diff --git a/CMakeLists.txt b/CMakeLists.txt index 07af3c2b416..bd47278112c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ endif() project(REACTOS) -#versioning +# Versioning include(include/reactos/version.cmake) # Don't escape preprocessor definition values added via add_definitions @@ -30,13 +30,16 @@ string(TOLOWER ${ARCH} ARCH) # Compile options if(ARCH MATCHES i386) - include(config.cmake) + include(cmake/config.cmake) elseif(ARCH MATCHES amd64) - include(config-amd64.cmake) + include(cmake/config-amd64.cmake) elseif(ARCH MATCHES arm) - include(config-arm.cmake) + include(cmake/config-arm.cmake) endif() +# Compiler flags handling +include(cmake/compilerflags.cmake) + add_definitions(-D__REACTOS__ -D__ROS_CMAKE__) if(NOT CMAKE_CROSSCOMPILING) @@ -44,24 +47,23 @@ if(NOT CMAKE_CROSSCOMPILING) add_definitions(-DTARGET_${ARCH}) if(MSVC) - add_definitions(-Dinline=__inline) + if(ARCH MATCHES i386) + add_definitions(/DWIN32 /D_WINDOWS) + endif() + add_definitions(/Dinline=__inline) else() - add_definitions(-fshort-wchar) + add_compiler_flags(-fshort-wchar) endif() - include_directories( - ${REACTOS_SOURCE_DIR}/tools/unicode - include - include/host - ${REACTOS_BINARY_DIR}/include) + include_directories(include/host) add_subdirectory(tools) add_subdirectory(lib) if(NOT MSVC) - export(TARGETS widl wrc gendib cabman cdmake mkhive spec2def geninc FILE ${CMAKE_BINARY_DIR}/ImportExecutables.cmake NAMESPACE native- ) + export(TARGETS widl wrc gendib cabman cdmake mkhive obj2bin spec2def geninc FILE ${CMAKE_BINARY_DIR}/ImportExecutables.cmake NAMESPACE native- ) else() - export(TARGETS gendib cabman cdmake mkhive spec2def geninc FILE ${CMAKE_BINARY_DIR}/ImportExecutables.cmake NAMESPACE native- ) + export(TARGETS gendib cabman cdmake mkhive obj2bin spec2def geninc FILE ${CMAKE_BINARY_DIR}/ImportExecutables.cmake NAMESPACE native- ) endif() else() @@ -72,9 +74,14 @@ else() set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER) - + #useful stuff! include(CMakeParseArguments) + + if(ENABLE_CCACHE) + set(CMAKE_C_USE_RESPONSE_FILE_FOR_INCLUDES OFF) + set(CMAKE_CXX_USE_RESPONSE_FILE_FOR_INCLUDES OFF) + endif() # Do some cleanup file(REMOVE @@ -93,25 +100,6 @@ else() set(IMPORT_EXECUTABLES "${REACTOS_BUILD_TOOLS_DIR}/ImportExecutables.cmake" CACHE FILEPATH "Host executables") include(${IMPORT_EXECUTABLES}) - # Compiler specific definitions and macros - if(MSVC) - include(msc.cmake) - else() - include(gcc.cmake) - endif() - - # Generic macros - include(CMakeMacros.cmake) - - # IDL macros for widl/midl - include(cmake/idl-support.cmake) - - # Activate support for assembly source files - enable_language(ASM) - - # Activate language support for resource files - enable_language(RC) - if(DBG) add_definitions(-DDBG=1 -D_SEH_ENABLE_TRACE) endif() @@ -150,19 +138,55 @@ else() add_definitions(-DUSE_COMPILER_EXCEPTIONS) endif() - include_directories( - include - include/psdk - include/dxsdk - ${REACTOS_BINARY_DIR}/include - ${REACTOS_BINARY_DIR}/include/dxsdk - ${REACTOS_BINARY_DIR}/include/psdk - ${REACTOS_BINARY_DIR}/include/reactos - include/crt - include/ddk - include/ndk - include/reactos - include/reactos/libs) + # Compiler specific definitions and macros + if(MSVC) + include(cmake/msvc.cmake) + else() + include(cmake/gcc.cmake) + endif() + + # Generic macros + include(cmake/CMakeMacros.cmake) + + # IDL macros for widl/midl + include(cmake/idl-support.cmake) + + # Activate support for assembly source files + enable_language(ASM) + + # Activate language support for resource files + enable_language(RC) + + if(MSVC AND USE_WDK_HEADERS) + include_directories( + include + $ENV{SDK_INC_PATH} + include/dxsdk + ${REACTOS_BINARY_DIR}/include + ${REACTOS_BINARY_DIR}/include/dxsdk + ${REACTOS_BINARY_DIR}/include/psdk + ${REACTOS_BINARY_DIR}/include/reactos + $ENV{CRT_INC_PATH} + $ENV{DDK_INC_PATH} + include/ndk + include/reactos + include/reactos/libs) + else() + include_directories( + include + include/psdk + include/dxsdk + ${REACTOS_BINARY_DIR}/include + ${REACTOS_BINARY_DIR}/include/dxsdk + ${REACTOS_BINARY_DIR}/include/psdk + ${REACTOS_BINARY_DIR}/include/reactos + include/crt + include/ddk + include/ndk + include/reactos + include/reactos/libs) + endif() + if(ARCH MATCHES arm) include_directories(${REACTOS_SOURCE_DIR}/include/reactos/arm) @@ -178,12 +202,11 @@ else() add_subdirectory(include/psdk) add_subdirectory(include/dxsdk) - add_subdirectory(include/reactos/idl) add_subdirectory(include/reactos/wine) add_subdirectory(include/reactos/mc) add_subdirectory(include/asm) - include(baseaddress.cmake) + include(cmake/baseaddress.cmake) #begin with boot so reactos_cab target is defined before all other modules add_subdirectory(boot) @@ -202,5 +225,4 @@ else() file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/importlibs) add_dependency_footer() - endif() diff --git a/CREDITS b/CREDITS index e967d823ad6..51567871763 100644 --- a/CREDITS +++ b/CREDITS @@ -58,6 +58,7 @@ Paolo Pantaleo Peter Ward Pierre Schweitzer Phillip Susi +Rafal Harabien Rex Jolliff Richard Campbell Robert Bergkvist diff --git a/ReactOS-generic.rbuild b/ReactOS-generic.rbuild index 9258f28d842..7b6d23a19a2 100644 --- a/ReactOS-generic.rbuild +++ b/ReactOS-generic.rbuild @@ -81,10 +81,7 @@ include/reactos/mc include/reactos/libs - include - include - include/reactos - include/reactos/wine + include/host -Wall diff --git a/ReactOS-i386.rbuild b/ReactOS-i386.rbuild index 5bfd52a6177..0cf26e14c75 100644 --- a/ReactOS-i386.rbuild +++ b/ReactOS-i386.rbuild @@ -30,6 +30,7 @@ -gstabs+ -fno-set-stack-executable -fno-optimize-sibling-calls + -fno-omit-frame-pointer -gstabs+ diff --git a/base/applications/CMakeLists.txt b/base/applications/CMakeLists.txt index 0540d69e2e3..e750c450507 100644 --- a/base/applications/CMakeLists.txt +++ b/base/applications/CMakeLists.txt @@ -4,7 +4,9 @@ add_subdirectory(calc) add_subdirectory(charmap) add_subdirectory(cmdutils) add_subdirectory(control) -add_subdirectory(dxdiag) +if(NOT MSVC) + add_subdirectory(dxdiag) # FIXME: msvc build. +endif() add_subdirectory(extrac32) add_subdirectory(findstr) add_subdirectory(fontview) @@ -16,7 +18,7 @@ add_subdirectory(logoff) add_subdirectory(magnify) add_subdirectory(mmc) add_subdirectory(mplay32) -# add_subdirectory(msconfig) +add_subdirectory(msconfig) add_subdirectory(mscutils) add_subdirectory(mstsc) add_subdirectory(network) diff --git a/base/applications/cacls/CMakeLists.txt b/base/applications/cacls/CMakeLists.txt index cfb03ed2377..b1fac988e48 100644 --- a/base/applications/cacls/CMakeLists.txt +++ b/base/applications/cacls/CMakeLists.txt @@ -4,11 +4,7 @@ set_rc_compiler() list(APPEND SOURCE cacls.c cacls.rc) -add_executable(cacls - ${CMAKE_CURRENT_BINARY_DIR}/cacls_precomp.h.gch - ${SOURCE}) - -add_pch(cacls ${CMAKE_CURRENT_SOURCE_DIR}/precomp.h ${SOURCE}) +add_executable(cacls ${SOURCE}) set_module_type(cacls win32cui) add_importlibs(cacls advapi32 user32 shell32 msvcrt kernel32) diff --git a/base/applications/cacls/lang/bg-BG.rc b/base/applications/cacls/lang/bg-BG.rc index 6e950e5e354..486feb734da 100644 --- a/base/applications/cacls/lang/bg-BG.rc +++ b/base/applications/cacls/lang/bg-BG.rc @@ -3,35 +3,35 @@ LANGUAGE LANG_BULGARIAN, SUBLANG_DEFAULT STRINGTABLE DISCARDABLE BEGIN -IDS_HELP, " (ACL ) \n\n\ -CACLS _ [/T] [/E] [/C] [/G : [...]] [/R [...]]\n\ - [/P : [...]] [/D [...]]\n\ - _ .\n\ - /T \n\ - . \n\ - /E , .\n\ - /C .\n\ - /G : .\n\ - : R \n\ - W \n\ - C ()\n\ - F \n\ - /R Revoke specified user's access rights (only valid with /E).\n\ - /P : .\n\ - : N \n\ - R \n\ - W \n\ - C ()\n\ - F \n\ - /D .\n\ - (* ?) ..\n\n\ -:\n\ - CI .\n\ - ACE .\n\ - OI ().\n\ - ACE .\n\ +IDS_HELP, "Показва или изменя списъците за достъп (ACL или СзД) до файловете\n\n\ +CACLS файлово_име [/T] [/E] [/C] [/G потребител:права [...]] [/R потребител [...]]\n\ + [/P потребител:права [...]] [/D име [...]]\n\ + файлово_име Показване на СзД.\n\ + /T Променя СзД на указаните файлове в\n\ + текущата папка и всички подпапки. \n\ + /E Промяна на СзД, вместо замяна.\n\ + /C Продължаване поради грешки поради отказ на достъп.\n\ + /G потребител:права Предоставяне на права на достъп на указания потребител.\n\ + Правата мога да са: R Четене\n\ + W Писане\n\ + C Промяна (писане)\n\ + F Всички права\n\ + /R потребител Revoke specified user's access rights (only valid with /E).\n\ + /P потребител:права Замяна на правата за достъп на потребителя.\n\ + Правата могат да са: N Без право на достъп\n\ + R Четене\n\ + W Писане\n\ + C Промяна (писане)\n\ + F Всички права \n\ + /D потребител Лишаване на потребител от достъп.\n\ +Могат да се използват заместващи знаци (* и ?) за указване на повече от един файл..\n\n\ +Съкращения:\n\ + CI – Онаследяване на съдържатели.\n\ + ACE ще бъде онаследен от папките.\n\ + OI – Онаследяване на предмети (обекти).\n\ + ACE ще бъде наследен от файловете.\n\ IO - Inherit Only.\n\ - ACE / .\n" + Няма да се прилага ACE върху текущия файл/ папка.\n" IDS_ABBR_CI, "(CI)" IDS_ABBR_OI, "(OI)" @@ -43,7 +43,7 @@ IDS_ABBR_CHANGE, "C" IDS_ABBR_NONE, "N" IDS_ALLOW, "" IDS_DENY, "(DENY)" -IDS_SPECIAL_ACCESS, "( :)" +IDS_SPECIAL_ACCESS, "(извънредни права:)" IDS_GENERIC_READ, "GENERIC_READ" IDS_GENERIC_WRITE, "GENERIC_WRITE" IDS_GENERIC_EXECUTE, "GENERIC_EXECUTE" diff --git a/base/applications/cacls/lang/ca-ES.rc b/base/applications/cacls/lang/ca-ES.rc index 7b492ff5032..db385d0ab1d 100644 --- a/base/applications/cacls/lang/ca-ES.rc +++ b/base/applications/cacls/lang/ca-ES.rc @@ -3,36 +3,36 @@ LANGUAGE LANG_CATALAN, SUBLANG_DEFAULT STRINGTABLE DISCARDABLE BEGIN -IDS_HELP, "Mostra o modifica la llista de control d'accs (ACLs) dels fitxers\n\n\ +IDS_HELP, "Mostra o modifica la llista de control d'accés (ACLs) dels fitxers\n\n\ CACLS fitxer [/T] [/E] [/C] [/G user:perm [...]] [/R usuari [...]]\n\ [/P user:perm [...]] [/D usuari [...]]\n\ fitxer Mostra ACLs.\n\ /T Canvia el ACLs dels fitxers especificats al\n\ directori actual i tots els seus subdirectoris.\n\ /E Edita ACL en comptes de substituir-lo.\n\ - /C Continua en cas d'error d'accs.\n\ - /G user:perm Assegura els drets d'accs especificats per al usuari.\n\ + /C Continua en cas d'error d'accés.\n\ + /G user:perm Assegura els drets d'accés especificats per al usuari.\n\ perm pot ser: R Lectura\n\ W Escriptura\n\ - C Modificaci (Escriptura)\n\ + C Modificació (Escriptura)\n\ F Control total\n\ - /R usuari Revoca els drets d'accs especificats per al usuari(noms vlid amb /E).\n\ - /P user:perm Canvia els drets d'accs especificats per al usuari.\n\ + /R usuari Revoca els drets d'accés especificats per al usuari(només vàlid amb /E).\n\ + /P user:perm Canvia els drets d'accés especificats per al usuari.\n\ perm pot ser: N Cap\n\ R Lectura\n\ W Escriptura\n\ - C Modificaci (Escriptura)\n\ + C Modificació (Escriptura)\n\ F Control total\n\ - /D usuari Denega els drets d'accs especificats per al usuari.\n\ -Es possible utilitzar comodins per especificar ms d'un fitxer per comanda.\n\ -Podeu especificar ms d'un usuari per comanda.\n\n\ + /D usuari Denega els drets d'accés especificats per al usuari.\n\ +Es possible utilitzar comodins per especificar més d'un fitxer per comanda.\n\ +Podeu especificar més d'un usuari per comanda.\n\n\ Abreviacions:\n\ CI - Container heredat.\n\ - ACE s'heredar per directoris.\n\ + ACE s'heredarà per directoris.\n\ OI - Objecte heredat.\n\ - ACE s'heredar per fitxers.\n\ - IO - Noms heredat.\n\ - ACE no s'aplicar al directori/fitxer actual.\n" + ACE s'heredarà per fitxers.\n\ + IO - Només heredat.\n\ + ACE no s'aplicarà al directori/fitxer actual.\n" IDS_ABBR_CI, "(CI)" IDS_ABBR_OI, "(OI)" @@ -44,7 +44,7 @@ IDS_ABBR_CHANGE, "C" IDS_ABBR_NONE, "N" IDS_ALLOW, "" IDS_DENY, "(DENEGAT)" -IDS_SPECIAL_ACCESS, "(accs especial:)" +IDS_SPECIAL_ACCESS, "(accés especial:)" IDS_GENERIC_READ, "GENERIC_READ" IDS_GENERIC_WRITE, "GENERIC_WRITE" IDS_GENERIC_EXECUTE, "GENERIC_EXECUTE" diff --git a/base/applications/cacls/lang/cs-CZ.rc b/base/applications/cacls/lang/cs-CZ.rc index 6d92a72470a..7f9fb2975f4 100644 --- a/base/applications/cacls/lang/cs-CZ.rc +++ b/base/applications/cacls/lang/cs-CZ.rc @@ -1,6 +1,7 @@ -/* FILE: applications/cacls/lang/cs-CZ.rc - * TRANSLATOR: Radek Liska aka Black_Fox (radekliska at gmail dot com) - * UPDATED: 2008-02-29 +/* + * FILE: base/applications/cacls/lang/cs-CZ.rc + * TRANSLATOR: Radek Liska aka Black_Fox (radekliska at gmail dot com) + * UPDATED: 2008-02-29 */ LANGUAGE LANG_CZECH, SUBLANG_DEFAULT @@ -8,37 +9,37 @@ LANGUAGE LANG_CZECH, SUBLANG_DEFAULT STRINGTABLE DISCARDABLE BEGIN -IDS_HELP, "Zobraz nebo zmn seznamy zen pstupu (ACL) k souborm\n\n\ -CACLS nzvu [/T] [/E] [/C] [/G uivatel:oprvnn [...]] [/R uivatel [...]]\n\ - [/P uivatel:oprvnn [...]] [/D uivatel [...]]\n\ - nzvu_soubori Zobraz ACL.\n\ - /T Zmn ACL urench soubor\n\ - v aktulnm adresi a vech podadresch.\n\ - /E Msto nahrazen ACL jej uprav.\n\ - /C Pi chybch odmtnut pstupu pokrauje.\n\ - /G uivatel:oprvnn Udl urenmu uivateli pstupov oprvnn.\n\ - Oprvnn me bt: R st\n\ +IDS_HELP, "Zobrazí nebo zmìní seznamy øízení pøístupu (ACL) k souborùm\n\n\ +CACLS názvu [/T] [/E] [/C] [/G uživatel:oprávnìní [...]] [/R uživatel [...]]\n\ + [/P uživatel:oprávnìní [...]] [/D uživatel [...]]\n\ + názvu_soubori Zobrazí ACL.\n\ + /T Zmìní ACL urèených souborù\n\ + v aktuálním adresáøi a všech podadresáøích.\n\ + /E Místo nahrazení ACL jej upraví.\n\ + /C Pøi chybách odmítnutí pøístupu pokraèuje.\n\ + /G uživatel:oprávnìní Udìlí urèenému uživateli pøístupová oprávnìní.\n\ + Oprávnìní mùže být: R Èíst\n\ W Zapisovat\n\ - C Mnit (zapisovat)\n\ - F pln zen\n\ - /R uivatel Odvol pstupov oprvnn urenho uivatele\n\ - (platn pouze s parametrem /E).\n\ - /P uivatel:oprvnn Nahrad pstupov oprvnn urenho uivatele.\n\ - Oprvnn me bt: N dn\n\ - R st\n\ + C Mìnit (zapisovat)\n\ + F Úplné øízení\n\ + /R uživatel Odvolá pøístupová oprávnìní urèeného uživatele\n\ + (platné pouze s parametrem /E).\n\ + /P uživatel:oprávnìní Nahradí pøístupová oprávnìní urèeného uživatele.\n\ + Oprávnìní mùže být: N Žádné\n\ + R Èíst\n\ W Zapisovat\n\ - C Mnit (zapisovat)\n\ - F pln zen\n\ - /D uivatel Odepe pstup urenmu uivateli.\n\ -Pro uren vce ne jednoho souboru mohou bt v pkazu pouity zstupn znaky.\n\ -V pkazu mete urit vce ne jednoho uivatele.\n\n\ + C Mìnit (zapisovat)\n\ + F Úplné øízení\n\ + /D uživatel Odepøe pøístup urèenému uživateli.\n\ +Pro urèení více než jednoho souboru mohou být v pøíkazu použity zástupné znaky.\n\ +V pøíkazu mùžete urèit více než jednoho uživatele.\n\n\ Zkratky:\n\ - CI - Ddit kontejner.\n\ - ACE bude ddno adresi.\n\ - OI - Ddit objekt.\n\ - ACE bude ddno soubory.\n\ - IO - Pouze ddit.\n\ - ACE se nepouije na aktuln adres i soubor.\n" + CI - Dìdit kontejner.\n\ + ACE bude dìdìno adresáøi.\n\ + OI - Dìdit objekt.\n\ + ACE bude dìdìno soubory.\n\ + IO - Pouze dìdit.\n\ + ACE se nepoužije na aktuální adresáø èi soubor.\n" IDS_ABBR_CI, "(CI)" IDS_ABBR_OI, "(OI)" @@ -50,7 +51,7 @@ IDS_ABBR_CHANGE, "C" IDS_ABBR_NONE, "N" IDS_ALLOW, "" IDS_DENY, "(DENY)" -IDS_SPECIAL_ACCESS, "(zvltn pstup:)" +IDS_SPECIAL_ACCESS, "(zvláštní pøístup:)" IDS_GENERIC_READ, "GENERIC_READ" IDS_GENERIC_WRITE, "GENERIC_WRITE" IDS_GENERIC_EXECUTE, "GENERIC_EXECUTE" diff --git a/base/applications/cacls/lang/da-DA.rc b/base/applications/cacls/lang/da-DA.rc index 7663dae602d..bf9ad4e5a4b 100644 --- a/base/applications/cacls/lang/da-DA.rc +++ b/base/applications/cacls/lang/da-DA.rc @@ -1,5 +1,5 @@ /* - * German language file by Daniel Reimer 2006-06-15 + * Danish language file by Daniel Reimer 2006-06-15 */ LANGUAGE LANG_DANISH, SUBLANG_DEFAULT @@ -7,28 +7,28 @@ LANGUAGE LANG_DANISH, SUBLANG_DEFAULT STRINGTABLE DISCARDABLE BEGIN -IDS_HELP, "ndringer fil-ACL'er (Access Control List) eller viser dem.\n\n\ +IDS_HELP, "Ændringer fil-ACL'er (Access Control List) eller viser dem.\n\n\ CACLS Filenavn [/T] [/E] [/C] [/G Bruger:Adgang] [/R Bruger [...]]\n\ [/P Bruger:Adgang [...]] [/D Bruger [...]]\n\ Filnavn Viser ACL'er for angivet filer.\n\ - /T ndre ACL'er for angivene filer i mapper\n\ + /T Ændre ACL'er for angivene filer i mapper\n\ og alle undermapper.\n\ /E Bearbejde ACL i stedet for at erstatte.\n\ /C Forandre ACL'er ved adgangfejl videre.\n\ /G Bruger:Adgang Tillade angivene adgangsformer.\n\ - Adgang kan vre: R lse\n\ + Adgang kan være: R læse\n\ W skrive\n\ - C ndre (At skrive)\n\ + C ændre (At skrive)\n\ F Fuld adgang\n\ /R Bruger Fjerne adgangsrette af brugeren (kun gyldig med /E).\n\ /P Bruger:Adgang Erstatte adgangsretterne af brugeren.\n\ - Adgang kan vre: N Ingen\n\ - R Lse\n\ + Adgang kan være: N Ingen\n\ + R Læse\n\ W Skrive\n\ - C ndre (Skrive)\n\ + C ændre (Skrive)\n\ F fuld adgang\n\ /D Bruger Forbyde adgang for brugeren.\n\ -Mellemrum(Wildcards) bliver understttet i filenavn.\n\ +Mellemrum(Wildcards) bliver understøttet i filenavn.\n\ Man kan angive flere bruger i en kommando.\n\n\ Forkortninger:\n\ CI - Container overtagelse.\n\ diff --git a/base/applications/cacls/lang/de-DE.rc b/base/applications/cacls/lang/de-DE.rc index 8efe17418db..c3feb90bff2 100644 --- a/base/applications/cacls/lang/de-DE.rc +++ b/base/applications/cacls/lang/de-DE.rc @@ -1,5 +1,5 @@ /* - * German language file by Daniel Reimer 2006-06-15 + * German language file by Daniel Reimer 2006-06-15 */ LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL @@ -7,30 +7,30 @@ LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL STRINGTABLE DISCARDABLE BEGIN -IDS_HELP, "ndert Datei-ACLs (Access Control List) oder zeigt sie an.\n\n\ +IDS_HELP, "Ändert Datei-ACLs (Access Control List) oder zeigt sie an.\n\n\ CACLS Dateiname [/T] [/E] [/C] [/G Benutzer:Zugriff] [/R Benutzer [...]]\n\ [/P Benutzer:Zugriff [...]] [/D Benutzer [...]]\n\ - Dateiname ACLs fr angegebene Datei anzeigen.\n\ + Dateiname ACLs für angegebene Datei anzeigen.\n\ /T ACLs der angegebenen Datei im aktuellen Verzeichnis\n\ - und allen Unterverzeichnissen ndern.\n\ + und allen Unterverzeichnissen ändern.\n\ /E ACL bearbeiten anstatt sie zu ersetzen.\n\ - /C ndern der ACLs bei Zugriffsverletzung fortsetzen.\n\ + /C Ändern der ACLs bei Zugriffsverletzung fortsetzen.\n\ /G Benutzer:Zugriff Angegebene Zugriffsarten zulassen.\n\ Zugriff kann sein: R Lesen\n\ W Schreiben\n\ - C ndern (Schreiben)\n\ + C Ändern (Schreiben)\n\ F Vollzugriff\n\ - /R Benutzer Zugriffsrechte des Benutzers aufheben (gltig mit /E).\n\ + /R Benutzer Zugriffsrechte des Benutzers aufheben (gültig mit /E).\n\ /P Benutzer:Zugriff Zugriffsrechte des Benutzers ersetzen.\n\ Zugriff kann sein: N Kein\n\ R Lesen\n\ W Schreiben\n\ - C ndern (Schreiben)\n\ + C Ändern (Schreiben)\n\ F Vollzugriff\n\ - /D Benutzer Zugriff fr Benutzer verweigern.\n\ -Platzhalterzeichen (Wildcards) werden fr Dateiname untersttzt.\n\ -Mehrere Benutzer knnen in einem Befehl angegeben werden.\n\n\ -Abkrzungen:\n\ + /D Benutzer Zugriff für Benutzer verweigern.\n\ +Platzhalterzeichen (Wildcards) werden für Dateiname unterstützt.\n\ +Mehrere Benutzer können in einem Befehl angegeben werden.\n\n\ +Abkürzungen:\n\ CI - Containervererbung.\n\ Der ACE-Eintrag wird von Verzeichnissen geerbt.\n\ OI - Objektvererbung.\n\ diff --git a/base/applications/cacls/lang/el-GR.rc b/base/applications/cacls/lang/el-GR.rc index 69a2196e502..22f8701f47c 100644 --- a/base/applications/cacls/lang/el-GR.rc +++ b/base/applications/cacls/lang/el-GR.rc @@ -3,36 +3,36 @@ LANGUAGE LANG_GREEK, SUBLANG_DEFAULT STRINGTABLE DISCARDABLE BEGIN -IDS_HELP, " access control lists (ACLs) \n\n\ -CACLS _ [/T] [/E] [/C] [/G : [...]] [/R [...]]\n\ - [/P : [...]] [/D [...]]\n\ - filename ACLs.\n\ - /T ACLs \n\ - .\n\ - /E ACL .n\ - /C .\n\ - /G : .\n\ - : R \n\ - W \n\ - C ()\n\ - F \n\ +IDS_HELP, "Εμφανίζει ή τροποποιεί τις access control lists (ACLs) των αρχείων\n\n\ +CACLS όνομα_αρχείου [/T] [/E] [/C] [/G χρήστης:άδειες [...]] [/R χρήστης [...]]\n\ + [/P χρήστης:άδειες [...]] [/D χρήστης [...]]\n\ + filename Εμφανίζει τις ACLs.\n\ + /T Αλλάζει τις ACLs των συγκκριμένων αρχείων στο\n\ + συγκεκριμένο φάκελο και σε όλους τους υποφακέλους.\n\ + /E Επεξεργάζεται την ACL αντίνα την αντικαταστήσει.n\ + /C Συνεχίζει και σε περίπτωση σφάλματος μη πρόσβασης.\n\ + /G χρήστης:άδειες Δίνει δικαιώματα στο χρήστη.\n\ + Οι άδειες μπορεί αν είναι: R Ανάγνωση\n\ + W Εγγραφή\n\ + C Αλαλγή (εγγραφή)\n\ + F Πλήρης έλεγχος\n\ /R user Revoke specified user's access rights (only valid with /E).\n\ - /P : .\n\ - : N \n\ - R \n\ - W \n\ - C ()\n\ - F \n\ - /D user .\n\ - Wildcards .\n\ - .\n\n\ + /P χρήστης:άδειες Αντικατάσταση των δικαιωμάτων του χρήστη.\n\ + Οι άδειες μπορεί να είναι: N Καμία\n\ + R Ανάγνωση\n\ + W Εγγραφή\n\ + C Αλλαγή (εγγραφή)\n\ + F Πλήρης έλεγχος\n\ + /D user Αποτροπή χρήστη από προσπέλαση.\n\ +Τα Wildcards μπορούν να χρησιμοποιηθούν για να προσδιορίσουν παραπαπάνω από ένα αρχεία στην εντολή.\n\ +Μπορείτε να προσδιορίσετε παρπαάνω από έναν χρήστη στην εντολή.\n\n\ Abbreviations:\n\ CI - Container Inherit.\n\ The ACE will be inherited by directories.\n\ OI - Object Inherit.\n\ The ACE will be inherited by files.\n\ IO - Inherit Only.\n\ - ACE /.\n" + Το ACE δεν υφίσταται για αυτό το αρχείο/κατάλογο.\n" IDS_ABBR_CI, "(CI)" IDS_ABBR_OI, "(OI)" @@ -44,7 +44,7 @@ IDS_ABBR_CHANGE, "C" IDS_ABBR_NONE, "N" IDS_ALLOW, "" IDS_DENY, "(DENY)" -IDS_SPECIAL_ACCESS, "( :)" +IDS_SPECIAL_ACCESS, "(ειδική άδεια:)" IDS_GENERIC_READ, "GENERIC_READ" IDS_GENERIC_WRITE, "GENERIC_WRITE" IDS_GENERIC_EXECUTE, "GENERIC_EXECUTE" diff --git a/base/applications/cacls/lang/es-ES.rc b/base/applications/cacls/lang/es-ES.rc index 37ff0bb2763..1cc8fd08b2d 100644 --- a/base/applications/cacls/lang/es-ES.rc +++ b/base/applications/cacls/lang/es-ES.rc @@ -10,29 +10,29 @@ CACLS archivo [/T] [/E] [/C] [/G user:perm [...]] [/R usuario [...]]\n\ /T Cambia ACLs de los archivos especificados en\n\ el directorio actual y todos sus subdirectorios.\n\ /E Edita la ACL en lugar de reemplazarla.\n\ - /C Contina en caso de errores de acceso.\n\ + /C Continúa en caso de errores de acceso.\n\ /G user:perm Da los derechos de acceso al usuario especificado.\n\ Perm puede ser: R Lectura\n\ W Escritura\n\ - C Modificacin (Escritura)\n\ + C Modificación (Escritura)\n\ F Control total\n\ - /R usuario Revoca los derechos de acceso al usuario especificado (unicamente vlido con /E).\n\ + /R usuario Revoca los derechos de acceso al usuario especificado (unicamente válido con /E).\n\ /P user:perm Reemplaza los derechos de acceso del usuario especificado.\n\ Perm puede ser: N Nada\n\ R Lectura\n\ W Escritura\n\ - C Modificacin (Escritura)\n\ + C Modificación (Escritura)\n\ F Control total\n\ /D usuario Revoca el acceso al usuario especificado.\n\ -Es posible usar comodines para especificar ms de un archivo por comando.\n\ -Se puede especificar ms de un usuario por comando.\n\n\ +Es posible usar comodines para especificar más de un archivo por comando.\n\ +Se puede especificar más de un usuario por comando.\n\n\ Abreviaciones:\n\ CI - Herencia del contenedor.\n\ - ACE ser heredado a los directorios.\n\ + ACE será heredado a los directorios.\n\ OI - Herencia del objeto.\n\ ACE sera heredado a los archivos.\n\ IO - Herencia sola.\n\ - ACE no se aplicar al archivo/directorio actual.\n" + ACE no se aplicará al archivo/directorio actual.\n" IDS_ABBR_CI, "(CI)" IDS_ABBR_OI, "(OI)" diff --git a/base/applications/cacls/lang/fr-FR.rc b/base/applications/cacls/lang/fr-FR.rc index 114acca4adb..b3de320022d 100644 --- a/base/applications/cacls/lang/fr-FR.rc +++ b/base/applications/cacls/lang/fr-FR.rc @@ -3,36 +3,36 @@ LANGUAGE LANG_FRENCH, SUBLANG_NEUTRAL STRINGTABLE DISCARDABLE BEGIN -IDS_HELP, "Affiche ou change la liste des contrles d'accs (ACLs) de fichiers\n\n\ +IDS_HELP, "Affiche ou change la liste des contrôles d'accès (ACLs) de fichiers\n\n\ CACLS nomfichier [/T] [/E] [/C] [/G user:perm [...]] [/R user [...]]\n\ [/P user:perm [...]] [/D user [...]]\n\ nomfichier Affiche les ACLs du fichier.\n\ - /T Change les ACLs des fichiers spcifis dans\n\ - le rpertoire en cours et tous les sous-rpertoires.\n\ - /E dite les ACL au lieu de les remplacer.\n\ - /C Continuer en cas de refus d'accs.\n\ - /G user:perm Accorder des droits d'accs l'utilisateur spcifi.\n\ + /T Change les ACLs des fichiers spécifiés dans\n\ + le répertoire en cours et tous les sous-répertoires.\n\ + /E Édite les ACL au lieu de les remplacer.\n\ + /C Continuer en cas de refus d'accès.\n\ + /G user:perm Accorder des droits d'accès à l'utilisateur spécifié.\n\ Perm peut valoir : R Lecture\n\ - W criture\n\ - C Modification (criture)\n\ - F Contrle total\n\ - /R user Supprime les droits d'accs de l'utilisateur spcifi (valide uniquement avec /E).\n\ - /P user:perm Remplace les droits d'accs de l'utilisateur spcifi.\n\ + W Écriture\n\ + C Modification (Écriture)\n\ + F Contrôle total\n\ + /R user Supprime les droits d'accès de l'utilisateur spécifié (valide uniquement avec /E).\n\ + /P user:perm Remplace les droits d'accès de l'utilisateur spécifié.\n\ Perm peut valoir : N Aucun \n\ R Lecture\n\ - W criture\n\ - C Modification (criture)\n\ - F Contrle total\n\ - /D user Interdit l'accs l'utilisateur spcifi.\n\ -Il est possible d'utiliser des caractres joker pour slectionner plus d'un fichier avec une commande.\n\ -Il est possible de spcifier plus d'un utilisateur dans une commande.\n\n\ -Abrviations:\n\ - CI - Hritage du conteneur.\n\ - Le ACE sera appliqu aux rpertoires.\n\ - OI - Hritage de l'objet.\n\ - Le ACE sera appliqu aux fichiers.\n\ - IO - Hritage seul.\n\ - Le ACE ne sera pas appliqu au fichier/rpertoire actuel.\n" + W Écriture\n\ + C Modification (Écriture)\n\ + F Contrôle total\n\ + /D user Interdit l'accès à l'utilisateur spécifié.\n\ +Il est possible d'utiliser des caractères joker pour sélectionner plus d'un fichier avec une commande.\n\ +Il est possible de spécifier plus d'un utilisateur dans une commande.\n\n\ +Abréviations:\n\ + CI - Héritage du conteneur.\n\ + Le ACE sera appliqué aux répertoires.\n\ + OI - Héritage de l'objet.\n\ + Le ACE sera appliqué aux fichiers.\n\ + IO - Héritage seul.\n\ + Le ACE ne sera pas appliqué au fichier/répertoire actuel.\n" IDS_ABBR_CI, "(CI)" IDS_ABBR_OI, "(OI)" @@ -44,7 +44,7 @@ IDS_ABBR_CHANGE, "C" IDS_ABBR_NONE, "N" IDS_ALLOW, "" IDS_DENY, "(REFUS)" -IDS_SPECIAL_ACCESS, "(Accs Spcial:)" +IDS_SPECIAL_ACCESS, "(Accès Spécial:)" IDS_GENERIC_READ, "GENERIC_READ" IDS_GENERIC_WRITE, "GENERIC_WRITE" IDS_GENERIC_EXECUTE, "GENERIC_EXECUTE" diff --git a/base/applications/cacls/lang/it-IT.rc b/base/applications/cacls/lang/it-IT.rc index c47e99f9688..b9993fd286b 100644 --- a/base/applications/cacls/lang/it-IT.rc +++ b/base/applications/cacls/lang/it-IT.rc @@ -26,14 +26,14 @@ CACLS nomefile [/T] [/E] [/C] [/G utente:perm [...]] [/R utente [...]]\n\ F Controllo completo\n\ /D utente Nega l'accesso all'utente indicato.\n\ I caratteri jolly possono essere usati per indicare piu' di un file in un comando.\n\ -Si pu indicare piu' di un utente in un comando.\n\n\ +Si può indicare piu' di un utente in un comando.\n\n\ Abbreviazioni:\n\ CI - Contenitore eredita.\n\ - ACE verr ereditato dalle cartelle.\n\ + ACE verrà ereditato dalle cartelle.\n\ OI - Oggetto eredita.\n\ - ACE verr ereditato dai file.\n\ + ACE verrà ereditato dai file.\n\ IO - Solo eredi.\n\ - ACE non applicato ai file/cartelle correnti.\n" + ACE non è applicato ai file/cartelle correnti.\n" IDS_ABBR_CI, "(CI)" IDS_ABBR_OI, "(OI)" diff --git a/base/applications/cacls/lang/ja-JP.rc b/base/applications/cacls/lang/ja-JP.rc index 3816fe4d94f..a52cbff4872 100644 --- a/base/applications/cacls/lang/ja-JP.rc +++ b/base/applications/cacls/lang/ja-JP.rc @@ -3,40 +3,40 @@ LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT STRINGTABLE DISCARDABLE BEGIN -IDS_HELP, "t@C̃ANZX䃊Xg(ACL) \\܂͕ύX܂B\n\n\ -CACLS t@C [/T] [/E] [/C] [/G [U[:ANZX]\n\ - [/R [U[ [...]] [/P [U[:ANZX [...]]\n\ - [/D [U[ [...]]\n\ - t@C ACL \\܂B\n\ - /T ݂̃fBNgƂׂẴTufBNgɂ\n\ - w肳ꂽt@C ACL ύX܂B\n\ - /E ACL uɁAACL ҏW܂B\n\ - /C ANZXۃG[𖳎āAACL ̕ύX𑱍s܂B\n\ - /G [U[:ANZX\n\ - w肳ꂽ[U[ɃANZX^܂B\n\ - ANZX: R ǂݎ\n\ - W \n\ - C ύX ()\n\ - F t Rg[\n\ - /R [U[ w肳ꂽ[U[̃ANZX܂B\n\ - (/E IvVƋɎgp)B\n\ - /P [U[:ANZX\n\ - w肳ꂽ[U[̃ANZXu܂B\n\ - ANZX: N Ȃ\n\ - W \n\ - R ǂݎ\n\ - C ύX ()\n\ - F t Rg[\n\ - /D [U[ w肳ꂽ[U[̃ANZXۂ܂B\n\ -̃t@Cw肷ɂ́AChJ[hgpł܂B\n\ -̃[U[wł܂B\n\n\ -ȗ`:\n\ - CI - ReipB\n\ - ACE ̓fBNgɌp܂B\n\ - OI - IuWFNgpB\n\ - ACE ̓t@CɌp܂B\n\ - IO - p̂݁B\n\ - ACE ݂͌̃t@C/fBNgɓKp܂B\n" +IDS_HELP, "ファイルのアクセス制御リスト(ACL) を表\示または変更します。\n\n\ +CACLS ファイル名 [/T] [/E] [/C] [/G ユーザー名:アクセス権]\n\ + [/R ユーザー名 [...]] [/P ユーザー名:アクセス権 [...]]\n\ + [/D ユーザー名 [...]]\n\ + ファイル名 ACL を表\示します。\n\ + /T 現在のディレクトリとすべてのサブディレクトリにある\n\ + 指定されたファイルの ACL を変更します。\n\ + /E ACL を置き換えずに、ACL を編集します。\n\ + /C アクセス拒否エラーを無視して、ACL の変更を続行します。\n\ + /G ユーザー名:アクセス権\n\ + 指定されたユーザーにアクセス権を与えます。\n\ + アクセス権: R 読み取り\n\ + W 書き込み\n\ + C 変更 (書き込み)\n\ + F フル コントロール\n\ + /R ユーザー名 指定されたユーザーのアクセス権を失効させます。\n\ + (/E オプションと共に使用)。\n\ + /P ユーザー名:アクセス権\n\ + 指定されたユーザーのアクセス権を置き換えます。\n\ + アクセス権: N なし\n\ + W 書き込み\n\ + R 読み取り\n\ + C 変更 (書き込み)\n\ + F フル コントロール\n\ + /D ユーザー名 指定されたユーザーのアクセスを拒否します。\n\ +複数のファイルを指定するには、ワイルドカードを使用できます。\n\ +複数のユーザーを指定できます。\n\n\ +省略形:\n\ + CI - コンテナ継承。\n\ + ACE はディレクトリに継承されます。\n\ + OI - オブジェクト継承。\n\ + ACE はファイルに継承されます。\n\ + IO - 継承のみ。\n\ + ACE は現在のファイル/ディレクトリに適用されません。\n" IDS_ABBR_CI, "(CI)" IDS_ABBR_OI, "(OI)" diff --git a/base/applications/cacls/lang/ko-KR.rc b/base/applications/cacls/lang/ko-KR.rc index f8abfcecd54..2f8211a456c 100644 --- a/base/applications/cacls/lang/ko-KR.rc +++ b/base/applications/cacls/lang/ko-KR.rc @@ -1,41 +1,42 @@ /* - *Korean translation by manatails007(www.manatails007.org) + * Korean translation by manatails007 (www.manatails007.org) */ + LANGUAGE LANG_KOREAN, SUBLANG_DEFAULT STRINGTABLE DISCARDABLE BEGIN -IDS_HELP, "׼ Ʈ Ʈ(ACLs), \n\n\ -CACLS ϸ [/T] [/E] [/C] [/G user:perm [...]] [/R user [...]]\n\ +IDS_HELP, "액세스 컨트롤 리스트(ACLs)보기, 수정\n\n\ +CACLS 파일명 [/T] [/E] [/C] [/G user:perm [...]] [/R user [...]]\n\ [/P user:perm [...]] [/D user [...]]\n\ - ϸ ACL ǥ\n\ - /T ACL ü\n\ - 丮 丮 \n\ - /E üϴ ACL \n\ - /C ߻ \n\ - /G user:perm ׼ ֱ\n\ - Perm : R б\n\ - W \n\ - C \n\ - F \n\ - /R user (/E ).\n\ - /P user:perm ü\n\ - Perm : N \n\ - R б\n\ - W \n\ - C ()\n\ - F \n\ - /D user ׼ \n\ -ϳ ̻ ϵī \n\ - 밡\n\n\ -Ű:\n\ + 파일명 ACL 표시\n\ + /T 파일의 ACL 대체\n\ + 현 디렉토리와 하위 디렉토리까지 포함\n\ + /E 대체하는 대신 ACL 수정\n\ + /C 권한 없음 에러 발생시 무시\n\ + /G user:perm 유저에게 액세스 권한 주기\n\ + Perm 은: R 읽기전용\n\ + W 쓰기\n\ + C 수정\n\ + F 모든 권한\n\ + /R user 유저의 권한 뺏기 (/E와 같이 사용).\n\ + /P user:perm 권한 대체\n\ + Perm 은: N 없음\n\ + R 읽기\n\ + W 쓰기\n\ + C 수정(쓰기)\n\ + F 모든권한\n\ + /D user 액세스 제한\n\ +하나 이상의 파일을 열기 위해 와일드카드 사용 가능\n\ +복수유저 동시 사용가능\n\n\ +단축키:\n\ CI - Container Inherit.\n\ - ACE 丮 \n\ + ACE를 디렉토리에 적용\n\ OI - Object Inherit.\n\ - ACE Ͽ \n\ + ACE를 파일에 적용\n\ IO - Inherit Only.\n\ - ACE \n" + ACE적용 안함\n" IDS_ABBR_CI, "(CI)" IDS_ABBR_OI, "(OI)" diff --git a/base/applications/cacls/lang/no-NO.rc b/base/applications/cacls/lang/no-NO.rc index 9c5263d3ac1..55d1a64e452 100644 --- a/base/applications/cacls/lang/no-NO.rc +++ b/base/applications/cacls/lang/no-NO.rc @@ -8,10 +8,10 @@ CACLS filnavn [/T] [/E] [/C] [/G bruker:perm [...]] [/R user [...]]\n\ [/P bruker:perm [...]] [/D bruker [...]]\n\ filnavn Viser ACL.\n\ /T Endrer ACL av spesifiserte filer i\n\ - nvrende katalog og alle under-mapper.\n\ + nåværende katalog og alle under-mapper.\n\ /E Rediger ACL isteden for erstatte det.\n\ - /C Fortsett p tilgang nektet feiler.\n\ - /G user:perm Innrmme spesifiert bruker tilgang rettigheter.\n\ + /C Fortsett på tilgang nektet feiler.\n\ + /G user:perm Innrømme spesifiert bruker tilgang rettigheter.\n\ Perm kan bli: L Les\n\ S Skriv\n\ E Endre (skriv)\n\ @@ -23,8 +23,8 @@ CACLS filnavn [/T] [/E] [/C] [/G bruker:perm [...]] [/R user [...]]\n\ S Skrive\n\ E Endre (skriv)\n\ F Full kontroll\n\ - /D bruker Avsl spesifisert bruker tilgang.\n\ -Wildcards kan bli brukt for spesifisere mere enn en fil i en kommando.\n\ + /D bruker Avslå spesifisert bruker tilgang.\n\ +Wildcards kan bli brukt for å spesifisere mere enn en fil i en kommando.\n\ Du kan spesifisere mere enn en bruker i en kommando.\n\n\ Forkortelse:\n\ CI - Container Inherit.\n\ @@ -32,7 +32,7 @@ Forkortelse:\n\ OI - Object Inherit.\n\ ACE will be inherited by files.\n\ IO - Inherit Only.\n\ - ACE gjelder ikke til nvrende fil/katalog.\n" + ACE gjelder ikke til nåværende fil/katalog.\n" IDS_ABBR_CI, "(CI)" IDS_ABBR_OI, "(OI)" @@ -47,24 +47,24 @@ IDS_DENY, "(NEKTE)" IDS_SPECIAL_ACCESS, "(spesiell tilgang:)" IDS_GENERIC_READ, "GENERISK_LESE" IDS_GENERIC_WRITE, "GENERISK_SKRIVE" -IDS_GENERIC_EXECUTE, "GENERISK_KJRE" +IDS_GENERIC_EXECUTE, "GENERISK_KJØRE" IDS_GENERIC_ALL, "GENERISK_ALT" -IDS_FILE_GENERIC_EXECUTE, "FIL_GENERISK_KJRE" +IDS_FILE_GENERIC_EXECUTE, "FIL_GENERISK_KJØRE" IDS_FILE_GENERIC_READ, "FIL_GENERISK_LESE" IDS_FILE_GENERIC_WRITE, "FIL_GENERISK_SKRIVE" IDS_FILE_READ_DATA, "FIL_LES_DATA" IDS_FILE_WRITE_DATA, "FIL_SKRIV_DATA" -IDS_FILE_APPEND_DATA, "FIL_TILFYE_DATA" +IDS_FILE_APPEND_DATA, "FIL_TILFØYE_DATA" IDS_FILE_READ_EA, "FIL_LESE_EA" IDS_FILE_WRITE_EA, "FIL_SKRIVE_EA" -IDS_FILE_EXECUTE, "FIL_KJRE" +IDS_FILE_EXECUTE, "FIL_KJØRE" IDS_FILE_DELETE_CHILD, "FIL_SLETT_BARN" IDS_FILE_READ_ATTRIBUTES, "FIL_LESE_ATTRIBUTTER" IDS_FILE_WRITE_ATTRIBUTES, "FIL_SKRIVE_ATTRIBUTTER" IDS_MAXIMUM_ALLOWED, "MAKSIMUM_TILATT" IDS_ACCESS_SYSTEM_SECURITY, "TILGANG_SYSTEM_SIKKERHET" IDS_SPECIFIC_RIGHTS_ALL, "SPESIFIKT_RETTIGHETER_ALT" -IDS_STANDARD_RIGHTS_REQUIRED, "STANDARD_RETTIGHETER_PBUDT" +IDS_STANDARD_RIGHTS_REQUIRED, "STANDARD_RETTIGHETER_PÅBUDT" IDS_SYNCHRONIZE, "SYNKRONISERE" IDS_WRITE_OWNER, "SKRIVE_EIER" IDS_WRITE_DAC, "SKRIVE_DAC" diff --git a/base/applications/cacls/lang/pt-BR.rc b/base/applications/cacls/lang/pt-BR.rc index 4e21b93c2e3..c518a1578d6 100644 --- a/base/applications/cacls/lang/pt-BR.rc +++ b/base/applications/cacls/lang/pt-BR.rc @@ -1,40 +1,42 @@ +/* UTF-8 Conversion: Elton Chung aka MfldElton (June, 2011) */ + LANGUAGE LANG_PORTUGUESE, SUBLANG_NEUTRAL STRINGTABLE DISCARDABLE BEGIN IDS_HELP, "Exibe ou modifica as listas de controle de acesso (ACLs) de arquivos\n\n\ -CACLS nome-arquivo [/T] [/E] [/C] [/G usurio:perm] [/R usurio [...]]\n\ - [/P usurio:perm [...]] [/D usurio [...]]\n\ +CACLS nome-arquivo [/T] [/E] [/C] [/G usuário:perm] [/R usuário [...]]\n\ + [/P usuário:perm [...]] [/D usuário [...]]\n\ nome-arquivo Exibe ACLs.\n\ /T Altera ACLs de arquivos especificados\n\ na pasta atual e em todas as subpastas.\n\ - /E Edita ACL em vez de substitu-la.\n\ + /E Edita ACL em vez de substituí-la.\n\ /C Continua ao encontrar erros de acesso negado.\n\ - /G usurio:perm Concede os direitos de acesso ao usurio especificado.\n\ + /G usuário:perm Concede os direitos de acesso ao usuário especificado.\n\ Perm pode ser: R Ler\n\ W Gravar\n\ C Alterar (gravar)\n\ F Controle total\n\ - /R usurio Revoga os direitos de acesso do usurio especificado\n\ - (vlido somente com /E).\n\ - /P usurio:perm Substitui os direitos de acesso do usurio especificado.\n\ + /R usuário Revoga os direitos de acesso do usuário especificado\n\ + (válido somente com /E).\n\ + /P usuário:perm Substitui os direitos de acesso do usuário especificado.\n\ Perm pode ser: N Nenhum\n\ R Ler\n\ W Gravar\n\ C Alterar (gravar)\n\ F Controle total\n\ - /D usurio Nega o acesso ao usurio especificado.\n\ + /D usuário Nega o acesso ao usuário especificado.\n\ Caracteres curinga podem ser usados para especificar mais de um arquivo\n\ em um comando.\n\ -Voc pode especificar mais de um usurio em um comando.\n\n\ -Abreviaes:\n\ - CI - Herana de recipiente.\n\ - O ACE ser herdado pelas pastas.\n\ - OI - Herana de objeto.\n\ - O ACE ser herdado pelos arquivos.\n\ - IO - Somente herana.\n\ - O ACE no se aplica ao arquivo/pasta atual.\n" +Você pode especificar mais de um usuário em um comando.\n\n\ +Abreviaçäes:\n\ + CI - Herança de recipiente.\n\ + O ACE será herdado pelas pastas.\n\ + OI - Herança de objeto.\n\ + O ACE será herdado pelos arquivos.\n\ + IO - Somente herança.\n\ + O ACE não se aplica ao arquivo/pasta atual.\n" IDS_ABBR_CI, "(CI)" IDS_ABBR_OI, "(OI)" diff --git a/base/applications/cacls/lang/ru-RU.rc b/base/applications/cacls/lang/ru-RU.rc index ac875ccd8ad..c15aa532d9d 100644 --- a/base/applications/cacls/lang/ru-RU.rc +++ b/base/applications/cacls/lang/ru-RU.rc @@ -3,37 +3,37 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT STRINGTABLE DISCARDABLE BEGIN -IDS_HELP, " (ACLs) \n\n\ -CACLS _ [/T] [/E] [/C] [/G : [...]] [/R [...]]\n\ - [/P :[...]] [/D [...]]\n\ - _ ACL.\n\ - /T ACL \n\ - .\n\ - /E ACL .\n\ - /C .\n\ - /G : .\n\ - : R \n\ - W \n\ - C ()\n\ - F \n\ - /R \n\ - ( /E).\n\ - /P : .\n\ - : N \n\ - R \n\ - W \n\ - C ()\n\ - F \n\ - /D .\n\ - .\n\ - .\n\n\ -:\n\ - CI - .\n\ - ACE .\n\ - OI - .\n\ - ACE .\n\ - IO - .\n\ - ACE /.\n" +IDS_HELP, "Отображает или изменяет списки доступа (ACLs) к файлам\n\n\ +CACLS имя_Файла [/T] [/E] [/C] [/G имя:право [...]] [/R имя [...]]\n\ + [/P имя:право[...]] [/D имя [...]]\n\ + имя_файла Вывод списков ACL.\n\ + /T Замена списков ACL для указанных файлов в текущем каталоге\n\ + и всех подкаталогах.\n\ + /E Редактирование списка ACL вместо его замены.\n\ + /C Продолжать при ошибках отказа доступа.\n\ + /G имя:право Предоставление указанному пользователю прав доступа.\n\ + Право может быть: R Чтение\n\ + W Запись\n\ + C Изменение (запись)\n\ + F Полный контроль\n\ + /R имя Отозвать права доступа для указанного пользователя\n\ + (верно только с /E).\n\ + /P имя:право Заменить права указанного пользователя.\n\ + Право может быть: N Нет доступа\n\ + R Чтение\n\ + W Запись\n\ + C Изменение (запись)\n\ + F Полный доступ\n\ + /D имя Запретить доступ для указанного пользователя.\n\ +В команде можно использовать шаблоны для обработки более одного файла.\n\ +В команде можно указывать более одного пользователя.\n\n\ +Сокращения:\n\ + CI - Наследование контейнерами.\n\ + ACE будет унаследован папками.\n\ + OI - Наследование объектами.\n\ + ACE будет унаследован файлами.\n\ + IO - Только наследованное.\n\ + ACE не будет применён к данному файлу/папке.\n" IDS_ABBR_CI, "(CI)" IDS_ABBR_OI, "(OI)" @@ -45,7 +45,7 @@ IDS_ABBR_CHANGE, "C" IDS_ABBR_NONE, "N" IDS_ALLOW, "" IDS_DENY, "(DENY)" -IDS_SPECIAL_ACCESS, "( :)" +IDS_SPECIAL_ACCESS, "(специальный доступ:)" IDS_GENERIC_READ, "GENERIC_READ" IDS_GENERIC_WRITE, "GENERIC_WRITE" IDS_GENERIC_EXECUTE, "GENERIC_EXECUTE" diff --git a/base/applications/cacls/lang/sk-SK.rc b/base/applications/cacls/lang/sk-SK.rc index 0edb2175eac..79e038ea71e 100644 --- a/base/applications/cacls/lang/sk-SK.rc +++ b/base/applications/cacls/lang/sk-SK.rc @@ -1,44 +1,46 @@ -//Slovak language file by Mrio Kamr aka Kario (kario@szm.sk) 16-01-2008 +/* + * Slovak language file by Mário Kačmár aka Kario (kario@szm.sk) 16-01-2008 + */ LANGUAGE LANG_SLOVAK, SUBLANG_DEFAULT STRINGTABLE DISCARDABLE BEGIN -IDS_HELP, "Zobraz alebo zmen zoznamy prstupovch prv (Access Control List) sborov.\n\n\ -CACLS nzov_sboru [/T] [/E] [/C] [/G pouvate:povolenia [...]]\n\ - [/R pouvate [...]] [/P pouvate:povolenia [...]]\n\ - [/D pouvate [...]]\n\ - nzov_sboru Zobraz zoznamy ACL.\n\ - /T Zmen zoznamy ACL pecifikovanch sborov\n\ - v aktulnom adresri a vo vetkch podadresroch.\n\ - /E Uprav zoznam ACL namiesto jeho nahradenia.\n\ - /C Pokraovanie pri chybch odmietnutia prstupu.\n\ - /G pouvate:povolenia\n\ - Udel pecifikovanmu pouvateovi prstupov prva.\n\ - Povolenia mu by: R tanie\n\ - W zpis\n\ - C zmena (zpis)\n\ - F pln prstup\n\ - /R pouvate Odoberie pecifikovanm pouvateom prstupov prva\n\ - (platn iba s prepnaom /E).\n\ - /P pouvate:povolenia\n\ - Nahrad pecifikovanm pouvateom prstupov prva.\n\ - Povolenia mu by: N iadne\n\ - R tanie\n\ - W zpis\n\ - C zmena (zpis)\n\ - F pln prstup\n\ - /D pouvate Odoprie pecifikovanmu pouvateovi prstup.\n\ -Nhradn znaky sa daj poui na pecifikovanie viacerch sborov v jednom\n\ -prkaze. Rovnako mete pecifikova aj viacerch pouvateov v prkaze.\n\n\ +IDS_HELP, "Zobrazí alebo zmení zoznamy prístupových práv (Access Control List) súborov.\n\n\ +CACLS názov_súboru [/T] [/E] [/C] [/G používateľ:povolenia [...]]\n\ + [/R používateľ [...]] [/P používateľ:povolenia [...]]\n\ + [/D používateľ [...]]\n\ + názov_súboru Zobrazí zoznamy ACL.\n\ + /T Zmení zoznamy ACL špecifikovaných súborov\n\ + v aktuálnom adresári a vo všetkých podadresároch.\n\ + /E Upraví zoznam ACL namiesto jeho nahradenia.\n\ + /C Pokračovanie pri chybách odmietnutia prístupu.\n\ + /G používateľ:povolenia\n\ + Udelí špecifikovanému používateľovi prístupové práva.\n\ + Povolenia môžu byť: R čítanie\n\ + W zápis\n\ + C zmena (zápis)\n\ + F úplný prístup\n\ + /R používateľ Odoberie špecifikovaným používateľom prístupové práva\n\ + (platné iba s prepínačom /E).\n\ + /P používateľ:povolenia\n\ + Nahradí špecifikovaným používateľom prístupové práva.\n\ + Povolenia môžu byť: N žiadne\n\ + R čítanie\n\ + W zápis\n\ + C zmena (zápis)\n\ + F úplný prístup\n\ + /D používateľ Odoprie špecifikovanému používateľovi prístup.\n\ +Náhradné znaky sa dajú použiť na špecifikovanie viacerých súborov v jednom\n\ +príkaze. Rovnako môžete špecifikovať aj viacerých používateľov v príkaze.\n\n\ Skratky:\n\ - CI - Kontajnerov dedenie.\n\ - ACE bude zdeden po adresroch.\n\ - OI - Objektov dedenie.\n\ - ACE bude zdeden po sboroch.\n\ - IO - Iba zdedi.\n\ - ACE sa neaplikuje na aktulny sbor alebo adresr.\n" + CI - Kontajnerové dedenie.\n\ + ACE bude zdedené po adresároch.\n\ + OI - Objektové dedenie.\n\ + ACE bude zdedené po súboroch.\n\ + IO - Iba zdediť.\n\ + ACE sa neaplikuje na aktuálny súbor alebo adresár.\n" IDS_ABBR_CI, "(CI)" IDS_ABBR_OI, "(OI)" @@ -50,7 +52,7 @@ IDS_ABBR_CHANGE, "C" IDS_ABBR_NONE, "N" IDS_ALLOW, "" IDS_DENY, "(DENY)" -IDS_SPECIAL_ACCESS, "(pecilny prstup:)" +IDS_SPECIAL_ACCESS, "(špeciálny prístup:)" IDS_GENERIC_READ, "GENERIC_READ" IDS_GENERIC_WRITE, "GENERIC_WRITE" IDS_GENERIC_EXECUTE, "GENERIC_EXECUTE" diff --git a/base/applications/cacls/lang/sv-SE.rc b/base/applications/cacls/lang/sv-SE.rc index 1984661ff60..e84cd92e6ad 100644 --- a/base/applications/cacls/lang/sv-SE.rc +++ b/base/applications/cacls/lang/sv-SE.rc @@ -1,44 +1,45 @@ /* - * PROJECT: ReactOS RAPPS - * FILE: \base\applications\cacls\lang\sv-SE.rc - * PURPOSE: Swedish resource file - * Translation: Jaix Bly + * PROJECT: ReactOS CACLS + * FILE: base/applications/cacls/lang/sv-SE.rc + * PURPOSE: Swedish resource file + * TRANSLATOR: Jaix Bly */ + LANGUAGE LANG_SWEDISH, SUBLANG_NEUTRAL STRINGTABLE DISCARDABLE BEGIN -IDS_HELP, "Visar eller ndrar rttighets-kontroll-listor (ACL) av filer\n\n\ -CACLS filnamn [/T] [/E] [/C] [/G anvndare:rttighet [...]] [/R anvndare [...]]\n\ - [/P anvndare:rttighet [...]] [/D anvndare [...]]\n\ +IDS_HELP, "Visar eller ändrar rättighets-kontroll-listor (ACL) av filer\n\n\ +CACLS filnamn [/T] [/E] [/C] [/G användare:rättighet [...]] [/R användare [...]]\n\ + [/P användare:rättighet [...]] [/D användare [...]]\n\ filnamn Visar ACL.\n\ - /T ndrer ACL av specificerade filer i\n\ + /T Ändrer ACL av specificerade filer i\n\ nuvarende katalog och alla undermapper.\n\ - /E Redigera ACL istllet fr ersttta den.\n\ - /C Fortstt vid nekad tkomst fel.\n\ - /G anvndare:rttighet Medge specificerad anvndar rttigheter.\n\ - rttighet kan vara: L Ls\n\ + /E Redigera ACL istället för erstätta den.\n\ + /C Fortsätt vid nekad åtkomst fel.\n\ + /G användare:rättighet Medge specificerad användar rättigheter.\n\ + rättighet kan vara: L Läs\n\ S Skriv\n\ - E ndra (skriv)\n\ + E Ändra (skriv)\n\ F Full kontroll\n\ - /R anvndare terkkalla specificerad anvndarrttighet (endast giltig med /E).\n\ - /P anvndare:rttighet Ersttt specificerad anvndar rttighet.\n\ - rttighet kan vara: I Ingen\n\ - L Ls\n\ + /R användare Återkkalla specificerad användarrättighet (endast giltig med /E).\n\ + /P användare:rättighet Erstätt specificerad användar rättighet.\n\ + rättighet kan vara: I Ingen\n\ + L Läs\n\ S Skrive\n\ - E ndra (skriv)\n\ + E Ändra (skriv)\n\ F Full kontroll\n\ - /D anvndare Avsl specificerad anvndare tillgng.\n\ -Wildcards kan anvndas fr att specificere mer n en fil i ett kommando.\n\ -Du kan spesifisere mere enn en anvndare i en kommando.\n\n\ -Frkortningar:\n\ + /D användare Avslå specificerad användare tillgång.\n\ +Wildcards kan användas för att specificere mer än en fil i ett kommando.\n\ +Du kan spesifisere mere enn en användare i en kommando.\n\n\ +Förkortningar:\n\ CI - Container Inherit.\n\ - ACE kommer att bli rvd av mappar.\n\ + ACE kommer att bli ärvd av mappar.\n\ OI - Object Inherit.\n\ - ACE kommer att bli rvd av filer.\n\ + ACE kommer att bli ärvd av filer.\n\ IO - Inherit Only.\n\ - ACE gller inte nuvarende fil/katalog.\n" + ACE gäller inte nuvarende fil/katalog.\n" IDS_ABBR_CI, "(CI)" IDS_ABBR_OI, "(OI)" @@ -50,31 +51,31 @@ IDS_ABBR_CHANGE, "C" IDS_ABBR_NONE, "N" IDS_ALLOW, "" IDS_DENY, "(NEKA)" -IDS_SPECIAL_ACCESS, "(speciell rttighet:)" -IDS_GENERIC_READ, "GENERISK_LSNING" +IDS_SPECIAL_ACCESS, "(speciell rättighet:)" +IDS_GENERIC_READ, "GENERISK_LÄSNING" IDS_GENERIC_WRITE, "GENERISK_SKRIVNING" -IDS_GENERIC_EXECUTE, "GENERISK_KRNING" +IDS_GENERIC_EXECUTE, "GENERISK_KÖRNING" IDS_GENERIC_ALL, "GENERISK_ALLT" -IDS_FILE_GENERIC_EXECUTE, "FIL_GENERISK_KJRE" -IDS_FILE_GENERIC_READ, "FIL_GENERISK_LSNING" +IDS_FILE_GENERIC_EXECUTE, "FIL_GENERISK_KJØRE" +IDS_FILE_GENERIC_READ, "FIL_GENERISK_LÄSNING" IDS_FILE_GENERIC_WRITE, "FIL_GENERISK_SKRIVNING" -IDS_FILE_READ_DATA, "FIL_LS_DATA" +IDS_FILE_READ_DATA, "FIL_LÄS_DATA" IDS_FILE_WRITE_DATA, "FIL_SKRIV_DATA" -IDS_FILE_APPEND_DATA, "FIL_TILLFRA_DATA" -IDS_FILE_READ_EA, "FIL_LS_EA" +IDS_FILE_APPEND_DATA, "FIL_TILLFÖRA_DATA" +IDS_FILE_READ_EA, "FIL_LÄS_EA" IDS_FILE_WRITE_EA, "FIL_SKRIVA_EA" -IDS_FILE_EXECUTE, "FIL_KRA" +IDS_FILE_EXECUTE, "FIL_KÖRA" IDS_FILE_DELETE_CHILD, "FIL_RADERA_BARN" -IDS_FILE_READ_ATTRIBUTES, "FIL_LSA_ATTRIBUT" +IDS_FILE_READ_ATTRIBUTES, "FIL_LÄSA_ATTRIBUT" IDS_FILE_WRITE_ATTRIBUTES, "FIL_SKRIVA_ATTRIBUT" -IDS_MAXIMUM_ALLOWED, "MAXIMALT_TILLTNA" -IDS_ACCESS_SYSTEM_SECURITY, "TILLGNG_SYSTEM_SKERHET" -IDS_SPECIFIC_RIGHTS_ALL, "SPECIFIKA_RTTIGHETER_ALLT" -IDS_STANDARD_RIGHTS_REQUIRED, "STANDARD_RTTIGHETER_KRVS" +IDS_MAXIMUM_ALLOWED, "MAXIMALT_TILLÅTNA" +IDS_ACCESS_SYSTEM_SECURITY, "TILLGÅNG_SYSTEM_SÄKERHET" +IDS_SPECIFIC_RIGHTS_ALL, "SPECIFIKA_RÄTTIGHETER_ALLT" +IDS_STANDARD_RIGHTS_REQUIRED, "STANDARD_RÄTTIGHETER_KRÄVS" IDS_SYNCHRONIZE, "SYNKRONISERA" -IDS_WRITE_OWNER, "SKRIVA_GARE" +IDS_WRITE_OWNER, "SKRIVA_ÄGARE" IDS_WRITE_DAC, "SKRIVA_DAC" -IDS_READ_CONTROL, "LSE_KONTROLL" +IDS_READ_CONTROL, "LÄSE_KONTROLL" IDS_DELETE, "RADERA" -IDS_STANDARD_RIGHTS_ALL, "STANDARD_RTTIGHETER_ALLT" +IDS_STANDARD_RIGHTS_ALL, "STANDARD_RÄTTIGHETER_ALLT" END diff --git a/base/applications/cacls/lang/uk-UA.rc b/base/applications/cacls/lang/uk-UA.rc index 16d21c05240..7c447c378a2 100644 --- a/base/applications/cacls/lang/uk-UA.rc +++ b/base/applications/cacls/lang/uk-UA.rc @@ -1,7 +1,7 @@ /* * PROJECT: ReactOS CACLS * LICENSE: GPL - See COPYING in the top level directory - * FILE: applications/cacls/lang/uk-UA.rc + * FILE: base/applications/cacls/lang/uk-UA.rc * PURPOSE: Ukraianian Language File for PROJECT * TRANSLATOR: Rostislav Zabolotny */ @@ -11,35 +11,35 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT STRINGTABLE DISCARDABLE BEGIN -IDS_HELP, "³ (ACLs) \n\n\ -CACLS '_ [/T] [/E] [/C] [/G : [...]] [/R [...]]\n\ - [/P : [...]] [/D [...]]\n\ - '_ ACL.\n\ - /T ACL \n\ - .\n\ - /E ACL .\n\ - /C .\n\ - /G : .\n\ - : R \n\ - W \n\ - C ()\n\ - F \n\ - /R ( /E).\n\ - /P : .\n\ - : R \n\ - W \n\ - C ()\n\ - F \n\ - /D .\n\ - .\n\ - .\n\n\ -:\n\ - CI - .(Container Inherit)\n\ - ACE .\n\ - OI - ' .(Object Inherit)\n\ - ACE .\n\ - IO - ҳ .(Inherit Only)\n\ - ACE /.\n" +IDS_HELP, "Відображає чи модифікує списки доступу (ACLs) до файлів\n\n\ +CACLS ім'я_файлу [/T] [/E] [/C] [/G користувач:права [...]] [/R користувач [...]]\n\ + [/P користувач:права [...]] [/D користувач [...]]\n\ + ім'я_файлу Виведення існуючих ACL.\n\ + /T Зміна ACL вказаних файлів в\n\ + поточній папці і всіх підпапках.\n\ + /E Редагування ACL замість заміни.\n\ + /C Продовження після помилок відмови в доступі.\n\ + /G користувач:права Надання вказаному користувачу певних прав.\n\ + Види прав: R Читати\n\ + W Записувати\n\ + C Змінювати (записувати)\n\ + F Повний доступ\n\ + /R користувач Скасувати права доступу вказаного користувача(корректно тільки з /E).\n\ + /P користувач:права Замінити вказані права користувача.\n\ + Види прав: R Читати\n\ + W Записувати\n\ + C Змінювати (записувати)\n\ + F Повний доступ\n\ + /D користувач Заборонити доступ вказаному користувачеві.\n\ +Можна використовувати шаблони для обробки більше ніж одного файлу за команду.\n\ +Можна вказувати більше ніж одного користувача за команду.\n\n\ +Скорочення:\n\ + CI - Контейнерне Успадкування.(Container Inherit)\n\ + ACE буде успадковуватися папками.\n\ + OI - Об'єктне Успадкування.(Object Inherit)\n\ + ACE буде успадковуватися файлами.\n\ + IO - Тільки Успадкування.(Inherit Only)\n\ + ACE не буде застосований для поточного файла/папки.\n" IDS_ABBR_CI, "(CI)" IDS_ABBR_OI, "(OI)" @@ -51,7 +51,7 @@ IDS_ABBR_CHANGE, "C" IDS_ABBR_NONE, "N" IDS_ALLOW, "" IDS_DENY, "(DENY)" -IDS_SPECIAL_ACCESS, "( :)" +IDS_SPECIAL_ACCESS, "(спеціальний доступ:)" IDS_GENERIC_READ, "GENERIC_READ" IDS_GENERIC_WRITE, "GENERIC_WRITE" IDS_GENERIC_EXECUTE, "GENERIC_EXECUTE" diff --git a/base/applications/cacls/lang/zh-CN.rc b/base/applications/cacls/lang/zh-CN.rc index 78577f43bb2..b33b6fdc897 100644 --- a/base/applications/cacls/lang/zh-CN.rc +++ b/base/applications/cacls/lang/zh-CN.rc @@ -1,6 +1,6 @@ /* * cacls (Simplified Chinese resources) - * (Դ) + * (简体中文资源) * Copyright 2007 zhangbing * * This program is free software; you can redistribute it and/or @@ -24,36 +24,36 @@ LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED STRINGTABLE DISCARDABLE BEGIN -IDS_HELP, "ʾ޸ļķʿƱ \n\n\ +IDS_HELP, "显示或者修改文件的访问控制表\n\n\ CACLS filename [/T] [/E] [/C] [/G user:perm [...]] [/R user [...]]\n\ [/P user:perm [...]] [/D user [...]]\n\ - filename ʾ ACLs\n\ - /T ĵǰĿ¼Ŀ¼\n\ - ָļ ACL\n\ - /E ༭ ACL 滻\n\ - /C ڳ־ܾʴʱ\n\ - /G user:perm ָûȨޡ\n\ - Perm : R ȡ \n\ - W д \n\ - C (д) \n\ - F ȫ \n\ - /R user ָûķȨ( /E һʹʱϷ)\n\ - /P user:perm 滻ָûķȨޡ\n\ - Perm : N \n\ - R ȡ \n\ - W д \n\ - C (д) \n\ - F ȫ \n\ - /D user ָܾûķʡ\n\ -пʹָͨļ\n\ -Ҳָû\n\n\ -д: \n\ - CI - ̳С\n\ - ACEĿ¼̳С\n\ - OI - ̳С\n\ - ACE ļ̳С\n\ - IO - ֻ̳С\n\ - ACE ڵǰļ/Ŀ¼\n" + filename 显示 ACLs。\n\ + /T 更改当前目录及其所有子目录中\n\ + 指定文件的 ACL。\n\ + /E 编辑 ACL 而不替换。\n\ + /C 在出现拒绝访问错误时继续。\n\ + /G user:perm 赋予指定用户访问权限。\n\ + Perm 可以是: R 读取\n\ + W 写入\n\ + C 更改(写入)\n\ + F 完全控制\n\ + /R user 撤销指定用户的访问权限(仅在与 /E 一起使用时合法)。\n\ + /P user:perm 替换指定用户的访问权限。\n\ + Perm 可以是: N 无\n\ + R 读取\n\ + W 写入\n\ + C 更改(写入)\n\ + F 完全控制\n\ + /D user 拒绝指定用户的访问。\n\ +在命令中可以使用通配符指定多个文件。\n\ +您也可以在命令中指定多个用户。\n\n\ +缩写: \n\ + CI - 容器继承。\n\ + ACE会由目录继承。\n\ + OI - 对象继承。\n\ + ACE 会由文件继承。\n\ + IO - 只继承。\n\ + ACE 不适用于当前文件/目录。\n" IDS_ABBR_CI, "(CI)" IDS_ABBR_OI, "(OI)" diff --git a/base/applications/cacls/lang/zh-TW.rc b/base/applications/cacls/lang/zh-TW.rc index 3529520aefe..965448695aa 100644 --- a/base/applications/cacls/lang/zh-TW.rc +++ b/base/applications/cacls/lang/zh-TW.rc @@ -1,6 +1,6 @@ /* * cacls (TRADITIONAL Chinese resources) - * (c餤귽) + * (繁體中文資源) * Copyright 2007 jauming * * This program is free software; you can redistribute it and/or @@ -24,36 +24,36 @@ LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL STRINGTABLE DISCARDABLE BEGIN -IDS_HELP, "ܩΪ̭ק󪺳Xݱ \n\n\ +IDS_HELP, "顯示或者修改文件的訪問控制表\n\n\ CACLS filename [/T] [/E] [/C] [/G user:perm [...]] [/R user [...]]\n\ [/P user:perm [...]] [/D user [...]]\n\ - filename ACLsC\n\ - /T eؿΨҦlؿ\n\ - w ACLC\n\ - /E s ACL ӤC\n\ - /C bX{ڵXݿ~~C\n\ - /G user:perm ᤩwΤXvC\n\ - Perm iHO: R Ū \n\ - W gJ \n\ - C (gJ) \n\ - F \n\ - /R user MPwΤ᪺Xv(ȦbO /E @_ϥήɦXk)C\n\ - /P user:perm wΤ᪺XvC\n\ - Perm iHO: N L \n\ - R Ū \n\ - W gJ \n\ - C (gJ) \n\ - F \n\ - /D user ڵwΤ᪺XݡC\n\ -bROiHϥγqtūwhӤC\n\ -z]iHbROwhӥΤC\n\n\ -Yg: \n\ - CI - e~ӡC\n\ - ACE|ѥؿ~ӡC\n\ - OI - H~ӡC\n\ - ACE |Ѥ~ӡC\n\ - IO - u~ӡC\n\ - ACE AΩe/ؿC\n" + filename 顯示 ACLs。\n\ + /T 更改當前目錄及其所有子目錄中\n\ + 指定文件的 ACL。\n\ + /E 編輯 ACL 而不替換。\n\ + /C 在出現拒絕訪問錯誤時繼續。\n\ + /G user:perm 賦予指定用戶訪問權限。\n\ + Perm 可以是: R 讀取\n\ + W 寫入\n\ + C 更改(寫入)\n\ + F 完全控制\n\ + /R user 撤銷指定用戶的訪問權限(僅在与 /E 一起使用時合法)。\n\ + /P user:perm 替換指定用戶的訪問權限。\n\ + Perm 可以是: N 無\n\ + R 讀取\n\ + W 寫入\n\ + C 更改(寫入) \n\ + F 完全控制 \n\ + /D user 拒絕指定用戶的訪問。\n\ +在命令中可以使用通配符指定多個文件。\n\ +您也可以在命令中指定多個用戶。\n\n\ +縮寫: \n\ + CI - 容器繼承。\n\ + ACE會由目錄繼承。\n\ + OI - 對象繼承。\n\ + ACE 會由文件繼承。\n\ + IO - 只繼承。\n\ + ACE 不適用於當前文件/目錄。\n" IDS_ABBR_CI, "(CI)" IDS_ABBR_OI, "(OI)" diff --git a/base/applications/cacls/rsrc.rc b/base/applications/cacls/rsrc.rc index 42db534254e..133603fd189 100644 --- a/base/applications/cacls/rsrc.rc +++ b/base/applications/cacls/rsrc.rc @@ -1,18 +1,22 @@ +#include "lang/en-US.rc" +#include "lang/id-ID.rc" +#include "lang/nl-NL.rc" + +// UTF-8 +#pragma code_page(65001) #include "lang/bg-BG.rc" -#include "lang/es-ES.rc" #include "lang/ca-ES.rc" #include "lang/cs-CZ.rc" #include "lang/da-DA.rc" #include "lang/de-DE.rc" #include "lang/el-GR.rc" -#include "lang/en-US.rc" +#include "lang/es-ES.rc" #include "lang/fr-FR.rc" -#include "lang/id-ID.rc" #include "lang/it-IT.rc" #include "lang/ja-JP.rc" #include "lang/ko-KR.rc" #include "lang/no-NO.rc" -#include "lang/nl-NL.rc" +#include "lang/pl-PL.rc" #include "lang/pt-BR.rc" #include "lang/ru-RU.rc" #include "lang/sk-SK.rc" @@ -20,7 +24,3 @@ #include "lang/uk-UA.rc" #include "lang/zh-CN.rc" #include "lang/zh-TW.rc" - -// UTF-8 -#pragma code_page(65001) -#include "lang/pl-PL.rc" diff --git a/base/applications/calc/CMakeLists.txt b/base/applications/calc/CMakeLists.txt index 3e1372e0752..9e28304922d 100644 --- a/base/applications/calc/CMakeLists.txt +++ b/base/applications/calc/CMakeLists.txt @@ -18,5 +18,5 @@ add_importlibs(calc advapi32 user32 gdi32 msvcrt kernel32) if(MSVC) add_importlibs(calc ntdll) endif() - +add_pch(calc calc.h) add_cd_file(TARGET calc DESTINATION reactos/system32 FOR all) diff --git a/base/applications/calc/calc.h b/base/applications/calc/calc.h index 1e645e75e84..3b36230b62a 100644 --- a/base/applications/calc/calc.h +++ b/base/applications/calc/calc.h @@ -1,4 +1,3 @@ -#pragma once #include #include diff --git a/base/applications/calc/calc.rbuild b/base/applications/calc/calc.rbuild index 325ab22970b..4cbc7869e3e 100644 --- a/base/applications/calc/calc.rbuild +++ b/base/applications/calc/calc.rbuild @@ -3,6 +3,7 @@ . 1 + msvcrt advapi32 gdi32 user32 @@ -13,4 +14,5 @@ utl.c winmain.c resource.rc + calc.h diff --git a/base/applications/calc/fun_mpfr.c b/base/applications/calc/fun_mpfr.c index e52193b6209..8d1534048a2 100644 --- a/base/applications/calc/fun_mpfr.c +++ b/base/applications/calc/fun_mpfr.c @@ -1,5 +1,4 @@ #include "calc.h" -#include void apply_int_mask(calc_number_t *r) { diff --git a/base/applications/calc/function.c b/base/applications/calc/function.c index 2da681ff26b..82bd6f46617 100644 --- a/base/applications/calc/function.c +++ b/base/applications/calc/function.c @@ -1,5 +1,4 @@ #include "calc.h" -#include void apply_int_mask(calc_number_t *r) { diff --git a/base/applications/calc/lang/bg-BG.rc b/base/applications/calc/lang/bg-BG.rc index 9fe90352987..71cb186ada3 100644 --- a/base/applications/calc/lang/bg-BG.rc +++ b/base/applications/calc/lang/bg-BG.rc @@ -1,33 +1,33 @@ -// +//Недовършен LANGUAGE LANG_BULGARIAN, SUBLANG_DEFAULT // Dialog IDD_DIALOG_SCIENTIFIC DIALOGEX 0, 0, 316, 161 STYLE DS_SHELLFONT | WS_MINIMIZEBOX | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Изчислителят на РеактОС" MENU IDR_MENU_SCIENTIFIC_1 FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN GROUPBOX "",IDC_STATIC,4,16,132,21 - CONTROL "",IDC_RADIO_HEX,"Button",BS_AUTORADIOBUTTON,8,24,29,10 - CONTROL "",IDC_RADIO_DEC,"Button",BS_AUTORADIOBUTTON,40,24,29,10 - CONTROL "",IDC_RADIO_OCT,"Button",BS_AUTORADIOBUTTON,72,24,27,10 - CONTROL "",IDC_RADIO_BIN,"Button",BS_AUTORADIOBUTTON,100,24,26,10 + CONTROL "Шстн",IDC_RADIO_HEX,"Button",BS_AUTORADIOBUTTON,8,24,29,10 + CONTROL "Дстн",IDC_RADIO_DEC,"Button",BS_AUTORADIOBUTTON,40,24,29,10 + CONTROL "Осм",IDC_RADIO_OCT,"Button",BS_AUTORADIOBUTTON,72,24,27,10 + CONTROL "Двоич",IDC_RADIO_BIN,"Button",BS_AUTORADIOBUTTON,100,24,26,10 GROUPBOX "",IDC_STATIC,4,36,76,21 - CONTROL "",IDC_CHECK_INV,"Button",BS_AUTOCHECKBOX | + CONTROL "Обр",IDC_CHECK_INV,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,44,26,10 - CONTROL "",IDC_CHECK_HYP,"Button",BS_AUTOCHECKBOX | + CONTROL "Хип",IDC_CHECK_HYP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,40,44,29,10 CTEXT "",IDC_TEXT_PARENT,84,40,24,17,SS_CENTERIMAGE, WS_EX_CLIENTEDGE CTEXT "",IDC_TEXT_MEMORY,112,40,24,17,SS_CENTERIMAGE, WS_EX_CLIENTEDGE - PUSHBUTTON "",IDC_BUTTON_STA,4,64,24,17,BS_CENTER | BS_VCENTER | + PUSHBUTTON "Стат",IDC_BUTTON_STA,4,64,24,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP - PUSHBUTTON "",IDC_BUTTON_AVE,4,83,24,17,BS_CENTER | BS_VCENTER | + PUSHBUTTON "Сред",IDC_BUTTON_AVE,4,83,24,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | WS_DISABLED | BS_OWNERDRAW | WS_TABSTOP - PUSHBUTTON "",IDC_BUTTON_SUM,4,102,24,17,BS_CENTER | BS_VCENTER | + PUSHBUTTON "Сбор",IDC_BUTTON_SUM,4,102,24,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | WS_DISABLED | BS_OWNERDRAW | WS_TABSTOP PUSHBUTTON "s",IDC_BUTTON_S,4,121,24,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | WS_DISABLED | BS_OWNERDRAW | WS_TABSTOP @@ -35,17 +35,17 @@ BEGIN BS_NOTIFY | WS_DISABLED | BS_OWNERDRAW | WS_TABSTOP PUSHBUTTON "F-E",IDC_BUTTON_FE,38,64,24,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP - PUSHBUTTON "",IDC_BUTTON_DMS,38,83,24,17,BS_CENTER | BS_VCENTER | + PUSHBUTTON "Гмс",IDC_BUTTON_DMS,38,83,24,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP - PUSHBUTTON "",IDC_BUTTON_SIN,38,102,24,17,BS_CENTER | BS_VCENTER | + PUSHBUTTON "син",IDC_BUTTON_SIN,38,102,24,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP - PUSHBUTTON "",IDC_BUTTON_COS,38,121,24,17,BS_CENTER | BS_VCENTER | + PUSHBUTTON "кос",IDC_BUTTON_COS,38,121,24,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP - PUSHBUTTON "",IDC_BUTTON_TAN,38,140,24,17,BS_CENTER | BS_VCENTER | + PUSHBUTTON "тан",IDC_BUTTON_TAN,38,140,24,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP PUSHBUTTON "(",IDC_BUTTON_LEFTPAR,64,64,24,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP - PUSHBUTTON "",IDC_BUTTON_EXP,64,83,24,17,BS_CENTER | BS_VCENTER | + PUSHBUTTON "експ",IDC_BUTTON_EXP,64,83,24,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP PUSHBUTTON "x^y",IDC_BUTTON_XeY,64,102,24,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP @@ -71,7 +71,7 @@ BEGIN BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP PUSHBUTTON "M+",IDC_BUTTON_MP,124,121,24,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP - PUSHBUTTON "",IDC_BUTTON_PI,124,140,24,17,BS_CENTER | BS_VCENTER | + PUSHBUTTON "пи",IDC_BUTTON_PI,124,140,24,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP PUSHBUTTON "7",IDC_BUTTON_7,158,64,24,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP @@ -113,25 +113,25 @@ BEGIN BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP PUSHBUTTON "D",IDC_BUTTON_D,236,140,24,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP - PUSHBUTTON "",IDC_BUTTON_MOD,262,64,24,17,BS_CENTER | BS_VCENTER | + PUSHBUTTON "Ост",IDC_BUTTON_MOD,262,64,24,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP - PUSHBUTTON "",IDC_BUTTON_OR,262,83,24,17,BS_CENTER | BS_VCENTER | + PUSHBUTTON "Или",IDC_BUTTON_OR,262,83,24,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP - PUSHBUTTON "",IDC_BUTTON_LSH,262,102,24,17,BS_CENTER | + PUSHBUTTON "ЛИзм",IDC_BUTTON_LSH,262,102,24,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP PUSHBUTTON "=",IDC_BUTTON_EQU,262,121,24,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP PUSHBUTTON "E",IDC_BUTTON_E,262,140,24,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP - PUSHBUTTON "",IDC_BUTTON_AND,288,64,24,17,BS_CENTER | BS_VCENTER | + PUSHBUTTON "И",IDC_BUTTON_AND,288,64,24,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP - PUSHBUTTON "",IDC_BUTTON_XOR,288,83,24,17,BS_CENTER | BS_VCENTER | + PUSHBUTTON "ИИли",IDC_BUTTON_XOR,288,83,24,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP - PUSHBUTTON "",IDC_BUTTON_NOT,288,102,24,17,BS_CENTER | + PUSHBUTTON "Не",IDC_BUTTON_NOT,288,102,24,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP - PUSHBUTTON "",IDC_BUTTON_INT,288,121,24,17,BS_CENTER | + PUSHBUTTON "Цлч",IDC_BUTTON_INT,288,121,24,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP - PUSHBUTTON "",IDC_BUTTON_F,288,140,24,17,BS_CENTER | BS_VCENTER | + PUSHBUTTON "Дроб",IDC_BUTTON_F,288,140,24,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP GROUPBOX "",IDC_STATIC,140,16,172,21 CONTROL "Qword",IDC_RADIO_QWORD,"Button",BS_AUTORADIOBUTTON | @@ -140,19 +140,19 @@ BEGIN NOT WS_VISIBLE,188,24,37,10 CONTROL "Word",IDC_RADIO_WORD,"Button",BS_AUTORADIOBUTTON | NOT WS_VISIBLE,232,24,33,10 - CONTROL "",IDC_RADIO_BYTE,"Button",BS_AUTORADIOBUTTON | NOT + CONTROL "Байт",IDC_RADIO_BYTE,"Button",BS_AUTORADIOBUTTON | NOT WS_VISIBLE,272,24,30,10 - CONTROL "",IDC_RADIO_DEG,"Button",BS_AUTORADIOBUTTON,148,24, + CONTROL "Градуси",IDC_RADIO_DEG,"Button",BS_AUTORADIOBUTTON,148,24, 42,10 - CONTROL "",IDC_RADIO_RAD,"Button",BS_AUTORADIOBUTTON,192, + CONTROL "Радиани",IDC_RADIO_RAD,"Button",BS_AUTORADIOBUTTON,192, 24,42,10 - CONTROL "",IDC_RADIO_GRAD,"Button",BS_AUTORADIOBUTTON, + CONTROL "Градове",IDC_RADIO_GRAD,"Button",BS_AUTORADIOBUTTON, 236,24,44,10 PUSHBUTTON "C",IDC_BUTTON_CANC,272,40,40,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP PUSHBUTTON "CE",IDC_BUTTON_CE,228,40,40,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP - PUSHBUTTON "",IDC_BUTTON_BACK,184,40,40,17,BS_CENTER | + PUSHBUTTON "Назад",IDC_BUTTON_BACK,184,40,40,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP RTEXT "",IDC_TEXT_OUTPUT,4,4,308,12,SS_CENTERIMAGE, WS_EX_CLIENTEDGE @@ -161,7 +161,7 @@ END IDD_DIALOG_STANDARD DIALOGEX 0, 0, 172, 127 STYLE DS_SHELLFONT | WS_MINIMIZEBOX | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Изчислителян на РеактОС" MENU IDR_MENU_STANDARD FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN @@ -169,7 +169,7 @@ BEGIN BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP PUSHBUTTON "CE",IDC_BUTTON_CE,84,24,40,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP - PUSHBUTTON "",IDC_BUTTON_BACK,40,24,40,17,BS_CENTER | + PUSHBUTTON "Назад",IDC_BUTTON_BACK,40,24,40,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP RTEXT "",IDC_TEXT_OUTPUT,4,4,164,12,SS_CENTERIMAGE, WS_EX_CLIENTEDGE @@ -228,7 +228,7 @@ END IDD_DIALOG_CONVERSION DIALOGEX 0, 0, 320, 130 STYLE DS_SHELLFONT | WS_MINIMIZEBOX | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Изчислителят на РеактОС" MENU IDR_MENU_STANDARD FONT 8, "MS Shell Dlg" BEGIN @@ -306,16 +306,16 @@ END IDD_DIALOG_ABOUT DIALOGEX DISCARDABLE 0, 0, 264, 169 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " ReactOS Calc" +CAPTION "За ReactOS Calc" FONT 8, "MS Shell Dlg" BEGIN - DEFPUSHBUTTON "",IDOK,105,148,52,16 + DEFPUSHBUTTON "Добре",IDOK,105,148,52,16 CONTROL IDB_BITMAP_ROS,IDC_STATIC,"Static",SS_BITMAP | SS_CENTERIMAGE | SS_REALSIZEIMAGE | WS_BORDER,4,4,104,48 - LTEXT " ",IDC_STATIC,120,12,132,8, + LTEXT "Изчислителят на РеактОС",IDC_STATIC,120,12,132,8, SS_CENTERIMAGE - LTEXT ":",IDC_TEXT_VERSION,120,20,132,8,SS_CENTERIMAGE - LTEXT " Carlo Bramini",IDC_STATIC,120,32,132,8, + LTEXT "Версия:",IDC_TEXT_VERSION,120,20,132,8,SS_CENTERIMAGE + LTEXT "Написано от Carlo Bramini",IDC_STATIC,120,32,132,8, SS_CENTERIMAGE GROUPBOX "",IDC_STATIC,112,0,148,52 GROUPBOX "",IDC_STATIC,4,56,256,88 @@ -325,7 +325,7 @@ END IDD_DIALOG_STAT DIALOGEX DISCARDABLE 0, 0, 163, 85 STYLE DS_SHELLFONT | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Статистическа кутия" FONT 8, "MS Shell Dlg" BEGIN LISTBOX IDC_LIST_STAT,4,4,156,40,LBS_NOINTEGRALHEIGHT | @@ -342,89 +342,89 @@ END IDR_MENU_SCIENTIFIC_1 MENU DISCARDABLE BEGIN - POPUP "&" + POPUP "&Обработка" BEGIN - MENUITEM "\tCTRL-C", IDM_EDIT_COPY - MENUITEM "\tCTRL-V", IDM_EDIT_PASTE + MENUITEM "Запомняне\tCTRL-C", IDM_EDIT_COPY + MENUITEM "Поставяне\tCTRL-V", IDM_EDIT_PASTE END - POPUP "" + POPUP "Изглед" BEGIN - MENUITEM "", IDM_VIEW_STANDARD, CHECKED - MENUITEM "", IDM_VIEW_SCIENTIFIC, CHECKED - MENUITEM "", IDM_VIEW_CONVERSION + MENUITEM "Обикновен", IDM_VIEW_STANDARD, CHECKED + MENUITEM "Научен", IDM_VIEW_SCIENTIFIC, CHECKED + MENUITEM "Преобразуване", IDM_VIEW_CONVERSION MENUITEM SEPARATOR - MENUITEM "a\tF5", IDM_VIEW_HEX, CHECKED - MENUITEM "\tF6", IDM_VIEW_DEC, CHECKED - MENUITEM "\tF7", IDM_VIEW_OCT, CHECKED - MENUITEM "\tF8", IDM_VIEW_BIN, CHECKED + MENUITEM "Шестнaдесетичен\tF5", IDM_VIEW_HEX, CHECKED + MENUITEM "Десетичен\tF6", IDM_VIEW_DEC, CHECKED + MENUITEM "Осмичен\tF7", IDM_VIEW_OCT, CHECKED + MENUITEM "Двоичен\tF8", IDM_VIEW_BIN, CHECKED MENUITEM SEPARATOR - MENUITEM "\tF2", IDM_VIEW_DEG, CHECKED - MENUITEM "\tF3", IDM_VIEW_RAD, CHECKED - MENUITEM "\tF4", IDM_VIEW_GRAD, CHECKED + MENUITEM "Градуси\tF2", IDM_VIEW_DEG, CHECKED + MENUITEM "Радиани\tF3", IDM_VIEW_RAD, CHECKED + MENUITEM "Градове\tF4", IDM_VIEW_GRAD, CHECKED MENUITEM SEPARATOR - MENUITEM " ", IDM_VIEW_GROUP, CHECKED + MENUITEM "Разделяне на хилядите", IDM_VIEW_GROUP, CHECKED END - POPUP "" + POPUP "Помощ" BEGIN - MENUITEM "", IDM_HELP_HELP + MENUITEM "Помощ", IDM_HELP_HELP MENUITEM SEPARATOR - MENUITEM " ReactOS Calc", IDM_HELP_ABOUT + MENUITEM "За ReactOS Calc", IDM_HELP_ABOUT END END IDR_MENU_SCIENTIFIC_2 MENU DISCARDABLE BEGIN - POPUP "&" + POPUP "&Обработка" BEGIN - MENUITEM "\tCTRL-C", IDM_EDIT_COPY - MENUITEM "\tCTRL-V", IDM_EDIT_PASTE + MENUITEM "Запомняне\tCTRL-C", IDM_EDIT_COPY + MENUITEM "Поставяне\tCTRL-V", IDM_EDIT_PASTE END - POPUP "" + POPUP "Изглед" BEGIN - MENUITEM "", IDM_VIEW_STANDARD, CHECKED - MENUITEM "", IDM_VIEW_SCIENTIFIC, CHECKED - MENUITEM "", IDM_VIEW_CONVERSION + MENUITEM "Стандартно", IDM_VIEW_STANDARD, CHECKED + MENUITEM "Научен", IDM_VIEW_SCIENTIFIC, CHECKED + MENUITEM "Преобразуване", IDM_VIEW_CONVERSION MENUITEM SEPARATOR - MENUITEM "a\tF5", IDM_VIEW_HEX, CHECKED - MENUITEM "\tF6", IDM_VIEW_DEC, CHECKED - MENUITEM "\tF7", IDM_VIEW_OCT, CHECKED - MENUITEM "\tF8", IDM_VIEW_BIN, CHECKED + MENUITEM "Шестнaдесетичен\tF5", IDM_VIEW_HEX, CHECKED + MENUITEM "Десетичен\tF6", IDM_VIEW_DEC, CHECKED + MENUITEM "Осмичен\tF7", IDM_VIEW_OCT, CHECKED + MENUITEM "Двоичен\tF8", IDM_VIEW_BIN, CHECKED MENUITEM SEPARATOR - MENUITEM "\tF12", IDM_VIEW_QWORD, CHECKED - MENUITEM "\tF2", IDM_VIEW_DWORD, CHECKED - MENUITEM "\tF3", IDM_VIEW_WORD, CHECKED - MENUITEM "\tF4", IDM_VIEW_BYTE, CHECKED + MENUITEM "Чдума\tF12", IDM_VIEW_QWORD, CHECKED + MENUITEM "Ддума\tF2", IDM_VIEW_DWORD, CHECKED + MENUITEM "Дума\tF3", IDM_VIEW_WORD, CHECKED + MENUITEM "Байт\tF4", IDM_VIEW_BYTE, CHECKED MENUITEM SEPARATOR - MENUITEM " ", IDM_VIEW_GROUP, CHECKED + MENUITEM "Разделяне на хилядите", IDM_VIEW_GROUP, CHECKED END - POPUP "" + POPUP "Помощ" BEGIN - MENUITEM "", IDM_HELP_HELP + MENUITEM "Помощ", IDM_HELP_HELP MENUITEM SEPARATOR - MENUITEM " ReactOS Calc", IDM_HELP_ABOUT + MENUITEM "За ReactOS Calc", IDM_HELP_ABOUT END END IDR_MENU_STANDARD MENU DISCARDABLE BEGIN - POPUP "&" + POPUP "&Обработка" BEGIN - MENUITEM "\tCTRL-C", IDM_EDIT_COPY - MENUITEM "\tCTRL-V", IDM_EDIT_PASTE + MENUITEM "Запомняне\tCTRL-C", IDM_EDIT_COPY + MENUITEM "Поставяне\tCTRL-V", IDM_EDIT_PASTE END - POPUP "" + POPUP "Изглед" BEGIN - MENUITEM "", IDM_VIEW_STANDARD, CHECKED - MENUITEM "", IDM_VIEW_SCIENTIFIC, CHECKED - MENUITEM "", IDM_VIEW_CONVERSION + MENUITEM "Стандартно", IDM_VIEW_STANDARD, CHECKED + MENUITEM "Научен", IDM_VIEW_SCIENTIFIC, CHECKED + MENUITEM "Преобразуване", IDM_VIEW_CONVERSION MENUITEM SEPARATOR - MENUITEM " ", IDM_VIEW_GROUP, CHECKED + MENUITEM "Разделяне на хилядите", IDM_VIEW_GROUP, CHECKED END - POPUP "" + POPUP "Помощ" BEGIN - MENUITEM "", IDM_HELP_HELP + MENUITEM "Помощ", IDM_HELP_HELP MENUITEM SEPARATOR - MENUITEM " ReactOS Calc", IDM_HELP_ABOUT + MENUITEM "За ReactOS Calc", IDM_HELP_ABOUT END END @@ -433,48 +433,48 @@ END STRINGTABLE DISCARDABLE BEGIN IDS_STRING_LICENSE "ReactOS Calc is free software released under GNU GPL license.\r\n\r\nYou can get a copy of GNU GPL license here:\r\nhttp://www.gnu.org/licenses/gpl.html\r\n\r\nYou can also get a translation of GNU GPL license here:\r\nhttp://www.gnu.org/licenses/translations.html" - IDS_MATH_ERROR "" - IDS_QUICKHELP " " + IDS_MATH_ERROR "Грешка" + IDS_QUICKHELP "Бърза помощ" END // types of conversion STRINGTABLE DISCARDABLE BEGIN - IDS_CONV_ANGLE "" - IDS_CONV_AREA "" - IDS_CONV_CONSUMPTION " ()" - IDS_CONV_CURRENCY " " - IDS_CONV_ENERGY "" - IDS_CONV_LENGTH "" - IDS_CONV_POWER "" - IDS_CONV_PRESSURE "" - IDS_CONV_TEMPERATURE "" - IDS_CONV_TIME "" - IDS_CONV_VELOCITY "" - IDS_CONV_VOLUME "" - IDS_CONV_WEIGHT "" + IDS_CONV_ANGLE "Ъгъл" + IDS_CONV_AREA "Площ" + IDS_CONV_CONSUMPTION "Потребление (двигатели)" + IDS_CONV_CURRENCY "Парични единици" + IDS_CONV_ENERGY "Енергия" + IDS_CONV_LENGTH "Дължини" + IDS_CONV_POWER "Мощност" + IDS_CONV_PRESSURE "Налягане" + IDS_CONV_TEMPERATURE "Температура" + IDS_CONV_TIME "Време" + IDS_CONV_VELOCITY "Скорост" + IDS_CONV_VOLUME "Обем" + IDS_CONV_WEIGHT "Тегло" END // TYPES OF ANGLES STRINGTABLE DISCARDABLE BEGIN - IDS_ANGLE_DEGREES "" - IDS_ANGLE_GRADIANS "" - IDS_ANGLE_RADIANS "" + IDS_ANGLE_DEGREES "Градуси" + IDS_ANGLE_GRADIANS "Гради" + IDS_ANGLE_RADIANS "Радиани" END // TYPES OF AREAS STRINGTABLE DISCARDABLE BEGIN - IDS_AREA_ACRES "" - IDS_AREA_ACRES_BRAZIL " ()" - IDS_AREA_ACRES_FRANCE " ()" - IDS_AREA_ACRES_SCOTS " ()" - IDS_AREA_ACRES_US " ()" - IDS_AREA_ARES "" + IDS_AREA_ACRES "Акри" + IDS_AREA_ACRES_BRAZIL "Акри (Бразилски)" + IDS_AREA_ACRES_FRANCE "Акри (Френски)" + IDS_AREA_ACRES_SCOTS "Акри (Шотландски)" + IDS_AREA_ACRES_US "Акри (САЩ)" + IDS_AREA_ARES "Арове" IDS_AREA_CHOU "Chou" IDS_AREA_DANBO "Danbo" - IDS_AREA_HECTARES "" + IDS_AREA_HECTARES "Хектари" IDS_AREA_JEONGBO "Jeongbo" IDS_AREA_MORGEN_HUNGARY "Morgen (Hungary)" IDS_AREA_MU "Mu" @@ -483,21 +483,21 @@ BEGIN IDS_AREA_PYEONGBANGJA "Pyeongbangja" IDS_AREA_RAI "Rai" IDS_AREA_SE "Se" - IDS_AREA_SQUARE_CENTIMETERS " " - IDS_AREA_SQUARE_CHR " chr" - IDS_AREA_SQUARE_FATHOMS " " - IDS_AREA_SQUARE_FATHOMS_HUNGARY " ()" - IDS_AREA_SQUARE_FEET " " - IDS_AREA_SQUARE_INCHES " " - IDS_AREA_SQUARE_KILOMETERS " " - IDS_AREA_SQUARE_LAR " lar" - IDS_AREA_SQUARE_METER " " - IDS_AREA_SQUARE_MILES " " - IDS_AREA_SQUARE_MILLIMETERS " " - IDS_AREA_SQUARE_SHAKU " shaku" - IDS_AREA_SQUARE_TSUEN " tsuen" - IDS_AREA_SQUARE_VA " va" - IDS_AREA_SQUARE_YARD " " + IDS_AREA_SQUARE_CENTIMETERS "Квадратни сантиметри" + IDS_AREA_SQUARE_CHR "Квадратни chr" + IDS_AREA_SQUARE_FATHOMS "Квадратни фадоми" + IDS_AREA_SQUARE_FATHOMS_HUNGARY "Квадратни фадоми (унгарски)" + IDS_AREA_SQUARE_FEET "Квадратни стъпки" + IDS_AREA_SQUARE_INCHES "Квадратни цолове" + IDS_AREA_SQUARE_KILOMETERS "Квадратни километри" + IDS_AREA_SQUARE_LAR "Квадратни lar" + IDS_AREA_SQUARE_METER "Квадратни метри" + IDS_AREA_SQUARE_MILES "Квадратни мили" + IDS_AREA_SQUARE_MILLIMETERS "Квадратни милиметри" + IDS_AREA_SQUARE_SHAKU "Квадратни shaku" + IDS_AREA_SQUARE_TSUEN "Квадратни tsuen" + IDS_AREA_SQUARE_VA "Квадратни va" + IDS_AREA_SQUARE_YARD "Квадратни ярдове" IDS_AREA_TAN "Tan" IDS_AREA_TSUBO "Tsubo" END @@ -505,10 +505,10 @@ END // TYPES OF COMSUMPTIONS STRINGTABLE DISCARDABLE BEGIN - IDS_CONSUMPTION_KM_PER_L "/" - IDS_CONSUMPTION_L_PER_100_KM "/100 " - IDS_CONSUMPTION_MILES_GALLON_UK "/ ()" - IDS_CONSUMPTION_MILES_GALLON_US "/ ()" + IDS_CONSUMPTION_KM_PER_L "Километри/литър" + IDS_CONSUMPTION_L_PER_100_KM "Литри/100 километра" + IDS_CONSUMPTION_MILES_GALLON_UK "Мили/галон (ОК)" + IDS_CONSUMPTION_MILES_GALLON_US "Мили/галон (САЩ)" END // TYPES OF CURRENCIES @@ -517,10 +517,10 @@ BEGIN IDS_CURRENCY_AUSTRIAN_SCHILLING "Austrian schilling" IDS_CURRENCY_BELGIAN_FRANC "Belgian franc" IDS_CURRENCY_CYPRIOT_POUND "Cypriot pound" - IDS_CURRENCY_CZECH_KORUNA " " + IDS_CURRENCY_CZECH_KORUNA "Чешка крона" IDS_CURRENCY_DEUTSCHE_MARK "Deutsche Mark" IDS_CURRENCY_DUTCH_GUILDER "Dutch guilder" - IDS_CURRENCY_EURO "" + IDS_CURRENCY_EURO "Евро" IDS_CURRENCY_FINNISH_MARKKA "Finnish markka" IDS_CURRENCY_FRENCH_FRANC "French franc" IDS_CURRENCY_GREEK_DRACHMA "Greek Drachma" @@ -537,59 +537,59 @@ END // TYPES OF ENERGIES STRINGTABLE DISCARDABLE BEGIN - IDS_ENERGY_15_C_CALORIES "15- " - IDS_ENERGY_BTUS " " - IDS_ENERGY_ERGS "" - IDS_ENERGY_EVS "" + IDS_ENERGY_15_C_CALORIES "15-градусни калории" + IDS_ENERGY_BTUS "Британски термални единици" + IDS_ENERGY_ERGS "Ергове" + IDS_ENERGY_EVS "Електронволти" IDS_ENERGY_FOOT_POUNDS "Foot-Pounds" - IDS_ENERGY_IT_CALORIES " " - IDS_ENERGY_IT_KILOCALORIES " " - IDS_ENERGY_JOULES "" - IDS_ENERGY_KILOJOULES "" - IDS_ENERGY_KILOWATT_HOURS "" - IDS_ENERGY_NUTRITION_CALORIES " " - IDS_ENERGY_TH_CALORIES " " + IDS_ENERGY_IT_CALORIES "Международни таблични калории" + IDS_ENERGY_IT_KILOCALORIES "Международни таблични килокалории" + IDS_ENERGY_JOULES "Джаули" + IDS_ENERGY_KILOJOULES "Килоджаули" + IDS_ENERGY_KILOWATT_HOURS "Киловатчасове" + IDS_ENERGY_NUTRITION_CALORIES "Хранителни калории" + IDS_ENERGY_TH_CALORIES "Топлинни калории" END // TYPES OF LENGTHS STRINGTABLE DISCARDABLE BEGIN - IDS_LENGTH_ANGSTROMS "" - IDS_LENGTH_ASTRONOMICAL_UNITS " " - IDS_LENGTH_BARLEYCORNS " " - IDS_LENGTH_CENTIMETERS "" - IDS_LENGTH_CHAINS_UK " ()" + IDS_LENGTH_ANGSTROMS "Ангстрьоми" + IDS_LENGTH_ASTRONOMICAL_UNITS "Астрономическа единица" + IDS_LENGTH_BARLEYCORNS "Ечемичени зърна" + IDS_LENGTH_CENTIMETERS "Сантиметри" + IDS_LENGTH_CHAINS_UK "Вериги (ОК)" IDS_LENGTH_CHI "Chi" IDS_LENGTH_CHOU "Chou" IDS_LENGTH_CHR "Chr" IDS_LENGTH_CUN "Cun" - IDS_LENGTH_FATHOMS "" - IDS_LENGTH_FATHOMS_HUNGARY " ()" - IDS_LENGTH_FEET "" - IDS_LENGTH_FURLONGS "" + IDS_LENGTH_FATHOMS "Сажени" + IDS_LENGTH_FATHOMS_HUNGARY "Сажени (унгарски)" + IDS_LENGTH_FEET "Стъпки" + IDS_LENGTH_FURLONGS "Бразди" IDS_LENGTH_GAN "Gan" - IDS_LENGTH_HANDS "" + IDS_LENGTH_HANDS "Длани" IDS_LENGTH_HUNH "Hunh" - IDS_LENGTH_INCHES "" + IDS_LENGTH_INCHES "Цолове" IDS_LENGTH_JA "Ja" IDS_LENGTH_JEONG "Jeong" IDS_LENGTH_KABIET "Kabiet" IDS_LENGTH_KEN "Ken" IDS_LENGTH_KEUB "Keub" - IDS_LENGTH_KILOMETERS "" + IDS_LENGTH_KILOMETERS "Километри" IDS_LENGTH_LAR "Lar" - IDS_LENGTH_LIGHT_YEARS " " + IDS_LENGTH_LIGHT_YEARS "Светлинни години" IDS_LENGTH_LINKS_UK "Links (UK)" - IDS_LENGTH_METERS "" - IDS_LENGTH_MICRONS "" - IDS_LENGTH_MILES "" - IDS_LENGTH_MILLIMETERS "" - IDS_LENGTH_NAUTICAL_MILES " " + IDS_LENGTH_METERS "Метри" + IDS_LENGTH_MICRONS "Микрометри" + IDS_LENGTH_MILES "Мили" + IDS_LENGTH_MILLIMETERS "Милиметри" + IDS_LENGTH_NAUTICAL_MILES "Морски мили" IDS_LENGTH_NIEU "Nieu" - IDS_LENGTH_PARSECS "" - IDS_LENGTH_PICAS " ()" - IDS_LENGTH_RI_JAPAN "Ri ()" - IDS_LENGTH_RI_KOREA "Ri ()" + IDS_LENGTH_PARSECS "Парсеци" + IDS_LENGTH_PICAS "Дванадесетки (пики)" + IDS_LENGTH_RI_JAPAN "Ri (японски)" + IDS_LENGTH_RI_KOREA "Ri (корейски)" IDS_LENGTH_RODS "Rods" IDS_LENGTH_SAWK "Sawk" IDS_LENGTH_SEN "Sen" @@ -598,7 +598,7 @@ BEGIN IDS_LENGTH_SUN "Sun" IDS_LENGTH_TSUEN "Tsuen" IDS_LENGTH_VA "Va" - IDS_LENGTH_YARDS "" + IDS_LENGTH_YARDS "Ярдове" IDS_LENGTH_YOTE "Yote" IDS_LENGTH_ZHANG "Zhang" END @@ -608,92 +608,92 @@ STRINGTABLE DISCARDABLE BEGIN IDS_POWER_BTUS_PER_MINUTE "British Thermal Units per minute" IDS_POWER_FPS_PER_MINUTE "Foot-Pounds per minute" - IDS_POWER_HORSEPOWER " " - IDS_POWER_KILOWATTS "" - IDS_POWER_MEGAWATTS "" - IDS_POWER_WATTS "" + IDS_POWER_HORSEPOWER "Конски сили" + IDS_POWER_KILOWATTS "Киловатове" + IDS_POWER_MEGAWATTS "Мегаватове" + IDS_POWER_WATTS "Ватове" END // TYPE OF PRESSURES STRINGTABLE DISCARDABLE BEGIN - IDS_PRESSURE_ATMOSPHERES "" - IDS_PRESSURE_BARS "" - IDS_PRESSURE_HECTOPASCALS "" - IDS_PRESSURE_KILOPASCALS "" - IDS_PRESSURE_MM_OF_MERCURY " " - IDS_PRESSURE_PASCALS "" - IDS_PRESSURE_PSI " " + IDS_PRESSURE_ATMOSPHERES "Атмосфери" + IDS_PRESSURE_BARS "Барове" + IDS_PRESSURE_HECTOPASCALS "Хектопаскали" + IDS_PRESSURE_KILOPASCALS "Килопаскали" + IDS_PRESSURE_MM_OF_MERCURY "Милиметри живачен стълб" + IDS_PRESSURE_PASCALS "Паскали" + IDS_PRESSURE_PSI "Паундове на квадратен цол" END // TYPES OF TEMPERATURES STRINGTABLE DISCARDABLE BEGIN - IDS_TEMPERATURE_CELSIUS "" - IDS_TEMPERATURE_FAHRENHEIT "" - IDS_TEMPERATURE_KELVIN "" - IDS_TEMPERATURE_RANKINE "" + IDS_TEMPERATURE_CELSIUS "Целзий" + IDS_TEMPERATURE_FAHRENHEIT "Фаренхайт" + IDS_TEMPERATURE_KELVIN "Келвин" + IDS_TEMPERATURE_RANKINE "Ранкин" END // TYPES OF TIME STRINGTABLE DISCARDABLE BEGIN - IDS_TIME_DAYS "" - IDS_TIME_HOURS "" + IDS_TIME_DAYS "Дни" + IDS_TIME_HOURS "Часи" IDS_TIME_NANOSECONDS "Nanoseconds" - IDS_TIME_MICROSECONDS "" - IDS_TIME_MILLISECONDS "" - IDS_TIME_MINUTES "" - IDS_TIME_SECONDS "" - IDS_TIME_WEEKS "" - IDS_TIME_YEARS "" + IDS_TIME_MICROSECONDS "Микросекунди" + IDS_TIME_MILLISECONDS "Милисекунди" + IDS_TIME_MINUTES "Минути" + IDS_TIME_SECONDS "Секунди" + IDS_TIME_WEEKS "Седмици" + IDS_TIME_YEARS "Години" END // TYPES OF VELOCITIES STRINGTABLE DISCARDABLE BEGIN - IDS_VELOCITY_CMS_SECOND "/" - IDS_VELOCITY_FEET_HOUR "/" - IDS_VELOCITY_FEET_SECOND "/" - IDS_VELOCITY_KILOMETERS_HOUR "/" - IDS_VELOCITY_KNOTS "" - IDS_VELOCITY_MACH "" - IDS_VELOCITY_METERS_SECOND "/" - IDS_VELOCITY_MILES_HOUR "/" + IDS_VELOCITY_CMS_SECOND "Сантиметри/час" + IDS_VELOCITY_FEET_HOUR "Стъпки/час" + IDS_VELOCITY_FEET_SECOND "Стъпки/секунда" + IDS_VELOCITY_KILOMETERS_HOUR "Километри/час" + IDS_VELOCITY_KNOTS "Възли" + IDS_VELOCITY_MACH "Махове" + IDS_VELOCITY_METERS_SECOND "Метри/секунда" + IDS_VELOCITY_MILES_HOUR "Мили/час" END // TYPES OF VOLUMES STRINGTABLE DISCARDABLE BEGIN - IDS_VOLUME_BARRELS_UK " () ()" - IDS_VOLUME_BARRELS_OIL " " + IDS_VOLUME_BARRELS_UK "Бъчви (барели) (ОК)" + IDS_VOLUME_BARRELS_OIL "Петролни бъчви" IDS_VOLUME_BUN "Bun" - IDS_VOLUME_BUSHELS_UK " ()" - IDS_VOLUME_BUSHELS_US " ()" - IDS_VOLUME_CUBIC_CENTIMETERS " " - IDS_VOLUME_CUBIC_FEET " " - IDS_VOLUME_CUBIC_INCHES " " - IDS_VOLUME_CUBIC_METERS " " - IDS_VOLUME_CUBIC_YARDS " " + IDS_VOLUME_BUSHELS_UK "Бушели (ОК)" + IDS_VOLUME_BUSHELS_US "Бушели (САЩ)" + IDS_VOLUME_CUBIC_CENTIMETERS "Кубични сантиметри" + IDS_VOLUME_CUBIC_FEET "Кубични стъпки" + IDS_VOLUME_CUBIC_INCHES "Кубични цолове" + IDS_VOLUME_CUBIC_METERS "Кубични метри" + IDS_VOLUME_CUBIC_YARDS "Кубични ярдове" IDS_VOLUME_DOE "Doe" - IDS_VOLUME_FLUID_OUNCES_UK " ()" - IDS_VOLUME_FLUID_OUNCES_US " ()" - IDS_VOLUME_GALLONS_UK " (UK)" - IDS_VOLUME_GALLONS_DRY_US ", ()" - IDS_VOLUME_GALLONS_LIQUID_US ", ()" + IDS_VOLUME_FLUID_OUNCES_UK "Течни унции (ОК)" + IDS_VOLUME_FLUID_OUNCES_US "Течни унции (САЩ)" + IDS_VOLUME_GALLONS_UK "Галони (UK)" + IDS_VOLUME_GALLONS_DRY_US "Галони, сухи (САЩ)" + IDS_VOLUME_GALLONS_LIQUID_US "Галони, течни (САЩ)" IDS_VOLUME_GOU "Gou" IDS_VOLUME_HOP "Hop" IDS_VOLUME_ICCE "Icce" IDS_VOLUME_KWIAN "Kwian" - IDS_VOLUME_LITERS "" + IDS_VOLUME_LITERS "Литри" IDS_VOLUME_MAL "Mal" - IDS_VOLUME_MILLILITERS "" - IDS_VOLUME_PINTS_UK " ()" - IDS_VOLUME_PINTS_DRY_US ", ()" - IDS_VOLUME_PINTS_LIQUID_US ", ()" - IDS_VOLUME_QUARTS_UK " ()" - IDS_VOLUME_QUARTS_DRY_US ", ()" - IDS_VOLUME_QUARTS_LIQUID_US ", ()" + IDS_VOLUME_MILLILITERS "Милиметри" + IDS_VOLUME_PINTS_UK "Пинти (ОК)" + IDS_VOLUME_PINTS_DRY_US "Пинти, сухи (САЩ)" + IDS_VOLUME_PINTS_LIQUID_US "Пинти, течни (САЩ)" + IDS_VOLUME_QUARTS_UK "Кварти (ОК)" + IDS_VOLUME_QUARTS_DRY_US "Кварти, сухи (САЩ)" + IDS_VOLUME_QUARTS_LIQUID_US "Кварти, течни (САЩ)" IDS_VOLUME_SEKI "Seki" IDS_VOLUME_SYOU "Syou" IDS_VOLUME_TANANLOUNG "Tananloung" @@ -705,29 +705,29 @@ END STRINGTABLE DISCARDABLE BEGIN IDS_WEIGHT_BAHT "Baht" - IDS_WEIGHT_CARATS "" + IDS_WEIGHT_CARATS "Карати" IDS_WEIGHT_CHUNG "Chung" IDS_WEIGHT_DON "Don" IDS_WEIGHT_GEUN "Geun" IDS_WEIGHT_GRAMS "Grams" IDS_WEIGHT_GWAN "Gwan" IDS_WEIGHT_HARB "Harb" - IDS_WEIGHT_JIN_CHINA " ()" - IDS_WEIGHT_JIN_TAIWAN " ()" + IDS_WEIGHT_JIN_CHINA "Джинове (Китай)" + IDS_WEIGHT_JIN_TAIWAN "Джинове (Тайван)" IDS_WEIGHT_KAN "Kan" - IDS_WEIGHT_KILOGRAMS "" + IDS_WEIGHT_KILOGRAMS "Килограми" IDS_WEIGHT_KIN "Kin" IDS_WEIGHT_LIANG_CHINA "Liang (China)" IDS_WEIGHT_LIANG_TAIWAN "Liang (Taiwan)" IDS_WEIGHT_MONME "Monme" - IDS_WEIGHT_OUNCES_AVOIRDUPOIS ", avoirdupois" - IDS_WEIGHT_OUNCES_TROY ", " - IDS_WEIGHT_POUNDS "" - IDS_WEIGHT_QUINTAL_METRIC " ()" + IDS_WEIGHT_OUNCES_AVOIRDUPOIS "Унции, avoirdupois" + IDS_WEIGHT_OUNCES_TROY "Унции, трой" + IDS_WEIGHT_POUNDS "Фунтове" + IDS_WEIGHT_QUINTAL_METRIC "Центнери (метрични)" IDS_WEIGHT_SALOUNG "Saloung" - IDS_WEIGHT_STONES "" + IDS_WEIGHT_STONES "Камъни" IDS_WEIGHT_TAMLUNG "Tamlung" - IDS_WEIGHT_TONNES "" - IDS_WEIGHT_TONS_UK " ()" - IDS_WEIGHT_TONS_US " ()" + IDS_WEIGHT_TONNES "Тонове" + IDS_WEIGHT_TONS_UK "Тонове (ОК)" + IDS_WEIGHT_TONS_US "Тонове (САЩ)" END diff --git a/base/applications/calc/lang/cs-CZ.rc b/base/applications/calc/lang/cs-CZ.rc index a062074f93b..95f2cb04458 100644 --- a/base/applications/calc/lang/cs-CZ.rc +++ b/base/applications/calc/lang/cs-CZ.rc @@ -9,7 +9,7 @@ LANGUAGE LANG_CZECH, SUBLANG_DEFAULT IDD_DIALOG_SCIENTIFIC DIALOGEX 0, 0, 316, 161 STYLE DS_SHELLFONT | WS_MINIMIZEBOX | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "ReactOS kalkulaka" +CAPTION "ReactOS kalkulaèka" MENU IDR_MENU_SCIENTIFIC_1 FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN @@ -75,7 +75,7 @@ BEGIN BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP PUSHBUTTON "M+",IDC_BUTTON_MP,124,121,24,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP - PUSHBUTTON "p",IDC_BUTTON_PI,124,140,24,17,BS_CENTER | BS_VCENTER | + PUSHBUTTON "pí",IDC_BUTTON_PI,124,140,24,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP PUSHBUTTON "7",IDC_BUTTON_7,158,64,24,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP @@ -146,9 +146,9 @@ BEGIN WS_VISIBLE,232,24,33,10 CONTROL "Byte",IDC_RADIO_BYTE,"Button",BS_AUTORADIOBUTTON | NOT WS_VISIBLE,272,24,30,10 - CONTROL "Stupn",IDC_RADIO_DEG,"Button",BS_AUTORADIOBUTTON,148,24, + CONTROL "Stupnì",IDC_RADIO_DEG,"Button",BS_AUTORADIOBUTTON,148,24, 42,10 - CONTROL "Radiny",IDC_RADIO_RAD,"Button",BS_AUTORADIOBUTTON,192, + CONTROL "Radiány",IDC_RADIO_RAD,"Button",BS_AUTORADIOBUTTON,192, 24,42,10 CONTROL "Grady",IDC_RADIO_GRAD,"Button",BS_AUTORADIOBUTTON, 236,24,44,10 @@ -156,7 +156,7 @@ BEGIN BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP PUSHBUTTON "CE",IDC_BUTTON_CE,228,40,40,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP - PUSHBUTTON "Zpt",IDC_BUTTON_BACK,184,40,40,17,BS_CENTER | + PUSHBUTTON "Zpìt",IDC_BUTTON_BACK,184,40,40,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP RTEXT "",IDC_TEXT_OUTPUT,4,4,308,12,SS_CENTERIMAGE, WS_EX_CLIENTEDGE @@ -165,7 +165,7 @@ END IDD_DIALOG_STANDARD DIALOGEX 0, 0, 172, 127 STYLE DS_SHELLFONT | WS_MINIMIZEBOX | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "ReactOS Kalkulaka" +CAPTION "ReactOS Kalkulaèka" MENU IDR_MENU_STANDARD FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN @@ -173,7 +173,7 @@ BEGIN BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP PUSHBUTTON "CE",IDC_BUTTON_CE,84,24,40,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP - PUSHBUTTON "Zpt",IDC_BUTTON_BACK,40,24,40,17,BS_CENTER | + PUSHBUTTON "Zpìt",IDC_BUTTON_BACK,40,24,40,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP RTEXT "",IDC_TEXT_OUTPUT,4,4,164,12,SS_CENTERIMAGE, WS_EX_CLIENTEDGE @@ -232,17 +232,17 @@ END IDD_DIALOG_CONVERSION DIALOGEX 0, 0, 320, 130 STYLE DS_SHELLFONT | WS_MINIMIZEBOX | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "ReactOS Kalkulaka" +CAPTION "ReactOS Kalkulaèka" MENU IDR_MENU_STANDARD FONT 8, "MS Shell Dlg" BEGIN - PUSHBUTTON "Pevst",IDC_BUTTON_CONVERT,35,105,76,17 + PUSHBUTTON "Pøevést",IDC_BUTTON_CONVERT,35,105,76,17 COMBOBOX IDC_COMBO_CATEGORY,4,31,140,168,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP | CBS_SORT LTEXT "Kategorie:",IDC_STATIC,4,20,56,8 COMBOBOX IDC_COMBO_FROM,4,60,140,168,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP | CBS_SORT - LTEXT "Pevst z:",IDC_STATIC,4,49,56,8 + LTEXT "Pøevést z:",IDC_STATIC,4,49,56,8 COMBOBOX IDC_COMBO_TO,4,87,140,168,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP | CBS_SORT LTEXT "Na:",IDC_STATIC,4,76,56,8 @@ -250,7 +250,7 @@ BEGIN BS_VCENTER | BS_NOTIFY | WS_TABSTOP,276,24,40,17 CONTROL "CE",IDC_BUTTON_CE,"Button",BS_OWNERDRAW | BS_CENTER | BS_VCENTER | BS_NOTIFY | WS_TABSTOP,232,24,40,17 - CONTROL "Zpt",IDC_BUTTON_BACK,"Button",BS_OWNERDRAW | + CONTROL "Zpìt",IDC_BUTTON_BACK,"Button",BS_OWNERDRAW | BS_CENTER | BS_VCENTER | BS_NOTIFY | WS_TABSTOP,188,24, 40,17 RTEXT "",IDC_TEXT_OUTPUT,4,4,312,12,SS_CENTERIMAGE, @@ -310,13 +310,13 @@ END IDD_DIALOG_ABOUT DIALOGEX DISCARDABLE 0, 0, 264, 169 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "O ReactOS Kalkulace" +CAPTION "O ReactOS Kalkulaèce" FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "OK",IDOK,105,148,52,16 CONTROL IDB_BITMAP_ROS,IDC_STATIC,"Static",SS_BITMAP | SS_CENTERIMAGE | SS_REALSIZEIMAGE | WS_BORDER,4,4,104,48 - LTEXT "ReactOS Kalkulaka",IDC_STATIC,120,12,132,8, + LTEXT "ReactOS Kalkulaèka",IDC_STATIC,120,12,132,8, SS_CENTERIMAGE LTEXT "Verze ",IDC_TEXT_VERSION,120,20,132,8,SS_CENTERIMAGE LTEXT "Autor: Carlo Bramini",IDC_STATIC,120,32,132,8, @@ -329,7 +329,7 @@ END IDD_DIALOG_STAT DIALOGEX DISCARDABLE 0, 0, 163, 85 STYLE DS_SHELLFONT | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "Statistick vpoty" +CAPTION "Statistické výpoèty" FONT 8, "MS Shell Dlg" BEGIN LISTBOX IDC_LIST_STAT,4,4,156,40,LBS_NOINTEGRALHEIGHT | @@ -346,89 +346,89 @@ END IDR_MENU_SCIENTIFIC_1 MENU DISCARDABLE BEGIN - POPUP "pravy" + POPUP "Úpravy" BEGIN - MENUITEM "Koprovat\tCTRL-C", IDM_EDIT_COPY - MENUITEM "Vloit\tCTRL-V", IDM_EDIT_PASTE + MENUITEM "Kopírovat\tCTRL-C", IDM_EDIT_COPY + MENUITEM "Vložit\tCTRL-V", IDM_EDIT_PASTE END POPUP "Zobrazit" BEGIN - MENUITEM "Standardn", IDM_VIEW_STANDARD, CHECKED - MENUITEM "Vdeck", IDM_VIEW_SCIENTIFIC, CHECKED - MENUITEM "Pevody", IDM_VIEW_CONVERSION + MENUITEM "Standardní", IDM_VIEW_STANDARD, CHECKED + MENUITEM "Vìdecká", IDM_VIEW_SCIENTIFIC, CHECKED + MENUITEM "Pøevody", IDM_VIEW_CONVERSION MENUITEM SEPARATOR - MENUITEM "estnctkov\tF5", IDM_VIEW_HEX, CHECKED - MENUITEM "Destkov\tF6", IDM_VIEW_DEC, CHECKED - MENUITEM "Osmikov\tF7", IDM_VIEW_OCT, CHECKED - MENUITEM "Binrn\tF8", IDM_VIEW_BIN, CHECKED + MENUITEM "Šestnáctkovì\tF5", IDM_VIEW_HEX, CHECKED + MENUITEM "Desítkovì\tF6", IDM_VIEW_DEC, CHECKED + MENUITEM "Osmièkovì\tF7", IDM_VIEW_OCT, CHECKED + MENUITEM "Binárnì\tF8", IDM_VIEW_BIN, CHECKED MENUITEM SEPARATOR - MENUITEM "Stupn\tF2", IDM_VIEW_DEG, CHECKED - MENUITEM "Radiny\tF3", IDM_VIEW_RAD, CHECKED + MENUITEM "Stupnì\tF2", IDM_VIEW_DEG, CHECKED + MENUITEM "Radiány\tF3", IDM_VIEW_RAD, CHECKED MENUITEM "Grady\tF4", IDM_VIEW_GRAD, CHECKED MENUITEM SEPARATOR - MENUITEM "Seskupovn slic", IDM_VIEW_GROUP, CHECKED + MENUITEM "Seskupování èíslic", IDM_VIEW_GROUP, CHECKED END - POPUP "Npovda" + POPUP "Nápovìda" BEGIN - MENUITEM "Tmata npovdy", IDM_HELP_HELP + MENUITEM "Témata nápovìdy", IDM_HELP_HELP MENUITEM SEPARATOR - MENUITEM "O ReactOS kalkulace", IDM_HELP_ABOUT + MENUITEM "O ReactOS kalkulaèce", IDM_HELP_ABOUT END END IDR_MENU_SCIENTIFIC_2 MENU DISCARDABLE BEGIN - POPUP "pravy" + POPUP "Úpravy" BEGIN - MENUITEM "Koprovat\tCTRL-C", IDM_EDIT_COPY - MENUITEM "Vloit\tCTRL-V", IDM_EDIT_PASTE + MENUITEM "Kopírovat\tCTRL-C", IDM_EDIT_COPY + MENUITEM "Vložit\tCTRL-V", IDM_EDIT_PASTE END POPUP "Zobrazit" BEGIN - MENUITEM "Standardn", IDM_VIEW_STANDARD, CHECKED - MENUITEM "Vdeck", IDM_VIEW_SCIENTIFIC, CHECKED - MENUITEM "Pevody", IDM_VIEW_CONVERSION + MENUITEM "Standardní", IDM_VIEW_STANDARD, CHECKED + MENUITEM "Vìdecká", IDM_VIEW_SCIENTIFIC, CHECKED + MENUITEM "Pøevody", IDM_VIEW_CONVERSION MENUITEM SEPARATOR - MENUITEM "estnctkov\tF5", IDM_VIEW_HEX, CHECKED - MENUITEM "Destkov\tF6", IDM_VIEW_DEC, CHECKED - MENUITEM "Osmikov\tF7", IDM_VIEW_OCT, CHECKED - MENUITEM "Binrn\tF8", IDM_VIEW_BIN, CHECKED + MENUITEM "Šestnáctkovì\tF5", IDM_VIEW_HEX, CHECKED + MENUITEM "Desítkovì\tF6", IDM_VIEW_DEC, CHECKED + MENUITEM "Osmièkovì\tF7", IDM_VIEW_OCT, CHECKED + MENUITEM "Binárnì\tF8", IDM_VIEW_BIN, CHECKED MENUITEM SEPARATOR MENUITEM "Qword\tF12", IDM_VIEW_QWORD, CHECKED MENUITEM "Dword\tF2", IDM_VIEW_DWORD, CHECKED MENUITEM "Word\tF3", IDM_VIEW_WORD, CHECKED MENUITEM "Byte\tF4", IDM_VIEW_BYTE, CHECKED MENUITEM SEPARATOR - MENUITEM "Seskupovn slic", IDM_VIEW_GROUP, CHECKED + MENUITEM "Seskupování èíslic", IDM_VIEW_GROUP, CHECKED END - POPUP "Npovda" + POPUP "Nápovìda" BEGIN - MENUITEM "Tmata npovdy", IDM_HELP_HELP + MENUITEM "Témata nápovìdy", IDM_HELP_HELP MENUITEM SEPARATOR - MENUITEM "O ReactOS kalkulace", IDM_HELP_ABOUT + MENUITEM "O ReactOS kalkulaèce", IDM_HELP_ABOUT END END IDR_MENU_STANDARD MENU DISCARDABLE BEGIN - POPUP "pravy" + POPUP "Úpravy" BEGIN - MENUITEM "Koprovat\tCTRL-C", IDM_EDIT_COPY - MENUITEM "Vloit\tCTRL-V", IDM_EDIT_PASTE + MENUITEM "Kopírovat\tCTRL-C", IDM_EDIT_COPY + MENUITEM "Vložit\tCTRL-V", IDM_EDIT_PASTE END POPUP "Zobrazit" BEGIN - MENUITEM "Standardn", IDM_VIEW_STANDARD, CHECKED - MENUITEM "Vdeck", IDM_VIEW_SCIENTIFIC, CHECKED - MENUITEM "Pevody", IDM_VIEW_CONVERSION + MENUITEM "Standardní", IDM_VIEW_STANDARD, CHECKED + MENUITEM "Vìdecká", IDM_VIEW_SCIENTIFIC, CHECKED + MENUITEM "Pøevody", IDM_VIEW_CONVERSION MENUITEM SEPARATOR - MENUITEM "Seskupovn slic", IDM_VIEW_GROUP, CHECKED + MENUITEM "Seskupování èíslic", IDM_VIEW_GROUP, CHECKED END - POPUP "Npovda" + POPUP "Nápovìda" BEGIN - MENUITEM "Tmata npovdy", IDM_HELP_HELP + MENUITEM "Témata nápovìdy", IDM_HELP_HELP MENUITEM SEPARATOR - MENUITEM "O ReactOS kalkulace", IDM_HELP_ABOUT + MENUITEM "O ReactOS kalkulaèce", IDM_HELP_ABOUT END END @@ -436,66 +436,66 @@ END STRINGTABLE DISCARDABLE BEGIN - IDS_STRING_LICENSE "ReactOS kalkulaka je svobodn software vydan pod licenc GNU GPL.\r\n\r\nZde najdete znn GNU GPL licence:\r\nhttp://www.gnu.org/licenses/gpl.html\r\n\r\nZde tak najdete peklad GNU GPL licence:\r\nhttp://www.gnu.org/licenses/translations.html" + IDS_STRING_LICENSE "ReactOS kalkulaèka je svobodný software vydaný pod licencí GNU GPL.\r\n\r\nZde najdete znìní GNU GPL licence:\r\nhttp://www.gnu.org/licenses/gpl.html\r\n\r\nZde také najdete pøeklad GNU GPL licence:\r\nhttp://www.gnu.org/licenses/translations.html" IDS_MATH_ERROR "Chyba" - IDS_QUICKHELP "Rychl npovda" + IDS_QUICKHELP "Rychlá nápovìda" END // types of conversion STRINGTABLE DISCARDABLE BEGIN - IDS_CONV_TIME "as" - IDS_CONV_LENGTH "Dlka" + IDS_CONV_TIME "Èas" + IDS_CONV_LENGTH "Délka" IDS_CONV_ENERGY "Energie" IDS_CONV_WEIGHT "Hmotnost" - IDS_CONV_CURRENCY "Mna" + IDS_CONV_CURRENCY "Mìna" IDS_CONV_VOLUME "Objem" IDS_CONV_AREA "Plocha" IDS_CONV_VELOCITY "Rychlost" - IDS_CONV_CONSUMPTION "Spoteba" + IDS_CONV_CONSUMPTION "Spotøeba" IDS_CONV_TEMPERATURE "Teplota" IDS_CONV_PRESSURE "Tlak" - IDS_CONV_ANGLE "hel" - IDS_CONV_POWER "Vkon" + IDS_CONV_ANGLE "Úhel" + IDS_CONV_POWER "Výkon" END // TYPES OF ANGLES STRINGTABLE DISCARDABLE BEGIN IDS_ANGLE_GRADIANS "Grady" - IDS_ANGLE_RADIANS "Radiny" - IDS_ANGLE_DEGREES "Stupn" + IDS_ANGLE_RADIANS "Radiány" + IDS_ANGLE_DEGREES "Stupnì" END // TYPES OF AREAS STRINGTABLE DISCARDABLE BEGIN IDS_AREA_ACRES "Akry" - IDS_AREA_ACRES_BRAZIL "Akry (Brazlie)" + IDS_AREA_ACRES_BRAZIL "Akry (Brazílie)" IDS_AREA_ACRES_FRANCE "Akry (Francie)" IDS_AREA_ACRES_SCOTS "Akry (Skotsko)" IDS_AREA_ACRES_US "Akry (USA)" IDS_AREA_ARES "Ary" IDS_AREA_CHOU "Chou" - IDS_AREA_SQUARE_CENTIMETERS "tveren centimetry" - IDS_AREA_SQUARE_CHR "tveren chr" - IDS_AREA_SQUARE_FATHOMS "tveren fathomy" - IDS_AREA_SQUARE_FATHOMS_HUNGARY "tveren fathomy (Maarsko)" - IDS_AREA_SQUARE_FEET "tveren stopy" - IDS_AREA_SQUARE_INCHES "tveren palce" - IDS_AREA_SQUARE_KILOMETERS "tveren kilometry" - IDS_AREA_SQUARE_LAR "tveren lar" - IDS_AREA_SQUARE_METER "tveren metry" - IDS_AREA_SQUARE_MILES "tveren mle" - IDS_AREA_SQUARE_MILLIMETERS "tveren milimetry" - IDS_AREA_SQUARE_SHAKU "tveren shaku" - IDS_AREA_SQUARE_TSUEN "tveren tsuen" - IDS_AREA_SQUARE_VA "tveren va" - IDS_AREA_SQUARE_YARD "tveren yardy" + IDS_AREA_SQUARE_CENTIMETERS "Ètvereèní centimetry" + IDS_AREA_SQUARE_CHR "Ètvereèní chr" + IDS_AREA_SQUARE_FATHOMS "Ètvereèní fathomy" + IDS_AREA_SQUARE_FATHOMS_HUNGARY "Ètvereèní fathomy (Maïarsko)" + IDS_AREA_SQUARE_FEET "Ètvereèní stopy" + IDS_AREA_SQUARE_INCHES "Ètvereèní palce" + IDS_AREA_SQUARE_KILOMETERS "Ètvereèní kilometry" + IDS_AREA_SQUARE_LAR "Ètvereèní lar" + IDS_AREA_SQUARE_METER "Ètvereèní metry" + IDS_AREA_SQUARE_MILES "Ètvereèní míle" + IDS_AREA_SQUARE_MILLIMETERS "Ètvereèní milimetry" + IDS_AREA_SQUARE_SHAKU "Ètvereèní shaku" + IDS_AREA_SQUARE_TSUEN "Ètvereèní tsuen" + IDS_AREA_SQUARE_VA "Ètvereèní va" + IDS_AREA_SQUARE_YARD "Ètvereèní yardy" IDS_AREA_DANBO "Danbo" IDS_AREA_HECTARES "Hektary" IDS_AREA_JEONGBO "Jeongbo" - IDS_AREA_MORGEN_HUNGARY "Morgen (Maarsko)" + IDS_AREA_MORGEN_HUNGARY "Morgen (Maïarsko)" IDS_AREA_MU "Mu" IDS_AREA_PING "Ping" IDS_AREA_PYEONG "Pyeong" @@ -510,56 +510,56 @@ END STRINGTABLE DISCARDABLE BEGIN IDS_CONSUMPTION_KM_PER_L "Kilometry/litr" - IDS_CONSUMPTION_L_PER_100_KM "Litry/100 kilometr" - IDS_CONSUMPTION_MILES_GALLON_UK "Mle/galon (UK)" - IDS_CONSUMPTION_MILES_GALLON_US "Mle/galon (USA)" + IDS_CONSUMPTION_L_PER_100_KM "Litry/100 kilometrù" + IDS_CONSUMPTION_MILES_GALLON_UK "Míle/galon (UK)" + IDS_CONSUMPTION_MILES_GALLON_US "Míle/galon (USA)" END // TYPES OF CURRENCIES STRINGTABLE DISCARDABLE BEGIN - IDS_CURRENCY_BELGIAN_FRANC "Belgick frank" - IDS_CURRENCY_CZECH_KORUNA "esk koruna" + IDS_CURRENCY_BELGIAN_FRANC "Belgický frank" + IDS_CURRENCY_CZECH_KORUNA "Èeská koruna" IDS_CURRENCY_EURO "Euro" - IDS_CURRENCY_FINNISH_MARKKA "Finsk marka" - IDS_CURRENCY_FRENCH_FRANC "Francouzsk frank" - IDS_CURRENCY_IRISH_POUND "Irsk libra" - IDS_CURRENCY_ITALIAN_LIRA "Italsk lira" - IDS_CURRENCY_CYPRIOT_POUND "Kypersk libra" - IDS_CURRENCY_LUXEMBOURG_FRANC "Lucembursk frank" - IDS_CURRENCY_MALTESE_LIRA "Maltsk lira" - IDS_CURRENCY_DEUTSCHE_MARK "Nmeck marka" - IDS_CURRENCY_DUTCH_GUILDER "Nizozemsk gulden" - IDS_CURRENCY_PORTOGUESE_ESCUDO "Portugalsk escudo" - IDS_CURRENCY_AUSTRIAN_SCHILLING "Rakousk ilink" - IDS_CURRENCY_GREEK_DRACHMA "eck drachma" - IDS_CURRENCY_SLOVAK_KORUNA "Slovensk koruna" - IDS_CURRENCY_SLOVENIAN_TOLAR "Slovinsk tolar" - IDS_CURRENCY_SPANISH_PESETA "panlsk peseta" + IDS_CURRENCY_FINNISH_MARKKA "Finská marka" + IDS_CURRENCY_FRENCH_FRANC "Francouzský frank" + IDS_CURRENCY_IRISH_POUND "Irská libra" + IDS_CURRENCY_ITALIAN_LIRA "Italská lira" + IDS_CURRENCY_CYPRIOT_POUND "Kyperská libra" + IDS_CURRENCY_LUXEMBOURG_FRANC "Lucemburský frank" + IDS_CURRENCY_MALTESE_LIRA "Maltská lira" + IDS_CURRENCY_DEUTSCHE_MARK "Nìmecká marka" + IDS_CURRENCY_DUTCH_GUILDER "Nizozemský gulden" + IDS_CURRENCY_PORTOGUESE_ESCUDO "Portugalské escudo" + IDS_CURRENCY_AUSTRIAN_SCHILLING "Rakouský šilink" + IDS_CURRENCY_GREEK_DRACHMA "Øecká drachma" + IDS_CURRENCY_SLOVAK_KORUNA "Slovenská koruna" + IDS_CURRENCY_SLOVENIAN_TOLAR "Slovinský tolar" + IDS_CURRENCY_SPANISH_PESETA "Španìlská peseta" END // TYPES OF ENERGIES STRINGTABLE DISCARDABLE BEGIN - IDS_ENERGY_15_C_CALORIES "15 C kalorie" - IDS_ENERGY_BTUS "Britsk termln jednotky" + IDS_ENERGY_15_C_CALORIES "15 °C kalorie" + IDS_ENERGY_BTUS "Britské termální jednotky" IDS_ENERGY_EVS "Elektronvolty" IDS_ENERGY_FOOT_POUNDS "Foot-Pounds" IDS_ENERGY_ERGS "Ergy" IDS_ENERGY_JOULES "Jouly" IDS_ENERGY_KILOJOULES "Kilojouly" IDS_ENERGY_KILOWATT_HOURS "Kilowatt hodiny" - IDS_ENERGY_IT_CALORIES "Mezinrodn kalorie" - IDS_ENERGY_IT_KILOCALORIES "Mezinrodn kilokalorie" - IDS_ENERGY_NUTRITION_CALORIES "Nutrin kalorie" - IDS_ENERGY_TH_CALORIES "Termochemick kalorie" + IDS_ENERGY_IT_CALORIES "Mezinárodní kalorie" + IDS_ENERGY_IT_KILOCALORIES "Mezinárodní kilokalorie" + IDS_ENERGY_NUTRITION_CALORIES "Nutrièní kalorie" + IDS_ENERGY_TH_CALORIES "Termochemické kalorie" END // TYPES OF LENGTHS STRINGTABLE DISCARDABLE BEGIN - IDS_LENGTH_ANGSTROMS "Angstrmy" - IDS_LENGTH_ASTRONOMICAL_UNITS "Astronomick jednotky" + IDS_LENGTH_ANGSTROMS "Angströmy" + IDS_LENGTH_ASTRONOMICAL_UNITS "Astronomické jednotky" IDS_LENGTH_BARLEYCORNS "Barleycorny" IDS_LENGTH_CENTIMETERS "Centimetry" IDS_LENGTH_CHAINS_UK "Chains (Gunter's chains) (UK)" @@ -568,10 +568,10 @@ BEGIN IDS_LENGTH_CHR "Chr" IDS_LENGTH_CUN "Cun" IDS_LENGTH_FATHOMS "Fathomy" - IDS_LENGTH_FATHOMS_HUNGARY "Fathomy (Maarsko)" + IDS_LENGTH_FATHOMS_HUNGARY "Fathomy (Maïarsko)" IDS_LENGTH_FURLONGS "Furlongy" IDS_LENGTH_GAN "Gan" - IDS_LENGTH_HANDS "Hands (dlan)" + IDS_LENGTH_HANDS "Hands (dlanì)" IDS_LENGTH_HUNH "Hunh" IDS_LENGTH_JA "Ja" IDS_LENGTH_JEONG "Jeong" @@ -583,9 +583,9 @@ BEGIN IDS_LENGTH_LINKS_UK "Links (UK)" IDS_LENGTH_METERS "Metry" IDS_LENGTH_MICRONS "Mikrony" - IDS_LENGTH_MILES "Mle" + IDS_LENGTH_MILES "Míle" IDS_LENGTH_MILLIMETERS "Milimetry" - IDS_LENGTH_NAUTICAL_MILES "Nmon mle" + IDS_LENGTH_NAUTICAL_MILES "Námoøní míle" IDS_LENGTH_NIEU "Nieu" IDS_LENGTH_INCHES "Palce" IDS_LENGTH_PARSECS "Parseky" @@ -599,7 +599,7 @@ BEGIN IDS_LENGTH_SPAN "Span" IDS_LENGTH_FEET "Stopy" IDS_LENGTH_SUN "Sun" - IDS_LENGTH_LIGHT_YEARS "Svteln roky" + IDS_LENGTH_LIGHT_YEARS "Svìtelné roky" IDS_LENGTH_TSUEN "Tsuen" IDS_LENGTH_VA "Va" IDS_LENGTH_YARDS "Yardy" @@ -610,9 +610,9 @@ END // TYPES OF POWERS STRINGTABLE DISCARDABLE BEGIN - IDS_POWER_BTUS_PER_MINUTE "Britsk termln jednotky za minutu" + IDS_POWER_BTUS_PER_MINUTE "Britské termální jednotky za minutu" IDS_POWER_FPS_PER_MINUTE "Foot-Pounds za minutu" - IDS_POWER_HORSEPOWER "Kosk sly" + IDS_POWER_HORSEPOWER "Koòské síly" IDS_POWER_KILOWATTS "Kilowatty" IDS_POWER_MEGAWATTS "Megawatty" IDS_POWER_WATTS "Watty" @@ -621,12 +621,12 @@ END // TYPE OF PRESSURES STRINGTABLE DISCARDABLE BEGIN - IDS_PRESSURE_ATMOSPHERES "Atmosfry" + IDS_PRESSURE_ATMOSPHERES "Atmosféry" IDS_PRESSURE_BARS "Bary" IDS_PRESSURE_HECTOPASCALS "Hektopascaly" IDS_PRESSURE_KILOPASCALS "Kilopascaly" - IDS_PRESSURE_PSI "Libry na tvercov palec" - IDS_PRESSURE_MM_OF_MERCURY "Milimetry rtuovho sloupce" + IDS_PRESSURE_PSI "Libry na ètvercový palec" + IDS_PRESSURE_MM_OF_MERCURY "Milimetry rtuového sloupce" IDS_PRESSURE_PASCALS "Pascaly" END @@ -650,7 +650,7 @@ BEGIN IDS_TIME_MINUTES "Minuty" IDS_TIME_SECONDS "Sekundy" IDS_TIME_YEARS "Roky" - IDS_TIME_WEEKS "Tdny" + IDS_TIME_WEEKS "Týdny" END // TYPES OF VELOCITIES @@ -660,7 +660,7 @@ BEGIN IDS_VELOCITY_KILOMETERS_HOUR "Kilometry za hodinu" IDS_VELOCITY_MACH "Machy" IDS_VELOCITY_METERS_SECOND "Metry za sekundu" - IDS_VELOCITY_MILES_HOUR "Mle za hodinu" + IDS_VELOCITY_MILES_HOUR "Míle za hodinu" IDS_VELOCITY_FEET_HOUR "Stopy za hodinu" IDS_VELOCITY_FEET_SECOND "Stopy za sekundu" IDS_VELOCITY_KNOTS "Uzly" @@ -672,30 +672,30 @@ BEGIN IDS_VOLUME_BARRELS_UK "Barely (UK)" IDS_VOLUME_BARRELS_OIL "Barely ropy" IDS_VOLUME_BUN "Bun" - IDS_VOLUME_BUSHELS_UK "Buly (UK)" - IDS_VOLUME_BUSHELS_US "Buly (USA)" - IDS_VOLUME_QUARTS_UK "tvrtky (UK)" - IDS_VOLUME_QUARTS_DRY_US "tvrtky, such (USA)" - IDS_VOLUME_QUARTS_LIQUID_US "tvrtky, tekut (USA)" + IDS_VOLUME_BUSHELS_UK "Bušly (UK)" + IDS_VOLUME_BUSHELS_US "Bušly (USA)" + IDS_VOLUME_QUARTS_UK "Ètvrtky (UK)" + IDS_VOLUME_QUARTS_DRY_US "Ètvrtky, suché (USA)" + IDS_VOLUME_QUARTS_LIQUID_US "Ètvrtky, tekuté (USA)" IDS_VOLUME_DOE "Doe" IDS_VOLUME_GALLONS_UK "Galony (UK)" - IDS_VOLUME_GALLONS_DRY_US "Galony, such (USA)" - IDS_VOLUME_GALLONS_LIQUID_US "Galony, tekut (USA)" + IDS_VOLUME_GALLONS_DRY_US "Galony, suché (USA)" + IDS_VOLUME_GALLONS_LIQUID_US "Galony, tekuté (USA)" IDS_VOLUME_GOU "Gou" IDS_VOLUME_HOP "Hop" IDS_VOLUME_ICCE "Icce" - IDS_VOLUME_CUBIC_CENTIMETERS "Krychlov centimetry" - IDS_VOLUME_CUBIC_FEET "Krychlov stopy" - IDS_VOLUME_CUBIC_INCHES "Krychlov palce" - IDS_VOLUME_CUBIC_METERS "Krychlov metry" - IDS_VOLUME_CUBIC_YARDS "Krychlov yardy" + IDS_VOLUME_CUBIC_CENTIMETERS "Krychlové centimetry" + IDS_VOLUME_CUBIC_FEET "Krychlové stopy" + IDS_VOLUME_CUBIC_INCHES "Krychlové palce" + IDS_VOLUME_CUBIC_METERS "Krychlové metry" + IDS_VOLUME_CUBIC_YARDS "Krychlové yardy" IDS_VOLUME_KWIAN "Kwian" IDS_VOLUME_LITERS "Litry" IDS_VOLUME_MAL "Mal" IDS_VOLUME_MILLILITERS "Mililitry" IDS_VOLUME_PINTS_UK "Pinty (UK)" - IDS_VOLUME_PINTS_DRY_US "Pinty, such (USA)" - IDS_VOLUME_PINTS_LIQUID_US "Pinty, tekut (USA)" + IDS_VOLUME_PINTS_DRY_US "Pinty, suché (USA)" + IDS_VOLUME_PINTS_LIQUID_US "Pinty, tekuté (USA)" IDS_VOLUME_SEKI "Seki" IDS_VOLUME_SYOU "Syou" IDS_VOLUME_TANANLOUNG "Tananloung" @@ -709,17 +709,17 @@ END STRINGTABLE DISCARDABLE BEGIN IDS_WEIGHT_BAHT "Baht" - IDS_WEIGHT_QUINTAL_METRIC "Centy (metrick)" + IDS_WEIGHT_QUINTAL_METRIC "Centy (metrické)" IDS_WEIGHT_CHUNG "Chung" IDS_WEIGHT_DON "Don" IDS_WEIGHT_GEUN "Geun" IDS_WEIGHT_GRAMS "Gramy" IDS_WEIGHT_GWAN "Gwan" IDS_WEIGHT_HARB "Harb" - IDS_WEIGHT_JIN_CHINA "Jin (na)" + IDS_WEIGHT_JIN_CHINA "Jin (Èína)" IDS_WEIGHT_JIN_TAIWAN "Jin (Taiwan)" IDS_WEIGHT_KAN "Kan" - IDS_WEIGHT_CARATS "Karty" + IDS_WEIGHT_CARATS "Karáty" IDS_WEIGHT_KILOGRAMS "Kilogramy" IDS_WEIGHT_KIN "Kin" IDS_WEIGHT_LIANG_CHINA "Liang (China)" @@ -729,9 +729,9 @@ BEGIN IDS_WEIGHT_SALOUNG "Saloung" IDS_WEIGHT_STONES "Stones" IDS_WEIGHT_TAMLUNG "Tamlung" - IDS_WEIGHT_TONNES "Tuny (metrick)" + IDS_WEIGHT_TONNES "Tuny (metrické)" IDS_WEIGHT_TONS_UK "Tuny (UK)" IDS_WEIGHT_TONS_US "Tuny (USA)" - IDS_WEIGHT_OUNCES_AVOIRDUPOIS "Unce (angloamerick)" - IDS_WEIGHT_OUNCES_TROY "Unce (trojsk/lkrensk)" + IDS_WEIGHT_OUNCES_AVOIRDUPOIS "Unce (angloamerické)" + IDS_WEIGHT_OUNCES_TROY "Unce (trojské/lékárenské)" END diff --git a/base/applications/calc/lang/de-DE.rc b/base/applications/calc/lang/de-DE.rc index d3aa5436a8f..a3561fc421d 100644 --- a/base/applications/calc/lang/de-DE.rc +++ b/base/applications/calc/lang/de-DE.rc @@ -151,7 +151,7 @@ BEGIN BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP PUSHBUTTON "CE",IDC_BUTTON_CE,228,40,40,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP - PUSHBUTTON "Zurck",IDC_BUTTON_BACK,184,40,40,17,BS_CENTER | + PUSHBUTTON "Zurück",IDC_BUTTON_BACK,184,40,40,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP RTEXT "",IDC_TEXT_OUTPUT,4,4,308,12,SS_CENTERIMAGE, WS_EX_CLIENTEDGE @@ -168,7 +168,7 @@ BEGIN BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP PUSHBUTTON "CE",IDC_BUTTON_CE,84,24,40,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP - PUSHBUTTON "Zurck",IDC_BUTTON_BACK,40,24,40,17,BS_CENTER | + PUSHBUTTON "Zurück",IDC_BUTTON_BACK,40,24,40,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP RTEXT "",IDC_TEXT_OUTPUT,4,4,164,12,SS_CENTERIMAGE, WS_EX_CLIENTEDGE @@ -245,7 +245,7 @@ BEGIN BS_VCENTER | BS_NOTIFY | WS_TABSTOP,276,24,40,17 CONTROL "CE",IDC_BUTTON_CE,"Button",BS_OWNERDRAW | BS_CENTER | BS_VCENTER | BS_NOTIFY | WS_TABSTOP,232,24,40,17 - CONTROL "Zurck",IDC_BUTTON_BACK,"Button",BS_OWNERDRAW | + CONTROL "Zurück",IDC_BUTTON_BACK,"Button",BS_OWNERDRAW | BS_CENTER | BS_VCENTER | BS_NOTIFY | WS_TABSTOP,188,24, 40,17 RTEXT "",IDC_TEXT_OUTPUT,4,4,312,12,SS_CENTERIMAGE, @@ -305,7 +305,7 @@ END IDD_DIALOG_ABOUT DIALOGEX DISCARDABLE 0, 0, 264, 169 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "ber ReactOS Rechner" +CAPTION "Über ReactOS Rechner" FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "OK",IDOK,105,148,52,16 @@ -344,7 +344,7 @@ BEGIN POPUP "Bearbeiten" BEGIN MENUITEM "Kopieren\tSTRG-C", IDM_EDIT_COPY - MENUITEM "Einfgen\tSTRG-V", IDM_EDIT_PASTE + MENUITEM "Einfügen\tSTRG-V", IDM_EDIT_PASTE END POPUP "Ansicht" BEGIN @@ -355,7 +355,7 @@ BEGIN MENUITEM "Hex\tF5", IDM_VIEW_HEX, CHECKED MENUITEM "Dezimal\tF6", IDM_VIEW_DEC, CHECKED MENUITEM "Oktal\tF7", IDM_VIEW_OCT, CHECKED - MENUITEM "Binr\tF8", IDM_VIEW_BIN, CHECKED + MENUITEM "Binär\tF8", IDM_VIEW_BIN, CHECKED MENUITEM SEPARATOR MENUITEM "Degree\tF2", IDM_VIEW_DEG, CHECKED MENUITEM "Radian\tF3", IDM_VIEW_RAD, CHECKED @@ -376,7 +376,7 @@ BEGIN POPUP "Bearbeiten" BEGIN MENUITEM "Kopieren\tSTRG-C", IDM_EDIT_COPY - MENUITEM "Einfgen\tSTRG-V", IDM_EDIT_PASTE + MENUITEM "Einfügen\tSTRG-V", IDM_EDIT_PASTE END POPUP "Ansicht" BEGIN @@ -387,7 +387,7 @@ BEGIN MENUITEM "Hex\tF5", IDM_VIEW_HEX, CHECKED MENUITEM "Dezimal\tF6", IDM_VIEW_DEC, CHECKED MENUITEM "Oktal\tF7", IDM_VIEW_OCT, CHECKED - MENUITEM "Binr\tF8", IDM_VIEW_BIN, CHECKED + MENUITEM "Binär\tF8", IDM_VIEW_BIN, CHECKED MENUITEM SEPARATOR MENUITEM "Qword\tF12", IDM_VIEW_QWORD, CHECKED MENUITEM "Dword\tF2", IDM_VIEW_DWORD, CHECKED @@ -400,7 +400,7 @@ BEGIN BEGIN MENUITEM "Hilfethemen", IDM_HELP_HELP MENUITEM SEPARATOR - MENUITEM "ber ReactOS Rechner", IDM_HELP_ABOUT + MENUITEM "Über ReactOS Rechner", IDM_HELP_ABOUT END END @@ -409,7 +409,7 @@ BEGIN POPUP "Bearbeiten" BEGIN MENUITEM "Kopieren\tSTRG-C", IDM_EDIT_COPY - MENUITEM "Einfgen\tSTRG-V", IDM_EDIT_PASTE + MENUITEM "Einfügen\tSTRG-V", IDM_EDIT_PASTE END POPUP "Ansicht" BEGIN @@ -423,7 +423,7 @@ BEGIN BEGIN MENUITEM "Hilfethemen", IDM_HELP_HELP MENUITEM SEPARATOR - MENUITEM "ber ReactOS Rechner", IDM_HELP_ABOUT + MENUITEM "Über ReactOS Rechner", IDM_HELP_ABOUT END END @@ -431,7 +431,7 @@ END STRINGTABLE DISCARDABLE BEGIN - IDS_STRING_LICENSE "ReactOS Rechner ist freie Software, herausgegeben unter der GNU GPL Lizenz.\r\n\r\nSie knnen hier eine Kopie der GNU GPL Lizenz erhalten:\r\nhttp://www.gnu.org/licenses/gpl.html\r\n\r\nSie knnen hier auch eine bersetzung der GNU GPL Lizenz erhalten:\r\nhttp://www.gnu.org/licenses/translations.html" + IDS_STRING_LICENSE "ReactOS Rechner ist freie Software, herausgegeben unter der GNU GPL Lizenz.\r\n\r\nSie können hier eine Kopie der GNU GPL Lizenz erhalten:\r\nhttp://www.gnu.org/licenses/gpl.html\r\n\r\nSie können hier auch eine Übersetzung der GNU GPL Lizenz erhalten:\r\nhttp://www.gnu.org/licenses/translations.html" IDS_MATH_ERROR "Fehler" IDS_QUICKHELP "Schnellhilfe" END @@ -442,14 +442,14 @@ BEGIN IDS_CONV_POWER "Arbeit" IDS_CONV_PRESSURE "Druck" IDS_CONV_ENERGY "Energie" - IDS_CONV_AREA "Flche" + IDS_CONV_AREA "Fläche" IDS_CONV_VELOCITY "Geschwindigkeit" IDS_CONV_WEIGHT "Gewicht" - IDS_CONV_LENGTH "Lngenma" + IDS_CONV_LENGTH "Längenmaß" IDS_CONV_TEMPERATURE "Temperatur" IDS_CONV_CONSUMPTION "Verbrauch (Motoren)" IDS_CONV_VOLUME "Volumeneinheit" - IDS_CONV_CURRENCY "Whrung" + IDS_CONV_CURRENCY "Währung" IDS_CONV_ANGLE "Winkel" IDS_CONV_TIME "Zeit" END @@ -462,7 +462,7 @@ BEGIN IDS_ANGLE_RADIANS "Radiant" END -// FLCHENTYPEN +// FLÄCHENTYPEN STRINGTABLE DISCARDABLE BEGIN IDS_AREA_ACRES "Acre" @@ -485,7 +485,7 @@ BEGIN IDS_AREA_SQUARE_CHR "Quadratchr" IDS_AREA_SQUARE_FATHOMS "Quadratfathom" IDS_AREA_SQUARE_FATHOMS_HUNGARY "Quadratfathom (Ungarn)" - IDS_AREA_SQUARE_FEET "Quadratfu" + IDS_AREA_SQUARE_FEET "Quadratfuß" IDS_AREA_SQUARE_KILOMETERS "Quadratkilometer" IDS_AREA_SQUARE_LAR "Quadratlar" IDS_AREA_SQUARE_METER "Quadratmeter" @@ -510,21 +510,21 @@ BEGIN IDS_CONSUMPTION_MILES_GALLON_US "Meilen/Gallone (USA)" END -// WHRUNGSTYPEN +// WÄHRUNGSTYPEN STRINGTABLE DISCARDABLE BEGIN IDS_CURRENCY_BELGIAN_FRANC "Belgische Franc" IDS_CURRENCY_DEUTSCHE_MARK "Deutsche Mark" IDS_CURRENCY_EURO "Euro" IDS_CURRENCY_FINNISH_MARKKA "Finnische Mark" - IDS_CURRENCY_FRENCH_FRANC "Franzschische Franc" + IDS_CURRENCY_FRENCH_FRANC "Französchische Franc" IDS_CURRENCY_GREEK_DRACHMA "Griechische Drachme" IDS_CURRENCY_IRISH_POUND "Irische Pfund" IDS_CURRENCY_ITALIAN_LIRA "Italienische Lire" IDS_CURRENCY_LUXEMBOURG_FRANC "Luxemburgische Franc" IDS_CURRENCY_MALTESE_LIRA "Maltesische Lire" - IDS_CURRENCY_DUTCH_GUILDER "Niederlndische Guilder" - IDS_CURRENCY_AUSTRIAN_SCHILLING "sterreichische Schilling" + IDS_CURRENCY_DUTCH_GUILDER "Niederländische Guilder" + IDS_CURRENCY_AUSTRIAN_SCHILLING "Österreichische Schilling" IDS_CURRENCY_PORTOGUESE_ESCUDO "Portugiesische Escudo" IDS_CURRENCY_SLOVAK_KORUNA "Slowakische Krone" IDS_CURRENCY_SLOVENIAN_TOLAR "Slovenische Tolar" @@ -536,11 +536,11 @@ END // ENERGIETYPEN STRINGTABLE DISCARDABLE BEGIN - IDS_ENERGY_15_C_CALORIES "15 C Kalorien" + IDS_ENERGY_15_C_CALORIES "15 °C Kalorien" IDS_ENERGY_BTUS "British thermal unit" IDS_ENERGY_EVS "Elektronenvolt" IDS_ENERGY_ERGS "Ergs" - IDS_ENERGY_NUTRITION_CALORIES "Ernhrung Kalorien" + IDS_ENERGY_NUTRITION_CALORIES "Ernährung Kalorien" IDS_ENERGY_FOOT_POUNDS "Foot-Pound" IDS_ENERGY_IT_CALORIES "International Kalorien" IDS_ENERGY_IT_KILOCALORIES "International Kilokalorien" @@ -550,10 +550,10 @@ BEGIN IDS_ENERGY_TH_CALORIES "Thermochemische Kalorie" END -// LNGENTYPEN +// LÄNGENTYPEN STRINGTABLE DISCARDABLE BEGIN - IDS_LENGTH_ANGSTROMS "Angstrms" + IDS_LENGTH_ANGSTROMS "Angströms" IDS_LENGTH_ASTRONOMICAL_UNITS "Astronomische Einheiten" IDS_LENGTH_CHAINS_UK "Chains (UK)" IDS_LENGTH_CHI "Chi" @@ -563,10 +563,10 @@ BEGIN IDS_LENGTH_FATHOMS "Fathome" IDS_LENGTH_FATHOMS_HUNGARY "Fathome (Ungarn)" IDS_LENGTH_FURLONGS "Furlongs" - IDS_LENGTH_FEET "Fu" + IDS_LENGTH_FEET "Fuß" IDS_LENGTH_GAN "Gan" IDS_LENGTH_BARLEYCORNS "Gerstenkorn" - IDS_LENGTH_HANDS "Hnde" + IDS_LENGTH_HANDS "Hände" IDS_LENGTH_HUNH "Hunh" IDS_LENGTH_JA "Ja" IDS_LENGTH_JEONG "Jeong" @@ -609,14 +609,14 @@ BEGIN IDS_POWER_FPS_PER_MINUTE "Foot-Pound pro Minute" IDS_POWER_KILOWATTS "Kilowatt" IDS_POWER_MEGAWATTS "Megawatt" - IDS_POWER_HORSEPOWER "Pferdestrken" + IDS_POWER_HORSEPOWER "Pferdestärken" IDS_POWER_WATTS "Watt" END // DRUCKTYPEN STRINGTABLE DISCARDABLE BEGIN - IDS_PRESSURE_ATMOSPHERES "Atmosphren" + IDS_PRESSURE_ATMOSPHERES "Atmosphären" IDS_PRESSURE_BARS "Bar" IDS_PRESSURE_HECTOPASCALS "Hektopascal" IDS_PRESSURE_KILOPASCALS "Kilopascal" @@ -652,8 +652,8 @@ END STRINGTABLE DISCARDABLE BEGIN IDS_VELOCITY_CMS_SECOND "Zentimeter/Sekunde" - IDS_VELOCITY_FEET_SECOND "Fu/Sekunde" - IDS_VELOCITY_FEET_HOUR "Fu/Stunde" + IDS_VELOCITY_FEET_SECOND "Fuß/Sekunde" + IDS_VELOCITY_FEET_HOUR "Fuß/Stunde" IDS_VELOCITY_KILOMETERS_HOUR "Kilometer/Stunde" IDS_VELOCITY_KNOTS "Knoten" IDS_VELOCITY_MACH "Mach" @@ -665,9 +665,9 @@ END STRINGTABLE DISCARDABLE BEGIN IDS_VOLUME_BARRELS_UK "Barrel (UK)" - IDS_VOLUME_BARRELS_OIL "Barrel l" + IDS_VOLUME_BARRELS_OIL "Barrel Öl" IDS_VOLUME_BUN "Bun" - IDS_VOLUME_CUBIC_FEET "Kubikfu" + IDS_VOLUME_CUBIC_FEET "Kubikfuß" IDS_VOLUME_CUBIC_METERS "Kubikmeter" IDS_VOLUME_CUBIC_YARDS "Kubikyard" IDS_VOLUME_CUBIC_CENTIMETERS "Kubikzentimeter" @@ -676,7 +676,7 @@ BEGIN IDS_VOLUME_FLUID_OUNCES_UK "Fluid Unzen (UK)" IDS_VOLUME_FLUID_OUNCES_US "Fluid Unzen (USA)" IDS_VOLUME_GALLONS_UK "Gallonen (UK)" - IDS_VOLUME_GALLONS_LIQUID_US "Gallonen, flssig (USA)" + IDS_VOLUME_GALLONS_LIQUID_US "Gallonen, flüssig (USA)" IDS_VOLUME_GALLONS_DRY_US "Gallonen, trocken (USA)" IDS_VOLUME_GOU "Gou" IDS_VOLUME_HOP "Hop" @@ -687,9 +687,9 @@ BEGIN IDS_VOLUME_MILLILITERS "Milliliter" IDS_VOLUME_PINTS_UK "Pints (UK)" IDS_VOLUME_PINTS_DRY_US "Pints, trocken (USA)" - IDS_VOLUME_PINTS_LIQUID_US "Pints, flssig (USA)" + IDS_VOLUME_PINTS_LIQUID_US "Pints, flüssig (USA)" IDS_VOLUME_QUARTS_UK "Quarts (UK)" - IDS_VOLUME_QUARTS_LIQUID_US "Quarts, flssig (USA)" + IDS_VOLUME_QUARTS_LIQUID_US "Quarts, flüssig (USA)" IDS_VOLUME_QUARTS_DRY_US "Quarts, trocken (USA)" IDS_VOLUME_BUSHELS_UK "Scheffel (UK)" IDS_VOLUME_BUSHELS_US "Scheffel (USA)" diff --git a/base/applications/calc/lang/el-GR.rc b/base/applications/calc/lang/el-GR.rc index 5f88a9465e1..f11de0ba3a3 100644 --- a/base/applications/calc/lang/el-GR.rc +++ b/base/applications/calc/lang/el-GR.rc @@ -4,7 +4,7 @@ LANGUAGE LANG_GREEK, SUBLANG_DEFAULT IDD_DIALOG_SCIENTIFIC DIALOGEX 0, 0, 316, 161 STYLE DS_SHELLFONT | WS_MINIMIZEBOX | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "" +CAPTION "Αριθμομηχανή" MENU IDR_MENU_SCIENTIFIC_1 FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN @@ -141,11 +141,11 @@ BEGIN WS_VISIBLE,232,24,33,10 CONTROL "Byte",IDC_RADIO_BYTE,"Button",BS_AUTORADIOBUTTON | NOT WS_VISIBLE,272,24,30,10 - CONTROL "",IDC_RADIO_DEG,"Button",BS_AUTORADIOBUTTON,148,24, + CONTROL "Βαθμοί",IDC_RADIO_DEG,"Button",BS_AUTORADIOBUTTON,148,24, 42,10 - CONTROL "",IDC_RADIO_RAD,"Button",BS_AUTORADIOBUTTON,192, + CONTROL "Μοίρες",IDC_RADIO_RAD,"Button",BS_AUTORADIOBUTTON,192, 24,42,10 - CONTROL "",IDC_RADIO_GRAD,"Button",BS_AUTORADIOBUTTON, + CONTROL "Ακτίνια",IDC_RADIO_GRAD,"Button",BS_AUTORADIOBUTTON, 236,24,44,10 PUSHBUTTON "C",IDC_BUTTON_CANC,272,40,40,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP @@ -160,7 +160,7 @@ END IDD_DIALOG_STANDARD DIALOGEX 0, 0, 172, 127 STYLE DS_SHELLFONT | WS_MINIMIZEBOX | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "" +CAPTION "Αριθμομηχανή" MENU IDR_MENU_STANDARD FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN @@ -227,14 +227,14 @@ END IDD_DIALOG_CONVERSION DIALOGEX 0, 0, 320, 130 STYLE DS_SHELLFONT | WS_MINIMIZEBOX | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "" +CAPTION "Αριθμομηχανή" MENU IDR_MENU_STANDARD FONT 8, "MS Shell Dlg" BEGIN PUSHBUTTON "Convert",IDC_BUTTON_CONVERT,35,105,76,17 COMBOBOX IDC_COMBO_CATEGORY,4,31,140,168,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP | CBS_SORT - LTEXT ":",IDC_STATIC,4,20,56,8 + LTEXT "Κατηγορία:",IDC_STATIC,4,20,56,8 COMBOBOX IDC_COMBO_FROM,4,60,140,168,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP | CBS_SORT LTEXT "Convert from:",IDC_STATIC,4,49,56,8 @@ -305,16 +305,16 @@ END IDD_DIALOG_ABOUT DIALOGEX DISCARDABLE 0, 0, 264, 169 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "..." +CAPTION "Σχετικά..." FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "OK",IDOK,105,148,52,16 CONTROL IDB_BITMAP_ROS,IDC_STATIC,"Static",SS_BITMAP | SS_CENTERIMAGE | SS_REALSIZEIMAGE | WS_BORDER,4,4,104,48 - LTEXT "",IDC_STATIC,120,12,132,8, + LTEXT "Αριθμομηχανή",IDC_STATIC,120,12,132,8, SS_CENTERIMAGE - LTEXT " ",IDC_TEXT_VERSION,120,20,132,8,SS_CENTERIMAGE - LTEXT " Carlo Bramini",IDC_STATIC,120,32,132,8, + LTEXT "Έκδοση ",IDC_TEXT_VERSION,120,20,132,8,SS_CENTERIMAGE + LTEXT "Από τον Carlo Bramini",IDC_STATIC,120,32,132,8, SS_CENTERIMAGE GROUPBOX "",IDC_STATIC,112,0,148,52 GROUPBOX "",IDC_STATIC,4,56,256,88 @@ -341,16 +341,16 @@ END IDR_MENU_SCIENTIFIC_1 MENU DISCARDABLE BEGIN - POPUP "" + POPUP "Επεξεργασία" BEGIN - MENUITEM "\tCTRL-C", IDM_EDIT_COPY - MENUITEM "\tCTRL-V", IDM_EDIT_PASTE + MENUITEM "Αντιγραφή\tCTRL-C", IDM_EDIT_COPY + MENUITEM "Επικόλληση\tCTRL-V", IDM_EDIT_PASTE END POPUP "View" BEGIN - MENUITEM "", IDM_VIEW_STANDARD, CHECKED - MENUITEM "", IDM_VIEW_SCIENTIFIC, CHECKED - MENUITEM "", IDM_VIEW_CONVERSION + MENUITEM "Τυπική", IDM_VIEW_STANDARD, CHECKED + MENUITEM "Επιστημονική", IDM_VIEW_SCIENTIFIC, CHECKED + MENUITEM "Μετατροπή", IDM_VIEW_CONVERSION MENUITEM SEPARATOR MENUITEM "Hex\tF5", IDM_VIEW_HEX, CHECKED MENUITEM "Decimal\tF6", IDM_VIEW_DEC, CHECKED @@ -365,65 +365,65 @@ BEGIN END POPUP "Help" BEGIN - MENUITEM " ", IDM_HELP_HELP + MENUITEM "Θέματα Βοήθειας", IDM_HELP_HELP MENUITEM SEPARATOR - MENUITEM "...", IDM_HELP_ABOUT + MENUITEM "Σχετικά...", IDM_HELP_ABOUT END END IDR_MENU_SCIENTIFIC_2 MENU DISCARDABLE BEGIN - POPUP "" + POPUP "Επεξεργασία" BEGIN - MENUITEM "\tCTRL-C", IDM_EDIT_COPY - MENUITEM "\tCTRL-V", IDM_EDIT_PASTE + MENUITEM "Αντιγραφή\tCTRL-C", IDM_EDIT_COPY + MENUITEM "Επικόλληση\tCTRL-V", IDM_EDIT_PASTE END POPUP "View" BEGIN - MENUITEM "", IDM_VIEW_STANDARD, CHECKED - MENUITEM "", IDM_VIEW_SCIENTIFIC, CHECKED - MENUITEM "", IDM_VIEW_CONVERSION + MENUITEM "Τυπική", IDM_VIEW_STANDARD, CHECKED + MENUITEM "Επιστημονική", IDM_VIEW_SCIENTIFIC, CHECKED + MENUITEM "Μετατροπή", IDM_VIEW_CONVERSION MENUITEM SEPARATOR - MENUITEM "\tF5", IDM_VIEW_HEX, CHECKED - MENUITEM "\tF6", IDM_VIEW_DEC, CHECKED - MENUITEM "\tF7", IDM_VIEW_OCT, CHECKED - MENUITEM "\tF8", IDM_VIEW_BIN, CHECKED + MENUITEM "Δεκαεξαδικό\tF5", IDM_VIEW_HEX, CHECKED + MENUITEM "Δεκαδικό\tF6", IDM_VIEW_DEC, CHECKED + MENUITEM "Οκταδικό\tF7", IDM_VIEW_OCT, CHECKED + MENUITEM "Δυαδικό\tF8", IDM_VIEW_BIN, CHECKED MENUITEM SEPARATOR MENUITEM "Qword\tF12", IDM_VIEW_QWORD, CHECKED MENUITEM "Dword\tF2", IDM_VIEW_DWORD, CHECKED MENUITEM "Word\tF3", IDM_VIEW_WORD, CHECKED MENUITEM "Byte\tF4", IDM_VIEW_BYTE, CHECKED MENUITEM SEPARATOR - MENUITEM " ", IDM_VIEW_GROUP, CHECKED + MENUITEM "Ομαδοποίηση ψηφίων", IDM_VIEW_GROUP, CHECKED END - POPUP "" + POPUP "Βοήθεια" BEGIN - MENUITEM " ", IDM_HELP_HELP + MENUITEM "Θέματα Βοήθειας", IDM_HELP_HELP MENUITEM SEPARATOR - MENUITEM "...", IDM_HELP_ABOUT + MENUITEM "Σχετικά...", IDM_HELP_ABOUT END END IDR_MENU_STANDARD MENU DISCARDABLE BEGIN - POPUP "" + POPUP "Επεξεργασία" BEGIN - MENUITEM "\tCTRL-C", IDM_EDIT_COPY - MENUITEM "\tCTRL-V", IDM_EDIT_PASTE + MENUITEM "Αντιγραφή\tCTRL-C", IDM_EDIT_COPY + MENUITEM "Επικόλληση\tCTRL-V", IDM_EDIT_PASTE END POPUP "View" BEGIN - MENUITEM "", IDM_VIEW_STANDARD, CHECKED - MENUITEM "", IDM_VIEW_SCIENTIFIC, CHECKED - MENUITEM "", IDM_VIEW_CONVERSION + MENUITEM "Τυπική", IDM_VIEW_STANDARD, CHECKED + MENUITEM "Επιστημονική", IDM_VIEW_SCIENTIFIC, CHECKED + MENUITEM "Μετατροπή", IDM_VIEW_CONVERSION MENUITEM SEPARATOR - MENUITEM " ", IDM_VIEW_GROUP, CHECKED + MENUITEM "Ομαδοποίηση ψηφίων", IDM_VIEW_GROUP, CHECKED END POPUP "Help" BEGIN - MENUITEM " ", IDM_HELP_HELP + MENUITEM "Θέματα Βοήθειας", IDM_HELP_HELP MENUITEM SEPARATOR - MENUITEM "...", IDM_HELP_ABOUT + MENUITEM "Σχετικά...", IDM_HELP_ABOUT END END @@ -432,34 +432,34 @@ END STRINGTABLE DISCARDABLE BEGIN IDS_STRING_LICENSE "ReactOS Calc is free software released under GNU GPL license.\r\n\r\nYou can get a copy of GNU GPL license here:\r\nhttp://www.gnu.org/licenses/gpl.html\r\n\r\nYou can also get a translation of GNU GPL license here:\r\nhttp://www.gnu.org/licenses/translations.html" - IDS_MATH_ERROR "" + IDS_MATH_ERROR "Σφάλμα" IDS_QUICKHELP "Quick help" END // Types of conversion STRINGTABLE DISCARDABLE BEGIN - IDS_CONV_ANGLE "" - IDS_CONV_AREA "" + IDS_CONV_ANGLE "Γωνία" + IDS_CONV_AREA "Εμβαδό" IDS_CONV_CONSUMPTION "Consumption (engines)" - IDS_CONV_CURRENCY "" - IDS_CONV_ENERGY "" + IDS_CONV_CURRENCY "Συνάλλαγμα" + IDS_CONV_ENERGY "Ενέργεια" IDS_CONV_LENGTH "Lenghts" - IDS_CONV_POWER "" - IDS_CONV_PRESSURE "" - IDS_CONV_TEMPERATURE "" - IDS_CONV_TIME "" - IDS_CONV_VELOCITY "" - IDS_CONV_VOLUME "" + IDS_CONV_POWER "Δύναμη" + IDS_CONV_PRESSURE "Πίεση" + IDS_CONV_TEMPERATURE "Θερμοκρασία" + IDS_CONV_TIME "Ώρα" + IDS_CONV_VELOCITY "Ταχύτητα" + IDS_CONV_VOLUME "Ένταση" IDS_CONV_WEIGHT "Weights" END // TYPES OF ANGLES STRINGTABLE DISCARDABLE BEGIN - IDS_ANGLE_DEGREES "" - IDS_ANGLE_GRADIANS "" - IDS_ANGLE_RADIANS "" + IDS_ANGLE_DEGREES "Βαθμοί" + IDS_ANGLE_GRADIANS "Ακτίνια" + IDS_ANGLE_RADIANS "Μοίρες" END // TYPES OF AREAS @@ -514,29 +514,29 @@ END STRINGTABLE DISCARDABLE BEGIN IDS_CURRENCY_AUSTRIAN_SCHILLING "Austrian schilling" - IDS_CURRENCY_BELGIAN_FRANC " " - IDS_CURRENCY_CYPRIOT_POUND " " + IDS_CURRENCY_BELGIAN_FRANC "Βέλγικο φράγκο" + IDS_CURRENCY_CYPRIOT_POUND "Κυπριακή λίρα" IDS_CURRENCY_CZECH_KORUNA "Czech koruna" - IDS_CURRENCY_DEUTSCHE_MARK " " + IDS_CURRENCY_DEUTSCHE_MARK "Γερμανικό μάρκο" IDS_CURRENCY_DUTCH_GUILDER "Dutch guilder" - IDS_CURRENCY_EURO "" + IDS_CURRENCY_EURO "Ευρώ" IDS_CURRENCY_FINNISH_MARKKA "Finnish markka" - IDS_CURRENCY_FRENCH_FRANC " " - IDS_CURRENCY_GREEK_DRACHMA "" + IDS_CURRENCY_FRENCH_FRANC "Γαλλικό φράγκο" + IDS_CURRENCY_GREEK_DRACHMA "Δραχμή" IDS_CURRENCY_IRISH_POUND "Irish pound" - IDS_CURRENCY_ITALIAN_LIRA " " + IDS_CURRENCY_ITALIAN_LIRA "Ιταλική λίρα" IDS_CURRENCY_LUXEMBOURG_FRANC "Luxembourg franc" - IDS_CURRENCY_MALTESE_LIRA " " - IDS_CURRENCY_PORTOGUESE_ESCUDO " " + IDS_CURRENCY_MALTESE_LIRA "Μαλτέζικη λίρα" + IDS_CURRENCY_PORTOGUESE_ESCUDO "Πορτογαλικό εσκούδο" IDS_CURRENCY_SLOVAK_KORUNA "Slovak koruna" IDS_CURRENCY_SLOVENIAN_TOLAR "Slovenian tolar" - IDS_CURRENCY_SPANISH_PESETA " " + IDS_CURRENCY_SPANISH_PESETA "Ισπανική πεσέτα" END // TYPES OF ENERGIES STRINGTABLE DISCARDABLE BEGIN - IDS_ENERGY_15_C_CALORIES "15 C calories" + IDS_ENERGY_15_C_CALORIES "15 °C calories" IDS_ENERGY_BTUS "British Thermal Units" IDS_ENERGY_ERGS "Ergs" IDS_ENERGY_EVS "Electron-Volts" @@ -556,7 +556,7 @@ BEGIN IDS_LENGTH_ANGSTROMS "Angstroms" IDS_LENGTH_ASTRONOMICAL_UNITS "Astronomical units" IDS_LENGTH_BARLEYCORNS "Barleycorns" - IDS_LENGTH_CENTIMETERS "" + IDS_LENGTH_CENTIMETERS "Εκατοστά" IDS_LENGTH_CHAINS_UK "Chains (UK)" IDS_LENGTH_CHI "Chi" IDS_LENGTH_CHOU "Chou" @@ -564,24 +564,24 @@ BEGIN IDS_LENGTH_CUN "Cun" IDS_LENGTH_FATHOMS "Fathoms" IDS_LENGTH_FATHOMS_HUNGARY "Fathoms (Hungary)" - IDS_LENGTH_FEET "" + IDS_LENGTH_FEET "Πόδια" IDS_LENGTH_FURLONGS "Furlongs" IDS_LENGTH_GAN "Gan" IDS_LENGTH_HANDS "Hands" IDS_LENGTH_HUNH "Hunh" - IDS_LENGTH_INCHES "" + IDS_LENGTH_INCHES "Ίντσες" IDS_LENGTH_JA "Ja" IDS_LENGTH_JEONG "Jeong" IDS_LENGTH_KABIET "Kabiet" IDS_LENGTH_KEN "Ken" IDS_LENGTH_KEUB "Keub" - IDS_LENGTH_KILOMETERS "" + IDS_LENGTH_KILOMETERS "Χιλιόμετρα" IDS_LENGTH_LAR "Lar" IDS_LENGTH_LIGHT_YEARS "Light years" IDS_LENGTH_LINKS_UK "Links (UK)" - IDS_LENGTH_METERS "" + IDS_LENGTH_METERS "Μέτρα" IDS_LENGTH_MICRONS "Microns" - IDS_LENGTH_MILES "" + IDS_LENGTH_MILES "Μίλια" IDS_LENGTH_MILLIMETERS "Millimeters" IDS_LENGTH_NAUTICAL_MILES "Nautical miles" IDS_LENGTH_NIEU "Nieu" @@ -597,7 +597,7 @@ BEGIN IDS_LENGTH_SUN "Sun" IDS_LENGTH_TSUEN "Tsuen" IDS_LENGTH_VA "Va" - IDS_LENGTH_YARDS "" + IDS_LENGTH_YARDS "Γιάρδες" IDS_LENGTH_YOTE "Yote" IDS_LENGTH_ZHANG "Zhang" END @@ -616,7 +616,7 @@ END // TYPE OF PRESSURES STRINGTABLE DISCARDABLE BEGIN - IDS_PRESSURE_ATMOSPHERES "" + IDS_PRESSURE_ATMOSPHERES "Ατμόσφαιρες" IDS_PRESSURE_BARS "Bars" IDS_PRESSURE_HECTOPASCALS "Hectopascals" IDS_PRESSURE_KILOPASCALS "Kilopascals" @@ -628,37 +628,37 @@ END // TYPES OF TEMPERATURES STRINGTABLE DISCARDABLE BEGIN - IDS_TEMPERATURE_CELSIUS "" - IDS_TEMPERATURE_FAHRENHEIT "" - IDS_TEMPERATURE_KELVIN "" + IDS_TEMPERATURE_CELSIUS "Κελσίου" + IDS_TEMPERATURE_FAHRENHEIT "Φαρενάιτ" + IDS_TEMPERATURE_KELVIN "Κέλβιν" IDS_TEMPERATURE_RANKINE "Rankine" END // TYPES OF TIME STRINGTABLE DISCARDABLE BEGIN - IDS_TIME_DAYS "" - IDS_TIME_HOURS "" + IDS_TIME_DAYS "Μέρες" + IDS_TIME_HOURS "Ώρες" IDS_TIME_NANOSECONDS "Nanoseconds" - IDS_TIME_MICROSECONDS "" - IDS_TIME_MILLISECONDS "" - IDS_TIME_MINUTES "" - IDS_TIME_SECONDS "" - IDS_TIME_WEEKS "" - IDS_TIME_YEARS "" + IDS_TIME_MICROSECONDS "Μικροδευτερόλεπτα" + IDS_TIME_MILLISECONDS "Μιλιδευτερόλεπτα" + IDS_TIME_MINUTES "Λεπτά" + IDS_TIME_SECONDS "Δευτερόλεπτα" + IDS_TIME_WEEKS "Εβδομάδες" + IDS_TIME_YEARS "Χρόνια" END // TYPES OF VELOCITIES STRINGTABLE DISCARDABLE BEGIN - IDS_VELOCITY_CMS_SECOND "/" - IDS_VELOCITY_FEET_HOUR "/" - IDS_VELOCITY_FEET_SECOND "/" - IDS_VELOCITY_KILOMETERS_HOUR "/" + IDS_VELOCITY_CMS_SECOND "Εκατοστά/ώρα" + IDS_VELOCITY_FEET_HOUR "Πόδια/ώρα" + IDS_VELOCITY_FEET_SECOND "Πόδια/δευτερόλεπτο" + IDS_VELOCITY_KILOMETERS_HOUR "Χιλιόμετρα/ώρα" IDS_VELOCITY_KNOTS "Knots" IDS_VELOCITY_MACH "Mach" - IDS_VELOCITY_METERS_SECOND "/" - IDS_VELOCITY_MILES_HOUR "/" + IDS_VELOCITY_METERS_SECOND "Μέτρα/δευτερόλεπτο" + IDS_VELOCITY_MILES_HOUR "Μίλια/ώρα" END // TYPES OF VOLUMES diff --git a/base/applications/calc/lang/es-ES.rc b/base/applications/calc/lang/es-ES.rc index 88e89a384fe..4d4f8d609b9 100644 --- a/base/applications/calc/lang/es-ES.rc +++ b/base/applications/calc/lang/es-ES.rc @@ -148,7 +148,7 @@ BEGIN WS_VISIBLE,272,24,30,10 CONTROL "Sexagesimal",IDC_RADIO_DEG,"Button",BS_AUTORADIOBUTTON,148,24, 54,10 - CONTROL "Radin",IDC_RADIO_RAD,"Button",BS_AUTORADIOBUTTON,212, + CONTROL "Radián",IDC_RADIO_RAD,"Button",BS_AUTORADIOBUTTON,212, 24,42,10 CONTROL "Centesimal",IDC_RADIO_GRAD,"Button",BS_AUTORADIOBUTTON, 256,24,50,10 @@ -239,7 +239,7 @@ BEGIN PUSHBUTTON "Convertir",IDC_BUTTON_CONVERT,35,105,76,17 COMBOBOX IDC_COMBO_CATEGORY,4,31,140,168,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP | CBS_SORT - LTEXT "Categora:",IDC_STATIC,4,20,56,8 + LTEXT "Categoría:",IDC_STATIC,4,20,56,8 COMBOBOX IDC_COMBO_FROM,4,60,140,168,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP | CBS_SORT LTEXT "Convertir de:",IDC_STATIC,4,49,56,8 @@ -318,7 +318,7 @@ BEGIN SS_REALSIZEIMAGE | WS_BORDER,4,4,104,48 LTEXT "Calculadora ReactOS",IDC_STATIC,120,12,132,8, SS_CENTERIMAGE - LTEXT "Versin ",IDC_TEXT_VERSION,120,20,132,8,SS_CENTERIMAGE + LTEXT "Versión ",IDC_TEXT_VERSION,120,20,132,8,SS_CENTERIMAGE LTEXT "Escrita por Carlo Bramini",IDC_STATIC,120,32,132,8, SS_CENTERIMAGE GROUPBOX "",IDC_STATIC,112,0,148,52 @@ -329,7 +329,7 @@ END IDD_DIALOG_STAT DIALOGEX DISCARDABLE 0, 0, 163, 85 STYLE DS_SHELLFONT | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "Cuadro de estadsticas" +CAPTION "Cuadro de estadísticas" FONT 8, "MS Shell Dlg" BEGIN LISTBOX IDC_LIST_STAT,4,4,156,40,LBS_NOINTEGRALHEIGHT | @@ -346,16 +346,16 @@ END IDR_MENU_SCIENTIFIC_1 MENU DISCARDABLE BEGIN - POPUP "Edicin" + POPUP "Edición" BEGIN MENUITEM "Copiar\tCTRL-C", IDM_EDIT_COPY MENUITEM "Pegar\tCTRL-V", IDM_EDIT_PASTE END POPUP "Ver" BEGIN - MENUITEM "Estndar", IDM_VIEW_STANDARD, CHECKED - MENUITEM "Cientfica", IDM_VIEW_SCIENTIFIC, CHECKED - MENUITEM "Conversin", IDM_VIEW_CONVERSION + MENUITEM "Estándar", IDM_VIEW_STANDARD, CHECKED + MENUITEM "Científica", IDM_VIEW_SCIENTIFIC, CHECKED + MENUITEM "Conversión", IDM_VIEW_CONVERSION MENUITEM SEPARATOR MENUITEM "Hexadecimal\tF5", IDM_VIEW_HEX, CHECKED MENUITEM "Decimal\tF6", IDM_VIEW_DEC, CHECKED @@ -363,10 +363,10 @@ BEGIN MENUITEM "Binario\tF8", IDM_VIEW_BIN, CHECKED MENUITEM SEPARATOR MENUITEM "Sexagesimal\tF2", IDM_VIEW_DEG, CHECKED - MENUITEM "Radin\tF3", IDM_VIEW_RAD, CHECKED + MENUITEM "Radián\tF3", IDM_VIEW_RAD, CHECKED MENUITEM "Centesimal\tF4", IDM_VIEW_GRAD, CHECKED MENUITEM SEPARATOR - MENUITEM "Nmero de dgitos en grupo", IDM_VIEW_GROUP, CHECKED + MENUITEM "Número de dígitos en grupo", IDM_VIEW_GROUP, CHECKED END POPUP "Ayuda" BEGIN @@ -378,16 +378,16 @@ END IDR_MENU_SCIENTIFIC_2 MENU DISCARDABLE BEGIN - POPUP "Edicin" + POPUP "Edición" BEGIN MENUITEM "Copiar\tCTRL-C", IDM_EDIT_COPY MENUITEM "Pegar\tCTRL-V", IDM_EDIT_PASTE END POPUP "Ver" BEGIN - MENUITEM "Estndar", IDM_VIEW_STANDARD, CHECKED - MENUITEM "Cientfica", IDM_VIEW_SCIENTIFIC, CHECKED - MENUITEM "Conversin", IDM_VIEW_CONVERSION + MENUITEM "Estándar", IDM_VIEW_STANDARD, CHECKED + MENUITEM "Científica", IDM_VIEW_SCIENTIFIC, CHECKED + MENUITEM "Conversión", IDM_VIEW_CONVERSION MENUITEM SEPARATOR MENUITEM "Hexadecimal\tF5", IDM_VIEW_HEX, CHECKED MENUITEM "Decimal\tF6", IDM_VIEW_DEC, CHECKED @@ -399,7 +399,7 @@ BEGIN MENUITEM "Word\tF3", IDM_VIEW_WORD, CHECKED MENUITEM "Byte\tF4", IDM_VIEW_BYTE, CHECKED MENUITEM SEPARATOR - MENUITEM "Nmero de dgitos en grupo", IDM_VIEW_GROUP, CHECKED + MENUITEM "Número de dígitos en grupo", IDM_VIEW_GROUP, CHECKED END POPUP "Ayuda" BEGIN @@ -411,18 +411,18 @@ END IDR_MENU_STANDARD MENU DISCARDABLE BEGIN - POPUP "Edicin" + POPUP "Edición" BEGIN MENUITEM "Copiar\tCTRL-C", IDM_EDIT_COPY MENUITEM "Pegar\tCTRL-V", IDM_EDIT_PASTE END POPUP "Ver" BEGIN - MENUITEM "Estndar", IDM_VIEW_STANDARD, CHECKED - MENUITEM "Cientfica", IDM_VIEW_SCIENTIFIC, CHECKED - MENUITEM "Conversin", IDM_VIEW_CONVERSION + MENUITEM "Estándar", IDM_VIEW_STANDARD, CHECKED + MENUITEM "Científica", IDM_VIEW_SCIENTIFIC, CHECKED + MENUITEM "Conversión", IDM_VIEW_CONVERSION MENUITEM SEPARATOR - MENUITEM "Nmero de dgitos en grupo", IDM_VIEW_GROUP, CHECKED + MENUITEM "Número de dígitos en grupo", IDM_VIEW_GROUP, CHECKED END POPUP "Ayuda" BEGIN @@ -436,22 +436,22 @@ END STRINGTABLE DISCARDABLE BEGIN - IDS_STRING_LICENSE "Calculadora ReactOS es software gratuito realizado bajo licencia GNU GPL.\r\n\r\nPuedes coger una copia de la licencia GNU GPL aqu:\r\nhttp://www.gnu.org/licenses/gpl.html\r\n\r\nPuedes tambin coger una traduccin de la licencia GNU GPL aqu:\r\nhttp://www.gnu.org/licenses/translations.html" + IDS_STRING_LICENSE "Calculadora ReactOS es software gratuito realizado bajo licencia GNU GPL.\r\n\r\nPuedes coger una copia de la licencia GNU GPL aquí:\r\nhttp://www.gnu.org/licenses/gpl.html\r\n\r\nPuedes también coger una traducción de la licencia GNU GPL aquí:\r\nhttp://www.gnu.org/licenses/translations.html" IDS_MATH_ERROR "Error" - IDS_QUICKHELP "Ayuda rpida" + IDS_QUICKHELP "Ayuda rápida" END // Types of conversion STRINGTABLE DISCARDABLE BEGIN - IDS_CONV_ANGLE "ngulo" - IDS_CONV_AREA "rea" + IDS_CONV_ANGLE "Ángulo" + IDS_CONV_AREA "Área" IDS_CONV_CONSUMPTION "Consumo (motores)" IDS_CONV_CURRENCY "Monedas" - IDS_CONV_ENERGY "Energa" + IDS_CONV_ENERGY "Energía" IDS_CONV_LENGTH "Longitud" IDS_CONV_POWER "Potencia" - IDS_CONV_PRESSURE "Presin" + IDS_CONV_PRESSURE "Presión" IDS_CONV_TEMPERATURE "Temperatura" IDS_CONV_TIME "Tiempo" IDS_CONV_VELOCITY "Velocidad" @@ -475,29 +475,29 @@ BEGIN IDS_AREA_ACRES_FRANCE "Acres (Francia)" IDS_AREA_ACRES_SCOTS "Acres (Escocia)" IDS_AREA_ACRES_US "Acres (US)" - IDS_AREA_ARES "rea" + IDS_AREA_ARES "Área" IDS_AREA_CHOU "Chou" IDS_AREA_DANBO "Danbo" - IDS_AREA_HECTARES "Hectrias" + IDS_AREA_HECTARES "Hectárias" IDS_AREA_JEONGBO "Jeongbo" - IDS_AREA_MORGEN_HUNGARY "Morgen (Hungra)" + IDS_AREA_MORGEN_HUNGARY "Morgen (Hungría)" IDS_AREA_MU "Mu" IDS_AREA_PING "Ping" IDS_AREA_PYEONG "Pyeong" IDS_AREA_PYEONGBANGJA "Pyeongbangja" IDS_AREA_RAI "Rai" IDS_AREA_SE "Se" - IDS_AREA_SQUARE_CENTIMETERS "Centmetros cuadrados" + IDS_AREA_SQUARE_CENTIMETERS "Centímetros cuadrados" IDS_AREA_SQUARE_CHR "Square chr" IDS_AREA_SQUARE_FATHOMS "Braza cuadrada" - IDS_AREA_SQUARE_FATHOMS_HUNGARY "Braza cuadrada (Hungra)" + IDS_AREA_SQUARE_FATHOMS_HUNGARY "Braza cuadrada (Hungría)" IDS_AREA_SQUARE_FEET "Pies cuadrados" IDS_AREA_SQUARE_INCHES "Pulgadas cuadradas" - IDS_AREA_SQUARE_KILOMETERS "Kilmetros cuadrados" + IDS_AREA_SQUARE_KILOMETERS "Kilómetros cuadrados" IDS_AREA_SQUARE_LAR "Square lar" IDS_AREA_SQUARE_METER "Metros cuadrado" IDS_AREA_SQUARE_MILES "Millas cuadradas" - IDS_AREA_SQUARE_MILLIMETERS "Milmetros cuadrados" + IDS_AREA_SQUARE_MILLIMETERS "Milímetros cuadrados" IDS_AREA_SQUARE_SHAKU "Square shaku" IDS_AREA_SQUARE_TSUEN "Square tsuen" IDS_AREA_SQUARE_VA "Square va" @@ -511,8 +511,8 @@ STRINGTABLE DISCARDABLE BEGIN IDS_CONSUMPTION_KM_PER_L "Kilometros/litro" IDS_CONSUMPTION_L_PER_100_KM "Litros/100 kilometros" - IDS_CONSUMPTION_MILES_GALLON_UK "Millas/galn (UK)" - IDS_CONSUMPTION_MILES_GALLON_US "Millas/galn (US)" + IDS_CONSUMPTION_MILES_GALLON_UK "Millas/galón (UK)" + IDS_CONSUMPTION_MILES_GALLON_US "Millas/galón (US)" END // TYPES OF CURRENCIES @@ -522,46 +522,46 @@ BEGIN IDS_CURRENCY_BELGIAN_FRANC "Franco Belga" IDS_CURRENCY_CYPRIOT_POUND "Libra Chipriota" IDS_CURRENCY_CZECH_KORUNA "Corona Checa" - IDS_CURRENCY_DEUTSCHE_MARK "Marco Alemn" - IDS_CURRENCY_DUTCH_GUILDER "Florn Neerlands" + IDS_CURRENCY_DEUTSCHE_MARK "Marco Alemán" + IDS_CURRENCY_DUTCH_GUILDER "Florín Neerlandés" IDS_CURRENCY_EURO "Euro" - IDS_CURRENCY_FINNISH_MARKKA "Marco Finlands" + IDS_CURRENCY_FINNISH_MARKKA "Marco Finlandés" IDS_CURRENCY_FRENCH_FRANC "Franco Frances" IDS_CURRENCY_GREEK_DRACHMA "Drachma Griego" IDS_CURRENCY_IRISH_POUND "Libra Irlandesa" IDS_CURRENCY_ITALIAN_LIRA "Lira Italiana" - IDS_CURRENCY_LUXEMBOURG_FRANC "Franco Luxemburgus" + IDS_CURRENCY_LUXEMBOURG_FRANC "Franco Luxemburgués" IDS_CURRENCY_MALTESE_LIRA "Lira Maltesa" - IDS_CURRENCY_PORTOGUESE_ESCUDO "Escudo Portugus" + IDS_CURRENCY_PORTOGUESE_ESCUDO "Escudo Portugués" IDS_CURRENCY_SLOVAK_KORUNA "Corona Eslovaca" IDS_CURRENCY_SLOVENIAN_TOLAR "Tolar Esloveno" - IDS_CURRENCY_SPANISH_PESETA "Peseta Espaola" + IDS_CURRENCY_SPANISH_PESETA "Peseta Española" END // TYPES OF ENERGIES STRINGTABLE DISCARDABLE BEGIN - IDS_ENERGY_15_C_CALORIES "15 C caloras" + IDS_ENERGY_15_C_CALORIES "15 °C calorías" IDS_ENERGY_BTUS "BTU" IDS_ENERGY_ERGS "Ergios" IDS_ENERGY_EVS "Electronovoltios" - IDS_ENERGY_FOOT_POUNDS "FtLbs" - IDS_ENERGY_IT_CALORIES "Tabla internacional de caloras" - IDS_ENERGY_IT_KILOCALORIES "Tabla internacional de kilocaloras" + IDS_ENERGY_FOOT_POUNDS "Ft·Lbs" + IDS_ENERGY_IT_CALORIES "Tabla internacional de calorías" + IDS_ENERGY_IT_KILOCALORIES "Tabla internacional de kilocalorías" IDS_ENERGY_JOULES "Julios" IDS_ENERGY_KILOJOULES "Kilojulios" IDS_ENERGY_KILOWATT_HOURS "Kilowatios hora" - IDS_ENERGY_NUTRITION_CALORIES "Caloras nutricionales" - IDS_ENERGY_TH_CALORIES "Caloras termoqumicas" + IDS_ENERGY_NUTRITION_CALORIES "Calorías nutricionales" + IDS_ENERGY_TH_CALORIES "Calorías termoquímicas" END // TYPES OF LENGTHS STRINGTABLE DISCARDABLE BEGIN - IDS_LENGTH_ANGSTROMS "ngstrms" + IDS_LENGTH_ANGSTROMS "Ångströms" IDS_LENGTH_ASTRONOMICAL_UNITS "Astronomical units" IDS_LENGTH_BARLEYCORNS "Barleycorns" - IDS_LENGTH_CENTIMETERS "Centmetros" + IDS_LENGTH_CENTIMETERS "Centímetros" IDS_LENGTH_CHAINS_UK "Cadenas (UK)" IDS_LENGTH_CHI "Chi" IDS_LENGTH_CHOU "Chou" @@ -582,12 +582,12 @@ BEGIN IDS_LENGTH_KEUB "Keub" IDS_LENGTH_KILOMETERS "Kilometros" IDS_LENGTH_LAR "Lar" - IDS_LENGTH_LIGHT_YEARS "Aos luz" + IDS_LENGTH_LIGHT_YEARS "Años luz" IDS_LENGTH_LINKS_UK "Links (UK)" IDS_LENGTH_METERS "Metros" - IDS_LENGTH_MICRONS "Micrmetros" + IDS_LENGTH_MICRONS "Micrómetros" IDS_LENGTH_MILES "Millas" - IDS_LENGTH_MILLIMETERS "Milmetros" + IDS_LENGTH_MILLIMETERS "Milímetros" IDS_LENGTH_NAUTICAL_MILES "Millas nauticas" IDS_LENGTH_NIEU "Nieu" IDS_LENGTH_PARSECS "Parsecs" @@ -611,7 +611,7 @@ END STRINGTABLE DISCARDABLE BEGIN IDS_POWER_BTUS_PER_MINUTE "BTU/Minuto" - IDS_POWER_FPS_PER_MINUTE "FtLbs/Minuto" + IDS_POWER_FPS_PER_MINUTE "Ft·Lbs/Minuto" IDS_POWER_HORSEPOWER "Caballos de vapor" IDS_POWER_KILOWATTS "Kilowatios" IDS_POWER_MEGAWATTS "Megawatios" @@ -621,11 +621,11 @@ END // TYPE OF PRESSURES STRINGTABLE DISCARDABLE BEGIN - IDS_PRESSURE_ATMOSPHERES "Atmsferas" + IDS_PRESSURE_ATMOSPHERES "Atmósferas" IDS_PRESSURE_BARS "Bares" IDS_PRESSURE_HECTOPASCALS "Kilopascales" IDS_PRESSURE_KILOPASCALS "Hectopascales" - IDS_PRESSURE_MM_OF_MERCURY "Milmetros de mercurio" + IDS_PRESSURE_MM_OF_MERCURY "Milímetros de mercurio" IDS_PRESSURE_PASCALS "Pascales" IDS_PRESSURE_PSI "Libras fuerza por pulgada cuadrada" END @@ -642,7 +642,7 @@ END // TYPES OF TIME STRINGTABLE DISCARDABLE BEGIN - IDS_TIME_DAYS "Das" + IDS_TIME_DAYS "Días" IDS_TIME_HOURS "Horas" IDS_TIME_NANOSECONDS "Nanoseconds" IDS_TIME_MICROSECONDS "Microsegundos" @@ -650,13 +650,13 @@ BEGIN IDS_TIME_MINUTES "Minutos" IDS_TIME_SECONDS "Segundos" IDS_TIME_WEEKS "Semanas" - IDS_TIME_YEARS "Aos" + IDS_TIME_YEARS "Años" END // TYPES OF VELOCITIES STRINGTABLE DISCARDABLE BEGIN - IDS_VELOCITY_CMS_SECOND "Centmetros/segundo" + IDS_VELOCITY_CMS_SECOND "Centímetros/segundo" IDS_VELOCITY_FEET_HOUR "Pies/hora" IDS_VELOCITY_FEET_SECOND "Pies/segundo" IDS_VELOCITY_KILOMETERS_HOUR "Kilometros/hora" @@ -672,16 +672,16 @@ BEGIN IDS_VOLUME_BARRELS_UK "Barriles (UK)" IDS_VOLUME_BARRELS_OIL "Barriles de petroleo" IDS_VOLUME_BUN "Bun" - IDS_VOLUME_BUSHELS_UK "Celemn (UK)" - IDS_VOLUME_BUSHELS_US "Celemn (US)" - IDS_VOLUME_CUBIC_CENTIMETERS "Centmetros cbicos" - IDS_VOLUME_CUBIC_FEET "Pes cbicos" - IDS_VOLUME_CUBIC_INCHES "Pulgadas cbicas" - IDS_VOLUME_CUBIC_METERS "Metros cbicos" - IDS_VOLUME_CUBIC_YARDS "Yardas cbicas" + IDS_VOLUME_BUSHELS_UK "Celemín (UK)" + IDS_VOLUME_BUSHELS_US "Celemín (US)" + IDS_VOLUME_CUBIC_CENTIMETERS "Centímetros cúbicos" + IDS_VOLUME_CUBIC_FEET "Píes cúbicos" + IDS_VOLUME_CUBIC_INCHES "Pulgadas cúbicas" + IDS_VOLUME_CUBIC_METERS "Metros cúbicos" + IDS_VOLUME_CUBIC_YARDS "Yardas cúbicas" IDS_VOLUME_DOE "Doe" - IDS_VOLUME_FLUID_OUNCES_UK "Onza lquida (UK)" - IDS_VOLUME_FLUID_OUNCES_US "Onza lquida (US)" + IDS_VOLUME_FLUID_OUNCES_UK "Onza líquida (UK)" + IDS_VOLUME_FLUID_OUNCES_US "Onza líquida (US)" IDS_VOLUME_GALLONS_UK "Galones (UK)" IDS_VOLUME_GALLONS_DRY_US "Galones, dry (US)" IDS_VOLUME_GALLONS_LIQUID_US "Galones, liquid (US)" diff --git a/base/applications/calc/lang/fr-FR.rc b/base/applications/calc/lang/fr-FR.rc index 8536cdb8d9d..43dd5086cb9 100644 --- a/base/applications/calc/lang/fr-FR.rc +++ b/base/applications/calc/lang/fr-FR.rc @@ -141,7 +141,7 @@ BEGIN WS_VISIBLE,232,24,33,10 CONTROL "Octet",IDC_RADIO_BYTE,"Button",BS_AUTORADIOBUTTON | NOT WS_VISIBLE,272,24,30,10 - CONTROL "Degrs",IDC_RADIO_DEG,"Button",BS_AUTORADIOBUTTON,148,24, + CONTROL "Degrés",IDC_RADIO_DEG,"Button",BS_AUTORADIOBUTTON,148,24, 42,10 CONTROL "Radians",IDC_RADIO_RAD,"Button",BS_AUTORADIOBUTTON,192, 24,42,10 @@ -151,7 +151,7 @@ BEGIN BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP PUSHBUTTON "CE",IDC_BUTTON_CE,228,40,40,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP - PUSHBUTTON "Retour arrire",IDC_BUTTON_BACK,184,40,40,17,BS_CENTER | + PUSHBUTTON "Retour arrière",IDC_BUTTON_BACK,184,40,40,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP RTEXT "",IDC_TEXT_OUTPUT,4,4,308,12,SS_CENTERIMAGE, WS_EX_CLIENTEDGE @@ -168,7 +168,7 @@ BEGIN BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP PUSHBUTTON "CE",IDC_BUTTON_CE,84,24,40,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP - PUSHBUTTON "Retour arrire",IDC_BUTTON_BACK,40,24,40,17,BS_CENTER | + PUSHBUTTON "Retour arrière",IDC_BUTTON_BACK,40,24,40,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP RTEXT "",IDC_TEXT_OUTPUT,4,4,164,12,SS_CENTERIMAGE, WS_EX_CLIENTEDGE @@ -234,7 +234,7 @@ BEGIN PUSHBUTTON "Convertir",IDC_BUTTON_CONVERT,35,105,76,17 COMBOBOX IDC_COMBO_CATEGORY,4,31,140,168,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP | CBS_SORT - LTEXT "Catgorie :",IDC_STATIC,4,20,56,8 + LTEXT "Catégorie :",IDC_STATIC,4,20,56,8 COMBOBOX IDC_COMBO_FROM,4,60,140,168,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP | CBS_SORT LTEXT "Convertir depuis :",IDC_STATIC,4,49,56,8 @@ -245,7 +245,7 @@ BEGIN BS_VCENTER | BS_NOTIFY | WS_TABSTOP,276,24,40,17 CONTROL "CE",IDC_BUTTON_CE,"Button",BS_OWNERDRAW | BS_CENTER | BS_VCENTER | BS_NOTIFY | WS_TABSTOP,232,24,40,17 - CONTROL "Retour arrire",IDC_BUTTON_BACK,"Button",BS_OWNERDRAW | + CONTROL "Retour arrière",IDC_BUTTON_BACK,"Button",BS_OWNERDRAW | BS_CENTER | BS_VCENTER | BS_NOTIFY | WS_TABSTOP,188,24, 40,17 RTEXT "",IDC_TEXT_OUTPUT,4,4,312,12,SS_CENTERIMAGE, @@ -305,7 +305,7 @@ END IDD_DIALOG_ABOUT DIALOGEX DISCARDABLE 0, 0, 264, 169 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " propos de la Calculatrice ReactOS" +CAPTION "À propos de la Calculatrice ReactOS" FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "OK",IDOK,105,148,52,16 @@ -341,7 +341,7 @@ END IDR_MENU_SCIENTIFIC_1 MENU DISCARDABLE BEGIN - POPUP "dition" + POPUP "Édition" BEGIN MENUITEM "Copier\tCTRL-C", IDM_EDIT_COPY MENUITEM "Coller\tCTRL-V", IDM_EDIT_PASTE @@ -352,12 +352,12 @@ BEGIN MENUITEM "Scientifique", IDM_VIEW_SCIENTIFIC, CHECKED MENUITEM "Conversion", IDM_VIEW_CONVERSION MENUITEM SEPARATOR - MENUITEM "Hexadcimal\tF5", IDM_VIEW_HEX, CHECKED - MENUITEM "Dcimal\tF6", IDM_VIEW_DEC, CHECKED + MENUITEM "Hexadécimal\tF5", IDM_VIEW_HEX, CHECKED + MENUITEM "Décimal\tF6", IDM_VIEW_DEC, CHECKED MENUITEM "Octal\tF7", IDM_VIEW_OCT, CHECKED MENUITEM "Binaire\tF8", IDM_VIEW_BIN, CHECKED MENUITEM SEPARATOR - MENUITEM "Degrs\tF2", IDM_VIEW_DEG, CHECKED + MENUITEM "Degrés\tF2", IDM_VIEW_DEG, CHECKED MENUITEM "Radians\tF3", IDM_VIEW_RAD, CHECKED MENUITEM "Grades\tF4", IDM_VIEW_GRAD, CHECKED MENUITEM SEPARATOR @@ -367,13 +367,13 @@ BEGIN BEGIN MENUITEM "Rubriques d'aide", IDM_HELP_HELP MENUITEM SEPARATOR - MENUITEM " propos de la Calculatrice ReactOS", IDM_HELP_ABOUT + MENUITEM "À propos de la Calculatrice ReactOS", IDM_HELP_ABOUT END END IDR_MENU_SCIENTIFIC_2 MENU DISCARDABLE BEGIN - POPUP "dition" + POPUP "Édition" BEGIN MENUITEM "Copier\tCTRL-C", IDM_EDIT_COPY MENUITEM "Coller\tCTRL-V", IDM_EDIT_PASTE @@ -384,8 +384,8 @@ BEGIN MENUITEM "Scientifique", IDM_VIEW_SCIENTIFIC, CHECKED MENUITEM "Conversion", IDM_VIEW_CONVERSION MENUITEM SEPARATOR - MENUITEM "Hexadcimal\tF5", IDM_VIEW_HEX, CHECKED - MENUITEM "Dcimal\tF6", IDM_VIEW_DEC, CHECKED + MENUITEM "Hexadécimal\tF5", IDM_VIEW_HEX, CHECKED + MENUITEM "Décimal\tF6", IDM_VIEW_DEC, CHECKED MENUITEM "Octal\tF7", IDM_VIEW_OCT, CHECKED MENUITEM "Binaire\tF8", IDM_VIEW_BIN, CHECKED MENUITEM SEPARATOR @@ -400,13 +400,13 @@ BEGIN BEGIN MENUITEM "Rubriques d'aide", IDM_HELP_HELP MENUITEM SEPARATOR - MENUITEM " propos de la Calculatrice ReactOS", IDM_HELP_ABOUT + MENUITEM "À propos de la Calculatrice ReactOS", IDM_HELP_ABOUT END END IDR_MENU_STANDARD MENU DISCARDABLE BEGIN - POPUP "dition" + POPUP "Édition" BEGIN MENUITEM "Copier\tCTRL-C", IDM_EDIT_COPY MENUITEM "Coller\tCTRL-V", IDM_EDIT_PASTE @@ -423,7 +423,7 @@ BEGIN BEGIN MENUITEM "Rubriques d'aide", IDM_HELP_HELP MENUITEM SEPARATOR - MENUITEM " propos de la Calculatrice ReactOS", IDM_HELP_ABOUT + MENUITEM "À propos de la Calculatrice ReactOS", IDM_HELP_ABOUT END END @@ -431,7 +431,7 @@ END STRINGTABLE DISCARDABLE BEGIN - IDS_STRING_LICENSE "Calculatrice ReactOS est un logiciel libre distribu sous licence GNU GPL.\r\n\r\nVous pouvez obtenir une copie de la licence GNU GPL ici:\r\nhttp://www.gnu.org/licenses/gpl.html\r\n\r\nVous pouvez aussi obtenir une traduction de la licence GNU GPL ici:\r\nhttp://www.gnu.org/licenses/translations.html" + IDS_STRING_LICENSE "Calculatrice ReactOS est un logiciel libre distribué sous licence GNU GPL.\r\n\r\nVous pouvez obtenir une copie de la licence GNU GPL ici:\r\nhttp://www.gnu.org/licenses/gpl.html\r\n\r\nVous pouvez aussi obtenir une traduction de la licence GNU GPL ici:\r\nhttp://www.gnu.org/licenses/translations.html" IDS_MATH_ERROR "Erreur" IDS_QUICKHELP "Aide rapide" END @@ -443,13 +443,13 @@ BEGIN IDS_CONV_AREA "Superficie" IDS_CONV_CONSUMPTION "Consommation (moteurs)" IDS_CONV_CURRENCY "Devises" - IDS_CONV_ENERGY "nergie" + IDS_CONV_ENERGY "Énergie" IDS_CONV_LENGTH "Longueurs" IDS_CONV_POWER "Puissance" IDS_CONV_PRESSURE "Pression" - IDS_CONV_TEMPERATURE "Temprature" + IDS_CONV_TEMPERATURE "Température" IDS_CONV_TIME "Temps" - IDS_CONV_VELOCITY "Vlocit" + IDS_CONV_VELOCITY "Vélocité" IDS_CONV_VOLUME "Volume" IDS_CONV_WEIGHT "Poids" END @@ -457,7 +457,7 @@ END // TYPES OF ANGLES STRINGTABLE DISCARDABLE BEGIN - IDS_ANGLE_DEGREES "Degrs" + IDS_ANGLE_DEGREES "Degrés" IDS_ANGLE_GRADIANS "Grades" IDS_ANGLE_RADIANS "Radians" END @@ -482,21 +482,21 @@ BEGIN IDS_AREA_PYEONGBANGJA "Pyeongbangja" IDS_AREA_RAI "Rai" IDS_AREA_SE "Se" - IDS_AREA_SQUARE_CENTIMETERS "Centimtres carrs" - IDS_AREA_SQUARE_CHR "Chr carr" - IDS_AREA_SQUARE_FATHOMS "Fathoms carrs" - IDS_AREA_SQUARE_FATHOMS_HUNGARY "Fathoms carrs (Hongrie)" - IDS_AREA_SQUARE_FEET "Pieds carrs" - IDS_AREA_SQUARE_INCHES "Pouces carrs" - IDS_AREA_SQUARE_KILOMETERS "Kilomtres carrs" + IDS_AREA_SQUARE_CENTIMETERS "Centimètres carrés" + IDS_AREA_SQUARE_CHR "Chr carré" + IDS_AREA_SQUARE_FATHOMS "Fathoms carrés" + IDS_AREA_SQUARE_FATHOMS_HUNGARY "Fathoms carrés (Hongrie)" + IDS_AREA_SQUARE_FEET "Pieds carrés" + IDS_AREA_SQUARE_INCHES "Pouces carrés" + IDS_AREA_SQUARE_KILOMETERS "Kilomètres carrés" IDS_AREA_SQUARE_LAR "Square lar" - IDS_AREA_SQUARE_METER "Mtre carr" - IDS_AREA_SQUARE_MILES "Miles carrs" - IDS_AREA_SQUARE_MILLIMETERS "Millimtres carrs" - IDS_AREA_SQUARE_SHAKU "Shaku carr" - IDS_AREA_SQUARE_TSUEN "Tsuen carr" - IDS_AREA_SQUARE_VA "Va carr" - IDS_AREA_SQUARE_YARD "Yard carr" + IDS_AREA_SQUARE_METER "Mètre carré" + IDS_AREA_SQUARE_MILES "Miles carrés" + IDS_AREA_SQUARE_MILLIMETERS "Millimètres carrés" + IDS_AREA_SQUARE_SHAKU "Shaku carré" + IDS_AREA_SQUARE_TSUEN "Tsuen carré" + IDS_AREA_SQUARE_VA "Va carré" + IDS_AREA_SQUARE_YARD "Yard carré" IDS_AREA_TAN "Tan" IDS_AREA_TSUBO "Tsubo" END @@ -504,8 +504,8 @@ END // TYPES OF COMSUMPTIONS STRINGTABLE DISCARDABLE BEGIN - IDS_CONSUMPTION_KM_PER_L "Kilomtre/litre" - IDS_CONSUMPTION_L_PER_100_KM "Litres/100 kilomtres" + IDS_CONSUMPTION_KM_PER_L "Kilomètre/litre" + IDS_CONSUMPTION_L_PER_100_KM "Litres/100 kilomètres" IDS_CONSUMPTION_MILES_GALLON_UK "Miles/gallon (UK)" IDS_CONSUMPTION_MILES_GALLON_US "Miles/gallon (US)" END @@ -516,12 +516,12 @@ BEGIN IDS_CURRENCY_AUSTRIAN_SCHILLING "Schilling autrichien" IDS_CURRENCY_BELGIAN_FRANC "Franc belge" IDS_CURRENCY_CYPRIOT_POUND "Livre chypriote" - IDS_CURRENCY_CZECH_KORUNA "Couronne tchque" + IDS_CURRENCY_CZECH_KORUNA "Couronne tchèque" IDS_CURRENCY_DEUTSCHE_MARK "Mark allemand" IDS_CURRENCY_DUTCH_GUILDER "Dutch guilder" IDS_CURRENCY_EURO "Euro" IDS_CURRENCY_FINNISH_MARKKA "Marks finlandais" - IDS_CURRENCY_FRENCH_FRANC "Franc franais" + IDS_CURRENCY_FRENCH_FRANC "Franc français" IDS_CURRENCY_GREEK_DRACHMA "Drachmes grecques" IDS_CURRENCY_IRISH_POUND "Livre irlandaise" IDS_CURRENCY_ITALIAN_LIRA "Lire italienne" @@ -529,17 +529,17 @@ BEGIN IDS_CURRENCY_MALTESE_LIRA "Lire maltaise" IDS_CURRENCY_PORTOGUESE_ESCUDO "Escudo portugaise" IDS_CURRENCY_SLOVAK_KORUNA "Couronne slovaque" - IDS_CURRENCY_SLOVENIAN_TOLAR "Tolar slovne" + IDS_CURRENCY_SLOVENIAN_TOLAR "Tolar slovène" IDS_CURRENCY_SPANISH_PESETA "Peseta espagnole" END // TYPES OF ENERGIES STRINGTABLE DISCARDABLE BEGIN - IDS_ENERGY_15_C_CALORIES "15 C calories" + IDS_ENERGY_15_C_CALORIES "15 °C calories" IDS_ENERGY_BTUS "British Thermal Units" IDS_ENERGY_ERGS "Ergs" - IDS_ENERGY_EVS "lectron-volts" + IDS_ENERGY_EVS "Électron-volts" IDS_ENERGY_FOOT_POUNDS "Pied-livres" IDS_ENERGY_IT_CALORIES "International Table calories" IDS_ENERGY_IT_KILOCALORIES "International Table kilocalories" @@ -553,10 +553,10 @@ END // TYPES OF LENGTHS STRINGTABLE DISCARDABLE BEGIN - IDS_LENGTH_ANGSTROMS "Angstrm" - IDS_LENGTH_ASTRONOMICAL_UNITS "Units astronomiques" + IDS_LENGTH_ANGSTROMS "Angström" + IDS_LENGTH_ASTRONOMICAL_UNITS "Unités astronomiques" IDS_LENGTH_BARLEYCORNS "Barleycorns" - IDS_LENGTH_CENTIMETERS "Centimtres" + IDS_LENGTH_CENTIMETERS "Centimètres" IDS_LENGTH_CHAINS_UK "Chains (UK)" IDS_LENGTH_CHI "Chi" IDS_LENGTH_CHOU "Chou" @@ -575,14 +575,14 @@ BEGIN IDS_LENGTH_KABIET "Kabiet" IDS_LENGTH_KEN "Ken" IDS_LENGTH_KEUB "Keub" - IDS_LENGTH_KILOMETERS "Kilomtres" + IDS_LENGTH_KILOMETERS "Kilomètres" IDS_LENGTH_LAR "Lar" - IDS_LENGTH_LIGHT_YEARS "Annes lumires" + IDS_LENGTH_LIGHT_YEARS "Années lumières" IDS_LENGTH_LINKS_UK "Links (UK)" - IDS_LENGTH_METERS "Mtres" - IDS_LENGTH_MICRONS "Micromtres" + IDS_LENGTH_METERS "Mètres" + IDS_LENGTH_MICRONS "Micromètres" IDS_LENGTH_MILES "Miles" - IDS_LENGTH_MILLIMETERS "Millimtres" + IDS_LENGTH_MILLIMETERS "Millimètres" IDS_LENGTH_NAUTICAL_MILES "Miles nautiques" IDS_LENGTH_NIEU "Nieu" IDS_LENGTH_PARSECS "Parsecs" @@ -616,11 +616,11 @@ END // TYPE OF PRESSURES STRINGTABLE DISCARDABLE BEGIN - IDS_PRESSURE_ATMOSPHERES "Atmosphres" + IDS_PRESSURE_ATMOSPHERES "Atmosphères" IDS_PRESSURE_BARS "Bars" IDS_PRESSURE_HECTOPASCALS "Hectopascals" IDS_PRESSURE_KILOPASCALS "Kilopascals" - IDS_PRESSURE_MM_OF_MERCURY "Millimtres de mercure" + IDS_PRESSURE_MM_OF_MERCURY "Millimètres de mercure" IDS_PRESSURE_PASCALS "Pascals" IDS_PRESSURE_PSI "Pounds-force per square inch" END @@ -645,19 +645,19 @@ BEGIN IDS_TIME_MINUTES "Minutes" IDS_TIME_SECONDS "Secondes" IDS_TIME_WEEKS "Semaines" - IDS_TIME_YEARS "Annes" + IDS_TIME_YEARS "Années" END // TYPES OF VELOCITIES STRINGTABLE DISCARDABLE BEGIN - IDS_VELOCITY_CMS_SECOND "Centimtres/seconde" + IDS_VELOCITY_CMS_SECOND "Centimètres/seconde" IDS_VELOCITY_FEET_HOUR "Pieds/heure" IDS_VELOCITY_FEET_SECOND "Pieds/seconde" - IDS_VELOCITY_KILOMETERS_HOUR "Kilomtres/heure" + IDS_VELOCITY_KILOMETERS_HOUR "Kilomètres/heure" IDS_VELOCITY_KNOTS "Knots" IDS_VELOCITY_MACH "Mach" - IDS_VELOCITY_METERS_SECOND "Mtres/second" + IDS_VELOCITY_METERS_SECOND "Mètres/second" IDS_VELOCITY_MILES_HOUR "Miles/heure" END @@ -665,14 +665,14 @@ END STRINGTABLE DISCARDABLE BEGIN IDS_VOLUME_BARRELS_UK "Baril (UK)" - IDS_VOLUME_BARRELS_OIL "Baril de ptrole" + IDS_VOLUME_BARRELS_OIL "Baril de pétrole" IDS_VOLUME_BUN "Bun" IDS_VOLUME_BUSHELS_UK "Bushels (UK)" IDS_VOLUME_BUSHELS_US "Bushels (US)" - IDS_VOLUME_CUBIC_CENTIMETERS "Centimtres cubes" + IDS_VOLUME_CUBIC_CENTIMETERS "Centimètres cubes" IDS_VOLUME_CUBIC_FEET "Pieds cubes" IDS_VOLUME_CUBIC_INCHES "Pouces cubes" - IDS_VOLUME_CUBIC_METERS "Mtres cubes" + IDS_VOLUME_CUBIC_METERS "Mètres cubes" IDS_VOLUME_CUBIC_YARDS "Yards cubes" IDS_VOLUME_DOE "Doe" IDS_VOLUME_FLUID_OUNCES_UK "Fluid ounces (UK)" diff --git a/base/applications/calc/lang/it-IT.rc b/base/applications/calc/lang/it-IT.rc index 2e96c209fb5..607e95871e8 100644 --- a/base/applications/calc/lang/it-IT.rc +++ b/base/applications/calc/lang/it-IT.rc @@ -449,7 +449,7 @@ BEGIN IDS_CONV_PRESSURE "Pressione" IDS_CONV_TEMPERATURE "Temperatura" IDS_CONV_TIME "Tempo" - IDS_CONV_VELOCITY "Velocit" + IDS_CONV_VELOCITY "Velocità" IDS_CONV_VOLUME "Volume" IDS_CONV_WEIGHT "Peso" END @@ -554,7 +554,7 @@ END STRINGTABLE DISCARDABLE BEGIN IDS_LENGTH_ANGSTROMS "Angstrom" - IDS_LENGTH_ASTRONOMICAL_UNITS "Unit astronomiche" + IDS_LENGTH_ASTRONOMICAL_UNITS "Unità astronomiche" IDS_LENGTH_BARLEYCORNS "Barleycorn" IDS_LENGTH_CENTIMETERS "Centimetri" IDS_LENGTH_CHAINS_UK "Catene (GB)" @@ -648,7 +648,7 @@ BEGIN IDS_TIME_YEARS "Anni" END -// Tipi di velocit +// Tipi di velocità STRINGTABLE DISCARDABLE BEGIN IDS_VELOCITY_CMS_SECOND "Centimetri/ora" diff --git a/base/applications/calc/lang/ja-JP.rc b/base/applications/calc/lang/ja-JP.rc index 5a7a52e05f9..0f94e4d0cfb 100644 --- a/base/applications/calc/lang/ja-JP.rc +++ b/base/applications/calc/lang/ja-JP.rc @@ -4,15 +4,15 @@ LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT IDD_DIALOG_SCIENTIFIC DIALOGEX 0, 0, 316, 161 STYLE DS_SHELLFONT | WS_MINIMIZEBOX | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "ReactOS d" +CAPTION "ReactOS 電卓" MENU IDR_MENU_SCIENTIFIC_1 FONT 9, "MS UI Gothic", 0, 0, 0x1 BEGIN GROUPBOX "",IDC_STATIC,4,16,132,21 - CONTROL "16i",IDC_RADIO_HEX,"Button",BS_AUTORADIOBUTTON,8,24,29,10 - CONTROL "10i",IDC_RADIO_DEC,"Button",BS_AUTORADIOBUTTON,40,24,29,10 - CONTROL "8i",IDC_RADIO_OCT,"Button",BS_AUTORADIOBUTTON,72,24,27,10 - CONTROL "2i",IDC_RADIO_BIN,"Button",BS_AUTORADIOBUTTON,100,24,26,10 + CONTROL "16進",IDC_RADIO_HEX,"Button",BS_AUTORADIOBUTTON,8,24,29,10 + CONTROL "10進",IDC_RADIO_DEC,"Button",BS_AUTORADIOBUTTON,40,24,29,10 + CONTROL "8進",IDC_RADIO_OCT,"Button",BS_AUTORADIOBUTTON,72,24,27,10 + CONTROL "2進",IDC_RADIO_BIN,"Button",BS_AUTORADIOBUTTON,100,24,26,10 GROUPBOX "",IDC_STATIC,4,36,76,21 CONTROL "Inv",IDC_CHECK_INV,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,44,26,10 @@ -160,7 +160,7 @@ END IDD_DIALOG_STANDARD DIALOGEX 0, 0, 172, 127 STYLE DS_SHELLFONT | WS_MINIMIZEBOX | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "ReactOS d" +CAPTION "ReactOS 電卓" MENU IDR_MENU_STANDARD FONT 9, "MS UI Gothic", 0, 0, 0x1 BEGIN @@ -227,20 +227,20 @@ END IDD_DIALOG_CONVERSION DIALOGEX 0, 0, 320, 130 STYLE DS_SHELLFONT | WS_MINIMIZEBOX | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "ReactOS d" +CAPTION "ReactOS 電卓" MENU IDR_MENU_STANDARD FONT 9, "MS UI Gothic" BEGIN - PUSHBUTTON "ϊ",IDC_BUTTON_CONVERT,35,105,76,17 + PUSHBUTTON "変換",IDC_BUTTON_CONVERT,35,105,76,17 COMBOBOX IDC_COMBO_CATEGORY,4,31,140,168,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP | CBS_SORT - LTEXT ":",IDC_STATIC,4,20,56,8 + LTEXT "分類:",IDC_STATIC,4,20,56,8 COMBOBOX IDC_COMBO_FROM,4,60,140,168,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP | CBS_SORT - LTEXT "ϊ:",IDC_STATIC,4,49,56,8 + LTEXT "変換元:",IDC_STATIC,4,49,56,8 COMBOBOX IDC_COMBO_TO,4,87,140,168,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP | CBS_SORT - LTEXT "ϊ:",IDC_STATIC,4,76,56,8 + LTEXT "変換先:",IDC_STATIC,4,76,56,8 CONTROL "C",IDC_BUTTON_CANC,"Button",BS_OWNERDRAW | BS_CENTER | BS_VCENTER | BS_NOTIFY | WS_TABSTOP,276,24,40,17 CONTROL "CE",IDC_BUTTON_CE,"Button",BS_OWNERDRAW | BS_CENTER | @@ -305,13 +305,13 @@ END IDD_DIALOG_ABOUT DIALOGEX DISCARDABLE 0, 0, 264, 169 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "ReactOS dɂ‚" +CAPTION "ReactOS 電卓について" FONT 9, "MS UI Gothic" BEGIN DEFPUSHBUTTON "OK",IDOK,105,148,52,16 CONTROL IDB_BITMAP_ROS,IDC_STATIC,"Static",SS_BITMAP | SS_CENTERIMAGE | SS_REALSIZEIMAGE | WS_BORDER,4,4,104,48 - LTEXT "ReactOS d",IDC_STATIC,120,12,132,8, + LTEXT "ReactOS 電卓",IDC_STATIC,120,12,132,8, SS_CENTERIMAGE LTEXT "Version ",IDC_TEXT_VERSION,120,20,132,8,SS_CENTERIMAGE LTEXT "Written by Carlo Bramini",IDC_STATIC,120,32,132,8, @@ -341,89 +341,89 @@ END IDR_MENU_SCIENTIFIC_1 MENU DISCARDABLE BEGIN - POPUP "ҏW" + POPUP "編集" BEGIN - MENUITEM "Rs[\tCtrl+C", IDM_EDIT_COPY - MENUITEM "\\t\tCtrl+V", IDM_EDIT_PASTE + MENUITEM "コピー\tCtrl+C", IDM_EDIT_COPY + MENUITEM "貼\り付け\tCtrl+V", IDM_EDIT_PASTE END - POPUP "\\" + POPUP "表\示" BEGIN - MENUITEM "W", IDM_VIEW_STANDARD, CHECKED - MENUITEM "֐d", IDM_VIEW_SCIENTIFIC, CHECKED - MENUITEM "ϊ", IDM_VIEW_CONVERSION + MENUITEM "標準", IDM_VIEW_STANDARD, CHECKED + MENUITEM "関数電卓", IDM_VIEW_SCIENTIFIC, CHECKED + MENUITEM "変換", IDM_VIEW_CONVERSION MENUITEM SEPARATOR - MENUITEM "16i\tF5", IDM_VIEW_HEX, CHECKED - MENUITEM "10i\tF6", IDM_VIEW_DEC, CHECKED - MENUITEM "8i\tF7", IDM_VIEW_OCT, CHECKED - MENUITEM "2i\tF8", IDM_VIEW_BIN, CHECKED + MENUITEM "16進\tF5", IDM_VIEW_HEX, CHECKED + MENUITEM "10進\tF6", IDM_VIEW_DEC, CHECKED + MENUITEM "8進\tF7", IDM_VIEW_OCT, CHECKED + MENUITEM "2進\tF8", IDM_VIEW_BIN, CHECKED MENUITEM SEPARATOR MENUITEM "Degrees\tF2", IDM_VIEW_DEG, CHECKED MENUITEM "Radians\tF3", IDM_VIEW_RAD, CHECKED MENUITEM "Gradians\tF4", IDM_VIEW_GRAD, CHECKED MENUITEM SEPARATOR - MENUITEM "؂", IDM_VIEW_GROUP, CHECKED + MENUITEM "桁を区切る", IDM_VIEW_GROUP, CHECKED END - POPUP "wv" + POPUP "ヘルプ" BEGIN - MENUITEM "wv gsbN", IDM_HELP_HELP + MENUITEM "ヘルプ トピック", IDM_HELP_HELP MENUITEM SEPARATOR - MENUITEM "ReactOS dɂ‚", IDM_HELP_ABOUT + MENUITEM "ReactOS 電卓について", IDM_HELP_ABOUT END END IDR_MENU_SCIENTIFIC_2 MENU DISCARDABLE BEGIN - POPUP "ҏW" + POPUP "編集" BEGIN - MENUITEM "Rs[\tCtrl+C", IDM_EDIT_COPY - MENUITEM "\\t\tCtrl+V", IDM_EDIT_PASTE + MENUITEM "コピー\tCtrl+C", IDM_EDIT_COPY + MENUITEM "貼\り付け\tCtrl+V", IDM_EDIT_PASTE END - POPUP "\\" + POPUP "表\示" BEGIN - MENUITEM "W", IDM_VIEW_STANDARD, CHECKED - MENUITEM "֐d", IDM_VIEW_SCIENTIFIC, CHECKED - MENUITEM "ϊ", IDM_VIEW_CONVERSION + MENUITEM "標準", IDM_VIEW_STANDARD, CHECKED + MENUITEM "関数電卓", IDM_VIEW_SCIENTIFIC, CHECKED + MENUITEM "変換", IDM_VIEW_CONVERSION MENUITEM SEPARATOR - MENUITEM "16i\tF5", IDM_VIEW_HEX, CHECKED - MENUITEM "10i\tF6", IDM_VIEW_DEC, CHECKED - MENUITEM "8i\tF7", IDM_VIEW_OCT, CHECKED - MENUITEM "2i\tF8", IDM_VIEW_BIN, CHECKED + MENUITEM "16進\tF5", IDM_VIEW_HEX, CHECKED + MENUITEM "10進\tF6", IDM_VIEW_DEC, CHECKED + MENUITEM "8進\tF7", IDM_VIEW_OCT, CHECKED + MENUITEM "2進\tF8", IDM_VIEW_BIN, CHECKED MENUITEM SEPARATOR MENUITEM "Qword\tF12", IDM_VIEW_QWORD, CHECKED MENUITEM "Dword\tF2", IDM_VIEW_DWORD, CHECKED MENUITEM "Word\tF3", IDM_VIEW_WORD, CHECKED MENUITEM "Byte\tF4", IDM_VIEW_BYTE, CHECKED MENUITEM SEPARATOR - MENUITEM "؂", IDM_VIEW_GROUP, CHECKED + MENUITEM "桁を区切る", IDM_VIEW_GROUP, CHECKED END - POPUP "wv" + POPUP "ヘルプ" BEGIN - MENUITEM "wv gsbN", IDM_HELP_HELP + MENUITEM "ヘルプ トピック", IDM_HELP_HELP MENUITEM SEPARATOR - MENUITEM "ReactOS dɂ‚", IDM_HELP_ABOUT + MENUITEM "ReactOS 電卓について", IDM_HELP_ABOUT END END IDR_MENU_STANDARD MENU DISCARDABLE BEGIN - POPUP "ҏW" + POPUP "編集" BEGIN - MENUITEM "Rs[\tCtrl+C", IDM_EDIT_COPY - MENUITEM "\\t\tCtrl+V", IDM_EDIT_PASTE + MENUITEM "コピー\tCtrl+C", IDM_EDIT_COPY + MENUITEM "貼\り付け\tCtrl+V", IDM_EDIT_PASTE END - POPUP "\\" + POPUP "表\示" BEGIN - MENUITEM "W", IDM_VIEW_STANDARD, CHECKED - MENUITEM "֐d", IDM_VIEW_SCIENTIFIC, CHECKED - MENUITEM "ϊ", IDM_VIEW_CONVERSION + MENUITEM "標準", IDM_VIEW_STANDARD, CHECKED + MENUITEM "関数電卓", IDM_VIEW_SCIENTIFIC, CHECKED + MENUITEM "変換", IDM_VIEW_CONVERSION MENUITEM SEPARATOR - MENUITEM "؂", IDM_VIEW_GROUP, CHECKED + MENUITEM "桁を区切る", IDM_VIEW_GROUP, CHECKED END - POPUP "wv" + POPUP "ヘルプ" BEGIN - MENUITEM "wv gsbN", IDM_HELP_HELP + MENUITEM "ヘルプ トピック", IDM_HELP_HELP MENUITEM SEPARATOR - MENUITEM "ReactOS dɂ‚", IDM_HELP_ABOUT + MENUITEM "ReactOS 電卓について", IDM_HELP_ABOUT END END @@ -431,27 +431,27 @@ END STRINGTABLE DISCARDABLE BEGIN - IDS_STRING_LICENSE "ReactOS dGNU GPLCZX̌Œ񋟂t[\\tgEFAłB\r\n\r\nGNU GPLCZX̃Rs[𓾂邱Ƃł܂:\r\nhttp://www.gnu.org/licenses/gpl.html\r\n\r\nGNU GPLCZX̖|𓾂邱Ƃł܂:\r\nhttp://www.gnu.org/licenses/translations.html" - IDS_MATH_ERROR "G[" - IDS_QUICKHELP "NCbNwv" + IDS_STRING_LICENSE "ReactOS 電卓はGNU GPLライセンスの元で提供されるフリーソ\フトウェアです。\r\n\r\nこちらでGNU GPLライセンスのコピーを得ることができます:\r\nhttp://www.gnu.org/licenses/gpl.html\r\n\r\nこちらでGNU GPLライセンスの翻訳を得ることができます:\r\nhttp://www.gnu.org/licenses/translations.html" + IDS_MATH_ERROR "エラー" + IDS_QUICKHELP "クイックヘルプ" END // Types of conversion STRINGTABLE DISCARDABLE BEGIN - IDS_CONV_ANGLE "px" - IDS_CONV_AREA "ʐ" - IDS_CONV_CONSUMPTION " (GW)" - IDS_CONV_CURRENCY "ʉ" - IDS_CONV_ENERGY "GlM[" - IDS_CONV_LENGTH "" - IDS_CONV_POWER "" - IDS_CONV_PRESSURE "" - IDS_CONV_TEMPERATURE "x" - IDS_CONV_TIME "" - IDS_CONV_VELOCITY "x" - IDS_CONV_VOLUME "̐" - IDS_CONV_WEIGHT "d" + IDS_CONV_ANGLE "角度" + IDS_CONV_AREA "面積" + IDS_CONV_CONSUMPTION "消費 (エンジン)" + IDS_CONV_CURRENCY "通貨" + IDS_CONV_ENERGY "エネルギー" + IDS_CONV_LENGTH "長さ" + IDS_CONV_POWER "力" + IDS_CONV_PRESSURE "圧力" + IDS_CONV_TEMPERATURE "温度" + IDS_CONV_TIME "時間" + IDS_CONV_VELOCITY "速度" + IDS_CONV_VOLUME "体積" + IDS_CONV_WEIGHT "重さ" END // TYPES OF ANGLES @@ -465,15 +465,15 @@ END // TYPES OF AREAS STRINGTABLE DISCARDABLE BEGIN - IDS_AREA_ACRES "G[J[" - IDS_AREA_ACRES_BRAZIL "G[J[ (uW)" - IDS_AREA_ACRES_FRANCE "G[J[ (tX)" - IDS_AREA_ACRES_SCOTS "G[J[ (XRbgh)" - IDS_AREA_ACRES_US "G[J[ (č)" - IDS_AREA_ARES "A[" + IDS_AREA_ACRES "エーカー" + IDS_AREA_ACRES_BRAZIL "エーカー (ブラジル)" + IDS_AREA_ACRES_FRANCE "エーカー (フランス)" + IDS_AREA_ACRES_SCOTS "エーカー (スコットランド)" + IDS_AREA_ACRES_US "エーカー (米国)" + IDS_AREA_ARES "アール" IDS_AREA_CHOU "Chou" IDS_AREA_DANBO "Danbo" - IDS_AREA_HECTARES "wN^[" + IDS_AREA_HECTARES "ヘクタール" IDS_AREA_JEONGBO "Jeongbo" IDS_AREA_MORGEN_HUNGARY "Morgen (Hungary)" IDS_AREA_MU "Mu" @@ -482,122 +482,122 @@ BEGIN IDS_AREA_PYEONGBANGJA "Pyeongbangja" IDS_AREA_RAI "Rai" IDS_AREA_SE "Se" - IDS_AREA_SQUARE_CENTIMETERS "Z`[g" + IDS_AREA_SQUARE_CENTIMETERS "平方センチメートル" IDS_AREA_SQUARE_CHR "Square chr" - IDS_AREA_SQUARE_FATHOMS "q" - IDS_AREA_SQUARE_FATHOMS_HUNGARY "q (nK[)" - IDS_AREA_SQUARE_FEET "tB[g" - IDS_AREA_SQUARE_INCHES "C`" - IDS_AREA_SQUARE_KILOMETERS "L[^[" + IDS_AREA_SQUARE_FATHOMS "平方尋" + IDS_AREA_SQUARE_FATHOMS_HUNGARY "平方尋 (ハンガリー)" + IDS_AREA_SQUARE_FEET "平方フィート" + IDS_AREA_SQUARE_INCHES "平方インチ" + IDS_AREA_SQUARE_KILOMETERS "平方キロメーター" IDS_AREA_SQUARE_LAR "Square lar" - IDS_AREA_SQUARE_METER "[g" - IDS_AREA_SQUARE_MILES "}C" - IDS_AREA_SQUARE_MILLIMETERS "~[g" - IDS_AREA_SQUARE_SHAKU "" + IDS_AREA_SQUARE_METER "平方メートル" + IDS_AREA_SQUARE_MILES "平方マイル" + IDS_AREA_SQUARE_MILLIMETERS "平方ミリメートル" + IDS_AREA_SQUARE_SHAKU "平方尺" IDS_AREA_SQUARE_TSUEN "Square tsuen" IDS_AREA_SQUARE_VA "Square va" - IDS_AREA_SQUARE_YARD "[h" + IDS_AREA_SQUARE_YARD "平方ヤード" IDS_AREA_TAN "Tan" - IDS_AREA_TSUBO "" + IDS_AREA_TSUBO "坪" END // TYPES OF COMSUMPTIONS STRINGTABLE DISCARDABLE BEGIN - IDS_CONSUMPTION_KM_PER_L "L[g/bg" - IDS_CONSUMPTION_L_PER_100_KM "bg/100L[g" - IDS_CONSUMPTION_MILES_GALLON_UK "}C/K (p)" - IDS_CONSUMPTION_MILES_GALLON_US "}C/K (č)" + IDS_CONSUMPTION_KM_PER_L "キロメートル/リットル" + IDS_CONSUMPTION_L_PER_100_KM "リットル/100キロメートル" + IDS_CONSUMPTION_MILES_GALLON_UK "マイル/ガロン (英国)" + IDS_CONSUMPTION_MILES_GALLON_US "マイル/ガロン (米国)" END // TYPES OF CURRENCIES STRINGTABLE DISCARDABLE BEGIN - IDS_CURRENCY_AUSTRIAN_SCHILLING "I[XgA VO" - IDS_CURRENCY_BELGIAN_FRANC "xM[ t" - IDS_CURRENCY_CYPRIOT_POUND "LvX |h" - IDS_CURRENCY_CZECH_KORUNA "`FR Ri" - IDS_CURRENCY_DEUTSCHE_MARK "hCc }N" - IDS_CURRENCY_DUTCH_GUILDER "I_ M_[" - IDS_CURRENCY_EURO "[" - IDS_CURRENCY_FINNISH_MARKKA "tBh }bJ" - IDS_CURRENCY_FRENCH_FRANC "tX t" - IDS_CURRENCY_GREEK_DRACHMA "MV hN}" - IDS_CURRENCY_IRISH_POUND "ACh |h" - IDS_CURRENCY_ITALIAN_LIRA "C^A " - IDS_CURRENCY_LUXEMBOURG_FRANC "NZuN t" - IDS_CURRENCY_MALTESE_LIRA "}^ " - IDS_CURRENCY_PORTOGUESE_ESCUDO "|gK GXN[h" - IDS_CURRENCY_SLOVAK_KORUNA "XoLA Ri" - IDS_CURRENCY_SLOVENIAN_TOLAR "XxjA tolar" - IDS_CURRENCY_SPANISH_PESETA "XyC yZ^" + IDS_CURRENCY_AUSTRIAN_SCHILLING "オーストリア シリング" + IDS_CURRENCY_BELGIAN_FRANC "ベルギー フラン" + IDS_CURRENCY_CYPRIOT_POUND "キプロス ポンド" + IDS_CURRENCY_CZECH_KORUNA "チェコ コルナ" + IDS_CURRENCY_DEUTSCHE_MARK "ドイツ マルク" + IDS_CURRENCY_DUTCH_GUILDER "オランダ ギルダー" + IDS_CURRENCY_EURO "ユーロ" + IDS_CURRENCY_FINNISH_MARKKA "フィンランド マルッカ" + IDS_CURRENCY_FRENCH_FRANC "フランス フラン" + IDS_CURRENCY_GREEK_DRACHMA "ギリシャ ドラクマ" + IDS_CURRENCY_IRISH_POUND "アイルランド ポンド" + IDS_CURRENCY_ITALIAN_LIRA "イタリア リラ" + IDS_CURRENCY_LUXEMBOURG_FRANC "ルクセンブルク フラン" + IDS_CURRENCY_MALTESE_LIRA "マルタ リラ" + IDS_CURRENCY_PORTOGUESE_ESCUDO "ポルトガル エスクード" + IDS_CURRENCY_SLOVAK_KORUNA "スロバキア コルナ" + IDS_CURRENCY_SLOVENIAN_TOLAR "スロベニア tolar" + IDS_CURRENCY_SPANISH_PESETA "スペイン ペセタ" END // TYPES OF ENERGIES STRINGTABLE DISCARDABLE BEGIN - IDS_ENERGY_15_C_CALORIES "15J[" - IDS_ENERGY_BTUS "pMP" - IDS_ENERGY_ERGS "GO" - IDS_ENERGY_EVS "dq{g" - IDS_ENERGY_FOOT_POUNDS "t[g|h" + IDS_ENERGY_15_C_CALORIES "15℃カロリー" + IDS_ENERGY_BTUS "英国熱単位" + IDS_ENERGY_ERGS "エルグ" + IDS_ENERGY_EVS "電子ボルト" + IDS_ENERGY_FOOT_POUNDS "フートポンド" IDS_ENERGY_IT_CALORIES "International Table calories" IDS_ENERGY_IT_KILOCALORIES "International Table kilocalories" - IDS_ENERGY_JOULES "W[" - IDS_ENERGY_KILOJOULES "LW[" - IDS_ENERGY_KILOWATT_HOURS "Lbg" - IDS_ENERGY_NUTRITION_CALORIES "h{J[" - IDS_ENERGY_TH_CALORIES "MwJ[" + IDS_ENERGY_JOULES "ジュール" + IDS_ENERGY_KILOJOULES "キロジュール" + IDS_ENERGY_KILOWATT_HOURS "キロワット時" + IDS_ENERGY_NUTRITION_CALORIES "栄養カロリー" + IDS_ENERGY_TH_CALORIES "熱化学カロリー" END // TYPES OF LENGTHS STRINGTABLE DISCARDABLE BEGIN - IDS_LENGTH_ANGSTROMS "IOXg[" - IDS_LENGTH_ASTRONOMICAL_UNITS "VP" - IDS_LENGTH_BARLEYCORNS "o[[R[" - IDS_LENGTH_CENTIMETERS "Z`[g" - IDS_LENGTH_CHAINS_UK "`F[ (p)" + IDS_LENGTH_ANGSTROMS "オングストローム" + IDS_LENGTH_ASTRONOMICAL_UNITS "天文単位" + IDS_LENGTH_BARLEYCORNS "バーレーコーン" + IDS_LENGTH_CENTIMETERS "センチメートル" + IDS_LENGTH_CHAINS_UK "チェーン (英国)" IDS_LENGTH_CHI "Chi" IDS_LENGTH_CHOU "Chou" IDS_LENGTH_CHR "Chr" IDS_LENGTH_CUN "Cun" - IDS_LENGTH_FATHOMS "t@]" - IDS_LENGTH_FATHOMS_HUNGARY "t@] (nK[)" - IDS_LENGTH_FEET "tB[g" - IDS_LENGTH_FURLONGS "n" + IDS_LENGTH_FATHOMS "ファゾム" + IDS_LENGTH_FATHOMS_HUNGARY "ファゾム (ハンガリー)" + IDS_LENGTH_FEET "フィート" + IDS_LENGTH_FURLONGS "ハロン" IDS_LENGTH_GAN "Gan" - IDS_LENGTH_HANDS "nh" + IDS_LENGTH_HANDS "ハンド" IDS_LENGTH_HUNH "Hunh" - IDS_LENGTH_INCHES "C`" + IDS_LENGTH_INCHES "インチ" IDS_LENGTH_JA "Ja" IDS_LENGTH_JEONG "Jeong" IDS_LENGTH_KABIET "Kabiet" IDS_LENGTH_KEN "Ken" IDS_LENGTH_KEUB "Keub" - IDS_LENGTH_KILOMETERS "L[g" + IDS_LENGTH_KILOMETERS "キロメートル" IDS_LENGTH_LAR "Lar" - IDS_LENGTH_LIGHT_YEARS "N" - IDS_LENGTH_LINKS_UK "N (p)" - IDS_LENGTH_METERS "[g" - IDS_LENGTH_MICRONS "~N" - IDS_LENGTH_MILES "}C" - IDS_LENGTH_MILLIMETERS "~[g" - IDS_LENGTH_NAUTICAL_MILES "C" + IDS_LENGTH_LIGHT_YEARS "光年" + IDS_LENGTH_LINKS_UK "リンク (英国)" + IDS_LENGTH_METERS "メートル" + IDS_LENGTH_MICRONS "ミクロン" + IDS_LENGTH_MILES "マイル" + IDS_LENGTH_MILLIMETERS "ミリメートル" + IDS_LENGTH_NAUTICAL_MILES "海里" IDS_LENGTH_NIEU "Nieu" - IDS_LENGTH_PARSECS "p[ZN" - IDS_LENGTH_PICAS "pCJ" - IDS_LENGTH_RI_JAPAN " ({)" - IDS_LENGTH_RI_KOREA "Ri (؍)" - IDS_LENGTH_RODS "bh" + IDS_LENGTH_PARSECS "パーセク" + IDS_LENGTH_PICAS "パイカ" + IDS_LENGTH_RI_JAPAN "里 (日本)" + IDS_LENGTH_RI_KOREA "Ri (韓国)" + IDS_LENGTH_RODS "ロッド" IDS_LENGTH_SAWK "Sawk" IDS_LENGTH_SEN "Sen" - IDS_LENGTH_SHAKU "" - IDS_LENGTH_SPAN "Xp" - IDS_LENGTH_SUN "" + IDS_LENGTH_SHAKU "尺" + IDS_LENGTH_SPAN "スパン" + IDS_LENGTH_SUN "寸" IDS_LENGTH_TSUEN "Tsuen" IDS_LENGTH_VA "Va" - IDS_LENGTH_YARDS "[h" + IDS_LENGTH_YARDS "ヤード" IDS_LENGTH_YOTE "Yote" IDS_LENGTH_ZHANG "Zhang" END @@ -605,94 +605,94 @@ END // TYPES OF POWERS STRINGTABLE DISCARDABLE BEGIN - IDS_POWER_BTUS_PER_MINUTE "pMP/" - IDS_POWER_FPS_PER_MINUTE "t[g|h/" - IDS_POWER_HORSEPOWER "n" - IDS_POWER_KILOWATTS "Lbg" - IDS_POWER_MEGAWATTS "Kbg" - IDS_POWER_WATTS "bg" + IDS_POWER_BTUS_PER_MINUTE "英国熱単位/分" + IDS_POWER_FPS_PER_MINUTE "フートポンド/分" + IDS_POWER_HORSEPOWER "馬力" + IDS_POWER_KILOWATTS "キロワット" + IDS_POWER_MEGAWATTS "メガワット" + IDS_POWER_WATTS "ワット" END // TYPE OF PRESSURES STRINGTABLE DISCARDABLE BEGIN - IDS_PRESSURE_ATMOSPHERES "C" + IDS_PRESSURE_ATMOSPHERES "気圧" IDS_PRESSURE_BARS "Bars" - IDS_PRESSURE_HECTOPASCALS "wNgpXJ" - IDS_PRESSURE_KILOPASCALS "LpXJ" - IDS_PRESSURE_MM_OF_MERCURY "~[g" - IDS_PRESSURE_PASCALS "pXJ" - IDS_PRESSURE_PSI "|hd/C`" + IDS_PRESSURE_HECTOPASCALS "ヘクトパスカル" + IDS_PRESSURE_KILOPASCALS "キロパスカル" + IDS_PRESSURE_MM_OF_MERCURY "水銀ミリメートル" + IDS_PRESSURE_PASCALS "パスカル" + IDS_PRESSURE_PSI "ポンド重/平方インチ" END // TYPES OF TEMPERATURES STRINGTABLE DISCARDABLE BEGIN - IDS_TEMPERATURE_CELSIUS "ێ" - IDS_TEMPERATURE_FAHRENHEIT "؎" - IDS_TEMPERATURE_KELVIN "Pr" + IDS_TEMPERATURE_CELSIUS "摂氏" + IDS_TEMPERATURE_FAHRENHEIT "華氏" + IDS_TEMPERATURE_KELVIN "ケルビン" IDS_TEMPERATURE_RANKINE "Rankine" END // TYPES OF TIME STRINGTABLE DISCARDABLE BEGIN - IDS_TIME_DAYS "" - IDS_TIME_HOURS "" - IDS_TIME_NANOSECONDS "imb" - IDS_TIME_MICROSECONDS "}CNb" - IDS_TIME_MILLISECONDS "~b" - IDS_TIME_MINUTES "" - IDS_TIME_SECONDS "b" - IDS_TIME_WEEKS "T" - IDS_TIME_YEARS "N" + IDS_TIME_DAYS "日数" + IDS_TIME_HOURS "時間" + IDS_TIME_NANOSECONDS "ナノ秒" + IDS_TIME_MICROSECONDS "マイクロ秒" + IDS_TIME_MILLISECONDS "ミリ秒" + IDS_TIME_MINUTES "分" + IDS_TIME_SECONDS "秒" + IDS_TIME_WEEKS "週" + IDS_TIME_YEARS "年" END // TYPES OF VELOCITIES STRINGTABLE DISCARDABLE BEGIN - IDS_VELOCITY_CMS_SECOND "Z`[g/" - IDS_VELOCITY_FEET_HOUR "tB[g/" - IDS_VELOCITY_FEET_SECOND "tB[g/b" - IDS_VELOCITY_KILOMETERS_HOUR "L[g/" - IDS_VELOCITY_KNOTS "mbg" - IDS_VELOCITY_MACH "}bn" - IDS_VELOCITY_METERS_SECOND "[g/b" - IDS_VELOCITY_MILES_HOUR "}C/" + IDS_VELOCITY_CMS_SECOND "センチメートル/時" + IDS_VELOCITY_FEET_HOUR "フィート/時" + IDS_VELOCITY_FEET_SECOND "フィート/秒" + IDS_VELOCITY_KILOMETERS_HOUR "キロメートル/時" + IDS_VELOCITY_KNOTS "ノット" + IDS_VELOCITY_MACH "マッハ" + IDS_VELOCITY_METERS_SECOND "メートル/秒" + IDS_VELOCITY_MILES_HOUR "マイル/時" END // TYPES OF VOLUMES STRINGTABLE DISCARDABLE BEGIN - IDS_VOLUME_BARRELS_UK "o (p)" - IDS_VOLUME_BARRELS_OIL "Ζo" + IDS_VOLUME_BARRELS_UK "バレル (英国)" + IDS_VOLUME_BARRELS_OIL "石油バレル" IDS_VOLUME_BUN "Bun" - IDS_VOLUME_BUSHELS_UK "ubVF (p)" - IDS_VOLUME_BUSHELS_US "ubVF (č)" - IDS_VOLUME_CUBIC_CENTIMETERS "@Z`[g" - IDS_VOLUME_CUBIC_FEET "@tB[g" - IDS_VOLUME_CUBIC_INCHES "@C`" - IDS_VOLUME_CUBIC_METERS "@[g" - IDS_VOLUME_CUBIC_YARDS "@[h" + IDS_VOLUME_BUSHELS_UK "ブッシェル (英国)" + IDS_VOLUME_BUSHELS_US "ブッシェル (米国)" + IDS_VOLUME_CUBIC_CENTIMETERS "立法センチメートル" + IDS_VOLUME_CUBIC_FEET "立法フィート" + IDS_VOLUME_CUBIC_INCHES "立法インチ" + IDS_VOLUME_CUBIC_METERS "立法メートル" + IDS_VOLUME_CUBIC_YARDS "立法ヤード" IDS_VOLUME_DOE "Doe" - IDS_VOLUME_FLUID_OUNCES_UK "̃IX (p)" - IDS_VOLUME_FLUID_OUNCES_US "̃IX (č)" - IDS_VOLUME_GALLONS_UK "K (p)" - IDS_VOLUME_GALLONS_DRY_US "KA (č)" - IDS_VOLUME_GALLONS_LIQUID_US "KAt (č)" + IDS_VOLUME_FLUID_OUNCES_UK "流体オンス (英国)" + IDS_VOLUME_FLUID_OUNCES_US "流体オンス (米国)" + IDS_VOLUME_GALLONS_UK "ガロン (英国)" + IDS_VOLUME_GALLONS_DRY_US "ガロン、乾燥 (米国)" + IDS_VOLUME_GALLONS_LIQUID_US "ガロン、液体 (米国)" IDS_VOLUME_GOU "Gou" IDS_VOLUME_HOP "Hop" IDS_VOLUME_ICCE "Icce" IDS_VOLUME_KWIAN "Kwian" - IDS_VOLUME_LITERS "bg" + IDS_VOLUME_LITERS "リットル" IDS_VOLUME_MAL "Mal" - IDS_VOLUME_MILLILITERS "~bg" - IDS_VOLUME_PINTS_UK "pCg (p)" - IDS_VOLUME_PINTS_DRY_US "pCgA (č)" - IDS_VOLUME_PINTS_LIQUID_US "pCgAt (č)" - IDS_VOLUME_QUARTS_UK "NH[g (p)" - IDS_VOLUME_QUARTS_DRY_US "NH[gA (č)" - IDS_VOLUME_QUARTS_LIQUID_US "NH[gAt (č)" + IDS_VOLUME_MILLILITERS "ミリリットル" + IDS_VOLUME_PINTS_UK "パイント (英国)" + IDS_VOLUME_PINTS_DRY_US "パイント、乾燥 (米国)" + IDS_VOLUME_PINTS_LIQUID_US "パイント、液体 (米国)" + IDS_VOLUME_QUARTS_UK "クォート (英国)" + IDS_VOLUME_QUARTS_DRY_US "クォート、乾燥 (米国)" + IDS_VOLUME_QUARTS_LIQUID_US "クォート、液体 (米国)" IDS_VOLUME_SEKI "Seki" IDS_VOLUME_SYOU "Syou" IDS_VOLUME_TANANLOUNG "Tananloung" @@ -704,29 +704,29 @@ END STRINGTABLE DISCARDABLE BEGIN IDS_WEIGHT_BAHT "Baht" - IDS_WEIGHT_CARATS "Jbg" + IDS_WEIGHT_CARATS "カラット" IDS_WEIGHT_CHUNG "Chung" IDS_WEIGHT_DON "Don" IDS_WEIGHT_GEUN "Geun" - IDS_WEIGHT_GRAMS "O" + IDS_WEIGHT_GRAMS "グラム" IDS_WEIGHT_GWAN "Gwan" IDS_WEIGHT_HARB "Harb" - IDS_WEIGHT_JIN_CHINA "Jin ()" - IDS_WEIGHT_JIN_TAIWAN "Jin (p)" + IDS_WEIGHT_JIN_CHINA "Jin (中国)" + IDS_WEIGHT_JIN_TAIWAN "Jin (台湾)" IDS_WEIGHT_KAN "Kan" - IDS_WEIGHT_KILOGRAMS "LO" + IDS_WEIGHT_KILOGRAMS "キログラム" IDS_WEIGHT_KIN "Kin" - IDS_WEIGHT_LIANG_CHINA "Liang ()" - IDS_WEIGHT_LIANG_TAIWAN "Liang (p)" - IDS_WEIGHT_MONME " ()" - IDS_WEIGHT_OUNCES_AVOIRDUPOIS "tIX" - IDS_WEIGHT_OUNCES_TROY "gC IX" - IDS_WEIGHT_POUNDS "|h" - IDS_WEIGHT_QUINTAL_METRIC "L^ (metric)" + IDS_WEIGHT_LIANG_CHINA "Liang (中国)" + IDS_WEIGHT_LIANG_TAIWAN "Liang (台湾)" + IDS_WEIGHT_MONME "匁 (もんめ)" + IDS_WEIGHT_OUNCES_AVOIRDUPOIS "常衡オンス" + IDS_WEIGHT_OUNCES_TROY "トロイ オンス" + IDS_WEIGHT_POUNDS "ポンド" + IDS_WEIGHT_QUINTAL_METRIC "キンタル (metric)" IDS_WEIGHT_SALOUNG "Saloung" - IDS_WEIGHT_STONES "Xg[" + IDS_WEIGHT_STONES "ストーン" IDS_WEIGHT_TAMLUNG "Tamlung" - IDS_WEIGHT_TONNES "g" - IDS_WEIGHT_TONS_UK "g (p)" - IDS_WEIGHT_TONS_US "g (č)" + IDS_WEIGHT_TONNES "トン" + IDS_WEIGHT_TONS_UK "トン (英国)" + IDS_WEIGHT_TONS_US "トン (米国)" END diff --git a/base/applications/calc/lang/ko-KR.rc b/base/applications/calc/lang/ko-KR.rc index 8ab51ed6496..8069dc2e05c 100644 --- a/base/applications/calc/lang/ko-KR.rc +++ b/base/applications/calc/lang/ko-KR.rc @@ -1,5 +1,5 @@ /* - * Korean translation by manatails007 (www.manatails007.org) Seungju Kim + * Korean translation by manatails007 (www.manatails007.org) Seungju Kim */ LANGUAGE LANG_KOREAN, SUBLANG_DEFAULT @@ -8,7 +8,7 @@ LANGUAGE LANG_KOREAN, SUBLANG_DEFAULT IDD_DIALOG_SCIENTIFIC DIALOGEX 0, 0, 316, 161 STYLE DS_SHELLFONT | WS_MINIMIZEBOX | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "ReactOS " +CAPTION "ReactOS 계산기" MENU IDR_MENU_SCIENTIFIC_1 FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN @@ -164,7 +164,7 @@ END IDD_DIALOG_STANDARD DIALOGEX 0, 0, 172, 127 STYLE DS_SHELLFONT | WS_MINIMIZEBOX | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "ReactOS " +CAPTION "ReactOS 계산기" MENU IDR_MENU_STANDARD FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN @@ -231,7 +231,7 @@ END IDD_DIALOG_CONVERSION DIALOGEX 0, 0, 320, 130 STYLE DS_SHELLFONT | WS_MINIMIZEBOX | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "ReactOS " +CAPTION "ReactOS 계산기 정보" MENU IDR_MENU_STANDARD FONT 8, "MS Shell Dlg" BEGIN @@ -309,16 +309,16 @@ END IDD_DIALOG_ABOUT DIALOGEX DISCARDABLE 0, 0, 264, 169 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "ReactOS " +CAPTION "ReactOS 계산기 정보" FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "OK",IDOK,105,148,52,16 CONTROL IDB_BITMAP_ROS,IDC_STATIC,"Static",SS_BITMAP | SS_CENTERIMAGE | SS_REALSIZEIMAGE | WS_BORDER,4,4,104,48 - LTEXT "ReactOS ",IDC_STATIC,120,12,132,8, + LTEXT "ReactOS 계산기",IDC_STATIC,120,12,132,8, SS_CENTERIMAGE - LTEXT " ",IDC_TEXT_VERSION,120,20,132,8,SS_CENTERIMAGE - LTEXT "Carlo Bramini ",IDC_STATIC,120,32,132,8, + LTEXT "버젼 ",IDC_TEXT_VERSION,120,20,132,8,SS_CENTERIMAGE + LTEXT "Carlo Bramini에 의해 쓰여짐",IDC_STATIC,120,32,132,8, SS_CENTERIMAGE GROUPBOX "",IDC_STATIC,112,0,148,52 GROUPBOX "",IDC_STATIC,4,56,256,88 @@ -345,16 +345,16 @@ END IDR_MENU_SCIENTIFIC_1 MENU DISCARDABLE BEGIN - POPUP "" + POPUP "편집" BEGIN - MENUITEM "\tCTRL-C", IDM_EDIT_COPY - MENUITEM "ٿֱ\tCTRL-V", IDM_EDIT_PASTE + MENUITEM "복사\tCTRL-C", IDM_EDIT_COPY + MENUITEM "붙여넣기\tCTRL-V", IDM_EDIT_PASTE END - POPUP "" + POPUP "보기" BEGIN - MENUITEM "Ϲ", IDM_VIEW_STANDARD, CHECKED - MENUITEM "", IDM_VIEW_SCIENTIFIC, CHECKED - MENUITEM "ȯ", IDM_VIEW_CONVERSION + MENUITEM "일반", IDM_VIEW_STANDARD, CHECKED + MENUITEM "공학", IDM_VIEW_SCIENTIFIC, CHECKED + MENUITEM "전환", IDM_VIEW_CONVERSION MENUITEM SEPARATOR MENUITEM "Hex\tF5", IDM_VIEW_HEX, CHECKED MENUITEM "Decimal\tF6", IDM_VIEW_DEC, CHECKED @@ -365,28 +365,28 @@ BEGIN MENUITEM "Radians\tF3", IDM_VIEW_RAD, CHECKED MENUITEM "Grads\tF4", IDM_VIEW_GRAD, CHECKED MENUITEM SEPARATOR - MENUITEM "ڸ ", IDM_VIEW_GROUP, CHECKED + MENUITEM "자릿수 구분 단위", IDM_VIEW_GROUP, CHECKED END - POPUP "" + POPUP "도움말" BEGIN - MENUITEM " ׸", IDM_HELP_HELP + MENUITEM "도움말 항목", IDM_HELP_HELP MENUITEM SEPARATOR - MENUITEM "ReactOS ", IDM_HELP_ABOUT + MENUITEM "ReactOS 계산기 정보", IDM_HELP_ABOUT END END IDR_MENU_SCIENTIFIC_2 MENU DISCARDABLE BEGIN - POPUP "" + POPUP "편집" BEGIN - MENUITEM "\tCTRL-C", IDM_EDIT_COPY - MENUITEM "ٿֱ\tCTRL-V", IDM_EDIT_PASTE + MENUITEM "복사\tCTRL-C", IDM_EDIT_COPY + MENUITEM "붙여넣기\tCTRL-V", IDM_EDIT_PASTE END - POPUP "" + POPUP "보기" BEGIN - MENUITEM "Ϲ", IDM_VIEW_STANDARD, CHECKED - MENUITEM "", IDM_VIEW_SCIENTIFIC, CHECKED - MENUITEM "ȯ", IDM_VIEW_CONVERSION + MENUITEM "일반", IDM_VIEW_STANDARD, CHECKED + MENUITEM "공학", IDM_VIEW_SCIENTIFIC, CHECKED + MENUITEM "전환", IDM_VIEW_CONVERSION MENUITEM SEPARATOR MENUITEM "Hex\tF5", IDM_VIEW_HEX, CHECKED MENUITEM "Decimal\tF6", IDM_VIEW_DEC, CHECKED @@ -398,36 +398,36 @@ BEGIN MENUITEM "Word\tF3", IDM_VIEW_WORD, CHECKED MENUITEM "Byte\tF4", IDM_VIEW_BYTE, CHECKED MENUITEM SEPARATOR - MENUITEM "ڸ ", IDM_VIEW_GROUP, CHECKED + MENUITEM "자릿수 구분 단위", IDM_VIEW_GROUP, CHECKED END - POPUP "" + POPUP "도움말" BEGIN - MENUITEM " ׸", IDM_HELP_HELP + MENUITEM "도움말 항목", IDM_HELP_HELP MENUITEM SEPARATOR - MENUITEM "ReactOS ", IDM_HELP_ABOUT + MENUITEM "ReactOS 계산기 정보", IDM_HELP_ABOUT END END IDR_MENU_STANDARD MENU DISCARDABLE BEGIN - POPUP "" + POPUP "편집" BEGIN - MENUITEM "\tCTRL-C", IDM_EDIT_COPY - MENUITEM "ٿֱ\tCTRL-V", IDM_EDIT_PASTE + MENUITEM "복사\tCTRL-C", IDM_EDIT_COPY + MENUITEM "붙여넣기\tCTRL-V", IDM_EDIT_PASTE END - POPUP "" + POPUP "보기" BEGIN - MENUITEM "Ϲ", IDM_VIEW_STANDARD, CHECKED - MENUITEM "", IDM_VIEW_SCIENTIFIC, CHECKED - MENUITEM "ȯ", IDM_VIEW_CONVERSION + MENUITEM "일반", IDM_VIEW_STANDARD, CHECKED + MENUITEM "공학", IDM_VIEW_SCIENTIFIC, CHECKED + MENUITEM "전환", IDM_VIEW_CONVERSION MENUITEM SEPARATOR - MENUITEM "ڸ ", IDM_VIEW_GROUP, CHECKED + MENUITEM "자릿수 구분 단위", IDM_VIEW_GROUP, CHECKED END - POPUP "" + POPUP "도움말" BEGIN - MENUITEM " ׸", IDM_HELP_HELP + MENUITEM "도움말 항목", IDM_HELP_HELP MENUITEM SEPARATOR - MENUITEM "ReactOS ", IDM_HELP_ABOUT + MENUITEM "ReactOS 계산기 정보", IDM_HELP_ABOUT END END @@ -436,14 +436,14 @@ END STRINGTABLE DISCARDABLE BEGIN IDS_STRING_LICENSE "ReactOS Calc is free software released under GNU GPL license.\r\n\r\nYou can get a copy of GNU GPL license here:\r\nhttp://www.gnu.org/licenses/gpl.html\r\n\r\nYou can also get a translation of GNU GPL license here:\r\nhttp://www.gnu.org/licenses/translations.html" - IDS_MATH_ERROR "" - IDS_QUICKHELP " " + IDS_MATH_ERROR "에러" + IDS_QUICKHELP "빠른 도움말" END // Types of conversion STRINGTABLE DISCARDABLE BEGIN - IDS_CONV_ANGLE "" + IDS_CONV_ANGLE "각도" IDS_CONV_AREA "Area" IDS_CONV_CONSUMPTION "Consumption (engines)" IDS_CONV_CURRENCY "Currencies" @@ -452,7 +452,7 @@ BEGIN IDS_CONV_POWER "Power" IDS_CONV_PRESSURE "Pressure" IDS_CONV_TEMPERATURE "Temperature" - IDS_CONV_TIME "" + IDS_CONV_TIME "각도" IDS_CONV_VELOCITY "Velocity" IDS_CONV_VOLUME "Volume" IDS_CONV_WEIGHT "Weights" @@ -540,10 +540,10 @@ END // TYPES OF ENERGIES STRINGTABLE DISCARDABLE BEGIN - IDS_ENERGY_15_C_CALORIES "15 C calories" + IDS_ENERGY_15_C_CALORIES "15 °C calories" IDS_ENERGY_BTUS "British Thermal Units" IDS_ENERGY_ERGS "Ergs" - IDS_ENERGY_EVS "ںƮ" + IDS_ENERGY_EVS "전자볼트" IDS_ENERGY_FOOT_POUNDS "Foot-Pounds" IDS_ENERGY_IT_CALORIES "International Table calories" IDS_ENERGY_IT_KILOCALORIES "International Table kilocalories" @@ -557,7 +557,7 @@ END // TYPES OF LENGTHS STRINGTABLE DISCARDABLE BEGIN - IDS_LENGTH_ANGSTROMS "˽Ʈ" + IDS_LENGTH_ANGSTROMS "옹스트롬" IDS_LENGTH_ASTRONOMICAL_UNITS "Astronomical units" IDS_LENGTH_BARLEYCORNS "Barleycorns" IDS_LENGTH_CENTIMETERS "Centimeters" diff --git a/base/applications/calc/lang/no-NO.rc b/base/applications/calc/lang/no-NO.rc index 8e590be8ac3..1b85033c33e 100644 --- a/base/applications/calc/lang/no-NO.rc +++ b/base/applications/calc/lang/no-NO.rc @@ -355,7 +355,7 @@ BEGIN MENUITEM "Heksadesimalt\tF5", IDM_VIEW_HEX, CHECKED MENUITEM "Desimalt\tF6", IDM_VIEW_DEC, CHECKED MENUITEM "Oktalt\tF7", IDM_VIEW_OCT, CHECKED - MENUITEM "Binrt\tF8", IDM_VIEW_BIN, CHECKED + MENUITEM "Binært\tF8", IDM_VIEW_BIN, CHECKED MENUITEM SEPARATOR MENUITEM "Grader\tF2", IDM_VIEW_DEG, CHECKED MENUITEM "Radianer\tF3", IDM_VIEW_RAD, CHECKED @@ -387,7 +387,7 @@ BEGIN MENUITEM "Heksadesimalt\tF5", IDM_VIEW_HEX, CHECKED MENUITEM "Desimal\tF6", IDM_VIEW_DEC, CHECKED MENUITEM "Oktalt\tF7", IDM_VIEW_OCT, CHECKED - MENUITEM "Binrt\tF8", IDM_VIEW_BIN, CHECKED + MENUITEM "Binært\tF8", IDM_VIEW_BIN, CHECKED MENUITEM SEPARATOR MENUITEM "Qword\tF12", IDM_VIEW_QWORD, CHECKED MENUITEM "Dword\tF2", IDM_VIEW_DWORD, CHECKED @@ -431,7 +431,7 @@ END STRINGTABLE DISCARDABLE BEGIN - IDS_STRING_LICENSE "ReactOS Kalkulator er gratis programvare utgitt under GNU GPL lisensen.\r\n\r\nDu kan f en kopi av GNU GPL lisensen her:\r\nhttp://www.gnu.org/licenses/gpl.html\r\n\r\nDu kan ogs f en oversettelse av GNU GPL lisensen her:\r\nhttp://www.gnu.org/licenses/translations.html" + IDS_STRING_LICENSE "ReactOS Kalkulator er gratis programvare utgitt under GNU GPL lisensen.\r\n\r\nDu kan få en kopi av GNU GPL lisensen her:\r\nhttp://www.gnu.org/licenses/gpl.html\r\n\r\nDu kan også få en oversettelse av GNU GPL lisensen her:\r\nhttp://www.gnu.org/licenses/translations.html" IDS_MATH_ERROR "Feil" IDS_QUICKHELP "Rask hjelp" END @@ -440,12 +440,12 @@ END STRINGTABLE DISCARDABLE BEGIN IDS_CONV_ANGLE "Vinkel" - IDS_CONV_AREA "Omrde" + IDS_CONV_AREA "Område" IDS_CONV_CONSUMPTION "Forbruk (maskin)" IDS_CONV_CURRENCY "Valuta" IDS_CONV_ENERGY "Energi" IDS_CONV_LENGTH "Lengde" - IDS_CONV_POWER "Strm" + IDS_CONV_POWER "Strøm" IDS_CONV_PRESSURE "Trykk" IDS_CONV_TEMPERATURE "Temperatur" IDS_CONV_TIME "Tid" @@ -513,7 +513,7 @@ END // TYPES OF CURRENCIES STRINGTABLE DISCARDABLE BEGIN - IDS_CURRENCY_AUSTRIAN_SCHILLING "sterriksk schilling" + IDS_CURRENCY_AUSTRIAN_SCHILLING "Østerriksk schilling" IDS_CURRENCY_BELGIAN_FRANC "Belgisk franc" IDS_CURRENCY_CYPRIOT_POUND "Kypriotisk pound" IDS_CURRENCY_CZECH_KORUNA "Tsjekkisk koruna" @@ -536,7 +536,7 @@ END // TYPES OF ENERGIES STRINGTABLE DISCARDABLE BEGIN - IDS_ENERGY_15_C_CALORIES "15 C calories" + IDS_ENERGY_15_C_CALORIES "15 °C calories" IDS_ENERGY_BTUS "Britisk varme-enhet" IDS_ENERGY_ERGS "Ergs" IDS_ENERGY_EVS "Elektrisk-Volt" @@ -546,7 +546,7 @@ BEGIN IDS_ENERGY_JOULES "Joules" IDS_ENERGY_KILOJOULES "Kilojoules" IDS_ENERGY_KILOWATT_HOURS "Kilowatt timer" - IDS_ENERGY_NUTRITION_CALORIES "Ernring kalori" + IDS_ENERGY_NUTRITION_CALORIES "Ernæring kalori" IDS_ENERGY_TH_CALORIES "Termokjemisk kalori" END @@ -577,7 +577,7 @@ BEGIN IDS_LENGTH_KEUB "Keub" IDS_LENGTH_KILOMETERS "Kilometer" IDS_LENGTH_LAR "Lar" - IDS_LENGTH_LIGHT_YEARS "Lysende r" + IDS_LENGTH_LIGHT_YEARS "Lysende år" IDS_LENGTH_LINKS_UK "Linker (UK)" IDS_LENGTH_METERS "Meters" IDS_LENGTH_MICRONS "Microns" @@ -616,7 +616,7 @@ END // TYPE OF PRESSURES STRINGTABLE DISCARDABLE BEGIN - IDS_PRESSURE_ATMOSPHERES "Atmosfretrykk" + IDS_PRESSURE_ATMOSPHERES "Atmosfæretrykk" IDS_PRESSURE_BARS "Bars" IDS_PRESSURE_HECTOPASCALS "Hectopascals" IDS_PRESSURE_KILOPASCALS "Kilopascals" diff --git a/base/applications/calc/lang/ro-RO.rc b/base/applications/calc/lang/ro-RO.rc index 118850579b8..e4e25e112bf 100644 --- a/base/applications/calc/lang/ro-RO.rc +++ b/base/applications/calc/lang/ro-RO.rc @@ -730,5 +730,3 @@ BEGIN IDS_WEIGHT_TONS_UK "Tone (Marea Britanie)" IDS_WEIGHT_TONS_US "Tone (SUA)" END - -#pragma code_page(default) diff --git a/base/applications/calc/lang/ru-RU.rc b/base/applications/calc/lang/ru-RU.rc index 6d2d41c3612..e2f26594db4 100644 --- a/base/applications/calc/lang/ru-RU.rc +++ b/base/applications/calc/lang/ru-RU.rc @@ -4,7 +4,7 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT IDD_DIALOG_SCIENTIFIC DIALOGEX 0, 0, 316, 161 STYLE DS_SHELLFONT | WS_MINIMIZEBOX | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " ReactOS" +CAPTION "Калькулятор ReactOS" MENU IDR_MENU_SCIENTIFIC_1 FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN @@ -133,19 +133,19 @@ BEGIN PUSHBUTTON "F",IDC_BUTTON_F,288,140,24,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP GROUPBOX "",IDC_STATIC,140,16,172,21 - CONTROL "8 ",IDC_RADIO_QWORD,"Button",BS_AUTORADIOBUTTON | + CONTROL "8 байт",IDC_RADIO_QWORD,"Button",BS_AUTORADIOBUTTON | NOT WS_VISIBLE,148,24,37,10 - CONTROL "4 ",IDC_RADIO_DWORD,"Button",BS_AUTORADIOBUTTON | + CONTROL "4 байт",IDC_RADIO_DWORD,"Button",BS_AUTORADIOBUTTON | NOT WS_VISIBLE,188,24,37,10 - CONTROL "2 ",IDC_RADIO_WORD,"Button",BS_AUTORADIOBUTTON | NOT + CONTROL "2 байт",IDC_RADIO_WORD,"Button",BS_AUTORADIOBUTTON | NOT WS_VISIBLE,232,24,33,10 - CONTROL "1 ",IDC_RADIO_BYTE,"Button",BS_AUTORADIOBUTTON | NOT + CONTROL "1 байт",IDC_RADIO_BYTE,"Button",BS_AUTORADIOBUTTON | NOT WS_VISIBLE,272,24,30,10 - CONTROL "",IDC_RADIO_DEG,"Button",BS_AUTORADIOBUTTON,148,24, + CONTROL "Градусы",IDC_RADIO_DEG,"Button",BS_AUTORADIOBUTTON,148,24, 42,10 - CONTROL "",IDC_RADIO_RAD,"Button",BS_AUTORADIOBUTTON,192, + CONTROL "Радианы",IDC_RADIO_RAD,"Button",BS_AUTORADIOBUTTON,192, 24,42,10 - CONTROL "",IDC_RADIO_GRAD,"Button",BS_AUTORADIOBUTTON, + CONTROL "Грады",IDC_RADIO_GRAD,"Button",BS_AUTORADIOBUTTON, 236,24,44,10 PUSHBUTTON "C",IDC_BUTTON_CANC,272,40,40,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP @@ -160,7 +160,7 @@ END IDD_DIALOG_STANDARD DIALOGEX 0, 0, 172, 127 STYLE DS_SHELLFONT | WS_MINIMIZEBOX | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " ReactOS" +CAPTION "Калькулятор ReactOS" MENU IDR_MENU_STANDARD FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN @@ -227,20 +227,20 @@ END IDD_DIALOG_CONVERSION DIALOGEX 0, 0, 320, 130 STYLE DS_SHELLFONT | WS_MINIMIZEBOX | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " ReactOS" +CAPTION "Калькулятор ReactOS" MENU IDR_MENU_STANDARD FONT 8, "MS Shell Dlg" BEGIN - PUSHBUTTON "",IDC_BUTTON_CONVERT,35,105,76,17 + PUSHBUTTON "Конвертировать",IDC_BUTTON_CONVERT,35,105,76,17 COMBOBOX IDC_COMBO_CATEGORY,4,31,140,168,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP | CBS_SORT - LTEXT ":",IDC_STATIC,4,20,56,8 + LTEXT "Категория:",IDC_STATIC,4,20,56,8 COMBOBOX IDC_COMBO_FROM,4,60,140,168,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP | CBS_SORT - LTEXT " :",IDC_STATIC,4,49,75,8 + LTEXT "Конвертировать из:",IDC_STATIC,4,49,75,8 COMBOBOX IDC_COMBO_TO,4,87,140,168,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP | CBS_SORT - LTEXT " :",IDC_STATIC,4,76,75,8 + LTEXT "Конвертировать в:",IDC_STATIC,4,76,75,8 CONTROL "C",IDC_BUTTON_CANC,"Button",BS_OWNERDRAW | BS_CENTER | BS_VCENTER | BS_NOTIFY | WS_TABSTOP,276,24,40,17 CONTROL "CE",IDC_BUTTON_CE,"Button",BS_OWNERDRAW | BS_CENTER | @@ -305,16 +305,16 @@ END IDD_DIALOG_ABOUT DIALOGEX DISCARDABLE 0, 0, 264, 169 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "О программе" FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "OK",IDOK,105,148,52,16 CONTROL IDB_BITMAP_ROS,IDC_STATIC,"Static",SS_BITMAP | SS_CENTERIMAGE | SS_REALSIZEIMAGE | WS_BORDER,4,4,104,48 - LTEXT " ReactOS",IDC_STATIC,120,12,132,8, + LTEXT "Калькулятор ReactOS",IDC_STATIC,120,12,132,8, SS_CENTERIMAGE - LTEXT " ",IDC_TEXT_VERSION,120,20,132,8,SS_CENTERIMAGE - LTEXT ": ",IDC_STATIC,120,32,132,8, + LTEXT "Версия ",IDC_TEXT_VERSION,120,20,132,8,SS_CENTERIMAGE + LTEXT "Автор: Карло Брамини",IDC_STATIC,120,32,132,8, SS_CENTERIMAGE GROUPBOX "",IDC_STATIC,112,0,148,52 GROUPBOX "",IDC_STATIC,4,56,256,88 @@ -324,7 +324,7 @@ END IDD_DIALOG_STAT DIALOGEX DISCARDABLE 0, 0, 163, 85 STYLE DS_SHELLFONT | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "" +CAPTION "Статистика" FONT 8, "MS Shell Dlg" BEGIN LISTBOX IDC_LIST_STAT,4,4,156,40,LBS_NOINTEGRALHEIGHT | @@ -341,89 +341,89 @@ END IDR_MENU_SCIENTIFIC_1 MENU DISCARDABLE BEGIN - POPUP "" + POPUP "Правка" BEGIN - MENUITEM "\tCTRL-C", IDM_EDIT_COPY - MENUITEM "\tCTRL-V", IDM_EDIT_PASTE + MENUITEM "Копировать\tCTRL-C", IDM_EDIT_COPY + MENUITEM "Вставить\tCTRL-V", IDM_EDIT_PASTE END - POPUP "" + POPUP "Вид" BEGIN - MENUITEM "", IDM_VIEW_STANDARD, CHECKED - MENUITEM "", IDM_VIEW_SCIENTIFIC, CHECKED - MENUITEM "", IDM_VIEW_CONVERSION + MENUITEM "Обычный", IDM_VIEW_STANDARD, CHECKED + MENUITEM "Научный", IDM_VIEW_SCIENTIFIC, CHECKED + MENUITEM "Преобразование", IDM_VIEW_CONVERSION MENUITEM SEPARATOR - MENUITEM "\tF5", IDM_VIEW_HEX, CHECKED - MENUITEM "\tF6", IDM_VIEW_DEC, CHECKED - MENUITEM "\tF7", IDM_VIEW_OCT, CHECKED - MENUITEM "\tF8", IDM_VIEW_BIN, CHECKED + MENUITEM "Шестнадцатеричный\tF5", IDM_VIEW_HEX, CHECKED + MENUITEM "Десятичный\tF6", IDM_VIEW_DEC, CHECKED + MENUITEM "Восьмеричный\tF7", IDM_VIEW_OCT, CHECKED + MENUITEM "Двоичный\tF8", IDM_VIEW_BIN, CHECKED MENUITEM SEPARATOR - MENUITEM "\tF2", IDM_VIEW_DEG, CHECKED - MENUITEM "\tF3", IDM_VIEW_RAD, CHECKED - MENUITEM "\tF4", IDM_VIEW_GRAD, CHECKED + MENUITEM "Градусы\tF2", IDM_VIEW_DEG, CHECKED + MENUITEM "Радианы\tF3", IDM_VIEW_RAD, CHECKED + MENUITEM "Грады\tF4", IDM_VIEW_GRAD, CHECKED MENUITEM SEPARATOR - MENUITEM " ", IDM_VIEW_GROUP, CHECKED + MENUITEM "Количество цифр в группе", IDM_VIEW_GROUP, CHECKED END - POPUP "" + POPUP "Справка" BEGIN - MENUITEM " ", IDM_HELP_HELP + MENUITEM "Вызов справки", IDM_HELP_HELP MENUITEM SEPARATOR - MENUITEM " ", IDM_HELP_ABOUT + MENUITEM "О программе", IDM_HELP_ABOUT END END IDR_MENU_SCIENTIFIC_2 MENU DISCARDABLE BEGIN - POPUP "" + POPUP "Правка" BEGIN - MENUITEM "\tCTRL-C", IDM_EDIT_COPY - MENUITEM "\tCTRL-V", IDM_EDIT_PASTE + MENUITEM "Копировать\tCTRL-C", IDM_EDIT_COPY + MENUITEM "Вставить\tCTRL-V", IDM_EDIT_PASTE END - POPUP "" + POPUP "Вид" BEGIN - MENUITEM "", IDM_VIEW_STANDARD, CHECKED - MENUITEM "", IDM_VIEW_SCIENTIFIC, CHECKED - MENUITEM "", IDM_VIEW_CONVERSION + MENUITEM "Обычный", IDM_VIEW_STANDARD, CHECKED + MENUITEM "Научный", IDM_VIEW_SCIENTIFIC, CHECKED + MENUITEM "Преобразование", IDM_VIEW_CONVERSION MENUITEM SEPARATOR - MENUITEM "\tF5", IDM_VIEW_HEX, CHECKED - MENUITEM "\tF6", IDM_VIEW_DEC, CHECKED - MENUITEM "\tF7", IDM_VIEW_OCT, CHECKED - MENUITEM "\tF8", IDM_VIEW_BIN, CHECKED + MENUITEM "Шестнадцатеричный\tF5", IDM_VIEW_HEX, CHECKED + MENUITEM "Десятичный\tF6", IDM_VIEW_DEC, CHECKED + MENUITEM "Восьмеричный\tF7", IDM_VIEW_OCT, CHECKED + MENUITEM "Двоичный\tF8", IDM_VIEW_BIN, CHECKED MENUITEM SEPARATOR - MENUITEM "8 \tF12", IDM_VIEW_QWORD, CHECKED - MENUITEM "4 \tF2", IDM_VIEW_DWORD, CHECKED - MENUITEM "2 \tF3", IDM_VIEW_WORD, CHECKED - MENUITEM "1 \tF4", IDM_VIEW_BYTE, CHECKED + MENUITEM "8 байт\tF12", IDM_VIEW_QWORD, CHECKED + MENUITEM "4 байт\tF2", IDM_VIEW_DWORD, CHECKED + MENUITEM "2 байт\tF3", IDM_VIEW_WORD, CHECKED + MENUITEM "1 байт\tF4", IDM_VIEW_BYTE, CHECKED MENUITEM SEPARATOR - MENUITEM " ", IDM_VIEW_GROUP, CHECKED + MENUITEM "Количество цифр в группе", IDM_VIEW_GROUP, CHECKED END - POPUP "" + POPUP "Справка" BEGIN - MENUITEM " ", IDM_HELP_HELP + MENUITEM "Вызов справки", IDM_HELP_HELP MENUITEM SEPARATOR - MENUITEM " ", IDM_HELP_ABOUT + MENUITEM "О программе", IDM_HELP_ABOUT END END IDR_MENU_STANDARD MENU DISCARDABLE BEGIN - POPUP "" + POPUP "Правка" BEGIN - MENUITEM "\tCTRL-C", IDM_EDIT_COPY - MENUITEM "\tCTRL-V", IDM_EDIT_PASTE + MENUITEM "Копировать\tCTRL-C", IDM_EDIT_COPY + MENUITEM "Вставить\tCTRL-V", IDM_EDIT_PASTE END - POPUP "" + POPUP "Вид" BEGIN - MENUITEM "", IDM_VIEW_STANDARD, CHECKED - MENUITEM "", IDM_VIEW_SCIENTIFIC, CHECKED - MENUITEM "", IDM_VIEW_CONVERSION + MENUITEM "Обычный", IDM_VIEW_STANDARD, CHECKED + MENUITEM "Научный", IDM_VIEW_SCIENTIFIC, CHECKED + MENUITEM "Преобразование", IDM_VIEW_CONVERSION MENUITEM SEPARATOR - MENUITEM " ", IDM_VIEW_GROUP, CHECKED + MENUITEM "Количество цифр в группе", IDM_VIEW_GROUP, CHECKED END - POPUP "" + POPUP "Справка" BEGIN - MENUITEM " ", IDM_HELP_HELP + MENUITEM "Вызов справки", IDM_HELP_HELP MENUITEM SEPARATOR - MENUITEM " ", IDM_HELP_ABOUT + MENUITEM "О программе", IDM_HELP_ABOUT END END @@ -431,302 +431,302 @@ END STRINGTABLE DISCARDABLE BEGIN - IDS_STRING_LICENSE " ReactOS - , GNU GPL.\r\n\r\n GNU GPL :\r\nhttp://www.gnu.org/licenses/gpl.html\r\n\r\n c GNU GPL :\r\nhttp://www.gnu.org/licenses/translations.html" - IDS_MATH_ERROR "" - IDS_QUICKHELP " " + IDS_STRING_LICENSE "Калькулятор ReactOS - свободное программное обеспечение, распространяющееся по лицензии GNU GPL.\r\n\r\nВы можете получить копию лицензии GNU GPL здесь:\r\nhttp://www.gnu.org/licenses/gpl.html\r\n\r\nОзнакомиться c переводом лицензии GNU GPL можно здесь:\r\nhttp://www.gnu.org/licenses/translations.html" + IDS_MATH_ERROR "Ошибка" + IDS_QUICKHELP "Быстрая справка" END // types of conversion STRINGTABLE DISCARDABLE BEGIN - IDS_CONV_ANGLE "" - IDS_CONV_AREA "" - IDS_CONV_CONSUMPTION " ()" - IDS_CONV_CURRENCY "" - IDS_CONV_ENERGY "" - IDS_CONV_LENGTH "" - IDS_CONV_POWER "" - IDS_CONV_PRESSURE "" - IDS_CONV_TEMPERATURE "" - IDS_CONV_TIME "" - IDS_CONV_VELOCITY "" - IDS_CONV_VOLUME "" - IDS_CONV_WEIGHT "" + IDS_CONV_ANGLE "Угол" + IDS_CONV_AREA "Площадь" + IDS_CONV_CONSUMPTION "Расход топлива (двигатели)" + IDS_CONV_CURRENCY "Валюта" + IDS_CONV_ENERGY "Энергия" + IDS_CONV_LENGTH "Длина" + IDS_CONV_POWER "Мощность" + IDS_CONV_PRESSURE "Давление" + IDS_CONV_TEMPERATURE "Температура" + IDS_CONV_TIME "Время" + IDS_CONV_VELOCITY "Скорость" + IDS_CONV_VOLUME "Объем" + IDS_CONV_WEIGHT "Вес" END // TYPES OF ANGLES STRINGTABLE DISCARDABLE BEGIN - IDS_ANGLE_DEGREES "" - IDS_ANGLE_GRADIANS "" - IDS_ANGLE_RADIANS "" + IDS_ANGLE_DEGREES "градус" + IDS_ANGLE_GRADIANS "град" + IDS_ANGLE_RADIANS "радиан" END // TYPES OF AREAS STRINGTABLE DISCARDABLE BEGIN - IDS_AREA_ACRES "" - IDS_AREA_ACRES_BRAZIL " ()" - IDS_AREA_ACRES_FRANCE " ()" - IDS_AREA_ACRES_SCOTS " ()" - IDS_AREA_ACRES_US " ()" - IDS_AREA_ARES "" - IDS_AREA_CHOU "" - IDS_AREA_DANBO "" - IDS_AREA_HECTARES "" - IDS_AREA_JEONGBO "" - IDS_AREA_MORGEN_HUNGARY " ()" - IDS_AREA_MU "" - IDS_AREA_PING "" - IDS_AREA_PYEONG "" - IDS_AREA_PYEONGBANGJA "" - IDS_AREA_RAI "" - IDS_AREA_SE " " - IDS_AREA_SQUARE_CENTIMETERS " " - IDS_AREA_SQUARE_CHR " " - IDS_AREA_SQUARE_FATHOMS " " - IDS_AREA_SQUARE_FATHOMS_HUNGARY " ()" - IDS_AREA_SQUARE_FEET " " - IDS_AREA_SQUARE_INCHES " " - IDS_AREA_SQUARE_KILOMETERS " " - IDS_AREA_SQUARE_LAR " " - IDS_AREA_SQUARE_METER " " - IDS_AREA_SQUARE_MILES " " - IDS_AREA_SQUARE_MILLIMETERS " " - IDS_AREA_SQUARE_SHAKU " " - IDS_AREA_SQUARE_TSUEN " " - IDS_AREA_SQUARE_VA " " - IDS_AREA_SQUARE_YARD " " - IDS_AREA_TAN "" - IDS_AREA_TSUBO "" + IDS_AREA_ACRES "акр" + IDS_AREA_ACRES_BRAZIL "акр (бразильский)" + IDS_AREA_ACRES_FRANCE "акр (французский)" + IDS_AREA_ACRES_SCOTS "акр (шотландский)" + IDS_AREA_ACRES_US "акр (США)" + IDS_AREA_ARES "ар" + IDS_AREA_CHOU "чоу" + IDS_AREA_DANBO "дамбо" + IDS_AREA_HECTARES "гектар" + IDS_AREA_JEONGBO "дженгбо" + IDS_AREA_MORGEN_HUNGARY "морген (венгерский)" + IDS_AREA_MU "му" + IDS_AREA_PING "пин" + IDS_AREA_PYEONG "пён" + IDS_AREA_PYEONGBANGJA "пёнбанджа" + IDS_AREA_RAI "рай" + IDS_AREA_SE "хэйхо сяку" + IDS_AREA_SQUARE_CENTIMETERS "квадратный сантиметр" + IDS_AREA_SQUARE_CHR "квадратный ча" + IDS_AREA_SQUARE_FATHOMS "квадратный фатом" + IDS_AREA_SQUARE_FATHOMS_HUNGARY "квадратный фатом (венгерский)" + IDS_AREA_SQUARE_FEET "квадратный фут" + IDS_AREA_SQUARE_INCHES "квадратный дюйм" + IDS_AREA_SQUARE_KILOMETERS "квадратный километр" + IDS_AREA_SQUARE_LAR "квадратный лар" + IDS_AREA_SQUARE_METER "квадратный метр" + IDS_AREA_SQUARE_MILES "квадратная миля" + IDS_AREA_SQUARE_MILLIMETERS "квадратный миллиметр" + IDS_AREA_SQUARE_SHAKU "квадратный шаку" + IDS_AREA_SQUARE_TSUEN "квадратный тсуэн" + IDS_AREA_SQUARE_VA "квадратная ва" + IDS_AREA_SQUARE_YARD "квадратный ярд" + IDS_AREA_TAN "тан" + IDS_AREA_TSUBO "цубо" END // TYPES OF COMSUMPTIONS STRINGTABLE DISCARDABLE BEGIN - IDS_CONSUMPTION_KM_PER_L "/" - IDS_CONSUMPTION_L_PER_100_KM "/100 " - IDS_CONSUMPTION_MILES_GALLON_UK "/ ()" - IDS_CONSUMPTION_MILES_GALLON_US "/ ()" + IDS_CONSUMPTION_KM_PER_L "километр/литр" + IDS_CONSUMPTION_L_PER_100_KM "литров/100 километров" + IDS_CONSUMPTION_MILES_GALLON_UK "миль/галлон (британский)" + IDS_CONSUMPTION_MILES_GALLON_US "миль/галлон (США)" END // TYPES OF CURRENCIES STRINGTABLE DISCARDABLE BEGIN - IDS_CURRENCY_AUSTRIAN_SCHILLING " " - IDS_CURRENCY_BELGIAN_FRANC " " - IDS_CURRENCY_CYPRIOT_POUND " " - IDS_CURRENCY_CZECH_KORUNA " " - IDS_CURRENCY_DEUTSCHE_MARK " " - IDS_CURRENCY_DUTCH_GUILDER " " - IDS_CURRENCY_EURO "" - IDS_CURRENCY_FINNISH_MARKKA " " - IDS_CURRENCY_FRENCH_FRANC " " - IDS_CURRENCY_GREEK_DRACHMA " " - IDS_CURRENCY_IRISH_POUND " " - IDS_CURRENCY_ITALIAN_LIRA " " - IDS_CURRENCY_LUXEMBOURG_FRANC " " - IDS_CURRENCY_MALTESE_LIRA " " - IDS_CURRENCY_PORTOGUESE_ESCUDO " " - IDS_CURRENCY_SLOVAK_KORUNA " " - IDS_CURRENCY_SLOVENIAN_TOLAR " " - IDS_CURRENCY_SPANISH_PESETA " " + IDS_CURRENCY_AUSTRIAN_SCHILLING "Австралийский шиллинг" + IDS_CURRENCY_BELGIAN_FRANC "Бельгийский франк" + IDS_CURRENCY_CYPRIOT_POUND "Киприотский фунт" + IDS_CURRENCY_CZECH_KORUNA "Чешская крона" + IDS_CURRENCY_DEUTSCHE_MARK "Немецкая марка" + IDS_CURRENCY_DUTCH_GUILDER "Голландский гульден" + IDS_CURRENCY_EURO "Евро" + IDS_CURRENCY_FINNISH_MARKKA "Финская марка" + IDS_CURRENCY_FRENCH_FRANC "Французский франк" + IDS_CURRENCY_GREEK_DRACHMA "Греческая драхма" + IDS_CURRENCY_IRISH_POUND "Ирландский фунт" + IDS_CURRENCY_ITALIAN_LIRA "Итальянская лира" + IDS_CURRENCY_LUXEMBOURG_FRANC "Люксембургский франк" + IDS_CURRENCY_MALTESE_LIRA "Мальтийская лира" + IDS_CURRENCY_PORTOGUESE_ESCUDO "Португальское эскудо" + IDS_CURRENCY_SLOVAK_KORUNA "Словацкая крона" + IDS_CURRENCY_SLOVENIAN_TOLAR "Словенский толар" + IDS_CURRENCY_SPANISH_PESETA "Испанская песета" END // TYPES OF ENERGIES STRINGTABLE DISCARDABLE BEGIN - IDS_ENERGY_15_C_CALORIES " " - IDS_ENERGY_BTUS " " - IDS_ENERGY_ERGS "" - IDS_ENERGY_EVS "" - IDS_ENERGY_FOOT_POUNDS "" - IDS_ENERGY_IT_CALORIES " " - IDS_ENERGY_IT_KILOCALORIES " " - IDS_ENERGY_JOULES "" - IDS_ENERGY_KILOJOULES "" - IDS_ENERGY_KILOWATT_HOURS "-" - IDS_ENERGY_NUTRITION_CALORIES " " - IDS_ENERGY_TH_CALORIES " " + IDS_ENERGY_15_C_CALORIES "калория пятнадцатиградусная" + IDS_ENERGY_BTUS "британская тепловая единица" + IDS_ENERGY_ERGS "эрг" + IDS_ENERGY_EVS "электронвольт" + IDS_ENERGY_FOOT_POUNDS "футофунт" + IDS_ENERGY_IT_CALORIES "калория международная" + IDS_ENERGY_IT_KILOCALORIES "килокалория международная" + IDS_ENERGY_JOULES "джоуль" + IDS_ENERGY_KILOJOULES "килоджоуль" + IDS_ENERGY_KILOWATT_HOURS "киловатт-час" + IDS_ENERGY_NUTRITION_CALORIES "калория пищевая" + IDS_ENERGY_TH_CALORIES "калория термохимическая" END // TYPES OF LENGTHS STRINGTABLE DISCARDABLE BEGIN - IDS_LENGTH_ANGSTROMS "" - IDS_LENGTH_ASTRONOMICAL_UNITS " " - IDS_LENGTH_BARLEYCORNS "" - IDS_LENGTH_CENTIMETERS "" - IDS_LENGTH_CHAINS_UK " ()" - IDS_LENGTH_CHI "" - IDS_LENGTH_CHOU "" - IDS_LENGTH_CHR "" - IDS_LENGTH_CUN "" - IDS_LENGTH_FATHOMS "" - IDS_LENGTH_FATHOMS_HUNGARY " ()" - IDS_LENGTH_FEET "" - IDS_LENGTH_FURLONGS "" - IDS_LENGTH_GAN "" - IDS_LENGTH_HANDS "" - IDS_LENGTH_HUNH "" - IDS_LENGTH_INCHES "" - IDS_LENGTH_JA "" - IDS_LENGTH_JEONG "" - IDS_LENGTH_KABIET "" - IDS_LENGTH_KEN "" - IDS_LENGTH_KEUB "" - IDS_LENGTH_KILOMETERS "" - IDS_LENGTH_LAR "" - IDS_LENGTH_LIGHT_YEARS " " - IDS_LENGTH_LINKS_UK " ()" - IDS_LENGTH_METERS "" - IDS_LENGTH_MICRONS "" - IDS_LENGTH_MILES "" - IDS_LENGTH_MILLIMETERS "" - IDS_LENGTH_NAUTICAL_MILES " " - IDS_LENGTH_NIEU "" - IDS_LENGTH_PARSECS "" - IDS_LENGTH_PICAS "" - IDS_LENGTH_RI_JAPAN " ()" - IDS_LENGTH_RI_KOREA " ()" - IDS_LENGTH_RODS "" - IDS_LENGTH_SAWK "" - IDS_LENGTH_SEN "" - IDS_LENGTH_SHAKU "" - IDS_LENGTH_SPAN "" - IDS_LENGTH_SUN "" - IDS_LENGTH_TSUEN "" - IDS_LENGTH_VA "" - IDS_LENGTH_YARDS "" - IDS_LENGTH_YOTE "" - IDS_LENGTH_ZHANG "" + IDS_LENGTH_ANGSTROMS "ангстрем" + IDS_LENGTH_ASTRONOMICAL_UNITS "астрономическая еденица" + IDS_LENGTH_BARLEYCORNS "барлейкорн" + IDS_LENGTH_CENTIMETERS "сантиметр" + IDS_LENGTH_CHAINS_UK "чейн (британский)" + IDS_LENGTH_CHI "чи" + IDS_LENGTH_CHOU "чоу" + IDS_LENGTH_CHR "ча" + IDS_LENGTH_CUN "цунь" + IDS_LENGTH_FATHOMS "фатом" + IDS_LENGTH_FATHOMS_HUNGARY "фатом (венгерский)" + IDS_LENGTH_FEET "фут" + IDS_LENGTH_FURLONGS "фарлонг" + IDS_LENGTH_GAN "гань" + IDS_LENGTH_HANDS "ладонь" + IDS_LENGTH_HUNH "ханх" + IDS_LENGTH_INCHES "дюйм" + IDS_LENGTH_JA "я" + IDS_LENGTH_JEONG "джеонг" + IDS_LENGTH_KABIET "кабьет" + IDS_LENGTH_KEN "кен" + IDS_LENGTH_KEUB "кеуб" + IDS_LENGTH_KILOMETERS "километр" + IDS_LENGTH_LAR "лар" + IDS_LENGTH_LIGHT_YEARS "световой год" + IDS_LENGTH_LINKS_UK "линк (британский)" + IDS_LENGTH_METERS "метр" + IDS_LENGTH_MICRONS "микрометр" + IDS_LENGTH_MILES "миля" + IDS_LENGTH_MILLIMETERS "миллиметр" + IDS_LENGTH_NAUTICAL_MILES "морская миля" + IDS_LENGTH_NIEU "ньё" + IDS_LENGTH_PARSECS "парсек" + IDS_LENGTH_PICAS "пика" + IDS_LENGTH_RI_JAPAN "ри (японская)" + IDS_LENGTH_RI_KOREA "ри (корейская)" + IDS_LENGTH_RODS "род" + IDS_LENGTH_SAWK "соук" + IDS_LENGTH_SEN "сен" + IDS_LENGTH_SHAKU "шаку" + IDS_LENGTH_SPAN "спан" + IDS_LENGTH_SUN "сан" + IDS_LENGTH_TSUEN "тсуэн" + IDS_LENGTH_VA "ва" + IDS_LENGTH_YARDS "ярд" + IDS_LENGTH_YOTE "йоут" + IDS_LENGTH_ZHANG "чжан" END // TYPES OF POWERS STRINGTABLE DISCARDABLE BEGIN - IDS_POWER_BTUS_PER_MINUTE " " - IDS_POWER_FPS_PER_MINUTE " " - IDS_POWER_HORSEPOWER " " - IDS_POWER_KILOWATTS "" - IDS_POWER_MEGAWATTS "" - IDS_POWER_WATTS "" + IDS_POWER_BTUS_PER_MINUTE "британская тепловая единица в минуту" + IDS_POWER_FPS_PER_MINUTE "футофунт в минуту" + IDS_POWER_HORSEPOWER "лошадиная сила" + IDS_POWER_KILOWATTS "киловатт" + IDS_POWER_MEGAWATTS "мегаватт" + IDS_POWER_WATTS "ватт" END // TYPE OF PRESSURES STRINGTABLE DISCARDABLE BEGIN - IDS_PRESSURE_ATMOSPHERES " ()" - IDS_PRESSURE_BARS "" - IDS_PRESSURE_HECTOPASCALS "" - IDS_PRESSURE_KILOPASCALS "" - IDS_PRESSURE_MM_OF_MERCURY " " - IDS_PRESSURE_PASCALS "" - IDS_PRESSURE_PSI " " + IDS_PRESSURE_ATMOSPHERES "атмосфера (физическая)" + IDS_PRESSURE_BARS "бар" + IDS_PRESSURE_HECTOPASCALS "гектопаскаль" + IDS_PRESSURE_KILOPASCALS "килопаскаль" + IDS_PRESSURE_MM_OF_MERCURY "миллиметр ртутного столба" + IDS_PRESSURE_PASCALS "паскаль" + IDS_PRESSURE_PSI "фунт на квадратный дюйм" END // TYPES OF TEMPERATURES STRINGTABLE DISCARDABLE BEGIN - IDS_TEMPERATURE_CELSIUS " ( )" - IDS_TEMPERATURE_FAHRENHEIT " ( )" - IDS_TEMPERATURE_KELVIN " ( )" - IDS_TEMPERATURE_RANKINE " ( Rankine)" + IDS_TEMPERATURE_CELSIUS "градус (по шкале Цельсия)" + IDS_TEMPERATURE_FAHRENHEIT "градус (по шкале Фаренгейта)" + IDS_TEMPERATURE_KELVIN "градус (по шкале Кельвина)" + IDS_TEMPERATURE_RANKINE "градус (по шкале Rankine)" END // TYPES OF TIME STRINGTABLE DISCARDABLE BEGIN - IDS_TIME_DAYS "" - IDS_TIME_HOURS "" + IDS_TIME_DAYS "день" + IDS_TIME_HOURS "час" IDS_TIME_NANOSECONDS "Nanoseconds" - IDS_TIME_MICROSECONDS "" - IDS_TIME_MILLISECONDS "" - IDS_TIME_MINUTES "" - IDS_TIME_SECONDS "" - IDS_TIME_WEEKS "" - IDS_TIME_YEARS "" + IDS_TIME_MICROSECONDS "микросекунда" + IDS_TIME_MILLISECONDS "миллисекунда" + IDS_TIME_MINUTES "минута" + IDS_TIME_SECONDS "секунда" + IDS_TIME_WEEKS "неделя" + IDS_TIME_YEARS "год" END // TYPES OF VELOCITIES STRINGTABLE DISCARDABLE BEGIN - IDS_VELOCITY_CMS_SECOND " " - IDS_VELOCITY_FEET_HOUR " " - IDS_VELOCITY_FEET_SECOND " " - IDS_VELOCITY_KILOMETERS_HOUR " " - IDS_VELOCITY_KNOTS "" - IDS_VELOCITY_MACH "" - IDS_VELOCITY_METERS_SECOND " " - IDS_VELOCITY_MILES_HOUR " " + IDS_VELOCITY_CMS_SECOND "сантиметр в час" + IDS_VELOCITY_FEET_HOUR "фут в час" + IDS_VELOCITY_FEET_SECOND "фут в секунду" + IDS_VELOCITY_KILOMETERS_HOUR "километр в час" + IDS_VELOCITY_KNOTS "узел" + IDS_VELOCITY_MACH "мах" + IDS_VELOCITY_METERS_SECOND "метр в секунду" + IDS_VELOCITY_MILES_HOUR "миля в час" END // TYPES OF VOLUMES STRINGTABLE DISCARDABLE BEGIN - IDS_VOLUME_BARRELS_UK " ()" - IDS_VOLUME_BARRELS_OIL " " - IDS_VOLUME_BUN "" - IDS_VOLUME_BUSHELS_UK " ()" - IDS_VOLUME_BUSHELS_US " ()" - IDS_VOLUME_CUBIC_CENTIMETERS " " - IDS_VOLUME_CUBIC_FEET " " - IDS_VOLUME_CUBIC_INCHES " " - IDS_VOLUME_CUBIC_METERS " " - IDS_VOLUME_CUBIC_YARDS " " - IDS_VOLUME_DOE "" - IDS_VOLUME_FLUID_OUNCES_UK " ()" - IDS_VOLUME_FLUID_OUNCES_US " ()" - IDS_VOLUME_GALLONS_UK " ()" - IDS_VOLUME_GALLONS_DRY_US " ( , )" - IDS_VOLUME_GALLONS_LIQUID_US " ( , )" - IDS_VOLUME_GOU "" - IDS_VOLUME_HOP "" - IDS_VOLUME_ICCE "" - IDS_VOLUME_KWIAN "" - IDS_VOLUME_LITERS "" - IDS_VOLUME_MAL "" - IDS_VOLUME_MILLILITERS "" - IDS_VOLUME_PINTS_UK " ()" - IDS_VOLUME_PINTS_DRY_US " ( , )" - IDS_VOLUME_PINTS_LIQUID_US " ( , )" - IDS_VOLUME_QUARTS_UK " ()" - IDS_VOLUME_QUARTS_DRY_US " ( , )" - IDS_VOLUME_QUARTS_LIQUID_US " ( , )" - IDS_VOLUME_SEKI "" - IDS_VOLUME_SYOU "" - IDS_VOLUME_TANANLOUNG "" - IDS_VOLUME_TANG "" - IDS_VOLUME_TO "" + IDS_VOLUME_BARRELS_UK "баррель (британский)" + IDS_VOLUME_BARRELS_OIL "баррель нефтяной" + IDS_VOLUME_BUN "бун" + IDS_VOLUME_BUSHELS_UK "бушель (британский)" + IDS_VOLUME_BUSHELS_US "бушель (США)" + IDS_VOLUME_CUBIC_CENTIMETERS "кубический сантиметр" + IDS_VOLUME_CUBIC_FEET "кубический фут" + IDS_VOLUME_CUBIC_INCHES "кубический дюйм" + IDS_VOLUME_CUBIC_METERS "кубический метр" + IDS_VOLUME_CUBIC_YARDS "кубический ярд" + IDS_VOLUME_DOE "то" + IDS_VOLUME_FLUID_OUNCES_UK "жидкая унция (британская)" + IDS_VOLUME_FLUID_OUNCES_US "жидкая унция (США)" + IDS_VOLUME_GALLONS_UK "галлон (британский)" + IDS_VOLUME_GALLONS_DRY_US "галлон (для сухих веществ, США)" + IDS_VOLUME_GALLONS_LIQUID_US "галлон (для жидкостей, США)" + IDS_VOLUME_GOU "гоу" + IDS_VOLUME_HOP "хоп" + IDS_VOLUME_ICCE "иккэ" + IDS_VOLUME_KWIAN "квиан" + IDS_VOLUME_LITERS "литр" + IDS_VOLUME_MAL "маль" + IDS_VOLUME_MILLILITERS "миллилитр" + IDS_VOLUME_PINTS_UK "пинта (британская)" + IDS_VOLUME_PINTS_DRY_US "пинта (для сухих веществ, США)" + IDS_VOLUME_PINTS_LIQUID_US "пинта (для жидкостей, США)" + IDS_VOLUME_QUARTS_UK "кварта (британская)" + IDS_VOLUME_QUARTS_DRY_US "кварта (для сухих веществ, США)" + IDS_VOLUME_QUARTS_LIQUID_US "кварта (для жидкостей, США)" + IDS_VOLUME_SEKI "сэки" + IDS_VOLUME_SYOU "сё" + IDS_VOLUME_TANANLOUNG "тананлунг" + IDS_VOLUME_TANG "тан" + IDS_VOLUME_TO "ту" END // TYPES OF WEIGHTS STRINGTABLE DISCARDABLE BEGIN - IDS_WEIGHT_BAHT "" - IDS_WEIGHT_CARATS "" - IDS_WEIGHT_CHUNG "" - IDS_WEIGHT_DON "" - IDS_WEIGHT_GEUN "" - IDS_WEIGHT_GRAMS "" - IDS_WEIGHT_GWAN "" - IDS_WEIGHT_HARB "" - IDS_WEIGHT_JIN_CHINA " ()" - IDS_WEIGHT_JIN_TAIWAN " ()" - IDS_WEIGHT_KAN "" - IDS_WEIGHT_KILOGRAMS "" - IDS_WEIGHT_KIN "" - IDS_WEIGHT_LIANG_CHINA " ()" - IDS_WEIGHT_LIANG_TAIWAN " ()" - IDS_WEIGHT_MONME "" - IDS_WEIGHT_OUNCES_AVOIRDUPOIS " ()" - IDS_WEIGHT_OUNCES_TROY " ()" - IDS_WEIGHT_POUNDS "" - IDS_WEIGHT_QUINTAL_METRIC " ()" - IDS_WEIGHT_SALOUNG "" - IDS_WEIGHT_STONES "" - IDS_WEIGHT_TAMLUNG "" - IDS_WEIGHT_TONNES "" - IDS_WEIGHT_TONS_UK " ()" - IDS_WEIGHT_TONS_US " ()" + IDS_WEIGHT_BAHT "бат" + IDS_WEIGHT_CARATS "карат" + IDS_WEIGHT_CHUNG "чанг" + IDS_WEIGHT_DON "дон" + IDS_WEIGHT_GEUN "джин" + IDS_WEIGHT_GRAMS "грамм" + IDS_WEIGHT_GWAN "кван" + IDS_WEIGHT_HARB "хап" + IDS_WEIGHT_JIN_CHINA "джин (китайский)" + IDS_WEIGHT_JIN_TAIWAN "джин (тайвань)" + IDS_WEIGHT_KAN "канн" + IDS_WEIGHT_KILOGRAMS "килограмм" + IDS_WEIGHT_KIN "кын" + IDS_WEIGHT_LIANG_CHINA "лианг (китайский)" + IDS_WEIGHT_LIANG_TAIWAN "лианг (тайвань)" + IDS_WEIGHT_MONME "монм" + IDS_WEIGHT_OUNCES_AVOIRDUPOIS "унция (торговая)" + IDS_WEIGHT_OUNCES_TROY "унция (тройская)" + IDS_WEIGHT_POUNDS "фунт" + IDS_WEIGHT_QUINTAL_METRIC "квинтал (метрический)" + IDS_WEIGHT_SALOUNG "салунг" + IDS_WEIGHT_STONES "стоун" + IDS_WEIGHT_TAMLUNG "тамлунг" + IDS_WEIGHT_TONNES "тонна" + IDS_WEIGHT_TONS_UK "тонна (британская)" + IDS_WEIGHT_TONS_US "тонна (США)" END diff --git a/base/applications/calc/lang/sk-SK.rc b/base/applications/calc/lang/sk-SK.rc index 41f9ca78fe2..644cb1875fa 100644 --- a/base/applications/calc/lang/sk-SK.rc +++ b/base/applications/calc/lang/sk-SK.rc @@ -1,9 +1,9 @@ -/* TRANSLATOR : Mrio Kamr /Mario Kacmar/ aka Kario (kario@szm.sk) +/* TRANSLATOR : Mário Kačmár /Mario Kacmar/ aka Kario (kario@szm.sk) * DATE OF TR.: 30-01-2008 * LAST CHANGE: 17-09-2010 * --------------------------------------- * TODO: - * pridanie naviganch znaiek "&" ? + * pridanie navigačných značiek "&" ? */ LANGUAGE LANG_SLOVAK, SUBLANG_DEFAULT @@ -12,7 +12,7 @@ LANGUAGE LANG_SLOVAK, SUBLANG_DEFAULT IDD_DIALOG_SCIENTIFIC DIALOGEX 0, 0, 316, 161 STYLE DS_SHELLFONT | WS_MINIMIZEBOX | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "Kalkulaka systmu ReactOS" +CAPTION "Kalkulačka systému ReactOS" MENU IDR_MENU_SCIENTIFIC_1 FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN @@ -151,7 +151,7 @@ BEGIN WS_VISIBLE,272,24,30,10 CONTROL "Stupne",IDC_RADIO_DEG,"Button",BS_AUTORADIOBUTTON,148,24, 42,10 - CONTROL "Radiny",IDC_RADIO_RAD,"Button",BS_AUTORADIOBUTTON,192, + CONTROL "Radiány",IDC_RADIO_RAD,"Button",BS_AUTORADIOBUTTON,192, 24,42,10 CONTROL "Grady",IDC_RADIO_GRAD,"Button",BS_AUTORADIOBUTTON, 236,24,44,10 @@ -159,7 +159,7 @@ BEGIN BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP PUSHBUTTON "CE",IDC_BUTTON_CE,228,40,40,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP - PUSHBUTTON "Sp",IDC_BUTTON_BACK,184,40,40,17,BS_CENTER | + PUSHBUTTON "Späť",IDC_BUTTON_BACK,184,40,40,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP RTEXT "",IDC_TEXT_OUTPUT,4,4,308,12,SS_CENTERIMAGE, WS_EX_CLIENTEDGE @@ -168,7 +168,7 @@ END IDD_DIALOG_STANDARD DIALOGEX 0, 0, 172, 127 STYLE DS_SHELLFONT | WS_MINIMIZEBOX | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "Kalkulaka systmu ReactOS" +CAPTION "Kalkulačka systému ReactOS" MENU IDR_MENU_STANDARD FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN @@ -176,7 +176,7 @@ BEGIN BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP PUSHBUTTON "CE",IDC_BUTTON_CE,84,24,40,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP - PUSHBUTTON "Sp",IDC_BUTTON_BACK,40,24,40,17,BS_CENTER | + PUSHBUTTON "Späť",IDC_BUTTON_BACK,40,24,40,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP RTEXT "",IDC_TEXT_OUTPUT,4,4,164,12,SS_CENTERIMAGE, WS_EX_CLIENTEDGE @@ -235,25 +235,25 @@ END IDD_DIALOG_CONVERSION DIALOGEX 0, 0, 320, 130 STYLE DS_SHELLFONT | WS_MINIMIZEBOX | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "Kalkulaka systmu ReactOS" +CAPTION "Kalkulačka systému ReactOS" MENU IDR_MENU_STANDARD FONT 8, "MS Shell Dlg" BEGIN - PUSHBUTTON "Previes",IDC_BUTTON_CONVERT,35,105,76,17 + PUSHBUTTON "Previesť",IDC_BUTTON_CONVERT,35,105,76,17 COMBOBOX IDC_COMBO_CATEGORY,4,31,140,168,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP | CBS_SORT - LTEXT "Kategria:",IDC_STATIC,4,20,56,8 + LTEXT "Kategória:",IDC_STATIC,4,20,56,8 COMBOBOX IDC_COMBO_FROM,4,60,140,168,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP | CBS_SORT - LTEXT "Previes z:",IDC_STATIC,4,49,56,8 + LTEXT "Previesť z:",IDC_STATIC,4,49,56,8 COMBOBOX IDC_COMBO_TO,4,87,140,168,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP | CBS_SORT - LTEXT "Previes na:",IDC_STATIC,4,76,56,8 + LTEXT "Previesť na:",IDC_STATIC,4,76,56,8 CONTROL "C",IDC_BUTTON_CANC,"Button",BS_OWNERDRAW | BS_CENTER | BS_VCENTER | BS_NOTIFY | WS_TABSTOP,276,24,40,17 CONTROL "CE",IDC_BUTTON_CE,"Button",BS_OWNERDRAW | BS_CENTER | BS_VCENTER | BS_NOTIFY | WS_TABSTOP,232,24,40,17 - CONTROL "Sp",IDC_BUTTON_BACK,"Button",BS_OWNERDRAW | + CONTROL "Späť",IDC_BUTTON_BACK,"Button",BS_OWNERDRAW | BS_CENTER | BS_VCENTER | BS_NOTIFY | WS_TABSTOP,188,24, 40,17 RTEXT "",IDC_TEXT_OUTPUT,4,4,312,12,SS_CENTERIMAGE, @@ -313,16 +313,16 @@ END IDD_DIALOG_ABOUT DIALOGEX DISCARDABLE 0, 0, 264, 169 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "o je kalkulaka systmu ReactOS" +CAPTION "Čo je kalkulačka systému ReactOS" FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "OK",IDOK,105,148,52,16 CONTROL IDB_BITMAP_ROS,IDC_STATIC,"Static",SS_BITMAP | SS_CENTERIMAGE | SS_REALSIZEIMAGE | WS_BORDER,4,4,104,48 - LTEXT "Kalkulaka systmu ReactOS",IDC_STATIC,120,12,132,8, + LTEXT "Kalkulačka systému ReactOS",IDC_STATIC,120,12,132,8, SS_CENTERIMAGE LTEXT "Verzia ",IDC_TEXT_VERSION,120,20,132,8,SS_CENTERIMAGE - LTEXT "Napsal Carlo Bramini",IDC_STATIC,120,32,132,8, + LTEXT "Napísal Carlo Bramini",IDC_STATIC,120,32,132,8, SS_CENTERIMAGE GROUPBOX "",IDC_STATIC,112,0,148,52 GROUPBOX "",IDC_STATIC,4,56,256,88 @@ -332,7 +332,7 @@ END IDD_DIALOG_STAT DIALOGEX DISCARDABLE 0, 0, 163, 85 STYLE DS_SHELLFONT | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "tatistika" +CAPTION "Štatistika" FONT 8, "MS Shell Dlg" BEGIN LISTBOX IDC_LIST_STAT,4,4,156,40,LBS_NOINTEGRALHEIGHT | @@ -349,89 +349,89 @@ END IDR_MENU_SCIENTIFIC_1 MENU DISCARDABLE BEGIN - POPUP "pravy" + POPUP "Úpravy" BEGIN - MENUITEM "Koprova\tCTRL-C", IDM_EDIT_COPY - MENUITEM "Prilepi\tCTRL-V", IDM_EDIT_PASTE + MENUITEM "Kopírovať\tCTRL-C", IDM_EDIT_COPY + MENUITEM "Prilepiť\tCTRL-V", IDM_EDIT_PASTE END - POPUP "Zobrazi" + POPUP "Zobraziť" BEGIN - MENUITEM "tandardn", IDM_VIEW_STANDARD, CHECKED - MENUITEM "Vedeck", IDM_VIEW_SCIENTIFIC, CHECKED + MENUITEM "Štandardná", IDM_VIEW_STANDARD, CHECKED + MENUITEM "Vedecká", IDM_VIEW_SCIENTIFIC, CHECKED MENUITEM "Prevody", IDM_VIEW_CONVERSION MENUITEM SEPARATOR - MENUITEM "estnstkov\tF5", IDM_VIEW_HEX, CHECKED - MENUITEM "Desiatkov\tF6", IDM_VIEW_DEC, CHECKED - MENUITEM "Osmikov\tF7", IDM_VIEW_OCT, CHECKED - MENUITEM "Dvojkov\tF8", IDM_VIEW_BIN, CHECKED + MENUITEM "Šestnástková\tF5", IDM_VIEW_HEX, CHECKED + MENUITEM "Desiatková\tF6", IDM_VIEW_DEC, CHECKED + MENUITEM "Osmičková\tF7", IDM_VIEW_OCT, CHECKED + MENUITEM "Dvojková\tF8", IDM_VIEW_BIN, CHECKED MENUITEM SEPARATOR MENUITEM "Stupne\tF2", IDM_VIEW_DEG, CHECKED - MENUITEM "Radiny\tF3", IDM_VIEW_RAD, CHECKED + MENUITEM "Radiány\tF3", IDM_VIEW_RAD, CHECKED MENUITEM "Grady\tF4", IDM_VIEW_GRAD, CHECKED MENUITEM SEPARATOR - MENUITEM "Zoskupova slice", IDM_VIEW_GROUP, CHECKED + MENUITEM "Zoskupovať číslice", IDM_VIEW_GROUP, CHECKED END - POPUP "Pomocnk" + POPUP "Pomocník" BEGIN - MENUITEM "Tmy pomocnka", IDM_HELP_HELP + MENUITEM "Témy pomocníka", IDM_HELP_HELP MENUITEM SEPARATOR - MENUITEM "o je kalkulaka systmu ReactOS", IDM_HELP_ABOUT + MENUITEM "Čo je kalkulačka systému ReactOS", IDM_HELP_ABOUT END END IDR_MENU_SCIENTIFIC_2 MENU DISCARDABLE BEGIN - POPUP "pravy" + POPUP "Úpravy" BEGIN - MENUITEM "Koprova\tCTRL-C", IDM_EDIT_COPY - MENUITEM "Prilepi\tCTRL-V", IDM_EDIT_PASTE + MENUITEM "Kopírovať\tCTRL-C", IDM_EDIT_COPY + MENUITEM "Prilepiť\tCTRL-V", IDM_EDIT_PASTE END - POPUP "Zobrazi" + POPUP "Zobraziť" BEGIN - MENUITEM "tandardn", IDM_VIEW_STANDARD, CHECKED - MENUITEM "Vedeck", IDM_VIEW_SCIENTIFIC, CHECKED + MENUITEM "Štandardná", IDM_VIEW_STANDARD, CHECKED + MENUITEM "Vedecká", IDM_VIEW_SCIENTIFIC, CHECKED MENUITEM "Prevody", IDM_VIEW_CONVERSION MENUITEM SEPARATOR - MENUITEM "estnstkov\tF5", IDM_VIEW_HEX, CHECKED - MENUITEM "Desiatkov\tF6", IDM_VIEW_DEC, CHECKED - MENUITEM "Osmikov\tF7", IDM_VIEW_OCT, CHECKED - MENUITEM "Dvojkov\tF8", IDM_VIEW_BIN, CHECKED + MENUITEM "Šestnástková\tF5", IDM_VIEW_HEX, CHECKED + MENUITEM "Desiatková\tF6", IDM_VIEW_DEC, CHECKED + MENUITEM "Osmičková\tF7", IDM_VIEW_OCT, CHECKED + MENUITEM "Dvojková\tF8", IDM_VIEW_BIN, CHECKED MENUITEM SEPARATOR MENUITEM "Qword\tF12", IDM_VIEW_QWORD, CHECKED MENUITEM "Dword\tF2", IDM_VIEW_DWORD, CHECKED MENUITEM "Word\tF3", IDM_VIEW_WORD, CHECKED MENUITEM "Bajt\tF4", IDM_VIEW_BYTE, CHECKED MENUITEM SEPARATOR - MENUITEM "Zoskupova slice", IDM_VIEW_GROUP, CHECKED + MENUITEM "Zoskupovať číslice", IDM_VIEW_GROUP, CHECKED END - POPUP "Pomocnk" + POPUP "Pomocník" BEGIN - MENUITEM "Tmy pomocnka", IDM_HELP_HELP + MENUITEM "Témy pomocníka", IDM_HELP_HELP MENUITEM SEPARATOR - MENUITEM "o je kalkulaka systmu ReactOS", IDM_HELP_ABOUT + MENUITEM "Čo je kalkulačka systému ReactOS", IDM_HELP_ABOUT END END IDR_MENU_STANDARD MENU DISCARDABLE BEGIN - POPUP "pravy" + POPUP "Úpravy" BEGIN - MENUITEM "Koprova\tCTRL-C", IDM_EDIT_COPY - MENUITEM "Prilepi\tCTRL-V", IDM_EDIT_PASTE + MENUITEM "Kopírovať\tCTRL-C", IDM_EDIT_COPY + MENUITEM "Prilepiť\tCTRL-V", IDM_EDIT_PASTE END - POPUP "Zobrazi" + POPUP "Zobraziť" BEGIN - MENUITEM "tandardn", IDM_VIEW_STANDARD, CHECKED - MENUITEM "Vedeck", IDM_VIEW_SCIENTIFIC, CHECKED + MENUITEM "Štandardná", IDM_VIEW_STANDARD, CHECKED + MENUITEM "Vedecká", IDM_VIEW_SCIENTIFIC, CHECKED MENUITEM "Prevody", IDM_VIEW_CONVERSION MENUITEM SEPARATOR - MENUITEM "Zoskupova slice", IDM_VIEW_GROUP, CHECKED + MENUITEM "Zoskupovať číslice", IDM_VIEW_GROUP, CHECKED END - POPUP "Pomocnk" + POPUP "Pomocník" BEGIN - MENUITEM "Tmy pomocnka", IDM_HELP_HELP + MENUITEM "Témy pomocníka", IDM_HELP_HELP MENUITEM SEPARATOR - MENUITEM "o je kalkulaka systmu ReactOS", IDM_HELP_ABOUT + MENUITEM "Čo je kalkulačka systému ReactOS", IDM_HELP_ABOUT END END @@ -439,9 +439,9 @@ END STRINGTABLE DISCARDABLE BEGIN - IDS_STRING_LICENSE "Kalkulaka systmu ReactOS je von softvr vydan pod licenciou GNU GPL.\r\n\r\nKpiu licencie GNU GPL mete zska tu:\r\nhttp://www.gnu.org/licenses/gpl.html\r\n\r\nRovnako mete zska preklad licencie GNU GPL tu:\r\nhttp://www.gnu.org/licenses/translations.html" + IDS_STRING_LICENSE "Kalkulačka systému ReactOS je voľný softvér vydaný pod licenciou GNU GPL.\r\n\r\nKópiu licencie GNU GPL môžete získať tu:\r\nhttp://www.gnu.org/licenses/gpl.html\r\n\r\nRovnako môžete získať preklad licencie GNU GPL tu:\r\nhttp://www.gnu.org/licenses/translations.html" IDS_MATH_ERROR "Chyba" - IDS_QUICKHELP "Rchla pomoc" + IDS_QUICKHELP "Rýchla pomoc" END // Types of conversion @@ -452,14 +452,14 @@ BEGIN IDS_CONV_CONSUMPTION "Spotreba motorov" //Spotreba (motory) IDS_CONV_CURRENCY "Mena" IDS_CONV_ENERGY "Energia" - IDS_CONV_LENGTH "Dka" - IDS_CONV_POWER "Vkon" + IDS_CONV_LENGTH "Dĺžka" + IDS_CONV_POWER "Výkon" IDS_CONV_PRESSURE "Tlak" IDS_CONV_TEMPERATURE "Teplota" - IDS_CONV_TIME "as" - IDS_CONV_VELOCITY "Rchlos" + IDS_CONV_TIME "Čas" + IDS_CONV_VELOCITY "Rýchlosť" IDS_CONV_VOLUME "Objem" - IDS_CONV_WEIGHT "Hmotnos" + IDS_CONV_WEIGHT "Hmotnosť" END // TYPES OF ANGLES @@ -467,44 +467,44 @@ STRINGTABLE DISCARDABLE BEGIN IDS_ANGLE_DEGREES "Stupne" IDS_ANGLE_GRADIANS "Grady" - IDS_ANGLE_RADIANS "Radiny" + IDS_ANGLE_RADIANS "Radiány" END // TYPES OF AREAS STRINGTABLE DISCARDABLE BEGIN IDS_AREA_ACRES "Akre" - IDS_AREA_ACRES_BRAZIL "Akre (Brazlia)" - IDS_AREA_ACRES_FRANCE "Akre (Franczsko)" - IDS_AREA_ACRES_SCOTS "Akre (ktsko)" + IDS_AREA_ACRES_BRAZIL "Akre (Brazília)" + IDS_AREA_ACRES_FRANCE "Akre (Francúzsko)" + IDS_AREA_ACRES_SCOTS "Akre (Škótsko)" IDS_AREA_ACRES_US "Akre (USA)" - IDS_AREA_ARES "re" + IDS_AREA_ARES "Áre" IDS_AREA_CHOU "Chou" IDS_AREA_DANBO "Danbo" - IDS_AREA_HECTARES "Hektre" + IDS_AREA_HECTARES "Hektáre" IDS_AREA_JEONGBO "Jeongbo" - IDS_AREA_MORGEN_HUNGARY "Morgen (Maarsko)" + IDS_AREA_MORGEN_HUNGARY "Morgen (Maďarsko)" IDS_AREA_MU "Mu" IDS_AREA_PING "Ping" IDS_AREA_PYEONG "Pyeong" IDS_AREA_PYEONGBANGJA "Pyeongbangja" IDS_AREA_RAI "Rai" IDS_AREA_SE "Se" - IDS_AREA_SQUARE_CENTIMETERS "tvorcov centimetre" - IDS_AREA_SQUARE_CHR "tvorcov chr" - IDS_AREA_SQUARE_FATHOMS "tvorcov siahy" - IDS_AREA_SQUARE_FATHOMS_HUNGARY "tvorcov siahy (Maarsko)" - IDS_AREA_SQUARE_FEET "tvorcov stopy" - IDS_AREA_SQUARE_INCHES "tvorcov palce" - IDS_AREA_SQUARE_KILOMETERS "tvorcov kilometre" - IDS_AREA_SQUARE_LAR "tvorcov lar" - IDS_AREA_SQUARE_METER "tvorcov meter" - IDS_AREA_SQUARE_MILES "tvorcov mle" - IDS_AREA_SQUARE_MILLIMETERS "tvorcov milimetre" - IDS_AREA_SQUARE_SHAKU "tvorcov shaku" - IDS_AREA_SQUARE_TSUEN "tvorcov tsuen" - IDS_AREA_SQUARE_VA "tvorcov va" - IDS_AREA_SQUARE_YARD "tvorcov yard" + IDS_AREA_SQUARE_CENTIMETERS "Štvorcové centimetre" + IDS_AREA_SQUARE_CHR "Štvorcový chr" + IDS_AREA_SQUARE_FATHOMS "Štvorcové siahy" + IDS_AREA_SQUARE_FATHOMS_HUNGARY "Štvorcové siahy (Maďarsko)" + IDS_AREA_SQUARE_FEET "Štvorcové stopy" + IDS_AREA_SQUARE_INCHES "Štvorcové palce" + IDS_AREA_SQUARE_KILOMETERS "Štvorcové kilometre" + IDS_AREA_SQUARE_LAR "Štvorcový lar" + IDS_AREA_SQUARE_METER "Štvorcové meter" + IDS_AREA_SQUARE_MILES "Štvorcové míle" + IDS_AREA_SQUARE_MILLIMETERS "Štvorcové milimetre" + IDS_AREA_SQUARE_SHAKU "Štvorcový shaku" + IDS_AREA_SQUARE_TSUEN "Štvorcový tsuen" + IDS_AREA_SQUARE_VA "Štvorcový va" + IDS_AREA_SQUARE_YARD "Štvorcový yard" IDS_AREA_TAN "Tan" IDS_AREA_TSUBO "Tsubo" END @@ -514,38 +514,38 @@ STRINGTABLE DISCARDABLE BEGIN IDS_CONSUMPTION_KM_PER_L "Kilometer/liter" IDS_CONSUMPTION_L_PER_100_KM "Litre/100 kilometerov" - IDS_CONSUMPTION_MILES_GALLON_UK "Mle/galn (UK)" - IDS_CONSUMPTION_MILES_GALLON_US "Mle/galn (USA)" + IDS_CONSUMPTION_MILES_GALLON_UK "Míle/galón (UK)" + IDS_CONSUMPTION_MILES_GALLON_US "Míle/galón (USA)" END // TYPES OF CURRENCIES STRINGTABLE DISCARDABLE BEGIN - IDS_CURRENCY_AUSTRIAN_SCHILLING "Raksky iling" - IDS_CURRENCY_BELGIAN_FRANC "Belgick frank" - IDS_CURRENCY_CYPRIOT_POUND "Cypersk libra" - IDS_CURRENCY_CZECH_KORUNA "esk koruna" - IDS_CURRENCY_DEUTSCHE_MARK "Nemeck marka" - IDS_CURRENCY_DUTCH_GUILDER "Holandsk gulden" + IDS_CURRENCY_AUSTRIAN_SCHILLING "Rakúsky šiling" + IDS_CURRENCY_BELGIAN_FRANC "Belgický frank" + IDS_CURRENCY_CYPRIOT_POUND "Cyperská libra" + IDS_CURRENCY_CZECH_KORUNA "Česká koruna" + IDS_CURRENCY_DEUTSCHE_MARK "Nemecká marka" + IDS_CURRENCY_DUTCH_GUILDER "Holandský gulden" IDS_CURRENCY_EURO "Euro" - IDS_CURRENCY_FINNISH_MARKKA "Fnska marka" - IDS_CURRENCY_FRENCH_FRANC "Franczsky frank" - IDS_CURRENCY_GREEK_DRACHMA "Grcka drachma" - IDS_CURRENCY_IRISH_POUND "rska libra" - IDS_CURRENCY_ITALIAN_LIRA "Taliansk lra" - IDS_CURRENCY_LUXEMBOURG_FRANC "Luxembursk frank" - IDS_CURRENCY_MALTESE_LIRA "Maltsk lra" - IDS_CURRENCY_PORTOGUESE_ESCUDO "Portugalsk escudo" - IDS_CURRENCY_SLOVAK_KORUNA "Slovensk koruna" - IDS_CURRENCY_SLOVENIAN_TOLAR "Slovinsk toliar" - IDS_CURRENCY_SPANISH_PESETA "panielska peseta" + IDS_CURRENCY_FINNISH_MARKKA "Fínska marka" + IDS_CURRENCY_FRENCH_FRANC "Francúzsky frank" + IDS_CURRENCY_GREEK_DRACHMA "Grécka drachma" + IDS_CURRENCY_IRISH_POUND "Írska libra" + IDS_CURRENCY_ITALIAN_LIRA "Talianská líra" + IDS_CURRENCY_LUXEMBOURG_FRANC "Luxemburský frank" + IDS_CURRENCY_MALTESE_LIRA "Maltská líra" + IDS_CURRENCY_PORTOGUESE_ESCUDO "Portugalské escudo" + IDS_CURRENCY_SLOVAK_KORUNA "Slovenská koruna" + IDS_CURRENCY_SLOVENIAN_TOLAR "Slovinský toliar" + IDS_CURRENCY_SPANISH_PESETA "Španielska peseta" END // TYPES OF ENERGIES STRINGTABLE DISCARDABLE BEGIN - IDS_ENERGY_15_C_CALORIES "15 C calories" - IDS_ENERGY_BTUS "Britsk termlne jednotky" + IDS_ENERGY_15_C_CALORIES "15 °C calories" + IDS_ENERGY_BTUS "Britské termálne jednotky" IDS_ENERGY_ERGS "Ergs" IDS_ENERGY_EVS "Elektron-Volty" IDS_ENERGY_FOOT_POUNDS "Foot-Pounds" @@ -571,7 +571,7 @@ BEGIN IDS_LENGTH_CHR "Chr" IDS_LENGTH_CUN "Cun" IDS_LENGTH_FATHOMS "Siahy" - IDS_LENGTH_FATHOMS_HUNGARY "Siahy (Maarsko)" + IDS_LENGTH_FATHOMS_HUNGARY "Siahy (Maďarsko)" IDS_LENGTH_FEET "Stopy" IDS_LENGTH_FURLONGS "Furlongs" IDS_LENGTH_GAN "Gan" @@ -585,18 +585,18 @@ BEGIN IDS_LENGTH_KEUB "Keub" IDS_LENGTH_KILOMETERS "Kilometre" IDS_LENGTH_LAR "Lar" - IDS_LENGTH_LIGHT_YEARS "Sveteln roky" + IDS_LENGTH_LIGHT_YEARS "Svetelné roky" IDS_LENGTH_LINKS_UK "Links (UK)" IDS_LENGTH_METERS "Metre" - IDS_LENGTH_MICRONS "Mikrny" - IDS_LENGTH_MILES "Mle" + IDS_LENGTH_MICRONS "Mikróny" + IDS_LENGTH_MILES "Míle" IDS_LENGTH_MILLIMETERS "Milimetre" - IDS_LENGTH_NAUTICAL_MILES "Nmorn mle" + IDS_LENGTH_NAUTICAL_MILES "Námorné míle" IDS_LENGTH_NIEU "Nieu" IDS_LENGTH_PARSECS "Parseky" IDS_LENGTH_PICAS "Picas" IDS_LENGTH_RI_JAPAN "Ri (Japonsko)" - IDS_LENGTH_RI_KOREA "Ri (Krea)" + IDS_LENGTH_RI_KOREA "Ri (Kórea)" IDS_LENGTH_RODS "Rods" IDS_LENGTH_SAWK "Sawk" IDS_LENGTH_SEN "Sen" @@ -613,9 +613,9 @@ END // TYPES OF POWERS STRINGTABLE DISCARDABLE BEGIN - IDS_POWER_BTUS_PER_MINUTE "Britsk termlne jednotky za mintu" - IDS_POWER_FPS_PER_MINUTE "Foot-Pounds za mintu" - IDS_POWER_HORSEPOWER "Kosk sily" + IDS_POWER_BTUS_PER_MINUTE "Britské termálne jednotky za minútu" + IDS_POWER_FPS_PER_MINUTE "Foot-Pounds za minútu" + IDS_POWER_HORSEPOWER "Koňské sily" IDS_POWER_KILOWATTS "Kilowatty" IDS_POWER_MEGAWATTS "Megawatty" IDS_POWER_WATTS "Watty" @@ -624,13 +624,13 @@ END // TYPE OF PRESSURES STRINGTABLE DISCARDABLE BEGIN - IDS_PRESSURE_ATMOSPHERES "Atmosfry" + IDS_PRESSURE_ATMOSPHERES "Atmosféry" IDS_PRESSURE_BARS "Bary" IDS_PRESSURE_HECTOPASCALS "Hektopascaly" IDS_PRESSURE_KILOPASCALS "Kilopascaly" IDS_PRESSURE_MM_OF_MERCURY "Milimetre ortuti" IDS_PRESSURE_PASCALS "Pascaly" - IDS_PRESSURE_PSI "Libry na tvorcov palec" + IDS_PRESSURE_PSI "Libry na štvorcový palec" END // TYPES OF TEMPERATURES @@ -650,9 +650,9 @@ BEGIN IDS_TIME_NANOSECONDS "Nanosekundy" IDS_TIME_MICROSECONDS "Mikrosekundy" IDS_TIME_MILLISECONDS "Milisekundy" - IDS_TIME_MINUTES "Minty" + IDS_TIME_MINUTES "Minúty" IDS_TIME_SECONDS "Sekundy" - IDS_TIME_WEEKS "Tdne" + IDS_TIME_WEEKS "Týždne" IDS_TIME_YEARS "Roky" END @@ -666,7 +666,7 @@ BEGIN IDS_VELOCITY_KNOTS "Knots" IDS_VELOCITY_MACH "Mach" IDS_VELOCITY_METERS_SECOND "Metre/sekundu" - IDS_VELOCITY_MILES_HOUR "Mle/hodinu" + IDS_VELOCITY_MILES_HOUR "Míle/hodinu" END // TYPES OF VOLUMES @@ -675,19 +675,19 @@ BEGIN IDS_VOLUME_BARRELS_UK "Barely (UK)" IDS_VOLUME_BARRELS_OIL "Barely ropy" //oleja? IDS_VOLUME_BUN "Bun" - IDS_VOLUME_BUSHELS_UK "Buely (UK)" //Buel, Bule? Buly? - IDS_VOLUME_BUSHELS_US "Buely (USA)" - IDS_VOLUME_CUBIC_CENTIMETERS "Kubick centimetre" - IDS_VOLUME_CUBIC_FEET "Kubick stopy" - IDS_VOLUME_CUBIC_INCHES "Kubick palce" - IDS_VOLUME_CUBIC_METERS "Kubick metre" - IDS_VOLUME_CUBIC_YARDS "Kubick yardy" + IDS_VOLUME_BUSHELS_UK "Bušely (UK)" //Bušel, Bušle? Bušly? + IDS_VOLUME_BUSHELS_US "Bušely (USA)" + IDS_VOLUME_CUBIC_CENTIMETERS "Kubické centimetre" + IDS_VOLUME_CUBIC_FEET "Kubické stopy" + IDS_VOLUME_CUBIC_INCHES "Kubické palce" + IDS_VOLUME_CUBIC_METERS "Kubické metre" + IDS_VOLUME_CUBIC_YARDS "Kubické yardy" IDS_VOLUME_DOE "Doe" IDS_VOLUME_FLUID_OUNCES_UK "Fluid ounces (UK)" IDS_VOLUME_FLUID_OUNCES_US "Fluid ounces (USA)" - IDS_VOLUME_GALLONS_UK "Galny (UK)" - IDS_VOLUME_GALLONS_DRY_US "Galny, such (USA)" - IDS_VOLUME_GALLONS_LIQUID_US "Galny, tekut (USA)" + IDS_VOLUME_GALLONS_UK "Galóny (UK)" + IDS_VOLUME_GALLONS_DRY_US "Galóny, suché (USA)" + IDS_VOLUME_GALLONS_LIQUID_US "Galóny, tekuté (USA)" IDS_VOLUME_GOU "Gou" IDS_VOLUME_HOP "Hop" IDS_VOLUME_ICCE "Icce" @@ -696,11 +696,11 @@ BEGIN IDS_VOLUME_MAL "Mal" IDS_VOLUME_MILLILITERS "Mililitre" IDS_VOLUME_PINTS_UK "Pinty (UK)" //pinta alebo polliter - IDS_VOLUME_PINTS_DRY_US "Pinty, such (USA)" - IDS_VOLUME_PINTS_LIQUID_US "Pinty, tekut (USA)" - IDS_VOLUME_QUARTS_UK "Quarts (UK)" //tvrgalny, tvrtiny, tvrky - IDS_VOLUME_QUARTS_DRY_US "Quarts, such (USA)" - IDS_VOLUME_QUARTS_LIQUID_US "Quarts, tekut (USA)" + IDS_VOLUME_PINTS_DRY_US "Pinty, suché (USA)" + IDS_VOLUME_PINTS_LIQUID_US "Pinty, tekuté (USA)" + IDS_VOLUME_QUARTS_UK "Quarts (UK)" //štvrťgalóny, štvrtiny, štvrťky + IDS_VOLUME_QUARTS_DRY_US "Quarts, suché (USA)" + IDS_VOLUME_QUARTS_LIQUID_US "Quarts, tekuté (USA)" IDS_VOLUME_SEKI "Seki" IDS_VOLUME_SYOU "Syou" IDS_VOLUME_TANANLOUNG "Tananloung" @@ -712,25 +712,25 @@ END STRINGTABLE DISCARDABLE BEGIN IDS_WEIGHT_BAHT "Baht" - IDS_WEIGHT_CARATS "Karty" + IDS_WEIGHT_CARATS "Karáty" IDS_WEIGHT_CHUNG "Chung" IDS_WEIGHT_DON "Don" IDS_WEIGHT_GEUN "Geun" IDS_WEIGHT_GRAMS "Gramy" IDS_WEIGHT_GWAN "Gwan" IDS_WEIGHT_HARB "Harb" - IDS_WEIGHT_JIN_CHINA "Jin (na)" + IDS_WEIGHT_JIN_CHINA "Jin (Čína)" IDS_WEIGHT_JIN_TAIWAN "Jin (Tchajvan)" IDS_WEIGHT_KAN "Kan" IDS_WEIGHT_KILOGRAMS "Kilogramy" IDS_WEIGHT_KIN "Kin" - IDS_WEIGHT_LIANG_CHINA "Liang (na)" + IDS_WEIGHT_LIANG_CHINA "Liang (Čína)" IDS_WEIGHT_LIANG_TAIWAN "Liang (Tchajvan)" IDS_WEIGHT_MONME "Monme" - IDS_WEIGHT_OUNCES_AVOIRDUPOIS "Unce, anglosask" - IDS_WEIGHT_OUNCES_TROY "Unce, trjska" + IDS_WEIGHT_OUNCES_AVOIRDUPOIS "Unce, anglosaská" + IDS_WEIGHT_OUNCES_TROY "Unce, trójska" IDS_WEIGHT_POUNDS "Libry" - IDS_WEIGHT_QUINTAL_METRIC "Cent (metrick)" + IDS_WEIGHT_QUINTAL_METRIC "Cent (metrický)" IDS_WEIGHT_SALOUNG "Saloung" IDS_WEIGHT_STONES "Stones" IDS_WEIGHT_TAMLUNG "Tamlung" diff --git a/base/applications/calc/lang/sv-SE.rc b/base/applications/calc/lang/sv-SE.rc index 2072e9cf64d..4b63dc8f2cc 100644 --- a/base/applications/calc/lang/sv-SE.rc +++ b/base/applications/calc/lang/sv-SE.rc @@ -1,9 +1,10 @@ /* - * PROJECT: ReactOS RAPPS - * FILE: \base\applications\calc\lang\sv-SE.rc + * PROJECT: ReactOS CALC + * FILE: base\applications\calc\lang\sv-SE.rc * PURPOSE: Swedish resource file * Translation: Jaix Bly */ + LANGUAGE LANG_SWEDISH, SUBLANG_NEUTRAL // Dialog @@ -243,7 +244,7 @@ BEGIN LTEXT "Kategori:",IDC_STATIC,4,20,56,8 COMBOBOX IDC_COMBO_FROM,4,60,140,168,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP | CBS_SORT - LTEXT "Konvertera frn:",IDC_STATIC,4,49,56,8 + LTEXT "Konvertera från:",IDC_STATIC,4,49,56,8 COMBOBOX IDC_COMBO_TO,4,87,140,168,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP | CBS_SORT LTEXT "Konvertera till:",IDC_STATIC,4,76,56,8 @@ -320,7 +321,7 @@ BEGIN LTEXT "ReactOS Kalkylator",IDC_STATIC,120,12,132,8, SS_CENTERIMAGE LTEXT "Version ",IDC_TEXT_VERSION,120,20,132,8,SS_CENTERIMAGE - LTEXT "Skriven av Carlo Bramini, vers.: Jaix Bly",IDC_STATIC,120,32,132,8, + LTEXT "Skriven av Carlo Bramini, Övers.: Jaix Bly",IDC_STATIC,120,32,132,8, SS_CENTERIMAGE GROUPBOX "",IDC_STATIC,112,0,148,52 GROUPBOX "",IDC_STATIC,4,56,256,88 @@ -361,7 +362,7 @@ BEGIN MENUITEM "Hexadecimal\tF5", IDM_VIEW_HEX, CHECKED MENUITEM "Decimal\tF6", IDM_VIEW_DEC, CHECKED MENUITEM "Oktal\tF7", IDM_VIEW_OCT, CHECKED - MENUITEM "Binr\tF8", IDM_VIEW_BIN, CHECKED + MENUITEM "Binär\tF8", IDM_VIEW_BIN, CHECKED MENUITEM SEPARATOR MENUITEM "Grader\tF2", IDM_VIEW_DEG, CHECKED MENUITEM "Radianer\tF3", IDM_VIEW_RAD, CHECKED @@ -369,9 +370,9 @@ BEGIN MENUITEM SEPARATOR MENUITEM "Siffergruppering", IDM_VIEW_GROUP, CHECKED END - POPUP "Hjlp" + POPUP "Hjälp" BEGIN - MENUITEM "Visa hjlp", IDM_HELP_HELP + MENUITEM "Visa hjälp", IDM_HELP_HELP MENUITEM SEPARATOR MENUITEM "Om ReactOS Kalkylator", IDM_HELP_ABOUT END @@ -393,7 +394,7 @@ BEGIN MENUITEM "Hexadecimal\tF5", IDM_VIEW_HEX, CHECKED MENUITEM "Decimal\tF6", IDM_VIEW_DEC, CHECKED MENUITEM "Oktal\tF7", IDM_VIEW_OCT, CHECKED - MENUITEM "Binr\tF8", IDM_VIEW_BIN, CHECKED + MENUITEM "Binär\tF8", IDM_VIEW_BIN, CHECKED MENUITEM SEPARATOR MENUITEM "Qword\tF12", IDM_VIEW_QWORD, CHECKED MENUITEM "Dword\tF2", IDM_VIEW_DWORD, CHECKED @@ -402,9 +403,9 @@ BEGIN MENUITEM SEPARATOR MENUITEM "Siffergruppering", IDM_VIEW_GROUP, CHECKED END - POPUP "Hjlp" + POPUP "Hjälp" BEGIN - MENUITEM "Visa hjlp", IDM_HELP_HELP + MENUITEM "Visa hjälp", IDM_HELP_HELP MENUITEM SEPARATOR MENUITEM "Om ReactOS Kalkylator", IDM_HELP_ABOUT END @@ -425,9 +426,9 @@ BEGIN MENUITEM SEPARATOR MENUITEM "Siffergruppering", IDM_VIEW_GROUP, CHECKED END - POPUP "Hjlp" + POPUP "Hjälp" BEGIN - MENUITEM "Visa hjlp", IDM_HELP_HELP + MENUITEM "Visa hjälp", IDM_HELP_HELP MENUITEM SEPARATOR MENUITEM "Om Reactos Kalkylator", IDM_HELP_ABOUT END @@ -437,21 +438,21 @@ END STRINGTABLE DISCARDABLE BEGIN - IDS_STRING_LICENSE "ReactOS Kalkylator r gratis programvara utgivet under GNU GPL licensen.\r\n\r\nDu kan f en kopia av GNU GPL licensen hr:\r\nhttp://www.gnu.org/licenses/gpl.html\r\n\r\nDu kan ocks f en versttning av GNU GPL lisensen hr:\r\nhttp://www.gnu.org/licenses/translations.html" + IDS_STRING_LICENSE "ReactOS Kalkylator är gratis programvara utgivet under GNU GPL licensen.\r\n\r\nDu kan få en kopia av GNU GPL licensen här:\r\nhttp://www.gnu.org/licenses/gpl.html\r\n\r\nDu kan också få en översättning av GNU GPL lisensen här:\r\nhttp://www.gnu.org/licenses/translations.html" IDS_MATH_ERROR "Fel" - IDS_QUICKHELP "Snabb hjlp" + IDS_QUICKHELP "Snabb hjälp" END // Types of conversion STRINGTABLE DISCARDABLE BEGIN IDS_CONV_ANGLE "Vinkel" - IDS_CONV_AREA "Omrde" - IDS_CONV_CONSUMPTION "Frbrukning (motor)" + IDS_CONV_AREA "Område" + IDS_CONV_CONSUMPTION "Förbrukning (motor)" IDS_CONV_CURRENCY "Valuta" IDS_CONV_ENERGY "Energi" - IDS_CONV_LENGTH "Lngd" - IDS_CONV_POWER "Strm" + IDS_CONV_LENGTH "Längd" + IDS_CONV_POWER "Ström" IDS_CONV_PRESSURE "Tryck" IDS_CONV_TEMPERATURE "Temperatur" IDS_CONV_TIME "Tid" @@ -519,12 +520,12 @@ END // TYPES OF CURRENCIES STRINGTABLE DISCARDABLE BEGIN - IDS_CURRENCY_AUSTRIAN_SCHILLING "sterriksk schilling" + IDS_CURRENCY_AUSTRIAN_SCHILLING "Österriksk schilling" IDS_CURRENCY_BELGIAN_FRANC "Belgisk franc" IDS_CURRENCY_CYPRIOT_POUND "Cypriotisk pound" IDS_CURRENCY_CZECH_KORUNA "Tjeckisk koruna" IDS_CURRENCY_DEUTSCHE_MARK "Tysk Mark" - IDS_CURRENCY_DUTCH_GUILDER "Nederlnsk guilder" + IDS_CURRENCY_DUTCH_GUILDER "Nederlänsk guilder" IDS_CURRENCY_EURO "Euro" IDS_CURRENCY_FINNISH_MARKKA "Finisk mark" IDS_CURRENCY_FRENCH_FRANC "Fransk franc" @@ -542,8 +543,8 @@ END // TYPES OF ENERGIES STRINGTABLE DISCARDABLE BEGIN - IDS_ENERGY_15_C_CALORIES "15 C calories" - IDS_ENERGY_BTUS "Britisk vrme-enhet" + IDS_ENERGY_15_C_CALORIES "15 °C calories" + IDS_ENERGY_BTUS "Britisk värme-enhet" IDS_ENERGY_ERGS "Ergs" IDS_ENERGY_EVS "Electron-Volt" IDS_ENERGY_FOOT_POUNDS "Fot-Pound" @@ -552,14 +553,14 @@ BEGIN IDS_ENERGY_JOULES "Joule" IDS_ENERGY_KILOJOULES "Kilojoule" IDS_ENERGY_KILOWATT_HOURS "Kilowattimmar" - IDS_ENERGY_NUTRITION_CALORIES "Nringskalorier" + IDS_ENERGY_NUTRITION_CALORIES "Näringskalorier" IDS_ENERGY_TH_CALORIES "Termokemiska kalorier" END // TYPES OF LENGTHS STRINGTABLE DISCARDABLE BEGIN - IDS_LENGTH_ANGSTROMS "ngstrm" + IDS_LENGTH_ANGSTROMS "Ångström" IDS_LENGTH_ASTRONOMICAL_UNITS "Astronomical units" IDS_LENGTH_BARLEYCORNS "Barleycorns" IDS_LENGTH_CENTIMETERS "Centimeter" @@ -583,7 +584,7 @@ BEGIN IDS_LENGTH_KEUB "Keub" IDS_LENGTH_KILOMETERS "Kilometer" IDS_LENGTH_LAR "Lar" - IDS_LENGTH_LIGHT_YEARS "Ljus r" + IDS_LENGTH_LIGHT_YEARS "Ljus år" IDS_LENGTH_LINKS_UK "Linker (UK)" IDS_LENGTH_METERS "Meter" IDS_LENGTH_MICRONS "Micron" @@ -611,9 +612,9 @@ END // TYPES OF POWERS STRINGTABLE DISCARDABLE BEGIN - IDS_POWER_BTUS_PER_MINUTE "Britisk vrme-enhet per minut" + IDS_POWER_BTUS_PER_MINUTE "Britisk värme-enhet per minut" IDS_POWER_FPS_PER_MINUTE "Fot-pund per minut" - IDS_POWER_HORSEPOWER "Hstekrafter" + IDS_POWER_HORSEPOWER "Hästekrafter" IDS_POWER_KILOWATTS "Kilowatt" IDS_POWER_MEGAWATTS "Megawatt" IDS_POWER_WATTS "Watt" @@ -622,7 +623,7 @@ END // TYPE OF PRESSURES STRINGTABLE DISCARDABLE BEGIN - IDS_PRESSURE_ATMOSPHERES "Atmosfr" + IDS_PRESSURE_ATMOSPHERES "Atmosfär" IDS_PRESSURE_BARS "Bar" IDS_PRESSURE_HECTOPASCALS "Hectopascal" IDS_PRESSURE_KILOPASCALS "Kilopascal" diff --git a/base/applications/calc/lang/th-TH.rc b/base/applications/calc/lang/th-TH.rc index ade4a12b17e..a0f5593e152 100644 --- a/base/applications/calc/lang/th-TH.rc +++ b/base/applications/calc/lang/th-TH.rc @@ -9,15 +9,15 @@ LANGUAGE LANG_THAI, SUBLANG_DEFAULT IDD_DIALOG_SCIENTIFIC DIALOGEX 0, 0, 316, 161 STYLE DS_SHELLFONT | WS_MINIMIZEBOX | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "ͧԴŢ ReactOS" +CAPTION "เครื่องคิดเลข ReactOS" MENU IDR_MENU_SCIENTIFIC_1 FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN GROUPBOX "",IDC_STATIC,4,16,132,21 - CONTROL "Ժˡ",IDC_RADIO_HEX,"Button",BS_AUTORADIOBUTTON,8,24,29,10 - CONTROL "Ժ",IDC_RADIO_DEC,"Button",BS_AUTORADIOBUTTON,40,24,29,10 - CONTROL "Ỵ",IDC_RADIO_OCT,"Button",BS_AUTORADIOBUTTON,72,24,27,10 - CONTROL "ͧ",IDC_RADIO_BIN,"Button",BS_AUTORADIOBUTTON,100,24,26,10 + CONTROL "สิบหก",IDC_RADIO_HEX,"Button",BS_AUTORADIOBUTTON,8,24,29,10 + CONTROL "สิบ",IDC_RADIO_DEC,"Button",BS_AUTORADIOBUTTON,40,24,29,10 + CONTROL "แปด",IDC_RADIO_OCT,"Button",BS_AUTORADIOBUTTON,72,24,27,10 + CONTROL "สอง",IDC_RADIO_BIN,"Button",BS_AUTORADIOBUTTON,100,24,26,10 GROUPBOX "",IDC_STATIC,4,36,76,21 CONTROL "Inv",IDC_CHECK_INV,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,44,26,10 @@ -138,25 +138,25 @@ BEGIN PUSHBUTTON "F",IDC_BUTTON_F,288,140,24,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP GROUPBOX "",IDC_STATIC,140,16,172,21 - CONTROL "",IDC_RADIO_QWORD,"Button",BS_AUTORADIOBUTTON | + CONTROL "สี่เวิร์ด",IDC_RADIO_QWORD,"Button",BS_AUTORADIOBUTTON | NOT WS_VISIBLE,148,24,37,10 - CONTROL "ͧ",IDC_RADIO_DWORD,"Button",BS_AUTORADIOBUTTON | + CONTROL "สองเวิร์ด",IDC_RADIO_DWORD,"Button",BS_AUTORADIOBUTTON | NOT WS_VISIBLE,188,24,37,10 - CONTROL "",IDC_RADIO_WORD,"Button",BS_AUTORADIOBUTTON | NOT + CONTROL "เวิร์ด",IDC_RADIO_WORD,"Button",BS_AUTORADIOBUTTON | NOT WS_VISIBLE,232,24,33,10 - CONTROL "亵",IDC_RADIO_BYTE,"Button",BS_AUTORADIOBUTTON | NOT + CONTROL "ไบต์",IDC_RADIO_BYTE,"Button",BS_AUTORADIOBUTTON | NOT WS_VISIBLE,272,24,30,10 - CONTROL "ͧ",IDC_RADIO_DEG,"Button",BS_AUTORADIOBUTTON,148,24, + CONTROL "องศา",IDC_RADIO_DEG,"Button",BS_AUTORADIOBUTTON,148,24, 42,10 - CONTROL "¹",IDC_RADIO_RAD,"Button",BS_AUTORADIOBUTTON,192, + CONTROL "เรเดียน",IDC_RADIO_RAD,"Button",BS_AUTORADIOBUTTON,192, 24,42,10 - CONTROL "¹",IDC_RADIO_GRAD,"Button",BS_AUTORADIOBUTTON, + CONTROL "เกรเดียน",IDC_RADIO_GRAD,"Button",BS_AUTORADIOBUTTON, 236,24,44,10 PUSHBUTTON "C",IDC_BUTTON_CANC,272,40,40,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP PUSHBUTTON "CE",IDC_BUTTON_CE,228,40,40,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP - PUSHBUTTON "໫",IDC_BUTTON_BACK,184,40,40,17,BS_CENTER | + PUSHBUTTON "แบ็กสเปซ",IDC_BUTTON_BACK,184,40,40,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP RTEXT "",IDC_TEXT_OUTPUT,4,4,308,12,SS_CENTERIMAGE, WS_EX_CLIENTEDGE @@ -165,7 +165,7 @@ END IDD_DIALOG_STANDARD DIALOGEX 0, 0, 172, 127 STYLE DS_SHELLFONT | WS_MINIMIZEBOX | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "ʶҹҾ" +CAPTION "สถานภาพทั่วไป" MENU IDR_MENU_STANDARD FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN @@ -173,7 +173,7 @@ BEGIN BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP PUSHBUTTON "CE",IDC_BUTTON_CE,84,24,40,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP - PUSHBUTTON "໫",IDC_BUTTON_BACK,40,24,40,17,BS_CENTER | + PUSHBUTTON "แบ็กสเปซ",IDC_BUTTON_BACK,40,24,40,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP RTEXT "",IDC_TEXT_OUTPUT,4,4,164,12,SS_CENTERIMAGE, WS_EX_CLIENTEDGE @@ -209,7 +209,7 @@ BEGIN BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP PUSHBUTTON "+",IDC_BUTTON_ADD,118,105,24,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP - PUSHBUTTON "ҡ",IDC_BUTTON_SQRT,144,48,24,17,BS_CENTER | + PUSHBUTTON "ราก",IDC_BUTTON_SQRT,144,48,24,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP PUSHBUTTON "%",IDC_BUTTON_PERCENT,144,67,24,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP @@ -232,7 +232,7 @@ END IDD_DIALOG_CONVERSION DIALOGEX 0, 0, 320, 130 STYLE DS_SHELLFONT | WS_MINIMIZEBOX | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "ͧԴŢ ReactOS" +CAPTION "เครื่องคิดเลข ReactOS" MENU IDR_MENU_STANDARD FONT 8, "MS Shell Dlg" BEGIN @@ -250,7 +250,7 @@ BEGIN BS_VCENTER | BS_NOTIFY | WS_TABSTOP,276,24,40,17 CONTROL "CE",IDC_BUTTON_CE,"Button",BS_OWNERDRAW | BS_CENTER | BS_VCENTER | BS_NOTIFY | WS_TABSTOP,232,24,40,17 - CONTROL "໫",IDC_BUTTON_BACK,"Button",BS_OWNERDRAW | + CONTROL "แบ็กสเปซ",IDC_BUTTON_BACK,"Button",BS_OWNERDRAW | BS_CENTER | BS_VCENTER | BS_NOTIFY | WS_TABSTOP,188,24, 40,17 RTEXT "",IDC_TEXT_OUTPUT,4,4,312,12,SS_CENTERIMAGE, @@ -287,7 +287,7 @@ BEGIN BS_VCENTER | BS_NOTIFY | WS_TABSTOP,266,86,24,17 CONTROL "+",IDC_BUTTON_ADD,"Button",BS_OWNERDRAW | BS_CENTER | BS_VCENTER | BS_NOTIFY | WS_TABSTOP,266,105,24,17 - CONTROL "ҡ",IDC_BUTTON_SQRT,"Button",BS_OWNERDRAW | BS_CENTER | + CONTROL "ราก",IDC_BUTTON_SQRT,"Button",BS_OWNERDRAW | BS_CENTER | BS_VCENTER | BS_NOTIFY | WS_TABSTOP,292,48,24,17 CONTROL "%",IDC_BUTTON_PERCENT,"Button",BS_OWNERDRAW | BS_CENTER | BS_VCENTER | BS_NOTIFY | WS_TABSTOP,292,67,24,17 @@ -310,15 +310,15 @@ END IDD_DIALOG_ABOUT DIALOGEX DISCARDABLE 0, 0, 264, 169 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "ǡѺ ReactOS Calc" +CAPTION "เกี่ยวกับ ReactOS Calc" FONT 8, "MS Shell Dlg" BEGIN - DEFPUSHBUTTON "ŧ",IDOK,105,148,52,16 + DEFPUSHBUTTON "ตกลง",IDOK,105,148,52,16 CONTROL IDB_BITMAP_ROS,IDC_STATIC,"Static",SS_BITMAP | SS_CENTERIMAGE | SS_REALSIZEIMAGE | WS_BORDER,4,4,104,48 - LTEXT "ͧԴŢ ReactOS",IDC_STATIC,120,12,132,8, + LTEXT "เครื่องคิดเลข ReactOS",IDC_STATIC,120,12,132,8, SS_CENTERIMAGE - LTEXT " ",IDC_TEXT_VERSION,120,20,132,8,SS_CENTERIMAGE + LTEXT "รุ่น ",IDC_TEXT_VERSION,120,20,132,8,SS_CENTERIMAGE LTEXT "Written by Carlo Bramini",IDC_STATIC,120,32,132,8, SS_CENTERIMAGE GROUPBOX "",IDC_STATIC,112,0,148,52 @@ -329,7 +329,7 @@ END IDD_DIALOG_STAT DIALOGEX DISCARDABLE 0, 0, 163, 85 STYLE DS_SHELLFONT | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "ͧʶҹ" +CAPTION "กล่องสถานะ" FONT 8, "MS Shell Dlg" BEGIN LISTBOX IDC_LIST_STAT,4,4,156,40,LBS_NOINTEGRALHEIGHT | @@ -346,89 +346,89 @@ END IDR_MENU_SCIENTIFIC_1 MENU DISCARDABLE BEGIN - POPUP "&" + POPUP "แ&ก้ไข" BEGIN - MENUITEM "Ѵ͡\tCTRL-C", IDM_EDIT_COPY - MENUITEM "ҧ\tCTRL-V", IDM_EDIT_PASTE + MENUITEM "คัดลอก\tCTRL-C", IDM_EDIT_COPY + MENUITEM "วาง\tCTRL-V", IDM_EDIT_PASTE END - POPUP "&ͧ" + POPUP "&มุมมอง" BEGIN - MENUITEM "Ẻҵðҹ", IDM_VIEW_STANDARD, CHECKED - MENUITEM "ẺԷʵ", IDM_VIEW_SCIENTIFIC, CHECKED - MENUITEM "¹ŧ", IDM_VIEW_CONVERSION + MENUITEM "แบบมาตรฐาน", IDM_VIEW_STANDARD, CHECKED + MENUITEM "แบบวิทยาศาสตร์", IDM_VIEW_SCIENTIFIC, CHECKED + MENUITEM "ความเปลี่ยนแปลง", IDM_VIEW_CONVERSION MENUITEM SEPARATOR - MENUITEM "ҹԺˡ\tF5", IDM_VIEW_HEX, CHECKED - MENUITEM "ҹԺ\tF6", IDM_VIEW_DEC, CHECKED - MENUITEM "ҹỴ\tF7", IDM_VIEW_OCT, CHECKED - MENUITEM "ҹͧ\tF8", IDM_VIEW_BIN, CHECKED + MENUITEM "ฐานสิบหก\tF5", IDM_VIEW_HEX, CHECKED + MENUITEM "ฐานสิบ\tF6", IDM_VIEW_DEC, CHECKED + MENUITEM "ฐานแปด\tF7", IDM_VIEW_OCT, CHECKED + MENUITEM "ฐานสอง\tF8", IDM_VIEW_BIN, CHECKED MENUITEM SEPARATOR - MENUITEM "ͧ\tF2", IDM_VIEW_DEG, CHECKED - MENUITEM "¹\tF3", IDM_VIEW_RAD, CHECKED - MENUITEM "¹\tF4", IDM_VIEW_GRAD, CHECKED + MENUITEM "องศา\tF2", IDM_VIEW_DEG, CHECKED + MENUITEM "เรเดียน\tF3", IDM_VIEW_RAD, CHECKED + MENUITEM "เกรเดียน\tF4", IDM_VIEW_GRAD, CHECKED MENUITEM SEPARATOR - MENUITEM "ʴѡŢ", IDM_VIEW_GROUP, CHECKED + MENUITEM "แสดงหลักตัวเลข", IDM_VIEW_GROUP, CHECKED END - POPUP "&" + POPUP "&ช่วยเหลือ" BEGIN - MENUITEM "Ū", IDM_HELP_HELP + MENUITEM "ข้อมูลช่วยเหลือ", IDM_HELP_HELP MENUITEM SEPARATOR - MENUITEM "ǡѺ ReactOS Calc", IDM_HELP_ABOUT + MENUITEM "เกี่ยวกับ ReactOS Calc", IDM_HELP_ABOUT END END IDR_MENU_SCIENTIFIC_2 MENU DISCARDABLE BEGIN - POPUP "&" + POPUP "แ&ก้ไข" BEGIN - MENUITEM "Ѵ͡\tCTRL-C", IDM_EDIT_COPY - MENUITEM "ҧ\tCTRL-V", IDM_EDIT_PASTE + MENUITEM "คัดลอก\tCTRL-C", IDM_EDIT_COPY + MENUITEM "วาง\tCTRL-V", IDM_EDIT_PASTE END - POPUP "&ͧ" + POPUP "&มุมมอง" BEGIN - MENUITEM "Ẻҵðҹ", IDM_VIEW_STANDARD, CHECKED - MENUITEM "ẺԷʵ", IDM_VIEW_SCIENTIFIC, CHECKED - MENUITEM "¹ŧ", IDM_VIEW_CONVERSION + MENUITEM "แบบมาตรฐาน", IDM_VIEW_STANDARD, CHECKED + MENUITEM "แบบวิทยาศาสตร์", IDM_VIEW_SCIENTIFIC, CHECKED + MENUITEM "ความเปลี่ยนแปลง", IDM_VIEW_CONVERSION MENUITEM SEPARATOR - MENUITEM "ҹԺˡ\tF5", IDM_VIEW_HEX, CHECKED - MENUITEM "ҹԺ\tF6", IDM_VIEW_DEC, CHECKED - MENUITEM "ҹỴ\tF7", IDM_VIEW_OCT, CHECKED - MENUITEM "ҹͧ\tF8", IDM_VIEW_BIN, CHECKED + MENUITEM "ฐานสิบหก\tF5", IDM_VIEW_HEX, CHECKED + MENUITEM "ฐานสิบ\tF6", IDM_VIEW_DEC, CHECKED + MENUITEM "ฐานแปด\tF7", IDM_VIEW_OCT, CHECKED + MENUITEM "ฐานสอง\tF8", IDM_VIEW_BIN, CHECKED MENUITEM SEPARATOR - MENUITEM "ͷ\tF12", IDM_VIEW_QWORD, CHECKED - MENUITEM "Ѻ\tF2", IDM_VIEW_DWORD, CHECKED - MENUITEM "\tF3", IDM_VIEW_WORD, CHECKED - MENUITEM "亵\tF4", IDM_VIEW_BYTE, CHECKED + MENUITEM "ควอทเวิร์ด\tF12", IDM_VIEW_QWORD, CHECKED + MENUITEM "ดับเบิลเวิร์ด\tF2", IDM_VIEW_DWORD, CHECKED + MENUITEM "เวิร์ด\tF3", IDM_VIEW_WORD, CHECKED + MENUITEM "ไบต์\tF4", IDM_VIEW_BYTE, CHECKED MENUITEM SEPARATOR - MENUITEM "ʴѡŢ", IDM_VIEW_GROUP, CHECKED + MENUITEM "แสดงหลักตัวเลข", IDM_VIEW_GROUP, CHECKED END - POPUP "&" + POPUP "&ช่วยเหลือ" BEGIN - MENUITEM "Ū", IDM_HELP_HELP + MENUITEM "ข้อมูลช่วยเหลือ", IDM_HELP_HELP MENUITEM SEPARATOR - MENUITEM "ǡѺ ReactOS Calc", IDM_HELP_ABOUT + MENUITEM "เกี่ยวกับ ReactOS Calc", IDM_HELP_ABOUT END END IDR_MENU_STANDARD MENU DISCARDABLE BEGIN - POPUP "&" + POPUP "แ&ก้ไข" BEGIN - MENUITEM "Ѵ͡\tCTRL-C", IDM_EDIT_COPY - MENUITEM "ҧ\tCTRL-V", IDM_EDIT_PASTE + MENUITEM "คัดลอก\tCTRL-C", IDM_EDIT_COPY + MENUITEM "วาง\tCTRL-V", IDM_EDIT_PASTE END - POPUP "&ͧ" + POPUP "&มุมมอง" BEGIN - MENUITEM "Ẻҵðҹ", IDM_VIEW_STANDARD, CHECKED - MENUITEM "ẺԷʵ", IDM_VIEW_SCIENTIFIC, CHECKED - MENUITEM "¹ŧ", IDM_VIEW_CONVERSION + MENUITEM "แบบมาตรฐาน", IDM_VIEW_STANDARD, CHECKED + MENUITEM "แบบวิทยาศาสตร์", IDM_VIEW_SCIENTIFIC, CHECKED + MENUITEM "ความเปลี่ยนแปลง", IDM_VIEW_CONVERSION MENUITEM SEPARATOR - MENUITEM "ʴѡŢ", IDM_VIEW_GROUP, CHECKED + MENUITEM "แสดงหลักตัวเลข", IDM_VIEW_GROUP, CHECKED END - POPUP "&" + POPUP "&ช่วยเหลือ" BEGIN - MENUITEM "Ū", IDM_HELP_HELP + MENUITEM "ข้อมูลช่วยเหลือ", IDM_HELP_HELP MENUITEM SEPARATOR - MENUITEM "ǡѺ ReactOS Calc", IDM_HELP_ABOUT + MENUITEM "เกี่ยวกับ ReactOS Calc", IDM_HELP_ABOUT END END @@ -437,15 +437,15 @@ END STRINGTABLE DISCARDABLE BEGIN IDS_STRING_LICENSE "ReactOS Calc is free software released under GNU GPL license.\r\n\r\nYou can get a copy of GNU GPL license here:\r\nhttp://www.gnu.org/licenses/gpl.html\r\n\r\nYou can also get a translation of GNU GPL license here:\r\nhttp://www.gnu.org/licenses/translations.html" - IDS_MATH_ERROR "ԴҴ" - IDS_QUICKHELP "觹 ?" + IDS_MATH_ERROR "ผิดพลาด" + IDS_QUICKHELP "สิ่งนี้คืออะไร ?" END // types of conversion STRINGTABLE DISCARDABLE BEGIN - IDS_CONV_ANGLE "" - IDS_CONV_AREA "鹷" + IDS_CONV_ANGLE "มุม" + IDS_CONV_AREA "พื้นที่" IDS_CONV_CONSUMPTION "Consumption (engines)" IDS_CONV_CURRENCY "Currencies" IDS_CONV_ENERGY "Energy" @@ -453,7 +453,7 @@ BEGIN IDS_CONV_POWER "Power" IDS_CONV_PRESSURE "Pressure" IDS_CONV_TEMPERATURE "Temperature" - IDS_CONV_TIME "" + IDS_CONV_TIME "เวลา" IDS_CONV_VELOCITY "Velocity" IDS_CONV_VOLUME "Volume" IDS_CONV_WEIGHT "Weights" @@ -462,9 +462,9 @@ END // TYPES OF ANGLES STRINGTABLE DISCARDABLE BEGIN - IDS_ANGLE_DEGREES "ͧ" - IDS_ANGLE_GRADIANS "¹" - IDS_ANGLE_RADIANS "¹" + IDS_ANGLE_DEGREES "องศา" + IDS_ANGLE_GRADIANS "เกรเดียน" + IDS_ANGLE_RADIANS "เรเดียน" END // TYPES OF AREAS @@ -524,7 +524,7 @@ BEGIN IDS_CURRENCY_CZECH_KORUNA "Czech koruna" IDS_CURRENCY_DEUTSCHE_MARK "Deutsche Mark" IDS_CURRENCY_DUTCH_GUILDER "Dutch guilder" - IDS_CURRENCY_EURO "" + IDS_CURRENCY_EURO "ยูโร" IDS_CURRENCY_FINNISH_MARKKA "Finnish markka" IDS_CURRENCY_FRENCH_FRANC "French franc" IDS_CURRENCY_GREEK_DRACHMA "Greek Drachma" @@ -541,7 +541,7 @@ END // TYPES OF ENERGIES STRINGTABLE DISCARDABLE BEGIN - IDS_ENERGY_15_C_CALORIES "15 ^0C " + IDS_ENERGY_15_C_CALORIES "15 ^0C แคลอรี" IDS_ENERGY_BTUS "British Thermal Units" IDS_ENERGY_ERGS "Ergs" IDS_ENERGY_EVS "Electron-Volts" diff --git a/base/applications/calc/lang/uk-UA.rc b/base/applications/calc/lang/uk-UA.rc index 1a1b615aa89..359ebfe7371 100644 --- a/base/applications/calc/lang/uk-UA.rc +++ b/base/applications/calc/lang/uk-UA.rc @@ -12,7 +12,7 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT IDD_DIALOG_SCIENTIFIC DIALOGEX 0, 0, 316, 161 STYLE DS_SHELLFONT | WS_MINIMIZEBOX | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " ReactOS" +CAPTION "Калькулятор ReactOS" MENU IDR_MENU_SCIENTIFIC_1 FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN @@ -141,19 +141,19 @@ BEGIN PUSHBUTTON "F",IDC_BUTTON_F,288,140,24,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP GROUPBOX "",IDC_STATIC,140,16,172,21 - CONTROL "8 ",IDC_RADIO_QWORD,"Button",BS_AUTORADIOBUTTON | + CONTROL "8 байт",IDC_RADIO_QWORD,"Button",BS_AUTORADIOBUTTON | NOT WS_VISIBLE,148,24,37,10 - CONTROL "4 ",IDC_RADIO_DWORD,"Button",BS_AUTORADIOBUTTON | + CONTROL "4 байт",IDC_RADIO_DWORD,"Button",BS_AUTORADIOBUTTON | NOT WS_VISIBLE,188,24,37,10 - CONTROL "2 ",IDC_RADIO_WORD,"Button",BS_AUTORADIOBUTTON | NOT + CONTROL "2 байт",IDC_RADIO_WORD,"Button",BS_AUTORADIOBUTTON | NOT WS_VISIBLE,232,24,33,10 - CONTROL "1 ",IDC_RADIO_BYTE,"Button",BS_AUTORADIOBUTTON | NOT + CONTROL "1 байт",IDC_RADIO_BYTE,"Button",BS_AUTORADIOBUTTON | NOT WS_VISIBLE,272,24,30,10 - CONTROL "",IDC_RADIO_DEG,"Button",BS_AUTORADIOBUTTON,148,24, + CONTROL "Градуси",IDC_RADIO_DEG,"Button",BS_AUTORADIOBUTTON,148,24, 42,10 - CONTROL "",IDC_RADIO_RAD,"Button",BS_AUTORADIOBUTTON,192, + CONTROL "Радіани",IDC_RADIO_RAD,"Button",BS_AUTORADIOBUTTON,192, 24,42,10 - CONTROL "",IDC_RADIO_GRAD,"Button",BS_AUTORADIOBUTTON, + CONTROL "Гради",IDC_RADIO_GRAD,"Button",BS_AUTORADIOBUTTON, 236,24,44,10 PUSHBUTTON "C",IDC_BUTTON_CANC,272,40,40,17,BS_CENTER | BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP @@ -168,7 +168,7 @@ END IDD_DIALOG_STANDARD DIALOGEX 0, 0, 172, 127 STYLE DS_SHELLFONT | WS_MINIMIZEBOX | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " ReactOS" +CAPTION "Калькулятор ReactOS" MENU IDR_MENU_STANDARD FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN @@ -235,20 +235,20 @@ END IDD_DIALOG_CONVERSION DIALOGEX 0, 0, 320, 130 STYLE DS_SHELLFONT | WS_MINIMIZEBOX | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " ReactOS" +CAPTION "Калькулятор ReactOS" MENU IDR_MENU_STANDARD FONT 8, "MS Shell Dlg" BEGIN - PUSHBUTTON "",IDC_BUTTON_CONVERT,35,105,76,17 + PUSHBUTTON "Перевести",IDC_BUTTON_CONVERT,35,105,76,17 COMBOBOX IDC_COMBO_CATEGORY,4,31,140,168,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP | CBS_SORT - LTEXT ":",IDC_STATIC,4,20,56,8 + LTEXT "Категорія:",IDC_STATIC,4,20,56,8 COMBOBOX IDC_COMBO_FROM,4,60,140,168,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP | CBS_SORT - LTEXT " :",IDC_STATIC,4,49,56,8 + LTEXT "Вихідна величина:",IDC_STATIC,4,49,56,8 COMBOBOX IDC_COMBO_TO,4,87,140,168,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP | CBS_SORT - LTEXT "ʳ :",IDC_STATIC,4,76,56,8 + LTEXT "Кінцева величина:",IDC_STATIC,4,76,56,8 CONTROL "C",IDC_BUTTON_CANC,"Button",BS_OWNERDRAW | BS_CENTER | BS_VCENTER | BS_NOTIFY | WS_TABSTOP,276,24,40,17 CONTROL "CE",IDC_BUTTON_CE,"Button",BS_OWNERDRAW | BS_CENTER | @@ -313,16 +313,16 @@ END IDD_DIALOG_ABOUT DIALOGEX DISCARDABLE 0, 0, 264, 169 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " ReactOS" +CAPTION "Про Калькулятор ReactOS" FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "OK",IDOK,105,148,52,16 CONTROL IDB_BITMAP_ROS,IDC_STATIC,"Static",SS_BITMAP | SS_CENTERIMAGE | SS_REALSIZEIMAGE | WS_BORDER,4,4,104,48 - LTEXT " ReactOS",IDC_STATIC,120,12,132,8, + LTEXT "Калькулятор ReactOS",IDC_STATIC,120,12,132,8, SS_CENTERIMAGE - LTEXT " ",IDC_TEXT_VERSION,120,20,132,8,SS_CENTERIMAGE - LTEXT " ",IDC_STATIC,120,32,132,8, + LTEXT "Версія ",IDC_TEXT_VERSION,120,20,132,8,SS_CENTERIMAGE + LTEXT "Написав Карло Браміні",IDC_STATIC,120,32,132,8, SS_CENTERIMAGE GROUPBOX "",IDC_STATIC,112,0,148,52 GROUPBOX "",IDC_STATIC,4,56,256,88 @@ -332,7 +332,7 @@ END IDD_DIALOG_STAT DIALOGEX DISCARDABLE 0, 0, 163, 85 STYLE DS_SHELLFONT | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "" +CAPTION "Статистика" FONT 8, "MS Shell Dlg" BEGIN LISTBOX IDC_LIST_STAT,4,4,156,40,LBS_NOINTEGRALHEIGHT | @@ -349,89 +349,89 @@ END IDR_MENU_SCIENTIFIC_1 MENU DISCARDABLE BEGIN - POPUP "" + POPUP "Правка" BEGIN - MENUITEM "\tCTRL-C", IDM_EDIT_COPY - MENUITEM "\tCTRL-V", IDM_EDIT_PASTE + MENUITEM "Копіювати\tCTRL-C", IDM_EDIT_COPY + MENUITEM "Вставити\tCTRL-V", IDM_EDIT_PASTE END - POPUP "" + POPUP "Вигляд" BEGIN - MENUITEM "", IDM_VIEW_STANDARD, CHECKED - MENUITEM "", IDM_VIEW_SCIENTIFIC, CHECKED - MENUITEM "", IDM_VIEW_CONVERSION + MENUITEM "Звичайний", IDM_VIEW_STANDARD, CHECKED + MENUITEM "Науковий", IDM_VIEW_SCIENTIFIC, CHECKED + MENUITEM "Перетворення", IDM_VIEW_CONVERSION MENUITEM SEPARATOR - MENUITEM "س\tF5", IDM_VIEW_HEX, CHECKED - MENUITEM "\tF6", IDM_VIEW_DEC, CHECKED - MENUITEM "³\tF7", IDM_VIEW_OCT, CHECKED - MENUITEM "\tF8", IDM_VIEW_BIN, CHECKED + MENUITEM "Шістнадцятковий\tF5", IDM_VIEW_HEX, CHECKED + MENUITEM "Десятковий\tF6", IDM_VIEW_DEC, CHECKED + MENUITEM "Вісімковий\tF7", IDM_VIEW_OCT, CHECKED + MENUITEM "Двійковий\tF8", IDM_VIEW_BIN, CHECKED MENUITEM SEPARATOR - MENUITEM "\tF2", IDM_VIEW_DEG, CHECKED - MENUITEM "\tF3", IDM_VIEW_RAD, CHECKED - MENUITEM "\tF4", IDM_VIEW_GRAD, CHECKED + MENUITEM "Градуси\tF2", IDM_VIEW_DEG, CHECKED + MENUITEM "Радіани\tF3", IDM_VIEW_RAD, CHECKED + MENUITEM "Гради\tF4", IDM_VIEW_GRAD, CHECKED MENUITEM SEPARATOR - MENUITEM "ʳ ", IDM_VIEW_GROUP, CHECKED + MENUITEM "Кількість цифр у групі", IDM_VIEW_GROUP, CHECKED END - POPUP "" + POPUP "Довідка" BEGIN - MENUITEM "", IDM_HELP_HELP + MENUITEM "Зміст", IDM_HELP_HELP MENUITEM SEPARATOR - MENUITEM " ReactOS", IDM_HELP_ABOUT + MENUITEM "Про Калькулятор ReactOS", IDM_HELP_ABOUT END END IDR_MENU_SCIENTIFIC_2 MENU DISCARDABLE BEGIN - POPUP "" + POPUP "Правка" BEGIN - MENUITEM "\tCTRL-C", IDM_EDIT_COPY - MENUITEM "\tCTRL-V", IDM_EDIT_PASTE + MENUITEM "Копіювати\tCTRL-C", IDM_EDIT_COPY + MENUITEM "Вставити\tCTRL-V", IDM_EDIT_PASTE END - POPUP "" + POPUP "Вигляд" BEGIN - MENUITEM "", IDM_VIEW_STANDARD, CHECKED - MENUITEM "", IDM_VIEW_SCIENTIFIC, CHECKED - MENUITEM "", IDM_VIEW_CONVERSION + MENUITEM "Звичайний", IDM_VIEW_STANDARD, CHECKED + MENUITEM "Науковий", IDM_VIEW_SCIENTIFIC, CHECKED + MENUITEM "Перетворення", IDM_VIEW_CONVERSION MENUITEM SEPARATOR - MENUITEM "س\tF5", IDM_VIEW_HEX, CHECKED - MENUITEM "\tF6", IDM_VIEW_DEC, CHECKED - MENUITEM "³\tF7", IDM_VIEW_OCT, CHECKED - MENUITEM "\tF8", IDM_VIEW_BIN, CHECKED + MENUITEM "Шістнадцятковий\tF5", IDM_VIEW_HEX, CHECKED + MENUITEM "Десятковий\tF6", IDM_VIEW_DEC, CHECKED + MENUITEM "Вісімковий\tF7", IDM_VIEW_OCT, CHECKED + MENUITEM "Двійковий\tF8", IDM_VIEW_BIN, CHECKED MENUITEM SEPARATOR - MENUITEM "8 \tF12", IDM_VIEW_QWORD, CHECKED - MENUITEM "4 \tF2", IDM_VIEW_DWORD, CHECKED - MENUITEM "2 \tF3", IDM_VIEW_WORD, CHECKED - MENUITEM "1 \tF4", IDM_VIEW_BYTE, CHECKED + MENUITEM "8 байт\tF12", IDM_VIEW_QWORD, CHECKED + MENUITEM "4 байт\tF2", IDM_VIEW_DWORD, CHECKED + MENUITEM "2 байт\tF3", IDM_VIEW_WORD, CHECKED + MENUITEM "1 байт\tF4", IDM_VIEW_BYTE, CHECKED MENUITEM SEPARATOR - MENUITEM "ʳ ", IDM_VIEW_GROUP, CHECKED + MENUITEM "Кількість цифр у групі", IDM_VIEW_GROUP, CHECKED END - POPUP "" + POPUP "Довідка" BEGIN - MENUITEM "", IDM_HELP_HELP + MENUITEM "Зміст", IDM_HELP_HELP MENUITEM SEPARATOR - MENUITEM " ReactOS", IDM_HELP_ABOUT + MENUITEM "Про Калькулятор ReactOS", IDM_HELP_ABOUT END END IDR_MENU_STANDARD MENU DISCARDABLE BEGIN - POPUP "" + POPUP "Правка" BEGIN - MENUITEM "\tCTRL-C", IDM_EDIT_COPY - MENUITEM "\tCTRL-V", IDM_EDIT_PASTE + MENUITEM "Копіювати\tCTRL-C", IDM_EDIT_COPY + MENUITEM "Вставити\tCTRL-V", IDM_EDIT_PASTE END - POPUP "" + POPUP "Вигляд" BEGIN - MENUITEM "", IDM_VIEW_STANDARD, CHECKED - MENUITEM "", IDM_VIEW_SCIENTIFIC, CHECKED - MENUITEM "", IDM_VIEW_CONVERSION + MENUITEM "Звичайний", IDM_VIEW_STANDARD, CHECKED + MENUITEM "Науковий", IDM_VIEW_SCIENTIFIC, CHECKED + MENUITEM "Перетворення", IDM_VIEW_CONVERSION MENUITEM SEPARATOR - MENUITEM "ʳ ", IDM_VIEW_GROUP, CHECKED + MENUITEM "Кількість цифр у групі", IDM_VIEW_GROUP, CHECKED END - POPUP "" + POPUP "Довідка" BEGIN - MENUITEM "", IDM_HELP_HELP + MENUITEM "Зміст", IDM_HELP_HELP MENUITEM SEPARATOR - MENUITEM " ReactOS", IDM_HELP_ABOUT + MENUITEM "Про Калькулятор ReactOS", IDM_HELP_ABOUT END END @@ -439,302 +439,302 @@ END STRINGTABLE DISCARDABLE BEGIN - IDS_STRING_LICENSE " ReactOS - , 糺 GNU GPL.\r\n\r\n 糿 GNU GPL :\r\nhttp://www.gnu.org/licenses/gpl.html\r\n\r\n 糿 GNU GPL :\r\nhttp://www.gnu.org/licenses/translations.html" - IDS_MATH_ERROR "" - IDS_QUICKHELP " " + IDS_STRING_LICENSE "Калькулятор ReactOS - вільне програмне забезпечення, випущене за ліцензією GNU GPL.\r\n\r\nВи можете отримати копію ліцензії GNU GPL тут:\r\nhttp://www.gnu.org/licenses/gpl.html\r\n\r\nВи можете також отримати переклад ліцензії GNU GPL тут:\r\nhttp://www.gnu.org/licenses/translations.html" + IDS_MATH_ERROR "Помилка" + IDS_QUICKHELP "Швидка довідка" END // types of conversion STRINGTABLE DISCARDABLE BEGIN - IDS_CONV_ANGLE "" - IDS_CONV_AREA "" - IDS_CONV_CONSUMPTION " ()" - IDS_CONV_CURRENCY "" - IDS_CONV_ENERGY "" - IDS_CONV_LENGTH "" - IDS_CONV_POWER "" - IDS_CONV_PRESSURE "" - IDS_CONV_TEMPERATURE "" - IDS_CONV_TIME "" - IDS_CONV_VELOCITY "" - IDS_CONV_VOLUME "'" - IDS_CONV_WEIGHT "" + IDS_CONV_ANGLE "Кут" + IDS_CONV_AREA "Площа" + IDS_CONV_CONSUMPTION "Витрата палива (двигуни)" + IDS_CONV_CURRENCY "Валюта" + IDS_CONV_ENERGY "Енергія" + IDS_CONV_LENGTH "Довжина" + IDS_CONV_POWER "Потужність" + IDS_CONV_PRESSURE "Тиск" + IDS_CONV_TEMPERATURE "Температура" + IDS_CONV_TIME "Час" + IDS_CONV_VELOCITY "Швидкість" + IDS_CONV_VOLUME "Об'єм" + IDS_CONV_WEIGHT "Вага" END // TYPES OF ANGLES STRINGTABLE DISCARDABLE BEGIN - IDS_ANGLE_DEGREES "" - IDS_ANGLE_GRADIANS "" - IDS_ANGLE_RADIANS "" + IDS_ANGLE_DEGREES "Градус" + IDS_ANGLE_GRADIANS "Град" + IDS_ANGLE_RADIANS "Радіан" END // TYPES OF AREAS STRINGTABLE DISCARDABLE BEGIN - IDS_AREA_ACRES "" - IDS_AREA_ACRES_BRAZIL " ()" - IDS_AREA_ACRES_FRANCE " ()" - IDS_AREA_ACRES_SCOTS " ()" - IDS_AREA_ACRES_US " ()" - IDS_AREA_ARES "" - IDS_AREA_CHOU "" - IDS_AREA_DANBO "" - IDS_AREA_HECTARES "" - IDS_AREA_JEONGBO "" - IDS_AREA_MORGEN_HUNGARY " ()" - IDS_AREA_MU "" - IDS_AREA_PING "ϳ" - IDS_AREA_PYEONG "" - IDS_AREA_PYEONGBANGJA "" - IDS_AREA_RAI "" + IDS_AREA_ACRES "Акр" + IDS_AREA_ACRES_BRAZIL "Акр (бразильський)" + IDS_AREA_ACRES_FRANCE "Акр (французький)" + IDS_AREA_ACRES_SCOTS "Акр (шотландський)" + IDS_AREA_ACRES_US "Акр (США)" + IDS_AREA_ARES "Ар" + IDS_AREA_CHOU "Чоу" + IDS_AREA_DANBO "Дамбо" + IDS_AREA_HECTARES "Гектар" + IDS_AREA_JEONGBO "Дженгбо" + IDS_AREA_MORGEN_HUNGARY "Морген (угорський)" + IDS_AREA_MU "Му" + IDS_AREA_PING "Пінг" + IDS_AREA_PYEONG "Пйон" + IDS_AREA_PYEONGBANGJA "Пйонбанджа" + IDS_AREA_RAI "Рай" IDS_AREA_SE "Se" - IDS_AREA_SQUARE_CENTIMETERS " " - IDS_AREA_SQUARE_CHR " " - IDS_AREA_SQUARE_FATHOMS " " - IDS_AREA_SQUARE_FATHOMS_HUNGARY " ()" - IDS_AREA_SQUARE_FEET " " - IDS_AREA_SQUARE_INCHES " " - IDS_AREA_SQUARE_KILOMETERS " " - IDS_AREA_SQUARE_LAR " " - IDS_AREA_SQUARE_METER " " - IDS_AREA_SQUARE_MILES " " - IDS_AREA_SQUARE_MILLIMETERS " " - IDS_AREA_SQUARE_SHAKU " " - IDS_AREA_SQUARE_TSUEN " " - IDS_AREA_SQUARE_VA " " - IDS_AREA_SQUARE_YARD " " - IDS_AREA_TAN "" - IDS_AREA_TSUBO "" + IDS_AREA_SQUARE_CENTIMETERS "Квадратний сантиметр" + IDS_AREA_SQUARE_CHR "Квадратний ча" + IDS_AREA_SQUARE_FATHOMS "Квадратний фатом" + IDS_AREA_SQUARE_FATHOMS_HUNGARY "Квадратний фатом (угорський)" + IDS_AREA_SQUARE_FEET "Квадратний фут" + IDS_AREA_SQUARE_INCHES "Квадратний дюйм" + IDS_AREA_SQUARE_KILOMETERS "Квадратний кілометр" + IDS_AREA_SQUARE_LAR "Квадратний лар" + IDS_AREA_SQUARE_METER "Квадратний метр" + IDS_AREA_SQUARE_MILES "Квадратна миля" + IDS_AREA_SQUARE_MILLIMETERS "Квадратний міліметр" + IDS_AREA_SQUARE_SHAKU "Квадратний шаку" + IDS_AREA_SQUARE_TSUEN "Квадратний тсуен" + IDS_AREA_SQUARE_VA "Квадратна ва" + IDS_AREA_SQUARE_YARD "Квадратний ярд" + IDS_AREA_TAN "Тан" + IDS_AREA_TSUBO "Цубо" END // TYPES OF COMSUMPTIONS STRINGTABLE DISCARDABLE BEGIN - IDS_CONSUMPTION_KM_PER_L "ʳ/" - IDS_CONSUMPTION_L_PER_100_KM "˳/100 " - IDS_CONSUMPTION_MILES_GALLON_UK "/ ()" - IDS_CONSUMPTION_MILES_GALLON_US "/ ()" + IDS_CONSUMPTION_KM_PER_L "Кілометр/літр" + IDS_CONSUMPTION_L_PER_100_KM "Літрів/100 кілометрів" + IDS_CONSUMPTION_MILES_GALLON_UK "Миль/галонів (британський)" + IDS_CONSUMPTION_MILES_GALLON_US "Миль/галонів (США)" END // TYPES OF CURRENCIES STRINGTABLE DISCARDABLE BEGIN - IDS_CURRENCY_AUSTRIAN_SCHILLING " " - IDS_CURRENCY_BELGIAN_FRANC " " - IDS_CURRENCY_CYPRIOT_POUND "ʳ " - IDS_CURRENCY_CZECH_KORUNA " " - IDS_CURRENCY_DEUTSCHE_MARK " " - IDS_CURRENCY_DUTCH_GUILDER " " - IDS_CURRENCY_EURO "" - IDS_CURRENCY_FINNISH_MARKKA "Գ " - IDS_CURRENCY_FRENCH_FRANC " " - IDS_CURRENCY_GREEK_DRACHMA " " - IDS_CURRENCY_IRISH_POUND " " - IDS_CURRENCY_ITALIAN_LIRA " " - IDS_CURRENCY_LUXEMBOURG_FRANC " " - IDS_CURRENCY_MALTESE_LIRA " " - IDS_CURRENCY_PORTOGUESE_ESCUDO " " - IDS_CURRENCY_SLOVAK_KORUNA " " - IDS_CURRENCY_SLOVENIAN_TOLAR " " - IDS_CURRENCY_SPANISH_PESETA " " + IDS_CURRENCY_AUSTRIAN_SCHILLING "Австралійський шилінг" + IDS_CURRENCY_BELGIAN_FRANC "Бельгійський франк" + IDS_CURRENCY_CYPRIOT_POUND "Кіпріотський фунт" + IDS_CURRENCY_CZECH_KORUNA "Чешська крона" + IDS_CURRENCY_DEUTSCHE_MARK "Немецька марка" + IDS_CURRENCY_DUTCH_GUILDER "Голандський гульден" + IDS_CURRENCY_EURO "Євро" + IDS_CURRENCY_FINNISH_MARKKA "Фінська марка" + IDS_CURRENCY_FRENCH_FRANC "Французський франк" + IDS_CURRENCY_GREEK_DRACHMA "Грецька драхма" + IDS_CURRENCY_IRISH_POUND "Ірландський фунт" + IDS_CURRENCY_ITALIAN_LIRA "Італьянськая ліра" + IDS_CURRENCY_LUXEMBOURG_FRANC "Люксембургський франк" + IDS_CURRENCY_MALTESE_LIRA "Мальтийськая ліра" + IDS_CURRENCY_PORTOGUESE_ESCUDO "Португальське ескудо" + IDS_CURRENCY_SLOVAK_KORUNA "Словацька крона" + IDS_CURRENCY_SLOVENIAN_TOLAR "Словенський толар" + IDS_CURRENCY_SPANISH_PESETA "Іспанська песета" END // TYPES OF ENERGIES STRINGTABLE DISCARDABLE BEGIN - IDS_ENERGY_15_C_CALORIES " 15-" - IDS_ENERGY_BTUS " " - IDS_ENERGY_ERGS "" - IDS_ENERGY_EVS "" - IDS_ENERGY_FOOT_POUNDS "-" - IDS_ENERGY_IT_CALORIES " " - IDS_ENERGY_IT_KILOCALORIES "ʳ " - IDS_ENERGY_JOULES "" - IDS_ENERGY_KILOJOULES "ʳ" - IDS_ENERGY_KILOWATT_HOURS "ʳ " - IDS_ENERGY_NUTRITION_CALORIES " " - IDS_ENERGY_TH_CALORIES " " + IDS_ENERGY_15_C_CALORIES "Калорія 15-градусна" + IDS_ENERGY_BTUS "Британська теплова одиниця" + IDS_ENERGY_ERGS "Ерг" + IDS_ENERGY_EVS "Електронвольт" + IDS_ENERGY_FOOT_POUNDS "Футо-фунт" + IDS_ENERGY_IT_CALORIES "Калорія міжнародна" + IDS_ENERGY_IT_KILOCALORIES "Кілокалорія міжнародна" + IDS_ENERGY_JOULES "Джоуль" + IDS_ENERGY_KILOJOULES "Кілоджоуль" + IDS_ENERGY_KILOWATT_HOURS "Кіловат за годину" + IDS_ENERGY_NUTRITION_CALORIES "Калорія харчова" + IDS_ENERGY_TH_CALORIES "Калорія термохімічна" END // TYPES OF LENGTHS STRINGTABLE DISCARDABLE BEGIN - IDS_LENGTH_ANGSTROMS "" - IDS_LENGTH_ASTRONOMICAL_UNITS " " - IDS_LENGTH_BARLEYCORNS "" - IDS_LENGTH_CENTIMETERS "" - IDS_LENGTH_CHAINS_UK " ()" - IDS_LENGTH_CHI "׳" - IDS_LENGTH_CHOU "" - IDS_LENGTH_CHR "" - IDS_LENGTH_CUN "" - IDS_LENGTH_FATHOMS "" - IDS_LENGTH_FATHOMS_HUNGARY " ()" - IDS_LENGTH_FEET "" - IDS_LENGTH_FURLONGS "" - IDS_LENGTH_GAN "" - IDS_LENGTH_HANDS "" - IDS_LENGTH_HUNH "" - IDS_LENGTH_INCHES "" - IDS_LENGTH_JA "" - IDS_LENGTH_JEONG "" - IDS_LENGTH_KABIET "ᒺ" - IDS_LENGTH_KEN "" - IDS_LENGTH_KEUB "" - IDS_LENGTH_KILOMETERS "ʳ" - IDS_LENGTH_LAR "" - IDS_LENGTH_LIGHT_YEARS " " - IDS_LENGTH_LINKS_UK "˳ ()" - IDS_LENGTH_METERS "" - IDS_LENGTH_MICRONS "̳" - IDS_LENGTH_MILES "" - IDS_LENGTH_MILLIMETERS "̳" - IDS_LENGTH_NAUTICAL_MILES " " - IDS_LENGTH_NIEU "" - IDS_LENGTH_PARSECS "" - IDS_LENGTH_PICAS "ϳ" - IDS_LENGTH_RI_JAPAN "г ()" - IDS_LENGTH_RI_KOREA "г ()" - IDS_LENGTH_RODS "" - IDS_LENGTH_SAWK "" - IDS_LENGTH_SEN "" - IDS_LENGTH_SHAKU "" - IDS_LENGTH_SPAN "" - IDS_LENGTH_SUN "" - IDS_LENGTH_TSUEN "" - IDS_LENGTH_VA "" - IDS_LENGTH_YARDS "" - IDS_LENGTH_YOTE "" - IDS_LENGTH_ZHANG "" + IDS_LENGTH_ANGSTROMS "Ангстрем" + IDS_LENGTH_ASTRONOMICAL_UNITS "Астрономічна одиниця" + IDS_LENGTH_BARLEYCORNS "Барлейкорн" + IDS_LENGTH_CENTIMETERS "Сантиметр" + IDS_LENGTH_CHAINS_UK "Чейн (британський)" + IDS_LENGTH_CHI "Чі" + IDS_LENGTH_CHOU "Чоу" + IDS_LENGTH_CHR "Ча" + IDS_LENGTH_CUN "Цунь" + IDS_LENGTH_FATHOMS "Фатом" + IDS_LENGTH_FATHOMS_HUNGARY "Фатом (угорський)" + IDS_LENGTH_FEET "Фут" + IDS_LENGTH_FURLONGS "Фарлонг" + IDS_LENGTH_GAN "Гань" + IDS_LENGTH_HANDS "Долоня" + IDS_LENGTH_HUNH "Ханх" + IDS_LENGTH_INCHES "Дюйм" + IDS_LENGTH_JA "Я" + IDS_LENGTH_JEONG "Джеонг" + IDS_LENGTH_KABIET "Каб’єт" + IDS_LENGTH_KEN "Кен" + IDS_LENGTH_KEUB "Кеуб" + IDS_LENGTH_KILOMETERS "Кілометр" + IDS_LENGTH_LAR "Лар" + IDS_LENGTH_LIGHT_YEARS "Світловий рік" + IDS_LENGTH_LINKS_UK "Лінк (британский)" + IDS_LENGTH_METERS "Метр" + IDS_LENGTH_MICRONS "Мікрометр" + IDS_LENGTH_MILES "Миля" + IDS_LENGTH_MILLIMETERS "Міліметр" + IDS_LENGTH_NAUTICAL_MILES "Морська миля" + IDS_LENGTH_NIEU "Ньйо" + IDS_LENGTH_PARSECS "Парсек" + IDS_LENGTH_PICAS "Піка" + IDS_LENGTH_RI_JAPAN "Рі (японська)" + IDS_LENGTH_RI_KOREA "Рі (корейськая)" + IDS_LENGTH_RODS "Род" + IDS_LENGTH_SAWK "Соук" + IDS_LENGTH_SEN "Сен" + IDS_LENGTH_SHAKU "Шаку" + IDS_LENGTH_SPAN "Спан" + IDS_LENGTH_SUN "Сан" + IDS_LENGTH_TSUEN "Тсуен" + IDS_LENGTH_VA "Ва" + IDS_LENGTH_YARDS "Ярд" + IDS_LENGTH_YOTE "Йоут" + IDS_LENGTH_ZHANG "Чжан" END // TYPES OF POWERS STRINGTABLE DISCARDABLE BEGIN - IDS_POWER_BTUS_PER_MINUTE " " - IDS_POWER_FPS_PER_MINUTE "- " - IDS_POWER_HORSEPOWER "ʳ " - IDS_POWER_KILOWATTS "ʳ" - IDS_POWER_MEGAWATTS "" - IDS_POWER_WATTS "" + IDS_POWER_BTUS_PER_MINUTE "Британська теплова одиниця за хвилину" + IDS_POWER_FPS_PER_MINUTE "Футо-фунт за хвилину" + IDS_POWER_HORSEPOWER "Кінська сила" + IDS_POWER_KILOWATTS "Кіловат" + IDS_POWER_MEGAWATTS "Мегават" + IDS_POWER_WATTS "Ват" END // TYPE OF PRESSURES STRINGTABLE DISCARDABLE BEGIN - IDS_PRESSURE_ATMOSPHERES " (Գ)" - IDS_PRESSURE_BARS "" - IDS_PRESSURE_HECTOPASCALS "" - IDS_PRESSURE_KILOPASCALS "ʳ" - IDS_PRESSURE_MM_OF_MERCURY "̳ " - IDS_PRESSURE_PASCALS "" - IDS_PRESSURE_PSI " " + IDS_PRESSURE_ATMOSPHERES "Атмосфера (Фізична)" + IDS_PRESSURE_BARS "Бар" + IDS_PRESSURE_HECTOPASCALS "Гектопаскаль" + IDS_PRESSURE_KILOPASCALS "Кілопаскаль" + IDS_PRESSURE_MM_OF_MERCURY "Міліметр ртутного стовпчика" + IDS_PRESSURE_PASCALS "Паскаль" + IDS_PRESSURE_PSI "Фунт на квадратний дюйм" END // TYPES OF TEMPERATURES STRINGTABLE DISCARDABLE BEGIN - IDS_TEMPERATURE_CELSIUS " ( )" - IDS_TEMPERATURE_FAHRENHEIT " ( )" - IDS_TEMPERATURE_KELVIN " ( )" - IDS_TEMPERATURE_RANKINE " ( )" + IDS_TEMPERATURE_CELSIUS "Градус (за шкалою Цельсія)" + IDS_TEMPERATURE_FAHRENHEIT "Градус (за шкалою Фаренгейта)" + IDS_TEMPERATURE_KELVIN "Градус (за шкалою Кельвіна)" + IDS_TEMPERATURE_RANKINE "Градус (за шкалою Ранкіна)" END // TYPES OF TIME STRINGTABLE DISCARDABLE BEGIN - IDS_TIME_DAYS "" - IDS_TIME_HOURS "" + IDS_TIME_DAYS "Доба" + IDS_TIME_HOURS "Година" IDS_TIME_NANOSECONDS "Nanoseconds" - IDS_TIME_MICROSECONDS "̳" - IDS_TIME_MILLISECONDS "̳" - IDS_TIME_MINUTES "" - IDS_TIME_SECONDS "" - IDS_TIME_WEEKS "" - IDS_TIME_YEARS "г" + IDS_TIME_MICROSECONDS "Мікросекунда" + IDS_TIME_MILLISECONDS "Мілісекунда" + IDS_TIME_MINUTES "Хвилина" + IDS_TIME_SECONDS "Секунда" + IDS_TIME_WEEKS "Тиждень" + IDS_TIME_YEARS "Рік" END // TYPES OF VELOCITIES STRINGTABLE DISCARDABLE BEGIN - IDS_VELOCITY_CMS_SECOND " " - IDS_VELOCITY_FEET_HOUR " " - IDS_VELOCITY_FEET_SECOND " " - IDS_VELOCITY_KILOMETERS_HOUR "ʳ " - IDS_VELOCITY_KNOTS "" - IDS_VELOCITY_MACH "" - IDS_VELOCITY_METERS_SECOND " " - IDS_VELOCITY_MILES_HOUR " " + IDS_VELOCITY_CMS_SECOND "Сантиметр за годину" + IDS_VELOCITY_FEET_HOUR "Фут за годину" + IDS_VELOCITY_FEET_SECOND "Фут за секунду" + IDS_VELOCITY_KILOMETERS_HOUR "Кілометр за годину" + IDS_VELOCITY_KNOTS "Вузол" + IDS_VELOCITY_MACH "Мах" + IDS_VELOCITY_METERS_SECOND "Метр за секунду" + IDS_VELOCITY_MILES_HOUR "Миля за годину" END // TYPES OF VOLUMES STRINGTABLE DISCARDABLE BEGIN - IDS_VOLUME_BARRELS_UK " ()" - IDS_VOLUME_BARRELS_OIL " " - IDS_VOLUME_BUN "" - IDS_VOLUME_BUSHELS_UK " ()" - IDS_VOLUME_BUSHELS_US " ()" - IDS_VOLUME_CUBIC_CENTIMETERS " " - IDS_VOLUME_CUBIC_FEET " " - IDS_VOLUME_CUBIC_INCHES " " - IDS_VOLUME_CUBIC_METERS " " - IDS_VOLUME_CUBIC_YARDS " " - IDS_VOLUME_DOE "" - IDS_VOLUME_FLUID_OUNCES_UK "г ()" - IDS_VOLUME_FLUID_OUNCES_US "г ()" - IDS_VOLUME_GALLONS_UK " ()" - IDS_VOLUME_GALLONS_DRY_US " ( , )" - IDS_VOLUME_GALLONS_LIQUID_US " ( , )" - IDS_VOLUME_GOU "" - IDS_VOLUME_HOP "" - IDS_VOLUME_ICCE "" - IDS_VOLUME_KWIAN "" - IDS_VOLUME_LITERS "˳" - IDS_VOLUME_MAL "" - IDS_VOLUME_MILLILITERS "̳" - IDS_VOLUME_PINTS_UK "ϳ ()" - IDS_VOLUME_PINTS_DRY_US "ϳ ( , )" - IDS_VOLUME_PINTS_LIQUID_US "ϳ ( , )" - IDS_VOLUME_QUARTS_UK " ()" - IDS_VOLUME_QUARTS_DRY_US " ( , )" - IDS_VOLUME_QUARTS_LIQUID_US " ( , )" - IDS_VOLUME_SEKI "" - IDS_VOLUME_SYOU "" - IDS_VOLUME_TANANLOUNG "" - IDS_VOLUME_TANG "" - IDS_VOLUME_TO "" + IDS_VOLUME_BARRELS_UK "Барель (британський)" + IDS_VOLUME_BARRELS_OIL "Барель нафти" + IDS_VOLUME_BUN "Бун" + IDS_VOLUME_BUSHELS_UK "Бушель (британський)" + IDS_VOLUME_BUSHELS_US "Бушель (США)" + IDS_VOLUME_CUBIC_CENTIMETERS "Кубічний сантиметр" + IDS_VOLUME_CUBIC_FEET "Кубічний фут" + IDS_VOLUME_CUBIC_INCHES "Кубічний дюйм" + IDS_VOLUME_CUBIC_METERS "Кубічний метр" + IDS_VOLUME_CUBIC_YARDS "Кубічний ярд" + IDS_VOLUME_DOE "То" + IDS_VOLUME_FLUID_OUNCES_UK "Рідка унція (британська)" + IDS_VOLUME_FLUID_OUNCES_US "Рідка унція (США)" + IDS_VOLUME_GALLONS_UK "Галон (британський)" + IDS_VOLUME_GALLONS_DRY_US "Галон (для сухих речовин, США)" + IDS_VOLUME_GALLONS_LIQUID_US "Галон (для рідин, США)" + IDS_VOLUME_GOU "Гоу" + IDS_VOLUME_HOP "Хоп" + IDS_VOLUME_ICCE "Ікке" + IDS_VOLUME_KWIAN "Квіан" + IDS_VOLUME_LITERS "Літр" + IDS_VOLUME_MAL "Маль" + IDS_VOLUME_MILLILITERS "Мілілітр" + IDS_VOLUME_PINTS_UK "Пінта (британська)" + IDS_VOLUME_PINTS_DRY_US "Пінта (для сухих речовин, США)" + IDS_VOLUME_PINTS_LIQUID_US "Пінта (для рідин, США)" + IDS_VOLUME_QUARTS_UK "Кварта (британська)" + IDS_VOLUME_QUARTS_DRY_US "Кварта (для сухих речовин, США)" + IDS_VOLUME_QUARTS_LIQUID_US "Кварта (для рідин, США)" + IDS_VOLUME_SEKI "Секі" + IDS_VOLUME_SYOU "Сьо" + IDS_VOLUME_TANANLOUNG "Тананлунг" + IDS_VOLUME_TANG "Танг" + IDS_VOLUME_TO "Ту" END // TYPES OF WEIGHTS STRINGTABLE DISCARDABLE BEGIN - IDS_WEIGHT_BAHT "" - IDS_WEIGHT_CARATS "" - IDS_WEIGHT_CHUNG "" - IDS_WEIGHT_DON "" - IDS_WEIGHT_GEUN "" - IDS_WEIGHT_GRAMS "" - IDS_WEIGHT_GWAN "" - IDS_WEIGHT_HARB "" - IDS_WEIGHT_JIN_CHINA " ()" - IDS_WEIGHT_JIN_TAIWAN " ()" - IDS_WEIGHT_KAN "" - IDS_WEIGHT_KILOGRAMS "ʳ" - IDS_WEIGHT_KIN "ʳ" - IDS_WEIGHT_LIANG_CHINA "˳ ()" - IDS_WEIGHT_LIANG_TAIWAN "˳ ()" - IDS_WEIGHT_MONME "" - IDS_WEIGHT_OUNCES_AVOIRDUPOIS " ()" - IDS_WEIGHT_OUNCES_TROY " ()" - IDS_WEIGHT_POUNDS "" - IDS_WEIGHT_QUINTAL_METRIC " ()" - IDS_WEIGHT_SALOUNG "" - IDS_WEIGHT_STONES "" - IDS_WEIGHT_TAMLUNG "" - IDS_WEIGHT_TONNES "" - IDS_WEIGHT_TONS_UK " ()" - IDS_WEIGHT_TONS_US " ()" + IDS_WEIGHT_BAHT "Бат" + IDS_WEIGHT_CARATS "Карат" + IDS_WEIGHT_CHUNG "Чанг" + IDS_WEIGHT_DON "Дон" + IDS_WEIGHT_GEUN "Джин" + IDS_WEIGHT_GRAMS "Грам" + IDS_WEIGHT_GWAN "Кван" + IDS_WEIGHT_HARB "Хап" + IDS_WEIGHT_JIN_CHINA "Джин (китайський)" + IDS_WEIGHT_JIN_TAIWAN "Джин (тайванський)" + IDS_WEIGHT_KAN "Кан" + IDS_WEIGHT_KILOGRAMS "Кілограм" + IDS_WEIGHT_KIN "Кін" + IDS_WEIGHT_LIANG_CHINA "Ліанг (китайський)" + IDS_WEIGHT_LIANG_TAIWAN "Ліанг (тайванський)" + IDS_WEIGHT_MONME "Монм" + IDS_WEIGHT_OUNCES_AVOIRDUPOIS "Унція (торгівельна)" + IDS_WEIGHT_OUNCES_TROY "Унція (тройська)" + IDS_WEIGHT_POUNDS "Фунт" + IDS_WEIGHT_QUINTAL_METRIC "Квінтал (метричний)" + IDS_WEIGHT_SALOUNG "Салунг" + IDS_WEIGHT_STONES "Стоун" + IDS_WEIGHT_TAMLUNG "тамлунг" + IDS_WEIGHT_TONNES "Тонна" + IDS_WEIGHT_TONS_UK "Тонна (британська)" + IDS_WEIGHT_TONS_US "Тонна (США)" END diff --git a/base/applications/calc/lang/zh-CN.rc b/base/applications/calc/lang/zh-CN.rc new file mode 100644 index 00000000000..117d7b8f3ec --- /dev/null +++ b/base/applications/calc/lang/zh-CN.rc @@ -0,0 +1,738 @@ +/* + * Simplified Chinese translation for calc + * + * By: Song Fuchang (0xfc) + */ + +LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED + +// Dialog + +IDD_DIALOG_SCIENTIFIC DIALOGEX 0, 0, 316, 161 +STYLE DS_SHELLFONT | WS_MINIMIZEBOX | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "ReactOS 计算器" +MENU IDR_MENU_SCIENTIFIC_1 +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + GROUPBOX "",IDC_STATIC,4,16,132,21 + CONTROL "Hex",IDC_RADIO_HEX,"Button",BS_AUTORADIOBUTTON,8,24,29,10 + CONTROL "Dec",IDC_RADIO_DEC,"Button",BS_AUTORADIOBUTTON,40,24,29,10 + CONTROL "Oct",IDC_RADIO_OCT,"Button",BS_AUTORADIOBUTTON,72,24,27,10 + CONTROL "Bin",IDC_RADIO_BIN,"Button",BS_AUTORADIOBUTTON,100,24,26,10 + GROUPBOX "",IDC_STATIC,4,36,76,21 + CONTROL "Inv",IDC_CHECK_INV,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,8,44,26,10 + CONTROL "Hyp",IDC_CHECK_HYP,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,40,44,29,10 + CTEXT "",IDC_TEXT_PARENT,84,40,24,17,SS_CENTERIMAGE, + WS_EX_CLIENTEDGE + CTEXT "",IDC_TEXT_MEMORY,112,40,24,17,SS_CENTERIMAGE, + WS_EX_CLIENTEDGE + PUSHBUTTON "Sta",IDC_BUTTON_STA,4,64,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "Ave",IDC_BUTTON_AVE,4,83,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | WS_DISABLED | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "Sum",IDC_BUTTON_SUM,4,102,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | WS_DISABLED | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "s",IDC_BUTTON_S,4,121,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | WS_DISABLED | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "Dat",IDC_BUTTON_DAT,4,140,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | WS_DISABLED | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "F-E",IDC_BUTTON_FE,38,64,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "dms",IDC_BUTTON_DMS,38,83,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "sin",IDC_BUTTON_SIN,38,102,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "cos",IDC_BUTTON_COS,38,121,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "tan",IDC_BUTTON_TAN,38,140,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "(",IDC_BUTTON_LEFTPAR,64,64,24,17,BS_CENTER | + BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "Exp",IDC_BUTTON_EXP,64,83,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "x^y",IDC_BUTTON_XeY,64,102,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "x^2",IDC_BUTTON_Xe2,64,121,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "x^3",IDC_BUTTON_Xe3,64,140,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON ")",IDC_BUTTON_RIGHTPAR,90,64,24,17,BS_CENTER | + BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "ln",IDC_BUTTON_LN,90,83,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "log",IDC_BUTTON_LOG,90,102,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "n!",IDC_BUTTON_NF,90,121,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "1/x",IDC_BUTTON_RX,90,140,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "MC",IDC_BUTTON_MC,124,64,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "MR",IDC_BUTTON_MR,124,83,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "MS",IDC_BUTTON_MS,124,102,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "M+",IDC_BUTTON_MP,124,121,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "pi",IDC_BUTTON_PI,124,140,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "7",IDC_BUTTON_7,158,64,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "4",IDC_BUTTON_4,158,83,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "1",IDC_BUTTON_1,158,102,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "0",IDC_BUTTON_0,158,121,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "A",IDC_BUTTON_A,158,140,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "8",IDC_BUTTON_8,184,64,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "5",IDC_BUTTON_5,184,83,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "2",IDC_BUTTON_2,184,102,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "+/-",IDC_BUTTON_SIGN,184,121,24,17,BS_CENTER | + BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "B",IDC_BUTTON_B,184,140,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "9",IDC_BUTTON_9,210,64,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "6",IDC_BUTTON_6,210,83,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "3",IDC_BUTTON_3,210,102,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON ",",IDC_BUTTON_DOT,210,121,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "C",IDC_BUTTON_C,210,140,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "/",IDC_BUTTON_DIV,236,64,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "*",IDC_BUTTON_MULT,236,83,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "-",IDC_BUTTON_SUB,236,102,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "+",IDC_BUTTON_ADD,236,121,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "D",IDC_BUTTON_D,236,140,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "Mod",IDC_BUTTON_MOD,262,64,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "Or",IDC_BUTTON_OR,262,83,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "Lsh",IDC_BUTTON_LSH,262,102,24,17,BS_CENTER | + BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "=",IDC_BUTTON_EQU,262,121,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "E",IDC_BUTTON_E,262,140,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "And",IDC_BUTTON_AND,288,64,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "Xor",IDC_BUTTON_XOR,288,83,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "Not",IDC_BUTTON_NOT,288,102,24,17,BS_CENTER | + BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "Int",IDC_BUTTON_INT,288,121,24,17,BS_CENTER | + BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "F",IDC_BUTTON_F,288,140,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + GROUPBOX "",IDC_STATIC,140,16,172,21 + CONTROL "四字",IDC_RADIO_QWORD,"Button",BS_AUTORADIOBUTTON | + NOT WS_VISIBLE,148,24,37,10 + CONTROL "双字",IDC_RADIO_DWORD,"Button",BS_AUTORADIOBUTTON | + NOT WS_VISIBLE,188,24,37,10 + CONTROL "字",IDC_RADIO_WORD,"Button",BS_AUTORADIOBUTTON | NOT + WS_VISIBLE,232,24,33,10 + CONTROL "字节",IDC_RADIO_BYTE,"Button",BS_AUTORADIOBUTTON | NOT + WS_VISIBLE,272,24,30,10 + CONTROL "角度",IDC_RADIO_DEG,"Button",BS_AUTORADIOBUTTON,148,24, + 42,10 + CONTROL "弧度",IDC_RADIO_RAD,"Button",BS_AUTORADIOBUTTON,192, + 24,42,10 + CONTROL "梯度",IDC_RADIO_GRAD,"Button",BS_AUTORADIOBUTTON, + 236,24,44,10 + PUSHBUTTON "C",IDC_BUTTON_CANC,272,40,40,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "CE",IDC_BUTTON_CE,228,40,40,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "Back",IDC_BUTTON_BACK,184,40,40,17,BS_CENTER | + BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + RTEXT "",IDC_TEXT_OUTPUT,4,4,308,12,SS_CENTERIMAGE, + WS_EX_CLIENTEDGE + DEFPUSHBUTTON "",IDC_BUTTON_FOCUS,0,0,5,5, NOT WS_VISIBLE +END + +IDD_DIALOG_STANDARD DIALOGEX 0, 0, 172, 127 +STYLE DS_SHELLFONT | WS_MINIMIZEBOX | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "ReactOS 计算器" +MENU IDR_MENU_STANDARD +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + PUSHBUTTON "C",IDC_BUTTON_CANC,128,24,40,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "CE",IDC_BUTTON_CE,84,24,40,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "Back",IDC_BUTTON_BACK,40,24,40,17,BS_CENTER | + BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + RTEXT "",IDC_TEXT_OUTPUT,4,4,164,12,SS_CENTERIMAGE, + WS_EX_CLIENTEDGE + PUSHBUTTON "7",IDC_BUTTON_7,40,48,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "4",IDC_BUTTON_4,40,67,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "1",IDC_BUTTON_1,40,86,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "0",IDC_BUTTON_0,40,105,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "8",IDC_BUTTON_8,66,48,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "5",IDC_BUTTON_5,66,67,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "2",IDC_BUTTON_2,66,86,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "+/-",IDC_BUTTON_SIGN,66,105,24,17,BS_CENTER | + BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "9",IDC_BUTTON_9,92,48,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "6",IDC_BUTTON_6,92,67,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "3",IDC_BUTTON_3,92,86,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON ",",IDC_BUTTON_DOT,92,105,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "/",IDC_BUTTON_DIV,118,48,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "*",IDC_BUTTON_MULT,118,67,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "-",IDC_BUTTON_SUB,118,86,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "+",IDC_BUTTON_ADD,118,105,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "Sqrt",IDC_BUTTON_SQRT,144,48,24,17,BS_CENTER | + BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "%",IDC_BUTTON_PERCENT,144,67,24,17,BS_CENTER | + BS_VCENTER | BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "1/x",IDC_BUTTON_RX,144,86,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "=",IDC_BUTTON_EQU,144,105,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + CTEXT "",IDC_TEXT_MEMORY,4,24,24,17,SS_CENTERIMAGE, + WS_EX_CLIENTEDGE + PUSHBUTTON "MC",IDC_BUTTON_MC,4,48,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "MR",IDC_BUTTON_MR,4,67,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "MS",IDC_BUTTON_MS,4,86,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + PUSHBUTTON "M+",IDC_BUTTON_MP,4,105,24,17,BS_CENTER | BS_VCENTER | + BS_NOTIFY | BS_OWNERDRAW | WS_TABSTOP + DEFPUSHBUTTON "",IDC_BUTTON_FOCUS,0,0,5,5, NOT WS_VISIBLE +END + +IDD_DIALOG_CONVERSION DIALOGEX 0, 0, 320, 130 +STYLE DS_SHELLFONT | WS_MINIMIZEBOX | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "ReactOS 计算器" +MENU IDR_MENU_STANDARD +FONT 8, "MS Shell Dlg" +BEGIN + PUSHBUTTON "转换",IDC_BUTTON_CONVERT,35,105,76,17 + COMBOBOX IDC_COMBO_CATEGORY,4,31,140,168,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP | CBS_SORT + LTEXT "类别:",IDC_STATIC,4,20,56,8 + COMBOBOX IDC_COMBO_FROM,4,60,140,168,CBS_DROPDOWNLIST | + WS_VSCROLL | WS_TABSTOP | CBS_SORT + LTEXT "从...转换:",IDC_STATIC,4,49,56,8 + COMBOBOX IDC_COMBO_TO,4,87,140,168,CBS_DROPDOWNLIST | WS_VSCROLL | + WS_TABSTOP | CBS_SORT + LTEXT "转换为:",IDC_STATIC,4,76,56,8 + CONTROL "C",IDC_BUTTON_CANC,"Button",BS_OWNERDRAW | BS_CENTER | + BS_VCENTER | BS_NOTIFY | WS_TABSTOP,276,24,40,17 + CONTROL "CE",IDC_BUTTON_CE,"Button",BS_OWNERDRAW | BS_CENTER | + BS_VCENTER | BS_NOTIFY | WS_TABSTOP,232,24,40,17 + CONTROL "Back",IDC_BUTTON_BACK,"Button",BS_OWNERDRAW | + BS_CENTER | BS_VCENTER | BS_NOTIFY | WS_TABSTOP,188,24, + 40,17 + RTEXT "",IDC_TEXT_OUTPUT,4,4,312,12,SS_CENTERIMAGE, + WS_EX_CLIENTEDGE + CONTROL "7",IDC_BUTTON_7,"Button",BS_OWNERDRAW | BS_CENTER | + BS_VCENTER | BS_NOTIFY | WS_TABSTOP,188,48,24,17 + CONTROL "4",IDC_BUTTON_4,"Button",BS_OWNERDRAW | BS_CENTER | + BS_VCENTER | BS_NOTIFY | WS_TABSTOP,188,67,24,17 + CONTROL "1",IDC_BUTTON_1,"Button",BS_OWNERDRAW | BS_CENTER | + BS_VCENTER | BS_NOTIFY | WS_TABSTOP,188,86,24,17 + CONTROL "0",IDC_BUTTON_0,"Button",BS_OWNERDRAW | BS_CENTER | + BS_VCENTER | BS_NOTIFY | WS_TABSTOP,188,105,24,17 + CONTROL "8",IDC_BUTTON_8,"Button",BS_OWNERDRAW | BS_CENTER | + BS_VCENTER | BS_NOTIFY | WS_TABSTOP,214,48,24,17 + CONTROL "5",IDC_BUTTON_5,"Button",BS_OWNERDRAW | BS_CENTER | + BS_VCENTER | BS_NOTIFY | WS_TABSTOP,214,67,24,17 + CONTROL "2",IDC_BUTTON_2,"Button",BS_OWNERDRAW | BS_CENTER | + BS_VCENTER | BS_NOTIFY | WS_TABSTOP,214,86,24,17 + CONTROL "+/-",IDC_BUTTON_SIGN,"Button",BS_OWNERDRAW | BS_CENTER | + BS_VCENTER | BS_NOTIFY | WS_TABSTOP,214,105,24,17 + CONTROL "9",IDC_BUTTON_9,"Button",BS_OWNERDRAW | BS_CENTER | + BS_VCENTER | BS_NOTIFY | WS_TABSTOP,240,48,24,17 + CONTROL "6",IDC_BUTTON_6,"Button",BS_OWNERDRAW | BS_CENTER | + BS_VCENTER | BS_NOTIFY | WS_TABSTOP,240,67,24,17 + CONTROL "3",IDC_BUTTON_3,"Button",BS_OWNERDRAW | BS_CENTER | + BS_VCENTER | BS_NOTIFY | WS_TABSTOP,240,86,24,17 + CONTROL ",",IDC_BUTTON_DOT,"Button",BS_OWNERDRAW | BS_CENTER | + BS_VCENTER | BS_NOTIFY | WS_TABSTOP,240,105,24,17 + CONTROL "/",IDC_BUTTON_DIV,"Button",BS_OWNERDRAW | BS_CENTER | + BS_VCENTER | BS_NOTIFY | WS_TABSTOP,266,48,24,17 + CONTROL "*",IDC_BUTTON_MULT,"Button",BS_OWNERDRAW | BS_CENTER | + BS_VCENTER | BS_NOTIFY | WS_TABSTOP,266,67,24,17 + CONTROL "-",IDC_BUTTON_SUB,"Button",BS_OWNERDRAW | BS_CENTER | + BS_VCENTER | BS_NOTIFY | WS_TABSTOP,266,86,24,17 + CONTROL "+",IDC_BUTTON_ADD,"Button",BS_OWNERDRAW | BS_CENTER | + BS_VCENTER | BS_NOTIFY | WS_TABSTOP,266,105,24,17 + CONTROL "Sqrt",IDC_BUTTON_SQRT,"Button",BS_OWNERDRAW | BS_CENTER | + BS_VCENTER | BS_NOTIFY | WS_TABSTOP,292,48,24,17 + CONTROL "%",IDC_BUTTON_PERCENT,"Button",BS_OWNERDRAW | BS_CENTER | + BS_VCENTER | BS_NOTIFY | WS_TABSTOP,292,67,24,17 + CONTROL "1/x",IDC_BUTTON_RX,"Button",BS_OWNERDRAW | BS_CENTER | + BS_VCENTER | BS_NOTIFY | WS_TABSTOP,292,86,24,17 + CONTROL "=",IDC_BUTTON_EQU,"Button",BS_OWNERDRAW | BS_CENTER | + BS_VCENTER | BS_NOTIFY | WS_TABSTOP,292,105,24,17 + CTEXT "",IDC_TEXT_MEMORY,152,24,24,17,SS_CENTERIMAGE, + WS_EX_CLIENTEDGE + CONTROL "MC",IDC_BUTTON_MC,"Button",BS_OWNERDRAW | BS_CENTER | + BS_VCENTER | BS_NOTIFY | WS_TABSTOP,152,48,24,17 + CONTROL "MR",IDC_BUTTON_MR,"Button",BS_OWNERDRAW | BS_CENTER | + BS_VCENTER | BS_NOTIFY | WS_TABSTOP,152,67,24,17 + CONTROL "MS",IDC_BUTTON_MS,"Button",BS_OWNERDRAW | BS_CENTER | + BS_VCENTER | BS_NOTIFY | WS_TABSTOP,152,86,24,17 + CONTROL "M+",IDC_BUTTON_MP,"Button",BS_OWNERDRAW | BS_CENTER | + BS_VCENTER | BS_NOTIFY | WS_TABSTOP,152,105,24,17 + DEFPUSHBUTTON "",IDC_BUTTON_FOCUS,0,0,5,5,NOT WS_VISIBLE +END + +IDD_DIALOG_ABOUT DIALOGEX DISCARDABLE 0, 0, 264, 169 +STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "关于 ReactOS 计算器" +FONT 8, "MS Shell Dlg" +BEGIN + DEFPUSHBUTTON "确定",IDOK,105,148,52,16 + CONTROL IDB_BITMAP_ROS,IDC_STATIC,"Static",SS_BITMAP | SS_CENTERIMAGE | + SS_REALSIZEIMAGE | WS_BORDER,4,4,104,48 + LTEXT "ReactOS 计算器",IDC_STATIC,120,12,132,8, + SS_CENTERIMAGE + LTEXT "版本 ",IDC_TEXT_VERSION,120,20,132,8,SS_CENTERIMAGE + LTEXT "作者 Carlo Bramini",IDC_STATIC,120,32,132,8, + SS_CENTERIMAGE + GROUPBOX "",IDC_STATIC,112,0,148,52 + GROUPBOX "",IDC_STATIC,4,56,256,88 + EDITTEXT IDC_EDIT_LICENSE,12,68,240,68,ES_MULTILINE | ES_READONLY | + WS_VSCROLL +END + +IDD_DIALOG_STAT DIALOGEX DISCARDABLE 0, 0, 163, 85 +STYLE DS_SHELLFONT | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "统计框" +FONT 8, "MS Shell Dlg" +BEGIN + LISTBOX IDC_LIST_STAT,4,4,156,40,LBS_NOINTEGRALHEIGHT | + WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "返回",IDC_BUTTON_RET,4,48,36,16 + PUSHBUTTON "加载",IDC_BUTTON_LOAD,44,48,36,16 + PUSHBUTTON "清除",IDC_BUTTON_CD,84,48,36,16 + PUSHBUTTON "全清",IDC_BUTTON_CAD,124,48,36,16 + CTEXT "n=0",IDC_TEXT_NITEMS,4,68,156,12,SS_CENTERIMAGE | + SS_SUNKEN +END + +// Menus + +IDR_MENU_SCIENTIFIC_1 MENU DISCARDABLE +BEGIN + POPUP "编辑" + BEGIN + MENUITEM "复制\tCtrl+C", IDM_EDIT_COPY + MENUITEM "粘贴\tCtrl+V", IDM_EDIT_PASTE + END + POPUP "查看" + BEGIN + MENUITEM "标准型", IDM_VIEW_STANDARD, CHECKED + MENUITEM "科学型", IDM_VIEW_SCIENTIFIC, CHECKED + MENUITEM "转换", IDM_VIEW_CONVERSION + MENUITEM SEPARATOR + MENUITEM "十六进制\tF5", IDM_VIEW_HEX, CHECKED + MENUITEM "十进制\tF6", IDM_VIEW_DEC, CHECKED + MENUITEM "八进制\tF7", IDM_VIEW_OCT, CHECKED + MENUITEM "二进制\tF8", IDM_VIEW_BIN, CHECKED + MENUITEM SEPARATOR + MENUITEM "角度\tF2", IDM_VIEW_DEG, CHECKED + MENUITEM "弧度\tF3", IDM_VIEW_RAD, CHECKED + MENUITEM "梯度\tF4", IDM_VIEW_GRAD, CHECKED + MENUITEM SEPARATOR + MENUITEM "数字分组", IDM_VIEW_GROUP, CHECKED + END + POPUP "帮助" + BEGIN + MENUITEM "帮助主题", IDM_HELP_HELP + MENUITEM SEPARATOR + MENUITEM "关于 ReactOS 计算器", IDM_HELP_ABOUT + END +END + +IDR_MENU_SCIENTIFIC_2 MENU DISCARDABLE +BEGIN + POPUP "编辑" + BEGIN + MENUITEM "复制\tCtrl+C", IDM_EDIT_COPY + MENUITEM "粘贴\tCtrl+V", IDM_EDIT_PASTE + END + POPUP "查看" + BEGIN + MENUITEM "标准型", IDM_VIEW_STANDARD, CHECKED + MENUITEM "科学型", IDM_VIEW_SCIENTIFIC, CHECKED + MENUITEM "转换", IDM_VIEW_CONVERSION + MENUITEM SEPARATOR + MENUITEM "十六进制\tF5", IDM_VIEW_HEX, CHECKED + MENUITEM "十进制\tF6", IDM_VIEW_DEC, CHECKED + MENUITEM "八进制\tF7", IDM_VIEW_OCT, CHECKED + MENUITEM "二进制\tF8", IDM_VIEW_BIN, CHECKED + MENUITEM SEPARATOR + MENUITEM "四字\tF12", IDM_VIEW_QWORD, CHECKED + MENUITEM "双字\tF2", IDM_VIEW_DWORD, CHECKED + MENUITEM "字\tF3", IDM_VIEW_WORD, CHECKED + MENUITEM "字节\tF4", IDM_VIEW_BYTE, CHECKED + MENUITEM SEPARATOR + MENUITEM "数字分组", IDM_VIEW_GROUP, CHECKED + END + POPUP "帮助" + BEGIN + MENUITEM "帮助主题", IDM_HELP_HELP + MENUITEM SEPARATOR + MENUITEM "关于 ReactOS 计算器", IDM_HELP_ABOUT + END +END + +IDR_MENU_STANDARD MENU DISCARDABLE +BEGIN + POPUP "编辑" + BEGIN + MENUITEM "复制\tCtrl+C", IDM_EDIT_COPY + MENUITEM "粘贴\tCtrl+V", IDM_EDIT_PASTE + END + POPUP "查看" + BEGIN + MENUITEM "标准型", IDM_VIEW_STANDARD, CHECKED + MENUITEM "科学型", IDM_VIEW_SCIENTIFIC, CHECKED + MENUITEM "转换", IDM_VIEW_CONVERSION + MENUITEM SEPARATOR + MENUITEM "数字分组", IDM_VIEW_GROUP, CHECKED + END + POPUP "帮助" + BEGIN + MENUITEM "帮助主题", IDM_HELP_HELP + MENUITEM SEPARATOR + MENUITEM "关于 ReactOS 计算器", IDM_HELP_ABOUT + END +END + +// String Tables + +STRINGTABLE DISCARDABLE +BEGIN + IDS_STRING_LICENSE "ReactOS 计算器是在 GNU GPL 协议下发行的自由软件。\r\n\r\n你可以从这儿取得一份 GNU GPL 协议的副本:\r\nhttp://www.gnu.org/licenses/gpl.html\r\n\r\n你也可以从这儿取得其翻译:\r\nhttp://www.gnu.org/licenses/translations.html" + IDS_MATH_ERROR "错误" + IDS_QUICKHELP "快速帮助" +END + +// Types of conversion +STRINGTABLE DISCARDABLE +BEGIN + IDS_CONV_ANGLE "角" + IDS_CONV_AREA "面积" + IDS_CONV_CONSUMPTION "油耗 (引擎)" + IDS_CONV_CURRENCY "货币" + IDS_CONV_ENERGY "能量" + IDS_CONV_LENGTH "长度" + IDS_CONV_POWER "功率" + IDS_CONV_PRESSURE "压力" + IDS_CONV_TEMPERATURE "温度" + IDS_CONV_TIME "时间" + IDS_CONV_VELOCITY "速度" + IDS_CONV_VOLUME "体积" + IDS_CONV_WEIGHT "质量" +END + +// TYPES OF ANGLES +STRINGTABLE DISCARDABLE +BEGIN + IDS_ANGLE_DEGREES "角度" + IDS_ANGLE_GRADIANS "梯度" + IDS_ANGLE_RADIANS "弧度" +END + +// TYPES OF AREAS +STRINGTABLE DISCARDABLE +BEGIN + IDS_AREA_ACRES "英亩" + IDS_AREA_ACRES_BRAZIL "英亩 (巴西)" + IDS_AREA_ACRES_FRANCE "英亩 (法国)" + IDS_AREA_ACRES_SCOTS "英亩 (苏格兰)" + IDS_AREA_ACRES_US "英亩 (美国)" + IDS_AREA_ARES "公亩" + IDS_AREA_CHOU "畴" + IDS_AREA_DANBO "大亩" + IDS_AREA_HECTARES "公顷" + IDS_AREA_JEONGBO "Jeongbo" + IDS_AREA_MORGEN_HUNGARY "摩根 (匈牙利)" + IDS_AREA_MU "亩" + IDS_AREA_PING "坪" + IDS_AREA_PYEONG "坪 (韩国)" + IDS_AREA_PYEONGBANGJA "Pyeongbangja" + IDS_AREA_RAI "莱" + IDS_AREA_SE "亩 (日本)" + IDS_AREA_SQUARE_CENTIMETERS "平方厘米" + IDS_AREA_SQUARE_CHR "Square chr" + IDS_AREA_SQUARE_FATHOMS "平方英寻" + IDS_AREA_SQUARE_FATHOMS_HUNGARY "平方英寻 (匈牙利)" + IDS_AREA_SQUARE_FEET "平方英尺" + IDS_AREA_SQUARE_INCHES "平方英寸" + IDS_AREA_SQUARE_KILOMETERS "平方千米" + IDS_AREA_SQUARE_LAR "平方拉尔" + IDS_AREA_SQUARE_METER "平方米" + IDS_AREA_SQUARE_MILES "平方英里" + IDS_AREA_SQUARE_MILLIMETERS "平方毫米" + IDS_AREA_SQUARE_SHAKU "平方尺" + IDS_AREA_SQUARE_TSUEN "平方寸" + IDS_AREA_SQUARE_VA "Square va" + IDS_AREA_SQUARE_YARD "平方码" + IDS_AREA_TAN "段" + IDS_AREA_TSUBO "坪 (日本)" +END + +// TYPES OF COMSUMPTIONS +STRINGTABLE DISCARDABLE +BEGIN + IDS_CONSUMPTION_KM_PER_L "千米/升" + IDS_CONSUMPTION_L_PER_100_KM "升/100 千米" + IDS_CONSUMPTION_MILES_GALLON_UK "英里/加仑 (英国)" + IDS_CONSUMPTION_MILES_GALLON_US "英里/加仑 (美国)" +END + +// TYPES OF CURRENCIES +STRINGTABLE DISCARDABLE +BEGIN + IDS_CURRENCY_AUSTRIAN_SCHILLING "奥地利先令" + IDS_CURRENCY_BELGIAN_FRANC "比利时法郎" + IDS_CURRENCY_CYPRIOT_POUND "塞浦路斯镑" + IDS_CURRENCY_CZECH_KORUNA "捷克克朗" + IDS_CURRENCY_DEUTSCHE_MARK "德国马克" + IDS_CURRENCY_DUTCH_GUILDER "荷兰盾" + IDS_CURRENCY_EURO "欧元" + IDS_CURRENCY_FINNISH_MARKKA "芬兰马克" + IDS_CURRENCY_FRENCH_FRANC "法郎" + IDS_CURRENCY_GREEK_DRACHMA "希腊德拉克马" + IDS_CURRENCY_IRISH_POUND "爱尔兰镑" + IDS_CURRENCY_ITALIAN_LIRA "意大利里拉" + IDS_CURRENCY_LUXEMBOURG_FRANC "卢森堡法郎" + IDS_CURRENCY_MALTESE_LIRA "马耳他里拉" + IDS_CURRENCY_PORTOGUESE_ESCUDO "葡萄牙埃斯库多" + IDS_CURRENCY_SLOVAK_KORUNA "斯洛伐克克朗" + IDS_CURRENCY_SLOVENIAN_TOLAR "斯洛文尼亚拖拉" + IDS_CURRENCY_SPANISH_PESETA "西班牙比塞塔" +END + +// TYPES OF ENERGIES +STRINGTABLE DISCARDABLE +BEGIN + IDS_ENERGY_15_C_CALORIES "15 °C 卡路里" + IDS_ENERGY_BTUS "英制热量单位" + IDS_ENERGY_ERGS "尔格" + IDS_ENERGY_EVS "电子伏特" + IDS_ENERGY_FOOT_POUNDS "英尺-磅" + IDS_ENERGY_IT_CALORIES "国际蒸汽表卡路里" + IDS_ENERGY_IT_KILOCALORIES "国际蒸汽表千卡路里" + IDS_ENERGY_JOULES "焦耳" + IDS_ENERGY_KILOJOULES "千焦" + IDS_ENERGY_KILOWATT_HOURS "千瓦时" + IDS_ENERGY_NUTRITION_CALORIES "营养卡路里" + IDS_ENERGY_TH_CALORIES "热化学卡路里" +END + +// TYPES OF LENGTHS +STRINGTABLE DISCARDABLE +BEGIN + IDS_LENGTH_ANGSTROMS "埃" + IDS_LENGTH_ASTRONOMICAL_UNITS "天文单位" + IDS_LENGTH_BARLEYCORNS "巴利肯" + IDS_LENGTH_CENTIMETERS "厘米" + IDS_LENGTH_CHAINS_UK "链 (英国)" + IDS_LENGTH_CHI "尺" + IDS_LENGTH_CHOU "畴" + IDS_LENGTH_CHR "Chr" + IDS_LENGTH_CUN "寸" + IDS_LENGTH_FATHOMS "英寻" + IDS_LENGTH_FATHOMS_HUNGARY "英寻 (匈牙利)" + IDS_LENGTH_FEET "英尺" + IDS_LENGTH_FURLONGS "浪" + IDS_LENGTH_GAN "杆" + IDS_LENGTH_HANDS "掌宽" + IDS_LENGTH_HUNH "Hunh" + IDS_LENGTH_INCHES "英尺" + IDS_LENGTH_JA "尺 (韩国)" + IDS_LENGTH_JEONG "Jeong" + IDS_LENGTH_KABIET "Kabiet" + IDS_LENGTH_KEN "Ken" + IDS_LENGTH_KEUB "Keub" + IDS_LENGTH_KILOMETERS "千米" + IDS_LENGTH_LAR "拉尔" + IDS_LENGTH_LIGHT_YEARS "光年" + IDS_LENGTH_LINKS_UK "Links (UK)" + IDS_LENGTH_METERS "米" + IDS_LENGTH_MICRONS "微米" + IDS_LENGTH_MILES "英里" + IDS_LENGTH_MILLIMETERS "毫米" + IDS_LENGTH_NAUTICAL_MILES "海里" + IDS_LENGTH_NIEU "Nieu" + IDS_LENGTH_PARSECS "Parsecs" + IDS_LENGTH_PICAS "Picas" + IDS_LENGTH_RI_JAPAN "里 (日本)" + IDS_LENGTH_RI_KOREA "里 (韩国)" + IDS_LENGTH_RODS "杆" + IDS_LENGTH_SAWK "Sawk" + IDS_LENGTH_SEN "Sen" + IDS_LENGTH_SHAKU "尺 (日本)" + IDS_LENGTH_SPAN "Span" + IDS_LENGTH_SUN "寸 (日本)" + IDS_LENGTH_TSUEN "寸" + IDS_LENGTH_VA "Va" + IDS_LENGTH_YARDS "码" + IDS_LENGTH_YOTE "约特" + IDS_LENGTH_ZHANG "丈" +END + +// TYPES OF POWERS +STRINGTABLE DISCARDABLE +BEGIN + IDS_POWER_BTUS_PER_MINUTE "英制热量单位每分钟" + IDS_POWER_FPS_PER_MINUTE "英尺-磅每分钟" + IDS_POWER_HORSEPOWER "马力" + IDS_POWER_KILOWATTS "千瓦" + IDS_POWER_MEGAWATTS "兆瓦" + IDS_POWER_WATTS "瓦" +END + +// TYPE OF PRESSURES +STRINGTABLE DISCARDABLE +BEGIN + IDS_PRESSURE_ATMOSPHERES "大气压" + IDS_PRESSURE_BARS "巴" + IDS_PRESSURE_HECTOPASCALS "百帕" + IDS_PRESSURE_KILOPASCALS "千帕" + IDS_PRESSURE_MM_OF_MERCURY "毫米汞柱" + IDS_PRESSURE_PASCALS "帕" + IDS_PRESSURE_PSI "英磅-力每平方英尺" +END + +// TYPES OF TEMPERATURES +STRINGTABLE DISCARDABLE +BEGIN + IDS_TEMPERATURE_CELSIUS "摄氏度" + IDS_TEMPERATURE_FAHRENHEIT "华氏度" + IDS_TEMPERATURE_KELVIN "开尔文" + IDS_TEMPERATURE_RANKINE "兰金度" +END + +// TYPES OF TIME +STRINGTABLE DISCARDABLE +BEGIN + IDS_TIME_DAYS "日" + IDS_TIME_HOURS "小时" + IDS_TIME_NANOSECONDS "纳秒" + IDS_TIME_MICROSECONDS "微秒" + IDS_TIME_MILLISECONDS "毫秒" + IDS_TIME_MINUTES "分" + IDS_TIME_SECONDS "秒" + IDS_TIME_WEEKS "周" + IDS_TIME_YEARS "年" +END + +// TYPES OF VELOCITIES +STRINGTABLE DISCARDABLE +BEGIN + IDS_VELOCITY_CMS_SECOND "厘米/小时" + IDS_VELOCITY_FEET_HOUR "英尺/小时" + IDS_VELOCITY_FEET_SECOND "英尺/秒" + IDS_VELOCITY_KILOMETERS_HOUR "千米/小时" + IDS_VELOCITY_KNOTS "节" + IDS_VELOCITY_MACH "马赫" + IDS_VELOCITY_METERS_SECOND "米/秒" + IDS_VELOCITY_MILES_HOUR "英里/小时" +END + +// TYPES OF VOLUMES +STRINGTABLE DISCARDABLE +BEGIN + IDS_VOLUME_BARRELS_UK "桶 (英国)" + IDS_VOLUME_BARRELS_OIL "桶油" + IDS_VOLUME_BUN "Bun" + IDS_VOLUME_BUSHELS_UK "蒲式耳 (英国)" + IDS_VOLUME_BUSHELS_US "蒲式耳 (美国)" + IDS_VOLUME_CUBIC_CENTIMETERS "立方厘米" + IDS_VOLUME_CUBIC_FEET "立方英尺" + IDS_VOLUME_CUBIC_INCHES "立方英寸" + IDS_VOLUME_CUBIC_METERS "立方米" + IDS_VOLUME_CUBIC_YARDS "立方码" + IDS_VOLUME_DOE "Doe" + IDS_VOLUME_FLUID_OUNCES_UK "液盎司 (英国)" + IDS_VOLUME_FLUID_OUNCES_US "液盎司 (美国)" + IDS_VOLUME_GALLONS_UK "加仑 (英国)" + IDS_VOLUME_GALLONS_DRY_US "干量加仑 (美国)" + IDS_VOLUME_GALLONS_LIQUID_US "液加仑 (美国)" + IDS_VOLUME_GOU "合" + IDS_VOLUME_HOP "Hop" + IDS_VOLUME_ICCE "Icce" + IDS_VOLUME_KWIAN "Kwian" + IDS_VOLUME_LITERS "升" + IDS_VOLUME_MAL "Mal" + IDS_VOLUME_MILLILITERS "毫升" + IDS_VOLUME_PINTS_UK "品脱 (英国)" + IDS_VOLUME_PINTS_DRY_US "干量品脱 (美国)" + IDS_VOLUME_PINTS_LIQUID_US "液品脱 (美国)" + IDS_VOLUME_QUARTS_UK "夸脱 (英国)" + IDS_VOLUME_QUARTS_DRY_US "干量夸脱 (美国)" + IDS_VOLUME_QUARTS_LIQUID_US "液夸脱 (美国)" + IDS_VOLUME_SEKI "Seki" + IDS_VOLUME_SYOU "Syou" + IDS_VOLUME_TANANLOUNG "Tananloung" + IDS_VOLUME_TANG "Tang" + IDS_VOLUME_TO "斗 (日本)" +END + +// TYPES OF WEIGHTS +STRINGTABLE DISCARDABLE +BEGIN + IDS_WEIGHT_BAHT "铢" + IDS_WEIGHT_CARATS "克拉" + IDS_WEIGHT_CHUNG "Chung" + IDS_WEIGHT_DON "Don" + IDS_WEIGHT_GEUN "Geun" + IDS_WEIGHT_GRAMS "克" + IDS_WEIGHT_GWAN "Gwan" + IDS_WEIGHT_HARB "Harb" + IDS_WEIGHT_JIN_CHINA "斤 (中国)" + IDS_WEIGHT_JIN_TAIWAN "斤 (中国台湾)" + IDS_WEIGHT_KAN "贯 (日本)" + IDS_WEIGHT_KILOGRAMS "千克" + IDS_WEIGHT_KIN "斤 (日本)" + IDS_WEIGHT_LIANG_CHINA "两 (中国)" + IDS_WEIGHT_LIANG_TAIWAN "两 (中国台湾)" + IDS_WEIGHT_MONME "两 (日本)" + IDS_WEIGHT_OUNCES_AVOIRDUPOIS "常衡盎司" + IDS_WEIGHT_OUNCES_TROY "金衡盎司" + IDS_WEIGHT_POUNDS "英磅" + IDS_WEIGHT_QUINTAL_METRIC "公担" + IDS_WEIGHT_SALOUNG "Saloung" + IDS_WEIGHT_STONES "石" + IDS_WEIGHT_TAMLUNG "Tamlung" + IDS_WEIGHT_TONNES "吨" + IDS_WEIGHT_TONS_UK "吨 (英国)" + IDS_WEIGHT_TONS_US "吨 (美国)" +END diff --git a/base/applications/calc/resource.rc b/base/applications/calc/resource.rc index 1af2e073dfd..c42d398fa4d 100644 --- a/base/applications/calc/resource.rc +++ b/base/applications/calc/resource.rc @@ -44,26 +44,26 @@ IDI_CALC_SMALL ICON DISCARDABLE "res/calc_sm.ico" IDB_BITMAP_ROS BITMAP DISCARDABLE "res/ROS_logo.bmp" +#include "lang/en-US.rc" +#include "lang/nl-NL.rc" + +// UTF-8 +#pragma code_page(65001) #include "lang/bg-BG.rc" #include "lang/cs-CZ.rc" #include "lang/de-DE.rc" #include "lang/el-GR.rc" -#include "lang/en-US.rc" #include "lang/es-ES.rc" #include "lang/fr-FR.rc" #include "lang/it-IT.rc" #include "lang/ja-JP.rc" #include "lang/ko-KR.rc" -#include "lang/nl-NL.rc" #include "lang/no-NO.rc" +#include "lang/pl-PL.rc" +#include "lang/ro-RO.rc" #include "lang/ru-RU.rc" #include "lang/sk-SK.rc" #include "lang/sv-SE.rc" #include "lang/th-TH.rc" #include "lang/uk-UA.rc" - - -// UTF-8 -#pragma code_page(65001) -#include "lang/pl-PL.rc" -#include "lang/ro-RO.rc" +#include "lang/zh-CN.rc" diff --git a/base/applications/charmap/CMakeLists.txt b/base/applications/charmap/CMakeLists.txt index 5a053c4f042..3e5d1bc4ebf 100644 --- a/base/applications/charmap/CMakeLists.txt +++ b/base/applications/charmap/CMakeLists.txt @@ -9,14 +9,12 @@ list(APPEND SOURCE map.c charmap.rc) -add_executable(charmap - ${CMAKE_CURRENT_BINARY_DIR}/charmap_precomp.h.gch - ${SOURCE}) - -add_pch(charmap ${CMAKE_CURRENT_SOURCE_DIR}/precomp.h ${SOURCE}) +add_executable(charmap ${SOURCE}) set_module_type(charmap win32gui) add_importlibs(charmap msvcrt user32 gdi32 comctl32 kernel32) +add_pch(charmap precomp.h) + add_cd_file(TARGET charmap DESTINATION reactos/system32 FOR all) diff --git a/base/applications/charmap/lang/bg-BG.rc b/base/applications/charmap/lang/bg-BG.rc index 860ca4bd464..6f6fa36607a 100644 --- a/base/applications/charmap/lang/bg-BG.rc +++ b/base/applications/charmap/lang/bg-BG.rc @@ -4,14 +4,14 @@ IDD_CHARMAP DIALOGEX 6, 6, 292, 224 FONT 8,"MS Shell Dlg",0,0 STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE BEGIN - LTEXT " :", IDC_STATIC, 6, 7, 24, 9 + LTEXT "Шрифт :", IDC_STATIC, 6, 7, 24, 9 COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE | WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS - PUSHBUTTON "", IDC_CMHELP, 249, 5, 35, 13 + PUSHBUTTON "Помощ", IDC_CMHELP, 249, 5, 35, 13 CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL, 20, 22, 266, 156 - LTEXT " :", IDC_STATIC, 3, 188, 75, 9 + LTEXT "Знаци за запомняне:", IDC_STATIC, 3, 188, 75, 9 CONTROL "",IDC_TEXTBOX,RICHEDIT_CLASS,ES_AUTOHSCROLL | WS_BORDER | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 74, 186, 114, 13 - DEFPUSHBUTTON "", IDC_SELECT, 194, 186, 44, 13 - PUSHBUTTON "", IDC_COPY, 242, 186, 44, 13, WS_DISABLED + DEFPUSHBUTTON "Избор", IDC_SELECT, 194, 186, 44, 13 + PUSHBUTTON "Запомняне", IDC_COPY, 242, 186, 44, 13, WS_DISABLED CONTROL "Advanced view",IDC_CHECK_ADVANCED,"Button", BS_AUTOCHECKBOX | WS_TABSTOP, 8, 208, 95, 10 END @@ -31,12 +31,12 @@ BEGIN END IDD_ABOUTBOX DIALOGEX 22,16,210,182 -CAPTION " " +CAPTION "За знаковия изборник" FONT 8,"MS Shell Dlg",0,0 STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME BEGIN - LTEXT " , 0,1\n (C) 2007 Ged Murphy (gedmurphy@reactos.org)", IDC_STATIC, 48, 7, 150, 36 - PUSHBUTTON "", IDOK, 75, 162, 44, 15 + LTEXT "Знаков изборник, в0,1\nВъзпроизводствено право (C) 2007 Ged Murphy (gedmurphy@reactos.org)", IDC_STATIC, 48, 7, 150, 36 + PUSHBUTTON "Затваряне", IDOK, 75, 162, 44, 15 ICON IDI_ICON, IDC_STATIC, 10, 10, 7, 30 EDITTEXT IDC_LICENSE_EDIT, 8, 44, 194, 107, WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_READONLY | ES_MULTILINE END @@ -44,6 +44,6 @@ END STRINGTABLE DISCARDABLE BEGIN IDS_LICENSE "This 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 "&..." + IDS_ABOUT "&За..." IDS_TITLE "Character Map" END diff --git a/base/applications/charmap/lang/ca-ES.rc b/base/applications/charmap/lang/ca-ES.rc index 19a4157dc0c..f0b02adad9c 100644 --- a/base/applications/charmap/lang/ca-ES.rc +++ b/base/applications/charmap/lang/ca-ES.rc @@ -8,7 +8,7 @@ BEGIN COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE | WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS PUSHBUTTON "Ajuda", IDC_CMHELP, 249, 5, 35, 13 CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL, 20, 22, 266, 156 - LTEXT "Carcters a copiar :", IDC_STATIC, 6, 188, 66, 9 + LTEXT "Caràcters a copiar :", IDC_STATIC, 6, 188, 66, 9 CONTROL "",IDC_TEXTBOX,RICHEDIT_CLASS,ES_AUTOHSCROLL | WS_BORDER | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 74, 186, 114, 13 DEFPUSHBUTTON "Selecciona", IDC_SELECT, 194, 186, 44, 13 PUSHBUTTON "Copia", IDC_COPY, 242, 186, 44, 13, WS_DISABLED @@ -31,7 +31,7 @@ BEGIN END IDD_ABOUTBOX DIALOGEX 22,16,210,182 -CAPTION "En quanta al Mapa de carcters" +CAPTION "En quanta al Mapa de caràcters" FONT 8,"MS Shell Dlg",0,0 STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME BEGIN diff --git a/base/applications/charmap/lang/cs-CZ.rc b/base/applications/charmap/lang/cs-CZ.rc index ff50115013d..326a7a55dfb 100644 --- a/base/applications/charmap/lang/cs-CZ.rc +++ b/base/applications/charmap/lang/cs-CZ.rc @@ -9,14 +9,14 @@ IDD_CHARMAP DIALOGEX 6, 6, 292, 224 FONT 8,"MS Shell Dlg",0,0 STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE BEGIN - LTEXT "Psmo:", IDC_STATIC, 6, 7, 24, 9 + LTEXT "Písmo:", IDC_STATIC, 6, 7, 24, 9 COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE | WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS - PUSHBUTTON "Npovda", IDC_CMHELP, 249, 5, 35, 13 + PUSHBUTTON "Nápovìda", IDC_CMHELP, 249, 5, 35, 13 CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL, 20, 22, 266, 156 - LTEXT "Znaky ke zkoprovn:", IDC_STATIC, 6, 188, 66, 9 + LTEXT "Znaky ke zkopírování:", IDC_STATIC, 6, 188, 66, 9 CONTROL "",IDC_TEXTBOX,RICHEDIT_CLASS,ES_AUTOHSCROLL | WS_BORDER | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 74, 186, 114, 13 - DEFPUSHBUTTON "Oznait", IDC_SELECT, 194, 186, 44, 13 - PUSHBUTTON "Koprovat", IDC_COPY, 242, 186, 44, 13, WS_DISABLED + DEFPUSHBUTTON "Oznaèit", IDC_SELECT, 194, 186, 44, 13 + PUSHBUTTON "Kopírovat", IDC_COPY, 242, 186, 44, 13, WS_DISABLED CONTROL "Advanced view",IDC_CHECK_ADVANCED,"Button", BS_AUTOCHECKBOX | WS_TABSTOP, 8, 208, 95, 10 END @@ -36,12 +36,12 @@ BEGIN END IDD_ABOUTBOX DIALOGEX 22,16,210,182 -CAPTION "O programu Mapa znak" +CAPTION "O programu Mapa znakù" FONT 8,"MS Shell Dlg",0,0 STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME BEGIN - LTEXT "Mapa znak v0.1\nCopyright (C) 2007 Ged Murphy (gedmurphy@reactos.org)", IDC_STATIC, 48, 7, 150, 36 - PUSHBUTTON "Zavt", IDOK, 75, 162, 44, 15 + LTEXT "Mapa znakù v0.1\nCopyright (C) 2007 Ged Murphy (gedmurphy@reactos.org)", IDC_STATIC, 48, 7, 150, 36 + PUSHBUTTON "Zavøít", IDOK, 75, 162, 44, 15 ICON IDI_ICON, IDC_STATIC, 10, 10, 7, 30 EDITTEXT IDC_LICENSE_EDIT, 8, 44, 194, 107, WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_READONLY | ES_MULTILINE END diff --git a/base/applications/charmap/lang/de-DE.rc b/base/applications/charmap/lang/de-DE.rc index d1feda73713..e85e0326eda 100644 --- a/base/applications/charmap/lang/de-DE.rc +++ b/base/applications/charmap/lang/de-DE.rc @@ -10,7 +10,7 @@ BEGIN CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL, 20, 22, 266, 156 LTEXT "Zeichenaus&wahl:", IDC_STATIC, 6, 188, 66, 9 CONTROL "",IDC_TEXTBOX,RICHEDIT_CLASS,ES_AUTOHSCROLL | WS_BORDER | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 74, 186, 114, 13 - DEFPUSHBUTTON "&Auswhlen", IDC_SELECT, 194, 186, 44, 13 + DEFPUSHBUTTON "&Auswählen", IDC_SELECT, 194, 186, 44, 13 PUSHBUTTON "&Kopieren", IDC_COPY, 242, 186, 44, 13, WS_DISABLED CONTROL "&Erweiterte Ansicht",IDC_CHECK_ADVANCED,"Button", BS_AUTOCHECKBOX | WS_TABSTOP, 8, 208, 95, 10 END @@ -31,19 +31,19 @@ BEGIN END IDD_ABOUTBOX DIALOGEX 22,16,210,182 -CAPTION "ber Zeichentabelle" +CAPTION "Über Zeichentabelle" FONT 8,"MS Shell Dlg",0,0 STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME BEGIN LTEXT "Zeichentabelle v0.1\nCopyright (C) 2007 Ged Murphy (gedmurphy@reactos.org)", IDC_STATIC, 48, 7, 150, 36 - PUSHBUTTON "Schlieen", IDOK, 75, 162, 44, 15 + PUSHBUTTON "Schließen", IDOK, 75, 162, 44, 15 ICON IDI_ICON, IDC_STATIC, 10, 10, 7, 30 EDITTEXT IDC_LICENSE_EDIT, 8, 44, 194, 107, WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_READONLY | ES_MULTILINE END STRINGTABLE DISCARDABLE BEGIN - IDS_LICENSE "Dieses Programm ist kostenlos; Sie knnen es frei verteilen mit od. ohne nderungen unter der GNU Lesser General Public License wie es von der Free Software Foundation verffentlicht wurde; entweder Version 2.1 der Lizenz, oder eine sptere Version (ihrer Wahl).\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 "&ber..." + IDS_LICENSE "Dieses Programm ist kostenlos; Sie können es frei verteilen mit od. ohne Änderungen unter der GNU Lesser General Public License wie es von der Free Software Foundation veröffentlicht wurde; entweder Version 2.1 der Lizenz, oder eine spätere Version (ihrer Wahl).\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 "Ü&ber..." IDS_TITLE "Zeichentabelle" END diff --git a/base/applications/charmap/lang/el-GR.rc b/base/applications/charmap/lang/el-GR.rc index 46fa157868a..edcc283fcf3 100644 --- a/base/applications/charmap/lang/el-GR.rc +++ b/base/applications/charmap/lang/el-GR.rc @@ -4,16 +4,16 @@ IDD_CHARMAP DIALOGEX 6, 6, 292, 224 FONT 8,"MS Shell Dlg",0,0 STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE BEGIN - LTEXT " :",IDC_STATIC,6,7,60,9 + LTEXT "Γραμματοσειρά :",IDC_STATIC,6,7,60,9 COMBOBOX IDC_FONTCOMBO,65,5,181,210,CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS | WS_VSCROLL - PUSHBUTTON "",IDC_CMHELP,249,5,35,13 + PUSHBUTTON "Βοήθεια",IDC_CMHELP,249,5,35,13 CONTROL "",IDC_FONTMAP,"FontMapWnd",WS_VSCROLL | WS_TABSTOP,20, 22,266,156 - LTEXT " :",IDC_STATIC,6,184,66,17 + LTEXT "Χαρακτήρες προς αντιγραφή :",IDC_STATIC,6,184,66,17 CONTROL "",IDC_TEXTBOX,RICHEDIT_CLASS,ES_AUTOHSCROLL | WS_BORDER | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 74, 186, 114, 13 - DEFPUSHBUTTON "",IDC_SELECT,194,186,44,13 - PUSHBUTTON "",IDC_COPY,242,186,44,13,WS_DISABLED + DEFPUSHBUTTON "Επιλογή",IDC_SELECT,194,186,44,13 + PUSHBUTTON "Αντιγραφή",IDC_COPY,242,186,44,13,WS_DISABLED CONTROL "Advanced view",IDC_CHECK_ADVANCED,"Button", BS_AUTOCHECKBOX | WS_TABSTOP, 8, 208, 95, 10 END @@ -34,12 +34,12 @@ END IDD_ABOUTBOX DIALOGEX 22, 16, 210, 182 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU -CAPTION "" +CAPTION "Πληροφορίες" FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN - LTEXT " v0.1\nCopyright (C) 2007 Ged Murphy (gedmurphy@reactos.org)", + LTEXT "Πίνακας χαρακτήρων v0.1\nCopyright (C) 2007 Ged Murphy (gedmurphy@reactos.org)", IDC_STATIC,48,7,150,36 - PUSHBUTTON "",IDOK,75,162,44,15 + PUSHBUTTON "Κλείσημο",IDOK,75,162,44,15 ICON 100,IDC_STATIC,10,10,7,30 EDITTEXT IDC_LICENSE_EDIT,8,44,194,107,ES_MULTILINE | ES_READONLY | WS_VSCROLL @@ -48,6 +48,6 @@ END STRINGTABLE DISCARDABLE BEGIN IDS_LICENSE "This 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 "&..." + IDS_ABOUT "&Πληροφορίες..." IDS_TITLE "Character Map" END diff --git a/base/applications/charmap/lang/fr-FR.rc b/base/applications/charmap/lang/fr-FR.rc index 910b6df3746..fe9d61076ed 100644 --- a/base/applications/charmap/lang/fr-FR.rc +++ b/base/applications/charmap/lang/fr-FR.rc @@ -8,9 +8,9 @@ BEGIN COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE | WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS PUSHBUTTON "Aide", IDC_CMHELP, 249, 5, 35, 13 CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL, 20, 22, 266, 156 - LTEXT "Caractres copier :", IDC_STATIC, 6, 188, 66, 9 + LTEXT "Caractères à copier :", IDC_STATIC, 6, 188, 66, 9 CONTROL "",IDC_TEXTBOX,RICHEDIT_CLASS,ES_AUTOHSCROLL | WS_BORDER | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 74, 186, 114, 13 - DEFPUSHBUTTON "Slectionner", IDC_SELECT, 194, 186, 44, 13 + DEFPUSHBUTTON "Sélectionner", IDC_SELECT, 194, 186, 44, 13 PUSHBUTTON "Copier", IDC_COPY, 242, 186, 44, 13, WS_DISABLED CONTROL "Advanced view",IDC_CHECK_ADVANCED,"Button", BS_AUTOCHECKBOX | WS_TABSTOP, 8, 208, 95, 10 END @@ -31,11 +31,11 @@ BEGIN END IDD_ABOUTBOX DIALOGEX 22,16,210,182 -CAPTION " propos de la Table des Caractres" +CAPTION "À propos de la Table des Caractères" FONT 8,"MS Shell Dlg",0,0 STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME BEGIN - LTEXT "Table des Caractres v0.1\nCopyright (C) 2007 Ged Murphy (gedmurphy@reactos.org)", IDC_STATIC, 48, 7, 150, 36 + LTEXT "Table des Caractères v0.1\nCopyright (C) 2007 Ged Murphy (gedmurphy@reactos.org)", IDC_STATIC, 48, 7, 150, 36 PUSHBUTTON "Fermer", IDOK, 75, 162, 44, 15 ICON IDI_ICON, IDC_STATIC, 10, 10, 7, 30 EDITTEXT IDC_LICENSE_EDIT, 8, 44, 194, 107, WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_READONLY | ES_MULTILINE @@ -43,7 +43,7 @@ END STRINGTABLE DISCARDABLE BEGIN - IDS_LICENSE "Ce programme est un logiciel libre ; vous pouvez le redistribuer et/ou le modifier tout en respectant les termes de la ""GNU General Public License"" publie par la Free Software Foundation; dans sa version 2 (ou selon votre prfrence) toute version ultrieure.\r\n\r\nCe programme est distribu dans l'espoir qu'il sera utile, cependant SANS GARANTIE D'AUCUNE SORTE ; sans mme une garantie implicite de COMMERCIABILIT ou DE CONFORMIT UNE UTILISATION PARTICULIRE. \r\n\r\nVoir la Licence Publique Gnrale GNU pour plus de dtails. Vous devriez avoir reu un exemplaire de la Licence Publique Gnrale GNU avec ce programme ; si ce n'est pas le cas, crivez la Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA." - IDS_ABOUT " propos..." + IDS_LICENSE "Ce programme est un logiciel libre ; vous pouvez le redistribuer et/ou le modifier tout en respectant les termes de la ""GNU General Public License"" publiée par la Free Software Foundation; dans sa version 2 (ou selon votre préférence) toute version ultérieure.\r\n\r\nCe programme est distribué dans l'espoir qu'il sera utile, cependant SANS GARANTIE D'AUCUNE SORTE ; sans même une garantie implicite de COMMERCIABILITÉ ou DE CONFORMITÉ À UNE UTILISATION PARTICULIÈRE. \r\n\r\nVoir la Licence Publique Générale GNU pour plus de détails. Vous devriez avoir reçu un exemplaire de la Licence Publique Générale GNU avec ce programme ; si ce n'est pas le cas, écrivez à la Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA." + IDS_ABOUT "À propos..." IDS_TITLE "Character Map" END diff --git a/base/applications/charmap/lang/it-IT.rc b/base/applications/charmap/lang/it-IT.rc index e4a66dea8f1..2366b8dc5ed 100644 --- a/base/applications/charmap/lang/it-IT.rc +++ b/base/applications/charmap/lang/it-IT.rc @@ -43,7 +43,7 @@ END STRINGTABLE DISCARDABLE BEGIN - IDS_LICENSE, "Questo programma software libero; pu redistribuirlo e/o modificarlo sotto\ni termini della licenza pubblica GNU come pubblicata dalla Free Software Foundation; sia la versione 2 sia una versione successiva (a sua scelta).\r\n\r\nQuesto programma distribuito\nnella speranza che sia utile, ma SENZA ALCUNA GARANZIA; senza neanche la garanzia implicita\ndi NEGOZIABILITA' o APPLICABILITA' per un particolare scopo. Si veda la licenza generale pubblica GNU per maggiori dettagli.\r\n\r\nDovrebbe aver ricevuto una copia assieme a questo programma; se cos non fosse, scriva alla Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA." + IDS_LICENSE, "Questo programma è software libero; può redistribuirlo e/o modificarlo sotto\ni termini della licenza pubblica GNU come pubblicata dalla Free Software Foundation; sia la versione 2 sia una versione successiva (a sua scelta).\r\n\r\nQuesto programma è distribuito\nnella speranza che sia utile, ma SENZA ALCUNA GARANZIA; senza neanche la garanzia implicita\ndi NEGOZIABILITA' o APPLICABILITA' per un particolare scopo. Si veda la licenza generale pubblica GNU per maggiori dettagli.\r\n\r\nDovrebbe aver ricevuto una copia assieme a questo programma; se così non fosse, scriva alla Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA." IDS_ABOUT "&Informazioni su..." IDS_TITLE "Mappa caratteri" END diff --git a/base/applications/charmap/lang/ja-JP.rc b/base/applications/charmap/lang/ja-JP.rc index b97f0a48f5c..c32cf8ae32c 100644 --- a/base/applications/charmap/lang/ja-JP.rc +++ b/base/applications/charmap/lang/ja-JP.rc @@ -4,14 +4,14 @@ IDD_CHARMAP DIALOGEX 6, 6, 292, 224 FONT 9,"MS UI Gothic",0,0 STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE BEGIN - LTEXT "tHg:", IDC_STATIC, 6, 7, 24, 9 + LTEXT "フォント:", IDC_STATIC, 6, 7, 24, 9 COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE | WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS - PUSHBUTTON "wv", IDC_CMHELP, 249, 5, 35, 13 + PUSHBUTTON "ヘルプ", IDC_CMHELP, 249, 5, 35, 13 CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL, 20, 22, 266, 156 - LTEXT "Rs[镶:", IDC_STATIC, 6, 188, 66, 9 + LTEXT "コピーする文字:", IDC_STATIC, 6, 188, 66, 9 CONTROL "",IDC_TEXTBOX,RICHEDIT_CLASS,ES_AUTOHSCROLL | WS_BORDER | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 74, 186, 114, 13 - DEFPUSHBUTTON "I", IDC_SELECT, 194, 186, 44, 13 - PUSHBUTTON "Rs[", IDC_COPY, 242, 186, 44, 13, WS_DISABLED + DEFPUSHBUTTON "選択", IDC_SELECT, 194, 186, 44, 13 + PUSHBUTTON "コピー", IDC_COPY, 242, 186, 44, 13, WS_DISABLED CONTROL "Advanced view",IDC_CHECK_ADVANCED,"Button", BS_AUTOCHECKBOX | WS_TABSTOP, 8, 208, 95, 10 END @@ -31,12 +31,12 @@ BEGIN END IDD_ABOUTBOX DIALOGEX 22,16,210,182 -CAPTION "R[h\\ɂ‚" +CAPTION "文字コード表について" FONT 9,"MS UI Gothic",0,0 STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME BEGIN - LTEXT "R[h\\ v0.1\nCopyright (C) 2007 Ged Murphy (gedmurphy@reactos.org)", IDC_STATIC, 48, 7, 150, 36 - PUSHBUTTON "‚", IDOK, 75, 162, 44, 15 + LTEXT "文字コード表 v0.1\nCopyright (C) 2007 Ged Murphy (gedmurphy@reactos.org)", IDC_STATIC, 48, 7, 150, 36 + PUSHBUTTON "閉じる", IDOK, 75, 162, 44, 15 ICON IDI_ICON, IDC_STATIC, 10, 10, 7, 30 EDITTEXT IDC_LICENSE_EDIT, 8, 44, 194, 107, WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_READONLY | ES_MULTILINE END @@ -44,6 +44,6 @@ END STRINGTABLE DISCARDABLE BEGIN IDS_LICENSE "This 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 "o[W(&B)..." + IDS_ABOUT "バージョン情報(&B)..." IDS_TITLE "Character Map" END diff --git a/base/applications/charmap/lang/ko-KR.rc b/base/applications/charmap/lang/ko-KR.rc index a99a7f7ebc3..1be87c3af9e 100644 --- a/base/applications/charmap/lang/ko-KR.rc +++ b/base/applications/charmap/lang/ko-KR.rc @@ -1,20 +1,21 @@ /* - *Korean translation by manatails007(www.manatails007.org) + * Korean translation by manatails007(www.manatails007.org) */ + LANGUAGE LANG_KOREAN, SUBLANG_DEFAULT IDD_CHARMAP DIALOGEX 6, 6, 292, 224 FONT 8,"MS Shell Dlg",0,0 STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE BEGIN - LTEXT "۲:", IDC_STATIC, 6, 7, 24, 9 + LTEXT "글꼴:", IDC_STATIC, 6, 7, 24, 9 COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE | WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS - PUSHBUTTON "", IDC_CMHELP, 249, 5, 35, 13 + PUSHBUTTON "도움말", IDC_CMHELP, 249, 5, 35, 13 CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL, 20, 22, 266, 156 - LTEXT " :", IDC_STATIC, 6, 188, 66, 9 + LTEXT "복사할 문자:", IDC_STATIC, 6, 188, 66, 9 CONTROL "",IDC_TEXTBOX,RICHEDIT_CLASS,ES_AUTOHSCROLL | WS_BORDER | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 74, 186, 114, 13 - DEFPUSHBUTTON "", IDC_SELECT, 194, 186, 44, 13 - PUSHBUTTON "", IDC_COPY, 242, 186, 44, 13, WS_DISABLED + DEFPUSHBUTTON "선택", IDC_SELECT, 194, 186, 44, 13 + PUSHBUTTON "복사", IDC_COPY, 242, 186, 44, 13, WS_DISABLED CONTROL "Advanced view",IDC_CHECK_ADVANCED,"Button", BS_AUTOCHECKBOX | WS_TABSTOP, 8, 208, 95, 10 END @@ -34,7 +35,7 @@ BEGIN END IDD_ABOUTBOX DIALOGEX 22,16,210,182 -CAPTION "ǥ Ͽ" +CAPTION "문자표에 대하여" FONT 8,"MS Shell Dlg",0,0 STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME BEGIN @@ -47,6 +48,6 @@ END STRINGTABLE DISCARDABLE BEGIN IDS_LICENSE "This 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 "(&A)" + IDS_ABOUT "정보(&A)" IDS_TITLE "Character Map" END diff --git a/base/applications/charmap/lang/lt-LT.rc b/base/applications/charmap/lang/lt-LT.rc index 67ba5fb1132..9d5767c04a0 100644 --- a/base/applications/charmap/lang/lt-LT.rc +++ b/base/applications/charmap/lang/lt-LT.rc @@ -3,7 +3,7 @@ * LICENSE: GPL - See COPYING in the top level directory * FILE: base/applications/charmap/lang/lt-LT.rc * PURPOSE: Lithuanian Language File - * TRANSLATOR: Vytis "CMan" Girdijauskas (cman@cman.us) + * TRANSLATOR: Vytis "CMan" Girdþijauskas (cman@cman.us) * DATE: 2007-09-23 */ @@ -13,7 +13,7 @@ IDD_CHARMAP DIALOGEX 6, 6, 292, 224 FONT 8,"MS Shell Dlg",0,0 STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE BEGIN - LTEXT "riftas:", IDC_STATIC, 6, 7, 24, 9 + LTEXT "Ðriftas:", IDC_STATIC, 6, 7, 24, 9 COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE | WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS PUSHBUTTON "Pagalba", IDC_CMHELP, 249, 5, 35, 13 CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL, 20, 22, 266, 156 @@ -40,12 +40,12 @@ BEGIN END IDD_ABOUTBOX DIALOGEX 22,16,210,182 -CAPTION "Apie simboli lentel" +CAPTION "Apie simboliø lentelæ" FONT 8,"MS Shell Dlg",0,0 STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME BEGIN - LTEXT "Simboli lentel v0.1\n(C) 2007 Ged Murphy (gedmurphy@reactos.org)", IDC_STATIC, 48, 7, 150, 36 - PUSHBUTTON "Uverti", IDOK, 83, 161, 44, 15 + LTEXT "Simboliø lentelë v0.1\n(C) 2007 Ged Murphy (gedmurphy@reactos.org)", IDC_STATIC, 48, 7, 150, 36 + PUSHBUTTON "Uþverti", IDOK, 83, 161, 44, 15 ICON IDI_ICON, IDC_STATIC, 10, 10, 7, 30 EDITTEXT IDC_LICENSE_EDIT, 8, 44, 194, 107, WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_READONLY | ES_MULTILINE END diff --git a/base/applications/charmap/lang/no-NO.rc b/base/applications/charmap/lang/no-NO.rc index 67ff7c9c102..7a003b16c92 100644 --- a/base/applications/charmap/lang/no-NO.rc +++ b/base/applications/charmap/lang/no-NO.rc @@ -8,7 +8,7 @@ BEGIN COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE | WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS PUSHBUTTON "Hjelp", IDC_CMHELP, 249, 5, 35, 13 CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL, 20, 22, 266, 156 - LTEXT "Kopier flgende tegn:", IDC_STATIC, 6, 188, 66, 9 + LTEXT "Kopier følgende tegn:", IDC_STATIC, 6, 188, 66, 9 CONTROL "",IDC_TEXTBOX,RICHEDIT_CLASS,ES_AUTOHSCROLL | WS_BORDER | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 74, 186, 114, 13 DEFPUSHBUTTON "Velg", IDC_SELECT, 194, 186, 44, 13 PUSHBUTTON "Kopier", IDC_COPY, 242, 186, 44, 13, WS_DISABLED @@ -43,7 +43,7 @@ END STRINGTABLE DISCARDABLE BEGIN - IDS_LICENSE "Dette programmet er gratis programvare; du kan distribuere det og/eller endre det under betingelsene av GNU General Public License som er utgitt av Free Software Foundation; version 2 av lisensen, eller (etter din mening) alle senere versjoner.\r\n\r\nDette programmet er utgitt i hp for at det skal kunne brukes, men DET ER INGEN GARANTIER; uten heller forutsatt garantier av SALGBARHET eller SIKKETHET FOR EN ENKELTHET FORML. Se p GNU General Public Lisensen for mere detaljer.\r\n\r\nDu skal ha motatt en kopi av GNU General Public Lisensen sammen med denne programmet; hvis du ikke har motatt det, skriv til Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA." + IDS_LICENSE "Dette programmet er gratis programvare; du kan distribuere det og/eller endre det under betingelsene av GNU General Public License som er utgitt av Free Software Foundation; version 2 av lisensen, eller (etter din mening) alle senere versjoner.\r\n\r\nDette programmet er utgitt i håp for at det skal kunne brukes, men DET ER INGEN GARANTIER; uten heller forutsatt garantier av SALGBARHET eller SIKKETHET FOR EN ENKELTHET FORMÅL. Se på GNU General Public Lisensen for mere detaljer.\r\n\r\nDu skal ha motatt en kopi av GNU General Public Lisensen sammen med denne programmet; hvis du ikke har motatt det, skriv til Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA." IDS_ABOUT "O&m..." IDS_TITLE "Character Map" END diff --git a/base/applications/charmap/lang/pl-PL.rc b/base/applications/charmap/lang/pl-PL.rc index 35c7b74ea65..ba912b4efd4 100644 --- a/base/applications/charmap/lang/pl-PL.rc +++ b/base/applications/charmap/lang/pl-PL.rc @@ -4,6 +4,7 @@ * https://sourceforge.net/projects/reactospl * updated by Olaf Siejka (May, 2011) * UTF-8 conversion by Caemyr (May, 2011) + * updated by Saibamen - Adam Stachowicz (saibamenppl@gmail.com) (August, 2011) */ LANGUAGE LANG_POLISH, SUBLANG_DEFAULT @@ -12,11 +13,11 @@ IDD_CHARMAP DIALOGEX 6, 6, 292, 224 FONT 8,"MS Shell Dlg",0,0 STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE BEGIN - LTEXT "Czci&onka:", IDC_STATIC, 6, 7, 24, 9 + LTEXT "Czci&onka:", IDC_STATIC, 6, 7, 28, 9 COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE | WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS PUSHBUTTON "Pomo&c", IDC_CMHELP, 249, 5, 35, 13 CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL, 20, 22, 266, 156 - LTEXT "&Znaki do skopiowania:", IDC_STATIC, 6, 188, 66, 9 + LTEXT "&Znaki do skopiowania:", IDC_STATIC, 6, 188, 70, 9 CONTROL "",IDC_TEXTBOX,RICHEDIT_CLASS,ES_AUTOHSCROLL | WS_BORDER | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 74, 186, 114, 13 DEFPUSHBUTTON "Wy&bierz", IDC_SELECT, 194, 186, 44, 13 PUSHBUTTON "&Kopiuj", IDC_COPY, 242, 186, 44, 13, WS_DISABLED @@ -27,9 +28,9 @@ IDD_ADVANCED DIALOGEX 0, 0, 292, 64 STYLE DS_SHELLFONT | WS_CHILD FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Zestaw znaków:",IDC_STATIC,8,8,48,8 + LTEXT "Zestaw znaków:",IDC_STATIC,8,8,53,8 COMBOBOX IDC_COMBO_CHARSET,72,4,116,80,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Grupowanie według:",IDC_STATIC,8,28,50,8 + LTEXT "Grupowanie według:",IDC_STATIC,8,28,67,8 COMBOBOX IDC_COMBO_GROUPBY,72,24,116,80,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP PUSHBUTTON "Szukaj",IDC_BUTTON_SEARCH,200,44,50,14 EDITTEXT IDC_EDIT_SEARCH,72,44,116,14,ES_AUTOHSCROLL diff --git a/base/applications/charmap/lang/pt-BR.rc b/base/applications/charmap/lang/pt-BR.rc index c3046153c3f..5abe94c9311 100644 --- a/base/applications/charmap/lang/pt-BR.rc +++ b/base/applications/charmap/lang/pt-BR.rc @@ -43,7 +43,7 @@ END STRINGTABLE DISCARDABLE BEGIN - IDS_LICENSE "Este programa software livre; voc pode redistribu-lo e/ou modific-lo sob os termos da GNU General Public License conforme publicada pela Free Software Foundation; quer a verso 2 da licena, ou (conforme voc escolha) qualquer verso posterior.\r\n\r\nEste programa distribudo com a esperana de que seja til, mas SEM QUALQUER GARANTIA; mesmo sem a garantia implcita de MERCANTIBILIDADE OU ADEQUAO A UM DETERMINADO PROPSITO. Para mais detalhes, veja a GNU General Public License.\r\n\r\nVoc deve ter recebido uma cpia da GNU General Public License juntamente com este programa; caso contrrio, escreva para a Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA." + IDS_LICENSE "Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo sob os termos da GNU General Public License conforme publicada pela Free Software Foundation; quer a versão 2 da licença, ou (conforme você escolha) qualquer versão posterior.\r\n\r\nEste programa é distribuído com a esperança de que seja útil, mas SEM QUALQUER GARANTIA; mesmo sem a garantia implícita de MERCANTIBILIDADE OU ADEQUAÇÃO A UM DETERMINADO PROPÓSITO. Para mais detalhes, veja a GNU General Public License.\r\n\r\nVocê deve ter recebido uma cópia da GNU General Public License juntamente com este programa; caso contrário, escreva para a Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA." IDS_ABOUT "So&bre..." IDS_TITLE "Character Map" END diff --git a/base/applications/charmap/lang/ru-RU.rc b/base/applications/charmap/lang/ru-RU.rc index dcc1effd04c..f5e24751a64 100644 --- a/base/applications/charmap/lang/ru-RU.rc +++ b/base/applications/charmap/lang/ru-RU.rc @@ -6,46 +6,46 @@ IDD_CHARMAP DIALOGEX 6, 6, 292, 224 FONT 8,"MS Shell Dlg",0,0 STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE BEGIN - LTEXT ":", IDC_STATIC, 6, 7, 27, 9 + LTEXT "Шрифт:", IDC_STATIC, 6, 7, 27, 9 COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE | WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS - PUSHBUTTON "", IDC_CMHELP, 249, 5, 35, 13 + PUSHBUTTON "Справка", IDC_CMHELP, 249, 5, 35, 13 CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL, 20, 22, 266, 156 - LTEXT " :", IDC_STATIC, 6, 188, 95, 9 + LTEXT "Копировать символ:", IDC_STATIC, 6, 188, 95, 9 CONTROL "",IDC_TEXTBOX,RICHEDIT_CLASS,ES_AUTOHSCROLL | WS_BORDER | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 74, 186, 114, 13 - DEFPUSHBUTTON "", IDC_SELECT, 194, 186, 44, 13 - PUSHBUTTON "", IDC_COPY, 242, 186, 44, 13, WS_DISABLED - CONTROL " ",IDC_CHECK_ADVANCED,"Button", BS_AUTOCHECKBOX | WS_TABSTOP, 8, 208, 95, 10 + DEFPUSHBUTTON "Выбрать", IDC_SELECT, 194, 186, 44, 13 + PUSHBUTTON "Копировать", IDC_COPY, 242, 186, 44, 13, WS_DISABLED + CONTROL "Расширенный вид",IDC_CHECK_ADVANCED,"Button", BS_AUTOCHECKBOX | WS_TABSTOP, 8, 208, 95, 10 END IDD_ADVANCED DIALOGEX 0, 0, 292, 64 STYLE DS_SHELLFONT | WS_CHILD FONT 8, "MS Shell Dlg" BEGIN - LTEXT " :",IDC_STATIC,8,8,55,8 + LTEXT "Набор символов:",IDC_STATIC,8,8,55,8 COMBOBOX IDC_COMBO_CHARSET,72,4,116,80,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT " :",IDC_STATIC,8,28,50,8 + LTEXT "Группировать за:",IDC_STATIC,8,28,50,8 COMBOBOX IDC_COMBO_GROUPBY,72,24,116,80,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "",IDC_BUTTON_SEARCH,200,44,50,14 + PUSHBUTTON "Найти",IDC_BUTTON_SEARCH,200,44,50,14 EDITTEXT IDC_EDIT_SEARCH,72,44,116,14,ES_AUTOHSCROLL - LTEXT ":",IDC_STATIC,8,48,42,8 - LTEXT ":",IDC_STATIC,200,8,30,8 + LTEXT "Искать:",IDC_STATIC,8,48,42,8 + LTEXT "Юникод:",IDC_STATIC,200,8,30,8 EDITTEXT IDC_EDIT_UNICODE,236,4,28,12,ES_AUTOHSCROLL END IDD_ABOUTBOX DIALOGEX 22,16,210,182 -CAPTION " " +CAPTION "О Таблице символов" FONT 8,"MS Shell Dlg",0,0 STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME BEGIN - LTEXT " v0.1\nCopyright (C) 2007 Ged Murphy (gedmurphy@reactos.org)", IDC_STATIC, 48, 7, 150, 36 - PUSHBUTTON "", IDOK, 75, 162, 44, 15 + LTEXT "Таблица символов v0.1\nCopyright (C) 2007 Ged Murphy (gedmurphy@reactos.org)", IDC_STATIC, 48, 7, 150, 36 + PUSHBUTTON "Закрыть", IDOK, 75, 162, 44, 15 ICON IDI_ICON, IDC_STATIC, 10, 10, 7, 30 EDITTEXT IDC_LICENSE_EDIT, 8, 44, 194, 107, WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_READONLY | ES_MULTILINE END STRINGTABLE DISCARDABLE BEGIN - IDS_LICENSE " ; () , GNU, ; 2 , ( ) , .\r\n\r\n , , - , . GNU.\r\n\r\n GNU, , (Free Software Foundation, Inc.), 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA." - IDS_ABOUT "& ..." - IDS_TITLE " " + IDS_LICENSE "Эта программа является свободно распространяемой; Вы можете распространять ее повторно и (или) изменять, соблюдая условия Открытого лицензионного соглашения GNU, опубликованного Фондом свободно распространяемого программного обеспечения; либо редакции 2 Соглашения, либо (на ваше усмотрение) любой редакции, выпущенной позже.\r\n\r\nЭта программа распространяется в надежде на то, что она окажется полезной, но БЕЗ КАКИХ-ЛИБО ГАРАНТИЙ, включая подразумеваемую гарантию КАЧЕСТВА либо ПРИГОДНОСТИ ДЛЯ ОПРЕДЕЛЕННЫХ ЦЕЛЕЙ. Подробности содержатся в Открытом лицензионном соглашении GNU.\r\n\r\nВместе с этой программой должен распространяться экземпляр Открытого лицензионного соглашения GNU, если он отсутствует, сообщите об этом в Фонд свободно распространяемого программного обеспечения (Free Software Foundation, Inc.), 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA." + IDS_ABOUT "&О программе..." + IDS_TITLE "Таблица символов" END diff --git a/base/applications/charmap/lang/sk-SK.rc b/base/applications/charmap/lang/sk-SK.rc index 868f97e72ba..3f1477013c9 100644 --- a/base/applications/charmap/lang/sk-SK.rc +++ b/base/applications/charmap/lang/sk-SK.rc @@ -2,7 +2,7 @@ * PROJECT: Character Map * FILE: base/applications/charmap/lang/sk-SK.rc * PURPOSE: Slovak Language File for charmap - * TRANSLATOR: Kario (kario@szm.sk) /Mrio Kamr/ + * TRANSLATOR: Kario (kario@szm.sk) /Mário Kačmár/ * DATE OF TR.: 24-07-2007 * LAST CHANGE: 29-08-2008 */ @@ -13,14 +13,14 @@ IDD_CHARMAP DIALOGEX 6, 6, 292, 224 FONT 8,"MS Shell Dlg",0,0 STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE BEGIN - LTEXT "Ps&mo:", IDC_STATIC, 6, 7, 24, 9 + LTEXT "Pís&mo:", IDC_STATIC, 6, 7, 24, 9 COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE | WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS - PUSHBUTTON "&Pomocnk", IDC_CMHELP, 249, 5, 35, 13 + PUSHBUTTON "&Pomocník", IDC_CMHELP, 249, 5, 35, 13 CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL, 20, 22, 266, 156 - LTEXT "Koprova &znaky:", IDC_STATIC, 6, 188, 66, 9 + LTEXT "Kopírovať &znaky:", IDC_STATIC, 6, 188, 66, 9 CONTROL "",IDC_TEXTBOX,RICHEDIT_CLASS,ES_AUTOHSCROLL | WS_BORDER | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 74, 186, 114, 13 - DEFPUSHBUTTON "&Vybra", IDC_SELECT, 194, 186, 44, 13 - PUSHBUTTON "&Koprova", IDC_COPY, 242, 186, 44, 13, WS_DISABLED + DEFPUSHBUTTON "&Vybrať", IDC_SELECT, 194, 186, 44, 13 + PUSHBUTTON "&Kopírovať", IDC_COPY, 242, 186, 44, 13, WS_DISABLED CONTROL "Advanced view",IDC_CHECK_ADVANCED,"Button", BS_AUTOCHECKBOX | WS_TABSTOP, 8, 208, 95, 10 END @@ -40,19 +40,19 @@ BEGIN END IDD_ABOUTBOX DIALOGEX 22,16,210,182 -CAPTION "o je Mapa znakov" +CAPTION "Čo je Mapa znakov" FONT 8,"MS Shell Dlg",0,0 STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME BEGIN LTEXT "Mapa znakov v0.1\nCopyright (C) 2007 Ged Murphy (gedmurphy@reactos.org)", IDC_STATIC, 48, 7, 150, 36 - PUSHBUTTON "&Zavrie", IDOK, 75, 162, 44, 15 + PUSHBUTTON "&Zavrieť", IDOK, 75, 162, 44, 15 ICON IDI_ICON, IDC_STATIC, 10, 10, 7, 30 EDITTEXT IDC_LICENSE_EDIT, 8, 44, 194, 107, WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_READONLY | ES_MULTILINE END STRINGTABLE DISCARDABLE BEGIN - IDS_LICENSE, "Tento program je von softvr; mete ho ri a/alebo modifikova poda podmienok GNU Veobecnej verejnej licencie (GNU General Public License) ako bola zverejnen nadciou Free Software Foundation; bu verzie 2 tejto licencie, alebo (poda Vho uvenia) niektorej neskorej verzie.\r\n\r\nTento program je distribuovan v ndeji, e bude uiton, avak BEZ AKEJKOVEK ZRUKY; rovnako bez zruky PREDAJNOSTI alebo VHODNOSTI PRE URIT EL. Pre viac detailov si pozrite GNU Veobecn verejn licenciu (GNU General Public License).\r\n\r\nKpiu Veobecnej verejnej licencie GNU ste mali dosta spolu s tmto programom; ak nie, napte si o u na Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA." - IDS_ABOUT "&o je Mapa znakov" + IDS_LICENSE, "Tento program je voľný softvér; môžete ho šíriť a/alebo modifikovať podľa podmienok GNU Všeobecnej verejnej licencie (GNU General Public License) ako bola zverejnená nadáciou Free Software Foundation; buď verzie 2 tejto licencie, alebo (podľa Vášho uváženia) niektorej neskoršej verzie.\r\n\r\nTento program je distribuovaný v nádeji, že bude užitočný, avšak BEZ AKEJKOĽVEK ZÁRUKY; rovnako bez záruky PREDAJNOSTI alebo VHODNOSTI PRE URČITÝ ÚČEL. Pre viac detailov si pozrite GNU Všeobecnú verejnú licenciu (GNU General Public License).\r\n\r\nKópiu Všeobecnej verejnej licencie GNU ste mali dostať spolu s týmto programom; ak nie, napíšte si o ňu na Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA." + IDS_ABOUT "Č&o je Mapa znakov" IDS_TITLE "Character Map" END diff --git a/base/applications/charmap/lang/sv-SE.rc b/base/applications/charmap/lang/sv-SE.rc index bd5da0a1a24..475f38f818f 100644 --- a/base/applications/charmap/lang/sv-SE.rc +++ b/base/applications/charmap/lang/sv-SE.rc @@ -1,41 +1,42 @@ /* - * PROJECT: ReactOS RAPPS - * FILE: \base\applications\charmap\lang\sv-SE.rc - * PURPOSE: Swedish resource file - * Translation: Jaix Bly + * PROJECT: ReactOS RAPPS + * FILE: base\applications\charmap\lang\sv-SE.rc + * PURPOSE: Swedish resource file + * TRANSLATOR: Jaix Bly */ - LANGUAGE LANG_SWEDISH, SUBLANG_NEUTRAL + +LANGUAGE LANG_SWEDISH, SUBLANG_NEUTRAL IDD_CHARMAP DIALOGEX 6, 6, 293, 205 //233 -CAPTION "Teckenuppsttning" +CAPTION "Teckenuppsättning" FONT 8,"MS Shell Dlg",0,0 STYLE DS_SHELLFONT | WS_BORDER | WS_VISIBLE | WS_SYSMENU | WS_MINIMIZEBOX BEGIN LTEXT "Typsnitt:", IDC_STATIC, 6, 7, 24, 9 COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE | WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS - PUSHBUTTON "Hjlp", IDC_CMHELP, 249, 5, 35, 13 + PUSHBUTTON "Hjälp", IDC_CMHELP, 249, 5, 35, 13 CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL, 20, 22, 266, 156 LTEXT "Kopiera tecken:", IDC_STATIC, 6, 188, 66, 9 CONTROL "",IDC_TEXTBOX,RICHEDIT_CLASS,ES_AUTOHSCROLL | WS_BORDER | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 74, 186, 114, 13 - DEFPUSHBUTTON "Vlj", IDC_SELECT, 194, 186, 44, 13 + DEFPUSHBUTTON "Välj", IDC_SELECT, 194, 186, 44, 13 PUSHBUTTON "Kopiera", IDC_COPY, 242, 186, 44, 13, WS_DISABLED //AUTOCHECKBOX "Avansert visning", IDC_ADVVIEW, 10, 204, 64, 9, WS_CHILD | WS_VISIBLE | WS_TABSTOP //EDITTEXT IDC_DISPLAY, 8, 217, 278, 13, WS_VISIBLE | WS_TABSTOP | ES_READONLY END IDD_ABOUTBOX DIALOGEX 22,16,210,182 -CAPTION "Om Teckenuppsttning" +CAPTION "Om Teckenuppsättning" FONT 8,"MS Shell Dlg",0,0 STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME BEGIN - LTEXT "Teckenuppsttning v0.1\nCopyright (C) 2007 Ged Murphy (gedmurphy@reactos.org)", IDC_STATIC, 48, 7, 150, 36 - PUSHBUTTON "Stng", IDOK, 75, 162, 44, 15 + LTEXT "Teckenuppsättning v0.1\nCopyright (C) 2007 Ged Murphy (gedmurphy@reactos.org)", IDC_STATIC, 48, 7, 150, 36 + PUSHBUTTON "Stäng", IDOK, 75, 162, 44, 15 ICON IDI_ICON, IDC_STATIC, 10, 10, 7, 30 EDITTEXT IDC_LICENSE_EDIT, 8, 44, 194, 107, WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_READONLY | ES_MULTILINE END STRINGTABLE DISCARDABLE BEGIN - IDS_LICENSE "Detta programmet r fri programvara; du kan distribuera det och/eller ndra det under villkoren enligt GNU General Public License som r utgivet av Free Software Foundation; version 2, eller (om du s nskar) alla senare versioner.\r\n\r\nDette programmet er utgivet i hopp om att det skall kunne anvndas, men DET FINNS INGA GARANTIER; ven utan underfrstdd garanti om SLJBARHET eller LMPLIGHET FR ETT VISST NDAML. Se p GNU General Public Licensen fr mer detaljer.\r\n\r\nDu skall ha motagit en kopia av GNU General Public Licensen tillsammans med detta programmet; om du inte har ftt det, skriv til Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA." + IDS_LICENSE "Detta programmet är fri programvara; du kan distribuera det och/eller ändra det under villkoren enligt GNU General Public License som är utgivet av Free Software Foundation; version 2, eller (om du så önskar) alla senare versioner.\r\n\r\nDette programmet er utgivet i hopp om att det skall kunne användas, men DET FINNS INGA GARANTIER; även utan underförstådd garanti om SÄLJBARHET eller LÄMPLIGHET FÖR ETT VISST ÄNDAMÅL. Se på GNU General Public Licensen för mer detaljer.\r\n\r\nDu skall ha motagit en kopia av GNU General Public Licensen tillsammans med detta programmet; om du inte har fått det, skriv til Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA." IDS_ABOUT "O&m..." END diff --git a/base/applications/charmap/lang/uk-UA.rc b/base/applications/charmap/lang/uk-UA.rc index 9d4cbe8e80c..fc75d02978c 100644 --- a/base/applications/charmap/lang/uk-UA.rc +++ b/base/applications/charmap/lang/uk-UA.rc @@ -12,46 +12,46 @@ IDD_CHARMAP DIALOGEX 6, 6, 292, 224 FONT 8,"MS Shell Dlg",0,0 STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE BEGIN - LTEXT " :", IDC_STATIC, 6, 7, 24, 9 + LTEXT "Шрифт :", IDC_STATIC, 6, 7, 24, 9 COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE | WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS - PUSHBUTTON "", IDC_CMHELP, 249, 5, 35, 13 + PUSHBUTTON "Довідка", IDC_CMHELP, 249, 5, 35, 13 CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL, 20, 22, 266, 156 - LTEXT " :", IDC_STATIC, 6, 188, 66, 9 + LTEXT "Для копіювання :", IDC_STATIC, 6, 188, 66, 9 CONTROL "",IDC_TEXTBOX,RICHEDIT_CLASS,ES_AUTOHSCROLL | WS_BORDER | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 74, 186, 114, 13 - DEFPUSHBUTTON "", IDC_SELECT, 194, 186, 44, 13 - PUSHBUTTON "", IDC_COPY, 242, 186, 44, 13, WS_DISABLED - CONTROL " ",IDC_CHECK_ADVANCED,"Button", BS_AUTOCHECKBOX | WS_TABSTOP, 8, 208, 95, 10 + DEFPUSHBUTTON "Вибрати", IDC_SELECT, 194, 186, 44, 13 + PUSHBUTTON "Копіювати", IDC_COPY, 242, 186, 44, 13, WS_DISABLED + CONTROL "Розширений вигляд",IDC_CHECK_ADVANCED,"Button", BS_AUTOCHECKBOX | WS_TABSTOP, 8, 208, 95, 10 END IDD_ADVANCED DIALOGEX 0, 0, 292, 64 STYLE DS_SHELLFONT | WS_CHILD FONT 8, "MS Shell Dlg" BEGIN - LTEXT " :",IDC_STATIC,8,8,55,8 + LTEXT "Набір символів:",IDC_STATIC,8,8,55,8 COMBOBOX IDC_COMBO_CHARSET,72,4,116,80,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT " :",IDC_STATIC,8,28,50,8 + LTEXT "Групувати за:",IDC_STATIC,8,28,50,8 COMBOBOX IDC_COMBO_GROUPBY,72,24,116,80,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "",IDC_BUTTON_SEARCH,200,44,50,14 + PUSHBUTTON "Знайти",IDC_BUTTON_SEARCH,200,44,50,14 EDITTEXT IDC_EDIT_SEARCH,72,44,116,14,ES_AUTOHSCROLL - LTEXT ":",IDC_STATIC,8,48,42,8 - LTEXT ":",IDC_STATIC,200,8,30,8 + LTEXT "Шукати:",IDC_STATIC,8,48,42,8 + LTEXT "Юнікод:",IDC_STATIC,200,8,30,8 EDITTEXT IDC_EDIT_UNICODE,236,4,28,12,ES_AUTOHSCROLL END IDD_ABOUTBOX DIALOGEX 22,16,210,182 -CAPTION " ..." +CAPTION "Про програму..." FONT 8,"MS Shell Dlg",0,0 STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME BEGIN - LTEXT " v0.1\nCopyright (C) 2007 Ged Murphy (gedmurphy@reactos.org)", IDC_STATIC, 48, 7, 150, 36 - PUSHBUTTON "", IDOK, 75, 162, 44, 15 + LTEXT "Таблиця символів v0.1\nCopyright (C) 2007 Ged Murphy (gedmurphy@reactos.org)", IDC_STATIC, 48, 7, 150, 36 + PUSHBUTTON "Закрити", IDOK, 75, 162, 44, 15 ICON IDI_ICON, IDC_STATIC, 10, 10, 7, 30 EDITTEXT IDC_LICENSE_EDIT, 8, 44, 194, 107, WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_READONLY | ES_MULTILINE END STRINGTABLE DISCARDABLE BEGIN - IDS_LICENSE " - ; , ³ GNU, ; 2 , - , .\r\n\r\n 䳿 , , - Ҳ, Ҳ Ҳ Ҳ . ³ GNU.\r\n\r\n ³ GNU. , (Free Software Foundation, Inc.), 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA." - IDS_ABOUT "& ..." - IDS_TITLE " C" + IDS_LICENSE "Таблиця символів - вільне програмне забезпечення; Ви можете розповсюджувати її та змінювати, дотримуючись умови Відкритої ліцензійної угоди GNU, опублікованої Фондом вільного програмного забезпечення; або редакції 2 Угоди, або будь-якої редакції, випущеної пізніше.\r\n\r\nЦя програма розповсюджується в надії на те, що вона виявиться корисною, але БЕЗ БУДЬ-ЯКИХ ГАРАНТІЙ, включаючи УЯВНОЮ ГАРАНТІЄЮ ЯКОСТІ або ПРИДАТНОСТІ для певних цілей. Подробиці містяться у Відкритій ліцензійній угоді GNU.\r\n\r\nРазом з цією програмою повинен поширюватися примірник Відкритої ліцензійної угоди GNU. Якщо він відсутній, повідомте про це в Фонд вільного програмного забезпечення (Free Software Foundation, Inc.), 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA." + IDS_ABOUT "&Про програму..." + IDS_TITLE "Таблиця Cимволів" END diff --git a/base/applications/charmap/lang/zh-CN.rc b/base/applications/charmap/lang/zh-CN.rc index 7385d597667..350b601d5b1 100644 --- a/base/applications/charmap/lang/zh-CN.rc +++ b/base/applications/charmap/lang/zh-CN.rc @@ -1,4 +1,10 @@ -// Chinese (Simplified) language resource file (Elton Chung, elton328@gmail.com) +/* + * PROJECT: ReactOS Character Map + * LICENSE: GPL - See COPYING in the top level directory + * FILE: base/applications/charmap/lang/zh-CN.rc + * PURPOSE: Chinese (Simplified) Language File for charmap + * TRANSLATOR: Elton Chung + */ LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED @@ -6,39 +12,39 @@ IDD_CHARMAP DIALOGEX 6, 6, 292, 224 FONT 8,"MS Shell Dlg",0,0 STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE BEGIN - LTEXT ":", IDC_STATIC, 6, 7, 24, 9 + LTEXT "字体:", IDC_STATIC, 6, 7, 24, 9 COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE | WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS - PUSHBUTTON "˵", IDC_CMHELP, 249, 5, 35, 13 + PUSHBUTTON "说明", IDC_CMHELP, 249, 5, 35, 13 CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL, 20, 22, 266, 156 - LTEXT "Ƶַ:", IDC_STATIC, 6, 188, 66, 9 + LTEXT "待复制的字符:", IDC_STATIC, 6, 188, 66, 9 CONTROL "",IDC_TEXTBOX,RICHEDIT_CLASS,ES_AUTOHSCROLL | WS_BORDER | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 74, 186, 114, 13 - DEFPUSHBUTTON "ѡ", IDC_SELECT, 194, 186, 44, 13 - PUSHBUTTON "", IDC_COPY, 242, 186, 44, 13, WS_DISABLED - CONTROL "Advanced view",IDC_CHECK_ADVANCED,"Button", BS_AUTOCHECKBOX | WS_TABSTOP, 8, 208, 95, 10 + DEFPUSHBUTTON "选择", IDC_SELECT, 194, 186, 44, 13 + PUSHBUTTON "复制", IDC_COPY, 242, 186, 44, 13, WS_DISABLED + CONTROL "高级查看",IDC_CHECK_ADVANCED,"Button", BS_AUTOCHECKBOX | WS_TABSTOP, 8, 208, 95, 10 END IDD_ADVANCED DIALOGEX 0, 0, 292, 64 STYLE DS_SHELLFONT | WS_CHILD FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Charset:",IDC_STATIC,8,8,48,8 + LTEXT "字符集:",IDC_STATIC,8,8,48,8 COMBOBOX IDC_COMBO_CHARSET,72,4,116,80,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Group by:",IDC_STATIC,8,28,50,8 + LTEXT "分组:",IDC_STATIC,8,28,50,8 COMBOBOX IDC_COMBO_GROUPBY,72,24,116,80,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "Search",IDC_BUTTON_SEARCH,200,44,50,14 + PUSHBUTTON "搜索",IDC_BUTTON_SEARCH,200,44,50,14 EDITTEXT IDC_EDIT_SEARCH,72,44,116,14,ES_AUTOHSCROLL - LTEXT "Search for:",IDC_STATIC,8,48,42,8 - LTEXT "Unicode:",IDC_STATIC,200,8,30,8 + LTEXT "搜索目标:",IDC_STATIC,8,48,42,8 + LTEXT "到 Unicode:",IDC_STATIC,200,8,30,8 EDITTEXT IDC_EDIT_UNICODE,236,4,28,12,ES_AUTOHSCROLL END IDD_ABOUTBOX DIALOGEX 22,16,210,182 -CAPTION "ַ" +CAPTION "关于字符映射表" FONT 8,"MS Shell Dlg",0,0 STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME BEGIN - LTEXT "ַ v0.1\nCopyright (C) 2007 Ged Murphy (gedmurphy@reactos.org)", IDC_STATIC, 48, 7, 150, 36 - PUSHBUTTON "ر", IDOK, 75, 162, 44, 15 + LTEXT "字符映射表 v0.1\nCopyright (C) 2007 Ged Murphy (gedmurphy@reactos.org)", IDC_STATIC, 48, 7, 150, 36 + PUSHBUTTON "关闭", IDOK, 75, 162, 44, 15 ICON IDI_ICON, IDC_STATIC, 10, 10, 7, 30 EDITTEXT IDC_LICENSE_EDIT, 8, 44, 194, 107, WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_READONLY | ES_MULTILINE END @@ -46,6 +52,6 @@ END STRINGTABLE DISCARDABLE BEGIN IDS_LICENSE "This 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., 675 Mass Ave, Cambridge, MA 02139, USA." - IDS_ABOUT "(&A)..." - IDS_TITLE "Character Map" + IDS_ABOUT "关于(&A)..." + IDS_TITLE "字符映射表" END diff --git a/base/applications/charmap/lang/zh-TW.rc b/base/applications/charmap/lang/zh-TW.rc index 5bb325887ba..528ba5b245e 100644 --- a/base/applications/charmap/lang/zh-TW.rc +++ b/base/applications/charmap/lang/zh-TW.rc @@ -1,4 +1,10 @@ -// Chinese (Traditional) language resource file (Elton Chung, elton328@gmail.com) +/* + * PROJECT: ReactOS Character Map + * LICENSE: GPL - See COPYING in the top level directory + * FILE: base/applications/charmap/lang/zh-TW.rc + * PURPOSE: Chinese (Traditional) Language File for charmap + * TRANSLATOR: Elton Chung + */ LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL @@ -6,39 +12,39 @@ IDD_CHARMAP DIALOGEX 6, 6, 292, 224 FONT 8,"MS Shell Dlg",0,0 STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE BEGIN - LTEXT "rG", IDC_STATIC, 6, 7, 24, 9 + LTEXT "字體:", IDC_STATIC, 6, 7, 24, 9 COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE | WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS - PUSHBUTTON "", IDC_CMHELP, 249, 5, 35, 13 + PUSHBUTTON "說明", IDC_CMHELP, 249, 5, 35, 13 CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL, 20, 22, 266, 156 - LTEXT "ݽƻsršG", IDC_STATIC, 6, 188, 66, 9 + LTEXT "待複製的字元:", IDC_STATIC, 6, 188, 66, 9 CONTROL "",IDC_TEXTBOX,RICHEDIT_CLASS,ES_AUTOHSCROLL | WS_BORDER | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 74, 186, 114, 13 - DEFPUSHBUTTON "", IDC_SELECT, 194, 186, 44, 13 - PUSHBUTTON "ƻs", IDC_COPY, 242, 186, 44, 13, WS_DISABLED - CONTROL "Advanced view",IDC_CHECK_ADVANCED,"Button", BS_AUTOCHECKBOX | WS_TABSTOP, 8, 208, 95, 10 + DEFPUSHBUTTON "選擇", IDC_SELECT, 194, 186, 44, 13 + PUSHBUTTON "複製", IDC_COPY, 242, 186, 44, 13, WS_DISABLED + CONTROL "進階檢視",IDC_CHECK_ADVANCED,"Button", BS_AUTOCHECKBOX | WS_TABSTOP, 8, 208, 95, 10 END IDD_ADVANCED DIALOGEX 0, 0, 292, 64 STYLE DS_SHELLFONT | WS_CHILD FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Charset:",IDC_STATIC,8,8,48,8 + LTEXT "字元集:",IDC_STATIC,8,8,48,8 COMBOBOX IDC_COMBO_CHARSET,72,4,116,80,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Group by:",IDC_STATIC,8,28,50,8 + LTEXT "分組:",IDC_STATIC,8,28,50,8 COMBOBOX IDC_COMBO_GROUPBY,72,24,116,80,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "Search",IDC_BUTTON_SEARCH,200,44,50,14 + PUSHBUTTON "搜尋",IDC_BUTTON_SEARCH,200,44,50,14 EDITTEXT IDC_EDIT_SEARCH,72,44,116,14,ES_AUTOHSCROLL - LTEXT "Search for:",IDC_STATIC,8,48,42,8 - LTEXT "Unicode:",IDC_STATIC,200,8,30,8 + LTEXT "搜尋目標:",IDC_STATIC,8,48,42,8 + LTEXT "到 Unicode:",IDC_STATIC,200,8,30,8 EDITTEXT IDC_EDIT_UNICODE,236,4,28,12,ES_AUTOHSCROLL END IDD_ABOUTBOX DIALOGEX 22,16,210,182 -CAPTION "rŪ" +CAPTION "關於字元對應表" FONT 8,"MS Shell Dlg",0,0 STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME BEGIN - LTEXT "rŪ v0.1\nCopyright (C) 2007 Ged Murphy (gedmurphy@reactos.org)", IDC_STATIC, 48, 7, 150, 36 - PUSHBUTTON "", IDOK, 75, 162, 44, 15 + LTEXT "字元對應表 v0.1\nCopyright (C) 2007 Ged Murphy (gedmurphy@reactos.org)", IDC_STATIC, 48, 7, 150, 36 + PUSHBUTTON "關閉", IDOK, 75, 162, 44, 15 ICON IDI_ICON, IDC_STATIC, 10, 10, 7, 30 EDITTEXT IDC_LICENSE_EDIT, 8, 44, 194, 107, WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_READONLY | ES_MULTILINE END @@ -46,6 +52,6 @@ END STRINGTABLE DISCARDABLE BEGIN IDS_LICENSE "This 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., 675 Mass Ave, Cambridge, MA 02139, USA." - IDS_ABOUT "(&A)..." - IDS_TITLE "Character Map" + IDS_ABOUT "關於(&A)..." + IDS_TITLE "字元對應表" END diff --git a/base/applications/charmap/rsrc.rc b/base/applications/charmap/rsrc.rc index 74f7b8bd86a..99007f8dc9f 100644 --- a/base/applications/charmap/rsrc.rc +++ b/base/applications/charmap/rsrc.rc @@ -1,18 +1,22 @@ +#include "lang/en-US.rc" +#include "lang/id-ID.rc" +#include "lang/nl-NL.rc" + +// UTF-8 +#pragma code_page(65001) #include "lang/bg-BG.rc" #include "lang/ca-ES.rc" #include "lang/cs-CZ.rc" #include "lang/de-DE.rc" #include "lang/el-GR.rc" -#include "lang/en-US.rc" #include "lang/es-ES.rc" #include "lang/fr-FR.rc" -#include "lang/id-ID.rc" #include "lang/it-IT.rc" #include "lang/ja-JP.rc" #include "lang/ko-KR.rc" #include "lang/lt-LT.rc" -#include "lang/nl-NL.rc" #include "lang/no-NO.rc" +#include "lang/pl-PL.rc" #include "lang/pt-BR.rc" #include "lang/ru-RU.rc" #include "lang/sk-SK.rc" @@ -20,7 +24,3 @@ #include "lang/uk-UA.rc" #include "lang/zh-CN.rc" #include "lang/zh-TW.rc" - -// UTF-8 -#pragma code_page(65001) -#include "lang/pl-PL.rc" diff --git a/base/applications/cmdutils/doskey/doskey.c b/base/applications/cmdutils/doskey/doskey.c index 986a3aa652c..5a73dc07f94 100644 --- a/base/applications/cmdutils/doskey/doskey.c +++ b/base/applications/cmdutils/doskey/doskey.c @@ -209,7 +209,7 @@ wmain(VOID) pExpungeConsoleCommandHistoryW = (ExpungeConsoleCommandHistoryW_t)GetProcAddress( hKernel32, "ExpungeConsoleCommandHistoryW"); assert(pGetConsoleCommandHistoryW && pGetConsoleCommandHistoryLengthW && - pSetConsoleNumberOfCommandsW && pSetConsoleNumberOfCommandsW); + pSetConsoleNumberOfCommandsW && pExpungeConsoleCommandHistoryW); /* Skip the application name */ GetArg(&pArgStart, &pArgEnd); diff --git a/base/applications/cmdutils/doskey/doskey.rc b/base/applications/cmdutils/doskey/doskey.rc index 1f901694382..100ecc561a5 100644 --- a/base/applications/cmdutils/doskey/doskey.rc +++ b/base/applications/cmdutils/doskey/doskey.rc @@ -10,8 +10,9 @@ #include "lang/de-DE.rc" #include "lang/en-US.rc" #include "lang/sv-SE.rc" -#include "lang/uk-UA.rc" // UTF-8 #pragma code_page(65001) #include "lang/pl-PL.rc" +#include "lang/uk-UA.rc" +#include "lang/zh-CN.rc" diff --git a/base/applications/cmdutils/doskey/lang/uk-UA.rc b/base/applications/cmdutils/doskey/lang/uk-UA.rc index 3655d47f57d..1f320a97e21 100644 --- a/base/applications/cmdutils/doskey/lang/uk-UA.rc +++ b/base/applications/cmdutils/doskey/lang/uk-UA.rc @@ -11,25 +11,25 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT STRINGTABLE DISCARDABLE BEGIN -IDS_HELP, " , ii i.\n\ +IDS_HELP, "Менеджер командного рядка для редагування налаштувань, iсторiї та макросiв.\n\ \n\ DOSKEY [/INSERT | /OVERSTRIKE] [/EXENAME=exe] [/HISTORY] [/LISTSIZE=size]\n\ [/REINSTALL] [/MACROS[:exe | :ALL]] [/MACROFILE=file] [macroname=[text]]\n\ \n\ - /INSERT .\n\ - /OVERSTRIKE i .\n\ - /EXENAME=exename /i ii\n\ - i i. cmd.exe.\n\ - /HISTORY i ii .\n\ - /LISTSIZE=size ii ii.\n\ - /REINSTALL ii .\n\ - /MACROS i i.\n\ - /MACROS:exename i i .\n\ - /MACROS:ALL i i i .\n\ - /MACROFILE=filename i .\n\ - macroname ii .\n\ - text i i.\n" + /INSERT Включає режим вставки.\n\ + /OVERSTRIKE Вiдключає режим вставки.\n\ + /EXENAME=exename Встановлення назви програми для перегляду/змiни iсторiї\n\ + i макросiв. Значення за замовчуванням cmd.exe.\n\ + /HISTORY Вiдображення iсторiї команд.\n\ + /LISTSIZE=size Встановлення кiлькостi команд в буфері iсторiї.\n\ + /REINSTALL Очищення iсторiї команд.\n\ + /MACROS Вiдображення визначень макросiв.\n\ + /MACROS:exename Вiдображення визначень макросiв для конкретної програми.\n\ + /MACROS:ALL Вiдображення визначень макросiв для всiх програм.\n\ + /MACROFILE=filename Завантаження визначень макросiв з файлу.\n\ + macroname Визначення iменi макросу для створення.\n\ + text Визначення замiни тексту в макросi.\n" -IDS_INVALID_MACRO_DEF, "i : %s\n" +IDS_INVALID_MACRO_DEF, "Недiйсний макрос визначення: %s\n" END diff --git a/base/applications/cmdutils/doskey/lang/zh-CN.rc b/base/applications/cmdutils/doskey/lang/zh-CN.rc new file mode 100644 index 00000000000..6f3fffadd93 --- /dev/null +++ b/base/applications/cmdutils/doskey/lang/zh-CN.rc @@ -0,0 +1,31 @@ +/* + * Translated by Song Fuchang (0xfc) + */ + +LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED + +STRINGTABLE DISCARDABLE +BEGIN + +IDS_HELP, "管理命令行编辑设置、历史记录和宏。\n\ +\n\ +DOSKEY [/INSERT | /OVERSTRIKE] [/EXENAME=exe] [/HISTORY] [/LISTSIZE=大小]\n\ + [/REINSTALL] [/MACROS[:exe | :ALL]] [/MACROFILE=文件] [宏名=[文本]]\n\ +\n\ + /INSERT 开启插入模式。\n\ + /OVERSTRIKE \n\ + /EXENAME=exename 设置要查看或改变历史记录和宏的程序名。\n\ + 默认为 cmd.exe。\n\ + /HISTORY 显示命令历史。\n\ + /LISTSIZE=size 设置每个历史记录缓存记录的命令数。\n\ + /REINSTALL 清空命令历史记录。\n\ + /MACROS 显示定义的宏。\n\ + /MACROS:exename 显示为指定程序定义的宏。\n\ + /MACROS:ALL 显示为所有程序定义的宏。\n\ + /MACROFILE=file 从文件载入宏定义。\n\ + 宏名 指定要创建的宏名。\n\ + 文本 指定要替换该宏的文本。\n" + +IDS_INVALID_MACRO_DEF, "无效的宏定义:%s\n" + +END diff --git a/base/applications/cmdutils/find/CMakeLists.txt b/base/applications/cmdutils/find/CMakeLists.txt index f94e42eee18..6f1d5b856c7 100644 --- a/base/applications/cmdutils/find/CMakeLists.txt +++ b/base/applications/cmdutils/find/CMakeLists.txt @@ -1,4 +1,5 @@ -add_definitions(-D_DLL -D__USE_CRTIMP) + +set_rc_compiler() add_executable(find find.c find.rc) diff --git a/base/applications/cmdutils/find/lang/ru-RU.rc b/base/applications/cmdutils/find/lang/ru-RU.rc index 726ebec18e4..945555940b8 100644 --- a/base/applications/cmdutils/find/lang/ru-RU.rc +++ b/base/applications/cmdutils/find/lang/ru-RU.rc @@ -3,15 +3,15 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT STRINGTABLE DISCARDABLE BEGIN -IDS_USAGE, "FIND: .\n\n\ - FIND [ /C ] [ /I ] [ /N ] [ /V ] """" [ ... ]\n\ - /C , .\n\ - /I .\n\ - /N ( 1).\n\ - /V , ." +IDS_USAGE, "FIND: Поиск текстовой строки в одном или нескольких файлах.\n\n\ + FIND [ /C ] [ /I ] [ /N ] [ /V ] ""строка"" [ файл... ]\n\ + /C Вывод только общего числа строк, содержащих заданную строку.\n\ + /I Поиск без учета регистра символов.\n\ + /N Вывод номеров отображаемых строк (начиная с 1).\n\ + /V Вывод всех строк, НЕ содержащих заданную строку." -IDS_NO_SUCH_FILE, "FIND: %s: .\n" +IDS_NO_SUCH_FILE, "FIND: %s: Файл не существует.\n" -IDS_CANNOT_OPEN, "FIND: %s: .\n" +IDS_CANNOT_OPEN, "FIND: %s: Невозможно открыть файл.\n" END diff --git a/base/applications/cmdutils/find/lang/uk-UA.rc b/base/applications/cmdutils/find/lang/uk-UA.rc index 43b241f33fd..7cef30daf65 100644 --- a/base/applications/cmdutils/find/lang/uk-UA.rc +++ b/base/applications/cmdutils/find/lang/uk-UA.rc @@ -11,15 +11,15 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT STRINGTABLE DISCARDABLE BEGIN -IDS_USAGE, "FIND: , .\n\n\ - FIND [ /C ] [ /I ] [ /N ] [ /V ] """" [ ... ]\n\ - /C , \n\ - /I \n\ - /N , ( 1)\n\ - /V , " +IDS_USAGE, "FIND: Виведення всіх рядків файлу, які містять рядок.\n\n\ + FIND [ /C ] [ /I ] [ /N ] [ /V ] ""рядок"" [ файл... ]\n\ + /C Порахувати кількість рядків, які містять рядок\n\ + /I Не враховувати регістр символів\n\ + /N Нумерувати рядки, які відображаються (починаючи з 1)\n\ + /V Виведення рядків, які не містять заданий рядок" -IDS_NO_SUCH_FILE, "FIND: %s: \n" +IDS_NO_SUCH_FILE, "FIND: %s: Файл не існує\n" -IDS_CANNOT_OPEN, "FIND: %s: \n" +IDS_CANNOT_OPEN, "FIND: %s: Неможливо відкрити файл\n" END diff --git a/base/applications/cmdutils/find/lang/zh-CN.rc b/base/applications/cmdutils/find/lang/zh-CN.rc new file mode 100644 index 00000000000..dc545fd85c7 --- /dev/null +++ b/base/applications/cmdutils/find/lang/zh-CN.rc @@ -0,0 +1,21 @@ +/* + * Translated by Song Fuchang (0xfc) + */ + +LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED + +STRINGTABLE DISCARDABLE +BEGIN + +IDS_USAGE, "FIND: 输出某文件中包含指定字符串的所有行。\n\n\ + FIND [ /C ] [ /I ] [ /N ] [ /V ] ""字符串"" [ 文件... ]\n\ + /C 计算包含该字符串的行数\n\ + /I 忽略大小写\n\ + /N 从 1 开始为显示的行编号\n\ + /V 输出不包含该指定字符串的行" + +IDS_NO_SUCH_FILE, "FIND: %s: 没有这个文件\n" + +IDS_CANNOT_OPEN, "FIND: %s: 无法打开文件\n" + +END diff --git a/base/applications/cmdutils/find/rsrc.rc b/base/applications/cmdutils/find/rsrc.rc index bcbc82848ba..f0638ab8b6f 100644 --- a/base/applications/cmdutils/find/rsrc.rc +++ b/base/applications/cmdutils/find/rsrc.rc @@ -13,11 +13,12 @@ #include "lang/lt-LT.rc" #include "lang/no-NO.rc" #include "lang/pt-BR.rc" -#include "lang/ru-RU.rc" #include "lang/sk-SK.rc" #include "lang/sv-SE.rc" -#include "lang/uk-UA.rc" // UTF-8 #pragma code_page(65001) #include "lang/pl-PL.rc" +#include "lang/ru-RU.rc" +#include "lang/uk-UA.rc" +#include "lang/zh-CN.rc" diff --git a/base/applications/cmdutils/hostname/CMakeLists.txt b/base/applications/cmdutils/hostname/CMakeLists.txt index 528d64f04ec..d9e9edac79f 100644 --- a/base/applications/cmdutils/hostname/CMakeLists.txt +++ b/base/applications/cmdutils/hostname/CMakeLists.txt @@ -1,4 +1,3 @@ -add_definitions(-D_DLL -D__USE_CRTIMP) add_executable(hostname hostname.c hostname.rc) diff --git a/base/applications/cmdutils/more/CMakeLists.txt b/base/applications/cmdutils/more/CMakeLists.txt index 34b841a09e2..251d0fc3c6f 100644 --- a/base/applications/cmdutils/more/CMakeLists.txt +++ b/base/applications/cmdutils/more/CMakeLists.txt @@ -1,4 +1,6 @@ +set_rc_compiler() + add_executable(more more.c more.rc) set_module_type(more win32cui) diff --git a/base/applications/cmdutils/more/lang/ru-RU.rc b/base/applications/cmdutils/more/lang/ru-RU.rc index b53980b0db1..20c39c1fbe5 100644 --- a/base/applications/cmdutils/more/lang/ru-RU.rc +++ b/base/applications/cmdutils/more/lang/ru-RU.rc @@ -10,14 +10,14 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT STRINGTABLE DISCARDABLE BEGIN - IDS_USAGE, " .\n\n\ - MORE < [:][] \n\ + IDS_USAGE, "Показывать данные постранично заполняя экран.\n\n\ + MORE < [Том:][Путь]Имя файла\n\ Command | MORE \n\ - MORE [:][] \n\n\ - [:][] .\n\ - Command\t\t , .\n\n\ - ""-- --"" .\n" + MORE [Том:][Путь]Имя файла\n\n\ + [Том:][Путь]Имя Файла Имя файла содержимое которого будет отображено.\n\ + Command\t\t Команда, результат работы которой требуется выводить на экран.\n\n\ + При запросе ""-- Продолжить --"" вы можете нажать любую клавишу для отображения следующего экрана.\n" - IDS_CONTINUE, " -- (100%) -- " - IDS_FILE_ACCESS, " %s." + IDS_CONTINUE, " -- Продолжить (100%) -- " + IDS_FILE_ACCESS, "Нет доступа к файлу %s." END diff --git a/base/applications/cmdutils/more/lang/uk-UA.rc b/base/applications/cmdutils/more/lang/uk-UA.rc index 5a930bb8449..805c5892225 100644 --- a/base/applications/cmdutils/more/lang/uk-UA.rc +++ b/base/applications/cmdutils/more/lang/uk-UA.rc @@ -9,15 +9,15 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT STRINGTABLE DISCARDABLE BEGIN - IDS_USAGE, " i . :\n\n\ - MORE < [:][]I'_\n\ + IDS_USAGE, "Виводить iнфрмацію поекранно. Використання:\n\n\ + MORE < [Диск:][Шлях]Iм'я_файлу\n\ Command | MORE \n\ - MORE [:][]I'_\n\n\ - : \n\ - [:][]'_ , i .\n\ - Command\t\t , .\n\n\ - ""-- i --"" - i i.\n" + MORE [Диск:][Шлях]Iм'я_файлу\n\n\ + Де: \n\ + [Диск:][Шлях]Ім'я_файлу Файл, вмiст якого треба вивести на екран.\n\ + Command\t\t Команда, результат роботи якої треба вивести на екран.\n\n\ + На запрошення ""-- Далi --"" Ви можете натиснути будь-яку клавiшу щоб побачити наступну сторiнку.\n" - IDS_CONTINUE, " -- i (100%) -- " - IDS_FILE_ACCESS, " %s." + IDS_CONTINUE, " -- Далi (100%) -- " + IDS_FILE_ACCESS, "Не можу отримати доступ до файла %s." END diff --git a/base/applications/cmdutils/more/lang/zh-CN.rc b/base/applications/cmdutils/more/lang/zh-CN.rc new file mode 100644 index 00000000000..c9aab8d256b --- /dev/null +++ b/base/applications/cmdutils/more/lang/zh-CN.rc @@ -0,0 +1,19 @@ +/* + * Translated by Song Fuchang (0xfc) + */ + +LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED + +STRINGTABLE DISCARDABLE +BEGIN + IDS_USAGE, "在屏幕上一页一页地显示内容。\n\n\ + MORE < [驱动器:][路径]文件名\n\ + 命令 | MORE \n\ + MORE [驱动器:][路径]文件名\n\n\ + [驱动器:][路径]文件名 一个将要被如此显示内容的文件。\n\ + 命令\t\t 一个输出将要被如此显示的命令。\n\n\ + 在 ""-- 继续 --"" 的提示出现时你可以按任意键来显示下一页。\n" + + IDS_CONTINUE, " -- 继续 (100%) -- " + IDS_FILE_ACCESS, "无法访问文件 %s。" +END diff --git a/base/applications/cmdutils/more/rsrc.rc b/base/applications/cmdutils/more/rsrc.rc index 045452af45a..d01b4c61bbc 100644 --- a/base/applications/cmdutils/more/rsrc.rc +++ b/base/applications/cmdutils/more/rsrc.rc @@ -9,11 +9,12 @@ #include "lang/it-IT.rc" #include "lang/lt-LT.rc" #include "lang/no-NO.rc" -#include "lang/ru-RU.rc" #include "lang/sk-SK.rc" #include "lang/sv-SE.rc" -#include "lang/uk-UA.rc" // UTF-8 #pragma code_page(65001) #include "lang/pl-PL.rc" +#include "lang/ru-RU.rc" +#include "lang/uk-UA.rc" +#include "lang/zh-CN.rc" diff --git a/base/applications/cmdutils/reg/CMakeLists.txt b/base/applications/cmdutils/reg/CMakeLists.txt index d33a5dc270c..7af6c898b92 100644 --- a/base/applications/cmdutils/reg/CMakeLists.txt +++ b/base/applications/cmdutils/reg/CMakeLists.txt @@ -1,5 +1,6 @@ set_unicode() +set_rc_compiler() remove_definitions(-D_WIN32_WINNT=0x502) add_definitions(-D_WIN32_WINNT=0x600) diff --git a/base/applications/cmdutils/xcopy/CMakeLists.txt b/base/applications/cmdutils/xcopy/CMakeLists.txt index 6ef21593877..17b0fb5dced 100644 --- a/base/applications/cmdutils/xcopy/CMakeLists.txt +++ b/base/applications/cmdutils/xcopy/CMakeLists.txt @@ -1,10 +1,10 @@ set_unicode() +set_rc_compiler() add_executable(xcopy xcopy.c rsrc.rc) target_link_libraries(xcopy wine) - set_module_type(xcopy win32cui) add_importlibs(xcopy shell32 user32 msvcrt kernel32 ntdll) add_cd_file(TARGET xcopy DESTINATION reactos/system32 FOR all) diff --git a/base/applications/dxdiag/CMakeLists.txt b/base/applications/dxdiag/CMakeLists.txt index d234cc13f6a..457a3bafac6 100644 --- a/base/applications/dxdiag/CMakeLists.txt +++ b/base/applications/dxdiag/CMakeLists.txt @@ -18,11 +18,7 @@ list(APPEND SOURCE d3dtest8.c d3dtest9.c) -add_executable(dxdiag - ${CMAKE_CURRENT_BINARY_DIR}/dxdiag_precomp.h.gch - ${SOURCE}) - -add_pch(dxdiag ${CMAKE_CURRENT_SOURCE_DIR}/precomp.h ${SOURCE}) +add_executable(dxdiag ${SOURCE}) set_module_type(dxdiag win32gui) @@ -30,4 +26,6 @@ target_link_libraries(dxdiag dxguid) add_importlibs(dxdiag user32 advapi32 comctl32 dinput8 setupapi dsound ddraw version gdi32 winmm d3d9 msvcrt kernel32 ntdll) +add_pch(dxdiag precomp.h) + add_cd_file(TARGET dxdiag DESTINATION reactos/system32 FOR all) diff --git a/base/applications/dxdiag/display.c b/base/applications/dxdiag/display.c index a67db53fee2..5cef4efb698 100644 --- a/base/applications/dxdiag/display.c +++ b/base/applications/dxdiag/display.c @@ -9,8 +9,6 @@ #include "precomp.h" #include -#include -#include BOOL GetFileModifyTime(LPCWSTR pFullPath, WCHAR * szTime, int szTimeSize) diff --git a/base/applications/dxdiag/lang/pl-PL.rc b/base/applications/dxdiag/lang/pl-PL.rc index de9971d1b86..aa14d3efa6c 100644 --- a/base/applications/dxdiag/lang/pl-PL.rc +++ b/base/applications/dxdiag/lang/pl-PL.rc @@ -1,6 +1,6 @@ /* * translated by Caemyr - Olaf Siejka (Apr,2008) - * updated by Saibamen - Adam Stachowicz (Apr, 2011) + * updated by Saibamen - Adam Stachowicz (saibamenppl@gmail.com) (August, 2011) * Use ReactOS forum PM or IRC to contact me * http://www.reactos.org * IRC: irc.freenode.net #reactos-pl @@ -50,7 +50,7 @@ BEGIN LTEXT "", IDC_STATIC_BIOS, 155, 130, 195, 10, SS_LEFT LTEXT "", IDC_STATIC_PROC, 155, 140, 195, 10, SS_LEFT LTEXT "", IDC_STATIC_MEM, 155, 150, 195, 10, SS_LEFT - LTEXT "", IDC_STATIC_SWAP, 155, 160, 195, 10, SS_LEFT + LTEXT "", IDC_STATIC_SWAP, 155, 160, 210, 10, SS_LEFT LTEXT "", IDC_STATIC_VERSION, 155, 170, 195, 10, SS_LEFT END @@ -159,7 +159,7 @@ FONT 8, "MS Shell Dlg" BEGIN GROUPBOX "Urządzenia DirectInput", -1, 10, 10, 452, 80 CONTROL "", IDC_LIST_DEVICE, "SysListView32", LVS_REPORT | WS_CHILD | WS_BORDER | WS_TABSTOP, 20, 22, 432, 60 - GROUPBOX "Urządenia wejścia", -1, 10, 100, 452, 60 + GROUPBOX "Urządzenia wejścia", -1, 10, 100, 452, 60 CONTROL "", IDC_TREE_PORT, "SysTreeView32", TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_DISABLEDRAGDROP | TVS_SHOWSELALWAYS | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 20, 112, 432, 40, 0x00000200 GROUPBOX "Informacje", -1, 10, 170, 452, 50 EDITTEXT IDC_RICH_INFO, 20, 182, 432, 30, WS_DISABLED | WS_TABSTOP @@ -220,7 +220,7 @@ BEGIN IDS_REG_SUCCESS "OK" IDS_REG_FAIL "Błąd" IDS_DDTEST_ERROR "Test nieudany!" - IDS_DDTEST_DESCRIPTION "Czy chcesz rozpocząć test interface DirectDraw?" + IDS_DDTEST_DESCRIPTION "Czy chcesz rozpocząć test interfejsu DirectDraw?" IDS_DDPRIMARY_DESCRIPTION "Ten test wykorzysta DirectDraw do rysowania na powierzchni podstawowej. Narysowane zostaną czarne i białe prostokąty. Kontynuować?" IDS_DDPRIMARY_RESULT "Czy było widać czarne i białe prostokąty?" IDS_DDOFFSCREEN_DESCRIPTION "Ten test wykorzysta DirectDraw do rysowania przy użyciu bufora pozaekranowego. Narysowany zostanie poruszający się biały kwadrat. Kontynuować?" diff --git a/base/applications/dxdiag/lang/ru-RU.rc b/base/applications/dxdiag/lang/ru-RU.rc index 29fe6321d27..327ed9c0e6a 100644 --- a/base/applications/dxdiag/lang/ru-RU.rc +++ b/base/applications/dxdiag/lang/ru-RU.rc @@ -4,34 +4,34 @@ IDD_MAIN_DIALOG DIALOGEX DISCARDABLE 0, 0, 478, 280 STYLE DS_SHELLFONT | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME -CAPTION " ReactX" +CAPTION "Средство диагностики ReactX" FONT 8, "MS Shell Dlg" BEGIN CONTROL "Tab1",IDC_TAB_CONTROL,"SysTabControl32",WS_TABSTOP,2,2,474,250 - PUSHBUTTON "&", IDC_BUTTON_HELP, 2, 260, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP - DEFPUSHBUTTON "& ", IDC_BUTTON_NEXT, 203, 260, 94, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP - PUSHBUTTON "& ...", IDC_BUTTON_SAVE_INFO, 301, 260, 120, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP - PUSHBUTTON "&", IDC_BUTTON_EXIT, 425, 260, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP + PUSHBUTTON "&Справка", IDC_BUTTON_HELP, 2, 260, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP + DEFPUSHBUTTON "&Следующая страница", IDC_BUTTON_NEXT, 203, 260, 94, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP + PUSHBUTTON "С&охранить всю информацию...", IDC_BUTTON_SAVE_INFO, 301, 260, 120, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP + PUSHBUTTON "&Выход", IDC_BUTTON_EXIT, 425, 260, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP END IDD_SYSTEM_DIALOG DIALOGEX DISCARDABLE 0, 0, 462, 190 STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ReactX.", -1, 10, 10, 443, 17 - LTEXT " , . "" "" .", -1, 10, 30, 443, 25 - GROUPBOX " ", -1, 10, 58, 443, 130, SS_RIGHT - LTEXT " :", -1, 70, 70, 80, 10, SS_RIGHT - LTEXT " :", -1, 70, 80, 80, 10, SS_RIGHT - LTEXT " :", -1, 50, 90, 100, 10, SS_RIGHT - LTEXT ":", -1, 70, 100, 80, 10, SS_RIGHT - LTEXT " :", -1, 50, 110, 100, 10, SS_RIGHT - LTEXT " :", -1, 70, 120, 80, 10, SS_RIGHT + LTEXT "Данная программа позволяет получить подробные сведения об установленных компонентах и драйверах ReactX.", -1, 10, 10, 443, 17 + LTEXT "Если известна возможная причина неполадки, можно сразу выбрать соответствующую вкладку. В противном случае используйте кнопку ""Следующая страница"" для последовательного просмотра страниц.", -1, 10, 30, 443, 25 + GROUPBOX "Сведения о системе", -1, 10, 58, 443, 130, SS_RIGHT + LTEXT "Текущие время и дата:", -1, 70, 70, 80, 10, SS_RIGHT + LTEXT "Имя компьютера:", -1, 70, 80, 80, 10, SS_RIGHT + LTEXT "Операционная система:", -1, 50, 90, 100, 10, SS_RIGHT + LTEXT "Язык:", -1, 70, 100, 80, 10, SS_RIGHT + LTEXT "Изготовитель компьютера:", -1, 50, 110, 100, 10, SS_RIGHT + LTEXT "Модель компьютера:", -1, 70, 120, 80, 10, SS_RIGHT LTEXT "BIOS:", -1, 70, 130, 80, 10, SS_RIGHT - LTEXT ":", -1, 70, 140, 80, 10, SS_RIGHT - LTEXT ":", -1, 70, 150, 80, 10, SS_RIGHT - LTEXT " :", -1, 70, 160, 80, 10, SS_RIGHT - LTEXT " ReactX:", -1, 70, 170, 80, 10, SS_RIGHT + LTEXT "Процессор:", -1, 70, 140, 80, 10, SS_RIGHT + LTEXT "Память:", -1, 70, 150, 80, 10, SS_RIGHT + LTEXT "Файл подкачки:", -1, 70, 160, 80, 10, SS_RIGHT + LTEXT "Версия ReactX:", -1, 70, 170, 80, 10, SS_RIGHT LTEXT "", IDC_STATIC_TIME, 155, 70, 195, 10, SS_LEFT LTEXT "", IDC_STATIC_COMPUTER, 155, 80, 195, 10, SS_LEFT LTEXT "", IDC_STATIC_OS, 155, 90, 195, 10, SS_LEFT @@ -49,14 +49,14 @@ IDD_DISPLAY_DIALOG DIALOGEX DISCARDABLE 0, 0, 462, 220 STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "", -1, 10, 10, 220, 100 - RTEXT ":", -1, 20, 25, 70, 10 - RTEXT ":", -1, 20, 35, 70, 10 - RTEXT " :", -1, 20, 45, 70, 10 - RTEXT " DAC:", -1, 15, 55, 75, 10 - RTEXT " :", -1, 20, 65, 70, 10 - RTEXT " :", -1, 20, 75, 70, 10 - RTEXT ":", -1, 20, 85, 70, 10 + GROUPBOX "Устройство", -1, 10, 10, 220, 100 + RTEXT "Имя:", -1, 20, 25, 70, 10 + RTEXT "Изготовитель:", -1, 20, 35, 70, 10 + RTEXT "Тип микросхем:", -1, 20, 45, 70, 10 + RTEXT "Тип конвертера DAC:", -1, 15, 55, 75, 10 + RTEXT "Всего памяти:", -1, 20, 65, 70, 10 + RTEXT "Режим экрана:", -1, 20, 75, 70, 10 + RTEXT "Монитор:", -1, 20, 85, 70, 10 LTEXT "", IDC_STATIC_ADAPTER_ID, 95, 25, 130, 10 LTEXT "", IDC_STATIC_ADAPTER_VENDOR, 95, 35, 130, 10 LTEXT "", IDC_STATIC_ADAPTER_CHIP, 95, 45, 130, 10 @@ -65,14 +65,14 @@ BEGIN LTEXT "", IDC_STATIC_ADAPTER_MODE, 95, 75, 130, 10 LTEXT "", IDC_STATIC_ADAPTER_MONITOR, 95, 85, 130, 10 - GROUPBOX "", -1, 240, 10, 220, 100 - RTEXT ":", -1, 245, 30, 55, 10 - RTEXT ":", -1, 245, 40, 55, 10 - RTEXT ":", -1, 245, 50, 55, 10 - RTEXT ":", -1, 245, 60, 55, 10 - RTEXT "-VDD:", -1, 245, 70, 55, 10 + GROUPBOX "Драйверы", -1, 240, 10, 220, 100 + RTEXT "Главный:", -1, 245, 30, 55, 10 + RTEXT "Версия:", -1, 245, 40, 55, 10 + RTEXT "Дата:", -1, 245, 50, 55, 10 + RTEXT "Подпись:", -1, 245, 60, 55, 10 + RTEXT "Мини-VDD:", -1, 245, 70, 55, 10 RTEXT "VDD:", -1, 245, 80, 55, 10 - RTEXT " DDI:", -1, 245, 90, 55, 10 + RTEXT "Версия DDI:", -1, 245, 90, 55, 10 LTEXT "", IDC_STATIC_ADAPTER_DRIVER, 305, 30, 130, 10 LTEXT "", IDC_STATIC_ADAPTER_VERSION, 305, 40, 130, 10 LTEXT "", IDC_STATIC_ADAPTER_DATE, 305, 50, 130, 10 @@ -81,20 +81,20 @@ BEGIN LTEXT "", IDC_STATIC_ADAPTER_VDD, 305, 80, 130, 10 LTEXT "", IDC_STATIC_ADAPTER_DDI, 305, 90, 130, 10 - GROUPBOX " ReactX", -1, 10, 115, 450, 65 - RTEXT " DirectDraw:", -1, 15, 130, 110, 12 - RTEXT " Direct3D:", -1, 15, 145, 110, 12 - RTEXT " AGP:", -1, 15, 160, 110, 12 + GROUPBOX "Возможности ReactX", -1, 10, 115, 450, 65 + RTEXT "Ускорение DirectDraw:", -1, 15, 130, 110, 12 + RTEXT "Ускорение Direct3D:", -1, 15, 145, 110, 12 + RTEXT "Ускорение текстур AGP:", -1, 15, 160, 110, 12 LTEXT "", IDC_STATIC_DDSTATE, 130, 130, 40, 10 LTEXT "", IDC_STATIC_D3DSTATE, 130, 145, 40, 10 LTEXT "", IDC_STATIC_AGPSTATE, 130, 160, 40, 10 - PUSHBUTTON "", IDC_BUTTON_DDRAW, 170, 126, 60, 14, WS_DISABLED - PUSHBUTTON "", IDC_BUTTON_D3D, 170, 142, 60, 14, WS_DISABLED - PUSHBUTTON "", IDC_BUTTON_AGP, 170, 158, 60, 14, WS_DISABLED - PUSHBUTTON " DirectDraw", IDC_BUTTON_TESTDD, 250, 126, 80, 14 - PUSHBUTTON " Direct3D", IDC_BUTTON_TEST3D, 250, 142, 80, 14, WS_DISABLED + PUSHBUTTON "Включить", IDC_BUTTON_DDRAW, 170, 126, 60, 14, WS_DISABLED + PUSHBUTTON "Включить", IDC_BUTTON_D3D, 170, 142, 60, 14, WS_DISABLED + PUSHBUTTON "Включить", IDC_BUTTON_AGP, 170, 158, 60, 14, WS_DISABLED + PUSHBUTTON "Проверка DirectDraw", IDC_BUTTON_TESTDD, 250, 126, 80, 14 + PUSHBUTTON "Проверка Direct3D", IDC_BUTTON_TEST3D, 250, 142, 80, 14, WS_DISABLED - GROUPBOX "", -1, 10, 185, 450, 34 + GROUPBOX "Примечания", -1, 10, 185, 450, 34 EDITTEXT IDC_TEXT_INFO, 20, 195, 432, 18, WS_DISABLED | WS_TABSTOP END @@ -103,37 +103,37 @@ IDD_SOUND_DIALOG DIALOGEX DISCARDABLE 0, 0, 462, 220 STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "", -1, 10, 10, 250, 100 - RTEXT ":", -1, 20, 25, 70, 10 - RTEXT " :", -1, 20, 35, 70, 10 - RTEXT " :", -1, 20, 45, 70, 10 - RTEXT " :", -1, 20, 55, 70, 10 - RTEXT ":", -1, 20, 65, 70, 10 - RTEXT " :", -1, 20, 75, 70, 10 + GROUPBOX "Устройство", -1, 10, 10, 250, 100 + RTEXT "Имя:", -1, 20, 25, 70, 10 + RTEXT "Код устройства:", -1, 20, 35, 70, 10 + RTEXT "Код изготовителя:", -1, 20, 45, 70, 10 + RTEXT "Код продукта:", -1, 20, 55, 70, 10 + RTEXT "Тип:", -1, 20, 65, 70, 10 + RTEXT "По умолчанию:", -1, 20, 75, 70, 10 LTEXT "", IDC_STATIC_DSOUND_NAME, 95, 25, 150, 10 LTEXT "", IDC_STATIC_DSOUND_DEVICEID, 95, 35, 150, 10 LTEXT "", IDC_STATIC_DSOUND_VENDORID, 95, 45, 150, 10 LTEXT "", IDC_STATIC_DSOUND_PRODUCTID, 95, 55, 150, 10 LTEXT "", IDC_STATIC_DSOUND_TYPE, 95, 65, 150, 10 LTEXT "", IDC_STATIC_DSOUND_STANDARD, 95, 75, 150, 10 - GROUPBOX "", -1, 270, 10, 190, 100 - RTEXT ":", -1, 275, 25, 55, 10 - RTEXT ":", -1, 275, 35, 55, 10 - RTEXT ":", -1, 275, 45, 55, 10 - RTEXT ":", -1, 275, 55, 55, 10 - RTEXT " :", -1, 275, 65, 55, 10 - RTEXT ":", -1, 275, 75, 55, 10 + GROUPBOX "Драйверы", -1, 270, 10, 190, 100 + RTEXT "Имя:", -1, 275, 25, 55, 10 + RTEXT "Версия:", -1, 275, 35, 55, 10 + RTEXT "Дата:", -1, 275, 45, 55, 10 + RTEXT "Подпись:", -1, 275, 55, 55, 10 + RTEXT "Другие файлы:", -1, 275, 65, 55, 10 + RTEXT "Поставщик:", -1, 275, 75, 55, 10 LTEXT "", IDC_STATIC_DSOUND_DRIVER, 335, 25, 100, 10 LTEXT "", IDC_STATIC_DSOUND_VERSION, 335, 35, 100, 10 LTEXT "", IDC_STATIC_DSOUND_DATE, 335, 45, 100, 10 LTEXT "", IDC_STATIC_DSOUND_LOGO, 335, 55, 100, 10 LTEXT "", IDC_STATIC_DSOUND_FILES, 335, 65, 100, 10 LTEXT "", IDC_STATIC_ADAPTER_PROVIDER, 335, 75, 100, 10 - GROUPBOX " ReactX", -1, 10, 115, 450, 60 + GROUPBOX "Возможности ReactX", -1, 10, 115, 450, 60 CONTROL "", IDC_SLIDER_DSOUND, "msctls_trackbar32", TBS_BOTTOM | TBS_AUTOTICKS | WS_TABSTOP, 120, 135, 80, 17 - RTEXT " \n:", -1, 20, 135, 90, 20 - PUSHBUTTON " DirectSound", IDC_BUTTON_TESTDSOUND, 270, 130, 80, 14 - GROUPBOX "", -1, 10, 180, 450, 40 + RTEXT "Уровень аппаратного\nускорения:", -1, 20, 135, 90, 20 + PUSHBUTTON "Проверка DirectSound", IDC_BUTTON_TESTDSOUND, 270, 130, 80, 14 + GROUPBOX "Примечания", -1, 10, 180, 450, 40 EDITTEXT IDC_TEXT_DSOUNDINFO, 20, 190, 432, 20, WS_DISABLED | WS_TABSTOP END @@ -148,11 +148,11 @@ IDD_INPUT_DIALOG DIALOGEX DISCARDABLE 0, 0, 462, 220 STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " DirectInput", -1, 10, 10, 452, 80 + GROUPBOX "Устройства DirectInput", -1, 10, 10, 452, 80 CONTROL "", IDC_LIST_DEVICE, "SysListView32", LVS_REPORT | WS_CHILD | WS_BORDER | WS_TABSTOP, 20, 20, 432, 60 - GROUPBOX " ", -1, 10, 100, 452, 60 + GROUPBOX "Устройства ввода", -1, 10, 100, 452, 60 CONTROL "", IDC_TREE_PORT, "SysTreeView32", TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_DISABLEDRAGDROP | TVS_SHOWSELALWAYS | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 20, 110, 432, 40, 0x00000200 - GROUPBOX "", -1, 10, 170, 452, 50 + GROUPBOX "Информация", -1, 10, 170, 452, 50 EDITTEXT IDC_RICH_INFO, 20, 180, 432, 30, WS_DISABLED | WS_TABSTOP END @@ -160,7 +160,7 @@ IDD_NETWORK_DIALOG DIALOGEX DISCARDABLE 0, 0, 462, 220 STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " DirectPlay", -1, 10, 10, 452, 80 + GROUPBOX "Зарегистрированные поставщики DirectPlay", -1, 10, 10, 452, 80 CONTROL "", IDC_LIST_PROVIDER, "SysListView32", LVS_REPORT | WS_CHILD | WS_BORDER | WS_TABSTOP, 20, 22, 432, 60 END @@ -172,53 +172,53 @@ END STRINGTABLE DISCARDABLE BEGIN - IDS_MAIN_DIALOG " ReactX" - IDS_SYSTEM_DIALOG "" - IDS_DISPLAY_DIALOG "" - IDS_SOUND_DIALOG "" - IDS_MUSIC_DIALOG "" - IDS_INPUT_DIALOG "" - IDS_NETWORK_DIALOG "" - IDS_HELP_DIALOG "" - IDS_FORMAT_MB "%I64u " - IDS_FORMAT_SWAP "%I64u , %I64u " - IDS_FORMAT_UNIPROC "%s (%u )" - IDS_FORMAT_MPPROC "%s (%u )" - IDS_VERSION_UNKNOWN " " - IDS_DEVICE_STATUS_ATTACHED "" - IDS_DEVICE_STATUS_MISSING "" - IDS_DEVICE_STATUS_UNKNOWN "" - IDS_DEVICE_NAME " " - IDS_DEVICE_STATUS "" - IDS_DEVICE_CONTROLLER "ID " - IDS_DEVICE_MANUFACTURER "ID " - IDS_DEVICE_PRODUCT "ID " - IDS_DEVICE_FORCEFEEDBACK " Force Feedback" - IDS_NOT_APPLICABLE "/" - IDS_OPTION_YES "" - IDS_DIRECTPLAY_COL_NAME1 "" - IDS_DIRECTPLAY_COL_NAME2 "" - IDS_DIRECTPLAY_COL_NAME3 "" - IDS_DIRECTPLAY_COL_NAME4 "" - IDS_DIRECTPLAY8_MODEMSP " DirectPlay8" - IDS_DIRECTPLAY8_SERIALSP " . DirectPlay8" - IDS_DIRECTPLAY8_IPXSP " IPX DirectPlay8" - IDS_DIRECTPLAY8_TCPSP " TCP/IP DirectPlay8" - IDS_DIRECTPLAY_TCPCONN "- TCP/IP DirectPlay" - IDS_DIRECTPLAY_IPXCONN "IPX DirectPlay" - IDS_DIRECTPLAY_MODEMCONN " DirectPlay" - IDS_DIRECTPLAY_SERIALCONN " DirectPlay" + IDS_MAIN_DIALOG "Средство диагностики ReactX" + IDS_SYSTEM_DIALOG "Система" + IDS_DISPLAY_DIALOG "Экран" + IDS_SOUND_DIALOG "Звук" + IDS_MUSIC_DIALOG "Музыка" + IDS_INPUT_DIALOG "Ввод" + IDS_NETWORK_DIALOG "Сеть" + IDS_HELP_DIALOG "Справка" + IDS_FORMAT_MB "%I64uМБ ОЗУ" + IDS_FORMAT_SWAP "%I64u МБ использовано, %I64u МБ доступно" + IDS_FORMAT_UNIPROC "%s (%u ЦП)" + IDS_FORMAT_MPPROC "%s (%u ЦП)" + IDS_VERSION_UNKNOWN "Неизвестная версия" + IDS_DEVICE_STATUS_ATTACHED "Подключено" + IDS_DEVICE_STATUS_MISSING "Отключено" + IDS_DEVICE_STATUS_UNKNOWN "Неизвестно" + IDS_DEVICE_NAME "Имя устройства" + IDS_DEVICE_STATUS "Состояние" + IDS_DEVICE_CONTROLLER "ID контроллера" + IDS_DEVICE_MANUFACTURER "ID производителя" + IDS_DEVICE_PRODUCT "ID продукта" + IDS_DEVICE_FORCEFEEDBACK "Драйвер Force Feedback" + IDS_NOT_APPLICABLE "Н/Д" + IDS_OPTION_YES "Да" + IDS_DIRECTPLAY_COL_NAME1 "Имя" + IDS_DIRECTPLAY_COL_NAME2 "Реестр" + IDS_DIRECTPLAY_COL_NAME3 "Файл" + IDS_DIRECTPLAY_COL_NAME4 "Версия" + IDS_DIRECTPLAY8_MODEMSP "Поставщик службы модема DirectPlay8" + IDS_DIRECTPLAY8_SERIALSP "Поставщик службы посл. порта DirectPlay8" + IDS_DIRECTPLAY8_IPXSP "Поставщик службы IPX DirectPlay8" + IDS_DIRECTPLAY8_TCPSP "Поставщик службы TCP/IP DirectPlay8" + IDS_DIRECTPLAY_TCPCONN "Интернет-подключение TCP/IP для DirectPlay" + IDS_DIRECTPLAY_IPXCONN "IPX подключение для DirectPlay" + IDS_DIRECTPLAY_MODEMCONN "Подключение через модем для DirectPlay" + IDS_DIRECTPLAY_SERIALCONN "Последовательное подключение для DirectPlay" IDS_REG_SUCCESS "OK" - IDS_REG_FAIL "" - IDS_DDTEST_ERROR " !" - IDS_DDTEST_DESCRIPTION " DirecDraw . ?" - IDS_DDPRIMARY_DESCRIPTION "This test will use DirectDraw to draw on primary surface. Black and white rectangles should be drawn. ?" - IDS_DDPRIMARY_RESULT " ?" - IDS_DDOFFSCREEN_DESCRIPTION "This test will use DirectDraw to draw in an offscreen buffer. Moving white rectangle should be drawn. ?" - IDS_DDOFFSCREEN_RESULT " ?" - IDS_DDFULLSCREEN_DESCRIPTION "This test will use DirectDraw to draw in a fullscreen mode. Moving white rectangle should be drawn. ?" - IDS_DDFULLSCREEN_RESULT " ?" - IDS_FORMAT_ADAPTER_MEM "%u " - IDS_FORMAT_ADAPTER_MODE "%04u x %04u (%u )(%u)" - IDS_OPTION_NO "" + IDS_REG_FAIL "Ошибка" + IDS_DDTEST_ERROR "Сбой в проверке!" + IDS_DDTEST_DESCRIPTION "Будет произведена проверка DirecDraw на этом устройстве. Продолжить?" + IDS_DDPRIMARY_DESCRIPTION "This test will use DirectDraw to draw on primary surface. Black and white rectangles should be drawn. Продолжить?" + IDS_DDPRIMARY_RESULT "Вы видели черные и белые прямоугольники?" + IDS_DDOFFSCREEN_DESCRIPTION "This test will use DirectDraw to draw in an offscreen buffer. Moving white rectangle should be drawn. Продолжить?" + IDS_DDOFFSCREEN_RESULT "Вы видели перемещающийся белый прямоугольник?" + IDS_DDFULLSCREEN_DESCRIPTION "This test will use DirectDraw to draw in a fullscreen mode. Moving white rectangle should be drawn. Продолжить?" + IDS_DDFULLSCREEN_RESULT "Вы видели белый перемешающийся прямоугольник в полноэкранном режиме?" + IDS_FORMAT_ADAPTER_MEM "%u Мб" + IDS_FORMAT_ADAPTER_MODE "%04u x %04u (%u бит)(%uГц)" + IDS_OPTION_NO "Нет" END diff --git a/base/applications/dxdiag/lang/ua-UA.rc b/base/applications/dxdiag/lang/ua-UA.rc deleted file mode 100644 index 0cd5c0aa74c..00000000000 --- a/base/applications/dxdiag/lang/ua-UA.rc +++ /dev/null @@ -1,234 +0,0 @@ -/* - * PROJECT: ReactOS dxdiag - * LICENSE: GPL - See COPYING in the top level directory - * FILE: base/applications/dxdiag/lang/uk-UA.rc - * PURPOSE: Ukraianian Language File for ReactOS dxdiag - * TRANSLATOR: Sakara Yevhen - */ - -LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT - -IDD_MAIN_DIALOG DIALOGEX DISCARDABLE 0, 0, 478, 280 -STYLE DS_SHELLFONT | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | - WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_CAPTION | WS_SYSMENU | - WS_THICKFRAME -CAPTION " ReactX" -FONT 8, "MS Shell Dlg" -BEGIN - CONTROL "Tab1",IDC_TAB_CONTROL,"SysTabControl32",WS_TABSTOP,2,2,474,250 - PUSHBUTTON "&", IDC_BUTTON_HELP, 2, 260, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP - DEFPUSHBUTTON "& ", IDC_BUTTON_NEXT, 203, 260, 94, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP - PUSHBUTTON "& ...", IDC_BUTTON_SAVE_INFO, 301, 260, 120, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP - PUSHBUTTON "&", IDC_BUTTON_EXIT, 425, 260, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP -END - -IDD_SYSTEM_DIALOG DIALOGEX DISCARDABLE 0, 0, 462, 190 -STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN -FONT 8, "MS Shell Dlg" -BEGIN - LTEXT " ReactX.", -1, 10, 10, 443, 17 - LTEXT " , . "" "" .", -1, 10, 30, 443, 25 - GROUPBOX "³ ", -1, 10, 58, 443, 130, SS_RIGHT - LTEXT " :", -1, 70, 70, 80, 10, SS_RIGHT - LTEXT "' ':", -1, 70, 80, 80, 10, SS_RIGHT - LTEXT " :", -1, 50, 90, 100, 10, SS_RIGHT - LTEXT ":", -1, 70, 100, 80, 10, SS_RIGHT - LTEXT " ':", -1, 50, 110, 100, 10, SS_RIGHT - LTEXT " ':", -1, 70, 120, 80, 10, SS_RIGHT - LTEXT "BIOS:", -1, 70, 130, 80, 10, SS_RIGHT - LTEXT ":", -1, 70, 140, 80, 10, SS_RIGHT - LTEXT "':", -1, 70, 150, 80, 10, SS_RIGHT - LTEXT " :", -1, 70, 160, 80, 10, SS_RIGHT - LTEXT " ReactX:", -1, 70, 170, 80, 10, SS_RIGHT - LTEXT "", IDC_STATIC_TIME, 155, 70, 195, 10, SS_LEFT - LTEXT "", IDC_STATIC_COMPUTER, 155, 80, 195, 10, SS_LEFT - LTEXT "", IDC_STATIC_OS, 155, 90, 195, 10, SS_LEFT - LTEXT "", IDC_STATIC_LANG, 155, 100, 195, 10, SS_LEFT - LTEXT "", IDC_STATIC_MANU, 155, 110, 195, 10, SS_LEFT - LTEXT "", IDC_STATIC_MODEL, 155, 120, 195, 10, SS_LEFT - LTEXT "", IDC_STATIC_BIOS, 155, 130, 195, 10, SS_LEFT - LTEXT "", IDC_STATIC_PROC, 155, 140, 195, 10, SS_LEFT - LTEXT "", IDC_STATIC_MEM, 155, 150, 195, 10, SS_LEFT - LTEXT "", IDC_STATIC_SWAP, 155, 160, 195, 10, SS_LEFT - LTEXT "", IDC_STATIC_VERSION, 155, 170, 195, 10, SS_LEFT -END - -IDD_DISPLAY_DIALOG DIALOGEX DISCARDABLE 0, 0, 462, 220 -STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN -FONT 8, "MS Shell Dlg" -BEGIN - GROUPBOX "", -1, 10, 10, 220, 100 - RTEXT ":", -1, 20, 25, 70, 10 - RTEXT ":", -1, 20, 35, 70, 10 - RTEXT " :", -1, 20, 45, 70, 10 - RTEXT " DAC:", -1, 15, 55, 75, 10 - RTEXT " ':", -1, 20, 65, 70, 10 - RTEXT " :", -1, 20, 75, 70, 10 - RTEXT ":", -1, 20, 85, 70, 10 - LTEXT "", IDC_STATIC_ADAPTER_ID, 95, 25, 130, 10 - LTEXT "", IDC_STATIC_ADAPTER_VENDOR, 95, 35, 130, 10 - LTEXT "", IDC_STATIC_ADAPTER_CHIP, 95, 45, 130, 10 - LTEXT "", IDC_STATIC_ADAPTER_DAC, 95, 55, 130, 10 - LTEXT "", IDC_STATIC_ADAPTER_MEM, 95, 65, 130, 10 - LTEXT "", IDC_STATIC_ADAPTER_MODE, 95, 75, 130, 10 - LTEXT "", IDC_STATIC_ADAPTER_MONITOR, 95, 85, 130, 10 - - GROUPBOX "", -1, 240, 10, 220, 100 - RTEXT ":", -1, 245, 30, 55, 10 - RTEXT ":", -1, 245, 40, 55, 10 - RTEXT ":", -1, 245, 50, 55, 10 - RTEXT "ϳ:", -1, 245, 60, 55, 10 - RTEXT "̳-VDD:", -1, 245, 70, 55, 10 - RTEXT "VDD:", -1, 245, 80, 55, 10 - RTEXT " DDI:", -1, 245, 90, 55, 10 - LTEXT "", IDC_STATIC_ADAPTER_DRIVER, 305, 30, 130, 10 - LTEXT "", IDC_STATIC_ADAPTER_VERSION, 305, 40, 130, 10 - LTEXT "", IDC_STATIC_ADAPTER_DATE, 305, 50, 130, 10 - LTEXT "", IDC_STATIC_ADAPTER_LOGO, 305, 60, 130, 10 - LTEXT "", IDC_STATIC_ADAPTER_MINIVDD, 305, 70, 130, 10 - LTEXT "", IDC_STATIC_ADAPTER_VDD, 305, 80, 130, 10 - LTEXT "", IDC_STATIC_ADAPTER_DDI, 305, 90, 130, 10 - - GROUPBOX " ReactX", -1, 10, 115, 450, 65 - RTEXT " DirectDraw:", -1, 15, 130, 110, 12 - RTEXT " Direct3D:", -1, 15, 145, 110, 12 - RTEXT " AGP:", -1, 15, 160, 110, 12 - LTEXT "", IDC_STATIC_DDSTATE, 130, 130, 40, 10 - LTEXT "", IDC_STATIC_D3DSTATE, 130, 145, 40, 10 - LTEXT "", IDC_STATIC_AGPSTATE, 130, 160, 40, 10 - PUSHBUTTON "", IDC_BUTTON_DDRAW, 170, 126, 60, 14, WS_DISABLED - PUSHBUTTON "", IDC_BUTTON_D3D, 170, 142, 60, 14, WS_DISABLED - PUSHBUTTON "", IDC_BUTTON_AGP, 170, 158, 60, 14, WS_DISABLED - PUSHBUTTON " DirectDraw", IDC_BUTTON_TESTDD, 250, 126, 80, 14 - PUSHBUTTON " Direct3D", IDC_BUTTON_TEST3D, 250, 142, 80, 14, WS_DISABLED - - GROUPBOX "", -1, 10, 185, 450, 34 - EDITTEXT IDC_TEXT_INFO, 20, 195, 432, 18, WS_DISABLED | WS_TABSTOP -END - - -IDD_SOUND_DIALOG DIALOGEX DISCARDABLE 0, 0, 462, 220 -STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN -FONT 8, "MS Shell Dlg" -BEGIN - GROUPBOX "", -1, 10, 10, 250, 100 - RTEXT ":", -1, 20, 25, 70, 10 - RTEXT " :", -1, 20, 35, 70, 10 - RTEXT " :", -1, 20, 45, 70, 10 - RTEXT " :", -1, 20, 55, 70, 10 - RTEXT ":", -1, 20, 65, 70, 10 - RTEXT " :", -1, 20, 75, 70, 10 - LTEXT "", IDC_STATIC_DSOUND_NAME, 95, 25, 150, 10 - LTEXT "", IDC_STATIC_DSOUND_DEVICEID, 95, 35, 150, 10 - LTEXT "", IDC_STATIC_DSOUND_VENDORID, 95, 45, 150, 10 - LTEXT "", IDC_STATIC_DSOUND_PRODUCTID, 95, 55, 150, 10 - LTEXT "", IDC_STATIC_DSOUND_TYPE, 95, 65, 150, 10 - LTEXT "", IDC_STATIC_DSOUND_STANDARD, 95, 75, 150, 10 - GROUPBOX "", -1, 270, 10, 190, 100 - RTEXT ":", -1, 275, 25, 55, 10 - RTEXT ":", -1, 275, 35, 55, 10 - RTEXT ":", -1, 275, 45, 55, 10 - RTEXT "ϳ:", -1, 275, 55, 55, 10 - RTEXT " :", -1, 275, 65, 55, 10 - RTEXT ":", -1, 275, 75, 55, 10 - LTEXT "", IDC_STATIC_DSOUND_DRIVER, 335, 25, 100, 10 - LTEXT "", IDC_STATIC_DSOUND_VERSION, 335, 35, 100, 10 - LTEXT "", IDC_STATIC_DSOUND_DATE, 335, 45, 100, 10 - LTEXT "", IDC_STATIC_DSOUND_LOGO, 335, 55, 100, 10 - LTEXT "", IDC_STATIC_DSOUND_FILES, 335, 65, 100, 10 - LTEXT "", IDC_STATIC_ADAPTER_PROVIDER, 335, 75, 100, 10 - GROUPBOX " ReactX", -1, 10, 115, 450, 60 - CONTROL "", IDC_SLIDER_DSOUND, "msctls_trackbar32", TBS_BOTTOM | TBS_AUTOTICKS | WS_TABSTOP, 120, 135, 80, 17 - RTEXT "г \n:", -1, 20, 135, 90, 20 - PUSHBUTTON " DirectSound", IDC_BUTTON_TESTDSOUND, 270, 130, 80, 14 - GROUPBOX "", -1, 10, 180, 450, 40 - EDITTEXT IDC_TEXT_DSOUNDINFO, 20, 190, 432, 20, WS_DISABLED | WS_TABSTOP -END - -IDD_MUSIC_DIALOG DIALOGEX DISCARDABLE 0, 0, 462, 220 -STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN -FONT 8, "MS Shell Dlg" -BEGIN -END - - -IDD_INPUT_DIALOG DIALOGEX DISCARDABLE 0, 0, 462, 220 -STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN -FONT 8, "MS Shell Dlg" -BEGIN - GROUPBOX " DirectInput", -1, 10, 10, 452, 80 - CONTROL "", IDC_LIST_DEVICE, "SysListView32", LVS_REPORT | WS_CHILD | WS_BORDER | WS_TABSTOP, 20, 20, 432, 60 - GROUPBOX " ", -1, 10, 100, 452, 60 - CONTROL "", IDC_TREE_PORT, "SysTreeView32", TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_DISABLEDRAGDROP | TVS_SHOWSELALWAYS | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 20, 110, 432, 40, 0x00000200 - GROUPBOX "", -1, 10, 170, 452, 50 - EDITTEXT IDC_RICH_INFO, 20, 180, 432, 30, WS_DISABLED | WS_TABSTOP -END - -IDD_NETWORK_DIALOG DIALOGEX DISCARDABLE 0, 0, 462, 220 -STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN -FONT 8, "MS Shell Dlg" -BEGIN - GROUPBOX " DirectPlay", -1, 10, 10, 452, 80 - CONTROL "", IDC_LIST_PROVIDER, "SysListView32", LVS_REPORT | WS_CHILD | WS_BORDER | WS_TABSTOP, 20, 22, 432, 60 -END - -IDD_HELP_DIALOG DIALOGEX DISCARDABLE 0, 0, 462, 220 -STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN -FONT 8, "MS Shell Dlg" -BEGIN -END - -STRINGTABLE DISCARDABLE -BEGIN - IDS_MAIN_DIALOG " ReactX" - IDS_SYSTEM_DIALOG "" - IDS_DISPLAY_DIALOG "" - IDS_SOUND_DIALOG "" - IDS_MUSIC_DIALOG "" - IDS_INPUT_DIALOG "" - IDS_NETWORK_DIALOG "" - IDS_HELP_DIALOG "" - IDS_FORMAT_MB "%I64u " - IDS_FORMAT_SWAP "%I64u , %I64u " - IDS_FORMAT_UNIPROC "%s (%u )" - IDS_FORMAT_MPPROC "%s (%u )" - IDS_VERSION_UNKNOWN " " - IDS_DEVICE_STATUS_ATTACHED "ϳ'" - IDS_DEVICE_STATUS_MISSING "³'" - IDS_DEVICE_STATUS_UNKNOWN "" - IDS_DEVICE_NAME " " - IDS_DEVICE_STATUS "" - IDS_DEVICE_CONTROLLER "ID " - IDS_DEVICE_MANUFACTURER "ID " - IDS_DEVICE_PRODUCT "ID " - IDS_DEVICE_FORCEFEEDBACK " Force Feedback" - IDS_NOT_APPLICABLE "/" - IDS_OPTION_YES "" - IDS_DIRECTPLAY_COL_NAME1 "" - IDS_DIRECTPLAY_COL_NAME2 "" - IDS_DIRECTPLAY_COL_NAME3 "" - IDS_DIRECTPLAY_COL_NAME4 "" - IDS_DIRECTPLAY8_MODEMSP " DirectPlay8" - IDS_DIRECTPLAY8_SERIALSP " . DirectPlay8" - IDS_DIRECTPLAY8_IPXSP " IPX DirectPlay8" - IDS_DIRECTPLAY8_TCPSP " TCP/IP DirectPlay8" - IDS_DIRECTPLAY_TCPCONN "- TCP/IP DirectPlay" - IDS_DIRECTPLAY_IPXCONN "IPX DirectPlay" - IDS_DIRECTPLAY_MODEMCONN "ϳ DirectPlay" - IDS_DIRECTPLAY_SERIALCONN " DirectPlay" - IDS_REG_SUCCESS "" - IDS_REG_FAIL "" - IDS_DDTEST_ERROR " !" - IDS_DDTEST_DESCRIPTION " DirecDraw. ?" - IDS_DDPRIMARY_DESCRIPTION " DirectDraw . . ?" - IDS_DDPRIMARY_RESULT " ?" - IDS_DDOFFSCREEN_DESCRIPTION " DirectDraw . . ?" - IDS_DDOFFSCREEN_RESULT " , ?" - IDS_DDFULLSCREEN_DESCRIPTION " DirectDraw . . ?" - IDS_DDFULLSCREEN_RESULT " , ?" - IDS_FORMAT_ADAPTER_MEM "%u " - IDS_FORMAT_ADAPTER_MODE "%04u x %04u (%u )(%u)" - IDS_OPTION_NO "ͳ" - IDS_D3DTEST_DESCRIPTION " Direct3D. ?" - IDS_D3DTEST_D3Dx " - Direct3D %u." -END diff --git a/base/applications/dxdiag/lang/uk-UA.rc b/base/applications/dxdiag/lang/uk-UA.rc new file mode 100644 index 00000000000..e5d7a0bc950 --- /dev/null +++ b/base/applications/dxdiag/lang/uk-UA.rc @@ -0,0 +1,234 @@ +/* + * PROJECT: ReactOS dxdiag + * LICENSE: GPL - See COPYING in the top level directory + * FILE: base/applications/dxdiag/lang/uk-UA.rc + * PURPOSE: Ukraianian Language File for ReactOS dxdiag + * TRANSLATOR: Sakara Yevhen + */ + +LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT + +IDD_MAIN_DIALOG DIALOGEX DISCARDABLE 0, 0, 478, 280 +STYLE DS_SHELLFONT | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | + WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_CAPTION | WS_SYSMENU | + WS_THICKFRAME +CAPTION "Засіб діагностики ReactX" +FONT 8, "MS Shell Dlg" +BEGIN + CONTROL "Tab1",IDC_TAB_CONTROL,"SysTabControl32",WS_TABSTOP,2,2,474,250 + PUSHBUTTON "&Довідка", IDC_BUTTON_HELP, 2, 260, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP + DEFPUSHBUTTON "&Наступна сторінка", IDC_BUTTON_NEXT, 203, 260, 94, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP + PUSHBUTTON "&Зберегти всю інформацію...", IDC_BUTTON_SAVE_INFO, 301, 260, 120, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP + PUSHBUTTON "&Вихід", IDC_BUTTON_EXIT, 425, 260, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP +END + +IDD_SYSTEM_DIALOG DIALOGEX DISCARDABLE 0, 0, 462, 190 +STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Ця програма дозволяє отримати докладні відомості про встановлені компоненти і драйвери ReactX.", -1, 10, 10, 443, 17 + LTEXT "Якщо ви знаєте можливу причину неполадки, можна відразу вибрати відповідну вкладку. В іншому випадку використовуйте кнопку ""Наступна сторінка"" для послідовного перегляду сторінок.", -1, 10, 30, 443, 25 + GROUPBOX "Відомості про систему", -1, 10, 58, 443, 130, SS_RIGHT + LTEXT "Поточні час і дата:", -1, 70, 70, 80, 10, SS_RIGHT + LTEXT "Ім'я комп'ютера:", -1, 70, 80, 80, 10, SS_RIGHT + LTEXT "Операційна система:", -1, 50, 90, 100, 10, SS_RIGHT + LTEXT "Мова:", -1, 70, 100, 80, 10, SS_RIGHT + LTEXT "Виробник комп'ютера:", -1, 50, 110, 100, 10, SS_RIGHT + LTEXT "Модель комп'ютера:", -1, 70, 120, 80, 10, SS_RIGHT + LTEXT "BIOS:", -1, 70, 130, 80, 10, SS_RIGHT + LTEXT "Процесор:", -1, 70, 140, 80, 10, SS_RIGHT + LTEXT "Пам'ять:", -1, 70, 150, 80, 10, SS_RIGHT + LTEXT "Файл підкачки:", -1, 70, 160, 80, 10, SS_RIGHT + LTEXT "Версія ReactX:", -1, 70, 170, 80, 10, SS_RIGHT + LTEXT "", IDC_STATIC_TIME, 155, 70, 195, 10, SS_LEFT + LTEXT "", IDC_STATIC_COMPUTER, 155, 80, 195, 10, SS_LEFT + LTEXT "", IDC_STATIC_OS, 155, 90, 195, 10, SS_LEFT + LTEXT "", IDC_STATIC_LANG, 155, 100, 195, 10, SS_LEFT + LTEXT "", IDC_STATIC_MANU, 155, 110, 195, 10, SS_LEFT + LTEXT "", IDC_STATIC_MODEL, 155, 120, 195, 10, SS_LEFT + LTEXT "", IDC_STATIC_BIOS, 155, 130, 195, 10, SS_LEFT + LTEXT "", IDC_STATIC_PROC, 155, 140, 195, 10, SS_LEFT + LTEXT "", IDC_STATIC_MEM, 155, 150, 195, 10, SS_LEFT + LTEXT "", IDC_STATIC_SWAP, 155, 160, 195, 10, SS_LEFT + LTEXT "", IDC_STATIC_VERSION, 155, 170, 195, 10, SS_LEFT +END + +IDD_DISPLAY_DIALOG DIALOGEX DISCARDABLE 0, 0, 462, 220 +STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN +FONT 8, "MS Shell Dlg" +BEGIN + GROUPBOX "Пристрій", -1, 10, 10, 220, 100 + RTEXT "Назва:", -1, 20, 25, 70, 10 + RTEXT "Виробник:", -1, 20, 35, 70, 10 + RTEXT "Тип мікросхем:", -1, 20, 45, 70, 10 + RTEXT "Тип конвертера DAC:", -1, 15, 55, 75, 10 + RTEXT "Всього пам'яті:", -1, 20, 65, 70, 10 + RTEXT "Режим екрану:", -1, 20, 75, 70, 10 + RTEXT "Монітор:", -1, 20, 85, 70, 10 + LTEXT "", IDC_STATIC_ADAPTER_ID, 95, 25, 130, 10 + LTEXT "", IDC_STATIC_ADAPTER_VENDOR, 95, 35, 130, 10 + LTEXT "", IDC_STATIC_ADAPTER_CHIP, 95, 45, 130, 10 + LTEXT "", IDC_STATIC_ADAPTER_DAC, 95, 55, 130, 10 + LTEXT "", IDC_STATIC_ADAPTER_MEM, 95, 65, 130, 10 + LTEXT "", IDC_STATIC_ADAPTER_MODE, 95, 75, 130, 10 + LTEXT "", IDC_STATIC_ADAPTER_MONITOR, 95, 85, 130, 10 + + GROUPBOX "Драйвери", -1, 240, 10, 220, 100 + RTEXT "Головний:", -1, 245, 30, 55, 10 + RTEXT "Версія:", -1, 245, 40, 55, 10 + RTEXT "Дата:", -1, 245, 50, 55, 10 + RTEXT "Підпис:", -1, 245, 60, 55, 10 + RTEXT "Міні-VDD:", -1, 245, 70, 55, 10 + RTEXT "VDD:", -1, 245, 80, 55, 10 + RTEXT "Версія DDI:", -1, 245, 90, 55, 10 + LTEXT "", IDC_STATIC_ADAPTER_DRIVER, 305, 30, 130, 10 + LTEXT "", IDC_STATIC_ADAPTER_VERSION, 305, 40, 130, 10 + LTEXT "", IDC_STATIC_ADAPTER_DATE, 305, 50, 130, 10 + LTEXT "", IDC_STATIC_ADAPTER_LOGO, 305, 60, 130, 10 + LTEXT "", IDC_STATIC_ADAPTER_MINIVDD, 305, 70, 130, 10 + LTEXT "", IDC_STATIC_ADAPTER_VDD, 305, 80, 130, 10 + LTEXT "", IDC_STATIC_ADAPTER_DDI, 305, 90, 130, 10 + + GROUPBOX "Можливості ReactX", -1, 10, 115, 450, 65 + RTEXT "Прискорення DirectDraw:", -1, 15, 130, 110, 12 + RTEXT "Прискорення Direct3D:", -1, 15, 145, 110, 12 + RTEXT "Прискорення текстур AGP:", -1, 15, 160, 110, 12 + LTEXT "", IDC_STATIC_DDSTATE, 130, 130, 40, 10 + LTEXT "", IDC_STATIC_D3DSTATE, 130, 145, 40, 10 + LTEXT "", IDC_STATIC_AGPSTATE, 130, 160, 40, 10 + PUSHBUTTON "Увімкнути", IDC_BUTTON_DDRAW, 170, 126, 60, 14, WS_DISABLED + PUSHBUTTON "Увімкнути", IDC_BUTTON_D3D, 170, 142, 60, 14, WS_DISABLED + PUSHBUTTON "Увімкнути", IDC_BUTTON_AGP, 170, 158, 60, 14, WS_DISABLED + PUSHBUTTON "Перевірка DirectDraw", IDC_BUTTON_TESTDD, 250, 126, 80, 14 + PUSHBUTTON "Перевірка Direct3D", IDC_BUTTON_TEST3D, 250, 142, 80, 14, WS_DISABLED + + GROUPBOX "Примітки", -1, 10, 185, 450, 34 + EDITTEXT IDC_TEXT_INFO, 20, 195, 432, 18, WS_DISABLED | WS_TABSTOP +END + + +IDD_SOUND_DIALOG DIALOGEX DISCARDABLE 0, 0, 462, 220 +STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN +FONT 8, "MS Shell Dlg" +BEGIN + GROUPBOX "Пристрій", -1, 10, 10, 250, 100 + RTEXT "Назва:", -1, 20, 25, 70, 10 + RTEXT "Код пристрою:", -1, 20, 35, 70, 10 + RTEXT "Код виробника:", -1, 20, 45, 70, 10 + RTEXT "Код продукту:", -1, 20, 55, 70, 10 + RTEXT "Тип:", -1, 20, 65, 70, 10 + RTEXT "За замовчуванням:", -1, 20, 75, 70, 10 + LTEXT "", IDC_STATIC_DSOUND_NAME, 95, 25, 150, 10 + LTEXT "", IDC_STATIC_DSOUND_DEVICEID, 95, 35, 150, 10 + LTEXT "", IDC_STATIC_DSOUND_VENDORID, 95, 45, 150, 10 + LTEXT "", IDC_STATIC_DSOUND_PRODUCTID, 95, 55, 150, 10 + LTEXT "", IDC_STATIC_DSOUND_TYPE, 95, 65, 150, 10 + LTEXT "", IDC_STATIC_DSOUND_STANDARD, 95, 75, 150, 10 + GROUPBOX "Драйвери", -1, 270, 10, 190, 100 + RTEXT "Назва:", -1, 275, 25, 55, 10 + RTEXT "Версія:", -1, 275, 35, 55, 10 + RTEXT "Дата:", -1, 275, 45, 55, 10 + RTEXT "Підпис:", -1, 275, 55, 55, 10 + RTEXT "Інші файли:", -1, 275, 65, 55, 10 + RTEXT "Постачальник:", -1, 275, 75, 55, 10 + LTEXT "", IDC_STATIC_DSOUND_DRIVER, 335, 25, 100, 10 + LTEXT "", IDC_STATIC_DSOUND_VERSION, 335, 35, 100, 10 + LTEXT "", IDC_STATIC_DSOUND_DATE, 335, 45, 100, 10 + LTEXT "", IDC_STATIC_DSOUND_LOGO, 335, 55, 100, 10 + LTEXT "", IDC_STATIC_DSOUND_FILES, 335, 65, 100, 10 + LTEXT "", IDC_STATIC_ADAPTER_PROVIDER, 335, 75, 100, 10 + GROUPBOX "Можливості ReactX", -1, 10, 115, 450, 60 + CONTROL "", IDC_SLIDER_DSOUND, "msctls_trackbar32", TBS_BOTTOM | TBS_AUTOTICKS | WS_TABSTOP, 120, 135, 80, 17 + RTEXT "Рівень апаратного\nприскорення:", -1, 20, 135, 90, 20 + PUSHBUTTON "Перевірка DirectSound", IDC_BUTTON_TESTDSOUND, 270, 130, 80, 14 + GROUPBOX "Примітки", -1, 10, 180, 450, 40 + EDITTEXT IDC_TEXT_DSOUNDINFO, 20, 190, 432, 20, WS_DISABLED | WS_TABSTOP +END + +IDD_MUSIC_DIALOG DIALOGEX DISCARDABLE 0, 0, 462, 220 +STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN +FONT 8, "MS Shell Dlg" +BEGIN +END + + +IDD_INPUT_DIALOG DIALOGEX DISCARDABLE 0, 0, 462, 220 +STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN +FONT 8, "MS Shell Dlg" +BEGIN + GROUPBOX "Пристрої DirectInput", -1, 10, 10, 452, 80 + CONTROL "", IDC_LIST_DEVICE, "SysListView32", LVS_REPORT | WS_CHILD | WS_BORDER | WS_TABSTOP, 20, 20, 432, 60 + GROUPBOX "Пристрої введення", -1, 10, 100, 452, 60 + CONTROL "", IDC_TREE_PORT, "SysTreeView32", TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_DISABLEDRAGDROP | TVS_SHOWSELALWAYS | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 20, 110, 432, 40, 0x00000200 + GROUPBOX "Інформація", -1, 10, 170, 452, 50 + EDITTEXT IDC_RICH_INFO, 20, 180, 432, 30, WS_DISABLED | WS_TABSTOP +END + +IDD_NETWORK_DIALOG DIALOGEX DISCARDABLE 0, 0, 462, 220 +STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN +FONT 8, "MS Shell Dlg" +BEGIN + GROUPBOX "Зареєстровані постачальники DirectPlay", -1, 10, 10, 452, 80 + CONTROL "", IDC_LIST_PROVIDER, "SysListView32", LVS_REPORT | WS_CHILD | WS_BORDER | WS_TABSTOP, 20, 22, 432, 60 +END + +IDD_HELP_DIALOG DIALOGEX DISCARDABLE 0, 0, 462, 220 +STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN +FONT 8, "MS Shell Dlg" +BEGIN +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_MAIN_DIALOG "Засіб діагностики ReactX" + IDS_SYSTEM_DIALOG "Система" + IDS_DISPLAY_DIALOG "Екран" + IDS_SOUND_DIALOG "Звук" + IDS_MUSIC_DIALOG "Музика" + IDS_INPUT_DIALOG "Введення" + IDS_NETWORK_DIALOG "Мережа" + IDS_HELP_DIALOG "Довідка" + IDS_FORMAT_MB "%I64uМБ ОЗУ" + IDS_FORMAT_SWAP "%I64u МБ використано, %I64u МБ в наявності" + IDS_FORMAT_UNIPROC "%s (%u ЦП)" + IDS_FORMAT_MPPROC "%s (%u ЦП)" + IDS_VERSION_UNKNOWN "Невідома версія" + IDS_DEVICE_STATUS_ATTACHED "Під'єднано" + IDS_DEVICE_STATUS_MISSING "Від'єднано" + IDS_DEVICE_STATUS_UNKNOWN "Невідомо" + IDS_DEVICE_NAME "Назва пристрою" + IDS_DEVICE_STATUS "Стан" + IDS_DEVICE_CONTROLLER "ID контролера" + IDS_DEVICE_MANUFACTURER "ID виробника" + IDS_DEVICE_PRODUCT "ID продукту" + IDS_DEVICE_FORCEFEEDBACK "Драйвер Force Feedback" + IDS_NOT_APPLICABLE "Н/Д" + IDS_OPTION_YES "Так" + IDS_DIRECTPLAY_COL_NAME1 "Назва" + IDS_DIRECTPLAY_COL_NAME2 "Реєстр" + IDS_DIRECTPLAY_COL_NAME3 "Файл" + IDS_DIRECTPLAY_COL_NAME4 "Версія" + IDS_DIRECTPLAY8_MODEMSP "Постачальник служби модему DirectPlay8" + IDS_DIRECTPLAY8_SERIALSP "Постачальник служби остан. порту DirectPlay8" + IDS_DIRECTPLAY8_IPXSP "Постачальник служби IPX DirectPlay8" + IDS_DIRECTPLAY8_TCPSP "Постачальник служби TCP/IP DirectPlay8" + IDS_DIRECTPLAY_TCPCONN "Інтернет-підключення TCP/IP для DirectPlay" + IDS_DIRECTPLAY_IPXCONN "IPX підключення для DirectPlay" + IDS_DIRECTPLAY_MODEMCONN "Підключення через модем для DirectPlay" + IDS_DIRECTPLAY_SERIALCONN "Послідовне підключення для DirectPlay" + IDS_REG_SUCCESS "Так" + IDS_REG_FAIL "Помилка" + IDS_DDTEST_ERROR "Збій у перевірці!" + IDS_DDTEST_DESCRIPTION "Буде виконана перевірка інтерфейсу DirecDraw. Продовжити?" + IDS_DDPRIMARY_DESCRIPTION "Цей тест буде використовувати DirectDraw для малювання на первинній поверхні. Будуть виводитись чорні та білі прямокутники. Продовжити?" + IDS_DDPRIMARY_RESULT "Ви бачили чорні та білі прямокутники?" + IDS_DDOFFSCREEN_DESCRIPTION "Цей тест буде використовувати DirectDraw для малювання в закадровий буфер. Повинен рухатись білий прямокутник. Продовжити?" + IDS_DDOFFSCREEN_RESULT "Ви бачили, як рухався білий прямокутник?" + IDS_DDFULLSCREEN_DESCRIPTION "Цей тест буде використовувати DirectDraw для малювання в повноекранному режимі. Повинен рухатись білий прямокутник. Продовжити?" + IDS_DDFULLSCREEN_RESULT "Ви бачили, як рухався білий прямокутник в повноекранному режимі?" + IDS_FORMAT_ADAPTER_MEM "%u Мб" + IDS_FORMAT_ADAPTER_MODE "%04u x %04u (%u біт)(%uГц)" + IDS_OPTION_NO "Ні" + IDS_D3DTEST_DESCRIPTION "Буде виконана перевірка інтерфейсу Direct3D. Продовжити?" + IDS_D3DTEST_D3Dx "Цей тест використає апаратно-прискорений Direct3D інтерфейс %u." +END diff --git a/base/applications/dxdiag/precomp.h b/base/applications/dxdiag/precomp.h index 05200f7b2d5..cbb999b1c18 100644 --- a/base/applications/dxdiag/precomp.h +++ b/base/applications/dxdiag/precomp.h @@ -12,7 +12,8 @@ #include #include #include - +#include +#include #include #include #include diff --git a/base/applications/dxdiag/rsrc.rc b/base/applications/dxdiag/rsrc.rc index dc65bd9cb95..6c23fcb1a29 100644 --- a/base/applications/dxdiag/rsrc.rc +++ b/base/applications/dxdiag/rsrc.rc @@ -8,13 +8,13 @@ #include "lang/ko-KR.rc" #include "lang/nl-NL.rc" #include "lang/no-NO.rc" -#include "lang/ru-RU.rc" #include "lang/sk-SK.rc" #include "lang/sv-SE.rc" -#include "lang/ua-UA.rc" #include "lang/zh-CN.rc" //#include "lang/zh-TW.rc" // UTF-8 #pragma code_page(65001) #include "lang/pl-PL.rc" +#include "lang/ru-RU.rc" +#include "lang/uk-UA.rc" diff --git a/base/applications/dxdiag/sound.c b/base/applications/dxdiag/sound.c index 4a84c9c6342..59a9293f6c5 100644 --- a/base/applications/dxdiag/sound.c +++ b/base/applications/dxdiag/sound.c @@ -8,7 +8,6 @@ */ #include "precomp.h" -#include #include #if 0 diff --git a/base/applications/findstr/CMakeLists.txt b/base/applications/findstr/CMakeLists.txt index 68b0e741727..fd9798e1e11 100644 --- a/base/applications/findstr/CMakeLists.txt +++ b/base/applications/findstr/CMakeLists.txt @@ -1,9 +1,7 @@ -add_definitions(-D_DLL -D__USE_CRTIMP) +set_rc_compiler() -add_executable(findstr - findstr.c - findstr.rc) +add_executable(findstr findstr.c findstr.rc) set_module_type(findstr win32cui) add_importlibs(findstr user32 msvcrt kernel32) diff --git a/base/applications/findstr/lang/ru-RU.rc b/base/applications/findstr/lang/ru-RU.rc index 726ebec18e4..945555940b8 100644 --- a/base/applications/findstr/lang/ru-RU.rc +++ b/base/applications/findstr/lang/ru-RU.rc @@ -3,15 +3,15 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT STRINGTABLE DISCARDABLE BEGIN -IDS_USAGE, "FIND: .\n\n\ - FIND [ /C ] [ /I ] [ /N ] [ /V ] """" [ ... ]\n\ - /C , .\n\ - /I .\n\ - /N ( 1).\n\ - /V , ." +IDS_USAGE, "FIND: Поиск текстовой строки в одном или нескольких файлах.\n\n\ + FIND [ /C ] [ /I ] [ /N ] [ /V ] ""строка"" [ файл... ]\n\ + /C Вывод только общего числа строк, содержащих заданную строку.\n\ + /I Поиск без учета регистра символов.\n\ + /N Вывод номеров отображаемых строк (начиная с 1).\n\ + /V Вывод всех строк, НЕ содержащих заданную строку." -IDS_NO_SUCH_FILE, "FIND: %s: .\n" +IDS_NO_SUCH_FILE, "FIND: %s: Файл не существует.\n" -IDS_CANNOT_OPEN, "FIND: %s: .\n" +IDS_CANNOT_OPEN, "FIND: %s: Невозможно открыть файл.\n" END diff --git a/base/applications/findstr/lang/uk-UA.rc b/base/applications/findstr/lang/uk-UA.rc index 43b241f33fd..7cef30daf65 100644 --- a/base/applications/findstr/lang/uk-UA.rc +++ b/base/applications/findstr/lang/uk-UA.rc @@ -11,15 +11,15 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT STRINGTABLE DISCARDABLE BEGIN -IDS_USAGE, "FIND: , .\n\n\ - FIND [ /C ] [ /I ] [ /N ] [ /V ] """" [ ... ]\n\ - /C , \n\ - /I \n\ - /N , ( 1)\n\ - /V , " +IDS_USAGE, "FIND: Виведення всіх рядків файлу, які містять рядок.\n\n\ + FIND [ /C ] [ /I ] [ /N ] [ /V ] ""рядок"" [ файл... ]\n\ + /C Порахувати кількість рядків, які містять рядок\n\ + /I Не враховувати регістр символів\n\ + /N Нумерувати рядки, які відображаються (починаючи з 1)\n\ + /V Виведення рядків, які не містять заданий рядок" -IDS_NO_SUCH_FILE, "FIND: %s: \n" +IDS_NO_SUCH_FILE, "FIND: %s: Файл не існує\n" -IDS_CANNOT_OPEN, "FIND: %s: \n" +IDS_CANNOT_OPEN, "FIND: %s: Неможливо відкрити файл\n" END diff --git a/base/applications/findstr/lang/zh-CN.rc b/base/applications/findstr/lang/zh-CN.rc new file mode 100644 index 00000000000..35fa9b34cf1 --- /dev/null +++ b/base/applications/findstr/lang/zh-CN.rc @@ -0,0 +1,17 @@ +LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED + +STRINGTABLE DISCARDABLE +BEGIN + +IDS_USAGE, "FINDSTR: 输出某文件中包含指定字符串的所有行。\n\n\ + FINDSTR [ /C ] [ /I ] [ /N ] [ /V ] ""字符串"" [ 文件... ]\n\ + /C 计算包含该字符串的行数\n\ + /I 忽略大小写\n\ + /N 从 1 开始为显示的行编号\n\ + /V 输出不包含该指定字符串的行" + +IDS_NO_SUCH_FILE, "FINDSTR: %s: 没有这个文件\n" + +IDS_CANNOT_OPEN, "FINDSTR: %s: 无法打开文件\n" + +END diff --git a/base/applications/findstr/rsrc.rc b/base/applications/findstr/rsrc.rc index 96cbd694c72..1c6773c36a0 100644 --- a/base/applications/findstr/rsrc.rc +++ b/base/applications/findstr/rsrc.rc @@ -13,12 +13,13 @@ #include "lang/lt-LT.rc" #include "lang/no-NO.rc" #include "lang/pt-BR.rc" -#include "lang/ru-RU.rc" #include "lang/sk-SK.rc" #include "lang/sv-SE.rc" -#include "lang/uk-UA.rc" // UTF-8 #pragma code_page(65001) #include "lang/pl-PL.rc" +#include "lang/ru-RU.rc" +#include "lang/uk-UA.rc" +#include "lang/zh-CN.rc" diff --git a/base/applications/fontview/fontview.rc b/base/applications/fontview/fontview.rc index 07a8c04f1f1..49ab20e58f2 100644 --- a/base/applications/fontview/fontview.rc +++ b/base/applications/fontview/fontview.rc @@ -18,10 +18,8 @@ END #include "lang/es-ES.rc" #include "lang/fr-FR.rc" #include "lang/lt-LT.rc" -#include "lang/ru-RU.rc" #include "lang/sk-SK.rc" #include "lang/sv-SE.rc" -#include "lang/uk-UA.rc" #include "lang/no-NO.rc" #include "lang/zh-CN.rc" #include "lang/zh-TW.rc" @@ -30,3 +28,5 @@ END #pragma code_page(65001) #include "lang/pl-PL.rc" #include "lang/ro-RO.rc" +#include "lang/ru-RU.rc" +#include "lang/uk-UA.rc" diff --git a/base/applications/fontview/lang/ro-RO.rc b/base/applications/fontview/lang/ro-RO.rc index 07ce527cd66..07f56dd0986 100644 --- a/base/applications/fontview/lang/ro-RO.rc +++ b/base/applications/fontview/lang/ro-RO.rc @@ -1,7 +1,5 @@ LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL -#pragma code_page(65001) - STRINGTABLE DISCARDABLE BEGIN IDS_QUIT, "Ieșire" @@ -13,5 +11,3 @@ BEGIN IDS_ERROR_NOCLASS, "Nu s-a putut iniţializa clasa de ferestre." IDS_ERROR_BADCMD, "Niciun font specificat.\nSintaxă:\n fontview.exe " END - -#pragma code_page(default) diff --git a/base/applications/fontview/lang/ru-RU.rc b/base/applications/fontview/lang/ru-RU.rc index 1ba0655aace..81f123f665e 100644 --- a/base/applications/fontview/lang/ru-RU.rc +++ b/base/applications/fontview/lang/ru-RU.rc @@ -4,14 +4,12 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT STRINGTABLE DISCARDABLE BEGIN - IDS_QUIT, "" - IDS_PRINT, "" - IDS_STRING, "Jackdaws love my big sphinx of quartz. 1234567890" - IDS_ERROR, "" - IDS_ERROR_NOMEM, " , ." - IDS_ERROR_NOFONT, "%1 ." - IDS_ERROR_NOCLASS, " ." - IDS_ERROR_BADCMD, " .\n:\n fontview.exe <_>" + IDS_QUIT, "Выход" + IDS_PRINT, "Печать" + IDS_STRING, "В чащах юга жил бы цитрус? Да, но фальшивый экземпляр! 1234567890" + IDS_ERROR, "Ошибка" + IDS_ERROR_NOMEM, "Недостаточно памяти, чтобы завершить операцию." + IDS_ERROR_NOFONT, "%1 не является корректным файлом шрифта." + IDS_ERROR_NOCLASS, "Невозможно инициализировать класс окна." + IDS_ERROR_BADCMD, "Не указан файл шрифта.\nСинтаксис:\n fontview.exe <файл_шрифта>" END - - diff --git a/base/applications/fontview/lang/uk-UA.rc b/base/applications/fontview/lang/uk-UA.rc index 5ba42fa40eb..d57d47b050a 100644 --- a/base/applications/fontview/lang/uk-UA.rc +++ b/base/applications/fontview/lang/uk-UA.rc @@ -10,12 +10,12 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT STRINGTABLE DISCARDABLE BEGIN - IDS_QUIT, "" - IDS_PRINT, "" - IDS_STRING, "Jackdaws love my big sphinx of quartz. 1234567890" - IDS_ERROR, "" - IDS_ERROR_NOMEM, " ' ." - IDS_ERROR_NOFONT, " %1 ." - IDS_ERROR_NOCLASS, " ." - IDS_ERROR_BADCMD, " .\n:\n fontview.exe < >" + IDS_QUIT, "Вихід" + IDS_PRINT, "Друк" + IDS_STRING, "Чуєш їх, доцю, га? Кумедна ж ти, прощайся без ґольфів! 1234567890" + IDS_ERROR, "Помилка" + IDS_ERROR_NOMEM, "Недостатньо пам'яті для завершення операції." + IDS_ERROR_NOFONT, "Файл %1 не є коректним файлом шрифту." + IDS_ERROR_NOCLASS, "Неможливо ініціалізувати віконний клас." + IDS_ERROR_BADCMD, "Не вказаний файл шрифту.\nСинтаксис:\n fontview.exe <файл_шрифту>" END diff --git a/base/applications/games/solitaire/CMakeLists.txt b/base/applications/games/solitaire/CMakeLists.txt index 2a4c737f685..b638a0a670e 100644 --- a/base/applications/games/solitaire/CMakeLists.txt +++ b/base/applications/games/solitaire/CMakeLists.txt @@ -12,9 +12,7 @@ add_executable(sol rsrc.rc) target_link_libraries(sol cardlib) - +add_pch(sol solitaire.h) set_module_type(sol win32gui) - add_importlibs(sol advapi32 comctl32 user32 gdi32 msvcrt kernel32) - add_cd_file(TARGET sol DESTINATION reactos/system32 FOR all) diff --git a/base/applications/games/solitaire/lang/pl-PL.rc b/base/applications/games/solitaire/lang/pl-PL.rc index 6af7abd1c9d..7a6493bfe55 100644 --- a/base/applications/games/solitaire/lang/pl-PL.rc +++ b/base/applications/games/solitaire/lang/pl-PL.rc @@ -21,7 +21,7 @@ BEGIN AUTORADIOBUTTON "Rozdaj &dwie", IDC_OPT_DRAWTHREE, 14, 32, 52, 10 AUTOCHECKBOX "&Pokazuj czas gry", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP | WS_DISABLED - AUTOCHECKBOX "Pokazuj pa&sek stanu", IDC_OPT_STATUSBAR, 7, 66, 64, 10, WS_TABSTOP + AUTOCHECKBOX "Pokazuj pa&sek stanu", IDC_OPT_STATUSBAR, 7, 66, 77, 10, WS_TABSTOP DEFPUSHBUTTON "OK", IDOK, 35, 97, 50, 14 PUSHBUTTON "Anuluj", IDCANCEL, 101, 97, 50, 14 diff --git a/base/applications/games/solitaire/lang/ro-RO.rc b/base/applications/games/solitaire/lang/ro-RO.rc index a453a061048..53d41f14644 100644 --- a/base/applications/games/solitaire/lang/ro-RO.rc +++ b/base/applications/games/solitaire/lang/ro-RO.rc @@ -89,5 +89,3 @@ BEGIN VK_F1, IDM_HELP_CONTENTS, VIRTKEY, NOINVERT VK_F2, IDM_GAME_NEW, VIRTKEY, NOINVERT END - -#pragma code_page(default) diff --git a/base/applications/games/solitaire/lang/ru-RU.rc b/base/applications/games/solitaire/lang/ru-RU.rc index 32fb55a6b7e..f3b5768d665 100644 --- a/base/applications/games/solitaire/lang/ru-RU.rc +++ b/base/applications/games/solitaire/lang/ru-RU.rc @@ -3,25 +3,25 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT -/* */ +/* Диалоги */ IDD_OPTIONS DIALOGEX DISCARDABLE 0, 0, 186, 118 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_SHELLFONT -CAPTION "" +CAPTION "Настройки" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "", -1, 7, 7, 65, 40 - AUTORADIOBUTTON " &", IDC_OPT_DRAWONE, 14, 19, 52, 10, WS_GROUP | WS_TABSTOP - AUTORADIOBUTTON " &", IDC_OPT_DRAWTHREE, 14, 32, 52, 10 - AUTOCHECKBOX "& ", IDC_OPT_SHOWTIME, 7 ,51 ,75 ,10, WS_TABSTOP | WS_DISABLED - AUTOCHECKBOX "& ", IDC_OPT_STATUSBAR, 7, 66, 75, 10, WS_TABSTOP + GROUPBOX "Карты", -1, 7, 7, 65, 40 + AUTORADIOBUTTON "По &одной", IDC_OPT_DRAWONE, 14, 19, 52, 10, WS_GROUP | WS_TABSTOP + AUTORADIOBUTTON "По &три", IDC_OPT_DRAWTHREE, 14, 32, 52, 10 + AUTOCHECKBOX "&Показывать время", IDC_OPT_SHOWTIME, 7 ,51 ,75 ,10, WS_TABSTOP | WS_DISABLED + AUTOCHECKBOX "&Строка состояния", IDC_OPT_STATUSBAR, 7, 66, 75, 10, WS_TABSTOP DEFPUSHBUTTON "OK", IDOK, 35, 97, 50, 14 - PUSHBUTTON "", IDCANCEL, 101, 97, 50, 14 + PUSHBUTTON "Отмена", IDCANCEL, 101, 97, 50, 14 END IDD_CARDBACK DIALOGEX 6, 6, 186, 104 -CAPTION " " +CAPTION "Выбор обложки карт" FONT 8, "MS Shell Dlg" STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_SHELLFONT BEGIN @@ -38,39 +38,39 @@ BEGIN CONTROL "", IDC_CARDBACK11, "Static", SS_NOTIFY, 124, 46, 26, 32 CONTROL "", IDC_CARDBACK12, "Static", SS_NOTIFY, 154, 46, 26, 32 DEFPUSHBUTTON "OK", IDOK, 66, 84, 54, 13 - PUSHBUTTON "", IDCANCEL, 126, 84, 54, 13 + PUSHBUTTON "Отмена", IDCANCEL, 126, 84, 54, 13 END -/* */ +/* Строки */ STRINGTABLE BEGIN - IDS_SOL_NAME "" - IDS_SOL_ABOUT " J Brown\n\nCardLib 1.0." - IDS_SOL_QUIT " ?" + IDS_SOL_NAME "Пасьянс" + IDS_SOL_ABOUT "Пасьянс от J Brown\n\nCardLib версии 1.0." + IDS_SOL_QUIT "Закончить текущую игру?" IDS_SOL_WIN "Congratulations, you win!!" IDS_SOL_DEAL "Deal again?" END -/* */ +/* Меню */ IDR_MENU1 MENU DISCARDABLE BEGIN - POPUP "&" + POPUP "&Игра" BEGIN - MENUITEM "& \tF2", IDM_GAME_NEW + MENUITEM "Н&овая игра\tF2", IDM_GAME_NEW MENUITEM SEPARATOR - MENUITEM "&...", IDM_GAME_DECK - MENUITEM "&...", IDM_GAME_OPTIONS + MENUITEM "&Обложки...", IDM_GAME_DECK + MENUITEM "&Настройки...", IDM_GAME_OPTIONS MENUITEM SEPARATOR - MENUITEM "&", IDM_GAME_EXIT + MENUITEM "&Выход", IDM_GAME_EXIT END - POPUP "&" + POPUP "&Помощь" BEGIN - MENUITEM "&\tF1", IDM_HELP_CONTENTS - MENUITEM "& ", IDM_HELP_ABOUT + MENUITEM "&Справка\tF1", IDM_HELP_CONTENTS + MENUITEM "&О программе", IDM_HELP_ABOUT END END diff --git a/base/applications/games/solitaire/lang/sv-SE.rc b/base/applications/games/solitaire/lang/sv-SE.rc new file mode 100644 index 00000000000..d045ff37974 --- /dev/null +++ b/base/applications/games/solitaire/lang/sv-SE.rc @@ -0,0 +1,92 @@ +/* + * PROJECT: Solitaire + * LICENSE: Freeware, permission to use under Public Domain + * FILE: base/applications/games/solitaire/lang/en-US.rc + * PURPOSE: English Language File for Solitaire + * PROGRAMMERS: Daniel "EmuandCo" Reimer (reimer.daniel@freenet.de) + */ +LANGUAGE LANG_SWEDISH, SUBLANG_NEUTRAL + + +/* Dialogs */ + +IDD_OPTIONS DIALOGEX DISCARDABLE 0, 0, 186, 118 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_SHELLFONT +CAPTION "Options" +FONT 8, "MS Shell Dlg" +BEGIN + GROUPBOX "Kort", -1, 7, 7, 65, 40 + AUTORADIOBUTTON "Dra &En", IDC_OPT_DRAWONE, 14, 19, 52, 10, WS_GROUP | WS_TABSTOP + AUTORADIOBUTTON "Dra &Tre", IDC_OPT_DRAWTHREE, 14, 32, 52, 10 + + AUTOCHECKBOX "&Visa Tid", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP | WS_DISABLED + AUTOCHECKBOX "&Statusflt", IDC_OPT_STATUSBAR, 7, 66, 64, 10, WS_TABSTOP + + DEFPUSHBUTTON "OK", IDOK, 35, 97, 50, 14 + PUSHBUTTON "Avbryt", IDCANCEL, 101, 97, 50, 14 +END + + +IDD_CARDBACK DIALOGEX 6, 6, 186, 104 +CAPTION "Vlj Kort Baksida" +FONT 8, "MS Shell Dlg" +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_SHELLFONT +BEGIN + CONTROL "", IDC_CARDBACK1, "Static", SS_NOTIFY, 4, 7, 26, 32 + CONTROL "", IDC_CARDBACK2, "Static", SS_NOTIFY, 34, 7, 26, 32 + CONTROL "", IDC_CARDBACK3, "Static", SS_NOTIFY, 64, 7, 26, 32 + CONTROL "", IDC_CARDBACK4, "Static", SS_NOTIFY, 94, 7, 26, 32 + CONTROL "", IDC_CARDBACK5, "Static", SS_NOTIFY, 124, 7, 26, 32 + CONTROL "", IDC_CARDBACK6, "Static", SS_NOTIFY, 154, 7, 26, 32 + CONTROL "", IDC_CARDBACK7, "Static", SS_NOTIFY, 4, 46, 26, 32 + CONTROL "", IDC_CARDBACK8, "Static", SS_NOTIFY, 34, 46, 26, 32 + CONTROL "", IDC_CARDBACK9, "Static", SS_NOTIFY, 64, 46, 26, 32 + CONTROL "", IDC_CARDBACK10, "Static", SS_NOTIFY, 94, 46, 26, 32 + CONTROL "", IDC_CARDBACK11, "Static", SS_NOTIFY, 124, 46, 26, 32 + CONTROL "", IDC_CARDBACK12, "Static", SS_NOTIFY, 154, 46, 26, 32 + DEFPUSHBUTTON "OK", IDOK, 66, 84, 54, 13 + PUSHBUTTON "Avbryt", IDCANCEL, 126, 84, 54, 13 +END + + +/* Strings */ + +STRINGTABLE +BEGIN + IDS_SOL_NAME "Solitaire" + IDS_SOL_ABOUT "Solitaire av J Brown\nverstt av Ronny K Svensson\n\nCardLib version 1.0." + IDS_SOL_QUIT "Avsluta nuvarande spel?" + IDS_SOL_WIN "Grattis, du vann!" + IDS_SOL_DEAL "Ge igen?" +END + + +/* Menus */ + +IDR_MENU1 MENU DISCARDABLE +BEGIN + POPUP "&Spel" + BEGIN + MENUITEM "&Ge\tF2", IDM_GAME_NEW + MENUITEM SEPARATOR + MENUITEM "&Kortlek...", IDM_GAME_DECK + MENUITEM "&Alternativ...", IDM_GAME_OPTIONS + MENUITEM SEPARATOR + MENUITEM "&Avsluta", IDM_GAME_EXIT + END + POPUP "&Hjlp" + BEGIN + MENUITEM "&Innehll\tF1", IDM_HELP_CONTENTS + MENUITEM "&Om", IDM_HELP_ABOUT + END +END + + + +/* Accelerator */ + +IDR_ACCELERATOR1 ACCELERATORS DISCARDABLE +BEGIN + VK_F1, IDM_HELP_CONTENTS, VIRTKEY, NOINVERT + VK_F2, IDM_GAME_NEW, VIRTKEY, NOINVERT +END diff --git a/base/applications/games/solitaire/lang/uk-UA.rc b/base/applications/games/solitaire/lang/uk-UA.rc index e4ab3aa55c0..0983910c462 100644 --- a/base/applications/games/solitaire/lang/uk-UA.rc +++ b/base/applications/games/solitaire/lang/uk-UA.rc @@ -13,22 +13,22 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT IDD_OPTIONS DIALOGEX DISCARDABLE 0, 0, 186, 118 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_SHELLFONT -CAPTION "" +CAPTION "Параметри" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "", -1, 7, 7, 65, 40 - AUTORADIOBUTTON " &", IDC_OPT_DRAWONE, 14, 19, 52, 10, WS_GROUP | WS_TABSTOP - AUTORADIOBUTTON " &", IDC_OPT_DRAWTHREE, 14, 32, 52, 10 + GROUPBOX "Карти", -1, 7, 7, 65, 40 + AUTORADIOBUTTON "По &одній", IDC_OPT_DRAWONE, 14, 19, 52, 10, WS_GROUP | WS_TABSTOP + AUTORADIOBUTTON "По &три", IDC_OPT_DRAWTHREE, 14, 32, 52, 10 - AUTOCHECKBOX "& ", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP | WS_DISABLED - AUTOCHECKBOX "& ", IDC_OPT_STATUSBAR, 7, 66, 64, 10, WS_TABSTOP + AUTOCHECKBOX "&Гра за часом", IDC_OPT_SHOWTIME, 7 ,51 ,65 ,10, WS_TABSTOP | WS_DISABLED + AUTOCHECKBOX "&Рядок стану", IDC_OPT_STATUSBAR, 7, 66, 64, 10, WS_TABSTOP DEFPUSHBUTTON "OK", IDOK, 35, 97, 50, 14 - PUSHBUTTON "", IDCANCEL, 101, 97, 50, 14 + PUSHBUTTON "Скасувати", IDCANCEL, 101, 97, 50, 14 END IDD_CARDBACK DIALOGEX 6, 6, 186, 104 -CAPTION " " +CAPTION "Вибрати сорочку" FONT 8, "MS Shell Dlg" STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_SHELLFONT BEGIN @@ -45,7 +45,7 @@ BEGIN CONTROL "", IDC_CARDBACK11, "Static", SS_NOTIFY, 124, 46, 26, 32 CONTROL "", IDC_CARDBACK12, "Static", SS_NOTIFY, 154, 46, 26, 32 DEFPUSHBUTTON "OK", IDOK, 66, 84, 54, 13 - PUSHBUTTON "", IDCANCEL, 126, 84, 54, 13 + PUSHBUTTON "Скасувати", IDCANCEL, 126, 84, 54, 13 END @@ -53,11 +53,11 @@ END STRINGTABLE BEGIN - IDS_SOL_NAME "" - IDS_SOL_ABOUT " J Brown\n\nCardLib 1.0." - IDS_SOL_QUIT " ?" - IDS_SOL_WIN "³, !!" - IDS_SOL_DEAL " ?" + IDS_SOL_NAME "Косинка" + IDS_SOL_ABOUT "Косинка від J Brown\n\nCardLib версії 1.0." + IDS_SOL_QUIT "Вийти з поточної гри?" + IDS_SOL_WIN "Вітання, Ви виграли!!" + IDS_SOL_DEAL "Роздати знову?" END @@ -65,19 +65,19 @@ END IDR_MENU1 MENU DISCARDABLE BEGIN - POPUP "&" + POPUP "&Гра" BEGIN - MENUITEM "& \tF2", IDM_GAME_NEW + MENUITEM "&Роздати карти\tF2", IDM_GAME_NEW MENUITEM SEPARATOR - MENUITEM "&...", IDM_GAME_DECK - MENUITEM "&...", IDM_GAME_OPTIONS + MENUITEM "&Колода...", IDM_GAME_DECK + MENUITEM "Па&раметри...", IDM_GAME_OPTIONS MENUITEM SEPARATOR - MENUITEM "&", IDM_GAME_EXIT + MENUITEM "В&ихід", IDM_GAME_EXIT END - POPUP "&" + POPUP "&Довідка" BEGIN - MENUITEM "&\tF1", IDM_HELP_CONTENTS - MENUITEM "& ...", IDM_HELP_ABOUT + MENUITEM "&Зміст\tF1", IDM_HELP_CONTENTS + MENUITEM "&Про програму...", IDM_HELP_ABOUT END END diff --git a/base/applications/games/solitaire/rsrc.rc b/base/applications/games/solitaire/rsrc.rc index ef93a2b4940..e1c90611223 100644 --- a/base/applications/games/solitaire/rsrc.rc +++ b/base/applications/games/solitaire/rsrc.rc @@ -22,13 +22,14 @@ IDI_SOLITAIRE ICON DISCARDABLE "solitaire.ico" #include "lang/lt-LT.rc" #include "lang/nl-NL.rc" #include "lang/no-NO.rc" -#include "lang/ru-RU.rc" #include "lang/sk-SK.rc" +#include "lang/sv-SE.rc" #include "lang/th-TH.rc" -#include "lang/uk-UA.rc" #include "lang/zh-CN.rc" // UTF-8 #pragma code_page(65001) #include "lang/pl-PL.rc" #include "lang/ro-RO.rc" +#include "lang/ru-RU.rc" +#include "lang/uk-UA.rc" diff --git a/base/applications/games/solitaire/solcreate.cpp b/base/applications/games/solitaire/solcreate.cpp index 0b29d246cca..7166ef7e195 100644 --- a/base/applications/games/solitaire/solcreate.cpp +++ b/base/applications/games/solitaire/solcreate.cpp @@ -1,8 +1,3 @@ -#include -#include -#include -#include "resource.h" -#include "cardlib.h" #include "solitaire.h" diff --git a/base/applications/games/solitaire/solgame.cpp b/base/applications/games/solitaire/solgame.cpp index 2709f1ed2a4..f809071961a 100644 --- a/base/applications/games/solitaire/solgame.cpp +++ b/base/applications/games/solitaire/solgame.cpp @@ -1,9 +1,4 @@ -#include -#include -#include -#include -#include "resource.h" -#include "cardlib.h" + #include "solitaire.h" #if 1 diff --git a/base/applications/games/solitaire/solitaire.cpp b/base/applications/games/solitaire/solitaire.cpp index 4046b92ff2a..bf45a53e9bd 100644 --- a/base/applications/games/solitaire/solitaire.cpp +++ b/base/applications/games/solitaire/solitaire.cpp @@ -1,10 +1,3 @@ -#include -#include -#include -#include - -#include "resource.h" -#include "cardlib.h" #include "solitaire.h" diff --git a/base/applications/games/solitaire/solitaire.h b/base/applications/games/solitaire/solitaire.h index ae52831b073..ddd00ad5bf3 100644 --- a/base/applications/games/solitaire/solitaire.h +++ b/base/applications/games/solitaire/solitaire.h @@ -1,4 +1,11 @@ -#pragma once + +#include +#include +#include +#include +#include +#include "resource.h" +#include "cardlib.h" extern CardWindow SolWnd; extern TCHAR szAppName[]; diff --git a/base/applications/games/solitaire/solitaire.rbuild b/base/applications/games/solitaire/solitaire.rbuild index b6e397e6111..98ea8fbb0cc 100644 --- a/base/applications/games/solitaire/solitaire.rbuild +++ b/base/applications/games/solitaire/solitaire.rbuild @@ -8,4 +8,5 @@ solgame.cpp solitaire.cpp rsrc.rc + solitaire.h diff --git a/base/applications/games/spider/CMakeLists.txt b/base/applications/games/spider/CMakeLists.txt index cf44a846995..9e2f84c5c47 100644 --- a/base/applications/games/spider/CMakeLists.txt +++ b/base/applications/games/spider/CMakeLists.txt @@ -12,9 +12,7 @@ add_executable(spider rsrc.rc) target_link_libraries(spider cardlib) - +add_pch(spider spider.h) set_module_type(spider win32gui) - add_importlibs(spider advapi32 comctl32 user32 gdi32 msvcrt kernel32) - add_cd_file(TARGET spider DESTINATION reactos/system32 FOR all) diff --git a/base/applications/games/spider/lang/ru-RU.rc b/base/applications/games/spider/lang/ru-RU.rc index 8701fef3c11..4c81651a3ba 100644 --- a/base/applications/games/spider/lang/ru-RU.rc +++ b/base/applications/games/spider/lang/ru-RU.rc @@ -14,7 +14,7 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT /* Dialogs */ IDD_CARDBACK DIALOGEX 6, 6, 186, 104 -CAPTION " " +CAPTION "Выбор оформления" FONT 8, "MS Shell Dlg" STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_SHELLFONT BEGIN @@ -31,31 +31,31 @@ BEGIN CONTROL "", IDC_CARDBACK11, "Static", SS_NOTIFY, 124, 46, 26, 32 CONTROL "", IDC_CARDBACK12, "Static", SS_NOTIFY, 154, 46, 26, 32 DEFPUSHBUTTON "OK", IDOK, 66, 84, 54, 13 - PUSHBUTTON "", IDCANCEL, 126, 84, 54, 13 + PUSHBUTTON "Отмена", IDCANCEL, 126, 84, 54, 13 END IDD_DIFFICULTY DIALOGEX DISCARDABLE 100, 100, 112, 80 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_SHELLFONT -CAPTION "" +CAPTION "Уровень" FONT 8, "MS Shell Dlg" BEGIN - AUTORADIOBUTTON ": & ", IDC_DIF_ONECOLOR, 8, 10, 102, 10, WS_GROUP | WS_TABSTOP - AUTORADIOBUTTON ": & ", IDC_DIF_TWOCOLORS, 8, 23, 102, 10 - AUTORADIOBUTTON ": & ", IDC_DIF_FOURCOLORS, 8, 36, 102, 10 + AUTORADIOBUTTON "Простой: &один цвет", IDC_DIF_ONECOLOR, 8, 10, 102, 10, WS_GROUP | WS_TABSTOP + AUTORADIOBUTTON "Средний: &два цвета", IDC_DIF_TWOCOLORS, 8, 23, 102, 10 + AUTORADIOBUTTON "Сложный: &четыре цвета", IDC_DIF_FOURCOLORS, 8, 36, 102, 10 DEFPUSHBUTTON "OK", IDOK, 8, 58, 40, 14 - PUSHBUTTON "", IDCANCEL, 63, 58, 40, 14 + PUSHBUTTON "Отмена", IDCANCEL, 63, 58, 40, 14 END /* Strings */ STRINGTABLE BEGIN - IDS_SPI_NAME " """"" - IDS_SPI_ABOUT " """", Gregor Schneider\n\nCardLib 1.0" - IDS_SPI_QUIT " ?" - IDS_SPI_WIN ", !" - IDS_SPI_DEAL " ?" + IDS_SPI_NAME "Пасьянс ""Паук""" + IDS_SPI_ABOUT "Пасьянс ""Паук"", Gregor Schneider\n\nCardLib версии 1.0" + IDS_SPI_QUIT "Выйти из текущей игры?" + IDS_SPI_WIN "Поздравляем, вы выйграли!" + IDS_SPI_DEAL "Попробовать снова?" END @@ -63,18 +63,18 @@ END IDR_MENU1 MENU DISCARDABLE BEGIN - POPUP "&" + POPUP "&Игра" BEGIN - MENUITEM "& \tF2", IDM_GAME_NEW + MENUITEM "&Новая игра\tF2", IDM_GAME_NEW MENUITEM SEPARATOR - MENUITEM "&...", IDM_GAME_DECK + MENUITEM "&Оформление...", IDM_GAME_DECK MENUITEM SEPARATOR - MENUITEM "&", IDM_GAME_EXIT + MENUITEM "&Выход", IDM_GAME_EXIT END - POPUP "&" + POPUP "&Справка" BEGIN - MENUITEM "& \tF1", IDM_HELP_CONTENTS - MENUITEM "& ", IDM_HELP_ABOUT + MENUITEM "&Просмотр справки\tF1", IDM_HELP_CONTENTS + MENUITEM "&О программе", IDM_HELP_ABOUT END END diff --git a/base/applications/games/spider/lang/sv-SE.rc b/base/applications/games/spider/lang/sv-SE.rc new file mode 100644 index 00000000000..c6af7ec7b0b --- /dev/null +++ b/base/applications/games/spider/lang/sv-SE.rc @@ -0,0 +1,89 @@ +/* + * PROJECT: Spider Solitaire + * LICENSE: See COPYING in top level directory + * FILE: base/applications/games/spider/lang/en-US.rc + * PURPOSE: English Language File for Spider Solitaire + * TRANSLATOR: Gregor Schneider + */ + +#include "resource.h" + +LANGUAGE LANG_SWEDISH, SUBLANG_NEUTRAL + + +/* Dialogs */ + +IDD_CARDBACK DIALOGEX 6, 6, 186, 104 +CAPTION "Vlj Kort Baksidan" +FONT 8, "MS Shell Dlg" +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_SHELLFONT +BEGIN + CONTROL "", IDC_CARDBACK1, "Static", SS_NOTIFY, 4, 7, 26, 32 + CONTROL "", IDC_CARDBACK2, "Static", SS_NOTIFY, 34, 7, 26, 32 + CONTROL "", IDC_CARDBACK3, "Static", SS_NOTIFY, 64, 7, 26, 32 + CONTROL "", IDC_CARDBACK4, "Static", SS_NOTIFY, 94, 7, 26, 32 + CONTROL "", IDC_CARDBACK5, "Static", SS_NOTIFY, 124, 7, 26, 32 + CONTROL "", IDC_CARDBACK6, "Static", SS_NOTIFY, 154, 7, 26, 32 + CONTROL "", IDC_CARDBACK7, "Static", SS_NOTIFY, 4, 46, 26, 32 + CONTROL "", IDC_CARDBACK8, "Static", SS_NOTIFY, 34, 46, 26, 32 + CONTROL "", IDC_CARDBACK9, "Static", SS_NOTIFY, 64, 46, 26, 32 + CONTROL "", IDC_CARDBACK10, "Static", SS_NOTIFY, 94, 46, 26, 32 + CONTROL "", IDC_CARDBACK11, "Static", SS_NOTIFY, 124, 46, 26, 32 + CONTROL "", IDC_CARDBACK12, "Static", SS_NOTIFY, 154, 46, 26, 32 + DEFPUSHBUTTON "OK", IDOK, 66, 84, 54, 13 + PUSHBUTTON "Avbryt", IDCANCEL, 126, 84, 54, 13 +END + +IDD_DIFFICULTY DIALOGEX DISCARDABLE 100, 100, 106, 80 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_SHELLFONT +CAPTION "Svrighet" +FONT 8, "MS Shell Dlg" +BEGIN + AUTORADIOBUTTON "Ltt: &En Frg", IDC_DIF_ONECOLOR, 8, 10, 80, 10, WS_GROUP | WS_TABSTOP + AUTORADIOBUTTON "Medel: &Tv Frger", IDC_DIF_TWOCOLORS, 8, 23, 80, 10 + AUTORADIOBUTTON "Svrt: &Fyra Frger", IDC_DIF_FOURCOLORS, 8, 36, 80, 10 + + DEFPUSHBUTTON "OK", IDOK, 8, 58, 40, 14 + PUSHBUTTON "Avbryt", IDCANCEL, 58, 58, 40, 14 +END + +/* Strings */ + +STRINGTABLE +BEGIN + IDS_SPI_NAME "Spider" + IDS_SPI_ABOUT "Spider Solitaire av Gregor Schneider\nverstt av Ronny K Svensson\n\nCardLib version 1.0" + IDS_SPI_QUIT "Avsluta ditt nuvarande spel?" + IDS_SPI_WIN "Grattis, du vann!" + IDS_SPI_DEAL "Ge igen?" +END + + +/* Menus */ + +IDR_MENU1 MENU DISCARDABLE +BEGIN + POPUP "&Spel" + BEGIN + MENUITEM "&Nytt spel\tF2", IDM_GAME_NEW + MENUITEM SEPARATOR + MENUITEM "&Kortlek...", IDM_GAME_DECK + MENUITEM SEPARATOR + MENUITEM "&Avsluta", IDM_GAME_EXIT + END + POPUP "&Hjlp" + BEGIN + MENUITEM "&Innehll\tF1", IDM_HELP_CONTENTS + MENUITEM "&Om", IDM_HELP_ABOUT + END +END + + + +/* Accelerator */ + +IDR_ACCELERATOR1 ACCELERATORS DISCARDABLE +BEGIN + VK_F1, IDM_HELP_CONTENTS, VIRTKEY, NOINVERT + VK_F2, IDM_GAME_NEW, VIRTKEY, NOINVERT +END diff --git a/base/applications/games/spider/lang/uk-UA.rc b/base/applications/games/spider/lang/uk-UA.rc index 2b4163c3ac4..7a75d11e7fc 100644 --- a/base/applications/games/spider/lang/uk-UA.rc +++ b/base/applications/games/spider/lang/uk-UA.rc @@ -16,7 +16,7 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT /* Dialogs */ IDD_CARDBACK DIALOGEX 6, 6, 186, 104 -CAPTION " " +CAPTION "Вибір оформлення" FONT 8, "MS Shell Dlg" STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_SHELLFONT BEGIN @@ -33,31 +33,31 @@ BEGIN CONTROL "", IDC_CARDBACK11, "Static", SS_NOTIFY, 124, 46, 26, 32 CONTROL "", IDC_CARDBACK12, "Static", SS_NOTIFY, 154, 46, 26, 32 DEFPUSHBUTTON "OK", IDOK, 66, 84, 54, 13 - PUSHBUTTON "", IDCANCEL, 126, 84, 54, 13 + PUSHBUTTON "Скасувати", IDCANCEL, 126, 84, 54, 13 END IDD_DIFFICULTY DIALOGEX DISCARDABLE 100, 100, 106, 80 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_SHELLFONT -CAPTION "г" +CAPTION "Рівень" FONT 8, "MS Shell Dlg" BEGIN - AUTORADIOBUTTON ": & ", IDC_DIF_ONECOLOR, 3, 10, 82, 10, WS_GROUP | WS_TABSTOP - AUTORADIOBUTTON ": & ", IDC_DIF_TWOCOLORS, 3, 23, 92, 10 - AUTORADIOBUTTON ": & ", IDC_DIF_FOURCOLORS, 3, 36, 120, 10 + AUTORADIOBUTTON "Простий: &Один колір", IDC_DIF_ONECOLOR, 3, 10, 82, 10, WS_GROUP | WS_TABSTOP + AUTORADIOBUTTON "Середній: &Два кольори", IDC_DIF_TWOCOLORS, 3, 23, 92, 10 + AUTORADIOBUTTON "Складний: &Чотири кольори", IDC_DIF_FOURCOLORS, 3, 36, 120, 10 DEFPUSHBUTTON "OK", IDOK, 8, 58, 40, 14 - PUSHBUTTON "", IDCANCEL, 58, 58, 40, 14 + PUSHBUTTON "Скасувати", IDCANCEL, 58, 58, 40, 14 END /* Strings */ STRINGTABLE BEGIN - IDS_SPI_NAME " " - IDS_SPI_ABOUT " , Gregor Schneider\n\nCardLib 1.0" - IDS_SPI_QUIT " ?" - IDS_SPI_WIN "³, !" - IDS_SPI_DEAL " ?" + IDS_SPI_NAME "Пас’янс Паук" + IDS_SPI_ABOUT "Пас’янс Паук, Gregor Schneider\n\nCardLib версії 1.0" + IDS_SPI_QUIT "Вийти з поточної гри?" + IDS_SPI_WIN "Вітаємо, ви виграли!" + IDS_SPI_DEAL "Спробувати знову?" END @@ -65,18 +65,18 @@ END IDR_MENU1 MENU DISCARDABLE BEGIN - POPUP "&" + POPUP "&Гра" BEGIN - MENUITEM "& \tF2", IDM_GAME_NEW + MENUITEM "&Нова гра\tF2", IDM_GAME_NEW MENUITEM SEPARATOR - MENUITEM "&...", IDM_GAME_DECK + MENUITEM "&Оформлення...", IDM_GAME_DECK MENUITEM SEPARATOR - MENUITEM "&", IDM_GAME_EXIT + MENUITEM "&Вихід", IDM_GAME_EXIT END - POPUP "&" + POPUP "&Довідка" BEGIN - MENUITEM "& \tF1", IDM_HELP_CONTENTS - MENUITEM "& ...", IDM_HELP_ABOUT + MENUITEM "Пе&регляд довідки\tF1", IDM_HELP_CONTENTS + MENUITEM "&Про програму...", IDM_HELP_ABOUT END END diff --git a/base/applications/games/spider/lang/zh-CN.rc b/base/applications/games/spider/lang/zh-CN.rc new file mode 100644 index 00000000000..56e4aa1cf1c --- /dev/null +++ b/base/applications/games/spider/lang/zh-CN.rc @@ -0,0 +1,89 @@ +/* + * PROJECT: Spider Solitaire + * LICENSE: See COPYING in top level directory + * FILE: base/applications/games/spider/lang/zh-CN.rc + * PURPOSE: Chinese Language File for Spider Solitaire + * TRANSLATOR: Song Fuchang (0xfc) + */ + +#include "resource.h" + +LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED + + +/* Dialogs */ + +IDD_CARDBACK DIALOGEX 6, 6, 186, 104 +CAPTION "选择牌背图案" +FONT 8, "MS Shell Dlg" +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_SHELLFONT +BEGIN + CONTROL "", IDC_CARDBACK1, "Static", SS_NOTIFY, 4, 7, 26, 32 + CONTROL "", IDC_CARDBACK2, "Static", SS_NOTIFY, 34, 7, 26, 32 + CONTROL "", IDC_CARDBACK3, "Static", SS_NOTIFY, 64, 7, 26, 32 + CONTROL "", IDC_CARDBACK4, "Static", SS_NOTIFY, 94, 7, 26, 32 + CONTROL "", IDC_CARDBACK5, "Static", SS_NOTIFY, 124, 7, 26, 32 + CONTROL "", IDC_CARDBACK6, "Static", SS_NOTIFY, 154, 7, 26, 32 + CONTROL "", IDC_CARDBACK7, "Static", SS_NOTIFY, 4, 46, 26, 32 + CONTROL "", IDC_CARDBACK8, "Static", SS_NOTIFY, 34, 46, 26, 32 + CONTROL "", IDC_CARDBACK9, "Static", SS_NOTIFY, 64, 46, 26, 32 + CONTROL "", IDC_CARDBACK10, "Static", SS_NOTIFY, 94, 46, 26, 32 + CONTROL "", IDC_CARDBACK11, "Static", SS_NOTIFY, 124, 46, 26, 32 + CONTROL "", IDC_CARDBACK12, "Static", SS_NOTIFY, 154, 46, 26, 32 + DEFPUSHBUTTON "确定", IDOK, 66, 84, 54, 13 + PUSHBUTTON "取消", IDCANCEL, 126, 84, 54, 13 +END + +IDD_DIFFICULTY DIALOGEX DISCARDABLE 100, 100, 106, 80 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_SHELLFONT +CAPTION "难度" +FONT 8, "MS Shell Dlg" +BEGIN + AUTORADIOBUTTON "简单:一种颜色(&O)", IDC_DIF_ONECOLOR, 8, 10, 80, 10, WS_GROUP | WS_TABSTOP + AUTORADIOBUTTON "中等:两种颜色(&T)", IDC_DIF_TWOCOLORS, 8, 23, 80, 10 + AUTORADIOBUTTON "困难:四种颜色(&F)", IDC_DIF_FOURCOLORS, 8, 36, 80, 10 + + DEFPUSHBUTTON "确定", IDOK, 8, 58, 40, 14 + PUSHBUTTON "取消", IDCANCEL, 58, 58, 40, 14 +END + +/* Strings */ + +STRINGTABLE +BEGIN + IDS_SPI_NAME "蜘蛛纸牌" + IDS_SPI_ABOUT "蜘蛛纸牌 作者:Gregor Schneider\n\n使用 CardLib 版本 1.0" + IDS_SPI_QUIT "退出当前游戏吗?" + IDS_SPI_WIN "祝贺您赢了!" + IDS_SPI_DEAL "再来一次吗?" +END + + +/* Menus */ + +IDR_MENU1 MENU DISCARDABLE +BEGIN + POPUP "游戏(&G)" + BEGIN + MENUITEM "新游戏(&N)\tF2", IDM_GAME_NEW + MENUITEM SEPARATOR + MENUITEM "纸牌... (&D)", IDM_GAME_DECK + MENUITEM SEPARATOR + MENUITEM "退出(&E)", IDM_GAME_EXIT + END + POPUP "帮助(&H)" + BEGIN + MENUITEM "帮助正文(&C)\tF1", IDM_HELP_CONTENTS + MENUITEM "关于(&A)", IDM_HELP_ABOUT + END +END + + + +/* Accelerator */ + +IDR_ACCELERATOR1 ACCELERATORS DISCARDABLE +BEGIN + VK_F1, IDM_HELP_CONTENTS, VIRTKEY, NOINVERT + VK_F2, IDM_GAME_NEW, VIRTKEY, NOINVERT +END diff --git a/base/applications/games/spider/rsrc.rc b/base/applications/games/spider/rsrc.rc index 30faffe8db6..b3c03b68e16 100644 --- a/base/applications/games/spider/rsrc.rc +++ b/base/applications/games/spider/rsrc.rc @@ -14,10 +14,12 @@ IDI_SPIDER ICON DISCARDABLE "spider.ico" #include "lang/it-IT.rc" #include "lang/ja-JP.rc" #include "lang/nl-NL.rc" -#include "lang/ru-RU.rc" #include "lang/sk-SK.rc" -#include "lang/uk-UA.rc" +#include "lang/sv-SE.rc" // UTF-8 #pragma code_page(65001) #include "lang/pl-PL.rc" +#include "lang/ru-RU.rc" +#include "lang/uk-UA.rc" +#include "lang/zh-CN.rc" diff --git a/base/applications/games/spider/spider.cpp b/base/applications/games/spider/spider.cpp index 49676433234..0df7f9982b0 100644 --- a/base/applications/games/spider/spider.cpp +++ b/base/applications/games/spider/spider.cpp @@ -6,13 +6,6 @@ * PROGRAMMER: Gregor Schneider */ -#include -#include -#include -#include - -#include "resource.h" -#include "cardlib.h" #include "spider.h" TCHAR szHelpPath[MAX_PATH]; diff --git a/base/applications/games/spider/spider.h b/base/applications/games/spider/spider.h index 17b919b91aa..f71d6e384dc 100644 --- a/base/applications/games/spider/spider.h +++ b/base/applications/games/spider/spider.h @@ -1,4 +1,12 @@ -#pragma once + +#include +#include +#include +#include +#include +#include "resource.h" +#include "cardlib.h" + #define DIFFICULTY_ONE_COLOR 1 #define DIFFICULTY_TWO_COLORS 2 diff --git a/base/applications/games/spider/spider.rbuild b/base/applications/games/spider/spider.rbuild index f675836fc37..52b86c72e34 100644 --- a/base/applications/games/spider/spider.rbuild +++ b/base/applications/games/spider/spider.rbuild @@ -7,4 +7,5 @@ spigame.cpp spider.cpp rsrc.rc + spider.h diff --git a/base/applications/games/spider/spigame.cpp b/base/applications/games/spider/spigame.cpp index 7521bdd5bdb..5e75ebb9a1f 100644 --- a/base/applications/games/spider/spigame.cpp +++ b/base/applications/games/spider/spigame.cpp @@ -6,13 +6,6 @@ * PROGRAMMER: Gregor Schneider */ -#include -#include -#include -#include - -#include "resource.h" -#include "cardlib.h" #include "spider.h" #define NUM_DECK_CARDS 5 diff --git a/base/applications/kbswitch/lang/ru-RU.rc b/base/applications/kbswitch/lang/ru-RU.rc index d65b1577254..76595ee548d 100644 --- a/base/applications/kbswitch/lang/ru-RU.rc +++ b/base/applications/kbswitch/lang/ru-RU.rc @@ -4,8 +4,8 @@ IDR_POPUP MENU BEGIN POPUP "popup" BEGIN - MENUITEM "&...", ID_PREFERENCES + MENUITEM "&Параметры...", ID_PREFERENCES MENUITEM SEPARATOR - MENUITEM "&", ID_EXIT + MENUITEM "&Выход", ID_EXIT END END diff --git a/base/applications/kbswitch/lang/uk-UA.rc b/base/applications/kbswitch/lang/uk-UA.rc index 3107c48a1ae..b736354f856 100644 --- a/base/applications/kbswitch/lang/uk-UA.rc +++ b/base/applications/kbswitch/lang/uk-UA.rc @@ -12,8 +12,8 @@ IDR_POPUP MENU BEGIN POPUP "popup" BEGIN - MENUITEM "&...", ID_PREFERENCES + MENUITEM "&Параметри...", ID_PREFERENCES MENUITEM SEPARATOR - MENUITEM "&", ID_EXIT + MENUITEM "В&ихід", ID_EXIT END END diff --git a/base/applications/kbswitch/rsrc.rc b/base/applications/kbswitch/rsrc.rc index 3b53529685f..e61940e4a7b 100644 --- a/base/applications/kbswitch/rsrc.rc +++ b/base/applications/kbswitch/rsrc.rc @@ -8,13 +8,13 @@ #include "lang/ja-JP.rc" #include "lang/lt-LT.rc" #include "lang/no-NO.rc" -#include "lang/ru-RU.rc" #include "lang/sk-SK.rc" #include "lang/sv-SE.rc" -#include "lang/uk-UA.rc" #include "lang/zh-CN.rc" #include "lang/zh-TW.rc" // UTF-8 #pragma code_page(65001) #include "lang/pl-PL.rc" +#include "lang/ru-RU.rc" +#include "lang/uk-UA.rc" diff --git a/base/applications/logoff/CMakeLists.txt b/base/applications/logoff/CMakeLists.txt index c560717531a..7a7180eb4c3 100644 --- a/base/applications/logoff/CMakeLists.txt +++ b/base/applications/logoff/CMakeLists.txt @@ -1,15 +1,14 @@ -add_definitions(-D_DLL -D__USE_CRTIMP) +set_rc_compiler() list(APPEND SOURCE misc.c logoff.c logoff.rc) -add_executable(logoff ${CMAKE_CURRENT_BINARY_DIR}/logoff_precomp.h.gch ${SOURCE}) - -add_pch(logoff ${CMAKE_CURRENT_SOURCE_DIR}/precomp.h ${SOURCE}) +add_executable(logoff ${SOURCE}) set_module_type(logoff win32cui) add_importlibs(logoff advapi32 user32 msvcrt kernel32) +add_pch(logoff precomp.h) add_cd_file(TARGET logoff DESTINATION reactos/system32 FOR all) diff --git a/base/applications/logoff/lang/ru-RU.rc b/base/applications/logoff/lang/ru-RU.rc index 8a41aed9c7b..1f18415a373 100644 --- a/base/applications/logoff/lang/ru-RU.rc +++ b/base/applications/logoff/lang/ru-RU.rc @@ -11,13 +11,13 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT STRINGTABLE DISCARDABLE BEGIN -IDS_USAGE, " .\n\n\ - /v\t\t .\n\ - /?\t\t .\n\n" +IDS_USAGE, "Завершение сеанса.\n\n\ + /v\t\tОтображение информации о выполненных действиях.\n\ + /?\t\tОтображение этой информации.\n\n" -IDS_LOGOFF_REMOTE, " ." -IDS_LOGOFF_LOCAL, " ." +IDS_LOGOFF_REMOTE, "Завершение сеанса на удаленной машине." +IDS_LOGOFF_LOCAL, "Завершение текущего сеанса на этой машине." -IDS_ILLEGAL_PARAM, " \n" +IDS_ILLEGAL_PARAM, "Ошибка в параметрах\n" END /* EOF */ diff --git a/base/applications/logoff/lang/uk-UA.rc b/base/applications/logoff/lang/uk-UA.rc index b6b1a4e3966..dd916d2d1c2 100644 --- a/base/applications/logoff/lang/uk-UA.rc +++ b/base/applications/logoff/lang/uk-UA.rc @@ -11,13 +11,13 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT STRINGTABLE DISCARDABLE BEGIN -IDS_USAGE, " .\n\n\ - /v\t\t³ 䳿.\n\ - /?\t\t³ .\n\n" +IDS_USAGE, "Завершення сеансу.\n\n\ + /v\t\tВідображення інформації про виконані дії.\n\ + /?\t\tВідображення цієї інформації.\n\n" -IDS_LOGOFF_REMOTE, " ." -IDS_LOGOFF_LOCAL, " ." +IDS_LOGOFF_REMOTE, "Завершення сеансу на віддаленій машині." +IDS_LOGOFF_LOCAL, "Завершення поточного сеансу на цій машині." -IDS_ILLEGAL_PARAM, " \n" +IDS_ILLEGAL_PARAM, "Невірні параметри\n" END /* EOF */ diff --git a/base/applications/logoff/rsrc.rc b/base/applications/logoff/rsrc.rc index 8a922bb0d26..c454dfe8d4f 100644 --- a/base/applications/logoff/rsrc.rc +++ b/base/applications/logoff/rsrc.rc @@ -11,13 +11,13 @@ #include "lang/ko-KR.rc" #include "lang/lt-LT.rc" #include "lang/no-NO.rc" -#include "lang/ru-RU.rc" #include "lang/sk-SK.rc" #include "lang/sv-SE.rc" -#include "lang/uk-UA.rc" #include "lang/zh-CN.rc" #include "lang/zh-TW.rc" // UTF-8 #pragma code_page(65001) #include "lang/pl-PL.rc" +#include "lang/ru-RU.rc" +#include "lang/uk-UA.rc" diff --git a/base/applications/magnify/CMakeLists.txt b/base/applications/magnify/CMakeLists.txt index e7ab404c53c..5fef7d5444d 100644 --- a/base/applications/magnify/CMakeLists.txt +++ b/base/applications/magnify/CMakeLists.txt @@ -6,6 +6,7 @@ add_executable(magnify settings.c magnify.rc) +add_pch(magnify magnifier.h) set_module_type(magnify win32gui) add_importlibs(magnify user32 gdi32 advapi32 shell32 msvcrt kernel32) add_cd_file(TARGET magnify DESTINATION reactos/system32 FOR all) diff --git a/base/applications/magnify/lang/ro-RO.rc b/base/applications/magnify/lang/ro-RO.rc index 209f74c630f..4bd21a55147 100644 --- a/base/applications/magnify/lang/ro-RO.rc +++ b/base/applications/magnify/lang/ro-RO.rc @@ -62,5 +62,3 @@ STRINGTABLE BEGIN IDS_APP_TITLE "Lupă" END - -#pragma code_page(default) diff --git a/base/applications/magnify/lang/ru-RU.rc b/base/applications/magnify/lang/ru-RU.rc index 12097918c3e..488fbd4c834 100644 --- a/base/applications/magnify/lang/ru-RU.rc +++ b/base/applications/magnify/lang/ru-RU.rc @@ -2,12 +2,12 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT IDC_MAGNIFIER MENU BEGIN - POPUP "&" + POPUP "&Файл" BEGIN - MENUITEM "&", IDM_EXIT - MENUITEM "&", IDM_OPTIONS + MENUITEM "&Выход", IDM_EXIT + MENUITEM "&Параметры", IDM_OPTIONS MENUITEM SEPARATOR - MENUITEM "& ...", IDM_ABOUT + MENUITEM "&О программе...", IDM_ABOUT END END @@ -19,46 +19,46 @@ END IDD_ABOUTBOX DIALOGEX 22, 17, 220, 75 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "О программе" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN ICON IDI_ICON,IDC_MYICON,14,9,20,20 - LTEXT " . 1.0",IDC_STATIC,49,10,119,8,SS_NOPREFIX - LTEXT " (C) 2007 Marc Piulachs (marc.piulachs@codexchange.net)",IDC_STATIC,48,24,150,22 + LTEXT "Экранная лупа. Версия 1.0",IDC_STATIC,49,10,119,8,SS_NOPREFIX + LTEXT "Авторские права (C) 2007 Marc Piulachs (marc.piulachs@codexchange.net)",IDC_STATIC,48,24,150,22 PUSHBUTTON "OK",IDOK,162,48,50,14 END IDD_DIALOGOPTIONS DIALOGEX 0, 0, 185, 182 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "" +CAPTION "Параметры" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - DEFPUSHBUTTON "&",IDOK,94,158,50,14 - PUSHBUTTON "&",IDC_BUTTON_HELP,34,158,50,14 - LTEXT ":",IDC_STATIC,6,8,68,8 + DEFPUSHBUTTON "В&ыход",IDOK,94,158,50,14 + PUSHBUTTON "&Справка",IDC_BUTTON_HELP,34,158,50,14 + LTEXT "Увеличение:",IDC_STATIC,6,8,68,8 COMBOBOX IDC_ZOOM,92,6,85,66,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - GROUPBOX "",IDC_STATIC,7,25,170,59 - GROUPBOX "",IDC_STATIC,7,87,170,57 - CONTROL " & ",IDC_FOLLOWMOUSECHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,42,155,10 - CONTROL " & ",IDC_FOLLOWKEYBOARDCHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,54,155,10 - CONTROL " & ",IDC_FOLLOWTEXTEDITINGCHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,66,155,10 - CONTROL "& ",IDC_INVERTCOLORSCHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,102,150,10 - CONTROL "& ",IDC_STARTMINIMIZEDCHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,114,150,10 - CONTROL "& ",IDC_SHOWMAGNIFIERCHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,126,150,10 + GROUPBOX "Слежение",IDC_STATIC,7,25,170,59 + GROUPBOX "Представление",IDC_STATIC,7,87,170,57 + CONTROL "Следовать за ук&азателем мыши",IDC_FOLLOWMOUSECHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,42,155,10 + CONTROL "Следовать за ф&окусом ввода",IDC_FOLLOWKEYBOARDCHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,54,155,10 + CONTROL "Следовать за р&едактированием текста",IDC_FOLLOWTEXTEDITINGCHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,66,155,10 + CONTROL "О&братить цвета",IDC_INVERTCOLORSCHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,102,150,10 + CONTROL "&Запускать в свернутом виде",IDC_STARTMINIMIZEDCHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,114,150,10 + CONTROL "О&тображать окно экранной лупы",IDC_SHOWMAGNIFIERCHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,126,150,10 END IDD_WARNINGDIALOG DIALOGEX 0, 0, 250, 97 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION -CAPTION " " +CAPTION "Экранная лупа" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN DEFPUSHBUTTON "OK",IDOK,193,76,50,14 ICON IDI_ICON,IDC_STATIC,7,17,20,20 - LTEXT """ "" . .",IDC_STATIC,36,7,207,33 - CONTROL " ",IDC_SHOWWARNINGCHECK, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,58,230,10 + LTEXT """Экранная лупа"" обеспечивает лишь начальный уровень возможностей для людей с плохим зрением. Пользователям с сильными нарушениями зрения лучше применять специальные программы с более широкими возможностями.",IDC_STATIC,36,7,207,33 + CONTROL "Не выводить это сообщение в дальнейшем",IDC_SHOWWARNINGCHECK, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,58,230,10 END STRINGTABLE BEGIN - IDS_APP_TITLE " " + IDS_APP_TITLE "Экранная лупа" END diff --git a/base/applications/magnify/lang/uk-UA.rc b/base/applications/magnify/lang/uk-UA.rc index 296d7c24dfb..d21865e67b3 100644 --- a/base/applications/magnify/lang/uk-UA.rc +++ b/base/applications/magnify/lang/uk-UA.rc @@ -10,12 +10,12 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT IDC_MAGNIFIER MENU BEGIN - POPUP "&" + POPUP "&Файл" BEGIN - MENUITEM "&", IDM_EXIT - MENUITEM "&", IDM_OPTIONS + MENUITEM "В&ихід", IDM_EXIT + MENUITEM "П&араметри", IDM_OPTIONS MENUITEM SEPARATOR - MENUITEM "& ...", IDM_ABOUT + MENUITEM "&Про програму ...", IDM_ABOUT END END @@ -27,46 +27,46 @@ END IDD_ABOUTBOX DIALOGEX 22, 17, 220, 75 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Про програму" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN ICON IDI_ICON,IDC_MYICON,14,9,20,20 - LTEXT " 1.0",IDC_STATIC,49,10,119,8,SS_NOPREFIX + LTEXT "Екранна лупа Версія 1.0",IDC_STATIC,49,10,119,8,SS_NOPREFIX LTEXT "Copyright (C) 2007 Marc Piulachs (marc.piulachs@codexchange.net)",IDC_STATIC,48,24,125,22 PUSHBUTTON "OK",IDOK,162,48,50,14 END IDD_DIALOGOPTIONS DIALOGEX 0, 0, 153, 182 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Параметри екранної лупи" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - DEFPUSHBUTTON "",IDOK,96,161,50,14 - PUSHBUTTON "",IDC_BUTTON_HELP,38,161,50,14 - LTEXT ":",IDC_STATIC,6,8,68,8 + DEFPUSHBUTTON "Вихід",IDOK,96,161,50,14 + PUSHBUTTON "Довідка",IDC_BUTTON_HELP,38,161,50,14 + LTEXT "Збільшення:",IDC_STATIC,6,8,68,8 COMBOBOX IDC_ZOOM,72,6,63,66,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - GROUPBOX "³",IDC_STATIC,7,25,139,59 - GROUPBOX "",IDC_STATIC,7,87,139,57 - CONTROL "³ ",IDC_FOLLOWMOUSECHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,42,114,10 - CONTROL "³ ",IDC_FOLLOWKEYBOARDCHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,54,114,10 - CONTROL "³ ",IDC_FOLLOWTEXTEDITINGCHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,66,114,10 - CONTROL " ",IDC_INVERTCOLORSCHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,102,114,10 - CONTROL " ",IDC_STARTMINIMIZEDCHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,114,114,10 - CONTROL " ",IDC_SHOWMAGNIFIERCHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,126,114,10 + GROUPBOX "Відстеження",IDC_STATIC,7,25,139,59 + GROUPBOX "Подання",IDC_STATIC,7,87,139,57 + CONTROL "Відстежувати вказівник миші",IDC_FOLLOWMOUSECHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,42,114,10 + CONTROL "Відстежувати фокус вводу",IDC_FOLLOWKEYBOARDCHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,54,114,10 + CONTROL "Відстежувати редагування тексту",IDC_FOLLOWTEXTEDITINGCHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,66,114,10 + CONTROL "Обернути кольори",IDC_INVERTCOLORSCHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,102,114,10 + CONTROL "Запустити у згорнутому вигляді",IDC_STARTMINIMIZEDCHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,114,114,10 + CONTROL "Показувати вікно екранної лупи",IDC_SHOWMAGNIFIERCHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,126,114,10 END IDD_WARNINGDIALOG DIALOGEX 0, 0, 250, 97 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION -CAPTION " ReactOS" +CAPTION "Екранна лупа ReactOS" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN DEFPUSHBUTTON "OK",IDOK,193,76,50,14 ICON IDI_ICON,IDC_STATIC,7,17,20,20 - LTEXT " . .",IDC_STATIC,36,7,207,33 - CONTROL " ",IDC_SHOWWARNINGCHECK, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,43,80,137,10 + LTEXT "Екранна лупа надає лише мінімальний обсяг можливостей для людей із порушенням зору. Більшості таких користувачів доцільно застосовувати спеціальні програми з більш широкими можливостями.",IDC_STATIC,36,7,207,33 + CONTROL "Більше не показувати це повідомлення",IDC_SHOWWARNINGCHECK, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,43,80,137,10 END STRINGTABLE BEGIN - IDS_APP_TITLE " " + IDS_APP_TITLE "Екранна лупа" END diff --git a/base/applications/magnify/magnifier.c b/base/applications/magnify/magnifier.c index af0358639a9..31435bf63e2 100644 --- a/base/applications/magnify/magnifier.c +++ b/base/applications/magnify/magnifier.c @@ -7,10 +7,7 @@ * */ -#include -#include #include "magnifier.h" -#include "resource.h" const TCHAR szWindowClass[] = TEXT("MAGNIFIER"); diff --git a/base/applications/magnify/magnifier.h b/base/applications/magnify/magnifier.h index 8728c02fb88..1181c9c4882 100644 --- a/base/applications/magnify/magnifier.h +++ b/base/applications/magnify/magnifier.h @@ -20,6 +20,12 @@ ////////////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include "resource.h" + extern int iZoom; extern BOOL bShowWarning; diff --git a/base/applications/magnify/magnify.rbuild b/base/applications/magnify/magnify.rbuild index 8c06ce8e5bf..bf08bc862a3 100644 --- a/base/applications/magnify/magnify.rbuild +++ b/base/applications/magnify/magnify.rbuild @@ -9,4 +9,5 @@ magnifier.c settings.c magnify.rc + magnifier.h diff --git a/base/applications/magnify/magnify.rc b/base/applications/magnify/magnify.rc index 9ea3ddcab6a..f9f04ee5753 100644 --- a/base/applications/magnify/magnify.rc +++ b/base/applications/magnify/magnify.rc @@ -1,6 +1,5 @@ -#include -#include -#include "resource.h" + +#include "magnifier.h" LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL diff --git a/base/applications/magnify/rsrc.rc b/base/applications/magnify/rsrc.rc index afc9f21fa02..f407b9273e9 100644 --- a/base/applications/magnify/rsrc.rc +++ b/base/applications/magnify/rsrc.rc @@ -9,10 +9,8 @@ #include "lang/it-IT.rc" #include "lang/ja-JP.rc" #include "lang/no-NO.rc" -#include "lang/ru-RU.rc" #include "lang/sk-SK.rc" #include "lang/sv-SE.rc" -#include "lang/uk-UA.rc" #include "lang/zh-CN.rc" #include "lang/zh-TW.rc" @@ -20,3 +18,5 @@ #pragma code_page(65001) #include "lang/pl-PL.rc" #include "lang/ro-RO.rc" +#include "lang/ru-RU.rc" +#include "lang/uk-UA.rc" diff --git a/base/applications/magnify/settings.c b/base/applications/magnify/settings.c index 3d6f9682f0c..b0119b0a40f 100644 --- a/base/applications/magnify/settings.c +++ b/base/applications/magnify/settings.c @@ -1,5 +1,4 @@ -#include -#include + #include "magnifier.h" int iZoom = 3; diff --git a/base/applications/mmc/CMakeLists.txt b/base/applications/mmc/CMakeLists.txt index 765cf2e2b3b..39bdd4f405b 100644 --- a/base/applications/mmc/CMakeLists.txt +++ b/base/applications/mmc/CMakeLists.txt @@ -8,9 +8,8 @@ list(APPEND SOURCE mmc.c mmc.rc) -add_executable(mmcclient ${CMAKE_CURRENT_BINARY_DIR}/mmcclient_precomp.h.gch ${SOURCE}) - -add_pch(mmcclient ${CMAKE_CURRENT_SOURCE_DIR}/precomp.h ${SOURCE}) +add_executable(mmcclient ${SOURCE}) set_module_type(mmcclient win32gui) add_importlibs(mmcclient user32 gdi32 comdlg32 advapi32 shell32 comctl32 msvcrt kernel32) +add_pch(mmcclient precomp.h) diff --git a/base/applications/mmc/lang/ru-RU.rc b/base/applications/mmc/lang/ru-RU.rc index a4ea202e8a2..1602e37974c 100644 --- a/base/applications/mmc/lang/ru-RU.rc +++ b/base/applications/mmc/lang/ru-RU.rc @@ -4,20 +4,20 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT IDM_CONSOLEROOT MENU DISCARDABLE BEGIN - POPUP "&" + POPUP "&Файл" BEGIN MENUITEM SEPARATOR - MENUITEM "&\tAlt+F4", ID_FILE_EXIT + MENUITEM "&Выход\tAlt+F4", ID_FILE_EXIT END - POPUP "&" + POPUP "&Справка" BEGIN - MENUITEM "& ...", ID_HELP_ABOUT + MENUITEM "&О программе...", ID_HELP_ABOUT END END STRINGTABLE DISCARDABLE BEGIN - IDS_APPTITLE " ReactOS" + IDS_APPTITLE "Консоль управления ReactOS" IDS_CONSOLETITLE "Console%1!u!" END diff --git a/base/applications/mmc/lang/uk-UA.rc b/base/applications/mmc/lang/uk-UA.rc index 1e8190b78d4..a09ce90e417 100644 --- a/base/applications/mmc/lang/uk-UA.rc +++ b/base/applications/mmc/lang/uk-UA.rc @@ -10,20 +10,20 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT IDM_CONSOLEROOT MENU DISCARDABLE BEGIN - POPUP "&" + POPUP "&Файл" BEGIN MENUITEM SEPARATOR - MENUITEM "&\tAlt+F4", ID_FILE_EXIT + MENUITEM "В&ихід\tAlt+F4", ID_FILE_EXIT END - POPUP "&" + POPUP "&Довідка" BEGIN - MENUITEM "& ReactOS...", ID_HELP_ABOUT + MENUITEM "&Про консоль керування ReactOS...", ID_HELP_ABOUT END END STRINGTABLE DISCARDABLE BEGIN - IDS_APPTITLE " ReactOS" - IDS_CONSOLETITLE "%1!u!" + IDS_APPTITLE "Консоль керування ReactOS" + IDS_CONSOLETITLE "Консоль%1!u!" END diff --git a/base/applications/mmc/rsrc.rc b/base/applications/mmc/rsrc.rc index 9769d477979..0a4886f5183 100644 --- a/base/applications/mmc/rsrc.rc +++ b/base/applications/mmc/rsrc.rc @@ -14,13 +14,13 @@ #include "lang/lt-LT.rc" #include "lang/no-NO.rc" #include "lang/pt-BR.rc" -#include "lang/ru-RU.rc" #include "lang/sk-SK.rc" #include "lang/sv-SE.rc" -#include "lang/uk-UA.rc" #include "lang/zh-CN.rc" #include "lang/zh-TW.rc" // UTF-8 #pragma code_page(65001) #include "lang/pl-PL.rc" +#include "lang/ru-RU.rc" +#include "lang/uk-UA.rc" diff --git a/base/applications/mplay32/lang/ru-RU.rc b/base/applications/mplay32/lang/ru-RU.rc index 639506f9daf..d83dc462d4e 100644 --- a/base/applications/mplay32/lang/ru-RU.rc +++ b/base/applications/mplay32/lang/ru-RU.rc @@ -2,29 +2,29 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT IDR_MAINMENU MENU BEGIN - POPUP "&" + POPUP "&Файл" BEGIN - MENUITEM "&...", IDM_OPEN_FILE - MENUITEM "&", IDM_CLOSE_FILE + MENUITEM "&Открыть...", IDM_OPEN_FILE + MENUITEM "&Закрыть", IDM_CLOSE_FILE MENUITEM SEPARATOR - MENUITEM "&", IDM_EXIT + MENUITEM "&Выход", IDM_EXIT END - POPUP "&" + POPUP "&Помощь" BEGIN - MENUITEM "& ...", IDM_ABOUT + MENUITEM "&О программе...", IDM_ABOUT END END STRINGTABLE DISCARDABLE BEGIN - IDS_ALL_TYPES_FILTER " (*.wav, *.cda, *.midi, *.mid, *.avi)\0*.wav;*.cda;*.midi;*.mid;*.avi\0" - IDS_TOOLTIP_PLAY "" - IDS_TOOLTIP_STOP "" - IDS_TOOLTIP_EJECT "" - IDS_TOOLTIP_BACKWARD "" - IDS_TOOLTIP_SEEKBACK " " - IDS_TOOLTIP_SEEKFORW " " - IDS_TOOLTIP_FORWARD "" - IDS_APPTITLE " ReactOS" - IDS_PLAY "" + IDS_ALL_TYPES_FILTER "Все поддерживаемые (*.wav, *.cda, *.midi, *.mid, *.avi)\0*.wav;*.cda;*.midi;*.mid;*.avi\0" + IDS_TOOLTIP_PLAY "Воспроизведение" + IDS_TOOLTIP_STOP "Остановить" + IDS_TOOLTIP_EJECT "Извлечь" + IDS_TOOLTIP_BACKWARD "Назад" + IDS_TOOLTIP_SEEKBACK "Перемотка назад" + IDS_TOOLTIP_SEEKFORW "Перемотка вперед" + IDS_TOOLTIP_FORWARD "Вперед" + IDS_APPTITLE "Проигрыватель ReactOS" + IDS_PLAY "Воспроизвести" END diff --git a/base/applications/mplay32/lang/uk-UA.rc b/base/applications/mplay32/lang/uk-UA.rc index 4ba0f32f1af..629b3e0d55f 100644 --- a/base/applications/mplay32/lang/uk-UA.rc +++ b/base/applications/mplay32/lang/uk-UA.rc @@ -10,29 +10,29 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT IDR_MAINMENU MENU BEGIN - POPUP "&" + POPUP "&Файл" BEGIN - MENUITEM "&³...", IDM_OPEN_FILE - MENUITEM "&", IDM_CLOSE_FILE + MENUITEM "&Відкрити...", IDM_OPEN_FILE + MENUITEM "&Закрити", IDM_CLOSE_FILE MENUITEM SEPARATOR - MENUITEM "&", IDM_EXIT + MENUITEM "&Вихід", IDM_EXIT END - POPUP "&" + POPUP "&Довідка" BEGIN - MENUITEM "& ...", IDM_ABOUT + MENUITEM "&Про програму...", IDM_ABOUT END END STRINGTABLE DISCARDABLE BEGIN - IDS_ALL_TYPES_FILTER " (*.wav, *.cda, *.midi, *.mid, *.avi)\0*.wav;*.cda;*.midi;*.mid;*.avi\0" - IDS_TOOLTIP_PLAY "³" - IDS_TOOLTIP_STOP "" - IDS_TOOLTIP_EJECT "" - IDS_TOOLTIP_BACKWARD "" - IDS_TOOLTIP_SEEKBACK " " - IDS_TOOLTIP_SEEKFORW " " - IDS_TOOLTIP_FORWARD "" - IDS_APPTITLE " ReactOS" - IDS_PLAY "³" + IDS_ALL_TYPES_FILTER "Всі підтримувані (*.wav, *.cda, *.midi, *.mid, *.avi)\0*.wav;*.cda;*.midi;*.mid;*.avi\0" + IDS_TOOLTIP_PLAY "Відтворення" + IDS_TOOLTIP_STOP "Зупинити" + IDS_TOOLTIP_EJECT "Витягти" + IDS_TOOLTIP_BACKWARD "Назад" + IDS_TOOLTIP_SEEKBACK "Перемотування назад" + IDS_TOOLTIP_SEEKFORW "Перемотування вперед" + IDS_TOOLTIP_FORWARD "Вперед" + IDS_APPTITLE "Програвач ReactOS" + IDS_PLAY "Відтворити" END diff --git a/base/applications/mplay32/lang/zh-CN.rc b/base/applications/mplay32/lang/zh-CN.rc new file mode 100644 index 00000000000..8b56ac44d3f --- /dev/null +++ b/base/applications/mplay32/lang/zh-CN.rc @@ -0,0 +1,34 @@ +/* + * Translated by Song Fuchang (0xfc) + */ + +LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED + +IDR_MAINMENU MENU +BEGIN + POPUP "文件(&F)" + BEGIN + MENUITEM "打开... (&O)", IDM_OPEN_FILE + MENUITEM "关闭(&C)", IDM_CLOSE_FILE + MENUITEM SEPARATOR + MENUITEM "退出(&E)", IDM_EXIT + END + POPUP "帮助(&H)" + BEGIN + MENUITEM "关于... (&A)", IDM_ABOUT + END +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_ALL_TYPES_FILTER "所有支持的格式 (*.wav, *.cda, *.midi, *.mid, *.avi)\0*.wav;*.cda;*.midi;*.mid;*.avi\0" + IDS_TOOLTIP_PLAY "播放" + IDS_TOOLTIP_STOP "停止" + IDS_TOOLTIP_EJECT "弹出" + IDS_TOOLTIP_BACKWARD "向后跳过" + IDS_TOOLTIP_SEEKBACK "快退" + IDS_TOOLTIP_SEEKFORW "快进" + IDS_TOOLTIP_FORWARD "向前跳过" + IDS_APPTITLE "ReactOS 多媒体播放器" + IDS_PLAY "播放" +END diff --git a/base/applications/mplay32/rsrc.rc b/base/applications/mplay32/rsrc.rc index 581f7839e06..6b4f0f0d2cd 100644 --- a/base/applications/mplay32/rsrc.rc +++ b/base/applications/mplay32/rsrc.rc @@ -11,11 +11,12 @@ #include "lang/ja-JP.rc" #include "lang/nl-NL.rc" #include "lang/no-NO.rc" -#include "lang/ru-RU.rc" #include "lang/sk-SK.rc" #include "lang/sv-SE.rc" -#include "lang/uk-UA.rc" // UTF-8 #pragma code_page(65001) #include "lang/pl-PL.rc" +#include "lang/ru-RU.rc" +#include "lang/uk-UA.rc" +#include "lang/zh-CN.rc" diff --git a/base/applications/msconfig/CMakeLists.txt b/base/applications/msconfig/CMakeLists.txt index cf9c7e0d1ed..94ff16b5618 100644 --- a/base/applications/msconfig/CMakeLists.txt +++ b/base/applications/msconfig/CMakeLists.txt @@ -12,10 +12,9 @@ list(APPEND SOURCE msconfig.c msconfig.rc) -add_executable(msconfig ${CMAKE_CURRENT_BINARY_DIR}/msconfig_precomp.h.gch ${SOURCE}) - -add_pch(msconfig ${CMAKE_CURRENT_SOURCE_DIR}/precomp.h ${SOURCE}) +add_executable(msconfig ${SOURCE}) set_module_type(msconfig win32gui) add_importlibs(msconfig user32 advapi32 version comctl32 shell32 shlwapi msvcrt kernel32) +add_pch(msconfig precomp.h) add_cd_file(TARGET msconfig DESTINATION reactos/system32 FOR all) diff --git a/base/applications/msconfig/lang/pl-PL.rc b/base/applications/msconfig/lang/pl-PL.rc index bbc95f958c8..c41bac60951 100644 --- a/base/applications/msconfig/lang/pl-PL.rc +++ b/base/applications/msconfig/lang/pl-PL.rc @@ -3,6 +3,7 @@ * testament@users.sourceforge.net * https://sourceforge.net/projects/reactospl * UTF-8 conversion by Caemyr (May, 2011) + * updated by Saibamen - Adam Stachowicz (saibamenppl@gmail.com) (August, 2011) */ LANGUAGE LANG_POLISH, SUBLANG_DEFAULT @@ -72,12 +73,12 @@ STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN FONT 8, "MS Shell Dlg" BEGIN GROUPBOX "Wybór uruchamiania", -1, 10, 10, 340, 150,0,WS_EX_TRANSPARENT - CONTROL "Uruchamianie &normalne - załaduj wszystkie sterowniki urządzeń i usługi", IDC_CBX_NORMAL_START, "Button", 0x50010009, 20, 30, 180, 10 - CONTROL "Uruchamianie &diagnostyczne - załaduj tylko podstawowe urządzenia i usługi", IDC_CBX_DIAGNOSTIC_START, "Button", 0x50010009, 20, 45, 195, 10 - CONTROL "Uruchamianie &selektywne", IDC_CBX_SELECTIVE_STARTUP, "Button", 0x50010009, 20, 60, 70, 10 - AUTOCHECKBOX "&Przetwarzaj plik SYSTEM.INI", IDC_CBX_SYSTEM_INI, 30, 80, 95, 10 - AUTOCHECKBOX "Załaduj &usługi systemowe", IDC_CBX_SYSTEM_SERVICE, 30, 95, 90, 10 - AUTOCHECKBOX "Załaduj &elementy startowe", IDC_CBX_STARTUP_ITEM, 30, 110, 75, 10 + CONTROL "Uruchamianie &normalne - załaduj wszystkie sterowniki urządzeń i usługi", IDC_CBX_NORMAL_START, "Button", 0x50010009, 20, 30, 238, 10 + CONTROL "Uruchamianie &diagnostyczne - załaduj tylko podstawowe urządzenia i usługi", IDC_CBX_DIAGNOSTIC_START, "Button", 0x50010009, 20, 45, 253, 10 + CONTROL "Uruchamianie &selektywne", IDC_CBX_SELECTIVE_STARTUP, "Button", 0x50010009, 20, 60, 95, 10 + AUTOCHECKBOX "&Przetwarzaj plik SYSTEM.INI", IDC_CBX_SYSTEM_INI, 30, 80, 102, 10 + AUTOCHECKBOX "Załaduj &usługi systemowe", IDC_CBX_SYSTEM_SERVICE, 30, 95, 95, 10 + AUTOCHECKBOX "Załaduj &elementy startowe", IDC_CBX_STARTUP_ITEM, 30, 110, 98, 10 END IDD_FREELDR_PAGE DIALOGEX DISCARDABLE 0, 0, 362, 175 @@ -140,7 +141,7 @@ END STRINGTABLE DISCARDABLE BEGIN IDS_SERVICES_COLUMN_SERVICE "Usługa" - IDS_SERVICES_COLUMN_REQ "Wymagany" + IDS_SERVICES_COLUMN_REQ "Wymagana" IDS_SERVICES_COLUMN_VENDOR "Producent" IDS_SERVICES_COLUMN_STATUS "Stan" END diff --git a/base/applications/msconfig/lang/ru-RU.rc b/base/applications/msconfig/lang/ru-RU.rc index c1a3a6b57fb..cec48591d0c 100644 --- a/base/applications/msconfig/lang/ru-RU.rc +++ b/base/applications/msconfig/lang/ru-RU.rc @@ -6,14 +6,14 @@ IDD_MSCONFIG_DIALOG DIALOGEX DISCARDABLE 0, 0, 378, 220 STYLE DS_SHELLFONT | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME -CAPTION " " +CAPTION "Настройки системы" FONT 8, "MS Shell Dlg" BEGIN CONTROL "Tab1",IDC_TAB,"SysTabControl32",WS_TABSTOP,2,2,374,195 DEFPUSHBUTTON "OK", IDOK, 211, 201, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP - PUSHBUTTON "&", IDC_BTN_HELP, 2, 201, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP - PUSHBUTTON "", IDCANCEL, 267, 201, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP - PUSHBUTTON "", IDC_BTN_APPLY, 323, 201, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP + PUSHBUTTON "&Справка", IDC_BTN_HELP, 2, 201, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP + PUSHBUTTON "Отмена", IDCANCEL, 267, 201, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP + PUSHBUTTON "Применить", IDC_BTN_APPLY, 323, 201, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP END IDD_STARTUP_PAGE DIALOGEX DISCARDABLE 0, 0, 362, 175 @@ -21,8 +21,8 @@ STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN FONT 8, "MS Shell Dlg" BEGIN CONTROL "List3",IDC_STARTUP_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 2, 1, 360, 148 - PUSHBUTTON "& ",IDC_BTN_STARTUP_ACTIVATE,223,155,66,14 - PUSHBUTTON "& ",IDC_BTN_STARTUP_DEACTIVATE,295,155,66,14 + PUSHBUTTON "&Включить все",IDC_BTN_STARTUP_ACTIVATE,223,155,66,14 + PUSHBUTTON "В&ыключить все",IDC_BTN_STARTUP_DEACTIVATE,295,155,66,14 END IDD_SYSTEM_PAGE DIALOGEX DISCARDABLE 0, 0, 362, 175 @@ -30,18 +30,18 @@ STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN FONT 8, "MS Shell Dlg" BEGIN CONTROL "", 237, "SysTreeView32", TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_EDITLABELS | TVS_SHOWSELALWAYS | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 2, 1, 280, 148 - PUSHBUTTON "&", IDC_BTN_SYSTEM_UP, 290, 5, 66, 14 - PUSHBUTTON "&", IDC_BTN_SYSTEM_DOWN, 290, 25, 66, 14 + PUSHBUTTON "Вв&ерх", IDC_BTN_SYSTEM_UP, 290, 5, 66, 14 + PUSHBUTTON "В&низ", IDC_BTN_SYSTEM_DOWN, 290, 25, 66, 14 - PUSHBUTTON "&", IDC_BTN_SYSTEM_ENABLE, 290, 50, 66, 14 - PUSHBUTTON "&", IDC_BTN_SYSTEM_DISABLE, 290, 70, 66, 14 + PUSHBUTTON "В&ключить", IDC_BTN_SYSTEM_ENABLE, 290, 50, 66, 14 + PUSHBUTTON "&Отключить", IDC_BTN_SYSTEM_DISABLE, 290, 70, 66, 14 - PUSHBUTTON "&", IDC_BTN_SYSTEM_FIND, 290, 95, 66, 14 - PUSHBUTTON "&", IDC_BTN_SYSTEM_NEW, 290, 115, 66, 14 - PUSHBUTTON "&", IDC_BTN_SYSTEM_EDIT, 290, 135, 66, 14 + PUSHBUTTON "&Поиск", IDC_BTN_SYSTEM_FIND, 290, 95, 66, 14 + PUSHBUTTON "&Создать", IDC_BTN_SYSTEM_NEW, 290, 115, 66, 14 + PUSHBUTTON "&Изменить", IDC_BTN_SYSTEM_EDIT, 290, 135, 66, 14 - PUSHBUTTON "& ", IDC_BTN_SYSTEM_ACTIVATE, 123, 155, 66, 14 - PUSHBUTTON "& ",IDC_BTN_SYSTEM_DEACTIVATE, 195, 155, 66, 14 + PUSHBUTTON "Вк&лючить все", IDC_BTN_SYSTEM_ACTIVATE, 123, 155, 66, 14 + PUSHBUTTON "О&тключить все",IDC_BTN_SYSTEM_DEACTIVATE, 195, 155, 66, 14 END IDD_TOOLS_PAGE DIALOGEX DISCARDABLE 0, 0, 362, 175 @@ -50,7 +50,7 @@ FONT 8, "MS Shell Dlg" BEGIN CONTROL "List2",IDC_TOOLS_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 2, 1, 360, 134 EDITTEXT IDC_TOOLS_CMDLINE, 1, 139, 360, 12, ES_READONLY - PUSHBUTTON "&", IDC_BTN_RUN, 311, 155, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP + PUSHBUTTON "&Запуск", IDC_BTN_RUN, 311, 155, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP END IDD_SERVICES_PAGE DIALOGEX DISCARDABLE 0, 0, 362, 175 @@ -58,21 +58,21 @@ STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN FONT 8, "MS Shell Dlg" BEGIN CONTROL "List1",IDC_SERVICES_LIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP,2,1,360,148 - PUSHBUTTON "& ",IDC_BTN_SERVICES_ACTIVATE,223,155,66,14 - PUSHBUTTON "& ",IDC_BTN_SERVICES_DEACTIVATE,295,155,66,14 + PUSHBUTTON "&Включить все",IDC_BTN_SERVICES_ACTIVATE,223,155,66,14 + PUSHBUTTON "В&ыключить все",IDC_BTN_SERVICES_DEACTIVATE,295,155,66,14 END IDD_GENERAL_PAGE DIALOGEX DISCARDABLE 0, 0, 362, 175 STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ", -1, 10, 10, 340, 150,0,WS_EX_TRANSPARENT - CONTROL "& - ", IDC_CBX_NORMAL_START, "Button", 0x50010009, 20, 30, 280, 10 - CONTROL "& - ", IDC_CBX_DIAGNOSTIC_START, "Button", 0x50010009, 20, 45, 325, 10 - CONTROL "& ", IDC_CBX_SELECTIVE_STARTUP, "Button", 0x50010009, 20, 60, 100, 10 - AUTOCHECKBOX "& SYSTEM.INI", IDC_CBX_SYSTEM_INI, 30, 80, 130, 10 - AUTOCHECKBOX "& ", IDC_CBX_SYSTEM_SERVICE, 30, 95, 130, 10 - AUTOCHECKBOX "& ", IDC_CBX_STARTUP_ITEM, 30, 110, 140, 10 + GROUPBOX "Варианты запуска", -1, 10, 10, 340, 150,0,WS_EX_TRANSPARENT + CONTROL "&Обычный запуск - загрузка всех драйверов устройств и запуск всех служб", IDC_CBX_NORMAL_START, "Button", 0x50010009, 20, 30, 280, 10 + CONTROL "&Диагностический запуск - загрузка только основных драйверов и запуск основных служб", IDC_CBX_DIAGNOSTIC_START, "Button", 0x50010009, 20, 45, 325, 10 + CONTROL "&Выборочный запуск", IDC_CBX_SELECTIVE_STARTUP, "Button", 0x50010009, 20, 60, 100, 10 + AUTOCHECKBOX "О&брабатывать файл SYSTEM.INI", IDC_CBX_SYSTEM_INI, 30, 80, 130, 10 + AUTOCHECKBOX "&Загружать системные службы", IDC_CBX_SYSTEM_SERVICE, 30, 95, 130, 10 + AUTOCHECKBOX "З&агружать элементы автозагрузки", IDC_CBX_STARTUP_ITEM, 30, 110, 140, 10 END IDD_FREELDR_PAGE DIALOGEX DISCARDABLE 0, 0, 362, 175 @@ -80,20 +80,20 @@ STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN FONT 8, "MS Shell Dlg" BEGIN LISTBOX IDC_LIST_BOX, 10, 10, 340, 50, WS_CHILD | WS_VISIBLE | WS_TABSTOP | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL - PUSHBUTTON "& ", IDC_BTN_CHECK_BOOT_PATH, 10, 65, 110, 12 - PUSHBUTTON "& ", IDC_BTN_SET_DEFAULT_BOOT, 125, 65, 70, 12 - PUSHBUTTON "&", IDC_BTN_MOVE_UP_BOOT_OPTION, 200, 65, 70, 12 - PUSHBUTTON "&", IDC_BTN_MOVE_DOWN_BOOT_OPTION, 275, 65, 70, 12 - GROUPBOX " ", -1, 10, 80, 250, 90,0,WS_EX_TRANSPARENT + PUSHBUTTON "&Проверить все пути загрузки", IDC_BTN_CHECK_BOOT_PATH, 10, 65, 110, 12 + PUSHBUTTON "П&о умолчанию", IDC_BTN_SET_DEFAULT_BOOT, 125, 65, 70, 12 + PUSHBUTTON "&Вверх", IDC_BTN_MOVE_UP_BOOT_OPTION, 200, 65, 70, 12 + PUSHBUTTON "В&низ", IDC_BTN_MOVE_DOWN_BOOT_OPTION, 275, 65, 70, 12 + GROUPBOX "Параметры загрузки", -1, 10, 80, 250, 90,0,WS_EX_TRANSPARENT CHECKBOX "/SA&FEBOOT", IDC_CBX_SAFE_BOOT, 15, 90, 55, 10 CHECKBOX "/&NOGUIBOOT", IDC_CBX_NO_GUI_BOOT, 15, 105, 60, 10 CHECKBOX "/&BOOTLOG", IDC_CBX_BOOT_LOG, 15, 120, 50, 10 CHECKBOX "/BAS&EVIDEO", IDC_CBX_BASE_VIDEO, 15, 135, 55, 10 CHECKBOX "/S&OS", IDC_CBX_SOS, 15, 150, 50, 10 - PUSHBUTTON "&...", IDC_BTN_ADVANCED_OPTIONS, 100, 150, 70, 12 - LTEXT "&:", -1, 280, 82, 30, 10 + PUSHBUTTON "&Дополнительно...", IDC_BTN_ADVANCED_OPTIONS, 100, 150, 70, 12 + LTEXT "&Таймаут:", -1, 280, 82, 30, 10 EDITTEXT IDC_TXT_BOOT_TIMEOUT, 280, 93, 25, 12, ES_LEFT - LTEXT ".", -1, 310, 91, 15, 10 + LTEXT "сек.", -1, 310, 91, 15, 10 END IDD_FREELDR_ADVANCED_PAGE DIALOGEX DISCARDABLE 0, 0, 175, 175 @@ -118,59 +118,59 @@ BEGIN EDITTEXT IDC_TXT_CHANNEL, 80, 130, 60, 12, ES_LEFT CONTROL "",IDC_SCR_CHANNEL, "msctls_updown32", 0x50000000, 140, 130, 11, 11 PUSHBUTTON "OK", IDC_OK, 20, 160, 50, 12 - PUSHBUTTON "", IDC_CANCEL, 100, 160, 50, 12 + PUSHBUTTON "Отмена", IDC_CANCEL, 100, 160, 50, 12 END STRINGTABLE DISCARDABLE BEGIN - IDS_MSCONFIG " " - IDS_TAB_GENERAL "" + IDS_MSCONFIG "Настройка системы" + IDS_TAB_GENERAL "Общие" IDS_TAB_SYSTEM "SYSTEM.INI" IDS_TAB_FREELDR "FREELDR.INI" - IDS_TAB_SERVICES "" - IDS_TAB_STARTUP "" - IDS_TAB_TOOLS "" + IDS_TAB_SERVICES "Службы" + IDS_TAB_STARTUP "Автозагрузка" + IDS_TAB_TOOLS "Утилиты" END STRINGTABLE DISCARDABLE BEGIN - IDS_SERVICES_COLUMN_SERVICE "" - IDS_SERVICES_COLUMN_REQ "" - IDS_SERVICES_COLUMN_VENDOR "" - IDS_SERVICES_COLUMN_STATUS "" + IDS_SERVICES_COLUMN_SERVICE "Служба" + IDS_SERVICES_COLUMN_REQ "Базовая" + IDS_SERVICES_COLUMN_VENDOR "Изготовитель" + IDS_SERVICES_COLUMN_STATUS "Состояние" END STRINGTABLE DISCARDABLE BEGIN - IDS_TOOLS_COLUMN_NAME "" - IDS_TOOLS_COLUMN_DESCR "" + IDS_TOOLS_COLUMN_NAME "Название" + IDS_TOOLS_COLUMN_DESCR "Описание" - IDS_TOOLS_CMD_NAME " " + IDS_TOOLS_CMD_NAME "Командная строка" IDS_TOOLS_CMD_DESCR "" IDS_TOOLS_CMD_CMD "cmd.exe" - IDS_TOOLS_INFO_NAME " " - IDS_TOOLS_INFO_DESCR " ." + IDS_TOOLS_INFO_NAME "О программе" + IDS_TOOLS_INFO_DESCR "Показать информацию о версии." IDS_TOOLS_INFO_CMD "winver.exe" - IDS_TOOLS_REGEDIT_NAME " " - IDS_TOOLS_REGEDIT_DESCR " ." + IDS_TOOLS_REGEDIT_NAME "Редактор реестра" + IDS_TOOLS_REGEDIT_DESCR "Открытый редактор реестра." IDS_TOOLS_REGEDIT_CMD "regedit.exe" - IDS_TOOLS_SYSDM_NAME " " - IDS_TOOLS_SYSDM_DESCR " ." + IDS_TOOLS_SYSDM_NAME "Настройки системы" + IDS_TOOLS_SYSDM_DESCR "Показать информацию об этом компьютере." IDS_TOOLS_SYSDM_CMD "control.exe" IDS_TOOLS_SYSDM_PARAM "sysdm.cpl" - IDS_STARTUP_COLUMN_ELEMENT "" - IDS_STARTUP_COLUMN_CMD "" - IDS_STARTUP_COLUMN_PATH "" + IDS_STARTUP_COLUMN_ELEMENT "Элемент" + IDS_STARTUP_COLUMN_CMD "Команда" + IDS_STARTUP_COLUMN_PATH "Расположение" END STRINGTABLE DISCARDABLE BEGIN - IDS_SERVICES_STATUS_RUNNING "" - IDS_SERVICES_STATUS_STOPPED "" - IDS_SERVICES_YES "" - IDS_SERVICES_UNKNOWN "" + IDS_SERVICES_STATUS_RUNNING "Запущено" + IDS_SERVICES_STATUS_STOPPED "Остановлено" + IDS_SERVICES_YES "Да" + IDS_SERVICES_UNKNOWN "Неизвестный" END diff --git a/base/applications/msconfig/lang/uk-UA.rc b/base/applications/msconfig/lang/uk-UA.rc index 986c4ca24e4..6d8292f0884 100644 --- a/base/applications/msconfig/lang/uk-UA.rc +++ b/base/applications/msconfig/lang/uk-UA.rc @@ -12,14 +12,14 @@ IDD_MSCONFIG_DIALOG DIALOGEX DISCARDABLE 0, 0, 378, 220 STYLE DS_SHELLFONT | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME -CAPTION " " +CAPTION "Програма налаштування системи" FONT 8, "MS Shell Dlg" BEGIN CONTROL "Tab1",IDC_TAB,"SysTabControl32",WS_TABSTOP,2,2,374,195 DEFPUSHBUTTON "OK", IDOK, 211, 201, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP - PUSHBUTTON "&", IDC_BTN_HELP, 2, 201, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP - PUSHBUTTON "", IDCANCEL, 267, 201, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP - PUSHBUTTON "&", IDC_BTN_APPLY, 323, 201, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP + PUSHBUTTON "&Довідка", IDC_BTN_HELP, 2, 201, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP + PUSHBUTTON "Скасувати", IDCANCEL, 267, 201, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP + PUSHBUTTON "Заст&осувати", IDC_BTN_APPLY, 323, 201, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP END IDD_STARTUP_PAGE DIALOGEX DISCARDABLE 0, 0, 362, 175 @@ -27,8 +27,8 @@ STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN FONT 8, "MS Shell Dlg" BEGIN CONTROL "List3",IDC_STARTUP_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 2, 1, 360, 148 - PUSHBUTTON "& ",IDC_BTN_STARTUP_ACTIVATE,223,155,66,14 - PUSHBUTTON "& ",IDC_BTN_STARTUP_DEACTIVATE,295,155,66,14 + PUSHBUTTON "&Активувати все",IDC_BTN_STARTUP_ACTIVATE,223,155,66,14 + PUSHBUTTON "&Деактивувати все",IDC_BTN_STARTUP_DEACTIVATE,295,155,66,14 END IDD_SYSTEM_PAGE DIALOGEX DISCARDABLE 0, 0, 362, 175 @@ -36,18 +36,18 @@ STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN FONT 8, "MS Shell Dlg" BEGIN CONTROL "", 237, "SysTreeView32", TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_EDITLABELS | TVS_SHOWSELALWAYS | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 2, 1, 280, 148 - PUSHBUTTON "&", IDC_BTN_SYSTEM_UP, 290, 5, 66, 14 - PUSHBUTTON "&", IDC_BTN_SYSTEM_DOWN, 290, 25, 66, 14 + PUSHBUTTON "В&гору", IDC_BTN_SYSTEM_UP, 290, 5, 66, 14 + PUSHBUTTON "В&низ", IDC_BTN_SYSTEM_DOWN, 290, 25, 66, 14 - PUSHBUTTON "&", IDC_BTN_SYSTEM_ENABLE, 290, 50, 66, 14 - PUSHBUTTON "&", IDC_BTN_SYSTEM_DISABLE, 290, 70, 66, 14 + PUSHBUTTON "&Ввімкнути", IDC_BTN_SYSTEM_ENABLE, 290, 50, 66, 14 + PUSHBUTTON "В&имкнути", IDC_BTN_SYSTEM_DISABLE, 290, 70, 66, 14 - PUSHBUTTON "&", IDC_BTN_SYSTEM_FIND, 290, 95, 66, 14 - PUSHBUTTON "&", IDC_BTN_SYSTEM_NEW, 290, 115, 66, 14 - PUSHBUTTON "&", IDC_BTN_SYSTEM_EDIT, 290, 135, 66, 14 + PUSHBUTTON "&Знайти", IDC_BTN_SYSTEM_FIND, 290, 95, 66, 14 + PUSHBUTTON "&Створити", IDC_BTN_SYSTEM_NEW, 290, 115, 66, 14 + PUSHBUTTON "&Правка", IDC_BTN_SYSTEM_EDIT, 290, 135, 66, 14 - PUSHBUTTON "& ", IDC_BTN_SYSTEM_ACTIVATE, 123, 155, 66, 14 - PUSHBUTTON "& ",IDC_BTN_SYSTEM_DEACTIVATE, 195, 155, 66, 14 + PUSHBUTTON "Вв&імкнути Все", IDC_BTN_SYSTEM_ACTIVATE, 123, 155, 66, 14 + PUSHBUTTON "Ви&мкнути Все",IDC_BTN_SYSTEM_DEACTIVATE, 195, 155, 66, 14 END IDD_TOOLS_PAGE DIALOGEX DISCARDABLE 0, 0, 362, 175 @@ -56,7 +56,7 @@ FONT 8, "MS Shell Dlg" BEGIN CONTROL "List2",IDC_TOOLS_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 2, 1, 360, 134 EDITTEXT IDC_TOOLS_CMDLINE, 1, 139, 360, 12, ES_READONLY - PUSHBUTTON "&", IDC_BTN_RUN, 311, 155, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP + PUSHBUTTON "&Запустити", IDC_BTN_RUN, 311, 155, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP END IDD_SERVICES_PAGE DIALOGEX DISCARDABLE 0, 0, 362, 175 @@ -64,21 +64,21 @@ STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN FONT 8, "MS Shell Dlg" BEGIN CONTROL "List1",IDC_SERVICES_LIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP,2,1,360,148 - PUSHBUTTON "& ",IDC_BTN_SERVICES_ACTIVATE,223,155,66,14 - PUSHBUTTON "& ",IDC_BTN_SERVICES_DEACTIVATE,295,155,66,14 + PUSHBUTTON "&Активувати все",IDC_BTN_SERVICES_ACTIVATE,223,155,66,14 + PUSHBUTTON "&Деактивувати все",IDC_BTN_SERVICES_DEACTIVATE,295,155,66,14 END IDD_GENERAL_PAGE DIALOGEX DISCARDABLE 0, 0, 362, 175 STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ", -1, 10, 10, 340, 150,0,WS_EX_TRANSPARENT - CONTROL "& - ", IDC_CBX_NORMAL_START, "Button", 0x50010009, 20, 30, 232, 10 - CONTROL "& - ", IDC_CBX_DIAGNOSTIC_START, "Button", 0x50010009, 20, 45, 275, 10 - CONTROL "& ", IDC_CBX_SELECTIVE_STARTUP, "Button", 0x50010009, 20, 60, 95, 10 - AUTOCHECKBOX "& SYSTEM.INI", IDC_CBX_SYSTEM_INI, 30, 80, 110, 10 - AUTOCHECKBOX "& ", IDC_CBX_SYSTEM_SERVICE, 30, 95, 122, 10 - AUTOCHECKBOX " &", IDC_CBX_STARTUP_ITEM, 30, 110, 175, 10 + GROUPBOX "Варіанти завантаження", -1, 10, 10, 340, 150,0,WS_EX_TRANSPARENT + CONTROL "&Звичайне завантаження - завантажувати всі драйвери і служби", IDC_CBX_NORMAL_START, "Button", 0x50010009, 20, 30, 232, 10 + CONTROL "&Скорочене завантаження - зувантажувати тільки основні драйвери і служби", IDC_CBX_DIAGNOSTIC_START, "Button", 0x50010009, 20, 45, 275, 10 + CONTROL "Ви&біркове завантаження", IDC_CBX_SELECTIVE_STARTUP, "Button", 0x50010009, 20, 60, 95, 10 + AUTOCHECKBOX "Об&робляти файл SYSTEM.INI", IDC_CBX_SYSTEM_INI, 30, 80, 110, 10 + AUTOCHECKBOX "За&вантажувати системні служби", IDC_CBX_SYSTEM_SERVICE, 30, 95, 122, 10 + AUTOCHECKBOX "Завантажувати елементи &автозавантаження", IDC_CBX_STARTUP_ITEM, 30, 110, 175, 10 END IDD_FREELDR_PAGE DIALOGEX DISCARDABLE 0, 0, 362, 175 @@ -86,20 +86,20 @@ STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN FONT 8, "MS Shell Dlg" BEGIN LISTBOX IDC_LIST_BOX, 10, 10, 340, 50, WS_CHILD | WS_VISIBLE | WS_TABSTOP | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL - PUSHBUTTON "& ", IDC_BTN_CHECK_BOOT_PATH, 10, 65, 70, 12 - PUSHBUTTON "& ", IDC_BTN_SET_DEFAULT_BOOT, 92, 65, 88, 12 - PUSHBUTTON " &", IDC_BTN_MOVE_UP_BOOT_OPTION, 190, 65, 70, 12 - PUSHBUTTON " &", IDC_BTN_MOVE_DOWN_BOOT_OPTION, 280, 65, 70, 12 - GROUPBOX " ", -1, 10, 80, 250, 90,0,WS_EX_TRANSPARENT + PUSHBUTTON "&Вибрати всі шляхи", IDC_BTN_CHECK_BOOT_PATH, 10, 65, 70, 12 + PUSHBUTTON "&Встановити стандартно", IDC_BTN_SET_DEFAULT_BOOT, 92, 65, 88, 12 + PUSHBUTTON "Перемістити Вв&ерх", IDC_BTN_MOVE_UP_BOOT_OPTION, 190, 65, 70, 12 + PUSHBUTTON "Перемістити В&низ", IDC_BTN_MOVE_DOWN_BOOT_OPTION, 280, 65, 70, 12 + GROUPBOX "Варіанти завантаження", -1, 10, 80, 250, 90,0,WS_EX_TRANSPARENT CHECKBOX "/SA&FEBOOT", IDC_CBX_SAFE_BOOT, 15, 90, 55, 10 CHECKBOX "/&NOGUIBOOT", IDC_CBX_NO_GUI_BOOT, 15, 105, 60, 10 CHECKBOX "/&BOOTLOG", IDC_CBX_BOOT_LOG, 15, 120, 50, 10 CHECKBOX "/BAS&EVIDEO", IDC_CBX_BASE_VIDEO, 15, 135, 55, 10 CHECKBOX "/S&OS", IDC_CBX_SOS, 15, 150, 50, 10 - PUSHBUTTON "&...", IDC_BTN_ADVANCED_OPTIONS, 100, 150, 70, 12 - LTEXT "&:", -1, 275, 91, 33, 10 + PUSHBUTTON "Д&одатково...", IDC_BTN_ADVANCED_OPTIONS, 100, 150, 70, 12 + LTEXT "&Затримка:", -1, 275, 91, 33, 10 EDITTEXT IDC_TXT_BOOT_TIMEOUT, 310, 90, 25, 12, ES_LEFT - LTEXT ".", -1, 340, 91, 15, 10 + LTEXT "сек.", -1, 340, 91, 15, 10 END IDD_FREELDR_ADVANCED_PAGE DIALOGEX DISCARDABLE 0, 0, 175, 175 @@ -124,59 +124,59 @@ BEGIN EDITTEXT IDC_TXT_CHANNEL, 80, 130, 60, 12, ES_LEFT CONTROL "",IDC_SCR_CHANNEL, "msctls_updown32", 0x50000000, 140, 130, 11, 11 PUSHBUTTON "OK", IDC_OK, 20, 160, 50, 12 - PUSHBUTTON "", IDC_CANCEL, 100, 160, 50, 12 + PUSHBUTTON "Скасувати", IDC_CANCEL, 100, 160, 50, 12 END STRINGTABLE DISCARDABLE BEGIN - IDS_MSCONFIG " " - IDS_TAB_GENERAL "" + IDS_MSCONFIG "Програма налаштування системи" + IDS_TAB_GENERAL "Загальні" IDS_TAB_SYSTEM "SYSTEM.INI" IDS_TAB_FREELDR "FREELDR.INI" - IDS_TAB_SERVICES "" - IDS_TAB_STARTUP "" - IDS_TAB_TOOLS "" + IDS_TAB_SERVICES "Служби" + IDS_TAB_STARTUP "Автозавантаження" + IDS_TAB_TOOLS "Утиліти" END STRINGTABLE DISCARDABLE BEGIN - IDS_SERVICES_COLUMN_SERVICE "" - IDS_SERVICES_COLUMN_REQ "" - IDS_SERVICES_COLUMN_VENDOR "" - IDS_SERVICES_COLUMN_STATUS "" + IDS_SERVICES_COLUMN_SERVICE "Служба" + IDS_SERVICES_COLUMN_REQ "Вимагає" + IDS_SERVICES_COLUMN_VENDOR "Постачальник" + IDS_SERVICES_COLUMN_STATUS "Стан" END STRINGTABLE DISCARDABLE BEGIN - IDS_TOOLS_COLUMN_NAME "" - IDS_TOOLS_COLUMN_DESCR "" + IDS_TOOLS_COLUMN_NAME "Назва" + IDS_TOOLS_COLUMN_DESCR "Опис" - IDS_TOOLS_CMD_NAME "" + IDS_TOOLS_CMD_NAME "Консоль" IDS_TOOLS_CMD_DESCR "" IDS_TOOLS_CMD_CMD "cmd.exe" - IDS_TOOLS_INFO_NAME "" - IDS_TOOLS_INFO_DESCR " ." + IDS_TOOLS_INFO_NAME "Версія" + IDS_TOOLS_INFO_DESCR "Виводить інформацію про версію ОС." IDS_TOOLS_INFO_CMD "winver.exe" - IDS_TOOLS_REGEDIT_NAME " " - IDS_TOOLS_REGEDIT_DESCR " ." + IDS_TOOLS_REGEDIT_NAME "Редактор Реєстру" + IDS_TOOLS_REGEDIT_DESCR "Запускає Редактор Реєстру." IDS_TOOLS_REGEDIT_CMD "regedit.exe" - IDS_TOOLS_SYSDM_NAME " " - IDS_TOOLS_SYSDM_DESCR " '." + IDS_TOOLS_SYSDM_NAME "Властивості системи" + IDS_TOOLS_SYSDM_DESCR "Показує інформацію про комп'ютер." IDS_TOOLS_SYSDM_CMD "control.exe" IDS_TOOLS_SYSDM_PARAM "sysdm.cpl" - IDS_STARTUP_COLUMN_ELEMENT "" - IDS_STARTUP_COLUMN_CMD "" - IDS_STARTUP_COLUMN_PATH "" + IDS_STARTUP_COLUMN_ELEMENT "Елемент" + IDS_STARTUP_COLUMN_CMD "Команда" + IDS_STARTUP_COLUMN_PATH "Шлях" END STRINGTABLE DISCARDABLE BEGIN - IDS_SERVICES_STATUS_RUNNING "" - IDS_SERVICES_STATUS_STOPPED "" - IDS_SERVICES_YES "" - IDS_SERVICES_UNKNOWN "" + IDS_SERVICES_STATUS_RUNNING "Працює" + IDS_SERVICES_STATUS_STOPPED "Зупинена" + IDS_SERVICES_YES "Так" + IDS_SERVICES_UNKNOWN "Невідомо" END diff --git a/base/applications/msconfig/rsrc.rc b/base/applications/msconfig/rsrc.rc index 33276a25f42..306f1388eea 100644 --- a/base/applications/msconfig/rsrc.rc +++ b/base/applications/msconfig/rsrc.rc @@ -23,13 +23,13 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL #include "lang/nl-NL.rc" #include "lang/pt-BR.rc" #include "lang/ro-RO.rc" -#include "lang/ru-RU.rc" #include "lang/sk-SK.rc" #include "lang/sv-SE.rc" #include "lang/th-TH.rc" -#include "lang/uk-UA.rc" #include "lang/zh-CN.rc" // UTF-8 #pragma code_page(65001) #include "lang/pl-PL.rc" +#include "lang/ru-RU.rc" +#include "lang/uk-UA.rc" diff --git a/base/applications/mscutils/devmgmt/CMakeLists.txt b/base/applications/mscutils/devmgmt/CMakeLists.txt index 703c0e1dceb..394dbf65dc0 100644 --- a/base/applications/mscutils/devmgmt/CMakeLists.txt +++ b/base/applications/mscutils/devmgmt/CMakeLists.txt @@ -1,5 +1,6 @@ set_unicode() +set_rc_compiler() list(APPEND SOURCE about.c @@ -9,10 +10,9 @@ list(APPEND SOURCE misc.c devmgmt.rc) -add_executable(devmgmt ${CMAKE_CURRENT_BINARY_DIR}/devmgmt_precomp.h.gch ${SOURCE}) - -add_pch(devmgmt ${CMAKE_CURRENT_SOURCE_DIR}/precomp.h ${SOURCE}) +add_executable(devmgmt ${SOURCE}) set_module_type(devmgmt win32gui) add_importlibs(devmgmt setupapi gdi32 user32 comctl32 advapi32 devmgr msvcrt kernel32) +add_pch(devmgmt precomp.h) add_cd_file(TARGET devmgmt DESTINATION reactos/system32 FOR all) diff --git a/base/applications/mscutils/devmgmt/lang/ru-RU.rc b/base/applications/mscutils/devmgmt/lang/ru-RU.rc index de349e0bdcb..d3c0d0bbdb8 100644 --- a/base/applications/mscutils/devmgmt/lang/ru-RU.rc +++ b/base/applications/mscutils/devmgmt/lang/ru-RU.rc @@ -4,29 +4,29 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT IDR_MAINMENU MENU BEGIN - POPUP "&" + POPUP "&Файл" BEGIN - MENUITEM "&", IDC_EXIT + MENUITEM "&Выход", IDC_EXIT END - POPUP "" + POPUP "Действие" BEGIN - MENUITEM "", IDC_PRINT, GRAYED + MENUITEM "Печать", IDC_PRINT, GRAYED MENUITEM SEPARATOR - MENUITEM "", IDC_PROP, GRAYED + MENUITEM "Свойства", IDC_PROP, GRAYED MENUITEM SEPARATOR - MENUITEM "", IDC_PROGHELP, GRAYED + MENUITEM "Справка", IDC_PROGHELP, GRAYED END - POPUP "" + POPUP "Вид" BEGIN - MENUITEM " ", IDC_DEVBYTYPE, CHECKED - MENUITEM " ", IDC_STATIC, GRAYED - MENUITEM " ", IDC_STATIC, GRAYED - MENUITEM " ", IDC_STATIC, GRAYED + MENUITEM "Устройства по типу", IDC_DEVBYTYPE, CHECKED + MENUITEM "Устройства по подключению", IDC_STATIC, GRAYED + MENUITEM "Ресурсы по типу", IDC_STATIC, GRAYED + MENUITEM "Ресурсы по подключению", IDC_STATIC, GRAYED END - POPUP "" + POPUP "Справка" BEGIN - MENUITEM "", IDC_PROGHELP - MENUITEM " ", IDC_ABOUT + MENUITEM "Помощь", IDC_PROGHELP + MENUITEM "О программе", IDC_ABOUT END END @@ -34,51 +34,51 @@ IDR_POPUP MENU BEGIN POPUP "popup" BEGIN - MENUITEM "", IDC_PROP, GRAYED + MENUITEM "Свойства", IDC_PROP, GRAYED MENUITEM SEPARATOR - MENUITEM "", IDC_PROGHELP + MENUITEM "Помощь", IDC_PROGHELP END END IDD_ABOUTBOX DIALOGEX 22,16,190,182 -CAPTION " " +CAPTION "О Диспетчере устройств" FONT 8,"MS Shell Dlg",0,0 STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME BEGIN - LTEXT " v0.1\nCopyright (C) 2006\n Ged Murphy (gedmurphy@gmail.com)", IDC_STATIC, 48, 7, 130, 30 - PUSHBUTTON "", IDOK, 75, 162, 44, 15 + LTEXT "Диспетчер устройств v0.1\nCopyright (C) 2006\nот Ged Murphy (gedmurphy@gmail.com)", IDC_STATIC, 48, 7, 130, 30 + PUSHBUTTON "Закрыть", IDOK, 75, 162, 44, 15 ICON IDI_MAIN_ICON, IDC_STATIC, 10, 10, 7, 30 EDITTEXT IDC_LICENSE_EDIT, 8, 44, 174, 107, WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_READONLY | ES_MULTILINE END STRINGTABLE DISCARDABLE BEGIN - IDS_LICENSE " ; () , GNU, ; 2 , ( ) , .\r\n\r\n , , - , . GNU.\r\n\r\n GNU, , (Free Software Foundation, Inc.), 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA." + IDS_LICENSE "Эта программа является свободно распространяемой; Вы можете распространять ее повторно и (или) изменять, соблюдая условия Открытого лицензионного соглашения GNU, опубликованного Фондом свободно распространяемого программного обеспечения; либо редакции 2 Соглашения, либо (на ваше усмотрение) любой редакции, выпущенной позже.\r\n\r\nЭта программа распространяется в надежде на то, что она окажется полезной, но БЕЗ КАКИХ-ЛИБО ГАРАНТИЙ, включая подразумеваемую гарантию КАЧЕСТВА либо ПРИГОДНОСТИ ДЛЯ ОПРЕДЕЛЕННЫХ ЦЕЛЕЙ. Подробности содержатся в Открытом лицензионном соглашении GNU.\r\n\r\nВместе с этой программой должен распространяться экземпляр Открытого лицензионного соглашения GNU, если он отсутствует, сообщите об этом в Фонд свободно распространяемого программного обеспечения (Free Software Foundation, Inc.), 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA." END STRINGTABLE DISCARDABLE BEGIN - IDS_TOOLTIP_PROP "" - IDS_TOOLTIP_REFRESH "" - IDS_TOOLTIP_HELP "" - IDS_TOOLTIP_EXIT "" + IDS_TOOLTIP_PROP "Свойства" + IDS_TOOLTIP_REFRESH "Обновить" + IDS_TOOLTIP_HELP "Помощь" + IDS_TOOLTIP_EXIT "Выход" END /* Hints */ STRINGTABLE DISCARDABLE BEGIN - IDS_APPNAME " ReactOS" + IDS_APPNAME "Диспетчер устройств ReactOS" IDS_HINT_BLANK " " - IDS_HINT_EXIT " ." - IDS_HINT_REFRESH " ." - IDS_HINT_PROP " ." - IDS_HINT_HELP " ." - IDS_HINT_ABOUT " ReactOS Device Manager." + IDS_HINT_EXIT " Выход из программы." + IDS_HINT_REFRESH " Обновить список." + IDS_HINT_PROP " Открыть свойства для выбранного элемента." + IDS_HINT_HELP " Показать окно справки." + IDS_HINT_ABOUT " О ReactOS Device Manager." - IDS_HINT_SYS_RESTORE " ." - IDS_HINT_SYS_MOVE " ." - IDS_HINT_SYS_SIZE " ." - IDS_HINT_SYS_MINIMIZE " ." - IDS_HINT_SYS_MAXIMIZE " ." - IDS_HINT_SYS_CLOSE " ." + IDS_HINT_SYS_RESTORE " Востановить нормальный размер этого окна." + IDS_HINT_SYS_MOVE " Переместить это окно." + IDS_HINT_SYS_SIZE " Изменить размер этого окна." + IDS_HINT_SYS_MINIMIZE " Свернуть это окно в значок." + IDS_HINT_SYS_MAXIMIZE " Развернуть это окно на полный экран." + IDS_HINT_SYS_CLOSE " Закрыть это окно." END diff --git a/base/applications/mscutils/devmgmt/lang/uk-UA.rc b/base/applications/mscutils/devmgmt/lang/uk-UA.rc index c45a6f1e58a..aa0c1e15d1c 100644 --- a/base/applications/mscutils/devmgmt/lang/uk-UA.rc +++ b/base/applications/mscutils/devmgmt/lang/uk-UA.rc @@ -10,29 +10,29 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT IDR_MAINMENU MENU BEGIN - POPUP "&" + POPUP "&Файл" BEGIN - MENUITEM "&", IDC_EXIT + MENUITEM "В&ихід", IDC_EXIT END - POPUP "ij" + POPUP "Дія" BEGIN - MENUITEM "", IDC_PRINT, GRAYED + MENUITEM "Друк", IDC_PRINT, GRAYED MENUITEM SEPARATOR - MENUITEM "", IDC_PROP, GRAYED + MENUITEM "Властивості", IDC_PROP, GRAYED MENUITEM SEPARATOR - MENUITEM "", IDC_PROGHELP, GRAYED + MENUITEM "Довідка", IDC_PROGHELP, GRAYED END - POPUP "" + POPUP "Вигляд" BEGIN - MENUITEM " ", IDC_DEVBYTYPE, CHECKED - MENUITEM " ", IDC_STATIC, GRAYED - MENUITEM " ", IDC_STATIC, GRAYED - MENUITEM " ", IDC_STATIC, GRAYED + MENUITEM "Пристрої за типом", IDC_DEVBYTYPE, CHECKED + MENUITEM "Пристрої за підключенням", IDC_STATIC, GRAYED + MENUITEM "Ресурси за типом", IDC_STATIC, GRAYED + MENUITEM "Ресурси за підключенням", IDC_STATIC, GRAYED END - POPUP "" + POPUP "Довідка" BEGIN - MENUITEM "", IDC_PROGHELP - MENUITEM " ", IDC_ABOUT + MENUITEM "Довідка", IDC_PROGHELP + MENUITEM "Про програму", IDC_ABOUT END END @@ -40,51 +40,51 @@ IDR_POPUP MENU BEGIN POPUP "popup" BEGIN - MENUITEM "", IDC_PROP, GRAYED + MENUITEM "Властивості", IDC_PROP, GRAYED MENUITEM SEPARATOR - MENUITEM "", IDC_PROGHELP + MENUITEM "Довідка", IDC_PROGHELP END END IDD_ABOUTBOX DIALOGEX 22,16,190,182 -CAPTION " " +CAPTION "Про програму Диспетчер пристроїв" FONT 8,"MS Shell Dlg",0,0 STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME BEGIN - LTEXT " v0.1\nCopyright (C) 2006\nby Ged Murphy (gedmurphy@gmail.com)", IDC_STATIC, 48, 7, 130, 26 - PUSHBUTTON "", IDOK, 75, 162, 44, 15 + LTEXT "Диспетчер пристроїв v0.1\nCopyright (C) 2006\nby Ged Murphy (gedmurphy@gmail.com)", IDC_STATIC, 48, 7, 130, 26 + PUSHBUTTON "Закрити", IDOK, 75, 162, 44, 15 ICON IDI_MAIN_ICON, IDC_STATIC, 10, 10, 7, 30 EDITTEXT IDC_LICENSE_EDIT, 8, 44, 174, 107, WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_READONLY | ES_MULTILINE END STRINGTABLE DISCARDABLE BEGIN - IDS_LICENSE " ; , ³ GNU, ; 2 , - , .\r\n\r\n 䳿 , , - Ҳ, Ҳ Ҳ Ҳ . ³ GNU.\r\n\r\n ³ GNU. , (Free Software Foundation, Inc.), 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA." + IDS_LICENSE "Це вільне програмне забезпечення; Ви можете розповсюджувати її та змінювати, дотримуючись умови Відкритої ліцензійної угоди GNU, опублікованої Фондом вільного програмного забезпечення; або редакції 2 Угоди, або будь-якої редакції, випущеної пізніше.\r\n\r\nЦя програма розповсюджується в надії на те, що вона виявиться корисною, але БЕЗ БУДЬ-ЯКИХ ГАРАНТІЙ, включаючи УЯВНОЮ ГАРАНТІЄЮ ЯКОСТІ або ПРИДАТНОСТІ для певних цілей. Подробиці містяться у Відкритій ліцензійній угоді GNU.\r\n\r\nРазом з цією програмою повинен поширюватися примірник Відкритої ліцензійної угоди GNU. Якщо він відсутній, повідомте про це в Фонд вільного програмного забезпечення (Free Software Foundation, Inc.), 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA." END STRINGTABLE DISCARDABLE BEGIN - IDS_TOOLTIP_PROP "" - IDS_TOOLTIP_REFRESH "" - IDS_TOOLTIP_HELP "" - IDS_TOOLTIP_EXIT "" + IDS_TOOLTIP_PROP "Властивості" + IDS_TOOLTIP_REFRESH "Оновити" + IDS_TOOLTIP_HELP "Довідка" + IDS_TOOLTIP_EXIT "Вихід" END /* Hints */ STRINGTABLE DISCARDABLE BEGIN - IDS_APPNAME " ReactOS" + IDS_APPNAME "Диспетчер пристроїв ReactOS" IDS_HINT_BLANK " " - IDS_HINT_EXIT " ." - IDS_HINT_REFRESH " ." - IDS_HINT_PROP " ³ ." - IDS_HINT_HELP " ." - IDS_HINT_ABOUT " ReactOS." + IDS_HINT_EXIT " Вийти з програми." + IDS_HINT_REFRESH " Оновити список." + IDS_HINT_PROP " Відкрити властивості для вибраного елементу." + IDS_HINT_HELP " Показати вікно довідки." + IDS_HINT_ABOUT " Про Диспетчер пристроїв ReactOS." - IDS_HINT_SYS_RESTORE " ³ ." - IDS_HINT_SYS_MOVE " ." - IDS_HINT_SYS_SIZE " ." - IDS_HINT_SYS_MINIMIZE " ." - IDS_HINT_SYS_MAXIMIZE " ." - IDS_HINT_SYS_CLOSE " ." + IDS_HINT_SYS_RESTORE " Відновити вихідний розмір вікна." + IDS_HINT_SYS_MOVE " Змінити розташування вікна." + IDS_HINT_SYS_SIZE " Змінити розмір вікна." + IDS_HINT_SYS_MINIMIZE " Згорнути вікно у значок." + IDS_HINT_SYS_MAXIMIZE " Розгорнути вікно на весь екран." + IDS_HINT_SYS_CLOSE " Закрити вікно." END diff --git a/base/applications/mscutils/devmgmt/lang/zh-CN.rc b/base/applications/mscutils/devmgmt/lang/zh-CN.rc new file mode 100644 index 00000000000..8a1023fbb1d --- /dev/null +++ b/base/applications/mscutils/devmgmt/lang/zh-CN.rc @@ -0,0 +1,86 @@ +/* + * Translated by Song Fuchang (0xfc) + */ + +LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED + +IDR_MAINMENU MENU +BEGIN + POPUP "文件(&F)" + BEGIN + MENUITEM "退出(&X)", IDC_EXIT + END + POPUP "动作" + BEGIN + MENUITEM "打印", IDC_PRINT, GRAYED + MENUITEM SEPARATOR + MENUITEM "属性", IDC_PROP, GRAYED + MENUITEM SEPARATOR + MENUITEM "帮助", IDC_PROGHELP, GRAYED + END + POPUP "查看" + BEGIN + MENUITEM "设备,按类型", IDC_DEVBYTYPE, CHECKED + MENUITEM "设备,按连接", IDC_STATIC, GRAYED + MENUITEM "资源,按类型", IDC_STATIC, GRAYED + MENUITEM "资源,按连接", IDC_STATIC, GRAYED + END + POPUP "帮助" + BEGIN + MENUITEM "帮助内容", IDC_PROGHELP + MENUITEM "关于", IDC_ABOUT + END +END + +IDR_POPUP MENU +BEGIN + POPUP "popup" + BEGIN + MENUITEM "属性", IDC_PROP, GRAYED + MENUITEM SEPARATOR + MENUITEM "帮助", IDC_PROGHELP + END +END + +IDD_ABOUTBOX DIALOGEX 22,16,190,182 +CAPTION "关于设备管理器" +FONT 8,"MS Shell Dlg",0,0 +STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME +BEGIN + LTEXT "设备管理器 v0.1\版权所有 (C) 2006\n作者 Ged Murphy (gedmurphy@gmail.com)", IDC_STATIC, 48, 7, 130, 30 + PUSHBUTTON "关闭", IDOK, 75, 162, 44, 15 + ICON IDI_MAIN_ICON, IDC_STATIC, 10, 10, 7, 30 + EDITTEXT IDC_LICENSE_EDIT, 8, 44, 174, 107, WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_READONLY | ES_MULTILINE +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_LICENSE "这个程序是自由软件;你可以在自由软件基金会(FSF)的 GNU LGPL 协议下重新发布或修改它;也适用于这个协议的版本 2,或(在您看来)任何更新的版本。\r\n\r\n这个程序在希望其有用的愿望中发布,但没有任何保证;也不意味着性能保证或对某特定用途的适用性。请查看 GNU GPL 许可协议以了解更多细节。\r\n\r\n您应该已经收到了一份和这个程序一起的 GNU GPL 协议的副本;如果没有,请写信给自由软件基金会(FSF):51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA." +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_TOOLTIP_PROP "属性" + IDS_TOOLTIP_REFRESH "刷新" + IDS_TOOLTIP_HELP "帮助" + IDS_TOOLTIP_EXIT "退出" +END + +/* Hints */ +STRINGTABLE DISCARDABLE +BEGIN + IDS_APPNAME "ReactOS 设备管理器" + IDS_HINT_BLANK " " + IDS_HINT_EXIT " 退出这个程序。" + IDS_HINT_REFRESH " 刷新设备列表。" + IDS_HINT_PROP " 为当前选择项打开属性页。" + IDS_HINT_HELP " 显示帮助窗口。" + IDS_HINT_ABOUT " 关于 ReactOS 设备管理器。" + + IDS_HINT_SYS_RESTORE " 将窗口恢复到默认大小。" + IDS_HINT_SYS_MOVE " 移动这个窗口。" + IDS_HINT_SYS_SIZE " 更改这个窗口的大小。" + IDS_HINT_SYS_MINIMIZE " 将这个窗口折叠为一个图标。" + IDS_HINT_SYS_MAXIMIZE " 将这个窗口扩展到整个屏幕。" + IDS_HINT_SYS_CLOSE " 关闭这个窗口。" +END diff --git a/base/applications/mscutils/devmgmt/rsrc.rc b/base/applications/mscutils/devmgmt/rsrc.rc index 795aca772eb..f512433568f 100644 --- a/base/applications/mscutils/devmgmt/rsrc.rc +++ b/base/applications/mscutils/devmgmt/rsrc.rc @@ -24,12 +24,13 @@ IDB_EXIT BITMAP DISCARDABLE "res/exit.bmp" #include "lang/ko-KR.rc" #include "lang/no-NO.rc" #include "lang/ro-RO.rc" -#include "lang/ru-RU.rc" #include "lang/sk-SK.rc" #include "lang/sv-SE.rc" #include "lang/th-TH.rc" -#include "lang/uk-UA.rc" // UTF-8 #pragma code_page(65001) #include "lang/pl-PL.rc" +#include "lang/ru-RU.rc" +#include "lang/uk-UA.rc" +#include "lang/zh-CN.rc" diff --git a/base/applications/mscutils/eventvwr/CMakeLists.txt b/base/applications/mscutils/eventvwr/CMakeLists.txt index ca96c17e8ae..f14cc2c6794 100644 --- a/base/applications/mscutils/eventvwr/CMakeLists.txt +++ b/base/applications/mscutils/eventvwr/CMakeLists.txt @@ -1,13 +1,14 @@ set_unicode() +set_rc_compiler() add_executable(eventvwr eventvwr.c eventvwr.rc) set_module_type(eventvwr win32gui) - add_importlibs(eventvwr user32 comctl32 advapi32 msvcrt kernel32) + if(MSVC) -add_importlibs(eventvwr ntdll) + add_importlibs(eventvwr ntdll) endif() add_cd_file(TARGET eventvwr DESTINATION reactos/system32 FOR all) diff --git a/base/applications/mscutils/eventvwr/lang/ru-RU.rc b/base/applications/mscutils/eventvwr/lang/ru-RU.rc index e36da0ee26d..908468c1e37 100644 --- a/base/applications/mscutils/eventvwr/lang/ru-RU.rc +++ b/base/applications/mscutils/eventvwr/lang/ru-RU.rc @@ -10,24 +10,24 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT IDC_EVENTVWR MENU BEGIN - POPUP "&" + POPUP "&Логи" BEGIN - MENUITEM "&", ID_LOG_APPLICATION - MENUITEM "&", ID_LOG_SECURITY - MENUITEM "&", ID_LOG_SYSTEM + MENUITEM "&Приложений", ID_LOG_APPLICATION + MENUITEM "&Безопасности", ID_LOG_SECURITY + MENUITEM "&Системы", ID_LOG_SYSTEM MENUITEM SEPARATOR - MENUITEM "&", IDM_EXIT + MENUITEM "В&ыход", IDM_EXIT END - POPUP "&" + POPUP "&Вид" BEGIN - MENUITEM "&", IDM_REFRESH + MENUITEM "&Обновить", IDM_REFRESH END - MENUITEM "&", ID_OPTIONS - POPUP "&" + MENUITEM "&Настройки", ID_OPTIONS + POPUP "&Справка" BEGIN - MENUITEM "&", IDM_HELP + MENUITEM "&Помощь", IDM_HELP MENUITEM SEPARATOR - MENUITEM "& ", IDM_ABOUT + MENUITEM "&О программе", IDM_ABOUT END END @@ -39,85 +39,85 @@ END IDD_ABOUTBOX DIALOGEX 0, 0, 230, 75 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "О программе" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN ICON IDI_EVENTVWR,IDC_MYICON,14,9,21,20 - LTEXT " ReactOS. 1.0",IDC_STATIC,49,10,119,8,SS_NOPREFIX - LTEXT " () 2007 (marc.piulachs@codexchange.net)",IDC_STATIC,49,20,140,22 + LTEXT "Просмотр событий ReactOS. Версия 1.0",IDC_STATIC,49,10,119,8,SS_NOPREFIX + LTEXT "Авторские права (С) 2007 Марк Пиулачс (marc.piulachs@codexchange.net)",IDC_STATIC,49,20,140,22 DEFPUSHBUTTON "OK",IDOK,90,48,42,16,WS_GROUP END IDD_PROGRESSBOX DIALOGEX 0, 0, 230, 40 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER -CAPTION ".." +CAPTION "Подождите.." FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - CTEXT " . ...",IDC_STATIC,0,15,230,8,SS_NOPREFIX + CTEXT "Идет загрузка. Подождите ...",IDC_STATIC,0,15,230,8,SS_NOPREFIX END IDD_EVENTDETAILDIALOG DIALOGEX 0, 0, 276, 282 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_CONTEXTHELP -CAPTION " " +CAPTION "Свойства события" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - DEFPUSHBUTTON "&",IDOK,14,258,55,14 - PUSHBUTTON "&",IDPREVIOUS,78,258,55,14 - PUSHBUTTON "&",IDNEXT,142,258,55,14 - PUSHBUTTON "&",IDHELP,206,258,55,14 + DEFPUSHBUTTON "&Закрыть",IDOK,14,258,55,14 + PUSHBUTTON "&Предыдущее",IDPREVIOUS,78,258,55,14 + PUSHBUTTON "С&ледующее",IDNEXT,142,258,55,14 + PUSHBUTTON "П&омощь",IDHELP,206,258,55,14 EDITTEXT IDC_EVENTTEXTEDIT,14,81,247,108,ES_MULTILINE | ES_READONLY - LTEXT ":",IDC_STATIC,15,70,39,8 - LTEXT ":",IDC_STATIC,14,14,36,8 + LTEXT "Описание:",IDC_STATIC,15,70,39,8 + LTEXT "Дата:",IDC_STATIC,14,14,36,8 LTEXT "",IDC_EVENTDATESTATIC,68,14,72,8 - LTEXT ":",IDC_STATIC,14,27,36,8 + LTEXT "Время:",IDC_STATIC,14,27,36,8 LTEXT "",IDC_EVENTTIMESTATIC,68,27,72,8 - LTEXT ":",IDC_STATIC,14,41,50,8 + LTEXT "Пользователь:",IDC_STATIC,14,41,50,8 LTEXT "",IDC_EVENTUSERSTATIC,68,41,72,8 - LTEXT ":",IDC_STATIC,14,54,45,8 + LTEXT "Компьютер:",IDC_STATIC,14,54,45,8 LTEXT "",IDC_EVENTCOMPUTERSTATIC,68,54,72,8 - LTEXT " (ID):",IDC_STATIC,143,15,45,8 + LTEXT "Код (ID):",IDC_STATIC,143,15,45,8 LTEXT "",IDC_EVENTIDSTATIC,190,15,87,8 - LTEXT ":",IDC_STATIC,143,28,36,8 + LTEXT "Источник:",IDC_STATIC,143,28,36,8 LTEXT "",IDC_EVENTSOURCESTATIC,190,28,127,8 - LTEXT ":",IDC_STATIC,143,42,36,8 + LTEXT "Тип:",IDC_STATIC,143,42,36,8 LTEXT "",IDC_EVENTTYPESTATIC,190,42,87,8 - LTEXT ":",IDC_STATIC,143,55,38,8 + LTEXT "Категория:",IDC_STATIC,143,55,38,8 LTEXT "",IDC_EVENTCATEGORYSTATIC,190,55,87,8 EDITTEXT IDC_EVENTDATAEDIT,14,204,247,44,ES_MULTILINE | ES_READONLY - LTEXT ":",IDC_STATIC,14,192,30,8 - CONTROL "&",IDC_BYTESRADIO,"Button",BS_AUTORADIOBUTTON,49,192,34,10 - CONTROL "&",IDC_WORDRADIO,"Button",BS_AUTORADIOBUTTON,87,192,33,10 + LTEXT "Данные:",IDC_STATIC,14,192,30,8 + CONTROL "&Байты",IDC_BYTESRADIO,"Button",BS_AUTORADIOBUTTON,49,192,34,10 + CONTROL "&Слова",IDC_WORDRADIO,"Button",BS_AUTORADIOBUTTON,87,192,33,10 END STRINGTABLE BEGIN - IDS_APP_TITLE " " - IDS_EVENTSTRINGIDNOTFOUND " ( %lu ) ( %s ). , DLL ." - IDS_EVENTLOG_ERROR_TYPE "" - IDS_EVENTLOG_WARNING_TYPE "" - IDS_EVENTLOG_INFORMATION_TYPE "" - IDS_EVENTLOG_AUDIT_SUCCESS " " - IDS_EVENTLOG_AUDIT_FAILURE " " - IDS_EVENTLOG_SUCCESS "" - IDS_EVENTLOG_UNKNOWN_TYPE " " + IDS_APP_TITLE "Просмотр событий" + IDS_EVENTSTRINGIDNOTFOUND "Не найдено описание для события с кодом ( %lu ) в источнике ( %s ). Возможно, на локальном компьютере нет нужных данных в реестре или файлов DLL сообщений для отображения сообщений удаленного компьютера." + IDS_EVENTLOG_ERROR_TYPE "Ошибка" + IDS_EVENTLOG_WARNING_TYPE "Предупреждение" + IDS_EVENTLOG_INFORMATION_TYPE "Уведомление" + IDS_EVENTLOG_AUDIT_SUCCESS "Аудит успехов" + IDS_EVENTLOG_AUDIT_FAILURE "Аудит отказов" + IDS_EVENTLOG_SUCCESS "Успех" + IDS_EVENTLOG_UNKNOWN_TYPE "Неизвестное событие" END STRINGTABLE BEGIN - IDS_COLUMNTYPE "" - IDS_COLUMNDATE "" - IDS_COLUMNTIME "" - IDS_COLUMNSOURCE "" - IDS_COLUMNCATEGORY "" - IDS_COLUMNEVENT "" - IDS_COLUMNUSER "" - IDS_COLUMNCOMPUTER "" - IDS_COLUMNEVENTDATA " " + IDS_COLUMNTYPE "Тип" + IDS_COLUMNDATE "Дата" + IDS_COLUMNTIME "Время" + IDS_COLUMNSOURCE "Источник" + IDS_COLUMNCATEGORY "Категория" + IDS_COLUMNEVENT "Событие" + IDS_COLUMNUSER "Пользователь" + IDS_COLUMNCOMPUTER "Компьютер" + IDS_COLUMNEVENTDATA "Данные события" END STRINGTABLE BEGIN - IDS_NONE "" + IDS_NONE "Нету" IDS_NOT_AVAILABLE "N/A" END diff --git a/base/applications/mscutils/eventvwr/lang/uk-UA.rc b/base/applications/mscutils/eventvwr/lang/uk-UA.rc index a8faa4fac6d..a6b283b19c0 100644 --- a/base/applications/mscutils/eventvwr/lang/uk-UA.rc +++ b/base/applications/mscutils/eventvwr/lang/uk-UA.rc @@ -10,24 +10,24 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT IDC_EVENTVWR MENU BEGIN - POPUP "&" + POPUP "&Звіт" BEGIN - MENUITEM "&", ID_LOG_APPLICATION - MENUITEM "&", ID_LOG_SECURITY - MENUITEM "&", ID_LOG_SYSTEM + MENUITEM "&Програма", ID_LOG_APPLICATION + MENUITEM "&Захист", ID_LOG_SECURITY + MENUITEM "&Система", ID_LOG_SYSTEM MENUITEM SEPARATOR - MENUITEM "&", IDM_EXIT + MENUITEM "В&ихід", IDM_EXIT END - POPUP "&" + POPUP "&Вигляд" BEGIN - MENUITEM "&", IDM_REFRESH + MENUITEM "&Оновити", IDM_REFRESH END - MENUITEM "&", ID_OPTIONS - POPUP "&" + MENUITEM "&Властивості", ID_OPTIONS + POPUP "&Допомога" BEGIN - MENUITEM "&", IDM_HELP + MENUITEM "Д&опомога", IDM_HELP MENUITEM SEPARATOR - MENUITEM "&...", IDM_ABOUT + MENUITEM "&Про...", IDM_ABOUT END END @@ -39,85 +39,85 @@ END IDD_ABOUTBOX DIALOGEX 0, 0, 230, 75 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_CAPTION | WS_SYSMENU -CAPTION "..." +CAPTION "Про..." FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN ICON IDI_EVENTVWR,IDC_MYICON,14,9,21,20 - LTEXT " ReactOS 1.0",IDC_STATIC,49,10,119,8,SS_NOPREFIX + LTEXT "Оглядач подій ReactOS версії 1.0",IDC_STATIC,49,10,119,8,SS_NOPREFIX LTEXT "Copyright (C) 2007 Marc Piulachs (marc.piulachs@codexchange.net)",IDC_STATIC,49,20,119,22 DEFPUSHBUTTON "OK",IDOK,90,48,42,16,WS_GROUP END IDD_PROGRESSBOX DIALOGEX 0, 0, 230, 40 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER -CAPTION ".." +CAPTION "Зачекайте.." FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - CTEXT " . , ...",IDC_STATIC,0,15,230,8,SS_NOPREFIX + CTEXT "Завантаження Звіту подій. Будь ласка, зачекайте ...",IDC_STATIC,0,15,230,8,SS_NOPREFIX END IDD_EVENTDETAILDIALOG DIALOGEX 0, 0, 276, 282 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_CONTEXTHELP -CAPTION " 䳿" +CAPTION "Деталі події" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - DEFPUSHBUTTON "&",IDOK,12,258,50,14 - PUSHBUTTON "&",IDPREVIOUS,78,258,50,14 - PUSHBUTTON "&",IDNEXT,144,258,50,14 - PUSHBUTTON "&",IDHELP,210,258,50,14 + DEFPUSHBUTTON "&Закрити",IDOK,12,258,50,14 + PUSHBUTTON "&Попередня",IDPREVIOUS,78,258,50,14 + PUSHBUTTON "&Наступна",IDNEXT,144,258,50,14 + PUSHBUTTON "&Допомога",IDHELP,210,258,50,14 EDITTEXT IDC_EVENTTEXTEDIT,14,81,247,108,ES_MULTILINE | ES_READONLY - LTEXT "&:",IDC_STATIC,15,70,39,8 - LTEXT ":",IDC_STATIC,14,14,36,8 - LTEXT "",IDC_EVENTDATESTATIC,56,14,72,8 - LTEXT ":",IDC_STATIC,14,27,36,8 - LTEXT "",IDC_EVENTTIMESTATIC,56,27,72,8 - LTEXT "&:",IDC_STATIC,14,41,36,8 - LTEXT "",IDC_EVENTUSERSTATIC,56,41,72,8 - LTEXT "&':",IDC_STATIC,14,54,36,8 - LTEXT "",IDC_EVENTCOMPUTERSTATIC,56,54,72,8 - LTEXT ". 䳿:",IDC_STATIC,133,15,36,8 - LTEXT "",IDC_EVENTIDSTATIC,175,15,87,8 - LTEXT ":",IDC_STATIC,133,28,36,8 - LTEXT "",IDC_EVENTSOURCESTATIC,175,28,87,8 - LTEXT ":",IDC_STATIC,133,42,36,8 - LTEXT "",IDC_EVENTTYPESTATIC,175,42,87,8 - LTEXT ":",IDC_STATIC,133,55,36,8 - LTEXT "",IDC_EVENTCATEGORYSTATIC,175,55,87,8 + LTEXT "&Опис:",IDC_STATIC,15,70,39,8 + LTEXT "Дата:",IDC_STATIC,14,14,36,8 + LTEXT "Постійна",IDC_EVENTDATESTATIC,59,14,72,8 + LTEXT "Час:",IDC_STATIC,14,27,36,8 + LTEXT "Постійний",IDC_EVENTTIMESTATIC,59,27,72,8 + LTEXT "&Користувач:",IDC_STATIC,14,41,41,8 + LTEXT "Постійний",IDC_EVENTUSERSTATIC,59,41,72,8 + LTEXT "Ко&мп'ютер:",IDC_STATIC,14,54,37,8 + LTEXT "Постійний",IDC_EVENTCOMPUTERSTATIC,59,54,72,8 + LTEXT "ID Події:",IDC_STATIC,133,15,36,8 + LTEXT "Постійний",IDC_EVENTIDSTATIC,175,15,87,8 + LTEXT "Джерело:",IDC_STATIC,133,28,36,8 + LTEXT "Постійне",IDC_EVENTSOURCESTATIC,175,28,87,8 + LTEXT "Тип:",IDC_STATIC,133,42,36,8 + LTEXT "Постійний",IDC_EVENTTYPESTATIC,175,42,87,8 + LTEXT "Категорія:",IDC_STATIC,133,55,36,8 + LTEXT "Постійна",IDC_EVENTCATEGORYSTATIC,175,55,87,8 EDITTEXT IDC_EVENTDATAEDIT,14,204,247,44,ES_MULTILINE | ES_READONLY - LTEXT "&a",IDC_STATIC,14,194,20,8 - CONTROL "&",IDC_BYTESRADIO,"Button",BS_AUTORADIOBUTTON,39,194,34,10 - CONTROL "&",IDC_WORDRADIO,"Button",BS_AUTORADIOBUTTON,77,194,33,10 + LTEXT "Д&aта",IDC_STATIC,14,194,20,8 + CONTROL "&Байт",IDC_BYTESRADIO,"Button",BS_AUTORADIOBUTTON,39,194,34,10 + CONTROL "&Слово",IDC_WORDRADIO,"Button",BS_AUTORADIOBUTTON,77,194,33,10 END STRINGTABLE BEGIN - IDS_APP_TITLE " " - IDS_EVENTSTRINGIDNOTFOUND " 䳿( %lu ) ( %s ) . ' DLL , '." - IDS_EVENTLOG_ERROR_TYPE "" - IDS_EVENTLOG_WARNING_TYPE "" - IDS_EVENTLOG_INFORMATION_TYPE "" - IDS_EVENTLOG_AUDIT_SUCCESS " " - IDS_EVENTLOG_AUDIT_FAILURE " " - IDS_EVENTLOG_SUCCESS "" - IDS_EVENTLOG_UNKNOWN_TYPE " " + IDS_APP_TITLE "Оглядач подій" + IDS_EVENTSTRINGIDNOTFOUND "Опис для Ідентифікатора події( %lu ) за джерелом( %s ) не знайдено. Локальний комп'ютер може не мати необхідної інформації в реєстрі чи DLL файлів повідомлень для відображення повідомлень, що надходять від віддаленого комп'ютера." + IDS_EVENTLOG_ERROR_TYPE "Помилка" + IDS_EVENTLOG_WARNING_TYPE "Попередження" + IDS_EVENTLOG_INFORMATION_TYPE "Повідомлення" + IDS_EVENTLOG_AUDIT_SUCCESS "Аудит успіхів" + IDS_EVENTLOG_AUDIT_FAILURE "Аудит відмов" + IDS_EVENTLOG_SUCCESS "Успіх" + IDS_EVENTLOG_UNKNOWN_TYPE "Невідома подія" END STRINGTABLE BEGIN - IDS_COLUMNTYPE "" - IDS_COLUMNDATE "" - IDS_COLUMNTIME "" - IDS_COLUMNSOURCE "" - IDS_COLUMNCATEGORY "" - IDS_COLUMNEVENT "" - IDS_COLUMNUSER "" - IDS_COLUMNCOMPUTER "'" - IDS_COLUMNEVENTDATA " 䳿" + IDS_COLUMNTYPE "Тип" + IDS_COLUMNDATE "Дата" + IDS_COLUMNTIME "Час" + IDS_COLUMNSOURCE "Джерело" + IDS_COLUMNCATEGORY "Категорія" + IDS_COLUMNEVENT "Подія" + IDS_COLUMNUSER "Користувач" + IDS_COLUMNCOMPUTER "Комп'ютер" + IDS_COLUMNEVENTDATA "Дані події" END STRINGTABLE BEGIN - IDS_NONE "" + IDS_NONE "Немає" IDS_NOT_AVAILABLE "N/A" END diff --git a/base/applications/mscutils/eventvwr/lang/zh-CN.rc b/base/applications/mscutils/eventvwr/lang/zh-CN.rc new file mode 100644 index 00000000000..fbcf63791e2 --- /dev/null +++ b/base/applications/mscutils/eventvwr/lang/zh-CN.rc @@ -0,0 +1,123 @@ +/* + * PROJECT: ReactOS Event Viewer + * LICENSE: GPL - See COPYING in the top level directory + * FILE: base/applications/mscutils/eventvwr/lang/en-US.rc + * PURPOSE: Chinese Language File for ReactOS Event Viewer + * TRANSLATORS: Song Fuchang (0xfc) + */ + +LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED + +IDC_EVENTVWR MENU +BEGIN + POPUP "日志(&L)" + BEGIN + MENUITEM "应用程序日志(&A)", ID_LOG_APPLICATION + MENUITEM "安全日志(&S)", ID_LOG_SECURITY + MENUITEM "系统日志(&Y)", ID_LOG_SYSTEM + MENUITEM SEPARATOR + MENUITEM "退出(&X)", IDM_EXIT + END + POPUP "查看(&V)" + BEGIN + MENUITEM "刷新(&R)", IDM_REFRESH + END + MENUITEM "选项(&O)", ID_OPTIONS + POPUP "帮助(&H)" + BEGIN + MENUITEM "帮助内容(&E)", IDM_HELP + MENUITEM SEPARATOR + MENUITEM "关于... (&A)", IDM_ABOUT + END +END + +IDC_EVENTVWR ACCELERATORS +BEGIN + "?", IDM_ABOUT, ASCII, ALT + "/", IDM_ABOUT, ASCII, ALT +END + +IDD_ABOUTBOX DIALOGEX 0, 0, 230, 75 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_CAPTION | WS_SYSMENU +CAPTION "关于" +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + ICON IDI_EVENTVWR,IDC_MYICON,14,9,21,20 + LTEXT "ReactOS 事件查看器 版本 1.0",IDC_STATIC,49,10,119,8,SS_NOPREFIX + LTEXT "版权所有 (C) 2007 Marc Piulachs (marc.piulachs@codexchange.net)",IDC_STATIC,49,20,119,22 + DEFPUSHBUTTON "确定",IDOK,90,48,42,16,WS_GROUP +END + +IDD_PROGRESSBOX DIALOGEX 0, 0, 230, 40 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER +CAPTION "请稍候..." +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + CTEXT "正在载入日志。请稍候...",IDC_STATIC,0,15,230,8,SS_NOPREFIX +END + +IDD_EVENTDETAILDIALOG DIALOGEX 0, 0, 276, 282 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_CONTEXTHELP +CAPTION "事件详细信息" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + DEFPUSHBUTTON "关闭(&C)",IDOK,12,258,50,14 + PUSHBUTTON "上一个(&P)",IDPREVIOUS,78,258,50,14 + PUSHBUTTON "下一个(&N)",IDNEXT,144,258,50,14 + PUSHBUTTON "帮助(&H)",IDHELP,210,258,50,14 + EDITTEXT IDC_EVENTTEXTEDIT,14,81,247,108,ES_MULTILINE | ES_READONLY + LTEXT "描述(&D):",IDC_STATIC,15,70,39,8 + LTEXT "日期:",IDC_STATIC,14,14,36,8 + LTEXT "Static",IDC_EVENTDATESTATIC,56,14,72,8 + LTEXT "时间:",IDC_STATIC,14,27,36,8 + LTEXT "Static",IDC_EVENTTIMESTATIC,56,27,72,8 + LTEXT "用户(&U):",IDC_STATIC,14,41,36,8 + LTEXT "Static",IDC_EVENTUSERSTATIC,56,41,72,8 + LTEXT "计算机(&C):",IDC_STATIC,14,54,36,8 + LTEXT "Static",IDC_EVENTCOMPUTERSTATIC,56,54,72,8 + LTEXT "事件 ID:",IDC_STATIC,133,15,36,8 + LTEXT "Static",IDC_EVENTIDSTATIC,175,15,87,8 + LTEXT "来源:",IDC_STATIC,133,28,36,8 + LTEXT "Static",IDC_EVENTSOURCESTATIC,175,28,87,8 + LTEXT "类型:",IDC_STATIC,133,42,36,8 + LTEXT "Static",IDC_EVENTTYPESTATIC,175,42,87,8 + LTEXT "分类:",IDC_STATIC,133,55,36,8 + LTEXT "Static",IDC_EVENTCATEGORYSTATIC,175,55,87,8 + EDITTEXT IDC_EVENTDATAEDIT,14,204,247,44,ES_MULTILINE | ES_READONLY + LTEXT "数据(&A)",IDC_STATIC,14,194,20,8 + CONTROL "字节(&B)",IDC_BYTESRADIO,"Button",BS_AUTORADIOBUTTON,39,194,34,10 + CONTROL "字(&W)",IDC_WORDRADIO,"Button",BS_AUTORADIOBUTTON,77,194,33,10 +END + +STRINGTABLE +BEGIN + IDS_APP_TITLE "事件查看器" + IDS_EVENTSTRINGIDNOTFOUND "来源 ( %s ) 中的事件 ID ( %lu ) 的描述无法找到。本地计算机可能没有显示来自远程计算机消息所必需的注册表信息或消息 DLL 文件。" + IDS_EVENTLOG_ERROR_TYPE "错误" + IDS_EVENTLOG_WARNING_TYPE "警告" + IDS_EVENTLOG_INFORMATION_TYPE "信息" + IDS_EVENTLOG_AUDIT_SUCCESS "审核成功" + IDS_EVENTLOG_AUDIT_FAILURE "审核失败" + IDS_EVENTLOG_SUCCESS "成功" + IDS_EVENTLOG_UNKNOWN_TYPE "未知事件" +END + +STRINGTABLE +BEGIN + IDS_COLUMNTYPE "类型" + IDS_COLUMNDATE "日期" + IDS_COLUMNTIME "时间" + IDS_COLUMNSOURCE "来源" + IDS_COLUMNCATEGORY "分类" + IDS_COLUMNEVENT "事件" + IDS_COLUMNUSER "用户" + IDS_COLUMNCOMPUTER "计算机" + IDS_COLUMNEVENTDATA "事件数据" +END + +STRINGTABLE +BEGIN + IDS_NONE "无" + IDS_NOT_AVAILABLE "不可用" +END diff --git a/base/applications/mscutils/eventvwr/rsrc.rc b/base/applications/mscutils/eventvwr/rsrc.rc index 1e81bbfa7ee..512cd86e4ba 100644 --- a/base/applications/mscutils/eventvwr/rsrc.rc +++ b/base/applications/mscutils/eventvwr/rsrc.rc @@ -20,11 +20,12 @@ IDI_ERRORICON ICON "res/error.ico" #include "lang/ko-KR.rc" #include "lang/no-NO.rc" #include "lang/ro-RO.rc" -#include "lang/ru-RU.rc" #include "lang/sk-SK.rc" #include "lang/sv-SE.rc" -#include "lang/uk-UA.rc" // UTF-8 #pragma code_page(65001) #include "lang/pl-PL.rc" +#include "lang/ru-RU.rc" +#include "lang/uk-UA.rc" +#include "lang/zh-CN.rc" diff --git a/base/applications/mscutils/servman/CMakeLists.txt b/base/applications/mscutils/servman/CMakeLists.txt index 87bd84b08d1..2a7bd6b0467 100644 --- a/base/applications/mscutils/servman/CMakeLists.txt +++ b/base/applications/mscutils/servman/CMakeLists.txt @@ -24,12 +24,12 @@ list(APPEND SOURCE stop_dependencies.c servman.rc) -add_executable(servman ${CMAKE_CURRENT_BINARY_DIR}/servman_precomp.h.gch ${SOURCE}) - -add_pch(servman ${CMAKE_CURRENT_SOURCE_DIR}/precomp.h ${SOURCE}) +add_executable(servman ${SOURCE}) set_module_type(servman win32gui) add_importlibs(servman user32 gdi32 advapi32 version comctl32 shell32 comdlg32 msvcrt kernel32) +add_pch(servman precomp.h) + add_cd_file(TARGET servman DESTINATION reactos/system32 FOR all) diff --git a/base/applications/mscutils/servman/lang/pl-PL.rc b/base/applications/mscutils/servman/lang/pl-PL.rc index 769fa099e51..ca01dea688a 100644 --- a/base/applications/mscutils/servman/lang/pl-PL.rc +++ b/base/applications/mscutils/servman/lang/pl-PL.rc @@ -4,7 +4,7 @@ * https://sourceforge.net/projects/reactospl * * updated by Caemyr - Olaf Siejka (Jan, 2008) - * updated by Saibamen - Adam Stachowicz (saibamenppl@gmail.com) (Apr, 2011) + * updated by Saibamen - Adam Stachowicz (saibamenppl@gmail.com) (August, 2011) * UTF-8 conversion by Caemyr (May, 2011) */ @@ -99,10 +99,10 @@ BEGIN PUSHBUTTON "Wznów", IDC_PAUSE , 130, 155, 54, 15, WS_DISABLED PUSHBUTTON "Uruchom ponownie", IDC_RESUME, 192, 155, 54, 15, WS_DISABLED LTEXT "Nazwa usługi:", IDC_STATIC, 4, 11, 53, 11 - LTEXT "Nazwa wyświetlana:", IDC_STATIC, 4, 29, 53, 11 + LTEXT "Nazwa wyświetlana:", IDC_STATIC, 4, 29, 65, 11 LTEXT "Opis:", IDC_STATIC, 4, 51, 53, 11 LTEXT "Ścieżka do aplikacji", IDC_STATIC, 6, 73, 82, 9 - LTEXT "Typ uruchomienia:", IDC_STATIC, 6, 108, 53, 11 + LTEXT "Typ uruchomienia:", IDC_STATIC, 6, 108, 59, 11 LTEXT "Stan usługi:", IDC_STATIC, 4, 138, 53, 11 LTEXT "", IDC_SERV_STATUS, 70, 138, 176, 11, WS_CHILD | WS_VISIBLE LTEXT "Możesz określić parametry początkowe, które będą użyte przy uruchomieniu usługi z tego miejsca.",IDC_STATIC, 6,177,240,15 @@ -138,7 +138,7 @@ BEGIN LTEXT "Opis", IDC_STATIC, 12, 86, 44, 9 PUSHBUTTON "OK", IDOK, 126, 192, 44, 13 PUSHBUTTON "Anuluj", IDCANCEL, 176, 192, 46, 13 - LTEXT "Dodatkowe opcje (kliknij Pomoc, aby zobaczyć szczegóły)", IDC_STATIC, 10, 151, 134, 9 + LTEXT "Dodatkowe opcje (kliknij Pomoc, aby zobaczyć szczegóły)", IDC_STATIC, 10, 151, 184, 9 PUSHBUTTON "Pomoc", ID_CREATE_HELP, 10, 192, 44, 13 END @@ -156,6 +156,19 @@ BEGIN PUSHBUTTON "Nie", IDCANCEL, 102, 129, 54, 13 END +IDD_DLG_DEPEND_STOP DIALOGEX 6,6,240,148 +CAPTION "Zatrzymaj inne usługi" +FONT 8, "MS Shell Dlg",0,0 +STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | DS_MODALFRAME +BEGIN + ICON IDI_WARNING, IDC_STATIC, 10, 8, 24, 22 + LTEXT "", IDC_STOP_DEPENDS, 40, 8, 170, 25 + LISTBOX IDC_STOP_DEPENDS_LB, 15, 40, 210, 70, WS_CHILD | WS_VISIBLE | WS_EX_STATICEDGE | LBS_NOSEL + LTEXT "Czy chcesz zatrzymać te usługi?",IDC_STATIC, 15, 110, 150, 10 + DEFPUSHBUTTON "Tak", IDOK, 60, 129, 54, 14 + PUSHBUTTON "Nie", IDCANCEL, 120, 129, 54, 14 +END + IDD_DLG_HELP_OPTIONS DIALOGEX 6,6,200,150 CAPTION "Opcje" FONT 8, "MS Shell Dlg",0,0 @@ -177,8 +190,6 @@ BEGIN PUSHBUTTON "&Zamknij", IDOK, 100, 70, 54, 13 END - - STRINGTABLE DISCARDABLE BEGIN IDS_FIRSTCOLUMN "Nazwa" @@ -222,6 +233,8 @@ STRINGTABLE DISCARDABLE BEGIN IDS_PROGRESS_INFO_START "ReactOS usiłuje uruchomić następującą usługę" IDS_PROGRESS_INFO_STOP "ReactOS usiłuje zatrzymać następującą usługę" + IDS_PROGRESS_INFO_PAUSE "ReactOS usiłuje wstrzymać następującą usługę" + IDS_PROGRESS_INFO_RESUME "ReactOS usiłuje wznowić następującą usługę" IDS_CREATE_SUCCESS "Usługa utworzona pomyślnie" IDS_DELETE_SUCCESS "Usługa skasowana pomyślnie" IDS_CREATE_REQ "Pola oznaczone gwiazdkami\nsą obowiązkowe" diff --git a/base/applications/mscutils/servman/lang/ro-RO.rc b/base/applications/mscutils/servman/lang/ro-RO.rc index fd87ba4b584..7eedbe3e2ad 100644 --- a/base/applications/mscutils/servman/lang/ro-RO.rc +++ b/base/applications/mscutils/servman/lang/ro-RO.rc @@ -280,5 +280,3 @@ STRINGTABLE DISCARDABLE BEGIN IDS_APPNAME "Gestionarul de servicii ReactOS" END - -#pragma code_page(default) diff --git a/base/applications/mscutils/servman/lang/ru-RU.rc b/base/applications/mscutils/servman/lang/ru-RU.rc index 026f8215a27..c76f6ce4bd5 100644 --- a/base/applications/mscutils/servman/lang/ru-RU.rc +++ b/base/applications/mscutils/servman/lang/ru-RU.rc @@ -2,79 +2,79 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT IDR_MAINMENU MENU BEGIN - POPUP "&" + POPUP "&Файл" BEGIN - MENUITEM "&...", ID_EXPORT + MENUITEM "&Экспорт...", ID_EXPORT MENUITEM SEPARATOR - MENUITEM "&", ID_EXIT + MENUITEM "&Выход", ID_EXIT END - POPUP "" + POPUP "Действие" BEGIN - MENUITEM " ...", ID_CONNECT, GRAYED + MENUITEM "Соединение с...", ID_CONNECT, GRAYED MENUITEM SEPARATOR - MENUITEM "", ID_START, GRAYED - MENUITEM "", ID_STOP, GRAYED - MENUITEM "", ID_PAUSE, GRAYED - MENUITEM "", ID_RESUME, GRAYED - MENUITEM "", ID_RESTART, GRAYED + MENUITEM "Пуск", ID_START, GRAYED + MENUITEM "Стоп", ID_STOP, GRAYED + MENUITEM "Пауза", ID_PAUSE, GRAYED + MENUITEM "Продолжить", ID_RESUME, GRAYED + MENUITEM "Перезапуск", ID_RESTART, GRAYED MENUITEM SEPARATOR - MENUITEM "", ID_REFRESH + MENUITEM "Обновить", ID_REFRESH MENUITEM SEPARATOR - MENUITEM "...", ID_EDIT, GRAYED - MENUITEM "...", ID_CREATE, GRAYED - MENUITEM "...", ID_DELETE, GRAYED + MENUITEM "Изменить...", ID_EDIT, GRAYED + MENUITEM "Создать...", ID_CREATE, GRAYED + MENUITEM "Удалить...", ID_DELETE, GRAYED MENUITEM SEPARATOR - MENUITEM "...", ID_PROP, GRAYED + MENUITEM "Свойства...", ID_PROP, GRAYED END - POPUP "" + POPUP "Вид" BEGIN - MENUITEM "", ID_VIEW_LARGE - MENUITEM "", ID_VIEW_SMALL - MENUITEM "", ID_VIEW_LIST - MENUITEM "", ID_VIEW_DETAILS + MENUITEM "Крупные", ID_VIEW_LARGE + MENUITEM "Мелкие", ID_VIEW_SMALL + MENUITEM "Список", ID_VIEW_LIST + MENUITEM "Таблица", ID_VIEW_DETAILS MENUITEM SEPARATOR - MENUITEM "...",ID_VIEW_CUST, GRAYED + MENUITEM "Настроить...",ID_VIEW_CUST, GRAYED END - POPUP "" + POPUP "Справка" BEGIN - MENUITEM "", ID_HELP - MENUITEM " ", ID_ABOUT + MENUITEM "Содержание", ID_HELP + MENUITEM "О программе", ID_ABOUT END END IDR_POPUP MENU BEGIN POPUP "popup" BEGIN - MENUITEM "", ID_START, GRAYED - MENUITEM "", ID_STOP, GRAYED - MENUITEM "", ID_PAUSE, GRAYED - MENUITEM "", ID_RESUME, GRAYED - MENUITEM "", ID_RESTART, GRAYED + MENUITEM "Пуск", ID_START, GRAYED + MENUITEM "Стоп", ID_STOP, GRAYED + MENUITEM "Пауза", ID_PAUSE, GRAYED + MENUITEM "Продолжить", ID_RESUME, GRAYED + MENUITEM "Перезапуск", ID_RESTART, GRAYED MENUITEM SEPARATOR - MENUITEM "", ID_REFRESH + MENUITEM "Обновить", ID_REFRESH MENUITEM SEPARATOR - MENUITEM "...", ID_EDIT, GRAYED - MENUITEM "...", ID_DELETE, GRAYED + MENUITEM "Изменить...", ID_EDIT, GRAYED + MENUITEM "Удалить...", ID_DELETE, GRAYED MENUITEM SEPARATOR - MENUITEM "...", ID_PROP, GRAYED + MENUITEM "Свойства...", ID_PROP, GRAYED MENUITEM SEPARATOR - MENUITEM "...", ID_HELP + MENUITEM "Справка...", ID_HELP END END IDD_ABOUTBOX DIALOGEX 22,16,190,182 -CAPTION " " +CAPTION "О Диспетчере служб" FONT 8, "MS Shell Dlg",0,0 STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME BEGIN - LTEXT " v0.8\n (C) 2005-2007\n (gedmurphy@reactos.org)", IDC_STATIC, 48, 7, 135, 32 - PUSHBUTTON "", IDOK, 75, 162, 44, 15 + LTEXT "Диспетчер служб v0.8\nАвторское право (C) 2005-2007\nГед Мерфи (gedmurphy@reactos.org)", IDC_STATIC, 48, 7, 135, 32 + PUSHBUTTON "Закрыть", IDOK, 75, 162, 44, 15 ICON IDI_SM_ICON, IDC_STATIC, 10, 10, 7, 30 EDITTEXT IDC_LICENSE_EDIT, 8, 44, 174, 107, WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_READONLY | ES_MULTILINE END IDD_DLG_GENERAL DIALOGEX 6,6,253,232 -CAPTION "" +CAPTION "Общие" FONT 8, "MS Shell Dlg",0,0 STYLE DS_SHELLFONT | WS_BORDER | WS_VISIBLE | WS_DLGFRAME | WS_SYSMENU | WS_THICKFRAME | WS_GROUP | WS_TABSTOP BEGIN @@ -83,37 +83,37 @@ BEGIN EDITTEXT IDC_DESCRIPTION, 78, 46, 167, 24, WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_MULTILINE | ES_READONLY EDITTEXT IDC_EXEPATH, 6, 86, 240, 11, WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_READONLY COMBOBOX IDC_START_TYPE, 78, 107, 168, 40, WS_CHILD | WS_VISIBLE | WS_TABSTOP | CBS_DROPDOWNLIST - PUSHBUTTON "", IDC_START, 6, 155, 54, 15, WS_DISABLED - PUSHBUTTON "", IDC_STOP, 68, 155, 54, 15, WS_DISABLED - PUSHBUTTON "", IDC_PAUSE , 130, 155, 54, 15, WS_DISABLED - PUSHBUTTON "", IDC_RESUME, 192, 155, 54, 15, WS_DISABLED - LTEXT " :", IDC_STATIC, 6, 11, 53, 11 - LTEXT " :", IDC_STATIC, 6, 29, 63, 11 - LTEXT ":", IDC_STATIC, 6, 47, 53, 11 - LTEXT " :", IDC_STATIC, 6, 75, 82, 9 - LTEXT " :", IDC_STATIC, 6, 108, 53, 11 - LTEXT ":", IDC_STATIC, 6, 138, 53, 11 + PUSHBUTTON "Пуск", IDC_START, 6, 155, 54, 15, WS_DISABLED + PUSHBUTTON "Стоп", IDC_STOP, 68, 155, 54, 15, WS_DISABLED + PUSHBUTTON "Пауза", IDC_PAUSE , 130, 155, 54, 15, WS_DISABLED + PUSHBUTTON "Продолжить", IDC_RESUME, 192, 155, 54, 15, WS_DISABLED + LTEXT "Имя службы:", IDC_STATIC, 6, 11, 53, 11 + LTEXT "Выводимое имя:", IDC_STATIC, 6, 29, 63, 11 + LTEXT "Описание:", IDC_STATIC, 6, 47, 53, 11 + LTEXT "Исполняемый файл:", IDC_STATIC, 6, 75, 82, 9 + LTEXT "Тип запуска:", IDC_STATIC, 6, 108, 53, 11 + LTEXT "Состояние:", IDC_STATIC, 6, 138, 53, 11 LTEXT "", IDC_SERV_STATUS, 78, 138, 176, 11, WS_CHILD | WS_VISIBLE - LTEXT " , .",IDC_STATIC, 6,177,240,15 - LTEXT " :", IDC_STATIC, 6, 200, 73, 11 + LTEXT "Можно указать параметры запуска, применяемые при запуске службы из этого каталога.",IDC_STATIC, 6,177,240,15 + LTEXT "Параметры запуска:", IDC_STATIC, 6, 200, 73, 11 EDITTEXT IDC_START_PARAM, 78, 199, 168, 11, WS_CHILD | WS_VISIBLE | WS_TABSTOP - PUSHBUTTON "", IDC_EDIT, 192, 215, 54, 15, WS_DISABLED + PUSHBUTTON "Изменить", IDC_EDIT, 192, 215, 54, 15, WS_DISABLED END IDD_DLG_DEPEND DIALOGEX 6,6,253,225 -CAPTION "" +CAPTION "Зависимости" FONT 8, "MS Shell Dlg",0,0 STYLE DS_SHELLFONT | WS_BORDER | WS_VISIBLE | WS_DLGFRAME | WS_SYSMENU | WS_THICKFRAME | WS_GROUP | WS_TABSTOP BEGIN CONTROL "", IDC_DEPEND_TREE1, "SysTreeView32" , WS_BORDER | WS_CHILDWINDOW | WS_VISIBLE | WS_TABSTOP | TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_DISABLEDRAGDROP, 8, 70, 236, 68 CONTROL "", IDC_DEPEND_TREE2, "SysTreeView32", WS_BORDER | WS_CHILDWINDOW | WS_VISIBLE | WS_TABSTOP | TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_DISABLEDRAGDROP, 8, 151, 234, 67 - LTEXT " . , .", IDC_STATIC,8, 7, 238, 26 - LTEXT " :", IDC_STATIC, 8, 59, 236, 9 + LTEXT "Некоторые службы зависят от других. Если служба остановлена или неправильно работает, это отражается на зависимых от нее службах.", IDC_STATIC,8, 7, 238, 26 + LTEXT "Эта служба зависит от следующих компонентов:", IDC_STATIC, 8, 59, 236, 9 LTEXT "", IDC_DEPEND_SERVICE, 8, 38, 236, 13 END IDD_DLG_CREATE DIALOGEX 6,6,225,209 -CAPTION " " +CAPTION "Создать службу" FONT 8, "MS Shell Dlg",0,0 STYLE DS_SHELLFONT | WS_BORDER | WS_VISIBLE | WS_DLGFRAME | WS_SYSMENU | WS_THICKFRAME | WS_GROUP | WS_TABSTOP BEGIN @@ -122,32 +122,32 @@ BEGIN EDITTEXT IDC_CREATE_PATH, 8, 62, 214, 14, WS_CHILD | WS_VISIBLE EDITTEXT IDC_CREATE_DESC, 8, 97, 210, 48, WS_CHILD | WS_VISIBLE EDITTEXT IDC_CREATE_OPTIONS, 8, 162, 210, 14, WS_CHILD | WS_VISIBLE - LTEXT "* :", IDC_STATIC, 8, 12, 59, 9 - LTEXT "* :", IDC_STATIC, 8, 33, 78, 9 - LTEXT "* :", IDC_STATIC, 8, 51, 96, 9 - LTEXT ":", IDC_STATIC, 8, 86, 58, 9 + LTEXT "*Имя службы:", IDC_STATIC, 8, 12, 59, 9 + LTEXT "*Отображаемое имя:", IDC_STATIC, 8, 33, 78, 9 + LTEXT "*Исполняемый файл:", IDC_STATIC, 8, 51, 96, 9 + LTEXT "Описание:", IDC_STATIC, 8, 86, 58, 9 PUSHBUTTON "OK", IDOK, 126, 192, 44, 14 - PUSHBUTTON "", IDCANCEL, 176, 192, 46, 14 - LTEXT " ( """" )", IDC_STATIC, 8, 151, 206, 9 - PUSHBUTTON "", ID_CREATE_HELP, 8, 192, 44, 14 + PUSHBUTTON "Отмена", IDCANCEL, 176, 192, 46, 14 + LTEXT "Дополнително (нажмите ""Справка"" для уточнения)", IDC_STATIC, 8, 151, 206, 9 + PUSHBUTTON "Справка", ID_CREATE_HELP, 8, 192, 44, 14 END IDD_DLG_DELETE DIALOGEX 6,6,185,148 -CAPTION " " +CAPTION "Удалить службу" FONT 8, "MS Shell Dlg",0,0 STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | DS_MODALFRAME BEGIN ICON IDI_WARNING, IDC_STATIC, 10, 8, 24, 22 - LTEXT " , ? !", IDC_STATIC, 50, 6, 125, 25 - LTEXT " :",IDC_STATIC, 6, 40, 80, 9 + LTEXT "Вы уверены, что хотите удалить выбранную службу? Вы не сможете востановить ее после удаления!", IDC_STATIC, 50, 6, 125, 25 + LTEXT "Имя службы:",IDC_STATIC, 6, 40, 80, 9 LTEXT "", IDC_DEL_NAME, 15, 53, 160, 15 EDITTEXT IDC_DEL_DESC, 6, 73, 174, 48, WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_EX_STATICEDGE | ES_MULTILINE | ES_READONLY - PUSHBUTTON "", IDOK, 26, 129, 54, 13 - DEFPUSHBUTTON "", IDCANCEL, 102, 129, 54, 13 + PUSHBUTTON "Да", IDOK, 26, 129, 54, 13 + DEFPUSHBUTTON "Нет", IDCANCEL, 102, 129, 54, 13 END IDD_DLG_HELP_OPTIONS DIALOGEX 6,6,200,150 -CAPTION "" +CAPTION "Настройки" FONT 8, "MS Shell Dlg",0,0 STYLE 0x10CF0000 BEGIN @@ -156,7 +156,7 @@ BEGIN END IDD_DLG_PROGRESS DIALOGEX 6,6,255,89 -CAPTION " " +CAPTION "Управление службами" FONT 8, "MS Shell Dlg",0,0 STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | WS_VISIBLE | DS_MODALFRAME EXSTYLE WS_EX_TOOLWINDOW @@ -164,105 +164,105 @@ BEGIN CONTROL "",IDC_SERVCON_PROGRESS,"msctls_progress32",0x50000000,8,46,238,13 LTEXT "", IDC_SERVCON_INFO, 8, 5, 236, 11 LTEXT "", IDC_SERVCON_NAME, 8, 25, 66, 11 - PUSHBUTTON "&", IDOK, 100, 70, 54, 13 + PUSHBUTTON "&Закрыть", IDOK, 100, 70, 54, 13 END STRINGTABLE DISCARDABLE BEGIN - IDS_FIRSTCOLUMN "" - IDS_SECONDCOLUMN "" - IDS_THIRDCOLUMN "" - IDS_FOURTHCOLUMN " " - IDS_FITHCOLUMN " " + IDS_FIRSTCOLUMN "Имя" + IDS_SECONDCOLUMN "Описание" + IDS_THIRDCOLUMN "Состояние" + IDS_FOURTHCOLUMN "Тип запуска" + IDS_FITHCOLUMN "Вход от имени" END STRINGTABLE DISCARDABLE BEGIN - IDS_SERVICES_STARTED "" - IDS_SERVICES_STOPPED "" - IDS_SERVICES_AUTO "" - IDS_SERVICES_MAN "" - IDS_SERVICES_DIS "" + IDS_SERVICES_STARTED "Работает" + IDS_SERVICES_STOPPED "Остановлено" + IDS_SERVICES_AUTO "Авто" + IDS_SERVICES_MAN "Вручную" + IDS_SERVICES_DIS "Отключено" END STRINGTABLE DISCARDABLE BEGIN - IDS_NUM_SERVICES " : %d" + IDS_NUM_SERVICES "Номер службы: %d" IDS_STOP_DEPENDS "When %s stops, these other services will also stop" IDS_NO_DEPENDS "" - IDS_LICENSE " ; / GNU General Public License 2 , Free Software Foundation.\r\n\r\n , , ; . . GNU General Public License .\r\n\r\n GNU , Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA." + IDS_LICENSE "Эта программа является свободным программным обеспечением; Вы можете распространять и/или изменять ее в соответствии с лицензией GNU General Public License версии 2 или более поздней, опубликованной Free Software Foundation.\r\n\r\nЭта программа распространяется с надеждой, что она может быть полезна, но БЕЗ ВСЯКОЙ ГАРАНТИИ; не подразумевается даже РАБОТОСПОСОБНОСТЬ или ПРИГОДНОСТЬ ДЛЯ ВЫПОЛНЕНИЯ НЕОБХОДИМЫХ ЗАДАЧ. См. GNU General Public License для получения дополнительных сведений.\r\n\r\nВы должны получить копию лицензии GNU вместе с этой программой, в противном случае обращайтесь в Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA." END STRINGTABLE DISCARDABLE BEGIN - IDS_TOOLTIP_PROP "" - IDS_TOOLTIP_REFRESH "" - IDS_TOOLTIP_EXPORT " " - IDS_TOOLTIP_CREATE " " - IDS_TOOLTIP_DELETE " " - IDS_TOOLTIP_START " " - IDS_TOOLTIP_STOP " " - IDS_TOOLTIP_PAUSE " " - IDS_TOOLTIP_RESTART " " + IDS_TOOLTIP_PROP "Свойства" + IDS_TOOLTIP_REFRESH "Обновить" + IDS_TOOLTIP_EXPORT "Экспортировать список" + IDS_TOOLTIP_CREATE "Создание новой службы" + IDS_TOOLTIP_DELETE "Удаление существующей службы" + IDS_TOOLTIP_START "Запустить службу" + IDS_TOOLTIP_STOP "Остановить службу" + IDS_TOOLTIP_PAUSE "Приостановить службу" + IDS_TOOLTIP_RESTART "Перезапуск службы" END STRINGTABLE DISCARDABLE BEGIN - IDS_PROGRESS_INFO_START "ReactOS " - IDS_PROGRESS_INFO_STOP "ReactOS " - IDS_PROGRESS_INFO_PAUSE "ReactOS " - IDS_PROGRESS_INFO_RESUME "ReactOS " - IDS_CREATE_SUCCESS " " - IDS_DELETE_SUCCESS " " - IDS_CREATE_REQ "* = " - IDS_DELETE_STOP " !" + IDS_PROGRESS_INFO_START "ReactOS запускает службу" + IDS_PROGRESS_INFO_STOP "ReactOS остановливает службу" + IDS_PROGRESS_INFO_PAUSE "ReactOS останавливает следующие службы" + IDS_PROGRESS_INFO_RESUME "ReactOS возобновляет работу следующих служб" + IDS_CREATE_SUCCESS "Создание службы успешно завершено" + IDS_DELETE_SUCCESS "Удаление службы успешно завершено" + IDS_CREATE_REQ "* = обязательные поля" + IDS_DELETE_STOP "Вы должны вручную остановить службу перед удалением!" END STRINGTABLE DISCARDABLE BEGIN - IDS_HELP_OPTIONS " :\r\n: """".\r\n type= \r\n ( = own)\r\n start= \r\n ( = demand) \r\n error= \r\n ( = normal)\r\n group= \r\n tag= \r\n depend= \r\n obj= \r\n ( = LocalSystem)\r\n password= \r\n" + IDS_HELP_OPTIONS "ОПЦИИ СОЗДАНИЯ:\r\nПримечание: Имя опции включает знак ""равно"".\r\n type= \r\n (по умолчанию = own)\r\n start= \r\n (по умолчанию = demand) \r\n error= \r\n (по умолчанию = normal)\r\n group= \r\n tag= \r\n depend= \r\n obj= \r\n (по умолчанию = LocalSystem)\r\n password= \r\n" END /* Hints */ STRINGTABLE DISCARDABLE BEGIN IDS_HINT_BLANK " " - IDS_HINT_EXPORT " ." - IDS_HINT_EXIT " ." + IDS_HINT_EXPORT " Экспорт текущего списка в файл." + IDS_HINT_EXIT " Выход из программы." - IDS_HINT_CONNECT " ." - IDS_HINT_START " ." - IDS_HINT_STOP " ." - IDS_HINT_PAUSE " ." - IDS_HINT_RESUME " ." - IDS_HINT_RESTART " ." - IDS_HINT_REFRESH " ." - IDS_HINT_EDIT " ." - IDS_HINT_CREATE " ." - IDS_HINT_DELETE " ." - IDS_HINT_PROP " ." + IDS_HINT_CONNECT " Управление другими компьютерами." + IDS_HINT_START " Запустить выбранную службу." + IDS_HINT_STOP " Остановить выбранную службу." + IDS_HINT_PAUSE " Приостановить выбранную службу." + IDS_HINT_RESUME " Продолжить выбранную службу." + IDS_HINT_RESTART " Перезапуск выбранной службы." + IDS_HINT_REFRESH " Обновить список служб." + IDS_HINT_EDIT " Изменить свойства выбранной службы." + IDS_HINT_CREATE " Создать новую службу." + IDS_HINT_DELETE " Удалить выбранную службу." + IDS_HINT_PROP " Открыть список свойств для выделенного элемента." - IDS_HINT_LARGE " ." - IDS_HINT_SMALL " ." - IDS_HINT_LIST " ." - IDS_HINT_DETAILS " ." - IDS_HINT_CUST " ." + IDS_HINT_LARGE " Отображать элементы в виде больших значков." + IDS_HINT_SMALL " Отображать элементы в виде маленьких значков." + IDS_HINT_LIST " Отображать элементы в виде списка." + IDS_HINT_DETAILS " Отображение информации о каждом элементе в окне." + IDS_HINT_CUST " Настройка вида." - IDS_HINT_HELP " ." - IDS_HINT_ABOUT " ReactOS." + IDS_HINT_HELP " Показать окно справки." + IDS_HINT_ABOUT " О Диспетчере служб ReactOS." - IDS_HINT_SYS_RESTORE " ." - IDS_HINT_SYS_MOVE " ." - IDS_HINT_SYS_SIZE " ." - IDS_HINT_SYS_MINIMIZE " ." - IDS_HINT_SYS_MAXIMIZE " ." - IDS_HINT_SYS_CLOSE " ." + IDS_HINT_SYS_RESTORE " Востановить нормальный размер окна." + IDS_HINT_SYS_MOVE " Переместить это окно." + IDS_HINT_SYS_SIZE " Изменить размер этого окна." + IDS_HINT_SYS_MINIMIZE " Сворачивание окна в значок." + IDS_HINT_SYS_MAXIMIZE " Развернуть это окно на полный экран." + IDS_HINT_SYS_CLOSE " Закрыть это окно." END /* Application title */ STRINGTABLE DISCARDABLE BEGIN - IDS_APPNAME " ReactOS" + IDS_APPNAME "Диспетчер служб ReactOS" END diff --git a/base/applications/mscutils/servman/lang/uk-UA.rc b/base/applications/mscutils/servman/lang/uk-UA.rc index a2b847d62b8..c991a731c2c 100644 --- a/base/applications/mscutils/servman/lang/uk-UA.rc +++ b/base/applications/mscutils/servman/lang/uk-UA.rc @@ -10,43 +10,43 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT IDR_MAINMENU MENU BEGIN - POPUP "&" + POPUP "&Файл" BEGIN - MENUITEM "&...", ID_EXPORT + MENUITEM "&Експорт...", ID_EXPORT MENUITEM SEPARATOR - MENUITEM "&", ID_EXIT + MENUITEM "&Вихід", ID_EXIT END - POPUP "ij" + POPUP "Дія" BEGIN - MENUITEM "' ...", ID_CONNECT, GRAYED + MENUITEM "З'єднання з...", ID_CONNECT, GRAYED MENUITEM SEPARATOR - MENUITEM "", ID_START, GRAYED - MENUITEM "", ID_STOP, GRAYED - MENUITEM "", ID_PAUSE, GRAYED - MENUITEM "", ID_RESUME, GRAYED - MENUITEM "", ID_RESTART, GRAYED + MENUITEM "Запуск", ID_START, GRAYED + MENUITEM "Зупинити", ID_STOP, GRAYED + MENUITEM "Пауза", ID_PAUSE, GRAYED + MENUITEM "Продовжити", ID_RESUME, GRAYED + MENUITEM "Перезапуск", ID_RESTART, GRAYED MENUITEM SEPARATOR - MENUITEM "", ID_REFRESH + MENUITEM "Оновити", ID_REFRESH MENUITEM SEPARATOR - MENUITEM "...", ID_EDIT, GRAYED - MENUITEM "...", ID_CREATE, GRAYED - MENUITEM "...", ID_DELETE, GRAYED + MENUITEM "Правка...", ID_EDIT, GRAYED + MENUITEM "Створити...", ID_CREATE, GRAYED + MENUITEM "Видалити...", ID_DELETE, GRAYED MENUITEM SEPARATOR - MENUITEM "...", ID_PROP, GRAYED + MENUITEM "Властивості...", ID_PROP, GRAYED END - POPUP "" + POPUP "Вигляд" BEGIN - MENUITEM " ", ID_VIEW_LARGE - MENUITEM " ", ID_VIEW_SMALL - MENUITEM "", ID_VIEW_LIST - MENUITEM "", ID_VIEW_DETAILS + MENUITEM "Великі значки", ID_VIEW_LARGE + MENUITEM "Дрібні значки", ID_VIEW_SMALL + MENUITEM "Список", ID_VIEW_LIST + MENUITEM "Подробиці", ID_VIEW_DETAILS MENUITEM SEPARATOR - MENUITEM "...",ID_VIEW_CUST, GRAYED + MENUITEM "Настройка...",ID_VIEW_CUST, GRAYED END - POPUP "" + POPUP "Довідка" BEGIN - MENUITEM "", ID_HELP - MENUITEM " ", ID_ABOUT + MENUITEM "Довідка", ID_HELP + MENUITEM "Про програму", ID_ABOUT END END @@ -54,36 +54,36 @@ IDR_POPUP MENU BEGIN POPUP "popup" BEGIN - MENUITEM "", ID_START, GRAYED - MENUITEM "", ID_STOP, GRAYED - MENUITEM "", ID_PAUSE, GRAYED - MENUITEM "", ID_RESUME, GRAYED - MENUITEM "", ID_RESTART, GRAYED + MENUITEM "Запуск", ID_START, GRAYED + MENUITEM "Зупинити", ID_STOP, GRAYED + MENUITEM "Пауза", ID_PAUSE, GRAYED + MENUITEM "Продовжити", ID_RESUME, GRAYED + MENUITEM "Перезапуск", ID_RESTART, GRAYED MENUITEM SEPARATOR - MENUITEM "", ID_REFRESH + MENUITEM "Оновити", ID_REFRESH MENUITEM SEPARATOR - MENUITEM "...", ID_EDIT, GRAYED - MENUITEM "...", ID_DELETE, GRAYED + MENUITEM "Правка...", ID_EDIT, GRAYED + MENUITEM "Видалити...", ID_DELETE, GRAYED MENUITEM SEPARATOR - MENUITEM "...", ID_PROP, GRAYED + MENUITEM "Властивості...", ID_PROP, GRAYED MENUITEM SEPARATOR - MENUITEM "...", ID_HELP + MENUITEM "Довідка...", ID_HELP END END IDD_ABOUTBOX DIALOGEX 22,16,190,182 -CAPTION " "" """ +CAPTION "Про програму ""Диспетчер керування службами""" FONT 8, "MS Shell Dlg",0,0 STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME BEGIN - LTEXT " v0.8\nCopyright (C) 2005-2007\nby Ged Murphy (gedmurphy@reactos.org)", IDC_STATIC, 48, 7, 135, 26 - PUSHBUTTON "", IDOK, 75, 162, 44, 15 + LTEXT "Диспетчер керування службами v0.8\nCopyright (C) 2005-2007\nby Ged Murphy (gedmurphy@reactos.org)", IDC_STATIC, 48, 7, 135, 26 + PUSHBUTTON "Закрити", IDOK, 75, 162, 44, 15 ICON IDI_SM_ICON, IDC_STATIC, 10, 10, 7, 30 EDITTEXT IDC_LICENSE_EDIT, 8, 44, 174, 107, WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_READONLY | ES_MULTILINE END IDD_DLG_GENERAL DIALOGEX 6, 6, 253, 232 -CAPTION "" +CAPTION "Загальні" FONT 8, "MS Shell Dlg",0,0 STYLE DS_SHELLFONT | WS_BORDER | WS_VISIBLE | WS_DLGFRAME | WS_SYSMENU | WS_THICKFRAME | WS_GROUP | WS_TABSTOP BEGIN @@ -92,37 +92,37 @@ BEGIN EDITTEXT IDC_DESCRIPTION, 70, 46, 176, 24, WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_MULTILINE | ES_READONLY EDITTEXT IDC_EXEPATH, 6, 86, 240, 13, WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_READONLY COMBOBOX IDC_START_TYPE, 70, 107, 176, 40, WS_CHILD | WS_VISIBLE | WS_TABSTOP | CBS_DROPDOWNLIST - PUSHBUTTON "", IDC_START, 6, 155, 54, 15, WS_DISABLED - PUSHBUTTON "", IDC_STOP, 68, 155, 54, 15, WS_DISABLED - PUSHBUTTON "", IDC_PAUSE , 130, 155, 54, 15, WS_DISABLED - PUSHBUTTON "", IDC_RESUME, 192, 155, 54, 15, WS_DISABLED - LTEXT "' :", IDC_STATIC, 4, 11, 53, 11 - LTEXT "' :", IDC_STATIC, 4, 29, 53, 11 - LTEXT ":", IDC_STATIC, 4, 51, 53, 11 - LTEXT " :", IDC_STATIC, 6, 73, 82, 9 - LTEXT " :", IDC_STATIC, 6, 108, 53, 11 - LTEXT " :", IDC_STATIC, 4, 138, 53, 11 + PUSHBUTTON "Запуск", IDC_START, 6, 155, 54, 15, WS_DISABLED + PUSHBUTTON "Зупинити", IDC_STOP, 68, 155, 54, 15, WS_DISABLED + PUSHBUTTON "Пауза", IDC_PAUSE , 130, 155, 54, 15, WS_DISABLED + PUSHBUTTON "Продовжити", IDC_RESUME, 192, 155, 54, 15, WS_DISABLED + LTEXT "Ім'я служби:", IDC_STATIC, 4, 11, 53, 11 + LTEXT "Ім'я виводиться:", IDC_STATIC, 4, 29, 53, 11 + LTEXT "Опис:", IDC_STATIC, 4, 51, 53, 11 + LTEXT "Виконуваний файл:", IDC_STATIC, 6, 73, 82, 9 + LTEXT "Тип запуску:", IDC_STATIC, 6, 108, 53, 11 + LTEXT "Стан служби:", IDC_STATIC, 4, 138, 53, 11 LTEXT "", IDC_SERV_STATUS, 70, 138, 176, 11, WS_CHILD | WS_VISIBLE - LTEXT " , .",IDC_STATIC, 6,177,240,15 - LTEXT " :", IDC_STATIC, 6, 200, 58, 11 + LTEXT "Ви можете вказати параметри запуску, вживані при запуску служби звідси.",IDC_STATIC, 6,177,240,15 + LTEXT "Параметри запуску:", IDC_STATIC, 6, 200, 58, 11 EDITTEXT IDC_START_PARAM, 68, 199, 178, 13, WS_CHILD | WS_VISIBLE | WS_TABSTOP - PUSHBUTTON "", IDC_EDIT, 192, 215, 54, 15, WS_DISABLED + PUSHBUTTON "Правка", IDC_EDIT, 192, 215, 54, 15, WS_DISABLED END IDD_DLG_DEPEND DIALOGEX 6,6,253,225 -CAPTION "" +CAPTION "Залежності" FONT 8, "MS Shell Dlg",0,0 STYLE DS_SHELLFONT | WS_BORDER | WS_VISIBLE | WS_DLGFRAME | WS_SYSMENU | WS_THICKFRAME | WS_GROUP | WS_TABSTOP BEGIN CONTROL "", IDC_DEPEND_TREE1, "SysTreeView32" , WS_BORDER | WS_CHILDWINDOW | WS_VISIBLE | WS_TABSTOP | TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_DISABLEDRAGDROP, 8, 70, 236, 68 CONTROL "", IDC_DEPEND_TREE2, "SysTreeView32", WS_BORDER | WS_CHILDWINDOW | WS_VISIBLE | WS_TABSTOP | TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_DISABLEDRAGDROP, 8, 151, 234, 67 - LTEXT " , . , .", IDC_STATIC,8, 7, 238, 26 - LTEXT " ", IDC_STATIC, 8, 57, 236, 9 + LTEXT "Деякі служби залежать від інших служб, системних драйверів або списку завантаження груп служб. Якщо служба зупинена або неправильно працює, це впливає на залежні від неї служби.", IDC_STATIC,8, 7, 238, 26 + LTEXT "Ця служба залежить від наступних компонентів", IDC_STATIC, 8, 57, 236, 9 LTEXT "", IDC_DEPEND_SERVICE, 8, 38, 236, 13 END IDD_DLG_CREATE DIALOGEX 6,6,225,209 -CAPTION " " +CAPTION "Створити службу" FONT 8, "MS Shell Dlg",0,0 STYLE DS_SHELLFONT | WS_BORDER | WS_VISIBLE | WS_DLGFRAME | WS_SYSMENU | WS_THICKFRAME | WS_GROUP | WS_TABSTOP BEGIN @@ -131,45 +131,45 @@ BEGIN EDITTEXT IDC_CREATE_PATH, 10, 62, 210, 13, WS_CHILD | WS_VISIBLE EDITTEXT IDC_CREATE_DESC, 10, 97, 210, 48, WS_CHILD | WS_VISIBLE EDITTEXT IDC_CREATE_OPTIONS, 10, 162, 210, 13, WS_CHILD | WS_VISIBLE - LTEXT "*' :", IDC_STATIC, 12, 12, 54, 9 - LTEXT "*' :", IDC_STATIC, 12, 33, 54, 9 - LTEXT "* :", IDC_STATIC, 10, 51, 68, 9 - LTEXT " :", IDC_STATIC, 12, 86, 44, 9 + LTEXT "*Ім'я служби :", IDC_STATIC, 12, 12, 54, 9 + LTEXT "*Ім'я виводиться :", IDC_STATIC, 12, 33, 54, 9 + LTEXT "*Виконуваний файл :", IDC_STATIC, 10, 51, 68, 9 + LTEXT "Опис :", IDC_STATIC, 12, 86, 44, 9 PUSHBUTTON "OK", IDOK, 126, 192, 44, 13 - PUSHBUTTON "", IDCANCEL, 176, 192, 46, 13 - LTEXT " ( """" )", IDC_STATIC, 10, 151, 134, 9 - PUSHBUTTON "", ID_CREATE_HELP, 10, 192, 44, 13 + PUSHBUTTON "Скасувати", IDCANCEL, 176, 192, 46, 13 + LTEXT "Додаткові опції (натисніть кнопку ""Довідка"" для подробиць)", IDC_STATIC, 10, 151, 134, 9 + PUSHBUTTON "Довідка", ID_CREATE_HELP, 10, 192, 44, 13 END IDD_DLG_DELETE DIALOGEX 6,6,185,148 -CAPTION " " +CAPTION "Видалити службу" FONT 8, "MS Shell Dlg",0,0 STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | DS_MODALFRAME BEGIN ICON IDI_WARNING, IDC_STATIC, 10, 8, 24, 22 - LTEXT " , ? !", IDC_STATIC, 50, 6, 125, 25 - LTEXT "' :",IDC_STATIC, 6, 40, 80, 9 + LTEXT "Ви впевнені, що хочете видалити вибрану службу? Ви не зможете відновити її після видалення!", IDC_STATIC, 50, 6, 125, 25 + LTEXT "Ім'я служби:",IDC_STATIC, 6, 40, 80, 9 LTEXT "", IDC_DEL_NAME, 15, 53, 160, 15 EDITTEXT IDC_DEL_DESC, 6, 73, 174, 48, WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_EX_STATICEDGE | ES_MULTILINE | ES_READONLY PUSHBUTTON "OK", IDOK, 26, 129, 54, 13 - DEFPUSHBUTTON "", IDCANCEL, 102, 129, 54, 13 + DEFPUSHBUTTON "Скасувати", IDCANCEL, 102, 129, 54, 13 END IDD_DLG_DEPEND_STOP DIALOGEX 6,6,240,148 -CAPTION " " +CAPTION "Зупинка інших служб" FONT 8, "MS Shell Dlg",0,0 STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | DS_MODALFRAME BEGIN ICON IDI_WARNING, IDC_STATIC, 10, 8, 24, 22 LTEXT "", IDC_STOP_DEPENDS, 40, 8, 170, 25 LISTBOX IDC_STOP_DEPENDS_LB, 15, 40, 210, 70, WS_CHILD | WS_VISIBLE | WS_EX_STATICEDGE | LBS_NOSEL - LTEXT " ?",IDC_STATIC, 15, 110, 150, 10 - DEFPUSHBUTTON "", IDOK, 60, 129, 54, 14 - PUSHBUTTON "ͳ", IDCANCEL, 120, 129, 54, 14 + LTEXT "Ви хочете зупинити ці служби?",IDC_STATIC, 15, 110, 150, 10 + DEFPUSHBUTTON "Так", IDOK, 60, 129, 54, 14 + PUSHBUTTON "Ні", IDCANCEL, 120, 129, 54, 14 END IDD_DLG_HELP_OPTIONS DIALOGEX 6,6,200,150 -CAPTION "" +CAPTION "Настройки" FONT 8, "MS Shell Dlg",0,0 STYLE 0x10CF0000 BEGIN @@ -178,7 +178,7 @@ BEGIN END IDD_DLG_PROGRESS DIALOGEX 6,6,255,89 -CAPTION " " +CAPTION "Управління службами" FONT 8, "MS Shell Dlg",0,0 STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | WS_VISIBLE | DS_MODALFRAME EXSTYLE WS_EX_TOOLWINDOW @@ -186,105 +186,105 @@ BEGIN CONTROL "", IDC_SERVCON_PROGRESS, "msctls_progress32", 0x50000000, 8, 46, 238, 13 LTEXT "", IDC_SERVCON_INFO, 8, 5, 236, 11 LTEXT "", IDC_SERVCON_NAME, 8, 25, 66, 11 - PUSHBUTTON "&", IDOK, 100, 70, 54, 13 + PUSHBUTTON "&Закрити", IDOK, 100, 70, 54, 13 END STRINGTABLE DISCARDABLE BEGIN - IDS_FIRSTCOLUMN "'" - IDS_SECONDCOLUMN "" - IDS_THIRDCOLUMN "" - IDS_FOURTHCOLUMN " " - IDS_FITHCOLUMN " " + IDS_FIRSTCOLUMN "Ім'я" + IDS_SECONDCOLUMN "Опис" + IDS_THIRDCOLUMN "Стан" + IDS_FOURTHCOLUMN "Тип запуску" + IDS_FITHCOLUMN "Вхід від імені" END STRINGTABLE DISCARDABLE BEGIN - IDS_SERVICES_STARTED "" - IDS_SERVICES_STOPPED "" - IDS_SERVICES_AUTO "" - IDS_SERVICES_MAN "" - IDS_SERVICES_DIS "³" + IDS_SERVICES_STARTED "Запущено" + IDS_SERVICES_STOPPED "Зупинено" + IDS_SERVICES_AUTO "Автоматично" + IDS_SERVICES_MAN "Вручну" + IDS_SERVICES_DIS "Відключено" END STRINGTABLE DISCARDABLE BEGIN - IDS_NUM_SERVICES "H : %d" - IDS_STOP_DEPENDS " %s , " + IDS_NUM_SERVICES "Hомер служби: %d" + IDS_STOP_DEPENDS "Коли %s зупинеться, наступні служби також буде зупинено" IDS_NO_DEPENDS "" - IDS_LICENSE " ; , ³ GNU, ; 2 , - , .\r\n\r\n 䳿 , , - Ҳ, Ҳ Ҳ Ҳ . ³ GNU.\r\n\r\n ³ GNU. , (Free Software Foundation, Inc.), 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA." + IDS_LICENSE "Це вільне програмне забезпечення; Ви можете розповсюджувати її та змінювати, дотримуючись умови Відкритої ліцензійної угоди GNU, опублікованої Фондом вільного програмного забезпечення; або редакції 2 Угоди, або будь-якої редакції, випущеної пізніше.\r\n\r\nЦя програма розповсюджується в надії на те, що вона виявиться корисною, але БЕЗ БУДЬ-ЯКИХ ГАРАНТІЙ, включаючи УЯВНОЮ ГАРАНТІЄЮ ЯКОСТІ або ПРИДАТНОСТІ для певних цілей. Подробиці містяться у Відкритій ліцензійній угоді GNU.\r\n\r\nРазом з цією програмою повинен поширюватися примірник Відкритої ліцензійної угоди GNU. Якщо він відсутній, повідомте про це в Фонд вільного програмного забезпечення (Free Software Foundation, Inc.), 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA." END STRINGTABLE DISCARDABLE BEGIN - IDS_TOOLTIP_PROP "" - IDS_TOOLTIP_REFRESH "" - IDS_TOOLTIP_EXPORT " " - IDS_TOOLTIP_CREATE " " - IDS_TOOLTIP_DELETE " " - IDS_TOOLTIP_START " " - IDS_TOOLTIP_STOP " " - IDS_TOOLTIP_PAUSE " " - IDS_TOOLTIP_RESTART " " + IDS_TOOLTIP_PROP "Властивості" + IDS_TOOLTIP_REFRESH "Оновити" + IDS_TOOLTIP_EXPORT "Експортувати список" + IDS_TOOLTIP_CREATE "Створення нової служби" + IDS_TOOLTIP_DELETE "Видалення існуючої служби" + IDS_TOOLTIP_START "Запуск служби" + IDS_TOOLTIP_STOP "Зупинення служби" + IDS_TOOLTIP_PAUSE "Призупинення служби" + IDS_TOOLTIP_RESTART "Перезапуск служби" END STRINGTABLE DISCARDABLE BEGIN - IDS_PROGRESS_INFO_START "ReactOS " - IDS_PROGRESS_INFO_STOP "ReactOS " - IDS_PROGRESS_INFO_PAUSE "ReactOS " - IDS_PROGRESS_INFO_RESUME "ReactOS " - IDS_CREATE_SUCCESS " " - IDS_DELETE_SUCCESS " " - IDS_CREATE_REQ ", \n '" - IDS_DELETE_STOP " !" + IDS_PROGRESS_INFO_START "ReactOS намагається запустити наступну службу" + IDS_PROGRESS_INFO_STOP "ReactOS намагається зупинити наступну службу" + IDS_PROGRESS_INFO_PAUSE "ReactOS намагається призупинити наступну службу" + IDS_PROGRESS_INFO_RESUME "ReactOS намагається продовжити наступну службу" + IDS_CREATE_SUCCESS "Служба успішно створена" + IDS_DELETE_SUCCESS "Служба успішно видалена" + IDS_CREATE_REQ "Поля, відмічені зірочкою\nє обов'язковими" + IDS_DELETE_STOP "Ви маєте вручну зупинити службу перед видаленням!" END STRINGTABLE DISCARDABLE BEGIN - IDS_HELP_OPTIONS "ֲ :\r\n̲: ' .\r\n type= \r\n (default = own)\r\n start= \r\n (default = demand) \r\n error= \r\n (default = normal)\r\n group= \r\n tag= \r\n depend= \r\n obj= \r\n (default = LocalSystem)\r\n password= \r\n" + IDS_HELP_OPTIONS "ОПЦІЇ СТВОРЕННЯ:\r\nПРИМІТКА: ім'я опції містить знак рівності.\r\n type= \r\n (default = own)\r\n start= \r\n (default = demand) \r\n error= \r\n (default = normal)\r\n group= \r\n tag= \r\n depend= \r\n obj= \r\n (default = LocalSystem)\r\n password= \r\n" END /* Hints */ STRINGTABLE DISCARDABLE BEGIN IDS_HINT_BLANK " " - IDS_HINT_EXPORT " ." - IDS_HINT_EXIT " ." + IDS_HINT_EXPORT " Експорт поточного списку у файл." + IDS_HINT_EXIT " Вихід з цієї програми." - IDS_HINT_CONNECT " '." - IDS_HINT_START " ." - IDS_HINT_STOP " ." - IDS_HINT_PAUSE " ." - IDS_HINT_RESUME " ." - IDS_HINT_RESTART " ." - IDS_HINT_REFRESH " ." - IDS_HINT_EDIT " ." - IDS_HINT_CREATE " ." - IDS_HINT_DELETE " ." - IDS_HINT_PROP " ³ ." + IDS_HINT_CONNECT " Управління іншим комп'ютером." + IDS_HINT_START " Запуск вибраної служби." + IDS_HINT_STOP " Зупинення вибраної служби." + IDS_HINT_PAUSE " Призупинення вибраної служби." + IDS_HINT_RESUME " Продовження вибраної служби." + IDS_HINT_RESTART " Перезапуск вибраної служби." + IDS_HINT_REFRESH " Оновлення списку служб." + IDS_HINT_EDIT " Зміна властивостей вибраної служби." + IDS_HINT_CREATE " Створення нової служби." + IDS_HINT_DELETE " Видалення вибраної служби." + IDS_HINT_PROP " Відкриття вікна властивостей вибраних елементів." - IDS_HINT_LARGE " ." - IDS_HINT_SMALL " ." - IDS_HINT_LIST " ." - IDS_HINT_DETAILS " ." - IDS_HINT_CUST " ." + IDS_HINT_LARGE " Показ елементів великими значками." + IDS_HINT_SMALL " Показ елементів малими значками." + IDS_HINT_LIST " Показ елементів у формі списку." + IDS_HINT_DETAILS " Показ інформації про кожен елемент у вікні." + IDS_HINT_CUST " Настройка вигляду." - IDS_HINT_HELP " ³ ." - IDS_HINT_ABOUT " ReactOS." + IDS_HINT_HELP " Відображення вікна довідки." + IDS_HINT_ABOUT " Про програму Диспетчер керування службами ReactOS." - IDS_HINT_SYS_RESTORE " ³ ." - IDS_HINT_SYS_MOVE " ." - IDS_HINT_SYS_SIZE " ." - IDS_HINT_SYS_MINIMIZE " ." - IDS_HINT_SYS_MAXIMIZE " ." - IDS_HINT_SYS_CLOSE " ." + IDS_HINT_SYS_RESTORE " Відновлення вихідних розмірів вікна." + IDS_HINT_SYS_MOVE " Зміна розташування вікна." + IDS_HINT_SYS_SIZE " Зміна розмірів вікна." + IDS_HINT_SYS_MINIMIZE " Згортання вікна до значка." + IDS_HINT_SYS_MAXIMIZE " Розгортання вікна до розмірів екрана." + IDS_HINT_SYS_CLOSE " Закриття цього вікна." END /* Application title */ STRINGTABLE DISCARDABLE BEGIN - IDS_APPNAME " ReactOS" + IDS_APPNAME "Диспетчер керування службами ReactOS" END diff --git a/base/applications/mscutils/servman/lang/zh-CN.rc b/base/applications/mscutils/servman/lang/zh-CN.rc new file mode 100644 index 00000000000..d86b98c082c --- /dev/null +++ b/base/applications/mscutils/servman/lang/zh-CN.rc @@ -0,0 +1,286 @@ +/* + * Translated by Song Fuchang (0xfc) + */ + +LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED + +IDR_MAINMENU MENU +BEGIN + POPUP "文件(&F)" + BEGIN + MENUITEM "导出...", ID_EXPORT + MENUITEM SEPARATOR + MENUITEM "退出(&X)", ID_EXIT + END + POPUP "动作" + BEGIN + MENUITEM "连接到...", ID_CONNECT, GRAYED + MENUITEM SEPARATOR + MENUITEM "启动", ID_START, GRAYED + MENUITEM "停止", ID_STOP, GRAYED + MENUITEM "暂停", ID_PAUSE, GRAYED + MENUITEM "恢复", ID_RESUME, GRAYED + MENUITEM "重新启动", ID_RESTART, GRAYED + MENUITEM SEPARATOR + MENUITEM "刷新", ID_REFRESH + MENUITEM SEPARATOR + MENUITEM "编辑...", ID_EDIT, GRAYED + MENUITEM "创建...", ID_CREATE, GRAYED + MENUITEM "删除...", ID_DELETE, GRAYED + MENUITEM SEPARATOR + MENUITEM "属性...", ID_PROP, GRAYED + END + POPUP "查看" + BEGIN + MENUITEM "大图标", ID_VIEW_LARGE + MENUITEM "小图标", ID_VIEW_SMALL + MENUITEM "列表", ID_VIEW_LIST + MENUITEM "详细信息", ID_VIEW_DETAILS + MENUITEM SEPARATOR + MENUITEM "自定义...", ID_VIEW_CUST, GRAYED + END + POPUP "帮助" + BEGIN + MENUITEM "帮助内容", ID_HELP + MENUITEM "关于", ID_ABOUT + END +END + +IDR_POPUP MENU +BEGIN + POPUP "popup" + BEGIN + MENUITEM "启动", ID_START, GRAYED + MENUITEM "停止", ID_STOP, GRAYED + MENUITEM "暂停", ID_PAUSE, GRAYED + MENUITEM "恢复", ID_RESUME, GRAYED + MENUITEM "重新启动", ID_RESTART, GRAYED + MENUITEM SEPARATOR + MENUITEM "刷新", ID_REFRESH + MENUITEM SEPARATOR + MENUITEM "编辑...", ID_EDIT, GRAYED + MENUITEM "删除...", ID_DELETE, GRAYED + MENUITEM SEPARATOR + MENUITEM "属性...", ID_PROP, GRAYED + MENUITEM SEPARATOR + MENUITEM "帮助...", ID_HELP + END +END + +IDD_ABOUTBOX DIALOGEX 22,16,190,182 +CAPTION "关于服务管理器" +FONT 8, "MS Shell Dlg",0,0 +STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME +BEGIN + LTEXT "服务管理器 v0.8\n版权所有 (C) 2005-2007\n作者 Ged Murphy (gedmurphy@reactos.org)", IDC_STATIC, 48, 7, 135, 30 + PUSHBUTTON "关闭", IDOK, 75, 162, 44, 15 + ICON IDI_SM_ICON, IDC_STATIC, 10, 10, 7, 30 + EDITTEXT IDC_LICENSE_EDIT, 8, 44, 174, 107, WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_READONLY | ES_MULTILINE +END + +IDD_DLG_GENERAL DIALOGEX 6, 6, 253, 232 +CAPTION "普通" +FONT 8, "MS Shell Dlg",0,0 +STYLE DS_SHELLFONT | WS_BORDER | WS_VISIBLE | WS_DLGFRAME | WS_SYSMENU | WS_THICKFRAME | WS_GROUP | WS_TABSTOP +BEGIN + LTEXT "", IDC_SERV_NAME, 70,11,176,11, WS_CHILD | WS_VISIBLE + EDITTEXT IDC_DISP_NAME, 70, 29, 176, 13, WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_READONLY + EDITTEXT IDC_DESCRIPTION, 70, 46, 176, 24, WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP | ES_MULTILINE | ES_READONLY + EDITTEXT IDC_EXEPATH, 6, 86, 240, 13, WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_READONLY + COMBOBOX IDC_START_TYPE, 70, 107, 176, 40, WS_CHILD | WS_VISIBLE | WS_TABSTOP | CBS_DROPDOWNLIST + PUSHBUTTON "启动", IDC_START, 6, 155, 54, 15, WS_DISABLED + PUSHBUTTON "停止", IDC_STOP, 68, 155, 54, 15, WS_DISABLED + PUSHBUTTON "暂停", IDC_PAUSE , 130, 155, 54, 15, WS_DISABLED + PUSHBUTTON "恢复", IDC_RESUME, 192, 155, 54, 15, WS_DISABLED + LTEXT "服务名称:", IDC_STATIC, 4, 11, 53, 11 + LTEXT "显示名称:", IDC_STATIC, 4, 29, 53, 11 + LTEXT "描述:", IDC_STATIC, 4, 51, 53, 11 + LTEXT "可执行文件路径:", IDC_STATIC, 6, 73, 82, 9 + LTEXT "启动类型:", IDC_STATIC, 6, 108, 53, 11 + LTEXT "服务状态:", IDC_STATIC, 4, 138, 53, 11 + LTEXT "", IDC_SERV_STATUS, 70, 138, 176, 11, WS_CHILD | WS_VISIBLE + LTEXT "你可以在这里指定当你从这里启动该服务时所应用的参数。",IDC_STATIC, 6,177,240,15 + LTEXT "启动参数:", IDC_STATIC, 6, 200, 58, 11 + EDITTEXT IDC_START_PARAM, 68, 199, 178, 13, WS_CHILD | WS_VISIBLE | WS_TABSTOP + PUSHBUTTON "编辑", IDC_EDIT, 192, 215, 54, 15, WS_DISABLED +END + +IDD_DLG_DEPEND DIALOGEX 6,6,253,225 +CAPTION "依赖" +FONT 8, "MS Shell Dlg",0,0 +STYLE DS_SHELLFONT | WS_BORDER | WS_VISIBLE | WS_DLGFRAME | WS_SYSMENU | WS_THICKFRAME | WS_GROUP | WS_TABSTOP +BEGIN + CONTROL "", IDC_DEPEND_TREE1, "SysTreeView32" , WS_BORDER | WS_CHILDWINDOW | WS_VISIBLE | WS_TABSTOP | TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_DISABLEDRAGDROP, 8, 70, 236, 68 + CONTROL "", IDC_DEPEND_TREE2, "SysTreeView32", WS_BORDER | WS_CHILDWINDOW | WS_VISIBLE | WS_TABSTOP | TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_DISABLEDRAGDROP, 8, 151, 234, 67 + LTEXT "一些服务依赖于其他服务,系统驱动程序和加载顺序组。如果一个系统组件被停止或者没有正确运行,被其依赖的服务也会被影响。", IDC_STATIC,8, 7, 238, 26 + LTEXT "这个服务依赖于以下的组件:", IDC_STATIC, 8, 57, 236, 9 + LTEXT "", IDC_DEPEND_SERVICE, 8, 38, 236, 13 +END + +IDD_DLG_CREATE DIALOGEX 6,6,225,209 +CAPTION "创建一个服务" +FONT 8, "MS Shell Dlg",0,0 +STYLE DS_SHELLFONT | WS_BORDER | WS_VISIBLE | WS_DLGFRAME | WS_SYSMENU | WS_THICKFRAME | WS_GROUP | WS_TABSTOP +BEGIN + EDITTEXT IDC_CREATE_SERVNAME, 72, 12, 150, 11, WS_CHILD | WS_VISIBLE | WS_EX_CLIENTEDGE + EDITTEXT IDC_CREATE_DISPNAME, 72, 31, 150, 11, WS_CHILD | WS_VISIBLE + EDITTEXT IDC_CREATE_PATH, 10, 62, 210, 13, WS_CHILD | WS_VISIBLE + EDITTEXT IDC_CREATE_DESC, 10, 97, 210, 48, WS_CHILD | WS_VISIBLE + EDITTEXT IDC_CREATE_OPTIONS, 10, 162, 210, 13, WS_CHILD | WS_VISIBLE + LTEXT "*服务名称:", IDC_STATIC, 12, 12, 54, 9 + LTEXT "*显示名称:", IDC_STATIC, 12, 33, 54, 9 + LTEXT "*可执行文件路径:", IDC_STATIC, 10, 51, 68, 9 + LTEXT "描述:", IDC_STATIC, 12, 86, 44, 9 + PUSHBUTTON "确定", IDOK, 126, 192, 44, 13 + PUSHBUTTON "取消", IDCANCEL, 176, 192, 46, 13 + LTEXT "附加选项 (点击帮助以获得详细信息)", IDC_STATIC, 10, 151, 134, 9 + PUSHBUTTON "帮助", ID_CREATE_HELP, 10, 192, 44, 13 +END + +IDD_DLG_DELETE DIALOGEX 6,6,185,148 +CAPTION "删除一个服务" +FONT 8, "MS Shell Dlg",0,0 +STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | DS_MODALFRAME +BEGIN + ICON IDI_WARNING, IDC_STATIC, 10, 8, 24, 22 + LTEXT "您确定要删除以下的服务吗?这个操作是不可撤消的!", IDC_STATIC, 50, 6, 125, 25 + LTEXT "服务名称:",IDC_STATIC, 6, 40, 80, 9 + LTEXT "", IDC_DEL_NAME, 15, 53, 160, 15 + EDITTEXT IDC_DEL_DESC, 6, 73, 174, 48, WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_EX_STATICEDGE | ES_MULTILINE | ES_READONLY + PUSHBUTTON "是", IDOK, 26, 129, 54, 13 + DEFPUSHBUTTON "否", IDCANCEL, 102, 129, 54, 13 +END + +IDD_DLG_DEPEND_STOP DIALOGEX 6,6,240,148 +CAPTION "停止其他服务" +FONT 8, "MS Shell Dlg",0,0 +STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | DS_MODALFRAME +BEGIN + ICON IDI_WARNING, IDC_STATIC, 10, 8, 24, 22 + LTEXT "", IDC_STOP_DEPENDS, 40, 8, 170, 25 + LISTBOX IDC_STOP_DEPENDS_LB, 15, 40, 210, 70, WS_CHILD | WS_VISIBLE | WS_EX_STATICEDGE | LBS_NOSEL + LTEXT "您确定要停止这些服务吗?",IDC_STATIC, 15, 110, 150, 10 + DEFPUSHBUTTON "是", IDOK, 60, 129, 54, 14 + PUSHBUTTON "否", IDCANCEL, 120, 129, 54, 14 +END + +IDD_DLG_HELP_OPTIONS DIALOGEX 6,6,200,150 +CAPTION "选项" +FONT 8, "MS Shell Dlg",0,0 +STYLE 0x10CF0000 +BEGIN + LTEXT "", IDC_CREATE_HELP, 6, 5, 200, 150 + PUSHBUTTON "确定", IDOK, 75, 130, 44, 13 +END + +IDD_DLG_PROGRESS DIALOGEX 6,6,255,89 +CAPTION "服务控制" +FONT 8, "MS Shell Dlg",0,0 +STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | WS_VISIBLE | DS_MODALFRAME +EXSTYLE WS_EX_TOOLWINDOW +BEGIN + CONTROL "", IDC_SERVCON_PROGRESS, "msctls_progress32", 0x50000000, 8, 46, 238, 13 + LTEXT "", IDC_SERVCON_INFO, 8, 5, 236, 11 + LTEXT "", IDC_SERVCON_NAME, 8, 25, 66, 11 + PUSHBUTTON "关闭(&C)", IDOK, 100, 70, 54, 13 +END + + + +STRINGTABLE DISCARDABLE +BEGIN + IDS_FIRSTCOLUMN "名称" + IDS_SECONDCOLUMN "描述" + IDS_THIRDCOLUMN "状态" + IDS_FOURTHCOLUMN "启动类型" + IDS_FITHCOLUMN "登录为" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_SERVICES_STARTED "已启动" + IDS_SERVICES_STOPPED "已停止" + IDS_SERVICES_AUTO "自动" + IDS_SERVICES_MAN "手动" + IDS_SERVICES_DIS "已禁用" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_NUM_SERVICES "服务总数: %d" + IDS_STOP_DEPENDS "当 %s 停止时,这些服务也将被停止" + IDS_NO_DEPENDS "<没有依赖>" + IDS_LICENSE "这个程序是自由软件;你可以在自由软件基金会(FSF)的 GNU LGPL 协议下重新发布或修改它;也适用于这个协议的版本 2,或(在您看来)任何更新的版本。\r\n\r\n这个程序在希望其有用的愿望中发布,但没有任何保证;也不意味着性能保证或对某特定用途的适用性。请查看 GNU GPL 许可协议以了解更多细节。\r\n\r\n您应该已经收到了一份和这个程序一起的 GNU GPL 协议的副本;如果没有,请写信给自由软件基金会(FSF):51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA." +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_TOOLTIP_PROP "属性" + IDS_TOOLTIP_REFRESH "刷新" + IDS_TOOLTIP_EXPORT "导出列表" + IDS_TOOLTIP_CREATE "创建一个新的服务" + IDS_TOOLTIP_DELETE "删除一个已存在的服务" + IDS_TOOLTIP_START "启动服务" + IDS_TOOLTIP_STOP "停止服务" + IDS_TOOLTIP_PAUSE "暂停服务" + IDS_TOOLTIP_RESTART "重新启动服务" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_PROGRESS_INFO_START "ReactOS 正在尝试启动以下服务" + IDS_PROGRESS_INFO_STOP "ReactOS 正在尝试停止以下服务" + IDS_PROGRESS_INFO_PAUSE "ReactOS 正在尝试暂停以下服务" + IDS_PROGRESS_INFO_RESUME "ReactOS 正在尝试恢复以下服务" + IDS_CREATE_SUCCESS "成功创建服务" + IDS_DELETE_SUCCESS "成功删除服务" + IDS_CREATE_REQ "标记有\n星号 (*) 的字段是必需的" + IDS_DELETE_STOP "您必须在删除该服务前停止它!" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_HELP_OPTIONS "创建选项:\r\n注意:选项名包含了等号(=)。\r\n type= \r\n (default = own)\r\n start= \r\n (default = demand) \r\n error= \r\n (default = normal)\r\n group= \r\n tag= \r\n depend= \r\n obj= \r\n (default = LocalSystem)\r\n password= \r\n" +END + +/* Hints */ +STRINGTABLE DISCARDABLE +BEGIN + IDS_HINT_BLANK " " + IDS_HINT_EXPORT " 将当前服务列表导出为一个文件。" + IDS_HINT_EXIT " 退出这个程序。" + + IDS_HINT_CONNECT " 管理一台不同的计算机。" + IDS_HINT_START " 启动选定的服务。" + IDS_HINT_STOP " 停止选定的服务。" + IDS_HINT_PAUSE " 暂停选定的服务。" + IDS_HINT_RESUME " 恢复选定的服务。" + IDS_HINT_RESTART " 停止然后启动选定的服务。" + IDS_HINT_REFRESH " 刷新服务列表。" + IDS_HINT_EDIT " 编辑选定服务的属性。" + IDS_HINT_CREATE " 创建一个新的服务。" + IDS_HINT_DELETE " 删除选定的服务。" + IDS_HINT_PROP " 为当前选择项目打开属性页。" + + IDS_HINT_LARGE " 用大图标显示条目。" + IDS_HINT_SMALL " 用小图标显示条目。" + IDS_HINT_LIST " 用列表显示条目。" + IDS_HINT_DETAILS " 在窗口中显示每个条目的信息。" + IDS_HINT_CUST " 自定义视图。" + + IDS_HINT_HELP " 显示帮助窗口。" + IDS_HINT_ABOUT " 关于 ReactOS 服务管理器。" + + IDS_HINT_SYS_RESTORE " 将这个窗口恢复到普通大小。" + IDS_HINT_SYS_MOVE " 移动这个窗口。" + IDS_HINT_SYS_SIZE " 调整这个窗口的大小。" + IDS_HINT_SYS_MINIMIZE " 将这个窗口折叠为一个图标。" + IDS_HINT_SYS_MAXIMIZE " 将这个窗口扩展到整个屏幕。" + IDS_HINT_SYS_CLOSE " 关闭这个窗口。" +END + +/* Application title */ +STRINGTABLE DISCARDABLE +BEGIN + IDS_APPNAME "ReactOS 服务管理器" +END diff --git a/base/applications/mscutils/servman/mainwnd.c b/base/applications/mscutils/servman/mainwnd.c index d4534b96f9d..0f135b43b8b 100644 --- a/base/applications/mscutils/servman/mainwnd.c +++ b/base/applications/mscutils/servman/mainwnd.c @@ -469,7 +469,7 @@ MainWndCommand(PMAIN_WND_INFO Info, case ID_START: { - if (DoStart(Info)) + if (DoStart(Info, NULL)) { UpdateServiceStatus(Info->pCurrentService); ChangeListViewText(Info, Info->pCurrentService, LVSTATUS); @@ -500,7 +500,7 @@ MainWndCommand(PMAIN_WND_INFO Info, case ID_RESTART: if (DoStop(Info)) { - DoStart(Info); + DoStart(Info, NULL); UpdateServiceStatus(Info->pCurrentService); ChangeListViewText(Info, Info->pCurrentService, LVSTATUS); SetMenuAndButtonStates(Info); diff --git a/base/applications/mscutils/servman/precomp.h b/base/applications/mscutils/servman/precomp.h index 9b829ad78df..bf4d63d5e0d 100644 --- a/base/applications/mscutils/servman/precomp.h +++ b/base/applications/mscutils/servman/precomp.h @@ -79,7 +79,7 @@ VOID ListViewSelectionChanged(PMAIN_WND_INFO Info, LPNMLISTVIEW pnmv); BOOL CreateListView(PMAIN_WND_INFO Info); /* start */ -BOOL DoStart(PMAIN_WND_INFO Info); +BOOL DoStart(PMAIN_WND_INFO Info, LPWSTR lpStartParams); /* stop */ typedef struct _STOP_INFO diff --git a/base/applications/mscutils/servman/propsheet_general.c b/base/applications/mscutils/servman/propsheet_general.c index 0affae972fe..f03272f5da9 100644 --- a/base/applications/mscutils/servman/propsheet_general.c +++ b/base/applications/mscutils/servman/propsheet_general.c @@ -48,6 +48,9 @@ SetButtonStates(PSERVICEPROPSHEET dlgInfo, EnableWindow (hButton, TRUE); } + hButton = GetDlgItem(hwndDlg, IDC_START_PARAM); + EnableWindow(hButton, (State == SERVICE_STOPPED)); + /* set the main toolbar */ SetMenuAndButtonStates(dlgInfo->Info); } @@ -248,6 +251,27 @@ SaveDlgInfo(PSERVICEPROPSHEET dlgInfo, } +static +VOID +OnStart(HWND hwndDlg, + PSERVICEPROPSHEET dlgInfo) +{ + WCHAR szStartParams[256]; + LPWSTR lpStartParams = NULL; + + if (GetDlgItemText(hwndDlg, IDC_START_PARAM, szStartParams, 256) > 0) + lpStartParams = szStartParams; + + if (DoStart(dlgInfo->Info, lpStartParams)) + { + UpdateServiceStatus(dlgInfo->pService); + ChangeListViewText(dlgInfo->Info, dlgInfo->pService, LVSTATUS); + SetButtonStates(dlgInfo, hwndDlg); + SetServiceStatusText(dlgInfo, hwndDlg); + } +} + + /* * General Property dialog callback. * Controls messages to the General dialog @@ -293,13 +317,7 @@ GeneralPageProc(HWND hwndDlg, break; case IDC_START: - if (DoStart(dlgInfo->Info)) - { - UpdateServiceStatus(dlgInfo->pService); - ChangeListViewText(dlgInfo->Info, dlgInfo->pService, LVSTATUS); - SetButtonStates(dlgInfo, hwndDlg); - SetServiceStatusText(dlgInfo, hwndDlg); - } + OnStart(hwndDlg, dlgInfo); break; case IDC_STOP: diff --git a/base/applications/mscutils/servman/rsrc.rc b/base/applications/mscutils/servman/rsrc.rc index 2cdfe024109..8ae670d6abb 100644 --- a/base/applications/mscutils/servman/rsrc.rc +++ b/base/applications/mscutils/servman/rsrc.rc @@ -31,13 +31,14 @@ IDI_DRIVER ICON "res/driver.ico" #include "lang/ja-JP.rc" #include "lang/ko-KR.rc" #include "lang/no-NO.rc" -#include "lang/ru-RU.rc" #include "lang/sk-SK.rc" #include "lang/sv-SE.rc" #include "lang/th-TH.rc" -#include "lang/uk-UA.rc" // UTF-8 #pragma code_page(65001) #include "lang/pl-PL.rc" #include "lang/ro-RO.rc" +#include "lang/ru-RU.rc" +#include "lang/uk-UA.rc" +#include "lang/zh-CN.rc" diff --git a/base/applications/mscutils/servman/start.c b/base/applications/mscutils/servman/start.c index 986437e0820..abdecad430a 100644 --- a/base/applications/mscutils/servman/start.c +++ b/base/applications/mscutils/servman/start.c @@ -11,7 +11,8 @@ static BOOL DoStartService(PMAIN_WND_INFO Info, - HWND hProgress) + HWND hProgress, + LPWSTR lpStartParams) { SC_HANDLE hSCManager; SC_HANDLE hService; @@ -23,6 +24,66 @@ DoStartService(PMAIN_WND_INFO Info, DWORD dwMaxWait; BOOL bRet = FALSE; + BOOL bWhiteSpace = TRUE; + LPWSTR lpChar; + DWORD dwArgsCount = 0; + LPCWSTR *lpArgsVector = NULL; + + if (lpStartParams != NULL) + { + /* Count the number of arguments */ + lpChar = lpStartParams; + while (*lpChar != 0) + { + if (iswspace(*lpChar)) + { + bWhiteSpace = TRUE; + } + else + { + if (bWhiteSpace == TRUE) + { + dwArgsCount++; + bWhiteSpace = FALSE; + } + } + + lpChar++; + } + + /* Allocate the arguments vector and add one for the service name */ + lpArgsVector = LocalAlloc(LMEM_FIXED, (dwArgsCount + 1) * sizeof(LPCWSTR)); + if (!lpArgsVector) + return FALSE; + + /* Make the service name the first argument */ + lpArgsVector[0] = Info->pCurrentService->lpServiceName; + + /* Fill the arguments vector */ + dwArgsCount = 1; + bWhiteSpace = TRUE; + lpChar = lpStartParams; + while (*lpChar != 0) + { + if (iswspace(*lpChar)) + { + *lpChar = 0; + bWhiteSpace = TRUE; + } + else + { + if (bWhiteSpace == TRUE) + { + lpArgsVector[dwArgsCount] = lpChar; + dwArgsCount++; + bWhiteSpace = FALSE; + } + } + + lpChar++; + } + } + hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_CONNECT); @@ -41,8 +102,8 @@ DoStartService(PMAIN_WND_INFO Info, /* Start the service */ bRet = StartService(hService, - 0, - NULL); + dwArgsCount, + lpArgsVector); if (!bRet && GetLastError() == ERROR_SERVICE_ALREADY_RUNNING) { /* If it's already running, just return TRUE */ @@ -121,11 +182,14 @@ DoStartService(PMAIN_WND_INFO Info, CloseServiceHandle(hSCManager); } + if (lpArgsVector) + LocalFree(lpArgsVector); + return bRet; } BOOL -DoStart(PMAIN_WND_INFO Info) +DoStart(PMAIN_WND_INFO Info, LPWSTR lpStartParams) { HWND hProgress; BOOL bRet = FALSE; @@ -139,7 +203,7 @@ DoStart(PMAIN_WND_INFO Info) InitializeProgressDialog(hProgress, Info->pCurrentService->lpServiceName); /* Start the requested service */ - bRet = DoStartService(Info, hProgress); + bRet = DoStartService(Info, hProgress, lpStartParams); /* Complete and destroy the progress bar */ DestroyProgressDialog(hProgress, bRet); diff --git a/base/applications/mspaint/CMakeLists.txt b/base/applications/mspaint/CMakeLists.txt index dee6aa9f405..1e8c65a8bec 100644 --- a/base/applications/mspaint/CMakeLists.txt +++ b/base/applications/mspaint/CMakeLists.txt @@ -1,5 +1,6 @@ set_unicode() +set_rc_compiler() add_executable(mspaint dialogs.c @@ -17,5 +18,6 @@ add_executable(mspaint rsrc.rc) set_module_type(mspaint win32gui) +add_pch(mspaint precomp.h) add_importlibs(mspaint comdlg32 shell32 user32 gdi32 advapi32 comctl32 msvcrt kernel32) add_cd_file(TARGET mspaint DESTINATION reactos/system32 FOR all) diff --git a/base/applications/mspaint/dialogs.c b/base/applications/mspaint/dialogs.c index bf3111b1bb7..0e843c5f7c2 100644 --- a/base/applications/mspaint/dialogs.c +++ b/base/applications/mspaint/dialogs.c @@ -8,10 +8,7 @@ /* INCLUDES *********************************************************/ -#include -#include -#include "definitions.h" -#include "globalvar.h" +#include "precomp.h" /* FUNCTIONS ********************************************************/ diff --git a/base/applications/mspaint/dib.c b/base/applications/mspaint/dib.c index 7c58f43c92d..4c1eaec7a2b 100644 --- a/base/applications/mspaint/dib.c +++ b/base/applications/mspaint/dib.c @@ -8,7 +8,7 @@ /* INCLUDES *********************************************************/ -#include +#include "precomp.h" /* FUNCTIONS ********************************************************/ diff --git a/base/applications/mspaint/drawing.c b/base/applications/mspaint/drawing.c index bafbe1cfe03..7a957baddf1 100644 --- a/base/applications/mspaint/drawing.c +++ b/base/applications/mspaint/drawing.c @@ -8,12 +8,12 @@ /* INCLUDES *********************************************************/ -#include +#include "precomp.h" /* FUNCTIONS ********************************************************/ void -Line(HDC hdc, short x1, short y1, short x2, short y2, int color, int thickness) +Line(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF color, int thickness) { HPEN oldPen = SelectObject(hdc, CreatePen(PS_SOLID, thickness, color)); MoveToEx(hdc, x1, y1, NULL); @@ -22,7 +22,7 @@ Line(HDC hdc, short x1, short y1, short x2, short y2, int color, int thickness) } void -Rect(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int thickness, int style) +Rect(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, int thickness, int style) { HBRUSH oldBrush; LOGBRUSH logbrush; @@ -37,7 +37,7 @@ Rect(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int thickn } void -Ellp(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int thickness, int style) +Ellp(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, int thickness, int style) { HBRUSH oldBrush; LOGBRUSH logbrush; @@ -52,7 +52,7 @@ Ellp(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int thickn } void -RRect(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int thickness, int style) +RRect(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, int thickness, int style) { LOGBRUSH logbrush; HBRUSH oldBrush; @@ -67,7 +67,7 @@ RRect(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int thick } void -Poly(HDC hdc, POINT * lpPoints, int nCount, int fg, int bg, int thickness, int style, BOOL closed) +Poly(HDC hdc, POINT * lpPoints, int nCount, COLORREF fg, COLORREF bg, int thickness, int style, BOOL closed) { LOGBRUSH logbrush; HBRUSH oldBrush; @@ -85,7 +85,7 @@ Poly(HDC hdc, POINT * lpPoints, int nCount, int fg, int bg, int thickness, int s } void -Bezier(HDC hdc, POINT p1, POINT p2, POINT p3, POINT p4, int color, int thickness) +Bezier(HDC hdc, POINT p1, POINT p2, POINT p3, POINT p4, COLORREF color, int thickness) { HPEN oldPen; POINT fourPoints[4]; @@ -99,7 +99,7 @@ Bezier(HDC hdc, POINT p1, POINT p2, POINT p3, POINT p4, int color, int thickness } void -Fill(HDC hdc, int x, int y, int color) +Fill(HDC hdc, LONG x, LONG y, COLORREF color) { HBRUSH oldBrush = SelectObject(hdc, CreateSolidBrush(color)); ExtFloodFill(hdc, x, y, GetPixel(hdc, x, y), FLOODFILLSURFACE); @@ -107,7 +107,7 @@ Fill(HDC hdc, int x, int y, int color) } void -Erase(HDC hdc, short x1, short y1, short x2, short y2, int color, int radius) +Erase(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF color, LONG radius) { short a; HPEN oldPen; @@ -122,9 +122,10 @@ Erase(HDC hdc, short x1, short y1, short x2, short y2, int color, int radius) } void -Replace(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int radius) +Replace(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, LONG radius) { - short a, x, y; + LONG a, x, y; + for(a = 0; a <= 100; a++) for(y = (y1 * (100 - a) + y2 * a) / 100 - radius + 1; y < (y1 * (100 - a) + y2 * a) / 100 + radius + 1; y++) @@ -135,10 +136,10 @@ Replace(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int rad } void -Airbrush(HDC hdc, short x, short y, int color, int r) +Airbrush(HDC hdc, LONG x, LONG y, COLORREF color, LONG r) { - short a; - short b; + LONG a, b; + for(b = -r; b <= r; b++) for(a = -r; a <= r; a++) if ((a * a + b * b <= r * r) && (rand() % 4 == 0)) @@ -146,7 +147,7 @@ Airbrush(HDC hdc, short x, short y, int color, int r) } void -Brush(HDC hdc, short x1, short y1, short x2, short y2, int color, int style) +Brush(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF color, COLORREF style) { HPEN oldPen = SelectObject(hdc, CreatePen(PS_SOLID, 1, color)); HBRUSH oldBrush = SelectObject(hdc, CreateSolidBrush(color)); @@ -231,7 +232,7 @@ Brush(HDC hdc, short x1, short y1, short x2, short y2, int color, int style) } void -RectSel(HDC hdc, short x1, short y1, short x2, short y2) +RectSel(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2) { HBRUSH oldBrush; LOGBRUSH logbrush; @@ -246,7 +247,7 @@ RectSel(HDC hdc, short x1, short y1, short x2, short y2) } void -SelectionFrame(HDC hdc, int x1, int y1, int x2, int y2) +SelectionFrame(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2) { HBRUSH oldBrush; LOGBRUSH logbrush; diff --git a/base/applications/mspaint/drawing.h b/base/applications/mspaint/drawing.h index db0d050d8d1..2c39ee9538d 100644 --- a/base/applications/mspaint/drawing.h +++ b/base/applications/mspaint/drawing.h @@ -6,28 +6,28 @@ * PROGRAMMERS: Benedikt Freisen */ -void Line(HDC hdc, short x1, short y1, short x2, short y2, int color, int thickness); +void Line(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF color, int thickness); -void Rect(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int thickness, int style); +void Rect(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, int thickness, int style); -void Ellp(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int thickness, int style); +void Ellp(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, int thickness, int style); -void RRect(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int thickness, int style); +void RRect(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, int thickness, int style); -void Poly(HDC hdc, POINT *lpPoints, int nCount, int fg, int bg, int thickness, int style, BOOL closed); +void Poly(HDC hdc, POINT *lpPoints, int nCount, COLORREF fg, COLORREF bg, int thickness, int style, BOOL closed); -void Bezier(HDC hdc, POINT p1, POINT p2, POINT p3, POINT p4, int color, int thickness); +void Bezier(HDC hdc, POINT p1, POINT p2, POINT p3, POINT p4, COLORREF color, int thickness); -void Fill(HDC hdc, int x, int y, int color); +void Fill(HDC hdc, LONG x, LONG y, COLORREF color); -void Erase(HDC hdc, short x1, short y1, short x2, short y2, int color, int radius); +void Erase(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF color, LONG radius); -void Replace(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int radius); +void Replace(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, LONG radius); -void Airbrush(HDC hdc, short x, short y, int color, int r); +void Airbrush(HDC hdc, LONG x, LONG y, COLORREF color, LONG r); -void Brush(HDC hdc, short x1, short y1, short x2, short y2, int color, int style); +void Brush(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF color, COLORREF style); -void RectSel(HDC hdc, short x1, short y1, short x2, short y2); +void RectSel(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2); -void SelectionFrame(HDC hdc, int x1, int y1, int x2, int y2); +void SelectionFrame(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2); diff --git a/base/applications/mspaint/globalvar.h b/base/applications/mspaint/globalvar.h index 9c884e4fa9a..d716dd994f3 100644 --- a/base/applications/mspaint/globalvar.h +++ b/base/applications/mspaint/globalvar.h @@ -26,10 +26,10 @@ extern int undoSteps; extern int redoSteps; extern BOOL imageSaved; -extern short startX; -extern short startY; -extern short lastX; -extern short lastY; +extern LONG startX; +extern LONG startY; +extern LONG lastX; +extern LONG lastY; extern int lineWidth; extern int shapeStyle; extern int brushStyle; diff --git a/base/applications/mspaint/history.c b/base/applications/mspaint/history.c index e105dab0f0d..daf526c977d 100644 --- a/base/applications/mspaint/history.c +++ b/base/applications/mspaint/history.c @@ -8,10 +8,7 @@ /* INCLUDES *********************************************************/ -#include -#include "globalvar.h" -#include "dib.h" -#include "definitions.h" +#include "precomp.h" /* FUNCTIONS ********************************************************/ diff --git a/base/applications/mspaint/lang/ro-RO.rc b/base/applications/mspaint/lang/ro-RO.rc index bf69e2216f1..a75ebd873d3 100644 --- a/base/applications/mspaint/lang/ro-RO.rc +++ b/base/applications/mspaint/lang/ro-RO.rc @@ -204,5 +204,3 @@ BEGIN IDS_FILESIZE, "%d bytes" IDS_PRINTRES, "%d x %d pixels per meter" END - -#pragma code_page(default) diff --git a/base/applications/mspaint/lang/ru-RU.rc b/base/applications/mspaint/lang/ru-RU.rc index cdbb5f5fcd7..7b151a2690c 100644 --- a/base/applications/mspaint/lang/ru-RU.rc +++ b/base/applications/mspaint/lang/ru-RU.rc @@ -10,46 +10,46 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT ID_MENU MENU BEGIN - POPUP "&" + POPUP "&Файл" BEGIN - MENUITEM "&\tCtrl+N", IDM_FILENEW - MENUITEM "&...\tCtrl+O", IDM_FILEOPEN - MENUITEM "&\tCtrl+S", IDM_FILESAVE - MENUITEM " &...", IDM_FILESAVEAS + MENUITEM "Созд&ать\tCtrl+N", IDM_FILENEW + MENUITEM "&Открыть...\tCtrl+O", IDM_FILEOPEN + MENUITEM "&Сохранить\tCtrl+S", IDM_FILESAVE + MENUITEM "Сохранить &как...", IDM_FILESAVEAS MENUITEM SEPARATOR - MENUITEM " (&)", IDM_FILEASWALLPAPERPLANE - MENUITEM " ( &)", IDM_FILEASWALLPAPERCENTERED - MENUITEM " (&)", IDM_FILEASWALLPAPERSTRETCHED + MENUITEM "Сделать фоновым рисунком (&замостить)", IDM_FILEASWALLPAPERPLANE + MENUITEM "Сделать фоновым рисунком (по ц&ентру)", IDM_FILEASWALLPAPERCENTERED + MENUITEM "Сделать фоновым рисунком (раст&януть)", IDM_FILEASWALLPAPERSTRETCHED MENUITEM SEPARATOR - MENUITEM "&\tAlt+F4", IDM_FILEEXIT + MENUITEM "В&ыход\tAlt+F4", IDM_FILEEXIT END - POPUP "&" + POPUP "&Правка" BEGIN - MENUITEM "&\tCtrl+Z", IDM_EDITUNDO - MENUITEM "&\tCtrl+Y", IDM_EDITREDO + MENUITEM "&Отменить\tCtrl+Z", IDM_EDITUNDO + MENUITEM "Пов&торить\tCtrl+Y", IDM_EDITREDO MENUITEM SEPARATOR - MENUITEM "&\tCtrl+X", IDM_EDITCUT - MENUITEM "&\tCtrl+C", IDM_EDITCOPY - MENUITEM "&\tCtrl+V", IDM_EDITPASTE - MENUITEM "& \tDel", IDM_EDITDELETESELECTION - MENUITEM " &", IDM_EDITINVERTSELECTION - MENUITEM " &\tCtrl+A", IDM_EDITSELECTALL + MENUITEM "&Вырезать\tCtrl+X", IDM_EDITCUT + MENUITEM "&Копировать\tCtrl+C", IDM_EDITCOPY + MENUITEM "Вст&авить\tCtrl+V", IDM_EDITPASTE + MENUITEM "О&чистить выделение\tDel", IDM_EDITDELETESELECTION + MENUITEM "Обратить в&ыделение", IDM_EDITINVERTSELECTION + MENUITEM "Выделить в&се\tCtrl+A", IDM_EDITSELECTALL MENUITEM SEPARATOR - MENUITEM "& ...", IDM_EDITCOPYTO - MENUITEM " &...", IDM_EDITPASTEFROM + MENUITEM "Копироват&ь в файл...", IDM_EDITCOPYTO + MENUITEM "Вставить из &файла...", IDM_EDITPASTEFROM END - POPUP "&" + POPUP "&Вид" BEGIN - MENUITEM " &\tCtrl+T", IDM_VIEWTOOLBOX, CHECKED - MENUITEM "&\tCtrl+L", IDM_VIEWCOLORPALETTE, CHECKED - MENUITEM "& ", IDM_VIEWSTATUSBAR, CHECKED - MENUITEM " & ", IDM_FORMATICONBAR, CHECKED, GRAYED + MENUITEM "Набор &инструментов\tCtrl+T", IDM_VIEWTOOLBOX, CHECKED + MENUITEM "Па&литра\tCtrl+L", IDM_VIEWCOLORPALETTE, CHECKED + MENUITEM "&Строка состояния", IDM_VIEWSTATUSBAR, CHECKED + MENUITEM "Панель &атрибутов текста", IDM_FORMATICONBAR, CHECKED, GRAYED MENUITEM SEPARATOR - POPUP "&" + POPUP "Мас&штаб" BEGIN - POPUP "" + POPUP "Выбрать" BEGIN MENUITEM "12,5%", IDM_VIEWZOOM125 MENUITEM "25%", IDM_VIEWZOOM25 @@ -60,33 +60,33 @@ BEGIN MENUITEM "800%", IDM_VIEWZOOM800 END MENUITEM SEPARATOR - MENUITEM " ", IDM_VIEWSHOWGRID - MENUITEM " ", IDM_VIEWSHOWMINIATURE + MENUITEM "Показать сетку", IDM_VIEWSHOWGRID + MENUITEM "Показать эскиз", IDM_VIEWSHOWMINIATURE END - MENUITEM " \tCtrl+F", IDM_VIEWFULLSCREEN + MENUITEM "Полный экран\tCtrl+F", IDM_VIEWFULLSCREEN END - POPUP "&" + POPUP "&Рисунок" BEGIN - MENUITEM "&/...\tCtrl+R", IDM_IMAGEROTATEMIRROR - MENUITEM "& ...\tCtrl+W", IDM_IMAGECHANGESIZE - MENUITEM "&", IDM_IMAGECROP - MENUITEM "& \tCtrl+I", IDM_IMAGEINVERTCOLORS - MENUITEM "&...\tCtrl+E", IDM_IMAGEATTRIBUTES - MENUITEM "&\tCtrl+Shft+N", IDM_IMAGEDELETEIMAGE - MENUITEM "& ", IDM_IMAGEDRAWOPAQUE + MENUITEM "&Отразить/повернуть...\tCtrl+R", IDM_IMAGEROTATEMIRROR + MENUITEM "&Изменить размер...\tCtrl+W", IDM_IMAGECHANGESIZE + MENUITEM "Обре&зать", IDM_IMAGECROP + MENUITEM "О&братить цвета\tCtrl+I", IDM_IMAGEINVERTCOLORS + MENUITEM "&Атрибуты...\tCtrl+E", IDM_IMAGEATTRIBUTES + MENUITEM "О&чистить\tCtrl+Shft+N", IDM_IMAGEDELETEIMAGE + MENUITEM "&Непрозрачный фон", IDM_IMAGEDRAWOPAQUE END - POPUP "&" + POPUP "П&алитра" BEGIN - MENUITEM "& ...", IDM_COLORSEDITPALETTE + MENUITEM "&Изменить палитру...", IDM_COLORSEDITPALETTE END POPUP "&?" BEGIN - MENUITEM "& ", IDM_HELPHELPTOPICS + MENUITEM "&Вызов справки", IDM_HELPHELPTOPICS MENUITEM SEPARATOR - MENUITEM "& ...", IDM_HELPINFO + MENUITEM "&О программе...", IDM_HELPINFO END END @@ -115,91 +115,91 @@ END IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU FONT 8, "MS Shell Dlg" -CAPTION " " +CAPTION "Отражение и поворот" BEGIN - GROUPBOX "", IDD_MIRRORROTATEGROUP, 6, 6, 112, 86 - AUTORADIOBUTTON " ", IDD_MIRRORROTATERB1, 12, 18, 100, 10, WS_GROUP - AUTORADIOBUTTON " ", IDD_MIRRORROTATERB2, 12, 30, 100, 10 - AUTORADIOBUTTON " ", IDD_MIRRORROTATERB3, 12, 42, 100, 10 - AUTORADIOBUTTON "90", IDD_MIRRORROTATERB4, 42, 54, 50, 10, WS_GROUP | WS_DISABLED - AUTORADIOBUTTON "180", IDD_MIRRORROTATERB5, 42, 66, 50, 10, WS_DISABLED - AUTORADIOBUTTON "270", IDD_MIRRORROTATERB6, 42, 78, 50, 10, WS_DISABLED + GROUPBOX "Действие", IDD_MIRRORROTATEGROUP, 6, 6, 112, 86 + AUTORADIOBUTTON "Отразить слева направо", IDD_MIRRORROTATERB1, 12, 18, 100, 10, WS_GROUP + AUTORADIOBUTTON "Отразить сверху вниз", IDD_MIRRORROTATERB2, 12, 30, 100, 10 + AUTORADIOBUTTON "Повернуть на угол", IDD_MIRRORROTATERB3, 12, 42, 100, 10 + AUTORADIOBUTTON "90°", IDD_MIRRORROTATERB4, 42, 54, 50, 10, WS_GROUP | WS_DISABLED + AUTORADIOBUTTON "180°", IDD_MIRRORROTATERB5, 42, 66, 50, 10, WS_DISABLED + AUTORADIOBUTTON "270°", IDD_MIRRORROTATERB6, 42, 78, 50, 10, WS_DISABLED DEFPUSHBUTTON "OK", IDOK, 125, 8, 48, 14 - PUSHBUTTON "", IDCANCEL, 125, 24, 48, 14 + PUSHBUTTON "Отмена", IDCANCEL, 125, 24, 48, 14 END IDD_ATTRIBUTES DIALOGEX 100, 100, 210, 120 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU FONT 8, "MS Shell Dlg" -CAPTION "" +CAPTION "Атрибуты" BEGIN EDITTEXT IDD_ATTRIBUTESEDIT1, 40, 40, 35, 12 EDITTEXT IDD_ATTRIBUTESEDIT2, 110, 40, 35, 12 - LTEXT ":", IDD_ATTRIBUTESTEXT1, 10, 42, 30, 10 - LTEXT ":", IDD_ATTRIBUTESTEXT2, 80, 42, 30, 10 - LTEXT " :", IDD_ATTRIBUTESTEXT3, 10, 5, 60, 10 - LTEXT " :", IDD_ATTRIBUTESTEXT4, 10, 15, 60, 10 - LTEXT ":", IDD_ATTRIBUTESTEXT5, 10, 25, 60, 10 - LTEXT " ", IDD_ATTRIBUTESTEXT6, 60, 5, 90, 10 - LTEXT " ", IDD_ATTRIBUTESTEXT7, 60, 15, 90, 10 - LTEXT " ", IDD_ATTRIBUTESTEXT8, 60, 25, 90, 10 - GROUPBOX " ", IDD_ATTRIBUTESGROUP1, 6, 57, 139, 27 - AUTORADIOBUTTON "&", IDD_ATTRIBUTESRB1, 12, 69, 35, 10, WS_GROUP - AUTORADIOBUTTON "&", IDD_ATTRIBUTESRB2, 52, 69, 35, 10 - AUTORADIOBUTTON "&", IDD_ATTRIBUTESRB3, 92, 69, 35, 10 - GROUPBOX "", IDD_ATTRIBUTESGROUP2, 6, 88, 139, 27 - AUTORADIOBUTTON "-", IDD_ATTRIBUTESRB4, 12, 100, 70, 10, WS_GROUP - AUTORADIOBUTTON "", IDD_ATTRIBUTESRB5, 92, 100, 45, 10 + LTEXT "Ширина:", IDD_ATTRIBUTESTEXT1, 10, 42, 30, 10 + LTEXT "Высота:", IDD_ATTRIBUTESTEXT2, 80, 42, 30, 10 + LTEXT "Дата сохранения:", IDD_ATTRIBUTESTEXT3, 10, 5, 60, 10 + LTEXT "Размер на диске:", IDD_ATTRIBUTESTEXT4, 10, 15, 60, 10 + LTEXT "Разрешение:", IDD_ATTRIBUTESTEXT5, 10, 25, 60, 10 + LTEXT "не доступно", IDD_ATTRIBUTESTEXT6, 60, 5, 90, 10 + LTEXT "не доступно", IDD_ATTRIBUTESTEXT7, 60, 15, 90, 10 + LTEXT "не доступно", IDD_ATTRIBUTESTEXT8, 60, 25, 90, 10 + GROUPBOX "Единицы измерения", IDD_ATTRIBUTESGROUP1, 6, 57, 139, 27 + AUTORADIOBUTTON "д&юймы", IDD_ATTRIBUTESRB1, 12, 69, 35, 10, WS_GROUP + AUTORADIOBUTTON "с&м", IDD_ATTRIBUTESRB2, 52, 69, 35, 10 + AUTORADIOBUTTON "т&очки", IDD_ATTRIBUTESRB3, 92, 69, 35, 10 + GROUPBOX "Палитра", IDD_ATTRIBUTESGROUP2, 6, 88, 139, 27 + AUTORADIOBUTTON "черно-белая", IDD_ATTRIBUTESRB4, 12, 100, 70, 10, WS_GROUP + AUTORADIOBUTTON "цветная", IDD_ATTRIBUTESRB5, 92, 100, 45, 10 DEFPUSHBUTTON "OK", IDOK, 150, 8, 57, 14 - PUSHBUTTON "", IDCANCEL, 150, 24, 57, 14 - PUSHBUTTON " &", IDD_ATTRIBUTESSTANDARD, 150, 40, 57, 14 + PUSHBUTTON "Отмена", IDCANCEL, 150, 24, 57, 14 + PUSHBUTTON "По умо&лчанию", IDD_ATTRIBUTESSTANDARD, 150, 40, 57, 14 END IDD_CHANGESIZE DIALOGEX 100, 100, 210, 80 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU FONT 8, "MS Shell Dlg" -CAPTION " " +CAPTION "Изменение размеров" BEGIN - GROUPBOX "", IDD_CHANGESIZEGROUP, 6, 6, 145, 66 + GROUPBOX "Размер", IDD_CHANGESIZEGROUP, 6, 6, 145, 66 ICON IDI_HORZSTRETCH, IDD_CHANGESIZEICON1, 12, 18, 32, 32 - LTEXT " :", IDD_CHANGESIZETEXT1, 39, 24, 62, 10 + LTEXT "По горизонтали:", IDD_CHANGESIZETEXT1, 39, 24, 62, 10 EDITTEXT IDD_CHANGESIZEEDIT1, 102, 23, 32, 12 LTEXT "%", IDD_CHANGESIZETEXT2, 137, 24, 12, 10 ICON IDI_VERTSTRETCH, IDD_CHANGESIZEICON2, 12, 43, 32, 32 - LTEXT " :", IDD_CHANGESIZETEXT3, 39, 49, 62, 10 + LTEXT "По вертикали:", IDD_CHANGESIZETEXT3, 39, 49, 62, 10 EDITTEXT IDD_CHANGESIZEEDIT2, 102, 48, 32, 12 LTEXT "%", IDD_CHANGESIZETEXT4, 137, 49, 12, 10 DEFPUSHBUTTON "OK", IDOK, 155, 8, 48, 14 - PUSHBUTTON "", IDCANCEL, 155, 24, 48, 14 + PUSHBUTTON "Отмена", IDCANCEL, 155, 24, 48, 14 END STRINGTABLE BEGIN IDS_PROGRAMNAME, "Paint" IDS_WINDOWTITLE, "%s - Paint" - IDS_INFOTITLE, "Paint ReactOS" - IDS_INFOTEXT, "Paint ReactOS GNU Lesser General Public License (LGPL) 3 (see www.gnu.org)" - IDS_SAVEPROMPTTEXT, " %s?" - IDS_DEFAULTFILENAME, "_.bmp" - IDS_MINIATURETITLE, "" - IDS_TOOLTIP1, " " - IDS_TOOLTIP2, "" - IDS_TOOLTIP3, "" - IDS_TOOLTIP4, "" - IDS_TOOLTIP5, " " - IDS_TOOLTIP6, "" - IDS_TOOLTIP7, "" - IDS_TOOLTIP8, "" - IDS_TOOLTIP9, "" - IDS_TOOLTIP10, "" - IDS_TOOLTIP11, "" - IDS_TOOLTIP12, "" - IDS_TOOLTIP13, "" - IDS_TOOLTIP14, "" - IDS_TOOLTIP15, "" - IDS_TOOLTIP16, " " - IDS_OPENFILTER, " (*.bmp;*.dib)\1*.bmp;*.dib\1 (*.*)\1*.*\1" - IDS_SAVEFILTER, "24- (*.bmp;*.dib)\1*.bmp;*.dib\1" + IDS_INFOTITLE, "Paint для ReactOS" + IDS_INFOTEXT, "Paint для ReactOS распространяется под лицензией GNU Lesser General Public License (LGPL) версии 3 (see www.gnu.org)" + IDS_SAVEPROMPTTEXT, "Сохранить изменения в %s?" + IDS_DEFAULTFILENAME, "Без_имени.bmp" + IDS_MINIATURETITLE, "Эскиз" + IDS_TOOLTIP1, "Выделение произвольной области" + IDS_TOOLTIP2, "Выделение" + IDS_TOOLTIP3, "Ластик" + IDS_TOOLTIP4, "Заливка" + IDS_TOOLTIP5, "Выбрать цвет" + IDS_TOOLTIP6, "Масштаб" + IDS_TOOLTIP7, "Карандаш" + IDS_TOOLTIP8, "Кисть" + IDS_TOOLTIP9, "Распылитель" + IDS_TOOLTIP10, "Текст" + IDS_TOOLTIP11, "Линия" + IDS_TOOLTIP12, "Кривая" + IDS_TOOLTIP13, "Прямоугольник" + IDS_TOOLTIP14, "Многоугольник" + IDS_TOOLTIP15, "Эллипс" + IDS_TOOLTIP16, "Скругленный прямоугольник" + IDS_OPENFILTER, "Точечные рисунки (*.bmp;*.dib)\1*.bmp;*.dib\1Все файлы (*.*)\1*.*\1" + IDS_SAVEFILTER, "24-разрядный рисунок (*.bmp;*.dib)\1*.bmp;*.dib\1" IDS_FILESIZE, "%d bytes" IDS_PRINTRES, "%d x %d pixels per meter" END diff --git a/base/applications/mspaint/lang/uk-UA.rc b/base/applications/mspaint/lang/uk-UA.rc index bcfe75e215c..d52fa540e08 100644 --- a/base/applications/mspaint/lang/uk-UA.rc +++ b/base/applications/mspaint/lang/uk-UA.rc @@ -10,46 +10,46 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT ID_MENU MENU BEGIN - POPUP "&" + POPUP "&Файл" BEGIN - MENUITEM "&\tCtrl+N", IDM_FILENEW - MENUITEM "&...\tCtrl+O", IDM_FILEOPEN - MENUITEM "&\tCtrl+S", IDM_FILESAVE - MENUITEM " &...", IDM_FILESAVEAS + MENUITEM "&Створити\tCtrl+N", IDM_FILENEW + MENUITEM "В&ідкрити...\tCtrl+O", IDM_FILEOPEN + MENUITEM "З&берегти\tCtrl+S", IDM_FILESAVE + MENUITEM "Зберегти &як...", IDM_FILESAVEAS MENUITEM SEPARATOR - MENUITEM "& Windows", IDM_FILEASWALLPAPERPLANE - MENUITEM " & Windows", IDM_FILEASWALLPAPERCENTERED - MENUITEM "& ()", IDM_FILEASWALLPAPERSTRETCHED + MENUITEM "&Замостити робочий стіл Windows", IDM_FILEASWALLPAPERPLANE + MENUITEM "До ц&ентру робочого стола Windows", IDM_FILEASWALLPAPERCENTERED + MENUITEM "&Встановити як тло (розтягнути)", IDM_FILEASWALLPAPERSTRETCHED MENUITEM SEPARATOR - MENUITEM "&\tAlt+F4", IDM_FILEEXIT + MENUITEM "В&ихід\tAlt+F4", IDM_FILEEXIT END - POPUP "&" + POPUP "&Редагування" BEGIN - MENUITEM "\tCtrl+Z", IDM_EDITUNDO - MENUITEM "\tCtrl+Y", IDM_EDITREDO + MENUITEM "Скасувати\tCtrl+Z", IDM_EDITUNDO + MENUITEM "Повторити\tCtrl+Y", IDM_EDITREDO MENUITEM SEPARATOR - MENUITEM "\tCtrl+X", IDM_EDITCUT - MENUITEM "\tCtrl+C", IDM_EDITCOPY - MENUITEM "\tCtrl+V", IDM_EDITPASTE - MENUITEM " \tDel", IDM_EDITDELETESELECTION - MENUITEM " ", IDM_EDITINVERTSELECTION - MENUITEM " \tCtrl+A", IDM_EDITSELECTALL + MENUITEM "Вирізати\tCtrl+X", IDM_EDITCUT + MENUITEM "Копіювати\tCtrl+C", IDM_EDITCOPY + MENUITEM "Вставити\tCtrl+V", IDM_EDITPASTE + MENUITEM "Видалити виділення\tDel", IDM_EDITDELETESELECTION + MENUITEM "Обернути виділення", IDM_EDITINVERTSELECTION + MENUITEM "Виділити все\tCtrl+A", IDM_EDITSELECTALL MENUITEM SEPARATOR - MENUITEM " ...", IDM_EDITCOPYTO - MENUITEM " ...", IDM_EDITPASTEFROM + MENUITEM "Копіювати до файлу...", IDM_EDITCOPYTO + MENUITEM "Вставити з файлу...", IDM_EDITPASTEFROM END - POPUP "&" + POPUP "В&игляд" BEGIN - MENUITEM " \tCtrl+T", IDM_VIEWTOOLBOX, CHECKED - MENUITEM "\tCtrl+L", IDM_VIEWCOLORPALETTE, CHECKED - MENUITEM " ", IDM_VIEWSTATUSBAR, CHECKED - MENUITEM " ", IDM_FORMATICONBAR, CHECKED, GRAYED + MENUITEM "Панель елементів\tCtrl+T", IDM_VIEWTOOLBOX, CHECKED + MENUITEM "Палітра\tCtrl+L", IDM_VIEWCOLORPALETTE, CHECKED + MENUITEM "Рядок стану", IDM_VIEWSTATUSBAR, CHECKED + MENUITEM "Панель атрибутів тексту", IDM_FORMATICONBAR, CHECKED, GRAYED MENUITEM SEPARATOR - POPUP "" + POPUP "Масштаб" BEGIN - POPUP "" + POPUP "Користувацький" BEGIN MENUITEM "12,5%", IDM_VIEWZOOM125 MENUITEM "25%", IDM_VIEWZOOM25 @@ -60,33 +60,33 @@ BEGIN MENUITEM "800%", IDM_VIEWZOOM800 END MENUITEM SEPARATOR - MENUITEM " ", IDM_VIEWSHOWGRID - MENUITEM " ", IDM_VIEWSHOWMINIATURE + MENUITEM "Показати сітку", IDM_VIEWSHOWGRID + MENUITEM "Показати в мініатюрі", IDM_VIEWSHOWMINIATURE END - MENUITEM " \tCtrl+F", IDM_VIEWFULLSCREEN + MENUITEM "На весь екран\tCtrl+F", IDM_VIEWFULLSCREEN END - POPUP "&" + POPUP "&Зображення" BEGIN - MENUITEM "³/...\tCtrl+R", IDM_IMAGEROTATEMIRROR - MENUITEM " ...\tCtrl+W", IDM_IMAGECHANGESIZE - MENUITEM "", IDM_IMAGECROP - MENUITEM " \tCtrl+I", IDM_IMAGEINVERTCOLORS - MENUITEM "...\tCtrl+E", IDM_IMAGEATTRIBUTES - MENUITEM " \tCtrl+Shft+N", IDM_IMAGEDELETEIMAGE - MENUITEM " ", IDM_IMAGEDRAWOPAQUE + MENUITEM "Відобразити/повернути...\tCtrl+R", IDM_IMAGEROTATEMIRROR + MENUITEM "Змінити розмір...\tCtrl+W", IDM_IMAGECHANGESIZE + MENUITEM "Обітнути", IDM_IMAGECROP + MENUITEM "Обернути кольори\tCtrl+I", IDM_IMAGEINVERTCOLORS + MENUITEM "Атрибути...\tCtrl+E", IDM_IMAGEATTRIBUTES + MENUITEM "Видалити малюнок\tCtrl+Shft+N", IDM_IMAGEDELETEIMAGE + MENUITEM "Непрозоре тло", IDM_IMAGEDRAWOPAQUE END - POPUP "&" + POPUP "&Кольори" BEGIN - MENUITEM " ...", IDM_COLORSEDITPALETTE + MENUITEM "Змінити палітру...", IDM_COLORSEDITPALETTE END - POPUP "&" + POPUP "&Довідка" BEGIN - MENUITEM " ", IDM_HELPHELPTOPICS + MENUITEM "Виклик довідки", IDM_HELPHELPTOPICS MENUITEM SEPARATOR - MENUITEM "", IDM_HELPINFO + MENUITEM "Інформація", IDM_HELPINFO END END @@ -115,91 +115,91 @@ END IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU FONT 8, "MS Shell Dlg" -CAPTION "³ " +CAPTION "Відображення й поворот" BEGIN - GROUPBOX " ", IDD_MIRRORROTATEGROUP, 6, 6, 112, 86 - AUTORADIOBUTTON "³ ", IDD_MIRRORROTATERB1, 12, 18, 100, 10, WS_GROUP - AUTORADIOBUTTON "³ ", IDD_MIRRORROTATERB2, 12, 30, 100, 10 - AUTORADIOBUTTON " ", IDD_MIRRORROTATERB3, 12, 42, 100, 10 - AUTORADIOBUTTON "90", IDD_MIRRORROTATERB4, 42, 54, 50, 10, WS_GROUP | WS_DISABLED - AUTORADIOBUTTON "180", IDD_MIRRORROTATERB5, 42, 66, 50, 10, WS_DISABLED - AUTORADIOBUTTON "270", IDD_MIRRORROTATERB6, 42, 78, 50, 10, WS_DISABLED + GROUPBOX "Перегорнути або повернути", IDD_MIRRORROTATEGROUP, 6, 6, 112, 86 + AUTORADIOBUTTON "Відобразити зліва направо", IDD_MIRRORROTATERB1, 12, 18, 100, 10, WS_GROUP + AUTORADIOBUTTON "Відобразити зверху вниз", IDD_MIRRORROTATERB2, 12, 30, 100, 10 + AUTORADIOBUTTON "Повернути на кут", IDD_MIRRORROTATERB3, 12, 42, 100, 10 + AUTORADIOBUTTON "90°", IDD_MIRRORROTATERB4, 42, 54, 50, 10, WS_GROUP | WS_DISABLED + AUTORADIOBUTTON "180°", IDD_MIRRORROTATERB5, 42, 66, 50, 10, WS_DISABLED + AUTORADIOBUTTON "270°", IDD_MIRRORROTATERB6, 42, 78, 50, 10, WS_DISABLED DEFPUSHBUTTON "OK", IDOK, 125, 8, 48, 14 - PUSHBUTTON "", IDCANCEL, 125, 24, 48, 14 + PUSHBUTTON "Скасувати", IDCANCEL, 125, 24, 48, 14 END IDD_ATTRIBUTES DIALOGEX 100, 100, 210, 120 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU FONT 8, "MS Shell Dlg" -CAPTION "" +CAPTION "Атрибути" BEGIN EDITTEXT IDD_ATTRIBUTESEDIT1, 40, 40, 35, 12 EDITTEXT IDD_ATTRIBUTESEDIT2, 110, 40, 35, 12 - LTEXT ":", IDD_ATTRIBUTESTEXT1, 10, 40, 30, 10 - LTEXT ":", IDD_ATTRIBUTESTEXT2, 80, 40, 30, 10 - LTEXT " :", IDD_ATTRIBUTESTEXT3, 10, 5, 60, 10 - LTEXT " :", IDD_ATTRIBUTESTEXT4, 10, 15, 60, 10 - LTEXT ":", IDD_ATTRIBUTESTEXT5, 10, 25, 60, 10 - LTEXT "", IDD_ATTRIBUTESTEXT6, 60, 5, 90, 10 - LTEXT "", IDD_ATTRIBUTESTEXT7, 60, 15, 90, 10 - LTEXT "", IDD_ATTRIBUTESTEXT8, 60, 25, 90, 10 - GROUPBOX " ", IDD_ATTRIBUTESGROUP1, 6, 57, 139, 27 - AUTORADIOBUTTON "", IDD_ATTRIBUTESRB1, 12, 69, 35, 10, WS_GROUP - AUTORADIOBUTTON "", IDD_ATTRIBUTESRB2, 52, 69, 35, 10 - AUTORADIOBUTTON "", IDD_ATTRIBUTESRB3, 92, 69, 35, 10 - GROUPBOX "", IDD_ATTRIBUTESGROUP2, 6, 88, 139, 27 - AUTORADIOBUTTON "-", IDD_ATTRIBUTESRB4, 12, 100, 70, 10, WS_GROUP - AUTORADIOBUTTON "", IDD_ATTRIBUTESRB5, 92, 100, 39, 10 + LTEXT "Ширина:", IDD_ATTRIBUTESTEXT1, 10, 40, 30, 10 + LTEXT "Висота:", IDD_ATTRIBUTESTEXT2, 80, 40, 30, 10 + LTEXT "Дата файлу:", IDD_ATTRIBUTESTEXT3, 10, 5, 60, 10 + LTEXT "Розмір файлу:", IDD_ATTRIBUTESTEXT4, 10, 15, 60, 10 + LTEXT "Розширення:", IDD_ATTRIBUTESTEXT5, 10, 25, 60, 10 + LTEXT "Недоступно", IDD_ATTRIBUTESTEXT6, 60, 5, 90, 10 + LTEXT "Недоступно", IDD_ATTRIBUTESTEXT7, 60, 15, 90, 10 + LTEXT "Недоступно", IDD_ATTRIBUTESTEXT8, 60, 25, 90, 10 + GROUPBOX "Одиниці вимірювання", IDD_ATTRIBUTESGROUP1, 6, 57, 139, 27 + AUTORADIOBUTTON "дюйми", IDD_ATTRIBUTESRB1, 12, 69, 35, 10, WS_GROUP + AUTORADIOBUTTON "см", IDD_ATTRIBUTESRB2, 52, 69, 35, 10 + AUTORADIOBUTTON "пікселі", IDD_ATTRIBUTESRB3, 92, 69, 35, 10 + GROUPBOX "Кольори", IDD_ATTRIBUTESGROUP2, 6, 88, 139, 27 + AUTORADIOBUTTON "чорно-білий", IDD_ATTRIBUTESRB4, 12, 100, 70, 10, WS_GROUP + AUTORADIOBUTTON "кольори", IDD_ATTRIBUTESRB5, 92, 100, 39, 10 DEFPUSHBUTTON "OK", IDOK, 155, 8, 48, 14 - PUSHBUTTON "", IDCANCEL, 155, 24, 48, 14 - PUSHBUTTON "", IDD_ATTRIBUTESSTANDARD, 155, 40, 48, 14 + PUSHBUTTON "Скасувати", IDCANCEL, 155, 24, 48, 14 + PUSHBUTTON "Стандартно", IDD_ATTRIBUTESSTANDARD, 155, 40, 48, 14 END IDD_CHANGESIZE DIALOGEX 100, 100, 210, 80 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU FONT 8, "MS Shell Dlg" -CAPTION " " +CAPTION "Зміна розміру" BEGIN - GROUPBOX " ", IDD_CHANGESIZEGROUP, 6, 6, 142, 66 + GROUPBOX "Зміна розміру", IDD_CHANGESIZEGROUP, 6, 6, 142, 66 ICON IDI_HORZSTRETCH, IDD_CHANGESIZEICON1, 12, 18, 32, 32 - LTEXT ":", IDD_CHANGESIZETEXT1, 45, 24, 45, 10 + LTEXT "Горизонталь:", IDD_CHANGESIZETEXT1, 45, 24, 45, 10 EDITTEXT IDD_CHANGESIZEEDIT1, 92, 23, 32, 12 LTEXT "%", IDD_CHANGESIZETEXT2, 127, 24, 15, 10 ICON IDI_VERTSTRETCH, IDD_CHANGESIZEICON2, 12, 43, 32, 32 - LTEXT ":", IDD_CHANGESIZETEXT3, 45, 49, 40, 10 + LTEXT "Вертикаль:", IDD_CHANGESIZETEXT3, 45, 49, 40, 10 EDITTEXT IDD_CHANGESIZEEDIT2, 92, 48, 32, 12 LTEXT "%", IDD_CHANGESIZETEXT4, 127, 49, 15, 10 DEFPUSHBUTTON "OK", IDOK, 155, 8, 48, 14 - PUSHBUTTON "", IDCANCEL, 155, 24, 48, 14 + PUSHBUTTON "Скасувати", IDCANCEL, 155, 24, 48, 14 END STRINGTABLE BEGIN IDS_PROGRAMNAME, "Paint" IDS_WINDOWTITLE, "%s - Paint" - IDS_INFOTITLE, "Paint ReactOS" - IDS_INFOTEXT, "Paint ReactOS GNU Lesser General Public License (LGPL) 3 ( www.gnu.org)" - IDS_SAVEPROMPTTEXT, " %s?" - IDS_DEFAULTFILENAME, "_.bmp" - IDS_MINIATURETITLE, "̳" - IDS_TOOLTIP1, " " - IDS_TOOLTIP2, "" - IDS_TOOLTIP3, "" - IDS_TOOLTIP4, "" - IDS_TOOLTIP5, " " - IDS_TOOLTIP6, "" - IDS_TOOLTIP7, "" - IDS_TOOLTIP8, "" - IDS_TOOLTIP9, "" - IDS_TOOLTIP10, "" - IDS_TOOLTIP11, "˳" - IDS_TOOLTIP12, " '" - IDS_TOOLTIP13, "" - IDS_TOOLTIP14, "" - IDS_TOOLTIP15, "" - IDS_TOOLTIP16, " " - IDS_OPENFILTER, " (*.bmp;*.dib)\1*.bmp;*.dib\1 (*.*)\1*.*\1" - IDS_SAVEFILTER, "24- (*.bmp;*.dib)\1*.bmp;*.dib\1" - IDS_FILESIZE, "%d " - IDS_PRINTRES, "%d x %d . " + IDS_INFOTITLE, "Paint для ReactOS" + IDS_INFOTEXT, "Paint для ReactOS доступний згідно з GNU Lesser General Public License (LGPL) версії 3 (дивіться www.gnu.org)" + IDS_SAVEPROMPTTEXT, "Зберегти зміни до %s?" + IDS_DEFAULTFILENAME, "Без_імені.bmp" + IDS_MINIATURETITLE, "Мініатюра" + IDS_TOOLTIP1, "Виділення довільної області" + IDS_TOOLTIP2, "Виділення" + IDS_TOOLTIP3, "Гумка" + IDS_TOOLTIP4, "Заливка" + IDS_TOOLTIP5, "Вибір кольорів" + IDS_TOOLTIP6, "Масштаб" + IDS_TOOLTIP7, "Олівець" + IDS_TOOLTIP8, "Пензель" + IDS_TOOLTIP9, "Розпилювач" + IDS_TOOLTIP10, "Текст" + IDS_TOOLTIP11, "Лінія" + IDS_TOOLTIP12, "Крива Без'є" + IDS_TOOLTIP13, "Прямокутник" + IDS_TOOLTIP14, "Багатокутник" + IDS_TOOLTIP15, "Еліпс" + IDS_TOOLTIP16, "Прямокутник з округленими кутами" + IDS_OPENFILTER, "Точкові рисунки (*.bmp;*.dib)\1*.bmp;*.dib\1Усі файли (*.*)\1*.*\1" + IDS_SAVEFILTER, "24-розрядний рисунок (*.bmp;*.dib)\1*.bmp;*.dib\1" + IDS_FILESIZE, "%d байт" + IDS_PRINTRES, "%d x %d пікс. на метр" END diff --git a/base/applications/mspaint/lang/zh-CN.rc b/base/applications/mspaint/lang/zh-CN.rc new file mode 100644 index 00000000000..2986838a5e5 --- /dev/null +++ b/base/applications/mspaint/lang/zh-CN.rc @@ -0,0 +1,206 @@ +/* + * PROJECT: PAINT for ReactOS + * LICENSE: unknown (LGPL assumed) + * FILE: base/applications/paint/lang/zh-CN.rc + * PURPOSE: Chinese Language resource file + * TRANSLATORS: Song Fuchang (0xfc) + */ + +LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED + +ID_MENU MENU +BEGIN + POPUP "文件(&F)" + BEGIN + MENUITEM "新建(&N)\tCtrl+N", IDM_FILENEW + MENUITEM "打开... (&O)\tCtrl+O", IDM_FILEOPEN + MENUITEM "保存(&S)\tCtrl+S", IDM_FILESAVE + MENUITEM "另存为... (&A)", IDM_FILESAVEAS + MENUITEM SEPARATOR + MENUITEM "保存为壁纸 (普通)", IDM_FILEASWALLPAPERPLANE + MENUITEM "保存为壁纸 (居中)", IDM_FILEASWALLPAPERCENTERED + MENUITEM "保存为壁纸 (拉伸)", IDM_FILEASWALLPAPERSTRETCHED + MENUITEM SEPARATOR + MENUITEM "退出(&Q)\tAlt+F4", IDM_FILEEXIT + END + + POPUP "编辑(&E)" + BEGIN + MENUITEM "撤销\tCtrl+Z", IDM_EDITUNDO + MENUITEM "重做\tCtrl+Y", IDM_EDITREDO + MENUITEM SEPARATOR + MENUITEM "剪切\tCtrl+X", IDM_EDITCUT + MENUITEM "复制\tCtrl+C", IDM_EDITCOPY + MENUITEM "粘贴\tCtrl+V", IDM_EDITPASTE + MENUITEM "删除选中区域\tDel", IDM_EDITDELETESELECTION + MENUITEM "反转选择", IDM_EDITINVERTSELECTION + MENUITEM "全部选择\tCtrl+A", IDM_EDITSELECTALL + MENUITEM SEPARATOR + MENUITEM "复制到...", IDM_EDITCOPYTO + MENUITEM "从...粘贴", IDM_EDITPASTEFROM + END + + POPUP "查看(&V)" + BEGIN + MENUITEM "工具箱\tCtrl+T", IDM_VIEWTOOLBOX, CHECKED + MENUITEM "调色板\tCtrl+L", IDM_VIEWCOLORPALETTE, CHECKED + MENUITEM "状态栏", IDM_VIEWSTATUSBAR, CHECKED + MENUITEM "文字工具栏", IDM_FORMATICONBAR, CHECKED, GRAYED + MENUITEM SEPARATOR + POPUP "缩放" + BEGIN + POPUP "用户定义" + BEGIN + MENUITEM "12.5%", IDM_VIEWZOOM125 + MENUITEM "25%", IDM_VIEWZOOM25 + MENUITEM "50%", IDM_VIEWZOOM50 + MENUITEM "100%", IDM_VIEWZOOM100 + MENUITEM "200%", IDM_VIEWZOOM200 + MENUITEM "400%", IDM_VIEWZOOM400 + MENUITEM "800%", IDM_VIEWZOOM800 + END + MENUITEM SEPARATOR + MENUITEM "显示网格\tCtrl+G", IDM_VIEWSHOWGRID + MENUITEM "显示缩略图", IDM_VIEWSHOWMINIATURE + END + MENUITEM "全屏显示\tCtrl+F", IDM_VIEWFULLSCREEN + END + + POPUP "图像(&I)" + BEGIN + MENUITEM "旋转/镜像...\tCtrl+R", IDM_IMAGEROTATEMIRROR + MENUITEM "改变大小...\tCtrl+W", IDM_IMAGECHANGESIZE + MENUITEM "剪裁", IDM_IMAGECROP + MENUITEM "颜色反转\tCtrl+I", IDM_IMAGEINVERTCOLORS + MENUITEM "属性...\tCtrl+E", IDM_IMAGEATTRIBUTES + MENUITEM "删除图像\tCtrl+Shft+N", IDM_IMAGEDELETEIMAGE + MENUITEM "不透明处理", IDM_IMAGEDRAWOPAQUE + END + + POPUP "颜色(&C)" + BEGIN + MENUITEM "编辑调色板...", IDM_COLORSEDITPALETTE + END + + POPUP "帮助(&?)" + BEGIN + MENUITEM "帮助主题", IDM_HELPHELPTOPICS + MENUITEM SEPARATOR + MENUITEM "信息", IDM_HELPINFO + END +END + +ID_ACCELERATORS ACCELERATORS +BEGIN + "^N", IDM_FILENEW + "^O", IDM_FILEOPEN + "^S", IDM_FILESAVE + "^Z", IDM_EDITUNDO + "^Y", IDM_EDITREDO + "^X", IDM_EDITCUT + "^C", IDM_EDITCOPY + "^V", IDM_EDITPASTE + VK_DELETE, IDM_EDITDELETESELECTION, VIRTKEY + "^A", IDM_EDITSELECTALL + "^T", IDM_VIEWTOOLBOX + "^L", IDM_VIEWCOLORPALETTE + "^G", IDM_VIEWSHOWGRID + "^F", IDM_VIEWFULLSCREEN + "^R", IDM_IMAGEROTATEMIRROR + "^W", IDM_IMAGECHANGESIZE + "^I", IDM_IMAGEINVERTCOLORS + "^E", IDM_IMAGEATTRIBUTES + "N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY +END + +IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100 +STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +FONT 8, "MS Shell Dlg" +CAPTION "旋转和镜像图像" +BEGIN + GROUPBOX "旋转或镜像", IDD_MIRRORROTATEGROUP, 6, 6, 112, 86 + AUTORADIOBUTTON "水平镜像", IDD_MIRRORROTATERB1, 12, 18, 100, 10, WS_GROUP + AUTORADIOBUTTON "垂直镜像", IDD_MIRRORROTATERB2, 12, 30, 100, 10 + AUTORADIOBUTTON "旋转角度", IDD_MIRRORROTATERB3, 12, 42, 100, 10 + AUTORADIOBUTTON "90°", IDD_MIRRORROTATERB4, 42, 54, 50, 10, WS_GROUP | WS_DISABLED + AUTORADIOBUTTON "180°", IDD_MIRRORROTATERB5, 42, 66, 50, 10, WS_DISABLED + AUTORADIOBUTTON "270°", IDD_MIRRORROTATERB6, 42, 78, 50, 10, WS_DISABLED + DEFPUSHBUTTON "确定", IDOK, 125, 8, 48, 14 + PUSHBUTTON "取消", IDCANCEL, 125, 24, 48, 14 +END + +IDD_ATTRIBUTES DIALOGEX 100, 100, 210, 120 +STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +FONT 8, "MS Shell Dlg" +CAPTION "属性" +BEGIN + EDITTEXT IDD_ATTRIBUTESEDIT1, 40, 40, 35, 12 + EDITTEXT IDD_ATTRIBUTESEDIT2, 110, 40, 35, 12 + LTEXT "宽度:", IDD_ATTRIBUTESTEXT1, 10, 40, 30, 10 + LTEXT "高度:", IDD_ATTRIBUTESTEXT2, 80, 40, 30, 10 + LTEXT "文件日期:", IDD_ATTRIBUTESTEXT3, 10, 5, 60, 10 + LTEXT "文件大小:", IDD_ATTRIBUTESTEXT4, 10, 15, 60, 10 + LTEXT "分辨率:", IDD_ATTRIBUTESTEXT5, 10, 25, 60, 10 + LTEXT "不可用", IDD_ATTRIBUTESTEXT6, 60, 5, 90, 10 + LTEXT "不可用", IDD_ATTRIBUTESTEXT7, 60, 15, 90, 10 + LTEXT "不可用", IDD_ATTRIBUTESTEXT8, 60, 25, 90, 10 + GROUPBOX "单位", IDD_ATTRIBUTESGROUP1, 6, 57, 139, 27 + AUTORADIOBUTTON "英寸", IDD_ATTRIBUTESRB1, 12, 69, 35, 10, WS_GROUP + AUTORADIOBUTTON "厘米", IDD_ATTRIBUTESRB2, 52, 69, 35, 10 + AUTORADIOBUTTON "像素", IDD_ATTRIBUTESRB3, 92, 69, 35, 10 + GROUPBOX "颜色", IDD_ATTRIBUTESGROUP2, 6, 88, 139, 27 + AUTORADIOBUTTON "黑白", IDD_ATTRIBUTESRB4, 12, 100, 70, 10, WS_GROUP + AUTORADIOBUTTON "彩色", IDD_ATTRIBUTESRB5, 92, 100, 35, 10 + DEFPUSHBUTTON "确定", IDOK, 155, 8, 48, 14 + PUSHBUTTON "取消", IDCANCEL, 155, 24, 48, 14 + PUSHBUTTON "缺省", IDD_ATTRIBUTESSTANDARD, 155, 40, 48, 14 +END + +IDD_CHANGESIZE DIALOGEX 100, 100, 210, 80 +STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +FONT 8, "MS Shell Dlg" +CAPTION "改变大小" +BEGIN + GROUPBOX "改变大小", IDD_CHANGESIZEGROUP, 6, 6, 142, 66 + ICON IDI_HORZSTRETCH, IDD_CHANGESIZEICON1, 12, 18, 32, 32 + LTEXT "水平:", IDD_CHANGESIZETEXT1, 45, 24, 40, 10 + EDITTEXT IDD_CHANGESIZEEDIT1, 90, 23, 32, 12 + LTEXT "%", IDD_CHANGESIZETEXT2, 125, 24, 15, 10 + ICON IDI_VERTSTRETCH, IDD_CHANGESIZEICON2, 12, 43, 32, 32 + LTEXT "垂直:", IDD_CHANGESIZETEXT3, 45, 49, 40, 10 + EDITTEXT IDD_CHANGESIZEEDIT2, 90, 48, 32, 12 + LTEXT "%", IDD_CHANGESIZETEXT4, 125, 49, 15, 10 + DEFPUSHBUTTON "确定", IDOK, 155, 8, 48, 14 + PUSHBUTTON "取消", IDCANCEL, 155, 24, 48, 14 +END + +STRINGTABLE +BEGIN + IDS_PROGRAMNAME, "画图" + IDS_WINDOWTITLE, "%s - 画图" + IDS_INFOTITLE, "ReactOS 画图" + IDS_INFOTEXT, "ReactOS 画图是在 GNU LGPL 协议版本 3 下发布的 (详见 www.gnu.org)" + IDS_SAVEPROMPTTEXT, "您想把改变保存到 %s 吗?" + IDS_DEFAULTFILENAME, "未命名.bmp" + IDS_MINIATURETITLE, "缩略图" + IDS_TOOLTIP1, "自由选择" + IDS_TOOLTIP2, "选择" + IDS_TOOLTIP3, "橡皮擦" + IDS_TOOLTIP4, "填充" + IDS_TOOLTIP5, "取色" + IDS_TOOLTIP6, "缩放" + IDS_TOOLTIP7, "铅笔" + IDS_TOOLTIP8, "刷子" + IDS_TOOLTIP9, "喷枪" + IDS_TOOLTIP10, "文字" + IDS_TOOLTIP11, "直线" + IDS_TOOLTIP12, "贝塞尔曲线" + IDS_TOOLTIP13, "矩形" + IDS_TOOLTIP14, "多边形" + IDS_TOOLTIP15, "椭圆" + IDS_TOOLTIP16, "圆角矩形" + IDS_OPENFILTER, "位图文件 (*.bmp;*.dib)\1*.bmp;*.dib\1All files (*.*)\1*.*\1" + IDS_SAVEFILTER, "24 位位图文件 (*.bmp;*.dib)\1*.bmp;*.dib\1" + IDS_FILESIZE, "%d 字节" + IDS_PRINTRES, "%d x %d 像素每米" +END diff --git a/base/applications/mspaint/main.c b/base/applications/mspaint/main.c index 3c77cb23999..cf15d3235fd 100644 --- a/base/applications/mspaint/main.c +++ b/base/applications/mspaint/main.c @@ -8,25 +8,7 @@ /* INCLUDES *********************************************************/ -#include -#include -#include -#include -#include -#include "definitions.h" - -#include "drawing.h" -#include "dib.h" - -#include "globalvar.h" -#include "history.h" -#include "mouse.h" - -#include "winproc.h" -#include "palette.h" -#include "toolsettings.h" -#include "selection.h" -#include "sizebox.h" +#include "precomp.h" /* FUNCTIONS ********************************************************/ @@ -43,10 +25,10 @@ int undoSteps = 0; int redoSteps = 0; BOOL imageSaved = TRUE; -short startX; -short startY; -short lastX; -short lastY; +LONG startX; +LONG startY; +LONG lastX; +LONG lastY; int lineWidth = 1; int shapeStyle = 0; int brushStyle = 0; @@ -168,8 +150,8 @@ _tWinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPTSTR lpszArgument wincl.lpfnWndProc = WindowProcedure; wincl.style = CS_DBLCLKS; wincl.cbSize = sizeof(WNDCLASSEX); - wincl.hIcon = LoadIcon(NULL, IDI_APPLICATION); - wincl.hIconSm = LoadIcon(hThisInstance, MAKEINTRESOURCE(500)); + wincl.hIcon = LoadIcon(hThisInstance, MAKEINTRESOURCE(IDI_APPICON)); + wincl.hIconSm = LoadIcon(hThisInstance, MAKEINTRESOURCE(IDI_APPICON)); wincl.hCursor = LoadCursor(NULL, IDC_ARROW); wincl.lpszMenuName = NULL; wincl.cbClsExtra = 0; diff --git a/base/applications/mspaint/mouse.c b/base/applications/mspaint/mouse.c index 0cda1879313..84909fb1f9b 100644 --- a/base/applications/mspaint/mouse.c +++ b/base/applications/mspaint/mouse.c @@ -8,10 +8,7 @@ /* INCLUDES *********************************************************/ -#include "globalvar.h" -#include "dib.h" -#include "drawing.h" -#include "history.h" +#include "precomp.h" /* FUNCTIONS ********************************************************/ @@ -26,7 +23,7 @@ placeSelWin() } void -regularize(short x0, short y0, short *x1, short *y1) +regularize(LONG x0, LONG y0, LONG *x1, LONG *y1) { if (abs(*x1 - x0) >= abs(*y1 - y0)) *y1 = y0 + (*y1 > y0 ? abs(*x1 - x0) : -abs(*x1 - x0)); @@ -35,7 +32,7 @@ regularize(short x0, short y0, short *x1, short *y1) } void -roundTo8Directions(short x0, short y0, short *x1, short *y1) +roundTo8Directions(LONG x0, LONG y0, LONG *x1, LONG *y1) { if (abs(*x1 - x0) >= abs(*y1 - y0)) { @@ -59,7 +56,7 @@ POINT *ptStack = NULL; int ptSP = 0; void -startPaintingL(HDC hdc, short x, short y, int fg, int bg) +startPaintingL(HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg) { startX = x; startY = y; @@ -132,7 +129,7 @@ startPaintingL(HDC hdc, short x, short y, int fg, int bg) } void -whilePaintingL(HDC hdc, short x, short y, int fg, int bg) +whilePaintingL(HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg) { switch (activeTool) { @@ -149,8 +146,8 @@ whilePaintingL(HDC hdc, short x, short y, int fg, int bg) break; case TOOL_RECTSEL: { - short tempX; - short tempY; + int tempX; + int tempY; resetToU1(); tempX = max(0, min(x, imgXRes)); tempY = max(0, min(y, imgYRes)); @@ -209,7 +206,7 @@ whilePaintingL(HDC hdc, short x, short y, int fg, int bg) pointStack[pointSP].y = y; if ((pointSP > 0) && (GetAsyncKeyState(VK_SHIFT) < 0)) roundTo8Directions(pointStack[pointSP - 1].x, pointStack[pointSP - 1].y, - (short *)&pointStack[pointSP].x, (short *)&pointStack[pointSP].y); + &pointStack[pointSP].x, &pointStack[pointSP].y); if (pointSP + 1 >= 2) Poly(hdc, pointStack, pointSP + 1, fg, bg, lineWidth, shapeStyle, FALSE); break; @@ -232,7 +229,7 @@ whilePaintingL(HDC hdc, short x, short y, int fg, int bg) } void -endPaintingL(HDC hdc, short x, short y, int fg, int bg) +endPaintingL(HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg) { switch (activeTool) { @@ -350,7 +347,7 @@ endPaintingL(HDC hdc, short x, short y, int fg, int bg) pointStack[pointSP].y = y; if ((pointSP > 0) && (GetAsyncKeyState(VK_SHIFT) < 0)) roundTo8Directions(pointStack[pointSP - 1].x, pointStack[pointSP - 1].y, - (short *)&pointStack[pointSP].x, (short *)&pointStack[pointSP].y); + &pointStack[pointSP].x, &pointStack[pointSP].y); pointSP++; if (pointSP >= 2) { @@ -384,7 +381,7 @@ endPaintingL(HDC hdc, short x, short y, int fg, int bg) } void -startPaintingR(HDC hdc, short x, short y, int fg, int bg) +startPaintingR(HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg) { startX = x; startY = y; @@ -444,7 +441,7 @@ startPaintingR(HDC hdc, short x, short y, int fg, int bg) } void -whilePaintingR(HDC hdc, short x, short y, int fg, int bg) +whilePaintingR(HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg) { switch (activeTool) { @@ -496,7 +493,7 @@ whilePaintingR(HDC hdc, short x, short y, int fg, int bg) pointStack[pointSP].y = y; if ((pointSP > 0) && (GetAsyncKeyState(VK_SHIFT) < 0)) roundTo8Directions(pointStack[pointSP - 1].x, pointStack[pointSP - 1].y, - (short *)&pointStack[pointSP].x, (short *)&pointStack[pointSP].y); + &pointStack[pointSP].x, &pointStack[pointSP].y); if (pointSP + 1 >= 2) Poly(hdc, pointStack, pointSP + 1, bg, fg, lineWidth, shapeStyle, FALSE); break; @@ -519,7 +516,7 @@ whilePaintingR(HDC hdc, short x, short y, int fg, int bg) } void -endPaintingR(HDC hdc, short x, short y, int fg, int bg) +endPaintingR(HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg) { switch (activeTool) { @@ -553,7 +550,7 @@ endPaintingR(HDC hdc, short x, short y, int fg, int bg) pointStack[pointSP].y = y; if ((pointSP > 0) && (GetAsyncKeyState(VK_SHIFT) < 0)) roundTo8Directions(pointStack[pointSP - 1].x, pointStack[pointSP - 1].y, - (short *)&pointStack[pointSP].x, (short *)&pointStack[pointSP].y); + &pointStack[pointSP].x, &pointStack[pointSP].y); pointSP++; if (pointSP >= 2) { diff --git a/base/applications/mspaint/mouse.h b/base/applications/mspaint/mouse.h index acb083c0a8b..ea56ba8b6ba 100644 --- a/base/applications/mspaint/mouse.h +++ b/base/applications/mspaint/mouse.h @@ -8,14 +8,14 @@ void placeSelWin(void); -void startPaintingL(HDC hdc, short x, short y, int fg, int bg); +void startPaintingL(HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg); -void whilePaintingL(HDC hdc, short x, short y, int fg, int bg); +void whilePaintingL(HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg); -void endPaintingL(HDC hdc, short x, short y, int fg, int bg); +void endPaintingL(HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg); -void startPaintingR(HDC hdc, short x, short y, int fg, int bg); +void startPaintingR(HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg); -void whilePaintingR(HDC hdc, short x, short y, int fg, int bg); +void whilePaintingR(HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg); -void endPaintingR(HDC hdc, short x, short y, int fg, int bg); +void endPaintingR(HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg); diff --git a/base/applications/mspaint/palette.c b/base/applications/mspaint/palette.c index cc68516e2a3..2626971ec5a 100644 --- a/base/applications/mspaint/palette.c +++ b/base/applications/mspaint/palette.c @@ -8,8 +8,7 @@ /* INCLUDES *********************************************************/ -#include -#include "globalvar.h" +#include "precomp.h" /* FUNCTIONS ********************************************************/ diff --git a/base/applications/mspaint/precomp.h b/base/applications/mspaint/precomp.h new file mode 100644 index 00000000000..cce714ad707 --- /dev/null +++ b/base/applications/mspaint/precomp.h @@ -0,0 +1,20 @@ + +#include +#include +#include +#include +#include + +#include "definitions.h" +#include "drawing.h" +#include "dib.h" +#include "globalvar.h" +#include "history.h" +#include "mouse.h" +#include "winproc.h" +#include "palette.h" +#include "toolsettings.h" +#include "selection.h" +#include "sizebox.h" +#include "dialogs.h" +#include "registry.h" \ No newline at end of file diff --git a/base/applications/mspaint/registry.c b/base/applications/mspaint/registry.c index 6f4e8e53a64..9da17c9a3f7 100644 --- a/base/applications/mspaint/registry.c +++ b/base/applications/mspaint/registry.c @@ -8,8 +8,7 @@ /* INCLUDES *********************************************************/ -#include -#include +#include "precomp.h" /* FUNCTIONS ********************************************************/ diff --git a/base/applications/mspaint/rsrc.rc b/base/applications/mspaint/rsrc.rc index 8a632b7ba54..d144db465e6 100644 --- a/base/applications/mspaint/rsrc.rc +++ b/base/applications/mspaint/rsrc.rc @@ -32,10 +32,11 @@ #include "lang/sk-SK.rc" // cp 1251 languages #include "lang/bg-BG.rc" -#include "lang/ru-RU.rc" -#include "lang/uk-UA.rc" // UTF-8 #pragma code_page(65001) #include "lang/pl-PL.rc" #include "lang/ro-RO.rc" +#include "lang/ru-RU.rc" +#include "lang/uk-UA.rc" +#include "lang/zh-CN.rc" diff --git a/base/applications/mspaint/selection.c b/base/applications/mspaint/selection.c index 03d7a18f75b..8a77b51c9f6 100644 --- a/base/applications/mspaint/selection.c +++ b/base/applications/mspaint/selection.c @@ -8,14 +8,7 @@ /* INCLUDES *********************************************************/ -#include -#include -#include -#include "globalvar.h" -#include "drawing.h" -#include "history.h" -#include "mouse.h" -#include "dib.h" +#include "precomp.h" /* FUNCTIONS ********************************************************/ diff --git a/base/applications/mspaint/sizebox.c b/base/applications/mspaint/sizebox.c index 9fa05ec8bed..728bd63a47f 100644 --- a/base/applications/mspaint/sizebox.c +++ b/base/applications/mspaint/sizebox.c @@ -8,11 +8,7 @@ /* INCLUDES *********************************************************/ -#include -#include -#include -#include "globalvar.h" -#include "history.h" +#include "precomp.h" /* FUNCTIONS ********************************************************/ diff --git a/base/applications/mspaint/toolsettings.c b/base/applications/mspaint/toolsettings.c index 2e5cd67661d..2ba81c7e68d 100644 --- a/base/applications/mspaint/toolsettings.c +++ b/base/applications/mspaint/toolsettings.c @@ -8,11 +8,7 @@ /* INCLUDES *********************************************************/ -#include -#include -#include "globalvar.h" -#include "drawing.h" -#include "winproc.h" +#include "precomp.h" /* FUNCTIONS ********************************************************/ diff --git a/base/applications/mspaint/winproc.c b/base/applications/mspaint/winproc.c index 2e450699433..391107499b7 100644 --- a/base/applications/mspaint/winproc.c +++ b/base/applications/mspaint/winproc.c @@ -9,19 +9,8 @@ /* INCLUDES *********************************************************/ -#include -#include //#include -#include -#include -#include "definitions.h" -#include "globalvar.h" -#include "dialogs.h" -#include "dib.h" -#include "drawing.h" -#include "history.h" -#include "mouse.h" -#include "registry.h" +#include "precomp.h" /* FUNCTIONS ********************************************************/ @@ -503,7 +492,7 @@ WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) } SendMessage(hImageArea, WM_PAINT, 0, 0); if ((activeTool == TOOL_ZOOM) && (zoom < 8000)) - zoomTo(zoom * 2, (short)LOWORD(lParam), (short)HIWORD(lParam)); + zoomTo(zoom * 2, LOWORD(lParam), HIWORD(lParam)); } break; @@ -524,7 +513,7 @@ WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) } SendMessage(hImageArea, WM_PAINT, 0, 0); if ((activeTool == TOOL_ZOOM) && (zoom > 125)) - zoomTo(zoom / 2, (short)LOWORD(lParam), (short)HIWORD(lParam)); + zoomTo(zoom / 2, LOWORD(lParam), HIWORD(lParam)); } break; @@ -589,8 +578,8 @@ WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) case WM_MOUSEMOVE: if (hwnd == hImageArea) { - short xNow = (short)LOWORD(lParam) * 1000 / zoom; - short yNow = (short)HIWORD(lParam) * 1000 / zoom; + LONG xNow = LOWORD(lParam) * 1000 / zoom; + LONG yNow = HIWORD(lParam) * 1000 / zoom; if ((!drawing) || (activeTool <= TOOL_AIRBRUSH)) { TRACKMOUSEEVENT tme; @@ -598,7 +587,7 @@ WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) if (activeTool == TOOL_ZOOM) { SendMessage(hImageArea, WM_PAINT, 0, 0); - drawZoomFrame((short)LOWORD(lParam), (short)HIWORD(lParam)); + drawZoomFrame(LOWORD(lParam), HIWORD(lParam)); } tme.cbSize = sizeof(TRACKMOUSEEVENT); @@ -617,8 +606,8 @@ WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) if (drawing) { /* values displayed in statusbar */ - short xRel = xNow - startX; - short yRel = yNow - startY; + LONG xRel = xNow - startX; + LONG yRel = yNow - startY; /* freesel, rectsel and text tools always show numbers limited to fit into image area */ if ((activeTool == TOOL_FREESEL) || (activeTool == TOOL_RECTSEL) || (activeTool == TOOL_TEXT)) { @@ -807,6 +796,10 @@ WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) OpenClipboard(hMainWnd); if (GetClipboardData(CF_BITMAP) != NULL) { + HWND hToolbar = FindWindowEx(hToolBoxContainer, NULL, TOOLBARCLASSNAME, NULL); + SendMessage(hToolbar, TB_CHECKBUTTON, ID_RECTSEL, MAKELONG(TRUE, 0)); + SendMessage(hwnd, WM_COMMAND, ID_RECTSEL, 0); + DeleteObject(SelectObject(hSelDC, hSelBm = CopyImage(GetClipboardData(CF_BITMAP), IMAGE_BITMAP, 0, 0, LR_COPYRETURNORG))); diff --git a/base/applications/mstsc/CMakeLists.txt b/base/applications/mstsc/CMakeLists.txt index ef37c8fd823..a43947accec 100644 --- a/base/applications/mstsc/CMakeLists.txt +++ b/base/applications/mstsc/CMakeLists.txt @@ -1,5 +1,6 @@ set_unicode() +set_rc_compiler() list(APPEND SOURCE bitmap.c @@ -23,12 +24,12 @@ list(APPEND SOURCE win32.c rdc.rc) -add_executable(mstsc ${CMAKE_CURRENT_BINARY_DIR}/mstsc_precomp.h.gch ${SOURCE}) - -add_pch(mstsc ${CMAKE_CURRENT_SOURCE_DIR}/precomp.h ${SOURCE}) +add_executable(mstsc ${SOURCE}) set_module_type(mstsc win32gui) add_importlibs(mstsc user32 gdi32 comctl32 ws2_32 advapi32 shell32 ole32 comdlg32 msvcrt kernel32) +add_pch(mstsc precomp.h) + add_cd_file(TARGET mstsc DESTINATION reactos/system32 FOR all) diff --git a/base/applications/mstsc/connectdialog.c b/base/applications/mstsc/connectdialog.c index c99e11c9b0e..92f0b4055d3 100644 --- a/base/applications/mstsc/connectdialog.c +++ b/base/applications/mstsc/connectdialog.c @@ -1136,10 +1136,10 @@ DlgProc(HWND hDlg, SRCCOPY); SelectObject(hdcMem, hBmpOld); - txtRc.left = bmpRc.right * 0.25; + txtRc.left = bmpRc.right / 4; txtRc.top = 10; - txtRc.right = bmpRc.right * 0.75; - txtRc.bottom = pInfo->headerbitmap.bmHeight * 0.5; + txtRc.right = bmpRc.right * 3 / 4; + txtRc.bottom = pInfo->headerbitmap.bmHeight / 2; ZeroMemory(&lf, sizeof(LOGFONTW)); @@ -1172,10 +1172,10 @@ DlgProc(HWND hDlg, } } - txtRc.left = bmpRc.right * 0.25; + txtRc.left = bmpRc.right / 4; txtRc.top = txtRc.bottom - 5; - txtRc.right = bmpRc.right * 0.75; - txtRc.bottom = pInfo->headerbitmap.bmHeight * 0.9; + txtRc.right = bmpRc.right * 3 / 4; + txtRc.bottom = pInfo->headerbitmap.bmHeight * 9 / 10; if (LoadStringW(hInst, IDS_HEADERTEXT2, diff --git a/base/applications/mstsc/lang/pl-PL.rc b/base/applications/mstsc/lang/pl-PL.rc index 6b0002dc633..4c4a20fb28a 100644 --- a/base/applications/mstsc/lang/pl-PL.rc +++ b/base/applications/mstsc/lang/pl-PL.rc @@ -3,8 +3,9 @@ * Use ReactOS forum PM or IRC to contact me * http://www.reactos.org * IRC: irc.freenode.net #reactos-pl; - * updated by Saibamen - Adam Stachowicz (saibamenppl@gmail.com) (Apr, 2011) + * updated by Saibamen - Adam Stachowicz (saibamenppl@gmail.com) (August, 2011) * UTF-8 conversion by Caemyr (May, 2011) + * Update by wojo664 - repositioning the titles */ LANGUAGE LANG_POLISH, SUBLANG_DEFAULT @@ -17,8 +18,8 @@ BEGIN GROUPBOX "Ustawienia połączenia",IDC_STATIC,7,103,228,65 ICON "", IDC_LOGONICON, 15,19,20,20 LTEXT "Wpisz adres serwera",IDC_STATIC,47,24,81,8 - LTEXT "Serwer:",IDC_STATIC,47,41,25,8 - LTEXT "Nazwa użytkownika:",IDC_STATIC,47,58,38,8 + LTEXT "Serwer:",IDC_STATIC,39,42,29,8 + LTEXT "Nazwa użytkownika:",IDC_STATIC,39,57,42,18 COMBOBOX IDC_SERVERCOMBO,79,39,141,150,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP PUSHBUTTON "Zapisz",IDC_SAVE,67,139,50,14 PUSHBUTTON "Zapisz jako...",IDC_SAVEAS,123,139,50,14 @@ -35,13 +36,13 @@ BEGIN GROUPBOX "Liczba kolorów",IDC_STATIC,7,83,228,85 ICON "", IDC_REMICON, 15,19,20,20 ICON "", IDC_COLORSICON, 15,98,20,20 - LTEXT "Ustaw rozmiar twojego pulpitu zdalnego. Przesuń suwak do końca w prawo, aby uruchomić pulpit na pełnym ekranie",IDC_STATIC,53,22,175,21 + LTEXT "Ustaw rozmiar twojego pulpitu zdalnego. Przesuń suwak do końca w prawo, aby uruchomić pulpit na pełnym ekranie",IDC_STATIC,53,16,175,24 CONTROL "", IDC_GEOSLIDER, "msctls_trackbar32", TBS_AUTOTICKS | WS_TABSTOP, 56, 42, 124, 17 COMBOBOX IDC_BPPCOMBO,56,102,128,80, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP CONTROL "",IDC_COLORIMAGE,"Static",SS_OWNERDRAW | SS_SUNKEN, 56,121,127,10 LTEXT "Uwaga: Ustawienia na komputerze zdalnym mają pierwszeństwo nad bieżącymi.",IDC_STATIC,56,143,165,18 - LTEXT "Mniej",IDC_STATIC,35,42,15,8 - LTEXT "Więcej",IDC_STATIC,189,42,17,8 + LTEXT "Mniej",IDC_STATIC,32,42,20,8 + LTEXT "Więcej",IDC_STATIC,189,42,21,8 LTEXT "", IDC_SETTINGS_RESOLUTION_TEXT, 56, 62, 120, 10, SS_CENTER END diff --git a/base/applications/mstsc/lang/ru-RU.rc b/base/applications/mstsc/lang/ru-RU.rc index 6c46131b026..f905d34667e 100644 --- a/base/applications/mstsc/lang/ru-RU.rc +++ b/base/applications/mstsc/lang/ru-RU.rc @@ -4,60 +4,60 @@ IDD_GENERAL DIALOGEX 0, 0, 242, 175 STYLE DS_SHELLFONT | WS_CHILD FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - GROUPBOX " ",IDC_STATIC,7,7,228,89 - GROUPBOX " ",IDC_STATIC,7,103,228,65 + GROUPBOX "Настройки входа",IDC_STATIC,7,7,228,89 + GROUPBOX "Настройки подключения",IDC_STATIC,7,103,228,65 ICON "", IDC_LOGONICON, 15,19,20,20 - LTEXT " ",IDC_STATIC,47,24,100,8 - LTEXT ":",IDC_STATIC,52,41,31,8 - LTEXT " :",IDC_STATIC,15,58,67,8 + LTEXT "Введите адрес сервера",IDC_STATIC,47,24,100,8 + LTEXT "Сервер:",IDC_STATIC,52,41,31,8 + LTEXT "Имя пользователя:",IDC_STATIC,15,58,67,8 COMBOBOX IDC_SERVERCOMBO,86,39,141,150,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "",IDC_SAVE,49,139,50,14 - PUSHBUTTON " ...",IDC_SAVEAS,103,139,70,14 - PUSHBUTTON "...",IDC_OPEN,177,139,50,14 + PUSHBUTTON "Сохранить",IDC_SAVE,49,139,50,14 + PUSHBUTTON "Сохранить как...",IDC_SAVEAS,103,139,70,14 + PUSHBUTTON "Открыть...",IDC_OPEN,177,139,50,14 ICON "", IDC_CONNICON, 16,114,20,20 - LTEXT " .",IDC_STATIC,50,115,172,20 + LTEXT "Сохранить текущие настройки подключения или открыть существующую конфигурацию.",IDC_STATIC,50,115,172,20 END IDD_DISPLAY DIALOGEX 0, 0, 242, 175 STYLE DS_SHELLFONT | WS_CHILD FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - GROUPBOX " ",IDC_STATIC,7,7,228,68 - GROUPBOX "",IDC_STATIC,7,83,228,85 + GROUPBOX "Размер удаленного рабочего стола",IDC_STATIC,7,7,228,68 + GROUPBOX "Цвета",IDC_STATIC,7,83,228,85 ICON "", IDC_REMICON, 15,19,20,20 ICON "", IDC_COLORSICON, 15,98,20,20 - LTEXT " -\n. .",IDC_STATIC,53,17,175,24 + LTEXT "Установить размер экрана на удаленном компью-\nтере. Перетащите ползунок в крайнее правое положение для перехода в полноэкранный режим.",IDC_STATIC,53,17,175,24 CONTROL "", IDC_GEOSLIDER, "msctls_trackbar32", TBS_AUTOTICKS | WS_TABSTOP, 56, 42, 124, 17 COMBOBOX IDC_BPPCOMBO,56,102,128,80, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP CONTROL "",IDC_COLORIMAGE,"Static",SS_OWNERDRAW | SS_SUNKEN, 56,121,127,10 - LTEXT ": .",IDC_STATIC,56,143,165,18 - LTEXT "",IDC_STATIC,20,52,30,8 - LTEXT "",IDC_STATIC,189,51,32,8 + LTEXT "Примечание: Эти параметры определяются настройками удаленного компьютера.",IDC_STATIC,56,143,165,18 + LTEXT "меньше",IDC_STATIC,20,52,30,8 + LTEXT "больше",IDC_STATIC,189,51,32,8 LTEXT "", IDC_SETTINGS_RESOLUTION_TEXT, 56, 62, 120, 10, SS_CENTER END IDD_CONNECTDIALOG DIALOGEX 0, 0, 260, 275 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Подключение к удаленному рабочему столу" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - DEFPUSHBUTTON "",IDOK,147,256,50,14 - PUSHBUTTON "",IDCANCEL,203,256,50,14 + DEFPUSHBUTTON "Соединение",IDOK,147,256,50,14 + PUSHBUTTON "Отмена",IDCANCEL,203,256,50,14 CONTROL "",IDC_TAB,"SysTabControl32",0x0,7,54,246,198 END STRINGTABLE BEGIN - IDS_TAB_GENERAL "" - IDS_TAB_DISPLAY "" - IDS_256COLORS "256 " - IDS_HIGHCOLOR15 "32,768 (15 )" - IDS_HIGHCOLOR16 "65,536 (16 )" - IDS_HIGHCOLOR24 "16,777,216 (24 )" - IDS_PIXEL "%lux%lu " - IDS_FULLSCREEN " " - IDS_BROWSESERVER "< ...>" - IDS_HEADERTEXT1 " " - IDS_HEADERTEXT2 "" + IDS_TAB_GENERAL "Общие" + IDS_TAB_DISPLAY "Экран" + IDS_256COLORS "256 цветов" + IDS_HIGHCOLOR15 "32,768 цветов (15 бит)" + IDS_HIGHCOLOR16 "65,536 цветов (16 бит)" + IDS_HIGHCOLOR24 "16,777,216 цветов (24 бит)" + IDS_PIXEL "%lux%lu пикселей" + IDS_FULLSCREEN "Полный экран" + IDS_BROWSESERVER "<Указать путь...>" + IDS_HEADERTEXT1 "Удаленный рабочий стол" + IDS_HEADERTEXT2 "Соединение" END diff --git a/base/applications/mstsc/lang/uk-UA.rc b/base/applications/mstsc/lang/uk-UA.rc index e425e31c15d..8e4892cc0ad 100644 --- a/base/applications/mstsc/lang/uk-UA.rc +++ b/base/applications/mstsc/lang/uk-UA.rc @@ -12,60 +12,60 @@ IDD_GENERAL DIALOGEX 0, 0, 242, 175 STYLE DS_SHELLFONT | WS_CHILD FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - GROUPBOX " ",IDC_STATIC,7,7,228,89 - GROUPBOX " ",IDC_STATIC,7,103,228,65 + GROUPBOX "Параметри входу",IDC_STATIC,7,7,228,89 + GROUPBOX "Параметри підключення",IDC_STATIC,7,103,228,65 ICON "", IDC_LOGONICON, 15,19,20,20 - LTEXT " ",IDC_STATIC,47,24,81,8 - LTEXT ":",IDC_STATIC,47,41,27,8 - LTEXT ":",IDC_STATIC,47,58,41,8 + LTEXT "Введіть адресу сервера",IDC_STATIC,47,24,81,8 + LTEXT "Сервер:",IDC_STATIC,47,41,27,8 + LTEXT "Користувач:",IDC_STATIC,47,58,41,8 COMBOBOX IDC_SERVERCOMBO,79,39,141,150,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "",IDC_SAVE,67,139,50,14 - PUSHBUTTON " ...",IDC_SAVEAS,123,139,50,14 - PUSHBUTTON "³...",IDC_OPEN,177,139,50,14 + PUSHBUTTON "Зберегти",IDC_SAVE,67,139,50,14 + PUSHBUTTON "Зберегти як...",IDC_SAVEAS,123,139,50,14 + PUSHBUTTON "Відкрити...",IDC_OPEN,177,139,50,14 ICON "", IDC_CONNICON, 16,114,20,20 - LTEXT " ",IDC_STATIC,50,115,172,20 + LTEXT "Збереження поточних параметрів або відкриття існуючого підключення",IDC_STATIC,50,115,172,20 END IDD_DISPLAY DIALOGEX 0, 0, 242, 175 STYLE DS_SHELLFONT | WS_CHILD FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - GROUPBOX " ",IDC_STATIC,7,7,228,71 - GROUPBOX " ",IDC_STATIC,7,83,228,85 + GROUPBOX "Розмір віддаленого робочого столу",IDC_STATIC,7,7,228,71 + GROUPBOX "Колірна палітра",IDC_STATIC,7,83,228,85 ICON "", IDC_REMICON, 15,19,20,20 ICON "", IDC_COLORSICON, 15,98,20,20 - LTEXT " . , ",IDC_STATIC,53,15,175,24 + LTEXT "Вкажіть розмір віддаленого робочого столу. Перетягніть повзунок праворуч до кінця, щоб перейти у повноекранний режим",IDC_STATIC,53,15,175,24 CONTROL "", IDC_GEOSLIDER, "msctls_trackbar32", TBS_AUTOTICKS | WS_TABSTOP, 56, 45, 124, 17 COMBOBOX IDC_BPPCOMBO,56,102,128,80, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP CONTROL "",IDC_COLORIMAGE,"Static",SS_OWNERDRAW | SS_SUNKEN, 56,121,127,10 - LTEXT ": ' .",IDC_STATIC,56,143,175,18 - LTEXT "",IDC_STATIC,29,45,21,8 - LTEXT "",IDC_STATIC,189,45,23,8 + LTEXT "Примітка: параметри на віддаленому комп'ютері можуть перекривати значення цього параметра.",IDC_STATIC,56,143,175,18 + LTEXT "менше",IDC_STATIC,29,45,21,8 + LTEXT "більше",IDC_STATIC,189,45,23,8 LTEXT "", IDC_SETTINGS_RESOLUTION_TEXT, 56, 65, 120, 10, SS_CENTER END IDD_CONNECTDIALOG DIALOGEX 0, 0, 260, 267 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "ϳ " +CAPTION "Підключення до віддаленого робочого столу" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - DEFPUSHBUTTON "ϳ",IDOK,147,249,50,14 - PUSHBUTTON "",IDCANCEL,203,249,50,14 + DEFPUSHBUTTON "Підключити",IDOK,147,249,50,14 + PUSHBUTTON "Скасувати",IDCANCEL,203,249,50,14 CONTROL "",IDC_TAB,"SysTabControl32",0x0,7,54,246,190 END STRINGTABLE BEGIN - IDS_TAB_GENERAL "" - IDS_TAB_DISPLAY "" - IDS_256COLORS "256 " - IDS_HIGHCOLOR15 "32,768 (15 )" - IDS_HIGHCOLOR16 "65,536 (16 )" - IDS_HIGHCOLOR24 "16,777,216 (24 )" - IDS_PIXEL "%lu %lu " - IDS_FULLSCREEN " " - IDS_BROWSESERVER "< ...>" - IDS_HEADERTEXT1 " " - IDS_HEADERTEXT2 "" + IDS_TAB_GENERAL "Загальні" + IDS_TAB_DISPLAY "Екран" + IDS_256COLORS "256 кольорів" + IDS_HIGHCOLOR15 "32,768 кольорів (15 біт)" + IDS_HIGHCOLOR16 "65,536 кольорів (16 біт)" + IDS_HIGHCOLOR24 "16,777,216 кольорів (24 біти)" + IDS_PIXEL "%lu на %lu крапок" + IDS_FULLSCREEN "На весь екран" + IDS_BROWSESERVER "<Пошук інших...>" + IDS_HEADERTEXT1 "Керування робочим" + IDS_HEADERTEXT2 "Столом" END diff --git a/base/applications/mstsc/lang/zh-CN.rc b/base/applications/mstsc/lang/zh-CN.rc new file mode 100644 index 00000000000..b9db57a076a --- /dev/null +++ b/base/applications/mstsc/lang/zh-CN.rc @@ -0,0 +1,67 @@ +/* + * Translated by Song Fuchang (0xfc) + */ + +LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED + +IDD_GENERAL DIALOGEX 0, 0, 242, 175 +STYLE DS_SHELLFONT | WS_CHILD +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + GROUPBOX "登录设置",IDC_STATIC,7,7,228,89 + GROUPBOX "连接设置",IDC_STATIC,7,103,228,65 + ICON "", IDC_LOGONICON, 15,19,20,20 + LTEXT "输入服务器地址",IDC_STATIC,47,24,81,8 + LTEXT "服务器:",IDC_STATIC,47,41,25,8 + LTEXT "用户名:",IDC_STATIC,47,58,38,8 + COMBOBOX IDC_SERVERCOMBO,79,39,141,150,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP + PUSHBUTTON "保存",IDC_SAVE,67,139,50,14 + PUSHBUTTON "另存为...",IDC_SAVEAS,123,139,50,14 + PUSHBUTTON "打开...",IDC_OPEN,177,139,50,14 + ICON "", IDC_CONNICON, 16,114,20,20 + LTEXT "保存当前连接设置或打开一个已有的配置",IDC_STATIC,50,115,172,20 +END + +IDD_DISPLAY DIALOGEX 0, 0, 242, 175 +STYLE DS_SHELLFONT | WS_CHILD +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN + GROUPBOX "远程桌面大小",IDC_STATIC,7,7,228,68 + GROUPBOX "颜色",IDC_STATIC,7,83,228,85 + ICON "", IDC_REMICON, 15,19,20,20 + ICON "", IDC_COLORSICON, 15,98,20,20 + LTEXT "为您的远程桌面设置屏幕大小。将这个滑块向右拉远以启用全屏。",IDC_STATIC,53,22,175,21 + CONTROL "", IDC_GEOSLIDER, "msctls_trackbar32", TBS_AUTOTICKS | WS_TABSTOP, 56, 42, 124, 17 + COMBOBOX IDC_BPPCOMBO,56,102,128,80, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP + CONTROL "",IDC_COLORIMAGE,"Static",SS_OWNERDRAW | SS_SUNKEN, 56,121,127,10 + LTEXT "注意:远程计算机上的设置可能会覆盖这个设置。",IDC_STATIC,56,143,165,18 + LTEXT "更少",IDC_STATIC,35,42,15,8 + LTEXT "更多",IDC_STATIC,189,42,17,8 + LTEXT "", IDC_SETTINGS_RESOLUTION_TEXT, 56, 62, 120, 10, SS_CENTER +END + +IDD_CONNECTDIALOG DIALOGEX 0, 0, 260, 262 +STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "远程桌面连接" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + DEFPUSHBUTTON "连接",IDOK,147,245,50,14 + PUSHBUTTON "取消",IDCANCEL,203,245,50,14 + CONTROL "",IDC_TAB,"SysTabControl32",0x0,7,50,246,190 +END + + +STRINGTABLE +BEGIN + IDS_TAB_GENERAL "普通" + IDS_TAB_DISPLAY "显示" + IDS_256COLORS "256 色" + IDS_HIGHCOLOR15 "32,768 色 (15 位)" + IDS_HIGHCOLOR16 "65,536 色 (16 位)" + IDS_HIGHCOLOR24 "16,777,216 色 (24 位)" + IDS_PIXEL "%lux%lu 像素" + IDS_FULLSCREEN "全屏" + IDS_BROWSESERVER "<浏览更多...>" + IDS_HEADERTEXT1 "远程桌面" + IDS_HEADERTEXT2 "连接" +END diff --git a/base/applications/mstsc/rsrc.rc b/base/applications/mstsc/rsrc.rc index c76046fd690..7dc783896ee 100644 --- a/base/applications/mstsc/rsrc.rc +++ b/base/applications/mstsc/rsrc.rc @@ -24,11 +24,12 @@ IDB_SPECT BITMAP "res/spectrum.bmp" #include "lang/ko-KR.rc" #include "lang/lt-LT.rc" #include "lang/no-NO.rc" -#include "lang/ru-RU.rc" #include "lang/sk-SK.rc" #include "lang/sv-SE.rc" -#include "lang/uk-UA.rc" // UTF-8 #pragma code_page(65001) #include "lang/pl-PL.rc" +#include "lang/ru-RU.rc" +#include "lang/uk-UA.rc" +#include "lang/zh-CN.rc" diff --git a/base/applications/network/CMakeLists.txt b/base/applications/network/CMakeLists.txt index d961ff60aa5..02eb61db45a 100644 --- a/base/applications/network/CMakeLists.txt +++ b/base/applications/network/CMakeLists.txt @@ -10,7 +10,7 @@ add_subdirectory(nslookup) add_subdirectory(ping) add_subdirectory(route) if(NOT MSVC) -add_subdirectory(telnet) + add_subdirectory(telnet) # FIXME: fix msvc build endif() add_subdirectory(tracert) add_subdirectory(whois) diff --git a/base/applications/network/dwnl/CMakeLists.txt b/base/applications/network/dwnl/CMakeLists.txt index b1aff5f18b6..cf9e64a6164 100644 --- a/base/applications/network/dwnl/CMakeLists.txt +++ b/base/applications/network/dwnl/CMakeLists.txt @@ -1,4 +1,3 @@ -add_definitions(-D_DLL -D__USE_CRTIMP) set_unicode() @@ -10,7 +9,7 @@ target_link_libraries(dwnl uuid) add_importlibs(dwnl urlmon wininet msvcrt kernel32) if(MSVC) -add_importlibs(dwnl ntdll) + add_importlibs(dwnl ntdll) endif() add_cd_file(TARGET dwnl DESTINATION reactos/system32 FOR all) diff --git a/base/applications/network/finger/CMakeLists.txt b/base/applications/network/finger/CMakeLists.txt index 88e1076475f..dd5444909e0 100644 --- a/base/applications/network/finger/CMakeLists.txt +++ b/base/applications/network/finger/CMakeLists.txt @@ -1,7 +1,5 @@ -add_definitions( - -D__USE_W32_SOCKETS - -D_DLL -D__USE_CRTIMP) +add_definitions(-D__USE_W32_SOCKETS) add_executable(finger finger.c @@ -11,5 +9,6 @@ add_executable(finger finger.rc) set_module_type(finger win32cui) +add_pch(finger precomp.h) add_importlibs(finger ws2_32 msvcrt kernel32) add_cd_file(TARGET finger DESTINATION reactos/system32 FOR all) diff --git a/base/applications/network/finger/err.c b/base/applications/network/finger/err.c index 8f1cc4ed030..ff6ccd7ddbf 100644 --- a/base/applications/network/finger/err.c +++ b/base/applications/network/finger/err.c @@ -35,17 +35,7 @@ static char sccsid[] = "@(#)err.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ -#include "err.h" -#include -#include -#include -#include - -#ifdef __STDC__ -#include -#else -#include -#endif +#include "precomp.h" extern char *__progname; /* Program name, from crt0. */ diff --git a/base/applications/network/finger/finger.c b/base/applications/network/finger/finger.c index ddb4bebaf1d..82abc45a76a 100644 --- a/base/applications/network/finger/finger.c +++ b/base/applications/network/finger/finger.c @@ -54,17 +54,7 @@ * mail info, and .plan/.project files. */ -#include -#include "err.h" -#include -#include -#include -#include -#include -#include - -#include "various.h" -#include "getopt.h" +#include "precomp.h" char *__progname; diff --git a/base/applications/network/finger/getopt.c b/base/applications/network/finger/getopt.c index ae5cc0985cc..ec49191e0d6 100644 --- a/base/applications/network/finger/getopt.c +++ b/base/applications/network/finger/getopt.c @@ -38,11 +38,7 @@ static char sccsid[] = "@(#)getopt.c 4.13 (Berkeley) 2/23/91"; #endif /* LIBC_SCCS and not lint */ -#include -#include -#include - -#include "getopt.h" +#include "precomp.h" /* * get option letter from argument vector diff --git a/base/applications/network/finger/net.c b/base/applications/network/finger/net.c index 7f932ef2b5d..1e004359923 100644 --- a/base/applications/network/finger/net.c +++ b/base/applications/network/finger/net.c @@ -34,12 +34,7 @@ * SUCH DAMAGE. */ -#include -#include -#include -#include - -#include "various.h" +#include "precomp.h" void netfinger(char *name) diff --git a/base/applications/network/finger/precomp.h b/base/applications/network/finger/precomp.h new file mode 100644 index 00000000000..53de144bbed --- /dev/null +++ b/base/applications/network/finger/precomp.h @@ -0,0 +1,19 @@ + +#include +#include "err.h" +#include +#include +#include +#include +#include +#include +#include + +#ifdef __STDC__ +#include +#else +#include +#endif + +#include "various.h" +#include "getopt.h" diff --git a/base/applications/network/ftp/CMakeLists.txt b/base/applications/network/ftp/CMakeLists.txt index 522da951bec..48988202a2a 100644 --- a/base/applications/network/ftp/CMakeLists.txt +++ b/base/applications/network/ftp/CMakeLists.txt @@ -1,7 +1,5 @@ -add_definitions( - -D_DLL -D__USE_CRTIMP - -Dlint) +add_definitions(-Dlint) add_executable(ftp cmds.c @@ -15,6 +13,7 @@ add_executable(ftp set_module_type(ftp win32cui) add_importlibs(ftp ws2_32 iphlpapi msvcrt kernel32) +add_pch(ftp precomp.h) if(MSVC) target_link_libraries(ftp oldnames) diff --git a/base/applications/network/ftp/cmds.c b/base/applications/network/ftp/cmds.c index 91b3bc48d5e..b4f9912bf6b 100644 --- a/base/applications/network/ftp/cmds.c +++ b/base/applications/network/ftp/cmds.c @@ -24,26 +24,8 @@ static char sccsid[] = "@(#)cmds.c 5.18 (Berkeley) 4/20/89"; */ //#include //#include -#include -#ifndef _WIN32 -#include -#include -#include -#include -#else -#include -#endif -#include -#include -#include -#include -#include -#include - -#include "ftp_var.h" -#include "pathnames.h" -#include "prototypes.h" +#include "precomp.h" extern char *globerr; extern char home[]; diff --git a/base/applications/network/ftp/cmdtab.c b/base/applications/network/ftp/cmdtab.c index 5c336526591..3dafb9c525b 100644 --- a/base/applications/network/ftp/cmdtab.c +++ b/base/applications/network/ftp/cmdtab.c @@ -19,7 +19,7 @@ static char sccsid[] = "@(#)cmdtab.c 5.9 (Berkeley) 3/21/89"; #endif /* not lint */ -#include "ftp_var.h" +#include "precomp.h" /* * User FTP -- Command Tables. diff --git a/base/applications/network/ftp/domacro.c b/base/applications/network/ftp/domacro.c index fc96ad76288..504f354dbcf 100644 --- a/base/applications/network/ftp/domacro.c +++ b/base/applications/network/ftp/domacro.c @@ -19,13 +19,8 @@ static char sccsid[] = "@(#)domacro.c 1.6 (Berkeley) 2/28/89"; #endif /* not lint */ -#include "ftp_var.h" -#include "prototypes.h" - -#include -#include +#include "precomp.h" //#include -#include //#include void domacro(int argc, const char *argv[]) diff --git a/base/applications/network/ftp/fake.c b/base/applications/network/ftp/fake.c index 5f4bfc88f83..17b50308640 100644 --- a/base/applications/network/ftp/fake.c +++ b/base/applications/network/ftp/fake.c @@ -1,8 +1,4 @@ -#include -#include -#include -#include "fake.h" -#include "prototypes.h" +#include "precomp.h" #define MAX_ASCII 100 diff --git a/base/applications/network/ftp/ftp.c b/base/applications/network/ftp/ftp.c index 9d0da1c4a73..407a3d31651 100644 --- a/base/applications/network/ftp/ftp.c +++ b/base/applications/network/ftp/ftp.c @@ -21,33 +21,9 @@ #ifndef lint static char sccsid[] = "@(#)ftp.c 5.28 (Berkeley) 4/20/89"; #endif /* not lint */ -#include -#include +#include "precomp.h" -#ifndef _WIN32 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#else -#include -#endif - -#include -#include -#include -#include - -#include "ftp_var.h" -#include "prototypes.h" #ifndef MAXHOSTNAMELEN #define MAXHOSTNAMELEN 64 #endif diff --git a/base/applications/network/ftp/main.c b/base/applications/network/ftp/main.c index 5843096df99..db4859f3987 100644 --- a/base/applications/network/ftp/main.c +++ b/base/applications/network/ftp/main.c @@ -28,26 +28,7 @@ static char sccsid[] = "@(#)main.c based on 5.13 (Berkeley) 3/14/89"; /* * FTP User Program -- Command Interface. */ -#ifndef _WIN32 -#include -#include -#include -#include -#include -#include -#endif -#include "ftp_var.h" -#include "prototypes.h" -#include - -#include -#include - -#include -#include -#include -#include - +#include "precomp.h" #if defined(sun) && !defined(FD_SET) typedef int uid_t; diff --git a/base/applications/network/ftp/precomp.h b/base/applications/network/ftp/precomp.h new file mode 100644 index 00000000000..df38d0a10a4 --- /dev/null +++ b/base/applications/network/ftp/precomp.h @@ -0,0 +1,36 @@ + +#include +#include + +#ifndef _WIN32 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#else +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ftp_var.h" +#include "pathnames.h" +#include "prototypes.h" + +#include "fake.h" + +#include diff --git a/base/applications/network/ftp/ruserpass.c b/base/applications/network/ftp/ruserpass.c index 618147e8d9a..248814b567c 100644 --- a/base/applications/network/ftp/ruserpass.c +++ b/base/applications/network/ftp/ruserpass.c @@ -19,15 +19,8 @@ static char sccsid[] = "@(#)ruserpass.c 5.1 (Berkeley) 3/1/89"; #endif /* not lint */ -#include -#include +#include "precomp.h" //#include -#include -#include -#include -#include "ftp_var.h" -#include "prototypes.h" -#include struct utmp *getutmp(); static FILE *cfile; diff --git a/base/applications/network/ipconfig/CMakeLists.txt b/base/applications/network/ipconfig/CMakeLists.txt index d772922feed..3be4c6de9f0 100644 --- a/base/applications/network/ipconfig/CMakeLists.txt +++ b/base/applications/network/ipconfig/CMakeLists.txt @@ -1,4 +1,6 @@ +set_rc_compiler() + add_executable(ipconfig ipconfig.c ipconfig.rc) set_module_type(ipconfig win32cui) add_importlibs(ipconfig user32 iphlpapi advapi32 msvcrt kernel32) diff --git a/base/applications/network/ipconfig/ipconfig.rc b/base/applications/network/ipconfig/ipconfig.rc index 2d0eb9fa09f..a27be7404d7 100644 --- a/base/applications/network/ipconfig/ipconfig.rc +++ b/base/applications/network/ipconfig/ipconfig.rc @@ -16,11 +16,12 @@ #include "lang/id-ID.rc" #include "lang/it-IT.rc" #include "lang/no-NO.rc" -#include "lang/ru-RU.rc" #include "lang/sk-SK.rc" #include "lang/sv-SE.rc" -#include "lang/uk-UA.rc" // UTF-8 #pragma code_page(65001) #include "lang/pl-PL.rc" +#include "lang/ru-RU.rc" +#include "lang/uk-UA.rc" +#include "lang/zh-CN.rc" diff --git a/base/applications/network/ipconfig/lang/ru-RU.rc b/base/applications/network/ipconfig/lang/ru-RU.rc index bd54562a5aa..e2d221a2ee9 100644 --- a/base/applications/network/ipconfig/lang/ru-RU.rc +++ b/base/applications/network/ipconfig/lang/ru-RU.rc @@ -13,57 +13,57 @@ END STRINGTABLE DISCARDABLE BEGIN - IDS_OTHER " " - IDS_ETH "Ethernet " - IDS_TOKEN "Token Ring " - IDS_FDDI "FDDI " - IDS_PPP "PPP " - IDS_LOOP "Loopback " - IDS_SLIP "SLIP " + IDS_OTHER "Другой тип адаптера" + IDS_ETH "Ethernet адаптер" + IDS_TOKEN "Token Ring адаптер" + IDS_FDDI "FDDI адаптер" + IDS_PPP "PPP адаптер" + IDS_LOOP "Loopback адаптер" + IDS_SLIP "SLIP адаптер" END STRINGTABLE DISCARDABLE BEGIN /* Please keep the spacing/formatting as per En.rc when translating */ IDS_USAGE - "\n:\n \ - ipconfig [/? | /all | /renew [] | /release [] |\n \ + "\nИСПОЛЬЗОВАНИЕ:\n \ + ipconfig [/? | /all | /renew [адаптер] | /release [адаптер] |\n \ /flushdns | /displaydns | /registerdns |\n \ - /showclassid |\n \ - /setclassid [___dhcp] ]\n \ + /showclassid адаптер |\n \ + /setclassid адаптер [устанавливаемый_код_класса_dhcp] ]\n \ \n \ - \n \ - \n \ - (* - , ? - , . )\n \ + Где\n \ + адаптер Название подключения\n \ + (* - любое количество знаков, ? - один любой знак, см. примеры)\n \ \n \ - :\n \ - /? .\n \ - /all .\n \ - /release IP- .\n \ - /renew IP- .\n \ - /flushdns DNS.\n \ - /registerdns DHCP- DNS-.\n \ - /displaydns DNS.\n \ - /showclassid (IDs) DHCP-.\n \ - /setclassid (ID) DHCP-.\n \ + Ключи:\n \ + /? Обобразить это справочное сообщение.\n \ + /all Отобразить полную информацию о настройке параметров.\n \ + /release Освободить IP-адрес для указанного адаптера.\n \ + /renew Обновить IP-адрес для указанного адаптера.\n \ + /flushdns Очистить кеш разрешений DNS.\n \ + /registerdns Обновить все DHCP-аренды и перерегистрировать DNS-имена.\n \ + /displaydns Отобразить содержимое кеша разрешений DNS.\n \ + /showclassid Отобразить все допустимые для этого адаптера коды (IDs) DHCP-классов.\n \ + /setclassid Изменить код (ID) DHCP-класса.\n \ \n \ - IP-, \n \ - , TCP/IP.\n \ + По умолчанию отображается только IP-адрес, маска подсети и стандартный шлюз\n \ + для каждого подключенного адаптера, для которого выполнена привязка с TCP/IP.\n \ \n \ - Release Renew, , \n \ - IP-, , \n \ - TCP/IP.\n \ + Для ключей Release и Renew, если не указано имя адаптера, будет освобожден или\n \ + обновлен IP-адрес, выданный для всех адаптеров, для которых существуют\n \ + привязки с TCP/IP.\n \ \n \ - Setclassid, (ID), .\n \ + Для ключа Setclassid, если не указан код класса (ID), существующий код класса будет удален.\n \ \n \ - :\n \ - > ipconfig ... .\n \ - > ipconfig /all ... \n \ - > ipconfig /renew ... \n \ - > ipconfig /renew EL* ... ,\n \ - EL\n \ - > ipconfig /release *Con* ... IP- ,\n \ - :\n \ - "" 1"" \n \ - "" 2""\n" + Примеры:\n \ + > ipconfig ... Отображает краткую информацию.\n \ + > ipconfig /all ... Отображает полную информацию\n \ + > ipconfig /renew ... Обновляет сведения для всех адаптеров\n \ + > ipconfig /renew EL* ... Обновляет сведения для адаптеров,\n \ + начинающихся с EL\n \ + > ipconfig /release *Con* ... Освобождает IP-адрес для всех адаптеров,\n \ + имена которых удовлетворяют запросу:\n \ + ""Подключение по локальной сети 1"" или\n \ + ""Подключение по локальной сети 2""\n" END diff --git a/base/applications/network/ipconfig/lang/uk-UA.rc b/base/applications/network/ipconfig/lang/uk-UA.rc index 2ecaed3c0ef..3d2af1ea4bd 100644 --- a/base/applications/network/ipconfig/lang/uk-UA.rc +++ b/base/applications/network/ipconfig/lang/uk-UA.rc @@ -13,61 +13,61 @@ BEGIN IDS_P2P "Peer To Peer" IDS_MIXED "Mixed" IDS_HYBRID "Hybrid" - IDS_UNKNOWN "" + IDS_UNKNOWN "Невідомий" END STRINGTABLE DISCARDABLE BEGIN - IDS_OTHER " " - IDS_ETH "Ethernet " - IDS_TOKEN "Token Ring " - IDS_FDDI "FDDI " - IDS_PPP "PPP " - IDS_LOOP "Loopback " - IDS_SLIP "SLIP " + IDS_OTHER "Інший тип адаптера" + IDS_ETH "Ethernet адаптер" + IDS_TOKEN "Token Ring адаптер" + IDS_FDDI "FDDI адаптер" + IDS_PPP "PPP адаптер" + IDS_LOOP "Loopback адаптер" + IDS_SLIP "SLIP адаптер" END STRINGTABLE DISCARDABLE BEGIN /* Please keep the spacing/formatting as per En.rc when translating */ IDS_USAGE - "\n:\n \ - ipconfig [/? | /all | /renew [] | /release [] |\n \ + "\nВИКОРИСТАННЯ:\n \ + ipconfig [/? | /all | /renew [адаптер] | /release [адаптер] |\n \ /flushdns | /displaydns | /registerdns |\n \ - /showclassid |\n \ - /setclassid [_classid] ]\n \ + /showclassid адптер |\n \ + /setclassid адаптер [встановлюваний_classid] ]\n \ \n \ - \n \ - '\n \ - ( -- *(- ) ?( )\n \ + де\n \ + адаптер Назва з'єднання\n \ + (дозволені символи маскування -- *(будь-яка кількість знаків) і ?(один символ)\n \ \n \ - :\n \ - /? \n \ - /all .\n \ - /release IP- .\n \ - /renew IP- .\n \ - /flushdns DNS .\n \ - /registerdns DHCP DNS.\n \ - /displaydns DNS.\n \ - /showclassid (Class ID) DHCP.\n \ - /setclassid DHCP (Class ID).\n \ + Ключі:\n \ + /? Вивести це повідомлення\n \ + /all Показати повну інформацію про мережні налаштування.\n \ + /release Звільнити IP-адресу вказаного адаптера.\n \ + /renew Обновити IP-адресу вказаного адаптера.\n \ + /flushdns Очистити кеш DNS записів.\n \ + /registerdns Оновити всі реєстрації DHCP і перереєстувати імена DNS.\n \ + /displaydns Показати вміст кешу DNS.\n \ + /showclassid Показати всі довзолені для вказаного адаптера коди(Class ID) DHCP.\n \ + /setclassid Змінтити код DHCP (Class ID).\n \ \n \ - IP-, \n \ - ' TCP/IP.\n \ + По замовчуванню відображається тільки IP-адреса, маска підмережі і шлюз\n \ + для кожного адаптера зв'язаного з TCP/IP.\n \ \n \ - Release Renew, ' ,\n \ - IP- ' TCP/IP.\n \ + При використанні ключів Release і Renew, якщо не було вказано ім'я адаптера,то\n \ + IP-адреса звільняється чи оновлюється для всіх адапетрів зв'язаних з TCP/IP.\n \ \n \ - Setclassid, ID (ClassId), .\n \ + При використанні ключа Setclassid, якщо не було вказано ID класу (ClassId), то існуючий код класу буде видалено.\n \ \n \ - :\n \ - > ipconfig ... .\n \ - > ipconfig /all ... .\n \ - > ipconfig /renew ... \n \ - > ipconfig /renew EL* ... ', \n \ - ' EL\n \ - > ipconfig /release *Con* ... ( )\n \ - ', ""on""\n \ - .""Local Area Connection 1"" \n \ + Приклади:\n \ + > ipconfig ... Вивести загальну інформацію.\n \ + > ipconfig /all ... Вивести повну інформацію.\n \ + > ipconfig /renew ... Оновити стан всіх адапетрів\n \ + > ipconfig /renew EL* ... Оновити стан всіх з'єднань, \n \ + ім'я яких починається на EL\n \ + > ipconfig /release *Con* ... Звільнити (скинути динамічну конфігурацію)\n \ + всі з'єднання, які містять у назві ""Сon""\n \ + напр.""Local Area Connection 1"" чи\n \ ""Local Area Connection 2""\n" END diff --git a/base/applications/network/ipconfig/lang/zh-CN.rc b/base/applications/network/ipconfig/lang/zh-CN.rc new file mode 100644 index 00000000000..2b28bc09c25 --- /dev/null +++ b/base/applications/network/ipconfig/lang/zh-CN.rc @@ -0,0 +1,69 @@ +/* + * Translated by Song Fuchang (0xfc) + */ + +LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED + +STRINGTABLE DISCARDABLE +BEGIN + IDS_BCAST "广播" + IDS_P2P "点对点" + IDS_MIXED "混合" + IDS_HYBRID "混杂" + IDS_UNKNOWN "未知" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_OTHER "其他类型的适配器" + IDS_ETH "以太网适配器" + IDS_TOKEN "令牌环适配器" + IDS_FDDI "FDDI 适配器" + IDS_PPP "PPP 适配器" + IDS_LOOP "本地环回适配器" + IDS_SLIP "SLIP 适配器" +END + +STRINGTABLE DISCARDABLE +BEGIN +/* Please keep the spacing/formatting as per En.rc when translating */ + IDS_USAGE + "\用法:\n \ + ipconfig [/? | /all | /renew [适配器] | /release [适配器] |\n \ + /flushdns | /displaydns | /registerdns |\n \ + /showclassid 适配器 |\n \ + /setclassid 适配器 [类ID] ]\n \ + \n \ + 其中\n \ + 适配器 连接名称\n \ + (通配符 * 和 ? 是被允许的,参见示例)\n \ + \n \ + 选项:\n \ + /? 显示这个帮助信息。\n \ + /all 显示完全的配置信息。\n \ + /release 释放指定适配器的 IP 地址。\n \ + /renew 更新指定适配器的 IP 地址。\n \ + /flushdns 清空 DNS 缓存。\n \ + /registerdns 刷新所有 DHCP 租约并且重新注册 DNS 名称。\n \ + /displaydns 显示 DNS 缓存中的内容。\n \ + /showclassid 显示所有被指定适配器允许的 DHCP 类 ID。\n \ + /setclassid 修改 DHCP 类 ID。\n \ + \n \ + 该程序的默认行为是仅显示每个绑定到 TCP/IP 的适配器的 IP 地址,子网掩码和\n \ + 默认网关。\n \ + \n \ + 对于释放和更新操作,如果没有指定适配器名称,那么所有绑定到 TCP/IP 的适配器\n \ + 的 IP 地址将会被释放或更新。\n \ + \n \ + 对于设置类 ID 操作,如果没有指定类 ID,那么类 ID 将被删除。\n \ + \n \ + 示例:\n \ + > ipconfig ... 显示信息。\n \ + > ipconfig /all ... 显示详细信息\n \ + > ipconfig /renew ... 更新所有适配器\n \ + > ipconfig /renew EL* ... 更新所有名称以 EL 开头\n \ + 的连接\n \ + > ipconfig /release *Con* ... 释放所有匹配的连接,\n \ + 如 ""Local Area Connection 1"" 或\n \ + ""Local Area Connection 2""\n" +END diff --git a/base/applications/network/net/CMakeLists.txt b/base/applications/network/net/CMakeLists.txt index 215d6a58d35..668c18a4ec0 100644 --- a/base/applications/network/net/CMakeLists.txt +++ b/base/applications/network/net/CMakeLists.txt @@ -11,5 +11,6 @@ list(APPEND SOURCE add_executable(net ${SOURCE}) set_module_type(net win32cui) +add_pch(net net.h) add_importlibs(net ws2_32 msvcrt kernel32) add_cd_file(TARGET net DESTINATION reactos/system32 FOR all) diff --git a/base/applications/network/nslookup/CMakeLists.txt b/base/applications/network/nslookup/CMakeLists.txt index bc6fe21eaa0..6a6b59fce1b 100644 --- a/base/applications/network/nslookup/CMakeLists.txt +++ b/base/applications/network/nslookup/CMakeLists.txt @@ -4,6 +4,7 @@ add_executable(nslookup utility.c nslookup.rc) +add_pch(nslookup nslookup.h) set_module_type(nslookup win32cui) add_importlibs(nslookup user32 ws2_32 snmpapi iphlpapi msvcrt kernel32) add_cd_file(TARGET nslookup DESTINATION reactos/system32 FOR all) diff --git a/base/applications/network/nslookup/nslookup.c b/base/applications/network/nslookup/nslookup.c index 11b1e91040b..fc94274da00 100644 --- a/base/applications/network/nslookup/nslookup.c +++ b/base/applications/network/nslookup/nslookup.c @@ -6,13 +6,6 @@ * COPYRIGHT: Copyright 2009 Lucas Suggs */ -#include -#include -#include -#include -#include -#include -#include #include "nslookup.h" STATE State; diff --git a/base/applications/network/nslookup/nslookup.h b/base/applications/network/nslookup/nslookup.h index 51ff023001b..06cd69cc7f5 100644 --- a/base/applications/network/nslookup/nslookup.h +++ b/base/applications/network/nslookup/nslookup.h @@ -1,3 +1,11 @@ +#include +#include +#include +#include +#include +#include +#include + #define TypeA "A" #define TypeAAAA "AAAA" #define TypeBoth "A+AAAA" diff --git a/base/applications/network/nslookup/utility.c b/base/applications/network/nslookup/utility.c index 50e8cc12d29..3b8d17f92b1 100644 --- a/base/applications/network/nslookup/utility.c +++ b/base/applications/network/nslookup/utility.c @@ -6,9 +6,6 @@ * COPYRIGHT: Copyright 2009 Lucas Suggs */ -#include -#include -#include #include "nslookup.h" BOOL SendRequest( PCHAR pInBuffer, diff --git a/base/applications/network/ping/CMakeLists.txt b/base/applications/network/ping/CMakeLists.txt index db5e7fc7206..ab49818789e 100644 --- a/base/applications/network/ping/CMakeLists.txt +++ b/base/applications/network/ping/CMakeLists.txt @@ -1,16 +1,16 @@ -set_unicode() add_definitions(-D__USE_W32_SOCKETS) set_unicode() +set_rc_compiler() add_executable(ping ping.c ping.rc) set_module_type(ping win32cui) - add_importlibs(ping ws2_32 msvcrt kernel32) + if(MSVC) -add_importlibs(ping ntdll) + add_importlibs(ping ntdll) endif() add_cd_file(TARGET ping DESTINATION reactos/system32 FOR all) diff --git a/base/applications/network/ping/lang/uk-UA.rc b/base/applications/network/ping/lang/uk-UA.rc index 95ef509d7a5..e4a8ab3c026 100644 --- a/base/applications/network/ping/lang/uk-UA.rc +++ b/base/applications/network/ping/lang/uk-UA.rc @@ -10,34 +10,34 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT STRINGTABLE DISCARDABLE BEGIN - IDS_USAGE "\n: ping [-t] [-n count] [-l size] [-w timeout] \n\n\ -:\n\ - -t ϳ .\n\ - Control-C.\n\ - -n count ʳ , .\n\ - -l size .\n\ - -w timeout .\n\n\0" + IDS_USAGE "\nВикористання: ping [-t] [-n count] [-l size] [-w timeout] хост\n\n\ +Опції:\n\ + -t Пінг вказаного вузла поки не буде здійснена ручна зупинка.\n\ + Для зупинки натисніть Control-C.\n\ + -n count Кількість запитів, які будуть підправлені.\n\ + -l size Розмір буфера відправки.\n\ + -w timeout Час очікування кожної відповіді в мілісекундах.\n\n\0" - IDS_PING_WITH_BYTES "\n %1 [%2] %3!d! :\n\n\0" - IDS_PING_STATISTICS "\n Ping %1:\n\0" - IDS_PACKETS_SENT_RECEIVED_LOST " : = %1!d!, = %2!d!, = %3!d! (%4!d!%% ),\n\0" - IDS_APPROXIMATE_ROUND_TRIP " -:\n\0" - IDS_MIN_MAX_AVERAGE " ̳ = %1, = %2, = %3\n\0" - IDS_NOT_ENOUGH_RESOURCES " .\n\0" - IDS_UNKNOWN_HOST " %1.\n\0" - IDS_SETSOCKOPT_FAILED "setsockopt (%1!d!).\n\0" - IDS_COULD_NOT_CREATE_SOCKET " (#%1!d!).\n\0" - IDS_COULD_NOT_INIT_WINSOCK " winsock dll.\n\0" - IDS_DEST_MUST_BE_SPECIFIED "' IP- .\n\0" - IDS_BAD_PARAMETER " %1.\n\0" - IDS_BAD_OPTION_FORMAT " %1.\n\0" - IDS_BAD_OPTION " %1.\n\0" - IDS_BAD_VALUE_OPTION_L " -l, 0 %1!d!.\n\0" - IDS_REPLY_FROM "³ %1: =%2!d! %3%4 TTL=%5!d!\n\0" - IDS_DEST_UNREACHABLE " .\n\0" - IDS_COULD_NOT_TRANSMIT " (%1!d!).\n\0" - IDS_COULD_NOT_RECV " (%1!d!).\n\0" - IDS_REQUEST_TIMEOUT " .\n\0" - IDS_MS "\0" - IDS_1MS "1\0" + IDS_PING_WITH_BYTES "\nОбмін пакетами з %1 [%2] по %3!d! байта:\n\n\0" + IDS_PING_STATISTICS "\nСтатистика Ping для %1:\n\0" + IDS_PACKETS_SENT_RECEIVED_LOST " Пакетів: відправлено = %1!d!, отримано = %2!d!, втрачено = %3!d! (%4!d!%% втрат),\n\0" + IDS_APPROXIMATE_ROUND_TRIP "Приблизний час прийому-передачі:\n\0" + IDS_MIN_MAX_AVERAGE " Мінімальний = %1, Максимальний = %2, Середній = %3\n\0" + IDS_NOT_ENOUGH_RESOURCES "Недостатньо вільних ресурсів.\n\0" + IDS_UNKNOWN_HOST "Невідомий хост %1.\n\0" + IDS_SETSOCKOPT_FAILED "setsockopt невдалий (%1!d!).\n\0" + IDS_COULD_NOT_CREATE_SOCKET "Не вдалося створити сокет (#%1!d!).\n\0" + IDS_COULD_NOT_INIT_WINSOCK "Не вдалося ініціалізувати winsock dll.\n\0" + IDS_DEST_MUST_BE_SPECIFIED "Ім'я або IP-адреса хосту повинні бути вказані.\n\0" + IDS_BAD_PARAMETER "Поганий параметр %1.\n\0" + IDS_BAD_OPTION_FORMAT "Невірний формат опції %1.\n\0" + IDS_BAD_OPTION "Погана опція %1.\n\0" + IDS_BAD_VALUE_OPTION_L "Неправильне значення для опції -l, допустимий діапазон від 0 до %1!d!.\n\0" + IDS_REPLY_FROM "Відповідь від %1: байтів=%2!d! час%3%4 TTL=%5!d!\n\0" + IDS_DEST_UNREACHABLE "Хост недоступний.\n\0" + IDS_COULD_NOT_TRANSMIT "Не вдалося передати дані (%1!d!).\n\0" + IDS_COULD_NOT_RECV "Не вдалося отримати дані (%1!d!).\n\0" + IDS_REQUEST_TIMEOUT "Очікування запиту.\n\0" + IDS_MS "мс\0" + IDS_1MS "1мс\0" END diff --git a/base/applications/network/ping/lang/zh-CN.rc b/base/applications/network/ping/lang/zh-CN.rc new file mode 100644 index 00000000000..295942cb100 --- /dev/null +++ b/base/applications/network/ping/lang/zh-CN.rc @@ -0,0 +1,39 @@ +/* + * Translated by Song Fuchang (0xfc) + */ + +LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED + +STRINGTABLE DISCARDABLE +BEGIN + IDS_USAGE "\用法:ping [-t] [-n 次数] [-l 大小] [-w 超时] 目标主机\n\n\ +选项:\n\ + -t 不停呼叫指定的主机直到被终止。\n\ + 要停止 - 按下 Ctrl-C。\n\ + -n 次数 发送回响包的次数。\n\ + -l 大小 发送包的大小。\n\ + -w 超时 等待每个回复的时间(毫秒)。\n\n\0" + + IDS_PING_WITH_BYTES "\n正在呼叫 %1 [%2] ,数据包大小 %3!d! 字节:\n\n\0" + IDS_PING_STATISTICS "\n%1 的呼叫统计:\n\0" + IDS_PACKETS_SENT_RECEIVED_LOST " 数据包:发送个数 = %1!d!,接收个数 = %2!d!,丢失个数 = %3!d! (丢失率 %4!d!%%),\n\0" + IDS_APPROXIMATE_ROUND_TRIP "近似来回所需时间(毫秒):\n\0" + IDS_MIN_MAX_AVERAGE " 最小值 = %1, 最大值 = %2, 平均值 = %3\n\0" + IDS_NOT_ENOUGH_RESOURCES "空闲资源不足。\n\0" + IDS_UNKNOWN_HOST "未知主机 %1。\n\0" + IDS_SETSOCKOPT_FAILED "setsockopt 失败 (%1!d!)。\n\0" + IDS_COULD_NOT_CREATE_SOCKET "不能创建套接字 (#%1!d!)。\n\0" + IDS_COULD_NOT_INIT_WINSOCK "不能初始化 winsock dll。\n\0" + IDS_DEST_MUST_BE_SPECIFIED "目标主机的名称或 IP 地址必须被指定。\n\0" + IDS_BAD_PARAMETER "错误参数 %1。\n\0" + IDS_BAD_OPTION_FORMAT "错误选项格式 %1。\n\0" + IDS_BAD_OPTION "错误选项 %1。\n\0" + IDS_BAD_VALUE_OPTION_L "-l 选项的值无效,有效的范围是从 0 到 %1!d!。\n\0" + IDS_REPLY_FROM "来自 %1 的回复:字节数=%2!d! 时间%3%4 TTL=%5!d!\n\0" + IDS_DEST_UNREACHABLE "目标主机不可到达。\n\0" + IDS_COULD_NOT_TRANSMIT "无法发送数据 (%1!d!)。\n\0" + IDS_COULD_NOT_RECV "无法接收数据 (%1!d!)。\n\0" + IDS_REQUEST_TIMEOUT "请求超时。\n\0" + IDS_MS "ms\0" + IDS_1MS "1ms\0" +END diff --git a/base/applications/network/ping/ping.rc b/base/applications/network/ping/ping.rc index a45986f91f6..fcfe015c956 100644 --- a/base/applications/network/ping/ping.rc +++ b/base/applications/network/ping/ping.rc @@ -14,8 +14,9 @@ #include "lang/fr-FR.rc" #include "lang/it-IT.rc" #include "lang/sv-SE.rc" -#include "lang/uk-UA.rc" // UTF-8 #pragma code_page(65001) #include "lang/pl-PL.rc" +#include "lang/uk-UA.rc" +#include "lang/zh-CN.rc" diff --git a/base/applications/network/route/CMakeLists.txt b/base/applications/network/route/CMakeLists.txt index 7dde646d9ff..77dde09896b 100644 --- a/base/applications/network/route/CMakeLists.txt +++ b/base/applications/network/route/CMakeLists.txt @@ -1,6 +1,4 @@ -add_definitions(-D_DLL -D__USE_CRTIMP) - set_unicode() add_executable(route route.c route.rc) diff --git a/base/applications/network/telnet/CMakeLists.txt b/base/applications/network/telnet/CMakeLists.txt index 8807761f2ca..74f41d0ea5b 100644 --- a/base/applications/network/telnet/CMakeLists.txt +++ b/base/applications/network/telnet/CMakeLists.txt @@ -1,7 +1,5 @@ -add_definitions( - -D_CRT_NONSTDC_NO_DEPRECATE - -D_DLL -D__USE_CRTIMP) +add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE) set_cpp() @@ -28,5 +26,6 @@ add_executable(telnet telnet.rc) set_module_type(telnet win32cui) +add_pch(telnet src/precomp.h) add_importlibs(telnet ws2_32 user32 msvcrt kernel32) add_cd_file(TARGET telnet DESTINATION reactos/system32 FOR all) diff --git a/base/applications/network/telnet/src/ansiprsr.cpp b/base/applications/network/telnet/src/ansiprsr.cpp index e24f44fea35..1263733e988 100644 --- a/base/applications/network/telnet/src/ansiprsr.cpp +++ b/base/applications/network/telnet/src/ansiprsr.cpp @@ -50,8 +50,7 @@ /////////////////////////////////////////////////////////////////////////////// //#include -#include -#include "ansiprsr.h" +#include "precomp.h" const int ANSIColors[] = {BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE}; diff --git a/base/applications/network/telnet/src/keytrans.cpp b/base/applications/network/telnet/src/keytrans.cpp index 0647c8e636c..e385d11c512 100644 --- a/base/applications/network/telnet/src/keytrans.cpp +++ b/base/applications/network/telnet/src/keytrans.cpp @@ -44,21 +44,7 @@ // DeleteKeyDef : Deletes a key def from the list // /////////////////////////////////////////////////////////////////// -#include - -// changed to make work with VC++ (Paul Brannan 5/25/98) -// FIX ME !!! Ioannou: This must be __BORLANDC__ && VERSION < 5 -// but what is the directive for Borland version ???? -// FIXED Sept. 31, 2000 (Bernard Badger) -// -#if defined(__BORLANDC__) && (__BORLANDC < 0x0500) -#include -#else -#include -#endif - -#include "keytrans.h" -#include "tnerror.h" +#include "precomp.h" ///////////////////////////////////////////////////////////// // class KeyTranslator // diff --git a/base/applications/network/telnet/src/precomp.h b/base/applications/network/telnet/src/precomp.h new file mode 100644 index 00000000000..373e06f5c44 --- /dev/null +++ b/base/applications/network/telnet/src/precomp.h @@ -0,0 +1,47 @@ +#include "ansiprsr.h" + +#if defined(__BORLANDC__) && (__BORLANDC < 0x0500) +#include +#else +#include +#endif + +#ifdef __BORLANDC__ +#include +#else +#include +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "keytrans.h" +#include "tnerror.h" +#include "tcharmap.h" +#include "tnconfig.h" +#include "tconsole.h" +#include "tkeydef.h" +#include "tkeymap.h" +#include "tmapldr.h" +#include "tmouse.h" +#include "tnclass.h" +#include "tnmisc.h" +#include "tnclip.h" +#include "tncon.h" +#include "ttelhndl.h" +#include "tnetwork.h" +#include "tnmain.h" +#include "tscript.h" +#include "tscroll.h" +#include "telnet.h" +#include "tparams.h" diff --git a/base/applications/network/telnet/src/tcharmap.cpp b/base/applications/network/telnet/src/tcharmap.cpp index 23564c8b872..4bc461e8279 100644 --- a/base/applications/network/telnet/src/tcharmap.cpp +++ b/base/applications/network/telnet/src/tcharmap.cpp @@ -28,9 +28,7 @@ // Written by Paul Brannan // Last modified 7/12/98 -#include -#include "tcharmap.h" -#include "tnconfig.h" +#include "precomp.h" // map B (US ASCII) // this maps each character to itself diff --git a/base/applications/network/telnet/src/tconsole.cpp b/base/applications/network/telnet/src/tconsole.cpp index ec866816c0d..97449aa04ca 100644 --- a/base/applications/network/telnet/src/tconsole.cpp +++ b/base/applications/network/telnet/src/tconsole.cpp @@ -46,8 +46,7 @@ // /////////////////////////////////////////////////////////////////////////////// -#include -#include "tconsole.h" +#include "precomp.h" // argsused doesn't work on MSVC++ #ifdef __BORLANDC__ diff --git a/base/applications/network/telnet/src/tkeydef.cpp b/base/applications/network/telnet/src/tkeydef.cpp index e1803271826..2d3e2120a08 100644 --- a/base/applications/network/telnet/src/tkeydef.cpp +++ b/base/applications/network/telnet/src/tkeydef.cpp @@ -29,8 +29,7 @@ // originally part of KeyTrans.cpp // ///////////////////////////////////////////////////////// -#include "tkeydef.h" -#include +#include "precomp.h" // This class did not properly release memory before, and a buffer overrun // was apparent in operator=(char*). Fixed. (Paul Brannan Feb. 4, 1999) diff --git a/base/applications/network/telnet/src/tkeymap.cpp b/base/applications/network/telnet/src/tkeymap.cpp index e1730f5a8bf..c62020a6672 100644 --- a/base/applications/network/telnet/src/tkeymap.cpp +++ b/base/applications/network/telnet/src/tkeymap.cpp @@ -29,7 +29,7 @@ // originally part of KeyTrans.cpp // ///////////////////////////////////////////////////////// -#include "tkeymap.h" +#include "precomp.h" KeyMap::KeyMap(DWORD state, DWORD code): map(0,0,sizeof(TKeyDef)), key(NULL,state,code) {}; diff --git a/base/applications/network/telnet/src/tmapldr.cpp b/base/applications/network/telnet/src/tmapldr.cpp index 18e2d621a60..3680645db11 100644 --- a/base/applications/network/telnet/src/tmapldr.cpp +++ b/base/applications/network/telnet/src/tmapldr.cpp @@ -29,15 +29,7 @@ // originally part of KeyTrans.cpp // ///////////////////////////////////////////////////////// -#include "tmapldr.h" -#include "tnconfig.h" - -#ifdef __BORLANDC__ -#include -#else -#include -#include -#endif +#include "precomp.h" // It's probably a good idea to turn off the "identifier was truncated" warning // in MSVC (Paul Brannan 5/25/98) diff --git a/base/applications/network/telnet/src/tmouse.cpp b/base/applications/network/telnet/src/tmouse.cpp index 322965bc5a3..317289dcf95 100644 --- a/base/applications/network/telnet/src/tmouse.cpp +++ b/base/applications/network/telnet/src/tmouse.cpp @@ -28,8 +28,7 @@ // Written by Paul Brannan // Last modified August 30, 1998 -#include "tmouse.h" -#include "tconsole.h" +#include "precomp.h" TMouse::TMouse(Tnclip &RefClipboard): Clipboard(RefClipboard) { hConsole = GetStdHandle(STD_INPUT_HANDLE); diff --git a/base/applications/network/telnet/src/tnclass.cpp b/base/applications/network/telnet/src/tnclass.cpp index b7a1f835310..8998523bb60 100644 --- a/base/applications/network/telnet/src/tnclass.cpp +++ b/base/applications/network/telnet/src/tnclass.cpp @@ -41,10 +41,7 @@ // /////////////////////////////////////////////////////////////////////////////// -#include -#include -#include "tnclass.h" -#include "tnmisc.h" +#include "precomp.h" // Mingw32 needs these (Paul Brannan 9/4/98) #ifndef ICON_SMALL diff --git a/base/applications/network/telnet/src/tnclip.cpp b/base/applications/network/telnet/src/tnclip.cpp index 54f3eba2308..ec47838614e 100644 --- a/base/applications/network/telnet/src/tnclip.cpp +++ b/base/applications/network/telnet/src/tnclip.cpp @@ -28,8 +28,7 @@ // Written by Paul Brannan // Last modified 7/12/98 -#include -#include "tnclip.h" +#include "precomp.h" Tnclip::Tnclip(HWND W, TNetwork &RefNetwork): Network(RefNetwork) { Window = W; diff --git a/base/applications/network/telnet/src/tncon.cpp b/base/applications/network/telnet/src/tncon.cpp index 10e9d4d0aed..6681317f2ee 100644 --- a/base/applications/network/telnet/src/tncon.cpp +++ b/base/applications/network/telnet/src/tncon.cpp @@ -43,10 +43,8 @@ // Original code // /////////////////////////////////////////////////////////////////////////////// -#include "tncon.h" -#include "keytrans.h" -#include "ttelhndl.h" -#include "tconsole.h" + +#include "precomp.h" #define KEYEVENT InputRecord[i].Event.KeyEvent diff --git a/base/applications/network/telnet/src/tnconfig.cpp b/base/applications/network/telnet/src/tnconfig.cpp index 5bd8dfaef21..9a9ad5ce192 100644 --- a/base/applications/network/telnet/src/tnconfig.cpp +++ b/base/applications/network/telnet/src/tnconfig.cpp @@ -30,14 +30,7 @@ // This is a class designed for use with Brad Johnson's Console Telnet // see the file tnconfig.h for more information -#include -#include -#include -#include -#include -#include -#include -#include "tnconfig.h" +#include "precomp.h" // Turn off the "forcing value to bool 'true' or 'false'" warning #ifdef _MSC_VER diff --git a/base/applications/network/telnet/src/tnerror.cpp b/base/applications/network/telnet/src/tnerror.cpp index 74249cb55a0..1a77ed9bc2b 100644 --- a/base/applications/network/telnet/src/tnerror.cpp +++ b/base/applications/network/telnet/src/tnerror.cpp @@ -42,13 +42,7 @@ // /////////////////////////////////////////////////////////////////////////////// -#include "tnerror.h" -#include "ttelhndl.h" // Paul Brannan 5/25/98 -#include "tnconfig.h" // Paul Brannan 5/25/98 -#include -#include -#include -#include +#include "precomp.h" #ifndef LANG_USER_DEFAULT #define LANG_USER_DEFAULT 400 diff --git a/base/applications/network/telnet/src/tnetwork.cpp b/base/applications/network/telnet/src/tnetwork.cpp index 64eed9be358..8cab0d564bd 100644 --- a/base/applications/network/telnet/src/tnetwork.cpp +++ b/base/applications/network/telnet/src/tnetwork.cpp @@ -35,7 +35,7 @@ // /////////////////////////////////////////////////////////////////////////////// -#include "tnetwork.h" +#include "precomp.h" void TNetwork::SetSocket(SOCKET s) { socket = s; diff --git a/base/applications/network/telnet/src/tnmain.cpp b/base/applications/network/telnet/src/tnmain.cpp index 011686baa78..0fc983b2cd3 100644 --- a/base/applications/network/telnet/src/tnmain.cpp +++ b/base/applications/network/telnet/src/tnmain.cpp @@ -42,10 +42,7 @@ // /////////////////////////////////////////////////////////////////////////////// -#include -#include -#include "tnmain.h" -#include "tnmisc.h" +#include "precomp.h" int telCommandLine (Telnet &MyConnection); diff --git a/base/applications/network/telnet/src/tnmisc.cpp b/base/applications/network/telnet/src/tnmisc.cpp index 25e319a81aa..0698b19fccd 100644 --- a/base/applications/network/telnet/src/tnmisc.cpp +++ b/base/applications/network/telnet/src/tnmisc.cpp @@ -1,7 +1,4 @@ -#include -#include - -#include "tnmisc.h" +#include "precomp.h" // from the PVAX (http://www.ccas.ru/~posp/popov/spawn.htm) // Create a process with pipes to stdin/out/err diff --git a/base/applications/network/telnet/src/tscript.cpp b/base/applications/network/telnet/src/tscript.cpp index 2045e43ce17..24774a77683 100644 --- a/base/applications/network/telnet/src/tscript.cpp +++ b/base/applications/network/telnet/src/tscript.cpp @@ -23,7 +23,7 @@ // /////////////////////////////////////////////////////////////////////////// -#include "tscript.h" +#include "precomp.h" // FIX ME!! This code not yet functional. diff --git a/base/applications/network/telnet/src/tscroll.cpp b/base/applications/network/telnet/src/tscroll.cpp index 6c8294ede4a..0b2a3e19d18 100644 --- a/base/applications/network/telnet/src/tscroll.cpp +++ b/base/applications/network/telnet/src/tscroll.cpp @@ -38,13 +38,7 @@ // /////////////////////////////////////////////////////////////////////////////// -#include -#include -#include -#include "tscroll.h" -#include "tncon.h" -#include "tconsole.h" -#include "tnconfig.h" +#include "precomp.h" enum { HEX, diff --git a/base/applications/network/telnet/src/ttelhndl.cpp b/base/applications/network/telnet/src/ttelhndl.cpp index 0020f3558f3..9caabc1be83 100644 --- a/base/applications/network/telnet/src/ttelhndl.cpp +++ b/base/applications/network/telnet/src/ttelhndl.cpp @@ -38,11 +38,7 @@ // /////////////////////////////////////////////////////////////////////////////// -#include -#include "ttelhndl.h" -#include "telnet.h" -#include "tnconfig.h" -#include "tparams.h" +#include "precomp.h" int naws_string(char *buf, int width, int height); diff --git a/base/applications/network/whois/CMakeLists.txt b/base/applications/network/whois/CMakeLists.txt index fb67240d921..755fc7a9818 100644 --- a/base/applications/network/whois/CMakeLists.txt +++ b/base/applications/network/whois/CMakeLists.txt @@ -1,6 +1,4 @@ -add_definitions(-D_DLL -D__USE_CRTIMP) - add_executable(whois whois.c whois.rc) set_module_type(whois win32cui) diff --git a/base/applications/notepad/CMakeLists.txt b/base/applications/notepad/CMakeLists.txt index c59cd26f2bb..60d2f774132 100644 --- a/base/applications/notepad/CMakeLists.txt +++ b/base/applications/notepad/CMakeLists.txt @@ -8,10 +8,9 @@ list(APPEND SOURCE set_rc_compiler() -add_pch(notepad ${CMAKE_CURRENT_SOURCE_DIR}/notepad.h ${SOURCE}) - -add_executable(notepad ${CMAKE_CURRENT_BINARY_DIR}/notepad_notepad.h.gch ${SOURCE}) +add_executable(notepad ${SOURCE}) set_module_type(notepad win32gui) add_importlibs(notepad user32 gdi32 comctl32 comdlg32 advapi32 shell32 msvcrt kernel32) +add_pch(notepad notepad.h) add_cd_file(TARGET notepad DESTINATION reactos/system32 FOR all) diff --git a/base/applications/notepad/lang/hy-AM.rc b/base/applications/notepad/lang/hy-AM.rc index e88eafa793c..ec55ae954b4 100644 --- a/base/applications/notepad/lang/hy-AM.rc +++ b/base/applications/notepad/lang/hy-AM.rc @@ -186,5 +186,3 @@ STRING_LF, "Յունիքս" STRING_CR, "Մակինտոշ" STRING_LINE_COLUMN, "Line %d, column %d" END - -#pragma code_page(default) diff --git a/base/applications/notepad/lang/ro-RO.rc b/base/applications/notepad/lang/ro-RO.rc index 97ca3837b38..24eebbcd2a0 100644 --- a/base/applications/notepad/lang/ro-RO.rc +++ b/base/applications/notepad/lang/ro-RO.rc @@ -202,5 +202,3 @@ STRING_LF, "Unix" STRING_CR, "Mac" STRING_LINE_COLUMN, "Linie %d, coloană %d" END - -#pragma code_page(default) diff --git a/base/applications/notepad/lang/ru-RU.rc b/base/applications/notepad/lang/ru-RU.rc index c5b3b0becfe..16d3ae19393 100644 --- a/base/applications/notepad/lang/ru-RU.rc +++ b/base/applications/notepad/lang/ru-RU.rc @@ -40,53 +40,53 @@ END MAIN_MENU MENU BEGIN - POPUP "&" + POPUP "&Файл" BEGIN - MENUITEM "&\tCtrl+N", CMD_NEW - MENUITEM "&\tCtrl+O", CMD_OPEN - MENUITEM "&\tCtrl+S", CMD_SAVE - MENUITEM " &...", CMD_SAVE_AS + MENUITEM "Созд&ать\tCtrl+N", CMD_NEW + MENUITEM "&Открыть\tCtrl+O", CMD_OPEN + MENUITEM "&Сохранить\tCtrl+S", CMD_SAVE + MENUITEM "Сохранить &как...", CMD_SAVE_AS MENUITEM SEPARATOR - MENUITEM "& ...", CMD_PAGE_SETUP - MENUITEM "&\tCtrl+P", CMD_PRINT - MENUITEM "& ...", CMD_PRINTER_SETUP + MENUITEM "Пара&метры страницы...", CMD_PAGE_SETUP + MENUITEM "&Печатать\tCtrl+P", CMD_PRINT + MENUITEM "&Настройка принтера...", CMD_PRINTER_SETUP MENUITEM SEPARATOR - MENUITEM "&", CMD_EXIT + MENUITEM "В&ыход", CMD_EXIT END - POPUP "&" + POPUP "&Правка" BEGIN - MENUITEM "&\tCtrl+Z", CMD_UNDO + MENUITEM "&Отменить\tCtrl+Z", CMD_UNDO MENUITEM SEPARATOR - MENUITEM "&\tCtrl+X", CMD_CUT - MENUITEM "&\tCtrl+C", CMD_COPY - MENUITEM "&\tCtrl+V", CMD_PASTE - MENUITEM "&\tDel", CMD_DELETE + MENUITEM "&Вырезать\tCtrl+X", CMD_CUT + MENUITEM "&Копировать\tCtrl+C", CMD_COPY + MENUITEM "Вст&авить\tCtrl+V", CMD_PASTE + MENUITEM "&Удалить\tDel", CMD_DELETE MENUITEM SEPARATOR - MENUITEM "&", CMD_SEARCH - MENUITEM " &\tF3", CMD_SEARCH_NEXT - MENUITEM "\tCtrl+H", CMD_REPLACE - MENUITEM " ...\tCtrl+G", CMD_GOTO + MENUITEM "&Найти", CMD_SEARCH + MENUITEM "Найти &далее\tF3", CMD_SEARCH_NEXT + MENUITEM "Заменить\tCtrl+H", CMD_REPLACE + MENUITEM "Перейти к...\tCtrl+G", CMD_GOTO MENUITEM SEPARATOR - MENUITEM " &", CMD_SELECT_ALL - MENUITEM "& \tF5", CMD_TIME_DATE + MENUITEM "Выделить в&се", CMD_SELECT_ALL + MENUITEM "Врем&я и дата\tF5", CMD_TIME_DATE END - POPUP "&" + POPUP "Фо&рмат" BEGIN - MENUITEM "& ", CMD_WRAP - MENUITEM "&...", CMD_FONT + MENUITEM "&Перенос по словам", CMD_WRAP + MENUITEM "&Шрифт...", CMD_FONT END - POPUP "&" + POPUP "&Вид" BEGIN - MENUITEM " &", CMD_STATUSBAR + MENUITEM "Строка &состояния", CMD_STATUSBAR END - POPUP "&" + POPUP "&Справка" BEGIN - MENUITEM "&", CMD_HELP_CONTENTS - MENUITEM "&...", CMD_HELP_SEARCH - MENUITEM "& ", CMD_HELP_ON_HELP + MENUITEM "&Содержание", CMD_HELP_CONTENTS + MENUITEM "&Поиск...", CMD_HELP_SEARCH + MENUITEM "&Использование справки", CMD_HELP_ON_HELP MENUITEM SEPARATOR - MENUITEM "& ", CMD_ABOUT - MENUITEM "&...", CMD_ABOUT_WINE + MENUITEM "&О программе", CMD_ABOUT + MENUITEM "&Сведения...", CMD_ABOUT_WINE END END @@ -95,26 +95,26 @@ END DIALOG_PAGESETUP DIALOGEX 0, 0, 225, 95 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU FONT 8, "MS Shell Dlg" -CAPTION " " +CAPTION "Параметры страницы" BEGIN -LTEXT "& :", 0x140, 10, 07, 40, 15 +LTEXT "В&ерхний колонтитул:", 0x140, 10, 07, 40, 15 EDITTEXT 0x141, 60, 05,110, 12, WS_BORDER | WS_TABSTOP -LTEXT "& :", 0x142, 10, 24, 40, 15 +LTEXT "Н&ижний колонтитул:", 0x142, 10, 24, 40, 15 EDITTEXT 0x143, 60, 22,110, 12, WS_BORDER | WS_TABSTOP -GROUPBOX " ():", 0x144, 10, 43,160, 45 -LTEXT "&:", 0x145, 20, 55, 30, 10, WS_CHILD +GROUPBOX "Поля (мм):", 0x144, 10, 43,160, 45 +LTEXT "&Левое:", 0x145, 20, 55, 30, 10, WS_CHILD EDITTEXT /*STRING_PAGESETUP_LEFTVALUE,*/ 0x147, 50, 55, 35, 11, WS_CHILD | WS_BORDER | WS_TABSTOP -LTEXT "&:", 0x148, 20, 73, 30, 10, WS_CHILD +LTEXT "&Верхнее:", 0x148, 20, 73, 30, 10, WS_CHILD EDITTEXT /*STRING_PAGESETUP_TOPVALUE,*/ 0x14A, 50, 73, 35, 11, WS_CHILD | WS_BORDER | WS_TABSTOP -LTEXT "&:", 0x14B, 100, 55, 30, 10, WS_CHILD +LTEXT "&Правое:", 0x14B, 100, 55, 30, 10, WS_CHILD EDITTEXT /*STRING_PAGESETUP_RIGHTVALUE,*/ 0x14D, 130, 55, 35, 11, WS_CHILD | WS_BORDER | WS_TABSTOP -LTEXT "&:", 0x14E,100, 73, 30, 10, WS_CHILD +LTEXT "&Нижнее:", 0x14E,100, 73, 30, 10, WS_CHILD EDITTEXT /*STRING_PAGESETUP_BOTTOMVALUE,*/ 0x150, 130, 73, 35, 11, WS_CHILD | WS_BORDER | WS_TABSTOP DEFPUSHBUTTON "OK", IDOK, 180, 3, 40, 15, WS_TABSTOP -PUSHBUTTON "", IDCANCEL, 180, 21, 40, 15, WS_TABSTOP -PUSHBUTTON "&", IDHELP, 180, 39, 40, 15, WS_TABSTOP +PUSHBUTTON "Отмена", IDCANCEL, 180, 21, 40, 15, WS_TABSTOP +PUSHBUTTON "&Справка", IDHELP, 180, 39, 40, 15, WS_TABSTOP END /* Dialog `Encoding' */ @@ -123,12 +123,12 @@ DIALOG_ENCODING DIALOGEX 0, 0, 256, 44 STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPSIBLINGS | WS_CAPTION | WS_SYSMENU FONT 8, "MS Shell Dlg" -CAPTION " " +CAPTION "Кодировка символов" BEGIN COMBOBOX ID_ENCODING,54,0,156,80,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP -LTEXT ":",0x155,5,2,41,12 +LTEXT "Кодировка:",0x155,5,2,41,12 COMBOBOX ID_EOLN,54,18,156,80,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP -LTEXT ":",0x156,5,20,41,12 +LTEXT "Вариант:",0x156,5,20,41,12 END /* Dialog 'Go To' */ @@ -136,24 +136,24 @@ END DIALOG_GOTO DIALOGEX 0,0,165,50 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU FONT 8, "MS Shell Dlg" -CAPTION " " +CAPTION "Перейти к строке" BEGIN EDITTEXT ID_LINENUMBER,54,10,106,12,WS_CHILD | WS_BORDER | WS_TABSTOP -LTEXT " :",0x155,5,12,41,12,WS_CHILD | WS_TABSTOP | ES_NUMBER +LTEXT "Номер строки:",0x155,5,12,41,12,WS_CHILD | WS_TABSTOP | ES_NUMBER DEFPUSHBUTTON "OK", IDOK, 75, 30, 40, 15, WS_CHILD | WS_TABSTOP -PUSHBUTTON "", IDCANCEL, 120, 30, 40, 15, WS_CHILD | WS_TABSTOP +PUSHBUTTON "Отмена", IDCANCEL, 120, 30, 40, 15, WS_CHILD | WS_TABSTOP END IDD_ABOUTBOX DIALOGEX DISCARDABLE 22,16,284,170 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU -CAPTION " ReactOS" +CAPTION "О программе Блокнот ReactOS" FONT 8, "MS Shell Dlg" BEGIN - CONTROL " ReactOS v1.0\r\nCopyright 1997,98 Marcel Baur \r\nCopyright 2000 Mike McCormack \r\nCopyright 2002 Sylvain Petreolle \r\nCopyright 2002 Andriy Palamarchuk\r\n ", + CONTROL "Блокнот ReactOS v1.0\r\nCopyright 1997,98 Marcel Baur \r\nCopyright 2000 Mike McCormack \r\nCopyright 2002 Sylvain Petreolle \r\nCopyright 2002 Andriy Palamarchuk\r\n ", -1,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,46,7,232,39 CONTROL " ", -1,"Static",0x50000000,8,48,272,11 - DEFPUSHBUTTON "",IDOK,114,149,44,15,WS_GROUP + DEFPUSHBUTTON "Закрыть",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 @@ -161,46 +161,46 @@ END STRINGTABLE DISCARDABLE BEGIN - STRING_LICENSE, " ; () , GNU, ; 2 , ( ) , .\r\n\r\n , , - , . GNU.\r\n\r\n GNU, , (Free Software Foundation, Inc.), 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA." + STRING_LICENSE, "Эта программа является свободно распространяемой; Вы можете распространять ее повторно и (или) изменять, соблюдая условия Открытого лицензионного соглашения GNU, опубликованного Фондом свободно распространяемого программного обеспечения; либо редакции 2 Соглашения, либо (на ваше усмотрение) любой редакции, выпущенной позже.\r\n\r\nЭта программа распространяется в надежде на то, что она окажется полезной, но БЕЗ КАКИХ-ЛИБО ГАРАНТИЙ, включая подразумеваемую гарантию КАЧЕСТВА либо ПРИГОДНОСТИ ДЛЯ ОПРЕДЕЛЕННЫХ ЦЕЛЕЙ. Подробности содержатся в Открытом лицензионном соглашении GNU.\r\n\r\nВместе с этой программой должен распространяться экземпляр Открытого лицензионного соглашения GNU, если он отсутствует, сообщите об этом в Фонд свободно распространяемого программного обеспечения (Free Software Foundation, Inc.), 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA." END STRINGTABLE DISCARDABLE BEGIN STRING_PAGESETUP_HEADERVALUE, "&n" /* FIXME */ -STRING_PAGESETUP_FOOTERVALUE, " &s" /* FIXME */ -STRING_PAGESETUP_LEFTVALUE, "20 " /* FIXME */ -STRING_PAGESETUP_RIGHTVALUE, "20 " /* FIXME */ -STRING_PAGESETUP_TOPVALUE, "25 " /* FIXME */ -STRING_PAGESETUP_BOTTOMVALUE, "25 " /* FIXME */ +STRING_PAGESETUP_FOOTERVALUE, "Страница &s" /* FIXME */ +STRING_PAGESETUP_LEFTVALUE, "20 мм" /* FIXME */ +STRING_PAGESETUP_RIGHTVALUE, "20 мм" /* FIXME */ +STRING_PAGESETUP_TOPVALUE, "25 мм" /* FIXME */ +STRING_PAGESETUP_BOTTOMVALUE, "25 мм" /* FIXME */ -STRING_NOTEPAD, "" -STRING_ERROR, "" -STRING_WARNING, "" -STRING_INFO, "" +STRING_NOTEPAD, "Блокнот" +STRING_ERROR, "ОШИБКА" +STRING_WARNING, "ВНИМАНИЕ" +STRING_INFO, "Информация" -STRING_UNTITLED, "( )" +STRING_UNTITLED, "(без заголовка)" -STRING_ALL_FILES, " (*.*)" -STRING_TEXT_FILES_TXT, " (*.txt)" +STRING_ALL_FILES, "Все файлы (*.*)" +STRING_TEXT_FILES_TXT, "Текстовые файлы (*.txt)" -STRING_TOOLARGE, " '%s' .\n \ - ." -STRING_NOTEXT, " . \ -\n - ." -STRING_DOESNOTEXIST, " '%s'\n \n\n \ - ?" -STRING_NOTSAVED, " '%s'\n \n\n \ - ?" -STRING_NOTFOUND, "'%s' ." -STRING_OUT_OF_MEMORY, " . \ -\n ." -STRING_CANNOTFIND " '%s'" +STRING_TOOLARGE, "Файл '%s' слишком большой для блокнота.\n \ +Используйте другой редактор." +STRING_NOTEXT, "Вы не ввели никакого текста. \ +\nВведите что-нибудь и попробуйте еще." +STRING_DOESNOTEXIST, "Файл '%s'\nне существует\n\n \ +Хотите создать новый файл?" +STRING_NOTSAVED, "Файл '%s'\nбыл изменен\n\n \ +Хотите сохранить изменения?" +STRING_NOTFOUND, "'%s' не найден." +STRING_OUT_OF_MEMORY, "Недостаточно памяти для завершения этой операции. \ +\nЗакройте одно или несколько приложений и повторите попытку." +STRING_CANNOTFIND "Невозможно найти '%s'" STRING_ANSI, "ANSI" -STRING_UNICODE, "" -STRING_UNICODE_BE, " (big endian)" +STRING_UNICODE, "Юникод" +STRING_UNICODE_BE, "Юникод (big endian)" STRING_UTF8, "UTF-8" STRING_CRLF, "Windows" STRING_LF, "Unix" -STRING_CR, "" -STRING_LINE_COLUMN, " %d, %d" +STRING_CR, "Макинтош" +STRING_LINE_COLUMN, "Строка %d, столбец %d" END diff --git a/base/applications/notepad/lang/uk-UA.rc b/base/applications/notepad/lang/uk-UA.rc index 923063731c2..8a7879bb934 100644 --- a/base/applications/notepad/lang/uk-UA.rc +++ b/base/applications/notepad/lang/uk-UA.rc @@ -41,53 +41,53 @@ END MAIN_MENU MENU BEGIN - POPUP "&" + POPUP "&Файл" BEGIN - MENUITEM "&\tCtrl+N", CMD_NEW - MENUITEM "&³...\tCtrl+O", CMD_OPEN - MENUITEM "&\tCtrl+S", CMD_SAVE - MENUITEM " &...", CMD_SAVE_AS + MENUITEM "&Створити\tCtrl+N", CMD_NEW + MENUITEM "&Відкрити...\tCtrl+O", CMD_OPEN + MENUITEM "&Зберегти\tCtrl+S", CMD_SAVE + MENUITEM "Зберегти &як...", CMD_SAVE_AS MENUITEM SEPARATOR - MENUITEM "& ...", CMD_PAGE_SETUP - MENUITEM "&\tCtrl+P", CMD_PRINT - MENUITEM " &...", CMD_PRINTER_SETUP + MENUITEM "Пара&метри сторінки...", CMD_PAGE_SETUP + MENUITEM "Д&рук\tCtrl+P", CMD_PRINT + MENUITEM "Налаштування &принтера...", CMD_PRINTER_SETUP MENUITEM SEPARATOR - MENUITEM "&", CMD_EXIT + MENUITEM "В&ихід", CMD_EXIT END - POPUP "&" + POPUP "Пр&авка" BEGIN - MENUITEM "&\tCtrl+Z", CMD_UNDO + MENUITEM "С&касувати\tCtrl+Z", CMD_UNDO MENUITEM SEPARATOR - MENUITEM "&\tCtrl+X", CMD_CUT - MENUITEM "&\tCtrl+C", CMD_COPY - MENUITEM "&\tCtrl+V", CMD_PASTE - MENUITEM "&\tDel", CMD_DELETE + MENUITEM "Вир&ізати\tCtrl+X", CMD_CUT + MENUITEM "Копі&ювати\tCtrl+C", CMD_COPY + MENUITEM "Вс&тавити\tCtrl+V", CMD_PASTE + MENUITEM "Ви&далити\tDel", CMD_DELETE MENUITEM SEPARATOR - MENUITEM "&...\tCtrl+F", CMD_SEARCH - MENUITEM "& \tF3", CMD_SEARCH_NEXT - MENUITEM "&\tCtrl+H", CMD_REPLACE - MENUITEM "&...\tCtrl+G", CMD_GOTO + MENUITEM "З&найти...\tCtrl+F", CMD_SEARCH + MENUITEM "Зна&йти далі\tF3", CMD_SEARCH_NEXT + MENUITEM "Зам&інити\tCtrl+H", CMD_REPLACE + MENUITEM "П&ерейти...\tCtrl+G", CMD_GOTO MENUITEM SEPARATOR - MENUITEM "& \tCtrl+A", CMD_SELECT_ALL - MENUITEM " &\tF5", CMD_TIME_DATE + MENUITEM "Виді&лити все\tCtrl+A", CMD_SELECT_ALL + MENUITEM "Дата й &час\tF5", CMD_TIME_DATE END - POPUP "&" + POPUP "Ф&ормат" BEGIN - MENUITEM " &", CMD_WRAP - MENUITEM "&...", CMD_FONT + MENUITEM "Перенос по слова&х", CMD_WRAP + MENUITEM "&Шрифт...", CMD_FONT END - POPUP "&" + POPUP "Ви&гляд" BEGIN - MENUITEM "& &", CMD_STATUSBAR + MENUITEM "Ряд&ок стан&у", CMD_STATUSBAR END - POPUP "&" + POPUP "Дов&ідка" BEGIN - MENUITEM "&", CMD_HELP_CONTENTS - MENUITEM "&...", CMD_HELP_SEARCH - MENUITEM "& ", CMD_HELP_ON_HELP + MENUITEM "Змі&ст", CMD_HELP_CONTENTS + MENUITEM "Пош&ук...", CMD_HELP_SEARCH + MENUITEM "Використ&ання довідки", CMD_HELP_ON_HELP MENUITEM SEPARATOR - MENUITEM "&", CMD_ABOUT - MENUITEM " &", CMD_ABOUT_WINE + MENUITEM "&Про", CMD_ABOUT + MENUITEM "Про програм&у", CMD_ABOUT_WINE END END @@ -96,26 +96,26 @@ END DIALOG_PAGESETUP DIALOGEX 0, 0, 225, 95 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU FONT 8, "MS Shell Dlg" -CAPTION " " +CAPTION "Параметри сторінки" BEGIN -LTEXT "& :", 0x140, 10, 07, 40, 15 +LTEXT "В&ерхній колонтитул:", 0x140, 10, 07, 40, 15 EDITTEXT 0x141, 60, 05,110, 12, WS_BORDER | WS_TABSTOP -LTEXT "& :", 0x142, 10, 24, 40, 15 +LTEXT "Н&ижній колонтитул:", 0x142, 10, 24, 40, 15 EDITTEXT 0x143, 60, 22,110, 12, WS_BORDER | WS_TABSTOP -GROUPBOX "", 0x144, 10, 43,160, 45 -LTEXT "&˳:", 0x145, 20, 55, 30, 10, WS_CHILD +GROUPBOX "Поля", 0x144, 10, 43,160, 45 +LTEXT "&Ліве:", 0x145, 20, 55, 30, 10, WS_CHILD EDITTEXT /*STRING_PAGESETUP_LEFTVALUE,*/ 0x147, 50, 55, 35, 11, WS_CHILD | WS_BORDER | WS_TABSTOP -LTEXT "&:", 0x148, 20, 73, 30, 10, WS_CHILD +LTEXT "&Верхнє:", 0x148, 20, 73, 30, 10, WS_CHILD EDITTEXT /*STRING_PAGESETUP_TOPVALUE,*/ 0x14A, 50, 73, 35, 11, WS_CHILD | WS_BORDER | WS_TABSTOP -LTEXT "&:", 0x14B, 100, 55, 30, 10, WS_CHILD +LTEXT "&Праве:", 0x14B, 100, 55, 30, 10, WS_CHILD EDITTEXT /*STRING_PAGESETUP_RIGHTVALUE,*/ 0x14D, 130, 55, 35, 11, WS_CHILD | WS_BORDER | WS_TABSTOP -LTEXT "&:", 0x14E,100, 73, 30, 10, WS_CHILD +LTEXT "&Нижнє:", 0x14E,100, 73, 30, 10, WS_CHILD EDITTEXT /*STRING_PAGESETUP_BOTTOMVALUE,*/ 0x150, 130, 73, 35, 11, WS_CHILD | WS_BORDER | WS_TABSTOP -DEFPUSHBUTTON "", IDOK, 180, 3, 40, 15, WS_TABSTOP -PUSHBUTTON "ͳ", IDCANCEL, 180, 21, 40, 15, WS_TABSTOP -PUSHBUTTON "&", IDHELP, 180, 39, 40, 15, WS_TABSTOP +DEFPUSHBUTTON "Так", IDOK, 180, 3, 40, 15, WS_TABSTOP +PUSHBUTTON "Ні", IDCANCEL, 180, 21, 40, 15, WS_TABSTOP +PUSHBUTTON "&Довідка", IDHELP, 180, 39, 40, 15, WS_TABSTOP END /* Dialog `Encoding' */ @@ -123,36 +123,36 @@ DIALOG_ENCODING DIALOGEX 0, 0, 256, 44 STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPSIBLINGS | WS_CAPTION | WS_SYSMENU FONT 8, "MS Shell Dlg" -CAPTION "" +CAPTION "Кодування" BEGIN COMBOBOX ID_ENCODING,54,0,156,80,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP -LTEXT ":",0x155,5,2,41,12 +LTEXT "Кодування:",0x155,5,2,41,12 COMBOBOX ID_EOLN,54,18,156,80,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP -LTEXT "ʳ :",0x156,5,20,47,12 +LTEXT "Кінець рядка:",0x156,5,20,47,12 END /* Dialog 'Go To' */ DIALOG_GOTO DIALOGEX 0,0,165,50 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU FONT 8, "MS Shell Dlg" -CAPTION " " +CAPTION "Перехід до рядка" BEGIN EDITTEXT ID_LINENUMBER,54,10,106,12,WS_CHILD | WS_BORDER | WS_TABSTOP -LTEXT " :",0x155,5,12,41,12,WS_CHILD | WS_TABSTOP | ES_NUMBER +LTEXT "Номер рядка:",0x155,5,12,41,12,WS_CHILD | WS_TABSTOP | ES_NUMBER DEFPUSHBUTTON "OK", IDOK, 75, 30, 40, 15, WS_CHILD | WS_TABSTOP -PUSHBUTTON "", IDCANCEL, 120, 30, 40, 15, WS_CHILD | WS_TABSTOP +PUSHBUTTON "Скасувати", IDCANCEL, 120, 30, 40, 15, WS_CHILD | WS_TABSTOP END IDD_ABOUTBOX DIALOGEX DISCARDABLE 22,16,284,170 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU -CAPTION " ReactOS" +CAPTION "Про Блокнот ReactOS" FONT 8, "MS Shell Dlg" BEGIN - CONTROL " ReactOS v1.0\r\nCopyright 1997,98 Marcel Baur \r\nCopyright 2000 Mike McCormack \r\nCopyright 2002 Sylvain Petreolle \r\nCopyright 2002 Andriy Palamarchuk\r\n ", + CONTROL "Блокнот ReactOS v1.0\r\nCopyright 1997,98 Marcel Baur \r\nCopyright 2000 Mike McCormack \r\nCopyright 2002 Sylvain Petreolle \r\nCopyright 2002 Andriy Palamarchuk\r\n ", -1,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,46,7,232,39 CONTROL " ", -1,"Static",0x50000000,8,48,272,11 - DEFPUSHBUTTON "",IDOK,114,149,44,15,WS_GROUP + DEFPUSHBUTTON "Закрити",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 @@ -160,46 +160,46 @@ END STRINGTABLE DISCARDABLE BEGIN - STRING_LICENSE, " ; , ³ GNU, ; 2 , - , .\r\n\r\n 䳿 , , - Ҳ, Ҳ Ҳ Ҳ . ³ GNU.\r\n\r\n ³ GNU. , (Free Software Foundation, Inc.), 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA." + STRING_LICENSE, "Це вільне програмне забезпечення; Ви можете розповсюджувати її та змінювати, дотримуючись умови Відкритої ліцензійної угоди GNU, опублікованої Фондом вільного програмного забезпечення; або редакції 2 Угоди, або будь-якої редакції, випущеної пізніше.\r\n\r\nЦя програма розповсюджується в надії на те, що вона виявиться корисною, але БЕЗ БУДЬ-ЯКИХ ГАРАНТІЙ, включаючи УЯВНОЮ ГАРАНТІЄЮ ЯКОСТІ або ПРИДАТНОСТІ для певних цілей. Подробиці містяться у Відкритій ліцензійній угоді GNU.\r\n\r\nРазом з цією програмою повинен поширюватися примірник Відкритої ліцензійної угоди GNU. Якщо він відсутній, повідомте про це в Фонд вільного програмного забезпечення (Free Software Foundation, Inc.), 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA." END STRINGTABLE DISCARDABLE BEGIN STRING_PAGESETUP_HEADERVALUE, "&n" /* FIXME */ -STRING_PAGESETUP_FOOTERVALUE, " &s" /* FIXME */ -STRING_PAGESETUP_LEFTVALUE, "20 " /* FIXME */ -STRING_PAGESETUP_RIGHTVALUE, "20 " /* FIXME */ -STRING_PAGESETUP_TOPVALUE, "25 " /* FIXME */ -STRING_PAGESETUP_BOTTOMVALUE, "25 " /* FIXME */ +STRING_PAGESETUP_FOOTERVALUE, "Сторінка &s" /* FIXME */ +STRING_PAGESETUP_LEFTVALUE, "20 мм" /* FIXME */ +STRING_PAGESETUP_RIGHTVALUE, "20 мм" /* FIXME */ +STRING_PAGESETUP_TOPVALUE, "25 мм" /* FIXME */ +STRING_PAGESETUP_BOTTOMVALUE, "25 мм" /* FIXME */ -STRING_NOTEPAD, "" -STRING_ERROR, "" -STRING_WARNING, "" -STRING_INFO, "" +STRING_NOTEPAD, "Блокнот" +STRING_ERROR, "ПОМИЛКА" +STRING_WARNING, "УВАГА" +STRING_INFO, "Інформація" -STRING_UNTITLED, "( )" +STRING_UNTITLED, "(без заголовка)" -STRING_ALL_FILES, " (*.*)" -STRING_TEXT_FILES_TXT, " (*.txt)" +STRING_ALL_FILES, "Усі файли (*.*)" +STRING_TEXT_FILES_TXT, "Текстові файли (*.txt)" -STRING_TOOLARGE, " '%s' .\n \ - ." -STRING_NOTEXT, " . \ -\n - " -STRING_DOESNOTEXIST, " '%s'\n \n\n \ - ?" -STRING_NOTSAVED, " '%s'\n \n\n \ - ?" +STRING_TOOLARGE, "Файл '%s' завеликий для блокнота.\n \ +Будь ласка використайте інший редактор." +STRING_NOTEXT, "Ви не ввели ніякого тексту. \ +\nБудь ласка введіть що-небудь і спробуйте ще раз" +STRING_DOESNOTEXIST, "Файл '%s'\nне існує\n\n \ +Хочете створити новий файл ?" +STRING_NOTSAVED, "Файл '%s'\nбув змінений\n\n \ +Хочете зберегти зміни ?" STRING_NOTFOUND, "'%s' can not be found." -STRING_OUT_OF_MEMORY, " ' .\ -\n ." -STRING_CANNOTFIND " '%s'" +STRING_OUT_OF_MEMORY, "Недостатньо пам'яті для виконання операції.\ +\nЗакрийте один або декілька додатків і повторіть спробу." +STRING_CANNOTFIND "Не можу знайти '%s'" STRING_ANSI, "ANSI" -STRING_UNICODE, "" -STRING_UNICODE_BE, " (big endian)" +STRING_UNICODE, "Юнікод" +STRING_UNICODE_BE, "Юнікод (big endian)" STRING_UTF8, "UTF-8" STRING_CRLF, "Windows" STRING_LF, "Unix" STRING_CR, "Mac" -STRING_LINE_COLUMN, " %d, %d" +STRING_LINE_COLUMN, "Рядок %d, стовпчик %d" END diff --git a/base/applications/notepad/rsrc.rc b/base/applications/notepad/rsrc.rc index fcdd6fba1dc..0e8bcdbb8bd 100644 --- a/base/applications/notepad/rsrc.rc +++ b/base/applications/notepad/rsrc.rc @@ -52,13 +52,10 @@ IDI_NPICON ICON "res/notepad.ico" #include "lang/nl-NL.rc" #include "lang/no-NO.rc" #include "lang/pt-PT.rc" - -#include "lang/ru-RU.rc" #include "lang/sk-SK.rc" #include "lang/sl-SI.rc" #include "lang/sv-SE.rc" #include "lang/th-TH.rc" -#include "lang/uk-UA.rc" #include "lang/zh-CN.rc" // UTF-8 @@ -66,3 +63,5 @@ IDI_NPICON ICON "res/notepad.ico" #include "lang/hy-AM.rc" #include "lang/pl-PL.rc" #include "lang/ro-RO.rc" +#include "lang/ru-RU.rc" +#include "lang/uk-UA.rc" diff --git a/base/applications/rapps/CMakeLists.txt b/base/applications/rapps/CMakeLists.txt index aeeb6815201..46099e4e548 100644 --- a/base/applications/rapps/CMakeLists.txt +++ b/base/applications/rapps/CMakeLists.txt @@ -26,6 +26,7 @@ include_directories( set_rc_compiler() add_executable(rapps ${SOURCE}) +add_pch(rapps rapps.h) set_module_type(rapps win32gui) target_link_libraries(rapps uuid) diff --git a/base/applications/rapps/lang/zh-CN.rc b/base/applications/rapps/lang/zh-CN.rc new file mode 100644 index 00000000000..cc9f36ebf0e --- /dev/null +++ b/base/applications/rapps/lang/zh-CN.rc @@ -0,0 +1,197 @@ +/* + * Translated by Song Fuchang (0xfc) + */ + +LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED + +IDR_MAINMENU MENU +BEGIN + POPUP "文件(&F)" + BEGIN + MENUITEM "设置(&S)", ID_SETTINGS + MENUITEM SEPARATOR + MENUITEM "退出(&X)", ID_EXIT + END + POPUP "程序(&P)" + BEGIN + MENUITEM "安装(&I)", ID_INSTALL + MENUITEM "卸载(&U)",ID_UNINSTALL + MENUITEM "修改(&M)", ID_MODIFY + MENUITEM SEPARATOR + MENUITEM "从注册表删除(&E)", ID_REGREMOVE + MENUITEM SEPARATOR + MENUITEM "刷新(&R)", ID_REFRESH + END + POPUP "帮助" + BEGIN + MENUITEM "帮助内容", ID_HELP, GRAYED + MENUITEM "关于", ID_ABOUT + END +END + +IDR_LINKMENU MENU +BEGIN + POPUP "popup" + BEGIN + MENUITEM "在浏览器中打开链接(&O)", ID_OPEN_LINK + MENUITEM "复制链接到剪贴板(&C)", ID_COPY_LINK + END +END + +IDR_APPLICATIONMENU MENU +BEGIN + POPUP "popup" + BEGIN + MENUITEM "安装(&I)", ID_INSTALL + MENUITEM "卸载(&U)", ID_UNINSTALL + MENUITEM "修改(&M)", ID_MODIFY + MENUITEM SEPARATOR + MENUITEM "从注册表删除(&E)", ID_REGREMOVE + MENUITEM SEPARATOR + MENUITEM "刷新(&R)", ID_REFRESH + END +END + +IDD_SETTINGS_DIALOG DIALOGEX DISCARDABLE 0, 0, 250, 144 +STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "设置" +FONT 8, "MS Shell Dlg" +BEGIN + GROUPBOX "普通", -1, 4, 2, 240, 61 + AUTOCHECKBOX "保存窗口位置(&S)", IDC_SAVE_WINDOW_POS, 15, 12, 219, 12 + AUTOCHECKBOX "启动时更新可获得的程序列表(&U)", IDC_UPDATE_AVLIST, 15, 29, 219, 12 + AUTOCHECKBOX "将程序的安装和卸载记录到日志(&L)", IDC_LOG_ENABLED, 15, 46, 219, 12 + + GROUPBOX "正在下载", -1, 4, 65, 240, 51 + LTEXT "下载文件夹:", -1, 16, 75, 100, 9 + EDITTEXT IDC_DOWNLOAD_DIR_EDIT, 15, 86, 166, 12, WS_CHILD | WS_VISIBLE | WS_GROUP + PUSHBUTTON "选择(&C)", IDC_CHOOSE, 187, 85, 50, 14 + AUTOCHECKBOX "在安装完程序后删除安装程序(&D)", IDC_DEL_AFTER_INSTALL, 16, 100, 218, 12 + + PUSHBUTTON "缺省", IDC_DEFAULT_SETTINGS, 8, 124, 60, 14 + PUSHBUTTON "确定", IDOK, 116, 124, 60, 14 + PUSHBUTTON "取消", IDCANCEL, 181, 124, 60, 14 +END + +IDD_INSTALL_DIALOG DIALOGEX DISCARDABLE 0, 0, 216, 97 +STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "安装程序" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "...", IDC_INSTALL_TEXT, 4, 5, 209, 35 + + AUTORADIOBUTTON "从存储设备安装 (CD 或 DVD)(&I)", IDC_CD_INSTALL, 10, 46, 197, 11, WS_GROUP + AUTORADIOBUTTON "下载并安装(&D)", IDC_DOWNLOAD_INSTALL, 10, 59, 197, 11, NOT WS_TABSTOP + + PUSHBUTTON "确定", IDOK, 86, 78, 60, 14 + PUSHBUTTON "取消", IDCANCEL, 150, 78, 60, 14 +END + +IDD_DOWNLOAD_DIALOG DIALOGEX LOADONCALL MOVEABLE DISCARDABLE 0, 0, 220, 76 +STYLE DS_SHELLFONT | DS_CENTER | WS_BORDER | WS_CAPTION | WS_POPUP | WS_SYSMENU | WS_VISIBLE +CAPTION "正在下载..." +FONT 8, "MS Shell Dlg" +BEGIN + CONTROL "Progress1", IDC_DOWNLOAD_PROGRESS, "msctls_progress32", WS_BORDER | PBS_SMOOTH, 10, 10, 200, 12 + LTEXT "", IDC_DOWNLOAD_STATUS, 10, 30, 200, 10, SS_CENTER + PUSHBUTTON "取消", IDCANCEL, 85, 58, 50, 15, WS_GROUP | WS_TABSTOP +END + +IDD_ABOUT_DIALOG DIALOGEX 22, 16, 190, 66 +STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME +CAPTION "关于" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "ReactOS 程序管理器\版权所有 (C) 2009\n作者 Dmitry Chapyshev (dmitry@reactos.org)", IDC_STATIC, 48, 7, 130, 39 + PUSHBUTTON "关闭", IDOK, 133, 46, 50, 14 + ICON IDI_MAIN, IDC_STATIC, 10, 10, 7, 30 +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_TOOLTIP_INSTALL "安装" + IDS_TOOLTIP_UNINSTALL "卸载" + IDS_TOOLTIP_MODIFY "修改" + IDS_TOOLTIP_SETTINGS "设置" + IDS_TOOLTIP_REFRESH "刷新" + IDS_TOOLTIP_EXIT "退出" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_APP_NAME "名称" + IDS_APP_INST_VERSION "版本" + IDS_APP_DESCRIPTION "描述" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_INFO_VERSION "\版本:" + IDS_INFO_DESCRIPTION "\描述:" + IDS_INFO_PUBLISHER "\n发布者:" + IDS_INFO_HELPLINK "\n帮助链接:" + IDS_INFO_HELPPHONE "\n帮助电话:" + IDS_INFO_README "\n必读:" + IDS_INFO_REGOWNER "\n注册所有者:" + IDS_INFO_PRODUCTID "\n产品 ID:" + IDS_INFO_CONTACT "\n联系方式:" + IDS_INFO_UPDATEINFO "\n更新信息:" + IDS_INFO_INFOABOUT "\n关于信息:" + IDS_INFO_COMMENTS "\n注释:" + IDS_INFO_INSTLOCATION "\n安装位置:" + IDS_INFO_INSTALLSRC "\n安装源:" + IDS_INFO_UNINSTALLSTR "\n卸载字符串:" + IDS_INFO_MODIFYPATH "\n修改路径:" + IDS_INFO_INSTALLDATE "\n安装日期:" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_AINFO_VERSION "\n版本:" + IDS_AINFO_DESCRIPTION "\n描述:" + IDS_AINFO_SIZE "\n大小:" + IDS_AINFO_URLSITE "\n主页:" + IDS_AINFO_LICENCE "\n协议:" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_CAT_AUDIO "音频" + IDS_CAT_DEVEL "开发" + IDS_CAT_DRIVERS "驱动程序" + IDS_CAT_EDU "教育与娱乐" + IDS_CAT_ENGINEER "工程" + IDS_CAT_FINANCE "经济" + IDS_CAT_GAMES "游戏与娱乐" + IDS_CAT_GRAPHICS "图形" + IDS_CAT_INTERNET "Internet 与网络" + IDS_CAT_LIBS "库" + IDS_CAT_OFFICE "办公" + IDS_CAT_OTHER "其他" + IDS_CAT_SCIENCE "科学" + IDS_CAT_TOOLS "工具" + IDS_CAT_VIDEO "视频" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_APPTITLE "ReactOS 程序管理器" + IDS_SEARCH_TEXT "搜索..." + IDS_INSTALL "安装" + IDS_UNINSTALL "卸载" + IDS_MODIFY "修改" + IDS_APPS_COUNT "程序个数:%d" + IDS_WELCOME_TITLE "欢迎来到 ReactOS 程序管理器!\n\n" + IDS_WELCOME_TEXT "从左栏选择一个类别,然后选择要安装或卸载的程序。\nReactOS 网站:" + IDS_WELCOME_URL "http://www.reactos.org" + IDS_INSTALLED "已安装" + IDS_AVAILABLEFORINST "可安装" + IDS_UPDATES "更新" + IDS_APPLICATIONS "应用程序" + IDS_CHOOSE_FOLDER_TEXT "请选择用来保存下载文件的文件夹:" + IDS_CHOOSE_FOLDER_ERROR "您选择的文件夹不存在。创建吗?" + IDS_USER_NOT_ADMIN "您必须以管理员权限启动 ""ReactOS 程序管理器""!" + IDS_APP_REG_REMOVE "您确定要从注册表删除该程序的数据吗?" + IDS_INFORMATION "信息" + IDS_UNABLE_TO_REMOVE "无法从注册表删除该程序的数据!" +END diff --git a/base/applications/rapps/loaddlg.c b/base/applications/rapps/loaddlg.c index 206eb39e5e5..ab4022391df 100644 --- a/base/applications/rapps/loaddlg.c +++ b/base/applications/rapps/loaddlg.c @@ -29,12 +29,6 @@ #define WIN32_NO_STATUS #include "rapps.h" -#include "resource.h" - -#include -#include -#include -#include static PAPPLICATION_INFO AppInfo; static HICON hIcon = NULL; diff --git a/base/applications/rapps/rapps.h b/base/applications/rapps/rapps.h index cba76db823a..261813af0fe 100644 --- a/base/applications/rapps/rapps.h +++ b/base/applications/rapps/rapps.h @@ -1,11 +1,10 @@ -#pragma once - #include #include #include #include #include #include +#include #include diff --git a/base/applications/rapps/rapps/bittorrent.txt b/base/applications/rapps/rapps/bittorrent.txt new file mode 100644 index 00000000000..d23ba34bcfa --- /dev/null +++ b/base/applications/rapps/rapps/bittorrent.txt @@ -0,0 +1,16 @@ +; UTF-8 + +[Section] +Name = BitTorrent +Version = 7.2.1 +Licence = Freeware for non-commercial uses +Description = The Original BitTorrent Client. +Size = 394K +Category = 5 +URLSite = http://www.bittorrent.com/ +URLDownload = http://download.bittorrent.com/dl/BitTorrent-7.2.1.exe +CDPath = none + +[Section.0407] +Licence = Freeware für nichtkommerzielle Nutzung +Description = Der Original BitTorrent Client. diff --git a/base/applications/rapps/rapps/fap.txt b/base/applications/rapps/rapps/fap.txt index 2ea6cf397dd..c08fea3eeb3 100644 --- a/base/applications/rapps/rapps/fap.txt +++ b/base/applications/rapps/rapps/fap.txt @@ -2,13 +2,13 @@ [Section] Name = Fox Audio Player -Version = 0.8.3 +Version = 0.8.8 Licence = GPL Description = Simple and lightweight audio player. Size = 1.85MB Category = 1 URLSite = http://foxaudioplayer.sourceforge.net/ -URLDownload = http://svn.reactos.org/packages/fap-0.8.3-win32-bin.exe +URLDownload = http://svn.reactos.org/packages/fap-0.8.8-win32-bin.exe CDPath = none [Section.0407] diff --git a/base/applications/rapps/rapps/firefox36.txt b/base/applications/rapps/rapps/firefox36.txt index af292db6042..c05f2df6c91 100644 --- a/base/applications/rapps/rapps/firefox36.txt +++ b/base/applications/rapps/rapps/firefox36.txt @@ -2,59 +2,59 @@ [Section] Name = Mozilla Firefox 3.6 -Version = 3.6.16 +Version = 3.6.19 Licence = MPL/GPL/LGPL Description = The most popular and one of the best free Web Browsers out there. Size = 8.2M Category = 5 URLSite = http://www.mozilla.com/en-US/ -URLDownload = http://mozilla.cdn.leaseweb.com/firefox/releases/3.6.16/win32/en-US/Firefox%20Setup%203.6.16.exe +URLDownload = http://mozilla.cdn.leaseweb.com/firefox/releases/3.6.19/win32/en-US/Firefox%20Setup%203.6.19.exe CDPath = none [Section.0407] Description = Der populärste und einer der besten freien Webbrowser. -Size = 8.1M +Size = 8.0M URLSite = http://www.mozilla-europe.org/de/ -URLDownload = http://mozilla.cdn.leaseweb.com/firefox/releases/3.6.16/win32/de/Firefox%20Setup%203.6.16.exe +URLDownload = http://mozilla.cdn.leaseweb.com/firefox/releases/3.6.19/win32/de/Firefox%20Setup%203.6.19.exe [Section.040a] Description = El más popular y uno de los mejores navegadores web gratuitos que hay. -Size = 8.1M +Size = 8.0M URLSite = http://www.mozilla-europe.org/es/ -URLDownload = http://mozilla.cdn.leaseweb.com/firefox/releases/3.6.16/win32/es-ES/Firefox%20Setup%203.6.16.exe +URLDownload = http://mozilla.cdn.leaseweb.com/firefox/releases/3.6.19/win32/es-ES/Firefox%20Setup%203.6.19.exe [Section.040c] Description = Le navigateur web gratuit le plus populaire et l'un des meilleurs. -Size = 8.1M +Size = 8.0M URLSite = http://www.mozilla-europe.org/fr/ -URLDownload = http://mozilla.cdn.leaseweb.com/firefox/releases/3.6.16/win32/fr/Firefox%20Setup%203.6.16.exe +URLDownload = http://mozilla.cdn.leaseweb.com/firefox/releases/3.6.19/win32/fr/Firefox%20Setup%203.6.19.exe [Section.0414] Description = Mest populære og best også gratis nettleserene der ute. -Size = 8.1M +Size = 8.0M URLSite = http://www.mozilla-europe.org/no/ -URLDownload = http://mozilla.cdn.leaseweb.com/firefox/releases/3.6.16/win32/nb-NO/Firefox%20Setup%203.6.16.exe +URLDownload = http://mozilla.cdn.leaseweb.com/firefox/releases/3.6.19/win32/nb-NO/Firefox%20Setup%203.6.19.exe [Section.0415] Description = Najpopularniejsza i jedna z najlepszych darmowych przeglądarek internetowych. Size = 8.9M URLSite = http://www.mozilla-europe.org/pl/ -URLDownload = http://mozilla.cdn.leaseweb.com/firefox/releases/3.6.16/win32/pl/Firefox%20Setup%203.6.16.exe +URLDownload = http://mozilla.cdn.leaseweb.com/firefox/releases/3.6.19/win32/pl/Firefox%20Setup%203.6.19.exe [Section.0419] Description = Один из самых популярных и лучших бесплатных браузеров. -Size = 8.5M +Size = 8.4M URLSite = http://www.mozilla-europe.org/ru/ -URLDownload = http://mozilla.cdn.leaseweb.com/firefox/releases/3.6.16/win32/ru/Firefox%20Setup%203.6.16.exe +URLDownload = http://mozilla.cdn.leaseweb.com/firefox/releases/3.6.19/win32/ru/Firefox%20Setup%203.6.19.exe [Section.041b] Description = Najpopulárnejší a jeden z najlepších slobodný webových prehliadačov. -Size = 8,5 MB +Size = 8,5MB URLSite = http://www.mozilla-europe.org/sk/ -URLDownload = http://mozilla.cdn.leaseweb.com/firefox/releases/3.6.16/win32/sk/Firefox%20Setup%203.6.16.exe +URLDownload = http://mozilla.cdn.leaseweb.com/firefox/releases/3.6.19/win32/sk/Firefox%20Setup%203.6.19.exe [Section.0422] Description = Найпопулярніший та один з кращих безплатних веб-браузерів. -Size = 8.5M +Size = 8.4M URLSite = http://www.mozilla-europe.org/uk/ -URLDownload = http://mozilla.cdn.leaseweb.com/firefox/releases/3.6.16/win32/uk/Firefox%20Setup%203.6.16.exe +URLDownload = http://mozilla.cdn.leaseweb.com/firefox/releases/3.6.19/win32/uk/Firefox%20Setup%203.6.19.exe diff --git a/base/applications/rapps/rapps/firefox4.txt b/base/applications/rapps/rapps/firefox5.txt similarity index 55% rename from base/applications/rapps/rapps/firefox4.txt rename to base/applications/rapps/rapps/firefox5.txt index 650153b0176..d023382d046 100644 --- a/base/applications/rapps/rapps/firefox4.txt +++ b/base/applications/rapps/rapps/firefox5.txt @@ -1,60 +1,60 @@ -; UTF-8 +; UTF-8 [Section] -Name = Mozilla Firefox 4 -Version = 4.0.1 +Name = Mozilla Firefox 5 +Version = 5.0.1 Licence = MPL/GPL/LGPL Description = The most popular and one of the best free Web Browsers out there. -Size = 11.9M +Size = 13.1M Category = 5 URLSite = http://www.mozilla.com/en-US/ -URLDownload = http://mozilla.cdn.leaseweb.com/firefox/releases/4.0.1/win32/en-US/Firefox%20Setup%204.0.1.exe +URLDownload = http://mozilla.cdn.leaseweb.com/firefox/releases/5.0.1/win32/en-US/Firefox%20Setup%205.0.1.exe CDPath = none [Section.0407] Description = Der populärste und einer der besten freien Webbrowser. -Size = 11.7M +Size = 12.9M URLSite = http://www.mozilla-europe.org/de/ -URLDownload = http://mozilla.cdn.leaseweb.com/firefox/releases/4.0.1/win32/de/Firefox%20Setup%204.0.1.exe +URLDownload = http://mozilla.cdn.leaseweb.com/firefox/releases/5.0.1/win32/de/Firefox%20Setup%205.0.1.exe [Section.040a] Description = El más popular y uno de los mejores navegadores web gratuitos que hay. -Size = 11.9M +Size = 12.9M URLSite = http://www.mozilla-europe.org/es/ -URLDownload = http://mozilla.cdn.leaseweb.com/firefox/releases/4.0.1/win32/es-ES/Firefox%20Setup%204.0.1.exe +URLDownload = http://mozilla.cdn.leaseweb.com/firefox/releases/5.0.1/win32/es-ES/Firefox%20Setup%205.0.1.exe [Section.040c] Description = Le navigateur web gratuit le plus populaire et l'un des meilleurs. -Size = 12.0M +Size = 13.2M URLSite = http://www.mozilla-europe.org/fr/ -URLDownload = http://mozilla.cdn.leaseweb.com/firefox/releases/4.0.1/win32/fr/Firefox%20Setup%204.0.1.exe +URLDownload = http://mozilla.cdn.leaseweb.com/firefox/releases/5.0.1/win32/fr/Firefox%20Setup%205.0.1.exe [Section.0414] Description = Mest populære og best også gratis nettleserene der ute. -Size = 11.7M +Size = 12.9M URLSite = http://www.mozilla-europe.org/no/ -URLDownload = http://mozilla.cdn.leaseweb.com/firefox/releases/4.0.1/win32/nb-NO/Firefox%20Setup%204.0.1.exe +URLDownload = http://mozilla.cdn.leaseweb.com/firefox/releases/5.0.1/win32/nb-NO/Firefox%20Setup%205.0.1.exe [Section.0415] Description = Najpopularniejsza i jedna z najlepszych darmowych przeglądarek internetowych. -Size = 12.6M +Size = 13.7M URLSite = http://www.mozilla-europe.org/pl/ -URLDownload = http://mozilla.cdn.leaseweb.com/firefox/releases/4.0.1/win32/pl/Firefox%20Setup%204.0.1.exe +URLDownload = http://mozilla.cdn.leaseweb.com/firefox/releases/5.0.1/win32/pl/Firefox%20Setup%205.0.1.exe [Section.0419] Description = Один из самых популярных и лучших бесплатных браузеров. -Size = 12.2M +Size = 13.3M URLSite = http://www.mozilla-europe.org/ru/ -URLDownload = http://mozilla.cdn.leaseweb.com/firefox/releases/4.0.1/win32/ru/Firefox%20Setup%204.0.1.exe +URLDownload = http://mozilla.cdn.leaseweb.com/firefox/releases/5.0.1/win32/ru/Firefox%20Setup%205.0.1.exe [Section.041b] Description = Najpopulárnejší a jeden z najlepších slobodný webových prehliadačov. -Size = 12.4 MB +Size = 13.6MB URLSite = http://www.mozilla-europe.org/sk/ -URLDownload = http://mozilla.cdn.leaseweb.com/firefox/releases/4.0.1/win32/sk/Firefox%20Setup%204.0.1.exe +URLDownload = http://mozilla.cdn.leaseweb.com/firefox/releases/5.0.1/win32/sk/Firefox%20Setup%205.0.1.exe [Section.0422] Description = Найпопулярніший та один з кращих безплатних веб-браузерів. -Size = 12.1M +Size = 13.3M URLSite = http://www.mozilla-europe.org/uk/ -URLDownload = http://mozilla.cdn.leaseweb.com/firefox/releases/4.0.1/win32/uk/Firefox%20Setup%204.0.1.exe +URLDownload = http://mozilla.cdn.leaseweb.com/firefox/releases/5.0.1/win32/uk/Firefox%20Setup%205.0.1.exe diff --git a/base/applications/rapps/rapps/irfanview.txt b/base/applications/rapps/rapps/irfanview.txt index 044d478cef0..c12850d54e6 100644 --- a/base/applications/rapps/rapps/irfanview.txt +++ b/base/applications/rapps/rapps/irfanview.txt @@ -2,13 +2,13 @@ [Section] Name = IrfanView -Version = 4.28 +Version = 4.30 Licence = Freeware (for personal use) Description = Viewer for all kinds of graphics/audio files/video files. -Size = 1.3MB +Size = 1.4MB Category = 3 URLSite = http://www.irfanview.com/ -URLDownload = http://irfanview.tuwien.ac.at/iview428_setup.exe +URLDownload = http://irfanview.tuwien.ac.at/iview430_setup.exe CDPath = none [Section.0407] diff --git a/base/applications/rapps/rapps/irfanviewplugins.txt b/base/applications/rapps/rapps/irfanviewplugins.txt index 7a116f1d9ef..7b9d12bdbb6 100644 --- a/base/applications/rapps/rapps/irfanviewplugins.txt +++ b/base/applications/rapps/rapps/irfanviewplugins.txt @@ -2,13 +2,13 @@ [Section] Name = IrfanView Plugins -Version = 4.28 +Version = 4.30 Licence = Freeware (for personal use) Description = Additional Plugins for supporting more file types. -Size = 7.8MB +Size = 7.7MB Category = 3 URLSite = http://www.irfanview.com/ -URLDownload = http://irfanview.tuwien.ac.at/plugins/irfanview_plugins_428_setup.exe +URLDownload = http://irfanview.tuwien.ac.at/plugins/irfanview_plugins_430_setup.exe CDPath = none [Section.0407] diff --git a/base/applications/rapps/rapps/libreoffice.txt b/base/applications/rapps/rapps/libreoffice.txt index d609e3f80b4..18919049568 100644 --- a/base/applications/rapps/rapps/libreoffice.txt +++ b/base/applications/rapps/rapps/libreoffice.txt @@ -2,13 +2,13 @@ [Section] Name = LibreOffice -Version = 3.3.2 +Version = 3.3.3 Licence = LGPL Description = Former called OpenOffice. Open Source Office Suite. -Size = 214.0MB +Size = 217.0MB Category = 6 URLSite = http://www.documentfoundation.org/ -URLDownload = http://download.documentfoundation.org/libreoffice/stable/3.3.2/win/x86/LibO_3.3.2_Win_x86_install_multi.exe +URLDownload = http://download.documentfoundation.org/libreoffice/stable/3.3.3/win/x86/LibO_3.3.3_Win_x86_install_multi.exe CDPath = none [Section.0407] @@ -25,3 +25,5 @@ Description = Otwarty pakiet biurowy. [Section.0422] Description = Відкритий офісний пакет. +Size = 249.0M +URLDownload = http://download.documentfoundation.org/libreoffice/stable/3.3.3/win/x86/LibO_3.3.3_Win_x86_install_all_lang.exe diff --git a/base/applications/rapps/rapps/mirandaim.txt b/base/applications/rapps/rapps/mirandaim.txt index 9e1198eb888..f771ebd7faa 100644 --- a/base/applications/rapps/rapps/mirandaim.txt +++ b/base/applications/rapps/rapps/mirandaim.txt @@ -2,13 +2,13 @@ [Section] Name = Miranda IM -Version = 0.9.18 +Version = 0.9.25 Licence = GPL Description = Open source multiprotocol instant messaging application - May not work completely. -Size = 3.0MB +Size = 3.1MB Category = 5 URLSite = http://www.miranda-im.org/ -URLDownload = http://miranda.googlecode.com/files/miranda-im-v0.9.18-unicode.exe +URLDownload = http://miranda.googlecode.com/files/miranda-im-v0.9.25-unicode.exe CDPath = none [Section.0407] diff --git a/base/applications/rapps/rapps/seamonkey.txt b/base/applications/rapps/rapps/seamonkey.txt index 48579604d39..9d167c44b27 100644 --- a/base/applications/rapps/rapps/seamonkey.txt +++ b/base/applications/rapps/rapps/seamonkey.txt @@ -2,36 +2,41 @@ [Section] Name = Mozilla SeaMonkey -Version = 2.0.13 +Version = 2.2 Licence = MPL/GPL/LGPL Description = Mozilla Suite is alive. This is the one and only Browser, Mail, Chat, and Composer bundle you will ever need. -Size = 10.2MB +Size = 16.0MB Category = 5 URLSite = http://www.seamonkey-project.org/ -URLDownload = http://releases.mozilla.org/pub/mozilla.org/seamonkey/releases/2.0.13/win32/en-US/SeaMonkey%20Setup%202.0.13.exe +URLDownload = http://releases.mozilla.org/pub/mozilla.org/seamonkey/releases/2.2/win32/en-US/SeaMonkey%20Setup%202.2.exe CDPath = none [Section.0407] Description = Mozilla Suite lebt. Dies ist das einzige Browser-, Mail-, Chat- and Composerwerkzeug-Bundle welches Sie benötigen. -Size = 10.1MB -URLDownload = http://releases.mozilla.org/pub/mozilla.org/seamonkey/releases/2.0.13/win32/de/SeaMonkey%20Setup%202.0.13.exe +Size = 16.0MB +URLDownload = http://releases.mozilla.org/pub/mozilla.org/seamonkey/releases/2.2/win32/de/SeaMonkey%20Setup%202.2.exe [Section.040a] Description = La suite de Mozilla está viva. Es el primero y único navegador web, gestor de correo, lector de noticias, Chat y editor HTML que necesitarás. -Size = 10.1MB -URLDownload = http://releases.mozilla.org/pub/mozilla.org/seamonkey/releases/2.0.13/win32/es-ES/SeaMonkey%20Setup%202.0.13.exe +Size = 15.9MB +URLDownload = http://releases.mozilla.org/pub/mozilla.org/seamonkey/releases/2.2/win32/es-ES/SeaMonkey%20Setup%202.2.exe [Section.040c] Description = La suite Mozilla est en vie. Ceci est le seul et l'unique package navigateur, client mail, client chat et composer dont vous aurez besoin. -Size = 10.1MB -URLDownload = http://releases.mozilla.org/pub/mozilla.org/seamonkey/releases/2.0.13/win32/fr/SeaMonkey%20Setup%202.0.13.exe +Size = 16.3MB +URLDownload = http://releases.mozilla.org/pub/mozilla.org/seamonkey/releases/2.2/win32/fr/SeaMonkey%20Setup%202.2.exe [Section.0415] Description = Pakiet Mozilla żyje. W zestawie: przeglądarka, klient poczty, IRC oraz Edytor HTML - wszystko, czego potrzebujesz. -Size = 11.0MB -URLDownload = http://releases.mozilla.org/pub/mozilla.org/seamonkey/releases/2.0.13/win32/pl/SeaMonkey%20Setup%202.0.13.exe +Size = 16.8MB +URLDownload = http://releases.mozilla.org/pub/mozilla.org/seamonkey/releases/2.2/win32/pl/SeaMonkey%20Setup%202.2.exe [Section.0419] Description = Продолжение Mozilla Suite. Включает браузер, почтовый клиент, IRC-клиент и HTML-редактор. -Size = 10.5MB -URLDownload = http://releases.mozilla.org/pub/mozilla.org/seamonkey/releases/2.0.13/win32/ru/SeaMonkey%20Setup%202.0.13.exe +Size = 16.4MB +URLDownload = http://releases.mozilla.org/pub/mozilla.org/seamonkey/releases/2.2/win32/ru/SeaMonkey%20Setup%202.2.exe + +[Section.0422] +Description = Продовження Mozilla Suite. Включає в себе браузер, поштовий клієнт, IRC-клієнт та HTML-редактор. +Size = 16.4MB +URLDownload = http://releases.mozilla.org/pub/mozilla.org/seamonkey/releases/2.2/win32/ru/SeaMonkey%20Setup%202.2.exe diff --git a/base/applications/rapps/rapps/superfinder.txt b/base/applications/rapps/rapps/superfinder.txt index 04d6b0f1ead..0abc6654944 100644 --- a/base/applications/rapps/rapps/superfinder.txt +++ b/base/applications/rapps/rapps/superfinder.txt @@ -2,13 +2,13 @@ [Section] Name = Super Finder XT -Version = 1.6.2.1 +Version = 1.6.3.2 Licence = Freeware Description = A fast and feature rich search Application. -Size = 4.5MB +Size = 4.9MB Category = 12 URLSite = http://fsl.sytes.net/ssearchxt.html -URLDownload = http://fsl.sytes.net/releases/setup_SuperFinderXT.exe +URLDownload = http://www.webalice.it/guido.vinaio/releases/setup_SuperFinderXT.exe CDPath = none [Section.0407] @@ -22,3 +22,6 @@ Description = Une application de recherche rapide et riche en fonctionnalités. [Section.0415] Description = Szybka i bogata w opcje aplikacja szukająca. + +[Section.0422] +Description = Швидка та потужна програма пошуку. diff --git a/base/applications/rapps/rapps/thunderbird.txt b/base/applications/rapps/rapps/thunderbird.txt index e91eb6c7182..29c02381281 100644 --- a/base/applications/rapps/rapps/thunderbird.txt +++ b/base/applications/rapps/rapps/thunderbird.txt @@ -2,47 +2,47 @@ [Section] Name = Mozilla Thunderbird -Version = 3.1.9 +Version = 3.1.11 Licence = MPL/GPL/LGPL Description = The most popular and one of the best free Mail Clients out there. Size = 9.0M Category = 5 URLSite = http://www.mozilla-europe.org/en/products/thunderbird/ -URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/3.1.9/win32/en-US/Thunderbird%20Setup%203.1.9.exe +URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/3.1.11/win32/en-US/Thunderbird%20Setup%203.1.11.exe CDPath = none [Section.0407] Description = Der populärste und einer der besten freien Mail-Clients. -Size = 8.8M +Size = 8.9M URLSite = http://www.mozilla-europe.org/de/products/thunderbird/ -URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/3.1.9/win32/de/Thunderbird%20Setup%203.1.9.exe +URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/3.1.11/win32/de/Thunderbird%20Setup%203.1.11.exe [Section.040a] Description = El más popular y uno de los mejores clientes mail que hay. -Size = 8.8M +Size = 8.9M URLSite = http://www.mozilla-europe.org/es/products/thunderbird/ -URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/3.1.9/win32/es-ES/Thunderbird%20Setup%203.1.9.exe +URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/3.1.11/win32/es-ES/Thunderbird%20Setup%203.1.11.exe [Section.040c] Description = Le plus populaire et l'un des meilleurs clients mail gratuits disponible. -Size = 8.8M +Size = 8.9M URLSite = http://www.mozilla-europe.org/fr/products/thunderbird/ -URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/3.1.9/win32/fr/Thunderbird%20Setup%203.1.9.exe +URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/3.1.11/win32/fr/Thunderbird%20Setup%203.1.11.exe [Section.0415] Description = Najpopularniejszy i jeden z najlepszych darmowych klientów poczty. Size = 9.7M URLSite = http://www.mozilla-europe.org/pl/products/thunderbird/ -URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/3.1.9/win32/pl/Thunderbird%20Setup%203.1.9.exe +URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/3.1.11/win32/pl/Thunderbird%20Setup%203.1.11.exe [Section.0419] Description = Один из самых популярных и лучших бесплатных почтовых клиентов. -Size = 9.2M +Size = 9.3M URLSite = http://www.mozilla-europe.org/ru/products/thunderbird/ -URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/3.1.9/win32/ru/Thunderbird%20Setup%203.1.9.exe +URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/3.1.11/win32/ru/Thunderbird%20Setup%203.1.11.exe [Section.0422] Description = Найпопулярніший та один з кращих поштових клієнтів. -Size = 9.2M +Size = 9.3M URLSite = http://www.mozillamessaging.com/uk/thunderbird/ -URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/3.1.9/win32/uk/Thunderbird%20Setup%203.1.9.exe +URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/3.1.11/win32/uk/Thunderbird%20Setup%203.1.11.exe diff --git a/base/applications/rapps/rapps/thunderbird5.txt b/base/applications/rapps/rapps/thunderbird5.txt new file mode 100644 index 00000000000..87c5a45c1ae --- /dev/null +++ b/base/applications/rapps/rapps/thunderbird5.txt @@ -0,0 +1,48 @@ +; UTF-8 + +[Section] +Name = Mozilla Thunderbird 5 +Version = 5.0 +Licence = MPL/GPL/LGPL +Description = The most popular and one of the best free Mail Clients out there. +Size = 13.4M +Category = 5 +URLSite = http://www.mozilla-europe.org/en/products/thunderbird/ +URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/5.0/win32/en-US/Thunderbird%20Setup%205.0.exe +CDPath = none + +[Section.0407] +Description = Der populärste und einer der besten freien Mail-Clients. +Size = 13.3M +URLSite = http://www.mozilla-europe.org/de/products/thunderbird/ +URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/5.0/win32/de/Thunderbird%20Setup%205.0.exe + +[Section.040a] +Description = El más popular y uno de los mejores clientes mail que hay. +Size = 13.2M +URLSite = http://www.mozilla-europe.org/es/products/thunderbird/ +URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/5.0/win32/es-ES/Thunderbird%20Setup%205.0.exe + +[Section.040c] +Description = Le plus populaire et l'un des meilleurs clients mail gratuits disponible. +Size = 13.5M +URLSite = http://www.mozilla-europe.org/fr/products/thunderbird/ +URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/5.0/win32/fr/Thunderbird%20Setup%205.0.exe + +[Section.0415] +Description = Najpopularniejszy i jeden z najlepszych darmowych klientów poczty. +Size = 14.1M +URLSite = http://www.mozilla-europe.org/pl/products/thunderbird/ +URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/5.0/win32/pl/Thunderbird%20Setup%205.0.exe + +[Section.0419] +Description = Один из самых популярных и лучших бесплатных почтовых клиентов. +Size = 13.7M +URLSite = http://www.mozilla-europe.org/ru/products/thunderbird/ +URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/5.0/win32/ru/Thunderbird%20Setup%205.0.exe + +[Section.0422] +Description = Найпопулярніший та один з кращих поштових клієнтів. +Size = 13.7M +URLSite = http://www.mozillamessaging.com/uk/thunderbird/ +URLDownload = http://releases.mozilla.org/pub/mozilla.org/thunderbird/releases/5.0/win32/uk/Thunderbird%20Setup%205.0.exe diff --git a/base/applications/rapps/rapps/vlc.txt b/base/applications/rapps/rapps/vlc.txt index a5cf92e77c4..8fec78f7367 100644 --- a/base/applications/rapps/rapps/vlc.txt +++ b/base/applications/rapps/rapps/vlc.txt @@ -2,13 +2,13 @@ [Section] Name = VLC media player -Version = 1.1.8 +Version = 1.1.11 Licence = GPL Description = A media player. -Size = 19.6MB +Size = 20.1MB Category = 1 URLSite = http://www.videolan.org/vlc/ -URLDownload = http://kent.dl.sourceforge.net/project/vlc/1.1.8/win32/vlc-1.1.8-win32.exe +URLDownload = http://kent.dl.sourceforge.net/project/vlc/1.1.11/win32/vlc-1.1.11-win32.exe CDPath = none [Section.0407] diff --git a/base/applications/rapps/rsrc.rc b/base/applications/rapps/rsrc.rc index cd56fb7ae25..350e60534c0 100644 --- a/base/applications/rapps/rsrc.rc +++ b/base/applications/rapps/rsrc.rc @@ -13,3 +13,4 @@ #include "lang/sk-SK.rc" #include "lang/sv-SE.rc" #include "lang/uk-UA.rc" +#include "lang/zh-CN.rc" diff --git a/base/applications/regedit/CMakeLists.txt b/base/applications/regedit/CMakeLists.txt index 4fb1946f698..9b6ae4d6cd8 100644 --- a/base/applications/regedit/CMakeLists.txt +++ b/base/applications/regedit/CMakeLists.txt @@ -1,6 +1,4 @@ -add_definitions(-D_DLL -D__USE_CRTIMP) - set_unicode() set_rc_compiler() @@ -22,9 +20,7 @@ list(APPEND SOURCE treeview.c regedit.rc) -add_pch(regedit ${CMAKE_CURRENT_SOURCE_DIR}/regedit.h ${SOURCE}) - -add_executable(regedit ${CMAKE_CURRENT_BINARY_DIR}/regedit_regedit.h.gch ${SOURCE}) +add_executable(regedit ${SOURCE}) set_module_type(regedit win32gui) @@ -32,6 +28,8 @@ target_link_libraries(regedit uuid) add_importlibs(regedit user32 gdi32 advapi32 ole32 shell32 comctl32 comdlg32 shlwapi msvcrt kernel32) +add_pch(regedit regedit.h) + #add_subdirectory(clb) add_cd_file(TARGET regedit DESTINATION reactos FOR all) diff --git a/base/applications/regedit/clb/lang/pl-PL.rc b/base/applications/regedit/clb/lang/pl-PL.rc index 1a98064752d..60e021f4571 100644 --- a/base/applications/regedit/clb/lang/pl-PL.rc +++ b/base/applications/regedit/clb/lang/pl-PL.rc @@ -1,33 +1,35 @@ -/** -* translated by Caemyr - Olaf Siejka -* caemyr@gmail.com -* https://sourceforge.net/projects/reactospl -*/ +/* + * translated by Caemyr - Olaf Siejka + * caemyr@gmail.com + * https://sourceforge.net/projects/reactospl + * updated by Saibamen - Adam Stachowicz (saibamenppl@gmail.com) (August, 2011) + * UTF-8 conversion by Caemyr (May, 2011) + */ LANGUAGE LANG_POLISH, SUBLANG_DEFAULT IDD_COLUMNLISTBOXSTYLES DIALOGEX 0, 0, 227, 215 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "Style kolumnowej listy elementw" +CAPTION "Style kolumnowej listy elementów" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - GROUPBOX "Style kolumnowej listy elementw", -1, 6, 7, 158, 71 + GROUPBOX "Style kolumnowej listy elementów", -1, 6, 7, 158, 71 CHECKBOX "&Standard", 1710, 10, 20, 42, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP - CHECKBOX "&Granica", 1713, 10, 30, 34, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP - CHECKBOX "So&rtuj", 1705, 10, 40, 26, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP - CHECKBOX "&Powiadom", 1706, 10, 50, 32, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP - CHECKBOX "P&ion. przewijanie", 1707, 10, 60, 64, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP - CHECKBOX "&Wybr wielokrot.", -1, 79, 20, 72, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP | WS_DISABLED - CHECKBOX "W&ybr rozszerz.", -1, 79, 30, 77, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP | WS_DISABLED - CHECKBOX "Wys&kaujcy dymek", 1714, 79, 40, 68, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP - CHECKBOX "K&olumny 'Springy'", 1715, 79, 50, 66, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP + CHECKBOX "&Granica", 1713, 10, 30, 39, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP + CHECKBOX "So&rtuj", 1705, 10, 40, 34, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP + CHECKBOX "&Powiadom", 1706, 10, 50, 45, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP + CHECKBOX "P&ion. przewijanie", 1707, 10, 60, 67, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP + CHECKBOX "&Wybór wielokrot.", -1, 79, 20, 72, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP | WS_DISABLED + CHECKBOX "W&ybór rozszerz.", -1, 79, 30, 77, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP | WS_DISABLED + CHECKBOX "Wys&kaujący dymek", 1714, 79, 40, 73, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP + CHECKBOX "K&olumny 'Springy'", 1715, 79, 50, 68, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP GROUPBOX "Style podstawowe", -1, 6, 80, 158, 34 - CHECKBOX "Wi&doczny", 1701, 10, 92, 34, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP - CHECKBOX "Wy&czony", 1702, 10, 102, 41, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP + CHECKBOX "Wi&doczny", 1701, 10, 92, 43, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP + CHECKBOX "Wyłą&czony", 1702, 10, 102, 48, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP CHECKBOX "Gr&upa", 1703, 79, 92, 32, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP - CHECKBOX "Przeskok &Tab", 1704, 79, 102, 44, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP + CHECKBOX "Przeskok &Tab", 1704, 79, 102, 55, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP PUSHBUTTON "OK", IDOK, 37, 125, 40, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP PUSHBUTTON "Anuluj", IDCANCEL, 93, 125, 40, 14, BS_PUSHBUTTON | WS_GROUP | WS_TABSTOP - CHECKBOX "Wy. blok.przewij.", 1708, 79, 60, 66, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP + CHECKBOX "Wył. blok.przewij.", 1708, 79, 60, 69, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP END diff --git a/base/applications/regedit/clb/rsrc.rc b/base/applications/regedit/clb/rsrc.rc index 176f4217132..07ebbd45eb8 100644 --- a/base/applications/regedit/clb/rsrc.rc +++ b/base/applications/regedit/clb/rsrc.rc @@ -37,12 +37,12 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL #include "lang/id-ID.rc" #include "lang/it-IT.rc" #include "lang/ja-JP.rc" -#include "lang/pl-PL.rc" #include "lang/no-NO.rc" #include "lang/sk-SK.rc" #include "lang/th-TH.rc" #include "lang/uk-UA.rc" #include "lang/ru-RU.rc" - - +// UTF-8 +#pragma code_page(65001) +#include "lang/pl-PL.rc" diff --git a/base/applications/regedit/edit.c b/base/applications/regedit/edit.c index ba5e7be4643..cd773455c4d 100644 --- a/base/applications/regedit/edit.c +++ b/base/applications/regedit/edit.c @@ -31,6 +31,8 @@ static const TCHAR* editValueName; static TCHAR* stringValueData; static PVOID binValueData; static DWORD dwordValueData; +static PCM_RESOURCE_LIST resourceValueData; +static INT fullResourceIndex = -1; static DWORD valueDataLen; static EDIT_MODE dwordEditMode = EDIT_MODE_HEX; @@ -429,6 +431,633 @@ INT_PTR CALLBACK modify_binary_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L } +static BOOL CreateResourceColumns(HWND hwnd) +{ + TCHAR szText[80]; + RECT rc; + LV_COLUMN lvC; + HWND hwndLV; + INT width; + + /* Create columns. */ + lvC.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; + lvC.pszText = szText; + lvC.fmt = LVCFMT_LEFT; + + hwndLV = GetDlgItem(hwnd, IDC_DMA_LIST); + ListView_SetExtendedListViewStyle(hwndLV, LVS_EX_FULLROWSELECT); + GetClientRect(hwndLV, &rc); + + /* Load the column labels from the resource file. */ + lvC.iSubItem = 0; + lvC.cx = (rc.right - rc.left) / 2; + LoadString(hInst, IDS_DMA_CHANNEL, szText, sizeof(szText)/sizeof(TCHAR)); + if (ListView_InsertColumn(hwndLV, 0, &lvC) == -1) + return FALSE; + + lvC.iSubItem = 1; + lvC.cx = (rc.right - rc.left) - lvC.cx; + LoadString(hInst, IDS_DMA_PORT, szText, sizeof(szText)/sizeof(TCHAR)); + if (ListView_InsertColumn(hwndLV, 1, &lvC) == -1) + return FALSE; + + + /* Interrupt list */ + hwndLV = GetDlgItem(hwnd, IDC_IRQ_LIST); + ListView_SetExtendedListViewStyle(hwndLV, LVS_EX_FULLROWSELECT); + GetClientRect(hwndLV, &rc); + width = (rc.right - rc.left) / 4; + + /* Load the column labels from the resource file. */ + lvC.iSubItem = 0; + lvC.cx = width; + LoadString(hInst, IDS_INTERRUPT_VECTOR, szText, sizeof(szText)/sizeof(TCHAR)); + if (ListView_InsertColumn(hwndLV, 0, &lvC) == -1) + return FALSE; + + lvC.iSubItem = 1; + LoadString(hInst, IDS_INTERRUPT_LEVEL, szText, sizeof(szText)/sizeof(TCHAR)); + if (ListView_InsertColumn(hwndLV, 1, &lvC) == -1) + return FALSE; + + lvC.iSubItem = 2; + LoadString(hInst, IDS_INTERRUPT_AFFINITY, szText, sizeof(szText)/sizeof(TCHAR)); + if (ListView_InsertColumn(hwndLV, 2, &lvC) == -1) + return FALSE; + + lvC.iSubItem = 3; + lvC.cx = (rc.right - rc.left) - 3 * width; + LoadString(hInst, IDS_INTERRUPT_TYPE, szText, sizeof(szText)/sizeof(TCHAR)); + if (ListView_InsertColumn(hwndLV, 3, &lvC) == -1) + return FALSE; + + + /* Memory list */ + hwndLV = GetDlgItem(hwnd, IDC_MEMORY_LIST); + ListView_SetExtendedListViewStyle(hwndLV, LVS_EX_FULLROWSELECT); + GetClientRect(hwndLV, &rc); + width = (rc.right - rc.left) / 3; + + /* Load the column labels from the resource file. */ + lvC.iSubItem = 0; + lvC.cx = width; + LoadString(hInst, IDS_MEMORY_ADDRESS, szText, sizeof(szText)/sizeof(TCHAR)); + if (ListView_InsertColumn(hwndLV, 0, &lvC) == -1) + return FALSE; + + lvC.iSubItem = 1; + LoadString(hInst, IDS_MEMORY_LENGTH, szText, sizeof(szText)/sizeof(TCHAR)); + if (ListView_InsertColumn(hwndLV, 1, &lvC) == -1) + return FALSE; + + lvC.iSubItem = 2; + lvC.cx = (rc.right - rc.left) - 2 * width; + LoadString(hInst, IDS_MEMORY_ACCESS, szText, sizeof(szText)/sizeof(TCHAR)); + if (ListView_InsertColumn(hwndLV, 2, &lvC) == -1) + return FALSE; + + + /* Port list */ + hwndLV = GetDlgItem(hwnd, IDC_PORT_LIST); + ListView_SetExtendedListViewStyle(hwndLV, LVS_EX_FULLROWSELECT); + GetClientRect(hwndLV, &rc); + width = (rc.right - rc.left) / 3; + + /* Load the column labels from the resource file. */ + lvC.iSubItem = 0; + lvC.cx = width; + LoadString(hInst, IDS_PORT_ADDRESS, szText, sizeof(szText)/sizeof(TCHAR)); + if (ListView_InsertColumn(hwndLV, 0, &lvC) == -1) + return FALSE; + + lvC.iSubItem = 1; + LoadString(hInst, IDS_PORT_LENGTH, szText, sizeof(szText)/sizeof(TCHAR)); + if (ListView_InsertColumn(hwndLV, 1, &lvC) == -1) + return FALSE; + + lvC.iSubItem = 2; + lvC.cx = (rc.right - rc.left) - 2 * width; + LoadString(hInst, IDS_PORT_ACCESS, szText, sizeof(szText)/sizeof(TCHAR)); + if (ListView_InsertColumn(hwndLV, 2, &lvC) == -1) + return FALSE; + + /* Device specific list */ + hwndLV = GetDlgItem(hwnd, IDC_DEVICE_LIST); + ListView_SetExtendedListViewStyle(hwndLV, LVS_EX_FULLROWSELECT); + GetClientRect(hwndLV, &rc); + width = (rc.right - rc.left) / 3; + + /* Load the column labels from the resource file. */ + lvC.iSubItem = 0; + lvC.cx = width; + LoadString(hInst, IDS_SPECIFIC_RESERVED1, szText, sizeof(szText)/sizeof(TCHAR)); + if (ListView_InsertColumn(hwndLV, 0, &lvC) == -1) + return FALSE; + + lvC.iSubItem = 1; + LoadString(hInst, IDS_SPECIFIC_RESERVED2, szText, sizeof(szText)/sizeof(TCHAR)); + if (ListView_InsertColumn(hwndLV, 1, &lvC) == -1) + return FALSE; + + lvC.iSubItem = 2; + lvC.cx = (rc.right - rc.left) - 2 * width; + LoadString(hInst, IDS_SPECIFIC_DATASIZE, szText, sizeof(szText)/sizeof(TCHAR)); + if (ListView_InsertColumn(hwndLV, 2, &lvC) == -1) + return FALSE; + + return TRUE; +} + +static VOID +GetInterfaceType(INTERFACE_TYPE InterfaceType, + LPTSTR pBuffer, + DWORD dwLength) +{ +// LPTSTR lpInterfaceType; + + switch (InterfaceType) + { + case InterfaceTypeUndefined: + LoadString(hInst, IDS_BUS_UNDEFINED, pBuffer, dwLength); +// lpInterfaceType = _T("Undefined"); + break; + case Internal: + LoadString(hInst, IDS_BUS_INTERNAL, pBuffer, dwLength); +// lpInterfaceType = _T("Internal"); + break; + case Isa: + LoadString(hInst, IDS_BUS_ISA, pBuffer, dwLength); +// lpInterfaceType = _T("Isa"); + break; + case Eisa: + LoadString(hInst, IDS_BUS_EISA, pBuffer, dwLength); +// lpInterfaceType = _T("Eisa"); + break; + case MicroChannel: + LoadString(hInst, IDS_BUS_MICROCHANNEL, pBuffer, dwLength); +// lpInterfaceType = _T("MicroChannel"); + break; + case TurboChannel: + LoadString(hInst, IDS_BUS_TURBOCHANNEL, pBuffer, dwLength); +// lpInterfaceType = _T("TurboChannel"); + break; + case PCIBus: + LoadString(hInst, IDS_BUS_PCIBUS, pBuffer, dwLength); +// lpInterfaceType = _T("PCIBus"); + break; + case VMEBus: + LoadString(hInst, IDS_BUS_VMEBUS, pBuffer, dwLength); +// lpInterfaceType = _T("VMEBus"); + break; + case NuBus: + LoadString(hInst, IDS_BUS_NUBUS, pBuffer, dwLength); +// lpInterfaceType = _T("NuBus"); + break; + case PCMCIABus: + LoadString(hInst, IDS_BUS_PCMCIABUS, pBuffer, dwLength); +// lpInterfaceType = _T("PCMCIABus"); + break; + case CBus: + LoadString(hInst, IDS_BUS_CBUS, pBuffer, dwLength); +// lpInterfaceType = _T("CBus"); + break; + case MPIBus: + LoadString(hInst, IDS_BUS_MPIBUS, pBuffer, dwLength); +// lpInterfaceType = _T("MPIBus"); + break; + case MPSABus: + LoadString(hInst, IDS_BUS_MPSABUS, pBuffer, dwLength); +// lpInterfaceType = _T("MPSABus"); + break; + case ProcessorInternal: + LoadString(hInst, IDS_BUS_PROCESSORINTERNAL, pBuffer, dwLength); +// lpInterfaceType = _T("ProcessorInternal"); + break; + case InternalPowerBus: + LoadString(hInst, IDS_BUS_INTERNALPOWERBUS, pBuffer, dwLength); +// lpInterfaceType = _T("InternalPowerBus"); + break; + case PNPISABus: + LoadString(hInst, IDS_BUS_PNPISABUS, pBuffer, dwLength); +// lpInterfaceType = _T("PNPISABus"); + break; + case PNPBus: + LoadString(hInst, IDS_BUS_PNPBUS, pBuffer, dwLength); +// lpInterfaceType = _T("PNPBus"); + break; + default: + LoadString(hInst, IDS_BUS_UNKNOWNTYPE, pBuffer, dwLength); +// lpInterfaceType = _T("Unknown interface type"); + break; + } + +// _tcscpy(pBuffer, lpInterfaceType); +} + + +static VOID +ParseResources(HWND hwnd) +{ + PCM_FULL_RESOURCE_DESCRIPTOR pFullDescriptor; + PCM_PARTIAL_RESOURCE_LIST pPartialResourceList; + PCM_PARTIAL_RESOURCE_DESCRIPTOR pDescriptor; + ULONG i; + HWND hwndLV; + + TCHAR buffer[80]; + LVITEM item; + INT iItem; + + pFullDescriptor = &resourceValueData->List[fullResourceIndex]; + pPartialResourceList = &pFullDescriptor->PartialResourceList; + + /* Interface type */ + GetInterfaceType(pFullDescriptor->InterfaceType, buffer, 80); + SetDlgItemText(hwnd, IDC_INTERFACETYPE, buffer); + + /* Busnumber */ + SetDlgItemInt(hwnd, IDC_BUSNUMBER, (UINT)pFullDescriptor->BusNumber, FALSE); + + /* Version */ + SetDlgItemInt(hwnd, IDC_VERSION, (UINT)pPartialResourceList->Version, FALSE); + + /* Revision */ + SetDlgItemInt(hwnd, IDC_REVISION, (UINT)pPartialResourceList->Revision, FALSE); + + for (i = 0; i < pPartialResourceList->Count; i++) + { + pDescriptor = &pPartialResourceList->PartialDescriptors[i]; + + switch (pDescriptor->Type) + { + case CmResourceTypePort: + hwndLV = GetDlgItem(hwnd, IDC_PORT_LIST); + +#ifdef _M_AMD64 + wsprintf(buffer, _T("0x%16I64x"), pDescriptor->u.Port.Start.QuadPart); +#else + wsprintf(buffer, _T("0x%08lx"), pDescriptor->u.Port.Start.u.LowPart); +#endif + + item.mask = LVIF_TEXT | LVIF_PARAM; + item.iItem = 1000; + item.iSubItem = 0; + item.state = 0; + item.stateMask = 0; + item.pszText = buffer; + item.cchTextMax = (int)_tcslen(item.pszText); + item.lParam = (LPARAM)pDescriptor; + + iItem = ListView_InsertItem(hwndLV, &item); + if (iItem != -1) + { + wsprintf(buffer, _T("0x%lx"), pDescriptor->u.Port.Length); + ListView_SetItemText(hwndLV, iItem, 1, buffer); + + if (pDescriptor->Flags & CM_RESOURCE_PORT_IO) + LoadString(hInst, IDS_PORT_PORT_IO, buffer, sizeof(buffer)/sizeof(TCHAR)); + else + LoadString(hInst, IDS_PORT_MEMORY_IO, buffer, sizeof(buffer)/sizeof(TCHAR)); + ListView_SetItemText(hwndLV, iItem, 2, buffer); + } + break; + + case CmResourceTypeInterrupt: + hwndLV = GetDlgItem(hwnd, IDC_IRQ_LIST); + + wsprintf(buffer, _T("%lu"), pDescriptor->u.Interrupt.Vector); + + item.mask = LVIF_TEXT | LVIF_PARAM; + item.iItem = 1000; + item.iSubItem = 0; + item.state = 0; + item.stateMask = 0; + item.pszText = buffer; + item.cchTextMax = (int)_tcslen(item.pszText); + item.lParam = (LPARAM)pDescriptor; + + iItem = ListView_InsertItem(hwndLV, &item); + if (iItem != -1) + { + wsprintf(buffer, _T("%lu"), pDescriptor->u.Interrupt.Level); + ListView_SetItemText(hwndLV, iItem, 1, buffer); + + wsprintf(buffer, _T("0x%08lx"), pDescriptor->u.Interrupt.Affinity); + ListView_SetItemText(hwndLV, iItem, 2, buffer); + + if (pDescriptor->Flags & CM_RESOURCE_INTERRUPT_LATCHED) + LoadString(hInst, IDS_INTERRUPT_EDGE_SENSITIVE, buffer, sizeof(buffer)/sizeof(TCHAR)); + else + LoadString(hInst, IDS_INTERRUPT_LEVEL_SENSITIVE, buffer, sizeof(buffer)/sizeof(TCHAR)); + + ListView_SetItemText(hwndLV, iItem, 3, buffer); + } + break; + + case CmResourceTypeMemory: + hwndLV = GetDlgItem(hwnd, IDC_MEMORY_LIST); + +#ifdef _M_AMD64 + wsprintf(buffer, _T("0x%16I64x"), pDescriptor->u.Memory.Start.QuadPart); +#else + wsprintf(buffer, _T("0x%08lx"), pDescriptor->u.Memory.Start.u.LowPart); +#endif + + item.mask = LVIF_TEXT | LVIF_PARAM; + item.iItem = 1000; + item.iSubItem = 0; + item.state = 0; + item.stateMask = 0; + item.pszText = buffer; + item.cchTextMax = (int)_tcslen(item.pszText); + item.lParam = (LPARAM)pDescriptor; + + iItem = ListView_InsertItem(hwndLV, &item); + if (iItem != -1) + { + wsprintf(buffer, _T("0x%lx"), pDescriptor->u.Memory.Length); + ListView_SetItemText(hwndLV, iItem, 1, buffer); + + switch (pDescriptor->Flags & (CM_RESOURCE_MEMORY_READ_ONLY | CM_RESOURCE_MEMORY_WRITE_ONLY)) + { + case CM_RESOURCE_MEMORY_READ_ONLY: + LoadString(hInst, IDS_MEMORY_READ_ONLY, buffer, sizeof(buffer)/sizeof(TCHAR)); + break; + + case CM_RESOURCE_MEMORY_WRITE_ONLY: + LoadString(hInst, IDS_MEMORY_WRITE_ONLY, buffer, sizeof(buffer)/sizeof(TCHAR)); + break; + + default: + LoadString(hInst, IDS_MEMORY_READ_WRITE, buffer, sizeof(buffer)/sizeof(TCHAR)); + break; + } + + ListView_SetItemText(hwndLV, iItem, 2, buffer); + } + break; + + case CmResourceTypeDma: + hwndLV = GetDlgItem(hwnd, IDC_DMA_LIST); + + wsprintf(buffer, _T("%lu"), pDescriptor->u.Dma.Channel); + + item.mask = LVIF_TEXT | LVIF_PARAM; + item.iItem = 1000; + item.iSubItem = 0; + item.state = 0; + item.stateMask = 0; + item.pszText = buffer; + item.cchTextMax = (int)_tcslen(item.pszText); + item.lParam = (LPARAM)pDescriptor; + + iItem = ListView_InsertItem(hwndLV, &item); + if (iItem != -1) + { + wsprintf(buffer, _T("%lu"), pDescriptor->u.Dma.Port); + ListView_SetItemText(hwndLV, iItem, 1, buffer); + } + break; + + case CmResourceTypeDeviceSpecific: + hwndLV = GetDlgItem(hwnd, IDC_DEVICE_LIST); + + wsprintf(buffer, _T("0x%08lx"), pDescriptor->u.DeviceSpecificData.Reserved1); + + item.mask = LVIF_TEXT | LVIF_PARAM; + item.iItem = 1000; + item.iSubItem = 0; + item.state = 0; + item.stateMask = 0; + item.pszText = buffer; + item.cchTextMax = (int)_tcslen(item.pszText); + item.lParam = (LPARAM)pDescriptor; + + iItem = ListView_InsertItem(hwndLV, &item); + if (iItem != -1) + { + wsprintf(buffer, _T("0x%08lx"), pDescriptor->u.DeviceSpecificData.Reserved2); + ListView_SetItemText(hwndLV, iItem, 1, buffer); + + wsprintf(buffer, _T("0x%lx"), pDescriptor->u.DeviceSpecificData.DataSize); + ListView_SetItemText(hwndLV, iItem, 2, buffer); + } + break; + } + } +} + + +static BOOL +OnResourceNotify(HWND hwndDlg, NMHDR *phdr) +{ + LPNMLISTVIEW lpnmlv = (LPNMLISTVIEW)phdr; + + switch (phdr->idFrom) + { + case IDC_PORT_LIST: + case IDC_MEMORY_LIST: + case IDC_DMA_LIST: + case IDC_IRQ_LIST: + case IDC_DEVICE_LIST: + switch(phdr->code) + { + case NM_CLICK: + if (lpnmlv->iItem != -1) + { + PCM_PARTIAL_RESOURCE_DESCRIPTOR pDescriptor; + LVITEM item; + + item.mask = LVIF_PARAM; + item.iItem = lpnmlv->iItem; + item.iSubItem = 0; + + if (ListView_GetItem(phdr->hwndFrom, &item)) + { + pDescriptor = (PCM_PARTIAL_RESOURCE_DESCRIPTOR)item.lParam; + + EnableWindow(GetDlgItem(hwndDlg, IDC_UNDETERMINED), + (pDescriptor->ShareDisposition == CmResourceShareUndetermined)); + + EnableWindow(GetDlgItem(hwndDlg, IDC_SHARED), + (pDescriptor->ShareDisposition == CmResourceShareShared)); + + EnableWindow(GetDlgItem(hwndDlg, IDC_DEVICE_EXCLUSIVE), + (pDescriptor->ShareDisposition == CmResourceShareDeviceExclusive)); + + EnableWindow(GetDlgItem(hwndDlg, IDC_DRIVER_EXCLUSIVE), + (pDescriptor->ShareDisposition == CmResourceShareDriverExclusive)); + } + } + else + { + EnableWindow(GetDlgItem(hwndDlg, IDC_UNDETERMINED), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_SHARED), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_DEVICE_EXCLUSIVE), FALSE); + EnableWindow(GetDlgItem(hwndDlg, IDC_DRIVER_EXCLUSIVE), FALSE); + } + break; + } + break; + } + + return FALSE; +} + + +static INT_PTR CALLBACK modify_resource_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + UNREFERENCED_PARAMETER(lParam); + + switch(uMsg) + { + case WM_INITDIALOG: + CreateResourceColumns(hwndDlg); + ParseResources(hwndDlg); + return FALSE; + + case WM_NOTIFY: + return OnResourceNotify(hwndDlg, (NMHDR *)lParam); + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDOK: + EndDialog(hwndDlg, IDOK); + break; + case IDCANCEL: + EndDialog(hwndDlg, IDCANCEL); + return TRUE; + } + } + return FALSE; +} + +static BOOL CreateResourceListColumns(HWND hWndListView) +{ + TCHAR szText[80]; + RECT rc; + LV_COLUMN lvC; + + ListView_SetExtendedListViewStyle(hWndListView, LVS_EX_FULLROWSELECT); + + GetClientRect(hWndListView, &rc); + + /* Create columns. */ + lvC.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; + lvC.pszText = szText; + lvC.fmt = LVCFMT_LEFT; + + /* Load the column labels from the resource file. */ + lvC.iSubItem = 0; + lvC.cx = (rc.right - rc.left) / 2; + LoadString(hInst, IDS_BUSNUMBER, szText, sizeof(szText)/sizeof(TCHAR)); + if (ListView_InsertColumn(hWndListView, 0, &lvC) == -1) + return FALSE; + + lvC.iSubItem = 1; + lvC.cx = (rc.right - rc.left) - lvC.cx; + LoadString(hInst, IDS_INTERFACE, szText, sizeof(szText)/sizeof(TCHAR)); + if (ListView_InsertColumn(hWndListView, 1, &lvC) == -1) + return FALSE; + + return TRUE; +} + +static VOID AddFullResourcesToList(HWND hwnd) +{ + PCM_FULL_RESOURCE_DESCRIPTOR pFullDescriptor; + TCHAR buffer[80]; + LVITEM item; + ULONG i; + INT iItem; + + for (i = 0; i < resourceValueData->Count; i++) + { + pFullDescriptor = &resourceValueData->List[i]; + + wsprintf(buffer, _T("%lu"), pFullDescriptor->BusNumber); + + item.mask = LVIF_TEXT; + item.iItem = i; + item.iSubItem = 0; + item.state = 0; + item.stateMask = 0; + item.pszText = buffer; + item.cchTextMax = (int)_tcslen(item.pszText); + + iItem = ListView_InsertItem(hwnd, &item); + if (iItem != -1) + { + GetInterfaceType(pFullDescriptor->InterfaceType, buffer, 80); + ListView_SetItemText(hwnd, iItem, 1, buffer); + } + } +} + +static BOOL +OnResourceListNotify(HWND hwndDlg, NMHDR *phdr) +{ + LPNMLISTVIEW lpnmlv = (LPNMLISTVIEW)phdr; + + switch (phdr->idFrom) + { + case IDC_RESOURCE_LIST: + switch(phdr->code) + { + case NM_CLICK: + fullResourceIndex = lpnmlv->iItem; + EnableWindow(GetDlgItem(hwndDlg, IDC_SHOW_RESOURCE), (lpnmlv->iItem != -1)); + break; + + case NM_DBLCLK: + if (lpnmlv->iItem != -1) + { + fullResourceIndex = lpnmlv->iItem; + DialogBox(0, MAKEINTRESOURCE(IDD_EDIT_RESOURCE), hwndDlg, modify_resource_dlgproc); + } + break; + } + break; + } + + return FALSE; +} + + +static INT_PTR CALLBACK modify_resource_list_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + UNREFERENCED_PARAMETER(lParam); + + switch(uMsg) + { + case WM_INITDIALOG: + CreateResourceListColumns(GetDlgItem(hwndDlg, IDC_RESOURCE_LIST)); + AddFullResourcesToList(GetDlgItem(hwndDlg, IDC_RESOURCE_LIST)); + return FALSE; + + case WM_NOTIFY: + return OnResourceListNotify(hwndDlg, (NMHDR *)lParam); + + case WM_COMMAND: + switch (LOWORD(wParam)) + { + case IDC_SHOW_RESOURCE: + if (fullResourceIndex != -1) + DialogBox(0, MAKEINTRESOURCE(IDD_EDIT_RESOURCE), hwndDlg, modify_resource_dlgproc); + break; + case IDOK: + EndDialog(hwndDlg, IDOK); + break; + case IDCANCEL: + EndDialog(hwndDlg, IDCANCEL); + return TRUE; + } + } + return FALSE; +} + + BOOL ModifyValue(HWND hwnd, HKEY hKey, LPCTSTR valueName, BOOL EditBin) { DWORD type; @@ -612,6 +1241,33 @@ BOOL ModifyValue(HWND hwnd, HKEY hKey, LPCTSTR valueName, BOOL EditBin) result = TRUE; } } + else if (EditBin == FALSE && type == REG_RESOURCE_LIST) + { + if (valueDataLen > 0) + { + resourceValueData = HeapAlloc(GetProcessHeap(), 0, valueDataLen); + if (resourceValueData == NULL) + { + error(hwnd, IDS_TOO_BIG_VALUE, valueDataLen); + goto done; + } + + lRet = RegQueryValueEx(hKey, valueName, 0, 0, (LPBYTE)resourceValueData, &valueDataLen); + if (lRet != ERROR_SUCCESS) + { + error(hwnd, IDS_BAD_VALUE, valueName); + goto done; + } + } + else + { + resourceValueData = NULL; + } + + if (DialogBox(0, MAKEINTRESOURCE(IDD_EDIT_RESOURCE_LIST), hwnd, modify_resource_list_dlgproc) == IDOK) + { + } + } else if (EditBin == TRUE || type == REG_NONE || type == REG_BINARY) { #ifndef UNICODE @@ -690,6 +1346,10 @@ BOOL ModifyValue(HWND hwnd, HKEY hKey, LPCTSTR valueName, BOOL EditBin) } done: + if (resourceValueData) + HeapFree(GetProcessHeap(), 0, resourceValueData); + resourceValueData = NULL; + if (stringValueData) HeapFree(GetProcessHeap(), 0, stringValueData); stringValueData = NULL; diff --git a/base/applications/regedit/lang/bg-BG.rc b/base/applications/regedit/lang/bg-BG.rc index 854d276977f..3c33c57eacc 100644 --- a/base/applications/regedit/lang/bg-BG.rc +++ b/base/applications/regedit/lang/bg-BG.rc @@ -249,6 +249,53 @@ BEGIN PUSHBUTTON "",IDCANCEL,196,82,50,14 END + +IDD_EDIT_RESOURCE_LIST DIALOGEX 32, 24, 170, 120 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | + WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Resource List" +FONT 8, "MS Shell Dlg" +{ + CONTROL "", IDC_RESOURCE_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 10, 150, 75 + DEFPUSHBUTTON "OK", IDOK, 27, 100, 50, 14 + PUSHBUTTON "Show...", IDC_SHOW_RESOURCE, 93, 100, 50, 14, WS_DISABLED +} + + +IDD_EDIT_RESOURCE DIALOGEX 6, 18, 281, 283 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | + WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Resources" +FONT 8, "MS Shell Dlg" +{ + LTEXT "DMA:", IDC_STATIC, 10, 5, 20, 8 + CONTROL "", IDC_DMA_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 15, 261, 31 + LTEXT "Interrupt:", IDC_STATIC, 10, 48, 35, 8 + CONTROL "", IDC_IRQ_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 58, 261, 31 + LTEXT "Memory:", IDC_STATIC, 10, 91, 32, 8 + CONTROL "", IDC_MEMORY_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 101, 261, 31 + LTEXT "Port:", IDC_STATIC, 10, 134, 38, 8 + CONTROL "", IDC_PORT_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 144, 261, 31 + LTEXT "Device specific data:", IDC_STATIC, 10, 177, 80, 8 + CONTROL "", IDC_DEVICE_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 188, 261, 31 + GROUPBOX "Usage", IDC_STATIC, 10, 219, 125, 39 + LTEXT "Undetermined", IDC_UNDETERMINED, 18, 230, 46, 8, WS_DISABLED + LTEXT "Shared", IDC_SHARED, 18, 240, 48, 8, WS_DISABLED + LTEXT "Device exclusive", IDC_DEVICE_EXCLUSIVE, 72, 230, 58, 8, WS_DISABLED + LTEXT "Driver exclusive", IDC_DRIVER_EXCLUSIVE, 72, 240, 54, 8, WS_DISABLED + RTEXT "Interface Type:", IDC_STATIC, 144, 220, 58, 8 + LTEXT "", IDC_INTERFACETYPE, 205, 220, 66, 8 + RTEXT "Bus Nummer:", IDC_STATIC, 151, 230, 51, 8 + LTEXT "", IDC_BUSNUMBER, 205, 230, 66, 8 + RTEXT "Version:", IDC_STATIC, 151, 240, 51, 8 + LTEXT "", IDC_VERSION, 205, 240, 66, 8 + RTEXT "Revision:", IDC_STATIC, 151, 250, 51, 8 + LTEXT "", IDC_REVISION, 205, 250, 66, 8 + DEFPUSHBUTTON "OK",IDOK, 92, 263, 40, 14 + PUSHBUTTON "&Data...", IDC_SHOW_RESOURCE_DATA, 148, 263, 40, 14, WS_DISABLED +} + + /* * String Table */ @@ -400,6 +447,60 @@ BEGIN IDS_IMPORTED_OK "Information added to the registry" END +STRINGTABLE DISCARDABLE +BEGIN + IDS_BUSNUMBER "Bus Number" + IDS_INTERFACE "Interface" + IDS_DMA_CHANNEL "Channel" + IDS_DMA_PORT "Port" + IDS_INTERRUPT_VECTOR "Vector" + IDS_INTERRUPT_LEVEL "Level" + IDS_INTERRUPT_AFFINITY "Affinity" + IDS_INTERRUPT_TYPE "Type" + IDS_MEMORY_ADDRESS "Physical Address" + IDS_MEMORY_LENGTH "Length" + IDS_MEMORY_ACCESS "Access" + IDS_PORT_ADDRESS "Physical Address" + IDS_PORT_LENGTH "Length" + IDS_PORT_ACCESS "Access" + IDS_SPECIFIC_RESERVED1 "Reserved 1" + IDS_SPECIFIC_RESERVED2 "Reserved 2" + IDS_SPECIFIC_DATASIZE "Data Size" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_PORT_PORT_IO "Port" + IDS_PORT_MEMORY_IO "Memory" + IDS_INTERRUPT_EDGE_SENSITIVE "Edge Sensitive" + IDS_INTERRUPT_LEVEL_SENSITIVE "Level Sensitive" + IDS_MEMORY_READ_ONLY "Read Only" + IDS_MEMORY_WRITE_ONLY "Write Only" + IDS_MEMORY_READ_WRITE "Read / Write" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_BUS_UNDEFINED "Undefined" + IDS_BUS_INTERNAL "Internal" + IDS_BUS_ISA "ISA" + IDS_BUS_EISA "EISA" + IDS_BUS_MICROCHANNEL "MicroChannel" + IDS_BUS_TURBOCHANNEL "TurboChannel" + IDS_BUS_PCIBUS "PCI" + IDS_BUS_VMEBUS "VME" + IDS_BUS_NUBUS "NuBus" + IDS_BUS_PCMCIABUS "PCMCIA" + IDS_BUS_CBUS "C-Bus" + IDS_BUS_MPIBUS "MPI-Bus" + IDS_BUS_MPSABUS "MPSA-Bus" + IDS_BUS_PROCESSORINTERNAL "Processor Internal" + IDS_BUS_INTERNALPOWERBUS "Internal Power Bus" + IDS_BUS_PNPISABUS "PnP-ISA Bus" + IDS_BUS_PNPBUS "PnP Bus" + IDS_BUS_UNKNOWNTYPE "Unknown Interface Type" +END + /*****************************************************************/ diff --git a/base/applications/regedit/lang/cs-CZ.rc b/base/applications/regedit/lang/cs-CZ.rc index be14bc5002c..7557b2f1597 100644 --- a/base/applications/regedit/lang/cs-CZ.rc +++ b/base/applications/regedit/lang/cs-CZ.rc @@ -246,6 +246,53 @@ BEGIN PUSHBUTTON "Storno",IDCANCEL,196,82,50,14 END + +IDD_EDIT_RESOURCE_LIST DIALOGEX 32, 24, 170, 120 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | + WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Resource List" +FONT 8, "MS Shell Dlg" +{ + CONTROL "", IDC_RESOURCE_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 10, 150, 75 + DEFPUSHBUTTON "OK", IDOK, 27, 100, 50, 14 + PUSHBUTTON "Show...", IDC_SHOW_RESOURCE, 93, 100, 50, 14, WS_DISABLED +} + + +IDD_EDIT_RESOURCE DIALOGEX 6, 18, 281, 283 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | + WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Resources" +FONT 8, "MS Shell Dlg" +{ + LTEXT "DMA:", IDC_STATIC, 10, 5, 20, 8 + CONTROL "", IDC_DMA_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 15, 261, 31 + LTEXT "Interrupt:", IDC_STATIC, 10, 48, 35, 8 + CONTROL "", IDC_IRQ_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 58, 261, 31 + LTEXT "Memory:", IDC_STATIC, 10, 91, 32, 8 + CONTROL "", IDC_MEMORY_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 101, 261, 31 + LTEXT "Port:", IDC_STATIC, 10, 134, 38, 8 + CONTROL "", IDC_PORT_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 144, 261, 31 + LTEXT "Device specific data:", IDC_STATIC, 10, 177, 80, 8 + CONTROL "", IDC_DEVICE_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 188, 261, 31 + GROUPBOX "Usage", IDC_STATIC, 10, 219, 125, 39 + LTEXT "Undetermined", IDC_UNDETERMINED, 18, 230, 46, 8, WS_DISABLED + LTEXT "Shared", IDC_SHARED, 18, 240, 48, 8, WS_DISABLED + LTEXT "Device exclusive", IDC_DEVICE_EXCLUSIVE, 72, 230, 58, 8, WS_DISABLED + LTEXT "Driver exclusive", IDC_DRIVER_EXCLUSIVE, 72, 240, 54, 8, WS_DISABLED + RTEXT "Interface Type:", IDC_STATIC, 144, 220, 58, 8 + LTEXT "", IDC_INTERFACETYPE, 205, 220, 66, 8 + RTEXT "Bus Nummer:", IDC_STATIC, 151, 230, 51, 8 + LTEXT "", IDC_BUSNUMBER, 205, 230, 66, 8 + RTEXT "Version:", IDC_STATIC, 151, 240, 51, 8 + LTEXT "", IDC_VERSION, 205, 240, 66, 8 + RTEXT "Revision:", IDC_STATIC, 151, 250, 51, 8 + LTEXT "", IDC_REVISION, 205, 250, 66, 8 + DEFPUSHBUTTON "OK",IDOK, 92, 263, 40, 14 + PUSHBUTTON "&Data...", IDC_SHOW_RESOURCE_DATA, 148, 263, 40, 14, WS_DISABLED +} + + /* * String Table */ @@ -397,6 +444,60 @@ BEGIN IDS_IMPORTED_OK "Information added to the registry" END +STRINGTABLE DISCARDABLE +BEGIN + IDS_BUSNUMBER "Bus Number" + IDS_INTERFACE "Interface" + IDS_DMA_CHANNEL "Channel" + IDS_DMA_PORT "Port" + IDS_INTERRUPT_VECTOR "Vector" + IDS_INTERRUPT_LEVEL "Level" + IDS_INTERRUPT_AFFINITY "Affinity" + IDS_INTERRUPT_TYPE "Type" + IDS_MEMORY_ADDRESS "Physical Address" + IDS_MEMORY_LENGTH "Length" + IDS_MEMORY_ACCESS "Access" + IDS_PORT_ADDRESS "Physical Address" + IDS_PORT_LENGTH "Length" + IDS_PORT_ACCESS "Access" + IDS_SPECIFIC_RESERVED1 "Reserved 1" + IDS_SPECIFIC_RESERVED2 "Reserved 2" + IDS_SPECIFIC_DATASIZE "Data Size" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_PORT_PORT_IO "Port" + IDS_PORT_MEMORY_IO "Memory" + IDS_INTERRUPT_EDGE_SENSITIVE "Edge Sensitive" + IDS_INTERRUPT_LEVEL_SENSITIVE "Level Sensitive" + IDS_MEMORY_READ_ONLY "Read Only" + IDS_MEMORY_WRITE_ONLY "Write Only" + IDS_MEMORY_READ_WRITE "Read / Write" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_BUS_UNDEFINED "Undefined" + IDS_BUS_INTERNAL "Internal" + IDS_BUS_ISA "ISA" + IDS_BUS_EISA "EISA" + IDS_BUS_MICROCHANNEL "MicroChannel" + IDS_BUS_TURBOCHANNEL "TurboChannel" + IDS_BUS_PCIBUS "PCI" + IDS_BUS_VMEBUS "VME" + IDS_BUS_NUBUS "NuBus" + IDS_BUS_PCMCIABUS "PCMCIA" + IDS_BUS_CBUS "C-Bus" + IDS_BUS_MPIBUS "MPI-Bus" + IDS_BUS_MPSABUS "MPSA-Bus" + IDS_BUS_PROCESSORINTERNAL "Processor Internal" + IDS_BUS_INTERNALPOWERBUS "Internal Power Bus" + IDS_BUS_PNPISABUS "PnP-ISA Bus" + IDS_BUS_PNPBUS "PnP Bus" + IDS_BUS_UNKNOWNTYPE "Unknown Interface Type" +END + /*****************************************************************/ diff --git a/base/applications/regedit/lang/de-DE.rc b/base/applications/regedit/lang/de-DE.rc index e48dc17a4c5..82d3c40b80f 100644 --- a/base/applications/regedit/lang/de-DE.rc +++ b/base/applications/regedit/lang/de-DE.rc @@ -248,6 +248,53 @@ BEGIN PUSHBUTTON "Abbrechen",IDCANCEL,196,82,50,14 END + +IDD_EDIT_RESOURCE_LIST DIALOGEX 32, 24, 170, 120 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | + WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Liste der Ressourcen" +FONT 8, "MS Shell Dlg" +{ + CONTROL "", IDC_RESOURCE_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 10, 150, 75 + DEFPUSHBUTTON "OK", IDOK, 27, 100, 50, 14 + PUSHBUTTON "Anzeige...", IDC_SHOW_RESOURCE, 93, 100, 50, 14, WS_DISABLED +} + + +IDD_EDIT_RESOURCE DIALOGEX 6, 18, 281, 283 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | + WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Ressourcen" +FONT 8, "MS Shell Dlg" +{ + LTEXT "DMA:", IDC_STATIC, 10, 5, 20, 8 + CONTROL "", IDC_DMA_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 15, 261, 31 + LTEXT "Interrupt:", IDC_STATIC, 10, 48, 35, 8 + CONTROL "", IDC_IRQ_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 58, 261, 31 + LTEXT "Speicher:", IDC_STATIC, 10, 91, 32, 8 + CONTROL "", IDC_MEMORY_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 101, 261, 31 + LTEXT "Anschluss:", IDC_STATIC, 10, 134, 38, 8 + CONTROL "", IDC_PORT_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 144, 261, 31 + LTEXT "Gertspezifische Daten:", IDC_STATIC, 10, 177, 80, 8 + CONTROL "", IDC_DEVICE_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 188, 261, 31 + GROUPBOX "Benutzung", IDC_STATIC, 10, 219, 125, 39 + LTEXT "Unbestimmt", IDC_UNDETERMINED, 18, 230, 46, 8, WS_DISABLED + LTEXT "Gemeinsam", IDC_SHARED, 18, 240, 48, 8, WS_DISABLED + LTEXT "Gert-exklusiv", IDC_DEVICE_EXCLUSIVE, 72, 230, 58, 8, WS_DISABLED + LTEXT "Treiber-exklusiv", IDC_DRIVER_EXCLUSIVE, 72, 240, 54, 8, WS_DISABLED + RTEXT "Schnittstellentyp:", IDC_STATIC, 144, 220, 58, 8 + LTEXT "", IDC_INTERFACETYPE, 205, 220, 66, 8 + RTEXT "Busnummer:", IDC_STATIC, 151, 230, 51, 8 + LTEXT "", IDC_BUSNUMBER, 205, 230, 66, 8 + RTEXT "Version:", IDC_STATIC, 151, 240, 51, 8 + LTEXT "", IDC_VERSION, 205, 240, 66, 8 + RTEXT "Revision:", IDC_STATIC, 151, 250, 51, 8 + LTEXT "", IDC_REVISION, 205, 250, 66, 8 + DEFPUSHBUTTON "OK",IDOK, 92, 263, 40, 14 + PUSHBUTTON "&Daten...", IDC_SHOW_RESOURCE_DATA, 148, 263, 40, 14, WS_DISABLED +} + + /* * String Table */ @@ -399,6 +446,60 @@ BEGIN IDS_IMPORTED_OK "Information added to the registry" END +STRINGTABLE DISCARDABLE +BEGIN + IDS_BUSNUMBER "Busnummer" + IDS_INTERFACE "Schnittstelle" + IDS_DMA_CHANNEL "Kanal" + IDS_DMA_PORT "Anschluss" + IDS_INTERRUPT_VECTOR "Vektor" + IDS_INTERRUPT_LEVEL "Ebene" + IDS_INTERRUPT_AFFINITY "Affinitt" + IDS_INTERRUPT_TYPE "Typ" + IDS_MEMORY_ADDRESS "Physikalische Adresse" + IDS_MEMORY_LENGTH "Lnge" + IDS_MEMORY_ACCESS "Zugriff" + IDS_PORT_ADDRESS "Physikalische Adresse" + IDS_PORT_LENGTH "Lnge" + IDS_PORT_ACCESS "Zugriff" + IDS_SPECIFIC_RESERVED1 "Reserviert 1" + IDS_SPECIFIC_RESERVED2 "Reserviert 2" + IDS_SPECIFIC_DATASIZE "Datengre" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_PORT_PORT_IO "Anschluss" + IDS_PORT_MEMORY_IO "Speicher" + IDS_INTERRUPT_EDGE_SENSITIVE "Flankengesteuert" + IDS_INTERRUPT_LEVEL_SENSITIVE "Pegelgesteuert" + IDS_MEMORY_READ_ONLY "Nur Lesen" + IDS_MEMORY_WRITE_ONLY "Nur Schreiben" + IDS_MEMORY_READ_WRITE "Lesen / Schreiben" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_BUS_UNDEFINED "Undefiniert" + IDS_BUS_INTERNAL "Intern" + IDS_BUS_ISA "ISA" + IDS_BUS_EISA "EISA" + IDS_BUS_MICROCHANNEL "MicroChannel" + IDS_BUS_TURBOCHANNEL "TurboChannel" + IDS_BUS_PCIBUS "PCI" + IDS_BUS_VMEBUS "VME" + IDS_BUS_NUBUS "NuBus" + IDS_BUS_PCMCIABUS "PCMCIA" + IDS_BUS_CBUS "C-Bus" + IDS_BUS_MPIBUS "MPI-Bus" + IDS_BUS_MPSABUS "MPSA-Bus" + IDS_BUS_PROCESSORINTERNAL "Processor Internal" + IDS_BUS_INTERNALPOWERBUS "Internal Power Bus" + IDS_BUS_PNPISABUS "PnP-ISA Bus" + IDS_BUS_PNPBUS "PnP Bus" + IDS_BUS_UNKNOWNTYPE "Unbekannter Schnittstellentyp" +END + /*****************************************************************/ diff --git a/base/applications/regedit/lang/el-GR.rc b/base/applications/regedit/lang/el-GR.rc index c7228641bb8..ca27ccdcdd8 100644 --- a/base/applications/regedit/lang/el-GR.rc +++ b/base/applications/regedit/lang/el-GR.rc @@ -248,6 +248,53 @@ BEGIN PUSHBUTTON "",IDCANCEL,196,82,50,14 END + +IDD_EDIT_RESOURCE_LIST DIALOGEX 32, 24, 170, 120 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | + WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Resource List" +FONT 8, "MS Shell Dlg" +{ + CONTROL "", IDC_RESOURCE_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 10, 150, 75 + DEFPUSHBUTTON "OK", IDOK, 27, 100, 50, 14 + PUSHBUTTON "Show...", IDC_SHOW_RESOURCE, 93, 100, 50, 14, WS_DISABLED +} + + +IDD_EDIT_RESOURCE DIALOGEX 6, 18, 281, 283 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | + WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Resources" +FONT 8, "MS Shell Dlg" +{ + LTEXT "DMA:", IDC_STATIC, 10, 5, 20, 8 + CONTROL "", IDC_DMA_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 15, 261, 31 + LTEXT "Interrupt:", IDC_STATIC, 10, 48, 35, 8 + CONTROL "", IDC_IRQ_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 58, 261, 31 + LTEXT "Memory:", IDC_STATIC, 10, 91, 32, 8 + CONTROL "", IDC_MEMORY_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 101, 261, 31 + LTEXT "Port:", IDC_STATIC, 10, 134, 38, 8 + CONTROL "", IDC_PORT_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 144, 261, 31 + LTEXT "Device specific data:", IDC_STATIC, 10, 177, 80, 8 + CONTROL "", IDC_DEVICE_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 188, 261, 31 + GROUPBOX "Usage", IDC_STATIC, 10, 219, 125, 39 + LTEXT "Undetermined", IDC_UNDETERMINED, 18, 230, 46, 8, WS_DISABLED + LTEXT "Shared", IDC_SHARED, 18, 240, 48, 8, WS_DISABLED + LTEXT "Device exclusive", IDC_DEVICE_EXCLUSIVE, 72, 230, 58, 8, WS_DISABLED + LTEXT "Driver exclusive", IDC_DRIVER_EXCLUSIVE, 72, 240, 54, 8, WS_DISABLED + RTEXT "Interface Type:", IDC_STATIC, 144, 220, 58, 8 + LTEXT "", IDC_INTERFACETYPE, 205, 220, 66, 8 + RTEXT "Bus Nummer:", IDC_STATIC, 151, 230, 51, 8 + LTEXT "", IDC_BUSNUMBER, 205, 230, 66, 8 + RTEXT "Version:", IDC_STATIC, 151, 240, 51, 8 + LTEXT "", IDC_VERSION, 205, 240, 66, 8 + RTEXT "Revision:", IDC_STATIC, 151, 250, 51, 8 + LTEXT "", IDC_REVISION, 205, 250, 66, 8 + DEFPUSHBUTTON "OK",IDOK, 92, 263, 40, 14 + PUSHBUTTON "&Data...", IDC_SHOW_RESOURCE_DATA, 148, 263, 40, 14, WS_DISABLED +} + + /* * String Table */ @@ -399,6 +446,60 @@ BEGIN IDS_IMPORTED_OK "Information added to the registry" END +STRINGTABLE DISCARDABLE +BEGIN + IDS_BUSNUMBER "Bus Number" + IDS_INTERFACE "Interface" + IDS_DMA_CHANNEL "Channel" + IDS_DMA_PORT "Port" + IDS_INTERRUPT_VECTOR "Vector" + IDS_INTERRUPT_LEVEL "Level" + IDS_INTERRUPT_AFFINITY "Affinity" + IDS_INTERRUPT_TYPE "Type" + IDS_MEMORY_ADDRESS "Physical Address" + IDS_MEMORY_LENGTH "Length" + IDS_MEMORY_ACCESS "Access" + IDS_PORT_ADDRESS "Physical Address" + IDS_PORT_LENGTH "Length" + IDS_PORT_ACCESS "Access" + IDS_SPECIFIC_RESERVED1 "Reserved 1" + IDS_SPECIFIC_RESERVED2 "Reserved 2" + IDS_SPECIFIC_DATASIZE "Data Size" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_PORT_PORT_IO "Port" + IDS_PORT_MEMORY_IO "Memory" + IDS_INTERRUPT_EDGE_SENSITIVE "Edge Sensitive" + IDS_INTERRUPT_LEVEL_SENSITIVE "Level Sensitive" + IDS_MEMORY_READ_ONLY "Read Only" + IDS_MEMORY_WRITE_ONLY "Write Only" + IDS_MEMORY_READ_WRITE "Read / Write" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_BUS_UNDEFINED "Undefined" + IDS_BUS_INTERNAL "Internal" + IDS_BUS_ISA "ISA" + IDS_BUS_EISA "EISA" + IDS_BUS_MICROCHANNEL "MicroChannel" + IDS_BUS_TURBOCHANNEL "TurboChannel" + IDS_BUS_PCIBUS "PCI" + IDS_BUS_VMEBUS "VME" + IDS_BUS_NUBUS "NuBus" + IDS_BUS_PCMCIABUS "PCMCIA" + IDS_BUS_CBUS "C-Bus" + IDS_BUS_MPIBUS "MPI-Bus" + IDS_BUS_MPSABUS "MPSA-Bus" + IDS_BUS_PROCESSORINTERNAL "Processor Internal" + IDS_BUS_INTERNALPOWERBUS "Internal Power Bus" + IDS_BUS_PNPISABUS "PnP-ISA Bus" + IDS_BUS_PNPBUS "PnP Bus" + IDS_BUS_UNKNOWNTYPE "Unknown Interface Type" +END + /*****************************************************************/ diff --git a/base/applications/regedit/lang/en-US.rc b/base/applications/regedit/lang/en-US.rc index 679f264d0e6..80dc88d399d 100644 --- a/base/applications/regedit/lang/en-US.rc +++ b/base/applications/regedit/lang/en-US.rc @@ -236,6 +236,53 @@ BEGIN PUSHBUTTON "Cancel",IDCANCEL,196,82,50,14 END + +IDD_EDIT_RESOURCE_LIST DIALOGEX 32, 24, 170, 120 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | + WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Resource List" +FONT 8, "MS Shell Dlg" +{ + CONTROL "", IDC_RESOURCE_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 10, 150, 75 + DEFPUSHBUTTON "OK", IDOK, 27, 100, 50, 14 + PUSHBUTTON "Show...", IDC_SHOW_RESOURCE, 93, 100, 50, 14, WS_DISABLED +} + + +IDD_EDIT_RESOURCE DIALOGEX 6, 18, 281, 283 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | + WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Resources" +FONT 8, "MS Shell Dlg" +{ + LTEXT "DMA:", IDC_STATIC, 10, 5, 20, 8 + CONTROL "", IDC_DMA_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 15, 261, 31 + LTEXT "Interrupt:", IDC_STATIC, 10, 48, 35, 8 + CONTROL "", IDC_IRQ_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 58, 261, 31 + LTEXT "Memory:", IDC_STATIC, 10, 91, 32, 8 + CONTROL "", IDC_MEMORY_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 101, 261, 31 + LTEXT "Port:", IDC_STATIC, 10, 134, 38, 8 + CONTROL "", IDC_PORT_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 144, 261, 31 + LTEXT "Device specific data:", IDC_STATIC, 10, 177, 80, 8 + CONTROL "", IDC_DEVICE_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 188, 261, 31 + GROUPBOX "Usage", IDC_STATIC, 10, 219, 125, 39 + LTEXT "Undetermined", IDC_UNDETERMINED, 18, 230, 46, 8, WS_DISABLED + LTEXT "Shared", IDC_SHARED, 18, 240, 48, 8, WS_DISABLED + LTEXT "Device exclusive", IDC_DEVICE_EXCLUSIVE, 72, 230, 58, 8, WS_DISABLED + LTEXT "Driver exclusive", IDC_DRIVER_EXCLUSIVE, 72, 240, 54, 8, WS_DISABLED + RTEXT "Interface Type:", IDC_STATIC, 144, 220, 58, 8 + LTEXT "", IDC_INTERFACETYPE, 205, 220, 66, 8 + RTEXT "Bus Nummer:", IDC_STATIC, 151, 230, 51, 8 + LTEXT "", IDC_BUSNUMBER, 205, 230, 66, 8 + RTEXT "Version:", IDC_STATIC, 151, 240, 51, 8 + LTEXT "", IDC_VERSION, 205, 240, 66, 8 + RTEXT "Revision:", IDC_STATIC, 151, 250, 51, 8 + LTEXT "", IDC_REVISION, 205, 250, 66, 8 + DEFPUSHBUTTON "OK",IDOK, 92, 263, 40, 14 + PUSHBUTTON "&Data...", IDC_SHOW_RESOURCE_DATA, 148, 263, 40, 14, WS_DISABLED +} + + /* * String Table */ @@ -387,6 +434,60 @@ BEGIN IDS_IMPORTED_OK "Information added to the registry" END +STRINGTABLE DISCARDABLE +BEGIN + IDS_BUSNUMBER "Bus Number" + IDS_INTERFACE "Interface" + IDS_DMA_CHANNEL "Channel" + IDS_DMA_PORT "Port" + IDS_INTERRUPT_VECTOR "Vector" + IDS_INTERRUPT_LEVEL "Level" + IDS_INTERRUPT_AFFINITY "Affinity" + IDS_INTERRUPT_TYPE "Type" + IDS_MEMORY_ADDRESS "Physical Address" + IDS_MEMORY_LENGTH "Length" + IDS_MEMORY_ACCESS "Access" + IDS_PORT_ADDRESS "Physical Address" + IDS_PORT_LENGTH "Length" + IDS_PORT_ACCESS "Access" + IDS_SPECIFIC_RESERVED1 "Reserved 1" + IDS_SPECIFIC_RESERVED2 "Reserved 2" + IDS_SPECIFIC_DATASIZE "Data Size" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_PORT_PORT_IO "Port" + IDS_PORT_MEMORY_IO "Memory" + IDS_INTERRUPT_EDGE_SENSITIVE "Edge Sensitive" + IDS_INTERRUPT_LEVEL_SENSITIVE "Level Sensitive" + IDS_MEMORY_READ_ONLY "Read Only" + IDS_MEMORY_WRITE_ONLY "Write Only" + IDS_MEMORY_READ_WRITE "Read / Write" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_BUS_UNDEFINED "Undefined" + IDS_BUS_INTERNAL "Internal" + IDS_BUS_ISA "ISA" + IDS_BUS_EISA "EISA" + IDS_BUS_MICROCHANNEL "MicroChannel" + IDS_BUS_TURBOCHANNEL "TurboChannel" + IDS_BUS_PCIBUS "PCI" + IDS_BUS_VMEBUS "VME" + IDS_BUS_NUBUS "NuBus" + IDS_BUS_PCMCIABUS "PCMCIA" + IDS_BUS_CBUS "C-Bus" + IDS_BUS_MPIBUS "MPI-Bus" + IDS_BUS_MPSABUS "MPSA-Bus" + IDS_BUS_PROCESSORINTERNAL "Processor Internal" + IDS_BUS_INTERNALPOWERBUS "Internal Power Bus" + IDS_BUS_PNPISABUS "PnP-ISA Bus" + IDS_BUS_PNPBUS "PnP Bus" + IDS_BUS_UNKNOWNTYPE "Unknown Interface Type" +END + /*****************************************************************/ diff --git a/base/applications/regedit/lang/es-ES.rc b/base/applications/regedit/lang/es-ES.rc index c4c4b1f0545..82860337d51 100644 --- a/base/applications/regedit/lang/es-ES.rc +++ b/base/applications/regedit/lang/es-ES.rc @@ -251,6 +251,53 @@ BEGIN PUSHBUTTON "Cancelar",IDCANCEL,196,82,50,14 END + +IDD_EDIT_RESOURCE_LIST DIALOGEX 32, 24, 170, 120 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | + WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Resource List" +FONT 8, "MS Shell Dlg" +{ + CONTROL "", IDC_RESOURCE_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 10, 150, 75 + DEFPUSHBUTTON "OK", IDOK, 27, 100, 50, 14 + PUSHBUTTON "Show...", IDC_SHOW_RESOURCE, 93, 100, 50, 14, WS_DISABLED +} + + +IDD_EDIT_RESOURCE DIALOGEX 6, 18, 281, 283 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | + WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Resources" +FONT 8, "MS Shell Dlg" +{ + LTEXT "DMA:", IDC_STATIC, 10, 5, 20, 8 + CONTROL "", IDC_DMA_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 15, 261, 31 + LTEXT "Interrupt:", IDC_STATIC, 10, 48, 35, 8 + CONTROL "", IDC_IRQ_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 58, 261, 31 + LTEXT "Memory:", IDC_STATIC, 10, 91, 32, 8 + CONTROL "", IDC_MEMORY_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 101, 261, 31 + LTEXT "Port:", IDC_STATIC, 10, 134, 38, 8 + CONTROL "", IDC_PORT_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 144, 261, 31 + LTEXT "Device specific data:", IDC_STATIC, 10, 177, 80, 8 + CONTROL "", IDC_DEVICE_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 188, 261, 31 + GROUPBOX "Usage", IDC_STATIC, 10, 219, 125, 39 + LTEXT "Undetermined", IDC_UNDETERMINED, 18, 230, 46, 8, WS_DISABLED + LTEXT "Shared", IDC_SHARED, 18, 240, 48, 8, WS_DISABLED + LTEXT "Device exclusive", IDC_DEVICE_EXCLUSIVE, 72, 230, 58, 8, WS_DISABLED + LTEXT "Driver exclusive", IDC_DRIVER_EXCLUSIVE, 72, 240, 54, 8, WS_DISABLED + RTEXT "Interface Type:", IDC_STATIC, 144, 220, 58, 8 + LTEXT "", IDC_INTERFACETYPE, 205, 220, 66, 8 + RTEXT "Bus Nummer:", IDC_STATIC, 151, 230, 51, 8 + LTEXT "", IDC_BUSNUMBER, 205, 230, 66, 8 + RTEXT "Version:", IDC_STATIC, 151, 240, 51, 8 + LTEXT "", IDC_VERSION, 205, 240, 66, 8 + RTEXT "Revision:", IDC_STATIC, 151, 250, 51, 8 + LTEXT "", IDC_REVISION, 205, 250, 66, 8 + DEFPUSHBUTTON "OK",IDOK, 92, 263, 40, 14 + PUSHBUTTON "&Data...", IDC_SHOW_RESOURCE_DATA, 148, 263, 40, 14, WS_DISABLED +} + + /* * String Table */ @@ -402,6 +449,60 @@ BEGIN IDS_IMPORTED_OK "La informacin ha sido agregada al registro" END +STRINGTABLE DISCARDABLE +BEGIN + IDS_BUSNUMBER "Bus Number" + IDS_INTERFACE "Interface" + IDS_DMA_CHANNEL "Channel" + IDS_DMA_PORT "Port" + IDS_INTERRUPT_VECTOR "Vector" + IDS_INTERRUPT_LEVEL "Level" + IDS_INTERRUPT_AFFINITY "Affinity" + IDS_INTERRUPT_TYPE "Type" + IDS_MEMORY_ADDRESS "Physical Address" + IDS_MEMORY_LENGTH "Length" + IDS_MEMORY_ACCESS "Access" + IDS_PORT_ADDRESS "Physical Address" + IDS_PORT_LENGTH "Length" + IDS_PORT_ACCESS "Access" + IDS_SPECIFIC_RESERVED1 "Reserved 1" + IDS_SPECIFIC_RESERVED2 "Reserved 2" + IDS_SPECIFIC_DATASIZE "Data Size" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_PORT_PORT_IO "Port" + IDS_PORT_MEMORY_IO "Memory" + IDS_INTERRUPT_EDGE_SENSITIVE "Edge Sensitive" + IDS_INTERRUPT_LEVEL_SENSITIVE "Level Sensitive" + IDS_MEMORY_READ_ONLY "Read Only" + IDS_MEMORY_WRITE_ONLY "Write Only" + IDS_MEMORY_READ_WRITE "Read / Write" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_BUS_UNDEFINED "Undefined" + IDS_BUS_INTERNAL "Internal" + IDS_BUS_ISA "ISA" + IDS_BUS_EISA "EISA" + IDS_BUS_MICROCHANNEL "MicroChannel" + IDS_BUS_TURBOCHANNEL "TurboChannel" + IDS_BUS_PCIBUS "PCI" + IDS_BUS_VMEBUS "VME" + IDS_BUS_NUBUS "NuBus" + IDS_BUS_PCMCIABUS "PCMCIA" + IDS_BUS_CBUS "C-Bus" + IDS_BUS_MPIBUS "MPI-Bus" + IDS_BUS_MPSABUS "MPSA-Bus" + IDS_BUS_PROCESSORINTERNAL "Processor Internal" + IDS_BUS_INTERNALPOWERBUS "Internal Power Bus" + IDS_BUS_PNPISABUS "PnP-ISA Bus" + IDS_BUS_PNPBUS "PnP Bus" + IDS_BUS_UNKNOWNTYPE "Unknown Interface Type" +END + /*****************************************************************/ diff --git a/base/applications/regedit/lang/fr-FR.rc b/base/applications/regedit/lang/fr-FR.rc index 7f01199c3e2..e3d5326bec1 100644 --- a/base/applications/regedit/lang/fr-FR.rc +++ b/base/applications/regedit/lang/fr-FR.rc @@ -251,6 +251,53 @@ BEGIN PUSHBUTTON "Annuler",IDCANCEL,196,82,50,14 END + +IDD_EDIT_RESOURCE_LIST DIALOGEX 32, 24, 170, 120 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | + WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Resource List" +FONT 8, "MS Shell Dlg" +{ + CONTROL "", IDC_RESOURCE_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 10, 150, 75 + DEFPUSHBUTTON "OK", IDOK, 27, 100, 50, 14 + PUSHBUTTON "Show...", IDC_SHOW_RESOURCE, 93, 100, 50, 14, WS_DISABLED +} + + +IDD_EDIT_RESOURCE DIALOGEX 6, 18, 281, 283 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | + WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Resources" +FONT 8, "MS Shell Dlg" +{ + LTEXT "DMA:", IDC_STATIC, 10, 5, 20, 8 + CONTROL "", IDC_DMA_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 15, 261, 31 + LTEXT "Interrupt:", IDC_STATIC, 10, 48, 35, 8 + CONTROL "", IDC_IRQ_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 58, 261, 31 + LTEXT "Memory:", IDC_STATIC, 10, 91, 32, 8 + CONTROL "", IDC_MEMORY_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 101, 261, 31 + LTEXT "Port:", IDC_STATIC, 10, 134, 38, 8 + CONTROL "", IDC_PORT_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 144, 261, 31 + LTEXT "Device specific data:", IDC_STATIC, 10, 177, 80, 8 + CONTROL "", IDC_DEVICE_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 188, 261, 31 + GROUPBOX "Usage", IDC_STATIC, 10, 219, 125, 39 + LTEXT "Undetermined", IDC_UNDETERMINED, 18, 230, 46, 8, WS_DISABLED + LTEXT "Shared", IDC_SHARED, 18, 240, 48, 8, WS_DISABLED + LTEXT "Device exclusive", IDC_DEVICE_EXCLUSIVE, 72, 230, 58, 8, WS_DISABLED + LTEXT "Driver exclusive", IDC_DRIVER_EXCLUSIVE, 72, 240, 54, 8, WS_DISABLED + RTEXT "Interface Type:", IDC_STATIC, 144, 220, 58, 8 + LTEXT "", IDC_INTERFACETYPE, 205, 220, 66, 8 + RTEXT "Bus Nummer:", IDC_STATIC, 151, 230, 51, 8 + LTEXT "", IDC_BUSNUMBER, 205, 230, 66, 8 + RTEXT "Version:", IDC_STATIC, 151, 240, 51, 8 + LTEXT "", IDC_VERSION, 205, 240, 66, 8 + RTEXT "Revision:", IDC_STATIC, 151, 250, 51, 8 + LTEXT "", IDC_REVISION, 205, 250, 66, 8 + DEFPUSHBUTTON "OK",IDOK, 92, 263, 40, 14 + PUSHBUTTON "&Data...", IDC_SHOW_RESOURCE_DATA, 148, 263, 40, 14, WS_DISABLED +} + + /* * String Table */ @@ -402,6 +449,60 @@ BEGIN IDS_IMPORTED_OK "Information added to the registry" END +STRINGTABLE DISCARDABLE +BEGIN + IDS_BUSNUMBER "Bus Number" + IDS_INTERFACE "Interface" + IDS_DMA_CHANNEL "Channel" + IDS_DMA_PORT "Port" + IDS_INTERRUPT_VECTOR "Vector" + IDS_INTERRUPT_LEVEL "Level" + IDS_INTERRUPT_AFFINITY "Affinity" + IDS_INTERRUPT_TYPE "Type" + IDS_MEMORY_ADDRESS "Physical Address" + IDS_MEMORY_LENGTH "Length" + IDS_MEMORY_ACCESS "Access" + IDS_PORT_ADDRESS "Physical Address" + IDS_PORT_LENGTH "Length" + IDS_PORT_ACCESS "Access" + IDS_SPECIFIC_RESERVED1 "Reserved 1" + IDS_SPECIFIC_RESERVED2 "Reserved 2" + IDS_SPECIFIC_DATASIZE "Data Size" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_PORT_PORT_IO "Port" + IDS_PORT_MEMORY_IO "Memory" + IDS_INTERRUPT_EDGE_SENSITIVE "Edge Sensitive" + IDS_INTERRUPT_LEVEL_SENSITIVE "Level Sensitive" + IDS_MEMORY_READ_ONLY "Read Only" + IDS_MEMORY_WRITE_ONLY "Write Only" + IDS_MEMORY_READ_WRITE "Read / Write" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_BUS_UNDEFINED "Undefined" + IDS_BUS_INTERNAL "Internal" + IDS_BUS_ISA "ISA" + IDS_BUS_EISA "EISA" + IDS_BUS_MICROCHANNEL "MicroChannel" + IDS_BUS_TURBOCHANNEL "TurboChannel" + IDS_BUS_PCIBUS "PCI" + IDS_BUS_VMEBUS "VME" + IDS_BUS_NUBUS "NuBus" + IDS_BUS_PCMCIABUS "PCMCIA" + IDS_BUS_CBUS "C-Bus" + IDS_BUS_MPIBUS "MPI-Bus" + IDS_BUS_MPSABUS "MPSA-Bus" + IDS_BUS_PROCESSORINTERNAL "Processor Internal" + IDS_BUS_INTERNALPOWERBUS "Internal Power Bus" + IDS_BUS_PNPISABUS "PnP-ISA Bus" + IDS_BUS_PNPBUS "PnP Bus" + IDS_BUS_UNKNOWNTYPE "Unknown Interface Type" +END + /*****************************************************************/ diff --git a/base/applications/regedit/lang/hu-HU.rc b/base/applications/regedit/lang/hu-HU.rc index ba56f983dbe..4d23b44d1fe 100644 --- a/base/applications/regedit/lang/hu-HU.rc +++ b/base/applications/regedit/lang/hu-HU.rc @@ -249,6 +249,53 @@ BEGIN PUSHBUTTON "Cancel",IDCANCEL,196,82,50,14 END + +IDD_EDIT_RESOURCE_LIST DIALOGEX 32, 24, 170, 120 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | + WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Resource List" +FONT 8, "MS Shell Dlg" +{ + CONTROL "", IDC_RESOURCE_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 10, 150, 75 + DEFPUSHBUTTON "OK", IDOK, 27, 100, 50, 14 + PUSHBUTTON "Show...", IDC_SHOW_RESOURCE, 93, 100, 50, 14, WS_DISABLED +} + + +IDD_EDIT_RESOURCE DIALOGEX 6, 18, 281, 283 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | + WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Resources" +FONT 8, "MS Shell Dlg" +{ + LTEXT "DMA:", IDC_STATIC, 10, 5, 20, 8 + CONTROL "", IDC_DMA_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 15, 261, 31 + LTEXT "Interrupt:", IDC_STATIC, 10, 48, 35, 8 + CONTROL "", IDC_IRQ_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 58, 261, 31 + LTEXT "Memory:", IDC_STATIC, 10, 91, 32, 8 + CONTROL "", IDC_MEMORY_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 101, 261, 31 + LTEXT "Port:", IDC_STATIC, 10, 134, 38, 8 + CONTROL "", IDC_PORT_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 144, 261, 31 + LTEXT "Device specific data:", IDC_STATIC, 10, 177, 80, 8 + CONTROL "", IDC_DEVICE_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 188, 261, 31 + GROUPBOX "Usage", IDC_STATIC, 10, 219, 125, 39 + LTEXT "Undetermined", IDC_UNDETERMINED, 18, 230, 46, 8, WS_DISABLED + LTEXT "Shared", IDC_SHARED, 18, 240, 48, 8, WS_DISABLED + LTEXT "Device exclusive", IDC_DEVICE_EXCLUSIVE, 72, 230, 58, 8, WS_DISABLED + LTEXT "Driver exclusive", IDC_DRIVER_EXCLUSIVE, 72, 240, 54, 8, WS_DISABLED + RTEXT "Interface Type:", IDC_STATIC, 144, 220, 58, 8 + LTEXT "", IDC_INTERFACETYPE, 205, 220, 66, 8 + RTEXT "Bus Nummer:", IDC_STATIC, 151, 230, 51, 8 + LTEXT "", IDC_BUSNUMBER, 205, 230, 66, 8 + RTEXT "Version:", IDC_STATIC, 151, 240, 51, 8 + LTEXT "", IDC_VERSION, 205, 240, 66, 8 + RTEXT "Revision:", IDC_STATIC, 151, 250, 51, 8 + LTEXT "", IDC_REVISION, 205, 250, 66, 8 + DEFPUSHBUTTON "OK",IDOK, 92, 263, 40, 14 + PUSHBUTTON "&Data...", IDC_SHOW_RESOURCE_DATA, 148, 263, 40, 14, WS_DISABLED +} + + /* * String Table */ @@ -400,6 +447,60 @@ BEGIN IDS_IMPORTED_OK "Information added to the registry" END +STRINGTABLE DISCARDABLE +BEGIN + IDS_BUSNUMBER "Bus Number" + IDS_INTERFACE "Interface" + IDS_DMA_CHANNEL "Channel" + IDS_DMA_PORT "Port" + IDS_INTERRUPT_VECTOR "Vector" + IDS_INTERRUPT_LEVEL "Level" + IDS_INTERRUPT_AFFINITY "Affinity" + IDS_INTERRUPT_TYPE "Type" + IDS_MEMORY_ADDRESS "Physical Address" + IDS_MEMORY_LENGTH "Length" + IDS_MEMORY_ACCESS "Access" + IDS_PORT_ADDRESS "Physical Address" + IDS_PORT_LENGTH "Length" + IDS_PORT_ACCESS "Access" + IDS_SPECIFIC_RESERVED1 "Reserved 1" + IDS_SPECIFIC_RESERVED2 "Reserved 2" + IDS_SPECIFIC_DATASIZE "Data Size" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_PORT_PORT_IO "Port" + IDS_PORT_MEMORY_IO "Memory" + IDS_INTERRUPT_EDGE_SENSITIVE "Edge Sensitive" + IDS_INTERRUPT_LEVEL_SENSITIVE "Level Sensitive" + IDS_MEMORY_READ_ONLY "Read Only" + IDS_MEMORY_WRITE_ONLY "Write Only" + IDS_MEMORY_READ_WRITE "Read / Write" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_BUS_UNDEFINED "Undefined" + IDS_BUS_INTERNAL "Internal" + IDS_BUS_ISA "ISA" + IDS_BUS_EISA "EISA" + IDS_BUS_MICROCHANNEL "MicroChannel" + IDS_BUS_TURBOCHANNEL "TurboChannel" + IDS_BUS_PCIBUS "PCI" + IDS_BUS_VMEBUS "VME" + IDS_BUS_NUBUS "NuBus" + IDS_BUS_PCMCIABUS "PCMCIA" + IDS_BUS_CBUS "C-Bus" + IDS_BUS_MPIBUS "MPI-Bus" + IDS_BUS_MPSABUS "MPSA-Bus" + IDS_BUS_PROCESSORINTERNAL "Processor Internal" + IDS_BUS_INTERNALPOWERBUS "Internal Power Bus" + IDS_BUS_PNPISABUS "PnP-ISA Bus" + IDS_BUS_PNPBUS "PnP Bus" + IDS_BUS_UNKNOWNTYPE "Unknown Interface Type" +END + /*****************************************************************/ diff --git a/base/applications/regedit/lang/id-ID.rc b/base/applications/regedit/lang/id-ID.rc index 4195cd20756..41718944c97 100644 --- a/base/applications/regedit/lang/id-ID.rc +++ b/base/applications/regedit/lang/id-ID.rc @@ -248,6 +248,53 @@ BEGIN PUSHBUTTON "Batal",IDCANCEL,196,82,50,14 END + +IDD_EDIT_RESOURCE_LIST DIALOGEX 32, 24, 170, 120 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | + WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Resource List" +FONT 8, "MS Shell Dlg" +{ + CONTROL "", IDC_RESOURCE_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 10, 150, 75 + DEFPUSHBUTTON "OK", IDOK, 27, 100, 50, 14 + PUSHBUTTON "Show...", IDC_SHOW_RESOURCE, 93, 100, 50, 14, WS_DISABLED +} + + +IDD_EDIT_RESOURCE DIALOGEX 6, 18, 281, 283 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | + WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Resources" +FONT 8, "MS Shell Dlg" +{ + LTEXT "DMA:", IDC_STATIC, 10, 5, 20, 8 + CONTROL "", IDC_DMA_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 15, 261, 31 + LTEXT "Interrupt:", IDC_STATIC, 10, 48, 35, 8 + CONTROL "", IDC_IRQ_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 58, 261, 31 + LTEXT "Memory:", IDC_STATIC, 10, 91, 32, 8 + CONTROL "", IDC_MEMORY_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 101, 261, 31 + LTEXT "Port:", IDC_STATIC, 10, 134, 38, 8 + CONTROL "", IDC_PORT_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 144, 261, 31 + LTEXT "Device specific data:", IDC_STATIC, 10, 177, 80, 8 + CONTROL "", IDC_DEVICE_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 188, 261, 31 + GROUPBOX "Usage", IDC_STATIC, 10, 219, 125, 39 + LTEXT "Undetermined", IDC_UNDETERMINED, 18, 230, 46, 8, WS_DISABLED + LTEXT "Shared", IDC_SHARED, 18, 240, 48, 8, WS_DISABLED + LTEXT "Device exclusive", IDC_DEVICE_EXCLUSIVE, 72, 230, 58, 8, WS_DISABLED + LTEXT "Driver exclusive", IDC_DRIVER_EXCLUSIVE, 72, 240, 54, 8, WS_DISABLED + RTEXT "Interface Type:", IDC_STATIC, 144, 220, 58, 8 + LTEXT "", IDC_INTERFACETYPE, 205, 220, 66, 8 + RTEXT "Bus Nummer:", IDC_STATIC, 151, 230, 51, 8 + LTEXT "", IDC_BUSNUMBER, 205, 230, 66, 8 + RTEXT "Version:", IDC_STATIC, 151, 240, 51, 8 + LTEXT "", IDC_VERSION, 205, 240, 66, 8 + RTEXT "Revision:", IDC_STATIC, 151, 250, 51, 8 + LTEXT "", IDC_REVISION, 205, 250, 66, 8 + DEFPUSHBUTTON "OK",IDOK, 92, 263, 40, 14 + PUSHBUTTON "&Data...", IDC_SHOW_RESOURCE_DATA, 148, 263, 40, 14, WS_DISABLED +} + + /* * String Table */ @@ -399,6 +446,60 @@ BEGIN IDS_IMPORTED_OK "Information added to the registry" END +STRINGTABLE DISCARDABLE +BEGIN + IDS_BUSNUMBER "Bus Number" + IDS_INTERFACE "Interface" + IDS_DMA_CHANNEL "Channel" + IDS_DMA_PORT "Port" + IDS_INTERRUPT_VECTOR "Vector" + IDS_INTERRUPT_LEVEL "Level" + IDS_INTERRUPT_AFFINITY "Affinity" + IDS_INTERRUPT_TYPE "Type" + IDS_MEMORY_ADDRESS "Physical Address" + IDS_MEMORY_LENGTH "Length" + IDS_MEMORY_ACCESS "Access" + IDS_PORT_ADDRESS "Physical Address" + IDS_PORT_LENGTH "Length" + IDS_PORT_ACCESS "Access" + IDS_SPECIFIC_RESERVED1 "Reserved 1" + IDS_SPECIFIC_RESERVED2 "Reserved 2" + IDS_SPECIFIC_DATASIZE "Data Size" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_PORT_PORT_IO "Port" + IDS_PORT_MEMORY_IO "Memory" + IDS_INTERRUPT_EDGE_SENSITIVE "Edge Sensitive" + IDS_INTERRUPT_LEVEL_SENSITIVE "Level Sensitive" + IDS_MEMORY_READ_ONLY "Read Only" + IDS_MEMORY_WRITE_ONLY "Write Only" + IDS_MEMORY_READ_WRITE "Read / Write" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_BUS_UNDEFINED "Undefined" + IDS_BUS_INTERNAL "Internal" + IDS_BUS_ISA "ISA" + IDS_BUS_EISA "EISA" + IDS_BUS_MICROCHANNEL "MicroChannel" + IDS_BUS_TURBOCHANNEL "TurboChannel" + IDS_BUS_PCIBUS "PCI" + IDS_BUS_VMEBUS "VME" + IDS_BUS_NUBUS "NuBus" + IDS_BUS_PCMCIABUS "PCMCIA" + IDS_BUS_CBUS "C-Bus" + IDS_BUS_MPIBUS "MPI-Bus" + IDS_BUS_MPSABUS "MPSA-Bus" + IDS_BUS_PROCESSORINTERNAL "Processor Internal" + IDS_BUS_INTERNALPOWERBUS "Internal Power Bus" + IDS_BUS_PNPISABUS "PnP-ISA Bus" + IDS_BUS_PNPBUS "PnP Bus" + IDS_BUS_UNKNOWNTYPE "Unknown Interface Type" +END + /*****************************************************************/ diff --git a/base/applications/regedit/lang/it-IT.rc b/base/applications/regedit/lang/it-IT.rc index 370a6d5e562..f6716a4f198 100644 --- a/base/applications/regedit/lang/it-IT.rc +++ b/base/applications/regedit/lang/it-IT.rc @@ -253,6 +253,53 @@ BEGIN PUSHBUTTON "Annulla",IDCANCEL,196,82,50,14 END + +IDD_EDIT_RESOURCE_LIST DIALOGEX 32, 24, 170, 120 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | + WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Resource List" +FONT 8, "MS Shell Dlg" +{ + CONTROL "", IDC_RESOURCE_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 10, 150, 75 + DEFPUSHBUTTON "OK", IDOK, 27, 100, 50, 14 + PUSHBUTTON "Show...", IDC_SHOW_RESOURCE, 93, 100, 50, 14, WS_DISABLED +} + + +IDD_EDIT_RESOURCE DIALOGEX 6, 18, 281, 283 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | + WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Resources" +FONT 8, "MS Shell Dlg" +{ + LTEXT "DMA:", IDC_STATIC, 10, 5, 20, 8 + CONTROL "", IDC_DMA_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 15, 261, 31 + LTEXT "Interrupt:", IDC_STATIC, 10, 48, 35, 8 + CONTROL "", IDC_IRQ_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 58, 261, 31 + LTEXT "Memory:", IDC_STATIC, 10, 91, 32, 8 + CONTROL "", IDC_MEMORY_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 101, 261, 31 + LTEXT "Port:", IDC_STATIC, 10, 134, 38, 8 + CONTROL "", IDC_PORT_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 144, 261, 31 + LTEXT "Device specific data:", IDC_STATIC, 10, 177, 80, 8 + CONTROL "", IDC_DEVICE_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 188, 261, 31 + GROUPBOX "Usage", IDC_STATIC, 10, 219, 125, 39 + LTEXT "Undetermined", IDC_UNDETERMINED, 18, 230, 46, 8, WS_DISABLED + LTEXT "Shared", IDC_SHARED, 18, 240, 48, 8, WS_DISABLED + LTEXT "Device exclusive", IDC_DEVICE_EXCLUSIVE, 72, 230, 58, 8, WS_DISABLED + LTEXT "Driver exclusive", IDC_DRIVER_EXCLUSIVE, 72, 240, 54, 8, WS_DISABLED + RTEXT "Interface Type:", IDC_STATIC, 144, 220, 58, 8 + LTEXT "", IDC_INTERFACETYPE, 205, 220, 66, 8 + RTEXT "Bus Nummer:", IDC_STATIC, 151, 230, 51, 8 + LTEXT "", IDC_BUSNUMBER, 205, 230, 66, 8 + RTEXT "Version:", IDC_STATIC, 151, 240, 51, 8 + LTEXT "", IDC_VERSION, 205, 240, 66, 8 + RTEXT "Revision:", IDC_STATIC, 151, 250, 51, 8 + LTEXT "", IDC_REVISION, 205, 250, 66, 8 + DEFPUSHBUTTON "OK",IDOK, 92, 263, 40, 14 + PUSHBUTTON "&Data...", IDC_SHOW_RESOURCE_DATA, 148, 263, 40, 14, WS_DISABLED +} + + /* * String Table */ @@ -404,6 +451,60 @@ BEGIN IDS_IMPORTED_OK "L'informazione stata aggiunta al registro" END +STRINGTABLE DISCARDABLE +BEGIN + IDS_BUSNUMBER "Bus Number" + IDS_INTERFACE "Interface" + IDS_DMA_CHANNEL "Channel" + IDS_DMA_PORT "Port" + IDS_INTERRUPT_VECTOR "Vector" + IDS_INTERRUPT_LEVEL "Level" + IDS_INTERRUPT_AFFINITY "Affinity" + IDS_INTERRUPT_TYPE "Type" + IDS_MEMORY_ADDRESS "Physical Address" + IDS_MEMORY_LENGTH "Length" + IDS_MEMORY_ACCESS "Access" + IDS_PORT_ADDRESS "Physical Address" + IDS_PORT_LENGTH "Length" + IDS_PORT_ACCESS "Access" + IDS_SPECIFIC_RESERVED1 "Reserved 1" + IDS_SPECIFIC_RESERVED2 "Reserved 2" + IDS_SPECIFIC_DATASIZE "Data Size" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_PORT_PORT_IO "Port" + IDS_PORT_MEMORY_IO "Memory" + IDS_INTERRUPT_EDGE_SENSITIVE "Edge Sensitive" + IDS_INTERRUPT_LEVEL_SENSITIVE "Level Sensitive" + IDS_MEMORY_READ_ONLY "Read Only" + IDS_MEMORY_WRITE_ONLY "Write Only" + IDS_MEMORY_READ_WRITE "Read / Write" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_BUS_UNDEFINED "Undefined" + IDS_BUS_INTERNAL "Internal" + IDS_BUS_ISA "ISA" + IDS_BUS_EISA "EISA" + IDS_BUS_MICROCHANNEL "MicroChannel" + IDS_BUS_TURBOCHANNEL "TurboChannel" + IDS_BUS_PCIBUS "PCI" + IDS_BUS_VMEBUS "VME" + IDS_BUS_NUBUS "NuBus" + IDS_BUS_PCMCIABUS "PCMCIA" + IDS_BUS_CBUS "C-Bus" + IDS_BUS_MPIBUS "MPI-Bus" + IDS_BUS_MPSABUS "MPSA-Bus" + IDS_BUS_PROCESSORINTERNAL "Processor Internal" + IDS_BUS_INTERNALPOWERBUS "Internal Power Bus" + IDS_BUS_PNPISABUS "PnP-ISA Bus" + IDS_BUS_PNPBUS "PnP Bus" + IDS_BUS_UNKNOWNTYPE "Unknown Interface Type" +END + /*****************************************************************/ diff --git a/base/applications/regedit/lang/ja-JP.rc b/base/applications/regedit/lang/ja-JP.rc index 62eb80fb2b4..bf5da338bbf 100644 --- a/base/applications/regedit/lang/ja-JP.rc +++ b/base/applications/regedit/lang/ja-JP.rc @@ -246,6 +246,53 @@ BEGIN PUSHBUTTON "LZ",IDCANCEL,196,82,50,14 END + +IDD_EDIT_RESOURCE_LIST DIALOGEX 32, 24, 170, 120 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | + WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Resource List" +FONT 8, "MS Shell Dlg" +{ + CONTROL "", IDC_RESOURCE_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 10, 150, 75 + DEFPUSHBUTTON "OK", IDOK, 27, 100, 50, 14 + PUSHBUTTON "Show...", IDC_SHOW_RESOURCE, 93, 100, 50, 14, WS_DISABLED +} + + +IDD_EDIT_RESOURCE DIALOGEX 6, 18, 281, 283 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | + WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Resources" +FONT 8, "MS Shell Dlg" +{ + LTEXT "DMA:", IDC_STATIC, 10, 5, 20, 8 + CONTROL "", IDC_DMA_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 15, 261, 31 + LTEXT "Interrupt:", IDC_STATIC, 10, 48, 35, 8 + CONTROL "", IDC_IRQ_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 58, 261, 31 + LTEXT "Memory:", IDC_STATIC, 10, 91, 32, 8 + CONTROL "", IDC_MEMORY_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 101, 261, 31 + LTEXT "Port:", IDC_STATIC, 10, 134, 38, 8 + CONTROL "", IDC_PORT_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 144, 261, 31 + LTEXT "Device specific data:", IDC_STATIC, 10, 177, 80, 8 + CONTROL "", IDC_DEVICE_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 188, 261, 31 + GROUPBOX "Usage", IDC_STATIC, 10, 219, 125, 39 + LTEXT "Undetermined", IDC_UNDETERMINED, 18, 230, 46, 8, WS_DISABLED + LTEXT "Shared", IDC_SHARED, 18, 240, 48, 8, WS_DISABLED + LTEXT "Device exclusive", IDC_DEVICE_EXCLUSIVE, 72, 230, 58, 8, WS_DISABLED + LTEXT "Driver exclusive", IDC_DRIVER_EXCLUSIVE, 72, 240, 54, 8, WS_DISABLED + RTEXT "Interface Type:", IDC_STATIC, 144, 220, 58, 8 + LTEXT "", IDC_INTERFACETYPE, 205, 220, 66, 8 + RTEXT "Bus Nummer:", IDC_STATIC, 151, 230, 51, 8 + LTEXT "", IDC_BUSNUMBER, 205, 230, 66, 8 + RTEXT "Version:", IDC_STATIC, 151, 240, 51, 8 + LTEXT "", IDC_VERSION, 205, 240, 66, 8 + RTEXT "Revision:", IDC_STATIC, 151, 250, 51, 8 + LTEXT "", IDC_REVISION, 205, 250, 66, 8 + DEFPUSHBUTTON "OK",IDOK, 92, 263, 40, 14 + PUSHBUTTON "&Data...", IDC_SHOW_RESOURCE_DATA, 148, 263, 40, 14, WS_DISABLED +} + + /* * String Table */ @@ -397,6 +444,60 @@ BEGIN IDS_IMPORTED_OK "Information added to the registry" END +STRINGTABLE DISCARDABLE +BEGIN + IDS_BUSNUMBER "Bus Number" + IDS_INTERFACE "Interface" + IDS_DMA_CHANNEL "Channel" + IDS_DMA_PORT "Port" + IDS_INTERRUPT_VECTOR "Vector" + IDS_INTERRUPT_LEVEL "Level" + IDS_INTERRUPT_AFFINITY "Affinity" + IDS_INTERRUPT_TYPE "Type" + IDS_MEMORY_ADDRESS "Physical Address" + IDS_MEMORY_LENGTH "Length" + IDS_MEMORY_ACCESS "Access" + IDS_PORT_ADDRESS "Physical Address" + IDS_PORT_LENGTH "Length" + IDS_PORT_ACCESS "Access" + IDS_SPECIFIC_RESERVED1 "Reserved 1" + IDS_SPECIFIC_RESERVED2 "Reserved 2" + IDS_SPECIFIC_DATASIZE "Data Size" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_PORT_PORT_IO "Port" + IDS_PORT_MEMORY_IO "Memory" + IDS_INTERRUPT_EDGE_SENSITIVE "Edge Sensitive" + IDS_INTERRUPT_LEVEL_SENSITIVE "Level Sensitive" + IDS_MEMORY_READ_ONLY "Read Only" + IDS_MEMORY_WRITE_ONLY "Write Only" + IDS_MEMORY_READ_WRITE "Read / Write" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_BUS_UNDEFINED "Undefined" + IDS_BUS_INTERNAL "Internal" + IDS_BUS_ISA "ISA" + IDS_BUS_EISA "EISA" + IDS_BUS_MICROCHANNEL "MicroChannel" + IDS_BUS_TURBOCHANNEL "TurboChannel" + IDS_BUS_PCIBUS "PCI" + IDS_BUS_VMEBUS "VME" + IDS_BUS_NUBUS "NuBus" + IDS_BUS_PCMCIABUS "PCMCIA" + IDS_BUS_CBUS "C-Bus" + IDS_BUS_MPIBUS "MPI-Bus" + IDS_BUS_MPSABUS "MPSA-Bus" + IDS_BUS_PROCESSORINTERNAL "Processor Internal" + IDS_BUS_INTERNALPOWERBUS "Internal Power Bus" + IDS_BUS_PNPISABUS "PnP-ISA Bus" + IDS_BUS_PNPBUS "PnP Bus" + IDS_BUS_UNKNOWNTYPE "Unknown Interface Type" +END + /*****************************************************************/ diff --git a/base/applications/regedit/lang/ko-KR.rc b/base/applications/regedit/lang/ko-KR.rc index 783b12bef14..8d269fe215b 100644 --- a/base/applications/regedit/lang/ko-KR.rc +++ b/base/applications/regedit/lang/ko-KR.rc @@ -233,6 +233,53 @@ BEGIN PUSHBUTTON "",IDCANCEL,196,82,50,14 END + +IDD_EDIT_RESOURCE_LIST DIALOGEX 32, 24, 170, 120 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | + WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Resource List" +FONT 8, "MS Shell Dlg" +{ + CONTROL "", IDC_RESOURCE_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 10, 150, 75 + DEFPUSHBUTTON "OK", IDOK, 27, 100, 50, 14 + PUSHBUTTON "Show...", IDC_SHOW_RESOURCE, 93, 100, 50, 14, WS_DISABLED +} + + +IDD_EDIT_RESOURCE DIALOGEX 6, 18, 281, 283 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | + WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Resources" +FONT 8, "MS Shell Dlg" +{ + LTEXT "DMA:", IDC_STATIC, 10, 5, 20, 8 + CONTROL "", IDC_DMA_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 15, 261, 31 + LTEXT "Interrupt:", IDC_STATIC, 10, 48, 35, 8 + CONTROL "", IDC_IRQ_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 58, 261, 31 + LTEXT "Memory:", IDC_STATIC, 10, 91, 32, 8 + CONTROL "", IDC_MEMORY_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 101, 261, 31 + LTEXT "Port:", IDC_STATIC, 10, 134, 38, 8 + CONTROL "", IDC_PORT_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 144, 261, 31 + LTEXT "Device specific data:", IDC_STATIC, 10, 177, 80, 8 + CONTROL "", IDC_DEVICE_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 188, 261, 31 + GROUPBOX "Usage", IDC_STATIC, 10, 219, 125, 39 + LTEXT "Undetermined", IDC_UNDETERMINED, 18, 230, 46, 8, WS_DISABLED + LTEXT "Shared", IDC_SHARED, 18, 240, 48, 8, WS_DISABLED + LTEXT "Device exclusive", IDC_DEVICE_EXCLUSIVE, 72, 230, 58, 8, WS_DISABLED + LTEXT "Driver exclusive", IDC_DRIVER_EXCLUSIVE, 72, 240, 54, 8, WS_DISABLED + RTEXT "Interface Type:", IDC_STATIC, 144, 220, 58, 8 + LTEXT "", IDC_INTERFACETYPE, 205, 220, 66, 8 + RTEXT "Bus Nummer:", IDC_STATIC, 151, 230, 51, 8 + LTEXT "", IDC_BUSNUMBER, 205, 230, 66, 8 + RTEXT "Version:", IDC_STATIC, 151, 240, 51, 8 + LTEXT "", IDC_VERSION, 205, 240, 66, 8 + RTEXT "Revision:", IDC_STATIC, 151, 250, 51, 8 + LTEXT "", IDC_REVISION, 205, 250, 66, 8 + DEFPUSHBUTTON "OK",IDOK, 92, 263, 40, 14 + PUSHBUTTON "&Data...", IDC_SHOW_RESOURCE_DATA, 148, 263, 40, 14, WS_DISABLED +} + + /* * String Table */ @@ -384,6 +431,60 @@ BEGIN IDS_IMPORTED_OK "Information added to the registry" END +STRINGTABLE DISCARDABLE +BEGIN + IDS_BUSNUMBER "Bus Number" + IDS_INTERFACE "Interface" + IDS_DMA_CHANNEL "Channel" + IDS_DMA_PORT "Port" + IDS_INTERRUPT_VECTOR "Vector" + IDS_INTERRUPT_LEVEL "Level" + IDS_INTERRUPT_AFFINITY "Affinity" + IDS_INTERRUPT_TYPE "Type" + IDS_MEMORY_ADDRESS "Physical Address" + IDS_MEMORY_LENGTH "Length" + IDS_MEMORY_ACCESS "Access" + IDS_PORT_ADDRESS "Physical Address" + IDS_PORT_LENGTH "Length" + IDS_PORT_ACCESS "Access" + IDS_SPECIFIC_RESERVED1 "Reserved 1" + IDS_SPECIFIC_RESERVED2 "Reserved 2" + IDS_SPECIFIC_DATASIZE "Data Size" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_PORT_PORT_IO "Port" + IDS_PORT_MEMORY_IO "Memory" + IDS_INTERRUPT_EDGE_SENSITIVE "Edge Sensitive" + IDS_INTERRUPT_LEVEL_SENSITIVE "Level Sensitive" + IDS_MEMORY_READ_ONLY "Read Only" + IDS_MEMORY_WRITE_ONLY "Write Only" + IDS_MEMORY_READ_WRITE "Read / Write" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_BUS_UNDEFINED "Undefined" + IDS_BUS_INTERNAL "Internal" + IDS_BUS_ISA "ISA" + IDS_BUS_EISA "EISA" + IDS_BUS_MICROCHANNEL "MicroChannel" + IDS_BUS_TURBOCHANNEL "TurboChannel" + IDS_BUS_PCIBUS "PCI" + IDS_BUS_VMEBUS "VME" + IDS_BUS_NUBUS "NuBus" + IDS_BUS_PCMCIABUS "PCMCIA" + IDS_BUS_CBUS "C-Bus" + IDS_BUS_MPIBUS "MPI-Bus" + IDS_BUS_MPSABUS "MPSA-Bus" + IDS_BUS_PROCESSORINTERNAL "Processor Internal" + IDS_BUS_INTERNALPOWERBUS "Internal Power Bus" + IDS_BUS_PNPISABUS "PnP-ISA Bus" + IDS_BUS_PNPBUS "PnP Bus" + IDS_BUS_UNKNOWNTYPE "Unknown Interface Type" +END + /*****************************************************************/ diff --git a/base/applications/regedit/lang/nl-NL.rc b/base/applications/regedit/lang/nl-NL.rc index 24e77cf8708..3312cb9b953 100644 --- a/base/applications/regedit/lang/nl-NL.rc +++ b/base/applications/regedit/lang/nl-NL.rc @@ -248,6 +248,53 @@ BEGIN PUSHBUTTON "Cancel",IDCANCEL,196,82,50,14 END + +IDD_EDIT_RESOURCE_LIST DIALOGEX 32, 24, 170, 120 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | + WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Resource List" +FONT 8, "MS Shell Dlg" +{ + CONTROL "", IDC_RESOURCE_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 10, 150, 75 + DEFPUSHBUTTON "OK", IDOK, 27, 100, 50, 14 + PUSHBUTTON "Show...", IDC_SHOW_RESOURCE, 93, 100, 50, 14, WS_DISABLED +} + + +IDD_EDIT_RESOURCE DIALOGEX 6, 18, 281, 283 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | + WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Resources" +FONT 8, "MS Shell Dlg" +{ + LTEXT "DMA:", IDC_STATIC, 10, 5, 20, 8 + CONTROL "", IDC_DMA_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 15, 261, 31 + LTEXT "Interrupt:", IDC_STATIC, 10, 48, 35, 8 + CONTROL "", IDC_IRQ_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 58, 261, 31 + LTEXT "Memory:", IDC_STATIC, 10, 91, 32, 8 + CONTROL "", IDC_MEMORY_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 101, 261, 31 + LTEXT "Port:", IDC_STATIC, 10, 134, 38, 8 + CONTROL "", IDC_PORT_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 144, 261, 31 + LTEXT "Device specific data:", IDC_STATIC, 10, 177, 80, 8 + CONTROL "", IDC_DEVICE_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 188, 261, 31 + GROUPBOX "Usage", IDC_STATIC, 10, 219, 125, 39 + LTEXT "Undetermined", IDC_UNDETERMINED, 18, 230, 46, 8, WS_DISABLED + LTEXT "Shared", IDC_SHARED, 18, 240, 48, 8, WS_DISABLED + LTEXT "Device exclusive", IDC_DEVICE_EXCLUSIVE, 72, 230, 58, 8, WS_DISABLED + LTEXT "Driver exclusive", IDC_DRIVER_EXCLUSIVE, 72, 240, 54, 8, WS_DISABLED + RTEXT "Interface Type:", IDC_STATIC, 144, 220, 58, 8 + LTEXT "", IDC_INTERFACETYPE, 205, 220, 66, 8 + RTEXT "Bus Nummer:", IDC_STATIC, 151, 230, 51, 8 + LTEXT "", IDC_BUSNUMBER, 205, 230, 66, 8 + RTEXT "Version:", IDC_STATIC, 151, 240, 51, 8 + LTEXT "", IDC_VERSION, 205, 240, 66, 8 + RTEXT "Revision:", IDC_STATIC, 151, 250, 51, 8 + LTEXT "", IDC_REVISION, 205, 250, 66, 8 + DEFPUSHBUTTON "OK",IDOK, 92, 263, 40, 14 + PUSHBUTTON "&Data...", IDC_SHOW_RESOURCE_DATA, 148, 263, 40, 14, WS_DISABLED +} + + /* * String Table */ @@ -398,7 +445,61 @@ BEGIN IDS_IMPORT_PROMPT "Add the data to the registry?" IDS_IMPORTED_OK "Information added to the registry" END - + +STRINGTABLE DISCARDABLE +BEGIN + IDS_BUSNUMBER "Bus Number" + IDS_INTERFACE "Interface" + IDS_DMA_CHANNEL "Channel" + IDS_DMA_PORT "Port" + IDS_INTERRUPT_VECTOR "Vector" + IDS_INTERRUPT_LEVEL "Level" + IDS_INTERRUPT_AFFINITY "Affinity" + IDS_INTERRUPT_TYPE "Type" + IDS_MEMORY_ADDRESS "Physical Address" + IDS_MEMORY_LENGTH "Length" + IDS_MEMORY_ACCESS "Access" + IDS_PORT_ADDRESS "Physical Address" + IDS_PORT_LENGTH "Length" + IDS_PORT_ACCESS "Access" + IDS_SPECIFIC_RESERVED1 "Reserved 1" + IDS_SPECIFIC_RESERVED2 "Reserved 2" + IDS_SPECIFIC_DATASIZE "Data Size" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_PORT_PORT_IO "Port" + IDS_PORT_MEMORY_IO "Memory" + IDS_INTERRUPT_EDGE_SENSITIVE "Edge Sensitive" + IDS_INTERRUPT_LEVEL_SENSITIVE "Level Sensitive" + IDS_MEMORY_READ_ONLY "Read Only" + IDS_MEMORY_WRITE_ONLY "Write Only" + IDS_MEMORY_READ_WRITE "Read / Write" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_BUS_UNDEFINED "Undefined" + IDS_BUS_INTERNAL "Internal" + IDS_BUS_ISA "ISA" + IDS_BUS_EISA "EISA" + IDS_BUS_MICROCHANNEL "MicroChannel" + IDS_BUS_TURBOCHANNEL "TurboChannel" + IDS_BUS_PCIBUS "PCI" + IDS_BUS_VMEBUS "VME" + IDS_BUS_NUBUS "NuBus" + IDS_BUS_PCMCIABUS "PCMCIA" + IDS_BUS_CBUS "C-Bus" + IDS_BUS_MPIBUS "MPI-Bus" + IDS_BUS_MPSABUS "MPSA-Bus" + IDS_BUS_PROCESSORINTERNAL "Processor Internal" + IDS_BUS_INTERNALPOWERBUS "Internal Power Bus" + IDS_BUS_PNPISABUS "PnP-ISA Bus" + IDS_BUS_PNPBUS "PnP Bus" + IDS_BUS_UNKNOWNTYPE "Unknown Interface Type" +END + /*****************************************************************/ diff --git a/base/applications/regedit/lang/no-NO.rc b/base/applications/regedit/lang/no-NO.rc index 166dea05c25..b93544c204f 100644 --- a/base/applications/regedit/lang/no-NO.rc +++ b/base/applications/regedit/lang/no-NO.rc @@ -248,6 +248,53 @@ BEGIN PUSHBUTTON "Avbryt",IDCANCEL,196,82,50,14 END + +IDD_EDIT_RESOURCE_LIST DIALOGEX 32, 24, 170, 120 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | + WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Resource List" +FONT 8, "MS Shell Dlg" +{ + CONTROL "", IDC_RESOURCE_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 10, 150, 75 + DEFPUSHBUTTON "OK", IDOK, 27, 100, 50, 14 + PUSHBUTTON "Show...", IDC_SHOW_RESOURCE, 93, 100, 50, 14, WS_DISABLED +} + + +IDD_EDIT_RESOURCE DIALOGEX 6, 18, 281, 283 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | + WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Resources" +FONT 8, "MS Shell Dlg" +{ + LTEXT "DMA:", IDC_STATIC, 10, 5, 20, 8 + CONTROL "", IDC_DMA_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 15, 261, 31 + LTEXT "Interrupt:", IDC_STATIC, 10, 48, 35, 8 + CONTROL "", IDC_IRQ_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 58, 261, 31 + LTEXT "Memory:", IDC_STATIC, 10, 91, 32, 8 + CONTROL "", IDC_MEMORY_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 101, 261, 31 + LTEXT "Port:", IDC_STATIC, 10, 134, 38, 8 + CONTROL "", IDC_PORT_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 144, 261, 31 + LTEXT "Device specific data:", IDC_STATIC, 10, 177, 80, 8 + CONTROL "", IDC_DEVICE_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 188, 261, 31 + GROUPBOX "Usage", IDC_STATIC, 10, 219, 125, 39 + LTEXT "Undetermined", IDC_UNDETERMINED, 18, 230, 46, 8, WS_DISABLED + LTEXT "Shared", IDC_SHARED, 18, 240, 48, 8, WS_DISABLED + LTEXT "Device exclusive", IDC_DEVICE_EXCLUSIVE, 72, 230, 58, 8, WS_DISABLED + LTEXT "Driver exclusive", IDC_DRIVER_EXCLUSIVE, 72, 240, 54, 8, WS_DISABLED + RTEXT "Interface Type:", IDC_STATIC, 144, 220, 58, 8 + LTEXT "", IDC_INTERFACETYPE, 205, 220, 66, 8 + RTEXT "Bus Nummer:", IDC_STATIC, 151, 230, 51, 8 + LTEXT "", IDC_BUSNUMBER, 205, 230, 66, 8 + RTEXT "Version:", IDC_STATIC, 151, 240, 51, 8 + LTEXT "", IDC_VERSION, 205, 240, 66, 8 + RTEXT "Revision:", IDC_STATIC, 151, 250, 51, 8 + LTEXT "", IDC_REVISION, 205, 250, 66, 8 + DEFPUSHBUTTON "OK",IDOK, 92, 263, 40, 14 + PUSHBUTTON "&Data...", IDC_SHOW_RESOURCE_DATA, 148, 263, 40, 14, WS_DISABLED +} + + /* * String Table */ @@ -399,6 +446,60 @@ BEGIN IDS_IMPORTED_OK "Information added to the registry" END +STRINGTABLE DISCARDABLE +BEGIN + IDS_BUSNUMBER "Bus Number" + IDS_INTERFACE "Interface" + IDS_DMA_CHANNEL "Channel" + IDS_DMA_PORT "Port" + IDS_INTERRUPT_VECTOR "Vector" + IDS_INTERRUPT_LEVEL "Level" + IDS_INTERRUPT_AFFINITY "Affinity" + IDS_INTERRUPT_TYPE "Type" + IDS_MEMORY_ADDRESS "Physical Address" + IDS_MEMORY_LENGTH "Length" + IDS_MEMORY_ACCESS "Access" + IDS_PORT_ADDRESS "Physical Address" + IDS_PORT_LENGTH "Length" + IDS_PORT_ACCESS "Access" + IDS_SPECIFIC_RESERVED1 "Reserved 1" + IDS_SPECIFIC_RESERVED2 "Reserved 2" + IDS_SPECIFIC_DATASIZE "Data Size" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_PORT_PORT_IO "Port" + IDS_PORT_MEMORY_IO "Memory" + IDS_INTERRUPT_EDGE_SENSITIVE "Edge Sensitive" + IDS_INTERRUPT_LEVEL_SENSITIVE "Level Sensitive" + IDS_MEMORY_READ_ONLY "Read Only" + IDS_MEMORY_WRITE_ONLY "Write Only" + IDS_MEMORY_READ_WRITE "Read / Write" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_BUS_UNDEFINED "Undefined" + IDS_BUS_INTERNAL "Internal" + IDS_BUS_ISA "ISA" + IDS_BUS_EISA "EISA" + IDS_BUS_MICROCHANNEL "MicroChannel" + IDS_BUS_TURBOCHANNEL "TurboChannel" + IDS_BUS_PCIBUS "PCI" + IDS_BUS_VMEBUS "VME" + IDS_BUS_NUBUS "NuBus" + IDS_BUS_PCMCIABUS "PCMCIA" + IDS_BUS_CBUS "C-Bus" + IDS_BUS_MPIBUS "MPI-Bus" + IDS_BUS_MPSABUS "MPSA-Bus" + IDS_BUS_PROCESSORINTERNAL "Processor Internal" + IDS_BUS_INTERNALPOWERBUS "Internal Power Bus" + IDS_BUS_PNPISABUS "PnP-ISA Bus" + IDS_BUS_PNPBUS "PnP Bus" + IDS_BUS_UNKNOWNTYPE "Unknown Interface Type" +END + /*****************************************************************/ diff --git a/base/applications/regedit/lang/pl-PL.rc b/base/applications/regedit/lang/pl-PL.rc index d0f6117bff9..5bbf8af0dc3 100644 --- a/base/applications/regedit/lang/pl-PL.rc +++ b/base/applications/regedit/lang/pl-PL.rc @@ -20,8 +20,9 @@ * Use ReactOS forum PM or IRC to contact me * http://www.reactos.org * IRC: irc.freenode.net #reactos-pl; - * updated by Saibamen - Adam Stachowicz (saibamenppl@gmail.com) (Apr, 2011) + * updated by Saibamen - Adam Stachowicz (saibamenppl@gmail.com) (August, 2011) * UTF-8 conversion by Caemyr (May, 2011) + * Update by wojo664 (04.08.2011) */ LANGUAGE LANG_POLISH, SUBLANG_DEFAULT @@ -254,6 +255,53 @@ BEGIN PUSHBUTTON "Anuluj",IDCANCEL,196,82,50,14 END + +IDD_EDIT_RESOURCE_LIST DIALOGEX 32, 24, 170, 120 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | + WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Lista zasobów" +FONT 8, "MS Shell Dlg" +{ + CONTROL "", IDC_RESOURCE_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 10, 150, 75 + DEFPUSHBUTTON "OK", IDOK, 27, 100, 50, 14 + PUSHBUTTON "Pokaż...", IDC_SHOW_RESOURCE, 93, 100, 50, 14, WS_DISABLED +} + + +IDD_EDIT_RESOURCE DIALOGEX 6, 18, 281, 283 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | + WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Zasoby" +FONT 8, "MS Shell Dlg" +{ + LTEXT "DMA:", IDC_STATIC, 10, 5, 20, 8 + CONTROL "", IDC_DMA_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 15, 261, 31 + LTEXT "Przerwanie:", IDC_STATIC, 10, 48, 35, 8 + CONTROL "", IDC_IRQ_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 58, 261, 31 + LTEXT "Pamięć:", IDC_STATIC, 10, 91, 32, 8 + CONTROL "", IDC_MEMORY_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 101, 261, 31 + LTEXT "Port:", IDC_STATIC, 10, 134, 38, 8 + CONTROL "", IDC_PORT_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 144, 261, 31 + LTEXT "Dane specyficzne dla sprzętu:", IDC_STATIC, 10, 177, 105, 8 + CONTROL "", IDC_DEVICE_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 188, 261, 31 + GROUPBOX "Użycie", IDC_STATIC, 10, 219, 125, 39 + LTEXT "Nieokreślone", IDC_UNDETERMINED, 18, 230, 46, 8, WS_DISABLED + LTEXT "Dzielone", IDC_SHARED, 18, 240, 48, 8, WS_DISABLED + LTEXT "Device Exclusive", IDC_DEVICE_EXCLUSIVE, 72, 230, 58, 8, WS_DISABLED + LTEXT "Driver Exclusive", IDC_DRIVER_EXCLUSIVE, 72, 240, 54, 8, WS_DISABLED + RTEXT "Typ interfejsu:", IDC_STATIC, 144, 220, 58, 8 + LTEXT "", IDC_INTERFACETYPE, 205, 220, 66, 8 + RTEXT "Numer szyny:", IDC_STATIC, 151, 230, 51, 8 + LTEXT "", IDC_BUSNUMBER, 205, 230, 66, 8 + RTEXT "Wersja:", IDC_STATIC, 151, 240, 51, 8 + LTEXT "", IDC_VERSION, 205, 240, 66, 8 + RTEXT "Wydanie:", IDC_STATIC, 151, 250, 51, 8 + LTEXT "", IDC_REVISION, 205, 250, 66, 8 + DEFPUSHBUTTON "OK",IDOK, 92, 263, 40, 14 + PUSHBUTTON "&Dane...", IDC_SHOW_RESOURCE_DATA, 148, 263, 40, 14, WS_DISABLED +} + + /* * String Table */ @@ -405,6 +453,60 @@ BEGIN IDS_IMPORTED_OK "Dane dopisane do rejestru" END +STRINGTABLE DISCARDABLE +BEGIN + IDS_BUSNUMBER "Numer Szyny" + IDS_INTERFACE "Interfejs" + IDS_DMA_CHANNEL "Kanał" + IDS_DMA_PORT "Port" + IDS_INTERRUPT_VECTOR "Wektor" + IDS_INTERRUPT_LEVEL "Poziom" + IDS_INTERRUPT_AFFINITY "Przynależność" + IDS_INTERRUPT_TYPE "Typ" + IDS_MEMORY_ADDRESS "Adres fizyczny" + IDS_MEMORY_LENGTH "Długość" + IDS_MEMORY_ACCESS "Dostęp" + IDS_PORT_ADDRESS "Adres fizyczny" + IDS_PORT_LENGTH "Długość" + IDS_PORT_ACCESS "Dostęp" + IDS_SPECIFIC_RESERVED1 "Zarezerwowane 1" + IDS_SPECIFIC_RESERVED2 "Zarezerwowane 2" + IDS_SPECIFIC_DATASIZE "Rozmiar danych" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_PORT_PORT_IO "Port" + IDS_PORT_MEMORY_IO "Pamięć" + IDS_INTERRUPT_EDGE_SENSITIVE "Edge Sensitive" + IDS_INTERRUPT_LEVEL_SENSITIVE "Level Sensitive" + IDS_MEMORY_READ_ONLY "Tylko Odczyt" + IDS_MEMORY_WRITE_ONLY "Tylko Zapis" + IDS_MEMORY_READ_WRITE "Odczyt / Zapis" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_BUS_UNDEFINED "Niezdefiniowane" + IDS_BUS_INTERNAL "Wewnętrzne" + IDS_BUS_ISA "ISA" + IDS_BUS_EISA "EISA" + IDS_BUS_MICROCHANNEL "MicroChannel" + IDS_BUS_TURBOCHANNEL "TurboChannel" + IDS_BUS_PCIBUS "PCI" + IDS_BUS_VMEBUS "VME" + IDS_BUS_NUBUS "NuBus" + IDS_BUS_PCMCIABUS "PCMCIA" + IDS_BUS_CBUS "C-Bus" + IDS_BUS_MPIBUS "MPI-Bus" + IDS_BUS_MPSABUS "MPSA-Bus" + IDS_BUS_PROCESSORINTERNAL "Procesora" + IDS_BUS_INTERNALPOWERBUS "Wewnętrzna szyna zasilania" + IDS_BUS_PNPISABUS "PnP-ISA Bus" + IDS_BUS_PNPBUS "PnP Bus" + IDS_BUS_UNKNOWNTYPE "Nieznany typ interfejsu" +END + /*****************************************************************/ @@ -418,7 +520,7 @@ STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | FONT 8, "MS Shell Dlg" BEGIN GROUPBOX "Zakres eksportu",IDC_STATIC,2,0,366,48 - CONTROL "&Wszystko",IDC_EXPORT_ALL,"Button",BS_AUTORADIOBUTTON,10,10, 29,11 + CONTROL "&Wszystko",IDC_EXPORT_ALL,"Button",BS_AUTORADIOBUTTON,10,10,47,11 CONTROL "Wy&brana gałąź",IDC_EXPORT_BRANCH,"Button",BS_AUTORADIOBUTTON,10,22, 100,11 EDITTEXT IDC_EXPORT_BRANCH_TEXT,30,34,335,12 END @@ -459,7 +561,7 @@ BEGIN CONTROL "&Klucze",IDC_LOOKAT_KEYS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,36,35,8 CONTROL "&Wartości",IDC_LOOKAT_VALUES,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,14,48,36,8 + WS_TABSTOP,14,48,45,8 CONTROL "&Dane",IDC_LOOKAT_DATA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,60,42,8 CONTROL " &tylko całe ciągi",IDC_MATCHSTRING,"Button", diff --git a/base/applications/regedit/lang/pt-BR.rc b/base/applications/regedit/lang/pt-BR.rc index a7b6acbf75d..29e8b290cd6 100644 --- a/base/applications/regedit/lang/pt-BR.rc +++ b/base/applications/regedit/lang/pt-BR.rc @@ -249,6 +249,53 @@ BEGIN PUSHBUTTON "Cancelar",IDCANCEL,196,82,50,14 END + +IDD_EDIT_RESOURCE_LIST DIALOGEX 32, 24, 170, 120 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | + WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Resource List" +FONT 8, "MS Shell Dlg" +{ + CONTROL "", IDC_RESOURCE_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 10, 150, 75 + DEFPUSHBUTTON "OK", IDOK, 27, 100, 50, 14 + PUSHBUTTON "Show...", IDC_SHOW_RESOURCE, 93, 100, 50, 14, WS_DISABLED +} + + +IDD_EDIT_RESOURCE DIALOGEX 6, 18, 281, 283 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | + WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Resources" +FONT 8, "MS Shell Dlg" +{ + LTEXT "DMA:", IDC_STATIC, 10, 5, 20, 8 + CONTROL "", IDC_DMA_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 15, 261, 31 + LTEXT "Interrupt:", IDC_STATIC, 10, 48, 35, 8 + CONTROL "", IDC_IRQ_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 58, 261, 31 + LTEXT "Memory:", IDC_STATIC, 10, 91, 32, 8 + CONTROL "", IDC_MEMORY_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 101, 261, 31 + LTEXT "Port:", IDC_STATIC, 10, 134, 38, 8 + CONTROL "", IDC_PORT_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 144, 261, 31 + LTEXT "Device specific data:", IDC_STATIC, 10, 177, 80, 8 + CONTROL "", IDC_DEVICE_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 188, 261, 31 + GROUPBOX "Usage", IDC_STATIC, 10, 219, 125, 39 + LTEXT "Undetermined", IDC_UNDETERMINED, 18, 230, 46, 8, WS_DISABLED + LTEXT "Shared", IDC_SHARED, 18, 240, 48, 8, WS_DISABLED + LTEXT "Device exclusive", IDC_DEVICE_EXCLUSIVE, 72, 230, 58, 8, WS_DISABLED + LTEXT "Driver exclusive", IDC_DRIVER_EXCLUSIVE, 72, 240, 54, 8, WS_DISABLED + RTEXT "Interface Type:", IDC_STATIC, 144, 220, 58, 8 + LTEXT "", IDC_INTERFACETYPE, 205, 220, 66, 8 + RTEXT "Bus Nummer:", IDC_STATIC, 151, 230, 51, 8 + LTEXT "", IDC_BUSNUMBER, 205, 230, 66, 8 + RTEXT "Version:", IDC_STATIC, 151, 240, 51, 8 + LTEXT "", IDC_VERSION, 205, 240, 66, 8 + RTEXT "Revision:", IDC_STATIC, 151, 250, 51, 8 + LTEXT "", IDC_REVISION, 205, 250, 66, 8 + DEFPUSHBUTTON "OK",IDOK, 92, 263, 40, 14 + PUSHBUTTON "&Data...", IDC_SHOW_RESOURCE_DATA, 148, 263, 40, 14, WS_DISABLED +} + + /* * String Table */ @@ -400,6 +447,60 @@ BEGIN IDS_IMPORTED_OK "Information added to the registry" END +STRINGTABLE DISCARDABLE +BEGIN + IDS_BUSNUMBER "Bus Number" + IDS_INTERFACE "Interface" + IDS_DMA_CHANNEL "Channel" + IDS_DMA_PORT "Port" + IDS_INTERRUPT_VECTOR "Vector" + IDS_INTERRUPT_LEVEL "Level" + IDS_INTERRUPT_AFFINITY "Affinity" + IDS_INTERRUPT_TYPE "Type" + IDS_MEMORY_ADDRESS "Physical Address" + IDS_MEMORY_LENGTH "Length" + IDS_MEMORY_ACCESS "Access" + IDS_PORT_ADDRESS "Physical Address" + IDS_PORT_LENGTH "Length" + IDS_PORT_ACCESS "Access" + IDS_SPECIFIC_RESERVED1 "Reserved 1" + IDS_SPECIFIC_RESERVED2 "Reserved 2" + IDS_SPECIFIC_DATASIZE "Data Size" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_PORT_PORT_IO "Port" + IDS_PORT_MEMORY_IO "Memory" + IDS_INTERRUPT_EDGE_SENSITIVE "Edge Sensitive" + IDS_INTERRUPT_LEVEL_SENSITIVE "Level Sensitive" + IDS_MEMORY_READ_ONLY "Read Only" + IDS_MEMORY_WRITE_ONLY "Write Only" + IDS_MEMORY_READ_WRITE "Read / Write" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_BUS_UNDEFINED "Undefined" + IDS_BUS_INTERNAL "Internal" + IDS_BUS_ISA "ISA" + IDS_BUS_EISA "EISA" + IDS_BUS_MICROCHANNEL "MicroChannel" + IDS_BUS_TURBOCHANNEL "TurboChannel" + IDS_BUS_PCIBUS "PCI" + IDS_BUS_VMEBUS "VME" + IDS_BUS_NUBUS "NuBus" + IDS_BUS_PCMCIABUS "PCMCIA" + IDS_BUS_CBUS "C-Bus" + IDS_BUS_MPIBUS "MPI-Bus" + IDS_BUS_MPSABUS "MPSA-Bus" + IDS_BUS_PROCESSORINTERNAL "Processor Internal" + IDS_BUS_INTERNALPOWERBUS "Internal Power Bus" + IDS_BUS_PNPISABUS "PnP-ISA Bus" + IDS_BUS_PNPBUS "PnP Bus" + IDS_BUS_UNKNOWNTYPE "Unknown Interface Type" +END + /*****************************************************************/ diff --git a/base/applications/regedit/lang/pt-PT.rc b/base/applications/regedit/lang/pt-PT.rc index ed973c09c0c..67251b034f8 100644 --- a/base/applications/regedit/lang/pt-PT.rc +++ b/base/applications/regedit/lang/pt-PT.rc @@ -239,6 +239,53 @@ BEGIN PUSHBUTTON "Cancel",IDCANCEL,196,82,50,14 END + +IDD_EDIT_RESOURCE_LIST DIALOGEX 32, 24, 170, 120 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | + WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Resource List" +FONT 8, "MS Shell Dlg" +{ + CONTROL "", IDC_RESOURCE_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 10, 150, 75 + DEFPUSHBUTTON "OK", IDOK, 27, 100, 50, 14 + PUSHBUTTON "Show...", IDC_SHOW_RESOURCE, 93, 100, 50, 14, WS_DISABLED +} + + +IDD_EDIT_RESOURCE DIALOGEX 6, 18, 281, 283 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | + WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Resources" +FONT 8, "MS Shell Dlg" +{ + LTEXT "DMA:", IDC_STATIC, 10, 5, 20, 8 + CONTROL "", IDC_DMA_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 15, 261, 31 + LTEXT "Interrupt:", IDC_STATIC, 10, 48, 35, 8 + CONTROL "", IDC_IRQ_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 58, 261, 31 + LTEXT "Memory:", IDC_STATIC, 10, 91, 32, 8 + CONTROL "", IDC_MEMORY_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 101, 261, 31 + LTEXT "Port:", IDC_STATIC, 10, 134, 38, 8 + CONTROL "", IDC_PORT_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 144, 261, 31 + LTEXT "Device specific data:", IDC_STATIC, 10, 177, 80, 8 + CONTROL "", IDC_DEVICE_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 188, 261, 31 + GROUPBOX "Usage", IDC_STATIC, 10, 219, 125, 39 + LTEXT "Undetermined", IDC_UNDETERMINED, 18, 230, 46, 8, WS_DISABLED + LTEXT "Shared", IDC_SHARED, 18, 240, 48, 8, WS_DISABLED + LTEXT "Device exclusive", IDC_DEVICE_EXCLUSIVE, 72, 230, 58, 8, WS_DISABLED + LTEXT "Driver exclusive", IDC_DRIVER_EXCLUSIVE, 72, 240, 54, 8, WS_DISABLED + RTEXT "Interface Type:", IDC_STATIC, 144, 220, 58, 8 + LTEXT "", IDC_INTERFACETYPE, 205, 220, 66, 8 + RTEXT "Bus Nummer:", IDC_STATIC, 151, 230, 51, 8 + LTEXT "", IDC_BUSNUMBER, 205, 230, 66, 8 + RTEXT "Version:", IDC_STATIC, 151, 240, 51, 8 + LTEXT "", IDC_VERSION, 205, 240, 66, 8 + RTEXT "Revision:", IDC_STATIC, 151, 250, 51, 8 + LTEXT "", IDC_REVISION, 205, 250, 66, 8 + DEFPUSHBUTTON "OK",IDOK, 92, 263, 40, 14 + PUSHBUTTON "&Data...", IDC_SHOW_RESOURCE_DATA, 148, 263, 40, 14, WS_DISABLED +} + + /* * String Table */ @@ -390,6 +437,60 @@ BEGIN IDS_IMPORTED_OK "Information added to the registry" END +STRINGTABLE DISCARDABLE +BEGIN + IDS_BUSNUMBER "Bus Number" + IDS_INTERFACE "Interface" + IDS_DMA_CHANNEL "Channel" + IDS_DMA_PORT "Port" + IDS_INTERRUPT_VECTOR "Vector" + IDS_INTERRUPT_LEVEL "Level" + IDS_INTERRUPT_AFFINITY "Affinity" + IDS_INTERRUPT_TYPE "Type" + IDS_MEMORY_ADDRESS "Physical Address" + IDS_MEMORY_LENGTH "Length" + IDS_MEMORY_ACCESS "Access" + IDS_PORT_ADDRESS "Physical Address" + IDS_PORT_LENGTH "Length" + IDS_PORT_ACCESS "Access" + IDS_SPECIFIC_RESERVED1 "Reserved 1" + IDS_SPECIFIC_RESERVED2 "Reserved 2" + IDS_SPECIFIC_DATASIZE "Data Size" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_PORT_PORT_IO "Port" + IDS_PORT_MEMORY_IO "Memory" + IDS_INTERRUPT_EDGE_SENSITIVE "Edge Sensitive" + IDS_INTERRUPT_LEVEL_SENSITIVE "Level Sensitive" + IDS_MEMORY_READ_ONLY "Read Only" + IDS_MEMORY_WRITE_ONLY "Write Only" + IDS_MEMORY_READ_WRITE "Read / Write" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_BUS_UNDEFINED "Undefined" + IDS_BUS_INTERNAL "Internal" + IDS_BUS_ISA "ISA" + IDS_BUS_EISA "EISA" + IDS_BUS_MICROCHANNEL "MicroChannel" + IDS_BUS_TURBOCHANNEL "TurboChannel" + IDS_BUS_PCIBUS "PCI" + IDS_BUS_VMEBUS "VME" + IDS_BUS_NUBUS "NuBus" + IDS_BUS_PCMCIABUS "PCMCIA" + IDS_BUS_CBUS "C-Bus" + IDS_BUS_MPIBUS "MPI-Bus" + IDS_BUS_MPSABUS "MPSA-Bus" + IDS_BUS_PROCESSORINTERNAL "Processor Internal" + IDS_BUS_INTERNALPOWERBUS "Internal Power Bus" + IDS_BUS_PNPISABUS "PnP-ISA Bus" + IDS_BUS_PNPBUS "PnP Bus" + IDS_BUS_UNKNOWNTYPE "Unknown Interface Type" +END + /*****************************************************************/ diff --git a/base/applications/regedit/lang/ru-RU.rc b/base/applications/regedit/lang/ru-RU.rc index 93832ad72bd..109b34b4d50 100644 --- a/base/applications/regedit/lang/ru-RU.rc +++ b/base/applications/regedit/lang/ru-RU.rc @@ -35,84 +35,84 @@ END IDC_REGEDIT MENU DISCARDABLE BEGIN - POPUP "&" + POPUP "&Файл" BEGIN - MENUITEM "&", ID_REGISTRY_EXIT + MENUITEM "В&ыход", ID_REGISTRY_EXIT END - POPUP "&" + POPUP "&Справка" BEGIN - MENUITEM "& ", ID_HELP_ABOUT + MENUITEM "&О программе", ID_HELP_ABOUT END END IDR_REGEDIT_MENU MENU DISCARDABLE BEGIN - POPUP "&" + POPUP "&Реестр" BEGIN - MENUITEM "& ...", ID_REGISTRY_IMPORTREGISTRYFILE + MENUITEM "&Импортировать файл реестра...", ID_REGISTRY_IMPORTREGISTRYFILE - MENUITEM "& ...", ID_REGISTRY_EXPORTREGISTRYFILE + MENUITEM "&Экспортировать файл реестра...", ID_REGISTRY_EXPORTREGISTRYFILE MENUITEM SEPARATOR - MENUITEM " ...", ID_REGISTRY_LOADHIVE, GRAYED - MENUITEM " ...", ID_REGISTRY_UNLOADHIVE, GRAYED + MENUITEM "Загрузить куст...", ID_REGISTRY_LOADHIVE, GRAYED + MENUITEM "Выгрузить куст...", ID_REGISTRY_UNLOADHIVE, GRAYED MENUITEM SEPARATOR - MENUITEM "& ...", ID_REGISTRY_CONNECTNETWORKREGISTRY + MENUITEM "&Подключить сетевой реестр...", ID_REGISTRY_CONNECTNETWORKREGISTRY - MENUITEM "& ...", + MENUITEM "&Отключить сетевой реестр...", ID_REGISTRY_DISCONNECTNETWORKREGISTRY, GRAYED MENUITEM SEPARATOR - MENUITEM "&\tCtrl+P", ID_REGISTRY_PRINT, GRAYED + MENUITEM "&Печатаь\tCtrl+P", ID_REGISTRY_PRINT, GRAYED MENUITEM SEPARATOR - MENUITEM "&", ID_REGISTRY_EXIT + MENUITEM "В&ыход", ID_REGISTRY_EXIT END - POPUP "&" + POPUP "&Правка" BEGIN - MENUITEM "&", ID_EDIT_MODIFY + MENUITEM "&Изменить", ID_EDIT_MODIFY MENUITEM SEPARATOR - POPUP "&" + POPUP "Созд&ать" BEGIN - MENUITEM "&", ID_EDIT_NEW_KEY + MENUITEM "Кл&юч", ID_EDIT_NEW_KEY MENUITEM SEPARATOR - MENUITEM "& ", ID_EDIT_NEW_STRINGVALUE - MENUITEM "& ", ID_EDIT_NEW_BINARYVALUE - MENUITEM "& DWORD", ID_EDIT_NEW_DWORDVALUE - MENUITEM "& ", ID_EDIT_NEW_MULTISTRINGVALUE - MENUITEM "& ", ID_EDIT_NEW_EXPANDABLESTRINGVALUE + MENUITEM "&Строковый параметр", ID_EDIT_NEW_STRINGVALUE + MENUITEM "&Двоичный параметр", ID_EDIT_NEW_BINARYVALUE + MENUITEM "&Параметр DWORD", ID_EDIT_NEW_DWORDVALUE + MENUITEM "&Мультистроковый параметр", ID_EDIT_NEW_MULTISTRINGVALUE + MENUITEM "Рас&ширяемый строковый параметр", ID_EDIT_NEW_EXPANDABLESTRINGVALUE END MENUITEM SEPARATOR - MENUITEM "& ...", ID_EDIT_PERMISSIONS + MENUITEM "&Права доступа...", ID_EDIT_PERMISSIONS MENUITEM SEPARATOR - MENUITEM "&\tDel", ID_EDIT_DELETE - MENUITEM "&", ID_EDIT_RENAME + MENUITEM "&Удалить\tDel", ID_EDIT_DELETE + MENUITEM "&Переименовать", ID_EDIT_RENAME MENUITEM SEPARATOR - MENUITEM "& ", ID_EDIT_COPYKEYNAME + MENUITEM "С&копировать имя ключа", ID_EDIT_COPYKEYNAME MENUITEM SEPARATOR - MENUITEM "&\tCtrl+F", ID_EDIT_FIND - MENUITEM " &\tF3", ID_EDIT_FINDNEXT + MENUITEM "&Найти\tCtrl+F", ID_EDIT_FIND + MENUITEM "Найти &далее\tF3", ID_EDIT_FINDNEXT END - POPUP "&" + POPUP "&Вид" BEGIN - MENUITEM " &", ID_VIEW_STATUSBAR + MENUITEM "Строка &состояния", ID_VIEW_STATUSBAR MENUITEM SEPARATOR - MENUITEM "&", ID_VIEW_SPLIT + MENUITEM "&Разделить", ID_VIEW_SPLIT MENUITEM SEPARATOR - MENUITEM "&\tF5", ID_VIEW_REFRESH + MENUITEM "&Обновить\tF5", ID_VIEW_REFRESH END - POPUP "&" + POPUP "&Избранное" BEGIN - MENUITEM "& ", ID_FAVOURITES_ADDTOFAVOURITES, GRAYED + MENUITEM "&Добавить в избранное", ID_FAVOURITES_ADDTOFAVOURITES, GRAYED - MENUITEM "& ", ID_FAVOURITES_REMOVEFAVOURITE, GRAYED + MENUITEM "&Удалить из избранного", ID_FAVOURITES_REMOVEFAVOURITE, GRAYED END - POPUP "&" + POPUP "&Справка" BEGIN - MENUITEM "&", ID_HELP_HELPTOPICS + MENUITEM "&Содержание", ID_HELP_HELPTOPICS MENUITEM SEPARATOR - MENUITEM "& ", ID_HELP_ABOUT + MENUITEM "&О редакторе реестра", ID_HELP_ABOUT END END @@ -120,47 +120,47 @@ IDR_POPUP_MENUS MENU DISCARDABLE BEGIN POPUP "" BEGIN - MENUITEM "&", ID_EDIT_MODIFY - MENUITEM "& ", ID_EDIT_MODIFY_BIN + MENUITEM "&Изменить", ID_EDIT_MODIFY + MENUITEM "И&зменить двоичные данные", ID_EDIT_MODIFY_BIN MENUITEM SEPARATOR - MENUITEM "&\tDel", ID_EDIT_DELETE - MENUITEM "&", ID_EDIT_RENAME + MENUITEM "&Удалить\tDel", ID_EDIT_DELETE + MENUITEM "&Переименовать", ID_EDIT_RENAME END POPUP "" BEGIN - POPUP "&" + POPUP "Созд&ать" BEGIN - MENUITEM "&", ID_EDIT_NEW_KEY + MENUITEM "&Ключ", ID_EDIT_NEW_KEY MENUITEM SEPARATOR - MENUITEM "& ", ID_EDIT_NEW_STRINGVALUE - MENUITEM "& ", ID_EDIT_NEW_BINARYVALUE - MENUITEM "& DWORD", ID_EDIT_NEW_DWORDVALUE + MENUITEM "&Строковый параметр", ID_EDIT_NEW_STRINGVALUE + MENUITEM "&Двоичный параметр", ID_EDIT_NEW_BINARYVALUE + MENUITEM "&Параметр DWORD", ID_EDIT_NEW_DWORDVALUE MENUITEM "&Multi-String Value", ID_EDIT_NEW_MULTISTRINGVALUE MENUITEM "&Expandable String Value", ID_EDIT_NEW_EXPANDABLESTRINGVALUE END END POPUP "" BEGIN - MENUITEM "/", ID_TREE_EXPANDBRANCH - POPUP "&" + MENUITEM "Развернуть/Свернуть", ID_TREE_EXPANDBRANCH + POPUP "Созд&ать" BEGIN - MENUITEM "&", ID_EDIT_NEW_KEY + MENUITEM "&Ключ", ID_EDIT_NEW_KEY MENUITEM SEPARATOR - MENUITEM "& ", ID_EDIT_NEW_STRINGVALUE - MENUITEM "& ", ID_EDIT_NEW_BINARYVALUE - MENUITEM "& DWORD", ID_EDIT_NEW_DWORDVALUE + MENUITEM "&Строковый параметр", ID_EDIT_NEW_STRINGVALUE + MENUITEM "&Двоичный параметр", ID_EDIT_NEW_BINARYVALUE + MENUITEM "&Параметр DWORD", ID_EDIT_NEW_DWORDVALUE MENUITEM "&Multi-String Value", ID_EDIT_NEW_MULTISTRINGVALUE MENUITEM "&Expandable String Value", ID_EDIT_NEW_EXPANDABLESTRINGVALUE END - MENUITEM "&", ID_EDIT_FIND + MENUITEM "&Найти", ID_EDIT_FIND MENUITEM SEPARATOR - MENUITEM "&", ID_TREE_DELETE - MENUITEM "&", ID_TREE_RENAME + MENUITEM "&Удалить", ID_TREE_DELETE + MENUITEM "&Переименовать", ID_TREE_RENAME MENUITEM SEPARATOR - MENUITEM "&", ID_TREE_EXPORT - MENUITEM "&...", ID_TREE_PERMISSIONS, GRAYED + MENUITEM "&Экспорт", ID_TREE_EXPORT + MENUITEM "Разре&шения...", ID_TREE_PERMISSIONS, GRAYED MENUITEM SEPARATOR - MENUITEM "& ", ID_EDIT_COPYKEYNAME + MENUITEM "&Копировать имя ключа", ID_EDIT_COPYKEYNAME END POPUP "" BEGIN @@ -191,212 +191,313 @@ FONT 8, "Ms Shell Dlg" IDD_EDIT_STRING DIALOGEX 32, 24, 252, 84 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Изменение строкового параметра" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "&:", IDC_STATIC, 6, 6, 134, 8 + LTEXT "&Параметр:", IDC_STATIC, 6, 6, 134, 8 EDITTEXT IDC_VALUE_NAME, 6, 17, 240, 12, ES_AUTOHSCROLL | ES_READONLY - LTEXT "&:", IDC_STATIC, 6, 35, 161, 8 + LTEXT "&Значение:", IDC_STATIC, 6, 35, 161, 8 EDITTEXT IDC_VALUE_DATA, 6, 46, 240, 12, ES_AUTOHSCROLL DEFPUSHBUTTON "OK", IDOK, 142, 64, 50, 14 - PUSHBUTTON "", IDCANCEL, 196, 64, 50, 14 + PUSHBUTTON "Отмена", IDCANCEL, 196, 64, 50, 14 END IDD_EDIT_MULTI_STRING DIALOGEX 32, 24, 252, 174 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Изменение мультистрочного параметра" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "&:", IDC_STATIC, 6, 6, 134, 8 + LTEXT "&Параметр:", IDC_STATIC, 6, 6, 134, 8 EDITTEXT IDC_VALUE_NAME, 6, 17, 240, 12, ES_AUTOHSCROLL | ES_READONLY - LTEXT "&:", IDC_STATIC, 6, 35, 161, 8 + LTEXT "&Значение:", IDC_STATIC, 6, 35, 161, 8 EDITTEXT IDC_VALUE_DATA, 6, 46, 240, 102, ES_AUTOHSCROLL | ES_MULTILINE | ES_WANTRETURN | ES_AUTOVSCROLL | WS_VSCROLL DEFPUSHBUTTON "OK", IDOK, 142, 154, 50, 14 - PUSHBUTTON "", IDCANCEL, 196, 154, 50, 14 + PUSHBUTTON "Отмена", IDCANCEL, 196, 154, 50, 14 END IDD_EDIT_BIN_DATA DIALOGEX 32, 24, 252, 174 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Изменение двоичного параметра" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "&:", IDC_STATIC, 6, 6, 134, 8 + LTEXT "&Параметр:", IDC_STATIC, 6, 6, 134, 8 EDITTEXT IDC_VALUE_NAME, 6, 17, 240, 12, ES_AUTOHSCROLL | ES_READONLY - LTEXT "&:", IDC_STATIC, 6, 35, 161, 8 + LTEXT "&Значение:", IDC_STATIC, 6, 35, 161, 8 CONTROL "", IDC_VALUE_DATA, "HexEdit32", WS_VSCROLL | WS_BORDER | WS_TABSTOP, 6, 46, 240, 102 DEFPUSHBUTTON "OK", IDOK, 142, 154, 50, 14 - PUSHBUTTON "", IDCANCEL, 196, 154, 50, 14 + PUSHBUTTON "Отмена", IDCANCEL, 196, 154, 50, 14 END IDD_EDIT_DWORD DIALOGEX 32, 24, 252, 104 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " DWORD" +CAPTION "Изменение параметра DWORD" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "&:", IDC_STATIC, 6, 6, 134, 8 + LTEXT "&Параметр:", IDC_STATIC, 6, 6, 134, 8 EDITTEXT IDC_VALUE_NAME, 6, 17, 240, 12, ES_AUTOHSCROLL | ES_READONLY - LTEXT "&:", IDC_STATIC, 6, 35, 161, 8 + LTEXT "&Значение:", IDC_STATIC, 6, 35, 161, 8 EDITTEXT IDC_VALUE_DATA, 6, 46, 116, 12, ES_AUTOHSCROLL - GROUPBOX " ", IDC_STATIC, 130, 35, 116, 39 - AUTORADIOBUTTON "&", IDC_FORMAT_HEX, 141, 46, 90, 10, WS_GROUP - AUTORADIOBUTTON "&", IDC_FORMAT_DEC, 141, 59, 60, 10 + GROUPBOX "Система исчисления", IDC_STATIC, 130, 35, 116, 39 + AUTORADIOBUTTON "&Шестнадцатеричная", IDC_FORMAT_HEX, 141, 46, 90, 10, WS_GROUP + AUTORADIOBUTTON "&Десятичная", IDC_FORMAT_DEC, 141, 59, 60, 10 DEFPUSHBUTTON "OK", IDOK, 142, 82, 50, 14 - PUSHBUTTON "", IDCANCEL, 196, 82, 50, 14 + PUSHBUTTON "Отмена", IDCANCEL, 196, 82, 50, 14 END + +IDD_EDIT_RESOURCE_LIST DIALOGEX 32, 24, 170, 120 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | + WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Resource List" +FONT 8, "MS Shell Dlg" +{ + CONTROL "", IDC_RESOURCE_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 10, 150, 75 + DEFPUSHBUTTON "OK", IDOK, 27, 100, 50, 14 + PUSHBUTTON "Show...", IDC_SHOW_RESOURCE, 93, 100, 50, 14, WS_DISABLED +} + + +IDD_EDIT_RESOURCE DIALOGEX 6, 18, 281, 283 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | + WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Resources" +FONT 8, "MS Shell Dlg" +{ + LTEXT "DMA:", IDC_STATIC, 10, 5, 20, 8 + CONTROL "", IDC_DMA_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 15, 261, 31 + LTEXT "Interrupt:", IDC_STATIC, 10, 48, 35, 8 + CONTROL "", IDC_IRQ_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 58, 261, 31 + LTEXT "Memory:", IDC_STATIC, 10, 91, 32, 8 + CONTROL "", IDC_MEMORY_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 101, 261, 31 + LTEXT "Port:", IDC_STATIC, 10, 134, 38, 8 + CONTROL "", IDC_PORT_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 144, 261, 31 + LTEXT "Device specific data:", IDC_STATIC, 10, 177, 80, 8 + CONTROL "", IDC_DEVICE_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 188, 261, 31 + GROUPBOX "Usage", IDC_STATIC, 10, 219, 125, 39 + LTEXT "Undetermined", IDC_UNDETERMINED, 18, 230, 46, 8, WS_DISABLED + LTEXT "Shared", IDC_SHARED, 18, 240, 48, 8, WS_DISABLED + LTEXT "Device exclusive", IDC_DEVICE_EXCLUSIVE, 72, 230, 58, 8, WS_DISABLED + LTEXT "Driver exclusive", IDC_DRIVER_EXCLUSIVE, 72, 240, 54, 8, WS_DISABLED + RTEXT "Interface Type:", IDC_STATIC, 144, 220, 58, 8 + LTEXT "", IDC_INTERFACETYPE, 205, 220, 66, 8 + RTEXT "Bus Nummer:", IDC_STATIC, 151, 230, 51, 8 + LTEXT "", IDC_BUSNUMBER, 205, 230, 66, 8 + RTEXT "Version:", IDC_STATIC, 151, 240, 51, 8 + LTEXT "", IDC_VERSION, 205, 240, 66, 8 + RTEXT "Revision:", IDC_STATIC, 151, 250, 51, 8 + LTEXT "", IDC_REVISION, 205, 250, 66, 8 + DEFPUSHBUTTON "OK",IDOK, 92, 263, 40, 14 + PUSHBUTTON "&Data...", IDC_SHOW_RESOURCE_DATA, 148, 263, 40, 14, WS_DISABLED +} + + /* * String Table */ STRINGTABLE DISCARDABLE BEGIN - IDS_LIST_COLUMN_NAME "" - IDS_LIST_COLUMN_TYPE "" - IDS_LIST_COLUMN_DATA "" + IDS_LIST_COLUMN_NAME "Имя" + IDS_LIST_COLUMN_TYPE "Тип" + IDS_LIST_COLUMN_DATA "Данные" END STRINGTABLE DISCARDABLE BEGIN - IDS_APP_TITLE " " + IDS_APP_TITLE "Редактор реестра" IDC_REGEDIT "REGEDIT" IDC_REGEDIT_FRAME "REGEDIT_FRAME" END STRINGTABLE DISCARDABLE BEGIN - ID_REGISTRY_MENU " " - ID_EDIT_MENU " " - ID_VIEW_MENU " " - ID_FAVOURITES_MENU " " - ID_HELP_MENU " " - ID_EDIT_NEW_MENU " " + ID_REGISTRY_MENU "Содержит команды для работы с регистром в целом" + ID_EDIT_MENU "Содержит команды для редактирования значений или ключей" + ID_VIEW_MENU "Содержит команды для настройки окна реестра" + ID_FAVOURITES_MENU "Содержит команды для доступа к часто используемым ключам" + ID_HELP_MENU "Содержит команды для отображения справки и информации о редакторе реестра" + ID_EDIT_NEW_MENU "Содержит команды для создания новых ключей или значений" END STRINGTABLE DISCARDABLE BEGIN - ID_EDIT_MODIFY " " - ID_EDIT_NEW_KEY " " - ID_EDIT_NEW_STRINGVALUE " " - ID_EDIT_NEW_BINARYVALUE " " - ID_EDIT_NEW_DWORDVALUE " DWORD-" - ID_REGISTRY_IMPORTREGISTRYFILE " " - ID_REGISTRY_EXPORTREGISTRYFILE " " + ID_EDIT_MODIFY "Изменяет значение" + ID_EDIT_NEW_KEY "Добавляет новый ключ" + ID_EDIT_NEW_STRINGVALUE "Добавляет новое строковое значение" + ID_EDIT_NEW_BINARYVALUE "Добавляет новое бинарное значение" + ID_EDIT_NEW_DWORDVALUE "Добавляет новое DWORD-значение" + ID_REGISTRY_IMPORTREGISTRYFILE "Импортирует текстовой файл в реестр" + ID_REGISTRY_EXPORTREGISTRYFILE "Экспортирует весь реестр или его часть в текстовой файл" ID_REGISTRY_LOADHIVE "Loads a hive file into the registry" ID_REGISTRY_UNLOADHIVE "Unloads a hive from the registry" - ID_REGISTRY_CONNECTNETWORKREGISTRY " " + ID_REGISTRY_CONNECTNETWORKREGISTRY "Подключается к реестру удалённого компьютера" - ID_REGISTRY_DISCONNECTNETWORKREGISTRY " " + ID_REGISTRY_DISCONNECTNETWORKREGISTRY "Отключается от реестра удалённого компьютера" - ID_REGISTRY_PRINT " " -/* ID_HELP_HELPTOPICS " " */ - ID_HELP_ABOUT " , " + ID_REGISTRY_PRINT "Печатает весь реестр или ого часть" +/* ID_HELP_HELPTOPICS "Открывает справку редактора реестра" */ + ID_HELP_ABOUT "Отображает информацию о программе, номер версии и авторские права" END STRINGTABLE DISCARDABLE BEGIN - ID_REGISTRY_EXIT " " - ID_FAVOURITES_ADDTOFAVOURITES " " - ID_FAVOURITES_REMOVEFAVOURITE " " - ID_VIEW_STATUSBAR " " - ID_VIEW_SPLIT " " - ID_VIEW_REFRESH " " - ID_EDIT_DELETE " " - ID_EDIT_RENAME " " - ID_EDIT_COPYKEYNAME " " - ID_EDIT_FIND " , " - ID_EDIT_FINDNEXT " , " + ID_REGISTRY_EXIT "Выход из редактора реестра" + ID_FAVOURITES_ADDTOFAVOURITES "Добавить ключ в избранное" + ID_FAVOURITES_REMOVEFAVOURITE "Удалить ключ из избранного" + ID_VIEW_STATUSBAR "Показать или скрыть строку состояния" + ID_VIEW_SPLIT "Изменить позицию разделителя между двумя панелями" + ID_VIEW_REFRESH "Обновляет окно" + ID_EDIT_DELETE "Удаляет выделение" + ID_EDIT_RENAME "Переименовывает выделение" + ID_EDIT_COPYKEYNAME "Копирует имя выделенного ключа в буфер обмена" + ID_EDIT_FIND "Ищет текстовую строку в ключе, значении или данных" + ID_EDIT_FINDNEXT "Ищет следующее совпадение текста, заданного в предыдущем поиске" END STRINGTABLE DISCARDABLE BEGIN - IDS_ERROR "" - IDS_WARNING "" - IDS_BAD_KEY " '%s'" - IDS_BAD_VALUE " '%s'" - IDS_UNSUPPORTED_TYPE " (%ld)" - IDS_TOO_BIG_VALUE " (%ld)" - IDS_MULTI_SZ_EMPTY_STRING " REG_MULTI_SZ .\n ." - IDS_QUERY_DELETE_KEY_ONE " ?" - IDS_QUERY_DELETE_KEY_MORE " ?" - IDS_QUERY_DELETE_KEY_CONFIRM " " - IDS_QUERY_DELETE_ONE " ?" - IDS_QUERY_DELETE_MORE " ?" - IDS_QUERY_DELETE_CONFIRM " " - IDS_ERR_DELVAL_CAPTION " " - IDS_ERR_DELETEVALUE " !" - IDS_ERR_RENVAL_CAPTION " " - IDS_ERR_RENVAL_TOEMPTY " %s. . ." - IDS_NEW_KEY " #%d" - IDS_NEW_VALUE " #%d" + IDS_ERROR "Ошибка" + IDS_WARNING "Предупреждение" + IDS_BAD_KEY "Не удалось получить ключ '%s'" + IDS_BAD_VALUE "Не удалось получить значение '%s'" + IDS_UNSUPPORTED_TYPE "Невозможно изменить ключи этого типа (%ld)" + IDS_TOO_BIG_VALUE "Значение слишком большое (%ld)" + IDS_MULTI_SZ_EMPTY_STRING "Данные типа REG_MULTI_SZ не могут содержать пустые строки.\nВсе пустые строки будут удалены." + IDS_QUERY_DELETE_KEY_ONE "Вы действительно хотите удалить этот ключ?" + IDS_QUERY_DELETE_KEY_MORE "Вы действительно хотите удалить эти ключи?" + IDS_QUERY_DELETE_KEY_CONFIRM "Подтверждение удаления ключа" + IDS_QUERY_DELETE_ONE "Вы действительно хотите удалить это значение?" + IDS_QUERY_DELETE_MORE "Вы действительно хотите удалить эти значения?" + IDS_QUERY_DELETE_CONFIRM "Подтверждение удаления значения" + IDS_ERR_DELVAL_CAPTION "Ошибка удаления значения" + IDS_ERR_DELETEVALUE "Невозможно удалить все указанные значения!" + IDS_ERR_RENVAL_CAPTION "Ошибка переименования значения" + IDS_ERR_RENVAL_TOEMPTY "Невозможно переименовать %s. Указанное значение не пустое. Введите другое значение и повторите попытку." + IDS_NEW_KEY "Новый ключ #%d" + IDS_NEW_VALUE "Новое значение #%d" END STRINGTABLE DISCARDABLE BEGIN - IDS_BINARY_EMPTY "( )" - IDS_DEFAULT_VALUE_NAME "( )" - IDS_VALUE_NOT_SET "( )" - IDS_UNKNOWN_TYPE " : (0x%lx)" - IDS_MY_COMPUTER " " - IDS_IMPORT_REG_FILE " " - IDS_EXPORT_REG_FILE " " + IDS_BINARY_EMPTY "(двоичное значение нулевой длины)" + IDS_DEFAULT_VALUE_NAME "(По умолчанию)" + IDS_VALUE_NOT_SET "(значение не установлено)" + IDS_UNKNOWN_TYPE "Неизвестный тип: (0x%lx)" + IDS_MY_COMPUTER "Мой компьютер" + IDS_IMPORT_REG_FILE "Импортирование файла реестра" + IDS_EXPORT_REG_FILE "Экспортирование файла реестра" IDS_LOAD_HIVE "Load Hive" IDS_UNLOAD_HIVE "Unload Hive" - IDS_INVALID_DWORD "( DWORD)" + IDS_INVALID_DWORD "(неправильное значение DWORD)" END STRINGTABLE DISCARDABLE BEGIN - IDS_FLT_REGFILE " " - IDS_FLT_REGFILES " " + IDS_FLT_REGFILE "Файл реестра" + IDS_FLT_REGFILES "Файлы реестра" IDS_FLT_REGFILES_FLT "*.reg" - IDS_FLT_REGEDIT4 " Win9x/NT4 (REGEDIT4)" + IDS_FLT_REGEDIT4 "Файлы реестра Win9x/NT4 (REGEDIT4)" IDS_FLT_REGEDIT4_FLT "*.reg" - IDS_FLT_ALLFILES " (*.*)" + IDS_FLT_ALLFILES "Все файлы (*.*)" IDS_FLT_ALLFILES_FLT "*.*" END STRINGTABLE DISCARDABLE BEGIN - IDS_ACCESS_FULLCONTROL " " - IDS_ACCESS_READ "" - IDS_ACCESS_QUERYVALUE " " - IDS_ACCESS_SETVALUE " " - IDS_ACCESS_CREATESUBKEY " " - IDS_ACCESS_ENUMERATESUBKEYS " " - IDS_ACCESS_NOTIFY "" - IDS_ACCESS_CREATELINK " " - IDS_ACCESS_DELETE "" - IDS_ACCESS_WRITEDAC " DAC" - IDS_ACCESS_WRITEOWNER " " - IDS_ACCESS_READCONTROL " " + IDS_ACCESS_FULLCONTROL "Полный контроль" + IDS_ACCESS_READ "Чтение" + IDS_ACCESS_QUERYVALUE "Запрос значений" + IDS_ACCESS_SETVALUE "Установка значений" + IDS_ACCESS_CREATESUBKEY "Создание подключей" + IDS_ACCESS_ENUMERATESUBKEYS "Перечисление подключей" + IDS_ACCESS_NOTIFY "Уведомление" + IDS_ACCESS_CREATELINK "Создание связи" + IDS_ACCESS_DELETE "Удаление" + IDS_ACCESS_WRITEDAC "Запись DAC" + IDS_ACCESS_WRITEOWNER "Смена владельца" + IDS_ACCESS_READCONTROL "Чтение разрешений" END STRINGTABLE DISCARDABLE BEGIN - IDS_INHERIT_THISKEYONLY " " - IDS_INHERIT_THISKEYANDSUBKEYS " " - IDS_INHERIT_SUBKEYSONLY " " + IDS_INHERIT_THISKEYONLY "Только этот ключ" + IDS_INHERIT_THISKEYANDSUBKEYS "Только этот ключ и подключи" + IDS_INHERIT_SUBKEYSONLY "Только подключи" END STRINGTABLE DISCARDABLE BEGIN - IDS_EXPAND "&" - IDS_COLLAPSE "&" - IDS_GOTO_SUGGESTED_KEY "& '%s'" - IDS_FINISHEDFIND " ." + IDS_EXPAND "&Развернуть" + IDS_COLLAPSE "&Свернуть" + IDS_GOTO_SUGGESTED_KEY "&Перейти к '%s'" + IDS_FINISHEDFIND "Поиск в реестре завершен." END STRINGTABLE DISCARDABLE BEGIN - IDS_IMPORT_PROMPT " ?" - IDS_IMPORTED_OK " " + IDS_IMPORT_PROMPT "Добавить данные в реестр?" + IDS_IMPORTED_OK "Информация добавлена в реестр" END - + +STRINGTABLE DISCARDABLE +BEGIN + IDS_BUSNUMBER "Bus Number" + IDS_INTERFACE "Interface" + IDS_DMA_CHANNEL "Channel" + IDS_DMA_PORT "Port" + IDS_INTERRUPT_VECTOR "Vector" + IDS_INTERRUPT_LEVEL "Level" + IDS_INTERRUPT_AFFINITY "Affinity" + IDS_INTERRUPT_TYPE "Type" + IDS_MEMORY_ADDRESS "Physical Address" + IDS_MEMORY_LENGTH "Length" + IDS_MEMORY_ACCESS "Access" + IDS_PORT_ADDRESS "Physical Address" + IDS_PORT_LENGTH "Length" + IDS_PORT_ACCESS "Access" + IDS_SPECIFIC_RESERVED1 "Reserved 1" + IDS_SPECIFIC_RESERVED2 "Reserved 2" + IDS_SPECIFIC_DATASIZE "Data Size" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_PORT_PORT_IO "Port" + IDS_PORT_MEMORY_IO "Memory" + IDS_INTERRUPT_EDGE_SENSITIVE "Edge Sensitive" + IDS_INTERRUPT_LEVEL_SENSITIVE "Level Sensitive" + IDS_MEMORY_READ_ONLY "Read Only" + IDS_MEMORY_WRITE_ONLY "Write Only" + IDS_MEMORY_READ_WRITE "Read / Write" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_BUS_UNDEFINED "Undefined" + IDS_BUS_INTERNAL "Internal" + IDS_BUS_ISA "ISA" + IDS_BUS_EISA "EISA" + IDS_BUS_MICROCHANNEL "MicroChannel" + IDS_BUS_TURBOCHANNEL "TurboChannel" + IDS_BUS_PCIBUS "PCI" + IDS_BUS_VMEBUS "VME" + IDS_BUS_NUBUS "NuBus" + IDS_BUS_PCMCIABUS "PCMCIA" + IDS_BUS_CBUS "C-Bus" + IDS_BUS_MPIBUS "MPI-Bus" + IDS_BUS_MPSABUS "MPSA-Bus" + IDS_BUS_PROCESSORINTERNAL "Processor Internal" + IDS_BUS_INTERNALPOWERBUS "Internal Power Bus" + IDS_BUS_PNPISABUS "PnP-ISA Bus" + IDS_BUS_PNPBUS "PnP Bus" + IDS_BUS_UNKNOWNTYPE "Unknown Interface Type" +END + /*****************************************************************/ @@ -409,66 +510,66 @@ STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_B FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ", IDC_STATIC, 2, 0, 366, 48 - CONTROL "& ", IDC_EXPORT_ALL, "Button", BS_AUTORADIOBUTTON, 10, 10, 70, 11 - CONTROL "& ", IDC_EXPORT_BRANCH, "Button", BS_AUTORADIOBUTTON, 10, 22, 100, 11 + GROUPBOX "Диапазон экспорта", IDC_STATIC, 2, 0, 366, 48 + CONTROL "&Весь реестр", IDC_EXPORT_ALL, "Button", BS_AUTORADIOBUTTON, 10, 10, 70, 11 + CONTROL "В&ыбранная ветвь", IDC_EXPORT_BRANCH, "Button", BS_AUTORADIOBUTTON, 10, 22, 100, 11 EDITTEXT IDC_EXPORT_BRANCH_TEXT, 30, 34, 335, 12 END IDD_ADDFAVORITES DIALOGEX DISCARDABLE 0, 0, 187, 95 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Добавить в избранное" FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "OK", IDOK, 130, 7, 50, 14 - PUSHBUTTON "", IDCANCEL, 130, 24, 50, 14 - LTEXT "&:", IDC_STATIC, 7, 7, 70, 10 + PUSHBUTTON "Отмена", IDCANCEL, 130, 24, 50, 14 + LTEXT "&Имя:", IDC_STATIC, 7, 7, 70, 10 EDITTEXT IDC_FAVORITENAME, 7, 26, 110, 13, ES_AUTOHSCROLL END IDD_REMOVEFAVORITES DIALOGEX DISCARDABLE 0, 0, 164, 135 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Удалить из избранного" FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "OK", IDOK, 107, 114, 50, 14 - PUSHBUTTON "", IDCANCEL, 7, 114, 50, 14 + PUSHBUTTON "Отмена", IDCANCEL, 7, 114, 50, 14 CONTROL "List1", IDC_FAVORITESLIST, "SysListView32", LVS_LIST | WS_BORDER | WS_TABSTOP, 7, 20, 150, 90 - LTEXT " :", IDC_STATIC, 7, 7, 99, 12 + LTEXT "Выберите удаляемое:", IDC_STATIC, 7, 7, 99, 12 END IDD_FIND DIALOGEX DISCARDABLE 0, 0, 254, 82 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "" +CAPTION "Поиск" FONT 8, "MS Shell Dlg" BEGIN - DEFPUSHBUTTON "& ", IDOK, 193, 7, 58, 14 - PUSHBUTTON "", IDCANCEL, 193, 24, 58, 14 - GROUPBOX "", IDC_STATIC, 7, 24, 87, 51 - LTEXT "&:", IDC_STATIC, 7, 8, 37, 10 + DEFPUSHBUTTON "&Искать далее", IDOK, 193, 7, 58, 14 + PUSHBUTTON "Отмена", IDCANCEL, 193, 24, 58, 14 + GROUPBOX "Просматривать", IDC_STATIC, 7, 24, 87, 51 + LTEXT "На&йти:", IDC_STATIC, 7, 8, 37, 10 EDITTEXT IDC_FINDWHAT, 47, 7, 142, 13, ES_AUTOHSCROLL - CONTROL "&", IDC_LOOKAT_KEYS, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 14, 36, 51, 8 + CONTROL "&Ключи", IDC_LOOKAT_KEYS, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 14, 36, 51, 8 - CONTROL "&", IDC_LOOKAT_VALUES, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 14, 48, 51, 8 + CONTROL "&Значения", IDC_LOOKAT_VALUES, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 14, 48, 51, 8 - CONTROL "&", IDC_LOOKAT_DATA, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 14, 60, 51, 8 + CONTROL "&Данные", IDC_LOOKAT_DATA, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 14, 60, 51, 8 - CONTROL "& ", IDC_MATCHSTRING, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 109, 44, 136, 13 + CONTROL "&Искать только строку целиком", IDC_MATCHSTRING, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 109, 44, 136, 13 - CONTROL "& ", IDC_MATCHCASE, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 109, 60, 90, 12 + CONTROL "&С учетом регистра", IDC_MATCHCASE, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, 109, 60, 90, 12 END IDD_FINDING DIALOGEX 0, 0, 145, 50 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "" +CAPTION "Поиск" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN ICON IDI_REGEDIT, IDC_STATIC, 7, 7, 20, 20 - DEFPUSHBUTTON "&", IDCANCEL, 93, 29, 45, 14 - LTEXT " ...", IDC_STATIC, 33, 12, 83, 8 + DEFPUSHBUTTON "&Отмена", IDCANCEL, 93, 29, 45, 14 + LTEXT "Поиск в реестре...", IDC_STATIC, 33, 12, 83, 8 END /* @@ -489,8 +590,8 @@ END /* *STRINGTABLE DISCARDABLE *BEGIN - * ID_HELP_HELPTOPICS " ." - * ID_HELP_ABOUT " , ." + * ID_HELP_HELPTOPICS "Открывает справку редактора реестра." + * ID_HELP_ABOUT "Отображает информацию о программе, номер версии и авторские права." *END */ diff --git a/base/applications/regedit/lang/sk-SK.rc b/base/applications/regedit/lang/sk-SK.rc index ea0c0bdb9ed..026856c15d0 100644 --- a/base/applications/regedit/lang/sk-SK.rc +++ b/base/applications/regedit/lang/sk-SK.rc @@ -233,6 +233,53 @@ BEGIN PUSHBUTTON "Zrui",IDCANCEL,196,82,50,14 END + +IDD_EDIT_RESOURCE_LIST DIALOGEX 32, 24, 170, 120 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | + WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Resource List" +FONT 8, "MS Shell Dlg" +{ + CONTROL "", IDC_RESOURCE_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 10, 150, 75 + DEFPUSHBUTTON "OK", IDOK, 27, 100, 50, 14 + PUSHBUTTON "Show...", IDC_SHOW_RESOURCE, 93, 100, 50, 14, WS_DISABLED +} + + +IDD_EDIT_RESOURCE DIALOGEX 6, 18, 281, 283 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | + WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Resources" +FONT 8, "MS Shell Dlg" +{ + LTEXT "DMA:", IDC_STATIC, 10, 5, 20, 8 + CONTROL "", IDC_DMA_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 15, 261, 31 + LTEXT "Interrupt:", IDC_STATIC, 10, 48, 35, 8 + CONTROL "", IDC_IRQ_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 58, 261, 31 + LTEXT "Memory:", IDC_STATIC, 10, 91, 32, 8 + CONTROL "", IDC_MEMORY_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 101, 261, 31 + LTEXT "Port:", IDC_STATIC, 10, 134, 38, 8 + CONTROL "", IDC_PORT_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 144, 261, 31 + LTEXT "Device specific data:", IDC_STATIC, 10, 177, 80, 8 + CONTROL "", IDC_DEVICE_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 188, 261, 31 + GROUPBOX "Usage", IDC_STATIC, 10, 219, 125, 39 + LTEXT "Undetermined", IDC_UNDETERMINED, 18, 230, 46, 8, WS_DISABLED + LTEXT "Shared", IDC_SHARED, 18, 240, 48, 8, WS_DISABLED + LTEXT "Device exclusive", IDC_DEVICE_EXCLUSIVE, 72, 230, 58, 8, WS_DISABLED + LTEXT "Driver exclusive", IDC_DRIVER_EXCLUSIVE, 72, 240, 54, 8, WS_DISABLED + RTEXT "Interface Type:", IDC_STATIC, 144, 220, 58, 8 + LTEXT "", IDC_INTERFACETYPE, 205, 220, 66, 8 + RTEXT "Bus Nummer:", IDC_STATIC, 151, 230, 51, 8 + LTEXT "", IDC_BUSNUMBER, 205, 230, 66, 8 + RTEXT "Version:", IDC_STATIC, 151, 240, 51, 8 + LTEXT "", IDC_VERSION, 205, 240, 66, 8 + RTEXT "Revision:", IDC_STATIC, 151, 250, 51, 8 + LTEXT "", IDC_REVISION, 205, 250, 66, 8 + DEFPUSHBUTTON "OK",IDOK, 92, 263, 40, 14 + PUSHBUTTON "&Data...", IDC_SHOW_RESOURCE_DATA, 148, 263, 40, 14, WS_DISABLED +} + + /* * String Table */ @@ -384,6 +431,60 @@ BEGIN IDS_IMPORTED_OK "Information added to the registry" END +STRINGTABLE DISCARDABLE +BEGIN + IDS_BUSNUMBER "Bus Number" + IDS_INTERFACE "Interface" + IDS_DMA_CHANNEL "Channel" + IDS_DMA_PORT "Port" + IDS_INTERRUPT_VECTOR "Vector" + IDS_INTERRUPT_LEVEL "Level" + IDS_INTERRUPT_AFFINITY "Affinity" + IDS_INTERRUPT_TYPE "Type" + IDS_MEMORY_ADDRESS "Physical Address" + IDS_MEMORY_LENGTH "Length" + IDS_MEMORY_ACCESS "Access" + IDS_PORT_ADDRESS "Physical Address" + IDS_PORT_LENGTH "Length" + IDS_PORT_ACCESS "Access" + IDS_SPECIFIC_RESERVED1 "Reserved 1" + IDS_SPECIFIC_RESERVED2 "Reserved 2" + IDS_SPECIFIC_DATASIZE "Data Size" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_PORT_PORT_IO "Port" + IDS_PORT_MEMORY_IO "Memory" + IDS_INTERRUPT_EDGE_SENSITIVE "Edge Sensitive" + IDS_INTERRUPT_LEVEL_SENSITIVE "Level Sensitive" + IDS_MEMORY_READ_ONLY "Read Only" + IDS_MEMORY_WRITE_ONLY "Write Only" + IDS_MEMORY_READ_WRITE "Read / Write" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_BUS_UNDEFINED "Undefined" + IDS_BUS_INTERNAL "Internal" + IDS_BUS_ISA "ISA" + IDS_BUS_EISA "EISA" + IDS_BUS_MICROCHANNEL "MicroChannel" + IDS_BUS_TURBOCHANNEL "TurboChannel" + IDS_BUS_PCIBUS "PCI" + IDS_BUS_VMEBUS "VME" + IDS_BUS_NUBUS "NuBus" + IDS_BUS_PCMCIABUS "PCMCIA" + IDS_BUS_CBUS "C-Bus" + IDS_BUS_MPIBUS "MPI-Bus" + IDS_BUS_MPSABUS "MPSA-Bus" + IDS_BUS_PROCESSORINTERNAL "Processor Internal" + IDS_BUS_INTERNALPOWERBUS "Internal Power Bus" + IDS_BUS_PNPISABUS "PnP-ISA Bus" + IDS_BUS_PNPBUS "PnP Bus" + IDS_BUS_UNKNOWNTYPE "Unknown Interface Type" +END + /*****************************************************************/ diff --git a/base/applications/regedit/lang/sl-SI.rc b/base/applications/regedit/lang/sl-SI.rc index b3c40553c23..45cea15cc10 100644 --- a/base/applications/regedit/lang/sl-SI.rc +++ b/base/applications/regedit/lang/sl-SI.rc @@ -248,6 +248,53 @@ BEGIN PUSHBUTTON "Cancel",IDCANCEL,196,82,50,14 END + +IDD_EDIT_RESOURCE_LIST DIALOGEX 32, 24, 170, 120 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | + WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Resource List" +FONT 8, "MS Shell Dlg" +{ + CONTROL "", IDC_RESOURCE_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 10, 150, 75 + DEFPUSHBUTTON "OK", IDOK, 27, 100, 50, 14 + PUSHBUTTON "Show...", IDC_SHOW_RESOURCE, 93, 100, 50, 14, WS_DISABLED +} + + +IDD_EDIT_RESOURCE DIALOGEX 6, 18, 281, 283 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | + WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Resources" +FONT 8, "MS Shell Dlg" +{ + LTEXT "DMA:", IDC_STATIC, 10, 5, 20, 8 + CONTROL "", IDC_DMA_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 15, 261, 31 + LTEXT "Interrupt:", IDC_STATIC, 10, 48, 35, 8 + CONTROL "", IDC_IRQ_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 58, 261, 31 + LTEXT "Memory:", IDC_STATIC, 10, 91, 32, 8 + CONTROL "", IDC_MEMORY_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 101, 261, 31 + LTEXT "Port:", IDC_STATIC, 10, 134, 38, 8 + CONTROL "", IDC_PORT_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 144, 261, 31 + LTEXT "Device specific data:", IDC_STATIC, 10, 177, 80, 8 + CONTROL "", IDC_DEVICE_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 188, 261, 31 + GROUPBOX "Usage", IDC_STATIC, 10, 219, 125, 39 + LTEXT "Undetermined", IDC_UNDETERMINED, 18, 230, 46, 8, WS_DISABLED + LTEXT "Shared", IDC_SHARED, 18, 240, 48, 8, WS_DISABLED + LTEXT "Device exclusive", IDC_DEVICE_EXCLUSIVE, 72, 230, 58, 8, WS_DISABLED + LTEXT "Driver exclusive", IDC_DRIVER_EXCLUSIVE, 72, 240, 54, 8, WS_DISABLED + RTEXT "Interface Type:", IDC_STATIC, 144, 220, 58, 8 + LTEXT "", IDC_INTERFACETYPE, 205, 220, 66, 8 + RTEXT "Bus Nummer:", IDC_STATIC, 151, 230, 51, 8 + LTEXT "", IDC_BUSNUMBER, 205, 230, 66, 8 + RTEXT "Version:", IDC_STATIC, 151, 240, 51, 8 + LTEXT "", IDC_VERSION, 205, 240, 66, 8 + RTEXT "Revision:", IDC_STATIC, 151, 250, 51, 8 + LTEXT "", IDC_REVISION, 205, 250, 66, 8 + DEFPUSHBUTTON "OK",IDOK, 92, 263, 40, 14 + PUSHBUTTON "&Data...", IDC_SHOW_RESOURCE_DATA, 148, 263, 40, 14, WS_DISABLED +} + + /* * String Table */ @@ -399,6 +446,60 @@ BEGIN IDS_IMPORTED_OK "Information added to the registry" END +STRINGTABLE DISCARDABLE +BEGIN + IDS_BUSNUMBER "Bus Number" + IDS_INTERFACE "Interface" + IDS_DMA_CHANNEL "Channel" + IDS_DMA_PORT "Port" + IDS_INTERRUPT_VECTOR "Vector" + IDS_INTERRUPT_LEVEL "Level" + IDS_INTERRUPT_AFFINITY "Affinity" + IDS_INTERRUPT_TYPE "Type" + IDS_MEMORY_ADDRESS "Physical Address" + IDS_MEMORY_LENGTH "Length" + IDS_MEMORY_ACCESS "Access" + IDS_PORT_ADDRESS "Physical Address" + IDS_PORT_LENGTH "Length" + IDS_PORT_ACCESS "Access" + IDS_SPECIFIC_RESERVED1 "Reserved 1" + IDS_SPECIFIC_RESERVED2 "Reserved 2" + IDS_SPECIFIC_DATASIZE "Data Size" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_PORT_PORT_IO "Port" + IDS_PORT_MEMORY_IO "Memory" + IDS_INTERRUPT_EDGE_SENSITIVE "Edge Sensitive" + IDS_INTERRUPT_LEVEL_SENSITIVE "Level Sensitive" + IDS_MEMORY_READ_ONLY "Read Only" + IDS_MEMORY_WRITE_ONLY "Write Only" + IDS_MEMORY_READ_WRITE "Read / Write" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_BUS_UNDEFINED "Undefined" + IDS_BUS_INTERNAL "Internal" + IDS_BUS_ISA "ISA" + IDS_BUS_EISA "EISA" + IDS_BUS_MICROCHANNEL "MicroChannel" + IDS_BUS_TURBOCHANNEL "TurboChannel" + IDS_BUS_PCIBUS "PCI" + IDS_BUS_VMEBUS "VME" + IDS_BUS_NUBUS "NuBus" + IDS_BUS_PCMCIABUS "PCMCIA" + IDS_BUS_CBUS "C-Bus" + IDS_BUS_MPIBUS "MPI-Bus" + IDS_BUS_MPSABUS "MPSA-Bus" + IDS_BUS_PROCESSORINTERNAL "Processor Internal" + IDS_BUS_INTERNALPOWERBUS "Internal Power Bus" + IDS_BUS_PNPISABUS "PnP-ISA Bus" + IDS_BUS_PNPBUS "PnP Bus" + IDS_BUS_UNKNOWNTYPE "Unknown Interface Type" +END + /*****************************************************************/ diff --git a/base/applications/regedit/lang/sv-SE.rc b/base/applications/regedit/lang/sv-SE.rc index 9931b9af3c1..51ba6ba11ab 100644 --- a/base/applications/regedit/lang/sv-SE.rc +++ b/base/applications/regedit/lang/sv-SE.rc @@ -246,6 +246,53 @@ BEGIN PUSHBUTTON "Avbryt",IDCANCEL,196,82,50,14 END + +IDD_EDIT_RESOURCE_LIST DIALOGEX 32, 24, 170, 120 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | + WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Resource List" +FONT 8, "MS Shell Dlg" +{ + CONTROL "", IDC_RESOURCE_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 10, 150, 75 + DEFPUSHBUTTON "OK", IDOK, 27, 100, 50, 14 + PUSHBUTTON "Show...", IDC_SHOW_RESOURCE, 93, 100, 50, 14, WS_DISABLED +} + + +IDD_EDIT_RESOURCE DIALOGEX 6, 18, 281, 283 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | + WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Resources" +FONT 8, "MS Shell Dlg" +{ + LTEXT "DMA:", IDC_STATIC, 10, 5, 20, 8 + CONTROL "", IDC_DMA_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 15, 261, 31 + LTEXT "Interrupt:", IDC_STATIC, 10, 48, 35, 8 + CONTROL "", IDC_IRQ_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 58, 261, 31 + LTEXT "Memory:", IDC_STATIC, 10, 91, 32, 8 + CONTROL "", IDC_MEMORY_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 101, 261, 31 + LTEXT "Port:", IDC_STATIC, 10, 134, 38, 8 + CONTROL "", IDC_PORT_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 144, 261, 31 + LTEXT "Device specific data:", IDC_STATIC, 10, 177, 80, 8 + CONTROL "", IDC_DEVICE_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 188, 261, 31 + GROUPBOX "Usage", IDC_STATIC, 10, 219, 125, 39 + LTEXT "Undetermined", IDC_UNDETERMINED, 18, 230, 46, 8, WS_DISABLED + LTEXT "Shared", IDC_SHARED, 18, 240, 48, 8, WS_DISABLED + LTEXT "Device exclusive", IDC_DEVICE_EXCLUSIVE, 72, 230, 58, 8, WS_DISABLED + LTEXT "Driver exclusive", IDC_DRIVER_EXCLUSIVE, 72, 240, 54, 8, WS_DISABLED + RTEXT "Interface Type:", IDC_STATIC, 144, 220, 58, 8 + LTEXT "", IDC_INTERFACETYPE, 205, 220, 66, 8 + RTEXT "Bus Nummer:", IDC_STATIC, 151, 230, 51, 8 + LTEXT "", IDC_BUSNUMBER, 205, 230, 66, 8 + RTEXT "Version:", IDC_STATIC, 151, 240, 51, 8 + LTEXT "", IDC_VERSION, 205, 240, 66, 8 + RTEXT "Revision:", IDC_STATIC, 151, 250, 51, 8 + LTEXT "", IDC_REVISION, 205, 250, 66, 8 + DEFPUSHBUTTON "OK",IDOK, 92, 263, 40, 14 + PUSHBUTTON "&Data...", IDC_SHOW_RESOURCE_DATA, 148, 263, 40, 14, WS_DISABLED +} + + /* * String Table */ @@ -397,6 +444,60 @@ BEGIN IDS_IMPORTED_OK "Information added to the registry" END +STRINGTABLE DISCARDABLE +BEGIN + IDS_BUSNUMBER "Bus Number" + IDS_INTERFACE "Interface" + IDS_DMA_CHANNEL "Channel" + IDS_DMA_PORT "Port" + IDS_INTERRUPT_VECTOR "Vector" + IDS_INTERRUPT_LEVEL "Level" + IDS_INTERRUPT_AFFINITY "Affinity" + IDS_INTERRUPT_TYPE "Type" + IDS_MEMORY_ADDRESS "Physical Address" + IDS_MEMORY_LENGTH "Length" + IDS_MEMORY_ACCESS "Access" + IDS_PORT_ADDRESS "Physical Address" + IDS_PORT_LENGTH "Length" + IDS_PORT_ACCESS "Access" + IDS_SPECIFIC_RESERVED1 "Reserved 1" + IDS_SPECIFIC_RESERVED2 "Reserved 2" + IDS_SPECIFIC_DATASIZE "Data Size" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_PORT_PORT_IO "Port" + IDS_PORT_MEMORY_IO "Memory" + IDS_INTERRUPT_EDGE_SENSITIVE "Edge Sensitive" + IDS_INTERRUPT_LEVEL_SENSITIVE "Level Sensitive" + IDS_MEMORY_READ_ONLY "Read Only" + IDS_MEMORY_WRITE_ONLY "Write Only" + IDS_MEMORY_READ_WRITE "Read / Write" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_BUS_UNDEFINED "Undefined" + IDS_BUS_INTERNAL "Internal" + IDS_BUS_ISA "ISA" + IDS_BUS_EISA "EISA" + IDS_BUS_MICROCHANNEL "MicroChannel" + IDS_BUS_TURBOCHANNEL "TurboChannel" + IDS_BUS_PCIBUS "PCI" + IDS_BUS_VMEBUS "VME" + IDS_BUS_NUBUS "NuBus" + IDS_BUS_PCMCIABUS "PCMCIA" + IDS_BUS_CBUS "C-Bus" + IDS_BUS_MPIBUS "MPI-Bus" + IDS_BUS_MPSABUS "MPSA-Bus" + IDS_BUS_PROCESSORINTERNAL "Processor Internal" + IDS_BUS_INTERNALPOWERBUS "Internal Power Bus" + IDS_BUS_PNPISABUS "PnP-ISA Bus" + IDS_BUS_PNPBUS "PnP Bus" + IDS_BUS_UNKNOWNTYPE "Unknown Interface Type" +END + /*****************************************************************/ diff --git a/base/applications/regedit/lang/th-TH.rc b/base/applications/regedit/lang/th-TH.rc index 9bfd14c493d..3dffba358e5 100644 --- a/base/applications/regedit/lang/th-TH.rc +++ b/base/applications/regedit/lang/th-TH.rc @@ -248,6 +248,53 @@ BEGIN PUSHBUTTON "Cancel",IDCANCEL,196,82,50,14 END + +IDD_EDIT_RESOURCE_LIST DIALOGEX 32, 24, 170, 120 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | + WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Resource List" +FONT 8, "MS Shell Dlg" +{ + CONTROL "", IDC_RESOURCE_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 10, 150, 75 + DEFPUSHBUTTON "OK", IDOK, 27, 100, 50, 14 + PUSHBUTTON "Show...", IDC_SHOW_RESOURCE, 93, 100, 50, 14, WS_DISABLED +} + + +IDD_EDIT_RESOURCE DIALOGEX 6, 18, 281, 283 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | + WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Resources" +FONT 8, "MS Shell Dlg" +{ + LTEXT "DMA:", IDC_STATIC, 10, 5, 20, 8 + CONTROL "", IDC_DMA_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 15, 261, 31 + LTEXT "Interrupt:", IDC_STATIC, 10, 48, 35, 8 + CONTROL "", IDC_IRQ_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 58, 261, 31 + LTEXT "Memory:", IDC_STATIC, 10, 91, 32, 8 + CONTROL "", IDC_MEMORY_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 101, 261, 31 + LTEXT "Port:", IDC_STATIC, 10, 134, 38, 8 + CONTROL "", IDC_PORT_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 144, 261, 31 + LTEXT "Device specific data:", IDC_STATIC, 10, 177, 80, 8 + CONTROL "", IDC_DEVICE_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 188, 261, 31 + GROUPBOX "Usage", IDC_STATIC, 10, 219, 125, 39 + LTEXT "Undetermined", IDC_UNDETERMINED, 18, 230, 46, 8, WS_DISABLED + LTEXT "Shared", IDC_SHARED, 18, 240, 48, 8, WS_DISABLED + LTEXT "Device exclusive", IDC_DEVICE_EXCLUSIVE, 72, 230, 58, 8, WS_DISABLED + LTEXT "Driver exclusive", IDC_DRIVER_EXCLUSIVE, 72, 240, 54, 8, WS_DISABLED + RTEXT "Interface Type:", IDC_STATIC, 144, 220, 58, 8 + LTEXT "", IDC_INTERFACETYPE, 205, 220, 66, 8 + RTEXT "Bus Nummer:", IDC_STATIC, 151, 230, 51, 8 + LTEXT "", IDC_BUSNUMBER, 205, 230, 66, 8 + RTEXT "Version:", IDC_STATIC, 151, 240, 51, 8 + LTEXT "", IDC_VERSION, 205, 240, 66, 8 + RTEXT "Revision:", IDC_STATIC, 151, 250, 51, 8 + LTEXT "", IDC_REVISION, 205, 250, 66, 8 + DEFPUSHBUTTON "OK",IDOK, 92, 263, 40, 14 + PUSHBUTTON "&Data...", IDC_SHOW_RESOURCE_DATA, 148, 263, 40, 14, WS_DISABLED +} + + /* * String Table */ @@ -398,6 +445,60 @@ BEGIN IDS_IMPORT_PROMPT "Add the data to the registry?" IDS_IMPORTED_OK "Information added to the registry" END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_BUSNUMBER "Bus Number" + IDS_INTERFACE "Interface" + IDS_DMA_CHANNEL "Channel" + IDS_DMA_PORT "Port" + IDS_INTERRUPT_VECTOR "Vector" + IDS_INTERRUPT_LEVEL "Level" + IDS_INTERRUPT_AFFINITY "Affinity" + IDS_INTERRUPT_TYPE "Type" + IDS_MEMORY_ADDRESS "Physical Address" + IDS_MEMORY_LENGTH "Length" + IDS_MEMORY_ACCESS "Access" + IDS_PORT_ADDRESS "Physical Address" + IDS_PORT_LENGTH "Length" + IDS_PORT_ACCESS "Access" + IDS_SPECIFIC_RESERVED1 "Reserved 1" + IDS_SPECIFIC_RESERVED2 "Reserved 2" + IDS_SPECIFIC_DATASIZE "Data Size" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_PORT_PORT_IO "Port" + IDS_PORT_MEMORY_IO "Memory" + IDS_INTERRUPT_EDGE_SENSITIVE "Edge Sensitive" + IDS_INTERRUPT_LEVEL_SENSITIVE "Level Sensitive" + IDS_MEMORY_READ_ONLY "Read Only" + IDS_MEMORY_WRITE_ONLY "Write Only" + IDS_MEMORY_READ_WRITE "Read / Write" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_BUS_UNDEFINED "Undefined" + IDS_BUS_INTERNAL "Internal" + IDS_BUS_ISA "ISA" + IDS_BUS_EISA "EISA" + IDS_BUS_MICROCHANNEL "MicroChannel" + IDS_BUS_TURBOCHANNEL "TurboChannel" + IDS_BUS_PCIBUS "PCI" + IDS_BUS_VMEBUS "VME" + IDS_BUS_NUBUS "NuBus" + IDS_BUS_PCMCIABUS "PCMCIA" + IDS_BUS_CBUS "C-Bus" + IDS_BUS_MPIBUS "MPI-Bus" + IDS_BUS_MPSABUS "MPSA-Bus" + IDS_BUS_PROCESSORINTERNAL "Processor Internal" + IDS_BUS_INTERNALPOWERBUS "Internal Power Bus" + IDS_BUS_PNPISABUS "PnP-ISA Bus" + IDS_BUS_PNPBUS "PnP Bus" + IDS_BUS_UNKNOWNTYPE "Unknown Interface Type" +END /*****************************************************************/ diff --git a/base/applications/regedit/lang/uk-UA.rc b/base/applications/regedit/lang/uk-UA.rc index 6369579ea19..980a0502afe 100644 --- a/base/applications/regedit/lang/uk-UA.rc +++ b/base/applications/regedit/lang/uk-UA.rc @@ -36,84 +36,84 @@ END IDC_REGEDIT MENU DISCARDABLE BEGIN - POPUP "&" + POPUP "&Файл" BEGIN - MENUITEM "&", ID_REGISTRY_EXIT + MENUITEM "В&ихід", ID_REGISTRY_EXIT END - POPUP "&" + POPUP "&Довідка" BEGIN - MENUITEM "& ", ID_HELP_ABOUT + MENUITEM "Пр&о програму", ID_HELP_ABOUT END END IDR_REGEDIT_MENU MENU DISCARDABLE BEGIN - POPUP "&" + POPUP "Фа&йл" BEGIN - MENUITEM "&...", ID_REGISTRY_IMPORTREGISTRYFILE + MENUITEM "&Імпорт...", ID_REGISTRY_IMPORTREGISTRYFILE - MENUITEM "&...", ID_REGISTRY_EXPORTREGISTRYFILE + MENUITEM "&Експорт...", ID_REGISTRY_EXPORTREGISTRYFILE MENUITEM SEPARATOR - MENUITEM " ...", ID_REGISTRY_LOADHIVE, GRAYED - MENUITEM " ...", ID_REGISTRY_UNLOADHIVE, GRAYED + MENUITEM "Завантажити файл реєстру...", ID_REGISTRY_LOADHIVE, GRAYED + MENUITEM "Вивантажити файл реєстру...", ID_REGISTRY_UNLOADHIVE, GRAYED MENUITEM SEPARATOR - MENUITEM "&ϳ ...", + MENUITEM "&Підключити мережевий реєстр...", ID_REGISTRY_CONNECTNETWORKREGISTRY - MENUITEM "&³ ...", + MENUITEM "&Відключити мережевий реєстр...", ID_REGISTRY_DISCONNECTNETWORKREGISTRY , GRAYED MENUITEM SEPARATOR - MENUITEM "&\tCtrl+P", ID_REGISTRY_PRINT, GRAYED + MENUITEM "Д&рук\tCtrl+P", ID_REGISTRY_PRINT, GRAYED MENUITEM SEPARATOR - MENUITEM "&", ID_REGISTRY_EXIT + MENUITEM "В&ихід", ID_REGISTRY_EXIT END - POPUP "&" + POPUP "Пра&вка" BEGIN - MENUITEM "&", ID_EDIT_MODIFY + MENUITEM "&Змінити", ID_EDIT_MODIFY MENUITEM SEPARATOR - POPUP "&" + POPUP "&Створити" BEGIN - MENUITEM "&", ID_EDIT_NEW_KEY + MENUITEM "Роз&діл", ID_EDIT_NEW_KEY MENUITEM SEPARATOR - MENUITEM "& ", ID_EDIT_NEW_STRINGVALUE - MENUITEM "& ", ID_EDIT_NEW_BINARYVALUE - MENUITEM "&DWORD ", ID_EDIT_NEW_DWORDVALUE - MENUITEM "& ", ID_EDIT_NEW_MULTISTRINGVALUE - MENUITEM "& ", ID_EDIT_NEW_EXPANDABLESTRINGVALUE + MENUITEM "&Рядкове значення", ID_EDIT_NEW_STRINGVALUE + MENUITEM "&Двійкове значення", ID_EDIT_NEW_BINARYVALUE + MENUITEM "&DWORD значення", ID_EDIT_NEW_DWORDVALUE + MENUITEM "&Багаторядкове значення", ID_EDIT_NEW_MULTISTRINGVALUE + MENUITEM "Роз&ширюване рядкове значення", ID_EDIT_NEW_EXPANDABLESTRINGVALUE END MENUITEM SEPARATOR - MENUITEM "&...", ID_EDIT_PERMISSIONS + MENUITEM "Дозв&оли...", ID_EDIT_PERMISSIONS MENUITEM SEPARATOR - MENUITEM "&\tDel", ID_EDIT_DELETE - MENUITEM "&", ID_EDIT_RENAME + MENUITEM "В&идалити\tDel", ID_EDIT_DELETE + MENUITEM "Перей&менувати", ID_EDIT_RENAME MENUITEM SEPARATOR - MENUITEM "& ' ", ID_EDIT_COPYKEYNAME + MENUITEM "&Копіювати ім'я розділу", ID_EDIT_COPYKEYNAME MENUITEM SEPARATOR - MENUITEM "&\tCtrl+F", ID_EDIT_FIND - MENUITEM "& \tF3", ID_EDIT_FINDNEXT + MENUITEM "З&найти\tCtrl+F", ID_EDIT_FIND + MENUITEM "Зна&йти далі\tF3", ID_EDIT_FINDNEXT END - POPUP "&" + POPUP "&Вигляд" BEGIN - MENUITEM "& ", ID_VIEW_STATUSBAR + MENUITEM "&Рядок стану", ID_VIEW_STATUSBAR MENUITEM SEPARATOR - MENUITEM "&", ID_VIEW_SPLIT + MENUITEM "Роз&ділити", ID_VIEW_SPLIT MENUITEM SEPARATOR - MENUITEM "&\tF5", ID_VIEW_REFRESH + MENUITEM "&Оновити\tF5", ID_VIEW_REFRESH END - POPUP "&" + POPUP "Обр&ане" BEGIN - MENUITEM "& ", ID_FAVOURITES_ADDTOFAVOURITES + MENUITEM "&Додати в обране", ID_FAVOURITES_ADDTOFAVOURITES , GRAYED - MENUITEM "& ", ID_FAVOURITES_REMOVEFAVOURITE + MENUITEM "В&идалити з обраного", ID_FAVOURITES_REMOVEFAVOURITE , GRAYED END - POPUP "&" + POPUP "&Довідка" BEGIN - MENUITEM "&\tF1", ID_HELP_HELPTOPICS + MENUITEM "&Зміст\tF1", ID_HELP_HELPTOPICS MENUITEM SEPARATOR - MENUITEM "& ", ID_HELP_ABOUT + MENUITEM "&Про редактор реєстру", ID_HELP_ABOUT END END @@ -121,47 +121,47 @@ IDR_POPUP_MENUS MENU DISCARDABLE BEGIN POPUP "" BEGIN - MENUITEM "&", ID_EDIT_MODIFY - MENUITEM " ", ID_EDIT_MODIFY_BIN + MENUITEM "&Змінити", ID_EDIT_MODIFY + MENUITEM "Змінити двійкові дані", ID_EDIT_MODIFY_BIN MENUITEM SEPARATOR - MENUITEM "&\tDel", ID_EDIT_DELETE - MENUITEM "&", ID_EDIT_RENAME + MENUITEM "В&идалити\tDel", ID_EDIT_DELETE + MENUITEM "Перей&менувати", ID_EDIT_RENAME END POPUP "" BEGIN - POPUP "&" + POPUP "&Створити" BEGIN - MENUITEM "&", ID_EDIT_NEW_KEY + MENUITEM "Роз&діл", ID_EDIT_NEW_KEY MENUITEM SEPARATOR - MENUITEM "& ", ID_EDIT_NEW_STRINGVALUE - MENUITEM "& ", ID_EDIT_NEW_BINARYVALUE - MENUITEM "&DWORD ", ID_EDIT_NEW_DWORDVALUE - MENUITEM "& ", ID_EDIT_NEW_MULTISTRINGVALUE - MENUITEM "& ", ID_EDIT_NEW_EXPANDABLESTRINGVALUE + MENUITEM "&Рядкове значення", ID_EDIT_NEW_STRINGVALUE + MENUITEM "&Двійкове значення", ID_EDIT_NEW_BINARYVALUE + MENUITEM "&DWORD значення", ID_EDIT_NEW_DWORDVALUE + MENUITEM "&Багаторядкове значення", ID_EDIT_NEW_MULTISTRINGVALUE + MENUITEM "&Розширюване рядкове значення", ID_EDIT_NEW_EXPANDABLESTRINGVALUE END END POPUP "" BEGIN - MENUITEM "/", ID_TREE_EXPANDBRANCH - POPUP "&" + MENUITEM "Розгорнути/Згорнути", ID_TREE_EXPANDBRANCH + POPUP "&Створити" BEGIN - MENUITEM "&", ID_EDIT_NEW_KEY + MENUITEM "Роз&діл", ID_EDIT_NEW_KEY MENUITEM SEPARATOR - MENUITEM "& ", ID_EDIT_NEW_STRINGVALUE - MENUITEM "& ", ID_EDIT_NEW_BINARYVALUE - MENUITEM "&DWORD ", ID_EDIT_NEW_DWORDVALUE - MENUITEM "& ", ID_EDIT_NEW_MULTISTRINGVALUE - MENUITEM "& ", ID_EDIT_NEW_EXPANDABLESTRINGVALUE + MENUITEM "&Рядкове значення", ID_EDIT_NEW_STRINGVALUE + MENUITEM "&Двійкове значення", ID_EDIT_NEW_BINARYVALUE + MENUITEM "&DWORD значення", ID_EDIT_NEW_DWORDVALUE + MENUITEM "&Багаторядкове значення", ID_EDIT_NEW_MULTISTRINGVALUE + MENUITEM "&Розширюване рядкове значення", ID_EDIT_NEW_EXPANDABLESTRINGVALUE END - MENUITEM "&", ID_EDIT_FIND + MENUITEM "З&найти", ID_EDIT_FIND MENUITEM SEPARATOR - MENUITEM "&", ID_TREE_DELETE - MENUITEM "&", ID_TREE_RENAME + MENUITEM "В&идалити", ID_TREE_DELETE + MENUITEM "Перей&менувати", ID_TREE_RENAME MENUITEM SEPARATOR - MENUITEM "&", ID_TREE_EXPORT - MENUITEM "&...", ID_TREE_PERMISSIONS, GRAYED + MENUITEM "&Експорт", ID_TREE_EXPORT + MENUITEM "&Дозволи...", ID_TREE_PERMISSIONS, GRAYED MENUITEM SEPARATOR - MENUITEM "& ' ", ID_EDIT_COPYKEYNAME + MENUITEM "&Копіювати ім'я розділу", ID_EDIT_COPYKEYNAME END POPUP "" BEGIN @@ -192,212 +192,313 @@ FONT 8, "Ms Shell Dlg" IDD_EDIT_STRING DIALOGEX 32, 24, 252, 84 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Редагування рядка" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "& :",IDC_STATIC,6,6,134,8 + LTEXT "&Назва значення:",IDC_STATIC,6,6,134,8 EDITTEXT IDC_VALUE_NAME,6,17,240,12,ES_AUTOHSCROLL | ES_READONLY - LTEXT "& :",IDC_STATIC,6,35,161,8 + LTEXT "&Дані значення:",IDC_STATIC,6,35,161,8 EDITTEXT IDC_VALUE_DATA,6,46,240,12,ES_AUTOHSCROLL DEFPUSHBUTTON "OK",IDOK,142,64,50,14 - PUSHBUTTON "",IDCANCEL,196,64,50,14 + PUSHBUTTON "Скасувати",IDCANCEL,196,64,50,14 END IDD_EDIT_MULTI_STRING DIALOGEX 32, 24, 252, 174 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Редагування багаторядкового значення" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "& :",IDC_STATIC,6,6,134,8 + LTEXT "&Назва значення:",IDC_STATIC,6,6,134,8 EDITTEXT IDC_VALUE_NAME,6,17,240,12,ES_AUTOHSCROLL | ES_READONLY - LTEXT "& :",IDC_STATIC,6,35,161,8 + LTEXT "&Дані значення:",IDC_STATIC,6,35,161,8 EDITTEXT IDC_VALUE_DATA,6,46,240,102,ES_AUTOHSCROLL | ES_MULTILINE | ES_WANTRETURN | ES_AUTOVSCROLL | WS_VSCROLL DEFPUSHBUTTON "OK",IDOK,142,154,50,14 - PUSHBUTTON "",IDCANCEL,196,154,50,14 + PUSHBUTTON "Скасувати",IDCANCEL,196,154,50,14 END IDD_EDIT_BIN_DATA DIALOGEX 32, 24, 252, 174 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Редагування двійкового значення" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "& :",IDC_STATIC,6,6,134,8 + LTEXT "&Назва значення:",IDC_STATIC,6,6,134,8 EDITTEXT IDC_VALUE_NAME,6,17,240,12,ES_AUTOHSCROLL | ES_READONLY - LTEXT "& :",IDC_STATIC,6,35,161,8 + LTEXT "&Дані значення:",IDC_STATIC,6,35,161,8 CONTROL "",IDC_VALUE_DATA,"HexEdit32",WS_VSCROLL | WS_BORDER | WS_TABSTOP,6,46,240,102 DEFPUSHBUTTON "OK",IDOK,142,154,50,14 - PUSHBUTTON "",IDCANCEL,196,154,50,14 + PUSHBUTTON "Скасувати",IDCANCEL,196,154,50,14 END IDD_EDIT_DWORD DIALOGEX 32, 24, 252, 104 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " DWORD " +CAPTION "Редагування DWORD значення" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "& :",IDC_STATIC,6,6,134,8 + LTEXT "&Назва значення:",IDC_STATIC,6,6,134,8 EDITTEXT IDC_VALUE_NAME,6,17,240,12,ES_AUTOHSCROLL | ES_READONLY - LTEXT "& :",IDC_STATIC,6,35,161,8 + LTEXT "&Дані значення:",IDC_STATIC,6,35,161,8 EDITTEXT IDC_VALUE_DATA,6,46,116,12,ES_AUTOHSCROLL - GROUPBOX "",IDC_STATIC,130,35,116,39 - AUTORADIOBUTTON "&س",IDC_FORMAT_HEX,141,46,60,10,WS_GROUP - AUTORADIOBUTTON "&",IDC_FORMAT_DEC,141,59,60,10 + GROUPBOX "Основа",IDC_STATIC,130,35,116,39 + AUTORADIOBUTTON "&Шістнадцяткова",IDC_FORMAT_HEX,141,46,60,10,WS_GROUP + AUTORADIOBUTTON "&Десяткова",IDC_FORMAT_DEC,141,59,60,10 DEFPUSHBUTTON "OK",IDOK,142,82,50,14 - PUSHBUTTON "",IDCANCEL,196,82,50,14 + PUSHBUTTON "Скасувати",IDCANCEL,196,82,50,14 END + +IDD_EDIT_RESOURCE_LIST DIALOGEX 32, 24, 170, 120 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | + WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Resource List" +FONT 8, "MS Shell Dlg" +{ + CONTROL "", IDC_RESOURCE_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 10, 150, 75 + DEFPUSHBUTTON "OK", IDOK, 27, 100, 50, 14 + PUSHBUTTON "Show...", IDC_SHOW_RESOURCE, 93, 100, 50, 14, WS_DISABLED +} + + +IDD_EDIT_RESOURCE DIALOGEX 6, 18, 281, 283 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | + WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Resources" +FONT 8, "MS Shell Dlg" +{ + LTEXT "DMA:", IDC_STATIC, 10, 5, 20, 8 + CONTROL "", IDC_DMA_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 15, 261, 31 + LTEXT "Interrupt:", IDC_STATIC, 10, 48, 35, 8 + CONTROL "", IDC_IRQ_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 58, 261, 31 + LTEXT "Memory:", IDC_STATIC, 10, 91, 32, 8 + CONTROL "", IDC_MEMORY_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 101, 261, 31 + LTEXT "Port:", IDC_STATIC, 10, 134, 38, 8 + CONTROL "", IDC_PORT_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 144, 261, 31 + LTEXT "Device specific data:", IDC_STATIC, 10, 177, 80, 8 + CONTROL "", IDC_DEVICE_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 188, 261, 31 + GROUPBOX "Usage", IDC_STATIC, 10, 219, 125, 39 + LTEXT "Undetermined", IDC_UNDETERMINED, 18, 230, 46, 8, WS_DISABLED + LTEXT "Shared", IDC_SHARED, 18, 240, 48, 8, WS_DISABLED + LTEXT "Device exclusive", IDC_DEVICE_EXCLUSIVE, 72, 230, 58, 8, WS_DISABLED + LTEXT "Driver exclusive", IDC_DRIVER_EXCLUSIVE, 72, 240, 54, 8, WS_DISABLED + RTEXT "Interface Type:", IDC_STATIC, 144, 220, 58, 8 + LTEXT "", IDC_INTERFACETYPE, 205, 220, 66, 8 + RTEXT "Bus Nummer:", IDC_STATIC, 151, 230, 51, 8 + LTEXT "", IDC_BUSNUMBER, 205, 230, 66, 8 + RTEXT "Version:", IDC_STATIC, 151, 240, 51, 8 + LTEXT "", IDC_VERSION, 205, 240, 66, 8 + RTEXT "Revision:", IDC_STATIC, 151, 250, 51, 8 + LTEXT "", IDC_REVISION, 205, 250, 66, 8 + DEFPUSHBUTTON "OK",IDOK, 92, 263, 40, 14 + PUSHBUTTON "&Data...", IDC_SHOW_RESOURCE_DATA, 148, 263, 40, 14, WS_DISABLED +} + + /* * String Table */ STRINGTABLE DISCARDABLE BEGIN - IDS_LIST_COLUMN_NAME "'" - IDS_LIST_COLUMN_TYPE "" - IDS_LIST_COLUMN_DATA "" + IDS_LIST_COLUMN_NAME "Ім'я" + IDS_LIST_COLUMN_TYPE "Тип" + IDS_LIST_COLUMN_DATA "Дані" END STRINGTABLE DISCARDABLE BEGIN - IDS_APP_TITLE " " + IDS_APP_TITLE "Редактор реєстру" IDC_REGEDIT "REGEDIT" IDC_REGEDIT_FRAME "REGEDIT_FRAME" END STRINGTABLE DISCARDABLE BEGIN - ID_REGISTRY_MENU "̳ " - ID_EDIT_MENU "̳ " - ID_VIEW_MENU "̳ " - ID_FAVOURITES_MENU "̳ , " - ID_HELP_MENU "̳ " - ID_EDIT_NEW_MENU "̳ " + ID_REGISTRY_MENU "Містить команди для роботи з реєстром у цілому" + ID_EDIT_MENU "Містить команди для редагування значень або розділів" + ID_VIEW_MENU "Містить команди для настроювання вікна реєстра" + ID_FAVOURITES_MENU "Містить команди для доступу до розділів, що часто вживаються" + ID_HELP_MENU "Містить команди для відображення довідки та інформації про редактор реєстра" + ID_EDIT_NEW_MENU "Містить команди для створення нових розділів або значень" END STRINGTABLE DISCARDABLE BEGIN - ID_EDIT_MODIFY " " - ID_EDIT_NEW_KEY " " - ID_EDIT_NEW_STRINGVALUE " " - ID_EDIT_NEW_BINARYVALUE " " - ID_EDIT_NEW_DWORDVALUE " DWORD-" - ID_REGISTRY_IMPORTREGISTRYFILE " " + ID_EDIT_MODIFY "Змінює дані значення" + ID_EDIT_NEW_KEY "Додає новий розділ" + ID_EDIT_NEW_STRINGVALUE "Додає нове рядкове значення" + ID_EDIT_NEW_BINARYVALUE "Додає нове двійкове значення" + ID_EDIT_NEW_DWORDVALUE "Додає нове DWORD-значення" + ID_REGISTRY_IMPORTREGISTRYFILE "Імпортує текстовий файл до реєстру" ID_REGISTRY_EXPORTREGISTRYFILE - " " + "Експортує весь реєстр або його частину в текстовий файл" ID_REGISTRY_LOADHIVE "Loads a hive file into the registry" ID_REGISTRY_UNLOADHIVE "Unloads a hive from the registry" ID_REGISTRY_CONNECTNETWORKREGISTRY - "ϳ '" + "Підключається до реєстру віддаленого комп'ютера" ID_REGISTRY_DISCONNECTNETWORKREGISTRY - "³ '" - ID_REGISTRY_PRINT " " -/* ID_HELP_HELPTOPICS "³ " */ - ID_HELP_ABOUT "³ , " + "Відключається від реєстру віддаленого комп'ютера" + ID_REGISTRY_PRINT "Друкує весь реєстр або його частину" +/* ID_HELP_HELPTOPICS "Відкриває довідку редактора реєстра" */ + ID_HELP_ABOUT "Відображає інформацію про програму, номер версії та авторство" END STRINGTABLE DISCARDABLE BEGIN - ID_REGISTRY_EXIT " " - ID_FAVOURITES_ADDTOFAVOURITES " " - ID_FAVOURITES_REMOVEFAVOURITE " " - ID_VIEW_STATUSBAR "³ " - ID_VIEW_SPLIT " " - ID_VIEW_REFRESH " " - ID_EDIT_DELETE " " - ID_EDIT_RENAME " " - ID_EDIT_COPYKEYNAME " ' " - ID_EDIT_FIND " , " - ID_EDIT_FINDNEXT " , " + ID_REGISTRY_EXIT "Виходить з редактора реєстру" + ID_FAVOURITES_ADDTOFAVOURITES "Додає розділ до обраного" + ID_FAVOURITES_REMOVEFAVOURITE "Видаляє розділ з обраного" + ID_VIEW_STATUSBAR "Відображує або ховає рядок стану" + ID_VIEW_SPLIT "Змінити позицію роздільника між двома панелями" + ID_VIEW_REFRESH "Оновлює вікно" + ID_EDIT_DELETE "Видаляє вибір" + ID_EDIT_RENAME "Перейменовує вибір" + ID_EDIT_COPYKEYNAME "Копіює ім'я вибраного розділу до буфера" + ID_EDIT_FIND "Шукає текстовий рядок у розділі, значенні або даних" + ID_EDIT_FINDNEXT "Шукає наступний збіг тексту, заданого в попередньому пошуку" END STRINGTABLE DISCARDABLE BEGIN - IDS_ERROR "" - IDS_WARNING "" - IDS_BAD_KEY " '%s'" - IDS_BAD_VALUE " '%s'" - IDS_UNSUPPORTED_TYPE " (%ld)" - IDS_TOO_BIG_VALUE " (%ld)" - IDS_MULTI_SZ_EMPTY_STRING " REG_MULTI_SZ \n ." - IDS_QUERY_DELETE_KEY_ONE " , ?" - IDS_QUERY_DELETE_KEY_MORE " , ?" - IDS_QUERY_DELETE_KEY_CONFIRM "ϳ " - IDS_QUERY_DELETE_ONE " , ?" - IDS_QUERY_DELETE_MORE " , ?" - IDS_QUERY_DELETE_CONFIRM "ϳ " - IDS_ERR_DELVAL_CAPTION " " - IDS_ERR_DELETEVALUE " !" - IDS_ERR_RENVAL_CAPTION " " - IDS_ERR_RENVAL_TOEMPTY " %s. ' . ' ." - IDS_NEW_KEY " #%d" - IDS_NEW_VALUE " #%d" + IDS_ERROR "Помилка" + IDS_WARNING "Увага" + IDS_BAD_KEY "Не можу запросити розділ '%s'" + IDS_BAD_VALUE "Не можу запросити значення '%s'" + IDS_UNSUPPORTED_TYPE "Не можу редагувати розділи цього типу (%ld)" + IDS_TOO_BIG_VALUE "Значення завелике (%ld)" + IDS_MULTI_SZ_EMPTY_STRING "Дані типу REG_MULTI_SZ не можуть містити порожні рядки\nПорожні рядки були видалені зі списку." + IDS_QUERY_DELETE_KEY_ONE "Ви впевнені, що хочете видалити цей розділ?" + IDS_QUERY_DELETE_KEY_MORE "Ви впевнені, що хочете видалити ці розділи?" + IDS_QUERY_DELETE_KEY_CONFIRM "Підтвердження видалення розділу" + IDS_QUERY_DELETE_ONE "Ви впевнені, що хочете видалити це значення?" + IDS_QUERY_DELETE_MORE "Ви впевнені, що хочете видалити ці значення?" + IDS_QUERY_DELETE_CONFIRM "Підтвердження видалення значення" + IDS_ERR_DELVAL_CAPTION "Помилка при видаленні значень" + IDS_ERR_DELETEVALUE "Неможливо видалити усі задані значення!" + IDS_ERR_RENVAL_CAPTION "Помилка при перейменуванні значення" + IDS_ERR_RENVAL_TOEMPTY "Не можу перейменувати %s. Ім'я заданого значення порожнє. Спробуйте інше ім'я та повторіть спробу." + IDS_NEW_KEY "Новий розділ #%d" + IDS_NEW_VALUE "Нове значення #%d" END STRINGTABLE DISCARDABLE BEGIN - IDS_BINARY_EMPTY "( )" - IDS_DEFAULT_VALUE_NAME "( )" - IDS_VALUE_NOT_SET "( )" - IDS_UNKNOWN_TYPE " : (0x%lx)" - IDS_MY_COMPUTER "̳ '" - IDS_IMPORT_REG_FILE " " - IDS_EXPORT_REG_FILE " " + IDS_BINARY_EMPTY "(двійкове значення нульової довжини)" + IDS_DEFAULT_VALUE_NAME "(За замовчуванням)" + IDS_VALUE_NOT_SET "(значення не встановлене)" + IDS_UNKNOWN_TYPE "Невідомий тип: (0x%lx)" + IDS_MY_COMPUTER "Мій комп'ютер" + IDS_IMPORT_REG_FILE "Імпортувати файл реєстру" + IDS_EXPORT_REG_FILE "Експортувати файл реєстру" IDS_LOAD_HIVE "Load Hive" IDS_UNLOAD_HIVE "Unload Hive" - IDS_INVALID_DWORD "( DWORD)" + IDS_INVALID_DWORD "(Неправильне значення DWORD)" END STRINGTABLE DISCARDABLE BEGIN - IDS_FLT_REGFILE " " - IDS_FLT_REGFILES " " + IDS_FLT_REGFILE "Файл реєстру" + IDS_FLT_REGFILES "Файли реєстру" IDS_FLT_REGFILES_FLT "*.reg" - IDS_FLT_REGEDIT4 " Win9x/NT4 (REGEDIT4)" + IDS_FLT_REGEDIT4 "Файли реєстру Win9x/NT4 (REGEDIT4)" IDS_FLT_REGEDIT4_FLT "*.reg" - IDS_FLT_ALLFILES " (*.*)" + IDS_FLT_ALLFILES "Усі файли (*.*)" IDS_FLT_ALLFILES_FLT "*.*" END STRINGTABLE DISCARDABLE BEGIN - IDS_ACCESS_FULLCONTROL " " - IDS_ACCESS_READ "" - IDS_ACCESS_QUERYVALUE " " - IDS_ACCESS_SETVALUE " " - IDS_ACCESS_CREATESUBKEY " " - IDS_ACCESS_ENUMERATESUBKEYS " " - IDS_ACCESS_NOTIFY "" - IDS_ACCESS_CREATELINK " '" - IDS_ACCESS_DELETE "" - IDS_ACCESS_WRITEDAC " DAC" - IDS_ACCESS_WRITEOWNER " " - IDS_ACCESS_READCONTROL " " + IDS_ACCESS_FULLCONTROL "Повний контроль" + IDS_ACCESS_READ "Читання" + IDS_ACCESS_QUERYVALUE "Запит значення" + IDS_ACCESS_SETVALUE "Установлення значення" + IDS_ACCESS_CREATESUBKEY "Створення підрозділу" + IDS_ACCESS_ENUMERATESUBKEYS "Перерахування підрозділів" + IDS_ACCESS_NOTIFY "Сповіщення" + IDS_ACCESS_CREATELINK "Створення зв'язку" + IDS_ACCESS_DELETE "Видалення" + IDS_ACCESS_WRITEDAC "Запис DAC" + IDS_ACCESS_WRITEOWNER "Запис власника" + IDS_ACCESS_READCONTROL "Читання дозволу" END STRINGTABLE DISCARDABLE BEGIN - IDS_INHERIT_THISKEYONLY "ҳ " - IDS_INHERIT_THISKEYANDSUBKEYS " " - IDS_INHERIT_SUBKEYSONLY "ҳ " + IDS_INHERIT_THISKEYONLY "Тільки цей розділ" + IDS_INHERIT_THISKEYANDSUBKEYS "Цей розділ та підрозділи" + IDS_INHERIT_SUBKEYSONLY "Тільки підрозділи" END STRINGTABLE DISCARDABLE BEGIN - IDS_EXPAND "&" - IDS_COLLAPSE "&" - IDS_GOTO_SUGGESTED_KEY "& '%s'" - IDS_FINISHEDFIND " ." + IDS_EXPAND "&Розгорнути" + IDS_COLLAPSE "&Згорнути" + IDS_GOTO_SUGGESTED_KEY "&Перейти до '%s'" + IDS_FINISHEDFIND "Пошук у реєстрі завершений." END STRINGTABLE DISCARDABLE BEGIN - IDS_IMPORT_PROMPT " ?" - IDS_IMPORTED_OK " " + IDS_IMPORT_PROMPT "Додати дані до реєстру?" + IDS_IMPORTED_OK "Інформація була додана до реєстру" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_BUSNUMBER "Bus Number" + IDS_INTERFACE "Interface" + IDS_DMA_CHANNEL "Channel" + IDS_DMA_PORT "Port" + IDS_INTERRUPT_VECTOR "Vector" + IDS_INTERRUPT_LEVEL "Level" + IDS_INTERRUPT_AFFINITY "Affinity" + IDS_INTERRUPT_TYPE "Type" + IDS_MEMORY_ADDRESS "Physical Address" + IDS_MEMORY_LENGTH "Length" + IDS_MEMORY_ACCESS "Access" + IDS_PORT_ADDRESS "Physical Address" + IDS_PORT_LENGTH "Length" + IDS_PORT_ACCESS "Access" + IDS_SPECIFIC_RESERVED1 "Reserved 1" + IDS_SPECIFIC_RESERVED2 "Reserved 2" + IDS_SPECIFIC_DATASIZE "Data Size" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_PORT_PORT_IO "Port" + IDS_PORT_MEMORY_IO "Memory" + IDS_INTERRUPT_EDGE_SENSITIVE "Edge Sensitive" + IDS_INTERRUPT_LEVEL_SENSITIVE "Level Sensitive" + IDS_MEMORY_READ_ONLY "Read Only" + IDS_MEMORY_WRITE_ONLY "Write Only" + IDS_MEMORY_READ_WRITE "Read / Write" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_BUS_UNDEFINED "Undefined" + IDS_BUS_INTERNAL "Internal" + IDS_BUS_ISA "ISA" + IDS_BUS_EISA "EISA" + IDS_BUS_MICROCHANNEL "MicroChannel" + IDS_BUS_TURBOCHANNEL "TurboChannel" + IDS_BUS_PCIBUS "PCI" + IDS_BUS_VMEBUS "VME" + IDS_BUS_NUBUS "NuBus" + IDS_BUS_PCMCIABUS "PCMCIA" + IDS_BUS_CBUS "C-Bus" + IDS_BUS_MPIBUS "MPI-Bus" + IDS_BUS_MPSABUS "MPSA-Bus" + IDS_BUS_PROCESSORINTERNAL "Processor Internal" + IDS_BUS_INTERNALPOWERBUS "Internal Power Bus" + IDS_BUS_PNPISABUS "PnP-ISA Bus" + IDS_BUS_PNPBUS "PnP Bus" + IDS_BUS_UNKNOWNTYPE "Unknown Interface Type" END /*****************************************************************/ @@ -412,66 +513,66 @@ STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_BORDER FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "ij ",IDC_STATIC,2,0,366,48 - CONTROL "& ",IDC_EXPORT_ALL,"Button",BS_AUTORADIOBUTTON,10,10, 29,11 - CONTROL "& ",IDC_EXPORT_BRANCH,"Button",BS_AUTORADIOBUTTON,10,22, 100,11 + GROUPBOX "Діапазон експорту",IDC_STATIC,2,0,366,48 + CONTROL "&Весь реєстр",IDC_EXPORT_ALL,"Button",BS_AUTORADIOBUTTON,10,10, 29,11 + CONTROL "Виді&лена гілка",IDC_EXPORT_BRANCH,"Button",BS_AUTORADIOBUTTON,10,22, 100,11 EDITTEXT IDC_EXPORT_BRANCH_TEXT,30,34,335,12 END IDD_ADDFAVORITES DIALOGEX DISCARDABLE 0, 0, 186, 46 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Додання до обраного" FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "OK",IDOK,129,7,50,14 - PUSHBUTTON "",IDCANCEL,129,24,50,14 - LTEXT "'& :",IDC_STATIC,7,7,70,10 + PUSHBUTTON "Скасувати",IDCANCEL,129,24,50,14 + LTEXT "Ім'&я обраного розділу:",IDC_STATIC,7,7,70,10 EDITTEXT IDC_FAVORITENAME,7,26,110,13,ES_AUTOHSCROLL END IDD_REMOVEFAVORITES DIALOGEX DISCARDABLE 0, 0, 164, 135 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Видалення до обраного" FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "OK",IDOK,107,114,50,14 - PUSHBUTTON "",IDCANCEL,7,114,50,14 + PUSHBUTTON "Скасувати",IDCANCEL,7,114,50,14 CONTROL "List1",IDC_FAVORITESLIST,"SysListView32",LVS_LIST | WS_BORDER | WS_TABSTOP,7,20,150,90 - LTEXT " :",IDC_STATIC,7,7,99,12 + LTEXT "Оберіть імена для видалення:",IDC_STATIC,7,7,99,12 END IDD_FIND DIALOGEX DISCARDABLE 0, 0, 254, 82 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "" +CAPTION "Пошук" FONT 8, "MS Shell Dlg" BEGIN - DEFPUSHBUTTON "& ",IDOK,197,7,50,14 - PUSHBUTTON "",IDCANCEL,197,24,50,14 - GROUPBOX " ",IDC_STATIC,7,25,63,51 - LTEXT "& :",IDC_STATIC,7,8,37,10 + DEFPUSHBUTTON "Зна&йти далі",IDOK,197,7,50,14 + PUSHBUTTON "Скасувати",IDCANCEL,197,24,50,14 + GROUPBOX "Шукати у",IDC_STATIC,7,25,63,51 + LTEXT "&Що шукати:",IDC_STATIC,7,8,37,10 EDITTEXT IDC_FINDWHAT,47,7,142,13,ES_AUTOHSCROLL - CONTROL "&",IDC_LOOKAT_KEYS,"Button",BS_AUTOCHECKBOX | + CONTROL "&Розділи",IDC_LOOKAT_KEYS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,36,35,8 - CONTROL "&",IDC_LOOKAT_VALUES,"Button",BS_AUTOCHECKBOX | + CONTROL "&Значення",IDC_LOOKAT_VALUES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,48,36,8 - CONTROL "&",IDC_LOOKAT_DATA,"Button",BS_AUTOCHECKBOX | + CONTROL "&Дані",IDC_LOOKAT_DATA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,60,42,8 - CONTROL "&ҳ ",IDC_MATCHSTRING,"Button", + CONTROL "&Тільки рядки цілком",IDC_MATCHSTRING,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,83,32,94,13 - CONTROL " &",IDC_MATCHCASE,"Button",BS_AUTOCHECKBOX | + CONTROL "З урахуванням &регістру",IDC_MATCHCASE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,83,48,90,12 END IDD_FINDING DIALOGEX 0, 0, 145, 50 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "" +CAPTION "Знайти" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN ICON IDI_REGEDIT,IDC_STATIC,7,7,20,20 - DEFPUSHBUTTON "&",IDCANCEL,93,29,45,14 - LTEXT " ...",IDC_STATIC,33,12,83,8 + DEFPUSHBUTTON "&Скасувати",IDCANCEL,93,29,45,14 + LTEXT "Пошук у реєстрі...",IDC_STATIC,33,12,83,8 END /* @@ -492,8 +593,8 @@ END /* *STRINGTABLE DISCARDABLE *BEGIN - * ID_HELP_HELPTOPICS "³ ." - * ID_HELP_ABOUT "³ , , ." + * ID_HELP_HELPTOPICS "Відкриває довідку редактора реєстра." + * ID_HELP_ABOUT "Відображає інформацію про програму, номер версії, та авторські права." *END */ diff --git a/base/applications/regedit/lang/zh-CN.rc b/base/applications/regedit/lang/zh-CN.rc index 21acd7999ef..c1ad4edc2b2 100644 --- a/base/applications/regedit/lang/zh-CN.rc +++ b/base/applications/regedit/lang/zh-CN.rc @@ -248,6 +248,53 @@ BEGIN PUSHBUTTON "ȡ",IDCANCEL,196,82,50,14 END + +IDD_EDIT_RESOURCE_LIST DIALOGEX 32, 24, 170, 120 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | + WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Resource List" +FONT 8, "MS Shell Dlg" +{ + CONTROL "", IDC_RESOURCE_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 10, 150, 75 + DEFPUSHBUTTON "OK", IDOK, 27, 100, 50, 14 + PUSHBUTTON "Show...", IDC_SHOW_RESOURCE, 93, 100, 50, 14, WS_DISABLED +} + + +IDD_EDIT_RESOURCE DIALOGEX 6, 18, 281, 283 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | + WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Resources" +FONT 8, "MS Shell Dlg" +{ + LTEXT "DMA:", IDC_STATIC, 10, 5, 20, 8 + CONTROL "", IDC_DMA_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 15, 261, 31 + LTEXT "Interrupt:", IDC_STATIC, 10, 48, 35, 8 + CONTROL "", IDC_IRQ_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 58, 261, 31 + LTEXT "Memory:", IDC_STATIC, 10, 91, 32, 8 + CONTROL "", IDC_MEMORY_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 101, 261, 31 + LTEXT "Port:", IDC_STATIC, 10, 134, 38, 8 + CONTROL "", IDC_PORT_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 144, 261, 31 + LTEXT "Device specific data:", IDC_STATIC, 10, 177, 80, 8 + CONTROL "", IDC_DEVICE_LIST, "SysListView32", LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 10, 188, 261, 31 + GROUPBOX "Usage", IDC_STATIC, 10, 219, 125, 39 + LTEXT "Undetermined", IDC_UNDETERMINED, 18, 230, 46, 8, WS_DISABLED + LTEXT "Shared", IDC_SHARED, 18, 240, 48, 8, WS_DISABLED + LTEXT "Device exclusive", IDC_DEVICE_EXCLUSIVE, 72, 230, 58, 8, WS_DISABLED + LTEXT "Driver exclusive", IDC_DRIVER_EXCLUSIVE, 72, 240, 54, 8, WS_DISABLED + RTEXT "Interface Type:", IDC_STATIC, 144, 220, 58, 8 + LTEXT "", IDC_INTERFACETYPE, 205, 220, 66, 8 + RTEXT "Bus Nummer:", IDC_STATIC, 151, 230, 51, 8 + LTEXT "", IDC_BUSNUMBER, 205, 230, 66, 8 + RTEXT "Version:", IDC_STATIC, 151, 240, 51, 8 + LTEXT "", IDC_VERSION, 205, 240, 66, 8 + RTEXT "Revision:", IDC_STATIC, 151, 250, 51, 8 + LTEXT "", IDC_REVISION, 205, 250, 66, 8 + DEFPUSHBUTTON "OK",IDOK, 92, 263, 40, 14 + PUSHBUTTON "&Data...", IDC_SHOW_RESOURCE_DATA, 148, 263, 40, 14, WS_DISABLED +} + + /* * String Table */ @@ -399,6 +446,60 @@ BEGIN IDS_IMPORTED_OK "Information added to the registry" END +STRINGTABLE DISCARDABLE +BEGIN + IDS_BUSNUMBER "Bus Number" + IDS_INTERFACE "Interface" + IDS_DMA_CHANNEL "Channel" + IDS_DMA_PORT "Port" + IDS_INTERRUPT_VECTOR "Vector" + IDS_INTERRUPT_LEVEL "Level" + IDS_INTERRUPT_AFFINITY "Affinity" + IDS_INTERRUPT_TYPE "Type" + IDS_MEMORY_ADDRESS "Physical Address" + IDS_MEMORY_LENGTH "Length" + IDS_MEMORY_ACCESS "Access" + IDS_PORT_ADDRESS "Physical Address" + IDS_PORT_LENGTH "Length" + IDS_PORT_ACCESS "Access" + IDS_SPECIFIC_RESERVED1 "Reserved 1" + IDS_SPECIFIC_RESERVED2 "Reserved 2" + IDS_SPECIFIC_DATASIZE "Data Size" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_PORT_PORT_IO "Port" + IDS_PORT_MEMORY_IO "Memory" + IDS_INTERRUPT_EDGE_SENSITIVE "Edge Sensitive" + IDS_INTERRUPT_LEVEL_SENSITIVE "Level Sensitive" + IDS_MEMORY_READ_ONLY "Read Only" + IDS_MEMORY_WRITE_ONLY "Write Only" + IDS_MEMORY_READ_WRITE "Read / Write" +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_BUS_UNDEFINED "Undefined" + IDS_BUS_INTERNAL "Internal" + IDS_BUS_ISA "ISA" + IDS_BUS_EISA "EISA" + IDS_BUS_MICROCHANNEL "MicroChannel" + IDS_BUS_TURBOCHANNEL "TurboChannel" + IDS_BUS_PCIBUS "PCI" + IDS_BUS_VMEBUS "VME" + IDS_BUS_NUBUS "NuBus" + IDS_BUS_PCMCIABUS "PCMCIA" + IDS_BUS_CBUS "C-Bus" + IDS_BUS_MPIBUS "MPI-Bus" + IDS_BUS_MPSABUS "MPSA-Bus" + IDS_BUS_PROCESSORINTERNAL "Processor Internal" + IDS_BUS_INTERNALPOWERBUS "Internal Power Bus" + IDS_BUS_PNPISABUS "PnP-ISA Bus" + IDS_BUS_PNPBUS "PnP Bus" + IDS_BUS_UNKNOWNTYPE "Unknown Interface Type" +END + /*****************************************************************/ diff --git a/base/applications/regedit/regedit.h b/base/applications/regedit/regedit.h index 58cc4aa5062..bcf262041e2 100644 --- a/base/applications/regedit/regedit.h +++ b/base/applications/regedit/regedit.h @@ -2,7 +2,12 @@ #define _REGEDIT_H #define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */ +#define WIN32_NO_STATUS #include + +#define NTOS_MODE_USER +#include + #include #include #include @@ -12,7 +17,6 @@ #include #include #include -#include #include #include #include diff --git a/base/applications/regedit/resource.h b/base/applications/regedit/resource.h index 8ee02c6d811..e2757a1d83b 100644 --- a/base/applications/regedit/resource.h +++ b/base/applications/regedit/resource.h @@ -188,6 +188,54 @@ #define IDS_IMPORT_PROMPT 31129 #define IDS_IMPORTED_OK 31130 +#define IDS_FINISHEDFIND 31131 + +#define IDS_BUSNUMBER 31132 +#define IDS_INTERFACE 31133 + +#define IDS_DMA_CHANNEL 31134 +#define IDS_DMA_PORT 31135 +#define IDS_INTERRUPT_VECTOR 31136 +#define IDS_INTERRUPT_LEVEL 31137 +#define IDS_INTERRUPT_AFFINITY 31138 +#define IDS_INTERRUPT_TYPE 31139 +#define IDS_MEMORY_ADDRESS 31140 +#define IDS_MEMORY_LENGTH 31141 +#define IDS_MEMORY_ACCESS 31142 +#define IDS_PORT_ADDRESS 31143 +#define IDS_PORT_LENGTH 31144 +#define IDS_PORT_ACCESS 31145 +#define IDS_SPECIFIC_RESERVED1 31146 +#define IDS_SPECIFIC_RESERVED2 31147 +#define IDS_SPECIFIC_DATASIZE 31148 + +#define IDS_PORT_PORT_IO 31149 +#define IDS_PORT_MEMORY_IO 31150 +#define IDS_INTERRUPT_EDGE_SENSITIVE 31151 +#define IDS_INTERRUPT_LEVEL_SENSITIVE 31152 +#define IDS_MEMORY_READ_ONLY 31153 +#define IDS_MEMORY_WRITE_ONLY 31154 +#define IDS_MEMORY_READ_WRITE 31155 + +#define IDS_BUS_UNDEFINED 31156 +#define IDS_BUS_INTERNAL 31157 +#define IDS_BUS_ISA 31158 +#define IDS_BUS_EISA 31159 +#define IDS_BUS_MICROCHANNEL 31160 +#define IDS_BUS_TURBOCHANNEL 31161 +#define IDS_BUS_PCIBUS 31162 +#define IDS_BUS_VMEBUS 31163 +#define IDS_BUS_NUBUS 31164 +#define IDS_BUS_PCMCIABUS 31165 +#define IDS_BUS_CBUS 31166 +#define IDS_BUS_MPIBUS 31167 +#define IDS_BUS_MPSABUS 31168 +#define IDS_BUS_PROCESSORINTERNAL 31169 +#define IDS_BUS_INTERNALPOWERBUS 31170 +#define IDS_BUS_PNPISABUS 31171 +#define IDS_BUS_PNPBUS 31172 +#define IDS_BUS_UNKNOWNTYPE 31173 + #define IDD_EDIT_STRING 2000 #define IDC_VALUE_NAME 2001 #define IDC_VALUE_DATA 2002 @@ -215,7 +263,25 @@ #define IDC_MATCHSTRING 2017 #define IDC_MATCHCASE 2018 -#define IDS_FINISHEDFIND 2019 +#define IDD_EDIT_RESOURCE_LIST 2019 +#define IDC_RESOURCE_LIST 2020 +#define IDC_SHOW_RESOURCE 2021 + +#define IDD_EDIT_RESOURCE 2022 +#define IDC_DMA_LIST 2023 +#define IDC_IRQ_LIST 2024 +#define IDC_MEMORY_LIST 2025 +#define IDC_PORT_LIST 2026 +#define IDC_DEVICE_LIST 2027 +#define IDC_UNDETERMINED 2028 +#define IDC_SHARED 2029 +#define IDC_DEVICE_EXCLUSIVE 2030 +#define IDC_DRIVER_EXCLUSIVE 2031 +#define IDC_INTERFACETYPE 2032 +#define IDC_BUSNUMBER 2033 +#define IDC_VERSION 2034 +#define IDC_REVISION 2035 +#define IDC_SHOW_RESOURCE_DATA 2036 #define ID_FAVORITES_MIN 2100 #define ID_FAVORITES_MAX 2999 diff --git a/base/applications/regedit/rsrc.rc b/base/applications/regedit/rsrc.rc index 87673a63d00..96393535077 100644 --- a/base/applications/regedit/rsrc.rc +++ b/base/applications/regedit/rsrc.rc @@ -44,14 +44,14 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL #include "lang/no-NO.rc" #include "lang/pt-BR.rc" #include "lang/pt-PT.rc" -#include "lang/ru-RU.rc" #include "lang/sl-SI.rc" #include "lang/sk-SK.rc" #include "lang/sv-SE.rc" #include "lang/th-TH.rc" -#include "lang/uk-UA.rc" #include "lang/zh-CN.rc" // UTF-8 #pragma code_page(65001) #include "lang/pl-PL.rc" +#include "lang/ru-RU.rc" +#include "lang/uk-UA.rc" diff --git a/base/applications/sc/CMakeLists.txt b/base/applications/sc/CMakeLists.txt index 0854d5b229c..43576854e9d 100644 --- a/base/applications/sc/CMakeLists.txt +++ b/base/applications/sc/CMakeLists.txt @@ -13,10 +13,9 @@ list(APPEND SOURCE usage.c sc.rc) -add_executable(sc ${CMAKE_CURRENT_BINARY_DIR}/sc_sc.h.gch ${SOURCE}) - -add_pch(sc ${CMAKE_CURRENT_SOURCE_DIR}/sc.h ${SOURCE}) +add_executable(sc ${SOURCE}) set_module_type(sc win32cui) add_importlibs(sc advapi32 msvcrt kernel32) +add_pch(sc sc.h) add_cd_file(TARGET sc DESTINATION reactos/system32 FOR all) diff --git a/base/applications/screensavers/3dtext/3dtext.c b/base/applications/screensavers/3dtext/3dtext.c index 7b8d11f34cb..924699d1e81 100644 --- a/base/applications/screensavers/3dtext/3dtext.c +++ b/base/applications/screensavers/3dtext/3dtext.c @@ -18,14 +18,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include -#include -#include -#include -#include -#include - -#include "resource.h" #include "3dtext.h" static HGLRC hRC; // Permanent Rendering Context diff --git a/base/applications/screensavers/3dtext/3dtext.h b/base/applications/screensavers/3dtext/3dtext.h index 10cd1aaac95..d3e4b5f048e 100644 --- a/base/applications/screensavers/3dtext/3dtext.h +++ b/base/applications/screensavers/3dtext/3dtext.h @@ -20,6 +20,15 @@ ////////////////////////////////////////////////////////////////// +#include +#include +#include +#include +#include +#include + +#include "resource.h" + extern TCHAR m_Text[MAX_PATH]; VOID LoadSettings(VOID); diff --git a/base/applications/screensavers/3dtext/CMakeLists.txt b/base/applications/screensavers/3dtext/CMakeLists.txt index 083b0b0304d..cb4b77ca79e 100644 --- a/base/applications/screensavers/3dtext/CMakeLists.txt +++ b/base/applications/screensavers/3dtext/CMakeLists.txt @@ -8,8 +8,8 @@ add_executable(3dtext rsrc.rc) set_module_type(3dtext win32gui) +add_pch(3dtext 3dtext.h) set_target_properties(3dtext PROPERTIES SUFFIX ".scr") - target_link_libraries(3dtext scrnsave) add_importlibs(3dtext user32 gdi32 opengl32 glu32 advapi32 msvcrt kernel32) diff --git a/base/applications/screensavers/3dtext/lang/ru-RU.rc b/base/applications/screensavers/3dtext/lang/ru-RU.rc index 5e4d60b51cd..1b62865f667 100644 --- a/base/applications/screensavers/3dtext/lang/ru-RU.rc +++ b/base/applications/screensavers/3dtext/lang/ru-RU.rc @@ -2,16 +2,16 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT DLG_SCRNSAVECONFIGURE DIALOGEX 0, 0, 273, 178 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Параметры заставки" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN DEFPUSHBUTTON "OK",IDOK,216,7,50,14 - PUSHBUTTON "",IDCANCEL,216,24,50,14 + PUSHBUTTON "Отмена",IDCANCEL,216,24,50,14 EDITTEXT IDC_MESSAGE_TEXT,18,28,122,14,ES_AUTOHSCROLL - LTEXT " ",IDC_STATIC,18,17,65,8 + LTEXT "Другой текст",IDC_STATIC,18,17,65,8 END STRINGTABLE DISCARDABLE BEGIN - IDS_DESCRIPTION " 3D-" + IDS_DESCRIPTION "Заставка 3D-текст" END diff --git a/base/applications/screensavers/3dtext/lang/uk-UA.rc b/base/applications/screensavers/3dtext/lang/uk-UA.rc index 612e5a232cb..aab854ff041 100644 --- a/base/applications/screensavers/3dtext/lang/uk-UA.rc +++ b/base/applications/screensavers/3dtext/lang/uk-UA.rc @@ -10,16 +10,16 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT DLG_SCRNSAVECONFIGURE DIALOGEX 0, 0, 273, 178 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " ""' """ +CAPTION "Параметры заставки ""Об'ємний текст""" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN DEFPUSHBUTTON "OK",IDOK,216,7,50,14 - PUSHBUTTON "",IDCANCEL,216,24,50,14 + PUSHBUTTON "Скасувати",IDCANCEL,216,24,50,14 EDITTEXT IDC_MESSAGE_TEXT,18,28,122,14,ES_AUTOHSCROLL - LTEXT "",IDC_STATIC,18,17,65,8 + LTEXT "Текст",IDC_STATIC,18,17,65,8 END STRINGTABLE DISCARDABLE BEGIN - IDS_DESCRIPTION " ""' """ + IDS_DESCRIPTION "Заставка ""Об'ємний текст""" END diff --git a/base/applications/screensavers/3dtext/lang/zh-CN.rc b/base/applications/screensavers/3dtext/lang/zh-CN.rc new file mode 100644 index 00000000000..533ec73f1a3 --- /dev/null +++ b/base/applications/screensavers/3dtext/lang/zh-CN.rc @@ -0,0 +1,21 @@ +/* + * Translated by Song Fuchang (0xfc) + */ + +LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED + +DLG_SCRNSAVECONFIGURE DIALOGEX 0, 0, 273, 178 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "3D 文字屏幕保护程序设置" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + DEFPUSHBUTTON "确定",IDOK,216,7,50,14 + PUSHBUTTON "取消",IDCANCEL,216,24,50,14 + EDITTEXT IDC_MESSAGE_TEXT,18,28,122,14,ES_AUTOHSCROLL + LTEXT "自定义文字",IDC_STATIC,18,17,65,8 +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_DESCRIPTION "3D 文字屏幕保护程序" +END diff --git a/base/applications/screensavers/3dtext/rsrc.rc b/base/applications/screensavers/3dtext/rsrc.rc index b2d03a36f95..14b043bd6ae 100644 --- a/base/applications/screensavers/3dtext/rsrc.rc +++ b/base/applications/screensavers/3dtext/rsrc.rc @@ -22,11 +22,12 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL #include "lang/ko-KR.rc" #include "lang/lt-LT.rc" #include "lang/no-NO.rc" -#include "lang/ru-RU.rc" #include "lang/sk-SK.rc" #include "lang/sv-SE.rc" -#include "lang/uk-UA.rc" // UTF-8 #pragma code_page(65001) #include "lang/pl-PL.rc" +#include "lang/ru-RU.rc" +#include "lang/uk-UA.rc" +#include "lang/zh-CN.rc" diff --git a/base/applications/screensavers/3dtext/settings.c b/base/applications/screensavers/3dtext/settings.c index d21f56aaa06..5257a70da82 100644 --- a/base/applications/screensavers/3dtext/settings.c +++ b/base/applications/screensavers/3dtext/settings.c @@ -20,8 +20,6 @@ ////////////////////////////////////////////////////////////////// -#include -#include #include "3dtext.h" TCHAR m_Text[MAX_PATH]; diff --git a/base/applications/screensavers/logon/lang/ro-RO.rc b/base/applications/screensavers/logon/lang/ro-RO.rc index 7a14e75d234..3082d082751 100644 --- a/base/applications/screensavers/logon/lang/ro-RO.rc +++ b/base/applications/screensavers/logon/lang/ro-RO.rc @@ -5,5 +5,3 @@ BEGIN IDS_DESCRIPTION "Ecran de veghe Siglă" IDS_TEXT "Acest ecran de veghe nu are opțiuni." END - -#pragma code_page(default) diff --git a/base/applications/screensavers/logon/lang/ru-RU.rc b/base/applications/screensavers/logon/lang/ru-RU.rc index e21c7926343..82a8c14473f 100644 --- a/base/applications/screensavers/logon/lang/ru-RU.rc +++ b/base/applications/screensavers/logon/lang/ru-RU.rc @@ -2,6 +2,6 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT STRINGTABLE DISCARDABLE BEGIN - IDS_DESCRIPTION " "" """ - IDS_TEXT " ." + IDS_DESCRIPTION "Заставка ""Вход в систему""" + IDS_TEXT "Эта заставка не имеет настраиваемых параметров." END diff --git a/base/applications/screensavers/logon/lang/uk-UA.rc b/base/applications/screensavers/logon/lang/uk-UA.rc index 2a8a19a34e5..19035b0856d 100644 --- a/base/applications/screensavers/logon/lang/uk-UA.rc +++ b/base/applications/screensavers/logon/lang/uk-UA.rc @@ -10,6 +10,6 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT STRINGTABLE DISCARDABLE BEGIN - IDS_DESCRIPTION " "" """ - IDS_TEXT " ." + IDS_DESCRIPTION "Заставка ""Вхід до системи""" + IDS_TEXT "Ця заставка не має налаштовуваних параметрів." END diff --git a/base/applications/screensavers/logon/lang/zh-CN.rc b/base/applications/screensavers/logon/lang/zh-CN.rc new file mode 100644 index 00000000000..6fee2178edb --- /dev/null +++ b/base/applications/screensavers/logon/lang/zh-CN.rc @@ -0,0 +1,11 @@ +/* + * Translated by Song Fuchang (0xfc) + */ + +LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED + +STRINGTABLE DISCARDABLE +BEGIN + IDS_DESCRIPTION "登录屏幕保护程序" + IDS_TEXT "没有需要设置的选项。" +END diff --git a/base/applications/screensavers/logon/logon.rc b/base/applications/screensavers/logon/logon.rc index 452c6e52092..f04007a38f4 100644 --- a/base/applications/screensavers/logon/logon.rc +++ b/base/applications/screensavers/logon/logon.rc @@ -27,10 +27,11 @@ IDB_SERVER BITMAP DISCARDABLE "res/1.bmp" #include "lang/no-NO.rc" #include "lang/sk-SK.rc" #include "lang/sv-SE.rc" -#include "lang/uk-UA.rc" -#include "lang/ru-RU.rc" // UTF-8 #pragma code_page(65001) #include "lang/pl-PL.rc" #include "lang/ro-RO.rc" +#include "lang/ru-RU.rc" +#include "lang/uk-UA.rc" +#include "lang/zh-CN.rc" diff --git a/base/applications/shutdown/CMakeLists.txt b/base/applications/shutdown/CMakeLists.txt index 196d558ce82..81b2ec72ded 100644 --- a/base/applications/shutdown/CMakeLists.txt +++ b/base/applications/shutdown/CMakeLists.txt @@ -1,15 +1,14 @@ -add_definitions(-D_DLL -D__USE_CRTIMP) +set_rc_compiler() list(APPEND SOURCE misc.c shutdown.c shutdown.rc) -add_executable(shutdown ${CMAKE_CURRENT_BINARY_DIR}/shutdown_precomp.h.gch ${SOURCE}) - -add_pch(shutdown ${CMAKE_CURRENT_SOURCE_DIR}/precomp.h ${SOURCE}) +add_executable(shutdown ${SOURCE}) set_module_type(shutdown win32cui) add_importlibs(shutdown advapi32 user32 msvcrt kernel32) +add_pch(shutdown precomp.h) add_cd_file(TARGET shutdown DESTINATION reactos/system32 FOR all) diff --git a/base/applications/shutdown/lang/ru-RU.rc b/base/applications/shutdown/lang/ru-RU.rc index 1e76b7fe8d0..cf60961b3af 100644 --- a/base/applications/shutdown/lang/ru-RU.rc +++ b/base/applications/shutdown/lang/ru-RU.rc @@ -5,13 +5,13 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT STRINGTABLE DISCARDABLE BEGIN -IDS_USAGE, ": shutdown [-?] [-l | -s | -r] [-f]\n\n\ - -?\t \n\ - -l\t\t\t \n\ - -s\t\t\t \n\ - -r\t\t\t \n\ - -f\t\t\t \n\ - \t\t\t\n\ - \t\t\t , \n\ - \t\t\t ." +IDS_USAGE, "Использование: shutdown [-?] [-l | -s | -r] [-f]\n\n\ + Без аргументов или -?\tОтображение этого сообщения\n\ + -l\t\t\tЗавершение сеанса\n\ + -s\t\t\tВыключение этого компьютера\n\ + -r\t\t\tПерезагрузка этого компьютера\n\ + -f\t\t\tИгнорирование запущенных программ и завершение их без\n\ + \t\t\tпредупреждения\n\ + \t\t\tЕсли вы не указали другие параметры, то эта опция\n\ + \t\t\tприведет к завершению сеанса." END diff --git a/base/applications/shutdown/lang/uk-UA.rc b/base/applications/shutdown/lang/uk-UA.rc index 4a4ce260e77..d6a0e5a221c 100644 --- a/base/applications/shutdown/lang/uk-UA.rc +++ b/base/applications/shutdown/lang/uk-UA.rc @@ -11,12 +11,12 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT STRINGTABLE DISCARDABLE BEGIN -IDS_USAGE, ": shutdown [-?] [-l | -s | -r] [-f]\n\n\ - -?\t³ \n\ - -l\t\t\t \n\ - -s\t\t\t '\n\ - -r\t\t\t '\n\ - -f\t\t\t \n\ - \t\t\t , \n\ - \t\t\t " +IDS_USAGE, "Використання: shutdown [-?] [-l | -s | -r] [-f]\n\n\ + Без аргументів або -?\tВідображення цього повідомлення\n\ + -l\t\t\tЗавершення сеансу\n\ + -s\t\t\tВимкнення цього комп'ютера\n\ + -r\t\t\tПерезавантаження цього комп'ютера\n\ + -f\t\t\tПримусове закриття запущених додатків без попереджень\n\ + \t\t\tЯкщо ви не вказали інший параметр, то ця опція також\n\ + \t\t\tзавершить сеанс" END diff --git a/base/applications/shutdown/lang/zh-CN.rc b/base/applications/shutdown/lang/zh-CN.rc new file mode 100644 index 00000000000..4d99b281f68 --- /dev/null +++ b/base/applications/shutdown/lang/zh-CN.rc @@ -0,0 +1,18 @@ +/* + * Translated by Song Fuchang (0xfc) + */ + +LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED + +STRINGTABLE DISCARDABLE +BEGIN + +IDS_USAGE, "用法: shutdown [-?] [-l | -s | -r] [-f]\n\n\ + 没有参数或 -?\t显示这个消息\n\ + -l\t\t\t注销\n\ + -s\t\t\t关闭计算机\n\ + -r\t\t\t重新启动计算机\n\ + -f\t\t\t毫无警告地强行关闭正在运行的程序\n\ + \t\t\t如果您没有指定其他任何参数,这个选项\n\ + \t\t\t也会引起注销" +END diff --git a/base/applications/shutdown/rsrc.rc b/base/applications/shutdown/rsrc.rc index 6e7e69d573a..89144ec01a5 100644 --- a/base/applications/shutdown/rsrc.rc +++ b/base/applications/shutdown/rsrc.rc @@ -13,11 +13,12 @@ #include "lang/lt-LT.rc" #include "lang/nl-NL.rc" #include "lang/no-NO.rc" -#include "lang/ru-RU.rc" #include "lang/sk-SK.rc" #include "lang/sv-SE.rc" -#include "lang/uk-UA.rc" // UTF-8 #pragma code_page(65001) #include "lang/pl-PL.rc" +#include "lang/ru-RU.rc" +#include "lang/uk-UA.rc" +#include "lang/zh-CN.rc" diff --git a/base/applications/sndrec32/lang/uk-UA.rc b/base/applications/sndrec32/lang/uk-UA.rc index ee659ee0d9c..dc48bfd7d03 100644 --- a/base/applications/sndrec32/lang/uk-UA.rc +++ b/base/applications/sndrec32/lang/uk-UA.rc @@ -16,47 +16,47 @@ END IDD_ABOUTBOX DIALOGEX 0, 0, 196, 75 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " reactOS_sndrec32" +CAPTION "Інформація про reactOS_sndrec32" FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN ICON 128,IDC_REACTOS_SNDREC32,19,14,21,20 - LTEXT "reactOS_sndrec32, 1.0",IDC_STATIC,56,16,114,8,SS_NOPREFIX + LTEXT "reactOS_sndrec32, версії 1.0",IDC_STATIC,56,16,114,8,SS_NOPREFIX LTEXT "Copyright (C) 2009",IDC_STATIC,55,25,114,8 DEFPUSHBUTTON "OK",IDOK,139,54,50,14,WS_GROUP END IDR_MENU1 MENU BEGIN - POPUP "" + POPUP "Файл" BEGIN - MENUITEM "", ID_NEW - MENUITEM "³...", ID_FILE_OPEN - MENUITEM "", ID_FILE_SAVE, GRAYED - MENUITEM " ...", ID_FILE_SAVEAS, GRAYED + MENUITEM "Новий", ID_NEW + MENUITEM "Відкрити...", ID_FILE_OPEN + MENUITEM "Зберегти", ID_FILE_SAVE, GRAYED + MENUITEM "Зберегти як...", ID_FILE_SAVEAS, GRAYED MENUITEM SEPARATOR - MENUITEM "", ID_EXIT + MENUITEM "Вихід", ID_EXIT END MENUITEM "todo1", 0 MENUITEM "todo2", 0 POPUP "?" BEGIN - MENUITEM " ...", ID__ABOUT + MENUITEM "Про програму...", ID__ABOUT END END STRINGTABLE BEGIN - IDS_APP_TITLE "" + IDS_APP_TITLE "Звукозапис" IDC_REACTOS_SNDREC32 "REACTOS_SNDREC32" END STRINGTABLE BEGIN - IDS_STRPOS ": %.2f s" - IDS_STRDUR ": %.2f s" - IDS_STRBUF ": %.2f kb" + IDS_STRPOS "Позиція: %.2f s" + IDS_STRDUR "Довжина: %.2f s" + IDS_STRBUF "Буфер: %.2f kb" IDS_STRFMT "%.1f kHz %u bits" - IDS_STRMONO "" - IDS_STRSTEREO "" + IDS_STRMONO "моно" + IDS_STRSTEREO "стерео" IDS_STRCHAN "%s" END diff --git a/base/applications/sndrec32/lang/zh-CN.rc b/base/applications/sndrec32/lang/zh-CN.rc new file mode 100644 index 00000000000..e56f8c2f69d --- /dev/null +++ b/base/applications/sndrec32/lang/zh-CN.rc @@ -0,0 +1,59 @@ +/* + * Translated by Song Fuchang (0xfc) + */ + + +LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED + +IDC_REACTOS_SNDREC32 ACCELERATORS +BEGIN + "?", IDM_ABOUT, ASCII, ALT + "/", IDM_ABOUT, ASCII, ALT +END + +IDD_ABOUTBOX DIALOGEX 0, 0, 196, 75 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "关于 ReactOS 录音机" +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + ICON 128,IDC_REACTOS_SNDREC32,19,14,21,20 + LTEXT "ReactOS 录音机,版本 1.0",IDC_STATIC,56,16,114,8,SS_NOPREFIX + LTEXT "版权所有 (C) 2009",IDC_STATIC,55,25,114,8 + DEFPUSHBUTTON "确定",IDOK,139,54,50,14,WS_GROUP +END + +IDR_MENU1 MENU +BEGIN + POPUP "文件" + BEGIN + MENUITEM "新建", ID_NEW + MENUITEM "打开...", ID_FILE_OPEN + MENUITEM "保存", ID_FILE_SAVE, GRAYED + MENUITEM "另存为...", ID_FILE_SAVEAS, GRAYED + MENUITEM SEPARATOR + MENUITEM "退出", ID_EXIT + END + MENUITEM "todo1", 0 + MENUITEM "todo2", 0 + POPUP "帮助" + BEGIN + MENUITEM "关于...", ID__ABOUT + END +END + +STRINGTABLE +BEGIN + IDS_APP_TITLE "录音机" + IDC_REACTOS_SNDREC32 "REACTOS_SNDREC32" +END + +STRINGTABLE +BEGIN + IDS_STRPOS "位置:%.2f 秒" + IDS_STRDUR "长度:%.2f 秒" + IDS_STRBUF "缓冲区:%.2f KiB" + IDS_STRFMT "%.1f kHz %u 位" + IDS_STRMONO "单声道" + IDS_STRSTEREO "立体声" + IDS_STRCHAN "%s" +END diff --git a/base/applications/sndrec32/rsrc.rc b/base/applications/sndrec32/rsrc.rc index 37e1426eb68..d0dcb073614 100644 --- a/base/applications/sndrec32/rsrc.rc +++ b/base/applications/sndrec32/rsrc.rc @@ -25,8 +25,9 @@ IDB_BITMAP2_STOP_DIS BITMAP "resources/but_stop_dis.bmp" #include "lang/ja-JP.rc" #include "lang/sk-SK.rc" #include "lang/sv-SE.rc" -#include "lang/uk-UA.rc" // UTF-8 #pragma code_page(65001) #include "lang/pl-PL.rc" +#include "lang/uk-UA.rc" +#include "lang/zh-CN.rc" diff --git a/base/applications/sndvol32/CMakeLists.txt b/base/applications/sndvol32/CMakeLists.txt index 9208072f08e..b29966a58fd 100644 --- a/base/applications/sndvol32/CMakeLists.txt +++ b/base/applications/sndvol32/CMakeLists.txt @@ -1,19 +1,17 @@ -add_definitions(-D_DLL -D__USE_CRTIMP) - set_unicode() +set_rc_compiler() list(APPEND SOURCE dialog.c - misc.c + misc.c mixer.c sndvol32.c sndvol32.rc) -add_executable(sndvol32 ${CMAKE_CURRENT_BINARY_DIR}/sndvol32_sndvol32.h.gch ${SOURCE}) - -add_pch(sndvol32 ${CMAKE_CURRENT_SOURCE_DIR}/sndvol32.h ${SOURCE}) +add_executable(sndvol32 ${SOURCE}) set_module_type(sndvol32 win32gui) add_importlibs(sndvol32 user32 advapi32 gdi32 comctl32 shell32 winmm msvcrt kernel32 ntdll) +add_pch(sndvol32 sndvol32.h) add_cd_file(TARGET sndvol32 DESTINATION reactos/system32 FOR all) diff --git a/base/applications/sndvol32/lang/ru-RU.rc b/base/applications/sndvol32/lang/ru-RU.rc index 1fc2c86b91b..872cdb8b9d8 100644 --- a/base/applications/sndvol32/lang/ru-RU.rc +++ b/base/applications/sndvol32/lang/ru-RU.rc @@ -4,44 +4,44 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT IDM_MAINMENU MENU DISCARDABLE BEGIN - POPUP "&" + POPUP "&Параметры" BEGIN - MENUITEM "&", IDC_PROPERTIES - MENUITEM "& ", IDC_ADVANCED_CONTROLS + MENUITEM "&Свойства", IDC_PROPERTIES + MENUITEM "&Дополнительные параметры", IDC_ADVANCED_CONTROLS MENUITEM SEPARATOR - MENUITEM "&", IDC_EXIT + MENUITEM "&Выход", IDC_EXIT END - POPUP "&" + POPUP "&Справка" BEGIN - MENUITEM "& ", IDC_HELP_TOPICS + MENUITEM "&Вызов справки", IDC_HELP_TOPICS MENUITEM SEPARATOR - MENUITEM "& ", IDC_ABOUT + MENUITEM "&О программе", IDC_ABOUT END END STRINGTABLE DISCARDABLE BEGIN - IDS_SNDVOL32 " " - IDS_NOMIXERDEVICES " ! ." + IDS_SNDVOL32 "Управление громкостью" + IDS_NOMIXERDEVICES "Нет доступных микшерных устройств! Приложение будет завершено." END IDD_PREFERENCES DIALOGEX 0, 0, 224, 250 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "" +CAPTION "Свойства" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "&:", -1, 7,8,48,9 + LTEXT "&Микшер:", -1, 7,8,48,9 COMBOBOX IDC_MIXERDEVICE, 55,8,162,80, CBS_DROPDOWNLIST | WS_TABSTOP - GROUPBOX " :", -1, 7,25,211,77 - PUSHBUTTON "&", IDC_PLAYBACK, 13,43,80,8, BS_AUTORADIOBUTTON - PUSHBUTTON "&", IDC_RECORDING, 13,61,47,8, BS_AUTORADIOBUTTON - PUSHBUTTON "&:", IDC_OTHER, 13,80,42,8, BS_AUTORADIOBUTTON | WS_DISABLED + GROUPBOX "Настройки громкости:", -1, 7,25,211,77 + PUSHBUTTON "&Воспроизведение", IDC_PLAYBACK, 13,43,80,8, BS_AUTORADIOBUTTON + PUSHBUTTON "&Запись", IDC_RECORDING, 13,61,47,8, BS_AUTORADIOBUTTON + PUSHBUTTON "&Другое:", IDC_OTHER, 13,80,42,8, BS_AUTORADIOBUTTON | WS_DISABLED COMBOBOX IDC_LINE, 55,80,155,50, CBS_DROPDOWNLIST | WS_TABSTOP | WS_DISABLED - LTEXT " :", IDC_LABELCONTROLS, 7, 109, 162, 8 + LTEXT "Отображать регуляторы громкости:", IDC_LABELCONTROLS, 7, 109, 162, 8 CONTROL "", IDC_CONTROLS, "SysListView32", LVS_REPORT | LVS_NOCOLUMNHEADER | WS_TABSTOP | WS_BORDER, 7, 122, 211, 96 PUSHBUTTON "OK", IDOK, 114,226,50,14 - PUSHBUTTON "", IDCANCEL, 168,226,50,14 + PUSHBUTTON "Отмена", IDCANCEL, 168,226,50,14 END IDD_VOLUME_CTRL DIALOG 0, 0, 90, 150 diff --git a/base/applications/sndvol32/lang/uk-UA.rc b/base/applications/sndvol32/lang/uk-UA.rc index c993a77a357..9f996386f52 100644 --- a/base/applications/sndvol32/lang/uk-UA.rc +++ b/base/applications/sndvol32/lang/uk-UA.rc @@ -10,56 +10,56 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT IDM_MAINMENU MENU DISCARDABLE BEGIN - POPUP "&" + POPUP "&Параметри" BEGIN - MENUITEM "&", IDC_PROPERTIES - MENUITEM "& ", IDC_ADVANCED_CONTROLS + MENUITEM "&Властивості", IDC_PROPERTIES + MENUITEM "&Додаткові параметри", IDC_ADVANCED_CONTROLS MENUITEM SEPARATOR - MENUITEM "&", IDC_EXIT + MENUITEM "В&ихід", IDC_EXIT END - POPUP "&" + POPUP "До&відка" BEGIN - MENUITEM "&", IDC_HELP_TOPICS + MENUITEM "&Зміст", IDC_HELP_TOPICS MENUITEM SEPARATOR - MENUITEM "& ", IDC_ABOUT + MENUITEM "&Про регулятор гучності", IDC_ABOUT END END STRINGTABLE DISCARDABLE BEGIN - IDS_SNDVOL32 " " - IDS_NOMIXERDEVICES " - ! ." + IDS_SNDVOL32 "Регулятор гучності" + IDS_NOMIXERDEVICES "Активні пристрої-мікшери недоступні! Додаток закінчує роботу." END IDD_PREFERENCES DIALOGEX 0, 0, 224, 250 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "" +CAPTION "Властивості" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "&̳:", -1, 7,8,48,9 + LTEXT "&Мікшер:", -1, 7,8,48,9 COMBOBOX IDC_MIXERDEVICE, 55,8,162,80, CBS_DROPDOWNLIST | WS_TABSTOP - GROUPBOX " :", -1, 7,25,211,77 - PUSHBUTTON "&³", IDC_PLAYBACK, 13,43,47,8, BS_AUTORADIOBUTTON - PUSHBUTTON "&", IDC_RECORDING, 13,61,47,8, BS_AUTORADIOBUTTON - PUSHBUTTON "&:", IDC_OTHER, 13,80,42,8, BS_AUTORADIOBUTTON | WS_DISABLED + GROUPBOX "Регуляція гучності для:", -1, 7,25,211,77 + PUSHBUTTON "&Відтворення", IDC_PLAYBACK, 13,43,47,8, BS_AUTORADIOBUTTON + PUSHBUTTON "&Запис", IDC_RECORDING, 13,61,47,8, BS_AUTORADIOBUTTON + PUSHBUTTON "&Інше:", IDC_OTHER, 13,80,42,8, BS_AUTORADIOBUTTON | WS_DISABLED COMBOBOX IDC_LINE, 55,80,155,50, CBS_DROPDOWNLIST | WS_TABSTOP | WS_DISABLED - LTEXT "³ :", IDC_LABELCONTROLS, 7, 109, 162, 8 + LTEXT "Відображати наступні регулятори гучності:", IDC_LABELCONTROLS, 7, 109, 162, 8 CONTROL "", IDC_CONTROLS, "SysListView32", LVS_REPORT | LVS_NOCOLUMNHEADER | WS_TABSTOP | WS_BORDER, 7, 122, 211, 96 PUSHBUTTON "OK", IDOK, 114,226,50,14 - PUSHBUTTON "", IDCANCEL, 168,226,50,14 + PUSHBUTTON "Скасувати", IDCANCEL, 168,226,50,14 END IDD_VOLUME_CTRL DIALOG 0, 0, 90, 150 STYLE WS_POPUP | WS_BORDER FONT 8, "MS Shell Dlg" BEGIN - LTEXT "", IDC_LINE_NAME, 4, 7, 100, 15 + LTEXT "Головна", IDC_LINE_NAME, 4, 7, 100, 15 CONTROL "", -1, "static", SS_ETCHEDHORZ | WS_CHILD | WS_VISIBLE, 4, 30, 82, 1 - LTEXT "", -1, 4, 35, 80, 42 - LTEXT "", -1, 4, 100, 77, 108 + LTEXT "Баланс", -1, 4, 35, 80, 42 + LTEXT "Гучність", -1, 4, 100, 77, 108 CONTROL "", IDC_LINE_SLIDER_HORZ, "msctls_trackbar32", TBS_HORZ | TBS_AUTOTICKS | TBS_BOTH | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 55, 85, 30 CONTROL "", IDC_LINE_SLIDER_VERT, "msctls_trackbar32", TBS_VERT | TBS_AUTOTICKS | TBS_BOTH | TBS_DOWNISLEFT | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 32, 115, 30, 70 - CHECKBOX "&", IDC_LINE_SWITCH, 4, 190, 90, 12, BS_AUTOCHECKBOX + CHECKBOX "&Тиша", IDC_LINE_SWITCH, 4, 190, 90, 12, BS_AUTOCHECKBOX CONTROL "", IDC_LINE_SEP, "static", SS_ETCHEDVERT | WS_CHILD | WS_VISIBLE, 130, 7, 1, 200 END diff --git a/base/applications/sndvol32/lang/zh-CN.rc b/base/applications/sndvol32/lang/zh-CN.rc new file mode 100644 index 00000000000..17e13cce06a --- /dev/null +++ b/base/applications/sndvol32/lang/zh-CN.rc @@ -0,0 +1,61 @@ +/* + * Translated by Song Fuchang (0xfc) + */ + +LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED + +IDM_MAINMENU MENU DISCARDABLE +BEGIN + POPUP "选项(&P)" + BEGIN + MENUITEM "属性(&R)", IDC_PROPERTIES + MENUITEM "高级控制(&A)", IDC_ADVANCED_CONTROLS + MENUITEM SEPARATOR + MENUITEM "退出(&X)", IDC_EXIT + END + POPUP "帮助(&H)" + BEGIN + MENUITEM "帮助主题(&T)", IDC_HELP_TOPICS + MENUITEM SEPARATOR + MENUITEM "关于音量控制(&A)", IDC_ABOUT + END +END + +STRINGTABLE DISCARDABLE +BEGIN + IDS_SNDVOL32 "音量控制" + IDS_NOMIXERDEVICES "没有可用的混音器设备!这个程序即将退出。" +END + +IDD_PREFERENCES DIALOGEX 0, 0, 224, 250 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "属性" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "混音设备(&M):", -1, 7,8,48,9 + COMBOBOX IDC_MIXERDEVICE, 55,8,162,80, CBS_DROPDOWNLIST | WS_TABSTOP + GROUPBOX "为...调节音量:", -1, 7,25,211,77 + PUSHBUTTON "回放(&P)", IDC_PLAYBACK, 13,43,47,8, BS_AUTORADIOBUTTON + PUSHBUTTON "录音(&R)", IDC_RECORDING, 13,61,47,8, BS_AUTORADIOBUTTON + PUSHBUTTON "其他(&O):", IDC_OTHER, 13,80,42,8, BS_AUTORADIOBUTTON | WS_DISABLED + COMBOBOX IDC_LINE, 55,80,155,50, CBS_DROPDOWNLIST | WS_TABSTOP | WS_DISABLED + LTEXT "显示以下的音量控制:", IDC_LABELCONTROLS, 7, 109, 162, 8 + CONTROL "", IDC_CONTROLS, "SysListView32", LVS_REPORT | LVS_NOCOLUMNHEADER | WS_TABSTOP | WS_BORDER, 7, 122, 211, 96 + + PUSHBUTTON "确定", IDOK, 114,226,50,14 + PUSHBUTTON "取消", IDCANCEL, 168,226,50,14 +END + +IDD_VOLUME_CTRL DIALOG 0, 0, 90, 150 +STYLE WS_POPUP | WS_BORDER +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "主要", IDC_LINE_NAME, 4, 7, 100, 15 + CONTROL "", -1, "static", SS_ETCHEDHORZ | WS_CHILD | WS_VISIBLE, 4, 30, 82, 1 + LTEXT "平衡", -1, 4, 35, 80, 42 + LTEXT "音量", -1, 4, 100, 77, 108 + CONTROL "", IDC_LINE_SLIDER_HORZ, "msctls_trackbar32", TBS_HORZ | TBS_AUTOTICKS | TBS_BOTH | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 55, 85, 30 + CONTROL "", IDC_LINE_SLIDER_VERT, "msctls_trackbar32", TBS_VERT | TBS_AUTOTICKS | TBS_BOTH | TBS_DOWNISLEFT | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 32, 115, 30, 70 + CHECKBOX "静音(&M)", IDC_LINE_SWITCH, 4, 190, 90, 12, BS_AUTOCHECKBOX + CONTROL "", IDC_LINE_SEP, "static", SS_ETCHEDVERT | WS_CHILD | WS_VISIBLE, 130, 7, 1, 200 +END diff --git a/base/applications/sndvol32/rsrc.rc b/base/applications/sndvol32/rsrc.rc index e3c89d7d6be..587b731ee0c 100644 --- a/base/applications/sndvol32/rsrc.rc +++ b/base/applications/sndvol32/rsrc.rc @@ -21,12 +21,13 @@ IDI_MAINAPP ICON DISCARDABLE resources/sndvol32.ico #include "lang/nl-NL.rc" #include "lang/no-NO.rc" #include "lang/pt-BR.rc" -#include "lang/ru-RU.rc" #include "lang/sk-SK.rc" #include "lang/sv-SE.rc" #include "lang/th-TH.rc" -#include "lang/uk-UA.rc" // UTF-8 #pragma code_page(65001) #include "lang/pl-PL.rc" +#include "lang/ru-RU.rc" +#include "lang/uk-UA.rc" +#include "lang/zh-CN.rc" diff --git a/base/applications/taskmgr/CMakeLists.txt b/base/applications/taskmgr/CMakeLists.txt index b36860362e5..99c8a25868c 100644 --- a/base/applications/taskmgr/CMakeLists.txt +++ b/base/applications/taskmgr/CMakeLists.txt @@ -23,10 +23,9 @@ list(APPEND SOURCE graphctl.c taskmgr.rc) -add_executable(taskmgr ${CMAKE_CURRENT_BINARY_DIR}/taskmgr_precomp.h.gch ${SOURCE}) - -add_pch(taskmgr ${CMAKE_CURRENT_SOURCE_DIR}/precomp.h ${SOURCE}) +add_executable(taskmgr ${SOURCE}) set_module_type(taskmgr win32gui) add_importlibs(taskmgr advapi32 user32 gdi32 shell32 comctl32 msvcrt kernel32 ntdll) +add_pch(taskmgr precomp.h) add_cd_file(TARGET taskmgr DESTINATION reactos/system32 FOR all) diff --git a/base/applications/taskmgr/lang/ja-JP.rc b/base/applications/taskmgr/lang/ja-JP.rc index 57db7b9ad01..ce26ca5fd0a 100644 --- a/base/applications/taskmgr/lang/ja-JP.rc +++ b/base/applications/taskmgr/lang/ja-JP.rc @@ -4,7 +4,6 @@ #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN) #ifdef _WIN32 LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT -#pragma code_page(65001) #endif //_WIN32 #define IDS_PHYSICAL_MEMORY_AVAILABLE 1067 ///////////////////////////////////////////////////////////////////////////// diff --git a/base/applications/taskmgr/lang/ro-RO.rc b/base/applications/taskmgr/lang/ro-RO.rc index 3983c3b5cba..76f4acb9c99 100644 --- a/base/applications/taskmgr/lang/ro-RO.rc +++ b/base/applications/taskmgr/lang/ro-RO.rc @@ -4,7 +4,6 @@ #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) #ifdef _WIN32 LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL -#pragma code_page(65001) #endif //_WIN32 ///////////////////////////////////////////////////////////////////////////// @@ -652,8 +651,6 @@ BEGIN IDS_Running "Rulează" END - -#pragma code_page(1252) #endif // Romanian resources ///////////////////////////////////////////////////////////////////////////// diff --git a/base/applications/taskmgr/lang/ru-RU.rc b/base/applications/taskmgr/lang/ru-RU.rc index 97d9215ac84..9ab90e029b0 100644 --- a/base/applications/taskmgr/lang/ru-RU.rc +++ b/base/applications/taskmgr/lang/ru-RU.rc @@ -3,95 +3,94 @@ #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) #ifdef _WIN32 LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT -#pragma code_page(1251) #endif //_WIN32 ///////////////////////////////////////////////////////////////////////////// // -// +// Меню // IDR_TASKMANAGER MENU DISCARDABLE BEGIN - POPUP "&" + POPUP "&Файл" BEGIN - MENUITEM "& (...)", ID_FILE_NEW + MENUITEM "&Новая задача (Выполнить...)", ID_FILE_NEW MENUITEM SEPARATOR - MENUITEM "& ", ID_FILE_EXIT + MENUITEM "&Завершение диспетчера задач", ID_FILE_EXIT END - POPUP "&" + POPUP "&Параметры" BEGIN - MENUITEM "& ", ID_OPTIONS_ALWAYSONTOP + MENUITEM "Пове&рх остальных окон", ID_OPTIONS_ALWAYSONTOP , CHECKED - MENUITEM "& ", ID_OPTIONS_MINIMIZEONUSE + MENUITEM "&Сворачивать после обращения", ID_OPTIONS_MINIMIZEONUSE , CHECKED - MENUITEM "& ", ID_OPTIONS_HIDEWHENMINIMIZED + MENUITEM "С&крывать свернутое", ID_OPTIONS_HIDEWHENMINIMIZED , CHECKED - MENUITEM "& 16- ", ID_OPTIONS_SHOW16BITTASKS + MENUITEM "&Отображать 16-разрядные задачи", ID_OPTIONS_SHOW16BITTASKS , CHECKED END - POPUP "&" + POPUP "&Вид" BEGIN - MENUITEM "&", ID_VIEW_REFRESH - POPUP "& " + MENUITEM "&Обновить", ID_VIEW_REFRESH + POPUP "&Скорость обновления" BEGIN - MENUITEM "&", ID_VIEW_UPDATESPEED_HIGH - MENUITEM "&", ID_VIEW_UPDATESPEED_NORMAL + MENUITEM "&Высокая", ID_VIEW_UPDATESPEED_HIGH + MENUITEM "О&бычная", ID_VIEW_UPDATESPEED_NORMAL , CHECKED - MENUITEM "&", ID_VIEW_UPDATESPEED_LOW - MENUITEM "&", ID_VIEW_UPDATESPEED_PAUSED + MENUITEM "&Низкая", ID_VIEW_UPDATESPEED_LOW + MENUITEM "&Приостановить", ID_VIEW_UPDATESPEED_PAUSED END MENUITEM SEPARATOR - MENUITEM "& ", ID_VIEW_LARGE - MENUITEM "& ", ID_VIEW_SMALL - MENUITEM "&", ID_VIEW_DETAILS, CHECKED - MENUITEM "& ...", ID_VIEW_SELECTCOLUMNS - POPUP "& " + MENUITEM "&Крупные значки", ID_VIEW_LARGE + MENUITEM "&Мелкие значки", ID_VIEW_SMALL + MENUITEM "&Таблица", ID_VIEW_DETAILS, CHECKED + MENUITEM "&Выбрать столбцы...", ID_VIEW_SELECTCOLUMNS + POPUP "&Загрузка ЦП" BEGIN - MENUITEM "& ", ID_VIEW_CPUHISTORY_ONEGRAPHALL + MENUITEM "&Один график на все ЦП", ID_VIEW_CPUHISTORY_ONEGRAPHALL - MENUITEM "& ", ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU + MENUITEM "&По графику на каждый ЦП", ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU , CHECKED END - MENUITEM "& ", ID_VIEW_SHOWKERNELTIMES + MENUITEM "&Вывод времени ядра", ID_VIEW_SHOWKERNELTIMES END - POPUP "&" + POPUP "&Окна" BEGIN - MENUITEM "& ", ID_WINDOWS_TILEHORIZONTALLY - MENUITEM "& ", ID_WINDOWS_TILEVERTICALLY - MENUITEM "&", ID_WINDOWS_MINIMIZE - MENUITEM "&", ID_WINDOWS_MAXIMIZE - MENUITEM "&", ID_WINDOWS_CASCADE - MENUITEM "& ", ID_WINDOWS_BRINGTOFRONT + MENUITEM "&Слева направо", ID_WINDOWS_TILEHORIZONTALLY + MENUITEM "С&верху вниз", ID_WINDOWS_TILEVERTICALLY + MENUITEM "Св&ернуть", ID_WINDOWS_MINIMIZE + MENUITEM "&Развернуть", ID_WINDOWS_MAXIMIZE + MENUITEM "&Каскадом", ID_WINDOWS_CASCADE + MENUITEM "&На передний план", ID_WINDOWS_BRINGTOFRONT END - POPUP "&" + POPUP "&Справка" BEGIN - MENUITEM "& ", ID_HELP_TOPICS + MENUITEM "&Вызов справки", ID_HELP_TOPICS MENUITEM SEPARATOR - MENUITEM "& ", ID_HELP_ABOUT + MENUITEM "&О программе", ID_HELP_ABOUT END END IDR_WINDOWSMENU MENU DISCARDABLE BEGIN - MENUITEM "& ", ID_WINDOWS_TILEHORIZONTALLY - MENUITEM "& ", ID_WINDOWS_TILEVERTICALLY - MENUITEM "&", ID_WINDOWS_MINIMIZE - MENUITEM "&", ID_WINDOWS_MAXIMIZE - MENUITEM "&", ID_WINDOWS_CASCADE - MENUITEM "& ", ID_WINDOWS_BRINGTOFRONT + MENUITEM "&Слева направо", ID_WINDOWS_TILEHORIZONTALLY + MENUITEM "С&верху вниз", ID_WINDOWS_TILEVERTICALLY + MENUITEM "Св&ернуть", ID_WINDOWS_MINIMIZE + MENUITEM "&Развернуть", ID_WINDOWS_MAXIMIZE + MENUITEM "&Каскадом", ID_WINDOWS_CASCADE + MENUITEM "&На передний план", ID_WINDOWS_BRINGTOFRONT END IDR_APPLICATION_PAGE_CONTEXT1 MENU DISCARDABLE BEGIN POPUP "DUMMY" BEGIN - MENUITEM "& (...)", ID_FILE_NEW + MENUITEM "&Новая задача (Выполнить...)", ID_FILE_NEW MENUITEM SEPARATOR - MENUITEM "& ", ID_VIEW_LARGE - MENUITEM "& ", ID_VIEW_SMALL - MENUITEM "&", ID_VIEW_DETAILS, CHECKED + MENUITEM "&Крупные значки", ID_VIEW_LARGE + MENUITEM "&Мелкие значки", ID_VIEW_SMALL + MENUITEM "&Таблица", ID_VIEW_DETAILS, CHECKED END END @@ -99,17 +98,17 @@ IDR_APPLICATION_PAGE_CONTEXT2 MENU DISCARDABLE BEGIN POPUP "DUMMY" BEGIN - MENUITEM "&", ID_APPLICATION_PAGE_SWITCHTO - MENUITEM "& ", ID_WINDOWS_BRINGTOFRONT + MENUITEM "&Переключиться", ID_APPLICATION_PAGE_SWITCHTO + MENUITEM "&На передний план", ID_WINDOWS_BRINGTOFRONT MENUITEM SEPARATOR - MENUITEM "& ", ID_WINDOWS_TILEHORIZONTALLY - MENUITEM "& ", ID_WINDOWS_TILEVERTICALLY - MENUITEM "&", ID_WINDOWS_MINIMIZE - MENUITEM "&", ID_WINDOWS_MAXIMIZE - MENUITEM "&", ID_WINDOWS_CASCADE + MENUITEM "&Слева направо", ID_WINDOWS_TILEHORIZONTALLY + MENUITEM "С&верху вниз", ID_WINDOWS_TILEVERTICALLY + MENUITEM "Св&ернуть", ID_WINDOWS_MINIMIZE + MENUITEM "&Развернуть", ID_WINDOWS_MAXIMIZE + MENUITEM "&Каскадом", ID_WINDOWS_CASCADE MENUITEM SEPARATOR - MENUITEM "& ", ID_APPLICATION_PAGE_ENDTASK - MENUITEM " &", ID_APPLICATION_PAGE_GOTOPROCESS + MENUITEM "Сня&ть задачу", ID_APPLICATION_PAGE_ENDTASK + MENUITEM "Перейти к процесса&м", ID_APPLICATION_PAGE_GOTOPROCESS END END @@ -118,10 +117,10 @@ IDR_TRAY_POPUP MENU DISCARDABLE BEGIN POPUP "DUMMY" BEGIN - MENUITEM "&", ID_RESTORE - MENUITEM "&", ID_FILE_EXIT + MENUITEM "&Востановить", ID_RESTORE + MENUITEM "&Закрыть", ID_FILE_EXIT MENUITEM SEPARATOR - MENUITEM "& ", ID_OPTIONS_ALWAYSONTOP + MENUITEM "&Поверх остальных окон", ID_OPTIONS_ALWAYSONTOP END END @@ -129,35 +128,35 @@ IDR_PROCESS_PAGE_CONTEXT MENU DISCARDABLE BEGIN POPUP "DUMMY" BEGIN - MENUITEM "& ", ID_PROCESS_PAGE_ENDPROCESS - MENUITEM "& ", ID_PROCESS_PAGE_ENDPROCESSTREE + MENUITEM "&Заверщить процесс", ID_PROCESS_PAGE_ENDPROCESS + MENUITEM "З&авершить дерево процессов", ID_PROCESS_PAGE_ENDPROCESSTREE - MENUITEM "&", ID_PROCESS_PAGE_DEBUG + MENUITEM "&Отладка", ID_PROCESS_PAGE_DEBUG MENUITEM SEPARATOR - POPUP "&" + POPUP "&Приоритет" BEGIN - MENUITEM "& ", ID_PROCESS_PAGE_SETPRIORITY_REALTIME + MENUITEM "&Реального времени", ID_PROCESS_PAGE_SETPRIORITY_REALTIME - MENUITEM "&", ID_PROCESS_PAGE_SETPRIORITY_HIGH + MENUITEM "&Высокий", ID_PROCESS_PAGE_SETPRIORITY_HIGH - MENUITEM "& ", ID_PROCESS_PAGE_SETPRIORITY_ABOVENORMAL + MENUITEM "В&ыше среднего", ID_PROCESS_PAGE_SETPRIORITY_ABOVENORMAL - MENUITEM "&", ID_PROCESS_PAGE_SETPRIORITY_NORMAL + MENUITEM "&Средний", ID_PROCESS_PAGE_SETPRIORITY_NORMAL - MENUITEM "& ", ID_PROCESS_PAGE_SETPRIORITY_BELOWNORMAL + MENUITEM "&Ниже среднего", ID_PROCESS_PAGE_SETPRIORITY_BELOWNORMAL - MENUITEM "&", ID_PROCESS_PAGE_SETPRIORITY_LOW + MENUITEM "Н&изкий", ID_PROCESS_PAGE_SETPRIORITY_LOW END - MENUITEM "& ...", ID_PROCESS_PAGE_SETAFFINITY - MENUITEM " &...", ID_PROCESS_PAGE_DEBUGCHANNELS + MENUITEM "&Задать соответствие...", ID_PROCESS_PAGE_SETAFFINITY + MENUITEM "Редактировать отладку &потоков...", ID_PROCESS_PAGE_DEBUGCHANNELS END END ///////////////////////////////////////////////////////////////////////////// // -// +// Диалоги // // TRANSLATORS: CAPTION must be the same as IDS_APP_TITLE to be brought back to focus when already opened @@ -165,7 +164,7 @@ IDD_TASKMGR_DIALOG DIALOGEX DISCARDABLE 0, 0, 264, 246 STYLE DS_SHELLFONT | DS_CENTER | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME -CAPTION " " +CAPTION "Диспетчер задач" MENU IDR_TASKMANAGER FONT 8, "MS Shell Dlg" BEGIN @@ -178,9 +177,9 @@ FONT 8, "MS Shell Dlg" BEGIN CONTROL "List2",IDC_APPLIST,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP,7,7,233,177 - PUSHBUTTON "& ...",IDC_NEWTASK,167,189,73,14 - PUSHBUTTON "&",IDC_SWITCHTO,89,189,73,14,WS_DISABLED - PUSHBUTTON "& ",IDC_ENDTASK,12,189,73,14,WS_DISABLED + PUSHBUTTON "&Новая задача...",IDC_NEWTASK,167,189,73,14 + PUSHBUTTON "&Переключиться",IDC_SWITCHTO,89,189,73,14,WS_DISABLED + PUSHBUTTON "&Завершить задачу",IDC_ENDTASK,12,189,73,14,WS_DISABLED END IDD_PROCESS_PAGE DIALOGEX DISCARDABLE 0, 0, 247, 210 @@ -190,8 +189,8 @@ BEGIN CONTROL "List2",IDC_PROCESSLIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP,7,7,233,177 - PUSHBUTTON "& ",IDC_ENDPROCESS,162,189,79,14 - CONTROL "& ",IDC_SHOWALLPROCESSES, + PUSHBUTTON "&Завершить процесс",IDC_ENDPROCESS,162,189,79,14 + CONTROL "&Процессы всех пользователей",IDC_SHOWALLPROCESSES, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,191,153,10 END @@ -200,204 +199,204 @@ IDD_PERFORMANCE_PAGE DIALOGEX DISCARDABLE 0, 0, 247, 210 STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ",IDC_CPU_USAGE_FRAME,5,5,60,54,0,WS_EX_TRANSPARENT - GROUPBOX " ",IDC_MEM_USAGE_FRAME,5,63,60,54,BS_LEFTTEXT, WS_EX_TRANSPARENT - GROUPBOX "",IDC_TOTALS_FRAME,5,122,111,39,0,WS_EX_TRANSPARENT - GROUPBOX " (K)",IDC_COMMIT_CHARGE_FRAME,5,166,111,39,0,WS_EX_TRANSPARENT - GROUPBOX " (K)",IDC_PHYSICAL_MEMORY_FRAME,131,122,111,39,0,WS_EX_TRANSPARENT - GROUPBOX " (K)",IDC_KERNEL_MEMORY_FRAME,131,166,111,39,0,WS_EX_TRANSPARENT - LTEXT "",IDS_TOTALS_HANDLE_COUNT,12,131,57,8 - LTEXT "",IDS_TOTALS_THREAD_COUNT,12,140,30,8 - LTEXT "",IDS_TOTALS_PROCESS_COUNT,12,149,34,8 + GROUPBOX "Загрузка ЦП",IDC_CPU_USAGE_FRAME,5,5,60,54,0,WS_EX_TRANSPARENT + GROUPBOX "Файл подкачки",IDC_MEM_USAGE_FRAME,5,63,60,54,BS_LEFTTEXT, WS_EX_TRANSPARENT + GROUPBOX "Всего",IDC_TOTALS_FRAME,5,122,111,39,0,WS_EX_TRANSPARENT + GROUPBOX "Выделение памяти (K)",IDC_COMMIT_CHARGE_FRAME,5,166,111,39,0,WS_EX_TRANSPARENT + GROUPBOX "Физическая память (K)",IDC_PHYSICAL_MEMORY_FRAME,131,122,111,39,0,WS_EX_TRANSPARENT + GROUPBOX "Память ядра (K)",IDC_KERNEL_MEMORY_FRAME,131,166,111,39,0,WS_EX_TRANSPARENT + LTEXT "Дескрипторов",IDS_TOTALS_HANDLE_COUNT,12,131,57,8 + LTEXT "Потоков",IDS_TOTALS_THREAD_COUNT,12,140,30,8 + LTEXT "Процессов",IDS_TOTALS_PROCESS_COUNT,12,149,34,8 EDITTEXT IDC_TOTALS_HANDLE_COUNT,65,131,45,8,ES_RIGHT | ES_READONLY | ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP EDITTEXT IDC_TOTALS_THREAD_COUNT,65,140,45,8,ES_RIGHT | ES_READONLY | ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP EDITTEXT IDC_TOTALS_PROCESS_COUNT,65,149,45,8,ES_RIGHT | ES_READONLY | ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP - LTEXT "",IDS_COMMIT_CHARGE_TOTAL,12,175,27,8 - LTEXT "",IDS_COMMIT_CHARGE_LIMIT,12,184,27,8,NOT WS_BORDER - LTEXT "",IDS_COMMIT_CHARGE_PEAK,12,193,34,8 + LTEXT "Всего",IDS_COMMIT_CHARGE_TOTAL,12,175,27,8 + LTEXT "Предел",IDS_COMMIT_CHARGE_LIMIT,12,184,27,8,NOT WS_BORDER + LTEXT "Пик",IDS_COMMIT_CHARGE_PEAK,12,193,34,8 EDITTEXT IDC_COMMIT_CHARGE_TOTAL,65,174,45,8,ES_RIGHT | ES_READONLY | ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP EDITTEXT IDC_COMMIT_CHARGE_LIMIT,65,184,45,8,ES_RIGHT | ES_READONLY | ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP EDITTEXT IDC_COMMIT_CHARGE_PEAK,65,193,45,8,ES_RIGHT | ES_READONLY | ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP - LTEXT "",IDS_PHYSICAL_MEMORY_TOTAL,137,131,27,8 - LTEXT "",IDS_PHYSICAL_MEMORY_AVAILABLE,137,140,33,8 - LTEXT " ",IDS_PHYSICAL_MEMORY_SYSTEM_CACHE,137,149,62,8 + LTEXT "Всего",IDS_PHYSICAL_MEMORY_TOTAL,137,131,27,8 + LTEXT "Доступно",IDS_PHYSICAL_MEMORY_AVAILABLE,137,140,33,8 + LTEXT "Системный кеш",IDS_PHYSICAL_MEMORY_SYSTEM_CACHE,137,149,62,8 EDITTEXT IDC_PHYSICAL_MEMORY_TOTAL,192,131,41,8,ES_RIGHT | ES_READONLY | ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP EDITTEXT IDC_PHYSICAL_MEMORY_AVAILABLE,185,140,48,8,ES_RIGHT | ES_READONLY | ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP EDITTEXT IDC_PHYSICAL_MEMORY_SYSTEM_CACHE,185,149,48,8,ES_RIGHT | ES_READONLY | ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP - LTEXT "",IDS_KERNEL_MEMORY_TOTAL,137,174,27,8 - LTEXT "",IDS_KERNEL_MEMORY_PAGED,137,184,50,8 - LTEXT "",IDS_KERNEL_MEMORY_NONPAGED,137,193,62,8 + LTEXT "Всего",IDS_KERNEL_MEMORY_TOTAL,137,174,27,8 + LTEXT "Выгружаемая",IDS_KERNEL_MEMORY_PAGED,137,184,50,8 + LTEXT "Невыгружаемая",IDS_KERNEL_MEMORY_NONPAGED,137,193,62,8 EDITTEXT IDC_KERNEL_MEMORY_TOTAL,192,174,41,8,ES_RIGHT | ES_READONLY | ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP EDITTEXT IDC_KERNEL_MEMORY_PAGED,185,184,48,8,ES_RIGHT | ES_READONLY | ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP EDITTEXT IDC_KERNEL_MEMORY_NONPAGED,185,193,48,8,ES_RIGHT | ES_READONLY | ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP - GROUPBOX " ",IDC_CPU_USAGE_HISTORY_FRAME,74,5,168,54,0,WS_EX_TRANSPARENT - GROUPBOX " ",IDC_MEMORY_USAGE_HISTORY_FRAME,74,63,168,54,0,WS_EX_TRANSPARENT - PUSHBUTTON " ",IDC_CPU_USAGE_GRAPH,12,17,47,37,NOT WS_TABSTOP, + GROUPBOX "Хронология загрузки ЦП",IDC_CPU_USAGE_HISTORY_FRAME,74,5,168,54,0,WS_EX_TRANSPARENT + GROUPBOX "Хронология использования файла подкачки",IDC_MEMORY_USAGE_HISTORY_FRAME,74,63,168,54,0,WS_EX_TRANSPARENT + PUSHBUTTON "Отображение загрузки ЦП",IDC_CPU_USAGE_GRAPH,12,17,47,37,NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON " ",IDC_MEM_USAGE_GRAPH,12,75,47,37,NOT WS_TABSTOP, + PUSHBUTTON "Отображение использования памяти",IDC_MEM_USAGE_GRAPH,12,75,47,37,NOT WS_TABSTOP, WS_EX_CLIENTEDGE - PUSHBUTTON " ",IDC_CPU_USAGE_HISTORY_GRAPH,81,17, + PUSHBUTTON "Хронология загрузки ЦП",IDC_CPU_USAGE_HISTORY_GRAPH,81,17, 153,37,NOT WS_TABSTOP,WS_EX_CLIENTEDGE - PUSHBUTTON " ",IDC_MEM_USAGE_HISTORY_GRAPH,81,75, + PUSHBUTTON "Хронология использования памяти",IDC_MEM_USAGE_HISTORY_GRAPH,81,75, 153,37,NOT WS_TABSTOP,WS_EX_CLIENTEDGE END IDD_DEBUG_CHANNELS_DIALOG DIALOGEX DISCARDABLE 0, 0, 247, 210 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Отладка потоков" FONT 8, "MS Shell Dlg" BEGIN CONTROL "List2",IDC_DEBUG_CHANNELS_LIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP | LVS_SORTASCENDING,7,7,233,177 - PUSHBUTTON "",IDOK,171,189,69,14 + PUSHBUTTON "Закрыть",IDOK,171,189,69,14 END IDD_AFFINITY_DIALOG DIALOGEX DISCARDABLE 0, 0, 231, 154 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Семейство процессоров" FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "OK",IDOK,124,133,50,14 - PUSHBUTTON "",IDCANCEL,178,133,50,14 - LTEXT " , .", + PUSHBUTTON "Отмена",IDCANCEL,178,133,50,14 + LTEXT "Установка процессоров, на которых будет выполняться задача.", IDC_STATIC,5,5,220,16 - CONTROL " 0",IDC_CPU0,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, + CONTROL "ЦП 0",IDC_CPU0,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, 11,28,37,10 - CONTROL " 1",IDC_CPU1,"Button",BS_AUTOCHECKBOX | WS_DISABLED | + CONTROL "ЦП 1",IDC_CPU1,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,11,41,37,10 - CONTROL " 2",IDC_CPU2,"Button",BS_AUTOCHECKBOX | WS_DISABLED | + CONTROL "ЦП 2",IDC_CPU2,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,11,54,37,10 - CONTROL " 3",IDC_CPU3,"Button",BS_AUTOCHECKBOX | WS_DISABLED | + CONTROL "ЦП 3",IDC_CPU3,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,11,67,37,10 - CONTROL " 4",IDC_CPU4,"Button",BS_AUTOCHECKBOX | WS_DISABLED | + CONTROL "ЦП 4",IDC_CPU4,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,11,80,37,10 - CONTROL " 5",IDC_CPU5,"Button",BS_AUTOCHECKBOX | WS_DISABLED | + CONTROL "ЦП 5",IDC_CPU5,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,11,93,37,10 - CONTROL " 6",IDC_CPU6,"Button",BS_AUTOCHECKBOX | WS_DISABLED | + CONTROL "ЦП 6",IDC_CPU6,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,11,106,37,10 - CONTROL " 7",IDC_CPU7,"Button",BS_AUTOCHECKBOX | WS_DISABLED | + CONTROL "ЦП 7",IDC_CPU7,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,11,119,37,10 - CONTROL " 8",IDC_CPU8,"Button",BS_AUTOCHECKBOX | WS_DISABLED | + CONTROL "ЦП 8",IDC_CPU8,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,61,28,37,10 - CONTROL " 9",IDC_CPU9,"Button",BS_AUTOCHECKBOX | WS_DISABLED | + CONTROL "ЦП 9",IDC_CPU9,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,61,41,37,10 - CONTROL " 10",IDC_CPU10,"Button",BS_AUTOCHECKBOX | + CONTROL "ЦП 10",IDC_CPU10,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,61,54,41,10 - CONTROL " 11",IDC_CPU11,"Button",BS_AUTOCHECKBOX | + CONTROL "ЦП 11",IDC_CPU11,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,61,67,41,10 - CONTROL " 12",IDC_CPU12,"Button",BS_AUTOCHECKBOX | + CONTROL "ЦП 12",IDC_CPU12,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,61,80,41,10 - CONTROL " 13",IDC_CPU13,"Button",BS_AUTOCHECKBOX | + CONTROL "ЦП 13",IDC_CPU13,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,61,93,41,10 - CONTROL " 14",IDC_CPU14,"Button",BS_AUTOCHECKBOX | + CONTROL "ЦП 14",IDC_CPU14,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,61,106,41,10 - CONTROL " 15",IDC_CPU15,"Button",BS_AUTOCHECKBOX | + CONTROL "ЦП 15",IDC_CPU15,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,61,119,41,10 - CONTROL " 16",IDC_CPU16,"Button",BS_AUTOCHECKBOX | + CONTROL "ЦП 16",IDC_CPU16,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,116,28,41,10 - CONTROL " 17",IDC_CPU17,"Button",BS_AUTOCHECKBOX | + CONTROL "ЦП 17",IDC_CPU17,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,116,41,41,10 - CONTROL " 18",IDC_CPU18,"Button",BS_AUTOCHECKBOX | + CONTROL "ЦП 18",IDC_CPU18,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,116,54,41,10 - CONTROL " 19",IDC_CPU19,"Button",BS_AUTOCHECKBOX | + CONTROL "ЦП 19",IDC_CPU19,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,116,67,41,10 - CONTROL " 20",IDC_CPU20,"Button",BS_AUTOCHECKBOX | + CONTROL "ЦП 20",IDC_CPU20,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,116,80,41,10 - CONTROL " 21",IDC_CPU21,"Button",BS_AUTOCHECKBOX | + CONTROL "ЦП 21",IDC_CPU21,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,116,93,41,10 - CONTROL " 22",IDC_CPU22,"Button",BS_AUTOCHECKBOX | + CONTROL "ЦП 22",IDC_CPU22,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,116,106,41,10 - CONTROL " 23",IDC_CPU23,"Button",BS_AUTOCHECKBOX | + CONTROL "ЦП 23",IDC_CPU23,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,116,119,41,10 - CONTROL " 24",IDC_CPU24,"Button",BS_AUTOCHECKBOX | + CONTROL "ЦП 24",IDC_CPU24,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,175,28,41,10 - CONTROL " 25",IDC_CPU25,"Button",BS_AUTOCHECKBOX | + CONTROL "ЦП 25",IDC_CPU25,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,175,41,41,10 - CONTROL " 26",IDC_CPU26,"Button",BS_AUTOCHECKBOX | + CONTROL "ЦП 26",IDC_CPU26,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,175,54,41,10 - CONTROL " 27",IDC_CPU27,"Button",BS_AUTOCHECKBOX | + CONTROL "ЦП 27",IDC_CPU27,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,175,67,41,10 - CONTROL " 28",IDC_CPU28,"Button",BS_AUTOCHECKBOX | + CONTROL "ЦП 28",IDC_CPU28,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,175,80,41,10 - CONTROL " 29",IDC_CPU29,"Button",BS_AUTOCHECKBOX | + CONTROL "ЦП 29",IDC_CPU29,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,175,93,41,10 - CONTROL " 30",IDC_CPU30,"Button",BS_AUTOCHECKBOX | + CONTROL "ЦП 30",IDC_CPU30,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,175,106,41,10 - CONTROL " 31",IDC_CPU31,"Button",BS_AUTOCHECKBOX | + CONTROL "ЦП 31",IDC_CPU31,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,175,119,41,10 END IDD_COLUMNS_DIALOG DIALOGEX DISCARDABLE 0, 0, 230, 199 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Выбор столбцов" FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "OK",IDOK,113,178,50,14 - PUSHBUTTON "",IDCANCEL,167,178,50,14 - LTEXT " , .", + PUSHBUTTON "Отмена",IDCANCEL,167,178,50,14 + LTEXT "Выбор столбцов, отображаемых в списке диспетчера задач.", IDC_STATIC,7,7,220,17 - CONTROL "& ",IDC_IMAGENAME,"Button",BS_AUTOCHECKBOX | + CONTROL "&Имя образа",IDC_IMAGENAME,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,7,28,56,10 - CONTROL "PID (&. )",IDC_PID,"Button", + CONTROL "PID (иденти&ф. процесса)",IDC_PID,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,7,39,95,10 - CONTROL "& ",IDC_CPUUSAGE,"Button",BS_AUTOCHECKBOX | + CONTROL "&Загрузка ЦП",IDC_CPUUSAGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,50,55,10 - CONTROL "& ",IDC_CPUTIME,"Button",BS_AUTOCHECKBOX | + CONTROL "&Время ЦП",IDC_CPUTIME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,61,48,10 - CONTROL "& - ",IDC_MEMORYUSAGE,"Button",BS_AUTOCHECKBOX | + CONTROL "&Память - использование",IDC_MEMORYUSAGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,72,95,10 - CONTROL " - &",IDC_MEMORYUSAGEDELTA,"Button", + CONTROL "Память - изме&нение",IDC_MEMORYUSAGEDELTA,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,7,83,82,10 - CONTROL " - &",IDC_PEAKMEMORYUSAGE,"Button", + CONTROL "Память - &максимум",IDC_PEAKMEMORYUSAGE,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,7,94,82,10 - CONTROL "& ",IDC_PAGEFAULTS,"Button",BS_AUTOCHECKBOX | + CONTROL "&Ошибок страницы",IDC_PAGEFAULTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,105,90,10 - CONTROL "& USER",IDC_USEROBJECTS,"Button",BS_AUTOCHECKBOX | + CONTROL "Об&ъекты USER",IDC_USEROBJECTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,116,65,10 - CONTROL " ",IDC_IOREADS,"Button",BS_AUTOCHECKBOX | + CONTROL "Число чтений",IDC_IOREADS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,127,60,10 - CONTROL " ",IDC_IOREADBYTES,"Button", + CONTROL "Прочитано байт",IDC_IOREADBYTES,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,7,138,65,10 - CONTROL " &",IDC_SESSIONID,"Button",BS_AUTOCHECKBOX | + CONTROL "Код се&анса",IDC_SESSIONID,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,149,50,10 - CONTROL "& ",IDC_USERNAME,"Button",BS_AUTOCHECKBOX | + CONTROL "Им&я пользователя",IDC_USERNAME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,160,80,10 - CONTROL " & - ",IDC_PAGEFAULTSDELTA,"Button", + CONTROL "Ошибок &страницы - изменение",IDC_PAGEFAULTSDELTA,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,107,28,120,10 - CONTROL " & ",IDC_VIRTUALMEMORYSIZE,"Button", + CONTROL "Объем вирт&уальной памяти",IDC_VIRTUALMEMORYSIZE,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,107,39,110,10 - CONTROL "& ",IDC_PAGEDPOOL,"Button",BS_AUTOCHECKBOX | + CONTROL "Вы&гружаемый пул",IDC_PAGEDPOOL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,107,50,90,10 - CONTROL "& ",IDC_NONPAGEDPOOL,"Button", + CONTROL "Невыгр&ужаемый пул",IDC_NONPAGEDPOOL,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,107,61,90,10 - CONTROL "& ",IDC_BASEPRIORITY,"Button", + CONTROL "&Базовый приоритет",IDC_BASEPRIORITY,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,107,72,90,10 - CONTROL " &",IDC_HANDLECOUNT,"Button",BS_AUTOCHECKBOX | + CONTROL "Счетчик &дескрипторов",IDC_HANDLECOUNT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,107,83,90,10 - CONTROL "& ",IDC_THREADCOUNT,"Button",BS_AUTOCHECKBOX | + CONTROL "С&четчик потоков",IDC_THREADCOUNT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,107,94,69,10 - CONTROL "& GDI",IDC_GDIOBJECTS,"Button",BS_AUTOCHECKBOX | + CONTROL "Объ&екты GDI",IDC_GDIOBJECTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,107,105,58,10 - CONTROL " ",IDC_IOWRITES,"Button",BS_AUTOCHECKBOX | + CONTROL "Число записей",IDC_IOWRITES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,107,116,65,10 - CONTROL " ",IDC_IOWRITEBYTES,"Button", + CONTROL "Записано байт",IDC_IOWRITEBYTES,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,107,127,65,10 - CONTROL " -",IDC_IOOTHER,"Button",BS_AUTOCHECKBOX | + CONTROL "Прочий ввод-вывод",IDC_IOOTHER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,107,138,90,10 - CONTROL " -",IDC_IOOTHERBYTES,"Button", + CONTROL "Прочих байт при вводе-выводе",IDC_IOOTHERBYTES,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,107,149,122,10 END @@ -522,135 +521,135 @@ END STRINGTABLE DISCARDABLE BEGIN - IDS_APP_TITLE " " - IDC_TASKMGR " " - IDS_IDLE_PROCESS " " + IDS_APP_TITLE "Диспетчер задач" + IDC_TASKMGR "Диспетчер задач" + IDS_IDLE_PROCESS "Бездействие системы" END STRINGTABLE DISCARDABLE BEGIN - ID_FILE_NEW " " - ID_OPTIONS_ALWAYSONTOP " , " + ID_FILE_NEW "Создать новую задачу" + ID_OPTIONS_ALWAYSONTOP "Менеджер задач остается поверх всех окон, если не свернут" ID_OPTIONS_MINIMIZEONUSE - " " - ID_OPTIONS_HIDEWHENMINIMIZED " " - ID_VIEW_REFRESH " " - ID_VIEW_LARGE " " - ID_VIEW_SMALL " " - ID_VIEW_DETAILS " " - ID_VIEW_UPDATESPEED_HIGH " " - ID_VIEW_UPDATESPEED_NORMAL " " - ID_VIEW_UPDATESPEED_LOW " " + "Менеджер задач сворачивается после выполения команды Переключиться" + ID_OPTIONS_HIDEWHENMINIMIZED "Скрытие Менеждера задач при свертывании" + ID_VIEW_REFRESH "Обновление Менеджера задач вне зависимости от установленной скорости обновления" + ID_VIEW_LARGE "Отображать задачи использую большие значки" + ID_VIEW_SMALL "Отображать задачи использую маленькие значки" + ID_VIEW_DETAILS "Показывать информацию о каждой задаче" + ID_VIEW_UPDATESPEED_HIGH "Обновлять каждую секунду" + ID_VIEW_UPDATESPEED_NORMAL "Обновлять каждые две секунды" + ID_VIEW_UPDATESPEED_LOW "Обновлять каждые четыре секунды" END STRINGTABLE DISCARDABLE BEGIN - ID_VIEW_UPDATESPEED_PAUSED " " + ID_VIEW_UPDATESPEED_PAUSED "Не обновлять автоматически" ID_WINDOWS_TILEHORIZONTALLY - " " - ID_WINDOWS_TILEVERTICALLY " " - ID_WINDOWS_MINIMIZE " " - ID_WINDOWS_MAXIMIZE " " - ID_WINDOWS_CASCADE " " - ID_WINDOWS_BRINGTOFRONT " , " - ID_HELP_TOPICS " " - ID_HELP_ABOUT " , " - ID_FILE_EXIT " " + "Окна располагаются горизонтально на рабочем столе" + ID_WINDOWS_TILEVERTICALLY "Окна располагаются вертикально на рабочем столе" + ID_WINDOWS_MINIMIZE "Свернуть окна" + ID_WINDOWS_MAXIMIZE "Развернуть окна" + ID_WINDOWS_CASCADE "Окна каскадом по диагонали на рабочем столе" + ID_WINDOWS_BRINGTOFRONT "Переносит осно на передний план, но не переключается на него" + ID_HELP_TOPICS "Показать помощь для диспетчера задач" + ID_HELP_ABOUT "Показать информацию о программе, версии и авторе" + ID_FILE_EXIT "Выход из Диспетчера задач" ID_OPTIONS_SHOW16BITTASKS - " 16- ntvdm.exe" - ID_VIEW_SELECTCOLUMNS " " - ID_VIEW_SHOWKERNELTIMES " " + "Показывать 16-разрядные процессы связанные с ntvdm.exe" + ID_VIEW_SELECTCOLUMNS "Выбирите какие из столбцов будут видны на вкладке процессов" + ID_VIEW_SHOWKERNELTIMES "Показывать график времени ядра" ID_VIEW_CPUHISTORY_ONEGRAPHALL - " " - ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU " " + "Один график показывает хронологию загрузки ЦП" + ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU "Каждый процессор имеет свой график загрузки" ID_APPLICATION_PAGE_SWITCHTO - " " + "Перенести задачу на передний план и переключиться к ней" END STRINGTABLE DISCARDABLE BEGIN - ID_ENDTASK " " - ID_GOTOPROCESS " " - ID_RESTORE " " - ID_PROCESS_PAGE_ENDPROCESS " " + ID_ENDTASK "Сообщает выбранным задачам о необходимости завершиться" + ID_GOTOPROCESS "Переносит выбранный процесс на передний план" + ID_RESTORE "Востанавливает Менеджер задач из скрытого состояния" + ID_PROCESS_PAGE_ENDPROCESS "Завершает процесс в системе" ID_PROCESS_PAGE_ENDPROCESSTREE - " " - ID_PROCESS_PAGE_DEBUG " " + "Завершает процесс и все его дочерние процессы в системе" + ID_PROCESS_PAGE_DEBUG "Прикрепляет отладчик к выбранному процессу" ID_PROCESS_PAGE_SETAFFINITY - " " + "Переключение между процессорами разрешенными для выполнения задачи" ID_PROCESS_PAGE_SETPRIORITY_REALTIME - " " - ID_PROCESS_PAGE_SETPRIORITY_HIGH " " + "Установить для процесса приоритет Реального времени" + ID_PROCESS_PAGE_SETPRIORITY_HIGH "Установить для процесса Высокий приоритет" ID_PROCESS_PAGE_SETPRIORITY_ABOVENORMAL - " " + "Установить для процесса приоритет Выше среднего" ID_PROCESS_PAGE_SETPRIORITY_NORMAL - " " + "Установить для процесса Средний приоритет" ID_PROCESS_PAGE_SETPRIORITY_BELOWNORMAL - " " - ID_PROCESS_PAGE_SETPRIORITY_LOW " " + "Установить для процесса приоритет Ниже среднего" + ID_PROCESS_PAGE_SETPRIORITY_LOW "Установить для процесса Низкий приоритет" END STRINGTABLE DISCARDABLE BEGIN - IDS_TAB_APPS "" - IDS_TAB_PROCESSES "" - IDS_TAB_PERFORMANCE "" - IDS_TAB_TASK "" - IDS_TAB_STATUS "" - IDS_TAB_IMAGENAME " " + IDS_TAB_APPS "Приложения" + IDS_TAB_PROCESSES "Процессы" + IDS_TAB_PERFORMANCE "Быстродействие" + IDS_TAB_TASK "Задача" + IDS_TAB_STATUS "Состояние" + IDS_TAB_IMAGENAME "Имя образа" IDS_TAB_PID "PID" - IDS_TAB_USERNAME " " - IDS_TAB_SESSIONID " " - IDS_TAB_CPU "" - IDS_TAB_CPUTIME " " - IDS_TAB_MEMUSAGE "" - IDS_TAB_PEAKMEMUSAGE " - " - IDS_TAB_MEMDELTA " - " - IDS_TAB_PAGEFAULT " " - IDS_TAB_PFDELTA " PF" - IDS_TAB_VMSIZE " VM" - IDS_TAB_PAGEDPOOL " " - IDS_TAB_NPPOOL "NP " - IDS_TAB_BASEPRI " " - IDS_TAB_HANDLES "" - IDS_TAB_THREADS "" - IDS_TAB_USERPBJECTS " USER" - IDS_TAB_GDIOBJECTS "GDI " - IDS_TAB_IOREADS " " - IDS_TAB_IOWRITES " " - IDS_TAB_IOOTHER " -" - IDS_TAB_IOREADBYTES " " - IDS_TAB_IOWRITESBYTES " " - IDS_TAB_IOOTHERBYTES " -" - IDS_MENU_SELECTCOLUMNS "& ..." - IDS_MENU_16BITTASK "& 16- " - IDS_MENU_WINDOWS "&" - IDS_MENU_LARGEICONS "& " - IDS_MENU_SMALLICONS "& " - IDS_MENU_DETAILS "&" - IDS_MENU_ONEGRAPHALLCPUS "& " - IDS_MENU_ONEGRAPHPERCPU "& " - IDS_MENU_CPUHISTORY "& " - IDS_MENU_SHOWKERNELTIMES "& " - IDS_CREATENEWTASK " " - IDS_CREATENEWTASK_DESC " , ." - IDS_MSG_ACCESSPROCESSAFF " " - IDS_MSG_PROCESSONEPRO " ." - IDS_MSG_INVALIDOPTION " " - IDS_MSG_UNABLEDEBUGPROCESS " " - IDS_MSG_WARNINGDEBUG ": .\n , ?" - IDS_MSG_TASKMGRWARNING " " - IDS_MSG_WARNINGTERMINATING ": \n .\n ?" - IDS_MSG_UNABLETERMINATEPRO " " - IDS_MSG_UNABLECHANGEPRIORITY " " - IDS_MSG_WARNINGCHANGEPRIORITY ": .\n , ?" - IDS_MSG_TRAYICONCPUUSAGE " : %d%%" - IDS_STATUS_MEMUSAGE " : %dK / %dK" - IDS_STATUS_CPUUSAGE " : %3d%%" - IDS_STATUS_PROCESSES ": %d" - IDS_Not_Responding " " - IDS_Running "" + IDS_TAB_USERNAME "Имя пользователя" + IDS_TAB_SESSIONID "Код сеанса" + IDS_TAB_CPU "ЦП" + IDS_TAB_CPUTIME "Время ЦП" + IDS_TAB_MEMUSAGE "Память" + IDS_TAB_PEAKMEMUSAGE "Память - максимум" + IDS_TAB_MEMDELTA "Память - изменение" + IDS_TAB_PAGEFAULT "Ошибок страницы" + IDS_TAB_PFDELTA "Изменение PF" + IDS_TAB_VMSIZE "Размер VM" + IDS_TAB_PAGEDPOOL "Пул страниц" + IDS_TAB_NPPOOL "NP пул" + IDS_TAB_BASEPRI "Базовый приоритет" + IDS_TAB_HANDLES "Дескрипторы" + IDS_TAB_THREADS "Потоки" + IDS_TAB_USERPBJECTS "Объекты USER" + IDS_TAB_GDIOBJECTS "GDI объекты" + IDS_TAB_IOREADS "Число чтений" + IDS_TAB_IOWRITES "Число записей" + IDS_TAB_IOOTHER "Прочий ввод-вывод" + IDS_TAB_IOREADBYTES "Прочитано байт" + IDS_TAB_IOWRITESBYTES "Записано байт" + IDS_TAB_IOOTHERBYTES "Прочих байт при вводе-выводе" + IDS_MENU_SELECTCOLUMNS "&Выбрать столбцы..." + IDS_MENU_16BITTASK "&Показывать 16-разрядные задачи" + IDS_MENU_WINDOWS "&Окна" + IDS_MENU_LARGEICONS "&Крупные значки" + IDS_MENU_SMALLICONS "&Мелкие значки" + IDS_MENU_DETAILS "&Таблица" + IDS_MENU_ONEGRAPHALLCPUS "&Один график для всех процессоров" + IDS_MENU_ONEGRAPHPERCPU "О&тдельный график для каждого процессора" + IDS_MENU_CPUHISTORY "&История ЦП" + IDS_MENU_SHOWKERNELTIMES "&Показать время ядра" + IDS_CREATENEWTASK "Создать новую задачу" + IDS_CREATENEWTASK_DESC "Вывести название программы, папки или документа для открытия в Менеджере задач." + IDS_MSG_ACCESSPROCESSAFF "Не удается получить доступ или установить приоритет процесса" + IDS_MSG_PROCESSONEPRO "Процесс должен иметь доступ по крайней мере к одному процессору." + IDS_MSG_INVALIDOPTION "Неправильные настройки" + IDS_MSG_UNABLEDEBUGPROCESS "Отладка процесса невозможна" + IDS_MSG_WARNINGDEBUG "ВНИМАНИЕ: Отладка этого процесса может закончиться потерей данных.\nВы уверены, что можно продолжать?" + IDS_MSG_TASKMGRWARNING "Ошибка Менеджера задач" + IDS_MSG_WARNINGTERMINATING "ВНИМАНИЕ: Завершение процесса может повлечь неустойчивую работу системы и потерю данных\nСохраните важные данные перед продолжением.\nПродолжить завершение процесса?" + IDS_MSG_UNABLETERMINATEPRO "Не удалось завершить процесс" + IDS_MSG_UNABLECHANGEPRIORITY "Не удалось изменить приоритет" + IDS_MSG_WARNINGCHANGEPRIORITY "ВНИМАНИЕ: Изменение приоритета может повлечь неустойчивую работу и потерю данных.\nВы уверены, что можно продолжать?" + IDS_MSG_TRAYICONCPUUSAGE "Загрузка ЦП: %d%%" + IDS_STATUS_MEMUSAGE "Выделение памяти: %dK / %dK" + IDS_STATUS_CPUUSAGE "Загрузка ЦП: %3d%%" + IDS_STATUS_PROCESSES "Процессов: %d" + IDS_Not_Responding "Не отвечает" + IDS_Running "Работает" END diff --git a/base/applications/taskmgr/lang/uk-UA.rc b/base/applications/taskmgr/lang/uk-UA.rc index cb518e1967a..036518f5d71 100644 --- a/base/applications/taskmgr/lang/uk-UA.rc +++ b/base/applications/taskmgr/lang/uk-UA.rc @@ -4,7 +4,6 @@ #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) #ifdef _WIN32 LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT -#pragma code_page(1251) #endif //_WIN32 ///////////////////////////////////////////////////////////////////////////// @@ -14,85 +13,85 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT IDR_TASKMANAGER MENU DISCARDABLE BEGIN - POPUP "&" + POPUP "&Файл" BEGIN - MENUITEM "& (...)", ID_FILE_NEW + MENUITEM "&Нове завдання (Виконати...)", ID_FILE_NEW MENUITEM SEPARATOR - MENUITEM "& ", ID_FILE_EXIT + MENUITEM "&Завершення диспетчера завдань", ID_FILE_EXIT END - POPUP "&" + POPUP "&Параметри" BEGIN - MENUITEM "& ", ID_OPTIONS_ALWAYSONTOP + MENUITEM "&Поверх інших вікон", ID_OPTIONS_ALWAYSONTOP , CHECKED - MENUITEM "& ", ID_OPTIONS_MINIMIZEONUSE + MENUITEM "&Згортати після звернення", ID_OPTIONS_MINIMIZEONUSE , CHECKED - MENUITEM "& ", ID_OPTIONS_HIDEWHENMINIMIZED + MENUITEM "При&ховувати згорнуте", ID_OPTIONS_HIDEWHENMINIMIZED , CHECKED - MENUITEM "&³ 16- ", ID_OPTIONS_SHOW16BITTASKS + MENUITEM "&Відображати 16-розрядні завдання", ID_OPTIONS_SHOW16BITTASKS , CHECKED END - POPUP "&" + POPUP "&Вигляд" BEGIN - MENUITEM "&", ID_VIEW_REFRESH - POPUP "& " + MENUITEM "&Оновити", ID_VIEW_REFRESH + POPUP "&Швидкість оновлення" BEGIN - MENUITEM "&", ID_VIEW_UPDATESPEED_HIGH - MENUITEM "&", ID_VIEW_UPDATESPEED_NORMAL + MENUITEM "&Висока", ID_VIEW_UPDATESPEED_HIGH + MENUITEM "&Звичайна", ID_VIEW_UPDATESPEED_NORMAL , CHECKED - MENUITEM "&", ID_VIEW_UPDATESPEED_LOW - MENUITEM "&", ID_VIEW_UPDATESPEED_PAUSED + MENUITEM "&Низька", ID_VIEW_UPDATESPEED_LOW + MENUITEM "&Призупинити", ID_VIEW_UPDATESPEED_PAUSED END MENUITEM SEPARATOR - MENUITEM "& ", ID_VIEW_LARGE - MENUITEM "& ", ID_VIEW_SMALL - MENUITEM "&", ID_VIEW_DETAILS, CHECKED - MENUITEM "& ...", ID_VIEW_SELECTCOLUMNS - POPUP "& " + MENUITEM "&Великі значки", ID_VIEW_LARGE + MENUITEM "&Дрібні значки", ID_VIEW_SMALL + MENUITEM "Д&етально", ID_VIEW_DETAILS, CHECKED + MENUITEM "В&ибрати стовпці...", ID_VIEW_SELECTCOLUMNS + POPUP "&Хронологія ЦП" BEGIN - MENUITEM "& ", ID_VIEW_CPUHISTORY_ONEGRAPHALL + MENUITEM "&Один графік для всіх ЦП", ID_VIEW_CPUHISTORY_ONEGRAPHALL - MENUITEM " & ", ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU + MENUITEM "Окремий &графік для кожного ЦП", ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU , CHECKED END - MENUITEM "& ", ID_VIEW_SHOWKERNELTIMES + MENUITEM "&Вивід часу ядра", ID_VIEW_SHOWKERNELTIMES END - POPUP "&" + POPUP "В&ікна" BEGIN - MENUITEM "& ", ID_WINDOWS_TILEHORIZONTALLY - MENUITEM " &", ID_WINDOWS_TILEVERTICALLY - MENUITEM "&", ID_WINDOWS_MINIMIZE - MENUITEM "&", ID_WINDOWS_MAXIMIZE - MENUITEM "&", ID_WINDOWS_CASCADE - MENUITEM " & ", ID_WINDOWS_BRINGTOFRONT + MENUITEM "З&ліва направо", ID_WINDOWS_TILEHORIZONTALLY + MENUITEM "Згори до&низу", ID_WINDOWS_TILEVERTICALLY + MENUITEM "&Згорнути", ID_WINDOWS_MINIMIZE + MENUITEM "&Розгорнути", ID_WINDOWS_MAXIMIZE + MENUITEM "&Каскадом", ID_WINDOWS_CASCADE + MENUITEM "На передні&й план", ID_WINDOWS_BRINGTOFRONT END - POPUP "&" + POPUP "&Довідка" BEGIN - MENUITEM "&", ID_HELP_TOPICS + MENUITEM "&Зміст", ID_HELP_TOPICS MENUITEM SEPARATOR - MENUITEM "& ", ID_HELP_ABOUT + MENUITEM "&Про Диспетчер завдань", ID_HELP_ABOUT END END IDR_WINDOWSMENU MENU DISCARDABLE BEGIN - MENUITEM "& ", ID_WINDOWS_TILEHORIZONTALLY - MENUITEM " &", ID_WINDOWS_TILEVERTICALLY - MENUITEM "&", ID_WINDOWS_MINIMIZE - MENUITEM "&", ID_WINDOWS_MAXIMIZE - MENUITEM "&", ID_WINDOWS_CASCADE - MENUITEM " & ", ID_WINDOWS_BRINGTOFRONT + MENUITEM "З&ліва направо", ID_WINDOWS_TILEHORIZONTALLY + MENUITEM "Згори до&низу", ID_WINDOWS_TILEVERTICALLY + MENUITEM "&Згорнути", ID_WINDOWS_MINIMIZE + MENUITEM "&Розгорнути", ID_WINDOWS_MAXIMIZE + MENUITEM "&Каскадом", ID_WINDOWS_CASCADE + MENUITEM "На передні&й план", ID_WINDOWS_BRINGTOFRONT END IDR_APPLICATION_PAGE_CONTEXT1 MENU DISCARDABLE BEGIN POPUP "DUMMY" BEGIN - MENUITEM "& (...)", ID_FILE_NEW + MENUITEM "&Нове завдання (Виконати...)", ID_FILE_NEW MENUITEM SEPARATOR - MENUITEM "& ", ID_VIEW_LARGE - MENUITEM "& ", ID_VIEW_SMALL - MENUITEM "&", ID_VIEW_DETAILS, CHECKED + MENUITEM "&Великі значки", ID_VIEW_LARGE + MENUITEM "&Дрібні значки", ID_VIEW_SMALL + MENUITEM "Д&етально", ID_VIEW_DETAILS, CHECKED END END @@ -100,17 +99,17 @@ IDR_APPLICATION_PAGE_CONTEXT2 MENU DISCARDABLE BEGIN POPUP "DUMMY" BEGIN - MENUITEM "&", ID_APPLICATION_PAGE_SWITCHTO - MENUITEM " & ", ID_WINDOWS_BRINGTOFRONT + MENUITEM "П&ереключитися", ID_APPLICATION_PAGE_SWITCHTO + MENUITEM "На передні&й план", ID_WINDOWS_BRINGTOFRONT MENUITEM SEPARATOR - MENUITEM "& ", ID_WINDOWS_TILEHORIZONTALLY - MENUITEM " &", ID_WINDOWS_TILEVERTICALLY - MENUITEM "&", ID_WINDOWS_MINIMIZE - MENUITEM "&", ID_WINDOWS_MAXIMIZE - MENUITEM "&", ID_WINDOWS_CASCADE + MENUITEM "З&ліва направо", ID_WINDOWS_TILEHORIZONTALLY + MENUITEM "Згори до&низу", ID_WINDOWS_TILEVERTICALLY + MENUITEM "&Згорнути", ID_WINDOWS_MINIMIZE + MENUITEM "&Розгорнути", ID_WINDOWS_MAXIMIZE + MENUITEM "&Каскадом", ID_WINDOWS_CASCADE MENUITEM SEPARATOR - MENUITEM "& ", ID_APPLICATION_PAGE_ENDTASK - MENUITEM "& ", ID_APPLICATION_PAGE_GOTOPROCESS + MENUITEM "Зн&яти завдання", ID_APPLICATION_PAGE_ENDTASK + MENUITEM "&Перейти до процесів", ID_APPLICATION_PAGE_GOTOPROCESS END END @@ -119,10 +118,10 @@ IDR_TRAY_POPUP MENU DISCARDABLE BEGIN POPUP "DUMMY" BEGIN - MENUITEM "&³", ID_RESTORE - MENUITEM "&", ID_FILE_EXIT + MENUITEM "&Відновити", ID_RESTORE + MENUITEM "&Закрити", ID_FILE_EXIT MENUITEM SEPARATOR - MENUITEM "& ", ID_OPTIONS_ALWAYSONTOP + MENUITEM "&Поверх інших вікон", ID_OPTIONS_ALWAYSONTOP END END @@ -130,28 +129,28 @@ IDR_PROCESS_PAGE_CONTEXT MENU DISCARDABLE BEGIN POPUP "DUMMY" BEGIN - MENUITEM "& ", ID_PROCESS_PAGE_ENDPROCESS - MENUITEM " & ", ID_PROCESS_PAGE_ENDPROCESSTREE + MENUITEM "&Завершити процес", ID_PROCESS_PAGE_ENDPROCESS + MENUITEM "Завершити &дерево процесів", ID_PROCESS_PAGE_ENDPROCESSTREE - MENUITEM "&", ID_PROCESS_PAGE_DEBUG + MENUITEM "&Налагодження", ID_PROCESS_PAGE_DEBUG MENUITEM SEPARATOR - POPUP "&" + POPUP "&Пріоритет" BEGIN - MENUITEM "& ", ID_PROCESS_PAGE_SETPRIORITY_REALTIME + MENUITEM "&Реального часу", ID_PROCESS_PAGE_SETPRIORITY_REALTIME - MENUITEM "&", ID_PROCESS_PAGE_SETPRIORITY_HIGH + MENUITEM "&Високий", ID_PROCESS_PAGE_SETPRIORITY_HIGH - MENUITEM "& ", ID_PROCESS_PAGE_SETPRIORITY_ABOVENORMAL + MENUITEM "Ви&ще середнього", ID_PROCESS_PAGE_SETPRIORITY_ABOVENORMAL - MENUITEM "&", ID_PROCESS_PAGE_SETPRIORITY_NORMAL + MENUITEM "&Середній", ID_PROCESS_PAGE_SETPRIORITY_NORMAL - MENUITEM "& ", ID_PROCESS_PAGE_SETPRIORITY_BELOWNORMAL + MENUITEM "Ни&жче середнього", ID_PROCESS_PAGE_SETPRIORITY_BELOWNORMAL - MENUITEM "&", ID_PROCESS_PAGE_SETPRIORITY_LOW + MENUITEM "&Низький", ID_PROCESS_PAGE_SETPRIORITY_LOW END - MENUITEM "& ...", ID_PROCESS_PAGE_SETAFFINITY - MENUITEM " &...", ID_PROCESS_PAGE_DEBUGCHANNELS + MENUITEM "У&становити відповідність...", ID_PROCESS_PAGE_SETAFFINITY + MENUITEM "Редагувати налагодження &потоків...", ID_PROCESS_PAGE_DEBUGCHANNELS END END @@ -166,7 +165,7 @@ IDD_TASKMGR_DIALOG DIALOGEX DISCARDABLE 0, 0, 264, 246 STYLE DS_SHELLFONT | DS_CENTER | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME -CAPTION " " +CAPTION "Диспетчер завдань" MENU IDR_TASKMANAGER FONT 8, "MS Shell Dlg" BEGIN @@ -179,9 +178,9 @@ FONT 8, "MS Shell Dlg" BEGIN CONTROL "List2",IDC_APPLIST,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP,7,7,233,177 - PUSHBUTTON "& ...",IDC_NEWTASK,181,189,60,14 - PUSHBUTTON "&",IDC_SWITCHTO,120,189,55,14,WS_DISABLED - PUSHBUTTON "& ",IDC_ENDTASK,58,189,56,14,WS_DISABLED + PUSHBUTTON "&Нове завдання...",IDC_NEWTASK,181,189,60,14 + PUSHBUTTON "П&ереключитися",IDC_SWITCHTO,120,189,55,14,WS_DISABLED + PUSHBUTTON "Зн&яти завдання",IDC_ENDTASK,58,189,56,14,WS_DISABLED END IDD_PROCESS_PAGE DIALOGEX DISCARDABLE 0, 0, 247, 210 @@ -191,8 +190,8 @@ BEGIN CONTROL "List2",IDC_PROCESSLIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP,7,7,233,177 - PUSHBUTTON "& ",IDC_ENDPROCESS,171,189,69,14 - CONTROL "&³ ",IDC_SHOWALLPROCESSES, + PUSHBUTTON "Зн&яти процес",IDC_ENDPROCESS,171,189,69,14 + CONTROL "&Відображати процеси всіх користувачів",IDC_SHOWALLPROCESSES, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,191,147,10 END @@ -201,202 +200,202 @@ IDD_PERFORMANCE_PAGE DIALOGEX DISCARDABLE 0, 0, 247, 210 STYLE DS_SHELLFONT | DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX ". ",IDC_CPU_USAGE_FRAME,5,5,62,54,0,WS_EX_TRANSPARENT - GROUPBOX ". '",IDC_MEM_USAGE_FRAME,5,63,62,54,BS_LEFTTEXT, WS_EX_TRANSPARENT - GROUPBOX "",IDC_TOTALS_FRAME,5,122,111,39,0,WS_EX_TRANSPARENT - GROUPBOX " ' ()",IDC_COMMIT_CHARGE_FRAME,5,166,111,39,0,WS_EX_TRANSPARENT - GROUPBOX "Գ ' ()",IDC_PHYSICAL_MEMORY_FRAME,131,122,111,39,0,WS_EX_TRANSPARENT - GROUPBOX "' ()",IDC_KERNEL_MEMORY_FRAME,131,166,111,39,0,WS_EX_TRANSPARENT - LTEXT "",IDS_TOTALS_HANDLE_COUNT,12,131,47,8 - LTEXT "",IDS_TOTALS_THREAD_COUNT,12,140,27,8 - LTEXT "",IDS_TOTALS_PROCESS_COUNT,12,149,34,8 + GROUPBOX "Викорис. ЦП",IDC_CPU_USAGE_FRAME,5,5,62,54,0,WS_EX_TRANSPARENT + GROUPBOX "Викорис. пам'яті",IDC_MEM_USAGE_FRAME,5,63,62,54,BS_LEFTTEXT, WS_EX_TRANSPARENT + GROUPBOX "Усього",IDC_TOTALS_FRAME,5,122,111,39,0,WS_EX_TRANSPARENT + GROUPBOX "Виділення пам'яті (КБ)",IDC_COMMIT_CHARGE_FRAME,5,166,111,39,0,WS_EX_TRANSPARENT + GROUPBOX "Фізична пам'ять (КБ)",IDC_PHYSICAL_MEMORY_FRAME,131,122,111,39,0,WS_EX_TRANSPARENT + GROUPBOX "Пам'ять ядра (КБ)",IDC_KERNEL_MEMORY_FRAME,131,166,111,39,0,WS_EX_TRANSPARENT + LTEXT "Дескрипторів",IDS_TOTALS_HANDLE_COUNT,12,131,47,8 + LTEXT "Потоків",IDS_TOTALS_THREAD_COUNT,12,140,27,8 + LTEXT "Процесів",IDS_TOTALS_PROCESS_COUNT,12,149,34,8 EDITTEXT IDC_TOTALS_HANDLE_COUNT,65,131,45,8,ES_RIGHT | ES_READONLY | ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP EDITTEXT IDC_TOTALS_THREAD_COUNT,65,140,45,8,ES_RIGHT | ES_READONLY | ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP EDITTEXT IDC_TOTALS_PROCESS_COUNT,65,149,45,8,ES_RIGHT | ES_READONLY | ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP - LTEXT "",IDS_COMMIT_CHARGE_TOTAL,12,175,27,8 - LTEXT "",IDS_COMMIT_CHARGE_LIMIT,12,184,18,8,NOT WS_BORDER - LTEXT "ϳ",IDS_COMMIT_CHARGE_PEAK,12,193,18,8 + LTEXT "Усього",IDS_COMMIT_CHARGE_TOTAL,12,175,27,8 + LTEXT "Межа",IDS_COMMIT_CHARGE_LIMIT,12,184,18,8,NOT WS_BORDER + LTEXT "Пік",IDS_COMMIT_CHARGE_PEAK,12,193,18,8 EDITTEXT IDC_COMMIT_CHARGE_TOTAL,65,174,45,8,ES_RIGHT | ES_READONLY | ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP EDITTEXT IDC_COMMIT_CHARGE_LIMIT,65,184,45,8,ES_RIGHT | ES_READONLY | ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP EDITTEXT IDC_COMMIT_CHARGE_PEAK,65,193,45,8,ES_RIGHT | ES_READONLY | ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP - LTEXT "",IDS_PHYSICAL_MEMORY_TOTAL,137,131,27,8 - LTEXT "",IDS_PHYSICAL_MEMORY_AVAILABLE,137,140,32,8 - LTEXT " ",IDS_PHYSICAL_MEMORY_SYSTEM_CACHE,137,149,53,8 + LTEXT "Усього",IDS_PHYSICAL_MEMORY_TOTAL,137,131,27,8 + LTEXT "Доступно",IDS_PHYSICAL_MEMORY_AVAILABLE,137,140,32,8 + LTEXT "Системний кеш",IDS_PHYSICAL_MEMORY_SYSTEM_CACHE,137,149,53,8 EDITTEXT IDC_PHYSICAL_MEMORY_TOTAL,188,131,45,8,ES_RIGHT | ES_READONLY | ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP EDITTEXT IDC_PHYSICAL_MEMORY_AVAILABLE,188,140,45,8,ES_RIGHT | ES_READONLY | ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP EDITTEXT IDC_PHYSICAL_MEMORY_SYSTEM_CACHE,188,149,45,8,ES_RIGHT | ES_READONLY | ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP - LTEXT "",IDS_KERNEL_MEMORY_TOTAL,137,174,27,8 - LTEXT "",IDS_KERNEL_MEMORY_PAGED,137,184,53,8 - LTEXT "",IDS_KERNEL_MEMORY_NONPAGED,137,193,61,8 + LTEXT "Усього",IDS_KERNEL_MEMORY_TOTAL,137,174,27,8 + LTEXT "Вивантажувана",IDS_KERNEL_MEMORY_PAGED,137,184,53,8 + LTEXT "Невивантажувана",IDS_KERNEL_MEMORY_NONPAGED,137,193,61,8 EDITTEXT IDC_KERNEL_MEMORY_TOTAL,198,174,35,8,ES_RIGHT | ES_READONLY | ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP EDITTEXT IDC_KERNEL_MEMORY_PAGED,198,184,35,8,ES_RIGHT | ES_READONLY | ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP EDITTEXT IDC_KERNEL_MEMORY_NONPAGED,198,193,35,8,ES_RIGHT | ES_READONLY | ES_NUMBER | NOT WS_BORDER | NOT WS_TABSTOP - GROUPBOX " ",IDC_CPU_USAGE_HISTORY_FRAME,74,5,168,54,0,WS_EX_TRANSPARENT - GROUPBOX " '",IDC_MEMORY_USAGE_HISTORY_FRAME,74,63,168,54,0,WS_EX_TRANSPARENT - PUSHBUTTON "³ ",IDC_CPU_USAGE_GRAPH,12,17,47,37,NOT WS_TABSTOP,WS_EX_CLIENTEDGE - PUSHBUTTON "³ '",IDC_MEM_USAGE_GRAPH,12,75,47,37,NOT WS_TABSTOP,WS_EX_CLIENTEDGE - PUSHBUTTON " ",IDC_CPU_USAGE_HISTORY_GRAPH,81,17, + GROUPBOX "Хронологія використання ЦП",IDC_CPU_USAGE_HISTORY_FRAME,74,5,168,54,0,WS_EX_TRANSPARENT + GROUPBOX "Хронологія використання пам'яті",IDC_MEMORY_USAGE_HISTORY_FRAME,74,63,168,54,0,WS_EX_TRANSPARENT + PUSHBUTTON "Відображення використання ЦП",IDC_CPU_USAGE_GRAPH,12,17,47,37,NOT WS_TABSTOP,WS_EX_CLIENTEDGE + PUSHBUTTON "Відображення використання пам'яті",IDC_MEM_USAGE_GRAPH,12,75,47,37,NOT WS_TABSTOP,WS_EX_CLIENTEDGE + PUSHBUTTON "Хронологія використання ЦП",IDC_CPU_USAGE_HISTORY_GRAPH,81,17, 153,37,NOT WS_TABSTOP,WS_EX_CLIENTEDGE - PUSHBUTTON " '",IDC_MEM_USAGE_HISTORY_GRAPH,81,75, + PUSHBUTTON "Хронологія використання пам'яті",IDC_MEM_USAGE_HISTORY_GRAPH,81,75, 153,37,NOT WS_TABSTOP,WS_EX_CLIENTEDGE END IDD_DEBUG_CHANNELS_DIALOG DIALOGEX DISCARDABLE 0, 0, 247, 210 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Налагодження каналів" FONT 8, "MS Shell Dlg" BEGIN CONTROL "List2",IDC_DEBUG_CHANNELS_LIST,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP | LVS_SORTASCENDING,7,7,233,177 - PUSHBUTTON "",IDOK,171,189,69,14 + PUSHBUTTON "Закрити",IDOK,171,189,69,14 END IDD_AFFINITY_DIALOG DIALOGEX DISCARDABLE 0, 0, 231, 154 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "³ " +CAPTION "Відповідність процесорів" FONT 8, "MS Shell Dlg" BEGIN - DEFPUSHBUTTON "",IDOK,120,133,50,14 - PUSHBUTTON "ͳ",IDCANCEL,174,133,50,14 - LTEXT " , .", + DEFPUSHBUTTON "Так",IDOK,120,133,50,14 + PUSHBUTTON "Ні",IDCANCEL,174,133,50,14 + LTEXT "Параметр відповідності процесорів визначає, на якому ЦП буде дозволено виконувати процес.", IDC_STATIC,5,5,220,16 - CONTROL " 0",IDC_CPU0,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, + CONTROL "ЦП 0",IDC_CPU0,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, 11,28,37,10 - CONTROL " 1",IDC_CPU1,"Button",BS_AUTOCHECKBOX | WS_DISABLED | + CONTROL "ЦП 1",IDC_CPU1,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,11,41,37,10 - CONTROL " 2",IDC_CPU2,"Button",BS_AUTOCHECKBOX | WS_DISABLED | + CONTROL "ЦП 2",IDC_CPU2,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,11,54,37,10 - CONTROL " 3",IDC_CPU3,"Button",BS_AUTOCHECKBOX | WS_DISABLED | + CONTROL "ЦП 3",IDC_CPU3,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,11,67,37,10 - CONTROL " 4",IDC_CPU4,"Button",BS_AUTOCHECKBOX | WS_DISABLED | + CONTROL "ЦП 4",IDC_CPU4,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,11,80,37,10 - CONTROL " 5",IDC_CPU5,"Button",BS_AUTOCHECKBOX | WS_DISABLED | + CONTROL "ЦП 5",IDC_CPU5,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,11,93,37,10 - CONTROL " 6",IDC_CPU6,"Button",BS_AUTOCHECKBOX | WS_DISABLED | + CONTROL "ЦП 6",IDC_CPU6,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,11,106,37,10 - CONTROL " 7",IDC_CPU7,"Button",BS_AUTOCHECKBOX | WS_DISABLED | + CONTROL "ЦП 7",IDC_CPU7,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,11,119,37,10 - CONTROL " 8",IDC_CPU8,"Button",BS_AUTOCHECKBOX | WS_DISABLED | + CONTROL "ЦП 8",IDC_CPU8,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,61,28,37,10 - CONTROL " 9",IDC_CPU9,"Button",BS_AUTOCHECKBOX | WS_DISABLED | + CONTROL "ЦП 9",IDC_CPU9,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,61,41,37,10 - CONTROL " 10",IDC_CPU10,"Button",BS_AUTOCHECKBOX | + CONTROL "ЦП 10",IDC_CPU10,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,61,54,41,10 - CONTROL " 11",IDC_CPU11,"Button",BS_AUTOCHECKBOX | + CONTROL "ЦП 11",IDC_CPU11,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,61,67,41,10 - CONTROL " 12",IDC_CPU12,"Button",BS_AUTOCHECKBOX | + CONTROL "ЦП 12",IDC_CPU12,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,61,80,41,10 - CONTROL " 13",IDC_CPU13,"Button",BS_AUTOCHECKBOX | + CONTROL "ЦП 13",IDC_CPU13,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,61,93,41,10 - CONTROL " 14",IDC_CPU14,"Button",BS_AUTOCHECKBOX | + CONTROL "ЦП 14",IDC_CPU14,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,61,106,41,10 - CONTROL " 15",IDC_CPU15,"Button",BS_AUTOCHECKBOX | + CONTROL "ЦП 15",IDC_CPU15,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,61,119,41,10 - CONTROL " 16",IDC_CPU16,"Button",BS_AUTOCHECKBOX | + CONTROL "ЦП 16",IDC_CPU16,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,116,28,41,10 - CONTROL " 17",IDC_CPU17,"Button",BS_AUTOCHECKBOX | + CONTROL "ЦП 17",IDC_CPU17,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,116,41,41,10 - CONTROL " 18",IDC_CPU18,"Button",BS_AUTOCHECKBOX | + CONTROL "ЦП 18",IDC_CPU18,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,116,54,41,10 - CONTROL " 19",IDC_CPU19,"Button",BS_AUTOCHECKBOX | + CONTROL "ЦП 19",IDC_CPU19,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,116,67,41,10 - CONTROL " 20",IDC_CPU20,"Button",BS_AUTOCHECKBOX | + CONTROL "ЦП 20",IDC_CPU20,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,116,80,41,10 - CONTROL " 21",IDC_CPU21,"Button",BS_AUTOCHECKBOX | + CONTROL "ЦП 21",IDC_CPU21,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,116,93,41,10 - CONTROL " 22",IDC_CPU22,"Button",BS_AUTOCHECKBOX | + CONTROL "ЦП 22",IDC_CPU22,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,116,106,41,10 - CONTROL " 23",IDC_CPU23,"Button",BS_AUTOCHECKBOX | + CONTROL "ЦП 23",IDC_CPU23,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,116,119,41,10 - CONTROL " 24",IDC_CPU24,"Button",BS_AUTOCHECKBOX | + CONTROL "ЦП 24",IDC_CPU24,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,175,28,41,10 - CONTROL " 25",IDC_CPU25,"Button",BS_AUTOCHECKBOX | + CONTROL "ЦП 25",IDC_CPU25,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,175,41,41,10 - CONTROL " 26",IDC_CPU26,"Button",BS_AUTOCHECKBOX | + CONTROL "ЦП 26",IDC_CPU26,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,175,54,41,10 - CONTROL " 27",IDC_CPU27,"Button",BS_AUTOCHECKBOX | + CONTROL "ЦП 27",IDC_CPU27,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,175,67,41,10 - CONTROL " 28",IDC_CPU28,"Button",BS_AUTOCHECKBOX | + CONTROL "ЦП 28",IDC_CPU28,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,175,80,41,10 - CONTROL " 29",IDC_CPU29,"Button",BS_AUTOCHECKBOX | + CONTROL "ЦП 29",IDC_CPU29,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,175,93,41,10 - CONTROL " 30",IDC_CPU30,"Button",BS_AUTOCHECKBOX | + CONTROL "ЦП 30",IDC_CPU30,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,175,106,41,10 - CONTROL " 31",IDC_CPU31,"Button",BS_AUTOCHECKBOX | + CONTROL "ЦП 31",IDC_CPU31,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,175,119,41,10 END IDD_COLUMNS_DIALOG DIALOGEX DISCARDABLE 0, 0, 227, 199 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Вибір стовпців" FONT 8, "MS Shell Dlg" BEGIN - DEFPUSHBUTTON "",IDOK,116,178,50,14 - PUSHBUTTON "",IDCANCEL,170,178,50,14 - LTEXT " , .", + DEFPUSHBUTTON "ОК",IDOK,116,178,50,14 + PUSHBUTTON "Скасувати",IDCANCEL,170,178,50,14 + LTEXT "Виберіть стовпці, які слід відображати на вкладці Процеси диспетчера завдань.", IDC_STATIC,7,7,181,17 - CONTROL "&' ",IDC_IMAGENAME,"Button",BS_AUTOCHECKBOX | + CONTROL "&Ім'я образу",IDC_IMAGENAME,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,7,28,56,10 - CONTROL "&. (PID)",IDC_PID,"Button", + CONTROL "Іденти&ф. процесу (PID)",IDC_PID,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,7,39,91,10 - CONTROL "& ",IDC_CPUUSAGE,"Button",BS_AUTOCHECKBOX | + CONTROL "&Використання ЦП",IDC_CPUUSAGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,50,71,10 - CONTROL "& ",IDC_CPUTIME,"Button",BS_AUTOCHECKBOX | + CONTROL "&Час ЦП",IDC_CPUTIME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,61,48,10 - CONTROL "&' - ",IDC_MEMORYUSAGE,"Button",BS_AUTOCHECKBOX | + CONTROL "&Пам'ять - використання",IDC_MEMORYUSAGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,72,92,10 - CONTROL "' - &",IDC_MEMORYUSAGEDELTA,"Button", + CONTROL "Пам'ять - змі&на",IDC_MEMORYUSAGEDELTA,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,7,83,82,10 - CONTROL "' - &",IDC_PEAKMEMORYUSAGE,"Button", + CONTROL "Пам'ять - &максимум",IDC_PEAKMEMORYUSAGE,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,7,94,82,10 - CONTROL "& ",IDC_PAGEFAULTS,"Button",BS_AUTOCHECKBOX | + CONTROL "П&омилок сторінки",IDC_PAGEFAULTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,105,73,10 - CONTROL "&' USER",IDC_USEROBJECTS,"Button",BS_AUTOCHECKBOX | + CONTROL "О&б'єкти USER",IDC_USEROBJECTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,116,62,10 - CONTROL "ʳ ",IDC_IOREADS,"Button",BS_AUTOCHECKBOX | + CONTROL "Кількість читань",IDC_IOREADS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,127,68,10 - CONTROL " ",IDC_IOREADBYTES,"Button", + CONTROL "Прочитано байтів",IDC_IOREADBYTES,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,7,138,72,10 - CONTROL " &",IDC_SESSIONID,"Button",BS_AUTOCHECKBOX | + CONTROL "Код се&ансу",IDC_SESSIONID,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,149,50,10 - CONTROL "'& ",IDC_USERNAME,"Button",BS_AUTOCHECKBOX | + CONTROL "Ім'&я користувача",IDC_USERNAME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,160,70,10 - CONTROL " & - ",IDC_PAGEFAULTSDELTA,"Button", + CONTROL "Помилок &сторінки - зміна",IDC_PAGEFAULTSDELTA,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,107,28,72,10 - CONTROL "' & '",IDC_VIRTUALMEMORYSIZE,"Button", + CONTROL "Об'єм віртуал&ьної пам'яті",IDC_VIRTUALMEMORYSIZE,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,107,39,100,10 - CONTROL "& ",IDC_PAGEDPOOL,"Button",BS_AUTOCHECKBOX | + CONTROL "Виванта&жуваний пул",IDC_PAGEDPOOL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,107,50,88,10 - CONTROL "& ",IDC_NONPAGEDPOOL,"Button", + CONTROL "Невивантаж&уваний пул",IDC_NONPAGEDPOOL,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,107,61,96,10 - CONTROL "& ",IDC_BASEPRIORITY,"Button", + CONTROL "Базови&й пріоритет",IDC_BASEPRIORITY,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,107,72,75,10 - CONTROL "˳ &",IDC_HANDLECOUNT,"Button",BS_AUTOCHECKBOX | + CONTROL "Лічильник &дескрипторів",IDC_HANDLECOUNT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,107,83,98,10 - CONTROL "&˳ ",IDC_THREADCOUNT,"Button",BS_AUTOCHECKBOX | + CONTROL "&Лічильник потоків",IDC_THREADCOUNT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,107,94,79,10 - CONTROL "'& GDI",IDC_GDIOBJECTS,"Button",BS_AUTOCHECKBOX | + CONTROL "Об'&єкти GDI",IDC_GDIOBJECTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,107,105,55,10 - CONTROL "ʳ ",IDC_IOWRITES,"Button",BS_AUTOCHECKBOX | + CONTROL "Кількість записів",IDC_IOWRITES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,107,116,73,10 - CONTROL " ",IDC_IOWRITEBYTES,"Button", + CONTROL "Записано байтів",IDC_IOWRITEBYTES,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,107,127,67,10 - CONTROL " -",IDC_IOOTHER,"Button",BS_AUTOCHECKBOX | + CONTROL "Інший ввід-вивід",IDC_IOOTHER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,107,138,71,10 - CONTROL " -",IDC_IOOTHERBYTES,"Button", + CONTROL "Інших байтів при вводі-виводі",IDC_IOOTHERBYTES,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,107,149,114,10 END @@ -521,135 +520,135 @@ END STRINGTABLE DISCARDABLE BEGIN - IDS_APP_TITLE " " - IDC_TASKMGR " " - IDS_IDLE_PROCESS " " + IDS_APP_TITLE "Диспетчер завдань" + IDC_TASKMGR "Диспетчер завдань" + IDS_IDLE_PROCESS "Бездіяльність системи" END STRINGTABLE DISCARDABLE BEGIN - ID_FILE_NEW " " - ID_OPTIONS_ALWAYSONTOP "³ , " + ID_FILE_NEW "Запускає нову програму" + ID_OPTIONS_ALWAYSONTOP "Вікно диспетчера завдань залишається поверх інших вікон, якщо його не згорнуто" ID_OPTIONS_MINIMIZEONUSE - "³ " - ID_OPTIONS_HIDEWHENMINIMIZED " " - ID_VIEW_REFRESH " " - ID_VIEW_LARGE " " - ID_VIEW_SMALL " " - ID_VIEW_DETAILS " " - ID_VIEW_UPDATESPEED_HIGH " " - ID_VIEW_UPDATESPEED_NORMAL " " - ID_VIEW_UPDATESPEED_LOW " " + "Вікно диспетчера завдань згортається при переключенні" + ID_OPTIONS_HIDEWHENMINIMIZED "Приховування згорнутого вікна диспетчера завдань" + ID_VIEW_REFRESH "Спричинює негайне оновлення вікна диспетчера завдань" + ID_VIEW_LARGE "Показує завдання великими значками" + ID_VIEW_SMALL "Показує завдання малими значками" + ID_VIEW_DETAILS "Показує додаткові відомості про кожне завдання" + ID_VIEW_UPDATESPEED_HIGH "Оновлює зображення двічі на секунду" + ID_VIEW_UPDATESPEED_NORMAL "Оновлює зображення раз на дві секунди" + ID_VIEW_UPDATESPEED_LOW "Оновлює зображення раз на чотири секунди" END STRINGTABLE DISCARDABLE BEGIN - ID_VIEW_UPDATESPEED_PAUSED " " + ID_VIEW_UPDATESPEED_PAUSED "Не оновлювати автоматично" ID_WINDOWS_TILEHORIZONTALLY - " " - ID_WINDOWS_TILEVERTICALLY " " - ID_WINDOWS_MINIMIZE " " - ID_WINDOWS_MAXIMIZE " " - ID_WINDOWS_CASCADE " " - ID_WINDOWS_BRINGTOFRONT " " - ID_HELP_TOPICS " " - ID_HELP_ABOUT " , " - ID_FILE_EXIT " " + "Розташовує вікна горизонтально на робочому столі" + ID_WINDOWS_TILEVERTICALLY "Розташовує вікна вертикально на робочому столі" + ID_WINDOWS_MINIMIZE "Згортає вікна" + ID_WINDOWS_MAXIMIZE "Розгортає вікна" + ID_WINDOWS_CASCADE "Розташовує вікна каскадом на робочому столі" + ID_WINDOWS_BRINGTOFRONT "Переміщення вікна на передній план без переходу до нього" + ID_HELP_TOPICS "Показує довідку диспетчера завдань" + ID_HELP_ABOUT "Показує відомості про програму, її версію та авторські права" + ID_FILE_EXIT "Закриває диспетчер завдань" ID_OPTIONS_SHOW16BITTASKS - " 16- , ntvdm.exe" - ID_VIEW_SELECTCOLUMNS " , " - ID_VIEW_SHOWKERNELTIMES " " + "Показ 16-розрядних завдань, які обробляє ntvdm.exe" + ID_VIEW_SELECTCOLUMNS "Виберіть стовпці, які слід відображати на вкладці Процеси" + ID_VIEW_SHOWKERNELTIMES "Показує час ядра на графіках продуктивності" ID_VIEW_CPUHISTORY_ONEGRAPHALL - " " - ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU " " + "Єдиний хронологічний графік загального використання ЦП" + ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU "Кожний ЦП має власний хронологічний графік" ID_APPLICATION_PAGE_SWITCHTO - " " + "Переміщення завдання на передній план і передача керування цьому завданню" END STRINGTABLE DISCARDABLE BEGIN - ID_ENDTASK " " - ID_GOTOPROCESS " " - ID_RESTORE "³ " - ID_PROCESS_PAGE_ENDPROCESS " " + ID_ENDTASK "Наказує вибраним завданням закритися" + ID_GOTOPROCESS "Передача фокуса до процесу вибраного завдання" + ID_RESTORE "Відновлення прихованого вікна диспетчера завдань" + ID_PROCESS_PAGE_ENDPROCESS "Видаляє процес із системи" ID_PROCESS_PAGE_ENDPROCESSTREE - " " - ID_PROCESS_PAGE_DEBUG " " + "Видаляє із системи цей процес і всіх його нащадків" + ID_PROCESS_PAGE_DEBUG "Застосовує налагоджувач до цього процесу" ID_PROCESS_PAGE_SETAFFINITY - ", " + "Визначає, які процесори може використовувати процес" ID_PROCESS_PAGE_SETPRIORITY_REALTIME - " "" "" " - ID_PROCESS_PAGE_SETPRIORITY_HIGH " """" " + "Установлює клас пріоритету ""Реального часу"" для процесу" + ID_PROCESS_PAGE_SETPRIORITY_HIGH "Установлює клас пріоритету ""Високий"" для процесу" ID_PROCESS_PAGE_SETPRIORITY_ABOVENORMAL - " "" "" " + "Установлює клас пріоритету ""Вище середнього"" для процесу" ID_PROCESS_PAGE_SETPRIORITY_NORMAL - " """" " + "Установлює клас пріоритету ""Середній"" для процесу" ID_PROCESS_PAGE_SETPRIORITY_BELOWNORMAL - " "" "" " - ID_PROCESS_PAGE_SETPRIORITY_LOW " """" " + "Установлює клас пріоритету ""Нижче середнього"" для процесу" + ID_PROCESS_PAGE_SETPRIORITY_LOW "Установлює клас пріоритету ""Низький"" для процесу" END STRINGTABLE DISCARDABLE BEGIN - IDS_TAB_APPS "" - IDS_TAB_PROCESSES "" - IDS_TAB_PERFORMANCE "" - IDS_TAB_TASK "" - IDS_TAB_STATUS "" - IDS_TAB_IMAGENAME "' " + IDS_TAB_APPS "Додатки" + IDS_TAB_PROCESSES "Процеси" + IDS_TAB_PERFORMANCE "Швидкодія" + IDS_TAB_TASK "Завдання" + IDS_TAB_STATUS "Стан" + IDS_TAB_IMAGENAME "Ім'я образу" IDS_TAB_PID "PID" - IDS_TAB_USERNAME "' " - IDS_TAB_SESSIONID " " - IDS_TAB_CPU "" - IDS_TAB_CPUTIME " " - IDS_TAB_MEMUSAGE "'" - IDS_TAB_PEAKMEMUSAGE "ϳ '" - IDS_TAB_MEMDELTA "' ()" - IDS_TAB_PAGEFAULT ".." - IDS_TAB_PFDELTA "..()" - IDS_TAB_VMSIZE "³.." - IDS_TAB_PAGEDPOOL "." - IDS_TAB_NPPOOL "." - IDS_TAB_BASEPRI ".." - IDS_TAB_HANDLES "." - IDS_TAB_THREADS "" - IDS_TAB_USERPBJECTS "' USER" - IDS_TAB_GDIOBJECTS "' GDI" - IDS_TAB_IOREADS "ʳ " - IDS_TAB_IOWRITES "ʳ " - IDS_TAB_IOOTHER " -" - IDS_TAB_IOREADBYTES " " - IDS_TAB_IOWRITESBYTES " " - IDS_TAB_IOOTHERBYTES " -" - IDS_MENU_SELECTCOLUMNS "& ..." - IDS_MENU_16BITTASK "&³ 16- " - IDS_MENU_WINDOWS "&" - IDS_MENU_LARGEICONS "& " - IDS_MENU_SMALLICONS "& " - IDS_MENU_DETAILS "&" - IDS_MENU_ONEGRAPHALLCPUS "& " - IDS_MENU_ONEGRAPHPERCPU " & " - IDS_MENU_CPUHISTORY "& " - IDS_MENU_SHOWKERNELTIMES "& " - IDS_CREATENEWTASK " " - IDS_CREATENEWTASK_DESC " ' , , , ." - IDS_MSG_ACCESSPROCESSAFF " " - IDS_MSG_PROCESSONEPRO " ." - IDS_MSG_INVALIDOPTION " " - IDS_MSG_UNABLEDEBUGPROCESS " " - IDS_MSG_WARNINGDEBUG "! .\n ?" - IDS_MSG_TASKMGRWARNING " " - IDS_MSG_WARNINGTERMINATING "! \n , \n . \n . \n ?" - IDS_MSG_UNABLETERMINATEPRO " " - IDS_MSG_UNABLECHANGEPRIORITY " " - IDS_MSG_WARNINGCHANGEPRIORITY "! \n , \n. ?" - IDS_MSG_TRAYICONCPUUSAGE " : %d%%" - IDS_STATUS_MEMUSAGE "': %dK / %dK" - IDS_STATUS_CPUUSAGE " : %3d%%" - IDS_STATUS_PROCESSES ": %d" - IDS_Not_Responding " " - IDS_Running "" + IDS_TAB_USERNAME "Ім'я користувача" + IDS_TAB_SESSIONID "Код сеансу" + IDS_TAB_CPU "ЦП" + IDS_TAB_CPUTIME "Час ЦП" + IDS_TAB_MEMUSAGE "Пам'ять" + IDS_TAB_PEAKMEMUSAGE "Пікове використання пам'яті" + IDS_TAB_MEMDELTA "Пам'ять (змін)" + IDS_TAB_PAGEFAULT "Пом.ст." + IDS_TAB_PFDELTA "Пом.ст.(змін)" + IDS_TAB_VMSIZE "Вірт.п." + IDS_TAB_PAGEDPOOL "Вив.пул" + IDS_TAB_NPPOOL "Невив.пул" + IDS_TAB_BASEPRI "Баз.пр." + IDS_TAB_HANDLES "Дескр." + IDS_TAB_THREADS "Потоків" + IDS_TAB_USERPBJECTS "Об'єкти USER" + IDS_TAB_GDIOBJECTS "Об'єкти GDI" + IDS_TAB_IOREADS "Кількість читань" + IDS_TAB_IOWRITES "Кількість записів" + IDS_TAB_IOOTHER "Інший ввід-вивід" + IDS_TAB_IOREADBYTES "Прочитано байтів" + IDS_TAB_IOWRITESBYTES "Записано байтів" + IDS_TAB_IOOTHERBYTES "Інших байтів під час вводу-виводу" + IDS_MENU_SELECTCOLUMNS "В&ибрати стовпці..." + IDS_MENU_16BITTASK "&Відображати 16-розрядні завдання" + IDS_MENU_WINDOWS "В&ікна" + IDS_MENU_LARGEICONS "&Великі значки" + IDS_MENU_SMALLICONS "&Дрібні значки" + IDS_MENU_DETAILS "&Детально" + IDS_MENU_ONEGRAPHALLCPUS "&Один графік для всіх ЦП" + IDS_MENU_ONEGRAPHPERCPU "Окремий &графік для кожного ЦП" + IDS_MENU_CPUHISTORY "&Хронологія ЦП" + IDS_MENU_SHOWKERNELTIMES "&Вивід часу ядра" + IDS_CREATENEWTASK "Створити нове завдання" + IDS_CREATENEWTASK_DESC "Введіть ім'я програми, папки, документа або ресурсу Інтернету, і Диспетчер завдань відкриє їх." + IDS_MSG_ACCESSPROCESSAFF "Не вдалося отримати доступ або установити належність процесу" + IDS_MSG_PROCESSONEPRO "Процесу має відповідати принаймні один процесор." + IDS_MSG_INVALIDOPTION "Неправильний параметр" + IDS_MSG_UNABLEDEBUGPROCESS "Не вдається налагодити процес" + IDS_MSG_WARNINGDEBUG "УВАГА! Налагодження цього процесу може спричинити втрату даних.\nВи дійсно бажаєте застосувати налагоджувач?" + IDS_MSG_TASKMGRWARNING "Попередження диспетчера завдань" + IDS_MSG_WARNINGTERMINATING "УВАГА! Припинення процесу може призвести до \nнебажаних наслідків, включаючи втрату даних і \nнестабільну роботу системи. Процес не зможе \nзберегти свій стан або дані перед припиненням. \nВи дійсно бажаєте припинити процес?" + IDS_MSG_UNABLETERMINATEPRO "Неможливо завершити процес" + IDS_MSG_UNABLECHANGEPRIORITY "Неможливо змінити пріоритет" + IDS_MSG_WARNINGCHANGEPRIORITY "УВАГА! Зміна класу пріоритету цього процесу може призвести до \nнебажаних наслідків, включаючи нестабільну роботу \nсистеми. Ви дійсно бажаєте змінити пріоритет класу?" + IDS_MSG_TRAYICONCPUUSAGE "Використання ЦП: %d%%" + IDS_STATUS_MEMUSAGE "Пам'ять: %dK / %dK" + IDS_STATUS_CPUUSAGE "Використання ЦП: %3d%%" + IDS_STATUS_PROCESSES "Процесів: %d" + IDS_Not_Responding "Не відповідає" + IDS_Running "Виконується" END diff --git a/base/applications/taskmgr/perfdata.c b/base/applications/taskmgr/perfdata.c index 50132d0b2b2..8e98a6ee714 100644 --- a/base/applications/taskmgr/perfdata.c +++ b/base/applications/taskmgr/perfdata.c @@ -179,7 +179,7 @@ void PerfDataRefresh(void) ULONG cwcUserName; /* Get new system time */ - status = NtQuerySystemInformation(SystemTimeOfDayInformation, &SysTimeInfo, sizeof(SysTimeInfo), 0); + status = NtQuerySystemInformation(SystemTimeOfDayInformation, &SysTimeInfo, sizeof(SysTimeInfo), NULL); if (!NT_SUCCESS(status)) return; diff --git a/base/applications/taskmgr/precomp.h b/base/applications/taskmgr/precomp.h index c30856b3065..e066d2ce929 100644 --- a/base/applications/taskmgr/precomp.h +++ b/base/applications/taskmgr/precomp.h @@ -13,7 +13,7 @@ #define WIN32_NO_STATUS #include #define NTOS_MODE_USER -#include +#include #include #include #include diff --git a/base/applications/taskmgr/rsrc.rc b/base/applications/taskmgr/rsrc.rc index 7da0b53a7ce..beacfb4e66d 100644 --- a/base/applications/taskmgr/rsrc.rc +++ b/base/applications/taskmgr/rsrc.rc @@ -14,10 +14,8 @@ #include "lang/no-NO.rc" #include "lang/nl-NL.rc" #include "lang/pt-BR.rc" -#include "lang/ru-RU.rc" #include "lang/sk-SK.rc" #include "lang/sv-SE.rc" -#include "lang/uk-UA.rc" #include "lang/zh-CN.rc" // UTF-8 @@ -25,3 +23,5 @@ #include "lang/ja-JP.rc" #include "lang/pl-PL.rc" #include "lang/ro-RO.rc" +#include "lang/ru-RU.rc" +#include "lang/uk-UA.rc" diff --git a/base/applications/taskmgr/taskmgr.c b/base/applications/taskmgr/taskmgr.c index 6778db38931..ad9175826b1 100644 --- a/base/applications/taskmgr/taskmgr.c +++ b/base/applications/taskmgr/taskmgr.c @@ -759,19 +759,10 @@ void LoadSettings(void) void SaveSettings(void) { HKEY hKey; - WCHAR szSubKey1[] = L"Software"; - WCHAR szSubKey2[] = L"Software\\ReactOS"; - WCHAR szSubKey3[] = L"Software\\ReactOS\\TaskManager"; + WCHAR szSubKey[] = L"Software\\ReactOS\\TaskManager"; /* Open (or create) the key */ - hKey = NULL; - RegCreateKeyExW(HKEY_CURRENT_USER, szSubKey1, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, NULL); - RegCloseKey(hKey); - hKey = NULL; - RegCreateKeyExW(HKEY_CURRENT_USER, szSubKey2, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, NULL); - RegCloseKey(hKey); - hKey = NULL; - if (RegCreateKeyExW(HKEY_CURRENT_USER, szSubKey3, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, NULL) != ERROR_SUCCESS) + if (RegCreateKeyExW(HKEY_CURRENT_USER, szSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, NULL) != ERROR_SUCCESS) return; /* Save the settings */ RegSetValueExW(hKey, L"Preferences", 0, REG_BINARY, (LPBYTE)&TaskManagerSettings, sizeof(TASKMANAGER_SETTINGS)); diff --git a/base/applications/winhlp32/CMakeLists.txt b/base/applications/winhlp32/CMakeLists.txt index 8b1e1fe154f..6f3b9e1b7d4 100644 --- a/base/applications/winhlp32/CMakeLists.txt +++ b/base/applications/winhlp32/CMakeLists.txt @@ -7,8 +7,7 @@ add_definitions( -D__ROS_LONG64__ -D_CRT_NONSTDC_NO_DEPRECATE -Dfileno=_fileno - -Disatty=_isatty - -D_DLL -D__USE_CRTIMP) + -Disatty=_isatty) add_executable(winhlp32 callback.c @@ -20,7 +19,6 @@ add_executable(winhlp32 rsrc.rc) set_module_type(winhlp32 win32gui) - target_link_libraries(winhlp32 wine) add_importlibs(winhlp32 user32 gdi32 shell32 comctl32 comdlg32 msvcrt kernel32 ntdll) add_cd_file(TARGET winhlp32 DESTINATION reactos FOR all) diff --git a/base/applications/wordpad/CMakeLists.txt b/base/applications/wordpad/CMakeLists.txt index e8f3906dda9..d04e11ccbe5 100644 --- a/base/applications/wordpad/CMakeLists.txt +++ b/base/applications/wordpad/CMakeLists.txt @@ -1,9 +1,7 @@ include_directories(BEFORE ${REACTOS_SOURCE_DIR}/include/reactos/wine) -add_definitions( - -D__ROS_LONG64__ - -D_DLL -D__USE_CRTIMP) +add_definitions(-D__ROS_LONG64__) set_rc_compiler() @@ -17,7 +15,6 @@ list(APPEND SOURCE add_executable(wordpad ${SOURCE}) set_module_type(wordpad win32gui) - target_link_libraries(wordpad wine uuid) add_importlibs(wordpad comdlg32 ole32 shell32 user32 gdi32 advapi32 comctl32 msvcrt kernel32 ntdll) add_cd_file(TARGET wordpad DESTINATION reactos/system32 FOR all) diff --git a/base/applications/write/CMakeLists.txt b/base/applications/write/CMakeLists.txt index 4660a307f7a..f58231fc9ed 100644 --- a/base/applications/write/CMakeLists.txt +++ b/base/applications/write/CMakeLists.txt @@ -1,5 +1,6 @@ set_unicode() +set_rc_compiler() add_executable(write write.c rsrc.rc) set_module_type(write win32gui) diff --git a/base/services/audiosrv/CMakeLists.txt b/base/services/audiosrv/CMakeLists.txt index bd96bf7f3a6..57935335548 100644 --- a/base/services/audiosrv/CMakeLists.txt +++ b/base/services/audiosrv/CMakeLists.txt @@ -11,5 +11,6 @@ add_executable(audiosrv audiosrv.rc) set_module_type(audiosrv win32cui) +add_pch(audiosrv audiosrv.h) add_importlibs(audiosrv advapi32 user32 setupapi msvcrt kernel32) add_cd_file(TARGET audiosrv DESTINATION reactos/system32 FOR all) diff --git a/base/services/audiosrv/audiosrv.h b/base/services/audiosrv/audiosrv.h index 1fce5ce0841..61edb2e2627 100644 --- a/base/services/audiosrv/audiosrv.h +++ b/base/services/audiosrv/audiosrv.h @@ -6,6 +6,15 @@ * COPYRIGHT: Copyright 2007 Andrew Greenwood */ +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include diff --git a/base/services/audiosrv/audiosrv.rbuild b/base/services/audiosrv/audiosrv.rbuild index 82a79207e56..4bbe4a03941 100644 --- a/base/services/audiosrv/audiosrv.rbuild +++ b/base/services/audiosrv/audiosrv.rbuild @@ -12,4 +12,5 @@ services.c debug.c audiosrv.rc + audiosrv.h diff --git a/base/services/audiosrv/debug.c b/base/services/audiosrv/debug.c index 9352fc923c2..bdb34a190fc 100644 --- a/base/services/audiosrv/debug.c +++ b/base/services/audiosrv/debug.c @@ -1,8 +1,6 @@ /* Service debugging (simply logs to a file) */ -#include -#include -#include +#include "audiosrv.h" void logmsg(char* string, ...) { diff --git a/base/services/audiosrv/main.c b/base/services/audiosrv/main.c index c987433cdb5..13c4a640312 100644 --- a/base/services/audiosrv/main.c +++ b/base/services/audiosrv/main.c @@ -6,9 +6,6 @@ * COPYRIGHT: Copyright 2007 Andrew Greenwood */ -#include - -#include #include "audiosrv.h" SERVICE_STATUS_HANDLE service_status_handle; diff --git a/base/services/audiosrv/pnp.c b/base/services/audiosrv/pnp.c index af1c4fce219..e85da65117e 100644 --- a/base/services/audiosrv/pnp.c +++ b/base/services/audiosrv/pnp.c @@ -6,15 +6,6 @@ * COPYRIGHT: Copyright 2007 Andrew Greenwood */ -#include -#include -#include -#include - -#include -#include - -#include #include "audiosrv.h" static HDEVNOTIFY device_notification_handle = NULL; diff --git a/base/services/audiosrv/pnp_list_lock.c b/base/services/audiosrv/pnp_list_lock.c index 07c6f6e308f..1ac7e6545e2 100644 --- a/base/services/audiosrv/pnp_list_lock.c +++ b/base/services/audiosrv/pnp_list_lock.c @@ -6,9 +6,7 @@ * COPYRIGHT: Copyright 2007 Andrew Greenwood */ -#include -#include -#include +#include "audiosrv.h" static HANDLE audio_device_list_lock = NULL; diff --git a/base/services/audiosrv/pnp_list_manager.c b/base/services/audiosrv/pnp_list_manager.c index cfafed070d9..457e8a442a3 100644 --- a/base/services/audiosrv/pnp_list_manager.c +++ b/base/services/audiosrv/pnp_list_manager.c @@ -6,9 +6,6 @@ * COPYRIGHT: Copyright 2007 Andrew Greenwood */ -#include -#include -#include #include "audiosrv.h" diff --git a/base/services/audiosrv/services.c b/base/services/audiosrv/services.c index 34dd2e285b9..dee6431629a 100644 --- a/base/services/audiosrv/services.c +++ b/base/services/audiosrv/services.c @@ -6,15 +6,6 @@ * COPYRIGHT: Copyright 2009 Johannes Anderwald */ -#include -#include -#include -#include - -#include -#include - -#include #include "audiosrv.h" BOOL diff --git a/base/services/eventlog/CMakeLists.txt b/base/services/eventlog/CMakeLists.txt index 424606205c4..b63913dcf59 100644 --- a/base/services/eventlog/CMakeLists.txt +++ b/base/services/eventlog/CMakeLists.txt @@ -1,5 +1,8 @@ -include_directories(${REACTOS_BINARY_DIR}/include/reactos/idl) +include_directories(${REACTOS_SOURCE_DIR}/include/reactos/idl + ${CMAKE_CURRENT_BINARY_DIR}) + +add_rpc_files(server ${REACTOS_SOURCE_DIR}/include/reactos/idl/eventlogrpc.idl) set_unicode() @@ -9,14 +12,16 @@ list(APPEND SOURCE logport.c eventlog.rc rpc.c - file.c) + file.c + ${CMAKE_CURRENT_BINARY_DIR}/eventlogrpc_s.c) -add_executable(eventlog ${CMAKE_CURRENT_BINARY_DIR}/eventlog_eventlog.h.gch ${SOURCE}) +add_executable(eventlog ${SOURCE}) -target_link_libraries(eventlog eventlogrpc ${PSEH_LIB}) - -add_pch(eventlog ${CMAKE_CURRENT_SOURCE_DIR}/eventlog.h ${SOURCE}) +if(NOT MSVC) + target_link_libraries(eventlog pseh) +endif() set_module_type(eventlog win32cui) add_importlibs(eventlog advapi32 rpcrt4 msvcrt kernel32 ntdll) +add_pch(eventlog eventlog.h) add_cd_file(TARGET eventlog DESTINATION reactos/system32 FOR all) diff --git a/base/services/eventlog/eventlog.c b/base/services/eventlog/eventlog.c index d0ee12f36ea..33927d6aa0e 100644 --- a/base/services/eventlog/eventlog.c +++ b/base/services/eventlog/eventlog.c @@ -63,6 +63,8 @@ ServiceControlHandler(DWORD dwControl, { case SERVICE_CONTROL_STOP: DPRINT(" SERVICE_CONTROL_STOP received\n"); + /* Stop listening to incoming RPC messages */ + RpcMgmtStopServerListening(NULL); UpdateServiceStatus(SERVICE_STOPPED); return ERROR_SUCCESS; @@ -463,7 +465,7 @@ VOID SystemTimeToEventTime(SYSTEMTIME * pSystemTime, DWORD * pEventTime) SystemTimeToFileTime(pSystemTime, &Time.ft); SystemTimeToFileTime(&st1970, &u1970.ft); - *pEventTime = (Time.ll - u1970.ll) / 10000000; + *pEventTime = (DWORD)((Time.ll - u1970.ll) / 10000000ull); } VOID PRINT_HEADER(PEVENTLOGHEADER header) diff --git a/base/services/eventlog/file.c b/base/services/eventlog/file.c index 116d0d09102..8bd9ec0a159 100644 --- a/base/services/eventlog/file.c +++ b/base/services/eventlog/file.c @@ -896,17 +896,17 @@ DWORD LogfGetCurrentRecord(PLOGFILE LogFile) BOOL LogfDeleteOffsetInformation(PLOGFILE LogFile, ULONG ulNumber) { - int i; + DWORD i; if (ulNumber != LogFile->OffsetInfo[0].EventNumber) { return FALSE; } - for (i=0;iOffsetInfoNext-1; i++) + for (i = 0; i < LogFile->OffsetInfoNext - 1; i++) { - LogFile->OffsetInfo[i].EventNumber = LogFile->OffsetInfo[i+1].EventNumber; - LogFile->OffsetInfo[i].EventOffset = LogFile->OffsetInfo[i+1].EventOffset; + LogFile->OffsetInfo[i].EventNumber = LogFile->OffsetInfo[i + 1].EventNumber; + LogFile->OffsetInfo[i].EventOffset = LogFile->OffsetInfo[i + 1].EventOffset; } LogFile->OffsetInfoNext--; return TRUE; @@ -1102,4 +1102,4 @@ LogfReportEvent(WORD wType, } LogfFreeRecord(logBuffer); -} \ No newline at end of file +} diff --git a/base/services/rpcss/CMakeLists.txt b/base/services/rpcss/CMakeLists.txt index f84c816f951..fed398b3b2e 100644 --- a/base/services/rpcss/CMakeLists.txt +++ b/base/services/rpcss/CMakeLists.txt @@ -1,4 +1,8 @@ +add_rpc_files(server + ${REACTOS_SOURCE_DIR}/include/reactos/wine/epm.idl + ${REACTOS_SOURCE_DIR}/include/reactos/wine/irot.idl) + set_unicode() list(APPEND SOURCE @@ -6,16 +10,19 @@ list(APPEND SOURCE irotp.c rpcss_main.c service_main.c - rpcss.rc) + rpcss.rc + ${CMAKE_CURRENT_BINARY_DIR}/epm_s.c + ${CMAKE_CURRENT_BINARY_DIR}/irot_s.c) include_directories(${REACTOS_BINARY_DIR}/include/reactos/wine) add_executable(rpcss ${SOURCE}) -target_link_libraries(rpcss epmrpc irotrpc ${PSEH_LIB} wine) +target_link_libraries(rpcss + ${PSEH_LIB} + wine) set_module_type(rpcss win32cui) add_importlibs(rpcss advapi32 rpcrt4 msvcrt kernel32 ntdll) add_cd_file(TARGET rpcss DESTINATION reactos/system32 FOR all) -add_dependencies(rpcss winesdk) diff --git a/base/services/rpcss/irotp.c b/base/services/rpcss/irotp.c index 41ccc7092a6..f7683570a60 100644 --- a/base/services/rpcss/irotp.c +++ b/base/services/rpcss/irotp.c @@ -25,7 +25,7 @@ #include "windef.h" #include "winbase.h" -#include "irot.h" +#include "irot_s.h" #include "wine/list.h" #include "wine/debug.h" diff --git a/base/services/rpcss/rpcss_main.c b/base/services/rpcss/rpcss_main.c index 8e6ec1f3099..7fd7cd41aca 100644 --- a/base/services/rpcss/rpcss_main.c +++ b/base/services/rpcss/rpcss_main.c @@ -51,8 +51,8 @@ #define NONAMELESSSTRUCT #include "rpcss.h" #include "winnt.h" -#include "irot.h" -#include "epm.h" +#include "irot_s.h" +#include "epm_s.h" #include "wine/debug.h" diff --git a/base/services/tcpsvcs/CMakeLists.txt b/base/services/tcpsvcs/CMakeLists.txt index 02439ab483a..08a1be6587b 100644 --- a/base/services/tcpsvcs/CMakeLists.txt +++ b/base/services/tcpsvcs/CMakeLists.txt @@ -12,11 +12,11 @@ list(APPEND SOURCE tcpsvcs.rc log.c) -add_executable(tcpsvcs ${CMAKE_CURRENT_BINARY_DIR}/tcpsvcs_tcpsvcs.h.gch ${SOURCE}) +add_executable(tcpsvcs ${SOURCE}) -add_pch(tcpsvcs ${CMAKE_CURRENT_SOURCE_DIR}/tcpsvcs.h ${SOURCE}) set_module_type(tcpsvcs win32cui) add_importlibs(tcpsvcs ws2_32 advapi32 msvcrt kernel32 ntdll) +add_pch(tcpsvcs tcpsvcs.h) add_cd_file(TARGET tcpsvcs DESTINATION reactos/system32 FOR all) diff --git a/base/services/telnetd/CMakeLists.txt b/base/services/telnetd/CMakeLists.txt index 225696094d5..f22c3e88ea9 100644 --- a/base/services/telnetd/CMakeLists.txt +++ b/base/services/telnetd/CMakeLists.txt @@ -1,6 +1,4 @@ -add_definitions(-D_DLL -D__USE_CRTIMP) - add_executable(telnetd telnetd.c serviceentry.c diff --git a/base/services/telnetd/telnetd.rc b/base/services/telnetd/telnetd.rc index 53760e9b74b..2e0c42aac53 100644 --- a/base/services/telnetd/telnetd.rc +++ b/base/services/telnetd/telnetd.rc @@ -1,6 +1,6 @@ /* $Id$ */ -#define REACTOS_STR_FILE_DESCRIPTION "ReactOS Simple Telnet Deamon\0" +#define REACTOS_STR_FILE_DESCRIPTION "ReactOS Simple Telnet Service\0" #define REACTOS_STR_INTERNAL_NAME "telnetd\0" #define REACTOS_STR_ORIGINAL_FILENAME "telnetd.exe\0" #define REACTOS_STR_ORIGINAL_COPYRIGHT "fred.van.lieshout 'at' zonnet.nl\0" diff --git a/base/services/umpnpmgr/CMakeLists.txt b/base/services/umpnpmgr/CMakeLists.txt index d02270ebe3f..3d642b1bf31 100644 --- a/base/services/umpnpmgr/CMakeLists.txt +++ b/base/services/umpnpmgr/CMakeLists.txt @@ -1,13 +1,21 @@ -set_unicode() - -include_directories(${REACTOS_BINARY_DIR}/include/reactos/idl) +include_directories(${REACTOS_SOURCE_DIR}/include/reactos/idl) remove_definitions(-D_WIN32_WINNT=0x502) add_definitions(-D_WIN32_WINNT=0x600) -add_executable(umpnpmgr umpnpmgr.c umpnpmgr.rc) -target_link_libraries(umpnpmgr pnprpc wdmguid ${PSEH_LIB}) +add_rpc_files(server ${REACTOS_SOURCE_DIR}/include/reactos/idl/pnp.idl) + +set_unicode() + +add_executable(umpnpmgr + umpnpmgr.c + umpnpmgr.rc + ${CMAKE_CURRENT_BINARY_DIR}/pnp_s.c) + +target_link_libraries(umpnpmgr + wdmguid + ${PSEH_LIB}) set_module_type(umpnpmgr win32cui) add_importlibs(umpnpmgr advapi32 rpcrt4 userenv msvcrt kernel32 ntdll) diff --git a/base/services/umpnpmgr/umpnpmgr.c b/base/services/umpnpmgr/umpnpmgr.c index 08c5b25978b..35c78881560 100644 --- a/base/services/umpnpmgr/umpnpmgr.c +++ b/base/services/umpnpmgr/umpnpmgr.c @@ -536,14 +536,33 @@ DWORD PNP_GetDeviceRegProp( PLUGPLAY_CONTROL_PROPERTY_DATA PlugPlayData; CONFIGRET ret = CR_SUCCESS; LPWSTR lpValueName = NULL; - HKEY hKey = 0; + HKEY hKey = NULL; + LONG lError; NTSTATUS Status; UNREFERENCED_PARAMETER(hBinding); - UNREFERENCED_PARAMETER(ulFlags); DPRINT("PNP_GetDeviceRegProp() called\n"); + if (pulTransferLen == NULL || pulLength == NULL) + { + ret = CR_INVALID_POINTER; + goto done; + } + + if (ulFlags != 0) + { + ret = CR_INVALID_FLAG; + goto done; + } + + /* FIXME: Check pDeviceID */ + + if (*pulLength < *pulTransferLen) + *pulLength = *pulTransferLen; + + *pulTransferLen = 0; + switch (ulProperty) { case CM_DRP_DEVICEDESC: @@ -626,8 +645,65 @@ DWORD PNP_GetDeviceRegProp( lpValueName = NULL; break; + case CM_DRP_SECURITY: + lpValueName = L"Security"; + break; + + case CM_DRP_DEVTYPE: + lpValueName = L"DeviceType"; + break; + + case CM_DRP_EXCLUSIVE: + lpValueName = L"Exclusive"; + break; + + case CM_DRP_CHARACTERISTICS: + lpValueName = L"DeviceCharacteristics"; + break; + + case CM_DRP_ADDRESS: + lpValueName = NULL; + break; + + case CM_DRP_UI_NUMBER_DESC_FORMAT: + lpValueName = L"UINumberDescFormat"; + break; + + case CM_DRP_DEVICE_POWER_DATA: + lpValueName = NULL; + break; + + case CM_DRP_REMOVAL_POLICY: + lpValueName = NULL; + break; + + case CM_DRP_REMOVAL_POLICY_HW_DEFAULT: + lpValueName = NULL; + break; + + case CM_DRP_REMOVAL_POLICY_OVERRIDE: + lpValueName = L"RemovalPolicy"; + break; + + case CM_DRP_INSTALL_STATE: + lpValueName = NULL; + break; + +#if (WINVER >= _WIN32_WINNT_WS03) + case CM_DRP_LOCATION_PATHS: + lpValueName = NULL; + break; +#endif + +#if (WINVER >= _WIN32_WINNT_WIN7) + case CM_DRP_BASE_CONTAINERID: + lpValueName = NULL; + break; +#endif + default: - return CR_INVALID_PROPERTY; + ret = CR_INVALID_PROPERTY; + goto done; } DPRINT("Value name: %S\n", lpValueName); @@ -635,24 +711,37 @@ DWORD PNP_GetDeviceRegProp( if (lpValueName) { /* Retrieve information from the Registry */ - if (RegOpenKeyExW(hEnumKey, - pDeviceID, - 0, - KEY_ALL_ACCESS, - &hKey)) - return CR_INVALID_DEVNODE; + lError = RegOpenKeyExW(hEnumKey, + pDeviceID, + 0, + KEY_QUERY_VALUE, + &hKey); + if (lError != ERROR_SUCCESS) + { + hKey = NULL; + *pulLength = 0; + ret = CR_INVALID_DEVNODE; + goto done; + } - if (RegQueryValueExW(hKey, - lpValueName, - NULL, - pulRegDataType, - Buffer, - pulLength)) - ret = CR_REGISTRY_ERROR; - - /* FIXME: Check buffer size */ - - RegCloseKey(hKey); + lError = RegQueryValueExW(hKey, + lpValueName, + NULL, + pulRegDataType, + Buffer, + pulLength); + if (lError != ERROR_SUCCESS) + { + if (lError == ERROR_MORE_DATA) + { + ret = CR_BUFFER_SMALL; + } + else + { + *pulLength = 0; + ret = CR_NO_SUCH_VALUE; + } + } } else { @@ -660,36 +749,69 @@ DWORD PNP_GetDeviceRegProp( RtlInitUnicodeString(&PlugPlayData.DeviceInstance, pDeviceID); PlugPlayData.Buffer = Buffer; - PlugPlayData.BufferSize = *pulTransferLen; + PlugPlayData.BufferSize = *pulLength; switch (ulProperty) { -#if 0 case CM_DRP_PHYSICAL_DEVICE_OBJECT_NAME: - PlugPlayData.Property = DevicePropertyPhysicalDeviceObjectName; + PlugPlayData.Property = 0xb; // DevicePropertyPhysicalDeviceObjectName; break; case CM_DRP_UI_NUMBER: - PlugPlayData.Property = DevicePropertyUINumber; + PlugPlayData.Property = 0x11; // DevicePropertyUINumber; break; case CM_DRP_BUSTYPEGUID: - PlugPlayData.Property = DevicePropertyBusTypeGuid; + PlugPlayData.Property = 0xc; // DevicePropertyBusTypeGuid; break; case CM_DRP_LEGACYBUSTYPE: - PlugPlayData.Property = DevicePropertyLegacyBusType; + PlugPlayData.Property = 0xd; // DevicePropertyLegacyBusType; break; case CM_DRP_BUSNUMBER: - PlugPlayData.Property = DevicePropertyBusNumber; + PlugPlayData.Property = 0xe; // DevicePropertyBusNumber; break; -#endif case CM_DRP_ENUMERATOR_NAME: - PlugPlayData.Property = 15; //DevicePropertyEnumeratorName; + PlugPlayData.Property = 0xf; // DevicePropertyEnumeratorName; break; + case CM_DRP_ADDRESS: + PlugPlayData.Property = 0x10; // DevicePropertyAddress; + break; + +#if 0 + /* FIXME: This property is not supported by IoGetDeviceProperty */ + case CM_DRP_DEVICE_POWER_DATA: +#endif + + case CM_DRP_REMOVAL_POLICY: + PlugPlayData.Property = 0x12; // DevicePropertyRemovalPolicy + break; + +#if 0 + /* FIXME: This property is not supported by IoGetDeviceProperty */ + case CM_DRP_REMOVAL_POLICY_HW_DEFAULT: +#endif + + case CM_DRP_INSTALL_STATE: + PlugPlayData.Property = 0x12; // DevicePropertyInstallState; + break; + +#if 0 + /* FIXME: This property is not supported by IoGetDeviceProperty */ +#if (WINVER >= _WIN32_WINNT_WS03) + case CM_DRP_LOCATION_PATHS: +#endif +#endif + +#if (WINVER >= _WIN32_WINNT_WIN7) + case CM_DRP_BASE_CONTAINERID: + PlugPlayData.Property = 0x16; // DevicePropertyContainerID; + break; +#endif + default: return CR_INVALID_PROPERTY; } @@ -707,6 +829,12 @@ DWORD PNP_GetDeviceRegProp( } } +done: + *pulTransferLen = (ret == CR_SUCCESS) ? *pulLength : 0; + + if (hKey != NULL) + RegCloseKey(hKey); + DPRINT("PNP_GetDeviceRegProp() done (returns %lx)\n", ret); return ret; @@ -791,6 +919,30 @@ DWORD PNP_SetDeviceRegProp( lpValueName = L"LowerFilters"; break; + case CM_DRP_SECURITY: + lpValueName = L"Security"; + break; + + case CM_DRP_DEVTYPE: + lpValueName = L"DeviceType"; + break; + + case CM_DRP_EXCLUSIVE: + lpValueName = L"Exclusive"; + break; + + case CM_DRP_CHARACTERISTICS: + lpValueName = L"DeviceCharacteristics"; + break; + + case CM_DRP_UI_NUMBER_DESC_FORMAT: + lpValueName = L"UINumberDescFormat"; + break; + + case CM_DRP_REMOVAL_POLICY_OVERRIDE: + lpValueName = L"RemovalPolicy"; + break; + default: return CR_INVALID_PROPERTY; } @@ -800,7 +952,7 @@ DWORD PNP_SetDeviceRegProp( if (RegOpenKeyExW(hEnumKey, pDeviceId, 0, - KEY_ALL_ACCESS, /* FIXME: so much? */ + KEY_SET_VALUE, &hKey)) return CR_INVALID_DEVNODE; @@ -1085,23 +1237,213 @@ DWORD PNP_GetClassRegProp( PNP_RPC_STRING_LEN *pulLength, DWORD ulFlags) { - UNIMPLEMENTED; - return CR_CALL_NOT_IMPLEMENTED; + CONFIGRET ret = CR_SUCCESS; + LPWSTR lpValueName = NULL; + HKEY hInstKey = NULL; + HKEY hPropKey = NULL; + LONG lError; + + UNREFERENCED_PARAMETER(hBinding); + + DPRINT("PNP_GetClassRegProp() called\n"); + + if (pulTransferLen == NULL || pulLength == NULL) + { + ret = CR_INVALID_POINTER; + goto done; + } + + if (ulFlags != 0) + { + ret = CR_INVALID_FLAG; + goto done; + } + + if (*pulLength < *pulTransferLen) + *pulLength = *pulTransferLen; + + *pulTransferLen = 0; + + switch (ulProperty) + { + case CM_CRP_SECURITY: + lpValueName = L"Security"; + break; + + case CM_CRP_DEVTYPE: + lpValueName = L"DeviceType"; + break; + + case CM_CRP_EXCLUSIVE: + lpValueName = L"Exclusive"; + break; + + case CM_CRP_CHARACTERISTICS: + lpValueName = L"DeviceCharacteristics"; + break; + + default: + ret = CR_INVALID_PROPERTY; + goto done; + } + + DPRINT("Value name: %S\n", lpValueName); + + lError = RegOpenKeyExW(hClassKey, + pszClassGuid, + 0, + KEY_READ, + &hInstKey); + if (lError != ERROR_SUCCESS) + { + *pulLength = 0; + ret = CR_NO_SUCH_REGISTRY_KEY; + goto done; + } + + lError = RegOpenKeyExW(hInstKey, + L"Properties", + 0, + KEY_READ, + &hPropKey); + if (lError != ERROR_SUCCESS) + { + *pulLength = 0; + ret = CR_NO_SUCH_REGISTRY_KEY; + goto done; + } + + lError = RegQueryValueExW(hPropKey, + lpValueName, + NULL, + pulRegDataType, + Buffer, + pulLength); + if (lError != ERROR_SUCCESS) + { + if (lError == ERROR_MORE_DATA) + { + ret = CR_BUFFER_SMALL; + } + else + { + *pulLength = 0; + ret = CR_NO_SUCH_VALUE; + } + } + +done:; + *pulTransferLen = (ret == CR_SUCCESS) ? *pulLength : 0; + + if (hPropKey != NULL) + RegCloseKey(hPropKey); + + if (hInstKey != NULL) + RegCloseKey(hInstKey); + + DPRINT("PNP_GetClassRegProp() done (returns %lx)\n", ret); + + return ret; } /* Function 27 */ DWORD PNP_SetClassRegProp( handle_t hBinding, - LPWSTR *pszClassGuid, + LPWSTR pszClassGuid, DWORD ulProperty, DWORD ulDataType, BYTE *Buffer, PNP_PROP_SIZE ulLength, DWORD ulFlags) { - UNIMPLEMENTED; - return CR_CALL_NOT_IMPLEMENTED; + CONFIGRET ret = CR_SUCCESS; + LPWSTR lpValueName = NULL; + HKEY hInstKey = 0; + HKEY hPropKey = 0; + LONG lError; + + UNREFERENCED_PARAMETER(hBinding); + + DPRINT("PNP_SetClassRegProp() called\n"); + + if (ulFlags != 0) + return CR_INVALID_FLAG; + + switch (ulProperty) + { + case CM_CRP_SECURITY: + lpValueName = L"Security"; + break; + + case CM_CRP_DEVTYPE: + lpValueName = L"DeviceType"; + break; + + case CM_CRP_EXCLUSIVE: + lpValueName = L"Exclusive"; + break; + + case CM_CRP_CHARACTERISTICS: + lpValueName = L"DeviceCharacteristics"; + break; + + default: + return CR_INVALID_PROPERTY; + } + + lError = RegOpenKeyExW(hClassKey, + pszClassGuid, + 0, + KEY_WRITE, + &hInstKey); + if (lError != ERROR_SUCCESS) + { + ret = CR_NO_SUCH_REGISTRY_KEY; + goto done; + } + + /* FIXME: Set security descriptor */ + lError = RegCreateKeyExW(hInstKey, + L"Properties", + 0, + NULL, + REG_OPTION_NON_VOLATILE, + KEY_ALL_ACCESS, + NULL, + &hPropKey, + NULL); + if (lError != ERROR_SUCCESS) + { + ret = CR_REGISTRY_ERROR; + goto done; + } + + if (ulLength == 0) + { + if (RegDeleteValueW(hPropKey, + lpValueName)) + ret = CR_REGISTRY_ERROR; + } + else + { + if (RegSetValueExW(hPropKey, + lpValueName, + 0, + ulDataType, + Buffer, + ulLength)) + ret = CR_REGISTRY_ERROR; + } + +done:; + if (hPropKey != NULL) + RegCloseKey(hPropKey); + + if (hInstKey != NULL) + RegCloseKey(hInstKey); + + return ret; } @@ -2241,8 +2583,6 @@ DWORD PNP_DeleteServiceDevices( static BOOL InstallDevice(PCWSTR DeviceInstance, BOOL ShowWizard) { - PLUGPLAY_CONTROL_STATUS_DATA PlugPlayData; - NTSTATUS Status; BOOL DeviceInstalled = FALSE; DWORD BytesWritten; DWORD Value; @@ -2251,6 +2591,7 @@ InstallDevice(PCWSTR DeviceInstance, BOOL ShowWizard) PROCESS_INFORMATION ProcessInfo; STARTUPINFOW StartupInfo; UUID RandomUuid; + HKEY DeviceKey; /* The following lengths are constant (see below), they cannot overflow */ WCHAR CommandLine[116]; @@ -2262,26 +2603,28 @@ InstallDevice(PCWSTR DeviceInstance, BOOL ShowWizard) ZeroMemory(&ProcessInfo, sizeof(ProcessInfo)); - RtlInitUnicodeString(&PlugPlayData.DeviceInstance, - DeviceInstance); - PlugPlayData.Operation = 0; /* Get status */ - - /* Get device status */ - Status = NtPlugPlayControl(PlugPlayControlDeviceStatus, - (PVOID)&PlugPlayData, - sizeof(PLUGPLAY_CONTROL_STATUS_DATA)); - if (!NT_SUCCESS(Status)) + if (RegOpenKeyExW(hEnumKey, + DeviceInstance, + 0, + KEY_QUERY_VALUE, + &DeviceKey) == ERROR_SUCCESS) { - DPRINT1("NtPlugPlayControl('%S') failed with status 0x%08lx\n", DeviceInstance, Status); - return FALSE; + if (RegQueryValueExW(DeviceKey, + L"ClassGUID", + NULL, + NULL, + NULL, + NULL) == ERROR_SUCCESS) + { + DPRINT("No need to install: %S\n", DeviceInstance); + RegCloseKey(DeviceKey); + return TRUE; + } + + RegCloseKey(DeviceKey); } - if ((PlugPlayData.DeviceStatus & (DNF_STARTED | DNF_START_FAILED)) != 0) - { - /* Device is already started, or disabled due to some problem. Don't install it */ - DPRINT("No need to install '%S'\n", DeviceInstance); - return TRUE; - } + DPRINT1("Installing: %S\n", DeviceInstance); /* Create a random UUID for the named pipe */ UuidCreate(&RandomUuid); @@ -2387,6 +2730,8 @@ cleanup: if(ProcessInfo.hThread) CloseHandle(ProcessInfo.hThread); + DPRINT1("Success? %d\n", DeviceInstalled); + return DeviceInstalled; } @@ -2595,7 +2940,7 @@ PnpEventThread(LPVOID lpParameter) DWORD len; DWORD DeviceIdLength; - DPRINT("Device enumerated: %S\n", PnpEvent->TargetDevice.DeviceIds); + DPRINT1("Device enumerated: %S\n", PnpEvent->TargetDevice.DeviceIds); DeviceIdLength = lstrlenW(PnpEvent->TargetDevice.DeviceIds); if (DeviceIdLength) @@ -2617,9 +2962,33 @@ PnpEventThread(LPVOID lpParameter) } else if (UuidEqual(&PnpEvent->EventGuid, (UUID*)&GUID_DEVICE_ARRIVAL, &RpcStatus)) { - DPRINT("Device arrival: %S\n", PnpEvent->TargetDevice.DeviceIds); + DPRINT1("Device arrival: %S\n", PnpEvent->TargetDevice.DeviceIds); /* FIXME: ? */ } + else if (UuidEqual(&PnpEvent->EventGuid, (UUID*)&GUID_DEVICE_EJECT_VETOED, &RpcStatus)) + { + DPRINT1("Eject vetoed: %S\n", PnpEvent->TargetDevice.DeviceIds); + } + else if (UuidEqual(&PnpEvent->EventGuid, (UUID*)&GUID_DEVICE_KERNEL_INITIATED_EJECT, &RpcStatus)) + { + DPRINT1("Kernel initiated eject: %S\n", PnpEvent->TargetDevice.DeviceIds); + } + else if (UuidEqual(&PnpEvent->EventGuid, (UUID*)&GUID_DEVICE_SAFE_REMOVAL, &RpcStatus)) + { + DPRINT1("Safe removal: %S\n", PnpEvent->TargetDevice.DeviceIds); + } + else if (UuidEqual(&PnpEvent->EventGuid, (UUID*)&GUID_DEVICE_SURPRISE_REMOVAL, &RpcStatus)) + { + DPRINT1("Surprise removal: %S\n", PnpEvent->TargetDevice.DeviceIds); + } + else if (UuidEqual(&PnpEvent->EventGuid, (UUID*)&GUID_DEVICE_REMOVAL_VETOED, &RpcStatus)) + { + DPRINT1("Removal vetoed: %S\n", PnpEvent->TargetDevice.DeviceIds); + } + else if (UuidEqual(&PnpEvent->EventGuid, (UUID*)&GUID_DEVICE_REMOVE_PENDING, &RpcStatus)) + { + DPRINT1("Removal pending: %S\n", PnpEvent->TargetDevice.DeviceIds); + } else { DPRINT1("Unknown event, GUID {%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}\n", @@ -2674,6 +3043,8 @@ ServiceControlHandler(DWORD dwControl, { case SERVICE_CONTROL_STOP: DPRINT1(" SERVICE_CONTROL_STOP received\n"); + /* Stop listening to RPC Messages */ + RpcMgmtStopServerListening(NULL); UpdateServiceStatus(SERVICE_STOPPED); return ERROR_SUCCESS; diff --git a/base/services/wlansvc/CMakeLists.txt b/base/services/wlansvc/CMakeLists.txt index 91edbdaf48b..f49f43a1267 100644 --- a/base/services/wlansvc/CMakeLists.txt +++ b/base/services/wlansvc/CMakeLists.txt @@ -1,10 +1,18 @@ +include_directories(${REACTOS_SOURCE_DIR}/include/reactos/idl) + +add_rpc_files(server ${REACTOS_SOURCE_DIR}/include/reactos/idl/wlansvc.idl) + set_unicode() -include_directories(${REACTOS_BINARY_DIR}/include/reactos/idl) -add_executable(wlansvc wlansvc.c rpcserver.c) +add_executable(wlansvc + wlansvc.c + rpcserver.c + ${CMAKE_CURRENT_BINARY_DIR}/wlansvc_s.c) -target_link_libraries(wlansvc wlansvcrpc ${PSEH_LIB}) +if(NOT MSVC) + target_link_libraries(wlansvc pseh) +endif() set_module_type(wlansvc win32cui) add_importlibs(wlansvc advapi32 rpcrt4 iphlpapi msvcrt kernel32 ntdll) diff --git a/base/services/wlansvc/wlansvc.c b/base/services/wlansvc/wlansvc.c index 5f0e1e6d95e..721dd0f9706 100644 --- a/base/services/wlansvc/wlansvc.c +++ b/base/services/wlansvc/wlansvc.c @@ -75,6 +75,7 @@ ServiceControlHandler(DWORD dwControl, case SERVICE_CONTROL_STOP: UpdateServiceStatus(ServiceStatusHandle, SERVICE_STOP_PENDING, 1); RpcMgmtStopServerListening(NULL); + UpdateServiceStatus(ServiceStatusHandle, SERVICE_STOPPED, 0); break; case SERVICE_CONTROL_INTERROGATE: return NO_ERROR; diff --git a/base/setup/reactos/lang/ru-RU.rc b/base/setup/reactos/lang/ru-RU.rc index c50cc7392f8..ff10bb026a6 100644 --- a/base/setup/reactos/lang/ru-RU.rc +++ b/base/setup/reactos/lang/ru-RU.rc @@ -4,65 +4,65 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT IDD_STARTPAGE DIALOGEX DISCARDABLE 0, 0, 317, 193 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " ReactOS" +CAPTION "Установка ReactOS" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ReactOS.", IDC_STARTTITLE, 115, 8, 195, 24 - LTEXT " ReactOS ! CD ReactOS.", IDC_STATIC, 115, 40, 195, 100 - LTEXT " ""W"" .", IDC_STATIC, 115, 169, 195, 17 + LTEXT "Вас приветствует программа установки ReactOS.", IDC_STARTTITLE, 115, 8, 195, 24 + LTEXT "Установку ReactOS можно производить только загрузившись с этого диска! После перезапуска компьютера выберите загрузку с CD и начните установку ReactOS.", IDC_STATIC, 115, 40, 195, 100 + LTEXT "Нажмите кнопку ""ЗавершитьW"" для выхода.", IDC_STATIC, 115, 169, 195, 17 END IDD_LANGSELPAGE DIALOGEX DISCARDABLE 0, 0, 317, 193 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " ReactOS" +CAPTION "Установка ReactOS" FONT 8, "MS Shell Dlg" BEGIN CONTROL "IDB_LOGO", IDB_ROSLOGO, "Static", WS_CHILD | WS_VISIBLE | SS_OWNERDRAW, 18, 0, 290, 99 - CONTROL " :", IDC_STATIC, "Static", WS_CHILD | WS_VISIBLE | WS_GROUP | SS_RIGHT, 20, 109, 106, 11 + CONTROL "Язык системы:", IDC_STATIC, "Static", WS_CHILD | WS_VISIBLE | WS_GROUP | SS_RIGHT, 20, 109, 106, 11 CONTROL "", IDC_LANGUAGES, "ComboBox", WS_VSCROLL | WS_TABSTOP | CBS_DROPDOWNLIST, 132, 107, 176, 142 - CONTROL " :", IDC_STATIC, "Static", WS_CHILD | WS_VISIBLE | WS_GROUP | SS_RIGHT, 20, 142, 106, 11 + CONTROL "Раскладка клавиатуры:", IDC_STATIC, "Static", WS_CHILD | WS_VISIBLE | WS_GROUP | SS_RIGHT, 20, 142, 106, 11 CONTROL "", IDC_KEYLAYOUT, "ComboBox", WS_VSCROLL | WS_TABSTOP | CBS_DROPDOWNLIST, 132, 141, 176, 81 - LTEXT " """".", IDC_STATIC, 10, 180 ,297, 10 + LTEXT "Для выбора типа установки нажмите ""Далее"".", IDC_STATIC, 10, 180 ,297, 10 END IDD_TYPEPAGE DIALOGEX DISCARDABLE 0, 0, 317, 193 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " ReactOS" +CAPTION "Установка ReactOS" FONT 8, "MS Shell Dlg" BEGIN - CONTROL " ", IDC_STATIC, "Button", BS_GROUPBOX, 10,0,297,172 - CONTROL " ReactOS", IDC_INSTALL, "Button", BS_AUTORADIOBUTTON | WS_TABSTOP, 20, 15, 277, 10 - CONTROL " ReactOS", IDC_SETUP, "Button", BS_AUTORADIOBUTTON | WS_TABSTOP | WS_DISABLED , 20, 30, 277, 10 - LTEXT " """".", IDC_STATIC, 10, 180 ,297, 10 + CONTROL "Тип установки", IDC_STATIC, "Button", BS_GROUPBOX, 10,0,297,172 + CONTROL "Установка ReactOS", IDC_INSTALL, "Button", BS_AUTORADIOBUTTON | WS_TABSTOP, 20, 15, 277, 10 + CONTROL "Восстановить или изменить установленный ранее ReactOS", IDC_SETUP, "Button", BS_AUTORADIOBUTTON | WS_TABSTOP | WS_DISABLED , 20, 30, 277, 10 + LTEXT "Для установки устройств нажмите ""Далее"".", IDC_STATIC, 10, 180 ,297, 10 END IDD_DEVICEPAGE DIALOGEX DISCARDABLE 0, 0, 317, 193 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " ReactOS" +CAPTION "Установка ReactOS" FONT 8, "MS Shell Dlg" BEGIN - CONTROL " ", IDC_STATIC, "Button", BS_GROUPBOX, 10,0,297,172 - LTEXT ":", IDC_STATIC, 20,15, 80, 10 + CONTROL "Основные устройства", IDC_STATIC, "Button", BS_GROUPBOX, 10,0,297,172 + LTEXT "Компьтер:", IDC_STATIC, 20,15, 80, 10 CONTROL "", IDC_COMPUTER, "ComboBox", WS_VSCROLL | WS_TABSTOP | CBS_DROPDOWNLIST , 100, 15, 150, 80 - LTEXT ":", IDC_STATIC, 20,35, 80, 10 + LTEXT "Экран:", IDC_STATIC, 20,35, 80, 10 CONTROL "", IDC_DISPLAY, "ComboBox", WS_VSCROLL | WS_TABSTOP | CBS_DROPDOWNLIST , 100, 35, 150, 80 - LTEXT ":", IDC_STATIC, 20,55, 80, 10 + LTEXT "Клавиатура:", IDC_STATIC, 20,55, 80, 10 CONTROL "", IDC_KEYBOARD, "ComboBox", WS_VSCROLL | WS_TABSTOP | CBS_DROPDOWNLIST , 100, 55, 150, 80 - LTEXT " """".", IDC_STATIC, 10, 180 ,277, 20 + LTEXT "Для установки устройств нажмите ""Далее"".", IDC_STATIC, 10, 180 ,277, 20 END IDD_DRIVEPAGE DIALOGEX DISCARDABLE 0, 0, 317, 193 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " ReactOS" +CAPTION "Установка ReactOS" FONT 8, "MS Shell Dlg" BEGIN - CONTROL " ReactOS", IDC_STATIC, "Button", BS_GROUPBOX, 10,1,298,176 + CONTROL "Разделы для установки ReactOS", IDC_STATIC, "Button", BS_GROUPBOX, 10,1,298,176 LISTBOX IDC_PARTITION, 20,12,278,142,LBS_HASSTRINGS | WS_VSCROLL - PUSHBUTTON "&", IDC_PARTCREATE, 20,155,50,15 - PUSHBUTTON "&", IDC_PARTDELETE, 76,155,50,15 - PUSHBUTTON "&", IDC_DEVICEDRIVER, 162,155,50,15, WS_DISABLED - PUSHBUTTON "& ...", IDC_PARTMOREOPTS, 176,155,122,15 - LTEXT " """".", IDC_STATIC, 10, 180 ,277, 20 + PUSHBUTTON "&Создать", IDC_PARTCREATE, 20,155,50,15 + PUSHBUTTON "&Удалить", IDC_PARTDELETE, 76,155,50,15 + PUSHBUTTON "Д&райвер", IDC_DEVICEDRIVER, 162,155,50,15, WS_DISABLED + PUSHBUTTON "&Дополнительные параметры...", IDC_PARTMOREOPTS, 176,155,122,15 + LTEXT "Для начала установки нажмите ""Далее"".", IDC_STATIC, 10, 180 ,277, 20 END IDD_PARTITION DIALOGEX DISCARDABLE 0, 0, 145, 90 @@ -71,49 +71,49 @@ CAPTION "Create Partition" FONT 8, "MS Shell Dlg" BEGIN CONTROL "",IDC_UPDOWN1,"msctls_updown32", WS_VISIBLE,104,22,9,13 - CONTROL " ",IDC_STATIC,"Button",BS_GROUPBOX,7,5,129,57 - LTEXT ":",IDC_STATIC, 13,24,27,9 + CONTROL "Создать и отформатировать раздел диска",IDC_STATIC,"Button",BS_GROUPBOX,7,5,129,57 + LTEXT "Размер:",IDC_STATIC, 13,24,27,9 EDITTEXT IDC_PARTSIZE,52,23,53,13, WS_VISIBLE|WS_TABSTOP - LTEXT "",IDC_UNIT, 117,24,14,9 - LTEXT " :",IDC_STATIC,13,46,35,9 + LTEXT "Гб",IDC_UNIT, 117,24,14,9 + LTEXT "Файловая система:",IDC_STATIC,13,46,35,9 CONTROL "",IDC_FSTYPE,"ComboBox",WS_VISIBLE|WS_TABSTOP|CBS_DROPDOWNLIST,52,42,79,50 - PUSHBUTTON "&",IDOK,35,68,47,15, WS_VISIBLE|WS_TABSTOP - PUSHBUTTON "&",IDCANCEL,87,68,47,15, WS_VISIBLE|WS_TABSTOP + PUSHBUTTON "&Есть",IDOK,35,68,47,15, WS_VISIBLE|WS_TABSTOP + PUSHBUTTON "&Отставить",IDCANCEL,87,68,47,15, WS_VISIBLE|WS_TABSTOP END IDD_BOOTOPTIONS DIALOGEX DISCARDABLE 0, 0, 305, 116 STYLE WS_VISIBLE|WS_CAPTION|WS_THICKFRAME -CAPTION " " +CAPTION "Дополнительные параметры установки" FONT 8, "MS Shell Dlg" BEGIN - CONTROL " ", IDC_STATIC, "Button", BS_GROUPBOX, 4,1,298,30 + CONTROL "Базовый каталог", IDC_STATIC, "Button", BS_GROUPBOX, 4,1,298,30 EDITTEXT IDC_PATH, 10,12,283,14, WS_VISIBLE - CONTROL " ", IDC_STATIC, "Button", BS_GROUPBOX, 4,36,298,52 + CONTROL "Установка загрузчика", IDC_STATIC, "Button", BS_GROUPBOX, 4,36,298,52 - CONTROL " (MBR VBR)", IDC_INSTFREELDR, "Button", BS_AUTORADIOBUTTON | WS_TABSTOP, 10,49,278,11 - CONTROL " ( VBR)", IDC_INSTVBRONLY, "Button", BS_AUTORADIOBUTTON | WS_TABSTOP, 10,57,278,11 - CONTROL " ", IDC_NOINSTFREELDR, "Button", BS_AUTORADIOBUTTON | WS_TABSTOP | WS_DISABLED , 10,68,278,11 + CONTROL "Установить загрузчик на диск (MBR и VBR)", IDC_INSTFREELDR, "Button", BS_AUTORADIOBUTTON | WS_TABSTOP, 10,49,278,11 + CONTROL "Установить загрузчик на диск (только VBR)", IDC_INSTVBRONLY, "Button", BS_AUTORADIOBUTTON | WS_TABSTOP, 10,57,278,11 + CONTROL "Не устанавливать загрузчик", IDC_NOINSTFREELDR, "Button", BS_AUTORADIOBUTTON | WS_TABSTOP | WS_DISABLED , 10,68,278,11 PUSHBUTTON "&OK", IDOK, 180,94,50,15, WS_TABSTOP | WS_VISIBLE - PUSHBUTTON "&", IDCANCEL, 240,94,50,15, WS_TABSTOP | WS_VISIBLE + PUSHBUTTON "&Отмена", IDCANCEL, 240,94,50,15, WS_TABSTOP | WS_VISIBLE END IDD_SUMMARYPAGE DIALOGEX 0, 0, 317, 193 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " ReactOS" +CAPTION "Установка ReactOS" FONT 8, "MS Shell Dlg" BEGIN CONTROL "Installation summary", IDC_ACTION, "Button", BS_GROUPBOX, 10,0,297,172 - LTEXT " """".", IDC_STATIC, 10, 180 ,277, 20 + LTEXT "Для начала установки нажмите ""Далее"".", IDC_STATIC, 10, 180 ,277, 20 END IDD_PROCESSPAGE DIALOGEX 0, 0, 317, 193 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " ReactOS" +CAPTION "Установка ReactOS" FONT 8, "MS Shell Dlg" BEGIN - CONTROL " ", IDC_ACTION, "Button", BS_GROUPBOX, 10,0,297,172 - LTEXT " ...", IDC_ACTIVITY, 20, 50, 277, 10 + CONTROL "Производится установка", IDC_ACTION, "Button", BS_GROUPBOX, 10,0,297,172 + LTEXT "Копирование файлов...", IDC_ACTIVITY, 20, 50, 277, 10 LTEXT "test.txt", IDC_ITEM, 30, 80, 257, 10 CONTROL "", IDC_PROCESSPROGRESS, "msctls_progress32", PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 20, 120, 277, 8 @@ -121,34 +121,34 @@ END IDD_RESTARTPAGE DIALOGEX DISCARDABLE 0, 0, 317, 193 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " ReactOS" +CAPTION "Завершение установки ReactOS" FONT 8, "MS Shell Dlg" BEGIN - CONTROL " ReactOS", IDC_FINISHTITLE, "Button", BS_GROUPBOX, 10,0,297,172 - LTEXT " ReactOS .", IDC_STATIC, 20, 50, 277, 10 + CONTROL "Завершение первого этапа установки ReactOS", IDC_FINISHTITLE, "Button", BS_GROUPBOX, 10,0,297,172 + LTEXT "Первый этап установки ReactOS закончен.", IDC_STATIC, 20, 50, 277, 10 - LTEXT " """" .", IDC_STATIC, 20, 80, 277, 10 + LTEXT "После нажатия клавиши ""Завершить"" ваш компьютер будет перезагружен.", IDC_STATIC, 20, 80, 277, 10 CONTROL "", IDC_RESTART_PROGRESS, "msctls_progress32", PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 20, 120, 277, 8 - LTEXT " . """".", IDC_STATIC, 10, 176, 297, 20 + LTEXT "Вы можете извлечь установочный диск. Для перезагрузки компьютера нажмите клавишу ""Завершить"".", IDC_STATIC, 10, 176, 297, 20 END STRINGTABLE BEGIN - IDS_LANGTITLE " " - IDS_LANGSUBTITLE " ." - IDS_TYPETITLE " ReactOS" - IDS_TYPESUBTITLE " ." - IDS_DEVICETITLE " " - IDS_DEVICESUBTITLE " ." - IDS_DRIVETITLE " " - IDS_DRIVESUBTITLE " , ." - IDS_PROCESSTITLE " , " - IDS_PROCESSSUBTITLE " , , " - IDS_RESTARTTITLE " " - IDS_RESTARTSUBTITLE " , " + IDS_LANGTITLE "Выбор языка" + IDS_LANGSUBTITLE "Выберите язык по умолчанию в системе." + IDS_TYPETITLE "Вас приветствует программа установки ReactOS" + IDS_TYPESUBTITLE "Выберите тип установки." + IDS_DEVICETITLE "Установка базовых устройств" + IDS_DEVICESUBTITLE "Настройка параметров экрана и клавиатуры." + IDS_DRIVETITLE "Выбор расположения на диске и системного каталога" + IDS_DRIVESUBTITLE "Подготовка раздела диска, системного каталога и загрузчика." + IDS_PROCESSTITLE "Подготовка раздела диска, копирование системных файлов" + IDS_PROCESSSUBTITLE "Создание раздела на диске, копирование файлов, установка загрузчика" + IDS_RESTARTTITLE "Первый этап установки закончен" + IDS_RESTARTSUBTITLE "Первый этап закончен, для продолжения требуется перезагрузка" IDS_SUMMARYTITLE "Installation Summary" IDS_SUMMARYSUBTITLE "List installation properties to check before apply to the installation device" - IDS_ABORTSETUP "ReactOS . , ReactOS. , ?" - IDS_ABORTSETUP2 " ?" + IDS_ABORTSETUP "ReactOS установлен на компьютер не полностью. Если вы закроете программу установки сейчас, в дальнейшем вам придется повторить установку ReactOS. Вы уверены, что необходимо прервать установку?" + IDS_ABORTSETUP2 "Прервать установку?" END /* EOF */ diff --git a/base/setup/reactos/lang/uk-UA.rc b/base/setup/reactos/lang/uk-UA.rc index 99f395a9562..a2c9e1c1b7b 100644 --- a/base/setup/reactos/lang/uk-UA.rc +++ b/base/setup/reactos/lang/uk-UA.rc @@ -10,116 +10,116 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT IDD_STARTPAGE DIALOGEX DISCARDABLE 0, 0, 317, 193 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " ReactOS" +CAPTION "Встановлення ReactOS" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ReactOS.", IDC_STARTTITLE, 115, 8, 195, 24 - LTEXT " ReactOS CD! CD , ReactOS.", IDC_STATIC, 115, 40, 195, 100 - LTEXT " .", IDC_STATIC, 115, 169, 195, 17 + LTEXT "Вас вітає програма встановлення ReactOS.", IDC_STARTTITLE, 115, 8, 195, 24 + LTEXT "Ви не можете встановити ReactOS прямо з цього CD! Будь ласка перезапустіть Ваш комп’ютер з цього CD для того, щоб встановити ReactOS.", IDC_STATIC, 115, 40, 195, 100 + LTEXT "Натисніть кнопку Завершити для виходу.", IDC_STATIC, 115, 169, 195, 17 END IDD_LANGSELPAGE DIALOGEX DISCARDABLE 0, 0, 317, 193 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " ReactOS" +CAPTION "Встановлення ReactOS" FONT 8, "MS Shell Dlg" BEGIN CONTROL "IDB_LOGO", IDB_ROSLOGO, "Static", WS_CHILD | WS_VISIBLE | SS_OWNERDRAW, 18, 0, 290, 99 - CONTROL " :", IDC_STATIC, "Static", WS_CHILD | WS_VISIBLE | WS_GROUP | SS_RIGHT, 20, 109, 106, 11 + CONTROL "Мова системи:", IDC_STATIC, "Static", WS_CHILD | WS_VISIBLE | WS_GROUP | SS_RIGHT, 20, 109, 106, 11 CONTROL "", IDC_LANGUAGES, "ComboBox", WS_VSCROLL | WS_TABSTOP | CBS_DROPDOWNLIST, 132, 107, 176, 142 - CONTROL " :", IDC_STATIC, "Static", WS_CHILD | WS_VISIBLE | WS_GROUP | SS_RIGHT, 20, 142, 106, 11 + CONTROL "Розкладка клавіатури:", IDC_STATIC, "Static", WS_CHILD | WS_VISIBLE | WS_GROUP | SS_RIGHT, 20, 142, 106, 11 CONTROL "", IDC_KEYLAYOUT, "ComboBox", WS_VSCROLL | WS_TABSTOP | CBS_DROPDOWNLIST, 132, 141, 176, 81 - LTEXT " .", IDC_STATIC, 10, 180 ,297, 10 + LTEXT "Для вибору типу встановлення натисніть Далі.", IDC_STATIC, 10, 180 ,297, 10 END IDD_TYPEPAGE DIALOGEX DISCARDABLE 0, 0, 317, 193 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " ReactOS" +CAPTION "Встановлення ReactOS" FONT 8, "MS Shell Dlg" BEGIN - CONTROL " ", IDC_STATIC, "Button", BS_GROUPBOX, 10,0,297,172 - CONTROL " ReactOS", IDC_INSTALL, "Button", BS_AUTORADIOBUTTON | WS_TABSTOP, 20, 15, 277, 10 - CONTROL "³ ReactOS", IDC_SETUP, "Button", BS_AUTORADIOBUTTON | WS_TABSTOP | WS_DISABLED , 20, 30, 277, 10 - LTEXT " .", IDC_STATIC, 10, 180 ,297, 10 + CONTROL "Тип встановлення", IDC_STATIC, "Button", BS_GROUPBOX, 10,0,297,172 + CONTROL "Встановлення ReactOS", IDC_INSTALL, "Button", BS_AUTORADIOBUTTON | WS_TABSTOP, 20, 15, 277, 10 + CONTROL "Відновити або змінити встановлений раніше ReactOS", IDC_SETUP, "Button", BS_AUTORADIOBUTTON | WS_TABSTOP | WS_DISABLED , 20, 30, 277, 10 + LTEXT "Для встановлення пристроїв натисніть Далі.", IDC_STATIC, 10, 180 ,297, 10 END IDD_DEVICEPAGE DIALOGEX DISCARDABLE 0, 0, 317, 193 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " ReactOS" +CAPTION "Встановлення ReactOS" FONT 8, "MS Shell Dlg" BEGIN - CONTROL " ", IDC_STATIC, "Button", BS_GROUPBOX, 10,0,297,172 - LTEXT ":", IDC_STATIC, 20,15, 80, 10 + CONTROL "Основні пристрої", IDC_STATIC, "Button", BS_GROUPBOX, 10,0,297,172 + LTEXT "Комп’ютер:", IDC_STATIC, 20,15, 80, 10 CONTROL "", IDC_COMPUTER, "ComboBox", WS_VSCROLL | WS_TABSTOP | CBS_DROPDOWNLIST , 100, 15, 180, 80 - LTEXT ":", IDC_STATIC, 20,35, 80, 10 + LTEXT "Екран:", IDC_STATIC, 20,35, 80, 10 CONTROL "", IDC_DISPLAY, "ComboBox", WS_VSCROLL | WS_TABSTOP | CBS_DROPDOWNLIST , 100, 35, 180, 80 - LTEXT ":", IDC_STATIC, 20,55, 80, 10 + LTEXT "Клавіатура:", IDC_STATIC, 20,55, 80, 10 CONTROL "", IDC_KEYBOARD, "ComboBox", WS_VSCROLL | WS_TABSTOP | CBS_DROPDOWNLIST , 100, 55, 180, 80 - LTEXT " .", IDC_STATIC, 10, 180 ,277, 20 + LTEXT "Для встановлення пристроїв натисніть Далі.", IDC_STATIC, 10, 180 ,277, 20 END IDD_DRIVEPAGE DIALOGEX DISCARDABLE 0, 0, 317, 193 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " ReactOS" +CAPTION "Встановлення ReactOS" FONT 8, "MS Shell Dlg" BEGIN - CONTROL " ReactOS", IDC_STATIC, "Button", BS_GROUPBOX, 10,1,298,176 + CONTROL "Розділи для встановлення ReactOS", IDC_STATIC, "Button", BS_GROUPBOX, 10,1,298,176 LISTBOX IDC_PARTITION, 20,12,278,142,LBS_HASSTRINGS | WS_VSCROLL - PUSHBUTTON "&", IDC_PARTCREATE, 20,155,50,15 - PUSHBUTTON "&", IDC_PARTDELETE, 76,155,50,15 - PUSHBUTTON "&", IDC_DEVICEDRIVER, 162,155,50,15, WS_DISABLED - PUSHBUTTON "& ...", IDC_PARTMOREOPTS, 218,155,80,15 - LTEXT " ", IDC_STATIC, 10, 180 ,277, 20 + PUSHBUTTON "&Створити", IDC_PARTCREATE, 20,155,50,15 + PUSHBUTTON "&Видалити", IDC_PARTDELETE, 76,155,50,15 + PUSHBUTTON "Д&райвер", IDC_DEVICEDRIVER, 162,155,50,15, WS_DISABLED + PUSHBUTTON "&Додаткові Опції...", IDC_PARTMOREOPTS, 218,155,80,15 + LTEXT "Для початку встановлення натисніть Далі", IDC_STATIC, 10, 180 ,277, 20 END IDD_PARTITION DIALOGEX DISCARDABLE 0, 0, 172, 90 STYLE WS_VISIBLE|WS_CAPTION|WS_THICKFRAME -CAPTION " " +CAPTION "Створення розділу" FONT 8, "MS Shell Dlg" BEGIN CONTROL "",IDC_UPDOWN1,"msctls_updown32", WS_VISIBLE,131,22,9,13 - CONTROL " ",IDC_STATIC,"Button",BS_GROUPBOX,7,5,156,57 - LTEXT ":",IDC_STATIC, 13,24,27,9 + CONTROL "Створити та відформатувати розділ",IDC_STATIC,"Button",BS_GROUPBOX,7,5,156,57 + LTEXT "Розмір:",IDC_STATIC, 13,24,27,9 EDITTEXT IDC_PARTSIZE,79,23,53,13, WS_VISIBLE|WS_TABSTOP - LTEXT "",IDC_UNIT, 144,24,14,9 - LTEXT " :",IDC_STATIC,13,46,65,9 + LTEXT "Гб",IDC_UNIT, 144,24,14,9 + LTEXT "Файлова система:",IDC_STATIC,13,46,65,9 CONTROL "",IDC_FSTYPE,"ComboBox",WS_VISIBLE|WS_TABSTOP|CBS_DROPDOWNLIST,79,42,79,50 PUSHBUTTON "&OK",IDOK,35,68,47,15, WS_VISIBLE|WS_TABSTOP - PUSHBUTTON "&",IDCANCEL,87,68,47,15, WS_VISIBLE|WS_TABSTOP + PUSHBUTTON "&Скасувати",IDCANCEL,87,68,47,15, WS_VISIBLE|WS_TABSTOP END IDD_BOOTOPTIONS DIALOGEX DISCARDABLE 0, 0, 305, 116 STYLE WS_VISIBLE|WS_CAPTION|WS_THICKFRAME -CAPTION " " +CAPTION "Розширені параметри розділу" FONT 8, "MS Shell Dlg" BEGIN - CONTROL " ", IDC_STATIC, "Button", BS_GROUPBOX, 4,1,298,30 + CONTROL "Тека встановлення", IDC_STATIC, "Button", BS_GROUPBOX, 4,1,298,30 EDITTEXT IDC_PATH, 10,11,278,13, WS_VISIBLE - CONTROL " ", IDC_STATIC, "Button", BS_GROUPBOX, 4,36,298,52 + CONTROL "Встановлення завантажувача", IDC_STATIC, "Button", BS_GROUPBOX, 4,36,298,52 - CONTROL " (MBR VBR)", IDC_INSTFREELDR, "Button", BS_AUTORADIOBUTTON | WS_TABSTOP, 10,46,278,11 - CONTROL " ( VBR)", IDC_INSTVBRONLY, "Button", BS_AUTORADIOBUTTON | WS_TABSTOP, 10,57,278,11 - CONTROL " ", IDC_NOINSTFREELDR, "Button", BS_AUTORADIOBUTTON | WS_TABSTOP | WS_DISABLED , 10,68,278,11 + CONTROL "Встановити завантажувач на жосткий диск (MBR та VBR)", IDC_INSTFREELDR, "Button", BS_AUTORADIOBUTTON | WS_TABSTOP, 10,46,278,11 + CONTROL "Встановити завантажувач на жосткий диск (лише VBR)", IDC_INSTVBRONLY, "Button", BS_AUTORADIOBUTTON | WS_TABSTOP, 10,57,278,11 + CONTROL "Не встановлювати завантажувач", IDC_NOINSTFREELDR, "Button", BS_AUTORADIOBUTTON | WS_TABSTOP | WS_DISABLED , 10,68,278,11 PUSHBUTTON "&OK", IDOK, 180,94,50,15, WS_TABSTOP | WS_VISIBLE - PUSHBUTTON "&", IDCANCEL, 240,94,50,15, WS_TABSTOP | WS_VISIBLE + PUSHBUTTON "&Скасувати", IDCANCEL, 240,94,50,15, WS_TABSTOP | WS_VISIBLE END IDD_SUMMARYPAGE DIALOGEX 0, 0, 317, 193 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " ReactOS" +CAPTION "Встановлення ReactOS" FONT 8, "MS Shell Dlg" BEGIN - CONTROL " ", IDC_ACTION, "Button", BS_GROUPBOX, 10,0,297,172 - LTEXT " .", IDC_STATIC, 10, 180 ,277, 20 + CONTROL "Інформація про Встановлення", IDC_ACTION, "Button", BS_GROUPBOX, 10,0,297,172 + LTEXT "Для початку встановлення натисніть Далі.", IDC_STATIC, 10, 180 ,277, 20 END IDD_PROCESSPAGE DIALOGEX 0, 0, 317, 193 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " ReactOS" +CAPTION "Встановлення ReactOS" FONT 8, "MS Shell Dlg" BEGIN - CONTROL " ", IDC_ACTION, "Button", BS_GROUPBOX, 10,0,297,172 - LTEXT " ...", IDC_ACTIVITY, 20, 50, 277, 10 + CONTROL "Виконується встановлення", IDC_ACTION, "Button", BS_GROUPBOX, 10,0,297,172 + LTEXT "Копіювання файлів...", IDC_ACTIVITY, 20, 50, 277, 10 LTEXT "test.txt", IDC_ITEM, 30, 80, 257, 10 CONTROL "", IDC_PROCESSPROGRESS, "msctls_progress32", PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 20, 120, 277, 8 @@ -127,34 +127,34 @@ END IDD_RESTARTPAGE DIALOGEX DISCARDABLE 0, 0, 317, 193 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " ReactOS" +CAPTION "Завершення встановлення ReactOS" FONT 8, "MS Shell Dlg" BEGIN - CONTROL " ReactOS", IDC_FINISHTITLE, "Button", BS_GROUPBOX, 10,0,297,172 - LTEXT " ReactOS .", IDC_STATIC, 20, 50, 277, 10 + CONTROL "Завершення першого етапу встановлення ReactOS", IDC_FINISHTITLE, "Button", BS_GROUPBOX, 10,0,297,172 + LTEXT "Перший етап встановлення ReactOS завершено.", IDC_STATIC, 20, 50, 277, 10 - LTEXT "ϳ ' .", IDC_STATIC, 20, 80, 277, 10 + LTEXT "Після натискання клавіші Завершити ваш комп'ютер буде перезавантажений.", IDC_STATIC, 20, 80, 277, 10 CONTROL "", IDC_RESTART_PROGRESS, "msctls_progress32", PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 20, 120, 277, 8 - LTEXT " . ' ", IDC_STATIC, 10, 180, 297, 20 + LTEXT "Ви можете витягнути інсталяційний диск. Для перезавантаження комп'ютера натисніть Завершити", IDC_STATIC, 10, 180, 297, 20 END STRINGTABLE BEGIN - IDS_LANGTITLE " " - IDS_LANGSUBTITLE " ." - IDS_TYPETITLE " ReactOS" - IDS_TYPESUBTITLE " ." - IDS_DEVICETITLE " " - IDS_DEVICESUBTITLE " ." - IDS_DRIVETITLE " " - IDS_DRIVESUBTITLE "ϳ , ." - IDS_PROCESSTITLE "ϳ , " - IDS_PROCESSSUBTITLE " , , " - IDS_RESTARTTITLE " " - IDS_RESTARTSUBTITLE " , " - IDS_SUMMARYTITLE " " - IDS_SUMMARYSUBTITLE " , " - IDS_ABORTSETUP "ReactOS ' . , ReactOS. , ?" - IDS_ABORTSETUP2 " ?" + IDS_LANGTITLE "Вибір мови" + IDS_LANGSUBTITLE "Виберіть мову за замовчуванням в системі." + IDS_TYPETITLE "Вас вітає програма встановлення ReactOS" + IDS_TYPESUBTITLE "Виберіть тип встановлення." + IDS_DEVICETITLE "Встановлення базових пристроїв" + IDS_DEVICESUBTITLE "Налаштування параметрів екрану та клавіатури." + IDS_DRIVETITLE "Вибір розташування на диску і системного каталогу" + IDS_DRIVESUBTITLE "Підготовка розділу диска, системного каталогу та завантажувача." + IDS_PROCESSTITLE "Підготовка розділу диска, копіювання системних файлів" + IDS_PROCESSSUBTITLE "Створення розділу на диску, копіювання файлів, встановлення завантажувача" + IDS_RESTARTTITLE "Перший етап встановлення завершено" + IDS_RESTARTSUBTITLE "Перший етап завершено, для продовження потрібне перезавантаження" + IDS_SUMMARYTITLE "Інформація про Встановлення" + IDS_SUMMARYSUBTITLE "Перевірте список властивостей встановлення, перш ніж почати встановлення системи" + IDS_ABORTSETUP "ReactOS встановлений на комп'ютер не повністю. Якщо ви закриєте програму встановлення зараз, в подальшому вам доведеться повторити встановлення ReactOS. Ви впевнені, що необхідно перервати встановлення?" + IDS_ABORTSETUP2 "Перервати встановлення?" END /* EOF */ diff --git a/base/setup/reactos/rsrc.rc b/base/setup/reactos/rsrc.rc index f864e04433e..5b28b84f20b 100644 --- a/base/setup/reactos/rsrc.rc +++ b/base/setup/reactos/rsrc.rc @@ -20,13 +20,13 @@ #include "lang/no-NO.rc" #include "lang/pt-BR.rc" #include "lang/ro-RO.rc" -#include "lang/ru-RU.rc" #include "lang/sk-SK.rc" /*#include "lang/sv-SE.rc" #include "lang/th-TH.rc"*/ -#include "lang/uk-UA.rc" //#include "lang/zh-CN.rc" // UTF-8 #pragma code_page(65001) #include "lang/pl-PL.rc" +#include "lang/ru-RU.rc" +#include "lang/uk-UA.rc" diff --git a/base/setup/usetup/CMakeLists.txt b/base/setup/usetup/CMakeLists.txt index bdc96518df0..d6f85340f0f 100644 --- a/base/setup/usetup/CMakeLists.txt +++ b/base/setup/usetup/CMakeLists.txt @@ -1,5 +1,6 @@ include_directories( + ${CMAKE_CURRENT_SOURCE_DIR} ${REACTOS_SOURCE_DIR}/lib/newinflib ${REACTOS_SOURCE_DIR}/lib/3rdparty/zlib ${REACTOS_SOURCE_DIR}/include/reactos/drivers) @@ -38,4 +39,5 @@ target_link_libraries(usetup set_module_type(usetup nativecui) add_importlibs(usetup ntdll) +add_pch(usetup usetup.h) add_cd_file(TARGET usetup DESTINATION reactos/system32 NO_CAB NAME_ON_CD smss.exe FOR bootcd regtest) diff --git a/base/setup/usetup/bootsup.c b/base/setup/usetup/bootsup.c index 3f880c97feb..64f10bc86f5 100644 --- a/base/setup/usetup/bootsup.c +++ b/base/setup/usetup/bootsup.c @@ -1,21 +1,3 @@ -/* - * ReactOS kernel - * Copyright (C) 2002 ReactOS Team - * - * This 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. - * - * This 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. - * - * You 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. - */ /* * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS text-mode setup @@ -34,66 +16,66 @@ #include typedef struct _FAT_BOOTSECTOR { - UCHAR JumpBoot[3]; // Jump instruction to boot code - CHAR OemName[8]; // "MSWIN4.1" for MS formatted volumes - USHORT BytesPerSector; // Bytes per sector - UCHAR SectorsPerCluster; // Number of sectors in a cluster - USHORT ReservedSectors; // Reserved sectors, usually 1 (the bootsector) - UCHAR NumberOfFats; // Number of FAT tables - USHORT RootDirEntries; // Number of root directory entries (fat12/16) - USHORT TotalSectors; // Number of total sectors on the drive, 16-bit - UCHAR MediaDescriptor; // Media descriptor byte - USHORT SectorsPerFat; // Sectors per FAT table (fat12/16) - USHORT SectorsPerTrack; // Number of sectors in a track - USHORT NumberOfHeads; // Number of heads on the disk - ULONG HiddenSectors; // Hidden sectors (sectors before the partition start like the partition table) - ULONG TotalSectorsBig; // This field is the new 32-bit total count of sectors on the volume - UCHAR DriveNumber; // Int 0x13 drive number (e.g. 0x80) - UCHAR Reserved1; // Reserved (used by Windows NT). Code that formats FAT volumes should always set this byte to 0. - UCHAR BootSignature; // Extended boot signature (0x29). This is a signature byte that indicates that the following three fields in the boot sector are present. - ULONG VolumeSerialNumber; // Volume serial number - CHAR VolumeLabel[11]; // Volume label. This field matches the 11-byte volume label recorded in the root directory - CHAR FileSystemType[8]; // One of the strings "FAT12 ", "FAT16 ", or "FAT " + UCHAR JumpBoot[3]; // Jump instruction to boot code + CHAR OemName[8]; // "MSWIN4.1" for MS formatted volumes + USHORT BytesPerSector; // Bytes per sector + UCHAR SectorsPerCluster; // Number of sectors in a cluster + USHORT ReservedSectors; // Reserved sectors, usually 1 (the bootsector) + UCHAR NumberOfFats; // Number of FAT tables + USHORT RootDirEntries; // Number of root directory entries (fat12/16) + USHORT TotalSectors; // Number of total sectors on the drive, 16-bit + UCHAR MediaDescriptor; // Media descriptor byte + USHORT SectorsPerFat; // Sectors per FAT table (fat12/16) + USHORT SectorsPerTrack; // Number of sectors in a track + USHORT NumberOfHeads; // Number of heads on the disk + ULONG HiddenSectors; // Hidden sectors (sectors before the partition start like the partition table) + ULONG TotalSectorsBig; // This field is the new 32-bit total count of sectors on the volume + UCHAR DriveNumber; // Int 0x13 drive number (e.g. 0x80) + UCHAR Reserved1; // Reserved (used by Windows NT). Code that formats FAT volumes should always set this byte to 0. + UCHAR BootSignature; // Extended boot signature (0x29). This is a signature byte that indicates that the following three fields in the boot sector are present. + ULONG VolumeSerialNumber; // Volume serial number + CHAR VolumeLabel[11]; // Volume label. This field matches the 11-byte volume label recorded in the root directory + CHAR FileSystemType[8]; // One of the strings "FAT12 ", "FAT16 ", or "FAT " - UCHAR BootCodeAndData[448]; // The remainder of the boot sector + UCHAR BootCodeAndData[448]; // The remainder of the boot sector - USHORT BootSectorMagic; // 0xAA55 + USHORT BootSectorMagic; // 0xAA55 } FAT_BOOTSECTOR, *PFAT_BOOTSECTOR; typedef struct _FAT32_BOOTSECTOR { - UCHAR JumpBoot[3]; // Jump instruction to boot code - CHAR OemName[8]; // "MSWIN4.1" for MS formatted volumes - USHORT BytesPerSector; // Bytes per sector - UCHAR SectorsPerCluster; // Number of sectors in a cluster - USHORT ReservedSectors; // Reserved sectors, usually 1 (the bootsector) - UCHAR NumberOfFats; // Number of FAT tables - USHORT RootDirEntries; // Number of root directory entries (fat12/16) - USHORT TotalSectors; // Number of total sectors on the drive, 16-bit - UCHAR MediaDescriptor; // Media descriptor byte - USHORT SectorsPerFat; // Sectors per FAT table (fat12/16) - USHORT SectorsPerTrack; // Number of sectors in a track - USHORT NumberOfHeads; // Number of heads on the disk - ULONG HiddenSectors; // Hidden sectors (sectors before the partition start like the partition table) - ULONG TotalSectorsBig; // This field is the new 32-bit total count of sectors on the volume - ULONG SectorsPerFatBig; // This field is the FAT32 32-bit count of sectors occupied by ONE FAT. BPB_FATSz16 must be 0 - USHORT ExtendedFlags; // Extended flags (fat32) - USHORT FileSystemVersion; // File system version (fat32) - ULONG RootDirStartCluster; // Starting cluster of the root directory (fat32) - USHORT FsInfo; // Sector number of FSINFO structure in the reserved area of the FAT32 volume. Usually 1. - USHORT BackupBootSector; // If non-zero, indicates the sector number in the reserved area of the volume of a copy of the boot record. Usually 6. - UCHAR Reserved[12]; // Reserved for future expansion - UCHAR DriveNumber; // Int 0x13 drive number (e.g. 0x80) - UCHAR Reserved1; // Reserved (used by Windows NT). Code that formats FAT volumes should always set this byte to 0. - UCHAR BootSignature; // Extended boot signature (0x29). This is a signature byte that indicates that the following three fields in the boot sector are present. - ULONG VolumeSerialNumber; // Volume serial number - CHAR VolumeLabel[11]; // Volume label. This field matches the 11-byte volume label recorded in the root directory - CHAR FileSystemType[8]; // Always set to the string "FAT32 " + UCHAR JumpBoot[3]; // Jump instruction to boot code + CHAR OemName[8]; // "MSWIN4.1" for MS formatted volumes + USHORT BytesPerSector; // Bytes per sector + UCHAR SectorsPerCluster; // Number of sectors in a cluster + USHORT ReservedSectors; // Reserved sectors, usually 1 (the bootsector) + UCHAR NumberOfFats; // Number of FAT tables + USHORT RootDirEntries; // Number of root directory entries (fat12/16) + USHORT TotalSectors; // Number of total sectors on the drive, 16-bit + UCHAR MediaDescriptor; // Media descriptor byte + USHORT SectorsPerFat; // Sectors per FAT table (fat12/16) + USHORT SectorsPerTrack; // Number of sectors in a track + USHORT NumberOfHeads; // Number of heads on the disk + ULONG HiddenSectors; // Hidden sectors (sectors before the partition start like the partition table) + ULONG TotalSectorsBig; // This field is the new 32-bit total count of sectors on the volume + ULONG SectorsPerFatBig; // This field is the FAT32 32-bit count of sectors occupied by ONE FAT. BPB_FATSz16 must be 0 + USHORT ExtendedFlags; // Extended flags (fat32) + USHORT FileSystemVersion; // File system version (fat32) + ULONG RootDirStartCluster; // Starting cluster of the root directory (fat32) + USHORT FsInfo; // Sector number of FSINFO structure in the reserved area of the FAT32 volume. Usually 1. + USHORT BackupBootSector; // If non-zero, indicates the sector number in the reserved area of the volume of a copy of the boot record. Usually 6. + UCHAR Reserved[12]; // Reserved for future expansion + UCHAR DriveNumber; // Int 0x13 drive number (e.g. 0x80) + UCHAR Reserved1; // Reserved (used by Windows NT). Code that formats FAT volumes should always set this byte to 0. + UCHAR BootSignature; // Extended boot signature (0x29). This is a signature byte that indicates that the following three fields in the boot sector are present. + ULONG VolumeSerialNumber; // Volume serial number + CHAR VolumeLabel[11]; // Volume label. This field matches the 11-byte volume label recorded in the root directory + CHAR FileSystemType[8]; // Always set to the string "FAT32 " - UCHAR BootCodeAndData[420]; // The remainder of the boot sector + UCHAR BootCodeAndData[420]; // The remainder of the boot sector - USHORT BootSectorMagic; // 0xAA55 + USHORT BootSectorMagic; // 0xAA55 } FAT32_BOOTSECTOR, *PFAT32_BOOTSECTOR; #include @@ -103,320 +85,318 @@ extern PPARTLIST PartitionList; /* FUNCTIONS ****************************************************************/ -static VOID +static +VOID CreateCommonFreeLoaderSections(PINICACHE IniCache) { - PINICACHESECTION IniSection; + PINICACHESECTION IniSection; - /* Create "FREELOADER" section */ - IniSection = IniCacheAppendSection(IniCache, - L"FREELOADER"); + /* Create "FREELOADER" section */ + IniSection = IniCacheAppendSection(IniCache, + L"FREELOADER"); #if DBG - if (IsUnattendedSetup) - { - /* DefaultOS=ReactOS */ - IniCacheInsertKey(IniSection, - NULL, - INSERT_LAST, - L"DefaultOS", - L"ReactOS_KdSerial"); - } - else + if (IsUnattendedSetup) + { + /* DefaultOS=ReactOS */ + IniCacheInsertKey(IniSection, + NULL, + INSERT_LAST, + L"DefaultOS", + L"ReactOS_KdSerial"); + } + else #endif - { - /* DefaultOS=ReactOS */ - IniCacheInsertKey(IniSection, - NULL, - INSERT_LAST, - L"DefaultOS", - L"ReactOS"); - } + { + /* DefaultOS=ReactOS */ + IniCacheInsertKey(IniSection, + NULL, + INSERT_LAST, + L"DefaultOS", + L"ReactOS"); + } #if DBG - if (IsUnattendedSetup) + if (IsUnattendedSetup) #endif - { - /* Timeout=0 for unattended or non debug*/ - IniCacheInsertKey(IniSection, - NULL, - INSERT_LAST, - L"TimeOut", - L"0"); - } + { + /* Timeout=0 for unattended or non debug*/ + IniCacheInsertKey(IniSection, + NULL, + INSERT_LAST, + L"TimeOut", + L"0"); + } #if DBG - else - { - /* Timeout=0 or 10 */ - IniCacheInsertKey(IniSection, - NULL, - INSERT_LAST, - L"TimeOut", - L"10"); - } + else + { + /* Timeout=0 or 10 */ + IniCacheInsertKey(IniSection, + NULL, + INSERT_LAST, + L"TimeOut", + L"10"); + } #endif - /* Create "Display" section */ - IniSection = IniCacheAppendSection(IniCache, - L"Display"); + /* Create "Display" section */ + IniSection = IniCacheAppendSection(IniCache, L"Display"); - /* TitleText=ReactOS Boot Manager */ - IniCacheInsertKey(IniSection, - NULL, - INSERT_LAST, - L"TitleText", - L"ReactOS Boot Manager"); + /* TitleText=ReactOS Boot Manager */ + IniCacheInsertKey(IniSection, + NULL, + INSERT_LAST, + L"TitleText", + L"ReactOS Boot Manager"); - /* StatusBarColor=Cyan */ - IniCacheInsertKey(IniSection, - NULL, - INSERT_LAST, - L"StatusBarColor", - L"Cyan"); + /* StatusBarColor=Cyan */ + IniCacheInsertKey(IniSection, + NULL, + INSERT_LAST, + L"StatusBarColor", + L"Cyan"); - /* StatusBarTextColor=Black */ - IniCacheInsertKey(IniSection, - NULL, - INSERT_LAST, - L"StatusBarTextColor", - L"Black"); + /* StatusBarTextColor=Black */ + IniCacheInsertKey(IniSection, + NULL, + INSERT_LAST, + L"StatusBarTextColor", + L"Black"); - /* BackdropTextColor=White */ - IniCacheInsertKey(IniSection, - NULL, - INSERT_LAST, - L"BackdropTextColor", - L"White"); + /* BackdropTextColor=White */ + IniCacheInsertKey(IniSection, + NULL, + INSERT_LAST, + L"BackdropTextColor", + L"White"); - /* BackdropColor=Blue */ - IniCacheInsertKey(IniSection, - NULL, - INSERT_LAST, - L"BackdropColor", - L"Blue"); + /* BackdropColor=Blue */ + IniCacheInsertKey(IniSection, + NULL, + INSERT_LAST, + L"BackdropColor", + L"Blue"); - /* BackdropFillStyle=Medium */ - IniCacheInsertKey(IniSection, - NULL, - INSERT_LAST, - L"BackdropFillStyle", - L"Medium"); + /* BackdropFillStyle=Medium */ + IniCacheInsertKey(IniSection, + NULL, + INSERT_LAST, + L"BackdropFillStyle", + L"Medium"); - /* TitleBoxTextColor=White */ - IniCacheInsertKey(IniSection, - NULL, - INSERT_LAST, - L"TitleBoxTextColor", - L"White"); + /* TitleBoxTextColor=White */ + IniCacheInsertKey(IniSection, + NULL, + INSERT_LAST, + L"TitleBoxTextColor", + L"White"); - /* TitleBoxColor=Red */ - IniCacheInsertKey(IniSection, - NULL, - INSERT_LAST, - L"TitleBoxColor", - L"Red"); + /* TitleBoxColor=Red */ + IniCacheInsertKey(IniSection, + NULL, + INSERT_LAST, + L"TitleBoxColor", + L"Red"); - /* MessageBoxTextColor=White */ - IniCacheInsertKey(IniSection, - NULL, - INSERT_LAST, - L"MessageBoxTextColor", - L"White"); + /* MessageBoxTextColor=White */ + IniCacheInsertKey(IniSection, + NULL, + INSERT_LAST, + L"MessageBoxTextColor", + L"White"); - /* MessageBoxColor=Blue */ - IniCacheInsertKey(IniSection, - NULL, - INSERT_LAST, - L"MessageBoxColor", - L"Blue"); + /* MessageBoxColor=Blue */ + IniCacheInsertKey(IniSection, + NULL, + INSERT_LAST, + L"MessageBoxColor", + L"Blue"); - /* MenuTextColor=White */ - IniCacheInsertKey(IniSection, - NULL, - INSERT_LAST, - L"MenuTextColor", - L"Gray"); + /* MenuTextColor=White */ + IniCacheInsertKey(IniSection, + NULL, + INSERT_LAST, + L"MenuTextColor", + L"Gray"); - /* MenuColor=Blue */ - IniCacheInsertKey(IniSection, - NULL, - INSERT_LAST, - L"MenuColor", - L"Black"); + /* MenuColor=Blue */ + IniCacheInsertKey(IniSection, + NULL, + INSERT_LAST, + L"MenuColor", + L"Black"); - /* TextColor=Yellow */ - IniCacheInsertKey(IniSection, - NULL, - INSERT_LAST, - L"TextColor", - L"Gray"); + /* TextColor=Yellow */ + IniCacheInsertKey(IniSection, + NULL, + INSERT_LAST, + L"TextColor", + L"Gray"); - /* SelectedTextColor=Black */ - IniCacheInsertKey(IniSection, - NULL, - INSERT_LAST, - L"SelectedTextColor", - L"Black"); - - /* SelectedColor=Gray */ - IniCacheInsertKey(IniSection, - NULL, - INSERT_LAST, - L"SelectedColor", - L"Gray"); - - /* SelectedColor=Gray */ - IniCacheInsertKey(IniSection, - NULL, - INSERT_LAST, - L"ShowTime", - L"No"); + /* SelectedTextColor=Black */ + IniCacheInsertKey(IniSection, + NULL, + INSERT_LAST, + L"SelectedTextColor", + L"Black"); /* SelectedColor=Gray */ - IniCacheInsertKey(IniSection, - NULL, - INSERT_LAST, - L"MenuBox", - L"No"); + IniCacheInsertKey(IniSection, + NULL, + INSERT_LAST, + L"SelectedColor", + L"Gray"); /* SelectedColor=Gray */ - IniCacheInsertKey(IniSection, - NULL, - INSERT_LAST, - L"CenterMenu", - L"No"); + IniCacheInsertKey(IniSection, + NULL, + INSERT_LAST, + L"ShowTime", + L"No"); /* SelectedColor=Gray */ - IniCacheInsertKey(IniSection, - NULL, - INSERT_LAST, - L"MinimalUI", - L"Yes"); + IniCacheInsertKey(IniSection, + NULL, + INSERT_LAST, + L"MenuBox", + L"No"); /* SelectedColor=Gray */ - IniCacheInsertKey(IniSection, - NULL, - INSERT_LAST, - L"TimeText", - L"Seconds until highlighted choice will be started automatically: "); + IniCacheInsertKey(IniSection, + NULL, + INSERT_LAST, + L"CenterMenu", + L"No"); + + /* SelectedColor=Gray */ + IniCacheInsertKey(IniSection, + NULL, + INSERT_LAST, + L"MinimalUI", + L"Yes"); + + /* SelectedColor=Gray */ + IniCacheInsertKey(IniSection, + NULL, + INSERT_LAST, + L"TimeText", + L"Seconds until highlighted choice will be started automatically: "); } NTSTATUS -CreateFreeLoaderIniForDos(PWCHAR IniPath, - PWCHAR ArcPath) +CreateFreeLoaderIniForDos( + PWCHAR IniPath, + PWCHAR ArcPath) { - PINICACHE IniCache; - PINICACHESECTION IniSection; + PINICACHE IniCache; + PINICACHESECTION IniSection; - IniCache = IniCacheCreate(); + IniCache = IniCacheCreate(); - CreateCommonFreeLoaderSections(IniCache); + CreateCommonFreeLoaderSections(IniCache); - /* Create "Operating Systems" section */ - IniSection = IniCacheAppendSection(IniCache, - L"Operating Systems"); + /* Create "Operating Systems" section */ + IniSection = IniCacheAppendSection(IniCache, L"Operating Systems"); - /* REACTOS=ReactOS */ - IniCacheInsertKey(IniSection, - NULL, - INSERT_LAST, - L"ReactOS", - L"\"ReactOS\""); + /* REACTOS=ReactOS */ + IniCacheInsertKey(IniSection, + NULL, + INSERT_LAST, + L"ReactOS", + L"\"ReactOS\""); - /* ReactOS_Debug="ReactOS (Debug)" */ - IniCacheInsertKey(IniSection, - NULL, - INSERT_LAST, - L"ReactOS_Debug", - L"\"ReactOS (Debug)\""); + /* ReactOS_Debug="ReactOS (Debug)" */ + IniCacheInsertKey(IniSection, + NULL, + INSERT_LAST, + L"ReactOS_Debug", + L"\"ReactOS (Debug)\""); - /* DOS=Dos/Windows */ - IniCacheInsertKey(IniSection, - NULL, - INSERT_LAST, - L"DOS", - L"\"DOS/Windows\""); + /* DOS=Dos/Windows */ + IniCacheInsertKey(IniSection, + NULL, + INSERT_LAST, + L"DOS", + L"\"DOS/Windows\""); - /* Create "ReactOS" section */ - IniSection = IniCacheAppendSection(IniCache, - L"ReactOS"); + /* Create "ReactOS" section */ + IniSection = IniCacheAppendSection(IniCache, L"ReactOS"); - /* BootType=ReactOS */ - IniCacheInsertKey(IniSection, - NULL, - INSERT_LAST, - L"BootType", - L"ReactOS"); + /* BootType=ReactOS */ + IniCacheInsertKey(IniSection, + NULL, + INSERT_LAST, + L"BootType", + L"ReactOS"); - /* SystemPath= */ - IniCacheInsertKey(IniSection, - NULL, - INSERT_LAST, - L"SystemPath", - ArcPath); + /* SystemPath= */ + IniCacheInsertKey(IniSection, + NULL, + INSERT_LAST, + L"SystemPath", + ArcPath); - /* Create "ReactOS_Debug" section */ - IniSection = IniCacheAppendSection(IniCache, - L"ReactOS_Debug"); + /* Create "ReactOS_Debug" section */ + IniSection = IniCacheAppendSection(IniCache, L"ReactOS_Debug"); - /* BootType=ReactOS */ - IniCacheInsertKey(IniSection, - NULL, - INSERT_LAST, - L"BootType", - L"ReactOS"); + /* BootType=ReactOS */ + IniCacheInsertKey(IniSection, + NULL, + INSERT_LAST, + L"BootType", + L"ReactOS"); - /* SystemPath= */ - IniCacheInsertKey(IniSection, - NULL, - INSERT_LAST, - L"SystemPath", - ArcPath); + /* SystemPath= */ + IniCacheInsertKey(IniSection, + NULL, + INSERT_LAST, + L"SystemPath", + ArcPath); - /* Options=/DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200 /SOS */ - IniCacheInsertKey(IniSection, - NULL, - INSERT_LAST, - L"Options", - L"/DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200 /SOS"); + /* Options=/DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200 /SOS */ + IniCacheInsertKey(IniSection, + NULL, + INSERT_LAST, + L"Options", + L"/DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200 /SOS"); - /* Create "DOS" section */ - IniSection = IniCacheAppendSection(IniCache, - L"DOS"); + /* Create "DOS" section */ + IniSection = IniCacheAppendSection(IniCache, + L"DOS"); - /* BootType=BootSector */ - IniCacheInsertKey(IniSection, - NULL, - INSERT_LAST, - L"BootType", - L"BootSector"); + /* BootType=BootSector */ + IniCacheInsertKey(IniSection, + NULL, + INSERT_LAST, + L"BootType", + L"BootSector"); - /* BootDrive=hd0 */ - IniCacheInsertKey(IniSection, - NULL, - INSERT_LAST, - L"BootDrive", - L"hd0"); + /* BootDrive=hd0 */ + IniCacheInsertKey(IniSection, + NULL, + INSERT_LAST, + L"BootDrive", + L"hd0"); - /* BootPartition=1 */ - IniCacheInsertKey(IniSection, - NULL, - INSERT_LAST, - L"BootPartition", - L"1"); + /* BootPartition=1 */ + IniCacheInsertKey(IniSection, + NULL, + INSERT_LAST, + L"BootPartition", + L"1"); - /* BootSector=BOOTSECT.DOS */ - IniCacheInsertKey(IniSection, - NULL, - INSERT_LAST, - L"BootSectorFile", - L"BOOTSECT.DOS"); + /* BootSector=BOOTSECT.DOS */ + IniCacheInsertKey(IniSection, + NULL, + INSERT_LAST, + L"BootSectorFile", + L"BOOTSECT.DOS"); - IniCacheSave(IniCache, IniPath); - IniCacheDestroy(IniCache); + IniCacheSave(IniCache, IniPath); + IniCacheDestroy(IniCache); - return(STATUS_SUCCESS); + return STATUS_SUCCESS; } @@ -434,753 +414,257 @@ CreateFreeLoaderEntry( /* Insert entry into "Operating Systems" section */ IniCacheInsertKey(OSSection, - NULL, - INSERT_LAST, - Section, - Description); + NULL, + INSERT_LAST, + Section, + Description); /* Create new section */ IniSection = IniCacheAppendSection(IniCache, Section); /* BootType= */ IniCacheInsertKey(IniSection, - NULL, - INSERT_LAST, - L"BootType", - BootType); + NULL, + INSERT_LAST, + L"BootType", + BootType); /* SystemPath= */ IniCacheInsertKey(IniSection, - NULL, - INSERT_LAST, - L"SystemPath", - ArcPath); + NULL, + INSERT_LAST, + L"SystemPath", + ArcPath); /* Options=*/ IniCacheInsertKey(IniSection, - NULL, - INSERT_LAST, - L"Options", - Options); + NULL, + INSERT_LAST, + L"Options", + Options); return STATUS_SUCCESS; } NTSTATUS -CreateFreeLoaderIniForReactos(PWCHAR IniPath, - PWCHAR ArcPath) +CreateFreeLoaderIniForReactos( + PWCHAR IniPath, + PWCHAR ArcPath) { - PINICACHE IniCache; - PINICACHESECTION IniSection; + PINICACHE IniCache; + PINICACHESECTION IniSection; - IniCache = IniCacheCreate(); + IniCache = IniCacheCreate(); - CreateCommonFreeLoaderSections(IniCache); + CreateCommonFreeLoaderSections(IniCache); - /* Create "Operating Systems" section */ - IniSection = IniCacheAppendSection(IniCache, - L"Operating Systems"); + /* Create "Operating Systems" section */ + IniSection = IniCacheAppendSection(IniCache, L"Operating Systems"); /* ReactOS */ CreateFreeLoaderEntry(IniCache, IniSection, - L"ReactOS", L"\"ReactOS\"", - L"Windows2003", ArcPath, - L""); + L"ReactOS", L"\"ReactOS\"", + L"Windows2003", ArcPath, + L""); /* ReactOS_Debug */ CreateFreeLoaderEntry(IniCache, IniSection, - L"ReactOS_Debug", L"\"ReactOS (Debug)\"", - L"Windows2003", ArcPath, - L"/DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200 /SOS"); + L"ReactOS_Debug", L"\"ReactOS (Debug)\"", + L"Windows2003", ArcPath, + L"/DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200 /SOS"); #if DBG +#ifndef _WINKD_ /* ReactOS_KdSerial */ CreateFreeLoaderEntry(IniCache, IniSection, - L"ReactOS_KdSerial", L"\"ReactOS (RosDbg)\"", - L"Windows2003", ArcPath, - L"/DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200 /SOS /KDSERIAL"); + L"ReactOS_KdSerial", L"\"ReactOS (RosDbg)\"", + L"Windows2003", ArcPath, + L"/DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200 /SOS /KDSERIAL"); +#endif /* ReactOS_LogFile */ CreateFreeLoaderEntry(IniCache, IniSection, - L"ReactOS_LogFile", L"\"ReactOS (Log file)\"", - L"Windows2003", ArcPath, - L"/DEBUG /DEBUGPORT=FILE /SOS"); + L"ReactOS_LogFile", L"\"ReactOS (Log file)\"", + L"Windows2003", ArcPath, + L"/DEBUG /DEBUGPORT=FILE /SOS"); /* ReactOS_Ram */ CreateFreeLoaderEntry(IniCache, IniSection, - L"ReactOS_Ram", L"\"ReactOS (RAM Disk)\"", - L"ReactOS", L"ramdisk(0)\\ReactOS", - L"/DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200 /SOS /RDIMAGEPATH=reactos.img /RDIMAGEOFFSET=32256"); + L"ReactOS_Ram", L"\"ReactOS (RAM Disk)\"", + L"ReactOS", L"ramdisk(0)\\ReactOS", + L"/DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200 /SOS /RDIMAGEPATH=reactos.img /RDIMAGEOFFSET=32256"); #endif - /* ReactOS_old */ - CreateFreeLoaderEntry(IniCache, IniSection, - L"ReactOS_old", L"\"ReactOS (old boot method)\"", - L"ReactOS", ArcPath, - L""); + /* Save the ini file */ + IniCacheSave(IniCache, IniPath); + IniCacheDestroy(IniCache); - /* ReactOS_Debug_old */ - CreateFreeLoaderEntry(IniCache, IniSection, - L"ReactOS_Debug_old", L"\"ReactOS (Debug, old boot method)\"", - L"ReactOS", ArcPath, - L"/DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200 /SOS"); - - /* Save the ini file */ - IniCacheSave(IniCache, IniPath); - IniCacheDestroy(IniCache); - - return(STATUS_SUCCESS); + return STATUS_SUCCESS; } NTSTATUS -UpdateFreeLoaderIni(PWCHAR IniPath, - PWCHAR ArcPath) +UpdateFreeLoaderIni( + PWCHAR IniPath, + PWCHAR ArcPath) { - UNICODE_STRING Name; - PINICACHE IniCache; - PINICACHESECTION IniSection; - PINICACHESECTION OsIniSection; - WCHAR SectionName[80]; - WCHAR OsName[80]; - WCHAR SystemPath[200]; - WCHAR SectionName2[200]; - PWCHAR KeyData; - ULONG i,j; - NTSTATUS Status; + UNICODE_STRING Name; + PINICACHE IniCache; + PINICACHESECTION IniSection; + PINICACHESECTION OsIniSection; + WCHAR SectionName[80]; + WCHAR OsName[80]; + WCHAR SystemPath[200]; + WCHAR SectionName2[200]; + PWCHAR KeyData; + ULONG i,j; + NTSTATUS Status; - RtlInitUnicodeString(&Name, - IniPath); + RtlInitUnicodeString(&Name, IniPath); - Status = IniCacheLoad(&IniCache, - &Name, - FALSE); - if (!NT_SUCCESS(Status)) - return(Status); - - /* Get "Operating Systems" section */ - IniSection = IniCacheGetSection(IniCache, - L"Operating Systems"); - if (IniSection == NULL) - { - IniCacheDestroy(IniCache); - return(STATUS_UNSUCCESSFUL); - } - - /* Find an existing usable or an unused section name */ - i = 1; - wcscpy(SectionName, L"ReactOS"); - wcscpy(OsName, L"\"ReactOS\""); - while(TRUE) - { - Status = IniCacheGetKey(IniSection, - SectionName, - &KeyData); + Status = IniCacheLoad(&IniCache, &Name, FALSE); if (!NT_SUCCESS(Status)) - break; + return Status; - /* Get operation system section */ - if (KeyData[0] == '"') + /* Get "Operating Systems" section */ + IniSection = IniCacheGetSection(IniCache, L"Operating Systems"); + if (IniSection == NULL) { - wcscpy(SectionName2, &KeyData[1]); - j = wcslen(SectionName2); - if (j > 0) - { - SectionName2[j-1] = 0; - } - } - else - { - wcscpy(SectionName2, KeyData); + IniCacheDestroy(IniCache); + return STATUS_UNSUCCESSFUL; } - OsIniSection = IniCacheGetSection(IniCache, - SectionName2); - if (OsIniSection != NULL) + /* Find an existing usable or an unused section name */ + i = 1; + wcscpy(SectionName, L"ReactOS"); + wcscpy(OsName, L"\"ReactOS\""); + while(TRUE) { - BOOLEAN UseExistingEntry = TRUE; + Status = IniCacheGetKey(IniSection, SectionName, &KeyData); + if (!NT_SUCCESS(Status)) + break; - /* Check BootType */ - Status = IniCacheGetKey(OsIniSection, - L"BootType", - &KeyData); - if (NT_SUCCESS(Status)) - { - if (KeyData == NULL - || (_wcsicmp(KeyData, L"ReactOS") != 0 - && _wcsicmp(KeyData, L"\"ReactOS\"") != 0)) + /* Get operation system section */ + if (KeyData[0] == '"') { - /* This is not a ReactOS entry */ - UseExistingEntry = FALSE; - } - } - else - { - UseExistingEntry = FALSE; - } - - if (UseExistingEntry) - { - /* BootType is ReactOS. Now check SystemPath */ - Status = IniCacheGetKey(OsIniSection, - L"SystemPath", - &KeyData); - if (NT_SUCCESS(Status)) - { - swprintf(SystemPath, L"\"%S\"", ArcPath); - if (KeyData == NULL - || (_wcsicmp(KeyData, ArcPath) != 0 - && _wcsicmp(KeyData, SystemPath) != 0)) - { - /* This entry is a ReactOS entry, but the SystemRoot does not - match the one we are looking for */ - UseExistingEntry = FALSE; - } + wcscpy(SectionName2, &KeyData[1]); + j = wcslen(SectionName2); + if (j > 0) + { + SectionName2[j-1] = 0; + } } else { - UseExistingEntry = FALSE; + wcscpy(SectionName2, KeyData); } - } - if (UseExistingEntry) - { - IniCacheDestroy(IniCache); - return(STATUS_SUCCESS); - } + OsIniSection = IniCacheGetSection(IniCache, SectionName2); + if (OsIniSection != NULL) + { + BOOLEAN UseExistingEntry = TRUE; + + /* Check BootType */ + Status = IniCacheGetKey(OsIniSection, L"BootType", &KeyData); + if (NT_SUCCESS(Status)) + { + if ((KeyData == NULL) || + ( (_wcsicmp(KeyData, L"ReactOS") != 0) && + (_wcsicmp(KeyData, L"\"ReactOS\"") != 0) )) + { + /* This is not a ReactOS entry */ + UseExistingEntry = FALSE; + } + } + else + { + UseExistingEntry = FALSE; + } + + if (UseExistingEntry) + { + /* BootType is ReactOS. Now check SystemPath */ + Status = IniCacheGetKey(OsIniSection, L"SystemPath", &KeyData); + if (NT_SUCCESS(Status)) + { + swprintf(SystemPath, L"\"%S\"", ArcPath); + if ((KeyData == NULL) || + ((_wcsicmp(KeyData, ArcPath) != 0) && + (_wcsicmp(KeyData, SystemPath) != 0) )) + { + /* This entry is a ReactOS entry, but the SystemRoot does not + match the one we are looking for */ + UseExistingEntry = FALSE; + } + } + else + { + UseExistingEntry = FALSE; + } + } + + if (UseExistingEntry) + { + IniCacheDestroy(IniCache); + return STATUS_SUCCESS; + } + } + + swprintf(SectionName, L"ReactOS_%lu", i); + swprintf(OsName, L"\"ReactOS %lu\"", i); + i++; } - swprintf(SectionName, L"ReactOS_%lu", i); - swprintf(OsName, L"\"ReactOS %lu\"", i); - i++; - } + /* = */ + IniCacheInsertKey(IniSection, + NULL, + INSERT_LAST, + SectionName, + OsName); - /* = */ - IniCacheInsertKey(IniSection, - NULL, - INSERT_LAST, - SectionName, - OsName); + /* Create section */ + IniSection = IniCacheAppendSection(IniCache, SectionName); - /* Create section */ - IniSection = IniCacheAppendSection(IniCache, - SectionName); + /* BootType=ReactOS */ + IniCacheInsertKey(IniSection, + NULL, + INSERT_LAST, + L"BootType", + L"ReactOS"); - /* BootType=ReactOS */ - IniCacheInsertKey(IniSection, - NULL, - INSERT_LAST, - L"BootType", - L"ReactOS"); + /* SystemPath= */ + IniCacheInsertKey(IniSection, + NULL, + INSERT_LAST, + L"SystemPath", + ArcPath); - /* SystemPath= */ - IniCacheInsertKey(IniSection, - NULL, - INSERT_LAST, - L"SystemPath", - ArcPath); + IniCacheSave(IniCache, IniPath); + IniCacheDestroy(IniCache); - IniCacheSave(IniCache, IniPath); - IniCacheDestroy(IniCache); - - return(STATUS_SUCCESS); + return STATUS_SUCCESS; } NTSTATUS -SaveCurrentBootSector(PWSTR RootPath, - PWSTR DstPath) -{ - OBJECT_ATTRIBUTES ObjectAttributes; - IO_STATUS_BLOCK IoStatusBlock; - UNICODE_STRING Name; - HANDLE FileHandle; - NTSTATUS Status; - PUCHAR BootSector; - - /* Allocate buffer for bootsector */ - BootSector = (PUCHAR)RtlAllocateHeap(ProcessHeap, - 0, - SECTORSIZE); - if (BootSector == NULL) - return(STATUS_INSUFFICIENT_RESOURCES); - - /* Read current boot sector into buffer */ - RtlInitUnicodeString(&Name, - RootPath); - - InitializeObjectAttributes(&ObjectAttributes, - &Name, - OBJ_CASE_INSENSITIVE, - NULL, - NULL); - - Status = NtOpenFile(&FileHandle, - GENERIC_READ, - &ObjectAttributes, - &IoStatusBlock, - 0, - FILE_SYNCHRONOUS_IO_NONALERT); - if (!NT_SUCCESS(Status)) - { - RtlFreeHeap(ProcessHeap, 0, BootSector); - return(Status); - } - - Status = NtReadFile(FileHandle, - NULL, - NULL, - NULL, - &IoStatusBlock, - BootSector, - SECTORSIZE, - NULL, - NULL); - NtClose(FileHandle); - if (!NT_SUCCESS(Status)) - { - RtlFreeHeap(ProcessHeap, 0, BootSector); - return(Status); - } - - /* Write bootsector to DstPath */ - RtlInitUnicodeString(&Name, - DstPath); - - InitializeObjectAttributes(&ObjectAttributes, - &Name, - 0, - NULL, - NULL); - - Status = NtCreateFile(&FileHandle, - GENERIC_WRITE, - &ObjectAttributes, - &IoStatusBlock, - NULL, - FILE_ATTRIBUTE_NORMAL, - 0, - FILE_SUPERSEDE, - FILE_SYNCHRONOUS_IO_NONALERT | FILE_SEQUENTIAL_ONLY, - NULL, - 0); - if (!NT_SUCCESS(Status)) - { - RtlFreeHeap(ProcessHeap, 0, BootSector); - return(Status); - } - - Status = NtWriteFile(FileHandle, - NULL, - NULL, - NULL, - &IoStatusBlock, - BootSector, - SECTORSIZE, - NULL, - NULL); - NtClose(FileHandle); - - /* Free the new boot sector */ - RtlFreeHeap(ProcessHeap, 0, BootSector); - - return(Status); -} - - -NTSTATUS -InstallFat16BootCodeToFile(PWSTR SrcPath, - PWSTR DstPath, - PWSTR RootPath) -{ - OBJECT_ATTRIBUTES ObjectAttributes; - IO_STATUS_BLOCK IoStatusBlock; - UNICODE_STRING Name; - HANDLE FileHandle; - NTSTATUS Status; - PUCHAR OrigBootSector; - PUCHAR NewBootSector; - - /* Allocate buffer for original bootsector */ - OrigBootSector = (PUCHAR)RtlAllocateHeap(ProcessHeap, - 0, - SECTORSIZE); - if (OrigBootSector == NULL) - return(STATUS_INSUFFICIENT_RESOURCES); - - /* Read current boot sector into buffer */ - RtlInitUnicodeString(&Name, - RootPath); - - InitializeObjectAttributes(&ObjectAttributes, - &Name, - OBJ_CASE_INSENSITIVE, - NULL, - NULL); - - Status = NtOpenFile(&FileHandle, - GENERIC_READ, - &ObjectAttributes, - &IoStatusBlock, - 0, - FILE_SYNCHRONOUS_IO_NONALERT); - if (!NT_SUCCESS(Status)) - { - RtlFreeHeap(ProcessHeap, 0, OrigBootSector); - return(Status); - } - - Status = NtReadFile(FileHandle, - NULL, - NULL, - NULL, - &IoStatusBlock, - OrigBootSector, - SECTORSIZE, - NULL, - NULL); - NtClose(FileHandle); - if (!NT_SUCCESS(Status)) - { - RtlFreeHeap(ProcessHeap, 0, OrigBootSector); - return(Status); - } - - - /* Allocate buffer for new bootsector */ - NewBootSector = (PUCHAR)RtlAllocateHeap(ProcessHeap, - 0, - SECTORSIZE); - if (NewBootSector == NULL) - { - RtlFreeHeap(ProcessHeap, 0, OrigBootSector); - return(STATUS_INSUFFICIENT_RESOURCES); - } - - /* Read new bootsector from SrcPath */ - RtlInitUnicodeString(&Name, - SrcPath); - - InitializeObjectAttributes(&ObjectAttributes, - &Name, - OBJ_CASE_INSENSITIVE, - NULL, - NULL); - - Status = NtOpenFile(&FileHandle, - GENERIC_READ, - &ObjectAttributes, - &IoStatusBlock, - 0, - FILE_SYNCHRONOUS_IO_NONALERT); - if (!NT_SUCCESS(Status)) - { - RtlFreeHeap(ProcessHeap, 0, OrigBootSector); - RtlFreeHeap(ProcessHeap, 0, NewBootSector); - return(Status); - } - - Status = NtReadFile(FileHandle, - NULL, - NULL, - NULL, - &IoStatusBlock, - NewBootSector, - SECTORSIZE, - NULL, - NULL); - NtClose(FileHandle); - if (!NT_SUCCESS(Status)) - { - RtlFreeHeap(ProcessHeap, 0, OrigBootSector); - RtlFreeHeap(ProcessHeap, 0, NewBootSector); - return(Status); - } - - /* Adjust bootsector (copy a part of the FAT BPB) */ - memcpy((NewBootSector + 11), (OrigBootSector + 11), 51 /*fat BPB length*/); - - /* Free the original boot sector */ - RtlFreeHeap(ProcessHeap, 0, OrigBootSector); - - /* Write new bootsector to DstPath */ - RtlInitUnicodeString(&Name, - DstPath); - - InitializeObjectAttributes(&ObjectAttributes, - &Name, - 0, - NULL, - NULL); - - Status = NtCreateFile(&FileHandle, - GENERIC_WRITE, - &ObjectAttributes, - &IoStatusBlock, - NULL, - FILE_ATTRIBUTE_NORMAL, - 0, - FILE_OVERWRITE_IF, - FILE_SYNCHRONOUS_IO_NONALERT | FILE_SEQUENTIAL_ONLY, - NULL, - 0); - if (!NT_SUCCESS(Status)) - { - RtlFreeHeap(ProcessHeap, 0, NewBootSector); - return(Status); - } - -#if 0 - FilePosition.QuadPart = 0; -#endif - Status = NtWriteFile(FileHandle, - NULL, - NULL, - NULL, - &IoStatusBlock, - NewBootSector, - SECTORSIZE, - NULL, - NULL); - NtClose(FileHandle); - - /* Free the new boot sector */ - RtlFreeHeap(ProcessHeap, 0, NewBootSector); - - return(Status); -} - - -NTSTATUS -InstallFat32BootCodeToFile(PWSTR SrcPath, - PWSTR DstPath, - PWSTR RootPath) -{ - OBJECT_ATTRIBUTES ObjectAttributes; - IO_STATUS_BLOCK IoStatusBlock; - UNICODE_STRING Name; - HANDLE FileHandle; - NTSTATUS Status; - PUCHAR OrigBootSector; - PUCHAR NewBootSector; - LARGE_INTEGER FileOffset; - - /* Allocate buffer for original bootsector */ - OrigBootSector = (PUCHAR)RtlAllocateHeap(ProcessHeap, - 0, - SECTORSIZE); - if (OrigBootSector == NULL) - return(STATUS_INSUFFICIENT_RESOURCES); - - /* Read current boot sector into buffer */ - RtlInitUnicodeString(&Name, - RootPath); - - InitializeObjectAttributes(&ObjectAttributes, - &Name, - OBJ_CASE_INSENSITIVE, - NULL, - NULL); - - Status = NtOpenFile(&FileHandle, - GENERIC_READ, - &ObjectAttributes, - &IoStatusBlock, - 0, - FILE_SYNCHRONOUS_IO_NONALERT); - if (!NT_SUCCESS(Status)) - { - RtlFreeHeap(ProcessHeap, 0, OrigBootSector); - return(Status); - } - - Status = NtReadFile(FileHandle, - NULL, - NULL, - NULL, - &IoStatusBlock, - OrigBootSector, - SECTORSIZE, - NULL, - NULL); - NtClose(FileHandle); - if (!NT_SUCCESS(Status)) - { - RtlFreeHeap(ProcessHeap, 0, OrigBootSector); - return(Status); - } - - /* Allocate buffer for new bootsector (2 sectors) */ - NewBootSector = (PUCHAR)RtlAllocateHeap(ProcessHeap, - 0, - 2 * SECTORSIZE); - if (NewBootSector == NULL) - { - RtlFreeHeap(ProcessHeap, 0, OrigBootSector); - return(STATUS_INSUFFICIENT_RESOURCES); - } - - /* Read new bootsector from SrcPath */ - RtlInitUnicodeString(&Name, - SrcPath); - - InitializeObjectAttributes(&ObjectAttributes, - &Name, - OBJ_CASE_INSENSITIVE, - NULL, - NULL); - - Status = NtOpenFile(&FileHandle, - GENERIC_READ, - &ObjectAttributes, - &IoStatusBlock, - 0, - FILE_SYNCHRONOUS_IO_NONALERT); - if (!NT_SUCCESS(Status)) - { - RtlFreeHeap(ProcessHeap, 0, OrigBootSector); - RtlFreeHeap(ProcessHeap, 0, NewBootSector); - return(Status); - } - - Status = NtReadFile(FileHandle, - NULL, - NULL, - NULL, - &IoStatusBlock, - NewBootSector, - 2 * SECTORSIZE, - NULL, - NULL); - NtClose(FileHandle); - if (!NT_SUCCESS(Status)) - { - RtlFreeHeap(ProcessHeap, 0, OrigBootSector); - RtlFreeHeap(ProcessHeap, 0, NewBootSector); - return(Status); - } - - /* Adjust bootsector (copy a part of the FAT32 BPB) */ - memcpy((NewBootSector + 3), - (OrigBootSector + 3), - 87); /* FAT32 BPB length */ - - /* Disable the backup boot sector */ - NewBootSector[0x32] = 0x00; - NewBootSector[0x33] = 0x00; - - /* Free the original boot sector */ - RtlFreeHeap(ProcessHeap, 0, OrigBootSector); - - /* Write the first sector of the new bootcode to DstPath */ - RtlInitUnicodeString(&Name, - DstPath); - - InitializeObjectAttributes(&ObjectAttributes, - &Name, - 0, - NULL, - NULL); - - Status = NtCreateFile(&FileHandle, - GENERIC_WRITE, - &ObjectAttributes, - &IoStatusBlock, - NULL, - FILE_ATTRIBUTE_NORMAL, - 0, - FILE_SUPERSEDE, - FILE_SYNCHRONOUS_IO_NONALERT | FILE_SEQUENTIAL_ONLY, - NULL, - 0); - if (!NT_SUCCESS(Status)) - { - RtlFreeHeap(ProcessHeap, 0, NewBootSector); - return(Status); - } - - Status = NtWriteFile(FileHandle, - NULL, - NULL, - NULL, - &IoStatusBlock, - NewBootSector, - SECTORSIZE, - NULL, - NULL); - NtClose(FileHandle); - if (!NT_SUCCESS(Status)) - { - RtlFreeHeap(ProcessHeap, 0, NewBootSector); - return(Status); - } - - /* Write the second sector of the new bootcode to boot disk sector 14 */ - RtlInitUnicodeString(&Name, - RootPath); - - InitializeObjectAttributes(&ObjectAttributes, - &Name, - 0, - NULL, - NULL); - - Status = NtOpenFile(&FileHandle, - GENERIC_WRITE, - &ObjectAttributes, - &IoStatusBlock, - 0, - FILE_SYNCHRONOUS_IO_NONALERT); - if (!NT_SUCCESS(Status)) - { - RtlFreeHeap(ProcessHeap, 0, NewBootSector); - return(Status); - } - - FileOffset.QuadPart = (ULONGLONG)(14 * SECTORSIZE); - Status = NtWriteFile(FileHandle, - NULL, - NULL, - NULL, - &IoStatusBlock, - (NewBootSector + SECTORSIZE), - SECTORSIZE, - &FileOffset, - NULL); - if (!NT_SUCCESS(Status)) - { - } - NtClose(FileHandle); - - /* Free the new boot sector */ - RtlFreeHeap(ProcessHeap, 0, NewBootSector); - - return(Status); -} - - -NTSTATUS -InstallMbrBootCodeToDisk (PWSTR SrcPath, - PWSTR RootPath) +SaveCurrentBootSector( + PWSTR RootPath, + PWSTR DstPath) { OBJECT_ATTRIBUTES ObjectAttributes; IO_STATUS_BLOCK IoStatusBlock; UNICODE_STRING Name; HANDLE FileHandle; NTSTATUS Status; - PPARTITION_SECTOR OrigBootSector; - PPARTITION_SECTOR NewBootSector; + PUCHAR BootSector; - /* Allocate buffer for original bootsector */ - OrigBootSector = (PPARTITION_SECTOR)RtlAllocateHeap(ProcessHeap, - 0, - sizeof(PARTITION_SECTOR)); - if (OrigBootSector == NULL) - return(STATUS_INSUFFICIENT_RESOURCES); + /* Allocate buffer for bootsector */ + BootSector = RtlAllocateHeap(ProcessHeap, 0, SECTORSIZE); + if (BootSector == NULL) + return STATUS_INSUFFICIENT_RESOURCES; /* Read current boot sector into buffer */ - RtlInitUnicodeString(&Name, - RootPath); + RtlInitUnicodeString(&Name, RootPath); InitializeObjectAttributes(&ObjectAttributes, &Name, @@ -1194,1050 +678,1502 @@ InstallMbrBootCodeToDisk (PWSTR SrcPath, &IoStatusBlock, 0, FILE_SYNCHRONOUS_IO_NONALERT); - if (!NT_SUCCESS(Status)) - { - RtlFreeHeap(ProcessHeap, 0, OrigBootSector); - return(Status); - } + if (!NT_SUCCESS(Status)) + { + RtlFreeHeap(ProcessHeap, 0, BootSector); + return Status; + } Status = NtReadFile(FileHandle, NULL, NULL, NULL, &IoStatusBlock, - OrigBootSector, + BootSector, SECTORSIZE, NULL, NULL); NtClose(FileHandle); - if (!NT_SUCCESS(Status)) - { - RtlFreeHeap(ProcessHeap, 0, OrigBootSector); - return(Status); - } - - - /* Allocate buffer for new bootsector */ - NewBootSector = (PPARTITION_SECTOR)RtlAllocateHeap(ProcessHeap, - 0, - sizeof(PARTITION_SECTOR)); - if (NewBootSector == NULL) - { - RtlFreeHeap(ProcessHeap, 0, OrigBootSector); - return(STATUS_INSUFFICIENT_RESOURCES); - } - - /* Read new bootsector from SrcPath */ - RtlInitUnicodeString(&Name, - SrcPath); - - InitializeObjectAttributes(&ObjectAttributes, - &Name, - OBJ_CASE_INSENSITIVE, - NULL, - NULL); - - Status = NtOpenFile(&FileHandle, - GENERIC_READ, - &ObjectAttributes, - &IoStatusBlock, - 0, - FILE_SYNCHRONOUS_IO_NONALERT); - if (!NT_SUCCESS(Status)) - { - RtlFreeHeap(ProcessHeap, 0, OrigBootSector); - RtlFreeHeap(ProcessHeap, 0, NewBootSector); - return(Status); - } - - Status = NtReadFile(FileHandle, - NULL, - NULL, - NULL, - &IoStatusBlock, - NewBootSector, - sizeof(PARTITION_SECTOR), - NULL, - NULL); - NtClose(FileHandle); - if (!NT_SUCCESS(Status)) - { - RtlFreeHeap(ProcessHeap, 0, OrigBootSector); - RtlFreeHeap(ProcessHeap, 0, NewBootSector); - return(Status); - } - - /* Copy partition table from old MBR to new */ - RtlCopyMemory (&NewBootSector->Signature, - &OrigBootSector->Signature, - sizeof(PARTITION_SECTOR) - offsetof(PARTITION_SECTOR, Signature) /* Length of partition table */); - - /* Free the original boot sector */ - RtlFreeHeap(ProcessHeap, 0, OrigBootSector); - - /* Write new bootsector to RootPath */ - RtlInitUnicodeString(&Name, - RootPath); - - InitializeObjectAttributes(&ObjectAttributes, - &Name, - 0, - NULL, - NULL); - - Status = NtOpenFile(&FileHandle, - GENERIC_WRITE, - &ObjectAttributes, - &IoStatusBlock, - 0, - FILE_SYNCHRONOUS_IO_NONALERT | FILE_SEQUENTIAL_ONLY); - if (!NT_SUCCESS(Status)) - { - DPRINT1("NtOpenFile() failed (Status %lx)\n", Status); - RtlFreeHeap(ProcessHeap, 0, NewBootSector); - return(Status); - } - - Status = NtWriteFile(FileHandle, - NULL, - NULL, - NULL, - &IoStatusBlock, - NewBootSector, - SECTORSIZE, - NULL, - NULL); - NtClose(FileHandle); - - /* Free the new boot sector */ - RtlFreeHeap(ProcessHeap, 0, NewBootSector); - - return(Status); -} - - -NTSTATUS -InstallFat16BootCodeToDisk(PWSTR SrcPath, - PWSTR RootPath) -{ - OBJECT_ATTRIBUTES ObjectAttributes; - IO_STATUS_BLOCK IoStatusBlock; - UNICODE_STRING Name; - HANDLE FileHandle; - NTSTATUS Status; - PFAT_BOOTSECTOR OrigBootSector; - PFAT_BOOTSECTOR NewBootSector; - PARTITION_INFORMATION *PartInfo; - - /* Allocate buffer for original bootsector */ - OrigBootSector = RtlAllocateHeap(ProcessHeap, - 0, - SECTORSIZE); - if (OrigBootSector == NULL) - return(STATUS_INSUFFICIENT_RESOURCES); - - /* Read current boot sector into buffer */ - RtlInitUnicodeString(&Name, - RootPath); - - InitializeObjectAttributes(&ObjectAttributes, - &Name, - OBJ_CASE_INSENSITIVE, - NULL, - NULL); - - Status = NtOpenFile(&FileHandle, - GENERIC_READ, - &ObjectAttributes, - &IoStatusBlock, - 0, - FILE_SYNCHRONOUS_IO_NONALERT); - if (!NT_SUCCESS(Status)) - { - RtlFreeHeap(ProcessHeap, 0, OrigBootSector); - return(Status); - } - - Status = NtReadFile(FileHandle, - NULL, - NULL, - NULL, - &IoStatusBlock, - OrigBootSector, - SECTORSIZE, - NULL, - NULL); - NtClose(FileHandle); - if (!NT_SUCCESS(Status)) - { - RtlFreeHeap(ProcessHeap, 0, OrigBootSector); - return(Status); - } - - - /* Allocate buffer for new bootsector */ - NewBootSector = RtlAllocateHeap(ProcessHeap, - 0, - SECTORSIZE); - if (NewBootSector == NULL) - { - RtlFreeHeap(ProcessHeap, 0, OrigBootSector); - return(STATUS_INSUFFICIENT_RESOURCES); - } - - /* Read new bootsector from SrcPath */ - RtlInitUnicodeString(&Name, - SrcPath); - - InitializeObjectAttributes(&ObjectAttributes, - &Name, - OBJ_CASE_INSENSITIVE, - NULL, - NULL); - - Status = NtOpenFile(&FileHandle, - GENERIC_READ, - &ObjectAttributes, - &IoStatusBlock, - 0, - FILE_SYNCHRONOUS_IO_NONALERT); - if (!NT_SUCCESS(Status)) - { - RtlFreeHeap(ProcessHeap, 0, OrigBootSector); - RtlFreeHeap(ProcessHeap, 0, NewBootSector); - return(Status); - } - - Status = NtReadFile(FileHandle, - NULL, - NULL, - NULL, - &IoStatusBlock, - NewBootSector, - SECTORSIZE, - NULL, - NULL); - NtClose(FileHandle); - if (!NT_SUCCESS(Status)) - { - RtlFreeHeap(ProcessHeap, 0, OrigBootSector); - RtlFreeHeap(ProcessHeap, 0, NewBootSector); - return(Status); - } - - /* Adjust bootsector (copy a part of the FAT16 BPB) */ - memcpy(&NewBootSector->BytesPerSector, - &OrigBootSector->BytesPerSector, - 51); /* FAT16 BPB length */ - - PartInfo = &PartitionList->CurrentPartition->PartInfo[PartitionList->CurrentPartitionNumber]; - NewBootSector->HiddenSectors = PartInfo->HiddenSectors; - - /* Free the original boot sector */ - RtlFreeHeap(ProcessHeap, 0, OrigBootSector); - - /* Write new bootsector to RootPath */ - RtlInitUnicodeString(&Name, - RootPath); - - InitializeObjectAttributes(&ObjectAttributes, - &Name, - 0, - NULL, - NULL); - - Status = NtOpenFile(&FileHandle, - GENERIC_WRITE, - &ObjectAttributes, - &IoStatusBlock, - 0, - FILE_SYNCHRONOUS_IO_NONALERT | FILE_SEQUENTIAL_ONLY); - if (!NT_SUCCESS(Status)) - { - DPRINT1("NtOpenFile() failed (Status %lx)\n", Status); - RtlFreeHeap(ProcessHeap, 0, NewBootSector); - return(Status); - } - -#if 0 - FilePosition.QuadPart = 0; -#endif - Status = NtWriteFile(FileHandle, - NULL, - NULL, - NULL, - &IoStatusBlock, - NewBootSector, - SECTORSIZE, - NULL, - NULL); - NtClose(FileHandle); - - /* Free the new boot sector */ - RtlFreeHeap(ProcessHeap, 0, NewBootSector); - - return(Status); -} - - -NTSTATUS -InstallFat32BootCodeToDisk(PWSTR SrcPath, - PWSTR RootPath) -{ - OBJECT_ATTRIBUTES ObjectAttributes; - IO_STATUS_BLOCK IoStatusBlock; - UNICODE_STRING Name; - HANDLE FileHandle; - NTSTATUS Status; - PFAT32_BOOTSECTOR OrigBootSector; - PFAT32_BOOTSECTOR NewBootSector; - LARGE_INTEGER FileOffset; - USHORT BackupBootSector; - PARTITION_INFORMATION *PartInfo; - - /* Allocate buffer for original bootsector */ - OrigBootSector = RtlAllocateHeap(ProcessHeap, - 0, - SECTORSIZE); - if (OrigBootSector == NULL) - return(STATUS_INSUFFICIENT_RESOURCES); - - /* Read current boot sector into buffer */ - RtlInitUnicodeString(&Name, - RootPath); - - InitializeObjectAttributes(&ObjectAttributes, - &Name, - OBJ_CASE_INSENSITIVE, - NULL, - NULL); - - Status = NtOpenFile(&FileHandle, - GENERIC_READ, - &ObjectAttributes, - &IoStatusBlock, - 0, - FILE_SYNCHRONOUS_IO_NONALERT); - if (!NT_SUCCESS(Status)) - { - RtlFreeHeap(ProcessHeap, 0, OrigBootSector); - return(Status); - } - - Status = NtReadFile(FileHandle, - NULL, - NULL, - NULL, - &IoStatusBlock, - OrigBootSector, - SECTORSIZE, - NULL, - NULL); - NtClose(FileHandle); - if (!NT_SUCCESS(Status)) - { - RtlFreeHeap(ProcessHeap, 0, OrigBootSector); - return(Status); - } - - - /* Allocate buffer for new bootsector (2 sectors) */ - NewBootSector = RtlAllocateHeap(ProcessHeap, - 0, - 2 * SECTORSIZE); - if (NewBootSector == NULL) - { - RtlFreeHeap(ProcessHeap, 0, OrigBootSector); - return(STATUS_INSUFFICIENT_RESOURCES); - } - - /* Read new bootsector from SrcPath */ - RtlInitUnicodeString(&Name, - SrcPath); - - InitializeObjectAttributes(&ObjectAttributes, - &Name, - OBJ_CASE_INSENSITIVE, - NULL, - NULL); - - Status = NtOpenFile(&FileHandle, - GENERIC_READ, - &ObjectAttributes, - &IoStatusBlock, - 0, - FILE_SYNCHRONOUS_IO_NONALERT); - if (!NT_SUCCESS(Status)) - { - RtlFreeHeap(ProcessHeap, 0, OrigBootSector); - RtlFreeHeap(ProcessHeap, 0, NewBootSector); - return(Status); - } - - Status = NtReadFile(FileHandle, - NULL, - NULL, - NULL, - &IoStatusBlock, - NewBootSector, - 2 * SECTORSIZE, - NULL, - NULL); - NtClose(FileHandle); - if (!NT_SUCCESS(Status)) - { - RtlFreeHeap(ProcessHeap, 0, OrigBootSector); - RtlFreeHeap(ProcessHeap, 0, NewBootSector); - return(Status); - } - - /* Adjust bootsector (copy a part of the FAT32 BPB) */ - memcpy(&NewBootSector->BytesPerSector, - &OrigBootSector->BytesPerSector, - 79); /* FAT32 BPB length */ - - PartInfo = &PartitionList->CurrentPartition->PartInfo[PartitionList->CurrentPartitionNumber]; - NewBootSector->HiddenSectors = PartInfo->HiddenSectors; - - /* Get the location of the backup boot sector */ - BackupBootSector = OrigBootSector->BackupBootSector; - - /* Free the original boot sector */ - RtlFreeHeap(ProcessHeap, 0, OrigBootSector); - - /* Write the first sector of the new bootcode to DstPath */ - RtlInitUnicodeString(&Name, - RootPath); - - InitializeObjectAttributes(&ObjectAttributes, - &Name, - 0, - NULL, - NULL); - - Status = NtOpenFile(&FileHandle, - GENERIC_WRITE, - &ObjectAttributes, - &IoStatusBlock, - 0, - FILE_SYNCHRONOUS_IO_NONALERT | FILE_SEQUENTIAL_ONLY); - if (!NT_SUCCESS(Status)) - { - DPRINT1("NtOpenFile() failed (Status %lx)\n", Status); - RtlFreeHeap(ProcessHeap, 0, NewBootSector); - return(Status); - } - - /* Write sector 0 */ - FileOffset.QuadPart = 0ULL; - Status = NtWriteFile(FileHandle, - NULL, - NULL, - NULL, - &IoStatusBlock, - NewBootSector, - SECTORSIZE, - &FileOffset, - NULL); - if (!NT_SUCCESS(Status)) - { - DPRINT1("NtWriteFile() failed (Status %lx)\n", Status); - NtClose(FileHandle); - RtlFreeHeap(ProcessHeap, 0, NewBootSector); - return(Status); - } - - /* Write backup boot sector */ - if ((BackupBootSector != 0x0000) && (BackupBootSector != 0xFFFF)) - { - FileOffset.QuadPart = (ULONGLONG)((ULONG)BackupBootSector * SECTORSIZE); - Status = NtWriteFile(FileHandle, - NULL, - NULL, - NULL, - &IoStatusBlock, - NewBootSector, - SECTORSIZE, - &FileOffset, - NULL); if (!NT_SUCCESS(Status)) { - DPRINT1("NtWriteFile() failed (Status %lx)\n", Status); - NtClose(FileHandle); - RtlFreeHeap(ProcessHeap, 0, NewBootSector); - return(Status); + RtlFreeHeap(ProcessHeap, 0, BootSector); + return Status; } - } - /* Write sector 14 */ - FileOffset.QuadPart = (ULONGLONG)(14 * SECTORSIZE); - Status = NtWriteFile(FileHandle, - NULL, - NULL, - NULL, - &IoStatusBlock, - ((PUCHAR)NewBootSector + SECTORSIZE), - SECTORSIZE, - &FileOffset, - NULL); - if (!NT_SUCCESS(Status)) - { - DPRINT1("NtWriteFile() failed (Status %lx)\n", Status); - } - NtClose(FileHandle); + /* Write bootsector to DstPath */ + RtlInitUnicodeString(&Name, DstPath); - /* Free the new boot sector */ - RtlFreeHeap(ProcessHeap, 0, NewBootSector); + InitializeObjectAttributes(&ObjectAttributes, + &Name, + 0, + NULL, + NULL); - return(Status); -} + Status = NtCreateFile(&FileHandle, + GENERIC_WRITE, + &ObjectAttributes, + &IoStatusBlock, + NULL, + FILE_ATTRIBUTE_NORMAL, + 0, + FILE_SUPERSEDE, + FILE_SYNCHRONOUS_IO_NONALERT | FILE_SEQUENTIAL_ONLY, + NULL, + 0); + if (!NT_SUCCESS(Status)) + { + RtlFreeHeap(ProcessHeap, 0, BootSector); + return Status; + } - -static NTSTATUS -UnprotectBootIni(PWSTR FileName, - PULONG Attributes) -{ - UNICODE_STRING Name; - OBJECT_ATTRIBUTES ObjectAttributes; - IO_STATUS_BLOCK IoStatusBlock; - FILE_BASIC_INFORMATION FileInfo; - HANDLE FileHandle; - NTSTATUS Status; - - RtlInitUnicodeString(&Name, - FileName); - - InitializeObjectAttributes(&ObjectAttributes, - &Name, - OBJ_CASE_INSENSITIVE, - NULL, - NULL); - - Status = NtOpenFile(&FileHandle, - GENERIC_READ|GENERIC_WRITE, - &ObjectAttributes, - &IoStatusBlock, - 0, - FILE_SYNCHRONOUS_IO_NONALERT); - if (Status == STATUS_NO_SUCH_FILE) - { - DPRINT1("NtOpenFile() failed (Status %lx)\n", Status); - *Attributes = 0; - return(STATUS_SUCCESS); - } - if (!NT_SUCCESS(Status)) - { - DPRINT1("NtOpenFile() failed (Status %lx)\n", Status); - return(Status); - } - - Status = NtQueryInformationFile(FileHandle, - &IoStatusBlock, - &FileInfo, - sizeof(FILE_BASIC_INFORMATION), - FileBasicInformation); - if (!NT_SUCCESS(Status)) - { - DPRINT1("NtQueryInformationFile() failed (Status %lx)\n", Status); + Status = NtWriteFile(FileHandle, + NULL, + NULL, + NULL, + &IoStatusBlock, + BootSector, + SECTORSIZE, + NULL, + NULL); NtClose(FileHandle); - return(Status); - } - *Attributes = FileInfo.FileAttributes; + /* Free the new boot sector */ + RtlFreeHeap(ProcessHeap, 0, BootSector); - /* Delete attributes SYSTEM, HIDDEN and READONLY */ - FileInfo.FileAttributes = FileInfo.FileAttributes & - ~(FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_READONLY); - - Status = NtSetInformationFile(FileHandle, - &IoStatusBlock, - &FileInfo, - sizeof(FILE_BASIC_INFORMATION), - FileBasicInformation); - if (!NT_SUCCESS(Status)) - { - DPRINT1("NtSetInformationFile() failed (Status %lx)\n", Status); - } - - NtClose(FileHandle); - return(Status); -} - - -static NTSTATUS -ProtectBootIni(PWSTR FileName, - ULONG Attributes) -{ - UNICODE_STRING Name; - OBJECT_ATTRIBUTES ObjectAttributes; - IO_STATUS_BLOCK IoStatusBlock; - FILE_BASIC_INFORMATION FileInfo; - HANDLE FileHandle; - NTSTATUS Status; - - RtlInitUnicodeString(&Name, - FileName); - - InitializeObjectAttributes(&ObjectAttributes, - &Name, - OBJ_CASE_INSENSITIVE, - NULL, - NULL); - - Status = NtOpenFile(&FileHandle, - GENERIC_READ|GENERIC_WRITE, - &ObjectAttributes, - &IoStatusBlock, - 0, - FILE_SYNCHRONOUS_IO_NONALERT); - if (!NT_SUCCESS(Status)) - { - DPRINT1("NtOpenFile() failed (Status %lx)\n", Status); - return(Status); - } - - Status = NtQueryInformationFile(FileHandle, - &IoStatusBlock, - &FileInfo, - sizeof(FILE_BASIC_INFORMATION), - FileBasicInformation); - if (!NT_SUCCESS(Status)) - { - DPRINT1("NtQueryInformationFile() failed (Status %lx)\n", Status); - NtClose(FileHandle); - return(Status); - } - - FileInfo.FileAttributes = FileInfo.FileAttributes | Attributes; - - Status = NtSetInformationFile(FileHandle, - &IoStatusBlock, - &FileInfo, - sizeof(FILE_BASIC_INFORMATION), - FileBasicInformation); - if (!NT_SUCCESS(Status)) - { - DPRINT1("NtSetInformationFile() failed (Status %lx)\n", Status); - } - - NtClose(FileHandle); - return(Status); + return Status; } NTSTATUS -UpdateBootIni(PWSTR BootIniPath, - PWSTR EntryName, - PWSTR EntryValue) +InstallFat16BootCodeToFile( + PWSTR SrcPath, + PWSTR DstPath, + PWSTR RootPath) { - UNICODE_STRING Name; - PINICACHE Cache = NULL; - PINICACHESECTION Section = NULL; - NTSTATUS Status; - ULONG FileAttribute; - PWCHAR OldValue = NULL; + OBJECT_ATTRIBUTES ObjectAttributes; + IO_STATUS_BLOCK IoStatusBlock; + UNICODE_STRING Name; + HANDLE FileHandle; + NTSTATUS Status; + PFAT_BOOTSECTOR OrigBootSector; + PFAT_BOOTSECTOR NewBootSector; - RtlInitUnicodeString(&Name, - BootIniPath); + /* Allocate buffer for original bootsector */ + OrigBootSector = RtlAllocateHeap(ProcessHeap, 0, SECTORSIZE); + if (OrigBootSector == NULL) + return STATUS_INSUFFICIENT_RESOURCES ; - Status = IniCacheLoad(&Cache, - &Name, - FALSE); - if (!NT_SUCCESS(Status)) - { - return(Status); - } + /* Read current boot sector into buffer */ + RtlInitUnicodeString(&Name, RootPath); + + InitializeObjectAttributes(&ObjectAttributes, + &Name, + OBJ_CASE_INSENSITIVE, + NULL, + NULL); + + Status = NtOpenFile(&FileHandle, + GENERIC_READ, + &ObjectAttributes, + &IoStatusBlock, + 0, + FILE_SYNCHRONOUS_IO_NONALERT); + if (!NT_SUCCESS(Status)) + { + RtlFreeHeap(ProcessHeap, 0, OrigBootSector); + return Status; + } + + Status = NtReadFile(FileHandle, + NULL, + NULL, + NULL, + &IoStatusBlock, + OrigBootSector, + SECTORSIZE, + NULL, + NULL); + NtClose(FileHandle); + if (!NT_SUCCESS(Status)) + { + RtlFreeHeap(ProcessHeap, 0, OrigBootSector); + return Status; + } + + /* Allocate buffer for new bootsector */ + NewBootSector = RtlAllocateHeap(ProcessHeap, 0, SECTORSIZE); + if (NewBootSector == NULL) + { + RtlFreeHeap(ProcessHeap, 0, OrigBootSector); + return STATUS_INSUFFICIENT_RESOURCES; + } + + /* Read new bootsector from SrcPath */ + RtlInitUnicodeString(&Name, SrcPath); + + InitializeObjectAttributes(&ObjectAttributes, + &Name, + OBJ_CASE_INSENSITIVE, + NULL, + NULL); + + Status = NtOpenFile(&FileHandle, + GENERIC_READ, + &ObjectAttributes, + &IoStatusBlock, + 0, + FILE_SYNCHRONOUS_IO_NONALERT); + if (!NT_SUCCESS(Status)) + { + RtlFreeHeap(ProcessHeap, 0, OrigBootSector); + RtlFreeHeap(ProcessHeap, 0, NewBootSector); + return Status; + } + + Status = NtReadFile(FileHandle, + NULL, + NULL, + NULL, + &IoStatusBlock, + NewBootSector, + SECTORSIZE, + NULL, + NULL); + NtClose(FileHandle); + if (!NT_SUCCESS(Status)) + { + RtlFreeHeap(ProcessHeap, 0, OrigBootSector); + RtlFreeHeap(ProcessHeap, 0, NewBootSector); + return Status; + } + + /* Adjust bootsector (copy a part of the FAT BPB) */ + memcpy(&NewBootSector->OemName, + &OrigBootSector->OemName, + FIELD_OFFSET(FAT_BOOTSECTOR, BootCodeAndData) - + FIELD_OFFSET(FAT_BOOTSECTOR, OemName)); + + /* Free the original boot sector */ + RtlFreeHeap(ProcessHeap, 0, OrigBootSector); + + /* Write new bootsector to DstPath */ + RtlInitUnicodeString(&Name, DstPath); + + InitializeObjectAttributes(&ObjectAttributes, + &Name, + 0, + NULL, + NULL); + + Status = NtCreateFile(&FileHandle, + GENERIC_WRITE, + &ObjectAttributes, + &IoStatusBlock, + NULL, + FILE_ATTRIBUTE_NORMAL, + 0, + FILE_OVERWRITE_IF, + FILE_SYNCHRONOUS_IO_NONALERT | FILE_SEQUENTIAL_ONLY, + NULL, + 0); + if (!NT_SUCCESS(Status)) + { + RtlFreeHeap(ProcessHeap, 0, NewBootSector); + return Status; + } + +#if 0 + FilePosition.QuadPart = 0; +#endif + Status = NtWriteFile(FileHandle, + NULL, + NULL, + NULL, + &IoStatusBlock, + NewBootSector, + SECTORSIZE, + NULL, + NULL); + NtClose(FileHandle); + + /* Free the new boot sector */ + RtlFreeHeap(ProcessHeap, 0, NewBootSector); + + return Status; +} + + +NTSTATUS +InstallFat32BootCodeToFile( + PWSTR SrcPath, + PWSTR DstPath, + PWSTR RootPath) +{ + OBJECT_ATTRIBUTES ObjectAttributes; + IO_STATUS_BLOCK IoStatusBlock; + UNICODE_STRING Name; + HANDLE FileHandle; + NTSTATUS Status; + PFAT32_BOOTSECTOR OrigBootSector; + PFAT32_BOOTSECTOR NewBootSector; + LARGE_INTEGER FileOffset; + + /* Allocate buffer for original bootsector */ + OrigBootSector = RtlAllocateHeap(ProcessHeap, 0, SECTORSIZE); + if (OrigBootSector == NULL) + return STATUS_INSUFFICIENT_RESOURCES; + + /* Read current boot sector into buffer */ + RtlInitUnicodeString(&Name, RootPath); + + InitializeObjectAttributes(&ObjectAttributes, + &Name, + OBJ_CASE_INSENSITIVE, + NULL, + NULL); + + Status = NtOpenFile(&FileHandle, + GENERIC_READ, + &ObjectAttributes, + &IoStatusBlock, + 0, + FILE_SYNCHRONOUS_IO_NONALERT); + if (!NT_SUCCESS(Status)) + { + RtlFreeHeap(ProcessHeap, 0, OrigBootSector); + return Status; + } + + Status = NtReadFile(FileHandle, + NULL, + NULL, + NULL, + &IoStatusBlock, + OrigBootSector, + SECTORSIZE, + NULL, + NULL); + NtClose(FileHandle); + if (!NT_SUCCESS(Status)) + { + RtlFreeHeap(ProcessHeap, 0, OrigBootSector); + return Status; + } + + /* Allocate buffer for new bootsector (2 sectors) */ + NewBootSector = RtlAllocateHeap(ProcessHeap, 0, 2 * SECTORSIZE); + if (NewBootSector == NULL) + { + RtlFreeHeap(ProcessHeap, 0, OrigBootSector); + return STATUS_INSUFFICIENT_RESOURCES; + } + + /* Read new bootsector from SrcPath */ + RtlInitUnicodeString(&Name, SrcPath); + + InitializeObjectAttributes(&ObjectAttributes, + &Name, + OBJ_CASE_INSENSITIVE, + NULL, + NULL); + + Status = NtOpenFile(&FileHandle, + GENERIC_READ, + &ObjectAttributes, + &IoStatusBlock, + 0, + FILE_SYNCHRONOUS_IO_NONALERT); + if (!NT_SUCCESS(Status)) + { + RtlFreeHeap(ProcessHeap, 0, OrigBootSector); + RtlFreeHeap(ProcessHeap, 0, NewBootSector); + return Status; + } + + Status = NtReadFile(FileHandle, + NULL, + NULL, + NULL, + &IoStatusBlock, + NewBootSector, + 2 * SECTORSIZE, + NULL, + NULL); + NtClose(FileHandle); + if (!NT_SUCCESS(Status)) + { + RtlFreeHeap(ProcessHeap, 0, OrigBootSector); + RtlFreeHeap(ProcessHeap, 0, NewBootSector); + return Status; + } + + /* Adjust bootsector (copy a part of the FAT32 BPB) */ + memcpy(&NewBootSector->OemName, + &OrigBootSector->OemName, + FIELD_OFFSET(FAT32_BOOTSECTOR, BootCodeAndData) - + FIELD_OFFSET(FAT32_BOOTSECTOR, OemName)); + + /* Disable the backup boot sector */ + NewBootSector->BackupBootSector = 0; + + /* Free the original boot sector */ + RtlFreeHeap(ProcessHeap, 0, OrigBootSector); + + /* Write the first sector of the new bootcode to DstPath */ + RtlInitUnicodeString(&Name, DstPath); + + InitializeObjectAttributes(&ObjectAttributes, + &Name, + 0, + NULL, + NULL); + + Status = NtCreateFile(&FileHandle, + GENERIC_WRITE, + &ObjectAttributes, + &IoStatusBlock, + NULL, + FILE_ATTRIBUTE_NORMAL, + 0, + FILE_SUPERSEDE, + FILE_SYNCHRONOUS_IO_NONALERT | FILE_SEQUENTIAL_ONLY, + NULL, + 0); + if (!NT_SUCCESS(Status)) + { + RtlFreeHeap(ProcessHeap, 0, NewBootSector); + return Status; + } + + Status = NtWriteFile(FileHandle, + NULL, + NULL, + NULL, + &IoStatusBlock, + NewBootSector, + SECTORSIZE, + NULL, + NULL); + NtClose(FileHandle); + if (!NT_SUCCESS(Status)) + { + RtlFreeHeap(ProcessHeap, 0, NewBootSector); + return Status; + } + + /* Write the second sector of the new bootcode to boot disk sector 14 */ + RtlInitUnicodeString(&Name, RootPath); + + InitializeObjectAttributes(&ObjectAttributes, + &Name, + 0, + NULL, + NULL); + + Status = NtOpenFile(&FileHandle, + GENERIC_WRITE, + &ObjectAttributes, + &IoStatusBlock, + 0, + FILE_SYNCHRONOUS_IO_NONALERT); + if (!NT_SUCCESS(Status)) + { + RtlFreeHeap(ProcessHeap, 0, NewBootSector); + return Status; + } + + FileOffset.QuadPart = (ULONGLONG)(14 * SECTORSIZE); + Status = NtWriteFile(FileHandle, + NULL, + NULL, + NULL, + &IoStatusBlock, + (NewBootSector + SECTORSIZE), + SECTORSIZE, + &FileOffset, + NULL); + if (!NT_SUCCESS(Status)) + { + } + NtClose(FileHandle); + + /* Free the new boot sector */ + RtlFreeHeap(ProcessHeap, 0, NewBootSector); + + return Status; +} + + +NTSTATUS +InstallMbrBootCodeToDisk( + PWSTR SrcPath, + PWSTR RootPath) +{ + OBJECT_ATTRIBUTES ObjectAttributes; + IO_STATUS_BLOCK IoStatusBlock; + UNICODE_STRING Name; + HANDLE FileHandle; + NTSTATUS Status; + PPARTITION_SECTOR OrigBootSector; + PPARTITION_SECTOR NewBootSector; + + /* Allocate buffer for original bootsector */ + OrigBootSector = (PPARTITION_SECTOR)RtlAllocateHeap(ProcessHeap, + 0, + sizeof(PARTITION_SECTOR)); + if (OrigBootSector == NULL) + return STATUS_INSUFFICIENT_RESOURCES; + + /* Read current boot sector into buffer */ + RtlInitUnicodeString(&Name, + RootPath); + + InitializeObjectAttributes(&ObjectAttributes, + &Name, + OBJ_CASE_INSENSITIVE, + NULL, + NULL); + + Status = NtOpenFile(&FileHandle, + GENERIC_READ, + &ObjectAttributes, + &IoStatusBlock, + 0, + FILE_SYNCHRONOUS_IO_NONALERT); + if (!NT_SUCCESS(Status)) + { + RtlFreeHeap(ProcessHeap, 0, OrigBootSector); + return Status; + } + + Status = NtReadFile(FileHandle, + NULL, + NULL, + NULL, + &IoStatusBlock, + OrigBootSector, + SECTORSIZE, + NULL, + NULL); + NtClose(FileHandle); + if (!NT_SUCCESS(Status)) + { + RtlFreeHeap(ProcessHeap, 0, OrigBootSector); + return Status; + } + + + /* Allocate buffer for new bootsector */ + NewBootSector = (PPARTITION_SECTOR)RtlAllocateHeap(ProcessHeap, + 0, + sizeof(PARTITION_SECTOR)); + if (NewBootSector == NULL) + { + RtlFreeHeap(ProcessHeap, 0, OrigBootSector); + return STATUS_INSUFFICIENT_RESOURCES; + } + + /* Read new bootsector from SrcPath */ + RtlInitUnicodeString(&Name, SrcPath); + + InitializeObjectAttributes(&ObjectAttributes, + &Name, + OBJ_CASE_INSENSITIVE, + NULL, + NULL); + + Status = NtOpenFile(&FileHandle, + GENERIC_READ, + &ObjectAttributes, + &IoStatusBlock, + 0, + FILE_SYNCHRONOUS_IO_NONALERT); + if (!NT_SUCCESS(Status)) + { + RtlFreeHeap(ProcessHeap, 0, OrigBootSector); + RtlFreeHeap(ProcessHeap, 0, NewBootSector); + return Status; + } + + Status = NtReadFile(FileHandle, + NULL, + NULL, + NULL, + &IoStatusBlock, + NewBootSector, + sizeof(PARTITION_SECTOR), + NULL, + NULL); + NtClose(FileHandle); + if (!NT_SUCCESS(Status)) + { + RtlFreeHeap(ProcessHeap, 0, OrigBootSector); + RtlFreeHeap(ProcessHeap, 0, NewBootSector); + return Status; + } + + /* Copy partition table from old MBR to new */ + RtlCopyMemory (&NewBootSector->Signature, + &OrigBootSector->Signature, + sizeof(PARTITION_SECTOR) - offsetof(PARTITION_SECTOR, Signature) /* Length of partition table */); + + /* Free the original boot sector */ + RtlFreeHeap(ProcessHeap, 0, OrigBootSector); + + /* Write new bootsector to RootPath */ + RtlInitUnicodeString(&Name, RootPath); + + InitializeObjectAttributes(&ObjectAttributes, + &Name, + 0, + NULL, + NULL); + + Status = NtOpenFile(&FileHandle, + GENERIC_WRITE, + &ObjectAttributes, + &IoStatusBlock, + 0, + FILE_SYNCHRONOUS_IO_NONALERT | FILE_SEQUENTIAL_ONLY); + if (!NT_SUCCESS(Status)) + { + DPRINT1("NtOpenFile() failed (Status %lx)\n", Status); + RtlFreeHeap(ProcessHeap, 0, NewBootSector); + return Status; + } + + Status = NtWriteFile(FileHandle, + NULL, + NULL, + NULL, + &IoStatusBlock, + NewBootSector, + SECTORSIZE, + NULL, + NULL); + NtClose(FileHandle); + + /* Free the new boot sector */ + RtlFreeHeap(ProcessHeap, 0, NewBootSector); + + return Status; +} + + +NTSTATUS +InstallFat16BootCodeToDisk( + PWSTR SrcPath, + PWSTR RootPath) +{ + OBJECT_ATTRIBUTES ObjectAttributes; + IO_STATUS_BLOCK IoStatusBlock; + UNICODE_STRING Name; + HANDLE FileHandle; + NTSTATUS Status; + PFAT_BOOTSECTOR OrigBootSector; + PFAT_BOOTSECTOR NewBootSector; + PARTITION_INFORMATION *PartInfo; + + /* Allocate buffer for original bootsector */ + OrigBootSector = RtlAllocateHeap(ProcessHeap, 0, SECTORSIZE); + if (OrigBootSector == NULL) + return STATUS_INSUFFICIENT_RESOURCES; + + /* Read current boot sector into buffer */ + RtlInitUnicodeString(&Name, RootPath); + + InitializeObjectAttributes(&ObjectAttributes, + &Name, + OBJ_CASE_INSENSITIVE, + NULL, + NULL); + + Status = NtOpenFile(&FileHandle, + GENERIC_READ, + &ObjectAttributes, + &IoStatusBlock, + 0, + FILE_SYNCHRONOUS_IO_NONALERT); + if (!NT_SUCCESS(Status)) + { + RtlFreeHeap(ProcessHeap, 0, OrigBootSector); + return Status; + } + + Status = NtReadFile(FileHandle, + NULL, + NULL, + NULL, + &IoStatusBlock, + OrigBootSector, + SECTORSIZE, + NULL, + NULL); + NtClose(FileHandle); + if (!NT_SUCCESS(Status)) + { + RtlFreeHeap(ProcessHeap, 0, OrigBootSector); + return Status; + } + + + /* Allocate buffer for new bootsector */ + NewBootSector = RtlAllocateHeap(ProcessHeap, + 0, + SECTORSIZE); + if (NewBootSector == NULL) + { + RtlFreeHeap(ProcessHeap, 0, OrigBootSector); + return STATUS_INSUFFICIENT_RESOURCES; + } + + /* Read new bootsector from SrcPath */ + RtlInitUnicodeString(&Name, SrcPath); + + InitializeObjectAttributes(&ObjectAttributes, + &Name, + OBJ_CASE_INSENSITIVE, + NULL, + NULL); + + Status = NtOpenFile(&FileHandle, + GENERIC_READ, + &ObjectAttributes, + &IoStatusBlock, + 0, + FILE_SYNCHRONOUS_IO_NONALERT); + if (!NT_SUCCESS(Status)) + { + RtlFreeHeap(ProcessHeap, 0, OrigBootSector); + RtlFreeHeap(ProcessHeap, 0, NewBootSector); + return Status; + } + + Status = NtReadFile(FileHandle, + NULL, + NULL, + NULL, + &IoStatusBlock, + NewBootSector, + SECTORSIZE, + NULL, + NULL); + NtClose(FileHandle); + if (!NT_SUCCESS(Status)) + { + RtlFreeHeap(ProcessHeap, 0, OrigBootSector); + RtlFreeHeap(ProcessHeap, 0, NewBootSector); + return Status; + } + + /* Adjust bootsector (copy a part of the FAT16 BPB) */ + memcpy(&NewBootSector->OemName, + &OrigBootSector->OemName, + FIELD_OFFSET(FAT_BOOTSECTOR, BootCodeAndData) - + FIELD_OFFSET(FAT_BOOTSECTOR, OemName)); + + PartInfo = &PartitionList->CurrentPartition->PartInfo[PartitionList->CurrentPartitionNumber]; + NewBootSector->HiddenSectors = PartInfo->HiddenSectors; + + /* Free the original boot sector */ + RtlFreeHeap(ProcessHeap, 0, OrigBootSector); + + /* Write new bootsector to RootPath */ + RtlInitUnicodeString(&Name, RootPath); + + InitializeObjectAttributes(&ObjectAttributes, + &Name, + 0, + NULL, + NULL); + + Status = NtOpenFile(&FileHandle, + GENERIC_WRITE, + &ObjectAttributes, + &IoStatusBlock, + 0, + FILE_SYNCHRONOUS_IO_NONALERT | FILE_SEQUENTIAL_ONLY); + if (!NT_SUCCESS(Status)) + { + DPRINT1("NtOpenFile() failed (Status %lx)\n", Status); + RtlFreeHeap(ProcessHeap, 0, NewBootSector); + return Status; + } + +#if 0 + FilePosition.QuadPart = 0; +#endif + Status = NtWriteFile(FileHandle, + NULL, + NULL, + NULL, + &IoStatusBlock, + NewBootSector, + SECTORSIZE, + NULL, + NULL); + NtClose(FileHandle); + + /* Free the new boot sector */ + RtlFreeHeap(ProcessHeap, 0, NewBootSector); + + return Status; +} + + +NTSTATUS +InstallFat32BootCodeToDisk( + PWSTR SrcPath, + PWSTR RootPath) +{ + OBJECT_ATTRIBUTES ObjectAttributes; + IO_STATUS_BLOCK IoStatusBlock; + UNICODE_STRING Name; + HANDLE FileHandle; + NTSTATUS Status; + PFAT32_BOOTSECTOR OrigBootSector; + PFAT32_BOOTSECTOR NewBootSector; + LARGE_INTEGER FileOffset; + USHORT BackupBootSector; + PARTITION_INFORMATION *PartInfo; + + /* Allocate buffer for original bootsector */ + OrigBootSector = RtlAllocateHeap(ProcessHeap, 0, SECTORSIZE); + if (OrigBootSector == NULL) + return STATUS_INSUFFICIENT_RESOURCES; + + /* Read current boot sector into buffer */ + RtlInitUnicodeString(&Name, RootPath); + + InitializeObjectAttributes(&ObjectAttributes, + &Name, + OBJ_CASE_INSENSITIVE, + NULL, + NULL); + + Status = NtOpenFile(&FileHandle, + GENERIC_READ, + &ObjectAttributes, + &IoStatusBlock, + 0, + FILE_SYNCHRONOUS_IO_NONALERT); + if (!NT_SUCCESS(Status)) + { + RtlFreeHeap(ProcessHeap, 0, OrigBootSector); + return Status; + } + + Status = NtReadFile(FileHandle, + NULL, + NULL, + NULL, + &IoStatusBlock, + OrigBootSector, + SECTORSIZE, + NULL, + NULL); + NtClose(FileHandle); + if (!NT_SUCCESS(Status)) + { + RtlFreeHeap(ProcessHeap, 0, OrigBootSector); + return Status; + } + + + /* Allocate buffer for new bootsector (2 sectors) */ + NewBootSector = RtlAllocateHeap(ProcessHeap, 0, 2 * SECTORSIZE); + if (NewBootSector == NULL) + { + RtlFreeHeap(ProcessHeap, 0, OrigBootSector); + return STATUS_INSUFFICIENT_RESOURCES; + } + + /* Read new bootsector from SrcPath */ + RtlInitUnicodeString(&Name, SrcPath); + + InitializeObjectAttributes(&ObjectAttributes, + &Name, + OBJ_CASE_INSENSITIVE, + NULL, + NULL); + + Status = NtOpenFile(&FileHandle, + GENERIC_READ, + &ObjectAttributes, + &IoStatusBlock, + 0, + FILE_SYNCHRONOUS_IO_NONALERT); + if (!NT_SUCCESS(Status)) + { + RtlFreeHeap(ProcessHeap, 0, OrigBootSector); + RtlFreeHeap(ProcessHeap, 0, NewBootSector); + return Status; + } + + Status = NtReadFile(FileHandle, + NULL, + NULL, + NULL, + &IoStatusBlock, + NewBootSector, + 2 * SECTORSIZE, + NULL, + NULL); + NtClose(FileHandle); + if (!NT_SUCCESS(Status)) + { + RtlFreeHeap(ProcessHeap, 0, OrigBootSector); + RtlFreeHeap(ProcessHeap, 0, NewBootSector); + return Status; + } + + /* Adjust bootsector (copy a part of the FAT32 BPB) */ + memcpy(&NewBootSector->OemName, + &OrigBootSector->OemName, + FIELD_OFFSET(FAT32_BOOTSECTOR, BootCodeAndData) - + FIELD_OFFSET(FAT32_BOOTSECTOR, OemName)); + + PartInfo = &PartitionList->CurrentPartition->PartInfo[PartitionList->CurrentPartitionNumber]; + NewBootSector->HiddenSectors = PartInfo->HiddenSectors; + + /* Get the location of the backup boot sector */ + BackupBootSector = OrigBootSector->BackupBootSector; + + /* Free the original boot sector */ + RtlFreeHeap(ProcessHeap, 0, OrigBootSector); + + /* Write the first sector of the new bootcode to DstPath */ + RtlInitUnicodeString(&Name, RootPath); + + InitializeObjectAttributes(&ObjectAttributes, + &Name, + 0, + NULL, + NULL); + + Status = NtOpenFile(&FileHandle, + GENERIC_WRITE, + &ObjectAttributes, + &IoStatusBlock, + 0, + FILE_SYNCHRONOUS_IO_NONALERT | FILE_SEQUENTIAL_ONLY); + if (!NT_SUCCESS(Status)) + { + DPRINT1("NtOpenFile() failed (Status %lx)\n", Status); + RtlFreeHeap(ProcessHeap, 0, NewBootSector); + return Status; + } + + /* Write sector 0 */ + FileOffset.QuadPart = 0ULL; + Status = NtWriteFile(FileHandle, + NULL, + NULL, + NULL, + &IoStatusBlock, + NewBootSector, + SECTORSIZE, + &FileOffset, + NULL); + if (!NT_SUCCESS(Status)) + { + DPRINT1("NtWriteFile() failed (Status %lx)\n", Status); + NtClose(FileHandle); + RtlFreeHeap(ProcessHeap, 0, NewBootSector); + return Status; + } + + /* Write backup boot sector */ + if ((BackupBootSector != 0x0000) && (BackupBootSector != 0xFFFF)) + { + FileOffset.QuadPart = (ULONGLONG)((ULONG)BackupBootSector * SECTORSIZE); + Status = NtWriteFile(FileHandle, + NULL, + NULL, + NULL, + &IoStatusBlock, + NewBootSector, + SECTORSIZE, + &FileOffset, + NULL); + if (!NT_SUCCESS(Status)) + { + DPRINT1("NtWriteFile() failed (Status %lx)\n", Status); + NtClose(FileHandle); + RtlFreeHeap(ProcessHeap, 0, NewBootSector); + return Status; + } + } + + /* Write sector 14 */ + FileOffset.QuadPart = 14 * SECTORSIZE; + Status = NtWriteFile(FileHandle, + NULL, + NULL, + NULL, + &IoStatusBlock, + ((PUCHAR)NewBootSector + SECTORSIZE), + SECTORSIZE, + &FileOffset, + NULL); + if (!NT_SUCCESS(Status)) + { + DPRINT1("NtWriteFile() failed (Status %lx)\n", Status); + } + NtClose(FileHandle); + + /* Free the new boot sector */ + RtlFreeHeap(ProcessHeap, 0, NewBootSector); + + return Status; +} + + +static +NTSTATUS +UnprotectBootIni( + PWSTR FileName, + PULONG Attributes) +{ + UNICODE_STRING Name; + OBJECT_ATTRIBUTES ObjectAttributes; + IO_STATUS_BLOCK IoStatusBlock; + FILE_BASIC_INFORMATION FileInfo; + HANDLE FileHandle; + NTSTATUS Status; + + RtlInitUnicodeString(&Name, FileName); + + InitializeObjectAttributes(&ObjectAttributes, + &Name, + OBJ_CASE_INSENSITIVE, + NULL, + NULL); + + Status = NtOpenFile(&FileHandle, + GENERIC_READ|GENERIC_WRITE, + &ObjectAttributes, + &IoStatusBlock, + 0, + FILE_SYNCHRONOUS_IO_NONALERT); + if (Status == STATUS_NO_SUCH_FILE) + { + DPRINT1("NtOpenFile() failed (Status %lx)\n", Status); + *Attributes = 0; + return STATUS_SUCCESS; + } + if (!NT_SUCCESS(Status)) + { + DPRINT1("NtOpenFile() failed (Status %lx)\n", Status); + return Status; + } + + Status = NtQueryInformationFile(FileHandle, + &IoStatusBlock, + &FileInfo, + sizeof(FILE_BASIC_INFORMATION), + FileBasicInformation); + if (!NT_SUCCESS(Status)) + { + DPRINT1("NtQueryInformationFile() failed (Status %lx)\n", Status); + NtClose(FileHandle); + return Status; + } + + *Attributes = FileInfo.FileAttributes; + + /* Delete attributes SYSTEM, HIDDEN and READONLY */ + FileInfo.FileAttributes = FileInfo.FileAttributes & + ~(FILE_ATTRIBUTE_SYSTEM | + FILE_ATTRIBUTE_HIDDEN | + FILE_ATTRIBUTE_READONLY); + + Status = NtSetInformationFile(FileHandle, + &IoStatusBlock, + &FileInfo, + sizeof(FILE_BASIC_INFORMATION), + FileBasicInformation); + if (!NT_SUCCESS(Status)) + { + DPRINT1("NtSetInformationFile() failed (Status %lx)\n", Status); + } + + NtClose(FileHandle); + return Status; +} + + +static +NTSTATUS +ProtectBootIni( + PWSTR FileName, + ULONG Attributes) +{ + UNICODE_STRING Name; + OBJECT_ATTRIBUTES ObjectAttributes; + IO_STATUS_BLOCK IoStatusBlock; + FILE_BASIC_INFORMATION FileInfo; + HANDLE FileHandle; + NTSTATUS Status; + + RtlInitUnicodeString(&Name, FileName); + + InitializeObjectAttributes(&ObjectAttributes, + &Name, + OBJ_CASE_INSENSITIVE, + NULL, + NULL); + + Status = NtOpenFile(&FileHandle, + GENERIC_READ|GENERIC_WRITE, + &ObjectAttributes, + &IoStatusBlock, + 0, + FILE_SYNCHRONOUS_IO_NONALERT); + if (!NT_SUCCESS(Status)) + { + DPRINT1("NtOpenFile() failed (Status %lx)\n", Status); + return Status; + } + + Status = NtQueryInformationFile(FileHandle, + &IoStatusBlock, + &FileInfo, + sizeof(FILE_BASIC_INFORMATION), + FileBasicInformation); + if (!NT_SUCCESS(Status)) + { + DPRINT1("NtQueryInformationFile() failed (Status %lx)\n", Status); + NtClose(FileHandle); + return Status; + } + + FileInfo.FileAttributes = FileInfo.FileAttributes | Attributes; + + Status = NtSetInformationFile(FileHandle, + &IoStatusBlock, + &FileInfo, + sizeof(FILE_BASIC_INFORMATION), + FileBasicInformation); + if (!NT_SUCCESS(Status)) + { + DPRINT1("NtSetInformationFile() failed (Status %lx)\n", Status); + } + + NtClose(FileHandle); + return Status; +} + + +NTSTATUS +UpdateBootIni( + PWSTR BootIniPath, + PWSTR EntryName, + PWSTR EntryValue) +{ + UNICODE_STRING Name; + PINICACHE Cache = NULL; + PINICACHESECTION Section = NULL; + NTSTATUS Status; + ULONG FileAttribute; + PWCHAR OldValue = NULL; + + RtlInitUnicodeString(&Name, BootIniPath); + + Status = IniCacheLoad(&Cache, &Name, FALSE); + if (!NT_SUCCESS(Status)) + { + return Status; + } + + Section = IniCacheGetSection(Cache, + L"operating systems"); + if (Section == NULL) + { + IniCacheDestroy(Cache); + return STATUS_UNSUCCESSFUL; + } + + /* Check - maybe record already exists */ + Status = IniCacheGetKey(Section, EntryName, &OldValue); + + /* If either key was not found, or contains something else - add new one */ + if (!NT_SUCCESS(Status) || wcscmp(OldValue, EntryValue)) + { + IniCacheInsertKey(Section, + NULL, + INSERT_LAST, + EntryName, + EntryValue); + } + + Status = UnprotectBootIni(BootIniPath, + &FileAttribute); + if (!NT_SUCCESS(Status)) + { + IniCacheDestroy(Cache); + return Status; + } + + Status = IniCacheSave(Cache, BootIniPath); + if (!NT_SUCCESS(Status)) + { + IniCacheDestroy(Cache); + return Status; + } + + FileAttribute |= (FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_READONLY); + Status = ProtectBootIni(BootIniPath, FileAttribute); - Section = IniCacheGetSection(Cache, - L"operating systems"); - if (Section == NULL) - { IniCacheDestroy(Cache); - return(STATUS_UNSUCCESSFUL); - } - /* Check - maybe record already exists */ - Status = IniCacheGetKey(Section, - EntryName, - &OldValue); - - /* If either key was not found, or contains something else - add new one */ - if (!NT_SUCCESS(Status) || wcscmp(OldValue, EntryValue)) - { - IniCacheInsertKey(Section, - NULL, - INSERT_LAST, - EntryName, - EntryValue); - } - - Status = UnprotectBootIni(BootIniPath, - &FileAttribute); - if (!NT_SUCCESS(Status)) - { - IniCacheDestroy(Cache); - return(Status); - } - - Status = IniCacheSave(Cache, - BootIniPath); - if (!NT_SUCCESS(Status)) - { - IniCacheDestroy(Cache); - return(Status); - } - - FileAttribute |= (FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_READONLY); - Status = ProtectBootIni(BootIniPath, - FileAttribute); - - IniCacheDestroy(Cache); - - return(Status); + return Status; } BOOLEAN -CheckInstallFatBootcodeToPartition(PUNICODE_STRING SystemRootPath) +CheckInstallFatBootcodeToPartition( + PUNICODE_STRING SystemRootPath) { #ifdef __REACTOS__ - if (DoesFileExist(SystemRootPath->Buffer, L"ntldr") || - DoesFileExist(SystemRootPath->Buffer, L"boot.ini")) + if (DoesFileExist(SystemRootPath->Buffer, L"ntldr") || + DoesFileExist(SystemRootPath->Buffer, L"boot.ini")) { - return TRUE; + return TRUE; } - else if (DoesFileExist(SystemRootPath->Buffer, L"io.sys") || - DoesFileExist(SystemRootPath->Buffer, L"msdos.sys")) + else if (DoesFileExist(SystemRootPath->Buffer, L"io.sys") || + DoesFileExist(SystemRootPath->Buffer, L"msdos.sys")) { - return TRUE; + return TRUE; } #endif - return FALSE; + return FALSE; } NTSTATUS -InstallFatBootcodeToPartition(PUNICODE_STRING SystemRootPath, - PUNICODE_STRING SourceRootPath, - PUNICODE_STRING DestinationArcPath, - UCHAR PartitionType) +InstallFatBootcodeToPartition( + PUNICODE_STRING SystemRootPath, + PUNICODE_STRING SourceRootPath, + PUNICODE_STRING DestinationArcPath, + UCHAR PartitionType) { #ifdef __REACTOS__ - WCHAR SrcPath[MAX_PATH]; - WCHAR DstPath[MAX_PATH]; - NTSTATUS Status; + WCHAR SrcPath[MAX_PATH]; + WCHAR DstPath[MAX_PATH]; + NTSTATUS Status; - /* FAT or FAT32 partition */ - DPRINT("System path: '%wZ'\n", SystemRootPath); + /* FAT or FAT32 partition */ + DPRINT("System path: '%wZ'\n", SystemRootPath); - if (DoesFileExist(SystemRootPath->Buffer, L"ntldr") == TRUE || - DoesFileExist(SystemRootPath->Buffer, L"boot.ini") == TRUE) - { - /* Search root directory for 'ntldr' and 'boot.ini'. */ - DPRINT("Found Microsoft Windows NT/2000/XP boot loader\n"); + if (DoesFileExist(SystemRootPath->Buffer, L"ntldr") == TRUE || + DoesFileExist(SystemRootPath->Buffer, L"boot.ini") == TRUE) + { + /* Search root directory for 'ntldr' and 'boot.ini'. */ + DPRINT("Found Microsoft Windows NT/2000/XP boot loader\n"); - /* Copy FreeLoader to the boot partition */ - wcscpy(SrcPath, SourceRootPath->Buffer); - wcscat(SrcPath, L"\\loader\\freeldr.sys"); - wcscpy(DstPath, SystemRootPath->Buffer); - wcscat(DstPath, L"\\freeldr.sys"); + /* Copy FreeLoader to the boot partition */ + wcscpy(SrcPath, SourceRootPath->Buffer); + wcscat(SrcPath, L"\\loader\\freeldr.sys"); + wcscpy(DstPath, SystemRootPath->Buffer); + wcscat(DstPath, L"\\freeldr.sys"); - DPRINT("Copy: %S ==> %S\n", SrcPath, DstPath); - Status = SetupCopyFile(SrcPath, DstPath); - if (!NT_SUCCESS(Status)) - { - DPRINT1("SetupCopyFile() failed (Status %lx)\n", Status); - return Status; - } + DPRINT("Copy: %S ==> %S\n", SrcPath, DstPath); + Status = SetupCopyFile(SrcPath, DstPath); + if (!NT_SUCCESS(Status)) + { + DPRINT1("SetupCopyFile() failed (Status %lx)\n", Status); + return Status; + } - /* Create or update freeldr.ini */ - if (DoesFileExist(SystemRootPath->Buffer, L"freeldr.ini") == FALSE) - { - /* Create new 'freeldr.ini' */ - DPRINT1("Create new 'freeldr.ini'\n"); - wcscpy(DstPath, SystemRootPath->Buffer); - wcscat(DstPath, L"\\freeldr.ini"); + /* Create or update freeldr.ini */ + if (DoesFileExist(SystemRootPath->Buffer, L"freeldr.ini") == FALSE) + { + /* Create new 'freeldr.ini' */ + DPRINT1("Create new 'freeldr.ini'\n"); + wcscpy(DstPath, SystemRootPath->Buffer); + wcscat(DstPath, L"\\freeldr.ini"); - Status = CreateFreeLoaderIniForReactos(DstPath, - DestinationArcPath->Buffer); - if (!NT_SUCCESS(Status)) - { - DPRINT1("CreateFreeLoaderIniForReactos() failed (Status %lx)\n", Status); - return Status; - } + Status = CreateFreeLoaderIniForReactos(DstPath, + DestinationArcPath->Buffer); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CreateFreeLoaderIniForReactos() failed (Status %lx)\n", Status); + return Status; + } - /* Install new bootcode */ - if (PartitionType == PARTITION_FAT32 || - PartitionType == PARTITION_FAT32_XINT13) - { - /* Install FAT32 bootcode */ - wcscpy(SrcPath, SourceRootPath->Buffer); - wcscat(SrcPath, L"\\loader\\fat32.bin"); - wcscpy(DstPath, SystemRootPath->Buffer); - wcscat(DstPath, L"\\bootsect.ros"); + /* Install new bootcode */ + if (PartitionType == PARTITION_FAT32 || + PartitionType == PARTITION_FAT32_XINT13) + { + /* Install FAT32 bootcode */ + wcscpy(SrcPath, SourceRootPath->Buffer); + wcscat(SrcPath, L"\\loader\\fat32.bin"); + wcscpy(DstPath, SystemRootPath->Buffer); + wcscat(DstPath, L"\\bootsect.ros"); - DPRINT1("Install FAT32 bootcode: %S ==> %S\n", SrcPath, DstPath); - Status = InstallFat32BootCodeToFile(SrcPath, - DstPath, - SystemRootPath->Buffer); - if (!NT_SUCCESS(Status)) - { - DPRINT1("InstallFat32BootCodeToFile() failed (Status %lx)\n", Status); - return Status; - } - } - else - { - /* Install FAT16 bootcode */ - wcscpy(SrcPath, SourceRootPath->Buffer); - wcscat(SrcPath, L"\\loader\\fat.bin"); - wcscpy(DstPath, SystemRootPath->Buffer); - wcscat(DstPath, L"\\bootsect.ros"); + DPRINT1("Install FAT32 bootcode: %S ==> %S\n", SrcPath, DstPath); + Status = InstallFat32BootCodeToFile(SrcPath, + DstPath, + SystemRootPath->Buffer); + if (!NT_SUCCESS(Status)) + { + DPRINT1("InstallFat32BootCodeToFile() failed (Status %lx)\n", Status); + return Status; + } + } + else + { + /* Install FAT16 bootcode */ + wcscpy(SrcPath, SourceRootPath->Buffer); + wcscat(SrcPath, L"\\loader\\fat.bin"); + wcscpy(DstPath, SystemRootPath->Buffer); + wcscat(DstPath, L"\\bootsect.ros"); - DPRINT1("Install FAT bootcode: %S ==> %S\n", SrcPath, DstPath); - Status = InstallFat16BootCodeToFile(SrcPath, - DstPath, - SystemRootPath->Buffer); - if (!NT_SUCCESS(Status)) - { - DPRINT1("InstallFat16BootCodeToFile() failed (Status %lx)\n", Status); - return Status; - } - } - } - else - { - /* Update existing 'freeldr.ini' */ - DPRINT1("Update existing 'freeldr.ini'\n"); - wcscpy(DstPath, SystemRootPath->Buffer); - wcscat(DstPath, L"\\freeldr.ini"); + DPRINT1("Install FAT bootcode: %S ==> %S\n", SrcPath, DstPath); + Status = InstallFat16BootCodeToFile(SrcPath, + DstPath, + SystemRootPath->Buffer); + if (!NT_SUCCESS(Status)) + { + DPRINT1("InstallFat16BootCodeToFile() failed (Status %lx)\n", Status); + return Status; + } + } + } + else + { + /* Update existing 'freeldr.ini' */ + DPRINT1("Update existing 'freeldr.ini'\n"); + wcscpy(DstPath, SystemRootPath->Buffer); + wcscat(DstPath, L"\\freeldr.ini"); - Status = UpdateFreeLoaderIni(DstPath, - DestinationArcPath->Buffer); - if (!NT_SUCCESS(Status)) - { - DPRINT1("UpdateFreeLoaderIni() failed (Status %lx)\n", Status); - return Status; - } - } + Status = UpdateFreeLoaderIni(DstPath, + DestinationArcPath->Buffer); + if (!NT_SUCCESS(Status)) + { + DPRINT1("UpdateFreeLoaderIni() failed (Status %lx)\n", Status); + return Status; + } + } - /* Update 'boot.ini' */ - wcscpy(DstPath, SystemRootPath->Buffer); - wcscat(DstPath, L"\\boot.ini"); + /* Update 'boot.ini' */ + wcscpy(DstPath, SystemRootPath->Buffer); + wcscat(DstPath, L"\\boot.ini"); - DPRINT1("Update 'boot.ini': %S\n", DstPath); - Status = UpdateBootIni(DstPath, - L"C:\\bootsect.ros", - L"\"ReactOS\""); - if (!NT_SUCCESS(Status)) - { - DPRINT1("UpdateBootIni() failed (Status %lx)\n", Status); - return Status; - } - } - else if (DoesFileExist(SystemRootPath->Buffer, L"io.sys") == TRUE || - DoesFileExist(SystemRootPath->Buffer, L"msdos.sys") == TRUE) - { - /* Search for root directory for 'io.sys' and 'msdos.sys'. */ - DPRINT1("Found Microsoft DOS or Windows 9x boot loader\n"); + DPRINT1("Update 'boot.ini': %S\n", DstPath); + Status = UpdateBootIni(DstPath, + L"C:\\bootsect.ros", + L"\"ReactOS\""); + if (!NT_SUCCESS(Status)) + { + DPRINT1("UpdateBootIni() failed (Status %lx)\n", Status); + return Status; + } + } + else if (DoesFileExist(SystemRootPath->Buffer, L"io.sys") == TRUE || + DoesFileExist(SystemRootPath->Buffer, L"msdos.sys") == TRUE) + { + /* Search for root directory for 'io.sys' and 'msdos.sys'. */ + DPRINT1("Found Microsoft DOS or Windows 9x boot loader\n"); - /* Copy FreeLoader to the boot partition */ - wcscpy(SrcPath, SourceRootPath->Buffer); - wcscat(SrcPath, L"\\loader\\freeldr.sys"); - wcscpy(DstPath, SystemRootPath->Buffer); - wcscat(DstPath, L"\\freeldr.sys"); + /* Copy FreeLoader to the boot partition */ + wcscpy(SrcPath, SourceRootPath->Buffer); + wcscat(SrcPath, L"\\loader\\freeldr.sys"); + wcscpy(DstPath, SystemRootPath->Buffer); + wcscat(DstPath, L"\\freeldr.sys"); - DPRINT("Copy: %S ==> %S\n", SrcPath, DstPath); - Status = SetupCopyFile(SrcPath, DstPath); - if (!NT_SUCCESS(Status)) - { - DPRINT1("SetupCopyFile() failed (Status %lx)\n", Status); - return Status; - } + DPRINT("Copy: %S ==> %S\n", SrcPath, DstPath); + Status = SetupCopyFile(SrcPath, DstPath); + if (!NT_SUCCESS(Status)) + { + DPRINT1("SetupCopyFile() failed (Status %lx)\n", Status); + return Status; + } - /* Create or update 'freeldr.ini' */ - if (DoesFileExist(SystemRootPath->Buffer, L"freeldr.ini") == FALSE) - { - /* Create new 'freeldr.ini' */ - DPRINT1("Create new 'freeldr.ini'\n"); - wcscpy(DstPath, SystemRootPath->Buffer); - wcscat(DstPath, L"\\freeldr.ini"); + /* Create or update 'freeldr.ini' */ + if (DoesFileExist(SystemRootPath->Buffer, L"freeldr.ini") == FALSE) + { + /* Create new 'freeldr.ini' */ + DPRINT1("Create new 'freeldr.ini'\n"); + wcscpy(DstPath, SystemRootPath->Buffer); + wcscat(DstPath, L"\\freeldr.ini"); - Status = CreateFreeLoaderIniForDos(DstPath, - DestinationArcPath->Buffer); - if (!NT_SUCCESS(Status)) - { - DPRINT1("CreateFreeLoaderIniForDos() failed (Status %lx)\n", Status); - return Status; - } + Status = CreateFreeLoaderIniForDos(DstPath, + DestinationArcPath->Buffer); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CreateFreeLoaderIniForDos() failed (Status %lx)\n", Status); + return Status; + } - /* Save current bootsector as 'BOOTSECT.DOS' */ - wcscpy(SrcPath, SystemRootPath->Buffer); - wcscpy(DstPath, SystemRootPath->Buffer); - wcscat(DstPath, L"\\bootsect.dos"); + /* Save current bootsector as 'BOOTSECT.DOS' */ + wcscpy(SrcPath, SystemRootPath->Buffer); + wcscpy(DstPath, SystemRootPath->Buffer); + wcscat(DstPath, L"\\bootsect.dos"); - DPRINT1("Save bootsector: %S ==> %S\n", SrcPath, DstPath); - Status = SaveCurrentBootSector(SrcPath, - DstPath); - if (!NT_SUCCESS(Status)) - { - DPRINT1("SaveCurrentBootSector() failed (Status %lx)\n", Status); - return Status; - } + DPRINT1("Save bootsector: %S ==> %S\n", SrcPath, DstPath); + Status = SaveCurrentBootSector(SrcPath, + DstPath); + if (!NT_SUCCESS(Status)) + { + DPRINT1("SaveCurrentBootSector() failed (Status %lx)\n", Status); + return Status; + } - /* Install new bootsector */ - if (PartitionType == PARTITION_FAT32 || - PartitionType == PARTITION_FAT32_XINT13) - { - wcscpy(SrcPath, SourceRootPath->Buffer); - wcscat(SrcPath, L"\\loader\\fat32.bin"); + /* Install new bootsector */ + if (PartitionType == PARTITION_FAT32 || + PartitionType == PARTITION_FAT32_XINT13) + { + wcscpy(SrcPath, SourceRootPath->Buffer); + wcscat(SrcPath, L"\\loader\\fat32.bin"); - DPRINT1("Install FAT32 bootcode: %S ==> %S\n", SrcPath, SystemRootPath->Buffer); - Status = InstallFat32BootCodeToDisk(SrcPath, - SystemRootPath->Buffer); - if (!NT_SUCCESS(Status)) - { - DPRINT1("InstallFat32BootCodeToDisk() failed (Status %lx)\n", Status); - return Status; - } - } - else - { - wcscpy(SrcPath, SourceRootPath->Buffer); - wcscat(SrcPath, L"\\loader\\fat.bin"); + DPRINT1("Install FAT32 bootcode: %S ==> %S\n", SrcPath, SystemRootPath->Buffer); + Status = InstallFat32BootCodeToDisk(SrcPath, + SystemRootPath->Buffer); + if (!NT_SUCCESS(Status)) + { + DPRINT1("InstallFat32BootCodeToDisk() failed (Status %lx)\n", Status); + return Status; + } + } + else + { + wcscpy(SrcPath, SourceRootPath->Buffer); + wcscat(SrcPath, L"\\loader\\fat.bin"); - DPRINT1("Install FAT bootcode: %S ==> %S\n", SrcPath, SystemRootPath->Buffer); - Status = InstallFat16BootCodeToDisk(SrcPath, - SystemRootPath->Buffer); - if (!NT_SUCCESS(Status)) - { - DPRINT1("InstallFat16BootCodeToDisk() failed (Status %lx)\n", Status); - return Status; - } - } - } - else - { - /* Update existing 'freeldr.ini' */ - wcscpy(DstPath, SystemRootPath->Buffer); - wcscat(DstPath, L"\\freeldr.ini"); + DPRINT1("Install FAT bootcode: %S ==> %S\n", SrcPath, SystemRootPath->Buffer); + Status = InstallFat16BootCodeToDisk(SrcPath, + SystemRootPath->Buffer); + if (!NT_SUCCESS(Status)) + { + DPRINT1("InstallFat16BootCodeToDisk() failed (Status %lx)\n", Status); + return Status; + } + } + } + else + { + /* Update existing 'freeldr.ini' */ + wcscpy(DstPath, SystemRootPath->Buffer); + wcscat(DstPath, L"\\freeldr.ini"); - Status = UpdateFreeLoaderIni(DstPath, - DestinationArcPath->Buffer); - if (!NT_SUCCESS(Status)) - { - DPRINT1("UpdateFreeLoaderIni() failed (Status %lx)\n", Status); - return Status; - } - } - } - else - { - /* No or unknown boot loader */ - DPRINT1("No or unknown boot loader found\n"); + Status = UpdateFreeLoaderIni(DstPath, DestinationArcPath->Buffer); + if (!NT_SUCCESS(Status)) + { + DPRINT1("UpdateFreeLoaderIni() failed (Status %lx)\n", Status); + return Status; + } + } + } + else + { + /* No or unknown boot loader */ + DPRINT1("No or unknown boot loader found\n"); - /* Copy FreeLoader to the boot partition */ - wcscpy(SrcPath, SourceRootPath->Buffer); - wcscat(SrcPath, L"\\loader\\freeldr.sys"); - wcscpy(DstPath, SystemRootPath->Buffer); - wcscat(DstPath, L"\\freeldr.sys"); + /* Copy FreeLoader to the boot partition */ + wcscpy(SrcPath, SourceRootPath->Buffer); + wcscat(SrcPath, L"\\loader\\freeldr.sys"); + wcscpy(DstPath, SystemRootPath->Buffer); + wcscat(DstPath, L"\\freeldr.sys"); - DPRINT("Copy: %S ==> %S\n", SrcPath, DstPath); - Status = SetupCopyFile(SrcPath, DstPath); - if (!NT_SUCCESS(Status)) - { - DPRINT1("SetupCopyFile() failed (Status %lx)\n", Status); - return Status; - } + DPRINT("Copy: %S ==> %S\n", SrcPath, DstPath); + Status = SetupCopyFile(SrcPath, DstPath); + if (!NT_SUCCESS(Status)) + { + DPRINT1("SetupCopyFile() failed (Status %lx)\n", Status); + return Status; + } - /* Create or update 'freeldr.ini' */ - if (DoesFileExist(SystemRootPath->Buffer, L"freeldr.ini") == FALSE) - { - /* Create new freeldr.ini */ - wcscpy(DstPath, SystemRootPath->Buffer); - wcscat(DstPath, L"\\freeldr.ini"); + /* Create or update 'freeldr.ini' */ + if (DoesFileExist(SystemRootPath->Buffer, L"freeldr.ini") == FALSE) + { + /* Create new freeldr.ini */ + wcscpy(DstPath, SystemRootPath->Buffer); + wcscat(DstPath, L"\\freeldr.ini"); - DPRINT("Copy: %S ==> %S\n", SrcPath, DstPath); - Status = CreateFreeLoaderIniForReactos(DstPath, - DestinationArcPath->Buffer); - if (!NT_SUCCESS(Status)) - { - DPRINT1("CreateFreeLoaderIniForReactos() failed (Status %lx)\n", Status); - return Status; - } + DPRINT("Copy: %S ==> %S\n", SrcPath, DstPath); + Status = CreateFreeLoaderIniForReactos(DstPath, + DestinationArcPath->Buffer); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CreateFreeLoaderIniForReactos() failed (Status %lx)\n", Status); + return Status; + } - /* Save current bootsector as 'BOOTSECT.OLD' */ - wcscpy(SrcPath, SystemRootPath->Buffer); - wcscpy(DstPath, SystemRootPath->Buffer); - wcscat(DstPath, L"\\bootsect.old"); + /* Save current bootsector as 'BOOTSECT.OLD' */ + wcscpy(SrcPath, SystemRootPath->Buffer); + wcscpy(DstPath, SystemRootPath->Buffer); + wcscat(DstPath, L"\\bootsect.old"); - DPRINT("Save bootsector: %S ==> %S\n", SrcPath, DstPath); - Status = SaveCurrentBootSector(SrcPath, - DstPath); - if (!NT_SUCCESS(Status)) - { - DPRINT1("SaveCurrentBootSector() failed (Status %lx)\n", Status); - return Status; - } + DPRINT("Save bootsector: %S ==> %S\n", SrcPath, DstPath); + Status = SaveCurrentBootSector(SrcPath, + DstPath); + if (!NT_SUCCESS(Status)) + { + DPRINT1("SaveCurrentBootSector() failed (Status %lx)\n", Status); + return Status; + } - /* Install new bootsector */ - if (PartitionType == PARTITION_FAT32 || - PartitionType == PARTITION_FAT32_XINT13) - { - wcscpy(SrcPath, SourceRootPath->Buffer); - wcscat(SrcPath, L"\\loader\\fat32.bin"); + /* Install new bootsector */ + if ((PartitionType == PARTITION_FAT32) || + (PartitionType == PARTITION_FAT32_XINT13)) + { + wcscpy(SrcPath, SourceRootPath->Buffer); + wcscat(SrcPath, L"\\loader\\fat32.bin"); - DPRINT("Install FAT32 bootcode: %S ==> %S\n", SrcPath, SystemRootPath->Buffer); - Status = InstallFat32BootCodeToDisk(SrcPath, - SystemRootPath->Buffer); - if (!NT_SUCCESS(Status)) - { - DPRINT1("InstallFat32BootCodeToDisk() failed (Status %lx)\n", Status); - return Status; - } - } - else - { - wcscpy(SrcPath, SourceRootPath->Buffer); - wcscat(SrcPath, L"\\loader\\fat.bin"); + DPRINT("Install FAT32 bootcode: %S ==> %S\n", SrcPath, SystemRootPath->Buffer); + Status = InstallFat32BootCodeToDisk(SrcPath, + SystemRootPath->Buffer); + if (!NT_SUCCESS(Status)) + { + DPRINT1("InstallFat32BootCodeToDisk() failed (Status %lx)\n", Status); + return Status; + } + } + else + { + wcscpy(SrcPath, SourceRootPath->Buffer); + wcscat(SrcPath, L"\\loader\\fat.bin"); - DPRINT("Install FAT bootcode: %S ==> %S\n", SrcPath, SystemRootPath->Buffer); - Status = InstallFat16BootCodeToDisk(SrcPath, - SystemRootPath->Buffer); - if (!NT_SUCCESS(Status)) - { - DPRINT1("InstallFat16BootCodeToDisk() failed (Status %lx)\n", Status); - return Status; - } - } - } - else - { - /* Update existing 'freeldr.ini' */ - wcscpy(DstPath, SystemRootPath->Buffer); - wcscat(DstPath, L"\\freeldr.ini"); + DPRINT("Install FAT bootcode: %S ==> %S\n", SrcPath, SystemRootPath->Buffer); + Status = InstallFat16BootCodeToDisk(SrcPath, + SystemRootPath->Buffer); + if (!NT_SUCCESS(Status)) + { + DPRINT1("InstallFat16BootCodeToDisk() failed (Status %lx)\n", Status); + return Status; + } + } + } + else + { + /* Update existing 'freeldr.ini' */ + wcscpy(DstPath, SystemRootPath->Buffer); + wcscat(DstPath, L"\\freeldr.ini"); - Status = UpdateFreeLoaderIni(DstPath, - DestinationArcPath->Buffer); - if (!NT_SUCCESS(Status)) - { - DPRINT1("UpdateFreeLoaderIni() failed (Status %lx)\n", Status); - return Status; - } - } - } + Status = UpdateFreeLoaderIni(DstPath, + DestinationArcPath->Buffer); + if (!NT_SUCCESS(Status)) + { + DPRINT1("UpdateFreeLoaderIni() failed (Status %lx)\n", Status); + return Status; + } + } + } - return STATUS_SUCCESS; + return STATUS_SUCCESS; #else - return STATUS_NOT_IMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; #endif } NTSTATUS -InstallVBRToPartition(PUNICODE_STRING SystemRootPath, - PUNICODE_STRING SourceRootPath, - PUNICODE_STRING DestinationArcPath, - UCHAR PartitionType) +InstallVBRToPartition( + PUNICODE_STRING SystemRootPath, + PUNICODE_STRING SourceRootPath, + PUNICODE_STRING DestinationArcPath, + UCHAR PartitionType) { if ((PartitionType == PARTITION_FAT_12) || (PartitionType == PARTITION_FAT_16) || @@ -2251,64 +2187,63 @@ InstallVBRToPartition(PUNICODE_STRING SystemRootPath, DestinationArcPath, PartitionType); } - + return STATUS_UNSUCCESSFUL; } NTSTATUS -InstallFatBootcodeToFloppy(PUNICODE_STRING SourceRootPath, - PUNICODE_STRING DestinationArcPath) +InstallFatBootcodeToFloppy( + PUNICODE_STRING SourceRootPath, + PUNICODE_STRING DestinationArcPath) { #ifdef __REACTOS__ - WCHAR SrcPath[MAX_PATH]; - WCHAR DstPath[MAX_PATH]; - NTSTATUS Status; + WCHAR SrcPath[MAX_PATH]; + WCHAR DstPath[MAX_PATH]; + NTSTATUS Status; - /* Copy FreeLoader to the boot partition */ - wcscpy(SrcPath, SourceRootPath->Buffer); - wcscat(SrcPath, L"\\loader\\freeldr.sys"); + /* Copy FreeLoader to the boot partition */ + wcscpy(SrcPath, SourceRootPath->Buffer); + wcscat(SrcPath, L"\\loader\\freeldr.sys"); - wcscpy(DstPath, L"\\Device\\Floppy0\\freeldr.sys"); + wcscpy(DstPath, L"\\Device\\Floppy0\\freeldr.sys"); - DPRINT("Copy: %S ==> %S\n", SrcPath, DstPath); - Status = SetupCopyFile(SrcPath, DstPath); - if (!NT_SUCCESS(Status)) + DPRINT("Copy: %S ==> %S\n", SrcPath, DstPath); + Status = SetupCopyFile(SrcPath, DstPath); + if (!NT_SUCCESS(Status)) { - DPRINT1("SetupCopyFile() failed (Status %lx)\n", Status); - return Status; + DPRINT1("SetupCopyFile() failed (Status %lx)\n", Status); + return Status; } - /* Create new 'freeldr.ini' */ - wcscpy(DstPath, L"\\Device\\Floppy0\\freeldr.ini"); + /* Create new 'freeldr.ini' */ + wcscpy(DstPath, L"\\Device\\Floppy0\\freeldr.ini"); - DPRINT("Create new 'freeldr.ini'\n"); - Status = CreateFreeLoaderIniForReactos(DstPath, - DestinationArcPath->Buffer); - if (!NT_SUCCESS(Status)) + DPRINT("Create new 'freeldr.ini'\n"); + Status = CreateFreeLoaderIniForReactos(DstPath, DestinationArcPath->Buffer); + if (!NT_SUCCESS(Status)) { - DPRINT1("CreateFreeLoaderIniForReactos() failed (Status %lx)\n", Status); - return Status; + DPRINT1("CreateFreeLoaderIniForReactos() failed (Status %lx)\n", Status); + return Status; } - /* Install FAT12/16 boosector */ - wcscpy(SrcPath, SourceRootPath->Buffer); - wcscat(SrcPath, L"\\loader\\fat.bin"); + /* Install FAT12/16 boosector */ + wcscpy(SrcPath, SourceRootPath->Buffer); + wcscat(SrcPath, L"\\loader\\fat.bin"); - wcscpy(DstPath, L"\\Device\\Floppy0"); + wcscpy(DstPath, L"\\Device\\Floppy0"); - DPRINT("Install FAT bootcode: %S ==> %S\n", SrcPath, DstPath); - Status = InstallFat16BootCodeToDisk(SrcPath, - DstPath); - if (!NT_SUCCESS(Status)) + DPRINT("Install FAT bootcode: %S ==> %S\n", SrcPath, DstPath); + Status = InstallFat16BootCodeToDisk(SrcPath, DstPath); + if (!NT_SUCCESS(Status)) { - DPRINT1("InstallFat16BootCodeToDisk() failed (Status %lx)\n", Status); - return Status; + DPRINT1("InstallFat16BootCodeToDisk() failed (Status %lx)\n", Status); + return Status; } - return STATUS_SUCCESS; + return STATUS_SUCCESS; #else - return STATUS_NOT_IMPLEMENTED; + return STATUS_NOT_IMPLEMENTED; #endif } diff --git a/base/setup/usetup/cabinet.c b/base/setup/usetup/cabinet.c index 25357a41cbb..0e8200ab222 100644 --- a/base/setup/usetup/cabinet.c +++ b/base/setup/usetup/cabinet.c @@ -9,7 +9,6 @@ */ #include "usetup.h" -#include #define NDEBUG #include diff --git a/base/setup/usetup/filesup.c b/base/setup/usetup/filesup.c index f0d8152e1f9..0051b0abed0 100644 --- a/base/setup/usetup/filesup.c +++ b/base/setup/usetup/filesup.c @@ -126,7 +126,7 @@ SetupCopyFile(PWCHAR SourceFileName, FILE_SEQUENTIAL_ONLY); if(!NT_SUCCESS(Status)) { - DPRINT1("NtOpenFile failed: %x\n", Status); + DPRINT1("NtOpenFile failed: %x, %wZ\n", Status, &FileName); goto done; } #else diff --git a/base/setup/usetup/fslist.c b/base/setup/usetup/fslist.c index 88fa241a458..93db77c6da1 100644 --- a/base/setup/usetup/fslist.c +++ b/base/setup/usetup/fslist.c @@ -172,11 +172,11 @@ DrawFileSystemList( if (ListEntry == &List->Selected->ListEntry) CONSOLE_SetInvertedTextXY(List->Left, - List->Top + Index, + List->Top + (SHORT)Index, Buffer); else CONSOLE_SetTextXY(List->Left, - List->Top + Index, + List->Top + (SHORT)Index, Buffer); Index++; ListEntry = ListEntry->Flink; diff --git a/base/setup/usetup/inffile.c b/base/setup/usetup/inffile.c index 71c01088152..e2ea1b4f0c1 100644 --- a/base/setup/usetup/inffile.c +++ b/base/setup/usetup/inffile.c @@ -28,10 +28,6 @@ #include "usetup.h" -#ifdef __REACTOS__ -#include -#endif - #define NDEBUG #include @@ -75,7 +71,7 @@ InfpOpenInfFileW( Status = InfOpenFile( &hInf, &FileNameU, - LocaleId, + LANGIDFROMLCID(LocaleId), &ErrorLineUL); *ErrorLine = (UINT)ErrorLineUL; if (!NT_SUCCESS(Status)) @@ -197,7 +193,7 @@ INF_OpenBufferedFileA( &hInf, FileBuffer, FileSize, - LocaleId, + LANGIDFROMLCID(LocaleId), &ErrorLineUL); *ErrorLine = (UINT)ErrorLineUL; if (!NT_SUCCESS(Status)) diff --git a/base/setup/usetup/interface/devinst.c b/base/setup/usetup/interface/devinst.c index 8ea6444d2f0..0f3f1ed7fed 100644 --- a/base/setup/usetup/interface/devinst.c +++ b/base/setup/usetup/interface/devinst.c @@ -11,10 +11,6 @@ #define NDEBUG #include -#define INITGUID -#include -#include - BOOLEAN ResetDevice( IN LPCWSTR DeviceId) @@ -65,6 +61,8 @@ InstallDriver( /* Find associated driver name */ /* FIXME: check in other sections too! */ if (!SetupFindFirstLineW(hInf, L"BootBusExtenders.Load", Driver, &Context) + && !SetupFindFirstLineW(hInf, L"BusExtenders.Load", Driver, &Context) + && !SetupFindFirstLineW(hInf, L"SCSI.Load", Driver, &Context) && !SetupFindFirstLineW(hInf, L"Keyboard.Load", Driver, &Context)) return FALSE; if (!INF_GetDataField(&Context, 1, &ImagePath)) @@ -81,7 +79,7 @@ InstallDriver( RtlCopyMemory(FullImagePath, PathPrefix.Buffer, PathPrefix.MaximumLength); wcscat(FullImagePath, ImagePath); - DPRINT("Using driver '%S' for device '%S'\n", ImagePath, DeviceId); + DPRINT1("Using driver '%S' for device '%S'\n", ImagePath, DeviceId); /* Create service key */ RtlInitUnicodeString(&StringU, Driver); diff --git a/base/setup/usetup/interface/usetup.c b/base/setup/usetup/interface/usetup.c index e0f503e7503..4e551430f1a 100644 --- a/base/setup/usetup/interface/usetup.c +++ b/base/setup/usetup/interface/usetup.c @@ -2450,75 +2450,6 @@ FormatPartitionPage(PINPUT_RECORD Ir) CheckActiveBootPartition(PartitionList); } - if (wcscmp(FileSystemList->Selected->FileSystem, L"FAT") == 0) - { - /* FIXME: Install boot code. This is a hack! */ - if ((PartEntry->PartInfo[PartNum].PartitionType == PARTITION_FAT32_XINT13) || - (PartEntry->PartInfo[PartNum].PartitionType == PARTITION_FAT32)) - { - wcscpy(PathBuffer, SourceRootPath.Buffer); - wcscat(PathBuffer, L"\\loader\\fat32.bin"); - - DPRINT("Install FAT32 bootcode: %S ==> %S\n", PathBuffer, - DestinationRootPath.Buffer); - - Status = InstallFat32BootCodeToDisk(PathBuffer, - DestinationRootPath.Buffer); - if (!NT_SUCCESS(Status)) - { - DPRINT1("InstallFat32BootCodeToDisk() failed with status 0x%08lx\n", Status); - /* FIXME: show an error dialog */ - DestroyFileSystemList(FileSystemList); - FileSystemList = NULL; - return QUIT_PAGE; - } - } - else - { - wcscpy(PathBuffer, SourceRootPath.Buffer); - wcscat(PathBuffer, L"\\loader\\fat.bin"); - - DPRINT("Install FAT bootcode: %S ==> %S\n", PathBuffer, - DestinationRootPath.Buffer); - - Status = InstallFat16BootCodeToDisk(PathBuffer, - DestinationRootPath.Buffer); - if (!NT_SUCCESS(Status)) - { - DPRINT1("InstallFat16BootCodeToDisk() failed with status 0x%.08x\n", Status); - /* FIXME: show an error dialog */ - DestroyFileSystemList(FileSystemList); - FileSystemList = NULL; - return QUIT_PAGE; - } - } - } - else if (wcscmp(FileSystemList->Selected->FileSystem, L"EXT2") == 0) - { - wcscpy(PathBuffer, SourceRootPath.Buffer); - wcscat(PathBuffer, L"\\loader\\ext2.bin"); - - DPRINT("Install EXT2 bootcode: %S ==> %S\n", PathBuffer, - DestinationRootPath.Buffer); - - Status = InstallFat32BootCodeToDisk(PathBuffer, - DestinationRootPath.Buffer); - if (!NT_SUCCESS(Status)) - { - DPRINT1("InstallFat32BootCodeToDisk() failed with status 0x%08lx\n", Status); - /* FIXME: show an error dialog */ - DestroyFileSystemList(FileSystemList); - FileSystemList = NULL; - return QUIT_PAGE; - } - } - else if (FileSystemList->Selected->FormatFunc) - { - DestroyFileSystemList(FileSystemList); - FileSystemList = NULL; - return QUIT_PAGE; - } - #ifndef NDEBUG CONSOLE_SetStatusText(" Done. Press any key ..."); CONSOLE_ConInKey(Ir); diff --git a/base/setup/usetup/lang/pl-PL.h b/base/setup/usetup/lang/pl-PL.h index 7e3ad8aaf5a..97cf395ec73 100644 --- a/base/setup/usetup/lang/pl-PL.h +++ b/base/setup/usetup/lang/pl-PL.h @@ -266,7 +266,7 @@ static MUI_ENTRY plPLLicensePageEntries[] = { 8, 11, - "oprogramowanie, bdce czsci system ReactOS podlega wic", + "oprogramowanie, bdce czci systemu ReactOS podlega wic", TEXT_STYLE_NORMAL }, { @@ -332,7 +332,7 @@ static MUI_ENTRY plPLLicensePageEntries[] = { 8, 25, - "dotyczce kopiowania w rdach. Nie ma ADNEJ gwarancji", + "dotyczce kopiowania w rdach. Nie ma ADNEJ gwarancji", TEXT_STYLE_NORMAL }, { @@ -717,7 +717,7 @@ static MUI_ENTRY plPLSuccessPageEntries[] = { 10, 8, - "Upewnij si ze w Napdzie A: nie ma dyskietki i", + "Upewnij si e w Napdzie A: nie ma dyskietki i", TEXT_STYLE_NORMAL }, { @@ -902,7 +902,7 @@ static MUI_ENTRY plPLInstallDirectoryEntries[] = { 6, 9, - "katalog do ktrego chcesz zainstalowa system ReactOS:", + "katalog, do ktrego chcesz zainstalowa system ReactOS:", TEXT_STYLE_NORMAL }, { @@ -1334,7 +1334,7 @@ MUI_ERROR plPLErrorEntries[] = }, { //ERROR_LOAD_COMPUTER, - "Instalator nie mg zaadowa listy typw komputea\ra.\n", + "Instalator nie mg zaadowa listy typw komputera.\n", "ENTER = Restart komputera" }, { @@ -1415,7 +1415,7 @@ MUI_ERROR plPLErrorEntries[] = }, { //ERROR_INITIALIZE_REGISTRY, - "Instalator nie by w stanie ustawic inicjalizacji rejestru.", + "Instalator nie by w stanie ustawi inicjalizacji rejestru.", "ENTER = Restart komputera" }, { @@ -1617,7 +1617,7 @@ MUI_STRING plPLStrings[] = {STRING_CHOOSENEWPARTITION, "Wybrane: utworzenie nowej partycji na"}, {STRING_HDDSIZE, - "Prosz wprowadzi rozmiar nowej partycji, w megabajtach."}, + "Prosz wprowadzi rozmiar nowej partycji w megabajtach."}, {STRING_CREATEPARTITION, " ENTER = Utworzenie Partycji ESC = Anulowanie F3 = Wyjcie"}, {STRING_PARTFORMAT, @@ -1633,7 +1633,7 @@ MUI_STRING plPLStrings[] = {STRING_REBOOTCOMPUTER, "ENTER = Restart komputera"}, {STRING_TXTSETUPFAILED, - "Instalator nie by w stanie odnale sekji '%S'\nw pliku TXTSETUP.SIF.\n"}, + "Instalator nie by w stanie odnale sekcji '%S'\nw pliku TXTSETUP.SIF.\n"}, {STRING_COPYING, " Kopiowanie plikw: %S"}, {STRING_SETUPCOPYINGFILES, @@ -1651,15 +1651,15 @@ MUI_STRING plPLStrings[] = {STRING_CODEPAGEINFOUPDATE, " Dodawanie informacji o stronie kodowej do rejestru..."}, {STRING_DONE, - " Ukoczone..."}, + " Ukoczone..."}, {STRING_REBOOTCOMPUTER2, " ENTER = Restart komputera"}, {STRING_CONSOLEFAIL1, "Otwarcie konsoli nieudane\n\n"}, {STRING_CONSOLEFAIL2, - "Najczstsz tego przyczyn jest uycie klawiatury USB,\n"}, + "Najczstsz tego przyczyn jest uycie klawiatury USB.\n"}, {STRING_CONSOLEFAIL3, - "ktre nie s w peni obsugiwane.\n"}, + "Nie s obecnie w peni obsugiwane.\n"}, {STRING_FORMATTINGDISK, "Instalator formatuje twj dysk"}, {STRING_CHECKINGDISK, diff --git a/base/setup/usetup/mui.c b/base/setup/usetup/mui.c index 114ee8e10ae..1972b93d756 100644 --- a/base/setup/usetup/mui.c +++ b/base/setup/usetup/mui.c @@ -25,9 +25,6 @@ */ #include "usetup.h" -#include "interface/consup.h" -#include "errorcode.h" -#include "mui.h" #include "muifonts.h" #include "muilanguages.h" diff --git a/base/setup/usetup/native/fslist.c b/base/setup/usetup/native/fslist.c index b3ce5d452a3..e29a956a2a8 100644 --- a/base/setup/usetup/native/fslist.c +++ b/base/setup/usetup/native/fslist.c @@ -1,10 +1,5 @@ #include "usetup.h" -/* Filesystem headers */ -#include -#include -#include - BOOLEAN NATIVE_CreateFileSystemList( IN PFILE_SYSTEM_LIST List) diff --git a/base/setup/usetup/native/host_native.h b/base/setup/usetup/native/host_native.h index 207927c83eb..a44234b1248 100644 --- a/base/setup/usetup/native/host_native.h +++ b/base/setup/usetup/native/host_native.h @@ -2,12 +2,6 @@ #include "usetup.h" -typedef struct -{ - PWCHAR Source; - PWCHAR Target; -} *PFILEPATHS_W; - #define SetupInitDefaultQueueCallback(a) NULL #define SetupDefaultQueueCallbackW(a, b, c, d) TRUE #define SetupTermDefaultQueueCallback(a) diff --git a/base/setup/usetup/partlist.c b/base/setup/usetup/partlist.c index 52a0259d99e..5109cafef43 100644 --- a/base/setup/usetup/partlist.c +++ b/base/setup/usetup/partlist.c @@ -1612,7 +1612,7 @@ SelectPartition(PPARTLIST List, ULONG DiskNumber, ULONG PartitionNumber) PPARTENTRY PartEntry; PLIST_ENTRY Entry1; PLIST_ENTRY Entry2; - ULONG i; + UCHAR i; /* Check for empty disks */ if (IsListEmpty (&List->DiskListHead)) @@ -1965,7 +1965,7 @@ CreateNewPartition (PPARTLIST List, PartEntry->PartInfo[0].StartingOffset.QuadPart = PartEntry->UnpartitionedOffset + DiskEntry->TrackSize; PartEntry->PartInfo[0].HiddenSectors = - PartEntry->PartInfo[0].StartingOffset.QuadPart / DiskEntry->BytesPerSector; + (ULONG)(PartEntry->PartInfo[0].StartingOffset.QuadPart / DiskEntry->BytesPerSector); PartEntry->PartInfo[0].PartitionLength.QuadPart = PartEntry->UnpartitionedLength - DiskEntry->TrackSize; PartEntry->PartInfo[0].PartitionType = PARTITION_ENTRY_UNUSED; @@ -1996,7 +1996,7 @@ CreateNewPartition (PPARTLIST List, PrevPartEntry->PartInfo[1].StartingOffset.QuadPart = PartEntry->PartInfo[0].StartingOffset.QuadPart - DiskEntry->TrackSize; PrevPartEntry->PartInfo[1].HiddenSectors = - PrevPartEntry->PartInfo[1].StartingOffset.QuadPart / DiskEntry->BytesPerSector; + (ULONG)(PrevPartEntry->PartInfo[1].StartingOffset.QuadPart / DiskEntry->BytesPerSector); if (DiskEntry->PartListHead.Flink == &PrevPartEntry->ListEntry) { @@ -2024,7 +2024,7 @@ CreateNewPartition (PPARTLIST List, PrevPartEntry->PartInfo[1].StartingOffset.QuadPart = PartEntry->PartInfo[0].StartingOffset.QuadPart - DiskEntry->TrackSize; PrevPartEntry->PartInfo[1].HiddenSectors = - PrevPartEntry->PartInfo[1].StartingOffset.QuadPart / DiskEntry->BytesPerSector; + (ULONG)(PrevPartEntry->PartInfo[1].StartingOffset.QuadPart / DiskEntry->BytesPerSector); if (DiskEntry->PartListHead.Flink == &PrevPartEntry->ListEntry) { @@ -2081,7 +2081,7 @@ CreateNewPartition (PPARTLIST List, NewPartEntry->PartInfo[0].StartingOffset.QuadPart = PartEntry->UnpartitionedOffset + DiskEntry->TrackSize; NewPartEntry->PartInfo[0].HiddenSectors = - NewPartEntry->PartInfo[0].StartingOffset.QuadPart / DiskEntry->BytesPerSector; + (ULONG)(NewPartEntry->PartInfo[0].StartingOffset.QuadPart / DiskEntry->BytesPerSector); NewPartEntry->PartInfo[0].PartitionLength.QuadPart = PartitionSize - DiskEntry->TrackSize; NewPartEntry->PartInfo[0].PartitionType = PARTITION_ENTRY_UNUSED; @@ -2112,7 +2112,7 @@ CreateNewPartition (PPARTLIST List, PrevPartEntry->PartInfo[1].StartingOffset.QuadPart = NewPartEntry->PartInfo[0].StartingOffset.QuadPart - DiskEntry->TrackSize; PrevPartEntry->PartInfo[1].HiddenSectors = - PrevPartEntry->PartInfo[1].StartingOffset.QuadPart / DiskEntry->BytesPerSector; + (ULONG)(PrevPartEntry->PartInfo[1].StartingOffset.QuadPart / DiskEntry->BytesPerSector); if (DiskEntry->PartListHead.Flink == &PrevPartEntry->ListEntry) { @@ -2140,7 +2140,7 @@ CreateNewPartition (PPARTLIST List, PrevPartEntry->PartInfo[1].StartingOffset.QuadPart = NewPartEntry->PartInfo[0].StartingOffset.QuadPart - DiskEntry->TrackSize; PrevPartEntry->PartInfo[1].HiddenSectors = - PrevPartEntry->PartInfo[1].StartingOffset.QuadPart / DiskEntry->BytesPerSector; + (ULONG)(PrevPartEntry->PartInfo[1].StartingOffset.QuadPart / DiskEntry->BytesPerSector); if (DiskEntry->PartListHead.Flink == &PrevPartEntry->ListEntry) { @@ -2495,7 +2495,6 @@ WritePartitionsToDisk (PPARTLIST List) PDRIVE_LAYOUT_INFORMATION DriveLayout; OBJECT_ATTRIBUTES ObjectAttributes; IO_STATUS_BLOCK Iosb; - WCHAR SrcPath[MAX_PATH]; WCHAR DstPath[MAX_PATH]; UNICODE_STRING Name; HANDLE FileHandle; @@ -2689,30 +2688,6 @@ WritePartitionsToDisk (PPARTLIST List) DriveLayout); NtClose (FileHandle); - - /* Install MBR code if the disk is new */ - if (DiskEntry1->NewDisk == TRUE && - DiskEntry1->BiosDiskNumber == 0) - { - wcscpy (SrcPath, SourceRootPath.Buffer); - wcscat (SrcPath, L"\\loader\\dosmbr.bin"); - - DPRINT ("Install MBR bootcode: %S ==> %S\n", - SrcPath, DstPath); - - /* Install MBR bootcode */ - Status = InstallMbrBootCodeToDisk (SrcPath, - DstPath); - if (!NT_SUCCESS (Status)) - { - DPRINT1 ("InstallMbrBootCodeToDisk() failed (Status %lx)\n", - Status); - return FALSE; - } - - DiskEntry1->NewDisk = FALSE; - DiskEntry1->NoMbr = FALSE; - } } Entry1 = Entry1->Flink; diff --git a/base/setup/usetup/progress.c b/base/setup/usetup/progress.c index acd6f8559a1..55433819877 100644 --- a/base/setup/usetup/progress.c +++ b/base/setup/usetup/progress.c @@ -290,75 +290,7 @@ ProgressSetStepCount(PPROGRESSBAR Bar, VOID ProgressNextStep(PPROGRESSBAR Bar) { - CHAR TextBuffer[8]; - COORD coPos; - DWORD Written; - ULONG NewPercent; - ULONG NewPos; - - if ((Bar->StepCount == 0) || - (Bar->CurrentStep == Bar->StepCount)) - return; - - Bar->CurrentStep++; - - /* Calculate new percentage */ - NewPercent = (ULONG)(((100.0 * (float)Bar->CurrentStep) / (float)Bar->StepCount) + 0.5); - - /* Redraw precentage if changed */ - if (Bar->Percent != NewPercent) - { - Bar->Percent = NewPercent; - - sprintf(TextBuffer, "%-3lu%%", Bar->Percent); - - coPos.X = Bar->Left + (Bar->Width - 2) / 2; - coPos.Y = Bar->Top; - WriteConsoleOutputCharacterA(StdOutput, - TextBuffer, - 4, - coPos, - &Written); - } - - /* Calculate bar position */ - NewPos = (ULONG)((((float)(Bar->Width - 2) * 2.0 * (float)Bar->CurrentStep) / (float)Bar->StepCount) + 0.5); - - /* Redraw bar if changed */ - if (Bar->Pos != NewPos) - { - Bar->Pos = NewPos; - - for (coPos.Y = Bar->Top + 2; coPos.Y <= Bar->Bottom - 1; coPos.Y++) - { - coPos.X = Bar->Left + 1; - FillConsoleOutputCharacterA(StdOutput, - 0xDB, - Bar->Pos / 2, - coPos, - &Written); - coPos.X += Bar->Pos/2; - - if (NewPos & 1) - { - FillConsoleOutputCharacterA(StdOutput, - 0xDD, - 1, - coPos, - &Written); - coPos.X++; - } - - if (coPos.X <= Bar->Right - 1) - { - FillConsoleOutputCharacterA(StdOutput, - ' ', - Bar->Right - coPos.X, - coPos, - &Written); - } - } - } + ProgressSetStep(Bar, Bar->CurrentStep + 1); } diff --git a/base/setup/usetup/progress.h b/base/setup/usetup/progress.h index 53af83db6d9..630967d24d1 100644 --- a/base/setup/usetup/progress.h +++ b/base/setup/usetup/progress.h @@ -38,7 +38,7 @@ typedef struct _PROGRESS SHORT Width; ULONG Percent; - ULONG Pos; + SHORT Pos; ULONG StepCount; ULONG CurrentStep; diff --git a/base/setup/usetup/registry.c b/base/setup/usetup/registry.c index c5951762d28..7cd06724e5f 100644 --- a/base/setup/usetup/registry.c +++ b/base/setup/usetup/registry.c @@ -398,8 +398,7 @@ CreateNestedKey (PHANDLE KeyHandle, UNICODE_STRING LocalKeyName; ULONG Disposition; NTSTATUS Status; - ULONG FullNameLength; - ULONG Length; + USHORT FullNameLength; PWCHAR Ptr; HANDLE LocalKeyHandle; @@ -421,7 +420,7 @@ CreateNestedKey (PHANDLE KeyHandle, RtlCreateUnicodeString (&LocalKeyName, ObjectAttributes->ObjectName->Buffer); LocalObjectAttributes.ObjectName = &LocalKeyName; - FullNameLength = LocalKeyName.Length / sizeof(WCHAR); + FullNameLength = LocalKeyName.Length; /* Remove the last part of the key name and try to create the key again. */ while (Status == STATUS_OBJECT_NAME_NOT_FOUND) @@ -452,10 +451,9 @@ CreateNestedKey (PHANDLE KeyHandle, } /* Add removed parts of the key name and create them too. */ - Length = wcslen (LocalKeyName.Buffer); while (TRUE) { - if (Length == FullNameLength) + if (LocalKeyName.Length == FullNameLength) { Status = STATUS_SUCCESS; *KeyHandle = LocalKeyHandle; @@ -463,9 +461,8 @@ CreateNestedKey (PHANDLE KeyHandle, } NtClose (LocalKeyHandle); - LocalKeyName.Buffer[Length] = L'\\'; - Length = wcslen (LocalKeyName.Buffer); - LocalKeyName.Length = Length * sizeof(WCHAR); + LocalKeyName.Buffer[LocalKeyName.Length / sizeof(WCHAR)] = L'\\'; + LocalKeyName.Length = wcslen (LocalKeyName.Buffer) * sizeof(WCHAR); Status = NtCreateKey (&LocalKeyHandle, KEY_ALL_ACCESS, diff --git a/base/setup/usetup/settings.c b/base/setup/usetup/settings.c index 90fd2634585..f4710189f4f 100644 --- a/base/setup/usetup/settings.c +++ b/base/setup/usetup/settings.c @@ -33,6 +33,143 @@ /* FUNCTIONS ****************************************************************/ +static BOOLEAN +IsAcpiComputer(VOID) +{ + UNICODE_STRING MultiKeyPathU = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\HARDWARE\\DESCRIPTION\\System\\MultifunctionAdapter"); + UNICODE_STRING IdentifierU = RTL_CONSTANT_STRING(L"Identifier"); + UNICODE_STRING AcpiBiosIdentifier = RTL_CONSTANT_STRING(L"ACPI BIOS"); + OBJECT_ATTRIBUTES ObjectAttributes; + PKEY_BASIC_INFORMATION pDeviceInformation = NULL; + ULONG DeviceInfoLength = sizeof(KEY_BASIC_INFORMATION) + 50 * sizeof(WCHAR); + PKEY_VALUE_PARTIAL_INFORMATION pValueInformation = NULL; + ULONG ValueInfoLength = sizeof(KEY_VALUE_PARTIAL_INFORMATION) + 50 * sizeof(WCHAR); + ULONG RequiredSize; + ULONG IndexDevice = 0; + UNICODE_STRING DeviceName, ValueName; + HANDLE hDevicesKey = NULL; + HANDLE hDeviceKey = NULL; + NTSTATUS Status; + BOOLEAN ret = FALSE; + + InitializeObjectAttributes(&ObjectAttributes, &MultiKeyPathU, OBJ_CASE_INSENSITIVE, NULL, NULL); + Status = NtOpenKey(&hDevicesKey, KEY_ENUMERATE_SUB_KEYS, &ObjectAttributes); + if (!NT_SUCCESS(Status)) + { + DPRINT("NtOpenKey() failed with status 0x%08lx\n", Status); + goto cleanup; + } + + pDeviceInformation = RtlAllocateHeap(RtlGetProcessHeap(), 0, DeviceInfoLength); + if (!pDeviceInformation) + { + DPRINT("RtlAllocateHeap() failed\n"); + Status = STATUS_NO_MEMORY; + goto cleanup; + } + + pValueInformation = RtlAllocateHeap(RtlGetProcessHeap(), 0, ValueInfoLength); + if (!pDeviceInformation) + { + DPRINT("RtlAllocateHeap() failed\n"); + Status = STATUS_NO_MEMORY; + goto cleanup; + } + + while (TRUE) + { + Status = NtEnumerateKey(hDevicesKey, IndexDevice, KeyBasicInformation, pDeviceInformation, DeviceInfoLength, &RequiredSize); + if (Status == STATUS_NO_MORE_ENTRIES) + break; + else if (Status == STATUS_BUFFER_OVERFLOW || Status == STATUS_BUFFER_TOO_SMALL) + { + RtlFreeHeap(RtlGetProcessHeap(), 0, pDeviceInformation); + DeviceInfoLength = RequiredSize; + pDeviceInformation = RtlAllocateHeap(RtlGetProcessHeap(), 0, DeviceInfoLength); + if (!pDeviceInformation) + { + DPRINT("RtlAllocateHeap() failed\n"); + Status = STATUS_NO_MEMORY; + goto cleanup; + } + Status = NtEnumerateKey(hDevicesKey, IndexDevice, KeyBasicInformation, pDeviceInformation, DeviceInfoLength, &RequiredSize); + } + if (!NT_SUCCESS(Status)) + { + DPRINT("NtEnumerateKey() failed with status 0x%08lx\n", Status); + goto cleanup; + } + IndexDevice++; + + /* Open device key */ + DeviceName.Length = DeviceName.MaximumLength = pDeviceInformation->NameLength; + DeviceName.Buffer = pDeviceInformation->Name; + InitializeObjectAttributes(&ObjectAttributes, &DeviceName, OBJ_CASE_INSENSITIVE, hDevicesKey, NULL); + Status = NtOpenKey( + &hDeviceKey, + KEY_QUERY_VALUE, + &ObjectAttributes); + if (!NT_SUCCESS(Status)) + { + DPRINT("NtOpenKey() failed with status 0x%08lx\n", Status); + goto cleanup; + } + + /* Read identifier */ + Status = NtQueryValueKey(hDeviceKey, &IdentifierU, KeyValuePartialInformation, pValueInformation, ValueInfoLength, &RequiredSize); + if (Status == STATUS_BUFFER_OVERFLOW || Status == STATUS_BUFFER_TOO_SMALL) + { + RtlFreeHeap(RtlGetProcessHeap(), 0, pValueInformation); + ValueInfoLength = RequiredSize; + pValueInformation = RtlAllocateHeap(RtlGetProcessHeap(), 0, ValueInfoLength); + if (!pValueInformation) + { + DPRINT("RtlAllocateHeap() failed\n"); + Status = STATUS_NO_MEMORY; + goto cleanup; + } + Status = NtQueryValueKey(hDeviceKey, &IdentifierU, KeyValuePartialInformation, pValueInformation, ValueInfoLength, &RequiredSize); + } + if (!NT_SUCCESS(Status)) + { + DPRINT("NtQueryValueKey() failed with status 0x%08lx\n", Status); + goto nextdevice; + } + else if (pValueInformation->Type != REG_SZ) + { + DPRINT("Wrong registry type: got 0x%lx, expected 0x%lx\n", pValueInformation->Type, REG_SZ); + goto nextdevice; + } + + ValueName.Length = ValueName.MaximumLength = pValueInformation->DataLength; + ValueName.Buffer = (PWCHAR)pValueInformation->Data; + if (ValueName.Length >= sizeof(WCHAR) && ValueName.Buffer[ValueName.Length / sizeof(WCHAR) - 1] == UNICODE_NULL) + ValueName.Length -= sizeof(WCHAR); + if (RtlCompareUnicodeString(&ValueName, &AcpiBiosIdentifier, FALSE) == 0) + { + DPRINT("Found ACPI BIOS\n"); + ret = TRUE; + goto cleanup; + } + +nextdevice: + NtClose(hDeviceKey); + hDeviceKey = NULL; + } + +cleanup: + if (pDeviceInformation) + RtlFreeHeap(RtlGetProcessHeap(), 0, pDeviceInformation); + if (pValueInformation) + RtlFreeHeap(RtlGetProcessHeap(), 0, pValueInformation); + if (hDevicesKey) + NtClose(hDevicesKey); + if (hDeviceKey) + NtClose(hDeviceKey); + return ret; +} + + static BOOLEAN GetComputerIdentifier(PWSTR Identifier, ULONG IdentifierLength) @@ -98,15 +235,31 @@ GetComputerIdentifier(PWSTR Identifier, return FALSE; } - if (pFullInfo->SubKeys == 1) + if (IsAcpiComputer()) { - /* Computer is mono-CPU */ - ComputerIdentifier = L"PC UP"; + if (pFullInfo->SubKeys == 1) + { + /* Computer is mono-CPU */ + ComputerIdentifier = L"ACPI UP"; + } + else + { + /* Computer is multi-CPUs */ + ComputerIdentifier = L"ACPI MP"; + } } else { - /* Computer is multi-CPUs */ - ComputerIdentifier = L"PC MP"; + if (pFullInfo->SubKeys == 1) + { + /* Computer is mono-CPU */ + ComputerIdentifier = L"PC UP"; + } + else + { + /* Computer is multi-CPUs */ + ComputerIdentifier = L"PC MP"; + } } RtlFreeHeap(RtlGetProcessHeap(), 0, pFullInfo); diff --git a/base/setup/usetup/usetup.h b/base/setup/usetup/usetup.h index b6f887a20d5..9193ec38a11 100644 --- a/base/setup/usetup/usetup.h +++ b/base/setup/usetup/usetup.h @@ -24,8 +24,6 @@ * PROGRAMMER: Eric Kohl */ -#pragma once - /* C Headers */ #include #include @@ -35,11 +33,21 @@ #define WIN32_NO_STATUS #include #define NTOS_MODE_USER -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include -/* VFAT */ +/* Filesystem headers */ +#include #include +#include /* DDK Disk Headers */ #include @@ -50,11 +58,11 @@ /* Internal Headers */ #include "interface/consup.h" #include "partlist.h" -#include "infros.h" #include "inffile.h" #include "inicache.h" #include "progress.h" #ifdef __REACTOS__ +#include "infros.h" #include "filequeue.h" #endif #include "bootsup.h" @@ -71,6 +79,12 @@ #include "mui.h" #include "errorcode.h" +#define INITGUID +#include +#include + +#include + extern HANDLE ProcessHeap; extern UNICODE_STRING SourceRootPath; extern UNICODE_STRING SourceRootDir; @@ -108,6 +122,8 @@ extern BOOLEAN InfGetStringField(PINFCONTEXT Context, #endif /* __REACTOS__ */ +#ifndef _PAGE_NUMBER_DEFINED +#define _PAGE_NUMBER_DEFINED typedef enum _PAGE_NUMBER { START_PAGE, @@ -148,6 +164,7 @@ typedef enum _PAGE_NUMBER FLUSH_PAGE, REBOOT_PAGE, /* virtual page */ } PAGE_NUMBER, *PPAGE_NUMBER; +#endif #define POPUP_WAIT_NONE 0 #define POPUP_WAIT_ANY_KEY 1 diff --git a/base/setup/vmwinst/CMakeLists.txt b/base/setup/vmwinst/CMakeLists.txt index 975d16d5dc4..e094f60d884 100644 --- a/base/setup/vmwinst/CMakeLists.txt +++ b/base/setup/vmwinst/CMakeLists.txt @@ -1,5 +1,6 @@ set_unicode() +set_rc_compiler() add_executable(vmwinst vmwinst.c vmwinst.rc) diff --git a/base/setup/vmwinst/lang/ru-RU.rc b/base/setup/vmwinst/lang/ru-RU.rc index 303dbeb17fd..e72ff7cc890 100644 --- a/base/setup/vmwinst/lang/ru-RU.rc +++ b/base/setup/vmwinst/lang/ru-RU.rc @@ -2,24 +2,24 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT IDD_WELCOMEPAGE DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Установка видеодрайвера" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT " , ReactOS VMware(r).", -1, 117, 8, 140, 24 - LTEXT " SVGA- VMware(r) """", """".", -1, 117, 125, 140, 22 + LTEXT "Программа установки обнаружила, что ReactOS работает под управлением виртуальной машины VMware(r).", -1, 117, 8, 140, 24 + LTEXT "Для установки SVGA-драйвера VMware(r) нажмите кнопку ""Далее"", иначе нажмите ""Отмена"".", -1, 117, 125, 140, 22 END IDD_INSERT_VMWARE_TOOLS DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Установка видеодрайвера" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT " ReactOS SVGA- VMware(r).\n\n 'VM' VMware(r) Workstation 'Install VMware tools...'\n\n\n """", """", SVGA-.",-1,25,25,225,85 + LTEXT "Программа установки ReactOS не включает в себя SVGA-драйвер VMware(r).\n\nСледуйте в меню 'VM' программы VMware(r) Workstation и выберите 'Install VMware tools...'\n\n\nДля продолжения нажмите кнопку ""Далее"", или ""Отмена"", чтобы пропустить установку SVGA-драйвера.",-1,25,25,225,85 END IDD_INSTALLING_VMWARE_TOOLS DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Установка видеодрайвера" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN LTEXT "{STATUS}",IDC_INSTALLINGSTATUS,25,68,225,8 @@ -28,10 +28,10 @@ END IDD_CONFIG DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Установка видеодрайвера" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT " SVGA- VMware(r) . :",-1,25,5,225,20 + LTEXT "Установка SVGA-драйвера VMware(r) завершена успешно. Выберите предпочтительное разрешение экрана:",-1,25,5,225,20 PUSHBUTTON "640x480", 1120, 25, 30, 65, 15, BS_AUTORADIOBUTTON PUSHBUTTON "800x600", 1400, 25, 45, 65, 15, BS_AUTORADIOBUTTON PUSHBUTTON "1024x768", 1792, 25, 60, 65, 15, BS_AUTORADIOBUTTON @@ -43,89 +43,89 @@ BEGIN PUSHBUTTON "1792x1344", 3136, 195, 30, 65, 15, BS_AUTORADIOBUTTON PUSHBUTTON "1856x1392", 3248, 195, 45, 65, 15, BS_AUTORADIOBUTTON PUSHBUTTON "1920x1440", 3360, 195, 60, 50, 15, BS_AUTORADIOBUTTON - LTEXT " :", -1, 25, 93, 225, 12 + LTEXT "Выберите качество передачи цвета:", -1, 25, 93, 225, 12 COMBOBOX IDC_COLORQUALITY, 25, 105, 75, 80, CBS_DROPDOWNLIST | WS_TABSTOP END IDD_INSTALLATION_FAILED DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Установка видеодрайвера" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT " ReactOS SVGA- VMware(r).\n\n\n """" .",-1,25,25,225,85 + LTEXT "Программа установки ReactOS не смогла установить SVGA-драйвер VMware(r).\n\n\nНажмите кнопку ""Завершить"" для продолжения процесса установки.",-1,25,25,225,85 END IDD_CHOOSEACTION DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Установка видеодрайвера" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT "SVGA- VMware(r) .\n\n :",-1,25,5,225,30 - PUSHBUTTON " ", IDC_CONFIGSETTINGS, 25, 40, 200, 15, BS_AUTORADIOBUTTON - PUSHBUTTON " ", IDC_USEOTHERDRIVER, 25, 55, 200, 15, BS_AUTORADIOBUTTON - PUSHBUTTON " SVGA- VMware(r)", IDC_UNINSTALL, 25, 70, 200, 15, BS_AUTORADIOBUTTON - LTEXT " """" """" .", -1, 25, 93, 225, 20 + LTEXT "SVGA-драйвер VMware(r) уже установлен.\n\nВыберите дальнейшее действие:",-1,25,5,225,30 + PUSHBUTTON "Настроить параметры экрана", IDC_CONFIGSETTINGS, 25, 40, 200, 15, BS_AUTORADIOBUTTON + PUSHBUTTON "Установить другой графический драйвер", IDC_USEOTHERDRIVER, 25, 55, 200, 15, BS_AUTORADIOBUTTON + PUSHBUTTON "Удалить SVGA-драйвер VMware(r)", IDC_UNINSTALL, 25, 70, 200, 15, BS_AUTORADIOBUTTON + LTEXT "Нажмите кнопку ""Далее"" для продолжения или ""Отмена"" для выхода из мастера установки.", -1, 25, 93, 225, 20 END IDD_SELECTDRIVER DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Установка видеодрайвера" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT " , :",-1,25,25,225,15 - PUSHBUTTON "ReactOS VGA ", IDC_VGA, 25, 40, 225, 15, BS_AUTORADIOBUTTON - PUSHBUTTON "ReactOS VBE (SVGA)", IDC_VBE, 25, 55, 225, 15, BS_AUTORADIOBUTTON - LTEXT " """" """" .", -1, 25, 93, 225, 30 + LTEXT "Выберите графический драйвер, который Вы хотели бы использовать:",-1,25,25,225,15 + PUSHBUTTON "ReactOS VGA драйвер", IDC_VGA, 25, 40, 225, 15, BS_AUTORADIOBUTTON + PUSHBUTTON "ReactOS VBE драйвер (SVGA)", IDC_VBE, 25, 55, 225, 15, BS_AUTORADIOBUTTON + LTEXT "Нажмите кнопку ""Завершить"" для выполнения операции или ""Отмена"" для выхода из программы установки без сохранения изменений.", -1, 25, 93, 225, 30 END IDD_DOUNINSTALL DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Установка видеодрайвера" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT " ReactOS SVGA- VMWare(r)!\n\n\n """" """" .",-1,25,25,225,85 + LTEXT "Программа установки ОС ReactOS готова произвести удаление SVGA-драйвера VMWare(r)!\n\n\nНажмите кнопку ""Завершить"" для удаления драйвера или ""Отмена"" чтобы оставить драйвер.",-1,25,25,225,85 END STRINGTABLE BEGIN - IDS_WIZARD_NAME " VMware(r)" - IDS_FAILEDTOLOCATEDRIVERS " ReactOS .\n, VMware(r) tools CD-ROM ." - IDS_FAILEDTOCOPYFILES " ReactOS .\n, VMware(r) tools CD-ROM .\n" - IDS_FAILEDTOACTIVATEDRIVER " SVGA- VMware(r)!" - IDS_FAILEDTOSELVGADRIVER " ReactOS VGA !" - IDS_FAILEDTOSELVBEDRIVER " ReactOS VBE !" - IDS_UNINSTNOTICE " SVGA- VMware(r) .\n ." - IDS_FAILEDTOADDREGENTRIES " SVGA- VMware(r)!" + IDS_WIZARD_NAME "Обнаружен VMware(r)" + IDS_FAILEDTOLOCATEDRIVERS "Программа установки ReactOS не смогла найти необходимые файлы.\nУбедитесь, что VMware(r) tools CD-ROM вставлен в привод." + IDS_FAILEDTOCOPYFILES "Программа установки ReactOS не смогла скопировать необходимые файлы.\nУбедитесь, что VMware(r) tools CD-ROM вставлен в привод.\n" + IDS_FAILEDTOACTIVATEDRIVER "Не удалось запустить SVGA-драйвер VMware(r)!" + IDS_FAILEDTOSELVGADRIVER "Не удалось запустить ReactOS VGA драйвер!" + IDS_FAILEDTOSELVBEDRIVER "Не удалось запустить ReactOS VBE драйвер!" + IDS_UNINSTNOTICE "Файлы SVGA-драйвера VMware(r) не были удалены.\nУдалите их самостоятельно после перезагрузки системы." + IDS_FAILEDTOADDREGENTRIES "Не удалось создать записи в реестре для SVGA-драйвера VMware(r)!" END STRINGTABLE BEGIN - 10001 " (8BPP)" - 10002 " (16BPP)" - 10003 " (32BPP)" + 10001 "Низкое (8BPP)" + 10002 "Среднее (16BPP)" + 10003 "Самое высокое (32BPP)" END STRINGTABLE BEGIN - IDS_SEARCHINGFORCDROM " - VMware(r) Tools..." - IDS_COPYINGFILES " ..." - IDS_ENABLINGDRIVER " SVGA- VMware(r)..." + IDS_SEARCHINGFORCDROM "Поиск компакт-диска VMware(r) Tools..." + IDS_COPYINGFILES "Копирование файлов..." + IDS_ENABLINGDRIVER "Запуск SVGA-драйвера VMware(r)..." END STRINGTABLE BEGIN - IDD_INSERT_VMWARE_TOOLSTITLE " SVGA- VMware (r)" - IDD_INSERT_VMWARE_TOOLSSUBTITLE " VMware tools." - IDD_INSTALLING_VMWARE_TOOLSTITLE " SVGA- VMware (r)" - IDD_INSTALLING_VMWARE_TOOLSSUBTITLE " SVGA- VMware (r)." - IDD_CONFIGTITLE " SVGA- VMware (r)" - IDD_CONFIGSUBTITLE " ." - IDD_INSTALLATION_FAILEDTITLE " SVGA- VMware (r)" - IDD_INSTALLATION_FAILEDSUBTITLE " SVGA- VMware (r) ." - IDD_CHOOSEACTIONTITLE " SVGA- VMware (r)" - IDD_CHOOSEACTIONSUBTITLE " ." - IDD_SELECTDRIVERTITLE " SVGA- VMware (r)" - IDD_SELECTDRIVERSUBTITLE " ." - IDD_DOUNINSTALLTITLE " SVGA- VMware (r)" - IDD_DOUNINSTALLSUBTITLE " ." + IDD_INSERT_VMWARE_TOOLSTITLE "Мастер установки SVGA-драйвера VMware (r)" + IDD_INSERT_VMWARE_TOOLSSUBTITLE "Вставьте диск VMware tools." + IDD_INSTALLING_VMWARE_TOOLSTITLE "Мастер установки SVGA-драйвера VMware (r)" + IDD_INSTALLING_VMWARE_TOOLSSUBTITLE "Поиск и копирование SVGA-драйвера VMware (r)." + IDD_CONFIGTITLE "Мастер установки SVGA-драйвера VMware (r)" + IDD_CONFIGSUBTITLE "Выберите предпочитаемое разрешение экрана." + IDD_INSTALLATION_FAILEDTITLE "Мастер установки SVGA-драйвера VMware (r)" + IDD_INSTALLATION_FAILEDSUBTITLE "Установка SVGA-драйвера VMware (r) не удалась." + IDD_CHOOSEACTIONTITLE "Мастер установки SVGA-драйвера VMware (r)" + IDD_CHOOSEACTIONSUBTITLE "Выберите действие." + IDD_SELECTDRIVERTITLE "Мастер установки SVGA-драйвера VMware (r)" + IDD_SELECTDRIVERSUBTITLE "Выберите драйвер." + IDD_DOUNINSTALLTITLE "Мастер установки SVGA-драйвера VMware (r)" + IDD_DOUNINSTALLSUBTITLE "Удаление драйвера." END diff --git a/base/setup/vmwinst/lang/uk-UA.rc b/base/setup/vmwinst/lang/uk-UA.rc index f7178e79aa7..801af7ce0d3 100644 --- a/base/setup/vmwinst/lang/uk-UA.rc +++ b/base/setup/vmwinst/lang/uk-UA.rc @@ -10,24 +10,24 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT IDD_WELCOMEPAGE DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Встановлення відеодрайвера" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT " ReactOS , ReactOS VMware(r).", -1, 117, 8, 140, 24 - LTEXT " SVGA VMware(r), """", """".", -1, 117, 140, 140, 24 + LTEXT "Програма встановлення ReactOS виявила, що Ви запустили ReactOS всередені VMware(r).", -1, 117, 8, 140, 24 + LTEXT "Якщо Ви бажаєте встановити SVGA драйвер VMware(r), натисніть ""Далі"", інакше натисніть ""Скасувати"".", -1, 117, 140, 140, 24 END IDD_INSERT_VMWARE_TOOLS DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Встановлення відеодрайвера" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT " ReactOS SVGA VMware(r).\n\n ""VM"" VMware(r) workstation ""Install VMware tools...""\n\n\n """" """", SVGA .",-1,25,25,225,85 + LTEXT "Програма встановлення ReactOS не включає SVGA драйвер VMware(r).\n\nТому йдіть до меню ""VM"" у VMware(r) workstation і виберіть ""Install VMware tools...""\n\n\nНатисніть ""Далі"" для продовження або ""Скасувати"", щоб пропустити встановлення SVGA драйвера.",-1,25,25,225,85 END IDD_INSTALLING_VMWARE_TOOLS DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Встановлення відеодрайвера" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN LTEXT "{STATUS}",IDC_INSTALLINGSTATUS,25,68,225,8 @@ -36,10 +36,10 @@ END IDD_CONFIG DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Встановлення відеодрайвера" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT " SVGA VMware(r) . :",-1,25,5,225,20 + LTEXT "Встановлення SVGA драйвера VMware(r) завершено успішно. Оберіть потрібну роздільну здатність екрану:",-1,25,5,225,20 PUSHBUTTON "640x480", 1120, 25, 30, 65, 15, BS_AUTORADIOBUTTON PUSHBUTTON "800x600", 1400, 25, 45, 65, 15, BS_AUTORADIOBUTTON PUSHBUTTON "1024x768", 1792, 25, 60, 65, 15, BS_AUTORADIOBUTTON @@ -51,89 +51,89 @@ BEGIN PUSHBUTTON "1792x1344", 3136, 195, 30, 65, 15, BS_AUTORADIOBUTTON PUSHBUTTON "1856x1392", 3248, 195, 45, 65, 15, BS_AUTORADIOBUTTON PUSHBUTTON "1920x1440", 3360, 195, 60, 50, 15, BS_AUTORADIOBUTTON - LTEXT " :", -1, 25, 93, 225, 12 + LTEXT "Будь ласка оберіть якість передачі кольору:", -1, 25, 93, 225, 12 COMBOBOX IDC_COLORQUALITY, 25, 105, 75, 80, CBS_DROPDOWNLIST | WS_TABSTOP END IDD_INSTALLATION_FAILED DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Встановлення відеодрайвера" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT " ReactOS SVGA VMware(r).\n\n\n """" .",-1,25,25,225,85 + LTEXT "Програма встановлення ReactOS не змогла встановити SVGA драйвер VMware(r).\n\n\nНатисніть ""Завершити"" для продовження процесу встановлення.",-1,25,25,225,85 END IDD_CHOOSEACTION DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Встановлення відеодрайвера" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT "SVGA VMware(r) SVGA .\n\n, :",-1,25,5,225,30 - PUSHBUTTON " ", IDC_CONFIGSETTINGS, 25, 40, 200, 15, BS_AUTORADIOBUTTON - PUSHBUTTON " ", IDC_USEOTHERDRIVER, 25, 55, 200, 15, BS_AUTORADIOBUTTON - PUSHBUTTON " SVGA VMware(r)", IDC_UNINSTALL, 25, 70, 200, 15, BS_AUTORADIOBUTTON - LTEXT " """" """" .", -1, 25, 93, 225, 17 + LTEXT "SVGA драйвер VMware(r) SVGA вже встановлений.\n\nОберіть, що Ви хочете зробити:",-1,25,5,225,30 + PUSHBUTTON "Налаштувати параметри екрану", IDC_CONFIGSETTINGS, 25, 40, 200, 15, BS_AUTORADIOBUTTON + PUSHBUTTON "Скористатися іншим графічним драйвером", IDC_USEOTHERDRIVER, 25, 55, 200, 15, BS_AUTORADIOBUTTON + PUSHBUTTON "Видалити SVGA драйвер VMware(r)", IDC_UNINSTALL, 25, 70, 200, 15, BS_AUTORADIOBUTTON + LTEXT "Натисніть ""Далі"" для продовження або ""Скасувати"" для виходу з майстра.", -1, 25, 93, 225, 17 END IDD_SELECTDRIVER DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Встановлення відеодрайвера" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT " , :",-1,25,25,225,15 - PUSHBUTTON "ReactOS VGA ", IDC_VGA, 25, 40, 225, 15, BS_AUTORADIOBUTTON - PUSHBUTTON "ReactOS VBE (SVGA)", IDC_VBE, 25, 55, 225, 15, BS_AUTORADIOBUTTON - LTEXT " """" """" .", -1, 25, 93, 225, 20 + LTEXT "Будь ласка оберіть графічний драйвер, який Ви хотіли б використовувати:",-1,25,25,225,15 + PUSHBUTTON "ReactOS VGA драйвер", IDC_VGA, 25, 40, 225, 15, BS_AUTORADIOBUTTON + PUSHBUTTON "ReactOS VBE драйвер (SVGA)", IDC_VBE, 25, 55, 225, 15, BS_AUTORADIOBUTTON + LTEXT "Натисніть ""Завершити"" для завершення операції або ""Скасувати"" для виходу з програми встановлення без збереження змін.", -1, 25, 93, 225, 20 END IDD_DOUNINSTALL DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Встановлення відеодрайвера" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT " ReactOS SVGA VMWare(r)!!!\n\n\n """" """" .",-1,25,25,225,85 + LTEXT "Програма встановлення ReactOS готова видалити SVGA драйвер VMWare(r)!!!\n\n\nНатисніть ""Завершити"" для видалення драйвера або ""Скасувати"" щоб залишити його як є.",-1,25,25,225,85 END STRINGTABLE BEGIN - IDS_WIZARD_NAME " VMware(r)" - IDS_FAILEDTOLOCATEDRIVERS " ReactOS .\n, CD-ROM VMware(r) tools ." - IDS_FAILEDTOCOPYFILES " ReactOS .\n, CD-ROM VMware(r) tools .\n" - IDS_FAILEDTOACTIVATEDRIVER " SVGA VMware(r)!" - IDS_FAILEDTOSELVGADRIVER " ReactOS VGA !" - IDS_FAILEDTOSELVBEDRIVER " ReactOS VBE !" - IDS_UNINSTNOTICE " SVGA VMware(r) .\n ." - IDS_FAILEDTOADDREGENTRIES " SVGA VMware(r)!" + IDS_WIZARD_NAME "Виявлений VMware(r)" + IDS_FAILEDTOLOCATEDRIVERS "Програма встановлення ReactOS не змогла знайти необхідні файли.\nПереконайтеся, що CD-ROM VMware(r) tools вставлений." + IDS_FAILEDTOCOPYFILES "Програма встановлення ReactOS не змогла скопіювати необхідні файли.\nПереконайтеся, що CD-ROM VMware(r) tools вставлений.\n" + IDS_FAILEDTOACTIVATEDRIVER "Не вдалося запустити SVGA драйвер VMware(r)!" + IDS_FAILEDTOSELVGADRIVER "Не вдалося запустити ReactOS VGA драйвер!" + IDS_FAILEDTOSELVBEDRIVER "Не вдалося запустити ReactOS VBE драйвер!" + IDS_UNINSTNOTICE "Файли SVGA драйвера VMware(r) ще не були видалені.\nБудь ласка видаліть їх вручну після перезавантаження системи." + IDS_FAILEDTOADDREGENTRIES "Не вдалося створити записи в реєстрі для SVGA драйвера VMware(r)!" END STRINGTABLE BEGIN - 10001 " (8BPP)" - 10002 " (16BPP)" - 10003 " (32BPP)" + 10001 "Низька (8BPP)" + 10002 "Середня (16BPP)" + 10003 "Найвища (32BPP)" END STRINGTABLE BEGIN - IDS_SEARCHINGFORCDROM " - VMware(r) Tools..." - IDS_COPYINGFILES " ..." - IDS_ENABLINGDRIVER " SVGA VMware(r)..." + IDS_SEARCHINGFORCDROM "Пошук компакт-диска VMware(r) Tools..." + IDS_COPYINGFILES "Копіювання файлів..." + IDS_ENABLINGDRIVER "Запуск SVGA драйвера VMware(r)..." END STRINGTABLE BEGIN - IDD_INSERT_VMWARE_TOOLSTITLE " SVGA VMware (r)" - IDD_INSERT_VMWARE_TOOLSSUBTITLE " VMware tools." - IDD_INSTALLING_VMWARE_TOOLSTITLE " SVGA VMware (r)" - IDD_INSTALLING_VMWARE_TOOLSSUBTITLE " SVGA VMware (r)." - IDD_CONFIGTITLE " SVGA VMware (r)" - IDD_CONFIGSUBTITLE " ." - IDD_INSTALLATION_FAILEDTITLE " SVGA VMware (r)" - IDD_INSTALLATION_FAILEDSUBTITLE " SVGA VMware (r) ." - IDD_CHOOSEACTIONTITLE " SVGA VMware (r)" - IDD_CHOOSEACTIONSUBTITLE ", ." - IDD_SELECTDRIVERTITLE " SVGA VMware (r)" - IDD_SELECTDRIVERSUBTITLE " ." - IDD_DOUNINSTALLTITLE " SVGA VMware (r)" - IDD_DOUNINSTALLSUBTITLE " ." + IDD_INSERT_VMWARE_TOOLSTITLE "Майстер встановлення SVGA драйвера VMware (r)" + IDD_INSERT_VMWARE_TOOLSSUBTITLE "Будь ласка вставте диск VMware tools." + IDD_INSTALLING_VMWARE_TOOLSTITLE "Майстер встановлення SVGA драйвера VMware (r)" + IDD_INSTALLING_VMWARE_TOOLSSUBTITLE "Пошук і копіювання SVGA драйвера VMware (r)." + IDD_CONFIGTITLE "Майстер встановлення SVGA драйвера VMware (r)" + IDD_CONFIGSUBTITLE "Оберіть потрібну Вам роздільну здатність екрану." + IDD_INSTALLATION_FAILEDTITLE "Майстер встановлення SVGA драйвера VMware (r)" + IDD_INSTALLATION_FAILEDSUBTITLE "Встановлення SVGA драйвера VMware (r) не вдалася." + IDD_CHOOSEACTIONTITLE "Майстер встановлення SVGA драйвера VMware (r)" + IDD_CHOOSEACTIONSUBTITLE "Виберіть, що Ви хочете зробити." + IDD_SELECTDRIVERTITLE "Майстер встановлення SVGA драйвера VMware (r)" + IDD_SELECTDRIVERSUBTITLE "Обрати драйвер." + IDD_DOUNINSTALLTITLE "Майстер встановлення SVGA драйвера VMware (r)" + IDD_DOUNINSTALLSUBTITLE "Видалити драйвер." END diff --git a/base/setup/vmwinst/rsrc.rc b/base/setup/vmwinst/rsrc.rc index 7d94fb80adc..3cb6ca3fa53 100644 --- a/base/setup/vmwinst/rsrc.rc +++ b/base/setup/vmwinst/rsrc.rc @@ -26,11 +26,11 @@ IDB_HEADER BITMAP "resources/header.bmp" #include "lang/ja-JP.rc" #include "lang/lt-LT.rc" #include "lang/no-NO.rc" -#include "lang/ru-RU.rc" #include "lang/sv-SE.rc" -#include "lang/uk-UA.rc" #include "lang/zh-CN.rc" // UTF-8 #pragma code_page(65001) #include "lang/pl-PL.rc" +#include "lang/ru-RU.rc" +#include "lang/uk-UA.rc" diff --git a/base/setup/welcome/CMakeLists.txt b/base/setup/welcome/CMakeLists.txt index f4252dbaa88..d4da7e3c581 100644 --- a/base/setup/welcome/CMakeLists.txt +++ b/base/setup/welcome/CMakeLists.txt @@ -1,5 +1,6 @@ set_unicode() +set_rc_compiler() add_executable(welcome welcome.c welcome.rc) diff --git a/base/setup/welcome/lang/ru-RU.rc b/base/setup/welcome/lang/ru-RU.rc index 42e114301d4..39ec334eaa1 100644 --- a/base/setup/welcome/lang/ru-RU.rc +++ b/base/setup/welcome/lang/ru-RU.rc @@ -7,19 +7,19 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT /* Default settings */ STRINGTABLE DISCARDABLE BEGIN - IDS_APPTITLE "ReactOS - !" + IDS_APPTITLE "ReactOS - Добро пожаловать!" IDS_DEFAULTTOPICTITLE "ReactOS" - IDS_DEFAULTTOPICDESC " ReactOS.\n\n ." -// IDS_CHECKTEXT " " -// IDS_CLOSETEXT "" + IDS_DEFAULTTOPICDESC "Добро пожаловать в ReactOS.\n\nВыберите пункт слева." +// IDS_CHECKTEXT "Показывать это окно снова" +// IDS_CLOSETEXT "Выход" END /* Topic buttons */ STRINGTABLE DISCARDABLE BEGIN - IDS_TOPICBUTTON0 " ReactOS" - IDS_TOPICBUTTON1 " " - IDS_TOPICBUTTON2 "" + IDS_TOPICBUTTON0 "Установить ReactOS" + IDS_TOPICBUTTON1 "Обзор диска" + IDS_TOPICBUTTON2 "Выход" // IDS_TOPICBUTTON3 "Empty Topic 3" // IDS_TOPICBUTTON4 "Empty Topic 4" // IDS_TOPICBUTTON5 "Empty Topic 5" @@ -32,9 +32,9 @@ END /* Topic titles */ STRINGTABLE DISCARDABLE BEGIN - IDS_TOPICTITLE0 " ReactOS" - IDS_TOPICTITLE1 " " - IDS_TOPICTITLE2 "" + IDS_TOPICTITLE0 "Установить ReactOS" + IDS_TOPICTITLE1 "Обзор диска" + IDS_TOPICTITLE2 "Выход" // IDS_TOPICTITLE3 "Empty Topic Title 3" // IDS_TOPICTITLE4 "Empty Topic Title 4" // IDS_TOPICTITLE5 "Empty Topic Title 5" @@ -47,9 +47,9 @@ END /* Topic descriptions */ STRINGTABLE DISCARDABLE BEGIN - IDS_TOPICDESC0 " ReactOS ." - IDS_TOPICDESC1 " ." - IDS_TOPICDESC2 " ." + IDS_TOPICDESC0 "Установит ReactOS на Ваш компьютер с нуля или обновит уже установленную версию." + IDS_TOPICDESC1 "Обзор диска." + IDS_TOPICDESC2 "Выберите для выхода из этого приложения." // IDS_TOPICDESC3 "Topic description 3.\n\nDescribe topic 3 here." // IDS_TOPICDESC4 "Topic description 4.\n\nDescribe topic 4 here." // IDS_TOPICDESC5 "Topic description 5.\n\nDescribe topic 5 here." diff --git a/base/setup/welcome/lang/uk-UA.rc b/base/setup/welcome/lang/uk-UA.rc index 01e6d031d52..2066bfe1ea1 100644 --- a/base/setup/welcome/lang/uk-UA.rc +++ b/base/setup/welcome/lang/uk-UA.rc @@ -25,19 +25,19 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT /* Default settings */ STRINGTABLE DISCARDABLE BEGIN - IDS_APPTITLE "ReactOS - " + IDS_APPTITLE "ReactOS - Ласкаво просимо" IDS_DEFAULTTOPICTITLE "ReactOS" - IDS_DEFAULTTOPICDESC " ReactOS.\n\n " -// IDS_CHECKTEXT " " -// IDS_CLOSETEXT "" + IDS_DEFAULTTOPICDESC "Ласкаво просимо до операційної системи ReactOS.\n\nКлацніть по темі ліворуч" +// IDS_CHECKTEXT "Показувати цей діалог знов" +// IDS_CLOSETEXT "Вихід" END /* Topic buttons */ STRINGTABLE DISCARDABLE BEGIN - IDS_TOPICBUTTON0 " ReactOS" - IDS_TOPICBUTTON1 " CD" - IDS_TOPICBUTTON2 "" + IDS_TOPICBUTTON0 "Встановлення ReactOS" + IDS_TOPICBUTTON1 "Огляд цього CD" + IDS_TOPICBUTTON2 "Вихід" // IDS_TOPICBUTTON3 "Empty Topic 3" // IDS_TOPICBUTTON4 "Empty Topic 4" // IDS_TOPICBUTTON5 "Empty Topic 5" @@ -50,9 +50,9 @@ END /* Topic titles */ STRINGTABLE DISCARDABLE BEGIN - IDS_TOPICTITLE0 " ReactOS" - IDS_TOPICTITLE1 " CD" - IDS_TOPICTITLE2 "" + IDS_TOPICTITLE0 "Встановлення ReactOS" + IDS_TOPICTITLE1 "Огляд цього CD" + IDS_TOPICTITLE2 "Вихід" // IDS_TOPICTITLE3 "Empty Topic Title 3" // IDS_TOPICTITLE4 "Empty Topic Title 4" // IDS_TOPICTITLE5 "Empty Topic Title 5" @@ -65,9 +65,9 @@ END /* Topic descriptions */ STRINGTABLE DISCARDABLE BEGIN - IDS_TOPICDESC0 " ReactOS ' ." - IDS_TOPICDESC1 " CD." - IDS_TOPICDESC2 " ." + IDS_TOPICDESC0 "Створення нової інсталяції ReactOS на Вашому комп'ютері чи оновлення існуючої інсталяції." + IDS_TOPICDESC1 "Проглянути CD." + IDS_TOPICDESC2 "Натисніть для виходу з цієї програми." // IDS_TOPICDESC3 "Topic description 3.\n\nDescribe topic 3 here." // IDS_TOPICDESC4 "Topic description 4.\n\nDescribe topic 4 here." // IDS_TOPICDESC5 "Topic description 5.\n\nDescribe topic 5 here." diff --git a/base/setup/welcome/rsrc.rc b/base/setup/welcome/rsrc.rc index 14167e771de..052d7019663 100644 --- a/base/setup/welcome/rsrc.rc +++ b/base/setup/welcome/rsrc.rc @@ -59,10 +59,10 @@ END #include "lang/sk-SK.rc" #include "lang/sv-SE.rc" #include "lang/th-TH.rc" -#include "lang/ru-RU.rc" -#include "lang/uk-UA.rc" #include "lang/zh-CN.rc" // UTF-8 #pragma code_page(65001) #include "lang/pl-PL.rc" +#include "lang/ru-RU.rc" +#include "lang/uk-UA.rc" diff --git a/base/shell/cmd/CMakeLists.txt b/base/shell/cmd/CMakeLists.txt index 855d5fa458a..37cacf55ecb 100644 --- a/base/shell/cmd/CMakeLists.txt +++ b/base/shell/cmd/CMakeLists.txt @@ -72,11 +72,11 @@ list(APPEND SOURCE where.c window.c) -add_executable(cmd ${CMAKE_CURRENT_BINARY_DIR}/cmd_precomp.h.gch ${SOURCE}) +add_executable(cmd ${SOURCE}) target_link_libraries(cmd wine) -add_pch(cmd ${CMAKE_CURRENT_SOURCE_DIR}/precomp.h SOURCE) set_module_type(cmd win32cui) add_importlibs(cmd advapi32 user32 msvcrt kernel32 ntdll) +add_pch(cmd precomp.h) add_cd_file(TARGET cmd DESTINATION reactos/system32 FOR all) diff --git a/base/shell/cmd/assoc.c b/base/shell/cmd/assoc.c index e5c931e4e88..4abbd672119 100644 --- a/base/shell/cmd/assoc.c +++ b/base/shell/cmd/assoc.c @@ -18,7 +18,6 @@ */ #include -#include #ifdef INCLUDE_CMD_ASSOC diff --git a/base/shell/cmd/batch.c b/base/shell/cmd/batch.c index bb0c8b6859b..4d9d1719847 100644 --- a/base/shell/cmd/batch.c +++ b/base/shell/cmd/batch.c @@ -156,6 +156,22 @@ LPTSTR BatchParams (LPTSTR s1, LPTSTR s2) return dp; } +/* + * free the allocated memory of a batch file + */ +VOID ClearBatch() +{ + TRACE ("ClearBatch mem = %08x free = %d\n", bc->mem, bc->memfree); + + if (bc->mem && bc->memfree) + cmd_free(bc->mem); + + if (bc->raw_params) + cmd_free(bc->raw_params); + + if (bc->params) + cmd_free(bc->params); +} /* * If a batch file is current, exits it, freeing the context block and @@ -169,20 +185,10 @@ LPTSTR BatchParams (LPTSTR s1, LPTSTR s2) VOID ExitBatch() { + ClearBatch(); + TRACE ("ExitBatch\n"); - if (bc->hBatchFile) - { - CloseHandle (bc->hBatchFile); - bc->hBatchFile = INVALID_HANDLE_VALUE; - } - - if (bc->raw_params) - cmd_free(bc->raw_params); - - if (bc->params) - cmd_free(bc->params); - UndoRedirection(bc->RedirList, NULL); FreeRedirection(bc->RedirList); @@ -195,6 +201,33 @@ VOID ExitBatch() bc = bc->prev; } +/* + * Load batch file into memory + * + */ +void BatchFile2Mem(HANDLE hBatchFile) +{ + TRACE ("BatchFile2Mem ()\n"); + + bc->memsize = GetFileSize(hBatchFile, NULL); + bc->mem = (char *)cmd_alloc(bc->memsize+1); /* 1 extra for '\0' */ + + /* if memory is available, read it in and close the file */ + if (bc->mem != NULL) + { + TRACE ("BatchFile2Mem memory %08x - %08x\n",bc->mem,bc->memsize); + SetFilePointer (hBatchFile, 0, NULL, FILE_BEGIN); + ReadFile(hBatchFile, (LPVOID)bc->mem, bc->memsize, &bc->memsize, NULL); + bc->mem[bc->memsize]='\0'; /* end this, so you can dump it as a string */ + bc->memfree=TRUE; /* this one needs to be freed */ + } + else + { + bc->memsize=0; /* this will prevent mem being accessed */ + bc->memfree=FALSE; + } + bc->mempos = 0; /* set position to the start */ +} /* * Start batch file execution @@ -209,31 +242,37 @@ INT Batch (LPTSTR fullname, LPTSTR firstword, LPTSTR param, PARSED_COMMAND *Cmd) LPFOR_CONTEXT saved_fc; INT i; INT ret = 0; + BOOL same_fn = FALSE; - HANDLE hFile; + HANDLE hFile = 0; SetLastError(0); - hFile = CreateFile (fullname, GENERIC_READ, FILE_SHARE_WRITE | FILE_SHARE_READ | FILE_SHARE_DELETE, NULL, - OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | - FILE_FLAG_SEQUENTIAL_SCAN, NULL); - - TRACE ("Batch: (\'%s\', \'%s\', \'%s\') hFile = %x\n", - debugstr_aw(fullname), debugstr_aw(firstword), debugstr_aw(param), hFile); - - if (hFile == INVALID_HANDLE_VALUE) + if (bc && bc->mem) { - ConErrResPuts(STRING_BATCH_ERROR); - return 1; + TCHAR fpname[MAX_PATH]; + GetFullPathName(fullname, sizeof(fpname) / sizeof(TCHAR), fpname, NULL); + if (_tcsicmp(bc->BatchFilePath,fpname)==0) + same_fn=TRUE; } + TRACE ("Batch: (\'%s\', \'%s\', \'%s\') same_fn = %d\n", + debugstr_aw(fullname), debugstr_aw(firstword), debugstr_aw(param), same_fn); + if (!same_fn) + { + hFile = CreateFile (fullname, GENERIC_READ, FILE_SHARE_WRITE | FILE_SHARE_READ | FILE_SHARE_DELETE, NULL, + OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | + FILE_FLAG_SEQUENTIAL_SCAN, NULL); + + if (hFile == INVALID_HANDLE_VALUE) + { + ConErrResPuts(STRING_BATCH_ERROR); + return 1; + } + } + if (bc != NULL && Cmd == bc->current) { /* Then we are transferring to another batch */ - CloseHandle (bc->hBatchFile); - bc->hBatchFile = INVALID_HANDLE_VALUE; - if (bc->params) - cmd_free (bc->params); - if (bc->raw_params) - cmd_free (bc->raw_params); + ClearBatch(); AddBatchRedirection(&Cmd->Redirections); } else @@ -261,15 +300,27 @@ INT Batch (LPTSTR fullname, LPTSTR firstword, LPTSTR param, PARSED_COMMAND *Cmd) /* Create a new context. This function will not * return until this context has been exited */ new.prev = bc; + /* copy some fields in the new structure if it is the same file */ + if (same_fn) { + new.mem = bc->mem; + new.memsize = bc->memsize; + new.mempos = 0; + new.memfree = FALSE; /* don't free this, being used before this */ + } bc = &new; bc->RedirList = NULL; bc->setlocal = setlocal; } GetFullPathName(fullname, sizeof(bc->BatchFilePath) / sizeof(TCHAR), bc->BatchFilePath, NULL); - - bc->hBatchFile = hFile; - SetFilePointer (bc->hBatchFile, 0, NULL, FILE_BEGIN); + /* if a new batch file, load it into memory and close the file */ + if (!same_fn) + { + BatchFile2Mem(hFile); + CloseHandle(hFile); + } + + bc->mempos = 0; /* goto begin of batch file */ bc->bEcho = bEcho; /* Preserve echo across batch calls */ for (i = 0; i < 10; i++) bc->shiftlevel[i] = i; @@ -339,6 +390,49 @@ VOID AddBatchRedirection(REDIRECTION **RedirList) *RedirList = NULL; } +/* + * Read a single line from the batch file from the current batch/memory position. + * Almost a copy of FileGetString with same UNICODE handling + */ +BOOL BatchGetString (LPTSTR lpBuffer, INT nBufferLength) +{ + LPSTR lpString; + INT len = 0; +#ifdef _UNICODE + lpString = cmd_alloc(nBufferLength); +#else + lpString = lpBuffer; +#endif + /* read all chars from memory until a '\n' is encountered */ + if (bc->mem) + { + for (; (bc->mempos < bc->memsize && len < (nBufferLength-1)); len++) + { + lpString[len] = bc->mem[bc->mempos++]; + if (lpString[len] == '\n' ) + { + len++; + break; + } + } + } + + if (!len) + { +#ifdef _UNICODE + cmd_free(lpString); +#endif + return FALSE; + } + + lpString[len++] = '\0'; +#ifdef _UNICODE + MultiByteToWideChar(OutputCodePage, 0, lpString, -1, lpBuffer, len); + cmd_free(lpString); +#endif + return TRUE; +} + /* * Read and return the next executable line form the current batch file * @@ -347,7 +441,6 @@ VOID AddBatchRedirection(REDIRECTION **RedirList) * * Set eflag to 0 if line is not to be echoed else 1 */ - LPTSTR ReadBatchLine () { TRACE ("ReadBatchLine ()\n"); @@ -360,7 +453,7 @@ LPTSTR ReadBatchLine () return NULL; } - if (!FileGetString (bc->hBatchFile, textline, sizeof (textline) / sizeof (textline[0]) - 1)) + if (!BatchGetString (textline, sizeof (textline) / sizeof (textline[0]) - 1)) { TRACE ("ReadBatchLine(): Reached EOF!\n"); /* End of file.... */ diff --git a/base/shell/cmd/batch.h b/base/shell/cmd/batch.h index 644fc35f6fb..ae44e67e6a2 100644 --- a/base/shell/cmd/batch.h +++ b/base/shell/cmd/batch.h @@ -9,7 +9,10 @@ typedef struct tagBATCHCONTEXT { struct tagBATCHCONTEXT *prev; - HANDLE hBatchFile; + char *mem; /* batchfile content in memory */ + DWORD memsize; /* size of batchfile */ + DWORD mempos; /* current position to read from */ + BOOL memfree; /* true if it need to be freed when exitbatch is called */ TCHAR BatchFilePath[MAX_PATH]; LPTSTR params; LPTSTR raw_params; /* Holds the raw params given by the input */ @@ -47,5 +50,6 @@ LPTSTR FindArg (TCHAR, BOOL *); LPTSTR BatchParams (LPTSTR, LPTSTR); VOID ExitBatch (VOID); INT Batch (LPTSTR, LPTSTR, LPTSTR, PARSED_COMMAND *); +BOOL BatchGetString (LPTSTR lpBuffer, INT nBufferLength); LPTSTR ReadBatchLine(VOID); -VOID AddBatchRedirection(REDIRECTION **); +VOID AddBatchRedirection(REDIRECTION **); diff --git a/base/shell/cmd/goto.c b/base/shell/cmd/goto.c index 192022713e7..3e285a5074f 100644 --- a/base/shell/cmd/goto.c +++ b/base/shell/cmd/goto.c @@ -74,14 +74,14 @@ INT cmd_goto (LPTSTR param) /* jump to end of the file */ if ( _tcsicmp( param, _T(":eof"))==0) { - SetFilePointer (bc->hBatchFile, 0, &lNewPosHigh, FILE_END); + bc->mempos=bc->memsize; /* position at the end of the batchfile */ return 0; } /* jump to begin of the file */ - SetFilePointer (bc->hBatchFile, 0, &lNewPosHigh, FILE_BEGIN); + bc->mempos=0; - while (FileGetString (bc->hBatchFile, textline, sizeof(textline) / sizeof(textline[0]))) + while (BatchGetString (textline, sizeof(textline) / sizeof(textline[0]))) { int pos; int size; diff --git a/base/shell/cmd/lang/de-DE.rc b/base/shell/cmd/lang/de-DE.rc index 081f108ec0c..3959cdbf0a6 100644 --- a/base/shell/cmd/lang/de-DE.rc +++ b/base/shell/cmd/lang/de-DE.rc @@ -2,7 +2,6 @@ * German language file by Klemens Friedl 2005-06-03 * Update: frik85 2005-06-06 */ -#pragma code_page(65001) LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL STRINGTABLE DISCARDABLE diff --git a/base/shell/cmd/lang/ja-JP.rc b/base/shell/cmd/lang/ja-JP.rc index 3195f0fbb1d..e6f45241884 100644 --- a/base/shell/cmd/lang/ja-JP.rc +++ b/base/shell/cmd/lang/ja-JP.rc @@ -1,7 +1,6 @@ /* * Japanese translation of CMD */ -#pragma code_page(65001) LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT STRINGTABLE DISCARDABLE diff --git a/base/shell/cmd/lang/pl-PL.rc b/base/shell/cmd/lang/pl-PL.rc index f8d2cb79a02..4eff17b0697 100644 --- a/base/shell/cmd/lang/pl-PL.rc +++ b/base/shell/cmd/lang/pl-PL.rc @@ -1,670 +1,673 @@ /* - * translated by Caemyr - * caemyr@gmail.com - * https://sourceforge.net/projects/reactospl + * translated by Caemyr - Olaf Siejka (Jan,2008) + * updated by niski - Maciej Bialas (Mar,2010) + * Use ReactOS forum PM or IRC to contact me + * http://www.reactos.org + * IRC: irc.freenode.net #reactos-pl; + * UTF-8 conversion by Caemyr (May, 2011) */ LANGUAGE LANG_POLISH, SUBLANG_DEFAULT STRINGTABLE DISCARDABLE BEGIN -STRING_ASSOC_HELP, "Modyfikuje skojarzenia rozszerze plikw.\n\n\ +STRING_ASSOC_HELP, "Modyfikuje skojarzenia rozszerzeń plików.\n\n\ assoc [.ext[=[typPliku]]]\n\ \n\ -assoc (wywietla wszystkie skojarzenia)\n\ -assoc .ext (wywietla okrelone skojarzenie)\n\ -assoc .ext= (usuwa okrelone skojarzenie)\n\ +assoc (wyświetla wszystkie skojarzenia)\n\ +assoc .ext (wyświetla określone skojarzenie)\n\ +assoc .ext= (usuwa określone skojarzenie)\n\ assoc .ext=typPliku (dodaje nowe skojarzenie)\n" -STRING_ATTRIB_HELP, "Wywietla lub zmienia atrybuty plikw.\n\n\ +STRING_ATTRIB_HELP, "Wyświetla lub zmienia atrybuty plików.\n\n\ ATTRIB [+R | -R] [+A | -A] [+S | -S] [+H | -H] nazwa_pliku ...\n\ [/S [/D]]\n\n\ + Ustawia atrybut\n\ - - Czyci atrybut\n\ + - Czyści atrybut\n\ R Atrybut pliku tylko do odczytu\n\ A Atrybut pliku archiwalnego\n\ S Atrybut pliku systemowego\n\ H Atrybut pliku ukrytego\n\ - /S Przetwarza wszystkie, pasujce pliki w biecym katalogu\n\ + /S Przetwarza wszystkie, pasujące pliki w bieżącym katalogu\n\ i we wszystkich podkatalogach\n\ - /D Przetwarza rwnie katalogi\n\n\ -Wpisz ATTRIB bez adnego parametru, by wywietli atrybuty wszystkich plikw.\n" + /D Przetwarza również katalogi\n\n\ +Wpisz ATTRIB bez żadnego parametru, by wyświetlić atrybuty wszystkich plików.\n" -STRING_ALIAS_HELP, "Ustawia, usuwa, a take wywietla aliasy.\n\n\ +STRING_ALIAS_HELP, "Ustawia, usuwa, a także wyświetla aliasy.\n\n\ ALIAS [nazwa=[tekst]]\n\n\ nazwa Nazwa aliasu.\n\ - tekst Cig tekstu, jaki ma zosta zastpiony aliasem.\n\n\ -Aby wywietli wszystkie aliasy:\n\ + tekst Ciąg tekstu, jaki ma zostać zastąpiony aliasem.\n\n\ +Aby wyświetlić wszystkie aliasy:\n\ ALIAS\n\n\ -Aby ustawi nowy albo zmieni ju istniejcy alias:\n\ +Aby ustawić nowy albo zmienić już istniejący alias:\n\ ALIAS da=dir a:\n\n\ -Aby usun istniejcy alias:\n\ +Aby usunąć istniejący alias:\n\ ALIAS da=" -STRING_BEEP_HELP, "Sygna dwikowy z gonika PC.\n\nBIIIIIP\n" +STRING_BEEP_HELP, "Sygnał dźwiękowy z głośnika PC.\n\nBIIIIIP\n" -STRING_CALL_HELP, "Umoliwia wywoanie programu wsadowego z poziomu innego.\n\n\ -CALL [napd:][cieka]nazwa_pliku [parametry]\n\n\ +STRING_CALL_HELP, "Umożliwia wywołanie programu wsadowego z poziomu innego.\n\n\ +CALL [napęd:][ścieżka]nazwa_pliku [parametry]\n\n\ parametry Wszelkie dane, wymagane przez program wsadowy,\n\ - ktry ma zosta wywoany." + który ma zostać wywołany." -STRING_CD_HELP, "Zmienia obecny katalog albo wywietla jego pen nazw. \n\n\ -CHDIR [/D][napd:][cieka]\n\ +STRING_CD_HELP, "Zmienia obecny katalog albo wyświetla jego pełną nazwę. \n\n\ +CHDIR [/D][napęd:][ścieżka]\n\ CHDIR[..|.]\n\ -CD [/D][napd:][cieka]\n\ +CD [/D][napęd:][ścieżka]\n\ CD[..|.]\n\n\ - .. katalog poziom wyej\n\ - . biecy katalog\n\ - /D Umoliwia zmian napdu.\n\n\ -Wpisz CD [napd:], by wywietli biecy katalog na danym napdzie.\n\ -Wpisz CD bez adnych parametrw, by wywietli biecy napd i katalog.\n" + .. katalog poziom wyżej\n\ + . bieżący katalog\n\ + /D Umożliwia zmianę napędu.\n\n\ +Wpisz CD [napęd:], by wyświetlić bieżący katalog na danym napędzie.\n\ +Wpisz CD bez żadnych parametrów, by wyświetlić bieżący napęd i katalog.\n" -STRING_CHCP_HELP, "Wywietla lub ustawia numer aktywnej strony kodowej.\n\n\ +STRING_CHCP_HELP, "Wyświetla lub ustawia numer aktywnej strony kodowej.\n\n\ CHCP [nnn]\n\n\ nnn Numer strony kodowej.\n\n\ -Wpisz CHCP bez parametru, by wywietli numer aktywnej strony kodowej.\n" +Wpisz CHCP bez parametru, by wyświetlić numer aktywnej strony kodowej.\n" -STRING_CHOICE_HELP, "Wywietla opcje jakimi dysponuje uytkownik i oczekuje na wybr jednej z nich.\n\n\ +STRING_CHOICE_HELP, "Wyświetla opcje jakimi dysponuje użytkownik i oczekuje na wybór jednej z nich.\n\n\ CHOICE [/C[:]opcje][/N][/S][/T[:]c,nn][tekst]\n\n\ - /C[:]opcje Wyznacza klawisze wywietlane jako wybr. Domylne: TN.\n\ - /N Nie wywietla klawiszy opcji ani znaku ? na kocu tekstu.\n\ - /S Komenda wyrni wielko liter przy wpisywaniu (n != N).\n\ - /T[:]c,nn Komenda zwrci domylny klawisz (c) po upywie (nn) sekund .\n\ - tekst Tekst wywietlany przy oczekiwaniu na wybr.\n\n\ -ERRORLEVEL ustawiony jest na kompensowanie wyboru uytkownika domylnym.\n" + /C[:]opcje Wyznacza klawisze wyświetlane jako wybór. Domyślne: TN.\n\ + /N Nie wyświetla klawiszy opcji ani znaku ? na końcu tekstu.\n\ + /S Komenda wyróżni wielkość liter przy wpisywaniu (n != N).\n\ + /T[:]c,nn Komenda zwróci domyślny klawisz (c) po upływie (nn) sekund .\n\ + tekst Tekst wyświetlany przy oczekiwaniu na wybór.\n\n\ +ERRORLEVEL ustawiony jest na kompensowanie wyboru użytkownika domyślnym.\n" -STRING_CLS_HELP, "Czyci ekran konsoli.\n\nCLS\n" +STRING_CLS_HELP, "Czyści ekran konsoli.\n\nCLS\n" -STRING_CMD_HELP1, "\nDostpne wewntrzne polecenia:\n" +STRING_CMD_HELP1, "\nDostępne wewnętrzne polecenia:\n" -STRING_CMD_HELP2, "\nDostpne opcje:" +STRING_CMD_HELP2, "\nDostępne opcje:" STRING_CMD_HELP3," [aliasy]" STRING_CMD_HELP4," [historia]" -STRING_CMD_HELP5," [dopenianie nazw unixa]" +STRING_CMD_HELP5," [dopełnianie nazw unixa]" STRING_CMD_HELP6," [stos katalogu]" STRING_CMD_HELP7," [przekierowania i potoki]" -STRING_CMD_HELP8, "Uruchamia nowe okno konsoli ReactOS (interpreter linii polece).\n\n\ +STRING_CMD_HELP8, "Uruchamia nowe okno konsoli ReactOS (interpreter linii poleceń).\n\n\ CMD [/[C|K] komenda][/P][/Q][/T:bf]\n\n\ - /C komenda Wykonuje podan komend i zamyka okno.\n\ - /K komenda Wykonuje podan komend i pozostawia okno.\n\ + /C komenda Wykonuje podaną komendę i zamyka okno.\n\ + /K komenda Wykonuje podaną komendę i pozostawia okno.\n\ /P CMD przetwarza autoexec.bat i pozostaje permanentny\n\ - (okno nie moe zosta zamknite).\n\ - /T:bf Ustawia kolor ta/tekstu (patrz komenda COLOR).\n" + (okno nie może zostać zamknięte).\n\ + /T:bf Ustawia kolor tła/tekstu (patrz komenda COLOR).\n" -STRING_COLOR_HELP1, "Ustawia domylny kolor ta i tekstu.\n\n\ +STRING_COLOR_HELP1, "Ustawia domyślny kolor tła i tekstu.\n\n\ COLOR [atr [/-F]] \n\n\ atr Ustawienia koloru \n\ - /-F Nie uzupenia kolorem pustych przestrzeni w konsoli\n\n\ -Ustawienia koloru mona wyznaczy na trzy sposoby:\n\ -1) [jasny] nazwa on [jasny] nazwa (wystarcz pierwsze trzy litery nazwy)\n\ + /-F Nie uzupełnia kolorem pustych przestrzeni w konsoli\n\n\ +Ustawienia koloru można wyznaczyć na trzy sposoby:\n\ +1) [jasny] nazwa on [jasny] nazwa (wystarczą pierwsze trzy litery nazwy)\n\ 2) numer_dec on numer_dec\n\ 3) dwa numery szesnastkowe\n\n\ -Dostpne kolory:\n\ +Dostępne kolory:\n\ dec hex nazwa dec hex nazwa\n\ 0 0 Czarny 8 8 Szary\n\ 1 1 Niebieski 9 9 Jasnoniebieski\n\ 2 2 Zielony 10 A Jasnozielony\n\ -3 3 Bkitny 11 B Jasnobkitny\n\ +3 3 Błękitny 11 B Jasnobłękitny\n\ 4 4 Czerwony 12 C Jasnoczerwony\n\ 5 5 Purpurowy 13 D Jasnopurpurowy\n\ -6 6 ty 14 E Jasnoty\n\ -7 7 Biay 15 F Jaskrawobiay\n" +6 6 Żółty 14 E Jasnożółty\n\ +7 7 Biały 15 F Jaskrawobiały\n" -STRING_COPY_HELP1, "Nadpisa %s (Tak/Nie/Zawsze)? " +STRING_COPY_HELP1, "Nadpisać %s (Tak/Nie/Zawsze)? " -STRING_COPY_HELP2, "Kopiuje jeden lub wicej plikw do wskazanej lokacji.\n\n\ -COPY [/V][/Y|/-Y][/A|/B] rdo [/A|/B]\n\ - [+ rdo [/A|/B] [+ ...]] [cel [/A|/B]]\n\n\ - rdo Miejsce, gdzie znajduj si plik(i) do skopiowania.\n\ - /A Wymusza traktowanie plikw jako tekstowych (ASCII).\n\ - /B Wymusza traktowanie plikw jako binarnych.\n\ +STRING_COPY_HELP2, "Kopiuje jeden lub więcej plików do wskazanej lokacji.\n\n\ +COPY [/V][/Y|/-Y][/A|/B] źródło [/A|/B]\n\ + [+ źródło [/A|/B] [+ ...]] [cel [/A|/B]]\n\n\ + źródło Miejsce, gdzie znajdują się plik(i) do skopiowania.\n\ + /A Wymusza traktowanie plików jako tekstowych (ASCII).\n\ + /B Wymusza traktowanie plików jako binarnych.\n\ cel Docelowy katalog/plik.\n\ - /V Weryfikuje prawidowo zapisu po skopiowaniu.\n\ - /Y Automatycznie potwierdza kad prb nadpisania ju\n\ - istniejcego pliku.\n\ - /-Y Wymusza kadorazowo potwierdzenie nadpisania ju\n\ - istniejcego pliku.\n\n\ -Opcja /Y moe znale si wrd zmiennych rodowiskowych COPYCMD.\n\ + /V Weryfikuje prawidłowość zapisu po skopiowaniu.\n\ + /Y Automatycznie potwierdza każdą próbę nadpisania już\n\ + istniejącego pliku.\n\ + /-Y Wymusza każdorazowo potwierdzenie nadpisania już\n\ + istniejącego pliku.\n\n\ +Opcja /Y może znaleźć się wśród zmiennych środowiskowych COPYCMD.\n\ ...\n" -STRING_DATE_HELP1, "\nPodaj now dat (mm%cdd%crrrr): " +STRING_DATE_HELP1, "\nPodaj nową datę (mm%cdd%crrrr): " -STRING_DATE_HELP2, "\nPodaj now dat (dd%cmm%crrrr): " +STRING_DATE_HELP2, "\nPodaj nową datę (dd%cmm%crrrr): " -STRING_DATE_HELP3, "\nPodaj now dat (rrrr%cmm%cdd): " +STRING_DATE_HELP3, "\nPodaj nową datę (rrrr%cmm%cdd): " -STRING_DATE_HELP4, "Wywietla lub zmienia dat systemow.\n\n\ +STRING_DATE_HELP4, "Wyświetla lub zmienia datę systemową.\n\n\ DATE [/T][data]\n\n\ - /T tylko wywietlenie\n\n\ -Wpisz DATE bez adnych parametrw, by wywietli obecn dat i\n\ -zapyta o now. Nacinicie ENTER od razu, pozostawia obecn.\n" + /T tylko wyświetlenie\n\n\ +Wpisz DATE bez żadnych parametrów, by wyświetlić obecną datę i\n\ +zapytać o nową. Naciśnięcie ENTER od razu, pozostawia obecną.\n" -STRING_DEL_HELP1, "Kasuje jeden lub wicej plikw.\n\n\ +STRING_DEL_HELP1, "Kasuje jeden lub więcej plików.\n\n\ DEL [/N /P /T /Q /S /W /Y /Z /A[[:]attributy]] plik ...\n\ DELETE [/N /P /T /Q /S /W /Y /Z /A[[:]attributy]] plik ...\n\ ERASE [/N /P /T /Q /S /W /Y /Z /A[[:]attributy]] plik ...\n\n\ plik Wyznacza pliki do skasowania.\n\n\ /N Nic.\n\ - /P Zapytanie przed skasowaniem kadego pliku.\n\ - /T Wywietla liczb skasowanych plikw i zwolnione przez nie miejsce.\n\ + /P Zapytanie przed skasowaniem każdego pliku.\n\ + /T Wyświetla liczbę skasowanych plików i zwolnione przez nie miejsce.\n\ /Q Tryb cichy.\n\ - /W Wymazywanie. Plik bdzie nadpisany losowym cigiem przed skasowaniem.\n\ - /Y Tak. Nawet przy *.* nie bdzie proby o potwierdzenie.\n\ - /F Wymusza kasowanie plikw Ukrytych, Systemowych i Tylko do odczytu.\n\ - /S Kasuje pliki take z podkatalogw\n\ - /A Wybr plikw do skasowania ze wzgldu na ich atrybuty:\n\ + /W Wymazywanie. Plik będzie nadpisany losowym ciągiem przed skasowaniem.\n\ + /Y Tak. Nawet przy *.* nie będzie prośby o potwierdzenie.\n\ + /F Wymusza kasowanie plików Ukrytych, Systemowych i Tylko do odczytu.\n\ + /S Kasuje pliki także z podkatalogów\n\ + /A Wybór plików do skasowania ze względu na ich atrybuty:\n\ R Tylko do odczytu\n\ S Systemowe\n\ A Archiwa\n\ H Ukryte\n\ - przedrostek NIE\n" -STRING_DEL_HELP2, "Wszystkie pliki w tym katalogu zostan skasowane!\nCzy jeste pewien (T/N)?" +STRING_DEL_HELP2, "Wszystkie pliki w tym katalogu zostaną skasowane!\nCzy jesteś pewien (T/N)?" STRING_DEL_HELP3, " %lu plik skasowany\n" -STRING_DEL_HELP4, " %lu pliki(-w) skasowane(-ych)\n" +STRING_DEL_HELP4, " %lu pliki(-ów) skasowane(-ych)\n" STRING_DELAY_HELP, "Pauzuje na n sekund lub milisekund\n\ DELAY [/m]n\n\n\ /m wymusza traktowanie n jako milisekund,\n\ - w innym wypadku bdzie traktowane jako sekundy\n" + w innym wypadku będzie traktowane jako sekundy\n" -STRING_DIR_HELP1, "DIR [napd:][cieka][pliki] [/A[[:]atrybuty]] [/B] [/C] [/D] [/L] [/N]\n\ - [/O[[:]porzdek]] [/P] [/Q] [/S] [/T[[:]czas]] [/W] [/X] [/4]\n\n\ - [napd:][cieka][nazwa_pliku]\n\ - Wyznacza liter napdu, katalog, i/lub pliki do wywietlenia.\n\n\ - /A Wywietla pliki o okrelonych atrybutach.\n\ +STRING_DIR_HELP1, "DIR [napęd:][ścieżka][pliki] [/A[[:]atrybuty]] [/B] [/C] [/D] [/L] [/N]\n\ + [/O[[:]porządek]] [/P] [/Q] [/S] [/T[[:]czas]] [/W] [/X] [/4]\n\n\ + [napęd:][ścieżka][nazwa_pliku]\n\ + Wyznacza literę napędu, katalog, i/lub pliki do wyświetlenia.\n\n\ + /A Wyświetla pliki o określonych atrybutach.\n\ atrybuty D Katalogi R Pliki tylko do odczytu\n\ H Pliki ukryte A Pliki do archiwizacji\n\ S Pliki systemowe - Przedrostek NIE\n\ - /B Format minimalny (bez nagwka i podsumowania).\n\ - /C Wywietla separator co trzy zera w rozmiarach plikw.\n\ - Opcja domylnie wczona. Aby wyczy, uyj: /-C .\n\ - /D To samo co format szeroki, ale pliki s posortowane kolumnami.\n\ - /L Uywa maych liter.\n\ - /N Nowy, dugi format plikw, gdzie nazwy znajduj si od prawej.\n\ - /O Sortowanie plikw wedug okrelonego porzdku.\n\ - sortorder N Wedug nazwy (alfabetycznie) S Wedug rozmiaru (rosnco)\n\ - E Wedug rozszerzenia (alfabet.) D Wedug daty (od najst.)\n\ - G Wywietla najpierw katalogi - Odwraca kolejno\n\ - /P Pauza po kadym penym ekranie.\n\ - /Q Wywietla waciciela plikw\n\ - /S Wywietla pliki w danym katalogu i wszystkich podkatalogach.\n\ - /T Pole czasu, odpowiedzialne za wywietlanie/sortowanie \n\ + /B Format minimalny (bez nagłówka i podsumowania).\n\ + /C Wyświetla separator co trzy zera w rozmiarach plików.\n\ + Opcja domyślnie włączona. Aby wyłączyć, użyj: /-C .\n\ + /D To samo co format szeroki, ale pliki są posortowane kolumnami.\n\ + /L Używa małych liter.\n\ + /N Nowy, długi format plików, gdzie nazwy znajdują się od prawej.\n\ + /O Sortowanie plików według określonego porządku.\n\ + sortorder N Według nazwy (alfabetycznie) S Według rozmiaru (rosnąco)\n\ + E Według rozszerzenia (alfabet.) D Według daty (od najst.)\n\ + G Wyświetla najpierw katalogi - Odwraca kolejność\n\ + /P Pauza po każdym pełnym ekranie.\n\ + /Q Wyświetla właściciela plików\n\ + /S Wyświetla pliki w danym katalogu i wszystkich podkatalogach.\n\ + /T Pole czasu, odpowiedzialne za wyświetlanie/sortowanie \n\ czas C Utworzenia\n\ A Ostatniego otwarcia\n\ W Ostatniej modyfikacji\n\ - /W Uywa szerokiego formatu wywietlania.\n\ - /X Wywietla krtkie nazwy, dla plikw nie w standardzie 8.3.\n\ - Format jest zbliony do tego przy /N z krtkimi nazwami,\n\ - umieszczonymi przed dugimi. Jeli plik nie ma krtkiej nazwy,\n\ - wywietlane jest puste pole.\n\ - /4 Wywietla lata w formacie czterocyfrowym.\n\n\ -Parametry mog znale si wrd zmiennych rodowiskowych DIRCMD. Mona\n\ -odwrci dziaanie parametrw przedrostkiem - (mylnik)-- na przykad, /-W.\n" + /W Używa szerokiego formatu wyświetlania.\n\ + /X Wyświetla krótkie nazwy, dla plików nie w standardzie 8.3.\n\ + Format jest zbliżony do tego przy /N z krótkimi nazwami,\n\ + umieszczonymi przed długimi. Jeśli plik nie ma krótkiej nazwy,\n\ + wyświetlane jest puste pole.\n\ + /4 Wyświetla lata w formacie czterocyfrowym.\n\n\ +Parametry mogą znaleźć się wśród zmiennych środowiskowych DIRCMD. Można\n\ +odwrócić działanie parametrów przedrostkiem - (myślnik)-- na przykład, /-W.\n" -STRING_DIR_HELP2, " Wolumin w napdzie %c ma etykiet: %s\n" -STRING_DIR_HELP3, " Wolumin w napdzie %c nie posiada etykiety.\n" +STRING_DIR_HELP2, " Wolumin w napędzie %c ma etykietę: %s\n" +STRING_DIR_HELP3, " Wolumin w napędzie %c nie posiada etykiety.\n" STRING_DIR_HELP4, " Numer seryjny woluminu to: %04X-%04X\n" -STRING_DIR_HELP5, "\n Ogem wywietonych:\n%16i plik(w)% 14s bajtw\n" -STRING_DIR_HELP6, "%16i katalog(w)% 15s bajtw\n" +STRING_DIR_HELP5, "\n Ogółem wyświetonych:\n%16i plik(ów)% 14s bajtów\n" +STRING_DIR_HELP6, "%16i katalog(ów)% 15s bajtów\n" STRING_DIR_HELP7, "\n katalog %s\n\n" -STRING_DIR_HELP8, "%16i plik(w)% 14s bajtw\n" +STRING_DIR_HELP8, "%16i plik(ów)% 14s bajtów\n" -STRING_DIRSTACK_HELP1, "Przechowuje obecny katalog dla potrzeb komendy POPD, nastpnie\n\ +STRING_DIRSTACK_HELP1, "Przechowuje obecny katalog dla potrzeb komendy POPD, następnie\n\ zmienia na podany.\n\n\ -PUSHD [cieka | ..]\n\n\ - cieka Okrela ciek dostpu do katalogu, podawanego do komendy\n" +PUSHD [ścieżka | ..]\n\n\ + ścieżka Określa ścieżkę dostępu do katalogu, podawanego do komendy\n" STRING_DIRSTACK_HELP2, "Zmienia katalog przechowywany w stosie przez PUSHD.\n\nPOPD" -STRING_DIRSTACK_HELP3, "Wywietla zawarto stosu katalogw.\n\nDIRS" +STRING_DIRSTACK_HELP3, "Wyświetla zawartość stosu katalogów.\n\nDIRS" -STRING_DIRSTACK_HELP4, "Stos katalogw jest pusty." +STRING_DIRSTACK_HELP4, "Stos katalogów jest pusty." -STRING_ECHO_HELP1, "Wywietla wiadomo bez nastpujcych po kadej linii znakw CR/LF.\n\n\ - ECHOS wiadomo" +STRING_ECHO_HELP1, "Wyświetla wiadomość bez następujących po każdej linii znaków CR/LF.\n\n\ + ECHOS wiadomość" -STRING_ECHO_HELP2, "Wywietla wiadomo dla domylnego odbiorcy bdw.\n\n\ - ECHOERR wiadomo)\n\ - ECHOERR. wywietla pust lini" +STRING_ECHO_HELP2, "Wyświetla wiadomość dla domyślnego odbiorcy błędów.\n\n\ + ECHOERR wiadomość)\n\ + ECHOERR. wyświetla pustą linię" -STRING_ECHO_HELP3, "Wywietla wiadomo dla domylnego odbiorcy bdw bez znakw CR/LF.\n\n\ - ECHOSERR wiadomo" +STRING_ECHO_HELP3, "Wyświetla wiadomość dla domyślnego odbiorcy błędów bez znaków CR/LF.\n\n\ + ECHOSERR wiadomość" -STRING_ECHO_HELP4, "Wywietla wiadomo albo wcza/wycza wywietlanie.\n\n\ +STRING_ECHO_HELP4, "Wyświetla wiadomość albo włącza/wyłącza wyświetlanie.\n\n\ ECHO [ON | OFF]\n\ - ECHO [wiadomo]\n\ - ECHO. wywietla pust lini\n\n\ -Wpisz ECHO bez adnych parametrw, by wywietli obecne ustawienie." + ECHO [wiadomość]\n\ + ECHO. wyświetla pustą linię\n\n\ +Wpisz ECHO bez żadnych parametrów, by wyświetlić obecne ustawienie." STRING_ECHO_HELP5, "ECHO jest %s\n" STRING_EXIT_HELP, "Zamyka okno konsoli.\n\nEXIT [/b] [kod]\n\n\ /B Zamyka jedynie plik wsadowy. \n\ - Jeli uyty bdzie poza plikiem wsadowym, zamknie cmd.exe\n\ - kod Ta warto zostanie przypisana do ERRORLEVEL przy wyjciu.\n" + Jeśli użyty będzie poza plikiem wsadowym, zamknie cmd.exe\n\ + kod Ta wartość zostanie przypisana do ERRORLEVEL przy wyjściu.\n" -STRING_FOR_HELP1, "Uruchamia wyznaczon komend dla kadego pliku w zestawie\n\n\ +STRING_FOR_HELP1, "Uruchamia wyznaczoną komendę dla każdego pliku w zestawie\n\n\ FOR %zmienna IN (zestaw) DO komenda [parametery]\n\n\ %zmienna Wyznacza zamienny parametr.\n\ - (zestaw) Definiuje zestaw plikw. Mona stosowa wieloznaczniki (np. *.*)\n\ - komenda Wyznacza komend do wykonania na zestawie plikw.\n\ + (zestaw) Definiuje zestaw plików. Można stosować wieloznaczniki (np. *.*)\n\ + komenda Wyznacza komendę do wykonania na zestawie plików.\n\ parametry Wyznacza parametry dla podanej komendy.\n\n\ -By uy FOR w pliku wsadowym, oznacz zmienn jako %%zmienna zamiast\n\ +By użyć FOR w pliku wsadowym, oznacz zmienną jako %%zmienna zamiast\n\ %zmienna.\n" -STRING_FREE_HELP1, "\nWolumin w napdzie %s ma etykiet: %-11s\n\ +STRING_FREE_HELP1, "\nWolumin w napędzie %s ma etykietę: %-11s\n\ Numer seryjny woluminu to: %s\n\ - %16s bajtw na dysku ogem\n\ - %16s bajtw zajte\n\ - %16s bajtw wolne\n" + %16s bajtów na dysku ogółem\n\ + %16s bajtów zajęte\n\ + %16s bajtów wolne\n" -STRING_FREE_HELP2, "Wywietla informacje o wolnym miejscu w napdzie.\n\nFREE [napd: ...]\n" +STRING_FREE_HELP2, "Wyświetla informacje o wolnym miejscu w napędzie.\n\nFREE [napęd: ...]\n" STRING_IF_HELP1, "Wykonuje przetwarzanie warunkowe w programach wsadowych.\n\n\ IF [NOT] ERRORLEVEL numer komenda\n\ - IF [NOT] cig_znakw1==cig_znakw2 komenda\n\ + IF [NOT] ciąg_znaków1==ciąg_znaków2 komenda\n\ IF [NOT] EXIST plik komenda\n\ IF [NOT] DEFINED zmienna komenda\n\n\ -NOT Oznacza, e CMD powinien wykona dane dziaanie tylko,\n\ - jeeli warunek nie jest speniony\n\ -ERRORLEVEL numer Zwraca PRAWDA, jeli ostatni dziaajcy program zwrci\n\ - kod bdu rwny lub wikszy od podanego.\n\ -komenda Komenda do wykonania, gdy warunek bdzie speniony.\n\ -cig1==cig2 Zwraca PRAWDA, gdy oba cigi znakw s identyczne\n\ -EXIST plik Zwraca PRAWDA, jeli podany plik istnieje.\n\ -DEFINED zmienna Zwraca PRAWDA, jeli podana zmienna zostaa zdefiniowana\n" +NOT Oznacza, że CMD powinien wykonać dane działanie tylko,\n\ + jeżeli warunek nie jest spełniony\n\ +ERRORLEVEL numer Zwraca PRAWDA, jeśli ostatni działający program zwrócił\n\ + kod błędu równy lub większy od podanego.\n\ +komenda Komenda do wykonania, gdy warunek będzie spełniony.\n\ +ciąg1==ciąg2 Zwraca PRAWDA, gdy oba ciągi znaków są identyczne\n\ +EXIST plik Zwraca PRAWDA, jeśli podany plik istnieje.\n\ +DEFINED zmienna Zwraca PRAWDA, jeśli podana zmienna została zdefiniowana\n" STRING_GOTO_HELP1, "Przekierowuje CMD do oznaczonej linii w programie wsadowym.\n\n\ GOTO etykieta\n\n\ - etykieta Cig znakw, uyty w programie wsadowym do oznaczenia linii.\n\n\ -Moesz oznaczy linie dowoln etykiet, zaczynajc od dwukropka." + etykieta Ciąg znaków, użyty w programie wsadowym do oznaczenia linii.\n\n\ +Możesz oznaczyć linie dowolną etykietą, zaczynając od dwukropka." -STRING_LABEL_HELP1, "Wywietla lub zmienia etykiet napdu.\n\nLABEL [napd:][etykieta]\n" +STRING_LABEL_HELP1, "Wyświetla lub zmienia etykietę napędu.\n\nLABEL [napęd:][etykieta]\n" -STRING_LABEL_HELP2, "Wolumin w napdzie %c: ma etykiet: %s\n" -STRING_LABEL_HELP3, "Wolumin w napdzie %c: nie posiada etykiety\n" +STRING_LABEL_HELP2, "Wolumin w napędzie %c: ma etykietę: %s\n" +STRING_LABEL_HELP3, "Wolumin w napędzie %c: nie posiada etykiety\n" STRING_LABEL_HELP4, "Numer seryjny woluminu to: %04X-%04X\n" -STRING_LABEL_HELP5, "Podaj etykiet (0-11 znakw, ENTER = brak etykiety) " +STRING_LABEL_HELP5, "Podaj etykietę (0-11 znaków, ENTER = brak etykiety) " -STRING_LOCALE_HELP1, "Czas biecy" +STRING_LOCALE_HELP1, "Czas bieżący" STRING_MKDIR_HELP, "Tworzy katalog.\n\n\ -MKDIR [napd:]cieka\nMD [napd:]cieka" +MKDIR [napęd:]ścieżka\nMD [napęd:]ścieżka" -STRING_MKLINK_HELP, "Tworzy dowizanie obiektu w systemie plikw.\n\n\ +STRING_MKLINK_HELP, "Tworzy dowiązanie obiektu w systemie plików.\n\n\ MKLINK [/D | /H | /J] nazwa_linku element_docelowy\n\n\ - /D Oznacza, e dowizanie symboliczne elementu docelowego jest katalogiem.\n\ - /H Tworzy dowizanie twarde.\n\ - /J Tworzy punkt poczenia katalogw.\n\n\ -Jeli nie zostay uyte zarwno /H jak i /J, zostanie utworzone dowizanie symboliczne." + /D Oznacza, że dowiązanie symboliczne elementu docelowego jest katalogiem.\n\ + /H Tworzy dowiązanie twarde.\n\ + /J Tworzy punkt połączenia katalogów.\n\n\ +Jeśli nie zostały użyte zarówno /H jak i /J, zostanie utworzone dowiązanie symboliczne." -STRING_MEMMORY_HELP1, "Wywietla ilo pamici systemowej.\n\nMEMORY" +STRING_MEMMORY_HELP1, "Wyświetla ilość pamięci systemowej.\n\nMEMORY" -STRING_MEMMORY_HELP2, "\n %12s%% pamici zajtej.\n\n\ - %13s bajtw pamici RAM ogem.\n\ - %13s bajtw pamici RAM dostpne.\n\n\ - %13s bajtw w pliku stronicowania ogem.\n\ - %13s bajtw dostpnych w pliku stronicowania.\n\n\ - %13s bajtw pamici wirtualnej ogem.\n\ - %13s bajtw pamici wirtualnej dostpne.\n" +STRING_MEMMORY_HELP2, "\n %12s%% pamięci zajętej.\n\n\ + %13s bajtów pamięci RAM ogółem.\n\ + %13s bajtów pamięci RAM dostępne.\n\n\ + %13s bajtów w pliku stronicowania ogółem.\n\ + %13s bajtów dostępnych w pliku stronicowania.\n\n\ + %13s bajtów pamięci wirtualnej ogółem.\n\ + %13s bajtów pamięci wirtualnej dostępne.\n" -STRING_MISC_HELP1, "Nacinij dowolny klawisz, aby kontynuowa...\n" +STRING_MISC_HELP1, "Naciśnij dowolny klawisz, aby kontynuować...\n" -STRING_MOVE_HELP1, "Nadpisa %s (Tak/Nie/Zawsze)? " +STRING_MOVE_HELP1, "Nadpisać %s (Tak/Nie/Zawsze)? " -STRING_MOVE_HELP2, "Przenosi, a take zmienia nazwy plikw i katalogw.\n\n\ -Aby przenie jeden lub wicej plikw:\n\ -MOVE [/N][napd:][cieka]nazwa_pliku1[,...] cel\n\n\ -Aby zmieni nazw katalogu:\n\ -MOVE [/N][napd:][cieka]nazwa1 nazwa2\n\n\ - [napd:][cieka]nazwa Wyznacza sciek dostpu do pliku lub \n\ - plikw, ktre chcesz przenie.\n\ - /N Nic. Zrb wszystko, oprcz przenoszenia plikw/katalogw.\n\n\ +STRING_MOVE_HELP2, "Przenosi, a także zmienia nazwy plików i katalogów.\n\n\ +Aby przenieść jeden lub więcej plików:\n\ +MOVE [/N][napęd:][ścieżka]nazwa_pliku1[,...] cel\n\n\ +Aby zmienić nazwę katalogu:\n\ +MOVE [/N][napęd:][ścieżka]nazwa1 nazwa2\n\n\ + [napęd:][ścieżka]nazwa Wyznacza scieżkę dostępu do pliku lub \n\ + plików, które chcesz przenieść.\n\ + /N Nic. Zrób wszystko, oprócz przenoszenia plików/katalogów.\n\n\ Obecne ograniczenia:\n\ - - Nie moesz przenie pliku ani katalogu z jednego napdu na inny.\n" + - Nie możesz przenieść pliku ani katalogu z jednego napędu na inny.\n" -STRING_MSGBOX_HELP, "Wywietla okno dialogowe i zwraca odpowied uytkownika\n\n\ -MSGBOX typ ['tytu'] tekst\n\n\ +STRING_MSGBOX_HELP, "Wyświetla okno dialogowe i zwraca odpowiedź użytkownika\n\n\ +MSGBOX typ ['tytuł'] tekst\n\n\ typ Rodzaj okna dialogowego\n\ - moliwe okna: OK, OKCANCEL,\n\ + możliwe okna: OK, OKCANCEL,\n\ YESNO, YESNOCANCEL\n\ -tytu Tytu okna dialogowego\n\ -tekst Tekst wywietlony w oknie dialogowym\n\n\n\ -Warto ERRORLEVEL wynosi zalenie od nacinitego przycisku:\n\n\ +tytuł Tytuł okna dialogowego\n\ +tekst Tekst wyświetlony w oknie dialogowym\n\n\n\ +Wartość ERRORLEVEL wynosi zależnie od naciśniętego przycisku:\n\n\ TAK : 10 | NIE : 11\n\ OK : 10 | ANULUJ : 12\n" -STRING_PATH_HELP1, "Wywietla lub ustawia ciek dostpu dla programw.\n\n\ -PATH [[napd:]cieka[;...]]\nPATH ;\n\n\ -Wpisz PATH ; jeli chcesz wyczyci wszystkie zapisane cieki dostpu i zmusi konsol\n\ -do przeszukiwania wycznie katalogu biecego.\n\ -Wpisz PATH bez adnych parametrw, by wywietli zapisane cieki dostpu.\n" +STRING_PATH_HELP1, "Wyświetla lub ustawia ścieżkę dostępu dla programów.\n\n\ +PATH [[napęd:]ścieżka[;...]]\nPATH ;\n\n\ +Wpisz PATH ; jeśli chcesz wyczyścić wszystkie zapisane ścieżki dostępu i zmusić konsolę\n\ +do przeszukiwania wyłącznie katalogu bieżącego.\n\ +Wpisz PATH bez żadnych parametrów, by wyświetlić zapisane ścieżki dostępu.\n" -STRING_PROMPT_HELP1, "Zmienia znak zachty.\n\n\ +STRING_PROMPT_HELP1, "Zmienia znak zachęty.\n\n\ PROMPT [tekst]\n\n\ - tekst Definiuje nowy znak zachty.\n\n\ -Znak zachty moe skada si z normalnych znakw, a take poniszych symboli:\n\n\ + tekst Definiuje nowy znak zachęty.\n\n\ +Znak zachęty może składać się z normalnych znaków, a także poniższych symboli:\n\n\ $A & (Et)\n\ $B | \n\ $C ( (lewy nawias)\n\ - $D Bieca data\n\ + $D Bieżąca data\n\ $E Znak ucieczki (kod ASCII 27)\n\ $F ) (prawy nawias)\n\ - $G > (znak wikszoci)\n\ + $G > (znak większości)\n\ $H (usuwa ostatni znak)\n\ - $L < (znak mniejszoci)\n\ - $N Biecy napd\n\ - $P Biecy napd i cieka\n\ - $Q = (znak rwnoci)\n\ - $T Biecy czas\n\ + $L < (znak mniejszości)\n\ + $N Bieżący napęd\n\ + $P Bieżący napęd i ścieżka\n\ + $Q = (znak równości)\n\ + $T Bieżący czas\n\ $V Wersja systemu\n\ $_ Znak CR/LF\n\ $$ $ (dolar)\n" -STRING_PAUSE_HELP1, "Zatrzymuje wykonywanie programu wsadowego i pokazuje wiadomo:\n\ -'Nacinij dowolny klawisz, aby kontynuowa...' albo inn dowoln.\n\n\ -PAUSE [wiadomo]" +STRING_PAUSE_HELP1, "Zatrzymuje wykonywanie programu wsadowego i pokazuje wiadomość:\n\ +'Naciśnij dowolny klawisz, aby kontynuować...' albo inną dowolną.\n\n\ +PAUSE [wiadomość]" -STRING_PROMPT_HELP2, " $+ Wywietla obecny poziom stosu katalogw" +STRING_PROMPT_HELP2, " $+ Wyświetla obecny poziom stosu katalogów" -STRING_PROMPT_HELP3, "\nWpisz PROMPT bez adnych parametrw, by powrci do ustawie domylnych." +STRING_PROMPT_HELP3, "\nWpisz PROMPT bez żadnych parametrów, by powrócić do ustawień domyślnych." -STRING_REM_HELP, "Definiuje lini komentarza w pliku wsadowym.\n\nREM [komentarz]" +STRING_REM_HELP, "Definiuje linię komentarza w pliku wsadowym.\n\nREM [komentarz]" STRING_RMDIR_HELP, "Usuwa katalog.\n\n\ -RMDIR [napd:]cieka\nRD [napd:]cieka\n\ -/S Kasuje take wszystkie pliki i podkatalogi w danym katalogu\n\ -/Q Nie wywietla proby o potwierdzenie\n" +RMDIR [napęd:]ścieżka\nRD [napęd:]ścieżka\n\ +/S Kasuje także wszystkie pliki i podkatalogi w danym katalogu\n\ +/Q Nie wyświetla prośby o potwierdzenie\n" STRING_RMDIR_HELP2, "Katalog nie jest pusty!\n" -STRING_REN_HELP1, "Zmienia nazw pliku/katalogu (take wielu).\n\n\ +STRING_REN_HELP1, "Zmienia nazwę pliku/katalogu (także wielu).\n\n\ RENAME [/E /N /P /Q /S /T] stara_nazwa ... nowa_nazwa\n\ REN [/E /N /P /Q /S /T] stara_nazwa ... nowa_nazwa\n\n\ - /E Bez komunikatw o bdach.\n\ + /E Bez komunikatów o błędach.\n\ /N Nic.\n\ - /P Wywietla prob o potwierdzenie przed kadym plikiem/katalogiem.\n\ + /P Wyświetla prośbę o potwierdzenie przed każdym plikiem/katalogiem.\n\ (nie jest jeszcze zaimplementowane)\n\ /Q Tryb cichy.\n\ - /S Zmienia take nazwy podkatalogw.\n\ - /T Wywietla podsumowanie iloci zmienionych nazw.\n\n\ -Uwaga: moesz rwnie poda now ciek dostpu dla zmienionych plikw. Uyj\n\ + /S Zmienia także nazwy podkatalogów.\n\ + /T Wyświetla podsumowanie ilości zmienionych nazw.\n\n\ +Uwaga: możesz również podać nową ścieżkę dostępu dla zmienionych plików. Użyj\n\ do tego komendy MOVE.\n" -STRING_REN_HELP2, " zmieniono nazw %lu pliku\n" +STRING_REN_HELP2, " zmieniono nazwę %lu pliku\n" -STRING_REN_HELP3, " zmieniono nazwy %lu plikw\n" +STRING_REN_HELP3, " zmieniono nazwy %lu plików\n" -STRING_SHIFT_HELP, "Zmienia pozycj parametru w pliku wsadowym.\n\n\ +STRING_SHIFT_HELP, "Zmienia pozycję parametru w pliku wsadowym.\n\n\ SHIFT [DOWN]" -STRING_SCREEN_HELP, "Przesuwa kursor i opcjonalnie wywietla tekst\n\n\ -SCREEN rzd kolumna [tekst]\n\n\ - rzd numer rzdu, do ktrego zostanie przesunity kursor\n\ - kolumna numer kolumny, do ktrej zostanie przesunity kursor" +STRING_SCREEN_HELP, "Przesuwa kursor i opcjonalnie wyświetla tekst\n\n\ +SCREEN rząd kolumna [tekst]\n\n\ + rząd numer rzędu, do którego zostanie przesunięty kursor\n\ + kolumna numer kolumny, do której zostanie przesunięty kursor" -STRING_SET_HELP, "Wywietla, ustawia lub usuwa zmienne rodowiskowe.\n\n\ +STRING_SET_HELP, "Wyświetla, ustawia lub usuwa zmienne środowiskowe.\n\n\ SET [zmienna[=][parametry]]\n\n\ - zmienna Okrela nazw zmiennej rodowiskowej.\n\ - parametry Okrela parametry przypisane do tej zmiennej.\n\n\ -Wpisz SET bez adnych parametrw, by wywietli obecne ustawienia zmiennych.\n" + zmienna Określa nazwę zmiennej środowiskowej.\n\ + parametry Określa parametry przypisane do tej zmiennej.\n\n\ +Wpisz SET bez żadnych parametrów, by wyświetlić obecne ustawienia zmiennych.\n" -STRING_START_HELP1, "Wywouje komend.\n\n\ +STRING_START_HELP1, "Wywołuje komendę.\n\n\ START komenda\n\n\ - komenda Okrela komend, jaka ma by wywoana.\n\n\ -Obecnie wszystkie komendy s uruchamiane asynchronicznie.\n" + komenda Określa komendę, jaka ma być wywołana.\n\n\ +Obecnie wszystkie komendy są uruchamiane asynchronicznie.\n" -STRING_TITLE_HELP, "Ustawia tytu dla okna ze znakiem zachty.\n\n\ -TITLE [tytu]\n\n\ -tytu Okrela tytu dla okna.\n" +STRING_TITLE_HELP, "Ustawia tytuł dla okna ze znakiem zachęty.\n\n\ +TITLE [tytuł]\n\n\ +tytuł Określa tytuł dla okna.\n" -STRING_TIME_HELP1, "Wywietla lub ustawia czas systemowy.\n\n\ +STRING_TIME_HELP1, "Wyświetla lub ustawia czas systemowy.\n\n\ TIME [/T][czas]\n\n\ - /T tylko wywietla\n\n\ -Wpisz TIME bez adnych parametrw, by wywietli obecny czas i\n\ -zapyta o nowy. Nacinicie ENTER bez podawania czasu zachowuje obecny.\n" + /T tylko wyświetla\n\n\ +Wpisz TIME bez żadnych parametrów, by wyświetlić obecny czas i\n\ +zapytać o nowy. Naciśnięcie ENTER bez podawania czasu zachowuje obecny.\n" -STRING_TIME_HELP2, "Wprowad nowy czas: " +STRING_TIME_HELP2, "Wprowadź nowy czas: " -STRING_TIMER_HELP1, "Upyno %d milisek.\n" +STRING_TIMER_HELP1, "Upłynęło %d milisek.\n" -STRING_TIMER_HELP2, "Upyno %02d%c%02d%c%02d%c%02d\n" +STRING_TIMER_HELP2, "Upłynęło %02d%c%02d%c%02d%c%02d\n" -STRING_TIMER_HELP3, "Umoliwia uycie stoperw (maksymalnie 10 na raz).\n\n\ +STRING_TIMER_HELP3, "Umożliwia użycie stoperów (maksymalnie 10 na raz).\n\n\ TIMER [ON|OFF] [/S] [/n] [/Fn]\n\n\ ON uruchamia stoper\n\ - OFF wycza stoper\n\ - /S Dzieli czas. Zwraca poow czasu\n\ + OFF wyłącza stoper\n\ + /S Dzieli czas. Zwraca połowę czasu\n\ na stoperze, bez zmieniania go.\n\ /n Definiuje numer stopera.\n\ - Dostpne s numery od 0 do 9\n\ - Domylnie stoper dostaje numer 1\n\ - /Fn Format wywietlania czasu,\n\ - n moliwoci:\n\ + Dostępne są numery od 0 do 9\n\ + Domyślnie stoper dostaje numer 1\n\ + /Fn Format wyświetlania czasu,\n\ + n możliwości:\n\ 0 millisekundy\n\ 1 hh%cmm%css%cdd\n\n\ -jeli nie podano w skadni parametrw: ON, OFF or /S, \n\ +jeśli nie podano w składni parametrów: ON, OFF or /S, \n\ komenda zmieni obecny stan stopera\n\n" -STRING_TYPE_HELP1, "Wywietla zawarto plikw tekstowych.\n\nTYPE [napd:][cieka]nazwa_pliku \n\ - /P Pauzuje po kadym penym ekranie.\n" +STRING_TYPE_HELP1, "Wyświetla zawartość plików tekstowych.\n\nTYPE [napęd:][ścieżka]nazwa_pliku \n\ + /P Pauzuje po każdym pełnym ekranie.\n" -STRING_VERIFY_HELP1, "Ta komenda jest tylko na podpuch\ -Odpowiada za to, czy po zapisaniu plikw ma nastpi sprawdzenie\n\ -poprawnoci tego zapisu.\n\n\ +STRING_VERIFY_HELP1, "Ta komenda jest tylko na podpuchę\ +Odpowiada za to, czy po zapisaniu plików ma nastąpić sprawdzenie\n\ +poprawności tego zapisu.\n\n\ VERIFY [ON | OFF]\n\n\ -Wpisz VERIFY bez adnych parametrw by sprawdzi aktualne ustawienie komendy.\n" +Wpisz VERIFY bez żadnych parametrów by sprawdzić aktualne ustawienie komendy.\n" STRING_VERIFY_HELP2, "Stan VERIFY: %s.\n" -STRING_VERIFY_HELP3, "Musisz okreli: ON czy OFF." +STRING_VERIFY_HELP3, "Musisz określić: ON czy OFF." -STRING_VERSION_HELP1, "Wywietla informacje o wersji powoki\n\n\ +STRING_VERSION_HELP1, "Wyświetla informacje o wersji powłoki\n\n\ VER [/C][/R][/W]\n\n\ - /C Wywietla podzikowania.\n\ - /R Wywietla informacje o redystrybucji.\n\ - /W Wywietla informacje o gwarancji." + /C Wyświetla podziękowania.\n\ + /R Wyświetla informacje o redystrybucji.\n\ + /W Wyświetla informacje o gwarancji." -STRING_VERSION_HELP2, " jest rozpowszechniany BEZ ADNEJ GWARANCJI; szczegy\n\ -dostpne - wpisz: `ver /w'. To jest darmowe oprogramowanie, i mona je\n\ -rozpowszechnia pod pewnymi warunkami: wpisz `ver /r'. Lista podzikowa pod\n\ +STRING_VERSION_HELP2, " jest rozpowszechniany BEZ ŻADNEJ GWARANCJI; szczegóły\n\ +dostępne - wpisz: `ver /w'. To jest darmowe oprogramowanie, i można je\n\ +rozpowszechniać pod pewnymi warunkami: wpisz `ver /r'. Lista podziękowań pod\n\ parametrem: `ver /c'." -STRING_VERSION_HELP3, "\n Program ten jest rozpowszechniany w dobrej wierze, ze wzgldu\n\ - na jego uyteczno, ale BEZ ADNEJ GWARANCJI; nie jest on przeznaczony\n\ - NA SPRZEDA, ani do uytku profesjonalnego. Szczegy dostpne w\n\ +STRING_VERSION_HELP3, "\n Program ten jest rozpowszechniany w dobrej wierze, ze względu\n\ + na jego użyteczność, ale BEZ ŻADNEJ GWARANCJI; nie jest on przeznaczony\n\ + NA SPRZEDAŻ, ani do użytku profesjonalnego. Szczegóły dostępne w\n\ GNU General Public License." -STRING_VERSION_HELP4, "\n To jest darmowe oprogramowanie; moesz je rozpowszechnia i modyfikowa,\n\ -o ile nie naruszasz warunkw GNU General Public License, w formie opublikowanej\n\ -przez Free Software Foundation; wersja 2 albo dowolna pniejsza.\n" +STRING_VERSION_HELP4, "\n To jest darmowe oprogramowanie; możesz je rozpowszechniać i modyfikować,\n\ +o ile nie naruszasz warunków GNU General Public License, w formie opublikowanej\n\ +przez Free Software Foundation; wersja 2 albo dowolna późniejsza.\n" -STRING_VERSION_HELP5, "\nRaporty o bdach prosimy przesya pod adres: .\n\ -Uaktualnienia dostpne na stronie: http://www.reactos.org" +STRING_VERSION_HELP5, "\nRaporty o błędach prosimy przesyłać pod adres: .\n\ +Uaktualnienia dostępne na stronie: http://www.reactos.org" STRING_VERSION_HELP6, "\nwersja FreeDOS, napisana przez:\n" STRING_VERSION_HELP7, "\nwersja ReactOS, napisana przez:\n" -STRING_VOL_HELP1, " Wolumin w napdzie %c ma etykiet: %s" -STRING_VOL_HELP2, " Wolumin w napdzie %c nie posiada etykiety.\n" +STRING_VOL_HELP1, " Wolumin w napędzie %c ma etykietę: %s" +STRING_VOL_HELP2, " Wolumin w napędzie %c nie posiada etykiety.\n" STRING_VOL_HELP3, " Numer seryjny woluminu to: %04X-%04X\n" -STRING_VOL_HELP4, "Wywietla etykiet woluminu w danym napdzie (o ile istnieje) i jego numer seryjny.\n\nVOL [napd:]" +STRING_VOL_HELP4, "Wyświetla etykietę woluminu w danym napędzie (o ile istnieje) i jego numer seryjny.\n\nVOL [napęd:]" -STRING_WINDOW_HELP1, "Zmienia wymiar i pozycj danego okna konsoli\n\n\ +STRING_WINDOW_HELP1, "Zmienia wymiar i pozycję danego okna konsoli\n\n\ WINDOW [/POS[=]left,top,width,heigth]\n\ - [MIN|MAX|RESTORE] ['tytu']\n\n\ -/POS okrela pooenie i rozmiary okna\n\ + [MIN|MAX|RESTORE] ['tytuł']\n\n\ +/POS określa położenie i rozmiary okna\n\ MIN minimalizuje okno\n\ MAX maksymalizuje okno\n\ RESTORE odtwarza standardowe ustawienia okna" -STRING_WINDOW_HELP2, "Zmienia wymiar i pozycj okrelonego okna konsoli\n\n\ -ACTIVATE 'tytu' [/POS[=]left,top,width,heigth]\n\ - [MIN|MAX|RESTORE] ['nowy_tytu']\n\n\ -window tytu okna, na ktrym zostan przeprowadzone zmiany\n\ -/POS okrela pooenie i rozmiary okna\n\ +STRING_WINDOW_HELP2, "Zmienia wymiar i pozycję określonego okna konsoli\n\n\ +ACTIVATE 'tytuł' [/POS[=]left,top,width,heigth]\n\ + [MIN|MAX|RESTORE] ['nowy_tytuł']\n\n\ +window tytuł okna, na którym zostaną przeprowadzone zmiany\n\ +/POS określa położenie i rozmiary okna\n\ MIN minimalizuje okno\n\ MAX maksymalizuje okno\n\ RESTORE odtwarza standardowe ustawienia okna\n\ -title nowy tytu okna\n" +title nowy tytuł okna\n" -STRING_HELP1, "Lista wszystkich dostpnych komend (+opisy)\n\n\ - komenda /? Wywietla dokadny opis danej komendy\n\n\ -? Lista wszystkich dostpnych komend (bez opisw).\n\ +STRING_HELP1, "Lista wszystkich dostępnych komend (+opisy)\n\n\ + komenda /? Wyświetla dokładny opis danej komendy\n\n\ +? Lista wszystkich dostępnych komend (bez opisów).\n\ ALIAS Ustawia, pokazuje lub usuwa aliasy.\n\ -ATTRIB Wywietla lub zmienia atrybuty plikw.\n\ -BEEP Sygna przez gonik PC.\n\ -CALL Wywouje program wsadowy z poziomu innego.\n\ -CD Wywietla ciek lub przechodzi do innego katalogu.\n\ -CHCP Wywietla lub ustawia biec stron kodow.\n\ -CHOICE Przedstawia uytkownikowi kilka moliwoci i czeka na wybr.\n\ -CLS Czyci ekran.\n\ +ATTRIB Wyświetla lub zmienia atrybuty plików.\n\ +BEEP Sygnał przez głośnik PC.\n\ +CALL Wywołuje program wsadowy z poziomu innego.\n\ +CD Wyświetla ścieżkę lub przechodzi do innego katalogu.\n\ +CHCP Wyświetla lub ustawia bieżącą stronę kodową.\n\ +CHOICE Przedstawia użytkownikowi kilka możliwości i czeka na wybór.\n\ +CLS Czyści ekran.\n\ CMD Uruchamia kolejne okno konsoli ReactOS.\n\ -COLOR Ustawia kolory ta i tekstu w oknie konsoli.\n\ -COPY Kopiuje jeden lub wicej plikw w inne miejsce.\n\ -DATE Wywietla lub ustawia dat.\n\ -DELETE Kasuje jeden lub wicej plikw.\n\ -DIR Wywietla list plikw i podkatalogw w danym katalogu.\n\ -ECHO Wywietla wiadomoci albo wcza/wycza komend ECHO.\n\ -ERASE Kasuje jeden lub wicej plikw.\n\ -EXIT Zamyka biece okno konsoli.\n\ -FOR Wykonuje okrelon komend dla kadego pliku z okrelonej listy.\n\ +COLOR Ustawia kolory tła i tekstu w oknie konsoli.\n\ +COPY Kopiuje jeden lub więcej plików w inne miejsce.\n\ +DATE Wyświetla lub ustawia datę.\n\ +DELETE Kasuje jeden lub więcej plików.\n\ +DIR Wyświetla listę plików i podkatalogów w danym katalogu.\n\ +ECHO Wyświetla wiadomości albo włącza/wyłącza komendę ECHO.\n\ +ERASE Kasuje jeden lub więcej plików.\n\ +EXIT Zamyka bieżące okno konsoli.\n\ +FOR Wykonuje określoną komendę dla każdego pliku z określonej listy.\n\ FREE Wolne miejsce na dysku.\n\ -GOTO Kieruje interpreter polece do okrelonej linii,\n\ +GOTO Kieruje interpreter poleceń do określonej linii,\n\ oznaczonej, w danym programie wsadowym.\n\ HELP Lista komend konsoli ReactOS wraz z opisem.\n\ -HISTORY Lista uytych komend.\n\ +HISTORY Lista użytych komend.\n\ IF Przetwarzanie warunkowe w programach wsadowych.\n\ -LABEL Tworzy, zmienia lub kasuje etykiet woluminu w danym napdzie.\n\ +LABEL Tworzy, zmienia lub kasuje etykietę woluminu w danym napędzie.\n\ MD Tworzy katalog.\n\ MKDIR Tworzy katalog.\n\ -MKLINK Tworzy dowizanie obiektu w systemie plikw.\n\ -MOVE Przenosi jeden lub wicej plikw z jednego katalogu do drugiego.\n\ -PATH Wywietla lub ustawia cieki dostpu dla programw.\n\ -PAUSE Zawiesza przetwarzanie programu wsadowego i wywietla komunikat.\n\ -POPD Odtwarza poprzedni nazw danego katalogu, zapisan przez\n\ +MKLINK Tworzy dowiązanie obiektu w systemie plików.\n\ +MOVE Przenosi jeden lub więcej plików z jednego katalogu do drugiego.\n\ +PATH Wyświetla lub ustawia ścieżki dostępu dla programów.\n\ +PAUSE Zawiesza przetwarzanie programu wsadowego i wyświetla komunikat.\n\ +POPD Odtwarza poprzednią nazwę danego katalogu, zapisaną przez\n\ PUSHD.\n\ -PROMPT Zmienia znak zachty w linii polece.\n\ -PUSHD Zapisuje obecn nazw katalogu, po czym zmienia j.\n\ +PROMPT Zmienia znak zachęty w linii poleceń.\n\ +PUSHD Zapisuje obecną nazwę katalogu, po czym zmienia ją.\n\ RD Usuwa katalog.\n\ REM Oznaczenie linii komentarza w programie wsadowym.\n\ -REN Zmienia nazw pliku lub plikw.\n\ -RENAME Zmienia nazw pliku lub plikw.\n\ +REN Zmienia nazwę pliku lub plików.\n\ +RENAME Zmienia nazwę pliku lub plików.\n\ RMDIR Usuwa katalog.\n\ -SCREEN Przenosi kursor i opcjonalnie wywietla tekst.\n\ -SET Wywietla, ustawia lub usuwa zmienne rodowiskowe.\n\ +SCREEN Przenosi kursor i opcjonalnie wyświetla tekst.\n\ +SET Wyświetla, ustawia lub usuwa zmienne środowiskowe.\n\ SHIFT Przenosi zamienne parametry w programach wsadowych.\n" -STRING_HELP2, "START Uruchamia oddzielne okno do wykonania okrelonego polecenia lub komendy.\n\ +STRING_HELP2, "START Uruchamia oddzielne okno do wykonania określonego polecenia lub komendy.\n\ Wykonuje polecenie.\n\ -TIME Wywietla lub zmienia czas systemowy.\n\ -TIMER Pozwala na uycie do 10 stoperw.\n\ -TITLE Ustanawia tytu dla danej sesji CMD.EXE.\n\ -TYPE Wywietla zawarto pliku tekstowego.\n\ -VER Wywietla wersj systemu ReactOS.\n\ -VERIFY Decyduje czy ReactOS ma sprawdza poprawno zapisu plikw\n\ +TIME Wyświetla lub zmienia czas systemowy.\n\ +TIMER Pozwala na użycie do 10 stoperów.\n\ +TITLE Ustanawia tytuł dla danej sesji CMD.EXE.\n\ +TYPE Wyświetla zawartość pliku tekstowego.\n\ +VER Wyświetla wersję systemu ReactOS.\n\ +VERIFY Decyduje czy ReactOS ma sprawdzać poprawność zapisu plików\n\ na dysku.\n\ -VOL Wywietla etykiet woluminu na danym napdzie i numer seryjny.\n" +VOL Wyświetla etykietę woluminu na danym napędzie i numer seryjny.\n" STRING_CHOICE_OPTION, "TN" STRING_COPY_OPTION, "TNZ" -STRING_ALIAS_ERROR, "Linia polece zbyt duga po rozszerzeniu aliasa!\n" +STRING_ALIAS_ERROR, "Linia poleceń zbyt długa po rozszerzeniu aliasa!\n" STRING_ASSOC_ERROR, "File association not found for extension %s\n" -STRING_BATCH_ERROR, "Bd podczas otwierania pliku wsadowego\n" +STRING_BATCH_ERROR, "Błąd podczas otwierania pliku wsadowego\n" STRING_CHCP_ERROR1, "Aktywna strona kodowa nr: %u\n" -STRING_CHCP_ERROR4, "Niewaciwy numer strony kodowej\n" +STRING_CHCP_ERROR4, "Niewłaściwy numer strony kodowej\n" STRING_CHOICE_ERROR, "Parametr niepoprawny. Poprawna forma: /C[:]opcja" STRING_CHOICE_ERROR_TXT, "Parametr niepoprawny. Poprawna forma: /T[:]c,nn" -STRING_CHOICE_ERROR_OPTION, "Zy parametr: %s" -STRING_MD_ERROR, "Istnieje ju plik lub podkatalog o tej nazwie.\n" -STRING_MD_ERROR2, "cieka do nowego katalogu nie jest prawidowa.\n" -STRING_CMD_ERROR1, "Nie mona przekierowa danych z pliku %s\n" -STRING_CMD_ERROR2, "Bd podczas tworzenia potokowego pliku tymczasowego\n" -STRING_CMD_ERROR3, "Nie mona przekierowa do pliku %s\n" +STRING_CHOICE_ERROR_OPTION, "Zły parametr: %s" +STRING_MD_ERROR, "Istnieje już plik lub podkatalog o tej nazwie.\n" +STRING_MD_ERROR2, "Ścieżka do nowego katalogu nie jest prawidłowa.\n" +STRING_CMD_ERROR1, "Nie można przekierować danych z pliku %s\n" +STRING_CMD_ERROR2, "Błąd podczas tworzenia potokowego pliku tymczasowego\n" +STRING_CMD_ERROR3, "Nie można przekierować do pliku %s\n" STRING_CMD_ERROR4, "Wykonywanie %s...\n" STRING_CMD_ERROR5, "Wykonywanie cmdexit.bat...\n" -STRING_COLOR_ERROR1, "Bd! Kolor ta i tekstu nie moe by taki sam" -STRING_COLOR_ERROR2, "Bd w oznaczeniu kolorw." +STRING_COLOR_ERROR1, "Błąd! Kolor tła i tekstu nie może być taki sam" +STRING_COLOR_ERROR2, "Błąd w oznaczeniu kolorów." STRING_COLOR_ERROR3, "Kolor %x\n" -STRING_COLOR_ERROR4, "Bd - kolory takie same!" -STRING_CONSOLE_ERROR, "Nieznany bd: %d\n" -STRING_COPY_ERROR1, "Bd: Nie mona otworzy rda - %s!\n" -STRING_COPY_ERROR2, "Bd: Nie mona przekopiowa pliku na niego samego!\n" -STRING_COPY_ERROR3, "Bd zapisu na miejscu docelowym!\n" -STRING_COPY_ERROR4, "Bd: Nie zaimplementowano!\n" -STRING_DATE_ERROR, "Data nieprawidowa." +STRING_COLOR_ERROR4, "Błąd - kolory takie same!" +STRING_CONSOLE_ERROR, "Nieznany błąd: %d\n" +STRING_COPY_ERROR1, "Błąd: Nie można otworzyć źródła - %s!\n" +STRING_COPY_ERROR2, "Błąd: Nie można przekopiować pliku na niego samego!\n" +STRING_COPY_ERROR3, "Błąd zapisu na miejscu docelowym!\n" +STRING_COPY_ERROR4, "Błąd: Nie zaimplementowano!\n" +STRING_DATE_ERROR, "Data nieprawidłowa." STRING_DEL_ERROR5, "Plik %s zostanie skasowany! " -STRING_DEL_ERROR6, "Czy jeste pewien (T/N)?" +STRING_DEL_ERROR6, "Czy jesteś pewien (T/N)?" STRING_DEL_ERROR7, "Kasowanie: %s\n" -STRING_ERROR_ERROR1, "Nieznany bd! Kod bdu: 0x%lx\n" -STRING_ERROR_ERROR2, "Bd skadni" +STRING_ERROR_ERROR1, "Nieznany błąd! Kod błędu: 0x%lx\n" +STRING_ERROR_ERROR2, "Błąd składni" STRING_FOR_ERROR1, "Brak 'in' dla twierdzenia." -STRING_FOR_ERROR2, "Nawias nie zosta znaleziony." +STRING_FOR_ERROR2, "Nawias nie został znaleziony." STRING_FOR_ERROR3, "Brakuje 'do'." STRING_FOR_ERROR4, "Brak komendy po 'do'." -STRING_FREE_ERROR1, "Nieprawidowa litera napdu" +STRING_FREE_ERROR1, "Nieprawidłowa litera napędu" STRING_FREE_ERROR2, "brak" STRING_GOTO_ERROR1, "Brak etykiety dla GOTO" -STRING_GOTO_ERROR2, "Etykieta '%s' nie zostaa znaleziona\n" +STRING_GOTO_ERROR2, "Etykieta '%s' nie została znaleziona\n" STRING_MOVE_ERROR1, "[OK]\n" -STRING_MOVE_ERROR2, "[Bd]\n" +STRING_MOVE_ERROR2, "[Błąd]\n" -STRING_REN_ERROR1, "MoveFile() nieudane. Bd: %lu\n" +STRING_REN_ERROR1, "MoveFile() nieudane. Błąd: %lu\n" -STRING_START_ERROR1, "Programy wsadowe nie zostay jeszcze zaimplementowane!" +STRING_START_ERROR1, "Programy wsadowe nie zostały jeszcze zaimplementowane!" -STRING_TIME_ERROR1, "Nieprawidowy czas." +STRING_TIME_ERROR1, "Nieprawidłowy czas." -STRING_TYPE_ERROR1, "Nieprawidowa opcja '/%s'\n" +STRING_TYPE_ERROR1, "Nieprawidłowa opcja '/%s'\n" -STRING_WINDOW_ERROR1, "Okno nie zostao odnalezione" +STRING_WINDOW_ERROR1, "Okno nie zostało odnalezione" -STRING_ERROR_PARAMETERF_ERROR, "Format parametrw nieprawidowy - %c\n" -STRING_ERROR_INVALID_SWITCH, "Niewaciwy argument - /%c\n" -STRING_ERROR_TOO_MANY_PARAMETERS, "Zbyt wiele parametrw - %s\n" -STRING_ERROR_PATH_NOT_FOUND, "cieka nie zostaa znaleziona\n" -STRING_ERROR_FILE_NOT_FOUND, "Plik nie zosta znaleziony\n" +STRING_ERROR_PARAMETERF_ERROR, "Format parametrów nieprawidłowy - %c\n" +STRING_ERROR_INVALID_SWITCH, "Niewłaściwy argument - /%c\n" +STRING_ERROR_TOO_MANY_PARAMETERS, "Zbyt wiele parametrów - %s\n" +STRING_ERROR_PATH_NOT_FOUND, "Ścieżka nie została znaleziona\n" +STRING_ERROR_FILE_NOT_FOUND, "Plik nie został znaleziony\n" STRING_ERROR_REQ_PARAM_MISSING, "Brak wymaganego parametru\n" -STRING_ERROR_INVALID_DRIVE, "Nieprawidowe okrelenie napdu\n" -STRING_ERROR_INVALID_PARAM_FORMAT, "Niewaciwy format parametru - %s\n" -STRING_ERROR_BADCOMMAND, "Nieprawidowa komenda lub nazwa pliku - %s\n" -STRING_ERROR_OUT_OF_MEMORY, "Bd - brak pamici.\n" -STRING_ERROR_CANNOTPIPE, "Bd potokw! Nie mona otworzy pliku tymczasowego.\n" -STRING_ERROR_D_PAUSEMSG, "Nacinij dowolny klawisz, aby kontynuowa . . ." -STRING_ERROR_DRIVER_NOT_READY, "Napd nie jest gotowy" +STRING_ERROR_INVALID_DRIVE, "Nieprawidłowe określenie napędu\n" +STRING_ERROR_INVALID_PARAM_FORMAT, "Niewłaściwy format parametru - %s\n" +STRING_ERROR_BADCOMMAND, "Nieprawidłowa komenda lub nazwa pliku - %s\n" +STRING_ERROR_OUT_OF_MEMORY, "Błąd - brak pamięci.\n" +STRING_ERROR_CANNOTPIPE, "Błąd potoków! Nie można otworzyć pliku tymczasowego.\n" +STRING_ERROR_D_PAUSEMSG, "Naciśnij dowolny klawisz, aby kontynuować . . ." +STRING_ERROR_DRIVER_NOT_READY, "Napęd nie jest gotowy" -STRING_PATH_ERROR, "CMD: Poza rodowiskiem '%s'\n" +STRING_PATH_ERROR, "CMD: Poza środowiskiem '%s'\n" STRING_REACTOS_VERSION, "ReactOS Operating System [Version %s-%s]\n" -STRING_CMD_SHELLINFO, "\nInterpreter linii polece ReactOS\nVersion %s %s" -STRING_VERSION_RUNVER, " dziaajcy na %s" -STRING_COPY_FILE , " %d plik(w) skopiowano\n" +STRING_CMD_SHELLINFO, "\nInterpreter linii poleceń ReactOS\nVersion %s %s" +STRING_VERSION_RUNVER, " działający na %s" +STRING_COPY_FILE , " %d plik(ów) skopiowano\n" STRING_DELETE_WIPE, "skasowano" -STRING_FOR_ERROR, "ze okrelenie zmiennej." -STRING_SCREEN_COL, "nieprawidowy numer kolumny" -STRING_SCREEN_ROW, "nieprawidowy numer rzdu" +STRING_FOR_ERROR, "złe określenie zmiennej." +STRING_SCREEN_COL, "nieprawidłowy numer kolumny" +STRING_SCREEN_ROW, "nieprawidłowy numer rzędu" STRING_TIMER_TIME "Stoper %d czas - %s: " -STRING_MKLINK_CREATED_SYMBOLIC, "Dowizanie symboliczne utworzone dla %s <<===>> %s\n" -STRING_MKLINK_CREATED_HARD, "Dowizanie twarde utworzone dla %s <<===>> %s\n" -STRING_MKLINK_CREATED_JUNCTION, "Punkt dowizania katalogw utworzony dla %s <<===>> %s\n" -STRING_MORE, "Wicej? " -STRING_CANCEL_BATCH_FILE, "\r\nWcinito Ctrl-Break. Anulowa wykonanie pliku wsadowego? (Tak/Nie/Zawsze) " +STRING_MKLINK_CREATED_SYMBOLIC, "Dowiązanie symboliczne utworzone dla %s <<===>> %s\n" +STRING_MKLINK_CREATED_HARD, "Dowiązanie twarde utworzone dla %s <<===>> %s\n" +STRING_MKLINK_CREATED_JUNCTION, "Punkt dowiązania katalogów utworzony dla %s <<===>> %s\n" +STRING_MORE, "Więcej? " +STRING_CANCEL_BATCH_FILE, "\r\nWciśnięto Ctrl-Break. Anulować wykonanie pliku wsadowego? (Tak/Nie/Zawsze) " -STRING_INVALID_OPERAND, "Nieprawidowy argument operatora." +STRING_INVALID_OPERAND, "Nieprawidłowy argument operatora." STRING_EXPECTED_CLOSE_PAREN, "Oczekiwano ')'." STRING_EXPECTED_NUMBER_OR_VARIABLE,"Oczekiwano liczby lub nazwy zmiennej." -STRING_SYNTAX_COMMAND_INCORRECT, "Skadnia komendy jest nieprawidowa." +STRING_SYNTAX_COMMAND_INCORRECT, "Składnia komendy jest nieprawidłowa." END diff --git a/base/shell/cmd/lang/ru-RU.rc b/base/shell/cmd/lang/ru-RU.rc index c09389263fb..293721298d1 100644 --- a/base/shell/cmd/lang/ru-RU.rc +++ b/base/shell/cmd/lang/ru-RU.rc @@ -5,7 +5,6 @@ * Aleksey Bragin (aleksey@reactos.com) * Copyright 2005 */ -#pragma code_page(65001) LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT STRINGTABLE DISCARDABLE diff --git a/base/shell/cmd/lang/uk-UA.rc b/base/shell/cmd/lang/uk-UA.rc index 680a2ae8bc4..c52af859327 100644 --- a/base/shell/cmd/lang/uk-UA.rc +++ b/base/shell/cmd/lang/uk-UA.rc @@ -10,718 +10,718 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT STRINGTABLE DISCARDABLE BEGIN -STRING_ASSOC_HELP, "i ii .\n\n\ -assoc [.[=[]]]\n\ +STRING_ASSOC_HELP, "Змiна асоцiацiй файлових розширень.\n\n\ +assoc [.рош[=[ФайлТип]]]\n\ \n\ -assoc ( i ii)\n\ -assoc . ( ii ii)\n\ -assoc .= ( ii ii)\n\ -assoc .= ( ii)\n" +assoc (друк всiх асоцiацiй)\n\ +assoc .рош (друк вiдповiдної асоцiацiї)\n\ +assoc .рош= (видалення вiдповiдної асоцiацiї)\n\ +assoc .рош=ФайлТип (додати нову асоцiацiю)\n" -STRING_ATTRIB_HELP, "³ .\n\n\ -ATTRIB [+R | -R] [+A | -A] [+S | -S] [+H | -H] ...\n\ +STRING_ATTRIB_HELP, "Відображення або зміна атрибутів файлу.\n\n\ +ATTRIB [+R | -R] [+A | -A] [+S | -S] [+H | -H] файл ...\n\ [/S [/D]]\n\n\ - + \n\ - - \n\ - R "" ""\n\ - A ""i""\n\ - S """"\n\ - H """"\n\ - /S i i i i i\n\ - i i\n\ - /D i \n\n\ -i ATTRIB , i i.\n" + + Встановлення атрибуту\n\ + - Зняття атрибуту\n\ + R Атрибут файлу ""Лише читання""\n\ + A Атрибут файлу ""Архiвний""\n\ + S Атрибут файлу ""Системний""\n\ + H Атрибут файлу ""Прихований""\n\ + /S Обробка файлiв зi вказаними iменами в поточнiй тецi\n\ + i у всіх її пiдтеках\n\ + /D Обробка також i тек\n\n\ +Введiть ATTRIB без параметра, щоб вивести атрибути всiх файлiв.\n" -STRING_ALIAS_HELP, ", ii.\n\n\ -ALIAS [i=[]]\n\n\ - i I' i.\n\ - , i i i.\n\n\ - i ii:\n\ +STRING_ALIAS_HELP, "Встановлення, видалення або показ псевдонiмiв.\n\n\ +ALIAS [псевдонiм=[команда]]\n\n\ + псевдонiм Iм'я псевдонiма.\n\ + команда Текст, що пiдставляється замiсть псевдонiма.\n\n\ +Виведення списку всiх псевдонiмiв:\n\ ALIAS\n\n\ - i i i:\n\ +Встановлення або змiна iснуючого псевдонiма:\n\ ALIAS da=dir a:\n\n\ - i i :\n\ +Видалення псевдонiма зi списку:\n\ ALIAS da=" -STRING_BEEP_HELP, " i.\n\nBEEP\n" +STRING_BEEP_HELP, "Звуковий сигнал динамiка.\n\nBEEP\n" -STRING_CALL_HELP, " i i.\n\n\ -CALL [:][]i'_ []\n\n\ - i i , i \n\ - ." +STRING_CALL_HELP, "Виклик однiєї пакетної програми з iншої.\n\n\ +CALL [диск:][шлях]iм'я_файла [параметри]\n\n\ + параметри Набiр параметрiв командного рядка, необхiдних для пакетного\n\ + файлу." -STRING_CD_HELP, " ii i \n\n\ -CHDIR [/D][:][]\n\ +STRING_CD_HELP, "Виведення iменi або змiна поточного каталогу\n\n\ +CHDIR [/D][диск:][шлях]\n\ CHDIR[..|.]\n\ -CD [/D][:][]\n\ +CD [/D][диск:][шлях]\n\ CD[..|.]\n\n\ - .. i \n\ - . \n\ - /D i .\n\n\ - CD : i i' .\n\ - CD i i i .\n" + .. батькiвський каталог\n\ + . поточний каталог\n\ + /D Одночасна змiна поточного диску та каталогу.\n\n\ +Команда CD диск: вiдображає iм'я поточного каталогу вказаного диску.\n\ +Команда CD без параметрiв вiдображає iмена поточних диску та каталогу.\n" -STRING_CHCP_HELP, "i i i.\n\n\ +STRING_CHCP_HELP, "Вивiд або змiна поточного номера кодової сторiнки.\n\n\ CHCP [nnn]\n\n\ - nnn i.\n\n\ - CHCP i.\n" + nnn Задає номер кодової сторiнки.\n\n\ +Команда CHCP без параметра виводить поточний номер кодової сторiнки.\n" -STRING_CHOICE_HELP, "i, i.\n\n\ -CHOICE [/C[:]_i][/N][/S][/T[:]c,nn][]\n\n\ - /C[:]_i i . YN.\n\ - /N i i ? i i.\n\ - /S i i.\n\ - /T[:]c,nn c i nn .\n\ - i.\n\n\ -ERRORLEVEL i .\n" +STRING_CHOICE_HELP, "Очiкує, поки користувач не обере один з вказаних в списку символiв.\n\n\ +CHOICE [/C[:]список_символiв][/N][/S][/T[:]c,nn][текст]\n\n\ + /C[:]список_символiв Задає допустимi символи. По замовчуванню це YN.\n\ + /N Не виводити список символiв i ? пiсля пiдказки.\n\ + /S Трактувати символи як чутливi до регiстру.\n\ + /T[:]c,nn По замовчуванню вибір c пiсля проминання nn секунд.\n\ + текст пiдказка.\n\n\ +ERRORLEVEL встановлюється рiвним номеру вибраного символу.\n" -STRING_CLS_HELP, " .\n\nCLS\n" +STRING_CLS_HELP, "Очищення екрану.\n\nCLS\n" -STRING_CMD_HELP1, "\ni ii :\n" +STRING_CMD_HELP1, "\nДоступнi внутрiшнi команди:\n" -STRING_CMD_HELP2, "\ni i:" +STRING_CMD_HELP2, "\nДоступнi можливостi:" -STRING_CMD_HELP3," [i]" +STRING_CMD_HELP3," [псевдонiми]" -STRING_CMD_HELP4," [ii]" +STRING_CMD_HELP4," [iсторiя]" -STRING_CMD_HELP5," [ i i unix]" +STRING_CMD_HELP5," [заваршення iмен файлiв unix]" -STRING_CMD_HELP6," [ i]" +STRING_CMD_HELP6," [стек директорiй]" -STRING_CMD_HELP7," [ piping]" +STRING_CMD_HELP7," [перенаправлення та piping]" -STRING_CMD_HELP8, " i i ReactOS.\n\n\ -CMD [/[C|K] ][/P][/Q][/T:]\n\n\ - /C .\n\ - /K .\n\ - /P CMD i autoexec.bat\n\ - ( ).\n\ - /T: i / (i . COLOR /?).\n" +STRING_CMD_HELP8, "Запуск нової копiї iнтерпретатора команд ReactOS.\n\n\ +CMD [/[C|K] команда][/P][/Q][/T:кл]\n\n\ + /C команда Виконання вказаної команди з подальшим завершенням.\n\ + /K команда Виконання вказаної команди без подальшого завершення.\n\ + /P CMD стає перманентним i запускає autoexec.bat\n\ + (процес не може бути завершений).\n\ + /T:кл Вибiр кольору тексту/тла (детальнiше див. COLOR /?).\n" -STRING_COLOR_HELP1, " i .\n\n\ +STRING_COLOR_HELP1, "Встановлення кольорiв по замовчуванню для тексту та тла.\n\n\ COLOR [attr [/-F]] \n\n\ - attr i i\n\ - /-F i i \n\n\ -I i:\n\ -1) ii i (i i )\n\ -2) i (decimal on decimal)\n\ -3) i ii \n\n\ - i:\n\ - \n\ -0 0 8 8 i\n\ -1 1 i 9 9 i-i\n\ -2 2 10 A i-\n\ -3 3 11 B i-\n\ -4 4 12 C i-\n\ -5 5 13 D i-\n\ -6 6 14 E i-\n\ -7 7 i 15 F -i\n" + attr Атрибути кольорiв для текстових вiкон\n\ + /-F Не заливати незаповненi мiсця кольором\n\n\ +Iснує три способи задання кольорiв:\n\ +1) за назвою на англiйськiй мовi (потрiбно лише першi три букви назви)\n\ +2) в виглядi десяткових чисел (decimal on decimal)\n\ +3) двi шiснадцятковi цифри\n\n\ +Таблиця кольорiв:\n\ +дес шіс назва дес шіс назва\n\ +0 0 Чорний 8 8 Сiрий\n\ +1 1 Синiй 9 9 Свiтло-синiй\n\ +2 2 Зелений 10 A Свiтло-зелений\n\ +3 3 Блакитний 11 B Свiтло-блакитний\n\ +4 4 Червоний 12 C Свiтло-червоний\n\ +5 5 Малиновий 13 D Свiтло-малиновий\n\ +6 6 Жовтий 14 E Свiтло-жовтий\n\ +7 7 Бiлий 15 F Яскраво-бiлий\n" -STRING_COPY_HELP1, " %s (Yes/No/All)? " +STRING_COPY_HELP1, "Перезаписати %s (Yes/No/All)? " -STRING_COPY_HELP2, "i i i i.\n\n\ -COPY [/V][/Y|/-Y][/A|/B] [/A|/B]\n\ - [+ [/A|/B] [+ ...]] [ [/A|/B]]\n\n\ - I i i, i.\n\ - /A ASCII.\n\ - /B i .\n\ - / i' i i.\n\ - /V i i i i.\n\ - /Y i i\n\ - .\n\ - /-Y ' i i\n\ - .\n\n\ - /Y i COPYCMD.\n\ +STRING_COPY_HELP2, "Копiювання одного або декількох файлiв в iнше мiсце.\n\n\ +COPY [/V][/Y|/-Y][/A|/B] джерело [/A|/B]\n\ + [+ джерело [/A|/B] [+ ...]] [результат [/A|/B]]\n\n\ + джерело Iмена одного або декiлькох файлiв, що будуть скопійованi.\n\ + /A Файл є текстовим файлом ASCII.\n\ + /B Файл є двiйковим файлом.\n\ + результат Каталог та/або iм'я для кiнцевих файлiв.\n\ + /V Перевiрка правильностi копiювання файлiв.\n\ + /Y Придавлення запиту пiдтвердження на перезапис iснуючого\n\ + результуючого файлу.\n\ + /-Y Обов'язковий запит пiдтвердження на перезапис iснуючого\n\ + результуючого файлу.\n\n\ +Ключ /Y можна встановити через змiнну середовища COPYCMD.\n\ ...\n" -STRING_DATE_HELP1, "\ni (mm%cdd%cyyyy): " +STRING_DATE_HELP1, "\nВведiть нову дату (mm%cdd%cyyyy): " -STRING_DATE_HELP2, "\ni (dd%cmm%cyyyy): " +STRING_DATE_HELP2, "\nВведiть нову дату (dd%cmm%cyyyy): " -STRING_DATE_HELP3, "\ni (yyyy%cmm%cdd): " +STRING_DATE_HELP3, "\nВведiть нову дату (yyyy%cmm%cdd): " -STRING_DATE_HELP4, "i i .\n\n\ -DATE [/T][]\n\n\ - /T i\n\n\ - DATE i i i \n\ - . ENTER.\n" +STRING_DATE_HELP4, "Вiдображення чи змiна дати.\n\n\ +DATE [/T][дата]\n\n\ + /T лише вiдображення\n\n\ +Команда DATE без параматрiв вiдображає поточну дату i запитує ввід\n\ +нової дати. Для збереження поточної дати натис ENTER.\n" -STRING_DEL_HELP1, " i i.\n\n\ -DEL [/N /P /T /Q /S /W /Y /Z /A[[:]]] i_i ...\n\ -DELETE [/N /P /T /Q /S /W /Y /Z /A[[:]]] i_i ...\n\ -ERASE [/N /P /T /Q /S /W /Y /Z /A[[:]]] i_i ...\n\n\ - i_ I i i.\n\n\ - /N i .\n\ - /P i .\n\ - /T i ii i i i\n\ - .\n\ - /Q i i i.\n\ - /W .\n\ - /Y i i i\n\ - i *.*.\n\ - /F , i\n\ - .\n\ - /S i ii\n\ - /A ii i .\n\ - i\n\ - R i \n\ - S i \n\ - A i\n\ - H i \n\ - i ""-"" \n" +STRING_DEL_HELP1, "Видалення одного або декiлькох файлiв.\n\n\ +DEL [/N /P /T /Q /S /W /Y /Z /A[[:]атрибути]] iмена_файлiв ...\n\ +DELETE [/N /P /T /Q /S /W /Y /Z /A[[:]атрибути]] iмена_файлiв ...\n\ +ERASE [/N /P /T /Q /S /W /Y /Z /A[[:]атрибути]] iмена_файлiв ...\n\n\ + iмена_файлів Iмена одного або декiлькох файлiв.\n\n\ + /N Не виконувати операцiю видалення безпосередньо.\n\ + /P Запит на пiдтвердження перед видаленням кожного файлу.\n\ + /T Вiдображає кiлькiсть видалених файлiв i звiльненого\n\ + дискового простору.\n\ + /Q Вимкнення запиту на пiдтвердження при видаленнi файлiв.\n\ + /W Перезаписати файл випадковими даними перед видаленням.\n\ + /Y Вимкнення запиту на пiдтвердження при видаленнi файлiв\n\ + навiть для маски *.*.\n\ + /F Примусове видалення прихованих, системних та файлiв\n\ + доступних лише для читання.\n\ + /S Видаляти файл з всiх пiддиректорiй\n\ + /A Вiдбiр файлiв для видалення за властивостями.\n\ + властивостi\n\ + R Доступнi лише для читання\n\ + S Системнi файли\n\ + A Файли для архiвування\n\ + H Прихованi файли\n\ + Префiкс ""-"" означає НЕ\n" -STRING_DEL_HELP2, "i i i!\n i (Y/N)?" -STRING_DEL_HELP3, " %lu \n" -STRING_DEL_HELP4, " %lu i \n" +STRING_DEL_HELP2, "Всi файли в каталозi будуть видалннi!\nВи впевненi (Y/N)?" +STRING_DEL_HELP3, " %lu файл видалено\n" +STRING_DEL_HELP4, " %lu файлiв видалено\n" -STRING_DELAY_HELP, " n ii\n\ +STRING_DELAY_HELP, "пауза на n секунд чи мiлiсекунд\n\ DELAY [/m]n\n\n\ - /m , n ii\n\ - i n ii \n" + /m вказує, що n це мiлiсекунди\n\ + iнакше n це кiлькiсть секунд\n" -STRING_DIR_HELP1, "DIR [:][][i'_] [/A[[:]]] [/B] [/C] [/D] [/L] [/N]\n\ - [/O[[:]]] [/P] [/Q] [/S] [/T[[:]]] [/W] [/X] [/4]\n\n\ - [:][][i'_]\n\ - , , / .\n\n\ - /A i i .\n\ - D i R , i \n\ - H i A , i i\n\ - S i i ""-"" \n\ - /B i i.\n\ - /C \n\ - ( i). /-C.\n\ - /D i i .\n\ - /L i.\n\ - /N i i i .\n\ - /O i i.\n\ - N i' ( i) S i ( i)\n\ - E ( i) D / ( ii)\n\ - G i i ""-"" \n\ - /P i .\n\ - /Q i .\n\ - /S i i i ii.\n\ - /T i i \n\ - C \n\ - A i \n\ - W i\n\ - /W i i.\n\ - /X i i i, i ii \n\ - 8.3. i /N i\n\ - i i . \n\ - i', i .\n\ - /4 i i\n\n\ -i i ii DIRCMD. i\n\ - i i i - (i)--, /-W.\n" +STRING_DIR_HELP1, "DIR [диск:][шлях][iм'я_файлу] [/A[[:]атрибути]] [/B] [/C] [/D] [/L] [/N]\n\ + [/O[[:]порядок]] [/P] [/Q] [/S] [/T[[:]час]] [/W] [/X] [/4]\n\n\ + [диск:][шлях][iм'я_файлу]\n\ + Визначає диск, директорію, та/чи файли для їх виведення в списку.\n\n\ + /A Вiдображення файлiв з вказаними атрибутами.\n\ + атрибути D Директорiї R Файли, доступнi лише для чтання\n\ + H Прихованi файли A Файли, готовi для архiвування\n\ + S Системнi файли Префiкс ""-"" означає НЕ\n\ + /B Виведення лише iмен файлiв.\n\ + /C Застосування роздільника груп розрядів для виводу розмірів файлів\n\ + (по замовчуваннi). Для вимкнення цього режиму використайте ключ /-C.\n\ + /D Виведення списку в декiлька стовпчикiв з сортуванням по стовпчиках.\n\ + /L Використання нижнього регiстру.\n\ + /N Вiдображення iмен файлiв у крайньому правому стовпчику.\n\ + /O Сортування списку вiдображених файлiв.\n\ + порядок N За iм'ям (по алфавiту) S За розмiром (спершу меншi)\n\ + E За розширенням (по алфавiту) D За датою/часом (спершу старiшi)\n\ + G Почати список з каталогiв Префiкс ""-"" для зворотнього порядку\n\ + /P Пауза пiсля кожного заповнення екрану.\n\ + /Q Вiдображення даних про власника файлу.\n\ + /S Вiдображення файлiв з вказаного каталогу та всiх пiдкаталогiв.\n\ + /T Вибiр поля часу для вiдображення чи сортування\n\ + час C Створення\n\ + A Останнiй доступ\n\ + W Остання змiна\n\ + /W Список на декiлька стовпцiв.\n\ + /X Вiдображення коротких iмен файлiв, iмена яких не вiдповiдають \n\ + стандарту 8.3. Формат аналогiчний виводу з ключем /N але короткi\n\ + iмена виводяться спава вiд довгих. Якщо у файла немає короткого\n\ + iм'я, замiсть нього виводяться пробли.\n\ + /4 Вiдображення року в чотиризначному форматi\n\n\ +Ключi можуть бути попередньо заданi в змiннiй середовища DIRCMD. Вiдхилити\n\ +попередньо заданi ключi можна префiксом - (дефiс)--наприклад, /-W.\n" -STRING_DIR_HELP2, " %c i %s\n" -STRING_DIR_HELP3, " %c i.\n" -STRING_DIR_HELP4, " i : %04X-%04X\n" -STRING_DIR_HELP5, "\n :\n%16i (i)% 14s \n" +STRING_DIR_HELP2, " Том в пристрої %c має мiтку %s\n" +STRING_DIR_HELP3, " Том в пристрої %c не має мiтки.\n" +STRING_DIR_HELP4, " Серiйний номер тому: %04X-%04X\n" +STRING_DIR_HELP5, "\n Всього:\n%16i Файл(iв)% 14s байт\n" STRING_DIR_HELP6, "%16i Dir(s)% 15s bytes free\n" STRING_DIR_HELP7, "\n Directory of %s\n\n" -STRING_DIR_HELP8, "%16i (i)% 14s \n" +STRING_DIR_HELP8, "%16i Файл(iв)% 14s байт\n" -STRING_DIRSTACK_HELP1, "i i POPD, i\n\ -i .\n\n\ +STRING_DIRSTACK_HELP1, "Зберiгає поточну директорiю для використання командою POPD, потiм\n\ +замiнює її на вказану.\n\n\ PUSHD [path | ..]\n\n\ - path i, \n" + path Вказує директорiю, яку треба зробити поточною\n" -STRING_DIRSTACK_HELP2, "i i , PUSHD.\n\nPOPD" +STRING_DIRSTACK_HELP2, "Змiнює поточну директорiю на ту, яка збережена командою PUSHD.\n\nPOPD" -STRING_DIRSTACK_HELP3, " i i.\n\nDIRS" +STRING_DIRSTACK_HELP3, "Друкує вмiст стеку директорiй.\n\nDIRS" -STRING_DIRSTACK_HELP4, " i i" +STRING_DIRSTACK_HELP4, "Стек директорiй порожнiй" -STRING_ECHO_HELP1, " i .\n\n\ - ECHOS i" +STRING_ECHO_HELP1, "Виводить повiдомлення без повернення каретки та переведення рядка.\n\n\ + ECHOS повiдомлення" -STRING_ECHO_HELP2, " i .\n\n\ - ECHOERR i\n\ - ECHOERR. i " +STRING_ECHO_HELP2, "Виводить повiдомлення в стандартний канал виводу помилок.\n\n\ + ECHOERR повiдомлення\n\ + ECHOERR. друкує порожнiй рядок" -STRING_ECHO_HELP3, " i .\n\n\ - ECHOSERR i" +STRING_ECHO_HELP3, "Друкує повiдомлення в стандартний канал виводу помилок без повернення каретки та переведення рядка.\n\n\ + ECHOSERR повiдомлення" -STRING_ECHO_HELP4, " i i i.\n\n\ +STRING_ECHO_HELP4, "Виведення повiдомлення та перемикання режиму вiдображення команд на екранi.\n\n\ ECHO [ON | OFF]\n\ - ECHO [i]\n\ - ECHO. i \n\n\ -ECHO i ." + ECHO [повiдомлення]\n\ + ECHO. друкує порожнiй рядок\n\n\ +ECHO без параметра виводить поточний режим вiдображення команд." STRING_ECHO_HELP5, "ECHO is %s\n" -STRING_EXIT_HELP, " i .\n\nEXIT [/b] [ExitCode]\n\n\ - /B . \n\ - - i cmd.exe\n\ - ExitCode ERRORLEVEL i\n" +STRING_EXIT_HELP, "Завершує iнтерпретатор команд.\n\nEXIT [/b] [ExitCode]\n\n\ + /B Виходить лише з пакетного файлу. \n\ + Якщо робота йде поза пакетним файлом - вихiд з cmd.exe\n\ + ExitCode Це значення буде присвоєно ERRORLEVEL при виходi\n" -STRING_FOR_HELP1, " i\n\n\ -FOR %variable IN (i) DO []\n\n\ - %variable , i.\n\ - (i) i i i. .\n\ - , i .\n\ - i i .\n\n\ - FOR %%variable i\n\ +STRING_FOR_HELP1, "Запускає вказану команду для кожного файлу з набору файлiв\n\n\ +FOR %variable IN (набiр) DO команда [параметри]\n\n\ + %variable Параметр, що пiдставляється.\n\ + (набiр) Набiр з одного або декiлькох файлiв. Можна використовувати маски.\n\ + команда Команда, яку слiд виконати для кожного файлу.\n\ + параметри Параметри i ключi для вказаної команди.\n\n\ +В пакетних програмах для команди FOR використовується %%variable замiсть\n\ %variable.\n" -STRING_FREE_HELP1, "\n %s : %-11s\n\ - i : %s\n\ - %16s \n\ - %16s \n\ - %16s i\n" +STRING_FREE_HELP1, "\nТом диску %s : %-11s\n\ + Серiйний номер: %s\n\ + %16s байт загального дискового простору\n\ + %16s байт зайнято\n\ + %16s байт вiльно\n" -STRING_FREE_HELP2, " ii .\n\nFREE [drive: ...]\n" +STRING_FREE_HELP2, "Виводить iнформацiю про том.\n\nFREE [drive: ...]\n" -STRING_IF_HELP1, " i.\n\n\ - IF [NOT] ERRORLEVEL \n\ - IF [NOT] 1==2 \n\ - IF [NOT] EXIST i'_ \n\ - IF [NOT] DEFINED i \n\n\ -NOT , CMD , \n\ - \n\ -ERRORLEVEL i, , \n\ - .\n\ - , ii .\n\ -1==2 i, i \n\ - i.\n\ -EXIST i'_ i, i i.\n\ -DEFINED i i, i\n\ - .\n" +STRING_IF_HELP1, "Оператор умовного виконання команд у пакетному файлi.\n\n\ + IF [NOT] ERRORLEVEL число команда\n\ + IF [NOT] рядок1==рядок2 команда\n\ + IF [NOT] EXIST iм'я_файлу команда\n\ + IF [NOT] DEFINED змiнна команда\n\n\ +NOT Вказує, що CMD повинен виконати команду, лише якщо\n\ + умова є хибною\n\ +ERRORLEVEL число Ця умова є iстинною, якщо код, що повернула\n\ + остання виконана програма не меньше вказаного числа.\n\ +команда Зазначає команду, виконувану при iстинностi умови.\n\ +рядок1==рядок2 Ця умова є iстинною, якщо вказанi рядки\n\ + спiвпадають.\n\ +EXIST iм'я_файлу Умова є iстинною, якщо файл з вказаним iменем iснує.\n\ +DEFINED змiнна Ця умова є iстинною, якщо вказана змiнна\n\ + задана.\n" -STRING_GOTO_HELP1, " , i i.\n\n\ -GOTO i\n\n\ - label , i.\n\n\ -̳ i ." +STRING_GOTO_HELP1, "Передача управління рядку пакетного файлу, що мiстить мiтку.\n\n\ +GOTO мiтка\n\n\ + label рядок пакетного файлу, визначений як мiтка.\n\n\ +Мітка повинна знаходитися в окремому рядку i починатися з двокрапки." -STRING_LABEL_HELP1, "i i i .\n\nLABEL [:][i]\n" +STRING_LABEL_HELP1, "Вiдображення або змiна мiтки тому.\n\nLABEL [диск:][мiтка]\n" -STRING_LABEL_HELP2, " %c: i %s\n" -STRING_LABEL_HELP3, " %c: i\n" -STRING_LABEL_HELP4, "i : %04X-%04X\n" -STRING_LABEL_HELP5, "i (11 , ENTER i)? " +STRING_LABEL_HELP2, "Том в пристрої %c: має мiтку %s\n" +STRING_LABEL_HELP3, "Том в пристрої %c: не має мiтки\n" +STRING_LABEL_HELP4, "Серiйний номер тому: %04X-%04X\n" +STRING_LABEL_HELP5, "Мiтка тому (11 букв, ENTER без мiтки)? " -STRING_LOCALE_HELP1, " : " +STRING_LOCALE_HELP1, "Поточний час: " -STRING_MKDIR_HELP, " .\n\n\ -MKDIR [:]\nMD [:]" +STRING_MKDIR_HELP, "Створення каталогу.\n\n\ +MKDIR [диск:]шлях\nMD [диск:]шлях" -STRING_MKLINK_HELP, " '- .\n\n\ -MKLINK [/D | /H | /J] _ i\n\n\ - /D , i - i.\n\ - /H .\n\ - /J ' i.\n\n\ - i /H i /J , i ." +STRING_MKLINK_HELP, "Створення об'єкту-посилання файлової системи.\n\n\ +MKLINK [/D | /H | /J] назва_посилання цiль\n\n\ + /D Вказує, що цiль символчного посилання - це директорiя.\n\ + /H Створення жорсткого посилання.\n\ + /J Створення з'єднання директорiй.\n\n\ +Якщо не вказано нi /H нi /J , створюється символiчне посилання." -STRING_MEMMORY_HELP1, "i ' 'i.\n\nMEMORY" +STRING_MEMMORY_HELP1, "Вiдображення об'єму системної пам'ятi.\n\nMEMORY" -STRING_MEMMORY_HELP2, "\n %12s%% 'i .\n\n\ - %13s i RAM.\n\ - %13s i RAM.\n\n\ - %13s i .\n\ - %13s i .\n\n\ - %13s i 'i.\n\ - %13s i 'i.\n" +STRING_MEMMORY_HELP2, "\n %12s%% пам'ятi використовується.\n\n\ + %13s байт всього фiзичної RAM.\n\ + %13s байт доступно фiзичної RAM.\n\n\ + %13s байт всього в файлi довантаження.\n\ + %13s байт доступно в файлi довантаження.\n\n\ + %13s байт всього вiртуальної пам'ятi.\n\ + %13s байт доступно вiртуальної пам'ятi.\n" -STRING_MISC_HELP1, "i i ...\n" +STRING_MISC_HELP1, "Натиснiть клавiшу для продовження...\n" -STRING_MOVE_HELP1, " %s (Yes/No/All)? " +STRING_MOVE_HELP1, "Переписати %s (Yes/No/All)? " -STRING_MOVE_HELP2, "i i i i i i.\n\n\ -i i i:\n\ -MOVE [/N][:][]i'_1[,...] \n\n\ - :\n\ -MOVE [/N][:][]i'_1 i'_2\n\n\ - [:][]i'_1 i i' \n\ - i i i i.\n\ - /N i. Do everything but move files or directories.\n\n\ -i :\n\ - - i i i.\n" +STRING_MOVE_HELP2, "Перемiщення файлiв i перейменування файлiв i каталогiв.\n\n\ +Перемiщення одного та бiльше файлiв:\n\ +MOVE [/N][диск:][шлях]iм'я_файлу1[,...] призначення\n\n\ +Перейменування каталогу:\n\ +MOVE [/N][диск:][шлях]iм'я_каталогу1 iм'я_каталогу2\n\n\ + [диск:][шлях]iм'я_файлу1 Вказує мiсце розташування й iм'я файлу або\n\ + файлiв якi необхiдно перемiстити.\n\ + /N Нiчого. Do everything but move files or directories.\n\n\ +Поточнi обмеження:\n\ + - Неможливо переносити файли чи теки мiж рiзними роздiлами.\n" -STRING_MSGBOX_HELP, " i i ii \n\n\ -MSGBOX [''] i\n\n\ - i \n\ - i : OK, OKCANCEL,\n\ +STRING_MSGBOX_HELP, "показ вiкна з повiдомленням та повернення вiдповдi користувача\n\n\ +MSGBOX тип ['заголовок'] пiдказка\n\n\ +тип вiдображені кнопки\n\ + можливi значення: OK, OKCANCEL,\n\ YESNO, YESNOCANCEL\n\ - i i\n\ -i i\n\n\n\ -ERRORLEVEL i :\n\n\ +заголовок заголовок вiкна з повiдомленням\n\ +пiдказка текст повiдомлення\n\n\n\ +ERRORLEVEL встановлюється вiдповдно до натиснутої кнопки:\n\n\ YES : 10 | NO : 11\n\ OK : 10 | CANCEL : 12\n" -STRING_PATH_HELP1, " i.\n\n\ -PATH [[:][;...]]\nPATH ;\n\n\ - PATH ; i \n\ - .\n\ - PATH i i .\n" +STRING_PATH_HELP1, "Показ або задання шляху пошуку виконуваних файлiв.\n\n\ +PATH [[диск:]шлях[;...]]\nPATH ;\n\n\ +Команда PATH ; очищає шлях пошуку файлiв та обмежує його\n\ +поточним каталогом.\n\ +Команда PATH без параметрiв вiдображає поточний шлях пошуку.\n" -STRING_PROMPT_HELP1, "i .\n\n\ -PROMPT []\n\n\ - .\n\n\ - i i:\n\n\ - $A & ()\n\ - $B | ( )\n\ - $C ( (i )\n\ - $D \n\ - $E ESC ( ASCII 27)\n\ - $F ) ( )\n\ - $G > ( )\n\ - $H Backspace ( )\n\ - $L < ( )\n\ - $N \n\ - $P \n\ - $Q = ( ii)\n\ - $T \n\ - $V i i \n\ - $_ \n\ - $$ $ ( )\n" +STRING_PROMPT_HELP1, "Змiна запрошення командного рядка.\n\n\ +PROMPT [текст]\n\n\ + текст Нове запрошення командного рядка.\n\n\ +Запрошення може складатись з звичайних символiв та наступних кодiв:\n\n\ + $A & (Амперсанд)\n\ + $B | (вертикальна риска)\n\ + $C ( (Лiва кругла дужка)\n\ + $D Поточна дата\n\ + $E ESC (символ ASCII з кодом 27)\n\ + $F ) (Права кругла дужка)\n\ + $G > (знак більше)\n\ + $H Backspace (видалення попередьного символу)\n\ + $L < (знак меньше)\n\ + $N Поточний диск\n\ + $P Поточний диск та каталог\n\ + $Q = (знак рiвностi)\n\ + $T Поточний час\n\ + $V Номер версiї операцiйної системи\n\ + $_ Повернення каретки та переведення рядка\n\ + $$ $ (знак долара)\n" -STRING_PAUSE_HELP1, " i i:\n\ -' i - i...' i.\n\n\ -PAUSE [i]" +STRING_PAUSE_HELP1, "Призупинка обробки пакетного файлу i показ повiдомлення:\n\ +'Для продовження натиснiть будь-яку клавiшу...' чи задане повiдомлення.\n\n\ +PAUSE [повiдомлення]" -STRING_PROMPT_HELP2, " $+ i" +STRING_PROMPT_HELP2, " $+ Показує поточну глибину стека каталогiв" -STRING_PROMPT_HELP3, "\nPROMPT i ." +STRING_PROMPT_HELP3, "\nPROMPT без параметрiв встановлює запрошення командного рядка за замовчуванням." -STRING_REM_HELP, " i.\n\nREM [Comment]" +STRING_REM_HELP, "Стартує рядок коментаря впакетному файлi.\n\nREM [Comment]" -STRING_RMDIR_HELP, " .\n\n\ -RMDIR [:]\nRD [:]\n\ -/S i ii\n\ -/Q i\n" -STRING_RMDIR_HELP2, " i!\n" +STRING_RMDIR_HELP, "Видалення каталогу.\n\n\ +RMDIR [диск:]шлях\nRD [диск:]шлях\n\ +/S Видалення всього дерева всерединi цiлi\n\ +/Q Вимкнення запиту пiдтвердження\n" +STRING_RMDIR_HELP2, "Каталог не порожнiй!\n" -STRING_REN_HELP1, " i i/i.\n\n\ -RENAME [/E /N /P /Q /S /T] _i' ... _i'\n\ -REN [/E /N /P /Q /S /T] _i' ... _i'\n\n\ - /E i .\n\ - /N i.\n\ - /P i .\n\ - ( i!)\n\ - /Q .\n\ - /S i.\n\ - /T i ii i i.\n\n\ - i i .\n\ - MOVE.\n" +STRING_REN_HELP1, "Перейменування одного чи кiлькох файлiв/каталогiв.\n\n\ +RENAME [/E /N /P /Q /S /T] старе_iм'я ... нове_iм'я\n\ +REN [/E /N /P /Q /S /T] старе_iм'я ... нове_iм'я\n\n\ + /E Не показувати повiдомлення про помилки.\n\ + /N Нiчого.\n\ + /P Запит пiдтвердження для кожного файлу.\n\ + (Ще не реалiзовано!)\n\ + /Q Тихо.\n\ + /S Перейменувати пiдкаталоги.\n\ + /T Вiдображення кiлькостi переiменованих файлiв.\n\n\ +Для кiнцевого фалу не можна вказати iнший диск чи каталог.\n\ +Для цього використайте команду MOVE.\n" -STRING_REN_HELP2, " %lu i\n" +STRING_REN_HELP2, " %lu файл переiменовано\n" -STRING_REN_HELP3, " %lu i i\n" +STRING_REN_HELP3, " %lu файлiв переiменовано\n" -STRING_REPLACE_HELP1, "i i.\n\n\ -REPLACE [1:][1]i'_ [2:][2] [/A] [/P] [/R] [/W]\n\ -REPLACE [1:][1]i'_ [2:][2] [/P] [/R] [/S] [/W] [/U]\n\n\ - [1:][1]i'_ () i.\n\ - [2:][2] , ii \n\ - .\n\ - /A i i . \n\ - i i /S /U.\n\ - /P i i \n\ - .\n\ - /R i .\n\ - /S i i i \n\ - . i\n\ - /A.\n\ - /W .\n\ - /U i () , ii i\n\ - ii. i /A.\n" +STRING_REPLACE_HELP1, "Замiна файлiв.\n\n\ +REPLACE [диск1:][шлях1]iм'я_файлу [диск2:][шлях2] [/A] [/P] [/R] [/W]\n\ +REPLACE [диск1:][шлях1]iм'я_файлу [диск2:][шлях2] [/P] [/R] [/S] [/W] [/U]\n\n\ + [диск1:][шлях1]iм'я_файлу Задає файл(и) для замiни.\n\ + [диск2:][шлях2] Задає каталог, в якому будуть замiненi файли\n\ + файли.\n\ + /A Додати новi файли в кiнцеву теку. Неможливе\n\ + при використаннi ключiв /S чи /U.\n\ + /P Запит на пiдтвердження замiни файлу чи\n\ + додавання початкового файлу.\n\ + /R Замiнює також файли лише для читання.\n\ + /S Замiнює файли у всiх пiдкаталогах каталогу\n\ + призначення. Неможливе при використаннi\n\ + ключа /A.\n\ + /W Чекає поки ви вставите диск перед початком.\n\ + /U Замiнює (оновлює) лише файли, що старiшi нiж\n\ + копiйованi. Неможливе при використаннi ключа /A.\n" -STRING_REPLACE_HELP2, "i \n" +STRING_REPLACE_HELP2, "Необхiдний шлях джерела\n" -STRING_REPLACE_HELP3, " i i\n" +STRING_REPLACE_HELP3, "Не замiнено жодних файлiв\n" -STRING_REPLACE_HELP4, "%lu (i) i\n" +STRING_REPLACE_HELP4, "%lu файл(iв) замiнено\n" -STRING_REPLACE_HELP5, "i %s\n" +STRING_REPLACE_HELP5, "Замiна %s\n" -STRING_REPLACE_HELP6, "i %s\n" +STRING_REPLACE_HELP6, "Замiнити %s\n" -STRING_REPLACE_HELP7, " i\n" +STRING_REPLACE_HELP7, "Не додано жодних файлiв\n" -STRING_REPLACE_HELP8, "%lu (i) \n" +STRING_REPLACE_HELP8, "%lu файл(iв) додано\n" -STRING_REPLACE_HELP9, " %s (Y/N) " +STRING_REPLACE_HELP9, "Додати %s (Y/N) " -STRING_REPLACE_HELP10, "i %s (Y/N) " +STRING_REPLACE_HELP10, "Замiнити %s (Y/N) " -STRING_REPLACE_HELP11, " %s\n" +STRING_REPLACE_HELP11, "Додавання %s\n" -STRING_SHIFT_HELP, "i i i i .\n\n\ +STRING_SHIFT_HELP, "Змiна позицiї пiдставлюваних параметрiв для пакетного файлу.\n\n\ SHIFT [DOWN]" -STRING_SCREEN_HELP, "i i \n\n\ -SCREEN []\n\n\ - , i \n\ - , i " +STRING_SCREEN_HELP, "перемiщення курсора та опцiонально показ тексту\n\n\ +SCREEN ряд стп [текст]\n\n\ + ряд рядок, куди требе перемiстити курсор\n\ + стп стовпчик, куди требе перемiстити курсор" -STRING_SET_HELP, ", i .\n\n\ -SET [i[=][]]\n\n\ - i I' i .\n\ - i, i ii.\n\n\ -SET i i i .\n" +STRING_SET_HELP, "Показ, задання чи видалення змiнних середовища.\n\n\ +SET [змiнна[=][значення]]\n\n\ + змiнна Iм'я змiнної середовища.\n\ + значення Рядок символiв, що призначається вказанiй змiннiй.\n\n\ +SET без параметрiв виводить поточнi значення змiнних середовища.\n" -STRING_START_HELP1, " .\n\n\ -START \n\n\ - .\n\n\ - i .\n" +STRING_START_HELP1, "Запуск команди.\n\n\ +START команда\n\n\ + команда Команда для запуску.\n\n\ +На даний момент всi команди стартують асинхронно.\n" -STRING_TITLE_HELP, "i i .\n\n\ -TITLE []\n\n\ - i i .\n" +STRING_TITLE_HELP, "Змiна заголовка вiкна командного рядка.\n\n\ +TITLE [рядок]\n\n\ +рядок Майбутнiй заголовок вiкна командного рядка.\n" -STRING_TIME_HELP1, "i i .\n\n\ -TIME [/T][]\n\n\ - /T i\n\n\ -TIME i \n\ - . i ENTER .\n" +STRING_TIME_HELP1, "Вiдображення чи змiна системного часу.\n\n\ +TIME [/T][час]\n\n\ + /T лише вiдображення\n\n\ +TIME без параметрiв виводить поточний час та запитує\n\ +введення нового. Натиснiть ENTER для збереження поточного.\n" -STRING_TIME_HELP2, "i : " +STRING_TIME_HELP2, "Введiть новий час: " -STRING_TIMER_HELP1, " %d \n" +STRING_TIMER_HELP1, "Минуло %d мсек\n" -STRING_TIMER_HELP2, " %02d%c%02d%c%02d%c%02d\n" +STRING_TIMER_HELP2, "Минуло %02d%c%02d%c%02d%c%02d\n" -STRING_TIMER_HELP3, " ii.\n\n\ +STRING_TIMER_HELP3, "дозволяє використати десять секундомiрiв.\n\n\ TIMER [ON|OFF] [/S] [/n] [/Fn]\n\n\ - ON i i (ON)\n\ - OFF i (OFF)\n\ - /S i i. i i\n\ - i i \n\ - /n i.\n\ - i i 0 9\n\ - - 1\n\ - /Fn \n\ - n :\n\ - 0 ii\n\ + ON ввiмкнути секундомiр (ON)\n\ + OFF вимкнути секундомiр (OFF)\n\ + /S Рiзниця в часi. Повертає рiзницю в часi\n\ + секундомiра без змiни його значення\n\ + /n Задати номер секундомiра.\n\ + Доступнi номери вiд 0 до 9\n\ + За замовчуванням - 1\n\ + /Fn Формат виводу\n\ + n може бути:\n\ + 0 мiлiсекунди\n\ 1 hh%cmm%css%cdd\n\n\ - i ON, OFF /S , \n\ - i\n\n" +Якщо не вказанi ON, OFF та /S , команда перемикає\n\ +стан секундомiра\n\n" -STRING_TYPE_HELP1, " i i.\n\nTYPE [:][]i'_ \n\ - /P i.\n" +STRING_TYPE_HELP1, "Виведення вмiсту текстових файлiв.\n\nTYPE [диск:][шлях]iм'я_файлу \n\ + /P Поекранний вивiд.\n" STRING_VERIFY_HELP1, "This command is just a dummy!!\n\ -i i i i\n\ - .\n\n\ +Ввiмкнення чи вимкнення перевiрки правильностi запису файлiв\n\ +на диск.\n\n\ VERIFY [ON | OFF]\n\n\ -VERIFY i .\n" +VERIFY без параметрiв виводить поточне значення команди.\n" STRING_VERIFY_HELP2, "VERIFY %s.\n" -STRING_VERIFY_HELP3, " ON OFF." +STRING_VERIFY_HELP3, "Треба задати ON або OFF." -STRING_VERSION_HELP1, "i i \n\n\ +STRING_VERSION_HELP1, "Данi про версiю оболонки\n\n\ VER [/C][/R][/W]\n\n\ - /C i i.\n\ - /R i ii .\n\ - /W i i ii." + /C Вiдображення списку авторiв.\n\ + /R Вiдображення iнформацiї про перепоширення.\n\ + /W Вiдображення гарантiйної iнформацiї." -STRING_VERSION_HELP2, " - I; \n\ -: `ver /w'. i , i \n\ - i ; `ver /r' . `ver /c' \n\ - i." +STRING_VERSION_HELP2, " надається без БУДЬ-ЯКИХ ГАРАНТIЙ; для детальних даних\n\ +надрукуйте: `ver /w'. Ця програма є вiльним ПЗ, i ви можете розповсюджувати\n\ +її згiдно певних умов; надрукуйте `ver /r' для детальних даних. Надрукуйте `ver /c' \n\ +для виведення списку авторiв." -STRING_VERSION_HELP3, "\n i i, ,\n\ - - I; i i\n\ - I I. i\n\ - GNU General Public License ii." +STRING_VERSION_HELP3, "\n Ця програма розповсюджується iз сподiванням, що вона буде корисною,\n\ + але БЕЗ БУДЬ-ЯКИХ ГАРАНТIЙ; навiть без непрямих гарантiй\n\ + щодо ПРОДАЖУ чи ПРИДАТНОСТI ДЛЯ ПЕВНИХ ЦIЛЕЙ. Дивiться\n\ + GNU General Public License для детальної iнформацiї." -STRING_VERSION_HELP4, "\n i ; /\n\ - i i GNU General Public License, i\n\ - Free Software Foundation; i 2 ii, \n\ - ( i) - i i.\n" +STRING_VERSION_HELP4, "\n Ця програма є вiльним ПЗ; ви можете перепоширювати її та/чи\n\ + модифiкувати згiдно умов GNU General Public License, що опублiкована\n\ + Free Software Foundation; версiї 2 Лiцензiї, чи\n\ + (на ваш вибiр) будь-якої новiшої версiї.\n" -STRING_VERSION_HELP5, "\ni i .\n\ - i : http://www.reactos.org" +STRING_VERSION_HELP5, "\nВiдсилайте звiти про помилки на .\n\ +Оновлення доступнi на: http://www.reactos.org" -STRING_VERSION_HELP6, "\nFreeDOS-i :\n" +STRING_VERSION_HELP6, "\nFreeDOS-версiя написана:\n" -STRING_VERSION_HELP7, "\nReactOS-i :\n" +STRING_VERSION_HELP7, "\nReactOS-версiя написана:\n" -STRING_VOL_HELP1, " %c i %s\n" -STRING_VOL_HELP2, " %c i.\n" -STRING_VOL_HELP3, " i : %04X-%04X\n" -STRING_VOL_HELP4, " i i , i.\n\nVOL [:]" +STRING_VOL_HELP1, " Том в пристрої %c має мiтку %s\n" +STRING_VOL_HELP2, " Том в пристрої %c не має мiтки.\n" +STRING_VOL_HELP3, " Серiйний номер тому: %04X-%04X\n" +STRING_VOL_HELP4, "Виводить мiтку тому та серiйний номер, якщо вони iснують.\n\nVOL [диск:]" -STRING_WINDOW_HELP1, "i i i\n\n\ +STRING_WINDOW_HELP1, "змiнює вигляд вiкна консолi\n\n\ WINDOW [/POS[=]left,top,width,heigth]\n\ - [MIN|MAX|RESTORE] ['']\n\n\ -/POS i i\n\ -MIN i\n\ -MAX i\n\ -RESTORE i i" + [MIN|MAX|RESTORE] ['заголовок']\n\n\ +/POS визначає розміри та розмiщення вiкна\n\ +MIN згортає вiкно\n\ +MAX розгортає вiкно\n\ +RESTORE вiдновлює вiкно" -STRING_WINDOW_HELP2, "i i i\n\n\ +STRING_WINDOW_HELP2, "змiнює вигляд вiкна консолi\n\n\ ACTIVATE 'window' [/POS[=]left,top,width,heigth]\n\ [MIN|MAX|RESTORE] ['title']\n\n\ -window i, i\n\ -/POS i i\n\ -MIN i\n\ -MAX i\n\ -RESTORE i i\n\ -title \n" +window заголовок вiкна, вигляд якого треба змiнити\n\ +/POS визначає розміри та розмiщення вiкна\n\ +MIN згортає вiкно\n\ +MAX розгортає вiкно\n\ +RESTORE вiдновлює вiкно\n\ +title новий заголовок\n" -STRING_HELP1, " i (+ )\n\n\ - /? ii \n\n\ -? i .\n\ -ALIAS , ii.\n\ -ATTRIB i i i .\n\ -BEEP i.\n\ -CALL i i.\n\ -CD i ii i .\n\ -CHCP i i.\n\ -CHOICE i i.\n\ -CLS .\n\ -CMD i i ReactOS.\n\ -COLOR i i i.\n\ -COPY i i i i i.\n\ -DATE i .\n\ -DELETE i i.\n\ -DIR i i i i i.\n\ -ECHO i i, i .\n\ -ERASE i i.\n\ -EXIT i CMD.EXE (i ).\n\ -FOR i.\n\ -FREE (i) i.\n\ -GOTO i , i i.\n\ -HELP i ii ReactOS.\n\ -HISTORY i .\n\ -IF .\n\ -LABEL , i, i .\n\ -MD .\n\ -MKDIR .\n\ -MKLINK '- .\n\ -MOVE i i i i i\n\ - .\n\ -PATH i i.\n\ -PAUSE i i.\n\ -POPD i , \n\ +STRING_HELP1, "Список всiх доступних команд (+ опис)\n\n\ + команда /? Для докладної iнформацiї про конкретну команду\n\n\ +? Список всiх доступних команд без опису.\n\ +ALIAS Встановлення, видалення або показ псевдонiмiв.\n\ +ATTRIB Вiдображення або змiна атрибутiв файлу.\n\ +BEEP Звуковий сигнал динамiка.\n\ +CALL Виклик однiєї пакетної програми з iншої.\n\ +CD Вiдображення iменi або змiна поточної теки.\n\ +CHCP Вiдображення або встановлення поточного номера кодової сторiнки.\n\ +CHOICE Очiкування вибору користувачем одного з вказаних символiв.\n\ +CLS Очищення екрану.\n\ +CMD Запуск нової копiї iнтерпретатора команд ReactOS.\n\ +COLOR Встановлення типових кольорiв тексту i тла консолi.\n\ +COPY Копiювання одного або бiльше файлiв в iнше мiсце.\n\ +DATE Вiдображення або встановлення дати.\n\ +DELETE Видалення одного або бiльше файлiв.\n\ +DIR Вiдображення списку файлiв i пiдтек в тецi.\n\ +ECHO Вiдображення повiдомлень, або перемикання режиму вiдображення команд.\n\ +ERASE Видалення одного або бiльше файлiв.\n\ +EXIT Вихiд з програми CMD.EXE (iнтерпретатора команд).\n\ +FOR Запуск вказаної команди для кожного файлу з набору файлiв.\n\ +FREE (Вiльний) дисковий простiр.\n\ +GOTO Передача управлiння рядку пакетної програми, який мiстить мiтку.\n\ +HELP Довiдкова iнформацiя про команди ReactOS.\n\ +HISTORY Список усiх використаних команд.\n\ +IF Оператор обробки умов у пакетних програмах.\n\ +LABEL Створення, змiна, або видалення мiток тому диска.\n\ +MD Створення теки.\n\ +MKDIR Створення теки.\n\ +MKLINK Створення об'єкту-посилання файлової системи.\n\ +MOVE Перемiщення одного або бiльше файлiв з однiєї теки до iншої\n\ + теки.\n\ +PATH Вiдображення або встановлення шляху пошуку виконуваних файлiв.\n\ +PAUSE Тимчасове припинення обробки командного файлу i показ повiдомлення.\n\ +POPD Вiдновлює попереднє значення поточної теки, збережене командою\n\ PUSHD.\n\ -PROMPT i .\n\ -PUSHD i , i i .\n\ -RD .\n\ -REM i () .\n\ -REN i.\n\ -RENAME i.\n\ -REPLACE i i.\n\ -RMDIR i .\n\ -SCREEN i i .\n\ -SET i, , i ReactOS.\n\ -SHIFT i i i .\n" -STRING_HELP2, "START i i .\n\ - .\n\ -TIME i .\n\ -TIMER ii.\n\ -TITLE i i CMD.EXE.\n\ -TYPE i i .\n\ -VER i i ReactOS.\n\ -VERIFY i i i \n\ - i .\n\ -VOL i i i i .\n" +PROMPT Змiна запрошення командного рядка.\n\ +PUSHD Зберiгає поточну теку, а потiм змiнює її.\n\ +RD Видалення теки.\n\ +REM Записує коментарi (зауваження) в командних файлах.\n\ +REN Перейменування файла або файлiв.\n\ +RENAME Перейменування файла або файлiв.\n\ +REPLACE Замiна файлiв.\n\ +RMDIR Перемiщення теки.\n\ +SCREEN Перемiщення курсора i виведення тексту.\n\ +SET Вiдображення, встановлення, або видалення змiнних оточення ReactOS.\n\ +SHIFT Зрушення позицiї замiнних параметрiв у командних файлах.\n" +STRING_HELP2, "START Вiдкриває окреме вiкно для запуску вказаних команд або програм.\n\ + Виконує команду.\n\ +TIME Вiдображення або встановлення системного часу.\n\ +TIMER Дозволяє використання десяти секундомiрiв.\n\ +TITLE Встановлення заголовка вiкна для сесiї CMD.EXE.\n\ +TYPE Вiдображення вмiсту текстового файлу.\n\ +VER Вiдображення версiї ReactOS.\n\ +VERIFY Включення або вiдключення режиму перевiрки правильностi запису\n\ + файлiв на диск.\n\ +VOL Вiдображення мiтки тому диска i серiйного номера.\n" STRING_CHOICE_OPTION, "YN" STRING_COPY_OPTION, "YNA" -STRING_ALIAS_ERROR, " i ii!\n" -STRING_ASSOC_ERROR, " ii %s\n" -STRING_BATCH_ERROR, " i \n" -STRING_CHCP_ERROR1, " i: %u\n" -STRING_CHCP_ERROR4, " i\n" -STRING_CHOICE_ERROR, "i . i : /C[:]" -STRING_CHOICE_ERROR_TXT, "i . i : /T[:]c,nn" -STRING_CHOICE_ERROR_OPTION, "i : %s" -STRING_CMD_ERROR1, " i %s\n" -STRING_CMD_ERROR2, " pipe-\n" -STRING_CMD_ERROR3, " %s\n" -STRING_CMD_ERROR4, " %s...\n" -STRING_CMD_ERROR5, " cmdexit.bat...\n" -STRING_COLOR_ERROR1, " - i ! ( )" -STRING_COLOR_ERROR2, " i " -STRING_COLOR_ERROR3, "i %x\n" -STRING_COLOR_ERROR4, " - i !" -STRING_CONSOLE_ERROR, "i : %d\n" -STRING_COPY_ERROR1, ": i - %s!\n" -STRING_COPY_ERROR2, ": i !\n" -STRING_COPY_ERROR3, " !\n" -STRING_COPY_ERROR4, ": i!\n" -STRING_DATE_ERROR, "i ." -STRING_DEL_ERROR5, " %s ! " -STRING_DEL_ERROR6, " i (Y/N)?" -STRING_DEL_ERROR7, ": %s\n" -STRING_ERROR_ERROR1, "i ! : 0x%lx\n" -STRING_ERROR_ERROR2, " " -STRING_FOR_ERROR1, "'in' i for." -STRING_FOR_ERROR2, " ." -STRING_FOR_ERROR3, "'do' i." -STRING_FOR_ERROR4, " i 'do'." -STRING_FREE_ERROR1, "i " -STRING_FREE_ERROR2, " ii" -STRING_GOTO_ERROR1, " i GOTO" -STRING_GOTO_ERROR2, "i '%s' \n" +STRING_ALIAS_ERROR, "Командний рядок занадто довгий пiсля розгортання псевдонiмiв!\n" +STRING_ASSOC_ERROR, "Не знайдено файлової асоцiацiї для розширення %s\n" +STRING_BATCH_ERROR, "Помилка вiдкриття пакетного файлу\n" +STRING_CHCP_ERROR1, "Поточна кодова сторiнка: %u\n" +STRING_CHCP_ERROR4, "Помилкова кодова сторiнка\n" +STRING_CHOICE_ERROR, "Невiрний параметр. Очiкується формат: /C[:]параметри" +STRING_CHOICE_ERROR_TXT, "Невiрний параметр. Очiкується формат: /T[:]c,nn" +STRING_CHOICE_ERROR_OPTION, "Невiрний параметр: %s" +STRING_CMD_ERROR1, "Не можу перенаправити ввiд з файлу %s\n" +STRING_CMD_ERROR2, "Помилка створення тимчасового файлу для pipe-даних\n" +STRING_CMD_ERROR3, "Не можу перенаправити в файл %s\n" +STRING_CMD_ERROR4, "Запуск %s...\n" +STRING_CMD_ERROR5, "Запуск cmdexit.bat...\n" +STRING_COLOR_ERROR1, "помилка - однаковi кольори! (тло та текст не можуть бути однакового кольору)" +STRING_COLOR_ERROR2, "помилка при вказаннi кольору" +STRING_COLOR_ERROR3, "Колiр %x\n" +STRING_COLOR_ERROR4, "помилка - однаковi кольори!" +STRING_CONSOLE_ERROR, "Невiдома помилка: %d\n" +STRING_COPY_ERROR1, "Помилка: Неможливо вiдкрити джерело - %s!\n" +STRING_COPY_ERROR2, "Помилка: Неможливо копiювати в себе!\n" +STRING_COPY_ERROR3, "Помилка запису призначення!\n" +STRING_COPY_ERROR4, "Помилка: Ще не реалiзовано!\n" +STRING_DATE_ERROR, "Невiрна дата." +STRING_DEL_ERROR5, "Файл %s буде видалений! " +STRING_DEL_ERROR6, "Ви впевненi (Y/N)?" +STRING_DEL_ERROR7, "Видалення: %s\n" +STRING_ERROR_ERROR1, "Невiдома помилка! Код помилки: 0x%lx\n" +STRING_ERROR_ERROR2, "Синтаксична помилка" +STRING_FOR_ERROR1, "'in' вiдсутнє в команді for." +STRING_FOR_ERROR2, "дужок не знайдено." +STRING_FOR_ERROR3, "'do' вiдсутнє." +STRING_FOR_ERROR4, "немає команди пiсля 'do'." +STRING_FREE_ERROR1, "Невiрний диск" +STRING_FREE_ERROR2, "не вiдмiчено" +STRING_GOTO_ERROR1, "Не визначена мiтка для GOTO" +STRING_GOTO_ERROR2, "Мiтка '%s' не знайдена\n" -STRING_MD_ERROR, "i i.\n" -STRING_MD_ERROR2, " i.\n" +STRING_MD_ERROR, "Пiдкаталог чи файл вже iснує.\n" +STRING_MD_ERROR2, "Шлях до нового каталогу не iснує.\n" STRING_MOVE_ERROR1, "[OK]\n" -STRING_MOVE_ERROR2, "[]\n" +STRING_MOVE_ERROR2, "[Помилка]\n" -STRING_REN_ERROR1, " MoveFile(). : %lu\n" +STRING_REN_ERROR1, "Невдачне виконання MoveFile(). Помилка: %lu\n" -STRING_START_ERROR1, " i i!" +STRING_START_ERROR1, "На даний момент пакетнi файли не пiдтримуються!" -STRING_TIME_ERROR1, "i ." +STRING_TIME_ERROR1, "Невiрний час." -STRING_TYPE_ERROR1, "i '/%s'\n" +STRING_TYPE_ERROR1, "Невiрний параметр '/%s'\n" -STRING_WINDOW_ERROR1, "i " +STRING_WINDOW_ERROR1, "вiкно не знайдено" -STRING_ERROR_PARAMETERF_ERROR, " - %c\n" -STRING_ERROR_INVALID_SWITCH, " i - /%c\n" -STRING_ERROR_TOO_MANY_PARAMETERS, " i - %s\n" -STRING_ERROR_PATH_NOT_FOUND, " \n" -STRING_ERROR_FILE_NOT_FOUND, " \n" -STRING_ERROR_REQ_PARAM_MISSING, "ii ' \n" -STRING_ERROR_INVALID_DRIVE, "i \n" -STRING_ERROR_INVALID_PARAM_FORMAT, "i - %s\n" -STRING_ERROR_BADCOMMAND, "i i' - %s\n" -STRING_ERROR_OUT_OF_MEMORY, " 'i.\n" -STRING_ERROR_CANNOTPIPE, "! pipe! i !\n" -STRING_ERROR_D_PAUSEMSG, "i - i . . ." -STRING_ERROR_DRIVER_NOT_READY, " " +STRING_ERROR_PARAMETERF_ERROR, "Неправильний формат параметра - %c\n" +STRING_ERROR_INVALID_SWITCH, "Невірна опцiя - /%c\n" +STRING_ERROR_TOO_MANY_PARAMETERS, "Забагато параметрiв - %s\n" +STRING_ERROR_PATH_NOT_FOUND, "Шлях не знайдений\n" +STRING_ERROR_FILE_NOT_FOUND, "Файл не знайдений\n" +STRING_ERROR_REQ_PARAM_MISSING, "Вiдсутнiй обов'язковий параметр\n" +STRING_ERROR_INVALID_DRIVE, "Невiрне визначення диску\n" +STRING_ERROR_INVALID_PARAM_FORMAT, "Невiрний формат параметра - %s\n" +STRING_ERROR_BADCOMMAND, "Невiрна команда або iм'я файлу - %s\n" +STRING_ERROR_OUT_OF_MEMORY, "Недостатньо пам'ятi.\n" +STRING_ERROR_CANNOTPIPE, "Помилка! Неможливо використати pipe! Неможливо вiдкрити тимчасовий файл!\n" +STRING_ERROR_D_PAUSEMSG, "Натиснiть будь-яку клавiшу для продовження . . ." +STRING_ERROR_DRIVER_NOT_READY, "Пристрій не готовий" -STRING_PATH_ERROR, "CMD: i '%s'\n" +STRING_PATH_ERROR, "CMD: Не в середовищi '%s'\n" -STRING_REPLACE_ERROR1, "i - %s\n" -STRING_REPLACE_ERROR2, " - %s\n" -STRING_REPLACE_ERROR3, " ii , i i.\n" -STRING_REPLACE_ERROR4, "i ii i\n" -STRING_REPLACE_ERROR5, " - %s\n" -STRING_REPLACE_ERROR6, " - %s\n" -STRING_REPLACE_ERROR7, " 32\n" +STRING_REPLACE_ERROR1, "Невiрний ключ - %s\n" +STRING_REPLACE_ERROR2, "Шлях не знайдено - %s\n" +STRING_REPLACE_ERROR3, "Синтаксис iменi файлу, теки чи мiтки диску некоректнi.\n" +STRING_REPLACE_ERROR4, "Невiрна комбiнацiя параметрiв\n" +STRING_REPLACE_ERROR5, "Немає доступу - %s\n" +STRING_REPLACE_ERROR6, "Файли не знайдено - %s\n" +STRING_REPLACE_ERROR7, "Розширена помилка 32\n" -STRING_REACTOS_VERSION, "i ReactOS [i %s-%s]\n" -STRING_CMD_SHELLINFO, "\nI ReactOS\nVersion %s %s" -STRING_VERSION_RUNVER, " %s" -STRING_COPY_FILE , " %d (i) i\n" -STRING_DELETE_WIPE, "" -STRING_FOR_ERROR, "i ii i." -STRING_SCREEN_COL, " col" -STRING_SCREEN_ROW, " row" -STRING_TIMER_TIME " %d - %s: " -STRING_MKLINK_CREATED_SYMBOLIC, " i %s <<===>> %s\n" -STRING_MKLINK_CREATED_HARD, " %s <<===>> %s\n" -STRING_MKLINK_CREATED_JUNCTION, " ' %s <<===>> %s\n" -STRING_MORE, "i? " -STRING_CANCEL_BATCH_FILE, "\r\n Ctrl-Break. ? (Yes/No/All) " +STRING_REACTOS_VERSION, "Операцiйна Система ReactOS [Версiя %s-%s]\n" +STRING_CMD_SHELLINFO, "\nIнтерпретатор командного рядка ReactOS\nVersion %s %s" +STRING_VERSION_RUNVER, " запущений на %s" +STRING_COPY_FILE , " %d файл(iв) скопiйовано\n" +STRING_DELETE_WIPE, "витерто" +STRING_FOR_ERROR, "невiрна специфiкацiя змiнної." +STRING_SCREEN_COL, "неправильне значення col" +STRING_SCREEN_ROW, "неправильне значення row" +STRING_TIMER_TIME "Таймер %d - %s: " +STRING_MKLINK_CREATED_SYMBOLIC, "Створено символiчне посилання для %s <<===>> %s\n" +STRING_MKLINK_CREATED_HARD, "Створено жорстке посилання для %s <<===>> %s\n" +STRING_MKLINK_CREATED_JUNCTION, "Створено з'єднання для %s <<===>> %s\n" +STRING_MORE, "Бiльше? " +STRING_CANCEL_BATCH_FILE, "\r\nнатиснено Ctrl-Break. Припинити виконання пакетного файлу? (Yes/No/All) " -STRING_INVALID_OPERAND, "i ." -STRING_EXPECTED_CLOSE_PAREN, "i ')'." -STRING_EXPECTED_NUMBER_OR_VARIABLE,"i i' i." -STRING_SYNTAX_COMMAND_INCORRECT, " ." +STRING_INVALID_OPERAND, "Невiрний операнд." +STRING_EXPECTED_CLOSE_PAREN, "Очiкується ')'." +STRING_EXPECTED_NUMBER_OR_VARIABLE,"Очiкується число або iм'я змiнної." +STRING_SYNTAX_COMMAND_INCORRECT, "Некоректний синтаксис команди." END diff --git a/base/shell/cmd/precomp.h b/base/shell/cmd/precomp.h index 3eb404b69c4..c442b98c302 100644 --- a/base/shell/cmd/precomp.h +++ b/base/shell/cmd/precomp.h @@ -26,7 +26,7 @@ #include #define NTOS_MODE_USER -#include +#include #include "resource.h" diff --git a/base/shell/cmd/rsrc.rc b/base/shell/cmd/rsrc.rc index 01b56ee5ea7..3ac7a4f39e4 100644 --- a/base/shell/cmd/rsrc.rc +++ b/base/shell/cmd/rsrc.rc @@ -5,11 +5,13 @@ #include "lang/hu-HU.rc" #include "lang/id-ID.rc" #include "lang/it-IT.rc" -#include "lang/pl-PL.rc" #include "lang/no-NO.rc" #include "lang/sk-SK.rc" -#include "lang/uk-UA.rc" +// UTF-8 +#pragma code_page(65001) #include "lang/de-DE.rc" #include "lang/ja-JP.rc" +#include "lang/pl-PL.rc" #include "lang/ru-RU.rc" +#include "lang/uk-UA.rc" diff --git a/base/shell/explorer-new/CMakeLists.txt b/base/shell/explorer-new/CMakeLists.txt index 6066f89dc5a..034e592a031 100644 --- a/base/shell/explorer-new/CMakeLists.txt +++ b/base/shell/explorer-new/CMakeLists.txt @@ -18,11 +18,10 @@ list(APPEND SOURCE traywnd.c explorer.rc) -add_executable(explorer_new ${CMAKE_CURRENT_BINARY_DIR}/explorer_new_precomp.h.gch ${SOURCE}) +add_executable(explorer_new ${SOURCE}) target_link_libraries(explorer_new uuid) -add_pch(explorer_new ${CMAKE_CURRENT_SOURCE_DIR}/precomp.h ${SOURCE}) set_module_type(explorer_new win32gui) add_importlibs(explorer_new advapi32 @@ -37,5 +36,6 @@ add_importlibs(explorer_new msvcrt kernel32 ntdll) +add_pch(explorer_new precomp.h) add_cd_file(TARGET explorer_new DESTINATION reactos FOR all) diff --git a/base/shell/explorer-new/explorer.rc b/base/shell/explorer-new/explorer.rc index ed22ecab9cf..850afb64e6e 100644 --- a/base/shell/explorer-new/explorer.rc +++ b/base/shell/explorer-new/explorer.rc @@ -33,8 +33,11 @@ IDB_TASKBARPROP_NOLOCK_GROUP_QL BITMAP DISCARDABLE res/nolock_group_ql.bmp #include "lang/lt-LT.rc" #include "lang/nl-NL.rc" #include "lang/no-NO.rc" -#include "lang/pl-PL.rc" #include "lang/ro-RO.rc" -#include "lang/ru-RU.rc" #include "lang/sk-SK.rc" + +// UTF-8 +#pragma code_page(65001) +#include "lang/pl-PL.rc" +#include "lang/ru-RU.rc" #include "lang/uk-UA.rc" diff --git a/base/shell/explorer-new/lang/pl-PL.rc b/base/shell/explorer-new/lang/pl-PL.rc index 224b7ab4eef..b0916597441 100644 --- a/base/shell/explorer-new/lang/pl-PL.rc +++ b/base/shell/explorer-new/lang/pl-PL.rc @@ -1,5 +1,11 @@ -// Polish translation by Caemyr - Olaf Siejka (caemyr@gmail.com) June, 2007 -// updated by niski - Maciej Bialas (bjauy@o2.pl), July 2009 +/* + * translated by Caemyr - Olaf Siejka (Jun,2007) + * Use ReactOS forum PM or IRC to contact me + * http://www.reactos.org + * IRC: irc.freenode.net #reactos-pl; + * updated by niski - Maciej Bialas (bjauy@o2.pl), July 2009 + * UTF-8 conversion by Caemyr (May, 2011) + */ LANGUAGE LANG_POLISH, SUBLANG_DEFAULT @@ -8,10 +14,10 @@ BEGIN POPUP "" BEGIN MENUITEM SEPARATOR - MENUITEM "Meneder zada", ID_SHELL_CMD_OPEN_TASKMGR + MENUITEM "Menedżer zadań", ID_SHELL_CMD_OPEN_TASKMGR MENUITEM SEPARATOR - MENUITEM "&Zablokuj Pasek zada", ID_LOCKTASKBAR - MENUITEM "&Waciwoci", ID_SHELL_CMD_PROPERTIES + MENUITEM "&Zablokuj Pasek zadań", ID_LOCKTASKBAR + MENUITEM "&Właściwości", ID_SHELL_CMD_PROPERTIES END END @@ -37,9 +43,9 @@ BEGIN MENUITEM "P&anel sterowania", IDM_CONTROLPANEL, MFT_STRING, MFS_GRAYED MENUITEM "", -1, MFT_SEPARATOR MENUITEM "Za&bezpieczenia...", IDM_SECURITY, MFT_STRING, MFS_ENABLED - MENUITEM "P&oczenia sieciowe", IDM_NETWORKCONNECTIONS, MFT_STRING, MFS_ENABLED + MENUITEM "P&ołączenia sieciowe", IDM_NETWORKCONNECTIONS, MFT_STRING, MFS_ENABLED MENUITEM "&Drukarki i faksy", IDM_PRINTERSANDFAXES, MFT_STRING, MFS_ENABLED - MENUITEM "P&asek zada i Menu Start", IDM_TASKBARANDSTARTMENU, MFT_STRING, MFS_ENABLED + MENUITEM "P&asek zadań i Menu Start", IDM_TASKBARANDSTARTMENU, MFT_STRING, MFS_ENABLED END POPUP "&Szukaj", IDM_SEARCH BEGIN @@ -50,7 +56,7 @@ BEGIN MENUITEM "", 450, MFT_SEPARATOR, MFS_ENABLED MENUITEM "S&ynchronizuj", IDM_SYNCHRONIZE, MFT_STRING, MFS_ENABLED MENUITEM "&Wyloguj %s...", IDM_LOGOFF, MFT_STRING, MFS_ENABLED - MENUITEM "&Rozcz...", IDM_DISCONNECT, MFT_STRING, MFS_ENABLED + MENUITEM "&Rozłącz...", IDM_DISCONNECT, MFT_STRING, MFS_ENABLED MENUITEM "Oddokuj &komputer", IDM_UNDOCKCOMPUTER, MFT_STRING, MFS_ENABLED MENUITEM "&Zamknij system...", IDM_SHUTDOWN, MFT_STRING, MFS_ENABLED END @@ -59,17 +65,17 @@ END IDD_TASKBARPROP_TASKBAR DIALOGEX 0, 0, 252, 218 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "Pasek zada" +CAPTION "Pasek zadań" FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN - GROUPBOX "Wygld paska zada", IDC_STATIC, 6,6,240,121 + GROUPBOX "Wygląd paska zadań", IDC_STATIC, 6,6,240,121 CONTROL "", IDC_TASKBARPROP_TASKBARBITMAP, "Static", SS_BITMAP | SS_SUNKEN, 13,18,224,21 - AUTOCHECKBOX "&Zablokuj pasek zada", IDC_TASKBARPROP_LOCK, 13,45,200,10 - AUTOCHECKBOX "A&utomatyczne ukrywanie paska zada", IDC_TASKBARPROP_HIDE, 13,58,200,10 + AUTOCHECKBOX "&Zablokuj pasek zadań", IDC_TASKBARPROP_LOCK, 13,45,200,10 + AUTOCHECKBOX "A&utomatyczne ukrywanie paska zadań", IDC_TASKBARPROP_HIDE, 13,58,200,10 AUTOCHECKBOX "Zawsze &na wierzchu", IDC_TASKBARPROP_ONTOP, 13,71,200,10 - AUTOCHECKBOX "&Grupuj programy w pasku zada", IDC_TASKBARPROP_GROUP, 13,84,200,10 - AUTOCHECKBOX "Poka pasek &Szybkiego uruchamiania", IDC_TASKBARPROP_SHOWQL, 13,97,200,10 - AUTOCHECKBOX "&Poka podgld okien (miniaturki)", IDC_TASKBARPROP_WNDPREV, 13,110,200,10 + AUTOCHECKBOX "&Grupuj programy w pasku zadań", IDC_TASKBARPROP_GROUP, 13,84,200,10 + AUTOCHECKBOX "Pokaż pasek &Szybkiego uruchamiania", IDC_TASKBARPROP_SHOWQL, 13,97,200,10 + AUTOCHECKBOX "&Pokaż podgląd okien (miniaturki)", IDC_TASKBARPROP_WNDPREV, 13,110,200,10 END IDD_TASKBARPROP_STARTMENU DIALOGEX 0, 0, 252, 218 @@ -78,41 +84,41 @@ CAPTION "Menu Start" FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN AUTORADIOBUTTON "&Menu Start", IDC_TASKBARPROP_STARTMENU, 7,7,105,10 - LTEXT "Ten styl menu daje Tobie atwy dostp do Twoich folderw, ulubionych programw i wyszukiwania.", IDC_STATIC, 20,17,150,24, WS_DISABLED + LTEXT "Ten styl menu pozwala na łatwy dostąp do Twoich folderów, ulubionych programów i wyszukiwania.", IDC_STATIC, 20,17,150,24, WS_DISABLED PUSHBUTTON "&Dostosuj...", IDC_TASKBARPROP_STARTMENUCUST, 192,4,53,14, WS_DISABLED AUTORADIOBUTTON "&Klasyczne Menu Start", IDC_TASKBARPROP_STARTMENUCLASSIC, 7,47,105,10, WS_DISABLED - LTEXT "Ten styl menu zawiera klasyczny wygld i funkcjonalno",-1,20,57,150,24, WS_DISABLED + LTEXT "Ten styl menu zawiera klasyczny wygląd i funkcjonalność",-1,20,57,150,24, WS_DISABLED PUSHBUTTON "&Dostosuj...", IDC_TASKBARPROP_STARTMENUCLASSICCUST, 192,44,53,14, WS_DISABLED - GROUPBOX "Prywatno",IDC_STATIC, 7,100,238,42 - AUTOCHECKBOX "Zachowaj i wywietl list niedawno &otwartych plikw", IDC_TASKBARPROP_RECENTFILES, 14,114,224,10, WS_DISABLED - AUTOCHECKBOX "Zachowaj i wywietl list niedawno otwartych &programw",IDC_TASKBARPROP_RECENTFOLDERS, 14,128,224,10, WS_DISABLED + GROUPBOX "Prywatność",IDC_STATIC, 7,100,238,42 + AUTOCHECKBOX "Zachowaj i wyświetl listę niedawno &otwartych plików", IDC_TASKBARPROP_RECENTFILES, 14,114,224,10, WS_DISABLED + AUTOCHECKBOX "Zachowaj i wyświetl listę niedawno otwartych &programów",IDC_TASKBARPROP_RECENTFOLDERS, 14,128,224,10, WS_DISABLED END IDD_TASKBARPROP_NOTIFICATION DIALOGEX 0, 0, 252, 218 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "Obszar powiadomie" +CAPTION "Obszar powiadomień" FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN CONTROL "", IDC_TASKBARPROP_NOTIFICATIONBITMAP, "Static", SS_BITMAP | SS_SUNKEN,7,6,238,21, WS_DISABLED GROUPBOX "Ikony", IDC_STATIC, 6,33,240,58, WS_DISABLED - LTEXT "Moesz uporzdkowa obszar powiadomie poprzez ukrycie rzadko uywanych ikon.", IDC_STATIC, 13,48,223,16, WS_DISABLED + LTEXT "Możesz uporządkować obszar powiadomień poprzez ukrycie rzadko używanych ikon.", IDC_STATIC, 13,48,223,16, WS_DISABLED AUTOCHECKBOX "&Ukryj nieaktywne ikony", IDC_TASKBARPROP_HIDEICONS, 13,70,125,10, WS_DISABLED PUSHBUTTON "&Dostosuj...", IDC_TASKBARPROP_ICONCUST, 188,70,50,14, WS_DISABLED GROUPBOX "Ikony systemowe", IDC_STATIC, 6,97,240,84, WS_DISABLED LTEXT "Wybierz zawsze widoczne ikony systemowe.", IDC_STATIC, 13,112,223,16, WS_DISABLED AUTOCHECKBOX "&Zegar", IDC_TASKBARPROP_CLOCK, 13,126,200,10, WS_DISABLED - AUTOCHECKBOX "&Gono", IDC_TASKBARPROP_VOLUME, 13,139,200,10, WS_DISABLED - AUTOCHECKBOX "&Sie", IDC_TASKBARPROP_NETWORK, 13,152,200,10, WS_DISABLED - AUTOCHECKBOX "Z&arzdzanie energi", IDC_TASKBARPROP_POWER, 13,164,200,10, WS_DISABLED + AUTOCHECKBOX "&Głośność", IDC_TASKBARPROP_VOLUME, 13,139,200,10, WS_DISABLED + AUTOCHECKBOX "&Sieć", IDC_TASKBARPROP_NETWORK, 13,152,200,10, WS_DISABLED + AUTOCHECKBOX "Z&arządzanie energią", IDC_TASKBARPROP_POWER, 13,164,200,10, WS_DISABLED END IDD_TASKBARPROP_TOOLBARS DIALOGEX 0, 0, 252, 218 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "Paski narzdzi" +CAPTION "Paski narzędzi" FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN - LTEXT "Wybierz paski narzdzi, ktre chcesz doda do paska zada.", IDC_STATIC, 7,7,223,12, WS_DISABLED + LTEXT "Wybierz paski narzędzi, które chcesz dodać do paska zadań.", IDC_STATIC, 7,7,223,12, WS_DISABLED CONTROL "", IDC_TASKBARPROP_DESKBANDLIST, "SysTreeView32",WS_BORDER | WS_TABSTOP | WS_DISABLED, 7,20,236,160, WS_EX_CLIENTEDGE END @@ -120,13 +126,13 @@ END STRINGTABLE DISCARDABLE BEGIN IDS_START "Start" - IDS_PROPERTIES "Wa&ciwoci" - IDS_OPEN_ALL_USERS "&Otwrz - wszyscy uytkownicy" - IDS_EXPLORE_ALL_USERS "&Eksploruj - wszyscy uytkownicy" - IDS_STARTUP_ERROR "System nie moe uruchomi eksploratora, poniewa rejestr jest niedostpny lub uszkodzony." + IDS_PROPERTIES "Właś&ciwości" + IDS_OPEN_ALL_USERS "&Otwórz - wszyscy użytkownicy" + IDS_EXPLORE_ALL_USERS "&Eksploruj - wszyscy użytkownicy" + IDS_STARTUP_ERROR "System nie może uruchomić eksploratora, ponieważ rejestr jest niedostępny lub uszkodzony." END STRINGTABLE DISCARDABLE BEGIN - IDS_TASKBAR_STARTMENU_PROP_CAPTION "Waciwoci paska zada i Menu Start" + IDS_TASKBAR_STARTMENU_PROP_CAPTION "Właściwości paska zadań i Menu Start" END diff --git a/base/shell/explorer-new/lang/ru-RU.rc b/base/shell/explorer-new/lang/ru-RU.rc index 29fb95ebbd2..ed38a91c3d0 100644 --- a/base/shell/explorer-new/lang/ru-RU.rc +++ b/base/shell/explorer-new/lang/ru-RU.rc @@ -7,10 +7,10 @@ BEGIN POPUP "" BEGIN MENUITEM SEPARATOR - MENUITEM " ", ID_SHELL_CMD_OPEN_TASKMGR + MENUITEM "Диспетчер задач", ID_SHELL_CMD_OPEN_TASKMGR MENUITEM SEPARATOR - MENUITEM "& ", ID_LOCKTASKBAR - MENUITEM "&", ID_SHELL_CMD_PROPERTIES + MENUITEM "&Закрепить панель задач", ID_LOCKTASKBAR + MENUITEM "&Свойства", ID_SHELL_CMD_PROPERTIES END END @@ -19,113 +19,113 @@ BEGIN POPUP "" BEGIN MENUITEM "", -1, MFT_SEPARATOR - POPUP "&", IDM_PROGRAMS + POPUP "&Программы", IDM_PROGRAMS BEGIN - MENUITEM "()", -1, MFT_STRING, MFS_GRAYED + MENUITEM "(пусто)", -1, MFT_STRING, MFS_GRAYED END - POPUP "&", IDM_FAVORITES + POPUP "&Избранное", IDM_FAVORITES BEGIN - MENUITEM "()", -1, MFT_STRING, MFS_GRAYED + MENUITEM "(пусто)", -1, MFT_STRING, MFS_GRAYED END - POPUP "&", IDM_DOCUMENTS + POPUP "&Документы", IDM_DOCUMENTS BEGIN - MENUITEM "()", -1, MFT_STRING, MFS_GRAYED + MENUITEM "(пусто)", -1, MFT_STRING, MFS_GRAYED END - POPUP "&", IDM_SETTINGS + POPUP "&Настройки", IDM_SETTINGS BEGIN - MENUITEM "& ", IDM_CONTROLPANEL, MFT_STRING, MFS_GRAYED + MENUITEM "&Панель управления", IDM_CONTROLPANEL, MFT_STRING, MFS_GRAYED MENUITEM "", -1, MFT_SEPARATOR - MENUITEM "&...", IDM_SECURITY, MFT_STRING, MFS_ENABLED - MENUITEM "& ", IDM_NETWORKCONNECTIONS, MFT_STRING, MFS_ENABLED - MENUITEM "& ", IDM_PRINTERSANDFAXES, MFT_STRING, MFS_ENABLED - MENUITEM "& ", IDM_TASKBARANDSTARTMENU, MFT_STRING, MFS_ENABLED + MENUITEM "&Безопасность...", IDM_SECURITY, MFT_STRING, MFS_ENABLED + MENUITEM "&Сетевые подключения", IDM_NETWORKCONNECTIONS, MFT_STRING, MFS_ENABLED + MENUITEM "&Принтеры и факсы", IDM_PRINTERSANDFAXES, MFT_STRING, MFS_ENABLED + MENUITEM "&Панель задач и меню пуск", IDM_TASKBARANDSTARTMENU, MFT_STRING, MFS_ENABLED END - POPUP "&", IDM_SEARCH + POPUP "П&оиск", IDM_SEARCH BEGIN MENUITEM "", -1, MFT_SEPARATOR END - MENUITEM "& ", IDM_HELPANDSUPPORT, MFT_STRING, MFS_ENABLED - MENUITEM "&...", IDM_RUN, MFT_STRING, MFS_ENABLED + MENUITEM "Сп&равка и поддержка", IDM_HELPANDSUPPORT, MFT_STRING, MFS_ENABLED + MENUITEM "Запус&к...", IDM_RUN, MFT_STRING, MFS_ENABLED MENUITEM "", 450, MFT_SEPARATOR, MFS_ENABLED - MENUITEM "&", IDM_SYNCHRONIZE, MFT_STRING, MFS_ENABLED - MENUITEM "& %s...", IDM_LOGOFF, MFT_STRING, MFS_ENABLED - MENUITEM "&...", IDM_DISCONNECT, MFT_STRING, MFS_ENABLED - MENUITEM " &", IDM_UNDOCKCOMPUTER, MFT_STRING, MFS_ENABLED - MENUITEM "&...", IDM_SHUTDOWN, MFT_STRING, MFS_ENABLED + MENUITEM "Синхрониза&ция", IDM_SYNCHRONIZE, MFT_STRING, MFS_ENABLED + MENUITEM "Завершени&е сеанса %s...", IDM_LOGOFF, MFT_STRING, MFS_ENABLED + MENUITEM "Отклю&чение...", IDM_DISCONNECT, MFT_STRING, MFS_ENABLED + MENUITEM "Блокировать комп&ьютер", IDM_UNDOCKCOMPUTER, MFT_STRING, MFS_ENABLED + MENUITEM "В&ыключение...", IDM_SHUTDOWN, MFT_STRING, MFS_ENABLED END END IDD_TASKBARPROP_TASKBAR DIALOGEX 0, 0, 252, 218 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Панель задач" FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN - GROUPBOX " ", IDC_STATIC, 6,6,240,121 + GROUPBOX "Свойства панели задач", IDC_STATIC, 6,6,240,121 CONTROL "", IDC_TASKBARPROP_TASKBARBITMAP, "Static", SS_BITMAP | SS_SUNKEN, 13,18,224,21 - AUTOCHECKBOX "& ", IDC_TASKBARPROP_LOCK, 13,45,200,10 - AUTOCHECKBOX "& ", IDC_TASKBARPROP_HIDE, 13,58,200,10 - AUTOCHECKBOX "& ", IDC_TASKBARPROP_ONTOP, 13,71,200,10 - AUTOCHECKBOX "& ", IDC_TASKBARPROP_GROUP, 13,84,200,10 - AUTOCHECKBOX " & ", IDC_TASKBARPROP_SHOWQL, 13,97,200,10 - AUTOCHECKBOX "& ()", IDC_TASKBARPROP_WNDPREV, 13,110,200,10 + AUTOCHECKBOX "&Закрепить панель задач", IDC_TASKBARPROP_LOCK, 13,45,200,10 + AUTOCHECKBOX "&Автоматически скрывать панель задач", IDC_TASKBARPROP_HIDE, 13,58,200,10 + AUTOCHECKBOX "&Поверх других окон", IDC_TASKBARPROP_ONTOP, 13,71,200,10 + AUTOCHECKBOX "&Группировать схожие кнопки", IDC_TASKBARPROP_GROUP, 13,84,200,10 + AUTOCHECKBOX "Отображать панель &быстрого запуска", IDC_TASKBARPROP_SHOWQL, 13,97,200,10 + AUTOCHECKBOX "Отобра&жать образцы окон (эскизы)", IDC_TASKBARPROP_WNDPREV, 13,110,200,10 END IDD_TASKBARPROP_STARTMENU DIALOGEX 0, 0, 252, 218 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " """"" +CAPTION "Меню ""Пуск""" FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN - AUTORADIOBUTTON "& """"", IDC_TASKBARPROP_STARTMENU, 7,7,105,10 - LTEXT " , .", IDC_STATIC, 20,17,150,24, WS_DISABLED - PUSHBUTTON "&...", IDC_TASKBARPROP_STARTMENUCUST, 192,4,53,14, WS_DISABLED - AUTORADIOBUTTON "& """"", IDC_TASKBARPROP_STARTMENUCLASSIC, 7,47,105,10, WS_DISABLED - LTEXT " """".",-1,20,57,150,24, WS_DISABLED - PUSHBUTTON "&...", IDC_TASKBARPROP_STARTMENUCLASSICCUST, 192,44,53,14, WS_DISABLED - GROUPBOX "",IDC_STATIC, 7,100,238,50 - AUTOCHECKBOX " &", IDC_TASKBARPROP_RECENTFILES, 14,114,227,10, WS_DISABLED - AUTOCHECKBOX " &",IDC_TASKBARPROP_RECENTFOLDERS, 14,128,224,17, WS_DISABLED + AUTORADIOBUTTON "М&еню ""Пуск""", IDC_TASKBARPROP_STARTMENU, 7,7,105,10 + LTEXT "Этот стиль меню обеспечивает удобный доступ к папкам, часто используемым программам и поиску.", IDC_STATIC, 20,17,150,24, WS_DISABLED + PUSHBUTTON "&Настроить...", IDC_TASKBARPROP_STARTMENUCUST, 192,4,53,14, WS_DISABLED + AUTORADIOBUTTON "&Классичесское меню ""Пуск""", IDC_TASKBARPROP_STARTMENUCLASSIC, 7,47,105,10, WS_DISABLED + LTEXT "Классичесский стиль отображения меню ""Пуск"".",-1,20,57,150,24, WS_DISABLED + PUSHBUTTON "Н&астроить...", IDC_TASKBARPROP_STARTMENUCLASSICCUST, 192,44,53,14, WS_DISABLED + GROUPBOX "Конфиденциальность",IDC_STATIC, 7,100,238,50 + AUTOCHECKBOX "Хранить и отображать список недавно открывавшихся фа&йлов", IDC_TASKBARPROP_RECENTFILES, 14,114,227,10, WS_DISABLED + AUTOCHECKBOX "Хранить и отображать список недавно открывавшихся &программ",IDC_TASKBARPROP_RECENTFOLDERS, 14,128,224,17, WS_DISABLED END IDD_TASKBARPROP_NOTIFICATION DIALOGEX 0, 0, 252, 218 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Область уведомлений" FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN CONTROL "", IDC_TASKBARPROP_NOTIFICATIONBITMAP, "Static", SS_BITMAP | SS_SUNKEN,7,6,238,21, WS_DISABLED - GROUPBOX "", IDC_STATIC, 6,33,240,58, WS_DISABLED - LTEXT " , , .", IDC_STATIC, 13,48,223,16, WS_DISABLED - AUTOCHECKBOX "& ", IDC_TASKBARPROP_HIDEICONS, 13,70,140,10, WS_DISABLED - PUSHBUTTON "&...", IDC_TASKBARPROP_ICONCUST, 188,70,50,14, WS_DISABLED - GROUPBOX " ", IDC_STATIC, 6,97,240,84, WS_DISABLED - LTEXT " .", IDC_STATIC, 13,112,223,16, WS_DISABLED - AUTOCHECKBOX "&", IDC_TASKBARPROP_CLOCK, 13,126,200,10, WS_DISABLED - AUTOCHECKBOX "&", IDC_TASKBARPROP_VOLUME, 13,139,200,10, WS_DISABLED - AUTOCHECKBOX "&", IDC_TASKBARPROP_NETWORK, 13,152,200,10, WS_DISABLED - AUTOCHECKBOX "&", IDC_TASKBARPROP_POWER, 13,164,200,10, WS_DISABLED + GROUPBOX "Значки", IDC_STATIC, 6,33,240,58, WS_DISABLED + LTEXT "Можно избежать загромождения области уведомлений, скрывая значки, которые давно не использовались.", IDC_STATIC, 13,48,223,16, WS_DISABLED + AUTOCHECKBOX "&Скрывать неиспользуемые значки", IDC_TASKBARPROP_HIDEICONS, 13,70,140,10, WS_DISABLED + PUSHBUTTON "&Настроить...", IDC_TASKBARPROP_ICONCUST, 188,70,50,14, WS_DISABLED + GROUPBOX "Системные значки", IDC_STATIC, 6,97,240,84, WS_DISABLED + LTEXT "Выберите постоянно отображаемые системные значки.", IDC_STATIC, 13,112,223,16, WS_DISABLED + AUTOCHECKBOX "&Часы", IDC_TASKBARPROP_CLOCK, 13,126,200,10, WS_DISABLED + AUTOCHECKBOX "&Громкость", IDC_TASKBARPROP_VOLUME, 13,139,200,10, WS_DISABLED + AUTOCHECKBOX "&Сеть", IDC_TASKBARPROP_NETWORK, 13,152,200,10, WS_DISABLED + AUTOCHECKBOX "&Питание", IDC_TASKBARPROP_POWER, 13,164,200,10, WS_DISABLED END IDD_TASKBARPROP_TOOLBARS DIALOGEX 0, 0, 252, 218 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Панели инструментов" FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN - LTEXT " , .", IDC_STATIC, 7,7,238,12, WS_DISABLED + LTEXT "Выберите панели инструментов, отображаемые на панели задач.", IDC_STATIC, 7,7,238,12, WS_DISABLED CONTROL "", IDC_TASKBARPROP_DESKBANDLIST, "SysTreeView32",WS_BORDER | WS_TABSTOP | WS_DISABLED, 7,20,236,160, WS_EX_CLIENTEDGE END STRINGTABLE DISCARDABLE BEGIN - IDS_START "" - IDS_PROPERTIES "&" - IDS_OPEN_ALL_USERS "& " - IDS_EXPLORE_ALL_USERS "& " + IDS_START "Пуск" + IDS_PROPERTIES "&Свойства" + IDS_OPEN_ALL_USERS "&Все пользователи" + IDS_EXPLORE_ALL_USERS "&Обзор Всех пользователей" IDS_STARTUP_ERROR "The system cannot start explorer because the registry is corrupted or unavailable." END STRINGTABLE DISCARDABLE BEGIN - IDS_TASKBAR_STARTMENU_PROP_CAPTION " " + IDS_TASKBAR_STARTMENU_PROP_CAPTION "Свойства меню Пуск и Панели задач" END diff --git a/base/shell/explorer-new/lang/uk-UA.rc b/base/shell/explorer-new/lang/uk-UA.rc index 0811238087d..d2a6ffe4804 100644 --- a/base/shell/explorer-new/lang/uk-UA.rc +++ b/base/shell/explorer-new/lang/uk-UA.rc @@ -13,10 +13,10 @@ BEGIN POPUP "" BEGIN MENUITEM SEPARATOR - MENUITEM " ", ID_SHELL_CMD_OPEN_TASKMGR + MENUITEM "Диспетчер завдань", ID_SHELL_CMD_OPEN_TASKMGR MENUITEM SEPARATOR - MENUITEM "& ", ID_LOCKTASKBAR - MENUITEM "&", ID_SHELL_CMD_PROPERTIES + MENUITEM "&Закріпити панель завдань", ID_LOCKTASKBAR + MENUITEM "В&ластивості", ID_SHELL_CMD_PROPERTIES END END @@ -25,113 +25,113 @@ BEGIN POPUP "" BEGIN MENUITEM "", -1, MFT_SEPARATOR - POPUP "&", IDM_PROGRAMS + POPUP "&Програми", IDM_PROGRAMS BEGIN - MENUITEM "()", -1, MFT_STRING, MFS_GRAYED + MENUITEM "(пусто)", -1, MFT_STRING, MFS_GRAYED END - POPUP "&", IDM_FAVORITES + POPUP "&Обране", IDM_FAVORITES BEGIN - MENUITEM "()", -1, MFT_STRING, MFS_GRAYED + MENUITEM "(пусто)", -1, MFT_STRING, MFS_GRAYED END - POPUP "&", IDM_DOCUMENTS + POPUP "До&кументи", IDM_DOCUMENTS BEGIN - MENUITEM "()", -1, MFT_STRING, MFS_GRAYED + MENUITEM "(пусто)", -1, MFT_STRING, MFS_GRAYED END - POPUP "&", IDM_SETTINGS + POPUP "Н&алаштування", IDM_SETTINGS BEGIN - MENUITEM "& ", IDM_CONTROLPANEL, MFT_STRING, MFS_GRAYED + MENUITEM "П&анель керування", IDM_CONTROLPANEL, MFT_STRING, MFS_GRAYED MENUITEM "", -1, MFT_SEPARATOR - MENUITEM "&...", IDM_SECURITY, MFT_STRING, MFS_ENABLED - MENUITEM "& ", IDM_NETWORKCONNECTIONS, MFT_STRING, MFS_ENABLED - MENUITEM "& ", IDM_PRINTERSANDFAXES, MFT_STRING, MFS_ENABLED - MENUITEM " & """"", IDM_TASKBARANDSTARTMENU, MFT_STRING, MFS_ENABLED + MENUITEM "&Безпека...", IDM_SECURITY, MFT_STRING, MFS_ENABLED + MENUITEM "&Мережні підключення", IDM_NETWORKCONNECTIONS, MFT_STRING, MFS_ENABLED + MENUITEM "Пр&интери й факси", IDM_PRINTERSANDFAXES, MFT_STRING, MFS_ENABLED + MENUITEM "Панель &завдань і меню ""Пуск""", IDM_TASKBARANDSTARTMENU, MFT_STRING, MFS_ENABLED END - POPUP "&", IDM_SEARCH + POPUP "З&найти", IDM_SEARCH BEGIN MENUITEM "", -1, MFT_SEPARATOR END - MENUITEM "& ", IDM_HELPANDSUPPORT, MFT_STRING, MFS_ENABLED - MENUITEM " &...", IDM_RUN, MFT_STRING, MFS_ENABLED + MENUITEM "&Довідка та підтримка", IDM_HELPANDSUPPORT, MFT_STRING, MFS_ENABLED + MENUITEM "Запуск про&грами...", IDM_RUN, MFT_STRING, MFS_ENABLED MENUITEM "", 450, MFT_SEPARATOR, MFS_ENABLED - MENUITEM "&", IDM_SYNCHRONIZE, MFT_STRING, MFS_ENABLED - MENUITEM "& %s...", IDM_LOGOFF, MFT_STRING, MFS_ENABLED - MENUITEM "&...", IDM_DISCONNECT, MFT_STRING, MFS_ENABLED - MENUITEM " '&", IDM_UNDOCKCOMPUTER, MFT_STRING, MFS_ENABLED - MENUITEM "& ...", IDM_SHUTDOWN, MFT_STRING, MFS_ENABLED + MENUITEM "Син&хронізація", IDM_SYNCHRONIZE, MFT_STRING, MFS_ENABLED + MENUITEM "Завер&шення сеансу %s...", IDM_LOGOFF, MFT_STRING, MFS_ENABLED + MENUITEM "В&имкнення...", IDM_DISCONNECT, MFT_STRING, MFS_ENABLED + MENUITEM "Заблокування комп'&ютера", IDM_UNDOCKCOMPUTER, MFT_STRING, MFS_ENABLED + MENUITEM "&Завершення роботи...", IDM_SHUTDOWN, MFT_STRING, MFS_ENABLED END END IDD_TASKBARPROP_TASKBAR DIALOGEX 0, 0, 252, 218 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Панель задач" FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN - GROUPBOX " ", IDC_STATIC, 6,6,240,121 + GROUPBOX "Властивості панелі задач", IDC_STATIC, 6,6,240,121 CONTROL "", IDC_TASKBARPROP_TASKBARBITMAP, "Static", SS_BITMAP | SS_SUNKEN, 13,18,224,21 - AUTOCHECKBOX "& ", IDC_TASKBARPROP_LOCK, 13,45,200,10 - AUTOCHECKBOX "& ", IDC_TASKBARPROP_HIDE, 13,58,200,10 - AUTOCHECKBOX "& ", IDC_TASKBARPROP_ONTOP, 13,71,200,10 - AUTOCHECKBOX "& ", IDC_TASKBARPROP_GROUP, 13,84,200,10 - AUTOCHECKBOX "³ & ", IDC_TASKBARPROP_SHOWQL, 13,97,200,10 - AUTOCHECKBOX "&³ ()", IDC_TASKBARPROP_WNDPREV, 13,110,200,10 + AUTOCHECKBOX "&Заборонити панель задач", IDC_TASKBARPROP_LOCK, 13,45,200,10 + AUTOCHECKBOX "&Автоматично приховувати панель задач", IDC_TASKBARPROP_HIDE, 13,58,200,10 + AUTOCHECKBOX "&Поверх інших вікон", IDC_TASKBARPROP_ONTOP, 13,71,200,10 + AUTOCHECKBOX "&Групувати схожі кнопки", IDC_TASKBARPROP_GROUP, 13,84,200,10 + AUTOCHECKBOX "Відображати панель &швидкого запуску", IDC_TASKBARPROP_SHOWQL, 13,97,200,10 + AUTOCHECKBOX "&Відображати зразки вікон (ескізи)", IDC_TASKBARPROP_WNDPREV, 13,110,200,10 END IDD_TASKBARPROP_STARTMENU DIALOGEX 0, 0, 252, 218 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " """"" +CAPTION "Меню ""Пуск""" FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN - AUTORADIOBUTTON "& """"", IDC_TASKBARPROP_STARTMENU, 7,7,105,10 - LTEXT " , .", IDC_STATIC, 20,17,150,24, WS_DISABLED - PUSHBUTTON "&...", IDC_TASKBARPROP_STARTMENUCUST, 192,4,53,14, WS_DISABLED - AUTORADIOBUTTON " """"", IDC_TASKBARPROP_STARTMENUCLASSIC, 7,47,105,10, WS_DISABLED - LTEXT " ",-1,20,57,150,24, WS_DISABLED - PUSHBUTTON "&...", IDC_TASKBARPROP_STARTMENUCLASSICCUST, 192,44,53,14, WS_DISABLED - GROUPBOX "",IDC_STATIC, 7,100,238,42 - AUTOCHECKBOX " &", IDC_TASKBARPROP_RECENTFILES, 14,114,224,10, WS_DISABLED - AUTOCHECKBOX " &",IDC_TASKBARPROP_RECENTFOLDERS, 14,128,224,10, WS_DISABLED + AUTORADIOBUTTON "&Меню ""Пуск""", IDC_TASKBARPROP_STARTMENU, 7,7,105,10 + LTEXT "Цей стиль меню забезпечує зручний доступ до папок, часто використовуваних програм та пошуку.", IDC_STATIC, 20,17,150,24, WS_DISABLED + PUSHBUTTON "&Налаштувати...", IDC_TASKBARPROP_STARTMENUCUST, 192,4,53,14, WS_DISABLED + AUTORADIOBUTTON "Класичне меню ""Пуск""", IDC_TASKBARPROP_STARTMENUCLASSIC, 7,47,105,10, WS_DISABLED + LTEXT "Цей стиль меню має класичний вигляд і функціональність",-1,20,57,150,24, WS_DISABLED + PUSHBUTTON "&Налаштувати...", IDC_TASKBARPROP_STARTMENUCLASSICCUST, 192,44,53,14, WS_DISABLED + GROUPBOX "Конфіденційність",IDC_STATIC, 7,100,238,42 + AUTOCHECKBOX "Зберігати та відображати список недавно відкритих &файлів", IDC_TASKBARPROP_RECENTFILES, 14,114,224,10, WS_DISABLED + AUTOCHECKBOX "Зберігати та відображати список недавно відкритих &програм",IDC_TASKBARPROP_RECENTFOLDERS, 14,128,224,10, WS_DISABLED END IDD_TASKBARPROP_NOTIFICATION DIALOGEX 0, 0, 252, 218 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Область сповіщень" FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN CONTROL "", IDC_TASKBARPROP_NOTIFICATIONBITMAP, "Static", SS_BITMAP | SS_SUNKEN,7,6,238,21, WS_DISABLED - GROUPBOX "", IDC_STATIC, 6,33,240,58, WS_DISABLED - LTEXT " , , .", IDC_STATIC, 13,48,223,16, WS_DISABLED - AUTOCHECKBOX "& ", IDC_TASKBARPROP_HIDEICONS, 13,70,125,10, WS_DISABLED - PUSHBUTTON "&...", IDC_TASKBARPROP_ICONCUST, 188,70,50,14, WS_DISABLED - GROUPBOX " ", IDC_STATIC, 6,97,240,84, WS_DISABLED - LTEXT " .", IDC_STATIC, 13,112,223,16, WS_DISABLED - AUTOCHECKBOX "&", IDC_TASKBARPROP_CLOCK, 13,126,200,10, WS_DISABLED - AUTOCHECKBOX "&", IDC_TASKBARPROP_VOLUME, 13,139,200,10, WS_DISABLED - AUTOCHECKBOX "&", IDC_TASKBARPROP_NETWORK, 13,152,200,10, WS_DISABLED - AUTOCHECKBOX "&", IDC_TASKBARPROP_POWER, 13,164,200,10, WS_DISABLED + GROUPBOX "Значки", IDC_STATIC, 6,33,240,58, WS_DISABLED + LTEXT "Можна уникнути захаращення області повідомлень, приховуючи значки, які давно не використовувалися.", IDC_STATIC, 13,48,223,16, WS_DISABLED + AUTOCHECKBOX "&Приховувати невживані значки", IDC_TASKBARPROP_HIDEICONS, 13,70,125,10, WS_DISABLED + PUSHBUTTON "&Налаштувати...", IDC_TASKBARPROP_ICONCUST, 188,70,50,14, WS_DISABLED + GROUPBOX "Системні значки", IDC_STATIC, 6,97,240,84, WS_DISABLED + LTEXT "Оберіть системні значки для постійного відображення.", IDC_STATIC, 13,112,223,16, WS_DISABLED + AUTOCHECKBOX "&Годинник", IDC_TASKBARPROP_CLOCK, 13,126,200,10, WS_DISABLED + AUTOCHECKBOX "&Гучність", IDC_TASKBARPROP_VOLUME, 13,139,200,10, WS_DISABLED + AUTOCHECKBOX "&Мережа", IDC_TASKBARPROP_NETWORK, 13,152,200,10, WS_DISABLED + AUTOCHECKBOX "&Живлення", IDC_TASKBARPROP_POWER, 13,164,200,10, WS_DISABLED END IDD_TASKBARPROP_TOOLBARS DIALOGEX 0, 0, 252, 218 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Панелі інструментів" FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN - LTEXT " , .", IDC_STATIC, 7,7,223,12, WS_DISABLED + LTEXT "Оберіть панелі інструментів, які будуть відображатись на панелі завдань.", IDC_STATIC, 7,7,223,12, WS_DISABLED CONTROL "", IDC_TASKBARPROP_DESKBANDLIST, "SysTreeView32",WS_BORDER | WS_TABSTOP | WS_DISABLED, 7,20,236,160, WS_EX_CLIENTEDGE END STRINGTABLE DISCARDABLE BEGIN - IDS_START "" - IDS_PROPERTIES "&" - IDS_OPEN_ALL_USERS "& " - IDS_EXPLORE_ALL_USERS "& " - IDS_STARTUP_ERROR " explorer, ." + IDS_START "Пуск" + IDS_PROPERTIES "В&ластивості" + IDS_OPEN_ALL_USERS "&Всі користувачі" + IDS_EXPLORE_ALL_USERS "&Огляд всіх користувачів" + IDS_STARTUP_ERROR "Система не може стартувати explorer, оскільки реєстр пошкоджений або відсутній." END STRINGTABLE DISCARDABLE BEGIN - IDS_TASKBAR_STARTMENU_PROP_CAPTION " " + IDS_TASKBAR_STARTMENU_PROP_CAPTION "Властивості меню Пуск та Панелі завдань" END diff --git a/base/shell/explorer/CMakeLists.txt b/base/shell/explorer/CMakeLists.txt index 3cf6006f382..ac1f970bfd0 100644 --- a/base/shell/explorer/CMakeLists.txt +++ b/base/shell/explorer/CMakeLists.txt @@ -2,6 +2,7 @@ add_subdirectory(notifyhook) set_unicode() +set_rc_compiler() #NOTE : explorer doesn't follow standard c++, and so doesn't compile with stlport headers #I'm not willing to do it if explorer_new is hanging around. @@ -10,10 +11,9 @@ set_unicode() add_definitions( -DWIN32 - -D__WINDRES__ - -D_DLL -D__USE_CRTIMP) + -D__WINDRES__) -#add_pch(explorer ${CMAKE_CURRENT_SOURCE_DIR}/precomp.h SOURCE) +#add_pch(explorer precomp.h) include_directories(${CMAKE_CURRENT_SOURCE_DIR}) list(APPEND SOURCE @@ -53,7 +53,7 @@ list(APPEND SOURCE utility/window.cpp utility/shellbrowserimpl.cpp) # utility/shelltests.cpp -add_executable(explorer ${SOURCE}) #${CMAKE_CURRENT_BINARY_DIR}/explorer_precomp.h.gch ${SOURCE}) +add_executable(explorer ${SOURCE}) set_subsystem(explorer windows) set_entrypoint(explorer WinMainCRTStartup) @@ -67,9 +67,7 @@ target_link_libraries(explorer uuid) add_importlibs(explorer advapi32 gdi32 user32 ws2_32 msimg32 comctl32 ole32 oleaut32 shell32 notifyhook msvcrt kernel32 ntdll) - set_image_base(explorer 0x00400000) - add_dependencies(explorer psdk) add_cd_file(TARGET explorer DESTINATION reactos FOR all) add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/explorer-cfg-template.xml DESTINATION reactos FOR all) diff --git a/base/shell/explorer/explorer-pl.rc b/base/shell/explorer/explorer-pl.rc index 8624c4b6755..2001458d76d 100644 --- a/base/shell/explorer/explorer-pl.rc +++ b/base/shell/explorer/explorer-pl.rc @@ -14,11 +14,11 @@ ///////////////////////////////////////////////////////////////////////////// // Polish (PL) resources +// UTF-8 conversion by Caemyr (May, 2011) #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) #ifdef _WIN32 LANGUAGE LANG_POLISH, SUBLANG_DEFAULT -#pragma code_page(1250) #endif //_WIN32 ///////////////////////////////////////////////////////////////////////////// @@ -32,30 +32,30 @@ BEGIN BEGIN MENUITEM "Urucho&m...", ID_EXECUTE MENUITEM SEPARATOR - MENUITEM "Za&kocz", ID_FILE_EXIT + MENUITEM "Za&kończ", ID_FILE_EXIT END POPUP "&Widok" BEGIN MENUITEM "Przyciski &standardowe", ID_VIEW_TOOL_BAR MENUITEM "P&rzyciski dodatkowe", ID_VIEW_EXTRA_BAR - MENUITEM "Pasek &dyskw", ID_VIEW_DRIVE_BAR, CHECKED + MENUITEM "Pasek &dysków", ID_VIEW_DRIVE_BAR, CHECKED MENUITEM "Pasek &boczny", ID_VIEW_SIDE_BAR MENUITEM "Pasek sta&nu", ID_VIEW_STATUSBAR MENUITEM SEPARATOR - MENUITEM "&Odwie\tF5", ID_REFRESH - MENUITEM "P&eny ekran\tCtrl+Shift+S", ID_VIEW_FULLSCREEN + MENUITEM "&Odśwież\tF5", ID_REFRESH + MENUITEM "P&ełny ekran\tCtrl+Shift+S", ID_VIEW_FULLSCREEN MENUITEM "SDI", ID_VIEW_SDI END POPUP "&Okna" BEGIN MENUITEM "Nowe &okno", ID_WINDOW_NEW MENUITEM "&Kaskadowo\tShift+F5", ID_WINDOW_CASCADE - MENUITEM "&Ssiadujco poziomo", ID_WINDOW_TILE_HORZ - MENUITEM "Ssiadujco &pionowo\tShift+F4", ID_WINDOW_TILE_VERT + MENUITEM "&Sąsiadująco poziomo", ID_WINDOW_TILE_HORZ + MENUITEM "Sąsiadująco &pionowo\tShift+F4", ID_WINDOW_TILE_VERT MENUITEM "&Autorozmieszczanie", ID_WINDOW_AUTOSORT - MENUITEM "Rozmie wedug &nazwy", ID_WINDOW_ARRANGE + MENUITEM "Rozmieść według &nazwy", ID_WINDOW_ARRANGE END - POPUP "&Narzdzia" + POPUP "&Narzędzia" BEGIN MENUITEM "&Opcje", ID_TOOLS_OPTIONS END @@ -71,8 +71,8 @@ IDM_DESKTOPBAR MENU DISCARDABLE BEGIN POPUP "" BEGIN - MENUITEM "&Waciwoci", ID_DESKTOPBAR_SETTINGS - MENUITEM "Meneder &zada", ID_TASKMGR + MENUITEM "&Właściwości", ID_DESKTOPBAR_SETTINGS + MENUITEM "Menedżer &zadań", ID_TASKMGR MENUITEM SEPARATOR MENUITEM "ReactOS Explorer - &informacje", ID_ABOUT_EXPLORER END @@ -82,8 +82,8 @@ IDM_VOLUME MENU DISCARDABLE BEGIN POPUP "" BEGIN - MENUITEM "&Otwrz regulacj gonoci", ID_TRAY_VOLUME - MENUITEM "&Ustaw waciwoci audio", ID_VOLUME_PROPERTIES + MENUITEM "&Otwórz regulację głośności", ID_TRAY_VOLUME + MENUITEM "&Ustaw właściwości audio", ID_VOLUME_PROPERTIES END END @@ -91,10 +91,10 @@ IDM_NOTIFYAREA MENU DISCARDABLE BEGIN POPUP "" BEGIN - MENUITEM "&Poka ukryte ikony", ID_SHOW_HIDDEN_ICONS - MENUITEM "&Ukrywaj nieuywane ikony", ID_SHOW_ICON_BUTTON + MENUITEM "&Pokaż ukryte ikony", ID_SHOW_HIDDEN_ICONS + MENUITEM "&Ukrywaj nieużywane ikony", ID_SHOW_ICON_BUTTON MENUITEM "&Konfiguruj powiadomienia", ID_CONFIG_NOTIFYAREA - MENUITEM "Ustaw &dat/godzin", ID_CONFIG_TIME + MENUITEM "Ustaw &datę/godzinę", ID_CONFIG_TIME MENUITEM SEPARATOR MENUITEM "ReactOS Explorer - &informacje", ID_ABOUT_EXPLORER END @@ -106,7 +106,7 @@ BEGIN BEGIN MENUITEM "Urucho&m...", ID_EXECUTE MENUITEM SEPARATOR - MENUITEM "Za&kocz", ID_FILE_EXIT + MENUITEM "Za&kończ", ID_FILE_EXIT END POPUP "&Widok" BEGIN @@ -114,11 +114,11 @@ BEGIN MENUITEM "Pasek &boczny", ID_VIEW_SIDE_BAR, GRAYED MENUITEM "Pasek sta&nu", ID_VIEW_STATUSBAR MENUITEM SEPARATOR - MENUITEM "&Odwie\tF5", ID_REFRESH - MENUITEM "P&eny ekran\tCtrl+Shift+S", ID_VIEW_FULLSCREEN + MENUITEM "&Odśwież\tF5", ID_REFRESH + MENUITEM "P&ełny ekran\tCtrl+Shift+S", ID_VIEW_FULLSCREEN MENUITEM "&MDI", ID_VIEW_MDI END - POPUP "&Narzdzia" + POPUP "&Narzędzia" BEGIN MENUITEM "&Opcje", ID_TOOLS_OPTIONS END @@ -169,45 +169,45 @@ END IDD_DESKBAR_DESKTOP DIALOGEX DISCARDABLE 0, 0, 212, 194 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Waciwoci pulpitu" +CAPTION "Właściwości pulpitu" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Wybierz sposb ukadania ikon:", + LTEXT "Wybierz sposób układania ikon:", IDC_STATIC,7,7,166,8 - CONTROL "lewy/gr w d",IDC_ICON_ALIGN_0,"Button",BS_OWNERDRAW | + CONTROL "lewy/gór w dół",IDC_ICON_ALIGN_0,"Button",BS_OWNERDRAW | BS_BOTTOM | WS_TABSTOP,7,25,46,44 - CONTROL "lewy/gr w prw",IDC_ICON_ALIGN_1,"Button",BS_OWNERDRAW | + CONTROL "lewy/gór w prw",IDC_ICON_ALIGN_1,"Button",BS_OWNERDRAW | BS_BOTTOM | WS_TABSTOP,57,25,46,44 - CONTROL "prwy/gr w lewo",IDC_ICON_ALIGN_2,"Button",BS_OWNERDRAW | + CONTROL "prwy/gór w lewo",IDC_ICON_ALIGN_2,"Button",BS_OWNERDRAW | BS_BOTTOM | WS_TABSTOP,110,25,46,44 - CONTROL "prwy/gr w d",IDC_ICON_ALIGN_3,"Button",BS_OWNERDRAW | + CONTROL "prwy/gór w dół",IDC_ICON_ALIGN_3,"Button",BS_OWNERDRAW | BS_BOTTOM | WS_TABSTOP,159,25,46,44 - CONTROL "lewy/dol.w gr",IDC_ICON_ALIGN_4,"Button",BS_OWNERDRAW | + CONTROL "lewy/dol.w gór",IDC_ICON_ALIGN_4,"Button",BS_OWNERDRAW | BS_BOTTOM | WS_TABSTOP,7,73,46,44 CONTROL "lewy/dol.w praw",IDC_ICON_ALIGN_5,"Button",BS_OWNERDRAW | BS_BOTTOM | WS_TABSTOP,57,73,46,44 CONTROL "prwy/dol.w lewo",IDC_ICON_ALIGN_6,"Button",BS_OWNERDRAW | BS_BOTTOM | WS_TABSTOP,110,73,46,44 - CONTROL "prwy/dol.w gr",IDC_ICON_ALIGN_7,"Button",BS_OWNERDRAW | + CONTROL "prwy/dol.w gór",IDC_ICON_ALIGN_7,"Button",BS_OWNERDRAW | BS_BOTTOM | WS_TABSTOP,159,73,46,44 - CONTROL "obustr. w d",IDC_ICON_ALIGN_8,"Button",BS_OWNERDRAW | + CONTROL "obustr. w dół",IDC_ICON_ALIGN_8,"Button",BS_OWNERDRAW | BS_BOTTOM | WS_TABSTOP,7,121,46,44 CONTROL "na brzegach",IDC_ICON_ALIGN_9,"Button",BS_OWNERDRAW | BS_BOTTOM | WS_TABSTOP,57,121,46,44 - CONTROL "dookoa",IDC_ICON_ALIGN_10,"Button",BS_OWNERDRAW | + CONTROL "dookoła",IDC_ICON_ALIGN_10,"Button",BS_OWNERDRAW | BS_BOTTOM | WS_TABSTOP,110,121,46,44 CONTROL "",IDC_ICON_ALIGN_11,"Button",BS_OWNERDRAW | BS_BOTTOM | WS_TABSTOP,159,121,46,44 -// CONTROL "Wywietlaj &numer wersji",ID_DESKTOP_VERSION,"Button", +// CONTROL "Wyświetlaj &numer wersji",ID_DESKTOP_VERSION,"Button", // BS_AUTOCHECKBOX | WS_TABSTOP,7,177,91,10 END IDD_DESKBAR_TASKBAR DIALOGEX DISCARDABLE 0, 0, 210, 194 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Waciwoci paska zada" +CAPTION "Właściwości paska zadań" FONT 8, "MS Shell Dlg" BEGIN - CONTROL "Poka &zegar",ID_SHOW_CLOCK,"Button",BS_AUTOCHECKBOX | + CONTROL "Pokaż &zegar",ID_SHOW_CLOCK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,152,52,10 CONTROL "&Ukrywaj nieaktywne ikony", ID_HIDE_INACTIVE_ICONS,"Button",BS_AUTOCHECKBOX | @@ -217,7 +217,7 @@ END IDD_DESKBAR_STARTMENU DIALOGEX DISCARDABLE 0, 0, 210, 194 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Waciwoci Menu Start" +CAPTION "Właściwości Menu Start" FONT 8, "MS Shell Dlg" BEGIN END @@ -226,18 +226,18 @@ IDD_NOTIFYAREA DIALOGEX 0, 0, 208, 174 STYLE DS_SHELLFONT | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME EXSTYLE WS_EX_APPWINDOW -CAPTION "Konfiguracja ikon powiadomie" +CAPTION "Konfiguracja ikon powiadomień" FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN CONTROL "Tree1",IDC_NOTIFY_ICONS,"SysTreeView32",TVS_HASLINES | TVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP,7,7,194,31 - LTEXT "&Podpowied:",IDC_LABEL1,7,44,40,8 + LTEXT "&Podpowiedź:",IDC_LABEL1,7,44,40,8 EDITTEXT IDC_NOTIFY_TOOLTIP,58,42,143,14,ES_AUTOHSCROLL - LTEXT "&Tytu okna:",IDC_LABEL2,7,63,44,8 + LTEXT "&Tytuł okna:",IDC_LABEL2,7,63,44,8 EDITTEXT IDC_NOTIFY_TITLE,58,60,143,14,ES_AUTOHSCROLL - LTEXT "cieka:",IDC_LABEL3,7,81,43,8 + LTEXT "Ścieżka:",IDC_LABEL3,7,81,43,8 EDITTEXT IDC_NOTIFY_MODULE,58,78,143,14,ES_AUTOHSCROLL - GROUPBOX "&Sposb wywietlania",IDC_LABEL4,7,96,157,28 + GROUPBOX "&Sposób wyświetlania",IDC_LABEL4,7,96,157,28 CONTROL "&widoczny",IDC_NOTIFY_SHOW,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,15,108,33,10 CONTROL "&ukryty",IDC_NOTIFY_HIDE,"Button",BS_AUTORADIOBUTTON,66, @@ -248,7 +248,7 @@ BEGIN LTEXT "&Zmodyfikowany:",IDC_LABEL6,7,132,43,8 EDITTEXT IDC_LAST_CHANGE,59,129,105,14,ES_AUTOHSCROLL | ES_READONLY - CONTROL "Po&ka wszystkie",ID_SHOW_HIDDEN_ICONS,"Button", + CONTROL "Po&każ wszystkie",ID_SHOW_HIDDEN_ICONS,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,7,154,56,10 DEFPUSHBUTTON "&OK",IDOK,91,153,50,14,WS_GROUP PUSHBUTTON "&Anuluj",IDCANCEL,151,153,50,14 @@ -257,21 +257,21 @@ END IDD_MDI_SDI DIALOGEX 0, 0, 194, 157 STYLE DS_SHELLFONT | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_APPWINDOW -CAPTION "Tryb wywietlania okien" +CAPTION "Tryb wyświetlania okien" FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN - LTEXT "Wybierz tryb wywietlania okien:", + LTEXT "Wybierz tryb wyświetlania okien:", IDC_STATIC,7,7,160,8 CONTROL "&MDI (Otwieraj w jednym oknie)",IDC_MDI,"Button", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,7,31,124,10 - CONTROL "&SDI (Otwieraj we wasnym oknie)",IDC_SDI,"Button", + CONTROL "&SDI (Otwieraj we własnym oknie)",IDC_SDI,"Button", BS_AUTORADIOBUTTON,7,62,118,10 CONTROL 170,IDC_STATIC,"Static",SS_BITMAP,145,23,15,13 CONTROL 171,IDC_STATIC,"Static",SS_BITMAP,145,57,15,13 CONTROL "&Otwieraj podkatalogi w nowych oknach", IDC_SEPARATE_SUBFOLDERS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,90,135,10 - LTEXT "Te opcje bd stosowane w przyszoci do wszystkich okien.", + LTEXT "Te opcje będą stosowane w przyszłości do wszystkich okien.", IDC_STATIC,7,111,174,22 DEFPUSHBUTTON "&OK",IDOK,29,136,50,14,WS_GROUP PUSHBUTTON "&Anuluj",IDCANCEL,106,136,50,14 @@ -349,41 +349,41 @@ BEGIN IDS_STARTMENU "Menu Start" IDS_MINIMIZE_ALL "Minimalizuj wszystko" IDS_DESKTOP_NUM "Pulpit %d" - IDS_VOLUME "Gono" + IDS_VOLUME "Głośność" IDS_ITEMS_CUR "Aktualne pozycje" IDS_ITEMS_CONFIGURED "ustawienia" IDS_ITEMS_VISIBLE "widoczne" IDS_ITEMS_HIDDEN "ukryte" - IDS_NOTIFY_SHOW "poka" + IDS_NOTIFY_SHOW "pokaż" IDS_NOTIFY_HIDE "ukryj" IDS_NOTIFY_AUTOHIDE "autoukrywanie" - IDS_SHOW_HIDDEN_ICONS "Poka ukryte ikony" + IDS_SHOW_HIDDEN_ICONS "Pokaż ukryte ikony" IDS_HIDE_ICONS "Ukryj ikony" - IDS_TERMINATE "Zakocz dziaanie ReactOS Explorer" + IDS_TERMINATE "Zakończ działanie ReactOS Explorer" END STRINGTABLE DISCARDABLE BEGIN - IDS_NETWORK "Sie" - IDS_CONNECTIONS "Poczenia sieciowe" + IDS_NETWORK "Sieć" + IDS_CONNECTIONS "Połączenia sieciowe" IDS_DRIVES "Dysk" - IDS_SEARCH_COMPUTER "Znajd komputer..." - IDS_SETTINGS_MENU "Menu ustawie" + IDS_SEARCH_COMPUTER "Znajdź komputer..." + IDS_SETTINGS_MENU "Menu ustawień" IDS_CONTROL_PANEL "Panel sterowania" IDS_PRINTERS "Drukarki" - IDS_BROWSE "Przegldaj" - IDS_SEARCH_PRG "Znajd program..." + IDS_BROWSE "Przeglądaj" + IDS_SEARCH_PRG "Znajdź program..." IDS_ALL_USERS "Wszyscy\\" IDS_SEARCH "Szukaj" IDS_ABOUT_EXPLORER "ReactOS Explorer - &informacje" IDS_LAUNCH_MANY_PROGRAMS - "Zaznaczye wicej ni jeden program.\nCzy chcesz uruchomi je jednoczenie?" - IDS_DESKTOPBAR_SETTINGS "Waciwoci pulpitu" + "Zaznaczyłeś więcej niż jeden program.\nCzy chcesz uruchomić je jednocześnie?" + IDS_DESKTOPBAR_SETTINGS "Właściwości pulpitu" IDS_DESKTOP "Pulpit" - IDS_TASKBAR "Pasek zada" + IDS_TASKBAR "Pasek zadań" IDS_NAMECOLUMN "Nazwa" - IDS_PATHCOLUMN "cieka" - IDS_MENUCOLUMN "cieka menu" + IDS_PATHCOLUMN "Ścieżka" + IDS_MENUCOLUMN "Ścieżka menu" END #endif // Polish (PL) resources diff --git a/base/shell/explorer/explorer-ro.rc b/base/shell/explorer/explorer-ro.rc index c16bba4c475..a07d64ea171 100644 --- a/base/shell/explorer/explorer-ro.rc +++ b/base/shell/explorer/explorer-ro.rc @@ -18,7 +18,6 @@ #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ROM) #ifdef _WIN32 LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL -#pragma code_page(65001) #endif //_WIN32 ///////////////////////////////////////////////////////////////////////////// diff --git a/base/shell/explorer/explorer-ru.rc b/base/shell/explorer/explorer-ru.rc index 2063bb7e237..0bad959ed5e 100644 --- a/base/shell/explorer/explorer-ru.rc +++ b/base/shell/explorer/explorer-ru.rc @@ -18,7 +18,6 @@ #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS) #ifdef _WIN32 LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT -#pragma code_page(1251) #endif //_WIN32 ///////////////////////////////////////////////////////////////////////////// @@ -28,42 +27,42 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT IDM_MDIFRAME MENU DISCARDABLE BEGIN - POPUP "&" + POPUP "&Файл" BEGIN - MENUITEM "&...", ID_EXECUTE + MENUITEM "&Выполнить...", ID_EXECUTE MENUITEM SEPARATOR - MENUITEM "&", ID_FILE_EXIT + MENUITEM "В&ыход", ID_FILE_EXIT END - POPUP "&" + POPUP "&Вид" BEGIN - MENUITEM "& ", ID_VIEW_TOOL_BAR - MENUITEM "& ", ID_VIEW_EXTRA_BAR - MENUITEM "&", ID_VIEW_DRIVE_BAR - MENUITEM "&", ID_VIEW_SIDE_BAR - MENUITEM "& ", ID_VIEW_STATUSBAR + MENUITEM "&Панель инструментов", ID_VIEW_TOOL_BAR + MENUITEM "&Дополнительная панель", ID_VIEW_EXTRA_BAR + MENUITEM "&Диски", ID_VIEW_DRIVE_BAR + MENUITEM "И&збранное", ID_VIEW_SIDE_BAR + MENUITEM "&Строка состояния", ID_VIEW_STATUSBAR MENUITEM SEPARATOR - MENUITEM "&\tF5", ID_REFRESH - MENUITEM "& \tCtrl+Shift+S", ID_VIEW_FULLSCREEN + MENUITEM "&Обновить\tF5", ID_REFRESH + MENUITEM "По&лный экран\tCtrl+Shift+S", ID_VIEW_FULLSCREEN MENUITEM "SDI", ID_VIEW_SDI END - POPUP "&" + POPUP "О&кна" BEGIN - MENUITEM " &", ID_WINDOW_NEW - MENUITEM " \tShift+F5", ID_WINDOW_CASCADE - MENUITEM "&", ID_WINDOW_TILE_HORZ - MENUITEM "&\tShift+F4", ID_WINDOW_TILE_VERT - MENUITEM " ", ID_WINDOW_AUTOSORT - MENUITEM " &", ID_WINDOW_ARRANGE + MENUITEM "Новое о&кно", ID_WINDOW_NEW + MENUITEM "Расположить каскадом\tShift+F5", ID_WINDOW_CASCADE + MENUITEM "&Горизонтально", ID_WINDOW_TILE_HORZ + MENUITEM "&Вертикально\tShift+F4", ID_WINDOW_TILE_VERT + MENUITEM "Упорядочить автоматически", ID_WINDOW_AUTOSORT + MENUITEM "Упорядочить &значки", ID_WINDOW_ARRANGE END - POPUP "&" + POPUP "&Инструменты" BEGIN - MENUITEM "&", ID_TOOLS_OPTIONS + MENUITEM "&Параметры", ID_TOOLS_OPTIONS END - POPUP "&" + POPUP "По&мощь" BEGIN - MENUITEM "& ...", ID_EXPLORER_FAQ - MENUITEM " &...", ID_ABOUT_EXPLORER - MENUITEM " &ReactOS...", ID_ABOUT_WINDOWS + MENUITEM "&Частые вопросы по Проводнику...", ID_EXPLORER_FAQ + MENUITEM "О &программе...", ID_ABOUT_EXPLORER + MENUITEM "О &ReactOS...", ID_ABOUT_WINDOWS END END @@ -71,10 +70,10 @@ IDM_DESKTOPBAR MENU DISCARDABLE BEGIN POPUP "" BEGIN - MENUITEM "&...", ID_DESKTOPBAR_SETTINGS - MENUITEM "& ", ID_TASKMGR + MENUITEM "&Параметры...", ID_DESKTOPBAR_SETTINGS + MENUITEM "&Диспетчер задач", ID_TASKMGR MENUITEM SEPARATOR - MENUITEM "& ...", ID_ABOUT_EXPLORER + MENUITEM "&О программе...", ID_ABOUT_EXPLORER END END @@ -82,8 +81,8 @@ IDM_VOLUME MENU DISCARDABLE BEGIN POPUP "" BEGIN - MENUITEM "", ID_TRAY_VOLUME - MENUITEM " ", ID_VOLUME_PROPERTIES + MENUITEM "Громкость", ID_TRAY_VOLUME + MENUITEM "Свойства звука", ID_VOLUME_PROPERTIES END END @@ -91,42 +90,42 @@ IDM_NOTIFYAREA MENU DISCARDABLE BEGIN POPUP "" BEGIN - MENUITEM "& ", ID_SHOW_HIDDEN_ICONS - MENUITEM " &", ID_SHOW_ICON_BUTTON - MENUITEM "& ...", ID_CONFIG_NOTIFYAREA - MENUITEM " /&", ID_CONFIG_TIME + MENUITEM "&Показывать скрытые значки", ID_SHOW_HIDDEN_ICONS + MENUITEM "Показывать значки на &кнопках", ID_SHOW_ICON_BUTTON + MENUITEM "&Настройка уведомлений...", ID_CONFIG_NOTIFYAREA + MENUITEM "Настройка даты/&времени", ID_CONFIG_TIME MENUITEM SEPARATOR - MENUITEM "& ...", ID_ABOUT_EXPLORER + MENUITEM "&О программе...", ID_ABOUT_EXPLORER END END IDM_SDIFRAME MENU DISCARDABLE BEGIN - POPUP "&" + POPUP "&Файл" BEGIN - MENUITEM "&...", ID_EXECUTE + MENUITEM "&Запустить...", ID_EXECUTE MENUITEM SEPARATOR - MENUITEM "&", ID_FILE_EXIT + MENUITEM "В&ыход", ID_FILE_EXIT END - POPUP "&" + POPUP "&Вид" BEGIN - MENUITEM "& ", ID_VIEW_TOOL_BAR - MENUITEM "&", ID_VIEW_SIDE_BAR, GRAYED - MENUITEM "& ", ID_VIEW_STATUSBAR + MENUITEM "&Панель инструментов", ID_VIEW_TOOL_BAR + MENUITEM "И&збранное", ID_VIEW_SIDE_BAR, GRAYED + MENUITEM "&Строка состояния", ID_VIEW_STATUSBAR MENUITEM SEPARATOR - MENUITEM "&\tF5", ID_REFRESH - MENUITEM "& \tCtrl+Shift+S", ID_VIEW_FULLSCREEN + MENUITEM "&Обновить\tF5", ID_REFRESH + MENUITEM "По&лный экран\tCtrl+Shift+S", ID_VIEW_FULLSCREEN MENUITEM "&MDI", ID_VIEW_MDI END - POPUP "&" + POPUP "&Инструменты" BEGIN - MENUITEM "&", ID_TOOLS_OPTIONS + MENUITEM "&Параметры", ID_TOOLS_OPTIONS END - POPUP "&" + POPUP "&Справка" BEGIN - MENUITEM "& ...", ID_EXPLORER_FAQ - MENUITEM " &...", ID_ABOUT_EXPLORER - MENUITEM " &ReactOS...", ID_ABOUT_WINDOWS + MENUITEM "&Частые вопросы по Проводнику...", ID_EXPLORER_FAQ + MENUITEM "О &Проводнике...", ID_ABOUT_EXPLORER + MENUITEM "О &ReactOS...", ID_ABOUT_WINDOWS END END @@ -138,41 +137,41 @@ END IDD_EXECUTE DIALOGEX DISCARDABLE 15, 13, 210, 63 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "" +CAPTION "Выполнить" FONT 8, "MS Shell Dlg" BEGIN CONTROL "",101,"Static",SS_SIMPLE | SS_NOPREFIX,3,6,150,10 - CONTROL "&:",-1,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,3, + CONTROL "&Команда:",-1,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,3, 18,60,10 EDITTEXT 201,3,29,134,12,ES_AUTOHSCROLL - CONTROL " &",214,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3, + CONTROL "Как &ссылку",214,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3, 45,71,12 DEFPUSHBUTTON "&OK",1,158,6,47,14 - PUSHBUTTON "&",2,158,24,47,14 - PUSHBUTTON "&",254,158,42,47,14 + PUSHBUTTON "&Отмена",2,158,24,47,14 + PUSHBUTTON "&Справка",254,158,42,47,14 END IDD_SEARCH_PROGRAM DIALOGEX 0, 0, 200, 65 STYLE DS_SHELLFONT | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME EXSTYLE WS_EX_APPWINDOW -CAPTION " c" +CAPTION "Поиск программ в меню Пуcк" FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN - LTEXT "&:",IDC_STATIC,7,9,30,8 + LTEXT "&Фильтр:",IDC_STATIC,7,9,30,8 EDITTEXT IDC_FILTER,40,7,94,14,ES_AUTOHSCROLL CONTROL "List1",IDC_PROGRAMS_FOUND,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP,7,25,186,33 - PUSHBUTTON "&",IDC_CHECK_ENTRIES,143,7,50,14 + PUSHBUTTON "&Проверить",IDC_CHECK_ENTRIES,143,7,50,14 END IDD_DESKBAR_DESKTOP DIALOGEX DISCARDABLE 0, 0, 212, 194 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION ": " +CAPTION "Свойства: Рабочий стол" FONT 8, "MS Shell Dlg" BEGIN - LTEXT ", , \n ", + LTEXT "Выберите, наиболее предпочтительный для вас, \nспособ выравнивания значков", IDC_STATIC,7,7,195,18 CONTROL "left/top dwn",IDC_ICON_ALIGN_0,"Button",BS_OWNERDRAW | BS_BOTTOM | WS_TABSTOP,7,25,46,44 @@ -198,26 +197,26 @@ BEGIN BS_BOTTOM | WS_TABSTOP,110,121,46,44 CONTROL "",IDC_ICON_ALIGN_11,"Button",BS_OWNERDRAW | BS_BOTTOM | WS_TABSTOP,159,121,46,44 -// CONTROL " &",ID_DESKTOP_VERSION,"Button", +// CONTROL "Показывать номер &версии",ID_DESKTOP_VERSION,"Button", // BS_AUTOCHECKBOX | WS_TABSTOP,7,177,109,10 END IDD_DESKBAR_TASKBAR DIALOGEX DISCARDABLE 0, 0, 210, 194 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Свойства панели задач" FONT 8, "MS Shell Dlg" BEGIN - CONTROL " &",ID_SHOW_CLOCK,"Button",BS_AUTOCHECKBOX | + CONTROL "Отображать &часы",ID_SHOW_CLOCK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,142,100,10 - CONTROL "& ", + CONTROL "&Скрывать неиспользуемые значки", ID_HIDE_INACTIVE_ICONS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,157,133,10 - PUSHBUTTON "&...",ID_CONFIG_NOTIFYAREA,133,173,70,14 + PUSHBUTTON "&Уведомления...",ID_CONFIG_NOTIFYAREA,133,173,70,14 END IDD_DESKBAR_STARTMENU DIALOGEX DISCARDABLE 0, 0, 210, 194 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Свойства меню Пуск" FONT 8, "MS Shell Dlg" BEGIN END @@ -226,63 +225,63 @@ IDD_NOTIFYAREA DIALOGEX 0, 0, 208, 174 STYLE DS_SHELLFONT | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME EXSTYLE WS_EX_APPWINDOW -CAPTION " " +CAPTION "Конфигурация значков" FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN CONTROL "Tree1",IDC_NOTIFY_ICONS,"SysTreeView32",TVS_HASLINES | TVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP,7,7,194,31 - LTEXT "& :",IDC_LABEL1,7,44,62,8 + LTEXT "&Текст подсказки:",IDC_LABEL1,7,44,62,8 EDITTEXT IDC_NOTIFY_TOOLTIP,76,42,125,14,ES_AUTOHSCROLL - LTEXT " &:",IDC_LABEL2,7,63,58,8 + LTEXT "Заголовок о&кна:",IDC_LABEL2,7,63,58,8 EDITTEXT IDC_NOTIFY_TITLE,76,60,125,14,ES_AUTOHSCROLL - LTEXT "& :",IDC_LABEL3,7,81,54,8 + LTEXT "&Путь к модулю:",IDC_LABEL3,7,81,54,8 EDITTEXT IDC_NOTIFY_MODULE,76,78,125,14,ES_AUTOHSCROLL - GROUPBOX "& ",IDC_LABEL4,7,96,169,28 - CONTROL "&",IDC_NOTIFY_SHOW,"Button",BS_AUTORADIOBUTTON | + GROUPBOX "&Режим отображения",IDC_LABEL4,7,96,169,28 + CONTROL "&показать",IDC_NOTIFY_SHOW,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,15,108,47,10 - CONTROL "&",IDC_NOTIFY_HIDE,"Button",BS_AUTORADIOBUTTON,66, + CONTROL "&Скрыть",IDC_NOTIFY_HIDE,"Button",BS_AUTORADIOBUTTON,66, 108,41,10 - CONTROL "&",IDC_NOTIFY_AUTOHIDE,"Button", + CONTROL "А&втоскрытие",IDC_NOTIFY_AUTOHIDE,"Button", BS_AUTORADIOBUTTON,112,108,60,10 ICON "",IDC_PICTURE,181,101,20,20 - LTEXT "&\n",IDC_LABEL6,7,129,40,19 + LTEXT "&Последние\nизменения",IDC_LABEL6,7,129,40,19 EDITTEXT IDC_LAST_CHANGE,59,129,105,14,ES_AUTOHSCROLL | ES_READONLY - CONTROL "& ",ID_SHOW_HIDDEN_ICONS,"Button", + CONTROL "Пока&зать скрытое",ID_SHOW_HIDDEN_ICONS,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,7,154,78,10 DEFPUSHBUTTON "&OK",IDOK,91,153,50,14,WS_GROUP - PUSHBUTTON "&",IDCANCEL,151,153,50,14 + PUSHBUTTON "&Отмена",IDCANCEL,151,153,50,14 END IDD_MDI_SDI DIALOGEX 0, 0, 194, 157 STYLE DS_SHELLFONT | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_APPWINDOW -CAPTION " MDI / SDI" +CAPTION "Выберите режим MDI / SDI" FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN - LTEXT " \n :", + LTEXT "Выберите наиболее предпочтительный для вас\nвид проводника:", IDC_STATIC,7,7,171,17 - CONTROL "&MDI ( )",IDC_MDI,"Button", + CONTROL "&MDI (многодокументный интерфейс)",IDC_MDI,"Button", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,7,31,137,10 - CONTROL "&SDI ( )",IDC_SDI,"Button", + CONTROL "&SDI (однодокументный интерфейс)",IDC_SDI,"Button", BS_AUTORADIOBUTTON,7,62,134,10 CONTROL 170,IDC_STATIC,"Static",SS_BITMAP,145,23,15,13 CONTROL 171,IDC_STATIC,"Static",SS_BITMAP,145,57,15,13 - CONTROL " & ", + CONTROL "Открывать подпапки в о&тдельных окнах", IDC_SEPARATE_SUBFOLDERS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,90,155,10 - LTEXT " , .", + LTEXT "Эти настройки будут использованны, как значение по умолчанию для всех окон проводника в дальнейшем.", IDC_STATIC,7,107,185,26 DEFPUSHBUTTON "&OK",IDOK,29,136,50,14,WS_GROUP - PUSHBUTTON "&",IDCANCEL,106,136,50,14 + PUSHBUTTON "&Отмена",IDCANCEL,106,136,50,14 END IDD_ABOUT_EXPLORER DIALOGEX DISCARDABLE 0, 0, 199, 106 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " ReactOS" +CAPTION "О Проводнике ReactOS" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ReactOS",IDC_ROS_EXPLORER,91,13,104,11 + LTEXT "Проводник ReactOS",IDC_ROS_EXPLORER,91,13,104,11 LTEXT "V 0.9",IDC_VERSION_TXT,91,27,104,8 LTEXT "(c) 2003-2005 Martin Fuchs",IDC_STATIC,91,42,104,8 LTEXT "",IDC_WIN_VERSION,91,58,98,22 @@ -326,64 +325,64 @@ END STRINGTABLE DISCARDABLE BEGIN - IDS_TITLE " ReactOS" - IDS_START "" - IDS_LOGOFF " ..." - IDS_SHUTDOWN "..." - IDS_RESTART "..." - IDS_LAUNCH "..." - IDS_START_HELP "" - IDS_SEARCH_FILES "..." - IDS_DOCUMENTS "" - IDS_FAVORITES "" - IDS_PROGRAMS "" - IDS_SETTINGS "" - IDS_EXPLORE "" - IDS_EMPTY "()" - IDS_RECENT " " - IDS_ADMIN "" + IDS_TITLE "Проводник ReactOS" + IDS_START "Пуск" + IDS_LOGOFF "Выход из системы..." + IDS_SHUTDOWN "Выключение..." + IDS_RESTART "Перезагрузка..." + IDS_LAUNCH "Выполнить..." + IDS_START_HELP "Справка" + IDS_SEARCH_FILES "Поиск..." + IDS_DOCUMENTS "Документы" + IDS_FAVORITES "Избранное" + IDS_PROGRAMS "Программы" + IDS_SETTINGS "Настройка" + IDS_EXPLORE "Обзор" + IDS_EMPTY "(пусто)" + IDS_RECENT "Недавние документы" + IDS_ADMIN "Администрирование" END STRINGTABLE DISCARDABLE BEGIN - IDS_STARTMENU " " - IDS_MINIMIZE_ALL "C " - IDS_DESKTOP_NUM " c %d" - IDS_VOLUME "" - IDS_ITEMS_CUR " " - IDS_ITEMS_CONFIGURED "" - IDS_ITEMS_VISIBLE "" - IDS_ITEMS_HIDDEN "" - IDS_NOTIFY_SHOW "" - IDS_NOTIFY_HIDE "" - IDS_NOTIFY_AUTOHIDE "" - IDS_SHOW_HIDDEN_ICONS " " - IDS_HIDE_ICONS " " - IDS_TERMINATE " " + IDS_STARTMENU "Меню Пуск" + IDS_MINIMIZE_ALL "Cвернуть все окна" + IDS_DESKTOP_NUM "Рабочий cтол %d" + IDS_VOLUME "Объём" + IDS_ITEMS_CUR "Текущей элемент" + IDS_ITEMS_CONFIGURED "Конфигурация" + IDS_ITEMS_VISIBLE "Видимый" + IDS_ITEMS_HIDDEN "Скрытый" + IDS_NOTIFY_SHOW "Показать" + IDS_NOTIFY_HIDE "Скрыть" + IDS_NOTIFY_AUTOHIDE "Автоскрытие" + IDS_SHOW_HIDDEN_ICONS "Показать скрытые значки" + IDS_HIDE_ICONS "Скрыть значки" + IDS_TERMINATE "Завершить работу Проводника" END STRINGTABLE DISCARDABLE BEGIN - IDS_NETWORK "" - IDS_CONNECTIONS " " - IDS_DRIVES "" - IDS_SEARCH_COMPUTER " ..." - IDS_SETTINGS_MENU " " - IDS_CONTROL_PANEL " " - IDS_PRINTERS "" - IDS_BROWSE " " - IDS_SEARCH_PRG " ..." - IDS_ALL_USERS " \\" - IDS_SEARCH "" - IDS_ABOUT_EXPLORER "& " + IDS_NETWORK "Сеть" + IDS_CONNECTIONS "Сетевые подключения" + IDS_DRIVES "Диски" + IDS_SEARCH_COMPUTER "Найти компьютер..." + IDS_SETTINGS_MENU "Меню настройки" + IDS_CONTROL_PANEL "Панель управления" + IDS_PRINTERS "Принтеры" + IDS_BROWSE "Обзор файлов" + IDS_SEARCH_PRG "Найти программу..." + IDS_ALL_USERS "Все пользователи\\" + IDS_SEARCH "Поиск" + IDS_ABOUT_EXPLORER "&О Проводнике" IDS_LAUNCH_MANY_PROGRAMS - " .\n , ?" - IDS_DESKTOPBAR_SETTINGS " " - IDS_DESKTOP " " - IDS_TASKBAR " " - IDS_NAMECOLUMN "" - IDS_PATHCOLUMN "" - IDS_MENUCOLUMN " " + "Вы выбрали более одной программы.\nВы уверены, что хотите выполнить их все?" + IDS_DESKTOPBAR_SETTINGS "Настройки рабочего стола" + IDS_DESKTOP "Рабочий стол" + IDS_TASKBAR "Панель задач" + IDS_NAMECOLUMN "Имя" + IDS_PATHCOLUMN "Путь" + IDS_MENUCOLUMN "Путь в меню" END #endif // Russian resources diff --git a/base/shell/explorer/explorer-uk.rc b/base/shell/explorer/explorer-uk.rc index 1d3f8ae757e..ea6c7d4f22c 100644 --- a/base/shell/explorer/explorer-uk.rc +++ b/base/shell/explorer/explorer-uk.rc @@ -18,7 +18,6 @@ #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_UKR) #ifdef _WIN32 LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT -#pragma code_page(1251) #endif //_WIN32 ///////////////////////////////////////////////////////////////////////////// @@ -28,42 +27,42 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT IDM_MDIFRAME MENU DISCARDABLE BEGIN - POPUP "&" + POPUP "&Файл" BEGIN - MENUITEM "&...", ID_EXECUTE + MENUITEM "&Виконати...", ID_EXECUTE MENUITEM SEPARATOR - MENUITEM "&", ID_FILE_EXIT + MENUITEM "В&ихід", ID_FILE_EXIT END - POPUP "&" + POPUP "&Вигляд" BEGIN - MENUITEM "& ", ID_VIEW_TOOL_BAR - MENUITEM "& ", ID_VIEW_EXTRA_BAR - MENUITEM "&", ID_VIEW_DRIVE_BAR, CHECKED - MENUITEM "&", ID_VIEW_SIDE_BAR - MENUITEM "& ", ID_VIEW_STATUSBAR + MENUITEM "&Панель інструментів", ID_VIEW_TOOL_BAR + MENUITEM "&Додаткова панель", ID_VIEW_EXTRA_BAR + MENUITEM "Д&иски", ID_VIEW_DRIVE_BAR, CHECKED + MENUITEM "&Обране", ID_VIEW_SIDE_BAR + MENUITEM "&Рядок стану", ID_VIEW_STATUSBAR MENUITEM SEPARATOR - MENUITEM "&\tF5", ID_REFRESH - MENUITEM " &\tCtrl+Shift+S", ID_VIEW_FULLSCREEN + MENUITEM "&Оновити\tF5", ID_REFRESH + MENUITEM "Повний &екран\tCtrl+Shift+S", ID_VIEW_FULLSCREEN MENUITEM "SDI", ID_VIEW_SDI END - POPUP "&" + POPUP "В&ікна" BEGIN - MENUITEM "& ", ID_WINDOW_NEW - MENUITEM "&\tShift+F5", ID_WINDOW_CASCADE - MENUITEM "&", ID_WINDOW_TILE_HORZ - MENUITEM "&\tShift+F4", ID_WINDOW_TILE_VERT - MENUITEM " ", ID_WINDOW_AUTOSORT - MENUITEM " &", ID_WINDOW_ARRANGE + MENUITEM "&Нове вікно", ID_WINDOW_NEW + MENUITEM "&Каскадом\tShift+F5", ID_WINDOW_CASCADE + MENUITEM "&Горизонтально", ID_WINDOW_TILE_HORZ + MENUITEM "&Вертикально\tShift+F4", ID_WINDOW_TILE_VERT + MENUITEM "Упорядкувати автоматично", ID_WINDOW_AUTOSORT + MENUITEM "Упорядкувати &значки", ID_WINDOW_ARRANGE END - POPUP "&" + POPUP "&Інструменти" BEGIN - MENUITEM "&", ID_TOOLS_OPTIONS + MENUITEM "&Опції", ID_TOOLS_OPTIONS END - POPUP "&" + POPUP "&Довідка" BEGIN - MENUITEM "&FAQ() ...", ID_EXPLORER_FAQ - MENUITEM " &...", ID_ABOUT_EXPLORER - MENUITEM " &...", ID_ABOUT_WINDOWS + MENUITEM "&FAQ(ЧаПи) по Провіднику...", ID_EXPLORER_FAQ + MENUITEM "Про &Провідник...", ID_ABOUT_EXPLORER + MENUITEM "Про &ОС...", ID_ABOUT_WINDOWS END END @@ -71,10 +70,10 @@ IDM_DESKTOPBAR MENU DISCARDABLE BEGIN POPUP "" BEGIN - MENUITEM "&...", ID_DESKTOPBAR_SETTINGS - MENUITEM "& ...", ID_TASKMGR + MENUITEM "&Налаштування...", ID_DESKTOPBAR_SETTINGS + MENUITEM "Д&испетчер завдань...", ID_TASKMGR MENUITEM SEPARATOR - MENUITEM "& ...", ID_ABOUT_EXPLORER + MENUITEM "&Про Провідник...", ID_ABOUT_EXPLORER END END @@ -82,8 +81,8 @@ IDM_VOLUME MENU DISCARDABLE BEGIN POPUP "" BEGIN - MENUITEM "", ID_TRAY_VOLUME - MENUITEM "& ", ID_VOLUME_PROPERTIES + MENUITEM "Гучність", ID_TRAY_VOLUME + MENUITEM "&Властивості звуку", ID_VOLUME_PROPERTIES END END @@ -91,42 +90,42 @@ IDM_NOTIFYAREA MENU DISCARDABLE BEGIN POPUP "" BEGIN - MENUITEM "&³ ", ID_SHOW_HIDDEN_ICONS - MENUITEM "³ &", ID_SHOW_ICON_BUTTON - MENUITEM "&& ...", ID_CONFIG_NOTIFYAREA - MENUITEM "& ...", ID_CONFIG_TIME + MENUITEM "&Відображати приховані значки", ID_SHOW_HIDDEN_ICONS + MENUITEM "Відображати значки на &кнопках", ID_SHOW_ICON_BUTTON + MENUITEM "&Н&астройка сповіщень...", ID_CONFIG_NOTIFYAREA + MENUITEM "&Настройка дати й часу...", ID_CONFIG_TIME MENUITEM SEPARATOR - MENUITEM "& ...", ID_ABOUT_EXPLORER + MENUITEM "&Про Провідник...", ID_ABOUT_EXPLORER END END IDM_SDIFRAME MENU DISCARDABLE BEGIN - POPUP "&" + POPUP "&Файл" BEGIN - MENUITEM "&...", ID_EXECUTE + MENUITEM "&Виконати...", ID_EXECUTE MENUITEM SEPARATOR - MENUITEM "&", ID_FILE_EXIT + MENUITEM "В&ихід", ID_FILE_EXIT END - POPUP "&" + POPUP "&Вигляд" BEGIN - MENUITEM "& ", ID_VIEW_TOOL_BAR - MENUITEM "&", ID_VIEW_SIDE_BAR, GRAYED - MENUITEM "& ", ID_VIEW_STATUSBAR + MENUITEM "&Панель інструментів", ID_VIEW_TOOL_BAR + MENUITEM "&Обране", ID_VIEW_SIDE_BAR, GRAYED + MENUITEM "&Рядок стану", ID_VIEW_STATUSBAR MENUITEM SEPARATOR - MENUITEM "&\tF5", ID_REFRESH - MENUITEM " &\tCtrl+Shift+S", ID_VIEW_FULLSCREEN + MENUITEM "&Оновити\tF5", ID_REFRESH + MENUITEM "Повний &екран\tCtrl+Shift+S", ID_VIEW_FULLSCREEN MENUITEM "&MDI", ID_VIEW_MDI END - POPUP "&" + POPUP "&Інструменти" BEGIN - MENUITEM "&", ID_TOOLS_OPTIONS + MENUITEM "&Опції", ID_TOOLS_OPTIONS END - POPUP "&" + POPUP "&Довідка" BEGIN - MENUITEM "&FAQ() ...", ID_EXPLORER_FAQ - MENUITEM " &...", ID_ABOUT_EXPLORER - MENUITEM " &...", ID_ABOUT_WINDOWS + MENUITEM "&FAQ(ЧаПи) по Провіднику...", ID_EXPLORER_FAQ + MENUITEM "Про &Провідник...", ID_ABOUT_EXPLORER + MENUITEM "Про &ОС...", ID_ABOUT_WINDOWS END END @@ -138,86 +137,86 @@ END IDD_EXECUTE DIALOGEX DISCARDABLE 15, 13, 210, 63 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "" +CAPTION "Виконати" FONT 8, "MS Shell Dlg" BEGIN CONTROL "",101,"Static",SS_SIMPLE | SS_NOPREFIX,3,6,150,10 - CONTROL "&:",-1,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,3, + CONTROL "&Команда:",-1,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,3, 18,60,10 EDITTEXT 201,3,29,134,12,ES_AUTOHSCROLL - CONTROL "& ",214,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3, + CONTROL "&Як Символ",214,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,3, 45,71,12 DEFPUSHBUTTON "&OK",1,158,6,47,14 - PUSHBUTTON "&",2,158,23,47,14 - PUSHBUTTON "&",254,158,43,47,14 + PUSHBUTTON "&Скасувати",2,158,23,47,14 + PUSHBUTTON "&Довідка",254,158,43,47,14 END IDD_SEARCH_PROGRAM DIALOGEX 0, 0, 200, 65 STYLE DS_SHELLFONT | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME EXSTYLE WS_EX_APPWINDOW -CAPTION " " +CAPTION "Пошук програми в меню Пуск" FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN - LTEXT "&Գ:",IDC_STATIC,7,9,18,8 + LTEXT "&Фільтр:",IDC_STATIC,7,9,18,8 EDITTEXT IDC_FILTER,34,7,100,14,ES_AUTOHSCROLL CONTROL "List1",IDC_PROGRAMS_FOUND,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP,7,25,186,33 - PUSHBUTTON "&",IDC_CHECK_ENTRIES,143,7,50,14 + PUSHBUTTON "&Перевірити",IDC_CHECK_ENTRIES,143,7,50,14 END IDD_DESKBAR_DESKTOP DIALOGEX DISCARDABLE 0, 0, 212, 194 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Властивості робочого столу" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " :", + LTEXT "Оберіть найбільш зручний для вас алгоритм вирівнювання значків:", IDC_STATIC,7,7,166,16 - CONTROL "/ ",IDC_ICON_ALIGN_0,"Button",BS_OWNERDRAW | + CONTROL "лів/верх низ",IDC_ICON_ALIGN_0,"Button",BS_OWNERDRAW | BS_BOTTOM | WS_TABSTOP,7,25,46,44 - CONTROL "/ ",IDC_ICON_ALIGN_1,"Button",BS_OWNERDRAW | + CONTROL "лів/верх прв",IDC_ICON_ALIGN_1,"Button",BS_OWNERDRAW | BS_BOTTOM | WS_TABSTOP,57,25,46,44 - CONTROL "/ ",IDC_ICON_ALIGN_2,"Button",BS_OWNERDRAW | + CONTROL "прв/верх лів",IDC_ICON_ALIGN_2,"Button",BS_OWNERDRAW | BS_BOTTOM | WS_TABSTOP,110,25,46,44 - CONTROL "/ ",IDC_ICON_ALIGN_3,"Button",BS_OWNERDRAW | + CONTROL "прв/верх низ",IDC_ICON_ALIGN_3,"Button",BS_OWNERDRAW | BS_BOTTOM | WS_TABSTOP,159,25,46,44 - CONTROL "/ ",IDC_ICON_ALIGN_4,"Button",BS_OWNERDRAW | + CONTROL "лів/низ верх",IDC_ICON_ALIGN_4,"Button",BS_OWNERDRAW | BS_BOTTOM | WS_TABSTOP,7,73,46,44 - CONTROL "/ ",IDC_ICON_ALIGN_5,"Button",BS_OWNERDRAW | + CONTROL "лів/низ прав",IDC_ICON_ALIGN_5,"Button",BS_OWNERDRAW | BS_BOTTOM | WS_TABSTOP,57,73,46,44 - CONTROL "/ ",IDC_ICON_ALIGN_6,"Button",BS_OWNERDRAW | + CONTROL "прав/низ лів",IDC_ICON_ALIGN_6,"Button",BS_OWNERDRAW | BS_BOTTOM | WS_TABSTOP,110,73,46,44 - CONTROL "/ ",IDC_ICON_ALIGN_7,"Button",BS_OWNERDRAW | + CONTROL "прв/низ верх",IDC_ICON_ALIGN_7,"Button",BS_OWNERDRAW | BS_BOTTOM | WS_TABSTOP,159,73,46,44 - CONTROL " ",IDC_ICON_ALIGN_8,"Button",BS_OWNERDRAW | + CONTROL "по краях",IDC_ICON_ALIGN_8,"Button",BS_OWNERDRAW | BS_BOTTOM | WS_TABSTOP,7,121,46,44 - CONTROL " ",IDC_ICON_ALIGN_9,"Button",BS_OWNERDRAW | + CONTROL "верхні кути",IDC_ICON_ALIGN_9,"Button",BS_OWNERDRAW | BS_BOTTOM | WS_TABSTOP,57,121,46,44 - CONTROL "",IDC_ICON_ALIGN_10,"Button",BS_OWNERDRAW | + CONTROL "навколо",IDC_ICON_ALIGN_10,"Button",BS_OWNERDRAW | BS_BOTTOM | WS_TABSTOP,110,121,46,44 CONTROL "",IDC_ICON_ALIGN_11,"Button",BS_OWNERDRAW | BS_BOTTOM | WS_TABSTOP,159,121,46,44 -// CONTROL "³ &",ID_DESKTOP_VERSION,"Button", +// CONTROL "Відображати Номер &Версії",ID_DESKTOP_VERSION,"Button", // BS_AUTOCHECKBOX | WS_TABSTOP,7,177,91,10 END IDD_DESKBAR_TASKBAR DIALOGEX DISCARDABLE 0, 0, 210, 194 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Властивості панелі завдань" FONT 8, "MS Shell Dlg" BEGIN - CONTROL "³& ",ID_SHOW_CLOCK,"Button",BS_AUTOCHECKBOX | + CONTROL "Відобра&жати годинник",ID_SHOW_CLOCK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,2,152,102,10 - CONTROL "& ", + CONTROL "При&ховувати невикористовувані значки", ID_HIDE_INACTIVE_ICONS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,2,174,151,10 - PUSHBUTTON "&...",ID_CONFIG_NOTIFYAREA,153,173,52,14 + PUSHBUTTON "&Сповіщення...",ID_CONFIG_NOTIFYAREA,153,173,52,14 END IDD_DESKBAR_STARTMENU DIALOGEX DISCARDABLE 0, 0, 210, 194 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Властивості меню Пуск" FONT 8, "MS Shell Dlg" BEGIN END @@ -226,63 +225,63 @@ IDD_NOTIFYAREA DIALOGEX 0, 0, 208, 174 STYLE DS_SHELLFONT | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME EXSTYLE WS_EX_APPWINDOW -CAPTION " " +CAPTION "Конфігурація значків сповіщень" FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN CONTROL "Tree1",IDC_NOTIFY_ICONS,"SysTreeView32",TVS_HASLINES | TVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP,7,7,194,31 - LTEXT "& ϳ:",IDC_LABEL1,7,44,60,8 + LTEXT "&Текст Підказки:",IDC_LABEL1,7,44,60,8 EDITTEXT IDC_NOTIFY_TOOLTIP,66,42,135,14,ES_AUTOHSCROLL - LTEXT " &:",IDC_LABEL2,7,63,64,8 + LTEXT "Заголовок В&ікна:",IDC_LABEL2,7,63,64,8 EDITTEXT IDC_NOTIFY_TITLE,66,60,135,14,ES_AUTOHSCROLL - LTEXT "& :",IDC_LABEL3,7,81,63,8 + LTEXT "&Шлях до Модуля:",IDC_LABEL3,7,81,63,8 EDITTEXT IDC_NOTIFY_MODULE,66,78,135,14,ES_AUTOHSCROLL - GROUPBOX "& ³",IDC_LABEL4,7,96,177,28 - CONTROL "&",IDC_NOTIFY_SHOW,"Button",BS_AUTORADIOBUTTON | + GROUPBOX "&Режим Відображення",IDC_LABEL4,7,96,177,28 + CONTROL "&показати",IDC_NOTIFY_SHOW,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,15,108,44,10 - CONTROL "&",IDC_NOTIFY_HIDE,"Button",BS_AUTORADIOBUTTON,66, + CONTROL "&сховати",IDC_NOTIFY_HIDE,"Button",BS_AUTORADIOBUTTON,66, 108,40,10 - CONTROL "&",IDC_NOTIFY_AUTOHIDE,"Button", + CONTROL "а&втоприховання",IDC_NOTIFY_AUTOHIDE,"Button", BS_AUTORADIOBUTTON,112,108,69,10 ICON "",IDC_PICTURE,173,101,21,20 - LTEXT "& :",IDC_LABEL6,7,132,65,8 + LTEXT "&Остання зміна:",IDC_LABEL6,7,132,65,8 EDITTEXT IDC_LAST_CHANGE,59,129,105,14,ES_AUTOHSCROLL | ES_READONLY - CONTROL "& ",ID_SHOW_HIDDEN_ICONS,"Button", + CONTROL "пока&зати приховане",ID_SHOW_HIDDEN_ICONS,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,7,154,86,10 DEFPUSHBUTTON "&OK",IDOK,91,153,50,14,WS_GROUP - PUSHBUTTON "&",IDCANCEL,151,153,50,14 + PUSHBUTTON "&Скасувати",IDCANCEL,151,153,50,14 END IDD_MDI_SDI DIALOGEX 0, 0, 194, 157 STYLE DS_SHELLFONT | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_APPWINDOW -CAPTION " " +CAPTION "Оберіть режим вікон Провідника" FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN - LTEXT " :", + LTEXT "Оберіть найбільш зручний для вас інтерфейс провідника:", IDC_STATIC,7,7,160,8 - CONTROL "&MDI ()",IDC_MDI,"Button", + CONTROL "&MDI (багатодокументний)",IDC_MDI,"Button", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,7,31,124,10 - CONTROL "&SDI ()",IDC_SDI,"Button", + CONTROL "&SDI (однодокументний)",IDC_SDI,"Button", BS_AUTORADIOBUTTON,7,62,118,10 CONTROL 170,IDC_STATIC,"Static",SS_BITMAP,145,23,15,13 CONTROL 171,IDC_STATIC,"Static",SS_BITMAP,145,57,15,13 - CONTROL "³ & ", + CONTROL "Відкривати підтеки в о&кремих вікнах", IDC_SEPARATE_SUBFOLDERS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,90,135,10 - LTEXT "ֳ .", + LTEXT "Ці параметри будуть використані як значення за замовчуванням для всіх вікон провідника в майбутньому.", IDC_STATIC,7,109,174,24 DEFPUSHBUTTON "&OK",IDOK,29,136,50,14,WS_GROUP - PUSHBUTTON "&",IDCANCEL,106,136,50,14 + PUSHBUTTON "&Скасувати",IDCANCEL,106,136,50,14 END IDD_ABOUT_EXPLORER DIALOGEX DISCARDABLE 0, 0, 199, 106 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " ReactOS" +CAPTION "Про Провідник ReactOS" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ReactOS",IDC_ROS_EXPLORER,91,13,104,11 + LTEXT "Провідник ReactOS",IDC_ROS_EXPLORER,91,13,104,11 LTEXT "V 0.9",IDC_VERSION_TXT,91,27,104,8 LTEXT "(c) 2003-2005 Martin Fuchs",IDC_STATIC,91,42,104,8 LTEXT "",IDC_WIN_VERSION,91,58,98,22 @@ -326,64 +325,64 @@ END STRINGTABLE DISCARDABLE BEGIN - IDS_TITLE " ReactOS" - IDS_START "" - IDS_LOGOFF " ..." - IDS_SHUTDOWN "..." - IDS_RESTART "..." - IDS_LAUNCH "..." - IDS_START_HELP "" - IDS_SEARCH_FILES "..." - IDS_DOCUMENTS "" - IDS_FAVORITES "" - IDS_PROGRAMS "" - IDS_SETTINGS "" - IDS_EXPLORE "" - IDS_EMPTY "()" - IDS_RECENT " " - IDS_ADMIN "" + IDS_TITLE "Провідник ReactOS" + IDS_START "Пуск" + IDS_LOGOFF "Завершення сеансу..." + IDS_SHUTDOWN "Вимкнення..." + IDS_RESTART "Перезавантаження..." + IDS_LAUNCH "Виконати..." + IDS_START_HELP "Довідка" + IDS_SEARCH_FILES "Пошук..." + IDS_DOCUMENTS "Документи" + IDS_FAVORITES "Обране" + IDS_PROGRAMS "Програми" + IDS_SETTINGS "Налаштування" + IDS_EXPLORE "Огляд" + IDS_EMPTY "(Порожньо)" + IDS_RECENT "Недавні документи" + IDS_ADMIN "Адміністрування" END STRINGTABLE DISCARDABLE BEGIN - IDS_STARTMENU " " - IDS_MINIMIZE_ALL " " - IDS_DESKTOP_NUM " %d" - IDS_VOLUME "" - IDS_ITEMS_CUR " " - IDS_ITEMS_CONFIGURED "" - IDS_ITEMS_VISIBLE "" - IDS_ITEMS_HIDDEN "" - IDS_NOTIFY_SHOW "" - IDS_NOTIFY_HIDE "" - IDS_NOTIFY_AUTOHIDE "" - IDS_SHOW_HIDDEN_ICONS " " - IDS_HIDE_ICONS " " - IDS_TERMINATE " " + IDS_STARTMENU "Меню Пуск" + IDS_MINIMIZE_ALL "згорнути всі вікна" + IDS_DESKTOP_NUM "Робочий Стіл %d" + IDS_VOLUME "Гучність" + IDS_ITEMS_CUR "поточні елементи" + IDS_ITEMS_CONFIGURED "конфігурація" + IDS_ITEMS_VISIBLE "видимий" + IDS_ITEMS_HIDDEN "прихований" + IDS_NOTIFY_SHOW "показати" + IDS_NOTIFY_HIDE "сховати" + IDS_NOTIFY_AUTOHIDE "автоприховання" + IDS_SHOW_HIDDEN_ICONS "Показати приховані значки" + IDS_HIDE_ICONS "Сховати значки" + IDS_TERMINATE "Завершити роботу Провідника" END STRINGTABLE DISCARDABLE BEGIN - IDS_NETWORK "" - IDS_CONNECTIONS " " - IDS_DRIVES "" - IDS_SEARCH_COMPUTER " ..." - IDS_SETTINGS_MENU " " - IDS_CONTROL_PANEL " " - IDS_PRINTERS "" - IDS_BROWSE " " - IDS_SEARCH_PRG " ..." - IDS_ALL_USERS " \\" - IDS_SEARCH "" - IDS_ABOUT_EXPLORER "& ..." + IDS_NETWORK "Мережа" + IDS_CONNECTIONS "Мережні підключення" + IDS_DRIVES "Диски" + IDS_SEARCH_COMPUTER "Пошук комп’ютера..." + IDS_SETTINGS_MENU "Меню Налаштувань" + IDS_CONTROL_PANEL "Панель керування" + IDS_PRINTERS "Принтери" + IDS_BROWSE "Огляд файлів" + IDS_SEARCH_PRG "Пошук програми..." + IDS_ALL_USERS "Всі користувачі\\" + IDS_SEARCH "Пошук" + IDS_ABOUT_EXPLORER "&Про Провідник..." IDS_LAUNCH_MANY_PROGRAMS - " .\n , ?" - IDS_DESKTOPBAR_SETTINGS " " - IDS_DESKTOP " " - IDS_TASKBAR " " - IDS_NAMECOLUMN "'" - IDS_PATHCOLUMN "" - IDS_MENUCOLUMN " " + "Ви обрали більше однієї програми.\nВи впевнені, що хочете запустити їх всі?" + IDS_DESKTOPBAR_SETTINGS "Налаштування робочого стола" + IDS_DESKTOP "Робочий Стіл" + IDS_TASKBAR "Панель завдань" + IDS_NAMECOLUMN "Ім'я" + IDS_PATHCOLUMN "Шлях" + IDS_MENUCOLUMN "Шлях в меню" END #endif // Ukrainian resources diff --git a/base/shell/explorer/explorer_intres.rc b/base/shell/explorer/explorer_intres.rc index a8d5f41439c..727dae81b7b 100644 --- a/base/shell/explorer/explorer_intres.rc +++ b/base/shell/explorer/explorer_intres.rc @@ -122,13 +122,9 @@ BEGIN "#include ""explorer-ko.rc""\r\n" "#include ""explorer-nl.rc""\r\n" "#include ""explorer-no.rc""\r\n" - "#include ""explorer-pl.rc""\r\n" "#include ""explorer-pt.rc""\r\n" - "#include ""explorer-ro.rc""\r\n" - "#include ""explorer-ru.rc""\r\n" "#include ""explorer-sk.rc""\r\n" "#include ""explorer-sv.rc""\r\n" - "#include ""explorer-uk.rc""\r\n" "\r\n" "#ifdef __WINDRES__\r\n" "#include ""explorer-cn.rc""\r\n" @@ -136,6 +132,12 @@ BEGIN "//#include ""explorer-cn-msvc.rc""\r\n" "#include ""explorer-bn.rc""\r\n" "#endif\r\n" + "\r\n" + "#pragma code_page(65001)" + "#include ""explorer-pl.rc""\r\n" + "#include ""explorer-ro.rc""\r\n" + "#include ""explorer-ru.rc""\r\n" + "#include ""explorer-uk.rc""\r\n" "\0" END @@ -230,13 +232,9 @@ CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST DISCARDABLE PURE "explorer.exe.ma #include "explorer-ko.rc" #include "explorer-nl.rc" #include "explorer-no.rc" -#include "explorer-pl.rc" #include "explorer-pt.rc" -#include "explorer-ro.rc" -#include "explorer-ru.rc" #include "explorer-sk.rc" #include "explorer-sv.rc" -#include "explorer-uk.rc" #ifdef __WINDRES__ #include "explorer-cn.rc" @@ -245,6 +243,13 @@ CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST DISCARDABLE PURE "explorer.exe.ma #include "explorer-bn.rc" #endif +// UTF-8 +#pragma code_page(65001) +#include "explorer-pl.rc" +#include "explorer-ro.rc" +#include "explorer-ru.rc" +#include "explorer-uk.rc" + ///////////////////////////////////////////////////////////////////////////// #endif // not APSTUDIO_INVOKED diff --git a/base/shell/explorer/services/startup.c b/base/shell/explorer/services/startup.c index 1208a32f0d6..ba435632fd9 100644 --- a/base/shell/explorer/services/startup.c +++ b/base/shell/explorer/services/startup.c @@ -369,6 +369,9 @@ static BOOL ProcessRunKeys(HKEY hkRoot, LPCWSTR szKeyName, BOOL bDelete, continue; } + /* safe mode - force to run if prefixed with asterisk */ + if (GetSystemMetrics(SM_CLEANBOOT) && (szValue[0] != L'*')) continue; + if (bDelete && (res=RegDeleteValueW(hkRun, szValue))!=ERROR_SUCCESS) { printf("Couldn't delete value - %ld, %ld. Running command anyways.\n", i, res); @@ -467,6 +470,9 @@ int startup(int argc, const char *argv[]) } else ops=DEFAULT; + /* do not run certain items in Safe Mode */ + if(GetSystemMetrics(SM_CLEANBOOT)) ops.startup = FALSE; + /* Perform the ops by order, stopping if one fails, skipping if necessary */ /* Shachar: Sorry for the perl syntax */ res=(ops.ntonly || !ops.preboot || wininit()) && diff --git a/base/system/CMakeLists.txt b/base/system/CMakeLists.txt index 80232bcae26..bc30ddfd406 100644 --- a/base/system/CMakeLists.txt +++ b/base/system/CMakeLists.txt @@ -4,7 +4,9 @@ add_subdirectory(bootok) add_subdirectory(expand) add_subdirectory(format) add_subdirectory(lsass) -add_subdirectory(msiexec) +if(NOT MSVC) + add_subdirectory(msiexec) # FIXME: msvc build. +endif() add_subdirectory(regsvr32) add_subdirectory(rundll32) add_subdirectory(runonce) diff --git a/base/system/autochk/autochk.c b/base/system/autochk/autochk.c index c4b62e6294a..101edbb8ff1 100644 --- a/base/system/autochk/autochk.c +++ b/base/system/autochk/autochk.c @@ -13,7 +13,12 @@ #define WIN32_NO_STATUS #include #define NTOS_MODE_USER -#include +#include +#include +#include +#include +#include +#include #include #define NDEBUG @@ -324,7 +329,7 @@ CheckVolume( Status = ChkdskFunc(&DrivePathU, TRUE, // FixErrors TRUE, // Verbose - FALSE, // CheckOnlyIfDirty + TRUE, // CheckOnlyIfDirty FALSE,// ScanDrive ChkdskCallback); diff --git a/base/system/bootok/CMakeLists.txt b/base/system/bootok/CMakeLists.txt index e59cd62ce20..bcd13f747ac 100644 --- a/base/system/bootok/CMakeLists.txt +++ b/base/system/bootok/CMakeLists.txt @@ -1,6 +1,4 @@ -add_definitions(-D_DLL -D__USE_CRTIMP) - set_unicode() add_executable(bootok bootok.c bootok.rc) diff --git a/base/system/expand/CMakeLists.txt b/base/system/expand/CMakeLists.txt index d82276adcfc..5a680bfa97c 100644 --- a/base/system/expand/CMakeLists.txt +++ b/base/system/expand/CMakeLists.txt @@ -1,6 +1,4 @@ -add_definitions(-D_DLL -D__USE_CRTIMP) - include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine) add_executable(expand expand.c expand.rc) diff --git a/base/system/format/CMakeLists.txt b/base/system/format/CMakeLists.txt index ba1aa8da7c5..5973db5f814 100644 --- a/base/system/format/CMakeLists.txt +++ b/base/system/format/CMakeLists.txt @@ -1,7 +1,4 @@ -add_definitions(-D_DLL -D__USE_CRTIMP) - -include_directories(.) set_rc_compiler() add_executable(format format.c format.rc) diff --git a/base/system/format/lang/pl-PL.rc b/base/system/format/lang/pl-PL.rc index de78700711e..2cc52fbb356 100644 --- a/base/system/format/lang/pl-PL.rc +++ b/base/system/format/lang/pl-PL.rc @@ -1,57 +1,57 @@ -#include "resource.h" /* -* translated by xrogers (http://rogers.cyberdusk.pl/) -* xxrogers@users.sourceforge.net -* https://sourceforge.net/projects/reactospl -*/ + * translated by xrogers + * xxrogers@users.sourceforge.net + * https://sourceforge.net/projects/reactospl + * UTF-8 conversion by Caemyr (May, 2011) + */ LANGUAGE LANG_POLISH, SUBLANG_DEFAULT STRINGTABLE DISCARDABLE BEGIN -STRING_HELP, "Sposb uycia: %s wolumin: [-FS:syst-plik] [-V:etykieta] [-Q] [-A:rozmiar] [-C]\n\n\ - [wolumin:] Okrela liter dysku przeznaczonego do formatowania.\n\ - -FS:syst-plik Okrela rodzaj systemu plikw (%s).\n\ - -V:etykieta Okrela etykiet woluminu.\n\ +STRING_HELP, "Sposób użycia: %s wolumin: [-FS:syst-plik] [-V:etykieta] [-Q] [-A:rozmiar] [-C]\n\n\ + [wolumin:] Określa literę dysku przeznaczonego do formatowania.\n\ + -FS:syst-plik Określa rodzaj systemu plików (%s).\n\ + -V:etykieta Określa etykietę woluminu.\n\ -Q Przeprowadza szybkie formatowanie.\n\ - -A:rozmiar Zastpuje domylny rozmiar jednostki alokacji. Dla zastosowa\n\ - oglnych zaleca si uywanie ustawie domylnych.\n\ - System NTFS obsuguje rozmiary: 512, 1024, 2048, 4096, 8192,\n\ + -A:rozmiar Zastępuje domyślny rozmiar jednostki alokacji. Dla zastosowań\n\ + ogólnych zaleca się używanie ustawień domyślnych.\n\ + System NTFS obsługuje rozmiary: 512, 1024, 2048, 4096, 8192,\n\ 16 KB, 32 KB, 64 KB.\n\ - System FAT obsuguje rozmiary: 512, 1024, 2048, 4096, 8192,\n\ + System FAT obsługuje rozmiary: 512, 1024, 2048, 4096, 8192,\n\ 16 KB, 32 KB, 64 KB, 128 KB, 256 KB.\n\ - Kompresja NTFS nie jest obsugiwana dla jednostek alokacji\n\ - wikszych ni 4096 bajtw.\n\ - -C Pliki utworzone na nowym woluminie bd domylnie poddane\n\ + Kompresja NTFS nie jest obsługiwana dla jednostek alokacji\n\ + większych niż 4096 bajtów.\n\ + -C Pliki utworzone na nowym woluminie będą domyślnie poddane\n\ kompresji.\n\n" -STRING_COMPLETE "%lu procent ukoczone.\r" +STRING_COMPLETE "%lu procent ukończone.\r" -STRING_FORMAT_FAIL "FormatEx nie mg zakoczy dziaania pomylnie.\n\n" +STRING_FORMAT_FAIL "FormatEx nie mógł zakończyć działania pomyślnie.\n\n" STRING_NO_SUPPORT "Operacja niewspierana" -STRING_FMIFS_FAIL "Nie mona zlokalizowa punktw wejciowych FMIFS.\n\n" +STRING_FMIFS_FAIL "Nie można zlokalizować punktów wejściowych FMIFS.\n\n" -STRING_UNKNOW_ARG "Nieprawidowy parametr: %s\n" +STRING_UNKNOW_ARG "Nieprawidłowy parametr: %s\n" -STRING_DRIVE_PARM "Brakujcy wymagany parametr dysku.\n\n" +STRING_DRIVE_PARM "Brakujący wymagany parametr dysku.\n\n" -STRING_ERROR_DRIVE_TYPE "Nie mona okreli rodzaju dysku" +STRING_ERROR_DRIVE_TYPE "Nie można określić rodzaju dysku" -STRING_INSERT_DISK "W nowy dysk do napdu %C:\ni nacinij Enter, gdy bdzie gotowe..." +STRING_INSERT_DISK "Włóż nowy dysk do napędu %C:\ni naciśnij Enter..." -STRING_NO_VOLUME "Nie mona odczyta woluminu" +STRING_NO_VOLUME "Nie można odczytać woluminu" -STRING_NO_VOLUME_SIZE "Nie mona odczyta rozmiaru woluminu" +STRING_NO_VOLUME_SIZE "Nie można odczytać rozmiaru woluminu" -STRING_FILESYSTEM "Rodzaj systemu plikw to %s.\n" +STRING_FILESYSTEM "Rodzaj systemu plików to %s.\n" -STRING_LABEL_NAME_EDIT "Podaj aktualn etykiet woluminu dla dysku %C: " +STRING_LABEL_NAME_EDIT "Podaj aktualną etykietę woluminu dla dysku %C: " -STRING_ERROR_LABEL "Nieprawidowa etykieta woluminu zostaa wpisana dla tego dysku.\n" +STRING_ERROR_LABEL "Nieprawidłowa etykieta woluminu została wpisana dla tego dysku.\n" -STRING_YN_FORMAT "\\OSTRZEENIE: WSZYSTKIE DANE NA NIEWYJMOWALNYM DYSKU\n\ -W STACJI %C: ZOSTAN UTRACONE!\nCzy kontynuowa formatowanie (T/N)? " +STRING_YN_FORMAT "\\OSTRZEŻENIE: WSZYSTKIE DANE NA NIEWYJMOWALNYM DYSKU\n\ +W STACJI %C: ZOSTANĄ UTRACONE!\nCzy kontynuować formatowanie (T/N)? " STRING_YES_NO_FAQ "TN" @@ -59,17 +59,17 @@ STRING_VERIFYING "Sprawdzanie" STRING_FAST_FMT "Szybkie formatowanie" -STRING_CREATE_FSYS "Tworzenie struktury systemu plikw.\n" +STRING_CREATE_FSYS "Tworzenie struktury systemu plików.\n" -STRING_FMT_COMPLETE "Formatowanie ukoczone.\n" +STRING_FMT_COMPLETE "Formatowanie ukończone.\n" -STRING_VOL_COMPRESS "Wolumin nie obsuguje kompresji.\n" +STRING_VOL_COMPRESS "Wolumin nie obsługuje kompresji.\n" -STRING_ENTER_LABEL "Podaj etykiet woluminu (11 znakw, ENTER = bez etykiety) " +STRING_ENTER_LABEL "Podaj etykietę woluminu (11 znaków, ENTER = bez etykiety) " -STRING_NO_LABEL "Nie mona zmieni etykiety woluminu" +STRING_NO_LABEL "Nie można zmienić etykiety woluminu" -STRING_FREE_SPACE "\n%I64d bajtw cakowitego miejsca na dysku.\n%I64d bajtw dostpnych na dysku.\n" +STRING_FREE_SPACE "\n%I64d bajtów całkowitego miejsca na dysku.\n%I64d bajtów dostępnych na dysku.\n" STRING_SERIAL_NUMBER "\nNumer seryjny woluminu to %04X-%04X\n" END diff --git a/base/system/format/lang/ru-RU.rc b/base/system/format/lang/ru-RU.rc index 2407018a9f8..d1ad0c77518 100644 --- a/base/system/format/lang/ru-RU.rc +++ b/base/system/format/lang/ru-RU.rc @@ -5,66 +5,66 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT STRINGTABLE DISCARDABLE BEGIN -STRING_HELP, ": %s : [-FS:] [-V:] [-Q] [-A:] [-C]\n\n\ - [:] ( ),\n\ - .\n\ - -FS: (%s).\n\ - -V: .\n\ - -Q .\n\ - -A: . \n\ - \n\ - NTFS 512, 1024, 2048, 4096, 8192, 16K, 32K, 64K.\n\ - FAT 8192, 16K, 32K, 64K, 128K, 256K.\n\ - NTFS- 4096.\n\ - -C ,\n\ - .\n\n" +STRING_HELP, "Использование: %s том: [-FS:система] [-V:метка] [-Q] [-A:размер] [-C]\n\n\ + [том:] Указывает букву диска (с последующим двоеточием),\n\ + точку подключения или имя тома.\n\ + -FS:система Указывает на тип файловой системы (%s).\n\ + -V:метка Метка тома.\n\ + -Q Быстрое форматирование.\n\ + -A:размер Заменяет размер кластера по умолчанию. В общих\n\ + случаях рекомендуется использовать размеры кластера по умолчанию\n\ + NTFS поддерживает 512, 1024, 2048, 4096, 8192, 16K, 32K, 64K.\n\ + FAT поддерживает 8192, 16K, 32K, 64K, 128K, 256K.\n\ + Для сжатых NTFS-томов не поддерживается размер более 4096.\n\ + -C Устанавливает режим сжатия по умолчанию для всех файлов,\n\ + создаваемых на новом томе.\n\n" -STRING_COMPLETE "%lu .\r" +STRING_COMPLETE "%lu процентов выполнено.\r" -STRING_FORMAT_FAIL "FormatEx .\n\n" +STRING_FORMAT_FAIL "FormatEx завершился неудачей.\n\n" -STRING_NO_SUPPORT " " +STRING_NO_SUPPORT "Операция не поддерживается" -STRING_FMIFS_FAIL " FMIFS.\n\n" +STRING_FMIFS_FAIL "Невозможно определить расположение точек входа FMIFS.\n\n" -STRING_UNKNOW_ARG " : %s\n" +STRING_UNKNOW_ARG "Неправильные аргументы: %s\n" -STRING_DRIVE_PARM " .\n\n" +STRING_DRIVE_PARM "Требуемый параметр операции отсутствует.\n\n" -STRING_ERROR_DRIVE_TYPE " " +STRING_ERROR_DRIVE_TYPE "Не удалось получить тип тома" -STRING_INSERT_DISK " %C:\n Enter ..." +STRING_INSERT_DISK "Вставьте чистый диск в устройство чтения %C:\nи нажмите Enter для продолжения..." -STRING_NO_VOLUME " " +STRING_NO_VOLUME "Не удалось выполнить запрос к тому" -STRING_NO_VOLUME_SIZE " " +STRING_NO_VOLUME_SIZE "Не удалось определить размер тома" -STRING_FILESYSTEM " %s.\n" +STRING_FILESYSTEM "Тип файловой системы %s.\n" -STRING_LABEL_NAME_EDIT " %C: " +STRING_LABEL_NAME_EDIT "Введите текущую метку тома %C: " -STRING_ERROR_LABEL " .\n" +STRING_ERROR_LABEL "Неправильная метка тома для этого устройства.\n" -STRING_YN_FORMAT "\n, NON_REMOVABLE\n\ - %C: !\n (Y/N)? " +STRING_YN_FORMAT "\nВНИМАНИЕ, ВСЕ ДАННЫЕ НА ДИСКЕ NON_REMOVABLE\n\ + %C: БУДУТ УНИЧТОЖЕНЫ!\nНачать форматирование (Y/N)? " STRING_YES_NO_FAQ "YN" -STRING_VERIFYING "" +STRING_VERIFYING "Проверка" -STRING_FAST_FMT " " +STRING_FAST_FMT "Быстрое форматирование" -STRING_CREATE_FSYS " .\n" +STRING_CREATE_FSYS "Создание структуры файловой системы.\n" -STRING_FMT_COMPLETE " .\n" +STRING_FMT_COMPLETE "Форматирование завершено.\n" -STRING_VOL_COMPRESS " .\n" +STRING_VOL_COMPRESS "Том не поддерживает сжатие.\n" -STRING_ENTER_LABEL " ( 11 )? " +STRING_ENTER_LABEL "Метка тома (не более 11 символов)? " -STRING_NO_LABEL " " +STRING_NO_LABEL "Без метки тома" -STRING_FREE_SPACE "\n%I64d .\n%I64d .\n" +STRING_FREE_SPACE "\n%I64d байт свободно на диске.\n%I64d байт доступно на диске.\n" -STRING_SERIAL_NUMBER "\n %04X-%04X\n" +STRING_SERIAL_NUMBER "\nСерийный номер тома %04X-%04X\n" END diff --git a/base/system/format/lang/uk-UA.rc b/base/system/format/lang/uk-UA.rc index d54b4a00f10..8822af5271b 100644 --- a/base/system/format/lang/uk-UA.rc +++ b/base/system/format/lang/uk-UA.rc @@ -11,65 +11,65 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT STRINGTABLE DISCARDABLE BEGIN -STRING_HELP, ": %s : [-FS:-] [-V:] [-Q] [-A:] [-C]\n\n\ - [:] , ( ').\n\ - -FS:- (%s).\n\ - -V: .\n\ - -Q .\n\ - -A: . \n\ - .\n\ - NTFS 512, 1024, 2048, 4096, 8192, 16K, 32K, 64K.\n\ - FAT 8192, 16K, 32K, 64K, 128K, 256K.\n\ - NTFS 4096.\n\ - -C ,\n\ - .\n\n" +STRING_HELP, "Використання: %s пристрій: [-FS:файл-система] [-V:мітка] [-Q] [-A:розмір] [-C]\n\n\ + [пристрій:] Вказує диск, який слід відформатувати (двокрапка обов'язкова).\n\ + -FS:файл-система Визначає тип файлової системи (%s).\n\ + -V:мітка Визначає коротку назву диску.\n\ + -Q Швидке форматування.\n\ + -A:розмір Перевизначає розмір кластера за замовчуванням. Рекомендується \n\ + використовувати значення за замовчуванням.\n\ + NTFS підтримує 512, 1024, 2048, 4096, 8192, 16K, 32K, 64K.\n\ + FAT підтримує 8192, 16K, 32K, 64K, 128K, 256K.\n\ + NTFS стискання не підтримується для кластерів більших за 4096.\n\ + -C Встановлює режим стискання для всіх нових файлів,\n\ + які створюються на диску.\n\n" -STRING_COMPLETE "%lu .\r" +STRING_COMPLETE "%lu відсотків виконано.\r" -STRING_FORMAT_FAIL "FormatEx .\n\n" +STRING_FORMAT_FAIL "FormatEx не зміг успішно виконати завдання.\n\n" -STRING_NO_SUPPORT " " +STRING_NO_SUPPORT "Функція не підтримується" -STRING_FMIFS_FAIL " FMIFS .\n\n" +STRING_FMIFS_FAIL "Не зміг знацти FMIFS точки входу.\n\n" -STRING_UNKNOW_ARG " : %s\n" +STRING_UNKNOW_ARG "Невідомий аргумент: %s\n" -STRING_DRIVE_PARM " .\n\n" +STRING_DRIVE_PARM "Необхідний параметр операції відсутній.\n\n" -STRING_ERROR_DRIVE_TYPE " " +STRING_ERROR_DRIVE_TYPE "Не вдалося втсанвити тип пристрою" -STRING_INSERT_DISK " %C:\n Enter ..." +STRING_INSERT_DISK "Вставте чистий диск в пристрій %C:\nі натисніть Enter щоб продовжити..." -STRING_NO_VOLUME " " +STRING_NO_VOLUME "Не вдалося виконати запит до пристрою" -STRING_NO_VOLUME_SIZE " " +STRING_NO_VOLUME_SIZE "Не вдалося визначити розмір диску" -STRING_FILESYSTEM " %s.\n" +STRING_FILESYSTEM "Визначена файлова система %s.\n" -STRING_LABEL_NAME_EDIT " %C: " +STRING_LABEL_NAME_EDIT "Визначте мітку диску %C: " -STRING_ERROR_LABEL " .\n" +STRING_ERROR_LABEL "Було вказано некорректну мітку.\n" -STRING_YN_FORMAT "\n! Ѳ Ͳ Բ %C:\n\ - ! \n (Y/N)? " +STRING_YN_FORMAT "\nУВАГА! ВСІ ДАНІ НА ФІКСОВАНОМУ ДИСКУ %C:\n\ + БУДЕ ВТРАЧЕНО! \nРозпочати форматування(Y/N)? " STRING_YES_NO_FAQ "YN" -STRING_VERIFYING "" +STRING_VERIFYING "Перевірка" -STRING_FAST_FMT " " +STRING_FAST_FMT "Швидке форматування" -STRING_CREATE_FSYS " .\n" +STRING_CREATE_FSYS "Створення файлової системи.\n" -STRING_FMT_COMPLETE " .\n" +STRING_FMT_COMPLETE "Форматування завершено.\n" -STRING_VOL_COMPRESS " .\n" +STRING_VOL_COMPRESS "Диск не підтримує стискання.\n" -STRING_ENTER_LABEL "̳ (11 , Enter )? " +STRING_ENTER_LABEL "Мітка диску (11 символів,натисніть Enter якщо не треба)? " -STRING_NO_LABEL " " +STRING_NO_LABEL "Не можу встановити мітку диску" -STRING_FREE_SPACE "\n%I64d .\n%I64d .\n" +STRING_FREE_SPACE "\n%I64d байтів на диску.\n%I64d байтів доступно на диску.\n" -STRING_SERIAL_NUMBER "\n - %04X-%04X\n" +STRING_SERIAL_NUMBER "\nСерійний номер диску - %04X-%04X\n" END diff --git a/base/system/format/rsrc.rc b/base/system/format/rsrc.rc index 61d06ce3d8d..51a2c5ca41b 100644 --- a/base/system/format/rsrc.rc +++ b/base/system/format/rsrc.rc @@ -14,8 +14,11 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL #include "lang/it-IT.rc" #include "lang/lt-LT.rc" #include "lang/no-NO.rc" +#include "lang/sk-SK.rc" +#include "lang/es-ES.rc" + +// UTF-8 +#pragma code_page(65001) #include "lang/pl-PL.rc" #include "lang/ru-RU.rc" -#include "lang/sk-SK.rc" #include "lang/uk-UA.rc" -#include "lang/es-ES.rc" diff --git a/base/system/logonui/NT5design.c b/base/system/logonui/NT5design.c new file mode 100644 index 00000000000..6c4ff372672 --- /dev/null +++ b/base/system/logonui/NT5design.c @@ -0,0 +1,354 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Logon User Interface Host + * FILE: subsys/system/logonui/NT5design.c + * PROGRAMMERS: Ged Murphy (gedmurphy@reactos.org) + */ + +#include "logonui.h" + + +/* GLOBALS ******************************************************************/ + +#define NT5_TOP_BORDER_HEIGHT 80 +#define NT5_BOTTOM_BORDER_HEIGHT 96 + + +/* FUNCTIONS ****************************************************************/ + +static VOID +NT5_DrawLogoffCaptionText(LPWSTR lpText, + HDC hdcMem) +{ + HFONT hFont; + LOGFONTW LogFont; + RECT TextRect; + INT PrevBkMode; + + /* Setup the font we'll use */ + ZeroMemory(&LogFont, sizeof(LOGFONTW)); + LogFont.lfCharSet = DEFAULT_CHARSET; + LogFont.lfHeight = 22; + LogFont.lfWeight = 109; // From WinXP disassembly + wcscpy_s(LogFont.lfFaceName, LF_FACESIZE, L"Arial"); + + /* Create it */ + hFont = CreateFontIndirectW(&LogFont); + if (hFont) + { + /* Set the font and font colour */ + SelectObject(hdcMem, hFont); + SetTextColor(hdcMem, RGB(255, 255, 255)); + + /* Create the text rect */ + TextRect.top = (g_pInfo->cy / 2) + 34; + TextRect.bottom = (g_pInfo->cy / 2) + 34 + (GetDeviceCaps(hdcMem, LOGPIXELSY)); + TextRect.left = g_pInfo->cx / 3; + TextRect.right = (g_pInfo->cx / 2) + 35 + 137; + + /* Set the background mode to transparent */ + PrevBkMode = SetBkMode(hdcMem, TRANSPARENT); + + /* Draw the text to the mem DC */ + DrawTextW(hdcMem, + lpText, + -1, + &TextRect, + DT_NOPREFIX | DT_WORDBREAK | DT_RIGHT); // WinXP disassembly uses 0x812 + + /* Set the previous background mode */ + SetBkMode(hdcMem, PrevBkMode); + + /* Delete the font */ + DeleteObject(hFont); + } +} + +static VOID +NT5_DrawLogoffIcon(HDC hdcMem) +{ + HBITMAP hBitmap; + BITMAP bitmap; + HDC hTempDC; + + /* Load the XP logo */ + hBitmap = (HBITMAP)LoadImageW(g_pInfo->hInstance, + MAKEINTRESOURCEW(IDB_MAIN_ROS_LOGO), + IMAGE_BITMAP, + 0, + 0, + LR_DEFAULTCOLOR); + if (hBitmap) + { + /* Get the bitmap dimensions */ + GetObjectW(hBitmap, sizeof(BITMAP), &bitmap); + + /* Create a temp DC for the bitmap */ + hTempDC = CreateCompatibleDC(hdcMem); + if (hTempDC) + { + /* Select the bitmap onto the temp DC */ + SelectObject(hTempDC, hBitmap); + + /* Paint it onto the centre block */ + BitBlt(hdcMem, + (g_pInfo->cx / 2) + 35, + (g_pInfo->cy / 2) - 72, + bitmap.bmWidth, + bitmap.bmHeight, + hTempDC, + 0, + 0, + SRCCOPY); + + /* Delete the DC */ + DeleteDC(hTempDC); + } + + /* Delete the bitmap */ + DeleteObject(hBitmap); + } +} + +VOID +NT5_RefreshLogoffScreenText(LPWSTR lpText, + HDC hdcMem) +{ + /* FIXME: clear previous text */ + + /* Draw the new text */ + NT5_DrawLogoffCaptionText(lpText, hdcMem); +} + +VOID +NT5_CreateLogoffScreen(LPWSTR lpText, + HDC hdcMem) +{ + /* Draw the reactos logo */ + NT5_DrawLogoffIcon(hdcMem); + + /* Draw the first text string */ + NT5_DrawLogoffCaptionText(lpText, hdcMem); +} + +HDC +NT5_DrawBaseBackground(HDC hdcDesktop) +{ + HBITMAP hBitmap = NULL; + HDC hdcMem = NULL; + BOOL bRet = FALSE; + + + /* Create an an off screen DC to match the desktop DC */ + hdcMem = CreateCompatibleDC(hdcDesktop); + if (hdcMem) + { + /* Create a bitmap to draw the logoff screen onto */ + hBitmap = CreateCompatibleBitmap(hdcDesktop, g_pInfo->cx, g_pInfo->cy); + if (hBitmap) + { + /* Select it onto our off screen DC*/ + SelectObject(hdcMem, hBitmap); + + /* Draw the centre block */ + { + HBITMAP hTempBitmap; + HBRUSH hBrush; + BITMAP bitmap; + HDC hTempDC; + + /* Paint the blue centre block */ + hBrush = CreateSolidBrush(RGB(90, 126, 220)); + SelectObject(hdcMem, hBrush); + PatBlt(hdcMem, + 0, + NT5_TOP_BORDER_HEIGHT, + g_pInfo->cx, + g_pInfo->cy - NT5_TOP_BORDER_HEIGHT - NT5_BOTTOM_BORDER_HEIGHT, + PATCOPY); + DeleteObject(hBrush); + + /* Load the shine effect */ + hTempBitmap = (HBITMAP)LoadImageW(g_pInfo->hInstance, + MAKEINTRESOURCEW(IDB_MAIN_PANEL_SHINE), + IMAGE_BITMAP, + 0, + 0, + LR_DEFAULTCOLOR); + if (hTempBitmap) + { + /* Get the bitmap dimensions */ + GetObjectW(hTempBitmap, sizeof(BITMAP), &bitmap); + + /* Create a temp DC for the bitmap */ + hTempDC = CreateCompatibleDC(hdcDesktop); + if (hTempDC) + { + /* Select the bitmap onto the temp DC */ + SelectObject(hTempDC, hTempBitmap); + + /* Paint it onto the top left of the centre block */ + BitBlt(hdcMem, + 0, + NT5_TOP_BORDER_HEIGHT, + bitmap.bmWidth, + bitmap.bmHeight, + hTempDC, + 0, + 0, + SRCCOPY); + + /* Delete the DC */ + DeleteDC(hTempDC); + } + + /* Delete the bitmap */ + DeleteObject(hTempBitmap); + } + } + + /* Draw the top border */ + { + HBITMAP hTempBitmap; + HBRUSH hBrush; + BITMAP bitmap; + HDC hTempDC; + + /* Create the blue brush and paint the top bar */ + hBrush = CreateSolidBrush(RGB(0, 48, 156)); + SelectObject(hdcMem, hBrush); + PatBlt(hdcMem, 0, 0, g_pInfo->cx, NT5_TOP_BORDER_HEIGHT, PATCOPY); + DeleteObject(hBrush); + + /* Load the top divider strip */ + hTempBitmap = (HBITMAP)LoadImageW(g_pInfo->hInstance, + MAKEINTRESOURCEW(IDB_TOP_DIVIDER_STRIP), + IMAGE_BITMAP, + 0, + 0, + LR_DEFAULTCOLOR); + if (hTempBitmap) + { + /* Get the bitmap dimensions */ + GetObjectW(hTempBitmap, sizeof(BITMAP), &bitmap); + + /* Create a temp DC for the bitmap */ + hTempDC = CreateCompatibleDC(hdcDesktop); + if (hTempDC) + { + /* Select the bitmap onto the temp DC */ + SelectObject(hTempDC, hTempBitmap); + + /* Paint the bitmap */ + StretchBlt(hdcMem, + 0, + NT5_TOP_BORDER_HEIGHT - bitmap.bmHeight, + g_pInfo->cx, + NT5_TOP_BORDER_HEIGHT, + hTempDC, + 0, + 0, + bitmap.bmWidth, + NT5_TOP_BORDER_HEIGHT, + SRCCOPY); + + /* Delete the DC */ + DeleteDC(hTempDC); + } + + /* Delete the bitmap */ + DeleteObject(hTempBitmap); + } + } + + /* Draw the bottom border */ + { + HBITMAP hTempBitmap; + TRIVERTEX vertex[2]; + GRADIENT_RECT gRect; + BITMAP bitmap; + HDC hTempDC; + + /* + * We paint the divider strip first as it's 3 + * pixels high but MS only show 2 of them. + */ + + /* Load the bottom divider strip */ + hTempBitmap = (HBITMAP)LoadImage(g_pInfo->hInstance, + MAKEINTRESOURCE(IDB_BOTTOM_DIVIDER_STRIP), + IMAGE_BITMAP, + 0, + 0, + LR_DEFAULTCOLOR); + if (hTempBitmap) + { + /* Get the bitmap dimensions */ + GetObjectW(hTempBitmap, sizeof(BITMAP), &bitmap); + + /* Create a temp DC for the bitmap */ + hTempDC = CreateCompatibleDC(hdcDesktop); + if (hTempDC) + { + /* Select the bitmap onto the temp DC */ + SelectObject(hTempDC, hTempBitmap); + + /* Paint the bitmap */ + StretchBlt(hdcMem, + 0, + g_pInfo->cy - NT5_BOTTOM_BORDER_HEIGHT, + g_pInfo->cx, + g_pInfo->cy - NT5_BOTTOM_BORDER_HEIGHT + bitmap.bmHeight, + hTempDC, + 0, + 0, + bitmap.bmWidth, + g_pInfo->cy - NT5_BOTTOM_BORDER_HEIGHT + bitmap.bmHeight, + SRCCOPY); + + /* Delete the DC */ + DeleteDC(hTempDC); + } + + /* Delete the bitmap */ + DeleteObject(hTempBitmap); + } + + /* Setup the left hand vertex */ + vertex[0].x = 0; + vertex[0].y = g_pInfo->cy - NT5_BOTTOM_BORDER_HEIGHT + 2; // paint over 1 pixel of the bitmap + vertex[0].Red = 0x3900; + vertex[0].Green = 0x3400; + vertex[0].Blue = 0xAE00; + vertex[0].Alpha = 0x0000; + + /* Setup the right hand vertex */ + vertex[1].x = g_pInfo->cx; + vertex[1].y = g_pInfo->cy; + vertex[1].Red = 0x0000; + vertex[1].Green = 0x3000; + vertex[1].Blue = 0x9600; + vertex[1].Alpha = 0x0000; + + /* Set the vertex structs */ + gRect.UpperLeft = 0; + gRect.LowerRight = 1; + + /* Paint the gradient across the bottom */ + GradientFill(hdcMem, + vertex, + 2, + &gRect, + 1, + GRADIENT_FILL_RECT_H); + } + + /* Delete the bitmap */ + DeleteObject(hBitmap); + } + } + + return hdcMem; +} + +/* EOF */ diff --git a/base/system/logonui/NT6design.c b/base/system/logonui/NT6design.c new file mode 100644 index 00000000000..32782788cd6 --- /dev/null +++ b/base/system/logonui/NT6design.c @@ -0,0 +1,21 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Logon User Interface Host + * FILE: subsys/system/logonui/NT6design.c + * PROGRAMMERS: Ged Murphy (gedmurphy@reactos.org) + */ + +#include "logonui.h" + +/* DATA *********************************************************************/ + +#define LOGONUI_KEY L"SOFTWARE\\Microsoft\\Windows\CurrentVersion\\Authentication\\LogonUI" + + +/* GLOBALS ******************************************************************/ + +/* FUNCTIONS ****************************************************************/ + + + +/* EOF */ diff --git a/base/system/logonui/lang/en-US.rc b/base/system/logonui/lang/en-US.rc new file mode 100644 index 00000000000..77cc40892c6 --- /dev/null +++ b/base/system/logonui/lang/en-US.rc @@ -0,0 +1,3 @@ +#include "resource.h" +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + diff --git a/base/system/logonui/logonui.c b/base/system/logonui/logonui.c new file mode 100644 index 00000000000..1f5cb1e9f91 --- /dev/null +++ b/base/system/logonui/logonui.c @@ -0,0 +1,171 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Logon User Interface Host + * FILE: subsys/system/logonui/logonui.c + * PROGRAMMERS: Ged Murphy (gedmurphy@reactos.org) + */ + +#include "logonui.h" + +/* DATA **********************************************************************/ + + + + +/* GLOBALS ******************************************************************/ + +PINFO g_pInfo = NULL; + + +/* FUNCTIONS ****************************************************************/ + + +static HDC +DrawBaseBackground(HDC hdcDesktop) +{ + HDC hdcMem; + + hdcMem = NT5_DrawBaseBackground(hdcDesktop); + + return hdcMem; +} + +static VOID +DrawLogoffScreen(HDC hdcMem) +{ + /* Draw the logoff icon */ + NT5_CreateLogoffScreen(L"Saving your settings...", hdcMem); +} + +static ULONG +GetULONG(LPWSTR String) +{ + UINT i, Length; + ULONG Value; + LPWSTR StopString; + + i = 0; + /* Get the string length */ + Length = (UINT)wcslen(String); + + /* Check the string only consists of numbers */ + while ((i < Length) && ((String[i] < L'0') || (String[i] > L'9'))) i++; + if ((i >= Length) || ((String[i] < L'0') || (String[i] > L'9'))) + { + return (ULONG)-1; + } + + /* Convert it */ + Value = wcstoul(&String[i], &StopString, 10); + + return Value; +} + +static ULONG +GetULONG2(LPWSTR String1, LPWSTR String2, PINT i) +{ + ULONG Value; + + /* Check the first string value */ + Value = GetULONG(String1); + if (Value == (ULONG)-1) + { + /* Check the second string value isn't a switch */ + if (String2[0] != L'-') + { + /* Check the value */ + Value = GetULONG(String2); + *i += 1; + } + } + + return Value; +} + +static BOOL +ParseCmdline(int argc, WCHAR* argv[]) +{ + return TRUE; +} + +static VOID +Run() +{ + HWND hDesktopWnd; + HDC hdcDesktop, hdcMem; + + /* Get the screen size */ + g_pInfo->cx = GetSystemMetrics(SM_CXSCREEN); + g_pInfo->cy = GetSystemMetrics(SM_CYSCREEN); + + hDesktopWnd = GetDesktopWindow(); + + /* Get the DC for the desktop */ + hdcDesktop = GetDCEx(hDesktopWnd, NULL, DCX_CACHE); + if (hdcDesktop) + { + /* Initialize the base background onto a DC */ + hdcMem = DrawBaseBackground(hdcDesktop); + if (hdcMem) + { + /* TEST : Draw logoff screen */ + DrawLogoffScreen(hdcMem); + + /* Blit the off-screen DC to the desktop */ + BitBlt(hdcDesktop, + 0, + 0, + g_pInfo->cx, + g_pInfo->cy, + hdcMem, + 0, + 0, + SRCCOPY); + + /* Delete the memory DC */ + DeleteDC(hdcMem); + } + + /* Release the desktop DC */ + ReleaseDC(hDesktopWnd, hdcDesktop); + } +} + +int WINAPI +wWinMain(IN HINSTANCE hInst, + IN HINSTANCE hPrevInstance, + IN LPWSTR lpszCmdLine, + IN int nCmdShow) +{ + LPWSTR *lpArgs; + INT NumArgs; + + /* Allocate memory for the data */ + g_pInfo = (PINFO)HeapAlloc(GetProcessHeap(), + HEAP_ZERO_MEMORY, + sizeof(INFO)); + if (!g_pInfo) return -1; + + g_pInfo->hInstance = hInst; + + /* Get the command line args */ + lpArgs = CommandLineToArgvW(lpszCmdLine, &NumArgs); + if (lpArgs) + { + /* Parse the command line */ + if (ParseCmdline(NumArgs, lpArgs)) + { + /* Start the main routine */ + Run(); + } + } + + /* Free the data */ + HeapFree(GetProcessHeap(), + 0, + g_pInfo); + + return 0; +} + +/* EOF */ diff --git a/base/system/logonui/logonui.h b/base/system/logonui/logonui.h new file mode 100644 index 00000000000..b0e36bfabd7 --- /dev/null +++ b/base/system/logonui/logonui.h @@ -0,0 +1,20 @@ +#pragma once + +#include +#include "resource.h" + +typedef struct _INFO +{ + HINSTANCE hInstance; + INT cx; + INT cy; + +} INFO, *PINFO; + +extern PINFO g_pInfo; + + + +HDC NT5_DrawBaseBackground(HDC hdcDesktop); +VOID NT5_CreateLogoffScreen(LPWSTR lpText, HDC hdcMem); +VOID NT5_RefreshLogoffScreenText(LPWSTR lpText, HDC hdcMem); diff --git a/base/system/logonui/logonui.rbuild b/base/system/logonui/logonui.rbuild new file mode 100644 index 00000000000..d314ddbe883 --- /dev/null +++ b/base/system/logonui/logonui.rbuild @@ -0,0 +1,12 @@ + + + + . + user32 + gdi32 + msimg32.lib + logonui.c + NT5design.c + NT6design.c + logonui.rc + diff --git a/base/system/logonui/logonui.rc b/base/system/logonui/logonui.rc new file mode 100644 index 00000000000..4b2ca7497cb --- /dev/null +++ b/base/system/logonui/logonui.rc @@ -0,0 +1,8 @@ +#include + +#define REACTOS_STR_FILE_DESCRIPTION "ReactOS Logon User Interface Host\0" +#define REACTOS_STR_INTERNAL_NAME "LogonUI\0" +#define REACTOS_STR_ORIGINAL_FILENAME "LogonUI.exe\0" +//#include + +#include "rsrc.rc" diff --git a/base/system/logonui/res/100.bmp b/base/system/logonui/res/100.bmp new file mode 100644 index 00000000000..a690d4c3206 Binary files /dev/null and b/base/system/logonui/res/100.bmp differ diff --git a/base/system/logonui/res/123.bmp b/base/system/logonui/res/123.bmp new file mode 100644 index 00000000000..eb967d022df Binary files /dev/null and b/base/system/logonui/res/123.bmp differ diff --git a/base/system/logonui/res/125.bmp b/base/system/logonui/res/125.bmp new file mode 100644 index 00000000000..ae6ea10cb6a Binary files /dev/null and b/base/system/logonui/res/125.bmp differ diff --git a/base/system/logonui/res/126.bmp b/base/system/logonui/res/126.bmp new file mode 100644 index 00000000000..05e6ce7a8fc Binary files /dev/null and b/base/system/logonui/res/126.bmp differ diff --git a/base/system/logonui/res/unknown.bmp b/base/system/logonui/res/unknown.bmp new file mode 100644 index 00000000000..67410c64078 Binary files /dev/null and b/base/system/logonui/res/unknown.bmp differ diff --git a/base/system/logonui/res/unknown2.bmp b/base/system/logonui/res/unknown2.bmp new file mode 100644 index 00000000000..d73e722124b Binary files /dev/null and b/base/system/logonui/res/unknown2.bmp differ diff --git a/base/system/logonui/resource.h b/base/system/logonui/resource.h new file mode 100644 index 00000000000..da8c4e76104 --- /dev/null +++ b/base/system/logonui/resource.h @@ -0,0 +1,5 @@ + +#define IDB_MAIN_PANEL_SHINE 100 +#define IDB_MAIN_ROS_LOGO 123 +#define IDB_TOP_DIVIDER_STRIP 125 +#define IDB_BOTTOM_DIVIDER_STRIP 126 diff --git a/base/system/logonui/rsrc.rc b/base/system/logonui/rsrc.rc new file mode 100644 index 00000000000..f2521e79f63 --- /dev/null +++ b/base/system/logonui/rsrc.rc @@ -0,0 +1,14 @@ + +#include +#include "resource.h" + +LANGUAGE LANG_NEUTRAL,SUBLANG_NEUTRAL + +IDB_MAIN_PANEL_SHINE BITMAP DISCARDABLE "res/100.bmp" +IDB_MAIN_ROS_LOGO BITMAP DISCARDABLE "res/123.bmp" +IDB_TOP_DIVIDER_STRIP BITMAP DISCARDABLE "res/125.bmp" +IDB_BOTTOM_DIVIDER_STRIP BITMAP DISCARDABLE "res/126.bmp" + + +//#include "lang/en-US.rc" + diff --git a/base/system/lsass/lsass.c b/base/system/lsass/lsass.c index 57216a4d9a6..3dae3ca15d7 100644 --- a/base/system/lsass/lsass.c +++ b/base/system/lsass/lsass.c @@ -27,7 +27,7 @@ #define WIN32_NO_STATUS #include #define NTOS_MODE_USER -#include +#include #include //#include diff --git a/base/system/msiexec/CMakeLists.txt b/base/system/msiexec/CMakeLists.txt index 9e4c2562343..2d19d4f98da 100644 --- a/base/system/msiexec/CMakeLists.txt +++ b/base/system/msiexec/CMakeLists.txt @@ -1,7 +1,5 @@ -add_definitions( - -D_DLL -D__USE_CRTIMP - -D__WINESRC__) +add_definitions(-D__WINESRC__) include_directories(${REACTOS_SOURCE_DIR}/include/wine) @@ -13,7 +11,6 @@ add_executable(msiexec rsrc.rc) set_module_type(msiexec win32gui) - target_link_libraries(msiexec uuid wine) add_importlibs(msiexec user32 advapi32 ole32 msi msvcrt kernel32 ntdll) add_cd_file(TARGET msiexec DESTINATION reactos/system32 FOR all) diff --git a/base/system/regsvr32/CMakeLists.txt b/base/system/regsvr32/CMakeLists.txt index c784511eb63..1711f737f4e 100644 --- a/base/system/regsvr32/CMakeLists.txt +++ b/base/system/regsvr32/CMakeLists.txt @@ -1,8 +1,5 @@ -add_definitions(-D_DLL -D__USE_CRTIMP) - set_unicode() -include_directories(.) set_rc_compiler() add_executable(regsvr32 regsvr32.c regsvr32.rc) diff --git a/base/system/regsvr32/lang/ru-RU.rc b/base/system/regsvr32/lang/ru-RU.rc index 7b758fd2015..9f7972f6721 100644 --- a/base/system/regsvr32/lang/ru-RU.rc +++ b/base/system/regsvr32/lang/ru-RU.rc @@ -4,25 +4,25 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT STRINGTABLE DISCARDABLE BEGIN -IDS_UsageMessage, "%s\n\n: regsvr32 [/u] [/s] [/c] [/n] [/i[:]] _dll\n\ -/u - \n\ -/s - ; \n\ -/c - \n\ -/i - DllInstall []; /u DllUninstall\n\ -/n - DllRegisterServer; /i" +IDS_UsageMessage, "%s\n\nИспользование: regsvr32 [/u] [/s] [/c] [/n] [/i[:параметр]] имя_dll\n\ +/u - Отмена регистрации сервера\n\ +/s - Тихий; не отображать окон сообщений\n\ +/c - Вывод в консоль\n\ +/i - Вызывает DllInstall с дополнительным параметром [параметр]; При использовании ключа /u вызывает DllUninstall\n\ +/n - Не вызывает DllRegisterServer; эта опция должна использоваться с /i" -IDS_NoDllSpecified, " DLL." +IDS_NoDllSpecified, "Не указано имя DLL." -IDS_InvalidFlag, " : %s" +IDS_InvalidFlag, "Неизвестный параметр: %s" -IDS_SwitchN_NoI, " : /n /i" +IDS_SwitchN_NoI, "Неизвестный параметр: /n должен использоваться совместно с параметром /i" -IDS_DllNotLoaded, " LoadLibrary('%s') .\n GetLastError : 0x%08x." +IDS_DllNotLoaded, "Вызов LoadLibrary('%s') завершился неудачей.\nФункция GetLastError возвратила код ошибки: 0x%08x." -IDS_MissingEntry, "%s , %s .\n\n\ -%s %s . PView, ." +IDS_MissingEntry, "%s был загружен, но точка входа %s не найдена.\n\n\ +%s может быть неэкспортируемой или поврежденная версия %s находится в памяти. Используйте PView, чтобы обнаружить и удалить его." -IDS_FailureMessage, "%s %s .\n : 0x%08x" +IDS_FailureMessage, "%s в %s завершился неудачей.\nВозвращенный код: 0x%08x" -IDS_SuccessMessage "%s %s ." +IDS_SuccessMessage "%s в %s успешно завершено." END diff --git a/base/system/regsvr32/lang/uk-UA.rc b/base/system/regsvr32/lang/uk-UA.rc index 3e7be2b1614..bcda54f6a98 100644 --- a/base/system/regsvr32/lang/uk-UA.rc +++ b/base/system/regsvr32/lang/uk-UA.rc @@ -5,25 +5,25 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT STRINGTABLE DISCARDABLE BEGIN -IDS_UsageMessage, "%s\n\n: regsvr32 [/u] [/s] [/c] [/n] [/i[:]] _dll\n\ -/u - ³ \n\ -/s - : \n\ -/c - \n\ -/i - DllInstall []; /u DllUninstall\n\ -/n - DllRegisterServer; /i" +IDS_UsageMessage, "%s\n\nВикористання: regsvr32 [/u] [/s] [/c] [/n] [/i[:параметри]] назва_dll\n\ +/u - Відмінити реєстрацію сервера\n\ +/s - Тихий режим: Не виводити повідомлень\n\ +/c - Вивід в консоль\n\ +/i - Викликати DllInstall з додатковими параметрами [параметри]; Коли використовується ключ /u викликається DllUninstall\n\ +/n - Не викликати DllRegisterServer; цей ключ має використовуватися з /i" -IDS_NoDllSpecified, " ' DLL." +IDS_NoDllSpecified, "Не вказано ім'я DLL." -IDS_InvalidFlag, " : %s" +IDS_InvalidFlag, "Невідомий ключ: %s" -IDS_SwitchN_NoI, " : /n /i" +IDS_SwitchN_NoI, "Невідомий ключ: /n використовується лише з ключем /i" -IDS_DllNotLoaded, "LoadLibrary('%s') .\nGetLastError 0x%08x." +IDS_DllNotLoaded, "LoadLibrary('%s') завершився аварійно.\nGetLastError повернуло 0x%08x." -IDS_MissingEntry, "%s , %s .\n\n\ -%s , ' %s. %s, PView." +IDS_MissingEntry, "%s було запущено, але точка входу для %s не знайдено.\n\n\ +%s може не експортуватись, чи в пам'яті лежить пошкоджена версія %s. Для того щоб знайти і видалти %s, використовуйте PView." -IDS_FailureMessage, "%s %s .\n : 0x%08x" +IDS_FailureMessage, "%s в %s завершилося аварійно.\nКод завершення: 0x%08x" -IDS_SuccessMessage "%s %s ." +IDS_SuccessMessage "%s в %s успішно виконано." END diff --git a/base/system/regsvr32/rsrc.rc b/base/system/regsvr32/rsrc.rc index 24fba70ad6b..4867e000c8a 100644 --- a/base/system/regsvr32/rsrc.rc +++ b/base/system/regsvr32/rsrc.rc @@ -17,9 +17,9 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL #include "lang/no-NO.rc" #include "lang/nl-NL.rc" #include "lang/pt-BR.rc" -#include "lang/ru-RU.rc" -#include "lang/uk-UA.rc" // UTF-8 #pragma code_page(65001) #include "lang/pl-PL.rc" +#include "lang/ru-RU.rc" +#include "lang/uk-UA.rc" diff --git a/base/system/rundll32/lang/ru-RU.rc b/base/system/rundll32/lang/ru-RU.rc index 57948f3096d..022411de2fe 100644 --- a/base/system/rundll32/lang/ru-RU.rc +++ b/base/system/rundll32/lang/ru-RU.rc @@ -3,6 +3,6 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT STRINGTABLE DISCARDABLE BEGIN - IDS_DllNotLoaded, " '%s'" - IDS_MissingEntry, " : %s\n %s" + IDS_DllNotLoaded, "Невозможно загрузить библиотеку '%s'" + IDS_MissingEntry, "Невозможно найти точку входа: %s\nв библиотеке %s" END diff --git a/base/system/rundll32/lang/uk-UA.rc b/base/system/rundll32/lang/uk-UA.rc index 3685ef48525..54899a51004 100644 --- a/base/system/rundll32/lang/uk-UA.rc +++ b/base/system/rundll32/lang/uk-UA.rc @@ -12,6 +12,6 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT STRINGTABLE DISCARDABLE BEGIN - IDS_DllNotLoaded, "LoadLibrary '%s'" - IDS_MissingEntry, " :%s\n %s" + IDS_DllNotLoaded, "LoadLibrary не вдалося завантажити '%s'" + IDS_MissingEntry, "Неможливо знайти точку входу:%s\nВ бібліотеці %s" END diff --git a/base/system/rundll32/rsrc.rc b/base/system/rundll32/rsrc.rc index f7d9278dbf8..784b916d3a7 100644 --- a/base/system/rundll32/rsrc.rc +++ b/base/system/rundll32/rsrc.rc @@ -18,11 +18,11 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL #include "lang/nl-NL.rc" #include "lang/pt-BR.rc" #include "lang/ro-RO.rc" -#include "lang/ru-RU.rc" #include "lang/sk-SK.rc" #include "lang/th-TH.rc" -#include "lang/uk-UA.rc" // UTF-8 #pragma code_page(65001) #include "lang/pl-PL.rc" +#include "lang/ru-RU.rc" +#include "lang/uk-UA.rc" diff --git a/base/system/runonce/lang/ru-RU.rc b/base/system/runonce/lang/ru-RU.rc index c8700bd92ed..1ff0637bef4 100644 --- a/base/system/runonce/lang/ru-RU.rc +++ b/base/system/runonce/lang/ru-RU.rc @@ -2,10 +2,10 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT IDD_RUNONCE_DLG DIALOG DISCARDABLE 0, 0, 239, 170 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " ReactOS" +CAPTION "Установка ReactOS" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "ReactOS :", -1, 38, 8, 196, 18 + LTEXT "ReactOS настраивает следующие компоненты:", -1, 38, 8, 196, 18 LISTBOX IDC_COMP_LIST, 36, 32, 197, 131, LBS_OWNERDRAWVARIABLE | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP ICON IDI_ICON, -1, 5, 6, 21, 20 END diff --git a/base/system/runonce/lang/uk-UA.rc b/base/system/runonce/lang/uk-UA.rc index 6c68828757a..18108958a3a 100644 --- a/base/system/runonce/lang/uk-UA.rc +++ b/base/system/runonce/lang/uk-UA.rc @@ -10,10 +10,10 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT IDD_RUNONCE_DLG DIALOG DISCARDABLE 0, 0, 239, 170 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " ReactOS" +CAPTION "Встановлення ReactOS" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "ReactOS :", -1, 38, 8, 196, 18 + LTEXT "ReactOS налаштовує наступні компоненти:", -1, 38, 8, 196, 18 LISTBOX IDC_COMP_LIST, 36, 32, 197, 131, LBS_OWNERDRAWVARIABLE | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP ICON IDI_ICON, -1, 5, 6, 21, 20 END diff --git a/base/system/runonce/rsrc.rc b/base/system/runonce/rsrc.rc index 18829d0a154..e86ca7e489e 100644 --- a/base/system/runonce/rsrc.rc +++ b/base/system/runonce/rsrc.rc @@ -3,10 +3,10 @@ #include "lang/fr-FR.rc" #include "lang/es-ES.rc" #include "lang/ja-JP.rc" -#include "lang/ru-RU.rc" #include "lang/sk-SK.rc" -#include "lang/uk-UA.rc" // UTF-8 #pragma code_page(65001) #include "lang/pl-PL.rc" +#include "lang/ru-RU.rc" +#include "lang/uk-UA.rc" diff --git a/base/system/services/CMakeLists.txt b/base/system/services/CMakeLists.txt index 5384849da3c..2706525af4e 100644 --- a/base/system/services/CMakeLists.txt +++ b/base/system/services/CMakeLists.txt @@ -1,9 +1,11 @@ -set_unicode() - include_directories( - ${REACTOS_BINARY_DIR}/include/reactos/idl - ${REACTOS_SOURCE_DIR}/include/reactos/subsys) + ${REACTOS_SOURCE_DIR}/include/reactos/subsys + ${REACTOS_SOURCE_DIR}/include/reactos/idl) + +add_rpc_files(server ${REACTOS_SOURCE_DIR}/include/reactos/idl/svcctl.idl) + +set_unicode() list(APPEND SOURCE config.c @@ -12,16 +14,16 @@ list(APPEND SOURCE groupdb.c rpcserver.c services.c - services.rc) + services.rc + ${CMAKE_CURRENT_BINARY_DIR}/svcctl_s.c) -add_executable(services ${CMAKE_CURRENT_BINARY_DIR}/services_services.h.gch ${SOURCE}) +add_executable(services ${SOURCE}) -target_link_libraries(services - svcctlrpc - ${PSEH_LIB}) - -add_pch(services ${CMAKE_CURRENT_SOURCE_DIR}/services.h ${SOURCE}) +if(NOT MSVC) + target_link_libraries(services pseh) +endif() set_module_type(services win32cui) add_importlibs(services user32 advapi32 rpcrt4 msvcrt kernel32 ntdll) +add_pch(services services.h) add_cd_file(TARGET services DESTINATION reactos/system32 FOR all) diff --git a/base/system/services/database.c b/base/system/services/database.c index b8d0a4be3d4..1c2cc7eeaa6 100644 --- a/base/system/services/database.c +++ b/base/system/services/database.c @@ -25,6 +25,7 @@ /* GLOBALS *******************************************************************/ +LIST_ENTRY ImageListHead; LIST_ENTRY ServiceListHead; static RTL_RESOURCE DatabaseLock; @@ -34,6 +35,232 @@ static CRITICAL_SECTION ControlServiceCriticalSection; /* FUNCTIONS *****************************************************************/ +static DWORD +ScmCreateNewControlPipe(PSERVICE_IMAGE pServiceImage) +{ + WCHAR szControlPipeName[MAX_PATH + 1]; + HKEY hServiceCurrentKey = INVALID_HANDLE_VALUE; + DWORD ServiceCurrent = 0; + DWORD KeyDisposition; + DWORD dwKeySize; + DWORD dwError; + + /* Get the service number */ + /* TODO: Create registry entry with correct write access */ + dwError = RegCreateKeyExW(HKEY_LOCAL_MACHINE, + L"SYSTEM\\CurrentControlSet\\Control\\ServiceCurrent", 0, NULL, + REG_OPTION_VOLATILE, + KEY_WRITE | KEY_READ, + NULL, + &hServiceCurrentKey, + &KeyDisposition); + if (dwError != ERROR_SUCCESS) + { + DPRINT1("RegCreateKeyEx() failed with error %lu\n", dwError); + return dwError; + } + + if (KeyDisposition == REG_OPENED_EXISTING_KEY) + { + dwKeySize = sizeof(DWORD); + dwError = RegQueryValueExW(hServiceCurrentKey, + L"", 0, NULL, (BYTE*)&ServiceCurrent, &dwKeySize); + + if (dwError != ERROR_SUCCESS) + { + RegCloseKey(hServiceCurrentKey); + DPRINT1("RegQueryValueEx() failed with error %lu\n", dwError); + return dwError; + } + + ServiceCurrent++; + } + + dwError = RegSetValueExW(hServiceCurrentKey, L"", 0, REG_DWORD, (BYTE*)&ServiceCurrent, sizeof(ServiceCurrent)); + + RegCloseKey(hServiceCurrentKey); + + if (dwError != ERROR_SUCCESS) + { + DPRINT1("RegSetValueExW() failed (Error %lu)\n", dwError); + return dwError; + } + + /* Create '\\.\pipe\net\NtControlPipeXXX' instance */ + swprintf(szControlPipeName, L"\\\\.\\pipe\\net\\NtControlPipe%u", ServiceCurrent); + + DPRINT("PipeName: %S\n", szControlPipeName); + + pServiceImage->hControlPipe = CreateNamedPipeW(szControlPipeName, + PIPE_ACCESS_DUPLEX, + PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT, + 100, + 8000, + 4, + 30000, + NULL); + DPRINT("CreateNamedPipeW(%S) done\n", szControlPipeName); + if (pServiceImage->hControlPipe == INVALID_HANDLE_VALUE) + { + DPRINT1("Failed to create control pipe!\n"); + return GetLastError(); + } + + return ERROR_SUCCESS; +} + + +static PSERVICE_IMAGE +ScmGetServiceImageByImagePath(LPWSTR lpImagePath) +{ + PLIST_ENTRY ImageEntry; + PSERVICE_IMAGE CurrentImage; + + DPRINT("ScmGetServiceImageByImagePath(%S) called\n", lpImagePath); + + ImageEntry = ImageListHead.Flink; + while (ImageEntry != &ImageListHead) + { + CurrentImage = CONTAINING_RECORD(ImageEntry, + SERVICE_IMAGE, + ImageListEntry); + if (_wcsicmp(CurrentImage->szImagePath, lpImagePath) == 0) + { + DPRINT("Found image: '%S'\n", CurrentImage->szImagePath); + return CurrentImage; + } + + ImageEntry = ImageEntry->Flink; + } + + DPRINT1("Couldn't find a matching image\n"); + + return NULL; + +} + + +static DWORD +ScmCreateOrReferenceServiceImage(PSERVICE pService) +{ + RTL_QUERY_REGISTRY_TABLE QueryTable[2]; + UNICODE_STRING ImagePath; + PSERVICE_IMAGE pServiceImage = NULL; + NTSTATUS Status; + DWORD dwError = ERROR_SUCCESS; + + DPRINT("ScmCreateOrReferenceServiceImage(%p)\n", pService); + + RtlInitUnicodeString(&ImagePath, NULL); + + /* Get service data */ + RtlZeroMemory(&QueryTable, + sizeof(QueryTable)); + + QueryTable[0].Name = L"ImagePath"; + QueryTable[0].Flags = RTL_QUERY_REGISTRY_DIRECT | RTL_QUERY_REGISTRY_REQUIRED; + QueryTable[0].EntryContext = &ImagePath; + + Status = RtlQueryRegistryValues(RTL_REGISTRY_SERVICES, + pService->lpServiceName, + QueryTable, + NULL, + NULL); + if (!NT_SUCCESS(Status)) + { + DPRINT1("RtlQueryRegistryValues() failed (Status %lx)\n", Status); + return RtlNtStatusToDosError(Status); + } + + DPRINT("ImagePath: '%wZ'\n", &ImagePath); + + pServiceImage = ScmGetServiceImageByImagePath(ImagePath.Buffer); + if (pServiceImage == NULL) + { + /* Create a new service image */ + pServiceImage = (PSERVICE_IMAGE)HeapAlloc(GetProcessHeap(), + HEAP_ZERO_MEMORY, + sizeof(SERVICE_IMAGE) + ((wcslen(ImagePath.Buffer) + 1) * sizeof(WCHAR))); + if (pServiceImage == NULL) + { + dwError = ERROR_NOT_ENOUGH_MEMORY; + goto done; + } + + pServiceImage->dwImageRunCount = 1; + pServiceImage->hControlPipe = INVALID_HANDLE_VALUE; + pServiceImage->hProcess = INVALID_HANDLE_VALUE; + + /* Set the image path */ + wcscpy(pServiceImage->szImagePath, + ImagePath.Buffer); + + RtlFreeUnicodeString(&ImagePath); + + /* Create the control pipe */ + dwError = ScmCreateNewControlPipe(pServiceImage); + if (dwError != ERROR_SUCCESS) + { + HeapFree(GetProcessHeap(), 0, pServiceImage); + goto done; + } + + /* FIXME: Add more initialization code here */ + + + /* Append service record */ + InsertTailList(&ImageListHead, + &pServiceImage->ImageListEntry); + } + else + { + /* Increment the run counter */ + pServiceImage->dwImageRunCount++; + } + + DPRINT("pServiceImage->dwImageRunCount: %lu\n", pServiceImage->dwImageRunCount); + + /* Link the service image to the service */ + pService->lpImage = pServiceImage; + +done:; + RtlFreeUnicodeString(&ImagePath); + + DPRINT("ScmCreateOrReferenceServiceImage() done (Error: %lu)\n", dwError); + + return dwError; +} + + +static VOID +ScmDereferenceServiceImage(PSERVICE_IMAGE pServiceImage) +{ + DPRINT1("ScmDereferenceServiceImage() called\n"); + + pServiceImage->dwImageRunCount--; + + if (pServiceImage->dwImageRunCount == 0) + { + DPRINT1("dwImageRunCount == 0\n"); + + /* FIXME: Terminate the process */ + + /* Remove the service image from the list */ + RemoveEntryList(&pServiceImage->ImageListEntry); + + /* Close the control pipe */ + if (pServiceImage->hControlPipe != INVALID_HANDLE_VALUE) + CloseHandle(pServiceImage->hControlPipe); + + /* Close the process handle */ + if (pServiceImage->hProcess != INVALID_HANDLE_VALUE) + CloseHandle(pServiceImage->hProcess); + + /* Release the service image */ + HeapFree(GetProcessHeap(), 0, pServiceImage); + } +} + PSERVICE ScmGetServiceEntryByName(LPCWSTR lpServiceName) @@ -131,7 +358,7 @@ ScmCreateNewServiceRecord(LPCWSTR lpServiceName, DPRINT("Service: '%S'\n", lpServiceName); /* Allocate service entry */ - lpService = (SERVICE*) HeapAlloc(GetProcessHeap(), + lpService = (SERVICE*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(SERVICE) + ((wcslen(lpServiceName) + 1) * sizeof(WCHAR))); if (lpService == NULL) @@ -173,9 +400,9 @@ ScmDeleteServiceRecord(PSERVICE lpService) lpService->lpDisplayName != lpService->lpServiceName) HeapFree(GetProcessHeap(), 0, lpService->lpDisplayName); - /* Decrement the image reference counter */ + /* Dereference the service image */ if (lpService->lpImage) - lpService->lpImage->dwServiceRefCount--; + ScmDereferenceServiceImage(lpService->lpImage); /* Decrement the group reference counter */ if (lpService->lpGroup) @@ -183,9 +410,6 @@ ScmDeleteServiceRecord(PSERVICE lpService) /* FIXME: SecurityDescriptor */ - /* Close the control pipe */ - if (lpService->ControlPipeHandle != INVALID_HANDLE_VALUE) - CloseHandle(lpService->ControlPipeHandle); /* Remove the Service from the List */ RemoveEntryList(&lpService->ServiceListEntry); @@ -330,6 +554,12 @@ done:; if (lpDisplayName != NULL) HeapFree(GetProcessHeap(), 0, lpDisplayName); + if (lpService != NULL) + { + if (lpService->lpImage != NULL) + ScmDereferenceServiceImage(lpService->lpImage); + } + return dwError; } @@ -479,6 +709,7 @@ ScmCreateServiceDatabase(VOID) return dwError; /* Initialize basic variables */ + InitializeListHead(&ImageListHead); InitializeListHead(&ServiceListHead); /* Initialize the database lock */ @@ -711,14 +942,14 @@ ScmControlService(PSERVICE Service, wcscpy(&ControlPacket->szArguments[0], Service->lpServiceName); /* Send the control packet */ - WriteFile(Service->ControlPipeHandle, + WriteFile(Service->lpImage->hControlPipe, ControlPacket, sizeof(SCM_CONTROL_PACKET) + (TotalLength * sizeof(WCHAR)), &dwWriteCount, NULL); /* Read the reply */ - ReadFile(Service->ControlPipeHandle, + ReadFile(Service->lpImage->hControlPipe, &ReplyPacket, sizeof(SCM_REPLY_PACKET), &dwReadCount, @@ -734,6 +965,12 @@ ScmControlService(PSERVICE Service, dwError = ReplyPacket.dwError; } + if (dwError == ERROR_SUCCESS && + dwControl == SERVICE_CONTROL_STOP) + { + ScmDereferenceServiceImage(Service->lpImage); + } + LeaveCriticalSection(&ControlServiceCriticalSection); DPRINT("ScmControlService() done\n"); @@ -804,14 +1041,14 @@ ScmSendStartCommand(PSERVICE Service, *Ptr = 0; /* Send the start command */ - WriteFile(Service->ControlPipeHandle, + WriteFile(Service->lpImage->hControlPipe, ControlPacket, sizeof(SCM_CONTROL_PACKET) + (TotalLength - 1) * sizeof(WCHAR), &dwWriteCount, NULL); /* Read the reply */ - ReadFile(Service->ControlPipeHandle, + ReadFile(Service->lpImage->hControlPipe, &ReplyPacket, sizeof(SCM_REPLY_PACKET), &dwReadCount, @@ -838,106 +1075,19 @@ ScmStartUserModeService(PSERVICE Service, DWORD argc, LPWSTR *argv) { - RTL_QUERY_REGISTRY_TABLE QueryTable[3]; PROCESS_INFORMATION ProcessInformation; STARTUPINFOW StartupInfo; - UNICODE_STRING ImagePath; - ULONG Type; - DWORD ServiceCurrent = 0; BOOL Result; - NTSTATUS Status; DWORD dwError = ERROR_SUCCESS; - WCHAR NtControlPipeName[MAX_PATH + 1]; - HKEY hServiceCurrentKey = INVALID_HANDLE_VALUE; - DWORD KeyDisposition; DWORD dwProcessId; - RtlInitUnicodeString(&ImagePath, NULL); + DPRINT("ScmStartUserModeService(%p)\n", Service); - /* Get service data */ - RtlZeroMemory(&QueryTable, - sizeof(QueryTable)); - - QueryTable[0].Name = L"Type"; - QueryTable[0].Flags = RTL_QUERY_REGISTRY_DIRECT | RTL_QUERY_REGISTRY_REQUIRED; - QueryTable[0].EntryContext = &Type; - - QueryTable[1].Name = L"ImagePath"; - QueryTable[1].Flags = RTL_QUERY_REGISTRY_DIRECT | RTL_QUERY_REGISTRY_REQUIRED; - QueryTable[1].EntryContext = &ImagePath; - - Status = RtlQueryRegistryValues(RTL_REGISTRY_SERVICES, - Service->lpServiceName, - QueryTable, - NULL, - NULL); - if (!NT_SUCCESS(Status)) + /* If the image is already running ... */ + if (Service->lpImage->dwImageRunCount > 1) { - DPRINT1("RtlQueryRegistryValues() failed (Status %lx)\n", Status); - return RtlNtStatusToDosError(Status); - } - DPRINT("ImagePath: '%S'\n", ImagePath.Buffer); - DPRINT("Type: %lx\n", Type); - - /* Get the service number */ - /* TODO: Create registry entry with correct write access */ - Status = RegCreateKeyExW(HKEY_LOCAL_MACHINE, - L"SYSTEM\\CurrentControlSet\\Control\\ServiceCurrent", 0, NULL, - REG_OPTION_VOLATILE, - KEY_WRITE | KEY_READ, - NULL, - &hServiceCurrentKey, - &KeyDisposition); - - if (ERROR_SUCCESS != Status) - { - DPRINT1("RegCreateKeyEx() failed with status %u\n", Status); - return Status; - } - - if (REG_OPENED_EXISTING_KEY == KeyDisposition) - { - DWORD KeySize = sizeof(ServiceCurrent); - Status = RegQueryValueExW(hServiceCurrentKey, L"", 0, NULL, (BYTE*)&ServiceCurrent, &KeySize); - - if (ERROR_SUCCESS != Status) - { - RegCloseKey(hServiceCurrentKey); - DPRINT1("RegQueryValueEx() failed with status %u\n", Status); - return Status; - } - - ServiceCurrent++; - } - - Status = RegSetValueExW(hServiceCurrentKey, L"", 0, REG_DWORD, (BYTE*)&ServiceCurrent, sizeof(ServiceCurrent)); - - RegCloseKey(hServiceCurrentKey); - - if (ERROR_SUCCESS != Status) - { - DPRINT1("RegSetValueExW() failed (Status %lx)\n", Status); - return Status; - } - - /* Create '\\.\pipe\net\NtControlPipeXXX' instance */ - swprintf(NtControlPipeName, L"\\\\.\\pipe\\net\\NtControlPipe%u", ServiceCurrent); - - DPRINT("Service: %p ImagePath: %wZ PipeName: %S\n", Service, &ImagePath, NtControlPipeName); - - Service->ControlPipeHandle = CreateNamedPipeW(NtControlPipeName, - PIPE_ACCESS_DUPLEX, - PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT, - 100, - 8000, - 4, - 30000, - NULL); - DPRINT("CreateNamedPipeW(%S) done\n", NtControlPipeName); - if (Service->ControlPipeHandle == INVALID_HANDLE_VALUE) - { - DPRINT1("Failed to create control pipe!\n"); - return GetLastError(); + /* ... just send a start command */ + return ScmSendStartCommand(Service, argc, argv); } StartupInfo.cb = sizeof(StartupInfo); @@ -949,7 +1099,7 @@ ScmStartUserModeService(PSERVICE Service, StartupInfo.lpReserved2 = 0; Result = CreateProcessW(NULL, - ImagePath.Buffer, + Service->lpImage->szImagePath, NULL, NULL, FALSE, @@ -958,15 +1108,9 @@ ScmStartUserModeService(PSERVICE Service, NULL, &StartupInfo, &ProcessInformation); - RtlFreeUnicodeString(&ImagePath); - if (!Result) { dwError = GetLastError(); - /* Close control pipe */ - CloseHandle(Service->ControlPipeHandle); - Service->ControlPipeHandle = INVALID_HANDLE_VALUE; - DPRINT1("Starting '%S' failed!\n", Service->lpServiceName); return dwError; } @@ -978,15 +1122,15 @@ ScmStartUserModeService(PSERVICE Service, ProcessInformation.dwThreadId, ProcessInformation.hThread); - /* Get process and thread ids */ - Service->ProcessId = ProcessInformation.dwProcessId; - Service->ThreadId = ProcessInformation.dwThreadId; + /* Get process handle and id */ + Service->lpImage->dwProcessId = ProcessInformation.dwProcessId; + Service->lpImage->hProcess = ProcessInformation.hProcess; /* Resume Thread */ ResumeThread(ProcessInformation.hThread); /* Connect control pipe */ - if (ConnectNamedPipe(Service->ControlPipeHandle, NULL) ? + if (ConnectNamedPipe(Service->lpImage->hControlPipe, NULL) ? TRUE : (dwError = GetLastError()) == ERROR_PIPE_CONNECTED) { DWORD dwRead = 0; @@ -994,7 +1138,7 @@ ScmStartUserModeService(PSERVICE Service, DPRINT("Control pipe connected!\n"); /* Read SERVICE_STATUS_HANDLE from pipe */ - if (!ReadFile(Service->ControlPipeHandle, + if (!ReadFile(Service->lpImage->hControlPipe, (LPVOID)&dwProcessId, sizeof(DWORD), &dwRead, @@ -1015,17 +1159,10 @@ ScmStartUserModeService(PSERVICE Service, else { DPRINT1("Connecting control pipe failed! (Error %lu)\n", dwError); - - /* Close control pipe */ - CloseHandle(Service->ControlPipeHandle); - Service->ControlPipeHandle = INVALID_HANDLE_VALUE; - Service->ProcessId = 0; - Service->ThreadId = 0; } - /* Close process and thread handle */ + /* Close thread handle */ CloseHandle(ProcessInformation.hThread); - CloseHandle(ProcessInformation.hProcess); return dwError; } @@ -1036,6 +1173,7 @@ ScmStartService(PSERVICE Service, DWORD argc, LPWSTR *argv) { PSERVICE_GROUP Group = Service->lpGroup; DWORD dwError = ERROR_SUCCESS; + LPCWSTR ErrorLogStrings[2]; DPRINT("ScmStartService() called\n"); @@ -1050,7 +1188,6 @@ ScmStartService(PSERVICE Service, DWORD argc, LPWSTR *argv) return ERROR_SERVICE_ALREADY_RUNNING; } - Service->ControlPipeHandle = INVALID_HANDLE_VALUE; DPRINT("Service->Type: %lu\n", Service->Status.dwServiceType); if (Service->Status.dwServiceType & SERVICE_DRIVER) @@ -1066,14 +1203,23 @@ ScmStartService(PSERVICE Service, DWORD argc, LPWSTR *argv) else { /* Start user-mode service */ - dwError = ScmStartUserModeService(Service, argc, argv); + dwError = ScmCreateOrReferenceServiceImage(Service); if (dwError == ERROR_SUCCESS) { + dwError = ScmStartUserModeService(Service, argc, argv); + if (dwError == ERROR_SUCCESS) + { #ifdef USE_SERVICE_START_PENDING - Service->Status.dwCurrentState = SERVICE_START_PENDING; + Service->Status.dwCurrentState = SERVICE_START_PENDING; #else - Service->Status.dwCurrentState = SERVICE_RUNNING; + Service->Status.dwCurrentState = SERVICE_RUNNING; #endif + } + else + { + ScmDereferenceServiceImage(Service->lpImage); + Service->lpImage = NULL; + } } } @@ -1088,15 +1234,20 @@ ScmStartService(PSERVICE Service, DWORD argc, LPWSTR *argv) Group->ServicesRunning = TRUE; } } -#if 0 else { - switch (Service->ErrorControl) + if (Service->dwErrorControl != SERVICE_ERROR_IGNORE) { - case SERVICE_ERROR_NORMAL: - /* FIXME: Log error */ - break; + ErrorLogStrings[0] = Service->lpServiceName; + ErrorLogStrings[1] = L"Test"; + ScmLogError(EVENT_SERVICE_START_FAILED, + 2, + ErrorLogStrings); + } +#if 0 + switch (Service->dwErrorControl) + { case SERVICE_ERROR_SEVERE: if (IsLastKnownGood == FALSE) { @@ -1115,8 +1266,8 @@ ScmStartService(PSERVICE Service, DWORD argc, LPWSTR *argv) } break; } - } #endif + } return dwError; } @@ -1129,15 +1280,77 @@ ScmAutoStartServices(VOID) PLIST_ENTRY ServiceEntry; PSERVICE_GROUP CurrentGroup; PSERVICE CurrentService; + WCHAR szSafeBootServicePath[MAX_PATH]; + DWORD dwError; + HKEY hKey; ULONG i; - /* Clear 'ServiceVisited' flag */ + /* Clear 'ServiceVisited' flag (or set if not to start in Safe Mode) */ ServiceEntry = ServiceListHead.Flink; while (ServiceEntry != &ServiceListHead) { - CurrentService = CONTAINING_RECORD(ServiceEntry, SERVICE, ServiceListEntry); - CurrentService->ServiceVisited = FALSE; - ServiceEntry = ServiceEntry->Flink; + CurrentService = CONTAINING_RECORD(ServiceEntry, SERVICE, ServiceListEntry); + + /* Build the safe boot path */ + wcscpy(szSafeBootServicePath, + L"SYSTEM\\CurrentControlSet\\Control\\SafeBoot"); + + switch (GetSystemMetrics(SM_CLEANBOOT)) + { + /* NOTE: Assumes MINIMAL (1) and DSREPAIR (3) load same items */ + case 1: + case 3: + wcscat(szSafeBootServicePath, L"\\Minimal\\"); + break; + + case 2: + wcscat(szSafeBootServicePath, L"\\Network\\"); + break; + } + + if (GetSystemMetrics(SM_CLEANBOOT)) + { + /* If key does not exist then do not assume safe mode */ + dwError = RegOpenKeyExW(HKEY_LOCAL_MACHINE, + szSafeBootServicePath, + 0, + KEY_READ, + &hKey); + if (dwError == ERROR_SUCCESS) + { + RegCloseKey(hKey); + + /* Finish Safe Boot path off */ + wcsncat(szSafeBootServicePath, + CurrentService->lpServiceName, + MAX_PATH - wcslen(szSafeBootServicePath)); + + /* Check that the key is in the Safe Boot path */ + dwError = RegOpenKeyExW(HKEY_LOCAL_MACHINE, + szSafeBootServicePath, + 0, + KEY_READ, + &hKey); + if (dwError != ERROR_SUCCESS) + { + /* Mark service as visited so it is not auto-started */ + CurrentService->ServiceVisited = TRUE; + } + else + { + /* Must be auto-started in safe mode - mark as unvisited */ + RegCloseKey(hKey); + CurrentService->ServiceVisited = FALSE; + } + } + else + { + DPRINT1("WARNING: Could not open the associated Safe Boot key!"); + CurrentService->ServiceVisited = FALSE; + } + } + + ServiceEntry = ServiceEntry->Flink; } /* Start all services which are members of an existing group */ @@ -1242,6 +1455,9 @@ ScmAutoShutdownServices(VOID) DPRINT("ScmAutoShutdownServices() called\n"); + /* Lock the service database exclusively */ + ScmLockDatabaseExclusive(); + ServiceEntry = ServiceListHead.Flink; while (ServiceEntry != &ServiceListHead) { @@ -1251,13 +1467,17 @@ ScmAutoShutdownServices(VOID) CurrentService->Status.dwCurrentState == SERVICE_START_PENDING) { /* shutdown service */ - ScmControlService(CurrentService, SERVICE_CONTROL_STOP); + DPRINT("Shutdown service: %S\n", CurrentService->szServiceName); + ScmControlService(CurrentService, SERVICE_CONTROL_SHUTDOWN); } ServiceEntry = ServiceEntry->Flink; } - DPRINT("ScmGetBootAndSystemDriverState() done\n"); + /* Unlock the service database */ + ScmUnlockDatabase(); + + DPRINT("ScmAutoShutdownServices() done\n"); } diff --git a/base/system/services/rpcserver.c b/base/system/services/rpcserver.c index 8e5da237f53..6f909a28622 100644 --- a/base/system/services/rpcserver.c +++ b/base/system/services/rpcserver.c @@ -91,7 +91,7 @@ static GENERIC_MAPPING ScmServiceMapping = {SERVICE_READ, SERVICE_WRITE, SERVICE_EXECUTE, - SC_MANAGER_ALL_ACCESS}; + SERVICE_ALL_ACCESS}; /* FUNCTIONS ***************************************************************/ @@ -586,7 +586,7 @@ DWORD RControlService( lpService = hSvc->ServiceEntry; if (lpService == NULL) { - DPRINT1("lpService == NULL!\n"); + DPRINT1("lpService == NULL!\n"); return ERROR_INVALID_HANDLE; } @@ -723,15 +723,6 @@ DWORD RControlService( if ((dwError == ERROR_SUCCESS) && (pcbBytesNeeded)) dwError = ERROR_DEPENDENT_SERVICES_RUNNING; - if (dwError == ERROR_SUCCESS && - dwControl == SERVICE_CONTROL_STOP && - lpServiceStatus->dwCurrentState == SERVICE_STOPPED) - { - lpService->ProcessId = 0; /* FIXME */ - lpService->ThreadId = 0; - } - - return dwError; } @@ -982,7 +973,7 @@ DWORD RSetServiceObjectSecurity( TRUE, &hToken); if (!NT_SUCCESS(Status)) - return RtlNtStatusToDosError(Status); + return RtlNtStatusToDosError(Status); RpcRevertToSelf(); @@ -1181,8 +1172,11 @@ DWORD RNotifyBootConfigStatus( SVCCTL_HANDLEW lpMachineName, DWORD BootAcceptable) { - UNIMPLEMENTED; - return ERROR_CALL_NOT_IMPLEMENTED; + DPRINT1("RNotifyBootConfigStatus(%p %lu) called\n", lpMachineName, BootAcceptable); + return ERROR_SUCCESS; + +// UNIMPLEMENTED; +// return ERROR_CALL_NOT_IMPLEMENTED; } @@ -1608,7 +1602,7 @@ ScmConvertToBootPathName(wchar_t *CanonName, wchar_t **RelativeName) } /* Do a real query now */ - LinkTarget.Length = BufferSize; + LinkTarget.Length = (USHORT)BufferSize; LinkTarget.MaximumLength = LinkTarget.Length + sizeof(WCHAR); Status = NtQuerySymbolicLinkObject(SymbolicLinkHandle, &LinkTarget, &BufferSize); @@ -1898,9 +1892,15 @@ DWORD RCreateServiceW( return ERROR_INVALID_PARAMETER; } + /* Lock the service database exclusively */ + ScmLockDatabaseExclusive(); + lpService = ScmGetServiceEntryByName(lpServiceName); if (lpService) { + /* Unlock the service database */ + ScmUnlockDatabase(); + /* check if it is marked for deletion */ if (lpService->bDeleted) return ERROR_SERVICE_MARKED_FOR_DELETE; @@ -1910,7 +1910,12 @@ DWORD RCreateServiceW( if (lpDisplayName != NULL && ScmGetServiceEntryByDisplayName(lpDisplayName) != NULL) + { + /* Unlock the service database */ + ScmUnlockDatabase(); + return ERROR_DUPLICATE_SERVICE_NAME; + } if (dwServiceType & SERVICE_DRIVER) { @@ -1925,6 +1930,9 @@ DWORD RCreateServiceW( if (dwStartType == SERVICE_BOOT_START || dwStartType == SERVICE_SYSTEM_START) { + /* Unlock the service database */ + ScmUnlockDatabase(); + return ERROR_INVALID_PARAMETER; } } @@ -2113,6 +2121,9 @@ DWORD RCreateServiceW( DPRINT("CreateService - lpService->dwRefCount %u\n", lpService->dwRefCount); done:; + /* Unlock the service database */ + ScmUnlockDatabase(); + if (hServiceKey != NULL) RegCloseKey(hServiceKey); @@ -2480,7 +2491,7 @@ DWORD REnumServicesStatusW( dwRequiredSize += dwSize; } - if (dwError == 0) + if (dwError == 0) { *pcbBytesNeeded = 0; if (lpResumeHandle) *lpResumeHandle = 0; @@ -3694,7 +3705,7 @@ DWORD REnumServicesStatusA( lpStatusPtrA = (LPENUM_SERVICE_STATUSA)lpBuffer; lpStringPtrA = (LPSTR)((ULONG_PTR)lpBuffer + *lpServicesReturned * sizeof(ENUM_SERVICE_STATUSA)); - lpStringPtrW = (LPWSTR)((ULONG_PTR)lpStatusPtrW + + lpStringPtrW = (LPWSTR)((ULONG_PTR)lpStatusPtrW + *lpServicesReturned * sizeof(ENUM_SERVICE_STATUSW)); for (dwServiceCount = 0; dwServiceCount < *lpServicesReturned; dwServiceCount++) @@ -4775,7 +4786,7 @@ DWORD RQueryServiceConfig2W( goto done; } - lpFailureActions->cActions = 0; + lpFailureActions->cActions = 0; lpFailureActions->dwResetPeriod = 0; lpFailureActions->lpCommand = NULL; lpFailureActions->lpRebootMsg = NULL; @@ -4877,7 +4888,7 @@ DWORD RQueryServiceStatusEx( &lpService->Status, sizeof(SERVICE_STATUS)); - lpStatus->dwProcessId = lpService->ProcessId; /* FIXME */ + lpStatus->dwProcessId = (lpService->lpImage != NULL) ? lpService->lpImage->dwProcessId : 0; /* FIXME */ lpStatus->dwServiceFlags = 0; /* FIXME */ /* Unlock the service database */ @@ -4955,7 +4966,7 @@ DWORD REnumServicesStatusExA( lpStatusPtrA = (LPENUM_SERVICE_STATUS_PROCESSA)lpBuffer; lpStringPtrA = (LPSTR)((ULONG_PTR)lpBuffer + *lpServicesReturned * sizeof(ENUM_SERVICE_STATUS_PROCESSA)); - lpStringPtrW = (LPWSTR)((ULONG_PTR)lpStatusPtrW + + lpStringPtrW = (LPWSTR)((ULONG_PTR)lpStatusPtrW + *lpServicesReturned * sizeof(ENUM_SERVICE_STATUS_PROCESSW)); for (dwServiceCount = 0; dwServiceCount < *lpServicesReturned; dwServiceCount++) @@ -5079,7 +5090,8 @@ DWORD REnumServicesStatusExW( if (lpResumeIndex) dwLastResumeCount = *lpResumeIndex; - /* FIXME: Lock the service list shared */ + /* Lock the service database shared */ + ScmLockDatabaseShared(); lpService = ScmGetServiceEntryByResumeCount(dwLastResumeCount); if (lpService == NULL) @@ -5261,7 +5273,8 @@ DWORD REnumServicesStatusExW( memcpy(&lpStatusPtr->ServiceStatusProcess, &CurrentService->Status, sizeof(SERVICE_STATUS)); - lpStatusPtr->ServiceStatusProcess.dwProcessId = CurrentService->ProcessId; /* FIXME */ + lpStatusPtr->ServiceStatusProcess.dwProcessId = + (CurrentService->lpImage != NULL) ? CurrentService->lpImage->dwProcessId : 0; /* FIXME */ lpStatusPtr->ServiceStatusProcess.dwServiceFlags = 0; /* FIXME */ lpStatusPtr++; @@ -5273,7 +5286,7 @@ DWORD REnumServicesStatusExW( } } - if (dwError == 0) + if (dwError == 0) { *pcbBytesNeeded = 0; if (lpResumeIndex) @@ -5281,7 +5294,8 @@ DWORD REnumServicesStatusExW( } Done:; - /* FIXME: Unlock the service list */ + /* Unlock the service database */ + ScmUnlockDatabase(); DPRINT("REnumServicesStatusExW() done (Error %lu)\n", dwError); diff --git a/base/system/services/services.c b/base/system/services/services.c index e5a00411259..0c213d38f63 100644 --- a/base/system/services/services.c +++ b/base/system/services/services.c @@ -47,6 +47,38 @@ PrintString(LPCSTR fmt, ...) } +VOID +ScmLogError(DWORD dwEventId, + WORD wStrings, + LPCWSTR *lpStrings) +{ + HANDLE hLog; + + hLog = RegisterEventSourceW(NULL, + L"Service Control Manager"); + if (hLog == NULL) + { + DPRINT1("ScmLogEvent: RegisterEventSourceW failed %d\n", GetLastError()); + return; + } + + if (!ReportEventW(hLog, + EVENTLOG_ERROR_TYPE, + 0, + dwEventId, + NULL, // Sid, + wStrings, + 0, + lpStrings, + NULL)) + { + DPRINT1("ScmLogEvent: ReportEventW failed %d\n", GetLastError()); + } + + DeregisterEventSource(hLog); +} + + BOOL ScmCreateStartEvent(PHANDLE StartEvent) { diff --git a/base/system/services/services.h b/base/system/services/services.h index 673edbf115d..210f8db5219 100644 --- a/base/system/services/services.h +++ b/base/system/services/services.h @@ -5,8 +5,11 @@ #include #define WIN32_NO_STATUS #include +#include #define NTOS_MODE_USER -#include +#include +#include +#include #include @@ -26,8 +29,14 @@ typedef struct _SERVICE_GROUP typedef struct _SERVICE_IMAGE { - DWORD dwServiceRefCount; // Number of running services of this image - DWORD Dummy; + LIST_ENTRY ImageListEntry; + DWORD dwImageRunCount; + + HANDLE hControlPipe; + HANDLE hProcess; + DWORD dwProcessId; + + WCHAR szImagePath[1]; } SERVICE_IMAGE, *PSERVICE_IMAGE; @@ -53,10 +62,6 @@ typedef struct _SERVICE BOOLEAN ServiceVisited; - HANDLE ControlPipeHandle; - ULONG ProcessId; - ULONG ThreadId; - WCHAR szServiceName[1]; } SERVICE, *PSERVICE; @@ -65,6 +70,7 @@ typedef struct _SERVICE extern LIST_ENTRY ServiceListHead; extern LIST_ENTRY GroupListHead; +extern LIST_ENTRY ImageListHead; extern BOOL ScmShutdown; @@ -151,6 +157,9 @@ VOID ScmStartRpcServer(VOID); /* services.c */ VOID PrintString(LPCSTR fmt, ...); +VOID ScmLogError(DWORD dwEventId, + WORD wStrings, + LPCWSTR *lpStrings); /* EOF */ diff --git a/base/system/smss/CMakeLists.txt b/base/system/smss/CMakeLists.txt index d6c7b99873b..8c3b553e17c 100644 --- a/base/system/smss/CMakeLists.txt +++ b/base/system/smss/CMakeLists.txt @@ -23,15 +23,14 @@ list(APPEND SOURCE smss.c smss.rc) -add_executable(smss WIN32 ${CMAKE_CURRENT_BINARY_DIR}/smss_smss.h.gch ${SOURCE}) +add_executable(smss WIN32 ${SOURCE}) target_link_libraries(smss nt smlib) if(MSVC) - target_link_libraries(smss msvcsup) set_entrypoint(smss DllMainCRTStartup) endif() -add_pch(smss ${CMAKE_CURRENT_SOURCE_DIR}/smss.h ${SOURCE}) +add_pch(smss smss.h) set_module_type(smss nativecui) add_importlibs(smss ntdll) diff --git a/base/system/smss/initpage.c b/base/system/smss/initpage.c index 7ec19985463..31bef7c975b 100644 --- a/base/system/smss/initpage.c +++ b/base/system/smss/initpage.c @@ -189,7 +189,7 @@ SmpPagingFilesQueryRoutine(PWSTR ValueName, if (InitialSize.QuadPart > GIGABYTE) { InitialSize.QuadPart = GIGABYTE; - MaximumSize.QuadPart = GIGABYTE * 1.5; + MaximumSize.QuadPart = (ULONGLONG)GIGABYTE * 3 / 2; } } diff --git a/base/system/smss/smss.h b/base/system/smss/smss.h index 61f3b4bead4..f0fff9b48b5 100644 --- a/base/system/smss/smss.h +++ b/base/system/smss/smss.h @@ -6,7 +6,16 @@ #define WIN32_NO_STATUS #include #define NTOS_MODE_USER -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include diff --git a/base/system/subst/CMakeLists.txt b/base/system/subst/CMakeLists.txt index 4319b5e9b34..6b9c5828f74 100644 --- a/base/system/subst/CMakeLists.txt +++ b/base/system/subst/CMakeLists.txt @@ -1,9 +1,6 @@ -include_directories(.) set_rc_compiler() -add_definitions(-D_DLL -D__USE_CRTIMP) - add_executable(subst subst.c subst.rc) set_module_type(subst win32cui) diff --git a/base/system/subst/lang/uk-UA.rc b/base/system/subst/lang/uk-UA.rc new file mode 100644 index 00000000000..ec4f18afa2f --- /dev/null +++ b/base/system/subst/lang/uk-UA.rc @@ -0,0 +1,27 @@ +/* + * PROJECT: ReactOS subst + * LICENSE: GPL - See COPYING in the top level directory + * FILE: base/system/subst/lang/uk-UA.rc + * PURPOSE: Ukraianian Language File for subst + * TRANSLATOR: Igor Paliychuk + */ + +#include "resource.h" + +LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT + +STRINGTABLE +BEGIN + IDS_INCORRECT_PARAMETER_COUNT "Невірна кількість параметрів - %s\n" + IDS_INVALID_PARAMETER "Невірна кількість параметрів - %s\n" + IDS_INVALID_PARAMETER2 "Невірний параметр - %s\n" + IDS_DRIVE_ALREAD_SUBSTED "До диску вже застосовано SUBST\n" + IDS_FAILED_WITH_ERROCODE "Невдача з кодом помилки 0x%x: %s\n" + IDS_USAGE "Асоціює шлях з буквою диску.\n\n\ +SUBST [диск1: [диск2:]шлях]\n\ +SUBST диск1: /D\n\n\ + диск1: Визначає віртуальний диск, на який ви хочете призначити шлях.\n\ + [диск2:]шлях Визначає фізичний диск та шлях, який ви хочете призначити\n для віртуального диску.\n\ + /D Видаляє підставлений (віртуальний) диск.\n\n\ +Введіть SUBST без параметрів для відображення списку поточних віртуальних дисків.\n" +END diff --git a/base/system/subst/rsrc.rc b/base/system/subst/rsrc.rc index db6207f95cc..46064e12d0e 100644 --- a/base/system/subst/rsrc.rc +++ b/base/system/subst/rsrc.rc @@ -10,3 +10,4 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL // UTF-8 #pragma code_page(65001) #include "lang/pl-PL.rc" +#include "lang/uk-UA.rc" diff --git a/base/system/userinit/lang/ru-RU.rc b/base/system/userinit/lang/ru-RU.rc index 063e6c1e638..aa3cf68ac51 100644 --- a/base/system/userinit/lang/ru-RU.rc +++ b/base/system/userinit/lang/ru-RU.rc @@ -7,6 +7,6 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT STRINGTABLE DISCARDABLE BEGIN -STRING_USERINIT_FAIL, " !\n" +STRING_USERINIT_FAIL, "Ошибка запуска оболочки при инициализации пользовательского сеанса!\n" END diff --git a/base/system/userinit/lang/uk-UA.rc b/base/system/userinit/lang/uk-UA.rc index b6d13dc368f..e6da517ae8e 100644 --- a/base/system/userinit/lang/uk-UA.rc +++ b/base/system/userinit/lang/uk-UA.rc @@ -13,6 +13,6 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT STRINGTABLE DISCARDABLE BEGIN -STRING_USERINIT_FAIL, "Userinit !\n" +STRING_USERINIT_FAIL, "Userinit не вдалося запустити оболонку!\n" END diff --git a/base/system/userinit/rsrc.rc b/base/system/userinit/rsrc.rc index 15e932156c3..30dab068320 100644 --- a/base/system/userinit/rsrc.rc +++ b/base/system/userinit/rsrc.rc @@ -19,12 +19,12 @@ LANGUAGE LANG_NEUTRAL,SUBLANG_NEUTRAL #include "lang/nl-NL.rc" #include "lang/no-NO.rc" #include "lang/pt-BR.rc" -#include "lang/ru-RU.rc" #include "lang/sk-SK.rc" #include "lang/sv-SE.rc" #include "lang/th-TH.rc" -#include "lang/uk-UA.rc" // UTF-8 #pragma code_page(65001) #include "lang/pl-PL.rc" +#include "lang/ru-RU.rc" +#include "lang/uk-UA.rc" diff --git a/base/system/userinit/userinit.c b/base/system/userinit/userinit.c index 81027d4b964..6dbf1bb6c34 100644 --- a/base/system/userinit/userinit.c +++ b/base/system/userinit/userinit.c @@ -274,9 +274,70 @@ VOID StartShell(VOID) { WCHAR Shell[MAX_PATH]; TCHAR szMsg[RC_STRING_MAX_SIZE]; + DWORD Type, Size; + DWORD Value = 0; + LONG rc; + HKEY hKey; TRACE("()\n"); + /* Safe Mode shell run */ + rc = RegOpenKeyExW(HKEY_LOCAL_MACHINE, + L"SYSTEM\\CurrentControlSet\\Control\\SafeBoot\\Option", + 0, KEY_QUERY_VALUE, &hKey); + if(rc == ERROR_SUCCESS) + { + Size = sizeof(Value); + rc = RegQueryValueExW(hKey, L"UseAlternateShell", NULL, + &Type, (LPBYTE)&Value, &Size); + if(rc == ERROR_SUCCESS) + { + RegCloseKey(hKey); + if(Type == REG_DWORD) + { + if(Value) + { + /* Safe Mode Alternate Shell required */ + rc = RegOpenKeyExW(HKEY_LOCAL_MACHINE, + L"SYSTEM\\CurrentControlSet\\Control\\SafeBoot", + 0, KEY_READ, &hKey); + if(rc == ERROR_SUCCESS) + { + Size = MAX_PATH * sizeof(WCHAR); + rc = RegQueryValueExW(hKey, L"AlternateShell", NULL, + &Type, (LPBYTE)Shell, &Size); + if(rc == ERROR_SUCCESS) + { + RegCloseKey(hKey); + if ((Type == REG_SZ) || (Type == REG_EXPAND_SZ)) + { + TRACE("Key located - %s\n", debugstr_w(Shell)); + /* Try to run alternate shell */ + if (TryToStartShell(Shell)) + { + TRACE("Alternate shell started (Safe Mode)\n"); + return; + } + } + else + { + WARN("Wrong type %lu (expected %u or %u)\n", + Type, REG_SZ, REG_EXPAND_SZ); + } + } + else + { + WARN("Alternate shell in Safe Mode required but not specified."); + } + } + } + } + else + { + WARN("Wrong type %lu (expected %u)\n", Type, REG_DWORD); + } + } + } /* Try to run shell in user key */ if (GetShell(Shell, HKEY_CURRENT_USER) && TryToStartShell(Shell)) { diff --git a/base/system/winlogon/CMakeLists.txt b/base/system/winlogon/CMakeLists.txt index 945de9935fa..99bee9d970e 100644 --- a/base/system/winlogon/CMakeLists.txt +++ b/base/system/winlogon/CMakeLists.txt @@ -8,12 +8,11 @@ list(APPEND SOURCE wlx.c winlogon.rc) -add_executable(winlogon ${CMAKE_CURRENT_BINARY_DIR}/winlogon_winlogon.h.gch ${SOURCE}) +add_executable(winlogon ${SOURCE}) target_link_libraries(winlogon wine) -add_pch(winlogon ${CMAKE_CURRENT_SOURCE_DIR}/winlogon.h ${SOURCE}) - set_module_type(winlogon win32gui) add_importlibs(winlogon user32 advapi32 userenv secur32 msvcrt kernel32 ntdll) +add_pch(winlogon winlogon.h) add_cd_file(TARGET winlogon DESTINATION reactos/system32 FOR all) diff --git a/base/system/winlogon/lang/ro-RO.rc b/base/system/winlogon/lang/ro-RO.rc index 5e754d609f7..3c8aa4cb575 100644 --- a/base/system/winlogon/lang/ro-RO.rc +++ b/base/system/winlogon/lang/ro-RO.rc @@ -1,7 +1,5 @@ LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL -#pragma code_page(65001) - IDD_SHUTDOWNCOMPUTER DIALOGEX 45, 22, 164, 52 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Oprire computer" @@ -44,5 +42,3 @@ STRINGTABLE BEGIN IDS_FAILEDACTIVATEUSERSHELL "Winlogon nu a putut porni nucleul sistemului!" END - -#pragma code_page(default) diff --git a/base/system/winlogon/lang/ru-RU.rc b/base/system/winlogon/lang/ru-RU.rc index 8eeb400ea58..b79a032b255 100644 --- a/base/system/winlogon/lang/ru-RU.rc +++ b/base/system/winlogon/lang/ru-RU.rc @@ -2,44 +2,44 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT IDD_SHUTDOWNCOMPUTER DIALOGEX 45, 22, 164, 52 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Выключение компьютера" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " .", IDC_SHUTDOWNCOMPUTER, 31, 13, 132, 8 + LTEXT "Теперь можно безопасно выключить компьютер.", IDC_SHUTDOWNCOMPUTER, 31, 13, 132, 8 ICON IDI_WINLOGON, IDC_SHTDOWNICON, 6, 7, 18, 20 - DEFPUSHBUTTON "&", IDC_BTNSHTDOWNCOMPUTER, 62, 32, 40, 14 + DEFPUSHBUTTON "&Перезагрузка", IDC_BTNSHTDOWNCOMPUTER, 62, 32, 40, 14 END IDD_GINALOADFAILED DIALOGEX 58, 83, 231, 119 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Ошибка загрузки интерфейса" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " DLL- %s.", IDC_GINALOADFAILED, 39, 16, 156, 24 - LTEXT " , DLL.", IDC_GINALOADFAILEDCONTACT, 39, 53, 151, 25 - DEFPUSHBUTTON "&", 1, 80, 91, 68, 14 + LTEXT "Невозможно загрузить DLL-библиотеку %s.", IDC_GINALOADFAILED, 39, 16, 156, 24 + LTEXT "Свяжитесь с системным администратором, чтобы заменить или восстановить оригинальный файл DLL.", IDC_GINALOADFAILEDCONTACT, 39, 53, 151, 25 + DEFPUSHBUTTON "&Перезагрузка", 1, 80, 91, 68, 14 END STRINGTABLE BEGIN - IDS_PREPARENETWORKCONNECTIONS " ..." - IDS_APPLYINGCOMPUTERSETTINGS " ..." - IDS_RUNNINGSTARTUPSCRIPTS " ..." - IDS_RUNNINGSHUTDOWNSCRIPTS " ..." - IDS_APPLYINGYOURPERSONALSETTINGS " ..." - IDS_RUNNINGLOGOFFSCRIPTS " ..." - IDS_RUNNINGLOGONSCRIPTS " ..." - IDS_LOADINGYOURPERSONALSETTINGS " ..." - IDS_CLOSINGNETWORKCONNECTIONS " ..." - IDS_REACTOSISSHUTTINGDOWN "ReactOS .." - IDS_PREPARETOSTANDBY " ..." - IDS_PREPARETOHIBERNATE " ..." - IDS_SAVEYOURSETTINGS " ..." - IDS_REACTOSISSTARTINGUP "ReactOS ..." + IDS_PREPARENETWORKCONNECTIONS "Подготавливаются сетевые подключения..." + IDS_APPLYINGCOMPUTERSETTINGS "Применяются настройки..." + IDS_RUNNINGSTARTUPSCRIPTS "Выполняются скрипты автозапуска..." + IDS_RUNNINGSHUTDOWNSCRIPTS "Выполняются скрипты выключения..." + IDS_APPLYINGYOURPERSONALSETTINGS "Применяются ваши персональные настройки..." + IDS_RUNNINGLOGOFFSCRIPTS "Выполняются скрипты выхода из системы..." + IDS_RUNNINGLOGONSCRIPTS "Выполняются скрипты входа в систему..." + IDS_LOADINGYOURPERSONALSETTINGS "Загружаются персональные настройки..." + IDS_CLOSINGNETWORKCONNECTIONS "Отключаются сетевые соединения..." + IDS_REACTOSISSHUTTINGDOWN "ReactOS завершает работу.." + IDS_PREPARETOSTANDBY "Подготовка к переходу в режим ожидания..." + IDS_PREPARETOHIBERNATE "Подготовка к переходу в спящий режим..." + IDS_SAVEYOURSETTINGS "Сохраняются настройки..." + IDS_REACTOSISSTARTINGUP "ReactOS загружается..." END STRINGTABLE BEGIN - IDS_FAILEDACTIVATEUSERSHELL "Winlogon !" + IDS_FAILEDACTIVATEUSERSHELL "Winlogon не может активировать пользовательский интерфейс!" END diff --git a/base/system/winlogon/lang/uk-UA.rc b/base/system/winlogon/lang/uk-UA.rc index 752f95d5989..cf1100d0861 100644 --- a/base/system/winlogon/lang/uk-UA.rc +++ b/base/system/winlogon/lang/uk-UA.rc @@ -2,44 +2,44 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT IDD_SHUTDOWNCOMPUTER DIALOGEX 45, 22, 164, 52 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " '" +CAPTION "Завершення роботи з комп'ютером" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " '.", IDC_SHUTDOWNCOMPUTER, 31, 13, 132, 8 + LTEXT "Тепер можна вимкнути комп'ютер.", IDC_SHUTDOWNCOMPUTER, 31, 13, 132, 8 ICON IDI_WINLOGON, IDC_SHTDOWNICON, 6, 7, 18, 20 - DEFPUSHBUTTON "&", IDC_BTNSHTDOWNCOMPUTER, 62, 32, 40, 14 + DEFPUSHBUTTON "&Перезавантаження", IDC_BTNSHTDOWNCOMPUTER, 62, 32, 40, 14 END IDD_GINALOADFAILED DIALOGEX 58, 83, 231, 119 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Помилка інтерфейсу користувача" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " %s.", IDC_GINALOADFAILED, 39, 16, 156, 24 - LTEXT " , .", IDC_GINALOADFAILEDCONTACT, 39, 53, 151, 25 - DEFPUSHBUTTON "&", 1, 80, 91, 68, 14 + LTEXT "Не вдалося завантажити бібліотеку інтерфейсу входу користувача %s.", IDC_GINALOADFAILED, 39, 16, 156, 24 + LTEXT "Зверніться до системного адміністратора щоб замінити наявну, або відновіть початкову бібліотеку.", IDC_GINALOADFAILEDCONTACT, 39, 53, 151, 25 + DEFPUSHBUTTON "&Перезавантаження", 1, 80, 91, 68, 14 END STRINGTABLE BEGIN - IDS_PREPARENETWORKCONNECTIONS "ϳ ..." - IDS_APPLYINGCOMPUTERSETTINGS " '..." - IDS_RUNNINGSTARTUPSCRIPTS " ..." - IDS_RUNNINGSHUTDOWNSCRIPTS " ..." - IDS_APPLYINGYOURPERSONALSETTINGS " ..." - IDS_RUNNINGLOGOFFSCRIPTS " ..." - IDS_RUNNINGLOGONSCRIPTS " ..." - IDS_LOADINGYOURPERSONALSETTINGS " ..." - IDS_CLOSINGNETWORKCONNECTIONS " ..." - IDS_REACTOSISSHUTTINGDOWN " ReactOS..." - IDS_PREPARETOSTANDBY "ϳ ..." - IDS_PREPARETOHIBERNATE "ϳ ..." - IDS_SAVEYOURSETTINGS " ..." - IDS_REACTOSISSTARTINGUP " ReactOS..." + IDS_PREPARENETWORKCONNECTIONS "Підготовка мережних підключень..." + IDS_APPLYINGCOMPUTERSETTINGS "Застосування параметрів комп'ютера..." + IDS_RUNNINGSTARTUPSCRIPTS "Виконання сценаріїв запуску..." + IDS_RUNNINGSHUTDOWNSCRIPTS "Виконання сценаріїв завершення роботи..." + IDS_APPLYINGYOURPERSONALSETTINGS "Застосування особистих параметрів..." + IDS_RUNNINGLOGOFFSCRIPTS "Виконання сценаріїв виходу із системи..." + IDS_RUNNINGLOGONSCRIPTS "Виконання сценаріїв входу до системи..." + IDS_LOADINGYOURPERSONALSETTINGS "Завантаження особистих параметрів..." + IDS_CLOSINGNETWORKCONNECTIONS "Закриття мережних підключень..." + IDS_REACTOSISSHUTTINGDOWN "Завершення роботи ReactOS..." + IDS_PREPARETOSTANDBY "Підготовка до режиму очікування..." + IDS_PREPARETOHIBERNATE "Підготовка до сплячого режиму..." + IDS_SAVEYOURSETTINGS "Збереження параметрів..." + IDS_REACTOSISSTARTINGUP "Запуск ReactOS..." END STRINGTABLE BEGIN - IDS_FAILEDACTIVATEUSERSHELL "Winlogon !" + IDS_FAILEDACTIVATEUSERSHELL "Winlogon не вдалося активувати оболонку користувача!" END diff --git a/base/system/winlogon/rsrc.rc b/base/system/winlogon/rsrc.rc index e334cab3e1f..c13a26b29e0 100644 --- a/base/system/winlogon/rsrc.rc +++ b/base/system/winlogon/rsrc.rc @@ -19,13 +19,13 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL #include "lang/lt-LT.rc" #include "lang/no-NO.rc" #include "lang/nl-NL.rc" -#include "lang/ro-RO.rc" -#include "lang/ru-RU.rc" #include "lang/sv-SE.rc" #include "lang/sk-SK.rc" -#include "lang/uk-UA.rc" #include "lang/zh-CN.rc" // UTF-8 #pragma code_page(65001) #include "lang/pl-PL.rc" +#include "lang/ro-RO.rc" +#include "lang/ru-RU.rc" +#include "lang/uk-UA.rc" diff --git a/base/system/winlogon/sas.c b/base/system/winlogon/sas.c index 11035c16d4e..3731a3588c6 100644 --- a/base/system/winlogon/sas.c +++ b/base/system/winlogon/sas.c @@ -25,6 +25,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(winlogon); #define HK_CTRL_ALT_DEL 0 #define HK_CTRL_SHIFT_ESC 1 +static BOOL inScrn = FALSE; + /* FUNCTIONS ****************************************************************/ static BOOL @@ -962,6 +964,28 @@ SASWindowProc( } break; } + case LN_START_SCREENSAVE: + { + BOOL bSecure = FALSE; + + if (inScrn) + break; + + inScrn = TRUE; + + // lParam 1 == Secure + if (lParam) + { + if (Session->Gina.Functions.WlxScreenSaverNotify(Session->Gina.Context, &bSecure)) + { + if (bSecure) DoGenericAction(Session, WLX_SAS_ACTION_LOCK_WKSTA); + } + } + + StartScreenSaver(Session); + inScrn = FALSE; + break; + } default: { ERR("WM_LOGONNOTIFY case %d is unimplemented\n", wParam); diff --git a/base/system/winlogon/screensaver.c b/base/system/winlogon/screensaver.c index 17423e58f37..ba3e8d04f2a 100644 --- a/base/system/winlogon/screensaver.c +++ b/base/system/winlogon/screensaver.c @@ -231,7 +231,7 @@ InitializeScreenSaver( if (ScreenSaverThread) CloseHandle(ScreenSaverThread); else - WARN("WL: Unable to start screen saver thread\n"); + ERR("WL: Unable to start screen saver thread\n"); return TRUE; } @@ -240,7 +240,7 @@ VOID StartScreenSaver( IN PWLSESSION Session) { - HKEY hKey = NULL; + HKEY hKey = NULL, hCurrentUser = NULL; WCHAR szApplicationName[MAX_PATH]; WCHAR szCommandLine[MAX_PATH + 3]; DWORD bufferSize = sizeof(szApplicationName) - sizeof(WCHAR); @@ -254,18 +254,30 @@ StartScreenSaver( if (!ImpersonateLoggedOnUser(Session->UserToken)) { - ERR("ImpersonateLoggedOnUser() failed with error %lu\n", GetLastError()); + ERR("WL: ImpersonateLoggedOnUser() failed with error %lu\n", GetLastError()); + goto cleanup; + } + + rc = RegOpenCurrentUser( + KEY_READ, + &hCurrentUser); + if (rc != ERROR_SUCCESS) + { + ERR("WL: RegOpenCurrentUser Error!\n"); goto cleanup; } rc = RegOpenKeyExW( - HKEY_CURRENT_USER, + hCurrentUser, L"Control Panel\\Desktop", 0, KEY_QUERY_VALUE, &hKey); if (rc != ERROR_SUCCESS) + { + ERR("WL: RegOpenKeyEx Error!\n"); goto cleanup; + } rc = RegQueryValueExW( hKey, @@ -275,15 +287,24 @@ StartScreenSaver( (LPBYTE)szApplicationName, &bufferSize); if (rc != ERROR_SUCCESS || dwType != REG_SZ) + { + ERR("WL: RegQueryValueEx Error!\n"); goto cleanup; + } if (bufferSize == 0) + { + ERR("WL: Buffer size is NULL!\n"); goto cleanup; + } szApplicationName[bufferSize / sizeof(WCHAR)] = 0; /* Terminate the string */ if (wcslen(szApplicationName) == 0) + { + ERR("WL: Application Name length is zero!\n"); goto cleanup; + } wsprintfW(szCommandLine, L"%s /s", szApplicationName); TRACE("WL: Executing %S\n", szCommandLine); @@ -291,6 +312,7 @@ StartScreenSaver( ZeroMemory(&StartupInfo, sizeof(STARTUPINFOW)); ZeroMemory(&ProcessInformation, sizeof(PROCESS_INFORMATION)); StartupInfo.cb = sizeof(STARTUPINFOW); + StartupInfo.dwFlags = STARTF_SCRNSAVER; /* FIXME: run the screen saver on the screen saver desktop */ ret = CreateProcessW( szApplicationName, @@ -305,7 +327,7 @@ StartScreenSaver( &ProcessInformation); if (!ret) { - WARN("WL: Unable to start %S, error %lu\n", szApplicationName, GetLastError()); + ERR("WL: Unable to start %S, error %lu\n", szApplicationName, GetLastError()); goto cleanup; } CloseHandle(ProcessInformation.hThread); @@ -330,6 +352,8 @@ cleanup: RevertToSelf(); if (hKey) RegCloseKey(hKey); + if (hCurrentUser) + RegCloseKey(hCurrentUser); if (!ret) { PostMessageW(Session->SASWindow, WLX_WM_SAS, WLX_SAS_TYPE_SCRNSVR_ACTIVITY, 0); diff --git a/baseaddress.rbuild b/baseaddress.rbuild index 33a469acc6d..aa0f140acc3 100644 --- a/baseaddress.rbuild +++ b/baseaddress.rbuild @@ -12,6 +12,7 @@ + diff --git a/boot/CMakeLists.txt b/boot/CMakeLists.txt index 3ae611023f8..53aacd87f5f 100644 --- a/boot/CMakeLists.txt +++ b/boot/CMakeLists.txt @@ -7,6 +7,7 @@ add_custom_target(bootcd ${CMAKE_COMMAND} -D CD_DIR=${CMAKE_CURRENT_BINARY_DIR}/bootcd -P ${CMAKE_CURRENT_BINARY_DIR}/bootcd.cmake COMMAND native-cdmake -v -j -m -b ${CMAKE_CURRENT_BINARY_DIR}/freeldr/bootsect/isoboot.bin ${CMAKE_CURRENT_BINARY_DIR}/bootcd REACTOS ${REACTOS_BINARY_DIR}/bootcd.iso + DEPENDS native-cdmake VERBATIM) ##bootcdregtest @@ -18,6 +19,7 @@ add_custom_target(bootcdregtest ${CMAKE_COMMAND} -D CD_DIR=${CMAKE_CURRENT_BINARY_DIR}/bootcdregtest -P ${CMAKE_CURRENT_BINARY_DIR}/bootcdregtest.cmake COMMAND native-cdmake -v -j -m -b ${CMAKE_CURRENT_BINARY_DIR}/freeldr/bootsect/isobtrt.bin ${CMAKE_CURRENT_BINARY_DIR}/bootcdregtest REACTOS ${REACTOS_BINARY_DIR}/bootcdregtest.iso + DEPENDS native-cdmake VERBATIM) @@ -43,6 +45,7 @@ add_custom_target(livecd ${CMAKE_COMMAND} -D CD_DIR=${CMAKE_CURRENT_BINARY_DIR}/livecd -P ${CMAKE_CURRENT_BINARY_DIR}/livecd.cmake COMMAND native-cdmake -v -j -m -b ${CMAKE_CURRENT_BINARY_DIR}/freeldr/bootsect/isoboot.bin ${CMAKE_CURRENT_BINARY_DIR}/livecd REACTOS ${REACTOS_BINARY_DIR}/livecd.iso + DEPENDS native-cdmake VERBATIM) add_subdirectory(freeldr) diff --git a/boot/bootdata/bootcd.ini b/boot/bootdata/bootcd.ini index c0bbf70a9f2..46acdd31e3f 100644 --- a/boot/bootdata/bootcd.ini +++ b/boot/bootdata/bootcd.ini @@ -1,6 +1,6 @@ [FREELOADER] DefaultOS=Setup -Timeout=1 +Timeout=0 [Display] TitleText=ReactOS Setup @@ -21,10 +21,7 @@ SelectedColor=Gray [Operating Systems] Setup="Setup" -Setup_old="Setup (old boot method)" [Setup] BootType=ReactOSSetup2 -[Setup_old] -BootType=ReactOSSetup diff --git a/boot/bootdata/hivecls_i386.inf b/boot/bootdata/hivecls_i386.inf index 147f80d81de..4e53064dc58 100644 --- a/boot/bootdata/hivecls_i386.inf +++ b/boot/bootdata/hivecls_i386.inf @@ -318,6 +318,10 @@ HKCR,"CLSID\{4657278A-411B-11d2-839A-00C04FD918D0}","",0x00000000,"Shell Drag an HKCR,"CLSID\{4657278A-411B-11d2-839A-00C04FD918D0}\InProcServer32","",0x00020000,"%SystemRoot%\system32\shell32.dll" HKCR,"CLSID\{4657278A-411B-11d2-839A-00C04FD918D0}\InProcServer32","ThreadingModel",0x00000000,"Apartment" +HKCR,"CLSID\{4622AD11-FF23-11D0-8D34-00A0C90F2719}","",0x00000000,"Shell Start Menu" +HKCR,"CLSID\{4622AD11-FF23-11D0-8D34-00A0C90F2719}\InProcServer32","",0x00020000,"%SystemRoot%\system32\shell32.dll" +HKCR,"CLSID\{4622AD11-FF23-11D0-8D34-00A0C90F2719}\InProcServer32","ThreadingModel",0x00000000,"Apartment" + ; Folder Options CPL HKCR,"CLSID\{6DFD7C5C-2451-11d3-A299-00C04F8EF6AF}","",0x00000000,"Folder Options" HKCR,"CLSID\{6DFD7C5C-2451-11d3-A299-00C04F8EF6AF}","LocalizedString",0x00020000,"@%SystemRoot%\system32\shell32.dll,-150" diff --git a/boot/bootdata/hivedef_i386.inf b/boot/bootdata/hivedef_i386.inf index b62841ddcd2..8e7b8329673 100644 Binary files a/boot/bootdata/hivedef_i386.inf and b/boot/bootdata/hivedef_i386.inf differ diff --git a/boot/bootdata/hivesft_i386.inf b/boot/bootdata/hivesft_i386.inf index 0afe66659ee..95a72dc2d8f 100644 Binary files a/boot/bootdata/hivesft_i386.inf and b/boot/bootdata/hivesft_i386.inf differ diff --git a/boot/bootdata/hivesys_amd64.inf b/boot/bootdata/hivesys_amd64.inf index af890ec1b55..e3f8a5c5e42 100644 --- a/boot/bootdata/hivesys_amd64.inf +++ b/boot/bootdata/hivesys_amd64.inf @@ -8,6 +8,143 @@ HKLM,"SYSTEM\CurrentControlSet\Control","WaitToKillServiceTimeout",2,"20000" HKLM,"SYSTEM\CurrentControlSet\Control\Biosinfo","InfName",2,"biosinfo.inf" HKLM,"SYSTEM\CurrentControlSet\Control\PnP",,0x00000012 +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot","AlternateShell",2,"cmd.exe" + +; Safe Boot drivers +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\AppMgmt","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\Base","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\Boot Bus Extender","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\Boot file system","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\CryptSvc","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\DcomLaunch","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\dmadmin","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\dmboot.sys","",0x00000000,"Driver" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\dmio.sys","",0x00000000,"Driver" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\dmload.sys","",0x00000000,"Driver" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\dmserver","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\EventLog","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\File system","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\Filter","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\HelpSvc","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\Netlogon","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\PCI Configuration","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\PlugPlay","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\PNP Filter","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\Primary disk","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\RpcSs","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\SCSI Class","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\sermouse.sys","",0x00000000,"Driver" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\sr.sys","",0x00000000,"FSFilter System Recovery" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\SRService","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\System Bus Extender","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\vga.sys","",0x00000000,"Driver" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\vgasave.sys","",0x00000000,"Driver" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\WinMgmt","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\{36FC9E60-C465-11CF-8056-444553540000}","",0x00000000,"Universal Serial Bus controllers" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\{4D36E965-E325-11CE-BFC1-08002BE10318}","",0x00000000,"CD-ROM Drive" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\{4D36E967-E325-11CE-BFC1-08002BE10318}","",0x00000000,"DiskDrive" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\{4D36E969-E325-11CE-BFC1-08002BE10318}","",0x00000000,"Standard floppy disk controller" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\{4D36E96A-E325-11CE-BFC1-08002BE10318}","",0x00000000,"Hdc" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\{4D36E96B-E325-11CE-BFC1-08002BE10318}","",0x00000000,"Keyboard" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\{4D36E96F-E325-11CE-BFC1-08002BE10318}","",0x00000000,"Mouse" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\{4D36E977-E325-11CE-BFC1-08002BE10318}","",0x00000000,"PCMCIA Adapters" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\{4D36E97B-E325-11CE-BFC1-08002BE10318}","",0x00000000,"SCSIAdapter" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\{4D36E97D-E325-11CE-BFC1-08002BE10318}","",0x00000000,"System" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\{4D36E980-E325-11CE-BFC1-08002BE10318}","",0x00000000,"Floppy disk drive" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\{71A27CDD-812A-11D0-BEC7-08002BE2092F}","",0x00000000,"Volume" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\{745A17A0-74D3-11D0-B6FE-00A0C90F57DA}","",0x00000000,"Human Interface Devices" + +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\AFD","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\AppMgmt","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\Base","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\Boot Bus Extender","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\Boot file system","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\Browser","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\CryptSvc","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\DcomLaunch","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\Dhcp","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\dmadmin","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\dmboot.sys","",0x00000000,"Driver" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\dmio.sys","",0x00000000,"Driver" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\dmload.sys","",0x00000000,"Driver" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\dmserver","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\DnsCache","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\EventLog","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\File system","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\Filter","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\HelpSvc","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\ip6fw.sys","",0x00000000,"Driver" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\ipnat.sys","",0x00000000,"Driver" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\LanmanServer","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\LanmanWorkstation","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\LmHosts","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\Messenger","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\NDIS","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\NDIS Wrapper","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\Ndisuio","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\NetBIOS","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\NetBIOSGroup","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\NetBT","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\NetDDEGroup","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\Netlogon","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\NetMan","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\Network","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\NetworkProvider","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\NtLmSsp","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\PCI Configuration","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\PlugPlay","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\PNP Filter","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\PNP_TDI","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\Primary disk","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\rdpcdd.sys","",0x00000000,"Driver" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\rdpdd.sys","",0x00000000,"Driver" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\rdpwd.sys","",0x00000000,"Driver" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\rdsessmgr","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\RpcSs","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\SCSI Class","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\sermouse.sys","",0x00000000,"Driver" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\SharedAccess","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\sr.sys","",0x00000000,"FSFilter System Recovery" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\SRService","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\Streams Drivers","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\System Bus Extender","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\Tcpip","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\TDI","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\tdpipe.sys","",0x00000000,"Driver" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\tdtcp.sys","",0x00000000,"Driver" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\termservice","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\vga.sys","",0x00000000,"Driver" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\vgasave.sys","",0x00000000,"Driver" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\WinMgmt","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\WZCSVC","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\{36FC9E60-C465-11CF-8056-444553540000}","",0x00000000,"Universal Serial Bus controllers" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\{4D36E965-E325-11CE-BFC1-08002BE10318}","",0x00000000,"CD-ROM Drive" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\{4D36E967-E325-11CE-BFC1-08002BE10318}","",0x00000000,"DiskDrive" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\{4D36E969-E325-11CE-BFC1-08002BE10318}","",0x00000000,"Standard floppy disk controller" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\{4D36E96A-E325-11CE-BFC1-08002BE10318}","",0x00000000,"Hdc" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\{4D36E96B-E325-11CE-BFC1-08002BE10318}","",0x00000000,"Keyboard" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\{4D36E96F-E325-11CE-BFC1-08002BE10318}","",0x00000000,"Mouse" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}","",0x00000000,"Net" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\{4D36E973-E325-11CE-BFC1-08002BE10318}","",0x00000000,"NetClient" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\{4D36E974-E325-11CE-BFC1-08002BE10318}","",0x00000000,"NetService" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\{4D36E975-E325-11CE-BFC1-08002BE10318}","",0x00000000,"NetTrans" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\{4D36E977-E325-11CE-BFC1-08002BE10318}","",0x00000000,"PCMCIA Adapters" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\{4D36E97B-E325-11CE-BFC1-08002BE10318}","",0x00000000,"SCSIAdapter" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\{4D36E97D-E325-11CE-BFC1-08002BE10318}","",0x00000000,"System" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\{4D36E980-E325-11CE-BFC1-08002BE10318}","",0x00000000,"Floppy disk drive" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\{71A27CDD-812A-11D0-BEC7-08002BE2092F}","",0x00000000,"Volume" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\{745A17A0-74D3-11D0-B6FE-00A0C90F57DA}","",0x00000000,"Human Interface Devices" + +; ReactOS specific - required to load in Safe Mode and for debugging in Safe Mode (until vga.sys and vgasave.sys are implemented) +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\Debug","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\vgamp.sys","",0x00000000,"Driver" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\vbemp.sys","",0x00000000,"Driver" + +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\Debug","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\vgamp.sys","",0x00000000,"Driver" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\vbemp.sys","",0x00000000,"Driver" + +; Other HKLM,"SYSTEM\CurrentControlSet\Control\FileSystem","NtfsDisable8dot3NameCreation",0x00010003,0 HKLM,"SYSTEM\CurrentControlSet\Control\FileSystem","Win31FileSystem",0x00010001,0 HKLM,"SYSTEM\CurrentControlSet\Control\FileSystem","Win95TruncatedExtensions",0x00010001,1 @@ -482,68 +619,68 @@ HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E975-E325-11CE-BFC1-08002BE1 HKLM,"SYSTEM\CurrentControlSet\Control\NetworkProvider\Order","ProviderOrder",0x00000000,"" ; NLS Files -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","37",0x00000000,"c_037.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","424",0x00000000,"c_424.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","437",0x00000000,"c_437.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","500",0x00000000,"c_500.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","737",0x00000000,"c_737.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","775",0x00000000,"c_775.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","850",0x00000000,"c_850.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","852",0x00000000,"c_852.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","855",0x00000000,"c_855.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","856",0x00000000,"c_856.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","857",0x00000000,"c_857.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","860",0x00000000,"c_860.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","861",0x00000000,"c_861.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","862",0x00000000,"c_862.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","863",0x00000000,"c_863.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","864",0x00000000,"c_864.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","865",0x00000000,"c_865.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","866",0x00000000,"c_866.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","869",0x00000000,"c_869.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","874",0x00000000,"c_874.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","875",0x00000000,"c_875.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","878",0x00000000,"c_878.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","932",0x00000000,"c_932.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","936",0x00000000,"c_936.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","949",0x00000000,"c_949.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","950",0x00000000,"c_950.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","1006",0x00000000,"c_1006.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","1026",0x00000000,"c_1026.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","1250",0x00000000,"c_1250.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","1251",0x00000000,"c_1251.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","1252",0x00000000,"c_1252.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","1253",0x00000000,"c_1253.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","1254",0x00000000,"c_1254.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","1255",0x00000000,"c_1255.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","1256",0x00000000,"c_1256.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","1257",0x00000000,"c_1257.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","1258",0x00000000,"c_1258.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","10000",0x00000000,"c_10000.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","10006",0x00000000,"c_10006.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","10007",0x00000000,"c_10007.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","10029",0x00000000,"c_10029.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","10079",0x00000000,"c_10079.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","10081",0x00000000,"c_10081.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","20866",0x00000000,"c_20866.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","21866",0x00000000,"c_21866.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28591",0x00000000,"c_28591.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28592",0x00000000,"c_28592.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28593",0x00000000,"c_28593.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28594",0x00000000,"c_28594.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28595",0x00000000,"c_28595.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28596",0x00000000,"c_28596.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28597",0x00000000,"c_28597.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28598",0x00000000,"c_28598.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28599",0x00000000,"c_28599.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28600",0x00000000,"c_28600.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28603",0x00000000,"c_28603.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28604",0x00000000,"c_28604.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28605",0x00000000,"c_28605.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28606",0x00000000,"c_28606.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","ACP",0x00000000,"1252" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","OEMCP",0x00000000,"437" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","MACCP",0x00000000,"10000" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","37",0x00000000,"c_037.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","424",0x00000000,"c_424.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","437",0x00000000,"c_437.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","500",0x00000000,"c_500.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","737",0x00000000,"c_737.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","775",0x00000000,"c_775.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","850",0x00000000,"c_850.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","852",0x00000000,"c_852.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","855",0x00000000,"c_855.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","856",0x00000000,"c_856.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","857",0x00000000,"c_857.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","860",0x00000000,"c_860.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","861",0x00000000,"c_861.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","862",0x00000000,"c_862.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","863",0x00000000,"c_863.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","864",0x00000000,"c_864.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","865",0x00000000,"c_865.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","866",0x00000000,"c_866.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","869",0x00000000,"c_869.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","874",0x00000000,"c_874.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","875",0x00000000,"c_875.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","878",0x00000000,"c_878.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","932",0x00000000,"c_932.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","936",0x00000000,"c_936.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","949",0x00000000,"c_949.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","950",0x00000000,"c_950.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","1006",0x00000000,"c_1006.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","1026",0x00000000,"c_1026.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","1250",0x00000000,"c_1250.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","1251",0x00000000,"c_1251.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","1252",0x00000000,"c_1252.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","1253",0x00000000,"c_1253.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","1254",0x00000000,"c_1254.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","1255",0x00000000,"c_1255.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","1256",0x00000000,"c_1256.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","1257",0x00000000,"c_1257.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","1258",0x00000000,"c_1258.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","10000",0x00000000,"c_10000.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","10006",0x00000000,"c_10006.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","10007",0x00000000,"c_10007.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","10029",0x00000000,"c_10029.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","10079",0x00000000,"c_10079.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","10081",0x00000000,"c_10081.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","20866",0x00000000,"c_20866.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","21866",0x00000000,"c_21866.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","28591",0x00000000,"c_28591.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","28592",0x00000000,"c_28592.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","28593",0x00000000,"c_28593.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","28594",0x00000000,"c_28594.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","28595",0x00000000,"c_28595.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","28596",0x00000000,"c_28596.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","28597",0x00000000,"c_28597.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","28598",0x00000000,"c_28598.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","28599",0x00000000,"c_28599.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","28600",0x00000000,"c_28600.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","28603",0x00000000,"c_28603.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","28604",0x00000000,"c_28604.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","28605",0x00000000,"c_28605.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","28606",0x00000000,"c_28606.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","ACP",0x00000000,"1252" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","OEMCP",0x00000000,"437" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","MACCP",0x00000000,"10000" HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage\EUDCCodeRange","932",2,"F040-F9FC" HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage\EUDCCodeRange","936",2,"AAA1-AFFE,F8A1-FEFE,A140-A7A0" @@ -552,253 +689,253 @@ HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage\EUDCCodeRange","950",2,"FA40 HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage\EUDCCodeRange","Unicode",2,"E000-F8FF" ; NLS Language settings -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0402",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0403",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0404",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0804",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0c04",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","1004",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","1404",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0405",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0406",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0407",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0807",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0c07",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","1407",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0408",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0409",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0809",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0c09",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","1009",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","1409",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","1809",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","1c09",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","2009",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","3009",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","3409",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","040a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","080a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0c0a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","100a",0x00000000,"l_intl.nls" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","140a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","180a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","1c0a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","200a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","240a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","280a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","2c0a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","300a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","340a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","380a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","3c0a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","400a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","440a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","480a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","4c0a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","500a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","040b",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","040c",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","080c",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0c0c",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","100c",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","140c",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","180c",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","040d",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","040e",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","040f",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0410",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0810",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0411",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0412",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0413",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0414",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0813",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0414",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0814",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0415",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0416",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0816",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0417",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0418",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0419",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","041a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","081a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0c1a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","041b",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","041c",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","041d",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","081d",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","041e",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","041f",0x00000000,"l_intl.nls" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0420",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0421",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0422",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0423",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0424",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0425",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0426",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0427",0x00000000,"l_intl.nls" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0429",0x00000000,"l_intl.nls" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","042a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","042b",0x00000000,"l_intl.nls" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","042c",0x00000000,"l_intl.nls" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","082c",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","042d",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","042f",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0436",0x00000000,"l_intl.nls" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0437",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0438",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0439",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","043e",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","083e",0x00000000,"l_intl.nls" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","043f",0x00000000,"l_intl.nls" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0440",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0441",0x00000000,"l_intl.nls" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0443",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0843",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0445",0x00000000,"l_intl.nls" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0455",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0456",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","048f",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0490",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","Default",0x00000000,"0409" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","InstallLanguage",0x00000000,"0409" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0402",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0403",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0404",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0804",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0c04",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","1004",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","1404",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0405",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0406",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0407",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0807",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0c07",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","1407",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0408",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0409",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0809",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0c09",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","1009",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","1409",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","1809",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","1c09",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","2009",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","3009",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","3409",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","040a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","080a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0c0a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","100a",0x00000000,"l_intl.nls" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","140a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","180a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","1c0a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","200a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","240a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","280a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","2c0a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","300a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","340a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","380a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","3c0a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","400a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","440a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","480a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","4c0a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","500a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","040b",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","040c",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","080c",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0c0c",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","100c",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","140c",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","180c",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","040d",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","040e",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","040f",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0410",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0810",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0411",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0412",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0413",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0414",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0813",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0414",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0814",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0415",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0416",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0816",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0417",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0418",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0419",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","041a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","081a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0c1a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","041b",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","041c",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","041d",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","081d",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","041e",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","041f",0x00000000,"l_intl.nls" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0420",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0421",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0422",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0423",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0424",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0425",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0426",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0427",0x00000000,"l_intl.nls" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0429",0x00000000,"l_intl.nls" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","042a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","042b",0x00000000,"l_intl.nls" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","042c",0x00000000,"l_intl.nls" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","082c",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","042d",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","042f",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0436",0x00000000,"l_intl.nls" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0437",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0438",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0439",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","043e",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","083e",0x00000000,"l_intl.nls" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","043f",0x00000000,"l_intl.nls" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0440",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0441",0x00000000,"l_intl.nls" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0443",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0843",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0445",0x00000000,"l_intl.nls" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0455",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0456",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","048f",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0490",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","Default",0x00000000,"0409" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","InstallLanguage",0x00000000,"0409" ; Supported and installed locales ; If you add/uncomment an entry here, please also add the appropriate Language ; in the previous section. -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale",,0x00000012 -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000402",0x00000000,"5" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000403",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000404",0x00000000,"9" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000804",0x00000000,"a" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000405",0x00000000,"2" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000406",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000407",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000807",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000c07",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00001407",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000408",0x00000000,"4" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000409",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000809",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000c09",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00001009",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00001409",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00001809",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00001c09",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00002009",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00003009",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00003409",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000040a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000080a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000c0a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000100a",0x00000000,"1" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000140a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000180a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00001c0a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000200a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000240a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000280a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00002c0a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000300a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000340a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000380a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00003c0a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000400a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000440a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000480a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00004c0a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000500a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000040b",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000040c",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000080c",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000c0c",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000100c",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000140c",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000180c",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000040d",0x00000000,"c" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000040e",0x00000000,"2" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000040f",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000410",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000810",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000411",0x00000000,"7" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000412",0x00000000,"8" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000413",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000813",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000414",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000814",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000415",0x00000000,"2" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000416",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000816",0x00000000,"1" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000417",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000418",0x00000000,"2" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000419",0x00000000,"5" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000041a",0x00000000,"2" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000081a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000c1a",0x00000000,"5" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000041b",0x00000000,"2" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000041c",0x00000000,"2" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000041d",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000081d",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000041e",0x00000000,"b" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000041f",0x00000000,"6" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000420",0x00000000,"" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000421",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000422",0x00000000,"5" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000423",0x00000000,"5" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000424",0x00000000,"2" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000425",0x00000000,"3" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000426",0x00000000,"3" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000427",0x00000000,"3" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000429",0x00000000,"" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000042a",0x00000000,"" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000042b",0x00000000,"11" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000042c",0x00000000,"6" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000082c",0x00000000,"5" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000042d",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000042f",0x00000000,"5" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000436",0x00000000,"1" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000437",0x00000000,"10" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000438",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000439",0x00000000,"f" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000043e",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000083e",0x00000000,"1" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000043f",0x00000000,"5" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000440",0x00000000,"5" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000441",0x00000000,"1" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000443",0x00000000,"6" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000843",0x00000000,"5" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000445",0x00000000,"f" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000455",0x00000000,"" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000456",0x00000000,"1" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000048f",0x00000000,"1" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000490",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale",,0x00000012 +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000402",0x00000000,"5" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000403",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000404",0x00000000,"9" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000804",0x00000000,"a" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000405",0x00000000,"2" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000406",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000407",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000807",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000c07",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00001407",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000408",0x00000000,"4" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000409",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000809",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000c09",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00001009",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00001409",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00001809",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00001c09",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00002009",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00003009",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00003409",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000040a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000080a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000c0a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000100a",0x00000000,"1" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000140a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000180a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00001c0a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000200a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000240a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000280a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00002c0a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000300a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000340a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000380a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00003c0a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000400a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000440a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000480a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00004c0a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000500a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000040b",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000040c",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000080c",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000c0c",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000100c",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000140c",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000180c",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000040d",0x00000000,"c" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000040e",0x00000000,"2" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000040f",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000410",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000810",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000411",0x00000000,"7" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000412",0x00000000,"8" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000413",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000813",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000414",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000814",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000415",0x00000000,"2" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000416",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000816",0x00000000,"1" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000417",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000418",0x00000000,"2" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000419",0x00000000,"5" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000041a",0x00000000,"2" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000081a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000c1a",0x00000000,"5" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000041b",0x00000000,"2" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000041c",0x00000000,"2" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000041d",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000081d",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000041e",0x00000000,"b" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000041f",0x00000000,"6" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000420",0x00000000,"" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000421",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000422",0x00000000,"5" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000423",0x00000000,"5" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000424",0x00000000,"2" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000425",0x00000000,"3" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000426",0x00000000,"3" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000427",0x00000000,"3" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000429",0x00000000,"" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000042a",0x00000000,"" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000042b",0x00000000,"11" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000042c",0x00000000,"6" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000082c",0x00000000,"5" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000042d",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000042f",0x00000000,"5" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000436",0x00000000,"1" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000437",0x00000000,"10" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000438",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000439",0x00000000,"f" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000043e",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000083e",0x00000000,"1" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000043f",0x00000000,"5" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000440",0x00000000,"5" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000441",0x00000000,"1" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000443",0x00000000,"6" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000843",0x00000000,"5" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000445",0x00000000,"f" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000455",0x00000000,"" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000456",0x00000000,"1" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000048f",0x00000000,"1" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000490",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language Groups","1",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language Groups","2",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language Groups","3",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language Groups","4",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language Groups","5",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language Groups","6",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language Groups","7",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language Groups","8",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language Groups","9",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language Groups","10",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language Groups","11",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language Groups","a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language Groups","b",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language Groups","c",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language Groups","d",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language Groups","e",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language Groups","f",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language Groups","1",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language Groups","2",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language Groups","3",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language Groups","4",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language Groups","5",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language Groups","6",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language Groups","7",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language Groups","8",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language Groups","9",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language Groups","10",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language Groups","11",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language Groups","a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language Groups","b",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language Groups","c",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language Groups","d",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language Groups","e",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language Groups","f",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale\Alternate Sorts","00010407",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale\Alternate Sorts","0001040e",0x00000000,"2" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale\Alternate Sorts","00010437",0x00000000,"" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale\Alternate Sorts","00020804",0x00000000,"" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale\Alternate Sorts","00021004",0x00000000,"" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale\Alternate Sorts","00021404",0x00000000,"" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale\Alternate Sorts","00030404",0x00000000,"" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale\Alternate Sorts","00010407",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale\Alternate Sorts","0001040e",0x00000000,"2" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale\Alternate Sorts","00010437",0x00000000,"" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale\Alternate Sorts","00020804",0x00000000,"" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale\Alternate Sorts","00021004",0x00000000,"" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale\Alternate Sorts","00021404",0x00000000,"" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale\Alternate Sorts","00030404",0x00000000,"" HKLM,"SYSTEM\CurrentControlSet\Control\PnP\Pci\CardList","Intel 82441FX",0x00030003,\ 01,00,00,00,86,80,37,12,00,00,00,00,00,00,00,00 @@ -1211,9 +1348,9 @@ HKLM,"SYSTEM\CurrentControlSet\Services\tcpsvcs","ImagePath",0x00020000,"%System HKLM,"SYSTEM\CurrentControlSet\Services\tcpsvcs","Start",0x00010001,0x00000003 HKLM,"SYSTEM\CurrentControlSet\Services\tcpsvcs","Type",0x00010001,0x00000020 -; ReactOS Telnet Daemon -HKLM,"SYSTEM\CurrentControlSet\Services\telnetd","Description",0x00000000,"ReactOS Telnet Daemon" -HKLM,"SYSTEM\CurrentControlSet\Services\telnetd","DisplayName",0x00000000,"ReactOS Telnet Daemon" +; ReactOS Telnet Service +HKLM,"SYSTEM\CurrentControlSet\Services\telnetd","Description",0x00000000,"ReactOS Telnet Service" +HKLM,"SYSTEM\CurrentControlSet\Services\telnetd","DisplayName",0x00000000,"ReactOS Telnet Service" HKLM,"SYSTEM\CurrentControlSet\Services\telnetd","ErrorControl",0x00010001,0x00000001 HKLM,"SYSTEM\CurrentControlSet\Services\telnetd","Group",0x00000000,"Network" HKLM,"SYSTEM\CurrentControlSet\Services\telnetd","ImagePath",0x00020000,"%SystemRoot%\system32\telnetd.exe" @@ -1278,11 +1415,11 @@ HKLM,"SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSe HKLM,"SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Services\Vga\Device0","DefaultSettings.YResolution",0x00010001,480 ; USB uhci/ehci driver -HKLM,"SYSTEM\CurrentControlSet\Services\usbdriver","ErrorControl",0x00010001,0x00000000 -HKLM,"SYSTEM\CurrentControlSet\Services\usbdriver","Group",0x00000000,"Base" -HKLM,"SYSTEM\CurrentControlSet\Services\usbdriver","ImagePath",0x00020000,"system32\drivers\usbdriver.sys" -HKLM,"SYSTEM\CurrentControlSet\Services\usbdriver","Start",0x00010001,0x00000001 -HKLM,"SYSTEM\CurrentControlSet\Services\usbdriver","Type",0x00010001,0x00000001 +;HKLM,"SYSTEM\CurrentControlSet\Services\usbdriver","ErrorControl",0x00010001,0x00000000 +;HKLM,"SYSTEM\CurrentControlSet\Services\usbdriver","Group",0x00000000,"Base" +;HKLM,"SYSTEM\CurrentControlSet\Services\usbdriver","ImagePath",0x00020000,"system32\drivers\usbdriver.sys" +;HKLM,"SYSTEM\CurrentControlSet\Services\usbdriver","Start",0x00010001,0x00000001 +;HKLM,"SYSTEM\CurrentControlSet\Services\usbdriver","Type",0x00010001,0x00000001 ; USB storage driver ;HKLM,"SYSTEM\CurrentControlSet\Services\usbstor","ErrorControl",0x00010001,0x00000000 diff --git a/boot/bootdata/hivesys_arm.inf b/boot/bootdata/hivesys_arm.inf index e766a5aaad5..2fac7e7ef79 100644 --- a/boot/bootdata/hivesys_arm.inf +++ b/boot/bootdata/hivesys_arm.inf @@ -381,317 +381,317 @@ HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E975-E325-11CE-BFC1-08002BE1 HKLM,"SYSTEM\CurrentControlSet\Control\NetworkProvider\Order","ProviderOrder",0x00000000,"" ; NLS Files -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","37",0x00000000,"c_037.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","424",0x00000000,"c_424.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","437",0x00000000,"c_437.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","500",0x00000000,"c_500.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","737",0x00000000,"c_737.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","775",0x00000000,"c_775.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","850",0x00000000,"c_850.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","852",0x00000000,"c_852.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","855",0x00000000,"c_855.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","856",0x00000000,"c_856.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","857",0x00000000,"c_857.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","860",0x00000000,"c_860.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","861",0x00000000,"c_861.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","862",0x00000000,"c_862.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","863",0x00000000,"c_863.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","864",0x00000000,"c_864.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","865",0x00000000,"c_865.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","866",0x00000000,"c_866.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","869",0x00000000,"c_869.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","874",0x00000000,"c_874.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","875",0x00000000,"c_875.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","878",0x00000000,"c_878.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","932",0x00000000,"c_932.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","936",0x00000000,"c_936.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","949",0x00000000,"c_949.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","950",0x00000000,"c_950.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","1006",0x00000000,"c_1006.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","1026",0x00000000,"c_1026.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","1250",0x00000000,"c_1250.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","1251",0x00000000,"c_1251.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","1252",0x00000000,"c_1252.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","1253",0x00000000,"c_1253.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","1254",0x00000000,"c_1254.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","1255",0x00000000,"c_1255.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","1256",0x00000000,"c_1256.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","1257",0x00000000,"c_1257.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","1258",0x00000000,"c_1258.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","10000",0x00000000,"c_10000.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","10006",0x00000000,"c_10006.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","10007",0x00000000,"c_10007.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","10029",0x00000000,"c_10029.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","10079",0x00000000,"c_10079.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","10081",0x00000000,"c_10081.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","20866",0x00000000,"c_20866.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","21866",0x00000000,"c_21866.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28591",0x00000000,"c_28591.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28592",0x00000000,"c_28592.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28593",0x00000000,"c_28593.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28594",0x00000000,"c_28594.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28595",0x00000000,"c_28595.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28596",0x00000000,"c_28596.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28597",0x00000000,"c_28597.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28598",0x00000000,"c_28598.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28599",0x00000000,"c_28599.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28600",0x00000000,"c_28600.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28603",0x00000000,"c_28603.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28604",0x00000000,"c_28604.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28605",0x00000000,"c_28605.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28606",0x00000000,"c_28606.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","ACP",0x00000000,"1252" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","OEMCP",0x00000000,"437" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","MACCP",0x00000000,"10000" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","37",0x00000000,"c_037.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","424",0x00000000,"c_424.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","437",0x00000000,"c_437.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","500",0x00000000,"c_500.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","737",0x00000000,"c_737.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","775",0x00000000,"c_775.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","850",0x00000000,"c_850.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","852",0x00000000,"c_852.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","855",0x00000000,"c_855.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","856",0x00000000,"c_856.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","857",0x00000000,"c_857.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","860",0x00000000,"c_860.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","861",0x00000000,"c_861.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","862",0x00000000,"c_862.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","863",0x00000000,"c_863.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","864",0x00000000,"c_864.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","865",0x00000000,"c_865.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","866",0x00000000,"c_866.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","869",0x00000000,"c_869.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","874",0x00000000,"c_874.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","875",0x00000000,"c_875.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","878",0x00000000,"c_878.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","932",0x00000000,"c_932.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","936",0x00000000,"c_936.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","949",0x00000000,"c_949.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","950",0x00000000,"c_950.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","1006",0x00000000,"c_1006.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","1026",0x00000000,"c_1026.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","1250",0x00000000,"c_1250.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","1251",0x00000000,"c_1251.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","1252",0x00000000,"c_1252.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","1253",0x00000000,"c_1253.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","1254",0x00000000,"c_1254.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","1255",0x00000000,"c_1255.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","1256",0x00000000,"c_1256.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","1257",0x00000000,"c_1257.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","1258",0x00000000,"c_1258.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","10000",0x00000000,"c_10000.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","10006",0x00000000,"c_10006.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","10007",0x00000000,"c_10007.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","10029",0x00000000,"c_10029.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","10079",0x00000000,"c_10079.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","10081",0x00000000,"c_10081.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","20866",0x00000000,"c_20866.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","21866",0x00000000,"c_21866.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","28591",0x00000000,"c_28591.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","28592",0x00000000,"c_28592.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","28593",0x00000000,"c_28593.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","28594",0x00000000,"c_28594.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","28595",0x00000000,"c_28595.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","28596",0x00000000,"c_28596.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","28597",0x00000000,"c_28597.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","28598",0x00000000,"c_28598.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","28599",0x00000000,"c_28599.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","28600",0x00000000,"c_28600.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","28603",0x00000000,"c_28603.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","28604",0x00000000,"c_28604.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","28605",0x00000000,"c_28605.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","28606",0x00000000,"c_28606.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","ACP",0x00000000,"1252" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","OEMCP",0x00000000,"437" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","MACCP",0x00000000,"10000" ; NLS Language settings -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0402",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0403",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0404",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0804",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0c04",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","1004",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","1404",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0405",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0406",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0407",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0807",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0c07",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","1407",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0408",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0409",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0809",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0c09",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","1009",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","1409",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","1809",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","1c09",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","2009",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","3009",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","3409",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","040a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","080a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0c0a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","100a",0x00000000,"l_intl.nls" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","140a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","180a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","1c0a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","200a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","240a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","280a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","2c0a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","300a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","340a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","380a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","3c0a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","400a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","440a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","480a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","4c0a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","500a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","040b",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","040c",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","080c",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0c0c",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","100c",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","140c",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","180c",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","040d",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","040e",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","040f",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0410",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0810",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0411",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0412",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0413",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0414",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0813",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0414",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0814",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0415",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0416",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0816",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0417",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0418",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0419",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","041a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","081a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0c1a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","041b",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","041c",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","041d",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","081d",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","041e",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","041f",0x00000000,"l_intl.nls" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0420",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0421",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0422",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0423",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0424",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0425",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0426",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0427",0x00000000,"l_intl.nls" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0429",0x00000000,"l_intl.nls" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","042a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","042b",0x00000000,"l_intl.nls" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","042c",0x00000000,"l_intl.nls" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","082c",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","042d",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","042f",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0436",0x00000000,"l_intl.nls" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0437",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0438",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0439",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","043e",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","083e",0x00000000,"l_intl.nls" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","043f",0x00000000,"l_intl.nls" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0440",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0441",0x00000000,"l_intl.nls" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0443",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0843",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0445",0x00000000,"l_intl.nls" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0455",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0456",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","048f",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0490",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","Default",0x00000000,"0409" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","InstallLanguage",0x00000000,"0409" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0402",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0403",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0404",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0804",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0c04",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","1004",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","1404",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0405",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0406",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0407",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0807",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0c07",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","1407",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0408",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0409",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0809",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0c09",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","1009",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","1409",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","1809",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","1c09",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","2009",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","3009",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","3409",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","040a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","080a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0c0a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","100a",0x00000000,"l_intl.nls" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","140a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","180a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","1c0a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","200a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","240a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","280a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","2c0a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","300a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","340a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","380a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","3c0a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","400a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","440a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","480a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","4c0a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","500a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","040b",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","040c",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","080c",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0c0c",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","100c",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","140c",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","180c",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","040d",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","040e",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","040f",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0410",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0810",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0411",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0412",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0413",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0414",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0813",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0414",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0814",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0415",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0416",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0816",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0417",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0418",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0419",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","041a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","081a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0c1a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","041b",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","041c",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","041d",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","081d",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","041e",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","041f",0x00000000,"l_intl.nls" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0420",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0421",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0422",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0423",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0424",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0425",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0426",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0427",0x00000000,"l_intl.nls" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0429",0x00000000,"l_intl.nls" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","042a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","042b",0x00000000,"l_intl.nls" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","042c",0x00000000,"l_intl.nls" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","082c",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","042d",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","042f",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0436",0x00000000,"l_intl.nls" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0437",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0438",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0439",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","043e",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","083e",0x00000000,"l_intl.nls" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","043f",0x00000000,"l_intl.nls" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0440",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0441",0x00000000,"l_intl.nls" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0443",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0843",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0445",0x00000000,"l_intl.nls" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0455",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0456",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","048f",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0490",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","Default",0x00000000,"0409" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","InstallLanguage",0x00000000,"0409" ; Supported and installed locales ; If you add/uncomment an entry here, please also add the appropriate Language ; in the previous section. -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale",,0x00000012 -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000402",0x00000000,"5" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000403",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000404",0x00000000,"9" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000804",0x00000000,"a" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000405",0x00000000,"2" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000406",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000407",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000807",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000c07",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00001407",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000408",0x00000000,"4" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000409",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000809",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000c09",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00001009",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00001409",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00001809",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00001c09",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00002009",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00003009",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00003409",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000040a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000080a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000c0a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000100a",0x00000000,"1" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000140a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000180a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00001c0a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000200a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000240a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000280a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00002c0a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000300a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000340a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000380a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00003c0a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000400a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000440a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000480a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00004c0a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000500a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000040b",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000040c",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000080c",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000c0c",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000100c",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000140c",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000180c",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000040d",0x00000000,"c" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000040e",0x00000000,"2" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000040f",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000410",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000810",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000411",0x00000000,"7" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000412",0x00000000,"8" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000413",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000813",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000414",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000814",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000415",0x00000000,"2" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000416",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000816",0x00000000,"1" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000417",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000418",0x00000000,"2" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000419",0x00000000,"5" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000041a",0x00000000,"2" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000081a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000c1a",0x00000000,"5" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000041b",0x00000000,"2" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000041c",0x00000000,"2" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000041d",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000081d",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000041e",0x00000000,"b" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000041f",0x00000000,"6" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000420",0x00000000,"" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000421",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000422",0x00000000,"5" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000423",0x00000000,"5" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000424",0x00000000,"2" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000425",0x00000000,"3" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000426",0x00000000,"3" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000427",0x00000000,"3" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000429",0x00000000,"" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000042a",0x00000000,"" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000042b",0x00000000,"11" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000042c",0x00000000,"6" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000082c",0x00000000,"5" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000042d",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000042f",0x00000000,"5" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000436",0x00000000,"1" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000437",0x00000000,"10" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000438",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000439",0x00000000,"f" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000043e",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000083e",0x00000000,"1" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000043f",0x00000000,"5" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000440",0x00000000,"5" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000441",0x00000000,"1" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000443",0x00000000,"6" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000843",0x00000000,"5" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000445",0x00000000,"f" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000455",0x00000000,"" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000456",0x00000000,"1" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000048f",0x00000000,"1" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000490",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale",,0x00000012 +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000402",0x00000000,"5" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000403",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000404",0x00000000,"9" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000804",0x00000000,"a" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000405",0x00000000,"2" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000406",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000407",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000807",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000c07",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00001407",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000408",0x00000000,"4" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000409",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000809",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000c09",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00001009",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00001409",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00001809",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00001c09",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00002009",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00003009",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00003409",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000040a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000080a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000c0a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000100a",0x00000000,"1" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000140a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000180a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00001c0a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000200a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000240a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000280a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00002c0a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000300a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000340a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000380a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00003c0a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000400a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000440a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000480a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00004c0a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000500a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000040b",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000040c",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000080c",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000c0c",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000100c",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000140c",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000180c",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000040d",0x00000000,"c" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000040e",0x00000000,"2" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000040f",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000410",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000810",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000411",0x00000000,"7" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000412",0x00000000,"8" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000413",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000813",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000414",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000814",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000415",0x00000000,"2" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000416",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000816",0x00000000,"1" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000417",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000418",0x00000000,"2" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000419",0x00000000,"5" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000041a",0x00000000,"2" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000081a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000c1a",0x00000000,"5" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000041b",0x00000000,"2" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000041c",0x00000000,"2" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000041d",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000081d",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000041e",0x00000000,"b" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000041f",0x00000000,"6" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000420",0x00000000,"" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000421",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000422",0x00000000,"5" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000423",0x00000000,"5" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000424",0x00000000,"2" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000425",0x00000000,"3" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000426",0x00000000,"3" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000427",0x00000000,"3" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000429",0x00000000,"" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000042a",0x00000000,"" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000042b",0x00000000,"11" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000042c",0x00000000,"6" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000082c",0x00000000,"5" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000042d",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000042f",0x00000000,"5" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000436",0x00000000,"1" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000437",0x00000000,"10" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000438",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000439",0x00000000,"f" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000043e",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000083e",0x00000000,"1" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000043f",0x00000000,"5" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000440",0x00000000,"5" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000441",0x00000000,"1" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000443",0x00000000,"6" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000843",0x00000000,"5" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000445",0x00000000,"f" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000455",0x00000000,"" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000456",0x00000000,"1" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000048f",0x00000000,"1" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000490",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language Groups","1",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language Groups","2",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language Groups","3",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language Groups","4",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language Groups","5",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language Groups","6",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language Groups","7",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language Groups","8",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language Groups","9",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language Groups","10",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language Groups","11",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language Groups","a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language Groups","b",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language Groups","c",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language Groups","d",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language Groups","e",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language Groups","f",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language Groups","1",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language Groups","2",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language Groups","3",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language Groups","4",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language Groups","5",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language Groups","6",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language Groups","7",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language Groups","8",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language Groups","9",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language Groups","10",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language Groups","11",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language Groups","a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language Groups","b",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language Groups","c",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language Groups","d",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language Groups","e",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language Groups","f",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale\Alternate Sorts","00010407",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale\Alternate Sorts","0001040e",0x00000000,"2" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale\Alternate Sorts","00010437",0x00000000,"" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale\Alternate Sorts","00020804",0x00000000,"" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale\Alternate Sorts","00021004",0x00000000,"" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale\Alternate Sorts","00021404",0x00000000,"" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale\Alternate Sorts","00030404",0x00000000,"" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale\Alternate Sorts","00010407",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale\Alternate Sorts","0001040e",0x00000000,"2" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale\Alternate Sorts","00010437",0x00000000,"" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale\Alternate Sorts","00020804",0x00000000,"" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale\Alternate Sorts","00021004",0x00000000,"" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale\Alternate Sorts","00021404",0x00000000,"" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale\Alternate Sorts","00030404",0x00000000,"" ; Some installers check for SP6 HKLM,"SYSTEM\CurrentControlSet\Control\Windows","CSDVersion",0x00010001,0x00000600 diff --git a/boot/bootdata/hivesys_i386.inf b/boot/bootdata/hivesys_i386.inf index 3561a0d9bff..42c7a93ee4b 100644 --- a/boot/bootdata/hivesys_i386.inf +++ b/boot/bootdata/hivesys_i386.inf @@ -7,6 +7,144 @@ HKLM,"SYSTEM\CurrentControlSet\Control","CurrentUser",2,"USERNAME" HKLM,"SYSTEM\CurrentControlSet\Control","WaitToKillServiceTimeout",2,"20000" HKLM,"SYSTEM\CurrentControlSet\Control\Biosinfo","InfName",2,"biosinfo.inf" HKLM,"SYSTEM\CurrentControlSet\Control\PnP",,0x00000012 + +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot","AlternateShell",2,"cmd.exe" + +; Safe Boot drivers +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\AppMgmt","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\Base","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\Boot Bus Extender","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\Boot file system","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\CryptSvc","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\DcomLaunch","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\dmadmin","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\dmboot.sys","",0x00000000,"Driver" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\dmio.sys","",0x00000000,"Driver" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\dmload.sys","",0x00000000,"Driver" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\dmserver","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\EventLog","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\File system","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\Filter","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\HelpSvc","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\Netlogon","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\PCI Configuration","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\PlugPlay","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\PNP Filter","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\Primary disk","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\RpcSs","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\SCSI Class","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\sermouse.sys","",0x00000000,"Driver" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\sr.sys","",0x00000000,"FSFilter System Recovery" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\SRService","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\System Bus Extender","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\vga.sys","",0x00000000,"Driver" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\vgasave.sys","",0x00000000,"Driver" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\WinMgmt","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\{36FC9E60-C465-11CF-8056-444553540000}","",0x00000000,"Universal Serial Bus controllers" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\{4D36E965-E325-11CE-BFC1-08002BE10318}","",0x00000000,"CD-ROM Drive" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\{4D36E967-E325-11CE-BFC1-08002BE10318}","",0x00000000,"DiskDrive" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\{4D36E969-E325-11CE-BFC1-08002BE10318}","",0x00000000,"Standard floppy disk controller" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\{4D36E96A-E325-11CE-BFC1-08002BE10318}","",0x00000000,"Hdc" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\{4D36E96B-E325-11CE-BFC1-08002BE10318}","",0x00000000,"Keyboard" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\{4D36E96F-E325-11CE-BFC1-08002BE10318}","",0x00000000,"Mouse" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\{4D36E977-E325-11CE-BFC1-08002BE10318}","",0x00000000,"PCMCIA Adapters" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\{4D36E97B-E325-11CE-BFC1-08002BE10318}","",0x00000000,"SCSIAdapter" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\{4D36E97D-E325-11CE-BFC1-08002BE10318}","",0x00000000,"System" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\{4D36E980-E325-11CE-BFC1-08002BE10318}","",0x00000000,"Floppy disk drive" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\{71A27CDD-812A-11D0-BEC7-08002BE2092F}","",0x00000000,"Volume" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\{745A17A0-74D3-11D0-B6FE-00A0C90F57DA}","",0x00000000,"Human Interface Devices" + +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\AFD","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\AppMgmt","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\Base","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\Boot Bus Extender","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\Boot file system","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\Browser","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\CryptSvc","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\DcomLaunch","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\Dhcp","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\dmadmin","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\dmboot.sys","",0x00000000,"Driver" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\dmio.sys","",0x00000000,"Driver" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\dmload.sys","",0x00000000,"Driver" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\dmserver","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\DnsCache","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\EventLog","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\File system","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\Filter","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\HelpSvc","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\ip6fw.sys","",0x00000000,"Driver" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\ipnat.sys","",0x00000000,"Driver" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\LanmanServer","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\LanmanWorkstation","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\LmHosts","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\Messenger","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\NDIS","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\NDIS Wrapper","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\Ndisuio","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\NetBIOS","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\NetBIOSGroup","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\NetBT","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\NetDDEGroup","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\Netlogon","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\NetMan","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\Network","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\NetworkProvider","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\NtLmSsp","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\PCI Configuration","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\PlugPlay","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\PNP Filter","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\PNP_TDI","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\Primary disk","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\rdpcdd.sys","",0x00000000,"Driver" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\rdpdd.sys","",0x00000000,"Driver" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\rdpwd.sys","",0x00000000,"Driver" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\rdsessmgr","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\RpcSs","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\SCSI Class","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\sermouse.sys","",0x00000000,"Driver" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\SharedAccess","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\sr.sys","",0x00000000,"FSFilter System Recovery" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\SRService","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\Streams Drivers","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\System Bus Extender","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\Tcpip","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\TDI","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\tdpipe.sys","",0x00000000,"Driver" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\tdtcp.sys","",0x00000000,"Driver" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\termservice","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\vga.sys","",0x00000000,"Driver" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\vgasave.sys","",0x00000000,"Driver" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\WinMgmt","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\WZCSVC","",0x00000000,"Service" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\{36FC9E60-C465-11CF-8056-444553540000}","",0x00000000,"Universal Serial Bus controllers" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\{4D36E965-E325-11CE-BFC1-08002BE10318}","",0x00000000,"CD-ROM Drive" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\{4D36E967-E325-11CE-BFC1-08002BE10318}","",0x00000000,"DiskDrive" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\{4D36E969-E325-11CE-BFC1-08002BE10318}","",0x00000000,"Standard floppy disk controller" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\{4D36E96A-E325-11CE-BFC1-08002BE10318}","",0x00000000,"Hdc" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\{4D36E96B-E325-11CE-BFC1-08002BE10318}","",0x00000000,"Keyboard" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\{4D36E96F-E325-11CE-BFC1-08002BE10318}","",0x00000000,"Mouse" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}","",0x00000000,"Net" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\{4D36E973-E325-11CE-BFC1-08002BE10318}","",0x00000000,"NetClient" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\{4D36E974-E325-11CE-BFC1-08002BE10318}","",0x00000000,"NetService" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\{4D36E975-E325-11CE-BFC1-08002BE10318}","",0x00000000,"NetTrans" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\{4D36E977-E325-11CE-BFC1-08002BE10318}","",0x00000000,"PCMCIA Adapters" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\{4D36E97B-E325-11CE-BFC1-08002BE10318}","",0x00000000,"SCSIAdapter" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\{4D36E97D-E325-11CE-BFC1-08002BE10318}","",0x00000000,"System" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\{4D36E980-E325-11CE-BFC1-08002BE10318}","",0x00000000,"Floppy disk drive" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\{71A27CDD-812A-11D0-BEC7-08002BE2092F}","",0x00000000,"Volume" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\{745A17A0-74D3-11D0-B6FE-00A0C90F57DA}","",0x00000000,"Human Interface Devices" + +; ReactOS specific - required to load in Safe Mode and for debugging in Safe Mode (until vga.sys and vgasave.sys are implemented) +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\Debug","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\vgamp.sys","",0x00000000,"Driver" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Minimal\vbemp.sys","",0x00000000,"Driver" + +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\Debug","",0x00000000,"Driver Group" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\vgamp.sys","",0x00000000,"Driver" +HKLM,"SYSTEM\CurrentControlSet\Control\SafeBoot\Network\vbemp.sys","",0x00000000,"Driver" + +; Other HKLM,"SYSTEM\CurrentControlSet\Control\Arbiters",,0x00000012 HKLM,"SYSTEM\CurrentControlSet\Control\Arbiters\AllocationOrder","Root",0x000a0001,\ @@ -574,68 +712,68 @@ HKLM,"SYSTEM\CurrentControlSet\Control\Network\{4D36E975-E325-11CE-BFC1-08002BE1 HKLM,"SYSTEM\CurrentControlSet\Control\NetworkProvider\Order","ProviderOrder",0x00000000,"" ; NLS Files -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","37",0x00000000,"c_037.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","424",0x00000000,"c_424.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","437",0x00000000,"c_437.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","500",0x00000000,"c_500.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","737",0x00000000,"c_737.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","775",0x00000000,"c_775.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","850",0x00000000,"c_850.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","852",0x00000000,"c_852.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","855",0x00000000,"c_855.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","856",0x00000000,"c_856.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","857",0x00000000,"c_857.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","860",0x00000000,"c_860.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","861",0x00000000,"c_861.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","862",0x00000000,"c_862.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","863",0x00000000,"c_863.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","864",0x00000000,"c_864.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","865",0x00000000,"c_865.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","866",0x00000000,"c_866.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","869",0x00000000,"c_869.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","874",0x00000000,"c_874.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","875",0x00000000,"c_875.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","878",0x00000000,"c_878.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","932",0x00000000,"c_932.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","936",0x00000000,"c_936.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","949",0x00000000,"c_949.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","950",0x00000000,"c_950.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","1006",0x00000000,"c_1006.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","1026",0x00000000,"c_1026.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","1250",0x00000000,"c_1250.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","1251",0x00000000,"c_1251.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","1252",0x00000000,"c_1252.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","1253",0x00000000,"c_1253.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","1254",0x00000000,"c_1254.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","1255",0x00000000,"c_1255.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","1256",0x00000000,"c_1256.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","1257",0x00000000,"c_1257.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","1258",0x00000000,"c_1258.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","10000",0x00000000,"c_10000.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","10006",0x00000000,"c_10006.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","10007",0x00000000,"c_10007.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","10029",0x00000000,"c_10029.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","10079",0x00000000,"c_10079.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","10081",0x00000000,"c_10081.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","20866",0x00000000,"c_20866.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","21866",0x00000000,"c_21866.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28591",0x00000000,"c_28591.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28592",0x00000000,"c_28592.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28593",0x00000000,"c_28593.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28594",0x00000000,"c_28594.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28595",0x00000000,"c_28595.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28596",0x00000000,"c_28596.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28597",0x00000000,"c_28597.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28598",0x00000000,"c_28598.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28599",0x00000000,"c_28599.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28600",0x00000000,"c_28600.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28603",0x00000000,"c_28603.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28604",0x00000000,"c_28604.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28605",0x00000000,"c_28605.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","28606",0x00000000,"c_28606.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","ACP",0x00000000,"1252" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","OEMCP",0x00000000,"437" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\CodePage","MACCP",0x00000000,"10000" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","37",0x00000000,"c_037.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","424",0x00000000,"c_424.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","437",0x00000000,"c_437.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","500",0x00000000,"c_500.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","737",0x00000000,"c_737.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","775",0x00000000,"c_775.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","850",0x00000000,"c_850.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","852",0x00000000,"c_852.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","855",0x00000000,"c_855.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","856",0x00000000,"c_856.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","857",0x00000000,"c_857.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","860",0x00000000,"c_860.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","861",0x00000000,"c_861.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","862",0x00000000,"c_862.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","863",0x00000000,"c_863.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","864",0x00000000,"c_864.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","865",0x00000000,"c_865.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","866",0x00000000,"c_866.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","869",0x00000000,"c_869.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","874",0x00000000,"c_874.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","875",0x00000000,"c_875.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","878",0x00000000,"c_878.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","932",0x00000000,"c_932.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","936",0x00000000,"c_936.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","949",0x00000000,"c_949.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","950",0x00000000,"c_950.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","1006",0x00000000,"c_1006.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","1026",0x00000000,"c_1026.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","1250",0x00000000,"c_1250.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","1251",0x00000000,"c_1251.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","1252",0x00000000,"c_1252.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","1253",0x00000000,"c_1253.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","1254",0x00000000,"c_1254.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","1255",0x00000000,"c_1255.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","1256",0x00000000,"c_1256.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","1257",0x00000000,"c_1257.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","1258",0x00000000,"c_1258.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","10000",0x00000000,"c_10000.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","10006",0x00000000,"c_10006.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","10007",0x00000000,"c_10007.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","10029",0x00000000,"c_10029.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","10079",0x00000000,"c_10079.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","10081",0x00000000,"c_10081.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","20866",0x00000000,"c_20866.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","21866",0x00000000,"c_21866.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","28591",0x00000000,"c_28591.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","28592",0x00000000,"c_28592.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","28593",0x00000000,"c_28593.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","28594",0x00000000,"c_28594.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","28595",0x00000000,"c_28595.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","28596",0x00000000,"c_28596.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","28597",0x00000000,"c_28597.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","28598",0x00000000,"c_28598.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","28599",0x00000000,"c_28599.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","28600",0x00000000,"c_28600.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","28603",0x00000000,"c_28603.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","28604",0x00000000,"c_28604.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","28605",0x00000000,"c_28605.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","28606",0x00000000,"c_28606.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","ACP",0x00000000,"1252" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","OEMCP",0x00000000,"437" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage","MACCP",0x00000000,"10000" HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage\EUDCCodeRange","932",2,"F040-F9FC" HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage\EUDCCodeRange","936",2,"AAA1-AFFE,F8A1-FEFE,A140-A7A0" @@ -644,253 +782,253 @@ HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage\EUDCCodeRange","950",2,"FA40 HKLM,"SYSTEM\CurrentControlSet\Control\Nls\CodePage\EUDCCodeRange","Unicode",2,"E000-F8FF" ; NLS Language settings -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0402",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0403",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0404",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0804",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0c04",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","1004",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","1404",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0405",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0406",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0407",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0807",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0c07",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","1407",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0408",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0409",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0809",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0c09",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","1009",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","1409",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","1809",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","1c09",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","2009",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","3009",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","3409",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","040a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","080a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0c0a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","100a",0x00000000,"l_intl.nls" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","140a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","180a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","1c0a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","200a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","240a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","280a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","2c0a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","300a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","340a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","380a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","3c0a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","400a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","440a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","480a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","4c0a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","500a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","040b",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","040c",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","080c",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0c0c",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","100c",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","140c",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","180c",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","040d",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","040e",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","040f",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0410",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0810",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0411",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0412",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0413",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0414",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0813",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0414",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0814",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0415",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0416",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0816",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0417",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0418",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0419",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","041a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","081a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0c1a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","041b",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","041c",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","041d",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","081d",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","041e",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","041f",0x00000000,"l_intl.nls" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0420",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0421",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0422",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0423",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0424",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0425",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0426",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0427",0x00000000,"l_intl.nls" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0429",0x00000000,"l_intl.nls" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","042a",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","042b",0x00000000,"l_intl.nls" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","042c",0x00000000,"l_intl.nls" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","082c",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","042d",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","042f",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0436",0x00000000,"l_intl.nls" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0437",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0438",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0439",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","043e",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","083e",0x00000000,"l_intl.nls" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","043f",0x00000000,"l_intl.nls" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0440",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0441",0x00000000,"l_intl.nls" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0443",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0843",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0445",0x00000000,"l_intl.nls" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0455",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0456",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","048f",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","0490",0x00000000,"l_intl.nls" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","Default",0x00000000,"0409" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language","InstallLanguage",0x00000000,"0409" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0402",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0403",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0404",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0804",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0c04",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","1004",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","1404",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0405",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0406",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0407",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0807",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0c07",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","1407",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0408",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0409",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0809",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0c09",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","1009",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","1409",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","1809",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","1c09",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","2009",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","3009",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","3409",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","040a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","080a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0c0a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","100a",0x00000000,"l_intl.nls" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","140a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","180a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","1c0a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","200a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","240a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","280a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","2c0a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","300a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","340a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","380a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","3c0a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","400a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","440a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","480a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","4c0a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","500a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","040b",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","040c",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","080c",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0c0c",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","100c",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","140c",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","180c",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","040d",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","040e",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","040f",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0410",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0810",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0411",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0412",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0413",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0414",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0813",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0414",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0814",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0415",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0416",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0816",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0417",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0418",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0419",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","041a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","081a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0c1a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","041b",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","041c",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","041d",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","081d",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","041e",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","041f",0x00000000,"l_intl.nls" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0420",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0421",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0422",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0423",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0424",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0425",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0426",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0427",0x00000000,"l_intl.nls" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0429",0x00000000,"l_intl.nls" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","042a",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","042b",0x00000000,"l_intl.nls" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","042c",0x00000000,"l_intl.nls" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","082c",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","042d",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","042f",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0436",0x00000000,"l_intl.nls" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0437",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0438",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0439",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","043e",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","083e",0x00000000,"l_intl.nls" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","043f",0x00000000,"l_intl.nls" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0440",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0441",0x00000000,"l_intl.nls" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0443",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0843",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0445",0x00000000,"l_intl.nls" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0455",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0456",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","048f",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","0490",0x00000000,"l_intl.nls" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","Default",0x00000000,"0409" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language","InstallLanguage",0x00000000,"0409" ; Supported and installed locales ; If you add/uncomment an entry here, please also add the appropriate Language ; in the previous section. -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale",,0x00000012 -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000402",0x00000000,"5" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000403",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000404",0x00000000,"9" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000804",0x00000000,"a" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000405",0x00000000,"2" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000406",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000407",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000807",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000c07",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00001407",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000408",0x00000000,"4" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000409",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000809",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000c09",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00001009",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00001409",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00001809",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00001c09",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00002009",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00003009",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00003409",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000040a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000080a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000c0a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000100a",0x00000000,"1" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000140a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000180a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00001c0a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000200a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000240a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000280a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00002c0a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000300a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000340a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000380a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00003c0a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000400a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000440a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000480a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00004c0a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000500a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000040b",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000040c",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000080c",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000c0c",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000100c",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000140c",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000180c",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000040d",0x00000000,"c" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000040e",0x00000000,"2" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000040f",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000410",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000810",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000411",0x00000000,"7" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000412",0x00000000,"8" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000413",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000813",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000414",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000814",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000415",0x00000000,"2" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000416",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000816",0x00000000,"1" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000417",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000418",0x00000000,"2" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000419",0x00000000,"5" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000041a",0x00000000,"2" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000081a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000c1a",0x00000000,"5" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000041b",0x00000000,"2" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000041c",0x00000000,"2" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000041d",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000081d",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000041e",0x00000000,"b" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000041f",0x00000000,"6" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000420",0x00000000,"" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000421",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000422",0x00000000,"5" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000423",0x00000000,"5" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000424",0x00000000,"2" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000425",0x00000000,"3" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000426",0x00000000,"3" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000427",0x00000000,"3" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000429",0x00000000,"" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000042a",0x00000000,"" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000042b",0x00000000,"11" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000042c",0x00000000,"6" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000082c",0x00000000,"5" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000042d",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000042f",0x00000000,"5" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000436",0x00000000,"1" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000437",0x00000000,"10" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000438",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000439",0x00000000,"f" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000043e",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000083e",0x00000000,"1" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000043f",0x00000000,"5" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000440",0x00000000,"5" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000441",0x00000000,"1" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000443",0x00000000,"6" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000843",0x00000000,"5" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000445",0x00000000,"f" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000455",0x00000000,"" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000456",0x00000000,"1" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","0000048f",0x00000000,"1" -;HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale","00000490",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale",,0x00000012 +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000402",0x00000000,"5" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000403",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000404",0x00000000,"9" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000804",0x00000000,"a" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000405",0x00000000,"2" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000406",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000407",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000807",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000c07",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00001407",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000408",0x00000000,"4" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000409",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000809",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000c09",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00001009",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00001409",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00001809",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00001c09",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00002009",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00003009",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00003409",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000040a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000080a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000c0a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000100a",0x00000000,"1" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000140a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000180a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00001c0a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000200a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000240a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000280a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00002c0a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000300a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000340a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000380a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00003c0a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000400a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000440a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000480a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00004c0a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000500a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000040b",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000040c",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000080c",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000c0c",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000100c",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000140c",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000180c",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000040d",0x00000000,"c" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000040e",0x00000000,"2" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000040f",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000410",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000810",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000411",0x00000000,"7" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000412",0x00000000,"8" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000413",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000813",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000414",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000814",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000415",0x00000000,"2" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000416",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000816",0x00000000,"1" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000417",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000418",0x00000000,"2" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000419",0x00000000,"5" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000041a",0x00000000,"2" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000081a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000c1a",0x00000000,"5" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000041b",0x00000000,"2" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000041c",0x00000000,"2" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000041d",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000081d",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000041e",0x00000000,"b" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000041f",0x00000000,"6" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000420",0x00000000,"" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000421",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000422",0x00000000,"5" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000423",0x00000000,"5" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000424",0x00000000,"2" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000425",0x00000000,"3" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000426",0x00000000,"3" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000427",0x00000000,"3" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000429",0x00000000,"" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000042a",0x00000000,"" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000042b",0x00000000,"11" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000042c",0x00000000,"6" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000082c",0x00000000,"5" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000042d",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000042f",0x00000000,"5" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000436",0x00000000,"1" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000437",0x00000000,"10" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000438",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000439",0x00000000,"f" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000043e",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000083e",0x00000000,"1" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000043f",0x00000000,"5" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000440",0x00000000,"5" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000441",0x00000000,"1" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000443",0x00000000,"6" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000843",0x00000000,"5" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000445",0x00000000,"f" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000455",0x00000000,"" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000456",0x00000000,"1" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","0000048f",0x00000000,"1" +;HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale","00000490",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language Groups","1",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language Groups","2",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language Groups","3",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language Groups","4",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language Groups","5",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language Groups","6",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language Groups","7",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language Groups","8",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language Groups","9",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language Groups","10",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language Groups","11",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language Groups","a",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language Groups","b",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language Groups","c",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language Groups","d",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language Groups","e",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Language Groups","f",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language Groups","1",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language Groups","2",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language Groups","3",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language Groups","4",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language Groups","5",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language Groups","6",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language Groups","7",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language Groups","8",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language Groups","9",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language Groups","10",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language Groups","11",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language Groups","a",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language Groups","b",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language Groups","c",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language Groups","d",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language Groups","e",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Language Groups","f",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale\Alternate Sorts","00010407",0x00000000,"1" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale\Alternate Sorts","0001040e",0x00000000,"2" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale\Alternate Sorts","00010437",0x00000000,"" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale\Alternate Sorts","00020804",0x00000000,"" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale\Alternate Sorts","00021004",0x00000000,"" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale\Alternate Sorts","00021404",0x00000000,"" -HKLM,"SYSTEM\CurrentControlSet\Control\NLS\Locale\Alternate Sorts","00030404",0x00000000,"" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale\Alternate Sorts","00010407",0x00000000,"1" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale\Alternate Sorts","0001040e",0x00000000,"2" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale\Alternate Sorts","00010437",0x00000000,"" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale\Alternate Sorts","00020804",0x00000000,"" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale\Alternate Sorts","00021004",0x00000000,"" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale\Alternate Sorts","00021404",0x00000000,"" +HKLM,"SYSTEM\CurrentControlSet\Control\Nls\Locale\Alternate Sorts","00030404",0x00000000,"" HKLM,"SYSTEM\CurrentControlSet\Control\PnP\Pci\CardList","Intel 82441FX",0x00030003,\ 01,00,00,00,86,80,37,12,00,00,00,00,00,00,00,00 @@ -1503,9 +1641,9 @@ HKLM,"SYSTEM\CurrentControlSet\Services\tcpsvcs","ObjectName",0x00000000,"LocalS HKLM,"SYSTEM\CurrentControlSet\Services\tcpsvcs","Start",0x00010001,0x00000003 HKLM,"SYSTEM\CurrentControlSet\Services\tcpsvcs","Type",0x00010001,0x00000020 -; ReactOS Telnet Daemon -HKLM,"SYSTEM\CurrentControlSet\Services\telnetd","Description",0x00000000,"ReactOS Telnet Daemon" -HKLM,"SYSTEM\CurrentControlSet\Services\telnetd","DisplayName",0x00000000,"ReactOS Telnet Daemon" +; ReactOS Telnet Service +HKLM,"SYSTEM\CurrentControlSet\Services\telnetd","Description",0x00000000,"ReactOS Telnet Service" +HKLM,"SYSTEM\CurrentControlSet\Services\telnetd","DisplayName",0x00000000,"ReactOS Telnet Service" HKLM,"SYSTEM\CurrentControlSet\Services\telnetd","ErrorControl",0x00010001,0x00000001 HKLM,"SYSTEM\CurrentControlSet\Services\telnetd","Group",0x00000000,"Network" HKLM,"SYSTEM\CurrentControlSet\Services\telnetd","ImagePath",0x00020000,"%SystemRoot%\system32\telnetd.exe" @@ -1571,11 +1709,11 @@ HKLM,"SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSe HKLM,"SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Services\Vga\Device0","DefaultSettings.YResolution",0x00010001,480 ; USB uhci/ehci driver -HKLM,"SYSTEM\CurrentControlSet\Services\usbdriver","ErrorControl",0x00010001,0x00000000 -HKLM,"SYSTEM\CurrentControlSet\Services\usbdriver","Group",0x00000000,"Base" -HKLM,"SYSTEM\CurrentControlSet\Services\usbdriver","ImagePath",0x00020000,"system32\drivers\usbdriver.sys" -HKLM,"SYSTEM\CurrentControlSet\Services\usbdriver","Start",0x00010001,0x00000001 -HKLM,"SYSTEM\CurrentControlSet\Services\usbdriver","Type",0x00010001,0x00000001 +;HKLM,"SYSTEM\CurrentControlSet\Services\usbdriver","ErrorControl",0x00010001,0x00000000 +;HKLM,"SYSTEM\CurrentControlSet\Services\usbdriver","Group",0x00000000,"Base" +;HKLM,"SYSTEM\CurrentControlSet\Services\usbdriver","ImagePath",0x00020000,"system32\drivers\usbdriver.sys" +;HKLM,"SYSTEM\CurrentControlSet\Services\usbdriver","Start",0x00010001,0x00000001 +;HKLM,"SYSTEM\CurrentControlSet\Services\usbdriver","Type",0x00010001,0x00000001 ; USB storage driver ;HKLM,"SYSTEM\CurrentControlSet\Services\usbstor","ErrorControl",0x00010001,0x00000000 diff --git a/boot/bootdata/livecd.ini b/boot/bootdata/livecd.ini index e43dbf6ad53..03064868afe 100644 --- a/boot/bootdata/livecd.ini +++ b/boot/bootdata/livecd.ini @@ -21,14 +21,8 @@ SelectedColor=Gray [Operating Systems] ReactOS="ReactOS" -Reactos_old="ReactOS (old boot method)" [ReactOS] BootType=Windows2003 SystemPath=LiveCD\reactos Options=/DEBUGPORT=COM1 /SOS /MININT - -[Reactos_old] -BootType=ReactOS -SystemPath=LiveCD\reactos -Options=/DEBUGPORT=COM1 /SOS diff --git a/boot/bootdata/packages/CMakeLists.txt b/boot/bootdata/packages/CMakeLists.txt index a9c7dbe4867..a87406a16c8 100644 --- a/boot/bootdata/packages/CMakeLists.txt +++ b/boot/bootdata/packages/CMakeLists.txt @@ -26,20 +26,16 @@ add_custom_command( ) # And now we build reactos.cab + +# First we create reactos.inf add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/reactos.inf COMMAND native-cabman -C ${CMAKE_CURRENT_BINARY_DIR}/reactos.dff -L ${CMAKE_CURRENT_BINARY_DIR} -I -P ${REACTOS_SOURCE_DIR} - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/reactos.dff -) -# add_custom_command( - # OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/reactos.cab - # COMMAND native-cabman -C ${CMAKE_CURRENT_BINARY_DIR}/reactos.dff -RC ${CMAKE_CURRENT_BINARY_DIR}/reactos.inf -L ${CMAKE_CURRENT_BINARY_DIR} -N -P ${REACTOS_SOURCE_DIR} - # DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/reactos.inf -# ) + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/reactos.dff native-cabman) + +# Then we create the actual cab file using a custom target +add_custom_target(reactos_cab + COMMAND native-cabman -C ${CMAKE_CURRENT_BINARY_DIR}/reactos.dff -RC ${CMAKE_CURRENT_BINARY_DIR}/reactos.inf -L ${CMAKE_CURRENT_BINARY_DIR} -N -P ${REACTOS_SOURCE_DIR} + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/reactos.inf native-cabman) -add_custom_target(reactos_cab - native-cabman -C ${CMAKE_CURRENT_BINARY_DIR}/reactos.dff -RC ${CMAKE_CURRENT_BINARY_DIR}/reactos.inf -L ${CMAKE_CURRENT_BINARY_DIR} -N -P ${REACTOS_SOURCE_DIR} - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/reactos.inf - VERBATIM) - add_cd_file(TARGET reactos_cab FILE ${CMAKE_CURRENT_BINARY_DIR}/reactos.cab ${CMAKE_CURRENT_BINARY_DIR}/reactos.inf DESTINATION reactos NO_CAB FOR bootcd regtest) diff --git a/boot/bootdata/packages/reactos.dff b/boot/bootdata/packages/reactos.dff index 8416c1b3105..14b02a63f34 100644 --- a/boot/bootdata/packages/reactos.dff +++ b/boot/bootdata/packages/reactos.dff @@ -47,6 +47,7 @@ base\applications\dxdiag\dxdiag.exe 1 base\applications\extrac32\extrac32.exe 1 base\applications\findstr\findstr.exe 1 base\applications\fontview\fontview.exe 1 +base\applications\iexplore\iexplore.exe 1 base\applications\games\solitaire\sol.exe 1 base\applications\games\spider\spider.exe 1 base\applications\games\winmine\winmine.exe 1 @@ -141,6 +142,7 @@ dll\cpl\console\console.dll 1 dll\cpl\desk\desk.cpl 1 dll\cpl\hdwwiz\hdwwiz.cpl 1 dll\cpl\input\input.dll 1 +dll\cpl\inetcpl\inetcpl.cpl 1 dll\cpl\intl\intl.cpl 1 dll\cpl\joy\joy.cpl 1 ;dll\cpl\liccpa\liccpa.cpl 1 @@ -538,14 +540,14 @@ drivers\storage\ide\pciidex\pciidex.sys 2 ;drivers\usb\miniport\usbuhci\usbuhci.sys 2 ;drivers\usb\usbhub\usbhub.sys 2 ;drivers\usb\usbport\usbport.sys 2 -drivers\usb\nt4compat\usbdriver\usbdriver.sys 2 +;drivers\usb\nt4compat\usbdriver\usbdriver.sys 2 drivers\video\displays\vga\vgaddi.dll 1 drivers\video\displays\framebuf\framebuf.dll 1 drivers\video\miniport\vga\vgamp.sys 2 drivers\video\miniport\vbe\vbemp.sys 2 drivers\video\videoprt\videoprt.sys 2 -drivers\video\font\ftfd\ftfd.dll 1 +drivers\video\font\ftfd\ftfd.dll 1 drivers\wdm\audio\filters\kmixer\kmixer.sys 2 drivers\wdm\audio\sysaudio\sysaudio.sys 2 @@ -657,9 +659,11 @@ media\inf\acpi.inf 6 media\inf\battery.inf 6 media\inf\cdrom.inf 6 media\inf\cpu.inf 6 +media\inf\disk.inf 6 media\inf\display.inf 6 media\inf\font.inf 6 media\inf\fdc.inf 6 +media\inf\hal.inf 6 media\inf\hdc.inf 6 media\inf\intl.inf 6 media\inf\layout.inf 6 @@ -675,6 +679,7 @@ media\inf\nettcpip.inf 6 media\inf\ports.inf 6 media\inf\scsi.inf 6 media\inf\syssetup.inf 6 +media\inf\unknown.inf 6 media\inf\usbport.inf 6 media\inf\usb.inf 6 media\inf\usbstor.inf 6 @@ -797,6 +802,7 @@ modules\rostests\winetests\gdi32\gdi32_winetest.exe 7 o modules\rostests\winetests\gdiplus\gdiplus_winetest.exe 7 optional modules\rostests\winetests\hlink\hlink_winetest.exe 7 optional modules\rostests\winetests\icmp\icmp_winetest.exe 7 optional +modules\rostests\winetests\imagehlp\imagehlp_winetest.exe 7 optional modules\rostests\winetests\imm32\imm32_winetest.exe 7 optional modules\rostests\winetests\inetcomm\inetcomm_winetest.exe 7 optional modules\rostests\winetests\inetmib1\inetmib1_winetest.exe 7 optional @@ -851,6 +857,7 @@ modules\rostests\winetests\spoolss\spoolss_winetest.exe 7 o modules\rostests\winetests\twain_32\twain_32_winetest.exe 7 optional modules\rostests\winetests\urlmon\urlmon_winetest.exe 7 optional modules\rostests\winetests\user32\user32_winetest.exe 7 optional +modules\rostests\winetests\userenv\userenv_winetest.exe 7 optional modules\rostests\winetests\usp10\usp10_winetest.exe 7 optional modules\rostests\winetests\uxtheme\uxtheme_winetest.exe 7 optional modules\rostests\winetests\version\version_winetest.exe 7 optional @@ -865,6 +872,7 @@ modules\rostests\winetests\xmllite\xmllite_winetest.exe 7 o modules\rostests\apitests\dciman32\dciman32_apitest.exe 7 optional modules\rostests\apitests\gdi32\gdi32_apitest.exe 7 optional +modules\rostests\apitests\kernel32\kernel32_apitest.exe 7 optional modules\rostests\apitests\ntdll\ntdll_apitest.exe 7 optional modules\rostests\apitests\user32\user32_apitest.exe 7 optional modules\rostests\apitests\ws2_32\ws2_32_apitest.exe 7 optional diff --git a/boot/bootdata/txtsetup.sif b/boot/bootdata/txtsetup.sif index 3b89c64499f..140d4ebce3c 100644 --- a/boot/bootdata/txtsetup.sif +++ b/boot/bootdata/txtsetup.sif @@ -41,6 +41,8 @@ fastfat.sys=,,,,,,x,,,,,,4 ramdisk.sys=,,,,,,x,,,,,,4 ext2fs.sys=,,,,,,x,,,,,,4 classpnp.sys=,,,,,,,,,,,,4 +pciide.sys=,,,,,,,,,,,,4 +pciidex.sys=,,,,,,,,,,,,4 pcix.sys=,,,,,,,,,,,,4 pcmcia.sys=,,,,,,,,,,,,4 swenum.sys=,,,,,,,,,,,,4 @@ -52,12 +54,25 @@ ntdll.dll=,,,,,,,,,,,,2 *PNP0C08 = acpi ;PCI\CC_0601 = isapnp PCI\CC_0604 = pci +PCI\VEN_104B&CC_0100 = buslogic +PCI\CC_0101 = pciide +PCI\CC_0104 = uniata +PCI\CC_0105 = uniata +PCI\CC_0106 = uniata +*PNP0600 = uniata [BootBusExtenders.Load] acpi = acpi.sys pci = pci.sys isapnp = isapnp.sys +[BusExtenders.Load] +pciide = pciide.sys + +[SCSI.Load] +uniata = uniata.sys +buslogic = buslogic.sys + [Cabinets] Cabinet=reactos.cab @@ -76,13 +91,17 @@ DefaultLayout = 00000409 DefaultLanguage = 00000409 [Computer] -pci_up = "Standard-PC" -pci_mp = "Standard-PC Multiprocessor" +pci_up = "Standard PC Uniprocessor" +pci_mp = "Standard PC Multiprocessor" +acpi_up = "ACPI PC Uniprocessor" +acpi_mp = "ACPI PC Multiprocessor" [Map.Computer] ; = pci_up = "PC UP" pci_mp = "PC MP" +acpi_up = "ACPI UP" +acpi_mp = "ACPI MP" [Files.pci_up] ntoskrnl.exe=,,,,,,,,,,,,2 @@ -92,6 +111,14 @@ hal.dll=,,,,,,,,,,,,2 ntkrnlmp.exe=,,,,,,,,,,ntoskrnl.exe,,2 halmps.dll=,,,,,,,,,,hal.dll,,2 +[Files.acpi_up] +ntoskrnl.exe=,,,,,,,,,,,,2 +halacpi.dll=,,,,,,,,,,hal.dll,,2 + +[Files.acpi_mp] +ntkrnlmp.exe=,,,,,,,,,,ntoskrnl.exe,,2 +halacpi.dll=,,,,,,,,,,hal.dll,,2 + [Display] ; = ,,,,, vga = "VGA Display (640x480x4)",,Vga,640,480,4 diff --git a/boot/freeldr/bootsect/CMakeLists.txt b/boot/freeldr/bootsect/CMakeLists.txt index 406799a62bf..09674206eb8 100644 --- a/boot/freeldr/bootsect/CMakeLists.txt +++ b/boot/freeldr/bootsect/CMakeLists.txt @@ -1,14 +1,23 @@ -CreateBootSectorTarget(dosmbr ${CMAKE_CURRENT_SOURCE_DIR}/dosmbr.asm ${CMAKE_CURRENT_BINARY_DIR}/dosmbr.bin) -CreateBootSectorTarget(ext2 ${CMAKE_CURRENT_SOURCE_DIR}/ext2.asm ${CMAKE_CURRENT_BINARY_DIR}/ext2.bin) -CreateBootSectorTarget(fat32 ${CMAKE_CURRENT_SOURCE_DIR}/fat32.asm ${CMAKE_CURRENT_BINARY_DIR}/fat32.bin) -CreateBootSectorTarget(fat ${CMAKE_CURRENT_SOURCE_DIR}/fat.asm ${CMAKE_CURRENT_BINARY_DIR}/fat.bin) -CreateBootSectorTarget(isoboot ${CMAKE_CURRENT_SOURCE_DIR}/isoboot.asm ${CMAKE_CURRENT_BINARY_DIR}/isoboot.bin) -CreateBootSectorTarget(isobtrt ${CMAKE_CURRENT_SOURCE_DIR}/isobtrt.asm ${CMAKE_CURRENT_BINARY_DIR}/isobtrt.bin) +if(ARCH MATCHES i386 OR ARCH MATCHES amd64) + +CreateBootSectorTarget2(dosmbr ${CMAKE_CURRENT_SOURCE_DIR}/dosmbr.S ${CMAKE_CURRENT_BINARY_DIR}/dosmbr.bin 7c00) +#CreateBootSectorTarget2(ext2 ${CMAKE_CURRENT_SOURCE_DIR}/ext2.S ${CMAKE_CURRENT_BINARY_DIR}/ext2.bin 0) +CreateBootSectorTarget2(fat32 ${CMAKE_CURRENT_SOURCE_DIR}/fat32.S ${CMAKE_CURRENT_BINARY_DIR}/fat32.bin 7c00) +CreateBootSectorTarget2(fat ${CMAKE_CURRENT_SOURCE_DIR}/fat.S ${CMAKE_CURRENT_BINARY_DIR}/fat.bin 7c00) +CreateBootSectorTarget2(isoboot ${CMAKE_CURRENT_SOURCE_DIR}/isoboot.S ${CMAKE_CURRENT_BINARY_DIR}/isoboot.bin 7000) +CreateBootSectorTarget2(isobtrt ${CMAKE_CURRENT_SOURCE_DIR}/isobtrt.S ${CMAKE_CURRENT_BINARY_DIR}/isobtrt.bin 7000) add_cd_file(TARGET dosmbr DESTINATION loader NO_CAB FILE ${CMAKE_CURRENT_BINARY_DIR}/dosmbr.bin FOR all) -add_cd_file(TARGET ext2 DESTINATION loader NO_CAB FILE ${CMAKE_CURRENT_BINARY_DIR}/ext2.bin FOR all) add_cd_file(TARGET fat32 DESTINATION loader NO_CAB FILE ${CMAKE_CURRENT_BINARY_DIR}/fat32.bin FOR all) add_cd_file(TARGET fat DESTINATION loader NO_CAB FILE ${CMAKE_CURRENT_BINARY_DIR}/fat.bin FOR all) add_cd_file(TARGET isoboot DESTINATION loader NO_CAB FILE ${CMAKE_CURRENT_BINARY_DIR}/isoboot.bin FOR all) -add_cd_file(TARGET isobtrt DESTINATION loader NO_CAB FILE ${CMAKE_CURRENT_BINARY_DIR}/isobtrt.bin FOR all) \ No newline at end of file +add_cd_file(TARGET isobtrt DESTINATION loader NO_CAB FILE ${CMAKE_CURRENT_BINARY_DIR}/isobtrt.bin FOR all) + +if(NOT MSVC) + CreateBootSectorTarget(ext2 ${CMAKE_CURRENT_SOURCE_DIR}/ext2.asm ${CMAKE_CURRENT_BINARY_DIR}/ext2.bin 0) + add_cd_file(TARGET ext2 DESTINATION loader NO_CAB FILE ${CMAKE_CURRENT_BINARY_DIR}/ext2.bin FOR all) +endif() + +endif() + diff --git a/boot/freeldr/bootsect/dosmbr.S b/boot/freeldr/bootsect/dosmbr.S new file mode 100644 index 00000000000..49fce6338d8 --- /dev/null +++ b/boot/freeldr/bootsect/dosmbr.S @@ -0,0 +1,187 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Bootsector for ISO file system + * PURPOSE: Normal DOS boot sector + * Ported to nasm from FreeDOS fdisk 1.2.0 by: + * PROGRAMMERS: Casper Hornstrup (chorns@users.sourceforge.net) + */ + +/* INCLUDES ******************************************************************/ + +#include + +//----------------------------------------------------------------------- +// ENTRY (copied from freedos bootsector) +// +// IN: DL = boot drive +// OUT: DL = boot drive +// +//----------------------------------------------------------------------- + +.code16 +real_start: + cli + cld + xor ax, ax + mov ss, ax // initialize stack + mov ds, ax + mov bp, HEX(7c00) + lea sp, [bp-32] + sti + + /* Copy 512 bytes of MBR to 1fe0:7c00 */ + mov ax, HEX(1FE0) + mov es, ax + mov si, bp + mov di, bp + mov cx, 256 + rep movsw + + /* Jump into relocated code */ + ljmp16 HEX(1FE0), cont +cont: + + /* Setup segment registers */ + mov ds, ax + mov ss, ax + xor ax, ax + mov es, ax + + /* Search for active partition */ + lea di, [bp + HEX(1be)] // start of partition table +test_next_for_active: + test byte ptr ds:[di], HEX(80) + jne active_partition_found + add di, 16 // next table + cmp di, HEX(07c00) + HEX(1fe) // scanned beyond end of table ?? + jb test_next_for_active + +/*****************************************************************/ + call print + .asciz "no active partition found" + +WAIT_FOR_REBOOT: + jmp WAIT_FOR_REBOOT + + +/*****************************************************************/ +trouble_reading_drive: + call print + .asciz "read error while reading drive" + jmp WAIT_FOR_REBOOT + +/*****************************************************************/ + +invalid_partition_code: + call print + .asciz "partition signature != 55AA" + + jmp WAIT_FOR_REBOOT + +/*****************************************************************/ + +active_partition_found: +// call print +// .asciz "loading active partition" + + call read_boot_sector + + jc trouble_reading_drive + + cmp word ptr es:[HEX(7c00)+HEX(1fe)], HEX(0aa55) + jne invalid_partition_code + + ljmp16 0, HEX(7c00) // and jump to boot sector code + +/***************************** + * read_boot_sector + * + * IN: DI--> partition info + * OUT:CARRY + *****************************/ +read_boot_sector: + /* check for LBA support */ + mov bx, HEX(55aa) + mov ah, HEX(41) + int HEX(13) + + jc StandardBios // if (regs.b.x != 0xaa55 || (regs.flags & 0x01)) + cmp bx, HEX(0aa55) // goto StandardBios; + jne StandardBios + + /* if DAP cannot be used, don't use LBA + if ((regs.c.x & 1) == 0) + goto StandardBios; */ + test cl, 1 + jz StandardBios + + jmp short LBABios + + +_bios_LBA_address_packet: + .byte 16 + .byte 0 + .byte 4 // read four sectors - why not + .byte 0 + .word HEX(7c00) // fixed boot address for DOS sector + .word HEX(0000) + +_bios_LBA_low: + .word 0 +_bios_LBA_high: + .word 0 + .word 0,0 + + +LBABios: + // copy start address of partition to DAP + mov ax, [di + 8] + mov word ptr ds:[_bios_LBA_low], ax + mov ax,[di + 8 + 2] + mov word ptr ds:[_bios_LBA_high], ax + + mov ax, HEX(4200) // regs.a.x = LBA_READ; + mov si, offset _bios_LBA_address_packet // regs.si = FP_OFF(&dap); + + int HEX(13) + ret + +/***************************************************************** + * read disk, using standard BIOS + */ +StandardBios: + mov ax, HEX(0204) // regs.a.x = 0x0201; + mov bx, HEX(7c00) // regs.b.x = FP_OFF(buffer); + + /* regs.c.x = + ((chs.Cylinder & 0xff) << 8) + ((chs.Cylinder & 0x300) >> 2) + + ; chs.Sector; + that was easy ;-) */ + mov cx, word ptr ds:[di + 2] + mov dh, byte ptr ds:[di + 1] // regs.d.b.h = chs.Head; + // regs.es = FP_SEG(buffer); + int HEX(13) + ret + +/****** PRINT + * prints text after call to this function. + */ +print_1char: + xor bx, bx // video page 0 + mov ah, HEX(0E) // else print it + int HEX(10) // via TTY mode +print: + pop si // this is the first character +print1: + lodsb // get token + push si // stack up potential return address + cmp al, 0 // end of string? + jne print_1char // until done + ret // and jump to it + +.org 510 + .byte HEX(55), HEX(0aa) + +.endcode16 + +END diff --git a/boot/freeldr/bootsect/fat.S b/boot/freeldr/bootsect/fat.S new file mode 100644 index 00000000000..e9eb2ee8982 --- /dev/null +++ b/boot/freeldr/bootsect/fat.S @@ -0,0 +1,429 @@ +// FAT.ASM +// FAT12/16 Boot Sector +// Copyright (c) 1998, 2001, 2002 Brian Palmer + + + +// This is a FAT12/16 file system boot sector +// that searches the entire root directory +// for the file freeldr.sys and loads it into +// memory. +// +// The stack is set to 0000:7BF2 so that the first +// WORD pushed will be placed at 0000:7BF0 +// +// The DWORD at 0000:7BFC or BP-04h is the logical +// sector number of the start of the data area. +// +// The DWORD at 0000:7BF8 or BP-08h is the total +// sector count of the boot drive as reported by +// the computers bios. +// +// The WORD at 0000:7BF6 or BP-0ah is the offset +// of the ReadSectors function in the boot sector. +// +// The WORD at 0000:7BF4 or BP-0ch is the offset +// of the ReadCluster function in the boot sector. +// +// The WORD at 0000:7BF2 or BP-0eh is the offset +// of the PutChars function in the boot sector. +// +// When it locates freeldr.sys on the disk it will +// load the first sector of the file to 0000:8000 +// With the help of this sector we should be able +// to load the entire file off the disk, no matter +// how fragmented it is. +// +// We load the entire FAT table into memory at +// 7000:0000. This improves the speed of floppy disk +// boots dramatically. + +#include +#include "../freeldr/include/arch/pc/x86common.h" + +#define BP_REL(x) [bp+x-offset start] + +DataAreaStartHigh = 2 +DataAreaStartLow = 4 +BiosCHSDriveSizeHigh = 6 +BiosCHSDriveSizeLow = 8 +BiosCHSDriveSize = 8 +ReadSectorsOffset = 10 +ReadClusterOffset = 12 +PutCharsOffset = 14 +BootSectorStackTop = HEX(7c00) - 16 + + +// org 7c00h + +.code16 + +start: + jmp main + nop + +OEMName: + .ascii "FrLdr1.0" +BytesPerSector: + .word 512 +SectsPerCluster: + .byte 1 +ReservedSectors: + .word 1 +NumberOfFats: + .byte 2 +MaxRootEntries: + .word 224 +TotalSectors: + .word 2880 +MediaDescriptor: + .byte HEX(0f0) +SectorsPerFat: + .word 9 +SectorsPerTrack: + .word 18 +NumberOfHeads: + .word 2 +HiddenSectors: + .long 0 +TotalSectorsBig: + .long 0 +BootDrive: + .byte HEX(0ff) +Reserved: + .byte 0 +ExtendSig: + .byte HEX(29) +SerialNumber: + .long 00000000 +VolumeLabel: + .ascii "NO NAME " +FileSystem: + .ascii "FAT12 " + +main: + xor ax, ax + mov ss, ax + mov bp, HEX(7c00) + mov sp, BootSectorStackTop // Setup a stack + mov ds, ax // Make DS correct + mov es, ax // Make ES correct + + cmp byte ptr BP_REL(BootDrive), HEX(0ff) // If they have specified a boot drive then use it + jne GetDriveParameters + + mov byte ptr BP_REL(BootDrive), dl // Save the boot drive + + +GetDriveParameters: + mov ah, 8 + mov dl, byte ptr BP_REL(BootDrive) // Get boot drive in dl + int HEX(13) // Request drive parameters from the bios + jnc CalcDriveSize // If the call succeeded then calculate the drive size + + // If we get here then the call to the BIOS failed + // so just set CHS equal to the maximum addressable + // size + mov cx, HEX(0ffff) + mov dh, cl + +CalcDriveSize: + // Now that we have the drive geometry + // lets calculate the drive size + mov bl, ch // Put the low 8-bits of the cylinder count into BL + mov bh, cl // Put the high 2-bits in BH + shr bh, 6 // Shift them into position, now BX contains the cylinder count + and cl, HEX(3f) // Mask off cylinder bits from sector count + // CL now contains sectors per track and DH contains head count + movzx eax, dh // Move the heads into EAX + movzx ebx, bx // Move the cylinders into EBX + movzx ecx, cl // Move the sectors per track into ECX + inc eax // Make it one based because the bios returns it zero based + inc ebx // Make the cylinder count one based also + mul ecx // Multiply heads with the sectors per track, result in edx:eax + mul ebx // Multiply the cylinders with (heads * sectors) [stored in edx:eax already] + + // We now have the total number of sectors as reported + // by the bios in eax, so store it in our variable + mov dword ptr [bp - BiosCHSDriveSize], eax + + + // Now we must find our way to the first sector of the root directory + xor ax, ax + xor cx, cx + mov al, byte ptr BP_REL(NumberOfFats) // Number of fats + mul word ptr BP_REL(SectorsPerFat) // Times sectors per fat + add ax, word ptr BP_REL(HiddenSectors) + adc dx, word ptr BP_REL(HiddenSectors+2) // Add the number of hidden sectors + add ax, word ptr BP_REL(ReservedSectors) // Add the number of reserved sectors + adc dx, cx // Add carry bit + mov word ptr [bp - DataAreaStartLow], ax // Save the starting sector of the root directory + mov word ptr [bp - DataAreaStartHigh], dx // Save it in the first 4 bytes before the boot sector + mov si, word ptr BP_REL(MaxRootEntries) // Get number of root dir entries in SI + pusha // Save 32-bit logical start sector of root dir + // DX:AX now has the number of the starting sector of the root directory + + // Now calculate the size of the root directory + xor dx, dx + mov ax, 32 // Size of dir entry + mul si // Times the number of entries + mov bx, word ptr BP_REL(BytesPerSector) + add ax, bx + dec ax + div bx // Divided by the size of a sector + // AX now has the number of root directory sectors + + add word ptr [bp - DataAreaStartLow], ax // Add the number of sectors of the root directory to our other value + adc word ptr [bp - DataAreaStartHigh], cx // Now the first 4 bytes before the boot sector contain the starting sector of the data area + popa // Restore root dir logical sector start to DX:AX + +LoadRootDirSector: + mov bx, HEX(7e0) // We will load the root directory sector + mov es, bx // Right after the boot sector in memory + xor bx, bx // We will load it to [0000:7e00h] + xor cx, cx // Zero out CX + inc cx // Now increment it to 1, we are reading one sector + xor di, di // Zero out di + push es // Save ES because it will get incremented by 20h + call ReadSectors // Read the first sector of the root directory + pop es // Restore ES (ES:DI = 07E0:0000) + +SearchRootDirSector: + cmp byte ptr es:[di], ch // If the first byte of the directory entry is zero then we have + jz ErrBoot // reached the end of the directory and FREELDR.SYS is not here so reboot + pusha // Save all registers + mov cl, 11 // Put 11 in cl (length of filename in directory entry) + mov si, offset filename // Put offset of filename string in DS:SI + repe cmpsb // Compare this directory entry against 'FREELDR SYS' + popa // Restore all the registers + jz FoundFreeLoader // If we found it then jump + dec si // SI holds MaxRootEntries, subtract one + jz ErrBoot // If we are out of root dir entries then reboot + add di, 32 // Increment DI by the size of a directory entry + cmp di, HEX(0200) // Compare DI to 512 (DI has offset to next dir entry, make sure we haven't gone over one sector) + jc SearchRootDirSector // If DI is less than 512 loop again + jmp short LoadRootDirSector // Didn't find FREELDR.SYS in this directory sector, try again + +FoundFreeLoader: + // We found freeldr.sys on the disk + // so we need to load the first 512 + // bytes of it to 0000:F800 + // ES:DI has dir entry (ES:DI == 07E0:XXXX) + mov ax, word ptr es:[di + HEX(1a)] // Get start cluster + push ax // Save start cluster + push FREELDR_BASE / 16 // Put load segment on the stack and load it + pop es // Into ES so that we load the cluster at 0000:F800 + call ReadCluster // Read the cluster + pop ax // Restore start cluster of FreeLoader + + // Save the addresses of needed functions so + // the helper code will know where to call them. + mov word ptr [bp-ReadSectorsOffset], offset ReadSectors // Save the address of ReadSectors + mov word ptr [bp-ReadClusterOffset], offset ReadCluster // Save the address of ReadCluster + mov word ptr [bp-PutCharsOffset], offset PutChars // Save the address of PutChars + + // Now AX has start cluster of FreeLoader and we + // have loaded the helper code in the first 512 bytes + // of FreeLoader to 0000:F800. Now transfer control + // to the helper code. Skip the first three bytes + // because they contain a jump instruction to skip + // over the helper code in the FreeLoader image. + ljmp16 0, FREELDR_BASE + 3 + + + + +// Displays an error message +// And reboots +ErrBoot: + mov si, offset msgFreeLdr // FreeLdr not found message + call PutChars // Display it + +Reboot: +// mov si, offset msgAnyKey // Press any key message +// call PutChars // Display it + xor ax, ax + int HEX(16) // Wait for a keypress + int HEX(19) // Reboot + +PutChars: + lodsb + or al,al + jz short Done + mov ah, HEX(0e) + mov bx, 7 + int HEX(10) + jmp short PutChars +Done: + ret + +// Displays a bad boot message +// And reboots +BadBoot: + mov si, offset msgDiskError // Bad boot disk message + call PutChars // Display it + + jmp short Reboot + + +// Reads cluster number in AX into [ES:0000] +ReadCluster: + // StartSector = ((Cluster - 2) * SectorsPerCluster) + ReservedSectors + HiddenSectors; + dec ax // Adjust start cluster by 2 + dec ax // Because the data area starts on cluster 2 + xor ch, ch + mov cl, byte ptr BP_REL(SectsPerCluster) + mul cx // Times sectors per cluster + add ax, [bp-DataAreaStartLow] // Add start of data area + adc dx, [bp-DataAreaStartHigh] // Now we have DX:AX with the logical start sector of OSLOADER.SYS + xor bx, bx // We will load it to [ES:0000], ES loaded before function call + //mov cl,BYTE [BYTE bp+SectsPerCluster]// Sectors per cluster still in CX + //call ReadSectors + //ret + + + +// Reads logical sectors into [ES:BX] +// DX:AX has logical sector number to read +// CX has number of sectors to read +ReadSectors: + + // We can't just check if the start sector is + // in the BIOS CHS range. We have to check if + // the start sector + length is in that range. + pusha + dec cx + add ax, cx + adc dx, 0 + + cmp dx, word ptr [bp-BiosCHSDriveSizeHigh] // Check if they are reading a sector within CHS range + ja ReadSectorsLBA // No - go to the LBA routine + jb ReadSectorsCHS // Yes - go to the old CHS routine + cmp ax, word ptr [bp-BiosCHSDriveSizeLow] // Check if they are reading a sector within CHS range + jbe ReadSectorsCHS // Yes - go to the old CHS routine + +ReadSectorsLBA: + popa +ReadSectorsLBALoop: + pusha // Save logical sector number & sector count + + push 0 + push 0 + push dx // Put 64-bit logical + push ax // block address on stack + push es // Put transfer segment on stack + push bx // Put transfer offset on stack + push 1 // Set transfer count to 1 sector + push HEX(10) // Set size of packet to 10h + mov si,sp // Setup disk address packet on stack + +// We are so totally out of space here that I am forced to +// comment out this very beautifully written piece of code +// It would have been nice to have had this check... +//CheckInt13hExtensions: // Now make sure this computer supports extended reads +// mov ah,0x41 // AH = 41h +// mov bx,0x55aa // BX = 55AAh +// mov dl,[BYTE bp+BootDrive] // DL = drive (80h-FFh) +// int 13h // IBM/MS INT 13 Extensions - INSTALLATION CHECK +// jc PrintDiskError // CF set on error (extensions not supported) +// cmp bx,0xaa55 // BX = AA55h if installed +// jne PrintDiskError +// test cl,1 // CX = API subset support bitmap +// jz PrintDiskError // Bit 0, extended disk access functions (AH=42h-44h,47h,48h) supported + + + // Good, we're here so the computer supports LBA disk access + // So finish the extended read + mov dl, byte ptr BP_REL(BootDrive) // Drive number + mov ah, HEX(42) // Int 13h, AH = 42h - Extended Read + int HEX(13) // Call BIOS + jc BadBoot // If the read failed then abort + + add sp, 16 // Remove disk address packet from stack + + popa // Restore sector count & logical sector number + + inc ax // Increment Sector to Read + adc dx, 0 + + push bx + mov bx, es + add bx, HEX(20) // Increment read buffer for next sector + mov es, bx + pop bx + + loop ReadSectorsLBALoop // Read next sector + + ret + + +// Reads logical sectors into [ES:BX] +// DX:AX has logical sector number to read +// CX has number of sectors to read +// CarryFlag set on error +ReadSectorsCHS: + popa +ReadSectorsCHSLoop: + pusha + xchg ax, cx + xchg ax, dx + xor dx, dx + div word ptr BP_REL(SectorsPerTrack) + xchg ax, cx + div word ptr BP_REL(SectorsPerTrack) // Divide logical by SectorsPerTrack + inc dx // Sectors numbering starts at 1 not 0 + xchg cx, dx + div word ptr BP_REL(NumberOfHeads) // Number of heads + mov dh, dl // Head to DH, drive to DL + mov dl, byte ptr BP_REL(BootDrive) // Drive number + mov ch, al // Cylinder in CX + ror ah, 2 // Low 8 bits of cylinder in CH, high 2 bits + // in CL shifted to bits 6 & 7 + or cl, ah // Or with sector number + mov ax, HEX(0201) + int HEX(13) // DISK - READ SECTORS INTO MEMORY + // AL = number of sectors to read, CH = track, CL = sector + // DH = head, DL = drive, ES:BX -> buffer to fill + // Return: CF set on error, AH = status (see AH=01h), AL = number of sectors read + + jc BadBoot + + popa + inc ax //Increment Sector to Read + jnz NoCarryCHS + inc dx + + +NoCarryCHS: + push bx + mov bx, es + add bx, HEX(20) + mov es, bx + pop bx + // Increment read buffer for next sector + loop ReadSectorsCHSLoop // Read next sector + + ret + + +msgDiskError: + .ascii "Disk error", CR, LF, NUL +msgFreeLdr: + .ascii "ldr not found", CR, LF, NUL +// Sorry, need the space... +//msgAnyKey: +// .ascii "Press any key to restart", CR, LF, NUL +filename: + .ascii "FREELDR SYS" + + .org 509 // Pad to 509 bytes + +BootPartition: + .byte 0 + +BootSignature: + .word HEX(0aa55) // BootSector signature + +.endcode16 + +END diff --git a/boot/freeldr/bootsect/fat32.S b/boot/freeldr/bootsect/fat32.S new file mode 100644 index 00000000000..96ff1880564 --- /dev/null +++ b/boot/freeldr/bootsect/fat32.S @@ -0,0 +1,540 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Bootsector + * FILE: + * PURPOSE: + * PROGRAMMERS: ? + */ + +/* INCLUDES ******************************************************************/ + +#include +#include "../freeldr/include/arch/pc/x86common.h" + +#define BP_REL(x) [bp+x-offset start] + +.code16 + +//ORG HEX(7c00) + +start: + jmp short main + nop + +OEMName: + .ASCII "FrLdr1.0" +BytesPerSector: + .word 512 +SectsPerCluster: + .byte 0 +ReservedSectors: + .word 32 +NumberOfFats: + .byte 2 +MaxRootEntries: + .word 0 // Always zero for FAT32 volumes +TotalSectors: + .word 0 // Always zero for FAT32 volumes +MediaDescriptor: + .byte HEX(0f8) +SectorsPerFat: + .word 0 // Always zero for FAT32 volumes +SectorsPerTrack: + .word 0 +NumberOfHeads: + .word 0 +HiddenSectors: + .long 0 +TotalSectorsBig: + .long 0 + +// FAT32 Inserted Info +SectorsPerFatBig: + .long 0 +ExtendedFlags: + .word 0 +FSVersion: + .word 0 +RootDirStartCluster: + .long 0 +FSInfoSector: + .word 0 +BackupBootSector: + .word 6 +Reserved1: + .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + +// End FAT32 Inserted Info +BootDrive: + .byte 0 +Reserved: + .byte 0 +ExtendSig: + .byte HEX(29) +SerialNumber: + .long 0 +VolumeLabel: + .ascii "NO NAME " +FileSystem: + .ascii "FAT32 " + +main: + xor ax,ax // Setup segment registers + mov ds,ax // Make DS correct + mov es,ax // Make ES correct + mov ss,ax // Make SS correct + mov bp, HEX(7c00) + mov sp, HEX(7c00) // Setup a stack + + cmp byte ptr BP_REL(BootDrive), HEX(0ff) // If they have specified a boot drive then use it + jne CheckSectorsPerFat + + mov byte ptr BP_REL(BootDrive), dl // Save the boot drive + +CheckSectorsPerFat: + + cmp word ptr BP_REL(SectorsPerFat), 0 // Check the old 16-bit value of SectorsPerFat + jnz CheckFailed // If it is non-zero then exit with an error +CheckTotalSectors: // Check the old 16-bit value of TotalSectors & MaxRootEntries + cmp dword ptr BP_REL(MaxRootEntries), 0// by comparing the DWORD at offset MaxRootEntries to zero + jnz CheckFailed // If it is non-zero then exit with an error +CheckFileSystemVersion: + cmp word ptr BP_REL(FSVersion), 0 // Check the file system version word + jna GetDriveParameters // It is zero, so continue +CheckFailed: + jmp PrintFileSystemError // If it is not zero then exit with an error + +GetDriveParameters: + mov ax, HEX(0800) + mov dl, byte ptr BP_REL(BootDrive) // Get boot drive in dl + int HEX(13) // Request drive parameters from the bios + jnc CalcDriveSize // If the call succeeded then calculate the drive size + + // If we get here then the call to the BIOS failed + // so just set CHS equal to the maximum addressable + // size + mov cx, HEX(0ffff) + mov dh, cl + +CalcDriveSize: + // Now that we have the drive geometry + // lets calculate the drive size + mov bl, ch // Put the low 8-bits of the cylinder count into BL + mov bh, cl // Put the high 2-bits in BH + shr bh, 6 // Shift them into position, now BX contains the cylinder count + and cl, HEX(3f) // Mask off cylinder bits from sector count + // CL now contains sectors per track and DH contains head count + movzx eax, dh // Move the heads into EAX + movzx ebx, bx // Move the cylinders into EBX + movzx ecx, cl // Move the sectors per track into ECX + inc eax // Make it one based because the bios returns it zero based + inc ebx // Make the cylinder count one based also + mul ecx // Multiply heads with the sectors per track, result in edx:eax + mul ebx // Multiply the cylinders with (heads * sectors) [stored in edx:eax already] + + // We now have the total number of sectors as reported + // by the bios in eax, so store it in our variable + mov dword ptr ds:[BiosCHSDriveSize], eax + +LoadExtraBootCode: + // First we have to load our extra boot code at + // sector 14 into memory at [0000:7e00h] + mov eax, HEX(0e) + add eax, dword ptr BP_REL(HiddenSectors) // Add the number of hidden sectors + mov cx, 1 + xor bx, bx + mov es, bx // Read sector to [0000:7e00h] + mov bx, HEX(7e00) + call ReadSectors + jmp StartSearch + + +// Reads logical sectors into [ES:BX] +// EAX has logical sector number to read +// CX has number of sectors to read +ReadSectors: + push es + cmp eax, dword ptr ds:[BiosCHSDriveSize] // Check if they are reading a sector outside CHS range + jae ReadSectorsLBA // Yes - go to the LBA routine + // If at all possible we want to use LBA routines because + // They are optimized to read more than 1 sector per read + + pushad // Save logical sector number & sector count + +CheckInt13hExtensions: // Now check if this computer supports extended reads + mov ah, HEX(41) // AH = 41h + mov bx, HEX(55aa) // BX = 55AAh + mov dl, byte ptr BP_REL(BootDrive) // DL = drive (80h-FFh) + int HEX(13) // IBM/MS INT 13 Extensions - INSTALLATION CHECK + jc ReadSectorsCHS // CF set on error (extensions not supported) + cmp bx, HEX(0aa55) // BX = AA55h if installed + jne ReadSectorsCHS + test cl,1 // CX = API subset support bitmap + jz ReadSectorsCHS // Bit 0, extended disk access functions (AH=42h-44h,47h,48h) supported + + popad // Restore sector count & logical sector number + +ReadSectorsLBA: + pushad // Save logical sector number & sector count + + cmp cx, 64 // Since the LBA calls only support 0x7F sectors at a time we will limit ourselves to 64 + jbe ReadSectorsSetupDiskAddressPacket // If we are reading less than 65 sectors then just do the read + mov cx, 64 // Otherwise read only 64 sectors on this loop iteration + +ReadSectorsSetupDiskAddressPacket: + mov word ptr ds:[LBASectorsRead],cx + push 0 + push 0 + push eax // Put 64-bit logical block address on stack + push es // Put transfer segment on stack + push bx // Put transfer offset on stack + push cx // Set transfer count + push 16 // Set size of packet to 10h + mov si, sp // Setup disk address packet on stack + + mov dl, byte ptr BP_REL(BootDrive) // Drive number + mov ah, HEX(42) // Int 13h, AH = 42h - Extended Read + int HEX(13) // Call BIOS + jc PrintDiskError // If the read failed then abort + + add sp, 16 // Remove disk address packet from stack + + popad // Restore sector count & logical sector number + + push bx + mov ebx, dword ptr ds:[LBASectorsRead] + add eax, ebx // Increment sector to read + shl ebx, 5 + mov dx, es + add dx, bx // Setup read buffer for next sector + mov es, dx + pop bx + + sub cx, word ptr ds:[LBASectorsRead] + jnz ReadSectorsLBA // Read next sector + + pop es + ret + +LBASectorsRead: + .long 0 + + +// Reads logical sectors into [ES:BX] +// EAX has logical sector number to read +// CX has number of sectors to read +ReadSectorsCHS: + popad // Get logical sector number & sector count off stack + +ReadSectorsCHSLoop: + pushad + xor edx, edx + movzx ecx, word ptr BP_REL(SectorsPerTrack) + div ecx // Divide logical by SectorsPerTrack + inc dl // Sectors numbering starts at 1 not 0 + mov cl, dl // Sector in CL + mov edx, eax + shr edx, 16 + div word ptr BP_REL(NumberOfHeads) // Divide logical by number of heads + mov dh, dl // Head in DH + mov dl, byte ptr BP_REL(BootDrive) // Drive number in DL + mov ch, al // Cylinder in CX + ror ah, 1 // Low 8 bits of cylinder in CH, high 2 bits + ror ah, 1 // in CL shifted to bits 6 & 7 + or cl, ah // Or with sector number + mov ax, HEX(0201) + int HEX(13) // DISK - READ SECTORS INTO MEMORY + // AL = number of sectors to read, CH = track, CL = sector + // DH = head, DL = drive, ES:BX -> buffer to fill + // Return: CF set on error, AH = status (see AH=01h), AL = number of sectors read + + jc PrintDiskError // If the read failed then abort + + popad + + inc eax // Increment Sector to Read + + mov dx, es + add dx, 32 // Increment read buffer for next sector + mov es, dx + + loop ReadSectorsCHSLoop // Read next sector + + ret + +// Displays a disk error message +// And reboots +PrintDiskError: + mov si, offset msgDiskError // Bad boot disk message + call PutChars // Display it + + jmp Reboot + +// Displays a file system error message +// And reboots +PrintFileSystemError: + mov si, offset msgFileSystemError // FreeLdr not found message + call PutChars // Display it + +Reboot: + mov si, offset msgAnyKey // Press any key message + call PutChars // Display it + xor ax, ax + int HEX(16) // Wait for a keypress + int HEX(19) // Reboot + +PutChars: + lodsb + or al, al + jz short Done + mov ah, HEX(0e) + mov bx, 7 + int HEX(10) + jmp short PutChars +Done: + ret + + +BiosCHSDriveSize: + .long 0 + +msgDiskError: + .ascii "Disk error", CR, LF, NUL +msgFileSystemError: + .ascii "File system error", CR, LF, NUL +msgAnyKey: + .ascii "Press any key to restart", CR, LF, NUL + +.org 509 // Pad to 509 bytes + +BootPartition: + .byte 0 + +BootSignature: + .word HEX(0aa55) // BootSector signature + +// End of bootsector +// +// Now starts the extra boot code that we will store +// at sector 14 on a FAT32 volume +// +// To remain multi-boot compatible with other operating +// systems we must not overwrite anything other than +// the bootsector which means we will have to use +// a different sector like 14 to store our extra boot code + + + +StartSearch: + + // Now we must get the first cluster of the root directory + mov eax, dword ptr BP_REL(RootDirStartCluster) + cmp eax, HEX(0ffffff8) // Check to see if this is the last cluster in the chain + jb ContinueSearch // If not continue, if so then we didn't find freeldr.sys + jmp PrintFileNotFound + +ContinueSearch: + mov bx, HEX(2000) + mov es, bx // Read cluster to [2000:0000h] + call ReadCluster // Read the cluster + + // Now we have to find our way through the root directory to + // The OSLOADER.SYS file + xor bx,bx + mov bl, byte ptr BP_REL(SectsPerCluster) + shl bx, 4 // BX = BX * 512 / 32 + mov ax, HEX(2000) // We loaded at 2000:0000 + mov es, ax + xor di, di + mov si, offset filename + mov cx, 11 + repe cmpsb // Compare filenames + jz FoundFile // If same we found it + dec bx + jnz FindFile + jmp PrintFileNotFound + +FindFile: + mov ax, es // We didn't find it in the previous dir entry + add ax, 2 // So lets move to the next one + mov es, ax // And search again + xor di, di + mov si, offset filename + mov cx, 11 + repe cmpsb // Compare filenames + jz FoundFile // If same we found it + dec bx // Keep searching till we run out of dir entries + jnz FindFile // Last entry? + + // Get the next root dir cluster and try again until we run out of clusters + mov eax, dword ptr BP_REL(RootDirStartCluster) + call GetFatEntry + mov dword ptr BP_REL(RootDirStartCluster), eax + jmp StartSearch + +FoundFile: + // Display "Loading FreeLoader..." message + mov si, offset msgLoading // Loading message + call PutChars // Display it + + xor di, di // ES:DI has dir entry + xor dx, dx + mov ax, word ptr es:[di+20] // Get start cluster high word + shl eax, 16 + mov ax, word ptr es:[di+26] // Get start cluster low word + +CheckStartCluster: + cmp eax, 2 // Check and see if the start cluster starts at cluster 2 or above + jnb CheckEndCluster // If so then continue + jmp PrintFileSystemError // If not exit with error +CheckEndCluster: + cmp eax, HEX(0ffffff8) // Check and see if the start cluster is and end of cluster chain indicator + jb InitializeLoadSegment // If not then continue + jmp PrintFileSystemError // If so exit with error + +InitializeLoadSegment: + mov bx, FREELDR_BASE / 16 + mov es, bx + +LoadFile: + cmp eax, HEX(0ffffff8) // Check to see if this is the last cluster in the chain + jae LoadFileDone // If so continue, if not then read the next one + push eax + xor bx, bx // Load ROSLDR starting at 0000:8000h + push es + call ReadCluster + pop es + + xor bx, bx + mov bl, byte ptr BP_REL(SectsPerCluster) + shl bx, 5 // BX = BX * 512 / 16 + mov ax, es // Increment the load address by + add ax, bx // The size of a cluster + mov es, ax + + pop eax + push es + call GetFatEntry // Get the next entry + pop es + + jmp LoadFile // Load the next cluster (if any) + +LoadFileDone: + mov dl, byte ptr BP_REL(BootDrive) // Load boot drive into DL + mov dh, byte ptr ds:[BootPartition] // Load boot partition into DH + + /* Transfer execution to the bootloader */ + ljmp16 0, FREELDR_BASE + +// Returns the FAT entry for a given cluster number +// On entry EAX has cluster number +// On return EAX has FAT entry for that cluster +GetFatEntry: + + shl eax, 2 // EAX = EAX * 4 (since FAT32 entries are 4 bytes) + mov ecx, eax // Save this for later in ECX + xor edx, edx + movzx ebx, word ptr BP_REL(BytesPerSector) + push ebx + div ebx // FAT Sector Number = EAX / BytesPerSector + movzx ebx, word ptr BP_REL(ReservedSectors) + add eax, ebx // FAT Sector Number += ReservedSectors + mov ebx, dword ptr BP_REL(HiddenSectors) + add eax, ebx // FAT Sector Number += HiddenSectors + pop ebx + dec ebx + and ecx,ebx // FAT Offset Within Sector = ECX % BytesPerSector + // EAX holds logical FAT sector number + // ECX holds FAT entry offset + + // Now we have to check the extended flags + // to see which FAT is the active one + // and use it, or if they are mirrored then + // no worries + movzx ebx, word ptr BP_REL(ExtendedFlags) // Get extended flags and put into ebx + and bx, HEX(0f) // Mask off upper 8 bits, now we have active fat in bl + jz LoadFatSector // If fat is mirrored then skip fat calcs + cmp bl, byte ptr BP_REL(NumberOfFats) // Compare bl to number of fats + jb GetActiveFatOffset + jmp PrintFileSystemError // If bl is bigger than numfats exit with error +GetActiveFatOffset: + push eax // Save logical FAT sector number + mov eax, dword ptr BP_REL(SectorsPerFatBig) // Get the number of sectors occupied by one fat in eax + mul ebx // Multiplied by the active FAT index we have in ebx + pop edx // Get logical FAT sector number + add eax, edx // Add the current FAT sector offset + +LoadFatSector: + push ecx + + mov bx, HEX(9000) // We will load it to [9000:0000h] + mov es, bx + + // EAX holds logical FAT sector number + // Check if we have already loaded it + cmp eax, dword ptr ds:[FatSectorInCache] + je LoadFatSectorAlreadyLoaded + + mov dword ptr ds:[FatSectorInCache], eax + xor bx, bx + mov cx, 1 + call ReadSectors + +LoadFatSectorAlreadyLoaded: + pop ecx + mov eax, dword ptr es:[ecx] // Get FAT entry + and eax, HEX(0fffffff) // Mask off reserved bits + + ret + +FatSectorInCache: // This variable tells us which sector we currently have in memory + .long HEX(0ffffffff) // There is no need to re-read the same sector if we don't have to + + +// Reads cluster number in EAX into [ES:0000] +ReadCluster: + // StartSector = ((Cluster - 2) * SectorsPerCluster) + ReservedSectors + HiddenSectors// + + dec eax + dec eax + xor edx, edx + movzx ebx, byte ptr BP_REL(SectsPerCluster) + mul ebx + push eax + xor edx, edx + movzx eax, byte ptr BP_REL(NumberOfFats) + mul dword ptr BP_REL(SectorsPerFatBig) + movzx ebx, word ptr BP_REL(ReservedSectors) + add eax, ebx + add eax, dword ptr BP_REL(HiddenSectors) + pop ebx + add eax, ebx // EAX now contains the logical sector number of the cluster + xor bx, bx // We will load it to [ES:0000], ES loaded before function call + movzx cx, byte ptr BP_REL(SectsPerCluster) + call ReadSectors + ret + +// Displays a file not found error message +// And reboots +PrintFileNotFound: + mov si, offset msgFreeLdr // FreeLdr not found message + call PutChars // Display it + mov si, offset msgAnyKey // Press any key message + call PutChars // Display it + + jmp Reboot + +msgFreeLdr: + .ascii "freeldr.sys not found", CR, LF, NUL +filename: + .ascii "FREELDR SYS" +msgLoading: + .ascii "Loading FreeLoader...", CR, LF, NUL + +.org 1022 // Pad to 1022 bytes + + .word HEX(0aa55) // BootSector signature + +.endcode16 + +END diff --git a/boot/freeldr/bootsect/isoboot.S b/boot/freeldr/bootsect/isoboot.S new file mode 100644 index 00000000000..979c35a1f00 --- /dev/null +++ b/boot/freeldr/bootsect/isoboot.S @@ -0,0 +1,1075 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Bootsector for ISO file system + * FILE: + * PURPOSE: + * PROGRAMMERS: ? + */ + +/* INCLUDES ******************************************************************/ + +#include +#include "../freeldr/include/arch/pc/x86common.h" + +.code16 + +// **************************************************************************** +// +// isolinux.asm +// +// A program to boot Linux kernels off a CD-ROM using the El Torito +// boot standard in "no emulation" mode, making the entire filesystem +// available. It is based on the SYSLINUX boot loader for MS-DOS +// floppies. +// +// Copyright (C) 1994-2001 H. Peter Anvin +// +// This 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, Inc., 675 Mass Ave, Cambridge MA 02139, +// USA; either version 2 of the License, or (at your option) any later +// version; incorporated herein by reference. +// +// **************************************************************************** +// +// THIS FILE IS A MODIFIED VERSION OF ISOLINUX.ASM +// MODIFICATION DONE BY MICHAEL K TER LOUW +// LAST UPDATED 3-9-2002 +// SEE "COPYING" FOR INFORMATION ABOUT THE LICENSE THAT APPLIES TO THIS RELEASE +// +// **************************************************************************** +// +// This file is a modified version of ISOLINUX.ASM. +// Modification done by Eric Kohl +// Last update 04-25-2002 +// +// **************************************************************************** + +//#define DEBUG_MESSAGES /* Uncomment to get debugging messages */ +#ifndef ROS_REGTEST +#define WAIT_FOR_KEY +#endif + +// **************************************************************************** +// BEGIN THE BIOS/CODE/DATA SEGMENT +// **************************************************************************** +serial_base = HEX(0400) // Base addresses for 4 serial ports (4 words) +BIOS_fbm = HEX(0413) // Free Base Memory (kilobytes) (1 word) +BIOS_timer = HEX(046C) // Timer ticks (1 word) +BIOS_magic = HEX(0472) // BIOS reset magic (1 word) +BIOS_vidrows = HEX(0484) // Number of screen rows (1 byte) + +// Memory below this point is reserved for the BIOS and the MBR +trackbuf = HEX(1000) // Track buffer goes here (8192 bytes) +trackbufsize = 8192 // trackbuf ends at 3000h + +// struct open_file_t +file_sector = 0 // Sector pointer (0 = structure free) +file_left = 4 // Number of sectors left + +//struct dir_t +dir_lba = 0 // Directory start (LBA) +dir_len = 4 // Length in bytes +dir_clust = 8 // Length in clusters + +#define dir_t_size 12 +#define open_file_t_size 8 + +MAX_OPEN_LG2 = 2 // log2(Max number of open files) +MAX_OPEN = 4 +SECTORSIZE_LG2 = 11 // 2048 bytes/sector (El Torito requirement) +SECTORSIZE = 2048 +retry_count = 6 // How patient are we with the BIOS? + +/******************************************************************************/ +absolute HEX(5000) // Here we keep our BSS stuff + +resb DriveNo, 1 // CD-ROM BIOS drive number (BYTE) +resb DiskError, 1 // Error code for disk I/O (BYTE) +resb RetryCount, 1 // Used for disk access retries (BYTE) +resb TimeoutCount, 1 // Timeout counter (BYTE) +resb ISOFlags, 1 // Flags for ISO directory search (BYTE) +resb RootDir, dir_t_size // Root directory (dir_t_size BYTES) +resb CurDir, dir_t_size // Current directory (dir_t_size BYTES) +resb ISOFileName, 64 // ISO filename canonicalization buffer +resb ISOFileNameEnd, 1 + +//align open_file_t_size +absolute HEX(5060) +resb Files, (MAX_OPEN * open_file_t_size) + + +/******************************************************************************/ + + +start: + cli // Disable interrupts + xor ax, ax // ax = segment zero + mov ss, ax // Initialize stack segment + mov sp, offset start // Set up stack + mov ds, ax // Initialize other segment registers + mov es, ax + mov fs, ax + mov gs, ax + sti // Enable interrupts + cld // Increment pointers + + mov cx, 2048 / 4 // Copy the bootsector + mov si, HEX(7C00) // from 0000:7C00 + mov di, HEX(7000) // to 0000:7000 + rep movsd // copy the program + + ljmp16 0, relocate // jump into relocated code + +relocate: +#ifdef DEBUG_MESSAGES + // Display the banner and copyright + mov si, offset isolinux_banner // si points to hello message + call writestr // display the message + mov si, offset copyright_str + call writestr +#endif + + // Make sure the keyboard buffer is empty + call pollchar_and_empty + + // Check for MBR on harddisk + pusha + mov ax, HEX(0201) + mov dx, HEX(0080) + mov cx, HEX(0001) + mov bx, trackbuf + int HEX(13) + popa + jc .boot_cdrom // could not read hdd + + push ax + mov ax, word ptr ds:[trackbuf] + cmp ax, 0 + je .boot_cdrom // no boot sector found (hopefully there are no weird bootsectors which begin with 0) + pop ax + +#ifdef WAIT_FOR_KEY + // Display the 'Press key' message and wait for a maximum of 5 seconds + call crlf + mov si, offset presskey_msg // si points to 'Press key' message + call writestr // display the message + + mov byte ptr ds:[TimeoutCount], 5 +.next_second: + mov eax, ds:[BIOS_timer] // load current tick counter + add eax, 19 + +.poll_again: + call pollchar_and_empty + jnz .boot_cdrom + + mov ebx, ds:[BIOS_timer] + cmp eax, ebx + jnz .poll_again + + mov si, offset dot_msg // print '.' + call writestr + dec byte ptr ds:[TimeoutCount] // decrement timeout counter + jz .boot_harddisk + jmp .next_second +#endif + +.boot_harddisk: + call crlf + + // Boot first harddisk (drive 0x80) + mov ax, HEX(0201) + mov dx, HEX(0080) + mov cx, HEX(0001) + mov bx, HEX(7C00) + int HEX(13) + jnc .go_hd + jmp kaboom +.go_hd: + mov ax, cs + mov ds, ax + mov es, ax + mov fs, ax + mov gs, ax + mov dx, HEX(0080) + + ljmp16 0, HEX(7C00) + +.boot_cdrom: +#ifdef WAIT_FOR_KEY + call crlf + call crlf +#endif + + // Save and display the boot drive number + mov byte ptr ds:[DriveNo], dl +#ifdef DEBUG_MESSAGES + mov si, offset startup_msg + call writemsg + mov al, dl + call writehex2 + call crlf +#endif + + // Now figure out what we're actually doing + // Note: use passed-in DL value rather than 7Fh because + // at least some BIOSes will get the wrong value otherwise + mov ax, HEX(4B01) // Get disk emulation status + mov dl, byte ptr ds:[DriveNo] + mov si, offset spec_packet + int HEX(13) + jc spec_query_failed // Shouldn't happen (BIOS bug) + mov dl, byte ptr ds:[DriveNo] + cmp byte ptr ds:[sp_drive], dl // Should contain the drive number + jne spec_query_failed + +#ifdef DEBUG_MESSAGES + mov si, offset spec_ok_msg + call writemsg + mov al, byte ptr ds:[sp_drive] + call writehex2 + call crlf +#endif + +found_drive: + // Get drive information + mov ah, HEX(48) + mov dl, byte ptr ds:[DriveNo] + mov si, offset drive_params + int HEX(13) + jnc params_ok + + // mov si, nosecsize_msg No use in reporting this + // call writemsg + +params_ok: + // Check for the sector size (should be 2048, but + // some BIOSes apparently think we're 512-byte media) + // + // FIX: We need to check what the proper behaviour + // is for getlinsec when the BIOS thinks the sector + // size is 512!!! For that, we need such a BIOS, though... +#ifdef DEBUG_MESSAGES + mov si, offset secsize_msg + call writemsg + mov ax, word ptr ds:[dp_secsize] + call writehex4 + call crlf +#endif + + + // + // Clear Files structures + // + mov di, Files + mov cx, (MAX_OPEN*open_file_t_size)/4 + xor eax, eax + rep stosd + + // + // Now, we need to sniff out the actual filesystem data structures. + // mkisofs gave us a pointer to the primary volume descriptor + // (which will be at 16 only for a single-session disk!); from the PVD + // we should be able to find the rest of what we need to know. + // +get_fs_structures: + mov eax, 16 // Primary Volume Descriptor (sector 16) + mov bx, trackbuf + call getonesec + + mov eax, dword ptr ds:[trackbuf+156+2] + mov dword ptr ds:[RootDir+dir_lba],eax + mov dword ptr ds:[CurDir+dir_lba],eax +#ifdef DEBUG_MESSAGES + mov si, offset rootloc_msg + call writemsg + call writehex8 + call crlf +#endif + + mov eax, dword ptr ds:[trackbuf+156+10] + mov dword ptr ds:[RootDir+dir_len],eax + mov dword ptr ds:[CurDir+dir_len],eax +#ifdef DEBUG_MESSAGES + mov si, offset rootlen_msg + call writemsg + call writehex8 + call crlf +#endif + add eax,SECTORSIZE-1 + shr eax,SECTORSIZE_LG2 + mov dword ptr ds:[RootDir+dir_clust],eax + mov dword ptr ds:[CurDir+dir_clust],eax +#ifdef DEBUG_MESSAGES + mov si, offset rootsect_msg + call writemsg + call writehex8 + call crlf +#endif + + // Look for the "REACTOS" directory, and if found, + // make it the current directory instead of the root + // directory. + mov di, offset isolinux_dir + mov al, 2 // Search for a directory + call searchdir_iso + jnz .dir_found + mov si, offset no_dir_msg + call writemsg + jmp kaboom + +.dir_found: + mov dword ptr ds:[CurDir+dir_len],eax + mov eax, dword ptr ds:[si+file_left] + mov dword ptr ds:[CurDir+dir_clust],eax + xor eax,eax // Free this file pointer entry + xchg eax,dword ptr ds:[si+file_sector] + mov dword ptr ds:[CurDir+dir_lba],eax + + + mov di, offset isolinux_bin // di points to Isolinux filename + call searchdir // look for the file + jnz .isolinux_opened // got the file + mov si, offset no_isolinux_msg // si points to error message + call writemsg // display the message + jmp kaboom // fail boot + +.isolinux_opened: + mov di, si // save file pointer + +#ifdef DEBUG_MESSAGES + mov si, offset filelen_msg + call writemsg + call writehex8 + call crlf +#endif + + mov ecx, eax // calculate sector count + shr ecx, 11 + test eax, HEX(7FF) + jz .full_sector + inc ecx +.full_sector: + +#ifdef DEBUG_MESSAGES + mov eax, ecx + mov si, offset filesect_msg + call writemsg + call writehex8 + call crlf +#endif + +// use high segment, as some bios can fail, when offset is too big + mov bx, FREELDR_BASE / 16 // es = load segment + mov es, bx + xor ebx, ebx // bx = load offset + mov si, di // restore file pointer + mov cx, HEX(0FFFF) // load the whole file + call getfssec // get the whole file + +#ifdef DEBUG_MESSAGES + mov si, offset startldr_msg + call writemsg + call crlf +#endif + + mov dl, byte ptr ds:[DriveNo] // dl = boot drive + mov dh, 0 // dh = boot partition + + /* Transfer execution to the bootloader */ + ljmp16 0, FREELDR_BASE + +// +// searchdir: +// +// Open a file +// +// On entry: +// DS:DI = filename +// If successful: +// ZF clear +// SI = file pointer +// DX:AX or EAX = file length in bytes +// If unsuccessful +// ZF set +// + +// +// searchdir_iso is a special entry point for ISOLINUX only. In addition +// to the above, searchdir_iso passes a file flag mask in AL. This is useful +// for searching for directories. +// +alloc_failure: + xor ax,ax // ZF <- 1 + ret + +searchdir: + xor al, al +searchdir_iso: + mov byte ptr ds:[ISOFlags],al + call allocate_file // Temporary file structure for directory + jnz alloc_failure + push es + push ds + pop es // ES = DS + mov si, offset CurDir + cmp byte ptr ds:[di], 92 //'\' // If filename begins with slash + jne .not_rooted + inc di // Skip leading slash + mov si, offset RootDir // Reference root directory instead +.not_rooted: + mov eax, dword ptr ds:[si+dir_clust] + mov dword ptr ds:[bx+file_left],eax + mov eax,dword ptr ds:[si+dir_lba] + mov dword ptr ds:[bx+file_sector],eax + mov edx,dword ptr ds:[si+dir_len] + +.look_for_slash: + mov ax,di +.scan: + mov cl, byte ptr ds:[di] + inc di + and cl,cl + jz .isfile + cmp cl, 92 // '\' + jne .scan + mov byte ptr ds:[di-1], 0 // Terminate at directory name + mov cl,2 // Search for directory + xchg cl, byte ptr ds:[ISOFlags] + push di + push cx + push offset .resume // Where to "return" to + push es +.isfile: + xchg ax,di + +.getsome: + // Get a chunk of the directory + mov si,trackbuf + pushad + xchg bx,si + mov cx,1 // load one sector + call getfssec + popad + +.compare: + movzx eax, byte ptr ds:[si] // Length of directory entry + cmp al, 33 + jb .next_sector + mov cl, byte ptr ds:[si+25] + xor cl, byte ptr ds:[ISOFlags] + test cl, HEX(8E) // Unwanted file attributes! + jnz .not_file + pusha + movzx cx, byte ptr ds:[si+32] // File identifier length + add si, 33 // File identifier offset + call iso_compare_names + popa + je .success +.not_file: + sub edx, eax // Decrease bytes left + jbe .failure + add si, ax // Advance pointer + +.check_overrun: + // Did we finish the buffer? + cmp si, trackbuf+trackbufsize + jb .compare // No, keep going + + jmp .getsome // Get some more directory + +.next_sector: + // Advance to the beginning of next sector + lea ax, [si+SECTORSIZE-1] + and ax, not (SECTORSIZE-1) + sub ax, si + jmp .not_file // We still need to do length checks + +.failure: +#ifdef DEBUG_MESSAGES + mov si, offset findfail_msg + call writemsg + call crlf +#endif + xor eax, eax // ZF = 1 + mov dword ptr ds:[bx+file_sector], eax + pop es + ret + +.success: + mov eax, dword ptr ds:[si+2] // Location of extent + mov dword ptr ds:[bx+file_sector], eax + mov eax, dword ptr ds:[si+10] // Data length + push eax + add eax, SECTORSIZE-1 + shr eax, SECTORSIZE_LG2 + mov dword ptr ds:[bx+file_left], eax + pop eax + mov edx, eax + shr edx, 16 + and bx, bx // ZF = 0 + mov si, bx + pop es + ret + +.resume: + // We get here if we were only doing part of a lookup + // This relies on the fact that .success returns bx == si + xchg edx, eax // Directory length in edx + pop cx // Old ISOFlags + pop di // Next filename pointer + + // restore the backslash in the filename + mov byte ptr ds:[di-1], 92 // '\' + + mov byte ptr ds:[ISOFlags], cl // Restore the flags + jz .failure // Did we fail? If so fail for real! + jmp .look_for_slash // Otherwise, next level + +// +// allocate_file: Allocate a file structure +// +// If successful: +// ZF set +// BX = file pointer +// In unsuccessful: +// ZF clear +// +allocate_file: + push cx + mov bx, Files + mov cx, MAX_OPEN +.check: + cmp dword ptr ds:[bx], 0 + je .found + add bx, open_file_t_size // ZF = 0 + loop .check + // ZF = 0 if we fell out of the loop +.found: + pop cx + ret + +// +// iso_compare_names: +// Compare the names DS:SI and DS:DI and report if they are +// equal from an ISO 9660 perspective. SI is the name from +// the filesystem; CX indicates its length, and ';' terminates. +// DI is expected to end with a null. +// +// Note: clobbers AX, CX, SI, DI; assumes DS == ES == base segment +// +iso_compare_names: + // First, terminate and canonicalize input filename + push di + mov di, offset ISOFileName +.canon_loop: + jcxz .canon_end + lodsb + dec cx + cmp al, ';' + je .canon_end + and al, al + je .canon_end + stosb + cmp di, offset ISOFileNameEnd-1 // Guard against buffer overrun + jb .canon_loop +.canon_end: + cmp di, ISOFileName + jbe .canon_done + cmp byte ptr ds:[di-1], '.' // Remove terminal dots + jne .canon_done + dec di + jmp short .canon_end +.canon_done: + mov byte ptr ds:[di], 0 // Null-terminate string + pop di + mov si, ISOFileName +.compare2: + lodsb + mov ah, byte ptr ds:[di] + inc di + and ax, ax + jz .success2 // End of string for both + and al, al // Is either one end of string? + jz .failure2 // If so, failure + and ah, ah + jz .failure2 + or ax, HEX(2020) // Convert to lower case + cmp al, ah + je .compare2 +.failure2: + and ax, ax // ZF = 0 (at least one will be nonzero) +.success2: + ret + + + + + + + +// +// getfssec: Get multiple clusters from a file, given the file pointer. +// +// On entry: +// ES:BX -> Buffer +// SI -> File pointer +// CX -> Cluster count; 0FFFFh = until end of file +// On exit: +// SI -> File pointer (or 0 on EOF) +// CF = 1 -> Hit EOF +// +getfssec: + cmp cx, word ptr ds:[si+file_left] + jna .ok_size + mov cx, word ptr ds:[si+file_left] + +.ok_size: + mov bp, cx + push cx + push si + mov eax, dword ptr ds:[si+file_sector] + call getlinsec + xor ecx, ecx + pop si + pop cx + + add dword ptr ds:[si+file_sector], ecx + sub dword ptr ds:[si+file_left], ecx + ja .not_eof // CF = 0 + + xor ecx, ecx + mov dword ptr ds:[si+file_sector], ecx // Mark as unused + xor si,si + stc + +.not_eof: + ret + + +// INT 13h, AX=4B01h, DL= failed. +// Try to scan the entire 80h-FFh from the end. +spec_query_failed: + mov si, offset spec_err_msg + call writemsg + + mov dl, HEX(0FF) +.test_loop: + pusha + mov ax, HEX(4B01) + mov si, offset spec_packet + mov byte ptr ds:[si], 13 // Size of buffer + int HEX(13) + popa + jc .still_broken + + mov si, offset maybe_msg + call writemsg + mov al, dl + call writehex2 + call crlf + + cmp byte ptr ds:[sp_drive], dl + jne .maybe_broken + + // Okay, good enough... + mov si, offset alright_msg + call writemsg + mov byte ptr ds:[DriveNo], dl +.found_drive: + jmp found_drive + + // Award BIOS 4.51 apparently passes garbage in sp_drive, + // but if this was the drive number originally passed in + // DL then consider it "good enough" +.maybe_broken: + cmp byte ptr ds:[DriveNo], dl + je .found_drive + +.still_broken: + dec dx + cmp dl, HEX(80) + jnb .test_loop + +fatal_error: + mov si, offset nothing_msg + call writemsg + +.norge: + jmp .norge + + + +// Information message (DS:SI) output +// Prefix with "isolinux: " +writemsg: + push ax + push si + mov si, offset isolinux_str + call writestr + pop si + call writestr + pop ax + ret + +// +// crlf: Print a newline +crlf: + mov si, offset crlf_msg + // Fall through + +// +// writestr: write a null-terminated string to the console, saving +// registers on entry. +// +writestr: + pushfd + pushad +writestr_top: + lodsb + and al, al + jz writestr_end + call writechr + jmp short writestr_top +writestr_end: + popad + popfd + ret + +// +// writehex[248]: Write a hex number in (AL, AX, EAX) to the console +// +writehex2: + pushfd + pushad + shl eax, 24 + mov cx, 2 + jmp short writehex_common +writehex4: + pushfd + pushad + shl eax, 16 + mov cx, 4 + jmp short writehex_common +writehex8: + pushfd + pushad + mov cx, 8 +writehex_common: +.loop: + rol eax, 4 + push eax + and al, HEX(0F) + cmp al, 10 + jae .high +.low: + add al, '0' + jmp short .ischar +.high: + add al, 'A'-10 +.ischar: + call writechr + pop eax + loop .loop + popad + popfd + ret + +// +// writechr: Write a character to the screen. There is a more "sophisticated" +// version of this in the subsequent code, so we patch the pointer +// when appropriate. +writechr: + pushfd + pushad + mov ah, HEX(0E) + xor bx, bx + int HEX(10) + popad + popfd + ret + +// +// Get one sector. Convenience entry point. +// +getonesec: + mov bp, 1 + // Fall through to getlinsec + +// +// Get linear sectors - EBIOS LBA addressing, 2048-byte sectors. +// +// Note that we can't always do this as a single request, because at least +// Phoenix BIOSes has a 127-sector limit. To be on the safe side, stick +// to 32 sectors (64K) per request. +// +// Input: +// EAX - Linear sector number +// ES:BX - Target buffer +// BP - Sector count +// +getlinsec: + mov si, offset dapa // Load up the DAPA + mov word ptr ds:[si+4], bx + mov bx, es + mov word ptr ds:[si+6], bx + mov dword ptr ds:[si+8], eax +.loop2: + push bp // Sectors left + cmp bp, word ptr ds:[MaxTransfer] + jbe .bp_ok + mov bp, word ptr ds:[MaxTransfer] +.bp_ok: + mov word ptr ds:[si+2], bp + push si + mov dl, byte ptr ds:[DriveNo] + mov ah, HEX(42) // Extended Read + call xint13 + pop si + pop bp + movzx eax,word ptr ds:[si+2] // Sectors we read + add dword ptr ds:[si+8], eax // Advance sector pointer + sub bp, ax // Sectors left + shl ax, SECTORSIZE_LG2-4 // 2048-byte sectors -> segment + add word ptr ds:[si+6], ax // Advance buffer pointer + and bp, bp + jnz .loop2 + mov eax, dword ptr ds:[si+8] // Next sector + ret + + // INT 13h with retry +xint13: + mov byte ptr ds:[RetryCount], retry_count +.try: + pushad + int HEX(13) + jc .error + add sp, 8*4 // Clean up stack + ret +.error: + mov byte ptr ds:[DiskError], ah // Save error code + popad + dec byte ptr ds:[RetryCount] + jz .real_error + push ax + mov al, byte ptr ds:[RetryCount] + mov ah, byte ptr ds:[dapa+2] // Sector transfer count + cmp al,2 // Only 2 attempts left + ja .nodanger + mov ah,1 // Drop transfer size to 1 + jmp short .setsize +.nodanger: + cmp al, retry_count-2 + ja .again // First time, just try again + shr ah,1 // Otherwise, try to reduce + adc ah,0 // the max transfer size, but not to 0 +.setsize: + mov byte ptr ds:[MaxTransfer],ah + mov byte ptr ds:[dapa+2],ah +.again: + pop ax + jmp .try + +.real_error: + mov si, offset diskerr_msg + call writemsg + mov al, byte ptr ds:[DiskError] + call writehex2 + mov si, offset ondrive_str + call writestr + mov al, dl + call writehex2 + call crlf + // Fall through to kaboom + +// +// kaboom: write a message and bail out. Wait for a user keypress, +// then do a hard reboot. +// +kaboom: + mov ax, cs + mov ds, ax + mov es, ax + mov fs, ax + mov gs, ax + sti + mov si, offset err_bootfailed + call writestr + xor ax, ax // Wait for keypress + int HEX(16) + cli + mov word ptr ds:[BIOS_magic], 0 // Cold reboot + ljmp16 HEX(0F000), HEX(0FFF0) // Reset vector address + + +// +// pollchar_and_empty: check if we have an input character pending (ZF = 0) and empty the input buffer afterwards +// +pollchar_and_empty: + pushad + mov ah, 1 // Did the user press a key? + int HEX(16) + jz .end // No, then we're done + mov ah, 0 // Otherwise empty the buffer by reading it + int HEX(16) +.end: + popad + ret + + +isolinux_banner: + .ascii CR, LF, "Loading IsoBoot...", CR, LF, NUL +copyright_str: + .ascii " (C) 1994-2002 H. Peter Anvin", CR, LF, NUL +presskey_msg: + .ascii "Press any key to boot from CD", NUL +dot_msg: + .ascii ".", NUL + +#ifdef DEBUG_MESSAGES +startup_msg: + .ascii "Startup, DL = '", NUL +spec_ok_msg: + .ascii "packet OK, drive = ", NUL +secsize_msg: + .ascii "size appears to be ", NUL +rootloc_msg: + .ascii "Root dir loc: ", NUL +rootlen_msg: + .ascii "Root dir len: ", NUL +rootsect_msg: + .ascii "Root dir len(sect): ", NUL +fileloc_msg: + .ascii "SETUPLDR loc: ", NUL +filelen_msg: + .ascii "SETUPLDR len: ", NUL +filesect_msg: + .ascii "SETUPLDR len(sect): ", NUL +findfail_msg: + .ascii "Failed to find file!", NUL +startldr_msg: + .ascii "Starting SETUPLDR.SYS", NUL +#endif + +spec_err_msg: + .ascii "Load spec failed, trying wing ...", CR, LF, NUL +maybe_msg: + .ascii "Found smth at drive = ", NUL +alright_msg: + .ascii "might be ok, continuing...", CR, LF, NUL +nothing_msg: + .ascii "Failed locate CD-ROM; boot failed.", CR, LF, NUL + +isolinux_str: + .ascii "IsoBoot: ", NUL +crlf_msg: + .ascii CR, LF, NUL +diskerr_msg: + .ascii "Disk error ", NUL +ondrive_str: + .ascii ", drive ", NUL + +err_bootfailed: + .ascii CR, LF, "failed..", NUL +isolinux_dir: + .ascii "\\LOADER", NUL +no_dir_msg: + .ascii "LOADER dir not found.", CR, LF, NUL +isolinux_bin: + .ascii "SETUPLDR.SYS", NUL +no_isolinux_msg: + .ascii "SETUPLDR not found.", CR, LF, NUL + + +// +// El Torito spec packet +// +.align 8 +spec_packet: + .byte HEX(13) // Size of packet +sp_media: + .byte 0 // Media type +sp_drive: + .byte 0 // Drive number +sp_controller: + .byte 0 // Controller index +sp_lba: + .long 0 // LBA for emulated disk image +sp_devspec: + .word 0 // IDE/SCSI information +sp_buffer: + .word 0 // User-provided buffer +sp_loadseg: + .word 0 // Load segment +sp_sectors: + .word 0 // Sector count +sp_chs: + .byte 0,0,0 // Simulated CHS geometry +sp_dummy: + .byte 0 // Scratch, safe to overwrite + +// +// EBIOS drive parameter packet +// +.align 8 +drive_params: + .word 30 // Buffer size +dp_flags: + .word 0 // Information flags +dp_cyl: + .long 0 // Physical cylinders +dp_head: + .long 0 // Physical heads +dp_sec: + .long 0 // Physical sectors/track +dp_totalsec: + .long 0,0 // Total sectors +dp_secsize: + .word 0 // Bytes per sector +dp_dpte: + .long 0 // Device Parameter Table +dp_dpi_key: + .word 0 // 0BEDDh if rest valid +dp_dpi_len: + .byte 0 // DPI len + .byte 0 + .word 0 +dp_bus: + .byte 0,0,0,0 // Host bus type +dp_interface: + .byte 0,0,0,0,0,0,0,0 // Interface type +db_i_path: + .long 0,0 // Interface path +db_d_path: + .long 0,0 // Device path + .byte 0 +db_dpi_csum: + .byte 0 // Checksum for DPI info + +// +// EBIOS disk address packet +// +.align 8 +dapa: + .word 16 // Packet size +.count: + .word 0 // Block count +.off: + .word 0 // Offset of buffer +.seg: + .word 0 // Segment of buffer +.lba: + .long 0 // LBA (LSW) + .long 0 // LBA (MSW) + +.align 4 +MaxTransfer: + .word 2 //32 // Max sectors per transfer + +.org 2046 // Pad to file offset 2046 +.word HEX(0aa55) // BootSector signature + +.endcode16 + +END diff --git a/boot/freeldr/bootsect/isobtrt.S b/boot/freeldr/bootsect/isobtrt.S new file mode 100644 index 00000000000..03f761251c3 --- /dev/null +++ b/boot/freeldr/bootsect/isobtrt.S @@ -0,0 +1,3 @@ + +#define ROS_REGTEST +#include "isoboot.S" diff --git a/boot/freeldr/fdebug/fdebug.rc b/boot/freeldr/fdebug/fdebug.rc index 15f787de361..23ecb5b8b68 100644 --- a/boot/freeldr/fdebug/fdebug.rc +++ b/boot/freeldr/fdebug/fdebug.rc @@ -17,8 +17,11 @@ IDI_FDEBUG ICON "fdebug.ico" #include "lang/it-IT.rc" #include "lang/ja-JP.rc" #include "lang/no-NO.rc" -#include "lang/pl-PL.rc" -#include "lang/ru-RU.rc" #include "lang/sk-SK.rc" #include "lang/tr-TR.rc" + +// UTF-8 +#pragma code_page(65001) +#include "lang/pl-PL.rc" +#include "lang/ru-RU.rc" #include "lang/uk-UA.rc" diff --git a/boot/freeldr/fdebug/lang/pl-PL.rc b/boot/freeldr/fdebug/lang/pl-PL.rc index 24dddd52186..e564758452a 100644 --- a/boot/freeldr/fdebug/lang/pl-PL.rc +++ b/boot/freeldr/fdebug/lang/pl-PL.rc @@ -1,10 +1,10 @@ ///////////////////////////////////////////////////////////////////////////// // Polish (P.L.) resources // 2005 Emil Kaczmarek +// UTF-8 conversion by Caemyr (May, 2011) #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) #ifdef _WIN32 LANGUAGE LANG_POLISH, SUBLANG_DEFAULT -#pragma code_page(1250) #endif //_WIN32 ///////////////////////////////////////////////////////////////////////////// @@ -16,17 +16,17 @@ IDC_FDEBUG MENU DISCARDABLE BEGIN POPUP "&Plik" BEGIN - MENUITEM "P&ocz", IDM_FILE_CONNECT - MENUITEM "&Rozcz", IDM_FILE_DISCONNECT, GRAYED + MENUITEM "P&ołącz", IDM_FILE_CONNECT + MENUITEM "&Rozłącz", IDM_FILE_DISCONNECT, GRAYED MENUITEM SEPARATOR - MENUITEM "&Wyczy wywietlacz", IDM_FILE_CLEARDISPLAY + MENUITEM "&Wyczyść wyświetlacz", IDM_FILE_CLEARDISPLAY MENUITEM SEPARATOR MENUITEM "Ro&zpocznij zrzut", IDM_FILE_STARTCAPTURE MENUITEM "Za&trzymaj zrzut", IDM_FILE_STOPCAPTURE, GRAYED MENUITEM SEPARATOR MENUITEM "Lo&kalne Echo", IDM_FILE_LOCALECHO MENUITEM SEPARATOR - MENUITEM "&Wyjcie", IDM_EXIT + MENUITEM "&Wyjście", IDM_EXIT END POPUP "Po&moc" BEGIN @@ -132,12 +132,12 @@ END IDD_CONNECTION DIALOGEX DISCARDABLE 0, 0, 196, 100 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Opcje poczenia" +CAPTION "Opcje połączenia" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Wprowad port COM (np. COM1):",IDC_STATIC,7,7,108,8 + LTEXT "Wprowadź port COM (np. COM1):",IDC_STATIC,7,7,108,8 EDITTEXT IDC_COMPORT,7,17,182,14,ES_AUTOHSCROLL - LTEXT "Wprowad szybko portu w bodach (np. 115200):",IDC_STATIC,7,38,114, + LTEXT "Wprowadź szybkość portu w bodach (np. 115200):",IDC_STATIC,7,38,114, 8 EDITTEXT IDC_BAUTRATE,7,48,182,14,ES_AUTOHSCROLL DEFPUSHBUTTON "OK",IDOK,45,79,50,14 @@ -146,12 +146,12 @@ END IDD_CAPTURE DIALOGEX DISCARDABLE 0, 0, 251, 95 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Przechwy plik" +CAPTION "Przechwyć plik" FONT 8, "MS Shell Dlg" BEGIN LTEXT "Nazwa pliku zrzutu:",IDC_STATIC,7,17,62,8 EDITTEXT IDC_CAPTUREFILENAME,7,26,181,14,ES_AUTOHSCROLL - PUSHBUTTON "Przeg&ldaj",IDC_BROWSE,194,26,50,14 + PUSHBUTTON "Przeg&lądaj",IDC_BROWSE,194,26,50,14 DEFPUSHBUTTON "OK",IDOK,139,74,50,14 PUSHBUTTON "Anuluj",IDCANCEL,194,74,50,14 END @@ -172,7 +172,7 @@ END STRINGTABLE DISCARDABLE BEGIN - IDS_LICENSE "Ten program naley do wolnego oprogramowania; moesz go rozpowszechnia i/lub modyfikowa w zgodzie z zasadami licencji GNU GPL w formie w jakiej zostay opublikowane przez fundacj Free Software Foundation; albo w wersji 2 Licencji albo (tu masz wybr) w jakiejkolwiek pniejszej wersji.\r\n\r\nRozpowszechniajc ten program mamy nadziej, e bdzie uyteczny, ale BEZ ADNEJ GWARANCJI; nawet bez zakadanej gwarancji HANDLOWOCI, a w szczeglnym przypadku zdatnoci. Aby pozna wicej szczegw, zajrzyj do licencji GNU.\r\n\r\nKopia licencji GNU GPL powinna by dostarczona razem z tym programem; jeli tak nie jest, napisz list do fundacji na adres: Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA." + IDS_LICENSE "Ten program należy do wolnego oprogramowania; możesz go rozpowszechniać i/lub modyfikować w zgodzie z zasadami licencji GNU GPL w formie w jakiej zostały opublikowane przez fundację Free Software Foundation; albo w wersji 2 Licencji albo (tu masz wybór) w jakiejkolwiek późniejszej wersji.\r\n\r\nRozpowszechniając ten program mamy nadzieję, że będzie użyteczny, ale BEZ ŻADNEJ GWARANCJI; nawet bez zakładanej gwarancji HANDLOWOŚCI, a w szczególnym przypadku zdatności. Aby poznać więcej szczegółów, zajrzyj do licencji GNU.\r\n\r\nKopia licencji GNU GPL powinna być dostarczona razem z tym programem; jeśli tak nie jest, napisz list do fundacji na adres: Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA." END @@ -190,4 +190,3 @@ BEGIN ///////////////////////////////////////////////////////////////////////////// #endif // not APSTUDIO_INVOKED - diff --git a/boot/freeldr/fdebug/lang/ru-RU.rc b/boot/freeldr/fdebug/lang/ru-RU.rc index 84b0023ba62..e7d2a6e7623 100644 --- a/boot/freeldr/fdebug/lang/ru-RU.rc +++ b/boot/freeldr/fdebug/lang/ru-RU.rc @@ -3,7 +3,6 @@ #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) #ifdef _WIN32 LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT -#pragma code_page(1251) #endif //_WIN32 ///////////////////////////////////////////////////////////////////////////// @@ -13,23 +12,23 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT IDC_FDEBUG MENU DISCARDABLE BEGIN - POPUP "&" + POPUP "&Файл" BEGIN - MENUITEM "&", IDM_FILE_CONNECT - MENUITEM "&", IDM_FILE_DISCONNECT, GRAYED + MENUITEM "&Соединение", IDM_FILE_CONNECT + MENUITEM "&Отключение", IDM_FILE_DISCONNECT, GRAYED MENUITEM SEPARATOR - MENUITEM "& ", IDM_FILE_CLEARDISPLAY + MENUITEM "О&чистить экран", IDM_FILE_CLEARDISPLAY MENUITEM SEPARATOR - MENUITEM "& ", IDM_FILE_STARTCAPTURE - MENUITEM "& ", IDM_FILE_STOPCAPTURE, GRAYED + MENUITEM "&Начать захват", IDM_FILE_STARTCAPTURE + MENUITEM "Ос&тановить захват", IDM_FILE_STOPCAPTURE, GRAYED MENUITEM SEPARATOR - MENUITEM "& ", IDM_FILE_LOCALECHO + MENUITEM "&Локальный ответ", IDM_FILE_LOCALECHO MENUITEM SEPARATOR - MENUITEM "&", IDM_EXIT + MENUITEM "&Выход", IDM_EXIT END - POPUP "&" + POPUP "&Справка" BEGIN - MENUITEM "& ...", IDM_ABOUT + MENUITEM "&О программе...", IDM_ABOUT END END @@ -117,10 +116,10 @@ END IDD_ABOUTBOX DIALOGEX DISCARDABLE 22, 17, 259, 210 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU -CAPTION " FreeLoader" +CAPTION "О программе Отладчик FreeLoader" FONT 8, "MS Shell Dlg" BEGIN - CONTROL " FreeLoader v1.0\n (C) 2003\n (brianp@reactos.org)", + CONTROL "Отладчик FreeLoader v1.0\nАвторские права (C) 2003\nБраин Палмер (brianp@reactos.org)", IDC_STATIC,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,53,28, 122,26 DEFPUSHBUTTON "OK",IDOK,183,189,44,14,WS_GROUP @@ -131,28 +130,28 @@ END IDD_CONNECTION DIALOGEX DISCARDABLE 0, 0, 196, 100 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Настройки соединения" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " COM- (e.g. COM1):",IDC_STATIC,7,7,108,8 + LTEXT "Введите COM-порт (e.g. COM1):",IDC_STATIC,7,7,108,8 EDITTEXT IDC_COMPORT,7,17,182,14,ES_AUTOHSCROLL - LTEXT " (e.g. 115200):",IDC_STATIC,7,38,114, + LTEXT "Введите скорость передачи (e.g. 115200):",IDC_STATIC,7,38,114, 8 EDITTEXT IDC_BAUTRATE,7,48,182,14,ES_AUTOHSCROLL DEFPUSHBUTTON "OK",IDOK,45,79,50,14 - PUSHBUTTON "",IDCANCEL,100,79,50,14 + PUSHBUTTON "Отмена",IDCANCEL,100,79,50,14 END IDD_CAPTURE DIALOGEX DISCARDABLE 0, 0, 251, 95 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Файл захвата" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " :",IDC_STATIC,7,17,62,8 + LTEXT "Название файла захвата:",IDC_STATIC,7,17,62,8 EDITTEXT IDC_CAPTUREFILENAME,7,26,181,14,ES_AUTOHSCROLL - PUSHBUTTON "&",IDC_BROWSE,194,26,50,14 + PUSHBUTTON "&Обзор",IDC_BROWSE,194,26,50,14 DEFPUSHBUTTON "OK",IDOK,139,74,50,14 - PUSHBUTTON "",IDCANCEL,194,74,50,14 + PUSHBUTTON "Отмена",IDCANCEL,194,74,50,14 END @@ -164,13 +163,13 @@ END STRINGTABLE DISCARDABLE BEGIN IDS_APP_TITLE "fdebug" - IDS_HELLO " !" + IDS_HELLO "Привет мир!" IDC_FDEBUG "FDEBUG" END STRINGTABLE DISCARDABLE BEGIN - IDS_LICENSE " ; / GNU General Public License 2 , Free Software Foundation.\r\n\r\n , , ; . . GNU General Public License .\r\n\r\n GNU , Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA." + IDS_LICENSE "Эта программа является свободным программным обеспечением; Вы можете распространять и/или изменять ее в соответствии с лицензией GNU General Public License версии 2 или более поздней, опубликованной Free Software Foundation.\r\n\r\nЭта программа распространяется с надеждой, что она может быть полезна, но БЕЗ ВСЯКОЙ ГАРАНТИИ; не подразумевается даже РАБОТОСПОСОБНОСТЬ или ПРИГОДНОСТЬ ДЛЯ ВЫПОЛНЕНИЯ НЕОБХОДИМЫХ ЗАДАЧ. См. GNU General Public License для получения дополнительных сведений.\r\n\r\nВы должны получить копию лицензии GNU вместе с этой программой, в противном случае обращайтесь в Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA." END #endif diff --git a/boot/freeldr/fdebug/lang/uk-UA.rc b/boot/freeldr/fdebug/lang/uk-UA.rc index 69ca13f7702..ae49c815c1d 100644 --- a/boot/freeldr/fdebug/lang/uk-UA.rc +++ b/boot/freeldr/fdebug/lang/uk-UA.rc @@ -4,7 +4,6 @@ #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) #ifdef _WIN32 LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT -#pragma code_page(1251) #endif //_WIN32 ///////////////////////////////////////////////////////////////////////////// @@ -14,23 +13,23 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT IDC_FDEBUG MENU DISCARDABLE BEGIN - POPUP "&" + POPUP "&Файл" BEGIN - MENUITEM "&ϳ", IDM_FILE_CONNECT - MENUITEM "&³", IDM_FILE_DISCONNECT, GRAYED + MENUITEM "&Підключити", IDM_FILE_CONNECT + MENUITEM "&Відключити", IDM_FILE_DISCONNECT, GRAYED MENUITEM SEPARATOR - MENUITEM "& ", IDM_FILE_CLEARDISPLAY + MENUITEM "&Очистити екран", IDM_FILE_CLEARDISPLAY MENUITEM SEPARATOR - MENUITEM " &", IDM_FILE_STARTCAPTURE - MENUITEM " &", IDM_FILE_STOPCAPTURE, GRAYED + MENUITEM "Почати &захоплення", IDM_FILE_STARTCAPTURE + MENUITEM "Зупинити з&ахоплення", IDM_FILE_STOPCAPTURE, GRAYED MENUITEM SEPARATOR - MENUITEM "& ", IDM_FILE_LOCALECHO + MENUITEM "&Локальна відповідь", IDM_FILE_LOCALECHO MENUITEM SEPARATOR - MENUITEM "&", IDM_EXIT + MENUITEM "В&ихід", IDM_EXIT END - POPUP "&" + POPUP "&Довідка" BEGIN - MENUITEM "& ...", IDM_ABOUT + MENUITEM "Пр&о програму ...", IDM_ABOUT END END @@ -118,13 +117,13 @@ END IDD_ABOUTBOX DIALOGEX DISCARDABLE 22, 17, 259, 210 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU -CAPTION " FreeLoader" +CAPTION "Про програму Налагоджувач FreeLoader" FONT 8, "MS Shell Dlg" BEGIN - CONTROL " FreeLoader v1.0\nCopyright (C) 2003\nby Brian Palmer (brianp@reactos.org)", + CONTROL "Налагоджувач FreeLoader v1.0\nCopyright (C) 2003\nby Brian Palmer (brianp@reactos.org)", IDC_STATIC,"Static",SS_LEFTNOWORDWRAP | WS_GROUP,53,28, 122,26 - DEFPUSHBUTTON "",IDOK,183,189,44,14,WS_GROUP + DEFPUSHBUTTON "Так",IDOK,183,189,44,14,WS_GROUP ICON IDI_FDEBUG,IDC_STATIC,19,30,20,20 EDITTEXT IDC_LICENSE_EDIT,53,63,174,107,ES_MULTILINE | ES_READONLY | WS_VSCROLL @@ -132,28 +131,28 @@ END IDD_CONNECTION DIALOGEX DISCARDABLE 0, 0, 196, 100 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " '" +CAPTION "Настройки з'єднання" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " COM- (. COM1):",IDC_STATIC,7,7,108,8 + LTEXT "Введіть COM-порт (напр. COM1):",IDC_STATIC,7,7,108,8 EDITTEXT IDC_COMPORT,7,17,182,14,ES_AUTOHSCROLL - LTEXT " (. 115200):",IDC_STATIC,7,38,114, + LTEXT "Введіть швидкість передачі (напр. 115200):",IDC_STATIC,7,38,114, 8 EDITTEXT IDC_BAUTRATE,7,48,182,14,ES_AUTOHSCROLL DEFPUSHBUTTON "OK",IDOK,45,79,50,14 - PUSHBUTTON "",IDCANCEL,100,79,50,14 + PUSHBUTTON "Скасувати",IDCANCEL,100,79,50,14 END IDD_CAPTURE DIALOGEX DISCARDABLE 0, 0, 251, 95 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Файл захоплення" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "' :",IDC_STATIC,7,17,62,8 + LTEXT "Ім'я файлу захоплення:",IDC_STATIC,7,17,62,8 EDITTEXT IDC_CAPTUREFILENAME,7,26,181,14,ES_AUTOHSCROLL - PUSHBUTTON "&",IDC_BROWSE,194,26,50,14 + PUSHBUTTON "&Огляд",IDC_BROWSE,194,26,50,14 DEFPUSHBUTTON "OK",IDOK,139,74,50,14 - PUSHBUTTON "",IDCANCEL,194,74,50,14 + PUSHBUTTON "Скасувати",IDCANCEL,194,74,50,14 END @@ -165,13 +164,13 @@ END STRINGTABLE DISCARDABLE BEGIN IDS_APP_TITLE "fdebug" - IDS_HELLO " !" + IDS_HELLO "Привіт Світ!" IDC_FDEBUG "FDEBUG" END STRINGTABLE DISCARDABLE BEGIN - IDS_LICENSE " ; , ³ GNU, ; 2 , - , .\r\n\r\n 䳿 , , - Ҳ, Ҳ Ҳ Ҳ . ³ GNU.\r\n\r\n ³ GNU. , (Free Software Foundation, Inc.), 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA." + IDS_LICENSE "Це вільне програмне забезпечення; Ви можете розповсюджувати її та змінювати, дотримуючись умови Відкритої ліцензійної угоди GNU, опублікованої Фондом вільного програмного забезпечення; або редакції 2 Угоди, або будь-якої редакції, випущеної пізніше.\r\n\r\nЦя програма розповсюджується в надії на те, що вона виявиться корисною, але БЕЗ БУДЬ-ЯКИХ ГАРАНТІЙ, включаючи УЯВНОЮ ГАРАНТІЄЮ ЯКОСТІ або ПРИДАТНОСТІ для певних цілей. Подробиці містяться у Відкритій ліцензійній угоді GNU.\r\n\r\nРазом з цією програмою повинен поширюватися примірник Відкритої ліцензійної угоди GNU. Якщо він відсутній, повідомте про це в Фонд вільного програмного забезпечення (Free Software Foundation, Inc.), 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA." END #endif // Ukrainian resources diff --git a/boot/freeldr/freeldr/CMakeLists.txt b/boot/freeldr/freeldr/CMakeLists.txt index f5f362519c6..fc4d056d30f 100644 --- a/boot/freeldr/freeldr/CMakeLists.txt +++ b/boot/freeldr/freeldr/CMakeLists.txt @@ -1,6 +1,18 @@ +if(ARCH MATCHES i386 OR ARCH MATCHES amd64) + CreateBootSectorTarget2(frldr16 + ${CMAKE_CURRENT_SOURCE_DIR}/arch/realmode/i386.S + ${CMAKE_CURRENT_BINARY_DIR}/frldr16.bin + F800) +endif() + include_directories(BEFORE include) include_directories(${REACTOS_SOURCE_DIR}/ntoskrnl/include) +include_directories(${REACTOS_SOURCE_DIR}/lib/cmlib) +include_directories(${REACTOS_SOURCE_DIR}/include/reactos/libs) +include_directories(${REACTOS_SOURCE_DIR}/include/reactos/elf) + +add_definitions(-D_NTHAL_ -D_BLDR_ -D_NTSYSTEM_) if(ARCH MATCHES arm) if(SARCH MATCHES omap-zoom2) @@ -8,50 +20,14 @@ if(ARCH MATCHES arm) endif() endif() -if(ARCH MATCHES i386) - if(MSVC) - list(APPEND FREELDR_BASE64K_SOURCE - arch/i386/realmode.S) - else() - list(APPEND FREELDR_STARTUP_SOURCE - arch/i386/fathelp.S - arch/i386/arch.S) - endif() -elseif(ARCH MATCHES amd64) - list(APPEND FREELDR_STARTUP_SOURCE - arch/i386/fathelp.S - arch/amd64/arch.S) -endif() - -if(ARCH MATCHES i386) - if(NOT MSVC) - list(APPEND FREELDR_BASE64K_SOURCE - arch/i386/boot.S - arch/i386/drvmap.S - arch/i386/i386cpu.S - arch/i386/i386idt.S - arch/i386/i386pnp.S - arch/i386/i386pxe.S - arch/i386/i386trap.S - arch/i386/int386.S - arch/i386/linux.S - arch/i386/mb.S - arch/i386/i386bug.c) - endif() -elseif(ARCH MATCHES amd64) - list(APPEND FREELDR_BASE64K_SOURCE - arch/i386/drvmap.S - arch/i386/i386cpu.S - arch/i386/i386idt.S - arch/i386/i386trap.S - arch/amd64/mb.S) -endif() - -set_source_files_properties(${FREELDR_BASE64K_SOURCE} PROPERTIES COMPILE_DEFINITIONS "_NTHAL_") - -include_directories(${REACTOS_SOURCE_DIR}/lib/cmlib) - -list(APPEND FREELDR_BASE_SOURCE +list(APPEND FREELDR_COMMON_SOURCE + cmdline.c + debug.c + linuxboot.c + machine.c + options.c + oslist.c + version.c arcemul/mm.c arcemul/time.c cache/blocklist.c @@ -60,7 +36,7 @@ list(APPEND FREELDR_BASE_SOURCE disk/disk.c disk/partition.c disk/ramdisk.c - disk/scsiport.c + #disk/scsiport.c fs/ext2.c fs/fat.c fs/fs.c @@ -76,10 +52,7 @@ list(APPEND FREELDR_BASE_SOURCE reactos/arcname.c reactos/archwsup.c reactos/binhive.c - reactos/reactos.c - reactos/imageldr.c - rtl/bget.c - rtl/libsupp.c + ui/directui.c ui/gui.c ui/minitui.c @@ -95,41 +68,29 @@ list(APPEND FREELDR_BASE_SOURCE windows/winldr.c windows/wlmemory.c windows/wlregistry.c - freeldr.c - debug.c - version.c - cmdline.c - machine.c - options.c - linuxboot.c - oslist.c) +) if(ARCH MATCHES i386) - list(APPEND FREELDR_BASE_SOURCE - windows/headless.c - disk/scsiport.c) -endif() - -set_source_files_properties(${FREELDR_BASE_SOURCE} PROPERTIES COMPILE_DEFINITIONS "_NTHAL_;_BLDR_;_NTSYSTEM_") - -include_directories(${REACTOS_SOURCE_DIR}/include/reactos/libs) -include_directories(${REACTOS_SOURCE_DIR}/include/reactos/elf) - -if(ARCH MATCHES i386) - list(APPEND FREELDR_ARCH_SOURCE + list(APPEND FREELDR_COMMON_SOURCE arch/i386/archmach.c arch/i386/custom.c arch/i386/drivemap.c + arch/i386/entry.S arch/i386/halstub.c arch/i386/hardware.c arch/i386/hwacpi.c arch/i386/hwapm.c arch/i386/hwpci.c + arch/i386/i386bug.c arch/i386/i386disk.c + arch/i386/i386idt.c + arch/i386/i386pnp.cmake.S arch/i386/i386rtl.c + arch/i386/i386trap.S arch/i386/i386vid.c - arch/i386/loader.c + arch/i386/linux.cmake.S arch/i386/machpc.c + arch/i386/mb.S arch/i386/miscboot.c arch/i386/ntoskrnl.c arch/i386/pccons.c @@ -147,97 +108,128 @@ if(ARCH MATCHES i386) arch/i386/xboxrtc.c arch/i386/xboxvideo.c windows/i386/ntsetup.c - windows/i386/wlmemory.c) + windows/i386/wlmemory.c + windows/headless.c + disk/scsiport.c) + if(NOT MSVC) + list(APPEND FREELDR_COMMON_SOURCE + arch/i386/drvmap.S + arch/i386/multiboot.S) + endif() +elseif(ARCH MATCHES amd64) + list(APPEND FREELDR_COMMON_SOURCE + arch/amd64/entry.S + arch/amd64/loader.c + arch/i386/hardware.c + arch/i386/hwacpi.c + arch/i386/hwapm.c + arch/i386/hwpci.c + arch/i386/i386rtl.c + arch/i386/i386disk.c + arch/i386/i386vid.c + arch/i386/machpc.c + arch/i386/ntoskrnl.c + arch/i386/pccons.c + arch/i386/pcdisk.c + arch/i386/pcmem.c + arch/i386/pcrtc.c + arch/i386/pcvideo.c + windows/amd64/ntsetup.c + windows/amd64/wlmemory.c) else() #TBD endif() -set_source_files_properties(${FREELDR_ARCH_SOURCE} PROPERTIES COMPILE_DEFINITIONS "_NTHAL_;_BLDR_;_NTSYSTEM_") -add_library(freeldr_arch ${FREELDR_ARCH_SOURCE}) +add_library(freeldr_common ${FREELDR_COMMON_SOURCE}) +add_dependencies(freeldr_common bugcodes) -list(APPEND FREELDR_SOURCE - bootmgr.c - ${FREELDR_STARTUP_SOURCE} - ${FREELDR_BASE64K_SOURCE} - ${FREELDR_BASE_SOURCE} - ) -add_library(freeldr SHARED - ${CMAKE_CURRENT_BINARY_DIR}/freeldr_freeldr.h.gch - ${FREELDR_SOURCE}) +list(APPEND FREELDR_BASE_SOURCE + bootmgr.c # This file is compiled with custom definitions + freeldr.c + rtl/bget.c + rtl/libsupp.c +) + +add_executable(freeldr_pe ${FREELDR_BASE_SOURCE}) if(NOT MSVC) - set_target_properties(freeldr PROPERTIES LINK_FLAGS "-Wl,--strip-all -Wl,--exclude-all-symbols -Wl,--file-alignment,0x1000 -Wl,-T,${CMAKE_CURRENT_SOURCE_DIR}/freeldr_i386.lnk" SUFFIX ".sys") -set_image_base(freeldr 0x8000) + set_target_properties(freeldr_pe PROPERTIES LINK_FLAGS "-Wl,--strip-all -Wl,--exclude-all-symbols -Wl,--file-alignment,0x1000 -Wl,-T,${CMAKE_CURRENT_SOURCE_DIR}/freeldr_i386.lnk") else() - set_target_properties(freeldr PROPERTIES LINK_FLAGS "/ignore:4078 /ignore:4254 /DRIVER /FIXED /ALIGN:0x400 /SECTION:.text,ERW /SECTION:.data,RW /MERGE:.text16=.text /MERGE:.data=.text /MERGE:.rdata=.text /MERGE:.bss=.text /SUBSYSTEM:BOOT_APPLICATION" SUFFIX ".sys") -set_image_base(freeldr 0x10000) + set_target_properties(freeldr_pe PROPERTIES LINK_FLAGS "/ignore:4078 /ignore:4254 /DRIVER /FIXED /ALIGN:0x400 /SECTION:.text,ERW /SECTION:.data,RW /MERGE:.text16=.text /MERGE:.data=.text /MERGE:.rdata=.text /MERGE:.bss=.text /SUBSYSTEM:BOOT_APPLICATION") endif() -set_subsystem(freeldr native) -set_entrypoint(freeldr mainCRTStartup) +set_image_base(freeldr_pe 0x10000) +set_subsystem(freeldr_pe native) +set_entrypoint(freeldr_pe RealEntryPoint) if(ARCH MATCHES i386) - target_link_libraries(freeldr mini_hal) + target_link_libraries(freeldr_pe mini_hal) endif() -target_link_libraries(freeldr - freeldr_arch +target_link_libraries(freeldr_pe + freeldr_common cportlib rossym cmlib rtl libcntpr) -add_pch(freeldr ${CMAKE_CURRENT_SOURCE_DIR}/include/freeldr.h ${FREELDR_SOURCE}) -add_dependencies(freeldr asm) +add_pch(freeldr_pe include/freeldr.h) +add_dependencies(freeldr_pe asm) -add_cd_file(TARGET freeldr DESTINATION loader NO_CAB FOR all) +concatenate_files( + ${CMAKE_CURRENT_BINARY_DIR}/frldr16.bin + ${CMAKE_CURRENT_BINARY_DIR}/freeldr_pe.exe + ${CMAKE_CURRENT_BINARY_DIR}/freeldr.sys) -list(APPEND SETUPLDR_MAIN_SOURCE - bootmgr.c - inffile/inffile.c - reactos/setupldr.c) +add_custom_target(freeldr ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/freeldr.sys) -if(ARCH MATCHES i386 OR ARCH MATCHES amd64) - list(APPEND SETUPLDR_MAIN_SOURCE windows/setupldr2.c) -endif() - -if(NOT MSVC) - set_source_files_properties(${SETUPLDR_MAIN_SOURCE} PROPERTIES COMPILE_FLAGS "-ffreestanding -fno-builtin -fno-inline -fno-zero-initialized-in-bss") -endif() +add_cd_file(TARGET freeldr FILE ${CMAKE_CURRENT_BINARY_DIR}/freeldr.sys DESTINATION loader NO_CAB FOR all) list(APPEND SETUPLDR_SOURCE - ${FREELDR_STARTUP_SOURCE} - ${FREELDR_BASE64K_SOURCE} - ${FREELDR_BASE_SOURCE} - ${SETUPLDR_MAIN_SOURCE}) + inffile/inffile.c) -add_library(setupldr SHARED ${SETUPLDR_SOURCE}) +if(ARCH MATCHES i386 OR ARCH MATCHES amd64) + list(APPEND SETUPLDR_SOURCE windows/setupldr2.c) +endif() if(NOT MSVC) - set_target_properties(setupldr PROPERTIES LINK_FLAGS "-Wl,--strip-all -Wl,--exclude-all-symbols -Wl,--file-alignment,0x1000 -Wl,-T,${CMAKE_CURRENT_SOURCE_DIR}/freeldr_i386.lnk" SUFFIX ".sys" COMPILE_DEFINITIONS "FREELDR_REACTOS_SETUP") -set_image_base(setupldr 0x8000) -else() - set_target_properties(setupldr PROPERTIES LINK_FLAGS "/DRIVER /SECTION:.text,ERWP,ALIGN=0x1000" SUFFIX ".sys" COMPILE_DEFINITIONS "FREELDR_REACTOS_SETUP") + set_source_files_properties(${SETUPLDR_SOURCE} PROPERTIES COMPILE_FLAGS "-ffreestanding -fno-builtin -fno-inline -fno-zero-initialized-in-bss") endif() -set_subsystem(setupldr native) -set_entrypoint(setupldr mainCRTStartup) +add_executable(setupldr_pe ${FREELDR_BASE_SOURCE} ${SETUPLDR_SOURCE}) + +if(NOT MSVC) + set_target_properties(setupldr_pe PROPERTIES LINK_FLAGS "-Wl,--strip-all -Wl,--exclude-all-symbols -Wl,--file-alignment,0x1000 -Wl,-T,${CMAKE_CURRENT_SOURCE_DIR}/freeldr_i386.lnk" COMPILE_DEFINITIONS "FREELDR_REACTOS_SETUP") +else() + set_target_properties(setupldr_pe PROPERTIES LINK_FLAGS "/ignore:4078 /ignore:4254 /DRIVER /FIXED /ALIGN:0x400 /SECTION:.text,ERW /SECTION:.data,RW /MERGE:.text16=.text /MERGE:.data=.text /MERGE:.rdata=.text /MERGE:.bss=.text /SUBSYSTEM:BOOT_APPLICATION" COMPILE_DEFINITIONS "FREELDR_REACTOS_SETUP") +endif() + +set_image_base(setupldr_pe 0x10000) +set_subsystem(setupldr_pe native) +set_entrypoint(setupldr_pe RealEntryPoint) if(ARCH MATCHES i386) - target_link_libraries(setupldr mini_hal) + target_link_libraries(setupldr_pe mini_hal) endif() -target_link_libraries(setupldr - freeldr_arch +target_link_libraries(setupldr_pe + freeldr_common cportlib rossym cmlib rtl libcntpr) -add_dependencies(setupldr asm) +add_dependencies(setupldr_pe asm) -add_cd_file(TARGET setupldr DESTINATION loader NO_CAB FOR all) +concatenate_files( + ${CMAKE_CURRENT_BINARY_DIR}/frldr16.bin + ${CMAKE_CURRENT_BINARY_DIR}/setupldr_pe.exe + ${CMAKE_CURRENT_BINARY_DIR}/setupldr.sys) + +add_custom_target(setupldr ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/setupldr.sys) + +add_cd_file(TARGET setupldr FILE ${CMAKE_CURRENT_BINARY_DIR}/setupldr.sys DESTINATION loader NO_CAB FOR all) diff --git a/boot/freeldr/freeldr/arcemul/mm.c b/boot/freeldr/freeldr/arcemul/mm.c index 57a654e0b20..09677bf28e5 100644 --- a/boot/freeldr/freeldr/arcemul/mm.c +++ b/boot/freeldr/freeldr/arcemul/mm.c @@ -35,8 +35,8 @@ static const MEMORY_DESCRIPTOR_INT MemoryDescriptors[] = #endif }; -MEMORY_DESCRIPTOR* -ArcGetMemoryDescriptor(MEMORY_DESCRIPTOR* Current) +const MEMORY_DESCRIPTOR* +ArcGetMemoryDescriptor(const MEMORY_DESCRIPTOR* Current) { MEMORY_DESCRIPTOR_INT* CurrentDescriptor; BIOS_MEMORY_MAP BiosMemoryMap[32]; @@ -55,7 +55,8 @@ ArcGetMemoryDescriptor(MEMORY_DESCRIPTOR* Current) // RtlZeroMemory(BiosMemoryMap, sizeof(BIOS_MEMORY_MAP) * 32); BiosMemoryMapEntryCount = MachVtbl.GetMemoryMap(BiosMemoryMap, - sizeof(BiosMemoryMap) / sizeof(BIOS_MEMORY_MAP)); + sizeof(BiosMemoryMap) / + sizeof(BIOS_MEMORY_MAP)); // // Copy the entries to our structure @@ -77,8 +78,8 @@ ArcGetMemoryDescriptor(MEMORY_DESCRIPTOR* Current) // Copy this memory descriptor // BiosMemoryDescriptors[j].m.MemoryType = MemoryFree; - BiosMemoryDescriptors[j].m.BasePage = BiosMemoryMap[i].BaseAddress / MM_PAGE_SIZE; - BiosMemoryDescriptors[j].m.PageCount = BiosMemoryMap[i].Length / MM_PAGE_SIZE; + BiosMemoryDescriptors[j].m.BasePage = (ULONG)(BiosMemoryMap[i].BaseAddress / MM_PAGE_SIZE); + BiosMemoryDescriptors[j].m.PageCount = (ULONG)(BiosMemoryMap[i].Length / MM_PAGE_SIZE); BiosMemoryDescriptors[j].Index = j; BiosMemoryDescriptors[j].GeneratedDescriptor = TRUE; j++; @@ -114,7 +115,7 @@ ArcGetMemoryDescriptor(MEMORY_DESCRIPTOR* Current) // // Return first fixed memory descriptor // - return (MEMORY_DESCRIPTOR*)&MemoryDescriptors[0].m; + return &MemoryDescriptors[0].m; } else { @@ -141,7 +142,7 @@ ArcGetMemoryDescriptor(MEMORY_DESCRIPTOR* Current) // // Return first fixed memory descriptor // - return (MEMORY_DESCRIPTOR*)&MemoryDescriptors[0].m; + return &MemoryDescriptors[0].m; } else { @@ -161,7 +162,7 @@ ArcGetMemoryDescriptor(MEMORY_DESCRIPTOR* Current) // // Return next fixed descriptor // - return (MEMORY_DESCRIPTOR*)&MemoryDescriptors[CurrentDescriptor->Index + 1].m; + return &MemoryDescriptors[CurrentDescriptor->Index + 1].m; } else { diff --git a/boot/freeldr/freeldr/arch/amd64/arch.S b/boot/freeldr/freeldr/arch/amd64/arch.S index 236a0be4b69..4be61c377b8 100644 --- a/boot/freeldr/freeldr/arch/amd64/arch.S +++ b/boot/freeldr/freeldr/arch/amd64/arch.S @@ -3,8 +3,6 @@ #include -#include - .text .code16 @@ -25,21 +23,20 @@ RealEntryPoint: /* checkPoint Charlie - where it all began... */ mov si, offset CheckPoint0 - call writestr + call writestr /* Setup a real mode stack */ mov sp, stack16 - /* Zero BootDrive and BootPartition */ + /* Zero BootPartition */ xor eax, eax - mov BootDrive, eax - mov BootPartition, eax + mov FrldrBootPartition, eax /* Store the boot drive */ - mov BootDrive, dl + mov FrldrBootDrive, dl /* Store the boot partition */ - mov BootPartition, dh + mov FrldrBootPartition, dh /* Load the GDT */ lgdt gdtptr @@ -50,16 +47,16 @@ RealEntryPoint: /* checkPoint Charlie - where it all began... */ mov si, offset CheckPoint1 - call writestr - + call writestr + call x86_16_BuildPageTables - + /* checkPoint Charlie - where it all began... */ mov si, offset CheckPoint2 - call writestr + call writestr /* Check if CPU supports CPUID */ - + pushfd pop eax mov ebx, eax @@ -70,8 +67,8 @@ RealEntryPoint: pop eax cmp eax,ebx jz NO_CPUID_SUPPORT_DETECTED - - /* CPUID support detected - getting the PAE/PGE */ + + /* CPUID support detected - getting the PAE/PGE */ mov eax,1 // Fn0000_0001 - PAE in EDX[6] cpuid @@ -79,24 +76,24 @@ RealEntryPoint: and edx,0x00a0 test edx,edx // are PAE and PGE bits set? jz NO_X64_SUPPORT_DETECTED - + /* PAE and PGE are here */ - + xor edx, edx mov eax, 0x80000001 cpuid and edx, 0x20000000 test edx,edx jz NO_X64_SUPPORT_DETECTED - + /* X64 Processor */ - + /* checkPoint Charlie - where it all began... */ mov si, offset CheckPoint3 - call writestr + call writestr jmp switch64 - + NO_X64_SUPPORT_DETECTED: mov si, offset NotAnX64Processor // Loading message call writestr @@ -129,7 +126,7 @@ switch64: // mov ds, ax // mov word ptr ds:[0xb8002], 0x0e02 + '2' - + /* Return into real mode */ call x86_64_SwitchToReal .code16 @@ -169,7 +166,7 @@ x86_16_EnableA20: ret /* - * We define 512 2MB pages at the start of memory, so we can access the first + * We define 512 2MB pages at the start of memory, so we can access the first * 1 GB as if paging was disabled */ x86_16_BuildPageTables: @@ -238,7 +235,7 @@ writestr: popad popfd ret - + writechr: pushf @@ -252,7 +249,7 @@ writechr: //.global x86_16_SwitchToLong x86_16_SwitchToLong: - + cli xor ax,ax @@ -332,7 +329,7 @@ SwitchToReal1: /* Step 2 - disable long mode in EFER MSR */ // mov ecx, 0xC0000080 // Specify EFER MSR -// rdmsr +// rdmsr // and eax, ~0x00000100 // Disable EFER.LME // wrmsr @@ -408,12 +405,12 @@ gdtptr: .long gdt /* Base Address */ -.global BootDrive -BootDrive: - .long 0 - -.global BootPartition -BootPartition: +.global FrldrBootDrive +FrldrBootDrive: + .byte 0 + +.global FrldrBootPartition +FrldrBootPartition: .long 0 .global NotAnX64Processor @@ -431,12 +428,12 @@ NoCPUIDSupport: CheckPoint0: .ascii "Starting FreeLoader..." .byte 0x0d, 0x0a, 0 - + .global CheckPoint1 CheckPoint1: .ascii "FreeLoader[16-bit]: building page tables..." .byte 0x0d, 0x0a, 0 - + .global CheckPoint2 CheckPoint2: .ascii "FreeLoader[16-bit]: checking CPU for x64 long mode..." diff --git a/boot/freeldr/freeldr/arch/amd64/boot.S b/boot/freeldr/freeldr/arch/amd64/boot.S index bc2e43e9e8b..277e773b992 100644 --- a/boot/freeldr/freeldr/arch/amd64/boot.S +++ b/boot/freeldr/freeldr/arch/amd64/boot.S @@ -23,9 +23,6 @@ .text .code16 -#define ASM -#include - PUBLIC ChainLoadBiosBootSectorCode ChainLoadBiosBootSectorCode: .code64 diff --git a/boot/freeldr/freeldr/arch/amd64/drvmap.S b/boot/freeldr/freeldr/arch/amd64/drvmap.S index 6871fe0f62d..9cfba3ccb45 100644 --- a/boot/freeldr/freeldr/arch/amd64/drvmap.S +++ b/boot/freeldr/freeldr/arch/amd64/drvmap.S @@ -20,9 +20,7 @@ .text .code16 -#define ASM -#include - +#include EXTERN(DriveMapInt13HandlerStart) Int13Handler: diff --git a/boot/freeldr/freeldr/arch/amd64/entry.S b/boot/freeldr/freeldr/arch/amd64/entry.S new file mode 100644 index 00000000000..242275bb387 --- /dev/null +++ b/boot/freeldr/freeldr/arch/amd64/entry.S @@ -0,0 +1,39 @@ + + +#include +#include + +.code64 + +PUBLIC RealEntryPoint +RealEntryPoint: + +PUBLIC FrldrBootDrive +FrldrBootDrive: + +PUBLIC FrldrBootPartition +FrldrBootPartition: + +PUBLIC PageDirectoryEnd +PageDirectoryEnd: +PUBLIC PageDirectoryStart +PageDirectoryStart: +PUBLIC PnpBiosGetDeviceNode +PnpBiosGetDeviceNode: +PUBLIC PnpBiosGetDeviceNodeCount +PnpBiosGetDeviceNodeCount: +PUBLIC PnpBiosSupported +PnpBiosSupported: +PUBLIC Int386 +Int386: +PUBLIC PxeCallApi +PxeCallApi: +PUBLIC __lgdt +__lgdt: +PUBLIC __ltr +__ltr: + +nop + + +END diff --git a/boot/freeldr/freeldr/arch/amd64/i386cpu.S b/boot/freeldr/freeldr/arch/amd64/i386cpu.S index ee3ee6fe256..449d491b88b 100644 --- a/boot/freeldr/freeldr/arch/amd64/i386cpu.S +++ b/boot/freeldr/freeldr/arch/amd64/i386cpu.S @@ -20,9 +20,7 @@ .text .code16 -#define ASM - -#include +#include /* * U32 CpuidSupported(VOID); diff --git a/boot/freeldr/freeldr/arch/amd64/i386idt.S b/boot/freeldr/freeldr/arch/amd64/i386idt.S index 10d3f16a0ae..38e9790825d 100644 --- a/boot/freeldr/freeldr/arch/amd64/i386idt.S +++ b/boot/freeldr/freeldr/arch/amd64/i386idt.S @@ -20,10 +20,6 @@ .text .code16 -#define ASM -#include - - .p2align 2 /* force 4-byte alignment */ EXTERN(i386idt) /* Exception 0 - Divide By Zero */ diff --git a/boot/freeldr/freeldr/arch/amd64/i386pnp.S b/boot/freeldr/freeldr/arch/amd64/i386pnp.S index c74fb97d64d..10228caa476 100644 --- a/boot/freeldr/freeldr/arch/amd64/i386pnp.S +++ b/boot/freeldr/freeldr/arch/amd64/i386pnp.S @@ -23,9 +23,7 @@ .text .code16 -#define ASM - -#include +#include /* @@ -199,7 +197,7 @@ EXTERN(PnpBiosGetDeviceNode) mov al, [rsi] mov _pnp_node_number, al - /* convert pointer to node buffer to segment/offset */ + /* convert pointer to node buffer to segment/offset */ mov eax, [rbp + 0x0C] shr eax, 4 and eax, 0xf000 @@ -215,7 +213,7 @@ EXTERN(PnpBiosGetDeviceNode) mov ax, _pnp_bios_data_segment push ax - /* push control flag */ + /* push control flag */ push 0x0001 /* push pointer to node buffer (segment/offset) */ diff --git a/boot/freeldr/freeldr/arch/amd64/i386trap.S b/boot/freeldr/freeldr/arch/amd64/i386trap.S index 195bf097cd0..11397fab13f 100644 --- a/boot/freeldr/freeldr/arch/amd64/i386trap.S +++ b/boot/freeldr/freeldr/arch/amd64/i386trap.S @@ -20,8 +20,7 @@ .text .code16 -#define ASM -#include +#include #include #define SCREEN_ATTR 0x1f /* Bright white on blue background */ @@ -517,7 +516,7 @@ i386PrintTextLoop2: jmp i386PrintTextLoop i386PrintTextDone: - + ret /************************************************************************/ diff --git a/boot/freeldr/freeldr/arch/amd64/int386.S b/boot/freeldr/freeldr/arch/amd64/int386.S index 6881173910d..820eb49e82c 100644 --- a/boot/freeldr/freeldr/arch/amd64/int386.S +++ b/boot/freeldr/freeldr/arch/amd64/int386.S @@ -24,8 +24,7 @@ .text .code16 -#define ASM -#include +#include Int386_REGS: diff --git a/boot/freeldr/freeldr/arch/amd64/loader.c b/boot/freeldr/freeldr/arch/amd64/loader.c index 9970090cd3a..f72cbe9a4c9 100644 --- a/boot/freeldr/freeldr/arch/amd64/loader.c +++ b/boot/freeldr/freeldr/arch/amd64/loader.c @@ -27,7 +27,6 @@ extern ULONG_PTR KernelBase; ULONG_PTR GdtBase, IdtBase, TssBase; extern ROS_KERNEL_ENTRY_POINT KernelEntryPoint; -PPAGE_DIRECTORY_AMD64 pPML4; PVOID pIdt, pGdt; /* FUNCTIONS *****************************************************************/ diff --git a/boot/freeldr/freeldr/arch/amd64/mb.S b/boot/freeldr/freeldr/arch/amd64/mb.S index 51b06bc1e01..fe4ff62334d 100644 --- a/boot/freeldr/freeldr/arch/amd64/mb.S +++ b/boot/freeldr/freeldr/arch/amd64/mb.S @@ -23,8 +23,7 @@ .text .code16 -#define ASM -#include +#include #include /* @@ -33,7 +32,7 @@ */ .code64 .globl PageDirectoryStart - + .globl pml4_startup .globl pdp_startup .globl pd_startup diff --git a/boot/freeldr/freeldr/arch/amd64/stubs.S b/boot/freeldr/freeldr/arch/amd64/stubs.S new file mode 100644 index 00000000000..3f2e0e4a462 --- /dev/null +++ b/boot/freeldr/freeldr/arch/amd64/stubs.S @@ -0,0 +1,48 @@ + + +#include + +EXTERN BootMain:PROC + +.code64 + +/* 64 bit entry point */ +PUBLIC mainCRTStartup +mainCRTStartup: + jmp BootMain + +PUBLIC Int386 +Int386: + ret + +PUBLIC __lgdt +__lgdt: + +PUBLIC __ltr +__ltr: + +PUBLIC PxeCallApi +PxeCallApi: + .long 0 + +PUBLIC PageDirectoryStart +PageDirectoryStart: + .long 0 + +PUBLIC PageDirectoryEnd +PageDirectoryEnd: + .long 0 + +PUBLIC PnpBiosGetDeviceNode +PnpBiosGetDeviceNode: + .long 0 + +PUBLIC PnpBiosGetDeviceNodeCount +PnpBiosGetDeviceNodeCount: + .long 0 + +PUBLIC PnpBiosSupported +PnpBiosSupported: + .long 0 + +END diff --git a/boot/freeldr/freeldr/arch/i386/_alloca.S b/boot/freeldr/freeldr/arch/i386/_alloca.S deleted file mode 100644 index 920db73b40e..00000000000 --- a/boot/freeldr/freeldr/arch/i386/_alloca.S +++ /dev/null @@ -1,33 +0,0 @@ -/* stuff needed for libgcc on win32. */ - -/*#ifdef L_chkstk*/ -#ifdef WIN32 - - .global ___chkstk - .global __alloca -___chkstk: -__alloca: - pushl %ecx /* save temp */ - movl %esp,%ecx /* get sp */ - addl $0x8,%ecx /* and point to return addr */ - -probe: cmpl $0x1000,%eax /* > 4k ?*/ - jb done - - subl $0x1000,%ecx /* yes, move pointer down 4k*/ - orl $0x0,(%ecx) /* probe there */ - subl $0x1000,%eax /* decrement count */ - jmp probe /* and do it again */ - -done: subl %eax,%ecx - orl $0x0,(%ecx) /* less that 4k, just peek here */ - - movl %esp,%eax - movl %ecx,%esp /* decrement stack */ - - movl (%eax),%ecx /* recover saved temp */ - movl 4(%eax),%eax /* get return address */ - jmp *%eax - - -#endif diff --git a/boot/freeldr/freeldr/arch/i386/arch.S b/boot/freeldr/freeldr/arch/i386/arch.S index 225dc4be3f9..3251fdd1c52 100644 --- a/boot/freeldr/freeldr/arch/i386/arch.S +++ b/boot/freeldr/freeldr/arch/i386/arch.S @@ -20,13 +20,12 @@ .intel_syntax noprefix #define HEX(y) 0x##y -#define ASM -#include +#include #include .code16 -EXTERN(RealEntryPoint) +EXTERN(_RealEntryPoint) cli @@ -48,16 +47,17 @@ EXTERN(RealEntryPoint) .code32 - /* Zero BootDrive and BootPartition */ + /* Zero BootPartition */ xor eax, eax - mov dword ptr [_BootDrive], eax - mov dword ptr [_BootPartition], eax + mov dword ptr [_FrldrBootPartition], eax /* Store the boot drive */ - mov byte ptr [_BootDrive], dl + mov byte ptr [_FrldrBootDrive], dl /* Store the boot partition */ - mov byte ptr [_BootPartition], dh + mov byte ptr [_FrldrBootPartition], dh + + call _EnableA20 /* GO! */ push eax @@ -302,7 +302,7 @@ EXTERN(_DisableA20) /* Align 32 bits boundary */ .align 4 - + /* Multiboot header */ MultibootHeader: /* magic */ @@ -400,12 +400,12 @@ mb4: mov eax, [ebx + MB_INFO_BOOT_DEVICE_OFFSET] shr eax, 16 inc al - mov byte ptr _BootPartition, al - mov byte ptr _BootDrive, ah + mov byte ptr _FrldrBootPartition, al + mov byte ptr _FrldrBootDrive, ah jmp mb6 mb5: /* No boot device known, assume first partition of first harddisk */ - mov byte ptr _BootDrive, HEX(80) - mov byte ptr _BootPartition, 1 + mov byte ptr _FrldrBootDrive, HEX(80) + mov byte ptr _FrldrBootPartition, 1 mb6: /* Check for command line */ mov eax, offset cmdline @@ -415,7 +415,7 @@ mb6: mb7: /* GO! */ - push eax + push eax call _BootMain mbfail: @@ -496,8 +496,8 @@ mb_info: cmdline: .fill CMDLINE_SIZE, 1, 0 -EXTERN(_BootDrive) - .long 0 - -EXTERN(_BootPartition) +EXTERN(_FrldrBootDrive) + .byte 0 + +EXTERN(_FrldrBootPartition) .long 0 diff --git a/boot/freeldr/freeldr/arch/i386/boot.S b/boot/freeldr/freeldr/arch/i386/boot.S index ec07351fe58..079ae1e1976 100644 --- a/boot/freeldr/freeldr/arch/i386/boot.S +++ b/boot/freeldr/freeldr/arch/i386/boot.S @@ -20,9 +20,7 @@ .text .code16 -#define ASM -#include - +#include EXTERN(_ChainLoadBiosBootSectorCode) .code32 @@ -31,7 +29,7 @@ EXTERN(_ChainLoadBiosBootSectorCode) .code16 /* Set the boot drive */ - movb (_BootDrive),%dl + movb (_FrldrBootDrive),%dl /* Load segment registers */ cli diff --git a/boot/freeldr/freeldr/arch/i386/custom.c b/boot/freeldr/freeldr/arch/i386/custom.c index 14e651df785..a53d42301af 100644 --- a/boot/freeldr/freeldr/arch/i386/custom.c +++ b/boot/freeldr/freeldr/arch/i386/custom.c @@ -60,9 +60,6 @@ VOID OptionMenuCustomBoot(VOID) case 2: // Boot Sector File OptionMenuCustomBootBootSectorFile(); break; - case 3: // ReactOS - OptionMenuCustomBootReactOS(); - break; case 4: // Linux OptionMenuCustomBootLinux(); break; @@ -234,79 +231,6 @@ VOID OptionMenuCustomBootBootSectorFile(VOID) LoadAndBootBootSector(SectionName); } -VOID OptionMenuCustomBootReactOS(VOID) -{ - CHAR SectionName[100]; - CHAR BootDriveString[20]; - CHAR BootPartitionString[20]; - CHAR ReactOSSystemPath[200]; - CHAR ReactOSARCPath[200]; - CHAR ReactOSOptions[200]; - ULONG SectionId; - TIMEINFO* TimeInfo; - - RtlZeroMemory(SectionName, sizeof(SectionName)); - RtlZeroMemory(BootDriveString, sizeof(BootDriveString)); - RtlZeroMemory(BootPartitionString, sizeof(BootPartitionString)); - RtlZeroMemory(ReactOSSystemPath, sizeof(ReactOSSystemPath)); - RtlZeroMemory(ReactOSOptions, sizeof(ReactOSOptions)); - - if (!UiEditBox(BootDrivePrompt, BootDriveString, 20)) - { - return; - } - - if (!UiEditBox(BootPartitionPrompt, BootPartitionString, 20)) - { - return; - } - - if (!UiEditBox(ReactOSSystemPathPrompt, ReactOSSystemPath, 200)) - { - return; - } - - if (!UiEditBox(ReactOSOptionsPrompt, ReactOSOptions, 200)) - { - return; - } - - // Generate a unique section name - TimeInfo = ArcGetTime(); - sprintf(SectionName, "CustomReactOS%u%u%u%u%u%u", TimeInfo->Year, TimeInfo->Day, TimeInfo->Month, TimeInfo->Hour, TimeInfo->Minute, TimeInfo->Second); - - // Add the section - if (!IniAddSection(SectionName, &SectionId)) - { - return; - } - - // Add the BootType - if (!IniAddSettingValueToSection(SectionId, "BootType", "ReactOS")) - { - return; - } - - // Construct the ReactOS ARC system path - ConstructArcPath(ReactOSARCPath, ReactOSSystemPath, DriveMapGetBiosDriveNumber(BootDriveString), atoi(BootPartitionString)); - - // Add the system path - if (!IniAddSettingValueToSection(SectionId, "SystemPath", ReactOSARCPath)) - { - return; - } - - // Add the CommandLine - if (!IniAddSettingValueToSection(SectionId, "Options", ReactOSOptions)) - { - return; - } - - UiMessageBox(CustomBootPrompt); - - LoadAndBootReactOS(SectionName); -} - VOID OptionMenuCustomBootLinux(VOID) { CHAR SectionName[100]; diff --git a/boot/freeldr/freeldr/arch/i386/drivemap.c b/boot/freeldr/freeldr/arch/i386/drivemap.c index 53da896665d..174595b63b7 100644 --- a/boot/freeldr/freeldr/arch/i386/drivemap.c +++ b/boot/freeldr/freeldr/arch/i386/drivemap.c @@ -25,6 +25,7 @@ ULONG OldInt13HandlerAddress = 0; // Address of BIOS int 13h handler ULONG DriveMapHandlerAddress = 0; // Linear address of our drive map handler ULONG DriveMapHandlerSegOff = 0; // Segment:offset style address of our drive map handler +#ifndef _MSC_VER VOID DriveMapMapDrivesInSection(PCSTR SectionName) { CHAR SettingName[80]; @@ -141,10 +142,11 @@ BOOLEAN DriveMapIsValidDriveString(PCSTR DriveString) return TRUE; } +#endif -ULONG DriveMapGetBiosDriveNumber(PCSTR DeviceName) +UCHAR DriveMapGetBiosDriveNumber(PCSTR DeviceName) { - ULONG BiosDriveNumber = 0; + UCHAR BiosDriveNumber = 0; // If they passed in a number string then just // convert it to decimal and return it @@ -167,6 +169,7 @@ ULONG DriveMapGetBiosDriveNumber(PCSTR DeviceName) return BiosDriveNumber; } +#ifndef _MSC_VER VOID DriveMapInstallInt13Handler(PDRIVE_MAP_LIST DriveMap) { ULONG* RealModeIVT = (ULONG*)0x00000000; @@ -220,3 +223,4 @@ VOID DriveMapRemoveInt13Handler(VOID) DriveMapInstalled = FALSE; } } +#endif diff --git a/boot/freeldr/freeldr/arch/i386/drvmap.S b/boot/freeldr/freeldr/arch/i386/drvmap.S index d6b081ca60b..5f4415ecafb 100644 --- a/boot/freeldr/freeldr/arch/i386/drvmap.S +++ b/boot/freeldr/freeldr/arch/i386/drvmap.S @@ -17,85 +17,92 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ - .text - .code16 -#define ASM -#include +#include +#include +.code16 -EXTERN(_DriveMapInt13HandlerStart) +PUBLIC _DriveMapInt13HandlerStart +_DriveMapInt13HandlerStart: Int13Handler: - pushw %bp - movw %sp,%bp - pushw %ax - pushw %cx - pushw %si + push bp + mov bp, sp + push ax + push cx + push si cld /* Get callers flags from stack */ - movw 0x06(%bp),%ax - movw %ax,%cs:(CallersFlags - Int13Handler) + mov ax, [bp + 6] + mov word ptr cs:[CallersFlags - Int13Handler], ax /* Save the drive number they passed in */ - movb %dl,%cs:(PassedInDriveNumber - Int13Handler) + mov cs:[PassedInDriveNumber - Int13Handler], dl /* Now we need to perform the mapping */ - xorw %cx,%cx - movw $(Int13HandlerMapCount - Int13Handler),%si + xor cx, cx + mov si, offset Int13HandlerMapCount - Int13Handler + /* Get the count of drives in the map list */ - movb %cs:(%si),%cl - incw %si + mov cl, cs:[si] + inc si /* If the map list is empty then just call the old int 13h handler */ - cmpb $0,%cl - jz CallOldInt13Handler + cmp cl, 0 + jz CallOldInt13Handler GetMappedDriveNumberLoop: /* Get the next drive number in the list */ - lodsw %cs:(%si),%ax + lods ax, cs:[si] + /* Check to see if it's the one they are calling int 13h for */ - cmpb %al,%dl + cmp dl, al + /* If not get the next one */ - jne GetMappedDriveNumberLoopNext + jne GetMappedDriveNumberLoopNext /* If we get here then we have found a mapped drive */ /* Send new drive number on to the old int 13h handler */ - movb %ah,%dl + mov dl, ah + /* Call BIOS Int 13 Handler */ - jmp CallOldInt13Handler + jmp CallOldInt13Handler GetMappedDriveNumberLoopNext: - loop GetMappedDriveNumberLoop + loop GetMappedDriveNumberLoop CallOldInt13Handler: /* Restore the registers we changed off the stack */ - popw %si - popw %cx - popw %ax + pop si + pop cx + pop ax /* Put flags onto stack */ - pushw %cs:(CallersFlags - Int13Handler) + push word ptr cs:[CallersFlags - Int13Handler] + /* Call old int 13h handler with new drive number */ - .byte 0x9a /* lcall */ -EXTERN(_DriveMapOldInt13HandlerAddress) + .byte HEX(9a) /* lcall */ +PUBLIC _DriveMapOldInt13HandlerAddress +_DriveMapOldInt13HandlerAddress: .word 0 .word 0 /* Update the callers flags with the values the BIOS returned */ - pushw %ax + push ax pushf - popw %ax - movw %ax,0x06(%bp) - popw %ax - /* Restore the callers drive number */ - movb %cs:(PassedInDriveNumber - Int13Handler),%dl + pop ax + mov [bp + 6], ax + pop ax - popw %bp + /* Restore the callers drive number */ + mov dl, cs:[PassedInDriveNumber - Int13Handler] + + pop bp iret @@ -105,7 +112,8 @@ CallersFlags: PassedInDriveNumber: .byte 0 -EXTERN(_DriveMapInt13HandlerMapList) +PUBLIC _DriveMapInt13HandlerMapList +_DriveMapInt13HandlerMapList: Int13HandlerMapCount: .byte 0 @@ -129,4 +137,5 @@ Int13HandlerDrive4: Int13HandlerDriveNew4: .byte 0 -EXTERN(_DriveMapInt13HandlerEnd) +PUBLIC _DriveMapInt13HandlerEnd +_DriveMapInt13HandlerEnd: diff --git a/boot/freeldr/freeldr/arch/i386/entry.S b/boot/freeldr/freeldr/arch/i386/entry.S new file mode 100644 index 00000000000..c117aa07c0e --- /dev/null +++ b/boot/freeldr/freeldr/arch/i386/entry.S @@ -0,0 +1,302 @@ +/* + * FreeLoader + * Copyright (C) 1998-2002 Brian Palmer + * + * This 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. + * + * This 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. + * + * You 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. + */ + +#include +#include + +EXTERN _BootMain:PROC +EXTERN _InitIdt:PROC +EXTERN _i386Idt:DWORD +//EXTERN _i386idtptr:FWORD + +.code32 + +PUBLIC _RealEntryPoint +_RealEntryPoint: + + /* Setup segment selectors */ + mov ax, PMODE_DS + mov ds, ax + mov es, ax + mov fs, ax + mov gs, ax + mov ss, ax + + /* Setup protected mode stack */ + mov esp, dword ptr ds:[stack32] + + /* Load the IDT */ +#ifdef _USE_ML + lidt fword ptr ds:[i386idtptr] +#else + lidt i386idtptr +#endif + + /* Continue execution */ + jmp dword ptr ds:[ContinueAddress] + +ContinueAddress: + .long _FrldrStartup + + +_FrldrStartup: + + /* Store BootDrive and BootPartition */ + mov byte ptr ds:[_FrldrBootDrive], dl + xor eax, eax + mov al, dh + mov dword ptr ds:[_FrldrBootPartition], eax + + /* Patch long jump with real mode entry point */ + mov eax, dword ptr ds:[BSS_RealModeEntry] + mov dword ptr ds:[SwitchToReal16Address], eax + + /* Initialize the idt */ + call _InitIdt + + /* GO! */ + xor eax, eax + push eax + call _BootMain + + /* We should never get here */ +stop: + jmp stop + nop + nop + +Int386_regsin: + .long 0 +Int386_regsout: + .long 0 + +/* + * int Int386(int ivec, REGS* in, REGS* out); + */ +PUBLIC _Int386 +_Int386: + + /* Get the function parameters */ + mov eax, dword ptr [esp + 4] + mov dword ptr ds:[BSS_IntVector], eax + mov eax, dword ptr [esp + 8] + mov dword ptr [Int386_regsin], eax + mov eax, dword ptr [esp + 12] + mov dword ptr [Int386_regsout], eax + + /* Save all registers + segment registers */ + push ds + push es + push fs + push gs + pusha + + /* Copy input registers */ + mov esi, dword ptr [Int386_regsin] + mov edi, BSS_RegisterSet + mov ecx, 9 + rep movsd + + /* Set the function ID */ + mov bx, FNID_Int386 + + /* Set continue address and switch to real mode */ + mov dword ptr [ContinueAddress], offset Int386_return + jmp SwitchToReal + +Int386_return: + + /* Copy output registers */ + mov esi, BSS_RegisterSet + mov edi, dword ptr [Int386_regsout] + mov ecx, 9 + rep movsd + + popa + pop gs + pop fs + pop es + pop ds + ret + + +/* + * U16 PxeCallApi(U16 Segment, U16 Offset, U16 Service, VOID *Parameter); + * + * RETURNS: + */ +PUBLIC _PxeCallApi +_PxeCallApi: + push ebp + mov ebp, esp + + pusha + push es + + /* copy entry point */ + mov eax, [ebp + 8] + shl eax, 16 + mov ax, [ebp + 12] + mov dword ptr ds:[BSS_PxeEntryPoint], eax + + /* copy function */ + mov ax, [ebp + 16] + mov word ptr ds:[BSS_PxeFunction], ax + + /* convert pointer to data buffer to segment/offset */ + mov eax, [ebp + 20] + shr eax, 4 + and eax, HEX(0f000) + mov word ptr ds:[BSS_PxeBufferSegment], ax + mov eax, [ebp + 20] + and eax, HEX(0ffff) + mov word ptr ds:[BSS_PxeBufferOffset], ax + + /* Set the function ID and call realmode */ + mov bx, FNID_PxeCallApi + call i386CallRealMode + + pop es + popa + + mov esp, ebp + pop ebp + + mov ax, word ptr [BSS_PxeResult] + + ret + + +PUBLIC _SoftReboot +_SoftReboot: + /* Set the function ID */ + mov bx, FNID_SoftReboot + + /*Switch to real mode (We don't return) */ + jmp SwitchToReal + + +PUBLIC _ChainLoadBiosBootSectorCode +_ChainLoadBiosBootSectorCode: + /* Set the boot drive */ + mov dl, byte ptr [_FrldrBootDrive] + + /* Set the function ID */ + mov bx, FNID_ChainLoadBiosBootSectorCode + + /*Switch to real mode (We don't return) */ + jmp SwitchToReal + + +PUBLIC i386CallRealMode +i386CallRealMode: + /* Set continue address and switch to real mode */ + mov dword ptr [ContinueAddress], offset i386CallRealMode_return + jmp SwitchToReal +i386CallRealMode_return: + ret + + +/* Entrypoint for realmode function calls + * ContinueAddress must be set to the return point from realmode + * bx must be set to the ID of the realmode function to call. */ +SwitchToReal: + /* Set sane segments */ + mov ax, PMODE_DS + mov ds, ax + mov es, ax + mov fs, ax + mov gs, ax + mov ss, ax + + /* Save 32-bit stack pointer */ + mov dword ptr [stack32], esp + + /* jmp to 16-bit segment to set the limit correctly */ + .byte HEX(0ea) // jmp far RMODE_CS:switch_to_real16 +SwitchToReal16Address: + .long 0 // receives address of switch_to_real16 + .word RMODE_CS + nop + + + /* 16-bit stack pointer */ +stack16: + .word STACK16ADDR + + /* 32-bit stack pointer */ +stack32: + .long STACK32ADDR + + .align 4 /* force 4-byte alignment */ +gdt: + /* NULL Descriptor */ + .word HEX(0000) + .word HEX(0000) + .word HEX(0000) + .word HEX(0000) + + /* 32-bit flat CS */ + .word HEX(FFFF) + .word HEX(0000) + .word HEX(9A00) + .word HEX(00CF) + + /* 32-bit flat DS */ + .word HEX(FFFF) + .word HEX(0000) + .word HEX(9200) + .word HEX(00CF) + + /* 16-bit real mode CS */ + .word HEX(FFFF) + .word HEX(0000) + .word HEX(9E00) + .word HEX(0000) + + /* 16-bit real mode DS */ + .word HEX(FFFF) + .word HEX(0000) + .word HEX(9200) + .word HEX(0000) + +/* GDT table pointer */ +gdtptr: + .word HEX(27) /* Limit */ + .long gdt /* Base Address */ + +/* Real-mode IDT pointer */ +rmode_idtptr: + .word HEX(3ff) /* Limit */ + .long 0 /* Base Address */ + +PUBLIC i386idtptr +i386idtptr: + .word 255 /* Limit */ + .long _i386Idt /* Base Address */ + +PUBLIC _FrldrBootDrive +_FrldrBootDrive: + .byte 0 + +PUBLIC _FrldrBootPartition +_FrldrBootPartition: + .long 0 + +END diff --git a/boot/freeldr/freeldr/arch/i386/fathelp.S b/boot/freeldr/freeldr/arch/i386/fathelp.S index 7bd7fb33d95..4403aa55c6c 100644 --- a/boot/freeldr/freeldr/arch/i386/fathelp.S +++ b/boot/freeldr/freeldr/arch/i386/fathelp.S @@ -56,6 +56,7 @@ PUBLIC _mainCRTStartup // For Mingw32 builds where the linker looks for this sym _mainCRTStartup: PUBLIC start start: +#if 0 .byte HEX(e9) .byte HEX(fd) .byte HEX(01) @@ -134,7 +135,7 @@ LoadFile_Done: // Reads the entire FAT into memory at 7000:0000 ReadFatIntoMemory: - mov ax, [bp+HiddenSectors] + mov ax, [bp+HiddenSectors] mov dx, [bp+HiddenSectors+2] add ax, [bp+ReservedSectors] adc dx, 0 @@ -233,6 +234,7 @@ msgLoading: .asciz "Loading FreeLoader...\r\n" .org HEX(1fe) // Pad to 510 bytes .word HEX(0aa55) // BootSector signature +#endif .endcode16 diff --git a/boot/freeldr/freeldr/arch/i386/halstub.c b/boot/freeldr/freeldr/arch/i386/halstub.c index 02aca2b67de..32a4ae6bb3b 100644 --- a/boot/freeldr/freeldr/arch/i386/halstub.c +++ b/boot/freeldr/freeldr/arch/i386/halstub.c @@ -33,7 +33,7 @@ NTAPI xHalVectorToIDTEntry(IN ULONG Vector) { /* Return the vector */ - return Vector; + return (UCHAR)Vector; } VOID diff --git a/boot/freeldr/freeldr/arch/i386/hardware.c b/boot/freeldr/freeldr/arch/i386/hardware.c index 641bd8d4c94..87ba7808fa2 100644 --- a/boot/freeldr/freeldr/arch/i386/hardware.c +++ b/boot/freeldr/freeldr/arch/i386/hardware.c @@ -323,7 +323,7 @@ DetectPnpBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber) static PCM_PARTIAL_RESOURCE_LIST -GetHarddiskConfigurationData(ULONG DriveNumber, ULONG* pSize) +GetHarddiskConfigurationData(UCHAR DriveNumber, ULONG* pSize) { PCM_PARTIAL_RESOURCE_LIST PartialResourceList; PCM_DISK_GEOMETRY_DEVICE_DATA DiskGeometry; @@ -400,7 +400,7 @@ GetHarddiskConfigurationData(ULONG DriveNumber, ULONG* pSize) typedef struct tagDISKCONTEXT { - ULONG DriveNumber; + UCHAR DriveNumber; ULONG SectorSize; ULONGLONG SectorOffset; ULONGLONG SectorCount; @@ -421,7 +421,7 @@ static LONG DiskGetFileInformation(ULONG FileId, FILEINFORMATION* Information) RtlZeroMemory(Information, sizeof(FILEINFORMATION)); Information->EndingAddress.QuadPart = (Context->SectorOffset + Context->SectorCount) * Context->SectorSize; - Information->CurrentAddress.LowPart = (Context->SectorOffset + Context->SectorNumber) * Context->SectorSize; + Information->CurrentAddress.QuadPart = (Context->SectorOffset + Context->SectorNumber) * Context->SectorSize; return ESUCCESS; } @@ -429,7 +429,8 @@ static LONG DiskGetFileInformation(ULONG FileId, FILEINFORMATION* Information) static LONG DiskOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId) { DISKCONTEXT* Context; - ULONG DriveNumber, DrivePartition, SectorSize; + UCHAR DriveNumber; + ULONG DrivePartition, SectorSize; ULONGLONG SectorOffset = 0; ULONGLONG SectorCount = 0; PARTITION_TABLE_ENTRY PartitionTableEntry; @@ -527,7 +528,7 @@ static const DEVVTBL DiskVtbl = { static VOID GetHarddiskIdentifier(PCHAR Identifier, - ULONG DriveNumber) + UCHAR DriveNumber) { PMASTER_BOOT_RECORD Mbr; ULONG *Buffer; @@ -568,7 +569,7 @@ GetHarddiskIdentifier(PCHAR Identifier, reactos_arc_strings[reactos_disk_count]; reactos_disk_count++; - sprintf(ArcName, "multi(0)disk(0)rdisk(%lu)partition(0)", DriveNumber - 0x80); + sprintf(ArcName, "multi(0)disk(0)rdisk(%u)partition(0)", DriveNumber - 0x80); FsRegisterDevice(ArcName, &DiskVtbl); /* Add partitions */ @@ -578,7 +579,7 @@ GetHarddiskIdentifier(PCHAR Identifier, { if (PartitionTableEntry.SystemIndicator != PARTITION_ENTRY_UNUSED) { - sprintf(ArcName, "multi(0)disk(0)rdisk(%lu)partition(%lu)", DriveNumber - 0x80, i); + sprintf(ArcName, "multi(0)disk(0)rdisk(%u)partition(%lu)", DriveNumber - 0x80, i); FsRegisterDevice(ArcName, &DiskVtbl); } i++; @@ -609,7 +610,7 @@ GetHarddiskIdentifier(PCHAR Identifier, DPRINTM(DPRINT_HWDETECT, "Identifier: %s\n", Identifier); } -static ULONG +static UCHAR GetFloppyCount(VOID) { UCHAR Data; @@ -657,7 +658,7 @@ DetectBiosFloppyPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey) CHAR Identifier[20]; PCONFIGURATION_COMPONENT_DATA PeripheralKey; ULONG Size; - ULONG FloppyNumber; + UCHAR FloppyNumber; UCHAR FloppyType; ULONG MaxDensity[6] = {0, 360, 1200, 720, 1440, 2880}; PUCHAR Ptr; @@ -669,12 +670,13 @@ DetectBiosFloppyPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey) if ((FloppyType > 5) || (FloppyType == 0)) continue; - DiskResetController(FloppyNumber); + if (!DiskResetController(FloppyNumber)) + continue; Ptr = GetInt1eTable(); /* Set 'Identifier' value */ - sprintf(Identifier, "FLOPPY%ld", FloppyNumber + 1); + sprintf(Identifier, "FLOPPY%d", FloppyNumber + 1); Size = sizeof(CM_PARTIAL_RESOURCE_LIST) + sizeof(CM_FLOPPY_DEVICE_DATA); @@ -736,7 +738,7 @@ DetectBiosFloppyController(PCONFIGURATION_COMPONENT_DATA BusKey) DPRINTM(DPRINT_HWDETECT, "Floppy count: %u\n", FloppyCount); - + Size = sizeof(CM_PARTIAL_RESOURCE_LIST) + 2 * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR); PartialResourceList = MmHeapAlloc(Size); @@ -804,15 +806,14 @@ DetectSystem(VOID) PCM_PARTIAL_RESOURCE_LIST PartialResourceList; PCM_INT13_DRIVE_PARAMETER Int13Drives; GEOMETRY Geometry; - ULONG DiskCount; + UCHAR DiskCount, i; ULONG Size; - ULONG i; BOOLEAN Changed; - + /* Count the number of visible drives */ DiskReportError(FALSE); DiskCount = 0; - + /* There are some really broken BIOSes out there. There are even BIOSes * that happily report success when you ask them to read from non-existent * harddisks. So, we set the buffer to known contents first, then try to @@ -838,7 +839,7 @@ DetectSystem(VOID) DiskReportError(TRUE); DPRINTM(DPRINT_HWDETECT, "BIOS reports %d harddisk%s\n", (int)DiskCount, (DiskCount == 1) ? "": "s"); - + /* Allocate resource descriptor */ Size = sizeof(CM_PARTIAL_RESOURCE_LIST) + sizeof(CM_INT13_DRIVE_PARAMETER) * DiskCount; @@ -849,7 +850,7 @@ DetectSystem(VOID) "Failed to allocate resource descriptor\n"); return NULL; } - + /* Initialize resource descriptor */ memset(PartialResourceList, 0, Size); PartialResourceList->Version = 1; @@ -860,7 +861,7 @@ DetectSystem(VOID) PartialResourceList->PartialDescriptors[0].Flags = 0; PartialResourceList->PartialDescriptors[0].u.DeviceSpecificData.DataSize = sizeof(CM_INT13_DRIVE_PARAMETER) * DiskCount; - + /* Get harddisk Int13 geometry data */ Int13Drives = (PVOID)(((ULONG_PTR)PartialResourceList) + sizeof(CM_PARTIAL_RESOURCE_LIST)); for (i = 0; i < DiskCount; i++) @@ -869,10 +870,10 @@ DetectSystem(VOID) { Int13Drives[i].DriveSelect = 0x80 + i; Int13Drives[i].MaxCylinders = Geometry.Cylinders - 1; - Int13Drives[i].SectorsPerTrack = Geometry.Sectors; - Int13Drives[i].MaxHeads = Geometry.Heads - 1; + Int13Drives[i].SectorsPerTrack = (USHORT)Geometry.Sectors; + Int13Drives[i].MaxHeads = (USHORT)Geometry.Heads - 1; Int13Drives[i].NumberDrives = DiskCount; - + DPRINTM(DPRINT_HWDETECT, "Disk %x: %u Cylinders %u Heads %u Sectors %u Bytes\n", 0x80 + i, @@ -899,12 +900,12 @@ DetectSystem(VOID) return SystemKey; } -static ULONG +static UCHAR GetDiskCount(PCONFIGURATION_COMPONENT_DATA BusKey) { PCONFIGURATION_COMPONENT_DATA System; ULONG ConfigurationDataLength; - ULONG DiskCount = 0; + UCHAR DiskCount = 0; // // Get root component @@ -924,8 +925,8 @@ GetDiskCount(PCONFIGURATION_COMPONENT_DATA BusKey) // by n entries of CM_INT13_DRIVE_PARAMETER // if (ConfigurationDataLength > 0) - DiskCount = (ConfigurationDataLength - sizeof(CM_PARTIAL_RESOURCE_LIST)) - / sizeof(CM_INT13_DRIVE_PARAMETER); + DiskCount = (UCHAR)((ConfigurationDataLength - sizeof(CM_PARTIAL_RESOURCE_LIST)) + / sizeof(CM_INT13_DRIVE_PARAMETER)); // // Return number of disks @@ -940,7 +941,7 @@ DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA BusKey) PCONFIGURATION_COMPONENT_DATA DiskKey, ControllerKey; BOOLEAN BootDriveReported = FALSE; ULONG i; - ULONG DiskCount = GetDiskCount(BusKey); + UCHAR DiskCount = GetDiskCount(BusKey); CHAR BootPath[512]; FldrCreateComponentKey(BusKey, @@ -954,20 +955,21 @@ DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA BusKey) 0, &ControllerKey); DPRINTM(DPRINT_HWDETECT, "Created key: DiskController\\0\n"); - + /* Create and fill subkey for each harddisk */ for (i = 0; i < DiskCount; i++) { PCM_PARTIAL_RESOURCE_LIST PartialResourceList; ULONG Size; CHAR Identifier[20]; + UCHAR DriveNumber = 0x80 + (UCHAR)i; - if (BootDrive == 0x80 + i) + if (FrldrBootDrive == DriveNumber) BootDriveReported = TRUE; /* Get disk values */ - PartialResourceList = GetHarddiskConfigurationData(0x80 + i, &Size); - GetHarddiskIdentifier(Identifier, 0x80 + i); + PartialResourceList = GetHarddiskConfigurationData(DriveNumber, &Size); + GetHarddiskIdentifier(Identifier, DriveNumber); /* Create disk key */ FldrCreateComponentKey(ControllerKey, @@ -986,15 +988,15 @@ DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA BusKey) MachDiskGetBootPath(BootPath, sizeof(BootPath)); /* Add it, if it's a floppy or cdrom */ - if ((BootDrive >= 0x80 && !BootDriveReported) || - DiskIsDriveRemovable(BootDrive)) + if ((FrldrBootDrive >= 0x80 && !BootDriveReported) || + DiskIsDriveRemovable(FrldrBootDrive)) { /* TODO: Check if it's really a cdrom drive */ ULONG* Buffer; ULONG Checksum = 0; /* Read the MBR */ - if (!MachDiskReadLogicalSectors(BootDrive, 16ULL, 1, (PVOID)DISKREADBUFFER)) + if (!MachDiskReadLogicalSectors(FrldrBootDrive, 16ULL, 1, (PVOID)DISKREADBUFFER)) { DPRINTM(DPRINT_HWDETECT, "Reading MBR failed\n"); return; @@ -1020,7 +1022,7 @@ DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA BusKey) static VOID InitializeSerialPort(PUCHAR Port, - ULONG LineControl) + UCHAR LineControl) { WRITE_PORT_UCHAR(Port + 3, 0x80); /* set DLAB on */ WRITE_PORT_UCHAR(Port, 0x60); /* speed LO byte */ @@ -1746,9 +1748,9 @@ DetectKeyboardController(PCONFIGURATION_COMPONENT_DATA BusKey) Size, &ControllerKey); DPRINTM(DPRINT_HWDETECT, "Created key: KeyboardController\\0\n"); - + MmHeapFree(PartialResourceList); - + DetectKeyboardPeripheral(ControllerKey); } @@ -2049,14 +2051,14 @@ PcHwDetect(VOID) /* Create the 'System' key */ SystemKey = DetectSystem(); - + /* Detect buses */ DetectPciBios(SystemKey, &BusNumber); DetectApmBios(SystemKey, &BusNumber); DetectPnpBios(SystemKey, &BusNumber); DetectIsaBios(SystemKey, &BusNumber); DetectAcpiBios(SystemKey, &BusNumber); - + DPRINTM(DPRINT_HWDETECT, "DetectHardware() Done\n"); return SystemKey; diff --git a/boot/freeldr/freeldr/arch/i386/hwacpi.c b/boot/freeldr/freeldr/arch/i386/hwacpi.c index 9ca9f128387..4881f29995c 100644 --- a/boot/freeldr/freeldr/arch/i386/hwacpi.c +++ b/boot/freeldr/freeldr/arch/i386/hwacpi.c @@ -65,7 +65,6 @@ DetectAcpiBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber) { /* Set up the flag in the loader block */ AcpiPresent = TRUE; - LoaderBlock.Flags |= MB_FLAGS_ACPI_TABLE; /* Get BIOS memory map */ RtlZeroMemory(BiosMemoryMap, sizeof(BiosMemoryMap)); diff --git a/boot/freeldr/freeldr/arch/i386/i386cpu.S b/boot/freeldr/freeldr/arch/i386/i386cpu.S index 6dfb91dbf4a..e3ef67d73be 100644 --- a/boot/freeldr/freeldr/arch/i386/i386cpu.S +++ b/boot/freeldr/freeldr/arch/i386/i386cpu.S @@ -20,9 +20,7 @@ .text .code16 -#define ASM - -#include +#include /* * U32 CpuidSupported(VOID); diff --git a/boot/freeldr/freeldr/arch/i386/i386disk.c b/boot/freeldr/freeldr/arch/i386/i386disk.c index bcee4538a07..5656ffa88d5 100644 --- a/boot/freeldr/freeldr/arch/i386/i386disk.c +++ b/boot/freeldr/freeldr/arch/i386/i386disk.c @@ -26,7 +26,7 @@ // FUNCTIONS ///////////////////////////////////////////////////////////////////////////////////////////// -BOOLEAN DiskResetController(ULONG DriveNumber) +BOOLEAN DiskResetController(UCHAR DriveNumber) { REGS RegsIn; REGS RegsOut; @@ -49,9 +49,9 @@ BOOLEAN DiskResetController(ULONG DriveNumber) return INT386_SUCCESS(RegsOut); } -BOOLEAN DiskInt13ExtensionsSupported(ULONG DriveNumber) +BOOLEAN DiskInt13ExtensionsSupported(UCHAR DriveNumber) { - static ULONG LastDriveNumber = 0xffffffff; + static UCHAR LastDriveNumber = 0xff; static BOOLEAN LastSupported; REGS RegsIn; REGS RegsOut; @@ -141,7 +141,7 @@ VOID DiskStopFloppyMotor(VOID) WRITE_PORT_UCHAR((PUCHAR)0x3F2, 0); } -BOOLEAN DiskGetExtendedDriveParameters(ULONG DriveNumber, PVOID Buffer, USHORT BufferSize) +BOOLEAN DiskGetExtendedDriveParameters(UCHAR DriveNumber, PVOID Buffer, USHORT BufferSize) { REGS RegsIn; REGS RegsOut; diff --git a/boot/freeldr/freeldr/arch/i386/i386idt.S b/boot/freeldr/freeldr/arch/i386/i386idt.S index 8c7df9e44bb..8332cc52361 100644 --- a/boot/freeldr/freeldr/arch/i386/i386idt.S +++ b/boot/freeldr/freeldr/arch/i386/i386idt.S @@ -20,98 +20,97 @@ .text .code16 -#define ASM -#include +#include .p2align 2 /* force 4-byte alignment */ EXTERN(i386idt) /* Exception 0 - Divide By Zero */ - .word i386DivideByZero /* Offset 0 - 15 */ + .word _i386DivideByZero /* Offset 0 - 15 */ .word 0x0008 /* Selector */ .word 0x8e00 /* Flags, Zero Byte */ .word 0x0000 /* Offset 16 - 31 */ /* Exception 1 - Debug Exception */ - .word i386DebugException /* Offset 0 - 15 */ + .word _i386DebugException /* Offset 0 - 15 */ .word 0x0008 /* Selector */ .word 0x8e00 /* Zero byte, flags */ .word 0x0000 /* Offset 16 - 31 */ /* Exception 2 - NMI */ - .word i386NMIException /* Offset 0 - 15 */ + .word _i386NMIException /* Offset 0 - 15 */ .word 0x0008 /* Selector */ .word 0x8e00 /* Zero byte, flags */ .word 0x0000 /* Offset 16 - 31 */ /* Exception 3 - Breakpoint (INT 3) */ - .word i386Breakpoint /* Offset 0 - 15 */ + .word _i386Breakpoint /* Offset 0 - 15 */ .word 0x0008 /* Selector */ .word 0x8e00 /* Zero byte, flags */ .word 0x0000 /* Offset 16 - 31 */ /* Exception 4 - Overflow (INTO with EFLAGS[OF] set) */ - .word i386Overflow /* Offset 0 - 15 */ + .word _i386Overflow /* Offset 0 - 15 */ .word 0x0008 /* Selector */ .word 0x8e00 /* Zero byte, flags */ .word 0x0000 /* Offset 16 - 31 */ /* Exception 5 - Bound Exception */ - .word i386BoundException /* Offset 0 - 15 */ + .word _i386BoundException /* Offset 0 - 15 */ .word 0x0008 /* Selector */ .word 0x8e00 /* Zero byte, flags */ .word 0x0000 /* Offset 16 - 31 */ /* Exception 6 - Invalid Opcode */ - .word i386InvalidOpcode /* Offset 0 - 15 */ + .word _i386InvalidOpcode /* Offset 0 - 15 */ .word 0x0008 /* Selector */ .word 0x8e00 /* Zero byte, flags */ .word 0x0000 /* Offset 16 - 31 */ /* Exception 7 - FPU Not Available */ - .word i386FPUNotAvailable /* Offset 0 - 15 */ + .word _i386FPUNotAvailable /* Offset 0 - 15 */ .word 0x0008 /* Selector */ .word 0x8e00 /* Zero byte, flags */ .word 0x0000 /* Offset 16 - 31 */ /* Exception 8 - Double Fault */ - .word i386DoubleFault /* Offset 0 - 15 */ + .word _i386DoubleFault /* Offset 0 - 15 */ .word 0x0008 /* Selector */ .word 0x8e00 /* Zero byte, flags */ .word 0x0000 /* Offset 16 - 31 */ /* Exception 9 - Coprocessor Segment Overrun */ - .word i386CoprocessorSegment /* Offset 0 - 15 */ + .word _i386CoprocessorSegment /* Offset 0 - 15 */ .word 0x0008 /* Selector */ .word 0x8e00 /* Zero byte, flags */ .word 0x0000 /* Offset 16 - 31 */ /* Exception 10 (0x0A) - Invalid TSS */ - .word i386InvalidTSS /* Offset 0 - 15 */ + .word _i386InvalidTSS /* Offset 0 - 15 */ .word 0x0008 /* Selector */ .word 0x8e00 /* Zero byte, flags */ .word 0x0000 /* Offset 16 - 31 */ /* Exception 11 (0x0B) - Segment Not Present */ - .word i386SegmentNotPresent /* Offset 0 - 15 */ + .word _i386SegmentNotPresent /* Offset 0 - 15 */ .word 0x0008 /* Selector */ .word 0x8e00 /* Zero byte, flags */ .word 0x0000 /* Offset 16 - 31 */ /* Exception 12 (0x0C) - Stack Exception */ - .word i386StackException /* Offset 0 - 15 */ + .word _i386StackException /* Offset 0 - 15 */ .word 0x0008 /* Selector */ .word 0x8e00 /* Zero byte, flags */ .word 0x0000 /* Offset 16 - 31 */ /* Exception 13 (0x0D) - General Protection Fault */ - .word i386GeneralProtectionFault /* Offset 0 - 15 */ + .word _i386GeneralProtectionFault /* Offset 0 - 15 */ .word 0x0008 /* Selector */ .word 0x8e00 /* Zero byte, flags */ .word 0x0000 /* Offset 16 - 31 */ /* Exception 14 (0x0E) - Page Fault */ - .word i386PageFault /* Offset 0 - 15 */ + .word _i386PageFault /* Offset 0 - 15 */ .word 0x0008 /* Selector */ .word 0x8e00 /* Zero byte, flags */ .word 0x0000 /* Offset 16 - 31 */ @@ -123,19 +122,19 @@ EXTERN(i386idt) .word 0x0000 /* Offset 16 - 31 */ /* Exception 16 (0x10) - Coprocessor Error */ - .word i386CoprocessorError /* Offset 0 - 15 */ + .word _i386CoprocessorError /* Offset 0 - 15 */ .word 0x0008 /* Selector */ .word 0x8e00 /* Zero byte, flags */ .word 0x0000 /* Offset 16 - 31 */ /* Exception 17 (0x11) - Alignment Check */ - .word i386AlignmentCheck /* Offset 0 - 15 */ + .word _i386AlignmentCheck /* Offset 0 - 15 */ .word 0x0008 /* Selector */ .word 0x8e00 /* Zero byte, flags */ .word 0x0000 /* Offset 16 - 31 */ /* Exception 18 (0x12) - Machine Check */ - .word i386MachineCheck /* Offset 0 - 15 */ + .word _i386MachineCheck /* Offset 0 - 15 */ .word 0x0008 /* Selector */ .word 0x8e00 /* Zero byte, flags */ .word 0x0000 /* Offset 16 - 31 */ diff --git a/boot/freeldr/freeldr/arch/i386/i386idt.c b/boot/freeldr/freeldr/arch/i386/i386idt.c new file mode 100644 index 00000000000..a4dd2e8b221 --- /dev/null +++ b/boot/freeldr/freeldr/arch/i386/i386idt.c @@ -0,0 +1,42 @@ + +#include + + +KIDTENTRY DECLSPEC_ALIGN(4) i386Idt[32]; +KDESCRIPTOR i386IdtDescriptor = {0, 255, (ULONG)i386Idt}; + +static +void +InitIdtVector( + UCHAR Vector, + PVOID ServiceHandler, + USHORT Access) +{ + i386Idt[Vector].Offset = (ULONG)ServiceHandler & 0xffff; + i386Idt[Vector].ExtendedOffset = (ULONG)ServiceHandler >> 16; + i386Idt[Vector].Selector = PMODE_CS; + i386Idt[Vector].Access = Access; +} + +void +InitIdt(void) +{ + InitIdtVector(0, i386DivideByZero, 0x8e00); + InitIdtVector(1, i386DebugException, 0x8e00); + InitIdtVector(2, i386NMIException, 0x8e00); + InitIdtVector(3, i386Breakpoint, 0x8e00); + InitIdtVector(4, i386Overflow, 0x8e00); + InitIdtVector(5, i386BoundException, 0x8e00); + InitIdtVector(6, i386InvalidOpcode, 0x8e00); + InitIdtVector(7, i386FPUNotAvailable, 0x8e00); + InitIdtVector(8, i386DoubleFault, 0x8e00); + InitIdtVector(9, i386CoprocessorSegment, 0x8e00); + InitIdtVector(10, i386InvalidTSS, 0x8e00); + InitIdtVector(11, i386SegmentNotPresent, 0x8e00); + InitIdtVector(12, i386StackException, 0x8e00); + InitIdtVector(13, i386GeneralProtectionFault, 0x8e00); + InitIdtVector(14, i386PageFault, 0x8e00); + InitIdtVector(16, i386CoprocessorError, 0x8e00); + InitIdtVector(17, i386AlignmentCheck, 0x8e00); + InitIdtVector(18, i386MachineCheck, 0x8e00); +} diff --git a/boot/freeldr/freeldr/arch/i386/i386pnp.S b/boot/freeldr/freeldr/arch/i386/i386pnp.S index 9276c72b1c4..b66b51adbab 100644 --- a/boot/freeldr/freeldr/arch/i386/i386pnp.S +++ b/boot/freeldr/freeldr/arch/i386/i386pnp.S @@ -17,12 +17,10 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ - .text - .code16 +#include +#include -#define ASM - -#include +.code32 /* @@ -35,68 +33,68 @@ _pnp_bios_entry_point: _pnp_bios_data_segment: .word 0 -EXTERN(_PnpBiosSupported) - .code32 +PUBLIC _PnpBiosSupported +_PnpBiosSupported: - pushl %edi - pushl %esi - pushl %ecx - pushl %edx + push edi + push esi + push ecx + push edx - xorl %edi,%edi + xor edi, edi /* init esi */ - movl $0xF0000,%esi + mov esi, HEX(0F0000) pnp_again: - movl (%esi),%eax - cmp $0x506E5024,%eax /* "$PnP" */ - je pnp_found + mov eax, [esi] + cmp eax, HEX(506E5024) /* "$PnP" */ + je pnp_found - cmp $0xFFFF0,%esi - je pnp_not_found + cmp esi, HEX(0FFFF0) + je pnp_not_found pnp_add: - addl $0x10,%esi - jmp pnp_again + add esi, 16 + jmp pnp_again pnp_found: /* first calculate the checksum */ - pushl %esi + push esi - pushl $0x21 - popl %ecx - xorl %edx, %edx + push HEX(21) + pop ecx + xor edx, edx pnp_loop: lodsb - addb %al,%dl - loopl pnp_loop + add dl, al + loop pnp_loop - testb %dl, %dl - popl %esi - jnz pnp_add + test dl, dl + pop esi + jnz pnp_add - movl %esi,%edi + mov edi, esi /* Calculate the bios entry point (far pointer) */ - xorl %eax,%eax - movw 0x0F(%esi),%ax - shll $16,%eax - movw 0x0D(%esi),%ax - movl %eax,_pnp_bios_entry_point + xor eax, eax + mov ax, [esi + 15] + shl eax, 16 + mov ax, [esi + 0x0D] + mov _pnp_bios_entry_point, eax /* Store bios data segment */ - movw 0x1B(%esi),%ax - movw %ax,_pnp_bios_data_segment + mov ax, [esi + 0x1B] + mov _pnp_bios_data_segment, ax pnp_not_found: - movl %edi,%eax + mov eax, edi - popl %edx - popl %ecx - popl %esi - popl %edi + pop edx + pop ecx + pop esi + pop edi ret @@ -113,58 +111,58 @@ _pnp_node_size: _pnp_node_count: .word 0 -EXTERN(_PnpBiosGetDeviceNodeCount) - .code32 +PUBLIC _PnpBiosGetDeviceNodeCount +_PnpBiosGetDeviceNodeCount: - pushl %ebp - movl %esp,%ebp + push ebp + mov ebp, esp - pushal - push %es + pusha + push es - call switch_to_real + call switch_to_real .code16 - movw _pnp_bios_data_segment,%ax - pushw %ax + mov ax, word ptr [_pnp_bios_data_segment] + push ax - pushw %cs - movw $(_pnp_node_size),%ax - pushw %ax + push cs + mov ax, offset _pnp_node_size + push ax - pushw %cs - movw $(_pnp_node_count),%ax - pushw %ax + push cs + mov ax, offset _pnp_node_count + push ax - pushw $0 + push 0 - lcall *_pnp_bios_entry_point - addw $12,%sp + call dword ptr [_pnp_bios_entry_point] + add sp, 12 - movzwl %ax,%ecx - movl %ecx,_pnp_result + movzx ecx, ax + mov _pnp_result, ecx - - call switch_to_prot + + call switch_to_prot .code32 - movl 0x08(%ebp),%esi - movw _pnp_node_size,%ax - movzwl %ax,%ecx - movl %ecx, (%esi) + mov esi, [ebp + 8] + mov ax, _pnp_node_size + movzx ecx, ax + mov [esi], ecx - movl 0x0C(%ebp),%esi - movw _pnp_node_count,%ax - movzwl %ax,%ecx - movl %eax, (%esi) + mov esi, [ebp + 12] + mov ax, _pnp_node_count + movzx ecx, ax + mov [esi], eax - pop %es - popal + pop es + popa - movl %ebp,%esp - popl %ebp + mov esp, ebp + pop ebp - movl _pnp_result,%eax + mov eax, _pnp_result ret @@ -185,72 +183,72 @@ _pnp_node_number: EXTERN(_PnpBiosGetDeviceNode) .code32 - pushl %ebp - movl %esp,%ebp + push ebp + mov ebp, esp - pushal - push %es + pusha + push es /* get current node number */ - movl 0x08(%ebp),%esi - movb (%esi),%al - movb %al,_pnp_node_number + mov esi, [ebp + 8] + mov al, [esi] + mov _pnp_node_number, al - /* convert pointer to node buffer to segment/offset */ - movl 0x0C(%ebp),%eax - shrl $4,%eax - andl $0xf000,%eax - movw %ax,_pnp_buffer_segment - movl 0x0C(%ebp),%eax - andl $0xffff,%eax - movw %ax,_pnp_buffer_offset + /* convert pointer to node buffer to segment/offset */ + mov eax, [ebp + 12] + shr eax, 4 + and eax, 0xf000 + mov _pnp_buffer_segment, ax + mov eax, [ebp + 12] + and eax, 0xffff + mov _pnp_buffer_offset, ax - call switch_to_real + call switch_to_real .code16 /* push bios segment */ - movw _pnp_bios_data_segment,%ax - pushw %ax + mov ax, word ptr [_pnp_bios_data_segment] + push ax - /* push control flag */ - pushw $0x0001 + /* push control flag */ + push 1 /* push pointer to node buffer (segment/offset) */ - movw _pnp_buffer_segment,%ax - pushw %ax - movw _pnp_buffer_offset,%ax - pushw %ax + mov ax, word ptr [_pnp_buffer_segment] + push ax + mov ax, word ptr [_pnp_buffer_offset] + push ax /* push pointer to node number (segment/offset) */ - pushw %cs - movw $(_pnp_node_number),%ax - pushw %ax + push cs + mov ax, offset _pnp_node_number + push ax /* push function number */ - pushw $1 + push 1 /* call entry point */ - lcall *_pnp_bios_entry_point - addw $14,%sp + call dword ptr [_pnp_bios_entry_point] + add sp, 14 - movzwl %ax,%ecx - movl %ecx,_pnp_result + movzx ecx, ax + mov _pnp_result, ecx - call switch_to_prot + call switch_to_prot .code32 /* update node number */ - movl 0x08(%ebp),%esi - movb _pnp_node_number,%al - movb %al,(%esi) + mov esi, [ebp + 8] + mov al, _pnp_node_number + mov [esi], al - pop %es - popal + pop es + popa - movl %ebp,%esp - popl %ebp + mov esp, ebp + pop ebp - movl _pnp_result,%eax + mov eax, _pnp_result ret diff --git a/boot/freeldr/freeldr/arch/i386/i386pnp.cmake.S b/boot/freeldr/freeldr/arch/i386/i386pnp.cmake.S new file mode 100644 index 00000000000..1721d3ef0a5 --- /dev/null +++ b/boot/freeldr/freeldr/arch/i386/i386pnp.cmake.S @@ -0,0 +1,184 @@ +/* + * FreeLoader + * Copyright (C) 2003 Eric Kohl + * + * This 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. + * + * This 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. + * + * You 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. + */ + +#include +#include + +EXTERN i386CallRealMode:PROC + +.code32 + +/* + * U32 PnpBiosSupported(VOID); + * + * RETURNS: + */ +PUBLIC _PnpBiosSupported +_PnpBiosSupported: + + push edi + push esi + push ecx + push edx + + xor edi, edi + + /* init esi */ + mov esi, HEX(0F0000) + +pnp_again: + mov eax, [esi] + cmp eax, HEX(506E5024) /* "$PnP" */ + je pnp_found + + cmp esi, HEX(0FFFF0) + je pnp_not_found + +pnp_add: + add esi, 16 + jmp pnp_again + +pnp_found: + /* first calculate the checksum */ + push esi + + push HEX(21) + pop ecx + xor edx, edx + +pnp_loop: + lodsb + add dl, al + loop pnp_loop + + test dl, dl + pop esi + jnz pnp_add + + mov edi, esi + + /* Calculate the bios entry point (far pointer) */ + xor eax, eax + mov ax, [esi + HEX(0F)] + shl eax, 16 + mov ax, [esi + HEX(0D)] + mov dword ptr ds:[BSS_PnpBiosEntryPoint], eax + + /* Store bios data segment */ + mov ax, [esi + HEX(1B)] + mov word ptr ds:[BSS_PnpBiosDataSegment], ax + +pnp_not_found: + mov eax, edi + + pop edx + pop ecx + pop esi + pop edi + + ret + + +/* + * U32 PnpBiosGetDeviceNodeCount(U32 *NodeSize, U32 *NodeCount); + * + * RETURNS: + */ +PUBLIC _PnpBiosGetDeviceNodeCount +_PnpBiosGetDeviceNodeCount: + + push ebp + mov ebp, esp + + pusha + push es + + mov bx, FNID_PnpBiosGetDeviceNodeCount + call i386CallRealMode + + mov esi, [ebp + 8] + mov ax, [BSS_PnpNodeSize] + movzx ecx, ax + mov [esi], ecx + + mov esi, [ebp + 12] + mov ax, [BSS_PnpNodeCount] + movzx ecx, ax + mov [esi], eax + + pop es + popa + + mov esp, ebp + pop ebp + + mov eax, dword ptr [BSS_PnpResult] + + ret + + +/* + * U32 PnpBiosGetDeviceNode(U8 *NodeId, U8 *NodeBuffer); + * + * RETURNS: + */ +PUBLIC _PnpBiosGetDeviceNode +_PnpBiosGetDeviceNode: + .code32 + + push ebp + mov ebp, esp + + pusha + push es + + /* get current node number */ + mov esi, [ebp + 8] + mov al, [esi] + mov byte ptr ds:[BSS_PnpNodeNumber], al + + /* convert pointer to node buffer to segment/offset */ + mov eax, [ebp + 12] + shr eax, 4 + and eax, HEX(0f000) + mov word ptr ds:[BSS_PnpBiosBufferSegment], ax + mov eax, [ebp + 12] + and eax, HEX(0ffff) + mov word ptr ds:[BSS_PnpBiosBufferOffset], ax + + mov bx, FNID_PnpBiosGetDeviceNode + call i386CallRealMode + + /* update node number */ + mov esi, [ebp + 8] + mov al, byte ptr ds:[BSS_PnpNodeNumber] + mov [esi], al + + pop es + popa + + mov esp, ebp + pop ebp + + mov eax, [BSS_PnpResult] + + ret + +END +/* EOF */ diff --git a/boot/freeldr/freeldr/arch/i386/i386pxe.S b/boot/freeldr/freeldr/arch/i386/i386pxe.S index 71442135f36..72f03a3bcca 100644 --- a/boot/freeldr/freeldr/arch/i386/i386pxe.S +++ b/boot/freeldr/freeldr/arch/i386/i386pxe.S @@ -20,9 +20,8 @@ .text .code16 -#define ASM +#include -#include /* * U16 PxeCallApi(U16 Segment, U16 Offset, U16 Service, VOID *Parameter); diff --git a/boot/freeldr/freeldr/arch/i386/i386trap.S b/boot/freeldr/freeldr/arch/i386/i386trap.S index be5c7de3ce9..c579cb96c28 100644 --- a/boot/freeldr/freeldr/arch/i386/i386trap.S +++ b/boot/freeldr/freeldr/arch/i386/i386trap.S @@ -17,17 +17,17 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -.intel_syntax noprefix - .text - .code16 - -#define ASM -#include +#include +#include #include #define SCREEN_ATTR 0x1f /* Bright white on blue background */ -.macro SAVE_CPU_REGS +EXTERN _i386PrintExceptionText@12:PROC + +.code32 + +MACRO(SAVE_CPU_REGS) /* push the rest of the KTRAP_FRAME */ push ebp push ebx @@ -61,8 +61,8 @@ sub esp, 44 sgdt [esp] sidt [esp + 8] - str [esp + 16] - sldt [esp + 18] + str word ptr [esp + 16] + sldt word ptr [esp + 18] mov eax, dr7; push eax mov eax, dr6; @@ -83,16 +83,14 @@ push eax mov eax, cr0; push eax -.endm +ENDM /* Set by each exception handler to the address of the description text */ i386ExceptionIndex: .long 0 - /************************************************************************/ i386CommonExceptionHandler: - .code32 SAVE_CPU_REGS @@ -109,69 +107,86 @@ i386ExceptionHandlerHang: iret -.macro TRAP_STUB function, index - EXTERN(\function) +MACRO(TRAP_STUB, function, index) + PUBLIC VAL(function) +#ifdef _USE_ML + function: +#else + \function: +#endif push 0 // Fake error code - mov dword ptr i386ExceptionIndex, \index + mov dword ptr i386ExceptionIndex, VAL(index) jmp i386CommonExceptionHandler -.endm +ENDM -.macro TRAP_STUB2 function, index - EXTERN(\function) - mov dword ptr i386ExceptionIndex, \index +MACRO(TRAP_STUB2, function, index) + PUBLIC VAL(function) +#ifdef _USE_ML + function: +#else + \function: +#endif + mov dword ptr i386ExceptionIndex, VAL(index) jmp i386CommonExceptionHandler -.endm +ENDM /************************************************************************/ -TRAP_STUB i386DivideByZero, 0 -TRAP_STUB i386DebugException, 1 -TRAP_STUB i386NMIException, 2 -TRAP_STUB i386Breakpoint, 3 -TRAP_STUB i386Overflow, 4 -TRAP_STUB i386BoundException, 5 -TRAP_STUB i386InvalidOpcode, 6 -TRAP_STUB i386FPUNotAvailable, 7 -TRAP_STUB2 i386DoubleFault, 8 -TRAP_STUB i386CoprocessorSegment, 9 -TRAP_STUB2 i386InvalidTSS, 10 -TRAP_STUB2 i386SegmentNotPresent, 11 -TRAP_STUB2 i386StackException, 12 -TRAP_STUB2 i386GeneralProtectionFault, 13 -TRAP_STUB2 i386PageFault, 14 +TRAP_STUB _i386DivideByZero, 0 + +TRAP_STUB _i386DebugException, 1 +TRAP_STUB _i386NMIException, 2 +TRAP_STUB _i386Breakpoint, 3 +TRAP_STUB _i386Overflow, 4 +TRAP_STUB _i386BoundException, 5 +TRAP_STUB _i386InvalidOpcode, 6 +TRAP_STUB _i386FPUNotAvailable, 7 +TRAP_STUB2 _i386DoubleFault, 8 +TRAP_STUB _i386CoprocessorSegment, 9 +TRAP_STUB2 _i386InvalidTSS, 10 +TRAP_STUB2 _i386SegmentNotPresent, 11 +TRAP_STUB2 _i386StackException, 12 +TRAP_STUB2 _i386GeneralProtectionFault, 13 +TRAP_STUB2 _i386PageFault, 14 // 15 is reserved -TRAP_STUB i386CoprocessorError, 16 -TRAP_STUB i386AlignmentCheck, 17 -TRAP_STUB i386MachineCheck, 18 -TRAP_STUB i386SimdFloatError, 19 +TRAP_STUB _i386CoprocessorError, 16 +TRAP_STUB _i386AlignmentCheck, 17 +TRAP_STUB _i386MachineCheck, 18 +TRAP_STUB _i386SimdFloatError, 19 /************************************************************************ * DEBUGGING SUPPORT FUNCTIONS ************************************************************************/ -.macro BREAKPOINT_TEPLATE functionname, mask1, mask2 - EXTERN(\functionname) +MACRO(BREAKPOINT_TEPLATE, functionname, mask1, mask2) + PUBLIC VAL(functionname) +#ifdef _USE_ML + functionname: +#else + \functionname: +#endif push eax mov eax, [esp + 8] mov dr3, eax mov eax, dr7 - and eax, \mask1 - or eax, \mask2 + and eax, VAL(mask1) + or eax, VAL(mask2) mov dr7, eax pop eax ret -.endm +ENDM -BREAKPOINT_TEPLATE _INSTRUCTION_BREAKPOINT1, 0xfff0ffff, 0x00000303 -BREAKPOINT_TEPLATE _MEMORY_READWRITE_BREAKPOINT1, 0xfff0ffff, 0x00030303 -BREAKPOINT_TEPLATE _MEMORY_WRITE_BREAKPOINT1, 0xfff0ffff, 0x00010303 -BREAKPOINT_TEPLATE _INSTRUCTION_BREAKPOINT2, 0xff0fffff, 0x0000030c -BREAKPOINT_TEPLATE _MEMORY_READWRITE_BREAKPOINT2, 0xff0fffff, 0x0030030c -BREAKPOINT_TEPLATE _MEMORY_WRITE_BREAKPOINT2, 0xff0fffff, 0x0010030c -BREAKPOINT_TEPLATE _INSTRUCTION_BREAKPOINT3, 0xf0ffffff, 0x00000330 -BREAKPOINT_TEPLATE _MEMORY_READWRITE_BREAKPOINT3, 0xf0ffffff, 0x03000330 -BREAKPOINT_TEPLATE _MEMORY_WRITE_BREAKPOINT3, 0xf0ffffff, 0x01000330 -BREAKPOINT_TEPLATE _INSTRUCTION_BREAKPOINT4, 0x0fffffff, 0x000003c0 -BREAKPOINT_TEPLATE _MEMORY_READWRITE_BREAKPOINT4, 0x0fffffff, 0x300003c0 -BREAKPOINT_TEPLATE _MEMORY_WRITE_BREAKPOINT4, 0x0fffffff, 0x100003c0 +BREAKPOINT_TEPLATE _INSTRUCTION_BREAKPOINT1, HEX(0fff0ffff), HEX(000000303) +BREAKPOINT_TEPLATE _MEMORY_READWRITE_BREAKPOINT1, HEX(0fff0ffff), HEX(000030303) +BREAKPOINT_TEPLATE _MEMORY_WRITE_BREAKPOINT1, HEX(0fff0ffff), HEX(000010303) +BREAKPOINT_TEPLATE _INSTRUCTION_BREAKPOINT2, HEX(0ff0fffff), HEX(00000030c) +BREAKPOINT_TEPLATE _MEMORY_READWRITE_BREAKPOINT2, HEX(0ff0fffff), HEX(00030030c) +BREAKPOINT_TEPLATE _MEMORY_WRITE_BREAKPOINT2, HEX(0ff0fffff), HEX(00010030c) +BREAKPOINT_TEPLATE _INSTRUCTION_BREAKPOINT3, HEX(0f0ffffff), HEX(000000330) +BREAKPOINT_TEPLATE _MEMORY_READWRITE_BREAKPOINT3, HEX(0f0ffffff), HEX(003000330) +BREAKPOINT_TEPLATE _MEMORY_WRITE_BREAKPOINT3, HEX(0f0ffffff), HEX(001000330) +BREAKPOINT_TEPLATE _INSTRUCTION_BREAKPOINT4, HEX(00fffffff), HEX(0000003c0) +BREAKPOINT_TEPLATE _MEMORY_READWRITE_BREAKPOINT4, HEX(00fffffff), HEX(0300003c0) +BREAKPOINT_TEPLATE _MEMORY_WRITE_BREAKPOINT4, HEX(00fffffff), HEX(0100003c0) +END diff --git a/boot/freeldr/freeldr/arch/i386/int386.S b/boot/freeldr/freeldr/arch/i386/int386.S index 14086bf391f..1d614675fc9 100644 --- a/boot/freeldr/freeldr/arch/i386/int386.S +++ b/boot/freeldr/freeldr/arch/i386/int386.S @@ -20,8 +20,7 @@ .text .code16 -#define ASM -#include +#include /* Only these flags are propagated into Int386() */ #define FLAGS_PROP (I386FLAG_CF | \ @@ -172,9 +171,9 @@ Int386_vector_opcode: movsb /* Restore segment and all other registers */ - - - popal + + + popal popw %gs popw %fs popw %es diff --git a/boot/freeldr/freeldr/arch/i386/linux.S b/boot/freeldr/freeldr/arch/i386/linux.S index 2d288268324..51e6fb7344b 100644 --- a/boot/freeldr/freeldr/arch/i386/linux.S +++ b/boot/freeldr/freeldr/arch/i386/linux.S @@ -20,9 +20,7 @@ .text .code16 -#define ASM -#include - +#include .code32 EXTERN(_BootNewLinuxKernel) @@ -30,7 +28,7 @@ EXTERN(_BootNewLinuxKernel) .code16 /* Set the boot drive */ - movb (_BootDrive),%dl + movb (_FrldrBootDrive),%dl /* Load segment registers */ cli @@ -66,7 +64,7 @@ EXTERN(_BootOldLinuxKernel) .code16 /* Set the boot drive */ - movb (_BootDrive),%dl + movb (_FrldrBootDrive),%dl /* Load segment registers */ cli diff --git a/boot/freeldr/freeldr/arch/i386/linux.cmake.S b/boot/freeldr/freeldr/arch/i386/linux.cmake.S new file mode 100644 index 00000000000..e605aea301b --- /dev/null +++ b/boot/freeldr/freeldr/arch/i386/linux.cmake.S @@ -0,0 +1,55 @@ +/* + * FreeLoader + * Copyright (C) 1998-2002 Brian Palmer + * + * This 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. + * + * This 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. + * + * You 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. + */ + +#include +#include + +EXTERN i386CallRealMode:PROC + +.code32 + +/* + * VOID BootOldLinuxKernel(ULONG KernelSize); + */ +PUBLIC _BootOldLinuxKernel +_BootOldLinuxKernel: + + /* First we have to copy the kernel down from 0x100000 to 0x10000 */ + /* The reason we can overwrite low memory is because this code */ + /* executes between 0000:8000 and 0000:FFFF. That leaves space for */ + /* 32k of code before we start interfering with Linux kernel address space. */ + + /* Get KernelSize in ECX and move the kernel down */ + mov ecx, [esp + 4] + mov esi, HEX(100000) + mov edi, HEX(10000) + rep movsb + + /* Fall through */ + +PUBLIC _BootNewLinuxKernel +_BootNewLinuxKernel: + + mov bx, FNID_BootLinuxKernel + call i386CallRealMode + + /* We should never get here */ + int 3 + +END diff --git a/boot/freeldr/freeldr/arch/i386/loader.c b/boot/freeldr/freeldr/arch/i386/loader.c deleted file mode 100644 index c9ae5c454e1..00000000000 --- a/boot/freeldr/freeldr/arch/i386/loader.c +++ /dev/null @@ -1,200 +0,0 @@ -/* - * FreeLoader - * Copyright (C) 1998-2003 Brian Palmer - * Copyright (C) 2005 Alex Ionescu - * - * This 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. - * - * This 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. - * - * You 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. - */ -#include - -#define NDEBUG -#include - -/* Page Directory and Tables for non-PAE Systems */ -extern PAGE_DIRECTORY_X86 startup_pagedirectory; -extern PAGE_DIRECTORY_X86 lowmem_pagetable; -extern PAGE_DIRECTORY_X86 kernel_pagetable; -extern PAGE_DIRECTORY_X86 apic_pagetable; -extern ULONG_PTR KernelBase; -extern ROS_KERNEL_ENTRY_POINT KernelEntryPoint; - -/* FUNCTIONS *****************************************************************/ - -/*++ - * FrLdrStartup - * INTERNAL - * - * Prepares the system for loading the Kernel. - * - * Params: - * Magic - Multiboot Magic - * - * Returns: - * None. - * - * Remarks: - * None. - * - *--*/ -VOID -NTAPI -FrLdrStartup(ULONG Magic) -{ - /* Disable Interrupts */ - _disable(); - - /* Re-initalize EFLAGS */ - __writeeflags(0); - - /* Initialize the page directory */ - FrLdrSetupPageDirectory(); - - /* Initialize Paging, Write-Protection and Load NTOSKRNL */ - FrLdrSetupPae(Magic); -} - -/*++ - * FrLdrSetupPae - * INTERNAL - * - * Configures PAE on a MP System, and sets the PDBR if it's supported, or if - * the system is UP. - * - * Params: - * Magic - Multiboot Magic - * - * Returns: - * None. - * - * Remarks: - * None. - * - *--*/ -VOID -FASTCALL -FrLdrSetupPae(ULONG Magic) -{ - ULONG_PTR PageDirectoryBaseAddress = (ULONG_PTR)&startup_pagedirectory; - - /* Set the PDBR */ - __writecr3(PageDirectoryBaseAddress); - - /* Enable Paging and Write Protect*/ - __writecr0(__readcr0() | CR0_PG | CR0_WP); - - /* Jump to Kernel */ - (*KernelEntryPoint)(&LoaderBlock); -} - -/*++ - * FrLdrSetupPageDirectory - * INTERNAL - * - * Sets up the ReactOS Startup Page Directory. - * - * Params: - * None. - * - * Returns: - * None. - * - * Remarks: - * We are setting PDEs, but using the equvivalent (for our purpose) PTE structure. - * As such, please note that PageFrameNumber == PageEntryNumber. - * - *--*/ -VOID -FASTCALL -FrLdrSetupPageDirectory(VOID) -{ - PPAGE_DIRECTORY_X86 PageDir; - ULONG KernelPageTableIndex; - ULONG i; - - /* Get the Kernel Table Index */ - KernelPageTableIndex = KernelBase >> PDE_SHIFT; - - /* Get the Startup Page Directory */ - PageDir = (PPAGE_DIRECTORY_X86)&startup_pagedirectory; - - /* Set up the Low Memory PDE */ - PageDir->Pde[LowMemPageTableIndex].Valid = 1; - PageDir->Pde[LowMemPageTableIndex].Write = 1; - PageDir->Pde[LowMemPageTableIndex].PageFrameNumber = PaPtrToPfn(lowmem_pagetable); - - /* Set up the Kernel PDEs */ - PageDir->Pde[KernelPageTableIndex].Valid = 1; - PageDir->Pde[KernelPageTableIndex].Write = 1; - PageDir->Pde[KernelPageTableIndex].PageFrameNumber = PaPtrToPfn(kernel_pagetable); - PageDir->Pde[KernelPageTableIndex + 1].Valid = 1; - PageDir->Pde[KernelPageTableIndex + 1].Write = 1; - PageDir->Pde[KernelPageTableIndex + 1].PageFrameNumber = PaPtrToPfn(kernel_pagetable + 4096); - - /* Set up the Startup PDE */ - PageDir->Pde[StartupPageTableIndex].Valid = 1; - PageDir->Pde[StartupPageTableIndex].Write = 1; - PageDir->Pde[StartupPageTableIndex].PageFrameNumber = PaPtrToPfn(startup_pagedirectory); - - /* Set up the HAL PDE */ - PageDir->Pde[HalPageTableIndex].Valid = 1; - PageDir->Pde[HalPageTableIndex].Write = 1; - PageDir->Pde[HalPageTableIndex].PageFrameNumber = PaPtrToPfn(apic_pagetable); - - /* Set up Low Memory PTEs */ - PageDir = (PPAGE_DIRECTORY_X86)&lowmem_pagetable; - for (i=0; i<1024; i++) - { - PageDir->Pde[i].Valid = 1; - PageDir->Pde[i].Write = 1; - PageDir->Pde[i].Owner = 1; - PageDir->Pde[i].PageFrameNumber = PaToPfn(i * PAGE_SIZE); - } - - /* Set up Kernel PTEs */ - PageDir = (PPAGE_DIRECTORY_X86)&kernel_pagetable; - for (i=0; i<1536; i++) - { - PageDir->Pde[i].Valid = 1; - PageDir->Pde[i].Write = 1; - PageDir->Pde[i].PageFrameNumber = PaToPfn(KERNEL_BASE_PHYS + i * PAGE_SIZE); - } - - /* Setup APIC Base */ - PageDir = (PPAGE_DIRECTORY_X86)&apic_pagetable; - PageDir->Pde[0].Valid = 1; - PageDir->Pde[0].Write = 1; - PageDir->Pde[0].CacheDisable = 1; - PageDir->Pde[0].WriteThrough = 1; - PageDir->Pde[0].PageFrameNumber = PaToPfn(HAL_BASE); - PageDir->Pde[0x200].Valid = 1; - PageDir->Pde[0x200].Write = 1; - PageDir->Pde[0x200].CacheDisable = 1; - PageDir->Pde[0x200].WriteThrough = 1; - PageDir->Pde[0x200].PageFrameNumber = PaToPfn(HAL_BASE + KERNEL_BASE_PHYS); - - /* Setup KUSER_SHARED_DATA Base */ - PageDir->Pde[0x1F0].Valid = 1; - PageDir->Pde[0x1F0].Write = 1; - PageDir->Pde[0x1F0].PageFrameNumber = 2; - - /* Setup KPCR Base*/ - PageDir->Pde[0x1FF].Valid = 1; - PageDir->Pde[0x1FF].Write = 1; - PageDir->Pde[0x1FF].PageFrameNumber = 1; - - /* Zero shared data */ - RtlZeroMemory((PVOID)(2 << MM_PAGE_SHIFT), PAGE_SIZE); -} - diff --git a/boot/freeldr/freeldr/arch/i386/machpc.c b/boot/freeldr/freeldr/arch/i386/machpc.c index c585c97932d..42d92321473 100644 --- a/boot/freeldr/freeldr/arch/i386/machpc.c +++ b/boot/freeldr/freeldr/arch/i386/machpc.c @@ -22,8 +22,6 @@ VOID PcMachInit(const char *CmdLine) { - EnableA20(); - /* Setup vtbl */ MachVtbl.ConsPutChar = PcConsPutChar; MachVtbl.ConsKbHit = PcConsKbHit; diff --git a/boot/freeldr/freeldr/arch/i386/mb.S b/boot/freeldr/freeldr/arch/i386/mb.S index 3b36d179053..592e066b58f 100644 --- a/boot/freeldr/freeldr/arch/i386/mb.S +++ b/boot/freeldr/freeldr/arch/i386/mb.S @@ -17,40 +17,22 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ - .text - .code16 - -#define ASM -#include +#include +#include #include - /* - * Here we assume the kernel is loaded at 1mb - * This boots the kernel - */ - .code32 - .globl _PageDirectoryStart - - .globl _startup_pagedirectory - .globl _lowmem_pagetable - .globl _kernel_pagetable - .globl _apic_pagetable +.code32 +PUBLIC _PageDirectoryStart - .globl _PageDirectoryEnd - - // - // Boot information structure - // - -EXTERN(_reactos_memory_map_descriptor_size) - .long 0 - -EXTERN(_reactos_memory_map) - .rept (32 * /*sizeof(memory_map_t)*/24) - .byte 0 - .endr +PUBLIC _startup_pagedirectory +PUBLIC _lowmem_pagetable +PUBLIC _kernel_pagetable +PUBLIC _apic_pagetable +PUBLIC _PageDirectoryEnd +#ifndef _USE_ML .bss +#endif _PageDirectoryStart: _startup_pagedirectory: .fill 4096, 1, 0 @@ -65,3 +47,5 @@ _apic_pagetable: .fill 4096, 1, 0 _PageDirectoryEnd: + +END diff --git a/boot/freeldr/freeldr/arch/i386/miscboot.c b/boot/freeldr/freeldr/arch/i386/miscboot.c index 1f30141ce7f..691c297f366 100644 --- a/boot/freeldr/freeldr/arch/i386/miscboot.c +++ b/boot/freeldr/freeldr/arch/i386/miscboot.c @@ -85,7 +85,7 @@ VOID LoadAndBootPartition(PCSTR OperatingSystemName) CHAR SettingValue[80]; ULONG SectionId; PARTITION_TABLE_ENTRY PartitionTableEntry; - ULONG DriveNumber; + UCHAR DriveNumber; ULONG PartitionNumber; // Find all the message box settings and run them @@ -156,7 +156,7 @@ VOID LoadAndBootDrive(PCSTR OperatingSystemName) CHAR SettingName[80]; CHAR SettingValue[80]; ULONG SectionId; - ULONG DriveNumber; + UCHAR DriveNumber; // Find all the message box settings and run them UiShowMessageBoxesInSection(OperatingSystemName); diff --git a/boot/freeldr/freeldr/arch/i386/multiboot.S b/boot/freeldr/freeldr/arch/i386/multiboot.S new file mode 100644 index 00000000000..5c1e7241dd1 --- /dev/null +++ b/boot/freeldr/freeldr/arch/i386/multiboot.S @@ -0,0 +1,215 @@ +/* + * FreeLoader + * Copyright (C) 1998-2002 Brian Palmer + * + * This 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. + * + * This 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. + * + * You 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. + */ + +#include +#include +#include + + +/* Multiboot support + * + * Allows freeldr to be loaded as a "multiboot kernel" by + * other boot loaders like Grub + * This code is not referenced from anywhere. GRUB searches for + * the header signature and uses the header to load it. + */ + +#define MB_INFO_SIZE 90 +#define MB_INFO_FLAGS_OFFSET 0 +#define MB_INFO_BOOT_DEVICE_OFFSET 12 +#define MB_INFO_COMMAND_LINE_OFFSET 16 +#define CMDLINE_SIZE 256 + +/* + * We want to execute at 0x8000 (to be compatible with bootsector + * loading), but Grub only allows loading of multiboot kernels + * above 1MB. So we let Grub load us there and then relocate + * ourself to 0x8000 + */ +#define INITIAL_BASE HEX(200000) + + /* Align 32 bits boundary */ +.align 4 + + /* Multiboot header */ +MultibootHeader: + /* magic */ + .long MULTIBOOT_HEADER_MAGIC + /* flags */ + .long MULTIBOOT_HEADER_FLAGS + /* checksum */ + .long -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS) + /* header_addr */ + .long INITIAL_BASE + MultibootHeader - FREELDR_BASE + /* load_addr */ + .long INITIAL_BASE + /* load_end_addr */ + .long INITIAL_BASE + __bss_start__ - FREELDR_BASE + /* bss_end_addr */ + .long INITIAL_BASE + __bss_end__ - FREELDR_BASE + /* entry_addr */ + .long INITIAL_BASE + MultibootEntry - FREELDR_BASE + +MultibootEntry: + cli /* Even after setting up the our IDT below we are + * not ready to handle hardware interrupts (no entries + * in IDT), so there's no sti here. Interrupts will be + * enabled in due time */ + + /* Although the multiboot spec says we should be called with the + * segment registers set to 4GB flat mode, let's be sure and set up + * our own */ + lgdt gdtptrhigh + INITIAL_BASE - FREELDR_BASE + /* Reload segment selectors */ + //ljmp $PMODE_CS, $(mb1 + INITIAL_BASE - FREELDR_BASE) + jmp far ptr PMODE_CS: (mb1 + INITIAL_BASE - FREELDR_BASE) +mb1: + mov dx, PMODE_DS + mov ds, dx + mov es, dx + + /* Check for valid multiboot signature */ + cmp eax, MULTIBOOT_BOOTLOADER_MAGIC + jne mbfail + + /* Store multiboot info in a safe place */ + mov esi, ebx + mov edi, offset mb_info + INITIAL_BASE - FREELDR_BASE + mov ecx, MB_INFO_SIZE + rep movsb + + /* Save commandline */ + mov edx, [ebx + MB_INFO_FLAGS_OFFSET] + test dword ptr [ebx + MB_INFO_FLAGS_OFFSET], MB_INFO_FLAG_COMMAND_LINE + jz mb3 + mov esi, [ebx + MB_INFO_COMMAND_LINE_OFFSET] + mov edi, offset cmdline + INITIAL_BASE - FREELDR_BASE + mov ecx, CMDLINE_SIZE +mb2: lodsb + stosb + test al, al + jz mb3 + dec ecx + jnz mb2 +mb3: + + /* Copy to low mem */ + mov esi, INITIAL_BASE + mov edi, FREELDR_BASE + mov ecx, (offset __bss_end__ - FREELDR_BASE) + add ecx, 3 + shr ecx, 2 + rep movsd + + /* Load the GDT and IDT */ + lgdt gdtptr + lidt i386idtptr + + /* Clear prefetch queue & correct CS, + * jump to low mem */ + //ljmp $PMODE_CS, $mb4 + jmp far ptr PMODE_CS:mb4 +mb4: + /* Reload segment selectors */ + mov dx, PMODE_DS + mov ds, dx + mov es, dx + mov fs, dx + mov gs, dx + mov ss, dx + mov esp, STACK32ADDR + + mov ebx, offset mb_info + /* See if the boot device was passed in */ + mov edx, [ebx + MB_INFO_FLAGS_OFFSET] + test edx, MB_INFO_FLAG_BOOT_DEVICE + jz mb5 + /* Retrieve boot device info */ + mov eax, [ebx + MB_INFO_BOOT_DEVICE_OFFSET] + shr eax, 16 + inc al + mov byte ptr [_FrldrBootPartition], al + mov byte ptr [_FrldrBootDrive], ah + jmp mb6 +mb5: /* No boot device known, assume first partition of first harddisk */ + mov byte ptr [_FrldrBootDrive], HEX(80) + mov byte ptr [_FrldrBootPartition], 1 +mb6: + /* Check for command line */ + mov eax, offset cmdline + test dword ptr [ebx + MB_INFO_FLAGS_OFFSET], MB_INFO_FLAG_COMMAND_LINE + jnz mb7 + xor eax, eax +mb7: + + /* GO! */ + push eax + call _BootMain + +mbfail: + int 3 +mbstop: jmp mbstop /* We should never get here */ + +mb_info: + .fill MB_INFO_SIZE, 1, 0 + +cmdline: + .fill CMDLINE_SIZE, 1, 0 + +.align 4 /* force 4-byte alignment */ +gdt: + /* NULL Descriptor */ + .word HEX(0000) + .word HEX(0000) + .word HEX(0000) + .word HEX(0000) + + /* 32-bit flat CS */ + .word HEX(FFFF) + .word HEX(0000) + .word HEX(9A00) + .word HEX(00CF) + + /* 32-bit flat DS */ + .word HEX(FFFF) + .word HEX(0000) + .word HEX(9200) + .word HEX(00CF) + + /* 16-bit real mode CS */ + .word HEX(FFFF) + .word HEX(0000) + .word HEX(9E00) + .word HEX(0000) + + /* 16-bit real mode DS */ + .word HEX(FFFF) + .word HEX(0000) + .word HEX(9200) + .word HEX(0000) + +/* GDT table pointer */ +gdtptr: + .word HEX(27) /* Limit */ + .long gdt /* Base Address */ + +/* Initial GDT table pointer for multiboot */ +gdtptrhigh: + .word HEX(27) /* Limit */ + .long gdt + INITIAL_BASE - FREELDR_BASE /* Base Address */ diff --git a/boot/freeldr/freeldr/arch/i386/ntoskrnl.c b/boot/freeldr/freeldr/arch/i386/ntoskrnl.c index dcc51ef2b59..272401d2c36 100644 --- a/boot/freeldr/freeldr/arch/i386/ntoskrnl.c +++ b/boot/freeldr/freeldr/arch/i386/ntoskrnl.c @@ -1,6 +1,9 @@ #include -#define NDEBUG -#include + +/* For KeStallExecutionProcessor */ +#if defined(_M_IX86) || defined(_M_AMD64) +#include +#endif VOID NTAPI @@ -75,6 +78,7 @@ NTAPI KeStallExecutionProcessor( IN ULONG MicroSeconds) { +#if defined(_M_IX86) || defined(_M_AMD64) REGS Regs; ULONG usec_this; @@ -111,4 +115,7 @@ KeStallExecutionProcessor( MicroSeconds -= usec_this; } +#else + #error unimplemented +#endif } diff --git a/boot/freeldr/freeldr/arch/i386/pcdisk.c b/boot/freeldr/freeldr/arch/i386/pcdisk.c index 4bde50c5839..31f59245e9e 100644 --- a/boot/freeldr/freeldr/arch/i386/pcdisk.c +++ b/boot/freeldr/freeldr/arch/i386/pcdisk.c @@ -42,7 +42,7 @@ typedef struct // FUNCTIONS ///////////////////////////////////////////////////////////////////////////////////////////// -static BOOLEAN PcDiskResetController(ULONG DriveNumber) +static BOOLEAN PcDiskResetController(UCHAR DriveNumber) { REGS RegsIn; REGS RegsOut; @@ -65,7 +65,7 @@ static BOOLEAN PcDiskResetController(ULONG DriveNumber) return INT386_SUCCESS(RegsOut); } -static BOOLEAN PcDiskReadLogicalSectorsLBA(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer) +static BOOLEAN PcDiskReadLogicalSectorsLBA(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer) { REGS RegsIn; REGS RegsOut; @@ -73,6 +73,7 @@ static BOOLEAN PcDiskReadLogicalSectorsLBA(ULONG DriveNumber, ULONGLONG SectorNu PI386_DISK_ADDRESS_PACKET Packet = (PI386_DISK_ADDRESS_PACKET)(BIOSCALLBUFFER); DPRINTM(DPRINT_DISK, "PcDiskReadLogicalSectorsLBA() DriveNumber: 0x%x SectorNumber: %I64d SectorCount: %d Buffer: 0x%x\n", DriveNumber, SectorNumber, SectorCount, Buffer); + ASSERT(((ULONG_PTR)Buffer) <= 0xFFFFF); // BIOS int 0x13, function 42h - IBM/MS INT 13 Extensions - EXTENDED READ RegsIn.b.ah = 0x42; // Subfunction 42h @@ -84,9 +85,10 @@ static BOOLEAN PcDiskReadLogicalSectorsLBA(ULONG DriveNumber, ULONGLONG SectorNu RtlZeroMemory(Packet, sizeof(I386_DISK_ADDRESS_PACKET)); Packet->PacketSize = sizeof(I386_DISK_ADDRESS_PACKET); Packet->Reserved = 0; - Packet->LBABlockCount = SectorCount; + Packet->LBABlockCount = (USHORT)SectorCount; + ASSERT(Packet->LBABlockCount == SectorCount); Packet->TransferBufferOffset = ((ULONG_PTR)Buffer) & 0x0F; - Packet->TransferBufferSegment = ((ULONG_PTR)Buffer) >> 4; + Packet->TransferBufferSegment = (USHORT)(((ULONG_PTR)Buffer) >> 4); Packet->LBAStartBlock = SectorNumber; // BIOS int 0x13, function 42h - IBM/MS INT 13 Extensions - EXTENDED READ @@ -128,10 +130,10 @@ static BOOLEAN PcDiskReadLogicalSectorsLBA(ULONG DriveNumber, ULONGLONG SectorNu return FALSE; } -static BOOLEAN PcDiskReadLogicalSectorsCHS(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer) +static BOOLEAN PcDiskReadLogicalSectorsCHS(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer) { - ULONG PhysicalSector; - ULONG PhysicalHead; + UCHAR PhysicalSector; + UCHAR PhysicalHead; ULONG PhysicalTrack; GEOMETRY DriveGeometry; ULONG NumberOfSectorsToRead; @@ -156,10 +158,11 @@ static BOOLEAN PcDiskReadLogicalSectorsCHS(ULONG DriveNumber, ULONGLONG SectorNu // // Calculate the physical disk offsets + // Note: DriveGeometry.Sectors < 64 // - PhysicalSector = 1 + (SectorNumber % DriveGeometry.Sectors); - PhysicalHead = (SectorNumber / DriveGeometry.Sectors) % DriveGeometry.Heads; - PhysicalTrack = (SectorNumber / DriveGeometry.Sectors) / DriveGeometry.Heads; + PhysicalSector = 1 + (UCHAR)(SectorNumber % DriveGeometry.Sectors); + PhysicalHead = (UCHAR)((SectorNumber / DriveGeometry.Sectors) % DriveGeometry.Heads); + PhysicalTrack = (ULONG)((SectorNumber / DriveGeometry.Sectors) / DriveGeometry.Heads); // // Calculate how many sectors we need to read this round @@ -208,12 +211,12 @@ static BOOLEAN PcDiskReadLogicalSectorsCHS(ULONG DriveNumber, ULONGLONG SectorNu // AL = number of sectors transferred // (only valid if CF set for some BIOSes) RegsIn.b.ah = 0x02; - RegsIn.b.al = NumberOfSectorsToRead; + RegsIn.b.al = (UCHAR)NumberOfSectorsToRead; RegsIn.b.ch = (PhysicalTrack & 0xFF); - RegsIn.b.cl = (PhysicalSector + ((PhysicalTrack & 0x300) >> 2)); + RegsIn.b.cl = (UCHAR)(PhysicalSector + ((PhysicalTrack & 0x300) >> 2)); RegsIn.b.dh = PhysicalHead; RegsIn.b.dl = DriveNumber; - RegsIn.w.es = ((ULONG_PTR)Buffer) >> 4; + RegsIn.w.es = (USHORT)(((ULONG_PTR)Buffer) >> 4); RegsIn.w.bx = ((ULONG_PTR)Buffer) & 0x0F; // @@ -264,7 +267,7 @@ static BOOLEAN PcDiskReadLogicalSectorsCHS(ULONG DriveNumber, ULONGLONG SectorNu return TRUE; } -BOOLEAN PcDiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer) +BOOLEAN PcDiskReadLogicalSectors(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer) { DPRINTM(DPRINT_DISK, "PcDiskReadLogicalSectors() DriveNumber: 0x%x SectorNumber: %I64d SectorCount: %d Buffer: 0x%x\n", DriveNumber, SectorNumber, SectorCount, Buffer); @@ -294,7 +297,7 @@ BOOLEAN PcDiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULON } BOOLEAN -PcDiskGetDriveGeometry(ULONG DriveNumber, PGEOMETRY Geometry) +PcDiskGetDriveGeometry(UCHAR DriveNumber, PGEOMETRY Geometry) { REGS RegsIn; REGS RegsOut; @@ -345,7 +348,7 @@ PcDiskGetDriveGeometry(ULONG DriveNumber, PGEOMETRY Geometry) } ULONG -PcDiskGetCacheableBlockCount(ULONG DriveNumber) +PcDiskGetCacheableBlockCount(UCHAR DriveNumber) { GEOMETRY Geometry; diff --git a/boot/freeldr/freeldr/arch/i386/pcvideo.c b/boot/freeldr/freeldr/arch/i386/pcvideo.c index 8464b10328c..2f89d6dff64 100644 --- a/boot/freeldr/freeldr/arch/i386/pcvideo.c +++ b/boot/freeldr/freeldr/arch/i386/pcvideo.c @@ -108,7 +108,7 @@ typedef struct } SVGA_MODE_INFORMATION, *PSVGA_MODE_INFORMATION; #include -static ULONG BiosVideoMode; /* Current video mode as known by BIOS */ +static USHORT BiosVideoMode; /* Current video mode as known by BIOS */ static ULONG ScreenWidth = 80; /* Screen Width in characters */ static ULONG ScreenHeight = 25; /* Screen Height in characters */ static ULONG BytesPerScanLine = 160; /* Number of bytes per scanline (delta) */ @@ -191,7 +191,7 @@ PcVideoDetectVideoCard(VOID) } } -static VOID PcVideoSetBiosMode(ULONG VideoMode) +static VOID PcVideoSetBiosMode(UCHAR VideoMode) { REGS Regs; @@ -298,7 +298,7 @@ PcVideoDisableCursorEmulation(VOID) } static VOID -PcVideoDefineCursor(ULONG StartScanLine, ULONG EndScanLine) +PcVideoDefineCursor(UCHAR StartScanLine, UCHAR EndScanLine) { REGS Regs; @@ -334,7 +334,7 @@ PcVideoDefineCursor(ULONG StartScanLine, ULONG EndScanLine) } static VOID -PcVideoSetVerticalResolution(ULONG ScanLines) +PcVideoSetVerticalResolution(UCHAR VerticalResolutionMode) { REGS Regs; @@ -356,7 +356,7 @@ PcVideoSetVerticalResolution(ULONG ScanLines) */ Regs.b.ah = 0x12; Regs.b.bl = 0x30; - Regs.b.al = ScanLines; + Regs.b.al = VerticalResolutionMode; Int386(0x10, &Regs, &Regs); } @@ -698,7 +698,7 @@ PcVideoSetMode80x60(VOID) } static BOOLEAN -PcVideoSetMode(ULONG NewMode) +PcVideoSetMode(USHORT NewMode) { CurrentMemoryBank = 0; @@ -735,7 +735,7 @@ PcVideoSetMode(ULONG NewMode) if (0x12 == NewMode) { /* 640x480x16 */ - PcVideoSetBiosMode(NewMode); + PcVideoSetBiosMode((UCHAR)NewMode); WRITE_PORT_USHORT((USHORT*)0x03CE, 0x0F01); /* For some reason this is necessary? */ ScreenWidth = 640; ScreenHeight = 480; @@ -748,7 +748,7 @@ PcVideoSetMode(ULONG NewMode) else if (0x13 == NewMode) { /* 320x200x256 */ - PcVideoSetBiosMode(NewMode); + PcVideoSetBiosMode((UCHAR)NewMode); ScreenWidth = 320; ScreenHeight = 200; BytesPerScanLine = 320; @@ -871,7 +871,7 @@ PcVideoSetMemoryBank(USHORT BankNumber) VIDEODISPLAYMODE PcVideoSetDisplayMode(char *DisplayModeName, BOOLEAN Init) { - ULONG VideoMode = VIDEOMODE_NORMAL_TEXT; + USHORT VideoMode = VIDEOMODE_NORMAL_TEXT; if (NULL == DisplayModeName || '\0' == *DisplayModeName) { @@ -923,7 +923,6 @@ PcVideoSetDisplayMode(char *DisplayModeName, BOOLEAN Init) PcVideoSetBlinkBit(! Init); - return DisplayMode; } @@ -958,7 +957,7 @@ PcVideoGetBufferSize(VOID) } VOID -PcVideoSetTextCursorPosition(ULONG X, ULONG Y) +PcVideoSetTextCursorPosition(UCHAR X, UCHAR Y) { REGS Regs; @@ -998,9 +997,9 @@ PcVideoHideShowTextCursor(BOOLEAN Show) VOID PcVideoCopyOffScreenBufferToVRAM(PVOID Buffer) { - ULONG BanksToCopy; + USHORT BanksToCopy; ULONG BytesInLastBank; - ULONG CurrentBank; + USHORT CurrentBank; ULONG BankSize; /* PcVideoWaitForVerticalRetrace(); */ @@ -1014,7 +1013,7 @@ PcVideoCopyOffScreenBufferToVRAM(PVOID Buffer) else if (VideoGraphicsMode == DisplayMode && VesaVideoMode) { BankSize = VesaVideoModeInformation.WindowGranularity << 10; - BanksToCopy = (VesaVideoModeInformation.HeightInPixels * VesaVideoModeInformation.BytesPerScanLine) / BankSize; + BanksToCopy = (USHORT)((VesaVideoModeInformation.HeightInPixels * VesaVideoModeInformation.BytesPerScanLine) / BankSize); BytesInLastBank = (VesaVideoModeInformation.HeightInPixels * VesaVideoModeInformation.BytesPerScanLine) % BankSize; /* Copy all the banks but the last one because diff --git a/boot/freeldr/freeldr/arch/i386/realmode.S b/boot/freeldr/freeldr/arch/i386/realmode.S index 78a1faecb2d..0a146c573e4 100644 --- a/boot/freeldr/freeldr/arch/i386/realmode.S +++ b/boot/freeldr/freeldr/arch/i386/realmode.S @@ -2,81 +2,7 @@ #include -.code16 -PUBLIC _mainCRTStartup -_mainCRTStartup: -_LoaderEntry: - ret - -.endcode16 - .code32 -// globals -PUBLIC _BootPartition -_BootPartition: -PUBLIC _BootDrive -_BootDrive: - -PUBLIC _PageDirectoryStart -_PageDirectoryStart: -PUBLIC _PageDirectoryEnd -_PageDirectoryEnd: - -PUBLIC _startup_pagedirectory -_startup_pagedirectory: -PUBLIC _apic_pagetable -_apic_pagetable: -PUBLIC _kernel_pagetable -_kernel_pagetable: -PUBLIC _lowmem_pagetable -_lowmem_pagetable: - - -PUBLIC RealEntryPoint -RealEntryPoint: - -PUBLIC _EnableA20 -_EnableA20: - -PUBLIC _ChainLoadBiosBootSectorCode -_ChainLoadBiosBootSectorCode: - -PUBLIC _BootOldLinuxKernel -_BootOldLinuxKernel: - -PUBLIC _BootNewLinuxKernel -_BootNewLinuxKernel: - -PUBLIC _SoftReboot -_SoftReboot: - -PUBLIC _DriveMapOldInt13HandlerAddress -_DriveMapOldInt13HandlerAddress: - -PUBLIC _DriveMapInt13HandlerStart -_DriveMapInt13HandlerStart: - -PUBLIC _DriveMapInt13HandlerEnd -_DriveMapInt13HandlerEnd: - -PUBLIC _DriveMapInt13HandlerMapList -_DriveMapInt13HandlerMapList: - -PUBLIC _PnpBiosGetDeviceNode -_PnpBiosGetDeviceNode: - -PUBLIC _PnpBiosGetDeviceNodeCount -_PnpBiosGetDeviceNodeCount: - -PUBLIC _PnpBiosSupported -_PnpBiosSupported: - -PUBLIC _Int386 -_Int386: - -PUBLIC _PxeCallApi -_PxeCallApi: - END diff --git a/boot/freeldr/freeldr/arch/i386/xboxdisk.c b/boot/freeldr/freeldr/arch/i386/xboxdisk.c index 57b57e7873f..3b33e0306d7 100644 --- a/boot/freeldr/freeldr/arch/i386/xboxdisk.c +++ b/boot/freeldr/freeldr/arch/i386/xboxdisk.c @@ -152,7 +152,7 @@ static struct * Data block read and write commands */ #define IDEReadBlock(Address, Buffer, Count) \ - (__inwordstring(((Address) + IDE_REG_DATA_PORT), (PUSHORT)(Buffer), (Count) / 2)) + (READ_PORT_BUFFER_USHORT((PUSHORT)((Address) + IDE_REG_DATA_PORT), (PUSHORT)(Buffer), (Count) / 2)) #define IDEWriteBlock(Address, Buffer, Count) \ (WRITE_PORT_BUFFER_USHORT((PUSHORT)((Address) + IDE_REG_DATA_PORT), (PUSHORT)(Buffer), (Count) / 2)) @@ -435,7 +435,7 @@ XboxDiskPolledRead(ULONG CommandPort, } BOOLEAN -XboxDiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer) +XboxDiskReadLogicalSectors(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer) { ULONG StartSector; UCHAR Count; @@ -456,7 +456,7 @@ XboxDiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG Sect StartSector = (ULONG) SectorNumber; while (0 < SectorCount) { - Count = (SectorCount <= 255 ? SectorCount : 255); + Count = (SectorCount <= 255 ? (UCHAR)SectorCount : 255); if (! XboxDiskPolledRead(XBOX_IDE_COMMAND_PORT, XBOX_IDE_CONTROL_PORT, 0, Count, @@ -478,7 +478,7 @@ XboxDiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG Sect } BOOLEAN -XboxDiskGetPartitionEntry(ULONG DriveNumber, ULONG PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry) +XboxDiskGetPartitionEntry(UCHAR DriveNumber, ULONG PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry) { UCHAR SectorData[IDE_SECTOR_BUF_SZ]; @@ -503,7 +503,7 @@ XboxDiskGetPartitionEntry(ULONG DriveNumber, ULONG PartitionNumber, PPARTITION_T } BOOLEAN -XboxDiskGetDriveGeometry(ULONG DriveNumber, PGEOMETRY Geometry) +XboxDiskGetDriveGeometry(UCHAR DriveNumber, PGEOMETRY Geometry) { IDE_DRIVE_IDENTIFY DrvParms; ULONG i; @@ -563,7 +563,7 @@ XboxDiskGetDriveGeometry(ULONG DriveNumber, PGEOMETRY Geometry) } ULONG -XboxDiskGetCacheableBlockCount(ULONG DriveNumber) +XboxDiskGetCacheableBlockCount(UCHAR DriveNumber) { /* 64 seems a nice number, it is used by the machpc code for LBA devices */ return 64; diff --git a/boot/freeldr/freeldr/arch/i386/xboxhw.c b/boot/freeldr/freeldr/arch/i386/xboxhw.c index ff325b3dd49..5df37c48b64 100644 --- a/boot/freeldr/freeldr/arch/i386/xboxhw.c +++ b/boot/freeldr/freeldr/arch/i386/xboxhw.c @@ -30,11 +30,11 @@ extern ARC_DISK_SIGNATURE reactos_arc_disk_info[]; extern char reactos_arc_strings[32][256]; static PCM_PARTIAL_RESOURCE_LIST -GetHarddiskConfigurationData(ULONG DriveNumber, ULONG* pSize) +GetHarddiskConfigurationData(UCHAR DriveNumber, ULONG* pSize) { PCM_PARTIAL_RESOURCE_LIST PartialResourceList; PCM_DISK_GEOMETRY_DEVICE_DATA DiskGeometry; - EXTENDED_GEOMETRY ExtGeometry; + //EXTENDED_GEOMETRY ExtGeometry; GEOMETRY Geometry; ULONG Size; @@ -69,7 +69,7 @@ GetHarddiskConfigurationData(ULONG DriveNumber, ULONG* pSize) DiskGeometry = (PVOID)(((ULONG_PTR)PartialResourceList) + sizeof(CM_PARTIAL_RESOURCE_LIST)); /* Get the disk geometry */ - ExtGeometry.Size = sizeof(EXTENDED_GEOMETRY); + //ExtGeometry.Size = sizeof(EXTENDED_GEOMETRY); if(MachDiskGetDriveGeometry(DriveNumber, &Geometry)) { @@ -101,7 +101,7 @@ GetHarddiskConfigurationData(ULONG DriveNumber, ULONG* pSize) typedef struct tagDISKCONTEXT { - ULONG DriveNumber; + UCHAR DriveNumber; ULONG SectorSize; ULONGLONG SectorOffset; ULONGLONG SectorCount; @@ -122,7 +122,7 @@ static LONG DiskGetFileInformation(ULONG FileId, FILEINFORMATION* Information) RtlZeroMemory(Information, sizeof(FILEINFORMATION)); Information->EndingAddress.QuadPart = (Context->SectorOffset + Context->SectorCount) * Context->SectorSize; - Information->CurrentAddress.LowPart = (Context->SectorOffset + Context->SectorNumber) * Context->SectorSize; + Information->CurrentAddress.QuadPart = (Context->SectorOffset + Context->SectorNumber) * Context->SectorSize; return ESUCCESS; } @@ -130,7 +130,8 @@ static LONG DiskGetFileInformation(ULONG FileId, FILEINFORMATION* Information) static LONG DiskOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId) { DISKCONTEXT* Context; - ULONG DriveNumber, DrivePartition, SectorSize; + ULONG DrivePartition, SectorSize; + UCHAR DriveNumber; ULONGLONG SectorOffset = 0; ULONGLONG SectorCount = 0; PARTITION_TABLE_ENTRY PartitionTableEntry; @@ -233,7 +234,7 @@ static const DEVVTBL DiskVtbl = { static VOID GetHarddiskIdentifier(PCHAR Identifier, - ULONG DriveNumber) + UCHAR DriveNumber) { PMASTER_BOOT_RECORD Mbr; ULONG *Buffer; @@ -274,7 +275,7 @@ GetHarddiskIdentifier(PCHAR Identifier, reactos_arc_strings[reactos_disk_count]; reactos_disk_count++; - sprintf(ArcName, "multi(0)disk(0)rdisk(%lu)partition(0)", DriveNumber - 0x80); + sprintf(ArcName, "multi(0)disk(0)rdisk(%u)partition(0)", DriveNumber - 0x80); FsRegisterDevice(ArcName, &DiskVtbl); /* Add partitions */ @@ -284,7 +285,7 @@ GetHarddiskIdentifier(PCHAR Identifier, { if (PartitionTableEntry.SystemIndicator != PARTITION_ENTRY_UNUSED) { - sprintf(ArcName, "multi(0)disk(0)rdisk(%lu)partition(%lu)", DriveNumber - 0x80, i); + sprintf(ArcName, "multi(0)disk(0)rdisk(%u)partition(%lu)", DriveNumber - 0x80, i); FsRegisterDevice(ArcName, &DiskVtbl); } i++; @@ -323,9 +324,8 @@ DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA SystemKey, PCM_INT13_DRIVE_PARAMETER Int13Drives; GEOMETRY Geometry; PCONFIGURATION_COMPONENT_DATA DiskKey, ControllerKey; - ULONG DiskCount; + UCHAR DiskCount, i; ULONG Size; - ULONG i; BOOLEAN Changed; /* Count the number of visible drives */ @@ -390,8 +390,8 @@ DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA SystemKey, { Int13Drives[i].DriveSelect = 0x80 + i; Int13Drives[i].MaxCylinders = Geometry.Cylinders - 1; - Int13Drives[i].SectorsPerTrack = Geometry.Sectors; - Int13Drives[i].MaxHeads = Geometry.Heads - 1; + Int13Drives[i].SectorsPerTrack = (USHORT)Geometry.Sectors; + Int13Drives[i].MaxHeads = (USHORT)Geometry.Heads - 1; Int13Drives[i].NumberDrives = DiskCount; DPRINTM(DPRINT_HWDETECT, diff --git a/boot/freeldr/freeldr/arch/i386/xboxvideo.c b/boot/freeldr/freeldr/arch/i386/xboxvideo.c index d164b540b01..d1d3f86ebf6 100644 --- a/boot/freeldr/freeldr/arch/i386/xboxvideo.c +++ b/boot/freeldr/freeldr/arch/i386/xboxvideo.c @@ -182,7 +182,7 @@ XboxVideoGetBufferSize(VOID) } VOID -XboxVideoSetTextCursorPosition(ULONG X, ULONG Y) +XboxVideoSetTextCursorPosition(UCHAR X, UCHAR Y) { /* We don't have a cursor yet */ } diff --git a/boot/freeldr/freeldr/arch/realmode/amd64.S b/boot/freeldr/freeldr/arch/realmode/amd64.S new file mode 100644 index 00000000000..1958a5411b3 --- /dev/null +++ b/boot/freeldr/freeldr/arch/realmode/amd64.S @@ -0,0 +1,225 @@ + +#include +#include + +#define IMAGE_DOS_HEADER_e_lfanew 36 +#define IMAGE_FILE_HEADER_SIZE 20 +#define IMAGE_OPTIONAL_HEADER_AddressOfEntryPoint 16 + + +.code16 + +/* fat helper code */ +#include "fathelp.inc" + +.org 512 +RealEntryPoint: + + cli + + /* Setup real mode segment registers */ + xor ax, ax + mov ds, ax + mov es, ax + mov fs, ax + mov gs, ax + mov ss, ax + + /* checkPoint Charlie - where it all began... */ + mov si, offset CheckPoint0 + call writestr + + /* Setup a real mode stack */ + mov sp, stack16 + + /* Zero BootDrive and BootPartition */ + xor eax, eax + mov BootDrive, eax + mov BootPartition, eax + + /* Store the boot drive */ + mov BootDrive, dl + + /* Store the boot partition */ + mov BootPartition, dh + + /* Load the GDT */ + lgdt gdtptr + /* Load the IDT */ +// lidt idtptr + + call x86_16_EnableA20 + + /* checkPoint Charlie - where it all began... */ + mov si, offset CheckPoint1 + call writestr + + call x86_16_BuildPageTables + + /* checkPoint Charlie - where it all began... */ + mov si, offset CheckPoint2 + call writestr + + /* Check if CPU supports CPUID */ + pushfd + pop eax + mov ebx, eax + xor eax, HEX(00200000) + push eax + popfd + pushfd + pop eax + cmp eax,ebx + jz no_cpuid_support_detected + + /* CPUID support detected - getting the PAE/PGE */ + + mov eax,1 // Fn0000_0001 - PAE in EDX[6] + cpuid + xor eax,eax + and edx, HEX(00a0) + test edx,edx // are PAE and PGE bits set? + jz no_x64_support_detected + + /* PAE and PGE are here */ + + xor edx, edx + mov eax, HEX(80000001) + cpuid + and edx, HEX(20000000) + test edx,edx + jz no_x64_support_detected + + /* X64 Processor */ + + /* checkPoint Charlie - where it all began... */ + mov si, offset CheckPoint3 + call writestr + + /* Get address of optional header */ + mov eax, dword ptr ds:[FREELDR_PE_BASE + IMAGE_DOS_HEADER_e_lfanew] + add eax, FREELDR_PE_BASE + 4 + IMAGE_FILE_HEADER_SIZE + + /* Get address of entry point */ + mov eax, dword ptr ds:[eax + IMAGE_OPTIONAL_HEADER_AddressOfEntryPoint] + + /* Store the address in the callback return variable */ + mov dword ptr ds:[CallbackReturnAddress], eax + +switch64: + mov + jmp x86_16_ReturnToLong + + +no_x64_support_detected: + mov si, offset NotAnX64Processor // Loading message + call writestr + jmp fail + +no_cpuid_support_detected: + mov si, offset NoCPUIDSupport // Loading message + call writestr + +fail: + jmp fail + nop + nop + +/* + * We define 512 2MB pages at the start of memory, so we can access the first + * 1 GB as if paging was disabled + */ +x86_16_BuildPageTables: + pusha + push es + + /* Get segment of pml4 */ + mov eax, offset pml4_startup + shr eax, 4 + mov es, ax + cld + xor di, di + + /* One entry in the PML4 pointing to PDP */ + mov eax, offset pdp_startup + or eax, HEX(00f) + stosd + /* clear rest */ + xor eax, eax + mov cx, HEX(03ff) + rep stosd + + /* One entry in the PDP pointing to PD */ + mov eax, offset pd_startup + or eax, HEX(00f) + stosd + /* clear rest */ + xor eax, eax + mov ecx, HEX(03ff) + rep stosd + + /* 512 entries in the PD defining a 2MB page each */ + mov ecx, 512 + mov eax, HEX(008f) + +Bpt2: + mov es: [di], eax + mov dword ptr es: [di + 4], 0 + add eax, 512 << 12 // add 512 4k pages + add di, 8 + + /* Loop it */ + dec cx + jnz Bpt2 + + /* Return */ + pop es + popa + ret + + + + + +x86_16_ReturnToLong: + + cli + + xor ax,ax + mov ds,ax + mov es,ax + mov fs,ax + mov gs,ax + mov ss,ax + + /* Get the return address off the stack */ + pop word ptr code64ret + + /* Save 16-bit stack pointer */ + mov stack16, sp + + mov eax, 0x00a0 // Set PAE and PGE: 10100000b + mov cr4, eax + + mov edx, offset pml4_startup // Point cr3 at PML4 + mov cr3, edx + + mov ecx, HEX(0C0000080) // Specify EFER MSR + + rdmsr // Enable long mode + or eax, HEX(00000100) + wrmsr + + mov ebx, cr0 // Activate long mode + or ebx, HEX(080000001) // by enabling paging and protection simultaneously + mov cr0, ebx // skipping protected mode entirely + + //jmp LMODE_CS:offset LongCat //Load CS with 64 bit segment and flush the instruction cache + // Do a long jmp to the CallbackReturn address + + +#include "helpers.inc" + +.endcode16 + +END diff --git a/boot/freeldr/freeldr/arch/realmode/fathelp.inc b/boot/freeldr/freeldr/arch/realmode/fathelp.inc new file mode 100644 index 00000000000..1825fbe96a6 --- /dev/null +++ b/boot/freeldr/freeldr/arch/realmode/fathelp.inc @@ -0,0 +1,225 @@ +// fathelp.S +// FAT12/16 Boot Sector Helper Code +// Copyright (c) 1998, 2001, 2002, 2003 Brian Palmer + +//#include + +//org 8000h + +//.text + +#define BootSectorStackTop HEX(7bf2) +#define DataAreaStartHigh 2 +#define DataAreaStartLow 4 +#define BiosCHSDriveSizeHigh 6 +#define BiosCHSDriveSizeLow 8 +#define BiosCHSDriveSize 8 +#define ReadSectorsOffset 10 +#define ReadClusterOffset 12 +#define PutCharsOffset 14 + +#define OEMName 3 +#define BytesPerSector 11 +#define SectsPerCluster 13 +#define ReservedSectors 14 +#define NumberOfFats 16 +#define MaxRootEntries 17 +#define TotalSectors 19 +#define MediaDescriptor 21 +#define SectorsPerFat 22 +#define SectorsPerTrack 24 +#define NumberOfHeads 26 +#define HiddenSectors 28 +#define TotalSectorsBig 32 +#define BootDrive 36 +#define Reserved 37 +#define ExtendSig 38 +#define SerialNumber 39 +#define VolumeLabel 43 +#define FileSystem 54 + +#define BootPartition HEX(7dfd) + + +// This code will be stored in the first 512 bytes +// of freeldr.sys. The first 3 bytes will be a jmp +// instruction to skip past the FAT helper code +// that is stored in the rest of the 512 bytes. +// + +PUBLIC start +start: + // This code is loaded at 0000:F800 so we have to + // encode a jmp instruction to jump to 0000:FA00 + .byte HEX(e9), HEX(fd), HEX(01) + +// Now starts the extra boot code that we will store +// in the first 512 bytes of freeldr.sys. This code +// allows the FAT12/16 bootsector to navigate the +// FAT table so that we can still load freeldr.sys +// even if it is fragmented. + + +FatHelperEntryPoint: + /* First save AX - the start cluster of freeldr.sys */ + push ax + + /* Display "Loading FreeLoader..." message */ + mov si, offset msgLoading + call word ptr [bp-PutCharsOffset] + + call ReadFatIntoMemory + + /* Restore AX (start cluster) */ + pop ax + + // AX has start cluster of freeldr.sys + mov bx, FREELDR_BASE / 16 + mov es,bx + +LoadFile: + push ax + call IsFat12 + pop ax + jnc LoadFile2 + cmp ax, HEX(0ff8) // Check to see if this is the last cluster in the chain + jmp LoadFile3 + +LoadFile2: + cmp ax, HEX(0fff8) +LoadFile3: + jae LoadFile_Done // If so continue, if not then read then next one + push ax + xor bx,bx // Load ROSLDR starting at 0000:8000h + push es + call word ptr [bp-ReadClusterOffset] + pop es + + xor bx,bx + mov bl, [bp+SectsPerCluster] + shl bx,5 // BX = BX * 512 / 16 + mov ax,es // Increment the load address by + add ax,bx // The size of a cluster + mov es,ax + + call IsFat12 + pop ax + push es + jnc LoadFile4 + call GetFatEntry12 // Get the next entry + jmp LoadFile5 +LoadFile4: + call GetFatEntry16 +LoadFile5: + pop es + + jmp LoadFile // Load the next cluster (if any) + +LoadFile_Done: + mov dl, byte ptr [bp+BootDrive] // Load the boot drive into DL + mov dh, byte ptr ds:[BootPartition] // Load the boot partition into DH + + /* continue where other bootsectors start */ + jmp start + + +// Reads the entire FAT into memory at 7000:0000 +ReadFatIntoMemory: + mov ax, [bp+HiddenSectors] + mov dx, [bp+HiddenSectors+2] + add ax, [bp+ReservedSectors] + adc dx, 0 + mov cx, [bp+SectorsPerFat] + mov bx, HEX(7000) + mov es,bx + xor bx,bx + call word ptr [bp-ReadSectorsOffset] + ret + + +// Returns the FAT entry for a given cluster number for 16-bit FAT +// On entry AX has cluster number +// On return AX has FAT entry for that cluster +GetFatEntry16: + mov cx,2 // AX = AX * 2 (since FAT16 entries are 2 bytes) + mul cx + shl dx,12 + + mov bx, HEX(7000) + add bx,dx + mov es,bx + mov bx,ax // Restore FAT entry offset + mov ax, es:[bx] // Get FAT entry + + ret + + +// Returns the FAT entry for a given cluster number for 12-bit FAT +// On entry AX has cluster number +// On return AX has FAT entry for that cluster +GetFatEntry12: + push ax + mov cx,ax + shr ax,1 + add ax,cx // AX = AX * 1.5 (AX = AX + (AX / 2)) (since FAT12 entries are 12 bits) + + mov bx, HEX(7000) + mov es,bx + mov bx,ax // Put FAT entry offset into BX + mov ax, es:[bx] // Get FAT entry + pop cx // Get cluster number from stack + and cx,1 + jz UseLow12Bits + and ax, HEX(0fff0) + shr ax,4 + jmp GetFatEntry12_Done + +UseLow12Bits: + and ax, HEX(0fff) + +GetFatEntry12_Done: + + ret + + +// Returns CF = 1 if this is a FAT12 file system +// Otherwise CF = 0 for FAT16 +IsFat12: + + mov ebx, dword ptr [bp-DataAreaStartLow] + // EBX now has the number of the starting sector of the data area + // starting from the beginning of the disk, so subtrace hidden sectors + sub ebx, dword ptr [bp+HiddenSectors] + + + xor eax,eax + mov ax, word ptr [bp+TotalSectors] + cmp ax, 0 + jnz IsFat12_2 + mov eax, dword ptr [bp+TotalSectorsBig] + + // EAX now contains the number of sectors on the volume + +IsFat12_2: + sub eax,ebx // Subtract data area start sector + xor edx,edx // from total sectors of volume + + // EDX:EAX now contains the number of data sectors on the volume + movzx ebx, byte ptr [bp+SectsPerCluster] + div ebx + // EAX now has the number of clusters on the volume + stc + cmp eax,4085 + jb IsFat12_Done + clc + +IsFat12_Done: + ret + + +msgLoading: + .ascii "Loading FreeLoader...", CR, LF, NUL + + .org 510 // Pad to 510 bytes + .word HEX(0aa55) // BootSector signature + diff --git a/boot/freeldr/freeldr/arch/realmode/helpers.inc b/boot/freeldr/freeldr/arch/realmode/helpers.inc new file mode 100644 index 00000000000..dd1fd492748 --- /dev/null +++ b/boot/freeldr/freeldr/arch/realmode/helpers.inc @@ -0,0 +1,120 @@ + +Empty8042: + .word HEX(00eb), HEX(00eb) // jmp $+2, jmp $+2 + in al, HEX(64) + cmp al, HEX(0ff) // legacy-free machine without keyboard + jz Empty8042_ret // controllers on Intel Macs read back 0xFF + test al, 2 + jnz Empty8042 +Empty8042_ret: + ret + +EnableA20: + pusha + call Empty8042 + mov al, HEX(0D1) // command write + out HEX(064), al + call Empty8042 + mov al, HEX(0DF) // A20 on + out HEX(060), al + call Empty8042 + popa + ret + +/* + * writestr + * si = pointer to zero terminated string + */ +writestr: + pushfd + pushad +writestr_top: + lodsb + and al, al + jz writestr_end + call writechr + jmp short writestr_top +writestr_end: + popad + popfd + ret + +/* + * writechr + * al = character to output + */ +writechr: + pushf + pusha + mov ah, HEX(0E) + xor bx, bx + int HEX(10) + popa + popf + ret + +// +// writehex[248]: Write a hex number in (AL, AX, EAX) to the console +// +writehex2: + pushfd + pushad + shl eax, 24 + mov cx, 2 + jmp short writehex_common +writehex4: + pushfd + pushad + shl eax, 16 + mov cx, 4 + jmp short writehex_common +writehex8: + pushfd + pushad + mov cx, 8 +writehex_common: +.loop: + rol eax, 4 + push eax + and al, HEX(0F) + cmp al, 10 + jae .high +.low: + add al, '0' + jmp short .ischar +.high: + add al, 'A'-10 +.ischar: + call writechr + pop eax + loop .loop + popad + popfd + ret + +SoftReboot: + mov ax, HEX(40) + mov ds, ax + mov si, HEX(72) + + /* Set the word at location 40:72 to 1234h */ + mov word ptr [si], HEX(1234) + + /* and jump to location FFFF:0 in ROM */ + ljmp16 HEX(0FFFF), HEX(0000) + + +ChainLoadBiosBootSectorCode: + + /* Load segment registers */ + cli + xor ax, ax + mov ds, ax + mov es, ax + mov fs, ax + mov gs, ax + mov ss, ax + mov esp, HEX(7C00) + + /* Jump to the bootsector code */ + ljmp16 HEX(0000), HEX(7C00) diff --git a/boot/freeldr/freeldr/arch/realmode/i386.S b/boot/freeldr/freeldr/arch/realmode/i386.S new file mode 100644 index 00000000000..12c6afc84ee --- /dev/null +++ b/boot/freeldr/freeldr/arch/realmode/i386.S @@ -0,0 +1,209 @@ + +#include +#include "../../include/arch/pc/x86common.h" + +#define IMAGE_DOS_HEADER_e_lfanew 60 +#define IMAGE_FILE_HEADER_SIZE 20 +#define IMAGE_OPTIONAL_HEADER_AddressOfEntryPoint 16 + +.code16 + +/* fat helper code */ +#include "fathelp.inc" + +.org 512 +RealModeEntryPoint: + + cli + + /* Setup segment registers */ + xor ax, ax + mov ds, ax + mov es, ax + mov fs, ax + mov gs, ax + mov ss, ax + + /* Setup the stack */ + mov sp, word ptr ds:[stack16] + + /* Enable A20 address line */ + call EnableA20 + + /* Safe real mode entry point in shared memory */ + mov dword ptr ds:[BSS_RealModeEntry], offset switch_to_real16 + + /* Address the image with es segment */ + mov ax, FREELDR_PE_BASE / 16 + mov es, ax + + /* Get address of optional header */ + mov eax, dword ptr es:[IMAGE_DOS_HEADER_e_lfanew] + add eax, 4 + IMAGE_FILE_HEADER_SIZE + + /* Get address of entry point */ + mov eax, dword ptr es:[eax + IMAGE_OPTIONAL_HEADER_AddressOfEntryPoint] + add eax, FREELDR_PE_BASE + + /* Save entry point */ + mov dword ptr ds:[pm_entrypoint], eax + + /* Restore es */ + xor ax, ax + mov es, ax + + jmp exit_to_protected + + +/* This is the entry point from protected mode */ +switch_to_real16: + + /* Restore segment registers to correct limit */ + mov ax, RMODE_DS + mov ds, ax + mov es, ax + mov fs, ax + mov gs, ax + mov ss, ax + + /* Disable Protected Mode */ + mov eax, cr0 + and eax, CR0_PE_CLR + mov cr0, eax + + /* Clear prefetch queue & correct CS */ + ljmp16 0, inrmode + +inrmode: + /* Set real mode segments */ + xor ax, ax + mov ds, ax + mov es, ax + mov fs, ax + mov gs, ax + mov ss, ax + + /* Clear out the high 16-bits of ESP */ + /* This is needed because I have one */ + /* machine that hangs when booted to dos if */ + /* anything other than 0x0000 is in the high */ + /* 16-bits of ESP. Even though real-mode */ + /* code should only use SP and not ESP. */ + xor esp, esp + + /* Restore real mode stack */ + mov sp, word ptr ds:[stack16] + + /* Load IDTR with real mode value */ +#ifdef _USE_ML + lidt fword ptr rmode_idtptr +#else + lidt rmode_idtptr +#endif + + sti /* These are ok now */ + + /* Do the callback, specified by bx */ + shl bx, 1 + call word ptr ds:callback_table[bx] + + +/* + * Switches the processor to protected mode + * it destroys eax + */ +exit_to_protected: + + cli + + /* Safe current stack pointer */ + mov word ptr ds:[stack16], sp + + /* Load the GDT */ +#ifdef _USE_ML + lgdt fword ptr gdtptr +#else + lgdt gdtptr +#endif + + /* Enable Protected Mode */ + mov eax, cr0 + or eax, CR0_PE_SET + mov cr0, eax + + /* Clear prefetch queue & correct CS */ + ljmp16 PMODE_CS, inpmode +inpmode: + .byte HEX(0ff), HEX(25) // opcode of indirect jump + .word pm_entrypoint, 0 +pm_entrypoint: + .long 0 // receives address of PE entry point + nop + +callback_table: + .word Int386 + .word SoftReboot + .word ChainLoadBiosBootSectorCode + .word PxeCallApi + .word PnpBiosGetDeviceNodeCount + .word PnpBiosGetDeviceNode + .word BootLinuxKernel + + + /* 16-bit stack pointer */ +stack16: + .word STACK16ADDR + + +.align 4 /* force 4-byte alignment */ +gdt: + /* NULL Descriptor */ + .word HEX(0000) + .word HEX(0000) + .word HEX(0000) + .word HEX(0000) + + /* 32-bit flat CS */ + .word HEX(FFFF) + .word HEX(0000) + .word HEX(9A00) + .word HEX(00CF) + + /* 32-bit flat DS */ + .word HEX(FFFF) + .word HEX(0000) + .word HEX(9200) + .word HEX(00CF) + + /* 16-bit real mode CS */ + .word HEX(FFFF) + .word HEX(0000) + .word HEX(9E00) + .word HEX(0000) + + /* 16-bit real mode DS */ + .word HEX(FFFF) + .word HEX(0000) + .word HEX(9200) + .word HEX(0000) + +/* GDT table pointer */ +gdtptr: + .word HEX(27) /* Limit */ + .word gdt, 0 /* Base Address */ + +/* Real-mode IDT pointer */ +rmode_idtptr: + .word HEX(3ff) /* Limit */ + .long 0 /* Base Address */ + +#include "int386.inc" +#include "pxe.inc" +#include "pnp.inc" +#include "linux.inc" +#include "helpers.inc" + +.org (FREELDR_PE_BASE - FREELDR_BASE - 1) +.byte 0 +.endcode16 +END diff --git a/boot/freeldr/freeldr/arch/realmode/int386.inc b/boot/freeldr/freeldr/arch/realmode/int386.inc new file mode 100644 index 00000000000..1fe18fb6062 --- /dev/null +++ b/boot/freeldr/freeldr/arch/realmode/int386.inc @@ -0,0 +1,70 @@ + + +Int386: + /* Save all registers + segment registers */ + push ds + push es + push fs + push gs + pushad + + /* Get the interupt vector and patch the opcode */ + mov al, byte ptr ds:[BSS_IntVector] + mov byte ptr ds:[Int386_vector_opcode], al + + /* Setup the registers */ + mov ax, word ptr cs:[BSS_RegisterSet + REGS_DS] + mov ds, ax + mov ax, word ptr cs:[BSS_RegisterSet + REGS_ES] + mov es, ax + mov ax, word ptr cs:[BSS_RegisterSet + REGS_FS] + mov fs, ax + mov ax, word ptr cs:[BSS_RegisterSet + REGS_GS] + mov gs, ax + + mov eax, dword ptr cs:[BSS_RegisterSet + REGS_EAX] + mov ebx, dword ptr cs:[BSS_RegisterSet + REGS_EBX] + mov ecx, dword ptr cs:[BSS_RegisterSet + REGS_ECX] + mov edx, dword ptr cs:[BSS_RegisterSet + REGS_EDX] + mov esi, dword ptr cs:[BSS_RegisterSet + REGS_ESI] + mov edi, dword ptr cs:[BSS_RegisterSet + REGS_EDI] + + /* Do not set the flags register */ + /* only return its value in regsout */ + + /* Call the interrupt vector */ + /*int Int386_vector*/ + .byte HEX(0cd) +Int386_vector_opcode: + .byte 00 + + /* Save the registers */ + mov dword ptr cs:[BSS_RegisterSet + REGS_EAX], eax + mov dword ptr cs:[BSS_RegisterSet + REGS_EBX], ebx + mov dword ptr cs:[BSS_RegisterSet + REGS_ECX], ecx + mov dword ptr cs:[BSS_RegisterSet + REGS_EDX], edx + mov dword ptr cs:[BSS_RegisterSet + REGS_ESI], esi + mov dword ptr cs:[BSS_RegisterSet + REGS_EDI], edi + + mov ax, ds + mov word ptr cs:[BSS_RegisterSet + REGS_DS], ax + mov ax, es + mov word ptr cs:[BSS_RegisterSet + REGS_ES], ax + mov ax, fs + mov word ptr cs:[BSS_RegisterSet + REGS_FS], ax + mov ax, gs + mov word ptr cs:[BSS_RegisterSet + REGS_GS], ax + + pushfd + pop dword ptr cs:[BSS_RegisterSet + REGS_EFLAGS] + + popad + pop gs + pop fs + pop es + pop ds + + ret + + + diff --git a/boot/freeldr/freeldr/arch/realmode/linux.inc b/boot/freeldr/freeldr/arch/realmode/linux.inc new file mode 100644 index 00000000000..c8fb0e9a4a8 --- /dev/null +++ b/boot/freeldr/freeldr/arch/realmode/linux.inc @@ -0,0 +1,16 @@ + + +BootLinuxKernel: + // dl must be set to the boot drive + + /* Load segment registers */ + cli + mov bx, HEX(9000) + mov ds, bx + mov es, bx + mov fs, bx + mov gs, bx + mov ss, bx + mov sp, HEX(9000) + + ljmp16 HEX(9020), HEX(0000) diff --git a/boot/freeldr/freeldr/arch/realmode/pnp.inc b/boot/freeldr/freeldr/arch/realmode/pnp.inc new file mode 100644 index 00000000000..19d8f30d073 --- /dev/null +++ b/boot/freeldr/freeldr/arch/realmode/pnp.inc @@ -0,0 +1,58 @@ + + +PnpBiosGetDeviceNodeCount: + + mov ax, word ptr ds:[BSS_PnpBiosDataSegment] + push ax + + push cs + mov ax, BSS_PnpNodeSize + push ax + + push cs + mov ax, BSS_PnpNodeCount + push ax + + push 0 + + call dword ptr ds:[BSS_PnpBiosEntryPoint] + add sp, 12 + + movzx ecx, ax + mov dword ptr ds:[BSS_PnpResult], ecx + + ret + + +PnpBiosGetDeviceNode: + + /* push bios segment */ + mov ax, word ptr ds:[BSS_PnpBiosDataSegment] + push ax + + /* push control flag */ + push 1 + + /* push pointer to node buffer (segment/offset) */ + mov ax, word ptr ds:[BSS_PnpBiosBufferSegment] + push ax + mov ax, word ptr ds:[BSS_PnpBiosBufferOffset] + push ax + + /* push pointer to node number (segment/offset) */ + push cs + mov ax, BSS_PnpNodeNumber + push ax + + /* push function number */ + push 1 + + /* call entry point */ + call dword ptr ds:[BSS_PnpBiosEntryPoint] + add sp, 14 + + movzx ecx, ax + mov dword ptr ds:[BSS_PnpResult], ecx + + ret + diff --git a/boot/freeldr/freeldr/arch/realmode/pxe.inc b/boot/freeldr/freeldr/arch/realmode/pxe.inc new file mode 100644 index 00000000000..335604857e5 --- /dev/null +++ b/boot/freeldr/freeldr/arch/realmode/pxe.inc @@ -0,0 +1,33 @@ +/* + * FreeLoader + * Copyright (C) 2011 Herv Poussineau + * + * This 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. + * + * This 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. + * + * You 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. + */ + + +PxeCallApi: + + mov ax, word ptr ds:[BSS_PxeBufferSegment] + push ax + mov ax, word ptr ds:[BSS_PxeBufferOffset] + push ax + mov ax, word ptr ds:[BSS_PxeFunction] + push ax + call dword ptr ds:[BSS_PxeEntryPoint] + add esp, 6 + mov word ptr ds:[BSS_PxeResult], ax + + ret diff --git a/boot/freeldr/freeldr/bootmgr.c b/boot/freeldr/freeldr/bootmgr.c index 3242a3e7329..2acc457a702 100644 --- a/boot/freeldr/freeldr/bootmgr.c +++ b/boot/freeldr/freeldr/bootmgr.c @@ -19,6 +19,11 @@ #include +ARC_DISK_SIGNATURE reactos_arc_disk_info[32]; // ARC Disk Information +unsigned long reactos_disk_count = 0; +char reactos_arc_hardware_data[HW_MAX_ARC_HEAP_SIZE] = {0}; +char reactos_arc_strings[32][256]; + ULONG GetDefaultOperatingSystem(OperatingSystemItem* OperatingSystemList, ULONG OperatingSystemCount) { CHAR DefaultOSText[80]; @@ -140,7 +145,7 @@ VOID RunLoader(VOID) } TimeOut = GetTimeOut(); - if (!UiInitialize(TimeOut)) + if (!UiInitialize(TimeOut != 0)) { UiMessageBoxCritical("Unable to initialize UI."); return; @@ -228,30 +233,19 @@ VOID RunLoader(VOID) #ifndef _M_ARM // Install the drive mapper according to this sections drive mappings -#ifdef __i386__ +#if defined(__i386__) && !defined(_MSC_VER) DriveMapMapDrivesInSection(SectionName); #endif - if (_stricmp(BootType, "ReactOS") == 0) - { - LoadAndBootReactOS(SectionName); - } #ifdef FREELDR_REACTOS_SETUP - else if (_stricmp(BootType, "ReactOSSetup") == 0) - { - // In future we could pass the selected OS details through this - // to have different install methods, etc. - LoadReactOSSetup(); - } -#if defined(__i386__) || defined(__x86_64__) - else if (_stricmp(BootType, "ReactOSSetup2") == 0) + if (_stricmp(BootType, "ReactOSSetup2") == 0) { // WinLdr-style boot LoadReactOSSetup2(); } -#endif + else #endif #ifdef __i386__ - else if (_stricmp(BootType, "Windows") == 0) + if (_stricmp(BootType, "Windows") == 0) { LoadAndBootWindows(SectionName, SettingValue, 0); } diff --git a/boot/freeldr/freeldr/cache/cache.c b/boot/freeldr/freeldr/cache/cache.c index 5f987e0346a..4b21350bbf4 100644 --- a/boot/freeldr/freeldr/cache/cache.c +++ b/boot/freeldr/freeldr/cache/cache.c @@ -32,7 +32,7 @@ ULONG CacheBlockCount = 0; ULONG CacheSizeLimit = 0; ULONG CacheSizeCurrent = 0; -BOOLEAN CacheInitializeDrive(ULONG DriveNumber) +BOOLEAN CacheInitializeDrive(UCHAR DriveNumber) { PCACHE_BLOCK NextCacheBlock; GEOMETRY DriveGeometry; @@ -111,7 +111,7 @@ VOID CacheInvalidateCacheData(VOID) CacheManagerDataInvalid = TRUE; } -BOOLEAN CacheReadDiskSectors(ULONG DiskNumber, ULONG StartSector, ULONG SectorCount, PVOID Buffer) +BOOLEAN CacheReadDiskSectors(UCHAR DiskNumber, ULONGLONG StartSector, ULONG SectorCount, PVOID Buffer) { PCACHE_BLOCK CacheBlock; ULONG StartBlock; @@ -122,7 +122,7 @@ BOOLEAN CacheReadDiskSectors(ULONG DiskNumber, ULONG StartSector, ULONG SectorCo ULONG BlockCount; ULONG Idx; - DPRINTM(DPRINT_CACHE, "CacheReadDiskSectors() DiskNumber: 0x%x StartSector: %d SectorCount: %d Buffer: 0x%x\n", DiskNumber, StartSector, SectorCount, Buffer); + DPRINTM(DPRINT_CACHE, "CacheReadDiskSectors() DiskNumber: 0x%x StartSector: %I64d SectorCount: %d Buffer: 0x%x\n", DiskNumber, StartSector, SectorCount, Buffer); // If we aren't initialized yet then they can't do this if (CacheManagerInitialized == FALSE) @@ -133,11 +133,11 @@ BOOLEAN CacheReadDiskSectors(ULONG DiskNumber, ULONG StartSector, ULONG SectorCo // // Caculate which blocks we must cache // - StartBlock = StartSector / CacheManagerDrive.BlockSize; - SectorOffsetInStartBlock = StartSector % CacheManagerDrive.BlockSize; - CopyLengthInStartBlock = (SectorCount > (CacheManagerDrive.BlockSize - SectorOffsetInStartBlock)) ? (CacheManagerDrive.BlockSize - SectorOffsetInStartBlock) : SectorCount; - EndBlock = (StartSector + (SectorCount - 1)) / CacheManagerDrive.BlockSize; - SectorOffsetInEndBlock = 1 + (StartSector + (SectorCount - 1)) % CacheManagerDrive.BlockSize; + StartBlock = (ULONG)(StartSector / CacheManagerDrive.BlockSize); + SectorOffsetInStartBlock = (ULONG)(StartSector % CacheManagerDrive.BlockSize); + CopyLengthInStartBlock = (ULONG)((SectorCount > (CacheManagerDrive.BlockSize - SectorOffsetInStartBlock)) ? (CacheManagerDrive.BlockSize - SectorOffsetInStartBlock) : SectorCount); + EndBlock = (ULONG)((StartSector + (SectorCount - 1)) / CacheManagerDrive.BlockSize); + SectorOffsetInEndBlock = (ULONG)(1 + (StartSector + (SectorCount - 1)) % CacheManagerDrive.BlockSize); BlockCount = (EndBlock - StartBlock) + 1; DPRINTM(DPRINT_CACHE, "StartBlock: %d SectorOffsetInStartBlock: %d CopyLengthInStartBlock: %d EndBlock: %d SectorOffsetInEndBlock: %d BlockCount: %d\n", StartBlock, SectorOffsetInStartBlock, CopyLengthInStartBlock, EndBlock, SectorOffsetInEndBlock, BlockCount); @@ -243,7 +243,8 @@ BOOLEAN CacheReadDiskSectors(ULONG DiskNumber, ULONG StartSector, ULONG SectorCo return TRUE; } -BOOLEAN CacheForceDiskSectorsIntoCache(ULONG DiskNumber, ULONG StartSector, ULONG SectorCount) +#if 0 +BOOLEAN CacheForceDiskSectorsIntoCache(UCHAR DiskNumber, ULONGLONG StartSector, ULONG SectorCount) { PCACHE_BLOCK CacheBlock; ULONG StartBlock; @@ -288,6 +289,7 @@ BOOLEAN CacheForceDiskSectorsIntoCache(ULONG DiskNumber, ULONG StartSector, ULON return TRUE; } +#endif BOOLEAN CacheReleaseMemory(ULONG MinimumAmountToRelease) { diff --git a/boot/freeldr/freeldr/disk/disk.c b/boot/freeldr/freeldr/disk/disk.c index b7ce3295497..4d1ea90dfcd 100644 --- a/boot/freeldr/freeldr/disk/disk.c +++ b/boot/freeldr/freeldr/disk/disk.c @@ -87,7 +87,7 @@ PCSTR DiskGetErrorCodeString(ULONG ErrorCode) // This function is in arch/i386/i386disk.c //BOOLEAN DiskReadLogicalSectors(ULONG DriveNumber, U64 SectorNumber, ULONG SectorCount, PVOID Buffer) -BOOLEAN DiskIsDriveRemovable(ULONG DriveNumber) +BOOLEAN DiskIsDriveRemovable(UCHAR DriveNumber) { // Hard disks use drive numbers >= 0x80 // So if the drive number indicates a hard disk @@ -111,7 +111,7 @@ DiskGetBootPath(char *BootPath, unsigned Size) PARTITION_TABLE_ENTRY PartitionEntry; MASTER_BOOT_RECORD MasterBootRecord; - if (BootDrive < 0x80) + if (FrldrBootDrive < 0x80) { /* This is a floppy */ @@ -124,41 +124,44 @@ DiskGetBootPath(char *BootPath, unsigned Size) strcat(BootPath, "fdisk"); - _itoa(BootDrive, Device, 10); + _itoa(FrldrBootDrive, Device, 10); strcat(BootPath, "("); strcat(BootPath, Device); strcat(BootPath, ")"); } /* FIXME */ - else if (DiskReadBootRecord(BootDrive, 0, &MasterBootRecord)) + else if (DiskReadBootRecord(FrldrBootDrive, 0, &MasterBootRecord)) { - /* This is a hard disk */ + ULONG BootPartition; - if (!DiskGetActivePartitionEntry(BootDrive, &PartitionEntry, &BootPartition)) + /* This is a hard disk */ + if (!DiskGetActivePartitionEntry(FrldrBootDrive, &PartitionEntry, &BootPartition)) { DbgPrint("Invalid active partition information\n"); return FALSE; } - if (Size <= sizeof(Path) + 18 + strlen(Device) + strlen(Partition)) - { - return FALSE; - } + FrldrBootPartition = BootPartition; + + if (Size <= sizeof(Path) + 18 + strlen(Device) + strlen(Partition)) + { + return FALSE; + } strcpy(BootPath, Path); strcat(BootPath, "rdisk"); - _itoa(BootDrive - 0x80, Device, 10); + _itoa(FrldrBootDrive - 0x80, Device, 10); strcat(BootPath, "("); strcat(BootPath, Device); strcat(BootPath, ")"); - _itoa(BootPartition, Partition, 10); + _itoa(FrldrBootPartition, Partition, 10); strcat(BootPath, "partition("); strcat(BootPath, Partition); strcat(BootPath, ")"); - } + } else { /* This is a CD-ROM drive */ @@ -172,7 +175,7 @@ DiskGetBootPath(char *BootPath, unsigned Size) strcat(BootPath, "cdrom"); - _itoa(BootDrive - 0x80, Device, 10); + _itoa(FrldrBootDrive - 0x80, Device, 10); strcat(BootPath, "("); strcat(BootPath, Device); strcat(BootPath, ")"); @@ -185,6 +188,6 @@ DiskGetBootPath(char *BootPath, unsigned Size) //VOID DiskStopFloppyMotor(VOID) // This function is in arch/i386/i386disk.c -//ULONG DiskGetCacheableBlockCount(ULONG DriveNumber) +//ULONG DiskGetCacheableBlockCount(UCHAR DriveNumber) #endif diff --git a/boot/freeldr/freeldr/disk/partition.c b/boot/freeldr/freeldr/disk/partition.c index b93b2e17b2a..1941da3361a 100644 --- a/boot/freeldr/freeldr/disk/partition.c +++ b/boot/freeldr/freeldr/disk/partition.c @@ -21,7 +21,7 @@ #include #include -BOOLEAN DiskGetActivePartitionEntry(ULONG DriveNumber, +BOOLEAN DiskGetActivePartitionEntry(UCHAR DriveNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry, ULONG *ActivePartition) { @@ -77,7 +77,7 @@ BOOLEAN DiskGetActivePartitionEntry(ULONG DriveNumber, return TRUE; } -BOOLEAN DiskGetPartitionEntry(ULONG DriveNumber, ULONG PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry) +BOOLEAN DiskGetPartitionEntry(UCHAR DriveNumber, ULONG PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry) { MASTER_BOOT_RECORD MasterBootRecord; PARTITION_TABLE_ENTRY ExtendedPartitionTableEntry; @@ -195,7 +195,7 @@ BOOLEAN DiskGetFirstExtendedPartitionEntry(PMASTER_BOOT_RECORD MasterBootRecord, return FALSE; } -BOOLEAN DiskReadBootRecord(ULONG DriveNumber, ULONGLONG LogicalSectorNumber, PMASTER_BOOT_RECORD BootRecord) +BOOLEAN DiskReadBootRecord(UCHAR DriveNumber, ULONGLONG LogicalSectorNumber, PMASTER_BOOT_RECORD BootRecord) { ULONG Index; diff --git a/boot/freeldr/freeldr/disk/scsiport.c b/boot/freeldr/freeldr/disk/scsiport.c index 254760ff24a..0db46a2ad29 100644 --- a/boot/freeldr/freeldr/disk/scsiport.c +++ b/boot/freeldr/freeldr/disk/scsiport.c @@ -11,6 +11,33 @@ #include #include +#undef ScsiPortLogError +#undef ScsiPortMoveMemory +#undef ScsiPortWritePortBufferUchar +#undef ScsiPortWritePortBufferUlong +#undef ScsiPortWritePortBufferUshort +#undef ScsiPortWritePortUchar +#undef ScsiPortWritePortUlong +#undef ScsiPortWritePortUshort +#undef ScsiPortWriteRegisterBufferUchar +#undef ScsiPortWriteRegisterBufferUlong +#undef ScsiPortWriteRegisterBufferUshort +#undef ScsiPortWriteRegisterUchar +#undef ScsiPortWriteRegisterUlong +#undef ScsiPortWriteRegisterUshort +#undef ScsiPortReadPortBufferUchar +#undef ScsiPortReadPortBufferUlong +#undef ScsiPortReadPortBufferUshort +#undef ScsiPortReadPortUchar +#undef ScsiPortReadPortUlong +#undef ScsiPortReadPortUshort +#undef ScsiPortReadRegisterBufferUchar +#undef ScsiPortReadRegisterBufferUlong +#undef ScsiPortReadRegisterBufferUshort +#undef ScsiPortReadRegisterUchar +#undef ScsiPortReadRegisterUlong +#undef ScsiPortReadRegisterUshort + #define NDEBUG #include @@ -110,9 +137,9 @@ typedef struct tagDISKCONTEXT { /* Device ID */ PSCSI_PORT_DEVICE_EXTENSION DeviceExtension; - ULONG PathId; - ULONG TargetId; - ULONG Lun; + UCHAR PathId; + UCHAR TargetId; + UCHAR Lun; /* Device characteristics */ ULONG SectorSize; @@ -135,7 +162,7 @@ static LONG DiskGetFileInformation(ULONG FileId, FILEINFORMATION* Information) RtlZeroMemory(Information, sizeof(FILEINFORMATION)); Information->EndingAddress.QuadPart = Context->SectorCount * Context->SectorSize; - Information->CurrentAddress.LowPart = Context->SectorNumber * Context->SectorSize; + Information->CurrentAddress.QuadPart = Context->SectorNumber * Context->SectorSize; return ESUCCESS; } @@ -168,9 +195,9 @@ static LONG DiskOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId) RtlZeroMemory(Srb, sizeof(SCSI_REQUEST_BLOCK)); Srb->Length = sizeof(SCSI_REQUEST_BLOCK); Srb->Function = SRB_FUNCTION_EXECUTE_SCSI; - Srb->PathId = PathId; - Srb->TargetId = TargetId; - Srb->Lun = Lun; + Srb->PathId = (UCHAR)PathId; + Srb->TargetId = (UCHAR)TargetId; + Srb->Lun = (UCHAR)Lun; Srb->CdbLength = 10; Srb->SrbFlags = SRB_FLAGS_DATA_IN; Srb->DataTransferLength = sizeof(READ_CAPACITY_DATA); @@ -198,9 +225,9 @@ static LONG DiskOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId) if (!Context) return ENOMEM; Context->DeviceExtension = DeviceExtension; - Context->PathId = PathId; - Context->TargetId = TargetId; - Context->Lun = Lun; + Context->PathId = (UCHAR)PathId; + Context->TargetId = (UCHAR)TargetId; + Context->Lun = (UCHAR)Lun; Context->SectorSize = SectorSize; Context->SectorOffset = SectorOffset; Context->SectorCount = SectorCount; @@ -231,7 +258,8 @@ static LONG DiskRead(ULONG FileId, VOID* Buffer, ULONG N, ULONG* Count) return EINVAL; /* Read full sectors */ - Lba = Context->SectorNumber; + ASSERT(Context->SectorNumber < 0xFFFFFFFF); + Lba = (ULONG)Context->SectorNumber; if (FullSectors > 0) { Srb = ExAllocatePool(PagedPool, sizeof(SCSI_REQUEST_BLOCK)); @@ -783,14 +811,14 @@ VOID SpiScanAdapter( IN PSCSI_PORT_DEVICE_EXTENSION DeviceExtension, IN ULONG ScsiBus, - IN ULONG PathId) + IN UCHAR PathId) { CHAR ArcName[64]; PSCSI_REQUEST_BLOCK Srb; PCDB Cdb; INQUIRYDATA InquiryBuffer; - ULONG TargetId; - ULONG Lun; + UCHAR TargetId; + UCHAR Lun; if (!DeviceExtension->HwResetBus(DeviceExtension->MiniPortDeviceExtension, PathId)) { @@ -825,7 +853,7 @@ SpiScanAdapter( Cdb = (PCDB)Srb->Cdb; Cdb->CDB6INQUIRY.OperationCode = SCSIOP_INQUIRY; Cdb->CDB6INQUIRY.LogicalUnitNumber = Srb->Lun; - Cdb->CDB6INQUIRY.AllocationLength = Srb->DataTransferLength; + Cdb->CDB6INQUIRY.AllocationLength = (UCHAR)Srb->DataTransferLength; if (!SpiSendSynchronousSrb(DeviceExtension, Srb)) { /* Don't check next LUNs */ @@ -835,13 +863,13 @@ SpiScanAdapter( /* Device exists, create its ARC name */ if (InquiryBuffer.RemovableMedia) { - sprintf(ArcName, "scsi(%ld)cdrom(%ld)fdisk(%ld)", + sprintf(ArcName, "scsi(%ld)cdrom(%d)fdisk(%d)", ScsiBus, TargetId, Lun); FsRegisterDevice(ArcName, &DiskVtbl); } else { - sprintf(ArcName, "scsi(%ld)disk(%ld)rdisk(%ld)", + sprintf(ArcName, "scsi(%ld)disk(%d)rdisk(%d)", ScsiBus, TargetId, Lun); /* Now, check if it has partitions */ SpiScanDevice(DeviceExtension, ArcName, PathId, TargetId, Lun); @@ -1047,6 +1075,7 @@ ScsiPortInitialize( BOOLEAN Again; BOOLEAN FirstConfigCall = TRUE; PCI_SLOT_NUMBER SlotNumber; + UCHAR ScsiBus; NTSTATUS Status; if (HwInitializationData->HwInitializationDataSize != sizeof(HW_INITIALIZATION_DATA)) @@ -1169,13 +1198,10 @@ ScsiPortInitialize( } /* Scan bus */ + for (ScsiBus = 0; ScsiBus < PortConfig.NumberOfBuses; ScsiBus++) { - ULONG ScsiBus; - for (ScsiBus = 0; ScsiBus < PortConfig.NumberOfBuses; ScsiBus++) - { - SpiScanAdapter(DeviceExtension, PortConfig.SystemIoBusNumber, ScsiBus); - PortConfig.SystemIoBusNumber++; - } + SpiScanAdapter(DeviceExtension, PortConfig.SystemIoBusNumber, ScsiBus); + PortConfig.SystemIoBusNumber++; } FirstConfigCall = FALSE; @@ -1513,7 +1539,7 @@ VOID NTAPI ScsiPortWriteRegisterUchar( IN PUCHAR Register, - IN ULONG Value) + IN UCHAR Value) { WRITE_REGISTER_UCHAR(Register, Value); } @@ -1606,7 +1632,7 @@ LoadBootDeviceDriver(VOID) CHAR NtBootDdPath[MAX_PATH]; PVOID ImageBase; ULONG (NTAPI *EntryPoint)(IN PVOID DriverObject, IN PVOID RegistryPath); - ULONG i; + USHORT i; BOOLEAN Status; /* Some initialization of our temporary loader block */ @@ -1683,7 +1709,7 @@ LoadBootDeviceDriver(VOID) NtHeaders = RtlImageNtHeader(VaToPa(BootDdDTE->DllBase)); if (!NtHeaders) return EIO; - Status = LdrRelocateImageWithBias( + Status = (BOOLEAN)LdrRelocateImageWithBias( VaToPa(BootDdDTE->DllBase), NtHeaders->OptionalHeader.ImageBase - (ULONG_PTR)BootDdDTE->DllBase, "FreeLdr", diff --git a/boot/freeldr/freeldr/freeldr.c b/boot/freeldr/freeldr/freeldr.c index 98af295c4c7..9ad6bd1c34a 100644 --- a/boot/freeldr/freeldr/freeldr.c +++ b/boot/freeldr/freeldr/freeldr.c @@ -54,26 +54,15 @@ VOID BootMain(LPSTR CmdLine) RunLoader(); } -#ifdef _MSC_VER -long _ftol2(double f) -{ - return _ftol(f); -} -long _ftol2_sse(double f) -{ - return _ftol(f); -} -#endif - // We need to emulate these, because the original ones don't work in freeldr int __cdecl wctomb(char *mbchar, wchar_t wchar) { - *mbchar = wchar; + *mbchar = (char)wchar; return 1; } int __cdecl mbtowc (wchar_t *wchar, const char *mbchar, size_t count) { - *wchar = *mbchar; + *wchar = (wchar_t)*mbchar; return 1; } diff --git a/boot/freeldr/freeldr/freeldr_arch.rbuild b/boot/freeldr/freeldr/freeldr_arch.rbuild index 6d965bf36db..1a7bc730661 100644 --- a/boot/freeldr/freeldr/freeldr_arch.rbuild +++ b/boot/freeldr/freeldr/freeldr_arch.rbuild @@ -12,7 +12,6 @@ - _alloca.S archmach.c custom.c drivemap.c @@ -25,7 +24,6 @@ i386disk.c i386rtl.c i386vid.c - loader.c machpc.c miscboot.c ntoskrnl.c diff --git a/boot/freeldr/freeldr/freeldr_base.rbuild b/boot/freeldr/freeldr/freeldr_base.rbuild index 5d391f65d21..78131dbd92c 100644 --- a/boot/freeldr/freeldr/freeldr_base.rbuild +++ b/boot/freeldr/freeldr/freeldr_base.rbuild @@ -49,8 +49,6 @@ arcname.c archwsup.c binhive.c - reactos.c - imageldr.c bget.c diff --git a/boot/freeldr/freeldr/freeldr_i386.lnk b/boot/freeldr/freeldr/freeldr_i386.lnk index 48b7b5d9ec5..41a6da04766 100644 --- a/boot/freeldr/freeldr/freeldr_i386.lnk +++ b/boot/freeldr/freeldr/freeldr_i386.lnk @@ -32,17 +32,18 @@ SECTIONS *(.data) *(.data2) *(SORT(.data$*)) + *(.rdata) + *(SORT(.rdata$*)) + *(.eh_frame) __data_end__ = . ; __bss_start__ = . ; *(.bss) *(COMMON) __bss_end__ = . ; } - .rdata BLOCK(__section_alignment__) : + /DISCARD/ : { - *(.rdata) - *(SORT(.rdata$*)) - *(.eh_frame) + *(.drectve) } .stab BLOCK(__section_alignment__) (NOLOAD) : { diff --git a/boot/freeldr/freeldr/fs/ext2.c b/boot/freeldr/freeldr/fs/ext2.c index 46f12fbe6d4..00d07641bc4 100644 --- a/boot/freeldr/freeldr/fs/ext2.c +++ b/boot/freeldr/freeldr/fs/ext2.c @@ -25,7 +25,7 @@ BOOLEAN Ext2OpenVolume(UCHAR DriveNumber, ULONGLONG VolumeStartSector, ULONGLONG PEXT2_FILE_INFO Ext2OpenFile(PCSTR FileName); BOOLEAN Ext2LookupFile(PCSTR FileName, PEXT2_FILE_INFO Ext2FileInfoPointer); BOOLEAN Ext2SearchDirectoryBufferForFile(PVOID DirectoryBuffer, ULONG DirectorySize, PCHAR FileName, PEXT2_DIR_ENTRY DirectoryEntry); -BOOLEAN Ext2ReadVolumeSectors(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONGLONG SectorCount, PVOID Buffer); +BOOLEAN Ext2ReadVolumeSectors(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer); BOOLEAN Ext2ReadFileBig(PEXT2_FILE_INFO Ext2FileInfo, ULONGLONG BytesToRead, ULONGLONG* BytesRead, PVOID Buffer); BOOLEAN Ext2ReadSuperBlock(VOID); @@ -61,7 +61,7 @@ ULONG Ext2GroupCount = 0; // Number of groups in this file system ULONG Ext2InodesPerBlock = 0; // Number of inodes in one block ULONG Ext2GroupDescPerBlock = 0; // Number of group descriptors in one block -BOOLEAN DiskGetBootVolume(PULONG DriveNumber, PULONGLONG StartSector, PULONGLONG SectorCount, int *FsType) +BOOLEAN DiskGetBootVolume(PUCHAR DriveNumber, PULONGLONG StartSector, PULONGLONG SectorCount, int *FsType) { *DriveNumber = 0; *StartSector = 0; @@ -425,7 +425,7 @@ BOOLEAN Ext2ReadFileBig(PEXT2_FILE_INFO Ext2FileInfo, ULONGLONG BytesToRead, ULO DPRINTM(DPRINT_FILESYSTEM, "Reading fast symbolic link data\n"); // Copy the data from the link - RtlCopyMemory(Buffer, (PVOID)((ULONG_PTR)Ext2FileInfo->FilePointer + Ext2FileInfo->Inode.symlink), BytesToRead); + RtlCopyMemory(Buffer, (PVOID)((ULONG_PTR)Ext2FileInfo->FilePointer + Ext2FileInfo->Inode.symlink), (ULONG)BytesToRead); if (BytesRead != NULL) { @@ -472,10 +472,10 @@ BOOLEAN Ext2ReadFileBig(PEXT2_FILE_INFO Ext2FileInfo, ULONGLONG BytesToRead, ULO // // Do the math for our first read // - BlockNumberIndex = (Ext2FileInfo->FilePointer / Ext2BlockSizeInBytes); + BlockNumberIndex = (ULONG)(Ext2FileInfo->FilePointer / Ext2BlockSizeInBytes); BlockNumber = Ext2FileInfo->FileBlockList[BlockNumberIndex]; OffsetInBlock = (Ext2FileInfo->FilePointer % Ext2BlockSizeInBytes); - LengthInBlock = (BytesToRead > (Ext2BlockSizeInBytes - OffsetInBlock)) ? (Ext2BlockSizeInBytes - OffsetInBlock) : BytesToRead; + LengthInBlock = (ULONG)((BytesToRead > (Ext2BlockSizeInBytes - OffsetInBlock)) ? (Ext2BlockSizeInBytes - OffsetInBlock) : BytesToRead); // // Now do the read and update BytesRead, BytesToRead, FilePointer, & Buffer @@ -501,11 +501,11 @@ BOOLEAN Ext2ReadFileBig(PEXT2_FILE_INFO Ext2FileInfo, ULONGLONG BytesToRead, ULO // // Determine how many full clusters we need to read // - NumberOfBlocks = (BytesToRead / Ext2BlockSizeInBytes); + NumberOfBlocks = (ULONG)(BytesToRead / Ext2BlockSizeInBytes); while (NumberOfBlocks > 0) { - BlockNumberIndex = (Ext2FileInfo->FilePointer / Ext2BlockSizeInBytes); + BlockNumberIndex = (ULONG)(Ext2FileInfo->FilePointer / Ext2BlockSizeInBytes); BlockNumber = Ext2FileInfo->FileBlockList[BlockNumberIndex]; // @@ -531,13 +531,13 @@ BOOLEAN Ext2ReadFileBig(PEXT2_FILE_INFO Ext2FileInfo, ULONGLONG BytesToRead, ULO // if (BytesToRead > 0) { - BlockNumberIndex = (Ext2FileInfo->FilePointer / Ext2BlockSizeInBytes); + BlockNumberIndex = (ULONG)(Ext2FileInfo->FilePointer / Ext2BlockSizeInBytes); BlockNumber = Ext2FileInfo->FileBlockList[BlockNumberIndex]; // // Now do the read and update BytesRead, BytesToRead, FilePointer, & Buffer // - if (!Ext2ReadPartialBlock(BlockNumber, 0, BytesToRead, Buffer)) + if (!Ext2ReadPartialBlock(BlockNumber, 0, (ULONG)BytesToRead, Buffer)) { return FALSE; } @@ -553,7 +553,7 @@ BOOLEAN Ext2ReadFileBig(PEXT2_FILE_INFO Ext2FileInfo, ULONGLONG BytesToRead, ULO return TRUE; } -BOOLEAN Ext2ReadVolumeSectors(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONGLONG SectorCount, PVOID Buffer) +BOOLEAN Ext2ReadVolumeSectors(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer) { //GEOMETRY DiskGeometry; //BOOLEAN ReturnValue; @@ -796,7 +796,8 @@ BOOLEAN Ext2ReadDirectory(ULONG Inode, PVOID* DirectoryBuffer, PEXT2_INODE Inode // // Now allocate the memory to hold the group descriptors // - *DirectoryBuffer = (PEXT2_DIR_ENTRY)MmHeapAlloc(DirectoryFileInfo.FileSize); + ASSERT(DirectoryFileInfo.FileSize <= 0xFFFFFFFF); + *DirectoryBuffer = (PEXT2_DIR_ENTRY)MmHeapAlloc((ULONG)DirectoryFileInfo.FileSize); // // Make sure we got the memory @@ -1009,7 +1010,7 @@ ULONG* Ext2ReadBlockPointerList(PEXT2_INODE Inode) //BlockCount = Inode->i_blocks; FileSize = Ext2GetInodeFileSize(Inode); FileSize = ROUND_UP(FileSize, Ext2BlockSizeInBytes); - BlockCount = (FileSize / Ext2BlockSizeInBytes); + BlockCount = (ULONG)(FileSize / Ext2BlockSizeInBytes); // Allocate the memory for the block list BlockList = MmHeapAlloc(BlockCount * sizeof(ULONG)); @@ -1181,8 +1182,8 @@ LONG Ext2GetFileInformation(ULONG FileId, FILEINFORMATION* Information) PEXT2_FILE_INFO FileHandle = FsGetDeviceSpecific(FileId); RtlZeroMemory(Information, sizeof(FILEINFORMATION)); - Information->EndingAddress.LowPart = FileHandle->FileSize; - Information->CurrentAddress.LowPart = FileHandle->FilePointer; + Information->EndingAddress.QuadPart = FileHandle->FileSize; + Information->CurrentAddress.QuadPart = FileHandle->FilePointer; DPRINTM(DPRINT_FILESYSTEM, "Ext2GetFileInformation() FileSize = %d\n", Information->EndingAddress.LowPart); @@ -1195,12 +1196,12 @@ LONG Ext2GetFileInformation(ULONG FileId, FILEINFORMATION* Information) LONG Ext2Open(CHAR* Path, OPENMODE OpenMode, ULONG* FileId) { PEXT2_FILE_INFO FileHandle; - ULONG DeviceId; + //ULONG DeviceId; if (OpenMode != OpenReadOnly) return EACCES; - DeviceId = FsGetDeviceId(*FileId); + //DeviceId = FsGetDeviceId(*FileId); DPRINTM(DPRINT_FILESYSTEM, "Ext2Open() FileName = %s\n", Path); @@ -1297,7 +1298,7 @@ const DEVVTBL* Ext2Mount(ULONG DeviceId) // // Compatibility hack as long as FS is not using underlying device DeviceId // - ULONG DriveNumber; + UCHAR DriveNumber; ULONGLONG StartSector; ULONGLONG SectorCount; int Type; diff --git a/boot/freeldr/freeldr/fs/fat.c b/boot/freeldr/freeldr/fs/fat.c index a97cdcb7318..53e3beb8568 100644 --- a/boot/freeldr/freeldr/fs/fat.c +++ b/boot/freeldr/freeldr/fs/fat.c @@ -23,7 +23,7 @@ #define NDEBUG #include -ULONG FatDetermineFatType(PFAT_BOOTSECTOR FatBootSector, ULONG PartitionSectorCount); +ULONG FatDetermineFatType(PFAT_BOOTSECTOR FatBootSector, ULONGLONG PartitionSectorCount); PVOID FatBufferDirectory(PFAT_VOLUME_INFO Volume, ULONG DirectoryStartCluster, ULONG* EntryCountPointer, BOOLEAN RootDirectory); BOOLEAN FatSearchDirectoryBufferForFile(PFAT_VOLUME_INFO Volume, PVOID DirectoryBuffer, ULONG EntryCount, PCHAR FileName, PFAT_FILE_INFO FatFileInfoPointer); LONG FatLookupFile(PFAT_VOLUME_INFO Volume, PCSTR FileName, ULONG DeviceId, PFAT_FILE_INFO FatFileInfoPointer); @@ -263,8 +263,8 @@ BOOLEAN FatOpenVolume(PFAT_VOLUME_INFO Volume, PFAT_BOOTSECTOR BootSector, ULONG Volume->FatSectorStart = (4096 / Volume->BytesPerSector); Volume->ActiveFatSectorStart = Volume->FatSectorStart; Volume->NumberOfFats = 1; - FatSize = PartitionSectorCount / Volume->SectorsPerCluster * - (Volume->FatType == FATX16 ? 2 : 4); + FatSize = (ULONG)(PartitionSectorCount / Volume->SectorsPerCluster * + (Volume->FatType == FATX16 ? 2 : 4)); Volume->SectorsPerFat = (((FatSize + 4095) / 4096) * 4096) / Volume->BytesPerSector; Volume->RootDirSectorStart = Volume->FatSectorStart + Volume->NumberOfFats * Volume->SectorsPerFat; @@ -313,7 +313,7 @@ BOOLEAN FatOpenVolume(PFAT_VOLUME_INFO Volume, PFAT_BOOTSECTOR BootSector, ULONG return TRUE; } -ULONG FatDetermineFatType(PFAT_BOOTSECTOR FatBootSector, ULONG PartitionSectorCount) +ULONG FatDetermineFatType(PFAT_BOOTSECTOR FatBootSector, ULONGLONG PartitionSectorCount) { ULONG RootDirSectors; ULONG DataSectorCount; @@ -325,7 +325,7 @@ ULONG FatDetermineFatType(PFAT_BOOTSECTOR FatBootSector, ULONG PartitionSectorCo if (0 == strncmp(FatXBootSector->FileSystemType, "FATX", 4)) { - CountOfClusters = PartitionSectorCount / FatXBootSector->SectorsPerCluster; + CountOfClusters = (ULONG)(PartitionSectorCount / FatXBootSector->SectorsPerCluster); if (CountOfClusters < 65525) { /* Volume is FATX16 */ diff --git a/boot/freeldr/freeldr/fs/ntfs.c b/boot/freeldr/freeldr/fs/ntfs.c index aff3bfaa339..7140b851ca9 100644 --- a/boot/freeldr/freeldr/fs/ntfs.c +++ b/boot/freeldr/freeldr/fs/ntfs.c @@ -134,7 +134,7 @@ static BOOLEAN NtfsDiskRead(PNTFS_VOLUME_INFO Volume, ULONGLONG Offset, ULONGLON { LARGE_INTEGER Position; ULONG Count; - USHORT ReadLength; + ULONG ReadLength; LONG ret; DPRINTM(DPRINT_FILESYSTEM, "NtfsDiskRead - Offset: %I64d Length: %I64d\n", Offset, Length); @@ -144,15 +144,14 @@ static BOOLEAN NtfsDiskRead(PNTFS_VOLUME_INFO Volume, ULONGLONG Offset, ULONGLON // if (Offset % Volume->BootSector.BytesPerSector) { - Position.HighPart = 0; - Position.LowPart = Offset & ~(Volume->BootSector.BytesPerSector - 1); + Position.QuadPart = Offset & ~(Volume->BootSector.BytesPerSector - 1); ret = ArcSeek(Volume->DeviceId, &Position, SeekAbsolute); if (ret != ESUCCESS) return FALSE; ret = ArcRead(Volume->DeviceId, Volume->TemporarySector, Volume->BootSector.BytesPerSector, &Count); if (ret != ESUCCESS || Count != Volume->BootSector.BytesPerSector) return FALSE; - ReadLength = min(Length, Volume->BootSector.BytesPerSector - (Offset % Volume->BootSector.BytesPerSector)); + ReadLength = (USHORT)min(Length, Volume->BootSector.BytesPerSector - (Offset % Volume->BootSector.BytesPerSector)); // // Copy interesting data @@ -174,8 +173,7 @@ static BOOLEAN NtfsDiskRead(PNTFS_VOLUME_INFO Volume, ULONGLONG Offset, ULONGLON // if (Length >= Volume->BootSector.BytesPerSector) { - Position.HighPart = 0; - Position.LowPart = Offset; + Position.QuadPart = Offset; ret = ArcSeek(Volume->DeviceId, &Position, SeekAbsolute); if (ret != ESUCCESS) return FALSE; @@ -197,12 +195,11 @@ static BOOLEAN NtfsDiskRead(PNTFS_VOLUME_INFO Volume, ULONGLONG Offset, ULONGLON // if (Length) { - Position.HighPart = 0; - Position.LowPart = Offset; + Position.QuadPart = Offset; ret = ArcSeek(Volume->DeviceId, &Position, SeekAbsolute); if (ret != ESUCCESS) return FALSE; - ret = ArcRead(Volume->DeviceId, Buffer, Length, &Count); + ret = ArcRead(Volume->DeviceId, Buffer, (ULONG)Length, &Count); if (ret != ESUCCESS || Count != Length) return FALSE; } @@ -210,7 +207,7 @@ static BOOLEAN NtfsDiskRead(PNTFS_VOLUME_INFO Volume, ULONGLONG Offset, ULONGLON return TRUE; } -static ULONGLONG NtfsReadAttribute(PNTFS_VOLUME_INFO Volume, PNTFS_ATTR_CONTEXT Context, ULONGLONG Offset, PCHAR Buffer, ULONGLONG Length) +static ULONG NtfsReadAttribute(PNTFS_VOLUME_INFO Volume, PNTFS_ATTR_CONTEXT Context, ULONGLONG Offset, PCHAR Buffer, ULONG Length) { ULONGLONG LastLCN; PUCHAR DataRun; @@ -218,15 +215,15 @@ static ULONGLONG NtfsReadAttribute(PNTFS_VOLUME_INFO Volume, PNTFS_ATTR_CONTEXT ULONGLONG DataRunLength; LONGLONG DataRunStartLCN; ULONGLONG CurrentOffset; - ULONGLONG ReadLength; - ULONGLONG AlreadyRead; + ULONG ReadLength; + ULONG AlreadyRead; if (!Context->Record.IsNonResident) { if (Offset > Context->Record.Resident.ValueLength) return 0; if (Offset + Length > Context->Record.Resident.ValueLength) - Length = Context->Record.Resident.ValueLength - Offset; + Length = (ULONG)(Context->Record.Resident.ValueLength - Offset); RtlCopyMemory(Buffer, (PCHAR)&Context->Record + Context->Record.Resident.ValueOffset + Offset, Length); return Length; } @@ -291,7 +288,7 @@ static ULONGLONG NtfsReadAttribute(PNTFS_VOLUME_INFO Volume, PNTFS_ATTR_CONTEXT * II. Go through the run list and read the data */ - ReadLength = min(DataRunLength * Volume->ClusterSize - (Offset - CurrentOffset), Length); + ReadLength = (ULONG)min(DataRunLength * Volume->ClusterSize - (Offset - CurrentOffset), Length); if (DataRunStartLCN == -1) RtlZeroMemory(Buffer, ReadLength); if (NtfsDiskRead(Volume, DataRunStartLCN * Volume->ClusterSize + Offset - CurrentOffset, ReadLength, Buffer)) @@ -318,7 +315,7 @@ static ULONGLONG NtfsReadAttribute(PNTFS_VOLUME_INFO Volume, PNTFS_ATTR_CONTEXT while (Length > 0) { - ReadLength = min(DataRunLength * Volume->ClusterSize, Length); + ReadLength = (ULONG)min(DataRunLength * Volume->ClusterSize, Length); if (DataRunStartLCN == -1) RtlZeroMemory(Buffer, ReadLength); else if (!NtfsDiskRead(Volume, DataRunStartLCN * Volume->ClusterSize, ReadLength, Buffer)) @@ -384,12 +381,21 @@ static PNTFS_ATTR_CONTEXT NtfsFindAttributeHelper(PNTFS_VOLUME_INFO Volume, PNTF ListContext = NtfsPrepareAttributeContext(AttrRecord); ListSize = NtfsGetAttributeSize(&ListContext->Record); - ListBuffer = MmHeapAlloc(ListSize); + if(ListSize <= 0xFFFFFFFF) + ListBuffer = MmHeapAlloc((ULONG)ListSize); + else + ListBuffer = NULL; + + if(!ListBuffer) + { + DPRINTM(DPRINT_FILESYSTEM, "Failed to allocate memory: %x\n", (ULONG)ListSize); + continue; + } ListAttrRecord = (PNTFS_ATTR_RECORD)ListBuffer; ListAttrRecordEnd = (PNTFS_ATTR_RECORD)((PCHAR)ListBuffer + ListSize); - if (NtfsReadAttribute(Volume, ListContext, 0, ListBuffer, ListSize) == ListSize) + if (NtfsReadAttribute(Volume, ListContext, 0, ListBuffer, (ULONG)ListSize) == ListSize) { Context = NtfsFindAttributeHelper(Volume, ListAttrRecord, ListAttrRecordEnd, Type, Name, NameLength); @@ -463,7 +469,7 @@ static BOOLEAN NtfsFixupRecord(PNTFS_VOLUME_INFO Volume, PNTFS_RECORD Record) return TRUE; } -static BOOLEAN NtfsReadMftRecord(PNTFS_VOLUME_INFO Volume, ULONG MFTIndex, PNTFS_MFT_RECORD Buffer) +static BOOLEAN NtfsReadMftRecord(PNTFS_VOLUME_INFO Volume, ULONGLONG MFTIndex, PNTFS_MFT_RECORD Buffer) { ULONGLONG BytesRead; @@ -484,10 +490,10 @@ VOID NtfsPrintFile(PNTFS_INDEX_ENTRY IndexEntry) UCHAR i; FileName = IndexEntry->FileName.FileName; - FileNameLength = IndexEntry->FileName.FileNameLength; + FileNameLength = min(IndexEntry->FileName.FileNameLength, 255); for (i = 0; i < FileNameLength; i++) - AnsiFileName[i] = FileName[i]; + AnsiFileName[i] = (CHAR)FileName[i]; AnsiFileName[i] = 0; DPRINTM(DPRINT_FILESYSTEM, "- %s (%x)\n", AnsiFileName, IndexEntry->Data.Directory.IndexedFile); @@ -527,10 +533,10 @@ static BOOLEAN NtfsCompareFileName(PCHAR FileName, PNTFS_INDEX_ENTRY IndexEntry) return TRUE; } -static BOOLEAN NtfsFindMftRecord(PNTFS_VOLUME_INFO Volume, ULONG MFTIndex, PCHAR FileName, ULONG *OutMFTIndex) +static BOOLEAN NtfsFindMftRecord(PNTFS_VOLUME_INFO Volume, ULONGLONG MFTIndex, PCHAR FileName, ULONGLONG *OutMFTIndex) { PNTFS_MFT_RECORD MftRecord; - ULONG Magic; + //ULONG Magic; PNTFS_ATTR_CONTEXT IndexRootCtx; PNTFS_ATTR_CONTEXT IndexBitmapCtx; PNTFS_ATTR_CONTEXT IndexAllocationCtx; @@ -551,7 +557,7 @@ static BOOLEAN NtfsFindMftRecord(PNTFS_VOLUME_INFO Volume, ULONG MFTIndex, PCHAR if (NtfsReadMftRecord(Volume, MFTIndex, MftRecord)) { - Magic = MftRecord->Magic; + //Magic = MftRecord->Magic; IndexRootCtx = NtfsFindAttribute(Volume, MftRecord, NTFS_ATTR_TYPE_INDEX_ROOT, L"$I30"); if (IndexRootCtx == NULL) @@ -603,15 +609,19 @@ static BOOLEAN NtfsFindMftRecord(PNTFS_VOLUME_INFO Volume, ULONG MFTIndex, PCHAR return FALSE; } BitmapDataSize = NtfsGetAttributeSize(&IndexBitmapCtx->Record); - DPRINTM(DPRINT_FILESYSTEM, "BitmapDataSize: %x\n", BitmapDataSize); - BitmapData = MmHeapAlloc(BitmapDataSize); + DPRINTM(DPRINT_FILESYSTEM, "BitmapDataSize: %x\n", (ULONG)BitmapDataSize); + if(BitmapDataSize <= 0xFFFFFFFF) + BitmapData = MmHeapAlloc((ULONG)BitmapDataSize); + else + BitmapData = NULL; + if (BitmapData == NULL) { MmHeapFree(IndexRecord); MmHeapFree(MftRecord); return FALSE; } - NtfsReadAttribute(Volume, IndexBitmapCtx, 0, BitmapData, BitmapDataSize); + NtfsReadAttribute(Volume, IndexBitmapCtx, 0, BitmapData, (ULONG)BitmapDataSize); NtfsReleaseAttributeContext(IndexBitmapCtx); IndexAllocationCtx = NtfsFindAttribute(Volume, MftRecord, NTFS_ATTR_TYPE_INDEX_ALLOCATION, L"$I30"); @@ -693,7 +703,7 @@ static BOOLEAN NtfsLookupFile(PNTFS_VOLUME_INFO Volume, PCSTR FileName, PNTFS_MF { ULONG NumberOfPathParts; CHAR PathPart[261]; - ULONG CurrentMFTIndex; + ULONGLONG CurrentMFTIndex; UCHAR i; DPRINTM(DPRINT_FILESYSTEM, "NtfsLookupFile() FileName = %s\n", FileName); @@ -748,8 +758,8 @@ LONG NtfsGetFileInformation(ULONG FileId, FILEINFORMATION* Information) PNTFS_FILE_HANDLE FileHandle = FsGetDeviceSpecific(FileId); RtlZeroMemory(Information, sizeof(FILEINFORMATION)); - Information->EndingAddress.LowPart = (ULONG)NtfsGetAttributeSize(&FileHandle->DataContext->Record); - Information->CurrentAddress.LowPart = FileHandle->Offset; + Information->EndingAddress.QuadPart = NtfsGetAttributeSize(&FileHandle->DataContext->Record); + Information->CurrentAddress.QuadPart = FileHandle->Offset; DPRINTM(DPRINT_FILESYSTEM, "NtfsGetFileInformation() FileSize = %d\n", Information->EndingAddress.LowPart); @@ -923,8 +933,7 @@ const DEVVTBL* NtfsMount(ULONG DeviceId) MmHeapFree(Volume); return NULL; } - Position.HighPart = 0; - Position.LowPart = Volume->BootSector.MftLocation * Volume->ClusterSize; + Position.QuadPart = Volume->BootSector.MftLocation * Volume->ClusterSize; ret = ArcSeek(DeviceId, &Position, SeekAbsolute); if (ret != ESUCCESS) { diff --git a/boot/freeldr/freeldr/include/arcemul.h b/boot/freeldr/freeldr/include/arcemul.h index 45c34ab04b3..2d6a450d2ca 100644 --- a/boot/freeldr/freeldr/include/arcemul.h +++ b/boot/freeldr/freeldr/include/arcemul.h @@ -35,8 +35,8 @@ ArcGetConfigurationData( CONFIGURATION_COMPONENT* Component); /* mm.c */ -MEMORY_DESCRIPTOR* -ArcGetMemoryDescriptor(MEMORY_DESCRIPTOR* Current); +const MEMORY_DESCRIPTOR* +ArcGetMemoryDescriptor(const MEMORY_DESCRIPTOR* Current); /* time.c */ TIMEINFO* ArcGetTime(VOID); diff --git a/boot/freeldr/freeldr/include/arch.h b/boot/freeldr/freeldr/include/arch.h deleted file mode 100644 index 9888601a434..00000000000 --- a/boot/freeldr/freeldr/include/arch.h +++ /dev/null @@ -1,181 +0,0 @@ -/* - * FreeLoader - * Copyright (C) 1998-2003 Brian Palmer - * - * This 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. - * - * This 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. - * - * You 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. - */ - -#ifndef __ASM__ -#pragma once -#endif - -#ifndef HEX -#define HEX(y) 0x##y -#endif - -#ifdef _M_AMD64 -#include -#endif - -#if defined (_M_IX86) -/* Defines needed for switching between real and protected mode */ -#define NULL_DESC HEX(00) /* NULL descriptor */ -#define PMODE_CS HEX(08) /* PMode code selector, base 0 limit 4g */ -#define PMODE_DS HEX(10) /* PMode data selector, base 0 limit 4g */ -#define RMODE_CS HEX(18) /* RMode code selector, base 0 limit 64k */ -#define RMODE_DS HEX(20) /* RMode data selector, base 0 limit 64k */ -#endif - -#define CR0_PE_SET HEX(00000001) /* OR this value with CR0 to enable pmode */ -#define CR0_PE_CLR HEX(FFFFFFFE) /* AND this value with CR0 to disable pmode */ - -#define STACK16ADDR HEX(7000) /* The 16-bit stack top will be at 0000:7000 */ -#define STACK32ADDR HEX(78000) /* The 32-bit stack top will be at 7000:8000, or 0x78000 */ - -#if defined (_M_IX86) || defined (_M_AMD64) -#define BIOSCALLBUFFER 0x78000 /* Buffer to store temporary data for any Int386() call */ -#define BIOSCALLBUFSEGMENT 0x7800 /* Buffer to store temporary data for any Int386() call */ -#define BIOSCALLBUFOFFSET 0x0000 /* Buffer to store temporary data for any Int386() call */ -#define FILESYSBUFFER 0x80000 /* Buffer to store file system data (e.g. cluster buffer for FAT) */ -#define DISKREADBUFFER 0x90000 /* Buffer to store data read in from the disk via the BIOS */ -#define DISKREADBUFFER_SIZE 512 -#elif defined(_M_PPC) || defined(_M_MIPS) -#define DISKREADBUFFER 0x80000000 -#define FILESYSBUFFER 0x80000000 -#elif defined(_M_ARM) -extern ULONG gDiskReadBuffer, gFileSysBuffer; -#define DISKREADBUFFER gDiskReadBuffer -#define FILESYSBUFFER gFileSysBuffer -#endif - -/* Makes "x" a global variable or label */ -#define EXTERN(x) .global x; x: - - -// Flag Masks -#define I386FLAG_CF HEX(0001) // Carry Flag -#define I386FLAG_RESV1 HEX(0002) // Reserved - Must be 1 -#define I386FLAG_PF HEX(0004) // Parity Flag -#define I386FLAG_RESV2 HEX(0008) // Reserved - Must be 0 -#define I386FLAG_AF HEX(0010) // Auxiliary Flag -#define I386FLAG_RESV3 HEX(0020) // Reserved - Must be 0 -#define I386FLAG_ZF HEX(0040) // Zero Flag -#define I386FLAG_SF HEX(0080) // Sign Flag -#define I386FLAG_TF HEX(0100) // Trap Flag (Single Step) -#define I386FLAG_IF HEX(0200) // Interrupt Flag -#define I386FLAG_DF HEX(0400) // Direction Flag -#define I386FLAG_OF HEX(0800) // Overflow Flag - - -#ifndef __ASM__ - -#include -typedef struct -{ - unsigned long eax; - unsigned long ebx; - unsigned long ecx; - unsigned long edx; - - unsigned long esi; - unsigned long edi; - - unsigned short ds; - unsigned short es; - unsigned short fs; - unsigned short gs; - - unsigned long eflags; - -} DWORDREGS; - -typedef struct -{ - unsigned short ax, _upper_ax; - unsigned short bx, _upper_bx; - unsigned short cx, _upper_cx; - unsigned short dx, _upper_dx; - - unsigned short si, _upper_si; - unsigned short di, _upper_di; - - unsigned short ds; - unsigned short es; - unsigned short fs; - unsigned short gs; - - unsigned short flags, _upper_flags; - -} WORDREGS; - -typedef struct -{ - unsigned char al; - unsigned char ah; - unsigned short _upper_ax; - unsigned char bl; - unsigned char bh; - unsigned short _upper_bx; - unsigned char cl; - unsigned char ch; - unsigned short _upper_cx; - unsigned char dl; - unsigned char dh; - unsigned short _upper_dx; - - unsigned short si, _upper_si; - unsigned short di, _upper_di; - - unsigned short ds; - unsigned short es; - unsigned short fs; - unsigned short gs; - - unsigned short flags, _upper_flags; - -} BYTEREGS; - - -typedef union -{ - DWORDREGS x; - DWORDREGS d; - WORDREGS w; - BYTEREGS b; -} REGS; -#include - -// Int386() -// -// Real mode interrupt vector interface -// -// (E)FLAGS can *only* be returned by this function, not set. -// Make sure all memory pointers are in SEG:OFFS format and -// not linear addresses, unless the interrupt handler -// specifically handles linear addresses. -int Int386(int ivec, REGS* in, REGS* out); - -// This macro tests the Carry Flag -// If CF is set then the call failed (usually) -#define INT386_SUCCESS(regs) ((regs.x.eflags & I386FLAG_CF) == 0) - -void EnableA20(void); - -VOID ChainLoadBiosBootSectorCode(VOID); // Implemented in boot.S -VOID SoftReboot(VOID); // Implemented in boot.S - -VOID DetectHardware(VOID); // Implemented in hardware.c - -#endif /* ! __ASM__ */ diff --git a/boot/freeldr/freeldr/include/arch/amd64/amd64.h b/boot/freeldr/freeldr/include/arch/amd64/amd64.h index e5c73d4b4e5..11aef1f90b6 100644 --- a/boot/freeldr/freeldr/include/arch/amd64/amd64.h +++ b/boot/freeldr/freeldr/include/arch/amd64/amd64.h @@ -18,7 +18,9 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#ifndef __ASM__ #pragma once +#endif // This is needed because headers define wrong one for ReactOS #undef KIP0PCRADDRESS @@ -29,9 +31,6 @@ /* Long mode selectors */ #define LMODE_CS 0x10 #define LMODE_DS 0x18 -#define RMODE_CS 0x20 /* RMode code selector, base 0 limit 64k */ -#define RMODE_DS 0x28 /* RMode data selector, base 0 limit 64k */ -#define CMODE_CS 0x30 #define VA_MASK 0x0000FFFFFFFFFFFFUL @@ -49,17 +48,12 @@ #define APIC_PHYS_BASE 0xfee00000 -#define NUM_PAGES_KERNEL +#define NUM_PAGES_KERNEL #ifndef ASM -typedef struct _PAGE_DIRECTORY_AMD64 -{ - HARDWARE_PTE Pde[512]; -} PAGE_DIRECTORY_AMD64, *PPAGE_DIRECTORY_AMD64; - VOID FrLdrSetupGdtIdt(VOID); - +#define MachInit PcMachInit #endif /* EOF */ diff --git a/boot/freeldr/freeldr/include/arch/amd64/machpc.h b/boot/freeldr/freeldr/include/arch/amd64/machpc.h deleted file mode 100644 index efcf293dcab..00000000000 --- a/boot/freeldr/freeldr/include/arch/amd64/machpc.h +++ /dev/null @@ -1,61 +0,0 @@ -/* $Id: machpc.h 32135 2008-02-05 11:13:17Z ros-arm-bringup $ - * - * FreeLoader - * - * Copyright (C) 2003 Eric Kohl - * - * This 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. - * - * This 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. - * - * You 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. - */ - -#pragma once - -#ifndef __MEMORY_H -#include "mm.h" -#endif - -#define MachInit PcMachInit -VOID PcMachInit(const char *CmdLine); - -VOID PcConsPutChar(int Ch); -BOOLEAN PcConsKbHit(VOID); -int PcConsGetCh(VOID); - -VOID PcVideoClearScreen(UCHAR Attr); -VIDEODISPLAYMODE PcVideoSetDisplayMode(char *DisplayMode, BOOLEAN Init); -VOID PcVideoGetDisplaySize(PULONG Width, PULONG Height, PULONG Depth); -ULONG PcVideoGetBufferSize(VOID); -VOID PcVideoSetTextCursorPosition(ULONG X, ULONG Y); -VOID PcVideoHideShowTextCursor(BOOLEAN Show); -VOID PcVideoPutChar(int Ch, UCHAR Attr, unsigned X, unsigned Y); -VOID PcVideoCopyOffScreenBufferToVRAM(PVOID Buffer); -BOOLEAN PcVideoIsPaletteFixed(VOID); -VOID PcVideoSetPaletteColor(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue); -VOID PcVideoGetPaletteColor(UCHAR Color, UCHAR* Red, UCHAR* Green, UCHAR* Blue); -VOID PcVideoSync(VOID); -VOID PcVideoPrepareForReactOS(IN BOOLEAN Setup); -VOID PcPrepareForReactOS(IN BOOLEAN Setup); - -ULONG PcMemGetMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize); - -BOOLEAN PcDiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer); -BOOLEAN PcDiskGetPartitionEntry(ULONG DriveNumber, ULONG PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry); -BOOLEAN PcDiskGetDriveGeometry(ULONG DriveNumber, PGEOMETRY DriveGeometry); -ULONG PcDiskGetCacheableBlockCount(ULONG DriveNumber); - -TIMEINFO* PcGetTime(VOID); - -PCONFIGURATION_COMPONENT_DATA PcHwDetect(VOID); - -/* EOF */ diff --git a/boot/freeldr/freeldr/include/arch/arm/hardware.h b/boot/freeldr/freeldr/include/arch/arm/hardware.h index 1668b4f4daa..3bc931076d3 100644 --- a/boot/freeldr/freeldr/include/arch/arm/hardware.h +++ b/boot/freeldr/freeldr/include/arch/arm/hardware.h @@ -35,3 +35,7 @@ extern ULONG SecondLevelDcacheSize; extern ULONG SecondLevelDcacheFillSize; extern ULONG SecondLevelIcacheSize; extern ULONG SecondLevelIcacheFillSize; + +extern ULONG gDiskReadBuffer, gFileSysBuffer; +#define DISKREADBUFFER gDiskReadBuffer +#define FILESYSBUFFER gFileSysBuffer diff --git a/boot/freeldr/freeldr/include/arch/i386/drivemap.h b/boot/freeldr/freeldr/include/arch/i386/drivemap.h index aebd893a53b..90ee931d1a2 100644 --- a/boot/freeldr/freeldr/include/arch/i386/drivemap.h +++ b/boot/freeldr/freeldr/include/arch/i386/drivemap.h @@ -29,7 +29,7 @@ typedef struct VOID DriveMapMapDrivesInSection(PCSTR SectionName); BOOLEAN DriveMapIsValidDriveString(PCSTR DriveString); // Checks the drive string ("hd0") for validity -ULONG DriveMapGetBiosDriveNumber(PCSTR DeviceName); // Returns a BIOS drive number for any given device name (e.g. 0x80 for 'hd0') +UCHAR DriveMapGetBiosDriveNumber(PCSTR DeviceName); // Returns a BIOS drive number for any given device name (e.g. 0x80 for 'hd0') VOID DriveMapInstallInt13Handler(PDRIVE_MAP_LIST DriveMap); // Installs the int 13h handler for the drive mapper VOID DriveMapRemoveInt13Handler(VOID); // Removes a previously installed int 13h drive map handler diff --git a/boot/freeldr/freeldr/include/arch/i386/hardware.h b/boot/freeldr/freeldr/include/arch/i386/hardware.h deleted file mode 100644 index 5974067cd2b..00000000000 --- a/boot/freeldr/freeldr/include/arch/i386/hardware.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * FreeLoader - * - * Copyright (C) 2003 Eric Kohl - * - * This 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. - * - * This 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. - * - * You 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. - */ - -#pragma once - -#ifndef __REGISTRY_H -#include "../../reactos/registry.h" -#endif - -#define CONFIG_CMD(bus, dev_fn, where) \ - (0x80000000 | (((ULONG)(bus)) << 16) | (((dev_fn) & 0x1F) << 11) | (((dev_fn) & 0xE0) << 3) | ((where) & ~3)) - - -// -// Static heap for ARC Hardware Component Tree -// 16KB oughta be enough for anyone. -// -#define HW_MAX_ARC_HEAP_SIZE 16 * 1024 - -// -// ARC Component Configuration Routines -// -VOID -NTAPI -FldrCreateSystemKey( - OUT PCONFIGURATION_COMPONENT_DATA *SystemKey -); - -VOID -NTAPI -FldrCreateComponentKey( - IN PCONFIGURATION_COMPONENT_DATA SystemKey, - IN CONFIGURATION_CLASS Class, - IN CONFIGURATION_TYPE Type, - IN IDENTIFIER_FLAG Flags, - IN ULONG Key, - IN ULONG Affinity, - IN PCHAR IdentifierString, - IN PCM_PARTIAL_RESOURCE_LIST ResourceList, - IN ULONG Size, - OUT PCONFIGURATION_COMPONENT_DATA *ComponentKey -); - -/* PROTOTYPES ***************************************************************/ - -/* hardware.c */ - -VOID StallExecutionProcessor(ULONG Microseconds); - -VOID HalpCalibrateStallExecution(VOID); - -/* hwacpi.c */ -VOID DetectAcpiBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber); - -/* hwapm.c */ -VOID DetectApmBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber); - -/* hwpci.c */ -VOID DetectPciBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber); - -/* i386cpu.S */ -ULONG CpuidSupported(VOID); -VOID GetCpuid(ULONG Level, - ULONG *eax, - ULONG *ebx, - ULONG *ecx, - ULONG *edx); -ULONGLONG RDTSC(VOID); - -/* i386pnp.S */ -ULONG PnpBiosSupported(VOID); -ULONG PnpBiosGetDeviceNodeCount(ULONG *NodeSize, - ULONG *NodeCount); -ULONG PnpBiosGetDeviceNode(UCHAR *NodeId, - UCHAR *NodeBuffer); - -/* i386pxe.S */ -USHORT PxeCallApi(USHORT Segment, USHORT Offset, USHORT Service, VOID* Parameter); - -/* EOF */ diff --git a/boot/freeldr/freeldr/include/arch/i386/i386.h b/boot/freeldr/freeldr/include/arch/i386/i386.h index faf26b8b8fd..19a90a4e736 100644 --- a/boot/freeldr/freeldr/include/arch/i386/i386.h +++ b/boot/freeldr/freeldr/include/arch/i386/i386.h @@ -24,4 +24,23 @@ #undef KIP0PCRADDRESS #define KIP0PCRADDRESS 0xffdff000 +void i386DivideByZero(void); +void i386DebugException(void); +void i386NMIException(void); +void i386Breakpoint(void); +void i386Overflow(void); +void i386BoundException(void); +void i386InvalidOpcode(void); +void i386FPUNotAvailable(void); +void i386DoubleFault(void); +void i386CoprocessorSegment(void); +void i386InvalidTSS(void); +void i386SegmentNotPresent(void); +void i386StackException(void); +void i386GeneralProtectionFault(void); +void i386PageFault(void); +void i386CoprocessorError(void); +void i386AlignmentCheck(void); +void i386MachineCheck(void); + /* EOF */ diff --git a/boot/freeldr/freeldr/include/arch/i386/machxbox.h b/boot/freeldr/freeldr/include/arch/i386/machxbox.h index febba0b8636..241320ac189 100644 --- a/boot/freeldr/freeldr/include/arch/i386/machxbox.h +++ b/boot/freeldr/freeldr/include/arch/i386/machxbox.h @@ -36,7 +36,7 @@ VOID XboxVideoClearScreen(UCHAR Attr); VIDEODISPLAYMODE XboxVideoSetDisplayMode(char *DisplayModem, BOOLEAN Init); VOID XboxVideoGetDisplaySize(PULONG Width, PULONG Height, PULONG Depth); ULONG XboxVideoGetBufferSize(VOID); -VOID XboxVideoSetTextCursorPosition(ULONG X, ULONG Y); +VOID XboxVideoSetTextCursorPosition(UCHAR X, UCHAR Y); VOID XboxVideoHideShowTextCursor(BOOLEAN Show); VOID XboxVideoPutChar(int Ch, UCHAR Attr, unsigned X, unsigned Y); VOID XboxVideoCopyOffScreenBufferToVRAM(PVOID Buffer); @@ -51,10 +51,10 @@ VOID XboxMemInit(VOID); PVOID XboxMemReserveMemory(ULONG MbToReserve); ULONG XboxMemGetMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize); -BOOLEAN XboxDiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer); -BOOLEAN XboxDiskGetPartitionEntry(ULONG DriveNumber, ULONG PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry); -BOOLEAN XboxDiskGetDriveGeometry(ULONG DriveNumber, PGEOMETRY DriveGeometry); -ULONG XboxDiskGetCacheableBlockCount(ULONG DriveNumber); +BOOLEAN XboxDiskReadLogicalSectors(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer); +BOOLEAN XboxDiskGetPartitionEntry(UCHAR DriveNumber, ULONG PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry); +BOOLEAN XboxDiskGetDriveGeometry(UCHAR DriveNumber, PGEOMETRY DriveGeometry); +ULONG XboxDiskGetCacheableBlockCount(UCHAR DriveNumber); TIMEINFO* XboxGetTime(VOID); diff --git a/boot/freeldr/freeldr/include/arch/amd64/hardware.h b/boot/freeldr/freeldr/include/arch/pc/hardware.h similarity index 90% rename from boot/freeldr/freeldr/include/arch/amd64/hardware.h rename to boot/freeldr/freeldr/include/arch/pc/hardware.h index b6da01e555e..0e4e8542c54 100644 --- a/boot/freeldr/freeldr/include/arch/amd64/hardware.h +++ b/boot/freeldr/freeldr/include/arch/pc/hardware.h @@ -20,10 +20,6 @@ #pragma once -#ifndef __REGISTRY_H -#include "../../reactos/registry.h" -#endif - #define CONFIG_CMD(bus, dev_fn, where) \ (0x80000000 | (((ULONG)(bus)) << 16) | (((dev_fn) & 0x1F) << 11) | (((dev_fn) & 0xE0) << 3) | ((where) & ~3)) @@ -75,15 +71,6 @@ VOID DetectApmBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber); /* hwpci.c */ VOID DetectPciBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber); -/* i386cpu.S */ -ULONG CpuidSupported(VOID); -VOID GetCpuid(ULONG Level, - ULONG *eax, - ULONG *ebx, - ULONG *ecx, - ULONG *edx); -ULONGLONG RDTSC(VOID); - /* i386pnp.S */ ULONG_PTR PnpBiosSupported(VOID); ULONG PnpBiosGetDeviceNodeCount(ULONG *NodeSize, @@ -91,4 +78,7 @@ ULONG PnpBiosGetDeviceNodeCount(ULONG *NodeSize, ULONG PnpBiosGetDeviceNode(UCHAR *NodeId, UCHAR *NodeBuffer); +/* i386pxe.S */ +USHORT PxeCallApi(USHORT Segment, USHORT Offset, USHORT Service, VOID* Parameter); + /* EOF */ diff --git a/boot/freeldr/freeldr/include/arch/i386/machpc.h b/boot/freeldr/freeldr/include/arch/pc/machpc.h similarity index 87% rename from boot/freeldr/freeldr/include/arch/i386/machpc.h rename to boot/freeldr/freeldr/include/arch/pc/machpc.h index e2af2118b8b..43ca48a2b12 100644 --- a/boot/freeldr/freeldr/include/arch/i386/machpc.h +++ b/boot/freeldr/freeldr/include/arch/pc/machpc.h @@ -35,7 +35,7 @@ VOID PcVideoClearScreen(UCHAR Attr); VIDEODISPLAYMODE PcVideoSetDisplayMode(char *DisplayMode, BOOLEAN Init); VOID PcVideoGetDisplaySize(PULONG Width, PULONG Height, PULONG Depth); ULONG PcVideoGetBufferSize(VOID); -VOID PcVideoSetTextCursorPosition(ULONG X, ULONG Y); +VOID PcVideoSetTextCursorPosition(UCHAR X, UCHAR Y); VOID PcVideoHideShowTextCursor(BOOLEAN Show); VOID PcVideoPutChar(int Ch, UCHAR Attr, unsigned X, unsigned Y); VOID PcVideoCopyOffScreenBufferToVRAM(PVOID Buffer); @@ -49,10 +49,10 @@ VOID PcPrepareForReactOS(IN BOOLEAN Setup); ULONG PcMemGetMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize); BOOLEAN PcDiskGetBootPath(char *BootPath, unsigned Size); -BOOLEAN PcDiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer); -BOOLEAN PcDiskGetPartitionEntry(ULONG DriveNumber, ULONG PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry); -BOOLEAN PcDiskGetDriveGeometry(ULONG DriveNumber, PGEOMETRY DriveGeometry); -ULONG PcDiskGetCacheableBlockCount(ULONG DriveNumber); +BOOLEAN PcDiskReadLogicalSectors(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer); +BOOLEAN PcDiskGetPartitionEntry(UCHAR DriveNumber, ULONG PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry); +BOOLEAN PcDiskGetDriveGeometry(UCHAR DriveNumber, PGEOMETRY DriveGeometry); +ULONG PcDiskGetCacheableBlockCount(UCHAR DriveNumber); TIMEINFO* PcGetTime(VOID); diff --git a/boot/freeldr/freeldr/include/arch/pc/pcbios.h b/boot/freeldr/freeldr/include/arch/pc/pcbios.h new file mode 100644 index 00000000000..61ff8df5211 --- /dev/null +++ b/boot/freeldr/freeldr/include/arch/pc/pcbios.h @@ -0,0 +1,98 @@ +#ifndef __ASM__ + +#include +typedef struct +{ + unsigned long eax; + unsigned long ebx; + unsigned long ecx; + unsigned long edx; + + unsigned long esi; + unsigned long edi; + + unsigned short ds; + unsigned short es; + unsigned short fs; + unsigned short gs; + + unsigned long eflags; + +} DWORDREGS; + +typedef struct +{ + unsigned short ax, _upper_ax; + unsigned short bx, _upper_bx; + unsigned short cx, _upper_cx; + unsigned short dx, _upper_dx; + + unsigned short si, _upper_si; + unsigned short di, _upper_di; + + unsigned short ds; + unsigned short es; + unsigned short fs; + unsigned short gs; + + unsigned short flags, _upper_flags; + +} WORDREGS; + +typedef struct +{ + unsigned char al; + unsigned char ah; + unsigned short _upper_ax; + unsigned char bl; + unsigned char bh; + unsigned short _upper_bx; + unsigned char cl; + unsigned char ch; + unsigned short _upper_cx; + unsigned char dl; + unsigned char dh; + unsigned short _upper_dx; + + unsigned short si, _upper_si; + unsigned short di, _upper_di; + + unsigned short ds; + unsigned short es; + unsigned short fs; + unsigned short gs; + + unsigned short flags, _upper_flags; + +} BYTEREGS; + + +typedef union +{ + DWORDREGS x; + DWORDREGS d; + WORDREGS w; + BYTEREGS b; +} REGS; +#include + +// Int386() +// +// Real mode interrupt vector interface +// +// (E)FLAGS can *only* be returned by this function, not set. +// Make sure all memory pointers are in SEG:OFFS format and +// not linear addresses, unless the interrupt handler +// specifically handles linear addresses. +int Int386(int ivec, REGS* in, REGS* out); + +// This macro tests the Carry Flag +// If CF is set then the call failed (usually) +#define INT386_SUCCESS(regs) ((regs.x.eflags & I386FLAG_CF) == 0) + +void EnableA20(void); +VOID ChainLoadBiosBootSectorCode(VOID); // Implemented in boot.S +VOID SoftReboot(VOID); // Implemented in boot.S +VOID DetectHardware(VOID); // Implemented in hardware.c + +#endif /* ! __ASM__ */ diff --git a/boot/freeldr/freeldr/include/arch/i386/pxe.h b/boot/freeldr/freeldr/include/arch/pc/pxe.h similarity index 100% rename from boot/freeldr/freeldr/include/arch/i386/pxe.h rename to boot/freeldr/freeldr/include/arch/pc/pxe.h diff --git a/boot/freeldr/freeldr/include/arch/pc/x86common.h b/boot/freeldr/freeldr/include/arch/pc/x86common.h new file mode 100644 index 00000000000..1e85f214630 --- /dev/null +++ b/boot/freeldr/freeldr/include/arch/pc/x86common.h @@ -0,0 +1,91 @@ + +#ifndef HEX +#define HEX(y) 0x##y +#endif + +/* Memory layout */ +#define STACK16ADDR HEX(6F00) /* The 16-bit stack top will be at 0000:6F00 */ +#define BSS_START HEX(6F00) +#define FREELDR_BASE HEX(F800) +#define FREELDR_PE_BASE HEX(10000) +#define STACK32ADDR HEX(98000) /* The 32-bit stack top will be at 9000:8000, or 0xA8000 */ +#define BIOSCALLBUFFER HEX(98000) /* Buffer to store temporary data for any Int386() call */ +#define FILESYSBUFFER HEX(80000) /* Buffer to store file system data (e.g. cluster buffer for FAT) */ +#define DISKREADBUFFER HEX(90000) /* Buffer to store data read in from the disk via the BIOS */ +#define DISKREADBUFFER_SIZE 512 + +#define BIOSCALLBUFSEGMENT (BIOSCALLBUFFER/16) /* Buffer to store temporary data for any Int386() call */ +#define BIOSCALLBUFOFFSET HEX(0000) /* Buffer to store temporary data for any Int386() call */ + +/* These addresses specify the realmode "BSS section" layout */ +#define BSS_RealModeEntry (BSS_START + 0) +#define BSS_CallbackAddress (BSS_START + 4) +#define BSS_CallbackReturn (BSS_START + 8) +#define BSS_RegisterSet (BSS_START + 16) /* size = 36 */ +#define BSS_IntVector (BSS_START + 52) +#define BSS_PxeEntryPoint (BSS_START + 56) +#define BSS_PxeBufferSegment (BSS_START + 60) +#define BSS_PxeBufferOffset (BSS_START + 64) +#define BSS_PxeFunction (BSS_START + 68) +#define BSS_PxeResult (BSS_START + 72) +#define BSS_PnpBiosEntryPoint (BSS_START + 76) +#define BSS_PnpBiosDataSegment (BSS_START + 80) +#define BSS_PnpBiosBufferSegment (BSS_START + 84) +#define BSS_PnpBiosBufferOffset (BSS_START + 88) +#define BSS_PnpNodeSize (BSS_START + 92) +#define BSS_PnpNodeCount (BSS_START + 96) +#define BSS_PnpNodeNumber (BSS_START + 100) +#define BSS_PnpResult (BSS_START + 104) + + +/* Realmode function IDs */ +#define FNID_Int386 0 +#define FNID_SoftReboot 1 +#define FNID_ChainLoadBiosBootSectorCode 2 +#define FNID_PxeCallApi 3 +#define FNID_PnpBiosGetDeviceNodeCount 4 +#define FNID_PnpBiosGetDeviceNode 5 +#define FNID_BootLinuxKernel 6 + +/* Layout of the REGS structure */ +#define REGS_EAX 0 +#define REGS_EBX 4 +#define REGS_ECX 8 +#define REGS_EDX 12 +#define REGS_ESI 16 +#define REGS_EDI 20 +#define REGS_DS 24 +#define REGS_ES 26 +#define REGS_FS 28 +#define REGS_GS 30 +#define REGS_EFLAGS 32 + + +// Flag Masks +#define I386FLAG_CF HEX(0001) // Carry Flag +#define I386FLAG_RESV1 HEX(0002) // Reserved - Must be 1 +#define I386FLAG_PF HEX(0004) // Parity Flag +#define I386FLAG_RESV2 HEX(0008) // Reserved - Must be 0 +#define I386FLAG_AF HEX(0010) // Auxiliary Flag +#define I386FLAG_RESV3 HEX(0020) // Reserved - Must be 0 +#define I386FLAG_ZF HEX(0040) // Zero Flag +#define I386FLAG_SF HEX(0080) // Sign Flag +#define I386FLAG_TF HEX(0100) // Trap Flag (Single Step) +#define I386FLAG_IF HEX(0200) // Interrupt Flag +#define I386FLAG_DF HEX(0400) // Direction Flag +#define I386FLAG_OF HEX(0800) // Overflow Flag + +#define CR0_PE_SET HEX(00000001) /* OR this value with CR0 to enable pmode */ +#define CR0_PE_CLR HEX(FFFFFFFE) /* AND this value with CR0 to disable pmode */ + +/* Defines needed for switching between real and protected mode */ +//#ifdef _M_IX86 +#define NULL_DESC HEX(00) /* NULL descriptor */ +#define PMODE_CS HEX(08) /* PMode code selector, base 0 limit 4g */ +#define PMODE_DS HEX(10) /* PMode data selector, base 0 limit 4g */ +#define RMODE_CS HEX(18) /* RMode code selector, base 0 limit 64k */ +#define RMODE_DS HEX(20) /* RMode data selector, base 0 limit 64k */ +//#endif + +/* Makes "x" a global variable or label */ +#define EXTERN(x) .global x; x: diff --git a/boot/freeldr/freeldr/include/cache.h b/boot/freeldr/freeldr/include/cache.h index abadfd32c93..ecc02acac5f 100644 --- a/boot/freeldr/freeldr/include/cache.h +++ b/boot/freeldr/freeldr/include/cache.h @@ -50,7 +50,7 @@ typedef struct /////////////////////////////////////////////////////////////////////////////////////// typedef struct { - ULONG DriveNumber; + UCHAR DriveNumber; ULONG BytesPerSector; ULONG BlockSize; // Block size (in sectors) @@ -84,8 +84,8 @@ VOID CacheInternalDumpBlockList(PCACHE_DRIVE CacheDrive); // Dumps the VOID CacheInternalOptimizeBlockList(PCACHE_DRIVE CacheDrive, PCACHE_BLOCK CacheBlock); // Moves the specified block to the head of the list -BOOLEAN CacheInitializeDrive(ULONG DriveNumber); +BOOLEAN CacheInitializeDrive(UCHAR DriveNumber); VOID CacheInvalidateCacheData(VOID); -BOOLEAN CacheReadDiskSectors(ULONG DiskNumber, ULONG StartSector, ULONG SectorCount, PVOID Buffer); -BOOLEAN CacheForceDiskSectorsIntoCache(ULONG DiskNumber, ULONG StartSector, ULONG SectorCount); +BOOLEAN CacheReadDiskSectors(UCHAR DiskNumber, ULONGLONG StartSector, ULONG SectorCount, PVOID Buffer); +BOOLEAN CacheForceDiskSectorsIntoCache(UCHAR DiskNumber, ULONGLONG StartSector, ULONG SectorCount); BOOLEAN CacheReleaseMemory(ULONG MinimumAmountToRelease); diff --git a/boot/freeldr/freeldr/include/disk.h b/boot/freeldr/freeldr/include/disk.h index 191ee1215d6..9a862d1925f 100644 --- a/boot/freeldr/freeldr/include/disk.h +++ b/boot/freeldr/freeldr/include/disk.h @@ -105,10 +105,10 @@ typedef struct _MASTER_BOOT_RECORD /////////////////////////////////////////////////////////////////////////////////////// #if defined(__i386__) || defined(_M_AMD64) -BOOLEAN DiskResetController(ULONG DriveNumber); -BOOLEAN DiskInt13ExtensionsSupported(ULONG DriveNumber); +BOOLEAN DiskResetController(UCHAR DriveNumber); +BOOLEAN DiskInt13ExtensionsSupported(UCHAR DriveNumber); //VOID DiskStopFloppyMotor(VOID); -BOOLEAN DiskGetExtendedDriveParameters(ULONG DriveNumber, PVOID Buffer, USHORT BufferSize); +BOOLEAN DiskGetExtendedDriveParameters(UCHAR DriveNumber, PVOID Buffer, USHORT BufferSize); #endif // defined __i386__ || defined(_M_AMD64) @@ -120,11 +120,11 @@ BOOLEAN DiskGetExtendedDriveParameters(ULONG DriveNumber, PVOID Buffer, USHORT B VOID DiskReportError (BOOLEAN bError); VOID DiskError(PCSTR ErrorString, ULONG ErrorCode); PCSTR DiskGetErrorCodeString(ULONG ErrorCode); -BOOLEAN DiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer); // Implemented in i386disk.c -BOOLEAN DiskIsDriveRemovable(ULONG DriveNumber); +BOOLEAN DiskReadLogicalSectors(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer); // Implemented in i386disk.c +BOOLEAN DiskIsDriveRemovable(UCHAR DriveNumber); VOID DiskStopFloppyMotor(VOID); // Implemented in i386disk.c -extern ULONG BootDrive; -extern ULONG BootPartition; +extern UCHAR FrldrBootDrive; +extern ULONG FrldrBootPartition; BOOLEAN DiskGetBootPath(char *BootPath, unsigned Size); @@ -134,10 +134,10 @@ BOOLEAN DiskGetBootPath(char *BootPath, unsigned Size); // Fixed Disk Partition Management Functions // /////////////////////////////////////////////////////////////////////////////////////// -BOOLEAN DiskGetActivePartitionEntry(ULONG DriveNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry, ULONG *ActivePartition); -BOOLEAN DiskGetPartitionEntry(ULONG DriveNumber, ULONG PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry); +BOOLEAN DiskGetActivePartitionEntry(UCHAR DriveNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry, ULONG *ActivePartition); +BOOLEAN DiskGetPartitionEntry(UCHAR DriveNumber, ULONG PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry); BOOLEAN DiskGetFirstPartitionEntry(PMASTER_BOOT_RECORD MasterBootRecord, PPARTITION_TABLE_ENTRY PartitionTableEntry); BOOLEAN DiskGetFirstExtendedPartitionEntry(PMASTER_BOOT_RECORD MasterBootRecord, PPARTITION_TABLE_ENTRY PartitionTableEntry); -BOOLEAN DiskReadBootRecord(ULONG DriveNumber, ULONGLONG LogicalSectorNumber, PMASTER_BOOT_RECORD BootRecord); +BOOLEAN DiskReadBootRecord(UCHAR DriveNumber, ULONGLONG LogicalSectorNumber, PMASTER_BOOT_RECORD BootRecord); ULONG LoadBootDeviceDriver(VOID); diff --git a/boot/freeldr/freeldr/include/freeldr.h b/boot/freeldr/freeldr/include/freeldr.h index 694c9c764a9..5e4df748261 100644 --- a/boot/freeldr/freeldr/include/freeldr.h +++ b/boot/freeldr/freeldr/include/freeldr.h @@ -29,6 +29,7 @@ #define ROUND_UP(n, align) \ ROUND_DOWN(((ULONG)n) + (align) - 1, (align)) +/* public headers */ #define NTOSAPI #define printf TuiPrintf #include @@ -45,77 +46,77 @@ #include #include #include -#include -#include #include +#include +#include +#include +#include +#include + +/* internal headers */ +#include +#include +#include +#include +#include +#include #include #include -#include -#include -#include -#include -#include -#include #include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include +#include +#include +#include #include -#include -#include + /* file system headers */ #include #include #include #include #include + /* ui support */ #include #include #include #include -/* arch files */ + +/* arch specific includes */ +#if defined(_M_IX86) || defined(_M_AMD64) +#include +#include +#include +#include +#include +#endif #if defined(_M_IX86) #include #include -#include #include -#include #include #include -#include #include +#elif defined(_M_AMD64) +#include +#include #elif defined(_M_PPC) #include #elif defined(_M_ARM) #include #elif defined(_M_MIPS) #include -#elif defined(_M_AMD64) -#include -#include -#include #endif -/* misc files */ -#include -#include -#include -#include -#include -/* Needed by boot manager */ -#include -#include -#include -/* Externals */ -#include -#include -/* Needed if debuging is enabled */ -#include -/* Swap */ -#include -/* Internal shared PCI header */ -#include VOID BootMain(LPSTR CmdLine); VOID RunLoader(VOID); diff --git a/boot/freeldr/freeldr/include/fs/ext2.h b/boot/freeldr/freeldr/include/fs/ext2.h index 8a2b518a4be..3458e7dc94a 100644 --- a/boot/freeldr/freeldr/include/fs/ext2.h +++ b/boot/freeldr/freeldr/include/fs/ext2.h @@ -75,7 +75,7 @@ struct ext2_sblock ULONG free_inodes; ULONG first_data_block; ULONG log2_block_size; - ULONG log2_fragment_size; + LONG log2_fragment_size; ULONG blocks_per_group; ULONG fragments_per_group; ULONG inodes_per_group; diff --git a/boot/freeldr/freeldr/include/machine.h b/boot/freeldr/freeldr/include/machine.h index ba2be4fdf6a..1e77b786e97 100644 --- a/boot/freeldr/freeldr/include/machine.h +++ b/boot/freeldr/freeldr/include/machine.h @@ -47,7 +47,7 @@ typedef struct tagMACHVTBL VIDEODISPLAYMODE (*VideoSetDisplayMode)(char *DisplayMode, BOOLEAN Init); VOID (*VideoGetDisplaySize)(PULONG Width, PULONG Height, PULONG Depth); ULONG (*VideoGetBufferSize)(VOID); - VOID (*VideoSetTextCursorPosition)(ULONG X, ULONG Y); + VOID (*VideoSetTextCursorPosition)(UCHAR X, UCHAR Y); VOID (*VideoHideShowTextCursor)(BOOLEAN Show); VOID (*VideoPutChar)(int Ch, UCHAR Attr, unsigned X, unsigned Y); VOID (*VideoCopyOffScreenBufferToVRAM)(PVOID Buffer); @@ -62,9 +62,9 @@ typedef struct tagMACHVTBL ULONG (*GetMemoryMap)(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize); BOOLEAN (*DiskGetBootPath)(char *BootPath, unsigned Size); - BOOLEAN (*DiskReadLogicalSectors)(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer); - BOOLEAN (*DiskGetDriveGeometry)(ULONG DriveNumber, PGEOMETRY DriveGeometry); - ULONG (*DiskGetCacheableBlockCount)(ULONG DriveNumber); + BOOLEAN (*DiskReadLogicalSectors)(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer); + BOOLEAN (*DiskGetDriveGeometry)(UCHAR DriveNumber, PGEOMETRY DriveGeometry); + ULONG (*DiskGetCacheableBlockCount)(UCHAR DriveNumber); TIMEINFO* (*GetTime)(VOID); ULONG (*GetRelativeTime)(VOID); @@ -83,7 +83,7 @@ VOID MachVideoClearScreen(UCHAR Attr); VIDEODISPLAYMODE MachVideoSetDisplayMode(char *DisplayMode, BOOLEAN Init); VOID MachVideoGetDisplaySize(PULONG Width, PULONG Height, PULONG Depth); ULONG MachVideoGetBufferSize(VOID); -VOID MachVideoSetTextCursorPosition(ULONG X, ULONG Y); +VOID MachVideoSetTextCursorPosition(UCHAR X, UCHAR Y); VOID MachVideoHideShowTextCursor(BOOLEAN Show); VOID MachVideoPutChar(int Ch, UCHAR Attr, unsigned X, unsigned Y); VOID MachVideoCopyOffScreenBufferToVRAM(PVOID Buffer); @@ -92,12 +92,11 @@ VOID MachVideoSetPaletteColor(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue); VOID MachVideoGetPaletteColor(UCHAR Color, UCHAR *Red, UCHAR *Green, UCHAR *Blue); VOID MachVideoSync(VOID); VOID MachBeep(VOID); -MEMORY_DESCRIPTOR* ArcGetMemoryDescriptor(MEMORY_DESCRIPTOR* Current); BOOLEAN MachDiskGetBootPath(char *BootPath, unsigned Size); BOOLEAN MachDiskNormalizeSystemPath(char *SystemPath, unsigned Size); -BOOLEAN MachDiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer); -BOOLEAN MachDiskGetDriveGeometry(ULONG DriveNumber, PGEOMETRY DriveGeometry); -ULONG MachDiskGetCacheableBlockCount(ULONG DriveNumber); +BOOLEAN MachDiskReadLogicalSectors(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer); +BOOLEAN MachDiskGetDriveGeometry(UCHAR DriveNumber, PGEOMETRY DriveGeometry); +ULONG MachDiskGetCacheableBlockCount(UCHAR DriveNumber); VOID MachPrepareForReactOS(IN BOOLEAN Setup); #define MachConsPutChar(Ch) MachVtbl.ConsPutChar(Ch) diff --git a/boot/freeldr/freeldr/include/mm.h b/boot/freeldr/freeldr/include/mm.h index a7840e37791..8d325191bcd 100644 --- a/boot/freeldr/freeldr/include/mm.h +++ b/boot/freeldr/freeldr/include/mm.h @@ -42,6 +42,7 @@ typedef struct #define MM_PAGE_SIZE 4096 #define MM_PAGE_MASK 0xFFF #define MM_PAGE_SHIFT 12 +#define MM_MAX_PAGE 0xFFFFF #define MM_SIZE_TO_PAGES(a) \ ( ((a) >> MM_PAGE_SHIFT) + ((a) & MM_PAGE_MASK ? 1 : 0) ) @@ -53,6 +54,8 @@ typedef struct #define MM_PAGE_SIZE 4096 #define MM_PAGE_MASK 0xFFF #define MM_PAGE_SHIFT 12 +// FIXME: freeldr implementation uses ULONG for page numbers +#define MM_MAX_PAGE 0xFFFFFFFFFFFFF #define MM_SIZE_TO_PAGES(a) \ ( ((a) >> MM_PAGE_SHIFT) + ((a) & MM_PAGE_MASK ? 1 : 0) ) diff --git a/boot/freeldr/freeldr/include/reactos.h b/boot/freeldr/freeldr/include/reactos.h index 82e23abb946..c31c0ca3f70 100644 --- a/boot/freeldr/freeldr/include/reactos.h +++ b/boot/freeldr/freeldr/include/reactos.h @@ -81,9 +81,9 @@ DissectArcPath2( OUT ULONG* z, OUT ULONG* Partition, OUT ULONG *PathSyntax); -BOOLEAN DissectArcPath(CHAR *ArcPath, CHAR *BootPath, ULONG* BootDrive, ULONG* BootPartition); -VOID ConstructArcPath(PCHAR ArcPath, PCHAR SystemFolder, ULONG Disk, ULONG Partition); -ULONG ConvertArcNameToBiosDriveNumber(PCHAR ArcPath); +BOOLEAN DissectArcPath(CHAR *ArcPath, CHAR *BootPath, UCHAR* BootDrive, ULONG* BootPartition); +VOID ConstructArcPath(PCHAR ArcPath, PCHAR SystemFolder, UCHAR Disk, ULONG Partition); +UCHAR ConvertArcNameToBiosDriveNumber(PCHAR ArcPath); /////////////////////////////////////////////////////////////////////////////////////// // diff --git a/boot/freeldr/freeldr/inifile/parse.c b/boot/freeldr/freeldr/inifile/parse.c index 54fb16a6864..47c58966cf5 100644 --- a/boot/freeldr/freeldr/inifile/parse.c +++ b/boot/freeldr/freeldr/inifile/parse.c @@ -180,12 +180,11 @@ BOOLEAN IniParseFile(PCHAR IniFileData, ULONG IniFileSize) ULONG IniGetNextLineSize(PCHAR IniFileData, ULONG IniFileSize, ULONG CurrentOffset) { - ULONG Idx; ULONG LineCharCount = 0; // Loop through counting chars until we hit the end of the // file or we encounter a new line char - for (Idx=0; (CurrentOffset < IniFileSize); CurrentOffset++) + for (; (CurrentOffset < IniFileSize); CurrentOffset++) { // Increment the line character count LineCharCount++; @@ -193,7 +192,6 @@ ULONG IniGetNextLineSize(PCHAR IniFileData, ULONG IniFileSize, ULONG CurrentOffs // Check for new line char if (IniFileData[CurrentOffset] == '\n') { - CurrentOffset++; break; } } diff --git a/boot/freeldr/freeldr/machine.c b/boot/freeldr/freeldr/machine.c index c898bf49430..5dae495d960 100644 --- a/boot/freeldr/freeldr/machine.c +++ b/boot/freeldr/freeldr/machine.c @@ -86,7 +86,7 @@ MachVideoGetBufferSize(VOID) } VOID -MachVideoSetTextCursorPosition(ULONG X, ULONG Y) +MachVideoSetTextCursorPosition(UCHAR X, UCHAR Y) { MachVtbl.VideoSetTextCursorPosition(X, Y); } @@ -152,19 +152,19 @@ MachDiskGetBootPath(char *BootPath, unsigned Size) } BOOLEAN -MachDiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer) +MachDiskReadLogicalSectors(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer) { return MachVtbl.DiskReadLogicalSectors(DriveNumber, SectorNumber, SectorCount, Buffer); } BOOLEAN -MachDiskGetDriveGeometry(ULONG DriveNumber, PGEOMETRY DriveGeometry) +MachDiskGetDriveGeometry(UCHAR DriveNumber, PGEOMETRY DriveGeometry) { return MachVtbl.DiskGetDriveGeometry(DriveNumber, DriveGeometry); } ULONG -MachDiskGetCacheableBlockCount(ULONG DriveNumber) +MachDiskGetCacheableBlockCount(UCHAR DriveNumber) { return MachVtbl.DiskGetCacheableBlockCount(DriveNumber); } diff --git a/boot/freeldr/freeldr/mm/meminit.c b/boot/freeldr/freeldr/mm/meminit.c index f59a43f7b54..e8e399bcf3d 100644 --- a/boot/freeldr/freeldr/mm/meminit.c +++ b/boot/freeldr/freeldr/mm/meminit.c @@ -48,6 +48,8 @@ PVOID PageLookupTableAddress = NULL; ULONG TotalPagesInLookupTable = 0; ULONG FreePagesInLookupTable = 0; ULONG LastFreePageHint = 0; +ULONG MmLowestPhysicalPage = 0xFFFFFFFF; +ULONG MmHighestPhysicalPage = 0; extern ULONG_PTR MmHeapPointer; extern ULONG_PTR MmHeapStart; @@ -55,7 +57,7 @@ extern ULONG_PTR MmHeapStart; BOOLEAN MmInitializeMemoryManager(VOID) { #if DBG - MEMORY_DESCRIPTOR* MemoryDescriptor = NULL; + const MEMORY_DESCRIPTOR* MemoryDescriptor = NULL; #endif DPRINTM(DPRINT_MEMORY, "Initializing Memory Manager.\n"); @@ -75,7 +77,7 @@ BOOLEAN MmInitializeMemoryManager(VOID) // Find address for the page lookup table TotalPagesInLookupTable = MmGetAddressablePageCountIncludingHoles(); PageLookupTableAddress = MmFindLocationForPageLookupTable(TotalPagesInLookupTable); - LastFreePageHint = TotalPagesInLookupTable; + LastFreePageHint = MmHighestPhysicalPage; if (PageLookupTableAddress == 0) { @@ -102,20 +104,21 @@ VOID MmInitializeHeap(PVOID PageLookupTable) { ULONG PagesNeeded; ULONG HeapStart; +#ifndef _M_ARM MEMORY_TYPE Type; PPAGE_LOOKUP_TABLE_ITEM RealPageLookupTable = (PPAGE_LOOKUP_TABLE_ITEM)PageLookupTable; // HACK: Make it so it doesn't overlap kernel space Type = RealPageLookupTable[0x100].PageAllocated; MmMarkPagesInLookupTable(PageLookupTableAddress, 0x100, 0xFF, LoaderSystemCode); - +#endif // Find contigious memory block for HEAP:STACK PagesNeeded = HEAP_PAGES + STACK_PAGES; HeapStart = MmFindAvailablePages(PageLookupTable, TotalPagesInLookupTable, PagesNeeded, FALSE); - +#ifndef _M_ARM // Unapply the hack MmMarkPagesInLookupTable(PageLookupTableAddress, 0x100, 0xFF, Type); - +#endif if (HeapStart == 0) { UiMessageBox("Critical error: Can't allocate heap!"); @@ -155,8 +158,8 @@ ULONG MmGetPageNumberFromAddress(PVOID Address) ULONG MmGetAddressablePageCountIncludingHoles(VOID) { - MEMORY_DESCRIPTOR* MemoryDescriptor = NULL; - ULONG EndPage = 0; + const MEMORY_DESCRIPTOR* MemoryDescriptor = NULL; + ULONG PageCount; // // Go through the whole memory map to get max address @@ -166,23 +169,35 @@ ULONG MmGetAddressablePageCountIncludingHoles(VOID) // // Check if we got a higher end page address // - if (MemoryDescriptor->BasePage + MemoryDescriptor->PageCount > EndPage) + if (MemoryDescriptor->BasePage + MemoryDescriptor->PageCount > MmHighestPhysicalPage) { // - // Yes, remember it + // Yes, remember it if this is real memory // - EndPage = MemoryDescriptor->BasePage + MemoryDescriptor->PageCount; + if (MemoryDescriptor->MemoryType == MemoryFree) MmHighestPhysicalPage = MemoryDescriptor->BasePage + MemoryDescriptor->PageCount; + } + + // + // Check if we got a higher (usable) start page address + // + if (MemoryDescriptor->BasePage < MmLowestPhysicalPage) + { + // + // Yes, remember it if this is real memory + // + if (MemoryDescriptor->MemoryType == MemoryFree) MmLowestPhysicalPage = MemoryDescriptor->BasePage; } } - - DPRINTM(DPRINT_MEMORY, "MmGetAddressablePageCountIncludingHoles() returning 0x%x\n", EndPage); - - return EndPage; + + DPRINTM(DPRINT_MEMORY, "lo/hi %lx %lxn", MmLowestPhysicalPage, MmHighestPhysicalPage); + PageCount = MmHighestPhysicalPage - MmLowestPhysicalPage; + DPRINTM(DPRINT_MEMORY, "MmGetAddressablePageCountIncludingHoles() returning 0x%x\n", PageCount); + return PageCount; } PVOID MmFindLocationForPageLookupTable(ULONG TotalPageCount) { - MEMORY_DESCRIPTOR* MemoryDescriptor = NULL; + const MEMORY_DESCRIPTOR* MemoryDescriptor = NULL; ULONG PageLookupTableSize; ULONG PageLookupTablePages; ULONG PageLookupTableStartPage = 0; @@ -232,6 +247,17 @@ PVOID MmFindLocationForPageLookupTable(ULONG TotalPageCount) continue; } + // + // Can we use this address? + // + if (MemoryDescriptor->BasePage >= MM_MAX_PAGE) + { + // + // No. Process next descriptor + // + continue; + } + // // Memory block is more suitable than the previous one // @@ -248,7 +274,7 @@ PVOID MmFindLocationForPageLookupTable(ULONG TotalPageCount) VOID MmInitPageLookupTable(PVOID PageLookupTable, ULONG TotalPageCount) { - MEMORY_DESCRIPTOR* MemoryDescriptor = NULL; + const MEMORY_DESCRIPTOR* MemoryDescriptor = NULL; TYPE_OF_MEMORY MemoryMapPageAllocated; ULONG PageLookupTableStartPage; ULONG PageLookupTablePageCount; @@ -260,7 +286,7 @@ VOID MmInitPageLookupTable(PVOID PageLookupTable, ULONG TotalPageCount) // We will go through and mark pages again according to the memory map // But this will mark any holes not described in the map as allocated // - MmMarkPagesInLookupTable(PageLookupTable, 0, TotalPageCount, LoaderFirmwarePermanent); + MmMarkPagesInLookupTable(PageLookupTable, MmLowestPhysicalPage, TotalPageCount, LoaderFirmwarePermanent); // // Parse the whole memory map @@ -307,9 +333,9 @@ VOID MmInitPageLookupTable(PVOID PageLookupTable, ULONG TotalPageCount) case MemorySpecialMemory: { // - // Special reserved memory + // OS Loader Stack // - MemoryMapPageAllocated = LoaderSpecialMemory; + MemoryMapPageAllocated = LoaderOsloaderStack; break; } default: @@ -343,6 +369,7 @@ VOID MmMarkPagesInLookupTable(PVOID PageLookupTable, ULONG StartPage, ULONG Page PPAGE_LOOKUP_TABLE_ITEM RealPageLookupTable = (PPAGE_LOOKUP_TABLE_ITEM)PageLookupTable; ULONG Index; + StartPage -= MmLowestPhysicalPage; for (Index=StartPage; Index<(StartPage+PageCount); Index++) { #if 0 @@ -362,6 +389,7 @@ VOID MmAllocatePagesInLookupTable(PVOID PageLookupTable, ULONG StartPage, ULONG PPAGE_LOOKUP_TABLE_ITEM RealPageLookupTable = (PPAGE_LOOKUP_TABLE_ITEM)PageLookupTable; ULONG Index; + StartPage -= MmLowestPhysicalPage; for (Index=StartPage; Index<(StartPage+PageCount); Index++) { RealPageLookupTable[Index].PageAllocated = MemoryType; @@ -416,7 +444,7 @@ ULONG MmFindAvailablePages(PVOID PageLookupTable, ULONG TotalPageCount, ULONG Pa if (AvailablePagesSoFar >= PagesNeeded) { - return Index; + return Index + MmLowestPhysicalPage; } } } @@ -438,7 +466,7 @@ ULONG MmFindAvailablePages(PVOID PageLookupTable, ULONG TotalPageCount, ULONG Pa if (AvailablePagesSoFar >= PagesNeeded) { - return Index - AvailablePagesSoFar + 1; + return Index - AvailablePagesSoFar + 1 + MmLowestPhysicalPage; } } } @@ -472,7 +500,7 @@ ULONG MmFindAvailablePagesBeforePage(PVOID PageLookupTable, ULONG TotalPageCount if (AvailablePagesSoFar >= PagesNeeded) { - return Index; + return Index + MmLowestPhysicalPage; } } @@ -488,7 +516,7 @@ VOID MmUpdateLastFreePageHint(PVOID PageLookupTable, ULONG TotalPageCount) { if (RealPageLookupTable[Index].PageAllocated == LoaderFree) { - LastFreePageHint = Index + 1; + LastFreePageHint = Index + 1 + MmLowestPhysicalPage; break; } } @@ -501,6 +529,7 @@ BOOLEAN MmAreMemoryPagesAvailable(PVOID PageLookupTable, ULONG TotalPageCount, P ULONG Index; StartPage = MmGetPageNumberFromAddress(PageAddress); + StartPage -= MmLowestPhysicalPage; // Make sure they aren't trying to go past the // end of availabe memory diff --git a/boot/freeldr/freeldr/mm/mm.c b/boot/freeldr/freeldr/mm/mm.c index 0066cb98d15..376f4d545b7 100644 --- a/boot/freeldr/freeldr/mm/mm.c +++ b/boot/freeldr/freeldr/mm/mm.c @@ -371,6 +371,17 @@ ExFreePool( MmHeapFree(P); } +#undef ExFreePoolWithTag +NTKERNELAPI +VOID +NTAPI +ExFreePoolWithTag( + IN PVOID P, + IN ULONG Tag) +{ + ExFreePool(P); +} + PVOID NTAPI RtlAllocateHeap( diff --git a/boot/freeldr/freeldr/reactos/arcname.c b/boot/freeldr/freeldr/reactos/arcname.c index 4b7f97addb6..a51218f0e63 100644 --- a/boot/freeldr/freeldr/reactos/arcname.c +++ b/boot/freeldr/freeldr/reactos/arcname.c @@ -21,7 +21,7 @@ #include -BOOLEAN DissectArcPath(CHAR *ArcPath, CHAR *BootPath, ULONG* BootDrive, ULONG* BootPartition) +BOOLEAN DissectArcPath(CHAR *ArcPath, CHAR *BootPath, UCHAR* BootDrive, ULONG* BootPartition) { char *p; @@ -160,7 +160,9 @@ DissectArcPath2( return FALSE; } -VOID ConstructArcPath(PCHAR ArcPath, PCHAR SystemFolder, ULONG Disk, ULONG Partition) + +#if 0 +VOID ConstructArcPath(PCHAR ArcPath, PCHAR SystemFolder, UCHAR Disk, ULONG Partition) { char tmp[50]; @@ -196,10 +198,10 @@ VOID ConstructArcPath(PCHAR ArcPath, PCHAR SystemFolder, ULONG Disk, ULONG Parti } } -ULONG ConvertArcNameToBiosDriveNumber(PCHAR ArcPath) +UCHAR ConvertArcNameToBiosDriveNumber(PCHAR ArcPath) { char * p; - ULONG DriveNumber = 0; + UCHAR DriveNumber = 0; if (_strnicmp(ArcPath, "multi(0)disk(0)", 15) != 0) return 0; @@ -226,3 +228,4 @@ ULONG ConvertArcNameToBiosDriveNumber(PCHAR ArcPath) return DriveNumber; } +#endif diff --git a/boot/freeldr/freeldr/reactos/imageldr.c b/boot/freeldr/freeldr/reactos/imageldr.c deleted file mode 100644 index 296e3afc10a..00000000000 --- a/boot/freeldr/freeldr/reactos/imageldr.c +++ /dev/null @@ -1,785 +0,0 @@ -#ifndef _M_ARM -#include -#include - -extern BOOLEAN FrLdrBootType; - -ULONG_PTR NextModuleBase = KERNEL_BASE_PHYS; -PLOADER_MODULE CurrentModule = NULL; - -PVOID -NTAPI -LdrPEGetExportByName( - IN PVOID BaseAddress, - IN PUCHAR SymbolName, - IN USHORT Hint -); - -extern BOOLEAN FrLdrLoadDriver(PCHAR szFileName, INT nPos); -ULONG Drivers; -PVOID AnsiData, OemData, UnicodeData, RegistryData, KernelData, HalData, DriverData[16]; -ULONG RegistrySize, AnsiSize, OemSize, UnicodeSize, KernelSize, HalSize, DriverSize[16]; -PCHAR DriverName[16]; - -/* MODULE MANAGEMENT **********************************************************/ - -PLOADER_MODULE -NTAPI -LdrGetModuleObject(IN PCHAR ModuleName) -{ - ULONG i; - - for (i = 0; i < LoaderBlock.ModsCount; i++) - { - if (strstr(_strupr((PCHAR)reactos_modules[i].String), _strupr(ModuleName))) - { - return &reactos_modules[i]; - } - } - - return NULL; -} - -NTSTATUS -NTAPI -LdrPEGetOrLoadModule(IN PCHAR ModuleName, - IN PCHAR ImportedName, - IN PLOADER_MODULE* ImportedModule) -{ - NTSTATUS Status = STATUS_SUCCESS; - - *ImportedModule = LdrGetModuleObject(ImportedName); - if (*ImportedModule == NULL) - { - if (!FrLdrLoadDriver(ImportedName, 0)) - { - return STATUS_UNSUCCESSFUL; - } - else - { - return LdrPEGetOrLoadModule(ModuleName, ImportedName, ImportedModule); - } - } - - return Status; -} - -ULONG_PTR -NTAPI -FrLdrLoadModule(PFILE ModuleImage, - LPCSTR ModuleName, - PULONG ModuleSize) -{ - ULONG LocalModuleSize; - PLOADER_MODULE ModuleData; - LPSTR NameBuffer; - LPSTR TempName; - - /* Get current module data structure and module name string array */ - ModuleData = &reactos_modules[LoaderBlock.ModsCount]; - - /* Get only the Module Name */ - do { - - TempName = strchr(ModuleName, '\\'); - - if(TempName) { - ModuleName = TempName + 1; - } - - } while(TempName); - NameBuffer = reactos_module_strings[LoaderBlock.ModsCount]; - - /* Get Module Size */ - LocalModuleSize = FsGetFileSize(ModuleImage); - - /* Fill out Module Data Structure */ - ModuleData->ModStart = NextModuleBase; - ModuleData->ModEnd = NextModuleBase + LocalModuleSize; - - /* Save name */ - strcpy(NameBuffer, ModuleName); - ModuleData->String = (ULONG_PTR)NameBuffer; - - /* NLS detection for NT Loader Block */ - if (!_stricmp(NameBuffer, "ansi.nls")) - { - AnsiData = (PVOID)NextModuleBase; - AnsiSize = LocalModuleSize; - } - else if (!_stricmp(NameBuffer, "oem.nls")) - { - OemData = (PVOID)NextModuleBase; - OemSize = LocalModuleSize; - } - else if (!_stricmp(NameBuffer, "casemap.nls")) - { - UnicodeData = (PVOID)NextModuleBase; - UnicodeSize = LocalModuleSize; - } - else if (!(_stricmp(NameBuffer, "system")) || - !(_stricmp(NameBuffer, "system.hiv"))) - { - RegistryData = (PVOID)NextModuleBase; - RegistrySize = LocalModuleSize; - } - - /* Load the file image */ - FsReadFile(ModuleImage, LocalModuleSize, NULL, (PVOID)NextModuleBase); - - /* Move to next memory block and increase Module Count */ - NextModuleBase = ROUND_UP(ModuleData->ModEnd, PAGE_SIZE); - LoaderBlock.ModsCount++; - // DbgPrint("NextBase, ImageSize, ModStart, ModEnd %p %p %p %p\n", - // NextModuleBase, LocalModuleSize, ModuleData->ModStart, ModuleData->ModEnd); - - /* Return Module Size if required */ - if (ModuleSize != NULL) { - *ModuleSize = LocalModuleSize; - } - - return(ModuleData->ModStart); -} - -ULONG_PTR -NTAPI -FrLdrCreateModule(LPCSTR ModuleName) -{ - PLOADER_MODULE ModuleData; - LPSTR NameBuffer; - - /* Get current module data structure and module name string array */ - ModuleData = &reactos_modules[LoaderBlock.ModsCount]; - NameBuffer = reactos_module_strings[LoaderBlock.ModsCount]; - - /* Set up the structure */ - ModuleData->ModStart = NextModuleBase; - ModuleData->ModEnd = -1; - - /* Copy the name */ - strcpy(NameBuffer, ModuleName); - ModuleData->String = (ULONG_PTR)NameBuffer; - - /* Set the current Module */ - CurrentModule = ModuleData; - - /* Return Module Base Address */ - return(ModuleData->ModStart); -} - -BOOLEAN -NTAPI -FrLdrCloseModule(ULONG_PTR ModuleBase, - ULONG ModuleSize) -{ - PLOADER_MODULE ModuleData = CurrentModule; - - /* Make sure a module is opened */ - if (ModuleData) { - - /* Make sure this is the right module and that it hasn't been closed */ - if ((ModuleBase == ModuleData->ModStart) && (ModuleData->ModEnd == MAXULONG_PTR)) { - - /* Close the Module */ - ModuleData->ModEnd = ModuleData->ModStart + ModuleSize; - - /* Set the next Module Base and increase the number of modules */ - NextModuleBase = ROUND_UP(ModuleData->ModEnd, PAGE_SIZE); - LoaderBlock.ModsCount++; - - /* Close the currently opened module */ - CurrentModule = NULL; - - /* Success */ - return(TRUE); - } - } - - /* Failure path */ - return(FALSE); -} - -/* PE IMAGE LOADER ***********************************************************/ - -PVOID -NTAPI -LdrPEFixupForward(IN PCHAR ForwardName) -{ - CHAR NameBuffer[128]; - PCHAR p; - PLOADER_MODULE ModuleObject; - - strcpy(NameBuffer, ForwardName); - p = strchr(NameBuffer, '.'); - if (p == NULL) return NULL; - *p = 0; - - ModuleObject = LdrGetModuleObject(NameBuffer); - if (!ModuleObject) - { - DbgPrint("LdrPEFixupForward: failed to find module %s\n", NameBuffer); - return NULL; - } - - return LdrPEGetExportByName((PVOID)ModuleObject->ModStart, (PUCHAR)(p + 1), 0xffff); -} - -PVOID -NTAPI -LdrPEGetExportByName(PVOID BaseAddress, - PUCHAR SymbolName, - USHORT Hint) -{ - PIMAGE_EXPORT_DIRECTORY ExportDir; - ULONG * ExFunctions; - ULONG * ExNames; - USHORT * ExOrdinals; - PVOID ExName; - ULONG Ordinal; - PVOID Function; - LONG minn, maxn, mid, res; - ULONG ExportDirSize; - - /* HAL and NTOS use a virtual address, switch it to physical mode */ - if ((ULONG_PTR)BaseAddress & KSEG0_BASE) - { - BaseAddress = RVA(BaseAddress, -KSEG0_BASE); - } - - ExportDir = (PIMAGE_EXPORT_DIRECTORY) - RtlImageDirectoryEntryToData(BaseAddress, - TRUE, - IMAGE_DIRECTORY_ENTRY_EXPORT, - &ExportDirSize); - if (!ExportDir) - { - DbgPrint("LdrPEGetExportByName(): no export directory!\n"); - return NULL; - } - - /* The symbol names may be missing entirely */ - if (!ExportDir->AddressOfNames) - { - DbgPrint("LdrPEGetExportByName(): symbol names missing entirely\n"); - return NULL; - } - - /* - * Get header pointers - */ - ExNames = (ULONG *)RVA(BaseAddress, ExportDir->AddressOfNames); - ExOrdinals = (USHORT *)RVA(BaseAddress, ExportDir->AddressOfNameOrdinals); - ExFunctions = (ULONG *)RVA(BaseAddress, ExportDir->AddressOfFunctions); - - /* - * Check the hint first - */ - if (Hint < ExportDir->NumberOfNames) - { - ExName = RVA(BaseAddress, ExNames[Hint]); - if (strcmp(ExName, (PCHAR)SymbolName) == 0) - { - Ordinal = ExOrdinals[Hint]; - Function = RVA(BaseAddress, ExFunctions[Ordinal]); - if ((ULONG_PTR)Function >= (ULONG_PTR)ExportDir && - (ULONG_PTR)Function < (ULONG_PTR)ExportDir + ExportDirSize) - { - Function = LdrPEFixupForward((PCHAR)Function); - if (Function == NULL) - { - DbgPrint("LdrPEGetExportByName(): failed to find %s\n", Function); - } - return Function; - } - - if (Function != NULL) return Function; - } - } - - /* - * Binary search - */ - minn = 0; - maxn = ExportDir->NumberOfNames - 1; - while (minn <= maxn) - { - mid = (minn + maxn) / 2; - - ExName = RVA(BaseAddress, ExNames[mid]); - res = strcmp(ExName, (PCHAR)SymbolName); - if (res == 0) - { - Ordinal = ExOrdinals[mid]; - Function = RVA(BaseAddress, ExFunctions[Ordinal]); - if ((ULONG_PTR)Function >= (ULONG_PTR)ExportDir && - (ULONG_PTR)Function < (ULONG_PTR)ExportDir + ExportDirSize) - { - Function = LdrPEFixupForward((PCHAR)Function); - if (Function == NULL) - { - DbgPrint("1: failed to find %s\n", Function); - } - return Function; - } - if (Function != NULL) - { - return Function; - } - } - else if (res > 0) - { - maxn = mid - 1; - } - else - { - minn = mid + 1; - } - } - - ExName = RVA(BaseAddress, ExNames[mid]); - DbgPrint("2: failed to find %s\n",SymbolName); - return (PVOID)NULL; -} - -NTSTATUS -NTAPI -LdrPEProcessImportDirectoryEntry(PVOID DriverBase, - PLOADER_MODULE LoaderModule, - PIMAGE_IMPORT_DESCRIPTOR ImportModuleDirectory) -{ - PVOID* ImportAddressList; - PULONG_PTR FunctionNameList; - - if (ImportModuleDirectory == NULL || ImportModuleDirectory->Name == 0) - { - return STATUS_UNSUCCESSFUL; - } - - /* Get the import address list. */ - ImportAddressList = (PVOID*)RVA(DriverBase, ImportModuleDirectory->FirstThunk); - - /* Get the list of functions to import. */ - if (ImportModuleDirectory->OriginalFirstThunk != 0) - { - FunctionNameList = (PULONG_PTR)RVA(DriverBase, ImportModuleDirectory->OriginalFirstThunk); - } - else - { - FunctionNameList = (PULONG_PTR)RVA(DriverBase, ImportModuleDirectory->FirstThunk); - } - - /* Walk through function list and fixup addresses. */ - while (*FunctionNameList != 0L) - { - if ((*FunctionNameList) & 0x80000000) - { - DbgPrint("Failed to import ordinal from %s\n", LoaderModule->String); - return STATUS_UNSUCCESSFUL; - } - else - { - IMAGE_IMPORT_BY_NAME *pe_name; - pe_name = RVA(DriverBase, *FunctionNameList); - *ImportAddressList = LdrPEGetExportByName((PVOID)LoaderModule->ModStart, pe_name->Name, pe_name->Hint); - - /* Fixup the address to be virtual */ - *ImportAddressList = RVA(*ImportAddressList, KSEG0_BASE); - - //DbgPrint("Looked for: %s and found: %p\n", pe_name->Name, *ImportAddressList); - if ((*ImportAddressList) == NULL) - { - DbgPrint("Failed to import %s from %s\n", pe_name->Name, LoaderModule->String); - return STATUS_UNSUCCESSFUL; - } - } - ImportAddressList++; - FunctionNameList++; - } - return STATUS_SUCCESS; -} - -NTSTATUS -NTAPI -LdrPEFixupImports(IN PVOID DllBase, - IN PCHAR DllName) -{ - PIMAGE_IMPORT_DESCRIPTOR ImportModuleDirectory; - PCHAR ImportedName; - NTSTATUS Status; - PLOADER_MODULE ImportedModule; - ULONG Size; - - /* Process each import module */ - ImportModuleDirectory = (PIMAGE_IMPORT_DESCRIPTOR) - RtlImageDirectoryEntryToData(DllBase, - TRUE, - IMAGE_DIRECTORY_ENTRY_IMPORT, - &Size); - while (ImportModuleDirectory && ImportModuleDirectory->Name) - { - /* Check to make sure that import lib is kernel */ - ImportedName = (PCHAR) DllBase + ImportModuleDirectory->Name; - //DbgPrint("Processing imports for file: %s into file: %s\n", DllName, ImportedName); - - Status = LdrPEGetOrLoadModule(DllName, ImportedName, &ImportedModule); - if (!NT_SUCCESS(Status)) return Status; - - Status = LdrPEProcessImportDirectoryEntry(DllBase, ImportedModule, ImportModuleDirectory); - if (!NT_SUCCESS(Status)) return Status; - - //DbgPrint("Imports for file: %s into file: %s complete\n", DllName, ImportedName); - ImportModuleDirectory++; - } - - return STATUS_SUCCESS; -} - -PVOID -NTAPI -FrLdrReadAndMapImage(IN PFILE Image, - IN PCHAR Name, - IN ULONG ImageType) -{ - PVOID ImageBase, LoadBase, ReadBuffer; - ULONG ImageId = LoaderBlock.ModsCount; - ULONG i, Size, ImageSize, SizeOfHeaders; - PIMAGE_NT_HEADERS NtHeader; - PIMAGE_SECTION_HEADER Section; - NTSTATUS Status = STATUS_SUCCESS; - PLOADER_MODULE pModule; - - /* Try to see, maybe it's loaded already */ - if ((pModule = LdrGetModuleObject(Name)) != NULL) - { - /* It's loaded, return LoadBase */ - ImageBase = (PVOID)pModule->ModStart; - LoadBase = RVA(ImageBase, -KSEG0_BASE); - return LoadBase; - } - - /* Set the virtual (image) and physical (load) addresses */ - LoadBase = (PVOID)NextModuleBase; - ImageBase = RVA(LoadBase, KSEG0_BASE); - - /* Allocate a temporary buffer for the read */ - ReadBuffer = MmHeapAlloc(MM_PAGE_SIZE); - if (!ReadBuffer) - { - /* Fail */ - DbgPrint("Failed to allocate a temporary buffer for the read\n"); - return NULL; - } - - /* Set the file pointer to zero */ - FsSetFilePointer(Image, 0); - - /* Load first page of the file image */ - if (!FsReadFile(Image, MM_PAGE_SIZE, NULL, ReadBuffer)) - { - /* Fail */ - DbgPrint("Failed to read image: %s\n", Name); - return NULL; - } - - /* Get image headers */ - NtHeader = RtlImageNtHeader(ReadBuffer); - if (!NtHeader) - { - DbgPrint("Failed to read image (bad PE signature) %s\n", Name); - return NULL; - } - - /* Allocate memory for the driver */ - ImageSize = NtHeader->OptionalHeader.SizeOfImage; - LoadBase = MmAllocateMemoryAtAddress(ImageSize, LoadBase, LoaderSystemCode); - ASSERT(LoadBase); - - /* Copy headers over */ - SizeOfHeaders = NtHeader->OptionalHeader.SizeOfHeaders; - if (SizeOfHeaders < MM_PAGE_SIZE) - { - RtlMoveMemory(LoadBase, ReadBuffer, SizeOfHeaders); - } - else - { - RtlMoveMemory(LoadBase, ReadBuffer, MM_PAGE_SIZE); - if (!FsReadFile(Image, SizeOfHeaders - MM_PAGE_SIZE, NULL, - (PVOID)((ULONG_PTR)LoadBase + MM_PAGE_SIZE))) - { - DbgPrint("Failed to read image: %s\n", Name); - return NULL; - } - } - - /* Free the temporary buffer */ - MmHeapFree(ReadBuffer); - - /* Get the first section */ - NtHeader = RtlImageNtHeader(LoadBase); - Section = IMAGE_FIRST_SECTION(NtHeader); - - /* Read image sections into virtual section */ - for (i = 0; i < NtHeader->FileHeader.NumberOfSections; i++) - { - /* Get the size of this section and check if it's valid */ - Size = Section[i].VirtualAddress + Section[i].Misc.VirtualSize; - if (Size <= ImageSize) - { - if (Section[i].SizeOfRawData) - { - /* Copy the data from the disk to the image */ - FsSetFilePointer(Image, Section[i].PointerToRawData); - if (!FsReadFile(Image, - Section[i].Misc.VirtualSize > - Section[i].SizeOfRawData ? - Section[i].SizeOfRawData : - Section[i].Misc.VirtualSize, - NULL, - (PVOID)((ULONG_PTR)LoadBase + - Section[i].VirtualAddress))) - { - DbgPrint("Failed to read image: %s\n", Name); - return NULL; - } - } - else - { - /* Clear the BSS area */ - RtlZeroMemory((PVOID)((ULONG_PTR)LoadBase + - Section[i].VirtualAddress), - Section[i].Misc.VirtualSize); - } - } - else - { - DbgPrint("Section %s in %s doesn't fit: VA: %lx, Size: %lx\n", - Section[i].Name, Name, Section[i].VirtualAddress, - Section[i].Misc.VirtualSize); - } - } - - /* Calculate Difference between Real Base and Compiled Base*/ - Status = LdrRelocateImageWithBias(LoadBase, - (ULONG_PTR)ImageBase - - (ULONG_PTR)LoadBase, - "FreeLdr", - STATUS_SUCCESS, -#ifdef _M_AMD64 - STATUS_SUCCESS, // allow stripped files -#else - STATUS_UNSUCCESSFUL, -#endif - STATUS_UNSUCCESSFUL); - if (!NT_SUCCESS(Status)) - { - /* Fail */ - DbgPrint("Failed to relocate image: %s\n", Name); - return NULL; - } - - /* Fill out Module Data Structure */ - reactos_modules[ImageId].ModStart = (ULONG_PTR)ImageBase; - reactos_modules[ImageId].ModEnd = (ULONG_PTR)ImageBase + ImageSize; - strcpy(reactos_module_strings[ImageId], Name); - reactos_modules[ImageId].String = (ULONG_PTR)reactos_module_strings[ImageId]; - LoaderBlock.ModsCount++; - - /* Detect kernel or HAL */ - if (!_stricmp(Name, "ntoskrnl.exe")) - { - KernelData = (PVOID)NextModuleBase; - KernelSize = ImageSize; - } - else if (!_stricmp(Name, "hal.dll")) - { - HalData = (PVOID)NextModuleBase; - HalSize = ImageSize; - } - else - { - DriverName[Drivers] = reactos_module_strings[ImageId]; - DriverData[Drivers] = (PVOID)NextModuleBase; - DriverSize[Drivers] = ImageSize; - Drivers++; - } - - /* Increase the next Load Base */ - NextModuleBase = ROUND_UP(NextModuleBase + ImageSize, PAGE_SIZE); - - /* Perform import fixups */ - if (!NT_SUCCESS(LdrPEFixupImports(LoadBase, Name))) - { - /* Fixup failed, just don't include it in the list */ - // NextModuleBase = OldNextModuleBase; - LoaderBlock.ModsCount = ImageId; - return NULL; - } - - /* Return the final mapped address */ - return LoadBase; -} - -ULONG -NTAPI -FrLdrReMapImage(IN PVOID Base, - IN PVOID LoadBase) -{ - PIMAGE_NT_HEADERS NtHeader; - PIMAGE_SECTION_HEADER Section; - ULONG i, Size, DriverSize = 0; - - /* Get the first section */ - NtHeader = RtlImageNtHeader(Base); - Section = IMAGE_FIRST_SECTION(NtHeader); - - /* Allocate memory for the driver */ - DriverSize = NtHeader->OptionalHeader.SizeOfImage; - LoadBase = MmAllocateMemoryAtAddress(DriverSize, LoadBase, LoaderSystemCode); - ASSERT(LoadBase); - - /* Copy headers over */ - RtlMoveMemory(LoadBase, Base, NtHeader->OptionalHeader.SizeOfHeaders); - - /* Copy image sections into virtual section */ - for (i = 0; i < NtHeader->FileHeader.NumberOfSections; i++) - { - /* Get the size of this section and check if it's valid */ - Size = Section[i].VirtualAddress + Section[i].Misc.VirtualSize; - if (Size <= DriverSize) - { - if (Section[i].SizeOfRawData) - { - /* Copy the data from the disk to the image */ - RtlCopyMemory((PVOID)((ULONG_PTR)LoadBase + - Section[i].VirtualAddress), - (PVOID)((ULONG_PTR)Base + - Section[i].PointerToRawData), - Section[i].Misc.VirtualSize > - Section[i].SizeOfRawData ? - Section[i].SizeOfRawData : - Section[i].Misc.VirtualSize); - } - else - { - /* Clear the BSS area */ - RtlZeroMemory((PVOID)((ULONG_PTR)LoadBase + - Section[i].VirtualAddress), - Section[i].Misc.VirtualSize); - } - } - } - - /* Return the size of the mapped driver */ - return DriverSize; -} - -PVOID -NTAPI -FrLdrMapImage(IN PFILE Image, - IN PCHAR Name, - IN ULONG ImageType) -{ - PVOID ImageBase, LoadBase, ReadBuffer; - ULONG ImageId = LoaderBlock.ModsCount; - ULONG ImageSize; - NTSTATUS Status = STATUS_SUCCESS; - - /* Try to see, maybe it's loaded already */ - if (LdrGetModuleObject(Name) != NULL) - { - /* It's loaded, return NULL. It would be wise to return - correct LoadBase, but it seems to be ignored almost everywhere */ - return NULL; - } - - /* Set the virtual (image) and physical (load) addresses */ - LoadBase = (PVOID)NextModuleBase; - ImageBase = RVA(LoadBase, KSEG0_BASE); - - /* Save the Image Size */ - ImageSize = FsGetFileSize(Image); - - /* Set the file pointer to zero */ - FsSetFilePointer(Image, 0); - - /* Allocate a temporary buffer for the read */ - ReadBuffer = MmHeapAlloc(ImageSize); - if (!ReadBuffer) - { - /* Fail */ - DbgPrint("Failed to allocate a temporary buffer for the read\n"); - return NULL; - } - - /* Load the file image */ - if (!FsReadFile(Image, ImageSize, NULL, ReadBuffer)) - { - /* Fail */ - DbgPrint("Failed to read image: %s\n", Name); - return NULL; - } - - /* Map it into virtual memory */ - ImageSize = FrLdrReMapImage(ReadBuffer, LoadBase); - - /* Free the temporary buffer */ - MmHeapFree(ReadBuffer); - - /* Calculate Difference between Real Base and Compiled Base*/ - Status = LdrRelocateImageWithBias(LoadBase, - (ULONG_PTR)ImageBase - - (ULONG_PTR)LoadBase, - "FreeLdr", - STATUS_SUCCESS, - STATUS_UNSUCCESSFUL, - STATUS_UNSUCCESSFUL); - if (!NT_SUCCESS(Status)) - { - /* Fail */ - DbgPrint("Failed to relocate image: %s\n", Name); - return NULL; - } - - /* Fill out Module Data Structure */ - reactos_modules[ImageId].ModStart = (ULONG_PTR)ImageBase; - reactos_modules[ImageId].ModEnd = (ULONG_PTR)ImageBase + ImageSize; - strcpy(reactos_module_strings[ImageId], Name); - reactos_modules[ImageId].String = (ULONG_PTR)reactos_module_strings[ImageId]; - LoaderBlock.ModsCount++; - - /* Detect kernel or HAL */ - if (!_stricmp(Name, "ntoskrnl.exe")) - { - KernelData = (PVOID)NextModuleBase; - KernelSize = ImageSize; - } - else if (!_stricmp(Name, "hal.dll")) - { - HalData = (PVOID)NextModuleBase; - HalSize = ImageSize; - } - else - { - DriverName[Drivers] = reactos_module_strings[ImageId]; - DriverData[Drivers] = (PVOID)NextModuleBase; - DriverSize[Drivers] = ImageSize; - Drivers++; - } - - /* Increase the next Load Base */ - NextModuleBase = ROUND_UP(NextModuleBase + ImageSize, PAGE_SIZE); - - /* Perform import fixups */ - if (!NT_SUCCESS(LdrPEFixupImports(LoadBase, Name))) - { - /* Fixup failed, just don't include it in the list */ - // NextModuleBase = OldNextModuleBase; - LoaderBlock.ModsCount = ImageId; - return NULL; - } - - /* Return the final mapped address */ - return LoadBase; -} -#endif -/* EOF */ diff --git a/boot/freeldr/freeldr/reactos/reactos.c b/boot/freeldr/freeldr/reactos/reactos.c deleted file mode 100644 index 959dc22b05e..00000000000 --- a/boot/freeldr/freeldr/reactos/reactos.c +++ /dev/null @@ -1,908 +0,0 @@ -/* - * FreeLoader - * - * Copyright (C) 1998-2003 Brian Palmer - * Copyright (C) 2005 Alex Ionescu - * - * This 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. - * - * This 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. - * - * You 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. - */ -#ifndef _M_ARM - -#include -#include - -extern ULONG PageDirectoryStart; -extern ULONG PageDirectoryEnd; - -ROS_LOADER_PARAMETER_BLOCK LoaderBlock; -char reactos_kernel_cmdline[255]; // Command line passed to kernel -LOADER_MODULE reactos_modules[64]; // Array to hold boot module info loaded for the kernel -char reactos_module_strings[64][256]; // Array to hold module names -// Make this a single struct to guarantee that these elements are nearby in -// memory. -reactos_mem_data_t reactos_mem_data; -ARC_DISK_SIGNATURE reactos_arc_disk_info[32]; // ARC Disk Information -char reactos_arc_strings[32][256]; -unsigned long reactos_disk_count = 0; -char reactos_arc_hardware_data[HW_MAX_ARC_HEAP_SIZE] = {0}; - -CHAR szHalName[255]; -CHAR szBootPath[255]; -CHAR SystemRoot[255]; -static CHAR szLoadingMsg[] = "ReactOS is loading files..."; -BOOLEAN FrLdrBootType; -ULONG_PTR KernelBase; -ROS_KERNEL_ENTRY_POINT KernelEntryPoint; - -BOOLEAN -FrLdrLoadDriver(PCHAR szFileName, - INT nPos) -{ - PFILE FilePointer; - CHAR value[256], *FinalSlash; - LPSTR p; - - if (!_stricmp(szFileName, "hal.dll")) - { - /* Use the boot.ini name instead */ - szFileName = szHalName; - } - - FinalSlash = strrchr(szFileName, '\\'); - if(FinalSlash) - szFileName = FinalSlash + 1; - - /* Open the Driver */ - FilePointer = FsOpenFile(szFileName); - - /* Try under the system root in the main dir and drivers */ - if (!FilePointer) - { - strcpy(value, SystemRoot); - if(value[strlen(value)-1] != '\\') - strcat(value, "\\"); - strcat(value, szFileName); - FilePointer = FsOpenFile(value); - } - - if (!FilePointer) - { - strcpy(value, SystemRoot); - if(value[strlen(value)-1] != '\\') - strcat(value, "\\"); - strcat(value, "SYSTEM32\\"); - strcat(value, szFileName); - FilePointer = FsOpenFile(value); - } - - if (!FilePointer) - { - strcpy(value, SystemRoot); - if(value[strlen(value)-1] != '\\') - strcat(value, "\\"); - strcat(value, "SYSTEM32\\DRIVERS\\"); - strcat(value, szFileName); - FilePointer = FsOpenFile(value); - } - - /* Make sure we did */ - if (!FilePointer) { - - /* Fail if file wasn't opened */ - strcpy(value, szFileName); - strcat(value, " not found."); - return(FALSE); - } - - /* Update the status bar with the current file */ - strcpy(value, "Reading "); - p = strrchr(szFileName, '\\'); - if (p == NULL) { - - strcat(value, szFileName); - - } else { - - strcat(value, p + 1); - - } - UiDrawStatusText(value); - - /* Load the driver */ - FrLdrReadAndMapImage(FilePointer, szFileName, 0); - - /* Update status and return */ - UiDrawProgressBarCenter(nPos, 100, szLoadingMsg); - return(TRUE); -} - -PVOID -NTAPI -FrLdrLoadImage(IN PCHAR szFileName, - IN INT nPos, - IN ULONG ImageType) -{ - PFILE FilePointer; - PCHAR szShortName; - CHAR szBuffer[256], szFullPath[256]; - PVOID LoadBase; - - /* Extract filename without path */ - szShortName = strrchr(szFileName, '\\'); - if (!szShortName) - { - /* No path, leave it alone */ - szShortName = szFileName; - - /* Which means we need to build a path now */ - strcpy(szBuffer, szFileName); - strcpy(szFullPath, szBootPath); - if (!FrLdrBootType) - { - strcat(szFullPath, "SYSTEM32\\DRIVERS\\"); - } - else - { - strcat(szFullPath, "\\"); - } - strcat(szFullPath, szBuffer); - szFileName = szFullPath; - } - else - { - /* Skip the path */ - szShortName = szShortName + 1; - } - - /* Open the image */ - FilePointer = FsOpenFile(szFileName); - if (!FilePointer) - { - /* Return failure on the short name */ - strcpy(szBuffer, szShortName); - strcat(szBuffer, " not found."); - UiMessageBox(szBuffer); - return FALSE; - } - - /* Update the status bar with the current file */ - strcpy(szBuffer, "Reading "); - strcat(szBuffer, szShortName); - UiDrawStatusText(szBuffer); - - /* Do the actual loading */ - LoadBase = FrLdrReadAndMapImage(FilePointer, szShortName, ImageType); - - /* Update Processbar and return success */ - if (!FrLdrBootType) UiDrawProgressBarCenter(nPos, 100, szLoadingMsg); - return LoadBase; -} - -BOOLEAN -FrLdrLoadNlsFile(PCSTR szFileName, - PCSTR szModuleName) -{ - PFILE FilePointer; - CHAR value[256]; - LPSTR p; - - /* Open the Driver */ - FilePointer = FsOpenFile(szFileName); - - /* Make sure we did */ - if (!FilePointer) { - - /* Fail if file wasn't opened */ - strcpy(value, szFileName); - strcat(value, " not found."); - UiMessageBox(value); - return(FALSE); - } - - /* Update the status bar with the current file */ - strcpy(value, "Reading "); - p = strrchr(szFileName, '\\'); - if (p == NULL) { - - strcat(value, szFileName); - - } else { - - strcat(value, p + 1); - } - UiDrawStatusText(value); - - /* Load the driver */ - FrLdrLoadModule(FilePointer, szModuleName, NULL); - return(TRUE); -} - -static BOOLEAN -FrLdrLoadNlsFiles(PCHAR szSystemRoot, - PCHAR szErrorOut) -{ - LONG rc = ERROR_SUCCESS; - FRLDRHKEY hKey; - WCHAR szIdBuffer[80]; - WCHAR szNameBuffer[80]; - CHAR szFileName[256]; - ULONG BufferSize; - - /* open the codepage key */ - rc = RegOpenKey(NULL, - L"\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\NLS\\CodePage", - &hKey); - if (rc != ERROR_SUCCESS) { - - strcpy(szErrorOut, "Couldn't open CodePage registry key"); - return(FALSE); - } - - /* get ANSI codepage */ - BufferSize = sizeof(szIdBuffer); - rc = RegQueryValue(hKey, L"ACP", NULL, (PUCHAR)szIdBuffer, &BufferSize); - if (rc != ERROR_SUCCESS) { - - strcpy(szErrorOut, "Couldn't get ACP NLS setting"); - return(FALSE); - } - - BufferSize = sizeof(szNameBuffer); - rc = RegQueryValue(hKey, szIdBuffer, NULL, (PUCHAR)szNameBuffer, &BufferSize); - if (rc != ERROR_SUCCESS) { - - //strcpy(szErrorOut, "ACP NLS Setting exists, but isn't readable"); - //return(FALSE); - - /* HACK */ - wcscpy(szNameBuffer, L"c_1252.nls"); - } - - /* load ANSI codepage table */ - sprintf(szFileName,"%ssystem32\\%S", szSystemRoot, szNameBuffer); - DPRINTM(DPRINT_REACTOS, "ANSI file: %s\n", szFileName); - if (!FrLdrLoadNlsFile(szFileName, "ansi.nls")) { - - strcpy(szErrorOut, "Couldn't load ansi.nls"); - return(FALSE); - } - - /* get OEM codepage */ - BufferSize = sizeof(szIdBuffer); - rc = RegQueryValue(hKey, L"OEMCP", NULL, (PUCHAR)szIdBuffer, &BufferSize); - if (rc != ERROR_SUCCESS) { - - strcpy(szErrorOut, "Couldn't get OEMCP NLS setting"); - return(FALSE); - } - - BufferSize = sizeof(szNameBuffer); - rc = RegQueryValue(hKey, szIdBuffer, NULL, (PUCHAR)szNameBuffer, &BufferSize); - if (rc != ERROR_SUCCESS) { - - //strcpy(szErrorOut, "OEMCP NLS setting exists, but isn't readable"); - //return(FALSE); - - /* HACK */ - wcscpy(szNameBuffer, L"c_437.nls"); - } - - /* load OEM codepage table */ - sprintf(szFileName, "%ssystem32\\%S", szSystemRoot, szNameBuffer); - DPRINTM(DPRINT_REACTOS, "Oem file: %s\n", szFileName); - if (!FrLdrLoadNlsFile(szFileName, "oem.nls")) { - - strcpy(szErrorOut, "Couldn't load oem.nls"); - return(FALSE); - } - - /* open the language key */ - rc = RegOpenKey(NULL, - L"\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\NLS\\Language", - &hKey); - if (rc != ERROR_SUCCESS) { - - strcpy(szErrorOut, "Couldn't open Language registry key"); - return(FALSE); - } - - /* get the Unicode case table */ - BufferSize = sizeof(szIdBuffer); - rc = RegQueryValue(hKey, L"Default", NULL, (PUCHAR)szIdBuffer, &BufferSize); - if (rc != ERROR_SUCCESS) { - - strcpy(szErrorOut, "Couldn't get Language Default setting"); - return(FALSE); - } - - BufferSize = sizeof(szNameBuffer); - rc = RegQueryValue(hKey, szIdBuffer, NULL, (PUCHAR)szNameBuffer, &BufferSize); - if (rc != ERROR_SUCCESS) { - - sprintf(szErrorOut, "Language Default setting exists, but isn't readable (%S)", szIdBuffer); - return(FALSE); - } - - /* load Unicode case table */ - sprintf(szFileName, "%ssystem32\\%S", szSystemRoot, szNameBuffer); - DPRINTM(DPRINT_REACTOS, "Casemap file: %s\n", szFileName); - if (!FrLdrLoadNlsFile(szFileName, "casemap.nls")) { - - strcpy(szErrorOut, "casemap.nls"); - return(FALSE); - } - - return(TRUE); -} - -static VOID -FrLdrLoadBootDrivers(PCHAR szSystemRoot, - INT nPos) -{ - LONG rc = 0; - FRLDRHKEY hGroupKey, hOrderKey, hServiceKey, hDriverKey; - WCHAR GroupNameBuffer[512]; - WCHAR ServiceName[256]; - ULONG OrderList[128]; - ULONG BufferSize; - ULONG Index; - ULONG TagIndex; - LPWSTR GroupName; - - ULONG ValueSize; - ULONG ValueType; - ULONG StartValue; - ULONG TagValue; - WCHAR DriverGroup[256]; - ULONG DriverGroupSize; - - CHAR ImagePath[256]; - WCHAR TempImagePath[256]; - - /* get 'service group order' key */ - rc = RegOpenKey(NULL, - L"\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\ServiceGroupOrder", - &hGroupKey); - if (rc != ERROR_SUCCESS) { - - DPRINTM(DPRINT_REACTOS, "Failed to open the 'ServiceGroupOrder' key (rc %d)\n", (int)rc); - return; - } - - /* get 'group order list' key */ - rc = RegOpenKey(NULL, - L"\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\GroupOrderList", - &hOrderKey); - if (rc != ERROR_SUCCESS) { - - DPRINTM(DPRINT_REACTOS, "Failed to open the 'GroupOrderList' key (rc %d)\n", (int)rc); - return; - } - - /* enumerate drivers */ - rc = RegOpenKey(NULL, - L"\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Services", - &hServiceKey); - if (rc != ERROR_SUCCESS) { - - DPRINTM(DPRINT_REACTOS, "Failed to open the 'Services' key (rc %d)\n", (int)rc); - return; - } - - /* Get the Name Group */ - BufferSize = sizeof(GroupNameBuffer); - rc = RegQueryValue(hGroupKey, L"List", NULL, (PUCHAR)GroupNameBuffer, &BufferSize); - DPRINTM(DPRINT_REACTOS, "RegQueryValue(): rc %d\n", (int)rc); - if (rc != ERROR_SUCCESS) return; - DPRINTM(DPRINT_REACTOS, "BufferSize: %d \n", (int)BufferSize); - DPRINTM(DPRINT_REACTOS, "GroupNameBuffer: '%S' \n", GroupNameBuffer); - - /* Loop through each group */ - GroupName = GroupNameBuffer; - while (*GroupName) { - DPRINTM(DPRINT_REACTOS, "Driver group: '%S'\n", GroupName); - - /* Query the Order */ - BufferSize = sizeof(OrderList); - rc = RegQueryValue(hOrderKey, GroupName, NULL, (PUCHAR)OrderList, &BufferSize); - if (rc != ERROR_SUCCESS) OrderList[0] = 0; - - /* enumerate all drivers */ - for (TagIndex = 1; TagIndex <= SWAPD(OrderList[0]); TagIndex++) { - - Index = 0; - - while (TRUE) { - - /* Get the Driver's Name */ - ValueSize = sizeof(ServiceName); - rc = RegEnumKey(hServiceKey, Index, ServiceName, &ValueSize); - DPRINTM(DPRINT_REACTOS, "RegEnumKey(): rc %d\n", (int)rc); - - /* Makre sure it's valid, and check if we're done */ - if (rc == ERROR_NO_MORE_ITEMS) break; - if (rc != ERROR_SUCCESS) return; - DPRINTM(DPRINT_REACTOS, "Service %d: '%S'\n", (int)Index, ServiceName); - - /* open driver Key */ - rc = RegOpenKey(hServiceKey, ServiceName, &hDriverKey); - if (rc == ERROR_SUCCESS) - { - /* Read the Start Value */ - ValueSize = sizeof(ULONG); - rc = RegQueryValue(hDriverKey, L"Start", &ValueType, (PUCHAR)&StartValue, &ValueSize); - if (rc != ERROR_SUCCESS) StartValue = (ULONG)-1; - DPRINTM(DPRINT_REACTOS, " Start: %x \n", (int)StartValue); - - /* Read the Tag */ - ValueSize = sizeof(ULONG); - rc = RegQueryValue(hDriverKey, L"Tag", &ValueType, (PUCHAR)&TagValue, &ValueSize); - if (rc != ERROR_SUCCESS) TagValue = (ULONG)-1; - DPRINTM(DPRINT_REACTOS, " Tag: %x \n", (int)TagValue); - - /* Read the driver's group */ - DriverGroupSize = sizeof(DriverGroup); - rc = RegQueryValue(hDriverKey, L"Group", NULL, (PUCHAR)DriverGroup, &DriverGroupSize); - DPRINTM(DPRINT_REACTOS, " Group: '%S' \n", DriverGroup); - - /* Make sure it should be started */ - if ((StartValue == 0) && - (TagValue == OrderList[TagIndex]) && - (_wcsicmp(DriverGroup, GroupName) == 0)) { - - /* Get the Driver's Location */ - ValueSize = sizeof(TempImagePath); - rc = RegQueryValue(hDriverKey, L"ImagePath", NULL, (PUCHAR)TempImagePath, &ValueSize); - - /* Write the whole path if it suceeded, else prepare to fail */ - if (rc != ERROR_SUCCESS) { - DPRINTM(DPRINT_REACTOS, " ImagePath: not found\n"); - sprintf(ImagePath, "%s\\system32\\drivers\\%S.sys", szSystemRoot, ServiceName); - } else if (TempImagePath[0] != L'\\') { - sprintf(ImagePath, "%s%S", szSystemRoot, TempImagePath); - } else { - sprintf(ImagePath, "%S", TempImagePath); - DPRINTM(DPRINT_REACTOS, " ImagePath: '%s'\n", ImagePath); - } - - DPRINTM(DPRINT_REACTOS, " Loading driver: '%s'\n", ImagePath); - - /* Update the position if needed */ - if (nPos < 100) nPos += 5; - - FrLdrLoadImage(ImagePath, nPos, 2); - - } else { - - DPRINTM(DPRINT_REACTOS, " Skipping driver '%S' with Start %d, Tag %d and Group '%S' (Current Tag %d, current group '%S')\n", - ServiceName, StartValue, TagValue, DriverGroup, OrderList[TagIndex], GroupName); - } - } - - Index++; - } - } - - Index = 0; - while (TRUE) { - - /* Get the Driver's Name */ - ValueSize = sizeof(ServiceName); - rc = RegEnumKey(hServiceKey, Index, ServiceName, &ValueSize); - - DPRINTM(DPRINT_REACTOS, "RegEnumKey(): rc %d\n", (int)rc); - if (rc == ERROR_NO_MORE_ITEMS) break; - if (rc != ERROR_SUCCESS) return; - DPRINTM(DPRINT_REACTOS, "Service %d: '%S'\n", (int)Index, ServiceName); - - /* open driver Key */ - rc = RegOpenKey(hServiceKey, ServiceName, &hDriverKey); - if (rc == ERROR_SUCCESS) - { - /* Read the Start Value */ - ValueSize = sizeof(ULONG); - rc = RegQueryValue(hDriverKey, L"Start", &ValueType, (PUCHAR)&StartValue, &ValueSize); - if (rc != ERROR_SUCCESS) StartValue = (ULONG)-1; - DPRINTM(DPRINT_REACTOS, " Start: %x \n", (int)StartValue); - - /* Read the Tag */ - ValueSize = sizeof(ULONG); - rc = RegQueryValue(hDriverKey, L"Tag", &ValueType, (PUCHAR)&TagValue, &ValueSize); - if (rc != ERROR_SUCCESS) TagValue = (ULONG)-1; - DPRINTM(DPRINT_REACTOS, " Tag: %x \n", (int)TagValue); - - /* Read the driver's group */ - DriverGroupSize = sizeof(DriverGroup); - rc = RegQueryValue(hDriverKey, L"Group", NULL, (PUCHAR)DriverGroup, &DriverGroupSize); - DPRINTM(DPRINT_REACTOS, " Group: '%S' \n", DriverGroup); - - for (TagIndex = 1; TagIndex <= OrderList[0]; TagIndex++) { - if (TagValue == OrderList[TagIndex]) break; - } - - if ((StartValue == 0) && - (TagIndex > OrderList[0]) && - (_wcsicmp(DriverGroup, GroupName) == 0)) { - - ValueSize = sizeof(TempImagePath); - rc = RegQueryValue(hDriverKey, L"ImagePath", NULL, (PUCHAR)TempImagePath, &ValueSize); - if (rc != ERROR_SUCCESS) { - DPRINTM(DPRINT_REACTOS, " ImagePath: not found\n"); - sprintf(ImagePath, "%ssystem32\\drivers\\%S.sys", szSystemRoot, ServiceName); - } else if (TempImagePath[0] != L'\\') { - sprintf(ImagePath, "%s%S", szSystemRoot, TempImagePath); - } else { - sprintf(ImagePath, "%S", TempImagePath); - DPRINTM(DPRINT_REACTOS, " ImagePath: '%s'\n", ImagePath); - } - DPRINTM(DPRINT_REACTOS, " Loading driver: '%s'\n", ImagePath); - - if (nPos < 100) nPos += 5; - - FrLdrLoadImage(ImagePath, nPos, 2); - - } else { - - DPRINTM(DPRINT_REACTOS, " Skipping driver '%S' with Start %d, Tag %d and Group '%S' (Current group '%S')\n", - ServiceName, StartValue, TagValue, DriverGroup, GroupName); - } - } - - Index++; - } - - /* Move to the next group name */ - GroupName = GroupName + wcslen(GroupName) + 1; - } -} - -VOID -LoadAndBootReactOS(PCSTR OperatingSystemName) -{ - PFILE FilePointer; - CHAR name[255]; - CHAR value[255]; - CHAR SystemPath[255]; - CHAR LivePath[255]; - CHAR szKernelName[255]; - CHAR szFileName[255]; - CHAR MsgBuffer[256]; - ULONG_PTR SectionId; - PIMAGE_NT_HEADERS NtHeader; - PVOID LoadBase; - ULONG_PTR Base; - ULONG Size; - - // - // Backdrop - // - UiDrawBackdrop(); - - // - // Open the operating system section - // specified in the .ini file - // - if (!IniOpenSection(OperatingSystemName, &SectionId)) - { - sprintf(MsgBuffer,"Operating System section '%s' not found in freeldr.ini", OperatingSystemName); - UiMessageBox(MsgBuffer); - return; - } - - // - // Read the command line - // - if (IniReadSettingByName(SectionId, "Options", value, sizeof(value))) - { - PCHAR File; - - // - // Append boot-time options - // - AppendBootTimeOptions(value); - - // - // Check if a ramdisk file was given - // - File = strstr(value, "/RDIMAGEPATH="); - if (File) - { - // - // Copy the file name and everything else after it - // - strcpy(szFileName, File + 13); - - // - // Null-terminate - // - *strstr(szFileName, " ") = ANSI_NULL; - - // - // Load the ramdisk - // - RamDiskLoadVirtualFile(szFileName); - } - } - - /* - * Setup multiboot information structure - */ - UiDrawProgressBarCenter(1, 100, szLoadingMsg); - UiDrawStatusText("Detecting Hardware..."); - LoaderBlock.CommandLine = reactos_kernel_cmdline; - LoaderBlock.PageDirectoryStart = (ULONG_PTR)&PageDirectoryStart; - LoaderBlock.PageDirectoryEnd = (ULONG_PTR)&PageDirectoryEnd; - LoaderBlock.ModsCount = 0; - LoaderBlock.ModsAddr = reactos_modules; - LoaderBlock.DrivesAddr = reactos_arc_disk_info; - LoaderBlock.RdAddr = (ULONG_PTR)gRamDiskBase; - LoaderBlock.RdLength = gRamDiskSize; - LoaderBlock.MmapLength = (SIZE_T)MachVtbl.GetMemoryMap((PBIOS_MEMORY_MAP)reactos_memory_map, 32) * sizeof(memory_map_t); - if (LoaderBlock.MmapLength) - { - ULONG i; - LoaderBlock.Flags |= MB_FLAGS_MEM_INFO | MB_FLAGS_MMAP_INFO; - LoaderBlock.MmapAddr = (ULONG_PTR)&reactos_memory_map; - reactos_memory_map_descriptor_size = sizeof(memory_map_t); // GetBiosMemoryMap uses a fixed value of 24 - for (i=0; i<(LoaderBlock.MmapLength/sizeof(memory_map_t)); i++) - { -#ifdef _M_PPC - ULONG tmp; - /* Also swap from long long to high/low - * We also have unusable memory that will be available to kernel - * land. Mark it here. - */ - if (BiosMemoryAcpiReclaim == reactos_memory_map[i].type) - { - reactos_memory_map[i].type = BiosMemoryUsable; - } - - tmp = reactos_memory_map[i].base_addr_low; - reactos_memory_map[i].base_addr_low = reactos_memory_map[i].base_addr_high; - reactos_memory_map[i].base_addr_high = tmp; - tmp = reactos_memory_map[i].length_low; - reactos_memory_map[i].length_low = reactos_memory_map[i].length_high; - reactos_memory_map[i].length_high = tmp; -#endif - - if (BiosMemoryUsable == reactos_memory_map[i].type && - 0 == reactos_memory_map[i].base_addr_low) - { - LoaderBlock.MemLower = (reactos_memory_map[i].base_addr_low + reactos_memory_map[i].length_low) / 1024; - if (640 < LoaderBlock.MemLower) - { - LoaderBlock.MemLower = 640; - } - } - if (BiosMemoryUsable == reactos_memory_map[i].type && - reactos_memory_map[i].base_addr_low <= 1024 * 1024 && - 1024 * 1024 <= reactos_memory_map[i].base_addr_low + reactos_memory_map[i].length_low) - { - LoaderBlock.MemHigher = (reactos_memory_map[i].base_addr_low + reactos_memory_map[i].length_low) / 1024 - 1024; - } - } - } - - /* - * Initialize the registry - */ - RegInitializeRegistry(); - - /* - * Make sure the system path is set in the .ini file - */ - if (!IniReadSettingByName(SectionId, "SystemPath", SystemPath, sizeof(SystemPath))) - { - UiMessageBox("System path not specified for selected operating system."); - return; - } - - /* - * Special case for Live CD. - */ - if (!_strnicmp(SystemPath, "LiveCD", strlen("LiveCD"))) - { - /* Use everything following the "LiveCD" string as the path */ - strcpy(LivePath, SystemPath + strlen("LiveCD")); - /* Normalize */ - MachDiskGetBootPath(SystemPath, sizeof(SystemPath)); - strcat(SystemPath, LivePath); - strcat(strcpy(reactos_kernel_cmdline, SystemPath), - " /MININT"); - } - else - { - /* copy system path into kernel command line */ - strcpy(reactos_kernel_cmdline, SystemPath); - } - - /* - * Read the optional kernel parameters (if any) - */ - if (IniReadSettingByName(SectionId, "Options", value, sizeof(value))) - { - strcat(reactos_kernel_cmdline, " "); - strcat(reactos_kernel_cmdline, value); - } - - /* - * Detect hardware - */ - LoaderBlock.ArchExtra = (ULONG_PTR)MachHwDetect(); - UiDrawProgressBarCenter(5, 100, szLoadingMsg); - - LoaderBlock.DrivesCount = reactos_disk_count; - - UiDrawStatusText("Loading..."); - - /* Get boot path */ - if (strchr(SystemPath, '\\') != NULL) - strcpy(szBootPath, strchr(SystemPath, '\\')); - else - szBootPath[0] = '\0'; - - /* append a backslash */ - if ((strlen(szBootPath)==0) || - szBootPath[strlen(szBootPath)] != '\\') - strcat(szBootPath, "\\"); - - DPRINTM(DPRINT_REACTOS,"SystemRoot: '%s'\n", szBootPath); - strcpy(SystemRoot, szBootPath); - - /* - * Find the kernel image name - * and try to load the kernel off the disk - */ - if(IniReadSettingByName(SectionId, "Kernel", value, sizeof(value))) - { - /* - * Set the name and - */ - if (value[0] == '\\') - { - strcpy(szKernelName, value); - } - else - { - strcpy(szKernelName, szBootPath); - strcat(szKernelName, "SYSTEM32\\"); - strcat(szKernelName, value); - } - } - else - { - strcpy(value, "NTOSKRNL.EXE"); - strcpy(szKernelName, szBootPath); - strcat(szKernelName, "SYSTEM32\\"); - strcat(szKernelName, value); - } - - /* - * Find the HAL image name - * and try to load the kernel off the disk - */ - if(IniReadSettingByName(SectionId, "Hal", value, sizeof(value))) - { - /* - * Set the name and - */ - if (value[0] == '\\') - { - strcpy(szHalName, value); - } - else - { - strcpy(szHalName, szBootPath); - strcat(szHalName, "SYSTEM32\\"); - strcat(szHalName, value); - } - } - else - { - strcpy(value, "HAL.DLL"); - strcpy(szHalName, szBootPath); - strcat(szHalName, "SYSTEM32\\"); - strcat(szHalName, value); - } - - /* Load the kernel */ - LoadBase = FrLdrLoadImage(szKernelName, 5, 1); - if (!LoadBase) return; - - /* Get the NT header, kernel base and kernel entry */ - NtHeader = RtlImageNtHeader(LoadBase); - KernelBase = SWAPD(NtHeader->OptionalHeader.ImageBase); - KernelEntryPoint = (ROS_KERNEL_ENTRY_POINT)(KernelBase + SWAPD(NtHeader->OptionalHeader.AddressOfEntryPoint)); - LoaderBlock.KernelBase = KernelBase; - - /* - * Load the System hive from disk - */ - strcpy(szFileName, szBootPath); - strcat(szFileName, "SYSTEM32\\CONFIG\\SYSTEM"); - - DPRINTM(DPRINT_REACTOS, "SystemHive: '%s'", szFileName); - - FilePointer = FsOpenFile(szFileName); - if (!FilePointer) - { - UiMessageBox("Could not find the System hive!"); - return; - } - - /* - * Update the status bar with the current file - */ - strcpy(name, "Reading "); - strcat(name, value); - while (strlen(name) < 80) - strcat(name, " "); - UiDrawStatusText(name); - - /* - * Load the System hive - */ - Base = FrLdrLoadModule(FilePointer, szFileName, &Size); - if (Base == 0 || Size == 0) - { - UiMessageBox("Could not load the System hive!\n"); - return; - } - DPRINTM(DPRINT_REACTOS, "SystemHive loaded at 0x%x size %u\n", (unsigned)Base, (unsigned)Size); - - /* - * Import the loaded system hive - */ - RegImportBinaryHive((PCHAR)Base, Size); - - /* - * Initialize the 'CurrentControlSet' link - */ - RegInitCurrentControlSet(FALSE); - - UiDrawProgressBarCenter(15, 100, szLoadingMsg); - - UiDrawProgressBarCenter(20, 100, szLoadingMsg); - - /* - * Load NLS files - */ - if (!FrLdrLoadNlsFiles(szBootPath, MsgBuffer)) - { - UiMessageBox(MsgBuffer); - return; - } - UiDrawProgressBarCenter(30, 100, szLoadingMsg); - - /* - * Load boot drivers - */ - FrLdrLoadBootDrivers(szBootPath, 40); - UiDrawProgressBarCenter(100, 100, szLoadingMsg); - //UiUnInitialize("Booting ReactOS..."); - - // - // Perform architecture-specific pre-boot configuration - // - MachPrepareForReactOS(FALSE); - - // - // Setup paging and jump to kernel - // - FrLdrStartup(0x2badb002); -} -#endif - -/* EOF */ diff --git a/boot/freeldr/freeldr/reactos/setupldr.c b/boot/freeldr/freeldr/reactos/setupldr.c deleted file mode 100644 index 2f7467dd057..00000000000 --- a/boot/freeldr/freeldr/reactos/setupldr.c +++ /dev/null @@ -1,315 +0,0 @@ -/* - * FreeLoader - * - * Copyright (C) 1998-2003 Brian Palmer - * - * This 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. - * - * This 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. - * - * You 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. - */ - -#define _NTSYSTEM_ -#include -#include - -extern ULONG PageDirectoryStart; -extern ULONG PageDirectoryEnd; - -extern CHAR szBootPath[255]; -extern CHAR SystemRoot[255]; -extern CHAR szHalName[255]; - -extern char reactos_arc_hardware_data[HW_MAX_ARC_HEAP_SIZE]; -extern ULONG_PTR KernelBase; -extern ROS_KERNEL_ENTRY_POINT KernelEntryPoint; - -extern BOOLEAN FrLdrLoadDriver(PCHAR szFileName, INT nPos); -extern BOOLEAN FrLdrLoadNlsFile(PCSTR szFileName, PCSTR szModuleName); - -#define USE_UI - -VOID LoadReactOSSetup(VOID) -{ - ULONG i; - LPCSTR SourcePath; - LPCSTR LoadOptions, DbgLoadOptions = ""; - BOOLEAN BootFromFloppy; - LPCSTR sourcePaths[] = { - "", /* Only for floppy boot */ -#if defined(_M_IX86) - "\\I386", -#elif defined(_M_MPPC) - "\\PPC", -#elif defined(_M_MRX000) - "\\MIPS", -#endif - "\\reactos", - NULL }; - CHAR FileName[256]; - - HINF InfHandle; - ULONG ErrorLine; - INFCONTEXT InfContext; - PIMAGE_NT_HEADERS NtHeader; - PVOID LoadBase; - extern BOOLEAN FrLdrBootType; - - /* Setup multiboot information structure */ - LoaderBlock.CommandLine = reactos_kernel_cmdline; - LoaderBlock.PageDirectoryStart = (ULONG_PTR)&PageDirectoryStart; - LoaderBlock.PageDirectoryEnd = (ULONG_PTR)&PageDirectoryEnd; - LoaderBlock.ModsCount = 0; - LoaderBlock.ModsAddr = reactos_modules; - LoaderBlock.MmapLength = (unsigned long)MachVtbl.GetMemoryMap((PBIOS_MEMORY_MAP)reactos_memory_map, 32) * sizeof(memory_map_t); - if (LoaderBlock.MmapLength) - { -#if defined (_M_IX86) || defined (_M_AMD64) - ULONG i; -#endif - LoaderBlock.Flags |= MB_FLAGS_MEM_INFO | MB_FLAGS_MMAP_INFO; - LoaderBlock.MmapAddr = (ULONG_PTR)&reactos_memory_map; - reactos_memory_map_descriptor_size = sizeof(memory_map_t); // GetBiosMemoryMap uses a fixed value of 24 -#if defined (_M_IX86) || defined (_M_AMD64) - for (i=0; i<(LoaderBlock.MmapLength/sizeof(memory_map_t)); i++) - { - if (BiosMemoryUsable == reactos_memory_map[i].type && - 0 == reactos_memory_map[i].base_addr_low) - { - LoaderBlock.MemLower = (reactos_memory_map[i].base_addr_low + reactos_memory_map[i].length_low) / 1024; - if (640 < LoaderBlock.MemLower) - { - LoaderBlock.MemLower = 640; - } - } - if (BiosMemoryUsable == reactos_memory_map[i].type && - reactos_memory_map[i].base_addr_low <= 1024 * 1024 && - 1024 * 1024 <= reactos_memory_map[i].base_addr_low + reactos_memory_map[i].length_low) - { - LoaderBlock.MemHigher = (reactos_memory_map[i].base_addr_low + reactos_memory_map[i].length_low) / 1024 - 1024; - } - } -#endif - } - -#ifdef USE_UI - SetupUiInitialize(); -#endif - UiDrawStatusText(""); - - FrLdrBootType = TRUE; - - /* Detect hardware */ - UiDrawStatusText("Detecting hardware..."); - LoaderBlock.ArchExtra = (ULONG_PTR)MachHwDetect(); - UiDrawStatusText(""); - - /* Check if we booted from floppy */ - MachDiskGetBootPath(reactos_kernel_cmdline, sizeof(reactos_kernel_cmdline)); - BootFromFloppy = strstr(reactos_kernel_cmdline, "fdisk") != NULL; - - UiDrawStatusText("Loading txtsetup.sif..."); - /* Open 'txtsetup.sif' */ - for (i = BootFromFloppy ? 0 : 1; ; i++) - { - SourcePath = sourcePaths[i]; - if (!SourcePath) - { - printf("Failed to open 'txtsetup.sif'\n"); - return; - } - sprintf(FileName,"%s\\txtsetup.sif", SourcePath); - if (InfOpenFile (&InfHandle, FileName, &ErrorLine)) - break; - } - if (!*SourcePath) - SourcePath = "\\"; - -#if DBG - /* Get load options */ - if (InfFindFirstLine (InfHandle, - "SetupData", - "DbgOsLoadOptions", - &InfContext)) - { - if (!InfGetDataField (&InfContext, 1, &DbgLoadOptions)) - DbgLoadOptions = ""; - } -#endif - if (!strlen(DbgLoadOptions) && !InfFindFirstLine (InfHandle, - "SetupData", - "OsLoadOptions", - &InfContext)) - { - printf("Failed to find 'SetupData/OsLoadOptions'\n"); - return; - } - - if (!InfGetDataField (&InfContext, - 1, - &LoadOptions)) - { - printf("Failed to get load options\n"); - return; - } - - /* Set kernel command line */ - MachDiskGetBootPath(reactos_kernel_cmdline, sizeof(reactos_kernel_cmdline)); - strcat(strcat(strcat(strcat(reactos_kernel_cmdline, SourcePath), " "), - LoadOptions), DbgLoadOptions); - - /* Setup the boot path and kernel path */ - strcpy(szBootPath, SourcePath); - - sprintf(SystemRoot,"%s\\", SourcePath); - sprintf(FileName,"%s\\ntoskrnl.exe", SourcePath); - sprintf(szHalName,"%s\\hal.dll", SourcePath); - - /* Load the kernel */ - LoadBase = FrLdrLoadImage(FileName, 5, 1); - if (!LoadBase) - { - DPRINT1("Loading the kernel failed!\n"); - return; - } - - /* Get the NT header, kernel base and kernel entry */ - NtHeader = RtlImageNtHeader(LoadBase); - KernelBase = SWAPD(NtHeader->OptionalHeader.ImageBase); - KernelEntryPoint = (ROS_KERNEL_ENTRY_POINT)(KernelBase + SWAPD(NtHeader->OptionalHeader.AddressOfEntryPoint)); - LoaderBlock.KernelBase = KernelBase; - - /* Insert boot disk 2 */ - if (BootFromFloppy) - { - UiMessageBox("Please insert \"ReactOS Boot Disk 2\" and press ENTER"); - - /* FIXME: check volume label or disk marker file */ - } - - - /* Get ANSI codepage file */ - if (!InfFindFirstLine (InfHandle, - "NLS", - "AnsiCodepage", - &InfContext)) - { - printf("Failed to find 'NLS/AnsiCodepage'\n"); - return; - } - - if (!InfGetDataField (&InfContext, - 1, - &LoadOptions)) - { - printf("Failed to get load options\n"); - return; - } - - sprintf(FileName,"%s\\%s", SourcePath,LoadOptions); - /* Load ANSI codepage file */ - if (!FrLdrLoadNlsFile(FileName, "ansi.nls")) - { - UiMessageBox("Failed to load the ANSI codepage file."); - return; - } - - /* Get OEM codepage file */ - if (!InfFindFirstLine (InfHandle, - "NLS", - "OemCodepage", - &InfContext)) - { - printf("Failed to find 'NLS/AnsiCodepage'\n"); - return; - } - - if (!InfGetDataField (&InfContext, - 1, - &LoadOptions)) - { - printf("Failed to get load options\n"); - return; - } - - sprintf(FileName,"%s\\%s", SourcePath,LoadOptions); - /* Load OEM codepage file */ - if (!FrLdrLoadNlsFile(FileName, "oem.nls")) - { - UiMessageBox("Failed to load the OEM codepage file."); - return; - } - - /* Get Unicode Casemap file */ - if (!InfFindFirstLine (InfHandle, - "NLS", - "UnicodeCasetable", - &InfContext)) - { - printf("Failed to find 'NLS/AnsiCodepage'\n"); - return; - } - - if (!InfGetDataField (&InfContext, - 1, - &LoadOptions)) - { - printf("Failed to get load options\n"); - return; - } - - sprintf(FileName,"%s\\%s", SourcePath,LoadOptions); - /* Load Unicode casemap file */ - if (!FrLdrLoadNlsFile(FileName, "casemap.nls")) - { - UiMessageBox("Failed to load the Unicode casemap file."); - return; - } - - /* Load additional files specified in txtsetup.inf */ - if (InfFindFirstLine(InfHandle, - "SourceDisksFiles", - NULL, - &InfContext)) - { - do - { - LPCSTR Media, DriverName; - if (InfGetDataField(&InfContext, 7, &Media) && - InfGetDataField(&InfContext, 0, &DriverName)) - { - if (strcmp(Media, "x") == 0) - { - if (!FrLdrLoadDriver((PCHAR)DriverName,0)) - { - DPRINTM(DPRINT_WARNING, "could not load %s, %s\n", SourcePath, DriverName); - return; - } - } - } - } while (InfFindNextLine(&InfContext, &InfContext)); - } - - UiUnInitialize("Booting ReactOS..."); - - // - // Perform architecture-specific pre-boot configuration - // - MachPrepareForReactOS(TRUE); - - // - // Setup paging and jump to kernel - // - FrLdrStartup(0x2badb002); -} - -/* EOF */ diff --git a/boot/freeldr/freeldr/setupldr.rbuild b/boot/freeldr/freeldr/setupldr.rbuild index ac8000c8ea0..b14d46c73f8 100644 --- a/boot/freeldr/freeldr/setupldr.rbuild +++ b/boot/freeldr/freeldr/setupldr.rbuild @@ -1,7 +1,7 @@ - freeldr_$(ARCH).lnk freeldr_startup diff --git a/boot/freeldr/freeldr/setupldr_main.rbuild b/boot/freeldr/freeldr/setupldr_main.rbuild index 0da5d2d3820..8b03906284e 100644 --- a/boot/freeldr/freeldr/setupldr_main.rbuild +++ b/boot/freeldr/freeldr/setupldr_main.rbuild @@ -9,9 +9,6 @@ inffile.c - - setupldr.c - setupldr2.c diff --git a/boot/freeldr/freeldr/ui/ui.c b/boot/freeldr/freeldr/ui/ui.c index 9a6a237f27e..07acd3a2d99 100644 --- a/boot/freeldr/freeldr/ui/ui.c +++ b/boot/freeldr/freeldr/ui/ui.c @@ -225,14 +225,13 @@ BOOLEAN UiInitialize(BOOLEAN ShowGui) BOOLEAN SetupUiInitialize(VOID) { - VIDEODISPLAYMODE UiDisplayMode; CHAR DisplayModeText[260]; ULONG Depth, Length; DisplayModeText[0] = '\0'; - UiDisplayMode = MachVideoSetDisplayMode(DisplayModeText, TRUE); + MachVideoSetDisplayMode(DisplayModeText, TRUE); MachVideoGetDisplaySize(&UiScreenWidth, &UiScreenHeight, &Depth); UiVtbl = TuiVtbl; diff --git a/boot/freeldr/freeldr/video/fade.c b/boot/freeldr/freeldr/video/fade.c index 4cfd4352d46..49ad2afe2bb 100644 --- a/boot/freeldr/freeldr/video/fade.c +++ b/boot/freeldr/freeldr/video/fade.c @@ -24,7 +24,7 @@ VOID VideoSetAllColorsToBlack(ULONG ColorCount) { - ULONG Color; + UCHAR Color; MachVideoSync(); @@ -37,7 +37,7 @@ VOID VideoSetAllColorsToBlack(ULONG ColorCount) VOID VideoFadeIn(PPALETTE_ENTRY Palette, ULONG ColorCount) { ULONG Index; - ULONG Color; + UCHAR Color; PPALETTE_ENTRY PaletteColors; PaletteColors = MmHeapAlloc(sizeof(PALETTE_ENTRY) * ColorCount); @@ -97,7 +97,7 @@ VOID VideoFadeIn(PPALETTE_ENTRY Palette, ULONG ColorCount) VOID VideoFadeOut(ULONG ColorCount) { ULONG Index; - ULONG Color; + UCHAR Color; UCHAR Red; UCHAR Green; UCHAR Blue; diff --git a/boot/freeldr/freeldr/video/palette.c b/boot/freeldr/freeldr/video/palette.c index c631648381a..805b73672fc 100644 --- a/boot/freeldr/freeldr/video/palette.c +++ b/boot/freeldr/freeldr/video/palette.c @@ -24,7 +24,7 @@ VOID VideoSavePaletteState(PPALETTE_ENTRY Palette, ULONG ColorCount) for (Color=0; Color= 0x80000) { @@ -277,7 +277,7 @@ WinLdrSetProcessorContext(PVOID GdtIdt, IN ULONG Pcr, IN ULONG Tss) GDTIDT GdtDesc, IdtDesc, OldIdt; PKGDTENTRY pGdt; PKIDTENTRY pIdt; - ULONG Ldt = 0; + USHORT Ldt = 0; //ULONG i; DPRINTM(DPRINT_WINDOWS, "GDtIdt %p, Pcr %p, Tss 0x%08X\n", @@ -487,13 +487,13 @@ WinLdrSetProcessorContext(PVOID GdtIdt, IN ULONG Pcr, IN ULONG Tss) "1:\n"); #elif defined(_MSC_VER) /* We can't express the above in MASM so we use this far return instead */ - DbgPrint("WinLdrSetProcessorContext: Performing untested far-return\n"); - __asm { + __asm + { push 8 push offset resume retf resume: - }; + }; #else #error #endif diff --git a/boot/freeldr/freeldr/windows/setupldr2.c b/boot/freeldr/freeldr/windows/setupldr2.c index 58ee4d89d31..016e4d53abb 100644 --- a/boot/freeldr/freeldr/windows/setupldr2.c +++ b/boot/freeldr/freeldr/windows/setupldr2.c @@ -123,7 +123,7 @@ SetupLdrScanBootDrivers(PLOADER_PARAMETER_BLOCK LoaderBlock, HINF InfHandle, LPC do { if (InfGetDataField(&InfContext, 7, &Media) && - InfGetDataField(&InfContext, 0, &DriverName) && + InfGetDataField(&InfContext, 0, &DriverName) && InfGetDataField(&InfContext, 13, &dirIndex)) { if ((strcmp(Media, "x") == 0) && @@ -137,7 +137,7 @@ SetupLdrScanBootDrivers(PLOADER_PARAMETER_BLOCK LoaderBlock, HINF InfHandle, LPC swprintf(ImagePathW, L"%S", ImagePath); wcscat(ImagePathW, L"\\"); wcscat(ImagePathW, ServiceName); - + /* Remove .sys extension */ ServiceName[wcslen(ServiceName) - 4] = 0; @@ -310,16 +310,17 @@ VOID LoadReactOSSetup2(VOID) /* Load all referenced DLLs for kernel, HAL and kdcom.dll */ strcpy(SearchPath, BootPath); - WinLdrScanImportDescriptorTable(LoaderBlock, SearchPath, KernelDTE); - WinLdrScanImportDescriptorTable(LoaderBlock, SearchPath, HalDTE); + strcat(SearchPath, "system32\\"); + Status = WinLdrScanImportDescriptorTable(LoaderBlock, SearchPath, KernelDTE); + Status &= WinLdrScanImportDescriptorTable(LoaderBlock, SearchPath, HalDTE); if (KdComDTE) - WinLdrScanImportDescriptorTable(LoaderBlock, SearchPath, KdComDTE); - /* In system32 too */ - strcpy(SearchPath + strlen(BootPath), "system32\\"); - WinLdrScanImportDescriptorTable(LoaderBlock, SearchPath, KernelDTE); - WinLdrScanImportDescriptorTable(LoaderBlock, SearchPath, HalDTE); - if (KdComDTE) - WinLdrScanImportDescriptorTable(LoaderBlock, SearchPath, KdComDTE); + Status &= WinLdrScanImportDescriptorTable(LoaderBlock, SearchPath, KdComDTE); + + if (!Status) + { + UiMessageBox("Error loading imported dll."); + return; + } /* Load NLS data, they are in system32 */ SetupLdrLoadNlsData(LoaderBlock, InfHandle, SearchPath); diff --git a/boot/freeldr/freeldr/windows/wlmemory.c b/boot/freeldr/freeldr/windows/wlmemory.c index bfa68ab904e..bb9c6c73435 100644 --- a/boot/freeldr/freeldr/windows/wlmemory.c +++ b/boot/freeldr/freeldr/windows/wlmemory.c @@ -139,9 +139,10 @@ MempAddMemoryBlock(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock, BOOLEAN Status; // - // Check for some weird stuff at the top + // Check for memory block after 4GB - we don't support it yet + // Note: Even last page before 4GB limit is not supported // - if (BasePage + PageCount > 0xF0000) + if (BasePage >= MM_MAX_PAGE) { // // Just skip this, without even adding to MAD list @@ -149,6 +150,17 @@ MempAddMemoryBlock(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock, return; } + // + // Check if last page is after 4GB limit and shorten this block if needed + // + if (BasePage + PageCount > MM_MAX_PAGE) + { + // + // shorten this block + // + PageCount = MM_MAX_PAGE - BasePage; + } + // // Set Base page, page count and type // @@ -212,7 +224,7 @@ WinLdrTurnOnPaging(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock, ULONG LastPageIndex, LastPageType, MemoryMapStartPage; PPAGE_LOOKUP_TABLE_ITEM MemoryMap; ULONG NoEntries; - PKTSS Tss; + //PKTSS Tss; BOOLEAN Status; // @@ -255,7 +267,7 @@ WinLdrTurnOnPaging(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock, // Calculate parameters of the memory map MemoryMapStartPage = (ULONG_PTR)MemoryMap >> MM_PAGE_SHIFT; - MemoryMapSizeInPages = NoEntries * sizeof(PAGE_LOOKUP_TABLE_ITEM); + MemoryMapSizeInPages = (NoEntries * sizeof(PAGE_LOOKUP_TABLE_ITEM) + MM_PAGE_SIZE - 1) / MM_PAGE_SIZE; DPRINTM(DPRINT_WINDOWS, "Got memory map with %d entries\n", NoEntries); @@ -341,7 +353,7 @@ WinLdrTurnOnPaging(IN OUT PLOADER_PARAMETER_BLOCK LoaderBlock, /* Map stuff like PCR, KI_USER_SHARED_DATA and Apic */ WinLdrMapSpecialPages(PcrBasePage); - Tss = (PKTSS)(KSEG0_BASE | (TssBasePage << MM_PAGE_SHIFT)); + //Tss = (PKTSS)(KSEG0_BASE | (TssBasePage << MM_PAGE_SHIFT)); // Unmap what is not needed from kernel page table MempDisablePages(); diff --git a/boot/freeldr/freeldr/windows/wlregistry.c b/boot/freeldr/freeldr/windows/wlregistry.c index b6c1fc956b4..a6b9adb28af 100644 --- a/boot/freeldr/freeldr/windows/wlregistry.c +++ b/boot/freeldr/freeldr/windows/wlregistry.c @@ -711,7 +711,7 @@ WinLdrAddDriverToList(LIST_ENTRY *BootDriverListHead, { PBOOT_DRIVER_LIST_ENTRY BootDriverEntry; NTSTATUS Status; - ULONG PathLength; + USHORT PathLength; BootDriverEntry = MmHeapAlloc(sizeof(BOOT_DRIVER_LIST_ENTRY)); @@ -726,10 +726,10 @@ WinLdrAddDriverToList(LIST_ENTRY *BootDriverListHead, if (ImagePath && (wcslen(ImagePath) > 0)) { // Just copy ImagePath to the corresponding field in the structure - PathLength = wcslen(ImagePath) * sizeof(WCHAR); + PathLength = wcslen(ImagePath) * sizeof(WCHAR) + sizeof(UNICODE_NULL); BootDriverEntry->FilePath.Length = 0; - BootDriverEntry->FilePath.MaximumLength = PathLength + sizeof(WCHAR); + BootDriverEntry->FilePath.MaximumLength = PathLength; BootDriverEntry->FilePath.Buffer = MmHeapAlloc(PathLength); if (!BootDriverEntry->FilePath.Buffer) @@ -751,7 +751,7 @@ WinLdrAddDriverToList(LIST_ENTRY *BootDriverListHead, // we have to construct ImagePath ourselves PathLength = wcslen(ServiceName)*sizeof(WCHAR) + sizeof(L"system32\\drivers\\.sys"); BootDriverEntry->FilePath.Length = 0; - BootDriverEntry->FilePath.MaximumLength = PathLength+sizeof(WCHAR); + BootDriverEntry->FilePath.MaximumLength = PathLength; BootDriverEntry->FilePath.Buffer = MmHeapAlloc(PathLength); if (!BootDriverEntry->FilePath.Buffer) @@ -786,9 +786,9 @@ WinLdrAddDriverToList(LIST_ENTRY *BootDriverListHead, } // Add registry path - PathLength = (wcslen(RegistryPath)+wcslen(ServiceName))*sizeof(WCHAR); + PathLength = (wcslen(RegistryPath) + wcslen(ServiceName))*sizeof(WCHAR) + sizeof(UNICODE_NULL); BootDriverEntry->RegistryPath.Length = 0; - BootDriverEntry->RegistryPath.MaximumLength = PathLength;//+sizeof(WCHAR); + BootDriverEntry->RegistryPath.MaximumLength = PathLength; BootDriverEntry->RegistryPath.Buffer = MmHeapAlloc(PathLength); if (!BootDriverEntry->RegistryPath.Buffer) return FALSE; diff --git a/cmake/CMakeDetermineASMCompiler.cmake b/cmake/CMakeDetermineASMCompiler.cmake new file mode 100644 index 00000000000..1728dc1ead5 --- /dev/null +++ b/cmake/CMakeDetermineASMCompiler.cmake @@ -0,0 +1,182 @@ + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +# determine the compiler to use for ASM programs + +IF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER) + # prefer the environment variable ASM + IF($ENV{ASM${ASM_DIALECT}} MATCHES ".+") + SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT "$ENV{ASM${ASM_DIALECT}}") + ENDIF($ENV{ASM${ASM_DIALECT}} MATCHES ".+") + + # finally list compilers to try + IF("ASM${ASM_DIALECT}" STREQUAL "ASM") # the generic assembler support + + IF(CMAKE_ASM_COMPILER_INIT) + SET(CMAKE_ASM_COMPILER_LIST ${CMAKE_ASM_COMPILER_INIT}) + ELSE(CMAKE_ASM_COMPILER_INIT) + + IF(CMAKE_C_COMPILER) + SET(CMAKE_ASM_COMPILER "${CMAKE_C_COMPILER}" CACHE FILEPATH "The ASM compiler") + SET(CMAKE_ASM_COMPILER_ID "${CMAKE_C_COMPILER_ID}") + ELSEIF(CMAKE_CXX_COMPILER) + SET(CMAKE_ASM_COMPILER "${CMAKE_CXX_COMPILER}" CACHE FILEPATH "The ASM compiler") + SET(CMAKE_ASM_COMPILER_ID "${CMAKE_CXX_COMPILER_ID}") + ELSE(CMAKE_CXX_COMPILER) + # List all default C and CXX compilers + SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST ${_CMAKE_TOOLCHAIN_PREFIX}gcc ${_CMAKE_TOOLCHAIN_PREFIX}cc cl bcc xlc + ${_CMAKE_TOOLCHAIN_PREFIX}c++ ${_CMAKE_TOOLCHAIN_PREFIX}g++ CC aCC cl bcc xlC) + ENDIF(CMAKE_C_COMPILER) + + ENDIF(CMAKE_ASM_COMPILER_INIT) + + + ELSE("ASM${ASM_DIALECT}" STREQUAL "ASM") # some specific assembler "dialect" + + IF(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT) + SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST ${CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT}) + ELSE(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT) + MESSAGE(FATAL_ERROR "CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT must be preset !") + ENDIF(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT) + + ENDIF("ASM${ASM_DIALECT}" STREQUAL "ASM") + + + # Find the compiler. + IF (_CMAKE_USER_CXX_COMPILER_PATH OR _CMAKE_USER_C_COMPILER_PATH) + FIND_PROGRAM(CMAKE_ASM${ASM_DIALECT}_COMPILER NAMES ${CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST} PATHS ${_CMAKE_USER_C_COMPILER_PATH} ${_CMAKE_USER_CXX_COMPILER_PATH} DOC "Assembler" NO_DEFAULT_PATH) + ENDIF (_CMAKE_USER_CXX_COMPILER_PATH OR _CMAKE_USER_C_COMPILER_PATH) + FIND_PROGRAM(CMAKE_ASM${ASM_DIALECT}_COMPILER NAMES ${CMAKE_ASM${ASM_DIALECT}_COMPILER_LIST} PATHS ${_CMAKE_TOOLCHAIN_LOCATION} DOC "Assembler") + +ELSE(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER) + + # we only get here if CMAKE_ASM${ASM_DIALECT}_COMPILER was specified using -D or a pre-made CMakeCache.txt + # (e.g. via ctest) or set in CMAKE_TOOLCHAIN_FILE + # + # if a compiler was specified by the user but without path, + # now try to find it with the full path + # if it is found, force it into the cache, + # if not, don't overwrite the setting (which was given by the user) with "NOTFOUND" + GET_FILENAME_COMPONENT(_CMAKE_USER_ASM${ASM_DIALECT}_COMPILER_PATH "${CMAKE_ASM${ASM_DIALECT}_COMPILER}" PATH) + IF(NOT _CMAKE_USER_ASM${ASM_DIALECT}_COMPILER_PATH) + FIND_PROGRAM(CMAKE_ASM${ASM_DIALECT}_COMPILER_WITH_PATH NAMES ${CMAKE_ASM${ASM_DIALECT}_COMPILER}) + MARK_AS_ADVANCED(CMAKE_ASM${ASM_DIALECT}_COMPILER_WITH_PATH) + IF(CMAKE_ASM${ASM_DIALECT}_COMPILER_WITH_PATH) + SET(CMAKE_ASM${ASM_DIALECT}_COMPILER ${CMAKE_ASM${ASM_DIALECT}_COMPILER_WITH_PATH} CACHE FILEPATH "Assembler" FORCE) + ENDIF(CMAKE_ASM${ASM_DIALECT}_COMPILER_WITH_PATH) + ENDIF(NOT _CMAKE_USER_ASM${ASM_DIALECT}_COMPILER_PATH) +ENDIF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER) +MARK_AS_ADVANCED(CMAKE_ASM${ASM_DIALECT}_COMPILER) + +IF (NOT _CMAKE_TOOLCHAIN_LOCATION) + GET_FILENAME_COMPONENT(_CMAKE_TOOLCHAIN_LOCATION "${CMAKE_ASM${ASM_DIALECT}_COMPILER}" PATH) +ENDIF (NOT _CMAKE_TOOLCHAIN_LOCATION) + + +IF(NOT CMAKE_ASM${ASM_DIALECT}_COMPILER_ID) + + # Table of per-vendor compiler id flags with expected output. + LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS GNU ) + SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_GNU "--version") + SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_GNU "(GNU assembler)|(GCC)|(Free Software Foundation)") + + LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS HP ) + SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_HP "-V") + SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_HP "HP C") + + LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS Intel ) + SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_Intel "--version") + SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_Intel "(ICC)") + + LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS SunPro ) + SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_SunPro "-V") + SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_SunPro "Sun C") + + LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS XL ) + SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_XL "-qversion") + SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_XL "XL C") + + LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS TI_DSP ) + SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_TI_DSP "-h") + SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_TI_DSP "Texas Instruments") + + LIST(APPEND CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDORS VISUAL) + SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_FLAGS_VISUAL "/?") + SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID_VENDOR_REGEX_VISUAL "Microsoft Corporation") + + INCLUDE(CMakeDetermineCompilerId) + CMAKE_DETERMINE_COMPILER_ID_VENDOR(ASM${ASM_DIALECT}) + +ENDIF() + +IF(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID) + MESSAGE(STATUS "The ASM${ASM_DIALECT} compiler identification is ${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}") +ELSE(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID) + MESSAGE(STATUS "The ASM${ASM_DIALECT} compiler identification is unknown") +ENDIF(CMAKE_ASM${ASM_DIALECT}_COMPILER_ID) + + + +# If we have a gas/as cross compiler, they have usually some prefix, like +# e.g. powerpc-linux-gas, arm-elf-gas or i586-mingw32msvc-gas , optionally +# with a 3-component version number at the end +# The other tools of the toolchain usually have the same prefix +# NAME_WE cannot be used since then this test will fail for names lile +# "arm-unknown-nto-qnx6.3.0-gas.exe", where BASENAME would be +# "arm-unknown-nto-qnx6" instead of the correct "arm-unknown-nto-qnx6.3.0-" +IF (NOT _CMAKE_TOOLCHAIN_PREFIX) + GET_FILENAME_COMPONENT(COMPILER_BASENAME "${CMAKE_ASM${ASM_DIALECT}_COMPILER}" NAME) + IF (COMPILER_BASENAME MATCHES "^(.+-)g?as(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$") + SET(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) + ENDIF (COMPILER_BASENAME MATCHES "^(.+-)g?as(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$") +ENDIF (NOT _CMAKE_TOOLCHAIN_PREFIX) + +# Now try the C compiler regexp: +IF (NOT _CMAKE_TOOLCHAIN_PREFIX) + IF (COMPILER_BASENAME MATCHES "^(.+-)g?cc(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$") + SET(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) + ENDIF (COMPILER_BASENAME MATCHES "^(.+-)g?cc(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$") +ENDIF (NOT _CMAKE_TOOLCHAIN_PREFIX) + +# Finally try the CXX compiler regexp: +IF (NOT _CMAKE_TOOLCHAIN_PREFIX) + IF (COMPILER_BASENAME MATCHES "^(.+-)[gc]\\+\\+(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$") + SET(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) + ENDIF (COMPILER_BASENAME MATCHES "^(.+-)[gc]\\+\\+(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$") +ENDIF (NOT _CMAKE_TOOLCHAIN_PREFIX) + + +INCLUDE(CMakeFindBinUtils) + +SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_ENV_VAR "ASM${ASM_DIALECT}") + +IF(CMAKE_ASM${ASM_DIALECT}_COMPILER) + MESSAGE(STATUS "Found assembler: ${CMAKE_ASM${ASM_DIALECT}_COMPILER}") +ELSE(CMAKE_ASM${ASM_DIALECT}_COMPILER) + MESSAGE(STATUS "Didn't find assembler") +ENDIF(CMAKE_ASM${ASM_DIALECT}_COMPILER) + + +SET(_CMAKE_ASM_COMPILER "${CMAKE_ASM${ASM_DIALECT}_COMPILER}") +SET(_CMAKE_ASM_COMPILER_ID "${CMAKE_ASM${ASM_DIALECT}_COMPILER_ID}") +SET(_CMAKE_ASM_COMPILER_ARG1 "${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARG1}") +SET(_CMAKE_ASM_COMPILER_ENV_VAR "${CMAKE_ASM${ASM_DIALECT}_COMPILER_ENV_VAR}") + +# configure variables set in this file for fast reload later on +CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeASMCompiler.cmake.in + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeASM${ASM_DIALECT}Compiler.cmake IMMEDIATE @ONLY) + +SET(_CMAKE_ASM_COMPILER) +SET(_CMAKE_ASM_COMPILER_ARG1) +SET(_CMAKE_ASM_COMPILER_ENV_VAR) diff --git a/cmake/CMakeDetermineCompilerId.cmake b/cmake/CMakeDetermineCompilerId.cmake new file mode 100644 index 00000000000..b160dee62db --- /dev/null +++ b/cmake/CMakeDetermineCompilerId.cmake @@ -0,0 +1,315 @@ + +#============================================================================= +# Copyright 2007-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +# Function to compile a source file to identify the compiler. This is +# used internally by CMake and should not be included by user code. +# If successful, sets CMAKE__COMPILER_ID and CMAKE__PLATFORM_ID + +FUNCTION(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) + # Make sure the compiler arguments are clean. + STRING(STRIP "${CMAKE_${lang}_COMPILER_ARG1}" CMAKE_${lang}_COMPILER_ID_ARG1) + STRING(REGEX REPLACE " +" ";" CMAKE_${lang}_COMPILER_ID_ARG1 "${CMAKE_${lang}_COMPILER_ID_ARG1}") + + # Make sure user-specified compiler flags are used. + IF(CMAKE_${lang}_FLAGS) + SET(CMAKE_${lang}_COMPILER_ID_FLAGS ${CMAKE_${lang}_FLAGS}) + ELSE(CMAKE_${lang}_FLAGS) + SET(CMAKE_${lang}_COMPILER_ID_FLAGS $ENV{${flagvar}}) + ENDIF(CMAKE_${lang}_FLAGS) + STRING(REGEX REPLACE " " ";" CMAKE_${lang}_COMPILER_ID_FLAGS_LIST "${CMAKE_${lang}_COMPILER_ID_FLAGS}") + + # Compute the directory in which to run the test. + SET(CMAKE_${lang}_COMPILER_ID_DIR ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CompilerId${lang}) + + # Try building with no extra flags and then try each set + # of helper flags. Stop when the compiler is identified. + FOREACH(flags "" ${CMAKE_${lang}_COMPILER_ID_TEST_FLAGS}) + IF(NOT CMAKE_${lang}_COMPILER_ID) + CMAKE_DETERMINE_COMPILER_ID_BUILD("${lang}" "${flags}" "${src}") + FOREACH(file ${COMPILER_${lang}_PRODUCED_FILES}) + CMAKE_DETERMINE_COMPILER_ID_CHECK("${lang}" "${CMAKE_${lang}_COMPILER_ID_DIR}/${file}" "${src}") + ENDFOREACH(file) + ENDIF(NOT CMAKE_${lang}_COMPILER_ID) + ENDFOREACH(flags) + + # If the compiler is still unknown, try to query its vendor. + IF(NOT CMAKE_${lang}_COMPILER_ID) + CMAKE_DETERMINE_COMPILER_ID_VENDOR(${lang}) + ENDIF() + + # if the format is unknown after all files have been checked, put "Unknown" in the cache + IF(NOT CMAKE_EXECUTABLE_FORMAT) + SET(CMAKE_EXECUTABLE_FORMAT "Unknown" CACHE INTERNAL "Executable file format") + ENDIF(NOT CMAKE_EXECUTABLE_FORMAT) + + # Display the final identification result. + IF(CMAKE_${lang}_COMPILER_ID) + MESSAGE(STATUS "The ${lang} compiler identification is " + "${CMAKE_${lang}_COMPILER_ID}") + ELSE(CMAKE_${lang}_COMPILER_ID) + MESSAGE(STATUS "The ${lang} compiler identification is unknown") + ENDIF(CMAKE_${lang}_COMPILER_ID) + + SET(CMAKE_${lang}_COMPILER_ID "${CMAKE_${lang}_COMPILER_ID}" PARENT_SCOPE) + SET(CMAKE_${lang}_PLATFORM_ID "${CMAKE_${lang}_PLATFORM_ID}" PARENT_SCOPE) + SET(MSVC_${lang}_ARCHITECTURE_ID "${MSVC_${lang}_ARCHITECTURE_ID}" + PARENT_SCOPE) +ENDFUNCTION(CMAKE_DETERMINE_COMPILER_ID) + +#----------------------------------------------------------------------------- +# Function to write the compiler id source file. +FUNCTION(CMAKE_DETERMINE_COMPILER_ID_WRITE lang src) + FILE(READ ${CMAKE_ROOT}/Modules/${src}.in ID_CONTENT_IN) + STRING(CONFIGURE "${ID_CONTENT_IN}" ID_CONTENT_OUT @ONLY) + FILE(WRITE ${CMAKE_${lang}_COMPILER_ID_DIR}/${src} "${ID_CONTENT_OUT}") +ENDFUNCTION(CMAKE_DETERMINE_COMPILER_ID_WRITE) + +#----------------------------------------------------------------------------- +# Function to build the compiler id source file and look for output +# files. +FUNCTION(CMAKE_DETERMINE_COMPILER_ID_BUILD lang testflags src) + # Create a clean working directory. + FILE(REMOVE_RECURSE ${CMAKE_${lang}_COMPILER_ID_DIR}) + FILE(MAKE_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR}) + CMAKE_DETERMINE_COMPILER_ID_WRITE("${lang}" "${src}") + + # Construct a description of this test case. + SET(COMPILER_DESCRIPTION + "Compiler: ${CMAKE_${lang}_COMPILER} ${CMAKE_${lang}_COMPILER_ID_ARG1} +Build flags: ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST} +Id flags: ${testflags} +") + + # Compile the compiler identification source. + IF(COMMAND EXECUTE_PROCESS) + EXECUTE_PROCESS( + COMMAND ${CMAKE_${lang}_COMPILER} + ${CMAKE_${lang}_COMPILER_ID_ARG1} + ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST} + ${testflags} + "${src}" + WORKING_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR} + OUTPUT_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT + ERROR_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT + RESULT_VARIABLE CMAKE_${lang}_COMPILER_ID_RESULT + ) + ELSE(COMMAND EXECUTE_PROCESS) + EXEC_PROGRAM( + ${CMAKE_${lang}_COMPILER} ${CMAKE_${lang}_COMPILER_ID_DIR} + ARGS ${CMAKE_${lang}_COMPILER_ID_ARG1} + ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST} + ${testflags} + \"${src}\" + OUTPUT_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT + RETURN_VALUE CMAKE_${lang}_COMPILER_ID_RESULT + ) + ENDIF(COMMAND EXECUTE_PROCESS) + + # Check the result of compilation. + IF(CMAKE_${lang}_COMPILER_ID_RESULT) + # Compilation failed. + SET(MSG + "Compiling the ${lang} compiler identification source file \"${src}\" failed. +${COMPILER_DESCRIPTION} +The output was: +${CMAKE_${lang}_COMPILER_ID_RESULT} +${CMAKE_${lang}_COMPILER_ID_OUTPUT} + +") + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "${MSG}") + #IF(NOT CMAKE_${lang}_COMPILER_ID_ALLOW_FAIL) + # MESSAGE(FATAL_ERROR "${MSG}") + #ENDIF(NOT CMAKE_${lang}_COMPILER_ID_ALLOW_FAIL) + + # No output files should be inspected. + SET(COMPILER_${lang}_PRODUCED_FILES) + ELSE(CMAKE_${lang}_COMPILER_ID_RESULT) + # Compilation succeeded. + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Compiling the ${lang} compiler identification source file \"${src}\" succeeded. +${COMPILER_DESCRIPTION} +The output was: +${CMAKE_${lang}_COMPILER_ID_RESULT} +${CMAKE_${lang}_COMPILER_ID_OUTPUT} + +") + + # Find the executable produced by the compiler, try all files in the + # binary dir. + FILE(GLOB COMPILER_${lang}_PRODUCED_FILES + RELATIVE ${CMAKE_${lang}_COMPILER_ID_DIR} + ${CMAKE_${lang}_COMPILER_ID_DIR}/*) + LIST(REMOVE_ITEM COMPILER_${lang}_PRODUCED_FILES "${src}") + FOREACH(file ${COMPILER_${lang}_PRODUCED_FILES}) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Compilation of the ${lang} compiler identification source \"" + "${src}\" produced \"${file}\"\n\n") + ENDFOREACH(file) + + IF(NOT COMPILER_${lang}_PRODUCED_FILES) + # No executable was found. + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Compilation of the ${lang} compiler identification source \"" + "${src}\" did not produce an executable in \"" + "${CMAKE_${lang}_COMPILER_ID_DIR}\".\n\n") + ENDIF(NOT COMPILER_${lang}_PRODUCED_FILES) + ENDIF(CMAKE_${lang}_COMPILER_ID_RESULT) + + # Return the files produced by the compilation. + SET(COMPILER_${lang}_PRODUCED_FILES "${COMPILER_${lang}_PRODUCED_FILES}" PARENT_SCOPE) +ENDFUNCTION(CMAKE_DETERMINE_COMPILER_ID_BUILD lang testflags src) + +#----------------------------------------------------------------------------- +# Function to extract the compiler id from an executable. +FUNCTION(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file) + # Look for a compiler id if not yet known. + IF(NOT CMAKE_${lang}_COMPILER_ID) + # Read the compiler identification string from the executable file. + SET(COMPILER_ID) + SET(PLATFORM_ID) + FILE(STRINGS ${file} + CMAKE_${lang}_COMPILER_ID_STRINGS LIMIT_COUNT 3 REGEX "INFO:") + SET(HAVE_COMPILER_TWICE 0) + FOREACH(info ${CMAKE_${lang}_COMPILER_ID_STRINGS}) + IF("${info}" MATCHES ".*INFO:compiler\\[([^]\"]*)\\].*") + IF(COMPILER_ID) + SET(COMPILER_ID_TWICE 1) + ENDIF(COMPILER_ID) + STRING(REGEX REPLACE ".*INFO:compiler\\[([^]]*)\\].*" "\\1" + COMPILER_ID "${info}") + ENDIF("${info}" MATCHES ".*INFO:compiler\\[([^]\"]*)\\].*") + IF("${info}" MATCHES ".*INFO:platform\\[([^]\"]*)\\].*") + STRING(REGEX REPLACE ".*INFO:platform\\[([^]]*)\\].*" "\\1" + PLATFORM_ID "${info}") + ENDIF("${info}" MATCHES ".*INFO:platform\\[([^]\"]*)\\].*") + IF("${info}" MATCHES ".*INFO:arch\\[([^]\"]*)\\].*") + STRING(REGEX REPLACE ".*INFO:arch\\[([^]]*)\\].*" "\\1" + ARCHITECTURE_ID "${info}") + ENDIF("${info}" MATCHES ".*INFO:arch\\[([^]\"]*)\\].*") + ENDFOREACH(info) + + # Check if a valid compiler and platform were found. + IF(COMPILER_ID AND NOT COMPILER_ID_TWICE) + SET(CMAKE_${lang}_COMPILER_ID "${COMPILER_ID}") + SET(CMAKE_${lang}_PLATFORM_ID "${PLATFORM_ID}") + SET(MSVC_${lang}_ARCHITECTURE_ID "${ARCHITECTURE_ID}") + ENDIF(COMPILER_ID AND NOT COMPILER_ID_TWICE) + + # Check the compiler identification string. + IF(CMAKE_${lang}_COMPILER_ID) + # The compiler identification was found. + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "The ${lang} compiler identification is ${CMAKE_${lang}_COMPILER_ID}, found in \"" + "${file}\"\n\n") + ELSE(CMAKE_${lang}_COMPILER_ID) + # The compiler identification could not be found. + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "The ${lang} compiler identification could not be found in \"" + "${file}\"\n\n") + ENDIF(CMAKE_${lang}_COMPILER_ID) + ENDIF(NOT CMAKE_${lang}_COMPILER_ID) + + # try to figure out the executable format: ELF, COFF, Mach-O + IF(NOT CMAKE_EXECUTABLE_FORMAT) + FILE(READ ${file} CMAKE_EXECUTABLE_MAGIC LIMIT 4 HEX) + + # ELF files start with 0x7f"ELF" + IF("${CMAKE_EXECUTABLE_MAGIC}" STREQUAL "7f454c46") + SET(CMAKE_EXECUTABLE_FORMAT "ELF" CACHE INTERNAL "Executable file format") + ENDIF("${CMAKE_EXECUTABLE_MAGIC}" STREQUAL "7f454c46") + +# # COFF (.exe) files start with "MZ" +# IF("${CMAKE_EXECUTABLE_MAGIC}" MATCHES "4d5a....") +# SET(CMAKE_EXECUTABLE_FORMAT "COFF" CACHE STRING "Executable file format") +# ENDIF("${CMAKE_EXECUTABLE_MAGIC}" MATCHES "4d5a....") +# +# # Mach-O files start with CAFEBABE or FEEDFACE, according to http://radio.weblogs.com/0100490/2003/01/28.html +# IF("${CMAKE_EXECUTABLE_MAGIC}" MATCHES "cafebabe") +# SET(CMAKE_EXECUTABLE_FORMAT "MACHO" CACHE STRING "Executable file format") +# ENDIF("${CMAKE_EXECUTABLE_MAGIC}" MATCHES "cafebabe") +# IF("${CMAKE_EXECUTABLE_MAGIC}" MATCHES "feedface") +# SET(CMAKE_EXECUTABLE_FORMAT "MACHO" CACHE STRING "Executable file format") +# ENDIF("${CMAKE_EXECUTABLE_MAGIC}" MATCHES "feedface") + + ENDIF(NOT CMAKE_EXECUTABLE_FORMAT) + IF(NOT DEFINED CMAKE_EXECUTABLE_FORMAT) + SET(CMAKE_EXECUTABLE_FORMAT) + ENDIF() + # Return the information extracted. + SET(CMAKE_${lang}_COMPILER_ID "${CMAKE_${lang}_COMPILER_ID}" PARENT_SCOPE) + SET(CMAKE_${lang}_PLATFORM_ID "${CMAKE_${lang}_PLATFORM_ID}" PARENT_SCOPE) + SET(MSVC_${lang}_ARCHITECTURE_ID "${MSVC_${lang}_ARCHITECTURE_ID}" + PARENT_SCOPE) + SET(CMAKE_EXECUTABLE_FORMAT "${CMAKE_EXECUTABLE_FORMAT}" PARENT_SCOPE) +ENDFUNCTION(CMAKE_DETERMINE_COMPILER_ID_CHECK lang) + +#----------------------------------------------------------------------------- +# Function to query the compiler vendor. +# This uses a table with entries of the form +# list(APPEND CMAKE_${lang}_COMPILER_ID_VENDORS ${vendor}) +# set(CMAKE_${lang}_COMPILER_ID_VENDOR_FLAGS_${vendor} -some-vendor-flag) +# set(CMAKE_${lang}_COMPILER_ID_VENDOR_REGEX_${vendor} "Some Vendor Output") +# We try running the compiler with the flag for each vendor and +# matching its regular expression in the output. +FUNCTION(CMAKE_DETERMINE_COMPILER_ID_VENDOR lang) + + IF(NOT CMAKE_${lang}_COMPILER_ID_DIR) + # We get here when this function is called not from within CMAKE_DETERMINE_COMPILER_ID() + # This is done e.g. for detecting the compiler ID for assemblers. + # Compute the directory in which to run the test and Create a clean working directory. + SET(CMAKE_${lang}_COMPILER_ID_DIR ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CompilerId${lang}) + FILE(REMOVE_RECURSE ${CMAKE_${lang}_COMPILER_ID_DIR}) + FILE(MAKE_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR}) + ENDIF(NOT CMAKE_${lang}_COMPILER_ID_DIR) + + + FOREACH(vendor ${CMAKE_${lang}_COMPILER_ID_VENDORS}) + SET(flags ${CMAKE_${lang}_COMPILER_ID_VENDOR_FLAGS_${vendor}}) + SET(regex ${CMAKE_${lang}_COMPILER_ID_VENDOR_REGEX_${vendor}}) + EXECUTE_PROCESS( + COMMAND ${CMAKE_${lang}_COMPILER} + ${CMAKE_${lang}_COMPILER_ID_ARG1} + ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST} + ${flags} + WORKING_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR} + OUTPUT_VARIABLE output ERROR_VARIABLE output + RESULT_VARIABLE result + TIMEOUT 10 + ) + + IF("${lang}" STREQUAL "ASM") + MESSAGE(STATUS "Checked for ${vendor}") + MESSAGE(STATUS " Output: -${output}-") + MESSAGE(STATUS " Result: -${result}-") + ENDIF("${lang}" STREQUAL "ASM") + + IF("${output}" MATCHES "${regex}") + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Checking whether the ${lang} compiler is ${vendor} using \"${flags}\" " + "matched \"${regex}\":\n${output}") + SET(CMAKE_${lang}_COMPILER_ID "${vendor}" PARENT_SCOPE) + BREAK() + ELSE() + IF("${result}" MATCHES "timeout") + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Checking whether the ${lang} compiler is ${vendor} using \"${flags}\" " + "terminated after 10 s due to timeout.") + ELSE() + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Checking whether the ${lang} compiler is ${vendor} using \"${flags}\" " + "did not match \"${regex}\":\n${output}") + ENDIF() + ENDIF() + ENDFOREACH() +ENDFUNCTION(CMAKE_DETERMINE_COMPILER_ID_VENDOR) diff --git a/CMakeMacros.cmake b/cmake/CMakeMacros.cmake similarity index 76% rename from CMakeMacros.cmake rename to cmake/CMakeMacros.cmake index 08a421dbf80..9645f4f6454 100644 --- a/CMakeMacros.cmake +++ b/cmake/CMakeMacros.cmake @@ -1,36 +1,4 @@ -if (NOT MSVC) - -macro(CreateBootSectorTarget _target_name _asm_file _object_file) - get_filename_component(OBJECT_PATH ${_object_file} PATH) - get_filename_component(OBJECT_NAME ${_object_file} NAME) - file(MAKE_DIRECTORY ${OBJECT_PATH}) - get_directory_property(defines COMPILE_DEFINITIONS) - get_directory_property(includes INCLUDE_DIRECTORIES) - - foreach(arg ${defines}) - set(result_defs ${result_defs} -D${arg}) - endforeach() - - foreach(arg ${includes}) - set(result_incs -I${arg} ${result_incs}) - endforeach() - - add_custom_command( - OUTPUT ${_object_file} - COMMAND nasm -o ${_object_file} ${result_incs} ${result_defs} -f bin ${_asm_file} - DEPENDS ${_asm_file}) - set_source_files_properties(${_object_file} PROPERTIES GENERATED TRUE) - add_custom_target(${_target_name} ALL DEPENDS ${_object_file}) -endmacro() - -else() - -macro(CreateBootSectorTarget _target_name _asm_file _object_file) -endmacro() - -endif() - macro(set_cpp) include_directories(BEFORE ${REACTOS_SOURCE_DIR}/include/c++/stlport) set(IS_CPP 1) @@ -39,34 +7,34 @@ macro(set_cpp) -DNATIVE_C_INCLUDE=${REACTOS_SOURCE_DIR}/include/crt) endmacro() -macro(add_dependency_node _node) +function(add_dependency_node _node) if(GENERATE_DEPENDENCY_GRAPH) get_target_property(_type ${_node} TYPE) if(_type MATCHES SHARED_LIBRARY OR ${_node} MATCHES ntoskrnl) file(APPEND ${REACTOS_BINARY_DIR}/dependencies.graphml " \n") endif() endif() -endmacro() +endfunction() -macro(add_dependency_edge _source _target) +function(add_dependency_edge _source _target) if(GENERATE_DEPENDENCY_GRAPH) get_target_property(_type ${_source} TYPE) if(_type MATCHES SHARED_LIBRARY) file(APPEND ${REACTOS_BINARY_DIR}/dependencies.graphml " \n") endif() endif() -endmacro() +endfunction() -macro(add_dependency_header) +function(add_dependency_header) file(APPEND ${REACTOS_BINARY_DIR}/dependencies.graphml "\n\n \n") -endmacro() +endfunction() -macro(add_dependency_footer) +function(add_dependency_footer) add_dependency_node(ntdll) file(APPEND ${REACTOS_BINARY_DIR}/dependencies.graphml " \n\n") -endmacro() +endfunction() -macro(add_message_headers) +function(add_message_headers) foreach(_in_FILE ${ARGN}) get_filename_component(FILE ${_in_FILE} NAME_WE) macro_mc(${FILE}) @@ -79,7 +47,7 @@ macro(add_message_headers) PROPERTIES GENERATED TRUE) add_custom_target(${FILE} ALL DEPENDS ${REACTOS_BINARY_DIR}/include/reactos/${FILE}.h ${REACTOS_BINARY_DIR}/include/reactos/${FILE}.rc) endforeach() -endmacro() +endfunction() macro(dir_to_num dir var) if(${dir} STREQUAL reactos/system32) @@ -108,27 +76,27 @@ function(add_cd_file) if(NOT (_CD_TARGET OR _CD_FILE)) message(FATAL_ERROR "You must provide a target or a file to install!") endif() - + if(NOT _CD_DESTINATION) message(FATAL_ERROR "You must provide a destination") elseif(${_CD_DESTINATION} STREQUAL root) set(_CD_DESTINATION "") endif() - + if(NOT _CD_FOR) message(FATAL_ERROR "You must provide a cd name (or "all" for all of them) to install the file on!") endif() - + #get file if we need to if(NOT _CD_FILE) get_target_property(_CD_FILE ${_CD_TARGET} LOCATION) endif() - + #do we add it to all CDs? if(_CD_FOR STREQUAL all) set(_CD_FOR "bootcd;livecd;regtest") endif() - + #do we add it to bootcd? list(FIND _CD_FOR bootcd __cd) if(NOT __cd EQUAL -1) @@ -150,14 +118,18 @@ function(add_cd_file) else() #add it in reactos.cab dir_to_num(${_CD_DESTINATION} _num) - file(APPEND ${REACTOS_BINARY_DIR}/boot/bootdata/packages/reactos.dff.dyn "${_CD_FILE} ${_num}\n") + if(CMAKE_HOST_SYSTEM_NAME MATCHES Windows) + file(APPEND ${REACTOS_BINARY_DIR}/boot/bootdata/packages/reactos.dff.dyn "${_CD_FILE} ${_num}\n") + else() + file(APPEND ${REACTOS_BINARY_DIR}/boot/bootdata/packages/reactos.dff.dyn "\"${_CD_FILE}\" ${_num}\n") + endif() if(_CD_TARGET) #manage dependency add_dependencies(reactos_cab ${_CD_TARGET}) endif() endif() endif() #end bootcd - + #do we add it to livecd? list(FIND _CD_FOR livecd __cd) if(NOT __cd EQUAL -1) @@ -174,7 +146,7 @@ function(add_cd_file) file(APPEND ${REACTOS_BINARY_DIR}/boot/livecd.cmake "file(RENAME \${CD_DIR}/${_CD_DESTINATION}/${__file} \${CD_DIR}/${_CD_DESTINATION}/${_CD_NAME_ON_CD})\n") endif() endif() #end livecd - + #do we add it to regtest? list(FIND _CD_FOR regtest __cd) if(NOT __cd EQUAL -1) @@ -218,12 +190,52 @@ function(add_clean_target target) COMMENT "Cleaning ${target}") endfunction() -function(add_library name) - _add_library(${name} ${ARGN}) - add_clean_target(${name}) -endfunction() +if(NOT MSVC_IDE) + function(add_library name) + _add_library(${name} ${ARGN}) + add_clean_target(${name}) + endfunction() -function(add_executable name) - _add_executable(${name} ${ARGN}) - add_clean_target(${name}) + function(add_executable name) + _add_executable(${name} ${ARGN}) + add_clean_target(${name}) + endfunction() +endif() + +if(CMAKE_HOST_SYSTEM_NAME MATCHES Windows) + macro(to_win_path _cmake_path _native_path) + string(REPLACE "/" "\\" ${_native_path} "${_cmake_path}") + endmacro() + + function(concatenate_files _file1 _file2 _output) + to_win_path("${_file1}" _real_file1) + to_win_path("${_file2}" _real_file2) + to_win_path("${_output}" _real_output) + add_custom_command( + OUTPUT ${_output} + COMMAND cmd.exe /C "copy /Y /B ${_real_file1} + ${_real_file2} ${_real_output} > nul" + DEPENDS ${_file1} + DEPENDS ${_file2}) + endfunction() +else() + macro(concatenate_files _file1 _file2 _output) + add_custom_command( + OUTPUT ${_output} + COMMAND cat ${_file1} ${_file2} > ${_output} + DEPENDS ${_file1} + DEPENDS ${_file2}) + endmacro() +endif() + +function(add_importlibs _module) + add_dependency_node(${_module}) + foreach(LIB ${ARGN}) + if ("${LIB}" MATCHES "msvcrt") + add_definitions(-D_DLL -D__USE_CRTIMP) + target_link_libraries(${_module} msvcrtex) + endif() + target_link_libraries(${_module} ${CMAKE_BINARY_DIR}/importlibs/lib${LIB}${CMAKE_STATIC_LIBRARY_SUFFIX}) + add_dependencies(${_module} lib${LIB}) + add_dependency_edge(${_module} ${LIB}) + endforeach() endfunction() diff --git a/cmake/Compiler/VISUAL-ASM.cmake b/cmake/Compiler/VISUAL-ASM.cmake new file mode 100644 index 00000000000..0f8019a8e80 --- /dev/null +++ b/cmake/Compiler/VISUAL-ASM.cmake @@ -0,0 +1,2 @@ + +set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s;S) diff --git a/cmake/Platform/Windows-cl.cmake b/cmake/Platform/Windows-cl.cmake index b06cdf3444e..ea903bd1d1c 100644 --- a/cmake/Platform/Windows-cl.cmake +++ b/cmake/Platform/Windows-cl.cmake @@ -31,6 +31,11 @@ if(CMAKE_USE_WDK_ENV) endif() endif() + # Force C/C++ Compilers + include(CMakeForceCompiler) + CMAKE_FORCE_C_COMPILER(cl MSVC) + CMAKE_FORCE_CXX_COMPILER(cl MSVC) + # Add library directories STRING(REPLACE * ${ARCH} ATL_LIB_PATH $ENV{ATL_LIB_PATH}) STRING(REPLACE * ${ARCH} CRT_LIB_PATH $ENV{CRT_LIB_PATH}) @@ -208,13 +213,13 @@ endif() #SET(CMAKE_C_LINK_EXECUTABLE " -E vs_link_exe ${CMAKE_C_LINK_EXECUTABLE}") SET(CMAKE_BUILD_TYPE_INIT Debug) -SET(CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /Zi /Ob0 /Od") -SET(CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /Zi /Ob0 /Od") -SET(CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /EHsc") +SET(CMAKE_CXX_FLAGS_DEBUG_INIT "/Zi /Ob0 /Od") +SET(CMAKE_C_FLAGS_DEBUG_INIT "/Zi /Ob0 /Od") +SET(CMAKE_CXX_FLAGS_INIT "") SET(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/O1 /Ob1 /D NDEBUG") SET(CMAKE_CXX_FLAGS_RELEASE_INIT "/O2 /Ob2 /D NDEBUG") SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/Zi /O2 /Ob1") -SET(CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000") +SET(CMAKE_C_FLAGS_INIT "") SET(CMAKE_C_FLAGS_MINSIZEREL_INIT "/O1 /Ob1 /D NDEBUG") SET(CMAKE_C_FLAGS_RELEASE_INIT "/O2 /Ob2 /D NDEBUG") SET(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/Zi /O2 /Ob1") diff --git a/baseaddress.cmake b/cmake/baseaddress.cmake similarity index 100% rename from baseaddress.cmake rename to cmake/baseaddress.cmake diff --git a/cmake/compilerflags.cmake b/cmake/compilerflags.cmake new file mode 100644 index 00000000000..1fc74017821 --- /dev/null +++ b/cmake/compilerflags.cmake @@ -0,0 +1,25 @@ + +function(add_compiler_flags) + set(flags_list "") + # Adds the compiler flag to both CMAKE_C_FLAGS and CMAKE_CXX_FLAGS + foreach(flag ${ARGN}) + set(flags_list "${flags_list} ${flag}") + endforeach() + + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flags_list}" PARENT_SCOPE) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flags_list}" PARENT_SCOPE) +endfunction() + +function(add_linkerflag MODULE _flag) + set(NEW_LINKER_FLAGS ${_flag}) + get_target_property(LINKER_FLAGS ${MODULE} LINK_FLAGS) + if(LINKER_FLAGS) + set(NEW_LINKER_FLAGS "${LINKER_FLAGS} ${NEW_LINKER_FLAGS}") + endif() + set_target_properties(${MODULE} PROPERTIES LINK_FLAGS ${NEW_LINKER_FLAGS}) +endfunction() + +macro(set_unicode) + add_definitions(-DUNICODE -D_UNICODE) + set(IS_UNICODE 1) +endmacro() diff --git a/config-amd64.cmake b/cmake/config-amd64.cmake similarity index 100% rename from config-amd64.cmake rename to cmake/config-amd64.cmake diff --git a/config-arm.cmake b/cmake/config-arm.cmake similarity index 100% rename from config-arm.cmake rename to cmake/config-arm.cmake diff --git a/config.cmake b/cmake/config.cmake similarity index 86% rename from config.cmake rename to cmake/config.cmake index 4bf055480a6..aabef676321 100644 --- a/config.cmake +++ b/cmake/config.cmake @@ -21,18 +21,24 @@ set(OPTIMIZE "1" CACHE STRING 4 = -O2 5 = -O3") -set(DBG TRUE CACHE BOOL -"Whether to compile for debugging.") - -set(KDBG TRUE CACHE BOOL -"Whether to compile in the integrated kernel debugger.") - set(GDB FALSE CACHE BOOL "Whether to compile for debugging with GDB. If you don't use GDB, don't enable this.") -set(_WINKD_ FALSE CACHE BOOL +set(DBG TRUE CACHE BOOL +"Whether to compile for debugging.") + +if(MSVC) + set(KDBG FALSE CACHE BOOL +"Whether to compile in the integrated kernel debugger.") + set(_WINKD_ TRUE CACHE BOOL "Whether to compile with the KD protocol.") +else() + set(KDBG TRUE CACHE BOOL +"Whether to compile in the integrated kernel debugger.") + set(_WINKD_ FALSE CACHE BOOL +"Whether to compile with the KD protocol.") +endif() set(_ELF_ FALSE CACHE BOOL "Whether to compile support for ELF files. diff --git a/gcc.cmake b/cmake/gcc.cmake similarity index 51% rename from gcc.cmake rename to cmake/gcc.cmake index a51cf6523cd..4b50e427a02 100644 --- a/gcc.cmake +++ b/cmake/gcc.cmake @@ -1,84 +1,54 @@ -# Linking -if(ARCH MATCHES i386) -link_directories("${REACTOS_SOURCE_DIR}/importlibs") -endif() -link_directories(${REACTOS_BINARY_DIR}/lib/sdk/crt) -set(CMAKE_C_LINK_EXECUTABLE " -o ") -set(CMAKE_CXX_LINK_EXECUTABLE " -o ") -set(CMAKE_EXE_LINKER_FLAGS "-nodefaultlibs -nostdlib -Wl,--enable-auto-image-base -Wl,--disable-auto-import") -# -Wl,-T,${REACTOS_SOURCE_DIR}/global.lds -set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS_INIT} -Wl,--disable-stdcall-fixup") - -#set(CMAKE_RC_COMPILE_OBJECT " -i -I${REACTOS_SOURCE_DIR}/include/psdk -I${REACTOS_BINARY_DIR}/include/psdk -I${REACTOS_SOURCE_DIR}/include/ -I${REACTOS_SOURCE_DIR}/include/reactos -I${REACTOS_BINARY_DIR}/include/reactos -I${REACTOS_SOURCE_DIR}/include/reactos/wine -I${REACTOS_SOURCE_DIR}/include/crt -I${REACTOS_SOURCE_DIR}/include/crt/mingw32 -O coff -o ") - -# Temporary, until windres issues are fixed -get_target_property(WRC native-wrc IMPORTED_LOCATION_NOCONFIG) -set(CMAKE_RC_COMPILE_OBJECT - " -DRC_INVOKED -D__WIN32__=1 -D__FLAT__=1 -I${REACTOS_SOURCE_DIR}/include/psdk -I${REACTOS_BINARY_DIR}/include/psdk -I${REACTOS_SOURCE_DIR}/include/ -I${REACTOS_SOURCE_DIR}/include/reactos -I${REACTOS_BINARY_DIR}/include/reactos -I${REACTOS_SOURCE_DIR}/include/reactos/wine -I${REACTOS_SOURCE_DIR}/include/crt -I${REACTOS_SOURCE_DIR}/include/crt/mingw32 -xc -E -o " - "${WRC} -i -o " - " -i -J res -O coff -o ") - -if(NOT CMAKE_HOST_SYSTEM_NAME MATCHES Windows) - set(CMAKE_C_CREATE_STATIC_LIBRARY " crs ") -endif() - # Compiler Core -add_definitions(-pipe -fms-extensions) - -set(CMAKE_C_CREATE_SHARED_LIBRARY " -o ") -set(CMAKE_CXX_CREATE_SHARED_LIBRARY " -o ") -set(CMAKE_RC_CREATE_SHARED_LIBRARY " -o ") +add_compiler_flags(-pipe -fms-extensions) # Debugging (Note: DWARF-4 on 4.5.1 when we ship) -add_definitions(-gdwarf-2 -g2 -femit-struct-debug-detailed=none -feliminate-unused-debug-types) +add_compiler_flags(-gdwarf-2 -g2 -femit-struct-debug-detailed=none -feliminate-unused-debug-types) # Tuning if(ARCH MATCHES i386) - add_definitions(-march=${OARCH} -mtune=${TUNE}) + add_compiler_flags(-march=${OARCH} -mtune=${TUNE}) else() - add_definitions(-march=${OARCH}) + add_compiler_flags(-march=${OARCH}) endif() # Warnings - -add_definitions(-Wall -Wno-char-subscripts -Wpointer-arith -Wno-multichar -Wno-error=uninitialized -Wno-unused-value -Winvalid-pch) +add_compiler_flags(-Wall -Wno-char-subscripts -Wpointer-arith -Wno-multichar -Wno-error=uninitialized -Wno-unused-value -Winvalid-pch) if(ARCH MATCHES amd64) - add_definitions(-Wno-format) + add_compiler_flags(-Wno-format) elseif(ARCH MATCHES arm) - add_definitions(-Wno-attributes) + add_compiler_flags(-Wno-attributes) endif() # Optimizations - if(OPTIMIZE STREQUAL "1") - add_definitions(-Os) + add_compiler_flags(-Os) elseif(OPTIMIZE STREQUAL "2") - add_definitions(-Os) + add_compiler_flags(-Os) elseif(OPTIMIZE STREQUAL "3") - add_definitions(-O1) + add_compiler_flags(-O1) elseif(OPTIMIZE STREQUAL "4") - add_definitions(-O2) + add_compiler_flags(-O2) elseif(OPTIMIZE STREQUAL "5") - add_definitions(-O3) + add_compiler_flags(-O3) endif() -add_definitions(-fno-strict-aliasing) +add_compiler_flags(-fno-strict-aliasing) if(ARCH MATCHES i386) - add_definitions(-mpreferred-stack-boundary=2 -fno-set-stack-executable -fno-optimize-sibling-calls) + add_compiler_flags(-mpreferred-stack-boundary=2 -fno-set-stack-executable -fno-optimize-sibling-calls -fno-omit-frame-pointer) if(OPTIMIZE STREQUAL "1") - add_definitions(-ftracer -momit-leaf-frame-pointer) + add_compiler_flags(-ftracer -momit-leaf-frame-pointer) endif() elseif(ARCH MATCHES amd64) - add_definitions(-mpreferred-stack-boundary=4) + add_compiler_flags(-mpreferred-stack-boundary=4) if(OPTIMIZE STREQUAL "1") - add_definitions(-ftracer -momit-leaf-frame-pointer) + add_compiler_flags(-ftracer -momit-leaf-frame-pointer) endif() elseif(ARCH MATCHES arm) if(OPTIMIZE STREQUAL "1") - add_definitions(-ftracer) + add_compiler_flags(-ftracer) endif() endif() @@ -97,56 +67,38 @@ else() set(ARCH2 ${ARCH}) endif() -# Macros -macro(_PCH_GET_COMPILE_FLAGS _target_name _out_compile_flags _header_filename) - # Add the precompiled header to the build - get_filename_component(FILE ${_header_filename} NAME) - set(_gch_filename "${_target_name}_${FILE}.gch") - list(APPEND ${_out_compile_flags} -c ${_header_filename} -o ${_gch_filename}) +# Linking +if(ARCH MATCHES i386) + link_directories(${REACTOS_SOURCE_DIR}/importlibs) +endif() - # This gets us our includes - get_directory_property(DIRINC INCLUDE_DIRECTORIES) - foreach(item ${DIRINC}) - list(APPEND ${_out_compile_flags} -I${item}) - endforeach() +link_directories(${REACTOS_BINARY_DIR}/lib/sdk/crt) - # This is a particular bit of undocumented/hacky magic I'm quite proud of - get_directory_property(_compiler_flags DEFINITIONS) - string(REPLACE "\ " "\t" _compiler_flags ${_compiler_flags}) - list(APPEND ${_out_compile_flags} ${_compiler_flags}) +set(CMAKE_C_LINK_EXECUTABLE " -o ") - # This gets any specific definitions that were added with set-target-property - get_target_property(_target_defs ${_target_name} COMPILE_DEFINITIONS) - if (_target_defs) - foreach(item ${_target_defs}) - list(APPEND ${_out_compile_flags} -D${item}) - endforeach() - endif() -endmacro() +set(CMAKE_CXX_LINK_EXECUTABLE " -o ") -macro(add_pch _target_name _header_filename _src_list) - get_filename_component(FILE ${_header_filename} NAME) - set(_gch_filename "${_target_name}_${FILE}.gch") - list(APPEND ${_src_list} ${_gch_filename}) - _PCH_GET_COMPILE_FLAGS(${_target_name} _args ${_header_filename}) - file(REMOVE ${_gch_filename}) - add_custom_command( - OUTPUT ${_gch_filename} - COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1} ${_args} - DEPENDS ${_header_filename}) -endmacro() +set(CMAKE_EXE_LINKER_FLAGS "-nodefaultlibs -nostdlib -Wl,--enable-auto-image-base -Wl,--disable-auto-import -Wl,--disable-stdcall-fixup") -macro(add_linkerflag MODULE _flag) - set(NEW_LINKER_FLAGS ${_flag}) - get_target_property(LINKER_FLAGS ${MODULE} LINK_FLAGS) - if(LINKER_FLAGS) - set(NEW_LINKER_FLAGS "${LINKER_FLAGS} ${NEW_LINKER_FLAGS}") - endif() - set_target_properties(${MODULE} PROPERTIES LINK_FLAGS ${NEW_LINKER_FLAGS}) -endmacro() +set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS_INIT} -Wl,--disable-stdcall-fixup") + +set(CMAKE_C_CREATE_SHARED_LIBRARY " -o ") +set(CMAKE_CXX_CREATE_SHARED_LIBRARY " -o ") +set(CMAKE_RC_CREATE_SHARED_LIBRARY " -o ") + +set(CMAKE_ASM_COMPILE_OBJECT " -x assembler-with-cpp -o -I${REACTOS_SOURCE_DIR}/include/asm -I${REACTOS_BINARY_DIR}/include/asm ${CMAKE_C_FLAGS} -D__ASM__ -c ") + +#set(CMAKE_RC_COMPILE_OBJECT " -i -I${REACTOS_SOURCE_DIR}/include/psdk -I${REACTOS_BINARY_DIR}/include/psdk -I${REACTOS_SOURCE_DIR}/include/ -I${REACTOS_SOURCE_DIR}/include/reactos -I${REACTOS_BINARY_DIR}/include/reactos -I${REACTOS_SOURCE_DIR}/include/reactos/wine -I${REACTOS_SOURCE_DIR}/include/crt -I${REACTOS_SOURCE_DIR}/include/crt/mingw32 -O coff -o ") + +# Temporary, until windres issues are fixed +get_target_property(WRC native-wrc IMPORTED_LOCATION_NOCONFIG) +set(CMAKE_RC_COMPILE_OBJECT + " -DRC_INVOKED -D__WIN32__=1 -D__FLAT__=1 -I${REACTOS_SOURCE_DIR}/include/psdk -I${REACTOS_BINARY_DIR}/include/psdk -I${REACTOS_SOURCE_DIR}/include/ -I${REACTOS_SOURCE_DIR}/include/reactos -I${REACTOS_BINARY_DIR}/include/reactos -I${REACTOS_SOURCE_DIR}/include/reactos/wine -I${REACTOS_SOURCE_DIR}/include/crt -I${REACTOS_SOURCE_DIR}/include/crt/mingw32 -xc -E -o " + "${WRC} -i -o " + " -i -J res -O coff -o ") # Optional 3rd parameter: stdcall stack bytes -macro(set_entrypoint MODULE ENTRYPOINT) +function(set_entrypoint MODULE ENTRYPOINT) if(${ENTRYPOINT} STREQUAL "0") add_linkerflag(${MODULE} "-Wl,-entry,0") elseif(ARCH MATCHES i386) @@ -158,17 +110,17 @@ macro(set_entrypoint MODULE ENTRYPOINT) else() add_linkerflag(${MODULE} "-Wl,-entry,${ENTRYPOINT}") endif() -endmacro() +endfunction() -macro(set_subsystem MODULE SUBSYSTEM) +function(set_subsystem MODULE SUBSYSTEM) add_linkerflag(${MODULE} "-Wl,--subsystem,${SUBSYSTEM}") -endmacro() +endfunction() -macro(set_image_base MODULE IMAGE_BASE) +function(set_image_base MODULE IMAGE_BASE) add_linkerflag(${MODULE} "-Wl,--image-base,${IMAGE_BASE}") -endmacro() +endfunction() -macro(set_module_type MODULE TYPE) +function(set_module_type MODULE TYPE) add_dependencies(${MODULE} psdk) if(${IS_CPP}) @@ -193,17 +145,17 @@ macro(set_module_type MODULE TYPE) set_entrypoint(${MODULE} mainCRTStartup) endif(IS_UNICODE) elseif(${TYPE} MATCHES win32dll) - set_entrypoint(${MODULE} DllMain 12) + set_entrypoint(${MODULE} DllMainCRTStartup 12) if(DEFINED baseaddress_${MODULE}) set_image_base(${MODULE} ${baseaddress_${MODULE}}) else() message(STATUS "${MODULE} has no base address") endif() elseif(${TYPE} MATCHES win32ocx) - set_entrypoint(${MODULE} DllMain 12) + set_entrypoint(${MODULE} DllMainCRTStartup 12) set_target_properties(${MODULE} PROPERTIES SUFFIX ".ocx") elseif(${TYPE} MATCHES cpl) - set_entrypoint(${MODULE} DllMain 12) + set_entrypoint(${MODULE} DllMainCRTStartup 12) set_target_properties(${MODULE} PROPERTIES SUFFIX ".cpl") elseif(${TYPE} MATCHES kernelmodedriver) set_target_properties(${MODULE} PROPERTIES LINK_FLAGS "-Wl,--exclude-all-symbols -Wl,-file-alignment=0x1000 -Wl,-section-alignment=0x1000" SUFFIX ".sys") @@ -213,18 +165,14 @@ macro(set_module_type MODULE TYPE) add_dependencies(${MODULE} bugcodes) elseif(${TYPE} MATCHES nativedll) set_subsystem(${MODULE} native) + set_entrypoint(${MODULE} DllMain 12) else() message(FATAL_ERROR "Unknown module type : ${TYPE}") endif() -endmacro() - -macro(set_unicode) - add_definitions(-DUNICODE -D_UNICODE) - set(IS_UNICODE 1) -endmacro() +endfunction() # Workaround lack of mingw RC support in cmake -macro(set_rc_compiler) +function(set_rc_compiler) get_directory_property(defines COMPILE_DEFINITIONS) get_directory_property(includes INCLUDE_DIRECTORIES) @@ -236,12 +184,12 @@ macro(set_rc_compiler) set(rc_result_incs "-I${arg} ${rc_result_incs}") endforeach() - #set(CMAKE_RC_COMPILE_OBJECT " ${rc_result_defs} ${rc_result_incs} -i -O coff -o ") + #set(CMAKE_RC_COMPILE_OBJECT " ${rc_result_defs} ${rc_result_incs} -i -O coff -o " PARENT_SCOPE) set(CMAKE_RC_COMPILE_OBJECT " -DRC_INVOKED -D__WIN32__=1 -D__FLAT__=1 ${rc_result_defs} -I${CMAKE_CURRENT_SOURCE_DIR} ${rc_result_incs} -xc -E -o " "${WRC} -I${CMAKE_CURRENT_SOURCE_DIR} -i -o " - " -i -J res -O coff -o ") -endmacro() + " -i -J res -O coff -o " PARENT_SCOPE) +endfunction() #idl files support set(IDL_COMPILER native-widl) @@ -252,32 +200,19 @@ elseif(ARCH MATCHES amd64) set(IDL_FLAGS -m64 --win64) endif() -set(IDL_HEADER_ARG -h -o) #.h -set(IDL_TYPELIB_ARG -t -o) #.tlb -set(IDL_SERVER_ARG -s -S) #.c for server library -set(IDL_CLIENT_ARG -c -C) #.c for stub client library -set(IDL_PROXY_ARG -p -P) -set(IDL_INTERFACE_ARG -u -o) -set(IDL_DLLDATA_ARG --dlldata-only -o) - - -macro(add_importlibs MODULE) - add_dependency_node(${MODULE}) +function(add_delay_importlibs MODULE) foreach(LIB ${ARGN}) - if ("${LIB}" MATCHES "msvcrt") - target_link_libraries(${MODULE} msvcrtex) - endif() - target_link_libraries(${MODULE} ${CMAKE_BINARY_DIR}/importlibs/lib${LIB}.a) - add_dependencies(${MODULE} lib${LIB}) - add_dependency_edge(${MODULE} ${LIB}) + target_link_libraries(${MODULE} ${CMAKE_BINARY_DIR}/importlibs/lib${LIB}_delayed.a) + add_dependencies(${MODULE} lib${LIB}_delayed) endforeach() -endmacro() + target_link_libraries(${MODULE} delayimp) +endfunction() if(NOT ARCH MATCHES i386) set(DECO_OPTION "-@") endif() -macro(add_importlib_target _exports_file) +function(add_importlib_target _exports_file) get_filename_component(_name ${_exports_file} NAME_WE) get_filename_component(_extension ${_exports_file} EXT) @@ -293,11 +228,19 @@ macro(add_importlib_target _exports_file) if (${_extension} STREQUAL ".spec") + # Normal importlib creation add_custom_command( OUTPUT ${CMAKE_BINARY_DIR}/importlibs/lib${_name}.a COMMAND native-spec2def -n=${_name}${_suffix} -a=${ARCH2} -d=${CMAKE_CURRENT_BINARY_DIR}/${_name}_implib.def ${CMAKE_CURRENT_SOURCE_DIR}/${_exports_file} COMMAND ${MINGW_PREFIX}dlltool --def ${CMAKE_CURRENT_BINARY_DIR}/${_name}_implib.def --kill-at --output-lib=${CMAKE_BINARY_DIR}/importlibs/lib${_name}.a - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_exports_file}) + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_exports_file} native-spec2def) + + # Delayed importlib creation + add_custom_command( + OUTPUT ${CMAKE_BINARY_DIR}/importlibs/lib${_name}_delayed.a + COMMAND native-spec2def -n=${_name}${_suffix} -a=${ARCH2} -d=${CMAKE_CURRENT_BINARY_DIR}/${_name}_delayed_implib.def ${CMAKE_CURRENT_SOURCE_DIR}/${_exports_file} + COMMAND ${MINGW_PREFIX}dlltool --def ${CMAKE_CURRENT_BINARY_DIR}/${_name}_delayed_implib.def --kill-at --output-delaylib ${CMAKE_BINARY_DIR}/importlibs/lib${_name}_delayed.a + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_exports_file} native-spec2def) elseif(${_extension} STREQUAL ".def") message("Use of def files for import libs is deprecated: ${_exports_file}") @@ -305,26 +248,41 @@ macro(add_importlib_target _exports_file) OUTPUT ${CMAKE_BINARY_DIR}/importlibs/lib${_name}.a COMMAND ${MINGW_PREFIX}dlltool --def ${CMAKE_CURRENT_SOURCE_DIR}/${_exports_file} --kill-at --output-lib=${CMAKE_BINARY_DIR}/importlibs/lib${_name}.a DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_exports_file}) + add_custom_command( + OUTPUT ${CMAKE_BINARY_DIR}/importlibs/lib${_name}_delayed.a + COMMAND ${MINGW_PREFIX}dlltool --def ${CMAKE_CURRENT_SOURCE_DIR}/${_exports_file} --kill-at --output-delaylib ${CMAKE_BINARY_DIR}/importlibs/lib${_name}_delayed.a + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_exports_file}) else() message(FATAL_ERROR "Unsupported exports file extension: ${_extension}") endif() + # Normal importlib target add_custom_target( lib${_name} DEPENDS ${CMAKE_BINARY_DIR}/importlibs/lib${_name}.a) + # Delayed importlib target + add_custom_target( + lib${_name}_delayed + DEPENDS ${CMAKE_BINARY_DIR}/importlibs/lib${_name}_delayed.a) -endmacro() +endfunction() + +function(spec2def _dllname _spec_file) + + if(${ARGC} GREATER 2) + set(_file ${ARGV2}) + else() + get_filename_component(_file ${_spec_file} NAME_WE) + endif() -macro(spec2def _dllname _spec_file) - get_filename_component(_file ${_spec_file} NAME_WE) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_file}.def ${CMAKE_CURRENT_BINARY_DIR}/${_file}_stubs.c COMMAND native-spec2def -n=${_dllname} --kill-at -a=${ARCH2} -d=${CMAKE_CURRENT_BINARY_DIR}/${_file}.def -s=${CMAKE_CURRENT_BINARY_DIR}/${_file}_stubs.c ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file} - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file}) + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file} native-spec2def) set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${_file}.def PROPERTIES GENERATED TRUE EXTERNAL_OBJECT TRUE) set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${_file}_stubs.c PROPERTIES GENERATED TRUE) -endmacro() +endfunction() macro(macro_mc FILE) set(COMMAND_MC ${MINGW_PREFIX}windmc -A -b ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}.mc -r ${REACTOS_BINARY_DIR}/include/reactos -h ${REACTOS_BINARY_DIR}/include/reactos) @@ -332,3 +290,114 @@ endmacro() #pseh lib, needed with mingw set(PSEH_LIB "pseh") + +# Macros +if(PCH) + macro(_PCH_GET_COMPILE_FLAGS _target_name _out_compile_flags _header_filename) + # Add the precompiled header to the build + get_filename_component(_FILE ${_header_filename} NAME) + set(_gch_filename "${_FILE}.gch") + list(APPEND ${_out_compile_flags} -c ${_header_filename} -o ${_gch_filename}) + + # This gets us our includes + get_directory_property(DIRINC INCLUDE_DIRECTORIES) + foreach(item ${DIRINC}) + list(APPEND ${_out_compile_flags} -I${item}) + endforeach() + + # This our definitions + get_directory_property(_compiler_flags DEFINITIONS) + list(APPEND ${_out_compile_flags} ${_compiler_flags}) + + # This gets any specific definitions that were added with set-target-property + get_target_property(_target_defs ${_target_name} COMPILE_DEFINITIONS) + if (_target_defs) + foreach(item ${_target_defs}) + list(APPEND ${_out_compile_flags} -D${item}) + endforeach() + endif() + + if(IS_CPP) + list(APPEND ${_out_compile_flags} ${CMAKE_CXX_FLAGS}) + else() + list(APPEND ${_out_compile_flags} ${CMAKE_C_FLAGS}) + endif() + + separate_arguments(${_out_compile_flags}) + endmacro() + + macro(add_pch _target_name _FILE) + set(_header_filename ${CMAKE_CURRENT_SOURCE_DIR}/${_FILE}) + get_filename_component(_basename ${_FILE} NAME) + set(_gch_filename ${_basename}.gch) + _PCH_GET_COMPILE_FLAGS(${_target_name} _args ${_header_filename}) + + if(IS_CPP) + set(__lang CXX) + set(__compiler ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1}) + else() + set(__lang C) + set(__compiler ${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1}) + endif() + + add_custom_command(OUTPUT ${_gch_filename} + COMMAND ${__compiler} ${_args} + IMPLICIT_DEPENDS ${__lang} ${_header_filename} + DEPENDS ${_header_filename} ${ARGN}) + get_target_property(_src_files ${_target_name} SOURCES) + foreach(_item in ${_src_files}) + get_source_file_property(__src_lang ${_item} LANGUAGE) + if(__src_lang STREQUAL __lang) + set_source_files_properties(${_item} PROPERTIES COMPILE_FLAGS "-fpch-preprocess" OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_gch_filename}) + endif() + endforeach() + #set dependency checking : depends on precompiled header only whixh already depends on deeper header + set_target_properties(${_target_name} PROPERTIES IMPLICIT_DEPENDS_INCLUDE_TRANSFORM "\"${_basename}\"=;<${_basename}>=") + endmacro() +else() + macro(add_pch _target_name _FILE) + endmacro() +endif() + +function(CreateBootSectorTarget _target_name _asm_file _object_file _base_address) + get_filename_component(OBJECT_PATH ${_object_file} PATH) + get_filename_component(OBJECT_NAME ${_object_file} NAME) + file(MAKE_DIRECTORY ${OBJECT_PATH}) + get_directory_property(defines COMPILE_DEFINITIONS) + get_directory_property(includes INCLUDE_DIRECTORIES) + + foreach(arg ${defines}) + set(result_defs ${result_defs} -D${arg}) + endforeach() + + foreach(arg ${includes}) + set(result_incs -I${arg} ${result_incs}) + endforeach() + + add_custom_command( + OUTPUT ${_object_file} + COMMAND nasm -o ${_object_file} ${result_incs} ${result_defs} -f bin ${_asm_file} + DEPENDS ${_asm_file}) + set_source_files_properties(${_object_file} PROPERTIES GENERATED TRUE) + add_custom_target(${_target_name} ALL DEPENDS ${_object_file}) +endfunction() + +function(CreateBootSectorTarget2 _target_name _asm_file _binary_file _base_address) + set(_object_file ${_binary_file}.o) + + add_custom_command( + OUTPUT ${_object_file} + COMMAND ${CMAKE_ASM_COMPILER} -x assembler-with-cpp -o ${_object_file} -I${REACTOS_SOURCE_DIR}/include/asm -I${REACTOS_BINARY_DIR}/include/asm -D__ASM__ -c ${_asm_file} + DEPENDS ${_asm_file}) + + add_custom_command( + OUTPUT ${_binary_file} + COMMAND native-obj2bin ${_object_file} ${_binary_file} ${_base_address} + # COMMAND objcopy --output-target binary --image-base 0x${_base_address} ${_object_file} ${_binary_file} + DEPENDS ${_object_file} native-obj2bin) + + set_source_files_properties(${_object_file} ${_binary_file} PROPERTIES GENERATED TRUE) + + add_custom_target(${_target_name} ALL DEPENDS ${_binary_file}) + +endfunction() diff --git a/cmake/idl-support.cmake b/cmake/idl-support.cmake index a64df0da6e4..07a8458d0ff 100644 --- a/cmake/idl-support.cmake +++ b/cmake/idl-support.cmake @@ -16,13 +16,14 @@ if(MSVC) else() set(IDL_FLAGS "") endif() + set(IDL_DEPENDS "") else() set(IDL_COMPILER native-widl) set(IDL_HEADER_ARG -h -o) #.h set(IDL_HEADER_ARG2 -h -H) #.h set(IDL_TYPELIB_ARG -t -o) #.tlb - set(IDL_SERVER_ARG -s -o) #.c for server library - set(IDL_CLIENT_ARG -c -o) #.c for stub client library + set(IDL_SERVER_ARG -Oif -s -o) #.c for server library + set(IDL_CLIENT_ARG -Oif -c -o) #.c for stub client library set(IDL_PROXY_ARG -p -o) set(IDL_INTERFACE_ARG -u -o) if(ARCH MATCHES i386) @@ -32,26 +33,27 @@ else() else() set(IDL_FLAGS "") endif() + set(IDL_DEPENDS native-widl) endif() -macro(get_includes OUTPUT_VAR) - set(${OUTPUT_VAR} "") +function(get_includes OUTPUT_VAR) get_directory_property(_includes INCLUDE_DIRECTORIES) foreach(arg ${_includes}) - set(${OUTPUT_VAR} -I${arg} ${${OUTPUT_VAR}}) + list(APPEND __tmp_var -I${arg}) endforeach() -endmacro() + set(${OUTPUT_VAR} ${__tmp_var} PARENT_SCOPE) +endfunction() -macro(get_defines OUTPUT_VAR) - set(${OUTPUT_VAR} "") +function(get_defines OUTPUT_VAR) get_directory_property(_defines COMPILE_DEFINITIONS) foreach(arg ${_defines}) - set(${OUTPUT_VAR} ${${OUTPUT_VAR}} -D${arg}) + list(APPEND __tmp_var -D${arg}) endforeach() -endmacro() + set(${OUTPUT_VAR} ${__tmp_var} PARENT_SCOPE) +endfunction() -macro(add_typelib TARGET) +function(add_typelib TARGET) get_includes(INCLUDES) get_defines(DEFINES) foreach(FILE ${ARGN}) @@ -59,13 +61,13 @@ macro(add_typelib TARGET) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.tlb COMMAND ${IDL_COMPILER} ${INCLUDES} ${DEFINES} ${IDL_FLAGS} ${IDL_TYPELIB_ARG} ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.tlb ${CMAKE_CURRENT_SOURCE_DIR}/${FILE} - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}) + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${FILE} ${IDL_DEPENDS}) list(APPEND OBJECTS ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.tlb) endforeach() add_custom_target(${TARGET} ALL DEPENDS ${OBJECTS}) -endmacro() +endfunction() -macro(add_idl_headers TARGET) +function(add_idl_headers TARGET) get_includes(INCLUDES) get_defines(DEFINES) foreach(FILE ${ARGN}) @@ -74,64 +76,76 @@ macro(add_idl_headers TARGET) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.h COMMAND ${IDL_COMPILER} ${INCLUDES} ${DEFINES} ${IDL_FLAGS} ${IDL_HEADER_ARG} ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.h ${CMAKE_CURRENT_SOURCE_DIR}/${FILE} - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}) + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${FILE} ${IDL_DEPENDS}) list(APPEND HEADERS ${HEADER}) endforeach() - add_custom_target(${TARGET} ALL DEPENDS ${HEADERS}) -endmacro() + add_custom_target(${TARGET} DEPENDS ${HEADERS}) +endfunction() -macro(add_rpcproxy_files) +function(add_rpcproxy_files) get_includes(INCLUDES) get_defines(DEFINES) if(MSVC) set(DLLDATA_ARG /dlldata ${CMAKE_CURRENT_BINARY_DIR}/proxy.dlldata.c) + set(DLLDATA_DEPENDENCIES "") endif() foreach(FILE ${ARGN}) get_filename_component(NAME ${FILE} NAME_WE) - if(NOT MSVC) + if(MSVC) + set(DLLDATA_DEPENDENCIES ${DLLDATA_DEPENDENCIES} ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_p.c) + else() list(APPEND IDLS ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}) endif() add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_p.c ${NAME}_p.h + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_p.c ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_p.h COMMAND ${IDL_COMPILER} ${INCLUDES} ${DEFINES} ${IDL_FLAGS} ${IDL_PROXY_ARG} ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_p.c ${IDL_HEADER_ARG2} ${NAME}_p.h ${CMAKE_CURRENT_SOURCE_DIR}/${FILE} ${DLLDATA_ARG} - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}) + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${FILE} ${IDL_DEPENDS}) endforeach() # Extra pass to generate dlldata if(MSVC) - #nobody told how to generate it, so mark it as generated + #touch it, so we're sure it's older than its dependencies + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/proxy.dlldata.c + COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/proxy.dlldata.c + DEPENDS ${DLLDATA_DEPENDENCIES}) set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/proxy.dlldata.c PROPERTIES GENERATED TRUE) else() add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/proxy.dlldata.c COMMAND ${IDL_COMPILER} ${INCLUDES} ${DEFINES} ${IDL_FLAGS} --dlldata-only -o ${CMAKE_CURRENT_BINARY_DIR}/proxy.dlldata.c ${IDLS} - DEPENDS ${IDLS}) + DEPENDS ${IDLS} ${IDL_DEPENDS}) endif() -endmacro() +endfunction() -macro(add_rpc_library TARGET) +function(add_rpc_files __type) get_includes(INCLUDES) get_defines(DEFINES) + # Is it a client or server module? + if(__type STREQUAL server) + set(__server_client ${IDL_SERVER_ARG}) + set(__suffix _s) + elseif(__type STREQUAL client) + set(__server_client ${IDL_CLIENT_ARG}) + set(__suffix _c) + else() + message(FATAL_ERROR "Please pass either server or client as argument to add_rpc_files") + endif() foreach(FILE ${ARGN}) - get_filename_component(NAME ${FILE} NAME_WE) + get_filename_component(__name ${FILE} NAME_WE) + set(__name ${__name}${__suffix}) + if(NOT IS_ABSOLUTE ${FILE}) + set(FILE ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}) + endif() add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_s.c ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_s.h - COMMAND ${IDL_COMPILER} ${INCLUDES} ${DEFINES} ${IDL_FLAGS} ${IDL_HEADER_ARG2} ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_s.h ${IDL_SERVER_ARG} ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_s.c ${CMAKE_CURRENT_SOURCE_DIR}/${FILE} - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}) - list(APPEND server_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_s.c) - - add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_c.c ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_c.h - COMMAND ${IDL_COMPILER} ${INCLUDES} ${DEFINES} ${IDL_FLAGS} ${IDL_HEADER_ARG2} ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_c.h ${IDL_CLIENT_ARG} ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_c.c ${CMAKE_CURRENT_SOURCE_DIR}/${FILE} - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}) - list(APPEND client_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_c.c) + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${__name}.c ${CMAKE_CURRENT_BINARY_DIR}/${__name}.h + COMMAND ${IDL_COMPILER} ${INCLUDES} ${DEFINES} ${IDL_FLAGS} ${IDL_HEADER_ARG2} ${CMAKE_CURRENT_BINARY_DIR}/${__name}.h ${__server_client} ${CMAKE_CURRENT_BINARY_DIR}/${__name}.c ${FILE} + DEPENDS ${FILE} ${IDL_DEPENDS}) endforeach() - add_library(${TARGET} ${client_SOURCES} ${server_SOURCES}) - add_dependencies(${TARGET} psdk) -endmacro() +endfunction() -macro(generate_idl_iids IDL_FILE) +function(generate_idl_iids IDL_FILE) get_filename_component(FILE ${IDL_FILE} NAME) if(FILE STREQUAL "${IDL_FILE}") set(IDL_FILE_FULL "${CMAKE_CURRENT_SOURCE_DIR}/${IDL_FILE}") @@ -144,11 +158,11 @@ macro(generate_idl_iids IDL_FILE) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_i.c COMMAND ${IDL_COMPILER} ${INCLUDES} ${DEFINES} ${IDL_FLAGS} ${IDL_INTERFACE_ARG} ${CMAKE_CURRENT_BINARY_DIR}/${NAME}_i.c ${IDL_FILE_FULL} - DEPENDS ${IDL_FILE_FULL}) + DEPENDS ${IDL_FILE_FULL} ${IDL_DEPENDS}) set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${NAME}_i.c PROPERTIES GENERATED TRUE) -endmacro() +endfunction() -macro(add_iid_library TARGET) +function(add_iid_library TARGET) foreach(IDL_FILE ${ARGN}) get_filename_component(NAME ${IDL_FILE} NAME_WE) generate_idl_iids(${IDL_FILE}) @@ -156,4 +170,5 @@ macro(add_iid_library TARGET) endforeach() add_library(${TARGET} ${IID_SOURCES}) add_dependencies(${TARGET} psdk) -endmacro() + set_target_properties(${TARGET} PROPERTIES EXCLUDE_FROM_ALL TRUE) +endfunction() diff --git a/msc.cmake b/cmake/msvc.cmake similarity index 53% rename from msc.cmake rename to cmake/msvc.cmake index 48f5802a9d2..151bfc4226a 100644 --- a/msc.cmake +++ b/cmake/msvc.cmake @@ -13,59 +13,69 @@ elseif(OPTIMIZE STREQUAL "5") add_definitions(/GF /Gy /Ob2 /Os /Ox /GS-) endif() -add_definitions(/X /GR- /GS- /Zl) -add_definitions(-Dinline=__inline -D__STDC__=1) +if(ARCH MATCHES i386) + add_definitions(/DWIN32 /D_WINDOWS) +endif() + +add_definitions(/Dinline=__inline /D__STDC__=1) + +add_compiler_flags(/X /GR- /GS- /Zl /W3) if(${_MACHINE_ARCH_FLAG} MATCHES X86) - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO") - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO") - set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /SAFESEH:NO") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO /NODEFAULTLIB") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO /NODEFAULTLIB") + set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /SAFESEH:NO /NODEFAULTLIB") endif() if(${ARCH} MATCHES amd64) - add_definitions(-D__x86_64) + add_definitions(/D__x86_64) + set(SPEC2DEF_ARCH x86_64) +else() + set(SPEC2DEF_ARCH i386) endif() -link_directories("${REACTOS_BINARY_DIR}/importlibs" ${REACTOS_BINARY_DIR}/lib/sdk/crt) +link_directories(${REACTOS_SOURCE_DIR}/importlibs ${REACTOS_BINARY_DIR}/importlibs ${REACTOS_BINARY_DIR}/lib/sdk/crt) + +set(CMAKE_RC_COMPILE_OBJECT " /I${REACTOS_SOURCE_DIR}/include/psdk /I${REACTOS_BINARY_DIR}/include/psdk /I${REACTOS_SOURCE_DIR}/include /I${REACTOS_SOURCE_DIR}/include/reactos /I${REACTOS_BINARY_DIR}/include/reactos /I${REACTOS_SOURCE_DIR}/include/reactos/wine /I${REACTOS_SOURCE_DIR}/include/crt /I${REACTOS_SOURCE_DIR}/include/crt/mingw32 /fo ") + +if(MSVC_IDE) + # Asm source files are not supported in VS generators yet. As a result, isn't recognized. + # We may temporarily use just the global defines, but this is not a solution as some modules (minihal for example) apply additional definitions to source files, so we get an incorrect build of such targets. + get_directory_property(definitions DEFINITIONS) + set(CMAKE_ASM_COMPILE_OBJECT + " /nologo /X /I${REACTOS_SOURCE_DIR}/include/asm /I${REACTOS_BINARY_DIR}/include/asm ${definitions} /D__ASM__ /D_USE_ML /EP /c > .tmp" + " /nologo /Cp /Fo /c /Ta .tmp") +else() + # NMake Makefiles + set(CMAKE_ASM_COMPILE_OBJECT + " /nologo /X /I${REACTOS_SOURCE_DIR}/include/asm /I${REACTOS_BINARY_DIR}/include/asm /D__ASM__ /D_USE_ML /EP /c > .tmp" + " /nologo /Cp /Fo /c /Ta .tmp") +endif() set(CMAKE_RC_CREATE_SHARED_LIBRARY ${CMAKE_C_CREATE_SHARED_LIBRARY}) set(CMAKE_ASM_CREATE_SHARED_LIBRARY ${CMAKE_C_CREATE_SHARED_LIBRARY}) +set(CMAKE_ASM_CREATE_STATIC_LIBRARY ${CMAKE_C_CREATE_STATIC_LIBRARY}) -macro(add_pch _target_name _header_filename _src_list) - get_filename_component(FILE ${_header_filename} NAME) - set(_gch_filename "${_target_name}_${FILE}.gch") - add_custom_command( - OUTPUT ${_gch_filename} - COMMAND echo Ignoring precompiled header - DEPENDS ${_header_filename}) +macro(add_pch _target_name _FILE) endmacro() -macro(add_linkerflag MODULE _flag) - set(NEW_LINKER_FLAGS ${_flag}) - get_target_property(LINKER_FLAGS ${MODULE} LINK_FLAGS) - if(LINKER_FLAGS) - set(NEW_LINKER_FLAGS "${LINKER_FLAGS} ${NEW_LINKER_FLAGS}") - endif() - set_target_properties(${MODULE} PROPERTIES LINK_FLAGS ${NEW_LINKER_FLAGS}) -endmacro() - -macro(set_entrypoint MODULE ENTRYPOINT) +function(set_entrypoint MODULE ENTRYPOINT) if(${ENTRYPOINT} STREQUAL "0") add_linkerflag(${MODULE} "/NOENTRY") else() add_linkerflag(${MODULE} "/ENTRY:${ENTRYPOINT}") endif() -endmacro() +endfunction() -macro(set_subsystem MODULE SUBSYSTEM) +function(set_subsystem MODULE SUBSYSTEM) add_linkerflag(${MODULE} "/subsystem:${SUBSYSTEM}") -endmacro() +endfunction() -macro(set_image_base MODULE IMAGE_BASE) +function(set_image_base MODULE IMAGE_BASE) add_linkerflag(${MODULE} "/BASE:${IMAGE_BASE}") -endmacro() +endfunction() -macro(set_module_type MODULE TYPE) +function(set_module_type MODULE TYPE) add_dependencies(${MODULE} psdk) if(${TYPE} MATCHES nativecui) set_subsystem(${MODULE} native) @@ -108,20 +118,19 @@ macro(set_module_type MODULE TYPE) set_image_base(${MODULE} 0x00010000) add_linkerflag(${MODULE} "/DRIVER") add_dependencies(${MODULE} bugcodes) + elseif(${TYPE} MATCHES nativedll) + set_subsystem(${MODULE} native) + else() + message(FATAL_ERROR "Unknown module type : ${TYPE}") endif() -endmacro() +endfunction() -macro(set_unicode) - add_definitions(-DUNICODE -D_UNICODE) - set(IS_UNICODE 1) -endmacro() - -macro(set_rc_compiler) +function(set_rc_compiler) # dummy, this workaround is only needed in mingw due to lack of RC support in cmake -endmacro() +endfunction() # Thanks MS for creating a stupid linker -macro(add_importlib_target _exports_file) +function(add_importlib_target _exports_file) get_filename_component(_name ${_exports_file} NAME_WE) get_target_property(_suffix ${_name} SUFFIX) if(${_suffix} STREQUAL "_suffix-NOTFOUND") @@ -136,8 +145,8 @@ macro(add_importlib_target _exports_file) # Generate the asm stub file and the export def file add_custom_command( OUTPUT ${CMAKE_BINARY_DIR}/importlibs/lib${_name}_stubs.asm ${CMAKE_BINARY_DIR}/importlibs/lib${_name}_exp.def - COMMAND native-spec2def --ms --kill-at -r -n=${_name}${_suffix} -d=${CMAKE_BINARY_DIR}/importlibs/lib${_name}_exp.def -l=${CMAKE_BINARY_DIR}/importlibs/lib${_name}_stubs.asm ${CMAKE_CURRENT_SOURCE_DIR}/${_exports_file} - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_exports_file}) + COMMAND native-spec2def --ms --kill-at -a=${SPEC2DEF_ARCH} --implib -n=${_name}${_suffix} -d=${CMAKE_BINARY_DIR}/importlibs/lib${_name}_exp.def -l=${CMAKE_BINARY_DIR}/importlibs/lib${_name}_stubs.asm ${CMAKE_CURRENT_SOURCE_DIR}/${_exports_file} + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_exports_file} native-spec2def) # Assemble the stub file add_custom_command( @@ -147,6 +156,7 @@ macro(add_importlib_target _exports_file) # Add neccessary importlibs for redirections set(_libraries "") + set(_dependencies "") foreach(_lib ${ARGN}) list(APPEND _libraries "${CMAKE_BINARY_DIR}/importlibs/${_lib}.lib") list(APPEND _dependencies ${_lib}) @@ -155,7 +165,7 @@ macro(add_importlib_target _exports_file) # Build the importlib add_custom_command( OUTPUT ${CMAKE_BINARY_DIR}/importlibs/lib${_name}.lib - COMMAND LINK /LIB /NOLOGO /MACHINE:X86 /DEF:${CMAKE_BINARY_DIR}/importlibs/lib${_name}_exp.def /OUT:${CMAKE_BINARY_DIR}/importlibs/lib${_name}.lib ${CMAKE_BINARY_DIR}/importlibs/lib${_name}_stubs.obj ${_libraries} + COMMAND LINK /LIB /NOLOGO /DEF:${CMAKE_BINARY_DIR}/importlibs/lib${_name}_exp.def /OUT:${CMAKE_BINARY_DIR}/importlibs/lib${_name}.lib ${CMAKE_BINARY_DIR}/importlibs/lib${_name}_stubs.obj ${_libraries} DEPENDS ${CMAKE_BINARY_DIR}/importlibs/lib${_name}_stubs.obj ${CMAKE_BINARY_DIR}/importlibs/lib${_name}_exp.def) # Add the importlib target @@ -164,27 +174,30 @@ macro(add_importlib_target _exports_file) DEPENDS ${CMAKE_BINARY_DIR}/importlibs/lib${_name}.lib) add_dependencies(lib${_name} asm ${_dependencies}) -endmacro() +endfunction() -macro(add_importlibs MODULE) +macro(add_delay_importlibs MODULE) foreach(LIB ${ARGN}) - if ("${LIB}" MATCHES "msvcrt") - target_link_libraries(${MODULE} msvcrtex) - endif() - target_link_libraries(${MODULE} ${CMAKE_BINARY_DIR}/importlibs/lib${LIB}.lib) + add_linkerflag(${MODULE} "/DELAYLOAD:${LIB}.dll") + target_link_libraries(${MODULE} ${CMAKE_BINARY_DIR}/importlibs/lib${LIB}.LIB) add_dependencies(${MODULE} lib${LIB}) endforeach() + target_link_libraries(${MODULE} delayimp) endmacro() -macro(spec2def _dllname _spec_file) - get_filename_component(_file ${_spec_file} NAME_WE) +function(spec2def _dllname _spec_file) + if(${ARGC} GREATER 2) + set(_file ${ARGV2}) + else() + get_filename_component(_file ${_spec_file} NAME_WE) + endif() add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_file}.def ${CMAKE_CURRENT_BINARY_DIR}/${_file}_stubs.c - COMMAND native-spec2def --ms --kill-at -n=${_dllname} -d=${CMAKE_CURRENT_BINARY_DIR}/${_file}.def -s=${CMAKE_CURRENT_BINARY_DIR}/${_file}_stubs.c ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file} - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file}) + COMMAND native-spec2def --ms --kill-at -a=${SPEC2DEF_ARCH} -n=${_dllname} -d=${CMAKE_CURRENT_BINARY_DIR}/${_file}.def -s=${CMAKE_CURRENT_BINARY_DIR}/${_file}_stubs.c ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file} + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file} native-spec2def) set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${_file}.def ${CMAKE_CURRENT_BINARY_DIR}/${_file}_stubs.c PROPERTIES GENERATED TRUE) -endmacro() +endfunction() macro(macro_mc FILE) set(COMMAND_MC mc -r ${REACTOS_BINARY_DIR}/include/reactos -h ${REACTOS_BINARY_DIR}/include/reactos ${CMAKE_CURRENT_SOURCE_DIR}/${FILE}.mc) @@ -194,3 +207,28 @@ file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/importlibs) #pseh workaround set(PSEH_LIB "pseh") + +function(CreateBootSectorTarget2 _target_name _asm_file _binary_file _base_address) + + set(_object_file ${_binary_file}.obj) + set(_temp_file ${_binary_file}.tmp) + + add_custom_command( + OUTPUT ${_temp_file} + COMMAND ${CMAKE_C_COMPILER} /nologo /X /I${REACTOS_SOURCE_DIR}/include/asm /I${REACTOS_BINARY_DIR}/include/asm /D__ASM__ /D_USE_ML /EP /c ${_asm_file} > ${_temp_file} + DEPENDS ${_asm_file}) + + add_custom_command( + OUTPUT ${_object_file} + COMMAND ml /nologo /Cp /Fo${_object_file} /c /Ta ${_temp_file} + DEPENDS ${_temp_file}) + + add_custom_command( + OUTPUT ${_binary_file} + COMMAND native-obj2bin ${_object_file} ${_binary_file} ${_base_address} + DEPENDS ${_object_file} native-obj2bin) + + set_source_files_properties(${_object_file} ${_temp_file} ${_binary_file} PROPERTIES GENERATED TRUE) + + add_custom_target(${_target_name} ALL DEPENDS ${_binary_file}) +endfunction() diff --git a/configure.cmd b/configure.cmd index f93b74ab14e..5e90c6e6b3e 100755 --- a/configure.cmd +++ b/configure.cmd @@ -2,25 +2,37 @@ :: Get the source root directory set REACTOS_SOURCE_DIR=%~dp0 -set USE_NMAKE= +set USE_NMAKE=0 + +:: Detect presence of cmake +cmd /c cmake --version 2>&1 | find "cmake version" > NUL || goto cmake_notfound :: Detect build environment (MinGW, VS, WDK, ...) if defined ROS_ARCH ( + echo Detected RosBE for %ROS_ARCH% set BUILD_ENVIRONMENT=MinGW set ARCH=%ROS_ARCH% - echo Detected RosBE for %ROS_ARCH% + if /I "%1" == "Codeblocks" ( + set CMAKE_GENERATOR="CodeBlocks - MinGW Makefiles" + ) else if /I "%1" == "Eclipse" ( + set CMAKE_GENERATOR="Eclipse CDT4 - MinGW Makefiles" + ) else ( + set CMAKE_GENERATOR="MinGW Makefiles" + ) + ) else if defined DDK_TARGET_OS ( + echo Detected DDK/WDK for %DDK_TARGET_OS%-%_BUILDARCH%% + set BUILD_ENVIRONMENT=WDK if "%_BUILDARCH%" == "x86" ( set ARCH=i386 - ) - if "%_BUILDARCH%" == "AMD64" ( + ) else if "%_BUILDARCH%" == "AMD64" ( set ARCH=amd64 ) - set BUILD_ENVIRONMENT=WDK set USE_NMAKE=1 - echo Detected DDK/WDK for %DDK_TARGET_OS%-%ARCH% -)else if defined VCINSTALLDIR ( -:: VS command prompt does not put this in enviroment vars + set USE_WDK_HEADERS=0 + +) else if defined VCINSTALLDIR ( + :: VS command prompt does not put this in enviroment vars cl 2>&1 | find "x86" > NUL && set ARCH=i386 cl 2>&1 | find "x64" > NUL && set ARCH=amd64 cl 2>&1 | find "14." > NUL && set BUILD_ENVIRONMENT=VS8 @@ -30,33 +42,69 @@ if defined ROS_ARCH ( echo Error: Visual Studio version too old or version detection failed. exit /b ) + echo Detected Visual Studio Environment %BUILD_ENVIRONMENT%-%ARCH% - if not "%1" == "VSSolution" ( + if /I "%1" == "VSSolution" ( + if "%BUILD_ENVIRONMENT%" == "VS8" ( + if "%ARCH%" == "amd64" ( + set CMAKE_GENERATOR="Visual Studio 8 2005 Win64" + ) else ( + set CMAKE_GENERATOR="Visual Studio 8 2005" + ) + ) else if "%BUILD_ENVIRONMENT%" == "VS9" ( + if "%ARCH%" == "amd64" ( + set CMAKE_GENERATOR="Visual Studio 9 2008 Win64" + ) else ( + set CMAKE_GENERATOR="Visual Studio 9 2008" + ) + ) else if "%BUILD_ENVIRONMENT%" == "VS10" ( + if "%ARCH%" == "amd64" ( + set CMAKE_GENERATOR="Visual Studio 10 Win64" + ) else ( + set CMAKE_GENERATOR="Visual Studio 10" + ) + ) + ) else ( set USE_NMAKE=1 echo This script defaults to nmake. To use Visual Studio GUI specify "VSSolution" as a parameter. ) + ) else if defined sdkdir ( + echo Detected Windows SDK %TARGET_PLATFORM%-%TARGET_CPU% if "%TARGET_CPU%" == "x86" ( set ARCH=i386 - ) - if "%TARGET_CPU%" == "x64" ( + ) else if "%TARGET_CPU%" == "x64" ( set ARCH=amd64 ) + set BUILD_ENVIRONMENT=SDK set USE_NMAKE=1 - echo Detected Windows SDK %TARGET_PLATFORM%-%ARCH% + +) else ( + echo Error: Unable to detect build environment. Configure script failure. + exit /b ) -if defined ARCH if defined BUILD_ENVIRONMENT ( - goto createdirs +:: Checkpoint +if not defined ARCH ( + echo unknown build architecture + exit /b ) -echo Error: Unable to detect a build environment. Configure script failure. -exit /b +:: Detect nmake generator +if %USE_NMAKE% == 1 ( + if /I "%1" == "CodeBlocks" ( + set CMAKE_GENERATOR="CodeBlocks - NMake Makefiles" + ) else if /I "%1" == "Eclipse" ( + set CMAKE_GENERATOR="Eclipse CDT4 - NMake Makefiles" + ) else if /I "%1" == "JOM" ( + set CMAKE_GENERATOR="NMake Makefiles JOM" + ) else ( + set CMAKE_GENERATOR="NMake Makefiles" + ) +) :: Create directories -:createdirs - set REACTOS_OUTPUT_PATH=output-%BUILD_ENVIRONMENT%-%ARCH% if "%REACTOS_SOURCE_DIR%" == "%CD%\" ( echo Creating directories in %REACTOS_OUTPUT_PATH% @@ -74,7 +122,6 @@ if not exist reactos ( mkdir reactos ) -:hostprep echo Preparing host tools... cd host-tools if EXIST CMakeCache.txt ( @@ -82,64 +129,28 @@ if EXIST CMakeCache.txt ( ) set REACTOS_BUILD_TOOLS_DIR=%CD% -if "%BUILD_ENVIRONMENT%" == "MinGW" ( - cmake -G "MinGW Makefiles" -DARCH=%ARCH% %REACTOS_SOURCE_DIR% -) else if defined USE_NMAKE ( - cmake -G "NMake Makefiles" -DARCH=%ARCH% %REACTOS_SOURCE_DIR% -) else if "%BUILD_ENVIRONMENT%" == "VS8" ( - if "%ARCH%" == "amd64" ( - cmake -G "Visual Studio 8 2005 Win64" -DARCH=%ARCH% %REACTOS_SOURCE_DIR% - ) else ( - cmake -G "Visual Studio 8 2005" -DARCH=%ARCH% %REACTOS_SOURCE_DIR% - ) -) else if "%BUILD_ENVIRONMENT%" == "VS9" ( - if "%ARCH%" == "amd64" ( - cmake -G "Visual Studio 9 2008 Win64" -DARCH=%ARCH% %REACTOS_SOURCE_DIR% - ) else ( - cmake -G "Visual Studio 9 2008" -DARCH=%ARCH% %REACTOS_SOURCE_DIR% - ) -) else if "%BUILD_ENVIRONMENT%" == "VS10" ( - if "%ARCH%" == "amd64" ( - cmake -G "Visual Studio 10 Win64" -DARCH=%ARCH% %REACTOS_SOURCE_DIR% - ) else ( - cmake -G "Visual Studio 10" -DARCH=%ARCH% %REACTOS_SOURCE_DIR% - ) -) +cmake -G %CMAKE_GENERATOR% -DARCH=%ARCH% %REACTOS_SOURCE_DIR% cd.. -:reactprep echo Preparing reactos... - cd reactos if EXIST CMakeCache.txt ( del CMakeCache.txt /q ) if "%BUILD_ENVIRONMENT%" == "MinGW" ( - cmake -G "MinGW Makefiles" -DCMAKE_TOOLCHAIN_FILE=toolchain-mingw32.cmake -DARCH=%ARCH% -DREACTOS_BUILD_TOOLS_DIR:DIR="%REACTOS_BUILD_TOOLS_DIR%" %REACTOS_SOURCE_DIR% -) else if defined USE_NMAKE ( - cmake -G "NMake Makefiles" -DCMAKE_TOOLCHAIN_FILE=toolchain-msvc.cmake -DARCH=%ARCH% -DREACTOS_BUILD_TOOLS_DIR:DIR="%REACTOS_BUILD_TOOLS_DIR%" %REACTOS_SOURCE_DIR% -) else if "%BUILD_ENVIRONMENT%" == "VS8" ( - if "%ARCH%" == "amd64" ( - cmake -G "Visual Studio 8 2005 Win64" -DCMAKE_TOOLCHAIN_FILE=toolchain-msvc.cmake -DARCH=%ARCH% -DREACTOS_BUILD_TOOLS_DIR:DIR="%REACTOS_BUILD_TOOLS_DIR%" %REACTOS_SOURCE_DIR% - ) else ( - cmake -G "Visual Studio 8 2005" -DCMAKE_TOOLCHAIN_FILE=toolchain-msvc.cmake -DARCH=%ARCH% -DREACTOS_BUILD_TOOLS_DIR:DIR="%REACTOS_BUILD_TOOLS_DIR%" %REACTOS_SOURCE_DIR% - ) -) else if "%BUILD_ENVIRONMENT%" == "VS9" ( - if "%ARCH%" == "amd64" ( - cmake -G "Visual Studio 9 2008 Win64" -DCMAKE_TOOLCHAIN_FILE=toolchain-msvc.cmake -DARCH=%ARCH% -DREACTOS_BUILD_TOOLS_DIR:DIR="%REACTOS_BUILD_TOOLS_DIR%" %REACTOS_SOURCE_DIR% - ) else ( - cmake -G "Visual Studio 9 2008" -DCMAKE_TOOLCHAIN_FILE=toolchain-msvc.cmake -DARCH=%ARCH% -DREACTOS_BUILD_TOOLS_DIR:DIR="%REACTOS_BUILD_TOOLS_DIR%" %REACTOS_SOURCE_DIR% - ) -) else if "%BUILD_ENVIRONMENT%" == "VS10" ( - if "%ARCH%" == "amd64" ( - cmake -G "Visual Studio 10 Win64" -DCMAKE_TOOLCHAIN_FILE=toolchain-msvc.cmake -DARCH=%ARCH% -DREACTOS_BUILD_TOOLS_DIR:DIR="%REACTOS_BUILD_TOOLS_DIR%" %REACTOS_SOURCE_DIR% - ) else ( - cmake -G "Visual Studio 10" -DCMAKE_TOOLCHAIN_FILE=toolchain-msvc.cmake -DARCH=%ARCH% -DREACTOS_BUILD_TOOLS_DIR:DIR="%REACTOS_BUILD_TOOLS_DIR%" %REACTOS_SOURCE_DIR% - ) + cmake -G %CMAKE_GENERATOR% -DENABLE_CCACHE=0 -DPCH=1 -DCMAKE_TOOLCHAIN_FILE=toolchain-gcc.cmake -DARCH=%ARCH% -DREACTOS_BUILD_TOOLS_DIR:DIR="%REACTOS_BUILD_TOOLS_DIR%" %REACTOS_SOURCE_DIR% +) else if "%BUILD_ENVIRONMENT%" == "WDK" ( + cmake -G %CMAKE_GENERATOR% -DCMAKE_TOOLCHAIN_FILE=toolchain-msvc.cmake -DUSE_WDK_HEADERS=%USE_WDK_HEADERS% -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% ) cd.. -echo Configure script complete! Enter directories and execute appropriate build commands(ex: make, nmake, etc...). +echo Configure script complete! Enter directories and execute appropriate build commands(ex: make, nmake, jom, etc...). +exit /b +:cmake_notfound + echo Unable to find cmake, if it is installed, check your PATH variable. + exit /b diff --git a/configure.sh b/configure.sh index d265d1dc79e..8aea7b9298a 100755 --- a/configure.sh +++ b/configure.sh @@ -10,7 +10,6 @@ ARCH=$ROS_ARCH REACTOS_SOURCE_DIR=$(cd `dirname $0` && pwd) REACTOS_OUTPUT_PATH=output-$BUILD_ENVIRONMENT-$ARCH -echo ARCH $ARCH ROS $ROS_ARCH if [ "$REACTOS_SOURCE_DIR" == "$PWD" ] then echo Creating directories in $REACTOS_OUTPUT_PATH @@ -31,8 +30,14 @@ fi REACTOS_BUILD_TOOLS_DIR="$PWD" cmake -G "Unix Makefiles" -DARCH=$ARCH "$REACTOS_SOURCE_DIR" +echo Preparing reactos... cd ../reactos -cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=toolchain-mingw32.cmake -DARCH=$ARCH -DREACTOS_BUILD_TOOLS_DIR="$REACTOS_BUILD_TOOLS_DIR" "$REACTOS_SOURCE_DIR" +if [ -f CMakeCache.txt ] +then + rm -f CMakeCache.txt +fi -echo Configure script complete! Enter directories and execute appropriate build commands(ex: make, makex, etc...). +cmake -G "Unix Makefiles" -DENABLE_CCACHE=0 -DPCH=0 -DCMAKE_TOOLCHAIN_FILE=toolchain-gcc.cmake -DARCH=$ARCH -DREACTOS_BUILD_TOOLS_DIR="$REACTOS_BUILD_TOOLS_DIR" "$REACTOS_SOURCE_DIR" + +echo Configure script complete! Enter directories and execute appropriate build commands\(ex: make, makex, etc...\). diff --git a/dll/3rdparty/CMakeLists.txt b/dll/3rdparty/CMakeLists.txt index bf606568afe..53f513c732a 100644 --- a/dll/3rdparty/CMakeLists.txt +++ b/dll/3rdparty/CMakeLists.txt @@ -5,7 +5,8 @@ endif() add_subdirectory(libjpeg) add_subdirectory(libpng) add_subdirectory(libtiff) -add_subdirectory(libxslt) + if(NOT MSVC) -add_subdirectory(mesa32) + add_subdirectory(libxslt) + add_subdirectory(mesa32) endif() diff --git a/dll/3rdparty/dxtn/CMakeLists.txt b/dll/3rdparty/dxtn/CMakeLists.txt index d581cbc516b..d4b2425c039 100644 --- a/dll/3rdparty/dxtn/CMakeLists.txt +++ b/dll/3rdparty/dxtn/CMakeLists.txt @@ -1,6 +1,4 @@ -add_definitions(-D_DLL -D__USE_CRTIMP) - spec2def(dxtn.dll dxtn.spec) add_library(dxtn SHARED diff --git a/dll/3rdparty/libjpeg/CMakeLists.txt b/dll/3rdparty/libjpeg/CMakeLists.txt index 7805ac5e282..1356e31a0f0 100644 --- a/dll/3rdparty/libjpeg/CMakeLists.txt +++ b/dll/3rdparty/libjpeg/CMakeLists.txt @@ -4,8 +4,7 @@ add_definitions( -D_WINDOWS -D_MBCS -DJPEG_DLL - -Dmain=mainptr - -D_DLL -D__USE_CRTIMP) + -Dmain=mainptr) include_directories( ${REACTOS_SOURCE_DIR}/include/reactos/libs/libjpeg @@ -60,9 +59,6 @@ add_library(libjpeg SHARED jmemnobs.c) set_entrypoint(libjpeg 0) - add_importlibs(libjpeg msvcrt kernel32) - add_dependencies(libjpeg psdk) - add_cd_file(TARGET libjpeg DESTINATION reactos/system32 FOR all) diff --git a/dll/3rdparty/libpng/CMakeLists.txt b/dll/3rdparty/libpng/CMakeLists.txt index 4c5d4ae4793..199e59a1d9e 100644 --- a/dll/3rdparty/libpng/CMakeLists.txt +++ b/dll/3rdparty/libpng/CMakeLists.txt @@ -3,8 +3,7 @@ add_definitions( -DWIN32 -DNDEBUG -D_WINDOWS - -DPNG_BUILD_DLL - -D_DLL -D__USE_CRTIMP) + -DPNG_BUILD_DLL) include_directories( ${REACTOS_SOURCE_DIR}/include/reactos/libs/libpng @@ -29,11 +28,7 @@ add_library(libpng SHARED pngwutil.c) set_entrypoint(libpng 0) - target_link_libraries(libpng zlib) - add_importlibs(libpng msvcrt kernel32) - add_dependencies(libpng psdk) - add_cd_file(TARGET libpng DESTINATION reactos/system32 FOR all) diff --git a/dll/3rdparty/libtiff/CMakeLists.txt b/dll/3rdparty/libtiff/CMakeLists.txt index 2586552d5fe..a83ca57ebd5 100644 --- a/dll/3rdparty/libtiff/CMakeLists.txt +++ b/dll/3rdparty/libtiff/CMakeLists.txt @@ -4,8 +4,7 @@ add_definitions( -DNDEBUG -DBUILD_LIBTIFF_DLL -DDLL_EXPORT - -DUSE_WIN32_FILEIO - -D_DLL -D__USE_CRTIMP) + -DUSE_WIN32_FILEIO) include_directories( ${REACTOS_SOURCE_DIR}/include/reactos/libs/libtiff @@ -52,11 +51,7 @@ add_library(libtiff SHARED tif_zip.c) set_entrypoint(libtiff 0) - target_link_libraries(libtiff zlib getopt) - add_importlibs(libtiff user32 msvcrt kernel32) - add_dependencies(libtiff psdk) - add_cd_file(TARGET libtiff DESTINATION reactos/system32 FOR all) diff --git a/dll/3rdparty/libxslt/CMakeLists.txt b/dll/3rdparty/libxslt/CMakeLists.txt index b56c8b4d1e3..10df37c5b02 100644 --- a/dll/3rdparty/libxslt/CMakeLists.txt +++ b/dll/3rdparty/libxslt/CMakeLists.txt @@ -1,4 +1,6 @@ +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) + add_definitions( -DHAVE_CONFIG_H -DWIN32 @@ -8,8 +10,7 @@ add_definitions( -DHAVE_WIN32_THREADS -D_REENTRANT -D_WINSOCKAPI_ - -DLIBXML_STATIC - -D_DLL -D__USE_CRTIMP) + -DLIBXML_STATIC) add_library(libxslt SHARED attributes.c @@ -33,14 +34,13 @@ add_library(libxslt SHARED xsltutils.c) set_entrypoint(libxslt 0) - target_link_libraries(libxslt libxml2) - add_importlibs(libxslt msvcrt ws2_32 kernel32) + if(MSVC) -add_importlibs(libxslt ntdll) + add_importlibs(libxslt ntdll) endif() add_dependencies(libxslt psdk) - +add_pch(libxslt libxslt.h) add_cd_file(TARGET libxslt DESTINATION reactos/system32 FOR all) diff --git a/dll/3rdparty/libxslt/libxslt.rbuild b/dll/3rdparty/libxslt/libxslt.rbuild index 3c58dc1db55..eefedf36887 100644 --- a/dll/3rdparty/libxslt/libxslt.rbuild +++ b/dll/3rdparty/libxslt/libxslt.rbuild @@ -33,4 +33,5 @@ xslt.c xsltlocale.c xsltutils.c + libxslt.h diff --git a/dll/3rdparty/mesa32/CMakeLists.txt b/dll/3rdparty/mesa32/CMakeLists.txt index 49e25ec7fb1..978f8910bee 100644 --- a/dll/3rdparty/mesa32/CMakeLists.txt +++ b/dll/3rdparty/mesa32/CMakeLists.txt @@ -1,22 +1,21 @@ if(NOT MSVC) -add_definitions(-w) + add_compiler_flags(-w) endif() add_definitions( -DUSE_EXTERNAL_DXTN_LIB=1 -DBUILD_GL32 -DWIN32 - -DUSE_3DNOW_ASM - -D_DLL -D__USE_CRTIMP) + -DUSE_3DNOW_ASM) if(ARCH MATCHES i386) -add_definitions( - -DUSE_X86_ASM - -DUSE_MMX_ASM - -DUSE_SSE_ASM) + add_definitions( + -DUSE_X86_ASM + -DUSE_MMX_ASM + -DUSE_SSE_ASM) else() -add_definitions(-DGL_NO_STDCALL) + add_definitions(-DGL_NO_STDCALL) endif(ARCH MATCHES i386) if(NOT MSVC) @@ -229,44 +228,39 @@ list(APPEND SOURCE src/vbo/vbo_split_inplace.c src/drivers/windows/icd/mesa.def) -set_source_files_properties(src/drivers/windows/icd/mesa.def PROPERTIES EXTERNAL_OBJECT TRUE) - if(ARCH MATCHES i386) -list(APPEND SOURCE - src/tnl/t_vertex_sse.c - src/x86/3dnow.c - src/x86/3dnow_normal.S - src/x86/3dnow_xform1.S - src/x86/3dnow_xform2.S - src/x86/3dnow_xform3.S - src/x86/3dnow_xform4.S - src/x86/common_x86.c - src/x86/common_x86_asm.S - src/x86/glapi_x86.S - src/x86/mmx_blend.S - src/x86/read_rgba_span_x86.S - src/x86/sse_normal.S - src/x86/sse_xform1.S - src/x86/sse_xform2.S - src/x86/sse_xform3.S - src/x86/sse_xform4.S - src/x86/sse.c - src/x86/x86.c - src/x86/x86_cliptest.S - src/x86/x86_xform2.S - src/x86/x86_xform3.S - src/x86/x86_xform4.S - src/x86/rtasm/x86sse.c) + list(APPEND SOURCE + src/tnl/t_vertex_sse.c + src/x86/3dnow.c + src/x86/3dnow_normal.S + src/x86/3dnow_xform1.S + src/x86/3dnow_xform2.S + src/x86/3dnow_xform3.S + src/x86/3dnow_xform4.S + src/x86/common_x86.c + src/x86/common_x86_asm.S + src/x86/glapi_x86.S + src/x86/mmx_blend.S + src/x86/read_rgba_span_x86.S + src/x86/sse_normal.S + src/x86/sse_xform1.S + src/x86/sse_xform2.S + src/x86/sse_xform3.S + src/x86/sse_xform4.S + src/x86/sse.c + src/x86/x86.c + src/x86/x86_cliptest.S + src/x86/x86_xform2.S + src/x86/x86_xform3.S + src/x86/x86_xform4.S + src/x86/rtasm/x86sse.c) else() -list(APPEND SOURCE src/x86-64/x86-64.c src/x86-64/xform4.S) -endif(ARCH MATCHES i386) + list(APPEND SOURCE src/x86-64/x86-64.c src/x86-64/xform4.S) +endif() add_library(mesa32 SHARED ${SOURCE}) - +add_pch(mesa32 src/main/glheader.h) set_entrypoint(mesa32 0) - add_importlibs(mesa32 gdi32 user32 msvcrt kernel32 ntdll) - add_dependencies(mesa32 psdk) - add_cd_file(TARGET mesa32 DESTINATION reactos/system32 FOR all) diff --git a/dll/3rdparty/mesa32/mesa32.rbuild b/dll/3rdparty/mesa32/mesa32.rbuild index c13d8eeaef4..e0a5ce4ddf5 100644 --- a/dll/3rdparty/mesa32/mesa32.rbuild +++ b/dll/3rdparty/mesa32/mesa32.rbuild @@ -126,6 +126,7 @@ texstore.c varray.c vtxfmt.c + glheader.h m_debug_clip.c diff --git a/dll/CMakeLists.txt b/dll/CMakeLists.txt index 77a2635c05c..dfba1ee53fd 100644 --- a/dll/CMakeLists.txt +++ b/dll/CMakeLists.txt @@ -3,7 +3,6 @@ add_subdirectory(3rdparty) add_subdirectory(cpl) add_subdirectory(directx) add_subdirectory(keyboard) -add_subdirectory(nls) add_subdirectory(ntdll) add_subdirectory(shellext) add_subdirectory(win32) diff --git a/dll/cpl/CMakeLists.txt b/dll/cpl/CMakeLists.txt index a81c845dcab..9276f8fd1df 100644 --- a/dll/cpl/CMakeLists.txt +++ b/dll/cpl/CMakeLists.txt @@ -4,6 +4,9 @@ add_subdirectory(appwiz) add_subdirectory(console)#Warning: console\\/lang/cs-CZ.rc:143: unrecognized escape sequence add_subdirectory(desk) add_subdirectory(hdwwiz) +if(NOT MSVC) + add_subdirectory(inetcpl) # FIXME: msvc build. +endif() add_subdirectory(input) add_subdirectory(intl) add_subdirectory(joy) diff --git a/dll/cpl/access/CMakeLists.txt b/dll/cpl/access/CMakeLists.txt index 6ee6db7d6e7..6c78ce27997 100644 --- a/dll/cpl/access/CMakeLists.txt +++ b/dll/cpl/access/CMakeLists.txt @@ -24,4 +24,5 @@ add_importlibs(access comctl32 kernel32) +add_pch(access access.h) add_cd_file(TARGET access DESTINATION reactos/system32 FOR all) diff --git a/dll/cpl/access/access.c b/dll/cpl/access/access.c index a2dd9b3befd..7b0a85eb160 100644 --- a/dll/cpl/access/access.c +++ b/dll/cpl/access/access.c @@ -8,12 +8,6 @@ * Copyright 2007 Eric Kohl */ -#include -#include -#include -#include -#include -#include "resource.h" #include "access.h" #define NUM_APPLETS (1) diff --git a/dll/cpl/access/access.h b/dll/cpl/access/access.h index 88c29d2c8c7..5237cb947b6 100644 --- a/dll/cpl/access/access.h +++ b/dll/cpl/access/access.h @@ -1,4 +1,12 @@ -#pragma once +#include +#include +#include +#include +#include +#include +#include + +#include "resource.h" typedef LONG (CALLBACK *APPLET_INITPROC)(VOID); diff --git a/dll/cpl/access/access.rbuild b/dll/cpl/access/access.rbuild index 257cb69b693..ad1d7ebe519 100644 --- a/dll/cpl/access/access.rbuild +++ b/dll/cpl/access/access.rbuild @@ -14,4 +14,5 @@ mouse.c sound.c access.rc + access.h diff --git a/dll/cpl/access/display.c b/dll/cpl/access/display.c index 7924a5842f5..cf09292b118 100644 --- a/dll/cpl/access/display.c +++ b/dll/cpl/access/display.c @@ -8,12 +8,6 @@ * Copyright 2007 Eric Kohl */ -#include -#include -#include -#include -#include -#include "resource.h" #include "access.h" diff --git a/dll/cpl/access/general.c b/dll/cpl/access/general.c index b55cea6a0c8..7fb7cf93770 100644 --- a/dll/cpl/access/general.c +++ b/dll/cpl/access/general.c @@ -8,13 +8,6 @@ * Copyright 2007 Eric Kohl */ -#include -#include -#include -#include -#include -#include -#include "resource.h" #include "access.h" diff --git a/dll/cpl/access/keyboard.c b/dll/cpl/access/keyboard.c index 90451eadb8f..1b2f3081eeb 100644 --- a/dll/cpl/access/keyboard.c +++ b/dll/cpl/access/keyboard.c @@ -8,13 +8,6 @@ * Copyright 2007 Eric Kohl */ -#include -#include -#include -#include -#include -#include -#include "resource.h" #include "access.h" diff --git a/dll/cpl/access/lang/pl-PL.rc b/dll/cpl/access/lang/pl-PL.rc index 5246a77427f..29c89d457a7 100644 --- a/dll/cpl/access/lang/pl-PL.rc +++ b/dll/cpl/access/lang/pl-PL.rc @@ -1,5 +1,8 @@ -//Polish translation Emil Kaczmarek 2005 -//revised and updated by Olaf Siejka (May, 2007) & (Jan, 2008) +/* + * translated by Emil Kaczmarek (2005) + * revised and updated by Olaf Siejka (May, 2007) & (Jan, 2008) + * UTF-8 conversion by Caemyr (May, 2011) + */ LANGUAGE LANG_POLISH, SUBLANG_DEFAULT @@ -9,39 +12,39 @@ STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION CAPTION "Klawiatura" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - GROUPBOX "Klawisze Trwae",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(6)+PROPSHEETPADDING(1) - LTEXT "Uyj funkcji Klawisze trwae jeli chcesz uywa Shifta, Ctrl-a albo Alta naciskajc je tylko raz.",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) - AUTOCHECKBOX "&Uyj Klawiszy Trwaych",IDC_STICKY_BOX,PROPSHEETPADDING(2),LABELLINE(5)+2,PROPSHEETWIDTH-PROPSHEETPADDING(20),14 + GROUPBOX "Klawisze Trwałe",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(6)+PROPSHEETPADDING(1) + LTEXT "Użyj funkcji Klawisze Trwałe jeśli chcesz używać Shift, Ctrl albo Alt naciskając je tylko raz.",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) + AUTOCHECKBOX "&Użyj Klawiszy Trwałych",IDC_STICKY_BOX,PROPSHEETPADDING(2),LABELLINE(5)+2,PROPSHEETWIDTH-PROPSHEETPADDING(20),14 PUSHBUTTON "U&stawienia",IDC_STICKY_BUTTON,PROPSHEETWIDTH-PROPSHEETPADDING(17),LABELLINE(5)+2,PROPSHEETPADDING(15),14 GROUPBOX "Klawisze Filtra",-1,PROPSHEETPADDING(1),LABELLINE(8)+5,PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(7)+2 - LTEXT "Uyj funkcji Klawisze Filtra, jeli chcesz, eby ReactOS ignorowa krtkie albo powtarzajce si wcinicia klawiszy albo zmniejsza czsto powtarzania.",-1,PROPSHEETPADDING(2),LABELLINE(10)-3,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) + LTEXT "Użyj funkcji Klawisze Filtra, jeśli chcesz, żeby ReactOS ignorował krótkie albo powtarzające się naciskanie klawiszy albo zmniejszał częstość powtarzania.",-1,PROPSHEETPADDING(2),LABELLINE(10)-3,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) AUTOCHECKBOX "Klawisze &Filtra",IDC_FILTER_BOX,PROPSHEETPADDING(2),LABELLINE(13)+2,PROPSHEETWIDTH-PROPSHEETPADDING(20),14 PUSHBUTTON "Us&tawienia",IDC_FILTER_BUTTON,PROPSHEETWIDTH-PROPSHEETPADDING(17),LABELLINE(13)+2,PROPSHEETPADDING(15),14 - GROUPBOX "Klawisze Przeczajce",-1,PROPSHEETPADDING(1),LABELLINE(16)+3,PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(6)+PROPSHEETPADDING(1) - LTEXT "Uyj funkcji Klawisze Przeczajce, jeli chcesz sysze dwik przy naciskaniu klawiszy Caps Lock, Num Lock albo Scroll Lock.",-1,PROPSHEETPADDING(2),LABELLINE(18)-3,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) - AUTOCHECKBOX "Uyj &Klawiszy Przeczajcych",IDC_TOGGLE_BOX,PROPSHEETPADDING(2),LABELLINE(20)+2,PROPSHEETWIDTH-PROPSHEETPADDING(20),14 + GROUPBOX "Klawisze Przełązające",-1,PROPSHEETPADDING(1),LABELLINE(16)+3,PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(6)+PROPSHEETPADDING(1) + LTEXT "Użyj funkcji Klawisze Przełączające, jeśli chcesz słyszeć dźwięk przy naciskaniu klawiszy Caps Lock, Num Lock albo Scroll Lock.",-1,PROPSHEETPADDING(2),LABELLINE(18)-3,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) + AUTOCHECKBOX "Użyj &Klawiszy Przełączających",IDC_TOGGLE_BOX,PROPSHEETPADDING(2),LABELLINE(20)+2,PROPSHEETWIDTH-PROPSHEETPADDING(20),14 PUSHBUTTON "Ustawie&nia",IDC_TOGGLE_BUTTON,PROPSHEETWIDTH-PROPSHEETPADDING(17),LABELLINE(20)+2,PROPSHEETPADDING(15),14 - AUTOCHECKBOX "&Poka dodatkow pomoc klawiatury w programach",IDC_KEYBOARD_EXTRA,PROPSHEETPADDING(1),LABELLINE(23)+3,PROPSHEETWIDTH-PROPSHEETPADDING(2),14 + AUTOCHECKBOX "&Pokaż dodatkową pomoc klawiatury w programach",IDC_KEYBOARD_EXTRA,PROPSHEETPADDING(1),LABELLINE(23)+3,PROPSHEETWIDTH-PROPSHEETPADDING(2),14 END IDD_PROPPAGESOUND DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Dwik" +CAPTION "Dźwięk" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - GROUPBOX "Wartownik Dwiku",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(10)+PROPSHEETPADDING(1) - LTEXT "Uyj funkcji Wartownik Dwiku jeli chcesz, eby ReactOS pokazywa wizualne ostrzeenia w chwili generacji dwiku.",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) - AUTOCHECKBOX "Uyj funkcji &Wartownik Dwiku",IDC_SENTRY_BOX,PROPSHEETPADDING(2),LABELLINE(5)+2,PROPSHEETPADDING(15),14 - LTEXT "Uyj nastpujcego ostrzeenia:", IDC_SENTRY_TEXT, PROPSHEETPADDING(2),LABELLINE(8)-2,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(1) + GROUPBOX "Wartownik Dźwięku",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(10)+PROPSHEETPADDING(1) + LTEXT "Użyj funkcji Wartownik Dźwięku jeśli chcesz, żeby ReactOS pokazywał wizualne ostrzeżenia w chwili generacji dźwięku.",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) + AUTOCHECKBOX "Użyj funkcji &Wartownik Dźwięku",IDC_SENTRY_BOX,PROPSHEETPADDING(2),LABELLINE(5)+2,PROPSHEETPADDING(15),14 + LTEXT "Użyj następującego ostrzeżenia:", IDC_SENTRY_TEXT, PROPSHEETPADDING(2),LABELLINE(8)-2,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(1) COMBOBOX IDC_SENTRY_COMBO, PROPSHEETPADDING(2), LABELLINE(9), PROPSHEETWIDTH-PROPSHEETPADDING(4), LABELLINE(6), CBS_DROPDOWNLIST | WS_VSCROLL | WS_VISIBLE | WS_TABSTOP - GROUPBOX "Poka Dwiki",-1,PROPSHEETPADDING(1),LABELLINE(12)+5,PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(7)+2 - LTEXT "Uyj funkcji Poka Dwiki, aby nakaza swoim programom wywietlanie napisw w chwili generacji dwiku lub mowy.",-1,PROPSHEETPADDING(2),LABELLINE(14)-3,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) - AUTOCHECKBOX "Uyj funkcji &Poka Dwiki",IDC_SSHOW_BOX,PROPSHEETPADDING(2),LABELLINE(16)+2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 + GROUPBOX "Pokaż Dźwięki",-1,PROPSHEETPADDING(1),LABELLINE(12)+5,PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(7)+2 + LTEXT "Użyj funkcji Pokaż Dźwięki, aby nakazać swoim programom wyświetlanie napisów w chwili generacji dźwięku lub mowy.",-1,PROPSHEETPADDING(2),LABELLINE(14)-3,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) + AUTOCHECKBOX "Użyj funkcji &Pokaż Dźwięki",IDC_SSHOW_BOX,PROPSHEETPADDING(2),LABELLINE(16)+2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 END @@ -51,18 +54,18 @@ CAPTION "Ekran" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN GROUPBOX "Wysoki Kontrast",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(6)+PROPSHEETPADDING(1) - LTEXT "Uyj tej funkcji, jeli chcesz, eby Reactos uywa kolorw i czcionek zaprojektowanych do atwego czytania",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) - AUTOCHECKBOX "&Uyj funkcji Wysoki Kontrast",IDC_CONTRAST_BOX,PROPSHEETPADDING(2),LABELLINE(5)+2,PROPSHEETWIDTH-PROPSHEETPADDING(20),14 + LTEXT "Użyj tej funkcji, jeśli chcesz, żeby Reactos używał kolorów i czcionek zaprojektowanych do łatwego czytania",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) + AUTOCHECKBOX "&Użyj funkcji Wysoki Kontrast",IDC_CONTRAST_BOX,PROPSHEETPADDING(2),LABELLINE(5)+2,PROPSHEETWIDTH-PROPSHEETPADDING(20),14 PUSHBUTTON "U&stawienia",IDC_CONTRAST_BUTTON,PROPSHEETWIDTH-PROPSHEETPADDING(17),LABELLINE(5)+2,PROPSHEETPADDING(15),14 GROUPBOX "Ustawienia kursora",-1,PROPSHEETPADDING(1),LABELLINE(8)+5,PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(13) - LTEXT "Za pomoc suwakw moesz ustawi czstotliwo migotania kursora i jego szeroko.",-1,PROPSHEETPADDING(2),LABELLINE(9)+5,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(2) - CTEXT "Czstotliwo migotania:",-1,PROPSHEETPADDING(2),LABELLINE(12)+5,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(1) + LTEXT "Za pomocą suwaków możesz ustawić częstotliwość migotania kursora i jego szerokość.",-1,PROPSHEETPADDING(2),LABELLINE(9)+5,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(2) + CTEXT "Częstotliwość migotania:",-1,PROPSHEETPADDING(2),LABELLINE(12)+5,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(1) LTEXT "Brak",-1,PROPSHEETPADDING(3),LABELLINE(14)+2,PROPSHEETPADDING(6),LABELLINE(1) LTEXT "Szybko",-1,PROPSHEETWIDTH-PROPSHEETPADDING(9),LABELLINE(14)+2,PROPSHEETPADDING(6),LABELLINE(1) CONTROL "",IDC_CURSOR_BLINK_TRACK,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,PROPSHEETPADDING(10),LABELLINE(14),PROPSHEETWIDTH-PROPSHEETPADDING(20),LABELLINE(2) - CTEXT "Szeroko kursora:",-1,PROPSHEETPADDING(2),LABELLINE(17),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(1) - LTEXT "Wski",-1,PROPSHEETPADDING(3),LABELLINE(18)+7,PROPSHEETPADDING(6),LABELLINE(1) + CTEXT "Szerokość kursora:",-1,PROPSHEETPADDING(2),LABELLINE(17),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(1) + LTEXT "Wąski",-1,PROPSHEETPADDING(3),LABELLINE(18)+7,PROPSHEETPADDING(6),LABELLINE(1) LTEXT "Szeroki",-1,PROPSHEETWIDTH-PROPSHEETPADDING(9),LABELLINE(18)+7,PROPSHEETPADDING(6),LABELLINE(1) CONTROL "",IDC_CURSOR_WIDTH_TRACK,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,PROPSHEETPADDING(10),LABELLINE(18)+5,PROPSHEETWIDTH-PROPSHEETPADDING(20),LABELLINE(2) LTEXT "",IDC_CURSOR_WIDTH_TEXT,PROPSHEETPADDING(3),LABELLINE(16),PROPSHEETPADDING(4),LABELLINE(1)+5 @@ -75,53 +78,53 @@ CAPTION "Mysz" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN GROUPBOX "Klawisze Myszy",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(6)+PROPSHEETPADDING(1) - LTEXT "Uyj tej opcji, jeli chcesz kontrolowa wskanik myszy przy pomocy klawiatury numerycznej.",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) - AUTOCHECKBOX "Uyj funkcji Klawisze &Myszy",IDC_MOUSE_BOX,PROPSHEETPADDING(2),LABELLINE(5)+2,PROPSHEETWIDTH-PROPSHEETPADDING(20),14 + LTEXT "Użyj tej opcji, jeśli chcesz kontrolować wskaźnik myszy przy pomocy klawiatury numerycznej.",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) + AUTOCHECKBOX "Użyj funkcji Klawisze &Myszy",IDC_MOUSE_BOX,PROPSHEETPADDING(2),LABELLINE(5)+2,PROPSHEETWIDTH-PROPSHEETPADDING(20),14 PUSHBUTTON "U&stawienia",IDC_MOUSE_BUTTON,PROPSHEETWIDTH-PROPSHEETPADDING(17),LABELLINE(5)+2,PROPSHEETPADDING(15),14 END IDD_PROPPAGEGENERAL DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Oglne" +CAPTION "Ogólne" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN GROUPBOX "Automatyczny reset",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(5) - AUTOCHECKBOX "&Wycz funkcje uatwiajce dostp kiedy komputer nie jest uywany przez:",IDC_RESET_BOX,PROPSHEETPADDING(2),LABELLINE(2)-2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 + AUTOCHECKBOX "&Wyłącz funkcje ułatwiające dostęp kiedy komputer nie jest używany przez:",IDC_RESET_BOX,PROPSHEETPADDING(2),LABELLINE(2)-2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 COMBOBOX IDC_RESET_COMBO, PROPSHEETPADDING(4), LABELLINE(4), PROPSHEETPADDING(10), LABELLINE(5), CBS_DROPDOWNLIST | WS_VSCROLL | WS_VISIBLE | WS_TABSTOP GROUPBOX "Powiadomienia",-1,PROPSHEETPADDING(1),LABELLINE(7)-2,PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(5) - AUTOCHECKBOX "Ostrzegaj kiedy funkcja jest wczana",IDC_NOTIFICATION_MESSAGE,PROPSHEETPADDING(2),LABELLINE(8)-2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 - AUTOCHECKBOX "Odgrywaj dwik, kiedy funkcja jest wczana albo wyczana",IDC_NOTIFICATION_SOUND,PROPSHEETPADDING(2),LABELLINE(10)-2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 + AUTOCHECKBOX "Ostrzegaj kiedy funkcja jest włączana",IDC_NOTIFICATION_MESSAGE,PROPSHEETPADDING(2),LABELLINE(8)-2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 + AUTOCHECKBOX "Odgrywaj dźwięk, kiedy funkcja jest włączana albo wyłączana",IDC_NOTIFICATION_SOUND,PROPSHEETPADDING(2),LABELLINE(10)-2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 - GROUPBOX "Urzdzenia klawiszy szeregowych",-1,PROPSHEETPADDING(1),LABELLINE(13)-4,PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(5) - LTEXT "Urzdzenia klawiszy szeregowych zapewniaj alternatywny dostp do funkcji klawiatury lub myszy.",-1,PROPSHEETPADDING(2),LABELLINE(14)-4,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(2) - AUTOCHECKBOX "Wspieraj urzdzenia klawi&szy szeregowych",IDC_SERIAL_BOX,PROPSHEETPADDING(2),LABELLINE(16)-4,PROPSHEETWIDTH-PROPSHEETPADDING(20),14 + GROUPBOX "Urządzenia klawiszy szeregowych",-1,PROPSHEETPADDING(1),LABELLINE(13)-4,PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(5) + LTEXT "Urządzenia klawiszy szeregowych zapewniają alternatywny dostęp do funkcji klawiatury lub myszy.",-1,PROPSHEETPADDING(2),LABELLINE(14)-4,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(2) + AUTOCHECKBOX "Wspieraj urządzenia klawi&szy szeregowych",IDC_SERIAL_BOX,PROPSHEETPADDING(2),LABELLINE(16)-4,PROPSHEETWIDTH-PROPSHEETPADDING(20),14 PUSHBUTTON "&Ustawienia",IDC_SERIAL_BUTTON,PROPSHEETWIDTH-PROPSHEETPADDING(17),LABELLINE(16)-4,PROPSHEETPADDING(15),14 - GROUPBOX "Opcje zarzdzania",-1,PROPSHEETPADDING(1),LABELLINE(19)-4,PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(5) + GROUPBOX "Opcje zarządzania",-1,PROPSHEETPADDING(1),LABELLINE(19)-4,PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(5) AUTOCHECKBOX "Zastosuj wszystkie ustawienia dla pu&lpitu logowania",IDC_ADMIN_LOGON_BOX,PROPSHEETPADDING(2),LABELLINE(20)-4,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 - AUTOCHECKBOX "Zastosuj wszystkie ustawienia dla &domylnego profilu dla nowych uytkownikw",IDC_ADMIN_USERS_BOX,PROPSHEETPADDING(2),LABELLINE(22)-4,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 + AUTOCHECKBOX "Zastosuj wszystkie ustawienia dla &domyślnego profilu dla nowych użytkowników",IDC_ADMIN_USERS_BOX,PROPSHEETPADDING(2),LABELLINE(22)-4,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 END IDD_STICKYKEYSOPTIONS DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Ustawienia Klawiszy Trwaych" +CAPTION "Ustawienia Klawiszy Trwałych" FONT 8, "MS Shell Dlg" BEGIN GROUPBOX "Klawisze",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(6)+PROPSHEETPADDING(1) - LTEXT "Nacinij klawisz SHIFT 5 razy by aktywowa funkcj KlawiszeTrwae.",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) - AUTOCHECKBOX "A&ktywuj Klawisze Trwae",IDC_STICKY_ACTIVATE_CHECK,PROPSHEETPADDING(2),LABELLINE(5)+2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 + LTEXT "Naciśnij klawisz SHIFT 5 razy by aktywować funkcję Klawisze Trwałe.",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) + AUTOCHECKBOX "A&ktywuj Klawisze Trwałe",IDC_STICKY_ACTIVATE_CHECK,PROPSHEETPADDING(2),LABELLINE(5)+2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 GROUPBOX "Ustawienia",-1,PROPSHEETPADDING(1),LABELLINE(9),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(4)+PROPSHEETPADDING(1) - AUTOCHECKBOX "&Nacinij klawisz modyfikujcy dwukrotnie, aby zablokowa",IDC_STICKY_LOCK_CHECK,PROPSHEETPADDING(2),LABELLINE(10)+2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 - AUTOCHECKBOX "&Wycz Klawisze Trwae gdy dwa klawisze zostan wcinite naraz",IDC_STICKY_UNLOCK_CHECK,PROPSHEETPADDING(2),LABELLINE(12),PROPSHEETWIDTH-PROPSHEETPADDING(4),14 + AUTOCHECKBOX "&Naciśnij klawisz modyfikujący dwukrotnie, aby zablokować",IDC_STICKY_LOCK_CHECK,PROPSHEETPADDING(2),LABELLINE(10)+2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 + AUTOCHECKBOX "&Wyłącz Klawisze Trwałe gdy dwa klawisze zostaną wciśnięte naraz",IDC_STICKY_UNLOCK_CHECK,PROPSHEETPADDING(2),LABELLINE(12),PROPSHEETWIDTH-PROPSHEETPADDING(4),14 GROUPBOX "Powiadomienia",-1,PROPSHEETPADDING(1),LABELLINE(15),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(4)+PROPSHEETPADDING(1) - AUTOCHECKBOX "W&ydaj dwik, po naciniciu klawisza modyfikujcego",IDC_STICKY_SOUND_CHECK,PROPSHEETPADDING(2),LABELLINE(16)+2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 - AUTOCHECKBOX "&Poka stan Klawiszy Trwaych na ekranie",IDC_STICKY_STATUS_CHECK,PROPSHEETPADDING(2),LABELLINE(18),PROPSHEETWIDTH-PROPSHEETPADDING(4),14 + AUTOCHECKBOX "W&ydaj dźwięk, po naciśnięciu klawisza modyfikującego",IDC_STICKY_SOUND_CHECK,PROPSHEETPADDING(2),LABELLINE(16)+2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 + AUTOCHECKBOX "&Pokaż stan Klawiszy Trwałych na ekranie",IDC_STICKY_STATUS_CHECK,PROPSHEETPADDING(2),LABELLINE(18),PROPSHEETWIDTH-PROPSHEETPADDING(4),14 DEFPUSHBUTTON "OK", IDOK, PROPSHEETWIDTH-111, PROPSHEETHEIGHT-21, 50, 14 PUSHBUTTON "Anuluj", IDCANCEL, PROPSHEETWIDTH-57, PROPSHEETHEIGHT-21, 50, 14 @@ -130,24 +133,24 @@ END IDD_FILTERKEYSOPTIONS DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Ustawienia Filtrw Klawiszy" +CAPTION "Ustawienia Filtrów Klawiszy" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "Skrt klawiszowy",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(6)+PROPSHEETPADDING(1) - LTEXT "Skrt do Filtrw Klawiszy: \nPrzytrzymaj nacinity przez 8 sekund.",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) - AUTOCHECKBOX "&Uywaj skrtu",IDC_FILTER_ACTIVATE_CHECK,PROPSHEETPADDING(2),LABELLINE(5)+2,PROPSHEETWIDTH-PROPSHEETPADDING(20),14 + GROUPBOX "Skrót klawiszowy",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(6)+PROPSHEETPADDING(1) + LTEXT "Skrót do Filtrów Klawiszy: \nPrzytrzymaj naciśnięty przez 8 sekund.",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) + AUTOCHECKBOX "&Używaj skrótu",IDC_FILTER_ACTIVATE_CHECK,PROPSHEETPADDING(2),LABELLINE(5)+2,PROPSHEETWIDTH-PROPSHEETPADDING(20),14 - GROUPBOX "Ustawienia Filtrw",-1,PROPSHEETPADDING(1),LABELLINE(8)+5,PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(8)+5 + GROUPBOX "Ustawienia Filtrów",-1,PROPSHEETPADDING(1),LABELLINE(8)+5,PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(8)+5 AUTORADIOBUTTON "Ign&oruj powtarzane naciskanie klawiszy",IDC_FILTER_BOUNCE_RADIO,PROPSHEETPADDING(2),LABELLINE(9)+7,PROPSHEETPADDING(20),LABELLINE(1),WS_GROUP|WS_TABSTOP AUTORADIOBUTTON "Ig&noruj szybkie naciskanie klawiszy i spowolnij tempo powtarzania",IDC_FILTER_REPEAT_RADIO,PROPSHEETPADDING(2),LABELLINE(11)+5,PROPSHEETPADDING(20),LABELLINE(2),BS_TOP|BS_MULTILINE PUSHBUTTON "U&stawienia",IDC_FILTER_BOUNCE_BUTTON,PROPSHEETWIDTH-PROPSHEETPADDING(17),LABELLINE(9)+5,PROPSHEETPADDING(15),14,WS_GROUP PUSHBUTTON "Us&tawienia",IDC_FILTER_REPEAT_BUTTON,PROPSHEETWIDTH-PROPSHEETPADDING(17),LABELLINE(11)+5,PROPSHEETPADDING(15),14,WS_GROUP - LTEXT "&Kliknij tutaj i wpisz cokolwiek by przetestowa ustawienia:",-1,PROPSHEETPADDING(2),LABELLINE(14)+1,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(1) + LTEXT "&Kliknij tutaj i wpisz cokolwiek by przetestować ustawienia:",-1,PROPSHEETPADDING(2),LABELLINE(14)+1,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(1) EDITTEXT IDC_FILTER_TEST_EDIT,PROPSHEETPADDING(2),LABELLINE(15)+1,PROPSHEETWIDTH-PROPSHEETPADDING(4),14,WS_GROUP|ES_AUTOHSCROLL GROUPBOX "Powiadomienia",-1,PROPSHEETPADDING(1),LABELLINE(17)+6,PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(4)+3 - AUTOCHECKBOX "&Wydaj dwik gdy klawisz zosta nacinity bd zaakceptowany",IDC_FILTER_SOUND_CHECK,PROPSHEETPADDING(2),LABELLINE(19),PROPSHEETWIDTH-PROPSHEETPADDING(4),10 - AUTOCHECKBOX "&Poka stan Filtrw Klawiszy na ekranie",IDC_FILTER_STATUS_CHECK,PROPSHEETPADDING(2),LABELLINE(20)+6,PROPSHEETWIDTH-PROPSHEETPADDING(4),10 + AUTOCHECKBOX "&Wydaj dźwięk gdy klawisz został naciśnięty bądź zaakceptowany",IDC_FILTER_SOUND_CHECK,PROPSHEETPADDING(2),LABELLINE(19),PROPSHEETWIDTH-PROPSHEETPADDING(4),10 + AUTOCHECKBOX "&Pokaż stan Filtrów Klawiszy na ekranie",IDC_FILTER_STATUS_CHECK,PROPSHEETPADDING(2),LABELLINE(20)+6,PROPSHEETWIDTH-PROPSHEETPADDING(4),10 DEFPUSHBUTTON "OK", IDOK, PROPSHEETWIDTH-111, PROPSHEETHEIGHT-21, 50, 14 PUSHBUTTON "Anuluj", IDCANCEL, PROPSHEETWIDTH-57, PROPSHEETHEIGHT-21, 50, 14 @@ -156,12 +159,12 @@ END IDD_TOGGLEKEYSOPTIONS DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Ustawienia Klawiszy Przeczajcych" +CAPTION "Ustawienia Klawiszy Przełączających" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "Skrt klawiszowy",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(6)+PROPSHEETPADDING(1) - LTEXT "Skrt do Klawiszy Przeczajcych: \nPrzytrzymaj nacinity przez 5 sekund.",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) - AUTOCHECKBOX "Uyj &skrtu",IDC_TOGGLE_ACTIVATE_CHECK,PROPSHEETPADDING(2),LABELLINE(5)+2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 + GROUPBOX "Skrót klawiszowy",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(6)+PROPSHEETPADDING(1) + LTEXT "Skrót do Klawiszy Przełączających: \nPrzytrzymaj naciśnięty przez 5 sekund.",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) + AUTOCHECKBOX "Użyj &skrótu",IDC_TOGGLE_ACTIVATE_CHECK,PROPSHEETPADDING(2),LABELLINE(5)+2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 DEFPUSHBUTTON "OK", IDOK, PROPSHEETWIDTH-111, PROPSHEETHEIGHT-21, 50, 14 PUSHBUTTON "Anuluj", IDCANCEL, PROPSHEETWIDTH-57, PROPSHEETHEIGHT-21, 50, 14 @@ -173,12 +176,12 @@ STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Ustawienia Wysokiego Kontrastu" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "Skrt klawiszowy",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(6)+PROPSHEETPADDING(1) - LTEXT "Skrt do Wysokiego Kontrastu: \nNacinij .",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) - AUTOCHECKBOX "&Uyj skrtu",IDC_CONTRAST_ACTIVATE_CHECK,PROPSHEETPADDING(4),LABELLINE(5)+2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 + GROUPBOX "Skrót klawiszowy",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(6)+PROPSHEETPADDING(1) + LTEXT "Skrót do Wysokiego Kontrastu: \nNaciśnij .",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) + AUTOCHECKBOX "&Użyj skrótu",IDC_CONTRAST_ACTIVATE_CHECK,PROPSHEETPADDING(4),LABELLINE(5)+2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 - GROUPBOX "Schemat kolorw Wysokiego Kontrastu",-1,PROPSHEETPADDING(1),LABELLINE(9),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(4)+PROPSHEETPADDING(1) - LTEXT "Obecny schemat kolorw:",-1,PROPSHEETPADDING(2),LABELLINE(10)+2,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(1) + GROUPBOX "Schemat kolorów Wysokiego Kontrastu",-1,PROPSHEETPADDING(1),LABELLINE(9),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(4)+PROPSHEETPADDING(1) + LTEXT "Obecny schemat kolorów:",-1,PROPSHEETPADDING(2),LABELLINE(10)+2,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(1) COMBOBOX IDC_CONTRAST_COMBO, PROPSHEETPADDING(2), LABELLINE(11)+2, PROPSHEETWIDTH-PROPSHEETPADDING(4), LABELLINE(6), CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_VISIBLE | WS_TABSTOP @@ -192,29 +195,29 @@ STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Ustawienia Klawiszy Myszy" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "Skrt klawiszowy",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(6)+PROPSHEETPADDING(1) - LTEXT "Skrt do Klawiszy Myszy: \nNacinij .",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) - AUTOCHECKBOX "&Uyj skrtu",IDC_MOUSEKEYS_ACTIVATE_CHECK,PROPSHEETPADDING(2),LABELLINE(5)+2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 + GROUPBOX "Skrót klawiszowy",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(6)+PROPSHEETPADDING(1) + LTEXT "Skrót do Klawiszy Myszy: \nNaciśnij .",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) + AUTOCHECKBOX "&Użyj skrótu",IDC_MOUSEKEYS_ACTIVATE_CHECK,PROPSHEETPADDING(2),LABELLINE(5)+2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 - GROUPBOX "Szybko kursora",-1,PROPSHEETPADDING(1),LABELLINE(9),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(9) + GROUPBOX "Szybkość kursora",-1,PROPSHEETPADDING(1),LABELLINE(9),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(9) - LTEXT "&Szybko maksymalna:",-1,PROPSHEETPADDING(2),LABELLINE(10)+4,PROPSHEETPADDING(8),LABELLINE(1) - LTEXT "Maa",-1,PROPSHEETPADDING(11),LABELLINE(10)+4,PROPSHEETPADDING(3),LABELLINE(1) + LTEXT "&Szybkość maksymalna:",-1,PROPSHEETPADDING(2),LABELLINE(10)+4,PROPSHEETPADDING(8),LABELLINE(1) + LTEXT "Mała",-1,PROPSHEETPADDING(11),LABELLINE(10)+4,PROPSHEETPADDING(3),LABELLINE(1) CONTROL "",IDC_MOUSEKEYS_SPEED_TRACK,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,PROPSHEETPADDING(15),LABELLINE(10)+2,PROPSHEETWIDTH-PROPSHEETPADDING(22),LABELLINE(2) - LTEXT "Dua",-1,PROPSHEETWIDTH-PROPSHEETPADDING(7),LABELLINE(10)+4,PROPSHEETPADDING(3),LABELLINE(1) + LTEXT "Duża",-1,PROPSHEETWIDTH-PROPSHEETPADDING(7),LABELLINE(10)+4,PROPSHEETPADDING(3),LABELLINE(1) LTEXT "&Przyspieszenie:",-1,PROPSHEETPADDING(2),LABELLINE(13)+4,PROPSHEETPADDING(8),LABELLINE(1) LTEXT "Wolno",-1,PROPSHEETPADDING(11),LABELLINE(13)+4,PROPSHEETPADDING(3),LABELLINE(1) CONTROL "",IDC_MOUSEKEYS_ACCEL_TRACK,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,PROPSHEETPADDING(15),LABELLINE(13)+2,PROPSHEETWIDTH-PROPSHEETPADDING(22),LABELLINE(2) LTEXT "Szybko",-1,PROPSHEETWIDTH-PROPSHEETPADDING(7),LABELLINE(13)+4,PROPSHEETPADDING(3),LABELLINE(1) - AUTOCHECKBOX "P&rzytrzymaj klawisz Ctrl by przyspieszy i Shift by spowolni",IDC_MOUSEKEYS_SPEED_CHECK,PROPSHEETPADDING(2),LABELLINE(16),PROPSHEETWIDTH-PROPSHEETPADDING(4),14 + AUTOCHECKBOX "P&rzytrzymaj klawisz Ctrl by przyspieszyć i Shift by spowolnić",IDC_MOUSEKEYS_SPEED_CHECK,PROPSHEETPADDING(2),LABELLINE(16),PROPSHEETWIDTH-PROPSHEETPADDING(4),14 - LTEXT "Uyj Klawiszy Myszy gdy NumLock jest:",-1,PROPSHEETPADDING(1),LABELLINE(18)+7,PROPSHEETPADDING(20),LABELLINE(1) - AUTORADIOBUTTON "&Wczonyn",IDC_MOUSEKEYS_ON_RADIO,PROPSHEETWIDTH-PROPSHEETPADDING(14),LABELLINE(18)+7,PROPSHEETPADDING(5),LABELLINE(1) - AUTORADIOBUTTON "Wy&czony",IDC_MOUSEKEYS_OFF_RADIO,PROPSHEETWIDTH-PROPSHEETPADDING(8),LABELLINE(18)+7,PROPSHEETPADDING(5),LABELLINE(1) + LTEXT "Użyj Klawiszy Myszy gdy NumLock jest:",-1,PROPSHEETPADDING(1),LABELLINE(18)+7,PROPSHEETPADDING(20),LABELLINE(1) + AUTORADIOBUTTON "&Włączonyn",IDC_MOUSEKEYS_ON_RADIO,PROPSHEETWIDTH-PROPSHEETPADDING(14),LABELLINE(18)+7,PROPSHEETPADDING(5),LABELLINE(1) + AUTORADIOBUTTON "Wyłą&czony",IDC_MOUSEKEYS_OFF_RADIO,PROPSHEETWIDTH-PROPSHEETPADDING(8),LABELLINE(18)+7,PROPSHEETPADDING(5),LABELLINE(1) - AUTOCHECKBOX "P&oka stan Klawiszy Myszy na ekranie",IDC_MOUSEKEYS_STATUS_CHECK,PROPSHEETPADDING(1),LABELLINE(20)+2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 + AUTOCHECKBOX "P&okaż stan Klawiszy Myszy na ekranie",IDC_MOUSEKEYS_STATUS_CHECK,PROPSHEETPADDING(1),LABELLINE(20)+2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 DEFPUSHBUTTON "OK", IDOK, PROPSHEETWIDTH-111, PROPSHEETHEIGHT-21, 50, 14 PUSHBUTTON "Anuluj", IDCANCEL, PROPSHEETWIDTH-57, PROPSHEETHEIGHT-21, 50, 14 @@ -223,11 +226,11 @@ END IDD_BOUNCEKEYSOPTIONS DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Ustawienia zaawansowane Filtrw Klawiszy" +CAPTION "Ustawienia zaawansowane Filtrów Klawiszy" FONT 8, "MS Shell Dlg" BEGIN GROUPBOX "Klawisze powtarzane",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(5) - LTEXT "&Ignoruj powtarzajce si naciskanie, szybsze ni:",-1,PROPSHEETPADDING(2),LABELLINE(2)+1,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(2) + LTEXT "&Ignoruj powtarzające się naciskanie, szybsze niż:",-1,PROPSHEETPADDING(2),LABELLINE(2)+1,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(2) COMBOBOX IDC_BOUNCE_TIME_COMBO, PROPSHEETPADDING(2), LABELLINE(3)+5, PROPSHEETWIDTH-PROPSHEETPADDING(4), LABELLINE(6), CBS_DROPDOWNLIST | WS_VSCROLL | WS_VISIBLE | WS_TABSTOP @@ -241,24 +244,24 @@ END IDD_REPEATKEYSOPTIONS DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Ustawienia zaawansowane Filtrw Klawiszy" +CAPTION "Ustawienia zaawansowane Filtrów Klawiszy" BEGIN GROUPBOX "Klawisze powtarzane",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(12) - LTEXT "Zastp ustawienia Klawiatury w Panelu Sterowania:",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(2) + LTEXT "Zastąp ustawienia Klawiatury w Panelu Sterowania:",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(2) AUTORADIOBUTTON "&Bez powtarzania klawiszy",IDC_REPEAT_NOREPEAT_RADIO,PROPSHEETPADDING(2),LABELLINE(3)+3,78,LABELLINE(1),WS_GROUP - AUTORADIOBUTTON "&Zmniejsz czstotliwo powtarzania",IDC_REPEAT_REPEAT_RADIO,PROPSHEETPADDING(2),LABELLINE(4)+7,131,LABELLINE(1) + AUTORADIOBUTTON "&Zmniejsz częstotliwość powtarzania",IDC_REPEAT_REPEAT_RADIO,PROPSHEETPADDING(2),LABELLINE(4)+7,131,LABELLINE(1) - LTEXT "O&pnienie powtarzania:",-1,PROPSHEETPADDING(4),LABELLINE(6)+4,PROPSHEETPADDING(10),LABELLINE(1) + LTEXT "O&późnienie powtarzania:",-1,PROPSHEETPADDING(4),LABELLINE(6)+4,PROPSHEETPADDING(10),LABELLINE(1) COMBOBOX IDC_REPEAT_DELAY_COMBO, PROPSHEETPADDING(4), LABELLINE(7)+6, PROPSHEETWIDTH-PROPSHEETPADDING(6), LABELLINE(6), CBS_DROPDOWNLIST | WS_VSCROLL | WS_VISIBLE | WS_TABSTOP - LTEXT "Czs&totliwo powtarzania:",-1,PROPSHEETPADDING(4),LABELLINE(9)+6,PROPSHEETPADDING(10),LABELLINE(1) + LTEXT "Częs&totliwość powtarzania:",-1,PROPSHEETPADDING(4),LABELLINE(9)+6,PROPSHEETPADDING(10),LABELLINE(1) COMBOBOX IDC_REPEAT_REPEAT_COMBO, PROPSHEETPADDING(4), LABELLINE(10)+8, PROPSHEETWIDTH-PROPSHEETPADDING(6), LABELLINE(7), CBS_DROPDOWNLIST | WS_VSCROLL | WS_VISIBLE | WS_TABSTOP GROUPBOX "Spowolnienie Klawiszy",-1,PROPSHEETPADDING(1),LABELLINE(14),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(4)+4 - LTEXT "&Klawisz musi by przycinity przez:",-1,PROPSHEETPADDING(2),LABELLINE(15),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(1) + LTEXT "&Klawisz musi być przyciśnięty przez:",-1,PROPSHEETPADDING(2),LABELLINE(15),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(1) COMBOBOX IDC_REPEAT_WAIT_COMBO, PROPSHEETPADDING(2), LABELLINE(16)+4, PROPSHEETWIDTH-PROPSHEETPADDING(4), LABELLINE(8), CBS_DROPDOWNLIST | WS_VSCROLL | WS_VISIBLE | WS_TABSTOP @@ -272,17 +275,17 @@ END IDD_SERIALKEYSOPTIONS DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Ustawienia Urzdze Dodatkowych" +CAPTION "Ustawienia Urządzeń Dodatkowych" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "Urzdzenie Dodatkowe",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(10) - LTEXT "Wybierz port do ktrego podczone jest dodatkowe urzdzenie wejcia.",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(2) + GROUPBOX "Urządzenie Dodatkowe",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(10) + LTEXT "Wybierz port do którego podłączone jest dodatkowe urządzenie wejścia.",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(2) LTEXT "&Port Szeregowy:",-1,PROPSHEETPADDING(2),LABELLINE(3)+5,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(2) COMBOBOX IDC_SERIAL_PORT_COMBO, PROPSHEETPADDING(2), LABELLINE(4)+7, PROPSHEETWIDTH-PROPSHEETPADDING(4), LABELLINE(6), CBS_DROPDOWNLIST | WS_VSCROLL | WS_VISIBLE | WS_TABSTOP - LTEXT "&Prdko transmisji:",-1,PROPSHEETPADDING(2),LABELLINE(7),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(2) + LTEXT "&Prędkość transmisji:",-1,PROPSHEETPADDING(2),LABELLINE(7),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(2) COMBOBOX IDC_SERIAL_BAUD_COMBO, PROPSHEETPADDING(2), LABELLINE(8)+2, PROPSHEETWIDTH-PROPSHEETPADDING(4), LABELLINE(8), CBS_DROPDOWNLIST | WS_VSCROLL | WS_VISIBLE | WS_TABSTOP @@ -293,13 +296,13 @@ END STRINGTABLE BEGIN - IDS_CPLSYSTEMNAME "Uatwienia dostpu" - IDS_CPLSYSTEMDESCRIPTION "Personalizuje funkcje uatwie dostpu na twoim komputerze." + IDS_CPLSYSTEMNAME "Ułatwienia dostępu" + IDS_CPLSYSTEMDESCRIPTION "Personalizuje funkcje ułatwień dostępu na twoim komputerze." IDS_SENTRY_NONE "[Brak]" - IDS_SENTRY_TITLE "Migajcy pasek tytuu" - IDS_SENTRY_WINDOW "Migajce okno aktywne" - IDS_SENTRY_DISPLAY "Migajcy pulpit" + IDS_SENTRY_TITLE "Migający pasek tytułu" + IDS_SENTRY_WINDOW "Migające okno aktywne" + IDS_SENTRY_DISPLAY "Migający pulpit" IDS_SECONDS "Sekund" IDS_MINUTES "Minut" diff --git a/dll/cpl/access/lang/ro-RO.rc b/dll/cpl/access/lang/ro-RO.rc index 70b2fe625f9..05cb128a54b 100644 --- a/dll/cpl/access/lang/ro-RO.rc +++ b/dll/cpl/access/lang/ro-RO.rc @@ -1,7 +1,5 @@ LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL -#pragma code_page(65001) - IDD_PROPPAGEKEYBOARD DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION CAPTION "Tastatură" @@ -303,5 +301,3 @@ BEGIN IDS_SECONDS "secunde" IDS_MINUTES "minute" END - -#pragma code_page(default) diff --git a/dll/cpl/access/lang/ru-RU.rc b/dll/cpl/access/lang/ru-RU.rc index 1ad3fae36b5..a2a1f9fc4af 100644 --- a/dll/cpl/access/lang/ru-RU.rc +++ b/dll/cpl/access/lang/ru-RU.rc @@ -3,64 +3,64 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT IDD_PROPPAGEKEYBOARD DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Клавиатура" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - GROUPBOX " ",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(6)+PROPSHEETPADDING(1) - LTEXT " Shift, Ctrl Alt .",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) - AUTOCHECKBOX "& ",IDC_STICKY_BOX,PROPSHEETPADDING(2),LABELLINE(5)+6,PROPSHEETWIDTH-PROPSHEETPADDING(20),14 - PUSHBUTTON "&",IDC_STICKY_BUTTON,PROPSHEETWIDTH-PROPSHEETPADDING(17)+5,LABELLINE(5)+6,PROPSHEETPADDING(15)-5,14 + GROUPBOX "Залипание клавиш",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(6)+PROPSHEETPADDING(1) + LTEXT "Ввод сочетаний с клавишами Shift, Ctrl или Alt путем последовательного нажатия клавиш.",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) + AUTOCHECKBOX "&Залипание клавиш",IDC_STICKY_BOX,PROPSHEETPADDING(2),LABELLINE(5)+6,PROPSHEETWIDTH-PROPSHEETPADDING(20),14 + PUSHBUTTON "&Настройка",IDC_STICKY_BUTTON,PROPSHEETWIDTH-PROPSHEETPADDING(17)+5,LABELLINE(5)+6,PROPSHEETPADDING(15)-5,14 - GROUPBOX " ",-1,PROPSHEETPADDING(1),LABELLINE(8)+5,PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(7)+2 - LTEXT " .",-1,PROPSHEETPADDING(2),LABELLINE(10)-3,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) - AUTOCHECKBOX " & ",IDC_FILTER_BOX, 12, 125, 134, 14 - PUSHBUTTON "&",IDC_FILTER_BUTTON,PROPSHEETWIDTH-PROPSHEETPADDING(17)+5,LABELLINE(13)+6,PROPSHEETPADDING(15)-5,14 + GROUPBOX "Фильтрация ввода",-1,PROPSHEETPADDING(1),LABELLINE(8)+5,PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(7)+2 + LTEXT "Игнорирование случайных кратковременных или повторных нажатий клавиш.",-1,PROPSHEETPADDING(2),LABELLINE(10)-3,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) + AUTOCHECKBOX "Использовать &фильтрацию ввода",IDC_FILTER_BOX, 12, 125, 134, 14 + PUSHBUTTON "Н&астройка",IDC_FILTER_BUTTON,PROPSHEETWIDTH-PROPSHEETPADDING(17)+5,LABELLINE(13)+6,PROPSHEETPADDING(15)-5,14 - GROUPBOX " ",-1,PROPSHEETPADDING(1),LABELLINE(16)+3,PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(6)+PROPSHEETPADDING(1) - LTEXT " Caps Lock, Num Lock Scroll Lock.",-1,PROPSHEETPADDING(2),LABELLINE(18)-3,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(2) - AUTOCHECKBOX "&",IDC_TOGGLE_BOX,PROPSHEETPADDING(2),LABELLINE(20)+6,PROPSHEETWIDTH-PROPSHEETPADDING(20),14 - PUSHBUTTON "&",IDC_TOGGLE_BUTTON,PROPSHEETWIDTH-PROPSHEETPADDING(17)+5,LABELLINE(20)+6,PROPSHEETPADDING(15)-5,14 + GROUPBOX "Озвучивание переключения режимов",-1,PROPSHEETPADDING(1),LABELLINE(16)+3,PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(6)+PROPSHEETPADDING(1) + LTEXT "Озвучивание нажатия клавиш переключения режимов Caps Lock, Num Lock и Scroll Lock.",-1,PROPSHEETPADDING(2),LABELLINE(18)-3,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(2) + AUTOCHECKBOX "&Озвучивание",IDC_TOGGLE_BOX,PROPSHEETPADDING(2),LABELLINE(20)+6,PROPSHEETWIDTH-PROPSHEETPADDING(20),14 + PUSHBUTTON "На&стройка",IDC_TOGGLE_BUTTON,PROPSHEETWIDTH-PROPSHEETPADDING(17)+5,LABELLINE(20)+6,PROPSHEETPADDING(15)-5,14 - AUTOCHECKBOX "& ",IDC_KEYBOARD_EXTRA,PROPSHEETPADDING(1),LABELLINE(23)+3,PROPSHEETWIDTH-PROPSHEETPADDING(2),14 + AUTOCHECKBOX "&Дополнительные сведения о работе с клавиатурой",IDC_KEYBOARD_EXTRA,PROPSHEETPADDING(1),LABELLINE(23)+3,PROPSHEETWIDTH-PROPSHEETPADDING(2),14 END IDD_PROPPAGESOUND DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Звук" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - GROUPBOX " ",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(10)+PROPSHEETPADDING(1) - LTEXT " .",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) - AUTOCHECKBOX "& ",IDC_SENTRY_BOX,PROPSHEETPADDING(2),LABELLINE(5)+2,PROPSHEETPADDING(15)+10,14 - LTEXT " :", IDC_SENTRY_TEXT, PROPSHEETPADDING(2),LABELLINE(8)-2,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(1) + GROUPBOX "Визуальное оповещение",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(10)+PROPSHEETPADDING(1) + LTEXT "Сопровождение звуковых сигналов визуальным оповещением.",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) + AUTOCHECKBOX "В&изуальное оповещение",IDC_SENTRY_BOX,PROPSHEETPADDING(2),LABELLINE(5)+2,PROPSHEETPADDING(15)+10,14 + LTEXT "Оповещение пользователя:", IDC_SENTRY_TEXT, PROPSHEETPADDING(2),LABELLINE(8)-2,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(1) COMBOBOX IDC_SENTRY_COMBO, PROPSHEETPADDING(2), LABELLINE(9), PROPSHEETWIDTH-PROPSHEETPADDING(4), LABELLINE(6), CBS_DROPDOWNLIST | WS_VSCROLL | WS_VISIBLE | WS_TABSTOP - GROUPBOX "",-1,PROPSHEETPADDING(1),LABELLINE(12)+5,PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(7)+2 - LTEXT " .",-1,PROPSHEETPADDING(2),LABELLINE(14)-3,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3)-7 - AUTOCHECKBOX "&",IDC_SSHOW_BOX,PROPSHEETPADDING(2),LABELLINE(16)+2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 + GROUPBOX "Субтитры",-1,PROPSHEETPADDING(1),LABELLINE(12)+5,PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(7)+2 + LTEXT "Сопровождение звуков и речи субтитрами.",-1,PROPSHEETPADDING(2),LABELLINE(14)-3,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3)-7 + AUTOCHECKBOX "С&убтитры",IDC_SSHOW_BOX,PROPSHEETPADDING(2),LABELLINE(16)+2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 END IDD_PROPPAGEDISPLAY DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Экран" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - GROUPBOX " ",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(6)+PROPSHEETPADDING(1) - LTEXT " , .",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) - AUTOCHECKBOX "& ",IDC_CONTRAST_BOX,PROPSHEETPADDING(2),LABELLINE(5)+2,PROPSHEETWIDTH-PROPSHEETPADDING(20),14 - PUSHBUTTON "&",IDC_CONTRAST_BUTTON,PROPSHEETWIDTH-PROPSHEETPADDING(17),LABELLINE(5)+2,PROPSHEETPADDING(15),14 + GROUPBOX "Высокая контрастность",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(6)+PROPSHEETPADDING(1) + LTEXT "Особо подобранные сочетания цветов и шрифтов, облегчающие восприятие.",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) + AUTOCHECKBOX "&Высокая контрастность",IDC_CONTRAST_BOX,PROPSHEETPADDING(2),LABELLINE(5)+2,PROPSHEETWIDTH-PROPSHEETPADDING(20),14 + PUSHBUTTON "&Настройка",IDC_CONTRAST_BUTTON,PROPSHEETWIDTH-PROPSHEETPADDING(17),LABELLINE(5)+2,PROPSHEETPADDING(15),14 - GROUPBOX " ",-1,PROPSHEETPADDING(1),LABELLINE(8)+5,PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(13) - LTEXT " , .",-1,PROPSHEETPADDING(2),LABELLINE(9)+5,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(2) - CTEXT "& :",-1,PROPSHEETPADDING(2),LABELLINE(12)+5,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(1) - LTEXT "",-1,PROPSHEETPADDING(3),LABELLINE(14)+2,PROPSHEETPADDING(6),LABELLINE(1) - LTEXT "",-1,PROPSHEETWIDTH-PROPSHEETPADDING(9),LABELLINE(14)+2,PROPSHEETPADDING(6),LABELLINE(1) + GROUPBOX "Параметры курсора",-1,PROPSHEETPADDING(1),LABELLINE(8)+5,PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(13) + LTEXT "Чтобы изменить частоту мерцания курсора и его ширину, воспользуйтесь следующими ползунками.",-1,PROPSHEETPADDING(2),LABELLINE(9)+5,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(2) + CTEXT "&Частота мерцания:",-1,PROPSHEETPADDING(2),LABELLINE(12)+5,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(1) + LTEXT "Реже",-1,PROPSHEETPADDING(3),LABELLINE(14)+2,PROPSHEETPADDING(6),LABELLINE(1) + LTEXT "Чаще",-1,PROPSHEETWIDTH-PROPSHEETPADDING(9),LABELLINE(14)+2,PROPSHEETPADDING(6),LABELLINE(1) CONTROL "",IDC_CURSOR_BLINK_TRACK,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,PROPSHEETPADDING(10),LABELLINE(14),PROPSHEETWIDTH-PROPSHEETPADDING(20),LABELLINE(2) - CTEXT "&:",-1,PROPSHEETPADDING(2),LABELLINE(17),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(1) - LTEXT "",-1,PROPSHEETPADDING(3),LABELLINE(18)+7,PROPSHEETPADDING(6),LABELLINE(1) - LTEXT "",-1,PROPSHEETWIDTH-PROPSHEETPADDING(9),LABELLINE(18)+7,PROPSHEETPADDING(6),LABELLINE(1) + CTEXT "&Толщина:",-1,PROPSHEETPADDING(2),LABELLINE(17),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(1) + LTEXT "Уже",-1,PROPSHEETPADDING(3),LABELLINE(18)+7,PROPSHEETPADDING(6),LABELLINE(1) + LTEXT "Шире",-1,PROPSHEETWIDTH-PROPSHEETPADDING(9),LABELLINE(18)+7,PROPSHEETPADDING(6),LABELLINE(1) CONTROL "",IDC_CURSOR_WIDTH_TRACK,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,PROPSHEETPADDING(10),LABELLINE(18)+5,PROPSHEETWIDTH-PROPSHEETPADDING(20),LABELLINE(2) LTEXT "",IDC_CURSOR_WIDTH_TEXT,PROPSHEETPADDING(3),LABELLINE(16),PROPSHEETPADDING(4),LABELLINE(1)+5 END @@ -68,237 +68,237 @@ END IDD_PROPPAGEMOUSE DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Мышь" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - GROUPBOX " ",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(6)+PROPSHEETPADDING(1) - LTEXT " .",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) - AUTOCHECKBOX "& ",IDC_MOUSE_BOX,PROPSHEETPADDING(2),LABELLINE(5)+2,PROPSHEETWIDTH-PROPSHEETPADDING(20),14 - PUSHBUTTON "&",IDC_MOUSE_BUTTON,PROPSHEETWIDTH-PROPSHEETPADDING(17),LABELLINE(5)+2,PROPSHEETPADDING(15),14 + GROUPBOX "Управление указателем с клавиатуры",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(6)+PROPSHEETPADDING(1) + LTEXT "Управление указателем с цифровой панели клавиатуры.",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) + AUTOCHECKBOX "&Управление с клавиатуры",IDC_MOUSE_BOX,PROPSHEETPADDING(2),LABELLINE(5)+2,PROPSHEETWIDTH-PROPSHEETPADDING(20),14 + PUSHBUTTON "&Настройка",IDC_MOUSE_BUTTON,PROPSHEETWIDTH-PROPSHEETPADDING(17),LABELLINE(5)+2,PROPSHEETPADDING(15),14 END IDD_PROPPAGEGENERAL DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Общие" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - GROUPBOX " ",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(5) - AUTOCHECKBOX "& :",IDC_RESET_BOX,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),14 + GROUPBOX "Автоматический сброс",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(5) + AUTOCHECKBOX "&Отключать при простое в течение:",IDC_RESET_BOX,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),14 COMBOBOX IDC_RESET_COMBO, PROPSHEETPADDING(4), LABELLINE(4), PROPSHEETPADDING(10), LABELLINE(5), CBS_DROPDOWNLIST | WS_VSCROLL | WS_VISIBLE | WS_TABSTOP - GROUPBOX "",-1,PROPSHEETPADDING(1),LABELLINE(7)-2,PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(5) - AUTOCHECKBOX " &",IDC_NOTIFICATION_MESSAGE,PROPSHEETPADDING(2),LABELLINE(8)-2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 - AUTOCHECKBOX " &",IDC_NOTIFICATION_SOUND,PROPSHEETPADDING(2),LABELLINE(10)-2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 + GROUPBOX "Уведомление",-1,PROPSHEETPADDING(1),LABELLINE(7)-2,PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(5) + AUTOCHECKBOX "Выдавать сообщение при включении &режима",IDC_NOTIFICATION_MESSAGE,PROPSHEETPADDING(2),LABELLINE(8)-2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 + AUTOCHECKBOX "Выдавать звуковой сигнал при изменении р&ежима",IDC_NOTIFICATION_SOUND,PROPSHEETPADDING(2),LABELLINE(10)-2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 - GROUPBOX " ",-1,PROPSHEETPADDING(1),LABELLINE(13)-4,PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(5) - LTEXT " , .",-1,12,124,222,18 - AUTOCHECKBOX "& ",IDC_SERIAL_BOX,12,142,138,14 - PUSHBUTTON "&",IDC_SERIAL_BUTTON,153,142,81,14 + GROUPBOX "Альтернативные устройства ввода",-1,PROPSHEETPADDING(1),LABELLINE(13)-4,PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(5) + LTEXT "Использование альтернативных устройств ввода, заменяющих мышь и клавиатуру.",-1,12,124,222,18 + AUTOCHECKBOX "&Альтернативные устройства ввода",IDC_SERIAL_BOX,12,142,138,14 + PUSHBUTTON "На&стройка",IDC_SERIAL_BUTTON,153,142,81,14 - GROUPBOX " ",-1,PROPSHEETPADDING(1),LABELLINE(19)-4,PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(5) - AUTOCHECKBOX " & ",IDC_ADMIN_LOGON_BOX,PROPSHEETPADDING(2),LABELLINE(20)-4,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 - AUTOCHECKBOX "& ",IDC_ADMIN_USERS_BOX,PROPSHEETPADDING(2),LABELLINE(22)-4,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 + GROUPBOX "Административные параметры",-1,PROPSHEETPADDING(1),LABELLINE(19)-4,PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(5) + AUTOCHECKBOX "Применить &к рабочему столу входа в систему",IDC_ADMIN_LOGON_BOX,PROPSHEETPADDING(2),LABELLINE(20)-4,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 + AUTOCHECKBOX "Ис&пользовать для всех новых пользователей",IDC_ADMIN_USERS_BOX,PROPSHEETPADDING(2),LABELLINE(22)-4,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 END IDD_STICKYKEYSOPTIONS DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Настройка режима залипания клавиш" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(6)+PROPSHEETPADDING(1) - LTEXT " SHIFT 5 .",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) - AUTOCHECKBOX "& ",IDC_STICKY_ACTIVATE_CHECK,PROPSHEETPADDING(2),LABELLINE(5)+2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 + GROUPBOX "Клавиши",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(6)+PROPSHEETPADDING(1) + LTEXT "Нажатие клавиши SHIFT 5 раз активирует залипание клавиш.",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) + AUTOCHECKBOX "&Активировать залипание клавиш",IDC_STICKY_ACTIVATE_CHECK,PROPSHEETPADDING(2),LABELLINE(5)+2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 - GROUPBOX "",-1,PROPSHEETPADDING(1),LABELLINE(9),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(4)+PROPSHEETPADDING(1) - AUTOCHECKBOX "& Ctrl, Shift Alt",IDC_STICKY_LOCK_CHECK,PROPSHEETPADDING(2),LABELLINE(10)+2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 - AUTOCHECKBOX "& ",IDC_STICKY_UNLOCK_CHECK,PROPSHEETPADDING(2),LABELLINE(12),PROPSHEETWIDTH-PROPSHEETPADDING(4),14 + GROUPBOX "Параметры",-1,PROPSHEETPADDING(1),LABELLINE(9),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(4)+PROPSHEETPADDING(1) + AUTOCHECKBOX "&Двойное нажатие запирает клавиши Ctrl, Shift и Alt",IDC_STICKY_LOCK_CHECK,PROPSHEETPADDING(2),LABELLINE(10)+2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 + AUTOCHECKBOX "Отк&лючать залипание при нажатии сразу двух клавиш",IDC_STICKY_UNLOCK_CHECK,PROPSHEETPADDING(2),LABELLINE(12),PROPSHEETWIDTH-PROPSHEETPADDING(4),14 - GROUPBOX "",-1,PROPSHEETPADDING(1),LABELLINE(15),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(4)+PROPSHEETPADDING(1) - AUTOCHECKBOX "& Ctrl, Shift Alt",IDC_STICKY_SOUND_CHECK,PROPSHEETPADDING(2),LABELLINE(16)+2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 - AUTOCHECKBOX "& ",IDC_STICKY_STATUS_CHECK,PROPSHEETPADDING(2),LABELLINE(18),PROPSHEETWIDTH-PROPSHEETPADDING(4),14 + GROUPBOX "Уведомление",-1,PROPSHEETPADDING(1),LABELLINE(15),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(4)+PROPSHEETPADDING(1) + AUTOCHECKBOX "&Выдавать звуковой сигнал при нажатии Ctrl, Shift и Alt",IDC_STICKY_SOUND_CHECK,PROPSHEETPADDING(2),LABELLINE(16)+2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 + AUTOCHECKBOX "&Отображать состояние режима залипания на экране",IDC_STICKY_STATUS_CHECK,PROPSHEETPADDING(2),LABELLINE(18),PROPSHEETWIDTH-PROPSHEETPADDING(4),14 DEFPUSHBUTTON "OK", IDOK, PROPSHEETWIDTH-111, PROPSHEETHEIGHT-21, 50, 14 - PUSHBUTTON "", IDCANCEL, PROPSHEETWIDTH-57, PROPSHEETHEIGHT-21, 50, 14 + PUSHBUTTON "Отмена", IDCANCEL, PROPSHEETWIDTH-57, PROPSHEETHEIGHT-21, 50, 14 END IDD_FILTERKEYSOPTIONS DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Настройка режима фильтрации" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(6)+PROPSHEETPADDING(1) - LTEXT " : \n 8 .",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) - AUTOCHECKBOX "& ",IDC_FILTER_ACTIVATE_CHECK,12,49,154,14 + GROUPBOX "Включение режима",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(6)+PROPSHEETPADDING(1) + LTEXT "Включение режима фильтрации: \nудерживание клавиши в течение 8 секунд.",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) + AUTOCHECKBOX "&Использовать такой способ включения",IDC_FILTER_ACTIVATE_CHECK,12,49,154,14 - GROUPBOX " ",-1,PROPSHEETPADDING(1),LABELLINE(8)+5,PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(8)+5 - AUTORADIOBUTTON " & ",IDC_FILTER_BOUNCE_RADIO,12,90,141,11,WS_GROUP|WS_TABSTOP - AUTORADIOBUTTON " & ; ",IDC_FILTER_REPEAT_RADIO,12,106,142,20,BS_TOP|BS_MULTILINE - PUSHBUTTON "&",IDC_FILTER_BOUNCE_BUTTON, 159, 88, 75, 14,WS_GROUP - PUSHBUTTON "&",IDC_FILTER_REPEAT_BUTTON, 159, 106, 75, 14,WS_GROUP - LTEXT "& :",-1,PROPSHEETPADDING(2),LABELLINE(14)+1,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(1) + GROUPBOX "Параметры фильтрации",-1,PROPSHEETPADDING(1),LABELLINE(8)+5,PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(8)+5 + AUTORADIOBUTTON "Игнорировать &повторные нажатия",IDC_FILTER_BOUNCE_RADIO,12,90,141,11,WS_GROUP|WS_TABSTOP + AUTORADIOBUTTON "Игнорировать &краткие нажатия; замедлить повтор",IDC_FILTER_REPEAT_RADIO,12,106,142,20,BS_TOP|BS_MULTILINE + PUSHBUTTON "&Настройка",IDC_FILTER_BOUNCE_BUTTON, 159, 88, 75, 14,WS_GROUP + PUSHBUTTON "Н&астройка",IDC_FILTER_REPEAT_BUTTON, 159, 106, 75, 14,WS_GROUP + LTEXT "&Область проверки параметров фильтрации:",-1,PROPSHEETPADDING(2),LABELLINE(14)+1,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(1) EDITTEXT IDC_FILTER_TEST_EDIT,PROPSHEETPADDING(2),LABELLINE(15)+1,PROPSHEETWIDTH-PROPSHEETPADDING(4),14,WS_GROUP|ES_AUTOHSCROLL - GROUPBOX "",-1,PROPSHEETPADDING(1),LABELLINE(17)+6,PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(4)+3 - AUTOCHECKBOX "& ",IDC_FILTER_SOUND_CHECK,PROPSHEETPADDING(2),LABELLINE(19),PROPSHEETWIDTH-PROPSHEETPADDING(4),10 - AUTOCHECKBOX " &",IDC_FILTER_STATUS_CHECK,PROPSHEETPADDING(2),LABELLINE(20)+6,PROPSHEETWIDTH-PROPSHEETPADDING(4),10 + GROUPBOX "Уведомление",-1,PROPSHEETPADDING(1),LABELLINE(17)+6,PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(4)+3 + AUTOCHECKBOX "&Звуковой сигнал при нажатии клавиш и приеме ввода",IDC_FILTER_SOUND_CHECK,PROPSHEETPADDING(2),LABELLINE(19),PROPSHEETWIDTH-PROPSHEETPADDING(4),10 + AUTOCHECKBOX "Отображать состояние режима фильтрации на &экране",IDC_FILTER_STATUS_CHECK,PROPSHEETPADDING(2),LABELLINE(20)+6,PROPSHEETWIDTH-PROPSHEETPADDING(4),10 DEFPUSHBUTTON "OK", IDOK, PROPSHEETWIDTH-111, PROPSHEETHEIGHT-21, 50, 14 - PUSHBUTTON "", IDCANCEL, PROPSHEETWIDTH-57, PROPSHEETHEIGHT-21, 50, 14 + PUSHBUTTON "Отмена", IDCANCEL, PROPSHEETWIDTH-57, PROPSHEETHEIGHT-21, 50, 14 END IDD_TOGGLEKEYSOPTIONS DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Настройка режима озвучивания" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(6)+PROPSHEETPADDING(1) - LTEXT " : \n 5 .",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) - AUTOCHECKBOX "& ",IDC_TOGGLE_ACTIVATE_CHECK,PROPSHEETPADDING(2),LABELLINE(5)+2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 + GROUPBOX "Включение режима",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(6)+PROPSHEETPADDING(1) + LTEXT "Включение режима озвучивания: \nудерживание клавиши в течение 5 секунд.",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) + AUTOCHECKBOX "&Использовать такой способ включения",IDC_TOGGLE_ACTIVATE_CHECK,PROPSHEETPADDING(2),LABELLINE(5)+2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 DEFPUSHBUTTON "OK", IDOK, PROPSHEETWIDTH-111, PROPSHEETHEIGHT-21, 50, 14 - PUSHBUTTON "", IDCANCEL, PROPSHEETWIDTH-57, PROPSHEETHEIGHT-21, 50, 14 + PUSHBUTTON "Отмена", IDCANCEL, PROPSHEETWIDTH-57, PROPSHEETHEIGHT-21, 50, 14 END IDD_CONTRASTOPTIONS DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Настройка режима высокой контрастности" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(6)+PROPSHEETPADDING(1) - LTEXT " : \n+ +.",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) - AUTOCHECKBOX "& ",IDC_CONTRAST_ACTIVATE_CHECK,PROPSHEETPADDING(2),LABELLINE(5)+2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 + GROUPBOX "Включение режима",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(6)+PROPSHEETPADDING(1) + LTEXT "Включение режима высокой контрастности: \n+ +.",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) + AUTOCHECKBOX "&Использовать такой способ включения",IDC_CONTRAST_ACTIVATE_CHECK,PROPSHEETPADDING(2),LABELLINE(5)+2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 - GROUPBOX " ",-1,PROPSHEETPADDING(1),LABELLINE(9),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(4)+PROPSHEETPADDING(1) - LTEXT "& :",-1,PROPSHEETPADDING(2),LABELLINE(10)+2,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(1) + GROUPBOX "Контрастная схема оформления",-1,PROPSHEETPADDING(1),LABELLINE(9),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(4)+PROPSHEETPADDING(1) + LTEXT "&Текущая контрастная схема оформления:",-1,PROPSHEETPADDING(2),LABELLINE(10)+2,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(1) COMBOBOX IDC_CONTRAST_COMBO, PROPSHEETPADDING(2), LABELLINE(11)+2, PROPSHEETWIDTH-PROPSHEETPADDING(4), LABELLINE(6), CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_VISIBLE | WS_TABSTOP DEFPUSHBUTTON "OK", IDOK, PROPSHEETWIDTH-111, PROPSHEETHEIGHT-21, 50, 14 - PUSHBUTTON "", IDCANCEL, PROPSHEETWIDTH-57, PROPSHEETHEIGHT-21, 50, 14 + PUSHBUTTON "Отмена", IDCANCEL, PROPSHEETWIDTH-57, PROPSHEETHEIGHT-21, 50, 14 END IDD_MOUSEKEYSOPTIONS DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Настройка управления указателем с клавиатуры" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(6)+PROPSHEETPADDING(1) - LTEXT " : \n++",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) - AUTOCHECKBOX "& ",IDC_MOUSEKEYS_ACTIVATE_CHECK,PROPSHEETPADDING(2),LABELLINE(5)+2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 + GROUPBOX "Включение режима",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(6)+PROPSHEETPADDING(1) + LTEXT "Включение управления указателем с клавиатуры: \n++",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) + AUTOCHECKBOX "&Использовать такой способ включения",IDC_MOUSEKEYS_ACTIVATE_CHECK,PROPSHEETPADDING(2),LABELLINE(5)+2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 - GROUPBOX " ",-1,PROPSHEETPADDING(1),LABELLINE(9),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(9) + GROUPBOX "Скорость перемещения указателя",-1,PROPSHEETPADDING(1),LABELLINE(9),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(9) - LTEXT "&:",-1,PROPSHEETPADDING(2),LABELLINE(10)+4,PROPSHEETPADDING(8)+2,LABELLINE(1) - LTEXT "",-1,PROPSHEETPADDING(11),LABELLINE(10)+4,PROPSHEETPADDING(3),LABELLINE(1) + LTEXT "&Максимальная:",-1,PROPSHEETPADDING(2),LABELLINE(10)+4,PROPSHEETPADDING(8)+2,LABELLINE(1) + LTEXT "ниже",-1,PROPSHEETPADDING(11),LABELLINE(10)+4,PROPSHEETPADDING(3),LABELLINE(1) CONTROL "",IDC_MOUSEKEYS_SPEED_TRACK,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,PROPSHEETPADDING(15),LABELLINE(10)+2,PROPSHEETWIDTH-PROPSHEETPADDING(22),LABELLINE(2) - LTEXT "",-1,PROPSHEETWIDTH-PROPSHEETPADDING(7),LABELLINE(10)+4,PROPSHEETPADDING(3),LABELLINE(1) + LTEXT "выше",-1,PROPSHEETWIDTH-PROPSHEETPADDING(7),LABELLINE(10)+4,PROPSHEETPADDING(3),LABELLINE(1) - LTEXT "&:",-1,PROPSHEETPADDING(2),LABELLINE(13)+4,PROPSHEETPADDING(8),LABELLINE(1) - LTEXT "",-1,PROPSHEETPADDING(11),LABELLINE(13)+4,PROPSHEETPADDING(3),LABELLINE(1) + LTEXT "У&скорение:",-1,PROPSHEETPADDING(2),LABELLINE(13)+4,PROPSHEETPADDING(8),LABELLINE(1) + LTEXT "ниже",-1,PROPSHEETPADDING(11),LABELLINE(13)+4,PROPSHEETPADDING(3),LABELLINE(1) CONTROL "",IDC_MOUSEKEYS_ACCEL_TRACK,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,PROPSHEETPADDING(15),LABELLINE(13)+2,PROPSHEETWIDTH-PROPSHEETPADDING(22),LABELLINE(2) - LTEXT "",-1,PROPSHEETWIDTH-PROPSHEETPADDING(7),LABELLINE(13)+4,PROPSHEETPADDING(3),LABELLINE(1) + LTEXT "выше",-1,PROPSHEETWIDTH-PROPSHEETPADDING(7),LABELLINE(13)+4,PROPSHEETPADDING(3),LABELLINE(1) - AUTOCHECKBOX " - &, - ",IDC_MOUSEKEYS_SPEED_CHECK,PROPSHEETPADDING(2),LABELLINE(16),PROPSHEETWIDTH-PROPSHEETPADDING(4),14 + AUTOCHECKBOX " - ус&корение, - замедление движения",IDC_MOUSEKEYS_SPEED_CHECK,PROPSHEETPADDING(2),LABELLINE(16),PROPSHEETWIDTH-PROPSHEETPADDING(4),14 - LTEXT " , :",-1, 6, 171, 118, 19 - AUTORADIOBUTTON "&",IDC_MOUSEKEYS_ON_RADIO, 129, 174, 49, 11 - AUTORADIOBUTTON "&",IDC_MOUSEKEYS_OFF_RADIO, 182, 174, 52, 11 + LTEXT "Использовать управление с клавиатуры, если :",-1, 6, 171, 118, 19 + AUTORADIOBUTTON "&включен",IDC_MOUSEKEYS_ON_RADIO, 129, 174, 49, 11 + AUTORADIOBUTTON "о&тключен",IDC_MOUSEKEYS_OFF_RADIO, 182, 174, 52, 11 - AUTOCHECKBOX "& ",IDC_MOUSEKEYS_STATUS_CHECK, 6, 190, 220, 14 + AUTOCHECKBOX "&Отображать состояние режима управления на экране",IDC_MOUSEKEYS_STATUS_CHECK, 6, 190, 220, 14 DEFPUSHBUTTON "OK", IDOK, PROPSHEETWIDTH-111, PROPSHEETHEIGHT-21, 50, 14 - PUSHBUTTON "", IDCANCEL, PROPSHEETWIDTH-57, PROPSHEETHEIGHT-21, 50, 14 + PUSHBUTTON "Отмена", IDCANCEL, PROPSHEETWIDTH-57, PROPSHEETHEIGHT-21, 50, 14 END IDD_BOUNCEKEYSOPTIONS DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Дополнительные параметры режима фильтрации" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(5) - LTEXT "& :",-1,PROPSHEETPADDING(2),LABELLINE(2)+1,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(2) + GROUPBOX "Параметры",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(5) + LTEXT "&Игнорировать нажатия с интервалом повтора менее:",-1,PROPSHEETPADDING(2),LABELLINE(2)+1,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(2) COMBOBOX IDC_BOUNCE_TIME_COMBO, PROPSHEETPADDING(2), LABELLINE(3)+5, PROPSHEETWIDTH-PROPSHEETPADDING(4), LABELLINE(6), CBS_DROPDOWNLIST | WS_VSCROLL | WS_VISIBLE | WS_TABSTOP - LTEXT "&:",-1,PROPSHEETPADDING(1),LABELLINE(7)+3,PROPSHEETPADDING(8),LABELLINE(1) + LTEXT "&Проверка:",-1,PROPSHEETPADDING(1),LABELLINE(7)+3,PROPSHEETPADDING(8),LABELLINE(1) EDITTEXT IDC_BOUNCE_TEST_EDIT,PROPSHEETPADDING(10),LABELLINE(7),PROPSHEETWIDTH-PROPSHEETPADDING(11),14,ES_AUTOHSCROLL DEFPUSHBUTTON "OK", IDOK, PROPSHEETWIDTH-111, PROPSHEETHEIGHT-21, 50, 14 - PUSHBUTTON "", IDCANCEL, PROPSHEETWIDTH-57, PROPSHEETHEIGHT-21, 50, 14 + PUSHBUTTON "Отмена", IDCANCEL, PROPSHEETWIDTH-57, PROPSHEETHEIGHT-21, 50, 14 END IDD_REPEATKEYSOPTIONS DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Дополнительные параметры режима фильтрации" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(12) - LTEXT " :",-1, 12, 20, 190, 11 + GROUPBOX "Повтор символов",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(12) + LTEXT "Изменение параметров работы с клавиатурой:",-1, 12, 20, 190, 11 - AUTORADIOBUTTON "& ",IDC_REPEAT_NOREPEAT_RADIO,12, 32, 160, 11,WS_GROUP - AUTORADIOBUTTON "& ",IDC_REPEAT_REPEAT_RADIO,PROPSHEETPADDING(2),LABELLINE(4)+7,131,LABELLINE(1) + AUTORADIOBUTTON "&нет повторов при удерживании клавиш",IDC_REPEAT_NOREPEAT_RADIO,12, 32, 160, 11,WS_GROUP + AUTORADIOBUTTON "за&медление повторов",IDC_REPEAT_REPEAT_RADIO,PROPSHEETPADDING(2),LABELLINE(4)+7,131,LABELLINE(1) - LTEXT "& :",-1, 24, 60, 167, 11 + LTEXT "&Задержка перед началом повтора символа:",-1, 24, 60, 167, 11 COMBOBOX IDC_REPEAT_DELAY_COMBO, PROPSHEETPADDING(4), LABELLINE(7)+6, PROPSHEETWIDTH-PROPSHEETPADDING(6), LABELLINE(6), CBS_DROPDOWNLIST | WS_VSCROLL | WS_VISIBLE | WS_TABSTOP - LTEXT "& :",-1, 24, 89, 89, 11 + LTEXT "С&корость повтора:",-1, 24, 89, 89, 11 COMBOBOX IDC_REPEAT_REPEAT_COMBO, PROPSHEETPADDING(4), LABELLINE(10)+8, PROPSHEETWIDTH-PROPSHEETPADDING(6), LABELLINE(7), CBS_DROPDOWNLIST | WS_VSCROLL | WS_VISIBLE | WS_TABSTOP - GROUPBOX " ",-1,PROPSHEETPADDING(1),LABELLINE(14),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(4)+4 - LTEXT "& :",-1,PROPSHEETPADDING(2),LABELLINE(15),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(1) + GROUPBOX "Медленное нажатие клавиш",-1,PROPSHEETPADDING(1),LABELLINE(14),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(4)+4 + LTEXT "&Удерживание нажатой клавиши:",-1,PROPSHEETPADDING(2),LABELLINE(15),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(1) COMBOBOX IDC_REPEAT_WAIT_COMBO, PROPSHEETPADDING(2), LABELLINE(16)+4, PROPSHEETWIDTH-PROPSHEETPADDING(4), LABELLINE(8), CBS_DROPDOWNLIST | WS_VSCROLL | WS_VISIBLE | WS_TABSTOP - LTEXT "&:",-1,PROPSHEETPADDING(1),LABELLINE(20),PROPSHEETPADDING(8),LABELLINE(1) + LTEXT "&Проверка:",-1,PROPSHEETPADDING(1),LABELLINE(20),PROPSHEETPADDING(8),LABELLINE(1) EDITTEXT IDC_REPEAT_TEST_EDIT,PROPSHEETPADDING(10),LABELLINE(19)+7,PROPSHEETWIDTH-PROPSHEETPADDING(11),14,ES_AUTOHSCROLL DEFPUSHBUTTON "OK", IDOK, PROPSHEETWIDTH-111, PROPSHEETHEIGHT-21, 50, 14 - PUSHBUTTON "", IDCANCEL, PROPSHEETWIDTH-57, PROPSHEETHEIGHT-21, 50, 14 + PUSHBUTTON "Отмена", IDCANCEL, PROPSHEETWIDTH-57, PROPSHEETHEIGHT-21, 50, 14 END IDD_SERIALKEYSOPTIONS DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Настройка альтернативного устройства ввода" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "",-1, 6, 6, 234, 92 - LTEXT " , .",-1, 12, 16, 222, 20 + GROUPBOX "Параметры",-1, 6, 6, 234, 92 + LTEXT "Укажите порт, к которому присоединено альтернативное устройство ввода.",-1, 12, 16, 222, 20 - LTEXT "& :",-1, 12, 34, 222, 10 + LTEXT "&Последовательный порт:",-1, 12, 34, 222, 10 COMBOBOX IDC_SERIAL_PORT_COMBO, PROPSHEETPADDING(2), LABELLINE(4)+7, PROPSHEETWIDTH-PROPSHEETPADDING(4), LABELLINE(6), CBS_DROPDOWNLIST | WS_VSCROLL | WS_VISIBLE | WS_TABSTOP - LTEXT "& (/):",-1, 12, 65, 222, 10 + LTEXT "&Скорость (бит/с):",-1, 12, 65, 222, 10 COMBOBOX IDC_SERIAL_BAUD_COMBO, PROPSHEETPADDING(2), LABELLINE(8)+2, PROPSHEETWIDTH-PROPSHEETPADDING(4), LABELLINE(8), CBS_DROPDOWNLIST | WS_VSCROLL | WS_VISIBLE | WS_TABSTOP DEFPUSHBUTTON "OK", IDOK, PROPSHEETWIDTH-111, PROPSHEETHEIGHT-21, 50, 14 - PUSHBUTTON "", IDCANCEL, PROPSHEETWIDTH-57, PROPSHEETHEIGHT-21, 50, 14 + PUSHBUTTON "Отмена", IDCANCEL, PROPSHEETWIDTH-57, PROPSHEETHEIGHT-21, 50, 14 END STRINGTABLE BEGIN - IDS_CPLSYSTEMNAME " " - IDS_CPLSYSTEMDESCRIPTION " ." + IDS_CPLSYSTEMNAME "Специальные возможности" + IDS_CPLSYSTEMDESCRIPTION "Настройка специальных возможностей вашего компьютера." - IDS_SENTRY_NONE "[]" - IDS_SENTRY_TITLE " " - IDS_SENTRY_WINDOW " " - IDS_SENTRY_DISPLAY " " + IDS_SENTRY_NONE "[нет]" + IDS_SENTRY_TITLE "Подсвечивать заголовок" + IDS_SENTRY_WINDOW "Подсвечивать активное окно" + IDS_SENTRY_DISPLAY "Подсвечивать рабочий стол" - IDS_SECONDS "." - IDS_MINUTES "." + IDS_SECONDS "сек." + IDS_MINUTES "мин." END diff --git a/dll/cpl/access/lang/uk-UA.rc b/dll/cpl/access/lang/uk-UA.rc index eefa7ca81fd..09c2a6c0bf1 100644 --- a/dll/cpl/access/lang/uk-UA.rc +++ b/dll/cpl/access/lang/uk-UA.rc @@ -11,64 +11,64 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT IDD_PROPPAGEKEYBOARD DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Клавіатура" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - GROUPBOX " ",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(6)+PROPSHEETPADDING(1) - LTEXT " Shift, Ctrl Alt, .",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) - AUTOCHECKBOX "& ",IDC_STICKY_BOX,PROPSHEETPADDING(2),LABELLINE(5)+6,PROPSHEETWIDTH-PROPSHEETPADDING(20),14 - PUSHBUTTON "&",IDC_STICKY_BUTTON,PROPSHEETWIDTH-PROPSHEETPADDING(17)+5,LABELLINE(5)+6,PROPSHEETPADDING(15)-5,14 + GROUPBOX "Залипання клавіш",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(6)+PROPSHEETPADDING(1) + LTEXT "Введення комбінацій з клавішами Shift, Ctrl чи Alt, натискаючи клавіші послідовно.",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) + AUTOCHECKBOX "&Залипання клавіш",IDC_STICKY_BOX,PROPSHEETPADDING(2),LABELLINE(5)+6,PROPSHEETWIDTH-PROPSHEETPADDING(20),14 + PUSHBUTTON "&Налаштування",IDC_STICKY_BUTTON,PROPSHEETWIDTH-PROPSHEETPADDING(17)+5,LABELLINE(5)+6,PROPSHEETPADDING(15)-5,14 - GROUPBOX "Գ ",-1,PROPSHEETPADDING(1),LABELLINE(8)+5,PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(7)+2 - LTEXT " .",-1,PROPSHEETPADDING(2),LABELLINE(10)-3,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) - AUTOCHECKBOX " & ",IDC_FILTER_BOX,PROPSHEETPADDING(2),LABELLINE(13)+6,PROPSHEETWIDTH-PROPSHEETPADDING(16),14 - PUSHBUTTON "&",IDC_FILTER_BUTTON,PROPSHEETWIDTH-PROPSHEETPADDING(17)+5,LABELLINE(13)+6,PROPSHEETPADDING(15)-5,14 + GROUPBOX "Фільтрація вводу",-1,PROPSHEETPADDING(1),LABELLINE(8)+5,PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(7)+2 + LTEXT "Ігнорування випадкових короткочасних або повторюваних затискань клавіш.",-1,PROPSHEETPADDING(2),LABELLINE(10)-3,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) + AUTOCHECKBOX "Використовувати &фільтрацію вводу",IDC_FILTER_BOX,PROPSHEETPADDING(2),LABELLINE(13)+6,PROPSHEETWIDTH-PROPSHEETPADDING(16),14 + PUSHBUTTON "Н&алаштування",IDC_FILTER_BUTTON,PROPSHEETWIDTH-PROPSHEETPADDING(17)+5,LABELLINE(13)+6,PROPSHEETPADDING(15)-5,14 - GROUPBOX " ",-1,PROPSHEETPADDING(1),LABELLINE(16)+3,PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(6)+PROPSHEETPADDING(1) - LTEXT " Caps Lock, Num Lock Scroll Lock .",-1,PROPSHEETPADDING(2),LABELLINE(18)-3,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(2) - AUTOCHECKBOX "&",IDC_TOGGLE_BOX,PROPSHEETPADDING(2),LABELLINE(20)+6,PROPSHEETWIDTH-PROPSHEETPADDING(20),14 - PUSHBUTTON "&",IDC_TOGGLE_BUTTON,PROPSHEETWIDTH-PROPSHEETPADDING(17)+5,LABELLINE(20)+6,PROPSHEETPADDING(15)-5,14 + GROUPBOX "Озвучування переключення режимів",-1,PROPSHEETPADDING(1),LABELLINE(16)+3,PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(6)+PROPSHEETPADDING(1) + LTEXT "При зміні стану клавіш Caps Lock, Num Lock і Scroll Lock звучить сигнал.",-1,PROPSHEETPADDING(2),LABELLINE(18)-3,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(2) + AUTOCHECKBOX "&Озвучування",IDC_TOGGLE_BOX,PROPSHEETPADDING(2),LABELLINE(20)+6,PROPSHEETWIDTH-PROPSHEETPADDING(20),14 + PUSHBUTTON "На&лаштування",IDC_TOGGLE_BUTTON,PROPSHEETWIDTH-PROPSHEETPADDING(17)+5,LABELLINE(20)+6,PROPSHEETPADDING(15)-5,14 - AUTOCHECKBOX "& ",IDC_KEYBOARD_EXTRA,PROPSHEETPADDING(1),LABELLINE(23)+3,PROPSHEETWIDTH-PROPSHEETPADDING(2),14 + AUTOCHECKBOX "&Додаткові відомості про роботу із клавіатурою в програмах",IDC_KEYBOARD_EXTRA,PROPSHEETPADDING(1),LABELLINE(23)+3,PROPSHEETWIDTH-PROPSHEETPADDING(2),14 END IDD_PROPPAGESOUND DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Звук" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - GROUPBOX "³ ",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(10)+PROPSHEETPADDING(1) - LTEXT " .",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) - AUTOCHECKBOX "³& ",IDC_SENTRY_BOX,PROPSHEETPADDING(2),LABELLINE(5)+2,PROPSHEETPADDING(15)+2,14 - LTEXT " :", IDC_SENTRY_TEXT, PROPSHEETPADDING(2),LABELLINE(8)-2,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(1) + GROUPBOX "Візуальне сповіщення",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(10)+PROPSHEETPADDING(1) + LTEXT "Звукові сигнали системи супроводжуються візуальною інформацією.",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) + AUTOCHECKBOX "Віз&уальне сповіщення",IDC_SENTRY_BOX,PROPSHEETPADDING(2),LABELLINE(5)+2,PROPSHEETPADDING(15)+2,14 + LTEXT "Інформувати користувача:", IDC_SENTRY_TEXT, PROPSHEETPADDING(2),LABELLINE(8)-2,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(1) COMBOBOX IDC_SENTRY_COMBO, PROPSHEETPADDING(2), LABELLINE(9), PROPSHEETWIDTH-PROPSHEETPADDING(4), LABELLINE(6), CBS_DROPDOWNLIST | WS_VSCROLL | WS_VISIBLE | WS_TABSTOP - GROUPBOX "",-1,PROPSHEETPADDING(1),LABELLINE(12)+5,PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(7)+2 - LTEXT " .",-1,PROPSHEETPADDING(2),LABELLINE(14)-3,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) - AUTOCHECKBOX "&",IDC_SSHOW_BOX,PROPSHEETPADDING(2),LABELLINE(16)+2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 + GROUPBOX "Субтитри",-1,PROPSHEETPADDING(1),LABELLINE(12)+5,PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(7)+2 + LTEXT "Супровід звуку і мови в програмах субтитрами.",-1,PROPSHEETPADDING(2),LABELLINE(14)-3,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) + AUTOCHECKBOX "С&убтитри",IDC_SSHOW_BOX,PROPSHEETPADDING(2),LABELLINE(16)+2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 END IDD_PROPPAGEDISPLAY DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Екран" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - GROUPBOX " ",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(6)+PROPSHEETPADDING(1) - LTEXT " , .",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) - AUTOCHECKBOX "& ",IDC_CONTRAST_BOX,PROPSHEETPADDING(2),LABELLINE(5)+2,PROPSHEETWIDTH-PROPSHEETPADDING(20),14 - PUSHBUTTON "&",IDC_CONTRAST_BUTTON,PROPSHEETWIDTH-PROPSHEETPADDING(17),LABELLINE(5)+2,PROPSHEETPADDING(15),14 + GROUPBOX "Висока контрастність",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(6)+PROPSHEETPADDING(1) + LTEXT "Використання системи кольорів і шрифтів, які полекшують зорове сприйняття тексту.",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) + AUTOCHECKBOX "&Висока контрастність",IDC_CONTRAST_BOX,PROPSHEETPADDING(2),LABELLINE(5)+2,PROPSHEETWIDTH-PROPSHEETPADDING(20),14 + PUSHBUTTON "Н&алаштування",IDC_CONTRAST_BUTTON,PROPSHEETWIDTH-PROPSHEETPADDING(17),LABELLINE(5)+2,PROPSHEETPADDING(15),14 - GROUPBOX " ",-1,PROPSHEETPADDING(1),LABELLINE(8)+5,PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(13) - LTEXT " .",-1,PROPSHEETPADDING(2),LABELLINE(9)+5,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(2) - CTEXT " :",-1,PROPSHEETPADDING(2),LABELLINE(12)+5,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(1) - LTEXT "³",-1,PROPSHEETPADDING(3),LABELLINE(14)+2,PROPSHEETPADDING(6),LABELLINE(1) - LTEXT "",-1,PROPSHEETWIDTH-PROPSHEETPADDING(9),LABELLINE(14)+2,PROPSHEETPADDING(6),LABELLINE(1) + GROUPBOX "Параметри курсору",-1,PROPSHEETPADDING(1),LABELLINE(8)+5,PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(13) + LTEXT "Налаштування частоти миготіння і товщини курсору.",-1,PROPSHEETPADDING(2),LABELLINE(9)+5,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(2) + CTEXT "Частота миготіння:",-1,PROPSHEETPADDING(2),LABELLINE(12)+5,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(1) + LTEXT "Відсутнє",-1,PROPSHEETPADDING(3),LABELLINE(14)+2,PROPSHEETPADDING(6),LABELLINE(1) + LTEXT "Швидке",-1,PROPSHEETWIDTH-PROPSHEETPADDING(9),LABELLINE(14)+2,PROPSHEETPADDING(6),LABELLINE(1) CONTROL "",IDC_CURSOR_BLINK_TRACK,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,PROPSHEETPADDING(10),LABELLINE(14),PROPSHEETWIDTH-PROPSHEETPADDING(20),LABELLINE(2) - CTEXT " :",-1,PROPSHEETPADDING(2),LABELLINE(17),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(1) - LTEXT "",-1,PROPSHEETPADDING(3),LABELLINE(18)+7,PROPSHEETPADDING(6),LABELLINE(1) - LTEXT "",-1,PROPSHEETWIDTH-PROPSHEETPADDING(9),LABELLINE(18)+7,PROPSHEETPADDING(6),LABELLINE(1) + CTEXT "Товщина курсору:",-1,PROPSHEETPADDING(2),LABELLINE(17),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(1) + LTEXT "Вузький",-1,PROPSHEETPADDING(3),LABELLINE(18)+7,PROPSHEETPADDING(6),LABELLINE(1) + LTEXT "Широкий",-1,PROPSHEETWIDTH-PROPSHEETPADDING(9),LABELLINE(18)+7,PROPSHEETPADDING(6),LABELLINE(1) CONTROL "",IDC_CURSOR_WIDTH_TRACK,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,PROPSHEETPADDING(10),LABELLINE(18)+5,PROPSHEETWIDTH-PROPSHEETPADDING(20),LABELLINE(2) LTEXT "",IDC_CURSOR_WIDTH_TEXT,PROPSHEETPADDING(3),LABELLINE(16),PROPSHEETPADDING(4),LABELLINE(1)+5 END @@ -76,237 +76,237 @@ END IDD_PROPPAGEMOUSE DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Миша" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - GROUPBOX " ",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(6)+PROPSHEETPADDING(1) - LTEXT " .",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) - AUTOCHECKBOX "& ",IDC_MOUSE_BOX,PROPSHEETPADDING(2),LABELLINE(5)+2,PROPSHEETWIDTH-PROPSHEETPADDING(20),14 - PUSHBUTTON "&",IDC_MOUSE_BUTTON,PROPSHEETWIDTH-PROPSHEETPADDING(17),LABELLINE(5)+2,PROPSHEETPADDING(15),14 + GROUPBOX "Керування вказівником миші з клавіатури",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(6)+PROPSHEETPADDING(1) + LTEXT "Керування мишею із цифрової панелі клавіатури.",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) + AUTOCHECKBOX "&Керування з клавіатури",IDC_MOUSE_BOX,PROPSHEETPADDING(2),LABELLINE(5)+2,PROPSHEETWIDTH-PROPSHEETPADDING(20),14 + PUSHBUTTON "Н&алаштування",IDC_MOUSE_BUTTON,PROPSHEETWIDTH-PROPSHEETPADDING(17),LABELLINE(5)+2,PROPSHEETPADDING(15),14 END IDD_PROPPAGEGENERAL DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Загальні" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - GROUPBOX " ",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(5) - AUTOCHECKBOX "&³ :",IDC_RESET_BOX,PROPSHEETPADDING(2),LABELLINE(2)-2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 + GROUPBOX "Автоматичне скидання спеціальних можливостей",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(5) + AUTOCHECKBOX "&Відключати спеціальні можливості в разі простою протягом:",IDC_RESET_BOX,PROPSHEETPADDING(2),LABELLINE(2)-2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 COMBOBOX IDC_RESET_COMBO, PROPSHEETPADDING(4), LABELLINE(4), PROPSHEETPADDING(10), LABELLINE(5), CBS_DROPDOWNLIST | WS_VSCROLL | WS_VISIBLE | WS_TABSTOP - GROUPBOX "",-1,PROPSHEETPADDING(1),LABELLINE(7)-2,PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(5) - AUTOCHECKBOX "& ",IDC_NOTIFICATION_MESSAGE,PROPSHEETPADDING(2),LABELLINE(8)-2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 - AUTOCHECKBOX "& ",IDC_NOTIFICATION_SOUND,PROPSHEETPADDING(2),LABELLINE(10)-2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 + GROUPBOX "Сповіщення",-1,PROPSHEETPADDING(1),LABELLINE(7)-2,PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(5) + AUTOCHECKBOX "&Показувати попередження при ввімкненні режиму",IDC_NOTIFICATION_MESSAGE,PROPSHEETPADDING(2),LABELLINE(8)-2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 + AUTOCHECKBOX "П&одавати звуковий сигнал при зміні режиму",IDC_NOTIFICATION_SOUND,PROPSHEETPADDING(2),LABELLINE(10)-2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 - GROUPBOX " ",-1,PROPSHEETPADDING(1),LABELLINE(13)-4,PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(5) - LTEXT " , .",-1,PROPSHEETPADDING(2),LABELLINE(14)-4,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(2) - AUTOCHECKBOX "& ",IDC_SERIAL_BOX,PROPSHEETPADDING(2),LABELLINE(16)-4,PROPSHEETWIDTH-PROPSHEETPADDING(20),14 - PUSHBUTTON "&",IDC_SERIAL_BUTTON,PROPSHEETWIDTH-PROPSHEETPADDING(17),LABELLINE(16)-4,PROPSHEETPADDING(15),14 + GROUPBOX "Альтрернативні пристрої вводу",-1,PROPSHEETPADDING(1),LABELLINE(13)-4,PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(5) + LTEXT "Використання альтернативних пристроїв вводу, які заміняють мишу і клавіатуру.",-1,PROPSHEETPADDING(2),LABELLINE(14)-4,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(2) + AUTOCHECKBOX "&Альтернативні пристрої вводу",IDC_SERIAL_BOX,PROPSHEETPADDING(2),LABELLINE(16)-4,PROPSHEETWIDTH-PROPSHEETPADDING(20),14 + PUSHBUTTON "&Налаштування",IDC_SERIAL_BUTTON,PROPSHEETWIDTH-PROPSHEETPADDING(17),LABELLINE(16)-4,PROPSHEETPADDING(15),14 - GROUPBOX " ",-1,PROPSHEETPADDING(1),LABELLINE(19)-4,PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(5) - AUTOCHECKBOX "& ",IDC_ADMIN_LOGON_BOX,PROPSHEETPADDING(2),LABELLINE(20)-4,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 - AUTOCHECKBOX "& ",IDC_ADMIN_USERS_BOX,PROPSHEETPADDING(2),LABELLINE(22)-4,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 + GROUPBOX "Адміністративні параметри",-1,PROPSHEETPADDING(1),LABELLINE(19)-4,PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(5) + AUTOCHECKBOX "Зас&тосувати до робочого стола входу до системи",IDC_ADMIN_LOGON_BOX,PROPSHEETPADDING(2),LABELLINE(20)-4,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 + AUTOCHECKBOX "&Застосовувати для всіх нових користувачів",IDC_ADMIN_USERS_BOX,PROPSHEETPADDING(2),LABELLINE(22)-4,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 END IDD_STICKYKEYSOPTIONS DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Налаштування режиму залипання клавіш" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(6)+PROPSHEETPADDING(1) - LTEXT " SHIFT 5 .",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) - AUTOCHECKBOX "& ",IDC_STICKY_ACTIVATE_CHECK,PROPSHEETPADDING(2),LABELLINE(5)+2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 + GROUPBOX "Увімкнення режиму",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(6)+PROPSHEETPADDING(1) + LTEXT "Натискання клавіші SHIFT 5 разів активує режим залипання клавіш.",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) + AUTOCHECKBOX "&Використовувати такий спосіб увімкнення",IDC_STICKY_ACTIVATE_CHECK,PROPSHEETPADDING(2),LABELLINE(5)+2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 - GROUPBOX "",-1,PROPSHEETPADDING(1),LABELLINE(9),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(4)+PROPSHEETPADDING(1) - AUTOCHECKBOX "& , ",IDC_STICKY_LOCK_CHECK,PROPSHEETPADDING(2),LABELLINE(10)+2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 - AUTOCHECKBOX "& ",IDC_STICKY_UNLOCK_CHECK,PROPSHEETPADDING(2),LABELLINE(12),PROPSHEETWIDTH-PROPSHEETPADDING(4),14 + GROUPBOX "Параметри",-1,PROPSHEETPADDING(1),LABELLINE(9),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(4)+PROPSHEETPADDING(1) + AUTOCHECKBOX "&Щоб заблокувати службову клавішу, натисніть її двічі",IDC_STICKY_LOCK_CHECK,PROPSHEETPADDING(2),LABELLINE(10)+2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 + AUTOCHECKBOX "&Вимикати залипання натисненням двох клавіш одночасно",IDC_STICKY_UNLOCK_CHECK,PROPSHEETPADDING(2),LABELLINE(12),PROPSHEETWIDTH-PROPSHEETPADDING(4),14 - GROUPBOX "",-1,PROPSHEETPADDING(1),LABELLINE(15),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(4)+PROPSHEETPADDING(1) - AUTOCHECKBOX "& ",IDC_STICKY_SOUND_CHECK,PROPSHEETPADDING(2),LABELLINE(16)+2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 - AUTOCHECKBOX "& ",IDC_STICKY_STATUS_CHECK,PROPSHEETPADDING(2),LABELLINE(18),PROPSHEETWIDTH-PROPSHEETPADDING(4),14 + GROUPBOX "Інформування",-1,PROPSHEETPADDING(1),LABELLINE(15),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(4)+PROPSHEETPADDING(1) + AUTOCHECKBOX "&Звуковий сигнал при натискансненні службової клавіші",IDC_STICKY_SOUND_CHECK,PROPSHEETPADDING(2),LABELLINE(16)+2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 + AUTOCHECKBOX "&Показувати стан Залипання клавіш на екрані",IDC_STICKY_STATUS_CHECK,PROPSHEETPADDING(2),LABELLINE(18),PROPSHEETWIDTH-PROPSHEETPADDING(4),14 DEFPUSHBUTTON "OK", IDOK, PROPSHEETWIDTH-111, PROPSHEETHEIGHT-21, 50, 14 - PUSHBUTTON "", IDCANCEL, PROPSHEETWIDTH-57, PROPSHEETHEIGHT-21, 50, 14 + PUSHBUTTON "Скасувати", IDCANCEL, PROPSHEETWIDTH-57, PROPSHEETHEIGHT-21, 50, 14 END IDD_FILTERKEYSOPTIONS DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Налаштування режиму фільтрації" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(6)+PROPSHEETPADDING(1) - LTEXT " \n 8 ",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) - AUTOCHECKBOX "& ",IDC_FILTER_ACTIVATE_CHECK,PROPSHEETPADDING(2),LABELLINE(5)+2,PROPSHEETWIDTH-PROPSHEETPADDING(20),14 + GROUPBOX "Увімкнення режиму",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(6)+PROPSHEETPADDING(1) + LTEXT "Викликом з клавіатури є \nУтримування правої клавіші впродовж 8 секунд",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) + AUTOCHECKBOX "&Використовувати швидкий виклик",IDC_FILTER_ACTIVATE_CHECK,PROPSHEETPADDING(2),LABELLINE(5)+2,PROPSHEETWIDTH-PROPSHEETPADDING(20),14 - GROUPBOX " ",-1,PROPSHEETPADDING(1),LABELLINE(8)+5,PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(8)+5 - AUTORADIOBUTTON "& ",IDC_FILTER_BOUNCE_RADIO,PROPSHEETPADDING(2),LABELLINE(9)+7,PROPSHEETPADDING(21),LABELLINE(1),WS_GROUP|WS_TABSTOP - AUTORADIOBUTTON " & -\n ",IDC_FILTER_REPEAT_RADIO,PROPSHEETPADDING(2),LABELLINE(11)+5,PROPSHEETPADDING(20),LABELLINE(2),BS_TOP|BS_MULTILINE - PUSHBUTTON "&",IDC_FILTER_BOUNCE_BUTTON,PROPSHEETWIDTH-PROPSHEETPADDING(17),LABELLINE(9)+5,PROPSHEETPADDING(15),14,WS_GROUP - PUSHBUTTON "&",IDC_FILTER_REPEAT_BUTTON,PROPSHEETWIDTH-PROPSHEETPADDING(17),LABELLINE(11)+5,PROPSHEETPADDING(15),14,WS_GROUP - LTEXT "& :",-1,PROPSHEETPADDING(2),LABELLINE(14)+1,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(1) + GROUPBOX "Налаштування фільтру",-1,PROPSHEETPADDING(1),LABELLINE(8)+5,PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(8)+5 + AUTORADIOBUTTON "&Ігнорувати повторні натискання",IDC_FILTER_BOUNCE_RADIO,PROPSHEETPADDING(2),LABELLINE(9)+7,PROPSHEETPADDING(21),LABELLINE(1),WS_GROUP|WS_TABSTOP + AUTORADIOBUTTON "Ігнорувати &короткочасні натис-\nнення і зменшити їх частоту",IDC_FILTER_REPEAT_RADIO,PROPSHEETPADDING(2),LABELLINE(11)+5,PROPSHEETPADDING(20),LABELLINE(2),BS_TOP|BS_MULTILINE + PUSHBUTTON "&Налаштування",IDC_FILTER_BOUNCE_BUTTON,PROPSHEETWIDTH-PROPSHEETPADDING(17),LABELLINE(9)+5,PROPSHEETPADDING(15),14,WS_GROUP + PUSHBUTTON "На&лаштування",IDC_FILTER_REPEAT_BUTTON,PROPSHEETWIDTH-PROPSHEETPADDING(17),LABELLINE(11)+5,PROPSHEETPADDING(15),14,WS_GROUP + LTEXT "Н&атисніть тут щоб перевірити налаштування:",-1,PROPSHEETPADDING(2),LABELLINE(14)+1,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(1) EDITTEXT IDC_FILTER_TEST_EDIT,PROPSHEETPADDING(2),LABELLINE(15)+1,PROPSHEETWIDTH-PROPSHEETPADDING(4),14,WS_GROUP|ES_AUTOHSCROLL - GROUPBOX "",-1,PROPSHEETPADDING(1),LABELLINE(17)+6,PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(4)+3 - AUTOCHECKBOX "& , ",IDC_FILTER_SOUND_CHECK,PROPSHEETPADDING(2),LABELLINE(19),PROPSHEETWIDTH-PROPSHEETPADDING(4),10 - AUTOCHECKBOX "& 'Գ ' ",IDC_FILTER_STATUS_CHECK,PROPSHEETPADDING(2),LABELLINE(20)+6,PROPSHEETWIDTH-PROPSHEETPADDING(4),10 + GROUPBOX "Інформування",-1,PROPSHEETPADDING(1),LABELLINE(17)+6,PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(4)+3 + AUTOCHECKBOX "&Подавати тон, коли натискання клавіші прийнято",IDC_FILTER_SOUND_CHECK,PROPSHEETPADDING(2),LABELLINE(19),PROPSHEETWIDTH-PROPSHEETPADDING(4),10 + AUTOCHECKBOX "По&казувати стан 'Фільтрації вводу' на екрані",IDC_FILTER_STATUS_CHECK,PROPSHEETPADDING(2),LABELLINE(20)+6,PROPSHEETWIDTH-PROPSHEETPADDING(4),10 DEFPUSHBUTTON "OK", IDOK, PROPSHEETWIDTH-111, PROPSHEETHEIGHT-21, 50, 14 - PUSHBUTTON "", IDCANCEL, PROPSHEETWIDTH-57, PROPSHEETHEIGHT-21, 50, 14 + PUSHBUTTON "Скасувати", IDCANCEL, PROPSHEETWIDTH-57, PROPSHEETHEIGHT-21, 50, 14 END IDD_TOGGLEKEYSOPTIONS DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Озвучування перемикання режимів" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(6)+PROPSHEETPADDING(1) - LTEXT " \n ' .",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) - AUTOCHECKBOX "& ",IDC_TOGGLE_ACTIVATE_CHECK,PROPSHEETPADDING(2),LABELLINE(5)+2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 + GROUPBOX "Увімкнення режиму",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(6)+PROPSHEETPADDING(1) + LTEXT "Для швикої активації\nУтримуйте клавішу впродовж п'яти секунд.",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) + AUTOCHECKBOX "Вико&ристовувати такий швикдий виклик",IDC_TOGGLE_ACTIVATE_CHECK,PROPSHEETPADDING(2),LABELLINE(5)+2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 DEFPUSHBUTTON "OK", IDOK, PROPSHEETWIDTH-111, PROPSHEETHEIGHT-21, 50, 14 - PUSHBUTTON "", IDCANCEL, PROPSHEETWIDTH-57, PROPSHEETHEIGHT-21, 50, 14 + PUSHBUTTON "Скасувати", IDCANCEL, PROPSHEETWIDTH-57, PROPSHEETHEIGHT-21, 50, 14 END IDD_CONTRASTOPTIONS DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Налаштування високої контрастності" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(6)+PROPSHEETPADDING(1) - LTEXT " \n .",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) - AUTOCHECKBOX "& ",IDC_CONTRAST_ACTIVATE_CHECK,PROPSHEETPADDING(2),LABELLINE(5)+2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 + GROUPBOX "Увімкнення режиму",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(6)+PROPSHEETPADDING(1) + LTEXT "Для активації \nнатисніть .",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) + AUTOCHECKBOX "&Використовувати такий спосіб увімкнення",IDC_CONTRAST_ACTIVATE_CHECK,PROPSHEETPADDING(2),LABELLINE(5)+2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 - GROUPBOX " ",-1,PROPSHEETPADDING(1),LABELLINE(9),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(4)+PROPSHEETPADDING(1) - LTEXT " :",-1,PROPSHEETPADDING(2),LABELLINE(10)+2,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(1) + GROUPBOX "Контрастна схема оформлення",-1,PROPSHEETPADDING(1),LABELLINE(9),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(4)+PROPSHEETPADDING(1) + LTEXT "Поточна контрастна схема оформлення:",-1,PROPSHEETPADDING(2),LABELLINE(10)+2,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(1) COMBOBOX IDC_CONTRAST_COMBO, PROPSHEETPADDING(2), LABELLINE(11)+2, PROPSHEETWIDTH-PROPSHEETPADDING(4), LABELLINE(6), CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_VISIBLE | WS_TABSTOP DEFPUSHBUTTON "OK", IDOK, PROPSHEETWIDTH-111, PROPSHEETHEIGHT-21, 50, 14 - PUSHBUTTON "", IDCANCEL, PROPSHEETWIDTH-57, PROPSHEETHEIGHT-21, 50, 14 + PUSHBUTTON "Скасувати", IDCANCEL, PROPSHEETWIDTH-57, PROPSHEETHEIGHT-21, 50, 14 END IDD_MOUSEKEYSOPTIONS DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Налаштування керування вказівником із клавіатури" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(6)+PROPSHEETPADDING(1) - LTEXT " : \n .",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) - AUTOCHECKBOX "& ",IDC_MOUSEKEYS_ACTIVATE_CHECK,PROPSHEETPADDING(2),LABELLINE(5)+2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 + GROUPBOX "Увімкнення режиму",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(6)+PROPSHEETPADDING(1) + LTEXT "Щоб увімкнути режим керування вказівником із клавіатури: \nНатисніть клавіші .",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(3) + AUTOCHECKBOX "&Використовувати такий спосіб увімкнення",IDC_MOUSEKEYS_ACTIVATE_CHECK,PROPSHEETPADDING(2),LABELLINE(5)+2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 - GROUPBOX " ",-1,PROPSHEETPADDING(1),LABELLINE(9),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(9) + GROUPBOX "Швидкість руху вказівника",-1,PROPSHEETPADDING(1),LABELLINE(9),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(9) - LTEXT "&:",-1,PROPSHEETPADDING(2),LABELLINE(10)+4,PROPSHEETPADDING(8),LABELLINE(1) - LTEXT "",-1,PROPSHEETPADDING(11),LABELLINE(10)+4,PROPSHEETPADDING(4),LABELLINE(1) + LTEXT "&Найбільша:",-1,PROPSHEETPADDING(2),LABELLINE(10)+4,PROPSHEETPADDING(8),LABELLINE(1) + LTEXT "нижче",-1,PROPSHEETPADDING(11),LABELLINE(10)+4,PROPSHEETPADDING(4),LABELLINE(1) CONTROL "",IDC_MOUSEKEYS_SPEED_TRACK,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,PROPSHEETPADDING(15),LABELLINE(10)+2,PROPSHEETWIDTH-PROPSHEETPADDING(22),LABELLINE(2) - LTEXT "",-1,PROPSHEETWIDTH-PROPSHEETPADDING(7),LABELLINE(10)+4,PROPSHEETPADDING(3),LABELLINE(1) + LTEXT "вище",-1,PROPSHEETWIDTH-PROPSHEETPADDING(7),LABELLINE(10)+4,PROPSHEETPADDING(3),LABELLINE(1) - LTEXT "&:",-1,PROPSHEETPADDING(2),LABELLINE(13)+4,PROPSHEETPADDING(8),LABELLINE(1) - LTEXT "",-1,PROPSHEETPADDING(11),LABELLINE(13)+4,PROPSHEETPADDING(4),LABELLINE(1) + LTEXT "&Прискорення:",-1,PROPSHEETPADDING(2),LABELLINE(13)+4,PROPSHEETPADDING(8),LABELLINE(1) + LTEXT "нижче",-1,PROPSHEETPADDING(11),LABELLINE(13)+4,PROPSHEETPADDING(4),LABELLINE(1) CONTROL "",IDC_MOUSEKEYS_ACCEL_TRACK,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,PROPSHEETPADDING(15),LABELLINE(13)+2,PROPSHEETWIDTH-PROPSHEETPADDING(22),LABELLINE(2) - LTEXT "",-1,PROPSHEETWIDTH-PROPSHEETPADDING(7),LABELLINE(13)+4,PROPSHEETPADDING(3),LABELLINE(1) + LTEXT "вище",-1,PROPSHEETWIDTH-PROPSHEETPADDING(7),LABELLINE(13)+4,PROPSHEETPADDING(3),LABELLINE(1) - AUTOCHECKBOX "CTRL - &, SHIFT - ",IDC_MOUSEKEYS_SPEED_CHECK,PROPSHEETPADDING(2),LABELLINE(16),PROPSHEETWIDTH-PROPSHEETPADDING(4),14 + AUTOCHECKBOX "CTRL - прис&корення, SHIFT - уповільення",IDC_MOUSEKEYS_SPEED_CHECK,PROPSHEETPADDING(2),LABELLINE(16),PROPSHEETWIDTH-PROPSHEETPADDING(4),14 - LTEXT ", NumLock:",-1,PROPSHEETPADDING(1),LABELLINE(18)+7,PROPSHEETPADDING(20),LABELLINE(1) - AUTORADIOBUTTON "&",IDC_MOUSEKEYS_ON_RADIO,PROPSHEETWIDTH-PROPSHEETPADDING(14),LABELLINE(18)+7,PROPSHEETPADDING(5),LABELLINE(1) - AUTORADIOBUTTON "&",IDC_MOUSEKEYS_OFF_RADIO,PROPSHEETWIDTH-PROPSHEETPADDING(8),LABELLINE(18)+7,PROPSHEETPADDING(5),LABELLINE(1) + LTEXT "Використовувати, якщо NumLock:",-1,PROPSHEETPADDING(1),LABELLINE(18)+7,PROPSHEETPADDING(20),LABELLINE(1) + AUTORADIOBUTTON "Уві&мк",IDC_MOUSEKEYS_ON_RADIO,PROPSHEETWIDTH-PROPSHEETPADDING(14),LABELLINE(18)+7,PROPSHEETPADDING(5),LABELLINE(1) + AUTORADIOBUTTON "В&имк",IDC_MOUSEKEYS_OFF_RADIO,PROPSHEETWIDTH-PROPSHEETPADDING(8),LABELLINE(18)+7,PROPSHEETPADDING(5),LABELLINE(1) - AUTOCHECKBOX "& ",IDC_MOUSEKEYS_STATUS_CHECK,PROPSHEETPADDING(1),LABELLINE(20)+2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 + AUTOCHECKBOX "П&оказувати стан керування вказівником на екрані",IDC_MOUSEKEYS_STATUS_CHECK,PROPSHEETPADDING(1),LABELLINE(20)+2,PROPSHEETWIDTH-PROPSHEETPADDING(4),14 DEFPUSHBUTTON "OK", IDOK, PROPSHEETWIDTH-111, PROPSHEETHEIGHT-21, 50, 14 - PUSHBUTTON "", IDCANCEL, PROPSHEETWIDTH-57, PROPSHEETHEIGHT-21, 50, 14 + PUSHBUTTON "Скасувати", IDCANCEL, PROPSHEETWIDTH-57, PROPSHEETHEIGHT-21, 50, 14 END IDD_BOUNCEKEYSOPTIONS DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Додаткові параметри режиму фільтрації" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(5) - LTEXT "& , :",-1,PROPSHEETPADDING(2),LABELLINE(2)+1,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(2) + GROUPBOX "Повторення символів",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(5) + LTEXT "&Ігнорувати натискання клавіш, які повторюються частіше ніж:",-1,PROPSHEETPADDING(2),LABELLINE(2)+1,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(2) COMBOBOX IDC_BOUNCE_TIME_COMBO, PROPSHEETPADDING(2), LABELLINE(3)+5, PROPSHEETWIDTH-PROPSHEETPADDING(4), LABELLINE(6), CBS_DROPDOWNLIST | WS_VSCROLL | WS_VISIBLE | WS_TABSTOP - LTEXT "&:",-1,PROPSHEETPADDING(1),LABELLINE(7)+3,PROPSHEETPADDING(8),LABELLINE(1) + LTEXT "&Перевірка:",-1,PROPSHEETPADDING(1),LABELLINE(7)+3,PROPSHEETPADDING(8),LABELLINE(1) EDITTEXT IDC_BOUNCE_TEST_EDIT,PROPSHEETPADDING(10),LABELLINE(7),PROPSHEETWIDTH-PROPSHEETPADDING(11),14,ES_AUTOHSCROLL DEFPUSHBUTTON "OK", IDOK, PROPSHEETWIDTH-111, PROPSHEETHEIGHT-21, 50, 14 - PUSHBUTTON "", IDCANCEL, PROPSHEETWIDTH-57, PROPSHEETHEIGHT-21, 50, 14 + PUSHBUTTON "Скасувати", IDCANCEL, PROPSHEETWIDTH-57, PROPSHEETHEIGHT-21, 50, 14 END IDD_REPEATKEYSOPTIONS DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Додаткові параметри режиму фільтрації" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(12) - LTEXT " :",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(2) + GROUPBOX "Повторення символів",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(12) + LTEXT "Зміна параметрів клавіатури на панелі керування:",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(2) - AUTORADIOBUTTON "& ",IDC_REPEAT_NOREPEAT_RADIO,PROPSHEETPADDING(2),LABELLINE(3)+3,78,LABELLINE(1),WS_GROUP - AUTORADIOBUTTON "& ",IDC_REPEAT_REPEAT_RADIO,PROPSHEETPADDING(2),LABELLINE(4)+7,131,LABELLINE(1) + AUTORADIOBUTTON "&не повторювати",IDC_REPEAT_NOREPEAT_RADIO,PROPSHEETPADDING(2),LABELLINE(3)+3,78,LABELLINE(1),WS_GROUP + AUTORADIOBUTTON "&уповільнення повторів",IDC_REPEAT_REPEAT_RADIO,PROPSHEETPADDING(2),LABELLINE(4)+7,131,LABELLINE(1) - LTEXT "& :",-1,PROPSHEETPADDING(4),LABELLINE(6)+4,PROPSHEETPADDING(10),LABELLINE(1) + LTEXT "&Затримка перед повторенням:",-1,PROPSHEETPADDING(4),LABELLINE(6)+4,PROPSHEETPADDING(10),LABELLINE(1) COMBOBOX IDC_REPEAT_DELAY_COMBO, PROPSHEETPADDING(4), LABELLINE(7)+6, PROPSHEETWIDTH-PROPSHEETPADDING(6), LABELLINE(6), CBS_DROPDOWNLIST | WS_VSCROLL | WS_VISIBLE | WS_TABSTOP - LTEXT "& :",-1,PROPSHEETPADDING(4),LABELLINE(9)+6,PROPSHEETPADDING(10),LABELLINE(1) + LTEXT "&Швидкість повторення:",-1,PROPSHEETPADDING(4),LABELLINE(9)+6,PROPSHEETPADDING(10),LABELLINE(1) COMBOBOX IDC_REPEAT_REPEAT_COMBO, PROPSHEETPADDING(4), LABELLINE(10)+8, PROPSHEETWIDTH-PROPSHEETPADDING(6), LABELLINE(7), CBS_DROPDOWNLIST | WS_VSCROLL | WS_VISIBLE | WS_TABSTOP - GROUPBOX " ",-1,PROPSHEETPADDING(1),LABELLINE(14),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(4)+4 - LTEXT "& :",-1,PROPSHEETPADDING(2),LABELLINE(15),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(1) + GROUPBOX "Повільне натискання клавіш",-1,PROPSHEETPADDING(1),LABELLINE(14),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(4)+4 + LTEXT "&Утримування натиснутої клавіші:",-1,PROPSHEETPADDING(2),LABELLINE(15),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(1) COMBOBOX IDC_REPEAT_WAIT_COMBO, PROPSHEETPADDING(2), LABELLINE(16)+4, PROPSHEETWIDTH-PROPSHEETPADDING(4), LABELLINE(8), CBS_DROPDOWNLIST | WS_VSCROLL | WS_VISIBLE | WS_TABSTOP - LTEXT "&:",-1,PROPSHEETPADDING(1),LABELLINE(20),PROPSHEETPADDING(8),LABELLINE(1) + LTEXT "&Перевірка:",-1,PROPSHEETPADDING(1),LABELLINE(20),PROPSHEETPADDING(8),LABELLINE(1) EDITTEXT IDC_REPEAT_TEST_EDIT,PROPSHEETPADDING(10),LABELLINE(19)+7,PROPSHEETWIDTH-PROPSHEETPADDING(11),14,ES_AUTOHSCROLL DEFPUSHBUTTON "OK", IDOK, PROPSHEETWIDTH-111, PROPSHEETHEIGHT-21, 50, 14 - PUSHBUTTON "", IDCANCEL, PROPSHEETWIDTH-57, PROPSHEETHEIGHT-21, 50, 14 + PUSHBUTTON "Скасувати", IDCANCEL, PROPSHEETWIDTH-57, PROPSHEETHEIGHT-21, 50, 14 END IDD_SERIALKEYSOPTIONS DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Настройка альтернативного пристрою вводу" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(10) - LTEXT " , .",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(2) + GROUPBOX "послідовний пристрій вводу",-1,PROPSHEETPADDING(1),LABELLINE(1),PROPSHEETWIDTH-PROPSHEETPADDING(2),LABELLINE(10) + LTEXT "Укажіть порт, до якого підключено альтернативний пристрій вводу.",-1,PROPSHEETPADDING(2),LABELLINE(2),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(2) - LTEXT "& :",-1,PROPSHEETPADDING(2),LABELLINE(3)+5,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(2) + LTEXT "&Послідовний порт:",-1,PROPSHEETPADDING(2),LABELLINE(3)+5,PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(2) COMBOBOX IDC_SERIAL_PORT_COMBO, PROPSHEETPADDING(2), LABELLINE(4)+7, PROPSHEETWIDTH-PROPSHEETPADDING(4), LABELLINE(6), CBS_DROPDOWNLIST | WS_VSCROLL | WS_VISIBLE | WS_TABSTOP - LTEXT "&:",-1,PROPSHEETPADDING(2),LABELLINE(7),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(2) + LTEXT "&Швидкість:",-1,PROPSHEETPADDING(2),LABELLINE(7),PROPSHEETWIDTH-PROPSHEETPADDING(4),LABELLINE(2) COMBOBOX IDC_SERIAL_BAUD_COMBO, PROPSHEETPADDING(2), LABELLINE(8)+2, PROPSHEETWIDTH-PROPSHEETPADDING(4), LABELLINE(8), CBS_DROPDOWNLIST | WS_VSCROLL | WS_VISIBLE | WS_TABSTOP DEFPUSHBUTTON "OK", IDOK, PROPSHEETWIDTH-111, PROPSHEETHEIGHT-21, 50, 14 - PUSHBUTTON "", IDCANCEL, PROPSHEETWIDTH-57, PROPSHEETHEIGHT-21, 50, 14 + PUSHBUTTON "Скасувати", IDCANCEL, PROPSHEETWIDTH-57, PROPSHEETHEIGHT-21, 50, 14 END STRINGTABLE BEGIN - IDS_CPLSYSTEMNAME " " - IDS_CPLSYSTEMDESCRIPTION " '." + IDS_CPLSYSTEMNAME "Спеціальні можливості" + IDS_CPLSYSTEMDESCRIPTION "Налаштування спеціальних можливостей Вашого комп'ютера." - IDS_SENTRY_NONE "[]" - IDS_SENTRY_TITLE "ϳ " - IDS_SENTRY_WINDOW "ϳ " - IDS_SENTRY_DISPLAY "ϳ " + IDS_SENTRY_NONE "[немає]" + IDS_SENTRY_TITLE "Підсвічувати загловок" + IDS_SENTRY_WINDOW "Підсвічувати активне вікно" + IDS_SENTRY_DISPLAY "Підсвічувати робочий стіл" - IDS_SECONDS "" - IDS_MINUTES "" + IDS_SECONDS "секунд" + IDS_MINUTES "хвилин" END diff --git a/dll/cpl/access/mouse.c b/dll/cpl/access/mouse.c index d5109b00f23..0fe19e5b6a1 100644 --- a/dll/cpl/access/mouse.c +++ b/dll/cpl/access/mouse.c @@ -8,12 +8,6 @@ * Copyright 2007 Eric Kohl */ -#include -#include -#include -#include -#include -#include "resource.h" #include "access.h" diff --git a/dll/cpl/access/rsrc.rc b/dll/cpl/access/rsrc.rc index 9284a15bcb1..fe768729384 100644 --- a/dll/cpl/access/rsrc.rc +++ b/dll/cpl/access/rsrc.rc @@ -14,9 +14,12 @@ #include "lang/ja-JP.rc" #include "lang/nl-NL.rc" #include "lang/no-NO.rc" +#include "lang/sk-SK.rc" +#include "lang/zh-CN.rc" + +// UTF-8 +#pragma code_page(65001) #include "lang/pl-PL.rc" #include "lang/ro-RO.rc" #include "lang/ru-RU.rc" -#include "lang/sk-SK.rc" #include "lang/uk-UA.rc" -#include "lang/zh-CN.rc" diff --git a/dll/cpl/access/sound.c b/dll/cpl/access/sound.c index 9dd1636b065..9190189ece4 100644 --- a/dll/cpl/access/sound.c +++ b/dll/cpl/access/sound.c @@ -8,11 +8,6 @@ * Copyright 2007 Eric Kohl */ -#include -#include -#include -#include -#include "resource.h" #include "access.h" diff --git a/dll/cpl/appwiz/CMakeLists.txt b/dll/cpl/appwiz/CMakeLists.txt index cf5b76fa428..a5be5f13620 100644 --- a/dll/cpl/appwiz/CMakeLists.txt +++ b/dll/cpl/appwiz/CMakeLists.txt @@ -23,4 +23,5 @@ add_importlibs(appwiz shell32 kernel32) +add_pch(appwiz appwiz.h) add_cd_file(TARGET appwiz DESTINATION reactos/system32 FOR all) diff --git a/dll/cpl/appwiz/appwiz.h b/dll/cpl/appwiz/appwiz.h index 8ee2bd4c6b3..355cffc86a1 100644 --- a/dll/cpl/appwiz/appwiz.h +++ b/dll/cpl/appwiz/appwiz.h @@ -1,5 +1,3 @@ -#pragma once - #define COBJMACROS #include #include diff --git a/dll/cpl/appwiz/appwiz.rbuild b/dll/cpl/appwiz/appwiz.rbuild index 316a0899215..c89725b7bba 100644 --- a/dll/cpl/appwiz/appwiz.rbuild +++ b/dll/cpl/appwiz/appwiz.rbuild @@ -12,4 +12,5 @@ appwiz.c createlink.c appwiz.rc + appwiz.h diff --git a/dll/cpl/appwiz/lang/pl-PL.rc b/dll/cpl/appwiz/lang/pl-PL.rc index eada53d8597..a836bfcc5cc 100644 --- a/dll/cpl/appwiz/lang/pl-PL.rc +++ b/dll/cpl/appwiz/lang/pl-PL.rc @@ -1,15 +1,16 @@ /* - * translated by Caemyr - Olaf Siejka (Jan, 2008) - * Use ReactOS forum PM or IRC to contact me - * http://www.reactos.org - * IRC: irc.freenode.net #reactos-pl; + * translated by Caemyr - Olaf Siejka (Jan, 2008) + * Use ReactOS forum PM or IRC to contact me + * http://www.reactos.org + * IRC: irc.freenode.net #reactos-pl; + * UTF-8 conversion by Caemyr (May, 2011) */ LANGUAGE LANG_POLISH, SUBLANG_DEFAULT IDD_FIRSTPAGE DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Utwrz cze" +CAPTION "Utwórz łącze" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN LTEXT "Text1", -1, 115, 15, 160, 24 @@ -18,7 +19,7 @@ END IDD_SUBMIT_REPORT DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Utwrz cze" +CAPTION "Utwórz łącze" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN LTEXT "Text1",-1,10,0,225,40 @@ -28,30 +29,30 @@ END IDD_SHORTCUT_LOCATION DIALOGEX 0, 0, 340, 200 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Utwrz skrt" +CAPTION "Utwórz skrót" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT "Ten program konfiguracyjny pomoe ci stworzy skrty do lokalnych lub\nsieciowych programw, plikw, katalogw, komputerw, bd addresw\nInternetowych.", -1, 120, 15, 200, 30 - LTEXT "Wpisz ciek dostpu do obiektu:", -1, 120, 50, 120, 10 + LTEXT "Ten program konfiguracyjny pomoże ci stworzyć skróty do lokalnych lub\nsieciowych programów, plików, katalogów, komputerów, bądź addresów\nInternetowych.", -1, 120, 15, 200, 30 + LTEXT "Wpisz ścieżkę dostępu do obiektu:", -1, 120, 50, 120, 10 EDITTEXT IDC_SHORTCUT_LOCATION, 120, 65, 150, 15, ES_LEFT - PUSHBUTTON "Przegldaj...", IDC_SHORTCUT_BROWSE, 272, 65, 55, 15, ES_LEFT - LTEXT "Nacinij Dalej aby kontynuowa.", -1, 120, 97, 162, 10 + PUSHBUTTON "Przeglądaj...", IDC_SHORTCUT_BROWSE, 272, 65, 55, 15, ES_LEFT + LTEXT "Naciśnij Dalej aby kontynuować.", -1, 120, 97, 162, 10 END IDD_SHORTCUT_FINISH DIALOGEX 0, 0, 340, 200 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Wybierz nazw" +CAPTION "Wybierz nazwę" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT "&Wpisz nazw dla tego skrtu:", -1, 120, 15, 150, 10 + LTEXT "&Wpisz nazwę dla tego skrótu:", -1, 120, 15, 150, 10 EDITTEXT IDC_SHORTCUT_NAME, 120, 35, 150, 15, ES_LEFT - LTEXT "Nacinij Zakocz by utworzy skrt.", -1, 118, 97, 178, 17 + LTEXT "Naciśnij Zakończ by utworzyć skrót.", -1, 118, 97, 178, 17 END STRINGTABLE BEGIN - IDS_CPLSYSTEMNAME "Dodaj/Usu Programy" - IDS_CPLSYSTEMDESCRIPTION "Instaluje bd usuwa programy oraz tworzy skrty." - IDS_CREATE_SHORTCUT "Utwrz skrt" - IDS_ERROR_NOT_FOUND "Plik %s nie zosta znaleziony." + IDS_CPLSYSTEMNAME "Dodaj/Usuń Programy" + IDS_CPLSYSTEMDESCRIPTION "Instaluje bądź usuwa programy oraz tworzy skróty." + IDS_CREATE_SHORTCUT "Utwórz skrót" + IDS_ERROR_NOT_FOUND "Plik %s nie został znaleziony." END diff --git a/dll/cpl/appwiz/lang/ru-RU.rc b/dll/cpl/appwiz/lang/ru-RU.rc index 253ed9a766e..d971d6c8164 100644 --- a/dll/cpl/appwiz/lang/ru-RU.rc +++ b/dll/cpl/appwiz/lang/ru-RU.rc @@ -2,7 +2,7 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT IDD_FIRSTPAGE DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Создания ярлыка" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN LTEXT "Text1", -1, 115, 15, 160, 24 @@ -11,7 +11,7 @@ END IDD_SUBMIT_REPORT DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Создание ярлыка" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN LTEXT "Text1",-1,10,0,225,40 @@ -21,30 +21,30 @@ END IDD_SHORTCUT_LOCATION DIALOGEX 0, 0, 340, 200 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Создание ярлыка" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT " \n , , , \n-.", -1, 120, 15, 200, 30 - LTEXT " :", -1, 120, 50, 120, 10 + LTEXT "Этот мастер поможет создать ярлык для локальных или\nсетевых программ, файлов, папок, компьютеров или\nИнтернет-адресов.", -1, 120, 15, 200, 30 + LTEXT "Выберите местоположение элемента:", -1, 120, 50, 120, 10 EDITTEXT IDC_SHORTCUT_LOCATION, 120, 65, 150, 15, ES_LEFT - PUSHBUTTON "...", IDC_SHORTCUT_BROWSE, 272, 65, 55, 15, ES_LEFT - LTEXT " """" .", -1, 120, 97, 162, 10 + PUSHBUTTON "Обзор...", IDC_SHORTCUT_BROWSE, 272, 65, 55, 15, ES_LEFT + LTEXT "Щелкните ""Далее"" для продолжения.", -1, 120, 97, 162, 10 END IDD_SHORTCUT_FINISH DIALOGEX 0, 0, 340, 200 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Выбор заголовка для программы" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT "& :", -1, 120, 15, 150, 10 + LTEXT "&Введите заголовок ярлыка:", -1, 120, 15, 150, 10 EDITTEXT IDC_SHORTCUT_NAME, 120, 35, 150, 15, ES_LEFT - LTEXT " """" .", -1, 118, 97, 178, 17 + LTEXT "Щелкните ""Завершить"" для создания ярлыка.", -1, 118, 97, 178, 17 END STRINGTABLE BEGIN - IDS_CPLSYSTEMNAME " " - IDS_CPLSYSTEMDESCRIPTION " , ." - IDS_CREATE_SHORTCUT " " - IDS_ERROR_NOT_FOUND " %s ." + IDS_CPLSYSTEMNAME "Установка и удаление программ" + IDS_CPLSYSTEMDESCRIPTION "Работа с программами, обновлениями и ярлыками." + IDS_CREATE_SHORTCUT "Создать ярлык" + IDS_ERROR_NOT_FOUND "Файл %s не найден." END diff --git a/dll/cpl/appwiz/lang/uk-UA.rc b/dll/cpl/appwiz/lang/uk-UA.rc index e9dd0bb6b68..a2d7202cb59 100644 --- a/dll/cpl/appwiz/lang/uk-UA.rc +++ b/dll/cpl/appwiz/lang/uk-UA.rc @@ -10,7 +10,7 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT IDD_FIRSTPAGE DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Створення ярлика" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN LTEXT "Text1", -1, 115, 15, 160, 24 @@ -19,7 +19,7 @@ END IDD_SUBMIT_REPORT DIALOGEX 0, 0, PROPSHEETWIDTH, PROPSHEETHEIGHT STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Створення ярлика" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN LTEXT "Text1",-1,10,0,225,40 @@ -29,30 +29,30 @@ END IDD_SHORTCUT_LOCATION DIALOGEX 0, 0, 340, 200 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Створення ярлика" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT " , \n , , , '\n .", -1, 120, 15, 200, 30 - LTEXT " ':", -1, 120, 50, 120, 10 + LTEXT "Цей майстер допомагає створити ярлик, який указує на\nлокальні або мережні програми, файли, папки, комп'ютери\nабо адреси в Інтернеті.", -1, 120, 15, 200, 30 + LTEXT "Укажіть розташування об'єкта:", -1, 120, 50, 120, 10 EDITTEXT IDC_SHORTCUT_LOCATION, 120, 65, 150, 15, ES_LEFT - PUSHBUTTON "...", IDC_SHORTCUT_BROWSE, 272, 65, 55, 15, ES_LEFT - LTEXT " , """".", -1, 120, 97, 162, 10 + PUSHBUTTON "Огляд...", IDC_SHORTCUT_BROWSE, 272, 65, 55, 15, ES_LEFT + LTEXT "Щоб продовжити установку, натисніть кнопку ""Далі"".", -1, 120, 97, 162, 10 END IDD_SHORTCUT_FINISH DIALOGEX 0, 0, 340, 200 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Вибір назви програми" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT "& ' :", -1, 120, 15, 150, 10 + LTEXT "&Введіть ім'я ярлика:", -1, 120, 15, 150, 10 EDITTEXT IDC_SHORTCUT_NAME, 120, 35, 150, 15, ES_LEFT - LTEXT " , """".", -1, 118, 97, 178, 17 + LTEXT "Щоб створити ярлик, натисніть кнопку ""Готово"".", -1, 118, 97, 178, 17 END STRINGTABLE BEGIN - IDS_CPLSYSTEMNAME " " - IDS_CPLSYSTEMDESCRIPTION " ." - IDS_CREATE_SHORTCUT " " - IDS_ERROR_NOT_FOUND " %s ." + IDS_CPLSYSTEMNAME "Установка й видалення програм" + IDS_CPLSYSTEMDESCRIPTION "Встановлення програм і створення ярликів." + IDS_CREATE_SHORTCUT "Створити ярлик" + IDS_ERROR_NOT_FOUND "Файл %s не знайдений." END diff --git a/dll/cpl/appwiz/rsrc.rc b/dll/cpl/appwiz/rsrc.rc index 5440928c43e..237d6c6106d 100644 --- a/dll/cpl/appwiz/rsrc.rc +++ b/dll/cpl/appwiz/rsrc.rc @@ -10,8 +10,11 @@ #include "lang/fr-FR.rc" #include "lang/it-IT.rc" #include "lang/no-NO.rc" +#include "lang/sk-SK.rc" +#include "lang/zh-CN.rc" + +// UTF-8 +#pragma code_page(65001) #include "lang/pl-PL.rc" #include "lang/ru-RU.rc" -#include "lang/sk-SK.rc" #include "lang/uk-UA.rc" -#include "lang/zh-CN.rc" diff --git a/dll/cpl/console/CMakeLists.txt b/dll/cpl/console/CMakeLists.txt index a16f09aedb4..56a66ca628a 100644 --- a/dll/cpl/console/CMakeLists.txt +++ b/dll/cpl/console/CMakeLists.txt @@ -12,7 +12,7 @@ list(APPEND SOURCE console.rc ${CMAKE_CURRENT_BINARY_DIR}/console.def) -add_library(console SHARED ${CMAKE_CURRENT_BINARY_DIR}/console_console.h.gch ${SOURCE}) +add_library(console SHARED ${SOURCE}) set_module_type(console win32dll) @@ -23,5 +23,5 @@ add_importlibs(console comctl32 kernel32) -add_pch(console ${CMAKE_CURRENT_SOURCE_DIR}/console.h ${SOURCE}) +add_pch(console console.h) add_cd_file(TARGET console DESTINATION reactos/system32 FOR all) diff --git a/dll/cpl/console/lang/pl-PL.rc b/dll/cpl/console/lang/pl-PL.rc index 31b785ed860..ceceeda21c3 100644 --- a/dll/cpl/console/lang/pl-PL.rc +++ b/dll/cpl/console/lang/pl-PL.rc @@ -1,10 +1,9 @@ /* * translated by TestamenT - * testament@users.sourceforge.net - * https://sourceforge.net/projects/reactospl - * + * testament@users.sourceforge.net + * https://sourceforge.net/projects/reactospl + * UTF-8 conversion by Caemyr (May, 2011) */ - #include LANGUAGE LANG_POLISH, SUBLANG_DEFAULT @@ -15,20 +14,20 @@ CAPTION "Opcje" FONT 8, "MS Shell Dlg" BEGIN GROUPBOX "Rozmiar kursora", -1, 15, 15, 120, 70, WS_CHILD | WS_VISIBLE | WS_GROUP -CONTROL "&May", IDC_RADIO_SMALL_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 25, 90, 10 -CONTROL "&redni", IDC_RADIO_MEDIUM_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 40, 90, 10 -CONTROL "&Duy", IDC_RADIO_LARGE_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 55, 90, 10 -GROUPBOX "Poka opcje", -1, 140, 15, 100, 70, WS_CHILD | WS_VISIBLE | WS_GROUP +CONTROL "&Mały", IDC_RADIO_SMALL_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 25, 90, 10 +CONTROL "&Średni", IDC_RADIO_MEDIUM_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 40, 90, 10 +CONTROL "&Duży", IDC_RADIO_LARGE_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 55, 90, 10 +GROUPBOX "Pokaż opcje", -1, 140, 15, 100, 70, WS_CHILD | WS_VISIBLE | WS_GROUP CONTROL "&Okno", IDC_RADIO_DISPLAY_WINDOW, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 150, 35, 70, 10 -CONTROL "&Peny ekran", IDC_RADIO_DISPLAY_FULL, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 150, 50, 70, 10 -GROUPBOX "Historia polece:", -1, 15, 90, 120, 70, WS_CHILD | WS_VISIBLE | WS_GROUP +CONTROL "&Pełny ekran", IDC_RADIO_DISPLAY_FULL, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 150, 50, 70, 10 +GROUPBOX "Historia poleceń:", -1, 15, 90, 120, 70, WS_CHILD | WS_VISIBLE | WS_GROUP LTEXT "&Rozmiar bufora", -1, 25, 100, 60, 15 EDITTEXT IDC_EDIT_BUFFER_SIZE, 90, 100, 30, 15, ES_RIGHT | WS_GROUP CONTROL "", IDC_UPDOWN_BUFFER_SIZE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 115, 100, 12, 12 -LTEXT "&Numery buforw:", -1, 25, 120, 80, 15 +LTEXT "&Numery buforów:", -1, 25, 120, 80, 15 EDITTEXT IDC_EDIT_NUM_BUFFER, 90, 120, 30, 15, ES_RIGHT | WS_GROUP CONTROL "", IDC_UPDOWN_NUM_BUFFER, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 115, 120, 12, 12 -CHECKBOX "O&drzu stare duplikaty", IDC_CHECK_DISCARD_DUPLICATES, 25, 140, 100, 15 +CHECKBOX "O&drzuć stare duplikaty", IDC_CHECK_DISCARD_DUPLICATES, 25, 140, 100, 15 GROUPBOX "Edytuj opcje", -1, 140, 90, 100, 70, BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP @@ -41,7 +40,7 @@ STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION CAPTION "Czcionka" FONT 8, "MS Shell Dlg" BEGIN -LTEXT "Okno podgldu", -1, 10, 7, 65, 10 +LTEXT "Okno podglądu", -1, 10, 7, 65, 10 LTEXT "Rozmiar", -1, 130, 10, 30, 10 CONTROL "", IDC_STATIC_FONT_WINDOW_PREVIEW, "Static", SS_OWNERDRAW | SS_SUNKEN, 10, 20, 115, 70 LISTBOX IDC_LBOX_FONTS, 130, 20, 55, 80, LBS_DISABLENOSCROLL | WS_VSCROLL @@ -51,40 +50,40 @@ LISTBOX IDC_LBOX_TYPE, 10, 120, 110, 50, LBS_DISABLENOSCROLL | WS_VSCROLL GROUPBOX "", IDC_GROUPBOX_FONT_NAME, 10, 155, 200, 50 CONTROL "", IDC_STATIC_SELECT_FONT_PREVIEW, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 165, 95, 35 LTEXT "Pogrubiona czcionka:", -1, 130, 165, 75, 10 -LTEXT "szeroko ekranu w pikselach/nwysoko ekranu w pikselach", -1, 140, 180, 65, 20 +LTEXT "szerokość ekranu w pikselach/nwysokość ekranu w pikselach", -1, 140, 180, 65, 20 LTEXT "", IDC_FONT_SIZE_X, 125, 180, 10, 10 LTEXT "", IDC_FONT_SIZE_Y, 125, 188, 10, 10 END IDD_PROPPAGELAYOUT DIALOGEX 0, 0, 250, 220 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION "Ukad" +CAPTION "Układ" FONT 8, "MS Shell Dlg" BEGIN -LTEXT "Okno podgldu", -1, 10, 7, 65, 10 +LTEXT "Okno podglądu", -1, 10, 7, 65, 10 CONTROL "", IDC_STATIC_LAYOUT_WINDOW_PREVIEW, "Static", SS_SUNKEN | SS_OWNERDRAW, 10, 20, 115, 70 GROUPBOX "Rozmiar bufora ekranu", -1, 130, 15, 115, 40 -LTEXT "&Szeroko:", -1, 135, 30, 25, 10 -LTEXT "&Wysoko:", -1, 135, 40, 25, 10 +LTEXT "&Szerokość:", -1, 135, 30, 25, 10 +LTEXT "&Wysokość:", -1, 135, 40, 25, 10 EDITTEXT IDC_EDIT_SCREEN_BUFFER_WIDTH, 165, 30, 35, 10, ES_RIGHT | WS_GROUP CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 185, 30, 30, 10 EDITTEXT IDC_EDIT_SCREEN_BUFFER_HEIGHT, 165, 40, 35, 10, ES_RIGHT | WS_GROUP CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 185, 30, 30, 10 GROUPBOX "Rozmiar okna", -1, 130, 60, 115, 40 -LTEXT "&Szeroko:", -1, 135, 70, 25, 10 -LTEXT "&Wysoko:", -1, 135, 80, 25, 10 +LTEXT "&Szerokość:", -1, 135, 70, 25, 10 +LTEXT "&Wysokość:", -1, 135, 80, 25, 10 EDITTEXT IDC_EDIT_WINDOW_SIZE_WIDTH, 165, 70, 35, 10, ES_RIGHT | WS_GROUP CONTROL "", IDC_UPDOWN_WINDOW_SIZE_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 185, 30, 30, 10 EDITTEXT IDC_EDIT_WINDOW_SIZE_HEIGHT, 165, 80, 35, 10, ES_RIGHT | WS_GROUP CONTROL "", IDC_UPDOWN_WINDOW_SIZE_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 185, 30, 30, 10 GROUPBOX "Pozycja okna", -1, 130, 105, 115, 55 LTEXT "&Lewo:", -1, 135, 120, 25, 10 -LTEXT "&Gra:", -1, 135, 130, 25, 10 +LTEXT "&Góra:", -1, 135, 130, 25, 10 EDITTEXT IDC_EDIT_WINDOW_POS_LEFT, 165, 120, 35, 10, ES_RIGHT | WS_GROUP CONTROL "", IDC_UPDOWN_WINDOW_POS_LEFT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 185, 30, 30, 10 EDITTEXT IDC_EDIT_WINDOW_POS_TOP, 165, 130, 35, 10, ES_RIGHT | WS_GROUP CONTROL "", IDC_UPDOWN_WINDOW_POS_TOP, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 185, 30, 30, 10 -CHECKBOX "Wybr pozycji okna przez system", IDC_CHECK_SYSTEM_POS_WINDOW, 135, 145, 100, 10 +CHECKBOX "Wybór pozycji okna przez system", IDC_CHECK_SYSTEM_POS_WINDOW, 135, 145, 100, 10 END IDD_PROPPAGECOLORS DIALOGEX 0, 0, 250, 220 @@ -93,10 +92,10 @@ CAPTION "Kolory" FONT 8, "MS Shell Dlg" BEGIN CONTROL "Ekran &tekst", IDC_RADIO_SCREEN_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 15, 90, 10 -CONTROL "Ekran &to", IDC_RADIO_SCREEN_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 25, 90, 10 +CONTROL "Ekran &tło", IDC_RADIO_SCREEN_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 25, 90, 10 CONTROL "&Popup tekst", IDC_RADIO_POPUP_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 35, 90, 10 -CONTROL "Pop&up to", IDC_RADIO_POPUP_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 45, 90, 10 -GROUPBOX "Wybrane wartoci koloru", -1, 120, 15, 90, 45 +CONTROL "Pop&up tło", IDC_RADIO_POPUP_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 45, 90, 10 +GROUPBOX "Wybrane wartości koloru", -1, 120, 15, 90, 45 LTEXT "&Czerowny:", -1, 125, 25, 30, 10 EDITTEXT IDC_EDIT_COLOR_RED, 150, 25, 30, 10, ES_RIGHT | WS_GROUP CONTROL "", IDC_UPDOWN_COLOR_RED, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 165, 25, 30, 10 @@ -130,11 +129,11 @@ END IDD_APPLYOPTIONS DIALOGEX 0, 0, 220, 100 STYLE DS_SHELLFONT | WS_POPUP | WS_CAPTION -CAPTION "Zastosuj waciwoci" +CAPTION "Zastosuj właściwości" FONT 8, "MS Shell Dlg" BEGIN -CONTROL "&Zastosuj waciwoci tylko do aktualnego okna", IDC_RADIO_APPLY_CURRENT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 25, 150, 10 -CONTROL "Z&apisz waciwoci na przysze okna z tym sam tytuem", IDC_RADIO_APPLY_ALL, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 40, 185, 10 +CONTROL "&Zastosuj właściwości tylko do aktualnego okna", IDC_RADIO_APPLY_CURRENT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 25, 150, 10 +CONTROL "Z&apisz właściwości na przyszłe okna z tym sam tytułem", IDC_RADIO_APPLY_ALL, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 25, 40, 185, 10 PUSHBUTTON "OK", IDOK, 25, 80, 40, 15, WS_VISIBLE PUSHBUTTON "Anuluj", IDCANCEL, 120, 80, 50, 15, WS_VISIBLE END @@ -142,8 +141,8 @@ END STRINGTABLE BEGIN IDS_CPLNAME "Konsola" - IDS_CPLDESCRIPTION "Konfiguruje waciwoci konsoli." - IDS_APPLY_SHORTCUT_ALL "Zmodyfikuj skrt, ktry wywoa to okno" + IDS_CPLDESCRIPTION "Konfiguruje właściwości konsoli." + IDS_APPLY_SHORTCUT_ALL "Zmodyfikuj skrót, który wywołał to okno" IDS_SCREEN_TEXT "C:\\ReactOS> dir\nSYSTEM 10-01-99 5:00\nSYSTEM32 10-01-99 5:00" - IDS_RASTERFONTS "Raster czcionki" + IDS_RASTERFONTS "Czcionki rastrowe" END diff --git a/dll/cpl/console/lang/ro-RO.rc b/dll/cpl/console/lang/ro-RO.rc index f363838f15d..4e0cd903494 100644 --- a/dll/cpl/console/lang/ro-RO.rc +++ b/dll/cpl/console/lang/ro-RO.rc @@ -10,8 +10,6 @@ LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL -#pragma code_page(65001) - IDD_PROPPAGEOPTIONS DIALOGEX 0, 0, 253, 220 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION CAPTION "Opțiuni" @@ -148,5 +146,3 @@ BEGIN IDS_SCREEN_TEXT "C:\\ReactOS> dir\nSYSTEM 10-01-99 5:00\nSYSTEM32 10-01-99 5:00" IDS_RASTERFONTS "Fonturi raster" END - -#pragma code_page(default) diff --git a/dll/cpl/console/lang/ru-RU.rc b/dll/cpl/console/lang/ru-RU.rc index dfe73e72ec4..8ee4b565b96 100644 --- a/dll/cpl/console/lang/ru-RU.rc +++ b/dll/cpl/console/lang/ru-RU.rc @@ -7,97 +7,97 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT IDD_PROPPAGEOPTIONS DIALOGEX 0, 0, 253, 220 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION "" +CAPTION "Параметры" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ", -1, 7, 7, 120, 70, WS_CHILD | WS_VISIBLE | WS_GROUP - CONTROL "&", IDC_RADIO_SMALL_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 20, 90, 10 - CONTROL "&", IDC_RADIO_MEDIUM_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 40, 90, 10 - CONTROL "&", IDC_RADIO_LARGE_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 60, 90, 10 - GROUPBOX "", -1, 133, 7, 112, 70, WS_CHILD | WS_VISIBLE | WS_GROUP - CONTROL "&", IDC_RADIO_DISPLAY_WINDOW, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 142, 20, 70, 10 - CONTROL "& ", IDC_RADIO_DISPLAY_FULL, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 142, 40, 70, 10 - GROUPBOX " ", -1, 7, 84, 120, 77, WS_CHILD | WS_VISIBLE | WS_GROUP - LTEXT "& :", -1, 14, 101, 60, 12 + GROUPBOX "Размер курсора", -1, 7, 7, 120, 70, WS_CHILD | WS_VISIBLE | WS_GROUP + CONTROL "&Большой", IDC_RADIO_SMALL_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 20, 90, 10 + CONTROL "&Средний", IDC_RADIO_MEDIUM_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 40, 90, 10 + CONTROL "&Маленький", IDC_RADIO_LARGE_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 60, 90, 10 + GROUPBOX "Экран", -1, 133, 7, 112, 70, WS_CHILD | WS_VISIBLE | WS_GROUP + CONTROL "&Окно", IDC_RADIO_DISPLAY_WINDOW, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 142, 20, 70, 10 + CONTROL "&Полный экран", IDC_RADIO_DISPLAY_FULL, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 142, 40, 70, 10 + GROUPBOX "История команд", -1, 7, 84, 120, 77, WS_CHILD | WS_VISIBLE | WS_GROUP + LTEXT "&Размер буфера:", -1, 14, 101, 60, 12 EDITTEXT IDC_EDIT_BUFFER_SIZE, 90, 97, 30, 15, ES_RIGHT | WS_GROUP CONTROL "", IDC_UPDOWN_BUFFER_SIZE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 119, 97, 12, 15 - LTEXT "& :", -1, 14, 124, 60, 12 + LTEXT "&Число буферов:", -1, 14, 124, 60, 12 EDITTEXT IDC_EDIT_NUM_BUFFER, 90, 120, 30, 15, ES_RIGHT | WS_GROUP CONTROL "", IDC_UPDOWN_NUM_BUFFER, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 119, 120, 12, 15 - CHECKBOX "& ", IDC_CHECK_DISCARD_DUPLICATES, 12, 140, 110, 15 - GROUPBOX "", -1, 133, 85, 112, 77, BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP - CHECKBOX "& ", IDC_CHECK_QUICK_EDIT, 140, 97, 102, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP - CHECKBOX "& ", IDC_CHECK_INSERT_MODE, 140, 113, 76, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP + CHECKBOX "&Убирать старые экземляры", IDC_CHECK_DISCARD_DUPLICATES, 12, 140, 110, 15 + GROUPBOX "Редактирование", -1, 133, 85, 112, 77, BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP + CHECKBOX "&Быстрое редактирование", IDC_CHECK_QUICK_EDIT, 140, 97, 102, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP + CHECKBOX "&Режим вставки", IDC_CHECK_INSERT_MODE, 140, 113, 76, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP END IDD_PROPPAGEFONT DIALOGEX 0, 0, 253, 220 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION "" +CAPTION "Шрифт" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " :", -1, 10, 10, 94, 10 - LTEXT ":", -1, 180, 10, 36, 10 + LTEXT "Окно предпросмотра:", -1, 10, 10, 94, 10 + LTEXT "Размер:", -1, 180, 10, 36, 10 CONTROL "", IDC_STATIC_FONT_WINDOW_PREVIEW, "Static", SS_OWNERDRAW | SS_SUNKEN, 10, 20, 163, 74 LISTBOX IDC_LBOX_FONTS, 181, 20, 55, 80, LBS_DISABLENOSCROLL | WS_VSCROLL - LTEXT "&:", -1, 10, 105, 33, 10 - CHECKBOX "&", IDC_CHECK_BOLD_FONTS, 56, 105, 60, 10 + LTEXT "&Шрифт:", -1, 10, 105, 33, 10 + CHECKBOX "&Жирный", IDC_CHECK_BOLD_FONTS, 56, 105, 60, 10 LISTBOX IDC_LBOX_TYPE, 10, 120, 110, 40, LBS_DISABLENOSCROLL | WS_VSCROLL GROUPBOX "", IDC_GROUPBOX_FONT_NAME, 6, 156, 241, 50 CONTROL "", IDC_STATIC_SELECT_FONT_PREVIEW, "Static", SS_OWNERDRAW | SS_SUNKEN, 16, 165, 95, 35 - LTEXT " :", -1, 124, 166, 75, 10 - LTEXT " \n ", -1, 136, 180, 101, 20 + LTEXT "Каждый символ:", -1, 124, 166, 75, 10 + LTEXT "широкие пикселы на экране\nвысокие пикселы на экране", -1, 136, 180, 101, 20 LTEXT "", IDC_FONT_SIZE_X, 120, 180, 10, 10 LTEXT "", IDC_FONT_SIZE_Y, 120, 188, 10, 10 END IDD_PROPPAGELAYOUT DIALOGEX 0, 0, 253, 220 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION "" +CAPTION "Раскладка" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " :", -1, 8, 6, 95, 10 + LTEXT "Окно предпросмотра:", -1, 8, 6, 95, 10 CONTROL "", IDC_STATIC_LAYOUT_WINDOW_PREVIEW, "Static", SS_SUNKEN | SS_OWNERDRAW, 8, 16, 115, 70 - GROUPBOX " ", -1, 130, 12, 115, 50 - LTEXT "&:", -1, 140, 28, 40, 10 - LTEXT "&:", -1, 140, 46, 39, 10 + GROUPBOX "Размер буфера экрана", -1, 130, 12, 115, 50 + LTEXT "&Ширина:", -1, 140, 28, 40, 10 + LTEXT "&Высота:", -1, 140, 46, 39, 10 EDITTEXT IDC_EDIT_SCREEN_BUFFER_WIDTH, 203, 25, 35, 14, ES_RIGHT | WS_GROUP CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 25, 13, 14 EDITTEXT IDC_EDIT_SCREEN_BUFFER_HEIGHT, 203, 42, 35, 14, ES_RIGHT | WS_GROUP CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 42, 13, 14 - GROUPBOX " ", -1, 130, 65, 115, 47 - LTEXT "&:", -1, 140, 78, 39, 10 - LTEXT "&:", -1, 140, 95, 37, 10 + GROUPBOX "Размер окна", -1, 130, 65, 115, 47 + LTEXT "Ш&ирина:", -1, 140, 78, 39, 10 + LTEXT "В&ысота:", -1, 140, 95, 37, 10 EDITTEXT IDC_EDIT_WINDOW_SIZE_WIDTH, 203, 75, 35, 14, ES_RIGHT | WS_GROUP CONTROL "", IDC_UPDOWN_WINDOW_SIZE_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 75, 13, 14 EDITTEXT IDC_EDIT_WINDOW_SIZE_HEIGHT, 203, 92, 35, 14, ES_RIGHT | WS_GROUP CONTROL "", IDC_UPDOWN_WINDOW_SIZE_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 92, 13, 14 - GROUPBOX " ", -1, 130, 116, 115, 64 - LTEXT "&:", -1, 140, 132, 38, 10 - LTEXT "&:", -1, 140, 149, 40, 10 + GROUPBOX "Положение окна", -1, 130, 116, 115, 64 + LTEXT "&Отступ:", -1, 140, 132, 38, 10 + LTEXT "&Высота:", -1, 140, 149, 40, 10 EDITTEXT IDC_EDIT_WINDOW_POS_LEFT, 203, 128, 35, 14, ES_RIGHT | WS_GROUP CONTROL "", IDC_UPDOWN_WINDOW_POS_LEFT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 128, 13, 14 EDITTEXT IDC_EDIT_WINDOW_POS_TOP, 203, 146, 35, 14, ES_RIGHT | WS_GROUP CONTROL "", IDC_UPDOWN_WINDOW_POS_TOP, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 146, 13, 14 - CHECKBOX "& ", IDC_CHECK_SYSTEM_POS_WINDOW, 140, 165, 100, 10 + CHECKBOX "&Системная позиция окна", IDC_CHECK_SYSTEM_POS_WINDOW, 140, 165, 100, 10 END IDD_PROPPAGECOLORS DIALOGEX 0, 0, 253, 220 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION "" +CAPTION "Цвета" FONT 8, "MS Shell Dlg" BEGIN - CONTROL "& ", IDC_RADIO_SCREEN_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 12, 112, 10 - CONTROL "& ", IDC_RADIO_SCREEN_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 30, 112, 10 - CONTROL "& ", IDC_RADIO_POPUP_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 48, 112, 10 - CONTROL "& ", IDC_RADIO_POPUP_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 67, 112, 10 - GROUPBOX " ", -1, 129, 7, 118, 73 - LTEXT "&:", -1, 140, 25, 48, 10 + CONTROL "&Текст на экране", IDC_RADIO_SCREEN_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 12, 112, 10 + CONTROL "&Фон экрана", IDC_RADIO_SCREEN_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 30, 112, 10 + CONTROL "&Всплывающий текст", IDC_RADIO_POPUP_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 48, 112, 10 + CONTROL "В&сплывающий фон", IDC_RADIO_POPUP_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 67, 112, 10 + GROUPBOX "Выбор значений цветов", -1, 129, 7, 118, 73 + LTEXT "&Красный:", -1, 140, 25, 48, 10 EDITTEXT IDC_EDIT_COLOR_RED, 210, 22, 30, 14, ES_RIGHT | WS_GROUP CONTROL "", IDC_UPDOWN_COLOR_RED, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 240, 22, 12, 14 - LTEXT "&:", -1, 140, 42, 48, 10 + LTEXT "&Зеленый:", -1, 140, 42, 48, 10 EDITTEXT IDC_EDIT_COLOR_GREEN, 210, 39, 30, 14, ES_RIGHT | WS_GROUP CONTROL "", IDC_UPDOWN_COLOR_GREEN, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 240, 39, 12, 14 - LTEXT "&:", -1, 140, 60, 48, 10 + LTEXT "&Голубой:", -1, 140, 60, 48, 10 EDITTEXT IDC_EDIT_COLOR_BLUE, 210, 56, 30, 14, ES_RIGHT | WS_GROUP CONTROL "", IDC_UPDOWN_COLOR_BLUE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 240, 56, 12, 14 CONTROL "", IDC_STATIC_COLOR1, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 17, 90, 12, 12 @@ -116,28 +116,28 @@ BEGIN CONTROL "", IDC_STATIC_COLOR14, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 199, 90, 12, 12 CONTROL "", IDC_STATIC_COLOR15, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 213, 90, 12, 12 CONTROL "", IDC_STATIC_COLOR16, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 227, 90, 12, 12 - GROUPBOX " ", -1, 7, 111, 240, 40 + GROUPBOX "Выбранный цвет экрана", -1, 7, 111, 240, 40 CONTROL "", IDC_STATIC_SCREEN_COLOR, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 124, 224, 20 - GROUPBOX " ", -1, 7, 162, 240, 40 + GROUPBOX "Выбранные всплывающие цвета", -1, 7, 162, 240, 40 CONTROL "", IDC_STATIC_POPUP_COLOR, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 176, 224, 20 END IDD_APPLYOPTIONS DIALOGEX 0, 0, 220, 79 STYLE DS_SHELLFONT | WS_POPUP | WS_CAPTION -CAPTION " " +CAPTION "Применить свойства" FONT 8, "MS Shell Dlg" BEGIN - CONTROL "& ", IDC_RADIO_APPLY_CURRENT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 12, 12, 207, 10 - CONTROL "& ", IDC_RADIO_APPLY_ALL, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 12, 31, 207, 10 + CONTROL "&Применить свойства только для этого окна", IDC_RADIO_APPLY_CURRENT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 12, 12, 207, 10 + CONTROL "&Сохранить свойства для всех окон с таким заголовком", IDC_RADIO_APPLY_ALL, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 12, 31, 207, 10 PUSHBUTTON "OK", IDOK, 58, 58, 50, 14, WS_VISIBLE - PUSHBUTTON "", IDCANCEL, 114, 58, 50, 14, WS_VISIBLE + PUSHBUTTON "Отмена", IDCANCEL, 114, 58, 50, 14, WS_VISIBLE END STRINGTABLE BEGIN - IDS_CPLNAME " " - IDS_CPLDESCRIPTION " ." - IDS_APPLY_SHORTCUT_ALL "& , " + IDS_CPLNAME "Командная строка" + IDS_CPLDESCRIPTION "Настройка командной строки." + IDS_APPLY_SHORTCUT_ALL "&Изменить ярлык, которым было запущено это окно" IDS_SCREEN_TEXT "C:\\ReactOS> dir\nSYSTEM 10-01-07 5:00\nSYSTEM32 10-01-07 5:00" - IDS_RASTERFONTS " " + IDS_RASTERFONTS "Растровые шрифты" END diff --git a/dll/cpl/console/lang/uk-UA.rc b/dll/cpl/console/lang/uk-UA.rc index d65ddec2965..09e6d85f62d 100644 --- a/dll/cpl/console/lang/uk-UA.rc +++ b/dll/cpl/console/lang/uk-UA.rc @@ -13,97 +13,97 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT IDD_PROPPAGEOPTIONS DIALOGEX 0, 0, 253, 220 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION "" +CAPTION "Параметри" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ", -1, 7, 7, 120, 70, WS_CHILD | WS_VISIBLE | WS_GROUP - CONTROL "&", IDC_RADIO_SMALL_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 20, 90, 10 - CONTROL "&", IDC_RADIO_MEDIUM_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 40, 90, 10 - CONTROL "&", IDC_RADIO_LARGE_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 60, 90, 10 - GROUPBOX " ", -1, 133, 7, 112, 70, WS_CHILD | WS_VISIBLE | WS_GROUP - CONTROL "&", IDC_RADIO_DISPLAY_WINDOW, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 142, 20, 70, 10 - CONTROL "& ", IDC_RADIO_DISPLAY_FULL, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 142, 40, 70, 10 - GROUPBOX " ", -1, 7, 84, 120, 77, WS_CHILD | WS_VISIBLE | WS_GROUP - LTEXT "& :", -1, 14, 101, 70, 12 + GROUPBOX "Розмір курсору", -1, 7, 7, 120, 70, WS_CHILD | WS_VISIBLE | WS_GROUP + CONTROL "&дрібний", IDC_RADIO_SMALL_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 20, 90, 10 + CONTROL "&середній", IDC_RADIO_MEDIUM_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 40, 90, 10 + CONTROL "&великий", IDC_RADIO_LARGE_CURSOR, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 15, 60, 90, 10 + GROUPBOX "Параметри відображення", -1, 133, 7, 112, 70, WS_CHILD | WS_VISIBLE | WS_GROUP + CONTROL "В&ікно", IDC_RADIO_DISPLAY_WINDOW, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 142, 20, 70, 10 + CONTROL "&На весь екран", IDC_RADIO_DISPLAY_FULL, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 142, 40, 70, 10 + GROUPBOX "Журнал команд", -1, 7, 84, 120, 77, WS_CHILD | WS_VISIBLE | WS_GROUP + LTEXT "&Розмір буфера:", -1, 14, 101, 70, 12 EDITTEXT IDC_EDIT_BUFFER_SIZE, 90, 97, 30, 15, ES_RIGHT | WS_GROUP CONTROL "", IDC_UPDOWN_BUFFER_SIZE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 119, 97, 12, 15 - LTEXT "&ʳ :", -1, 14, 124, 70, 12 + LTEXT "&Кількість буферів:", -1, 14, 124, 70, 12 EDITTEXT IDC_EDIT_NUM_BUFFER, 90, 120, 30, 15, ES_RIGHT | WS_GROUP CONTROL "", IDC_UPDOWN_NUM_BUFFER, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 119, 120, 12, 15 - CHECKBOX "& ", IDC_CHECK_DISCARD_DUPLICATES, 12, 140, 110, 15 - GROUPBOX " ", -1, 133, 85, 112, 77, BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP - CHECKBOX "& ", IDC_CHECK_QUICK_EDIT, 140, 97, 102, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP - CHECKBOX "& ", IDC_CHECK_INSERT_MODE, 140, 113, 76, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP + CHECKBOX "В&ідкидати повторення", IDC_CHECK_DISCARD_DUPLICATES, 12, 140, 110, 15 + GROUPBOX "Параметри редагування", -1, 133, 85, 112, 77, BS_GROUPBOX | WS_CHILD | WS_VISIBLE | WS_GROUP + CHECKBOX "&Швидке редагування", IDC_CHECK_QUICK_EDIT, 140, 97, 102, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP + CHECKBOX "&Режим вставлення", IDC_CHECK_INSERT_MODE, 140, 113, 76, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP END IDD_PROPPAGEFONT DIALOGEX 0, 0, 253, 220 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION "" +CAPTION "Шрифт" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ", -1, 10, 10, 94, 10 + LTEXT "Зразок вікна", -1, 10, 10, 94, 10 LTEXT "Size:", -1, 180, 10, 36, 10 CONTROL "", IDC_STATIC_FONT_WINDOW_PREVIEW, "Static", SS_OWNERDRAW | SS_SUNKEN, 10, 20, 163, 74 LISTBOX IDC_LBOX_FONTS, 181, 20, 55, 80, LBS_DISABLENOSCROLL | WS_VSCROLL - LTEXT "&:", -1, 10, 105, 33, 10 - CHECKBOX "&", IDC_CHECK_BOLD_FONTS, 56, 105, 60, 10 + LTEXT "&Шрифт:", -1, 10, 105, 33, 10 + CHECKBOX "&Жирні", IDC_CHECK_BOLD_FONTS, 56, 105, 60, 10 LISTBOX IDC_LBOX_TYPE, 10, 120, 110, 40, LBS_DISABLENOSCROLL | WS_VSCROLL GROUPBOX "", IDC_GROUPBOX_FONT_NAME, 6, 156, 241, 50 CONTROL "", IDC_STATIC_SELECT_FONT_PREVIEW, "Static", SS_OWNERDRAW | SS_SUNKEN, 16, 165, 95, 35 - LTEXT " :", -1, 124, 166, 75, 10 - LTEXT " \n ", -1, 136, 180, 101, 20 + LTEXT "Кожен символ:", -1, 124, 166, 75, 10 + LTEXT "пікселів завширшки\nпікселів заввишки", -1, 136, 180, 101, 20 LTEXT "", IDC_FONT_SIZE_X, 120, 180, 10, 10 LTEXT "", IDC_FONT_SIZE_Y, 120, 188, 10, 10 END IDD_PROPPAGELAYOUT DIALOGEX 0, 0, 253, 220 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION "" +CAPTION "Розкладка" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ", -1, 8, 6, 95, 10 + LTEXT "Зразок вікна", -1, 8, 6, 95, 10 CONTROL "", IDC_STATIC_LAYOUT_WINDOW_PREVIEW, "Static", SS_SUNKEN | SS_OWNERDRAW, 8, 16, 115, 70 - GROUPBOX " ", -1, 130, 12, 115, 50 - LTEXT "&:", -1, 140, 28, 40, 10 - LTEXT "&:", -1, 140, 46, 39, 10 + GROUPBOX "Розмір буфера екрана", -1, 130, 12, 115, 50 + LTEXT "&Ширина:", -1, 140, 28, 40, 10 + LTEXT "&Висота:", -1, 140, 46, 39, 10 EDITTEXT IDC_EDIT_SCREEN_BUFFER_WIDTH, 203, 25, 35, 14, ES_RIGHT | WS_GROUP CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 25, 13, 14 EDITTEXT IDC_EDIT_SCREEN_BUFFER_HEIGHT, 203, 42, 35, 14, ES_RIGHT | WS_GROUP CONTROL "", IDC_UPDOWN_SCREEN_BUFFER_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 42, 13, 14 - GROUPBOX " ", -1, 130, 65, 115, 47 - LTEXT "&:", -1, 140, 78, 39, 10 - LTEXT "&:", -1, 140, 95, 37, 10 + GROUPBOX "Розмір вікна", -1, 130, 65, 115, 47 + LTEXT "Ши&рина:", -1, 140, 78, 39, 10 + LTEXT "В&исота:", -1, 140, 95, 37, 10 EDITTEXT IDC_EDIT_WINDOW_SIZE_WIDTH, 203, 75, 35, 14, ES_RIGHT | WS_GROUP CONTROL "", IDC_UPDOWN_WINDOW_SIZE_WIDTH, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 75, 13, 14 EDITTEXT IDC_EDIT_WINDOW_SIZE_HEIGHT, 203, 92, 35, 14, ES_RIGHT | WS_GROUP CONTROL "", IDC_UPDOWN_WINDOW_SIZE_HEIGHT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 92, 13, 14 - GROUPBOX " ", -1, 130, 116, 115, 64 - LTEXT "&:", -1, 140, 132, 38, 10 - LTEXT "&:", -1, 140, 149, 40, 10 + GROUPBOX "Позиція вікна", -1, 130, 116, 115, 64 + LTEXT "&Зліва:", -1, 140, 132, 38, 10 + LTEXT "З&гори:", -1, 140, 149, 40, 10 EDITTEXT IDC_EDIT_WINDOW_POS_LEFT, 203, 128, 35, 14, ES_RIGHT | WS_GROUP CONTROL "", IDC_UPDOWN_WINDOW_POS_LEFT, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 128, 13, 14 EDITTEXT IDC_EDIT_WINDOW_POS_TOP, 203, 146, 35, 14, ES_RIGHT | WS_GROUP CONTROL "", IDC_UPDOWN_WINDOW_POS_TOP, UPDOWN_CLASS, UDS_NOTHOUSANDS | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 238, 146, 13, 14 - CHECKBOX "& ", IDC_CHECK_SYSTEM_POS_WINDOW, 137, 165, 104, 10 + CHECKBOX "&Автоматичний вибір", IDC_CHECK_SYSTEM_POS_WINDOW, 137, 165, 104, 10 END IDD_PROPPAGECOLORS DIALOGEX 0, 0, 253, 220 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION "" +CAPTION "Кольори" FONT 8, "MS Shell Dlg" BEGIN - CONTROL "& ", IDC_RADIO_SCREEN_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 12, 112, 10 - CONTROL "& ", IDC_RADIO_SCREEN_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 30, 112, 10 - CONTROL "& ", IDC_RADIO_POPUP_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 48, 112, 10 - CONTROL "& ", IDC_RADIO_POPUP_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 67, 112, 10 - GROUPBOX " ", -1, 129, 7, 118, 73 - LTEXT "&:", -1, 140, 25, 48, 10 + CONTROL "Т&екст на екрані", IDC_RADIO_SCREEN_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 12, 112, 10 + CONTROL "&Тло екрана", IDC_RADIO_SCREEN_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 30, 112, 10 + CONTROL "Те&кст спливного вікна", IDC_RADIO_POPUP_TEXT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 48, 112, 10 + CONTROL "Т&ло спливного вікна", IDC_RADIO_POPUP_BACKGROUND, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 67, 112, 10 + GROUPBOX "Значення вибраних кольорів", -1, 129, 7, 118, 73 + LTEXT "&Червоний:", -1, 140, 25, 48, 10 EDITTEXT IDC_EDIT_COLOR_RED, 210, 22, 30, 14, ES_RIGHT | WS_GROUP CONTROL "", IDC_UPDOWN_COLOR_RED, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 240, 22, 12, 14 - LTEXT "&:", -1, 140, 42, 48, 10 + LTEXT "&Зелений:", -1, 140, 42, 48, 10 EDITTEXT IDC_EDIT_COLOR_GREEN, 210, 39, 30, 14, ES_RIGHT | WS_GROUP CONTROL "", IDC_UPDOWN_COLOR_GREEN, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 240, 39, 12, 14 - LTEXT "&:", -1, 140, 60, 48, 10 + LTEXT "&Синій:", -1, 140, 60, 48, 10 EDITTEXT IDC_EDIT_COLOR_BLUE, 210, 56, 30, 14, ES_RIGHT | WS_GROUP CONTROL "", IDC_UPDOWN_COLOR_BLUE, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 240, 56, 12, 14 CONTROL "", IDC_STATIC_COLOR1, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 17, 90, 12, 12 @@ -122,28 +122,28 @@ BEGIN CONTROL "", IDC_STATIC_COLOR14, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 199, 90, 12, 12 CONTROL "", IDC_STATIC_COLOR15, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 213, 90, 12, 12 CONTROL "", IDC_STATIC_COLOR16, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 227, 90, 12, 12 - GROUPBOX " ", -1, 7, 111, 240, 40 + GROUPBOX "Вибрані кольори екрана", -1, 7, 111, 240, 40 CONTROL "", IDC_STATIC_SCREEN_COLOR, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 124, 224, 20 - GROUPBOX " ", -1, 7, 162, 240, 40 + GROUPBOX "Вибрані спливні кольори", -1, 7, 162, 240, 40 CONTROL "", IDC_STATIC_POPUP_COLOR, "Static", SS_OWNERDRAW | SS_SUNKEN, 15, 176, 224, 20 END IDD_APPLYOPTIONS DIALOGEX 0, 0, 220, 79 STYLE DS_SHELLFONT | WS_POPUP | WS_CAPTION -CAPTION " " +CAPTION "Зміна властивостей" FONT 8, "MS Shell Dlg" BEGIN - CONTROL "& ", IDC_RADIO_APPLY_CURRENT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 12, 12, 207, 10 - CONTROL "& ", IDC_RADIO_APPLY_ALL, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 12, 31, 207, 10 + CONTROL "&Змінити тільки для поточного вікна", IDC_RADIO_APPLY_CURRENT, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 12, 12, 207, 10 + CONTROL "&Зберігти для майбутніх вікон з таким самим заголовком", IDC_RADIO_APPLY_ALL, "Button", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 12, 31, 207, 10 PUSHBUTTON "OK", IDOK, 58, 58, 50, 14, WS_VISIBLE - PUSHBUTTON "", IDCANCEL, 114, 58, 50, 14, WS_VISIBLE + PUSHBUTTON "Скасувати", IDCANCEL, 114, 58, 50, 14, WS_VISIBLE END STRINGTABLE BEGIN - IDS_CPLNAME "" - IDS_CPLDESCRIPTION " ." - IDS_APPLY_SHORTCUT_ALL " &, " + IDS_CPLNAME "Консоль" + IDS_CPLDESCRIPTION "Настроювання властивостей консолі." + IDS_APPLY_SHORTCUT_ALL "Зміна &ярлика, який запустив це вікно" IDS_SCREEN_TEXT "C:\\ReactOS> dir\nSYSTEM 10-01-99 5:00\nSYSTEM32 10-01-99 5:00" - IDS_RASTERFONTS " " + IDS_RASTERFONTS "Растрові шрифти" END diff --git a/dll/cpl/console/rsrc.rc b/dll/cpl/console/rsrc.rc index facd97b3150..0d7e0407690 100644 --- a/dll/cpl/console/rsrc.rc +++ b/dll/cpl/console/rsrc.rc @@ -12,9 +12,12 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL #include "lang/id-ID.rc" #include "lang/it-IT.rc" #include "lang/no-NO.rc" +#include "lang/sk-SK.rc" +#include "lang/zh-CN.rc" + +// UTF-8 +#pragma code_page(65001) #include "lang/pl-PL.rc" #include "lang/ro-RO.rc" #include "lang/ru-RU.rc" -#include "lang/sk-SK.rc" #include "lang/uk-UA.rc" -#include "lang/zh-CN.rc" diff --git a/dll/cpl/cpl.rbuild b/dll/cpl/cpl.rbuild index 95c9c19850e..4f4e896d174 100644 --- a/dll/cpl/cpl.rbuild +++ b/dll/cpl/cpl.rbuild @@ -16,6 +16,9 @@ + + + diff --git a/dll/cpl/desk/CMakeLists.txt b/dll/cpl/desk/CMakeLists.txt index 51909fc6525..fe5c1876b20 100644 --- a/dll/cpl/desk/CMakeLists.txt +++ b/dll/cpl/desk/CMakeLists.txt @@ -1,11 +1,9 @@ +add_definitions(-D_WIN32) + set_unicode() - -add_definitions( - -D_WIN32 - -D_DLL -D__USE_CRTIMP) - set_rc_compiler() + spec2def(desk.cpl desk.spec) add_library(desk SHARED @@ -47,4 +45,5 @@ add_importlibs(desk kernel32 ntdll) +add_pch(desk desk.h) add_cd_file(TARGET desk DESTINATION reactos/system32 FOR all) diff --git a/dll/cpl/desk/advappdlg.c b/dll/cpl/desk/advappdlg.c index 725fe82e584..3742534ee11 100644 --- a/dll/cpl/desk/advappdlg.c +++ b/dll/cpl/desk/advappdlg.c @@ -10,9 +10,6 @@ */ #include "desk.h" -#include "theme.h" -#include "appearance.h" -#include "preview.h" /******************************************************************************/ @@ -276,8 +273,8 @@ SaveCurrentValues(HWND hwndDlg, GLOBALS *g) if (g_Assignment[g->CurrentElement].Font != -1) { g->ThemeAdv.lfFont[g_Assignment[g->CurrentElement].Font].lfHeight = -MulDiv(GetDlgItemInt(hwndDlg, IDC_ADVAPPEARANCE_FONTSIZE_E, &bTranslated, FALSE), GetDeviceCaps(hdcDlg, LOGPIXELSY), 72); - g->ThemeAdv.lfFont[g_Assignment[g->CurrentElement].Font].lfWeight = (SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_FONTBOLD, BM_GETCHECK, 0, 0) == 1)?FW_BOLD:FW_NORMAL; - g->ThemeAdv.lfFont[g_Assignment[g->CurrentElement].Font].lfItalic = SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_FONTITALIC, BM_GETCHECK, 0, 0); + g->ThemeAdv.lfFont[g_Assignment[g->CurrentElement].Font].lfWeight = (SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_FONTBOLD, BM_GETCHECK, 0, 0) == 1) ? FW_BOLD : FW_NORMAL; + g->ThemeAdv.lfFont[g_Assignment[g->CurrentElement].Font].lfItalic = (BYTE)SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_FONTITALIC, BM_GETCHECK, 0, 0); GetDlgItemText(hwndDlg, IDC_ADVAPPEARANCE_FONT_C, g->ThemeAdv.lfFont[g_Assignment[g->CurrentElement].Font].lfFaceName, LF_FACESIZE * sizeof(TCHAR)); } diff --git a/dll/cpl/desk/appearance.c b/dll/cpl/desk/appearance.c index 7670f4c9e00..1711ab0f779 100644 --- a/dll/cpl/desk/appearance.c +++ b/dll/cpl/desk/appearance.c @@ -9,9 +9,6 @@ */ #include "desk.h" -#include "theme.h" -#include "preview.h" -#include "appearance.h" /******************************************************************************/ diff --git a/dll/cpl/desk/desk.c b/dll/cpl/desk/desk.c index bb31e511956..cd229010a19 100644 --- a/dll/cpl/desk/desk.c +++ b/dll/cpl/desk/desk.c @@ -9,7 +9,6 @@ */ #include "desk.h" -#include "preview.h" #define NUM_APPLETS (1) diff --git a/dll/cpl/desk/desk.h b/dll/cpl/desk/desk.h index f1ac24de143..5ed0ed9efd7 100644 --- a/dll/cpl/desk/desk.h +++ b/dll/cpl/desk/desk.h @@ -1,5 +1,3 @@ -#pragma once - #define COBJMACROS #include #include @@ -12,6 +10,13 @@ #include #include #include +#include + +#include "theme.h" +#include "appearance.h" +#include "preview.h" +#include "draw.h" +#include "monslctl.h" #include "resource.h" diff --git a/dll/cpl/desk/desk.rbuild b/dll/cpl/desk/desk.rbuild index fddd10ef8e7..ff9fa1e420d 100644 --- a/dll/cpl/desk/desk.rbuild +++ b/dll/cpl/desk/desk.rbuild @@ -33,4 +33,5 @@ desk.rc draw.c theme.c + desk.h diff --git a/dll/cpl/desk/devsett.c b/dll/cpl/desk/devsett.c index d175d1a9a6d..0bac48b5128 100644 --- a/dll/cpl/desk/devsett.c +++ b/dll/cpl/desk/devsett.c @@ -7,8 +7,6 @@ #include "desk.h" -#include - #define NDEBUG #include diff --git a/dll/cpl/desk/draw.c b/dll/cpl/desk/draw.c index 982ac9c1401..8107b245f15 100644 --- a/dll/cpl/desk/draw.c +++ b/dll/cpl/desk/draw.c @@ -8,8 +8,6 @@ */ #include "desk.h" -#include "theme.h" -#include "draw.h" #define MENU_BAR_ITEMS_SPACE (12) diff --git a/dll/cpl/desk/effappdlg.c b/dll/cpl/desk/effappdlg.c index 910c5d3b395..4e2cfe826d1 100644 --- a/dll/cpl/desk/effappdlg.c +++ b/dll/cpl/desk/effappdlg.c @@ -9,8 +9,6 @@ */ #include "desk.h" -#include "theme.h" -#include "appearance.h" /* Update all the controls with the current values for the selected screen element */ static VOID diff --git a/dll/cpl/desk/lang/pl-PL.rc b/dll/cpl/desk/lang/pl-PL.rc index 367abd95404..c565b20b50b 100644 --- a/dll/cpl/desk/lang/pl-PL.rc +++ b/dll/cpl/desk/lang/pl-PL.rc @@ -1,14 +1,12 @@ /* -* Polish language resource file (Sebastian Gasiorek, 2005-07-07) -* update by xrogers (13.04.2007) -* xxrogers@users.sourceforge.net -* https://sourceforge.net/projects/reactospl -* update by Caemyr - Olaf Siejka (Jan-Feb, 2008) -* Use ReactOS forum PM or IRC to contact me -* http://www.reactos.org -* IRC: irc.freenode.net #reactos-pl; -* update by Saibamen saibamenppl@gmail.com (29.03.2011) -*/ + * translated by Sebastian Gasiorek, (2005-07-07) + * updated by xrogers (13.04.2007) + * https://sourceforge.net/projects/reactospl + * updated by Caemyr - Olaf Siejka (Jan-Feb, 2008) + * updated by Saibamen - Adam Stachowicz (saibamenppl@gmail.com) (August, 2011) + * UTF-8 conversion by Caemyr (May, 2011) + */ + LANGUAGE LANG_POLISH, SUBLANG_DEFAULT IDD_BACKGROUND DIALOGEX DISCARDABLE 0, 0, 246, 188 @@ -21,11 +19,11 @@ BEGIN CONTROL "", IDC_BACKGROUND_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_NOCOLUMNHEADER | LVS_SHAREIMAGELISTS | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 7, 99, 173, 71 - LTEXT "Wybierz obraz do uycia jako tapeta pulpitu:", + LTEXT "Wybierz obraz do użycia jako tapeta pulpitu:", IDC_STATIC, 8, 87, 180, 8 - PUSHBUTTON "&Przegldaj...", IDC_BROWSE_BUTTON, 187, 135, 50, 14 + PUSHBUTTON "&Przeglądaj...", IDC_BROWSE_BUTTON, 187, 135, 50, 14 PUSHBUTTON "&Kolor...", IDC_COLOR_BUTTON, 187, 155, 50, 14 - LTEXT "Pooenie:", IDC_STATIC, 187, 98, 36, 8 + LTEXT "Położenie:", IDC_STATIC, 187, 98, 36, 8 COMBOBOX IDC_PLACEMENT_COMBO, 187, 108, 50, 90, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP END @@ -40,29 +38,29 @@ BEGIN GROUPBOX "&Wygaszacz ekranu",IDC_SCREENS_DUMMY, 8, 92, 230, 52 COMBOBOX IDC_SCREENS_LIST, 14, 103, 100, 100, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP PUSHBUTTON "&Ustawienia",IDC_SCREENS_SETTINGS, 120, 103, 50, 13, WS_GROUP - PUSHBUTTON "&Podgld",IDC_SCREENS_TESTSC, 175, 103, 50, 13 + PUSHBUTTON "&Podgląd",IDC_SCREENS_TESTSC, 175, 103, 50, 13 LTEXT "&Czekaj",IDC_WAITTEXT, 14, 125, 16, 9 EDITTEXT IDC_SCREENS_TIMEDELAY, 34, 123, 32, 13, ES_RIGHT | WS_GROUP CONTROL "",IDC_SCREENS_TIME ,UPDOWN_CLASS,UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 54, 123, 12, 13 LTEXT "minut", IDC_MINTEXT, 70, 125, 26, 9 - CONTROL "Ochrona &hasem.",IDC_SCREENS_USEPASSCHK,"button", + CONTROL "Ochrona &hasłem.",IDC_SCREENS_USEPASSCHK,"button", BS_AUTOCHECKBOX | WS_TABSTOP, 108, 120, 104, 19 GROUPBOX "&Zasilanie monitora", IDC_SCREENS_DUMMY2, 6, 155, 232, 41 - LTEXT "Kliknij przycisk Zasilanie, aby dopasowa ustawienia zasilania dla monitora i oszczdzanie energii.", + LTEXT "Kliknij przycisk Zasilanie, aby dopasować ustawienia zasilania dla monitora i oszczędzanie energii.", IDC_STATIC, 14, 166, 146 ,20 PUSHBUTTON "Z&asilanie...", IDC_SCREENS_POWER_BUTTON, 176, 171, 50, 13 END IDD_APPEARANCE DIALOGEX DISCARDABLE 0, 0, 246, 228 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Wygld" +CAPTION "Wygląd" FONT 8, "MS Shell Dlg" BEGIN CONTROL "", IDC_APPEARANCE_PREVIEW, "PreviewWndClass", WS_VISIBLE | WS_BORDER, 7, 7, 232, 120 - LTEXT "Schemat kolorw", IDC_STATIC, 7, 140, 64, 7 + LTEXT "Schemat kolorów", IDC_STATIC, 7, 140, 64, 7 COMBOBOX IDC_APPEARANCE_COLORSCHEME, 7, 150, 134, 90, CBS_DROPDOWNLIST | CBS_HASSTRINGS | CBS_SORT | WS_VSCROLL | WS_TABSTOP PUSHBUTTON "&Efekty...", IDC_APPEARANCE_EFFECTS, 182, 150, 56, 15 PUSHBUTTON "Zaawansowane", IDC_APPEARANCE_ADVANCED, 182, 170, 56, 15 @@ -71,7 +69,7 @@ END IDD_ADVAPPEARANCE DIALOGEX DISCARDABLE 0, 0, 250, 239 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE -CAPTION "Zaawnsowany wygld" +CAPTION "Ustawienia zaawnsowane" FONT 8, "MS Shell Dlg" BEGIN CONTROL "", IDC_APPEARANCE_PREVIEW, "PreviewWndClass", @@ -112,19 +110,19 @@ EXSTYLE WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE CAPTION "Efekty" FONT 8, "MS Shell Dlg" BEGIN - CONTROL "&Uyj nastpujcego efektu przejcia dla menu i etykiet narzdzi:",IDC_EFFAPPEARANCE_ANIMATION,"button", + CONTROL "&Użyj następującego efektu przejścia dla menu i etykiet narzędzi:",IDC_EFFAPPEARANCE_ANIMATION,"button", BS_AUTOCHECKBOX | WS_TABSTOP, 10, 5, 285, 19 COMBOBOX IDC_EFFAPPEARANCE_ANIMATIONTYPE, 20, 25, 80, 19 , CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_CHILD | WS_VSCROLL | WS_TABSTOP - CONTROL "U&yj nastpujcej metody wygadzania krawdzi czcionek ekranowych:",IDC_EFFAPPEARANCE_SMOOTHING,"button", + CONTROL "Uż&yj następującej metody wygładzania krawędzi czcionek ekranowych:",IDC_EFFAPPEARANCE_SMOOTHING,"button", BS_AUTOCHECKBOX | WS_TABSTOP | WS_DISABLED, 10, 42, 285, 19 COMBOBOX IDC_EFFAPPEARANCE_SMOOTHINGTYPE, 20, 62, 80, 19 , CBS_DROPDOWNLIST | CBS_HASSTRINGS | CBS_SORT | WS_VSCROLL | WS_TABSTOP | WS_DISABLED - CONTROL "Uy&j duych ikon",IDC_EFFAPPEARANCE_LARGEICONS,"button", + CONTROL "Uży&j dużych ikon",IDC_EFFAPPEARANCE_LARGEICONS,"button", BS_AUTOCHECKBOX | WS_TABSTOP | WS_DISABLED, 10, 80, 285, 19 - CONTROL "Pok&a cienie pod menu",IDC_EFFAPPEARANCE_SETDROPSHADOW,"button", + CONTROL "Pok&aż cienie pod menu",IDC_EFFAPPEARANCE_SETDROPSHADOW,"button", BS_AUTOCHECKBOX | WS_TABSTOP | WS_DISABLED, 10, 95, 285, 19 - CONTROL "Poka za&warto okna podczas przecigania",IDC_EFFAPPEARANCE_DRAGFULLWINDOWS,"button", + CONTROL "Pokaż za&wartość okna podczas przeciągania",IDC_EFFAPPEARANCE_DRAGFULLWINDOWS,"button", BS_AUTOCHECKBOX | WS_TABSTOP, 10, 110, 285, 19 - CONTROL "U&kryj podkrelenie liter do nawigacji klawiatur dopki nie nacisn klawisza Alt",IDC_EFFAPPEARANCE_KEYBOARDCUES,"button", + CONTROL "U&kryj podkreślenie liter do nawigacji klawiaturą o ile klawisz Alt nie jest wciśnięty",IDC_EFFAPPEARANCE_KEYBOARDCUES,"button", BS_AUTOCHECKBOX | WS_TABSTOP, 10, 125, 285, 19 PUSHBUTTON "Anuluj", IDCANCEL, 226, 165, 50, 14 DEFPUSHBUTTON "OK", IDOK, 172, 165, 50, 14 @@ -135,17 +133,17 @@ STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION CAPTION "Ustawienia" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Przecignij ikony monitorw tak, by przedstawiay fizyczne rozmieszczenei twoich monitorw.",-1,3,3,240,10 + LTEXT "Przeciągnij ikony monitorów tak, by przedstawiały fizyczne rozmieszczenie twoich monitorów.",-1,3,3,240,10 CONTROL "",IDC_SETTINGS_MONSEL,"MONITORSELWNDCLASS",WS_CHILD|WS_VISIBLE|WS_TABSTOP,3,16,240,82,WS_EX_CLIENTEDGE LTEXT "&Ekran:",1820,3,100,30,8 LTEXT "",IDC_SETTINGS_DEVICE,9,109,224,8 - GROUPBOX "&Rozdzielczo ekranu",1818,3,120,115,43 + GROUPBOX "&Rozdzielczość ekranu",1818,3,120,115,43 CONTROL "",IDC_SETTINGS_RESOLUTION,"msctls_trackbar32", TBS_AUTOTICKS | WS_TABSTOP, 30, 130, 58, 17 LTEXT "Mniej",1815,9,130,15,8,NOT WS_GROUP - LTEXT "Wicej",1816,93,130,21,8,NOT WS_GROUP + LTEXT "Więcej",1816,93,130,21,8,NOT WS_GROUP LTEXT "",IDC_SETTINGS_RESOLUTION_TEXT,10,150,100,10,NOT WS_GROUP | SS_CENTER - GROUPBOX "&Jako kolorw",1817,125,120,115,43 + GROUPBOX "&Ilość kolorów",1817,125,120,115,43 COMBOBOX IDC_SETTINGS_BPP,131,130,103,80,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP CONTROL "",IDC_SETTINGS_SPECTRUM,"Static",SS_OWNERDRAW | SS_SUNKEN,131,148,103,9 @@ -154,15 +152,15 @@ END IDD_ADVANCED_GENERAL DIALOGEX DISCARDABLE 0, 0, 253, 204 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Oglne" +CAPTION "Ogólne" FONT 8, "MS Shell Dlg" BEGIN GROUPBOX "Ekran", -1, 7, 6, 237, 56, WS_GROUP LTEXT "Rozmiar czcionek:", -1, 14, 20, 222, 8 COMBOBOX IDC_FONTSIZE_COMBO, 14, 30, 223, 80, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP LTEXT "", IDC_FONTSIZE_COSTOM, 14, 46, 223, 12 - GROUPBOX "Tryb zgodnoci", -1, 7, 67, 237, 97 - LTEXT "Niektre programy mog dziaa niepoprawnie, jeli po zmianie ustawie ekranu nie zrestartujesz systemu.\r\n\nPo zmianie ustawie ekranu:", -1, 12, 78, 228, 34 + GROUPBOX "Tryb zgodności", -1, 7, 67, 237, 97 + LTEXT "Niektóre programy mogą działać niepoprawnie, jeśli po zmianie ustawień ekranu nie zrestartujesz systemu.\r\n\nPo zmianie ustawień ekranu:", -1, 12, 78, 228, 34 AUTORADIOBUTTON "&Zrestartuj system przed wprowadzeniem zmian.", IDC_RESTART_RB, 14, 116, 224, 10 AUTORADIOBUTTON "Zastosuj nowe ustawienia ekranu bez restartu systemu.", IDC_WITHOUTREBOOT_RB, 14, 131, 224, 10 AUTORADIOBUTTON "Zapytaj mnie przed wprowadzeniem zmian w ustawieniach ekranu.", IDC_ASKME_RB, 14, 146, 224, 10 @@ -171,7 +169,7 @@ END IDR_PREVIEW_MENU MENU BEGIN MENUITEM "Normalny", ID_MENU_NORMAL - MENUITEM "Wyczony", ID_MENU_DISABLED + MENUITEM "Wyłączony", ID_MENU_DISABLED MENUITEM "Wybrany", ID_MENU_SELECTED END @@ -179,18 +177,18 @@ IDM_MONITOR_MENU MENU BEGIN POPUP "" BEGIN - MENUITEM "&Doczony", ID_MENU_ATTACHED - MENUITEM "&Gwny", ID_MENU_PRIMARY + MENUITEM "&Przyłączony", ID_MENU_ATTACHED + MENUITEM "&Główny", ID_MENU_PRIMARY MENUITEM SEPARATOR MENUITEM "&Identyfikuj", ID_MENU_IDENTIFY - MENUITEM "W&aciwoci", ID_MENU_PROPERTIES + MENUITEM "W&łaściwości", ID_MENU_PROPERTIES END END STRINGTABLE DISCARDABLE BEGIN IDS_SLIDEEFFECT "Efekt przewijania" - IDS_FADEEFFECT "Efekt przejcia" + IDS_FADEEFFECT "Efekt przejścia" END STRINGTABLE DISCARDABLE @@ -201,7 +199,7 @@ END STRINGTABLE BEGIN - IDS_MULTIPLEMONITORS "(Kilka Monitorw)" + IDS_MULTIPLEMONITORS "(Kilka Monitorów)" IDS_UNKNOWNMONITOR "(Monitor Nieznany)" IDS_ADVANCEDTITLEFMT "%s i %s" END @@ -209,18 +207,18 @@ END STRINGTABLE BEGIN IDS_CPLNAME "Ekran" - IDS_CPLDESCRIPTION "Dostosowuje wygld pulpitu oraz wygaszacze." + IDS_CPLDESCRIPTION "Dostosowuje wygląd pulpitu oraz wygaszacze." IDS_NONE "(brak)" - IDS_CENTER "Do rodka" - IDS_STRETCH "Rozcignicie" - IDS_TILE "Ssiadujco" + IDS_CENTER "Do środka" + IDS_STRETCH "Rozciągnięcie" + IDS_TILE "Sąsiadująco" END STRINGTABLE DISCARDABLE BEGIN - IDS_COLOR_4BIT "16 kolorw" - IDS_COLOR_8BIT "256 kolorw" - IDS_COLOR_16BIT "High Color (16 Bitw)" + IDS_COLOR_4BIT "16 kolorów" + IDS_COLOR_8BIT "256 kolorów" + IDS_COLOR_16BIT "High Color (16 Bitów)" IDS_COLOR_24BIT "True Color (24 Bity)" IDS_COLOR_32BIT "True Color (32 Bity)" IDS_PIXEL "%lux%lu pikseli" @@ -228,7 +226,7 @@ END STRINGTABLE DISCARDABLE BEGIN - IDS_BACKGROUND_COMDLG_FILTER "Pliki ta (*.bmp;*.dib)\0*.bmp;*.dib\0" + IDS_BACKGROUND_COMDLG_FILTER "Pliki tła (*.bmp;*.dib)\0*.bmp;*.dib\0" IDS_SUPPORTED_EXT "*.bmp;*.dib" END @@ -238,16 +236,16 @@ BEGIN IDS_ACTWIN "Aktywne okno" IDS_WINTEXT "Tekst okna" IDS_MESSBOX "Okno komunikatu" - IDS_MESSTEXT "Tre wiadomoci" + IDS_MESSTEXT "Treść wiadomości" IDS_BUTTEXT "OK" END STRINGTABLE DISCARDABLE BEGIN IDS_ELEMENT_1 "Pulpit" - IDS_ELEMENT_2 "Nieaktywny pasek tytuu" + IDS_ELEMENT_2 "Nieaktywny pasek tytułu" IDS_ELEMENT_3 "Obramowanie nieaktywnego okna" - IDS_ELEMENT_4 "Aktywny pasek tytuu" + IDS_ELEMENT_4 "Aktywny pasek tytułu" IDS_ELEMENT_5 "Obramowanie aktywnego okna" IDS_ELEMENT_6 "Menu" IDS_ELEMENT_7 "Wybrane elementy" @@ -256,21 +254,21 @@ BEGIN IDS_ELEMENT_10 "Obiekty 3D" IDS_ELEMENT_11 "Nazwa palety " IDS_ELEMENT_12 "Etykieta ikony" - IDS_ELEMENT_13 "Belka tytuowa" + IDS_ELEMENT_13 "Belka tytułowa" IDS_ELEMENT_14 "Nieaktywne elementy menu" IDS_ELEMENT_15 "Okno komunikatu" IDS_ELEMENT_16 "Przyciski na pasku przewijania" - IDS_ELEMENT_17 "To aplikacji" - IDS_ELEMENT_18 "Maa belka tytuowa" + IDS_ELEMENT_17 "Tło aplikacji" + IDS_ELEMENT_18 "Mała belka tytułowa" IDS_ELEMENT_19 "Rozmieszczenie ikon (poziome)" IDS_ELEMENT_20 "Rozmieszczenie ikon (pionowe)" - IDS_ELEMENT_21 "Etykieta narzdzia" + IDS_ELEMENT_21 "Etykieta narzędzia" IDS_ELEMENT_22 "Ikona" END STRINGTABLE DISCARDABLE BEGIN IDS_DISPLAY_SETTINGS "Ustawienia ekranu" - IDS_APPLY_FAILED "Nie udao si zastosowa nowych ustawie..." - IDS_APPLY_NEEDS_RESTART "Musisz ponownie uruchomi komputer aby zastosowa zmiany." + IDS_APPLY_FAILED "Nie udało się zastosować nowych ustawień..." + IDS_APPLY_NEEDS_RESTART "Musisz ponownie uruchomić komputer aby zastosować zmiany." END diff --git a/dll/cpl/desk/lang/ro-RO.rc b/dll/cpl/desk/lang/ro-RO.rc index e74329a20f0..887b66a68b2 100644 --- a/dll/cpl/desk/lang/ro-RO.rc +++ b/dll/cpl/desk/lang/ro-RO.rc @@ -1,7 +1,5 @@ LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL -#pragma code_page(65001) - IDD_BACKGROUND DIALOGEX DISCARDABLE 0, 0, 246, 204 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION CAPTION "Fundal" @@ -267,5 +265,3 @@ BEGIN IDS_APPLY_FAILED "Nu s-au putut aplica noile setări." IDS_APPLY_NEEDS_RESTART "Trebuie să reporniți computerul pentru a aplica noile setări." END - -#pragma code_page(default) diff --git a/dll/cpl/desk/lang/ru-RU.rc b/dll/cpl/desk/lang/ru-RU.rc index dad783a73ee..e14ed35071f 100644 --- a/dll/cpl/desk/lang/ru-RU.rc +++ b/dll/cpl/desk/lang/ru-RU.rc @@ -2,7 +2,7 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT IDD_BACKGROUND DIALOGEX DISCARDABLE 0, 0, 246, 205 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Рабочий стол" FONT 8, "MS Shell Dlg" BEGIN CONTROL "", IDC_BACKGROUND_PREVIEW, "Static", SS_OWNERDRAW, @@ -10,256 +10,256 @@ BEGIN CONTROL "", IDC_BACKGROUND_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_NOCOLUMNHEADER | LVS_SHAREIMAGELISTS | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 8, 114, 174, 78 - LTEXT " :", + LTEXT "Выберите изображение для рабочего стола:", IDC_STATIC, 8, 103, 180, 9 - PUSHBUTTON "&...", IDC_BROWSE_BUTTON, 188, 114, 55, 15 - PUSHBUTTON "&...", IDC_COLOR_BUTTON, 188, 167, 55, 15 - LTEXT ":", IDC_STATIC, 188, 138, 55, 9 + PUSHBUTTON "&Обзор...", IDC_BROWSE_BUTTON, 188, 114, 55, 15 + PUSHBUTTON "&Цвет...", IDC_COLOR_BUTTON, 188, 167, 55, 15 + LTEXT "Расположение:", IDC_STATIC, 188, 138, 55, 9 COMBOBOX IDC_PLACEMENT_COMBO, 188, 149, 55, 54, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP END IDD_SCREENSAVER DIALOGEX 0, 0, 246, 204 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Заставка" FONT 8, "MS Shell Dlg", 0, 0 BEGIN CONTROL "", IDC_SCREENS_PREVIEW, "Static", SS_OWNERDRAW, 70, 10, 105, 70, WS_EX_STATICEDGE - GROUPBOX "&",IDC_SCREENS_DUMMY, 7, 92, 231, 52 + GROUPBOX "&Заставка",IDC_SCREENS_DUMMY, 7, 92, 231, 52 COMBOBOX IDC_SCREENS_LIST, 14, 104, 100, 100, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "&",IDC_SCREENS_SETTINGS, 120, 104, 50, 14, WS_GROUP - PUSHBUTTON "&",IDC_SCREENS_TESTSC, 175, 104, 50, 14 - LTEXT "&:",IDC_WAITTEXT, 14, 124, 40, 10 + PUSHBUTTON "&Параметры",IDC_SCREENS_SETTINGS, 120, 104, 50, 14, WS_GROUP + PUSHBUTTON "П&росмотр",IDC_SCREENS_TESTSC, 175, 104, 50, 14 + LTEXT "И&нтервал:",IDC_WAITTEXT, 14, 124, 40, 10 EDITTEXT IDC_SCREENS_TIMEDELAY, 55, 121, 32, 13, ES_RIGHT | WS_GROUP CONTROL "",IDC_SCREENS_TIME ,UPDOWN_CLASS,UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 54, 123, 12, 13 - LTEXT ".", IDC_MINTEXT, 90, 124, 19, 10 - CONTROL "& ",IDC_SCREENS_USEPASSCHK,"button", + LTEXT "мин.", IDC_MINTEXT, 90, 124, 19, 10 + CONTROL "На&чинать с экрана приветствия",IDC_SCREENS_USEPASSCHK,"button", BS_AUTOCHECKBOX | WS_TABSTOP, 110, 124, 124, 12 - GROUPBOX "&", IDC_SCREENS_DUMMY2, 6, 155, 232, 37 - LTEXT " """".", + GROUPBOX "&Энергосбережение", IDC_SCREENS_DUMMY2, 6, 155, 232, 37 + LTEXT "Для изменения параметров питания монитора нажмите кнопку ""Питание"".", IDC_STATIC, 14, 166, 146 ,20 - PUSHBUTTON "&...", IDC_SCREENS_POWER_BUTTON, 171, 168, 55, 14 + PUSHBUTTON "П&итание...", IDC_SCREENS_POWER_BUTTON, 171, 168, 55, 14 END IDD_APPEARANCE DIALOGEX DISCARDABLE 0, 0, 246, 228 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Оформление" FONT 8, "MS Shell Dlg" BEGIN CONTROL "", IDC_APPEARANCE_PREVIEW, "PreviewWndClass", WS_VISIBLE | WS_BORDER, 7, 7, 232, 120 - LTEXT " :", IDC_STATIC, 7, 139, 154, 10 + LTEXT "Цветовая схема:", IDC_STATIC, 7, 139, 154, 10 COMBOBOX IDC_APPEARANCE_COLORSCHEME, 7, 150, 155, 200 , CBS_DROPDOWNLIST | CBS_HASSTRINGS | CBS_SORT | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "&...", IDC_APPEARANCE_EFFECTS, 182, 150, 56, 15 - PUSHBUTTON "", IDC_APPEARANCE_ADVANCED, 168, 170, 70, 14 + PUSHBUTTON "&Эффекты...", IDC_APPEARANCE_EFFECTS, 182, 150, 56, 15 + PUSHBUTTON "Дополнительно", IDC_APPEARANCE_ADVANCED, 168, 170, 70, 14 END IDD_ADVAPPEARANCE DIALOGEX DISCARDABLE 0, 0, 250, 239 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE -CAPTION " " +CAPTION "Дополнительное оформление" FONT 8, "MS Shell Dlg" BEGIN CONTROL "", IDC_APPEARANCE_PREVIEW, "PreviewWndClass", WS_VISIBLE | WS_BORDER, 7, 7, 232, 120 - LTEXT ":", 8, 5, 160, 50, 9 + LTEXT "Элемент:", 8, 5, 160, 50, 9 COMBOBOX IDC_ADVAPPEARANCE_ELEMENT, 5, 170, 130, 200, CBS_DROPDOWNLIST | CBS_HASSTRINGS | CBS_SORT | WS_CHILD | WS_VSCROLL | WS_TABSTOP - LTEXT "&:", IDC_ADVAPPEARANCE_SIZE_T, 142, 160, 39, 9 + LTEXT "&Размер:", IDC_ADVAPPEARANCE_SIZE_T, 142, 160, 39, 9 EDITTEXT IDC_ADVAPPEARANCE_SIZE_E, 142, 170, 38, 13, ES_RIGHT | WS_GROUP CONTROL "", IDC_ADVAPPEARANCE_SIZE_UD, UPDOWN_CLASS, UDS_AUTOBUDDY | WS_BORDER | WS_GROUP | UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_SETBUDDYINT | WS_CHILD | WS_VISIBLE, 172, 170, 10, 13 - LTEXT " &1:", IDC_ADVAPPEARANCE_COLOR1_T, 184, 160, 40, 9 + LTEXT "Цвет &1:", IDC_ADVAPPEARANCE_COLOR1_T, 184, 160, 40, 9 CHECKBOX "-", IDC_ADVAPPEARANCE_COLOR1_B, 184, 170, 28, 13, BS_PUSHLIKE | BS_BITMAP - LTEXT " &2:", IDC_ADVAPPEARANCE_COLOR2_T, 216, 160, 40, 9 + LTEXT "Цвет &2:", IDC_ADVAPPEARANCE_COLOR2_T, 216, 160, 40, 9 CHECKBOX "-", IDC_ADVAPPEARANCE_COLOR2_B, 216, 170, 28, 13, BS_PUSHLIKE | BS_BITMAP - LTEXT ":", IDC_ADVAPPEARANCE_FONT_T, 5, 190, 50, 8 + LTEXT "Шрифт:", IDC_ADVAPPEARANCE_FONT_T, 5, 190, 50, 8 COMBOBOX IDC_ADVAPPEARANCE_FONT_C, 5, 200, 130, 90, CBS_DROPDOWN | CBS_HASSTRINGS | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT ":", IDC_ADVAPPEARANCE_FONTSIZE_T, 142, 190, 39, 8 + LTEXT "Размер:", IDC_ADVAPPEARANCE_FONTSIZE_T, 142, 190, 39, 8 COMBOBOX IDC_ADVAPPEARANCE_FONTSIZE_E, 142, 200, 38, 200, CBS_DROPDOWN | WS_VSCROLL - LTEXT ":", IDC_ADVAPPEARANCE_FONTCOLOR_T, 184, 190, 20, 9 + LTEXT "Цвет:", IDC_ADVAPPEARANCE_FONTCOLOR_T, 184, 190, 20, 9 CHECKBOX "", IDC_ADVAPPEARANCE_FONTCOLOR_B, 184, 200, 28, 13, BS_PUSHLIKE | BS_BITMAP - AUTOCHECKBOX "", IDC_ADVAPPEARANCE_FONTBOLD, 216, 200, 14, 13, BS_PUSHLIKE - AUTOCHECKBOX " ", IDC_ADVAPPEARANCE_FONTITALIC, 230, 200, 14, 13, BS_PUSHLIKE + AUTOCHECKBOX "Ж", IDC_ADVAPPEARANCE_FONTBOLD, 216, 200, 14, 13, BS_PUSHLIKE + AUTOCHECKBOX "К ", IDC_ADVAPPEARANCE_FONTITALIC, 230, 200, 14, 13, BS_PUSHLIKE - PUSHBUTTON "", IDCANCEL, 191, 220, 50, 14 + PUSHBUTTON "Отмена", IDCANCEL, 191, 220, 50, 14 DEFPUSHBUTTON "OK", IDOK, 137, 220, 50, 14 END IDD_EFFAPPEARANCE DIALOGEX DISCARDABLE 0, 0, 285, 185 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE -CAPTION "" +CAPTION "Эффекты" FONT 8, "MS Shell Dlg" BEGIN - CONTROL "& :",IDC_EFFAPPEARANCE_ANIMATION,"button", + CONTROL "&Применять следующий переходный эффект для меню и подсказок:",IDC_EFFAPPEARANCE_ANIMATION,"button", BS_AUTOCHECKBOX | WS_TABSTOP, 10, 5, 285, 19 COMBOBOX IDC_EFFAPPEARANCE_ANIMATIONTYPE, 20, 25, 80, 19 , CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_CHILD | WS_VSCROLL | WS_TABSTOP - CONTROL "& :",IDC_EFFAPPEARANCE_SMOOTHING,"button", + CONTROL "Пр&именять следующий метод сглаживания для экранных шрифтов:",IDC_EFFAPPEARANCE_SMOOTHING,"button", BS_AUTOCHECKBOX | WS_TABSTOP | WS_DISABLED, 10, 42, 285, 19 COMBOBOX IDC_EFFAPPEARANCE_SMOOTHINGTYPE, 20, 62, 80, 19 , CBS_DROPDOWNLIST | CBS_HASSTRINGS | CBS_SORT | WS_VSCROLL | WS_TABSTOP | WS_DISABLED - CONTROL " & ",IDC_EFFAPPEARANCE_LARGEICONS,"button", + CONTROL "Применять &крупные значки",IDC_EFFAPPEARANCE_LARGEICONS,"button", BS_AUTOCHECKBOX | WS_TABSTOP | WS_DISABLED, 10, 80, 285, 19 - CONTROL " &, ",IDC_EFFAPPEARANCE_SETDROPSHADOW,"button", + CONTROL "Отображать &тени, отбрасываемые меню",IDC_EFFAPPEARANCE_SETDROPSHADOW,"button", BS_AUTOCHECKBOX | WS_TABSTOP | WS_DISABLED, 10, 95, 285, 19 - CONTROL "& ",IDC_EFFAPPEARANCE_DRAGFULLWINDOWS,"button", + CONTROL "&Отображать содержимое окна при перетаскивании",IDC_EFFAPPEARANCE_DRAGFULLWINDOWS,"button", BS_AUTOCHECKBOX | WS_TABSTOP, 10, 110, 285, 19 - CONTROL "& ",IDC_EFFAPPEARANCE_KEYBOARDCUES,"button", + CONTROL "Скр&ывать указатели вызова с клавиатуры до нажатия ",IDC_EFFAPPEARANCE_KEYBOARDCUES,"button", BS_AUTOCHECKBOX | WS_TABSTOP, 10, 125, 285, 19 - PUSHBUTTON "", IDCANCEL, 226, 165, 50, 14 + PUSHBUTTON "Отмена", IDCANCEL, 226, 165, 50, 14 DEFPUSHBUTTON "OK", IDOK, 172, 165, 50, 14 END IDD_SETTINGS DIALOGEX DISCARDABLE 0, 0, 249, 197 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Параметры" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " .",-1,3,7,244,17 + LTEXT "Разместите значки мониторов в соответствии с их расположением.",-1,3,7,244,17 CONTROL "",IDC_SETTINGS_MONSEL,"MONITORSELWNDCLASS",WS_CHILD|WS_VISIBLE|WS_TABSTOP,3,21,240,82,WS_EX_CLIENTEDGE - LTEXT "&:",1820,3,105,40,8 - LTEXT "<>",IDC_SETTINGS_DEVICE,9,115,224,8 - GROUPBOX "& ",1818,3,129,119,46 + LTEXT "&Дисплей:",1820,3,105,40,8 + LTEXT "<нет>",IDC_SETTINGS_DEVICE,9,115,224,8 + GROUPBOX "&Разрешение экрана",1818,3,129,119,46 CONTROL "",IDC_SETTINGS_RESOLUTION,"msctls_trackbar32", TBS_AUTOTICKS | WS_TABSTOP,33,141,58,17 - LTEXT ".",1815,12,146,21,8,NOT WS_GROUP - LTEXT ".",1816,94,146,21,8,NOT WS_GROUP + LTEXT "мен.",1815,12,146,21,8,NOT WS_GROUP + LTEXT "бол.",1816,94,146,21,8,NOT WS_GROUP LTEXT "",IDC_SETTINGS_RESOLUTION_TEXT,10,161,105,10,NOT WS_GROUP | SS_CENTER - GROUPBOX "& ",1817,129,129,115,46 + GROUPBOX "&Качество цветопередачи",1817,129,129,115,46 COMBOBOX IDC_SETTINGS_BPP,135,141,103,80,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP CONTROL "",IDC_SETTINGS_SPECTRUM,"Static",SS_OWNERDRAW | SS_SUNKEN,135,161,103,9 - PUSHBUTTON "&",IDC_SETTINGS_ADVANCED,173,182,70,14 + PUSHBUTTON "До&полнительно",IDC_SETTINGS_ADVANCED,173,182,70,14 END IDD_ADVANCED_GENERAL DIALOGEX DISCARDABLE 0, 0, 253, 204 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Общие" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "", -1, 7, 6, 237, 56, WS_GROUP - LTEXT " :", -1, 14, 20, 222, 8 + GROUPBOX "Экран", -1, 7, 6, 237, 56, WS_GROUP + LTEXT "Размер шрифта:", -1, 14, 20, 222, 8 COMBOBOX IDC_FONTSIZE_COMBO, 14, 30, 223, 80, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP LTEXT "", IDC_FONTSIZE_COSTOM, 14, 46, 223, 12 - GROUPBOX "", -1, 7, 67, 237, 97 - LTEXT " , .\r\n\n :", -1, 12, 78, 228, 34 - AUTORADIOBUTTON "& ", IDC_RESTART_RB, 14, 116, 224, 10 - AUTORADIOBUTTON "& ", IDC_WITHOUTREBOOT_RB, 14, 131, 224, 10 - AUTORADIOBUTTON "& ", IDC_ASKME_RB, 14, 146, 224, 10 + GROUPBOX "Совместимость", -1, 7, 67, 237, 97 + LTEXT "Некоторые программы могут работать неправильно, если вы не перезагрузите компьютер после изменения параметров экрана.\r\n\nПосле изменения параметров экрана следует:", -1, 12, 78, 228, 34 + AUTORADIOBUTTON "Пере&загрузить компьютер с новыми параметрами экрана", IDC_RESTART_RB, 14, 116, 224, 10 + AUTORADIOBUTTON "&Применить новые параметры экрана без перезагрузки", IDC_WITHOUTREBOOT_RB, 14, 131, 224, 10 + AUTORADIOBUTTON "З&апросить перед применением новых параметров экрана", IDC_ASKME_RB, 14, 146, 224, 10 END IDR_PREVIEW_MENU MENU BEGIN - MENUITEM "", ID_MENU_NORMAL - MENUITEM "", ID_MENU_DISABLED - MENUITEM "", ID_MENU_SELECTED + MENUITEM "Обычная", ID_MENU_NORMAL + MENUITEM "Отключенная", ID_MENU_DISABLED + MENUITEM "Выбранная", ID_MENU_SELECTED END IDM_MONITOR_MENU MENU BEGIN POPUP "" BEGIN - MENUITEM "&", ID_MENU_ATTACHED - MENUITEM "&", ID_MENU_PRIMARY + MENUITEM "&Присоединенный", ID_MENU_ATTACHED + MENUITEM "&Основной", ID_MENU_PRIMARY MENUITEM SEPARATOR - MENUITEM "&", ID_MENU_IDENTIFY - MENUITEM "&", ID_MENU_PROPERTIES + MENUITEM "Опр&еделение", ID_MENU_IDENTIFY + MENUITEM "Сво&йства", ID_MENU_PROPERTIES END END STRINGTABLE DISCARDABLE BEGIN - IDS_SLIDEEFFECT "" - IDS_FADEEFFECT "" + IDS_SLIDEEFFECT "Развертывание" + IDS_FADEEFFECT "Затемнение" END STRINGTABLE DISCARDABLE BEGIN - IDS_STANDARDEFFECT "" + IDS_STANDARDEFFECT "Обычный" IDS_CLEARTYPEEFFECT "ClearType" END STRINGTABLE BEGIN - IDS_MULTIPLEMONITORS "( )" - IDS_UNKNOWNMONITOR "( )" - IDS_ADVANCEDTITLEFMT "%s %s" + IDS_MULTIPLEMONITORS "(несколько экранов)" + IDS_UNKNOWNMONITOR "(неизвестный экран)" + IDS_ADVANCEDTITLEFMT "%s и %s" END STRINGTABLE BEGIN - IDS_CPLNAME "" - IDS_CPLDESCRIPTION " ." - IDS_NONE "()" - IDS_CENTER " " - IDS_STRETCH "" - IDS_TILE "" + IDS_CPLNAME "Экран" + IDS_CPLDESCRIPTION "Выберите дисплей рабочего стола и заставку." + IDS_NONE "(нет)" + IDS_CENTER "по центру" + IDS_STRETCH "растянуть" + IDS_TILE "замостить" END STRINGTABLE DISCARDABLE BEGIN - IDS_COLOR_4BIT "16 " - IDS_COLOR_8BIT "256 " - IDS_COLOR_16BIT " (16 )" - IDS_COLOR_24BIT " (24 )" - IDS_COLOR_32BIT " (32 )" - IDS_PIXEL "%lux%lu " + IDS_COLOR_4BIT "16 цветов" + IDS_COLOR_8BIT "256 цветов" + IDS_COLOR_16BIT "Среднее (16 бит)" + IDS_COLOR_24BIT "Высокое (24 бита)" + IDS_COLOR_32BIT "Самое высокое (32 бита)" + IDS_PIXEL "%lux%lu точек" END STRINGTABLE DISCARDABLE BEGIN - IDS_BACKGROUND_COMDLG_FILTER " (*.bmp;*.dib)\000*.bmp;*.dib" + IDS_BACKGROUND_COMDLG_FILTER "Изображения (*.bmp;*.dib)\000*.bmp;*.dib" IDS_SUPPORTED_EXT "*.bmp;*.dib" END STRINGTABLE DISCARDABLE BEGIN - IDS_INACTWIN " " - IDS_ACTWIN " " - IDS_WINTEXT " " - IDS_MESSBOX " " - IDS_MESSTEXT "" + IDS_INACTWIN "Неактивное окно" + IDS_ACTWIN "Активное окно" + IDS_WINTEXT "Текст окна" + IDS_MESSBOX "Окно сообщения" + IDS_MESSTEXT "Сообщение" IDS_BUTTEXT "OK" END STRINGTABLE DISCARDABLE BEGIN - IDS_ELEMENT_1 " " - IDS_ELEMENT_2 " " - IDS_ELEMENT_3 " " - IDS_ELEMENT_4 " " - IDS_ELEMENT_5 " " - IDS_ELEMENT_6 "" - IDS_ELEMENT_7 " " - IDS_ELEMENT_8 "" - IDS_ELEMENT_9 " " - IDS_ELEMENT_10 " " - IDS_ELEMENT_11 " " - IDS_ELEMENT_12 " " - IDS_ELEMENT_13 " " - IDS_ELEMENT_14 " " - IDS_ELEMENT_15 "" - IDS_ELEMENT_16 " " - IDS_ELEMENT_17 " " + IDS_ELEMENT_1 "Рабочий стол" + IDS_ELEMENT_2 "Заголовок неактивных окон" + IDS_ELEMENT_3 "Граница неактивных окон" + IDS_ELEMENT_4 "Заголовок активных окон" + IDS_ELEMENT_5 "Граница активных окон" + IDS_ELEMENT_6 "Меню" + IDS_ELEMENT_7 "Выледенные элементы" + IDS_ELEMENT_8 "Окна" + IDS_ELEMENT_9 "Полоса прокрутки" + IDS_ELEMENT_10 "Рельефные объекты" + IDS_ELEMENT_11 "Цвет заголовка" + IDS_ELEMENT_12 "Иконка заголовка" + IDS_ELEMENT_13 "Строка заголовка" + IDS_ELEMENT_14 "Неактивные пункты меню" + IDS_ELEMENT_15 "Диалог" + IDS_ELEMENT_16 "Полосы прокрутки" + IDS_ELEMENT_17 "Рабочая область приложения" IDS_ELEMENT_18 "Small captionbar" - IDS_ELEMENT_19 " (.)" - IDS_ELEMENT_20 " (.)" - IDS_ELEMENT_21 " " - IDS_ELEMENT_22 "" + IDS_ELEMENT_19 "Интервал между значками (гор.)" + IDS_ELEMENT_20 "Интервал между значками (верт.)" + IDS_ELEMENT_21 "Всплывающая подсказка" + IDS_ELEMENT_22 "Значок" END STRINGTABLE DISCARDABLE BEGIN - IDS_DISPLAY_SETTINGS " " - IDS_APPLY_FAILED " ..." - IDS_APPLY_NEEDS_RESTART " ." + IDS_DISPLAY_SETTINGS "Параметры экрана" + IDS_APPLY_FAILED "Не удалось применить новые настройки..." + IDS_APPLY_NEEDS_RESTART "Вы должны перезагрузить компьютер для применения изменений." END diff --git a/dll/cpl/desk/lang/uk-UA.rc b/dll/cpl/desk/lang/uk-UA.rc index 76e91399fd4..03e7c307c91 100644 --- a/dll/cpl/desk/lang/uk-UA.rc +++ b/dll/cpl/desk/lang/uk-UA.rc @@ -10,7 +10,7 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT IDD_BACKGROUND DIALOGEX DISCARDABLE 0, 0, 246, 205 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Робочий стіл" FONT 8, "MS Shell Dlg" BEGIN CONTROL "", IDC_BACKGROUND_PREVIEW, "Static", SS_OWNERDRAW, @@ -18,256 +18,256 @@ BEGIN CONTROL "", IDC_BACKGROUND_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_NOCOLUMNHEADER | LVS_SHAREIMAGELISTS | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 8, 114, 174, 78 - LTEXT " :", + LTEXT "Виберіть зображення для шпалер робочого столу:", IDC_STATIC, 8, 103, 180, 9 - PUSHBUTTON "&...", IDC_BROWSE_BUTTON, 188, 114, 50, 15 - PUSHBUTTON "&...", IDC_COLOR_BUTTON, 188, 177, 50, 15 - LTEXT ":", IDC_STATIC, 188, 138, 51, 9 + PUSHBUTTON "&Огляд...", IDC_BROWSE_BUTTON, 188, 114, 50, 15 + PUSHBUTTON "&Колір...", IDC_COLOR_BUTTON, 188, 177, 50, 15 + LTEXT "Розташування:", IDC_STATIC, 188, 138, 51, 9 COMBOBOX IDC_PLACEMENT_COMBO, 188, 149, 50, 54, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP END IDD_SCREENSAVER DIALOGEX 0, 0, 246, 204 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Заставка" FONT 8, "MS Shell Dlg", 0, 0 BEGIN CONTROL "", IDC_SCREENS_PREVIEW, "Static", SS_OWNERDRAW, 70, 10, 105, 70, WS_EX_STATICEDGE - GROUPBOX "&",IDC_SCREENS_DUMMY, 8, 92, 230, 52 + GROUPBOX "&Заставка",IDC_SCREENS_DUMMY, 8, 92, 230, 52 COMBOBOX IDC_SCREENS_LIST, 14, 103, 100, 100, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "&",IDC_SCREENS_SETTINGS, 120, 103, 50, 13, WS_GROUP - PUSHBUTTON "&",IDC_SCREENS_TESTSC, 175, 103, 50, 13 - LTEXT "&",IDC_WAITTEXT, 14, 125, 30, 9 + PUSHBUTTON "П&араметри",IDC_SCREENS_SETTINGS, 120, 103, 50, 13, WS_GROUP + PUSHBUTTON "&Перегляд",IDC_SCREENS_TESTSC, 175, 103, 50, 13 + LTEXT "&Інтервал",IDC_WAITTEXT, 14, 125, 30, 9 EDITTEXT IDC_SCREENS_TIMEDELAY, 48, 123, 32, 13, ES_RIGHT | WS_GROUP CONTROL "",IDC_SCREENS_TIME ,UPDOWN_CLASS,UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER | WS_GROUP, 54, 123, 12, 13 - LTEXT "", IDC_MINTEXT, 84, 125, 26, 9 - CONTROL "& ",IDC_SCREENS_USEPASSCHK,"button", + LTEXT "хв", IDC_MINTEXT, 84, 125, 26, 9 + CONTROL "За&хист паролем",IDC_SCREENS_USEPASSCHK,"button", BS_AUTOCHECKBOX | WS_TABSTOP, 108, 120, 104, 19 - GROUPBOX "&", IDC_SCREENS_DUMMY2, 6, 155, 232, 41 - LTEXT " , """".", + GROUPBOX "&Енергозбереження", IDC_SCREENS_DUMMY2, 6, 155, 232, 41 + LTEXT "Щоб змінити параметри живлення монітора, натисніть кнопку ""Живлення"".", IDC_STATIC, 14, 166, 146 ,20 - PUSHBUTTON "&...", IDC_SCREENS_POWER_BUTTON, 176, 171, 50, 13 + PUSHBUTTON "&Живлення...", IDC_SCREENS_POWER_BUTTON, 176, 171, 50, 13 END IDD_APPEARANCE DIALOGEX DISCARDABLE 0, 0, 246, 228 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Оформлення" FONT 8, "MS Shell Dlg" BEGIN CONTROL "", IDC_APPEARANCE_PREVIEW, "PreviewWndClass", WS_VISIBLE | WS_BORDER, 7, 7, 232, 120 - LTEXT " ", IDC_STATIC, 7, 140, 64, 7 + LTEXT "Колірна схема", IDC_STATIC, 7, 140, 64, 7 COMBOBOX IDC_APPEARANCE_COLORSCHEME, 7, 150, 134, 90, CBS_DROPDOWNLIST | CBS_HASSTRINGS | CBS_SORT | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "&...", IDC_APPEARANCE_EFFECTS, 182, 150, 56, 15 - PUSHBUTTON "", IDC_APPEARANCE_ADVANCED, 182, 170, 56, 15 + PUSHBUTTON "&Ефекти...", IDC_APPEARANCE_EFFECTS, 182, 150, 56, 15 + PUSHBUTTON "Додатково", IDC_APPEARANCE_ADVANCED, 182, 170, 56, 15 END IDD_ADVAPPEARANCE DIALOGEX DISCARDABLE 0, 0, 250, 239 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE -CAPTION " " +CAPTION "Додаткове оформлення" FONT 8, "MS Shell Dlg" BEGIN CONTROL "", IDC_APPEARANCE_PREVIEW, "PreviewWndClass", WS_VISIBLE | WS_BORDER, 7, 7, 232, 120 - LTEXT ":", 8, 5, 160, 50, 9 + LTEXT "Елемент:", 8, 5, 160, 50, 9 COMBOBOX IDC_ADVAPPEARANCE_ELEMENT, 5, 170, 130, 90, CBS_DROPDOWNLIST | CBS_HASSTRINGS | CBS_SORT | WS_CHILD | WS_VSCROLL | WS_TABSTOP - LTEXT "&", IDC_ADVAPPEARANCE_SIZE_T, 142, 160, 21, 9 + LTEXT "&Розмір", IDC_ADVAPPEARANCE_SIZE_T, 142, 160, 21, 9 EDITTEXT IDC_ADVAPPEARANCE_SIZE_E, 142, 170, 38, 13, ES_RIGHT | WS_GROUP CONTROL "", IDC_ADVAPPEARANCE_SIZE_UD, UPDOWN_CLASS, UDS_AUTOBUDDY | WS_BORDER | WS_GROUP | UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_SETBUDDYINT | WS_CHILD | WS_VISIBLE, 172, 170, 10, 13 - LTEXT " &1:", IDC_ADVAPPEARANCE_COLOR1_T, 184, 160, 40, 9 + LTEXT "Колір &1:", IDC_ADVAPPEARANCE_COLOR1_T, 184, 160, 40, 9 CHECKBOX "-", IDC_ADVAPPEARANCE_COLOR1_B, 184, 170, 28, 13, BS_PUSHLIKE | BS_BITMAP - LTEXT " &2:", IDC_ADVAPPEARANCE_COLOR2_T, 216, 160, 40, 9 + LTEXT "Колір &2:", IDC_ADVAPPEARANCE_COLOR2_T, 216, 160, 40, 9 CHECKBOX "-", IDC_ADVAPPEARANCE_COLOR2_B, 216, 170, 28, 13, BS_PUSHLIKE | BS_BITMAP - LTEXT ":", IDC_ADVAPPEARANCE_FONT_T, 5, 190, 50, 8 + LTEXT "Шрифт:", IDC_ADVAPPEARANCE_FONT_T, 5, 190, 50, 8 COMBOBOX IDC_ADVAPPEARANCE_FONT_C, 5, 200, 130, 90, CBS_DROPDOWN | CBS_HASSTRINGS | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT ":", IDC_ADVAPPEARANCE_FONTSIZE_T, 142, 190, 39, 8 + LTEXT "Розмір:", IDC_ADVAPPEARANCE_FONTSIZE_T, 142, 190, 39, 8 COMBOBOX IDC_ADVAPPEARANCE_FONTSIZE_E, 142, 200, 38, 200, CBS_DROPDOWN | WS_VSCROLL - LTEXT ":", IDC_ADVAPPEARANCE_FONTCOLOR_T, 184, 190, 20, 9 + LTEXT "Колір:", IDC_ADVAPPEARANCE_FONTCOLOR_T, 184, 190, 20, 9 CHECKBOX "", IDC_ADVAPPEARANCE_FONTCOLOR_B, 184, 200, 28, 13, BS_PUSHLIKE | BS_BITMAP - AUTOCHECKBOX "", IDC_ADVAPPEARANCE_FONTBOLD, 216, 200, 14, 13, BS_PUSHLIKE - AUTOCHECKBOX " ", IDC_ADVAPPEARANCE_FONTITALIC, 230, 200, 14, 13, BS_PUSHLIKE + AUTOCHECKBOX "Ж", IDC_ADVAPPEARANCE_FONTBOLD, 216, 200, 14, 13, BS_PUSHLIKE + AUTOCHECKBOX "К ", IDC_ADVAPPEARANCE_FONTITALIC, 230, 200, 14, 13, BS_PUSHLIKE - PUSHBUTTON "", IDCANCEL, 191, 220, 50, 14 + PUSHBUTTON "Скасувати", IDCANCEL, 191, 220, 50, 14 DEFPUSHBUTTON "OK", IDOK, 137, 220, 50, 14 END IDD_EFFAPPEARANCE DIALOGEX DISCARDABLE 0, 0, 285, 185 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE -CAPTION "" +CAPTION "Ефекти" FONT 8, "MS Shell Dlg" BEGIN - CONTROL "& :",IDC_EFFAPPEARANCE_ANIMATION,"button", + CONTROL "&Застосовувати наступний перехідний ефект для меню та підказок:",IDC_EFFAPPEARANCE_ANIMATION,"button", BS_AUTOCHECKBOX | WS_TABSTOP, 10, 5, 285, 19 COMBOBOX IDC_EFFAPPEARANCE_ANIMATIONTYPE, 20, 25, 80, 19 , CBS_DROPDOWNLIST | CBS_HASSTRINGS | WS_CHILD | WS_VSCROLL | WS_TABSTOP - CONTROL "& :",IDC_EFFAPPEARANCE_SMOOTHING,"button", + CONTROL "З&астосовувати наступний метод згладжування для екранних шрифтів:",IDC_EFFAPPEARANCE_SMOOTHING,"button", BS_AUTOCHECKBOX | WS_TABSTOP | WS_DISABLED, 10, 42, 285, 19 COMBOBOX IDC_EFFAPPEARANCE_SMOOTHINGTYPE, 20, 62, 80, 19 , CBS_DROPDOWNLIST | CBS_HASSTRINGS | CBS_SORT | WS_VSCROLL | WS_TABSTOP | WS_DISABLED - CONTROL " & ",IDC_EFFAPPEARANCE_LARGEICONS,"button", + CONTROL "Застосовувати &великі значки",IDC_EFFAPPEARANCE_LARGEICONS,"button", BS_AUTOCHECKBOX | WS_TABSTOP | WS_DISABLED, 10, 80, 285, 19 - CONTROL "³ ",IDC_EFFAPPEARANCE_SETDROPSHADOW,"button", + CONTROL "Відображати тіні від меню",IDC_EFFAPPEARANCE_SETDROPSHADOW,"button", BS_AUTOCHECKBOX | WS_TABSTOP | WS_DISABLED, 10, 95, 285, 19 - CONTROL " & ",IDC_EFFAPPEARANCE_DRAGFULLWINDOWS,"button", + CONTROL "Показати &вміст вікна під час перетягування",IDC_EFFAPPEARANCE_DRAGFULLWINDOWS,"button", BS_AUTOCHECKBOX | WS_TABSTOP, 10, 110, 285, 19 - CONTROL "& ",IDC_EFFAPPEARANCE_KEYBOARDCUES,"button", + CONTROL "&Приховувати покажчики виклику з клавіатури до натиснення ",IDC_EFFAPPEARANCE_KEYBOARDCUES,"button", BS_AUTOCHECKBOX | WS_TABSTOP, 10, 125, 285, 19 - PUSHBUTTON "", IDCANCEL, 226, 165, 50, 14 + PUSHBUTTON "Скасувати", IDCANCEL, 226, 165, 50, 14 DEFPUSHBUTTON "OK", IDOK, 172, 165, 50, 14 END IDD_SETTINGS DIALOGEX DISCARDABLE 0, 0, 246, 188 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Параметри" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " .",-1,3,1,240,16 + LTEXT "Розташуйте значки моніторів відповідно до фактичного розташування моніторів.",-1,3,1,240,16 CONTROL "",IDC_SETTINGS_MONSEL,"MONITORSELWNDCLASS",WS_CHILD|WS_VISIBLE|WS_TABSTOP,3,16,240,82,WS_EX_CLIENTEDGE - LTEXT "&:",1820,3,100,30,8 - LTEXT "<>",IDC_SETTINGS_DEVICE,9,109,224,8 - GROUPBOX "& ",1818,3,120,115,43 + LTEXT "&Дисплей:",1820,3,100,30,8 + LTEXT "<немає>",IDC_SETTINGS_DEVICE,9,109,224,8 + GROUPBOX "&Область екрану",1818,3,120,115,43 CONTROL "",IDC_SETTINGS_RESOLUTION,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP, 30,130,58,17 - LTEXT "",1815,6,130,24,8,NOT WS_GROUP - LTEXT "",1816,90,130,24,8,NOT WS_GROUP + LTEXT "Менше",1815,6,130,24,8,NOT WS_GROUP + LTEXT "Більше",1816,90,130,24,8,NOT WS_GROUP LTEXT "",IDC_SETTINGS_RESOLUTION_TEXT,10,150,100,10, NOT WS_GROUP | SS_CENTER - GROUPBOX "& ",1817,125,120,115,43 + GROUPBOX "&Якість кольоропередачі",1817,125,120,115,43 COMBOBOX IDC_SETTINGS_BPP,131,130,103,80,CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP CONTROL "",IDC_SETTINGS_SPECTRUM,"Static",SS_OWNERDRAW | SS_SUNKEN,131,148,103,9 - PUSHBUTTON "&...",IDC_SETTINGS_ADVANCED,170,165,70,14 + PUSHBUTTON "Дод&атково...",IDC_SETTINGS_ADVANCED,170,165,70,14 END IDD_ADVANCED_GENERAL DIALOGEX DISCARDABLE 0, 0, 253, 204 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Загальні" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "", -1, 7, 6, 237, 56, WS_GROUP - LTEXT " :", -1, 14, 20, 222, 8 + GROUPBOX "Екран", -1, 7, 6, 237, 56, WS_GROUP + LTEXT "Розмір шрифту:", -1, 14, 20, 222, 8 COMBOBOX IDC_FONTSIZE_COMBO, 14, 30, 223, 80, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP LTEXT "", IDC_FONTSIZE_COSTOM, 14, 46, 223, 12 - GROUPBOX "", -1, 7, 67, 237, 97 - LTEXT " , ' .\r\n\nϳ :", -1, 12, 78, 228, 34 - AUTORADIOBUTTON "& ' .", IDC_RESTART_RB, 14, 116, 224, 10 - AUTORADIOBUTTON "& .", IDC_WITHOUTREBOOT_RB, 14, 131, 224, 10 - AUTORADIOBUTTON " .", IDC_ASKME_RB, 14, 146, 224, 10 + GROUPBOX "Сумісність", -1, 7, 67, 237, 97 + LTEXT "Деякі програми працюватимуть неправильно, якщо ви не перезавантажите комп'ютер після зміни параметрів кольору.\r\n\nПісля зміни параметрів кольору слід:", -1, 12, 78, 228, 34 + AUTORADIOBUTTON "&Перезавантажити комп'ютер із новими параметрами кольору.", IDC_RESTART_RB, 14, 116, 224, 10 + AUTORADIOBUTTON "&Застосувати нові параметри кольору без перезавантаження.", IDC_WITHOUTREBOOT_RB, 14, 131, 224, 10 + AUTORADIOBUTTON "Запитати перед застосуванням нових параметрів кольору.", IDC_ASKME_RB, 14, 146, 224, 10 END IDR_PREVIEW_MENU MENU BEGIN - MENUITEM "", ID_MENU_NORMAL - MENUITEM "", ID_MENU_DISABLED - MENUITEM "", ID_MENU_SELECTED + MENUITEM "Звичайне", ID_MENU_NORMAL + MENUITEM "Вимкнене", ID_MENU_DISABLED + MENUITEM "Вибране", ID_MENU_SELECTED END IDM_MONITOR_MENU MENU BEGIN POPUP "" BEGIN - MENUITEM "&", ID_MENU_ATTACHED - MENUITEM "&", ID_MENU_PRIMARY + MENUITEM "&Приєднаний", ID_MENU_ATTACHED + MENUITEM "&Основний", ID_MENU_PRIMARY MENUITEM SEPARATOR - MENUITEM "&", ID_MENU_IDENTIFY - MENUITEM "&", ID_MENU_PROPERTIES + MENUITEM "&Визначення", ID_MENU_IDENTIFY + MENUITEM "В&ластивості", ID_MENU_PROPERTIES END END STRINGTABLE DISCARDABLE BEGIN - IDS_SLIDEEFFECT "" - IDS_FADEEFFECT "" + IDS_SLIDEEFFECT "Розгортання" + IDS_FADEEFFECT "Затемнення" END STRINGTABLE DISCARDABLE BEGIN - IDS_STANDARDEFFECT "" - IDS_CLEARTYPEEFFECT "³ " + IDS_STANDARDEFFECT "Звичайний" + IDS_CLEARTYPEEFFECT "Відкритий тип" END STRINGTABLE BEGIN - IDS_MULTIPLEMONITORS "( )" - IDS_UNKNOWNMONITOR "( )" - IDS_ADVANCEDTITLEFMT "%s %s" + IDS_MULTIPLEMONITORS "(Декілька моніторів)" + IDS_UNKNOWNMONITOR "(Невідомий монітор)" + IDS_ADVANCEDTITLEFMT "%s і %s" END STRINGTABLE BEGIN - IDS_CPLNAME "" - IDS_CPLDESCRIPTION " ." - IDS_NONE "()" - IDS_CENTER " " - IDS_STRETCH "" - IDS_TILE "" + IDS_CPLNAME "Екран" + IDS_CPLDESCRIPTION "Виберіть відображення робочого столу й зберігача екрану." + IDS_NONE "(немає)" + IDS_CENTER "По центру" + IDS_STRETCH "Розтягнути" + IDS_TILE "Плиткою" END STRINGTABLE DISCARDABLE BEGIN - IDS_COLOR_4BIT "16 " - IDS_COLOR_8BIT "256 " - IDS_COLOR_16BIT " (16 )" - IDS_COLOR_24BIT " (24 )" - IDS_COLOR_32BIT " (32 )" - IDS_PIXEL "%lu %lu " + IDS_COLOR_4BIT "16 кольорів" + IDS_COLOR_8BIT "256 кольорів" + IDS_COLOR_16BIT "Середня (16 біт)" + IDS_COLOR_24BIT "Висока (24 біта)" + IDS_COLOR_32BIT "Найвища (32 біта)" + IDS_PIXEL "%lu на %lu крапок" END STRINGTABLE DISCARDABLE BEGIN - IDS_BACKGROUND_COMDLG_FILTER " (*.bmp;*.dib)\0*.bmp;*.dib\0" + IDS_BACKGROUND_COMDLG_FILTER "Малюнки (*.bmp;*.dib)\0*.bmp;*.dib\0" IDS_SUPPORTED_EXT "*.bmp;*.dib" END STRINGTABLE DISCARDABLE BEGIN - IDS_INACTWIN " " - IDS_ACTWIN " " - IDS_WINTEXT " " - IDS_MESSBOX "³ " - IDS_MESSTEXT "" + IDS_INACTWIN "Неактивне вікно" + IDS_ACTWIN "Активне вікно" + IDS_WINTEXT "Текст у вікні" + IDS_MESSBOX "Вікно повідомлення" + IDS_MESSTEXT "Повідомлення" IDS_BUTTEXT "OK" END STRINGTABLE DISCARDABLE BEGIN - IDS_ELEMENT_1 " " - IDS_ELEMENT_2 " " - IDS_ELEMENT_3 " " - IDS_ELEMENT_4 " " - IDS_ELEMENT_5 " " - IDS_ELEMENT_6 "" - IDS_ELEMENT_7 " " - IDS_ELEMENT_8 "³" - IDS_ELEMENT_9 " " - IDS_ELEMENT_10 " '" - IDS_ELEMENT_11 " " - IDS_ELEMENT_12 "ϳ " - IDS_ELEMENT_13 " " - IDS_ELEMENT_14 " " - IDS_ELEMENT_15 "³ " - IDS_ELEMENT_16 " " - IDS_ELEMENT_17 " " - IDS_ELEMENT_18 " " - IDS_ELEMENT_19 " (.)" - IDS_ELEMENT_20 " (.)" - IDS_ELEMENT_21 " " - IDS_ELEMENT_22 "" + IDS_ELEMENT_1 "Робочий стіл" + IDS_ELEMENT_2 "Заголовок неактивних вікон" + IDS_ELEMENT_3 "Межа неактивних вікон" + IDS_ELEMENT_4 "Заголовок активних вікон" + IDS_ELEMENT_5 "Межа активних вікон" + IDS_ELEMENT_6 "Меню" + IDS_ELEMENT_7 "Виділені пункти" + IDS_ELEMENT_8 "Вікна" + IDS_ELEMENT_9 "Смуга прокрутки" + IDS_ELEMENT_10 "Рельєфні об'єкти" + IDS_ELEMENT_11 "Назва панелі" + IDS_ELEMENT_12 "Підпис значка" + IDS_ELEMENT_13 "Кнопки керування вікном" + IDS_ELEMENT_14 "Недоступні пункти меню" + IDS_ELEMENT_15 "Вікно повідомлення" + IDS_ELEMENT_16 "Елементи управління прокрутки" + IDS_ELEMENT_17 "Робоча область додатка" + IDS_ELEMENT_18 "Значок у заголовку" + IDS_ELEMENT_19 "Інтервал між значками (гор.)" + IDS_ELEMENT_20 "Інтервал між значками (верт.)" + IDS_ELEMENT_21 "Виринаюча підказка" + IDS_ELEMENT_22 "Значок" END STRINGTABLE DISCARDABLE BEGIN - IDS_DISPLAY_SETTINGS " " - IDS_APPLY_FAILED " ..." - IDS_APPLY_NEEDS_RESTART " ' ." + IDS_DISPLAY_SETTINGS "Параметри дисплея" + IDS_APPLY_FAILED "Не вдалося застосувати нові параметри..." + IDS_APPLY_NEEDS_RESTART "Ви повинні перезавантажити комп'ютер для застосування змін." END diff --git a/dll/cpl/desk/monslctl.c b/dll/cpl/desk/monslctl.c index 74390fcb717..0a15cf8f231 100644 --- a/dll/cpl/desk/monslctl.c +++ b/dll/cpl/desk/monslctl.c @@ -1,7 +1,5 @@ -#include -#include -#include -#include "monslctl.h" + +#include "desk.h" static const TCHAR szMonitorSelWndClass[] = TEXT("MONITORSELWNDCLASS"); diff --git a/dll/cpl/desk/preview.c b/dll/cpl/desk/preview.c index c6e6a3210b5..09513bb2115 100644 --- a/dll/cpl/desk/preview.c +++ b/dll/cpl/desk/preview.c @@ -7,9 +7,6 @@ */ #include "desk.h" -#include "theme.h" -#include "preview.h" -#include "draw.h" static const TCHAR szPreviewWndClass[] = TEXT("PreviewWndClass"); diff --git a/dll/cpl/desk/rsrc.rc b/dll/cpl/desk/rsrc.rc index c27b561df3c..91b57b7cf09 100644 --- a/dll/cpl/desk/rsrc.rc +++ b/dll/cpl/desk/rsrc.rc @@ -14,10 +14,13 @@ #include "lang/ja-JP.rc" #include "lang/nl-NL.rc" #include "lang/no-NO.rc" +#include "lang/sk-SK.rc" +#include "lang/sv-SE.rc" +#include "lang/zh-CN.rc" + +// UTF-8 +#pragma code_page(65001) #include "lang/pl-PL.rc" #include "lang/ro-RO.rc" #include "lang/ru-RU.rc" -#include "lang/sk-SK.rc" -#include "lang/sv-SE.rc" #include "lang/uk-UA.rc" -#include "lang/zh-CN.rc" diff --git a/dll/cpl/desk/screensaver.c b/dll/cpl/desk/screensaver.c index deeeda6ec73..4908514166a 100644 --- a/dll/cpl/desk/screensaver.c +++ b/dll/cpl/desk/screensaver.c @@ -460,6 +460,7 @@ static VOID SetScreenSaver(HWND hwndDlg, PDATA pData) { HKEY regKey; + BOOL DeleteMode = FALSE; if (RegOpenKeyEx(HKEY_CURRENT_USER, _T("Control Panel\\Desktop"), @@ -486,6 +487,7 @@ SetScreenSaver(HWND hwndDlg, PDATA pData) { /* Windows deletes the value if no screensaver is set */ RegDeleteValue(regKey, _T("SCRNSAVE.EXE")); + DeleteMode = TRUE; } /* set the screensaver time delay */ @@ -506,6 +508,10 @@ SetScreenSaver(HWND hwndDlg, PDATA pData) (PBYTE)szTime, _tcslen(szTime) * sizeof(TCHAR)); + if (DeleteMode) Time = 0; + + SystemParametersInfoW(SPI_SETSCREENSAVETIMEOUT, Time, 0, SPIF_SENDCHANGE); + /* set the secure value */ Ret = SendDlgItemMessage(hwndDlg, IDC_SCREENS_USEPASSCHK, diff --git a/dll/cpl/desk/settings.c b/dll/cpl/desk/settings.c index cc6fb974f88..d9527cf239b 100644 --- a/dll/cpl/desk/settings.c +++ b/dll/cpl/desk/settings.c @@ -9,7 +9,6 @@ */ #include "desk.h" -#include "monslctl.h" typedef struct _DATA { diff --git a/dll/cpl/desk/theme.c b/dll/cpl/desk/theme.c index 821206fab2e..c4e2fe3ebac 100644 --- a/dll/cpl/desk/theme.c +++ b/dll/cpl/desk/theme.c @@ -8,7 +8,6 @@ */ #include "desk.h" -#include "theme.h" static BOOL g_PresetLoaded = FALSE; static INT g_TemplateCount = 0; @@ -24,7 +23,7 @@ static const TCHAR g_SelectedStyle[] = TEXT("SelectedStyle"); THEME_PRESET g_ThemeTemplates[MAX_TEMPLATES]; /* This is the list of names for the colors stored in the registry */ -const TCHAR g_RegColorNames[NUM_COLORS][MAX_COLORNAMELENGTH] = +static const TCHAR *g_RegColorNames[NUM_COLORS] = {TEXT("Scrollbar"), /* 00 = COLOR_SCROLLBAR */ TEXT("Background"), /* 01 = COLOR_DESKTOP */ TEXT("ActiveTitle"), /* 02 = COLOR_ACTIVECAPTION */ @@ -59,11 +58,11 @@ const TCHAR g_RegColorNames[NUM_COLORS][MAX_COLORNAMELENGTH] = }; /* This is the list of used metrics and their numbers */ -const int g_SizeMetric[NUM_SIZES] = +static const int g_SizeMetric[NUM_SIZES] = { SM_CXBORDER, /* 00: SIZE_BORDER_X */ SM_CYBORDER, /* 01: SIZE_BORDER_Y */ - SM_CYCAPTION, /* 02: SIZE_CAPTION_Y */ + SM_CYSIZE, /* 02: SIZE_CAPTION_Y */ SM_CXICON, /* 03: SIZE_ICON_X */ SM_CYICON, /* 04: SIZE_ICON_Y */ SM_CXICONSPACING, /* 05: SIZE_ICON_SPC_X */ @@ -72,7 +71,7 @@ const int g_SizeMetric[NUM_SIZES] = SM_CYMENU, /* 08: SIZE_MENU_Y */ SM_CXVSCROLL, /* 09: SIZE_SCROLL_X */ SM_CYHSCROLL, /* 10: SIZE_SCROLL_Y */ - SM_CYSMCAPTION, /* 11: SIZE_SMCAPTION_Y */ + SM_CYSMSIZE, /* 11: SIZE_SMCAPTION_Y */ SM_CXEDGE, /* 12: SIZE_EDGE_X */ SM_CYEDGE, /* 13: SIZE_EDGE_Y */ SM_CYSIZEFRAME, /* 14: SIZE_FRAME_Y */ @@ -120,8 +119,8 @@ VOID LoadCurrentTheme(THEME* theme) /* FIXME: XP seems to use grayed checkboxes to reflect differences between menu and tooltips settings * Just keep them in sync for now: */ - theme->Effects.bTooltipAnimation = theme->Effects.bMenuAnimation; - theme->Effects.bTooltipFade = theme->Effects.bMenuFade; + theme->Effects.bTooltipAnimation = theme->Effects.bMenuAnimation; + theme->Effects.bTooltipFade = theme->Effects.bMenuFade; /* show content of windows during dragging */ SystemParametersInfo(SPI_GETDRAGFULLWINDOWS, 0, &theme->Effects.bDragFullWindows, 0); @@ -134,10 +133,11 @@ BOOL LoadThemeFromReg(THEME* theme, INT ThemeId) { INT i; TCHAR strSelectedStyle[4]; - TCHAR strSizeName[20] = {TEXT("Sizes\\0")}; + TCHAR strSizeName[20] = TEXT("Sizes\\0"); TCHAR strValueName[10]; HKEY hkNewSchemes, hkScheme, hkSize; DWORD dwType, dwLength; + UINT64 iSize; BOOL Ret = FALSE; if (!g_PresetLoaded) @@ -191,12 +191,14 @@ BOOL LoadThemeFromReg(THEME* theme, INT ThemeId) { wsprintf(strValueName, TEXT("Size #%d"), i); dwLength = sizeof(UINT64); - if (RegQueryValueEx(hkSize, strValueName, NULL, &dwType, (LPBYTE)&theme->Size[i], &dwLength) != ERROR_SUCCESS || + if (RegQueryValueEx(hkSize, strValueName, NULL, &dwType, (LPBYTE)&iSize, &dwLength) != ERROR_SUCCESS || dwType != REG_QWORD || dwLength != sizeof(UINT64)) { /* Failed to read registry value, initialize with current setting for now */ theme->Size[i] = GetSystemMetrics(g_SizeMetric[i]); } + else + theme->Size[i] = (INT)iSize; } RegCloseKey(hkScheme); } @@ -208,18 +210,10 @@ BOOL LoadThemeFromReg(THEME* theme, INT ThemeId) return Ret; } -static VOID -_UpdateUserPref(UINT SpiGet, UINT SpiSet, BOOL *pbFlag) -{ - SystemParametersInfo(SpiSet, 0, (PVOID)pbFlag, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE); -} -#define UPDATE_USERPREF(NAME,pbFlag) _UpdateUserPref(SPI_GET ## NAME, SPI_SET ## NAME, pbFlag) - VOID ApplyTheme(THEME* theme, INT ThemeId) { INT i, Result; HKEY hKey; - DWORD dwDisposition; TCHAR clText[16]; NONCLIENTMETRICS NonClientMetrics; ICONMETRICS IconMetrics; @@ -228,13 +222,7 @@ VOID ApplyTheme(THEME* theme, INT ThemeId) SetSysColors(NUM_COLORS, g_ColorList, theme->crColor); /* Save colors to registry */ - Result = RegOpenKeyEx(HKEY_CURRENT_USER, g_CPColors, 0, KEY_ALL_ACCESS, &hKey); - if (Result != ERROR_SUCCESS) - { - /* Could not open the key, try to create it */ - Result = RegCreateKeyEx(HKEY_CURRENT_USER, g_CPColors, 0, NULL, 0, KEY_ALL_ACCESS, NULL, &hKey, &dwDisposition); - } - + Result = RegCreateKeyEx(HKEY_CURRENT_USER, g_CPColors, 0, NULL, 0, KEY_ALL_ACCESS, NULL, &hKey, NULL); if (Result == ERROR_SUCCESS) { for (i = 0; i < NUM_COLORS; i++) @@ -289,19 +277,19 @@ VOID ApplyTheme(THEME* theme, INT ThemeId) theme->Effects.bTooltipFade = theme->Effects.bMenuFade; SystemParametersInfo(SPI_SETDRAGFULLWINDOWS, theme->Effects.bDragFullWindows, (PVOID)&theme->Effects.bDragFullWindows, SPIF_SENDCHANGE | SPIF_UPDATEINIFILE); SystemParametersInfo(SPI_SETKEYBOARDCUES, 0, IntToPtr(theme->Effects.bKeyboardCues), SPIF_SENDCHANGE | SPIF_UPDATEINIFILE); - //UPDATE_USERPREF(ACTIVEWINDOWTRACKING, &theme->Effects.bActiveWindowTracking); - //UPDATE_USERPREF(MENUANIMATION, &theme->Effects.bMenuAnimation); - //UPDATE_USERPREF(COMBOBOXANIMATION, &theme->Effects.bComboBoxAnimation); - //UPDATE_USERPREF(LISTBOXSMOOTHSCROLLING, &theme->Effects.bListBoxSmoothScrolling); - //UPDATE_USERPREF(GRADIENTCAPTIONS, &theme->Effects.bGradientCaptions); - //UPDATE_USERPREF(ACTIVEWNDTRKZORDER, &theme->Effects.bActiveWndTrkZorder); - //UPDATE_USERPREF(HOTTRACKING, &theme->Effects.bHotTracking); - UPDATE_USERPREF(MENUFADE, &theme->Effects.bMenuFade); - //UPDATE_USERPREF(SELECTIONFADE, &theme->Effects.bSelectionFade); - UPDATE_USERPREF(TOOLTIPANIMATION, &theme->Effects.bTooltipAnimation); - UPDATE_USERPREF(TOOLTIPFADE, &theme->Effects.bTooltipFade); - //UPDATE_USERPREF(CURSORSHADOW, &theme->Effects.bCursorShadow); - //UPDATE_USERPREF(UIEFFECTS, &theme->Effects.bUiEffects); + //SystemParametersInfo(SPI_SETACTIVEWINDOWTRACKING, 0, (PVOID)&theme->Effects.bActiveWindowTracking, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE); + //SystemParametersInfo(SPI_SETMENUANIMATION, 0, (PVOID)&theme->Effects.bMenuAnimation, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE); + //SystemParametersInfo(SPI_SETCOMBOBOXANIMATION, 0, (PVOID)&theme->Effects.bComboBoxAnimation, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE); + //SystemParametersInfo(SPI_SETLISTBOXSMOOTHSCROLLING, 0, (PVOID)&theme->Effects.bListBoxSmoothScrolling, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE); + //SystemParametersInfo(SPI_SETGRADIENTCAPTIONS, 0, (PVOID)&theme->Effects.bGradientCaptions, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE); + //SystemParametersInfo(SPI_SETACTIVEWNDTRKZORDER, 0, (PVOID)&theme->Effects.bActiveWndTrkZorder, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE); + //SystemParametersInfo(SPI_SETHOTTRACKING, 0, (PVOID)&theme->Effects.bHotTracking, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE); + SystemParametersInfo(SPI_SETMENUFADE, 0, (PVOID)&theme->Effects.bMenuFade, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE); + //SystemParametersInfo(SPI_SETSELECTIONFADE, 0, (PVOID)&theme->Effects.bSelectionFade, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE); + SystemParametersInfo(SPI_SETTOOLTIPANIMATION, 0, (PVOID)&theme->Effects.bTooltipAnimation, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE); + SystemParametersInfo(SPI_SETTOOLTIPFADE, 0, (PVOID)&theme->Effects.bTooltipFade, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE); + //SystemParametersInfo(SPI_SETCURSORSHADOW, 0, (PVOID)&theme->Effects.bCursorShadow, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE); + //SystemParametersInfo(SPI_SETUIEFFECTS, 0, (PVOID)&theme->Effects.bUiEffects, SPIF_UPDATEINIFILE|SPIF_SENDCHANGE); /* Save ThemeId */ Result = RegOpenKeyEx(HKEY_CURRENT_USER, g_CPANewSchemes, 0, KEY_ALL_ACCESS, &hKey); diff --git a/dll/cpl/desk/theme.h b/dll/cpl/desk/theme.h index 3641f0794f8..68a7a253da2 100644 --- a/dll/cpl/desk/theme.h +++ b/dll/cpl/desk/theme.h @@ -33,7 +33,6 @@ #define NUM_SIZES 20 #define NUM_COLORS 31 #define MAX_TEMPLATES 50 -#define MAX_COLORNAMELENGTH 30 #define MAX_TEMPLATENAMELENTGH 80 /* Some typedefs for theme */ @@ -64,7 +63,7 @@ typedef struct { COLORREF crColor[NUM_COLORS]; LOGFONT lfFont[NUM_FONTS]; - UINT64 Size[NUM_SIZES]; + INT Size[NUM_SIZES]; BOOL bFlatMenus; EFFECTS Effects; } THEME; @@ -77,8 +76,6 @@ typedef struct TCHAR strLegacyName[MAX_TEMPLATENAMELENTGH]; } THEME_PRESET; -extern const TCHAR g_RegColorNames[NUM_COLORS][MAX_COLORNAMELENGTH]; -extern const INT g_SizeMetric[NUM_SIZES]; extern THEME_PRESET g_ThemeTemplates[MAX_TEMPLATES]; /* prototypes for theme.c */ diff --git a/dll/cpl/hdwwiz/lang/pl-PL.rc b/dll/cpl/hdwwiz/lang/pl-PL.rc index 524f69867f3..9c8c0a25c81 100644 --- a/dll/cpl/hdwwiz/lang/pl-PL.rc +++ b/dll/cpl/hdwwiz/lang/pl-PL.rc @@ -1,27 +1,30 @@ /* -* translated by niski -* bjauy@o2.pl -* https://sourceforge.net/projects/reactospl -*/ + * translated by niski + * bjauy@o2.pl + * https://sourceforge.net/projects/reactospl + * UTF-8 conversion by Caemyr (May, 2011) + * updated by Saibamen - Adam Stachowicz (saibamenppl@gmail.com) (August, 2011) + */ + LANGUAGE LANG_POLISH, SUBLANG_DEFAULT IDD_STARTPAGE DIALOG DISCARDABLE 0, 0, 317, 186 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "Kreator dodawania sprztu" +CAPTION "Kreator dodawania sprzętu" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Witamy w Kreatorze dodawania sprztu", IDC_FINISHTITLE, 114, 8, 203, 24 - LTEXT "Ten kreator pomoe Ci:", -1, 114, 40, 182, 8 - LTEXT "1) Zainstalowa oprogramowanie do obsugi urzdzenia dodanego do Twojego komputera.", -1, 121, 56, 184, 16 - LTEXT "2) Rozwiza problemy sprztowe.", -1, 121, 78, 185, 16 + LTEXT "Witamy w Kreatorze dodawania sprzętu", IDC_FINISHTITLE, 114, 8, 203, 24 + LTEXT "Ten kreator pomoże Ci:", -1, 114, 40, 182, 8 + LTEXT "1) Zainstalować oprogramowanie do obsługi urządzenia dodanego do Twojego komputera.", -1, 121, 56, 184, 16 + LTEXT "2) Rozwiązać problemy sprzętowe.", -1, 121, 78, 185, 16 ICON IDI_WARNINGICON, IDC_WARNINGICON, 124, 109, 20, 20 - LTEXT "Jeli do urzdzenia doczona zostaa instalacyjna pyta CD, zaleca si kliknicie przycisku Anuluj w celu zamknicia tego kreatora i uycie pyty CD producenta do zainstalowania tego urzdzenia.", 503, 150, 106, 155, 50 - LTEXT "Aby kontynuowa, kliknij Dalej.", -1, 114, 166, 193, 8 + LTEXT "Jeśli do urządzenia dołączony został nośnik z oprogramowaniem producenta, zaleca się kliknięcie przycisku Anuluj w celu zamknięcia tego kreatora i użycie oprogramowania producenta do zainstalowania tego urządzenia.", 503, 150, 106, 155, 50 + LTEXT "Aby kontynuować, kliknij Dalej.", -1, 114, 166, 193, 8 END IDD_SEARCHPAGE DIALOG DISCARDABLE 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "Kreator dodawania sprztu" +CAPTION "Kreator dodawania sprzętu" FONT 8, "MS Shell Dlg" BEGIN LTEXT "", IDC_STATUSTEXT, 21, 8, 275, 32 @@ -30,63 +33,63 @@ END IDD_ISCONNECTEDPAGE DIALOG DISCARDABLE 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "Kreator dodawania sprztu" +CAPTION "Kreator dodawania sprzętu" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Czy urzdzenie zostao ju podczone do komputera?", -1, 20, 11, 275, 8 - AUTORADIOBUTTON "&Tak, urzdzenie zostao ju podczone", IDC_CONNECTED, 29, 23, 266, 8, WS_GROUP - AUTORADIOBUTTON "&Nie, urzdzenie nie zostao jeszcze podczone", IDC_NOTCONNECTED, 29, 35, 266, 8 + LTEXT "Czy urządzenie zostało już podłączone do komputera?", -1, 20, 11, 275, 8 + AUTORADIOBUTTON "&Tak, urządzenie zostało już podłaczone", IDC_CONNECTED, 29, 23, 266, 8, WS_GROUP + AUTORADIOBUTTON "&Nie, urządzenie nie zostało jeszcze podłączone", IDC_NOTCONNECTED, 29, 35, 266, 8 END IDD_PROBELISTPAGE DIALOG DISCARDABLE 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "Kreator dodawania sprztu" +CAPTION "Kreator dodawania sprzętu" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Wybierz z poniszej listy zainstalowane urzdzenie, nastpnie kliknij Dalej, aby sprawdzi jego waciwoci lub rozwiza ewentualny problem.", -1, 21, 8, 275, 22 - LTEXT "Aby doda urzdzenie, ktrego nie ma na licie, kliknij przycisk ""Dodaj nowe urzdzenie""", -1, 21, 32, 275, 24 - LTEXT "&Zainstalowane urzdzenia:", -1, 21, 62, 140, 8 + LTEXT "Wybierz z poniższej listy zainstalowane urządzenie, następnie kliknij Dalej, aby sprawdzić jego właściwości lub rozwiązać ewentualny problem.", -1, 21, 8, 275, 22 + LTEXT "Aby dodać urządzenie, którego nie ma na liście, kliknij przycisk ""Dodaj nowe urządzenie""", -1, 21, 32, 275, 24 + LTEXT "&Zainstalowane urządzenia:", -1, 21, 62, 140, 8 CONTROL "", IDC_PROBELIST, "SysListView32", WS_BORDER | WS_GROUP | WS_TABSTOP | LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHAREIMAGELISTS | LVS_NOCOLUMNHEADER, 21, 72, 275, 66 END IDD_SELECTWAYPAGE DIALOG DISCARDABLE 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "Kreator dodawania sprztu" +CAPTION "Kreator dodawania sprzętu" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Kreator moe wyszuka inne urzdzenie i zainstalowa je automatycznie. Moesz take wybra urzdzenie z listy, jeli wiesz dokadnie, jaki model urzdzenia chcesz zainstalowa.", -1, 21, 8, 280, 24 - LTEXT "Co chcesz, aby zrobi kreator?", -1, 23, 40, 275, 8 - AUTORADIOBUTTON "Wy&szukaj i zainstaluj nowe urzdzenie automatycznie (zalecane)", IDC_AUTOINSTALL, 30, 55, 266, 8, WS_GROUP | NOT WS_TABSTOP - AUTORADIOBUTTON "&Zainstaluj urzdzenie, ktre wybior rcznie z listy (zaawansowane)", IDC_MANUALLYINST, 30, 70, 266, 8, NOT WS_TABSTOP + LTEXT "Kreator może wyszukać inne urządzenie i zainstalować je automatycznie. Możesz także wybrać urządzenie z listy, jeśli wiesz dokładnie, jaki model urządzenia chcesz zainstalować.", -1, 21, 8, 280, 24 + LTEXT "Co chcesz, aby zrobił kreator?", -1, 23, 40, 275, 8 + AUTORADIOBUTTON "Wy&szukaj i zainstaluj nowe urządzenie automatycznie (zalecane)", IDC_AUTOINSTALL, 30, 55, 266, 8, WS_GROUP | NOT WS_TABSTOP + AUTORADIOBUTTON "&Zainstaluj urządzenie, które wybiorę ręcznie z listy (zaawansowane)", IDC_MANUALLYINST, 30, 70, 266, 8, NOT WS_TABSTOP END IDD_DETECTEDHWPAGE DIALOG DISCARDABLE 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "Kreator dodawania sprztu" +CAPTION "Kreator dodawania sprzętu" FONT 8, "MS Shell Dlg" BEGIN LTEXT "", IDC_STATUSTEXT, 21, 9, 275, 40 - LTEXT "Wykryte urzdzenia:", IDC_DETECTEDHWTEXT, 21, 53, 176, 8 + LTEXT "Wykryte urządzenia:", IDC_DETECTEDHWTEXT, 21, 53, 176, 8 CONTROL "", IDC_DETECTEDHWLIST, "SysListView32", WS_BORDER | WS_GROUP | WS_TABSTOP | LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHAREIMAGELISTS | LVS_NOCOLUMNHEADER, 21, 65, 275, 70 END IDD_HWTYPESPAGE DIALOG DISCARDABLE 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "Kreator dodawania sprztu" +CAPTION "Kreator dodawania sprzętu" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Jeli nie widzisz odpowiedniej kategorii urzdze kliknij przycisk Poka wszystkie urzdzenia.", IDC_STATUSTEXT, 21, 9, 275, 18 - LTEXT "&Popularne typy urzdze:", IDC_HWTYPESTEXT, 21, 31, 180, 8 + LTEXT "Jeśli nie widzisz odpowiedniej kategorii urządzenia kliknij przycisk Pokaż wszystkie urządzenia.", IDC_STATUSTEXT, 21, 9, 275, 18 + LTEXT "&Popularne typy urządzeń:", IDC_HWTYPESTEXT, 21, 31, 180, 8 CONTROL "", IDC_HWTYPESLIST, "SysListView32", WS_BORDER | WS_GROUP | WS_TABSTOP | LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHAREIMAGELISTS | LVS_NOCOLUMNHEADER, 21, 42, 275, 92 END IDD_PROGRESSPAGE DIALOG DISCARDABLE 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "Kreator dodawania sprztu" +CAPTION "Kreator dodawania sprzętu" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Wyszukiwanie nowych urzdze moe zaj kilka minut.", -1, 21, 8, 275, 15 - LTEXT "Postp cakowity:", IDC_TPROGRESSTEXT, 21, 25, 275, 8 + LTEXT "Wyszukiwanie nowych urządzeń może zająć kilka minut.", -1, 21, 8, 275, 15 + LTEXT "Postęp całkowity:", IDC_TPROGRESSTEXT, 21, 25, 275, 8 CONTROL "", IDC_TPROGRESSBAR, "msctls_progress32", 0, 21, 37, 275, 14 LTEXT "", IDC_PROGRESSTEXT, 58, 58, 200, 8, SS_NOPREFIX CONTROL "", IDC_PROGRESSBAR, "msctls_progress32", 0, 58, 70, 200, 8 @@ -94,59 +97,59 @@ END IDD_FINISHPAGE DIALOG DISCARDABLE 0, 0, 317, 186 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "Kreator dodawania sprztu" +CAPTION "Kreator dodawania sprzętu" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Koczenie pracy Kreatora dodawania sprztu", IDC_FINISHTITLE, 114, 8, 203, 24 - LTEXT "Pomylnie zakoczono prac Kreatora dodawania sprztu.", -1, 114, 32, 193, 19 + LTEXT "Kończenie pracy Kreatora dodawania sprzętu", IDC_FINISHTITLE, 114, 8, 203, 24 + LTEXT "Pomyślnie zakończono pracę Kreatora dodawania sprzętu.", -1, 114, 32, 193, 19 LTEXT "", IDC_STATUSTEXT, 114, 70, 193, 92 - LTEXT "Aby zamkn kreatora, kliknij Zakocz", -1, 114, 166, 132, 8 + LTEXT "Aby zamknąć kreatora, kliknij Zakończ", -1, 114, 166, 132, 8 END IDD_ISFOUNDPAGE DIALOG DISCARDABLE 0, 0, 317, 186 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "Kreator dodawania sprztu" +CAPTION "Kreator dodawania sprzętu" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Koczenie pracy Kreatora dodawania sprztu", IDC_FINISHTITLE, 114, 8, 203, 24 - LTEXT "Kreator znalaz nastpujce urzdzenia podczone do tego komputera:", -1, 114, 32, 193, 19 - LTEXT "Aby zamkn kreatora, kliknij Zakocz", -1, 114, 166, 132, 8 + LTEXT "Kończenie pracy Kreatora dodawania sprzętu", IDC_FINISHTITLE, 114, 8, 203, 24 + LTEXT "Kreator znalazł następujące urządzenia podłączone do tego komputera:", -1, 114, 32, 193, 19 + LTEXT "Aby zamknąć kreatora, kliknij Zakończ", -1, 114, 166, 132, 8 CONTROL "", IDC_FOUNDHARDWARELIST, "SysListView32", WS_BORDER | WS_GROUP | WS_TABSTOP | LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHAREIMAGELISTS, 114, 56, 193, 78 END IDD_HWSTATUSPAGE DIALOG DISCARDABLE 0, 0, 317, 186 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "Kreator dodawania sprztu" +CAPTION "Kreator dodawania sprzętu" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Koczenie pracy Kreatora dodawania sprztu", IDC_FINISHTITLE, 114, 8, 195, 28 - LTEXT "Oto aktualny stan wybranego urzdzenia:", -1, 114, 40, 193, 19 + LTEXT "Kończenie pracy Kreatora dodawania sprzętu", IDC_FINISHTITLE, 114, 8, 195, 28 + LTEXT "Oto aktualny stan wybranego urządzenia:", -1, 114, 40, 193, 19 EDITTEXT IDC_HWSTATUSEDIT, 114, 60, 193, 70, ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL | NOT WS_TABSTOP - LTEXT "Aby uruchomi modu rozwizywania problemw, ktry moe pomc Ci rozwiza ewentualne problemy z urzdzeniem, kliknij Zakocz.", -1, 114, 136, 193, 16 - LTEXT "Aby zamkn kreatora, kliknij przycisk Anuluj", IDC_STATUSTEXT, 114, 166, 132, 8 + LTEXT "Aby uruchomić moduł rozwiązywania problemów, który może pomóc Ci rozwiązać ewentualne problemy z urządzeniem, kliknij Zakończ.", -1, 114, 136, 193, 25 + LTEXT "Aby zamknąć kreator, kliknij przycisk Anuluj", IDC_STATUSTEXT, 114, 166, 138, 8 END IDD_NOTCONNECTEDPAGE DIALOG DISCARDABLE 0, 0, 317, 186 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "Kreator dodawania sprztu" +CAPTION "Kreator dodawania sprzętu" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Nie mona kontynuowa pracy Kreatora dodawania sprztu", IDC_FINISHTITLE, 114, 8, 203, 28 - LTEXT "Aby kontynuowa, podcz nowe urzdzenie do komputera.", -1, 114, 40, 193, 16 - AUTOCHECKBOX "&Wycz komputer po klikniciu przycisku Zakocz, aby mona byo otworzy komputer i podczy urzdzenie.", IDC_TURNOFFCHECKBOX, 114, 64, 203, 20, BS_TOP | BS_MULTILINE - LTEXT "W wikszoci przypadkw ReactOS automatycznie zainstaluje urzdzenie po jego podczeniu. Jeli ReactOS nie odnajdzie urzdzenia, uruchom ponownie tego kreatora w celu zainstalowania oprogramowania do obsugi urzdzenia.", -1, 114, 98, 193, 32 - LTEXT "Aby zamkn kreatora, kliknij Zakocz.", IDC_STATUSTEXT, 114, 166, 193, 8 + LTEXT "Nie można kontynuować pracy Kreatora dodawania sprzętu", IDC_FINISHTITLE, 114, 8, 203, 28 + LTEXT "Aby kontynuować, podłącz nowe urządzenie do komputera.", -1, 114, 40, 193, 16 + AUTOCHECKBOX "&Wyłącz komputer po kliknięciu przycisku Zakończ, aby można było otworzyć komputer i podłączyć urządzenie.", IDC_TURNOFFCHECKBOX, 114, 64, 203, 20, BS_TOP | BS_MULTILINE + LTEXT "W większości przypadków ReactOS automatycznie zainstaluje urządzenie po jego podłączeniu. Jeśli ReactOS nie odnajdzie urządzenia, uruchom ponownie ten kreator w celu zainstalowania oprogramowania do obsługi urządzenia.", -1, 114, 98, 193, 32 + LTEXT "Aby zamknąć kreatora, kliknij Zakończ.", IDC_STATUSTEXT, 114, 166, 193, 8 END STRINGTABLE BEGIN - IDS_CPLNAME "Dodaj sprzt" - IDS_CPLDESCRIPTION "Dodaje sprzt do Twojego komputera." + IDS_CPLNAME "Dodaj sprzęt" + IDS_CPLDESCRIPTION "Dodaje sprzęt do Twojego komputera." IDS_SEARCHTITLE "Czekaj, kreator przeprowadza wyszukiwanie..." - IDS_SEARCHTEXT "Ten kreator wyszukuje urzdzenia, ktre zostay ostatnio podczone do tego komputera, ale jeszcze nie zostay zainstalowane." - IDS_ISCONNECTED "Czy urzdzenie zostao ju podczone do komputera?" - IDS_PROBELISTTITLE "Ponisze urzdzenia s ju zainstalowane na tym komputerze" - IDS_ADDNEWDEVICE "Dodaj nowe urzdzenie sprztowe" - IDS_SELECTWAYTITLE "Kreator moe pomc Tobie zainstalowa inne urzdzenie" - IDS_HDTYPESTITLE "Wybierz z poniszej listy typ urzdzenia, ktre chcesz zainstalowa" + IDS_SEARCHTEXT "Ten kreator wyszukuje urządzenia, które zostały ostatnio podłączone do tego komputera, ale jeszcze nie zostały zainstalowane." + IDS_ISCONNECTED "Czy urządzenie zostało już podłączone do komputera?" + IDS_PROBELISTTITLE "Poniższe urządzenia są już zainstalowane na tym komputerze" + IDS_ADDNEWDEVICE "Dodaj nowe urządzenie sprzętowe" + IDS_SELECTWAYTITLE "Kreator może pomóc Tobie zainstalować inne urządzenie" + IDS_HDTYPESTITLE "Wybierz z poniższej listy typ urządzenia, które chcesz zainstalować" END diff --git a/dll/cpl/hdwwiz/lang/ro-RO.rc b/dll/cpl/hdwwiz/lang/ro-RO.rc index 341abd7de54..7248988f99d 100644 --- a/dll/cpl/hdwwiz/lang/ro-RO.rc +++ b/dll/cpl/hdwwiz/lang/ro-RO.rc @@ -1,7 +1,5 @@ LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL -#pragma code_page(65001) - IDD_STARTPAGE DIALOG DISCARDABLE 0, 0, 317, 186 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Expertul de adăugare hardware" @@ -147,5 +145,3 @@ BEGIN IDS_SELECTWAYTITLE "Acest Expert vă poate ajuta să instalați alt hardware" IDS_HDTYPESTITLE "Din lista de mai jos, alegeți dispozitivul pe care vreți să îl instalați." END - -#pragma code_page(default) diff --git a/dll/cpl/hdwwiz/lang/ru-RU.rc b/dll/cpl/hdwwiz/lang/ru-RU.rc index 3b263565bb6..d9dfc0ef285 100644 --- a/dll/cpl/hdwwiz/lang/ru-RU.rc +++ b/dll/cpl/hdwwiz/lang/ru-RU.rc @@ -2,21 +2,21 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT IDD_STARTPAGE DIALOG DISCARDABLE 0, 0, 317, 186 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Мастер установки оборудования" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ", IDC_FINISHTITLE, 114, 8, 203, 24 - LTEXT " :", -1, 114, 40, 182, 8 - LTEXT "1) ", -1, 121, 56, 184, 16 - LTEXT "2) ", -1, 121, 78, 185, 16 + LTEXT "Мастер установки оборудования", IDC_FINISHTITLE, 114, 8, 203, 24 + LTEXT "Этот мастер помогает:", -1, 114, 40, 182, 8 + LTEXT "1) Устанавливать драйверы для нового оборудования на вашем компьютере", -1, 121, 56, 184, 16 + LTEXT "2) Проводить диагностику неполадок имеющегося оборудования", -1, 121, 78, 185, 16 ICON IDI_WARNINGICON, IDC_WARNINGICON, 124, 109, 20, 20 - LTEXT " , """" .", 503, 150, 106, 155, 50 - LTEXT " """".", -1, 114, 166, 193, 8 + LTEXT "Если к устройству прилагается установочный диск, рекомендуется нажать кнопку ""Отмена"" для закрытия этого мастера и воспользоваться диском изготовителя для установки этого устройства.", 503, 150, 106, 155, 50 + LTEXT "Для продолжения нажмите кнопку ""Далее"".", -1, 114, 166, 193, 8 END IDD_SEARCHPAGE DIALOG DISCARDABLE 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Мастер установки оборудования" FONT 8, "MS Shell Dlg" BEGIN LTEXT "", IDC_STATUSTEXT, 21, 8, 275, 32 @@ -25,63 +25,63 @@ END IDD_ISCONNECTEDPAGE DIALOG DISCARDABLE 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Мастер установки оборудования" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ?", -1, 20, 11, 275, 8 - AUTORADIOBUTTON "&, ", IDC_CONNECTED, 29, 23, 266, 8, WS_GROUP - AUTORADIOBUTTON "&, ", IDC_NOTCONNECTED, 29, 35, 266, 8 + LTEXT "Было ли это устройство уже подключено к компьютеру?", -1, 20, 11, 275, 8 + AUTORADIOBUTTON "Д&а, устройство уже подключено", IDC_CONNECTED, 29, 23, 266, 8, WS_GROUP + AUTORADIOBUTTON "Н&ет, это устройство еще не подключено", IDC_NOTCONNECTED, 29, 35, 266, 8 END IDD_PROBELISTPAGE DIALOG DISCARDABLE 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Мастер установки оборудования" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " """", .", -1, 21, 8, 275, 22 - LTEXT " , , "" "".", -1, 21, 32, 275, 24 - LTEXT "& :", -1, 21, 62, 140, 8 + LTEXT "Выберите устройство из списка и нажмите кнопку ""Далее"", чтобы проверить его свойства или выполнить диагностику неполадок.", -1, 21, 8, 275, 22 + LTEXT "Чтобы добавить новое устройство, отсутствующее в этом списке, щелкните элемент ""Добавление нового устройства"".", -1, 21, 32, 275, 24 + LTEXT "&Установленное оборудование:", -1, 21, 62, 140, 8 CONTROL "", IDC_PROBELIST, "SysListView32", WS_BORDER | WS_GROUP | WS_TABSTOP | LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHAREIMAGELISTS | LVS_NOCOLUMNHEADER, 21, 72, 275, 66 END IDD_SELECTWAYPAGE DIALOG DISCARDABLE 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Мастер установки оборудования" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " . , , .", -1, 21, 8, 280, 24 - LTEXT " , .", -1, 23, 40, 275, 8 - AUTORADIOBUTTON "& ()", IDC_AUTOINSTALL, 30, 55, 266, 8, WS_GROUP | NOT WS_TABSTOP - AUTORADIOBUTTON "& , ", IDC_MANUALLYINST, 30, 70, 266, 8, NOT WS_TABSTOP + LTEXT "Мастер может выполнить поиск нового оборудования и установить его автоматически. Если же вы точно знаете изготовителя и модель оборудования, которое нужно установить, вы можете выбрать его из списка вручную.", -1, 21, 8, 280, 24 + LTEXT "Выберите действие, которое следует выполнить.", -1, 23, 40, 275, 8 + AUTORADIOBUTTON "&Поиск и автоматическая установка оборудования (рекомендуется)", IDC_AUTOINSTALL, 30, 55, 266, 8, WS_GROUP | NOT WS_TABSTOP + AUTORADIOBUTTON "&Установка оборудования, выбранного из списка вручную", IDC_MANUALLYINST, 30, 70, 266, 8, NOT WS_TABSTOP END IDD_DETECTEDHWPAGE DIALOG DISCARDABLE 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Мастер установки оборудования" FONT 8, "MS Shell Dlg" BEGIN LTEXT "", IDC_STATUSTEXT, 21, 9, 275, 40 - LTEXT " :", IDC_DETECTEDHWTEXT, 21, 53, 176, 8 + LTEXT "Обнаруженные устройства:", IDC_DETECTEDHWTEXT, 21, 53, 176, 8 CONTROL "", IDC_DETECTEDHWLIST, "SysListView32", WS_BORDER | WS_GROUP | WS_TABSTOP | LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHAREIMAGELISTS | LVS_NOCOLUMNHEADER, 21, 65, 275, 70 END IDD_HWTYPESPAGE DIALOG DISCARDABLE 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Мастер установки оборудования" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " , "" "".", IDC_STATUSTEXT, 21, 9, 275, 18 - LTEXT "& :", IDC_HWTYPESTEXT, 21, 31, 180, 8 + LTEXT "Если нужный вам тип оборудования отсутствует, щелкните элемент списка ""Показать все устройства"".", IDC_STATUSTEXT, 21, 9, 275, 18 + LTEXT "&Стандартные типы оборудования:", IDC_HWTYPESTEXT, 21, 31, 180, 8 CONTROL "", IDC_HWTYPESLIST, "SysListView32", WS_BORDER | WS_GROUP | WS_TABSTOP | LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHAREIMAGELISTS | LVS_NOCOLUMNHEADER, 21, 42, 275, 92 END IDD_PROGRESSPAGE DIALOG DISCARDABLE 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Мастер установки оборудования" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " .", -1, 21, 8, 275, 15 - LTEXT " :", IDC_TPROGRESSTEXT, 21, 25, 275, 8 + LTEXT "Процесс поиска оборудования может занять несколько минут.", -1, 21, 8, 275, 15 + LTEXT "Общий индикатор выполнения:", IDC_TPROGRESSTEXT, 21, 25, 275, 8 CONTROL "", IDC_TPROGRESSBAR, "msctls_progress32", 0, 21, 37, 275, 14 LTEXT "", IDC_PROGRESSTEXT, 58, 58, 200, 8, SS_NOPREFIX CONTROL "", IDC_PROGRESSBAR, "msctls_progress32", 0, 58, 70, 200, 8 @@ -89,59 +89,59 @@ END IDD_FINISHPAGE DIALOG DISCARDABLE 0, 0, 317, 186 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Мастер установки оборудования" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ", IDC_FINISHTITLE, 114, 8, 203, 24 - LTEXT " .", -1, 114, 32, 193, 19 + LTEXT "Мастер установки оборудования", IDC_FINISHTITLE, 114, 8, 203, 24 + LTEXT "Работа мастера установки оборудования успешно завершена.", -1, 114, 32, 193, 19 LTEXT "", IDC_STATUSTEXT, 114, 70, 193, 92 - LTEXT " """".", -1, 114, 166, 190, 8 + LTEXT "Для закрытия мастера нажмите кнопку ""Готово"".", -1, 114, 166, 190, 8 END IDD_ISFOUNDPAGE DIALOG DISCARDABLE 0, 0, 317, 186 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Мастер установки оборудования" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ", IDC_FINISHTITLE, 114, 8, 203, 24 - LTEXT " , :", -1, 114, 32, 193, 19 - LTEXT " """".", -1, 114, 166, 190, 8 + LTEXT "Мастер установки оборудования", IDC_FINISHTITLE, 114, 8, 203, 24 + LTEXT "Мастер обнаружил следующее оборудование, подключенное к этому компьютеру:", -1, 114, 32, 193, 19 + LTEXT "Для закрытия мастера нажмите кнопку ""Готово"".", -1, 114, 166, 190, 8 CONTROL "", IDC_FOUNDHARDWARELIST, "SysListView32", WS_BORDER | WS_GROUP | WS_TABSTOP | LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHAREIMAGELISTS, 114, 56, 193, 78 END IDD_HWSTATUSPAGE DIALOG DISCARDABLE 0, 0, 317, 186 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Мастер установки оборудования" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ", IDC_FINISHTITLE, 114, 8, 195, 28 - LTEXT " :", -1, 114, 40, 193, 19 + LTEXT "Мастер установки оборудования", IDC_FINISHTITLE, 114, 8, 195, 28 + LTEXT "Текущее состояние выбранного оборудования:", -1, 114, 40, 193, 19 EDITTEXT IDC_HWSTATUSEDIT, 114, 60, 193, 70, ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL | NOT WS_TABSTOP - LTEXT " """".", -1, 114, 136, 193, 16 - LTEXT " """".", IDC_STATUSTEXT, 114, 158, 192, 19 + LTEXT "Для запуска диагностики и получения помощи в устранении неполадок нажмите кнопку ""Готово"".", -1, 114, 136, 193, 16 + LTEXT "Для прекращения работы мастера нажмите кнопку ""Отмена"".", IDC_STATUSTEXT, 114, 158, 192, 19 END IDD_NOTCONNECTEDPAGE DIALOG DISCARDABLE 0, 0, 317, 186 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Мастер установки оборудования" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ", IDC_FINISHTITLE, 114, 8, 203, 28 - LTEXT " , .", -1, 114, 40, 193, 16 - AUTOCHECKBOX "& """", .", IDC_TURNOFFCHECKBOX, 114, 64, 203, 30, BS_TOP | BS_MULTILINE - LTEXT " ReactOS . ReactOS , .", -1, 114, 98, 193, 44 - LTEXT " """".", IDC_STATUSTEXT, 114, 166, 193, 8 + LTEXT "Мастер установки оборудования", IDC_FINISHTITLE, 114, 8, 203, 28 + LTEXT "Чтобы продолжить, подключите это устройство к компьютеру.", -1, 114, 40, 193, 16 + AUTOCHECKBOX "&Отключить компьютер после нажатия кнопки ""Готово"", чтобы можно было открыть корпус и подключить устройство.", IDC_TURNOFFCHECKBOX, 114, 64, 203, 30, BS_TOP | BS_MULTILINE + LTEXT "В большинстве случаев ReactOS автоматически установит новое оборудование после его подключения. Если ReactOS не обнаружит его, надо будет вновь запустить этот мастер для установки программной поддержки.", -1, 114, 98, 193, 44 + LTEXT "Для закрытия мастера нажмите кнопку ""Готово"".", IDC_STATUSTEXT, 114, 166, 193, 8 END STRINGTABLE BEGIN - IDS_CPLNAME " " - IDS_CPLDESCRIPTION " " - IDS_SEARCHTITLE ", ..." - IDS_SEARCHTEXT " , , ." - IDS_ISCONNECTED " ?" - IDS_PROBELISTTITLE " " - IDS_ADDNEWDEVICE " " - IDS_SELECTWAYTITLE " " - IDS_HDTYPESTITLE " ." + IDS_CPLNAME "Установка оборудования" + IDS_CPLDESCRIPTION "Установка оборудования в компьютер" + IDS_SEARCHTITLE "Подождите, выполняется поиск..." + IDS_SEARCHTEXT "Этот мастер выполняет поиск оборудования, которое недавно было подключено к компьютеру, но еще не было установлено." + IDS_ISCONNECTED "Подключено ли устройство?" + IDS_PROBELISTTITLE "На этом компьютере уже установлено следующее оборудование" + IDS_ADDNEWDEVICE "Добавление нового устройства" + IDS_SELECTWAYTITLE "Этот мастер помогает установить новое оборудование" + IDS_HDTYPESTITLE "Выберите тип устанавливаемого оборудования из списка." END diff --git a/dll/cpl/hdwwiz/lang/uk-UA.rc b/dll/cpl/hdwwiz/lang/uk-UA.rc index 53e8e594504..e2129e039fb 100644 --- a/dll/cpl/hdwwiz/lang/uk-UA.rc +++ b/dll/cpl/hdwwiz/lang/uk-UA.rc @@ -10,21 +10,21 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT IDD_STARTPAGE DIALOG DISCARDABLE 0, 0, 317, 186 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Майстер встановлення обладнання" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ", IDC_FINISHTITLE, 114, 8, 203, 24 - LTEXT " :", -1, 114, 40, 182, 8 - LTEXT "1) '.", -1, 121, 56, 184, 16 - LTEXT "2) .", -1, 121, 78, 185, 16 + LTEXT "Вас вітає майстер встановлення обладнання", IDC_FINISHTITLE, 114, 8, 203, 24 + LTEXT "Цей майстер допомагає:", -1, 114, 40, 182, 8 + LTEXT "1) Встановлювати драйвери для нових пристроїв вашого комп'ютера.", -1, 121, 56, 184, 16 + LTEXT "2) Проводити діагностику неполадок наявного обладнання.", -1, 121, 78, 185, 16 ICON IDI_WARNINGICON, IDC_WARNINGICON, 124, 109, 20, 20 - LTEXT " , """" .", 503, 150, 106, 155, 50 - LTEXT " """".", -1, 114, 166, 193, 8 + LTEXT "Якщо до пристрою додається установочний диск, рекомендується натиснути кнопку ""Скасувати"" для закриття цього майстра та використати диск від виробника для встановлення цього пристрою.", 503, 150, 106, 155, 50 + LTEXT "Для продовження натисніть кнопку ""Далі"".", -1, 114, 166, 193, 8 END IDD_SEARCHPAGE DIALOG DISCARDABLE 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Майстер встановлення обладнання" FONT 8, "MS Shell Dlg" BEGIN LTEXT "", IDC_STATUSTEXT, 21, 8, 275, 32 @@ -33,63 +33,63 @@ END IDD_ISCONNECTEDPAGE DIALOG DISCARDABLE 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Майстер встановлення обладнання" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ' '?", -1, 20, 11, 275, 8 - AUTORADIOBUTTON "&, '", IDC_CONNECTED, 29, 23, 266, 8, WS_GROUP - AUTORADIOBUTTON "&ͳ, '", IDC_NOTCONNECTED, 29, 35, 266, 8 + LTEXT "Цей пристрій вже під'єднано до комп'ютера?", -1, 20, 11, 275, 8 + AUTORADIOBUTTON "&Так, пристрій вже під'єднано", IDC_CONNECTED, 29, 23, 266, 8, WS_GROUP + AUTORADIOBUTTON "&Ні, цей пристрій ще не під'єднано", IDC_NOTCONNECTED, 29, 35, 266, 8 END IDD_PROBELISTPAGE DIALOG DISCARDABLE 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Майстер встановлення обладнання" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " """" .", -1, 21, 8, 275, 22 - LTEXT " , , "" "".", -1, 21, 32, 275, 24 - LTEXT "& :", -1, 21, 62, 140, 8 + LTEXT "Виберіть пристрій зі списку та натисніть кнопку ""Далі"" для перевірки його властивостей чи виконання діагностики неполадок.", -1, 21, 8, 275, 22 + LTEXT "Щоб додати пристрій, відсутній в цьому списку, натисніть ""Додати новий пристрій"".", -1, 21, 32, 275, 24 + LTEXT "В&становлене обладнання:", -1, 21, 62, 140, 8 CONTROL "", IDC_PROBELIST, "SysListView32", WS_BORDER | WS_GROUP | WS_TABSTOP | LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHAREIMAGELISTS | LVS_NOCOLUMNHEADER, 21, 72, 275, 66 END IDD_SELECTWAYPAGE DIALOG DISCARDABLE 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Майстер встановлення обладнання" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " . , , .", -1, 21, 8, 280, 24 - LTEXT " , ", -1, 23, 40, 275, 8 - AUTORADIOBUTTON "& ()", IDC_AUTOINSTALL, 30, 55, 266, 8, WS_GROUP | NOT WS_TABSTOP - AUTORADIOBUTTON " , &", IDC_MANUALLYINST, 30, 70, 266, 8, NOT WS_TABSTOP + LTEXT "Майстер може виконати пошук іншого обладнання та встановити його автоматично. Якщо ж ви точно знаєте виробника та модель обладнання, яке треба встановити, ви можете вибрати його зі списку вручну.", -1, 21, 8, 280, 24 + LTEXT "Виберіть дію, яку треба виконати", -1, 23, 40, 275, 8 + AUTORADIOBUTTON "&Пошук і автоматичне встановлення обладнання (Рекомендовано)", IDC_AUTOINSTALL, 30, 55, 266, 8, WS_GROUP | NOT WS_TABSTOP + AUTORADIOBUTTON "Встановлення обладнання, що вибрано зі спику в&ручну", IDC_MANUALLYINST, 30, 70, 266, 8, NOT WS_TABSTOP END IDD_DETECTEDHWPAGE DIALOG DISCARDABLE 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Майстер встановлення обладнання" FONT 8, "MS Shell Dlg" BEGIN LTEXT "", IDC_STATUSTEXT, 21, 9, 275, 40 - LTEXT " :", IDC_DETECTEDHWTEXT, 21, 53, 176, 8 + LTEXT "Знайдені пристрої:", IDC_DETECTEDHWTEXT, 21, 53, 176, 8 CONTROL "", IDC_DETECTEDHWLIST, "SysListView32", WS_BORDER | WS_GROUP | WS_TABSTOP | LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHAREIMAGELISTS | LVS_NOCOLUMNHEADER, 21, 65, 275, 70 END IDD_HWTYPESPAGE DIALOG DISCARDABLE 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Майстер встановлення обладнання" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " , "" "".", IDC_STATUSTEXT, 21, 9, 275, 18 - LTEXT "& :", IDC_HWTYPESTEXT, 21, 31, 180, 8 + LTEXT "Якщо потрібний вам тип обладнання відсутній, натисніть елемент списку ""Показати всі пристрої"".", IDC_STATUSTEXT, 21, 9, 275, 18 + LTEXT "&Стандартні типи обладнання:", IDC_HWTYPESTEXT, 21, 31, 180, 8 CONTROL "", IDC_HWTYPESLIST, "SysListView32", WS_BORDER | WS_GROUP | WS_TABSTOP | LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHAREIMAGELISTS | LVS_NOCOLUMNHEADER, 21, 42, 275, 92 END IDD_PROGRESSPAGE DIALOG DISCARDABLE 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Майстер встановлення обладнання" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " .", -1, 21, 8, 275, 15 - LTEXT " :", IDC_TPROGRESSTEXT, 21, 25, 275, 8 + LTEXT "Процес пошуку обладнання може зайняти декілька хвилин.", -1, 21, 8, 275, 15 + LTEXT "Загальний індикатор виконання:", IDC_TPROGRESSTEXT, 21, 25, 275, 8 CONTROL "", IDC_TPROGRESSBAR, "msctls_progress32", 0, 21, 37, 275, 14 LTEXT "", IDC_PROGRESSTEXT, 58, 58, 200, 8, SS_NOPREFIX CONTROL "", IDC_PROGRESSBAR, "msctls_progress32", 0, 58, 70, 200, 8 @@ -97,59 +97,59 @@ END IDD_FINISHPAGE DIALOG DISCARDABLE 0, 0, 317, 186 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Майстер встановлення обладнання" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ", IDC_FINISHTITLE, 114, 8, 203, 24 - LTEXT " .", -1, 114, 32, 193, 19 + LTEXT "Завершення роботи майстра встановлення обладнання", IDC_FINISHTITLE, 114, 8, 203, 24 + LTEXT "Робота майстра встановлення обладнання успішно завершена.", -1, 114, 32, 193, 19 LTEXT "", IDC_STATUSTEXT, 114, 70, 193, 92 - LTEXT " """".", -1, 114, 166, 132, 8 + LTEXT "Для закриття майстра натисніть кнопку ""Завершити"".", -1, 114, 166, 132, 8 END IDD_ISFOUNDPAGE DIALOG DISCARDABLE 0, 0, 317, 186 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Майстер встановлення обладнання" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ", IDC_FINISHTITLE, 114, 8, 203, 24 - LTEXT " , ' ':", -1, 114, 32, 193, 19 - LTEXT " """".", -1, 114, 166, 132, 8 + LTEXT "Завершення роботи майстра встановлення обладнання", IDC_FINISHTITLE, 114, 8, 203, 24 + LTEXT "Майстер знайшов наступне обладнання, під'єднане до цього комп'ютера:", -1, 114, 32, 193, 19 + LTEXT "Для закриття майстра натисніть кнопку ""Завершити"".", -1, 114, 166, 132, 8 CONTROL "", IDC_FOUNDHARDWARELIST, "SysListView32", WS_BORDER | WS_GROUP | WS_TABSTOP | LVS_REPORT | LVS_NOSORTHEADER | LVS_SINGLESEL | LVS_SHAREIMAGELISTS, 114, 56, 193, 78 END IDD_HWSTATUSPAGE DIALOG DISCARDABLE 0, 0, 317, 186 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Майстер встановлення обладнання" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ", IDC_FINISHTITLE, 114, 8, 195, 28 - LTEXT " :", -1, 114, 40, 193, 19 + LTEXT "Завершення роботи майстра встановлення обладнання", IDC_FINISHTITLE, 114, 8, 195, 28 + LTEXT "Поточний стан вибраного пристрою:", -1, 114, 40, 193, 19 EDITTEXT IDC_HWSTATUSEDIT, 114, 60, 193, 70, ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | WS_VSCROLL | NOT WS_TABSTOP - LTEXT " """".", -1, 114, 136, 193, 16 - LTEXT " """".", IDC_STATUSTEXT, 114, 166, 170, 16 + LTEXT "Для запуску діагностики та отримання допомоги щодо усунення неполадок натисніть ""Завршити"".", -1, 114, 136, 193, 16 + LTEXT "Для припинення роботи майстра натисніть кнопку ""Скасувати"".", IDC_STATUSTEXT, 114, 166, 170, 16 END IDD_NOTCONNECTEDPAGE DIALOG DISCARDABLE 0, 0, 317, 186 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Майстер встановлення обладнання" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ", IDC_FINISHTITLE, 114, 8, 203, 28 - LTEXT " ' '.", -1, 114, 40, 193, 16 - AUTOCHECKBOX "& ' """" ' ' .", IDC_TURNOFFCHECKBOX, 114, 64, 203, 25, BS_TOP | BS_MULTILINE - LTEXT " ReactOS '. ReactOS , .", -1, 114, 98, 193, 32 - LTEXT " """".", IDC_STATUSTEXT, 114, 166, 193, 8 + LTEXT "Майстер встановлення обладнання не може продовжити роботу", IDC_FINISHTITLE, 114, 8, 203, 28 + LTEXT "Для продовження під'єднайте цей пристрій до комп'ютера.", -1, 114, 40, 193, 16 + AUTOCHECKBOX "&Вимкнути комп'ютер після натиснення кнопки ""Завершити"" щоб можна було відкрити комп'ютер та під'єднати пристрій.", IDC_TURNOFFCHECKBOX, 114, 64, 203, 25, BS_TOP | BS_MULTILINE + LTEXT "В більшості випадків ReactOS автоматично встановить нове обладнання після його під'єднання. Якщо ReactOS його не знайде, запустіть цього майстра знов для встановлення програмної підтримки.", -1, 114, 98, 193, 32 + LTEXT "Для закриття майстра натисніть кпопку ""Завершити"".", IDC_STATUSTEXT, 114, 166, 193, 8 END STRINGTABLE BEGIN - IDS_CPLNAME " " - IDS_CPLDESCRIPTION " '." - IDS_SEARCHTITLE ", ..." - IDS_SEARCHTEXT " , ' ', ." - IDS_ISCONNECTED " '?" - IDS_PROBELISTTITLE " ' " - IDS_ADDNEWDEVICE " " - IDS_SELECTWAYTITLE " " - IDS_HDTYPESTITLE " " + IDS_CPLNAME "Додати обладнання" + IDS_CPLDESCRIPTION "Встановлення обладнання в вашому комп'ютері." + IDS_SEARCHTITLE "Зачекайте, виконується пошук..." + IDS_SEARCHTEXT "Цей майстер виконує пошук обладнання, яке недавно було під'єднано до комп'ютера, але ще не було встановлене." + IDS_ISCONNECTED "Пристрій під'єднаний?" + IDS_PROBELISTTITLE "На цьому комп'ютері вже встановлене наступне обладнання" + IDS_ADDNEWDEVICE "Додати новий пристрій" + IDS_SELECTWAYTITLE "Цей майстер допоможе встановити інше обладнання" + IDS_HDTYPESTITLE "Виберіть тип встановлюваного обладнання зі списку" END diff --git a/dll/cpl/hdwwiz/rsrc.rc b/dll/cpl/hdwwiz/rsrc.rc index cde584da6b4..6c45d5f2c0d 100644 --- a/dll/cpl/hdwwiz/rsrc.rc +++ b/dll/cpl/hdwwiz/rsrc.rc @@ -14,11 +14,14 @@ #include "lang/ja-JP.rc" #include "lang/nl-NL.rc" #include "lang/no-NO.rc" -#include "lang/pl-PL.rc" #include "lang/pt-BR.rc" -#include "lang/ro-RO.rc" -#include "lang/ru-RU.rc" #include "lang/sk-SK.rc" #include "lang/th-TH.rc" -#include "lang/uk-UA.rc" #include "lang/zh-CN.rc" + +// UTF-8 +#pragma code_page(65001) +#include "lang/pl-PL.rc" +#include "lang/ro-RO.rc" +#include "lang/ru-RU.rc" +#include "lang/uk-UA.rc" diff --git a/dll/cpl/inetcpl/CMakeLists.txt b/dll/cpl/inetcpl/CMakeLists.txt new file mode 100644 index 00000000000..df363f2f93d --- /dev/null +++ b/dll/cpl/inetcpl/CMakeLists.txt @@ -0,0 +1,41 @@ + +set_unicode() +set_rc_compiler() + +include_directories(BEFORE ${REACTOS_SOURCE_DIR}/include/reactos/wine) + +spec2def(inetcpl.cpl inetcpl.spec) + +list(APPEND SOURCE + inetcpl.c + content.c + general.c + security.c + inetcpl.rc + ${CMAKE_CURRENT_BINARY_DIR}/inetcpl_stubs.c + ${CMAKE_CURRENT_BINARY_DIR}/inetcpl.def) + +add_library(inetcpl SHARED ${SOURCE}) + +set_module_type(inetcpl cpl) + +target_link_libraries(inetcpl wine) + +add_importlibs(inetcpl + advapi32 + comctl32 + user32 + gdi32 + shlwapi + msvcrt + kernel32 + ntdll) + +add_delay_importlibs(inetcpl + cryptui + wininet + ole32 + urlmon) + +add_cd_file(TARGET inetcpl DESTINATION reactos/system32 FOR all) + diff --git a/dll/cpl/inetcpl/content.c b/dll/cpl/inetcpl/content.c new file mode 100644 index 00000000000..8fb1729308e --- /dev/null +++ b/dll/cpl/inetcpl/content.c @@ -0,0 +1,99 @@ +/* + * Internet control panel applet: content propsheet + * + * Copyright 2010 Detlef Riekenberg + * + * 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 + * + */ + +#define NONAMELESSUNION + +#include +#include +#include +#include +#include + +#include "inetcpl.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(inetcpl); + +/********************************************************************* + * display_cert_manager (internal) + * + * call cryptui to display a specific certificate manager dialog + * + */ +static BOOL display_cert_manager(HWND parent, DWORD flags) +{ + CRYPTUI_CERT_MGR_STRUCT dlg; + + TRACE("(%p, 0x%x)\n", parent, flags); + + ZeroMemory(&dlg, sizeof(CRYPTUI_CERT_MGR_STRUCT)); + dlg.dwSize = sizeof(CRYPTUI_CERT_MGR_STRUCT); + dlg.hwndParent = parent; + dlg.dwFlags = flags; + + return CryptUIDlgCertMgr(&dlg); +} + +/********************************************************************* + * LaunchSiteCertDialog (inetcpl.@) + * + * Launch a dialog to manage personal certificates + * + * PARAMS + * parent [I] Handle for the parent window + * + * RETURNS + * Failure: FALSE + * Success: TRUE + * + * NOTES + * rundll32 callable function: rundll32 inetcpl.cpl,LaunchSiteCertDialog + * + */ +BOOL WINAPI LaunchSiteCertDialog(HWND parent) +{ + return display_cert_manager(parent, 0); +} + +/********************************************************************* + * content_dlgproc [internal] + * + */ +INT_PTR CALLBACK content_dlgproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) +{ + if ((msg != WM_SETCURSOR) && (msg != WM_NCHITTEST) && (msg != WM_MOUSEMOVE)) + TRACE("(%p, 0x%08x/%d, 0x%lx, 0x%lx)\n", hwnd, msg, msg, wparam, lparam); + + if (msg == WM_COMMAND) + { + switch (LOWORD(wparam)) + { + case IDC_CERT: + display_cert_manager(hwnd, 0); + break; + + case IDC_CERT_PUBLISHER: + display_cert_manager(hwnd, CRYPTUI_CERT_MGR_PUBLISHER_TAB); + break; + } + } + return FALSE; +} diff --git a/dll/cpl/inetcpl/general.c b/dll/cpl/inetcpl/general.c new file mode 100644 index 00000000000..1d8f027e042 --- /dev/null +++ b/dll/cpl/inetcpl/general.c @@ -0,0 +1,297 @@ +/* + * Internet control panel applet: general propsheet + * + * Copyright 2010 Detlef Riekenberg + * + * 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 + * + */ + +#define NONAMELESSUNION + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "inetcpl.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(inetcpl); + +static const WCHAR about_blank[] = {'a','b','o','u','t',':','b','l','a','n','k',0}; +static const WCHAR start_page[] = {'S','t','a','r','t',' ','P','a','g','e',0}; +static const WCHAR reg_ie_main[] = {'S','o','f','t','w','a','r','e','\\', + 'M','i','c','r','o','s','o','f','t','\\', + 'I','n','t','e','r','n','e','t',' ','E','x','p','l','o','r','e','r','\\', + 'M','a','i','n',0}; + +/* list of unimplemented buttons */ +static DWORD disabled_general_buttons[] = {IDC_HOME_CURRENT, + IDC_HOME_DEFAULT, + IDC_HISTORY_SETTINGS, + 0}; +static DWORD disabled_delhist_buttons[] = {IDC_DELETE_COOKIES, + IDC_DELETE_HISTORY, + IDC_DELETE_FORM_DATA, + IDC_DELETE_PASSWORDS, + 0}; + +/********************************************************************* + * delhist_on_command [internal] + * + * handle WM_COMMAND in Delete browsing history dialog + * + */ +static INT_PTR delhist_on_command(HWND hdlg, WPARAM wparam) +{ + switch (wparam) + { + case MAKEWPARAM(IDOK, BN_CLICKED): + if (!FreeUrlCacheSpaceW(NULL, 100, FCS_PERCENT_CACHE_SPACE)) + break; /* Don't close the dialog. */ + EndDialog(hdlg, IDOK); + return TRUE; + + case MAKEWPARAM(IDCANCEL, BN_CLICKED): + EndDialog(hdlg, IDCANCEL); + return TRUE; + + case MAKEWPARAM(IDC_DELETE_TEMP_FILES, BN_CLICKED): + case MAKEWPARAM(IDC_DELETE_COOKIES, BN_CLICKED): + case MAKEWPARAM(IDC_DELETE_HISTORY, BN_CLICKED): + case MAKEWPARAM(IDC_DELETE_FORM_DATA, BN_CLICKED): + case MAKEWPARAM(IDC_DELETE_PASSWORDS, BN_CLICKED): + { + BOOL any = IsDlgButtonChecked(hdlg, IDC_DELETE_TEMP_FILES) || + IsDlgButtonChecked(hdlg, IDC_DELETE_COOKIES) || + IsDlgButtonChecked(hdlg, IDC_DELETE_HISTORY) || + IsDlgButtonChecked(hdlg, IDC_DELETE_FORM_DATA) || + IsDlgButtonChecked(hdlg, IDC_DELETE_PASSWORDS); + EnableWindow(GetDlgItem(hdlg, IDOK), any); + break; + } + + default: + break; + } + return FALSE; +} + + +/********************************************************************* + * delhist_dlgproc [internal] + * + * Delete browsing history dialog procedure + * + */ +static INT_PTR CALLBACK delhist_dlgproc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) +{ + switch (msg) + { + case WM_COMMAND: + return delhist_on_command(hdlg, wparam); + + case WM_INITDIALOG: + { + DWORD *ptr = disabled_delhist_buttons; + while (*ptr) + { + EnableWindow(GetDlgItem(hdlg, *ptr), FALSE); + ptr++; + } + CheckDlgButton(hdlg, IDC_DELETE_TEMP_FILES, BST_CHECKED); + break; + } + + default: + break; + } + return FALSE; +} + +/********************************************************************* + * parse_url_from_outside [internal] + * + * Filter an URL, add a usable scheme, when needed + * + */ +static DWORD parse_url_from_outside(LPCWSTR url, LPWSTR out, DWORD maxlen) +{ + HMODULE hdll; + DWORD (WINAPI *pParseURLFromOutsideSourceW)(LPCWSTR, LPWSTR, LPDWORD, LPDWORD); + DWORD res; + + hdll = LoadLibraryA("shdocvw.dll"); + pParseURLFromOutsideSourceW = (void *) GetProcAddress(hdll, (LPSTR) 170); + + if (pParseURLFromOutsideSourceW) + { + res = pParseURLFromOutsideSourceW(url, out, &maxlen, NULL); + FreeLibrary(hdll); + return res; + } + + ERR("failed to get ordinal 170: %d\n", GetLastError()); + FreeLibrary(hdll); + return 0; +} + +/********************************************************************* + * general_on_command [internal] + * + * handle WM_COMMAND + * + */ +static INT_PTR general_on_command(HWND hwnd, WPARAM wparam) +{ + + switch (wparam) + { + case MAKEWPARAM(IDC_HOME_EDIT, EN_CHANGE): + /* enable apply button */ + SendMessageW(GetParent(hwnd), PSM_CHANGED, (WPARAM)hwnd, 0); + break; + + case MAKEWPARAM(IDC_HOME_BLANK, BN_CLICKED): + SetDlgItemTextW(hwnd, IDC_HOME_EDIT, about_blank); + break; + + case MAKEWPARAM(IDC_HISTORY_DELETE, BN_CLICKED): + DialogBoxW(hcpl, MAKEINTRESOURCEW(IDD_DELETE_HISTORY), hwnd, + delhist_dlgproc); + break; + + default: + TRACE("not implemented for command: %d/%d\n", HIWORD(wparam), LOWORD(wparam)); + return FALSE; + } + return TRUE; +} + +/********************************************************************* + * general_on_initdialog [internal] + * + * handle WM_INITDIALOG + * + */ +static VOID general_on_initdialog(HWND hwnd) +{ + WCHAR buffer[INTERNET_MAX_URL_LENGTH]; + DWORD len; + DWORD type; + LONG res; + DWORD *ptr = disabled_general_buttons; + + /* disable unimplemented buttons */ + while (*ptr) + { + EnableWindow(GetDlgItem(hwnd, *ptr), FALSE); + ptr++; + } + + /* read current homepage from the registry. Try HCU first, then HKLM */ + *buffer = 0; + len = sizeof(buffer); + type = REG_SZ; + res = SHRegGetUSValueW(reg_ie_main, start_page, &type, buffer, &len, FALSE, (LPBYTE) about_blank, sizeof(about_blank)); + + if (!res && (type == REG_SZ)) + { + SetDlgItemTextW(hwnd, IDC_HOME_EDIT, buffer); + } +} + +/********************************************************************* + * general_on_notify [internal] + * + * handle WM_NOTIFY + * + */ +static INT_PTR general_on_notify(HWND hwnd, WPARAM wparam, LPARAM lparam) +{ + PSHNOTIFY *psn; + WCHAR buffer[INTERNET_MAX_URL_LENGTH]; + WCHAR parsed[INTERNET_MAX_URL_LENGTH]; + LONG res; + + psn = (PSHNOTIFY *) lparam; + TRACE("WM_NOTIFY (%p, 0x%lx, 0x%lx) from %p with code: %d\n", hwnd, wparam, lparam, + psn->hdr.hwndFrom, psn->hdr.code); + + if (psn->hdr.code == PSN_APPLY) + { + *buffer = 0; + GetDlgItemTextW(hwnd, IDC_HOME_EDIT, buffer, sizeof(buffer)/sizeof(WCHAR)); + TRACE("EDITTEXT has %s\n", debugstr_w(buffer)); + + res = parse_url_from_outside(buffer, parsed, sizeof(parsed)/sizeof(WCHAR)); + TRACE("got %d with %s\n", res, debugstr_w(parsed)); + + if (res) + { + HKEY hkey; + + /* update the dialog, when needed */ + if (lstrcmpW(buffer, parsed)) + SetDlgItemTextW(hwnd, IDC_HOME_EDIT, parsed); + + /* update the registry */ + res = RegOpenKeyW(HKEY_CURRENT_USER, reg_ie_main, &hkey); + if (!res) + { + res = RegSetValueExW(hkey, start_page, 0, REG_SZ, (const BYTE *)parsed, + (lstrlenW(parsed) + 1) * sizeof(WCHAR)); + RegCloseKey(hkey); + return !res; + } + } + } + return FALSE; +} + +/********************************************************************* + * general_dlgproc [internal] + * + */ +INT_PTR CALLBACK general_dlgproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) +{ + + switch (msg) + { + case WM_INITDIALOG: + general_on_initdialog(hwnd); + return TRUE; + + case WM_COMMAND: + return general_on_command(hwnd, wparam); + + case WM_NOTIFY: + return general_on_notify(hwnd, wparam, lparam); + + default: + /* do not flood the log */ + if ((msg == WM_SETCURSOR) || (msg == WM_NCHITTEST) || (msg == WM_MOUSEMOVE)) + return FALSE; + + TRACE("(%p, 0x%08x/%d, 0x%lx, 0x%lx)\n", hwnd, msg, msg, wparam, lparam); + + } + return FALSE; +} diff --git a/dll/cpl/inetcpl/inetcpl.c b/dll/cpl/inetcpl/inetcpl.c new file mode 100644 index 00000000000..751eccd468a --- /dev/null +++ b/dll/cpl/inetcpl/inetcpl.c @@ -0,0 +1,203 @@ +/* + * Internet control panel applet + * + * Copyright 2010 Detlef Riekenberg + * + * 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 + * + */ + +#define NONAMELESSUNION +#define COBJMACROS +#define CONST_VTABLE + +#include +#include +#include +#include +#include +#include +#include +#include "ole2.h" + +#include "wine/debug.h" + +#include "inetcpl.h" + + +WINE_DEFAULT_DEBUG_CHANNEL(inetcpl); + +DECLSPEC_HIDDEN HMODULE hcpl; + +/********************************************************************* + * DllMain (inetcpl.@) + */ +BOOL WINAPI DllMain(HINSTANCE hdll, DWORD reason, LPVOID reserved) +{ + TRACE("(%p, %d, %p)\n", hdll, reason, reserved); + + switch (reason) + { + /* case DLL_WINE_PREATTACH: + return FALSE; prefer native version */ + + case DLL_PROCESS_ATTACH: + DisableThreadLibraryCalls(hdll); + hcpl = hdll; + } + return TRUE; +} + +/****************************************************************************** + * propsheet_callback [internal] + * + */ +static int CALLBACK propsheet_callback(HWND hwnd, UINT msg, LPARAM lparam) +{ + + TRACE("(%p, 0x%08x/%d, 0x%lx)\n", hwnd, msg, msg, lparam); + switch (msg) + { + case PSCB_INITIALIZED: + SendMessageW(hwnd, WM_SETICON, ICON_BIG, (LPARAM) LoadIconW(hcpl, MAKEINTRESOURCEW(ICO_MAIN))); + break; + } + return 0; +} + +/****************************************************************************** + * display_cpl_sheets [internal] + * + * Build and display the dialog with all control panel propertysheets + * + */ +static void display_cpl_sheets(HWND parent) +{ + INITCOMMONCONTROLSEX icex; + PROPSHEETPAGEW psp[NUM_PROPERTY_PAGES]; + PROPSHEETHEADERW psh; + DWORD id = 0; + + OleInitialize(NULL); + /* Initialize common controls */ + icex.dwSize = sizeof(INITCOMMONCONTROLSEX); + icex.dwICC = ICC_LISTVIEW_CLASSES | ICC_BAR_CLASSES; + InitCommonControlsEx(&icex); + + ZeroMemory(&psh, sizeof(psh)); + ZeroMemory(psp, sizeof(psp)); + + /* Fill out all PROPSHEETPAGE */ + psp[id].dwSize = sizeof (PROPSHEETPAGEW); + psp[id].hInstance = hcpl; + psp[id].u.pszTemplate = MAKEINTRESOURCEW(IDD_GENERAL); + psp[id].pfnDlgProc = general_dlgproc; + id++; + + psp[id].dwSize = sizeof (PROPSHEETPAGEW); + psp[id].hInstance = hcpl; + psp[id].u.pszTemplate = MAKEINTRESOURCEW(IDD_SECURITY); + psp[id].pfnDlgProc = security_dlgproc; + id++; + + psp[id].dwSize = sizeof (PROPSHEETPAGEW); + psp[id].hInstance = hcpl; + psp[id].u.pszTemplate = MAKEINTRESOURCEW(IDD_CONTENT); + psp[id].pfnDlgProc = content_dlgproc; + id++; + + /* Fill out the PROPSHEETHEADER */ + psh.dwSize = sizeof (PROPSHEETHEADERW); + psh.dwFlags = PSH_PROPSHEETPAGE | PSH_USEICONID | PSH_USECALLBACK; + psh.hwndParent = parent; + psh.hInstance = hcpl; + psh.u.pszIcon = MAKEINTRESOURCEW(ICO_MAIN); + psh.pszCaption = MAKEINTRESOURCEW(IDS_CPL_NAME); + psh.nPages = id; + psh.u3.ppsp = psp; + psh.pfnCallback = propsheet_callback; + + /* display the dialog */ + PropertySheetW(&psh); + + OleUninitialize(); +} + +/********************************************************************* + * CPlApplet (inetcpl.@) + * + * Control Panel entry point + * + * PARAMS + * hWnd [I] Handle for the Control Panel Window + * command [I] CPL_* Command + * lParam1 [I] first extra Parameter + * lParam2 [I] second extra Parameter + * + * RETURNS + * Depends on the command + * + */ +LONG CALLBACK CPlApplet(HWND hWnd, UINT command, LPARAM lParam1, LPARAM lParam2) +{ + TRACE("(%p, %u, 0x%lx, 0x%lx)\n", hWnd, command, lParam1, lParam2); + + switch (command) + { + case CPL_INIT: + return TRUE; + + case CPL_GETCOUNT: + return 1; + + case CPL_INQUIRE: + { + CPLINFO *appletInfo = (CPLINFO *) lParam2; + + appletInfo->idIcon = ICO_MAIN; + appletInfo->idName = IDS_CPL_NAME; + appletInfo->idInfo = IDS_CPL_INFO; + appletInfo->lData = 0; + return TRUE; + } + + case CPL_DBLCLK: + display_cpl_sheets(hWnd); + break; + } + + return FALSE; +} + +/********************************************************************* + * LaunchInternetControlPanel (inetcpl.@) + * + * Launch the Internet Control Panel dialog + * + * PARAMS + * parent [I] Handle for the parent window + * + * RETURNS + * Success: TRUE + * + * NOTES + * rundll32 callable function: rundll32 inetcpl.cpl,LaunchInternetControlPanel + * + */ +BOOL WINAPI LaunchInternetControlPanel(HWND parent) +{ + display_cpl_sheets(parent); + return TRUE; +} diff --git a/dll/cpl/inetcpl/inetcpl.h b/dll/cpl/inetcpl/inetcpl.h new file mode 100644 index 00000000000..bd1e55a5bab --- /dev/null +++ b/dll/cpl/inetcpl/inetcpl.h @@ -0,0 +1,105 @@ +/* + * Internet control panel applet + * + * Copyright 2010 Detlef Riekenberg + * + * 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 __WINE_INETCPL__ +#define __WINE_INETCPL__ + +#include +#include +#include + +extern HMODULE hcpl; +INT_PTR CALLBACK content_dlgproc(HWND, UINT, WPARAM, LPARAM) DECLSPEC_HIDDEN; +INT_PTR CALLBACK general_dlgproc(HWND, UINT, WPARAM, LPARAM) DECLSPEC_HIDDEN; +INT_PTR CALLBACK security_dlgproc(HWND, UINT, WPARAM, LPARAM) DECLSPEC_HIDDEN; + +/* ## Memory allocation functions ## */ + +static inline void * __WINE_ALLOC_SIZE(1) heap_alloc( size_t len ) +{ + return HeapAlloc( GetProcessHeap(), 0, len ); +} + +static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero( size_t len ) +{ + return HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, len ); +} + +static inline BOOL heap_free( void *mem ) +{ + return HeapFree( GetProcessHeap(), 0, mem ); +} + +/* ######### */ + +#define NUM_PROPERTY_PAGES 8 + +/* icons */ +#define ICO_MAIN 100 + +/* strings */ +#define IDS_CPL_NAME 1 +#define IDS_CPL_INFO 2 +#define IDS_SEC_SETTINGS 0x10 +#define IDS_SEC_LEVEL0 0x100 +#define IDS_SEC_LEVEL1 0x101 +#define IDS_SEC_LEVEL2 0x102 +#define IDS_SEC_LEVEL3 0x103 +#define IDS_SEC_LEVEL4 0x104 +#define IDS_SEC_LEVEL5 0x105 +#define IDS_SEC_LEVEL0_INFO 0x200 +#define IDS_SEC_LEVEL1_INFO 0x210 +#define IDS_SEC_LEVEL2_INFO 0x220 +#define IDS_SEC_LEVEL3_INFO 0x230 +#define IDS_SEC_LEVEL4_INFO 0x240 +#define IDS_SEC_LEVEL5_INFO 0x250 + +/* dialogs */ +#define IDC_STATIC -1 + +#define IDD_GENERAL 1000 +#define IDC_HOME_EDIT 1000 +#define IDC_HOME_CURRENT 1001 +#define IDC_HOME_DEFAULT 1002 +#define IDC_HOME_BLANK 1003 +#define IDC_HISTORY_DELETE 1004 +#define IDC_HISTORY_SETTINGS 1005 + +#define IDD_DELETE_HISTORY 1010 +#define IDC_DELETE_TEMP_FILES 1011 +#define IDC_DELETE_COOKIES 1012 +#define IDC_DELETE_HISTORY 1013 +#define IDC_DELETE_FORM_DATA 1014 +#define IDC_DELETE_PASSWORDS 1015 + +#define IDD_SECURITY 2000 +#define IDC_SEC_LISTVIEW 2001 +#define IDC_SEC_ZONE_INFO 2002 +#define IDC_SEC_GROUP 2003 +#define IDC_SEC_TRACKBAR 2004 +#define IDC_SEC_LEVEL 2005 +#define IDC_SEC_LEVEL_INFO 2006 + +#define IDD_CONTENT 4000 +#define IDC_CERT 4100 +#define IDC_CERT_PUBLISHER 4101 + +#endif diff --git a/dll/cpl/inetcpl/inetcpl.ico b/dll/cpl/inetcpl/inetcpl.ico new file mode 100644 index 00000000000..1eae208a702 Binary files /dev/null and b/dll/cpl/inetcpl/inetcpl.ico differ diff --git a/dll/cpl/inetcpl/inetcpl.rbuild b/dll/cpl/inetcpl/inetcpl.rbuild new file mode 100644 index 00000000000..f3abf389807 --- /dev/null +++ b/dll/cpl/inetcpl/inetcpl.rbuild @@ -0,0 +1,23 @@ + + + + + . + include/reactos/wine + cryptui + wininet + ole32 + urlmon + delayimp + wine + advapi32 + user32 + comctl32 + gdi32 + shlwapi + inetcpl.c + content.c + general.c + security.c + inetcpl.rc + diff --git a/dll/cpl/inetcpl/inetcpl.rc b/dll/cpl/inetcpl/inetcpl.rc new file mode 100644 index 00000000000..e7a2c8d0da4 --- /dev/null +++ b/dll/cpl/inetcpl/inetcpl.rc @@ -0,0 +1,70 @@ +/* + * Internet control panel applet + * + * Copyright 2010 Detlef Riekenberg + * + * 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 "inetcpl.h" + +#include "lang/de-DE.rc" +#include "lang/en-US.rc" +#include "lang/fr-FR.rc" +#include "lang/He.rc" +#include "lang/it-IT.rc" +#include "lang/ja-JP.rc" +#include "lang/ko-KR.rc" +#include "lang/lt-LT.rc" +#include "lang/nl-NL.rc" +#include "lang/pl-PL.rc" +#include "lang/pt-PT.rc" +#include "lang/ru-RU.rc" +#include "lang/Sr.rc" +#include "lang/sv-SE.rc" +#include "lang/uk-UA.rc" + +LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT + +STRINGTABLE DISCARDABLE +BEGIN + IDS_CPL_NAME "Internet Settings" + IDS_CPL_INFO "Configure Wine Internet Browser and related settings" + IDS_SEC_SETTINGS "Security settings for zone: " + IDS_SEC_LEVEL0 "Custom" + IDS_SEC_LEVEL1 "Very Low" + IDS_SEC_LEVEL2 "Low" + IDS_SEC_LEVEL3 "Medium" + IDS_SEC_LEVEL4 "Increased" + IDS_SEC_LEVEL5 "High" +END + +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL + +#define WINE_FILENAME_STR "inetcpl.cpl" +#define WINE_FILEDESCRIPTION_STR "Internet Control Panel" + +/* Same Version as IE 8 on WinXP */ +#define WINE_FILEVERSION 8,0,6001,18939 +#define WINE_FILEVERSION_STR "8.00.6001.18939" + +#define WINE_PRODUCTVERSION 8,0,6001,18939 +#define WINE_PRODUCTVERSION_STR "8.00.6001.18939" + +#include "wine/wine_common_ver.rc" + +/* @makedep: inetcpl.ico */ +ICO_MAIN ICON "inetcpl.ico" diff --git a/dll/cpl/inetcpl/inetcpl.spec b/dll/cpl/inetcpl/inetcpl.spec new file mode 100644 index 00000000000..eaf5e4d6e7d --- /dev/null +++ b/dll/cpl/inetcpl/inetcpl.spec @@ -0,0 +1,25 @@ +@ stub ClearMyTracksByProcessW +@ stub AddInternetPropertySheets +@ stub AddInternetPropertySheetsEx +@ stdcall CPlApplet(long long long long) +@ stub DisplayPopupWindowManagementDialog +@ stub DllInstall +@ stub GetAddSitesDisplayUrl +@ stub ImportExportPFX +@ stub LaunchAddSitesDialog +@ stub LaunchConnectionDialog +@ stdcall LaunchInternetControlPanel(long) +@ stub LaunchPerSitePrivacyActionDialog +@ stub LaunchPopupWindowManagementDialog +@ stub LaunchPrivacyDialog +@ stub LaunchSecurityDialog +@ stub LaunchSecurityDialogEx +@ stdcall LaunchSiteCertDialog(long) +@ stub OpenFontsDialog +@ stub OpenFontsDialogEx +@ stub OpenLanguageDialog +@ stub ResetIEtoDefaults +@ stub ShowDeleteBrowsingHistoryDialog +@ stub ShowFeedOptionsDialog +@ stub ShowLanguageDialog +@ stub SiteCert_RunFromCmdLine diff --git a/dll/cpl/inetcpl/inetcpl.svg b/dll/cpl/inetcpl/inetcpl.svg new file mode 100644 index 00000000000..7b943b1ea64 --- /dev/null +++ b/dll/cpl/inetcpl/inetcpl.svg @@ -0,0 +1,265 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dll/cpl/inetcpl/lang/He.rc b/dll/cpl/inetcpl/lang/He.rc new file mode 100644 index 00000000000..256ca084125 --- /dev/null +++ b/dll/cpl/inetcpl/lang/He.rc @@ -0,0 +1,66 @@ +/* + * Hebrew resources for the Internet control panel applet + * + * Copyright 2010 Detlef Riekenberg + * Copyright 2010 Yaron Shahrabani + * + * 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 "inetcpl.h" + +#pragma code_page(65001) + +LANGUAGE LANG_HEBREW, SUBLANG_DEFAULT + +/* "General" propsheet */ +IDD_GENERAL DIALOG 0, 0, 320, 220 +STYLE WS_CAPTION | WS_CHILD | WS_DISABLED +EXSTYLE WS_EX_LAYOUTRTL +FONT 8, "MS Shell Dlg" +CAPTION "כללי" +BEGIN + + GROUPBOX " דף הבית ", IDC_STATIC, 4, 4, 312, 52 + LTEXT "באפשרותך לבחור את הכתובת שתשמש כדף הבית שלך.", + IDC_STATIC, 58, 10, 252, 10 + EDITTEXT IDC_HOME_EDIT, 58, 22, 252, 12, WS_VISIBLE | ES_AUTOHSCROLL + PUSHBUTTON "העמוד ה&נוכחי", IDC_HOME_CURRENT, 58, 36, 80, 14 + PUSHBUTTON "עמוד &בררת המחדל", IDC_HOME_DEFAULT, 144, 36, 80, 14 + PUSHBUTTON "עמוד &ריק", IDC_HOME_BLANK, 230, 36, 80, 14 + GROUPBOX " Browsing history ", IDC_STATIC, 4, 60, 312, 46 + LTEXT "You can delete cached pages, cookies and other data.", + IDC_STATIC, 58, 72, 252, 10 + PUSHBUTTON "Delete &files...", IDC_HISTORY_DELETE, 144, 86, 80, 14 + PUSHBUTTON "&Settings...", IDC_HISTORY_SETTINGS, 230, 86, 80, 14 + +END + +/* "Content" propsheet */ +IDD_CONTENT DIALOG 0, 0, 320, 220 +STYLE WS_CAPTION | WS_CHILD | WS_DISABLED +EXSTYLE WS_EX_LAYOUTRTL +FONT 8, "MS Shell Dlg" +CAPTION "תוכן" +BEGIN + + GROUPBOX " אישורים ", IDC_STATIC, 4, 4, 312, 50 + LTEXT "אישורים משמשים כדי לזהות אותך וגם כדי לזהות רשויות ומפיצים.", + IDC_STATIC, 58, 14, 252, 18 + PUSHBUTTON "אישורים...", IDC_CERT, 146, 34, 80, 14 + PUSHBUTTON "מפיצים...", IDC_CERT_PUBLISHER, 230, 34, 80, 14 + +END diff --git a/dll/cpl/inetcpl/lang/Sr.rc b/dll/cpl/inetcpl/lang/Sr.rc new file mode 100644 index 00000000000..0312d2a2b73 --- /dev/null +++ b/dll/cpl/inetcpl/lang/Sr.rc @@ -0,0 +1,103 @@ +/* + * Internet control panel applet + * + * Copyright 2010 Detlef Riekenberg + * Copyright 2010 Đorđe Vasiljević + * + * 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 "inetcpl.h" + +#pragma code_page(65001) + +LANGUAGE LANG_SERBIAN, SUBLANG_SERBIAN_CYRILLIC + +/* "General" propsheet */ +IDD_GENERAL DIALOG 0, 0, 320, 220 +STYLE WS_CAPTION | WS_CHILD | WS_DISABLED +FONT 8, "MS Shell Dlg" +CAPTION "Опште" +BEGIN + + GROUPBOX "Почетна страна", IDC_STATIC, 4, 4, 312, 52 + LTEXT "Изаберите адресу која ће се користити за почетну страну.", + IDC_STATIC, 58, 10, 252, 10 + EDITTEXT IDC_HOME_EDIT, 58, 22, 252, 12, WS_VISIBLE | ES_AUTOHSCROLL + PUSHBUTTON "&Текућа страна", IDC_HOME_CURRENT, 58, 36, 80, 14 + PUSHBUTTON "&Подразумевана страна", IDC_HOME_DEFAULT, 144, 36, 80, 14 + PUSHBUTTON "Празна &страна", IDC_HOME_BLANK, 230, 36, 80, 14 + GROUPBOX " Browsing history ", IDC_STATIC, 4, 60, 312, 46 + LTEXT "You can delete cached pages, cookies and other data.", + IDC_STATIC, 58, 72, 252, 10 + PUSHBUTTON "Delete &files...", IDC_HISTORY_DELETE, 144, 86, 80, 14 + PUSHBUTTON "&Settings...", IDC_HISTORY_SETTINGS, 230, 86, 80, 14 + +END + +/* "Content" propsheet */ +IDD_CONTENT DIALOG 0, 0, 320, 220 +STYLE WS_CAPTION | WS_CHILD | WS_DISABLED +FONT 8, "MS Shell Dlg" +CAPTION "Садржај" +BEGIN + + GROUPBOX "Сертификати", IDC_STATIC, 4, 4, 312, 50 + LTEXT "Сертификати се користе за личну идентификацију, као и за препознавање ауторитета и издавача сертификата.", + IDC_STATIC, 58, 14, 252, 18 + PUSHBUTTON "Сертификати...", IDC_CERT, 146, 34, 80, 14 + PUSHBUTTON "Издавачи...", IDC_CERT_PUBLISHER, 230, 34, 80, 14 + +END + +LANGUAGE LANG_SERBIAN, SUBLANG_SERBIAN_LATIN + +/* "General" propsheet */ +IDD_GENERAL DIALOG 0, 0, 320, 220 +STYLE WS_CAPTION | WS_CHILD | WS_DISABLED +FONT 8, "MS Shell Dlg" +CAPTION "Opšte" +BEGIN + + GROUPBOX "Početna strana", IDC_STATIC, 4, 4, 312, 52 + LTEXT "Izaberite adresu koja će se koristiti za početnu stranu.", + IDC_STATIC, 58, 10, 252, 10 + EDITTEXT IDC_HOME_EDIT, 58, 22, 252, 12, WS_VISIBLE | ES_AUTOHSCROLL + PUSHBUTTON "&Tekuća strana", IDC_HOME_CURRENT, 58, 36, 80, 14 + PUSHBUTTON "&Podrazumevana strana", IDC_HOME_DEFAULT, 144, 36, 80, 14 + PUSHBUTTON "Prazna &strana", IDC_HOME_BLANK, 230, 36, 80, 14 + GROUPBOX " Browsing history ", IDC_STATIC, 4, 60, 312, 46 + LTEXT "You can delete cached pages, cookies and other data.", + IDC_STATIC, 58, 72, 252, 10 + PUSHBUTTON "Delete &files...", IDC_HISTORY_DELETE, 144, 86, 80, 14 + PUSHBUTTON "&Settings...", IDC_HISTORY_SETTINGS, 230, 86, 80, 14 + +END + +/* "Content" propsheet */ +IDD_CONTENT DIALOG 0, 0, 320, 220 +STYLE WS_CAPTION | WS_CHILD | WS_DISABLED +FONT 8, "MS Shell Dlg" +CAPTION "Sadržaj" +BEGIN + + GROUPBOX "Sertifikati", IDC_STATIC, 4, 4, 312, 50 + LTEXT "Sertifikati se koriste za ličnu identifikaciju, kao i za prepoznavanje autoriteta i izdavača sertifikata.", + IDC_STATIC, 58, 14, 252, 18 + PUSHBUTTON "Sertifikati...", IDC_CERT, 146, 34, 80, 14 + PUSHBUTTON "Izdavači...", IDC_CERT_PUBLISHER, 230, 34, 80, 14 + +END diff --git a/dll/cpl/inetcpl/lang/de-DE.rc b/dll/cpl/inetcpl/lang/de-DE.rc new file mode 100644 index 00000000000..5d278f140ca --- /dev/null +++ b/dll/cpl/inetcpl/lang/de-DE.rc @@ -0,0 +1,103 @@ +/* + * German resources for the Internet control panel applet + * + * Copyright 2010 Detlef Riekenberg + * + * 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 "inetcpl.h" + +#pragma code_page(65001) + +LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL + +/* "General" propsheet */ +IDD_GENERAL DIALOG 0, 0, 320, 220 +STYLE WS_CAPTION | WS_CHILD | WS_DISABLED +FONT 8, "MS Shell Dlg" +CAPTION "Allgemein" +BEGIN + + GROUPBOX " Startseite ", IDC_STATIC, 4, 4, 312, 52 + LTEXT "Sie können eine Addresse wählen, die als Startseite verwendet wird.", + IDC_STATIC, 58, 10, 252, 10 + EDITTEXT IDC_HOME_EDIT, 58, 22, 252, 12, WS_VISIBLE | ES_AUTOHSCROLL + PUSHBUTTON "A&ktuelle Seite", IDC_HOME_CURRENT, 58, 36, 80, 14 + PUSHBUTTON "&Standardseite", IDC_HOME_DEFAULT, 144, 36, 80, 14 + PUSHBUTTON "&Leere Seite", IDC_HOME_BLANK, 230, 36, 80, 14 + GROUPBOX " Browserverlauf ", IDC_STATIC, 4, 60, 312, 46 + LTEXT "Sie können temporäre Dateien, Cookies und andere Daten löschen.", + IDC_STATIC, 58, 72, 252, 10 + PUSHBUTTON "&Daten löschen...", IDC_HISTORY_DELETE, 144, 86, 80, 14 + PUSHBUTTON "&Einstellungen...", IDC_HISTORY_SETTINGS, 230, 86, 80, 14 + +END + +/* "Delete browsing history" dialog */ +IDD_DELETE_HISTORY DIALOG 0, 0, 250, 250 +STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU +FONT 8, "MS Shell Dlg" +CAPTION "Gespeicherte Browserdaten löchen" +BEGIN + + AUTOCHECKBOX "&Temporäre Inernetdateien\nZwischengespeicherte Kopien von Webseiten, Bildern und Zertifikaten.", + IDC_DELETE_TEMP_FILES, 10, 8, 230, 30, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Cookies\nVon Webseiten auf ihrem Computer gespeicherte Dateien, die Benutzereinstellungen oder Anmeldeinformationen enthalten.", + IDC_DELETE_COOKIES, 10, 38, 230, 30, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Verlauf\nListe von Webseiten, die Sie aufgerufen haben.", + IDC_DELETE_HISTORY, 10, 68, 230, 30, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Formulardaten\nBenutzernamen und andere Informationen, die Sie in Formulare eingegeben haben.", + IDC_DELETE_FORM_DATA, 10, 98, 230, 30, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Kennwörter\nGespeicherte Kennwörter, die Sie in Formulare eingegeben haben.", + IDC_DELETE_PASSWORDS, 10, 128, 230, 30, BS_TOP | BS_MULTILINE + DEFPUSHBUTTON "&Abbrechen", IDCANCEL, 185, 230, 60, 15, WS_GROUP + PUSHBUTTON "&Löschen", IDOK, 120, 230, 60, 15, WS_GROUP + +END + +/* "Security" propsheet */ +IDD_SECURITY DIALOG 0, 0, 320, 220 +STYLE WS_CAPTION | WS_CHILD | WS_DISABLED +FONT 8, "MS Shell Dlg" +CAPTION "Sicherheit" +BEGIN + + CONTROL "Listview", IDC_SEC_LISTVIEW, "SysListView32", + LVS_ICON | LVS_ALIGNLEFT | LVS_AUTOARRANGE | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_VSCROLL, + 4, 4, 312, 58 + LTEXT "", IDC_SEC_ZONE_INFO, 4, 68, 312, 20 + GROUPBOX "", IDC_SEC_GROUP, 4, 88, 312, 126 + CONTROL "trackbar", IDC_SEC_TRACKBAR, "msctls_trackbar32", + TBS_VERT | TBS_AUTOTICKS | TBS_BOTH | TBS_REVERSED, 8, 98, 32, 100 + LTEXT "", IDC_SEC_LEVEL, 48, 102, 180, 12 + LTEXT "", IDC_SEC_LEVEL_INFO, 48, 114, 260, 80 +END + +/* "Content" propsheet */ +IDD_CONTENT DIALOG 0, 0, 320, 220 +STYLE WS_CAPTION | WS_CHILD | WS_DISABLED +FONT 8, "MS Shell Dlg" +CAPTION "Inhalte" +BEGIN + + GROUPBOX " Zertifikate ", IDC_STATIC, 4, 4, 312, 50 + LTEXT "Zertifikate werden benutzt, um sich persönlich, Zertifizierungsstellen und Herausgeber von Zertifikaten zu identifizieren.", + IDC_STATIC, 58, 14, 252, 18 + PUSHBUTTON "Zertifikate...", IDC_CERT, 146, 34, 80, 14 + PUSHBUTTON "Herausgeber...", IDC_CERT_PUBLISHER, 230, 34, 80, 14 + +END diff --git a/dll/cpl/inetcpl/lang/en-US.rc b/dll/cpl/inetcpl/lang/en-US.rc new file mode 100644 index 00000000000..296864f56eb --- /dev/null +++ b/dll/cpl/inetcpl/lang/en-US.rc @@ -0,0 +1,101 @@ +/* + * English resources for the Internet control panel applet + * + * Copyright 2010 Detlef Riekenberg + * + * 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 "inetcpl.h" + +LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT + +/* "General" propsheet */ +IDD_GENERAL DIALOG 0, 0, 320, 220 +STYLE WS_CAPTION | WS_CHILD | WS_DISABLED +FONT 8, "MS Shell Dlg" +CAPTION "General" +BEGIN + + GROUPBOX " Home page ", IDC_STATIC, 4, 4, 312, 52 + LTEXT "You can choose the address that will be used as your home page.", + IDC_STATIC, 58, 10, 252, 10 + EDITTEXT IDC_HOME_EDIT, 58, 22, 252, 12, WS_VISIBLE | ES_AUTOHSCROLL + PUSHBUTTON "&Current page", IDC_HOME_CURRENT, 58, 36, 80, 14 + PUSHBUTTON "&Default page", IDC_HOME_DEFAULT, 144, 36, 80, 14 + PUSHBUTTON "&Blank page", IDC_HOME_BLANK, 230, 36, 80, 14 + GROUPBOX " Browsing history ", IDC_STATIC, 4, 60, 312, 46 + LTEXT "You can delete cached pages, cookies and other data.", + IDC_STATIC, 58, 72, 252, 10 + PUSHBUTTON "Delete &files...", IDC_HISTORY_DELETE, 144, 86, 80, 14 + PUSHBUTTON "&Settings...", IDC_HISTORY_SETTINGS, 230, 86, 80, 14 + +END + +/* "Delete browsing history" dialog */ +IDD_DELETE_HISTORY DIALOG 0, 0, 250, 250 +STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU +FONT 8, "MS Shell Dlg" +CAPTION "Delete browsing history" +BEGIN + + AUTOCHECKBOX "Temporary internet files\nCached copies of webpages, images and certificates.", + IDC_DELETE_TEMP_FILES, 10, 8, 230, 30, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Cookies\nFiles saved on your computer by websites, which store things like user preferences and login information.", + IDC_DELETE_COOKIES, 10, 38, 230, 30, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "History\nList of websites you have accessed.", + IDC_DELETE_HISTORY, 10, 68, 230, 30, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Form data\nUsernames and other information you have entered into forms.", + IDC_DELETE_FORM_DATA, 10, 98, 230, 30, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Passwords\nSaved passwords you have entered into forms.", + IDC_DELETE_PASSWORDS, 10, 128, 230, 30, BS_TOP | BS_MULTILINE + DEFPUSHBUTTON "Cancel", IDCANCEL, 185, 230, 60, 15, WS_GROUP + PUSHBUTTON "Delete", IDOK, 120, 230, 60, 15, WS_GROUP + +END + +/* "Security" propsheet */ +IDD_SECURITY DIALOG 0, 0, 320, 220 +STYLE WS_CAPTION | WS_CHILD | WS_DISABLED +FONT 8, "MS Shell Dlg" +CAPTION "Security" +BEGIN + + CONTROL "Listview", IDC_SEC_LISTVIEW, "SysListView32", + LVS_ICON | LVS_ALIGNLEFT | LVS_AUTOARRANGE | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_VSCROLL, + 4, 4, 312, 58 + LTEXT "", IDC_SEC_ZONE_INFO, 4, 68, 312, 20 + GROUPBOX "", IDC_SEC_GROUP, 4, 88, 312, 126 + CONTROL "trackbar", IDC_SEC_TRACKBAR, "msctls_trackbar32", + TBS_VERT | TBS_AUTOTICKS | TBS_BOTH | TBS_REVERSED, 8, 98, 32, 100 + LTEXT "", IDC_SEC_LEVEL, 48, 102, 180, 12 + LTEXT "", IDC_SEC_LEVEL_INFO, 48, 114, 260, 80 +END + +/* "Content" propsheet */ +IDD_CONTENT DIALOG 0, 0, 320, 220 +STYLE WS_CAPTION | WS_CHILD | WS_DISABLED +FONT 8, "MS Shell Dlg" +CAPTION "Content" +BEGIN + + GROUPBOX " Certificates ", IDC_STATIC, 4, 4, 312, 50 + LTEXT "Certificates are used for your personal identification and to identify certificate authorities and publishers.", + IDC_STATIC, 58, 14, 252, 18 + PUSHBUTTON "Certificates...", IDC_CERT, 146, 34, 80, 14 + PUSHBUTTON "Publishers...", IDC_CERT_PUBLISHER, 230, 34, 80, 14 + +END diff --git a/dll/cpl/inetcpl/lang/fr-FR.rc b/dll/cpl/inetcpl/lang/fr-FR.rc new file mode 100644 index 00000000000..6c55754b917 --- /dev/null +++ b/dll/cpl/inetcpl/lang/fr-FR.rc @@ -0,0 +1,105 @@ +/* + * Internet control panel applet + * French language support + * + * Copyright 2010-2011 Frédéric Delanoy + * + * 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 "inetcpl.h" + +LANGUAGE LANG_FRENCH, SUBLANG_NEUTRAL + +/* UTF-8 */ +#pragma code_page(65001) + +/* "General" propsheet */ +IDD_GENERAL DIALOG 0, 0, 320, 220 +STYLE WS_CAPTION | WS_CHILD | WS_DISABLED +FONT 8, "MS Shell Dlg" +CAPTION "Général" +BEGIN + + GROUPBOX " Page d'accueil ", IDC_STATIC, 4, 4, 312, 52 + LTEXT "Vous pouvez spécifier l'adresse à utiliser comme page d'accueil :", + IDC_STATIC, 68, 10, 242, 10 + EDITTEXT IDC_HOME_EDIT, 68, 22, 242, 12, WS_VISIBLE | ES_AUTOHSCROLL + PUSHBUTTON "Page &courante", IDC_HOME_CURRENT, 68, 36, 77, 14 + PUSHBUTTON "Page par &défaut", IDC_HOME_DEFAULT, 151, 36, 77, 14 + PUSHBUTTON "Page &blanche", IDC_HOME_BLANK, 233, 36, 77, 14 + GROUPBOX " Historique de navigation ", IDC_STATIC, 4, 60, 312, 46 + LTEXT "Vous pouvez effacer les pages en cache, les cookies et d'autres données.", + IDC_STATIC, 68, 72, 242, 10 + PUSHBUTTON "&Effacer les fichiers...", IDC_HISTORY_DELETE, 151, 86, 77, 14 + PUSHBUTTON "&Paramètres...", IDC_HISTORY_SETTINGS, 233, 86, 77, 14 + +END + +/* "Delete browsing history" dialog */ +IDD_DELETE_HISTORY DIALOG 0, 0, 250, 250 +STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU +FONT 8, "MS Shell Dlg" +CAPTION "Effacer l'historique de navigation" +BEGIN + + AUTOCHECKBOX "Fichiers internet temporaires\nCopies en cache de pages web, d'images et de certificats.", + IDC_DELETE_TEMP_FILES, 10, 8, 230, 30, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Cookies\nDonnées enregistrées sur votre ordinateur par des sites web, telles que préférences utilisateur et informations de connexion.", + IDC_DELETE_COOKIES, 10, 32, 230, 35, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Historique\nListe des sites web accédés.", + IDC_DELETE_HISTORY, 10, 73, 230, 30, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Données de formulaires\nNoms d'utilisateur et autres informations entrées dans des formulaires.", + IDC_DELETE_FORM_DATA, 10, 98, 230, 30, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Mots de passe\nMots de passe entrés dans des formulaires et sauvegardés.", + IDC_DELETE_PASSWORDS, 10, 128, 230, 30, BS_TOP | BS_MULTILINE + DEFPUSHBUTTON "Annuler", IDCANCEL, 185, 228, 60, 15, WS_GROUP + PUSHBUTTON "Effacer", IDOK, 120, 228, 60, 15, WS_GROUP + +END + +/* "Security" propsheet */ +IDD_SECURITY DIALOG 0, 0, 320, 220 +STYLE WS_CAPTION | WS_CHILD | WS_DISABLED +FONT 8, "MS Shell Dlg" +CAPTION "Sécurité" +BEGIN + + CONTROL "Listview", IDC_SEC_LISTVIEW, "SysListView32", + LVS_ICON | LVS_ALIGNLEFT | LVS_AUTOARRANGE | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_VSCROLL, + 4, 4, 312, 58 + LTEXT "", IDC_SEC_ZONE_INFO, 4, 68, 312, 20 + GROUPBOX "", IDC_SEC_GROUP, 4, 88, 312, 126 + CONTROL "trackbar", IDC_SEC_TRACKBAR, "msctls_trackbar32", + TBS_VERT | TBS_AUTOTICKS | TBS_BOTH | TBS_REVERSED, 8, 98, 32, 100 + LTEXT "", IDC_SEC_LEVEL, 48, 102, 180, 12 + LTEXT "", IDC_SEC_LEVEL_INFO, 48, 114, 260, 80 +END + +/* "Content" propsheet */ +IDD_CONTENT DIALOG 0, 0, 320, 220 +STYLE WS_CAPTION | WS_CHILD | WS_DISABLED +FONT 8, "MS Shell Dlg" +CAPTION "Contenu" +BEGIN + + GROUPBOX " Certificats ", IDC_STATIC, 4, 4, 312, 50 + LTEXT "Les certificats sont utilisés pour votre identification personnelle, celle d'autorités de certification ou d'éditeurs.", + IDC_STATIC, 58, 14, 252, 18 + PUSHBUTTON "Certificats...", IDC_CERT, 146, 34, 80, 14 + PUSHBUTTON "Éditeurs...", IDC_CERT_PUBLISHER, 230, 34, 80, 14 + +END diff --git a/dll/cpl/inetcpl/lang/it-IT.rc b/dll/cpl/inetcpl/lang/it-IT.rc new file mode 100644 index 00000000000..566450c9eaa --- /dev/null +++ b/dll/cpl/inetcpl/lang/it-IT.rc @@ -0,0 +1,64 @@ +/* + * Italian resources for the Internet control panel applet + * + * Copyright 2010 Luca Bennati + * + * 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 "inetcpl.h" + +/* UTF-8 */ +#pragma code_page(65001) + +LANGUAGE LANG_LITHUANIAN, SUBLANG_NEUTRAL + +/* "General" propsheet */ +IDD_GENERAL DIALOG 0, 0, 320, 220 +STYLE WS_CAPTION | WS_CHILD | WS_DISABLED +FONT 8, "MS Shell Dlg" +CAPTION "Bendrosios" +BEGIN + + GROUPBOX " Pradžios tinklalapis ", IDC_STATIC, 4, 4, 312, 56 + LTEXT "Galite pasirinkti adresą, kuris bus naudojamas kaip jūsų pradžios tinklalapis.", + IDC_STATIC, 58, 14, 252, 10 + EDITTEXT IDC_HOME_EDIT, 58, 26, 252, 12, WS_VISIBLE | ES_AUTOHSCROLL + PUSHBUTTON "&Dabartinis puslapis", IDC_HOME_CURRENT, 58, 40, 80, 14 + PUSHBUTTON "&Numatytasis puslapis", IDC_HOME_DEFAULT, 144, 40, 80, 14 + PUSHBUTTON "&Tuščias puslapis", IDC_HOME_BLANK, 230, 40, 80, 14 + GROUPBOX " Naršymo istorija ", IDC_STATIC, 4, 60, 312, 46 + LTEXT "Jūs galite pašalinti puslapius podėlyje, slapukus ir kitus duomenis.", + IDC_STATIC, 58, 72, 252, 10 + PUSHBUTTON "Šalinti &failus...", IDC_HISTORY_DELETE, 144, 86, 80, 14 + PUSHBUTTON "Nuo&statos...", IDC_HISTORY_SETTINGS, 230, 86, 80, 14 + +END + +/* "Delete browsing history" dialog */ +IDD_DELETE_HISTORY DIALOG 0, 0, 250, 250 +STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU +FONT 8, "MS Shell Dlg" +CAPTION "Šalinti naršymo istoriją" +BEGIN + + AUTOCHECKBOX "Laikini interneto failai\nTinklalapių kopijos podėlyje, paveikslai, liudijimai.", + IDC_DELETE_TEMP_FILES, 10, 8, 230, 30, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Slapukai\nTinklalapių kompiuteryje išsaugoti failai, kuriuose saugomi naudotojų nustatymai ir prisijungimo informacija.", + IDC_DELETE_COOKIES, 10, 38, 230, 30, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Istorija\nTinklalapių, kuriuos naršėte, sąrašas.", + IDC_DELETE_HISTORY, 10, 68, 230, 30, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Formų duomenys\nNaudotojų vardai ir kita informacija, kurią įvedėte į formas.", + IDC_DELETE_FORM_DATA, 10, 98, 230, 30, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Slaptažodžiai\nIšsaugoti slaptažodžiai, kuriuos įvedėte į formas.", + IDC_DELETE_PASSWORDS, 10, 128, 230, 30, BS_TOP | BS_MULTILINE + DEFPUSHBUTTON "Atsisakyti", IDCANCEL, 185, 230, 60, 15, WS_GROUP + PUSHBUTTON "Šalinti", IDOK, 120, 230, 60, 15, WS_GROUP + +END + +/* "Security" propsheet */ +IDD_SECURITY DIALOG 0, 0, 320, 220 +STYLE WS_CAPTION | WS_CHILD | WS_DISABLED +FONT 8, "MS Shell Dlg" +CAPTION "Saugumas" +BEGIN + + CONTROL "Listview", IDC_SEC_LISTVIEW, "SysListView32", + LVS_ICON | LVS_ALIGNLEFT | LVS_AUTOARRANGE | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_VSCROLL, + 4, 4, 312, 58 + LTEXT "", IDC_SEC_ZONE_INFO, 4, 68, 312, 20 + GROUPBOX "", IDC_SEC_GROUP, 4, 88, 312, 126 + CONTROL "trackbar", IDC_SEC_TRACKBAR, "msctls_trackbar32", + TBS_VERT | TBS_AUTOTICKS | TBS_BOTH | TBS_REVERSED, 8, 98, 32, 100 + LTEXT "", IDC_SEC_LEVEL, 48, 102, 180, 12 + LTEXT "", IDC_SEC_LEVEL_INFO, 48, 114, 260, 80 +END + +/* "Content" propsheet */ +IDD_CONTENT DIALOG 0, 0, 320, 220 +STYLE WS_CAPTION | WS_CHILD | WS_DISABLED +FONT 8, "MS Shell Dlg" +CAPTION "Turinys" +BEGIN + + GROUPBOX " Liudijimai ", IDC_STATIC, 4, 4, 312, 50 + LTEXT "Liudijimai yra naudojami jūsų tapatumo nustatymui ir liudijimo įstaigų bei publikuotojų tapatumui nustatyti.", + IDC_STATIC, 58, 14, 252, 18 + PUSHBUTTON "Liudijimai...", IDC_CERT, 146, 34, 80, 14 + PUSHBUTTON "Publikuotojai...", IDC_CERT_PUBLISHER, 230, 34, 80, 14 + +END diff --git a/dll/cpl/inetcpl/lang/nl-NL.rc b/dll/cpl/inetcpl/lang/nl-NL.rc new file mode 100644 index 00000000000..5d5fb520de2 --- /dev/null +++ b/dll/cpl/inetcpl/lang/nl-NL.rc @@ -0,0 +1,61 @@ +/* + * Dutch resources for the Internet control panel applet + * + * Copyright 2010 Sven Baars + * + * 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 "inetcpl.h" + +LANGUAGE LANG_DUTCH, SUBLANG_NEUTRAL + +/* "General" propsheet */ +IDD_GENERAL DIALOG 0, 0, 320, 220 +STYLE WS_CAPTION | WS_CHILD | WS_DISABLED +FONT 8, "MS Shell Dlg" +CAPTION "Algemeen" +BEGIN + + GROUPBOX " Startpagina ", IDC_STATIC, 4, 4, 312, 52 + LTEXT "Hier kunt u het adres kiezen dat gebruikt wordt als uw startpagina.", + IDC_STATIC, 58, 10, 252, 10 + EDITTEXT IDC_HOME_EDIT, 58, 22, 252, 12, WS_VISIBLE | ES_AUTOHSCROLL + PUSHBUTTON "&Huidige pagina", IDC_HOME_CURRENT, 58, 36, 80, 14 + PUSHBUTTON "&Standaardpagina", IDC_HOME_DEFAULT, 144, 36, 80, 14 + PUSHBUTTON "&Lege pagina", IDC_HOME_BLANK, 230, 36, 80, 14 + GROUPBOX " Browsing history ", IDC_STATIC, 4, 60, 312, 46 + LTEXT "You can delete cached pages, cookies and other data.", + IDC_STATIC, 58, 72, 252, 10 + PUSHBUTTON "Delete &files...", IDC_HISTORY_DELETE, 144, 86, 80, 14 + PUSHBUTTON "&Settings...", IDC_HISTORY_SETTINGS, 230, 86, 80, 14 + +END + +/* "Content" propsheet */ +IDD_CONTENT DIALOG 0, 0, 320, 220 +STYLE WS_CAPTION | WS_CHILD | WS_DISABLED +FONT 8, "MS Shell Dlg" +CAPTION "Inhoud" +BEGIN + + GROUPBOX " Certificaten ", IDC_STATIC, 4, 4, 312, 50 + LTEXT "Certificaten worden gebruikt voor uw persoonlijke identificatie en om certificaat-autoriteiten en uitgevers te identificeren.", + IDC_STATIC, 58, 14, 252, 18 + PUSHBUTTON "Certificaten...", IDC_CERT, 146, 34, 80, 14 + PUSHBUTTON "Uitgevers...", IDC_CERT_PUBLISHER, 230, 34, 80, 14 + +END diff --git a/dll/cpl/inetcpl/lang/pl-PL.rc b/dll/cpl/inetcpl/lang/pl-PL.rc new file mode 100644 index 00000000000..d3dd98224aa --- /dev/null +++ b/dll/cpl/inetcpl/lang/pl-PL.rc @@ -0,0 +1,104 @@ +/* + * Internet control panel applet + * + * Copyright 2010 Łukasz Wojniłowicz + * + * 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 "inetcpl.h" + +LANGUAGE LANG_POLISH, SUBLANG_DEFAULT + +/* UTF-8 */ +#pragma code_page(65001) + +/* "General" propsheet */ +IDD_GENERAL DIALOG 0, 0, 320, 220 +STYLE WS_CAPTION | WS_CHILD | WS_DISABLED +FONT 8, "MS Shell Dlg" +CAPTION "Ogólne" +BEGIN + + GROUPBOX " Strona domowa ", IDC_STATIC, 4, 4, 312, 52 + LTEXT "Możesz wybrać adres strony, która będzie twoją stroną domową.", + IDC_STATIC, 58, 10, 252, 10 + EDITTEXT IDC_HOME_EDIT, 58, 22, 252, 12, WS_VISIBLE | ES_AUTOHSCROLL + PUSHBUTTON "Użyj &bieżącej", IDC_HOME_CURRENT, 58, 36, 80, 14 + PUSHBUTTON "Użyj d&omyślnej", IDC_HOME_DEFAULT, 144, 36, 80, 14 + PUSHBUTTON "Użyj pu&stej", IDC_HOME_BLANK, 230, 36, 80, 14 + GROUPBOX " Historia przeglądania ", IDC_STATIC, 4, 60, 312, 46 + LTEXT "Możesz usunąć przechowywane strony, ciasteczka i inne dane.", + IDC_STATIC, 58, 72, 252, 10 + PUSHBUTTON "&Usuń pliki...", IDC_HISTORY_DELETE, 144, 86, 80, 14 + PUSHBUTTON "Ustawie&nia...", IDC_HISTORY_SETTINGS, 230, 86, 80, 14 + +END + +/* "Delete browsing history" dialog */ +IDD_DELETE_HISTORY DIALOG 0, 0, 250, 250 +STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU +FONT 8, "MS Shell Dlg" +CAPTION "Usuwanie historii przeglądania" +BEGIN + + AUTOCHECKBOX "Tymczasowe pliki internetowe\nKopie stron sieci Web, obrazów i certyfikatów.", + IDC_DELETE_TEMP_FILES, 10, 8, 230, 30, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Pliki cookies\nPliki przechowywane na komputerze przez witryny sieci Web w celu zapisania preferencji takich jak informacje logowania.", + IDC_DELETE_COOKIES, 10, 38, 230, 30, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Historia\nLista odwiedzonych witryn sieci Web.", + IDC_DELETE_HISTORY, 10, 68, 230, 30, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Dane formularzy\nZapisane informacje, które zostały wpisane w formularzach.", + IDC_DELETE_FORM_DATA, 10, 98, 230, 30, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Hasła\nHasła uzupełniane automatycznie po zalogowaniu się do wcześniej odwiedzonej witryny Web.", + IDC_DELETE_PASSWORDS, 10, 128, 230, 30, BS_TOP | BS_MULTILINE + DEFPUSHBUTTON "Anuluj", IDCANCEL, 185, 230, 60, 15, WS_GROUP + PUSHBUTTON "Usuń", IDOK, 120, 230, 60, 15, WS_GROUP + +END + +/* "Security" propsheet */ +IDD_SECURITY DIALOG 0, 0, 320, 220 +STYLE WS_CAPTION | WS_CHILD | WS_DISABLED +FONT 8, "MS Shell Dlg" +CAPTION "Bezpieczeństwo" +BEGIN + + CONTROL "Listview", IDC_SEC_LISTVIEW, "SysListView32", + LVS_ICON | LVS_ALIGNLEFT | LVS_AUTOARRANGE | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_VSCROLL, + 4, 4, 312, 58 + LTEXT "", IDC_SEC_ZONE_INFO, 4, 68, 312, 20 + GROUPBOX "", IDC_SEC_GROUP, 4, 88, 312, 126 + CONTROL "trackbar", IDC_SEC_TRACKBAR, "msctls_trackbar32", + TBS_VERT | TBS_AUTOTICKS | TBS_BOTH | TBS_REVERSED, 8, 98, 32, 100 + LTEXT "", IDC_SEC_LEVEL, 48, 102, 180, 12 + LTEXT "", IDC_SEC_LEVEL_INFO, 48, 114, 260, 80 +END + +/* "Content" propsheet */ +IDD_CONTENT DIALOG 0, 0, 320, 220 +STYLE WS_CAPTION | WS_CHILD | WS_DISABLED +FONT 8, "MS Shell Dlg" +CAPTION "Zawartość" +BEGIN + + GROUPBOX " Certyfikaty ", IDC_STATIC, 4, 4, 312, 50 + LTEXT "Certyfikaty są używane do twojej osobistej identyfikacji oraz do identyfikacji wydawców i urzędów certyfikujących.", + IDC_STATIC, 58, 14, 252, 18 + PUSHBUTTON "Certyfikaty...", IDC_CERT, 146, 34, 80, 14 + PUSHBUTTON "Wydawcy...", IDC_CERT_PUBLISHER, 230, 34, 80, 14 + +END diff --git a/dll/cpl/inetcpl/lang/pt-PT.rc b/dll/cpl/inetcpl/lang/pt-PT.rc new file mode 100644 index 00000000000..5be8c1a6ba9 --- /dev/null +++ b/dll/cpl/inetcpl/lang/pt-PT.rc @@ -0,0 +1,63 @@ +/* + * Portuguese resources for the Internet control panel applet + * + * Copyright 2010 Gustavo Henrique Milaré + * + * 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 "inetcpl.h" + +#pragma code_page(65001) + +LANGUAGE LANG_PORTUGUESE, SUBLANG_PORTUGUESE_BRAZILIAN + +/* "General" propsheet */ +IDD_GENERAL DIALOG 0, 0, 320, 220 +STYLE WS_CAPTION | WS_CHILD | WS_DISABLED +FONT 8, "MS Shell Dlg" +CAPTION "Geral" +BEGIN + + GROUPBOX " Página inicial ", IDC_STATIC, 4, 4, 312, 52 + LTEXT "Escolha o endereço que será usado como página inicial.", + IDC_STATIC, 58, 10, 252, 10 + EDITTEXT IDC_HOME_EDIT, 58, 22, 252, 12, WS_VISIBLE | ES_AUTOHSCROLL + PUSHBUTTON "Página &atual", IDC_HOME_CURRENT, 58, 36, 80, 14 + PUSHBUTTON "Página &padrão", IDC_HOME_DEFAULT, 144, 36, 80, 14 + PUSHBUTTON "Página em &branco", IDC_HOME_BLANK, 230, 36, 80, 14 + GROUPBOX " Browsing history ", IDC_STATIC, 4, 60, 312, 46 + LTEXT "You can delete cached pages, cookies and other data.", + IDC_STATIC, 58, 72, 252, 10 + PUSHBUTTON "Delete &files...", IDC_HISTORY_DELETE, 144, 86, 80, 14 + PUSHBUTTON "&Settings...", IDC_HISTORY_SETTINGS, 230, 86, 80, 14 + +END + +/* "Content" propsheet */ +IDD_CONTENT DIALOG 0, 0, 320, 220 +STYLE WS_CAPTION | WS_CHILD | WS_DISABLED +FONT 8, "MS Shell Dlg" +CAPTION "Conteúdo" +BEGIN + + GROUPBOX " Certificados ", IDC_STATIC, 4, 4, 312, 50 + LTEXT "Certificados são usados para sua identificação pessoal e para identificar certificados de autoridades e editores.", + IDC_STATIC, 58, 14, 252, 18 + PUSHBUTTON "Certificados...", IDC_CERT, 146, 34, 80, 14 + PUSHBUTTON "Editores...", IDC_CERT_PUBLISHER, 230, 34, 80, 14 + +END diff --git a/dll/cpl/inetcpl/lang/ru-RU.rc b/dll/cpl/inetcpl/lang/ru-RU.rc new file mode 100644 index 00000000000..98b809d0328 --- /dev/null +++ b/dll/cpl/inetcpl/lang/ru-RU.rc @@ -0,0 +1,105 @@ +/* + * Russian resources for the Internet control panel applet + * + * Copyright 2011 Alexander Lakhin + * + * 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 "inetcpl.h" + +/* UTF-8 */ +#pragma code_page(65001) + +LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT + +/* "General" propsheet */ +IDD_GENERAL DIALOG 0, 0, 320, 220 +STYLE WS_CAPTION | WS_CHILD | WS_DISABLED +FONT 8, "MS Shell Dlg" +CAPTION "Общие" +BEGIN + + GROUPBOX " Домашняя страница ", IDC_STATIC, 4, 4, 312, 52 + LTEXT "Укажите адрес для вашей домашней страницы:", + IDC_STATIC, 58, 14, 252, 8 + EDITTEXT IDC_HOME_EDIT, 58, 22, 252, 12, WS_VISIBLE | ES_AUTOHSCROLL + PUSHBUTTON "&Текущая страница", IDC_HOME_CURRENT, 58, 36, 80, 14 + PUSHBUTTON "&По умолчанию", IDC_HOME_DEFAULT, 144, 36, 80, 14 + PUSHBUTTON "Пу&стая страница", IDC_HOME_BLANK, 230, 36, 80, 14 + GROUPBOX " История использования браузера ", IDC_STATIC, 4, 60, 312, 46 + LTEXT "Вы можете удалить кэшированные страницы, файлы cookies и другие данные.", + IDC_STATIC, 58, 72, 252, 10 + PUSHBUTTON "Удалить &файлы...", IDC_HISTORY_DELETE, 144, 86, 80, 14 + PUSHBUTTON "&Настройки...", IDC_HISTORY_SETTINGS, 230, 86, 80, 14 + +END + +/* "Delete browsing history" dialog */ +IDD_DELETE_HISTORY DIALOG 0, 0, 250, 250 +STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU +FONT 8, "MS Shell Dlg" +CAPTION "Очистка истории" +BEGIN + + AUTOCHECKBOX "Временные файлы\nКэшированные копии страниц, изображений и сертификатов.", + IDC_DELETE_TEMP_FILES, 10, 8, 230, 30, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Файлы cookies\nФайлы, сохранённые на вашем компьютере, могут содержать пользовательские настройки и информацию для авторизации.", + IDC_DELETE_COOKIES, 10, 38, 230, 30, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "История\nПеречень сайтов, к которым осуществлялся доступ.", + IDC_DELETE_HISTORY, 10, 68, 230, 30, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Данные веб-форм\nИмена пользователя и другая информация, которая использовалась при заполнении форм.", + IDC_DELETE_FORM_DATA, 10, 98, 230, 30, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Пароли\nСохранённые пароли, которые были указаны в веб-формах.", + IDC_DELETE_PASSWORDS, 10, 128, 230, 30, BS_TOP | BS_MULTILINE + DEFPUSHBUTTON "Отмена", IDCANCEL, 185, 230, 60, 15, WS_GROUP + PUSHBUTTON "Удалить", IDOK, 120, 230, 60, 15, WS_GROUP + +END + +/* "Security" propsheet */ +IDD_SECURITY DIALOG 0, 0, 320, 220 +STYLE WS_CAPTION | WS_CHILD | WS_DISABLED +FONT 8, "MS Shell Dlg" +CAPTION "Безопасность" +BEGIN + + CONTROL "Listview", IDC_SEC_LISTVIEW, "SysListView32", + LVS_ICON | LVS_ALIGNLEFT | LVS_AUTOARRANGE | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_VSCROLL, + 4, 4, 312, 58 + LTEXT "", IDC_SEC_ZONE_INFO, 4, 68, 312, 20 + GROUPBOX "", IDC_SEC_GROUP, 4, 88, 312, 126 + CONTROL "trackbar", IDC_SEC_TRACKBAR, "msctls_trackbar32", + TBS_VERT | TBS_AUTOTICKS | TBS_BOTH | TBS_REVERSED, 8, 98, 32, 100 + LTEXT "", IDC_SEC_LEVEL, 48, 102, 180, 12 + LTEXT "", IDC_SEC_LEVEL_INFO, 48, 114, 260, 80 + +END + +/* "Content" propsheet */ +IDD_CONTENT DIALOG 0, 0, 320, 220 +STYLE WS_CAPTION | WS_CHILD | WS_DISABLED +FONT 8, "MS Shell Dlg" +CAPTION "Содержание" +BEGIN + + GROUPBOX " Сертификаты ", IDC_STATIC, 4, 4, 312, 50 + LTEXT "Сертификаты используются для идентификации личности, а также для проверки подлинности центров сертификации и издателей.", + IDC_STATIC, 58, 14, 252, 18 + PUSHBUTTON "Сертификаты...", IDC_CERT, 146, 34, 80, 14 + PUSHBUTTON "Издатели...", IDC_CERT_PUBLISHER, 230, 34, 80, 14 + +END diff --git a/dll/cpl/inetcpl/lang/sv-SE.rc b/dll/cpl/inetcpl/lang/sv-SE.rc new file mode 100644 index 00000000000..997fd31a04e --- /dev/null +++ b/dll/cpl/inetcpl/lang/sv-SE.rc @@ -0,0 +1,63 @@ +/* + * Swedish resources for the Internet control panel applet + * + * Copyright 2010 Anders Jonsson + * + * 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 "inetcpl.h" + +#pragma code_page(65001) + +LANGUAGE LANG_SWEDISH, SUBLANG_NEUTRAL + +/* "General" propsheet */ +IDD_GENERAL DIALOG 0, 0, 320, 220 +STYLE WS_CAPTION | WS_CHILD | WS_DISABLED +FONT 8, "MS Shell Dlg" +CAPTION "Allmänt" +BEGIN + + GROUPBOX " Startsida ", IDC_STATIC, 4, 4, 312, 52 + LTEXT "Du kan välja vilken adress som ska användas som startsida.", + IDC_STATIC, 58, 10, 252, 10 + EDITTEXT IDC_HOME_EDIT, 58, 22, 252, 12, WS_VISIBLE | ES_AUTOHSCROLL + PUSHBUTTON "&Aktuell sida", IDC_HOME_CURRENT, 58, 36, 80, 14 + PUSHBUTTON "För&vald sida", IDC_HOME_DEFAULT, 144, 36, 80, 14 + PUSHBUTTON "&Blank sida", IDC_HOME_BLANK, 230, 36, 80, 14 + GROUPBOX " Bläddringshistorik ", IDC_STATIC, 4, 60, 312, 46 + LTEXT "Du kan ta bort cachade sidor, kakor och annan data.", + IDC_STATIC, 58, 72, 252, 10 + PUSHBUTTON "Ta bort &filer...", IDC_HISTORY_DELETE, 144, 86, 80, 14 + PUSHBUTTON "&Inställningar...", IDC_HISTORY_SETTINGS, 230, 86, 80, 14 + +END + +/* "Content" propsheet */ +IDD_CONTENT DIALOG 0, 0, 320, 220 +STYLE WS_CAPTION | WS_CHILD | WS_DISABLED +FONT 8, "MS Shell Dlg" +CAPTION "Innehåll" +BEGIN + + GROUPBOX " Certifikat ", IDC_STATIC, 4, 4, 312, 50 + LTEXT "Certifikat används för din personliga identifikation samt för att identifiera certifikats-auktoriteter och -utgivare.", + IDC_STATIC, 58, 14, 252, 18 + PUSHBUTTON "Certifikat...", IDC_CERT, 146, 34, 80, 14 + PUSHBUTTON "Utgivare...", IDC_CERT_PUBLISHER, 230, 34, 80, 14 + +END diff --git a/dll/cpl/inetcpl/lang/uk-UA.rc b/dll/cpl/inetcpl/lang/uk-UA.rc new file mode 100644 index 00000000000..102fb0cc999 --- /dev/null +++ b/dll/cpl/inetcpl/lang/uk-UA.rc @@ -0,0 +1,65 @@ +/* + * Internet control panel applet + * + * Copyright 2010 Detlef Riekenberg + * Copyright 2010 Igor Paliychuk + * + * 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 "inetcpl.h" + +/* UTF-8 */ +#pragma code_page(65001) + +LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT + +/* "General" propsheet */ +IDD_GENERAL DIALOG 0, 0, 320, 220 +STYLE WS_CAPTION | WS_CHILD | WS_DISABLED +FONT 8, "MS Shell Dlg" +CAPTION "Загальні" +BEGIN + + GROUPBOX " Домашня сторінка ", IDC_STATIC, 4, 4, 312, 52 + LTEXT "Ви можете вказати адресу, що буде використана як домашня сторінка.", + IDC_STATIC, 58, 12, 252, 10 + EDITTEXT IDC_HOME_EDIT, 58, 22, 252, 12, WS_VISIBLE | ES_AUTOHSCROLL + PUSHBUTTON "&Поточна сторінка", IDC_HOME_CURRENT, 58, 36, 80, 14 + PUSHBUTTON "&За замовчуванням", IDC_HOME_DEFAULT, 144, 36, 80, 14 + PUSHBUTTON "По&рожня сторінка", IDC_HOME_BLANK, 230, 36, 80, 14 + GROUPBOX " Browsing history ", IDC_STATIC, 4, 60, 312, 46 + LTEXT "You can delete cached pages, cookies and other data.", + IDC_STATIC, 58, 72, 252, 10 + PUSHBUTTON "Delete &files...", IDC_HISTORY_DELETE, 144, 86, 80, 14 + PUSHBUTTON "&Settings...", IDC_HISTORY_SETTINGS, 230, 86, 80, 14 + +END + +/* "Content" propsheet */ +IDD_CONTENT DIALOG 0, 0, 320, 220 +STYLE WS_CAPTION | WS_CHILD | WS_DISABLED +FONT 8, "MS Shell Dlg" +CAPTION "Вміст" +BEGIN + + GROUPBOX " Сертифікати ", IDC_STATIC, 4, 4, 312, 50 + LTEXT "Сертифікати використовуються для вашої ідентифікації та для ідентифікації органів сертифікації та видавців.", + IDC_STATIC, 58, 14, 252, 18 + PUSHBUTTON "Сертифікати...", IDC_CERT, 146, 34, 80, 14 + PUSHBUTTON "Видавці...", IDC_CERT_PUBLISHER, 230, 34, 80, 14 + +END diff --git a/dll/cpl/inetcpl/security.c b/dll/cpl/inetcpl/security.c new file mode 100644 index 00000000000..118718533b1 --- /dev/null +++ b/dll/cpl/inetcpl/security.c @@ -0,0 +1,444 @@ +/* + * Internet control panel applet: security propsheet + * + * Copyright 2011 Detlef Riekenberg + * + * 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 + * + */ + +#define COBJMACROS +#define CONST_VTABLE +#define NONAMELESSUNION + +#include +#include +#include +#include +#include +#include "commctrl.h" + +#include "ole2.h" +#include "urlmon.h" +#include "initguid.h" +#include "winreg.h" +#include "shlwapi.h" + +#include "inetcpl.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(inetcpl); + +typedef struct secdlg_data_s { + HWND hsec; /* security propsheet */ + HWND hlv; /* listview */ + HWND htb; /* trackbar */ + IInternetSecurityManager *sec_mgr; + IInternetZoneManager *zone_mgr; + DWORD zone_enumerator; + DWORD num_zones; + ZONEATTRIBUTES *zone_attr; + DWORD *zones; + DWORD *levels; + HIMAGELIST himages; + DWORD last_lv_index; + DWORD last_level; +} secdlg_data; + +#define NUM_TRACKBAR_POS 5 + +static WCHAR spaceW[] = {' ',0}; +static DWORD url_templates[] = {URLTEMPLATE_CUSTOM, + URLTEMPLATE_LOW, + URLTEMPLATE_MEDLOW, + URLTEMPLATE_MEDIUM, + URLTEMPLATE_MEDHIGH, + URLTEMPLATE_HIGH}; + +/********************************************************************* + * index_from_urltemplate [internal] + * + */ +static DWORD index_from_urltemplate(URLTEMPLATE value) +{ + + DWORD index = sizeof(url_templates) / sizeof(url_templates[0]); + + while((index > 0) && (url_templates[index-1] != value)) + index--; + + index--; /* table entries are 0 based */ + if (!index && value) + FIXME("URLTEMPLATE 0x%x not supported\n", value); + + TRACE("URLTEMPLATE 0x%08x=> Level %d\n", value, index); + return index; +} + +/********************************************************************* + * update_security_level [internal] + * + */ +static void update_security_level(secdlg_data *sd, DWORD lv_index, DWORD tb_index) +{ + WCHAR name[512]; + DWORD current_index; + + TRACE("(%p, lv_index: %u, tb_index: %u)\n", sd, lv_index, tb_index); + + if ((sd->levels[lv_index] != sd->last_level) || (tb_index > 0)) { + /* show or hide the trackbar */ + if (!sd->levels[lv_index] || !sd->last_level) + ShowWindow(sd->htb, sd->levels[lv_index] ? SW_NORMAL : SW_HIDE); + + current_index = (tb_index > 0) ? tb_index : index_from_urltemplate(sd->levels[lv_index]); + + name[0] = 0; + LoadStringW(hcpl, IDS_SEC_LEVEL0 + current_index, name, sizeof(name)/sizeof(name[0])); + TRACE("new level #%d: %s\n", current_index, debugstr_w(name)); + SetWindowTextW(GetDlgItem(sd->hsec, IDC_SEC_LEVEL), name); + + name[0] = 0; + LoadStringW(hcpl, IDS_SEC_LEVEL0_INFO + (current_index * 0x10), name, sizeof(name)/sizeof(name[0])); + TRACE("new level info: %s\n", debugstr_w(name)); + SetWindowTextW(GetDlgItem(sd->hsec, IDC_SEC_LEVEL_INFO), name); + + if (current_index) + SendMessageW(sd->htb, TBM_SETPOS, TRUE, NUM_TRACKBAR_POS - current_index); + + sd->last_level = sd->levels[lv_index]; + + } +} + +/********************************************************************* + * update_zone_info [internal] + * + */ +static void update_zone_info(secdlg_data *sd, DWORD lv_index) +{ + ZONEATTRIBUTES *za = &sd->zone_attr[lv_index]; + WCHAR name[MAX_PATH]; + DWORD len; + + SetWindowTextW(GetDlgItem(sd->hsec, IDC_SEC_ZONE_INFO), za->szDescription); + + name[0] = ' '; + name[1] = 0; + + LoadStringW(hcpl, IDS_SEC_SETTINGS, &name[1], sizeof(name)/sizeof(name[0]) - 3); + len = lstrlenW(name); + lstrcpynW(&name[len], za->szDisplayName, sizeof(name)/sizeof(name[0]) - len - 3); + lstrcatW(name, spaceW); + + TRACE("new title: %s\n", debugstr_w(name)); + SetWindowTextW(GetDlgItem(sd->hsec, IDC_SEC_GROUP), name); + + update_security_level(sd, lv_index, 0); + sd->last_lv_index = lv_index; +} + +/********************************************************************* + * add_zone_to_listview [internal] + * + */ +static void add_zone_to_listview(secdlg_data *sd, DWORD *pindex, DWORD zone) +{ + DWORD lv_index = *pindex; + ZONEATTRIBUTES *za = &sd->zone_attr[lv_index]; + LVITEMW lvitem; + HRESULT hr; + INT iconid = 0; + HMODULE hdll = NULL; + WCHAR * ptr; + HICON icon; + + TRACE("item %d (zone %d)\n", lv_index, zone); + + sd->zones[lv_index] = zone; + + memset(&lvitem, 0, sizeof(LVITEMW)); + memset(za, 0, sizeof(ZONEATTRIBUTES)); + za->cbSize = sizeof(ZONEATTRIBUTES); + hr = IInternetZoneManager_GetZoneAttributes(sd->zone_mgr, zone, za); + if (SUCCEEDED(hr)) { + TRACE("displayname: %s\n", debugstr_w(za->szDisplayName)); + TRACE("description: %s\n", debugstr_w(za->szDescription)); + TRACE("minlevel: 0x%x, recommended: 0x%x, current: 0x%x (flags: 0x%x)\n", za->dwTemplateMinLevel, + za->dwTemplateRecommended, za->dwTemplateCurrentLevel, za->dwFlags); + + if (za->dwFlags & ZAFLAGS_NO_UI ) { + TRACE("item %d (zone %d): UI disabled for %s\n", lv_index, zone, debugstr_w(za->szDisplayName)); + return; + } + + sd->levels[lv_index] = za->dwTemplateCurrentLevel; + + lvitem.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM; + lvitem.iItem = lv_index; + lvitem.iSubItem = 0; + lvitem.pszText = za->szDisplayName; + lvitem.lParam = (LPARAM) zone; + + /* format is "filename.ext#iconid" */ + ptr = StrChrW(za->szIconPath, '#'); + if (ptr) { + *ptr = 0; + ptr++; + iconid = StrToIntW(ptr); + hdll = LoadLibraryExW(za->szIconPath, NULL, LOAD_LIBRARY_AS_DATAFILE); + TRACE("%p: icon #%d from %s\n", hdll, iconid, debugstr_w(za->szIconPath)); + + icon = LoadImageW(hdll, MAKEINTRESOURCEW(iconid), IMAGE_ICON, GetSystemMetrics(SM_CXICON), + GetSystemMetrics(SM_CYICON), LR_SHARED); + + if (!icon) { + FIXME("item %d (zone %d): missing icon #%d in %s\n", lv_index, zone, iconid, debugstr_w(za->szIconPath)); + } + + /* the failure result (NULL) from LoadImageW let ImageList_AddIcon fail + with -1, which is reused in ListView_InsertItemW to disable the image */ + lvitem.iImage = ImageList_AddIcon(sd->himages, icon); + } + else + FIXME("item %d (zone %d): malformed szIconPath %s\n", lv_index, zone, debugstr_w(za->szIconPath)); + + if (ListView_InsertItemW(sd->hlv, &lvitem) >= 0) { + /* activate first item in the listview */ + if (! lv_index) { + lvitem.state = LVIS_FOCUSED | LVIS_SELECTED; + lvitem.stateMask = LVIS_FOCUSED | LVIS_SELECTED; + SendMessageW(sd->hlv, LVM_SETITEMSTATE, 0, (LPARAM) &lvitem); + sd->last_level = ~0; + update_zone_info(sd, lv_index); + } + (*pindex)++; + } + FreeLibrary(hdll); + } + else + FIXME("item %d (zone %d): GetZoneAttributes failed with 0x%x\n", lv_index, zone, hr); +} + +/********************************************************************* + * security_cleanup_zones [internal] + * + */ +static void security_cleanup_zones(secdlg_data *sd) +{ + if (sd->zone_enumerator) { + IInternetZoneManager_DestroyZoneEnumerator(sd->zone_mgr, sd->zone_enumerator); + } + + if (sd->zone_mgr) { + IInternetZoneManager_Release(sd->zone_mgr); + } + + if (sd->sec_mgr) { + IInternetSecurityManager_Release(sd->sec_mgr); + } +} + +/********************************************************************* + * security_enum_zones [internal] + * + */ +static HRESULT security_enum_zones(secdlg_data * sd) +{ + HRESULT hr; + + hr = CoInternetCreateSecurityManager(NULL, &sd->sec_mgr, 0); + if (SUCCEEDED(hr)) { + hr = CoInternetCreateZoneManager(NULL, &sd->zone_mgr, 0); + if (SUCCEEDED(hr)) { + hr = IInternetZoneManager_CreateZoneEnumerator(sd->zone_mgr, &sd->zone_enumerator, &sd->num_zones, 0); + } + } + return hr; +} + +/********************************************************************* + * security_on_destroy [internal] + * + * handle WM_NCDESTROY + * + */ +static INT_PTR security_on_destroy(secdlg_data * sd) +{ + TRACE("(%p)\n", sd); + + heap_free(sd->zone_attr); + heap_free(sd->zones); + if (sd->himages) { + SendMessageW(sd->hlv, LVM_SETIMAGELIST, LVSIL_NORMAL, 0); + ImageList_Destroy(sd->himages); + } + + security_cleanup_zones(sd); + SetWindowLongPtrW(sd->hsec, DWLP_USER, 0); + heap_free(sd); + return TRUE; +} + +/********************************************************************* + * security_on_initdialog [internal] + * + * handle WM_INITDIALOG + * + */ +static INT_PTR security_on_initdialog(HWND hsec) +{ + secdlg_data *sd; + HRESULT hr; + DWORD current_zone; + DWORD lv_index = 0; + DWORD i; + + sd = heap_alloc_zero(sizeof(secdlg_data)); + SetWindowLongPtrW(hsec, DWLP_USER, (LONG_PTR) sd); + if (!sd) { + return FALSE; + } + + sd->hsec = hsec; + sd->hlv = GetDlgItem(hsec, IDC_SEC_LISTVIEW); + sd->htb = GetDlgItem(hsec, IDC_SEC_TRACKBAR); + + EnableWindow(sd->htb, FALSE); /* not changeable yet */ + + TRACE("(%p) (data: %p, listview: %p, trackbar: %p)\n", hsec, sd, sd->hlv, sd->htb); + + SendMessageW(sd->htb, TBM_SETRANGE, FALSE, MAKELONG(0, NUM_TRACKBAR_POS - 1)); + SendMessageW(sd->htb, TBM_SETTICFREQ, 1, 0 ); + + /* Create the image lists for the listview */ + sd->himages = ImageList_Create(GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), ILC_COLOR32 | ILC_MASK, 1, 1); + + TRACE("using imagelist: %p\n", sd->himages); + if (!sd->himages) { + ERR("ImageList_Create failed!\n"); + return FALSE; + } + SendMessageW(sd->hlv, LVM_SETIMAGELIST, LVSIL_NORMAL, (LPARAM)sd->himages); + + hr = security_enum_zones(sd); + if (FAILED(hr)) { + ERR("got 0x%x\n", hr); + security_on_destroy(sd); + return FALSE; + } + + TRACE("found %d zones\n", sd->num_zones); + + /* remember ZONEATTRIBUTES for a listview entry */ + sd->zone_attr = heap_alloc(sizeof(ZONEATTRIBUTES) * sd->num_zones); + if (!sd->zone_attr) { + security_on_destroy(sd); + return FALSE; + } + + /* remember zone number and current security level for a listview entry */ + sd->zones = heap_alloc((sizeof(DWORD) + sizeof(DWORD)) * sd->num_zones); + if (!sd->zones) { + security_on_destroy(sd); + return FALSE; + } + sd->levels = &sd->zones[sd->num_zones]; + + /* use the same order as visible with native inetcpl.cpl */ + add_zone_to_listview(sd, &lv_index, URLZONE_INTERNET); + add_zone_to_listview(sd, &lv_index, URLZONE_INTRANET); + add_zone_to_listview(sd, &lv_index, URLZONE_TRUSTED); + add_zone_to_listview(sd, &lv_index, URLZONE_UNTRUSTED); + + for (i = 0; i < sd->num_zones; i++) + { + hr = IInternetZoneManager_GetZoneAt(sd->zone_mgr, sd->zone_enumerator, i, ¤t_zone); + if (SUCCEEDED(hr) && (current_zone != (DWORD)URLZONE_INVALID)) { + if (!current_zone || (current_zone > URLZONE_UNTRUSTED)) { + add_zone_to_listview(sd, &lv_index, current_zone); + } + } + } + return TRUE; +} + +/********************************************************************* + * security_on_notify [internal] + * + * handle WM_NOTIFY + * + */ +static INT_PTR security_on_notify(secdlg_data *sd, WPARAM wparam, LPARAM lparam) +{ + NMLISTVIEW *nm; + + nm = (NMLISTVIEW *) lparam; + switch (nm->hdr.code) + { + case LVN_ITEMCHANGED: + TRACE("LVN_ITEMCHANGED (0x%lx, 0x%lx) from %p with code: %d (item: %d, uNewState: %u)\n", + wparam, lparam, nm->hdr.hwndFrom, nm->hdr.code, nm->iItem, nm->uNewState); + if ((nm->uNewState & LVIS_SELECTED) == LVIS_SELECTED) { + update_zone_info(sd, nm->iItem); + } + break; + + case PSN_APPLY: + TRACE("PSN_APPLY (0x%lx, 0x%lx) from %p with code: %d\n", wparam, lparam, + nm->hdr.hwndFrom, nm->hdr.code); + break; + + default: + TRACE("WM_NOTIFY (0x%lx, 0x%lx) from %p with code: %d\n", wparam, lparam, + nm->hdr.hwndFrom, nm->hdr.code); + + } + return FALSE; +} + +/********************************************************************* + * security_dlgproc [internal] + * + */ +INT_PTR CALLBACK security_dlgproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) +{ + secdlg_data *sd; + + if (msg == WM_INITDIALOG) { + return security_on_initdialog(hwnd); + } + + sd = (secdlg_data *)GetWindowLongPtrW(hwnd, DWLP_USER); + if (sd) { + switch (msg) + { + case WM_NOTIFY: + return security_on_notify(sd, wparam, lparam); + + case WM_NCDESTROY: + return security_on_destroy(sd); + + default: + /* do not flood the log */ + if ((msg == WM_SETCURSOR) || (msg == WM_NCHITTEST) || + (msg == WM_MOUSEMOVE) || (msg == WM_MOUSEACTIVATE) || (msg == WM_PARENTNOTIFY)) + return FALSE; + + TRACE("(%p, 0x%08x/%03d, 0x%08lx, 0x%08lx)\n", hwnd, msg, msg, wparam, lparam); + } + } + return FALSE; +} diff --git a/dll/cpl/input/CMakeLists.txt b/dll/cpl/input/CMakeLists.txt index f6da9712807..6b86afe2d92 100644 --- a/dll/cpl/input/CMakeLists.txt +++ b/dll/cpl/input/CMakeLists.txt @@ -23,4 +23,5 @@ add_importlibs(input gdi32 kernel32) +add_pch(input input.h) add_cd_file(TARGET input DESTINATION reactos/system32 FOR all) diff --git a/dll/cpl/input/changekeyseq.c b/dll/cpl/input/changekeyseq.c index ac06de7e8d7..e38cbff7b93 100644 --- a/dll/cpl/input/changekeyseq.c +++ b/dll/cpl/input/changekeyseq.c @@ -8,7 +8,6 @@ * 06-09-2007 Created */ -#include "resource.h" #include "input.h" BOOL diff --git a/dll/cpl/input/input.c b/dll/cpl/input/input.c index 558bff4bfcc..d3548ce8103 100644 --- a/dll/cpl/input/input.c +++ b/dll/cpl/input/input.c @@ -9,7 +9,6 @@ * 06-09-2007 Created */ -#include "resource.h" #include "input.h" #define NUM_APPLETS (1) diff --git a/dll/cpl/input/input.h b/dll/cpl/input/input.h index dcf0ac7d5e5..84655831819 100644 --- a/dll/cpl/input/input.h +++ b/dll/cpl/input/input.h @@ -1,5 +1,3 @@ -#pragma once - #include #include #include @@ -10,6 +8,8 @@ #include #include +#include "resource.h" + typedef LONG (CALLBACK *CPLAPPLET_PROC)(VOID); typedef struct diff --git a/dll/cpl/input/input.rbuild b/dll/cpl/input/input.rbuild index 81357d65636..27ec2066301 100644 --- a/dll/cpl/input/input.rbuild +++ b/dll/cpl/input/input.rbuild @@ -13,4 +13,5 @@ add.c changekeyseq.c input.rc + input.h diff --git a/dll/cpl/input/keysettings.c b/dll/cpl/input/keysettings.c index d66676c181b..56a5254d283 100644 --- a/dll/cpl/input/keysettings.c +++ b/dll/cpl/input/keysettings.c @@ -9,7 +9,6 @@ * 06-09-2007 Created */ -#include "resource.h" #include "input.h" static HWND hKeySettingsWnd; diff --git a/dll/cpl/input/lang/pl-PL.rc b/dll/cpl/input/lang/pl-PL.rc index b18fe84620e..a05ebfc1bc4 100644 --- a/dll/cpl/input/lang/pl-PL.rc +++ b/dll/cpl/input/lang/pl-PL.rc @@ -1,8 +1,9 @@ /* - * translated by Caemyr - Olaf Siejka (Jan,March 2008) - * Use ReactOS forum PM or IRC to contact me - * http://www.reactos.org - * IRC: irc.freenode.net #reactos-pl; + * translated by Caemyr - Olaf Siejka (Jan,March 2008) + * Use ReactOS forum PM or IRC to contact me + * http://www.reactos.org + * IRC: irc.freenode.net #reactos-pl; + * UTF-8 conversion by Caemyr (May, 2011) */ LANGUAGE LANG_POLISH, SUBLANG_DEFAULT @@ -12,12 +13,12 @@ STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION CAPTION "Ustawienia" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Wybierz usugi dla kadego uywanego jzyka z listy.\nList mona modyfikowa przyciskami Dodaj i Usu.", -1, 9, 6, 238, 17 + LTEXT "Wybierz usługi dla każdego używanego języka z listy.\nListę można modyfikować przyciskami Dodaj i Usuń.", -1, 9, 6, 238, 17 CONTROL "TEXT", IDC_KEYLAYOUT_LIST, "SYSLISTVIEW32", WS_BORDER | WS_VSCROLL | WS_TABSTOP | LVS_SORTASCENDING | LVS_REPORT | 0x0000808D, 8, 28, 237, 109 - PUSHBUTTON "&Ustaw domylne", IDC_SET_DEFAULT, 101, 159, 144, 14 + PUSHBUTTON "&Ustaw domyślne", IDC_SET_DEFAULT, 101, 159, 144, 14 PUSHBUTTON "&Dodaj...", IDC_ADD_BUTTON, 27, 142, 70, 14 - PUSHBUTTON "U&su...", IDC_REMOVE_BUTTON, 101, 142, 70, 14 - PUSHBUTTON "&Waciwoci...", IDC_PROP_BUTTON, 175, 142, 70, 14 + PUSHBUTTON "U&suń...", IDC_REMOVE_BUTTON, 101, 142, 70, 14 + PUSHBUTTON "&Właściwości...", IDC_PROP_BUTTON, 175, 142, 70, 14 GROUPBOX "Preferencje", -1, 7, 185, 240, 36 PUSHBUTTON "Us&tawienia klawiszy...", IDC_KEY_SET_BTN, 14, 198, 110, 14 END @@ -27,26 +28,26 @@ STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | WS_POPUPWIN CAPTION "Zaawansowane ustawienia klawiszy" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "Wyczenie CAPSLOCK", -1, 7, 7, 258, 26 - AUTORADIOBUTTON "Nacinicie klawisza CAPS&LOCK", IDC_PRESS_CL_KEY_RB, 14, 17, 120, 11, WS_GROUP - AUTORADIOBUTTON "Nacinicie klawisza SHI&FT", IDC_PRESS_SHIFT_KEY_RB, 144, 17, 120, 11, NOT WS_TABSTOP - GROUPBOX "Klawisze skrtu jzykw", -1, 7, 37, 258, 95 + GROUPBOX "Wyłączenie CAPSLOCK", -1, 7, 7, 258, 26 + AUTORADIOBUTTON "Naciśnięcie klawisza CAPS&LOCK", IDC_PRESS_CL_KEY_RB, 14, 17, 120, 11, WS_GROUP + AUTORADIOBUTTON "Naciśnięcie klawisza SHI&FT", IDC_PRESS_SHIFT_KEY_RB, 144, 17, 120, 11, NOT WS_TABSTOP + GROUPBOX "Klawisze skrótu języków", -1, 7, 37, 258, 95 LTEXT "Akcja", -1, 14, 47, 60, 9 RTEXT "&Sekwencja klawiszy", -1, 177, 47, 79, 9 CONTROL "", IDC_KEY_LISTVIEW, "SysListView32", LVS_REPORT | LVS_NOCOLUMNHEADER | LVS_AUTOARRANGE | LVS_SINGLESEL, 14, 57, 244, 52, WS_EX_CLIENTEDGE - PUSHBUTTON "Z&mie sekwencj klawiszy...", IDC_CHANGE_KEY_SEQ_BTN, 152, 113, 106, 14, WS_GROUP + PUSHBUTTON "Z&mień sekwencję klawiszy...", IDC_CHANGE_KEY_SEQ_BTN, 152, 113, 106, 14, WS_GROUP DEFPUSHBUTTON "OK", IDOK, 66, 140, 70, 14 PUSHBUTTON "Anuluj", IDCANCEL, 146, 140, 70, 14 END IDD_ADD DIALOGEX 20, 20, 227, 90 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION "Dodawanie jzykw" +CAPTION "Dodawanie języków" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "&Jzyk:", -1, 7, 7, 61, 10 + LTEXT "&Język:", -1, 7, 7, 61, 10 COMBOBOX IDC_INPUT_LANG_COMBO, 7, 17, 212, 150, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL - LTEXT "&Ukad klawiatury/IME:", -1, 7, 36, 110, 10 + LTEXT "&Układ klawiatury/IME:", -1, 7, 36, 110, 10 COMBOBOX IDC_KEYBOARD_LO_COMBO, 7, 47, 212, 150, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL DEFPUSHBUTTON "OK", IDOK, 116, 68, 50, 14 PUSHBUTTON "Anuluj", IDCANCEL, 169, 68, 50, 14 @@ -58,12 +59,12 @@ CAPTION "Zmiana sekwencji klawiszy" FONT 8, "MS Shell Dlg" BEGIN GROUPBOX "", -1, 9, 5, 155, 110 - AUTOCHECKBOX "&Przecz ukad klawiatury", IDC_SWITCH_INPUT_LANG_CB, 15, 15, 105, 12 + AUTOCHECKBOX "&Przełącz układ klawiatury", IDC_SWITCH_INPUT_LANG_CB, 15, 15, 105, 12 LTEXT "Shift", -1, 73, 37, 27, 12 CTEXT "+", -1, 62, 37, 8, 9 AUTORADIOBUTTON "&Ctrl", IDC_CTRL_LANG, 29, 31, 30, 11 AUTORADIOBUTTON "Lewy &ALT", IDC_LEFT_ALT_LANG, 29, 45, 46, 12 - AUTOCHECKBOX "P&rzecz ukad klawiatur", IDC_SWITCH_KBLAYOUTS_CB, 16, 65, 141, 12 + AUTOCHECKBOX "P&rzełącz układ klawiatur", IDC_SWITCH_KBLAYOUTS_CB, 16, 65, 141, 12 LTEXT "Shift", -1, 74, 87, 27, 12 CTEXT "+", -1, 63, 87, 8, 9 AUTORADIOBUTTON "C&trl", IDC_CTRL_LAYOUT, 30, 81, 30, 11 @@ -74,12 +75,12 @@ END IDD_INPUT_LANG_PROP DIALOGEX 20, 20, 227, 75 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION "Waciwoci jzyka" +CAPTION "Właściwości języka" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Jzyk:", -1, 7, 7, 61, 8 + LTEXT "Język:", -1, 7, 7, 61, 8 LTEXT "", IDC_INPUT_LANG_STR, 73, 7, 129, 8 - LTEXT "&Ukad klawiatury/IME:", -1, 7, 21, 110, 10 + LTEXT "&Układ klawiatury/IME:", -1, 7, 21, 110, 10 COMBOBOX IDC_KB_LAYOUT_IME_COMBO, 7, 32, 212, 150, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL DEFPUSHBUTTON "OK", IDOK, 116, 53, 52, 14 PUSHBUTTON "Anuluj", IDCANCEL, 169, 53, 52, 14 @@ -87,22 +88,22 @@ END STRINGTABLE BEGIN - IDS_CPLSYSTEMNAME "Jzyki i usugi tekstowe" - IDS_CPLSYSTEMDESCRIPTION "Umoliwia zmian ustawie jzykw." + IDS_CPLSYSTEMNAME "Języki i usługi tekstowe" + IDS_CPLSYSTEMDESCRIPTION "Umożliwia zmianę ustawień języków." IDS_KEYBOARD "Klawiatura" IDS_NONE "(Brak)" IDS_UNKNOWN "(Nieznany)" - IDS_RESTART "Czy chcesz zrestartowa swj komputer w tej chwili?" + IDS_RESTART "Czy chcesz zrestartować swój komputer w tej chwili?" IDS_WHATS_THIS "Co to jest?" - IDS_LANGUAGE "Jzyk" - IDS_LAYOUT "Ukad klawiatury" - IDS_REM_QUESTION "Czy chcesz usun dany ukad klawiatury?" + IDS_LANGUAGE "Język" + IDS_LAYOUT "Układ klawiatury" + IDS_REM_QUESTION "Czy chcesz usunąć dany układ klawiatury?" IDS_CONFIRMATION "Potwierdzenie" - IDS_LAYOUT_EXISTS "Taki ukad ju istnieje." - IDS_LAYOUT_EXISTS2 "Taki ukad ju istnieje i nie mona go doda ponownie." + IDS_LAYOUT_EXISTS "Taki układ już istnieje." + IDS_LAYOUT_EXISTS2 "Taki układ już istnieje i nie można go dodać ponownie." IDS_CTRL_SHIFT "Ctrl+Shift" IDS_LEFT_ALT_SHIFT "Lewy Alt+Shift" - IDS_SWITCH_BET_INLANG "Przecza pomidzy ukadami klawiatury" + IDS_SWITCH_BET_INLANG "Przełącza pomiędzy układami klawiatury" END STRINGTABLE @@ -113,44 +114,44 @@ BEGIN IDS_PORTUGUESE_BRAZILIAN_ABNT_LAYOUT, "Portugalski (Brazylijski ABNT)" IDS_CANADIAN_FRENCH_LAYOUT, "Kanadyjski Francuski" IDS_CANADIAN_FRENCH_LEGACY_LAYOUT, "Kanadyjski Francuski (Legacy)" - IDS_DANISH_LAYOUT, "Duski" + IDS_DANISH_LAYOUT, "Duński" IDS_DUTCH_LAYOUT, "Holenderski" - IDS_FINNISH_LAYOUT, "Fiski" + IDS_FINNISH_LAYOUT, "Fiński" IDS_FRENCH_LAYOUT, "Francuski" IDS_GERMAN_LAYOUT, "Niemiecki" IDS_GERMAN_IBM_LAYOUT, "Niemiecki (IBM)" IDS_ICELANDIC_LAYOUT, "Islandzki" IDS_IRISH_LAYOUT, "Irlandzki" - IDS_ITALIAN_LAYOUT, "Woski" - IDS_ITALIAN_142_LAYOUT, "Woski (142)" - IDS_LATIN_AMERICAN_LAYOUT, "Latynoamerykaski" + IDS_ITALIAN_LAYOUT, "Włoski" + IDS_ITALIAN_142_LAYOUT, "Włoski (142)" + IDS_LATIN_AMERICAN_LAYOUT, "Latynoamerykański" IDS_NORWEGIAN_LAYOUT, "Norweski" IDS_PORTUGUESE_LAYOUT, "Portugalski" - IDS_SPANISH_LAYOUT, "Hiszpaski" - IDS_SPANISH_VARIANTION_LAYOUT, "Hiszpaski (odmiana)" + IDS_SPANISH_LAYOUT, "Hiszpański" + IDS_SPANISH_VARIANTION_LAYOUT, "Hiszpański (odmiana)" IDS_SWEDISH_LAYOUT, "Szwedzki" IDS_SWISS_FRENCH_LAYOUT, "Szwajcarski Francuski" IDS_SWISS_GERMAN_LAYOUT, "Szwajcarski Niemiecki" IDS_UNITED_KINGDOM_LAYOUT, "Angielski (Wielka Brytania)" - IDS_UNITED_STATES_INTERNATIONAL_LAYOUT, "Midzynarodowy (USA)" - IDS_UNITED_STATES_DVORAK_FOR_LEFT_HAND_LAYOUT, "Angielski (Dvoraka dla leworcznych)" - IDS_UNITED_STATES_DVORAK_FOR_RIGHT_HAND_LAYOUT, "Angielski (Dvoraka dla praworcznych)" - IDS_ALBANIAN_LAYOUT, "Albaski" + IDS_UNITED_STATES_INTERNATIONAL_LAYOUT, "Międzynarodowy (USA)" + IDS_UNITED_STATES_DVORAK_FOR_LEFT_HAND_LAYOUT, "Angielski (Dvoraka dla leworęcznych)" + IDS_UNITED_STATES_DVORAK_FOR_RIGHT_HAND_LAYOUT, "Angielski (Dvoraka dla praworęcznych)" + IDS_ALBANIAN_LAYOUT, "Albański" IDS_CROATIAN_LAYOUT, "Chorwacki" IDS_CZECH_LAYOUT, "Czeski" IDS_CZECH_QWERTY_LAYOUT, "Czeski (QWERTY)" - IDS_HUNGARIAN_LAYOUT, "Wgierski" - IDS_HUNGARIAN_101_KEY_LAYOUT, "Wgierski (101-klawiszy)" + IDS_HUNGARIAN_LAYOUT, "Węgierski" + IDS_HUNGARIAN_101_KEY_LAYOUT, "Węgierski (101-klawiszy)" IDS_POLISH_LAYOUT, "Polski (Programisty)" IDS_POLISH_214_LAYOUT, "Polski (214)" - IDS_ROMANIAN_LAYOUT, "Rumuski" + IDS_ROMANIAN_LAYOUT, "Rumuński" IDS_SERBIAN_LATIN_LAYOUT, "Serbski (Latin)" - IDS_SLOVAK_LAYOUT, "Sowacki" - IDS_SLOVAK_QWERTY_LAYOUT, "Sowacki (QWERTY)" - IDS_SLOVENIAN_LAYOUT, "Sloweski" - IDS_ESTONIAN_LAYOUT, "Estoski" - IDS_LATVIAN_LAYOUT, "otewski" - IDS_LATVIAN_QWERTY_LAYOUT, "otewski (QWERTY)" + IDS_SLOVAK_LAYOUT, "Słowacki" + IDS_SLOVAK_QWERTY_LAYOUT, "Słowacki (QWERTY)" + IDS_SLOVENIAN_LAYOUT, "Sloweński" + IDS_ESTONIAN_LAYOUT, "Estoński" + IDS_LATVIAN_LAYOUT, "Łotewski" + IDS_LATVIAN_QWERTY_LAYOUT, "Łotewski (QWERTY)" IDS_LITHUANIAN_IBM_LAYOUT, "Litewski (IBM)" IDS_GREEK_LAYOUT, "Grecki" IDS_GREEK_LATIN_LAYOUT, "Grecki (Latin)" @@ -158,31 +159,31 @@ BEGIN IDS_GREEK_319_LAYOUT, "Grecki (319)" IDS_GREEK_220_LATIN_LAYOUT, "Grecki (220, Latin)" IDS_GREEK_319_LATIN_LAYOUT, "Grecki (319, Latin)" - IDS_BELARUSIAN_LAYOUT, "Biaoruski" - IDS_BULGARIAN_LAYOUT, "Bugarski" - IDS_BULGARIAN_LATIN_LAYOUT, "Bugarski (Latin)" + IDS_BELARUSIAN_LAYOUT, "Białoruski" + IDS_BULGARIAN_LAYOUT, "Bułgarski" + IDS_BULGARIAN_LATIN_LAYOUT, "Bułgarski (Latin)" IDS_RUSSIAN_LAYOUT, "Rosyjski" IDS_RUSSIAN_TYPEWRITER_LAYOUT, "Rosyjski (Maszynisty)" IDS_SERBIAN_CYRILLIC_LAYOUT, "Serbski (Cyrylica)" - IDS_UKRAINIAN_LAYOUT, "Ukraiski" + IDS_UKRAINIAN_LAYOUT, "Ukraiński" IDS_TURKISH_F_LAYOUT, "Turecki (F)" IDS_TURKISH_Q_LAYOUT, "Turecki (Q)" - IDS_JAPANESE_LAYOUT, "Japoski" - IDS_JAPANESE_INPUT_SYSTEM_MSIME2002_LAYOUT, "Japoski (MS-IME2002)" - IDS_KOREAN_LAYOUT, "Koreaski" - IDS_KOREAN_INPUT_SYSTEM_MSIME2002_LAYOUT, "Koreaski (MS-IME2002)" - IDS_CHINESE_TRADITIONAL_USKEYBOARD_LAYOUT, "Chiski (Tradycyjny) - Klawiatura US" - IDS_CHINESE_TRADITIONAL_PHONETIC_LAYOUT, "Chiski (Tradycyjny) - Fonetyczny" - IDS_CHINESE_TRADITIONAL_CHANGJIE_LAYOUT, "Chiski (Tradycyjny) - ChangJie" - IDS_CHINESE_TRADITIONAL_BIG5CODE_LAYOUT, "Chiski (Tradycyjny) - Kod Big5" - IDS_CHINESE_TRADITIONAL_DAYI_LAYOUT, "Chiski (Tradycyjny) - DaYi" - IDS_CHINESE_TRADITIONAL_UNICODE_LAYOUT, "Chiski (Tradycyjny) - Unicode" - IDS_CHINESE_TRADITIONAL_ALPHANUMERIC_LAYOUT, "Chiski (Tradycyjny) - Alfanumeryczny" - IDS_CHINESE_SIMPLIFIED_USKEYBOARD_LAYOUT, "Chiski (Uproszczony) - Klawiatura US" - IDS_CHINESE_SIMPLIFIED_QUANPIN_LAYOUT, "Chiski (Uproszczony) - QuanPin" - IDS_CHINESE_SIMPLIFIED_SHUANGPIN_LAYOUT, "Chiski (Uproszczony) - ShuangPin" - IDS_CHINESE_SIMPLIFIED_ZHENGMA_LAYOUT, "Chiski (Uproszczony) - ZhengMa" - IDS_CHINESE_SIMPLIFIED_NEIMA_LAYOUT, "Chiski (Uproszczony) - NeiMa" + IDS_JAPANESE_LAYOUT, "Japoński" + IDS_JAPANESE_INPUT_SYSTEM_MSIME2002_LAYOUT, "Japoński (MS-IME2002)" + IDS_KOREAN_LAYOUT, "Koreański" + IDS_KOREAN_INPUT_SYSTEM_MSIME2002_LAYOUT, "Koreański (MS-IME2002)" + IDS_CHINESE_TRADITIONAL_USKEYBOARD_LAYOUT, "Chiński (Tradycyjny) - Klawiatura US" + IDS_CHINESE_TRADITIONAL_PHONETIC_LAYOUT, "Chiński (Tradycyjny) - Fonetyczny" + IDS_CHINESE_TRADITIONAL_CHANGJIE_LAYOUT, "Chiński (Tradycyjny) - ChangJie" + IDS_CHINESE_TRADITIONAL_BIG5CODE_LAYOUT, "Chiński (Tradycyjny) - Kod Big5" + IDS_CHINESE_TRADITIONAL_DAYI_LAYOUT, "Chiński (Tradycyjny) - DaYi" + IDS_CHINESE_TRADITIONAL_UNICODE_LAYOUT, "Chiński (Tradycyjny) - Unicode" + IDS_CHINESE_TRADITIONAL_ALPHANUMERIC_LAYOUT, "Chiński (Tradycyjny) - Alfanumeryczny" + IDS_CHINESE_SIMPLIFIED_USKEYBOARD_LAYOUT, "Chiński (Uproszczony) - Klawiatura US" + IDS_CHINESE_SIMPLIFIED_QUANPIN_LAYOUT, "Chiński (Uproszczony) - QuanPin" + IDS_CHINESE_SIMPLIFIED_SHUANGPIN_LAYOUT, "Chiński (Uproszczony) - ShuangPin" + IDS_CHINESE_SIMPLIFIED_ZHENGMA_LAYOUT, "Chiński (Uproszczony) - ZhengMa" + IDS_CHINESE_SIMPLIFIED_NEIMA_LAYOUT, "Chiński (Uproszczony) - NeiMa" IDS_THAI_KEDMANEE_LAYOUT, "Tajski (Kedmanee)" IDS_THAI_PATTACHOTE_LAYOUT, "Tajski (Pattachote)" IDS_THAI_KEDMANEE_NONSHIFTLOCK_LAYOUT, "Tajski (Kedmanee, bez ShiftLock)" @@ -194,37 +195,37 @@ BEGIN IDS_CZECH_PROGRAMMERS_LAYOUT, "Czeski (Programisty)" IDS_LITHUANIAN_LAYOUT, "Litewski" IDS_BELGIAN_COMMA_LAYOUT, "Belgijski (Comma)" - IDS_CHINESE_TRADITIONAL_NEWPHONETIC_LAYOUT, "Chiski (Tradycyjny) - Nowa fonetyka" - IDS_CHINESE_SIMPLIFIED_MSPINYINIME30_LAYOUT, "Chiski (Uproszczony) - Microsoft Pinyin IME 3.0" + IDS_CHINESE_TRADITIONAL_NEWPHONETIC_LAYOUT, "Chiński (Tradycyjny) - Nowa fonetyka" + IDS_CHINESE_SIMPLIFIED_MSPINYINIME30_LAYOUT, "Chiński (Uproszczony) - Microsoft Pinyin IME 3.0" IDS_UNITED_STATES_DVIRAK_LAYOUT, "Angielski (US-Dvorak)" - IDS_CHINESE_TRADITIONAL_NEWCHANGJIE_LAYOUT, "Chiski (Tradycyjny) - Nowy ChangJie" + IDS_CHINESE_TRADITIONAL_NEWCHANGJIE_LAYOUT, "Chiński (Tradycyjny) - Nowy ChangJie" IDS_ASSAMESE_LAYOUT, "Assamski" IDS_BENGALI_LAYOUT, "Bengalski" IDS_DEVANAGARI_INSCRIPT_LAYOUT, "Dewanagari (INSCRIPT)" - IDS_GUJARATI_LAYOUT, "Gudarati" + IDS_GUJARATI_LAYOUT, "Gudźarati" IDS_KANNADA_LAYOUT, "Kannada" IDS_MALAYALAM_LAYOUT, "Malayalam" IDS_ORIYA_LAYOUT, "Orija" - IDS_PUNJABI_LAYOUT, "Pendabski" + IDS_PUNJABI_LAYOUT, "Pendżabski" IDS_TAMIL_LAYOUT, "Tamilski" IDS_TELUGU_LAYOUT, "Telugu" IDS_MARATHI_LAYOUT, "Marathi" IDS_HINDI_TRADITIONAL_LAYOUT, "Hindi (Tradycyjny)" - IDS_CANTONESE_PHONETIC_LAYOUT, "Kantoski (Fonetyczny)" + IDS_CANTONESE_PHONETIC_LAYOUT, "Kantoński (Fonetyczny)" IDS_FAEROESE_LAYOUT, "Farerski" - IDS_FYRO_MACEDONIAN_LAYOUT, "Macedoski(FYRO)" - IDS_CANADIAN_MULTILINGUAL_STD_LAYOUT, "Kanadyjski wielojzykowy" - IDS_CHINESE_TRADITIONAL_QUICK_LAYOUT, "Chiski (Tradycyjny) - Quick" - IDS_CHINESE_TRADITIONAL_ARRAY_LAYOUT, "Chiski (Tradycyjny) - Array" + IDS_FYRO_MACEDONIAN_LAYOUT, "Macedoński(FYRO)" + IDS_CANADIAN_MULTILINGUAL_STD_LAYOUT, "Kanadyjski wielojęzykowy" + IDS_CHINESE_TRADITIONAL_QUICK_LAYOUT, "Chiński (Tradycyjny) - Quick" + IDS_CHINESE_TRADITIONAL_ARRAY_LAYOUT, "Chiński (Tradycyjny) - Array" IDS_KAZAKH_LAYOUT, "Kazachski" IDS_UZBEK_CYRILLIC_LAYOUT, "Uzbecki (Cyrylica)" IDS_AZERI_CYRILLIC_LAYOUT, "Azerski (Cyrylica)" IDS_TATAR_LAYOUT, "Tatarski" IDS_AZERI_LATIN_LAYOUT, "Azerski (Latin)" IDS_VIETNAMESE_LAYOUT, "Wietnamski" - IDS_GEORGIAN_LAYOUT, "Gruziski" - IDS_ARMENIAN_EASTERN_LAYOUT, "Armeski wschodni" - IDS_ARMENIAN_WESTERN_LAYOUT, "Armeski zachodni" + IDS_GEORGIAN_LAYOUT, "Gruziński" + IDS_ARMENIAN_EASTERN_LAYOUT, "Armeński wschodni" + IDS_ARMENIAN_WESTERN_LAYOUT, "Armeński zachodni" IDS_GREEK_POLYTONIC_LAYOUT, "Grecki Politoniczny" IDS_USENG_TABLE_IBM_ARABIC238L_LAYOUT, "Tablica Angielska (US) dla Arabskiego (IBM 238_L)" IDS_FARSI_LAYOUT, "Perski" @@ -237,12 +238,12 @@ BEGIN IDS_SYRIAC_PHONETIC_LAYOUT, "Syriacki (Fonetyczny)" IDS_DIVEHI_PHONETIC_LAYOUT, "Malediwski (Fonetyczny)" IDS_DIVEHI_TYPEWRITER_LAYOUT, "Malediwski (Maszynisty)" - IDS_BULGARIAN_PHONETIC_CLASSIC_LAYOUT, "Bugarski (Fonetyczny)" - IDS_BULGARIAN_PHONETIC_BDS_LAYOUT, "Bugarski (Fonetyczny, BDS)" - IDS_BULGARIAN_BDS_LAYOUT, "Bugarski BDS 5237-1978" + IDS_BULGARIAN_PHONETIC_CLASSIC_LAYOUT, "Bułgarski (Fonetyczny)" + IDS_BULGARIAN_PHONETIC_BDS_LAYOUT, "Bułgarski (Fonetyczny, BDS)" + IDS_BULGARIAN_BDS_LAYOUT, "Bułgarski BDS 5237-1978" IDS_GERMAN_RISTOME_LAYOUT, "Niemiecki (RISTOME)" IDS_GERMAN_NEO_11_LAYOUT, "Niemiecki (NEO-1.1)" IDS_GERMAN_DE_ERGO_LAYOUT, "Niemiecki (de_ergo)" - IDS_BURMESE_LAYOUT, "Birmaski" - IDS_UKRAINIAN_STUDENT_LAYOUT, "Ukraiski (Student)" + IDS_BURMESE_LAYOUT, "Birmański" + IDS_UKRAINIAN_STUDENT_LAYOUT, "Ukraiński (Student)" END diff --git a/dll/cpl/input/lang/ro-RO.rc b/dll/cpl/input/lang/ro-RO.rc index 14092528eee..896b238833e 100644 --- a/dll/cpl/input/lang/ro-RO.rc +++ b/dll/cpl/input/lang/ro-RO.rc @@ -1,7 +1,5 @@ LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL -#pragma code_page(65001) - IDD_PROPPAGESETTINGS DIALOGEX 0, 0, 254, 228 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION CAPTION "Setări" @@ -241,5 +239,3 @@ BEGIN IDS_UZBEK_CYRILLIC_LAYOUT, "Uzbek Cyrillic" IDS_VIETNAMESE_LAYOUT, "Vietnamese" END - -#pragma code_page(default) diff --git a/dll/cpl/input/lang/ru-RU.rc b/dll/cpl/input/lang/ru-RU.rc index 52f4a0dbcfb..8f43df12529 100644 --- a/dll/cpl/input/lang/ru-RU.rc +++ b/dll/cpl/input/lang/ru-RU.rc @@ -2,240 +2,240 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT IDD_PROPPAGESETTINGS DIALOGEX 0, 0, 254, 228 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Параметры" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " . """" """".", -1, 9, 6, 238, 17 + LTEXT "Выберите нужные раскладки для каждого языка ввода из списка. Для изменения списка служат кнопки ""Добавить"" и ""Удалить"".", -1, 9, 6, 238, 17 CONTROL "TEXT", IDC_KEYLAYOUT_LIST, "SYSLISTVIEW32", WS_BORDER | WS_VSCROLL | WS_TABSTOP | LVS_SORTASCENDING | LVS_REPORT | 0x0000808D, 8, 28, 237, 109 - PUSHBUTTON "& ", IDC_SET_DEFAULT, 101, 159, 144, 14 - PUSHBUTTON "&...", IDC_ADD_BUTTON, 27, 142, 70, 14 - PUSHBUTTON "&...", IDC_REMOVE_BUTTON, 101, 142, 70, 14 - PUSHBUTTON "&...", IDC_PROP_BUTTON, 175, 142, 70, 14 - GROUPBOX "", -1, 7, 185, 240, 36 - PUSHBUTTON "& ...", IDC_KEY_SET_BTN, 14, 198, 110, 14 + PUSHBUTTON "Ус&тановить по умолчанию", IDC_SET_DEFAULT, 101, 159, 144, 14 + PUSHBUTTON "&Добавить...", IDC_ADD_BUTTON, 27, 142, 70, 14 + PUSHBUTTON "&Удалить...", IDC_REMOVE_BUTTON, 101, 142, 70, 14 + PUSHBUTTON "&Свойства...", IDC_PROP_BUTTON, 175, 142, 70, 14 + GROUPBOX "Параметры", -1, 7, 185, 240, 36 + PUSHBUTTON "&Параметры клавиатуры...", IDC_KEY_SET_BTN, 14, 198, 110, 14 END IDD_KEYSETTINGS DIALOGEX 0, 0, 272, 163 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION " " +CAPTION "Дополнительные параметры клавиатуры" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " Caps Lock", -1, 7, 7, 258, 26 - AUTORADIOBUTTON "& CAPS LOCK", IDC_PRESS_CL_KEY_RB, 14, 17, 120, 11, WS_GROUP - AUTORADIOBUTTON "& SHIFT", IDC_PRESS_SHIFT_KEY_RB, 144, 17, 120, 11, NOT WS_TABSTOP - GROUPBOX " ", -1, 7, 37, 258, 95 - LTEXT "", -1, 14, 47, 60, 9 - RTEXT "& ", -1, 177, 47, 79, 9 + GROUPBOX "Отключение режима Caps Lock", -1, 7, 7, 258, 26 + AUTORADIOBUTTON "&Клавишей CAPS LOCK", IDC_PRESS_CL_KEY_RB, 14, 17, 120, 11, WS_GROUP + AUTORADIOBUTTON "К&лавишей SHIFT", IDC_PRESS_SHIFT_KEY_RB, 144, 17, 120, 11, NOT WS_TABSTOP + GROUPBOX "Сочетания клавиш для языков ввода", -1, 7, 37, 258, 95 + LTEXT "Действие", -1, 14, 47, 60, 9 + RTEXT "&Сочетание клавиш", -1, 177, 47, 79, 9 CONTROL "", IDC_KEY_LISTVIEW, "SysListView32", LVS_REPORT | LVS_NOCOLUMNHEADER | LVS_AUTOARRANGE | LVS_SINGLESEL, 14, 57, 244, 52, WS_EX_CLIENTEDGE - PUSHBUTTON "& ...", IDC_CHANGE_KEY_SEQ_BTN, 152, 113, 106, 14, WS_GROUP + PUSHBUTTON "См&ена сочетания клавиш...", IDC_CHANGE_KEY_SEQ_BTN, 152, 113, 106, 14, WS_GROUP DEFPUSHBUTTON "OK", IDOK, 66, 140, 70, 14 - PUSHBUTTON "", IDCANCEL, 146, 140, 70, 14 + PUSHBUTTON "Отмена", IDCANCEL, 146, 140, 70, 14 END IDD_ADD DIALOGEX 20, 20, 227, 90 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION " " +CAPTION "Добавление языка ввода" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "& :", -1, 7, 7, 61, 10 + LTEXT "&Язык ввода:", -1, 7, 7, 61, 10 COMBOBOX IDC_INPUT_LANG_COMBO, 7, 17, 212, 150, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL - LTEXT "& :", -1, 7, 36, 170, 10 + LTEXT "&Раскладка клавиатуры:", -1, 7, 36, 170, 10 COMBOBOX IDC_KEYBOARD_LO_COMBO, 7, 47, 212, 150, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL DEFPUSHBUTTON "OK", IDOK, 116, 68, 50, 14 - PUSHBUTTON "", IDCANCEL, 169, 68, 50, 14 + PUSHBUTTON "Отмена", IDCANCEL, 169, 68, 50, 14 END IDD_CHANGE_KEY_SEQ DIALOGEX 5, 100, 230, 125 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION " " +CAPTION "Смена сочетания клавиш" FONT 8, "MS Shell Dlg" BEGIN GROUPBOX "", -1, 9, 5, 155, 110 - AUTOCHECKBOX " & ", IDC_SWITCH_INPUT_LANG_CB, 15, 15, 105, 12 + AUTOCHECKBOX "Переключать &языки ввода", IDC_SWITCH_INPUT_LANG_CB, 15, 15, 105, 12 LTEXT "Shift", -1, 73, 37, 27, 12 CTEXT "+", -1, 62, 37, 8, 9 AUTORADIOBUTTON "&Ctrl", IDC_CTRL_LANG, 29, 31, 30, 11 - AUTORADIOBUTTON "Alt &", IDC_LEFT_ALT_LANG, 29, 45, 46, 12 - AUTOCHECKBOX " &", IDC_SWITCH_KBLAYOUTS_CB, 16, 65, 141, 12 + AUTORADIOBUTTON "Alt с&лева", IDC_LEFT_ALT_LANG, 29, 45, 46, 12 + AUTOCHECKBOX "Переключать раскладки &клавиатуры", IDC_SWITCH_KBLAYOUTS_CB, 16, 65, 141, 12 LTEXT "Shift", -1, 74, 87, 27, 12 CTEXT "+", -1, 63, 87, 8, 9 AUTORADIOBUTTON "C&trl", IDC_CTRL_LAYOUT, 30, 81, 30, 11 - AUTORADIOBUTTON "Alt &", IDC_LEFT_ALT_LAYOUT, 30, 95, 44, 12 - DEFPUSHBUTTON "", IDOK, 172, 9, 50, 14 - PUSHBUTTON "", IDCANCEL, 172, 27, 50, 14 + AUTORADIOBUTTON "Alt сл&ева", IDC_LEFT_ALT_LAYOUT, 30, 95, 44, 12 + DEFPUSHBUTTON "ОК", IDOK, 172, 9, 50, 14 + PUSHBUTTON "Отмена", IDCANCEL, 172, 27, 50, 14 END IDD_INPUT_LANG_PROP DIALOGEX 20, 20, 227, 75 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION " " +CAPTION "Свойства языка ввода" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " :", -1, 7, 7, 61, 8 + LTEXT "Язык ввода:", -1, 7, 7, 61, 8 LTEXT "", IDC_INPUT_LANG_STR, 73, 7, 129, 8 - LTEXT "& :", -1, 7, 21, 170, 10 + LTEXT "&Раскладка клавиатуры:", -1, 7, 21, 170, 10 COMBOBOX IDC_KB_LAYOUT_IME_COMBO, 7, 32, 212, 150, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL DEFPUSHBUTTON "OK", IDOK, 114, 53, 52, 14 - PUSHBUTTON "", IDCANCEL, 169, 53, 52, 14 + PUSHBUTTON "Отмена", IDCANCEL, 169, 53, 52, 14 END STRINGTABLE BEGIN - IDS_CPLSYSTEMNAME " " - IDS_CPLSYSTEMDESCRIPTION " ." - IDS_KEYBOARD "" - IDS_NONE "()" - IDS_UNKNOWN "( )" - IDS_RESTART " ?" - IDS_WHATS_THIS " ?" - IDS_LANGUAGE " " - IDS_LAYOUT "" - IDS_REM_QUESTION " ?" - IDS_CONFIRMATION "" - IDS_LAYOUT_EXISTS " ." - IDS_LAYOUT_EXISTS2 " ." + IDS_CPLSYSTEMNAME "Текстовые сервисы и ввод языков" + IDS_CPLSYSTEMDESCRIPTION "Дополнительные параметры текстового ввода языков." + IDS_KEYBOARD "Клавиатура" + IDS_NONE "(нет)" + IDS_UNKNOWN "(нет данных)" + IDS_RESTART "Выполнить перезагрузку сейчас?" + IDS_WHATS_THIS "Что это?" + IDS_LANGUAGE "Язык ввода" + IDS_LAYOUT "Раскладка" + IDS_REM_QUESTION "Вы действительно хотите удалить выбранную раскладку клавиатуры?" + IDS_CONFIRMATION "Подтверждение" + IDS_LAYOUT_EXISTS "Такая раскладка уже существует." + IDS_LAYOUT_EXISTS2 "Такая раскладка уже существует и не может быть добавлена." IDS_CTRL_SHIFT "Ctrl+Shift" - IDS_LEFT_ALT_SHIFT "Alt +Shift" - IDS_SWITCH_BET_INLANG " " + IDS_LEFT_ALT_SHIFT "Alt слева+Shift" + IDS_SWITCH_BET_INLANG "Переключение между языками ввода" END STRINGTABLE BEGIN - IDS_US_LAYOUT, "" - IDS_BELGIAN_LAYOUT, " ( )" - IDS_BELGIAN_FRENCH_LAYOUT, " ()" - IDS_PORTUGUESE_BRAZILIAN_ABNT_LAYOUT, " ( ABNT)" - IDS_CANADIAN_FRENCH_LAYOUT, " ()" - IDS_CANADIAN_FRENCH_LEGACY_LAYOUT, " ( )" - IDS_DANISH_LAYOUT, "" - IDS_DUTCH_LAYOUT, "" - IDS_FINNISH_LAYOUT, "" - IDS_FRENCH_LAYOUT, "" - IDS_GERMAN_LAYOUT, "" - IDS_GERMAN_IBM_LAYOUT, " (IBM)" - IDS_ICELANDIC_LAYOUT, "" - IDS_IRISH_LAYOUT, "" - IDS_ITALIAN_LAYOUT, "" - IDS_ITALIAN_142_LAYOUT, " (142)" - IDS_LATIN_AMERICAN_LAYOUT, "" - IDS_NORWEGIAN_LAYOUT, "" - IDS_PORTUGUESE_LAYOUT, "" - IDS_SPANISH_LAYOUT, "" - IDS_SPANISH_VARIANTION_LAYOUT, " 2" - IDS_SWEDISH_LAYOUT, "" - IDS_SWISS_FRENCH_LAYOUT, " " - IDS_SWISS_GERMAN_LAYOUT, " " - IDS_UNITED_KINGDOM_LAYOUT, "" - IDS_UNITED_STATES_INTERNATIONAL_LAYOUT, " - " - IDS_UNITED_STATES_DVORAK_FOR_LEFT_HAND_LAYOUT, " - " - IDS_UNITED_STATES_DVORAK_FOR_RIGHT_HAND_LAYOUT, " - " - IDS_ALBANIAN_LAYOUT, "" - IDS_CROATIAN_LAYOUT, "" - IDS_CZECH_LAYOUT, "" - IDS_CZECH_QWERTY_LAYOUT, " (QWERTY)" - IDS_HUNGARIAN_LAYOUT, "" - IDS_HUNGARIAN_101_KEY_LAYOUT, " (101 )" - IDS_POLISH_LAYOUT, " ()" - IDS_POLISH_214_LAYOUT, " (214)" - IDS_ROMANIAN_LAYOUT, "" - IDS_SERBIAN_LATIN_LAYOUT, " ()" - IDS_SLOVAK_LAYOUT, "" - IDS_SLOVAK_QWERTY_LAYOUT, " (QWERTY)" - IDS_SLOVENIAN_LAYOUT, "" - IDS_ESTONIAN_LAYOUT, "" - IDS_LATVIAN_LAYOUT, "" - IDS_LATVIAN_QWERTY_LAYOUT, " (QWERTY)" - IDS_LITHUANIAN_IBM_LAYOUT, " IBM" - IDS_GREEK_LAYOUT, "" - IDS_GREEK_LATIN_LAYOUT, " " - IDS_GREEK_220_LAYOUT, " (220)" - IDS_GREEK_319_LAYOUT, " (319)" - IDS_GREEK_220_LATIN_LAYOUT, " (220) " - IDS_GREEK_319_LATIN_LAYOUT, " (319) " - IDS_BELARUSIAN_LAYOUT, "" - IDS_BULGARIAN_LAYOUT, "" - IDS_BULGARIAN_LATIN_LAYOUT, " ()" - IDS_RUSSIAN_LAYOUT, "" - IDS_RUSSIAN_TYPEWRITER_LAYOUT, " ()" - IDS_SERBIAN_CYRILLIC_LAYOUT, " ()" - IDS_UKRAINIAN_LAYOUT, "" - IDS_TURKISH_F_LAYOUT, " F" - IDS_TURKISH_Q_LAYOUT, " Q" - IDS_JAPANESE_LAYOUT, "" - IDS_JAPANESE_INPUT_SYSTEM_MSIME2002_LAYOUT, " (MS-IME2002)" - IDS_KOREAN_LAYOUT, "" - IDS_KOREAN_INPUT_SYSTEM_MSIME2002_LAYOUT, " (MS-IME98)" - IDS_CHINESE_TRADITIONAL_USKEYBOARD_LAYOUT, " () - " - IDS_CHINESE_TRADITIONAL_PHONETIC_LAYOUT, " () - " - IDS_CHINESE_TRADITIONAL_CHANGJIE_LAYOUT, " () - ChangJie" - IDS_CHINESE_TRADITIONAL_BIG5CODE_LAYOUT, " () - Big5 Code" - IDS_CHINESE_TRADITIONAL_DAYI_LAYOUT, " () - DaYi" - IDS_CHINESE_TRADITIONAL_UNICODE_LAYOUT, " () - " - IDS_CHINESE_TRADITIONAL_ALPHANUMERIC_LAYOUT, " () - -" - IDS_CHINESE_SIMPLIFIED_USKEYBOARD_LAYOUT, " () - " - IDS_CHINESE_SIMPLIFIED_QUANPIN_LAYOUT, " () - QuanPin" - IDS_CHINESE_SIMPLIFIED_SHUANGPIN_LAYOUT, " () - ShuangPin" - IDS_CHINESE_SIMPLIFIED_ZHENGMA_LAYOUT, " () - ZhengMa" - IDS_CHINESE_SIMPLIFIED_NEIMA_LAYOUT, " () - NeiMa" - IDS_THAI_KEDMANEE_LAYOUT, " " - IDS_THAI_PATTACHOTE_LAYOUT, " " - IDS_THAI_KEDMANEE_NONSHIFTLOCK_LAYOUT, " ( ShiftLock)" - IDS_THAI_PATTACHOTE_NONSHIFTLOCK_LAYOUT, " ( ShiftLock)" - IDS_HEBREW_LAYOUT, "" - IDS_ARABIC_101_LAYOUT, " (101)" - IDS_ARABIC_102_LAYOUT, " (102)" - IDS_ARABIC_102_AZERTY_LAYOUT, " (102) AZERTY" - IDS_CZECH_PROGRAMMERS_LAYOUT, " ()" - IDS_LITHUANIAN_LAYOUT, "" - IDS_BELGIAN_COMMA_LAYOUT, " ( )" - IDS_CHINESE_TRADITIONAL_NEWPHONETIC_LAYOUT, " () - " - IDS_CHINESE_SIMPLIFIED_MSPINYINIME30_LAYOUT, " () - Microsoft Pinyin IME 3.0" - IDS_UNITED_STATES_DVIRAK_LAYOUT, " - " - IDS_CHINESE_TRADITIONAL_NEWCHANGJIE_LAYOUT, " () - ChangJie" - IDS_ASSAMESE_LAYOUT, "" - IDS_BENGALI_LAYOUT, "" - IDS_DEVANAGARI_INSCRIPT_LAYOUT, " - " - IDS_GUJARATI_LAYOUT, "" - IDS_KANNADA_LAYOUT, "" - IDS_MALAYALAM_LAYOUT, "" - IDS_ORIYA_LAYOUT, "" - IDS_PUNJABI_LAYOUT, "" - IDS_TAMIL_LAYOUT, "" - IDS_TELUGU_LAYOUT, "" - IDS_MARATHI_LAYOUT, "" - IDS_HINDI_TRADITIONAL_LAYOUT, " " - IDS_CANTONESE_PHONETIC_LAYOUT, " " - IDS_FAEROESE_LAYOUT, "" - IDS_FYRO_MACEDONIAN_LAYOUT, " (FYROM)" - IDS_CANADIAN_MULTILINGUAL_STD_LAYOUT, " ()" - IDS_CHINESE_TRADITIONAL_QUICK_LAYOUT, " () - " - IDS_CHINESE_TRADITIONAL_ARRAY_LAYOUT, " () - " - IDS_KAZAKH_LAYOUT, "" - IDS_UZBEK_CYRILLIC_LAYOUT, " " - IDS_AZERI_CYRILLIC_LAYOUT, " ()" - IDS_TATAR_LAYOUT, "" - IDS_AZERI_LATIN_LAYOUT, " ()" - IDS_VIETNAMESE_LAYOUT, "" - IDS_GEORGIAN_LAYOUT, "" - IDS_ARMENIAN_EASTERN_LAYOUT, " " - IDS_ARMENIAN_WESTERN_LAYOUT, " " - IDS_GREEK_POLYTONIC_LAYOUT, " " - IDS_USENG_TABLE_IBM_ARABIC238L_LAYOUT, " IBM 238_L" - IDS_FARSI_LAYOUT, "" - IDS_GAELIC_LAYOUT, "" - IDS_PORTUGUESE_BRAZIL_ABNT2_LAYOUT, " ()" - IDS_MONGOLIAN_CYRILLIC_LAYOUT, " ()" - IDS_KYRGYZ_CYRILLIC_LAYOUT, " ()" - IDS_URDU_LAYOUT, "" - IDS_SYRIAC_LAYOUT, "" - IDS_SYRIAC_PHONETIC_LAYOUT, " " - IDS_DIVEHI_PHONETIC_LAYOUT, " " - IDS_DIVEHI_TYPEWRITER_LAYOUT, " " - IDS_BULGARIAN_PHONETIC_CLASSIC_LAYOUT, " ()" - IDS_BULGARIAN_PHONETIC_BDS_LAYOUT, " (BDS)" - IDS_BULGARIAN_BDS_LAYOUT, " (BDS 5237-1978)" - IDS_GERMAN_RISTOME_LAYOUT, " (RISTOME)" - IDS_GERMAN_NEO_11_LAYOUT, " (NEO-1.1)" - IDS_GERMAN_DE_ERGO_LAYOUT, " (de_ergo)" - IDS_BURMESE_LAYOUT, "" - IDS_UKRAINIAN_STUDENT_LAYOUT, " ()" + IDS_US_LAYOUT, "США" + IDS_BELGIAN_LAYOUT, "Бельгийская (с точкой)" + IDS_BELGIAN_FRENCH_LAYOUT, "Бельгийская (французская)" + IDS_PORTUGUESE_BRAZILIAN_ABNT_LAYOUT, "Португальская (Бразильская ABNT)" + IDS_CANADIAN_FRENCH_LAYOUT, "Канадская (французская)" + IDS_CANADIAN_FRENCH_LEGACY_LAYOUT, "Канадская (французская традиционная)" + IDS_DANISH_LAYOUT, "Датская" + IDS_DUTCH_LAYOUT, "Голландская" + IDS_FINNISH_LAYOUT, "Финская" + IDS_FRENCH_LAYOUT, "Французская" + IDS_GERMAN_LAYOUT, "Немецкая" + IDS_GERMAN_IBM_LAYOUT, "Немецкая (IBM)" + IDS_ICELANDIC_LAYOUT, "Исландская" + IDS_IRISH_LAYOUT, "Ирландская" + IDS_ITALIAN_LAYOUT, "Итальянская" + IDS_ITALIAN_142_LAYOUT, "Итальянская (142)" + IDS_LATIN_AMERICAN_LAYOUT, "Латиноамериканская" + IDS_NORWEGIAN_LAYOUT, "Норвежская" + IDS_PORTUGUESE_LAYOUT, "Португальская" + IDS_SPANISH_LAYOUT, "Испанская" + IDS_SPANISH_VARIANTION_LAYOUT, "Испанская 2" + IDS_SWEDISH_LAYOUT, "Шведская" + IDS_SWISS_FRENCH_LAYOUT, "Швейцарская французская" + IDS_SWISS_GERMAN_LAYOUT, "Швейцарская немецкая" + IDS_UNITED_KINGDOM_LAYOUT, "Британская" + IDS_UNITED_STATES_INTERNATIONAL_LAYOUT, "США - международная" + IDS_UNITED_STATES_DVORAK_FOR_LEFT_HAND_LAYOUT, "США - по Двораку для левой руки" + IDS_UNITED_STATES_DVORAK_FOR_RIGHT_HAND_LAYOUT, "США - по Двораку для правой руки" + IDS_ALBANIAN_LAYOUT, "Албанская" + IDS_CROATIAN_LAYOUT, "Хорватская" + IDS_CZECH_LAYOUT, "Чешская" + IDS_CZECH_QWERTY_LAYOUT, "Чешская (QWERTY)" + IDS_HUNGARIAN_LAYOUT, "Венгерская" + IDS_HUNGARIAN_101_KEY_LAYOUT, "Венгерская (101 клавиша)" + IDS_POLISH_LAYOUT, "Польская (программистская)" + IDS_POLISH_214_LAYOUT, "Польская (214)" + IDS_ROMANIAN_LAYOUT, "Румынская" + IDS_SERBIAN_LATIN_LAYOUT, "Сербская (латиница)" + IDS_SLOVAK_LAYOUT, "Словацкая" + IDS_SLOVAK_QWERTY_LAYOUT, "Словацкая (QWERTY)" + IDS_SLOVENIAN_LAYOUT, "Словенская" + IDS_ESTONIAN_LAYOUT, "Эстонская" + IDS_LATVIAN_LAYOUT, "Латышская" + IDS_LATVIAN_QWERTY_LAYOUT, "Латвийская (QWERTY)" + IDS_LITHUANIAN_IBM_LAYOUT, "Литовская IBM" + IDS_GREEK_LAYOUT, "Греческая" + IDS_GREEK_LATIN_LAYOUT, "Греческая латиница" + IDS_GREEK_220_LAYOUT, "Греческая (220)" + IDS_GREEK_319_LAYOUT, "Греческая (319)" + IDS_GREEK_220_LATIN_LAYOUT, "Греческая (220) латиница" + IDS_GREEK_319_LATIN_LAYOUT, "Греческая (319) латиница" + IDS_BELARUSIAN_LAYOUT, "Белорусская" + IDS_BULGARIAN_LAYOUT, "Болгарская" + IDS_BULGARIAN_LATIN_LAYOUT, "Болгарская (латиница)" + IDS_RUSSIAN_LAYOUT, "Русская" + IDS_RUSSIAN_TYPEWRITER_LAYOUT, "Русская (машинопись)" + IDS_SERBIAN_CYRILLIC_LAYOUT, "Сербская (кириллица)" + IDS_UKRAINIAN_LAYOUT, "Украинская" + IDS_TURKISH_F_LAYOUT, "Турецкая F" + IDS_TURKISH_Q_LAYOUT, "Турецкая Q" + IDS_JAPANESE_LAYOUT, "Японская" + IDS_JAPANESE_INPUT_SYSTEM_MSIME2002_LAYOUT, "Японская система ввода (MS-IME2002)" + IDS_KOREAN_LAYOUT, "Корейский" + IDS_KOREAN_INPUT_SYSTEM_MSIME2002_LAYOUT, "Корейская система ввода (MS-IME98)" + IDS_CHINESE_TRADITIONAL_USKEYBOARD_LAYOUT, "Китайская (традиционная) - США" + IDS_CHINESE_TRADITIONAL_PHONETIC_LAYOUT, "Китайская (традиционная) - фонетическая" + IDS_CHINESE_TRADITIONAL_CHANGJIE_LAYOUT, "Китайская (традиционная) - ChangJie" + IDS_CHINESE_TRADITIONAL_BIG5CODE_LAYOUT, "Китайская (традиционная) - Big5 Code" + IDS_CHINESE_TRADITIONAL_DAYI_LAYOUT, "Китайская (традиционная) - DaYi" + IDS_CHINESE_TRADITIONAL_UNICODE_LAYOUT, "Китайская (традиционная) - Юникод" + IDS_CHINESE_TRADITIONAL_ALPHANUMERIC_LAYOUT, "Китайская (традиционная) - алфавитно-цифровая" + IDS_CHINESE_SIMPLIFIED_USKEYBOARD_LAYOUT, "Китайская (упрощенная) - США" + IDS_CHINESE_SIMPLIFIED_QUANPIN_LAYOUT, "Китайская (упрощенная) - QuanPin" + IDS_CHINESE_SIMPLIFIED_SHUANGPIN_LAYOUT, "Китайская (упрощенная) - ShuangPin" + IDS_CHINESE_SIMPLIFIED_ZHENGMA_LAYOUT, "Китайская (упрощенная) - ZhengMa" + IDS_CHINESE_SIMPLIFIED_NEIMA_LAYOUT, "Китайская (упрощенная) - NeiMa" + IDS_THAI_KEDMANEE_LAYOUT, "Тайская Кедмани" + IDS_THAI_PATTACHOTE_LAYOUT, "Тайская Паташот" + IDS_THAI_KEDMANEE_NONSHIFTLOCK_LAYOUT, "Тайская Кедмани (без ShiftLock)" + IDS_THAI_PATTACHOTE_NONSHIFTLOCK_LAYOUT, "Тайская Паташот (без ShiftLock)" + IDS_HEBREW_LAYOUT, "Иврит" + IDS_ARABIC_101_LAYOUT, "Арабская (101)" + IDS_ARABIC_102_LAYOUT, "Арабская (102)" + IDS_ARABIC_102_AZERTY_LAYOUT, "Арабская (102) AZERTY" + IDS_CZECH_PROGRAMMERS_LAYOUT, "Чешская (программистская)" + IDS_LITHUANIAN_LAYOUT, "Литовская" + IDS_BELGIAN_COMMA_LAYOUT, "Бельгийская (с запятой)" + IDS_CHINESE_TRADITIONAL_NEWPHONETIC_LAYOUT, "Китайская (традиционная) - новая фонетическая" + IDS_CHINESE_SIMPLIFIED_MSPINYINIME30_LAYOUT, "Китайская (упрощенная) - Microsoft Pinyin IME 3.0" + IDS_UNITED_STATES_DVIRAK_LAYOUT, "США - по Двораку" + IDS_CHINESE_TRADITIONAL_NEWCHANGJIE_LAYOUT, "Китайская (традиционная) - новая ChangJie" + IDS_ASSAMESE_LAYOUT, "Ассамская" + IDS_BENGALI_LAYOUT, "Бенгальская" + IDS_DEVANAGARI_INSCRIPT_LAYOUT, "Деванагари - инскрипт" + IDS_GUJARATI_LAYOUT, "Гуджарати" + IDS_KANNADA_LAYOUT, "Каннада" + IDS_MALAYALAM_LAYOUT, "Малаялам" + IDS_ORIYA_LAYOUT, "Ория" + IDS_PUNJABI_LAYOUT, "Пенджабская" + IDS_TAMIL_LAYOUT, "Тамильская" + IDS_TELUGU_LAYOUT, "Телугу" + IDS_MARATHI_LAYOUT, "Маратхи" + IDS_HINDI_TRADITIONAL_LAYOUT, "Хинди традиционная" + IDS_CANTONESE_PHONETIC_LAYOUT, "Кантонская фонетическая" + IDS_FAEROESE_LAYOUT, "Фарерская" + IDS_FYRO_MACEDONIAN_LAYOUT, "Македонский (FYROM)" + IDS_CANADIAN_MULTILINGUAL_STD_LAYOUT, "Канадская стандартная (многоязычная)" + IDS_CHINESE_TRADITIONAL_QUICK_LAYOUT, "Китайская (традиционная) - быстрая" + IDS_CHINESE_TRADITIONAL_ARRAY_LAYOUT, "Китайская (традиционная) - таблицей" + IDS_KAZAKH_LAYOUT, "Казахская" + IDS_UZBEK_CYRILLIC_LAYOUT, "Узбекская кириллица" + IDS_AZERI_CYRILLIC_LAYOUT, "Азербайджанская (кир)" + IDS_TATAR_LAYOUT, "Татарская" + IDS_AZERI_LATIN_LAYOUT, "Азербайджанская (лат)" + IDS_VIETNAMESE_LAYOUT, "Вьетнамская" + IDS_GEORGIAN_LAYOUT, "Грузинская" + IDS_ARMENIAN_EASTERN_LAYOUT, "Армянская восточная" + IDS_ARMENIAN_WESTERN_LAYOUT, "Армянская западная" + IDS_GREEK_POLYTONIC_LAYOUT, "Греческая политоническая" + IDS_USENG_TABLE_IBM_ARABIC238L_LAYOUT, "США английская табличная для IBM арабского 238_L" + IDS_FARSI_LAYOUT, "Фарси" + IDS_GAELIC_LAYOUT, "Гэльская" + IDS_PORTUGUESE_BRAZIL_ABNT2_LAYOUT, "Португальская (Бразилия)" + IDS_MONGOLIAN_CYRILLIC_LAYOUT, "Монгольская (кириллица)" + IDS_KYRGYZ_CYRILLIC_LAYOUT, "Киргизская (кириллица)" + IDS_URDU_LAYOUT, "Урду" + IDS_SYRIAC_LAYOUT, "Сирийская" + IDS_SYRIAC_PHONETIC_LAYOUT, "Сирийская фонетическая" + IDS_DIVEHI_PHONETIC_LAYOUT, "Дивихай фонетическая" + IDS_DIVEHI_TYPEWRITER_LAYOUT, "Дивихай машинопись" + IDS_BULGARIAN_PHONETIC_CLASSIC_LAYOUT, "Болгарская фонетическая (классическая)" + IDS_BULGARIAN_PHONETIC_BDS_LAYOUT, "Болгарская фонетическая (BDS)" + IDS_BULGARIAN_BDS_LAYOUT, "Болгарская (BDS 5237-1978)" + IDS_GERMAN_RISTOME_LAYOUT, "Немецкая (RISTOME)" + IDS_GERMAN_NEO_11_LAYOUT, "Немецкая (NEO-1.1)" + IDS_GERMAN_DE_ERGO_LAYOUT, "Немецкая (de_ergo)" + IDS_BURMESE_LAYOUT, "Бирманская" + IDS_UKRAINIAN_STUDENT_LAYOUT, "Украинская (студенческая)" END diff --git a/dll/cpl/input/lang/uk-UA.rc b/dll/cpl/input/lang/uk-UA.rc index ad112a86d6a..df36abaab1b 100644 --- a/dll/cpl/input/lang/uk-UA.rc +++ b/dll/cpl/input/lang/uk-UA.rc @@ -10,241 +10,241 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT IDD_PROPPAGESETTINGS DIALOGEX 0, 0, 254, 228 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Параметри" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " . """" """".", -1, 9, 6, 238, 25 + LTEXT "Виберіть потрібні розкладки для кожної мови введення зі списку. Для зміни списку використовуйте кнопки ""Додати"" і ""Видалити"".", -1, 9, 6, 238, 25 CONTROL "TEXT", IDC_KEYLAYOUT_LIST, "SYSLISTVIEW32", WS_BORDER | WS_VSCROLL | WS_TABSTOP | LVS_SORTASCENDING | LVS_REPORT | 0x0000808D, 8, 36, 237, 101 - PUSHBUTTON "&", IDC_SET_DEFAULT, 101, 159, 144, 14 - PUSHBUTTON "&...", IDC_ADD_BUTTON, 27, 142, 70, 14 - PUSHBUTTON "&...", IDC_REMOVE_BUTTON, 101, 142, 70, 14 - PUSHBUTTON "&...", IDC_PROP_BUTTON, 175, 142, 70, 14 - GROUPBOX "", -1, 7, 185, 240, 36 - PUSHBUTTON "& ...", IDC_KEY_SET_BTN, 14, 198, 110, 14 + PUSHBUTTON "Замов&чування", IDC_SET_DEFAULT, 101, 159, 144, 14 + PUSHBUTTON "&Додати...", IDC_ADD_BUTTON, 27, 142, 70, 14 + PUSHBUTTON "В&идалити...", IDC_REMOVE_BUTTON, 101, 142, 70, 14 + PUSHBUTTON "В&ластивості...", IDC_PROP_BUTTON, 175, 142, 70, 14 + GROUPBOX "Налаштування", -1, 7, 185, 240, 36 + PUSHBUTTON "&Параметри клавіатури...", IDC_KEY_SET_BTN, 14, 198, 110, 14 END IDD_KEYSETTINGS DIALOGEX 0, 0, 272, 163 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION " " +CAPTION "Додаткові параметри клавіатури" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " Caps Lock", -1, 7, 7, 258, 26 - AUTORADIOBUTTON "& CAPS LOCK", IDC_PRESS_CL_KEY_RB, 10, 17, 130, 11, WS_GROUP - AUTORADIOBUTTON " & SHIFT", IDC_PRESS_SHIFT_KEY_RB, 144, 17, 120, 11, NOT WS_TABSTOP - GROUPBOX " ", -1, 7, 37, 258, 95 - LTEXT "ij", -1, 14, 47, 60, 9 - RTEXT "& ", -1, 177, 47, 79, 9 + GROUPBOX "Вимкнення режиму Caps Lock", -1, 7, 7, 258, 26 + AUTORADIOBUTTON "&при натисненні клавіші CAPS LOCK", IDC_PRESS_CL_KEY_RB, 10, 17, 130, 11, WS_GROUP + AUTORADIOBUTTON "при &натисненні клавіші SHIFT", IDC_PRESS_SHIFT_KEY_RB, 144, 17, 120, 11, NOT WS_TABSTOP + GROUPBOX "Сполучення клавіш для мов вводу", -1, 7, 37, 258, 95 + LTEXT "Дія", -1, 14, 47, 60, 9 + RTEXT "&Сполучення клавіш", -1, 177, 47, 79, 9 CONTROL "", IDC_KEY_LISTVIEW, "SysListView32", LVS_REPORT | LVS_NOCOLUMNHEADER | LVS_AUTOARRANGE | LVS_SINGLESEL, 14, 57, 244, 52, WS_EX_CLIENTEDGE - PUSHBUTTON "& ...", IDC_CHANGE_KEY_SEQ_BTN, 152, 113, 106, 14, WS_GROUP + PUSHBUTTON "З&міна сполучення клавіш...", IDC_CHANGE_KEY_SEQ_BTN, 152, 113, 106, 14, WS_GROUP DEFPUSHBUTTON "OK", IDOK, 66, 140, 70, 14 - PUSHBUTTON "", IDCANCEL, 146, 140, 70, 14 + PUSHBUTTON "Скасувати", IDCANCEL, 146, 140, 70, 14 END IDD_ADD DIALOGEX 20, 20, 227, 90 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION " " +CAPTION "Додавання мови вводу" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "& :", -1, 7, 7, 61, 10 + LTEXT "&Мова вводу:", -1, 7, 7, 61, 10 COMBOBOX IDC_INPUT_LANG_COMBO, 7, 17, 212, 150, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL - LTEXT "& (IME):", -1, 7, 36, 140, 10 + LTEXT "&Розкладка клавіатури або засіб вводу (IME):", -1, 7, 36, 140, 10 COMBOBOX IDC_KEYBOARD_LO_COMBO, 7, 47, 212, 150, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL DEFPUSHBUTTON "OK", IDOK, 116, 68, 50, 14 - PUSHBUTTON "", IDCANCEL, 169, 68, 50, 14 + PUSHBUTTON "Скасувати", IDCANCEL, 169, 68, 50, 14 END IDD_CHANGE_KEY_SEQ DIALOGEX 5, 100, 230, 125 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION " " +CAPTION "Зміна сполучення клавіш" FONT 8, "MS Shell Dlg" BEGIN GROUPBOX "", -1, 9, 5, 155, 110 - AUTOCHECKBOX "& ", IDC_SWITCH_INPUT_LANG_CB, 15, 15, 105, 12 + AUTOCHECKBOX "&Перемикати мови вводу", IDC_SWITCH_INPUT_LANG_CB, 15, 15, 105, 12 LTEXT "Shift", -1, 73, 37, 27, 12 CTEXT "+", -1, 62, 37, 8, 9 AUTORADIOBUTTON "&Ctrl", IDC_CTRL_LANG, 29, 31, 30, 11 - AUTORADIOBUTTON "ALT &", IDC_LEFT_ALT_LANG, 29, 45, 46, 12 - AUTOCHECKBOX "& ", IDC_SWITCH_KBLAYOUTS_CB, 16, 65, 141, 12 + AUTORADIOBUTTON "ALT з&ліва", IDC_LEFT_ALT_LANG, 29, 45, 46, 12 + AUTOCHECKBOX "Переми&кати розкладки клавіатури", IDC_SWITCH_KBLAYOUTS_CB, 16, 65, 141, 12 LTEXT "Shift", -1, 74, 87, 27, 12 CTEXT "+", -1, 63, 87, 8, 9 AUTORADIOBUTTON "C&trl", IDC_CTRL_LAYOUT, 30, 81, 30, 11 - AUTORADIOBUTTON "ALT &", IDC_LEFT_ALT_LAYOUT, 30, 95, 44, 12 + AUTORADIOBUTTON "ALT &зліва", IDC_LEFT_ALT_LAYOUT, 30, 95, 44, 12 DEFPUSHBUTTON "OK", IDOK, 172, 9, 50, 14 - PUSHBUTTON "", IDCANCEL, 172, 27, 50, 14 + PUSHBUTTON "Скасувати", IDCANCEL, 172, 27, 50, 14 END IDD_INPUT_LANG_PROP DIALOGEX 20, 20, 227, 75 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_NOIDLEMSG | DS_CONTEXTHELP | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION " " +CAPTION "Властивості мови вводу" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " :", -1, 7, 7, 61, 8 + LTEXT "Мова вводу:", -1, 7, 7, 61, 8 LTEXT "", IDC_INPUT_LANG_STR, 73, 7, 129, 8 - LTEXT "& (IME):", -1, 7, 21, 150, 10 + LTEXT "&Розкладка клавіатури або засіб вводу (IME):", -1, 7, 21, 150, 10 COMBOBOX IDC_KB_LAYOUT_IME_COMBO, 7, 32, 212, 150, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL DEFPUSHBUTTON "OK", IDOK, 116, 53, 52, 14 - PUSHBUTTON "", IDCANCEL, 169, 53, 52, 14 + PUSHBUTTON "Скасувати", IDCANCEL, 169, 53, 52, 14 END STRINGTABLE BEGIN - IDS_CPLSYSTEMNAME " " - IDS_CPLSYSTEMDESCRIPTION " ." - IDS_KEYBOARD "" - IDS_NONE "()" - IDS_UNKNOWN "( )" - IDS_RESTART " ' ?" - IDS_WHATS_THIS " ?" - IDS_LANGUAGE "" - IDS_LAYOUT " " - IDS_REM_QUESTION " ?" - IDS_CONFIRMATION "ϳ" - IDS_LAYOUT_EXISTS " ." - IDS_LAYOUT_EXISTS2 " ." + IDS_CPLSYSTEMNAME "Мови та служби текстового вводу" + IDS_CPLSYSTEMDESCRIPTION "Налаштовує параметри для текстового вводу." + IDS_KEYBOARD "Клавіатура" + IDS_NONE "(Немає)" + IDS_UNKNOWN "(Немає даних)" + IDS_RESTART "Ви дійсно бажаєте перезавантажити комп'ютер зараз?" + IDS_WHATS_THIS "Що це?" + IDS_LANGUAGE "Мова" + IDS_LAYOUT "Розкладка клавіатури" + IDS_REM_QUESTION "Ви дійсно хочете видалити вибрану розкладку клавіатури?" + IDS_CONFIRMATION "Підтвердження" + IDS_LAYOUT_EXISTS "Ця розкладка вже існує." + IDS_LAYOUT_EXISTS2 "Ця розкладка вже існує і не може бути додана." IDS_CTRL_SHIFT "Ctrl+Shift" - IDS_LEFT_ALT_SHIFT "Alt +Shift" - IDS_SWITCH_BET_INLANG " " + IDS_LEFT_ALT_SHIFT "Alt зліва+Shift" + IDS_SWITCH_BET_INLANG "Перемикання мов вводу" END STRINGTABLE BEGIN - IDS_US_LAYOUT, "" - IDS_BELGIAN_LAYOUT, " ( )" - IDS_BELGIAN_FRENCH_LAYOUT, " ()" - IDS_PORTUGUESE_BRAZILIAN_ABNT_LAYOUT, " ( ABNT)" - IDS_CANADIAN_FRENCH_LAYOUT, " ()" - IDS_CANADIAN_FRENCH_LEGACY_LAYOUT, " (, )" - IDS_DANISH_LAYOUT, "" - IDS_DUTCH_LAYOUT, "ͳ" - IDS_FINNISH_LAYOUT, "Գ" - IDS_FRENCH_LAYOUT, "" - IDS_GERMAN_LAYOUT, "ͳ" - IDS_GERMAN_IBM_LAYOUT, "ͳ (IBM)" - IDS_ICELANDIC_LAYOUT, "" - IDS_IRISH_LAYOUT, "" - IDS_ITALIAN_LAYOUT, "" - IDS_ITALIAN_142_LAYOUT, " (142)" - IDS_LATIN_AMERICAN_LAYOUT, " " - IDS_NORWEGIAN_LAYOUT, "" - IDS_PORTUGUESE_LAYOUT, "" - IDS_SPANISH_LAYOUT, "" - IDS_SPANISH_VARIANTION_LAYOUT, " 2" - IDS_SWEDISH_LAYOUT, "" - IDS_SWISS_FRENCH_LAYOUT, " ()" - IDS_SWISS_GERMAN_LAYOUT, "ͳ ()" - IDS_UNITED_KINGDOM_LAYOUT, "" - IDS_UNITED_STATES_INTERNATIONAL_LAYOUT, " - " - IDS_UNITED_STATES_DVORAK_FOR_LEFT_HAND_LAYOUT, " - ( )" - IDS_UNITED_STATES_DVORAK_FOR_RIGHT_HAND_LAYOUT, " - ( )" - IDS_ALBANIAN_LAYOUT, "" - IDS_CROATIAN_LAYOUT, "" - IDS_CZECH_LAYOUT, "" - IDS_CZECH_QWERTY_LAYOUT, " (QWERTY)" - IDS_HUNGARIAN_LAYOUT, "" - IDS_HUNGARIAN_101_KEY_LAYOUT, " (101 )" - IDS_POLISH_LAYOUT, " ()" - IDS_POLISH_214_LAYOUT, " (214)" - IDS_ROMANIAN_LAYOUT, "" - IDS_SERBIAN_LATIN_LAYOUT, " ()" - IDS_SLOVAK_LAYOUT, "" - IDS_SLOVAK_QWERTY_LAYOUT, " (QWERTY)" - IDS_SLOVENIAN_LAYOUT, "" - IDS_ESTONIAN_LAYOUT, "" - IDS_LATVIAN_LAYOUT, "" - IDS_LATVIAN_QWERTY_LAYOUT, " (QWERTY)" - IDS_LITHUANIAN_IBM_LAYOUT, " (IBM)" - IDS_GREEK_LAYOUT, "" - IDS_GREEK_LATIN_LAYOUT, " ()" - IDS_GREEK_220_LAYOUT, " (220)" - IDS_GREEK_319_LAYOUT, " (319)" - IDS_GREEK_220_LATIN_LAYOUT, " (220, )" - IDS_GREEK_319_LATIN_LAYOUT, " (319, )" - IDS_BELARUSIAN_LAYOUT, "" - IDS_BULGARIAN_LAYOUT, "" - IDS_BULGARIAN_LATIN_LAYOUT, " ()" - IDS_RUSSIAN_LAYOUT, "" - IDS_RUSSIAN_TYPEWRITER_LAYOUT, " ( )" - IDS_SERBIAN_CYRILLIC_LAYOUT, " ()" - IDS_UKRAINIAN_LAYOUT, "" - IDS_TURKISH_F_LAYOUT, " F" - IDS_TURKISH_Q_LAYOUT, " Q" - IDS_JAPANESE_LAYOUT, "" - IDS_JAPANESE_INPUT_SYSTEM_MSIME2002_LAYOUT, " (MS-IME2002)" - IDS_KOREAN_LAYOUT, "" - IDS_KOREAN_INPUT_SYSTEM_MSIME2002_LAYOUT, " (MS-IME2002)" - IDS_CHINESE_TRADITIONAL_USKEYBOARD_LAYOUT, " ( ) - " - IDS_CHINESE_TRADITIONAL_PHONETIC_LAYOUT, " ( ) - " - IDS_CHINESE_TRADITIONAL_CHANGJIE_LAYOUT, " ( ) - ChangJie" - IDS_CHINESE_TRADITIONAL_BIG5CODE_LAYOUT, " ( ) - Big5 Code" - IDS_CHINESE_TRADITIONAL_DAYI_LAYOUT, " ( ) - DaYi" - IDS_CHINESE_TRADITIONAL_UNICODE_LAYOUT, " ( ) - " - IDS_CHINESE_TRADITIONAL_ALPHANUMERIC_LAYOUT, " ( ) - -" - IDS_CHINESE_SIMPLIFIED_USKEYBOARD_LAYOUT, " ( ) - " - IDS_CHINESE_SIMPLIFIED_QUANPIN_LAYOUT, " ( ) - QuanPin" - IDS_CHINESE_SIMPLIFIED_SHUANGPIN_LAYOUT, " ( ) - ShuangPin" - IDS_CHINESE_SIMPLIFIED_ZHENGMA_LAYOUT, " ( ) - ZhengMa" - IDS_CHINESE_SIMPLIFIED_NEIMA_LAYOUT, " ( ) - NeiMa" - IDS_THAI_KEDMANEE_LAYOUT, " " - IDS_THAI_PATTACHOTE_LAYOUT, " " - IDS_THAI_KEDMANEE_NONSHIFTLOCK_LAYOUT, " ( ShiftLock)" - IDS_THAI_PATTACHOTE_NONSHIFTLOCK_LAYOUT, " ( ShiftLock)" - IDS_HEBREW_LAYOUT, "" - IDS_ARABIC_101_LAYOUT, " (101)" - IDS_ARABIC_102_LAYOUT, " (102)" - IDS_ARABIC_102_AZERTY_LAYOUT, " (102) AZERTY" - IDS_CZECH_PROGRAMMERS_LAYOUT, " ()" - IDS_LITHUANIAN_LAYOUT, "" - IDS_BELGIAN_COMMA_LAYOUT, " ( )" - IDS_CHINESE_TRADITIONAL_NEWPHONETIC_LAYOUT, " ( ) - " - IDS_CHINESE_SIMPLIFIED_MSPINYINIME30_LAYOUT, " ( ) - Microsoft Pinyin IME 3.0" - IDS_UNITED_STATES_DVIRAK_LAYOUT, " - " - IDS_CHINESE_TRADITIONAL_NEWCHANGJIE_LAYOUT, " ( ) - ChangJie" - IDS_ASSAMESE_LAYOUT, "" - IDS_BENGALI_LAYOUT, "" - IDS_DEVANAGARI_INSCRIPT_LAYOUT, " (INSCRIPT)" - IDS_GUJARATI_LAYOUT, "" - IDS_KANNADA_LAYOUT, "" - IDS_MALAYALAM_LAYOUT, "" - IDS_ORIYA_LAYOUT, "" - IDS_PUNJABI_LAYOUT, "" - IDS_TAMIL_LAYOUT, "" - IDS_TELUGU_LAYOUT, "" - IDS_MARATHI_LAYOUT, "" - IDS_HINDI_TRADITIONAL_LAYOUT, "ճ ()" - IDS_CANTONESE_PHONETIC_LAYOUT, " ()" - IDS_FAEROESE_LAYOUT, "" - IDS_FYRO_MACEDONIAN_LAYOUT, " ()" - IDS_CANADIAN_MULTILINGUAL_STD_LAYOUT, " ()" - IDS_CHINESE_TRADITIONAL_QUICK_LAYOUT, " ( ) - " - IDS_CHINESE_TRADITIONAL_ARRAY_LAYOUT, " ( ) - " - IDS_KAZAKH_LAYOUT, "" - IDS_UZBEK_CYRILLIC_LAYOUT, " ()" - IDS_AZERI_CYRILLIC_LAYOUT, " ()" - IDS_TATAR_LAYOUT, "" - IDS_AZERI_LATIN_LAYOUT, " ()" - IDS_VIETNAMESE_LAYOUT, "'" - IDS_GEORGIAN_LAYOUT, "" - IDS_ARMENIAN_EASTERN_LAYOUT, "³ ()" - IDS_ARMENIAN_WESTERN_LAYOUT, "³ ()" - IDS_GREEK_POLYTONIC_LAYOUT, " ()" - IDS_USENG_TABLE_IBM_ARABIC238L_LAYOUT, " () (IBM, 238_L)" - IDS_FARSI_LAYOUT, "" - IDS_GAELIC_LAYOUT, "" - IDS_PORTUGUESE_BRAZIL_ABNT2_LAYOUT, " ( ABNT2)" - IDS_MONGOLIAN_CYRILLIC_LAYOUT, " ()" - IDS_KYRGYZ_CYRILLIC_LAYOUT, " ()" - IDS_URDU_LAYOUT, "" - IDS_SYRIAC_LAYOUT, "" - IDS_SYRIAC_PHONETIC_LAYOUT, " ()" - IDS_DIVEHI_PHONETIC_LAYOUT, " ()" - IDS_DIVEHI_TYPEWRITER_LAYOUT, " ( )" - IDS_BULGARIAN_PHONETIC_CLASSIC_LAYOUT, " ()" - IDS_BULGARIAN_PHONETIC_BDS_LAYOUT, " (BDS)" - IDS_BULGARIAN_BDS_LAYOUT, " BDS 5237-1978" - IDS_GERMAN_RISTOME_LAYOUT, "ͳ (RISTOME)" - IDS_GERMAN_NEO_11_LAYOUT, "ͳ (NEO-1.1)" - IDS_GERMAN_DE_ERGO_LAYOUT, "ͳ (de_ergo)" - IDS_BURMESE_LAYOUT, "" - IDS_UKRAINIAN_STUDENT_LAYOUT, " ()" + IDS_US_LAYOUT, "США" + IDS_BELGIAN_LAYOUT, "Бельгійська (із крапкою)" + IDS_BELGIAN_FRENCH_LAYOUT, "Французька (Бельгія)" + IDS_PORTUGUESE_BRAZILIAN_ABNT_LAYOUT, "Португальська (Бразилія ABNT)" + IDS_CANADIAN_FRENCH_LAYOUT, "Французька (Канада)" + IDS_CANADIAN_FRENCH_LEGACY_LAYOUT, "Французька (Канада, традиційна)" + IDS_DANISH_LAYOUT, "Датська" + IDS_DUTCH_LAYOUT, "Нідерландська" + IDS_FINNISH_LAYOUT, "Фінська" + IDS_FRENCH_LAYOUT, "Французька" + IDS_GERMAN_LAYOUT, "Німецька" + IDS_GERMAN_IBM_LAYOUT, "Німецька (IBM)" + IDS_ICELANDIC_LAYOUT, "Ісландська" + IDS_IRISH_LAYOUT, "Ірландська" + IDS_ITALIAN_LAYOUT, "Італійська" + IDS_ITALIAN_142_LAYOUT, "Італійська (142)" + IDS_LATIN_AMERICAN_LAYOUT, "Латинська Америка" + IDS_NORWEGIAN_LAYOUT, "Норвезька" + IDS_PORTUGUESE_LAYOUT, "Португальська" + IDS_SPANISH_LAYOUT, "Іспанська" + IDS_SPANISH_VARIANTION_LAYOUT, "Іспанська 2" + IDS_SWEDISH_LAYOUT, "Шведська" + IDS_SWISS_FRENCH_LAYOUT, "Французька (Швейцарія)" + IDS_SWISS_GERMAN_LAYOUT, "Німецька (Швейцарія)" + IDS_UNITED_KINGDOM_LAYOUT, "Великобританія" + IDS_UNITED_STATES_INTERNATIONAL_LAYOUT, "США - міжнародна" + IDS_UNITED_STATES_DVORAK_FOR_LEFT_HAND_LAYOUT, "США - Дворак (для лівої руки)" + IDS_UNITED_STATES_DVORAK_FOR_RIGHT_HAND_LAYOUT, "США - Дворак (для правої руки)" + IDS_ALBANIAN_LAYOUT, "Албанська" + IDS_CROATIAN_LAYOUT, "Хорватська" + IDS_CZECH_LAYOUT, "Чеська" + IDS_CZECH_QWERTY_LAYOUT, "Чеська (QWERTY)" + IDS_HUNGARIAN_LAYOUT, "Угорська" + IDS_HUNGARIAN_101_KEY_LAYOUT, "Угорська (101 клавіша)" + IDS_POLISH_LAYOUT, "Польська (програмістська)" + IDS_POLISH_214_LAYOUT, "Польська (214)" + IDS_ROMANIAN_LAYOUT, "Румунська" + IDS_SERBIAN_LATIN_LAYOUT, "Сербська (латиниця)" + IDS_SLOVAK_LAYOUT, "Словацька" + IDS_SLOVAK_QWERTY_LAYOUT, "Словацька (QWERTY)" + IDS_SLOVENIAN_LAYOUT, "Словенська" + IDS_ESTONIAN_LAYOUT, "Естонська" + IDS_LATVIAN_LAYOUT, "Латвійська" + IDS_LATVIAN_QWERTY_LAYOUT, "Латвійська (QWERTY)" + IDS_LITHUANIAN_IBM_LAYOUT, "Литовська (IBM)" + IDS_GREEK_LAYOUT, "Грецька" + IDS_GREEK_LATIN_LAYOUT, "Грецька (латиниця)" + IDS_GREEK_220_LAYOUT, "Грецька (220)" + IDS_GREEK_319_LAYOUT, "Грецька (319)" + IDS_GREEK_220_LATIN_LAYOUT, "Грецька (220, латиниця)" + IDS_GREEK_319_LATIN_LAYOUT, "Грецька (319, латиниця)" + IDS_BELARUSIAN_LAYOUT, "Білоруська" + IDS_BULGARIAN_LAYOUT, "Болгарська" + IDS_BULGARIAN_LATIN_LAYOUT, "Болгарська (латиниця)" + IDS_RUSSIAN_LAYOUT, "Російська" + IDS_RUSSIAN_TYPEWRITER_LAYOUT, "Російська (друкарська машинка)" + IDS_SERBIAN_CYRILLIC_LAYOUT, "Сербська (кирилиця)" + IDS_UKRAINIAN_LAYOUT, "Українська" + IDS_TURKISH_F_LAYOUT, "Турецька F" + IDS_TURKISH_Q_LAYOUT, "Турецька Q" + IDS_JAPANESE_LAYOUT, "Японська" + IDS_JAPANESE_INPUT_SYSTEM_MSIME2002_LAYOUT, "Японський засіб вводу (MS-IME2002)" + IDS_KOREAN_LAYOUT, "Корейська" + IDS_KOREAN_INPUT_SYSTEM_MSIME2002_LAYOUT, "Корейський засіб вводу (MS-IME2002)" + IDS_CHINESE_TRADITIONAL_USKEYBOARD_LAYOUT, "Китайська (традиційне письмо) - США" + IDS_CHINESE_TRADITIONAL_PHONETIC_LAYOUT, "Китайська (традиційне письмо) - фонетична" + IDS_CHINESE_TRADITIONAL_CHANGJIE_LAYOUT, "Китайська (традиційне письмо) - ChangJie" + IDS_CHINESE_TRADITIONAL_BIG5CODE_LAYOUT, "Китайська (традиційне письмо) - Big5 Code" + IDS_CHINESE_TRADITIONAL_DAYI_LAYOUT, "Китайська (традиційне письмо) - DaYi" + IDS_CHINESE_TRADITIONAL_UNICODE_LAYOUT, "Китайська (традиційне письмо) - Юнікод" + IDS_CHINESE_TRADITIONAL_ALPHANUMERIC_LAYOUT, "Китайська (традиційне письмо) - алфавітно-цифрова" + IDS_CHINESE_SIMPLIFIED_USKEYBOARD_LAYOUT, "Китайська (спрощене письмо) - США" + IDS_CHINESE_SIMPLIFIED_QUANPIN_LAYOUT, "Китайська (спрощене письмо) - QuanPin" + IDS_CHINESE_SIMPLIFIED_SHUANGPIN_LAYOUT, "Китайська (спрощене письмо) - ShuangPin" + IDS_CHINESE_SIMPLIFIED_ZHENGMA_LAYOUT, "Китайська (спрощене письмо) - ZhengMa" + IDS_CHINESE_SIMPLIFIED_NEIMA_LAYOUT, "Китайська (спрощене письмо) - NeiMa" + IDS_THAI_KEDMANEE_LAYOUT, "Тайська Кедмані" + IDS_THAI_PATTACHOTE_LAYOUT, "Тайська Паташот" + IDS_THAI_KEDMANEE_NONSHIFTLOCK_LAYOUT, "Тайська Кедмані (без ShiftLock)" + IDS_THAI_PATTACHOTE_NONSHIFTLOCK_LAYOUT, "Тайська Паташот (без ShiftLock)" + IDS_HEBREW_LAYOUT, "Іврит" + IDS_ARABIC_101_LAYOUT, "Арабська (101)" + IDS_ARABIC_102_LAYOUT, "Арабська (102)" + IDS_ARABIC_102_AZERTY_LAYOUT, "Арабська (102) AZERTY" + IDS_CZECH_PROGRAMMERS_LAYOUT, "Чеська (програмістська)" + IDS_LITHUANIAN_LAYOUT, "Литовська" + IDS_BELGIAN_COMMA_LAYOUT, "Бельгійська (з комою)" + IDS_CHINESE_TRADITIONAL_NEWPHONETIC_LAYOUT, "Китайська (традиційне письмо) - нова фонетична" + IDS_CHINESE_SIMPLIFIED_MSPINYINIME30_LAYOUT, "Китайська (спрощене письмо) - Microsoft Pinyin IME 3.0" + IDS_UNITED_STATES_DVIRAK_LAYOUT, "США - Дворак" + IDS_CHINESE_TRADITIONAL_NEWCHANGJIE_LAYOUT, "Китайська (традиційне письмо) - нова ChangJie" + IDS_ASSAMESE_LAYOUT, "Ассамська" + IDS_BENGALI_LAYOUT, "Бенгалі" + IDS_DEVANAGARI_INSCRIPT_LAYOUT, "Деванагарі (INSCRIPT)" + IDS_GUJARATI_LAYOUT, "Гуджараті" + IDS_KANNADA_LAYOUT, "Каннада" + IDS_MALAYALAM_LAYOUT, "Малаялам" + IDS_ORIYA_LAYOUT, "Орія" + IDS_PUNJABI_LAYOUT, "Панджабі" + IDS_TAMIL_LAYOUT, "Тамільська" + IDS_TELUGU_LAYOUT, "Телугу" + IDS_MARATHI_LAYOUT, "Маратхі" + IDS_HINDI_TRADITIONAL_LAYOUT, "Хінді (традиційна)" + IDS_CANTONESE_PHONETIC_LAYOUT, "Кантонська (фонетична)" + IDS_FAEROESE_LAYOUT, "Фарерська" + IDS_FYRO_MACEDONIAN_LAYOUT, "Македонська (Македонія)" + IDS_CANADIAN_MULTILINGUAL_STD_LAYOUT, "Канадська стандартна (багатомовна)" + IDS_CHINESE_TRADITIONAL_QUICK_LAYOUT, "Китайська (традиційне письмо) - швидка" + IDS_CHINESE_TRADITIONAL_ARRAY_LAYOUT, "Китайська (традиційне письмо) - таблична" + IDS_KAZAKH_LAYOUT, "Казахська" + IDS_UZBEK_CYRILLIC_LAYOUT, "Узбецька (кирилиця)" + IDS_AZERI_CYRILLIC_LAYOUT, "Азербайджанська (кирилиця)" + IDS_TATAR_LAYOUT, "Татарська" + IDS_AZERI_LATIN_LAYOUT, "Азербайджанська (латиниця)" + IDS_VIETNAMESE_LAYOUT, "В'єтнамська" + IDS_GEORGIAN_LAYOUT, "Грузинська" + IDS_ARMENIAN_EASTERN_LAYOUT, "Вірменська (східна)" + IDS_ARMENIAN_WESTERN_LAYOUT, "Вірменська (західна)" + IDS_GREEK_POLYTONIC_LAYOUT, "Грецька (політонічна)" + IDS_USENG_TABLE_IBM_ARABIC238L_LAYOUT, "Англійська таблична (США) для арабської (IBM, 238_L)" + IDS_FARSI_LAYOUT, "Перська" + IDS_GAELIC_LAYOUT, "Гельська" + IDS_PORTUGUESE_BRAZIL_ABNT2_LAYOUT, "Португальська (Бразилія ABNT2)" + IDS_MONGOLIAN_CYRILLIC_LAYOUT, "Монгольська (кирилиця)" + IDS_KYRGYZ_CYRILLIC_LAYOUT, "Киргизька (кирилиця)" + IDS_URDU_LAYOUT, "Урду" + IDS_SYRIAC_LAYOUT, "Сирійська" + IDS_SYRIAC_PHONETIC_LAYOUT, "Сирійська (фонетична)" + IDS_DIVEHI_PHONETIC_LAYOUT, "Мальдівська (фонетична)" + IDS_DIVEHI_TYPEWRITER_LAYOUT, "Мальдівська (друкарська машинка)" + IDS_BULGARIAN_PHONETIC_CLASSIC_LAYOUT, "Болгарська фонетична (класична)" + IDS_BULGARIAN_PHONETIC_BDS_LAYOUT, "Болгарська фонетична (BDS)" + IDS_BULGARIAN_BDS_LAYOUT, "Болгарська BDS 5237-1978" + IDS_GERMAN_RISTOME_LAYOUT, "Німецька (RISTOME)" + IDS_GERMAN_NEO_11_LAYOUT, "Німецька (NEO-1.1)" + IDS_GERMAN_DE_ERGO_LAYOUT, "Німецька (de_ergo)" + IDS_BURMESE_LAYOUT, "Бірманська" + IDS_UKRAINIAN_STUDENT_LAYOUT, "Українська (студентська)" END diff --git a/dll/cpl/input/rsrc.rc b/dll/cpl/input/rsrc.rc index 2dcb7b7f22a..3c2eb0e4311 100644 --- a/dll/cpl/input/rsrc.rc +++ b/dll/cpl/input/rsrc.rc @@ -10,9 +10,12 @@ #include "lang/fr-FR.rc" #include "lang/it-IT.rc" #include "lang/no-NO.rc" +#include "lang/sk-SK.rc" +#include "lang/zh-CN.rc" + +// UTF-8 +#pragma code_page(65001) #include "lang/pl-PL.rc" #include "lang/ro-RO.rc" #include "lang/ru-RU.rc" -#include "lang/sk-SK.rc" #include "lang/uk-UA.rc" -#include "lang/zh-CN.rc" diff --git a/dll/cpl/input/settings.c b/dll/cpl/input/settings.c index 5f1ca81e066..849d70cd62a 100644 --- a/dll/cpl/input/settings.c +++ b/dll/cpl/input/settings.c @@ -10,7 +10,6 @@ * 06-09-2007 Created */ -#include "resource.h" #include "input.h" static HWND MainDlgWnd; diff --git a/dll/cpl/intl/CMakeLists.txt b/dll/cpl/intl/CMakeLists.txt index cae9ec0d80e..7af2bd2f7f0 100644 --- a/dll/cpl/intl/CMakeLists.txt +++ b/dll/cpl/intl/CMakeLists.txt @@ -2,8 +2,6 @@ set_unicode() set_rc_compiler() -add_definitions(-D_DLL -D__USE_CRTIMP) - spec2def(intl.cpl intl.spec) add_library(intl SHARED @@ -32,4 +30,5 @@ add_importlibs(intl shell32 kernel32) +add_pch(intl intl.h) add_cd_file(TARGET intl DESTINATION reactos/system32 FOR all) diff --git a/dll/cpl/intl/advanced.c b/dll/cpl/intl/advanced.c index 2196e762552..22c5a11bfc4 100644 --- a/dll/cpl/intl/advanced.c +++ b/dll/cpl/intl/advanced.c @@ -1,13 +1,5 @@ -#include -#include -#include -#include -#include -#include -#include #include "intl.h" -#include "resource.h" typedef struct CPStruct { diff --git a/dll/cpl/intl/currency.c b/dll/cpl/intl/currency.c index b355640a6da..74df951da19 100644 --- a/dll/cpl/intl/currency.c +++ b/dll/cpl/intl/currency.c @@ -24,13 +24,7 @@ * PROGRAMMER: Eric Kohl */ -#include -#include -#include -#include - #include "intl.h" -#include "resource.h" #define POSITIVE_EXAMPLE _T("123456789.00") #define NEGATIVE_EXAMPLE _T("-123456789.00") diff --git a/dll/cpl/intl/date.c b/dll/cpl/intl/date.c index b92d4c2d66b..ff7468f870a 100644 --- a/dll/cpl/intl/date.c +++ b/dll/cpl/intl/date.c @@ -24,13 +24,7 @@ * PROGRAMMER: Eric Kohl */ -#include -#include -#include -#include - #include "intl.h" -#include "resource.h" /* GLOBALS ******************************************************************/ diff --git a/dll/cpl/intl/generalp.c b/dll/cpl/intl/generalp.c index f1e93241449..9cbe5d032b1 100644 --- a/dll/cpl/intl/generalp.c +++ b/dll/cpl/intl/generalp.c @@ -26,13 +26,7 @@ * Aleksey Bragin */ -#include -#include -#include -#include - #include "intl.h" -#include "resource.h" #define SAMPLE_NUMBER _T("123456789") #define NO_FLAG 0 diff --git a/dll/cpl/intl/inplocale.c b/dll/cpl/intl/inplocale.c index e80e1f996ed..785cf902aaa 100644 --- a/dll/cpl/intl/inplocale.c +++ b/dll/cpl/intl/inplocale.c @@ -24,14 +24,7 @@ * PROGRAMMER: Eric Kohl */ -#include -#include -#include -#include - #include "intl.h" -#include "resource.h" - /* Property page dialog callback */ INT_PTR CALLBACK diff --git a/dll/cpl/intl/intl.c b/dll/cpl/intl/intl.c index 1f084950e8a..d3dc375a306 100644 --- a/dll/cpl/intl/intl.c +++ b/dll/cpl/intl/intl.c @@ -23,15 +23,8 @@ * PURPOSE: Property sheet code * PROGRAMMER: Eric Kohl */ -#include -#include -#include -#include -#include #include "intl.h" -#include "resource.h" - #define NUM_APPLETS (1) diff --git a/dll/cpl/intl/intl.h b/dll/cpl/intl/intl.h index 12de475dc5e..20dbbba4ff1 100644 --- a/dll/cpl/intl/intl.h +++ b/dll/cpl/intl/intl.h @@ -1,6 +1,14 @@ -#pragma once - +#include #include +#include +#include +#include +#include +#include +#include +#include + +#include "resource.h" #define DECIMAL_RADIX 10 diff --git a/dll/cpl/intl/intl.rbuild b/dll/cpl/intl/intl.rbuild index 631c8958de7..49f6c687234 100644 --- a/dll/cpl/intl/intl.rbuild +++ b/dll/cpl/intl/intl.rbuild @@ -21,4 +21,5 @@ advanced.c sort.c intl.rc + intl.h diff --git a/dll/cpl/intl/kblayouts.c b/dll/cpl/intl/kblayouts.c index 34335b96e6d..d1a8f982ab5 100644 --- a/dll/cpl/intl/kblayouts.c +++ b/dll/cpl/intl/kblayouts.c @@ -5,13 +5,7 @@ * PROGRAMMER: Dmitry Chapyshev (dmitry@reactos.org) */ -#include -#include -#include -#include - #include "intl.h" -#include "resource.h" /* Character Count of a layout ID like "00000409" */ #define CCH_LAYOUT_ID 8 diff --git a/dll/cpl/intl/lang/pl-PL.rc b/dll/cpl/intl/lang/pl-PL.rc index 3b566acdc75..c03fb81ee92 100644 --- a/dll/cpl/intl/lang/pl-PL.rc +++ b/dll/cpl/intl/lang/pl-PL.rc @@ -1,8 +1,9 @@ /* - * translated by Caemyr - Olaf Siejka (Jan, 2008; May 2010) - * Use ReactOS forum PM or IRC to contact me - * http://www.reactos.org - * IRC: irc.freenode.net #reactos-pl; + * translated by Caemyr - Olaf Siejka (Jan, 2008; May 2010) + * Use ReactOS forum PM or IRC to contact me + * http://www.reactos.org + * IRC: irc.freenode.net #reactos-pl; + * UTF-8 conversion by Caemyr (May, 2011) */ LANGUAGE LANG_POLISH, SUBLANG_DEFAULT @@ -13,38 +14,38 @@ CAPTION "Ustawienia regionalne" FONT 8, "MS Shell Dlg" BEGIN GROUPBOX "Standardy i formaty", -1, 5, 5, 234, 162 - LTEXT "Te opcje wpywaj na to jak niektre programy odczytuj liczby, waluty, daty i czas.", -1, 14, 17, 220, 25 - LTEXT "Wybierz opcj z listy, albo kliknij na Dostosuj, by wprowadzi wasny format:", -1, 14, 37, 220, 22 + LTEXT "Te opcje wpływają na to jak niektóre programy odczytują liczby, waluty, daty i czas.", -1, 14, 17, 220, 25 + LTEXT "Wybierz opcję z listy, albo kliknij na Dostosuj, by wprowadzić własny format:", -1, 14, 37, 220, 22 COMBOBOX IDC_LANGUAGELIST, 14, 56, 160, 160, CBS_DROPDOWNLIST | CBS_SORT | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL PUSHBUTTON "Do&stosuj...", IDC_SETUP_BUTTON, 178, 56, 52, 13 - LTEXT "Przykady", -1, 14, 73, 70, 10 + LTEXT "Przykłady", -1, 14, 73, 70, 10 LTEXT "Liczby:", -1, 16, 86, 48, 10 LTEXT "Waluty:", -1, 16, 101, 48, 10 LTEXT "Czas:", -1, 16, 116, 48, 10 - LTEXT "Data (krtka):", -1, 16, 131, 48, 10 - LTEXT "Data (duga):", -1, 16, 146, 48, 10 + LTEXT "Data (krótka):", -1, 16, 131, 48, 10 + LTEXT "Data (długa):", -1, 16, 146, 48, 10 EDITTEXT IDC_NUMSAMPLE_EDIT, 89, 86, 140, 12, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP | NOT WS_TABSTOP EDITTEXT IDC_MONEYSAMPLE_EDIT, 89, 101, 140, 12, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP | NOT WS_TABSTOP EDITTEXT IDC_TIMESAMPLE_EDIT, 89, 116, 140, 12, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP | NOT WS_TABSTOP EDITTEXT IDC_SHORTTIMESAMPLE_EDIT, 89, 131, 140, 12, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP | NOT WS_TABSTOP EDITTEXT IDC_FULLTIMESAMPLE_EDIT, 89, 146, 140, 12, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP | NOT WS_TABSTOP GROUPBOX "Lokalizacja geograficzna", -1, 5, 171, 234, 55 - LTEXT "Ustaw swoj obecn lokalizacj, by pewne usugi mogy dostarcza lokalnych informacji; na przykad wiadomoci i prognozy pogody.", -1, 14, 180, 215, 24 + LTEXT "Ustaw swoją obecną lokalizację, by pewne usługi mogły dostarczać lokalnych informacji; na przykład wiadomości i prognozy pogody.", -1, 14, 180, 215, 24 COMBOBOX IDC_LOCATION_COMBO, 14, 207, 217, 160, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP | CBS_SORT END IDD_LANGUAGESPAGE DIALOGEX 0, 0, 246, 230 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Jzyki" +CAPTION "Języki" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "Jzyki i usugi tekstowe", -1, 5, 5, 234, 52 - LTEXT "Aby przejrze bd zmieni zainstalowane jzyki lub usugi tekstowe, nacinij ""Szczegy...""", -1, 12, 15, 220, 18 - PUSHBUTTON "Szcze&gy...", IDC_DETAIL_BUTTON, 177, 34, 54, 14 - GROUPBOX "Dodatkowe wsparcie jzykw", -1, 5, 62, 234, 82 - LTEXT "Wikszo jzykw jest instalowana domylnie. Aby zainstalowa dodatkowe jzyki, zaznacz odpowiedni opcj poniej.", -1, 12, 72, 220, 18 - CHECKBOX "I&nstalacja jzykw o zoonej skadni i jzykw pisanych od prawej do lewej", IDC_INST_FILES_FOR_RTOL_LANG, 12, 92, 215, 22, BS_MULTILINE - CHECKBOX "In&stalacja jzykw wschodnioazjatyckich", IDC_INST_FILES_FOR_ASIAN, 12, 114, 180, 22, BS_MULTILINE + GROUPBOX "Języki i usługi tekstowe", -1, 5, 5, 234, 52 + LTEXT "Aby przejrzeć bądź zmienić zainstalowane języki lub usługi tekstowe, naciśnij ""Szczegóły...""", -1, 12, 15, 220, 18 + PUSHBUTTON "Szcze&góły...", IDC_DETAIL_BUTTON, 177, 34, 54, 14 + GROUPBOX "Dodatkowe wsparcie języków", -1, 5, 62, 234, 82 + LTEXT "Większość języków jest instalowana domyślnie. Aby zainstalować dodatkowe języki, zaznacz odpowiednią opcję poniżej.", -1, 12, 72, 220, 18 + CHECKBOX "I&nstalacja języków o złożonej składni i języków pisanych od prawej do lewej", IDC_INST_FILES_FOR_RTOL_LANG, 12, 92, 215, 22, BS_MULTILINE + CHECKBOX "In&stalacja języków wschodnioazjatyckich", IDC_INST_FILES_FOR_ASIAN, 12, 114, 180, 22, BS_MULTILINE END IDD_ADVANCEDPAGE DIALOGEX 0, 0, 246, 230 @@ -52,14 +53,14 @@ STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION CAPTION "Zaawansowane" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "Jzyki dla programw bez Unicode", -1, 5, 5, 234, 90 + GROUPBOX "Języki dla programów bez wsparcia Unicode", -1, 5, 5, 234, 90 COMBOBOX IDC_LANGUAGE_COMBO, 14, 75, 217, 160, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP | CBS_SORT - LTEXT "Te ustawienia umoliwiaj programom bez standardu Unicode wywietla menu i dialogi w odpowiednich jzykach. Nie ma to wpywu na programy Unicode ale dotyczy profili domylnych.", -1, 14, 18, 223, 33 - LTEXT "Wybierz taki jzyk, ktry ma by uywany przez programy bez Unicode:", -1, 14, 55, 223, 18 + LTEXT "Te ustawienia umożliwiają programom niewspierających Unicode wyświetlanie menu i dialogów w odpowiednich językach. Nie ma to wpływu na programy Unicode ale dotyczy profili domyślnych.", -1, 14, 18, 223, 33 + LTEXT "Wybierz taki język, który ma być używany przez programy bez Unicode:", -1, 14, 55, 223, 18 GROUPBOX "Tablice konwersji stron kodowych", -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 "Ustawienia domylne uytkownika", -1, 5, 193, 234, 30 - CHECKBOX "Zastosuj ustawienia dla obecnego konta jak i dla profilu domylnego.", IDC_APPLY_CUR_USER_DEF_PROFILE, 12, 200, 220, 22, BS_MULTILINE + GROUPBOX "Ustawienia domyślne użytkownika", -1, 5, 193, 234, 30 + CHECKBOX "Zastosuj ustawienia dla obecnego konta jak i dla profilu domyślnego.", IDC_APPLY_CUR_USER_DEF_PROFILE, 12, 200, 220, 22, BS_MULTILINE END IDD_NUMBERSPAGE DIALOGEX 0, 0, 246, 234 @@ -67,24 +68,24 @@ STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION CAPTION "Liczby" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "Przykad", -1, 7, 7, 230, 53, WS_CHILD | WS_VISIBLE + GROUPBOX "Przykład", -1, 7, 7, 230, 53, WS_CHILD | WS_VISIBLE LTEXT "Dodatnie:", -1, 13, 21, 31, 10, WS_CHILD |WS_VISIBLE | WS_GROUP EDITTEXT IDC_NUMBERSPOSSAMPLE, 48, 19, 67, 14, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP | NOT WS_TABSTOP LTEXT "Ujemne:", -1, 120, 21, 31, 10, WS_CHILD |WS_VISIBLE | WS_GROUP EDITTEXT IDC_NUMBERSNEGSAMPLE, 154, 19, 72, 14, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP | NOT WS_TABSTOP - LTEXT "&Symbol dziesitny:", -1, 8, 67, 96, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + LTEXT "&Symbol dziesiętny:", -1, 8, 67, 96, 10, WS_CHILD |WS_VISIBLE | WS_GROUP COMBOBOX IDC_NUMBERDSYMBOL, 137, 65, 100, 83, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL - LTEXT "Liczba cyfr &po symbolu dziesitnym:", -1, 8, 83, 124, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + LTEXT "Liczba cyfr &po symbolu dziesiętnym:", -1, 8, 83, 124, 10, WS_CHILD |WS_VISIBLE | WS_GROUP COMBOBOX IDC_NUMBERSNDIGDEC, 137, 81, 100, 83, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL LTEXT "Symbol grupowania &cyfr:", -1, 8, 100, 96, 10, WS_CHILD |WS_VISIBLE | WS_GROUP COMBOBOX IDC_NUMBERSDIGITGRSYM, 137, 97, 100, 83, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL LTEXT "&Grupowanie cyfr:", -1, 8, 117, 96, 10, WS_CHILD |WS_VISIBLE | WS_GROUP COMBOBOX IDC_NUMBERSDGROUPING, 137, 113, 100, 83, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL - LTEXT "Sy&mbol wartoci ujemnych:", -1, 8, 134, 96, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + LTEXT "Sy&mbol wartości ujemnych:", -1, 8, 134, 96, 10, WS_CHILD |WS_VISIBLE | WS_GROUP COMBOBOX IDC_NUMBERSNSIGNSYM, 137, 129, 100, 83, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL LTEXT "&Format liczb ujemnych:", -1, 8, 149, 100, 10, WS_CHILD |WS_VISIBLE | WS_GROUP COMBOBOX IDC_NUMBERSNNUMFORMAT, 137, 145, 100, 83, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL - LTEXT "Wywietlanie &zer wiodcych:", -1, 8, 166, 96, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + LTEXT "Wyświetlanie &zer wiodących:", -1, 8, 166, 96, 10, WS_CHILD |WS_VISIBLE | WS_GROUP COMBOBOX IDC_NUMBERSDISPLEADZER, 137, 161, 100, 83, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL LTEXT "Separator &listy:", -1, 8, 181, 96, 10, WS_CHILD |WS_VISIBLE | WS_GROUP COMBOBOX IDC_NUMBERSLSEP, 137, 177, 100, 83, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL @@ -98,20 +99,20 @@ STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION CAPTION "Waluta" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "Przykad", -1, 7, 7, 230, 33, WS_CHILD | WS_VISIBLE + GROUPBOX "Przykład", -1, 7, 7, 230, 33, WS_CHILD | WS_VISIBLE LTEXT "Dodatnie:", -1, 13, 21, 31, 10, WS_CHILD |WS_VISIBLE | WS_GROUP EDITTEXT IDC_CURRENCYPOSSAMPLE, 43, 19, 72, 14, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP | NOT WS_TABSTOP LTEXT "Ujemne:", -1, 120, 21, 31, 10, WS_CHILD |WS_VISIBLE | WS_GROUP EDITTEXT IDC_CURRENCYNEGSAMPLE, 154, 19, 72, 14, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP | NOT WS_TABSTOP LTEXT "&Symbol waluty:", -1, 10, 51, 111, 10, WS_CHILD |WS_VISIBLE | WS_GROUP COMBOBOX IDC_CURRENCYSYMBOL, 134, 49, 100, 83, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL - LTEXT "&Format iloci dodatnich:", -1, 10, 68, 111, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + LTEXT "&Format ilości dodatnich:", -1, 10, 68, 111, 10, WS_CHILD |WS_VISIBLE | WS_GROUP COMBOBOX IDC_CURRENCYPOSVALUE, 134, 66, 100, 83, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL - LTEXT "F&ormat iloci ujemnych:", -1, 10, 85, 111, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + LTEXT "F&ormat ilości ujemnych:", -1, 10, 85, 111, 10, WS_CHILD |WS_VISIBLE | WS_GROUP COMBOBOX IDC_CURRENCYNEGVALUE, 134, 83, 100, 83, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL - LTEXT "S&ymbol dziesitny:", -1, 10, 111, 111, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + LTEXT "S&ymbol dziesiętny:", -1, 10, 111, 111, 10, WS_CHILD |WS_VISIBLE | WS_GROUP COMBOBOX IDC_CURRENCYDECSEP, 134, 109, 100, 83, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL - LTEXT "Liczba cyfr &po symbolu dziesitnym:", -1, 10, 128, 121, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + LTEXT "Liczba cyfr &po symbolu dziesiętnym:", -1, 10, 128, 121, 10, WS_CHILD |WS_VISIBLE | WS_GROUP COMBOBOX IDC_CURRENCYDECNUM, 134, 126, 100, 83, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL LTEXT "Symbol grupowania &cyfr:", -1, 10, 156, 111, 10, WS_CHILD |WS_VISIBLE | WS_GROUP COMBOBOX IDC_CURRENCYGRPSEP, 134, 154, 100, 83, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL @@ -125,22 +126,22 @@ STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION CAPTION "Czas" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "Przykad", -1, 7, 7, 230, 33, WS_CHILD | WS_VISIBLE - LTEXT "Przykad czasu:", -1, 13, 21, 54, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + GROUPBOX "Przykład", -1, 7, 7, 230, 33, WS_CHILD | WS_VISIBLE + LTEXT "Przykład czasu:", -1, 13, 21, 54, 10, WS_CHILD |WS_VISIBLE | WS_GROUP EDITTEXT IDC_TIMESAMPLE, 68, 19, 84, 14, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP | NOT WS_TABSTOP LTEXT "&Format czasu:", -1, 13, 52, 130, 10, WS_CHILD |WS_VISIBLE | WS_GROUP COMBOBOX IDC_TIMEFORMAT, 149, 50, 84, 100, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_TABSTOP LTEXT "&Separator:", -1, 13, 70, 130, 10, WS_VISIBLE | WS_GROUP COMBOBOX IDC_TIMESEPARATOR, 149, 68, 84, 100, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP - LTEXT "S&ymbol AM ""Przed Poudniem"":", -1, 13, 88, 130, 10, WS_VISIBLE | WS_GROUP + LTEXT "S&ymbol AM ""Przed Południem"":", -1, 13, 88, 130, 10, WS_VISIBLE | WS_GROUP COMBOBOX IDC_TIMEAMSYMBOL, 149, 86, 84, 100, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP - LTEXT "Sy&mbol PM ""Po Poudniu"":", -1, 13, 106, 130, 10, WS_VISIBLE | WS_GROUP + LTEXT "Sy&mbol PM ""Po Południu"":", -1, 13, 106, 130, 10, WS_VISIBLE | WS_GROUP COMBOBOX IDC_TIMEPMSYMBOL, 149, 104, 84, 100, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP GROUPBOX "", -1, 7, 140, 230, 80, WS_VISIBLE LTEXT "Notacja formatu czasu\n\n\ h = godzina m = minuta s = sekunda t = am lub pm\n\n\ h = 12 godzin H = 24 godziny\n\ -hh, mm, ss = zero wiodce h, m, s = bez zera wiodcego", +hh, mm, ss = zero wiodące h, m, s = bez zera wiodącego", -1, 13, 150, 214, 50, WS_CHILD |WS_VISIBLE | WS_GROUP END @@ -151,30 +152,30 @@ CAPTION "Data" FONT 8, "MS Shell Dlg" BEGIN GROUPBOX "Kalendarz", -1, 7, 7, 230, 74 - LTEXT "Jeeli rok zostanie zapisany w postaci dwch cyfr, intepretuj go jako rok z przedziau:", -1, 13, 18, 215, 8 + LTEXT "Jeżeli rok zostanie zapisany w postaci dwóch cyfr, intepretuj go jako rok z przedziału:", -1, 13, 18, 215, 8 EDITTEXT IDC_FIRSTYEAR_EDIT, 13, 30, 36, 12, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_DISABLED LTEXT "do", -1, 55, 32, 17, 8 EDITTEXT IDC_SECONDYEAR_EDIT, 77, 30, 36, 12, ES_LEFT | ES_NUMBER | WS_GROUP CONTROL "",IDC_SCR_MAX_YEAR, "msctls_updown32", UDS_NOTHOUSANDS | UDS_WRAP | UDS_SETBUDDYINT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_CHILD | WS_VISIBLE, 113, 30, 10, 12 LTEXT "Rodzaj kalendarza:", -1, 13, 48, 64, 10 COMBOBOX IDC_CALTYPE_COMBO, 77, 46, 153, 100, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP | WS_DISABLED - LTEXT "Kalendarz muzumaski:", -1, 13, 62, 60, 16 + LTEXT "Kalendarz muzułmański:", -1, 13, 62, 60, 16 COMBOBOX IDC_HIJCHRON_COMBO, 77, 64, 153, 100, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP | WS_DISABLED - GROUPBOX "Format daty krtkiej", -1, 7, 83, 230, 81 - LTEXT "Przykad:", -1, 13, 95, 63, 10 + GROUPBOX "Format daty krótkiej", -1, 7, 83, 230, 81 + LTEXT "Przykład:", -1, 13, 95, 63, 10 EDITTEXT IDC_SHRTDATESAMPLE_EDIT, 77, 93, 153, 14, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP | NOT WS_TABSTOP - LTEXT "Przykad - z prawej do lewej:", -1, 13, 109, 60, 16 + LTEXT "Przykład - z prawej do lewej:", -1, 13, 109, 60, 16 EDITTEXT IDC_SHRTDATERTOL_EDIT, 77, 111, 153, 14, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP | NOT WS_TABSTOP | WS_DISABLED - LTEXT "Data krtka:", -1, 13, 131, 60, 10 + LTEXT "Data krótka:", -1, 13, 131, 60, 10 COMBOBOX IDC_SHRTDATEFMT_COMBO, 77, 129, 153, 100, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP | WS_VISIBLE LTEXT "Separator daty:", -1, 13, 148, 113, 10 COMBOBOX IDC_SHRTDATESEP_COMBO, 180, 146, 51, 100, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP | WS_VISIBLE - GROUPBOX "Format daty dugiej", -1, 7, 167, 230, 64 - LTEXT "Przykad:", -1, 13, 179, 61, 10 + GROUPBOX "Format daty długiej", -1, 7, 167, 230, 64 + LTEXT "Przykład:", -1, 13, 179, 61, 10 EDITTEXT IDC_LONGDATESAMPLE_EDIT, 77, 177, 153, 14, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP | NOT WS_TABSTOP - LTEXT "Przykad - z prawej do lewej:", -1, 13, 193, 61, 16 + LTEXT "Przykład - z prawej do lewej:", -1, 13, 193, 61, 16 EDITTEXT IDC_LONGDATERTOL_EDIT, 77, 195, 153, 14, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP | NOT WS_TABSTOP | WS_DISABLED - LTEXT "Data duga:", -1, 13, 215, 60, 10 + LTEXT "Data długa:", -1, 13, 215, 60, 10 COMBOBOX IDC_LONGDATEFMT_COMBO, 77, 213, 153, 100, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP | WS_VISIBLE END @@ -185,8 +186,8 @@ CAPTION "Sortowanie" FONT 8, "MS Shell Dlg" BEGIN GROUPBOX "Sortowanie", -1, 7, 7, 230, 74 - LTEXT "Metody sortowania okrelaj porzdek znakw, sw, plikw i katalogw.", -1, 14, 17, 220, 25 - LTEXT "Wybierz metod sortowania dla twojego jzyka:", -1, 14, 37, 220, 22 + LTEXT "Metody sortowania określają porządek znaków, słów, plików i katalogów.", -1, 14, 17, 220, 25 + LTEXT "Wybierz metodę sortowania dla twojego języka:", -1, 14, 37, 220, 22 COMBOBOX IDC_SORTLIST_COMBO, 14, 56, 217, 83, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL END @@ -194,7 +195,7 @@ END STRINGTABLE BEGIN IDS_CUSTOMIZE_TITLE "Dostosuj Ustawienia regionalne" - IDS_SPAIN "Hiszpaski (Hiszpania)" + IDS_SPAIN "Hiszpański (Hiszpania)" IDS_METRIC "Metryczne" IDS_IMPERIAL "Imperialne" END @@ -202,5 +203,5 @@ END STRINGTABLE BEGIN IDS_CPLNAME "Ustawienia regionalne" - IDS_CPLDESCRIPTION "Ustawienia jzykw oraz formaty liczb, walut, daty i czasu." + IDS_CPLDESCRIPTION "Ustawienia języków oraz formaty liczb, walut, daty i czasu." END diff --git a/dll/cpl/intl/lang/ro-RO.rc b/dll/cpl/intl/lang/ro-RO.rc index 621985509ac..28fe8ec0f54 100644 --- a/dll/cpl/intl/lang/ro-RO.rc +++ b/dll/cpl/intl/lang/ro-RO.rc @@ -1,7 +1,5 @@ LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL -#pragma code_page(65001) - IDD_GENERALPAGE DIALOGEX 0, 0, 246, 230 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION CAPTION "Opțiuni regionale" @@ -199,5 +197,3 @@ BEGIN IDS_CPLNAME "Opțiuni regionale" IDS_CPLDESCRIPTION "Setări limbi și formatare numere, valute, dată și timp." END - -#pragma code_page(default) diff --git a/dll/cpl/intl/lang/ru-RU.rc b/dll/cpl/intl/lang/ru-RU.rc index 6c3b3d637c8..ac4fe597814 100644 --- a/dll/cpl/intl/lang/ru-RU.rc +++ b/dll/cpl/intl/lang/ru-RU.rc @@ -2,196 +2,196 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT IDD_GENERALPAGE DIALOGEX 0, 0, 246, 230 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Региональные параметры" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ", -1, 5, 5, 234, 162 - LTEXT " , , .", -1, 14, 17, 220, 25 - LTEXT " """" , :", -1, 14, 37, 220, 22 + GROUPBOX "Языковые стандарты и форматы", -1, 5, 5, 234, 162 + LTEXT "Этот параметр влияет на способ отображения некоторыми программами чисел, денежных сумм, дат и времени.", -1, 14, 17, 220, 25 + LTEXT "Выберите элемент из списка или нажмите кнопку ""Настройка"" для того, чтобы задать форматы самостоятельно:", -1, 14, 37, 220, 22 COMBOBOX IDC_LANGUAGELIST, 14, 56, 160, 160, CBS_DROPDOWNLIST | CBS_SORT | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL - PUSHBUTTON "&...", IDC_SETUP_BUTTON, 178, 56, 52, 13 - LTEXT "", -1, 14, 73, 70, 10 - LTEXT ":", -1, 16, 86, 48, 10 - LTEXT " :", -1, 16, 101, 48, 10 - LTEXT ":", -1, 16, 116, 48, 10 - LTEXT " :", -1, 16, 131, 55, 10 - LTEXT " :", -1, 16, 146, 48, 10 + PUSHBUTTON "Настро&йка...", IDC_SETUP_BUTTON, 178, 56, 52, 13 + LTEXT "Образцы", -1, 14, 73, 70, 10 + LTEXT "Число:", -1, 16, 86, 48, 10 + LTEXT "Сумма денег:", -1, 16, 101, 48, 10 + LTEXT "Время:", -1, 16, 116, 48, 10 + LTEXT "Короткая дата:", -1, 16, 131, 55, 10 + LTEXT "Полная дата:", -1, 16, 146, 48, 10 EDITTEXT IDC_NUMSAMPLE_EDIT, 89, 86, 140, 12, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP | NOT WS_TABSTOP EDITTEXT IDC_MONEYSAMPLE_EDIT, 89, 101, 140, 12, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP | NOT WS_TABSTOP EDITTEXT IDC_TIMESAMPLE_EDIT, 89, 116, 140, 12, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP | NOT WS_TABSTOP EDITTEXT IDC_SHORTTIMESAMPLE_EDIT, 89, 131, 140, 12, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP | NOT WS_TABSTOP EDITTEXT IDC_FULLTIMESAMPLE_EDIT, 89, 146, 140, 12, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP | NOT WS_TABSTOP - GROUPBOX " ", -1, 5, 171, 234, 55 - LTEXT "& , , , :", -1, 14, 180, 217, 24 + GROUPBOX "Географического расположение", -1, 5, 171, 234, 55 + LTEXT "&Укажите ваше расположение для того, чтобы службы могли снабжать вас местной информацией, например, новостями и сводками погоды:", -1, 14, 180, 217, 24 COMBOBOX IDC_LOCATION_COMBO, 14, 207, 217, 160, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP | CBS_SORT END IDD_LANGUAGESPAGE DIALOGEX 0, 0, 246, 230 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Языки" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ", -1, 5, 5, 234, 52 - LTEXT " , """"", -1, 12, 15, 220, 18 - PUSHBUTTON "&...", IDC_DETAIL_BUTTON, 177, 34, 54, 14 - GROUPBOX " ", -1, 5, 61, 234, 90 - LTEXT " . , .", -1, 12, 72, 220, 32 - CHECKBOX "& ", IDC_INST_FILES_FOR_RTOL_LANG, 12, 108, 215, 18, BS_MULTILINE - CHECKBOX "& ", IDC_INST_FILES_FOR_ASIAN, 12, 129, 215, 15, BS_MULTILINE + GROUPBOX "Языки и службы текстового ввода", -1, 5, 5, 234, 52 + LTEXT "Чтобы просмотреть или изменить язык или метод ввода текста, нажмите кнопку ""Подробнее""", -1, 12, 15, 220, 18 + PUSHBUTTON "&Подробнее...", IDC_DETAIL_BUTTON, 177, 34, 54, 14 + GROUPBOX "Дополнительная языковая поддержка", -1, 5, 61, 234, 90 + LTEXT "Поддержка большинства языков устанавливается по умолчанию. Чтобы установить дополнительную поддержку языков с особыми способами письма, установите соответствующие флажки.", -1, 12, 72, 220, 32 + CHECKBOX "&Установить поддержку языков с письмом справа налево и сложным письмом", IDC_INST_FILES_FOR_RTOL_LANG, 12, 108, 215, 18, BS_MULTILINE + CHECKBOX "Ус&тановить поддержку языков с письмом иероглифами", IDC_INST_FILES_FOR_ASIAN, 12, 129, 215, 15, BS_MULTILINE END IDD_ADVANCEDPAGE DIALOGEX 0, 0, 246, 230 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Дополнительно" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " , ", -1, 5, 5, 234, 90 + GROUPBOX "Язык программ, не поддерживающих Юникод", -1, 5, 5, 234, 90 COMBOBOX IDC_LANGUAGE_COMBO, 14, 75, 217, 160, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP | CBS_SORT - LTEXT " , , . - , .", -1, 14, 18, 223, 33 - LTEXT " , , :", -1, 14, 55, 223, 18 - GROUPBOX " ", -1, 5, 101, 234, 88 + LTEXT "Этот параметр позволяет программам, не поддерживающим Юникод, отображать меню и диалоги на своем языке. Он не влияет на Юникод-совместимые программы, но применяется для всех пользователей этого компьютера.", -1, 14, 18, 223, 33 + LTEXT "Выберите язык, соответствующий языку используемых программ, которые не поддерживают Юникод:", -1, 14, 55, 223, 18 + GROUPBOX "Кодовые страницы таблиц преобразования", -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 " ", -1, 5, 193, 234, 30 - CHECKBOX " ", IDC_APPLY_CUR_USER_DEF_PROFILE, 12, 200, 220, 22, BS_MULTILINE + GROUPBOX "Параметры для стандартной учетной записи", -1, 5, 193, 234, 30 + CHECKBOX "Применить эти параметры для текущей учетной записи и для стандартного профиля", IDC_APPLY_CUR_USER_DEF_PROFILE, 12, 200, 220, 22, BS_MULTILINE END IDD_NUMBERSPAGE DIALOGEX 0, 0, 246, 234 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Числа" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "", -1, 7, 7, 230, 53, WS_CHILD | WS_VISIBLE - LTEXT ".:", -1, 13, 21, 31, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + GROUPBOX "Образцы", -1, 7, 7, 230, 53, WS_CHILD | WS_VISIBLE + LTEXT "Полож.:", -1, 13, 21, 31, 10, WS_CHILD |WS_VISIBLE | WS_GROUP EDITTEXT IDC_NUMBERSPOSSAMPLE, 43, 19, 72, 14, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP | NOT WS_TABSTOP - LTEXT ".:", -1, 123, 21, 31, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + LTEXT "Отриц.:", -1, 123, 21, 31, 10, WS_CHILD |WS_VISIBLE | WS_GROUP EDITTEXT IDC_NUMBERSNEGSAMPLE, 154, 19, 72, 14, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP | NOT WS_TABSTOP - LTEXT "&. :", -1, 8, 67, 125, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + LTEXT "&Раздел. целой и дробной части:", -1, 8, 67, 125, 10, WS_CHILD |WS_VISIBLE | WS_GROUP COMBOBOX IDC_NUMBERDSYMBOL, 137, 65, 100, 83, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL - LTEXT "& :", -1, 8, 83, 125, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + LTEXT "&Количество дробных знаков:", -1, 8, 83, 125, 10, WS_CHILD |WS_VISIBLE | WS_GROUP COMBOBOX IDC_NUMBERSNDIGDEC, 137, 81, 100, 83, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL - LTEXT " & :", -1, 8, 100, 125, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + LTEXT "Разделитель &групп разрядов:", -1, 8, 100, 125, 10, WS_CHILD |WS_VISIBLE | WS_GROUP COMBOBOX IDC_NUMBERSDIGITGRSYM, 137, 97, 100, 83, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL - LTEXT " & :", -1, 8, 117, 96, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + LTEXT "Количество &цифр в группе:", -1, 8, 117, 96, 10, WS_CHILD |WS_VISIBLE | WS_GROUP COMBOBOX IDC_NUMBERSDGROUPING, 137, 113, 100, 83, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL - LTEXT "& :", -1, 8, 134, 125, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + LTEXT "&Признак отрицательного числа:", -1, 8, 134, 125, 10, WS_CHILD |WS_VISIBLE | WS_GROUP COMBOBOX IDC_NUMBERSNSIGNSYM, 137, 129, 100, 83, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL - LTEXT "& :", -1, 8, 149, 125, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + LTEXT "&Формат отрицательного числа:", -1, 8, 149, 125, 10, WS_CHILD |WS_VISIBLE | WS_GROUP COMBOBOX IDC_NUMBERSNNUMFORMAT, 137, 145, 100, 83, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL - LTEXT "& :", -1, 8, 166, 125, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + LTEXT "&Вывод нулей в начале числа:", -1, 8, 166, 125, 10, WS_CHILD |WS_VISIBLE | WS_GROUP COMBOBOX IDC_NUMBERSDISPLEADZER, 137, 161, 100, 83, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL - LTEXT " & :", -1, 8, 181, 125, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + LTEXT "Разделитель &элементов списка:", -1, 8, 181, 125, 10, WS_CHILD |WS_VISIBLE | WS_GROUP COMBOBOX IDC_NUMBERSLSEP, 137, 177, 100, 83, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL - LTEXT "& :", -1, 8, 197, 96, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + LTEXT "&Система едениц:", -1, 8, 197, 96, 10, WS_CHILD |WS_VISIBLE | WS_GROUP COMBOBOX IDC_NUMBERSMEASSYS, 137, 193, 100, 83, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL END IDD_CURRENCYPAGE DIALOGEX 0, 0, 246, 234 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Денежная единица" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "", -1, 7, 7, 230, 33, WS_CHILD | WS_VISIBLE - LTEXT ".:", -1, 13, 21, 31, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + GROUPBOX "Образцы", -1, 7, 7, 230, 33, WS_CHILD | WS_VISIBLE + LTEXT "Полож.:", -1, 13, 21, 31, 10, WS_CHILD |WS_VISIBLE | WS_GROUP EDITTEXT IDC_CURRENCYPOSSAMPLE, 43, 19, 72, 14, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP | NOT WS_TABSTOP - LTEXT ".:", -1, 123, 21, 31, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + LTEXT "Отриц.:", -1, 123, 21, 31, 10, WS_CHILD |WS_VISIBLE | WS_GROUP EDITTEXT IDC_CURRENCYNEGSAMPLE, 154, 19, 72, 14, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP | NOT WS_TABSTOP - LTEXT "& :", -1, 8, 51, 125, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + LTEXT "О&бозначение денежной еденицы:", -1, 8, 51, 125, 10, WS_CHILD |WS_VISIBLE | WS_GROUP COMBOBOX IDC_CURRENCYSYMBOL, 134, 49, 100, 83, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL - LTEXT " &. :", -1, 8, 68, 125, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + LTEXT "Формат &полож. денежных сумм:", -1, 8, 68, 125, 10, WS_CHILD |WS_VISIBLE | WS_GROUP COMBOBOX IDC_CURRENCYPOSVALUE, 134, 66, 100, 83, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL - LTEXT " &. :", -1, 8, 85, 125, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + LTEXT "Формат &отриц. денежных сумм:", -1, 8, 85, 125, 10, WS_CHILD |WS_VISIBLE | WS_GROUP COMBOBOX IDC_CURRENCYNEGVALUE, 134, 83, 100, 83, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL - LTEXT "&. :", -1, 8, 111, 125, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + LTEXT "&Раздел. целой и дробной части:", -1, 8, 111, 125, 10, WS_CHILD |WS_VISIBLE | WS_GROUP COMBOBOX IDC_CURRENCYDECSEP, 134, 109, 100, 83, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL - LTEXT "& :", -1, 8, 128, 110, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + LTEXT "&Количество дробных знаков:", -1, 8, 128, 110, 10, WS_CHILD |WS_VISIBLE | WS_GROUP COMBOBOX IDC_CURRENCYDECNUM, 134, 126, 100, 83, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL - LTEXT " & :", -1, 8, 156, 110, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + LTEXT "Разделитель &групп разрядов:", -1, 8, 156, 110, 10, WS_CHILD |WS_VISIBLE | WS_GROUP COMBOBOX IDC_CURRENCYGRPSEP, 134, 154, 100, 83, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL - LTEXT " & :", -1, 8, 173, 96, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + LTEXT "Количество &цифр в группе:", -1, 8, 173, 96, 10, WS_CHILD |WS_VISIBLE | WS_GROUP COMBOBOX IDC_CURRENCYGRPNUM, 134, 171, 100, 83, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL END IDD_TIMEPAGE DIALOGEX 0, 0, 246, 234 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Время" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "", -1, 7, 7, 230, 33, WS_CHILD | WS_VISIBLE - LTEXT ":", -1, 13, 21, 54, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + GROUPBOX "Образцы", -1, 7, 7, 230, 33, WS_CHILD | WS_VISIBLE + LTEXT "Образец:", -1, 13, 21, 54, 10, WS_CHILD |WS_VISIBLE | WS_GROUP EDITTEXT IDC_TIMESAMPLE, 68, 19, 84, 14, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP | NOT WS_TABSTOP - LTEXT "& :", -1, 13, 52, 135, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + LTEXT "&Формат времени:", -1, 13, 52, 135, 10, WS_CHILD |WS_VISIBLE | WS_GROUP COMBOBOX IDC_TIMEFORMAT, 152, 50, 84, 100, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_TABSTOP - LTEXT "&. :", -1, 13, 70, 135, 10, WS_VISIBLE | WS_GROUP + LTEXT "&Раздел. компонентов времени:", -1, 13, 70, 135, 10, WS_VISIBLE | WS_GROUP COMBOBOX IDC_TIMESEPARATOR, 152, 68, 84, 100, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP - LTEXT "&. (AM):", -1, 13, 88, 135, 10, WS_VISIBLE | WS_GROUP + LTEXT "&Обозн. времени до полудня (AM):", -1, 13, 88, 135, 10, WS_VISIBLE | WS_GROUP COMBOBOX IDC_TIMEAMSYMBOL, 152, 86, 84, 100, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP - LTEXT "&. (PM):", -1, 13, 106, 135, 10, WS_VISIBLE | WS_GROUP + LTEXT "О&бозн. времени после полудня (PM):", -1, 13, 106, 135, 10, WS_VISIBLE | WS_GROUP COMBOBOX IDC_TIMEPMSYMBOL, 152, 104, 84, 100, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP GROUPBOX "", -1, 7, 140, 230, 80, WS_VISIBLE - LTEXT " \n\n\ -h = m = s = t = am pm\n\n\ -h = 12- \n\ -H = 24- \n\ -hh, mm, ss = \n\ -h, m, s = ", + LTEXT "Обозначение формата времени\n\n\ +h = час m = минута s = секунда t = am или pm\n\n\ +h = 12-часовой формат суток\n\ +H = 24-часовой формат суток\n\ +hh, mm, ss = с выводом нулей в начале\n\ +h, m, s = без вывода нулей", -1, 13, 150, 214, 50, WS_CHILD |WS_VISIBLE | WS_GROUP END IDD_DATEPAGE DIALOGEX 0, 0, 246, 234 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Дата" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "", -1, 7, 7, 230, 74 - LTEXT " , :", -1, 13, 18, 221, 8 + GROUPBOX "Календарь", -1, 7, 7, 230, 74 + LTEXT "Если год введен двумя цифрами, отображать как год между:", -1, 13, 18, 221, 8 EDITTEXT IDC_FIRSTYEAR_EDIT, 13, 30, 36, 12, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_DISABLED - LTEXT "", -1, 55, 32, 17, 8 + LTEXT "и", -1, 55, 32, 17, 8 EDITTEXT IDC_SECONDYEAR_EDIT, 77, 30, 36, 12, ES_LEFT | ES_NUMBER | WS_GROUP CONTROL "",IDC_SCR_MAX_YEAR, "msctls_updown32", UDS_NOTHOUSANDS | UDS_WRAP | UDS_SETBUDDYINT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_CHILD | WS_VISIBLE, 113, 30, 10, 12 - LTEXT " :", -1, 13, 48, 56, 10 + LTEXT "Тип календаря:", -1, 13, 48, 56, 10 COMBOBOX IDC_CALTYPE_COMBO, 77, 46, 153, 100, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP | WS_DISABLED - LTEXT " :", -1, 13, 61, 60, 16 + LTEXT "Мусульманский календарь:", -1, 13, 61, 60, 16 COMBOBOX IDC_HIJCHRON_COMBO, 77, 64, 153, 100, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP | WS_DISABLED - GROUPBOX " ", -1, 7, 83, 230, 81 - LTEXT ":", -1, 13, 95, 63, 10 + GROUPBOX "Краткий формат даты", -1, 7, 83, 230, 81 + LTEXT "Образец:", -1, 13, 95, 63, 10 EDITTEXT IDC_SHRTDATESAMPLE_EDIT, 77, 93, 153, 14, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP | NOT WS_TABSTOP - LTEXT " - :", -1, 13, 111, 60, 16 + LTEXT "Образец - справа на лево:", -1, 13, 111, 60, 16 EDITTEXT IDC_SHRTDATERTOL_EDIT, 77, 111, 153, 14, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP | NOT WS_TABSTOP | WS_DISABLED - LTEXT " :", -1, 13, 131, 60, 10 + LTEXT "Краткий формат:", -1, 13, 131, 60, 10 COMBOBOX IDC_SHRTDATEFMT_COMBO, 77, 129, 153, 100, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP | WS_VISIBLE - LTEXT "& :", -1, 13, 148, 125, 10 + LTEXT "&Разделитель компонентов даты:", -1, 13, 148, 125, 10 COMBOBOX IDC_SHRTDATESEP_COMBO, 180, 146, 51, 100, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP | WS_VISIBLE - GROUPBOX " ", -1, 7, 167, 230, 64 - LTEXT ":", -1, 13, 179, 61, 10 + GROUPBOX "Полный формат даты", -1, 7, 167, 230, 64 + LTEXT "Образец:", -1, 13, 179, 61, 10 EDITTEXT IDC_LONGDATESAMPLE_EDIT, 77, 177, 153, 14, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP | NOT WS_TABSTOP - LTEXT " - :", -1, 13, 195, 61, 16 + LTEXT "Образец - справа на лево:", -1, 13, 195, 61, 16 EDITTEXT IDC_LONGDATERTOL_EDIT, 77, 195, 153, 14, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP | NOT WS_TABSTOP | WS_DISABLED - LTEXT "& :", -1, 13, 215, 60, 10 + LTEXT "&Полный формат:", -1, 13, 215, 60, 10 COMBOBOX IDC_LONGDATEFMT_COMBO, 77, 213, 153, 100, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP | WS_VISIBLE END IDD_SORTPAGE DIALOGEX 0, 0, 246, 234 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Сортировка" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "", -1, 7, 7, 230, 74 - LTEXT " , , .", -1, 14, 17, 220, 25 - LTEXT "& :", -1, 14, 37, 220, 22 + GROUPBOX "Сортировка", -1, 7, 7, 230, 74 + LTEXT "Методы сортировки влияют на порядок сортировки символов, слов, имен файлов и папок.", -1, 14, 17, 220, 25 + LTEXT "&Выбрать метод сортировки для этого языка:", -1, 14, 37, 220, 22 COMBOBOX IDC_SORTLIST_COMBO, 14, 56, 217, 83, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL END STRINGTABLE BEGIN - IDS_CUSTOMIZE_TITLE " " - IDS_SPAIN " ()" + IDS_CUSTOMIZE_TITLE "Настройка региональных параметров" + IDS_SPAIN "Испанский (Испания)" IDS_METRIC "Metric" IDS_IMPERIAL "Imperial" END STRINGTABLE BEGIN - IDS_CPLNAME " " - IDS_CPLDESCRIPTION " , , , ." + IDS_CPLNAME "Язык и региональные стандарты" + IDS_CPLDESCRIPTION "Выбор языка, формата чисел, денежных единиц, времени и даты." END diff --git a/dll/cpl/intl/lang/uk-UA.rc b/dll/cpl/intl/lang/uk-UA.rc index 8b9aa001eac..17af13e5cb6 100644 --- a/dll/cpl/intl/lang/uk-UA.rc +++ b/dll/cpl/intl/lang/uk-UA.rc @@ -10,199 +10,199 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT IDD_GENERALPAGE DIALOGEX 0, 0, 246, 230 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Регіональні параметри" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ", -1, 5, 5, 234, 162 - LTEXT " , , .", -1, 14, 17, 220, 25 - LTEXT "& """", :", -1, 14, 37, 220, 22 + GROUPBOX "Мовні стандарти й формати", -1, 5, 5, 234, 162 + LTEXT "Цей параметр впливає на відображення чисел, грошових сум, дати й часу в деяких програмах.", -1, 14, 17, 220, 25 + LTEXT "&Виберіть зі списку найбільш прийнятний елемент або натисніть кнопку ""Налаштування"", щоб указати формати самостійно:", -1, 14, 37, 220, 22 COMBOBOX IDC_LANGUAGELIST, 14, 56, 160, 160, CBS_DROPDOWNLIST | CBS_SORT | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL - PUSHBUTTON "&...", IDC_SETUP_BUTTON, 175, 56, 60, 13 - LTEXT "", -1, 14, 73, 70, 10 - LTEXT ":", -1, 16, 86, 48, 10 - LTEXT " :", -1, 16, 101, 48, 10 - LTEXT ":", -1, 16, 116, 48, 10 - LTEXT " :", -1, 16, 131, 48, 10 - LTEXT " :", -1, 16, 146, 48, 10 + PUSHBUTTON "Налашту&вання...", IDC_SETUP_BUTTON, 175, 56, 60, 13 + LTEXT "Зразки", -1, 14, 73, 70, 10 + LTEXT "Число:", -1, 16, 86, 48, 10 + LTEXT "Сума грошей:", -1, 16, 101, 48, 10 + LTEXT "Час:", -1, 16, 116, 48, 10 + LTEXT "Коротка дата:", -1, 16, 131, 48, 10 + LTEXT "Повна дата:", -1, 16, 146, 48, 10 EDITTEXT IDC_NUMSAMPLE_EDIT, 89, 86, 140, 12, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP | NOT WS_TABSTOP EDITTEXT IDC_MONEYSAMPLE_EDIT, 89, 101, 140, 12, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP | NOT WS_TABSTOP EDITTEXT IDC_TIMESAMPLE_EDIT, 89, 116, 140, 12, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP | NOT WS_TABSTOP EDITTEXT IDC_SHORTTIMESAMPLE_EDIT, 89, 131, 140, 12, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP | NOT WS_TABSTOP EDITTEXT IDC_FULLTIMESAMPLE_EDIT, 89, 146, 140, 12, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP | NOT WS_TABSTOP - GROUPBOX " ", -1, 5, 171, 234, 55 - LTEXT " , , , ", -1, 14, 180, 215, 24 + GROUPBOX "Географічне розташування", -1, 5, 171, 234, 55 + LTEXT "Укажіть ваше поточне розташування, щоб служби могли надавати вам місцеву інформацію, наприклад, новини та прогноз погоди", -1, 14, 180, 215, 24 COMBOBOX IDC_LOCATION_COMBO, 14, 207, 217, 160, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP | CBS_SORT END IDD_LANGUAGESPAGE DIALOGEX 0, 0, 246, 230 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Мови" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ", -1, 5, 5, 234, 52 - LTEXT " , ""...""", -1, 12, 15, 220, 18 - PUSHBUTTON "&...", IDC_DETAIL_BUTTON, 177, 34, 54, 14 - GROUPBOX " ", -1, 5, 62, 234, 82 - LTEXT " . , .", -1, 12, 72, 220, 18 - CHECKBOX "& ", IDC_INST_FILES_FOR_RTOL_LANG, 12, 92, 215, 22, BS_MULTILINE - CHECKBOX "& - ", IDC_INST_FILES_FOR_ASIAN, 12, 114, 180, 22, BS_MULTILINE + GROUPBOX "Текстові служби та мови вводу", -1, 5, 5, 234, 52 + LTEXT "Щоб переглянути або змінити мову або засіб вводу тексту, натисніть кнопку ""Подробиці...""", -1, 12, 15, 220, 18 + PUSHBUTTON "&Подробиці...", IDC_DETAIL_BUTTON, 177, 34, 54, 14 + GROUPBOX "Додаткова мовна підтримка", -1, 5, 62, 234, 82 + LTEXT "Більшість мов установлюється за замовчуванням. Щоб установити додаткові мови, установіть відповідні прапорці.", -1, 12, 72, 220, 18 + CHECKBOX "&Установити підтримку для мов із письмом справа наліво та для мов зі складними знаками", IDC_INST_FILES_FOR_RTOL_LANG, 12, 92, 215, 22, BS_MULTILINE + CHECKBOX "Ус&тановити підтримку для східно-азіатських мов", IDC_INST_FILES_FOR_ASIAN, 12, 114, 180, 22, BS_MULTILINE END IDD_ADVANCEDPAGE DIALOGEX 0, 0, 246, 230 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Додатково" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " , ", -1, 5, 5, 234, 90 + GROUPBOX "Мова програм, які не підтримують Юнікод", -1, 5, 5, 234, 90 COMBOBOX IDC_LANGUAGE_COMBO, 14, 75, 217, 160, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP | CBS_SORT - LTEXT " , , . ³ , '.", -1, 14, 18, 223, 33 - LTEXT " , .", -1, 14, 55, 223, 18 - GROUPBOX " ", -1, 5, 101, 234, 88 + LTEXT "Цей системний параметр дає змогу програмам, які не підтримують Юнікод, показувати меню та діалоги рідною мовою. Він не впливає на програми з підтримкою Юнікоду, але застосовується до всіх користувачів цього комп'ютера.", -1, 14, 18, 223, 33 + LTEXT "Виберіть мову, яка відповідає мовній версії бажаних програм без підтримки Юнікоду.", -1, 14, 55, 223, 18 + GROUPBOX "Таблиці перетворення кодових сторінок", -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 " ", -1, 5, 193, 234, 30 - CHECKBOX " ", IDC_APPLY_CUR_USER_DEF_PROFILE, 12, 200, 220, 22, BS_MULTILINE + GROUPBOX "Параметри стандартного облікового запису", -1, 5, 193, 234, 30 + CHECKBOX "Застосувати всі параметри до поточного облікового запису та до стандартного профілю користувача", IDC_APPLY_CUR_USER_DEF_PROFILE, 12, 200, 220, 22, BS_MULTILINE END IDD_NUMBERSPAGE DIALOGEX 0, 0, 246, 234 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Числа" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "", -1, 7, 7, 230, 53, WS_CHILD | WS_VISIBLE - LTEXT ".:", -1, 13, 21, 31, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + GROUPBOX "Зразки", -1, 7, 7, 230, 53, WS_CHILD | WS_VISIBLE + LTEXT "Додатн.:", -1, 13, 21, 31, 10, WS_CHILD |WS_VISIBLE | WS_GROUP EDITTEXT IDC_NUMBERSPOSSAMPLE, 48, 19, 67, 14, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP | NOT WS_TABSTOP - LTEXT "³'.:", -1, 120, 21, 31, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + LTEXT "Від'ємн.:", -1, 120, 21, 31, 10, WS_CHILD |WS_VISIBLE | WS_GROUP EDITTEXT IDC_NUMBERSNEGSAMPLE, 154, 19, 72, 14, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP | NOT WS_TABSTOP - LTEXT " &:", -1, 8, 67, 96, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + LTEXT "Десятковий &розділювач:", -1, 8, 67, 96, 10, WS_CHILD |WS_VISIBLE | WS_GROUP COMBOBOX IDC_NUMBERDSYMBOL, 137, 65, 100, 83, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL - LTEXT "&ʳ :", -1, 8, 83, 96, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + LTEXT "&Кількість дробових знаків:", -1, 8, 83, 96, 10, WS_CHILD |WS_VISIBLE | WS_GROUP COMBOBOX IDC_NUMBERSNDIGDEC, 137, 81, 100, 83, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL - LTEXT " & :", -1, 8, 100, 96, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + LTEXT "Розділювач &груп розрядів:", -1, 8, 100, 96, 10, WS_CHILD |WS_VISIBLE | WS_GROUP COMBOBOX IDC_NUMBERSDIGITGRSYM, 137, 97, 100, 83, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL - LTEXT "ʳ& :", -1, 8, 117, 96, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + LTEXT "Кіл&ькість цифр у групі:", -1, 8, 117, 96, 10, WS_CHILD |WS_VISIBLE | WS_GROUP COMBOBOX IDC_NUMBERSDGROUPING, 137, 113, 100, 83, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL - LTEXT "& ' :", -1, 8, 134, 96, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + LTEXT "Оз&нака від'ємного числа:", -1, 8, 134, 96, 10, WS_CHILD |WS_VISIBLE | WS_GROUP COMBOBOX IDC_NUMBERSNSIGNSYM, 137, 129, 100, 83, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL - LTEXT "& ' :", -1, 8, 149, 100, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + LTEXT "&Формат від'ємних чисел:", -1, 8, 149, 100, 10, WS_CHILD |WS_VISIBLE | WS_GROUP COMBOBOX IDC_NUMBERSNNUMFORMAT, 137, 145, 100, 83, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL - LTEXT "&³. :", -1, 8, 166, 127, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + LTEXT "&Відображ. нулів на початку числа:", -1, 8, 166, 127, 10, WS_CHILD |WS_VISIBLE | WS_GROUP COMBOBOX IDC_NUMBERSDISPLEADZER, 137, 161, 100, 83, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL - LTEXT " & :", -1, 8, 181, 124, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + LTEXT "Розділювач &елементів списку:", -1, 8, 181, 124, 10, WS_CHILD |WS_VISIBLE | WS_GROUP COMBOBOX IDC_NUMBERSLSEP, 137, 177, 100, 83, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL - LTEXT "& :", -1, 8, 197, 96, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + LTEXT "&Система одиниць:", -1, 8, 197, 96, 10, WS_CHILD |WS_VISIBLE | WS_GROUP COMBOBOX IDC_NUMBERSMEASSYS, 137, 193, 100, 83, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL END IDD_CURRENCYPAGE DIALOGEX 0, 0, 246, 234 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Грошова одиниця" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "", -1, 7, 7, 230, 33, WS_CHILD | WS_VISIBLE - LTEXT ".:", -1, 13, 21, 31, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + GROUPBOX "Зразки", -1, 7, 7, 230, 33, WS_CHILD | WS_VISIBLE + LTEXT "Додатн.:", -1, 13, 21, 31, 10, WS_CHILD |WS_VISIBLE | WS_GROUP EDITTEXT IDC_CURRENCYPOSSAMPLE, 46, 19, 72, 14, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP | NOT WS_TABSTOP - LTEXT "³'.:", -1, 120, 21, 31, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + LTEXT "Від'ємн.:", -1, 120, 21, 31, 10, WS_CHILD |WS_VISIBLE | WS_GROUP EDITTEXT IDC_CURRENCYNEGSAMPLE, 154, 19, 72, 14, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP | NOT WS_TABSTOP - LTEXT "& :", -1, 10, 51, 111, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + LTEXT "&Позначення грошової одиниці:", -1, 10, 51, 111, 10, WS_CHILD |WS_VISIBLE | WS_GROUP COMBOBOX IDC_CURRENCYSYMBOL, 134, 49, 100, 83, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL - LTEXT "& :", -1, 10, 68, 111, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + LTEXT "&Формат додатних грошових сум:", -1, 10, 68, 111, 10, WS_CHILD |WS_VISIBLE | WS_GROUP COMBOBOX IDC_CURRENCYPOSVALUE, 134, 66, 100, 83, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL - LTEXT "& ' :", -1, 10, 85, 111, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + LTEXT "Фор&мат від'ємних грошових сум:", -1, 10, 85, 111, 10, WS_CHILD |WS_VISIBLE | WS_GROUP COMBOBOX IDC_CURRENCYNEGVALUE, 134, 83, 100, 83, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL - LTEXT " &:", -1, 10, 111, 111, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + LTEXT "Десятковий &розділювач:", -1, 10, 111, 111, 10, WS_CHILD |WS_VISIBLE | WS_GROUP COMBOBOX IDC_CURRENCYDECSEP, 134, 109, 100, 83, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL - LTEXT "&ʳ :", -1, 10, 128, 111, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + LTEXT "&Кількість дробових знаків:", -1, 10, 128, 111, 10, WS_CHILD |WS_VISIBLE | WS_GROUP COMBOBOX IDC_CURRENCYDECNUM, 134, 126, 100, 83, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL - LTEXT " & :", -1, 10, 156, 111, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + LTEXT "Розділювач &груп розрядів:", -1, 10, 156, 111, 10, WS_CHILD |WS_VISIBLE | WS_GROUP COMBOBOX IDC_CURRENCYGRPSEP, 134, 154, 100, 83, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL - LTEXT "ʳ & :", -1, 10, 173, 111, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + LTEXT "Кількість &цифр у групі:", -1, 10, 173, 111, 10, WS_CHILD |WS_VISIBLE | WS_GROUP COMBOBOX IDC_CURRENCYGRPNUM, 134, 171, 100, 83, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL END IDD_TIMEPAGE DIALOGEX 0, 0, 246, 234 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Час" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "", -1, 7, 7, 230, 33, WS_CHILD | WS_VISIBLE - LTEXT " :", -1, 13, 21, 54, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + GROUPBOX "Зразки", -1, 7, 7, 230, 33, WS_CHILD | WS_VISIBLE + LTEXT "Зразок часу:", -1, 13, 21, 54, 10, WS_CHILD |WS_VISIBLE | WS_GROUP EDITTEXT IDC_TIMESAMPLE, 68, 19, 84, 14, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP | NOT WS_TABSTOP - LTEXT "& :", -1, 13, 52, 54, 10, WS_CHILD |WS_VISIBLE | WS_GROUP + LTEXT "&Формат часу:", -1, 13, 52, 54, 10, WS_CHILD |WS_VISIBLE | WS_GROUP COMBOBOX IDC_TIMEFORMAT, 149, 50, 84, 100, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_TABSTOP - LTEXT "& :", -1, 13, 70, 130, 10, WS_VISIBLE | WS_GROUP + LTEXT "&Розділювач компонентів часу:", -1, 13, 70, 130, 10, WS_VISIBLE | WS_GROUP COMBOBOX IDC_TIMESEPARATOR, 149, 68, 84, 100, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP - LTEXT "& (AM):", -1, 13, 88, 130, 10, WS_VISIBLE | WS_GROUP + LTEXT "По&значення часу до полудня (AM):", -1, 13, 88, 130, 10, WS_VISIBLE | WS_GROUP COMBOBOX IDC_TIMEAMSYMBOL, 149, 86, 84, 100, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP - LTEXT "& (PM):", -1, 13, 106, 130, 10, WS_VISIBLE | WS_GROUP + LTEXT "&Позначення часу після полудня (PM):", -1, 13, 106, 130, 10, WS_VISIBLE | WS_GROUP COMBOBOX IDC_TIMEPMSYMBOL, 149, 104, 84, 100, CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP GROUPBOX "", -1, 7, 140, 230, 80, WS_VISIBLE - LTEXT " \n\n\ -h = m = s = t = \n\n\ -h = 12- H = 24- \n\ -hh, mm, ss = h, m, s = ", + LTEXT "Позначення формату часу\n\n\ +h = година m = хвилина s = секунда t = АМ або РМ\n\n\ +h = 12-годинний формат доби H = 24-годинний формат доби\n\ +hh, mm, ss = з виводом нулів на початку h, m, s = без виводу нулів", -1, 13, 150, 214, 55, WS_CHILD |WS_VISIBLE | WS_GROUP END IDD_DATEPAGE DIALOGEX 0, 0, 246, 234 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Дата" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "", -1, 7, 7, 230, 74 - LTEXT " , :", -1, 9, 18, 226, 8 + GROUPBOX "Календар", -1, 7, 7, 230, 74 + LTEXT "Якщо рік введено двома цифрами, інтерпретувати його як рік між:", -1, 9, 18, 226, 8 EDITTEXT IDC_FIRSTYEAR_EDIT, 13, 30, 36, 12, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_DISABLED - LTEXT "", -1, 55, 32, 17, 8 + LTEXT "і", -1, 55, 32, 17, 8 EDITTEXT IDC_SECONDYEAR_EDIT, 77, 30, 36, 12, ES_LEFT | ES_NUMBER | WS_GROUP CONTROL "",IDC_SCR_MAX_YEAR, "msctls_updown32", UDS_NOTHOUSANDS | UDS_WRAP | UDS_SETBUDDYINT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_CHILD | WS_VISIBLE, 113, 30, 10, 12 - LTEXT " :", -1, 13, 48, 56, 10 + LTEXT "Тип календаря:", -1, 13, 48, 56, 10 COMBOBOX IDC_CALTYPE_COMBO, 77, 46, 153, 100, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP | WS_DISABLED - LTEXT "˳ :", -1, 13, 62, 60, 16 + LTEXT "Літочислення за хиджрою:", -1, 13, 62, 60, 16 COMBOBOX IDC_HIJCHRON_COMBO, 77, 64, 153, 100, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP | WS_DISABLED - GROUPBOX " ", -1, 7, 83, 230, 81 - LTEXT ":", -1, 13, 95, 63, 10 + GROUPBOX "Короткий формат дати", -1, 7, 83, 230, 81 + LTEXT "Зразок:", -1, 13, 95, 63, 10 EDITTEXT IDC_SHRTDATESAMPLE_EDIT, 77, 93, 153, 14, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP | NOT WS_TABSTOP - LTEXT " - :", -1, 13, 109, 60, 16 + LTEXT "Зразок - читання справа наліво:", -1, 13, 109, 60, 16 EDITTEXT IDC_SHRTDATERTOL_EDIT, 77, 111, 153, 14, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP | NOT WS_TABSTOP | WS_DISABLED - LTEXT " :", -1, 13, 128, 62, 16 + LTEXT "Короткий формат:", -1, 13, 128, 62, 16 COMBOBOX IDC_SHRTDATEFMT_COMBO, 77, 129, 153, 100, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP | WS_VISIBLE - LTEXT " :", -1, 13, 148, 113, 10 + LTEXT "Розділювач компонентів дати:", -1, 13, 148, 113, 10 COMBOBOX IDC_SHRTDATESEP_COMBO, 180, 146, 51, 100, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP | WS_VISIBLE - GROUPBOX " ", -1, 7, 167, 230, 64 - LTEXT ":", -1, 13, 179, 61, 10 + GROUPBOX "Повний формат дати", -1, 7, 167, 230, 64 + LTEXT "Зразок:", -1, 13, 179, 61, 10 EDITTEXT IDC_LONGDATESAMPLE_EDIT, 77, 177, 153, 14, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP | NOT WS_TABSTOP - LTEXT " - :", -1, 13, 193, 61, 16 + LTEXT "Зразок - читання справа наліво:", -1, 13, 193, 61, 16 EDITTEXT IDC_LONGDATERTOL_EDIT, 77, 195, 153, 14, ES_READONLY | WS_CHILD | WS_VISIBLE | WS_GROUP | NOT WS_TABSTOP | WS_DISABLED - LTEXT " :", -1, 13, 215, 60, 10 + LTEXT "Повний формат:", -1, 13, 215, 60, 10 COMBOBOX IDC_LONGDATEFMT_COMBO, 77, 213, 153, 100, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP | WS_VISIBLE END IDD_SORTPAGE DIALOGEX 0, 0, 246, 234 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Сортування" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "", -1, 7, 7, 230, 74 - LTEXT " , , .", -1, 14, 17, 220, 25 - LTEXT " :", -1, 14, 37, 220, 22 + GROUPBOX "Сортування", -1, 7, 7, 230, 74 + LTEXT "Методи сортування визначають порядок сортування символів, слів, імен файлів і папок.", -1, 14, 17, 220, 25 + LTEXT "Вибрати метод сортування для Вашої мови:", -1, 14, 37, 220, 22 COMBOBOX IDC_SORTLIST_COMBO, 14, 56, 217, 83, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL END STRINGTABLE BEGIN - IDS_CUSTOMIZE_TITLE " " - IDS_SPAIN " ()" - IDS_METRIC "" - IDS_IMPERIAL "" + IDS_CUSTOMIZE_TITLE "Налаштування регіональних параметрів" + IDS_SPAIN "Іспанська (Іспанія)" + IDS_METRIC "Метрична" + IDS_IMPERIAL "Американська" END STRINGTABLE BEGIN - IDS_CPLNAME " " - IDS_CPLDESCRIPTION " , , ." + IDS_CPLNAME "Регіональні стандарти" + IDS_CPLDESCRIPTION "Налаштування мовних параметрів і формату чисел, грошових одиниць, часу й дат." END diff --git a/dll/cpl/intl/languages.c b/dll/cpl/intl/languages.c index 17dba22f605..1ae36d94870 100644 --- a/dll/cpl/intl/languages.c +++ b/dll/cpl/intl/languages.c @@ -1,10 +1,5 @@ -#include -#include -#include -#include #include "intl.h" -#include "resource.h" /* Property page dialog callback */ INT_PTR CALLBACK diff --git a/dll/cpl/intl/misc.c b/dll/cpl/intl/misc.c index 7a9be0e3e3d..bd5d5dec7c8 100644 --- a/dll/cpl/intl/misc.c +++ b/dll/cpl/intl/misc.c @@ -1,10 +1,5 @@ -#include -#include -#include -#include #include "intl.h" -#include "resource.h" #define NUM_SHEETS 4 diff --git a/dll/cpl/intl/numbers.c b/dll/cpl/intl/numbers.c index 75f609bda1d..3169879fae8 100644 --- a/dll/cpl/intl/numbers.c +++ b/dll/cpl/intl/numbers.c @@ -24,13 +24,7 @@ * PROGRAMMER: Eric Kohl */ -#include -#include -#include -#include - #include "intl.h" -#include "resource.h" #define SAMPLE_NUMBER _T("123456789") #define SAMPLE_NEG_NUMBER _T("-123456789") diff --git a/dll/cpl/intl/rsrc.rc b/dll/cpl/intl/rsrc.rc index fad6ac0b9c3..f8a17b20a64 100644 --- a/dll/cpl/intl/rsrc.rc +++ b/dll/cpl/intl/rsrc.rc @@ -9,9 +9,12 @@ #include "lang/fr-FR.rc" #include "lang/it-IT.rc" #include "lang/no-NO.rc" +#include "lang/sk-SK.rc" +#include "lang/zh-CN.rc" + +// UTF-8 +#pragma code_page(65001) #include "lang/pl-PL.rc" #include "lang/ro-RO.rc" #include "lang/ru-RU.rc" -#include "lang/sk-SK.rc" #include "lang/uk-UA.rc" -#include "lang/zh-CN.rc" diff --git a/dll/cpl/intl/setupreg.c b/dll/cpl/intl/setupreg.c index ae85e94c948..b9c464b2b6a 100644 --- a/dll/cpl/intl/setupreg.c +++ b/dll/cpl/intl/setupreg.c @@ -8,13 +8,7 @@ /* INCLUDES *****************************************************************/ -#include -#include -#include -#include - #include "intl.h" -#include "resource.h" /* GLOBALS ******************************************************************/ diff --git a/dll/cpl/intl/sort.c b/dll/cpl/intl/sort.c index aec36951105..dc99a40fe7a 100644 --- a/dll/cpl/intl/sort.c +++ b/dll/cpl/intl/sort.c @@ -6,13 +6,7 @@ * PROGRAMMER: Eric Kohl */ -#include -#include -#include -#include - #include "intl.h" -#include "resource.h" static BOOL bSortPage = FALSE; static LCID userLcid; diff --git a/dll/cpl/intl/time.c b/dll/cpl/intl/time.c index ca21d692991..7156363813c 100644 --- a/dll/cpl/intl/time.c +++ b/dll/cpl/intl/time.c @@ -23,14 +23,7 @@ * PROGRAMMER: Eric Kohl */ -#include -#include -#include -#include -#include - #include "intl.h" -#include "resource.h" static HWND hwndEnum = NULL; diff --git a/dll/cpl/joy/lang/pl-PL.rc b/dll/cpl/joy/lang/pl-PL.rc index 18632f68ecd..446c2a45065 100644 --- a/dll/cpl/joy/lang/pl-PL.rc +++ b/dll/cpl/joy/lang/pl-PL.rc @@ -1,8 +1,9 @@ /* - * translated by Caemyr - Olaf Siejka (Jan, 2008) - * Use ReactOS forum PM or IRC to contact me - * http://www.reactos.org - * IRC: irc.freenode.net #reactos-pl; + * translated by Caemyr - Olaf Siejka (Jan, 2008) + * Use ReactOS forum PM or IRC to contact me + * http://www.reactos.org + * IRC: irc.freenode.net #reactos-pl; + * UTF-8 conversion by Caemyr (May, 2011) */ LANGUAGE LANG_POLISH, SUBLANG_DEFAULT @@ -14,12 +15,12 @@ CAPTION "Kontrolery gier" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_CPLSYSTEM, -1, 7, 7, 20, 20 - LTEXT "Te ustawienia pomog ci skonfigurowa kontolery gier, zainstalowane na tym komputerze.", -1, 33, 7, 214, 20, NOT WS_GROUP + LTEXT "Te ustawienia pomogą ci skonfigurować kontolery gier, zainstalowane na tym komputerze.", -1, 33, 7, 214, 20, NOT WS_GROUP GROUPBOX "&Zainstalowane kontrolery gier", -1, 7, 34, 238, 117 CONTROL "List1", IDC_CONTROLLER_LIST, "SysListView32", WS_BORDER | WS_GROUP | WS_TABSTOP | 0x0000808D, 14, 44, 224, 80 PUSHBUTTON "&Dodaj.", IDC_ADD_BUTTON, 35, 129, 65, 14 - PUSHBUTTON "&Usu..", IDC_REMOVE_BUTTON, 104, 129, 65, 14, WS_DISABLED - PUSHBUTTON "&Waciwoci", IDC_PROPERTIES_BUTTON, 173, 129, 65, 14, WS_DISABLED + PUSHBUTTON "&Usuń..", IDC_REMOVE_BUTTON, 104, 129, 65, 14, WS_DISABLED + PUSHBUTTON "&Właściwości", IDC_PROPERTIES_BUTTON, 173, 129, 65, 14, WS_DISABLED PUSHBUTTON "Z&aawansowane", IDC_ADVANCED_BUTTON, 111, 157, 65, 14 PUSHBUTTON "D&iagnostyka", IDC_TROUBLESHOOT_BUTTON, 180, 157, 65, 14 PUSHBUTTON "OK", IDOK, 195, 185, 50, 14 @@ -32,13 +33,13 @@ CAPTION "Dodawanie Kontrolera" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_CPLSYSTEM, -1, 8, 7, 20, 20 - LTEXT "Wybierz Kontroler gier z listy poniej i nacinij OK. Jeeli twojego Kontrolera gier nie ma na licie, nacinij Wasny.", -1, 35, 7, 210, 33 + LTEXT "Wybierz Kontroler gier z listy poniżej i naciśnij OK. Jeżeli twojego Kontrolera gier nie ma na liście, naciśnij Własny.", -1, 35, 7, 210, 33 LTEXT "&Kontrolery gier:", -1, 8, 45, 126, 8 LISTBOX IDC_GAME_CONTROLLERS_LIST, 7, 55, 251, 57, LBS_STANDARD | LBS_NOINTEGRALHEIGHT | LBS_WANTKEYBOARDINPUT | WS_HSCROLL | WS_TABSTOP - AUTOCHECKBOX "&Wcz ster i peday", IDC_ENABLE_RUDDERS_CHECKBOX, 7, 114, 100, 10, WS_GROUP + AUTOCHECKBOX "&Włącz ster i pedały", IDC_ENABLE_RUDDERS_CHECKBOX, 7, 114, 100, 10, WS_GROUP LTEXT "&Port gier:", -1, 7, 134, 38, 8, NOT WS_VISIBLE COMBOBOX IDC_GAME_PORT_COMBO, 7, 147, 140, 50, CBS_DROPDOWNLIST | CBS_SORT | NOT WS_VISIBLE | WS_VSCROLL - PUSHBUTTON "&Wasny...", IDC_CUSTOM_BUTTON, 208, 147, 50, 14 + PUSHBUTTON "&Własny...", IDC_CUSTOM_BUTTON, 208, 147, 50, 14 CONTROL "", -25525, "STATIC", SS_ETCHEDHORZ, 7, 170, 251, 1 DEFPUSHBUTTON "OK", IDOK, 155, 179, 50, 14 PUSHBUTTON "Anuluj", IDCANCEL, 208, 179, 50, 14 @@ -47,7 +48,7 @@ END IDD_CUSTOM DIALOGEX 0, 0, 265, 183, 0 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_SETFOREGROUND | WS_POPUPWINDOW | WS_CAPTION EXSTYLE WS_EX_CONTEXTHELP -CAPTION "Wasny Kontroler gier" +CAPTION "Własny Kontroler gier" FONT 8, "MS Shell Dlg" BEGIN GROUPBOX "Charakterystyka", -1, 7, 7, 245, 52 @@ -57,11 +58,11 @@ BEGIN AUTORADIOBUTTON "&Kierownica", IDC_RACE_CAR_RADIO, 147, 40, 93, 10 GROUPBOX "&Osie", -1, 7, 67, 116, 44, WS_GROUP COMBOBOX IDC_AXES_COMBO, 37, 79, 48, 50, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL - AUTORADIOBUTTON "Ster/Peday", IDC_RUDDER_PEDALS_RADIO, 14, 97, 63, 10, NOT WS_VISIBLE - AUTORADIOBUTTON "O Z", IDC_Z_AXIS_RADIO, 81, 97, 35, 10, NOT WS_VISIBLE + AUTORADIOBUTTON "Ster/Pedały", IDC_RUDDER_PEDALS_RADIO, 14, 97, 63, 10, NOT WS_VISIBLE + AUTORADIOBUTTON "Oś Z", IDC_Z_AXIS_RADIO, 81, 97, 35, 10, NOT WS_VISIBLE GROUPBOX "&Przyciski", -1, 137, 67, 116, 44 COMBOBOX IDC_BUTTONS_COMBO, 178, 79, 48, 50, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL, WS_EX_CLIENTEDGE - AUTOCHECKBOX "&Zawiera kontrol obszaru widoku", IDC_INC_POINT_CHECKBOX, 7, 123, 115, 10 + AUTOCHECKBOX "&Zawiera kontrolę obszaru widoku", IDC_INC_POINT_CHECKBOX, 7, 123, 115, 10 LTEXT "&Nazwa kontrolera:", -1, 7, 139, 200, 9 EDITTEXT IDC_CONTROLLER_NAME_EDIT, 7, 150, 116, 15, ES_AUTOHSCROLL, WS_EX_CLIENTEDGE | WS_EX_STATICEDGE DEFPUSHBUTTON "OK", IDOK, 137, 150, 50, 14 @@ -77,8 +78,8 @@ BEGIN ICON IDI_CPLSYSTEM, -1, 7, 24, 20, 20 DEFPUSHBUTTON "OK", IDOK, 106, 65, 50, 14 PUSHBUTTON "Anuluj", IDCANCEL, 163, 65, 50, 14 - LTEXT "Wybierz urzdzenie, ktrego chcesz uywa domylnie ze starszymi programami.", -1, 7, 7, 208, 10 - LTEXT "&Urzdzenie preferowane:", -1, 34, 24, 70, 10 + LTEXT "Wybierz urządzenie, którego chcesz używać domyślnie ze starszymi programami.", -1, 7, 7, 208, 10 + LTEXT "&Urządzenie preferowane:", -1, 34, 24, 70, 10 COMBOBOX IDC_PREFERRED_DEV_COMBO, 34, 38, 179, 75, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL END diff --git a/dll/cpl/joy/lang/ro-RO.rc b/dll/cpl/joy/lang/ro-RO.rc index dac950291a9..9930de2e2a9 100644 --- a/dll/cpl/joy/lang/ro-RO.rc +++ b/dll/cpl/joy/lang/ro-RO.rc @@ -1,7 +1,5 @@ LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL -#pragma code_page(65001) - IDD_PROPPAGEMAIN DIALOGEX 0, 0, 252, 205 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION EXSTYLE WS_EX_CONTEXTHELP @@ -84,5 +82,3 @@ BEGIN IDS_CONTROLLER "Controlor" IDS_STATUS "Stare" END - -#pragma code_page(default) diff --git a/dll/cpl/joy/lang/ru-RU.rc b/dll/cpl/joy/lang/ru-RU.rc index 7e18f557cd1..2995a5ce72f 100644 --- a/dll/cpl/joy/lang/ru-RU.rc +++ b/dll/cpl/joy/lang/ru-RU.rc @@ -3,82 +3,82 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT IDD_PROPPAGEMAIN DIALOGEX 0, 0, 252, 205 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION EXSTYLE WS_EX_CONTEXTHELP -CAPTION " " +CAPTION "Игровые устройства" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_CPLSYSTEM, -1, 7, 7, 20, 20 - LTEXT " , .", -1, 33, 7, 214, 20, NOT WS_GROUP - GROUPBOX " & ", -1, 7, 34, 238, 117 + LTEXT "Эти параметры позволяют настроить игровые устройства, установленные на компьютере.", -1, 33, 7, 214, 20, NOT WS_GROUP + GROUPBOX "Установленные &игровые устройства", -1, 7, 34, 238, 117 CONTROL "List1", IDC_CONTROLLER_LIST, "SysListView32", WS_BORDER | WS_GROUP | WS_TABSTOP | 0x0000808D, 14, 44, 224, 80 - PUSHBUTTON "&...", IDC_ADD_BUTTON, 35, 129, 65, 14 - PUSHBUTTON "&", IDC_REMOVE_BUTTON, 104, 129, 65, 14, WS_DISABLED - PUSHBUTTON "&", IDC_PROPERTIES_BUTTON, 173, 129, 65, 14, WS_DISABLED - PUSHBUTTON "&...", IDC_ADVANCED_BUTTON, 101, 157, 70, 14 - PUSHBUTTON "&...", IDC_TROUBLESHOOT_BUTTON, 175, 157, 70, 14 + PUSHBUTTON "До&бавить...", IDC_ADD_BUTTON, 35, 129, 65, 14 + PUSHBUTTON "&Удалить", IDC_REMOVE_BUTTON, 104, 129, 65, 14, WS_DISABLED + PUSHBUTTON "Сво&йства", IDC_PROPERTIES_BUTTON, 173, 129, 65, 14, WS_DISABLED + PUSHBUTTON "Д&ополнительно...", IDC_ADVANCED_BUTTON, 101, 157, 70, 14 + PUSHBUTTON "Диа&гностика...", IDC_TROUBLESHOOT_BUTTON, 175, 157, 70, 14 PUSHBUTTON "OK", IDOK, 195, 185, 50, 14 END IDD_ADD DIALOGEX 0, 0, 265, 200 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_SETFOREGROUND | WS_POPUPWINDOW | WS_CAPTION EXSTYLE WS_EX_CONTEXTHELP -CAPTION " " +CAPTION "Добавление игрового устройства" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_CPLSYSTEM, -1, 8, 7, 20, 20 - LTEXT " . , """".", -1, 35, 7, 210, 33 - LTEXT "& :", -1, 8, 45, 126, 8 + LTEXT "Выберите игровой контроллер в расположенном ниже списке и нажмите кнопку ОК. Если ваш игровой контроллер отсутствует в списке, нажмите кнопку ""Другой"".", -1, 35, 7, 210, 33 + LTEXT "&Игровые устройства:", -1, 8, 45, 126, 8 LISTBOX IDC_GAME_CONTROLLERS_LIST, 7, 55, 251, 57, LBS_STANDARD | LBS_NOINTEGRALHEIGHT | LBS_WANTKEYBOARDINPUT | WS_HSCROLL | WS_TABSTOP - AUTOCHECKBOX "& ", IDC_ENABLE_RUDDERS_CHECKBOX, 7, 114, 120, 10, WS_GROUP - LTEXT "& :", -1, 7, 134, 38, 8, NOT WS_VISIBLE + AUTOCHECKBOX "&Подключить руль или педали", IDC_ENABLE_RUDDERS_CHECKBOX, 7, 114, 120, 10, WS_GROUP + LTEXT "&Игровой порт:", -1, 7, 134, 38, 8, NOT WS_VISIBLE COMBOBOX IDC_GAME_PORT_COMBO, 7, 147, 140, 50, CBS_DROPDOWNLIST | CBS_SORT | NOT WS_VISIBLE | WS_VSCROLL - PUSHBUTTON "&...", IDC_CUSTOM_BUTTON, 208, 147, 50, 14 + PUSHBUTTON "&Другой...", IDC_CUSTOM_BUTTON, 208, 147, 50, 14 CONTROL "", -25525, "STATIC", SS_ETCHEDHORZ, 7, 170, 251, 1 DEFPUSHBUTTON "OK", IDOK, 155, 179, 50, 14 - PUSHBUTTON "", IDCANCEL, 208, 179, 50, 14 + PUSHBUTTON "Отмена", IDCANCEL, 208, 179, 50, 14 END IDD_CUSTOM DIALOGEX 0, 0, 265, 183, 0 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_SETFOREGROUND | WS_POPUPWINDOW | WS_CAPTION EXSTYLE WS_EX_CONTEXTHELP -CAPTION " " +CAPTION "Особое игровое устройство" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "", -1, 7, 7, 245, 52 - AUTORADIOBUTTON "&", IDC_JOYSTICK_RADIO, 17, 23, 55, 10 - AUTORADIOBUTTON "& ", IDC_FLIGHT_YOKE_RADIO, 100, 23, 143, 10 - AUTORADIOBUTTON "& ", IDC_GAME_PAD_RADIO, 17, 40, 75, 10 - AUTORADIOBUTTON " &", IDC_RACE_CAR_RADIO, 100, 40, 143, 10 - GROUPBOX "& ", -1, 7, 67, 116, 44, WS_GROUP + GROUPBOX "Особенности", -1, 7, 7, 245, 52 + AUTORADIOBUTTON "&Джойстик", IDC_JOYSTICK_RADIO, 17, 23, 55, 10 + AUTORADIOBUTTON "&Штурвал или рукоятка управления", IDC_FLIGHT_YOKE_RADIO, 100, 23, 143, 10 + AUTORADIOBUTTON "&Игровой планшет", IDC_GAME_PAD_RADIO, 17, 40, 75, 10 + AUTORADIOBUTTON "Управление гоночной &автомашиной", IDC_RACE_CAR_RADIO, 100, 40, 143, 10 + GROUPBOX "&Степень свободы", -1, 7, 67, 116, 44, WS_GROUP COMBOBOX IDC_AXES_COMBO, 37, 79, 48, 50, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL - AUTORADIOBUTTON " ", IDC_RUDDER_PEDALS_RADIO, 14, 97, 63, 10, NOT WS_VISIBLE - AUTORADIOBUTTON " Z", IDC_Z_AXIS_RADIO, 81, 97, 35, 10, NOT WS_VISIBLE - GROUPBOX "&", -1, 137, 67, 116, 44 + AUTORADIOBUTTON "Руль управления или педали", IDC_RUDDER_PEDALS_RADIO, 14, 97, 63, 10, NOT WS_VISIBLE + AUTORADIOBUTTON "Ось Z", IDC_Z_AXIS_RADIO, 81, 97, 35, 10, NOT WS_VISIBLE + GROUPBOX "К&нопки", -1, 137, 67, 116, 44 COMBOBOX IDC_BUTTONS_COMBO, 178, 79, 48, 50, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL, WS_EX_CLIENTEDGE - AUTOCHECKBOX " & POV", IDC_INC_POINT_CHECKBOX, 7, 123, 115, 10 - LTEXT "&:", -1, 7, 139, 200, 9 + AUTOCHECKBOX "Имеется &переключатель POV", IDC_INC_POINT_CHECKBOX, 7, 123, 115, 10 + LTEXT "&Контролер:", -1, 7, 139, 200, 9 EDITTEXT IDC_CONTROLLER_NAME_EDIT, 7, 150, 116, 15, ES_AUTOHSCROLL, WS_EX_CLIENTEDGE | WS_EX_STATICEDGE DEFPUSHBUTTON "OK", IDOK, 137, 150, 50, 14 - PUSHBUTTON "", IDCANCEL, 203, 150, 50, 14 + PUSHBUTTON "Отмена", IDCANCEL, 203, 150, 50, 14 END IDD_ADVANCED DIALOGEX 0, 0, 220, 86 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION EXSTYLE WS_EX_CONTEXTHELP -CAPTION " " +CAPTION "Дополнительные параметры" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_CPLSYSTEM, -1, 7, 24, 20, 20 - LTEXT " , .", -1, 7, 5, 208, 17 - LTEXT "& :", -1, 34, 24, 180, 10 + LTEXT "Выберите устройство, которое следует использовать со старыми программами.", -1, 7, 5, 208, 17 + LTEXT "&Предпочитаемое устройство:", -1, 34, 24, 180, 10 COMBOBOX IDC_PREFERRED_DEV_COMBO, 34, 38, 179, 75, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL DEFPUSHBUTTON "OK", IDOK, 106, 65, 50, 14 - PUSHBUTTON "", IDCANCEL, 163, 65, 50, 14 + PUSHBUTTON "Отмена", IDCANCEL, 163, 65, 50, 14 END STRINGTABLE BEGIN - IDS_CPLSYSTEMNAME " " - IDS_CPLSYSTEMDESCRIPTION ", , , ." - IDS_CONTROLLER "" - IDS_STATUS "" + IDS_CPLSYSTEMNAME "Игровые устройства" + IDS_CPLSYSTEMDESCRIPTION "Добавление, удаление и настройка параметров игровых устройств, например, джойстиков или игровых планшетов." + IDS_CONTROLLER "Устройство" + IDS_STATUS "Состояние" END diff --git a/dll/cpl/joy/lang/uk-UA.rc b/dll/cpl/joy/lang/uk-UA.rc index 13546069fbd..564c961fa7e 100644 --- a/dll/cpl/joy/lang/uk-UA.rc +++ b/dll/cpl/joy/lang/uk-UA.rc @@ -11,82 +11,82 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT IDD_PROPPAGEMAIN DIALOGEX 0, 0, 252, 205 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION EXSTYLE WS_EX_CONTEXTHELP -CAPTION " " +CAPTION "Ігрові пристрої" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_CPLSYSTEM, -1, 7, 7, 20, 20 - LTEXT "ֳ , '.", -1, 33, 7, 214, 20, NOT WS_GROUP - GROUPBOX "& ", -1, 7, 34, 238, 117 + LTEXT "Ці параметри дають змогу налаштувати ігрові пристрої, установлені на цьому комп'ютері.", -1, 33, 7, 214, 20, NOT WS_GROUP + GROUPBOX "&Установлені ігрові пристрої", -1, 7, 34, 238, 117 CONTROL "List1", IDC_CONTROLLER_LIST, "SysListView32", WS_BORDER | WS_GROUP | WS_TABSTOP | 0x0000808D, 14, 44, 224, 80 - PUSHBUTTON "&...", IDC_ADD_BUTTON, 35, 129, 65, 14 - PUSHBUTTON "&", IDC_REMOVE_BUTTON, 104, 129, 65, 14, WS_DISABLED - PUSHBUTTON "&", IDC_PROPERTIES_BUTTON, 173, 129, 65, 14, WS_DISABLED - PUSHBUTTON "&...", IDC_ADVANCED_BUTTON, 111, 157, 65, 14 - PUSHBUTTON "ij&...", IDC_TROUBLESHOOT_BUTTON, 180, 157, 65, 14 + PUSHBUTTON "&Додати...", IDC_ADD_BUTTON, 35, 129, 65, 14 + PUSHBUTTON "В&идалити", IDC_REMOVE_BUTTON, 104, 129, 65, 14, WS_DISABLED + PUSHBUTTON "В&ластивості", IDC_PROPERTIES_BUTTON, 173, 129, 65, 14, WS_DISABLED + PUSHBUTTON "Д&одатково...", IDC_ADVANCED_BUTTON, 111, 157, 65, 14 + PUSHBUTTON "Діа&гностика...", IDC_TROUBLESHOOT_BUTTON, 180, 157, 65, 14 PUSHBUTTON "OK", IDOK, 195, 185, 50, 14 END IDD_ADD DIALOGEX 0, 0, 265, 200 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_SETFOREGROUND | WS_POPUPWINDOW | WS_CAPTION EXSTYLE WS_EX_CONTEXTHELP -CAPTION " " +CAPTION "Додавання ігрового пристрою" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_CPLSYSTEM, -1, 8, 7, 20, 20 - LTEXT " ""OK"". , """".", -1, 35, 7, 210, 33 - LTEXT "& :", -1, 8, 45, 126, 8 + LTEXT "Виберіть ігровий пристрій із нижченаведеного списку й натисніть кнопку ""OK"". Якщо вашого ігрового пристрою немає у списку, натисніть кнопку ""Інший"".", -1, 35, 7, 210, 33 + LTEXT "&Ігрові пристрої:", -1, 8, 45, 126, 8 LISTBOX IDC_GAME_CONTROLLERS_LIST, 7, 55, 251, 57, LBS_STANDARD | LBS_NOINTEGRALHEIGHT | LBS_WANTKEYBOARDINPUT | WS_HSCROLL | WS_TABSTOP - AUTOCHECKBOX "&ϳ ", IDC_ENABLE_RUDDERS_CHECKBOX, 7, 114, 100, 10, WS_GROUP - LTEXT "& :", -1, 7, 134, 38, 8, NOT WS_VISIBLE + AUTOCHECKBOX "&Підключити руль і педалі", IDC_ENABLE_RUDDERS_CHECKBOX, 7, 114, 100, 10, WS_GROUP + LTEXT "І&гровий порт:", -1, 7, 134, 38, 8, NOT WS_VISIBLE COMBOBOX IDC_GAME_PORT_COMBO, 7, 147, 140, 50, CBS_DROPDOWNLIST | CBS_SORT | NOT WS_VISIBLE | WS_VSCROLL - PUSHBUTTON "&...", IDC_CUSTOM_BUTTON, 208, 147, 50, 14 + PUSHBUTTON "Ін&ший...", IDC_CUSTOM_BUTTON, 208, 147, 50, 14 CONTROL "", -25525, "STATIC", SS_ETCHEDHORZ, 7, 170, 251, 1 DEFPUSHBUTTON "OK", IDOK, 155, 179, 50, 14 - PUSHBUTTON "", IDCANCEL, 208, 179, 50, 14 + PUSHBUTTON "Скасувати", IDCANCEL, 208, 179, 50, 14 END IDD_CUSTOM DIALOGEX 0, 0, 265, 183, 0 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_SETFOREGROUND | WS_POPUPWINDOW | WS_CAPTION EXSTYLE WS_EX_CONTEXTHELP -CAPTION " " +CAPTION "Особливий ігровий пристрій" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "", -1, 7, 7, 245, 52 - AUTORADIOBUTTON "&", IDC_JOYSTICK_RADIO, 17, 23, 55, 10 - AUTORADIOBUTTON "& ", IDC_FLIGHT_YOKE_RADIO, 125, 23, 116, 10 - AUTORADIOBUTTON "& ", IDC_GAME_PAD_RADIO, 17, 40, 70, 10 - AUTORADIOBUTTON " . &", IDC_RACE_CAR_RADIO, 125, 40, 125, 10 - GROUPBOX "& ", -1, 7, 67, 116, 44, WS_GROUP + GROUPBOX "Особливості", -1, 7, 7, 245, 52 + AUTORADIOBUTTON "Джо&йстик", IDC_JOYSTICK_RADIO, 17, 23, 55, 10 + AUTORADIOBUTTON "&Штурвал або ручка керування", IDC_FLIGHT_YOKE_RADIO, 125, 23, 116, 10 + AUTORADIOBUTTON "І&гровий планшет", IDC_GAME_PAD_RADIO, 17, 40, 70, 10 + AUTORADIOBUTTON "Керування перегон. &автомобілем", IDC_RACE_CAR_RADIO, 125, 40, 125, 10 + GROUPBOX "&Степені вільності", -1, 7, 67, 116, 44, WS_GROUP COMBOBOX IDC_AXES_COMBO, 37, 79, 48, 50, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL - AUTORADIOBUTTON " ", IDC_RUDDER_PEDALS_RADIO, 14, 97, 63, 10, NOT WS_VISIBLE - AUTORADIOBUTTON "³ Z", IDC_Z_AXIS_RADIO, 81, 97, 35, 10, NOT WS_VISIBLE - GROUPBOX "&", -1, 137, 67, 116, 44 + AUTORADIOBUTTON "Руль або педалі", IDC_RUDDER_PEDALS_RADIO, 14, 97, 63, 10, NOT WS_VISIBLE + AUTORADIOBUTTON "Вісь Z", IDC_Z_AXIS_RADIO, 81, 97, 35, 10, NOT WS_VISIBLE + GROUPBOX "К&нопки", -1, 137, 67, 116, 44 COMBOBOX IDC_BUTTONS_COMBO, 178, 79, 48, 50, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL, WS_EX_CLIENTEDGE - AUTOCHECKBOX " & ", IDC_INC_POINT_CHECKBOX, 7, 123, 115, 10 - LTEXT "&' :", -1, 7, 139, 200, 9 + AUTOCHECKBOX "Є &перемикач точки зору", IDC_INC_POINT_CHECKBOX, 7, 123, 115, 10 + LTEXT "&Ім'я пристрою:", -1, 7, 139, 200, 9 EDITTEXT IDC_CONTROLLER_NAME_EDIT, 7, 150, 116, 15, ES_AUTOHSCROLL, WS_EX_CLIENTEDGE | WS_EX_STATICEDGE DEFPUSHBUTTON "OK", IDOK, 137, 150, 50, 14 - PUSHBUTTON "", IDCANCEL, 203, 150, 50, 14 + PUSHBUTTON "Скасувати", IDCANCEL, 203, 150, 50, 14 END IDD_ADVANCED DIALOGEX 0, 0, 220, 86 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION EXSTYLE WS_EX_CONTEXTHELP -CAPTION " " +CAPTION "Додаткові параметри" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_CPLSYSTEM, -1, 7, 24, 20, 20 DEFPUSHBUTTON "OK", IDOK, 106, 65, 50, 14 - PUSHBUTTON "", IDCANCEL, 163, 65, 50, 14 - LTEXT " , .", -1, 7, 7, 190, 18 - LTEXT "& :", -1, 34, 24, 70, 10 + PUSHBUTTON "Скасувати", IDCANCEL, 163, 65, 50, 14 + LTEXT "Виберіть пристрій, який слід використовувати зі старими програмами.", -1, 7, 7, 190, 18 + LTEXT "&Кращий пристрій:", -1, 34, 24, 70, 10 COMBOBOX IDC_PREFERRED_DEV_COMBO, 34, 38, 179, 75, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL END STRINGTABLE BEGIN - IDS_CPLSYSTEMNAME " " - IDS_CPLSYSTEMDESCRIPTION ", , , ." - IDS_CONTROLLER "" - IDS_STATUS "" + IDS_CPLSYSTEMNAME "Ігрові пристрої" + IDS_CPLSYSTEMDESCRIPTION "Додавання, видалення й настройка параметрів ігрових пристроїв, наприклад, джойстиків або ігрових планшетів." + IDS_CONTROLLER "Пристрій" + IDS_STATUS "Стан" END diff --git a/dll/cpl/joy/rsrc.rc b/dll/cpl/joy/rsrc.rc index ba9ed7bd74b..84cdb798a67 100644 --- a/dll/cpl/joy/rsrc.rc +++ b/dll/cpl/joy/rsrc.rc @@ -10,9 +10,12 @@ #include "lang/fr-FR.rc" #include "lang/it-IT.rc" #include "lang/no-NO.rc" +#include "lang/sk-SK.rc" +#include "lang/zh-CN.rc" + +// UTF-8 +#pragma code_page(65001) #include "lang/pl-PL.rc" #include "lang/ro-RO.rc" #include "lang/ru-RU.rc" -#include "lang/sk-SK.rc" #include "lang/uk-UA.rc" -#include "lang/zh-CN.rc" diff --git a/dll/cpl/liccpa/lang/pl-PL.rc b/dll/cpl/liccpa/lang/pl-PL.rc index 9c3b2507569..e0365b67a46 100644 --- a/dll/cpl/liccpa/lang/pl-PL.rc +++ b/dll/cpl/liccpa/lang/pl-PL.rc @@ -1,8 +1,10 @@ /* -* translated by xrogers -* xxrogers@users.sourceforge.net -* https://sourceforge.net/projects/reactospl -*/ + * translated by xrogers + * xxrogers@users.sourceforge.net + * https://sourceforge.net/projects/reactospl + * UTF-8 conversion by Caemyr (May, 2011) + */ + LANGUAGE LANG_POLISH, SUBLANG_DEFAULT IDD_PROPPAGE1 DIALOGEX DISCARDABLE 20, 40, 315, 104 @@ -11,22 +13,22 @@ CAPTION "Wybierz tryb licencjonowania" FONT 8, "Helv" BEGIN CONTROL "Tryb licencjonowania klienckiego", 100, "BUTTON", BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 4, 4, 239, 94 - CONTROL "Na urzdzenie lub na uytkownika", 102, "BUTTON", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 13, 79, 107, 12 - CONTROL "Na serwer. Liczba jednoczesnych pocze:", 103, "BUTTON", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 13, 38, 163, 9 + CONTROL "Na urządzenie lub na użytkownika", 102, "BUTTON", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 13, 79, 107, 12 + CONTROL "Na serwer. Liczba jednoczesnych połączeń:", 103, "BUTTON", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 13, 38, 163, 9 CONTROL "Produkt:", 105, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 13, 20, 31, 8 CONTROL "", 106, "COMBOBOX", CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP, 49, 20, 171, 12 CONTROL "OK", 107, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 263, 7, 46, 14 CONTROL "Anuluj", 108, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 263, 27, 46, 14 CONTROL "Pomoc", 109, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 263, 48, 46, 14 CONTROL "Replikacja...", 110, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 263, 68, 46, 14 - CONTROL "Dodaj licencj", 111, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 30, 56, 65, 15 - CONTROL "Usu licencj", 112, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 112, 56, 61, 16 + CONTROL "Dodaj licencję", 111, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 30, 56, 65, 15 + CONTROL "Usuń licencję", 112, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 112, 56, 61, 16 CONTROL "", 114, "EDIT", ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 187, 39, 32, 12 END STRINGTABLE BEGIN - IDS_CPLNAME_1 "Meneder licencji" - IDS_CPLDESCRIPTION_1 "Meneder licencji" + IDS_CPLNAME_1 "Menedżer licencji" + IDS_CPLDESCRIPTION_1 "Menedżer licencji" IDS_REACTOS "ReactOS - darmowe oprogramowanie" END diff --git a/dll/cpl/liccpa/lang/ru-RU.rc b/dll/cpl/liccpa/lang/ru-RU.rc index bf435849d24..f64e0adc2a0 100644 --- a/dll/cpl/liccpa/lang/ru-RU.rc +++ b/dll/cpl/liccpa/lang/ru-RU.rc @@ -2,26 +2,26 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT IDD_PROPPAGE1 DIALOGEX DISCARDABLE 20, 40, 315, 104 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_OVERLAPPED | WS_CAPTION | WS_VISIBLE | WS_SYSMENU -CAPTION " " +CAPTION "Выбор вариантов лицензирования" FONT 8, "Helv" BEGIN - CONTROL " ", 100, "BUTTON", BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 4, 4, 239, 94 - CONTROL " ", 102, "BUTTON", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 13, 79, 107, 12 - CONTROL " . :", 103, "BUTTON", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 13, 38, 163, 9 - CONTROL ":", 105, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 13, 20, 31, 8 + CONTROL "Вариант клиентской лицензии", 100, "BUTTON", BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 4, 4, 239, 94 + CONTROL "На устройство или на пользователя", 102, "BUTTON", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 13, 79, 107, 12 + CONTROL "На сервер. Число одновременных подключений:", 103, "BUTTON", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 13, 38, 163, 9 + CONTROL "Продукт:", 105, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 13, 20, 31, 8 CONTROL "", 106, "COMBOBOX", CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP, 49, 20, 171, 12 CONTROL "OK", 107, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 263, 7, 46, 14 - CONTROL "", 108, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 263, 27, 46, 14 - CONTROL "", 109, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 263, 48, 46, 14 - CONTROL "...", 110, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 263, 68, 46, 14 - CONTROL " ", 111, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 30, 56, 65, 15 - CONTROL " ", 112, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 112, 56, 61, 16 + CONTROL "Отмена", 108, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 263, 27, 46, 14 + CONTROL "Справка", 109, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 263, 48, 46, 14 + CONTROL "Репликация...", 110, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 263, 68, 46, 14 + CONTROL "Добавить лицензии", 111, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 30, 56, 65, 15 + CONTROL "Удалить лицензии", 112, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 112, 56, 61, 16 CONTROL "", 114, "EDIT", ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 187, 39, 32, 12 END STRINGTABLE BEGIN - IDS_CPLNAME_1 " " - IDS_CPLDESCRIPTION_1 " " - IDS_REACTOS "ReactOS - " + IDS_CPLNAME_1 "Менеджер лицензий" + IDS_CPLDESCRIPTION_1 "Менеджер лицензий" + IDS_REACTOS "ReactOS - Свободное программное обеспечение" END diff --git a/dll/cpl/liccpa/lang/uk-UA.rc b/dll/cpl/liccpa/lang/uk-UA.rc index fe492daa7cd..b3b697479b7 100644 --- a/dll/cpl/liccpa/lang/uk-UA.rc +++ b/dll/cpl/liccpa/lang/uk-UA.rc @@ -10,26 +10,26 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT IDD_PROPPAGE1 DIALOGEX DISCARDABLE 20, 40, 315, 104 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_OVERLAPPED | WS_CAPTION | WS_VISIBLE | WS_SYSMENU -CAPTION " " +CAPTION "Вибір режиму ліцензування" FONT 8, "Helv" BEGIN - CONTROL " 볺 糿", 100, "BUTTON", BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 4, 4, 239, 94 - CONTROL " ", 102, "BUTTON", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 13, 79, 107, 12 - CONTROL " . :", 103, "BUTTON", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 13, 38, 163, 9 - CONTROL ":", 105, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 13, 20, 31, 8 + CONTROL "Режим клієнтської ліцензії", 100, "BUTTON", BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 4, 4, 239, 94 + CONTROL "На пристрій або на користувача", 102, "BUTTON", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 13, 79, 107, 12 + CONTROL "На сервер. Число одночасних підключень:", 103, "BUTTON", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 13, 38, 163, 9 + CONTROL "Продукт:", 105, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 13, 20, 31, 8 CONTROL "", 106, "COMBOBOX", CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP, 49, 20, 171, 12 CONTROL "OK", 107, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 263, 7, 46, 14 - CONTROL "", 108, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 263, 27, 46, 14 - CONTROL "", 109, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 263, 48, 46, 14 - CONTROL "...", 110, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 263, 68, 46, 14 - CONTROL " 糿", 111, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 30, 56, 65, 15 - CONTROL " 糿", 112, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 112, 56, 61, 16 + CONTROL "Скасувати", 108, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 263, 27, 46, 14 + CONTROL "Довідка", 109, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 263, 48, 46, 14 + CONTROL "Реплікація...", 110, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 263, 68, 46, 14 + CONTROL "Додати ліцензії", 111, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 30, 56, 65, 15 + CONTROL "Видалити ліцензії", 112, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 112, 56, 61, 16 CONTROL "", 114, "EDIT", ES_LEFT | ES_AUTOHSCROLL | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 187, 39, 32, 12 END STRINGTABLE BEGIN - IDS_CPLNAME_1 " " - IDS_CPLDESCRIPTION_1 " " - IDS_REACTOS "ReactOS - ³ " + IDS_CPLNAME_1 "Менеджер ліцензій" + IDS_CPLDESCRIPTION_1 "Менеджер ліцензій" + IDS_REACTOS "ReactOS - Вільне ПЗ" END diff --git a/dll/cpl/liccpa/rsrc.rc b/dll/cpl/liccpa/rsrc.rc index 46d6d98cfa5..dce56362d51 100644 --- a/dll/cpl/liccpa/rsrc.rc +++ b/dll/cpl/liccpa/rsrc.rc @@ -12,8 +12,11 @@ #include "lang/it-IT.rc" #include "lang/ja-JP.rc" #include "lang/no-NO.rc" +#include "lang/sk-SK.rc" +#include "lang/zh-CN.rc" + +// UTF-8 +#pragma code_page(65001) #include "lang/pl-PL.rc" #include "lang/ru-RU.rc" -#include "lang/sk-SK.rc" #include "lang/uk-UA.rc" -#include "lang/zh-CN.rc" diff --git a/dll/cpl/main/CMakeLists.txt b/dll/cpl/main/CMakeLists.txt index 0f6a5f56840..1187ad31124 100644 --- a/dll/cpl/main/CMakeLists.txt +++ b/dll/cpl/main/CMakeLists.txt @@ -2,8 +2,6 @@ set_unicode() set_rc_compiler() -add_definitions(-D_DLL -D__USE_CRTIMP) - spec2def(main.cpl main.spec) add_library(main SHARED @@ -26,4 +24,5 @@ add_importlibs(main gdi32 kernel32) +add_pch(main main.h) add_cd_file(TARGET main DESTINATION reactos/system32 FOR all) diff --git a/dll/cpl/main/keyboard.c b/dll/cpl/main/keyboard.c index 293ace41805..958f5eb0ef6 100644 --- a/dll/cpl/main/keyboard.c +++ b/dll/cpl/main/keyboard.c @@ -24,16 +24,7 @@ * PROGRAMMER: Eric Kohl */ -#include -#include -#include -#include -#include -#include -#include - #include "main.h" -#include "resource.h" #define ID_BLINK_TIMER 345 diff --git a/dll/cpl/main/lang/pl-PL.rc b/dll/cpl/main/lang/pl-PL.rc index 1f2b5cf5653..e6ec1677587 100644 --- a/dll/cpl/main/lang/pl-PL.rc +++ b/dll/cpl/main/lang/pl-PL.rc @@ -1,54 +1,55 @@ /* - * translation by xrogers - * xxrogers@users.sourceforge.net - * https://sourceforge.net/projects/reactospl + * translated by xrogers + * xxrogers@users.sourceforge.net + * https://sourceforge.net/projects/reactospl + * UTF-8 conversion by Caemyr (May, 2011) */ - + LANGUAGE LANG_POLISH, SUBLANG_DEFAULT IDD_KEYBSPEED DIALOGEX 0, 0, 246, 228 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Szybko" +CAPTION "Szybkość" FONT 8, "MS Shell Dlg" BEGIN GROUPBOX "Powtarzanie znaku", -1, 5, 5, 230, 130 ICON IDI_REPEAT_DELAY, IDC_ICON_REPEAT_DELAY, 15, 15, 15, 15 - LTEXT "&Opnienie powtarzania:", -1, 40, 15, 50, 10 - LTEXT "Due", -1, 40, 30, 20, 10 - LTEXT "Mae", -1, 200, 30, 20, 10 + LTEXT "&Opóźnienie powtarzania:", -1, 40, 15, 50, 10 + LTEXT "Duże", -1, 40, 30, 20, 10 + LTEXT "Małe", -1, 200, 30, 20, 10 CONTROL "",IDC_SLIDER_REPEAT_DELAY, "msctls_trackbar32", TBS_AUTOTICKS | WS_TABSTOP, 65, 30, 130, 17 ICON IDI_REPEAT_RATE, IDC_ICON_REPEAT_RATE, 15, 70, 15, 15 - LTEXT "&Czstotliwo powtarzania", -1, 40, 70, 50, 10 - LTEXT "Maa", -1, 40, 85, 20, 10 - LTEXT "Dua", -1, 200, 85, 20, 10 + LTEXT "&Częstotliwość powtarzania", -1, 40, 70, 50, 10 + LTEXT "Mała", -1, 40, 85, 20, 10 + LTEXT "Duża", -1, 200, 85, 20, 10 CONTROL "",IDC_SLIDER_REPEAT_RATE, "msctls_trackbar32", TBS_AUTOTICKS | WS_TABSTOP, 65, 85, 130, 17 - LTEXT "&Kliknij tutaj i przytrzymaj klawisz, aby sprawdzi szybko powtarzania:", -1, 15, 105, 150, 10 + LTEXT "&Kliknij tutaj i przytrzymaj klawisz, aby sprawdzić szybkość powtarzania:", -1, 15, 105, 150, 10 EDITTEXT IDC_EDIT_REPEAT_RATE, 15, 115, 200, 15, WS_CHILD | WS_VISIBLE | WS_GROUP - GROUPBOX "Czstotliwo &migania kursora", -1, 5, 145, 230, 50 + GROUPBOX "Częstotliwość &migania kursora", -1, 5, 145, 230, 50 LTEXT "", IDC_TEXT_CURSOR_BLINK, 20, 165, 1, 8 LTEXT "Brak", -1, 40, 165, 30, 10 - LTEXT "Dua", -1, 200, 165, 30, 10 + LTEXT "Duża", -1, 200, 165, 30, 10 CONTROL "",IDC_SLIDER_CURSOR_BLINK, "msctls_trackbar32", TBS_AUTOTICKS | WS_TABSTOP, 65, 165, 130, 17 END IDD_HARDWARE DIALOGEX 0, 0, 246, 228 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Sprzt" +CAPTION "Sprzęt" FONT 8, "MS Shell Dlg" BEGIN END IDD_CLICK_LOCK DIALOGEX 0, 0, 246, 100 STYLE DS_SHELLFONT | WS_CAPTION | WS_SYSMENU -CAPTION "Blokada Kliknicia" +CAPTION "Blokada Kliknięcia" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Krtko", -1, 35, 50, 30, 10 - LTEXT "Dugo", -1, 140, 50, 30, 10 + LTEXT "Krótko", -1, 35, 50, 30, 10 + LTEXT "Długo", -1, 140, 50, 30, 10 CONTROL "",IDC_SLIDER_CLICK_LOCK, "msctls_trackbar32", TBS_AUTOTICKS | WS_TABSTOP, 65, 50, 70, 17 PUSHBUTTON "&Ok", IDOK, 120, 75, 50, 15 PUSHBUTTON "&Anuluj", IDCANCEL, 175, 75, 50, 15 - LTEXT "&Dopasuj czas potrzebny do przytrzymania wcinitego przycisku myszy lub urzdzenia wskazujcego przed zablokowaniem kliknicia.",-1,60,15,170,30 + LTEXT "&Dopasuj czas potrzebny do przytrzymania wciśniętego przycisku myszy lub urządzenia wskazującego przed „zablokowaniem” kliknięcia.",-1,60,15,170,30 ICON IDI_LOOK_KEY, IDC_ICON_CLICK_LOCK, 15, 15, 15, 15 END @@ -57,37 +58,37 @@ STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION CAPTION "Przyciski" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "Konfiguracja przyciskw", -1, 5, 5, 230, 70 - CHECKBOX "&Przecz przycisk podstawowy i pomocniczy", IDC_SWAP_MOUSE_BUTTONS, 10, 15, 140, 10 + GROUPBOX "Konfiguracja przycisków", -1, 5, 5, 230, 70 + CHECKBOX "&Przełącz przycisk podstawowy i pomocniczy", IDC_SWAP_MOUSE_BUTTONS, 10, 15, 140, 10 CONTROL "", IDC_IMAGE_SWAP_MOUSE, "Static", SS_ICON | SS_CENTERIMAGE | WS_VISIBLE, 165, 15, 65, 57, WS_EX_STATICEDGE - LTEXT "Zaznacz to pole wyboru, aby uywa prawego przycisku do wykonywania funkcji podstawowych, takich jak zaznaczanie i przeciganie.", -1, 10, 30, 150, 30 - GROUPBOX "Szybko dwukrotnego kliknicia", -1, 5, 75, 230, 70 - LTEXT "Kliknij dwukrotnie folder, aby przetestowa ustawienie. Jeli folder nie otworzy si lub nie zamknie, sprbuj uy wolniejszego ustawienia.", -1, 10, 85, 150, 30 - LTEXT "&Szybko: Wolno", -1, 10, 120, 90, 8 + LTEXT "Zaznacz to pole wyboru, aby używać prawego przycisku do wykonywania funkcji podstawowych, takich jak zaznaczanie i przeciąganie.", -1, 10, 30, 150, 30 + GROUPBOX "Szybkość dwukrotnego kliknięcia", -1, 5, 75, 230, 70 + LTEXT "Kliknij dwukrotnie folder, aby przetestować ustawienie. Jeśli folder nie otworzy się lub nie zamknie, spróbuj użyć wolniejszego ustawienia.", -1, 10, 85, 150, 30 + LTEXT "&Szybkość: Wolno", -1, 10, 120, 90, 8 LTEXT "Szybko", -1, 140, 120, 30, 8 CONTROL "",IDC_SLIDER_DOUBLE_CLICK_SPEED, "msctls_trackbar32", TBS_AUTOTICKS | WS_TABSTOP, 60, 120, 70, 17 CONTROL "", IDC_IMAGE_DOUBLE_CLICK_SPEED, "Static", SS_ICON | SS_NOTIFY | SS_CENTERIMAGE | WS_VISIBLE, 165, 85, 65, 57, WS_EX_STATICEDGE - GROUPBOX "Blokada Kliknicia", -1, 5, 150, 230, 70 - CHECKBOX "&Wcz funkcj Blokada Kliknicia", IDC_CHECK_CLICK_LOCK, 10, 160, 70, 20 + GROUPBOX "Blokada Kliknięcia", -1, 5, 150, 230, 70 + CHECKBOX "&Włącz funkcję Blokada Kliknięcia", IDC_CHECK_CLICK_LOCK, 10, 160, 70, 20 PUSHBUTTON "&Ustawienia...", IDC_BUTTON_CLICK_LOCK, 170, 160, 50, 10 - LTEXT "Umoliwia podwietlanie lub przeciganie bez przytrzymywania nacinitego przycisku myszy. Aby ustawi, nacinij na krtko przycisk myszy. Aby zwolni, kliknij przycisk myszy ponownie.", -1, 10, 180, 190, 30 + LTEXT "Umożliwia podświetlanie lub przeciąganie bez przytrzymywania naciśniętego przycisku myszy. Aby ustawić, naciśnij na krótko przycisk myszy. Aby zwolnić, kliknij przycisk myszy ponownie.", -1, 10, 180, 190, 30 END IDD_PAGE_POINTER DIALOGEX 0, 0, 246, 228 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION "Wskaniki" +CAPTION "Wskaźniki" FONT 8, "MS Shell Dlg" BEGIN GROUPBOX "&Schemat", -1, 5, 5, 170, 45 COMBOBOX IDC_COMBO_CURSOR_SCHEME, 10, 15, 145, 200, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP PUSHBUTTON "Z&apisz jako...", IDC_BUTTON_SAVEAS_SCHEME, 70, 30, 50, 15 - PUSHBUTTON "&Usu", IDC_BUTTON_DELETE_SCHEME, 125, 30, 40, 15 + PUSHBUTTON "&Usuń", IDC_BUTTON_DELETE_SCHEME, 125, 30, 40, 15 CONTROL "", IDC_IMAGE_CURRENT_CURSOR, "Static", SS_ICON | SS_CENTERIMAGE | WS_VISIBLE, 190, 9, 45, 41, WS_EX_STATICEDGE LTEXT "&Dostosuj:", -1, 5, 60, 40, 10 LISTBOX IDC_LISTBOX_CURSOR, 5, 70, 230, 120, WS_VISIBLE | WS_BORDER | WS_TABSTOP | WS_VSCROLL | LBS_OWNERDRAWFIXED | LBS_NOTIFY - CHECKBOX "&Wcz cie wskanika", IDC_CHECK_CURSOR_SHADOW, 5, 200, 100, 10 - PUSHBUTTON "Uyj d&omylnego", IDC_BUTTON_USE_DEFAULT_CURSOR, 120, 200, 50, 15 - PUSHBUTTON "&Przegldaj...", IDC_BUTTON_BROWSE_CURSOR, 175, 200, 50, 15 + CHECKBOX "&Włącz cień wskaźnika", IDC_CHECK_CURSOR_SHADOW, 5, 200, 100, 10 + PUSHBUTTON "Użyj d&omyślnego", IDC_BUTTON_USE_DEFAULT_CURSOR, 120, 200, 50, 15 + PUSHBUTTON "&Przeglądaj...", IDC_BUTTON_BROWSE_CURSOR, 175, 200, 50, 15 END IDD_CURSOR_SCHEME_SAVEAS DIALOGEX 0, 0, 200, 75 @@ -95,7 +96,7 @@ STYLE DS_SHELLFONT | WS_CAPTION | WS_SYSMENU CAPTION "Zapisz schemat" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Zapisz ten schemat kursorw jako:", -1, 5, 5, 100, 10 + LTEXT "Zapisz ten schemat kursorów jako:", -1, 5, 5, 100, 10 EDITTEXT IDC_EDIT_SCHEME_NAME, 5, 15, 180, 15, WS_CHILD | WS_VISIBLE | WS_GROUP PUSHBUTTON "&Ok", IDOK, 60, 45, 50, 15 PUSHBUTTON "&Anuluj", IDCANCEL, 115, 45, 50, 15 @@ -104,41 +105,41 @@ END IDD_PAGE_OPTION DIALOGEX 0, 0, 246, 228 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION "Opcje wskanika" +CAPTION "Opcje wskaźnika" FONT 8, "MS Shell Dlg" BEGIN GROUPBOX "Ruch", -1, 5, 5, 230, 60 - LTEXT "&Wybierz szybko wskanika:", -1, 60, 15, 110, 10 + LTEXT "&Wybierz szybkość wskaźnika:", -1, 60, 15, 110, 10 LTEXT "Wolno", -1, 60, 30, 20, 10 CONTROL "",IDC_SLIDER_MOUSE_SPEED, "msctls_trackbar32", TBS_AUTOTICKS | WS_TABSTOP, 90, 30, 70, 17 LTEXT "Szybko", -1, 170, 30, 20, 10 ICON IDI_MOUSE_SPEED, IDC_ICON_MOUSE_SPEED, 15, 15, 15, 15 - CHECKBOX "Zwiksz pr&ecyzj wskanika", IDC_CHECK_POINTER_PRECISION, 60, 50, 100, 10 - GROUPBOX "Przyciganie do", -1, 5, 65, 230, 40 - CHECKBOX "&Automatycznie przenie wskanik na domylny przycisk w oknie dialogowym", + CHECKBOX "Zwiększ pr&ecyzję wskaźnika", IDC_CHECK_POINTER_PRECISION, 60, 50, 100, 10 + GROUPBOX "Przyciąganie do", -1, 5, 65, 230, 40 + CHECKBOX "&Automatycznie przenieś wskaźnik na domyślny przycisk w oknie dialogowym", IDC_CHECK_SNAP_TO, 60, 75, 170, 20, BS_MULTILINE | BS_TOP ICON IDI_MOUSE_BUTTON, IDC_ICON_SNAP_TO, 15, 75, 15, 15 - GROUPBOX "Widoczno", -1, 5, 105, 230, 95 - CHECKBOX "&Poka lady wskanika", IDC_CHECK_POINTER_TRAIL, 60, 115, 80, 10 - LTEXT "Dugo", IDC_TEXT_TRAIL_SHORT, 60, 130, 30, 10 - LTEXT "Krtko", IDC_TEXT_TRAIL_LONG, 160, 130, 30, 10 + GROUPBOX "Widoczność", -1, 5, 105, 230, 95 + CHECKBOX "&Pokaż ślady wskaźnika", IDC_CHECK_POINTER_TRAIL, 60, 115, 80, 10 + LTEXT "Długo", IDC_TEXT_TRAIL_SHORT, 60, 130, 30, 10 + LTEXT "Krótko", IDC_TEXT_TRAIL_LONG, 160, 130, 30, 10 ICON IDI_MOUSE_TRAILS, IDC_ICON_POINTER_TRAIL, 15, 115, 15, 15 CONTROL "", IDC_SLIDER_POINTER_TRAIL ,"msctls_trackbar32", TBS_AUTOTICKS | WS_TABSTOP, 80, 130, 70, 17 - CHECKBOX "&Ukryj wskanik podczas pisania", IDC_CHECK_HIDE_POINTER, 60, 150, 90, 10 + CHECKBOX "&Ukryj wskaźnik podczas pisania", IDC_CHECK_HIDE_POINTER, 60, 150, 90, 10 ICON IDI_MOUSE_SPEED, IDC_ICON_HIDE_POINTER, 15, 145, 15, 15 - CHECKBOX "Poka lokalizacj wskanika po naciniciu klawisza &CTRL", + CHECKBOX "Pokaż lokalizację wskaźnika po naciśnięciu klawisza &CTRL", IDC_CHECK_SHOW_POINTER, 60, 175, 170, 20, BS_MULTILINE | BS_TOP ICON IDI_MOUSE_POINTER, IDC_ICON_SHOW_POINTER, 15, 170, 15, 15 END IDD_PAGE_WHEEL DIALOGEX 0, 0, 246, 228 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION "Kko" +CAPTION "Kółko" FONT 8, "MS Shell Dlg" BEGIN GROUPBOX "Przewijanie", -1, 5, 5, 230, 80 ICON IDI_MOUSE_WHEEL, IDC_ICON_WHEEL, 20, 20, 32, 32 - LTEXT "Obrcenie kkiem o jeden skok powoduje przewinicie:", -1, 60, 15, 150, 10 + LTEXT "Obrócenie kółkiem o jeden skok powoduje przewinięcie:", -1, 60, 15, 150, 10 RADIOBUTTON "&O tyle linii naraz:", IDC_RADIO_WHEEL_SCROLL_LINES, 60, 30, 150, 10, WS_VISIBLE | WS_GROUP | WS_TABSTOP RADIOBUTTON "O jeden &ekran", IDC_RADIO_WHEEL_SCROLL_PAGE, 60, 65, 90, 10 EDITTEXT IDC_EDIT_WHEEL_SCROLL_LINES, 70, 45, 60, 15, ES_RIGHT | WS_VISIBLE | WS_GROUP | WS_TABSTOP @@ -151,28 +152,28 @@ BEGIN IDS_CPLDESCRIPTION_1 "Dostosowuje ustawienia myszy." IDS_CPLNAME_2 "Klawiatura" IDS_CPLDESCRIPTION_2 "Dostosowuje ustawienia klawiatury." - IDS_ARROW "Wybr normalny" - IDS_HELP "Wybr pomocy" + IDS_ARROW "Wybór normalny" + IDS_HELP "Wybór pomocy" IDS_APPSTARTING "Praca w tle" - IDS_WAIT "Zajty" - IDS_CROSSHAIR "Wybr precyzyjny" - IDS_IBEAM "Wybr tekstowy" - IDS_NWPEN "Pismo rczne" - IDS_NO "Niedostpny" + IDS_WAIT "Zajęty" + IDS_CROSSHAIR "Wybór precyzyjny" + IDS_IBEAM "Wybór tekstowy" + IDS_NWPEN "Pismo ręczne" + IDS_NO "Niedostępny" IDS_SIZENS "Zmiana wymiaru pionowego" IDS_SIZEWE "Zmiana wymiaru poziomego" - IDS_SIZENWSE "Zmiana wymiarw po przektnej 1" - IDS_SIZENESW "Zmiana wymiarw po przektnej 2" - IDS_SIZEALL "Przenie" - IDS_UPARROW "Alternatywny wybr" - IDS_HAND "Wybr cza" + IDS_SIZENWSE "Zmiana wymiarów po przekątnej 1" + IDS_SIZENESW "Zmiana wymiarów po przekątnej 2" + IDS_SIZEALL "Przenieś" + IDS_UPARROW "Alternatywny wybór" + IDS_HAND "Wybór łącza" IDS_NONE "(brak)" IDS_SYSTEM_SCHEME "(schemat systemu)" IDS_BROWSE_FILTER "Kursory (*.ani, *.cur)\0*.ani;*.cur\0Animowane kusory (*.ani)\0*.ani\0Kursory statyczne (*.cur)\0*.cur\0Wszystkie pliki\0*.*\0\0" - IDS_BROWSE_TITLE "Przegldaj" - IDS_REMOVE_TITLE "Potwierd usunicie schematu" - IDS_REMOVE_TEXT "Czy na pewno chcesz usun schemat kursorw '%s'?" - IDS_OVERWRITE_TITLE "Potwierd nadpisanie schematu kursorw" - IDS_OVERWRITE_TEXT "Wybrana nazwa schematu kursorw jest ju w uyciu. Czy chcesz nadpisa istniejcy schemat?" + IDS_BROWSE_TITLE "Przeglądaj" + IDS_REMOVE_TITLE "Potwierdź usunięcie schematu" + IDS_REMOVE_TEXT "Czy na pewno chcesz usunąć schemat kursorów '%s'?" + IDS_OVERWRITE_TITLE "Potwierdź nadpisanie schematu kursorów" + IDS_OVERWRITE_TEXT "Wybrana nazwa schematu kursorów jest już w użyciu. Czy chcesz nadpisać istniejący schemat?" IDS_ANIMATE_CURSOR "Kursor animowany" END diff --git a/dll/cpl/main/lang/ro-RO.rc b/dll/cpl/main/lang/ro-RO.rc index e6c05386f50..b18396d3000 100644 --- a/dll/cpl/main/lang/ro-RO.rc +++ b/dll/cpl/main/lang/ro-RO.rc @@ -1,7 +1,5 @@ LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL -#pragma code_page(65001) - IDD_KEYBSPEED DIALOGEX 0, 0, 246, 228 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION CAPTION "Viteză" @@ -172,5 +170,3 @@ BEGIN IDS_OVERWRITE_TEXT "Numele de schemă ales este deja în folosință. Vreți să suprascrieți schema actuală?" IDS_ANIMATE_CURSOR "Cursoare animate" END - -#pragma code_page(default) diff --git a/dll/cpl/main/lang/ru-RU.rc b/dll/cpl/main/lang/ru-RU.rc index 6cd6898c5c8..c9c4f6f2ca2 100644 --- a/dll/cpl/main/lang/ru-RU.rc +++ b/dll/cpl/main/lang/ru-RU.rc @@ -2,139 +2,139 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT IDD_KEYBSPEED DIALOGEX 0, 0, 246, 228 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Скорость" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ", -1, 5, 5, 236, 150 + GROUPBOX "Повтор вводимого символа", -1, 5, 5, 236, 150 ICON IDI_REPEAT_DELAY, IDC_ICON_REPEAT_DELAY, 15, 20, 15, 15 - LTEXT "& :", -1, 51, 20, 160, 10 - LTEXT "", -1, 50, 42, 35, 11 - LTEXT "", -1, 190, 42, 33, 10 + LTEXT "&Задержка перед началом повтора:", -1, 51, 20, 160, 10 + LTEXT "Длиннее", -1, 50, 42, 35, 11 + LTEXT "Короче", -1, 190, 42, 33, 10 CONTROL "",IDC_SLIDER_REPEAT_DELAY, "msctls_trackbar32", TBS_AUTOTICKS | WS_TABSTOP, 84, 35, 102, 17 ICON IDI_REPEAT_RATE, IDC_ICON_REPEAT_RATE, 15, 70, 15, 15 - LTEXT "& :", -1, 51, 70, 100, 10 - LTEXT "", -1, 60, 91, 22, 10 - LTEXT "", -1, 191, 91, 22, 10 + LTEXT "&Скорость повтора:", -1, 51, 70, 100, 10 + LTEXT "Ниже", -1, 60, 91, 22, 10 + LTEXT "Выше", -1, 191, 91, 22, 10 CONTROL "",IDC_SLIDER_REPEAT_RATE, "msctls_trackbar32", TBS_AUTOTICKS | WS_TABSTOP, 84, 85, 102, 17 - LTEXT "& , , :", -1, 15, 105, 216, 22 + LTEXT "&Чтобы проверить скорость повтора, поместите курсор в поле, нажмите любую клавишу и не отпускайте ее:", -1, 15, 105, 216, 22 EDITTEXT IDC_EDIT_REPEAT_RATE, 15, 130, 213, 15, WS_CHILD | WS_VISIBLE | WS_GROUP - GROUPBOX " ", -1, 5, 160, 236, 50 + GROUPBOX "Частота мерцания курсора", -1, 5, 160, 236, 50 LTEXT "", IDC_TEXT_CURSOR_BLINK, 23, 180, 1, 8 - LTEXT "", -1, 45, 180, 30, 10 - LTEXT "", -1, 205, 180, 30, 10 + LTEXT "Ниже", -1, 45, 180, 30, 10 + LTEXT "Выше", -1, 205, 180, 30, 10 CONTROL "",IDC_SLIDER_CURSOR_BLINK, "msctls_trackbar32", TBS_AUTOTICKS | WS_TABSTOP, 70, 180, 130, 17 END IDD_HARDWARE DIALOGEX 0, 0, 246, 228 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Оборудование" FONT 8, "MS Shell Dlg" BEGIN END IDD_CLICK_LOCK DIALOGEX 0, 0, 234, 100 STYLE DS_SHELLFONT | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Залипание клавиш" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "", -1, 60, 50, 30, 10 - LTEXT "", -1, 165, 50, 30, 10 + LTEXT "Короче", -1, 60, 50, 30, 10 + LTEXT "Дольше", -1, 165, 50, 30, 10 CONTROL "",IDC_SLIDER_CLICK_LOCK, "msctls_trackbar32", TBS_AUTOTICKS | WS_TABSTOP, 90, 50, 70, 17 PUSHBUTTON "&OK", IDOK, 120, 79, 50, 15 - PUSHBUTTON "&", IDCANCEL, 177, 79, 50, 15 - LTEXT "&, , .",-1,60,15,170,30 + PUSHBUTTON "&Отмена", IDCANCEL, 177, 79, 50, 15 + LTEXT "&Выберите, как долго следует удерживать нажатой кнопку мыши или трекбола для того, чтобы сработало залипание.",-1,60,15,170,30 ICON IDI_LOOK_KEY, IDC_ICON_CLICK_LOCK, 15, 15, 15, 15 END IDD_PAGE_BUTTON DIALOGEX 0, 0, 246, 228 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION " " +CAPTION "Кнопки мыши" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ", -1, 5, 5, 236, 70 - CHECKBOX "& ", IDC_SWAP_MOUSE_BUTTONS, 14, 17, 140, 10 + GROUPBOX "Конфигурация кнопок", -1, 5, 5, 236, 70 + CHECKBOX "&Обменять назначение кнопок", IDC_SWAP_MOUSE_BUTTONS, 14, 17, 140, 10 CONTROL "", IDC_IMAGE_SWAP_MOUSE, "Static", SS_ICON | SS_CENTERIMAGE | WS_VISIBLE, 176, 16, 58, 51, WS_EX_STATICEDGE - LTEXT " , . , .", -1, 12, 30, 150, 38 - GROUPBOX " ", -1, 5, 79, 236, 70 - LTEXT " . , .", -1, 12, 89, 160, 35 - LTEXT "&: ", -1, 12, 124, 61, 10 - LTEXT "", -1, 146, 124, 24, 10 + LTEXT "Назначает правую кнопку для выполнения таких основных функций, как выбор и перетаскивание. Часто используется теми, кто работает мышью левой рукой.", -1, 12, 30, 150, 38 + GROUPBOX "Скорость выполнения двойного щелчка", -1, 5, 79, 236, 70 + LTEXT "Сделайте двойной щелчок по этому значку. Если папка не открывается или не закрывается, выберите более низкую скорость.", -1, 12, 89, 160, 35 + LTEXT "&Скорость: Ниже", -1, 12, 124, 61, 10 + LTEXT "Выше", -1, 146, 124, 24, 10 CONTROL "",IDC_SLIDER_DOUBLE_CLICK_SPEED, "msctls_trackbar32", TBS_AUTOTICKS | WS_TABSTOP, 71, 125, 70, 17 CONTROL "", IDC_IMAGE_DOUBLE_CLICK_SPEED, "Static", SS_ICON | SS_NOTIFY | SS_CENTERIMAGE | WS_VISIBLE, 176, 90, 58, 51, WS_EX_STATICEDGE - GROUPBOX " ", -1, 5, 153, 236, 70 - CHECKBOX "& ", IDC_CHECK_CLICK_LOCK, 14, 164, 99, 17 - PUSHBUTTON "&...", IDC_BUTTON_CLICK_LOCK, 173, 165, 55, 14 - LTEXT " . . .", -1, 12, 183, 222, 36 + GROUPBOX "Залипание кнопки мыши", -1, 5, 153, 236, 70 + CHECKBOX "&Включить залипание", IDC_CHECK_CLICK_LOCK, 14, 164, 99, 17 + PUSHBUTTON "&Параметры...", IDC_BUTTON_CLICK_LOCK, 173, 165, 55, 14 + LTEXT "Позволяет выполнять выделение и перетаскивание без удерживания кнопки нажатой. Для включения ненадолго задержите кнопку мыши в нажатом положении. Для освобождения снова сделайте щелчок.", -1, 12, 183, 222, 36 END IDD_PAGE_POINTER DIALOGEX 0, 0, 246, 228 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION "" +CAPTION "Указатели" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "", -1, 5, 5, 183, 45 + GROUPBOX "Схема", -1, 5, 5, 183, 45 COMBOBOX IDC_COMBO_CURSOR_SCHEME, 10, 15, 172, 200, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON " &...", IDC_BUTTON_SAVEAS_SCHEME, 58, 30, 70, 14 - PUSHBUTTON "&", IDC_BUTTON_DELETE_SCHEME, 132, 30, 50, 14 + PUSHBUTTON "Сохранить &как...", IDC_BUTTON_SAVEAS_SCHEME, 58, 30, 70, 14 + PUSHBUTTON "&Удалить", IDC_BUTTON_DELETE_SCHEME, 132, 30, 50, 14 CONTROL "", IDC_IMAGE_CURRENT_CURSOR, "Static", SS_ICON | SS_CENTERIMAGE | WS_VISIBLE, 195, 9, 45, 41, WS_EX_STATICEDGE - LTEXT "&", -1, 5, 60, 40, 10 + LTEXT "&Настройка", -1, 5, 60, 40, 10 LISTBOX IDC_LISTBOX_CURSOR, 5, 70, 235, 125, WS_VISIBLE | WS_BORDER | WS_TABSTOP | WS_VSCROLL | LBS_OWNERDRAWFIXED | LBS_NOTIFY - CHECKBOX " & ", IDC_CHECK_CURSOR_SHADOW, 5, 203, 108, 10 - PUSHBUTTON "& ", IDC_BUTTON_USE_DEFAULT_CURSOR, 116, 200, 64, 14 - PUSHBUTTON "&", IDC_BUTTON_BROWSE_CURSOR, 185, 200, 55, 14 + CHECKBOX "Включить &тень указателя", IDC_CHECK_CURSOR_SHADOW, 5, 203, 108, 10 + PUSHBUTTON "&По умолчанию", IDC_BUTTON_USE_DEFAULT_CURSOR, 116, 200, 64, 14 + PUSHBUTTON "&Обзор", IDC_BUTTON_BROWSE_CURSOR, 185, 200, 55, 14 END IDD_CURSOR_SCHEME_SAVEAS DIALOGEX 0, 0, 200, 65 STYLE DS_SHELLFONT | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Сохранение схемы" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " :", -1, 5, 5, 190, 10 + LTEXT "Название сохраняемой схемы указателей мыши:", -1, 5, 5, 190, 10 EDITTEXT IDC_EDIT_SCHEME_NAME, 5, 18, 190, 15, WS_CHILD | WS_VISIBLE | WS_GROUP PUSHBUTTON "&OK", IDOK, 90, 45, 50, 15 - PUSHBUTTON "&", IDCANCEL, 145, 45, 50, 15 + PUSHBUTTON "&Отмена", IDCANCEL, 145, 45, 50, 15 END IDD_PAGE_OPTION DIALOGEX 0, 0, 246, 228 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION " " +CAPTION "Параметры указателя" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "", -1, 5, 5, 236, 60 - LTEXT "& :", -1, 60, 15, 150, 10 - LTEXT "", -1, 60, 30, 20, 10 + GROUPBOX "Перемещение", -1, 5, 5, 236, 60 + LTEXT "&Задайте скорость движение указателя:", -1, 60, 15, 150, 10 + LTEXT "Ниже", -1, 60, 30, 20, 10 CONTROL "",IDC_SLIDER_MOUSE_SPEED, "msctls_trackbar32", TBS_AUTOTICKS | WS_TABSTOP, 90, 30, 70, 17 - LTEXT "", -1, 170, 30, 20, 10 + LTEXT "Выше", -1, 170, 30, 20, 10 ICON IDI_MOUSE_SPEED, IDC_ICON_MOUSE_SPEED, 15, 18, 15, 15 - CHECKBOX "& ", IDC_CHECK_POINTER_PRECISION, 20, 50, 205, 10 - GROUPBOX " ", -1, 5, 71, 236, 42 - CHECKBOX "& , ", + CHECKBOX "&Включить повышенную точность установки указателя", IDC_CHECK_POINTER_PRECISION, 20, 50, 205, 10 + GROUPBOX "Исходное положение в диалоговом окне", -1, 5, 71, 236, 42 + CHECKBOX "&На кнопке, выбираемой по умолчанию", IDC_CHECK_SNAP_TO, 44, 88, 170, 20, BS_MULTILINE | BS_TOP ICON IDI_MOUSE_BUTTON, IDC_ICON_SNAP_TO, 15, 83, 15, 15 - GROUPBOX "", -1, 5, 118, 236, 104 - CHECKBOX "& ", IDC_CHECK_POINTER_TRAIL, 44, 135, 135, 10 - LTEXT "", IDC_TEXT_TRAIL_SHORT, 54, 149, 30, 10 - LTEXT "", IDC_TEXT_TRAIL_LONG, 160, 149, 30, 10 + GROUPBOX "Видимость", -1, 5, 118, 236, 104 + CHECKBOX "&Отображать след указателя мыши", IDC_CHECK_POINTER_TRAIL, 44, 135, 135, 10 + LTEXT "Короче", IDC_TEXT_TRAIL_SHORT, 54, 149, 30, 10 + LTEXT "Длиннее", IDC_TEXT_TRAIL_LONG, 160, 149, 30, 10 ICON IDI_MOUSE_TRAILS, IDC_ICON_POINTER_TRAIL, 15, 134, 15, 15 CONTROL "", IDC_SLIDER_POINTER_TRAIL ,"msctls_trackbar32", TBS_AUTOTICKS | WS_TABSTOP, 82, 146, 70, 17 - CHECKBOX "& ", IDC_CHECK_HIDE_POINTER, 44, 164, 190, 20 + CHECKBOX "&Скрывать указатель во время ввода с клавиатуры", IDC_CHECK_HIDE_POINTER, 44, 164, 190, 20 ICON IDI_MOUSE_SPEED, IDC_ICON_HIDE_POINTER, 15, 167, 15, 15 - CHECKBOX " & CTRL", + CHECKBOX "Обозначать поло&жение указателя при нажатии CTRL", IDC_CHECK_SHOW_POINTER, 44, 197, 186, 20, BS_MULTILINE | BS_TOP ICON IDI_MOUSE_POINTER, IDC_ICON_SHOW_POINTER, 15, 194, 15, 15 END IDD_PAGE_WHEEL DIALOGEX 0, 0, 246, 228 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION "" +CAPTION "Колесико" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "", -1, 5, 5, 236, 80 + GROUPBOX "Прокрутка", -1, 5, 5, 236, 80 ICON IDI_MOUSE_WHEEL, IDC_ICON_WHEEL, 20, 28, 32, 32 - LTEXT " :", -1, 20, 17, 212, 10 - RADIOBUTTON " &:", IDC_RADIO_WHEEL_SCROLL_LINES, 60, 30, 150, 10, WS_VISIBLE | WS_GROUP | WS_TABSTOP - RADIOBUTTON " &", IDC_RADIO_WHEEL_SCROLL_PAGE, 60, 65, 90, 10 + LTEXT "Поворот колесика на один щелчок служит для прокрутки:", -1, 20, 17, 212, 10 + RADIOBUTTON "на указанное количество &строк:", IDC_RADIO_WHEEL_SCROLL_LINES, 60, 30, 150, 10, WS_VISIBLE | WS_GROUP | WS_TABSTOP + RADIOBUTTON "на один &экран", IDC_RADIO_WHEEL_SCROLL_PAGE, 60, 65, 90, 10 EDITTEXT IDC_EDIT_WHEEL_SCROLL_LINES, 70, 45, 56, 12, ES_RIGHT | WS_VISIBLE | WS_GROUP | WS_TABSTOP CONTROL "", IDC_UPDOWN_WHEEL_SCROLL_LINES, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER, 125, 45, 12, 12 END @@ -142,32 +142,32 @@ END STRINGTABLE BEGIN - IDS_CPLNAME_1 "" - IDS_CPLDESCRIPTION_1 " ." - IDS_CPLNAME_2 "" - IDS_CPLDESCRIPTION_2 " ." - IDS_ARROW " " - IDS_HELP " " - IDS_APPSTARTING " " - IDS_WAIT " " - IDS_CROSSHAIR " " - IDS_IBEAM " " - IDS_NWPEN " " - IDS_NO " " - IDS_SIZENS " " - IDS_SIZEWE " " - IDS_SIZENWSE " 1" - IDS_SIZENESW " 2" - IDS_SIZEALL "" - IDS_UPARROW " " - IDS_HAND " " - IDS_NONE "()" - IDS_SYSTEM_SCHEME "( )" - IDS_BROWSE_FILTER " (*.ani, *.cur)\0*.ani;*.cur\0 (*.ani)\0*.ani\0 (*.cur)\0*.cur\0 \0*.*\0\0" - IDS_BROWSE_TITLE "" - IDS_REMOVE_TITLE " " - IDS_REMOVE_TEXT " '%s'?" - IDS_OVERWRITE_TITLE " " - IDS_OVERWRITE_TEXT " . ?" - IDS_ANIMATE_CURSOR " " + IDS_CPLNAME_1 "Мышь" + IDS_CPLDESCRIPTION_1 "Изменение настроек мыши." + IDS_CPLNAME_2 "Клавиатура" + IDS_CPLDESCRIPTION_2 "Изменение настроек клавиатуры." + IDS_ARROW "Основной режим" + IDS_HELP "Выбор справки" + IDS_APPSTARTING "Фоновой режим" + IDS_WAIT "Система недоступна" + IDS_CROSSHAIR "Графическое выделение" + IDS_IBEAM "Выделение текста" + IDS_NWPEN "Рукописный ввод" + IDS_NO "Операция невозможна" + IDS_SIZENS "Изменение вертикальных размеров" + IDS_SIZEWE "Изменение горизонтальных размеров" + IDS_SIZENWSE "Изменение размеров по диагонали 1" + IDS_SIZENESW "Изменение размеров по диагонали 2" + IDS_SIZEALL "Перемещение" + IDS_UPARROW "Специальное выделение" + IDS_HAND "Выбор ссылки" + IDS_NONE "(нет)" + IDS_SYSTEM_SCHEME "(системная схема)" + IDS_BROWSE_FILTER "Курсоры (*.ani, *.cur)\0*.ani;*.cur\0Анимированные курсоры (*.ani)\0*.ani\0Обычные курсоры (*.cur)\0*.cur\0Все файлы\0*.*\0\0" + IDS_BROWSE_TITLE "Обзор" + IDS_REMOVE_TITLE "Подтверждение удаления схемы" + IDS_REMOVE_TEXT "Вы действительно хотите удалить схему курсоров '%s'?" + IDS_OVERWRITE_TITLE "Подтверждение замены схемы" + IDS_OVERWRITE_TEXT "Выбранное имя схемы курсоров уже занято. Заменить существующую схему?" + IDS_ANIMATE_CURSOR "Анимированный курсор" END diff --git a/dll/cpl/main/lang/uk-UA.rc b/dll/cpl/main/lang/uk-UA.rc index 3caeae1e55c..79df2db7fc9 100644 --- a/dll/cpl/main/lang/uk-UA.rc +++ b/dll/cpl/main/lang/uk-UA.rc @@ -10,171 +10,171 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT IDD_KEYBSPEED DIALOGEX 0, 0, 246, 228 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Швидкість" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " , ", -1, 5, 5, 230, 130 + GROUPBOX "Повтор символу, що вводиться", -1, 5, 5, 230, 130 ICON IDI_REPEAT_DELAY, IDC_ICON_REPEAT_DELAY, 15, 15, 15, 15 - LTEXT "& ", -1, 40, 15, 170, 10 - LTEXT "", -1, 40, 30, 23, 10 - LTEXT "", -1, 200, 30, 29, 10 + LTEXT "&Затримка перед початком повтору символу", -1, 40, 15, 170, 10 + LTEXT "Довше", -1, 40, 30, 23, 10 + LTEXT "Коротше", -1, 200, 30, 29, 10 CONTROL "",IDC_SLIDER_REPEAT_DELAY, "msctls_trackbar32", TBS_AUTOTICKS | WS_TABSTOP, 65, 30, 130, 17 ICON IDI_REPEAT_RATE, IDC_ICON_REPEAT_RATE, 15, 70, 15, 15 - LTEXT "& ", -1, 40, 70, 80, 10 - LTEXT "", -1, 40, 85, 22, 10 - LTEXT "", -1, 200, 85, 20, 10 + LTEXT "&Швидкість повтору", -1, 40, 70, 80, 10 + LTEXT "Нижче", -1, 40, 85, 22, 10 + LTEXT "Вище", -1, 200, 85, 20, 10 CONTROL "",IDC_SLIDER_REPEAT_RATE, "msctls_trackbar32", TBS_AUTOTICKS | WS_TABSTOP, 65, 85, 130, 17 - LTEXT " & :", -1, 15, 105, 150, 10 + LTEXT "Затисніть клавішу в полі для &перевірки швидкості повтору:", -1, 15, 105, 150, 10 EDITTEXT IDC_EDIT_REPEAT_RATE, 15, 115, 200, 15, WS_CHILD | WS_VISIBLE | WS_GROUP - GROUPBOX " & :", -1, 5, 145, 230, 50 + GROUPBOX "Частота м&ерехтіння курсора:", -1, 5, 145, 230, 50 LTEXT "", IDC_TEXT_CURSOR_BLINK, 20, 165, 1, 8 - LTEXT "", -1, 40, 165, 30, 10 - LTEXT "", -1, 200, 165, 30, 10 + LTEXT "Немає", -1, 40, 165, 30, 10 + LTEXT "Швидко", -1, 200, 165, 30, 10 CONTROL "",IDC_SLIDER_CURSOR_BLINK, "msctls_trackbar32", TBS_AUTOTICKS | WS_TABSTOP, 65, 165, 130, 17 END IDD_HARDWARE DIALOGEX 0, 0, 246, 228 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Обладнання" FONT 8, "MS Shell Dlg" BEGIN END IDD_CLICK_LOCK DIALOGEX 0, 0, 246, 100 STYLE DS_SHELLFONT | WS_CAPTION | WS_SYSMENU -CAPTION "" +CAPTION "Залипання" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "", -1, 35, 50, 30, 10 - LTEXT "", -1, 140, 50, 30, 10 + LTEXT "Коротше", -1, 35, 50, 30, 10 + LTEXT "Довше", -1, 140, 50, 30, 10 CONTROL "",IDC_SLIDER_CLICK_LOCK, "msctls_trackbar32", TBS_AUTOTICKS | WS_TABSTOP, 65, 50, 70, 17 PUSHBUTTON "&OK", IDOK, 120, 75, 50, 15 - PUSHBUTTON "&", IDCANCEL, 175, 75, 50, 15 - LTEXT "&, ",-1,60,15,170,30 + PUSHBUTTON "&Скасувати", IDCANCEL, 175, 75, 50, 15 + LTEXT "&Виберіть, як довго слід утримувати натиснуту кнопку миші або трекбола перед спрацьовуванням залипання",-1,60,15,170,30 ICON IDI_LOOK_KEY, IDC_ICON_CLICK_LOCK, 15, 15, 15, 15 END IDD_PAGE_BUTTON DIALOGEX 0, 0, 246, 228 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION " " +CAPTION "Кнопки миші" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ", -1, 5, 5, 230, 70 - CHECKBOX "& ", IDC_SWAP_MOUSE_BUTTONS, 10, 15, 140, 10 + GROUPBOX "Конфігурація кнопок", -1, 5, 5, 230, 70 + CHECKBOX "О&бміняти призначення кнопок", IDC_SWAP_MOUSE_BUTTONS, 10, 15, 140, 10 CONTROL "", IDC_IMAGE_SWAP_MOUSE, "Static", SS_ICON | SS_CENTERIMAGE | WS_VISIBLE, 165, 15, 65, 57, WS_EX_STATICEDGE - LTEXT " , , ", -1, 10, 30, 150, 30 - GROUPBOX " ", -1, 5, 75, 230, 70 - LTEXT " . , .", -1, 10, 85, 150, 30 - LTEXT "&: ", -1, 10, 120, 90, 8 - LTEXT "", -1, 142, 120, 30, 8 + LTEXT "Встановіть цей прапорець, щоб призначити праву кнопку для виконання таких основних функцій, як вибір і перетягування", -1, 10, 30, 150, 30 + GROUPBOX "Швидкість подвійного клацання", -1, 5, 75, 230, 70 + LTEXT "Двічі клацніть по цій теці. Якщо тека не відкривається або не закривається, виберіть меншу швидкість.", -1, 10, 85, 150, 30 + LTEXT "&Швидкість: Нижче", -1, 10, 120, 90, 8 + LTEXT "Вище", -1, 142, 120, 30, 8 CONTROL "",IDC_SLIDER_DOUBLE_CLICK_SPEED, "msctls_trackbar32", TBS_AUTOTICKS | WS_TABSTOP, 72, 120, 70, 17 CONTROL "", IDC_IMAGE_DOUBLE_CLICK_SPEED, "Static", SS_ICON | SS_NOTIFY | SS_CENTERIMAGE | WS_VISIBLE, 165, 85, 65, 57, WS_EX_STATICEDGE - GROUPBOX " ", -1, 5, 150, 230, 70 - CHECKBOX "& ", IDC_CHECK_CLICK_LOCK, 10, 160, 87, 35 - PUSHBUTTON "&...", IDC_BUTTON_CLICK_LOCK, 170, 160, 50, 10 - LTEXT " , . , . , .", -1, 10, 180, 190, 33 + GROUPBOX "Залипання кнопки миші", -1, 5, 150, 230, 70 + CHECKBOX "&Увімкнути залипання", IDC_CHECK_CLICK_LOCK, 10, 160, 87, 35 + PUSHBUTTON "&Параметри...", IDC_BUTTON_CLICK_LOCK, 170, 160, 50, 10 + LTEXT "Дозволяє виконувати виділення й перетягування, не утримуючи кнопку миші натиснутою. Щоб увімкнути цей режим, ненадовго натисніть кнопку миші. Щоб вимкнути цей режим, натисніть кнопку миші ще раз.", -1, 10, 180, 190, 33 END IDD_PAGE_POINTER DIALOGEX 0, 0, 246, 228 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION "" +CAPTION "Вказівники" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "", -1, 5, 5, 170, 45 + GROUPBOX "Схема", -1, 5, 5, 170, 45 COMBOBOX IDC_COMBO_CURSOR_SCHEME, 10, 15, 145, 200, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON " &...", IDC_BUTTON_SAVEAS_SCHEME, 70, 30, 50, 15 - PUSHBUTTON "&", IDC_BUTTON_DELETE_SCHEME, 125, 30, 40, 15 + PUSHBUTTON "Зберегти &як...", IDC_BUTTON_SAVEAS_SCHEME, 70, 30, 50, 15 + PUSHBUTTON "В&идалити", IDC_BUTTON_DELETE_SCHEME, 125, 30, 40, 15 CONTROL "", IDC_IMAGE_CURRENT_CURSOR, "Static", SS_ICON | SS_CENTERIMAGE | WS_VISIBLE, 190, 9, 45, 41, WS_EX_STATICEDGE - LTEXT "&", -1, 5, 60, 40, 10 + LTEXT "&Настройка", -1, 5, 60, 40, 10 LISTBOX IDC_LISTBOX_CURSOR, 5, 70, 230, 120, WS_VISIBLE | WS_BORDER | WS_TABSTOP | WS_VSCROLL | LBS_OWNERDRAWFIXED | LBS_NOTIFY - CHECKBOX " & ", IDC_CHECK_CURSOR_SHADOW, 5, 200, 100, 10 - PUSHBUTTON "&", IDC_BUTTON_USE_DEFAULT_CURSOR, 120, 200, 50, 15 - PUSHBUTTON "&", IDC_BUTTON_BROWSE_CURSOR, 175, 200, 50, 15 + CHECKBOX "Увімкнути &тінь вказівника", IDC_CHECK_CURSOR_SHADOW, 5, 200, 100, 10 + PUSHBUTTON "&Стандартно", IDC_BUTTON_USE_DEFAULT_CURSOR, 120, 200, 50, 15 + PUSHBUTTON "&Огляд", IDC_BUTTON_BROWSE_CURSOR, 175, 200, 50, 15 END IDD_CURSOR_SCHEME_SAVEAS DIALOGEX 0, 0, 200, 75 STYLE DS_SHELLFONT | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Збереження схеми" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " :", -1, 5, 5, 100, 10 + LTEXT "Назва схеми вказівників миші:", -1, 5, 5, 100, 10 EDITTEXT IDC_EDIT_SCHEME_NAME, 5, 15, 180, 15, WS_CHILD | WS_VISIBLE | WS_GROUP PUSHBUTTON "&OK", IDOK, 60, 45, 50, 15 - PUSHBUTTON "&", IDCANCEL, 115, 45, 50, 15 + PUSHBUTTON "&Скасувати", IDCANCEL, 115, 45, 50, 15 END IDD_PAGE_OPTION DIALOGEX 0, 0, 246, 228 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION " " +CAPTION "Параметри вказівника" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "", -1, 5, 5, 230, 60 - LTEXT "& :", -1, 60, 15, 150, 10 - LTEXT "", -1, 60, 30, 23, 10 + GROUPBOX "Переміщення", -1, 5, 5, 230, 60 + LTEXT "&Виберіть швидкість руху вказівника:", -1, 60, 15, 150, 10 + LTEXT "Нижче", -1, 60, 30, 23, 10 CONTROL "",IDC_SLIDER_MOUSE_SPEED, "msctls_trackbar32", TBS_AUTOTICKS | WS_TABSTOP, 90, 30, 70, 17 - LTEXT "", -1, 170, 30, 20, 10 + LTEXT "Вище", -1, 170, 30, 20, 10 ICON IDI_MOUSE_SPEED, IDC_ICON_MOUSE_SPEED, 15, 15, 15, 15 - CHECKBOX "&ϳ ", IDC_CHECK_POINTER_PRECISION, 60, 50, 118, 10 - GROUPBOX "' ", -1, 5, 65, 230, 40 - CHECKBOX ", & ", + CHECKBOX "&Підвищена точність вказівника", IDC_CHECK_POINTER_PRECISION, 60, 50, 118, 10 + GROUPBOX "Прив'язка до", -1, 5, 65, 230, 40 + CHECKBOX "Кнопки, що &вибирана за замовчуванням в діалоговому вікні", IDC_CHECK_SNAP_TO, 60, 75, 170, 20, BS_MULTILINE | BS_TOP ICON IDI_MOUSE_BUTTON, IDC_ICON_SNAP_TO, 15, 75, 15, 15 - GROUPBOX "", -1, 5, 105, 230, 95 - CHECKBOX "&³ ", IDC_CHECK_POINTER_TRAIL, 60, 115, 110, 10 - LTEXT "", IDC_TEXT_TRAIL_SHORT, 60, 130, 30, 10 - LTEXT "", IDC_TEXT_TRAIL_LONG, 160, 130, 30, 10 + GROUPBOX "Видимість", -1, 5, 105, 230, 95 + CHECKBOX "&Відображати слід вказівника", IDC_CHECK_POINTER_TRAIL, 60, 115, 110, 10 + LTEXT "Коротше", IDC_TEXT_TRAIL_SHORT, 60, 130, 30, 10 + LTEXT "Довше", IDC_TEXT_TRAIL_LONG, 160, 130, 30, 10 ICON IDI_MOUSE_TRAILS, IDC_ICON_POINTER_TRAIL, 15, 115, 15, 15 CONTROL "", IDC_SLIDER_POINTER_TRAIL ,"msctls_trackbar32", TBS_AUTOTICKS | WS_TABSTOP, 90, 130, 70, 17 - CHECKBOX "& ", IDC_CHECK_HIDE_POINTER, 60, 150, 90, 10 + CHECKBOX "П&риховувати вказівник під час введення з клавіатури", IDC_CHECK_HIDE_POINTER, 60, 150, 90, 10 ICON IDI_MOUSE_SPEED, IDC_ICON_HIDE_POINTER, 15, 145, 15, 15 - CHECKBOX " & CTRL", + CHECKBOX "Показувати ро&зташування вказівника при натисненні CTRL", IDC_CHECK_SHOW_POINTER, 60, 175, 170, 20, BS_MULTILINE | BS_TOP ICON IDI_MOUSE_POINTER, IDC_ICON_SHOW_POINTER, 15, 170, 15, 15 END IDD_PAGE_WHEEL DIALOGEX 0, 0, 246, 228 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION "" +CAPTION "Коліщатко" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "", -1, 5, 5, 230, 80 + GROUPBOX "Прокрутка", -1, 5, 5, 230, 80 ICON IDI_MOUSE_WHEEL, IDC_ICON_WHEEL, 20, 20, 32, 32 - LTEXT " ", -1, 60, 15, 150, 10 - RADIOBUTTON " &:", IDC_RADIO_WHEEL_SCROLL_LINES, 60, 30, 150, 10, WS_VISIBLE | WS_GROUP | WS_TABSTOP - RADIOBUTTON " &", IDC_RADIO_WHEEL_SCROLL_PAGE, 60, 65, 90, 10 + LTEXT "Поворот коліщатка на одне клацання прокручує", -1, 60, 15, 150, 10 + RADIOBUTTON "На вказану кількість &рядків:", IDC_RADIO_WHEEL_SCROLL_LINES, 60, 30, 150, 10, WS_VISIBLE | WS_GROUP | WS_TABSTOP + RADIOBUTTON "На один &екран", IDC_RADIO_WHEEL_SCROLL_PAGE, 60, 65, 90, 10 EDITTEXT IDC_EDIT_WHEEL_SCROLL_LINES, 70, 45, 60, 15, ES_RIGHT | WS_VISIBLE | WS_GROUP | WS_TABSTOP CONTROL "", IDC_UPDOWN_WHEEL_SCROLL_LINES, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | WS_BORDER, 125, 45, 12, 12 END STRINGTABLE BEGIN - IDS_CPLNAME_1 "" - IDS_CPLDESCRIPTION_1 " ." - IDS_CPLNAME_2 "" - IDS_CPLDESCRIPTION_2 " ." - IDS_ARROW " " - IDS_HELP " " - IDS_APPSTARTING " " - IDS_WAIT " " - IDS_CROSSHAIR " " - IDS_IBEAM " " - IDS_NWPEN " " - IDS_NO " " - IDS_SIZENS " " - IDS_SIZEWE " " - IDS_SIZENWSE " 1" - IDS_SIZENESW " 2" - IDS_SIZEALL "" - IDS_UPARROW " " - IDS_HAND " " - IDS_NONE "()" - IDS_SYSTEM_SCHEME "( )" - IDS_BROWSE_FILTER " (*.ani, *.cur)\0*.ani;*.cur\0 (*.ani)\0*.ani\0 (*.cur)\0*.cur\0 \0*.*\0\0" - IDS_BROWSE_TITLE "" - IDS_REMOVE_TITLE "ϳ " - IDS_REMOVE_TEXT " '%s' ?" - IDS_OVERWRITE_TITLE "ϳ " - IDS_OVERWRITE_TEXT " . ?" - IDS_ANIMATE_CURSOR " " + IDS_CPLNAME_1 "Миша" + IDS_CPLDESCRIPTION_1 "Змінює настройки миші." + IDS_CPLNAME_2 "Клавіатура" + IDS_CPLDESCRIPTION_2 "Змінює настройки клавіатури." + IDS_ARROW "Основний режим" + IDS_HELP "Вибір довідки" + IDS_APPSTARTING "Фоновий режим" + IDS_WAIT "Система зайнята" + IDS_CROSSHAIR "Графічне виділення" + IDS_IBEAM "Виділення тексту" + IDS_NWPEN "Рукописне введення" + IDS_NO "Операція неможлива" + IDS_SIZENS "Зміна вертикальних розмірів" + IDS_SIZEWE "Зміна горизонтальних розмірів" + IDS_SIZENWSE "Зміна розмірів по діагоналі 1" + IDS_SIZENESW "Зміна розмірів по діагоналі 2" + IDS_SIZEALL "Переміщення" + IDS_UPARROW "Спеціальне виділення" + IDS_HAND "Вибір посилання" + IDS_NONE "(немає)" + IDS_SYSTEM_SCHEME "(системна схема)" + IDS_BROWSE_FILTER "Вказівники (*.ani, *.cur)\0*.ani;*.cur\0Анімовані вказівники (*.ani)\0*.ani\0Звичайні вказівники (*.cur)\0*.cur\0Усі файли\0*.*\0\0" + IDS_BROWSE_TITLE "Огляд" + IDS_REMOVE_TITLE "Підтвердження видалення схеми" + IDS_REMOVE_TEXT "Ви дійсно бажаєте видалити схему '%s' із системи?" + IDS_OVERWRITE_TITLE "Підтвердження заміни схеми" + IDS_OVERWRITE_TEXT "Вибрана схема вказівників уже використовується. Замінити вихідну схему?" + IDS_ANIMATE_CURSOR "Анімований вказівник" END diff --git a/dll/cpl/main/main.c b/dll/cpl/main/main.c index 3c259fece9e..379ab8985ea 100644 --- a/dll/cpl/main/main.c +++ b/dll/cpl/main/main.c @@ -25,16 +25,8 @@ * UPDATE HISTORY: * 05-01-2004 Created */ -#include -#include -#include -#include -#include -#include #include "main.h" -#include "resource.h" - #define NUM_APPLETS (2) diff --git a/dll/cpl/main/main.h b/dll/cpl/main/main.h index 2c32c7e63b1..50f5206c766 100644 --- a/dll/cpl/main/main.h +++ b/dll/cpl/main/main.h @@ -1,4 +1,19 @@ -#pragma once +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "resource.h" typedef enum { diff --git a/dll/cpl/main/main.rbuild b/dll/cpl/main/main.rbuild index f0025d068cc..0b20db99427 100644 --- a/dll/cpl/main/main.rbuild +++ b/dll/cpl/main/main.rbuild @@ -14,4 +14,5 @@ main.c mouse.c main.rc + main.h diff --git a/dll/cpl/main/mouse.c b/dll/cpl/main/mouse.c index c208fb2a5d0..a015793add0 100644 --- a/dll/cpl/main/mouse.c +++ b/dll/cpl/main/mouse.c @@ -28,22 +28,7 @@ //TODO: // add missing icons -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - #include "main.h" -#include "resource.h" #define DEFAULT_DOUBLE_CLICK_SPEED 500 #define DEFAULT_CLICK_LOCK_TIME 2200 diff --git a/dll/cpl/main/rsrc.rc b/dll/cpl/main/rsrc.rc index 9284a15bcb1..fe768729384 100644 --- a/dll/cpl/main/rsrc.rc +++ b/dll/cpl/main/rsrc.rc @@ -14,9 +14,12 @@ #include "lang/ja-JP.rc" #include "lang/nl-NL.rc" #include "lang/no-NO.rc" +#include "lang/sk-SK.rc" +#include "lang/zh-CN.rc" + +// UTF-8 +#pragma code_page(65001) #include "lang/pl-PL.rc" #include "lang/ro-RO.rc" #include "lang/ru-RU.rc" -#include "lang/sk-SK.rc" #include "lang/uk-UA.rc" -#include "lang/zh-CN.rc" diff --git a/dll/cpl/mmsys/CMakeLists.txt b/dll/cpl/mmsys/CMakeLists.txt index f0078e88a03..62d6a5ec381 100644 --- a/dll/cpl/mmsys/CMakeLists.txt +++ b/dll/cpl/mmsys/CMakeLists.txt @@ -2,8 +2,6 @@ set_unicode() set_rc_compiler() -add_definitions(-D_DLL -D__USE_CRTIMP) - spec2def(mmsys.cpl mmsys.spec) add_library(mmsys SHARED @@ -31,4 +29,5 @@ add_importlibs(mmsys ntdll kernel32) +add_pch(mmsys mmsys.h) add_cd_file(TARGET mmsys DESTINATION reactos/system32 FOR all) diff --git a/dll/cpl/mmsys/audio.c b/dll/cpl/mmsys/audio.c index 129004987ba..775d94282e0 100644 --- a/dll/cpl/mmsys/audio.c +++ b/dll/cpl/mmsys/audio.c @@ -8,14 +8,7 @@ * Dmitry Chapyshev */ -#include -#include -#include -#include -#include #include "mmsys.h" -#include "resource.h" - VOID InitAudioDlg(HWND hwnd) diff --git a/dll/cpl/mmsys/lang/pl-PL.rc b/dll/cpl/mmsys/lang/pl-PL.rc index 1765b4a273c..f53fa32b75f 100644 --- a/dll/cpl/mmsys/lang/pl-PL.rc +++ b/dll/cpl/mmsys/lang/pl-PL.rc @@ -1,54 +1,57 @@ /* - * translated by Caemyr - Olaf Siejka (Jan-Feb, 2008) - * Use ReactOS forum PM or IRC to contact me - * http://www.reactos.org - * IRC: irc.freenode.net #reactos-pl; + * translated by Caemyr - Olaf Siejka (Jan-Feb, 2008) + * Use ReactOS forum PM or IRC to contact me + * http://www.reactos.org + * IRC: irc.freenode.net #reactos-pl; * - * IDS_CPLNAME and IDS_CPLDESCRIPTION translated by xrogers - * xxrogers@users.sourceforge.net - * https://sourceforge.net/projects/reactospl -*/ + * IDS_CPLNAME and IDS_CPLDESCRIPTION translated by xrogers + * xxrogers@users.sourceforge.net + * https://sourceforge.net/projects/reactospl + * UTF-8 conversion by Caemyr (May, 2011) + * updated by Saibamen - Adam Stachowicz (saibamenppl@gmail.com) (August, 2011) + */ + LANGUAGE LANG_POLISH, SUBLANG_DEFAULT IDD_VOLUME DIALOGEX 0, 0, 246, 228 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Gono" +CAPTION "Głośność" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_CPLICON, IDI_CPLICON, 8,5,32,32 LTEXT "",IDC_DEVICE_NAME,40,10,194,36 - GROUPBOX "Gono urzdzenia", -1, 7,30,230,100 + GROUPBOX "Głośność urządzenia", -1, 7,30,230,100 CONTROL "", IDC_MUTE_ICON, "Static", SS_ICON | WS_VISIBLE,17,45,32,32 CONTROL "",IDC_VOLUME_TRACKBAR, "msctls_trackbar32", TBS_AUTOTICKS | TBS_ENABLESELRANGE | TBS_BOTTOM | TBS_HORZ | WS_TABSTOP, 65, 45, 140, 14 - LTEXT "Maa",-1,62,66,30,17 - LTEXT "Dua",-1,195,66,30,17 + LTEXT "Mała",-1,62,66,30,17 + LTEXT "Duża",-1,195,66,30,17 CHECKBOX "&Wycisz", IDC_MUTE_CHECKBOX, 50, 78, 140, 10 - CHECKBOX "Umie &ikon gonoci w zasobniku systemowym", IDC_ICON_IN_TASKBAR, 50, 92, 140, 10 + CHECKBOX "Umieść &ikonę głośności w zasobniku systemowym", IDC_ICON_IN_TASKBAR, 50, 92, 140, 10 PUSHBUTTON "&Zaawansowane...", IDC_ADVANCED_BTN, 150,105,75,15 - GROUPBOX "Ustawienia gonikw", IDC_SPEAKER_SET_BTN, 7,140,230,80 + GROUPBOX "Ustawienia głośników", IDC_SPEAKER_SET_BTN, 7,140,230,80 CONTROL "", IDC_SPEAKIMG, "Static", SS_OWNERDRAW, 4, 160, 70, 70 - LTEXT "Uyj ustawie poniej aby zmieni indywidualny poziom gonoci i dostosowa ustawienia zaawansowane.",-1,70,155,150,36 - PUSHBUTTON "&Goniki...", IDC_SPEAKER_VOL_BTN, 70,195,75,15 + LTEXT "Użyj ustawień poniżej aby zmienić indywidualny poziom głośności i dostosować ustawienia zaawansowane.",-1,70,155,150,36 + PUSHBUTTON "&Głośniki...", IDC_SPEAKER_VOL_BTN, 70,195,75,15 PUSHBUTTON "Z&aawansowane...", IDC_ADVANCED2_BTN, 150,195,75,15 END IDD_SOUNDS DIALOGEX 0, 0, 246, 228 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Dwiki" +CAPTION "Dźwięki" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Schemat dwikowy to zestaw dwikw dla kadego ze zdarze systemowych w ReactOS i aplikacjach. Moesz wybra istniejcy ju schemat albo stworzy i zapisa wasny.",-1,8,7,230,40 - LTEXT "S&chemat dwikowy:",-1,8,42,150,17 + LTEXT "Schemat dźwiękowy to zestaw dźwięków dla każdego ze zdarzeń systemowych w ReactOS i aplikacjach. Możesz wybrać istniejący już schemat albo stworzyć i zapisać własny.",-1,8,7,230,40 + LTEXT "S&chemat dźwiękowy:",-1,8,42,150,17 COMBOBOX IDC_SOUND_SCHEME, 8, 53, 230, 46, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP PUSHBUTTON "Za&pisz jako...", IDC_SAVEAS_BTN, 134,70,50,15 PUSHBUTTON "S&kasuj", IDC_DELETE_BTN, 188,70,50,15 - LTEXT "Aby zmieni dwik, kliknij na zdarzenie z listy poniej a nastpnie wybierz dwik. Zmiany moesz zapisa w nowym lub obecnym schemacie dwikowym.",-1,8,90,230,40 + LTEXT "Aby zmienić dźwięk, kliknij na zdarzenie z listy poniżej a następnie wybierz dźwięk. Zmiany możesz zapisać w nowym lub obecnym schemacie dźwiękowym.",-1,8,90,230,40 LTEXT "&Zdarzenia:",-1,8,118,150,17 CONTROL "", IDC_SCHEME_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP, 8, 130, 230, 60, WS_EX_CLIENTEDGE - LTEXT "&Dwiki:", IDC_TEXT_SOUND,8,194,80,17, WS_DISABLED + LTEXT "&Dźwięki:", IDC_TEXT_SOUND,8,194,80,17, WS_DISABLED COMBOBOX IDC_SOUND_LIST, 8, 205, 155, 146, CBS_DROPDOWNLIST | CBS_DISABLENOSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP | WS_DISABLED PUSHBUTTON "", IDC_PLAY_SOUND, 168,205,15,15, WS_DISABLED | BS_ICON - PUSHBUTTON "&Przegldaj...", IDC_BROWSE_SOUND, 188,205,50,15, WS_DISABLED + PUSHBUTTON "&Przeglądaj...", IDC_BROWSE_SOUND, 188,205,50,15, WS_DISABLED END IDD_AUDIO DIALOGEX 0, 0, 246, 228 @@ -56,51 +59,51 @@ STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION CAPTION "Audio" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "Odtwarzanie dwiku", -1, 7,7,230,60 + GROUPBOX "Odtwarzanie dźwięku", -1, 7,7,230,60 ICON IDI_CPLICON, IDI_CPLICON, 15,20,32,32 - LTEXT "Urzdzen&ie domylne:",-1,50,20,80,17 + LTEXT "Urządzen&ie domyślne:",-1,50,20,80,17 COMBOBOX IDC_DEVICE_PLAY_LIST, 50, 30, 180, 46, CBS_DROPDOWNLIST - PUSHBUTTON "&Gono...", IDC_VOLUME1_BTN, 85,47,70,15 + PUSHBUTTON "&Głośność...", IDC_VOLUME1_BTN, 85,47,70,15 PUSHBUTTON "Zaa&wansowane", IDC_ADV2_BTN, 160,47,70,15 - GROUPBOX "Nagrywanie dwiku", -1, 7,75,230,60 + GROUPBOX "Nagrywanie dźwięku", -1, 7,75,230,60 ICON IDI_MICROPHONE_ICON, IDI_MICROPHONE_ICON, 15,88,32,32 - LTEXT "U&rzdzenie domylne:",-1,50,88,80,17 + LTEXT "U&rządzenie domyślne:",-1,50,88,80,17 COMBOBOX IDC_DEVICE_REC_LIST, 50, 98, 180, 46, CBS_DROPDOWNLIST - PUSHBUTTON "G&ono....", IDC_VOLUME2_BTN, 85,115,70,15 + PUSHBUTTON "Gł&ośność....", IDC_VOLUME2_BTN, 85,115,70,15 PUSHBUTTON "Zaawan&sowane", IDC_ADV1_BTN, 160,115,70,15 GROUPBOX "Odtwarzanie MIDI", -1, 7,145,230,60 ICON IDI_MIDICON, IDI_MIDICON, 15,158,32,32 - LTEXT "Urz&dzenie domylne:",-1,50,158,80,17 + LTEXT "Urzą&dzenie domyślne:",-1,50,158,80,17 COMBOBOX IDC_DEVICE_MIDI_LIST, 50, 168, 180, 46, CBS_DROPDOWNLIST - PUSHBUTTON "Go&no....", IDC_VOLUME3_BTN, 85,185,70,15 + PUSHBUTTON "Głoś&ność....", IDC_VOLUME3_BTN, 85,185,70,15 PUSHBUTTON "In&formacje", IDC_ADV3_BTN, 160,185,70,15 - CHECKBOX "&Uyj wycznie urzdze domylnych", IDC_DEFAULT_DEV_CHECKBOX, 7, 212, 140, 10 + CHECKBOX "&Użyj wyłącznie urządzeń domyślnych", IDC_DEFAULT_DEV_CHECKBOX, 7, 212, 140, 10 END IDD_VOICE DIALOGEX 0, 0, 246, 228 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Gos" +CAPTION "Głos" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Te ustawienia reguluj gono i zaawansowan konfiguracj dla odwtarzania i nagrywania gosu za pomoc wybranych urzdze.",-1,8,7,230,40 - GROUPBOX "Odtwarzanie gosu", -1, 7,37,230,60 + LTEXT "Te ustawienia regulują głośność i zaawansowaną konfigurację dla odwtarzania i nagrywania głosu za pomocą wybranych urządzeń.",-1,8,7,230,40 + GROUPBOX "Odtwarzanie głosu", -1, 7,37,230,60 ICON IDI_CPLICON, IDI_CPLICON, 15,50,32,32 - LTEXT "&Urzdzenie domylne:",-1,50,50,80,17 + LTEXT "&Urządzenie domyślne:",-1,50,50,80,17 COMBOBOX IDC_DEVICE_VOICE_LIST, 50, 60, 180, 46, CBS_DROPDOWNLIST - PUSHBUTTON "&Gono....", IDC_VOLUME4_BTN, 85,77,70,15 + PUSHBUTTON "&Głośność....", IDC_VOLUME4_BTN, 85,77,70,15 PUSHBUTTON "&Zaawansowane", IDC_ADV4_BTN, 160,77,70,15 - GROUPBOX "Nagrywanie gosu", -1, 7,105,230,60 + GROUPBOX "Nagrywanie głosu", -1, 7,105,230,60 ICON IDI_MICROPHONE_ICON, IDI_MICROPHONE_ICON, 15,118,32,32 - LTEXT "U&rzdzenie domylne:",-1,50,118,80,17 + LTEXT "U&rządzenie domyślne:",-1,50,118,80,17 COMBOBOX IDC_DEVICE_VOICE_REC_LIST, 50, 128, 180, 46, CBS_DROPDOWNLIST - PUSHBUTTON "G&ono....", IDC_VOLUME5_BTN, 85,145,70,15 + PUSHBUTTON "Gł&ośność....", IDC_VOLUME5_BTN, 85,145,70,15 PUSHBUTTON "Zaa&wansowane", IDC_ADV5_BTN, 160,145,70,15 - PUSHBUTTON "&Test sprztu", IDC_TEST_HARDWARE, 160,175,70,15 + PUSHBUTTON "&Test sprzętu", IDC_TEST_HARDWARE, 160,175,70,15 END IDD_HARDWARE DIALOGEX 0, 0, 246, 228 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Sprzt" +CAPTION "Sprzęt" FONT 8, "MS Shell Dlg" BEGIN @@ -111,7 +114,7 @@ STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUPWINDOW | WS_VISIBL CAPTION "Zapisz schemat jako..." FONT 8, "MS Shell Dlg" BEGIN - LTEXT "&Zapisz biecy schemat dzwikowy jako:", -1, 7, 7, 212, 9 + LTEXT "&Zapisz bieżący schemat dźwiękowy jako:", -1, 7, 7, 212, 9 EDITTEXT 8960, 7, 17, 211, 14, ES_AUTOHSCROLL DEFPUSHBUTTON "OK", IDOK, 93, 36, 60, 14 PUSHBUTTON "Anuluj", IDCANCEL, 157, 36, 60, 14 @@ -119,56 +122,56 @@ END IDD_SPEAKERS DIALOG 0, 0, 257, 204 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Goniki" +CAPTION "Głośniki" FONT 8, "MS Shell Dlg" BEGIN ICON 4379, -1, 7, 8, 20, 20 - LTEXT "Wybierz takie ustawienie gonikw, ktre najbardziej odpowiada rzeczywistemu.", -1, 36, 8, 215, 27 + LTEXT "Wybierz takie ustawienie głośników, które najbardziej odpowiada rzeczywistemu.", -1, 36, 8, 215, 27 CONTROL 110, 5376, "STATIC", SS_BITMAP | SS_CENTERIMAGE, 37, 40, 209, 112, WS_EX_TRANSPARENT - LTEXT "&Ustawienie gonikw:", 8502, 53, 169, 55, 10 + LTEXT "&Ustawienie głośników:", 8502, 53, 169, 73, 10 COMBOBOX 5401, 52, 182, 170, 200, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP END IDD_PERFORMANCE1 DIALOG 0, 0, 257, 218 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Wydajno" +CAPTION "Wydajność" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Niniejsze ustawienia maj wpyw na dwik, odtwarzany przez ReactOS. Moesz, dziki nim, zdiagnozowa niektre problemy z dzwikiem.", 8492, 34, 7, 218, 23 + LTEXT "Niniejsze ustawienia mają wpływ na dźwięk, odtwarzany przez ReactOS. Możesz, dzięki nim, zdiagnozować niektóre problemy z dźwiękiem.", 8492, 34, 7, 218, 23 GROUPBOX "Odtwarzanie", 8494, 7, 32, 243, 152 ICON 4379, 8512, 8, 8, 20, 20 - LTEXT "&Przyspieszanie sprztowe:", 8495, 13, 56, 111, 14 + LTEXT "&Przyspieszanie sprzętowe:", 8495, 13, 56, 111, 14 CONTROL "Slider1", 5395, "MSCTLS_TRACKBAR32", WS_GROUP | WS_TABSTOP | 0x00000401, 150, 54, 62, 18 - LTEXT "&Jako prbkowania dwiku:", 8496, 13, 123, 103, 14 + LTEXT "&Jakość próbkowania dźwięku:", 8496, 13, 123, 103, 14 CONTROL "Slider1", 5396, "MSCTLS_TRACKBAR32", WS_TABSTOP | 0x00000401, 150, 121, 62, 18 - PUSHBUTTON "&Odtwrz domylne", 5400, 7, 191, 110, 14 + PUSHBUTTON "&Odtwórz domyślne", 5400, 7, 191, 110, 14 LTEXT "Brak", 8497, 128, 56, 21, 10 - LTEXT "Pene", 8498, 214, 56, 21, 9 - LTEXT "Saba", 8499, 128, 123, 21, 10 + LTEXT "Pełne", 8498, 214, 56, 21, 9 + LTEXT "Słaba", 8499, 128, 123, 21, 10 LTEXT "Najlepsza", 8500, 214, 123, 23, 9 - LTEXT "Ustawienia sprztowe urzdzenia nagrywania", 5399, 13, 145, 227, 21 - LTEXT "Ustawienia sprztowe urzdzenia odtwarzania", 5398, 13, 78, 227, 22 + LTEXT "Ustawienia sprzętowe urządzenia nagrywania", 5399, 13, 145, 227, 21 + LTEXT "Ustawienia sprzętowe urządzenia odtwarzania", 5398, 13, 78, 227, 22 END IDD_PERFORMANCE2 DIALOG 0, 0, 257, 218 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Wydajno" +CAPTION "Wydajność" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Niniejsze ustawienia maj wpyw na dwik, odtwarzany przez ReactOS. Moesz, dziki nim, zdiagnozowa niektre problemy z dzwikiem.", 8492, 34, 7, 217, 20 + LTEXT "Niniejsze ustawienia mają wpływ na dźwięk, odtwarzany przez ReactOS. Możesz, dzięki nim, zdiagnozować niektóre problemy z dźwiękiem.", 8492, 34, 7, 217, 20 GROUPBOX "Nagrywanie", 8494, 7, 29, 242, 122 ICON 4380, 8512, 8, 7, 20, 20 - LTEXT "&Przyspieszanie sprztowe:", 8495, 13, 46, 103, 17 + LTEXT "&Przyspieszanie sprzętowe:", 8495, 13, 46, 103, 17 CONTROL "Slider1", 5395, "MSCTLS_TRACKBAR32", WS_GROUP | WS_TABSTOP | 0x00000401, 150, 43, 62, 18 - LTEXT "&Jako prbkowania dwiku:", 8496, 13, 103, 103, 17 + LTEXT "&Jakość próbkowania dźwięku:", 8496, 13, 103, 103, 17 CONTROL "Slider1", 5396, "MSCTLS_TRACKBAR32", WS_TABSTOP | 0x00000401, 150, 101, 62, 18 - PUSHBUTTON "&Odtwrz domylne", 5400, 9, 158, 110, 14 + PUSHBUTTON "&Odtwórz domyślne", 5400, 9, 158, 110, 14 LTEXT "Brak", 8497, 125, 46, 24, 10 - LTEXT "Pene", 8498, 217, 46, 19, 9 - LTEXT "Saba", 8499, 125, 103, 24, 10 + LTEXT "Pełne", 8498, 217, 46, 19, 9 + LTEXT "Słaba", 8499, 125, 103, 24, 10 LTEXT "Najlepsza", 8500, 217, 103, 19, 9 - LTEXT "Ustawienia sprztowe urzdzenia nagrywania", 5399, 13, 125, 222, 21 - LTEXT "Ustawienia sprztowe urzdzenia odtwarzania", 5398, 13, 68, 218, 24 + LTEXT "Ustawienia sprzętowe urządzenia nagrywania", 5399, 13, 125, 222, 21 + LTEXT "Ustawienia sprzętowe urządzenia odtwarzania", 5398, 13, 68, 218, 24 END IDD_SETUP1 DIALOG 0, 0, 227, 206 @@ -176,55 +179,55 @@ STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION CAPTION "Konfiguracja" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "Usuga ReactOS Audio", 10243, 7, 5, 213, 192 + GROUPBOX "Usługa ReactOS Audio", 10243, 7, 5, 213, 192 ICON 4393, 10241, 26, 26, 20, 20 - LTEXT "Ten komputer nie moe odtwarza dwiku, poniewa usuga ReactOS Audio nie zostaa wczona.", 10245, 60, 25, 150, 40 - AUTOCHECKBOX "&Wcz ReactOS Audio", 10253, 60, 68, 150, 9 + LTEXT "Ten komputer nie może odtwarzać dźwięku, ponieważ usługa ReactOS Audio nie została włączona.", 10245, 60, 25, 150, 40 + AUTOCHECKBOX "&Włącz ReactOS Audio", 10253, 60, 68, 150, 9 LTEXT "Uwagi", 10246, 58, 87, 150, 11 - LTEXT "1. Musisz mie uprawnienia administratora, by wczy t usug. Jeli nie masz uprawnie, konieczne bdzie przelogowanie si na konto administratora.", 10247, 60, 100, 150, 40 - LTEXT "2. Po wczeniu usugi ReactOS Audio konieczne bdzie zrestartowanie komputera.", 10248, 60, 140, 150, 40 + LTEXT "1. Musisz mieć uprawnienia administratora, by włączyć tę usługę. Jeśli nie masz uprawnień, konieczne będzie przelogowanie się na konto administratora.", 10247, 60, 100, 150, 40 + LTEXT "2. Po włączeniu usługi ReactOS Audio konieczne będzie zrestartowanie komputera.", 10248, 60, 140, 150, 40 END IDD_MULTICHANNEL DIALOG 0, 0, 227, 218 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION "Dzwik wielokanaowy" +CAPTION "Dźwięk wielokanałowy" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Opis ma by tutaj.", 9506, 8, 4, 212, 24 - LTEXT "Maa", 9473, 65, 31, 14, 8 + LTEXT "Opis ma być tutaj.", 9506, 8, 4, 212, 24 + LTEXT "Mała", 9473, 65, 31, 14, 8 LTEXT "", 9472, 5, 31, 55, 8 CONTROL "Slider1", 9475, "MSCTLS_TRACKBAR32", WS_TABSTOP | 0x00000401, 87, 29, 108, 17 - LTEXT "Dua", 9474, 202, 31, 17, 8 - LTEXT "Maa", 9477, 65, 50, 14, 8 + LTEXT "Duża", 9474, 202, 31, 17, 8 + LTEXT "Mała", 9477, 65, 50, 14, 8 LTEXT "", 9476, 5, 50, 55, 8 CONTROL "Slider1", 9479, "MSCTLS_TRACKBAR32", WS_TABSTOP | 0x00000401, 87, 48, 108, 17 - LTEXT "Dua", 9478, 202, 50, 17, 8 - LTEXT "Maa", 9481, 65, 69, 14, 8 + LTEXT "Duża", 9478, 202, 50, 17, 8 + LTEXT "Mała", 9481, 65, 69, 14, 8 LTEXT "", 9480, 5, 69, 55, 8 CONTROL "Slider1", 9483, "MSCTLS_TRACKBAR32", WS_TABSTOP | 0x00000401, 87, 67, 108, 17 - LTEXT "Dua", 9482, 202, 69, 17, 8 - LTEXT "Maa", 9485, 65, 88, 14, 8 + LTEXT "Duża", 9482, 202, 69, 17, 8 + LTEXT "Mała", 9485, 65, 88, 14, 8 LTEXT "", 9484, 5, 88, 55, 8 CONTROL "Slider1", 9487, "MSCTLS_TRACKBAR32", WS_TABSTOP | 0x00000401, 87, 86, 108, 17 - LTEXT "Dua", 9486, 202, 88, 17, 8 - LTEXT "Maa", 9489, 65, 107, 14, 8 + LTEXT "Duża", 9486, 202, 88, 17, 8 + LTEXT "Mała", 9489, 65, 107, 14, 8 LTEXT "", 9488, 5, 107, 55, 8 CONTROL "Slider1", 9491, "MSCTLS_TRACKBAR32", WS_TABSTOP | 0x00000401, 87, 105, 108, 17 - LTEXT "Dua", 9490, 202, 107, 17, 8 - LTEXT "Maa", 9493, 65, 126, 14, 8 + LTEXT "Duża", 9490, 202, 107, 17, 8 + LTEXT "Mała", 9493, 65, 126, 14, 8 LTEXT "", 9492, 5, 126, 55, 8 CONTROL "Slider1", 9495, "MSCTLS_TRACKBAR32", WS_TABSTOP | 0x00000401, 87, 124, 108, 17 - LTEXT "Dua", 9494, 202, 126, 17, 8 - LTEXT "Maa", 9497, 65, 145, 14, 8 + LTEXT "Duża", 9494, 202, 126, 17, 8 + LTEXT "Mała", 9497, 65, 145, 14, 8 LTEXT "", 9496, 5, 145, 55, 8 CONTROL "Slider1", 9499, "MSCTLS_TRACKBAR32", WS_TABSTOP | 0x00000401, 87, 143, 108, 17 - LTEXT "Dua", 9498, 202, 145, 17, 8 - LTEXT "Maa", 9501, 65, 164, 14, 8 + LTEXT "Duża", 9498, 202, 145, 17, 8 + LTEXT "Mała", 9501, 65, 164, 14, 8 LTEXT "", 9500, 5, 164, 55, 8 CONTROL "Slider1", 9503, "MSCTLS_TRACKBAR32", WS_TABSTOP | 0x00000401, 87, 162, 108, 17 - LTEXT "Dua", 9502, 202, 164, 17, 8 - AUTOCHECKBOX "&Pocz wszystkie suwaki", 9504, 5, 185, 216, 9 - PUSHBUTTON "Odtwrz &domylne", 9505, 110, 199, 110, 14 + LTEXT "Duża", 9502, 202, 164, 17, 8 + AUTOCHECKBOX "&Połącz wszystkie suwaki", 9504, 5, 185, 216, 9 + PUSHBUTTON "Odtwórz &domyślne", 9505, 110, 199, 110, 14 END IDD_SETUP2 DIALOG 0, 0, 227, 206 @@ -232,43 +235,43 @@ STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION CAPTION "Konfiguracja" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "Usuga ReactOS Audio", 10259, 7, 5, 213, 192 + GROUPBOX "Usługa ReactOS Audio", 10259, 7, 5, 213, 192 ICON 4394, 10257, 25, 25, 20, 20 - LTEXT "Usuga ReactOS Audio zostaa pomylnie wczona. Jednake dwik moe nie by poprawnie odtwarzany, dopki nie zrestartujesz systemu. Przed restartem upewnij si, czy wszystkie twoje dokumenty zostay zapisane.", 10261, 60, 25, 150, 50 - LTEXT "Aby zrestartowa ReactOS, nacinij OK.", 10262, 60, 75, 150, 20 - LTEXT "Jeli wciniesz Anuluj, konieczny bdzie pzniejszy restart systemu aby usuga ReactOS Audio zadziaaa prawidowo.", 10263, 60, 100, 150, 40 + LTEXT "Usługa ReactOS Audio została pomyślnie włączona. Jednakże dźwięk może nie być poprawnie odtwarzany, dopóki nie zrestartujesz systemu. Przed restartem upewnij się, czy wszystkie twoje dokumenty zostały zapisane.", 10261, 60, 25, 150, 50 + LTEXT "Aby zrestartować ReactOS, naciśnij OK.", 10262, 60, 75, 150, 20 + LTEXT "Jeśli wciśniesz Anuluj, konieczny będzie pózniejszy restart systemu aby usługa ReactOS Audio zadziałała prawidłowo.", 10263, 60, 100, 150, 40 END STRINGTABLE BEGIN - IDS_CPLNAME "Dwik i urzdzenia audio" - IDS_CPLDESCRIPTION "Zmie schemat dwikowy dla tego komputera lub skonfiguruj ustawienia gonikw i urzdze nagrywajcych." + IDS_CPLNAME "Dźwięk i urządzenia audio" + IDS_CPLDESCRIPTION "Zmień schemat dźwiękowy dla tego komputera lub skonfiguruj ustawienia głośników i urządzeń nagrywających." IDS_NO_SOUND "(Brak)" - IDS_NO_DEVICES "Brak urzdze" + IDS_NO_DEVICES "Brak urządzeń" - 5825 "Bd programu" + 5825 "Błąd programu" 5826 "Zamknij program" 5827 "Krytyczny stan baterii" - 5828 "Urzdzenie podczone" - 5829 "Urzdzenie odczone" - 5830 "Bd podczas podczania urzdzenia" - 5831 "Oprnianie kosza" + 5828 "Urządzenie podłączone" + 5829 "Urządzenie odłączone" + 5830 "Błąd podczas podłączania urządzenia" + 5831 "Opróżnianie kosza" 5832 "Niski stan baterii" - 5833 "Peen ekran" + 5833 "Pełen ekran" 5834 "Polecenie Menu" - 5835 "Wywoanie Menu" + 5835 "Wywołanie Menu" 5836 "Minimalizuj" 5837 "Powiadomienie o nowej poczcie" - 5838 "Rozpoczcie nawigacji" + 5838 "Rozpoczęcie nawigacji" 5839 "Uruchomienie programu" - 5840 "Zakoczenie programu" - 5841 "Przywrcenie w d" - 5842 "Przywrcenie w gr" + 5840 "Zakończenie programu" + 5841 "Przywrócenie w dół" + 5842 "Przywrócenie w górę" 5843 "Gwiazdka" - 5844 "Dwik domylny" + 5844 "Dźwięk domyślny" 5845 "Wykrzyknik" - 5846 "Zamknicie ReactOS" - 5847 "Bd krytyczny" + 5846 "Zamknięcie ReactOS" + 5847 "Błąd krytyczny" 5848 "Powiadomienie systemowe" 5849 "Znak zapytania" 5850 "Uruchomienie ReactOS" diff --git a/dll/cpl/mmsys/lang/ro-RO.rc b/dll/cpl/mmsys/lang/ro-RO.rc index 94631712a12..02df5eb3783 100644 --- a/dll/cpl/mmsys/lang/ro-RO.rc +++ b/dll/cpl/mmsys/lang/ro-RO.rc @@ -1,7 +1,5 @@ LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL -#pragma code_page(65001) - IDD_VOLUME DIALOGEX 0, 0, 246, 228 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION CAPTION "Volum" @@ -269,5 +267,3 @@ BEGIN 5853 "Intrare în ReactOS" 5854 "ReactOS Explorer" END - -#pragma code_page(default) diff --git a/dll/cpl/mmsys/lang/ru-RU.rc b/dll/cpl/mmsys/lang/ru-RU.rc index a1c537a5509..5d86b8f1a21 100644 --- a/dll/cpl/mmsys/lang/ru-RU.rc +++ b/dll/cpl/mmsys/lang/ru-RU.rc @@ -2,267 +2,267 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT IDD_VOLUME DIALOGEX 0, 0, 246, 228 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Громкость" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_CPLICON, IDI_CPLICON, 8,5,32,32 LTEXT "",IDC_DEVICE_NAME,40,10,194,19 - GROUPBOX " ", -1, 7,30,230,100 + GROUPBOX "Громкость микшера", -1, 7,30,230,100 CONTROL "", IDC_MUTE_ICON, "Static", SS_ICON | WS_VISIBLE,17,45,32,32 CONTROL "",IDC_VOLUME_TRACKBAR, "msctls_trackbar32", TBS_AUTOTICKS | TBS_ENABLESELRANGE | TBS_BOTTOM | TBS_HORZ | WS_TABSTOP, 65, 45, 140, 14 - LTEXT "",-1,62,66,30,9 - LTEXT "",-1,195,66,30,9 - CHECKBOX "& ", IDC_MUTE_CHECKBOX, 50, 78, 140, 10 - CHECKBOX " & ", IDC_ICON_IN_TASKBAR, 50, 92, 140, 10 - PUSHBUTTON "&...", IDC_ADVANCED_BTN, 155,110,75,15 - GROUPBOX " ", IDC_SPEAKER_SET_BTN, 7,140,230,80 + LTEXT "ниже",-1,62,66,30,9 + LTEXT "выше",-1,195,66,30,9 + CHECKBOX "В&ыключить звук", IDC_MUTE_CHECKBOX, 50, 78, 140, 10 + CHECKBOX "Отображать &значок на панели задач", IDC_ICON_IN_TASKBAR, 50, 92, 140, 10 + PUSHBUTTON "&Дополнительно...", IDC_ADVANCED_BTN, 155,110,75,15 + GROUPBOX "Настройки динамиков", IDC_SPEAKER_SET_BTN, 7,140,230,80 CONTROL "", IDC_SPEAKIMG, "Static", SS_OWNERDRAW, 4, 160, 70, 70 - LTEXT " .",-1,70,155,150,36 - PUSHBUTTON "&...", IDC_SPEAKER_VOL_BTN, 70,200,80,15 - PUSHBUTTON "&...", IDC_ADVANCED2_BTN, 155,200,75,15 + LTEXT "Расположенные ниже кнопки позволяют выполнить индивидуальную настройку громкости динамиков и других параметров.",-1,70,155,150,36 + PUSHBUTTON "Гром&кость...", IDC_SPEAKER_VOL_BTN, 70,200,80,15 + PUSHBUTTON "Д&ополнительно...", IDC_ADVANCED2_BTN, 155,200,75,15 END IDD_SOUNDS DIALOGEX 0, 0, 246, 228 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Звуки" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " , ReactOS . .",-1,8,7,230,30 - LTEXT " &:",-1,8,42,150,9 + LTEXT "Звуковая схема задает звуки, сопровождающие события в операционной системе ReactOS и программах. Можно выбрать одну из существующих схем или создать новую.",-1,8,7,230,30 + LTEXT "Звуковая с&хема:",-1,8,42,150,9 COMBOBOX IDC_SOUND_SCHEME, 8, 53, 230, 46, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON " &...", IDC_SAVEAS_BTN, 119,70,65,15 - PUSHBUTTON "&", IDC_DELETE_BTN, 188,70,50,15 - LTEXT " , . .",-1,8,90,230,28 - LTEXT " &:",-1,8,118,150,9 + PUSHBUTTON "Сохранить &как...", IDC_SAVEAS_BTN, 119,70,65,15 + PUSHBUTTON "&Удалить", IDC_DELETE_BTN, 188,70,50,15 + LTEXT "Чтобы изменить звуковое сопровождение, щелкните на событии в списке и выберите нужный звук. Изменения можно сохранить как новую звуковую схему.",-1,8,90,230,28 + LTEXT "Программные &события:",-1,8,118,150,9 CONTROL "", IDC_SCHEME_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP, 8, 130, 230, 60, WS_EX_CLIENTEDGE - LTEXT "&:",IDC_TEXT_SOUND,8,194,80,9, WS_DISABLED + LTEXT "&Звуки:",IDC_TEXT_SOUND,8,194,80,9, WS_DISABLED COMBOBOX IDC_SOUND_LIST, 8, 205, 155, 146, CBS_DROPDOWNLIST | CBS_DISABLENOSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP | WS_DISABLED PUSHBUTTON "", IDC_PLAY_SOUND, 168,205,15,15, WS_DISABLED | BS_ICON - PUSHBUTTON "&...", IDC_BROWSE_SOUND, 188,205,50,15, WS_DISABLED + PUSHBUTTON "&Обзор...", IDC_BROWSE_SOUND, 188,205,50,15, WS_DISABLED END IDD_AUDIO DIALOGEX 0, 0, 246, 228 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Аудио" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ", -1, 7,7,230,60 + GROUPBOX "Воспроизведение звука", -1, 7,7,230,60 ICON IDI_CPLICON, IDI_CPLICON, 15,20,32,32 - LTEXT "& :",-1,50,20,180,9 + LTEXT "&Используемое по умолчанию устройство:",-1,50,20,180,9 COMBOBOX IDC_DEVICE_PLAY_LIST, 50, 30, 180, 46, CBS_DROPDOWNLIST - PUSHBUTTON "&...", IDC_VOLUME1_BTN, 85,47,70,15 - PUSHBUTTON "&...", IDC_ADV2_BTN, 160,47,70,15 - GROUPBOX " ", -1, 7,75,230,60 + PUSHBUTTON "&Громкость...", IDC_VOLUME1_BTN, 85,47,70,15 + PUSHBUTTON "&Настройка...", IDC_ADV2_BTN, 160,47,70,15 + GROUPBOX "Запись звука", -1, 7,75,230,60 ICON IDI_MICROPHONE_ICON, IDI_MICROPHONE_ICON, 15,88,32,32 - LTEXT "& :",-1,50,88,180,9 + LTEXT "И&используемое по умолчанию устройство:",-1,50,88,180,9 COMBOBOX IDC_DEVICE_REC_LIST, 50, 98, 180, 46, CBS_DROPDOWNLIST - PUSHBUTTON "&...", IDC_VOLUME2_BTN, 85,115,70,15 - PUSHBUTTON "&...", IDC_ADV1_BTN, 160,115,70,15 - GROUPBOX " MIDI", -1, 7,145,230,60 + PUSHBUTTON "Гро&мкость...", IDC_VOLUME2_BTN, 85,115,70,15 + PUSHBUTTON "Н&астройка...", IDC_ADV1_BTN, 160,115,70,15 + GROUPBOX "Воспроизведение MIDI", -1, 7,145,230,60 ICON IDI_MIDICON, IDI_MIDICON, 15,158,32,32 - LTEXT "& :",-1,50,158,180,9 + LTEXT "Ис&пользуемое по умолчанию устройство:",-1,50,158,180,9 COMBOBOX IDC_DEVICE_MIDI_LIST, 50, 168, 180, 46, CBS_DROPDOWNLIST - PUSHBUTTON "&...", IDC_VOLUME3_BTN, 85,185,70,15 - PUSHBUTTON "&...", IDC_ADV3_BTN, 160,185,70,15 - CHECKBOX " & ", IDC_DEFAULT_DEV_CHECKBOX, 7, 212, 180, 10 + PUSHBUTTON "Гром&кость...", IDC_VOLUME3_BTN, 85,185,70,15 + PUSHBUTTON "Св&едения...", IDC_ADV3_BTN, 160,185,70,15 + CHECKBOX "Использовать то&лько устройства по умолчанию", IDC_DEFAULT_DEV_CHECKBOX, 7, 212, 180, 10 END IDD_VOICE DIALOGEX 0, 0, 246, 228 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Речь" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " .",-1,8,7,230,30 - GROUPBOX " ", -1, 7,37,230,60 + LTEXT "Можно изменить громкость и другие параметры для выбранных вами устройств воспроизведения и записи речи.",-1,8,7,230,30 + GROUPBOX "Воспроизведение речи", -1, 7,37,230,60 ICON IDI_CPLICON, IDI_CPLICON, 15,50,32,32 - LTEXT "& :",-1,50,50,180,9 + LTEXT "&Используемое по умолчанию устройство:",-1,50,50,180,9 COMBOBOX IDC_DEVICE_VOICE_LIST, 50, 60, 180, 46, CBS_DROPDOWNLIST - PUSHBUTTON "&...", IDC_VOLUME4_BTN, 85,77,70,15 - PUSHBUTTON "&...", IDC_ADV4_BTN, 160,77,70,15 - GROUPBOX " ", -1, 7,105,230,60 + PUSHBUTTON "&Громкость...", IDC_VOLUME4_BTN, 85,77,70,15 + PUSHBUTTON "&Дополнительно...", IDC_ADV4_BTN, 160,77,70,15 + GROUPBOX "Запись речи", -1, 7,105,230,60 ICON IDI_MICROPHONE_ICON, IDI_MICROPHONE_ICON, 15,118,32,32 - LTEXT "& :",-1,50,118,180,9 + LTEXT "И&спользуемое по умолчанию утройство:",-1,50,118,180,9 COMBOBOX IDC_DEVICE_VOICE_REC_LIST, 50, 128, 180, 46, CBS_DROPDOWNLIST - PUSHBUTTON "&...", IDC_VOLUME5_BTN, 85,145,70,15 - PUSHBUTTON "&...", IDC_ADV5_BTN, 160,145,70,15 - PUSHBUTTON "&...", IDC_TEST_HARDWARE, 160,175,70,15 + PUSHBUTTON "Гро&мкость...", IDC_VOLUME5_BTN, 85,145,70,15 + PUSHBUTTON "Допо&лнительно...", IDC_ADV5_BTN, 160,145,70,15 + PUSHBUTTON "&Проверка...", IDC_TEST_HARDWARE, 160,175,70,15 END IDD_HARDWARE DIALOGEX 0, 0, 246, 228 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Оборудование" FONT 8, "MS Shell Dlg" BEGIN END IDD_SAVE_SCHEME_AS DIALOG 9, 23, 225, 54 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION " " +CAPTION "Сохранить схему как" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "& :", -1, 7, 7, 212, 9 + LTEXT "&Сохранить эту схему как:", -1, 7, 7, 212, 9 EDITTEXT 8960, 7, 17, 211, 14, ES_AUTOHSCROLL DEFPUSHBUTTON "OK", IDOK, 93, 36, 60, 14 - PUSHBUTTON "", IDCANCEL, 157, 36, 60, 14 + PUSHBUTTON "Отмена", IDCANCEL, 157, 36, 60, 14 END IDD_SPEAKERS DIALOG 0, 0, 257, 204 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Динамики" FONT 8, "MS Shell Dlg" BEGIN ICON 4379, -1, 7, 8, 20, 20 - LTEXT " , .", -1, 36, 8, 215, 27 + LTEXT "Укажите расположение динамиков, наиболее соответствующее реальному для данного компьютера.", -1, 36, 8, 215, 27 CONTROL 110, 5376, "STATIC", SS_BITMAP | SS_CENTERIMAGE, 37, 40, 209, 112, WS_EX_TRANSPARENT - LTEXT "& :", 8502, 53, 169, 100, 10 + LTEXT "&Расположение динамиков:", 8502, 53, 169, 100, 10 COMBOBOX 5401, 52, 182, 170, 200, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP END IDD_PERFORMANCE1 DIALOG 0, 0, 257, 218 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Производительность" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " .", 8492, 34, 7, 218, 23 - GROUPBOX " ", 8494, 7, 32, 243, 152 + LTEXT "Эти параметры управляют воспроизведением звука и могут помочь при диагностике неполадок со звуком.", 8492, 34, 7, 218, 23 + GROUPBOX "Воспроизведение звука", 8494, 7, 32, 243, 152 ICON 4379, 8512, 8, 8, 20, 20 - LTEXT "& :", 8495, 13, 56, 111, 14 + LTEXT "&Аппаратное ускорение:", 8495, 13, 56, 111, 14 CONTROL "Slider1", 5395, "MSCTLS_TRACKBAR32", WS_GROUP | WS_TABSTOP | 0x00000401, 150, 54, 62, 18 - LTEXT "& :", 8496, 13, 123, 103, 14 + LTEXT "&Частота дискретизации:", 8496, 13, 123, 103, 14 CONTROL "Slider1", 5396, "MSCTLS_TRACKBAR32", WS_TABSTOP | 0x00000401, 150, 121, 62, 18 - PUSHBUTTON "& ", 5400, 7, 191, 110, 14 - LTEXT "", 8497, 128, 56, 21, 10 - LTEXT "", 8498, 214, 56, 30, 9 - LTEXT "", 8499, 128, 123, 21, 10 - LTEXT "", 8500, 214, 123, 23, 9 - LTEXT " ", 5399, 13, 145, 227, 21 - LTEXT " ", 5398, 13, 78, 227, 22 + PUSHBUTTON "&Восстановить умолчания", 5400, 7, 191, 110, 14 + LTEXT "Нет", 8497, 128, 56, 21, 10 + LTEXT "Полное", 8498, 214, 56, 30, 9 + LTEXT "Ниже", 8499, 128, 123, 21, 10 + LTEXT "Выше", 8500, 214, 123, 23, 9 + LTEXT "Этот параметр описывает настройку устройства захвата звука", 5399, 13, 145, 227, 21 + LTEXT "Этот параметр описывает настройку устройства обработки звука", 5398, 13, 78, 227, 22 END IDD_PERFORMANCE2 DIALOG 0, 0, 257, 218 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Производительность" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " .", 8492, 34, 7, 217, 20 - GROUPBOX " ", 8494, 7, 29, 242, 122 + LTEXT "Эти параметры управляют записью звука и могут помочь при диагностике неполадок со звуком.", 8492, 34, 7, 217, 20 + GROUPBOX "Запись звука", 8494, 7, 29, 242, 122 ICON 4380, 8512, 8, 7, 20, 20 - LTEXT "& :", 8495, 13, 46, 103, 9 + LTEXT "&Аппаратное ускорение:", 8495, 13, 46, 103, 9 CONTROL "Slider1", 5395, "MSCTLS_TRACKBAR32", WS_GROUP | WS_TABSTOP | 0x00000401, 150, 43, 62, 18 - LTEXT "& :", 8496, 13, 103, 103, 9 + LTEXT "&Частота дискретизации:", 8496, 13, 103, 103, 9 CONTROL "Slider1", 5396, "MSCTLS_TRACKBAR32", WS_TABSTOP | 0x00000401, 150, 101, 62, 18 - PUSHBUTTON "& ", 5400, 9, 158, 110, 14 - LTEXT "", 8497, 125, 46, 24, 10 - LTEXT "", 8498, 217, 46, 30, 9 - LTEXT "", 8499, 125, 103, 24, 10 - LTEXT "", 8500, 217, 103, 19, 9 - LTEXT " ", 5399, 13, 125, 222, 21 - LTEXT " ", 5398, 13, 68, 218, 17 + PUSHBUTTON "&Восстановить умолчания", 5400, 9, 158, 110, 14 + LTEXT "Нет", 8497, 125, 46, 24, 10 + LTEXT "Полное", 8498, 217, 46, 30, 9 + LTEXT "Ниже", 8499, 125, 103, 24, 10 + LTEXT "Выше", 8500, 217, 103, 19, 9 + LTEXT "Этот параметр описывает настройку устройства захвата звука", 5399, 13, 125, 222, 21 + LTEXT "Этот параметр описывает настройку устройства обработки звука", 5398, 13, 68, 218, 17 END IDD_SETUP1 DIALOG 0, 0, 227, 206 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION "" +CAPTION "Установка" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ReactOS", 10243, 7, 5, 213, 192 + GROUPBOX "Звук ReactOS", 10243, 7, 5, 213, 192 ICON 4393, 10241, 26, 26, 20, 20 - LTEXT " ReactOS .", 10245, 60, 25, 150, 40 - AUTOCHECKBOX "& ReactOS", 10253, 60, 68, 150, 9 - LTEXT "", 10246, 58, 87, 150, 9 + LTEXT "Этот компьютер не может воспроизводить звук пока служба звука ReactOS не включена.", 10245, 60, 25, 150, 40 + AUTOCHECKBOX "&Включить Звук ReactOS", 10253, 60, 68, 150, 9 + LTEXT "Примечания", 10246, 58, 87, 150, 9 LTEXT "1. You must be an administrator to enable this service. If you are not logged on as administrator, you will be prompted for an administrator name and password.", 10247, 60, 100, 150, 40 - LTEXT "2. , ReactOS, .", 10248, 60, 140, 150, 40 + LTEXT "2. После того, как вы включите Звук ReactOS, вы должны перезагрузить компьютер.", 10248, 60, 140, 150, 40 END IDD_MULTICHANNEL DIALOG 0, 0, 227, 218 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION "" +CAPTION "Многоканальный" FONT 8, "MS Shell Dlg" BEGIN - LTEXT ".", 9506, 8, 4, 212, 24 - LTEXT ".", 9473, 65, 31, 14, 8 + LTEXT "Описание.", 9506, 8, 4, 212, 24 + LTEXT "Мин.", 9473, 65, 31, 14, 8 LTEXT "", 9472, 5, 31, 55, 8 CONTROL "Slider1", 9475, "MSCTLS_TRACKBAR32", WS_TABSTOP | 0x00000401, 87, 29, 108, 17 - LTEXT ".", 9474, 202, 31, 17, 8 - LTEXT ".", 9477, 65, 50, 14, 8 + LTEXT "Макс.", 9474, 202, 31, 17, 8 + LTEXT "Мин.", 9477, 65, 50, 14, 8 LTEXT "", 9476, 5, 50, 55, 8 CONTROL "Slider1", 9479, "MSCTLS_TRACKBAR32", WS_TABSTOP | 0x00000401, 87, 48, 108, 17 - LTEXT ".", 9478, 202, 50, 17, 8 - LTEXT ".", 9481, 65, 69, 14, 8 + LTEXT "Макс.", 9478, 202, 50, 17, 8 + LTEXT "Мин.", 9481, 65, 69, 14, 8 LTEXT "", 9480, 5, 69, 55, 8 CONTROL "Slider1", 9483, "MSCTLS_TRACKBAR32", WS_TABSTOP | 0x00000401, 87, 67, 108, 17 - LTEXT ".", 9482, 202, 69, 17, 8 - LTEXT ".", 9485, 65, 88, 14, 8 + LTEXT "Макс.", 9482, 202, 69, 17, 8 + LTEXT "Мин.", 9485, 65, 88, 14, 8 LTEXT "", 9484, 5, 88, 55, 8 CONTROL "Slider1", 9487, "MSCTLS_TRACKBAR32", WS_TABSTOP | 0x00000401, 87, 86, 108, 17 - LTEXT ".", 9486, 202, 88, 17, 8 - LTEXT ".", 9489, 65, 107, 14, 8 + LTEXT "Макс.", 9486, 202, 88, 17, 8 + LTEXT "Мин.", 9489, 65, 107, 14, 8 LTEXT "", 9488, 5, 107, 55, 8 CONTROL "Slider1", 9491, "MSCTLS_TRACKBAR32", WS_TABSTOP | 0x00000401, 87, 105, 108, 17 - LTEXT ".", 9490, 202, 107, 17, 8 - LTEXT ".", 9493, 65, 126, 14, 8 + LTEXT "Макс.", 9490, 202, 107, 17, 8 + LTEXT "Мин.", 9493, 65, 126, 14, 8 LTEXT "", 9492, 5, 126, 55, 8 CONTROL "Slider1", 9495, "MSCTLS_TRACKBAR32", WS_TABSTOP | 0x00000401, 87, 124, 108, 17 - LTEXT ".", 9494, 202, 126, 17, 8 - LTEXT ".", 9497, 65, 145, 14, 8 + LTEXT "Макс.", 9494, 202, 126, 17, 8 + LTEXT "Мин.", 9497, 65, 145, 14, 8 LTEXT "", 9496, 5, 145, 55, 8 CONTROL "Slider1", 9499, "MSCTLS_TRACKBAR32", WS_TABSTOP | 0x00000401, 87, 143, 108, 17 - LTEXT ".", 9498, 202, 145, 17, 8 - LTEXT ".", 9501, 65, 164, 14, 8 + LTEXT "Макс.", 9498, 202, 145, 17, 8 + LTEXT "Мин.", 9501, 65, 164, 14, 8 LTEXT "", 9500, 5, 164, 55, 8 CONTROL "Slider1", 9503, "MSCTLS_TRACKBAR32", WS_TABSTOP | 0x00000401, 87, 162, 108, 17 - LTEXT ".", 9502, 202, 164, 17, 8 - AUTOCHECKBOX "& ", 9504, 5, 185, 216, 9 - PUSHBUTTON "& ", 9505, 110, 199, 110, 14 + LTEXT "Макс.", 9502, 202, 164, 17, 8 + AUTOCHECKBOX "П&ередвигать все регуляторы одновременно", 9504, 5, 185, 216, 9 + PUSHBUTTON "&Востановить умолчания", 9505, 110, 199, 110, 14 END IDD_SETUP2 DIALOG 0, 0, 227, 206 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION "" +CAPTION "Установка" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ReactOS", 10259, 7, 5, 213, 192 + GROUPBOX "Звук ReactOS", 10259, 7, 5, 213, 192 ICON 4394, 10257, 25, 25, 20, 20 LTEXT "The ReactOS Audio service is now enabled. However, audio may not function properly until you restart ReactOS. If you want to restart now, first save your work and close all programs.", 10261, 60, 25, 150, 50 - LTEXT " ReactOS ""OK"".", 10262, 60, 75, 150, 20 + LTEXT "Для перезагрузки ReactOS нажмите ""OK"".", 10262, 60, 75, 150, 20 LTEXT "If you Cancel, you will need to restart later for ReactOS Audio to function properly.", 10263, 60, 100, 150, 40 END STRINGTABLE BEGIN - IDS_CPLNAME " " - IDS_CPLDESCRIPTION " , ." - IDS_NO_SOUND "()" + IDS_CPLNAME "Звук и аудиоустройства" + IDS_CPLDESCRIPTION "Изменение звуковых схем вашего компьютера, настройка колонок и записывающих устройств." + IDS_NO_SOUND "(Нет)" IDS_NO_DEVICES "No Devices" - 5825 " " - 5826 " " - 5827 " " - 5828 " " - 5829 " " - 5830 " " - 5831 " " - 5832 " " - 5833 "" - 5834 " " - 5835 " " - 5836 "" - 5837 " " - 5838 " " - 5839 " " - 5840 " " - 5841 " " - 5842 " " - 5843 "" - 5844 " " - 5845 "" - 5846 " ReactOS" - 5847 " " - 5848 " " - 5849 "" - 5850 " ReactOS" - 5851 " " - 5852 " ReactOS" - 5853 " ReactOS" - 5854 " ReactOS" + 5825 "Ошибка программы" + 5826 "Закрыть программу" + 5827 "Сигнал почти полной разрядки батарей" + 5828 "Подключение устройства" + 5829 "Отключение устройства" + 5830 "Ошибка подключения устройства" + 5831 "Очистка карзины" + 5832 "Сигнал низкого заряда батарей" + 5833 "Развертывание" + 5834 "Команда меню" + 5835 "Раскрытие меню" + 5836 "Свертывание" + 5837 "Уведомление о получении почты" + 5838 "Начать обзор" + 5839 "Открытие программы" + 5840 "Печать завершена" + 5841 "Восстановление окна с полного экрана" + 5842 "Восстановление окна из значка" + 5843 "Звездочка" + 5844 "Стандартный звук" + 5845 "Восклицание" + 5846 "Завершение работы ReactOS" + 5847 "Критическая ошибка" + 5848 "Системное уведомление" + 5849 "Вопрос" + 5850 "Запуск ReactOS" + 5851 "Главное меню" + 5852 "Выход из ReactOS" + 5853 "Вход в ReactOS" + 5854 "Проводник ReactOS" END diff --git a/dll/cpl/mmsys/lang/uk-UA.rc b/dll/cpl/mmsys/lang/uk-UA.rc index d9477c763d5..d5e042e4601 100644 --- a/dll/cpl/mmsys/lang/uk-UA.rc +++ b/dll/cpl/mmsys/lang/uk-UA.rc @@ -10,95 +10,95 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT IDD_VOLUME DIALOGEX 0, 0, 246, 228 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Гучність" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_CPLICON, IDI_CPLICON, 8,5,32,32 LTEXT "",IDC_DEVICE_NAME,40,10,194,36 - GROUPBOX " ", -1, 7,30,230,100 + GROUPBOX "Гучність мікшера", -1, 7,30,230,100 CONTROL "", IDC_MUTE_ICON, "Static", SS_ICON | WS_VISIBLE,17,45,32,32 CONTROL "",IDC_VOLUME_TRACKBAR, "msctls_trackbar32", TBS_AUTOTICKS | TBS_ENABLESELRANGE | TBS_BOTTOM | TBS_HORZ | WS_TABSTOP, 65, 45, 140, 14 - LTEXT "",-1,62,66,30,17 - LTEXT "",-1,195,66,30,17 - CHECKBOX "& ", IDC_MUTE_CHECKBOX, 50, 78, 140, 10 - CHECKBOX "& ", IDC_ICON_IN_TASKBAR, 50, 92, 140, 10 - PUSHBUTTON "&...", IDC_ADVANCED_BTN, 150,105,75,15 - GROUPBOX " ", IDC_SPEAKER_SET_BTN, 7,140,230,80 + LTEXT "нижче",-1,62,66,30,17 + LTEXT "вище",-1,195,66,30,17 + CHECKBOX "&Вимкнути звук", IDC_MUTE_CHECKBOX, 50, 78, 140, 10 + CHECKBOX "Пока&зувати значок гучності на панелі завдань", IDC_ICON_IN_TASKBAR, 50, 92, 140, 10 + PUSHBUTTON "&Додатково...", IDC_ADVANCED_BTN, 150,105,75,15 + GROUPBOX "Налаштування динаміків", IDC_SPEAKER_SET_BTN, 7,140,230,80 CONTROL "", IDC_SPEAKIMG, "Static", SS_OWNERDRAW, 4, 160, 70, 70 - LTEXT " .",-1,70,155,150,36 - PUSHBUTTON "& ...", IDC_SPEAKER_VOL_BTN, 70,195,75,15 - PUSHBUTTON "&...", IDC_ADVANCED2_BTN, 150,195,75,15 + LTEXT "За допомогою розташованих нижче кнопок можна виконати індивідуальну настройку гучності динаміків та інших параметрів.",-1,70,155,150,36 + PUSHBUTTON "&Гучність динаміків...", IDC_SPEAKER_VOL_BTN, 70,195,75,15 + PUSHBUTTON "Дод&атково...", IDC_ADVANCED2_BTN, 150,195,75,15 END IDD_SOUNDS DIALOGEX 0, 0, 246, 228 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Звуки" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " , 䳿 ReactOS . .",-1,8,7,230,40 - LTEXT " &:",-1,8,42,150,17 + LTEXT "Звукова схема визначає звуки, які супроводжують події в системі ReactOS і у програмах. Можна вибрати одну з наявних схем або створити нову.",-1,8,7,230,40 + LTEXT "Звукова с&хема:",-1,8,42,150,17 COMBOBOX IDC_SOUND_SCHEME, 8, 53, 230, 46, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON " &...", IDC_SAVEAS_BTN, 134,70,50,15 - PUSHBUTTON "&", IDC_DELETE_BTN, 188,70,50,15 - LTEXT " , . .",-1,8,90,230,40 - LTEXT "& 䳿:",-1,8,118,150,17 + PUSHBUTTON "Зберегти &як...", IDC_SAVEAS_BTN, 134,70,50,15 + PUSHBUTTON "В&идалити", IDC_DELETE_BTN, 188,70,50,15 + LTEXT "Щоб змінити звуковий супровід, клацніть подію у списку та виберіть потрібний звук. Зміни можна зберегти як нову звукову схему.",-1,8,90,230,40 + LTEXT "&Програмні події:",-1,8,118,150,17 CONTROL "", IDC_SCHEME_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP, 8, 130, 230, 60, WS_EX_CLIENTEDGE - LTEXT "&:", IDC_TEXT_SOUND,8,194,80,17, WS_DISABLED + LTEXT "&Звуки:", IDC_TEXT_SOUND,8,194,80,17, WS_DISABLED COMBOBOX IDC_SOUND_LIST, 8, 205, 155, 146, CBS_DROPDOWNLIST | CBS_DISABLENOSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP | WS_DISABLED PUSHBUTTON "", IDC_PLAY_SOUND, 168,205,15,15, WS_DISABLED | BS_ICON - PUSHBUTTON "&...", IDC_BROWSE_SOUND, 188,205,50,15, WS_DISABLED + PUSHBUTTON "О&гляд...", IDC_BROWSE_SOUND, 188,205,50,15, WS_DISABLED END IDD_AUDIO DIALOGEX 0, 0, 246, 228 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Аудіо" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "³ ", -1, 7,7,230,60 + GROUPBOX "Відтворення звуку", -1, 7,7,230,60 ICON IDI_CPLICON, IDI_CPLICON, 15,20,32,32 - LTEXT "& :",-1,50,20,140,17 + LTEXT "&Пристрій за замовчуванням:",-1,50,20,140,17 COMBOBOX IDC_DEVICE_PLAY_LIST, 50, 30, 180, 46, CBS_DROPDOWNLIST - PUSHBUTTON "&...", IDC_VOLUME1_BTN, 85,47,70,15 - PUSHBUTTON "&...", IDC_ADV2_BTN, 160,47,70,15 - GROUPBOX " ", -1, 7,75,230,60 + PUSHBUTTON "&Гучність...", IDC_VOLUME1_BTN, 85,47,70,15 + PUSHBUTTON "&Додатково...", IDC_ADV2_BTN, 160,47,70,15 + GROUPBOX "Запис звуку", -1, 7,75,230,60 ICON IDI_MICROPHONE_ICON, IDI_MICROPHONE_ICON, 15,88,32,32 - LTEXT "& :",-1,50,88,140,17 + LTEXT "Пр&истрій за замовчуванням:",-1,50,88,140,17 COMBOBOX IDC_DEVICE_REC_LIST, 50, 98, 180, 46, CBS_DROPDOWNLIST - PUSHBUTTON "&...", IDC_VOLUME2_BTN, 85,115,70,15 - PUSHBUTTON "&...", IDC_ADV1_BTN, 160,115,70,15 - GROUPBOX "³ MIDI", -1, 7,145,230,60 + PUSHBUTTON "Гу&чність...", IDC_VOLUME2_BTN, 85,115,70,15 + PUSHBUTTON "Д&одатково...", IDC_ADV1_BTN, 160,115,70,15 + GROUPBOX "Відтворення MIDI", -1, 7,145,230,60 ICON IDI_MIDICON, IDI_MIDICON, 15,158,32,32 - LTEXT "& :",-1,50,158,140,17 + LTEXT "При&стрій за замовчуванням:",-1,50,158,140,17 COMBOBOX IDC_DEVICE_MIDI_LIST, 50, 168, 180, 46, CBS_DROPDOWNLIST - PUSHBUTTON "&...", IDC_VOLUME3_BTN, 85,185,70,15 - PUSHBUTTON "&³...", IDC_ADV3_BTN, 160,185,70,15 - CHECKBOX "& ", IDC_DEFAULT_DEV_CHECKBOX, 7, 212, 140, 10 + PUSHBUTTON "Гучніст&ь...", IDC_VOLUME3_BTN, 85,185,70,15 + PUSHBUTTON "&Відомості...", IDC_ADV3_BTN, 160,185,70,15 + CHECKBOX "&Лише пристрої за замовчуванням", IDC_DEFAULT_DEV_CHECKBOX, 7, 212, 140, 10 END IDD_VOICE DIALOGEX 0, 0, 246, 228 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Мовлення" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "ֳ .",-1,8,7,230,40 - GROUPBOX "³ ", -1, 7,37,230,60 + LTEXT "Ці параметри керують гучністю та додатковою настройкою вибраних пристроїв відтворення або запису мовлення.",-1,8,7,230,40 + GROUPBOX "Відтворення мовлення", -1, 7,37,230,60 ICON IDI_CPLICON, IDI_CPLICON, 15,50,32,32 - LTEXT " & :",-1,50,50,140,17 + LTEXT "Пристрій &за замовчуванням:",-1,50,50,140,17 COMBOBOX IDC_DEVICE_VOICE_LIST, 50, 60, 180, 46, CBS_DROPDOWNLIST - PUSHBUTTON "&...", IDC_VOLUME4_BTN, 85,77,70,15 - PUSHBUTTON "&...", IDC_ADV4_BTN, 160,77,70,15 - GROUPBOX " ", -1, 7,105,230,60 + PUSHBUTTON "&Гучність...", IDC_VOLUME4_BTN, 85,77,70,15 + PUSHBUTTON "&Додатково...", IDC_ADV4_BTN, 160,77,70,15 + GROUPBOX "Запис мовлення", -1, 7,105,230,60 ICON IDI_MICROPHONE_ICON, IDI_MICROPHONE_ICON, 15,118,32,32 - LTEXT "& :",-1,50,118,140,17 + LTEXT "Пр&истрій за замовчуванням:",-1,50,118,140,17 COMBOBOX IDC_DEVICE_VOICE_REC_LIST, 50, 128, 180, 46, CBS_DROPDOWNLIST - PUSHBUTTON "&...", IDC_VOLUME5_BTN, 85,145,70,15 - PUSHBUTTON "&...", IDC_ADV5_BTN, 160,145,70,15 - PUSHBUTTON "&...", IDC_TEST_HARDWARE, 160,175,70,15 + PUSHBUTTON "Гу&чність...", IDC_VOLUME5_BTN, 85,145,70,15 + PUSHBUTTON "Дод&атково...", IDC_ADV5_BTN, 160,145,70,15 + PUSHBUTTON "&Перевірка...", IDC_TEST_HARDWARE, 160,175,70,15 END IDD_HARDWARE DIALOGEX 0, 0, 246, 228 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Обладнання" FONT 8, "MS Shell Dlg" BEGIN @@ -106,172 +106,172 @@ END IDD_SAVE_SCHEME_AS DIALOG 9, 23, 225, 54 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION " " +CAPTION "Збереження схеми" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "& :", -1, 7, 7, 212, 9 + LTEXT "&Назва схеми:", -1, 7, 7, 212, 9 EDITTEXT 8960, 7, 17, 211, 14, ES_AUTOHSCROLL DEFPUSHBUTTON "OK", IDOK, 93, 36, 60, 14 - PUSHBUTTON "", IDCANCEL, 157, 36, 60, 14 + PUSHBUTTON "Скасувати", IDCANCEL, 157, 36, 60, 14 END IDD_SPEAKERS DIALOG 0, 0, 257, 204 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Динаміки" FONT 8, "MS Shell Dlg" BEGIN ICON 4379, -1, 7, 8, 20, 20 - LTEXT " , '.", -1, 36, 8, 215, 27 + LTEXT "Виберіть схему розташування динаміків, яка найбільш відповідає реальному розташуванню динаміків вашого комп'ютера.", -1, 36, 8, 215, 27 CONTROL 110, 5376, "STATIC", SS_BITMAP | SS_CENTERIMAGE, 37, 40, 209, 112, WS_EX_TRANSPARENT - LTEXT "& :", 8502, 53, 169, 55, 10 + LTEXT "&Розташування динаміків:", 8502, 53, 169, 55, 10 COMBOBOX 5401, 52, 182, 170, 200, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP END IDD_PERFORMANCE1 DIALOG 0, 0, 257, 218 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Якість відтворення" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "ֳ . .", 8492, 34, 7, 218, 23 - GROUPBOX "³ ", 8494, 7, 32, 243, 152 + LTEXT "Ці параметри керують відтворенням звуку. За їх допомогою можна виправляти неполадки зі звуком.", 8492, 34, 7, 218, 23 + GROUPBOX "Відтворення звуку", 8494, 7, 32, 243, 152 ICON 4379, 8512, 8, 8, 20, 20 - LTEXT "& :", 8495, 13, 56, 111, 14 + LTEXT "&Апаратне прискорення:", 8495, 13, 56, 111, 14 CONTROL "Slider1", 5395, "MSCTLS_TRACKBAR32", WS_GROUP | WS_TABSTOP | 0x00000401, 150, 54, 62, 18 - LTEXT "& :", 8496, 13, 123, 103, 14 + LTEXT "&Частота дискретизації:", 8496, 13, 123, 103, 14 CONTROL "Slider1", 5396, "MSCTLS_TRACKBAR32", WS_TABSTOP | 0x00000401, 150, 121, 62, 18 - PUSHBUTTON "&³", 5400, 7, 191, 110, 14 - LTEXT "", 8497, 128, 56, 21, 10 - LTEXT "", 8498, 214, 56, 21, 9 - LTEXT "", 8499, 128, 123, 21, 10 - LTEXT "", 8500, 214, 123, 23, 9 - LTEXT " ", 5399, 13, 145, 227, 21 - LTEXT " ", 5398, 13, 78, 227, 22 + PUSHBUTTON "&Відновити", 5400, 7, 191, 110, 14 + LTEXT "Немає", 8497, 128, 56, 21, 10 + LTEXT "Повне", 8498, 214, 56, 21, 9 + LTEXT "Нижче", 8499, 128, 123, 21, 10 + LTEXT "Вище", 8500, 214, 123, 23, 9 + LTEXT "Цей параметр описує настройку пристрою звукозапису", 5399, 13, 145, 227, 21 + LTEXT "Цей параметр описує настройку пристрою обробки звуку", 5398, 13, 78, 227, 22 END IDD_PERFORMANCE2 DIALOG 0, 0, 257, 218 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Якість запису" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "ֳ . .", 8492, 34, 7, 217, 20 - GROUPBOX " ", 8494, 7, 29, 242, 122 + LTEXT "Ці параметри керують записом звуку. За їх допомогою можна виправляти неполадки зі звуком.", 8492, 34, 7, 217, 20 + GROUPBOX "Запис звуку", 8494, 7, 29, 242, 122 ICON 4380, 8512, 8, 7, 20, 20 - LTEXT "& :", 8495, 13, 46, 103, 17 + LTEXT "&Апаратне прискорення:", 8495, 13, 46, 103, 17 CONTROL "Slider1", 5395, "MSCTLS_TRACKBAR32", WS_GROUP | WS_TABSTOP | 0x00000401, 150, 43, 62, 18 - LTEXT "& :", 8496, 13, 103, 103, 17 + LTEXT "&Частота дискретизації:", 8496, 13, 103, 103, 17 CONTROL "Slider1", 5396, "MSCTLS_TRACKBAR32", WS_TABSTOP | 0x00000401, 150, 101, 62, 18 - PUSHBUTTON "&³", 5400, 9, 158, 110, 14 - LTEXT "", 8497, 125, 46, 24, 10 - LTEXT "", 8498, 217, 46, 19, 9 - LTEXT "", 8499, 125, 103, 24, 10 - LTEXT "", 8500, 217, 103, 19, 9 - LTEXT " ", 5399, 13, 125, 222, 21 - LTEXT " ", 5398, 13, 68, 218, 24 + PUSHBUTTON "&Відновити", 5400, 9, 158, 110, 14 + LTEXT "Немає", 8497, 125, 46, 24, 10 + LTEXT "Повне", 8498, 217, 46, 19, 9 + LTEXT "Нижче", 8499, 125, 103, 24, 10 + LTEXT "Вище", 8500, 217, 103, 19, 9 + LTEXT "Цей параметр описує настройку пристрою звукозапису", 5399, 13, 125, 222, 21 + LTEXT "Цей параметр описує настройку пристрою обробки звуку", 5398, 13, 68, 218, 24 END IDD_SETUP1 DIALOG 0, 0, 227, 206 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION "" +CAPTION "Установка" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ReactOS ", 10243, 7, 5, 213, 192 + GROUPBOX "Служба ReactOS аудіо", 10243, 7, 5, 213, 192 ICON 4393, 10241, 26, 26, 20, 20 - LTEXT " ' , ReactOS .", 10245, 60, 25, 150, 40 - AUTOCHECKBOX "& ReactOS ", 10253, 60, 68, 150, 9 - LTEXT "", 10246, 58, 87, 150, 11 - LTEXT "1. ҳ . , .", 10247, 60, 100, 150, 40 - LTEXT "2. ϳ ReactOS '.", 10248, 60, 140, 150, 40 + LTEXT "Цей комп'ютер не може відтворювати звукові дані, оскільки служба ReactOS аудіо не включена.", 10245, 60, 25, 150, 40 + AUTOCHECKBOX "&Включити службу ReactOS аудіо", 10253, 60, 68, 150, 9 + LTEXT "Примітки", 10246, 58, 87, 150, 11 + LTEXT "1. Тільки адміністратор може включити цю службу. Якщо ви не виконали вхід в систему як адміністратор, ви отримаєте запит на введення імені і пароля адміністратора.", 10247, 60, 100, 150, 40 + LTEXT "2. Після включення служби ReactOS аудіо треба буде перезавантажити комп'ютер.", 10248, 60, 140, 150, 40 END IDD_MULTICHANNEL DIALOG 0, 0, 227, 218 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION "" +CAPTION "Багатоканальний" FONT 8, "MS Shell Dlg" BEGIN - LTEXT ".", 9506, 8, 4, 212, 24 - LTEXT "̳.", 9473, 65, 31, 14, 8 + LTEXT "Опис.", 9506, 8, 4, 212, 24 + LTEXT "Мін.", 9473, 65, 31, 14, 8 LTEXT "", 9472, 5, 31, 55, 8 CONTROL "Slider1", 9475, "MSCTLS_TRACKBAR32", WS_TABSTOP | 0x00000401, 87, 29, 108, 17 - LTEXT ".", 9474, 202, 31, 17, 8 - LTEXT "̳.", 9477, 65, 50, 14, 8 + LTEXT "Макс.", 9474, 202, 31, 17, 8 + LTEXT "Мін.", 9477, 65, 50, 14, 8 LTEXT "", 9476, 5, 50, 55, 8 CONTROL "Slider1", 9479, "MSCTLS_TRACKBAR32", WS_TABSTOP | 0x00000401, 87, 48, 108, 17 - LTEXT ".", 9478, 202, 50, 17, 8 - LTEXT "̳.", 9481, 65, 69, 14, 8 + LTEXT "Макс.", 9478, 202, 50, 17, 8 + LTEXT "Мін.", 9481, 65, 69, 14, 8 LTEXT "", 9480, 5, 69, 55, 8 CONTROL "Slider1", 9483, "MSCTLS_TRACKBAR32", WS_TABSTOP | 0x00000401, 87, 67, 108, 17 - LTEXT ".", 9482, 202, 69, 17, 8 - LTEXT "̳.", 9485, 65, 88, 14, 8 + LTEXT "Макс.", 9482, 202, 69, 17, 8 + LTEXT "Мін.", 9485, 65, 88, 14, 8 LTEXT "", 9484, 5, 88, 55, 8 CONTROL "Slider1", 9487, "MSCTLS_TRACKBAR32", WS_TABSTOP | 0x00000401, 87, 86, 108, 17 - LTEXT ".", 9486, 202, 88, 17, 8 - LTEXT "̳.", 9489, 65, 107, 14, 8 + LTEXT "Макс.", 9486, 202, 88, 17, 8 + LTEXT "Мін.", 9489, 65, 107, 14, 8 LTEXT "", 9488, 5, 107, 55, 8 CONTROL "Slider1", 9491, "MSCTLS_TRACKBAR32", WS_TABSTOP | 0x00000401, 87, 105, 108, 17 - LTEXT ".", 9490, 202, 107, 17, 8 - LTEXT "̳.", 9493, 65, 126, 14, 8 + LTEXT "Макс.", 9490, 202, 107, 17, 8 + LTEXT "Мін.", 9493, 65, 126, 14, 8 LTEXT "", 9492, 5, 126, 55, 8 CONTROL "Slider1", 9495, "MSCTLS_TRACKBAR32", WS_TABSTOP | 0x00000401, 87, 124, 108, 17 - LTEXT ".", 9494, 202, 126, 17, 8 - LTEXT "̳.", 9497, 65, 145, 14, 8 + LTEXT "Макс.", 9494, 202, 126, 17, 8 + LTEXT "Мін.", 9497, 65, 145, 14, 8 LTEXT "", 9496, 5, 145, 55, 8 CONTROL "Slider1", 9499, "MSCTLS_TRACKBAR32", WS_TABSTOP | 0x00000401, 87, 143, 108, 17 - LTEXT ".", 9498, 202, 145, 17, 8 - LTEXT "̳.", 9501, 65, 164, 14, 8 + LTEXT "Макс.", 9498, 202, 145, 17, 8 + LTEXT "Мін.", 9501, 65, 164, 14, 8 LTEXT "", 9500, 5, 164, 55, 8 CONTROL "Slider1", 9503, "MSCTLS_TRACKBAR32", WS_TABSTOP | 0x00000401, 87, 162, 108, 17 - LTEXT ".", 9502, 202, 164, 17, 8 - AUTOCHECKBOX "& ", 9504, 5, 185, 216, 9 - PUSHBUTTON "&³", 9505, 110, 199, 110, 14 + LTEXT "Макс.", 9502, 202, 164, 17, 8 + AUTOCHECKBOX "П&ереміщати всі повзунки одночасно", 9504, 5, 185, 216, 9 + PUSHBUTTON "&Відновити", 9505, 110, 199, 110, 14 END IDD_SETUP2 DIALOG 0, 0, 227, 206 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION "" +CAPTION "Установка" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ReactOS ", 10259, 7, 5, 213, 192 + GROUPBOX "Служба ReactOS аудіо", 10259, 7, 5, 213, 192 ICON 4394, 10257, 25, 25, 20, 20 - LTEXT " ReactOS . ReactOS. .", 10261, 60, 25, 150, 50 - LTEXT " ReactOS, ""OK"".", 10262, 60, 75, 150, 20 - LTEXT " """", ReactOS ' .", 10263, 60, 100, 150, 40 + LTEXT "Служба ReactOS аудіо тепер включена. Проте для правильного відтворення звукових даних слід перезавантажити ReactOS. Перед перезавантаженням потрібно зберегти всі дані і завершити роботу всіх програм.", 10261, 60, 25, 150, 50 + LTEXT "Щоб перезавантажити ReactOS, натисніть кнопку ""OK"".", 10262, 60, 75, 150, 20 + LTEXT "Якщо натиснути кнопку ""Скасувати"", то для правильної роботи служби ReactOS аудіо потрібно буде перезавантажити комп'ютер пізніше.", 10263, 60, 100, 150, 40 END STRINGTABLE BEGIN - IDS_CPLNAME " " - IDS_CPLDESCRIPTION " ', ." - IDS_NO_SOUND "()" + IDS_CPLNAME "Звукові і аудіо пристрої" + IDS_CPLDESCRIPTION "Зміна звукових схем вашого комп'ютера, настроювання колонок і записуючих пристроїв." + IDS_NO_SOUND "(немає)" IDS_NO_DEVICES "No Devices" - 5825 " " - 5826 " " - 5827 " " - 5828 "ϳ " - 5829 "³ " - 5830 " " - 5831 " " - 5832 " " - 5833 "" - 5834 " " - 5835 " " - 5836 "" - 5837 " " - 5838 " " - 5839 "³ " - 5840 " " - 5841 "³ " - 5842 "³ " - 5843 "dz" - 5844 " " - 5845 "" - 5846 " ReactOS" - 5847 " " - 5848 " " - 5849 "" - 5850 " ReactOS" - 5851 " " - 5852 " ReactOS" - 5853 " ReactOS" + 5825 "Помилка програми" + 5826 "Закрити програму" + 5827 "Сигнал критичної розрядки батарей" + 5828 "Підключення пристрою" + 5829 "Відключення пристрою" + 5830 "Помилка підключення пристрою" + 5831 "Очищення кошика" + 5832 "Сигнал значної розрядки батарей" + 5833 "Розгортання" + 5834 "Команда меню" + 5835 "Розгортання меню" + 5836 "Згортання" + 5837 "Сповіщення про отримання пошти" + 5838 "Почати огляд" + 5839 "Відкриття програми" + 5840 "Друк завершено" + 5841 "Відновлення після розгортання" + 5842 "Відновлення після згортання" + 5843 "Зірочка" + 5844 "Стандартний звук" + 5845 "Вигук" + 5846 "Завершення роботи ReactOS" + 5847 "Критична помилка" + 5848 "Системне сповіщення" + 5849 "Запитання" + 5850 "Запуск ReactOS" + 5851 "Головне меню" + 5852 "Вихід із ReactOS" + 5853 "Вхід до ReactOS" 5854 "ReactOS Explorer" END diff --git a/dll/cpl/mmsys/mmsys.c b/dll/cpl/mmsys/mmsys.c index 6e765608f5d..9b32a7ef04a 100644 --- a/dll/cpl/mmsys/mmsys.c +++ b/dll/cpl/mmsys/mmsys.c @@ -9,19 +9,7 @@ * 2005/11/23 Created */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - #include "mmsys.h" -#include "resource.h" typedef enum { diff --git a/dll/cpl/mmsys/mmsys.h b/dll/cpl/mmsys/mmsys.h index ed6c480a0c0..f5085cc5714 100644 --- a/dll/cpl/mmsys/mmsys.h +++ b/dll/cpl/mmsys/mmsys.h @@ -1,4 +1,16 @@ -#pragma once +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "resource.h" //typedef LONG (CALLBACK *APPLET_PROC)(VOID); diff --git a/dll/cpl/mmsys/mmsys.rbuild b/dll/cpl/mmsys/mmsys.rbuild index 3180e2a7888..86fb7f9e808 100644 --- a/dll/cpl/mmsys/mmsys.rbuild +++ b/dll/cpl/mmsys/mmsys.rbuild @@ -18,4 +18,5 @@ audio.c voice.c mmsys.rc + mmsys.h diff --git a/dll/cpl/mmsys/rsrc.rc b/dll/cpl/mmsys/rsrc.rc index 51954a3a650..28849c5890b 100644 --- a/dll/cpl/mmsys/rsrc.rc +++ b/dll/cpl/mmsys/rsrc.rc @@ -12,10 +12,13 @@ #include "lang/it-IT.rc" #include "lang/nl-NL.rc" #include "lang/no-NO.rc" -#include "lang/pl-PL.rc" #include "lang/pt-BR.rc" +#include "lang/sk-SK.rc" +#include "lang/zh-CN.rc" + +// UTF-8 +#pragma code_page(65001) +#include "lang/pl-PL.rc" #include "lang/ro-RO.rc" #include "lang/ru-RU.rc" -#include "lang/sk-SK.rc" #include "lang/uk-UA.rc" -#include "lang/zh-CN.rc" diff --git a/dll/cpl/mmsys/sounds.c b/dll/cpl/mmsys/sounds.c index c7ff17187a5..48ba4f4cdeb 100644 --- a/dll/cpl/mmsys/sounds.c +++ b/dll/cpl/mmsys/sounds.c @@ -8,15 +8,7 @@ * Dmitry Chapyshev */ -#include -#include -#include -#include -#include -#include #include "mmsys.h" -#include "resource.h" -#include struct __APP_MAP__; diff --git a/dll/cpl/mmsys/voice.c b/dll/cpl/mmsys/voice.c index ac5c4497111..f19fe69438c 100644 --- a/dll/cpl/mmsys/voice.c +++ b/dll/cpl/mmsys/voice.c @@ -8,13 +8,7 @@ * Dmitry Chapyshev */ -#include -#include -#include -#include -#include #include "mmsys.h" -#include "resource.h" /* Voice property page dialog callback */ INT_PTR CALLBACK diff --git a/dll/cpl/mmsys/volume.c b/dll/cpl/mmsys/volume.c index 19f518bccea..836b13d4596 100644 --- a/dll/cpl/mmsys/volume.c +++ b/dll/cpl/mmsys/volume.c @@ -8,14 +8,7 @@ * Dmitry Chapyshev */ -#include -#include -#include -#include -#include -#include #include "mmsys.h" -#include "resource.h" #define VOLUME_DIVIDER 0xFFF diff --git a/dll/cpl/powercfg/CMakeLists.txt b/dll/cpl/powercfg/CMakeLists.txt index c0beaa6ecef..f449a940347 100644 --- a/dll/cpl/powercfg/CMakeLists.txt +++ b/dll/cpl/powercfg/CMakeLists.txt @@ -25,4 +25,5 @@ add_importlibs(powercfg kernel32 ntdll) +add_pch(powercfg powercfg.h) add_cd_file(TARGET powercfg DESTINATION reactos/system32 FOR all) diff --git a/dll/cpl/powercfg/advanced.c b/dll/cpl/powercfg/advanced.c index 20c4b85fe07..15313f259c4 100644 --- a/dll/cpl/powercfg/advanced.c +++ b/dll/cpl/powercfg/advanced.c @@ -14,12 +14,6 @@ //typedef long NTSTATUS; //#endif -#include "ntstatus.h" -#define WIN32_NO_STATUS -#include -#include -#include -#include "resource.h" #include "powercfg.h" HWND hAdv = 0; diff --git a/dll/cpl/powercfg/alarms.c b/dll/cpl/powercfg/alarms.c index 464723b0858..df44386c416 100644 --- a/dll/cpl/powercfg/alarms.c +++ b/dll/cpl/powercfg/alarms.c @@ -10,14 +10,6 @@ * Dmitry Chapyshev (lentind@yandex.ru) */ - -#include -#include -#include -#include -#include - -#include "resource.h" #include "powercfg.h" static BOOLEAN diff --git a/dll/cpl/powercfg/hibernate.c b/dll/cpl/powercfg/hibernate.c index 77cc51d441f..1b69cc8c95b 100644 --- a/dll/cpl/powercfg/hibernate.c +++ b/dll/cpl/powercfg/hibernate.c @@ -14,18 +14,8 @@ //typedef long NTSTATUS; //#endif -#include "ntstatus.h" -#define WIN32_NO_STATUS -#include -#include -#include -#include -#include - -#include "resource.h" #include "powercfg.h" - BOOLEAN Pos_InitData(); void Adv_InitDialog(); diff --git a/dll/cpl/powercfg/lang/pl-PL.rc b/dll/cpl/powercfg/lang/pl-PL.rc index f6faf4d7ff2..42081492382 100644 --- a/dll/cpl/powercfg/lang/pl-PL.rc +++ b/dll/cpl/powercfg/lang/pl-PL.rc @@ -1,9 +1,11 @@ -/** - * translated by aart3k - * aart3k@gmail.com - * https://sourceforge.net/projects/reactospl - * updated by Caemyr - Olaf Siejka (Jan, 2008) +/* + * translated by aart3k + * aart3k@gmail.com + * https://sourceforge.net/projects/reactospl + * updated by Caemyr - Olaf Siejka (Jan, 2008) + * UTF-8 conversion by Caemyr (May, 2011) */ + LANGUAGE LANG_POLISH, SUBLANG_DEFAULT IDD_PROPPAGEPOWERSHEMES DIALOGEX 0, 0, 250, 220 @@ -12,22 +14,22 @@ CAPTION "Schematy zasilania" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_ACDC, IDI_ACDC, 7,7,28,22 - LTEXT "Wybierz schemat zasilana najbardziej pasujcy do Twojego komputera. Miej na uwadze, e zmiany poniej spowoduj modyfikacj wybranego schematu.", + LTEXT "Wybierz schemat zasilana najbardziej pasujący do Twojego komputera. Miej na uwadze, że zmiany poniżej spowodują modyfikację wybranego schematu.", -1,45,13,194,36 GROUPBOX "&Schematy zasilania", -1, 7,57,240,46 COMBOBOX IDC_ENERGYLIST, 14,70,224,92, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP PUSHBUTTON "&Zapisz jako...", IDC_SAVEAS_BTN, 100,85,75,15,WS_DISABLED - PUSHBUTTON "&Usu", IDC_DELETE_BTN, 180,85,55,15,WS_DISABLED + PUSHBUTTON "&Usuń", IDC_DELETE_BTN, 180,85,55,15,WS_DISABLED GROUPBOX "Nieznany", IDC_GRPDETAIL, 7,108,240,105 LTEXT "Kiedy komputer jest:",IDC_SAT,15,120,60,10 - LTEXT "Podczony",IDC_SAC,100,120,45,15 + LTEXT "Podłączony",IDC_SAC,100,120,45,15 ICON IDI_AC, IDC_IAC, 75,115,25,15 LTEXT "Zasilany akumulatorem",IDC_SDC,197,120,45,15 ICON IDI_DC, IDC_IDC, 165,115,25,15 - LTEXT "Wycz &monitor:",IDC_MONITOR,15,145,80,10 + LTEXT "Wyłącz &monitor:",IDC_MONITOR,15,145,80,10 COMBOBOX IDC_MONITORACLIST, 100,140,65,150, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_MONITORDCLIST, 175,140,65,150, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "Wycz &dysk twardy:",IDC_DISK,15,160,80,10 + LTEXT "Wyłącz &dysk twardy:",IDC_DISK,15,160,80,10 COMBOBOX IDC_DISKACLIST, 100,155,65,150, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_DISKDCLIST, 175,155,65,150, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP LTEXT "System w stan &czuwania:",IDC_STANDBY,15,180,80,10 @@ -40,37 +42,37 @@ END IDD_PROPPAGEALARMS DIALOGEX DISCARDABLE 0, 0, 250, 220 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Ostrzeenia" +CAPTION "Ostrzeżenia" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "Saba bateria",-1,10,15,235,95 - CONTROL "Aktywuj ostrzeenie, kiedy &poziom mocy siga:",IDC_ALARM1, + GROUPBOX "Słaba bateria",-1,10,15,235,95 + CONTROL "Aktywuj ostrzeżenie, kiedy &poziom mocy sięga:",IDC_ALARM1, "Przycisk",BS_AUTOCHECKBOX | WS_TABSTOP,15,25,180,15 LTEXT "nieznany",IDC_ALARMVALUE1,200,25,40,10 LTEXT "0%",-1,20,40,15,15 CONTROL "Slider1",IDC_ALARMBAR1,"msctls_trackbar32",TBS_HORZ | TBS_AUTOTICKS | WS_TABSTOP,30,40,170,15 LTEXT "100%",-1,215,40,25,10 - PUSHBUTTON "Dziaanie &alarmu...",-1,20,70,70,15,WS_DISABLED + PUSHBUTTON "Działanie &alarmu...",-1,20,70,70,15,WS_DISABLED LTEXT "Powiadomienie:",-1,95,70,50,10 LTEXT "Nieznane",IDC_ALARMMSG1,145,70,95,10 - LTEXT "Dziaanie:",-1,95,80,45,10 + LTEXT "Działanie:",-1,95,80,45,10 LTEXT "Nieznane",IDC_ALARMAKTION1,145,80,95,10 LTEXT "Uruchom program:",-1,95,90,50,10 LTEXT "Nieznany",IDC_ALARMPROG1,150,90,40,10 - GROUPBOX "Krytycznie saba bateria",-1,10,115,235,95 - CONTROL "Aktywuj ostrzeenie, kiedy &poziom mocy siga:",IDC_ALARM2, + GROUPBOX "Krytycznie słaba bateria",-1,10,115,235,95 + CONTROL "Aktywuj ostrzeżenie, kiedy &poziom mocy sięga:",IDC_ALARM2, "Przycisk",BS_AUTOCHECKBOX | WS_TABSTOP,15,125,180,15 LTEXT "nieznany",IDC_ALARMVALUE2,200,125,40,10 LTEXT "0%",-1,20,140,15,15 CONTROL "Slider1",IDC_ALARMBAR2,"msctls_trackbar32",TBS_HORZ | TBS_AUTOTICKS | WS_TABSTOP,30,140,170,15 LTEXT "100%",-1,215,140,25,10 - PUSHBUTTON "Dziaanie &alarmu...",-1,20,170,70,15,WS_DISABLED + PUSHBUTTON "Działanie &alarmu...",-1,20,170,70,15,WS_DISABLED LTEXT "Powiadomienie:",-1,95,170,50,10 LTEXT "Nieznane",IDC_ALARMMSG2,145,170,95,10 - LTEXT "Dziaanie:",-1,95,180,45,10 + LTEXT "Działanie:",-1,95,180,45,10 LTEXT "Nieznane",IDC_ALARMAKTION2,145,180,95,10 LTEXT "Uruchom program:",-1,95,190,50,10 LTEXT "Nieznany",IDC_ALARMPROG2,150,190,40,10 @@ -82,22 +84,22 @@ CAPTION "Zaawansowane" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_ACDC,IDI_ACDC,5,5,20,20 - LTEXT "Wybierz, ktrych ustawie oszczdzania energii chcesz uywa.",-1,30,5,205,20 + LTEXT "Wybierz, których ustawień oszczędzania energii chcesz używać.",-1,30,5,205,20 GROUPBOX "Opcje",-1,5,35,225,55 - CONTROL "&Zawsze pokazuj ikon w zasobniku systemowym",IDC_SYSTRAYBATTERYMETER,"Button",BS_AUTOCHECKBOX | + CONTROL "&Zawsze pokazuj ikonę w zasobniku systemowym",IDC_SYSTRAYBATTERYMETER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,45,200,10 - CONTROL "Zapytaj o &haso kiedy komputer powraca ze stanu czuwania",IDC_PASSWORDLOGON,"Button",BS_AUTOCHECKBOX | + CONTROL "Zapytaj o &hasło kiedy komputer powraca ze stanu czuwania",IDC_PASSWORDLOGON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,55,200,10 CONTROL "&Przyciemniaj ekran, kiedy zasilanie z akumulatora",IDC_VIDEODIMDISPLAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,65,200,10 GROUPBOX "Przyciski zasilania",-1,5,100,230,105 - LTEXT "&Kiedy zamykam mj komputer przenony:", IDC_SLIDCLOSE,10,110,210,10 + LTEXT "&Kiedy zamykam mój komputer przenośny:", IDC_SLIDCLOSE,10,110,210,10 COMBOBOX IDC_LIDCLOSE,10,120,220,90,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "K&iedy naciskam wycznik mojego komputera:", IDC_SPOWERBUTTON,10,135,210,10 + LTEXT "K&iedy naciskam przycisk zasilania mojego komputera:", IDC_SPOWERBUTTON,10,135,210,10 COMBOBOX IDC_POWERBUTTON,10,150,220,90,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Ki&edy naciskam przycisk upienia:", IDC_SSLEEPBUTTON,10,165,210,10 + LTEXT "Ki&edy naciskam przycisk uśpienia:", IDC_SSLEEPBUTTON,10,165,210,10 COMBOBOX IDC_SLEEPBUTTON,10,180,220,90,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP END @@ -108,43 +110,43 @@ CAPTION "Hibernacja" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_SCREEN,IDI_SCREEN,5,5,20,20 - LTEXT "Kiedy Twj komputer przechodzi w stan hibernacji caa zawarto pamici jest zrzucana na dysk twardy i komputer jest wyczany. Kiedy komputer budzi si z hibernacji, powraca on do poprzedniego stanu. ", + LTEXT "Kiedy Twój komputer przechodzi w stan hibernacji cała zawartość pamięci jest zrzucana na dysk twardy i komputer jest wyłączany. Kiedy komputer budzi się z hibernacji, powraca on do poprzedniego stanu. ", -1,35,5,195,35 GROUPBOX "Hibernacja",-1,5,45,235,25 - CONTROL "Wcz &hibernacj",IDC_HIBERNATEFILE,"Button",BS_AUTOCHECKBOX | + CONTROL "Włącz &hibernację",IDC_HIBERNATEFILE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,55,210,10 - GROUPBOX "Przestrze dyskowa dla hibernacji",-1,5,80,240,60 - LTEXT "Wolna przestrze dyskowa:",-1,10,90,100,10 + GROUPBOX "Przestrzeń dyskowa dla hibernacji",-1,5,80,240,60 + LTEXT "Wolna przestrzeń dyskowa:",-1,10,90,100,10 LTEXT "Nieznana",IDC_FREESPACE,120,90,70,10 - LTEXT "Przestrze wymagana do hibernacji:",-1,10,100,115,10 + LTEXT "Przestrzeń wymagana do hibernacji:",-1,10,100,115,10 LTEXT "Nieznana",IDC_SPACEFORHIBERNATEFILE,120,100,55,10 - LTEXT "Musisz zwolni nieco miejsca na dysku przed przejciem w stan hibernacji. ",IDC_TOLESSFREESPACE,10,115,220,20 + LTEXT "Musisz zwolnić więcej miejsca na dysku przed przejściem w stan hibernacji. ",IDC_TOLESSFREESPACE,10,115,220,20 END STRINGTABLE BEGIN IDS_CPLNAME_1 "Opcje zasilania" - IDS_CPLDESCRIPTION_1 "Konfiguracja ustawie oszczdzania energii dla Twojego komputera." + IDS_CPLDESCRIPTION_1 "Konfiguracja ustawień oszczędzania energii dla Twojego komputera." IDS_PROCENT "%i%%" - IDS_SOUND "Dwik" + IDS_SOUND "Dźwięk" IDS_TEXT "Tekst" IDS_CONFIG1 "Ustawienia dla schematu %1" IDS_CONFIG2 "Zaawansowane ustawienia dla %1" - IDS_SIZEBYTS "%i bajtw" + IDS_SIZEBYTS "%i bajtów" IDS_SIZEMB "%i MB" - IDS_NOACTION "Nie rb nic" + IDS_NOACTION "Nie rób nic" IDS_PowerActionNone1 "Brak akcji" IDS_PowerActionUnknown "Nieznana" - IDS_PowerActionSleep "Przejd w stan czuwania" + IDS_PowerActionSleep "Przejdź w stan czuwania" IDS_PowerActionHibernate "Hibernuj" IDS_PowerActionShutdown "Zamknij" IDS_PowerActionRestart "Uruchom ponownie" - IDS_PowerActionShutdownOff "Zamknij i wycz" - IDS_PowerActionWarmEject "Zapytaj co zrobi" - IDS_PowerActionNone2 "Nic nie rb" + IDS_PowerActionShutdownOff "Zamknij i wyłącz" + IDS_PowerActionWarmEject "Zapytaj co zrobić" + IDS_PowerActionNone2 "Nic nie rób" IDS_TIMEOUT1 "Po 1 minucie" IDS_TIMEOUT2 "Po 2 minutach" @@ -163,9 +165,6 @@ BEGIN IDS_TIMEOUT15 "Po 5 godzinach" IDS_TIMEOUT16 "Nigdy" - IDS_DEL_SCHEME "Czy na pewno chcesz skasowa schemat oszczdzania energii?" + IDS_DEL_SCHEME "Czy na pewno chcesz skasować schemat oszczędzania energii?" IDS_DEL_SCHEME_TITLE "Skasuj schemat" END - - - diff --git a/dll/cpl/powercfg/lang/ro-RO.rc b/dll/cpl/powercfg/lang/ro-RO.rc index 26be69be6e4..c05aafaf235 100644 --- a/dll/cpl/powercfg/lang/ro-RO.rc +++ b/dll/cpl/powercfg/lang/ro-RO.rc @@ -2,8 +2,6 @@ LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL -#pragma code_page(65001) - IDD_PROPPAGEPOWERSHEMES DIALOGEX 0, 0, 252, 237 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION CAPTION "Scheme de alimentare" @@ -164,5 +162,3 @@ BEGIN IDS_DEL_SCHEME "Sunteți sigur că vreți să eliminați această schemă?" IDS_DEL_SCHEME_TITLE "Eliminare schemă" END - -#pragma code_page(default) diff --git a/dll/cpl/powercfg/lang/ru-RU.rc b/dll/cpl/powercfg/lang/ru-RU.rc index 907ffec174d..3cb3f9b5f5e 100644 --- a/dll/cpl/powercfg/lang/ru-RU.rc +++ b/dll/cpl/powercfg/lang/ru-RU.rc @@ -4,160 +4,160 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT IDD_PROPPAGEPOWERSHEMES DIALOGEX 0, 0, 250, 220 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Схемы управления питанием" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_ACDC, IDI_ACDC, 5,5,32,32 - LTEXT " . .", + LTEXT "Выберите схему управления электропитанием с наиболее подходящими параметрами для этого компьютера. Изменение нижеследующих параметров изменит выбранную схему.", -1,37,5,194,36 - GROUPBOX "& ", -1, 7,57,240,46 + GROUPBOX "&Схемы управления питанием", -1, 7,57,240,46 COMBOBOX IDC_ENERGYLIST, 14,70,224,92, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON " &...", IDC_SAVEAS_BTN, 103,85,75,15,WS_DISABLED - PUSHBUTTON "&", IDC_DELETE_BTN, 183,85,55,15,WS_DISABLED - GROUPBOX " ", IDC_GRPDETAIL, 7,108,240,105 - LTEXT " :",IDC_SAT,15,120,60,10 - LTEXT " ",IDC_SAC,113,120,45,15 + PUSHBUTTON "Сохранить &как...", IDC_SAVEAS_BTN, 103,85,75,15,WS_DISABLED + PUSHBUTTON "&Удалить", IDC_DELETE_BTN, 183,85,55,15,WS_DISABLED + GROUPBOX "Нет данных", IDC_GRPDETAIL, 7,108,240,105 + LTEXT "При питании:",IDC_SAT,15,120,60,10 + LTEXT "от сети",IDC_SAC,113,120,45,15 ICON IDI_AC, IDC_IAC, 85,115,25,15 - LTEXT " ",IDC_SDC,190,120,45,15 + LTEXT "от батарей",IDC_SDC,190,120,45,15 ICON IDI_DC, IDC_IDC, 165,115,25,15 - LTEXT " &:",IDC_MONITOR,15,142,80,10 + LTEXT "Отключить &монитор:",IDC_MONITOR,15,142,80,10 COMBOBOX IDC_MONITORACLIST, 100,140,65,150, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_MONITORDCLIST, 175,140,65,150, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT " &:",IDC_DISK,15,157,80,10 + LTEXT "Отключить &диски:",IDC_DISK,15,157,80,10 COMBOBOX IDC_DISKACLIST, 100,155,65,150, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_DISKDCLIST, 175,155,65,150, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "& :",IDC_STANDBY,15,177,80,10 + LTEXT "&Ждущий режим через:",IDC_STANDBY,15,177,80,10 COMBOBOX IDC_STANDBYACLIST, 100,175,65,150, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_STANDBYDCLIST, 175,175,65,150, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "& :",IDC_HYBERNATE,15,192,80,10 + LTEXT "С&пящий режим через:",IDC_HYBERNATE,15,192,80,10 COMBOBOX IDC_HYBERNATEACLIST, 100,190,65,150, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_HYBERNATEDCLIST, 175,190,65,150, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP END IDD_PROPPAGEALARMS DIALOGEX DISCARDABLE 0, 0, 250, 220 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "" +CAPTION "Уведомления" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ",-1,10,15,235,95 - CONTROL " & :",IDC_ALARM1, + GROUPBOX "Сигнал низкого заряда батарей",-1,10,15,235,95 + CONTROL "Включить сигнал н&изкого заряда при уровне:",IDC_ALARM1, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,25,180,15 - LTEXT " ",IDC_ALARMVALUE1,200,25,40,10 + LTEXT "Нет данных",IDC_ALARMVALUE1,200,25,40,10 LTEXT "0%",-1,20,40,15,15 CONTROL "Slider1",IDC_ALARMBAR1,"msctls_trackbar32",TBS_HORZ | TBS_AUTOTICKS | WS_TABSTOP,30,40,170,15 LTEXT "100%",-1,215,40,25,10 - PUSHBUTTON "&...",-1,20,70,70,15,WS_DISABLED - LTEXT ":",-1,95,70,50,10 - LTEXT " ",IDC_ALARMMSG1,145,70,95,10 - LTEXT ":",-1,95,80,45,10 - LTEXT " ",IDC_ALARMAKTION1,145,80,95,10 - LTEXT " :",-1,95,90,50,10 - LTEXT " ",IDC_ALARMPROG1,150,90,40,10 + PUSHBUTTON "Д&ействие...",-1,20,70,70,15,WS_DISABLED + LTEXT "Уведомление:",-1,95,70,50,10 + LTEXT "Нет данных",IDC_ALARMMSG1,145,70,95,10 + LTEXT "Действие:",-1,95,80,45,10 + LTEXT "Нет данных",IDC_ALARMAKTION1,145,80,95,10 + LTEXT "Запуск программы:",-1,95,90,50,10 + LTEXT "Нет данных",IDC_ALARMPROG1,150,90,40,10 - GROUPBOX " ",-1,10,115,235,95 - CONTROL " & :",IDC_ALARM2, + GROUPBOX "Сигнал критически низкого заряда батарей",-1,10,115,235,95 + CONTROL "Включить такой &сигнал при уровне:",IDC_ALARM2, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,125,180,15 - LTEXT " ",IDC_ALARMVALUE2,200,125,40,10 + LTEXT "Нет данных",IDC_ALARMVALUE2,200,125,40,10 LTEXT "0%",-1,20,140,15,15 CONTROL "Slider1",IDC_ALARMBAR2,"msctls_trackbar32",TBS_HORZ | TBS_AUTOTICKS | WS_TABSTOP,30,140,170,15 LTEXT "100%",-1,215,140,25,10 - PUSHBUTTON "&...",-1,20,170,70,15,WS_DISABLED - LTEXT ":",-1,95,170,50,10 - LTEXT " ",IDC_ALARMMSG2,145,170,95,10 - LTEXT ":",-1,95,180,45,10 - LTEXT " ",IDC_ALARMAKTION2,145,180,95,10 - LTEXT " :",-1,95,190,50,10 - LTEXT " ",IDC_ALARMPROG2,150,190,40,10 + PUSHBUTTON "Де&йствие...",-1,20,170,70,15,WS_DISABLED + LTEXT "Уведомление:",-1,95,170,50,10 + LTEXT "Нет данных",IDC_ALARMMSG2,145,170,95,10 + LTEXT "Действие:",-1,95,180,45,10 + LTEXT "Нет данных",IDC_ALARMAKTION2,145,180,95,10 + LTEXT "Запуск программы:",-1,95,190,50,10 + LTEXT "Нет данных",IDC_ALARMPROG2,150,190,40,10 END IDD_PROPPAGEADVANCED DIALOGEX DISCARDABLE 0, 0, 250, 220 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "" +CAPTION "Дополнительно" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_ACDC,IDI_ACDC,5,5,32,32 - LTEXT " .",-1,37,5,205,20 - GROUPBOX "",-1,5,35,225,55 - CONTROL "& ",IDC_SYSTRAYBATTERYMETER,"Button",BS_AUTOCHECKBOX | + LTEXT "Выберите желаемые параметры энергосбережения.",-1,37,5,205,20 + GROUPBOX "Параметры",-1,5,35,225,55 + CONTROL "&Всегда отображать значок на панели задач",IDC_SYSTRAYBATTERYMETER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,48,200,10 - CONTROL "& ",IDC_PASSWORDLOGON,"Button",BS_AUTOCHECKBOX | + CONTROL "&Запрашивать пароль при выходе из ждущего режима",IDC_PASSWORDLOGON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,60,200,10 - CONTROL "& ",IDC_VIDEODIMDISPLAY,"Button",BS_AUTOCHECKBOX | + CONTROL "&Снизить яркость монитора при работе от батарей",IDC_VIDEODIMDISPLAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,72,200,10 - GROUPBOX " ",-1,5,100,230,105 - LTEXT "& :", IDC_SLIDCLOSE,10,110,210,10 + GROUPBOX "Кнопки питания",-1,5,100,230,105 + LTEXT "&При закрытии крышки переносного компьютера:", IDC_SLIDCLOSE,10,110,210,10 COMBOBOX IDC_LIDCLOSE,10,120,220,90,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT " & :", IDC_SPOWERBUTTON,10,140,210,10 + LTEXT "При &нажатии кнопки включения питания компьютера:", IDC_SPOWERBUTTON,10,140,210,10 COMBOBOX IDC_POWERBUTTON,10,150,220,90,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT " & :", IDC_SSLEEPBUTTON,10,170,210,10 + LTEXT "При нажатии &кнопки перехода в спящий режим:", IDC_SSLEEPBUTTON,10,170,210,10 COMBOBOX IDC_SLEEPBUTTON,10,180,220,90,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP END IDD_PROPPAGEHIBERNATE DIALOGEX DISCARDABLE 0, 0, 250, 220 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Спящий режим" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_SCREEN,IDI_SCREEN,5,5,32,32 - LTEXT " . .", + LTEXT "При переходе в спящий режим компьютер переносит содержимое оперативной памяти на диск и выключается. При выходе из спящего режима компьютер возвращается в прежнее состояние.", -1,37,5,195,35 - GROUPBOX " ",-1,5,57,235,25 - CONTROL "& ",IDC_HIBERNATEFILE,"Button",BS_AUTOCHECKBOX | + GROUPBOX "Спящий режим",-1,5,57,235,25 + CONTROL "&Разрешить переход в спящий режим",IDC_HIBERNATEFILE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,67,210,10 - GROUPBOX " ",-1,5,92,240,60 - LTEXT " :",-1,10,102,100,10 - LTEXT " ",IDC_FREESPACE,130,102,70,10 - LTEXT " :",-1,10,112,115,10 - LTEXT " ",IDC_SPACEFORHIBERNATEFILE,130,112,55,10 - LTEXT " .",IDC_TOLESSFREESPACE,10,127,220,20 + GROUPBOX "Место на диске для перехода в спящий режим",-1,5,92,240,60 + LTEXT "Свободно места на диске:",-1,10,102,100,10 + LTEXT "Нет данных",IDC_FREESPACE,130,102,70,10 + LTEXT "Требуется для спящего режима:",-1,10,112,115,10 + LTEXT "Нет данных",IDC_SPACEFORHIBERNATEFILE,130,112,55,10 + LTEXT "Для возможности перехода в спящий режим требуется освободить место на диске.",IDC_TOLESSFREESPACE,10,127,220,20 END STRINGTABLE BEGIN - IDS_CPLNAME_1 "" - IDS_CPLDESCRIPTION_1 " ." + IDS_CPLNAME_1 "Электропитание" + IDS_CPLDESCRIPTION_1 "Настройка параметров энергосбережения для компьютера." IDS_PROCENT "%i%%" - IDS_SOUND "" - IDS_TEXT "" - IDS_CONFIG1 " %1" - IDS_CONFIG2 " %1" + IDS_SOUND "Звук" + IDS_TEXT "Текст" + IDS_CONFIG1 "Параметры схемы %1" + IDS_CONFIG2 "Дополнительные параметры схемы %1" - IDS_SIZEBYTS "%i " - IDS_SIZEMB "%i " + IDS_SIZEBYTS "%i байт" + IDS_SIZEMB "%i МБ" - IDS_NOACTION " " + IDS_NOACTION "Не делать ничего" - IDS_PowerActionNone1 " " - IDS_PowerActionUnknown " " - IDS_PowerActionSleep " " - IDS_PowerActionHibernate " " - IDS_PowerActionShutdown " " - IDS_PowerActionRestart "" - IDS_PowerActionShutdownOff " " - IDS_PowerActionWarmEject " " - IDS_PowerActionNone2 "" + IDS_PowerActionNone1 "Действие не требуется" + IDS_PowerActionUnknown "Нет данных" + IDS_PowerActionSleep "Ждущий режим" + IDS_PowerActionHibernate "Спящий режим" + IDS_PowerActionShutdown "Завершение работы" + IDS_PowerActionRestart "Перезагрузка" + IDS_PowerActionShutdownOff "Завершение работы и выключение питания" + IDS_PowerActionWarmEject "Спросить о нужном действии" + IDS_PowerActionNone2 "Отсутствует" - IDS_TIMEOUT1 " 1 " - IDS_TIMEOUT2 " 2 " - IDS_TIMEOUT3 " 3 " - IDS_TIMEOUT4 " 5 " - IDS_TIMEOUT5 " 10 " - IDS_TIMEOUT6 " 15 " - IDS_TIMEOUT7 " 20 " - IDS_TIMEOUT8 " 25 " - IDS_TIMEOUT9 " 30 " - IDS_TIMEOUT10 " 45 " - IDS_TIMEOUT11 " 1 " - IDS_TIMEOUT12 " 2 " - IDS_TIMEOUT13 " 3 " - IDS_TIMEOUT14 " 4 " - IDS_TIMEOUT15 " 5 " - IDS_TIMEOUT16 "" + IDS_TIMEOUT1 "через 1 мин" + IDS_TIMEOUT2 "через 2 мин" + IDS_TIMEOUT3 "через 3 мин" + IDS_TIMEOUT4 "через 5 мин" + IDS_TIMEOUT5 "через 10 мин" + IDS_TIMEOUT6 "через 15 мин" + IDS_TIMEOUT7 "через 20 мин" + IDS_TIMEOUT8 "через 25 мин" + IDS_TIMEOUT9 "через 30 мин" + IDS_TIMEOUT10 "через 45 мин" + IDS_TIMEOUT11 "через 1 час" + IDS_TIMEOUT12 "через 2 часа" + IDS_TIMEOUT13 "через 3 часа" + IDS_TIMEOUT14 "через 4 часа" + IDS_TIMEOUT15 "через 5 часов" + IDS_TIMEOUT16 "никогда" IDS_DEL_SCHEME "Are you sure you want to delete the power scheme?" IDS_DEL_SCHEME_TITLE "Delete Scheme" diff --git a/dll/cpl/powercfg/lang/uk-UA.rc b/dll/cpl/powercfg/lang/uk-UA.rc index d2a728b4b73..a9d32ed5a58 100644 --- a/dll/cpl/powercfg/lang/uk-UA.rc +++ b/dll/cpl/powercfg/lang/uk-UA.rc @@ -10,163 +10,163 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT IDD_PROPPAGEPOWERSHEMES DIALOGEX 0, 0, 252, 237 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Схеми керування живленням" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_ACDC, IDI_ACDC, 7, 7, 28, 22 - LTEXT " ' . , .", + LTEXT "Виберіть схему керування живленням із найбільш прийнятними для цього комп'ютера параметрами. Якщо змінити нижченаведені параметри, вибрана схема також зміниться.", -1,37, 6, 209, 36 - GROUPBOX "& ", -1, 6, 43, 240, 50 + GROUPBOX "&Схеми керування живленням", -1, 6, 43, 240, 50 COMBOBOX IDC_ENERGYLIST, 14, 54, 224, 92, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL - PUSHBUTTON " &...", IDC_SAVEAS_BTN, 109, 72, 70, 14, WS_DISABLED - PUSHBUTTON "&", IDC_DELETE_BTN, 183, 72, 55, 14, WS_DISABLED - GROUPBOX " ", IDC_GRPDETAIL, 6, 95, 240, 136 - LTEXT " :",IDC_SAT, 12, 109, 60, 12 - LTEXT " ",IDC_SAC, 123, 110, 45, 15 + PUSHBUTTON "Зберегти &як...", IDC_SAVEAS_BTN, 109, 72, 70, 14, WS_DISABLED + PUSHBUTTON "В&идалити", IDC_DELETE_BTN, 183, 72, 55, 14, WS_DISABLED + GROUPBOX "Немає даних", IDC_GRPDETAIL, 6, 95, 240, 136 + LTEXT "При живленні:",IDC_SAT, 12, 109, 60, 12 + LTEXT "від мережі",IDC_SAC, 123, 110, 45, 15 ICON IDI_AC, IDC_IAC, 97, 108, 21, 20 - LTEXT " ",IDC_SDC, 195, 110, 45, 15 + LTEXT "від батарей",IDC_SDC, 195, 110, 45, 15 ICON IDI_DC, IDC_IDC, 170, 108, 21, 20 - LTEXT " &:",IDC_MONITOR, 13, 148, 84, 10 + LTEXT "Вимкнення дисп&лея:",IDC_MONITOR, 13, 148, 84, 10 COMBOBOX IDC_MONITORACLIST, 100, 145, 65, 150, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_MONITORDCLIST, 173, 145, 65, 150, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "& :",IDC_DISK, 13, 171, 84, 10 + LTEXT "&Вимкнення дисків:",IDC_DISK, 13, 171, 84, 10 COMBOBOX IDC_DISKACLIST, 100, 167, 65, 150, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_DISKDCLIST, 173, 167, 65, 150, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "& :",IDC_STANDBY, 13, 191, 84, 10 + LTEXT "Ре&жим очікування:",IDC_STANDBY, 13, 191, 84, 10 COMBOBOX IDC_STANDBYACLIST, 100, 188, 65, 150, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_STANDBYDCLIST, 173, 188, 65, 150, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "& :",IDC_HYBERNATE, 13, 212, 84, 10 + LTEXT "С&плячий режим:",IDC_HYBERNATE, 13, 212, 84, 10 COMBOBOX IDC_HYBERNATEACLIST, 100, 209, 65, 150, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_HYBERNATEDCLIST, 173, 209, 65, 150, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP END IDD_PROPPAGEALARMS DIALOGEX DISCARDABLE 0, 0, 250, 220 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "" +CAPTION "Сигналізація" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ",-1,10,15,235,95 - CONTROL "& , :",IDC_ALARM1, + GROUPBOX "Сигнал значної розрядки батарей",-1,10,15,235,95 + CONTROL "Подават&и сигнал, якщо рівень живлення досягає:",IDC_ALARM1, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,25,180,15 - LTEXT " ",IDC_ALARMVALUE1,200,25,40,10 + LTEXT "немає даних",IDC_ALARMVALUE1,200,25,40,10 LTEXT "0%",-1,20,40,15,15 CONTROL "Slider1",IDC_ALARMBAR1,"msctls_trackbar32",TBS_HORZ | TBS_AUTOTICKS | WS_TABSTOP,30,40,170,15 LTEXT "100%",-1,215,40,25,10 - PUSHBUTTON "&ij...",-1,20,70,70,15,WS_DISABLED - LTEXT ":",-1,95,70,50,10 - LTEXT " ",IDC_ALARMMSG1,145,70,95,10 - LTEXT "ij:",-1,95,80,45,10 - LTEXT " ",IDC_ALARMAKTION1,145,80,95,10 - LTEXT " :",-1,95,90,50,10 - LTEXT " ",IDC_ALARMPROG1,150,90,40,10 + PUSHBUTTON "&Дія...",-1,20,70,70,15,WS_DISABLED + LTEXT "Сповіщення:",-1,95,70,50,10 + LTEXT "Немає даних",IDC_ALARMMSG1,145,70,95,10 + LTEXT "Дія:",-1,95,80,45,10 + LTEXT "Немає даних",IDC_ALARMAKTION1,145,80,95,10 + LTEXT "Запуск програми:",-1,95,90,50,10 + LTEXT "Немає даних",IDC_ALARMPROG1,150,90,40,10 - GROUPBOX " ",-1,10,115,235,95 - CONTROL " &, :",IDC_ALARM2, + GROUPBOX "Сигнал критичної розрядки батарей",-1,10,115,235,95 + CONTROL "Подавати &сигнал, якщо рівень живлення досягає:",IDC_ALARM2, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,125,180,15 - LTEXT " ",IDC_ALARMVALUE2,200,125,40,10 + LTEXT "немає даних",IDC_ALARMVALUE2,200,125,40,10 LTEXT "0%",-1,20,140,15,15 CONTROL "Slider1",IDC_ALARMBAR2,"msctls_trackbar32",TBS_HORZ | TBS_AUTOTICKS | WS_TABSTOP,30,140,170,15 LTEXT "100%",-1,215,140,25,10 - PUSHBUTTON "&ij...",-1,20,170,70,15,WS_DISABLED - LTEXT ":",-1,95,170,50,10 - LTEXT " ",IDC_ALARMMSG2,145,170,95,10 - LTEXT "ij:",-1,95,180,45,10 - LTEXT " ",IDC_ALARMAKTION2,145,180,95,10 - LTEXT " :",-1,95,190,50,10 - LTEXT " ",IDC_ALARMPROG2,150,190,40,10 + PUSHBUTTON "&Дія...",-1,20,170,70,15,WS_DISABLED + LTEXT "Сповіщення:",-1,95,170,50,10 + LTEXT "Немає даних",IDC_ALARMMSG2,145,170,95,10 + LTEXT "Дія:",-1,95,180,45,10 + LTEXT "Немає даних",IDC_ALARMAKTION2,145,180,95,10 + LTEXT "Запуск програми:",-1,95,190,50,10 + LTEXT "Немає даних",IDC_ALARMPROG2,150,190,40,10 END IDD_PROPPAGEADVANCED DIALOGEX DISCARDABLE 0, 0, 250, 220 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "" +CAPTION "Додатково" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_ACDC,IDI_ACDC,5,5,20,20 - LTEXT " .",-1,30,5,205,20 - GROUPBOX "",-1,5,35,225,55 - CONTROL "& ",IDC_SYSTRAYBATTERYMETER,"Button",BS_AUTOCHECKBOX | + LTEXT "Виберіть бажані параметри енергозбереження.",-1,30,5,205,20 + GROUPBOX "Параметри",-1,5,35,225,55 + CONTROL "За&вжди показувати значок на панелі завдань",IDC_SYSTRAYBATTERYMETER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,45,200,10 - CONTROL "& ",IDC_PASSWORDLOGON,"Button",BS_AUTOCHECKBOX | + CONTROL "&Запитувати пароль при виході з режиму очікування",IDC_PASSWORDLOGON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,55,200,10 - CONTROL "& .",IDC_VIDEODIMDISPLAY,"Button",BS_AUTOCHECKBOX | + CONTROL "З&меншити яскравість монітора в разі живлення від батарей.",IDC_VIDEODIMDISPLAY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,65,200,10 - GROUPBOX " ",-1,5,100,230,105 - LTEXT "& & ':", IDC_SLIDCLOSE,10,110,210,10 + GROUPBOX "Кнопки живлення",-1,5,100,230,105 + LTEXT "&При закритті кришки &портативного комп'ютера:", IDC_SLIDCLOSE,10,110,210,10 COMBOBOX IDC_LIDCLOSE,10,120,220,90,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT " & ':", IDC_SPOWERBUTTON,10,135,210,10 + LTEXT "При нат&исненні вимикача живлення на моєму комп'ютері:", IDC_SPOWERBUTTON,10,135,210,10 COMBOBOX IDC_POWERBUTTON,10,150,220,90,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT " & :", IDC_SSLEEPBUTTON,10,165,210,10 + LTEXT "При нати&сненні кнопки переходу до сплячого режиму:", IDC_SSLEEPBUTTON,10,165,210,10 COMBOBOX IDC_SLEEPBUTTON,10,180,220,90,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP END IDD_PROPPAGEHIBERNATE DIALOGEX DISCARDABLE 0, 0, 250, 220 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Сплячий режим" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_SCREEN,IDI_SCREEN,5,5,20,20 - LTEXT " ' , ' . , ' . ", + LTEXT "Коли комп'ютер переходить до сплячого режиму, увесь вміст пам'яті записується на жорсткий диск і робота завершується. Виходячи зі сплячого режиму, комп'ютер повертається до попереднього стану. ", -1,35,5,195,35 - GROUPBOX " ",-1,5,45,235,25 - CONTROL " &",IDC_HIBERNATEFILE,"Button",BS_AUTOCHECKBOX | + GROUPBOX "Сплячий режим",-1,5,45,235,25 + CONTROL "Дозволити сплячий &режим",IDC_HIBERNATEFILE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,55,210,10 - GROUPBOX "̳ ",-1,5,80,240,60 - LTEXT " :",-1,10,90,100,10 - LTEXT " ",IDC_FREESPACE,120,90,70,10 - LTEXT " :",-1,10,100,115,10 - LTEXT " ",IDC_SPACEFORHIBERNATEFILE,120,100,55,10 - LTEXT " ' . ",IDC_TOLESSFREESPACE,10,115,220,20 + GROUPBOX "Місце на диску для сплячого режиму",-1,5,80,240,60 + LTEXT "Доступно на диску:",-1,10,90,100,10 + LTEXT "немає даних",IDC_FREESPACE,120,90,70,10 + LTEXT "Для сплячого режиму потрібно:",-1,10,100,115,10 + LTEXT "Немає даних",IDC_SPACEFORHIBERNATEFILE,120,100,55,10 + LTEXT "Перед переведенням комп'ютера до сплячого режиму слід звільнити місце на диску. ",IDC_TOLESSFREESPACE,10,115,220,20 END STRINGTABLE BEGIN - IDS_CPLNAME_1 "" - IDS_CPLDESCRIPTION_1 " '." + IDS_CPLNAME_1 "Електроживлення" + IDS_CPLDESCRIPTION_1 "Налаштування параметрів енергозбереження для комп'ютера." IDS_PROCENT "%i%%" - IDS_SOUND "" - IDS_TEXT "" - IDS_CONFIG1 " %1" - IDS_CONFIG2 " %1" + IDS_SOUND "Звук" + IDS_TEXT "Текст" + IDS_CONFIG1 "Налаштування схеми живлення %1" + IDS_CONFIG2 "Додаткові налаштування для %1" - IDS_SIZEBYTS "%i " - IDS_SIZEMB "%i " + IDS_SIZEBYTS "%i байт" + IDS_SIZEMB "%i МБ" - IDS_NOACTION " " + IDS_NOACTION "Не робити нічого" - IDS_PowerActionNone1 "ij " - IDS_PowerActionUnknown " " - IDS_PowerActionSleep " " - IDS_PowerActionHibernate " " - IDS_PowerActionShutdown " " - IDS_PowerActionRestart "" - IDS_PowerActionShutdownOff " " - IDS_PowerActionWarmEject ", " - IDS_PowerActionNone2 "³" + IDS_PowerActionNone1 "Дія не потрібна" + IDS_PowerActionUnknown "Немає даних" + IDS_PowerActionSleep "Перехід до очікування" + IDS_PowerActionHibernate "Перехід до сплячого режиму" + IDS_PowerActionShutdown "Завершення роботи" + IDS_PowerActionRestart "Перезавантаження" + IDS_PowerActionShutdownOff "Завершення роботи і вимкнення живлення" + IDS_PowerActionWarmEject "Запитувати, що слід зробити" + IDS_PowerActionNone2 "Відсутня" - IDS_TIMEOUT1 " 1 " - IDS_TIMEOUT2 " 2 " - IDS_TIMEOUT3 " 3 " - IDS_TIMEOUT4 " 5 " - IDS_TIMEOUT5 " 10 " - IDS_TIMEOUT6 " 15 " - IDS_TIMEOUT7 " 20 " - IDS_TIMEOUT8 " 25 " - IDS_TIMEOUT9 " 30 " - IDS_TIMEOUT10 " 45 " - IDS_TIMEOUT11 " 1 " - IDS_TIMEOUT12 " 2 " - IDS_TIMEOUT13 " 3 " - IDS_TIMEOUT14 " 4 " - IDS_TIMEOUT15 " 5 " - IDS_TIMEOUT16 "" + IDS_TIMEOUT1 "через 1 хв" + IDS_TIMEOUT2 "через 2 хв" + IDS_TIMEOUT3 "через 3 хв" + IDS_TIMEOUT4 "через 5 хв" + IDS_TIMEOUT5 "через 10 хв" + IDS_TIMEOUT6 "через 15 хв" + IDS_TIMEOUT7 "через 20 хв" + IDS_TIMEOUT8 "через 25 хв" + IDS_TIMEOUT9 "через 30 хв" + IDS_TIMEOUT10 "через 45 хв" + IDS_TIMEOUT11 "через 1 годину" + IDS_TIMEOUT12 "через 2 години" + IDS_TIMEOUT13 "через 3 години" + IDS_TIMEOUT14 "через 4 години" + IDS_TIMEOUT15 "через 5 годин" + IDS_TIMEOUT16 "ніколи" - IDS_DEL_SCHEME " ?" - IDS_DEL_SCHEME_TITLE " " + IDS_DEL_SCHEME "Ви дійсно бажаєте видалити схему керування електроживленням?" + IDS_DEL_SCHEME_TITLE "Видалення схеми" END diff --git a/dll/cpl/powercfg/powercfg.c b/dll/cpl/powercfg/powercfg.c index af764b2a17b..28c7b84f5a0 100644 --- a/dll/cpl/powercfg/powercfg.c +++ b/dll/cpl/powercfg/powercfg.c @@ -10,13 +10,6 @@ * Dmitry Chapyshev (lentind@yandex.ru) */ -#include -#include -#include -#include -#include - -#include "resource.h" #include "powercfg.h" #define NUM_APPLETS (1) diff --git a/dll/cpl/powercfg/powercfg.h b/dll/cpl/powercfg/powercfg.h index 27b54e596a8..c5997889204 100644 --- a/dll/cpl/powercfg/powercfg.h +++ b/dll/cpl/powercfg/powercfg.h @@ -1,6 +1,16 @@ -#pragma once +#include "ntstatus.h" +#define WIN32_NO_STATUS +#include + +#include +#include +#include +#include +#include +#include #include "powrprof.h" +#include "resource.h" typedef struct { diff --git a/dll/cpl/powercfg/powercfg.rbuild b/dll/cpl/powercfg/powercfg.rbuild index 9e53839dc2e..14f44a1a7c7 100644 --- a/dll/cpl/powercfg/powercfg.rbuild +++ b/dll/cpl/powercfg/powercfg.rbuild @@ -15,4 +15,5 @@ advanced.c hibernate.c powercfg.rc + powercfg.h diff --git a/dll/cpl/powercfg/powershemes.c b/dll/cpl/powercfg/powershemes.c index cf8ced7e80b..05037de508c 100644 --- a/dll/cpl/powercfg/powershemes.c +++ b/dll/cpl/powercfg/powershemes.c @@ -10,13 +10,7 @@ * Dmitry Chapyshev (lentind@yandex.ru) */ -#include -#include -#include -#include -#include "resource.h" #include "powercfg.h" -#include "stdio.h" UINT Sec[]= { diff --git a/dll/cpl/powercfg/rsrc.rc b/dll/cpl/powercfg/rsrc.rc index f9e7669231e..a98245f11e5 100644 --- a/dll/cpl/powercfg/rsrc.rc +++ b/dll/cpl/powercfg/rsrc.rc @@ -13,10 +13,13 @@ #include "lang/ja-JP.rc" #include "lang/nl-NL.rc" #include "lang/no-NO.rc" +#include "lang/sk-SK.rc" +#include "lang/th-TH.rc" +#include "lang/zh-CN.rc" + +// UTF-8 +#pragma code_page(65001) #include "lang/pl-PL.rc" #include "lang/ro-RO.rc" #include "lang/ru-RU.rc" -#include "lang/sk-SK.rc" -#include "lang/th-TH.rc" #include "lang/uk-UA.rc" -#include "lang/zh-CN.rc" diff --git a/dll/cpl/sysdm/CMakeLists.txt b/dll/cpl/sysdm/CMakeLists.txt index 14c585c0044..fb98ed6fa25 100644 --- a/dll/cpl/sysdm/CMakeLists.txt +++ b/dll/cpl/sysdm/CMakeLists.txt @@ -18,7 +18,7 @@ list(APPEND SOURCE sysdm.rc ${CMAKE_CURRENT_BINARY_DIR}/sysdm.def) -add_library(sysdm SHARED ${CMAKE_CURRENT_BINARY_DIR}/sysdm_precomp.h.gch ${SOURCE}) +add_library(sysdm SHARED ${SOURCE}) set_module_type(sysdm cpl) @@ -37,5 +37,5 @@ add_importlibs(sysdm kernel32 ntdll) -add_pch(sysdm ${CMAKE_CURRENT_SOURCE_DIR}/precomp.h ${SOURCE}) +add_pch(sysdm precomp.h) add_cd_file(TARGET sysdm DESTINATION reactos/system32 FOR all) diff --git a/dll/cpl/sysdm/lang/pl-PL.rc b/dll/cpl/sysdm/lang/pl-PL.rc index 91f7db5ed4c..6f038e54aa1 100644 --- a/dll/cpl/sysdm/lang/pl-PL.rc +++ b/dll/cpl/sysdm/lang/pl-PL.rc @@ -1,14 +1,17 @@ /* -* translated by xrogers -* xxrogers@users.sourceforge.net -* https://sourceforge.net/projects/reactospl -* updated by Caemyr - Olaf Siejka (Jan, 2008) -*/ + * translated by xrogers + * xxrogers@users.sourceforge.net + * https://sourceforge.net/projects/reactospl + * updated by Caemyr - Olaf Siejka (Jan, 2008) + * UTF-8 conversion by Caemyr (May, 2011) + * updated by Saibamen - Adam Stachowicz (saibamenppl@gmail.com) (August, 2011) + */ + LANGUAGE LANG_POLISH, SUBLANG_DEFAULT IDD_PROPPAGEGENERAL DIALOGEX 0, 0, 256, 218 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Oglne" +CAPTION "Ogólne" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN CONTROL "", IDC_ROSIMG, "Static", SS_OWNERDRAW, 4, 5, 248, 111 @@ -23,30 +26,30 @@ BEGIN LTEXT "", IDC_MACHINELINE3, 130, 162, 118, 9 LTEXT "", IDC_MACHINELINE4, 130, 171, 118, 9 LTEXT "", IDC_MACHINELINE5, 130, 180, 118, 9 - CONTROL "Odwied Stron domow ReactOS", IDC_ROSHOMEPAGE_LINK, "SysLink", WS_CHILD | WS_VISIBLE | WS_TABSTOP, 20, 200, 123, 8 - PUSHBUTTON "Wywietl &licencj...", IDC_LICENCE, 170, 199, 78, 14 + CONTROL "Odwiedź Stronę domową ReactOS", IDC_ROSHOMEPAGE_LINK, "SysLink", WS_CHILD | WS_VISIBLE | WS_TABSTOP, 20, 200, 123, 8 + PUSHBUTTON "Wyświetl &licencję...", IDC_LICENCE, 170, 199, 78, 14 END IDD_PROPPAGEHARDWARE DIALOGEX 0, 0, 256, 218 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Sprzt" +CAPTION "Sprzęt" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - GROUPBOX "Meneder urzdze", IDC_STATIC, 6, 7, 244, 61 + GROUPBOX "Menedżer urządzeń", IDC_STATIC, 6, 7, 244, 61 ICON IDI_DEVMGR, IDC_STATIC, 12, 18, 23, 21, SS_ICON - LTEXT "Meneder urzdze wywietla wszystkie urzdzenia sprztowe zainstalowane w komputerze. Moesz uy Menedera urzdze, aby zmieni waciwoci kadego urzdzenia.", IDC_STATIC, 42, 18, 204, 24 - PUSHBUTTON "&Meneder urzdze", IDC_HARDWARE_DEVICE_MANAGER, 154, 48, 90, 14 + LTEXT "Menedżer urządzeń wyświetla wszystkie urządzenia sprzętowe zainstalowane w komputerze. Możesz użyć Menedżera urządzeń, aby zmienić właściwości każdego urządzenia.", IDC_STATIC, 42, 18, 204, 24 + PUSHBUTTON "&Menedżer urządzeń", IDC_HARDWARE_DEVICE_MANAGER, 154, 48, 90, 14 - GROUPBOX "Kreator sprztu", IDC_STATIC, 6, 79, 244, 61 + GROUPBOX "Kreator sprzętu", IDC_STATIC, 6, 79, 244, 61 ICON IDI_DEVMGR, IDC_STATIC, 12, 90, 23, 21, SS_ICON - LTEXT "Kreator sprztu pomaga w instalacji, deinstalacji, odczaniu, usuwaniu i konfiguracji sprztu.", IDC_STATIC, 42, 90, 204, 24 - PUSHBUTTON "&Kreator sprztu", IDC_HARDWARE_WIZARD, 154, 120, 90, 14 + LTEXT "Kreator sprzętu pomaga w instalacji, deinstalacji, odłączaniu, usuwaniu i konfiguracji sprzętu.", IDC_STATIC, 42, 90, 204, 24 + PUSHBUTTON "&Kreator sprzętu", IDC_HARDWARE_WIZARD, 154, 120, 90, 14 - GROUPBOX "Profile sprztu", IDC_STATIC, 6, 149, 244, 61 + GROUPBOX "Profile sprzętu", IDC_STATIC, 6, 149, 244, 61 ICON IDI_HARDPROF, IDC_STATIC, 12, 160, 23, 21, SS_ICON - LTEXT "Dziki profilom sprztu moesz instalowa oraz przechowywa rne konfiguracje sprztu.", IDC_STATIC, 42, 160, 204, 24 - PUSHBUTTON "Profile &sprztu", IDC_HARDWARE_PROFILE, 154, 190, 90, 14 + LTEXT "Dzięki profilom sprzętu możesz instalować oraz przechowywać różne konfiguracje sprzętu.", IDC_STATIC, 42, 160, 204, 24 + PUSHBUTTON "Profile &sprzętu", IDC_HARDWARE_PROFILE, 154, 190, 90, 14 END IDD_PROPPAGEADVANCED DIALOGEX 0, 0, 256, 218 @@ -54,21 +57,21 @@ STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION CAPTION "Zaawansowane" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT "Aby mc przeprowadzi wikszo tych zmian, musisz zalogowa si jako administrator.", IDC_STATIC, 12, 5, 236, 8 - GROUPBOX "Wydajno", IDC_STATIC, 6, 18, 244, 50 - LTEXT "Efekty wizualne, planowanie uycia procesora, wykorzystanie pamici i pami wirtualna.", IDC_STATIC, 16, 29, 210, 17 + LTEXT "Aby móc przeprowadzić większość tych zmian, musisz zalogować się jako administrator.", IDC_STATIC, 12, 5, 236, 8 + GROUPBOX "Wydajność", IDC_STATIC, 6, 18, 244, 50 + LTEXT "Efekty wizualne, planowanie użycia procesora, wykorzystanie pamięci i pamięć wirtualna.", IDC_STATIC, 16, 29, 210, 17 PUSHBUTTON "&Ustawienia", IDC_PERFOR, 194, 48, 50, 14 - GROUPBOX "Profile uytkownika", IDC_STATIC, 6,75,244,48 - LTEXT "Ustawienia pulpitu powizane z logowaniem uytkownika.", IDC_STATIC, 16, 88, 210, 20 + GROUPBOX "Profile użytkownika", IDC_STATIC, 6,75,244,48 + LTEXT "Ustawienia pulpitu powiązane z logowaniem użytkownika.", IDC_STATIC, 16, 88, 210, 20 PUSHBUTTON "U&stawienia", IDC_USERPROFILE, 194, 103, 50, 14 GROUPBOX "Uruchamianie i odzyskiwanie", IDC_STATIC, 6, 131, 244, 52 LTEXT "Informacje o uruchamianiu systemu, awariach systemu i debugowaniu.", IDC_STATIC, 16, 144, 210, 19 PUSHBUTTON "Us&tawienia", IDC_STAREC, 194, 162, 50, 14 - PUSHBUTTON "Z&mienne rodowiskowe", IDC_ENVVAR, 84, 192, 80, 14 - PUSHBUTTON "&Raportowanie bdw", IDC_ERRORREPORT, 170, 192, 80, 14 + PUSHBUTTON "Z&mienne Środowiskowe", IDC_ENVVAR, 84, 192, 80, 14 + PUSHBUTTON "&Raportowanie błędów", IDC_ERRORREPORT, 170, 192, 80, 14 END IDD_SYSSETTINGS DIALOGEX 0, 0, 221, 106 @@ -77,32 +80,32 @@ CAPTION "Ustawienia systemowe" FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN GROUPBOX "Informowanie o wersji",IDC_STATIC,6,3,210,73 - CONTROL "Zgaszaj jako stacj robocz",IDC_REPORTASWORKSTATION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,57,110,10 - LTEXT "ReactOS jest zbudowany w oparciu o wersj serwerow. Zaznacz pole, aby ReactOS zgasza si aplikacjom jako stacja robocza.",IDC_STATIC,15,15,183,41 + CONTROL "Zgłaszaj jako stację roboczą",IDC_REPORTASWORKSTATION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,57,110,10 + LTEXT "ReactOS jest zbudowany w oparciu o wersję serwerową. Zaznacz pole, aby ReactOS zgłaszał się aplikacjom jako stacja robocza.",IDC_STATIC,15,15,183,41 PUSHBUTTON "OK",IDOK,166,83,50,14 END IDD_HARDWAREPROFILES DIALOGEX 6, 18, 254, 234 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "Profile sprztu" +CAPTION "Profile sprzętu" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_HARDPROF, IDC_STATIC, 8, 11, 18, 20, SS_ICON - LTEXT "Moesz okreli profile sprztu dla rnych konfiguracji sprztu. Podczas uruchamiania moesz wybra profil, ktrego chcesz uy.", IDC_STATIC, 46, 11, 188, 25 - LTEXT "&Dostpne profile sprztu:", IDC_STATIC, 8, 41, 120, 8 + LTEXT "Możesz określić profile sprzętu dla różnych konfiguracji sprzętu. Podczas uruchamiania możesz wybrać profil, którego chcesz użyć.", IDC_STATIC, 46, 11, 188, 25 + LTEXT "&Dostępne profile sprzętu:", IDC_STATIC, 8, 41, 120, 8 LISTBOX IDC_HRDPROFLSTBOX, 8, 52, 215, 54, LBS_NOTIFY PUSHBUTTON "", IDC_HRDPROFUP, 232, 59, 15, 14, BS_ICON PUSHBUTTON "", IDC_HRDPROFDWN, 232, 79, 15, 14, BS_ICON - PUSHBUTTON "&Waciwoci", IDC_HRDPROFPROP, 8, 106, 50, 14 + PUSHBUTTON "&Właściwości", IDC_HRDPROFPROP, 8, 106, 50, 14 PUSHBUTTON "&Kopiuj", IDC_HRDPROFCOPY, 63, 106, 50, 14 - PUSHBUTTON "Z&mie nazw", IDC_HRDPROFRENAME, 118, 106, 50, 14 - PUSHBUTTON "&Usu", IDC_HRDPROFDEL, 173, 106, 50, 14 + PUSHBUTTON "Z&mień nazwę", IDC_HRDPROFRENAME, 118, 106, 50, 14 + PUSHBUTTON "&Usuń", IDC_HRDPROFDEL, 173, 106, 50, 14 - GROUPBOX "Wybr profilw sprztu", IDC_STATIC, 7, 130, 240, 75 + GROUPBOX "Wybór profili sprzętu", IDC_STATIC, 7, 130, 240, 75 LTEXT "Podczas uruchamiania ReactOS:", IDC_STATIC, 14, 142, 210, 8 - AUTORADIOBUTTON "&Czekaj na wybr profilu sprztu przez uytkownika", IDC_HRDPROFWAIT, 14, 158, 133, 8, WS_GROUP - AUTORADIOBUTTON "&Wybierz &pierwszy profil na licie, jeeli uytkownik nie wybierze profilu w cigu", IDC_HRDPROFSELECT, 14, 173, 190, 8 + AUTORADIOBUTTON "&Czekaj na wybór profilu sprzętu przez użytkownika", IDC_HRDPROFWAIT, 14, 158, 175, 8, WS_GROUP + AUTORADIOBUTTON "&Wybierz &pierwszy profil na liście, jeżeli użytkownik nie wybierze profilu w ciągu", IDC_HRDPROFSELECT, 14, 173, 190, 8 LTEXT "s", IDC_STATIC, 65, 187, 35, 8 EDITTEXT IDC_HRDPROFEDIT, 25, 185, 35, 12 CONTROL "", IDC_HRDPROFUPDWN, "msctls_updown32", UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | WS_CHILD | WS_VISIBLE, 25, 185, 7, 10 @@ -129,20 +132,20 @@ END IDD_USERPROFILE DIALOGEX 0, 0, 256, 218 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | DS_SETFONT | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "Profile uytkownika" +CAPTION "Profile użytkownika" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_USERPROF, IDC_STATIC, 6, 11, 16, 16, SS_ICON - LTEXT "Profile uytkownika przechowuj ustawienia pulpitu oraz inne informacje zwizane z kontem uytkownika. Moesz utworzy inny profil na kadym z uywanych komputerw lub wybra profil mobilny, ktry jest taki sam dla kadego z uywanych komputerw.", + LTEXT "Profile użytkownika przechowują ustawienia pulpitu oraz inne informacje związane z kontem użytkownika. Możesz utworzyć inny profil na każdym z używanych komputerów lub wybrać profil mobilny, który jest taki sam dla każdego z używanych komputerów.", IDC_STATIC, 40, 11, 204, 35 LTEXT "&Profile przechowywane na tym komputerze:", IDC_STATIC, 16, 51, 204, 9 CONTROL "", IDC_USERPROFILE_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP, 6, 66, 244, 85, WS_EX_CLIENTEDGE - PUSHBUTTON "&Zmie typ", IDC_USERPROFILE_CHANGE, 90, 156, 50, 14 - PUSHBUTTON "&Usu", IDC_USERPROFILE_DELETE, 145, 156, 50, 14 + PUSHBUTTON "&Zmień typ", IDC_USERPROFILE_CHANGE, 90, 156, 50, 14 + PUSHBUTTON "&Usuń", IDC_USERPROFILE_DELETE, 145, 156, 50, 14 PUSHBUTTON "&Kopiuj do", IDC_USERPROFILE_COPY, 200, 156, 50, 14 - CONTROL "Aby utworzy nowe konta uytkownikw, otwrz aplet Konta uytkownikw w Panelu sterowania.", IDC_USERACCOUNT_LINK, "SysLink", WS_CHILD | WS_VISIBLE | WS_TABSTOP, 7, 175, 204, 18 + CONTROL "Aby utworzyć nowe konta użytkowników, otwórz aplet Konta użytkowników w Panelu sterowania.", IDC_USERACCOUNT_LINK, "SysLink", WS_CHILD | WS_VISIBLE | WS_TABSTOP, 7, 175, 204, 18 DEFPUSHBUTTON "OK", IDOK, 134, 200, 54, 14 PUSHBUTTON "Anuluj", IDCANCEL, 196, 200, 54, 14 @@ -155,29 +158,29 @@ CAPTION "Uruchamianie i odzyskiwanie" FONT 8, "MS Shell Dlg" BEGIN GROUPBOX "Uruchamianie systemu", IDC_STATIC, 7, 12, 238, 95 - LTEXT "&Domylny system operacyjny:", IDC_STATIC, 14, 26, 100, 8 + LTEXT "&Domyślny system operacyjny:", IDC_STATIC, 14, 26, 100, 8 COMBOBOX IDC_STRECOSCOMBO, 14, 37, 224, 46, CBS_DROPDOWNLIST - AUTOCHECKBOX "&Czas wywietlania listy systemw operacyjnych:", IDC_STRECLIST, 14, 56, 150, 8 + AUTOCHECKBOX "&Czas wyświetlania listy systemów operacyjnych:", IDC_STRECLIST, 14, 56, 150, 8 EDITTEXT IDC_STRRECLISTEDIT, 179, 54, 30, 12, ES_NUMBER CONTROL "", IDC_STRRECLISTUPDWN, "msctls_updown32", UDS_WRAP | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | WS_CHILD | WS_VISIBLE, 0, 0, 8, 13 LTEXT "s", IDC_STATIC, 215, 56, 25, 8 - AUTOCHECKBOX "Czas wywietlania w razie potrzeby &opcji odzyskiwania:", IDC_STRRECREC, 14, 70, 163, 8 + AUTOCHECKBOX "Czas wyświetlania w razie potrzeby &opcji odzyskiwania:", IDC_STRRECREC, 14, 70, 163, 8 EDITTEXT IDC_STRRECRECEDIT, 179, 68, 30, 12, ES_NUMBER CONTROL "", IDC_STRRECRECUPDWN, "msctls_updown32", UDS_WRAP | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | WS_CHILD | WS_VISIBLE, 0, 0, 8, 13 LTEXT "s", IDC_STATIC, 215, 70, 25, 8 - LTEXT "Aby rcznie edytowa plik opcji autostartu, kliknij przycisk Edytuj.", IDC_STATIC, 14, 89, 187, 8 + LTEXT "Aby ręcznie edytować plik opcji autostartu, kliknij przycisk Edytuj.", IDC_STATIC, 14, 89, 187, 8 PUSHBUTTON "&Edytuj", IDC_STRRECEDIT, 188, 87, 50, 14 GROUPBOX "Awaria systemu", IDC_STATIC, 7, 111, 238, 140 AUTOCHECKBOX "&Zapisz zdarzenie do dziennika systemu", IDC_STRRECWRITEEVENT, 14, 124, 148, 10 - AUTOCHECKBOX "&Wylij alert administracyjny", IDC_STRRECSENDALERT, 14, 138, 148, 10 + AUTOCHECKBOX "&Wyślij alert administracyjny", IDC_STRRECSENDALERT, 14, 138, 148, 10 AUTOCHECKBOX "A&utomatycznie uruchom ponownie", IDC_STRRECRESTART, 14, 152, 145, 10 GROUPBOX "Zapisywanie informacji o debugowaniu", IDC_STATIC, 12, 167, 227, 76 COMBOBOX IDC_STRRECDEBUGCOMBO, 17, 182, 151, 49, CBS_DROPDOWNLIST LTEXT "&Plik zrzutu:", IDC_STATIC, 17, 202, 150, 8 EDITTEXT IDC_STRRECDUMPFILE, 17, 210, 153, 12 - AUTOCHECKBOX "Z&astp wszystkie istniejce pliki", IDC_STRRECOVERWRITE, 17, 228, 125, 10 + AUTOCHECKBOX "Z&astąp wszystkie istniejące pliki", IDC_STRRECOVERWRITE, 17, 228, 125, 10 DEFPUSHBUTTON "OK", IDOK, 141, 259, 50, 14 PUSHBUTTON "Anuluj", IDCANCEL, 195, 259, 50, 14 @@ -186,7 +189,7 @@ END IDD_VIRTMEM DIALOGEX 6, 6, 223, 248 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "Pami wirtualna" +CAPTION "Pamięć wirtualna" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN LTEXT "&Dysk [Etykieta woluminu]", IDC_STATIC, 12, 5, 96, 9 @@ -195,9 +198,9 @@ BEGIN GROUPBOX "Rozmiar pliku stronicowania dla wybranego dysku", IDC_DRIVEGROUP, 10, 70, 204, 104 LTEXT "Dysk:", IDC_STATIC, 20, 80, 20, 8 LTEXT "", IDC_DRIVE, 88, 81, 100, 9 - LTEXT "Dostpne miejsce:", IDC_STATIC, 20, 92, 56, 9 + LTEXT "Dostępne miejsce:", IDC_STATIC, 20, 92, 56, 9 LTEXT "", IDC_SPACEAVAIL, 88, 92, 104, 9 - LTEXT "R&ozmiar pocztkowy (MB):", -1, 22, 118, 54, 9 + LTEXT "R&ozmiar początkowy (MB):", -1, 22, 118, 54, 9 LTEXT "Rozmiar &maksymalny (MB):", -1, 22, 131, 64, 9 AUTORADIOBUTTON "&Rozmiar niestandardowy:", IDC_CUSTOM, 20, 105, 54, 9, WS_GROUP AUTORADIOBUTTON "Rozmiar &kontrolowany przez system", IDC_SYSMANSIZE, 20, 145, 88, 9 @@ -206,7 +209,7 @@ BEGIN EDITTEXT IDC_MAXSIZE, 100, 129, 44, 13, NOT WS_BORDER, WS_EX_CLIENTEDGE PUSHBUTTON "Ustaw", IDC_SET, 158, 155, 50, 14 - GROUPBOX "Cakowity rozmiar plikw stronicowania dla wszystkich dyskw", IDC_TOTALGROUP, 10, 177, 204, 46 + GROUPBOX "Całkowity rozmiar plików stronicowania dla wszystkich dysków", IDC_TOTALGROUP, 10, 177, 204, 46 LTEXT "Dopuszczalne minimum:", IDC_STATIC, 18, 188, 58, 9 LTEXT "", IDC_MINIMUM, 88, 188, 100, 9 LTEXT "Zalecane:", IDC_STATIC, 18, 199, 52, 9 @@ -221,17 +224,17 @@ END IDD_ENVIRONMENT_VARIABLES DIALOGEX 6, 18, 252, 245 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "Zmienne rodowiskowe" +CAPTION "Zmienne Środowiskowe" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - GROUPBOX "Zmienne uytkownika", IDC_STATIC, 7, 12, 238, 100 + GROUPBOX "Zmienne użytkownika", IDC_STATIC, 7, 12, 238, 100 CONTROL "", IDC_USER_VARIABLE_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | LVS_NOSORTHEADER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP, 14, 25, 224, 58, WS_EX_CLIENTEDGE PUSHBUTTON "&Nowa...", IDC_USER_VARIABLE_NEW, 80, 90, 50, 14 PUSHBUTTON "&Edytuj...", IDC_USER_VARIABLE_EDIT, 134, 90, 50, 14 - PUSHBUTTON "&Usu", IDC_USER_VARIABLE_DELETE, 188, 90, 50, 14 + PUSHBUTTON "&Usuń", IDC_USER_VARIABLE_DELETE, 188, 90, 50, 14 GROUPBOX "Zmienne systemowe", IDC_STATIC, 7, 116, 238, 100 CONTROL "", IDC_SYSTEM_VARIABLE_LIST, "SysListView32", @@ -239,7 +242,7 @@ BEGIN WS_VSCROLL | WS_HSCROLL | WS_TABSTOP, 14, 129, 224, 58, WS_EX_CLIENTEDGE PUSHBUTTON "N&owa...", IDC_SYSTEM_VARIABLE_NEW, 80, 194, 50, 14 PUSHBUTTON "E&dytuj...", IDC_SYSTEM_VARIABLE_EDIT, 134, 194, 50, 14 - PUSHBUTTON "U&su", IDC_SYSTEM_VARIABLE_DELETE, 188, 194, 50, 14 + PUSHBUTTON "U&suń", IDC_SYSTEM_VARIABLE_DELETE, 188, 194, 50, 14 DEFPUSHBUTTON "OK", IDOK, 141, 224, 50, 14, WS_GROUP PUSHBUTTON "Anuluj", IDCANCEL, 195, 224, 50, 14 END @@ -252,7 +255,7 @@ FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN LTEXT "&Nazwa zmiennej:", IDC_STATIC, 7, 14, 50, 8 EDITTEXT IDC_VARIABLE_NAME, 75, 12, 145, 12, ES_AUTOHSCROLL - LTEXT "&Warto zmiennej:", IDC_STATIC, 7, 32, 50, 8 + LTEXT "&Wartość zmiennej:", IDC_STATIC, 7, 32, 50, 8 EDITTEXT IDC_VARIABLE_VALUE, 75, 30, 145, 12, ES_AUTOHSCROLL DEFPUSHBUTTON "OK", IDOK, 116, 50, 50, 14 PUSHBUTTON "Anuluj", IDCANCEL, 170, 50, 50, 14 @@ -272,25 +275,25 @@ END STRINGTABLE DISCARDABLE BEGIN IDS_CPLSYSTEMNAME "System" - IDS_CPLSYSTEMDESCRIPTION "Wywietl informacje o swoim systemie komputerowym, zmie ustawienia dotyczce sprztu i wydajnoci" + IDS_CPLSYSTEMDESCRIPTION "Wyświetl informacje o swoim systemie komputerowym, zmień ustawienia dotyczące sprzętu i wydajności" IDS_MEGABYTE "MB RAM" IDS_GIGABYTE "GB RAM" IDS_TERABYTE "TB RAM" IDS_PETABYTE "PB RAM" IDS_VARIABLE "Zmienna" - IDS_VALUE "Warto" + IDS_VALUE "Wartość" IDS_NO_DUMP "(Brak)" - IDS_MINI_DUMP "Minimalny zrzut pamici(64KB)" - IDS_KERNEL_DUMP "Zrzut pamici kernela" - IDS_FULL_DUMP "Zrzut caej pamici" + IDS_MINI_DUMP "Minimalny zrzut pamięci(64KB)" + IDS_KERNEL_DUMP "Zrzut pamięci kernela" + IDS_FULL_DUMP "Zrzut całej pamięci" IDS_USERPROFILE_NAME "Nazwa" IDS_USERPROFILE_SIZE "Rozmiar" IDS_USERPROFILE_TYPE "Typ" IDS_USERPROFILE_STATUS "Stan" IDS_USERPROFILE_MODIFIED "Zmodyfikowano" - IDS_MESSAGEBOXTITLE "System control panel applet" - IDS_WARNINITIALSIZE "Enter a numeric value for the initial size of the paging file." - IDS_WARNMAXIMUMSIZE "Enter a numeric value for the maximum size of the paging file." - IDS_WARNINITIALRANGE "The initial size of the paging file must not be smaller than 2 MB and must not exceed the available space on the selected drive." - IDS_WARNMAXIMUMRANGE "The maximum size of the paging file must not be smaller than its initial size and must not exceed the available space on the selected drive." + IDS_MESSAGEBOXTITLE "System" + IDS_WARNINITIALSIZE "Wprowadź wielkość dla początkowego rozmiaru pliku stronicowania." + IDS_WARNMAXIMUMSIZE "Wprowadź wielkość dla maksymalnego rozmiaru pliku stronicowania." + IDS_WARNINITIALRANGE "Początkowy rozmiar pliku stronicowania nie może być mniejszy niż 2MB i nie może przekraczać dostępnej ilości miejsca w wybranym napędzie." + IDS_WARNMAXIMUMRANGE "Maksymalny rozmiar pliku stronicowania nie może być mniejszy niż jego rozmiar początkowy i nie może przekraczać dostępnej ilości miejsca w wybranym napędzie." END diff --git a/dll/cpl/sysdm/lang/ro-RO.rc b/dll/cpl/sysdm/lang/ro-RO.rc index 26c61341a7f..63460dd0fb6 100644 --- a/dll/cpl/sysdm/lang/ro-RO.rc +++ b/dll/cpl/sysdm/lang/ro-RO.rc @@ -1,7 +1,5 @@ LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL -#pragma code_page(65001) - IDD_PROPPAGEGENERAL DIALOGEX 0, 0, 256, 218 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION CAPTION "Generalități" @@ -290,5 +288,3 @@ BEGIN IDS_WARNINITIALRANGE "The initial size of the paging file must not be smaller than 2 MB and must not exceed the available space on the selected drive." IDS_WARNMAXIMUMRANGE "The maximum size of the paging file must not be smaller than its initial size and must not exceed the available space on the selected drive." END - -#pragma code_page(default) diff --git a/dll/cpl/sysdm/lang/ru-RU.rc b/dll/cpl/sysdm/lang/ru-RU.rc index 72ecb3cc417..236c55f0db0 100644 --- a/dll/cpl/sysdm/lang/ru-RU.rc +++ b/dll/cpl/sysdm/lang/ru-RU.rc @@ -2,45 +2,45 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT IDD_PROPPAGEGENERAL DIALOGEX 0, 0, 256, 218 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Общие" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN CONTROL "", IDC_ROSIMG, "Static", SS_OWNERDRAW, 4, 5, 248, 111 - LTEXT " :", IDC_STATIC, 4, 132, 87, 9 + LTEXT "Операционная система:", IDC_STATIC, 4, 132, 87, 9 LTEXT REACTOS_STR_PRODUCT_NAME, IDC_STATIC, 10, 144, 116, 9 - LTEXT " ", IDC_STATIC, 10, 153, 25, 9 + LTEXT "Версия ", IDC_STATIC, 10, 153, 25, 9 LTEXT REACTOS_STR_PRODUCT_VERSION, IDC_STATIC, 35, 153, 91, 9 LTEXT REACTOS_STR_PRODUCT_BUILD, IDC_STATIC, 10, 162, 60, 9 - LTEXT ":", IDC_STATIC, 124, 132, 40, 9 + LTEXT "Компьютер:", IDC_STATIC, 124, 132, 40, 9 LTEXT "", IDC_MACHINELINE1, 130, 144, 118, 9 LTEXT "", IDC_MACHINELINE2, 130, 153, 118, 9 LTEXT "", IDC_MACHINELINE3, 130, 162, 118, 9 LTEXT "", IDC_MACHINELINE4, 130, 171, 118, 9 LTEXT "", IDC_MACHINELINE5, 130, 180, 118, 9 - CONTROL " ReactOS.", IDC_ROSHOMEPAGE_LINK, "SysLink", WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 204, 220, 8 - PUSHBUTTON "&...", IDC_LICENCE, 170, 200, 78, 14 + CONTROL "Посетите домашнюю страницу ReactOS.", IDC_ROSHOMEPAGE_LINK, "SysLink", WS_CHILD | WS_VISIBLE | WS_TABSTOP, 10, 204, 220, 8 + PUSHBUTTON "&Лицензия...", IDC_LICENCE, 170, 200, 78, 14 END IDD_PROPPAGEHARDWARE DIALOGEX 0, 0, 256, 218 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Оборудование" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - GROUPBOX " ", IDC_STATIC, 6, 7, 244, 61 + GROUPBOX "Диспетчер устройств", IDC_STATIC, 6, 7, 244, 61 ICON IDI_DEVMGR, IDC_STATIC, 12, 18, 23, 21, SS_ICON - LTEXT " .", IDC_STATIC, 42, 18, 204, 24 - PUSHBUTTON "& ...", IDC_HARDWARE_DEVICE_MANAGER, 144, 48, 100, 14 + LTEXT "Диспетчер устройств приводит список всего установленного оборудования на данном компьютере и позволяет изменить свойства любого устройства.", IDC_STATIC, 42, 18, 204, 24 + PUSHBUTTON "&Диспетчер устройств...", IDC_HARDWARE_DEVICE_MANAGER, 144, 48, 100, 14 - GROUPBOX " ", IDC_STATIC, 6, 79, 244, 61 + GROUPBOX "Мастер оборудования", IDC_STATIC, 6, 79, 244, 61 ICON IDI_DEVMGR, IDC_STATIC, 12, 90, 23, 21, SS_ICON - LTEXT " , , , .", IDC_STATIC, 42, 90, 204, 24 - PUSHBUTTON "& ...", IDC_HARDWARE_WIZARD, 144, 120, 100, 14 + LTEXT "Мастер оборудования помогает установить, востановить, отключить или извлечь любое устройство, а также настроить его.", IDC_STATIC, 42, 90, 204, 24 + PUSHBUTTON "&Мастер оборудования...", IDC_HARDWARE_WIZARD, 144, 120, 100, 14 - GROUPBOX " ", IDC_STATIC, 6, 149, 244, 61 + GROUPBOX "Профили оборудования", IDC_STATIC, 6, 149, 244, 61 ICON IDI_HARDPROF, IDC_STATIC, 12, 160, 23, 21, SS_ICON - LTEXT " .", IDC_STATIC, 42, 160, 204, 24 - PUSHBUTTON "& ...", IDC_HARDWARE_PROFILE, 144, 190, 100, 14 + LTEXT "Профили оборудования помогают устанавливать и хранить различные конфигурации оборудования.", IDC_STATIC, 42, 160, 204, 24 + PUSHBUTTON "&Профили оборудования...", IDC_HARDWARE_PROFILE, 144, 190, 100, 14 END IDD_SYSSETTINGS DIALOGEX 0, 0, 221, 106 @@ -56,205 +56,205 @@ END IDD_PROPPAGEADVANCED DIALOGEX 0, 0, 256, 218 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Дополнительно" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT " .", IDC_STATIC, 12, 5, 253, 8 - GROUPBOX "", IDC_STATIC, 6, 18, 244, 50 - LTEXT " , , .", IDC_STATIC, 16, 29, 210, 20 - PUSHBUTTON "&", IDC_PERFOR, 194, 48, 50, 14 + LTEXT "Для изменения этих параметров требуются права Администратора.", IDC_STATIC, 12, 5, 253, 8 + GROUPBOX "Быстродействие", IDC_STATIC, 6, 18, 244, 50 + LTEXT "Визуальные эффекты, использование процессора, оперативной и виртуальной памяти.", IDC_STATIC, 16, 29, 210, 20 + PUSHBUTTON "&Параметры", IDC_PERFOR, 194, 48, 50, 14 - GROUPBOX " ", IDC_STATIC, 6,75,244,48 - LTEXT " , .", IDC_STATIC, 16, 88, 210, 20 - PUSHBUTTON "", IDC_USERPROFILE, 194, 103, 50, 14 + GROUPBOX "Профили пользователей", IDC_STATIC, 6,75,244,48 + LTEXT "Параметры рабочего стола, относящиеся ко входу в систему.", IDC_STATIC, 16, 88, 210, 20 + PUSHBUTTON "Параметры", IDC_USERPROFILE, 194, 103, 50, 14 - GROUPBOX " ", IDC_STATIC, 6, 131, 244, 52 - LTEXT " , .", IDC_STATIC, 16, 144, 210, 20 - PUSHBUTTON "&", IDC_STAREC, 194, 162, 50, 14 + GROUPBOX "Загрузка и восстановление", IDC_STATIC, 6, 131, 244, 52 + LTEXT "Загрузка и восстановление системы, отладочная информация.", IDC_STATIC, 16, 144, 210, 20 + PUSHBUTTON "&Параметры", IDC_STAREC, 194, 162, 50, 14 - PUSHBUTTON "& ", IDC_ENVVAR, 84, 192, 80, 14 - PUSHBUTTON " ", IDC_ERRORREPORT, 170, 192, 80, 14 + PUSHBUTTON "П&еременные среды", IDC_ENVVAR, 84, 192, 80, 14 + PUSHBUTTON "Отчет об ошибках", IDC_ERRORREPORT, 170, 192, 80, 14 END IDD_HARDWAREPROFILES DIALOGEX 6, 18, 254, 234 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Профили оборудования" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_HARDPROF, IDC_STATIC, 8, 11, 18, 20, SS_ICON - LTEXT " .", IDC_STATIC, 46, 11, 188, 25 - LTEXT " :", IDC_STATIC, 8, 41, 120, 8 + LTEXT "Можно создать несколько профилей для различных конфигураций оборудования и выбрать нужный при загрузке системы.", IDC_STATIC, 46, 11, 188, 25 + LTEXT "Доступные профили оборудования:", IDC_STATIC, 8, 41, 120, 8 LISTBOX IDC_HRDPROFLSTBOX, 8, 52, 215, 54, LBS_NOTIFY PUSHBUTTON "", IDC_HRDPROFUP, 232, 59, 15, 14, BS_ICON PUSHBUTTON "", IDC_HRDPROFDWN, 232, 79, 15, 14, BS_ICON - PUSHBUTTON "", IDC_HRDPROFPROP, 8, 106, 47, 14 - PUSHBUTTON "", IDC_HRDPROFCOPY, 60, 106, 47, 14 - PUSHBUTTON "", IDC_HRDPROFRENAME, 112, 106, 59, 14 - PUSHBUTTON "", IDC_HRDPROFDEL, 176, 106, 47, 14 + PUSHBUTTON "Свойства", IDC_HRDPROFPROP, 8, 106, 47, 14 + PUSHBUTTON "Копировать", IDC_HRDPROFCOPY, 60, 106, 47, 14 + PUSHBUTTON "Переименовать", IDC_HRDPROFRENAME, 112, 106, 59, 14 + PUSHBUTTON "Удалить", IDC_HRDPROFDEL, 176, 106, 47, 14 - GROUPBOX " ", IDC_STATIC, 7, 130, 240, 75 - LTEXT " ReactOS :", IDC_STATIC, 14, 142, 210, 8 - AUTORADIOBUTTON "& ", IDC_HRDPROFWAIT, 14, 158, 190, 8, WS_GROUP - AUTORADIOBUTTON "& , ", IDC_HRDPROFSELECT, 14, 173, 225, 8 - LTEXT ".", IDC_STATIC, 65, 187, 35, 8 + GROUPBOX "Выбор профиля оборудования", IDC_STATIC, 7, 130, 240, 75 + LTEXT "При загрузке ReactOS следует:", IDC_STATIC, 14, 142, 210, 8 + AUTORADIOBUTTON "&Дождаться явного указания от пользователя", IDC_HRDPROFWAIT, 14, 158, 190, 8, WS_GROUP + AUTORADIOBUTTON "&Выбрать первый профиль в списке, если выбор не сделан за", IDC_HRDPROFSELECT, 14, 173, 225, 8 + LTEXT "сек.", IDC_STATIC, 65, 187, 35, 8 EDITTEXT IDC_HRDPROFEDIT, 25, 185, 35, 12 CONTROL "", IDC_HRDPROFUPDWN, "msctls_updown32", UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | WS_CHILD | WS_VISIBLE, 25, 185, 7, 10 DEFPUSHBUTTON "OK", IDOK, 143, 213, 50, 14 - PUSHBUTTON "", IDCANCEL, 197, 213, 50, 14 + PUSHBUTTON "Отмена", IDCANCEL, 197, 213, 50, 14 END IDD_RENAMEPROFILE DIALOGEX 12, 26, 256, 52 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Переименовать профиль" FONT 8, "MS Shell Dlg" BEGIN - LTEXT ":", IDC_STATIC, 5, 10, 20, 8 + LTEXT "ИЗ:", IDC_STATIC, 5, 10, 20, 8 LTEXT "", IDC_RENPROFEDITFROM, 30, 10, 160, 10 - LTEXT ":", IDC_STATIC, 5, 30, 20, 8 + LTEXT "в:", IDC_STATIC, 5, 30, 20, 8 EDITTEXT IDC_RENPROFEDITTO, 30, 30, 160, 12 DEFPUSHBUTTON "OK", IDOK, 199, 9, 50, 14 - PUSHBUTTON "", IDCANCEL, 199, 30, 50, 14 + PUSHBUTTON "Отмена", IDCANCEL, 199, 30, 50, 14 END IDD_USERPROFILE DIALOGEX 0, 0, 256, 218 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | DS_SETFONT | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Профили пользователей" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_USERPROF, IDC_STATIC, 6, 11, 16, 16, SS_ICON - LTEXT " , . .", + LTEXT "Профиль пользователя содержит настройки рабочего стола и другие сведения, используемые при входе в систему. Можно создать различные профили на разных компьютерах для одного пользователя или использовать один общий профиль.", IDC_STATIC, 40, 11, 204, 35 - LTEXT ", :", IDC_STATIC, 16, 51, 204, 9 + LTEXT "Профили, хранящиеся на этом компьютере:", IDC_STATIC, 16, 51, 204, 9 CONTROL "", IDC_USERPROFILE_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP, 6, 66, 244, 85, WS_EX_CLIENTEDGE - PUSHBUTTON " ", IDC_USERPROFILE_CHANGE, 90, 156, 50, 14 - PUSHBUTTON "", IDC_USERPROFILE_DELETE, 145, 156, 50, 14 - PUSHBUTTON "", IDC_USERPROFILE_COPY, 200, 156, 50, 14 + PUSHBUTTON "Сменить тип", IDC_USERPROFILE_CHANGE, 90, 156, 50, 14 + PUSHBUTTON "Удалить", IDC_USERPROFILE_DELETE, 145, 156, 50, 14 + PUSHBUTTON "Копировать", IDC_USERPROFILE_COPY, 200, 156, 50, 14 - CONTROL " , .", IDC_USERACCOUNT_LINK, "SysLink", WS_CHILD | WS_VISIBLE | WS_TABSTOP, 7, 175, 204, 18 + CONTROL "Создайте новый профиль, используя Профили пользователей в Панели управления.", IDC_USERACCOUNT_LINK, "SysLink", WS_CHILD | WS_VISIBLE | WS_TABSTOP, 7, 175, 204, 18 DEFPUSHBUTTON "OK", IDOK, 134, 200, 54, 14 - PUSHBUTTON "", IDCANCEL, 196, 200, 54, 14 + PUSHBUTTON "Отмена", IDCANCEL, 196, 200, 54, 14 END IDD_STARTUPRECOVERY DIALOGEX 6, 18, 252, 280 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Загрузка и востановление" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ", IDC_STATIC, 7, 12, 238, 95 - LTEXT " :", IDC_STATIC, 14, 26, 145, 8 + GROUPBOX "Загрузка операционной системы", IDC_STATIC, 7, 12, 238, 95 + LTEXT "Операционная система по умолчанию:", IDC_STATIC, 14, 26, 145, 8 COMBOBOX IDC_STRECOSCOMBO, 14, 37, 224, 46, CBS_DROPDOWNLIST - AUTOCHECKBOX "& :", IDC_STRECLIST, 14, 56, 161, 8 + AUTOCHECKBOX "О&тображать список операционных систем:", IDC_STRECLIST, 14, 56, 161, 8 EDITTEXT IDC_STRRECLISTEDIT, 179, 54, 30, 12, ES_NUMBER CONTROL "", IDC_STRRECLISTUPDWN, "msctls_updown32", UDS_WRAP | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | WS_CHILD | WS_VISIBLE, 0, 0, 8, 13 - LTEXT "", IDC_STATIC, 213, 56, 25, 8 - AUTOCHECKBOX " & :", IDC_STRRECREC, 14, 70, 163, 8 + LTEXT "секунд", IDC_STATIC, 213, 56, 25, 8 + AUTOCHECKBOX "Отображать &варианты востановления:", IDC_STRRECREC, 14, 70, 163, 8 EDITTEXT IDC_STRRECRECEDIT, 179, 68, 30, 12, ES_NUMBER CONTROL "", IDC_STRRECRECUPDWN, "msctls_updown32", UDS_WRAP | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | WS_CHILD | WS_VISIBLE, 0, 0, 8, 13 - LTEXT "", IDC_STATIC, 213, 70, 25, 8 - LTEXT " . """"", IDC_STATIC, 14, 90, 187, 8 - PUSHBUTTON "&", IDC_STRRECEDIT, 188, 87, 50, 14 + LTEXT "секунд", IDC_STATIC, 213, 70, 25, 8 + LTEXT "Для редактир. вручную нажмите ""Изменить""", IDC_STATIC, 14, 90, 187, 8 + PUSHBUTTON "&Изменить", IDC_STRRECEDIT, 188, 87, 50, 14 - GROUPBOX " ", IDC_STATIC, 7, 111, 238, 140 - AUTOCHECKBOX " &", IDC_STRRECWRITEEVENT, 14, 124, 154, 10 - AUTOCHECKBOX "& ", IDC_STRRECSENDALERT, 14, 138, 165, 10 - AUTOCHECKBOX " & ", IDC_STRRECRESTART, 14, 152, 160, 10 + GROUPBOX "Отказ системы", IDC_STATIC, 7, 111, 238, 140 + AUTOCHECKBOX "Записать событие в системный &журнал", IDC_STRRECWRITEEVENT, 14, 124, 154, 10 + AUTOCHECKBOX "&Отправить административное оповещение", IDC_STRRECSENDALERT, 14, 138, 165, 10 + AUTOCHECKBOX "Выполнить &автоматическую перезагрузку", IDC_STRRECRESTART, 14, 152, 160, 10 - GROUPBOX " ", IDC_STATIC, 12, 167, 227, 76 + GROUPBOX "Запись отладочной информации", IDC_STATIC, 12, 167, 227, 76 COMBOBOX IDC_STRRECDEBUGCOMBO, 17, 182, 151, 49, CBS_DROPDOWNLIST - LTEXT " :", IDC_STATIC, 17, 202, 150, 8 + LTEXT "Файл дампа памяти:", IDC_STATIC, 17, 202, 150, 8 EDITTEXT IDC_STRRECDUMPFILE, 17, 210, 153, 12 - AUTOCHECKBOX " & ", IDC_STRRECOVERWRITE, 17, 228, 145, 10 + AUTOCHECKBOX "Заменять &существующий файл дампа", IDC_STRRECOVERWRITE, 17, 228, 145, 10 DEFPUSHBUTTON "OK", IDOK, 141, 259, 50, 14 - PUSHBUTTON "", IDCANCEL, 195, 259, 50, 14 + PUSHBUTTON "Отмена", IDCANCEL, 195, 259, 50, 14 END IDD_VIRTMEM DIALOGEX 6, 6, 223, 248 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Виртуальная память" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT " [ ]", IDC_STATIC, 12, 5, 96, 9 - LTEXT " (MB)", IDC_STATIC, 115, 5, 96, 9 + LTEXT "Диск [метка тома]", IDC_STATIC, 12, 5, 96, 9 + LTEXT "Файл подкачки (MB)", IDC_STATIC, 115, 5, 96, 9 LISTBOX IDC_PAGEFILELIST, 10, 16, 204, 52, LBS_NOTIFY | LBS_USETABSTOPS - GROUPBOX " ", IDC_DRIVEGROUP, 10, 70, 204, 104 - LTEXT ":", IDC_STATIC, 20, 80, 20, 8 + GROUPBOX "Размер файла подкачки для выбранного диска", IDC_DRIVEGROUP, 10, 70, 204, 104 + LTEXT "Диск:", IDC_STATIC, 20, 80, 20, 8 LTEXT "", IDC_DRIVE, 88, 81, 100, 9 - LTEXT " :", IDC_STATIC, 20, 92, 183, 9 + LTEXT "Доступное пространство:", IDC_STATIC, 20, 92, 183, 9 LTEXT "", IDC_SPACEAVAIL, 154, 92, 104, 9 - LTEXT " (MB):", -1, 22, 118, 80, 9 - LTEXT " (MB):", -1, 22, 131, 98, 9 - AUTORADIOBUTTON "& ", IDC_CUSTOM, 20, 105, 65, 9, WS_GROUP - AUTORADIOBUTTON " ", IDC_SYSMANSIZE, 20, 145, 105, 9 - AUTORADIOBUTTON " ", IDC_NOPAGEFILE, 20, 158, 85, 9 + LTEXT "Исходный размер (MB):", -1, 22, 118, 80, 9 + LTEXT "Максимальный размер (MB):", -1, 22, 131, 98, 9 + AUTORADIOBUTTON "&Другой размер", IDC_CUSTOM, 20, 105, 65, 9, WS_GROUP + AUTORADIOBUTTON "Размер по выбору системы", IDC_SYSMANSIZE, 20, 145, 105, 9 + AUTORADIOBUTTON "Без файла подкачки", IDC_NOPAGEFILE, 20, 158, 85, 9 EDITTEXT IDC_INITIALSIZE, 120, 114, 44, 13, NOT WS_BORDER, WS_EX_CLIENTEDGE EDITTEXT IDC_MAXSIZE, 120, 129, 44, 13, NOT WS_BORDER, WS_EX_CLIENTEDGE - PUSHBUTTON "", IDC_SET, 158, 155, 50, 14 + PUSHBUTTON "Установить", IDC_SET, 158, 155, 50, 14 - GROUPBOX " ", IDC_TOTALGROUP, 10, 177, 204, 46 - LTEXT " :", IDC_STATIC, 18, 188, 120, 9 + GROUPBOX "Общий объем файла подкачки на всех дисках", IDC_TOTALGROUP, 10, 177, 204, 46 + LTEXT "Минимальный размер:", IDC_STATIC, 18, 188, 120, 9 LTEXT "", IDC_MINIMUM, 145, 188, 60, 9 - LTEXT ":", IDC_STATIC, 18, 199, 120, 9 + LTEXT "Рекомендуемый:", IDC_STATIC, 18, 199, 120, 9 LTEXT "", IDC_RECOMMENDED, 145, 197, 60, 9 - LTEXT " :", IDC_STATIC, 18, 210, 120, 9 + LTEXT "Текущий размер:", IDC_STATIC, 18, 210, 120, 9 LTEXT "", IDC_CURRENT, 145, 208, 60, 9 DEFPUSHBUTTON "OK", IDOK, 114, 232, 48, 14 - PUSHBUTTON "", IDCANCEL, 168, 232, 48, 14 + PUSHBUTTON "Отмена", IDCANCEL, 168, 232, 48, 14 END IDD_ENVIRONMENT_VARIABLES DIALOGEX 6, 18, 252, 245 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Перемнные среды" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - GROUPBOX " ", IDC_STATIC, 7, 12, 238, 100 + GROUPBOX "Переменные пользователя", IDC_STATIC, 7, 12, 238, 100 CONTROL "", IDC_USER_VARIABLE_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | LVS_NOSORTHEADER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP, 14, 25, 224, 58, WS_EX_CLIENTEDGE - PUSHBUTTON "&...", IDC_USER_VARIABLE_NEW, 80, 90, 50, 14 - PUSHBUTTON "&...", IDC_USER_VARIABLE_EDIT, 134, 90, 50, 14 - PUSHBUTTON "&", IDC_USER_VARIABLE_DELETE, 188, 90, 50, 14 - GROUPBOX " ", IDC_STATIC, 7, 116, 238, 100 + PUSHBUTTON "&Создать...", IDC_USER_VARIABLE_NEW, 80, 90, 50, 14 + PUSHBUTTON "&Изменить...", IDC_USER_VARIABLE_EDIT, 134, 90, 50, 14 + PUSHBUTTON "&Удалить", IDC_USER_VARIABLE_DELETE, 188, 90, 50, 14 + GROUPBOX "Системные переменные", IDC_STATIC, 7, 116, 238, 100 CONTROL "", IDC_SYSTEM_VARIABLE_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | LVS_NOSORTHEADER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP, 14, 129, 224, 58, WS_EX_CLIENTEDGE - PUSHBUTTON "&...", IDC_SYSTEM_VARIABLE_NEW, 80, 194, 50, 14 - PUSHBUTTON "&...", IDC_SYSTEM_VARIABLE_EDIT, 134, 194, 50, 14 - PUSHBUTTON "&", IDC_SYSTEM_VARIABLE_DELETE, 188, 194, 50, 14 + PUSHBUTTON "С&оздать...", IDC_SYSTEM_VARIABLE_NEW, 80, 194, 50, 14 + PUSHBUTTON "И&зменить...", IDC_SYSTEM_VARIABLE_EDIT, 134, 194, 50, 14 + PUSHBUTTON "У&далить", IDC_SYSTEM_VARIABLE_DELETE, 188, 194, 50, 14 DEFPUSHBUTTON "OK", IDOK, 141, 224, 50, 14, WS_GROUP - PUSHBUTTON "", IDCANCEL, 195, 224, 50, 14 + PUSHBUTTON "Отмена", IDCANCEL, 195, 224, 50, 14 END IDD_EDIT_VARIABLE DIALOGEX 10, 15, 227, 71 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Изменение переменной" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT "& :", IDC_STATIC, 7, 14, 50, 8 + LTEXT "Им&я переменной:", IDC_STATIC, 7, 14, 50, 8 EDITTEXT IDC_VARIABLE_NAME, 75, 12, 145, 12, ES_AUTOHSCROLL - LTEXT " &:", IDC_STATIC, 7, 32, 50, 8 + LTEXT "Значение перемен&ной:", IDC_STATIC, 7, 32, 50, 8 EDITTEXT IDC_VARIABLE_VALUE, 75, 30, 145, 12, ES_AUTOHSCROLL DEFPUSHBUTTON "OK", IDOK, 116, 50, 50, 14 - PUSHBUTTON "", IDCANCEL, 170, 50, 50, 14 + PUSHBUTTON "Отмена", IDCANCEL, 170, 50, 50, 14 END IDD_LICENCE DIALOGEX 6, 5, 267, 159 -CAPTION " " +CAPTION "Лицензионное соглашение" FONT 8, "MS Shell Dlg", 0, 0, 0x0 STYLE DS_SHELLFONT | WS_BORDER | WS_THICKFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU BEGIN @@ -265,23 +265,23 @@ END STRINGTABLE DISCARDABLE BEGIN - IDS_CPLSYSTEMNAME "" - IDS_CPLSYSTEMDESCRIPTION " ." - IDS_MEGABYTE " " - IDS_GIGABYTE " " - IDS_TERABYTE " " - IDS_PETABYTE " " - IDS_VARIABLE "" - IDS_VALUE "" - IDS_NO_DUMP "()" - IDS_MINI_DUMP " (64)" - IDS_KERNEL_DUMP " " - IDS_FULL_DUMP " " - IDS_USERPROFILE_NAME "" - IDS_USERPROFILE_SIZE "" - IDS_USERPROFILE_TYPE "" - IDS_USERPROFILE_STATUS "" - IDS_USERPROFILE_MODIFIED "" + IDS_CPLSYSTEMNAME "Система" + IDS_CPLSYSTEMDESCRIPTION "Просмотр информации о вашем компьютере и изменение различных системных и аппаратных параметров." + IDS_MEGABYTE "Мб ОЗУ" + IDS_GIGABYTE "Гб ОЗУ" + IDS_TERABYTE "Тб ОЗУ" + IDS_PETABYTE "Пб ОЗУ" + IDS_VARIABLE "Переменная" + IDS_VALUE "Значение" + IDS_NO_DUMP "(нет)" + IDS_MINI_DUMP "Малый дамп(64Кб)" + IDS_KERNEL_DUMP "Дамп ядра" + IDS_FULL_DUMP "Полный дамп" + IDS_USERPROFILE_NAME "Имя" + IDS_USERPROFILE_SIZE "Размер" + IDS_USERPROFILE_TYPE "Тип" + IDS_USERPROFILE_STATUS "Состояние" + IDS_USERPROFILE_MODIFIED "Изменен" IDS_MESSAGEBOXTITLE "System control panel applet" IDS_WARNINITIALSIZE "Enter a numeric value for the initial size of the paging file." IDS_WARNMAXIMUMSIZE "Enter a numeric value for the maximum size of the paging file." diff --git a/dll/cpl/sysdm/lang/uk-UA.rc b/dll/cpl/sysdm/lang/uk-UA.rc index 7d3e434e806..8901f465f0a 100644 --- a/dll/cpl/sysdm/lang/uk-UA.rc +++ b/dll/cpl/sysdm/lang/uk-UA.rc @@ -10,259 +10,259 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT IDD_PROPPAGEGENERAL DIALOGEX 0, 0, 256, 218 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Загальні" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN CONTROL "", IDC_ROSIMG, "Static", SS_OWNERDRAW, 4, 5, 248, 111 - LTEXT " :", IDC_STATIC, 4, 132, 82, 9 + LTEXT "Операційна система:", IDC_STATIC, 4, 132, 82, 9 LTEXT REACTOS_STR_PRODUCT_NAME, IDC_STATIC, 10, 144, 116, 9 - LTEXT " ", IDC_STATIC, 10, 153, 25, 9 + LTEXT "Версія ", IDC_STATIC, 10, 153, 25, 9 LTEXT REACTOS_STR_PRODUCT_VERSION, IDC_STATIC, 35, 153, 91, 9 LTEXT REACTOS_STR_PRODUCT_BUILD, IDC_STATIC, 10, 162, 60, 9 - LTEXT "':", IDC_STATIC, 124, 132, 36, 9 + LTEXT "Комп'ютер:", IDC_STATIC, 124, 132, 36, 9 LTEXT "", IDC_MACHINELINE1, 130, 144, 118, 9 LTEXT "", IDC_MACHINELINE2, 130, 153, 118, 9 LTEXT "", IDC_MACHINELINE3, 130, 162, 118, 9 LTEXT "", IDC_MACHINELINE4, 130, 171, 118, 9 LTEXT "", IDC_MACHINELINE5, 130, 180, 118, 9 - CONTROL "³ ReactOS", IDC_ROSHOMEPAGE_LINK, "SysLink", WS_CHILD | WS_VISIBLE | WS_TABSTOP, 20, 200, 150, 8 - PUSHBUTTON "&˳...", IDC_LICENCE, 170, 199, 78, 14 + CONTROL "Відвідаєте домашню сторінку ReactOS", IDC_ROSHOMEPAGE_LINK, "SysLink", WS_CHILD | WS_VISIBLE | WS_TABSTOP, 20, 200, 150, 8 + PUSHBUTTON "&Ліцензія...", IDC_LICENCE, 170, 199, 78, 14 END IDD_PROPPAGEHARDWARE DIALOGEX 0, 0, 256, 218 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Обладнання" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - GROUPBOX " ", IDC_STATIC, 6, 7, 244, 61 + GROUPBOX "Диспетчер пристроїв", IDC_STATIC, 6, 7, 244, 61 ICON IDI_DEVMGR, IDC_STATIC, 12, 18, 23, 21, SS_ICON - LTEXT " , '. - .", IDC_STATIC, 42, 18, 204, 24 - PUSHBUTTON "& ...", IDC_HARDWARE_DEVICE_MANAGER, 154, 48, 90, 14 + LTEXT "Диспетчер пристроїв перелічує все обладнання, установлене на цьому комп'ютері. За його допомогою можна змінити властивості будь-якого пристрою.", IDC_STATIC, 42, 18, 204, 24 + PUSHBUTTON "&Диспетчер пристроїв...", IDC_HARDWARE_DEVICE_MANAGER, 154, 48, 90, 14 - GROUPBOX " ", IDC_STATIC, 6, 79, 244, 61 + GROUPBOX "Установка обладнання", IDC_STATIC, 6, 79, 244, 61 ICON IDI_DEVMGR, IDC_STATIC, 12, 90, 23, 21, SS_ICON - LTEXT " , , , , .", IDC_STATIC, 42, 90, 204, 24 - PUSHBUTTON "& ...", IDC_HARDWARE_WIZARD, 154, 120, 90, 14 + LTEXT "Майстер установки обладнання допомагає установити, відключити, відновити, витягнути, та налаштувати ваше обладнання.", IDC_STATIC, 42, 90, 204, 24 + PUSHBUTTON "&Установка обладнання...", IDC_HARDWARE_WIZARD, 154, 120, 90, 14 - GROUPBOX " ", IDC_STATIC, 6, 149, 244, 61 + GROUPBOX "Профілі обладнання", IDC_STATIC, 6, 149, 244, 61 ICON IDI_HARDPROF, IDC_STATIC, 12, 160, 23, 21, SS_ICON - LTEXT " .", IDC_STATIC, 42, 160, 204, 24 - PUSHBUTTON "& ...", IDC_HARDWARE_PROFILE, 154, 190, 90, 14 + LTEXT "Профілі обладнання дають змогу установлювати й зберігати різні конфігурації обладнання.", IDC_STATIC, 42, 160, 204, 24 + PUSHBUTTON "&Профілі обладнання...", IDC_HARDWARE_PROFILE, 154, 190, 90, 14 END IDD_PROPPAGEADVANCED DIALOGEX 0, 0, 256, 218 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Додатково" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT " , .", IDC_STATIC, 12, 5, 236, 8 - GROUPBOX "", IDC_STATIC, 6, 18, 244, 50 - LTEXT "³ , , '.", IDC_STATIC, 16, 29, 210, 17 - PUSHBUTTON "", IDC_PERFOR, 194, 48, 50, 14 + LTEXT "Потрібно мати права адміністратора, щоб виконати більшу частину цих змін.", IDC_STATIC, 12, 5, 236, 8 + GROUPBOX "Швидкодія", IDC_STATIC, 6, 18, 244, 50 + LTEXT "Візуальні ефекти, використання процесора, оперативної та віртуальної пам'яті.", IDC_STATIC, 16, 29, 210, 17 + PUSHBUTTON "Параметри", IDC_PERFOR, 194, 48, 50, 14 - GROUPBOX " ", IDC_STATIC, 6,75,244,48 - LTEXT " , .", IDC_STATIC, 16, 88, 210, 20 - PUSHBUTTON "", IDC_USERPROFILE, 194, 103, 50, 14 + GROUPBOX "Профілі користувачів", IDC_STATIC, 6,75,244,48 + LTEXT "Параметри робочого стола, які стосуються входу до системи.", IDC_STATIC, 16, 88, 210, 20 + PUSHBUTTON "Параметри", IDC_USERPROFILE, 194, 103, 50, 14 - GROUPBOX " ", IDC_STATIC, 6, 131, 244, 52 - LTEXT " , .", IDC_STATIC, 16, 144, 210, 19 - PUSHBUTTON "", IDC_STAREC, 194, 162, 50, 14 + GROUPBOX "Завантаження й відновлення", IDC_STATIC, 6, 131, 244, 52 + LTEXT "Завантаження й відновлення системи, налагоджувальна інформація.", IDC_STATIC, 16, 144, 210, 19 + PUSHBUTTON "Параметри", IDC_STAREC, 194, 162, 50, 14 - PUSHBUTTON " ", IDC_SYSSETTINGS, 2, 192, 80, 15 - PUSHBUTTON " ", IDC_ENVVAR, 84, 192, 80, 14 - PUSHBUTTON " ", IDC_ERRORREPORT, 170, 192, 80, 14 + PUSHBUTTON "Налаштування системи", IDC_SYSSETTINGS, 2, 192, 80, 15 + PUSHBUTTON "Змінні оточення", IDC_ENVVAR, 84, 192, 80, 14 + PUSHBUTTON "Звіт про помилки", IDC_ERRORREPORT, 170, 192, 80, 14 END IDD_SYSSETTINGS DIALOGEX 0, 0, 221, 106 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION -CAPTION " " +CAPTION "Налаштування системи" FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN - GROUPBOX " ",IDC_STATIC,6,3,210,73 - CONTROL " ",IDC_REPORTASWORKSTATION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,57,118,10 - LTEXT "ReactOS , . , .",IDC_STATIC,15,15,183,41 + GROUPBOX "Інформація про версію",IDC_STATIC,6,3,210,73 + CONTROL "Позначити як робочу станцію",IDC_REPORTASWORKSTATION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,57,118,10 + LTEXT "ReactOS повудована як серверна ОС, і так само про себе повідомляє. Обрати прапорець, щоб змінити це лише для програм.",IDC_STATIC,15,15,183,41 PUSHBUTTON "OK",IDOK,166,83,50,14 END IDD_HARDWAREPROFILES DIALOGEX 6, 18, 254, 234 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Профілі обладнання" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_HARDPROF, IDC_STATIC, 8, 11, 18, 20, SS_ICON - LTEXT " .", IDC_STATIC, 46, 11, 188, 25 - LTEXT " :", IDC_STATIC, 8, 41, 120, 8 + LTEXT "Можна створити декілька профілів для різних конфігурацій устаткування й вибирати потрібний профіль під час завантаження системи.", IDC_STATIC, 46, 11, 188, 25 + LTEXT "Наявні профілі обладнання:", IDC_STATIC, 8, 41, 120, 8 LISTBOX IDC_HRDPROFLSTBOX, 8, 52, 215, 54, LBS_NOTIFY PUSHBUTTON "", IDC_HRDPROFUP, 232, 59, 15, 14, BS_ICON PUSHBUTTON "", IDC_HRDPROFDWN, 232, 79, 15, 14, BS_ICON - PUSHBUTTON "&", IDC_HRDPROFPROP, 8, 106, 50, 14 - PUSHBUTTON "&", IDC_HRDPROFCOPY, 63, 106, 50, 14 - PUSHBUTTON "&", IDC_HRDPROFRENAME, 116, 106, 54, 14 - PUSHBUTTON "&", IDC_HRDPROFDEL, 173, 106, 50, 14 + PUSHBUTTON "В&ластивості", IDC_HRDPROFPROP, 8, 106, 50, 14 + PUSHBUTTON "&Копіювати", IDC_HRDPROFCOPY, 63, 106, 50, 14 + PUSHBUTTON "Переі&менувати", IDC_HRDPROFRENAME, 116, 106, 54, 14 + PUSHBUTTON "В&идалити", IDC_HRDPROFDEL, 173, 106, 50, 14 - GROUPBOX " ", IDC_STATIC, 7, 130, 240, 75 - LTEXT "ϳ ReactOS :", IDC_STATIC, 14, 142, 210, 8 - AUTORADIOBUTTON ", & ", IDC_HRDPROFWAIT, 14, 158, 185, 8, WS_GROUP - AUTORADIOBUTTON "& , ", IDC_HRDPROFSELECT, 14, 173, 230, 8 - LTEXT "", IDC_STATIC, 65, 187, 35, 8 + GROUPBOX "Вибір профілю устаткування", IDC_STATIC, 7, 130, 240, 75 + LTEXT "Під час завантаження ReactOS слід:", IDC_STATIC, 14, 142, 210, 8 + AUTORADIOBUTTON "зачекати, п&оки користувач не вибере профіль", IDC_HRDPROFWAIT, 14, 158, 185, 8, WS_GROUP + AUTORADIOBUTTON "ви&брати перший профіль у списку, якщо вибір не зроблено за", IDC_HRDPROFSELECT, 14, 173, 230, 8 + LTEXT "сек", IDC_STATIC, 65, 187, 35, 8 EDITTEXT IDC_HRDPROFEDIT, 25, 185, 35, 12 CONTROL "", IDC_HRDPROFUPDWN, "msctls_updown32", UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | WS_CHILD | WS_VISIBLE, 25, 185, 7, 10 DEFPUSHBUTTON "OK", IDOK, 143, 213, 50, 14 - PUSHBUTTON "", IDCANCEL, 197, 213, 50, 14 + PUSHBUTTON "Скасувати", IDCANCEL, 197, 213, 50, 14 END IDD_RENAMEPROFILE DIALOGEX 12, 26, 256, 52 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Перейменування профілю" FONT 8, "MS Shell Dlg" BEGIN - LTEXT ":", IDC_STATIC, 5, 10, 20, 8 + LTEXT "З:", IDC_STATIC, 5, 10, 20, 8 LTEXT "", IDC_RENPROFEDITFROM, 30, 10, 160, 10 - LTEXT ":", IDC_STATIC, 5, 30, 20, 8 + LTEXT "На:", IDC_STATIC, 5, 30, 20, 8 EDITTEXT IDC_RENPROFEDITTO, 30, 30, 160, 12 DEFPUSHBUTTON "OK", IDOK, 196, 6, 50, 14 - PUSHBUTTON "", IDCANCEL, 196, 24, 50, 14 + PUSHBUTTON "Скасувати", IDCANCEL, 196, 24, 50, 14 END IDD_USERPROFILE DIALOGEX 0, 0, 256, 218 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | DS_SETFONT | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Профілі користувачів" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_USERPROF, IDC_STATIC, 6, 11, 16, 16, SS_ICON - LTEXT " . ', , '.", + LTEXT "Профілі користувачів містять параметри робочого стола та інші відомості стосовно облікових записів користувачів. Ви можете створити окремі профілі для кожного з комп'ютерів, на яких ви працюєте, або використовувати один спільний профіль для всіх комп'ютерів.", IDC_STATIC, 40, 11, 204, 39 - LTEXT ", ':", IDC_STATIC, 16, 51, 204, 9 + LTEXT "Профілі, які зберігаються на цьому комп'ютері:", IDC_STATIC, 16, 51, 204, 9 CONTROL "", IDC_USERPROFILE_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP, 6, 66, 244, 85, WS_EX_CLIENTEDGE - PUSHBUTTON " ", IDC_USERPROFILE_CHANGE, 90, 156, 50, 14 - PUSHBUTTON "", IDC_USERPROFILE_DELETE, 145, 156, 50, 14 - PUSHBUTTON "...", IDC_USERPROFILE_COPY, 200, 156, 50, 14 + PUSHBUTTON "Змінити тип", IDC_USERPROFILE_CHANGE, 90, 156, 50, 14 + PUSHBUTTON "Видалити", IDC_USERPROFILE_DELETE, 145, 156, 50, 14 + PUSHBUTTON "Копіювати...", IDC_USERPROFILE_COPY, 200, 156, 50, 14 - CONTROL " .", IDC_USERACCOUNT_LINK, "SysLink", WS_CHILD | WS_VISIBLE | WS_TABSTOP, 7, 175, 204, 18 + CONTROL "Для створення нового профілю відкрийте Профілі користувачів в Панелі керування.", IDC_USERACCOUNT_LINK, "SysLink", WS_CHILD | WS_VISIBLE | WS_TABSTOP, 7, 175, 204, 18 DEFPUSHBUTTON "OK", IDOK, 134, 200, 54, 14 - PUSHBUTTON "", IDCANCEL, 196, 200, 54, 14 + PUSHBUTTON "Скасувати", IDCANCEL, 196, 200, 54, 14 END IDD_STARTUPRECOVERY DIALOGEX 6, 18, 252, 280 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Завантаження й відновлення" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ", IDC_STATIC, 7, 12, 238, 95 - LTEXT "& :", IDC_STATIC, 14, 26, 100, 8 + GROUPBOX "Завантаження операційної системи", IDC_STATIC, 7, 12, 238, 95 + LTEXT "&Операційна система за замовчуванням:", IDC_STATIC, 14, 26, 100, 8 COMBOBOX IDC_STRECOSCOMBO, 14, 37, 224, 46, CBS_DROPDOWNLIST - AUTOCHECKBOX "& :", IDC_STRECLIST, 14, 56, 150, 8 + AUTOCHECKBOX "&Показувати список операційних систем:", IDC_STRECLIST, 14, 56, 150, 8 EDITTEXT IDC_STRRECLISTEDIT, 179, 54, 30, 12, ES_NUMBER CONTROL "", IDC_STRRECLISTUPDWN, "msctls_updown32", UDS_WRAP | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | WS_CHILD | WS_VISIBLE, 0, 0, 8, 13 - LTEXT "", IDC_STATIC, 215, 56, 25, 8 - AUTOCHECKBOX "& :", IDC_STRRECREC, 14, 70, 163, 8 + LTEXT "сек", IDC_STATIC, 215, 56, 25, 8 + AUTOCHECKBOX "По&казувати варіанти відновлення:", IDC_STRRECREC, 14, 70, 163, 8 EDITTEXT IDC_STRRECRECEDIT, 179, 68, 30, 12, ES_NUMBER CONTROL "", IDC_STRRECRECUPDWN, "msctls_updown32", UDS_WRAP | UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | WS_CHILD | WS_VISIBLE, 0, 0, 8, 13 - LTEXT "", IDC_STATIC, 215, 70, 25, 8 - LTEXT "³ .", IDC_STATIC, 14, 89, 187, 8 - PUSHBUTTON "&", IDC_STRRECEDIT, 188, 87, 50, 14 + LTEXT "сек", IDC_STATIC, 215, 70, 25, 8 + LTEXT "Відредагувати список завантаження вручну.", IDC_STATIC, 14, 89, 187, 8 + PUSHBUTTON "&Змінити", IDC_STRRECEDIT, 188, 87, 50, 14 - GROUPBOX "³ ", IDC_STATIC, 7, 111, 238, 140 - AUTOCHECKBOX " &", IDC_STRRECWRITEEVENT, 14, 124, 148, 10 - AUTOCHECKBOX "& ", IDC_STRRECSENDALERT, 14, 138, 148, 10 - AUTOCHECKBOX "& ", IDC_STRRECRESTART, 14, 152, 145, 10 + GROUPBOX "Відмова системи", IDC_STATIC, 7, 111, 238, 140 + AUTOCHECKBOX "Записати подію до системного &журналу", IDC_STRRECWRITEEVENT, 14, 124, 148, 10 + AUTOCHECKBOX "&Надіслати адміністративне оповіщення", IDC_STRRECSENDALERT, 14, 138, 148, 10 + AUTOCHECKBOX "&Автоматичне перезавантаження", IDC_STRRECRESTART, 14, 152, 145, 10 - GROUPBOX " ", IDC_STATIC, 12, 167, 227, 76 + GROUPBOX "Записати налагоджувальну інформацію", IDC_STATIC, 12, 167, 227, 76 COMBOBOX IDC_STRRECDEBUGCOMBO, 17, 182, 151, 49, CBS_DROPDOWNLIST - LTEXT "& ':", IDC_STATIC, 17, 202, 150, 8 + LTEXT "&Файл дампа пам'яті:", IDC_STATIC, 17, 202, 150, 8 EDITTEXT IDC_STRRECDUMPFILE, 17, 210, 153, 12 - AUTOCHECKBOX "& ", IDC_STRRECOVERWRITE, 17, 228, 125, 10 + AUTOCHECKBOX "За&мінювати наявний файл", IDC_STRRECOVERWRITE, 17, 228, 125, 10 DEFPUSHBUTTON "OK", IDOK, 141, 259, 50, 14 - PUSHBUTTON "", IDCANCEL, 195, 259, 50, 14 + PUSHBUTTON "Скасувати", IDCANCEL, 195, 259, 50, 14 END IDD_VIRTMEM DIALOGEX 6, 6, 223, 248 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "³ '" +CAPTION "Віртуальна пам'ять" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT " [ ]", IDC_STATIC, 12, 5, 96, 9 - LTEXT " ()", IDC_STATIC, 115, 5, 96, 9 + LTEXT "Диск [мітка тому]", IDC_STATIC, 12, 5, 96, 9 + LTEXT "Файл довантаження (МБ)", IDC_STATIC, 115, 5, 96, 9 LISTBOX IDC_PAGEFILELIST, 10, 16, 204, 52, LBS_NOTIFY | LBS_USETABSTOPS - GROUPBOX " ", IDC_DRIVEGROUP, 10, 70, 204, 104 - LTEXT ":", IDC_STATIC, 20, 80, 20, 8 + GROUPBOX "Розмір файлу довантаження для вибраного диска", IDC_DRIVEGROUP, 10, 70, 204, 104 + LTEXT "Диск:", IDC_STATIC, 20, 80, 20, 8 LTEXT "", IDC_DRIVE, 88, 81, 100, 9 - LTEXT ":", IDC_STATIC, 20, 92, 56, 9 + LTEXT "Доступно:", IDC_STATIC, 20, 92, 56, 9 LTEXT "", IDC_SPACEAVAIL, 88, 92, 104, 9 - LTEXT "& ():", -1, 22, 118, 75, 9 - LTEXT "& ():", -1, 22, 131, 92, 9 - AUTORADIOBUTTON "& ", IDC_CUSTOM, 20, 105, 79, 9, WS_GROUP - AUTORADIOBUTTON "&, ", IDC_SYSMANSIZE, 20, 145, 143, 9 - AUTORADIOBUTTON "& ", IDC_NOPAGEFILE, 20, 158, 103,9 + LTEXT "&Вихідний розмір (МБ):", -1, 22, 118, 75, 9 + LTEXT "&Максимальний розмір (МБ):", -1, 22, 131, 92, 9 + AUTORADIOBUTTON "&Особливий розмір", IDC_CUSTOM, 20, 105, 79, 9, WS_GROUP + AUTORADIOBUTTON "&Розмір, установлюваний системою", IDC_SYSMANSIZE, 20, 145, 143, 9 + AUTORADIOBUTTON "&Без файлу довантаження", IDC_NOPAGEFILE, 20, 158, 103,9 EDITTEXT IDC_INITIALSIZE, 115, 114, 44, 13, NOT WS_BORDER, WS_EX_CLIENTEDGE EDITTEXT IDC_MAXSIZE, 115, 129, 44, 13, NOT WS_BORDER, WS_EX_CLIENTEDGE - PUSHBUTTON "", IDC_SET, 158, 155, 50, 14 + PUSHBUTTON "Установити", IDC_SET, 158, 155, 50, 14 - GROUPBOX " ", IDC_TOTALGROUP, 10, 177, 204, 46 - LTEXT "̳ :", IDC_STATIC, 18, 188, 88, 9 + GROUPBOX "Загальний розмір файлу довантаження для всіх дисків", IDC_TOTALGROUP, 10, 177, 204, 46 + LTEXT "Мінімальний розмір:", IDC_STATIC, 18, 188, 88, 9 LTEXT "", IDC_MINIMUM, 93, 188, 100, 9 - LTEXT ":", IDC_STATIC, 18, 199, 55, 9 + LTEXT "Рекомендовано:", IDC_STATIC, 18, 199, 55, 9 LTEXT "", IDC_RECOMMENDED, 93, 199, 100, 9 - LTEXT " :", IDC_STATIC, 18, 210, 66, 9 + LTEXT "Поточний розмір:", IDC_STATIC, 18, 210, 66, 9 LTEXT "", IDC_CURRENT, 93, 210, 100, 9 DEFPUSHBUTTON "OK", IDOK, 114, 232, 48, 14 - PUSHBUTTON "", IDCANCEL, 168, 232, 48, 14 + PUSHBUTTON "Скасувати", IDCANCEL, 168, 232, 48, 14 END IDD_ENVIRONMENT_VARIABLES DIALOGEX 6, 18, 252, 245 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Змінні оточення" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - GROUPBOX " ", IDC_STATIC, 7, 12, 238, 100 + GROUPBOX "Змінні користувача", IDC_STATIC, 7, 12, 238, 100 CONTROL "", IDC_USER_VARIABLE_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | LVS_NOSORTHEADER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP, 14, 25, 224, 58, WS_EX_CLIENTEDGE - PUSHBUTTON "&...", IDC_USER_VARIABLE_NEW, 80, 90, 50, 14 - PUSHBUTTON "&...", IDC_USER_VARIABLE_EDIT, 134, 90, 50, 14 - PUSHBUTTON "&", IDC_USER_VARIABLE_DELETE, 188, 90, 50, 14 - GROUPBOX " ", IDC_STATIC, 7, 116, 238, 100 + PUSHBUTTON "&Створити...", IDC_USER_VARIABLE_NEW, 80, 90, 50, 14 + PUSHBUTTON "&Змінити...", IDC_USER_VARIABLE_EDIT, 134, 90, 50, 14 + PUSHBUTTON "В&идалити", IDC_USER_VARIABLE_DELETE, 188, 90, 50, 14 + GROUPBOX "Системні змінні", IDC_STATIC, 7, 116, 238, 100 CONTROL "", IDC_SYSTEM_VARIABLE_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | LVS_NOSORTHEADER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP, 14, 129, 224, 58, WS_EX_CLIENTEDGE - PUSHBUTTON "&...", IDC_SYSTEM_VARIABLE_NEW, 80, 194, 50, 14 - PUSHBUTTON "&...", IDC_SYSTEM_VARIABLE_EDIT, 134, 194, 50, 14 - PUSHBUTTON "&", IDC_SYSTEM_VARIABLE_DELETE, 188, 194, 50, 14 + PUSHBUTTON "&Створити...", IDC_SYSTEM_VARIABLE_NEW, 80, 194, 50, 14 + PUSHBUTTON "&Змінити...", IDC_SYSTEM_VARIABLE_EDIT, 134, 194, 50, 14 + PUSHBUTTON "В&идалити", IDC_SYSTEM_VARIABLE_DELETE, 188, 194, 50, 14 DEFPUSHBUTTON "OK", IDOK, 141, 224, 50, 14, WS_GROUP - PUSHBUTTON "", IDCANCEL, 195, 224, 50, 14 + PUSHBUTTON "Скасувати", IDCANCEL, 195, 224, 50, 14 END IDD_EDIT_VARIABLE DIALOGEX 10, 15, 227, 71 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Редагування змінної" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT "&' :", IDC_STATIC, 7, 14, 50, 8 + LTEXT "&Ім'я змінної:", IDC_STATIC, 7, 14, 50, 8 EDITTEXT IDC_VARIABLE_NAME, 75, 12, 145, 12, ES_AUTOHSCROLL - LTEXT "& :", IDC_STATIC, 7, 32, 87, 8 + LTEXT "&Значення змінної:", IDC_STATIC, 7, 32, 87, 8 EDITTEXT IDC_VARIABLE_VALUE, 75, 30, 145, 12, ES_AUTOHSCROLL DEFPUSHBUTTON "OK", IDOK, 116, 50, 50, 14 - PUSHBUTTON "", IDCANCEL, 170, 50, 50, 14 + PUSHBUTTON "Скасувати", IDCANCEL, 170, 50, 50, 14 END IDD_LICENCE DIALOGEX 6, 5, 267, 159 -CAPTION "˳ " +CAPTION "Ліцензійна угода" FONT 8, "MS Shell Dlg", 0, 0, 0x0 STYLE DS_SHELLFONT | WS_BORDER | WS_THICKFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU BEGIN @@ -273,27 +273,27 @@ END STRINGTABLE DISCARDABLE BEGIN - IDS_CPLSYSTEMNAME "" - IDS_CPLSYSTEMDESCRIPTION " ' , 䳿, ." - IDS_MEGABYTE " " - IDS_GIGABYTE " " - IDS_TERABYTE " " - IDS_PETABYTE " " - IDS_VARIABLE "" - IDS_VALUE "" - IDS_NO_DUMP "()" - IDS_MINI_DUMP "̳(64)" - IDS_KERNEL_DUMP " " - IDS_FULL_DUMP " " - IDS_USERPROFILE_NAME "'" - IDS_USERPROFILE_SIZE "" - IDS_USERPROFILE_TYPE "" - IDS_USERPROFILE_STATUS "" - IDS_USERPROFILE_MODIFIED "" + IDS_CPLSYSTEMNAME "Система" + IDS_CPLSYSTEMDESCRIPTION "Перегляд відомостей про систему комп'ютера та зміна параметрів обладнання, швидкодії, автоматичних оновлень." + IDS_MEGABYTE "Мб ОЗП" + IDS_GIGABYTE "Гб ОЗП" + IDS_TERABYTE "Тб ОЗП" + IDS_PETABYTE "Пб ОЗП" + IDS_VARIABLE "Змінна" + IDS_VALUE "Значення" + IDS_NO_DUMP "(немає)" + IDS_MINI_DUMP "Мінідамп(64Кб)" + IDS_KERNEL_DUMP "Дамп ядра" + IDS_FULL_DUMP "Повний дамп" + IDS_USERPROFILE_NAME "Ім'я" + IDS_USERPROFILE_SIZE "Розмір" + IDS_USERPROFILE_TYPE "Тип" + IDS_USERPROFILE_STATUS "Стан" + IDS_USERPROFILE_MODIFIED "Змінено" IDS_MESSAGEBOXTITLE "System control panel applet" - IDS_WARNINITIALSIZE " ." - IDS_WARNMAXIMUMSIZE " ." - IDS_WARNINITIALRANGE " 2 ' ." - IDS_WARNMAXIMUMRANGE " ' ." - IDS_DEVS "\nReactOS Team\n\nProject Coordinator\n\nAleksey Bragin\n\nDevelopment Team\n\nAleksey Bragin\nAndrew Greenwood\nAndrey Korotaev\nArt Yerkes\nChristoph von Wittich\nColin Finck\nDaniel Reimer\nDmitry Chapyshev\nEric Kohl\nGed Murphy\nGregor Brunmar\nHerv Poussineau\nJames Tabor\nJeffrey Morlan\nJohannes Anderwald\nKJK::Hyperion\nMaarten Bosma\nMagnus Olsen\nMarc Piulachs\nMatthias Kupfer\nMike Nordell\nPeter Ward\nPierre Schweitzer\nSaveliy Tretiakov\nStefan Ginsberg\nSylvain Petreolle\nThomas Blmel\nTimo Kreuzer \n\nAlex Ionescu\nFilip Navara\nGunnar Dalsnes\nMartin Fuchs\nRoyce Mitchell III\nBrandon Turner\nBrian Palmer\nCasper Hornstrup\nDavid Welch\nEmanuele Aliberti\nG van Geldorp\nGregor Anich\nJason Filby\nJens Collin\nMichael Wirth\nNathan Woods\nRobert Dickenson\nRex Jolliff\nVizzini \n\nRelease Engineers\n\nColin Finck\nZ98\n\nWebsite Team\n\nColin Finck\nJaix Bly\nKlemens Friedl\nZ98\n\nMedia Team\n\nMindflyer\nWierd_W\n\nfurther thanks go to\n\nall Contributers\nWine Team\n\n" + IDS_WARNINITIALSIZE "Введіть числове значення для початкового розміру файлу довантаження." + IDS_WARNMAXIMUMSIZE "Введіть числове значення для максимального розміру файлу довантаження." + IDS_WARNINITIALRANGE "Початковий розмір файлу довантаження не повинен бути меншим 2 Мб і не повинен перевищувати об'єм вільного місця на обраному диску." + IDS_WARNMAXIMUMRANGE "Максимальний розмір файлу довантаження не повинен бути меншим від початкового та не повинен перевищувати об'єм вільного місця на обраному диску." + IDS_DEVS "\nReactOS Team\n\nProject Coordinator\n\nAleksey Bragin\n\nDevelopment Team\n\nAleksey Bragin\nAndrew Greenwood\nAndrey Korotaev\nArt Yerkes\nChristoph von Wittich\nColin Finck\nDaniel Reimer\nDmitry Chapyshev\nEric Kohl\nGed Murphy\nGregor Brunmar\nHervé Poussineau\nJames Tabor\nJeffrey Morlan\nJohannes Anderwald\nKJK::Hyperion\nMaarten Bosma\nMagnus Olsen\nMarc Piulachs\nMatthias Kupfer\nMike Nordell\nPeter Ward\nPierre Schweitzer\nSaveliy Tretiakov\nStefan Ginsberg\nSylvain Petreolle\nThomas Blümel\nTimo Kreuzer \n\nAlex Ionescu\nFilip Navara\nGunnar Dalsnes\nMartin Fuchs\nRoyce Mitchell III\nBrandon Turner\nBrian Palmer\nCasper Hornstrup\nDavid Welch\nEmanuele Aliberti\nGé van Geldorp\nGregor Anich\nJason Filby\nJens Collin\nMichael Wirth\nNathan Woods\nRobert Dickenson\nRex Jolliff\nVizzini \n\nRelease Engineers\n\nColin Finck\nZ98\n\nWebsite Team\n\nColin Finck\nJaix Bly\nKlemens Friedl\nZ98\n\nMedia Team\n\nMindflyer\nWierd_W\n\nfurther thanks go to\n\nall Contributers\nWine Team\n\n" END diff --git a/dll/cpl/sysdm/licence.c b/dll/cpl/sysdm/licence.c index a1a799c70c3..8dfe6cf1b15 100644 --- a/dll/cpl/sysdm/licence.c +++ b/dll/cpl/sysdm/licence.c @@ -54,7 +54,7 @@ OnInitDialog(HWND hDlg, PLIC_CONTEXT pLicInfo) EM_SETSEL, -1, 0); - + PostMessage(GetDlgItem(hDlg, IDC_LICENCEEDIT), WM_VSCROLL, SB_TOP, 0); return TRUE; } diff --git a/dll/cpl/sysdm/precomp.h b/dll/cpl/sysdm/precomp.h index cf3afd6f62a..f3b20cfbc57 100644 --- a/dll/cpl/sysdm/precomp.h +++ b/dll/cpl/sysdm/precomp.h @@ -49,11 +49,11 @@ INT_PTR CALLBACK LicenceDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM l typedef struct _PAGEFILE { - TCHAR szDrive[3]; - INT InitialSize; - INT MaximumSize; - INT FreeSize; - BOOL bUsed; + TCHAR szDrive[3]; + UINT InitialSize; + UINT MaximumSize; + UINT FreeSize; + BOOL bUsed; } PAGEFILE, *PPAGEFILE; typedef struct _VIRTMEM diff --git a/dll/cpl/sysdm/rsrc.rc b/dll/cpl/sysdm/rsrc.rc index ee3e6ff485e..2542bb47c7b 100644 --- a/dll/cpl/sysdm/rsrc.rc +++ b/dll/cpl/sysdm/rsrc.rc @@ -12,13 +12,16 @@ #include "lang/it-IT.rc" #include "lang/ja-JP.rc" #include "lang/no-NO.rc" +#include "lang/sk-SK.rc" +#include "lang/sv-SE.rc" +#include "lang/zh-CN.rc" + +// UTF-8 +#pragma code_page(65001) #include "lang/pl-PL.rc" #include "lang/ro-RO.rc" #include "lang/ru-RU.rc" -#include "lang/sk-SK.rc" -#include "lang/sv-SE.rc" #include "lang/uk-UA.rc" -#include "lang/zh-CN.rc" /* #include "lang/da-DK.rc" diff --git a/dll/cpl/sysdm/virtmem.c b/dll/cpl/sysdm/virtmem.c index c09b6e40dcf..648b1c41f7c 100644 --- a/dll/cpl/sysdm/virtmem.c +++ b/dll/cpl/sysdm/virtmem.c @@ -206,8 +206,7 @@ WritePageFileSettings(PVIRTMEM pVirtMem) HKEY hk = NULL; TCHAR szPagingFiles[2048]; TCHAR szText[256]; - INT i; - INT nPos = 0; + INT i, nPos = 0; BOOL bErr = TRUE; for (i = 0; i < pVirtMem->Count; ++i) @@ -312,7 +311,7 @@ OnSet(PVIRTMEM pVirtMem) LB_GETCURSEL, 0, 0); - if (Index < pVirtMem->Count) + if (Index >= 0 && Index < pVirtMem->Count) { /* check if custom settings are checked */ if (IsDlgButtonChecked(pVirtMem->hSelf, @@ -463,8 +462,8 @@ OnSelChange(HWND hwndDlg, PVIRTMEM pVirtMem) if (GetDiskFreeSpaceEx(pVirtMem->Pagefile[Index].szDrive, NULL, NULL, &FreeBytes)) { - pVirtMem->Pagefile[Index].FreeSize = FreeBytes.QuadPart >> 20; - _stprintf(szBuffer, _T("%I64u MB"), FreeBytes.QuadPart / (1024 * 1024)); + pVirtMem->Pagefile[Index].FreeSize = (UINT)(FreeBytes.QuadPart / (1024 * 1024)); + _stprintf(szBuffer, _T("%I64u MB"), pVirtMem->Pagefile[Index].FreeSize); SetDlgItemText(hwndDlg, IDC_SPACEAVAIL, szBuffer); } diff --git a/dll/cpl/telephon/lang/pl-PL.rc b/dll/cpl/telephon/lang/pl-PL.rc index 021eecb8830..ff518f7514c 100644 --- a/dll/cpl/telephon/lang/pl-PL.rc +++ b/dll/cpl/telephon/lang/pl-PL.rc @@ -1,8 +1,9 @@ /* - * translated by Caemyr - Olaf Siejka (Jan,2008) - * Use ReactOS forum PM or IRC to contact me - * http://www.reactos.org - * IRC: irc.freenode.net #reactos-pl; + * translated by Caemyr - Olaf Siejka (Jan,2008) + * Use ReactOS forum PM or IRC to contact me + * http://www.reactos.org + * IRC: irc.freenode.net #reactos-pl; + * UTF-8 conversion by Caemyr (May, 2011) */ LANGUAGE LANG_POLISH, SUBLANG_DEFAULT @@ -10,5 +11,5 @@ LANGUAGE LANG_POLISH, SUBLANG_DEFAULT STRINGTABLE BEGIN IDS_CPLSYSTEMNAME "Opcje telefonu i modemu" - IDS_CPLSYSTEMDESCRIPTION "Skonfiguruj reguy wybierania numerw oraz ustawienia modemu." + IDS_CPLSYSTEMDESCRIPTION "Skonfiguruj reguły wybierania numerów oraz ustawienia modemu." END diff --git a/dll/cpl/telephon/lang/ro-RO.rc b/dll/cpl/telephon/lang/ro-RO.rc index ae4a013dafc..a81b9ac9ee6 100644 --- a/dll/cpl/telephon/lang/ro-RO.rc +++ b/dll/cpl/telephon/lang/ro-RO.rc @@ -1,11 +1,7 @@ LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL -#pragma code_page(65001) - STRINGTABLE BEGIN IDS_CPLSYSTEMNAME "Opțiuni telefon și modem" IDS_CPLSYSTEMDESCRIPTION "Configurează regulile de apelare telefonică și setările pentru modem." END - -#pragma code_page(default) diff --git a/dll/cpl/telephon/lang/ru-RU.rc b/dll/cpl/telephon/lang/ru-RU.rc index 8d3255b5603..c53bf01618d 100644 --- a/dll/cpl/telephon/lang/ru-RU.rc +++ b/dll/cpl/telephon/lang/ru-RU.rc @@ -2,6 +2,6 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT STRINGTABLE BEGIN - IDS_CPLSYSTEMNAME " " - IDS_CPLSYSTEMDESCRIPTION " ." + IDS_CPLSYSTEMNAME "Телефон и модем" + IDS_CPLSYSTEMDESCRIPTION "Настройка правил набора номера и других параметров при работе с модемом." END diff --git a/dll/cpl/telephon/lang/uk-UA.rc b/dll/cpl/telephon/lang/uk-UA.rc index 31715fe51a9..ba04a999e43 100644 --- a/dll/cpl/telephon/lang/uk-UA.rc +++ b/dll/cpl/telephon/lang/uk-UA.rc @@ -10,6 +10,6 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT STRINGTABLE BEGIN - IDS_CPLSYSTEMNAME " " - IDS_CPLSYSTEMDESCRIPTION " ." + IDS_CPLSYSTEMNAME "Телефон і модем" + IDS_CPLSYSTEMDESCRIPTION "Настройка правил набору номера та інших параметрів модема." END diff --git a/dll/cpl/telephon/rsrc.rc b/dll/cpl/telephon/rsrc.rc index 1f531b2c9cf..fdf7c3ffeb3 100644 --- a/dll/cpl/telephon/rsrc.rc +++ b/dll/cpl/telephon/rsrc.rc @@ -11,8 +11,11 @@ #include "lang/it-IT.rc" #include "lang/ja-JP.rc" #include "lang/no-NO.rc" +#include "lang/sk-SK.rc" + +// UTF-8 +#pragma code_page(65001) #include "lang/pl-PL.rc" #include "lang/ro-RO.rc" #include "lang/ru-RU.rc" -#include "lang/sk-SK.rc" #include "lang/uk-UA.rc" diff --git a/dll/cpl/timedate/CMakeLists.txt b/dll/cpl/timedate/CMakeLists.txt index 9dbc98ee293..32727d391ce 100644 --- a/dll/cpl/timedate/CMakeLists.txt +++ b/dll/cpl/timedate/CMakeLists.txt @@ -27,4 +27,5 @@ add_importlibs(timedate msvcrt kernel32) +add_pch(timedate timedate.h) add_cd_file(TARGET timedate DESTINATION reactos/system32 FOR all) diff --git a/dll/cpl/timedate/lang/pl-PL.rc b/dll/cpl/timedate/lang/pl-PL.rc index b5b5363a290..562bba58a0c 100644 --- a/dll/cpl/timedate/lang/pl-PL.rc +++ b/dll/cpl/timedate/lang/pl-PL.rc @@ -1,11 +1,12 @@ -// Polish translation by Sebastian Gasiorek /* -* update by xrogers (13.04.2007) -* xxrogers@users.sourceforge.net -* https://sourceforge.net/projects/reactospl -* -* update by Caemyr - Olaf Siejka (Jan, 2008) -*/ + * translated by Sebastian Gasiorek + * updated by xrogers (13.04.2007) + * xxrogers@users.sourceforge.net + * https://sourceforge.net/projects/reactospl + * updated by Caemyr - Olaf Siejka (Jan, 2008) + * UTF-8 conversion by Caemyr (May, 2011) + */ + LANGUAGE LANG_POLISH, SUBLANG_DEFAULT IDD_DATETIMEPAGE DIALOGEX 0, 0, 252, 146 @@ -40,7 +41,7 @@ BEGIN COMBOBOX IDC_TIMEZONELIST, 5, 4, 241, 136, CBS_DROPDOWNLIST | WS_VSCROLL | WS_VISIBLE | WS_TABSTOP CONTROL "", IDC_WORLD_BACKGROUND, "Static", SS_OWNERDRAW, 5, 20, 240, 110, WS_EX_STATICEDGE - AUTOCHECKBOX "&Automatycznie uwzgldnij zmiany czasu", + AUTOCHECKBOX "&Automatycznie uwzględnij zmiany czasu", IDC_AUTODAYLIGHT, 6, 132, 242, 11, WS_VISIBLE | WS_GROUP | WS_TABSTOP END @@ -57,19 +58,19 @@ BEGIN PUSHBUTTON "&Aktualizuj teraz", IDC_UPDATEBUTTON, 187, 22, 49, 14 LTEXT "", IDC_SUCSYNC, 16, 54, 214, 23 LTEXT "", IDC_NEXTSYNC, 12, 96, 137, 12 - LTEXT "Synchronizacja moe nastpi tylko wtedy, gdy komputer jest podczony do Internetu.", -1, 12, 114, 225, 25 + LTEXT "Synchronizacja może nastąpić tylko wtedy, gdy komputer jest podłączony do Internetu.", -1, 12, 114, 225, 25 END STRINGTABLE BEGIN IDS_CPLNAME "Data/Godzina" - IDS_CPLDESCRIPTION "Ustaw dat, godzin i stref czasow komputera." + IDS_CPLDESCRIPTION "Ustaw datę, godzinę i strefę czasową komputera." IDS_TIMEZONETEXT "Aktualna strefa czasowa: %s" - IDS_TIMEZONEINVALID "Nieprawidowa" + IDS_TIMEZONEINVALID "Nieprawidłowa" IDS_TIMEZONEUNKNOWN "Nieznana" - IDS_INETTIMESUCSYNC "Zegar zosta pomylnie zsynchronizowany z %s w dniu %s o %s" - IDS_INETTIMENEXTSYNC "Nastpna synchronizacja w dniu %s o %s" - IDS_INETTIMESYNCING "Prosz czeka, gdy ReactOS zsynchronizuje czas z %s" - IDS_INETTIMEERROR "Wystpi bd podczas gdy ReactOS synchronizowa czas z %s" + IDS_INETTIMESUCSYNC "Zegar został pomyślnie zsynchronizowany z %s w dniu %s o %s" + IDS_INETTIMENEXTSYNC "Następna synchronizacja w dniu %s o %s" + IDS_INETTIMESYNCING "Proszę czekać, gdy ReactOS zsynchronizuje czas z %s" + IDS_INETTIMEERROR "Wystąpił błąd podczas próby synchronizacji czasu z %s" END diff --git a/dll/cpl/timedate/lang/ro-RO.rc b/dll/cpl/timedate/lang/ro-RO.rc index c5311390e25..fb523a8c87a 100644 --- a/dll/cpl/timedate/lang/ro-RO.rc +++ b/dll/cpl/timedate/lang/ro-RO.rc @@ -1,7 +1,5 @@ LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL -#pragma code_page(65001) - IDD_DATETIMEPAGE DIALOGEX 0, 0, 252, 146 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION CAPTION "Dată și timp" @@ -68,5 +66,3 @@ BEGIN IDS_INETTIMESYNCING "Așteptași cât ReactOS se sincronizează cu %s" IDS_INETTIMEERROR "A apărut o eroare cât timp ReactOS se sincroniza cu %s" END - -#pragma code_page(default) diff --git a/dll/cpl/timedate/lang/ru-RU.rc b/dll/cpl/timedate/lang/ru-RU.rc index 63d508a8492..0b9b80ba0b6 100644 --- a/dll/cpl/timedate/lang/ru-RU.rc +++ b/dll/cpl/timedate/lang/ru-RU.rc @@ -2,10 +2,10 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT IDD_DATETIMEPAGE DIALOGEX 0, 0, 252, 146 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Дата и время" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - GROUPBOX "&", -1, 4, 2, 122, 125 + GROUPBOX "&Дата", -1, 4, 2, 122, 125 COMBOBOX IDC_MONTHCB, 11, 17, 50, 120, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP EDITTEXT IDC_YEARTEXT,65, 17, 55, 12, ES_LEFT | WS_GROUP | ES_READONLY CONTROL "", IDC_YEAR, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_NOTHOUSANDS | @@ -14,7 +14,7 @@ BEGIN CONTROL "", IDC_MONTHCALENDAR, "MonthCalWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP, 11, 37, 108, 80, WS_EX_CLIENTEDGE - GROUPBOX "&", -1, 132, 2, 113, 125 + GROUPBOX "&Время", -1, 132, 2, 113, 125 CONTROL "", IDC_TIMEPICKER, "SysDateTimePick32", DTS_TIMEFORMAT | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 144, 105, 90, 12 @@ -26,42 +26,42 @@ END IDD_TIMEZONEPAGE DIALOGEX 0, 0, 252, 146 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Часовой пояс" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN COMBOBOX IDC_TIMEZONELIST, 5, 4, 241, 136, CBS_DROPDOWNLIST | WS_VSCROLL | WS_VISIBLE | WS_TABSTOP CONTROL "", IDC_WORLD_BACKGROUND, "Static", SS_OWNERDRAW, 5, 20, 240, 110, WS_EX_STATICEDGE - AUTOCHECKBOX "& ", + AUTOCHECKBOX "Автомати&ческий переход на летнее время и обратно", IDC_AUTODAYLIGHT, 6, 132, 242, 11, WS_VISIBLE | WS_GROUP | WS_TABSTOP END IDD_INETTIMEPAGE DIALOGEX 0, 0, 252, 146 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Время через Интернет" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN COMBOBOX IDC_SERVERLIST, 65, 22, 117, 136, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - AUTOCHECKBOX "& ", IDC_AUTOSYNC, + AUTOCHECKBOX "&Выполнять синхронизацию с сервером времени в Интернете", IDC_AUTOSYNC, 11 ,7, 246, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP - LTEXT ":", IDC_SERVERTEXT, 34, 22, 28, 13 - PUSHBUTTON "&", IDC_UPDATEBUTTON, 187, 22, 49, 13 + LTEXT "Сервер:", IDC_SERVERTEXT, 34, 22, 28, 13 + PUSHBUTTON "&Обновить", IDC_UPDATEBUTTON, 187, 22, 49, 13 LTEXT "", IDC_SUCSYNC, 16, 54, 214, 23 LTEXT "", IDC_NEXTSYNC, 12, 96, 137, 12 - LTEXT " .", -1, 12, 114, 225, 25 + LTEXT "Синхронизация может быть выполнена только при наличии подключения к сети Интернет.", -1, 12, 114, 225, 25 END STRINGTABLE BEGIN - IDS_CPLNAME " " - IDS_CPLDESCRIPTION " , " - IDS_TIMEZONETEXT " : %s" - IDS_TIMEZONEINVALID "" - IDS_TIMEZONEUNKNOWN "" - IDS_INETTIMESUCSYNC " %s %s %s" - IDS_INETTIMENEXTSYNC " : %s %s" - IDS_INETTIMESYNCING ", %s" - IDS_INETTIMEERROR " %s" + IDS_CPLNAME "Дата и время" + IDS_CPLDESCRIPTION "Установка даты, времени и часового пояса для этого компьютера" + IDS_TIMEZONETEXT "Текущий часовой пояс: %s" + IDS_TIMEZONEINVALID "Недействительная" + IDS_TIMEZONEUNKNOWN "Неизвестная" + IDS_INETTIMESUCSYNC "Время было успешно синхронизировано с %s на %s в %s" + IDS_INETTIMENEXTSYNC "Следующая синхронизация через: %s в %s" + IDS_INETTIMESYNCING "Подождите, пока РеактОС синхронизирует время с %s" + IDS_INETTIMEERROR "Возникла ошибка во время синхронизации с %s" END diff --git a/dll/cpl/timedate/lang/uk-UA.rc b/dll/cpl/timedate/lang/uk-UA.rc index b1f33aaf8ae..da3d43985e4 100644 --- a/dll/cpl/timedate/lang/uk-UA.rc +++ b/dll/cpl/timedate/lang/uk-UA.rc @@ -10,10 +10,10 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT IDD_DATETIMEPAGE DIALOGEX 0, 0, 252, 146 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Дата й час" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - GROUPBOX "&", -1, 4, 2, 122, 125 + GROUPBOX "&Дата", -1, 4, 2, 122, 125 COMBOBOX IDC_MONTHCB, 11, 17, 50, 120, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP EDITTEXT IDC_YEARTEXT,65, 17, 55, 12, ES_LEFT | WS_GROUP | ES_READONLY CONTROL "", IDC_YEAR, UPDOWN_CLASS, UDS_SETBUDDYINT | UDS_NOTHOUSANDS | @@ -23,7 +23,7 @@ BEGIN CONTROL "", IDC_MONTHCALENDAR, "MonthCalWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP, 11, 37, 108, 80, WS_EX_CLIENTEDGE - GROUPBOX "&", -1, 132, 2, 113, 125 + GROUPBOX "&Час", -1, 132, 2, 113, 125 CONTROL "", IDC_TIMEPICKER, "SysDateTimePick32", DTS_TIMEFORMAT | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 144, 105, 90, 12 @@ -35,42 +35,42 @@ END IDD_TIMEZONEPAGE DIALOGEX 0, 0, 252, 146 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Часовий пояс" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN COMBOBOX IDC_TIMEZONELIST, 5, 4, 241, 136, CBS_DROPDOWNLIST | WS_VSCROLL | WS_VISIBLE | WS_TABSTOP CONTROL "", IDC_WORLD_BACKGROUND, "Static", SS_OWNERDRAW, 5, 20, 240, 110, WS_EX_STATICEDGE - AUTOCHECKBOX "& / ", + AUTOCHECKBOX "Автомати&чне переведення годинника на літний/зимовий час", IDC_AUTODAYLIGHT, 6, 132, 242, 11, WS_VISIBLE | WS_GROUP | WS_TABSTOP END IDD_INETTIMEPAGE DIALOGEX 0, 0, 252, 146 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Час Інтернету" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN COMBOBOX IDC_SERVERLIST, 65, 22, 117, 136, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - AUTOCHECKBOX " ", IDC_AUTOSYNC, + AUTOCHECKBOX "Автоматично синхронізувати з сервером часу в Інтернеті", IDC_AUTOSYNC, 11 ,7, 241, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP - LTEXT ":", IDC_SERVERTEXT, 34, 22, 28, 13 - PUSHBUTTON "", IDC_UPDATEBUTTON, 187, 22, 49, 14 + LTEXT "Сервер:", IDC_SERVERTEXT, 34, 22, 28, 13 + PUSHBUTTON "Оновити", IDC_UPDATEBUTTON, 187, 22, 49, 14 LTEXT "", IDC_SUCSYNC, 12, 54, 214, 23 LTEXT "", IDC_NEXTSYNC, 12, 96, 137, 12 - LTEXT " , ' .", -1, 12, 114, 225, 25 + LTEXT "Синхронізація можлива, лише коли комп'ютер підключений до Інтернету.", -1, 12, 114, 225, 25 END STRINGTABLE BEGIN - IDS_CPLNAME " " - IDS_CPLDESCRIPTION " , '." - IDS_TIMEZONETEXT " : %s" - IDS_TIMEZONEINVALID "" - IDS_TIMEZONEUNKNOWN "" - IDS_INETTIMESUCSYNC " %s %s %s" - IDS_INETTIMENEXTSYNC " : %s %s" - IDS_INETTIMESYNCING " , ReactOS %s" - IDS_INETTIMEERROR " %s" + IDS_CPLNAME "Дата й час" + IDS_CPLDESCRIPTION "Установлення дати, часу й часового поясу для цього комп'ютера." + IDS_TIMEZONETEXT "Поточний часовий пояс: %s" + IDS_TIMEZONEINVALID "Недійсний" + IDS_TIMEZONEUNKNOWN "Невідомий" + IDS_INETTIMESUCSYNC "Час було успішно синхронізовано з %s на %s в %s" + IDS_INETTIMENEXTSYNC "Наступна синхронізація: %s в %s" + IDS_INETTIMESYNCING "Будь ласка зачекайте, поки ReactOS синхронізує час з %s" + IDS_INETTIMEERROR "Помилка під час синхронізації з %s" END diff --git a/dll/cpl/timedate/rsrc.rc b/dll/cpl/timedate/rsrc.rc index f726f79d7d8..3855b76d051 100644 --- a/dll/cpl/timedate/rsrc.rc +++ b/dll/cpl/timedate/rsrc.rc @@ -16,10 +16,13 @@ #include "lang/ja-JP.rc" #include "lang/nl-NL.rc" #include "lang/no-NO.rc" -#include "lang/pl-PL.rc" -#include "lang/ro-RO.rc" -#include "lang/ru-RU.rc" #include "lang/sk-SK.rc" #include "lang/sv-SE.rc" #include "lang/th-TH.rc" + +// UTF-8 +#pragma code_page(65001) +#include "lang/pl-PL.rc" +#include "lang/ro-RO.rc" +#include "lang/ru-RU.rc" #include "lang/uk-UA.rc" diff --git a/dll/cpl/timedate/timedate.h b/dll/cpl/timedate/timedate.h index ced96a12eec..97e6acb09ae 100644 --- a/dll/cpl/timedate/timedate.h +++ b/dll/cpl/timedate/timedate.h @@ -1,5 +1,3 @@ -#pragma once - #include #include #include diff --git a/dll/cpl/timedate/timedate.rbuild b/dll/cpl/timedate/timedate.rbuild index a611b2a74ea..dd88c4c9e44 100644 --- a/dll/cpl/timedate/timedate.rbuild +++ b/dll/cpl/timedate/timedate.rbuild @@ -17,4 +17,5 @@ timedate.c timezone.c timedate.rc + timedate.h diff --git a/dll/cpl/usrmgr/CMakeLists.txt b/dll/cpl/usrmgr/CMakeLists.txt index a1d0ec5e12a..1449fa7db7e 100644 --- a/dll/cpl/usrmgr/CMakeLists.txt +++ b/dll/cpl/usrmgr/CMakeLists.txt @@ -30,5 +30,5 @@ add_importlibs(usrmgr kernel32 ntdll) - +add_pch(usrmgr usrmgr.h) add_cd_file(TARGET usrmgr DESTINATION reactos/system32 FOR all) diff --git a/dll/cpl/usrmgr/lang/pl-PL.rc b/dll/cpl/usrmgr/lang/pl-PL.rc index cf349ab053b..6d851dc85be 100644 --- a/dll/cpl/usrmgr/lang/pl-PL.rc +++ b/dll/cpl/usrmgr/lang/pl-PL.rc @@ -1,10 +1,19 @@ +/* + * translated by Caemyr - Olaf Siejka (Jun,2008) + * updated by Saibamen - Adam Stachowicz (Jul, 2008) + * Use ReactOS forum PM or IRC to contact me + * http://www.reactos.org + * IRC: irc.freenode.net #reactos-pl + * UTF-8 conversion by Caemyr (May, 2011) + */ + LANGUAGE LANG_POLISH, SUBLANG_DEFAULT /* Dialogs */ IDD_USERS DIALOGEX DISCARDABLE 0, 0, 252, 223 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Uytkownicy" +CAPTION "Użytkownicy" FONT 8, "MS Shell Dlg" BEGIN CONTROL "", IDC_USERS_LIST, "SysListView32", LVS_REPORT | LVS_EDITLABELS | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP, @@ -27,38 +36,38 @@ STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION CAPTION "Dodatki" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Przestrze celowo pozostawiona pusta", IDC_STATIC, 66, 90, 112, 8 + LTEXT "Przestrzeń celowo pozostawiona pusta", IDC_STATIC, 66, 90, 112, 8 END IDD_USER_GENERAL DIALOGEX DISCARDABLE 0, 0, 252, 223 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Oglne" +CAPTION "Ogólne" FONT 8, "MS Shell Dlg" BEGIN LTEXT "", IDC_USER_GENERAL_NAME, 7, 12, 112, 8 - LTEXT "Imi i nazwisko:", -1, 7, 46, 63, 8 + LTEXT "Imię i Nazwisko:", -1, 7, 46, 63, 8 EDITTEXT IDC_USER_GENERAL_FULL_NAME,77,43,168,13,ES_AUTOHSCROLL LTEXT "Opis:", -1, 7, 64, 63, 8 EDITTEXT IDC_USER_GENERAL_DESCRIPTION,77,61,168,13,ES_AUTOHSCROLL - AUTOCHECKBOX "Uytkownik musi zmieni haso podczas pierwszego logowania",IDC_USER_GENERAL_FORCE_CHANGE,7,82,210,10 - AUTOCHECKBOX "Uytkownik nie moe zmieni hasa",IDC_USER_GENERAL_CANNOT_CHANGE,7,95,210,10 - AUTOCHECKBOX "Haso nigdy nie wygasa",IDC_USER_GENERAL_NEVER_EXPIRES,7,108,210,10 - AUTOCHECKBOX "Konto jest wyczone",IDC_USER_GENERAL_DISABLED,7,121,210,10 + AUTOCHECKBOX "Użytkownik musi zmienić hasło podczas pierwszego logowania",IDC_USER_GENERAL_FORCE_CHANGE,7,82,210,10 + AUTOCHECKBOX "Użytkownik nie może zmienić hasła",IDC_USER_GENERAL_CANNOT_CHANGE,7,95,210,10 + AUTOCHECKBOX "Hasło nigdy nie wygasa",IDC_USER_GENERAL_NEVER_EXPIRES,7,108,210,10 + AUTOCHECKBOX "Konto jest wyłączone",IDC_USER_GENERAL_DISABLED,7,121,210,10 AUTOCHECKBOX "Konto jest zablokowane",IDC_USER_GENERAL_LOCKED,7,134,210,10 END IDD_USER_MEMBERSHIP DIALOGEX DISCARDABLE 0, 0, 252, 223 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Czonkostwo" +CAPTION "Członkostwo" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Naley do:", -1, 7, 7, 56, 8 + LTEXT "Należy do:", -1, 7, 7, 56, 8 CONTROL "", IDC_USER_MEMBERSHIP_LIST, "SysListView32", LVS_REPORT | LVS_NOCOLUMNHEADER | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP, 7, 18, 238, 173, WS_EX_CLIENTEDGE PUSHBUTTON "Dodaj...", IDC_USER_MEMBERSHIP_ADD, 7, 197, 50, 14 - PUSHBUTTON "Usu", IDC_USER_MEMBERSHIP_REMOVE, 61, 197, 50, 14, WS_DISABLED + PUSHBUTTON "Usuń", IDC_USER_MEMBERSHIP_REMOVE, 61, 197, 50, 14, WS_DISABLED END @@ -67,15 +76,15 @@ STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION CAPTION "Profil" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "Profil uytkownika", -1, 7, 7, 238, 54 - LTEXT "cieka profilu:", -1, 16, 22, 55, 8 + GROUPBOX "Profil użytkownika", -1, 7, 7, 238, 54 + LTEXT "Ścieżka profilu:", -1, 16, 22, 55, 8 EDITTEXT IDC_USER_PROFILE_PATH, 78, 19, 160, 13, ES_AUTOHSCROLL LTEXT "Skrypt logowania:", -1, 16, 40, 55, 8 EDITTEXT IDC_USER_PROFILE_SCRIPT, 78, 37, 160, 13, ES_AUTOHSCROLL GROUPBOX "Katalog domowy", -1, 7, 68, 238, 54 - AUTORADIOBUTTON "cieka lokalna:", IDC_USER_PROFILE_LOCAL, 16, 83, 60, 10 - AUTORADIOBUTTON "Pocz:", IDC_USER_PROFILE_REMOTE, 16, 100, 60, 10 + AUTORADIOBUTTON "Ścieżka lokalna:", IDC_USER_PROFILE_LOCAL, 16, 83, 60, 10 + AUTORADIOBUTTON "Połącz:", IDC_USER_PROFILE_REMOTE, 16, 100, 60, 10 EDITTEXT IDC_USER_PROFILE_LOCAL_PATH, 78, 81, 160, 13, ES_AUTOHSCROLL COMBOBOX IDC_USER_PROFILE_DRIVE, 78, 99, 26, 160, CBS_DROPDOWNLIST | CBS_SORT | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL LTEXT "z:", -1, 112, 101, 12, 8 @@ -85,29 +94,29 @@ END IDD_GROUP_GENERAL DIALOGEX DISCARDABLE 0, 0, 252, 223 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Oglne" +CAPTION "Ogólne" FONT 8, "MS Shell Dlg" BEGIN LTEXT "", IDC_GROUP_GENERAL_NAME, 7, 12, 112, 8 LTEXT "Opis:", -1, 7, 45, 46, 8 EDITTEXT IDC_GROUP_GENERAL_DESCRIPTION,65,42,180,13,ES_AUTOHSCROLL - LTEXT "Czonkowie:", -1, 7, 63, 45, 8 + LTEXT "Członkowie:", -1, 7, 63, 45, 8 CONTROL "", IDC_GROUP_GENERAL_MEMBERS, "SysListView32", LVS_REPORT | LVS_NOCOLUMNHEADER | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP, 7, 74, 238, 117, WS_EX_CLIENTEDGE PUSHBUTTON "Dodaj...", IDC_GROUP_GENERAL_ADD, 7, 197, 50, 14, WS_DISABLED - PUSHBUTTON "Usu", IDC_GROUP_GENERAL_REMOVE, 61, 197, 50, 14, WS_DISABLED + PUSHBUTTON "Usuń", IDC_GROUP_GENERAL_REMOVE, 61, 197, 50, 14, WS_DISABLED END IDD_CHANGE_PASSWORD DIALOGEX DISCARDABLE 0, 0, 267, 74 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_SHELLFONT -CAPTION "Zmiana hasa" +CAPTION "Zmiana hasła" FONT 8, "MS Shell Dlg" BEGIN EDITTEXT IDC_EDIT_PASSWORD1,107,7,153,14,ES_AUTOHSCROLL | ES_PASSWORD - RTEXT "Nowe haso:", -1,7,10,96,8 + RTEXT "Nowe hasło:", -1,7,10,96,8 EDITTEXT IDC_EDIT_PASSWORD2,107,25,153,14,ES_AUTOHSCROLL | ES_PASSWORD - RTEXT "Powtrz haso:", -1,7,28,96,8 + RTEXT "Powtórz hasło:", -1,7,28,96,8 DEFPUSHBUTTON "OK",IDOK,156,53,50,14 PUSHBUTTON "Anuluj",IDCANCEL,210,53,50,14 END @@ -115,22 +124,22 @@ END IDD_USER_NEW DIALOGEX DISCARDABLE 0, 0, 267, 200 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_SHELLFONT -CAPTION "Nowy uytkownik" +CAPTION "Nowy użytkownik" FONT 8, "MS Shell Dlg" BEGIN EDITTEXT IDC_USER_NEW_NAME,107,7,153,14,ES_AUTOHSCROLL - RTEXT "Nazwa uytkownika:", -1,7,10,96,8 + RTEXT "Nazwa użytkownika:", -1,7,10,96,8 EDITTEXT IDC_USER_NEW_FULL_NAME,107,25,153,14,ES_AUTOHSCROLL - RTEXT "Imi i nazwisko:", -1,7,28,96,8 + RTEXT "Imię i Nazwisko:", -1,7,28,96,8 EDITTEXT IDC_USER_NEW_DESCRIPTION,107,43,153,14,ES_AUTOHSCROLL RTEXT "Opis:", -1,7,46,96,8 EDITTEXT IDC_USER_NEW_PASSWORD1,107,67,153,14,ES_AUTOHSCROLL | ES_PASSWORD - RTEXT "Haso:", -1,7,70,96,8 + RTEXT "Hasło:", -1,7,70,96,8 EDITTEXT IDC_USER_NEW_PASSWORD2,107,85,153,14,ES_AUTOHSCROLL | ES_PASSWORD - RTEXT "Powtrz haso:", -1,7,88,96,8 - AUTOCHECKBOX "Uytkownik musi zmieni haso podczas pierwszego logowania",IDC_USER_NEW_FORCE_CHANGE,7,109,200,10 - AUTOCHECKBOX "Uytkownik nie moe zmieni hasa",IDC_USER_NEW_CANNOT_CHANGE,7,123,200,10,WS_DISABLED - AUTOCHECKBOX "Haso nigdy nie wygasa",IDC_USER_NEW_NEVER_EXPIRES,7,137,200,10,WS_DISABLED + RTEXT "Powtórz hasło:", -1,7,88,96,8 + AUTOCHECKBOX "Użytkownik musi zmienić hasło podczas pierwszego logowania",IDC_USER_NEW_FORCE_CHANGE,7,109,200,10 + AUTOCHECKBOX "Użytkownik nie może zmienić hasła",IDC_USER_NEW_CANNOT_CHANGE,7,123,200,10,WS_DISABLED + AUTOCHECKBOX "Hasło nigdy nie wygasa",IDC_USER_NEW_NEVER_EXPIRES,7,137,200,10,WS_DISABLED AUTOCHECKBOX "Konto jest zablokowane",IDC_USER_NEW_DISABLED,7,151,200,10 DEFPUSHBUTTON "OK",IDOK,156,179,50,14,WS_DISABLED PUSHBUTTON "Anuluj",IDCANCEL,210,179,50,14 @@ -153,10 +162,10 @@ END IDD_USER_ADD_MEMBERSHIP DIALOGEX DISCARDABLE 0, 0, 252, 223 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_SHELLFONT -CAPTION "Przynaleno do grup" +CAPTION "Przynależność do grup" FONT 8, "MS Shell Dlg" BEGIN -LTEXT "Naley do:", -1, 7, 7, 56, 8 +LTEXT "Należy do:", -1, 7, 7, 56, 8 CONTROL "", IDC_USER_ADD_MEMBERSHIP_LIST, "SysListView32", LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP, 7, 18, 238, 173, WS_EX_CLIENTEDGE DEFPUSHBUTTON "OK",IDOK,156,197,50,14 @@ -175,12 +184,12 @@ BEGIN END POPUP "" BEGIN - MENUITEM "Dodaj czonka grupy", IDM_GROUP_ADD_MEMBER, GRAYED + MENUITEM "Dodaj członka grupy", IDM_GROUP_ADD_MEMBER, GRAYED MENUITEM SEPARATOR - MENUITEM "Usu", IDM_GROUP_DELETE - MENUITEM "Zmie nazw", IDM_GROUP_RENAME + MENUITEM "Usuń", IDM_GROUP_DELETE + MENUITEM "Zmień nazwę", IDM_GROUP_RENAME MENUITEM SEPARATOR - MENUITEM "Waciwoci", IDM_GROUP_PROPERTIES + MENUITEM "Właściwości", IDM_GROUP_PROPERTIES END END @@ -189,16 +198,16 @@ IDM_POPUP_USER MENU DISCARDABLE BEGIN POPUP "" BEGIN - MENUITEM "Nowy uytkownik...", IDM_USER_NEW + MENUITEM "Nowy użytkownik...", IDM_USER_NEW END POPUP "" BEGIN - MENUITEM "Zmie haso", IDM_USER_CHANGE_PASSWORD + MENUITEM "Zmień hasło", IDM_USER_CHANGE_PASSWORD MENUITEM SEPARATOR - MENUITEM "Usu", IDM_USER_DELETE - MENUITEM "Zmie nazw", IDM_USER_RENAME + MENUITEM "Usuń", IDM_USER_DELETE + MENUITEM "Zmień nazwę", IDM_USER_RENAME MENUITEM SEPARATOR - MENUITEM "Waciwoci", IDM_USER_PROPERTIES + MENUITEM "Właściwości", IDM_USER_PROPERTIES END END @@ -207,13 +216,13 @@ END STRINGTABLE BEGIN - IDS_CPLNAME "Konta uytkownikw" - IDS_CPLDESCRIPTION "Zarzdzanie uytkownikami i grupami." + IDS_CPLNAME "Konta użytkowników" + IDS_CPLDESCRIPTION "Zarządzanie użytkownikami i grupami." END STRINGTABLE BEGIN IDS_NAME "Nazwa" - IDS_FULLNAME "Imi i nazwisko" + IDS_FULLNAME "Imię i Nazwisko" IDS_DESCRIPTION "Opis" END diff --git a/dll/cpl/usrmgr/lang/ru-RU.rc b/dll/cpl/usrmgr/lang/ru-RU.rc index aaede5b8428..5448bc2264b 100644 --- a/dll/cpl/usrmgr/lang/ru-RU.rc +++ b/dll/cpl/usrmgr/lang/ru-RU.rc @@ -9,7 +9,7 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT IDD_USERS DIALOGEX DISCARDABLE 0, 0, 252, 223 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Пользователи" FONT 8, "MS Shell Dlg" BEGIN CONTROL "", IDC_USERS_LIST, "SysListView32", LVS_REPORT | LVS_EDITLABELS | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP, @@ -19,7 +19,7 @@ END IDD_GROUPS DIALOGEX DISCARDABLE 0, 0, 252, 223 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Группы" FONT 8, "MS Shell Dlg" BEGIN CONTROL "", IDC_GROUPS_LIST, "SysListView32", LVS_REPORT | LVS_EDITLABELS | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP, @@ -29,130 +29,130 @@ END IDD_EXTRA DIALOGEX DISCARDABLE 0, 0, 252, 223 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Дополнительно" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ", IDC_STATIC, 66, 90, 112, 8 + LTEXT "Это место преднамерено осталено чистым", IDC_STATIC, 66, 90, 112, 8 END IDD_USER_GENERAL DIALOGEX DISCARDABLE 0, 0, 252, 223 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Общие" FONT 8, "MS Shell Dlg" BEGIN LTEXT "", IDC_USER_GENERAL_NAME, 7, 12, 112, 8 - LTEXT " :", -1, 7, 46, 63, 8 + LTEXT "Полное имя:", -1, 7, 46, 63, 8 EDITTEXT IDC_USER_GENERAL_FULL_NAME,77,43,168,13,ES_AUTOHSCROLL - LTEXT ":", -1, 7, 64, 63, 8 + LTEXT "Описание:", -1, 7, 64, 63, 8 EDITTEXT IDC_USER_GENERAL_DESCRIPTION,77,61,168,13,ES_AUTOHSCROLL - AUTOCHECKBOX " ",IDC_USER_GENERAL_FORCE_CHANGE,7,82,230,10 - AUTOCHECKBOX " ",IDC_USER_GENERAL_CANNOT_CHANGE,7,95,210,10 - AUTOCHECKBOX " ",IDC_USER_GENERAL_NEVER_EXPIRES,7,108,210,10 - AUTOCHECKBOX " ",IDC_USER_GENERAL_DISABLED,7,121,210,10 - AUTOCHECKBOX " ",IDC_USER_GENERAL_LOCKED,7,134,210,10 + AUTOCHECKBOX "Потребовать смену пароля при следующем входе в систему",IDC_USER_GENERAL_FORCE_CHANGE,7,82,230,10 + AUTOCHECKBOX "Запретить смену пароля пользователем",IDC_USER_GENERAL_CANNOT_CHANGE,7,95,210,10 + AUTOCHECKBOX "Срок действия пароля не ограничен",IDC_USER_GENERAL_NEVER_EXPIRES,7,108,210,10 + AUTOCHECKBOX "Отключить учётную запись",IDC_USER_GENERAL_DISABLED,7,121,210,10 + AUTOCHECKBOX "Заблокировать учётную запись",IDC_USER_GENERAL_LOCKED,7,134,210,10 END IDD_USER_MEMBERSHIP DIALOGEX DISCARDABLE 0, 0, 252, 223 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Членство в группах" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " :", -1, 7, 7, 56, 8 + LTEXT "Член групп:", -1, 7, 7, 56, 8 CONTROL "", IDC_USER_MEMBERSHIP_LIST, "SysListView32", LVS_REPORT | LVS_NOCOLUMNHEADER | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP, 7, 18, 238, 173, WS_EX_CLIENTEDGE - PUSHBUTTON "...", IDC_USER_MEMBERSHIP_ADD, 7, 197, 50, 14, WS_DISABLED - PUSHBUTTON "", IDC_USER_MEMBERSHIP_REMOVE, 61, 197, 50, 14, WS_DISABLED + PUSHBUTTON "Добавить...", IDC_USER_MEMBERSHIP_ADD, 7, 197, 50, 14, WS_DISABLED + PUSHBUTTON "Удалить", IDC_USER_MEMBERSHIP_REMOVE, 61, 197, 50, 14, WS_DISABLED END IDD_USER_PROFILE DIALOGEX DISCARDABLE 0, 0, 252, 223 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Профиль" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ", -1, 7, 7, 238, 54 - LTEXT " :", -1, 16, 22, 80, 8 + GROUPBOX "Профиль пользователя", -1, 7, 7, 238, 54 + LTEXT "Путь к профилю:", -1, 16, 22, 80, 8 EDITTEXT IDC_USER_PROFILE_PATH, 88, 19, 150, 13, ES_AUTOHSCROLL - LTEXT " :", -1, 16, 40, 80, 8 + LTEXT "Сценарий входа:", -1, 16, 40, 80, 8 EDITTEXT IDC_USER_PROFILE_SCRIPT, 88, 37, 150, 13, ES_AUTOHSCROLL - GROUPBOX " ", -1, 7, 68, 238, 54 - AUTORADIOBUTTON " :", IDC_USER_PROFILE_LOCAL, 16, 83, 80, 10 - AUTORADIOBUTTON ":", IDC_USER_PROFILE_REMOTE, 16, 100, 60, 10 + GROUPBOX "Домашняя папка", -1, 7, 68, 238, 54 + AUTORADIOBUTTON "Локальный путь:", IDC_USER_PROFILE_LOCAL, 16, 83, 80, 10 + AUTORADIOBUTTON "Подключить:", IDC_USER_PROFILE_REMOTE, 16, 100, 60, 10 EDITTEXT IDC_USER_PROFILE_LOCAL_PATH, 88, 81, 150, 13, ES_AUTOHSCROLL COMBOBOX IDC_USER_PROFILE_DRIVE, 78, 99, 26, 153, CBS_DROPDOWNLIST | CBS_SORT | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL - LTEXT ":", -1, 112, 101, 12, 8 + LTEXT "на:", -1, 112, 101, 12, 8 EDITTEXT IDC_USER_PROFILE_REMOTE_PATH, 130, 99, 108, 13, ES_AUTOHSCROLL END IDD_GROUP_GENERAL DIALOGEX DISCARDABLE 0, 0, 252, 223 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Общие" FONT 8, "MS Shell Dlg" BEGIN LTEXT "", IDC_GROUP_GENERAL_NAME, 7, 12, 112, 8 - LTEXT ":", -1, 7, 45, 46, 8 + LTEXT "Описание:", -1, 7, 45, 46, 8 EDITTEXT IDC_GROUP_GENERAL_DESCRIPTION,65,42,180,13,ES_AUTOHSCROLL - LTEXT " :", -1, 7, 63, 45, 8 + LTEXT "Члены группы:", -1, 7, 63, 45, 8 CONTROL "", IDC_GROUP_GENERAL_MEMBERS, "SysListView32", LVS_REPORT | LVS_NOCOLUMNHEADER | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP, 7, 74, 238, 117, WS_EX_CLIENTEDGE - PUSHBUTTON "...", IDC_GROUP_GENERAL_ADD, 7, 197, 50, 14, WS_DISABLED - PUSHBUTTON "", IDC_GROUP_GENERAL_REMOVE, 61, 197, 50, 14, WS_DISABLED + PUSHBUTTON "Добавить...", IDC_GROUP_GENERAL_ADD, 7, 197, 50, 14, WS_DISABLED + PUSHBUTTON "Удалить", IDC_GROUP_GENERAL_REMOVE, 61, 197, 50, 14, WS_DISABLED END IDD_CHANGE_PASSWORD DIALOGEX DISCARDABLE 0, 0, 267, 74 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_SHELLFONT -CAPTION " " +CAPTION "Установка пароля" FONT 8, "MS Shell Dlg" BEGIN EDITTEXT IDC_EDIT_PASSWORD1,107,7,153,14,ES_AUTOHSCROLL | ES_PASSWORD - RTEXT " :", -1,7,10,96,8 + RTEXT "Новый пароль:", -1,7,10,96,8 EDITTEXT IDC_EDIT_PASSWORD2,107,25,153,14,ES_AUTOHSCROLL | ES_PASSWORD - RTEXT ":", -1,7,28,96,8 - DEFPUSHBUTTON "",IDOK,156,53,50,14 - PUSHBUTTON "",IDCANCEL,210,53,50,14 + RTEXT "Подтверждение:", -1,7,28,96,8 + DEFPUSHBUTTON "ОК",IDOK,156,53,50,14 + PUSHBUTTON "Отмена",IDCANCEL,210,53,50,14 END IDD_USER_NEW DIALOGEX DISCARDABLE 0, 0, 267, 200 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_SHELLFONT -CAPTION " " +CAPTION "Новый пользователь" FONT 8, "MS Shell Dlg" BEGIN EDITTEXT IDC_USER_NEW_NAME,107,7,153,14,ES_AUTOHSCROLL - RTEXT " :", -1,7,10,96,8 + RTEXT "Имя пользователя:", -1,7,10,96,8 EDITTEXT IDC_USER_NEW_FULL_NAME,107,25,153,14,ES_AUTOHSCROLL - RTEXT " :", -1,7,28,96,8 + RTEXT "Полное имя пользователя:", -1,7,28,96,8 EDITTEXT IDC_USER_NEW_DESCRIPTION,107,43,153,14,ES_AUTOHSCROLL - RTEXT ":", -1,7,46,96,8 + RTEXT "Описание:", -1,7,46,96,8 EDITTEXT IDC_USER_NEW_PASSWORD1,107,67,153,14,ES_AUTOHSCROLL | ES_PASSWORD - RTEXT ":", -1,7,70,96,8 + RTEXT "Пароль:", -1,7,70,96,8 EDITTEXT IDC_USER_NEW_PASSWORD2,107,85,153,14,ES_AUTOHSCROLL | ES_PASSWORD - RTEXT ":", -1,7,88,96,8 - AUTOCHECKBOX " ",IDC_USER_NEW_FORCE_CHANGE,7,109,200,10 - AUTOCHECKBOX " ",IDC_USER_NEW_CANNOT_CHANGE,7,123,200,10,WS_DISABLED - AUTOCHECKBOX " ",IDC_USER_NEW_NEVER_EXPIRES,7,137,200,10,WS_DISABLED - AUTOCHECKBOX " ",IDC_USER_NEW_DISABLED,7,151,200,10 + RTEXT "Подтвердите:", -1,7,88,96,8 + AUTOCHECKBOX "Потребовать смену пароля при следующем входе в систему",IDC_USER_NEW_FORCE_CHANGE,7,109,200,10 + AUTOCHECKBOX "Запретить смену пароля пользователем",IDC_USER_NEW_CANNOT_CHANGE,7,123,200,10,WS_DISABLED + AUTOCHECKBOX "Срок действия пароля не ограничен",IDC_USER_NEW_NEVER_EXPIRES,7,137,200,10,WS_DISABLED + AUTOCHECKBOX "Отключить учётную запись",IDC_USER_NEW_DISABLED,7,151,200,10 DEFPUSHBUTTON "OK",IDOK,156,179,50,14,WS_DISABLED - PUSHBUTTON "",IDCANCEL,210,179,50,14 + PUSHBUTTON "Отмена",IDCANCEL,210,179,50,14 END IDD_GROUP_NEW DIALOGEX DISCARDABLE 0, 0, 267, 74 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_SHELLFONT -CAPTION " " +CAPTION "Новая группа" FONT 8, "MS Shell Dlg" BEGIN EDITTEXT IDC_GROUP_NEW_NAME,107,7,153,14,ES_AUTOHSCROLL - RTEXT " :", -1,7,10,96,8 + RTEXT "Имя группы:", -1,7,10,96,8 EDITTEXT IDC_GROUP_NEW_DESCRIPTION,107,25,153,14,ES_AUTOHSCROLL - RTEXT ":", -1,7,28,96,8 + RTEXT "Описание:", -1,7,28,96,8 DEFPUSHBUTTON "OK",IDOK,156,53,50,14,WS_DISABLED - PUSHBUTTON "",IDCANCEL,210,53,50,14 + PUSHBUTTON "Отмена",IDCANCEL,210,53,50,14 END @@ -162,16 +162,16 @@ IDM_POPUP_GROUP MENU DISCARDABLE BEGIN POPUP "" BEGIN - MENUITEM " ...", IDM_GROUP_NEW + MENUITEM "Создать группу...", IDM_GROUP_NEW END POPUP "" BEGIN - MENUITEM " ...", IDM_GROUP_ADD_MEMBER, GRAYED + MENUITEM "Добавить в группу...", IDM_GROUP_ADD_MEMBER, GRAYED MENUITEM SEPARATOR - MENUITEM "", IDM_GROUP_DELETE - MENUITEM "", IDM_GROUP_RENAME + MENUITEM "Удалить", IDM_GROUP_DELETE + MENUITEM "Переименовать", IDM_GROUP_RENAME MENUITEM SEPARATOR - MENUITEM "", IDM_GROUP_PROPERTIES + MENUITEM "Свойства", IDM_GROUP_PROPERTIES END END @@ -180,16 +180,16 @@ IDM_POPUP_USER MENU DISCARDABLE BEGIN POPUP "" BEGIN - MENUITEM " ...", IDM_USER_NEW + MENUITEM "Новый пользователь...", IDM_USER_NEW END POPUP "" BEGIN - MENUITEM " ...", IDM_USER_CHANGE_PASSWORD + MENUITEM "Задать пароль...", IDM_USER_CHANGE_PASSWORD MENUITEM SEPARATOR - MENUITEM "", IDM_USER_DELETE - MENUITEM "", IDM_USER_RENAME + MENUITEM "Удалить", IDM_USER_DELETE + MENUITEM "Переименовать", IDM_USER_RENAME MENUITEM SEPARATOR - MENUITEM "", IDM_USER_PROPERTIES + MENUITEM "Свойства", IDM_USER_PROPERTIES END END @@ -198,13 +198,13 @@ END STRINGTABLE BEGIN - IDS_CPLNAME " " - IDS_CPLDESCRIPTION " ." + IDS_CPLNAME "Учётные записи пользователей" + IDS_CPLDESCRIPTION "Управление пользователями и группами." END STRINGTABLE BEGIN - IDS_NAME "" - IDS_FULLNAME " " - IDS_DESCRIPTION "" + IDS_NAME "Имя" + IDS_FULLNAME "Полное имя" + IDS_DESCRIPTION "Описание" END diff --git a/dll/cpl/usrmgr/lang/uk-UA.rc b/dll/cpl/usrmgr/lang/uk-UA.rc index 36c118c9b1d..25851627589 100644 --- a/dll/cpl/usrmgr/lang/uk-UA.rc +++ b/dll/cpl/usrmgr/lang/uk-UA.rc @@ -9,7 +9,7 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT IDD_USERS DIALOGEX DISCARDABLE 0, 0, 252, 223 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Користувачі" FONT 8, "MS Shell Dlg" BEGIN CONTROL "", IDC_USERS_LIST, "SysListView32", LVS_REPORT | LVS_EDITLABELS | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP, @@ -19,7 +19,7 @@ END IDD_GROUPS DIALOGEX DISCARDABLE 0, 0, 252, 223 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Групи" FONT 8, "MS Shell Dlg" BEGIN CONTROL "", IDC_GROUPS_LIST, "SysListView32", LVS_REPORT | LVS_EDITLABELS | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP, @@ -29,143 +29,143 @@ END IDD_EXTRA DIALOGEX DISCARDABLE 0, 0, 252, 223 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Додатково" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ", IDC_STATIC, 66, 90, 112, 8 + LTEXT "Це місце навмисно залишене порожнім", IDC_STATIC, 66, 90, 112, 8 END IDD_USER_GENERAL DIALOGEX DISCARDABLE 0, 0, 252, 223 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Загальні" FONT 8, "MS Shell Dlg" BEGIN LTEXT "", IDC_USER_GENERAL_NAME, 7, 12, 112, 8 - LTEXT " ':", -1, 7, 46, 63, 8 + LTEXT "Повне Ім'я:", -1, 7, 46, 63, 8 EDITTEXT IDC_USER_GENERAL_FULL_NAME,77,43,168,13,ES_AUTOHSCROLL - LTEXT ":", -1, 7, 64, 63, 8 + LTEXT "Опис:", -1, 7, 64, 63, 8 EDITTEXT IDC_USER_GENERAL_DESCRIPTION,77,61,168,13,ES_AUTOHSCROLL - AUTOCHECKBOX " ",IDC_USER_GENERAL_FORCE_CHANGE,7,82,210,10 - AUTOCHECKBOX " ",IDC_USER_GENERAL_CANNOT_CHANGE,7,95,210,10 - AUTOCHECKBOX " 䳿 ",IDC_USER_GENERAL_NEVER_EXPIRES,7,108,210,10 - AUTOCHECKBOX " ",IDC_USER_GENERAL_DISABLED,7,121,210,10 - AUTOCHECKBOX " ",IDC_USER_GENERAL_LOCKED,7,134,210,10 + AUTOCHECKBOX "Користувач має змінити пароль при першому вході",IDC_USER_GENERAL_FORCE_CHANGE,7,82,210,10 + AUTOCHECKBOX "Користувач не може змінювати пароль",IDC_USER_GENERAL_CANNOT_CHANGE,7,95,210,10 + AUTOCHECKBOX "Термін дії паролю необмежений",IDC_USER_GENERAL_NEVER_EXPIRES,7,108,210,10 + AUTOCHECKBOX "Обліковий запис вимкнено",IDC_USER_GENERAL_DISABLED,7,121,210,10 + AUTOCHECKBOX "Обліковий запис заблоковано",IDC_USER_GENERAL_LOCKED,7,134,210,10 END IDD_USER_MEMBERSHIP DIALOGEX DISCARDABLE 0, 0, 252, 223 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Членство" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " :", -1, 7, 7, 56, 8 + LTEXT "Член Групи:", -1, 7, 7, 56, 8 CONTROL "", IDC_USER_MEMBERSHIP_LIST, "SysListView32", LVS_REPORT | LVS_NOCOLUMNHEADER | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP, 7, 18, 238, 173, WS_EX_CLIENTEDGE - PUSHBUTTON "...", IDC_USER_MEMBERSHIP_ADD, 7, 197, 50, 14 - PUSHBUTTON "", IDC_USER_MEMBERSHIP_REMOVE, 61, 197, 50, 14, WS_DISABLED + PUSHBUTTON "Додати...", IDC_USER_MEMBERSHIP_ADD, 7, 197, 50, 14 + PUSHBUTTON "Вилучити", IDC_USER_MEMBERSHIP_REMOVE, 61, 197, 50, 14, WS_DISABLED END IDD_USER_PROFILE DIALOGEX DISCARDABLE 0, 0, 252, 223 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Профіль" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ", -1, 7, 7, 238, 54 - LTEXT " :", -1, 16, 22, 55, 8 + GROUPBOX "Профіль Користувача", -1, 7, 7, 238, 54 + LTEXT "Шлях до Профілю:", -1, 16, 22, 55, 8 EDITTEXT IDC_USER_PROFILE_PATH, 78, 19, 160, 13, ES_AUTOHSCROLL - LTEXT " :", -1, 16, 40, 55, 8 + LTEXT "Сценарій входу:", -1, 16, 40, 55, 8 EDITTEXT IDC_USER_PROFILE_SCRIPT, 78, 37, 160, 13, ES_AUTOHSCROLL - GROUPBOX " ", -1, 7, 68, 238, 54 - AUTORADIOBUTTON " :", IDC_USER_PROFILE_LOCAL, 16, 83, 60, 10 - AUTORADIOBUTTON "ϳ':", IDC_USER_PROFILE_REMOTE, 16, 100, 60, 10 + GROUPBOX "Домашня тека", -1, 7, 68, 238, 54 + AUTORADIOBUTTON "Локальний шлях:", IDC_USER_PROFILE_LOCAL, 16, 83, 60, 10 + AUTORADIOBUTTON "Під'єднати:", IDC_USER_PROFILE_REMOTE, 16, 100, 60, 10 EDITTEXT IDC_USER_PROFILE_LOCAL_PATH, 78, 81, 160, 13, ES_AUTOHSCROLL COMBOBOX IDC_USER_PROFILE_DRIVE, 78, 99, 26, 160, CBS_DROPDOWNLIST | CBS_SORT | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL - LTEXT ":", -1, 112, 101, 12, 8 + LTEXT "до:", -1, 112, 101, 12, 8 EDITTEXT IDC_USER_PROFILE_REMOTE_PATH, 130, 99, 108, 13, ES_AUTOHSCROLL END IDD_GROUP_GENERAL DIALOGEX DISCARDABLE 0, 0, 252, 223 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Загальні" FONT 8, "MS Shell Dlg" BEGIN LTEXT "", IDC_GROUP_GENERAL_NAME, 7, 12, 112, 8 - LTEXT ":", -1, 7, 45, 46, 8 + LTEXT "Опис:", -1, 7, 45, 46, 8 EDITTEXT IDC_GROUP_GENERAL_DESCRIPTION,65,42,180,13,ES_AUTOHSCROLL - LTEXT ":", -1, 7, 63, 45, 8 + LTEXT "Члени:", -1, 7, 63, 45, 8 CONTROL "", IDC_GROUP_GENERAL_MEMBERS, "SysListView32", LVS_REPORT | LVS_NOCOLUMNHEADER | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP, 7, 74, 238, 117, WS_EX_CLIENTEDGE - PUSHBUTTON "...", IDC_GROUP_GENERAL_ADD, 7, 197, 50, 14 - PUSHBUTTON "", IDC_GROUP_GENERAL_REMOVE, 61, 197, 50, 14, WS_DISABLED + PUSHBUTTON "Додати...", IDC_GROUP_GENERAL_ADD, 7, 197, 50, 14 + PUSHBUTTON "Вилучити", IDC_GROUP_GENERAL_REMOVE, 61, 197, 50, 14, WS_DISABLED END IDD_CHANGE_PASSWORD DIALOGEX DISCARDABLE 0, 0, 267, 74 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_SHELLFONT -CAPTION " " +CAPTION "Зміна Паролю" FONT 8, "MS Shell Dlg" BEGIN EDITTEXT IDC_EDIT_PASSWORD1,107,7,153,14,ES_AUTOHSCROLL | ES_PASSWORD - RTEXT " :", -1,7,10,96,8 + RTEXT "Новий Пароль:", -1,7,10,96,8 EDITTEXT IDC_EDIT_PASSWORD2,107,25,153,14,ES_AUTOHSCROLL | ES_PASSWORD - RTEXT " :", -1,7,28,96,8 + RTEXT "Повтор Паролю:", -1,7,28,96,8 DEFPUSHBUTTON "OK",IDOK,156,53,50,14 - PUSHBUTTON "",IDCANCEL,210,53,50,14 + PUSHBUTTON "Скасувати",IDCANCEL,210,53,50,14 END IDD_USER_NEW DIALOGEX DISCARDABLE 0, 0, 267, 200 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_SHELLFONT -CAPTION " " +CAPTION "Новий Користувач" FONT 8, "MS Shell Dlg" BEGIN EDITTEXT IDC_USER_NEW_NAME,107,7,153,14,ES_AUTOHSCROLL - RTEXT "' :", -1,7,10,96,8 + RTEXT "Ім'я Користувача:", -1,7,10,96,8 EDITTEXT IDC_USER_NEW_FULL_NAME,107,25,153,14,ES_AUTOHSCROLL - RTEXT " ' :", -1,7,28,96,8 + RTEXT "Повне Ім'я Користувача:", -1,7,28,96,8 EDITTEXT IDC_USER_NEW_DESCRIPTION,107,43,153,14,ES_AUTOHSCROLL - RTEXT ":", -1,7,46,96,8 + RTEXT "Опис:", -1,7,46,96,8 EDITTEXT IDC_USER_NEW_PASSWORD1,107,67,153,14,ES_AUTOHSCROLL | ES_PASSWORD - RTEXT ":", -1,7,70,96,8 + RTEXT "Пароль:", -1,7,70,96,8 EDITTEXT IDC_USER_NEW_PASSWORD2,107,85,153,14,ES_AUTOHSCROLL | ES_PASSWORD - RTEXT " :", -1,7,88,96,8 - AUTOCHECKBOX " ",IDC_USER_NEW_FORCE_CHANGE,7,109,200,10 - AUTOCHECKBOX " ",IDC_USER_NEW_CANNOT_CHANGE,7,123,200,10,WS_DISABLED - AUTOCHECKBOX " 䳿 ",IDC_USER_NEW_NEVER_EXPIRES,7,137,200,10,WS_DISABLED - AUTOCHECKBOX " ",IDC_USER_NEW_DISABLED,7,151,200,10 + RTEXT "Повтор Паролю:", -1,7,88,96,8 + AUTOCHECKBOX "Користувач має змінити пароль при першому вході",IDC_USER_NEW_FORCE_CHANGE,7,109,200,10 + AUTOCHECKBOX "Користувач не може змінювати пароль",IDC_USER_NEW_CANNOT_CHANGE,7,123,200,10,WS_DISABLED + AUTOCHECKBOX "Термін дії паролю необмежений",IDC_USER_NEW_NEVER_EXPIRES,7,137,200,10,WS_DISABLED + AUTOCHECKBOX "Обліковий запис вимкнено",IDC_USER_NEW_DISABLED,7,151,200,10 DEFPUSHBUTTON "OK",IDOK,156,179,50,14,WS_DISABLED - PUSHBUTTON "",IDCANCEL,210,179,50,14 + PUSHBUTTON "Скасувати",IDCANCEL,210,179,50,14 END IDD_GROUP_NEW DIALOGEX DISCARDABLE 0, 0, 267, 74 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_SHELLFONT -CAPTION " " +CAPTION "Нова Група" FONT 8, "MS Shell Dlg" BEGIN EDITTEXT IDC_GROUP_NEW_NAME,107,7,153,14,ES_AUTOHSCROLL - RTEXT " :", -1,7,10,96,8 + RTEXT "Назва Групи:", -1,7,10,96,8 EDITTEXT IDC_GROUP_NEW_DESCRIPTION,107,25,153,14,ES_AUTOHSCROLL - RTEXT ":", -1,7,28,96,8 + RTEXT "Опис:", -1,7,28,96,8 DEFPUSHBUTTON "OK",IDOK,156,53,50,14,WS_DISABLED - PUSHBUTTON "",IDCANCEL,210,53,50,14 + PUSHBUTTON "Скасувати",IDCANCEL,210,53,50,14 END IDD_USER_ADD_MEMBERSHIP DIALOGEX DISCARDABLE 0, 0, 252, 223 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_SHELLFONT -CAPTION " " +CAPTION "Членство в Групах" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " :", -1, 7, 7, 56, 8 + LTEXT "Член Групи:", -1, 7, 7, 56, 8 CONTROL "", IDC_USER_ADD_MEMBERSHIP_LIST, "SysListView32", LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP, 7, 18, 238, 173, WS_EX_CLIENTEDGE DEFPUSHBUTTON "OK",IDOK,141,197,50,14 - PUSHBUTTON "",IDCANCEL,195,197,50,14 + PUSHBUTTON "Скасувати",IDCANCEL,195,197,50,14 END @@ -175,16 +175,16 @@ IDM_POPUP_GROUP MENU DISCARDABLE BEGIN POPUP "" BEGIN - MENUITEM " ...", IDM_GROUP_NEW + MENUITEM "Створити Групу...", IDM_GROUP_NEW END POPUP "" BEGIN - MENUITEM " ", IDM_GROUP_ADD_MEMBER, GRAYED + MENUITEM "Додати в Групу", IDM_GROUP_ADD_MEMBER, GRAYED MENUITEM SEPARATOR - MENUITEM "", IDM_GROUP_DELETE - MENUITEM "", IDM_GROUP_RENAME + MENUITEM "Видалити", IDM_GROUP_DELETE + MENUITEM "Перейменувати", IDM_GROUP_RENAME MENUITEM SEPARATOR - MENUITEM "", IDM_GROUP_PROPERTIES + MENUITEM "Властивості", IDM_GROUP_PROPERTIES END END @@ -193,16 +193,16 @@ IDM_POPUP_USER MENU DISCARDABLE BEGIN POPUP "" BEGIN - MENUITEM " ...", IDM_USER_NEW + MENUITEM "Новий Користувач...", IDM_USER_NEW END POPUP "" BEGIN - MENUITEM " ", IDM_USER_CHANGE_PASSWORD + MENUITEM "Змінити Пароль", IDM_USER_CHANGE_PASSWORD MENUITEM SEPARATOR - MENUITEM "", IDM_USER_DELETE - MENUITEM "", IDM_USER_RENAME + MENUITEM "Видалити", IDM_USER_DELETE + MENUITEM "Перейменувати", IDM_USER_RENAME MENUITEM SEPARATOR - MENUITEM "", IDM_USER_PROPERTIES + MENUITEM "Властивості", IDM_USER_PROPERTIES END END @@ -211,13 +211,13 @@ END STRINGTABLE BEGIN - IDS_CPLNAME " " - IDS_CPLDESCRIPTION " ." + IDS_CPLNAME "Облікові записи користувачів" + IDS_CPLDESCRIPTION "Керування Користувачами та Групами." END STRINGTABLE BEGIN - IDS_NAME "'" - IDS_FULLNAME " '" - IDS_DESCRIPTION "" + IDS_NAME "Ім'я" + IDS_FULLNAME "Повне Ім'я" + IDS_DESCRIPTION "Опис" END diff --git a/dll/cpl/usrmgr/rsrc.rc b/dll/cpl/usrmgr/rsrc.rc index 42a24ad3303..d9287f6a689 100644 --- a/dll/cpl/usrmgr/rsrc.rc +++ b/dll/cpl/usrmgr/rsrc.rc @@ -5,6 +5,9 @@ #include "lang/en-US.rc" #include "lang/es-ES.rc" #include "lang/fr-FR.rc" + +// UTF-8 +#pragma code_page(65001) #include "lang/pl-PL.rc" #include "lang/ru-RU.rc" #include "lang/uk-UA.rc" diff --git a/dll/cpl/usrmgr/usrmgr.h b/dll/cpl/usrmgr/usrmgr.h index 13896cd147c..1a6fdf84338 100644 --- a/dll/cpl/usrmgr/usrmgr.h +++ b/dll/cpl/usrmgr/usrmgr.h @@ -1,5 +1,3 @@ -#pragma once - #include #include #include diff --git a/dll/cpl/usrmgr/usrmgr.rbuild b/dll/cpl/usrmgr/usrmgr.rbuild index 472bec32e51..ac2cea51f74 100644 --- a/dll/cpl/usrmgr/usrmgr.rbuild +++ b/dll/cpl/usrmgr/usrmgr.rbuild @@ -18,4 +18,5 @@ users.c usrmgr.c usrmgr.rc + usrmgr.h diff --git a/dll/directx/CMakeLists.txt b/dll/directx/CMakeLists.txt index 5a92a036a35..0f8f70ab3f6 100644 --- a/dll/directx/CMakeLists.txt +++ b/dll/directx/CMakeLists.txt @@ -16,7 +16,9 @@ add_subdirectory(dplayx) add_subdirectory(dsound) #add_subdirectory(dsound_new) #disabled in trunk add_subdirectory(dxdiagn) -add_subdirectory(ksproxy) +if(NOT MSVC) + add_subdirectory(ksproxy) #FIXME: fix msvc build +endif() add_subdirectory(ksuser) add_subdirectory(msdmo) #add_subdirectory(msdvbnp) #disabled in trunk diff --git a/dll/directx/devenum/CMakeLists.txt b/dll/directx/devenum/CMakeLists.txt index c31eefaaf50..b023838734f 100644 --- a/dll/directx/devenum/CMakeLists.txt +++ b/dll/directx/devenum/CMakeLists.txt @@ -35,4 +35,5 @@ add_importlibs(devenum kernel32 ntdll) +add_pch(devenum devenum_private.h) add_cd_file(TARGET devenum DESTINATION reactos/system32 FOR all) diff --git a/dll/directx/devenum/devenum.rbuild b/dll/directx/devenum/devenum.rbuild index 3ca2d48c1c7..57d92be949f 100644 --- a/dll/directx/devenum/devenum.rbuild +++ b/dll/directx/devenum/devenum.rbuild @@ -23,4 +23,5 @@ factory.c mediacatenum.c parsedisplayname.c + devenum_private.h diff --git a/dll/directx/dmusic/CMakeLists.txt b/dll/directx/dmusic/CMakeLists.txt index df15dcf81f4..29bc7d43c05 100644 --- a/dll/directx/dmusic/CMakeLists.txt +++ b/dll/directx/dmusic/CMakeLists.txt @@ -40,5 +40,5 @@ add_importlibs(dmusic ntdll) add_dependencies(dmusic psdk) - +add_pch(dmusic dmusic_private.h) add_cd_file(TARGET dmusic DESTINATION reactos/system32 FOR all) diff --git a/dll/directx/dmusic/dmusic.rbuild b/dll/directx/dmusic/dmusic.rbuild index 9de6f1abcaf..289a15fe872 100644 --- a/dll/directx/dmusic/dmusic.rbuild +++ b/dll/directx/dmusic/dmusic.rbuild @@ -26,4 +26,5 @@ instrument.c port.c regsvr.c + dmusic_private.h diff --git a/dll/directx/dsound/CMakeLists.txt b/dll/directx/dsound/CMakeLists.txt index c4b7218871a..84f3782c9ff 100644 --- a/dll/directx/dsound/CMakeLists.txt +++ b/dll/directx/dsound/CMakeLists.txt @@ -1,8 +1,7 @@ add_definitions( -D_WINE - -D_USE_MATH_DEFINES - -D_DLL -D__USE_CRTIMP) + -D_USE_MATH_DEFINES) include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine) diff --git a/dll/directx/dxdiagn/CMakeLists.txt b/dll/directx/dxdiagn/CMakeLists.txt index 59b0dc31d47..e736f2705a9 100644 --- a/dll/directx/dxdiagn/CMakeLists.txt +++ b/dll/directx/dxdiagn/CMakeLists.txt @@ -25,4 +25,5 @@ add_importlibs(dxdiagn kernel32 ntdll) +add_pch(dxdiagn dxdiag_private.h) add_cd_file(TARGET dxdiagn DESTINATION reactos/system32 FOR all) diff --git a/dll/directx/dxdiagn/dxdiagn.rbuild b/dll/directx/dxdiagn/dxdiagn.rbuild index c874773e1c8..28debd23dbb 100644 --- a/dll/directx/dxdiagn/dxdiagn.rbuild +++ b/dll/directx/dxdiagn/dxdiagn.rbuild @@ -18,4 +18,5 @@ dxdiag_main.c provider.c regsvr.c + dxdiag_private.h diff --git a/dll/directx/ksproxy/CMakeLists.txt b/dll/directx/ksproxy/CMakeLists.txt index c1ab338b565..68b8c6853ac 100644 --- a/dll/directx/ksproxy/CMakeLists.txt +++ b/dll/directx/ksproxy/CMakeLists.txt @@ -2,7 +2,6 @@ spec2def(ksproxy.ax ksproxy.spec) add_definitions( - -D_DLL -D__USE_CRTIMP -DNATIVE_CPP_INCLUDE=${REACTOS_SOURCE_DIR}/include/c++ -DNATIVE_C_INCLUDE=${REACTOS_SOURCE_DIR}/include/crt) @@ -36,11 +35,11 @@ if(MSVC) else() #FIXME : can't build if this is enabled, check if this is needed #set_target_properties(ksproxy PROPERTIES COMPILE_FLAGS "-fno-exceptions -fno-rtti") - target_link_libraries(ksproxy -lsupc++ -lgcc -lmingw32 -lcoldname) -endif(MSVC) + target_link_libraries(ksproxy -lsupc++ -lgcc -lmingw32 oldnames) +endif() + +target_link_libraries(ksproxy stlport strmiids) -target_link_libraries(ksproxy stlport strmiids) - add_importlibs(ksproxy advapi32 ole32 diff --git a/dll/directx/ksuser/ksuser.h b/dll/directx/ksuser/ksuser.h index de44aab6d8b..10953981dda 100644 --- a/dll/directx/ksuser/ksuser.h +++ b/dll/directx/ksuser/ksuser.h @@ -4,7 +4,9 @@ #define WIN32_NO_STATUS #include -#include +#include +#include +#include #include diff --git a/dll/directx/qedit/CMakeLists.txt b/dll/directx/qedit/CMakeLists.txt index 2d393e1ae44..1f411e334b2 100644 --- a/dll/directx/qedit/CMakeLists.txt +++ b/dll/directx/qedit/CMakeLists.txt @@ -1,9 +1,7 @@ set_unicode() -add_definitions( - -D__WINESRC__ - -D_DLL -D__USE_CRTIMP) +add_definitions(-D__WINESRC__) remove_definitions(-D_WIN32_WINNT=0x502) add_definitions(-D_WIN32_WINNT=0x600) @@ -34,5 +32,6 @@ add_importlibs(qedit kernel32 ntdll) +add_pch(qedit qedit_private.h) add_dependencies(qedit dxsdk) add_cd_file(TARGET qedit DESTINATION reactos/system32 FOR all) diff --git a/dll/directx/qedit/qedit.rbuild b/dll/directx/qedit/qedit.rbuild index 0fd54bf8ea3..b2827b3bb9d 100644 --- a/dll/directx/qedit/qedit.rbuild +++ b/dll/directx/qedit/qedit.rbuild @@ -9,6 +9,7 @@ mediadet.c regsvr.c samplegrabber.c + qedit_private.h wine strmiids uuid diff --git a/dll/directx/quartz/CMakeLists.txt b/dll/directx/quartz/CMakeLists.txt index 946d73eba30..aff19556112 100644 --- a/dll/directx/quartz/CMakeLists.txt +++ b/dll/directx/quartz/CMakeLists.txt @@ -6,9 +6,7 @@ add_definitions( -D__WINESRC__ -DENTRY_PREFIX=QUARTZ_ -DREGISTER_PROXY_DLL - -DPROXY_DELEGATION - -D_DLL - -D__USE_CRTIMP) + -DPROXY_DELEGATION) include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine) @@ -72,4 +70,5 @@ add_importlibs(quartz kernel32 ntdll) +add_pch(quartz quartz_private.h) add_cd_file(TARGET quartz DESTINATION reactos/system32 FOR all) diff --git a/dll/directx/quartz/quartz.rbuild b/dll/directx/quartz/quartz.rbuild index 4a86c54b112..4cfec9f412b 100644 --- a/dll/directx/quartz/quartz.rbuild +++ b/dll/directx/quartz/quartz.rbuild @@ -53,6 +53,7 @@ control.c avisplit.c version.rc + quartz_private.h diff --git a/dll/directx/wine/CMakeLists.txt b/dll/directx/wine/CMakeLists.txt index be9f27b8150..59580031371 100644 --- a/dll/directx/wine/CMakeLists.txt +++ b/dll/directx/wine/CMakeLists.txt @@ -1,4 +1,5 @@ +if(NOT MSVC) add_subdirectory(d3d8) add_subdirectory(d3d9) add_subdirectory(d3dx9_24) @@ -22,3 +23,4 @@ add_subdirectory(d3dx9_41) add_subdirectory(d3dx9_42) add_subdirectory(ddraw) add_subdirectory(wined3d) +endif() diff --git a/dll/directx/wine/d3d8/CMakeLists.txt b/dll/directx/wine/d3d8/CMakeLists.txt index a8cc0a720d0..495823691d2 100644 --- a/dll/directx/wine/d3d8/CMakeLists.txt +++ b/dll/directx/wine/d3d8/CMakeLists.txt @@ -7,10 +7,6 @@ add_definitions( include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine) -if(MSVC) - add_definitions(-FImsvchelper.h) -endif() - set_rc_compiler() spec2def(d3d8.dll d3d8.spec) @@ -29,7 +25,6 @@ list(APPEND SOURCE volume.c volumetexture.c version.rc - #${REACTOS_BINARY_DIR}/include/reactos/wine/wined3d_i.c ${CMAKE_CURRENT_BINARY_DIR}/d3d8.def) add_library(d3d8 SHARED ${SOURCE}) @@ -48,4 +43,5 @@ add_importlibs(d3d8 ntdll) add_dependencies(d3d8 wineheaders) +add_pch(d3d8 d3d8_private.h) add_cd_file(TARGET d3d8 DESTINATION reactos/system32 FOR all) diff --git a/dll/directx/wine/d3d8/buffer.c b/dll/directx/wine/d3d8/buffer.c index f7dc12d8f60..8cf55311ba9 100644 --- a/dll/directx/wine/d3d8/buffer.c +++ b/dll/directx/wine/d3d8/buffer.c @@ -51,7 +51,7 @@ static ULONG WINAPI d3d8_vertexbuffer_AddRef(IDirect3DVertexBuffer8 *iface) { IDirect3DDevice8_AddRef(buffer->parentDevice); wined3d_mutex_lock(); - IWineD3DBuffer_AddRef(buffer->wineD3DVertexBuffer); + wined3d_buffer_incref(buffer->wineD3DVertexBuffer); wined3d_mutex_unlock(); } @@ -70,7 +70,7 @@ static ULONG WINAPI d3d8_vertexbuffer_Release(IDirect3DVertexBuffer8 *iface) IDirect3DDevice8 *device = buffer->parentDevice; wined3d_mutex_lock(); - IWineD3DBuffer_Release(buffer->wineD3DVertexBuffer); + wined3d_buffer_decref(buffer->wineD3DVertexBuffer); wined3d_mutex_unlock(); /* Release the device last, as it may cause the device to be destroyed. */ @@ -101,7 +101,7 @@ static HRESULT WINAPI d3d8_vertexbuffer_SetPrivateData(IDirect3DVertexBuffer8 *i iface, debugstr_guid(guid), data, data_size, flags); wined3d_mutex_lock(); - hr = IWineD3DBuffer_SetPrivateData(((IDirect3DVertexBuffer8Impl *)iface)->wineD3DVertexBuffer, + hr = wined3d_buffer_set_private_data(((IDirect3DVertexBuffer8Impl *)iface)->wineD3DVertexBuffer, guid, data, data_size, flags); wined3d_mutex_unlock(); @@ -117,7 +117,7 @@ static HRESULT WINAPI d3d8_vertexbuffer_GetPrivateData(IDirect3DVertexBuffer8 *i iface, debugstr_guid(guid), data, data_size); wined3d_mutex_lock(); - hr = IWineD3DBuffer_GetPrivateData(((IDirect3DVertexBuffer8Impl *)iface)->wineD3DVertexBuffer, + hr = wined3d_buffer_get_private_data(((IDirect3DVertexBuffer8Impl *)iface)->wineD3DVertexBuffer, guid, data, data_size); wined3d_mutex_unlock(); @@ -131,7 +131,7 @@ static HRESULT WINAPI d3d8_vertexbuffer_FreePrivateData(IDirect3DVertexBuffer8 * TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid)); wined3d_mutex_lock(); - hr = IWineD3DBuffer_FreePrivateData(((IDirect3DVertexBuffer8Impl *)iface)->wineD3DVertexBuffer, guid); + hr = wined3d_buffer_free_private_data(((IDirect3DVertexBuffer8Impl *)iface)->wineD3DVertexBuffer, guid); wined3d_mutex_unlock(); return hr; @@ -144,7 +144,7 @@ static DWORD WINAPI d3d8_vertexbuffer_SetPriority(IDirect3DVertexBuffer8 *iface, TRACE("iface %p, priority %u.\n", iface, priority); wined3d_mutex_lock(); - previous = IWineD3DBuffer_SetPriority(((IDirect3DVertexBuffer8Impl *)iface)->wineD3DVertexBuffer, priority); + previous = wined3d_buffer_set_priority(((IDirect3DVertexBuffer8Impl *)iface)->wineD3DVertexBuffer, priority); wined3d_mutex_unlock(); return previous; @@ -157,7 +157,7 @@ static DWORD WINAPI d3d8_vertexbuffer_GetPriority(IDirect3DVertexBuffer8 *iface) TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - priority = IWineD3DBuffer_GetPriority(((IDirect3DVertexBuffer8Impl *)iface)->wineD3DVertexBuffer); + priority = wined3d_buffer_get_priority(((IDirect3DVertexBuffer8Impl *)iface)->wineD3DVertexBuffer); wined3d_mutex_unlock(); return priority; @@ -168,7 +168,7 @@ static void WINAPI d3d8_vertexbuffer_PreLoad(IDirect3DVertexBuffer8 *iface) TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - IWineD3DBuffer_PreLoad(((IDirect3DVertexBuffer8Impl *)iface)->wineD3DVertexBuffer); + wined3d_buffer_preload(((IDirect3DVertexBuffer8Impl *)iface)->wineD3DVertexBuffer); wined3d_mutex_unlock(); } @@ -188,7 +188,7 @@ static HRESULT WINAPI d3d8_vertexbuffer_Lock(IDirect3DVertexBuffer8 *iface, iface, offset, size, data, flags); wined3d_mutex_lock(); - hr = IWineD3DBuffer_Map(((IDirect3DVertexBuffer8Impl *)iface)->wineD3DVertexBuffer, + hr = wined3d_buffer_map(((IDirect3DVertexBuffer8Impl *)iface)->wineD3DVertexBuffer, offset, size, data, flags); wined3d_mutex_unlock(); @@ -197,32 +197,32 @@ static HRESULT WINAPI d3d8_vertexbuffer_Lock(IDirect3DVertexBuffer8 *iface, static HRESULT WINAPI d3d8_vertexbuffer_Unlock(IDirect3DVertexBuffer8 *iface) { - HRESULT hr; - TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - hr = IWineD3DBuffer_Unmap(((IDirect3DVertexBuffer8Impl *)iface)->wineD3DVertexBuffer); + wined3d_buffer_unmap(((IDirect3DVertexBuffer8Impl *)iface)->wineD3DVertexBuffer); wined3d_mutex_unlock(); - return hr; + return D3D_OK; } static HRESULT WINAPI d3d8_vertexbuffer_GetDesc(IDirect3DVertexBuffer8 *iface, D3DVERTEXBUFFER_DESC *desc) { IDirect3DVertexBuffer8Impl *buffer = (IDirect3DVertexBuffer8Impl *)iface; - WINED3DBUFFER_DESC wined3d_desc; + struct wined3d_resource_desc wined3d_desc; + struct wined3d_resource *wined3d_resource; TRACE("iface %p, desc %p.\n", iface, desc); wined3d_mutex_lock(); - IWineD3DBuffer_GetDesc(buffer->wineD3DVertexBuffer, &wined3d_desc); + wined3d_resource = wined3d_buffer_get_resource(buffer->wineD3DVertexBuffer); + wined3d_resource_get_desc(wined3d_resource, &wined3d_desc); wined3d_mutex_unlock(); desc->Type = D3DRTYPE_VERTEXBUFFER; - desc->Usage = wined3d_desc.Usage; - desc->Pool = wined3d_desc.Pool; - desc->Size = wined3d_desc.Size; + desc->Usage = wined3d_desc.usage; + desc->Pool = wined3d_desc.pool; + desc->Size = wined3d_desc.size; desc->FVF = buffer->fvf; desc->Format = D3DFMT_VERTEXDATA; @@ -270,7 +270,7 @@ HRESULT vertexbuffer_init(IDirect3DVertexBuffer8Impl *buffer, IDirect3DDevice8Im buffer->fvf = fvf; wined3d_mutex_lock(); - hr = IWineD3DDevice_CreateVertexBuffer(device->WineD3DDevice, size, usage & WINED3DUSAGE_MASK, + hr = wined3d_buffer_create_vb(device->wined3d_device, size, usage & WINED3DUSAGE_MASK, (WINED3DPOOL)pool, buffer, &d3d8_vertexbuffer_wined3d_parent_ops, &buffer->wineD3DVertexBuffer); wined3d_mutex_unlock(); if (FAILED(hr)) @@ -279,7 +279,7 @@ HRESULT vertexbuffer_init(IDirect3DVertexBuffer8Impl *buffer, IDirect3DDevice8Im return hr; } - buffer->parentDevice = (IDirect3DDevice8 *)device; + buffer->parentDevice = &device->IDirect3DDevice8_iface; IUnknown_AddRef(buffer->parentDevice); return D3D_OK; @@ -315,7 +315,7 @@ static ULONG WINAPI d3d8_indexbuffer_AddRef(IDirect3DIndexBuffer8 *iface) { IDirect3DDevice8_AddRef(buffer->parentDevice); wined3d_mutex_lock(); - IWineD3DBuffer_AddRef(buffer->wineD3DIndexBuffer); + wined3d_buffer_incref(buffer->wineD3DIndexBuffer); wined3d_mutex_unlock(); } @@ -334,7 +334,7 @@ static ULONG WINAPI d3d8_indexbuffer_Release(IDirect3DIndexBuffer8 *iface) IDirect3DDevice8 *device = buffer->parentDevice; wined3d_mutex_lock(); - IWineD3DBuffer_Release(buffer->wineD3DIndexBuffer); + wined3d_buffer_decref(buffer->wineD3DIndexBuffer); wined3d_mutex_unlock(); /* Release the device last, as it may cause the device to be destroyed. */ @@ -365,7 +365,7 @@ static HRESULT WINAPI d3d8_indexbuffer_SetPrivateData(IDirect3DIndexBuffer8 *ifa iface, debugstr_guid(guid), data, data_size, flags); wined3d_mutex_lock(); - hr = IWineD3DBuffer_SetPrivateData(((IDirect3DIndexBuffer8Impl *)iface)->wineD3DIndexBuffer, + hr = wined3d_buffer_set_private_data(((IDirect3DIndexBuffer8Impl *)iface)->wineD3DIndexBuffer, guid, data, data_size, flags); wined3d_mutex_unlock(); @@ -381,7 +381,7 @@ static HRESULT WINAPI d3d8_indexbuffer_GetPrivateData(IDirect3DIndexBuffer8 *ifa iface, debugstr_guid(guid), data, data_size); wined3d_mutex_lock(); - hr = IWineD3DBuffer_GetPrivateData(((IDirect3DIndexBuffer8Impl *)iface)->wineD3DIndexBuffer, + hr = wined3d_buffer_get_private_data(((IDirect3DIndexBuffer8Impl *)iface)->wineD3DIndexBuffer, guid, data, data_size); wined3d_mutex_unlock(); @@ -395,7 +395,7 @@ static HRESULT WINAPI d3d8_indexbuffer_FreePrivateData(IDirect3DIndexBuffer8 *if TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid)); wined3d_mutex_lock(); - hr = IWineD3DBuffer_FreePrivateData(((IDirect3DIndexBuffer8Impl *)iface)->wineD3DIndexBuffer, guid); + hr = wined3d_buffer_free_private_data(((IDirect3DIndexBuffer8Impl *)iface)->wineD3DIndexBuffer, guid); wined3d_mutex_unlock(); return hr; @@ -408,7 +408,7 @@ static DWORD WINAPI d3d8_indexbuffer_SetPriority(IDirect3DIndexBuffer8 *iface, D TRACE("iface %p, priority %u.\n", iface, priority); wined3d_mutex_lock(); - previous = IWineD3DBuffer_SetPriority(((IDirect3DIndexBuffer8Impl *)iface)->wineD3DIndexBuffer, priority); + previous = wined3d_buffer_set_priority(((IDirect3DIndexBuffer8Impl *)iface)->wineD3DIndexBuffer, priority); wined3d_mutex_unlock(); return previous; @@ -421,7 +421,7 @@ static DWORD WINAPI d3d8_indexbuffer_GetPriority(IDirect3DIndexBuffer8 *iface) TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - priority = IWineD3DBuffer_GetPriority(((IDirect3DIndexBuffer8Impl *)iface)->wineD3DIndexBuffer); + priority = wined3d_buffer_get_priority(((IDirect3DIndexBuffer8Impl *)iface)->wineD3DIndexBuffer); wined3d_mutex_unlock(); return priority; @@ -432,7 +432,7 @@ static void WINAPI d3d8_indexbuffer_PreLoad(IDirect3DIndexBuffer8 *iface) TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - IWineD3DBuffer_PreLoad(((IDirect3DIndexBuffer8Impl *)iface)->wineD3DIndexBuffer); + wined3d_buffer_preload(((IDirect3DIndexBuffer8Impl *)iface)->wineD3DIndexBuffer); wined3d_mutex_unlock(); } @@ -452,7 +452,7 @@ static HRESULT WINAPI d3d8_indexbuffer_Lock(IDirect3DIndexBuffer8 *iface, iface, offset, size, data, flags); wined3d_mutex_lock(); - hr = IWineD3DBuffer_Map(((IDirect3DIndexBuffer8Impl *)iface)->wineD3DIndexBuffer, + hr = wined3d_buffer_map(((IDirect3DIndexBuffer8Impl *)iface)->wineD3DIndexBuffer, offset, size, data, flags); wined3d_mutex_unlock(); @@ -461,33 +461,33 @@ static HRESULT WINAPI d3d8_indexbuffer_Lock(IDirect3DIndexBuffer8 *iface, static HRESULT WINAPI d3d8_indexbuffer_Unlock(IDirect3DIndexBuffer8 *iface) { - HRESULT hr; - TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - hr = IWineD3DBuffer_Unmap(((IDirect3DIndexBuffer8Impl *)iface)->wineD3DIndexBuffer); + wined3d_buffer_unmap(((IDirect3DIndexBuffer8Impl *)iface)->wineD3DIndexBuffer); wined3d_mutex_unlock(); - return hr; + return D3D_OK; } static HRESULT WINAPI d3d8_indexbuffer_GetDesc(IDirect3DIndexBuffer8 *iface, D3DINDEXBUFFER_DESC *desc) { IDirect3DIndexBuffer8Impl *buffer = (IDirect3DIndexBuffer8Impl *)iface; - WINED3DBUFFER_DESC wined3d_desc; + struct wined3d_resource_desc wined3d_desc; + struct wined3d_resource *wined3d_resource; TRACE("iface %p, desc %p.\n", iface, desc); wined3d_mutex_lock(); - IWineD3DBuffer_GetDesc(buffer->wineD3DIndexBuffer, &wined3d_desc); + wined3d_resource = wined3d_buffer_get_resource(buffer->wineD3DIndexBuffer); + wined3d_resource_get_desc(wined3d_resource, &wined3d_desc); wined3d_mutex_unlock(); desc->Format = d3dformat_from_wined3dformat(buffer->format); desc->Type = D3DRTYPE_INDEXBUFFER; - desc->Usage = wined3d_desc.Usage; - desc->Pool = wined3d_desc.Pool; - desc->Size = wined3d_desc.Size; + desc->Usage = wined3d_desc.usage; + desc->Pool = wined3d_desc.pool; + desc->Size = wined3d_desc.size; return D3D_OK; } @@ -533,7 +533,7 @@ HRESULT indexbuffer_init(IDirect3DIndexBuffer8Impl *buffer, IDirect3DDevice8Impl buffer->format = wined3dformat_from_d3dformat(format); wined3d_mutex_lock(); - hr = IWineD3DDevice_CreateIndexBuffer(device->WineD3DDevice, size, usage & WINED3DUSAGE_MASK, + hr = wined3d_buffer_create_ib(device->wined3d_device, size, usage & WINED3DUSAGE_MASK, (WINED3DPOOL)pool, buffer, &d3d8_indexbuffer_wined3d_parent_ops, &buffer->wineD3DIndexBuffer); wined3d_mutex_unlock(); if (FAILED(hr)) @@ -542,7 +542,7 @@ HRESULT indexbuffer_init(IDirect3DIndexBuffer8Impl *buffer, IDirect3DDevice8Impl return hr; } - buffer->parentDevice = (IDirect3DDevice8 *)device; + buffer->parentDevice = &device->IDirect3DDevice8_iface; IUnknown_AddRef(buffer->parentDevice); return D3D_OK; diff --git a/dll/directx/wine/d3d8/cubetexture.c b/dll/directx/wine/d3d8/cubetexture.c index b9b411a1156..5915c54e730 100644 --- a/dll/directx/wine/d3d8/cubetexture.c +++ b/dll/directx/wine/d3d8/cubetexture.c @@ -23,9 +23,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d8); -/* IDirect3DCubeTexture8 IUnknown parts follow: */ -static HRESULT WINAPI IDirect3DCubeTexture8Impl_QueryInterface(LPDIRECT3DCUBETEXTURE8 iface, REFIID riid, LPVOID *ppobj) { - IDirect3DCubeTexture8Impl *This = (IDirect3DCubeTexture8Impl *)iface; +static inline IDirect3DCubeTexture8Impl *impl_from_IDirect3DCubeTexture8(IDirect3DCubeTexture8 *iface) +{ + return CONTAINING_RECORD(iface, IDirect3DCubeTexture8Impl, IDirect3DCubeTexture8_iface); +} + +static HRESULT WINAPI IDirect3DCubeTexture8Impl_QueryInterface(IDirect3DCubeTexture8 *iface, + REFIID riid, void **ppobj) +{ + IDirect3DCubeTexture8Impl *This = impl_from_IDirect3DCubeTexture8(iface); TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), ppobj); @@ -43,8 +49,9 @@ static HRESULT WINAPI IDirect3DCubeTexture8Impl_QueryInterface(LPDIRECT3DCUBETEX return E_NOINTERFACE; } -static ULONG WINAPI IDirect3DCubeTexture8Impl_AddRef(LPDIRECT3DCUBETEXTURE8 iface) { - IDirect3DCubeTexture8Impl *This = (IDirect3DCubeTexture8Impl *)iface; +static ULONG WINAPI IDirect3DCubeTexture8Impl_AddRef(IDirect3DCubeTexture8 *iface) +{ + IDirect3DCubeTexture8Impl *This = impl_from_IDirect3DCubeTexture8(iface); ULONG ref = InterlockedIncrement(&This->ref); TRACE("%p increasing refcount to %u.\n", iface, ref); @@ -53,15 +60,16 @@ static ULONG WINAPI IDirect3DCubeTexture8Impl_AddRef(LPDIRECT3DCUBETEXTURE8 ifac { IUnknown_AddRef(This->parentDevice); wined3d_mutex_lock(); - IWineD3DCubeTexture_AddRef(This->wineD3DCubeTexture); + wined3d_texture_incref(This->wined3d_texture); wined3d_mutex_unlock(); } return ref; } -static ULONG WINAPI IDirect3DCubeTexture8Impl_Release(LPDIRECT3DCUBETEXTURE8 iface) { - IDirect3DCubeTexture8Impl *This = (IDirect3DCubeTexture8Impl *)iface; +static ULONG WINAPI IDirect3DCubeTexture8Impl_Release(IDirect3DCubeTexture8 *iface) +{ + IDirect3DCubeTexture8Impl *This = impl_from_IDirect3DCubeTexture8(iface); ULONG ref = InterlockedDecrement(&This->ref); TRACE("%p decreasing refcount to %u.\n", iface, ref); @@ -69,10 +77,10 @@ static ULONG WINAPI IDirect3DCubeTexture8Impl_Release(LPDIRECT3DCUBETEXTURE8 ifa if (ref == 0) { IDirect3DDevice8 *parentDevice = This->parentDevice; - TRACE("Releasing child %p\n", This->wineD3DCubeTexture); + TRACE("Releasing child %p.\n", This->wined3d_texture); wined3d_mutex_lock(); - IWineD3DCubeTexture_Release(This->wineD3DCubeTexture); + wined3d_texture_decref(This->wined3d_texture); wined3d_mutex_unlock(); /* Release the device last, as it may cause the device to be destroyed. */ @@ -82,9 +90,10 @@ static ULONG WINAPI IDirect3DCubeTexture8Impl_Release(LPDIRECT3DCUBETEXTURE8 ifa } /* IDirect3DCubeTexture8 IDirect3DResource8 Interface follow: */ -static HRESULT WINAPI IDirect3DCubeTexture8Impl_GetDevice(IDirect3DCubeTexture8 *iface, IDirect3DDevice8 **device) +static HRESULT WINAPI IDirect3DCubeTexture8Impl_GetDevice(IDirect3DCubeTexture8 *iface, + IDirect3DDevice8 **device) { - IDirect3DCubeTexture8Impl *This = (IDirect3DCubeTexture8Impl *)iface; + IDirect3DCubeTexture8Impl *This = impl_from_IDirect3DCubeTexture8(iface); TRACE("iface %p, device %p.\n", iface, device); @@ -96,221 +105,275 @@ static HRESULT WINAPI IDirect3DCubeTexture8Impl_GetDevice(IDirect3DCubeTexture8 return D3D_OK; } -static HRESULT WINAPI IDirect3DCubeTexture8Impl_SetPrivateData(LPDIRECT3DCUBETEXTURE8 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) { - IDirect3DCubeTexture8Impl *This = (IDirect3DCubeTexture8Impl *)iface; +static HRESULT WINAPI IDirect3DCubeTexture8Impl_SetPrivateData(IDirect3DCubeTexture8 *iface, + REFGUID refguid, const void *pData, DWORD SizeOfData, DWORD Flags) +{ + IDirect3DCubeTexture8Impl *This = impl_from_IDirect3DCubeTexture8(iface); HRESULT hr; TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n", iface, debugstr_guid(refguid), pData, SizeOfData, Flags); wined3d_mutex_lock(); - hr = IWineD3DCubeTexture_SetPrivateData(This->wineD3DCubeTexture,refguid,pData,SizeOfData,Flags); + hr = wined3d_texture_set_private_data(This->wined3d_texture, refguid, pData, SizeOfData, Flags); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DCubeTexture8Impl_GetPrivateData(LPDIRECT3DCUBETEXTURE8 iface, REFGUID refguid, void *pData, DWORD *pSizeOfData) { - IDirect3DCubeTexture8Impl *This = (IDirect3DCubeTexture8Impl *)iface; +static HRESULT WINAPI IDirect3DCubeTexture8Impl_GetPrivateData(IDirect3DCubeTexture8 *iface, + REFGUID refguid, void *pData, DWORD *pSizeOfData) +{ + IDirect3DCubeTexture8Impl *This = impl_from_IDirect3DCubeTexture8(iface); HRESULT hr; TRACE("iface %p, guid %s, data %p, data_size %p.\n", iface, debugstr_guid(refguid), pData, pSizeOfData); wined3d_mutex_lock(); - hr = IWineD3DCubeTexture_GetPrivateData(This->wineD3DCubeTexture,refguid,pData,pSizeOfData); + hr = wined3d_texture_get_private_data(This->wined3d_texture, refguid, pData, pSizeOfData); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DCubeTexture8Impl_FreePrivateData(LPDIRECT3DCUBETEXTURE8 iface, REFGUID refguid) { - IDirect3DCubeTexture8Impl *This = (IDirect3DCubeTexture8Impl *)iface; +static HRESULT WINAPI IDirect3DCubeTexture8Impl_FreePrivateData(IDirect3DCubeTexture8 *iface, + REFGUID refguid) +{ + IDirect3DCubeTexture8Impl *This = impl_from_IDirect3DCubeTexture8(iface); HRESULT hr; TRACE("iface %p, guid %s.\n", iface, debugstr_guid(refguid)); wined3d_mutex_lock(); - hr = IWineD3DCubeTexture_FreePrivateData(This->wineD3DCubeTexture,refguid); + hr = wined3d_texture_free_private_data(This->wined3d_texture, refguid); wined3d_mutex_unlock(); return hr; } -static DWORD WINAPI IDirect3DCubeTexture8Impl_SetPriority(LPDIRECT3DCUBETEXTURE8 iface, DWORD PriorityNew) { - IDirect3DCubeTexture8Impl *This = (IDirect3DCubeTexture8Impl *)iface; +static DWORD WINAPI IDirect3DCubeTexture8Impl_SetPriority(IDirect3DCubeTexture8 *iface, + DWORD PriorityNew) +{ + IDirect3DCubeTexture8Impl *This = impl_from_IDirect3DCubeTexture8(iface); DWORD ret; TRACE("iface %p, priority %u.\n", iface, PriorityNew); wined3d_mutex_lock(); - ret = IWineD3DCubeTexture_SetPriority(This->wineD3DCubeTexture, PriorityNew); + ret = wined3d_texture_set_priority(This->wined3d_texture, PriorityNew); wined3d_mutex_unlock(); return ret; } -static DWORD WINAPI IDirect3DCubeTexture8Impl_GetPriority(LPDIRECT3DCUBETEXTURE8 iface) { - IDirect3DCubeTexture8Impl *This = (IDirect3DCubeTexture8Impl *)iface; +static DWORD WINAPI IDirect3DCubeTexture8Impl_GetPriority(IDirect3DCubeTexture8 *iface) +{ + IDirect3DCubeTexture8Impl *This = impl_from_IDirect3DCubeTexture8(iface); DWORD ret; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - ret = IWineD3DCubeTexture_GetPriority(This->wineD3DCubeTexture); + ret = wined3d_texture_get_priority(This->wined3d_texture); wined3d_mutex_unlock(); return ret; } -static void WINAPI IDirect3DCubeTexture8Impl_PreLoad(LPDIRECT3DCUBETEXTURE8 iface) { - IDirect3DCubeTexture8Impl *This = (IDirect3DCubeTexture8Impl *)iface; +static void WINAPI IDirect3DCubeTexture8Impl_PreLoad(IDirect3DCubeTexture8 *iface) +{ + IDirect3DCubeTexture8Impl *This = impl_from_IDirect3DCubeTexture8(iface); TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - IWineD3DCubeTexture_PreLoad(This->wineD3DCubeTexture); + wined3d_texture_preload(This->wined3d_texture); wined3d_mutex_unlock(); } -static D3DRESOURCETYPE WINAPI IDirect3DCubeTexture8Impl_GetType(LPDIRECT3DCUBETEXTURE8 iface) { - IDirect3DCubeTexture8Impl *This = (IDirect3DCubeTexture8Impl *)iface; +static D3DRESOURCETYPE WINAPI IDirect3DCubeTexture8Impl_GetType(IDirect3DCubeTexture8 *iface) +{ + IDirect3DCubeTexture8Impl *This = impl_from_IDirect3DCubeTexture8(iface); D3DRESOURCETYPE type; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - type = IWineD3DCubeTexture_GetType(This->wineD3DCubeTexture); + type = wined3d_texture_get_type(This->wined3d_texture); wined3d_mutex_unlock(); return type; } /* IDirect3DCubeTexture8 IDirect3DBaseTexture8 Interface follow: */ -static DWORD WINAPI IDirect3DCubeTexture8Impl_SetLOD(LPDIRECT3DCUBETEXTURE8 iface, DWORD LODNew) { - IDirect3DCubeTexture8Impl *This = (IDirect3DCubeTexture8Impl *)iface; +static DWORD WINAPI IDirect3DCubeTexture8Impl_SetLOD(IDirect3DCubeTexture8 *iface, DWORD LODNew) +{ + IDirect3DCubeTexture8Impl *This = impl_from_IDirect3DCubeTexture8(iface); DWORD lod; TRACE("iface %p, lod %u.\n", iface, LODNew); wined3d_mutex_lock(); - lod = IWineD3DCubeTexture_SetLOD(This->wineD3DCubeTexture, LODNew); + lod = wined3d_texture_set_lod(This->wined3d_texture, LODNew); wined3d_mutex_unlock(); return lod; } -static DWORD WINAPI IDirect3DCubeTexture8Impl_GetLOD(LPDIRECT3DCUBETEXTURE8 iface) { - IDirect3DCubeTexture8Impl *This = (IDirect3DCubeTexture8Impl *)iface; +static DWORD WINAPI IDirect3DCubeTexture8Impl_GetLOD(IDirect3DCubeTexture8 *iface) +{ + IDirect3DCubeTexture8Impl *This = impl_from_IDirect3DCubeTexture8(iface); DWORD lod; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - lod = IWineD3DCubeTexture_GetLOD((LPDIRECT3DBASETEXTURE8) This); + lod = wined3d_texture_get_lod(This->wined3d_texture); wined3d_mutex_unlock(); return lod; } -static DWORD WINAPI IDirect3DCubeTexture8Impl_GetLevelCount(LPDIRECT3DCUBETEXTURE8 iface) { - IDirect3DCubeTexture8Impl *This = (IDirect3DCubeTexture8Impl *)iface; +static DWORD WINAPI IDirect3DCubeTexture8Impl_GetLevelCount(IDirect3DCubeTexture8 *iface) +{ + IDirect3DCubeTexture8Impl *This = impl_from_IDirect3DCubeTexture8(iface); DWORD cnt; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - cnt = IWineD3DCubeTexture_GetLevelCount(This->wineD3DCubeTexture); + cnt = wined3d_texture_get_level_count(This->wined3d_texture); wined3d_mutex_unlock(); return cnt; } /* IDirect3DCubeTexture8 Interface follow: */ -static HRESULT WINAPI IDirect3DCubeTexture8Impl_GetLevelDesc(LPDIRECT3DCUBETEXTURE8 iface, UINT Level, D3DSURFACE_DESC *pDesc) { - IDirect3DCubeTexture8Impl *This = (IDirect3DCubeTexture8Impl *)iface; - HRESULT hr; - WINED3DSURFACE_DESC wined3ddesc; +static HRESULT WINAPI IDirect3DCubeTexture8Impl_GetLevelDesc(IDirect3DCubeTexture8 *iface, + UINT level, D3DSURFACE_DESC *desc) +{ + IDirect3DCubeTexture8Impl *texture = impl_from_IDirect3DCubeTexture8(iface); + struct wined3d_resource *sub_resource; + HRESULT hr = D3D_OK; - TRACE("iface %p, level %u, desc %p.\n", iface, Level, pDesc); + TRACE("iface %p, level %u, desc %p.\n", iface, level, desc); wined3d_mutex_lock(); - hr = IWineD3DCubeTexture_GetLevelDesc(This->wineD3DCubeTexture, Level, &wined3ddesc); - wined3d_mutex_unlock(); - - if (SUCCEEDED(hr)) + if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, level))) + hr = D3DERR_INVALIDCALL; + else { - pDesc->Format = d3dformat_from_wined3dformat(wined3ddesc.format); - pDesc->Type = wined3ddesc.resource_type; - pDesc->Usage = wined3ddesc.usage; - pDesc->Pool = wined3ddesc.pool; - pDesc->Size = wined3ddesc.size; - pDesc->MultiSampleType = wined3ddesc.multisample_type; - pDesc->Width = wined3ddesc.width; - pDesc->Height = wined3ddesc.height; + struct wined3d_resource_desc wined3d_desc; + + wined3d_resource_get_desc(sub_resource, &wined3d_desc); + desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format); + desc->Type = wined3d_desc.resource_type; + desc->Usage = wined3d_desc.usage; + desc->Pool = wined3d_desc.pool; + desc->Size = wined3d_desc.size; + desc->MultiSampleType = wined3d_desc.multisample_type; + desc->Width = wined3d_desc.width; + desc->Height = wined3d_desc.height; } + wined3d_mutex_unlock(); return hr; } static HRESULT WINAPI IDirect3DCubeTexture8Impl_GetCubeMapSurface(IDirect3DCubeTexture8 *iface, - D3DCUBEMAP_FACES FaceType, UINT Level, IDirect3DSurface8 **ppCubeMapSurface) + D3DCUBEMAP_FACES face, UINT level, IDirect3DSurface8 **surface) { - IDirect3DCubeTexture8Impl *This = (IDirect3DCubeTexture8Impl *)iface; - IWineD3DSurface *mySurface = NULL; - HRESULT hr; + IDirect3DCubeTexture8Impl *texture = impl_from_IDirect3DCubeTexture8(iface); + struct wined3d_resource *sub_resource; + UINT sub_resource_idx; - TRACE("iface %p, face %#x, level %u, surface %p.\n", iface, FaceType, Level, ppCubeMapSurface); + TRACE("iface %p, face %#x, level %u, surface %p.\n", iface, face, level, surface); wined3d_mutex_lock(); - hr = IWineD3DCubeTexture_GetCubeMapSurface(This->wineD3DCubeTexture, - (WINED3DCUBEMAP_FACES) FaceType, Level, &mySurface); - if (SUCCEEDED(hr) && ppCubeMapSurface) + sub_resource_idx = wined3d_texture_get_level_count(texture->wined3d_texture) * face + level; + if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, sub_resource_idx))) { - *ppCubeMapSurface = IWineD3DCubeTexture_GetParent(mySurface); - IDirect3DSurface8_AddRef(*ppCubeMapSurface); - IWineD3DCubeTexture_Release(mySurface); + wined3d_mutex_unlock(); + return D3DERR_INVALIDCALL; } + + *surface = wined3d_resource_get_parent(sub_resource); + IDirect3DSurface8_AddRef(*surface); wined3d_mutex_unlock(); - return hr; + return D3D_OK; } -static HRESULT WINAPI IDirect3DCubeTexture8Impl_LockRect(LPDIRECT3DCUBETEXTURE8 iface, D3DCUBEMAP_FACES FaceType, UINT Level, D3DLOCKED_RECT* pLockedRect, CONST RECT *pRect, DWORD Flags) { - IDirect3DCubeTexture8Impl *This = (IDirect3DCubeTexture8Impl *)iface; +static HRESULT WINAPI IDirect3DCubeTexture8Impl_LockRect(IDirect3DCubeTexture8 *iface, + D3DCUBEMAP_FACES face, UINT level, D3DLOCKED_RECT *locked_rect, const RECT *rect, + DWORD flags) +{ + IDirect3DCubeTexture8Impl *texture = impl_from_IDirect3DCubeTexture8(iface); + struct wined3d_resource *sub_resource; + UINT sub_resource_idx; HRESULT hr; TRACE("iface %p, face %#x, level %u, locked_rect %p, rect %p, flags %#x.\n", - iface, FaceType, Level, pLockedRect, pRect, Flags); + iface, face, level, locked_rect, rect, flags); wined3d_mutex_lock(); - hr = IWineD3DCubeTexture_LockRect(This->wineD3DCubeTexture, (WINED3DCUBEMAP_FACES) FaceType, Level, (WINED3DLOCKED_RECT *) pLockedRect, pRect, Flags); + sub_resource_idx = wined3d_texture_get_level_count(texture->wined3d_texture) * face + level; + if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, sub_resource_idx))) + hr = D3DERR_INVALIDCALL; + else + hr = IDirect3DSurface8_LockRect((IDirect3DSurface8 *)wined3d_resource_get_parent(sub_resource), + locked_rect, rect, flags); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DCubeTexture8Impl_UnlockRect(LPDIRECT3DCUBETEXTURE8 iface, D3DCUBEMAP_FACES FaceType, UINT Level) { - IDirect3DCubeTexture8Impl *This = (IDirect3DCubeTexture8Impl *)iface; +static HRESULT WINAPI IDirect3DCubeTexture8Impl_UnlockRect(IDirect3DCubeTexture8 *iface, + D3DCUBEMAP_FACES face, UINT level) +{ + IDirect3DCubeTexture8Impl *texture = impl_from_IDirect3DCubeTexture8(iface); + struct wined3d_resource *sub_resource; + UINT sub_resource_idx; HRESULT hr; - TRACE("iface %p, face %#x, level %u.\n", iface, FaceType, Level); + TRACE("iface %p, face %#x, level %u.\n", iface, face, level); wined3d_mutex_lock(); - hr = IWineD3DCubeTexture_UnlockRect(This->wineD3DCubeTexture, (WINED3DCUBEMAP_FACES) FaceType, Level); + sub_resource_idx = wined3d_texture_get_level_count(texture->wined3d_texture) * face + level; + if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, sub_resource_idx))) + hr = D3DERR_INVALIDCALL; + else + hr = IDirect3DSurface8_UnlockRect((IDirect3DSurface8 *)wined3d_resource_get_parent(sub_resource)); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DCubeTexture8Impl_AddDirtyRect(LPDIRECT3DCUBETEXTURE8 iface, D3DCUBEMAP_FACES FaceType, CONST RECT *pDirtyRect) { - IDirect3DCubeTexture8Impl *This = (IDirect3DCubeTexture8Impl *)iface; +static HRESULT WINAPI IDirect3DCubeTexture8Impl_AddDirtyRect(IDirect3DCubeTexture8 *iface, + D3DCUBEMAP_FACES face, const RECT *dirty_rect) +{ + IDirect3DCubeTexture8Impl *texture = impl_from_IDirect3DCubeTexture8(iface); HRESULT hr; - TRACE("iface %p, face %#x, dirty_rect %p.\n", iface, FaceType, pDirtyRect); + TRACE("iface %p, face %#x, dirty_rect %s.\n", + iface, face, wine_dbgstr_rect(dirty_rect)); wined3d_mutex_lock(); - hr = IWineD3DCubeTexture_AddDirtyRect(This->wineD3DCubeTexture, (WINED3DCUBEMAP_FACES) FaceType, pDirtyRect); + if (!dirty_rect) + hr = wined3d_texture_add_dirty_region(texture->wined3d_texture, face, NULL); + else + { + WINED3DBOX dirty_region; + + dirty_region.Left = dirty_rect->left; + dirty_region.Top = dirty_rect->top; + dirty_region.Right = dirty_rect->right; + dirty_region.Bottom = dirty_rect->bottom; + dirty_region.Front = 0; + dirty_region.Back = 1; + hr = wined3d_texture_add_dirty_region(texture->wined3d_texture, face, &dirty_region); + } wined3d_mutex_unlock(); return hr; @@ -358,13 +421,13 @@ HRESULT cubetexture_init(IDirect3DCubeTexture8Impl *texture, IDirect3DDevice8Imp { HRESULT hr; - texture->lpVtbl = &Direct3DCubeTexture8_Vtbl; + texture->IDirect3DCubeTexture8_iface.lpVtbl = &Direct3DCubeTexture8_Vtbl; texture->ref = 1; wined3d_mutex_lock(); - hr = IWineD3DDevice_CreateCubeTexture(device->WineD3DDevice, edge_length, levels, + hr = wined3d_texture_create_cube(device->wined3d_device, edge_length, levels, usage & WINED3DUSAGE_MASK, wined3dformat_from_d3dformat(format), pool, texture, - &d3d8_cubetexture_wined3d_parent_ops, &texture->wineD3DCubeTexture); + &d3d8_cubetexture_wined3d_parent_ops, &texture->wined3d_texture); wined3d_mutex_unlock(); if (FAILED(hr)) { @@ -372,7 +435,7 @@ HRESULT cubetexture_init(IDirect3DCubeTexture8Impl *texture, IDirect3DDevice8Imp return hr; } - texture->parentDevice = (IDirect3DDevice8 *)device; + texture->parentDevice = &device->IDirect3DDevice8_iface; IDirect3DDevice8_AddRef(texture->parentDevice); return D3D_OK; diff --git a/dll/directx/wine/d3d8/d3d8.rbuild b/dll/directx/wine/d3d8/d3d8.rbuild index 84e2a26d275..c6819396c48 100644 --- a/dll/directx/wine/d3d8/d3d8.rbuild +++ b/dll/directx/wine/d3d8/d3d8.rbuild @@ -27,6 +27,7 @@ volume.c volumetexture.c version.rc + d3d8_private.h wineheaders diff --git a/dll/directx/wine/d3d8/d3d8_main.c b/dll/directx/wine/d3d8/d3d8_main.c index 6cefe574d19..7a25a93c928 100644 --- a/dll/directx/wine/d3d8/d3d8_main.c +++ b/dll/directx/wine/d3d8/d3d8_main.c @@ -43,9 +43,9 @@ IDirect3D8* WINAPI DECLSPEC_HOTPATCH Direct3DCreate8(UINT SDKVersion) { object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3D8Impl)); - object->lpVtbl = &Direct3D8_Vtbl; + object->IDirect3D8_iface.lpVtbl = &Direct3D8_Vtbl; object->ref = 1; - object->WineD3D = WineDirect3DCreate(8, (IUnknown *)object); + object->WineD3D = wined3d_create(8, &object->IDirect3D8_iface); TRACE("Created Direct3D object @ %p, WineObj @ %p\n", object, object->WineD3D); @@ -56,7 +56,7 @@ IDirect3D8* WINAPI DECLSPEC_HOTPATCH Direct3DCreate8(UINT SDKVersion) { HeapFree( GetProcessHeap(), 0, object ); object = NULL; } - return (IDirect3D8*) object; + return &object->IDirect3D8_iface; } /* At process attach */ diff --git a/dll/directx/wine/d3d8/device.c b/dll/directx/wine/d3d8/device.c index f54f043e006..aa85c61c398 100644 --- a/dll/directx/wine/d3d8/device.c +++ b/dll/directx/wine/d3d8/device.c @@ -254,20 +254,15 @@ static void *d3d8_get_object(struct d3d8_handle_table *t, DWORD handle, enum d3d return entry->object; } -static ULONG WINAPI D3D8CB_DestroySwapChain(IWineD3DSwapChain *swapchain) +static inline IDirect3DDevice8Impl *impl_from_IDirect3DDevice8(IDirect3DDevice8 *iface) { - IUnknown *parent; - - TRACE("swapchain %p.\n", swapchain); - - parent = IWineD3DSwapChain_GetParent(swapchain); - return IUnknown_Release(parent); + return CONTAINING_RECORD(iface, IDirect3DDevice8Impl, IDirect3DDevice8_iface); } -/* IDirect3D IUnknown parts follow: */ -static HRESULT WINAPI IDirect3DDevice8Impl_QueryInterface(LPDIRECT3DDEVICE8 iface,REFIID riid,LPVOID *ppobj) +static HRESULT WINAPI IDirect3DDevice8Impl_QueryInterface(IDirect3DDevice8 *iface, REFIID riid, + void **ppobj) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), ppobj); @@ -279,20 +274,14 @@ static HRESULT WINAPI IDirect3DDevice8Impl_QueryInterface(LPDIRECT3DDEVICE8 ifac return S_OK; } - if (IsEqualGUID(riid, &IID_IWineD3DDeviceParent)) - { - IUnknown_AddRef((IUnknown *)&This->device_parent_vtbl); - *ppobj = &This->device_parent_vtbl; - return S_OK; - } - WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); *ppobj = NULL; return E_NOINTERFACE; } -static ULONG WINAPI IDirect3DDevice8Impl_AddRef(LPDIRECT3DDEVICE8 iface) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static ULONG WINAPI IDirect3DDevice8Impl_AddRef(IDirect3DDevice8 *iface) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); ULONG ref = InterlockedIncrement(&This->ref); TRACE("%p increasing refcount to %u.\n", iface, ref); @@ -300,8 +289,9 @@ static ULONG WINAPI IDirect3DDevice8Impl_AddRef(LPDIRECT3DDEVICE8 iface) { return ref; } -static ULONG WINAPI IDirect3DDevice8Impl_Release(LPDIRECT3DDEVICE8 iface) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static ULONG WINAPI IDirect3DDevice8Impl_Release(IDirect3DDevice8 *iface) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); ULONG ref; if (This->inDestruction) return 0; @@ -312,7 +302,7 @@ static ULONG WINAPI IDirect3DDevice8Impl_Release(LPDIRECT3DDEVICE8 iface) { if (ref == 0) { unsigned i; - TRACE("Releasing wined3d device %p\n", This->WineD3DDevice); + TRACE("Releasing wined3d device %p.\n", This->wined3d_device); wined3d_mutex_lock(); @@ -323,9 +313,9 @@ static ULONG WINAPI IDirect3DDevice8Impl_Release(LPDIRECT3DDEVICE8 iface) { } HeapFree(GetProcessHeap(), 0, This->decls); - IWineD3DDevice_Uninit3D(This->WineD3DDevice, D3D8CB_DestroySwapChain); - IWineD3DDevice_ReleaseFocusWindow(This->WineD3DDevice); - IWineD3DDevice_Release(This->WineD3DDevice); + wined3d_device_uninit_3d(This->wined3d_device); + wined3d_device_release_focus_window(This->wined3d_device); + wined3d_device_decref(This->wined3d_device); HeapFree(GetProcessHeap(), 0, This->handle_table.entries); HeapFree(GetProcessHeap(), 0, This); @@ -337,33 +327,44 @@ static ULONG WINAPI IDirect3DDevice8Impl_Release(LPDIRECT3DDEVICE8 iface) { /* IDirect3DDevice Interface follow: */ static HRESULT WINAPI IDirect3DDevice8Impl_TestCooperativeLevel(IDirect3DDevice8 *iface) { + IDirect3DDevice8Impl *device = impl_from_IDirect3DDevice8(iface); + TRACE("iface %p.\n", iface); + if (device->lost) + { + TRACE("Device is lost.\n"); + return D3DERR_DEVICENOTRESET; + } + return D3D_OK; } -static UINT WINAPI IDirect3DDevice8Impl_GetAvailableTextureMem(LPDIRECT3DDEVICE8 iface) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static UINT WINAPI IDirect3DDevice8Impl_GetAvailableTextureMem(IDirect3DDevice8 *iface) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); HRESULT hr; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - hr = IWineD3DDevice_GetAvailableTextureMem(This->WineD3DDevice); + hr = wined3d_device_get_available_texture_mem(This->wined3d_device); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice8Impl_ResourceManagerDiscardBytes(LPDIRECT3DDEVICE8 iface, DWORD Bytes) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_ResourceManagerDiscardBytes(IDirect3DDevice8 *iface, + DWORD Bytes) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); HRESULT hr; TRACE("iface %p, byte_count %u.\n", iface, Bytes); FIXME("Byte count ignored.\n"); wined3d_mutex_lock(); - hr = IWineD3DDevice_EvictManagedResources(This->WineD3DDevice); + hr = wined3d_device_evict_managed_resources(This->wined3d_device); wined3d_mutex_unlock(); return hr; @@ -371,8 +372,8 @@ static HRESULT WINAPI IDirect3DDevice8Impl_ResourceManagerDiscardBytes(LPDIRECT3 static HRESULT WINAPI IDirect3DDevice8Impl_GetDirect3D(IDirect3DDevice8 *iface, IDirect3D8 **ppD3D8) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; - IWineD3D *pWineD3D; + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); + struct wined3d *wined3d; HRESULT hr; TRACE("iface %p, d3d8 %p.\n", iface, ppD3D8); @@ -382,12 +383,12 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetDirect3D(IDirect3DDevice8 *iface, } wined3d_mutex_lock(); - hr = IWineD3DDevice_GetDirect3D(This->WineD3DDevice, &pWineD3D); - if (SUCCEEDED(hr) && pWineD3D) + hr = wined3d_device_get_wined3d(This->wined3d_device, &wined3d); + if (SUCCEEDED(hr) && wined3d) { - *ppD3D8 = IWineD3D_GetParent(pWineD3D); + *ppD3D8 = wined3d_get_parent(wined3d); IDirect3D8_AddRef(*ppD3D8); - IWineD3D_Release(pWineD3D); + wined3d_decref(wined3d); } else { @@ -401,8 +402,9 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetDirect3D(IDirect3DDevice8 *iface, return hr; } -static HRESULT WINAPI IDirect3DDevice8Impl_GetDeviceCaps(LPDIRECT3DDEVICE8 iface, D3DCAPS8* pCaps) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_GetDeviceCaps(IDirect3DDevice8 *iface, D3DCAPS8 *pCaps) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); HRESULT hrc = D3D_OK; WINED3DCAPS *pWineCaps; @@ -417,7 +419,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetDeviceCaps(LPDIRECT3DDEVICE8 iface } wined3d_mutex_lock(); - hrc = IWineD3DDevice_GetDeviceCaps(This->WineD3DDevice, pWineCaps); + hrc = wined3d_device_get_device_caps(This->wined3d_device, pWineCaps); wined3d_mutex_unlock(); fixup_caps(pWineCaps); @@ -428,14 +430,16 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetDeviceCaps(LPDIRECT3DDEVICE8 iface return hrc; } -static HRESULT WINAPI IDirect3DDevice8Impl_GetDisplayMode(LPDIRECT3DDEVICE8 iface, D3DDISPLAYMODE* pMode) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_GetDisplayMode(IDirect3DDevice8 *iface, + D3DDISPLAYMODE *pMode) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); HRESULT hr; TRACE("iface %p, mode %p.\n", iface, pMode); wined3d_mutex_lock(); - hr = IWineD3DDevice_GetDisplayMode(This->WineD3DDevice, 0, (WINED3DDISPLAYMODE *) pMode); + hr = wined3d_device_get_display_mode(This->wined3d_device, 0, (WINED3DDISPLAYMODE *)pMode); wined3d_mutex_unlock(); if (SUCCEEDED(hr)) pMode->Format = d3dformat_from_wined3dformat(pMode->Format); @@ -443,58 +447,67 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetDisplayMode(LPDIRECT3DDEVICE8 ifac return hr; } -static HRESULT WINAPI IDirect3DDevice8Impl_GetCreationParameters(LPDIRECT3DDEVICE8 iface, D3DDEVICE_CREATION_PARAMETERS *pParameters) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_GetCreationParameters(IDirect3DDevice8 *iface, + D3DDEVICE_CREATION_PARAMETERS *pParameters) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); HRESULT hr; TRACE("iface %p, parameters %p.\n", iface, pParameters); wined3d_mutex_lock(); - hr = IWineD3DDevice_GetCreationParameters(This->WineD3DDevice, (WINED3DDEVICE_CREATION_PARAMETERS *) pParameters); + hr = wined3d_device_get_creation_parameters(This->wined3d_device, + (WINED3DDEVICE_CREATION_PARAMETERS *)pParameters); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice8Impl_SetCursorProperties(LPDIRECT3DDEVICE8 iface, UINT XHotSpot, UINT YHotSpot, IDirect3DSurface8* pCursorBitmap) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_SetCursorProperties(IDirect3DDevice8 *iface, + UINT XHotSpot, UINT YHotSpot, IDirect3DSurface8 *pCursorBitmap) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); IDirect3DSurface8Impl *pSurface = (IDirect3DSurface8Impl*)pCursorBitmap; HRESULT hr; TRACE("iface %p, hotspot_x %u, hotspot_y %u, bitmap %p.\n", iface, XHotSpot, YHotSpot, pCursorBitmap); - if(!pCursorBitmap) { - WARN("No cursor bitmap, returning WINED3DERR_INVALIDCALL\n"); - return WINED3DERR_INVALIDCALL; + if (!pCursorBitmap) + { + WARN("No cursor bitmap, returning D3DERR_INVALIDCALL.\n"); + return D3DERR_INVALIDCALL; } wined3d_mutex_lock(); - hr = IWineD3DDevice_SetCursorProperties(This->WineD3DDevice,XHotSpot,YHotSpot,pSurface->wineD3DSurface); + hr = wined3d_device_set_cursor_properties(This->wined3d_device, XHotSpot, YHotSpot, pSurface->wined3d_surface); wined3d_mutex_unlock(); return hr; } -static void WINAPI IDirect3DDevice8Impl_SetCursorPosition(LPDIRECT3DDEVICE8 iface, UINT XScreenSpace, UINT YScreenSpace, DWORD Flags) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static void WINAPI IDirect3DDevice8Impl_SetCursorPosition(IDirect3DDevice8 *iface, + UINT XScreenSpace, UINT YScreenSpace, DWORD Flags) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); TRACE("iface %p, x %u, y %u, flags %#x.\n", iface, XScreenSpace, YScreenSpace, Flags); wined3d_mutex_lock(); - IWineD3DDevice_SetCursorPosition(This->WineD3DDevice, XScreenSpace, YScreenSpace, Flags); + wined3d_device_set_cursor_position(This->wined3d_device, XScreenSpace, YScreenSpace, Flags); wined3d_mutex_unlock(); } -static BOOL WINAPI IDirect3DDevice8Impl_ShowCursor(LPDIRECT3DDEVICE8 iface, BOOL bShow) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static BOOL WINAPI IDirect3DDevice8Impl_ShowCursor(IDirect3DDevice8 *iface, BOOL bShow) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); BOOL ret; TRACE("iface %p, show %#x.\n", iface, bShow); wined3d_mutex_lock(); - ret = IWineD3DDevice_ShowCursor(This->WineD3DDevice, bShow); + ret = wined3d_device_show_cursor(This->wined3d_device, bShow); wined3d_mutex_unlock(); return ret; @@ -503,7 +516,7 @@ static BOOL WINAPI IDirect3DDevice8Impl_ShowCursor(LPDIRECT3DDEVICE8 iface, BOOL static HRESULT WINAPI IDirect3DDevice8Impl_CreateAdditionalSwapChain(IDirect3DDevice8 *iface, D3DPRESENT_PARAMETERS *present_parameters, IDirect3DSwapChain8 **swapchain) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); IDirect3DSwapChain8Impl *object; HRESULT hr; @@ -526,18 +539,76 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateAdditionalSwapChain(IDirect3DDe } TRACE("Created swapchain %p.\n", object); - *swapchain = (IDirect3DSwapChain8 *)object; + *swapchain = &object->IDirect3DSwapChain8_iface; return D3D_OK; } -static HRESULT WINAPI IDirect3DDevice8Impl_Reset(LPDIRECT3DDEVICE8 iface, D3DPRESENT_PARAMETERS* pPresentationParameters) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI reset_enum_callback(struct wined3d_resource *resource, void *data) +{ + struct wined3d_resource_desc desc; + BOOL *resources_ok = data; + + wined3d_resource_get_desc(resource, &desc); + if (desc.pool == WINED3DPOOL_DEFAULT) + { + IDirect3DSurface8 *surface; + + if (desc.resource_type != WINED3DRTYPE_SURFACE) + { + WARN("Resource %p in pool D3DPOOL_DEFAULT blocks the Reset call.\n", resource); + *resources_ok = FALSE; + return S_FALSE; + } + + surface = wined3d_resource_get_parent(resource); + + IDirect3DSurface8_AddRef(surface); + if (IDirect3DSurface8_Release(surface)) + { + WARN("Surface %p (resource %p) in pool D3DPOOL_DEFAULT blocks the Reset call.\n", surface, resource); + *resources_ok = FALSE; + return S_FALSE; + } + + WARN("Surface %p (resource %p) is an implicit resource with ref 0.\n", surface, resource); + } + + return S_OK; +} + +static HRESULT WINAPI IDirect3DDevice8Impl_Reset(IDirect3DDevice8 *iface, + D3DPRESENT_PARAMETERS *pPresentationParameters) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); WINED3DPRESENT_PARAMETERS localParameters; + BOOL resources_ok = TRUE; HRESULT hr; + UINT i; TRACE("iface %p, present_parameters %p.\n", iface, pPresentationParameters); + wined3d_mutex_lock(); + wined3d_device_set_index_buffer(This->wined3d_device, NULL, WINED3DFMT_UNKNOWN); + for (i = 0; i < 16; ++i) + { + wined3d_device_set_stream_source(This->wined3d_device, i, NULL, 0, 0); + } + for (i = 0; i < 16; ++i) + { + wined3d_device_set_texture(This->wined3d_device, i, NULL); + } + + wined3d_device_enum_resources(This->wined3d_device, reset_enum_callback, &resources_ok); + if (!resources_ok) + { + WARN("The application is holding D3DPOOL_DEFAULT resources, rejecting reset.\n"); + This->lost = TRUE; + wined3d_mutex_unlock(); + + return D3DERR_DEVICELOST; + } + localParameters.BackBufferWidth = pPresentationParameters->BackBufferWidth; localParameters.BackBufferHeight = pPresentationParameters->BackBufferHeight; localParameters.BackBufferFormat = wined3dformat_from_d3dformat(pPresentationParameters->BackBufferFormat); @@ -554,10 +625,15 @@ static HRESULT WINAPI IDirect3DDevice8Impl_Reset(LPDIRECT3DDEVICE8 iface, D3DPRE localParameters.PresentationInterval = pPresentationParameters->FullScreen_PresentationInterval; localParameters.AutoRestoreDisplayMode = TRUE; - wined3d_mutex_lock(); - hr = IWineD3DDevice_Reset(This->WineD3DDevice, &localParameters); - if(SUCCEEDED(hr)) { - hr = IWineD3DDevice_SetRenderState(This->WineD3DDevice, WINED3DRS_POINTSIZE_MIN, 0); + hr = wined3d_device_reset(This->wined3d_device, &localParameters); + if (SUCCEEDED(hr)) + { + hr = wined3d_device_set_render_state(This->wined3d_device, WINED3DRS_POINTSIZE_MIN, 0); + This->lost = FALSE; + } + else + { + This->lost = TRUE; } wined3d_mutex_unlock(); @@ -578,15 +654,17 @@ static HRESULT WINAPI IDirect3DDevice8Impl_Reset(LPDIRECT3DDEVICE8 iface, D3DPRE return hr; } -static HRESULT WINAPI IDirect3DDevice8Impl_Present(LPDIRECT3DDEVICE8 iface, CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_Present(IDirect3DDevice8 *iface, const RECT *pSourceRect, + const RECT *pDestRect, HWND hDestWindowOverride, const RGNDATA *pDirtyRegion) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); HRESULT hr; TRACE("iface %p, src_rect %p, dst_rect %p, dst_window_override %p, dirty_region %p.\n", iface, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion); wined3d_mutex_lock(); - hr = IWineD3DDevice_Present(This->WineD3DDevice, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion); + hr = wined3d_device_present(This->wined3d_device, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion); wined3d_mutex_unlock(); return hr; @@ -595,58 +673,64 @@ static HRESULT WINAPI IDirect3DDevice8Impl_Present(LPDIRECT3DDEVICE8 iface, CONS static HRESULT WINAPI IDirect3DDevice8Impl_GetBackBuffer(IDirect3DDevice8 *iface, UINT BackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface8 **ppBackBuffer) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; - IWineD3DSurface *retSurface = NULL; + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); + struct wined3d_surface *wined3d_surface = NULL; HRESULT hr; TRACE("iface %p, backbuffer_idx %u, backbuffer_type %#x, backbuffer %p.\n", iface, BackBuffer, Type, ppBackBuffer); wined3d_mutex_lock(); - hr = IWineD3DDevice_GetBackBuffer(This->WineD3DDevice, 0, BackBuffer, (WINED3DBACKBUFFER_TYPE)Type, &retSurface); - if (SUCCEEDED(hr) && retSurface && ppBackBuffer) + hr = wined3d_device_get_back_buffer(This->wined3d_device, 0, + BackBuffer, (WINED3DBACKBUFFER_TYPE)Type, &wined3d_surface); + if (SUCCEEDED(hr) && wined3d_surface && ppBackBuffer) { - *ppBackBuffer = IWineD3DSurface_GetParent(retSurface); + *ppBackBuffer = wined3d_surface_get_parent(wined3d_surface); IDirect3DSurface8_AddRef(*ppBackBuffer); - IWineD3DSurface_Release(retSurface); + wined3d_surface_decref(wined3d_surface); } wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice8Impl_GetRasterStatus(LPDIRECT3DDEVICE8 iface, D3DRASTER_STATUS* pRasterStatus) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_GetRasterStatus(IDirect3DDevice8 *iface, + D3DRASTER_STATUS *pRasterStatus) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); HRESULT hr; TRACE("iface %p, raster_status %p.\n", iface, pRasterStatus); wined3d_mutex_lock(); - hr = IWineD3DDevice_GetRasterStatus(This->WineD3DDevice, 0, (WINED3DRASTER_STATUS *) pRasterStatus); + hr = wined3d_device_get_raster_status(This->wined3d_device, 0, (WINED3DRASTER_STATUS *)pRasterStatus); wined3d_mutex_unlock(); return hr; } -static void WINAPI IDirect3DDevice8Impl_SetGammaRamp(LPDIRECT3DDEVICE8 iface, DWORD Flags, CONST D3DGAMMARAMP* pRamp) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static void WINAPI IDirect3DDevice8Impl_SetGammaRamp(IDirect3DDevice8 *iface, DWORD Flags, + const D3DGAMMARAMP *pRamp) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); TRACE("iface %p, flags %#x, ramp %p.\n", iface, Flags, pRamp); /* Note: D3DGAMMARAMP is compatible with WINED3DGAMMARAMP */ wined3d_mutex_lock(); - IWineD3DDevice_SetGammaRamp(This->WineD3DDevice, 0, Flags, (CONST WINED3DGAMMARAMP *) pRamp); + wined3d_device_set_gamma_ramp(This->wined3d_device, 0, Flags, (const WINED3DGAMMARAMP *)pRamp); wined3d_mutex_unlock(); } -static void WINAPI IDirect3DDevice8Impl_GetGammaRamp(LPDIRECT3DDEVICE8 iface, D3DGAMMARAMP* pRamp) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static void WINAPI IDirect3DDevice8Impl_GetGammaRamp(IDirect3DDevice8 *iface, D3DGAMMARAMP *pRamp) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); TRACE("iface %p, ramp %p.\n", iface, pRamp); /* Note: D3DGAMMARAMP is compatible with WINED3DGAMMARAMP */ wined3d_mutex_lock(); - IWineD3DDevice_GetGammaRamp(This->WineD3DDevice, 0, (WINED3DGAMMARAMP *) pRamp); + wined3d_device_get_gamma_ramp(This->wined3d_device, 0, (WINED3DGAMMARAMP *)pRamp); wined3d_mutex_unlock(); } @@ -654,7 +738,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateTexture(IDirect3DDevice8 *iface UINT width, UINT height, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool, IDirect3DTexture8 **texture) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); IDirect3DTexture8Impl *object; HRESULT hr; @@ -677,7 +761,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateTexture(IDirect3DDevice8 *iface } TRACE("Created texture %p.\n", object); - *texture = (IDirect3DTexture8 *)object; + *texture = &object->IDirect3DTexture8_iface; return D3D_OK; } @@ -686,7 +770,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateVolumeTexture(IDirect3DDevice8 UINT width, UINT height, UINT depth, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool, IDirect3DVolumeTexture8 **texture) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); IDirect3DVolumeTexture8Impl *object; HRESULT hr; @@ -709,7 +793,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateVolumeTexture(IDirect3DDevice8 } TRACE("Created volume texture %p.\n", object); - *texture = (IDirect3DVolumeTexture8 *)object; + *texture = &object->IDirect3DVolumeTexture8_iface; return D3D_OK; } @@ -717,7 +801,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateVolumeTexture(IDirect3DDevice8 static HRESULT WINAPI IDirect3DDevice8Impl_CreateCubeTexture(IDirect3DDevice8 *iface, UINT edge_length, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool, IDirect3DCubeTexture8 **texture) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); IDirect3DCubeTexture8Impl *object; HRESULT hr; @@ -740,15 +824,15 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateCubeTexture(IDirect3DDevice8 *i } TRACE("Created cube texture %p.\n", object); - *texture = (IDirect3DCubeTexture8 *)object; + *texture = &object->IDirect3DCubeTexture8_iface; return hr; } -static HRESULT WINAPI IDirect3DDevice8Impl_CreateVertexBuffer(IDirect3DDevice8 *iface, UINT size, DWORD usage, - DWORD fvf, D3DPOOL pool, IDirect3DVertexBuffer8 **buffer) +static HRESULT WINAPI IDirect3DDevice8Impl_CreateVertexBuffer(IDirect3DDevice8 *iface, UINT size, + DWORD usage, DWORD fvf, D3DPOOL pool, IDirect3DVertexBuffer8 **buffer) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); IDirect3DVertexBuffer8Impl *object; HRESULT hr; @@ -776,10 +860,10 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateVertexBuffer(IDirect3DDevice8 * return D3D_OK; } -static HRESULT WINAPI IDirect3DDevice8Impl_CreateIndexBuffer(IDirect3DDevice8 *iface, UINT size, DWORD usage, - D3DFORMAT format, D3DPOOL pool, IDirect3DIndexBuffer8 **buffer) +static HRESULT WINAPI IDirect3DDevice8Impl_CreateIndexBuffer(IDirect3DDevice8 *iface, UINT size, + DWORD usage, D3DFORMAT format, D3DPOOL pool, IDirect3DIndexBuffer8 **buffer) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); IDirect3DIndexBuffer8Impl *object; HRESULT hr; @@ -807,17 +891,17 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateIndexBuffer(IDirect3DDevice8 *i return D3D_OK; } -static HRESULT IDirect3DDevice8Impl_CreateSurface(LPDIRECT3DDEVICE8 iface, UINT Width, UINT Height, - D3DFORMAT Format, BOOL Lockable, BOOL Discard, UINT Level, IDirect3DSurface8 **ppSurface, - UINT Usage, D3DPOOL Pool, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality) +static HRESULT IDirect3DDevice8Impl_CreateSurface(IDirect3DDevice8Impl *device, UINT Width, + UINT Height, D3DFORMAT Format, BOOL Lockable, BOOL Discard, UINT Level, + IDirect3DSurface8 **ppSurface, UINT Usage, D3DPOOL Pool, D3DMULTISAMPLE_TYPE MultiSample, + DWORD MultisampleQuality) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; IDirect3DSurface8Impl *object; HRESULT hr; - TRACE("iface %p, width %u, height %u, format %#x, lockable %#x, discard %#x, level %u, surface %p,\n" + TRACE("device %p, width %u, height %u, format %#x, lockable %#x, discard %#x, level %u, surface %p,\n" "\tusage %#x, pool %#x, multisample_type %#x, multisample_quality %u.\n", - iface, Width, Height, Format, Lockable, Discard, Level, ppSurface, + device, Width, Height, Format, Lockable, Discard, Level, ppSurface, Usage, Pool, MultiSample, MultisampleQuality); object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DSurface8Impl)); @@ -827,8 +911,8 @@ static HRESULT IDirect3DDevice8Impl_CreateSurface(LPDIRECT3DDEVICE8 iface, UINT return D3DERR_OUTOFVIDEOMEMORY; } - hr = surface_init(object, This, Width, Height, Format, Lockable, Discard, - Level, Usage, Pool, MultiSample, MultisampleQuality); + hr = surface_init(object, device, Width, Height, Format, Lockable, Discard, Level, Usage, + Pool, MultiSample, MultisampleQuality); if (FAILED(hr)) { WARN("Failed to initialize surface, hr %#x.\n", hr); @@ -842,52 +926,66 @@ static HRESULT IDirect3DDevice8Impl_CreateSurface(LPDIRECT3DDEVICE8 iface, UINT return D3D_OK; } -static HRESULT WINAPI IDirect3DDevice8Impl_CreateRenderTarget(LPDIRECT3DDEVICE8 iface, UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, BOOL Lockable, IDirect3DSurface8** ppSurface) { +static HRESULT WINAPI IDirect3DDevice8Impl_CreateRenderTarget(IDirect3DDevice8 *iface, UINT Width, + UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, BOOL Lockable, + IDirect3DSurface8 **ppSurface) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); HRESULT hr; TRACE("iface %p, width %u, height %u, format %#x, multisample_type %#x, lockable %#x, surface %p.\n", iface, Width, Height, Format, MultiSample, Lockable, ppSurface); - hr = IDirect3DDevice8Impl_CreateSurface(iface, Width, Height, Format, Lockable, FALSE /* Discard */, - 0 /* Level */, ppSurface, D3DUSAGE_RENDERTARGET, D3DPOOL_DEFAULT, MultiSample, 0); + hr = IDirect3DDevice8Impl_CreateSurface(This, Width, Height, Format, Lockable, + FALSE /* Discard */, 0 /* Level */, ppSurface, D3DUSAGE_RENDERTARGET, D3DPOOL_DEFAULT, + MultiSample, 0); return hr; } -static HRESULT WINAPI IDirect3DDevice8Impl_CreateDepthStencilSurface(LPDIRECT3DDEVICE8 iface, UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, IDirect3DSurface8** ppSurface) { +static HRESULT WINAPI IDirect3DDevice8Impl_CreateDepthStencilSurface(IDirect3DDevice8 *iface, + UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, + IDirect3DSurface8 **ppSurface) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); HRESULT hr; TRACE("iface %p, width %u, height %u, format %#x, multisample_type %#x, surface %p.\n", iface, Width, Height, Format, MultiSample, ppSurface); /* TODO: Verify that Discard is false */ - hr = IDirect3DDevice8Impl_CreateSurface(iface, Width, Height, Format, TRUE /* Lockable */, FALSE, + hr = IDirect3DDevice8Impl_CreateSurface(This, Width, Height, Format, TRUE /* Lockable */, FALSE, 0 /* Level */, ppSurface, D3DUSAGE_DEPTHSTENCIL, D3DPOOL_DEFAULT, MultiSample, 0); return hr; } /* IDirect3DDevice8Impl::CreateImageSurface returns surface with pool type SYSTEMMEM */ -static HRESULT WINAPI IDirect3DDevice8Impl_CreateImageSurface(LPDIRECT3DDEVICE8 iface, UINT Width, UINT Height, D3DFORMAT Format, IDirect3DSurface8** ppSurface) { +static HRESULT WINAPI IDirect3DDevice8Impl_CreateImageSurface(IDirect3DDevice8 *iface, UINT Width, + UINT Height, D3DFORMAT Format, IDirect3DSurface8 **ppSurface) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); HRESULT hr; TRACE("iface %p, width %u, height %u, format %#x, surface %p.\n", iface, Width, Height, Format, ppSurface); - hr = IDirect3DDevice8Impl_CreateSurface(iface, Width, Height, Format, TRUE /* Lockable */, FALSE /* Discard */, - 0 /* Level */, ppSurface, 0 /* Usage (undefined/none) */, D3DPOOL_SYSTEMMEM, D3DMULTISAMPLE_NONE, - 0 /* MultisampleQuality */); + hr = IDirect3DDevice8Impl_CreateSurface(This, Width, Height, Format, TRUE /* Lockable */, + FALSE /* Discard */, 0 /* Level */, ppSurface, 0 /* Usage (undefined/none) */, + D3DPOOL_SYSTEMMEM, D3DMULTISAMPLE_NONE, 0 /* MultisampleQuality */); return hr; } -static HRESULT WINAPI IDirect3DDevice8Impl_CopyRects(LPDIRECT3DDEVICE8 iface, IDirect3DSurface8 *pSourceSurface, CONST RECT *pSourceRects, UINT cRects, IDirect3DSurface8 *pDestinationSurface, CONST POINT *pDestPoints) { +static HRESULT WINAPI IDirect3DDevice8Impl_CopyRects(IDirect3DDevice8 *iface, + IDirect3DSurface8 *pSourceSurface, const RECT *pSourceRects, UINT cRects, + IDirect3DSurface8 *pDestinationSurface, const POINT *pDestPoints) +{ IDirect3DSurface8Impl *Source = (IDirect3DSurface8Impl *) pSourceSurface; IDirect3DSurface8Impl *Dest = (IDirect3DSurface8Impl *) pDestinationSurface; - - HRESULT hr = WINED3D_OK; enum wined3d_format_id srcFormat, destFormat; - WINED3DSURFACE_DESC winedesc; + struct wined3d_resource_desc wined3d_desc; + struct wined3d_resource *wined3d_resource; TRACE("iface %p, src_surface %p, src_rects %p, rect_count %u, dst_surface %p, dst_points %p.\n", iface, pSourceSurface, pSourceRects, cRects, pDestinationSurface, pDestPoints); @@ -896,58 +994,81 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CopyRects(LPDIRECT3DDEVICE8 iface, ID * destination texture is in WINED3DPOOL_DEFAULT. */ wined3d_mutex_lock(); - IWineD3DSurface_GetDesc(Source->wineD3DSurface, &winedesc); - srcFormat = winedesc.format; + wined3d_resource = wined3d_surface_get_resource(Source->wined3d_surface); + wined3d_resource_get_desc(wined3d_resource, &wined3d_desc); + srcFormat = wined3d_desc.format; - IWineD3DSurface_GetDesc(Dest->wineD3DSurface, &winedesc); - destFormat = winedesc.format; + wined3d_resource = wined3d_surface_get_resource(Dest->wined3d_surface); + wined3d_resource_get_desc(wined3d_resource, &wined3d_desc); + destFormat = wined3d_desc.format; /* Check that the source and destination formats match */ - if (srcFormat != destFormat && WINED3DFMT_UNKNOWN != destFormat) { - WARN("(%p) source %p format must match the dest %p format, returning WINED3DERR_INVALIDCALL\n", iface, pSourceSurface, pDestinationSurface); + if (srcFormat != destFormat && WINED3DFMT_UNKNOWN != destFormat) + { + WARN("Source %p format must match the dest %p format, returning D3DERR_INVALIDCALL.\n", + pSourceSurface, pDestinationSurface); wined3d_mutex_unlock(); - return WINED3DERR_INVALIDCALL; - } else if (WINED3DFMT_UNKNOWN == destFormat) { + return D3DERR_INVALIDCALL; + } + else if (WINED3DFMT_UNKNOWN == destFormat) + { TRACE("(%p) : Converting destination surface from WINED3DFMT_UNKNOWN to the source format\n", iface); - IWineD3DSurface_SetFormat(Dest->wineD3DSurface, srcFormat); + wined3d_surface_set_format(Dest->wined3d_surface, srcFormat); } /* Quick if complete copy ... */ - if (cRects == 0 && pSourceRects == NULL && pDestPoints == NULL) { - IWineD3DSurface_BltFast(Dest->wineD3DSurface, 0, 0, Source->wineD3DSurface, NULL, WINEDDBLTFAST_NOCOLORKEY); - } else { + if (!cRects && !pSourceRects && !pDestPoints) + { + wined3d_surface_bltfast(Dest->wined3d_surface, 0, 0, + Source->wined3d_surface, NULL, WINEDDBLTFAST_NOCOLORKEY); + } + else + { unsigned int i; /* Copy rect by rect */ - if (NULL != pSourceRects && NULL != pDestPoints) { - for (i = 0; i < cRects; ++i) { - IWineD3DSurface_BltFast(Dest->wineD3DSurface, pDestPoints[i].x, pDestPoints[i].y, Source->wineD3DSurface, &pSourceRects[i], WINEDDBLTFAST_NOCOLORKEY); + if (pSourceRects && pDestPoints) + { + for (i = 0; i < cRects; ++i) + { + wined3d_surface_bltfast(Dest->wined3d_surface, pDestPoints[i].x, pDestPoints[i].y, + Source->wined3d_surface, &pSourceRects[i], WINEDDBLTFAST_NOCOLORKEY); } - } else { - for (i = 0; i < cRects; ++i) { - IWineD3DSurface_BltFast(Dest->wineD3DSurface, 0, 0, Source->wineD3DSurface, &pSourceRects[i], WINEDDBLTFAST_NOCOLORKEY); + } + else + { + for (i = 0; i < cRects; ++i) + { + wined3d_surface_bltfast(Dest->wined3d_surface, 0, 0, + Source->wined3d_surface, &pSourceRects[i], WINEDDBLTFAST_NOCOLORKEY); } } } wined3d_mutex_unlock(); - return hr; + return WINED3D_OK; } -static HRESULT WINAPI IDirect3DDevice8Impl_UpdateTexture(LPDIRECT3DDEVICE8 iface, IDirect3DBaseTexture8* pSourceTexture, IDirect3DBaseTexture8* pDestinationTexture) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_UpdateTexture(IDirect3DDevice8 *iface, + IDirect3DBaseTexture8 *src_texture, IDirect3DBaseTexture8 *dst_texture) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); HRESULT hr; - TRACE("iface %p, src_texture %p, dst_texture %p.\n", iface, pSourceTexture, pDestinationTexture); + TRACE("iface %p, src_texture %p, dst_texture %p.\n", iface, src_texture, dst_texture); wined3d_mutex_lock(); - hr = IWineD3DDevice_UpdateTexture(This->WineD3DDevice, ((IDirect3DBaseTexture8Impl *)pSourceTexture)->wineD3DBaseTexture, ((IDirect3DBaseTexture8Impl *)pDestinationTexture)->wineD3DBaseTexture); + hr = wined3d_device_update_texture(This->wined3d_device, + ((IDirect3DBaseTexture8Impl *)src_texture)->wined3d_texture, + ((IDirect3DBaseTexture8Impl *)dst_texture)->wined3d_texture); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice8Impl_GetFrontBuffer(LPDIRECT3DDEVICE8 iface, IDirect3DSurface8* pDestSurface) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_GetFrontBuffer(IDirect3DDevice8 *iface, + IDirect3DSurface8 *pDestSurface) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); IDirect3DSurface8Impl *destSurface = (IDirect3DSurface8Impl *)pDestSurface; HRESULT hr; @@ -959,32 +1080,70 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetFrontBuffer(LPDIRECT3DDEVICE8 ifac } wined3d_mutex_lock(); - hr = IWineD3DDevice_GetFrontBufferData(This->WineD3DDevice, 0, destSurface->wineD3DSurface); + hr = wined3d_device_get_front_buffer_data(This->wined3d_device, 0, destSurface->wined3d_surface); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice8Impl_SetRenderTarget(LPDIRECT3DDEVICE8 iface, IDirect3DSurface8* pRenderTarget, IDirect3DSurface8* pNewZStencil) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_SetRenderTarget(IDirect3DDevice8 *iface, + IDirect3DSurface8 *pRenderTarget, IDirect3DSurface8 *pNewZStencil) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); IDirect3DSurface8Impl *pSurface = (IDirect3DSurface8Impl *)pRenderTarget; IDirect3DSurface8Impl *pZSurface = (IDirect3DSurface8Impl *)pNewZStencil; - IWineD3DSurface *original_ds = NULL; + struct wined3d_surface *original_ds = NULL; HRESULT hr; TRACE("iface %p, render_target %p, depth_stencil %p.\n", iface, pRenderTarget, pNewZStencil); wined3d_mutex_lock(); - hr = IWineD3DDevice_GetDepthStencilSurface(This->WineD3DDevice, &original_ds); + if (pZSurface) + { + struct wined3d_resource_desc ds_desc, rt_desc; + struct wined3d_resource *wined3d_resource; + IDirect3DSurface8 *orig_rt = NULL; + + /* If no render target is passed in check the size against the current RT */ + if (!pRenderTarget) + { + hr = IDirect3DDevice8_GetRenderTarget(iface, &orig_rt); + if (FAILED(hr)) + { + wined3d_mutex_unlock(); + return hr; + } + pSurface = (IDirect3DSurface8Impl *)orig_rt; + } + + wined3d_resource = wined3d_surface_get_resource(pZSurface->wined3d_surface); + wined3d_resource_get_desc(wined3d_resource, &ds_desc); + wined3d_resource = wined3d_surface_get_resource(pSurface->wined3d_surface); + wined3d_resource_get_desc(wined3d_resource, &rt_desc); + if (orig_rt) IDirect3DSurface8_Release(orig_rt); + + if (ds_desc.width < rt_desc.width || ds_desc.height < rt_desc.height) + { + WARN("Depth stencil is smaller than the render target, returning D3DERR_INVALIDCALL\n"); + wined3d_mutex_unlock(); + return D3DERR_INVALIDCALL; + } + } + + hr = wined3d_device_get_depth_stencil(This->wined3d_device, &original_ds); if (hr == WINED3D_OK || hr == WINED3DERR_NOTFOUND) { - hr = IWineD3DDevice_SetDepthStencilSurface(This->WineD3DDevice, pZSurface ? pZSurface->wineD3DSurface : NULL); - if (SUCCEEDED(hr) && pSurface) - hr = IWineD3DDevice_SetRenderTarget(This->WineD3DDevice, 0, pSurface->wineD3DSurface, TRUE); - if (FAILED(hr)) IWineD3DDevice_SetDepthStencilSurface(This->WineD3DDevice, original_ds); + hr = wined3d_device_set_depth_stencil(This->wined3d_device, pZSurface ? pZSurface->wined3d_surface : NULL); + if (SUCCEEDED(hr) && pRenderTarget) + { + hr = wined3d_device_set_render_target(This->wined3d_device, 0, pSurface->wined3d_surface, TRUE); + if (FAILED(hr)) + wined3d_device_set_depth_stencil(This->wined3d_device, original_ds); + } } - if (original_ds) IWineD3DSurface_Release(original_ds); + if (original_ds) + wined3d_surface_decref(original_ds); wined3d_mutex_unlock(); @@ -994,8 +1153,8 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetRenderTarget(LPDIRECT3DDEVICE8 ifa static HRESULT WINAPI IDirect3DDevice8Impl_GetRenderTarget(IDirect3DDevice8 *iface, IDirect3DSurface8 **ppRenderTarget) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; - IWineD3DSurface *pRenderTarget; + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); + struct wined3d_surface *wined3d_surface; HRESULT hr; TRACE("iface %p, render_target %p.\n", iface, ppRenderTarget); @@ -1005,12 +1164,12 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetRenderTarget(IDirect3DDevice8 *ifa } wined3d_mutex_lock(); - hr = IWineD3DDevice_GetRenderTarget(This->WineD3DDevice, 0, &pRenderTarget); - if (SUCCEEDED(hr) && pRenderTarget) + hr = wined3d_device_get_render_target(This->wined3d_device, 0, &wined3d_surface); + if (SUCCEEDED(hr) && wined3d_surface) { - *ppRenderTarget = IWineD3DSurface_GetParent(pRenderTarget); + *ppRenderTarget = wined3d_surface_get_parent(wined3d_surface); IDirect3DSurface8_AddRef(*ppRenderTarget); - IWineD3DSurface_Release(pRenderTarget); + wined3d_surface_decref(wined3d_surface); } else { @@ -1025,8 +1184,8 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetRenderTarget(IDirect3DDevice8 *ifa static HRESULT WINAPI IDirect3DDevice8Impl_GetDepthStencilSurface(IDirect3DDevice8 *iface, IDirect3DSurface8 **ppZStencilSurface) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; - IWineD3DSurface *pZStencilSurface; + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); + struct wined3d_surface *wined3d_surface; HRESULT hr; TRACE("iface %p, depth_stencil %p.\n", iface, ppZStencilSurface); @@ -1036,12 +1195,12 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetDepthStencilSurface(IDirect3DDevic } wined3d_mutex_lock(); - hr = IWineD3DDevice_GetDepthStencilSurface(This->WineD3DDevice, &pZStencilSurface); + hr = wined3d_device_get_depth_stencil(This->wined3d_device, &wined3d_surface); if (SUCCEEDED(hr)) { - *ppZStencilSurface = IWineD3DSurface_GetParent(pZStencilSurface); + *ppZStencilSurface = wined3d_surface_get_parent(wined3d_surface); IDirect3DSurface8_AddRef(*ppZStencilSurface); - IWineD3DSurface_Release(pZStencilSurface); + wined3d_surface_decref(wined3d_surface); } else { @@ -1054,266 +1213,336 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetDepthStencilSurface(IDirect3DDevic return hr; } -static HRESULT WINAPI IDirect3DDevice8Impl_BeginScene(LPDIRECT3DDEVICE8 iface) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_BeginScene(IDirect3DDevice8 *iface) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); HRESULT hr; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - hr = IWineD3DDevice_BeginScene(This->WineD3DDevice); + hr = wined3d_device_begin_scene(This->wined3d_device); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDevice8Impl_EndScene(LPDIRECT3DDEVICE8 iface) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDevice8Impl_EndScene(IDirect3DDevice8 *iface) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); HRESULT hr; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - hr = IWineD3DDevice_EndScene(This->WineD3DDevice); + hr = wined3d_device_end_scene(This->wined3d_device); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice8Impl_Clear(LPDIRECT3DDEVICE8 iface, DWORD Count, CONST D3DRECT* pRects, DWORD Flags, D3DCOLOR Color, float Z, DWORD Stencil) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_Clear(IDirect3DDevice8 *iface, DWORD Count, + const D3DRECT *pRects, DWORD Flags, D3DCOLOR Color, float Z, DWORD Stencil) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); HRESULT hr; TRACE("iface %p, rect_count %u, rects %p, flags %#x, color 0x%08x, z %.8e, stencil %u.\n", iface, Count, pRects, Flags, Color, Z, Stencil); wined3d_mutex_lock(); - hr = IWineD3DDevice_Clear(This->WineD3DDevice, Count, (const RECT *)pRects, Flags, Color, Z, Stencil); + hr = wined3d_device_clear(This->wined3d_device, Count, (const RECT *)pRects, Flags, Color, Z, Stencil); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice8Impl_SetTransform(LPDIRECT3DDEVICE8 iface, D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX* lpMatrix) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_SetTransform(IDirect3DDevice8 *iface, + D3DTRANSFORMSTATETYPE State, const D3DMATRIX *lpMatrix) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); HRESULT hr; TRACE("iface %p, state %#x, matrix %p.\n", iface, State, lpMatrix); /* Note: D3DMATRIX is compatible with WINED3DMATRIX */ wined3d_mutex_lock(); - hr = IWineD3DDevice_SetTransform(This->WineD3DDevice, State, (CONST WINED3DMATRIX*) lpMatrix); + hr = wined3d_device_set_transform(This->wined3d_device, State, (const WINED3DMATRIX *)lpMatrix); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice8Impl_GetTransform(LPDIRECT3DDEVICE8 iface, D3DTRANSFORMSTATETYPE State,D3DMATRIX* pMatrix) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_GetTransform(IDirect3DDevice8 *iface, + D3DTRANSFORMSTATETYPE State, D3DMATRIX *pMatrix) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); HRESULT hr; TRACE("iface %p, state %#x, matrix %p.\n", iface, State, pMatrix); /* Note: D3DMATRIX is compatible with WINED3DMATRIX */ wined3d_mutex_lock(); - hr = IWineD3DDevice_GetTransform(This->WineD3DDevice, State, (WINED3DMATRIX*) pMatrix); + hr = wined3d_device_get_transform(This->wined3d_device, State, (WINED3DMATRIX *)pMatrix); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice8Impl_MultiplyTransform(LPDIRECT3DDEVICE8 iface, D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX* pMatrix) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_MultiplyTransform(IDirect3DDevice8 *iface, + D3DTRANSFORMSTATETYPE State, const D3DMATRIX *pMatrix) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); HRESULT hr; TRACE("iface %p, state %#x, matrix %p.\n", iface, State, pMatrix); /* Note: D3DMATRIX is compatible with WINED3DMATRIX */ wined3d_mutex_lock(); - hr = IWineD3DDevice_MultiplyTransform(This->WineD3DDevice, State, (CONST WINED3DMATRIX*) pMatrix); + hr = wined3d_device_multiply_transform(This->wined3d_device, State, (const WINED3DMATRIX *)pMatrix); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice8Impl_SetViewport(LPDIRECT3DDEVICE8 iface, CONST D3DVIEWPORT8* pViewport) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_SetViewport(IDirect3DDevice8 *iface, + const D3DVIEWPORT8 *pViewport) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); HRESULT hr; TRACE("iface %p, viewport %p.\n", iface, pViewport); /* Note: D3DVIEWPORT8 is compatible with WINED3DVIEWPORT */ wined3d_mutex_lock(); - hr = IWineD3DDevice_SetViewport(This->WineD3DDevice, (const WINED3DVIEWPORT *)pViewport); + hr = wined3d_device_set_viewport(This->wined3d_device, (const WINED3DVIEWPORT *)pViewport); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice8Impl_GetViewport(LPDIRECT3DDEVICE8 iface, D3DVIEWPORT8* pViewport) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_GetViewport(IDirect3DDevice8 *iface, + D3DVIEWPORT8 *pViewport) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); HRESULT hr; TRACE("iface %p, viewport %p.\n", iface, pViewport); /* Note: D3DVIEWPORT8 is compatible with WINED3DVIEWPORT */ wined3d_mutex_lock(); - hr = IWineD3DDevice_GetViewport(This->WineD3DDevice, (WINED3DVIEWPORT *)pViewport); + hr = wined3d_device_get_viewport(This->wined3d_device, (WINED3DVIEWPORT *)pViewport); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice8Impl_SetMaterial(LPDIRECT3DDEVICE8 iface, CONST D3DMATERIAL8* pMaterial) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_SetMaterial(IDirect3DDevice8 *iface, + const D3DMATERIAL8 *pMaterial) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); HRESULT hr; TRACE("iface %p, material %p.\n", iface, pMaterial); /* Note: D3DMATERIAL8 is compatible with WINED3DMATERIAL */ wined3d_mutex_lock(); - hr = IWineD3DDevice_SetMaterial(This->WineD3DDevice, (const WINED3DMATERIAL *)pMaterial); + hr = wined3d_device_set_material(This->wined3d_device, (const WINED3DMATERIAL *)pMaterial); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice8Impl_GetMaterial(LPDIRECT3DDEVICE8 iface, D3DMATERIAL8* pMaterial) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_GetMaterial(IDirect3DDevice8 *iface, + D3DMATERIAL8 *pMaterial) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); HRESULT hr; TRACE("iface %p, material %p.\n", iface, pMaterial); /* Note: D3DMATERIAL8 is compatible with WINED3DMATERIAL */ wined3d_mutex_lock(); - hr = IWineD3DDevice_GetMaterial(This->WineD3DDevice, (WINED3DMATERIAL *)pMaterial); + hr = wined3d_device_get_material(This->wined3d_device, (WINED3DMATERIAL *)pMaterial); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice8Impl_SetLight(LPDIRECT3DDEVICE8 iface, DWORD Index, CONST D3DLIGHT8* pLight) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_SetLight(IDirect3DDevice8 *iface, DWORD Index, + const D3DLIGHT8 *pLight) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); HRESULT hr; TRACE("iface %p, index %u, light %p.\n", iface, Index, pLight); /* Note: D3DLIGHT8 is compatible with WINED3DLIGHT */ wined3d_mutex_lock(); - hr = IWineD3DDevice_SetLight(This->WineD3DDevice, Index, (const WINED3DLIGHT *)pLight); + hr = wined3d_device_set_light(This->wined3d_device, Index, (const WINED3DLIGHT *)pLight); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice8Impl_GetLight(LPDIRECT3DDEVICE8 iface, DWORD Index,D3DLIGHT8* pLight) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_GetLight(IDirect3DDevice8 *iface, DWORD Index, + D3DLIGHT8 *pLight) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); HRESULT hr; TRACE("iface %p, index %u, light %p.\n", iface, Index, pLight); /* Note: D3DLIGHT8 is compatible with WINED3DLIGHT */ wined3d_mutex_lock(); - hr = IWineD3DDevice_GetLight(This->WineD3DDevice, Index, (WINED3DLIGHT *)pLight); + hr = wined3d_device_get_light(This->wined3d_device, Index, (WINED3DLIGHT *)pLight); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice8Impl_LightEnable(LPDIRECT3DDEVICE8 iface, DWORD Index,BOOL Enable) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_LightEnable(IDirect3DDevice8 *iface, DWORD Index, + BOOL Enable) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); HRESULT hr; TRACE("iface %p, index %u, enable %#x.\n", iface, Index, Enable); wined3d_mutex_lock(); - hr = IWineD3DDevice_SetLightEnable(This->WineD3DDevice, Index, Enable); + hr = wined3d_device_set_light_enable(This->wined3d_device, Index, Enable); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice8Impl_GetLightEnable(LPDIRECT3DDEVICE8 iface, DWORD Index,BOOL* pEnable) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_GetLightEnable(IDirect3DDevice8 *iface, DWORD Index, + BOOL *pEnable) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); HRESULT hr; TRACE("iface %p, index %u, enable %p.\n", iface, Index, pEnable); wined3d_mutex_lock(); - hr = IWineD3DDevice_GetLightEnable(This->WineD3DDevice, Index, pEnable); + hr = wined3d_device_get_light_enable(This->wined3d_device, Index, pEnable); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice8Impl_SetClipPlane(LPDIRECT3DDEVICE8 iface, DWORD Index,CONST float* pPlane) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_SetClipPlane(IDirect3DDevice8 *iface, DWORD Index, + const float *pPlane) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); HRESULT hr; TRACE("iface %p, index %u, plane %p.\n", iface, Index, pPlane); wined3d_mutex_lock(); - hr = IWineD3DDevice_SetClipPlane(This->WineD3DDevice, Index, pPlane); + hr = wined3d_device_set_clip_plane(This->wined3d_device, Index, pPlane); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice8Impl_GetClipPlane(LPDIRECT3DDEVICE8 iface, DWORD Index,float* pPlane) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_GetClipPlane(IDirect3DDevice8 *iface, DWORD Index, + float *pPlane) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); HRESULT hr; TRACE("iface %p, index %u, plane %p.\n", iface, Index, pPlane); wined3d_mutex_lock(); - hr = IWineD3DDevice_GetClipPlane(This->WineD3DDevice, Index, pPlane); + hr = wined3d_device_get_clip_plane(This->wined3d_device, Index, pPlane); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice8Impl_SetRenderState(LPDIRECT3DDEVICE8 iface, D3DRENDERSTATETYPE State,DWORD Value) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +/* This factor is the result of a trial-and-error search. Both ZBIAS and DEPTHBIAS require + * guesswork by design. d3d9 apps usually use a DEPTHBIAS of -0.00002(Mass Effect 2, WoW). + * d3d8 apps(Final Fantasy XI) set ZBIAS to 15 and still expect the depth test to sort + * objects properly. */ +static const float zbias_factor = -0.000005f; + +static HRESULT WINAPI IDirect3DDevice8Impl_SetRenderState(IDirect3DDevice8 *iface, + D3DRENDERSTATETYPE State, DWORD Value) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); HRESULT hr; + union + { + DWORD d; + float f; + } wined3d_value; TRACE("iface %p, state %#x, value %#x.\n", iface, State, Value); wined3d_mutex_lock(); - hr = IWineD3DDevice_SetRenderState(This->WineD3DDevice, State, Value); + switch (State) + { + case D3DRS_ZBIAS: + wined3d_value.f = Value * zbias_factor; + hr = wined3d_device_set_render_state(This->wined3d_device, WINED3DRS_DEPTHBIAS, wined3d_value.d); + break; + + default: + hr = wined3d_device_set_render_state(This->wined3d_device, State, Value); + } wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice8Impl_GetRenderState(LPDIRECT3DDEVICE8 iface, D3DRENDERSTATETYPE State,DWORD* pValue) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_GetRenderState(IDirect3DDevice8 *iface, + D3DRENDERSTATETYPE State, DWORD *pValue) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); HRESULT hr; + union + { + DWORD d; + float f; + } wined3d_value; TRACE("iface %p, state %#x, value %p.\n", iface, State, pValue); wined3d_mutex_lock(); - hr = IWineD3DDevice_GetRenderState(This->WineD3DDevice, State, pValue); + switch (State) + { + case D3DRS_ZBIAS: + hr = wined3d_device_get_render_state(This->wined3d_device, WINED3DRS_DEPTHBIAS, &wined3d_value.d); + if (SUCCEEDED(hr)) *pValue = (DWORD)(wined3d_value.f / zbias_factor); + break; + + default: + hr = wined3d_device_get_render_state(This->wined3d_device, State, pValue); + } wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice8Impl_BeginStateBlock(LPDIRECT3DDEVICE8 iface) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_BeginStateBlock(IDirect3DDevice8 *iface) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); HRESULT hr; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - hr = IWineD3DDevice_BeginStateBlock(This->WineD3DDevice); + hr = wined3d_device_begin_stateblock(This->wined3d_device); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice8Impl_EndStateBlock(LPDIRECT3DDEVICE8 iface, DWORD* pToken) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; - IWineD3DStateBlock *stateblock; +static HRESULT WINAPI IDirect3DDevice8Impl_EndStateBlock(IDirect3DDevice8 *iface, DWORD *pToken) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); + struct wined3d_stateblock *stateblock; HRESULT hr; TRACE("iface %p, token %p.\n", iface, pToken); @@ -1322,8 +1551,9 @@ static HRESULT WINAPI IDirect3DDevice8Impl_EndStateBlock(LPDIRECT3DDEVICE8 iface * of memory later and cause locking problems) */ wined3d_mutex_lock(); - hr = IWineD3DDevice_EndStateBlock(This->WineD3DDevice , &stateblock); - if (hr != D3D_OK) { + hr = wined3d_device_end_stateblock(This->wined3d_device, &stateblock); + if (FAILED(hr)) + { WARN("IWineD3DDevice_EndStateBlock returned an error\n"); wined3d_mutex_unlock(); return hr; @@ -1336,7 +1566,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_EndStateBlock(LPDIRECT3DDEVICE8 iface { ERR("Failed to create a handle\n"); wined3d_mutex_lock(); - IWineD3DStateBlock_Release(stateblock); + wined3d_stateblock_decref(stateblock); wined3d_mutex_unlock(); return E_FAIL; } @@ -1347,9 +1577,34 @@ static HRESULT WINAPI IDirect3DDevice8Impl_EndStateBlock(LPDIRECT3DDEVICE8 iface return hr; } -static HRESULT WINAPI IDirect3DDevice8Impl_ApplyStateBlock(LPDIRECT3DDEVICE8 iface, DWORD Token) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; - IWineD3DStateBlock *stateblock; +static HRESULT WINAPI IDirect3DDevice8Impl_ApplyStateBlock(IDirect3DDevice8 *iface, DWORD Token) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); + struct wined3d_stateblock *stateblock; + HRESULT hr; + + TRACE("iface %p, token %#x.\n", iface, Token); + + if (!Token) return D3D_OK; + + wined3d_mutex_lock(); + stateblock = d3d8_get_object(&This->handle_table, Token - 1, D3D8_HANDLE_SB); + if (!stateblock) + { + WARN("Invalid handle (%#x) passed.\n", Token); + wined3d_mutex_unlock(); + return D3DERR_INVALIDCALL; + } + hr = wined3d_stateblock_apply(stateblock); + wined3d_mutex_unlock(); + + return hr; +} + +static HRESULT WINAPI IDirect3DDevice8Impl_CaptureStateBlock(IDirect3DDevice8 *iface, DWORD Token) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); + struct wined3d_stateblock *stateblock; HRESULT hr; TRACE("iface %p, token %#x.\n", iface, Token); @@ -1362,36 +1617,16 @@ static HRESULT WINAPI IDirect3DDevice8Impl_ApplyStateBlock(LPDIRECT3DDEVICE8 ifa wined3d_mutex_unlock(); return D3DERR_INVALIDCALL; } - hr = IWineD3DStateBlock_Apply(stateblock); + hr = wined3d_stateblock_capture(stateblock); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice8Impl_CaptureStateBlock(LPDIRECT3DDEVICE8 iface, DWORD Token) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; - IWineD3DStateBlock *stateblock; - HRESULT hr; - - TRACE("iface %p, token %#x.\n", iface, Token); - - wined3d_mutex_lock(); - stateblock = d3d8_get_object(&This->handle_table, Token - 1, D3D8_HANDLE_SB); - if (!stateblock) - { - WARN("Invalid handle (%#x) passed.\n", Token); - wined3d_mutex_unlock(); - return D3DERR_INVALIDCALL; - } - hr = IWineD3DStateBlock_Capture(stateblock); - wined3d_mutex_unlock(); - - return hr; -} - -static HRESULT WINAPI IDirect3DDevice8Impl_DeleteStateBlock(LPDIRECT3DDEVICE8 iface, DWORD Token) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; - IWineD3DStateBlock *stateblock; +static HRESULT WINAPI IDirect3DDevice8Impl_DeleteStateBlock(IDirect3DDevice8 *iface, DWORD Token) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); + struct wined3d_stateblock *stateblock; TRACE("iface %p, token %#x.\n", iface, Token); @@ -1405,7 +1640,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_DeleteStateBlock(LPDIRECT3DDEVICE8 if return D3DERR_INVALIDCALL; } - if (IWineD3DStateBlock_Release((IUnknown *)stateblock)) + if (wined3d_stateblock_decref(stateblock)) { ERR("Stateblock %p has references left, this shouldn't happen.\n", stateblock); } @@ -1417,8 +1652,8 @@ static HRESULT WINAPI IDirect3DDevice8Impl_DeleteStateBlock(LPDIRECT3DDEVICE8 if static HRESULT WINAPI IDirect3DDevice8Impl_CreateStateBlock(IDirect3DDevice8 *iface, D3DSTATEBLOCKTYPE Type, DWORD *handle) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; - IWineD3DStateBlock *stateblock; + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); + struct wined3d_stateblock *stateblock; HRESULT hr; TRACE("iface %p, type %#x, handle %p.\n", iface, Type, handle); @@ -1432,7 +1667,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateStateBlock(IDirect3DDevice8 *if } wined3d_mutex_lock(); - hr = IWineD3DDevice_CreateStateBlock(This->WineD3DDevice, (WINED3DSTATEBLOCKTYPE)Type, &stateblock); + hr = wined3d_stateblock_create(This->wined3d_device, (WINED3DSTATEBLOCKTYPE)Type, &stateblock); if (FAILED(hr)) { wined3d_mutex_unlock(); @@ -1447,7 +1682,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateStateBlock(IDirect3DDevice8 *if { ERR("Failed to allocate a handle.\n"); wined3d_mutex_lock(); - IWineD3DStateBlock_Release(stateblock); + wined3d_stateblock_decref(stateblock); wined3d_mutex_unlock(); return E_FAIL; } @@ -1458,28 +1693,32 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateStateBlock(IDirect3DDevice8 *if return hr; } -static HRESULT WINAPI IDirect3DDevice8Impl_SetClipStatus(LPDIRECT3DDEVICE8 iface, CONST D3DCLIPSTATUS8* pClipStatus) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_SetClipStatus(IDirect3DDevice8 *iface, + const D3DCLIPSTATUS8 *pClipStatus) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); HRESULT hr; TRACE("iface %p, clip_status %p.\n", iface, pClipStatus); /* FIXME: Verify that D3DCLIPSTATUS8 ~= WINED3DCLIPSTATUS */ wined3d_mutex_lock(); - hr = IWineD3DDevice_SetClipStatus(This->WineD3DDevice, (const WINED3DCLIPSTATUS *)pClipStatus); + hr = wined3d_device_set_clip_status(This->wined3d_device, (const WINED3DCLIPSTATUS *)pClipStatus); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice8Impl_GetClipStatus(LPDIRECT3DDEVICE8 iface, D3DCLIPSTATUS8* pClipStatus) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_GetClipStatus(IDirect3DDevice8 *iface, + D3DCLIPSTATUS8 *pClipStatus) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); HRESULT hr; TRACE("iface %p, clip_status %p.\n", iface, pClipStatus); wined3d_mutex_lock(); - hr = IWineD3DDevice_GetClipStatus(This->WineD3DDevice, (WINED3DCLIPSTATUS *)pClipStatus); + hr = wined3d_device_get_clip_status(This->wined3d_device, (WINED3DCLIPSTATUS *)pClipStatus); wined3d_mutex_unlock(); return hr; @@ -1488,8 +1727,8 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetClipStatus(LPDIRECT3DDEVICE8 iface static HRESULT WINAPI IDirect3DDevice8Impl_GetTexture(IDirect3DDevice8 *iface, DWORD Stage, IDirect3DBaseTexture8 **ppTexture) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; - IWineD3DBaseTexture *retTexture; + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); + struct wined3d_texture *wined3d_texture; HRESULT hr; TRACE("iface %p, stage %u, texture %p.\n", iface, Stage, ppTexture); @@ -1499,7 +1738,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetTexture(IDirect3DDevice8 *iface, } wined3d_mutex_lock(); - hr = IWineD3DDevice_GetTexture(This->WineD3DDevice, Stage, &retTexture); + hr = wined3d_device_get_texture(This->wined3d_device, Stage, &wined3d_texture); if (FAILED(hr)) { WARN("Failed to get texture for stage %u, hr %#x.\n", Stage, hr); @@ -1508,11 +1747,11 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetTexture(IDirect3DDevice8 *iface, return hr; } - if (retTexture) + if (wined3d_texture) { - *ppTexture = IWineD3DBaseTexture_GetParent(retTexture); + *ppTexture = wined3d_texture_get_parent(wined3d_texture); IDirect3DBaseTexture8_AddRef(*ppTexture); - IWineD3DBaseTexture_Release(retTexture); + wined3d_texture_decref(wined3d_texture); } else { @@ -1523,15 +1762,17 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetTexture(IDirect3DDevice8 *iface, return D3D_OK; } -static HRESULT WINAPI IDirect3DDevice8Impl_SetTexture(LPDIRECT3DDEVICE8 iface, DWORD Stage, IDirect3DBaseTexture8* pTexture) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_SetTexture(IDirect3DDevice8 *iface, DWORD Stage, + IDirect3DBaseTexture8 *pTexture) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); HRESULT hr; TRACE("iface %p, stage %u, texture %p.\n", iface, Stage, pTexture); wined3d_mutex_lock(); - hr = IWineD3DDevice_SetTexture(This->WineD3DDevice, Stage, - pTexture==NULL ? NULL : ((IDirect3DBaseTexture8Impl *)pTexture)->wineD3DBaseTexture); + hr = wined3d_device_set_texture(This->wined3d_device, Stage, + pTexture ? ((IDirect3DBaseTexture8Impl *)pTexture)->wined3d_texture : NULL); wined3d_mutex_unlock(); return hr; @@ -1575,9 +1816,10 @@ tss_lookup[] = {FALSE, WINED3DTSS_RESULTARG}, /* 28, D3DTSS_RESULTARG */ }; -static HRESULT WINAPI IDirect3DDevice8Impl_GetTextureStageState(LPDIRECT3DDEVICE8 iface, DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD *pValue) +static HRESULT WINAPI IDirect3DDevice8Impl_GetTextureStageState(IDirect3DDevice8 *iface, + DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD *pValue) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); const struct tss_lookup *l; HRESULT hr; @@ -1592,16 +1834,19 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetTextureStageState(LPDIRECT3DDEVI l = &tss_lookup[Type]; wined3d_mutex_lock(); - if (l->sampler_state) hr = IWineD3DDevice_GetSamplerState(This->WineD3DDevice, Stage, l->state, pValue); - else hr = IWineD3DDevice_GetTextureStageState(This->WineD3DDevice, Stage, l->state, pValue); + if (l->sampler_state) + hr = wined3d_device_get_sampler_state(This->wined3d_device, Stage, l->state, pValue); + else + hr = wined3d_device_get_texture_stage_state(This->wined3d_device, Stage, l->state, pValue); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice8Impl_SetTextureStageState(LPDIRECT3DDEVICE8 iface, DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD Value) +static HRESULT WINAPI IDirect3DDevice8Impl_SetTextureStageState(IDirect3DDevice8 *iface, + DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD Value) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); const struct tss_lookup *l; HRESULT hr; @@ -1616,21 +1861,25 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetTextureStageState(LPDIRECT3DDEVICE l = &tss_lookup[Type]; wined3d_mutex_lock(); - if (l->sampler_state) hr = IWineD3DDevice_SetSamplerState(This->WineD3DDevice, Stage, l->state, Value); - else hr = IWineD3DDevice_SetTextureStageState(This->WineD3DDevice, Stage, l->state, Value); + if (l->sampler_state) + hr = wined3d_device_set_sampler_state(This->wined3d_device, Stage, l->state, Value); + else + hr = wined3d_device_set_texture_stage_state(This->wined3d_device, Stage, l->state, Value); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice8Impl_ValidateDevice(LPDIRECT3DDEVICE8 iface, DWORD* pNumPasses) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_ValidateDevice(IDirect3DDevice8 *iface, + DWORD *pNumPasses) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); HRESULT hr; TRACE("iface %p, pass_count %p.\n", iface, pNumPasses); wined3d_mutex_lock(); - hr = IWineD3DDevice_ValidateDevice(This->WineD3DDevice, pNumPasses); + hr = wined3d_device_validate_device(This->wined3d_device, pNumPasses); wined3d_mutex_unlock(); return hr; @@ -1644,103 +1893,116 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetInfo(IDirect3DDevice8 *iface, return D3D_OK; } -static HRESULT WINAPI IDirect3DDevice8Impl_SetPaletteEntries(LPDIRECT3DDEVICE8 iface, UINT PaletteNumber, CONST PALETTEENTRY* pEntries) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_SetPaletteEntries(IDirect3DDevice8 *iface, + UINT PaletteNumber, const PALETTEENTRY *pEntries) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); HRESULT hr; TRACE("iface %p, palette_idx %u, entries %p.\n", iface, PaletteNumber, pEntries); wined3d_mutex_lock(); - hr = IWineD3DDevice_SetPaletteEntries(This->WineD3DDevice, PaletteNumber, pEntries); + hr = wined3d_device_set_palette_entries(This->wined3d_device, PaletteNumber, pEntries); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice8Impl_GetPaletteEntries(LPDIRECT3DDEVICE8 iface, UINT PaletteNumber, PALETTEENTRY* pEntries) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_GetPaletteEntries(IDirect3DDevice8 *iface, + UINT PaletteNumber, PALETTEENTRY *pEntries) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); HRESULT hr; TRACE("iface %p, palette_idx %u, entries %p.\n", iface, PaletteNumber, pEntries); wined3d_mutex_lock(); - hr = IWineD3DDevice_GetPaletteEntries(This->WineD3DDevice, PaletteNumber, pEntries); + hr = wined3d_device_get_palette_entries(This->wined3d_device, PaletteNumber, pEntries); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice8Impl_SetCurrentTexturePalette(LPDIRECT3DDEVICE8 iface, UINT PaletteNumber) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_SetCurrentTexturePalette(IDirect3DDevice8 *iface, + UINT PaletteNumber) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); HRESULT hr; TRACE("iface %p, palette_idx %u.\n", iface, PaletteNumber); wined3d_mutex_lock(); - hr = IWineD3DDevice_SetCurrentTexturePalette(This->WineD3DDevice, PaletteNumber); + hr = wined3d_device_set_current_texture_palette(This->wined3d_device, PaletteNumber); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice8Impl_GetCurrentTexturePalette(LPDIRECT3DDEVICE8 iface, UINT *PaletteNumber) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_GetCurrentTexturePalette(IDirect3DDevice8 *iface, + UINT *PaletteNumber) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); HRESULT hr; TRACE("iface %p, palette_idx %p.\n", iface, PaletteNumber); wined3d_mutex_lock(); - hr = IWineD3DDevice_GetCurrentTexturePalette(This->WineD3DDevice, PaletteNumber); + hr = wined3d_device_get_current_texture_palette(This->wined3d_device, PaletteNumber); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice8Impl_DrawPrimitive(IDirect3DDevice8 *iface, D3DPRIMITIVETYPE PrimitiveType, - UINT StartVertex, UINT PrimitiveCount) +static HRESULT WINAPI IDirect3DDevice8Impl_DrawPrimitive(IDirect3DDevice8 *iface, + D3DPRIMITIVETYPE PrimitiveType, UINT StartVertex, UINT PrimitiveCount) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); HRESULT hr; TRACE("iface %p, primitive_type %#x, start_vertex %u, primitive_count %u.\n", iface, PrimitiveType, StartVertex, PrimitiveCount); wined3d_mutex_lock(); - IWineD3DDevice_SetPrimitiveType(This->WineD3DDevice, PrimitiveType); - hr = IWineD3DDevice_DrawPrimitive(This->WineD3DDevice, StartVertex, + wined3d_device_set_primitive_type(This->wined3d_device, PrimitiveType); + hr = wined3d_device_draw_primitive(This->wined3d_device, StartVertex, vertex_count_from_primitive_count(PrimitiveType, PrimitiveCount)); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice8Impl_DrawIndexedPrimitive(LPDIRECT3DDEVICE8 iface, D3DPRIMITIVETYPE PrimitiveType, - UINT MinVertexIndex,UINT NumVertices,UINT startIndex,UINT primCount) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_DrawIndexedPrimitive(IDirect3DDevice8 *iface, + D3DPRIMITIVETYPE PrimitiveType, UINT MinVertexIndex, UINT NumVertices, UINT startIndex, + UINT primCount) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); HRESULT hr; TRACE("iface %p, primitive_type %#x, min_vertex_idx %u, vertex_count %u, start_idx %u, primitive_count %u.\n", iface, PrimitiveType, MinVertexIndex, NumVertices, startIndex, primCount); wined3d_mutex_lock(); - IWineD3DDevice_SetPrimitiveType(This->WineD3DDevice, PrimitiveType); - hr = IWineD3DDevice_DrawIndexedPrimitive(This->WineD3DDevice, startIndex, + wined3d_device_set_primitive_type(This->wined3d_device, PrimitiveType); + hr = wined3d_device_draw_indexed_primitive(This->wined3d_device, startIndex, vertex_count_from_primitive_count(PrimitiveType, primCount)); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice8Impl_DrawPrimitiveUP(LPDIRECT3DDEVICE8 iface, D3DPRIMITIVETYPE PrimitiveType,UINT PrimitiveCount,CONST void* pVertexStreamZeroData,UINT VertexStreamZeroStride) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_DrawPrimitiveUP(IDirect3DDevice8 *iface, + D3DPRIMITIVETYPE PrimitiveType, UINT PrimitiveCount, const void *pVertexStreamZeroData, + UINT VertexStreamZeroStride) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); HRESULT hr; TRACE("iface %p, primitive_type %#x, primitive_count %u, data %p, stride %u.\n", iface, PrimitiveType, PrimitiveCount, pVertexStreamZeroData, VertexStreamZeroStride); wined3d_mutex_lock(); - IWineD3DDevice_SetPrimitiveType(This->WineD3DDevice, PrimitiveType); - hr = IWineD3DDevice_DrawPrimitiveUP(This->WineD3DDevice, + wined3d_device_set_primitive_type(This->wined3d_device, PrimitiveType); + hr = wined3d_device_draw_primitive_up(This->wined3d_device, vertex_count_from_primitive_count(PrimitiveType, PrimitiveCount), pVertexStreamZeroData, VertexStreamZeroStride); wined3d_mutex_unlock(); @@ -1748,11 +2010,12 @@ static HRESULT WINAPI IDirect3DDevice8Impl_DrawPrimitiveUP(LPDIRECT3DDEVICE8 ifa return hr; } -static HRESULT WINAPI IDirect3DDevice8Impl_DrawIndexedPrimitiveUP(LPDIRECT3DDEVICE8 iface, D3DPRIMITIVETYPE PrimitiveType,UINT MinVertexIndex, - UINT NumVertexIndices,UINT PrimitiveCount,CONST void* pIndexData, - D3DFORMAT IndexDataFormat,CONST void* pVertexStreamZeroData, - UINT VertexStreamZeroStride) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_DrawIndexedPrimitiveUP(IDirect3DDevice8 *iface, + D3DPRIMITIVETYPE PrimitiveType, UINT MinVertexIndex, UINT NumVertexIndices, + UINT PrimitiveCount, const void *pIndexData, D3DFORMAT IndexDataFormat, + const void *pVertexStreamZeroData, UINT VertexStreamZeroStride) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); HRESULT hr; TRACE("iface %p, primitive_type %#x, min_vertex_idx %u, index_count %u, primitive_count %u,\n" @@ -1761,8 +2024,8 @@ static HRESULT WINAPI IDirect3DDevice8Impl_DrawIndexedPrimitiveUP(LPDIRECT3DDEVI pIndexData, IndexDataFormat, pVertexStreamZeroData, VertexStreamZeroStride); wined3d_mutex_lock(); - IWineD3DDevice_SetPrimitiveType(This->WineD3DDevice, PrimitiveType); - hr = IWineD3DDevice_DrawIndexedPrimitiveUP(This->WineD3DDevice, + wined3d_device_set_primitive_type(This->wined3d_device, PrimitiveType); + hr = wined3d_device_draw_indexed_primitive_up(This->wined3d_device, vertex_count_from_primitive_count(PrimitiveType, PrimitiveCount), pIndexData, wined3dformat_from_d3dformat(IndexDataFormat), pVertexStreamZeroData, VertexStreamZeroStride); wined3d_mutex_unlock(); @@ -1770,8 +2033,11 @@ static HRESULT WINAPI IDirect3DDevice8Impl_DrawIndexedPrimitiveUP(LPDIRECT3DDEVI return hr; } -static HRESULT WINAPI IDirect3DDevice8Impl_ProcessVertices(LPDIRECT3DDEVICE8 iface, UINT SrcStartIndex,UINT DestIndex,UINT VertexCount,IDirect3DVertexBuffer8* pDestBuffer,DWORD Flags) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_ProcessVertices(IDirect3DDevice8 *iface, + UINT SrcStartIndex, UINT DestIndex, UINT VertexCount, IDirect3DVertexBuffer8 *pDestBuffer, + DWORD Flags) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); HRESULT hr; IDirect3DVertexBuffer8Impl *dest = (IDirect3DVertexBuffer8Impl *) pDestBuffer; @@ -1779,7 +2045,8 @@ static HRESULT WINAPI IDirect3DDevice8Impl_ProcessVertices(LPDIRECT3DDEVICE8 ifa iface, SrcStartIndex, DestIndex, VertexCount, pDestBuffer, Flags); wined3d_mutex_lock(); - hr = IWineD3DDevice_ProcessVertices(This->WineD3DDevice,SrcStartIndex, DestIndex, VertexCount, dest->wineD3DVertexBuffer, NULL, Flags, dest->fvf); + hr = wined3d_device_process_vertices(This->wined3d_device, SrcStartIndex, DestIndex, + VertexCount, dest->wineD3DVertexBuffer, NULL, Flags, dest->fvf); wined3d_mutex_unlock(); return hr; @@ -1788,7 +2055,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_ProcessVertices(LPDIRECT3DDEVICE8 ifa static HRESULT WINAPI IDirect3DDevice8Impl_CreateVertexShader(IDirect3DDevice8 *iface, const DWORD *declaration, const DWORD *byte_code, DWORD *shader, DWORD usage) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); IDirect3DVertexShader8Impl *object; DWORD shader_handle; DWORD handle; @@ -1898,8 +2165,9 @@ static IDirect3DVertexDeclaration8Impl *IDirect3DDevice8Impl_FindDecl(IDirect3DD return d3d8_declaration; } -static HRESULT WINAPI IDirect3DDevice8Impl_SetVertexShader(LPDIRECT3DDEVICE8 iface, DWORD pShader) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_SetVertexShader(IDirect3DDevice8 *iface, DWORD pShader) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); IDirect3DVertexShader8Impl *shader; HRESULT hr; @@ -1909,9 +2177,9 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetVertexShader(LPDIRECT3DDEVICE8 ifa TRACE("Setting FVF, %#x\n", pShader); wined3d_mutex_lock(); - IWineD3DDevice_SetVertexDeclaration(This->WineD3DDevice, + wined3d_device_set_vertex_declaration(This->wined3d_device, IDirect3DDevice8Impl_FindDecl(This, pShader)->wined3d_vertex_declaration); - IWineD3DDevice_SetVertexShader(This->WineD3DDevice, NULL); + wined3d_device_set_vertex_shader(This->wined3d_device, NULL); wined3d_mutex_unlock(); return D3D_OK; @@ -1929,9 +2197,10 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetVertexShader(LPDIRECT3DDEVICE8 ifa return D3DERR_INVALIDCALL; } - hr = IWineD3DDevice_SetVertexDeclaration(This->WineD3DDevice, + hr = wined3d_device_set_vertex_declaration(This->wined3d_device, ((IDirect3DVertexDeclaration8Impl *)shader->vertex_declaration)->wined3d_vertex_declaration); - if (SUCCEEDED(hr)) hr = IWineD3DDevice_SetVertexShader(This->WineD3DDevice, shader->wineD3DVertexShader); + if (SUCCEEDED(hr)) + hr = wined3d_device_set_vertex_shader(This->wined3d_device, shader->wined3d_shader); wined3d_mutex_unlock(); TRACE("Returning hr %#x\n", hr); @@ -1941,20 +2210,20 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetVertexShader(LPDIRECT3DDEVICE8 ifa static HRESULT WINAPI IDirect3DDevice8Impl_GetVertexShader(IDirect3DDevice8 *iface, DWORD *ppShader) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; - IWineD3DVertexDeclaration *wined3d_declaration; + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); + struct wined3d_vertex_declaration *wined3d_declaration; IDirect3DVertexDeclaration8 *d3d8_declaration; HRESULT hr; TRACE("iface %p, shader %p.\n", iface, ppShader); wined3d_mutex_lock(); - hr = IWineD3DDevice_GetVertexDeclaration(This->WineD3DDevice, &wined3d_declaration); + hr = wined3d_device_get_vertex_declaration(This->wined3d_device, &wined3d_declaration); if (FAILED(hr)) { wined3d_mutex_unlock(); WARN("(%p) : Call to IWineD3DDevice_GetVertexDeclaration failed %#x (device %p)\n", - This, hr, This->WineD3DDevice); + This, hr, This->wined3d_device); return hr; } @@ -1965,8 +2234,8 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetVertexShader(IDirect3DDevice8 *ifa return D3D_OK; } - d3d8_declaration = IWineD3DVertexDeclaration_GetParent(wined3d_declaration); - IWineD3DVertexDeclaration_Release(wined3d_declaration); + d3d8_declaration = wined3d_vertex_declaration_get_parent(wined3d_declaration); + wined3d_vertex_declaration_decref(wined3d_declaration); wined3d_mutex_unlock(); *ppShader = ((IDirect3DVertexDeclaration8Impl *)d3d8_declaration)->shader_handle; @@ -1975,10 +2244,11 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetVertexShader(IDirect3DDevice8 *ifa return hr; } -static HRESULT WINAPI IDirect3DDevice8Impl_DeleteVertexShader(LPDIRECT3DDEVICE8 iface, DWORD pShader) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_DeleteVertexShader(IDirect3DDevice8 *iface, DWORD pShader) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); IDirect3DVertexShader8Impl *shader; - IWineD3DVertexShader *cur; + struct wined3d_shader *cur; TRACE("iface %p, shader %#x.\n", iface, pShader); @@ -1992,16 +2262,17 @@ static HRESULT WINAPI IDirect3DDevice8Impl_DeleteVertexShader(LPDIRECT3DDEVICE return D3DERR_INVALIDCALL; } - cur = IWineD3DDevice_GetVertexShader(This->WineD3DDevice); + cur = wined3d_device_get_vertex_shader(This->wined3d_device); if (cur) { - if (cur == shader->wineD3DVertexShader) IDirect3DDevice8_SetVertexShader(iface, 0); - IWineD3DVertexShader_Release(cur); + if (cur == shader->wined3d_shader) + IDirect3DDevice8_SetVertexShader(iface, 0); + wined3d_shader_decref(cur); } wined3d_mutex_unlock(); - if (IUnknown_Release((IUnknown *)shader)) + if (IDirect3DVertexShader8_Release(&shader->IDirect3DVertexShader8_iface)) { ERR("Shader %p has references left, this shouldn't happen.\n", shader); } @@ -2009,8 +2280,10 @@ static HRESULT WINAPI IDirect3DDevice8Impl_DeleteVertexShader(LPDIRECT3DDEVICE return D3D_OK; } -static HRESULT WINAPI IDirect3DDevice8Impl_SetVertexShaderConstant(LPDIRECT3DDEVICE8 iface, DWORD Register, CONST void* pConstantData, DWORD ConstantCount) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_SetVertexShaderConstant(IDirect3DDevice8 *iface, + DWORD Register, const void *pConstantData, DWORD ConstantCount) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); HRESULT hr; TRACE("iface %p, register %u, data %p, count %u.\n", @@ -2023,14 +2296,16 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetVertexShaderConstant(LPDIRECT3DDEV } wined3d_mutex_lock(); - hr = IWineD3DDevice_SetVertexShaderConstantF(This->WineD3DDevice, Register, pConstantData, ConstantCount); + hr = wined3d_device_set_vs_consts_f(This->wined3d_device, Register, pConstantData, ConstantCount); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice8Impl_GetVertexShaderConstant(LPDIRECT3DDEVICE8 iface, DWORD Register, void* pConstantData, DWORD ConstantCount) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_GetVertexShaderConstant(IDirect3DDevice8 *iface, + DWORD Register, void *pConstantData, DWORD ConstantCount) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); HRESULT hr; TRACE("iface %p, register %u, data %p, count %u.\n", @@ -2043,14 +2318,16 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetVertexShaderConstant(LPDIRECT3DDEV } wined3d_mutex_lock(); - hr = IWineD3DDevice_GetVertexShaderConstantF(This->WineD3DDevice, Register, pConstantData, ConstantCount); + hr = wined3d_device_get_vs_consts_f(This->wined3d_device, Register, pConstantData, ConstantCount); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice8Impl_GetVertexShaderDeclaration(LPDIRECT3DDEVICE8 iface, DWORD pVertexShader, void* pData, DWORD* pSizeOfData) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_GetVertexShaderDeclaration(IDirect3DDevice8 *iface, + DWORD pVertexShader, void *pData, DWORD *pSizeOfData) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); IDirect3DVertexDeclaration8Impl *declaration; IDirect3DVertexShader8Impl *shader; @@ -2086,8 +2363,10 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetVertexShaderDeclaration(LPDIRECT3D return D3D_OK; } -static HRESULT WINAPI IDirect3DDevice8Impl_GetVertexShaderFunction(LPDIRECT3DDEVICE8 iface, DWORD pVertexShader, void* pData, DWORD* pSizeOfData) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_GetVertexShaderFunction(IDirect3DDevice8 *iface, + DWORD pVertexShader, void *pData, DWORD *pSizeOfData) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); IDirect3DVertexShader8Impl *shader = NULL; HRESULT hr; @@ -2104,21 +2383,23 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetVertexShaderFunction(LPDIRECT3DDEV return D3DERR_INVALIDCALL; } - if (!shader->wineD3DVertexShader) + if (!shader->wined3d_shader) { wined3d_mutex_unlock(); *pSizeOfData = 0; return D3D_OK; } - hr = IWineD3DVertexShader_GetFunction(shader->wineD3DVertexShader, pData, pSizeOfData); + hr = wined3d_shader_get_byte_code(shader->wined3d_shader, pData, pSizeOfData); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice8Impl_SetIndices(LPDIRECT3DDEVICE8 iface, IDirect3DIndexBuffer8* pIndexData, UINT baseVertexIndex) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_SetIndices(IDirect3DDevice8 *iface, + IDirect3DIndexBuffer8 *pIndexData, UINT baseVertexIndex) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); HRESULT hr; IDirect3DIndexBuffer8Impl *ib = (IDirect3DIndexBuffer8Impl *)pIndexData; @@ -2131,8 +2412,8 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetIndices(LPDIRECT3DDEVICE8 iface, I * problem) */ wined3d_mutex_lock(); - IWineD3DDevice_SetBaseVertexIndex(This->WineD3DDevice, baseVertexIndex); - hr = IWineD3DDevice_SetIndexBuffer(This->WineD3DDevice, + wined3d_device_set_base_vertex_index(This->wined3d_device, baseVertexIndex); + hr = wined3d_device_set_index_buffer(This->wined3d_device, ib ? ib->wineD3DIndexBuffer : NULL, ib ? ib->format : WINED3DFMT_UNKNOWN); wined3d_mutex_unlock(); @@ -2143,8 +2424,8 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetIndices(LPDIRECT3DDEVICE8 iface, I static HRESULT WINAPI IDirect3DDevice8Impl_GetIndices(IDirect3DDevice8 *iface, IDirect3DIndexBuffer8 **ppIndexData, UINT *pBaseVertexIndex) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; - IWineD3DBuffer *retIndexData = NULL; + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); + struct wined3d_buffer *retIndexData = NULL; HRESULT hr; TRACE("iface %p, buffer %p, base_vertex_index %p.\n", iface, ppIndexData, pBaseVertexIndex); @@ -2155,13 +2436,13 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetIndices(IDirect3DDevice8 *iface, /* The case from UINT to INT is safe because d3d8 will never set negative values */ wined3d_mutex_lock(); - IWineD3DDevice_GetBaseVertexIndex(This->WineD3DDevice, (INT *) pBaseVertexIndex); - hr = IWineD3DDevice_GetIndexBuffer(This->WineD3DDevice, &retIndexData); + *pBaseVertexIndex = wined3d_device_get_base_vertex_index(This->wined3d_device); + hr = wined3d_device_get_index_buffer(This->wined3d_device, &retIndexData); if (SUCCEEDED(hr) && retIndexData) { - *ppIndexData = IWineD3DBuffer_GetParent(retIndexData); + *ppIndexData = wined3d_buffer_get_parent(retIndexData); IDirect3DIndexBuffer8_AddRef(*ppIndexData); - IWineD3DBuffer_Release(retIndexData); + wined3d_buffer_decref(retIndexData); } else { if (FAILED(hr)) FIXME("Call to GetIndices failed\n"); *ppIndexData = NULL; @@ -2174,7 +2455,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetIndices(IDirect3DDevice8 *iface, static HRESULT WINAPI IDirect3DDevice8Impl_CreatePixelShader(IDirect3DDevice8 *iface, const DWORD *byte_code, DWORD *shader) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); IDirect3DPixelShader8Impl *object; DWORD shader_handle; DWORD handle; @@ -2225,8 +2506,9 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreatePixelShader(IDirect3DDevice8 *i return D3D_OK; } -static HRESULT WINAPI IDirect3DDevice8Impl_SetPixelShader(LPDIRECT3DDEVICE8 iface, DWORD pShader) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_SetPixelShader(IDirect3DDevice8 *iface, DWORD pShader) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); IDirect3DPixelShader8Impl *shader; HRESULT hr; @@ -2236,7 +2518,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetPixelShader(LPDIRECT3DDEVICE8 ifac if (!pShader) { - hr = IWineD3DDevice_SetPixelShader(This->WineD3DDevice, NULL); + hr = wined3d_device_set_pixel_shader(This->wined3d_device, NULL); wined3d_mutex_unlock(); return hr; } @@ -2250,7 +2532,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetPixelShader(LPDIRECT3DDEVICE8 ifac } TRACE("(%p) : Setting shader %p\n", This, shader); - hr = IWineD3DDevice_SetPixelShader(This->WineD3DDevice, shader->wineD3DPixelShader); + hr = wined3d_device_set_pixel_shader(This->wined3d_device, shader->wined3d_shader); wined3d_mutex_unlock(); return hr; @@ -2258,8 +2540,8 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetPixelShader(LPDIRECT3DDEVICE8 ifac static HRESULT WINAPI IDirect3DDevice8Impl_GetPixelShader(IDirect3DDevice8 *iface, DWORD *ppShader) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; - IWineD3DPixelShader *object; + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); + struct wined3d_shader *object; TRACE("iface %p, shader %p.\n", iface, ppShader); @@ -2269,12 +2551,12 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetPixelShader(IDirect3DDevice8 *ifac } wined3d_mutex_lock(); - object = IWineD3DDevice_GetPixelShader(This->WineD3DDevice); + object = wined3d_device_get_pixel_shader(This->wined3d_device); if (object) { IDirect3DPixelShader8Impl *d3d8_shader; - d3d8_shader = IWineD3DPixelShader_GetParent(object); - IWineD3DPixelShader_Release(object); + d3d8_shader = wined3d_shader_get_parent(object); + wined3d_shader_decref(object); *ppShader = d3d8_shader->handle; } else @@ -2288,10 +2570,11 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetPixelShader(IDirect3DDevice8 *ifac return D3D_OK; } -static HRESULT WINAPI IDirect3DDevice8Impl_DeletePixelShader(LPDIRECT3DDEVICE8 iface, DWORD pShader) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_DeletePixelShader(IDirect3DDevice8 *iface, DWORD pShader) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); IDirect3DPixelShader8Impl *shader; - IWineD3DPixelShader *cur; + struct wined3d_shader *cur; TRACE("iface %p, shader %#x.\n", iface, pShader); @@ -2305,16 +2588,17 @@ static HRESULT WINAPI IDirect3DDevice8Impl_DeletePixelShader(LPDIRECT3DDEVICE8 i return D3DERR_INVALIDCALL; } - cur = IWineD3DDevice_GetPixelShader(This->WineD3DDevice); + cur = wined3d_device_get_pixel_shader(This->wined3d_device); if (cur) { - if (cur == shader->wineD3DPixelShader) IDirect3DDevice8_SetPixelShader(iface, 0); - IWineD3DPixelShader_Release(cur); + if (cur == shader->wined3d_shader) + IDirect3DDevice8_SetPixelShader(iface, 0); + wined3d_shader_decref(cur); } wined3d_mutex_unlock(); - if (IUnknown_Release((IUnknown *)shader)) + if (IDirect3DPixelShader8_Release(&shader->IDirect3DPixelShader8_iface)) { ERR("Shader %p has references left, this shouldn't happen.\n", shader); } @@ -2322,36 +2606,42 @@ static HRESULT WINAPI IDirect3DDevice8Impl_DeletePixelShader(LPDIRECT3DDEVICE8 i return D3D_OK; } -static HRESULT WINAPI IDirect3DDevice8Impl_SetPixelShaderConstant(LPDIRECT3DDEVICE8 iface, DWORD Register, CONST void* pConstantData, DWORD ConstantCount) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_SetPixelShaderConstant(IDirect3DDevice8 *iface, + DWORD Register, const void *pConstantData, DWORD ConstantCount) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); HRESULT hr; TRACE("iface %p, register %u, data %p, count %u.\n", iface, Register, pConstantData, ConstantCount); wined3d_mutex_lock(); - hr = IWineD3DDevice_SetPixelShaderConstantF(This->WineD3DDevice, Register, pConstantData, ConstantCount); + hr = wined3d_device_set_ps_consts_f(This->wined3d_device, Register, pConstantData, ConstantCount); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice8Impl_GetPixelShaderConstant(LPDIRECT3DDEVICE8 iface, DWORD Register, void* pConstantData, DWORD ConstantCount) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_GetPixelShaderConstant(IDirect3DDevice8 *iface, + DWORD Register, void *pConstantData, DWORD ConstantCount) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); HRESULT hr; TRACE("iface %p, register %u, data %p, count %u.\n", iface, Register, pConstantData, ConstantCount); wined3d_mutex_lock(); - hr = IWineD3DDevice_GetPixelShaderConstantF(This->WineD3DDevice, Register, pConstantData, ConstantCount); + hr = wined3d_device_get_ps_consts_f(This->wined3d_device, Register, pConstantData, ConstantCount); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice8Impl_GetPixelShaderFunction(LPDIRECT3DDEVICE8 iface, DWORD pPixelShader, void* pData, DWORD* pSizeOfData) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_GetPixelShaderFunction(IDirect3DDevice8 *iface, + DWORD pPixelShader, void *pData, DWORD *pSizeOfData) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); IDirect3DPixelShader8Impl *shader = NULL; HRESULT hr; @@ -2368,64 +2658,73 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetPixelShaderFunction(LPDIRECT3DDEVI return D3DERR_INVALIDCALL; } - hr = IWineD3DPixelShader_GetFunction(shader->wineD3DPixelShader, pData, pSizeOfData); + hr = wined3d_shader_get_byte_code(shader->wined3d_shader, pData, pSizeOfData); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice8Impl_DrawRectPatch(LPDIRECT3DDEVICE8 iface, UINT Handle,CONST float* pNumSegs,CONST D3DRECTPATCH_INFO* pRectPatchInfo) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_DrawRectPatch(IDirect3DDevice8 *iface, UINT Handle, + const float *pNumSegs, const D3DRECTPATCH_INFO *pRectPatchInfo) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); HRESULT hr; TRACE("iface %p, handle %#x, segment_count %p, patch_info %p.\n", iface, Handle, pNumSegs, pRectPatchInfo); wined3d_mutex_lock(); - hr = IWineD3DDevice_DrawRectPatch(This->WineD3DDevice, Handle, pNumSegs, (CONST WINED3DRECTPATCH_INFO *)pRectPatchInfo); + hr = wined3d_device_draw_rect_patch(This->wined3d_device, Handle, + pNumSegs, (const WINED3DRECTPATCH_INFO *)pRectPatchInfo); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice8Impl_DrawTriPatch(LPDIRECT3DDEVICE8 iface, UINT Handle,CONST float* pNumSegs,CONST D3DTRIPATCH_INFO* pTriPatchInfo) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_DrawTriPatch(IDirect3DDevice8 *iface, UINT Handle, + const float *pNumSegs, const D3DTRIPATCH_INFO *pTriPatchInfo) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); HRESULT hr; TRACE("iface %p, handle %#x, segment_count %p, patch_info %p.\n", iface, Handle, pNumSegs, pTriPatchInfo); wined3d_mutex_lock(); - hr = IWineD3DDevice_DrawTriPatch(This->WineD3DDevice, Handle, pNumSegs, (CONST WINED3DTRIPATCH_INFO *)pTriPatchInfo); + hr = wined3d_device_draw_tri_patch(This->wined3d_device, Handle, + pNumSegs, (const WINED3DTRIPATCH_INFO *)pTriPatchInfo); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice8Impl_DeletePatch(LPDIRECT3DDEVICE8 iface, UINT Handle) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_DeletePatch(IDirect3DDevice8 *iface, UINT Handle) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); HRESULT hr; TRACE("iface %p, handle %#x.\n", iface, Handle); wined3d_mutex_lock(); - hr = IWineD3DDevice_DeletePatch(This->WineD3DDevice, Handle); + hr = wined3d_device_delete_patch(This->wined3d_device, Handle); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice8Impl_SetStreamSource(LPDIRECT3DDEVICE8 iface, UINT StreamNumber,IDirect3DVertexBuffer8* pStreamData,UINT Stride) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; +static HRESULT WINAPI IDirect3DDevice8Impl_SetStreamSource(IDirect3DDevice8 *iface, + UINT StreamNumber, IDirect3DVertexBuffer8 *pStreamData, UINT Stride) +{ + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); HRESULT hr; TRACE("iface %p, stream_idx %u, buffer %p, stride %u.\n", iface, StreamNumber, pStreamData, Stride); wined3d_mutex_lock(); - hr = IWineD3DDevice_SetStreamSource(This->WineD3DDevice, StreamNumber, - NULL == pStreamData ? NULL : ((IDirect3DVertexBuffer8Impl *)pStreamData)->wineD3DVertexBuffer, - 0/* Offset in bytes */, Stride); + hr = wined3d_device_set_stream_source(This->wined3d_device, StreamNumber, + pStreamData ? ((IDirect3DVertexBuffer8Impl *)pStreamData)->wineD3DVertexBuffer : NULL, + 0/* Offset in bytes */, Stride); wined3d_mutex_unlock(); return hr; @@ -2434,8 +2733,8 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetStreamSource(LPDIRECT3DDEVICE8 ifa static HRESULT WINAPI IDirect3DDevice8Impl_GetStreamSource(IDirect3DDevice8 *iface, UINT StreamNumber, IDirect3DVertexBuffer8 **pStream, UINT *pStride) { - IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; - IWineD3DBuffer *retStream = NULL; + IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface); + struct wined3d_buffer *retStream = NULL; HRESULT hr; TRACE("iface %p, stream_idx %u, buffer %p, stride %p.\n", @@ -2446,13 +2745,13 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetStreamSource(IDirect3DDevice8 *ifa } wined3d_mutex_lock(); - hr = IWineD3DDevice_GetStreamSource(This->WineD3DDevice, StreamNumber, + hr = wined3d_device_get_stream_source(This->wined3d_device, StreamNumber, &retStream, 0 /* Offset in bytes */, pStride); if (SUCCEEDED(hr) && retStream) { - *pStream = IWineD3DBuffer_GetParent(retStream); + *pStream = wined3d_buffer_get_parent(retStream); IDirect3DVertexBuffer8_AddRef(*pStream); - IWineD3DBuffer_Release(retStream); + wined3d_buffer_decref(retStream); } else { @@ -2565,148 +2864,129 @@ static const IDirect3DDevice8Vtbl Direct3DDevice8_Vtbl = IDirect3DDevice8Impl_DeletePatch }; -/* IWineD3DDeviceParent IUnknown methods */ - -static inline struct IDirect3DDevice8Impl *device_from_device_parent(IWineD3DDeviceParent *iface) +static inline IDirect3DDevice8Impl *device_from_device_parent(struct wined3d_device_parent *device_parent) { - return (struct IDirect3DDevice8Impl *)((char*)iface - - FIELD_OFFSET(struct IDirect3DDevice8Impl, device_parent_vtbl)); + return CONTAINING_RECORD(device_parent, IDirect3DDevice8Impl, device_parent); } -static HRESULT STDMETHODCALLTYPE device_parent_QueryInterface(IWineD3DDeviceParent *iface, REFIID riid, void **object) +static void CDECL device_parent_wined3d_device_created(struct wined3d_device_parent *device_parent, + struct wined3d_device *device) { - struct IDirect3DDevice8Impl *This = device_from_device_parent(iface); - return IDirect3DDevice8Impl_QueryInterface((IDirect3DDevice8 *)This, riid, object); + TRACE("device_parent %p, device %p\n", device_parent, device); } -static ULONG STDMETHODCALLTYPE device_parent_AddRef(IWineD3DDeviceParent *iface) +static HRESULT CDECL device_parent_create_surface(struct wined3d_device_parent *device_parent, + void *container_parent, UINT width, UINT height, enum wined3d_format_id format, DWORD usage, + WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, struct wined3d_surface **surface) { - struct IDirect3DDevice8Impl *This = device_from_device_parent(iface); - return IDirect3DDevice8Impl_AddRef((IDirect3DDevice8 *)This); -} - -static ULONG STDMETHODCALLTYPE device_parent_Release(IWineD3DDeviceParent *iface) -{ - struct IDirect3DDevice8Impl *This = device_from_device_parent(iface); - return IDirect3DDevice8Impl_Release((IDirect3DDevice8 *)This); -} - -/* IWineD3DDeviceParent methods */ - -static void STDMETHODCALLTYPE device_parent_WineD3DDeviceCreated(IWineD3DDeviceParent *iface, IWineD3DDevice *device) -{ - TRACE("iface %p, device %p\n", iface, device); -} - -static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParent *iface, - IUnknown *superior, UINT width, UINT height, enum wined3d_format_id format, DWORD usage, - WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, IWineD3DSurface **surface) -{ - struct IDirect3DDevice8Impl *This = device_from_device_parent(iface); + IDirect3DDevice8Impl *device = device_from_device_parent(device_parent); IDirect3DSurface8Impl *d3d_surface; BOOL lockable = TRUE; HRESULT hr; - TRACE("iface %p, superior %p, width %u, height %u, format %#x, usage %#x,\n" - "\tpool %#x, level %u, face %u, surface %p\n", - iface, superior, width, height, format, usage, pool, level, face, surface); + TRACE("device_parent %p, container_parent %p, width %u, height %u, format %#x, usage %#x,\n" + "\tpool %#x, level %u, face %u, surface %p.\n", + device_parent, container_parent, width, height, format, usage, pool, level, face, surface); if (pool == WINED3DPOOL_DEFAULT && !(usage & WINED3DUSAGE_DYNAMIC)) lockable = FALSE; - hr = IDirect3DDevice8Impl_CreateSurface((IDirect3DDevice8 *)This, width, height, + hr = IDirect3DDevice8Impl_CreateSurface(device, width, height, d3dformat_from_wined3dformat(format), lockable, FALSE /* Discard */, level, (IDirect3DSurface8 **)&d3d_surface, usage, pool, D3DMULTISAMPLE_NONE, 0 /* MultisampleQuality */); if (FAILED(hr)) { - ERR("(%p) CreateSurface failed, returning %#x\n", iface, hr); + WARN("Failed to create surface, hr %#x.\n", hr); return hr; } - *surface = d3d_surface->wineD3DSurface; - IWineD3DSurface_AddRef(*surface); + *surface = d3d_surface->wined3d_surface; + wined3d_surface_incref(*surface); - d3d_surface->container = superior; + d3d_surface->container = container_parent; IUnknown_Release(d3d_surface->parentDevice); d3d_surface->parentDevice = NULL; IDirect3DSurface8_Release((IDirect3DSurface8 *)d3d_surface); - d3d_surface->forwardReference = superior; + d3d_surface->forwardReference = container_parent; return hr; } -static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDeviceParent *iface, - IUnknown *superior, UINT width, UINT height, enum wined3d_format_id format, +static HRESULT CDECL device_parent_create_rendertarget(struct wined3d_device_parent *device_parent, + void *container_parent, UINT width, UINT height, enum wined3d_format_id format, WINED3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality, BOOL lockable, - IWineD3DSurface **surface) + struct wined3d_surface **surface) { - struct IDirect3DDevice8Impl *This = device_from_device_parent(iface); + IDirect3DDevice8Impl *device = device_from_device_parent(device_parent); IDirect3DSurface8Impl *d3d_surface; HRESULT hr; - TRACE("iface %p, superior %p, width %u, height %u, format %#x, multisample_type %#x,\n" - "\tmultisample_quality %u, lockable %u, surface %p\n", - iface, superior, width, height, format, multisample_type, multisample_quality, lockable, surface); + TRACE("device_parent %p, container_parent %p, width %u, height %u, format %#x, multisample_type %#x,\n" + "\tmultisample_quality %u, lockable %u, surface %p.\n", + device_parent, container_parent, width, height, format, + multisample_type, multisample_quality, lockable, surface); - hr = IDirect3DDevice8_CreateRenderTarget((IDirect3DDevice8 *)This, width, height, + hr = IDirect3DDevice8_CreateRenderTarget(&device->IDirect3DDevice8_iface, width, height, d3dformat_from_wined3dformat(format), multisample_type, lockable, (IDirect3DSurface8 **)&d3d_surface); if (FAILED(hr)) { - ERR("(%p) CreateRenderTarget failed, returning %#x\n", iface, hr); + WARN("Failed to create rendertarget, hr %#x.\n", hr); return hr; } - *surface = d3d_surface->wineD3DSurface; - IWineD3DSurface_AddRef(*surface); + *surface = d3d_surface->wined3d_surface; + wined3d_surface_incref(*surface); - d3d_surface->container = (IUnknown *)This; + d3d_surface->container = (IUnknown *)&device->IDirect3DDevice8_iface; /* Implicit surfaces are created with an refcount of 0 */ IUnknown_Release((IUnknown *)d3d_surface); return hr; } -static HRESULT STDMETHODCALLTYPE device_parent_CreateDepthStencilSurface(IWineD3DDeviceParent *iface, +static HRESULT CDECL device_parent_create_depth_stencil(struct wined3d_device_parent *device_parent, UINT width, UINT height, enum wined3d_format_id format, WINED3DMULTISAMPLE_TYPE multisample_type, - DWORD multisample_quality, BOOL discard, IWineD3DSurface **surface) + DWORD multisample_quality, BOOL discard, struct wined3d_surface **surface) { - struct IDirect3DDevice8Impl *This = device_from_device_parent(iface); + IDirect3DDevice8Impl *device = device_from_device_parent(device_parent); IDirect3DSurface8Impl *d3d_surface; HRESULT hr; - TRACE("iface %p, width %u, height %u, format %#x, multisample_type %#x,\n" - "\tmultisample_quality %u, discard %u, surface %p\n", - iface, width, height, format, multisample_type, multisample_quality, discard, surface); + TRACE("device_parent %p, width %u, height %u, format %#x, multisample_type %#x,\n" + "\tmultisample_quality %u, discard %u, surface %p.\n", + device_parent, width, height, format, multisample_type, multisample_quality, discard, surface); - hr = IDirect3DDevice8_CreateDepthStencilSurface((IDirect3DDevice8 *)This, width, height, + hr = IDirect3DDevice8_CreateDepthStencilSurface(&device->IDirect3DDevice8_iface, width, height, d3dformat_from_wined3dformat(format), multisample_type, (IDirect3DSurface8 **)&d3d_surface); if (FAILED(hr)) { - ERR("(%p) CreateDepthStencilSurface failed, returning %#x\n", iface, hr); + WARN("Failed to create depth/stencil surface, hr %#x.\n", hr); return hr; } - *surface = d3d_surface->wineD3DSurface; - IWineD3DSurface_AddRef(*surface); + *surface = d3d_surface->wined3d_surface; + wined3d_surface_incref(*surface); - d3d_surface->container = (IUnknown *)This; + d3d_surface->container = (IUnknown *)&device->IDirect3DDevice8_iface; /* Implicit surfaces are created with an refcount of 0 */ IUnknown_Release((IUnknown *)d3d_surface); return hr; } -static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent *iface, - IUnknown *superior, UINT width, UINT height, UINT depth, enum wined3d_format_id format, - WINED3DPOOL pool, DWORD usage, IWineD3DVolume **volume) +static HRESULT CDECL device_parent_create_volume(struct wined3d_device_parent *device_parent, + void *container_parent, UINT width, UINT height, UINT depth, enum wined3d_format_id format, + WINED3DPOOL pool, DWORD usage, struct wined3d_volume **volume) { - struct IDirect3DDevice8Impl *This = device_from_device_parent(iface); + IDirect3DDevice8Impl *device = device_from_device_parent(device_parent); IDirect3DVolume8Impl *object; HRESULT hr; - TRACE("iface %p, superior %p, width %u, height %u, depth %u, format %#x, pool %#x, usage %#x, volume %p\n", - iface, superior, width, height, depth, format, pool, usage, volume); + TRACE("device_parent %p, container_parent %p, width %u, height %u, depth %u, " + "format %#x, pool %#x, usage %#x, volume %p.\n", + device_parent, container_parent, width, height, depth, + format, pool, usage, volume); /* Allocate the storage for the device */ object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); @@ -2717,7 +2997,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent return D3DERR_OUTOFVIDEOMEMORY; } - hr = volume_init(object, This, width, height, depth, usage, format, pool); + hr = volume_init(object, device, width, height, depth, usage, format, pool); if (FAILED(hr)) { WARN("Failed to initialize volume, hr %#x.\n", hr); @@ -2725,27 +3005,27 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent return hr; } - *volume = object->wineD3DVolume; - IWineD3DVolume_AddRef(*volume); - IDirect3DVolume8_Release((IDirect3DVolume8 *)object); + *volume = object->wined3d_volume; + wined3d_volume_incref(*volume); + IDirect3DVolume8_Release(&object->IDirect3DVolume8_iface); - object->container = superior; - object->forwardReference = superior; + object->container = container_parent; + object->forwardReference = container_parent; - TRACE("(%p) Created volume %p\n", iface, object); + TRACE("Created volume %p.\n", object); return hr; } -static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDeviceParent *iface, - WINED3DPRESENT_PARAMETERS *present_parameters, IWineD3DSwapChain **swapchain) +static HRESULT CDECL device_parent_create_swapchain(struct wined3d_device_parent *device_parent, + WINED3DPRESENT_PARAMETERS *present_parameters, struct wined3d_swapchain **swapchain) { - struct IDirect3DDevice8Impl *This = device_from_device_parent(iface); - IDirect3DSwapChain8Impl *d3d_swapchain; + IDirect3DDevice8Impl *device = device_from_device_parent(device_parent); D3DPRESENT_PARAMETERS local_parameters; + IDirect3DSwapChain8 *d3d_swapchain; HRESULT hr; - TRACE("iface %p, present_parameters %p, swapchain %p\n", iface, present_parameters, swapchain); + TRACE("device_parent %p, present_parameters %p, swapchain %p.\n", device_parent, present_parameters, swapchain); /* Copy the presentation parameters */ local_parameters.BackBufferWidth = present_parameters->BackBufferWidth; @@ -2762,18 +3042,18 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDevicePar local_parameters.FullScreen_RefreshRateInHz = present_parameters->FullScreen_RefreshRateInHz; local_parameters.FullScreen_PresentationInterval = present_parameters->PresentationInterval; - hr = IDirect3DDevice8_CreateAdditionalSwapChain((IDirect3DDevice8 *)This, - &local_parameters, (IDirect3DSwapChain8 **)&d3d_swapchain); + hr = IDirect3DDevice8_CreateAdditionalSwapChain(&device->IDirect3DDevice8_iface, + &local_parameters, &d3d_swapchain); if (FAILED(hr)) { - ERR("(%p) CreateAdditionalSwapChain failed, returning %#x\n", iface, hr); + WARN("Failed to create swapchain, hr %#x.\n", hr); *swapchain = NULL; return hr; } - *swapchain = d3d_swapchain->wineD3DSwapChain; - IUnknown_Release(d3d_swapchain->parentDevice); - d3d_swapchain->parentDevice = NULL; + *swapchain = ((IDirect3DSwapChain8Impl *)d3d_swapchain)->wined3d_swapchain; + wined3d_swapchain_incref(*swapchain); + IDirect3DSwapChain8_Release(d3d_swapchain); /* Copy back the presentation parameters */ present_parameters->BackBufferWidth = local_parameters.BackBufferWidth; @@ -2793,19 +3073,14 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDevicePar return hr; } -static const IWineD3DDeviceParentVtbl d3d8_wined3d_device_parent_vtbl = +static const struct wined3d_device_parent_ops d3d8_wined3d_device_parent_ops = { - /* IUnknown methods */ - device_parent_QueryInterface, - device_parent_AddRef, - device_parent_Release, - /* IWineD3DDeviceParent methods */ - device_parent_WineD3DDeviceCreated, - device_parent_CreateSurface, - device_parent_CreateRenderTarget, - device_parent_CreateDepthStencilSurface, - device_parent_CreateVolume, - device_parent_CreateSwapChain, + device_parent_wined3d_device_created, + device_parent_create_surface, + device_parent_create_rendertarget, + device_parent_create_depth_stencil, + device_parent_create_volume, + device_parent_create_swapchain, }; static void setup_fpu(void) @@ -2820,14 +3095,14 @@ static void setup_fpu(void) #endif } -HRESULT device_init(IDirect3DDevice8Impl *device, IWineD3D *wined3d, UINT adapter, +HRESULT device_init(IDirect3DDevice8Impl *device, struct wined3d *wined3d, UINT adapter, D3DDEVTYPE device_type, HWND focus_window, DWORD flags, D3DPRESENT_PARAMETERS *parameters) { WINED3DPRESENT_PARAMETERS wined3d_parameters; HRESULT hr; - device->lpVtbl = &Direct3DDevice8_Vtbl; - device->device_parent_vtbl = &d3d8_wined3d_device_parent_vtbl; + device->IDirect3DDevice8_iface.lpVtbl = &Direct3DDevice8_Vtbl; + device->device_parent.ops = &d3d8_wined3d_device_parent_ops; device->ref = 1; device->handle_table.entries = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, D3D8_INITIAL_HANDLE_TABLE_SIZE * sizeof(*device->handle_table.entries)); @@ -2841,8 +3116,8 @@ HRESULT device_init(IDirect3DDevice8Impl *device, IWineD3D *wined3d, UINT adapte if (!(flags & D3DCREATE_FPU_PRESERVE)) setup_fpu(); wined3d_mutex_lock(); - hr = IWineD3D_CreateDevice(wined3d, adapter, device_type, focus_window, flags, - (IWineD3DDeviceParent *)&device->device_parent_vtbl, &device->WineD3DDevice); + hr = wined3d_device_create(wined3d, adapter, device_type, focus_window, flags, + &device->device_parent, &device->wined3d_device); if (FAILED(hr)) { WARN("Failed to create wined3d device, hr %#x.\n", hr); @@ -2853,18 +3128,28 @@ HRESULT device_init(IDirect3DDevice8Impl *device, IWineD3D *wined3d, UINT adapte if (!parameters->Windowed) { - if (!focus_window) focus_window = parameters->hDeviceWindow; - if (FAILED(hr = IWineD3DDevice_AcquireFocusWindow(device->WineD3DDevice, focus_window))) + HWND device_window = parameters->hDeviceWindow; + + if (!focus_window) + focus_window = device_window; + if (FAILED(hr = wined3d_device_acquire_focus_window(device->wined3d_device, focus_window))) { ERR("Failed to acquire focus window, hr %#x.\n", hr); - IWineD3DDevice_Release(device->WineD3DDevice); + wined3d_device_decref(device->wined3d_device); wined3d_mutex_unlock(); HeapFree(GetProcessHeap(), 0, device->handle_table.entries); return hr; } + + if (!device_window) + device_window = focus_window; + wined3d_device_setup_fullscreen_window(device->wined3d_device, device_window, + parameters->BackBufferWidth, + parameters->BackBufferHeight); } - if (flags & D3DCREATE_MULTITHREADED) IWineD3DDevice_SetMultithreaded(device->WineD3DDevice); + if (flags & D3DCREATE_MULTITHREADED) + wined3d_device_set_multithreaded(device->wined3d_device); wined3d_parameters.BackBufferWidth = parameters->BackBufferWidth; wined3d_parameters.BackBufferHeight = parameters->BackBufferHeight; @@ -2882,18 +3167,18 @@ HRESULT device_init(IDirect3DDevice8Impl *device, IWineD3D *wined3d, UINT adapte wined3d_parameters.PresentationInterval = parameters->FullScreen_PresentationInterval; wined3d_parameters.AutoRestoreDisplayMode = TRUE; - hr = IWineD3DDevice_Init3D(device->WineD3DDevice, &wined3d_parameters); + hr = wined3d_device_init_3d(device->wined3d_device, &wined3d_parameters); if (FAILED(hr)) { WARN("Failed to initialize 3D, hr %#x.\n", hr); - IWineD3DDevice_ReleaseFocusWindow(device->WineD3DDevice); - IWineD3DDevice_Release(device->WineD3DDevice); + wined3d_device_release_focus_window(device->wined3d_device); + wined3d_device_decref(device->wined3d_device); wined3d_mutex_unlock(); HeapFree(GetProcessHeap(), 0, device->handle_table.entries); return hr; } - hr = IWineD3DDevice_SetRenderState(device->WineD3DDevice, WINED3DRS_POINTSIZE_MIN, 0); + hr = wined3d_device_set_render_state(device->wined3d_device, WINED3DRS_POINTSIZE_MIN, 0); wined3d_mutex_unlock(); if (FAILED(hr)) { @@ -2928,9 +3213,9 @@ HRESULT device_init(IDirect3DDevice8Impl *device, IWineD3D *wined3d, UINT adapte err: wined3d_mutex_lock(); - IWineD3DDevice_Uninit3D(device->WineD3DDevice, D3D8CB_DestroySwapChain); - IWineD3DDevice_ReleaseFocusWindow(device->WineD3DDevice); - IWineD3DDevice_Release(device->WineD3DDevice); + wined3d_device_uninit_3d(device->wined3d_device); + wined3d_device_release_focus_window(device->wined3d_device); + wined3d_device_decref(device->wined3d_device); wined3d_mutex_unlock(); HeapFree(GetProcessHeap(), 0, device->handle_table.entries); return hr; diff --git a/dll/directx/wine/d3d8/directx.c b/dll/directx/wine/d3d8/directx.c index 8bcd5abf9c9..249399e8452 100644 --- a/dll/directx/wine/d3d8/directx.c +++ b/dll/directx/wine/d3d8/directx.c @@ -37,10 +37,14 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d8); -/* IDirect3D IUnknown parts follow: */ +static inline IDirect3D8Impl *impl_from_IDirect3D8(IDirect3D8 *iface) +{ + return CONTAINING_RECORD(iface, IDirect3D8Impl, IDirect3D8_iface); +} + static HRESULT WINAPI IDirect3D8Impl_QueryInterface(LPDIRECT3D8 iface, REFIID riid,LPVOID *ppobj) { - IDirect3D8Impl *This = (IDirect3D8Impl *)iface; + IDirect3D8Impl *This = impl_from_IDirect3D8(iface); TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), ppobj); @@ -56,8 +60,9 @@ static HRESULT WINAPI IDirect3D8Impl_QueryInterface(LPDIRECT3D8 iface, REFIID ri return E_NOINTERFACE; } -static ULONG WINAPI IDirect3D8Impl_AddRef(LPDIRECT3D8 iface) { - IDirect3D8Impl *This = (IDirect3D8Impl *)iface; +static ULONG WINAPI IDirect3D8Impl_AddRef(LPDIRECT3D8 iface) +{ + IDirect3D8Impl *This = impl_from_IDirect3D8(iface); ULONG ref = InterlockedIncrement(&This->ref); TRACE("%p increasing refcount to %u.\n", iface, ref); @@ -65,8 +70,9 @@ static ULONG WINAPI IDirect3D8Impl_AddRef(LPDIRECT3D8 iface) { return ref; } -static ULONG WINAPI IDirect3D8Impl_Release(LPDIRECT3D8 iface) { - IDirect3D8Impl *This = (IDirect3D8Impl *)iface; +static ULONG WINAPI IDirect3D8Impl_Release(LPDIRECT3D8 iface) +{ + IDirect3D8Impl *This = impl_from_IDirect3D8(iface); ULONG ref = InterlockedDecrement(&This->ref); TRACE("%p decreasing refcount to %u.\n", iface, ref); @@ -75,7 +81,7 @@ static ULONG WINAPI IDirect3D8Impl_Release(LPDIRECT3D8 iface) { TRACE("Releasing wined3d %p\n", This->WineD3D); wined3d_mutex_lock(); - IWineD3D_Release(This->WineD3D); + wined3d_decref(This->WineD3D); wined3d_mutex_unlock(); HeapFree(GetProcessHeap(), 0, This); @@ -84,37 +90,39 @@ static ULONG WINAPI IDirect3D8Impl_Release(LPDIRECT3D8 iface) { return ref; } -/* IDirect3D8 Interface follow: */ -static HRESULT WINAPI IDirect3D8Impl_RegisterSoftwareDevice (LPDIRECT3D8 iface, void* pInitializeFunction) { - IDirect3D8Impl *This = (IDirect3D8Impl *)iface; +static HRESULT WINAPI IDirect3D8Impl_RegisterSoftwareDevice(LPDIRECT3D8 iface, + void* pInitializeFunction) +{ + IDirect3D8Impl *This = impl_from_IDirect3D8(iface); HRESULT hr; TRACE("iface %p, init_function %p.\n", iface, pInitializeFunction); wined3d_mutex_lock(); - hr = IWineD3D_RegisterSoftwareDevice(This->WineD3D, pInitializeFunction); + hr = wined3d_register_software_device(This->WineD3D, pInitializeFunction); wined3d_mutex_unlock(); return hr; } -static UINT WINAPI IDirect3D8Impl_GetAdapterCount (LPDIRECT3D8 iface) { - IDirect3D8Impl *This = (IDirect3D8Impl *)iface; +static UINT WINAPI IDirect3D8Impl_GetAdapterCount(LPDIRECT3D8 iface) +{ + IDirect3D8Impl *This = impl_from_IDirect3D8(iface); HRESULT hr; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - hr = IWineD3D_GetAdapterCount(This->WineD3D); + hr = wined3d_get_adapter_count(This->WineD3D); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3D8Impl_GetAdapterIdentifier(LPDIRECT3D8 iface, - UINT Adapter, DWORD Flags, D3DADAPTER_IDENTIFIER8 *pIdentifier) +static HRESULT WINAPI IDirect3D8Impl_GetAdapterIdentifier(LPDIRECT3D8 iface, UINT Adapter, + DWORD Flags, D3DADAPTER_IDENTIFIER8 *pIdentifier) { - IDirect3D8Impl *This = (IDirect3D8Impl *)iface; + IDirect3D8Impl *This = impl_from_IDirect3D8(iface); WINED3DADAPTER_IDENTIFIER adapter_id; HRESULT hr; @@ -129,7 +137,7 @@ static HRESULT WINAPI IDirect3D8Impl_GetAdapterIdentifier(LPDIRECT3D8 iface, adapter_id.device_name_size = 0; /* d3d9 only */ wined3d_mutex_lock(); - hr = IWineD3D_GetAdapterIdentifier(This->WineD3D, Adapter, Flags, &adapter_id); + hr = wined3d_get_adapter_identifier(This->WineD3D, Adapter, Flags, &adapter_id); wined3d_mutex_unlock(); pIdentifier->DriverVersion = adapter_id.driver_version; @@ -143,28 +151,31 @@ static HRESULT WINAPI IDirect3D8Impl_GetAdapterIdentifier(LPDIRECT3D8 iface, return hr; } -static UINT WINAPI IDirect3D8Impl_GetAdapterModeCount (LPDIRECT3D8 iface,UINT Adapter) { - IDirect3D8Impl *This = (IDirect3D8Impl *)iface; +static UINT WINAPI IDirect3D8Impl_GetAdapterModeCount(LPDIRECT3D8 iface,UINT Adapter) +{ + IDirect3D8Impl *This = impl_from_IDirect3D8(iface); HRESULT hr; TRACE("iface %p, adapter %u.\n", iface, Adapter); wined3d_mutex_lock(); - hr = IWineD3D_GetAdapterModeCount(This->WineD3D, Adapter, 0 /* format */); + hr = wined3d_get_adapter_mode_count(This->WineD3D, Adapter, 0); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3D8Impl_EnumAdapterModes (LPDIRECT3D8 iface, UINT Adapter, UINT Mode, D3DDISPLAYMODE* pMode) { - IDirect3D8Impl *This = (IDirect3D8Impl *)iface; +static HRESULT WINAPI IDirect3D8Impl_EnumAdapterModes(LPDIRECT3D8 iface, UINT Adapter, UINT Mode, + D3DDISPLAYMODE* pMode) +{ + IDirect3D8Impl *This = impl_from_IDirect3D8(iface); HRESULT hr; TRACE("iface %p, adapter %u, mode_idx %u, mode %p.\n", iface, Adapter, Mode, pMode); wined3d_mutex_lock(); - hr = IWineD3D_EnumAdapterModes(This->WineD3D, Adapter, WINED3DFMT_UNKNOWN, Mode, (WINED3DDISPLAYMODE *) pMode); + hr = wined3d_enum_adapter_modes(This->WineD3D, Adapter, WINED3DFMT_UNKNOWN, Mode, (WINED3DDISPLAYMODE *)pMode); wined3d_mutex_unlock(); if (SUCCEEDED(hr)) pMode->Format = d3dformat_from_wined3dformat(pMode->Format); @@ -172,15 +183,17 @@ static HRESULT WINAPI IDirect3D8Impl_EnumAdapterModes (LPDIRECT3D8 iface, UINT A return hr; } -static HRESULT WINAPI IDirect3D8Impl_GetAdapterDisplayMode (LPDIRECT3D8 iface, UINT Adapter, D3DDISPLAYMODE* pMode) { - IDirect3D8Impl *This = (IDirect3D8Impl *)iface; +static HRESULT WINAPI IDirect3D8Impl_GetAdapterDisplayMode(LPDIRECT3D8 iface, UINT Adapter, + D3DDISPLAYMODE* pMode) +{ + IDirect3D8Impl *This = impl_from_IDirect3D8(iface); HRESULT hr; TRACE("iface %p, adapter %u, mode %p.\n", iface, Adapter, pMode); wined3d_mutex_lock(); - hr = IWineD3D_GetAdapterDisplayMode(This->WineD3D, Adapter, (WINED3DDISPLAYMODE *) pMode); + hr = wined3d_get_adapter_display_mode(This->WineD3D, Adapter, (WINED3DDISPLAYMODE *)pMode); wined3d_mutex_unlock(); if (SUCCEEDED(hr)) pMode->Format = d3dformat_from_wined3dformat(pMode->Format); @@ -188,27 +201,28 @@ static HRESULT WINAPI IDirect3D8Impl_GetAdapterDisplayMode (LPDIRECT3D8 iface, U return hr; } -static HRESULT WINAPI IDirect3D8Impl_CheckDeviceType (LPDIRECT3D8 iface, - UINT Adapter, D3DDEVTYPE CheckType, D3DFORMAT DisplayFormat, - D3DFORMAT BackBufferFormat, BOOL Windowed) { - IDirect3D8Impl *This = (IDirect3D8Impl *)iface; +static HRESULT WINAPI IDirect3D8Impl_CheckDeviceType(LPDIRECT3D8 iface, UINT Adapter, + D3DDEVTYPE CheckType, D3DFORMAT DisplayFormat, D3DFORMAT BackBufferFormat, BOOL Windowed) +{ + IDirect3D8Impl *This = impl_from_IDirect3D8(iface); HRESULT hr; TRACE("iface %p, adapter %u, device_type %#x, display_format %#x, backbuffer_format %#x, windowed %#x.\n", iface, Adapter, CheckType, DisplayFormat, BackBufferFormat, Windowed); wined3d_mutex_lock(); - hr = IWineD3D_CheckDeviceType(This->WineD3D, Adapter, CheckType, wined3dformat_from_d3dformat(DisplayFormat), + hr = wined3d_check_device_type(This->WineD3D, Adapter, CheckType, wined3dformat_from_d3dformat(DisplayFormat), wined3dformat_from_d3dformat(BackBufferFormat), Windowed); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3D8Impl_CheckDeviceFormat (LPDIRECT3D8 iface, - UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, - DWORD Usage, D3DRESOURCETYPE RType, D3DFORMAT CheckFormat) { - IDirect3D8Impl *This = (IDirect3D8Impl *)iface; +static HRESULT WINAPI IDirect3D8Impl_CheckDeviceFormat(LPDIRECT3D8 iface, UINT Adapter, + D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, DWORD Usage, D3DRESOURCETYPE RType, + D3DFORMAT CheckFormat) +{ + IDirect3D8Impl *This = impl_from_IDirect3D8(iface); HRESULT hr; WINED3DRESOURCETYPE WineD3DRType; @@ -235,7 +249,7 @@ static HRESULT WINAPI IDirect3D8Impl_CheckDeviceFormat (LPDIRECT3D8 i } wined3d_mutex_lock(); - hr = IWineD3D_CheckDeviceFormat(This->WineD3D, Adapter, DeviceType, wined3dformat_from_d3dformat(AdapterFormat), + hr = wined3d_check_device_format(This->WineD3D, Adapter, DeviceType, wined3dformat_from_d3dformat(AdapterFormat), Usage, WineD3DRType, wined3dformat_from_d3dformat(CheckFormat), SURFACE_OPENGL); wined3d_mutex_unlock(); @@ -243,33 +257,35 @@ static HRESULT WINAPI IDirect3D8Impl_CheckDeviceFormat (LPDIRECT3D8 i } static HRESULT WINAPI IDirect3D8Impl_CheckDeviceMultiSampleType(IDirect3D8 *iface, UINT Adapter, - D3DDEVTYPE DeviceType, D3DFORMAT SurfaceFormat, BOOL Windowed, D3DMULTISAMPLE_TYPE MultiSampleType) + D3DDEVTYPE DeviceType, D3DFORMAT SurfaceFormat, BOOL Windowed, + D3DMULTISAMPLE_TYPE MultiSampleType) { - IDirect3D8Impl *This = (IDirect3D8Impl *)iface; + IDirect3D8Impl *This = impl_from_IDirect3D8(iface); HRESULT hr; TRACE("iface %p, adapter %u, device_type %#x, format %#x, windowed %#x, multisample_type %#x.\n", iface, Adapter, DeviceType, SurfaceFormat, Windowed, MultiSampleType); wined3d_mutex_lock(); - hr = IWineD3D_CheckDeviceMultiSampleType(This->WineD3D, Adapter, DeviceType, - wined3dformat_from_d3dformat(SurfaceFormat), Windowed, (WINED3DMULTISAMPLE_TYPE) MultiSampleType, NULL); + hr = wined3d_check_device_multisample_type(This->WineD3D, Adapter, DeviceType, + wined3dformat_from_d3dformat(SurfaceFormat), Windowed, (WINED3DMULTISAMPLE_TYPE)MultiSampleType, NULL); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3D8Impl_CheckDepthStencilMatch(IDirect3D8 *iface, UINT Adapter, D3DDEVTYPE DeviceType, - D3DFORMAT AdapterFormat, D3DFORMAT RenderTargetFormat, D3DFORMAT DepthStencilFormat) +static HRESULT WINAPI IDirect3D8Impl_CheckDepthStencilMatch(IDirect3D8 *iface, UINT Adapter, + D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, D3DFORMAT RenderTargetFormat, + D3DFORMAT DepthStencilFormat) { - IDirect3D8Impl *This = (IDirect3D8Impl *)iface; + IDirect3D8Impl *This = impl_from_IDirect3D8(iface); HRESULT hr; TRACE("iface %p, adapter %u, device_type %#x, adapter_format %#x, rt_format %#x, ds_format %#x.\n", iface, Adapter, DeviceType, AdapterFormat, RenderTargetFormat, DepthStencilFormat); wined3d_mutex_lock(); - hr = IWineD3D_CheckDepthStencilMatch(This->WineD3D, Adapter, DeviceType, + hr = wined3d_check_depth_stencil_match(This->WineD3D, Adapter, DeviceType, wined3dformat_from_d3dformat(AdapterFormat), wined3dformat_from_d3dformat(RenderTargetFormat), wined3dformat_from_d3dformat(DepthStencilFormat)); wined3d_mutex_unlock(); @@ -291,8 +307,10 @@ void fixup_caps(WINED3DCAPS *caps) caps->StencilCaps &= ~WINED3DSTENCILCAPS_TWOSIDED; } -static HRESULT WINAPI IDirect3D8Impl_GetDeviceCaps(LPDIRECT3D8 iface, UINT Adapter, D3DDEVTYPE DeviceType, D3DCAPS8* pCaps) { - IDirect3D8Impl *This = (IDirect3D8Impl *)iface; +static HRESULT WINAPI IDirect3D8Impl_GetDeviceCaps(LPDIRECT3D8 iface, UINT Adapter, + D3DDEVTYPE DeviceType, D3DCAPS8* pCaps) +{ + IDirect3D8Impl *This = impl_from_IDirect3D8(iface); HRESULT hrc = D3D_OK; WINED3DCAPS *pWineCaps; @@ -307,7 +325,7 @@ static HRESULT WINAPI IDirect3D8Impl_GetDeviceCaps(LPDIRECT3D8 iface, UINT Ada } wined3d_mutex_lock(); - hrc = IWineD3D_GetDeviceCaps(This->WineD3D, Adapter, DeviceType, pWineCaps); + hrc = wined3d_get_device_caps(This->WineD3D, Adapter, DeviceType, pWineCaps); wined3d_mutex_unlock(); fixup_caps(pWineCaps); @@ -318,23 +336,25 @@ static HRESULT WINAPI IDirect3D8Impl_GetDeviceCaps(LPDIRECT3D8 iface, UINT Ada return hrc; } -static HMONITOR WINAPI IDirect3D8Impl_GetAdapterMonitor(LPDIRECT3D8 iface, UINT Adapter) { - IDirect3D8Impl *This = (IDirect3D8Impl *)iface; +static HMONITOR WINAPI IDirect3D8Impl_GetAdapterMonitor(LPDIRECT3D8 iface, UINT Adapter) +{ + IDirect3D8Impl *This = impl_from_IDirect3D8(iface); HMONITOR ret; TRACE("iface %p, adapter %u.\n", iface, Adapter); wined3d_mutex_lock(); - ret = IWineD3D_GetAdapterMonitor(This->WineD3D, Adapter); + ret = wined3d_get_adapter_monitor(This->WineD3D, Adapter); wined3d_mutex_unlock(); return ret; } -static HRESULT WINAPI IDirect3D8Impl_CreateDevice(IDirect3D8 *iface, UINT adapter, D3DDEVTYPE device_type, - HWND focus_window, DWORD flags, D3DPRESENT_PARAMETERS *parameters, IDirect3DDevice8 **device) +static HRESULT WINAPI IDirect3D8Impl_CreateDevice(IDirect3D8 *iface, UINT adapter, + D3DDEVTYPE device_type, HWND focus_window, DWORD flags, D3DPRESENT_PARAMETERS *parameters, + IDirect3DDevice8 **device) { - IDirect3D8Impl *This = (IDirect3D8Impl *)iface; + IDirect3D8Impl *This = impl_from_IDirect3D8(iface); IDirect3DDevice8Impl *object; HRESULT hr; @@ -357,7 +377,7 @@ static HRESULT WINAPI IDirect3D8Impl_CreateDevice(IDirect3D8 *iface, UINT adapte } TRACE("Created device %p.\n", object); - *device = (IDirect3DDevice8 *)object; + *device = &object->IDirect3DDevice8_iface; return D3D_OK; } diff --git a/dll/directx/wine/d3d8/shader.c b/dll/directx/wine/d3d8/shader.c index a59f10b57b4..e04c2a2960f 100644 --- a/dll/directx/wine/d3d8/shader.c +++ b/dll/directx/wine/d3d8/shader.c @@ -22,6 +22,11 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d8); +static inline IDirect3DVertexShader8Impl *impl_from_IDirect3DVertexShader8(IDirect3DVertexShader8 *iface) +{ + return CONTAINING_RECORD(iface, IDirect3DVertexShader8Impl, IDirect3DVertexShader8_iface); +} + static HRESULT WINAPI d3d8_vertexshader_QueryInterface(IDirect3DVertexShader8 *iface, REFIID riid, void **object) { TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object); @@ -42,15 +47,15 @@ static HRESULT WINAPI d3d8_vertexshader_QueryInterface(IDirect3DVertexShader8 *i static ULONG WINAPI d3d8_vertexshader_AddRef(IDirect3DVertexShader8 *iface) { - IDirect3DVertexShader8Impl *shader = (IDirect3DVertexShader8Impl *)iface; + IDirect3DVertexShader8Impl *shader = impl_from_IDirect3DVertexShader8(iface); ULONG refcount = InterlockedIncrement(&shader->ref); TRACE("%p increasing refcount to %u.\n", iface, refcount); - if (refcount == 1 && shader->wineD3DVertexShader) + if (refcount == 1 && shader->wined3d_shader) { wined3d_mutex_lock(); - IWineD3DVertexShader_AddRef(shader->wineD3DVertexShader); + wined3d_shader_incref(shader->wined3d_shader); wined3d_mutex_unlock(); } @@ -66,17 +71,17 @@ static void STDMETHODCALLTYPE d3d8_vertexshader_wined3d_object_destroyed(void *p static ULONG WINAPI d3d8_vertexshader_Release(IDirect3DVertexShader8 *iface) { - IDirect3DVertexShader8Impl *shader = (IDirect3DVertexShader8Impl *)iface; + IDirect3DVertexShader8Impl *shader = impl_from_IDirect3DVertexShader8(iface); ULONG refcount = InterlockedDecrement(&shader->ref); TRACE("%p decreasing refcount to %u.\n", iface, refcount); if (!refcount) { - if (shader->wineD3DVertexShader) + if (shader->wined3d_shader) { wined3d_mutex_lock(); - IWineD3DVertexShader_Release(shader->wineD3DVertexShader); + wined3d_shader_decref(shader->wined3d_shader); wined3d_mutex_unlock(); } else @@ -157,7 +162,7 @@ HRESULT vertexshader_init(IDirect3DVertexShader8Impl *shader, IDirect3DDevice8Im } shader->ref = 1; - shader->lpVtbl = &d3d8_vertexshader_vtbl; + shader->IDirect3DVertexShader8_iface.lpVtbl = &d3d8_vertexshader_vtbl; hr = d3d8_vertexshader_create_vertexdeclaration(device, declaration, shader_handle, &shader->vertex_declaration); if (FAILED(hr)) @@ -171,8 +176,8 @@ HRESULT vertexshader_init(IDirect3DVertexShader8Impl *shader, IDirect3DDevice8Im if (usage) FIXME("Usage %#x not implemented.\n", usage); wined3d_mutex_lock(); - hr = IWineD3DDevice_CreateVertexShader(device->WineD3DDevice, byte_code, NULL /* output signature */, - shader, &d3d8_vertexshader_wined3d_parent_ops, &shader->wineD3DVertexShader); + hr = wined3d_shader_create_vs(device->wined3d_device, byte_code, NULL /* output signature */, + shader, &d3d8_vertexshader_wined3d_parent_ops, &shader->wined3d_shader); wined3d_mutex_unlock(); if (FAILED(hr)) { @@ -181,12 +186,17 @@ HRESULT vertexshader_init(IDirect3DVertexShader8Impl *shader, IDirect3DDevice8Im return hr; } - load_local_constants(declaration, shader->wineD3DVertexShader); + load_local_constants(declaration, shader->wined3d_shader); } return D3D_OK; } +static inline IDirect3DPixelShader8Impl *impl_from_IDirect3DPixelShader8(IDirect3DPixelShader8 *iface) +{ + return CONTAINING_RECORD(iface, IDirect3DPixelShader8Impl, IDirect3DPixelShader8_iface); +} + static HRESULT WINAPI d3d8_pixelshader_QueryInterface(IDirect3DPixelShader8 *iface, REFIID riid, void **object) { TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object); @@ -207,7 +217,7 @@ static HRESULT WINAPI d3d8_pixelshader_QueryInterface(IDirect3DPixelShader8 *ifa static ULONG WINAPI d3d8_pixelshader_AddRef(IDirect3DPixelShader8 *iface) { - IDirect3DPixelShader8Impl *shader = (IDirect3DPixelShader8Impl *)iface; + IDirect3DPixelShader8Impl *shader = impl_from_IDirect3DPixelShader8(iface); ULONG refcount = InterlockedIncrement(&shader->ref); TRACE("%p increasing refcount to %u.\n", iface, refcount); @@ -215,7 +225,7 @@ static ULONG WINAPI d3d8_pixelshader_AddRef(IDirect3DPixelShader8 *iface) if (refcount == 1) { wined3d_mutex_lock(); - IWineD3DPixelShader_AddRef(shader->wineD3DPixelShader); + wined3d_shader_incref(shader->wined3d_shader); wined3d_mutex_unlock(); } @@ -224,7 +234,7 @@ static ULONG WINAPI d3d8_pixelshader_AddRef(IDirect3DPixelShader8 *iface) static ULONG WINAPI d3d8_pixelshader_Release(IDirect3DPixelShader8 *iface) { - IDirect3DPixelShader8Impl *shader = (IDirect3DPixelShader8Impl *)iface; + IDirect3DPixelShader8Impl *shader = impl_from_IDirect3DPixelShader8(iface); ULONG refcount = InterlockedDecrement(&shader->ref); TRACE("%p decreasing refcount to %u.\n", iface, refcount); @@ -232,7 +242,7 @@ static ULONG WINAPI d3d8_pixelshader_Release(IDirect3DPixelShader8 *iface) if (!refcount) { wined3d_mutex_lock(); - IWineD3DPixelShader_Release(shader->wineD3DPixelShader); + wined3d_shader_decref(shader->wined3d_shader); wined3d_mutex_unlock(); } @@ -263,12 +273,12 @@ HRESULT pixelshader_init(IDirect3DPixelShader8Impl *shader, IDirect3DDevice8Impl HRESULT hr; shader->ref = 1; - shader->lpVtbl = &d3d8_pixelshader_vtbl; + shader->IDirect3DPixelShader8_iface.lpVtbl = &d3d8_pixelshader_vtbl; shader->handle = shader_handle; wined3d_mutex_lock(); - hr = IWineD3DDevice_CreatePixelShader(device->WineD3DDevice, byte_code, NULL, shader, - &d3d8_pixelshader_wined3d_parent_ops, &shader->wineD3DPixelShader); + hr = wined3d_shader_create_ps(device->wined3d_device, byte_code, NULL, shader, + &d3d8_pixelshader_wined3d_parent_ops, &shader->wined3d_shader); wined3d_mutex_unlock(); if (FAILED(hr)) { diff --git a/dll/directx/wine/d3d8/surface.c b/dll/directx/wine/d3d8/surface.c index 6e59bd65f75..8a07244e604 100644 --- a/dll/directx/wine/d3d8/surface.c +++ b/dll/directx/wine/d3d8/surface.c @@ -61,7 +61,7 @@ static ULONG WINAPI IDirect3DSurface8Impl_AddRef(LPDIRECT3DSURFACE8 iface) { { if (This->parentDevice) IUnknown_AddRef(This->parentDevice); wined3d_mutex_lock(); - IUnknown_AddRef(This->wineD3DSurface); + wined3d_surface_incref(This->wined3d_surface); wined3d_mutex_unlock(); } @@ -89,7 +89,7 @@ static ULONG WINAPI IDirect3DSurface8Impl_Release(LPDIRECT3DSURFACE8 iface) { /* Implicit surfaces are destroyed with the device, not if refcount reaches 0. */ wined3d_mutex_lock(); - IWineD3DSurface_Release(This->wineD3DSurface); + wined3d_surface_decref(This->wined3d_surface); wined3d_mutex_unlock(); if (parentDevice) IDirect3DDevice8_Release(parentDevice); @@ -139,7 +139,7 @@ static HRESULT WINAPI IDirect3DSurface8Impl_SetPrivateData(LPDIRECT3DSURFACE8 if iface, debugstr_guid(refguid), pData, SizeOfData, Flags); wined3d_mutex_lock(); - hr = IWineD3DSurface_SetPrivateData(This->wineD3DSurface, refguid, pData, SizeOfData, Flags); + hr = wined3d_surface_set_private_data(This->wined3d_surface, refguid, pData, SizeOfData, Flags); wined3d_mutex_unlock(); return hr; @@ -153,7 +153,7 @@ static HRESULT WINAPI IDirect3DSurface8Impl_GetPrivateData(LPDIRECT3DSURFACE8 if iface, debugstr_guid(refguid), pData, pSizeOfData); wined3d_mutex_lock(); - hr = IWineD3DSurface_GetPrivateData(This->wineD3DSurface, refguid, pData, pSizeOfData); + hr = wined3d_surface_get_private_data(This->wined3d_surface, refguid, pData, pSizeOfData); wined3d_mutex_unlock(); return hr; @@ -166,7 +166,7 @@ static HRESULT WINAPI IDirect3DSurface8Impl_FreePrivateData(LPDIRECT3DSURFACE8 i TRACE("iface %p, guid %s.\n", iface, debugstr_guid(refguid)); wined3d_mutex_lock(); - hr = IWineD3DSurface_FreePrivateData(This->wineD3DSurface, refguid); + hr = wined3d_surface_free_private_data(This->wined3d_surface, refguid); wined3d_mutex_unlock(); return hr; @@ -187,24 +187,27 @@ static HRESULT WINAPI IDirect3DSurface8Impl_GetContainer(LPDIRECT3DSURFACE8 ifac return res; } -static HRESULT WINAPI IDirect3DSurface8Impl_GetDesc(LPDIRECT3DSURFACE8 iface, D3DSURFACE_DESC *pDesc) { +static HRESULT WINAPI IDirect3DSurface8Impl_GetDesc(IDirect3DSurface8 *iface, D3DSURFACE_DESC *desc) +{ IDirect3DSurface8Impl *This = (IDirect3DSurface8Impl *)iface; - WINED3DSURFACE_DESC wined3ddesc; + struct wined3d_resource_desc wined3d_desc; + struct wined3d_resource *wined3d_resource; - TRACE("iface %p, desc %p.\n", iface, pDesc); + TRACE("iface %p, desc %p.\n", iface, desc); wined3d_mutex_lock(); - IWineD3DSurface_GetDesc(This->wineD3DSurface, &wined3ddesc); + wined3d_resource = wined3d_surface_get_resource(This->wined3d_surface); + wined3d_resource_get_desc(wined3d_resource, &wined3d_desc); wined3d_mutex_unlock(); - pDesc->Format = d3dformat_from_wined3dformat(wined3ddesc.format); - pDesc->Type = wined3ddesc.resource_type; - pDesc->Usage = wined3ddesc.usage; - pDesc->Pool = wined3ddesc.pool; - pDesc->Size = wined3ddesc.size; - pDesc->MultiSampleType = wined3ddesc.multisample_type; - pDesc->Width = wined3ddesc.width; - pDesc->Height = wined3ddesc.height; + desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format); + desc->Type = wined3d_desc.resource_type; + desc->Usage = wined3d_desc.usage; + desc->Pool = wined3d_desc.pool; + desc->Size = wined3d_desc.size; + desc->MultiSampleType = wined3d_desc.multisample_type; + desc->Width = wined3d_desc.width; + desc->Height = wined3d_desc.height; return D3D_OK; } @@ -233,7 +236,7 @@ static HRESULT WINAPI IDirect3DSurface8Impl_LockRect(LPDIRECT3DSURFACE8 iface, D } } - hr = IWineD3DSurface_LockRect(This->wineD3DSurface, (WINED3DLOCKED_RECT *) pLockedRect, pRect, Flags); + hr = wined3d_surface_map(This->wined3d_surface, (WINED3DLOCKED_RECT *)pLockedRect, pRect, Flags); wined3d_mutex_unlock(); return hr; @@ -246,7 +249,7 @@ static HRESULT WINAPI IDirect3DSurface8Impl_UnlockRect(LPDIRECT3DSURFACE8 iface) TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - hr = IWineD3DSurface_UnlockRect(This->wineD3DSurface); + hr = wined3d_surface_unmap(This->wined3d_surface); wined3d_mutex_unlock(); switch(hr) @@ -301,9 +304,9 @@ HRESULT surface_init(IDirect3DSurface8Impl *surface, IDirect3DDevice8Impl *devic } wined3d_mutex_lock(); - hr = IWineD3DDevice_CreateSurface(device->WineD3DDevice, width, height, wined3dformat_from_d3dformat(format), + hr = wined3d_surface_create(device->wined3d_device, width, height, wined3dformat_from_d3dformat(format), lockable, discard, level, usage & WINED3DUSAGE_MASK, (WINED3DPOOL)pool, multisample_type, - multisample_quality, SURFACE_OPENGL, surface, &d3d8_surface_wined3d_parent_ops, &surface->wineD3DSurface); + multisample_quality, SURFACE_OPENGL, surface, &d3d8_surface_wined3d_parent_ops, &surface->wined3d_surface); wined3d_mutex_unlock(); if (FAILED(hr)) { @@ -311,7 +314,7 @@ HRESULT surface_init(IDirect3DSurface8Impl *surface, IDirect3DDevice8Impl *devic return hr; } - surface->parentDevice = (IDirect3DDevice8 *)device; + surface->parentDevice = &device->IDirect3DDevice8_iface; IUnknown_AddRef(surface->parentDevice); return D3D_OK; diff --git a/dll/directx/wine/d3d8/swapchain.c b/dll/directx/wine/d3d8/swapchain.c index 1c2a5357824..866335fcdc8 100644 --- a/dll/directx/wine/d3d8/swapchain.c +++ b/dll/directx/wine/d3d8/swapchain.c @@ -23,10 +23,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d8); -/* IDirect3DSwapChain IUnknown parts follow: */ -static HRESULT WINAPI IDirect3DSwapChain8Impl_QueryInterface(LPDIRECT3DSWAPCHAIN8 iface, REFIID riid, LPVOID* ppobj) +static inline IDirect3DSwapChain8Impl *impl_from_IDirect3DSwapChain8(IDirect3DSwapChain8 *iface) { - IDirect3DSwapChain8Impl *This = (IDirect3DSwapChain8Impl *)iface; + return CONTAINING_RECORD(iface, IDirect3DSwapChain8Impl, IDirect3DSwapChain8_iface); +} + +static HRESULT WINAPI IDirect3DSwapChain8Impl_QueryInterface(IDirect3DSwapChain8 *iface, + REFIID riid, void **ppobj) +{ + IDirect3DSwapChain8Impl *This = impl_from_IDirect3DSwapChain8(iface); TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), ppobj); @@ -42,42 +47,59 @@ static HRESULT WINAPI IDirect3DSwapChain8Impl_QueryInterface(LPDIRECT3DSWAPCHAIN return E_NOINTERFACE; } -static ULONG WINAPI IDirect3DSwapChain8Impl_AddRef(LPDIRECT3DSWAPCHAIN8 iface) { - IDirect3DSwapChain8Impl *This = (IDirect3DSwapChain8Impl *)iface; +static ULONG WINAPI IDirect3DSwapChain8Impl_AddRef(IDirect3DSwapChain8 *iface) +{ + IDirect3DSwapChain8Impl *This = impl_from_IDirect3DSwapChain8(iface); ULONG ref = InterlockedIncrement(&This->ref); TRACE("%p increasing refcount to %u.\n", iface, ref); + if (ref == 1) + { + if (This->parentDevice) + IDirect3DDevice8_AddRef(This->parentDevice); + wined3d_mutex_lock(); + wined3d_swapchain_incref(This->wined3d_swapchain); + wined3d_mutex_unlock(); + } + return ref; } -static ULONG WINAPI IDirect3DSwapChain8Impl_Release(LPDIRECT3DSWAPCHAIN8 iface) { - IDirect3DSwapChain8Impl *This = (IDirect3DSwapChain8Impl *)iface; +static ULONG WINAPI IDirect3DSwapChain8Impl_Release(IDirect3DSwapChain8 *iface) +{ + IDirect3DSwapChain8Impl *This = impl_from_IDirect3DSwapChain8(iface); ULONG ref = InterlockedDecrement(&This->ref); TRACE("%p decreasing refcount to %u.\n", iface, ref); - if (ref == 0) { + if (!ref) + { + IDirect3DDevice8 *parentDevice = This->parentDevice; + wined3d_mutex_lock(); - IWineD3DSwapChain_Destroy(This->wineD3DSwapChain); + wined3d_swapchain_decref(This->wined3d_swapchain); wined3d_mutex_unlock(); - if (This->parentDevice) IUnknown_Release(This->parentDevice); - HeapFree(GetProcessHeap(), 0, This); + if (parentDevice) + IDirect3DDevice8_Release(parentDevice); } return ref; } -/* IDirect3DSwapChain8 parts follow: */ -static HRESULT WINAPI IDirect3DSwapChain8Impl_Present(LPDIRECT3DSWAPCHAIN8 iface, CONST RECT *pSourceRect, CONST RECT *pDestRect, HWND hDestWindowOverride, CONST RGNDATA *pDirtyRegion) { - IDirect3DSwapChain8Impl *This = (IDirect3DSwapChain8Impl *)iface; +static HRESULT WINAPI IDirect3DSwapChain8Impl_Present(IDirect3DSwapChain8 *iface, + const RECT *pSourceRect, const RECT *pDestRect, HWND hDestWindowOverride, + const RGNDATA *pDirtyRegion) +{ + IDirect3DSwapChain8Impl *This = impl_from_IDirect3DSwapChain8(iface); HRESULT hr; TRACE("iface %p, src_rect %p, dst_rect %p, dst_window_override %p, dirty_region %p.\n", iface, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion); wined3d_mutex_lock(); - hr = IWineD3DSwapChain_Present(This->wineD3DSwapChain, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion, 0); + hr = wined3d_swapchain_present(This->wined3d_swapchain, pSourceRect, + pDestRect, hDestWindowOverride, pDirtyRegion, 0); wined3d_mutex_unlock(); return hr; @@ -86,21 +108,21 @@ static HRESULT WINAPI IDirect3DSwapChain8Impl_Present(LPDIRECT3DSWAPCHAIN8 iface static HRESULT WINAPI IDirect3DSwapChain8Impl_GetBackBuffer(IDirect3DSwapChain8 *iface, UINT iBackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface8 **ppBackBuffer) { - IDirect3DSwapChain8Impl *This = (IDirect3DSwapChain8Impl *)iface; - IWineD3DSurface *mySurface = NULL; + IDirect3DSwapChain8Impl *This = impl_from_IDirect3DSwapChain8(iface); + struct wined3d_surface *wined3d_surface = NULL; HRESULT hr; TRACE("iface %p, backbuffer_idx %u, backbuffer_type %#x, backbuffer %p.\n", iface, iBackBuffer, Type, ppBackBuffer); wined3d_mutex_lock(); - hr = IWineD3DSwapChain_GetBackBuffer(This->wineD3DSwapChain, iBackBuffer, - (WINED3DBACKBUFFER_TYPE)Type, &mySurface); - if (SUCCEEDED(hr) && mySurface) + hr = wined3d_swapchain_get_back_buffer(This->wined3d_swapchain, + iBackBuffer, (WINED3DBACKBUFFER_TYPE)Type, &wined3d_surface); + if (SUCCEEDED(hr) && wined3d_surface) { - *ppBackBuffer = IWineD3DSurface_GetParent(mySurface); + *ppBackBuffer = wined3d_surface_get_parent(wined3d_surface); IDirect3DSurface8_AddRef(*ppBackBuffer); - IWineD3DSurface_Release(mySurface); + wined3d_surface_decref(wined3d_surface); } wined3d_mutex_unlock(); @@ -116,6 +138,16 @@ static const IDirect3DSwapChain8Vtbl Direct3DSwapChain8_Vtbl = IDirect3DSwapChain8Impl_GetBackBuffer }; +static void STDMETHODCALLTYPE d3d8_swapchain_wined3d_object_released(void *parent) +{ + HeapFree(GetProcessHeap(), 0, parent); +} + +static const struct wined3d_parent_ops d3d8_swapchain_wined3d_parent_ops = +{ + d3d8_swapchain_wined3d_object_released, +}; + HRESULT swapchain_init(IDirect3DSwapChain8Impl *swapchain, IDirect3DDevice8Impl *device, D3DPRESENT_PARAMETERS *present_parameters) { @@ -123,7 +155,7 @@ HRESULT swapchain_init(IDirect3DSwapChain8Impl *swapchain, IDirect3DDevice8Impl HRESULT hr; swapchain->ref = 1; - swapchain->lpVtbl = &Direct3DSwapChain8_Vtbl; + swapchain->IDirect3DSwapChain8_iface.lpVtbl = &Direct3DSwapChain8_Vtbl; wined3d_parameters.BackBufferWidth = present_parameters->BackBufferWidth; wined3d_parameters.BackBufferHeight = present_parameters->BackBufferHeight; @@ -142,8 +174,9 @@ HRESULT swapchain_init(IDirect3DSwapChain8Impl *swapchain, IDirect3DDevice8Impl wined3d_parameters.AutoRestoreDisplayMode = TRUE; wined3d_mutex_lock(); - hr = IWineD3DDevice_CreateSwapChain(device->WineD3DDevice, &wined3d_parameters, - SURFACE_OPENGL, swapchain, &swapchain->wineD3DSwapChain); + hr = wined3d_swapchain_create(device->wined3d_device, &wined3d_parameters, + SURFACE_OPENGL, swapchain, &d3d8_swapchain_wined3d_parent_ops, + &swapchain->wined3d_swapchain); wined3d_mutex_unlock(); present_parameters->BackBufferWidth = wined3d_parameters.BackBufferWidth; @@ -166,7 +199,7 @@ HRESULT swapchain_init(IDirect3DSwapChain8Impl *swapchain, IDirect3DDevice8Impl return hr; } - swapchain->parentDevice = (IDirect3DDevice8 *)device; + swapchain->parentDevice = &device->IDirect3DDevice8_iface; IDirect3DDevice8_AddRef(swapchain->parentDevice); return D3D_OK; diff --git a/dll/directx/wine/d3d8/texture.c b/dll/directx/wine/d3d8/texture.c index a8421604862..1b9db9d2303 100644 --- a/dll/directx/wine/d3d8/texture.c +++ b/dll/directx/wine/d3d8/texture.c @@ -24,8 +24,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d8); /* IDirect3DTexture8 IUnknown parts follow: */ -static HRESULT WINAPI IDirect3DTexture8Impl_QueryInterface(LPDIRECT3DTEXTURE8 iface, REFIID riid, LPVOID *ppobj) { - IDirect3DTexture8Impl *This = (IDirect3DTexture8Impl *)iface; +static inline IDirect3DTexture8Impl *impl_from_IDirect3DTexture8(IDirect3DTexture8 *iface) +{ + return CONTAINING_RECORD(iface, IDirect3DTexture8Impl, IDirect3DTexture8_iface); +} + +static HRESULT WINAPI IDirect3DTexture8Impl_QueryInterface(IDirect3DTexture8 *iface, REFIID riid, + void **ppobj) +{ + IDirect3DTexture8Impl *This = impl_from_IDirect3DTexture8(iface); TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), ppobj); @@ -43,8 +50,9 @@ static HRESULT WINAPI IDirect3DTexture8Impl_QueryInterface(LPDIRECT3DTEXTURE8 if return E_NOINTERFACE; } -static ULONG WINAPI IDirect3DTexture8Impl_AddRef(LPDIRECT3DTEXTURE8 iface) { - IDirect3DTexture8Impl *This = (IDirect3DTexture8Impl *)iface; +static ULONG WINAPI IDirect3DTexture8Impl_AddRef(IDirect3DTexture8 *iface) +{ + IDirect3DTexture8Impl *This = impl_from_IDirect3DTexture8(iface); ULONG ref = InterlockedIncrement(&This->ref); TRACE("%p increasing refcount to %u.\n", iface, ref); @@ -53,15 +61,16 @@ static ULONG WINAPI IDirect3DTexture8Impl_AddRef(LPDIRECT3DTEXTURE8 iface) { { IDirect3DDevice8_AddRef(This->parentDevice); wined3d_mutex_lock(); - IWineD3DTexture_AddRef(This->wineD3DTexture); + wined3d_texture_incref(This->wined3d_texture); wined3d_mutex_unlock(); } return ref; } -static ULONG WINAPI IDirect3DTexture8Impl_Release(LPDIRECT3DTEXTURE8 iface) { - IDirect3DTexture8Impl *This = (IDirect3DTexture8Impl *)iface; +static ULONG WINAPI IDirect3DTexture8Impl_Release(IDirect3DTexture8 *iface) +{ + IDirect3DTexture8Impl *This = impl_from_IDirect3DTexture8(iface); ULONG ref = InterlockedDecrement(&This->ref); TRACE("%p decreasing refcount to %u.\n", iface, ref); @@ -70,7 +79,7 @@ static ULONG WINAPI IDirect3DTexture8Impl_Release(LPDIRECT3DTEXTURE8 iface) { IDirect3DDevice8 *parentDevice = This->parentDevice; wined3d_mutex_lock(); - IWineD3DTexture_Release(This->wineD3DTexture); + wined3d_texture_decref(This->wined3d_texture); wined3d_mutex_unlock(); /* Release the device last, as it may cause the device to be destroyed. */ @@ -80,9 +89,10 @@ static ULONG WINAPI IDirect3DTexture8Impl_Release(LPDIRECT3DTEXTURE8 iface) { } /* IDirect3DTexture8 IDirect3DResource8 Interface follow: */ -static HRESULT WINAPI IDirect3DTexture8Impl_GetDevice(IDirect3DTexture8 *iface, IDirect3DDevice8 **device) +static HRESULT WINAPI IDirect3DTexture8Impl_GetDevice(IDirect3DTexture8 *iface, + IDirect3DDevice8 **device) { - IDirect3DTexture8Impl *This = (IDirect3DTexture8Impl *)iface; + IDirect3DTexture8Impl *This = impl_from_IDirect3DTexture8(iface); TRACE("iface %p, device %p.\n", iface, device); @@ -94,220 +104,264 @@ static HRESULT WINAPI IDirect3DTexture8Impl_GetDevice(IDirect3DTexture8 *iface, return D3D_OK; } -static HRESULT WINAPI IDirect3DTexture8Impl_SetPrivateData(LPDIRECT3DTEXTURE8 iface, REFGUID refguid, CONST void *pData, DWORD SizeOfData, DWORD Flags) { - IDirect3DTexture8Impl *This = (IDirect3DTexture8Impl *)iface; +static HRESULT WINAPI IDirect3DTexture8Impl_SetPrivateData(IDirect3DTexture8 *iface, + REFGUID refguid, const void *pData, DWORD SizeOfData, DWORD Flags) +{ + IDirect3DTexture8Impl *This = impl_from_IDirect3DTexture8(iface); HRESULT hr; TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n", iface, debugstr_guid(refguid), pData, SizeOfData, Flags); wined3d_mutex_lock(); - hr = IWineD3DTexture_SetPrivateData(This->wineD3DTexture, refguid, pData, SizeOfData, Flags); + hr = wined3d_texture_set_private_data(This->wined3d_texture, refguid, pData, SizeOfData, Flags); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DTexture8Impl_GetPrivateData(LPDIRECT3DTEXTURE8 iface, REFGUID refguid, void *pData, DWORD* pSizeOfData) { - IDirect3DTexture8Impl *This = (IDirect3DTexture8Impl *)iface; +static HRESULT WINAPI IDirect3DTexture8Impl_GetPrivateData(IDirect3DTexture8 *iface, + REFGUID refguid, void *pData, DWORD *pSizeOfData) +{ + IDirect3DTexture8Impl *This = impl_from_IDirect3DTexture8(iface); HRESULT hr; TRACE("iface %p, guid %s, data %p, data_size %p.\n", iface, debugstr_guid(refguid), pData, pSizeOfData); wined3d_mutex_lock(); - hr = IWineD3DTexture_GetPrivateData(This->wineD3DTexture, refguid, pData, pSizeOfData); + hr = wined3d_texture_get_private_data(This->wined3d_texture, refguid, pData, pSizeOfData); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DTexture8Impl_FreePrivateData(LPDIRECT3DTEXTURE8 iface, REFGUID refguid) { - IDirect3DTexture8Impl *This = (IDirect3DTexture8Impl *)iface; +static HRESULT WINAPI IDirect3DTexture8Impl_FreePrivateData(IDirect3DTexture8 *iface, + REFGUID refguid) +{ + IDirect3DTexture8Impl *This = impl_from_IDirect3DTexture8(iface); HRESULT hr; TRACE("iface %p, guid %s.\n", iface, debugstr_guid(refguid)); wined3d_mutex_lock(); - hr = IWineD3DTexture_FreePrivateData(This->wineD3DTexture, refguid); + hr = wined3d_texture_free_private_data(This->wined3d_texture, refguid); wined3d_mutex_unlock(); return hr; } -static DWORD WINAPI IDirect3DTexture8Impl_SetPriority(LPDIRECT3DTEXTURE8 iface, DWORD PriorityNew) { - IDirect3DTexture8Impl *This = (IDirect3DTexture8Impl *)iface; +static DWORD WINAPI IDirect3DTexture8Impl_SetPriority(IDirect3DTexture8 *iface, DWORD PriorityNew) +{ + IDirect3DTexture8Impl *This = impl_from_IDirect3DTexture8(iface); DWORD ret; TRACE("iface %p, priority %u.\n", iface, PriorityNew); wined3d_mutex_lock(); - ret = IWineD3DTexture_SetPriority(This->wineD3DTexture, PriorityNew); + ret = wined3d_texture_set_priority(This->wined3d_texture, PriorityNew); wined3d_mutex_unlock(); return ret; } -static DWORD WINAPI IDirect3DTexture8Impl_GetPriority(LPDIRECT3DTEXTURE8 iface) { - IDirect3DTexture8Impl *This = (IDirect3DTexture8Impl *)iface; +static DWORD WINAPI IDirect3DTexture8Impl_GetPriority(IDirect3DTexture8 *iface) +{ + IDirect3DTexture8Impl *This = impl_from_IDirect3DTexture8(iface); DWORD ret; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - ret = IWineD3DTexture_GetPriority(This->wineD3DTexture); + ret = wined3d_texture_get_priority(This->wined3d_texture); wined3d_mutex_unlock(); return ret; } -static void WINAPI IDirect3DTexture8Impl_PreLoad(LPDIRECT3DTEXTURE8 iface) { - IDirect3DTexture8Impl *This = (IDirect3DTexture8Impl *)iface; +static void WINAPI IDirect3DTexture8Impl_PreLoad(IDirect3DTexture8 *iface) +{ + IDirect3DTexture8Impl *This = impl_from_IDirect3DTexture8(iface); TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - IWineD3DTexture_PreLoad(This->wineD3DTexture); + wined3d_texture_preload(This->wined3d_texture); wined3d_mutex_unlock(); } -static D3DRESOURCETYPE WINAPI IDirect3DTexture8Impl_GetType(LPDIRECT3DTEXTURE8 iface) { - IDirect3DTexture8Impl *This = (IDirect3DTexture8Impl *)iface; +static D3DRESOURCETYPE WINAPI IDirect3DTexture8Impl_GetType(IDirect3DTexture8 *iface) +{ + IDirect3DTexture8Impl *This = impl_from_IDirect3DTexture8(iface); D3DRESOURCETYPE type; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - type = IWineD3DTexture_GetType(This->wineD3DTexture); + type = wined3d_texture_get_type(This->wined3d_texture); wined3d_mutex_unlock(); return type; } /* IDirect3DTexture8 IDirect3DBaseTexture8 Interface follow: */ -static DWORD WINAPI IDirect3DTexture8Impl_SetLOD(LPDIRECT3DTEXTURE8 iface, DWORD LODNew) { - IDirect3DTexture8Impl *This = (IDirect3DTexture8Impl *)iface; +static DWORD WINAPI IDirect3DTexture8Impl_SetLOD(IDirect3DTexture8 *iface, DWORD LODNew) +{ + IDirect3DTexture8Impl *This = impl_from_IDirect3DTexture8(iface); DWORD ret; TRACE("iface %p, lod %u.\n", iface, LODNew); wined3d_mutex_lock(); - ret = IWineD3DTexture_SetLOD(This->wineD3DTexture, LODNew); + ret = wined3d_texture_set_lod(This->wined3d_texture, LODNew); wined3d_mutex_unlock(); return ret; } -static DWORD WINAPI IDirect3DTexture8Impl_GetLOD(LPDIRECT3DTEXTURE8 iface) { - IDirect3DTexture8Impl *This = (IDirect3DTexture8Impl *)iface; +static DWORD WINAPI IDirect3DTexture8Impl_GetLOD(IDirect3DTexture8 *iface) +{ + IDirect3DTexture8Impl *This = impl_from_IDirect3DTexture8(iface); DWORD ret; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - ret = IWineD3DTexture_GetLOD(This->wineD3DTexture); + ret = wined3d_texture_get_lod(This->wined3d_texture); wined3d_mutex_unlock(); return ret; } -static DWORD WINAPI IDirect3DTexture8Impl_GetLevelCount(LPDIRECT3DTEXTURE8 iface) { - IDirect3DTexture8Impl *This = (IDirect3DTexture8Impl *)iface; +static DWORD WINAPI IDirect3DTexture8Impl_GetLevelCount(IDirect3DTexture8 *iface) +{ + IDirect3DTexture8Impl *This = impl_from_IDirect3DTexture8(iface); DWORD ret; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - ret = IWineD3DTexture_GetLevelCount(This->wineD3DTexture); + ret = wined3d_texture_get_level_count(This->wined3d_texture); wined3d_mutex_unlock(); return ret; } -/* IDirect3DTexture8 Interface follow: */ -static HRESULT WINAPI IDirect3DTexture8Impl_GetLevelDesc(LPDIRECT3DTEXTURE8 iface, UINT Level, D3DSURFACE_DESC *pDesc) { - IDirect3DTexture8Impl *This = (IDirect3DTexture8Impl *)iface; - WINED3DSURFACE_DESC wined3ddesc; - HRESULT hr; +static HRESULT WINAPI IDirect3DTexture8Impl_GetLevelDesc(IDirect3DTexture8 *iface, + UINT level, D3DSURFACE_DESC *desc) +{ + IDirect3DTexture8Impl *texture = impl_from_IDirect3DTexture8(iface); + struct wined3d_resource *sub_resource; + HRESULT hr = D3D_OK; - TRACE("iface %p, level %u, desc %p.\n", iface, Level, pDesc); + TRACE("iface %p, level %u, desc %p.\n", iface, level, desc); wined3d_mutex_lock(); - hr = IWineD3DTexture_GetLevelDesc(This->wineD3DTexture, Level, &wined3ddesc); - wined3d_mutex_unlock(); - - if (SUCCEEDED(hr)) + if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, level))) + hr = D3DERR_INVALIDCALL; + else { - pDesc->Format = d3dformat_from_wined3dformat(wined3ddesc.format); - pDesc->Type = wined3ddesc.resource_type; - pDesc->Usage = wined3ddesc.usage; - pDesc->Pool = wined3ddesc.pool; - pDesc->Size = wined3ddesc.size; - pDesc->MultiSampleType = wined3ddesc.multisample_type; - pDesc->Width = wined3ddesc.width; - pDesc->Height = wined3ddesc.height; + struct wined3d_resource_desc wined3d_desc; + + wined3d_resource_get_desc(sub_resource, &wined3d_desc); + desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format); + desc->Type = wined3d_desc.resource_type; + desc->Usage = wined3d_desc.usage; + desc->Pool = wined3d_desc.pool; + desc->Size = wined3d_desc.size; + desc->MultiSampleType = wined3d_desc.multisample_type; + desc->Width = wined3d_desc.width; + desc->Height = wined3d_desc.height; } + wined3d_mutex_unlock(); return hr; } static HRESULT WINAPI IDirect3DTexture8Impl_GetSurfaceLevel(IDirect3DTexture8 *iface, - UINT Level, IDirect3DSurface8 **ppSurfaceLevel) + UINT level, IDirect3DSurface8 **surface) { - IDirect3DTexture8Impl *This = (IDirect3DTexture8Impl *)iface; - IWineD3DSurface *mySurface = NULL; - HRESULT hr; + IDirect3DTexture8Impl *texture = impl_from_IDirect3DTexture8(iface); + struct wined3d_resource *sub_resource; - TRACE("iface %p, level %u, surface %p.\n", iface, Level, ppSurfaceLevel); + TRACE("iface %p, level %u, surface %p.\n", iface, level, surface); wined3d_mutex_lock(); - hr = IWineD3DTexture_GetSurfaceLevel(This->wineD3DTexture, Level, &mySurface); - if (SUCCEEDED(hr) && ppSurfaceLevel) + if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, level))) { - *ppSurfaceLevel = IWineD3DSurface_GetParent(mySurface); - IDirect3DSurface8_AddRef(*ppSurfaceLevel); - IWineD3DSurface_Release(mySurface); + wined3d_mutex_unlock(); + return D3DERR_INVALIDCALL; } + + *surface = wined3d_resource_get_parent(sub_resource); + IDirect3DSurface8_AddRef(*surface); wined3d_mutex_unlock(); - return hr; + return D3D_OK; } -static HRESULT WINAPI IDirect3DTexture8Impl_LockRect(LPDIRECT3DTEXTURE8 iface, UINT Level, D3DLOCKED_RECT *pLockedRect, CONST RECT *pRect, DWORD Flags) { - IDirect3DTexture8Impl *This = (IDirect3DTexture8Impl *)iface; +static HRESULT WINAPI IDirect3DTexture8Impl_LockRect(IDirect3DTexture8 *iface, UINT level, + D3DLOCKED_RECT *locked_rect, const RECT *rect, DWORD flags) +{ + IDirect3DTexture8Impl *texture = impl_from_IDirect3DTexture8(iface); + struct wined3d_resource *sub_resource; HRESULT hr; TRACE("iface %p, level %u, locked_rect %p, rect %p, flags %#x.\n", - iface, Level, pLockedRect, pRect, Flags); + iface, level, locked_rect, rect, flags); wined3d_mutex_lock(); - hr = IWineD3DTexture_LockRect(This->wineD3DTexture, Level, (WINED3DLOCKED_RECT *) pLockedRect, pRect, Flags); + if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, level))) + hr = D3DERR_INVALIDCALL; + else + hr = IDirect3DSurface8_LockRect((IDirect3DSurface8 *)wined3d_resource_get_parent(sub_resource), + locked_rect, rect, flags); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DTexture8Impl_UnlockRect(LPDIRECT3DTEXTURE8 iface, UINT Level) { - IDirect3DTexture8Impl *This = (IDirect3DTexture8Impl *)iface; +static HRESULT WINAPI IDirect3DTexture8Impl_UnlockRect(IDirect3DTexture8 *iface, UINT level) +{ + IDirect3DTexture8Impl *texture = impl_from_IDirect3DTexture8(iface); + struct wined3d_resource *sub_resource; HRESULT hr; - TRACE("iface %p, level %u.\n", iface, Level); + TRACE("iface %p, level %u.\n", iface, level); wined3d_mutex_lock(); - hr = IWineD3DTexture_UnlockRect(This->wineD3DTexture, Level); + if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, level))) + hr = D3DERR_INVALIDCALL; + else + hr = IDirect3DSurface8_UnlockRect((IDirect3DSurface8 *)wined3d_resource_get_parent(sub_resource)); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DTexture8Impl_AddDirtyRect(LPDIRECT3DTEXTURE8 iface, CONST RECT *pDirtyRect) { - IDirect3DTexture8Impl *This = (IDirect3DTexture8Impl *)iface; +static HRESULT WINAPI IDirect3DTexture8Impl_AddDirtyRect(IDirect3DTexture8 *iface, const RECT *dirty_rect) +{ + IDirect3DTexture8Impl *texture = impl_from_IDirect3DTexture8(iface); HRESULT hr; - TRACE("iface %p, dirty_rect %p.\n", iface, pDirtyRect); + TRACE("iface %p, dirty_rect %s.\n", + iface, wine_dbgstr_rect(dirty_rect)); wined3d_mutex_lock(); - hr = IWineD3DTexture_AddDirtyRect(This->wineD3DTexture, pDirtyRect); + if (!dirty_rect) + hr = wined3d_texture_add_dirty_region(texture->wined3d_texture, 0, NULL); + else + { + WINED3DBOX dirty_region; + + dirty_region.Left = dirty_rect->left; + dirty_region.Top = dirty_rect->top; + dirty_region.Right = dirty_rect->right; + dirty_region.Bottom = dirty_rect->bottom; + dirty_region.Front = 0; + dirty_region.Back = 1; + hr = wined3d_texture_add_dirty_region(texture->wined3d_texture, 0, &dirty_region); + } wined3d_mutex_unlock(); return hr; @@ -355,13 +409,13 @@ HRESULT texture_init(IDirect3DTexture8Impl *texture, IDirect3DDevice8Impl *devic { HRESULT hr; - texture->lpVtbl = &Direct3DTexture8_Vtbl; + texture->IDirect3DTexture8_iface.lpVtbl = &Direct3DTexture8_Vtbl; texture->ref = 1; wined3d_mutex_lock(); - hr = IWineD3DDevice_CreateTexture(device->WineD3DDevice, width, height, levels, + hr = wined3d_texture_create_2d(device->wined3d_device, width, height, levels, usage & WINED3DUSAGE_MASK, wined3dformat_from_d3dformat(format), pool, - texture, &d3d8_texture_wined3d_parent_ops, &texture->wineD3DTexture); + texture, &d3d8_texture_wined3d_parent_ops, &texture->wined3d_texture); wined3d_mutex_unlock(); if (FAILED(hr)) { @@ -369,7 +423,7 @@ HRESULT texture_init(IDirect3DTexture8Impl *texture, IDirect3DDevice8Impl *devic return hr; } - texture->parentDevice = (IDirect3DDevice8 *)device; + texture->parentDevice = &device->IDirect3DDevice8_iface; IDirect3DDevice8_AddRef(texture->parentDevice); return D3D_OK; diff --git a/dll/directx/wine/d3d8/vertexdeclaration.c b/dll/directx/wine/d3d8/vertexdeclaration.c index 58573a50f84..78a59d11ad5 100644 --- a/dll/directx/wine/d3d8/vertexdeclaration.c +++ b/dll/directx/wine/d3d8/vertexdeclaration.c @@ -53,7 +53,7 @@ static ULONG WINAPI IDirect3DVertexDeclaration8Impl_AddRef(IDirect3DVertexDeclar if (ref_count == 1) { wined3d_mutex_lock(); - IWineD3DVertexDeclaration_AddRef(This->wined3d_vertex_declaration); + wined3d_vertex_declaration_incref(This->wined3d_vertex_declaration); wined3d_mutex_unlock(); } @@ -69,7 +69,7 @@ static ULONG WINAPI IDirect3DVertexDeclaration8Impl_Release(IDirect3DVertexDecla if (!ref_count) { wined3d_mutex_lock(); - IWineD3DVertexDeclaration_Release(This->wined3d_vertex_declaration); + wined3d_vertex_declaration_decref(This->wined3d_vertex_declaration); wined3d_mutex_unlock(); } @@ -199,7 +199,7 @@ size_t parse_token(const DWORD* pToken) return tokenlen; } -void load_local_constants(const DWORD *d3d8_elements, IWineD3DVertexShader *wined3d_vertex_shader) +void load_local_constants(const DWORD *d3d8_elements, struct wined3d_shader *wined3d_vertex_shader) { const DWORD *token = d3d8_elements; @@ -224,7 +224,8 @@ void load_local_constants(const DWORD *d3d8_elements, IWineD3DVertexShader *wine *(const float *)(token + i * 4 + 4)); } } - hr = IWineD3DVertexShader_SetLocalConstantsF(wined3d_vertex_shader, constant_idx, (const float *)token+1, count); + hr = wined3d_shader_set_local_constants_float(wined3d_vertex_shader, + constant_idx, (const float *)token + 1, count); if (FAILED(hr)) ERR("Failed setting shader constants\n"); } @@ -308,7 +309,7 @@ static UINT convert_to_wined3d_declaration(const DWORD *d3d8_elements, DWORD *d3 WINED3DVERTEXELEMENT *element; D3DVSD_TOKENTYPE token_type; unsigned int element_count = 0; - DWORD stream = 0; + WORD stream = 0; int offset = 0; TRACE("d3d8_elements %p, wined3d_elements %p\n", d3d8_elements, wined3d_elements); @@ -399,7 +400,7 @@ HRESULT vertexdeclaration_init(IDirect3DVertexDeclaration8Impl *declaration, memcpy(declaration->elements, elements, declaration->elements_size); wined3d_mutex_lock(); - hr = IWineD3DDevice_CreateVertexDeclaration(device->WineD3DDevice, wined3d_elements, wined3d_element_count, + hr = wined3d_vertex_declaration_create(device->wined3d_device, wined3d_elements, wined3d_element_count, declaration, &d3d8_vertexdeclaration_wined3d_parent_ops, &declaration->wined3d_vertex_declaration); wined3d_mutex_unlock(); HeapFree(GetProcessHeap(), 0, wined3d_elements); @@ -424,7 +425,7 @@ HRESULT vertexdeclaration_init_fvf(IDirect3DVertexDeclaration8Impl *declaration, declaration->elements_size = 0; declaration->shader_handle = fvf; - hr = IWineD3DDevice_CreateVertexDeclarationFromFVF(device->WineD3DDevice, fvf, declaration, + hr = wined3d_vertex_declaration_create_from_fvf(device->wined3d_device, fvf, declaration, &d3d8_vertexdeclaration_wined3d_parent_ops, &declaration->wined3d_vertex_declaration); if (FAILED(hr)) { diff --git a/dll/directx/wine/d3d8/volume.c b/dll/directx/wine/d3d8/volume.c index 1705822cf5d..2726880aa83 100644 --- a/dll/directx/wine/d3d8/volume.c +++ b/dll/directx/wine/d3d8/volume.c @@ -23,9 +23,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d8); -/* IDirect3DVolume8 IUnknown parts follow: */ -static HRESULT WINAPI IDirect3DVolume8Impl_QueryInterface(LPDIRECT3DVOLUME8 iface, REFIID riid, LPVOID *ppobj) { - IDirect3DVolume8Impl *This = (IDirect3DVolume8Impl *)iface; +static inline IDirect3DVolume8Impl *impl_from_IDirect3DVolume8(IDirect3DVolume8 *iface) +{ + return CONTAINING_RECORD(iface, IDirect3DVolume8Impl, IDirect3DVolume8_iface); +} + +static HRESULT WINAPI IDirect3DVolume8Impl_QueryInterface(IDirect3DVolume8 *iface, REFIID riid, + void **ppobj) +{ + IDirect3DVolume8Impl *This = impl_from_IDirect3DVolume8(iface); TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), ppobj); @@ -41,8 +47,9 @@ static HRESULT WINAPI IDirect3DVolume8Impl_QueryInterface(LPDIRECT3DVOLUME8 ifac return E_NOINTERFACE; } -static ULONG WINAPI IDirect3DVolume8Impl_AddRef(LPDIRECT3DVOLUME8 iface) { - IDirect3DVolume8Impl *This = (IDirect3DVolume8Impl *)iface; +static ULONG WINAPI IDirect3DVolume8Impl_AddRef(IDirect3DVolume8 *iface) +{ + IDirect3DVolume8Impl *This = impl_from_IDirect3DVolume8(iface); TRACE("iface %p.\n", iface); @@ -59,7 +66,7 @@ static ULONG WINAPI IDirect3DVolume8Impl_AddRef(LPDIRECT3DVOLUME8 iface) { if (ref == 1) { wined3d_mutex_lock(); - IWineD3DVolume_AddRef(This->wineD3DVolume); + wined3d_volume_incref(This->wined3d_volume); wined3d_mutex_unlock(); } @@ -67,8 +74,9 @@ static ULONG WINAPI IDirect3DVolume8Impl_AddRef(LPDIRECT3DVOLUME8 iface) { } } -static ULONG WINAPI IDirect3DVolume8Impl_Release(LPDIRECT3DVOLUME8 iface) { - IDirect3DVolume8Impl *This = (IDirect3DVolume8Impl *)iface; +static ULONG WINAPI IDirect3DVolume8Impl_Release(IDirect3DVolume8 *iface) +{ + IDirect3DVolume8Impl *This = impl_from_IDirect3DVolume8(iface); TRACE("iface %p.\n", iface); @@ -85,7 +93,7 @@ static ULONG WINAPI IDirect3DVolume8Impl_Release(LPDIRECT3DVOLUME8 iface) { if (ref == 0) { wined3d_mutex_lock(); - IWineD3DVolume_Release(This->wineD3DVolume); + wined3d_volume_decref(This->wined3d_volume); wined3d_mutex_unlock(); } @@ -93,10 +101,10 @@ static ULONG WINAPI IDirect3DVolume8Impl_Release(LPDIRECT3DVOLUME8 iface) { } } -/* IDirect3DVolume8 Interface follow: */ -static HRESULT WINAPI IDirect3DVolume8Impl_GetDevice(IDirect3DVolume8 *iface, IDirect3DDevice8 **device) +static HRESULT WINAPI IDirect3DVolume8Impl_GetDevice(IDirect3DVolume8 *iface, + IDirect3DDevice8 **device) { - IDirect3DVolume8Impl *This = (IDirect3DVolume8Impl *)iface; + IDirect3DVolume8Impl *This = impl_from_IDirect3DVolume8(iface); IDirect3DResource8 *resource; HRESULT hr; @@ -114,49 +122,56 @@ static HRESULT WINAPI IDirect3DVolume8Impl_GetDevice(IDirect3DVolume8 *iface, ID return hr; } -static HRESULT WINAPI IDirect3DVolume8Impl_SetPrivateData(LPDIRECT3DVOLUME8 iface, REFGUID refguid, CONST void *pData, DWORD SizeOfData, DWORD Flags) { - IDirect3DVolume8Impl *This = (IDirect3DVolume8Impl *)iface; +static HRESULT WINAPI IDirect3DVolume8Impl_SetPrivateData(IDirect3DVolume8 *iface, REFGUID refguid, + const void *pData, DWORD SizeOfData, DWORD Flags) +{ + IDirect3DVolume8Impl *This = impl_from_IDirect3DVolume8(iface); HRESULT hr; TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n", iface, debugstr_guid(refguid), pData, SizeOfData, Flags); wined3d_mutex_lock(); - hr = IWineD3DVolume_SetPrivateData(This->wineD3DVolume, refguid, pData, SizeOfData, Flags); + hr = wined3d_volume_set_private_data(This->wined3d_volume, refguid, pData, SizeOfData, Flags); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DVolume8Impl_GetPrivateData(LPDIRECT3DVOLUME8 iface, REFGUID refguid, void *pData, DWORD* pSizeOfData) { - IDirect3DVolume8Impl *This = (IDirect3DVolume8Impl *)iface; +static HRESULT WINAPI IDirect3DVolume8Impl_GetPrivateData(IDirect3DVolume8 *iface, REFGUID refguid, + void *pData, DWORD *pSizeOfData) +{ + IDirect3DVolume8Impl *This = impl_from_IDirect3DVolume8(iface); HRESULT hr; TRACE("iface %p, guid %s, data %p, data_size %p.\n", iface, debugstr_guid(refguid), pData, pSizeOfData); wined3d_mutex_lock(); - hr = IWineD3DVolume_GetPrivateData(This->wineD3DVolume, refguid, pData, pSizeOfData); + hr = wined3d_volume_get_private_data(This->wined3d_volume, refguid, pData, pSizeOfData); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DVolume8Impl_FreePrivateData(LPDIRECT3DVOLUME8 iface, REFGUID refguid) { - IDirect3DVolume8Impl *This = (IDirect3DVolume8Impl *)iface; +static HRESULT WINAPI IDirect3DVolume8Impl_FreePrivateData(IDirect3DVolume8 *iface, REFGUID refguid) +{ + IDirect3DVolume8Impl *This = impl_from_IDirect3DVolume8(iface); HRESULT hr; TRACE("iface %p, guid %s.\n", iface, debugstr_guid(refguid)); wined3d_mutex_lock(); - hr = IWineD3DVolume_FreePrivateData(This->wineD3DVolume, refguid); + hr = wined3d_volume_free_private_data(This->wined3d_volume, refguid); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DVolume8Impl_GetContainer(LPDIRECT3DVOLUME8 iface, REFIID riid, void **ppContainer) { - IDirect3DVolume8Impl *This = (IDirect3DVolume8Impl *)iface; +static HRESULT WINAPI IDirect3DVolume8Impl_GetContainer(IDirect3DVolume8 *iface, REFIID riid, + void **ppContainer) +{ + IDirect3DVolume8Impl *This = impl_from_IDirect3DVolume8(iface); HRESULT res; TRACE("iface %p, riid %s, container %p.\n", @@ -164,10 +179,6 @@ static HRESULT WINAPI IDirect3DVolume8Impl_GetContainer(LPDIRECT3DVOLUME8 iface, if (!This->container) return E_NOINTERFACE; - if (!ppContainer) { - ERR("Called without a valid ppContainer.\n"); - } - res = IUnknown_QueryInterface(This->container, riid, ppContainer); TRACE("Returning ppContainer %p, *ppContainer %p\n", ppContainer, *ppContainer); @@ -175,50 +186,57 @@ static HRESULT WINAPI IDirect3DVolume8Impl_GetContainer(LPDIRECT3DVOLUME8 iface, return res; } -static HRESULT WINAPI IDirect3DVolume8Impl_GetDesc(LPDIRECT3DVOLUME8 iface, D3DVOLUME_DESC *pDesc) { - IDirect3DVolume8Impl *This = (IDirect3DVolume8Impl *)iface; - WINED3DVOLUME_DESC wined3ddesc; +static HRESULT WINAPI IDirect3DVolume8Impl_GetDesc(IDirect3DVolume8 *iface, D3DVOLUME_DESC *desc) +{ + IDirect3DVolume8Impl *This = impl_from_IDirect3DVolume8(iface); + struct wined3d_resource_desc wined3d_desc; + struct wined3d_resource *wined3d_resource; - TRACE("iface %p, desc %p.\n", iface, pDesc); + TRACE("iface %p, desc %p.\n", iface, desc); wined3d_mutex_lock(); - IWineD3DVolume_GetDesc(This->wineD3DVolume, &wined3ddesc); + wined3d_resource = wined3d_volume_get_resource(This->wined3d_volume); + wined3d_resource_get_desc(wined3d_resource, &wined3d_desc); wined3d_mutex_unlock(); - pDesc->Format = d3dformat_from_wined3dformat(wined3ddesc.Format); - pDesc->Type = wined3ddesc.Type; - pDesc->Usage = wined3ddesc.Usage; - pDesc->Pool = wined3ddesc.Pool; - pDesc->Size = wined3ddesc.Size; - pDesc->Width = wined3ddesc.Width; - pDesc->Height = wined3ddesc.Height; - pDesc->Depth = wined3ddesc.Depth; + desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format); + desc->Type = wined3d_desc.resource_type; + desc->Usage = wined3d_desc.usage; + desc->Pool = wined3d_desc.pool; + desc->Size = wined3d_desc.size; + desc->Width = wined3d_desc.width; + desc->Height = wined3d_desc.height; + desc->Depth = wined3d_desc.depth; return D3D_OK; } -static HRESULT WINAPI IDirect3DVolume8Impl_LockBox(LPDIRECT3DVOLUME8 iface, D3DLOCKED_BOX *pLockedVolume, CONST D3DBOX *pBox, DWORD Flags) { - IDirect3DVolume8Impl *This = (IDirect3DVolume8Impl *)iface; +static HRESULT WINAPI IDirect3DVolume8Impl_LockBox(IDirect3DVolume8 *iface, + D3DLOCKED_BOX *pLockedVolume, const D3DBOX *pBox, DWORD Flags) +{ + IDirect3DVolume8Impl *This = impl_from_IDirect3DVolume8(iface); HRESULT hr; TRACE("iface %p, locked_box %p, box %p, flags %#x.\n", iface, pLockedVolume, pBox, Flags); wined3d_mutex_lock(); - hr = IWineD3DVolume_LockBox(This->wineD3DVolume, (WINED3DLOCKED_BOX *) pLockedVolume, (CONST WINED3DBOX *) pBox, Flags); + hr = wined3d_volume_map(This->wined3d_volume, (WINED3DLOCKED_BOX *)pLockedVolume, + (const WINED3DBOX *)pBox, Flags); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DVolume8Impl_UnlockBox(LPDIRECT3DVOLUME8 iface) { - IDirect3DVolume8Impl *This = (IDirect3DVolume8Impl *)iface; +static HRESULT WINAPI IDirect3DVolume8Impl_UnlockBox(IDirect3DVolume8 *iface) +{ + IDirect3DVolume8Impl *This = impl_from_IDirect3DVolume8(iface); HRESULT hr; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - hr = IWineD3DVolume_UnlockBox(This->wineD3DVolume); + hr = wined3d_volume_unmap(This->wined3d_volume); wined3d_mutex_unlock(); return hr; @@ -256,11 +274,11 @@ HRESULT volume_init(IDirect3DVolume8Impl *volume, IDirect3DDevice8Impl *device, { HRESULT hr; - volume->lpVtbl = &Direct3DVolume8_Vtbl; + volume->IDirect3DVolume8_iface.lpVtbl = &Direct3DVolume8_Vtbl; volume->ref = 1; - hr = IWineD3DDevice_CreateVolume(device->WineD3DDevice, width, height, depth, usage, - format, pool, volume, &d3d8_volume_wined3d_parent_ops, &volume->wineD3DVolume); + hr = wined3d_volume_create(device->wined3d_device, width, height, depth, usage, + format, pool, volume, &d3d8_volume_wined3d_parent_ops, &volume->wined3d_volume); if (FAILED(hr)) { WARN("Failed to create wined3d volume, hr %#x.\n", hr); diff --git a/dll/directx/wine/d3d8/volumetexture.c b/dll/directx/wine/d3d8/volumetexture.c index bd72d68e916..08e36807bba 100644 --- a/dll/directx/wine/d3d8/volumetexture.c +++ b/dll/directx/wine/d3d8/volumetexture.c @@ -23,9 +23,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d8); -/* IDirect3DVolumeTexture8 IUnknown parts follow: */ -static HRESULT WINAPI IDirect3DVolumeTexture8Impl_QueryInterface(LPDIRECT3DVOLUMETEXTURE8 iface, REFIID riid, LPVOID *ppobj) { - IDirect3DVolumeTexture8Impl *This = (IDirect3DVolumeTexture8Impl *)iface; +static inline IDirect3DVolumeTexture8Impl *impl_from_IDirect3DVolumeTexture8(IDirect3DVolumeTexture8 *iface) +{ + return CONTAINING_RECORD(iface, IDirect3DVolumeTexture8Impl, IDirect3DVolumeTexture8_iface); +} + +static HRESULT WINAPI IDirect3DVolumeTexture8Impl_QueryInterface(IDirect3DVolumeTexture8 *iface, + REFIID riid, void **ppobj) +{ + IDirect3DVolumeTexture8Impl *This = impl_from_IDirect3DVolumeTexture8(iface); TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), ppobj); @@ -43,8 +49,9 @@ static HRESULT WINAPI IDirect3DVolumeTexture8Impl_QueryInterface(LPDIRECT3DVOLUM return E_NOINTERFACE; } -static ULONG WINAPI IDirect3DVolumeTexture8Impl_AddRef(LPDIRECT3DVOLUMETEXTURE8 iface) { - IDirect3DVolumeTexture8Impl *This = (IDirect3DVolumeTexture8Impl *)iface; +static ULONG WINAPI IDirect3DVolumeTexture8Impl_AddRef(IDirect3DVolumeTexture8 *iface) +{ + IDirect3DVolumeTexture8Impl *This = impl_from_IDirect3DVolumeTexture8(iface); ULONG ref = InterlockedIncrement(&This->ref); TRACE("%p increasing refcount to %u.\n", iface, ref); @@ -53,15 +60,16 @@ static ULONG WINAPI IDirect3DVolumeTexture8Impl_AddRef(LPDIRECT3DVOLUMETEXTURE8 { IDirect3DDevice8_AddRef(This->parentDevice); wined3d_mutex_lock(); - IWineD3DVolumeTexture_AddRef(This->wineD3DVolumeTexture); + wined3d_texture_incref(This->wined3d_texture); wined3d_mutex_unlock(); } return ref; } -static ULONG WINAPI IDirect3DVolumeTexture8Impl_Release(LPDIRECT3DVOLUMETEXTURE8 iface) { - IDirect3DVolumeTexture8Impl *This = (IDirect3DVolumeTexture8Impl *)iface; +static ULONG WINAPI IDirect3DVolumeTexture8Impl_Release(IDirect3DVolumeTexture8 *iface) +{ + IDirect3DVolumeTexture8Impl *This = impl_from_IDirect3DVolumeTexture8(iface); ULONG ref = InterlockedDecrement(&This->ref); TRACE("%p decreasing refcount to %u.\n", iface, ref); @@ -70,7 +78,7 @@ static ULONG WINAPI IDirect3DVolumeTexture8Impl_Release(LPDIRECT3DVOLUMETEXTURE8 IDirect3DDevice8 *parentDevice = This->parentDevice; wined3d_mutex_lock(); - IWineD3DVolumeTexture_Release(This->wineD3DVolumeTexture); + wined3d_texture_decref(This->wined3d_texture); wined3d_mutex_unlock(); /* Release the device last, as it may cause the device to be destroyed. */ @@ -80,9 +88,10 @@ static ULONG WINAPI IDirect3DVolumeTexture8Impl_Release(LPDIRECT3DVOLUMETEXTURE8 } /* IDirect3DVolumeTexture8 IDirect3DResource8 Interface follow: */ -static HRESULT WINAPI IDirect3DVolumeTexture8Impl_GetDevice(IDirect3DVolumeTexture8 *iface, IDirect3DDevice8 **device) +static HRESULT WINAPI IDirect3DVolumeTexture8Impl_GetDevice(IDirect3DVolumeTexture8 *iface, + IDirect3DDevice8 **device) { - IDirect3DVolumeTexture8Impl *This = (IDirect3DVolumeTexture8Impl *)iface; + IDirect3DVolumeTexture8Impl *This = impl_from_IDirect3DVolumeTexture8(iface); TRACE("iface %p, device %p.\n", iface, device); @@ -94,220 +103,253 @@ static HRESULT WINAPI IDirect3DVolumeTexture8Impl_GetDevice(IDirect3DVolumeTextu return D3D_OK; } -static HRESULT WINAPI IDirect3DVolumeTexture8Impl_SetPrivateData(LPDIRECT3DVOLUMETEXTURE8 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) { - IDirect3DVolumeTexture8Impl *This = (IDirect3DVolumeTexture8Impl *)iface; +static HRESULT WINAPI IDirect3DVolumeTexture8Impl_SetPrivateData(IDirect3DVolumeTexture8 *iface, + REFGUID refguid, const void *pData, DWORD SizeOfData, DWORD Flags) +{ + IDirect3DVolumeTexture8Impl *This = impl_from_IDirect3DVolumeTexture8(iface); HRESULT hr; TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n", iface, debugstr_guid(refguid), pData, SizeOfData, Flags); wined3d_mutex_lock(); - hr = IWineD3DVolumeTexture_SetPrivateData(This->wineD3DVolumeTexture, refguid, pData, SizeOfData, Flags); + hr = wined3d_texture_set_private_data(This->wined3d_texture, refguid, pData, SizeOfData, Flags); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DVolumeTexture8Impl_GetPrivateData(LPDIRECT3DVOLUMETEXTURE8 iface, REFGUID refguid, void *pData, DWORD *pSizeOfData) { - IDirect3DVolumeTexture8Impl *This = (IDirect3DVolumeTexture8Impl *)iface; +static HRESULT WINAPI IDirect3DVolumeTexture8Impl_GetPrivateData(IDirect3DVolumeTexture8 *iface, + REFGUID refguid, void *pData, DWORD *pSizeOfData) +{ + IDirect3DVolumeTexture8Impl *This = impl_from_IDirect3DVolumeTexture8(iface); HRESULT hr; TRACE("iface %p, guid %s, data %p, data_size %p.\n", iface, debugstr_guid(refguid), pData, pSizeOfData); wined3d_mutex_lock(); - hr = IWineD3DVolumeTexture_GetPrivateData(This->wineD3DVolumeTexture, refguid, pData, pSizeOfData); + hr = wined3d_texture_get_private_data(This->wined3d_texture, refguid, pData, pSizeOfData); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DVolumeTexture8Impl_FreePrivateData(LPDIRECT3DVOLUMETEXTURE8 iface, REFGUID refguid) { - IDirect3DVolumeTexture8Impl *This = (IDirect3DVolumeTexture8Impl *)iface; +static HRESULT WINAPI IDirect3DVolumeTexture8Impl_FreePrivateData(IDirect3DVolumeTexture8 *iface, + REFGUID refguid) +{ + IDirect3DVolumeTexture8Impl *This = impl_from_IDirect3DVolumeTexture8(iface); HRESULT hr; TRACE("iface %p, guid %s.\n", iface, debugstr_guid(refguid)); wined3d_mutex_lock(); - hr = IWineD3DVolumeTexture_FreePrivateData(This->wineD3DVolumeTexture, refguid); + hr = wined3d_texture_free_private_data(This->wined3d_texture, refguid); wined3d_mutex_unlock(); return hr; } -static DWORD WINAPI IDirect3DVolumeTexture8Impl_SetPriority(LPDIRECT3DVOLUMETEXTURE8 iface, DWORD PriorityNew) { - IDirect3DVolumeTexture8Impl *This = (IDirect3DVolumeTexture8Impl *)iface; +static DWORD WINAPI IDirect3DVolumeTexture8Impl_SetPriority(IDirect3DVolumeTexture8 *iface, + DWORD PriorityNew) +{ + IDirect3DVolumeTexture8Impl *This = impl_from_IDirect3DVolumeTexture8(iface); DWORD ret; TRACE("iface %p, priority %u.\n", iface, PriorityNew); wined3d_mutex_lock(); - ret = IWineD3DVolumeTexture_SetPriority(This->wineD3DVolumeTexture, PriorityNew); + ret = wined3d_texture_set_priority(This->wined3d_texture, PriorityNew); wined3d_mutex_unlock(); return ret; } -static DWORD WINAPI IDirect3DVolumeTexture8Impl_GetPriority(LPDIRECT3DVOLUMETEXTURE8 iface) { - IDirect3DVolumeTexture8Impl *This = (IDirect3DVolumeTexture8Impl *)iface; +static DWORD WINAPI IDirect3DVolumeTexture8Impl_GetPriority(IDirect3DVolumeTexture8 *iface) +{ + IDirect3DVolumeTexture8Impl *This = impl_from_IDirect3DVolumeTexture8(iface); DWORD ret; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - ret = IWineD3DVolumeTexture_GetPriority(This->wineD3DVolumeTexture); + ret = wined3d_texture_get_priority(This->wined3d_texture); wined3d_mutex_unlock(); return ret; } -static void WINAPI IDirect3DVolumeTexture8Impl_PreLoad(LPDIRECT3DVOLUMETEXTURE8 iface) { - IDirect3DVolumeTexture8Impl *This = (IDirect3DVolumeTexture8Impl *)iface; +static void WINAPI IDirect3DVolumeTexture8Impl_PreLoad(IDirect3DVolumeTexture8 *iface) +{ + IDirect3DVolumeTexture8Impl *This = impl_from_IDirect3DVolumeTexture8(iface); TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - IWineD3DVolumeTexture_PreLoad(This->wineD3DVolumeTexture); + wined3d_texture_preload(This->wined3d_texture); wined3d_mutex_unlock(); } -static D3DRESOURCETYPE WINAPI IDirect3DVolumeTexture8Impl_GetType(LPDIRECT3DVOLUMETEXTURE8 iface) { - IDirect3DVolumeTexture8Impl *This = (IDirect3DVolumeTexture8Impl *)iface; +static D3DRESOURCETYPE WINAPI IDirect3DVolumeTexture8Impl_GetType(IDirect3DVolumeTexture8 *iface) +{ + IDirect3DVolumeTexture8Impl *This = impl_from_IDirect3DVolumeTexture8(iface); D3DRESOURCETYPE type; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - type = IWineD3DVolumeTexture_GetType(This->wineD3DVolumeTexture); + type = wined3d_texture_get_type(This->wined3d_texture); wined3d_mutex_unlock(); return type; } /* IDirect3DVolumeTexture8 IDirect3DBaseTexture8 Interface follow: */ -static DWORD WINAPI IDirect3DVolumeTexture8Impl_SetLOD(LPDIRECT3DVOLUMETEXTURE8 iface, DWORD LODNew) { - IDirect3DVolumeTexture8Impl *This = (IDirect3DVolumeTexture8Impl *)iface; +static DWORD WINAPI IDirect3DVolumeTexture8Impl_SetLOD(IDirect3DVolumeTexture8 *iface, DWORD LODNew) +{ + IDirect3DVolumeTexture8Impl *This = impl_from_IDirect3DVolumeTexture8(iface); DWORD ret; TRACE("iface %p, lod %u.\n", iface, LODNew); wined3d_mutex_lock(); - ret = IWineD3DVolumeTexture_SetLOD(This->wineD3DVolumeTexture, LODNew); + ret = wined3d_texture_set_lod(This->wined3d_texture, LODNew); wined3d_mutex_unlock(); return ret; } -static DWORD WINAPI IDirect3DVolumeTexture8Impl_GetLOD(LPDIRECT3DVOLUMETEXTURE8 iface) { - IDirect3DVolumeTexture8Impl *This = (IDirect3DVolumeTexture8Impl *)iface; +static DWORD WINAPI IDirect3DVolumeTexture8Impl_GetLOD(IDirect3DVolumeTexture8 *iface) +{ + IDirect3DVolumeTexture8Impl *This = impl_from_IDirect3DVolumeTexture8(iface); DWORD ret; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - ret = IWineD3DVolumeTexture_GetLOD(This->wineD3DVolumeTexture); + ret = wined3d_texture_get_lod(This->wined3d_texture); wined3d_mutex_unlock(); return ret; } -static DWORD WINAPI IDirect3DVolumeTexture8Impl_GetLevelCount(LPDIRECT3DVOLUMETEXTURE8 iface) { - IDirect3DVolumeTexture8Impl *This = (IDirect3DVolumeTexture8Impl *)iface; +static DWORD WINAPI IDirect3DVolumeTexture8Impl_GetLevelCount(IDirect3DVolumeTexture8 *iface) +{ + IDirect3DVolumeTexture8Impl *This = impl_from_IDirect3DVolumeTexture8(iface); DWORD ret; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - ret = IWineD3DVolumeTexture_GetLevelCount(This->wineD3DVolumeTexture); + ret = wined3d_texture_get_level_count(This->wined3d_texture); wined3d_mutex_unlock(); return ret; } -/* IDirect3DVolumeTexture8 Interface follow: */ -static HRESULT WINAPI IDirect3DVolumeTexture8Impl_GetLevelDesc(LPDIRECT3DVOLUMETEXTURE8 iface, UINT Level, D3DVOLUME_DESC* pDesc) { - IDirect3DVolumeTexture8Impl *This = (IDirect3DVolumeTexture8Impl *)iface; - WINED3DVOLUME_DESC wined3ddesc; - HRESULT hr; +static HRESULT WINAPI IDirect3DVolumeTexture8Impl_GetLevelDesc(IDirect3DVolumeTexture8 *iface, + UINT level, D3DVOLUME_DESC *desc) +{ + IDirect3DVolumeTexture8Impl *texture = impl_from_IDirect3DVolumeTexture8(iface); + struct wined3d_resource *sub_resource; + HRESULT hr = D3D_OK; - TRACE("iface %p, level %u, desc %p.\n", iface, Level, pDesc); + TRACE("iface %p, level %u, desc %p.\n", iface, level, desc); wined3d_mutex_lock(); - hr = IWineD3DVolumeTexture_GetLevelDesc(This->wineD3DVolumeTexture, Level, &wined3ddesc); - wined3d_mutex_unlock(); - - if (SUCCEEDED(hr)) + if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, level))) + hr = D3DERR_INVALIDCALL; + else { - pDesc->Format = d3dformat_from_wined3dformat(wined3ddesc.Format); - pDesc->Type = wined3ddesc.Type; - pDesc->Usage = wined3ddesc.Usage; - pDesc->Pool = wined3ddesc.Pool; - pDesc->Size = wined3ddesc.Size; - pDesc->Width = wined3ddesc.Width; - pDesc->Height = wined3ddesc.Height; - pDesc->Depth = wined3ddesc.Depth; + struct wined3d_resource_desc wined3d_desc; + + wined3d_resource_get_desc(sub_resource, &wined3d_desc); + desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format); + desc->Type = wined3d_desc.resource_type; + desc->Usage = wined3d_desc.usage; + desc->Pool = wined3d_desc.pool; + desc->Size = wined3d_desc.size; + desc->Width = wined3d_desc.width; + desc->Height = wined3d_desc.height; + desc->Depth = wined3d_desc.depth; } + wined3d_mutex_unlock(); return hr; } static HRESULT WINAPI IDirect3DVolumeTexture8Impl_GetVolumeLevel(IDirect3DVolumeTexture8 *iface, - UINT Level, IDirect3DVolume8 **ppVolumeLevel) + UINT level, IDirect3DVolume8 **volume) { - IDirect3DVolumeTexture8Impl *This = (IDirect3DVolumeTexture8Impl *)iface; - IWineD3DVolume *myVolume = NULL; - HRESULT hr; + IDirect3DVolumeTexture8Impl *texture = impl_from_IDirect3DVolumeTexture8(iface); + struct wined3d_resource *sub_resource; - TRACE("iface %p, level %u, volume %p.\n", iface, Level, ppVolumeLevel); + TRACE("iface %p, level %u, volume %p.\n", iface, level, volume); wined3d_mutex_lock(); - hr = IWineD3DVolumeTexture_GetVolumeLevel(This->wineD3DVolumeTexture, Level, &myVolume); - if (SUCCEEDED(hr) && ppVolumeLevel) + if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, level))) { - *ppVolumeLevel = IWineD3DVolumeTexture_GetParent(myVolume); - IDirect3DVolume8_AddRef(*ppVolumeLevel); - IWineD3DVolumeTexture_Release(myVolume); + wined3d_mutex_unlock(); + return D3DERR_INVALIDCALL; } + + *volume = wined3d_resource_get_parent(sub_resource); + IDirect3DVolume8_AddRef(*volume); wined3d_mutex_unlock(); - return hr; + return D3D_OK; } -static HRESULT WINAPI IDirect3DVolumeTexture8Impl_LockBox(LPDIRECT3DVOLUMETEXTURE8 iface, UINT Level, D3DLOCKED_BOX *pLockedVolume, CONST D3DBOX *pBox, DWORD Flags) { - IDirect3DVolumeTexture8Impl *This = (IDirect3DVolumeTexture8Impl *)iface; +static HRESULT WINAPI IDirect3DVolumeTexture8Impl_LockBox(IDirect3DVolumeTexture8 *iface, + UINT level, D3DLOCKED_BOX *locked_box, const D3DBOX *box, DWORD flags) +{ + IDirect3DVolumeTexture8Impl *texture = impl_from_IDirect3DVolumeTexture8(iface); + struct wined3d_resource *sub_resource; HRESULT hr; TRACE("iface %p, level %u, locked_box %p, box %p, flags %#x.\n", - iface, Level, pLockedVolume, pBox, Flags); + iface, level, locked_box, box, flags); wined3d_mutex_lock(); - hr = IWineD3DVolumeTexture_LockBox(This->wineD3DVolumeTexture, Level, (WINED3DLOCKED_BOX *) pLockedVolume, (CONST WINED3DBOX *) pBox, Flags); + if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, level))) + hr = D3DERR_INVALIDCALL; + else + hr = IDirect3DVolume8_LockBox((IDirect3DVolume8 *)wined3d_resource_get_parent(sub_resource), + locked_box, box, flags); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DVolumeTexture8Impl_UnlockBox(LPDIRECT3DVOLUMETEXTURE8 iface, UINT Level) { - IDirect3DVolumeTexture8Impl *This = (IDirect3DVolumeTexture8Impl *)iface; +static HRESULT WINAPI IDirect3DVolumeTexture8Impl_UnlockBox(IDirect3DVolumeTexture8 *iface, + UINT level) +{ + IDirect3DVolumeTexture8Impl *texture = impl_from_IDirect3DVolumeTexture8(iface); + struct wined3d_resource *sub_resource; HRESULT hr; - TRACE("iface %p, level %u.\n", iface, Level); + TRACE("iface %p, level %u.\n", iface, level); wined3d_mutex_lock(); - hr = IWineD3DVolumeTexture_UnlockBox(This->wineD3DVolumeTexture, Level); + if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, level))) + hr = D3DERR_INVALIDCALL; + else + hr = IDirect3DVolume8_UnlockBox((IDirect3DVolume8 *)wined3d_resource_get_parent(sub_resource)); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DVolumeTexture8Impl_AddDirtyBox(LPDIRECT3DVOLUMETEXTURE8 iface, CONST D3DBOX *pDirtyBox) { - IDirect3DVolumeTexture8Impl *This = (IDirect3DVolumeTexture8Impl *)iface; +static HRESULT WINAPI IDirect3DVolumeTexture8Impl_AddDirtyBox(IDirect3DVolumeTexture8 *iface, + const D3DBOX *dirty_box) +{ + IDirect3DVolumeTexture8Impl *texture = impl_from_IDirect3DVolumeTexture8(iface); HRESULT hr; - TRACE("iface %p, dirty_box %p.\n", iface, pDirtyBox); + TRACE("iface %p, dirty_box %p.\n", iface, dirty_box); wined3d_mutex_lock(); - hr = IWineD3DVolumeTexture_AddDirtyBox(This->wineD3DVolumeTexture, (CONST WINED3DBOX *) pDirtyBox); + hr = wined3d_texture_add_dirty_region(texture->wined3d_texture, 0, (const WINED3DBOX *)dirty_box); wined3d_mutex_unlock(); return hr; @@ -355,13 +397,13 @@ HRESULT volumetexture_init(IDirect3DVolumeTexture8Impl *texture, IDirect3DDevice { HRESULT hr; - texture->lpVtbl = &Direct3DVolumeTexture8_Vtbl; + texture->IDirect3DVolumeTexture8_iface.lpVtbl = &Direct3DVolumeTexture8_Vtbl; texture->ref = 1; wined3d_mutex_lock(); - hr = IWineD3DDevice_CreateVolumeTexture(device->WineD3DDevice, width, height, depth, levels, + hr = wined3d_texture_create_3d(device->wined3d_device, width, height, depth, levels, usage & WINED3DUSAGE_MASK, wined3dformat_from_d3dformat(format), pool, texture, - &d3d8_volumetexture_wined3d_parent_ops, &texture->wineD3DVolumeTexture); + &d3d8_volumetexture_wined3d_parent_ops, &texture->wined3d_texture); wined3d_mutex_unlock(); if (FAILED(hr)) { @@ -369,7 +411,7 @@ HRESULT volumetexture_init(IDirect3DVolumeTexture8Impl *texture, IDirect3DDevice return hr; } - texture->parentDevice = (IDirect3DDevice8 *)device; + texture->parentDevice = &device->IDirect3DDevice8_iface; IDirect3DDevice8_AddRef(texture->parentDevice); return D3D_OK; diff --git a/dll/directx/wine/d3d9/CMakeLists.txt b/dll/directx/wine/d3d9/CMakeLists.txt index bdd13db21b7..172149ffcf0 100644 --- a/dll/directx/wine/d3d9/CMakeLists.txt +++ b/dll/directx/wine/d3d9/CMakeLists.txt @@ -7,10 +7,6 @@ add_definitions( include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine) -if(MSVC) - add_definitions(-FImsvchelper.h) -endif() - set_rc_compiler() spec2def(d3d9.dll d3d9.spec) @@ -31,7 +27,6 @@ list(APPEND SOURCE volume.c volumetexture.c version.rc - #${REACTOS_BINARY_DIR}/include/reactos/wine/wined3d_i.c ${CMAKE_CURRENT_BINARY_DIR}/d3d9_stubs.c ${CMAKE_CURRENT_BINARY_DIR}/d3d9.def) @@ -51,5 +46,6 @@ add_importlibs(d3d9 ntdll) add_dependencies(d3d9 wineheaders) +add_pch(d3d9 d3d9_private.h) add_cd_file(TARGET d3d9 DESTINATION reactos/system32 FOR all) add_importlib_target(d3d9.spec) diff --git a/dll/directx/wine/d3d9/buffer.c b/dll/directx/wine/d3d9/buffer.c index ac8c2443e33..d9a5564d577 100644 --- a/dll/directx/wine/d3d9/buffer.c +++ b/dll/directx/wine/d3d9/buffer.c @@ -53,7 +53,7 @@ static ULONG WINAPI d3d9_vertexbuffer_AddRef(IDirect3DVertexBuffer9 *iface) { IDirect3DDevice9Ex_AddRef(buffer->parentDevice); wined3d_mutex_lock(); - IWineD3DBuffer_AddRef(buffer->wineD3DVertexBuffer); + wined3d_buffer_incref(buffer->wineD3DVertexBuffer); wined3d_mutex_unlock(); } @@ -72,7 +72,7 @@ static ULONG WINAPI d3d9_vertexbuffer_Release(IDirect3DVertexBuffer9 *iface) IDirect3DDevice9Ex *device = buffer->parentDevice; wined3d_mutex_lock(); - IWineD3DBuffer_Release(buffer->wineD3DVertexBuffer); + wined3d_buffer_decref(buffer->wineD3DVertexBuffer); wined3d_mutex_unlock(); /* Release the device last, as it may cause the device to be destroyed. */ @@ -103,7 +103,7 @@ static HRESULT WINAPI d3d9_vertexbuffer_SetPrivateData(IDirect3DVertexBuffer9 *i iface, debugstr_guid(guid), data, data_size, flags); wined3d_mutex_lock(); - hr = IWineD3DBuffer_SetPrivateData(((IDirect3DVertexBuffer9Impl *)iface)->wineD3DVertexBuffer, + hr = wined3d_buffer_set_private_data(((IDirect3DVertexBuffer9Impl *)iface)->wineD3DVertexBuffer, guid, data, data_size, flags); wined3d_mutex_unlock(); @@ -119,7 +119,7 @@ static HRESULT WINAPI d3d9_vertexbuffer_GetPrivateData(IDirect3DVertexBuffer9 *i iface, debugstr_guid(guid), data, data_size); wined3d_mutex_lock(); - hr = IWineD3DBuffer_GetPrivateData(((IDirect3DVertexBuffer9Impl *)iface)->wineD3DVertexBuffer, + hr = wined3d_buffer_get_private_data(((IDirect3DVertexBuffer9Impl *)iface)->wineD3DVertexBuffer, guid, data, data_size); wined3d_mutex_unlock(); @@ -133,7 +133,7 @@ static HRESULT WINAPI d3d9_vertexbuffer_FreePrivateData(IDirect3DVertexBuffer9 * TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid)); wined3d_mutex_lock(); - hr = IWineD3DBuffer_FreePrivateData(((IDirect3DVertexBuffer9Impl *)iface)->wineD3DVertexBuffer, guid); + hr = wined3d_buffer_free_private_data(((IDirect3DVertexBuffer9Impl *)iface)->wineD3DVertexBuffer, guid); wined3d_mutex_unlock(); return hr; @@ -146,7 +146,7 @@ static DWORD WINAPI d3d9_vertexbuffer_SetPriority(IDirect3DVertexBuffer9 *iface, TRACE("iface %p, priority %u.\n", iface, priority); wined3d_mutex_lock(); - previous = IWineD3DBuffer_SetPriority(((IDirect3DVertexBuffer9Impl *)iface)->wineD3DVertexBuffer, priority); + previous = wined3d_buffer_set_priority(((IDirect3DVertexBuffer9Impl *)iface)->wineD3DVertexBuffer, priority); wined3d_mutex_unlock(); return previous; @@ -159,7 +159,7 @@ static DWORD WINAPI d3d9_vertexbuffer_GetPriority(IDirect3DVertexBuffer9 *iface) TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - priority = IWineD3DBuffer_GetPriority(((IDirect3DVertexBuffer9Impl *)iface)->wineD3DVertexBuffer); + priority = wined3d_buffer_get_priority(((IDirect3DVertexBuffer9Impl *)iface)->wineD3DVertexBuffer); wined3d_mutex_unlock(); return priority; @@ -170,7 +170,7 @@ static void WINAPI d3d9_vertexbuffer_PreLoad(IDirect3DVertexBuffer9 *iface) TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - IWineD3DBuffer_PreLoad(((IDirect3DVertexBuffer9Impl *)iface)->wineD3DVertexBuffer); + wined3d_buffer_preload(((IDirect3DVertexBuffer9Impl *)iface)->wineD3DVertexBuffer); wined3d_mutex_unlock(); } @@ -190,7 +190,7 @@ static HRESULT WINAPI d3d9_vertexbuffer_Lock(IDirect3DVertexBuffer9 *iface, iface, offset, size, data, flags); wined3d_mutex_lock(); - hr = IWineD3DBuffer_Map(((IDirect3DVertexBuffer9Impl *)iface)->wineD3DVertexBuffer, + hr = wined3d_buffer_map(((IDirect3DVertexBuffer9Impl *)iface)->wineD3DVertexBuffer, offset, size, (BYTE **)data, flags); wined3d_mutex_unlock(); @@ -199,32 +199,32 @@ static HRESULT WINAPI d3d9_vertexbuffer_Lock(IDirect3DVertexBuffer9 *iface, static HRESULT WINAPI d3d9_vertexbuffer_Unlock(IDirect3DVertexBuffer9 *iface) { - HRESULT hr; - TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - hr = IWineD3DBuffer_Unmap(((IDirect3DVertexBuffer9Impl *)iface)->wineD3DVertexBuffer); + wined3d_buffer_unmap(((IDirect3DVertexBuffer9Impl *)iface)->wineD3DVertexBuffer); wined3d_mutex_unlock(); - return hr; + return D3D_OK; } static HRESULT WINAPI d3d9_vertexbuffer_GetDesc(IDirect3DVertexBuffer9 *iface, D3DVERTEXBUFFER_DESC *desc) { IDirect3DVertexBuffer9Impl *buffer = (IDirect3DVertexBuffer9Impl *)iface; - WINED3DBUFFER_DESC wined3d_desc; + struct wined3d_resource_desc wined3d_desc; + struct wined3d_resource *wined3d_resource; TRACE("iface %p, desc %p.\n", iface, desc); wined3d_mutex_lock(); - IWineD3DBuffer_GetDesc(buffer->wineD3DVertexBuffer, &wined3d_desc); + wined3d_resource = wined3d_buffer_get_resource(buffer->wineD3DVertexBuffer); + wined3d_resource_get_desc(wined3d_resource, &wined3d_desc); wined3d_mutex_unlock(); desc->Format = D3DFMT_VERTEXDATA; - desc->Usage = wined3d_desc.Usage; - desc->Pool = wined3d_desc.Pool; - desc->Size = wined3d_desc.Size; + desc->Usage = wined3d_desc.usage; + desc->Pool = wined3d_desc.pool; + desc->Size = wined3d_desc.size; desc->Type = D3DRTYPE_VERTEXBUFFER; desc->FVF = buffer->fvf; @@ -272,7 +272,7 @@ HRESULT vertexbuffer_init(IDirect3DVertexBuffer9Impl *buffer, IDirect3DDevice9Im buffer->fvf = fvf; wined3d_mutex_lock(); - hr = IWineD3DDevice_CreateVertexBuffer(device->WineD3DDevice, size, usage & WINED3DUSAGE_MASK, + hr = wined3d_buffer_create_vb(device->wined3d_device, size, usage & WINED3DUSAGE_MASK, (WINED3DPOOL)pool, buffer, &d3d9_vertexbuffer_wined3d_parent_ops, &buffer->wineD3DVertexBuffer); wined3d_mutex_unlock(); if (FAILED(hr)) @@ -281,7 +281,7 @@ HRESULT vertexbuffer_init(IDirect3DVertexBuffer9Impl *buffer, IDirect3DDevice9Im return hr; } - buffer->parentDevice = (IDirect3DDevice9Ex *)device; + buffer->parentDevice = &device->IDirect3DDevice9Ex_iface; IDirect3DDevice9Ex_AddRef(buffer->parentDevice); return D3D_OK; @@ -317,7 +317,7 @@ static ULONG WINAPI d3d9_indexbuffer_AddRef(IDirect3DIndexBuffer9 *iface) { IDirect3DDevice9Ex_AddRef(buffer->parentDevice); wined3d_mutex_lock(); - IWineD3DBuffer_AddRef(buffer->wineD3DIndexBuffer); + wined3d_buffer_incref(buffer->wineD3DIndexBuffer); wined3d_mutex_unlock(); } @@ -336,7 +336,7 @@ static ULONG WINAPI d3d9_indexbuffer_Release(IDirect3DIndexBuffer9 *iface) IDirect3DDevice9Ex *device = buffer->parentDevice; wined3d_mutex_lock(); - IWineD3DBuffer_Release(buffer->wineD3DIndexBuffer); + wined3d_buffer_decref(buffer->wineD3DIndexBuffer); wined3d_mutex_unlock(); /* Release the device last, as it may cause the device to be destroyed. */ @@ -367,7 +367,7 @@ static HRESULT WINAPI d3d9_indexbuffer_SetPrivateData(IDirect3DIndexBuffer9 *ifa iface, debugstr_guid(guid), data, data_size, flags); wined3d_mutex_lock(); - hr = IWineD3DBuffer_SetPrivateData(((IDirect3DIndexBuffer9Impl *)iface)->wineD3DIndexBuffer, + hr = wined3d_buffer_set_private_data(((IDirect3DIndexBuffer9Impl *)iface)->wineD3DIndexBuffer, guid, data, data_size, flags); wined3d_mutex_unlock(); @@ -383,7 +383,7 @@ static HRESULT WINAPI d3d9_indexbuffer_GetPrivateData(IDirect3DIndexBuffer9 *ifa iface, debugstr_guid(guid), data, data_size); wined3d_mutex_lock(); - hr = IWineD3DBuffer_GetPrivateData(((IDirect3DIndexBuffer9Impl *)iface)->wineD3DIndexBuffer, + hr = wined3d_buffer_get_private_data(((IDirect3DIndexBuffer9Impl *)iface)->wineD3DIndexBuffer, guid, data, data_size); wined3d_mutex_unlock(); @@ -397,7 +397,7 @@ static HRESULT WINAPI d3d9_indexbuffer_FreePrivateData(IDirect3DIndexBuffer9 *if TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid)); wined3d_mutex_lock(); - hr = IWineD3DBuffer_FreePrivateData(((IDirect3DIndexBuffer9Impl *)iface)->wineD3DIndexBuffer, guid); + hr = wined3d_buffer_free_private_data(((IDirect3DIndexBuffer9Impl *)iface)->wineD3DIndexBuffer, guid); wined3d_mutex_unlock(); return hr; @@ -410,7 +410,7 @@ static DWORD WINAPI d3d9_indexbuffer_SetPriority(IDirect3DIndexBuffer9 *iface, D TRACE("iface %p, priority %u.\n", iface, priority); wined3d_mutex_lock(); - previous = IWineD3DBuffer_SetPriority(((IDirect3DIndexBuffer9Impl *)iface)->wineD3DIndexBuffer, priority); + previous = wined3d_buffer_set_priority(((IDirect3DIndexBuffer9Impl *)iface)->wineD3DIndexBuffer, priority); wined3d_mutex_unlock(); return previous; @@ -423,7 +423,7 @@ static DWORD WINAPI d3d9_indexbuffer_GetPriority(IDirect3DIndexBuffer9 *iface) TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - priority = IWineD3DBuffer_GetPriority(((IDirect3DIndexBuffer9Impl *)iface)->wineD3DIndexBuffer); + priority = wined3d_buffer_get_priority(((IDirect3DIndexBuffer9Impl *)iface)->wineD3DIndexBuffer); wined3d_mutex_unlock(); return priority; @@ -434,7 +434,7 @@ static void WINAPI d3d9_indexbuffer_PreLoad(IDirect3DIndexBuffer9 *iface) TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - IWineD3DBuffer_PreLoad(((IDirect3DIndexBuffer9Impl *)iface)->wineD3DIndexBuffer); + wined3d_buffer_preload(((IDirect3DIndexBuffer9Impl *)iface)->wineD3DIndexBuffer); wined3d_mutex_unlock(); } @@ -454,7 +454,7 @@ static HRESULT WINAPI d3d9_indexbuffer_Lock(IDirect3DIndexBuffer9 *iface, iface, offset, size, data, flags); wined3d_mutex_lock(); - hr = IWineD3DBuffer_Map(((IDirect3DIndexBuffer9Impl *)iface)->wineD3DIndexBuffer, + hr = wined3d_buffer_map(((IDirect3DIndexBuffer9Impl *)iface)->wineD3DIndexBuffer, offset, size, (BYTE **)data, flags); wined3d_mutex_unlock(); @@ -463,32 +463,32 @@ static HRESULT WINAPI d3d9_indexbuffer_Lock(IDirect3DIndexBuffer9 *iface, static HRESULT WINAPI d3d9_indexbuffer_Unlock(IDirect3DIndexBuffer9 *iface) { - HRESULT hr; - TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - hr = IWineD3DBuffer_Unmap(((IDirect3DIndexBuffer9Impl *)iface)->wineD3DIndexBuffer); + wined3d_buffer_unmap(((IDirect3DIndexBuffer9Impl *)iface)->wineD3DIndexBuffer); wined3d_mutex_unlock(); - return hr; + return D3D_OK; } static HRESULT WINAPI d3d9_indexbuffer_GetDesc(IDirect3DIndexBuffer9 *iface, D3DINDEXBUFFER_DESC *desc) { IDirect3DIndexBuffer9Impl *buffer = (IDirect3DIndexBuffer9Impl *)iface; - WINED3DBUFFER_DESC wined3d_desc; + struct wined3d_resource_desc wined3d_desc; + struct wined3d_resource *wined3d_resource; TRACE("iface %p, desc %p.\n", iface, desc); wined3d_mutex_lock(); - IWineD3DBuffer_GetDesc(buffer->wineD3DIndexBuffer, &wined3d_desc); + wined3d_resource = wined3d_buffer_get_resource(buffer->wineD3DIndexBuffer); + wined3d_resource_get_desc(wined3d_resource, &wined3d_desc); wined3d_mutex_unlock(); desc->Format = d3dformat_from_wined3dformat(buffer->format); - desc->Usage = wined3d_desc.Usage; - desc->Pool = wined3d_desc.Pool; - desc->Size = wined3d_desc.Size; + desc->Usage = wined3d_desc.usage; + desc->Pool = wined3d_desc.pool; + desc->Size = wined3d_desc.size; desc->Type = D3DRTYPE_INDEXBUFFER; return D3D_OK; @@ -535,7 +535,7 @@ HRESULT indexbuffer_init(IDirect3DIndexBuffer9Impl *buffer, IDirect3DDevice9Impl buffer->format = wined3dformat_from_d3dformat(format); wined3d_mutex_lock(); - hr = IWineD3DDevice_CreateIndexBuffer(device->WineD3DDevice, size, usage & WINED3DUSAGE_MASK, + hr = wined3d_buffer_create_ib(device->wined3d_device, size, usage & WINED3DUSAGE_MASK, (WINED3DPOOL)pool, buffer, &d3d9_indexbuffer_wined3d_parent_ops, &buffer->wineD3DIndexBuffer); wined3d_mutex_unlock(); if (FAILED(hr)) @@ -544,7 +544,7 @@ HRESULT indexbuffer_init(IDirect3DIndexBuffer9Impl *buffer, IDirect3DDevice9Impl return hr; } - buffer->parentDevice = (IDirect3DDevice9Ex *)device; + buffer->parentDevice = &device->IDirect3DDevice9Ex_iface; IDirect3DDevice9Ex_AddRef(buffer->parentDevice); return D3D_OK; diff --git a/dll/directx/wine/d3d9/cubetexture.c b/dll/directx/wine/d3d9/cubetexture.c index 508784f8958..1f5e27b8033 100644 --- a/dll/directx/wine/d3d9/cubetexture.c +++ b/dll/directx/wine/d3d9/cubetexture.c @@ -26,9 +26,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d9); -/* IDirect3DCubeTexture9 IUnknown parts follow: */ -static HRESULT WINAPI IDirect3DCubeTexture9Impl_QueryInterface(LPDIRECT3DCUBETEXTURE9 iface, REFIID riid, LPVOID* ppobj) { - IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; +static inline IDirect3DCubeTexture9Impl *impl_from_IDirect3DCubeTexture9(IDirect3DCubeTexture9 *iface) +{ + return CONTAINING_RECORD(iface, IDirect3DCubeTexture9Impl, IDirect3DCubeTexture9_iface); +} + +static HRESULT WINAPI IDirect3DCubeTexture9Impl_QueryInterface(IDirect3DCubeTexture9 *iface, + REFIID riid, void **ppobj) +{ + IDirect3DCubeTexture9Impl *This = impl_from_IDirect3DCubeTexture9(iface); TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), ppobj); @@ -46,8 +52,9 @@ static HRESULT WINAPI IDirect3DCubeTexture9Impl_QueryInterface(LPDIRECT3DCUBETEX return E_NOINTERFACE; } -static ULONG WINAPI IDirect3DCubeTexture9Impl_AddRef(LPDIRECT3DCUBETEXTURE9 iface) { - IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; +static ULONG WINAPI IDirect3DCubeTexture9Impl_AddRef(IDirect3DCubeTexture9 *iface) +{ + IDirect3DCubeTexture9Impl *This = impl_from_IDirect3DCubeTexture9(iface); ULONG ref = InterlockedIncrement(&This->ref); TRACE("%p increasing refcount to %u.\n", iface, ref); @@ -56,15 +63,16 @@ static ULONG WINAPI IDirect3DCubeTexture9Impl_AddRef(LPDIRECT3DCUBETEXTURE9 ifac { IDirect3DDevice9Ex_AddRef(This->parentDevice); wined3d_mutex_lock(); - IWineD3DCubeTexture_AddRef(This->wineD3DCubeTexture); + wined3d_texture_incref(This->wined3d_texture); wined3d_mutex_unlock(); } return ref; } -static ULONG WINAPI IDirect3DCubeTexture9Impl_Release(LPDIRECT3DCUBETEXTURE9 iface) { - IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; +static ULONG WINAPI IDirect3DCubeTexture9Impl_Release(IDirect3DCubeTexture9 *iface) +{ + IDirect3DCubeTexture9Impl *This = impl_from_IDirect3DCubeTexture9(iface); ULONG ref = InterlockedDecrement(&This->ref); TRACE("%p decreasing refcount to %u.\n", iface, ref); @@ -72,10 +80,10 @@ static ULONG WINAPI IDirect3DCubeTexture9Impl_Release(LPDIRECT3DCUBETEXTURE9 ifa if (ref == 0) { IDirect3DDevice9Ex *parentDevice = This->parentDevice; - TRACE("Releasing child %p\n", This->wineD3DCubeTexture); + TRACE("Releasing child %p.\n", This->wined3d_texture); wined3d_mutex_lock(); - IWineD3DCubeTexture_Release(This->wineD3DCubeTexture); + wined3d_texture_decref(This->wined3d_texture); wined3d_mutex_unlock(); /* Release the device last, as it may cause the device to be destroyed. */ @@ -85,9 +93,10 @@ static ULONG WINAPI IDirect3DCubeTexture9Impl_Release(LPDIRECT3DCUBETEXTURE9 ifa } /* IDirect3DCubeTexture9 IDirect3DResource9 Interface follow: */ -static HRESULT WINAPI IDirect3DCubeTexture9Impl_GetDevice(IDirect3DCubeTexture9 *iface, IDirect3DDevice9 **device) +static HRESULT WINAPI IDirect3DCubeTexture9Impl_GetDevice(IDirect3DCubeTexture9 *iface, + IDirect3DDevice9 **device) { - IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; + IDirect3DCubeTexture9Impl *This = impl_from_IDirect3DCubeTexture9(iface); TRACE("iface %p, device %p.\n", iface, device); @@ -99,263 +108,320 @@ static HRESULT WINAPI IDirect3DCubeTexture9Impl_GetDevice(IDirect3DCubeTexture9 return D3D_OK; } -static HRESULT WINAPI IDirect3DCubeTexture9Impl_SetPrivateData(LPDIRECT3DCUBETEXTURE9 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) { - IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; +static HRESULT WINAPI IDirect3DCubeTexture9Impl_SetPrivateData(IDirect3DCubeTexture9 *iface, + REFGUID refguid, const void *pData, DWORD SizeOfData, DWORD Flags) +{ + IDirect3DCubeTexture9Impl *This = impl_from_IDirect3DCubeTexture9(iface); HRESULT hr; TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n", iface, debugstr_guid(refguid), pData, SizeOfData, Flags); wined3d_mutex_lock(); - hr = IWineD3DCubeTexture_SetPrivateData(This->wineD3DCubeTexture,refguid,pData,SizeOfData,Flags); + hr = wined3d_texture_set_private_data(This->wined3d_texture, refguid, pData, SizeOfData, Flags); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DCubeTexture9Impl_GetPrivateData(LPDIRECT3DCUBETEXTURE9 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) { - IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; +static HRESULT WINAPI IDirect3DCubeTexture9Impl_GetPrivateData(IDirect3DCubeTexture9 *iface, + REFGUID refguid, void *pData, DWORD *pSizeOfData) +{ + IDirect3DCubeTexture9Impl *This = impl_from_IDirect3DCubeTexture9(iface); HRESULT hr; TRACE("iface %p, guid %s, data %p, data_size %p.\n", iface, debugstr_guid(refguid), pData, pSizeOfData); wined3d_mutex_lock(); - hr = IWineD3DCubeTexture_GetPrivateData(This->wineD3DCubeTexture,refguid,pData,pSizeOfData); + hr = wined3d_texture_get_private_data(This->wined3d_texture, refguid, pData, pSizeOfData); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DCubeTexture9Impl_FreePrivateData(LPDIRECT3DCUBETEXTURE9 iface, REFGUID refguid) { - IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; +static HRESULT WINAPI IDirect3DCubeTexture9Impl_FreePrivateData(IDirect3DCubeTexture9 *iface, + REFGUID refguid) +{ + IDirect3DCubeTexture9Impl *This = impl_from_IDirect3DCubeTexture9(iface); HRESULT hr; TRACE("iface %p, guid %s.\n", iface, debugstr_guid(refguid)); wined3d_mutex_lock(); - hr = IWineD3DCubeTexture_FreePrivateData(This->wineD3DCubeTexture,refguid); + hr = wined3d_texture_free_private_data(This->wined3d_texture, refguid); wined3d_mutex_unlock(); return hr; } -static DWORD WINAPI IDirect3DCubeTexture9Impl_SetPriority(LPDIRECT3DCUBETEXTURE9 iface, DWORD PriorityNew) { - IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; +static DWORD WINAPI IDirect3DCubeTexture9Impl_SetPriority(IDirect3DCubeTexture9 *iface, + DWORD PriorityNew) +{ + IDirect3DCubeTexture9Impl *This = impl_from_IDirect3DCubeTexture9(iface); DWORD ret; TRACE("iface %p, priority %u.\n", iface, PriorityNew); wined3d_mutex_lock(); - ret = IWineD3DCubeTexture_SetPriority(This->wineD3DCubeTexture, PriorityNew); + ret = wined3d_texture_set_priority(This->wined3d_texture, PriorityNew); wined3d_mutex_unlock(); return ret; } -static DWORD WINAPI IDirect3DCubeTexture9Impl_GetPriority(LPDIRECT3DCUBETEXTURE9 iface) { - IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; +static DWORD WINAPI IDirect3DCubeTexture9Impl_GetPriority(IDirect3DCubeTexture9 *iface) +{ + IDirect3DCubeTexture9Impl *This = impl_from_IDirect3DCubeTexture9(iface); DWORD ret; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - ret = IWineD3DCubeTexture_GetPriority(This->wineD3DCubeTexture); + ret = wined3d_texture_get_priority(This->wined3d_texture); wined3d_mutex_unlock(); return ret; } -static void WINAPI IDirect3DCubeTexture9Impl_PreLoad(LPDIRECT3DCUBETEXTURE9 iface) { - IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; +static void WINAPI IDirect3DCubeTexture9Impl_PreLoad(IDirect3DCubeTexture9 *iface) +{ + IDirect3DCubeTexture9Impl *This = impl_from_IDirect3DCubeTexture9(iface); TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - IWineD3DCubeTexture_PreLoad(This->wineD3DCubeTexture); + wined3d_texture_preload(This->wined3d_texture); wined3d_mutex_unlock(); } -static D3DRESOURCETYPE WINAPI IDirect3DCubeTexture9Impl_GetType(LPDIRECT3DCUBETEXTURE9 iface) { - IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; +static D3DRESOURCETYPE WINAPI IDirect3DCubeTexture9Impl_GetType(IDirect3DCubeTexture9 *iface) +{ + IDirect3DCubeTexture9Impl *This = impl_from_IDirect3DCubeTexture9(iface); D3DRESOURCETYPE ret; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - ret = IWineD3DCubeTexture_GetType(This->wineD3DCubeTexture); + ret = wined3d_texture_get_type(This->wined3d_texture); wined3d_mutex_unlock(); return ret; } /* IDirect3DCubeTexture9 IDirect3DBaseTexture9 Interface follow: */ -static DWORD WINAPI IDirect3DCubeTexture9Impl_SetLOD(LPDIRECT3DCUBETEXTURE9 iface, DWORD LODNew) { - IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; +static DWORD WINAPI IDirect3DCubeTexture9Impl_SetLOD(IDirect3DCubeTexture9 *iface, DWORD LODNew) +{ + IDirect3DCubeTexture9Impl *This = impl_from_IDirect3DCubeTexture9(iface); DWORD ret; TRACE("iface %p, lod %u.\n", iface, LODNew); wined3d_mutex_lock(); - ret = IWineD3DCubeTexture_SetLOD(This->wineD3DCubeTexture, LODNew); + ret = wined3d_texture_set_lod(This->wined3d_texture, LODNew); wined3d_mutex_unlock(); return ret; } -static DWORD WINAPI IDirect3DCubeTexture9Impl_GetLOD(LPDIRECT3DCUBETEXTURE9 iface) { - IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; +static DWORD WINAPI IDirect3DCubeTexture9Impl_GetLOD(IDirect3DCubeTexture9 *iface) +{ + IDirect3DCubeTexture9Impl *This = impl_from_IDirect3DCubeTexture9(iface); DWORD ret; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - ret = IWineD3DCubeTexture_GetLOD(This->wineD3DCubeTexture); + ret = wined3d_texture_get_lod(This->wined3d_texture); wined3d_mutex_unlock(); return ret; } -static DWORD WINAPI IDirect3DCubeTexture9Impl_GetLevelCount(LPDIRECT3DCUBETEXTURE9 iface) { - IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; +static DWORD WINAPI IDirect3DCubeTexture9Impl_GetLevelCount(IDirect3DCubeTexture9 *iface) +{ + IDirect3DCubeTexture9Impl *This = impl_from_IDirect3DCubeTexture9(iface); DWORD ret; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - ret = IWineD3DCubeTexture_GetLevelCount(This->wineD3DCubeTexture); + ret = wined3d_texture_get_level_count(This->wined3d_texture); wined3d_mutex_unlock(); return ret; } -static HRESULT WINAPI IDirect3DCubeTexture9Impl_SetAutoGenFilterType(LPDIRECT3DCUBETEXTURE9 iface, D3DTEXTUREFILTERTYPE FilterType) { - IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; +static HRESULT WINAPI IDirect3DCubeTexture9Impl_SetAutoGenFilterType(IDirect3DCubeTexture9 *iface, + D3DTEXTUREFILTERTYPE FilterType) +{ + IDirect3DCubeTexture9Impl *This = impl_from_IDirect3DCubeTexture9(iface); HRESULT hr; TRACE("iface %p, filter_type %#x.\n", iface, FilterType); wined3d_mutex_lock(); - hr = IWineD3DCubeTexture_SetAutoGenFilterType(This->wineD3DCubeTexture, (WINED3DTEXTUREFILTERTYPE) FilterType); + hr = wined3d_texture_set_autogen_filter_type(This->wined3d_texture, (WINED3DTEXTUREFILTERTYPE)FilterType); wined3d_mutex_unlock(); return hr; } -static D3DTEXTUREFILTERTYPE WINAPI IDirect3DCubeTexture9Impl_GetAutoGenFilterType(LPDIRECT3DCUBETEXTURE9 iface) { - IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; +static D3DTEXTUREFILTERTYPE WINAPI IDirect3DCubeTexture9Impl_GetAutoGenFilterType(IDirect3DCubeTexture9 *iface) +{ + IDirect3DCubeTexture9Impl *This = impl_from_IDirect3DCubeTexture9(iface); D3DTEXTUREFILTERTYPE ret; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - ret = (D3DTEXTUREFILTERTYPE) IWineD3DCubeTexture_GetAutoGenFilterType(This->wineD3DCubeTexture); + ret = (D3DTEXTUREFILTERTYPE)wined3d_texture_get_autogen_filter_type(This->wined3d_texture); wined3d_mutex_unlock(); return ret; } -static void WINAPI IDirect3DCubeTexture9Impl_GenerateMipSubLevels(LPDIRECT3DCUBETEXTURE9 iface) { - IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; +static void WINAPI IDirect3DCubeTexture9Impl_GenerateMipSubLevels(IDirect3DCubeTexture9 *iface) +{ + IDirect3DCubeTexture9Impl *This = impl_from_IDirect3DCubeTexture9(iface); TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - IWineD3DCubeTexture_GenerateMipSubLevels(This->wineD3DCubeTexture); + wined3d_texture_generate_mipmaps(This->wined3d_texture); wined3d_mutex_unlock(); } /* IDirect3DCubeTexture9 Interface follow: */ -static HRESULT WINAPI IDirect3DCubeTexture9Impl_GetLevelDesc(LPDIRECT3DCUBETEXTURE9 iface, UINT Level, D3DSURFACE_DESC* pDesc) { - IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; - WINED3DSURFACE_DESC wined3ddesc; - HRESULT hr; +static HRESULT WINAPI IDirect3DCubeTexture9Impl_GetLevelDesc(IDirect3DCubeTexture9 *iface, + UINT level, D3DSURFACE_DESC *desc) +{ + IDirect3DCubeTexture9Impl *texture = impl_from_IDirect3DCubeTexture9(iface); + struct wined3d_resource *sub_resource; + HRESULT hr = D3D_OK; - TRACE("iface %p, level %u, desc %p.\n", iface, Level, pDesc); + TRACE("iface %p, level %u, desc %p.\n", iface, level, desc); wined3d_mutex_lock(); - hr = IWineD3DCubeTexture_GetLevelDesc(This->wineD3DCubeTexture, Level, &wined3ddesc); - wined3d_mutex_unlock(); - - if (SUCCEEDED(hr)) + if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, level))) + hr = D3DERR_INVALIDCALL; + else { - pDesc->Format = d3dformat_from_wined3dformat(wined3ddesc.format); - pDesc->Type = wined3ddesc.resource_type; - pDesc->Usage = wined3ddesc.usage; - pDesc->Pool = wined3ddesc.pool; - pDesc->MultiSampleType = wined3ddesc.multisample_type; - pDesc->MultiSampleQuality = wined3ddesc.multisample_quality; - pDesc->Width = wined3ddesc.width; - pDesc->Height = wined3ddesc.height; + struct wined3d_resource_desc wined3d_desc; + + wined3d_resource_get_desc(sub_resource, &wined3d_desc); + desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format); + desc->Type = wined3d_desc.resource_type; + desc->Usage = wined3d_desc.usage; + desc->Pool = wined3d_desc.pool; + desc->MultiSampleType = wined3d_desc.multisample_type; + desc->MultiSampleQuality = wined3d_desc.multisample_quality; + desc->Width = wined3d_desc.width; + desc->Height = wined3d_desc.height; } + wined3d_mutex_unlock(); return hr; } static HRESULT WINAPI IDirect3DCubeTexture9Impl_GetCubeMapSurface(IDirect3DCubeTexture9 *iface, - D3DCUBEMAP_FACES FaceType, UINT Level, IDirect3DSurface9 **ppCubeMapSurface) + D3DCUBEMAP_FACES face, UINT level, IDirect3DSurface9 **surface) { - IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; - IWineD3DSurface *mySurface = NULL; - HRESULT hr; + IDirect3DCubeTexture9Impl *texture = impl_from_IDirect3DCubeTexture9(iface); + struct wined3d_resource *sub_resource; + UINT sub_resource_idx; - TRACE("iface %p, face %#x, level %u, surface %p.\n", iface, FaceType, Level, ppCubeMapSurface); + TRACE("iface %p, face %#x, level %u, surface %p.\n", iface, face, level, surface); wined3d_mutex_lock(); - hr = IWineD3DCubeTexture_GetCubeMapSurface(This->wineD3DCubeTexture, - (WINED3DCUBEMAP_FACES)FaceType, Level, &mySurface); - if (SUCCEEDED(hr) && ppCubeMapSurface) + sub_resource_idx = wined3d_texture_get_level_count(texture->wined3d_texture) * face + level; + if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, sub_resource_idx))) { - *ppCubeMapSurface = IWineD3DCubeTexture_GetParent(mySurface); - IDirect3DSurface9_AddRef(*ppCubeMapSurface); - IWineD3DCubeTexture_Release(mySurface); + wined3d_mutex_unlock(); + return D3DERR_INVALIDCALL; + } + + *surface = wined3d_resource_get_parent(sub_resource); + IDirect3DSurface9_AddRef(*surface); + wined3d_mutex_unlock(); + + return D3D_OK; +} + +static HRESULT WINAPI IDirect3DCubeTexture9Impl_LockRect(IDirect3DCubeTexture9 *iface, + D3DCUBEMAP_FACES face, UINT level, D3DLOCKED_RECT *locked_rect, const RECT *rect, + DWORD flags) +{ + IDirect3DCubeTexture9Impl *texture = impl_from_IDirect3DCubeTexture9(iface); + struct wined3d_resource *sub_resource; + UINT sub_resource_idx; + HRESULT hr; + + TRACE("iface %p, face %#x, level %u, locked_rect %p, rect %p, flags %#x.\n", + iface, face, level, locked_rect, rect, flags); + + wined3d_mutex_lock(); + sub_resource_idx = wined3d_texture_get_level_count(texture->wined3d_texture) * face + level; + if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, sub_resource_idx))) + hr = D3DERR_INVALIDCALL; + else + hr = IDirect3DSurface9_LockRect((IDirect3DSurface9 *)wined3d_resource_get_parent(sub_resource), + locked_rect, rect, flags); + wined3d_mutex_unlock(); + + return hr; +} + +static HRESULT WINAPI IDirect3DCubeTexture9Impl_UnlockRect(IDirect3DCubeTexture9 *iface, + D3DCUBEMAP_FACES face, UINT level) +{ + IDirect3DCubeTexture9Impl *texture = impl_from_IDirect3DCubeTexture9(iface); + struct wined3d_resource *sub_resource; + UINT sub_resource_idx; + HRESULT hr; + + TRACE("iface %p, face %#x, level %u.\n", iface, face, level); + + wined3d_mutex_lock(); + sub_resource_idx = wined3d_texture_get_level_count(texture->wined3d_texture) * face + level; + if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, sub_resource_idx))) + hr = D3DERR_INVALIDCALL; + else + hr = IDirect3DSurface9_UnlockRect((IDirect3DSurface9 *)wined3d_resource_get_parent(sub_resource)); + wined3d_mutex_unlock(); + + return hr; +} + +static HRESULT WINAPI IDirect3DCubeTexture9Impl_AddDirtyRect(IDirect3DCubeTexture9 *iface, + D3DCUBEMAP_FACES face, const RECT *dirty_rect) +{ + IDirect3DCubeTexture9Impl *texture = impl_from_IDirect3DCubeTexture9(iface); + HRESULT hr; + + TRACE("iface %p, face %#x, dirty_rect %s.\n", + iface, face, wine_dbgstr_rect(dirty_rect)); + + wined3d_mutex_lock(); + if (!dirty_rect) + hr = wined3d_texture_add_dirty_region(texture->wined3d_texture, face, NULL); + else + { + WINED3DBOX dirty_region; + + dirty_region.Left = dirty_rect->left; + dirty_region.Top = dirty_rect->top; + dirty_region.Right = dirty_rect->right; + dirty_region.Bottom = dirty_rect->bottom; + dirty_region.Front = 0; + dirty_region.Back = 1; + hr = wined3d_texture_add_dirty_region(texture->wined3d_texture, face, &dirty_region); } wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DCubeTexture9Impl_LockRect(LPDIRECT3DCUBETEXTURE9 iface, D3DCUBEMAP_FACES FaceType, UINT Level, D3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags) { - IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; - HRESULT hr; - - TRACE("iface %p, face %#x, level %u, locked_rect %p, rect %p, flags %#x.\n", - iface, FaceType, Level, pLockedRect, pRect, Flags); - - wined3d_mutex_lock(); - hr = IWineD3DCubeTexture_LockRect(This->wineD3DCubeTexture, (WINED3DCUBEMAP_FACES) FaceType, Level, (WINED3DLOCKED_RECT *) pLockedRect, pRect, Flags); - wined3d_mutex_unlock(); - - return hr; -} - -static HRESULT WINAPI IDirect3DCubeTexture9Impl_UnlockRect(LPDIRECT3DCUBETEXTURE9 iface, D3DCUBEMAP_FACES FaceType, UINT Level) { - IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; - HRESULT hr; - - TRACE("iface %p, face %#x, level %u.\n", iface, FaceType, Level); - - wined3d_mutex_lock(); - hr = IWineD3DCubeTexture_UnlockRect(This->wineD3DCubeTexture, (WINED3DCUBEMAP_FACES) FaceType, Level); - wined3d_mutex_unlock(); - - return hr; -} - -static HRESULT WINAPI IDirect3DCubeTexture9Impl_AddDirtyRect(LPDIRECT3DCUBETEXTURE9 iface, D3DCUBEMAP_FACES FaceType, CONST RECT* pDirtyRect) { - IDirect3DCubeTexture9Impl *This = (IDirect3DCubeTexture9Impl *)iface; - HRESULT hr; - - TRACE("iface %p, face %#x, dirty_rect %p.\n", iface, FaceType, pDirtyRect); - - wined3d_mutex_lock(); - hr = IWineD3DCubeTexture_AddDirtyRect(This->wineD3DCubeTexture, (WINED3DCUBEMAP_FACES) FaceType, pDirtyRect); - wined3d_mutex_unlock(); - - return hr; -} - - static const IDirect3DCubeTexture9Vtbl Direct3DCubeTexture9_Vtbl = { /* IUnknown */ @@ -400,13 +466,13 @@ HRESULT cubetexture_init(IDirect3DCubeTexture9Impl *texture, IDirect3DDevice9Imp { HRESULT hr; - texture->lpVtbl = &Direct3DCubeTexture9_Vtbl; + texture->IDirect3DCubeTexture9_iface.lpVtbl = &Direct3DCubeTexture9_Vtbl; texture->ref = 1; wined3d_mutex_lock(); - hr = IWineD3DDevice_CreateCubeTexture(device->WineD3DDevice, edge_length, + hr = wined3d_texture_create_cube(device->wined3d_device, edge_length, levels, usage, wined3dformat_from_d3dformat(format), pool, texture, - &d3d9_cubetexture_wined3d_parent_ops, &texture->wineD3DCubeTexture); + &d3d9_cubetexture_wined3d_parent_ops, &texture->wined3d_texture); wined3d_mutex_unlock(); if (FAILED(hr)) { @@ -414,7 +480,7 @@ HRESULT cubetexture_init(IDirect3DCubeTexture9Impl *texture, IDirect3DDevice9Imp return hr; } - texture->parentDevice = (IDirect3DDevice9Ex *)device; + texture->parentDevice = &device->IDirect3DDevice9Ex_iface; IDirect3DDevice9Ex_AddRef(texture->parentDevice); return D3D_OK; diff --git a/dll/directx/wine/d3d9/d3d9.rbuild b/dll/directx/wine/d3d9/d3d9.rbuild index af8412a9cb4..ac9689bc607 100644 --- a/dll/directx/wine/d3d9/d3d9.rbuild +++ b/dll/directx/wine/d3d9/d3d9.rbuild @@ -29,6 +29,7 @@ volume.c volumetexture.c version.rc + d3d9_private.h wineheaders diff --git a/dll/directx/wine/d3d9/d3d9_main.c b/dll/directx/wine/d3d9/d3d9_main.c index c405a5747d7..0d3ecec99d4 100644 --- a/dll/directx/wine/d3d9/d3d9_main.c +++ b/dll/directx/wine/d3d9/d3d9_main.c @@ -36,11 +36,11 @@ void WINAPI DebugSetMute(void) { IDirect3D9* WINAPI DECLSPEC_HOTPATCH Direct3DCreate9(UINT SDKVersion) { IDirect3D9Impl* object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3D9Impl)); - object->lpVtbl = &Direct3D9_Vtbl; + object->IDirect3D9Ex_iface.lpVtbl = &Direct3D9_Vtbl; object->ref = 1; wined3d_mutex_lock(); - object->WineD3D = WineDirect3DCreate(9, (IUnknown *)object); + object->WineD3D = wined3d_create(9, object); wined3d_mutex_unlock(); TRACE("SDKVersion = %x, Created Direct3D object @ %p, WineObj @ %p\n", SDKVersion, object, object->WineD3D); @@ -66,7 +66,7 @@ HRESULT WINAPI DECLSPEC_HOTPATCH Direct3DCreate9Ex(UINT SDKVersion, IDirect3D9Ex object = (IDirect3D9Impl *) ret; object->extended = TRUE; /* Enables QI for extended interfaces */ - *direct3d9ex = (IDirect3D9Ex *) object; + *direct3d9ex = &object->IDirect3D9Ex_iface; return D3D_OK; } diff --git a/dll/directx/wine/d3d9/device.c b/dll/directx/wine/d3d9/device.c index c788b987c8a..2af2c82460a 100644 --- a/dll/directx/wine/d3d9/device.c +++ b/dll/directx/wine/d3d9/device.c @@ -181,21 +181,15 @@ static UINT vertex_count_from_primitive_count(D3DPRIMITIVETYPE primitive_type, U } } -static ULONG WINAPI D3D9CB_DestroySwapChain(IWineD3DSwapChain *swapchain) +static inline IDirect3DDevice9Impl *impl_from_IDirect3DDevice9Ex(IDirect3DDevice9Ex *iface) { - IDirect3DSwapChain9Impl *parent; - - TRACE("swapchain %p.\n", swapchain); - - parent = IWineD3DSwapChain_GetParent(swapchain); - parent->isImplicit = FALSE; - IDirect3DSwapChain9_AddRef((IDirect3DSwapChain9 *)parent); - return IDirect3DSwapChain9_Release((IDirect3DSwapChain9 *)parent); + return CONTAINING_RECORD(iface, IDirect3DDevice9Impl, IDirect3DDevice9Ex_iface); } -/* IDirect3D IUnknown parts follow: */ -static HRESULT WINAPI IDirect3DDevice9Impl_QueryInterface(LPDIRECT3DDEVICE9EX iface, REFIID riid, LPVOID* ppobj) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI IDirect3DDevice9Impl_QueryInterface(IDirect3DDevice9Ex *iface, REFIID riid, + void **ppobj) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); IDirect3D9 *d3d; IDirect3D9Impl *d3dimpl; @@ -228,20 +222,14 @@ static HRESULT WINAPI IDirect3DDevice9Impl_QueryInterface(LPDIRECT3DDEVICE9EX if } } - if (IsEqualGUID(riid, &IID_IWineD3DDeviceParent)) - { - IUnknown_AddRef((IUnknown *)&This->device_parent_vtbl); - *ppobj = &This->device_parent_vtbl; - return S_OK; - } - WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj); *ppobj = NULL; return E_NOINTERFACE; } -static ULONG WINAPI IDirect3DDevice9Impl_AddRef(LPDIRECT3DDEVICE9EX iface) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static ULONG WINAPI IDirect3DDevice9Impl_AddRef(IDirect3DDevice9Ex *iface) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); ULONG ref = InterlockedIncrement(&This->ref); TRACE("%p increasing refcount to %u.\n", iface, ref); @@ -249,8 +237,9 @@ static ULONG WINAPI IDirect3DDevice9Impl_AddRef(LPDIRECT3DDEVICE9EX iface) { return ref; } -static ULONG WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_Release(LPDIRECT3DDEVICE9EX iface) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static ULONG WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_Release(IDirect3DDevice9Ex *iface) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); ULONG ref; if (This->inDestruction) return 0; @@ -271,9 +260,9 @@ static ULONG WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_Release(LPDIRECT3DDEV } HeapFree(GetProcessHeap(), 0, This->convertedDecls); - IWineD3DDevice_Uninit3D(This->WineD3DDevice, D3D9CB_DestroySwapChain); - IWineD3DDevice_ReleaseFocusWindow(This->WineD3DDevice); - IWineD3DDevice_Release(This->WineD3DDevice); + wined3d_device_uninit_3d(This->wined3d_device); + wined3d_device_release_focus_window(This->wined3d_device); + wined3d_device_decref(This->wined3d_device); wined3d_mutex_unlock(); HeapFree(GetProcessHeap(), 0, This); @@ -281,10 +270,9 @@ static ULONG WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_Release(LPDIRECT3DDEV return ref; } -/* IDirect3DDevice Interface follow: */ static HRESULT WINAPI IDirect3DDevice9Impl_TestCooperativeLevel(IDirect3DDevice9Ex *iface) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); TRACE("iface %p.\n", iface); @@ -297,36 +285,40 @@ static HRESULT WINAPI IDirect3DDevice9Impl_TestCooperativeLevel(IDirect3DDevice9 return D3D_OK; } -static UINT WINAPI IDirect3DDevice9Impl_GetAvailableTextureMem(LPDIRECT3DDEVICE9EX iface) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static UINT WINAPI IDirect3DDevice9Impl_GetAvailableTextureMem(IDirect3DDevice9Ex *iface) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - hr = IWineD3DDevice_GetAvailableTextureMem(This->WineD3DDevice); + hr = wined3d_device_get_available_texture_mem(This->wined3d_device); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_EvictManagedResources(LPDIRECT3DDEVICE9EX iface) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI IDirect3DDevice9Impl_EvictManagedResources(IDirect3DDevice9Ex *iface) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - hr = IWineD3DDevice_EvictManagedResources(This->WineD3DDevice); + hr = wined3d_device_evict_managed_resources(This->wined3d_device); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_GetDirect3D(LPDIRECT3DDEVICE9EX iface, IDirect3D9** ppD3D9) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI IDirect3DDevice9Impl_GetDirect3D(IDirect3DDevice9Ex *iface, + IDirect3D9 **ppD3D9) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); + struct wined3d *wined3d; HRESULT hr = D3D_OK; - IWineD3D* pWineD3D; TRACE("iface %p, d3d9 %p.\n", iface, ppD3D9); @@ -335,13 +327,15 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetDirect3D(LPDIRECT3DDEVICE9EX iface } wined3d_mutex_lock(); - hr = IWineD3DDevice_GetDirect3D(This->WineD3DDevice, &pWineD3D); - if (hr == D3D_OK && pWineD3D != NULL) + hr = wined3d_device_get_wined3d(This->wined3d_device, &wined3d); + if (hr == D3D_OK && wined3d) { - *ppD3D9 = IWineD3D_GetParent(pWineD3D); + *ppD3D9 = wined3d_get_parent(wined3d); IDirect3D9_AddRef(*ppD3D9); - IWineD3D_Release(pWineD3D); - } else { + wined3d_decref(wined3d); + } + else + { FIXME("Call to IWineD3DDevice_GetDirect3D failed\n"); *ppD3D9 = NULL; } @@ -351,8 +345,9 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetDirect3D(LPDIRECT3DDEVICE9EX iface return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_GetDeviceCaps(LPDIRECT3DDEVICE9EX iface, D3DCAPS9* pCaps) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI IDirect3DDevice9Impl_GetDeviceCaps(IDirect3DDevice9Ex *iface, D3DCAPS9 *pCaps) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hrc = D3D_OK; WINED3DCAPS *pWineCaps; @@ -369,7 +364,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetDeviceCaps(LPDIRECT3DDEVICE9EX i memset(pCaps, 0, sizeof(*pCaps)); wined3d_mutex_lock(); - hrc = IWineD3DDevice_GetDeviceCaps(This->WineD3DDevice, pWineCaps); + hrc = wined3d_device_get_device_caps(This->wined3d_device, pWineCaps); wined3d_mutex_unlock(); WINECAPSTOD3D9CAPS(pCaps, pWineCaps) @@ -384,14 +379,16 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetDeviceCaps(LPDIRECT3DDEVICE9EX i return hrc; } -static HRESULT WINAPI IDirect3DDevice9Impl_GetDisplayMode(LPDIRECT3DDEVICE9EX iface, UINT iSwapChain, D3DDISPLAYMODE* pMode) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI IDirect3DDevice9Impl_GetDisplayMode(IDirect3DDevice9Ex *iface, + UINT iSwapChain, D3DDISPLAYMODE *pMode) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, swapchain %u, mode %p.\n", iface, iSwapChain, pMode); wined3d_mutex_lock(); - hr = IWineD3DDevice_GetDisplayMode(This->WineD3DDevice, iSwapChain, (WINED3DDISPLAYMODE *) pMode); + hr = wined3d_device_get_display_mode(This->wined3d_device, iSwapChain, (WINED3DDISPLAYMODE *)pMode); wined3d_mutex_unlock(); if (SUCCEEDED(hr)) pMode->Format = d3dformat_from_wined3dformat(pMode->Format); @@ -399,57 +396,66 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetDisplayMode(LPDIRECT3DDEVICE9EX return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_GetCreationParameters(LPDIRECT3DDEVICE9EX iface, D3DDEVICE_CREATION_PARAMETERS *pParameters) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI IDirect3DDevice9Impl_GetCreationParameters(IDirect3DDevice9Ex *iface, + D3DDEVICE_CREATION_PARAMETERS *pParameters) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, parameters %p.\n", iface, pParameters); wined3d_mutex_lock(); - hr = IWineD3DDevice_GetCreationParameters(This->WineD3DDevice, (WINED3DDEVICE_CREATION_PARAMETERS *) pParameters); + hr = wined3d_device_get_creation_parameters(This->wined3d_device, + (WINED3DDEVICE_CREATION_PARAMETERS *)pParameters); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_SetCursorProperties(LPDIRECT3DDEVICE9EX iface, UINT XHotSpot, UINT YHotSpot, IDirect3DSurface9* pCursorBitmap) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI IDirect3DDevice9Impl_SetCursorProperties(IDirect3DDevice9Ex *iface, + UINT XHotSpot, UINT YHotSpot, IDirect3DSurface9 *pCursorBitmap) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); IDirect3DSurface9Impl *pSurface = (IDirect3DSurface9Impl*)pCursorBitmap; HRESULT hr; TRACE("iface %p, hotspot_x %u, hotspot_y %u, bitmap %p.\n", iface, XHotSpot, YHotSpot, pCursorBitmap); - if(!pCursorBitmap) { - WARN("No cursor bitmap, returning WINED3DERR_INVALIDCALL\n"); - return WINED3DERR_INVALIDCALL; + if (!pCursorBitmap) + { + WARN("No cursor bitmap, returning D3DERR_INVALIDCALL.\n"); + return D3DERR_INVALIDCALL; } wined3d_mutex_lock(); - hr = IWineD3DDevice_SetCursorProperties(This->WineD3DDevice, XHotSpot, YHotSpot, pSurface->wineD3DSurface); + hr = wined3d_device_set_cursor_properties(This->wined3d_device, XHotSpot, YHotSpot, pSurface->wined3d_surface); wined3d_mutex_unlock(); return hr; } -static void WINAPI IDirect3DDevice9Impl_SetCursorPosition(LPDIRECT3DDEVICE9EX iface, int XScreenSpace, int YScreenSpace, DWORD Flags) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static void WINAPI IDirect3DDevice9Impl_SetCursorPosition(IDirect3DDevice9Ex *iface, + int XScreenSpace, int YScreenSpace, DWORD Flags) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); TRACE("iface %p, x %u, y %u, flags %#x.\n", iface, XScreenSpace, YScreenSpace, Flags); wined3d_mutex_lock(); - IWineD3DDevice_SetCursorPosition(This->WineD3DDevice, XScreenSpace, YScreenSpace, Flags); + wined3d_device_set_cursor_position(This->wined3d_device, XScreenSpace, YScreenSpace, Flags); wined3d_mutex_unlock(); } -static BOOL WINAPI IDirect3DDevice9Impl_ShowCursor(LPDIRECT3DDEVICE9EX iface, BOOL bShow) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static BOOL WINAPI IDirect3DDevice9Impl_ShowCursor(IDirect3DDevice9Ex *iface, BOOL bShow) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); BOOL ret; TRACE("iface %p, show %#x.\n", iface, bShow); wined3d_mutex_lock(); - ret = IWineD3DDevice_ShowCursor(This->WineD3DDevice, bShow); + ret = wined3d_device_show_cursor(This->wined3d_device, bShow); wined3d_mutex_unlock(); return ret; @@ -458,7 +464,7 @@ static BOOL WINAPI IDirect3DDevice9Impl_ShowCursor(LPDIRECT3DDEVICE9EX ifac static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_CreateAdditionalSwapChain(IDirect3DDevice9Ex *iface, D3DPRESENT_PARAMETERS *present_parameters, IDirect3DSwapChain9 **swapchain) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); IDirect3DSwapChain9Impl *object; HRESULT hr; @@ -489,19 +495,19 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_CreateAdditionalSwa static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_GetSwapChain(IDirect3DDevice9Ex *iface, UINT swapchain_idx, IDirect3DSwapChain9 **swapchain) { - IWineD3DSwapChain *wined3d_swapchain = NULL; + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); + struct wined3d_swapchain *wined3d_swapchain = NULL; HRESULT hr; TRACE("iface %p, swapchain_idx %u, swapchain %p.\n", iface, swapchain_idx, swapchain); wined3d_mutex_lock(); - hr = IWineD3DDevice_GetSwapChain(((IDirect3DDevice9Impl *)iface)->WineD3DDevice, - swapchain_idx, &wined3d_swapchain); - if (SUCCEEDED(hr) && swapchain) + hr = wined3d_device_get_swapchain(This->wined3d_device, swapchain_idx, &wined3d_swapchain); + if (SUCCEEDED(hr) && wined3d_swapchain) { - *swapchain = IWineD3DSwapChain_GetParent(wined3d_swapchain); + *swapchain = wined3d_swapchain_get_parent(wined3d_swapchain); IDirect3DSwapChain9_AddRef(*swapchain); - IWineD3DSwapChain_Release(wined3d_swapchain); + wined3d_swapchain_decref(wined3d_swapchain); } else { @@ -514,78 +520,55 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_GetSwapChain(IDirec static UINT WINAPI IDirect3DDevice9Impl_GetNumberOfSwapChains(IDirect3DDevice9Ex *iface) { + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); UINT count; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - count = IWineD3DDevice_GetNumberOfSwapChains(((IDirect3DDevice9Impl *)iface)->WineD3DDevice); + count = wined3d_device_get_swapchain_count(This->wined3d_device); wined3d_mutex_unlock(); return count; } -static HRESULT WINAPI reset_enum_callback(IWineD3DResource *resource, void *data) { +static HRESULT WINAPI reset_enum_callback(struct wined3d_resource *resource, void *data) +{ + struct wined3d_resource_desc desc; BOOL *resources_ok = data; - D3DRESOURCETYPE type; - HRESULT ret = S_OK; - WINED3DSURFACE_DESC surface_desc; - WINED3DVOLUME_DESC volume_desc; - D3DINDEXBUFFER_DESC index_desc; - D3DVERTEXBUFFER_DESC vertex_desc; - WINED3DPOOL pool; - IDirect3DResource9 *parent; - parent = IWineD3DResource_GetParent(resource); - type = IDirect3DResource9_GetType(parent); - switch(type) { - case D3DRTYPE_SURFACE: - IWineD3DSurface_GetDesc((IWineD3DSurface *) resource, &surface_desc); - pool = surface_desc.pool; - break; - - case D3DRTYPE_VOLUME: - IWineD3DVolume_GetDesc((IWineD3DVolume *) resource, &volume_desc); - pool = volume_desc.Pool; - break; - - case D3DRTYPE_INDEXBUFFER: - IDirect3DIndexBuffer9_GetDesc((IDirect3DIndexBuffer9 *) parent, &index_desc); - pool = index_desc.Pool; - break; - - case D3DRTYPE_VERTEXBUFFER: - IDirect3DVertexBuffer9_GetDesc((IDirect3DVertexBuffer9 *)parent, &vertex_desc); - pool = vertex_desc.Pool; - break; - - /* No need to check for textures. If there is a D3DPOOL_DEFAULT texture, there - * is a D3DPOOL_DEFAULT surface or volume as well - */ - default: - pool = WINED3DPOOL_SCRATCH; /* a harmless pool */ - break; - } - - if (pool == WINED3DPOOL_DEFAULT) + wined3d_resource_get_desc(resource, &desc); + if (desc.pool == WINED3DPOOL_DEFAULT) { - IDirect3DResource9_AddRef(parent); - if (IUnknown_Release(parent) == 0) - { - TRACE("Parent %p is an implicit resource with ref 0\n", parent); - } else { - WARN("Resource %p(wineD3D %p) with pool D3DPOOL_DEFAULT blocks the Reset call\n", parent, resource); - ret = S_FALSE; - *resources_ok = FALSE; - } - } - IWineD3DResource_Release(resource); + IDirect3DSurface9 *surface; - return ret; + if (desc.resource_type != WINED3DRTYPE_SURFACE) + { + WARN("Resource %p in pool D3DPOOL_DEFAULT blocks the Reset call.\n", resource); + *resources_ok = FALSE; + return S_FALSE; + } + + surface = wined3d_resource_get_parent(resource); + + IDirect3DSurface9_AddRef(surface); + if (IDirect3DSurface9_Release(surface)) + { + WARN("Surface %p (resource %p) in pool D3DPOOL_DEFAULT blocks the Reset call.\n", surface, resource); + *resources_ok = FALSE; + return S_FALSE; + } + + WARN("Surface %p (resource %p) is an implicit resource with ref 0.\n", surface, resource); + } + + return S_OK; } -static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_Reset(LPDIRECT3DDEVICE9EX iface, D3DPRESENT_PARAMETERS* pPresentationParameters) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_Reset(IDirect3DDevice9Ex *iface, + D3DPRESENT_PARAMETERS *pPresentationParameters) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); WINED3DPRESENT_PARAMETERS localParameters; HRESULT hr; BOOL resources_ok = TRUE; @@ -602,21 +585,24 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_Reset(LPDIRECT3DDE * below fails, the device is considered "lost", and _Reset and _Release are the only allowed calls */ wined3d_mutex_lock(); - IWineD3DDevice_SetIndexBuffer(This->WineD3DDevice, NULL, WINED3DFMT_UNKNOWN); - for(i = 0; i < 16; i++) { - IWineD3DDevice_SetStreamSource(This->WineD3DDevice, i, NULL, 0, 0); + wined3d_device_set_index_buffer(This->wined3d_device, NULL, WINED3DFMT_UNKNOWN); + for (i = 0; i < 16; ++i) + { + wined3d_device_set_stream_source(This->wined3d_device, i, NULL, 0, 0); } - for(i = 0; i < 16; i++) { - IWineD3DDevice_SetTexture(This->WineD3DDevice, i, NULL); + for (i = 0; i < 16; ++i) + { + wined3d_device_set_texture(This->wined3d_device, i, NULL); } - IWineD3DDevice_EnumResources(This->WineD3DDevice, reset_enum_callback, &resources_ok); - if(!resources_ok) { + wined3d_device_enum_resources(This->wined3d_device, reset_enum_callback, &resources_ok); + if (!resources_ok) + { WARN("The application is holding D3DPOOL_DEFAULT resources, rejecting reset\n"); This->notreset = TRUE; wined3d_mutex_unlock(); - return WINED3DERR_INVALIDCALL; + return D3DERR_INVALIDCALL; } localParameters.BackBufferWidth = pPresentationParameters->BackBufferWidth; @@ -635,7 +621,7 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_Reset(LPDIRECT3DDE localParameters.PresentationInterval = pPresentationParameters->PresentationInterval; localParameters.AutoRestoreDisplayMode = TRUE; - hr = IWineD3DDevice_Reset(This->WineD3DDevice, &localParameters); + hr = wined3d_device_reset(This->wined3d_device, &localParameters); if(FAILED(hr)) { This->notreset = TRUE; @@ -662,16 +648,18 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_Reset(LPDIRECT3DDE return hr; } -static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_Present(LPDIRECT3DDEVICE9EX iface, CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* - pDirtyRegion) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_Present(IDirect3DDevice9Ex *iface, + const RECT *pSourceRect, const RECT *pDestRect, HWND hDestWindowOverride, + const RGNDATA *pDirtyRegion) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, src_rect %p, dst_rect %p, dst_window_override %p, dirty_region %p.\n", iface, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion); wined3d_mutex_lock(); - hr = IWineD3DDevice_Present(This->WineD3DDevice, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion); + hr = wined3d_device_present(This->wined3d_device, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion); wined3d_mutex_unlock(); return hr; @@ -680,47 +668,51 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_Present(LPDIRECT3D static HRESULT WINAPI IDirect3DDevice9Impl_GetBackBuffer(IDirect3DDevice9Ex *iface, UINT iSwapChain, UINT BackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface9 **ppBackBuffer) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; - IWineD3DSurface *retSurface = NULL; + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); + struct wined3d_surface *wined3d_surface = NULL; HRESULT hr; TRACE("iface %p, swapchain %u, backbuffer_idx %u, backbuffer_type %#x, backbuffer %p.\n", iface, iSwapChain, BackBuffer, Type, ppBackBuffer); wined3d_mutex_lock(); - hr = IWineD3DDevice_GetBackBuffer(This->WineD3DDevice, iSwapChain, - BackBuffer, (WINED3DBACKBUFFER_TYPE) Type, &retSurface); - if (SUCCEEDED(hr) && retSurface && ppBackBuffer) + hr = wined3d_device_get_back_buffer(This->wined3d_device, iSwapChain, + BackBuffer, (WINED3DBACKBUFFER_TYPE) Type, &wined3d_surface); + if (SUCCEEDED(hr) && wined3d_surface && ppBackBuffer) { - *ppBackBuffer = IWineD3DSurface_GetParent(retSurface); + *ppBackBuffer = wined3d_surface_get_parent(wined3d_surface); IDirect3DSurface9_AddRef(*ppBackBuffer); - IWineD3DSurface_Release(retSurface); + wined3d_surface_decref(wined3d_surface); } wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_GetRasterStatus(LPDIRECT3DDEVICE9EX iface, UINT iSwapChain, D3DRASTER_STATUS* pRasterStatus) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI IDirect3DDevice9Impl_GetRasterStatus(IDirect3DDevice9Ex *iface, + UINT iSwapChain, D3DRASTER_STATUS *pRasterStatus) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, swapchain %u, raster_status %p.\n", iface, iSwapChain, pRasterStatus); wined3d_mutex_lock(); - hr = IWineD3DDevice_GetRasterStatus(This->WineD3DDevice, iSwapChain, (WINED3DRASTER_STATUS *) pRasterStatus); + hr = wined3d_device_get_raster_status(This->wined3d_device, iSwapChain, (WINED3DRASTER_STATUS *)pRasterStatus); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_SetDialogBoxMode(LPDIRECT3DDEVICE9EX iface, BOOL bEnableDialogs) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI IDirect3DDevice9Impl_SetDialogBoxMode(IDirect3DDevice9Ex *iface, + BOOL bEnableDialogs) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, enable %#x.\n", iface, bEnableDialogs); wined3d_mutex_lock(); - hr = IWineD3DDevice_SetDialogBoxMode(This->WineD3DDevice, bEnableDialogs); + hr = wined3d_device_set_dialog_box_mode(This->wined3d_device, bEnableDialogs); wined3d_mutex_unlock(); return hr; @@ -729,24 +721,26 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetDialogBoxMode(LPDIRECT3DDEVICE9EX static void WINAPI IDirect3DDevice9Impl_SetGammaRamp(IDirect3DDevice9Ex *iface, UINT iSwapChain, DWORD Flags, const D3DGAMMARAMP *pRamp) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); TRACE("iface %p, swapchain %u, flags %#x, ramp %p.\n", iface, iSwapChain, Flags, pRamp); /* Note: D3DGAMMARAMP is compatible with WINED3DGAMMARAMP */ wined3d_mutex_lock(); - IWineD3DDevice_SetGammaRamp(This->WineD3DDevice, iSwapChain, Flags, (CONST WINED3DGAMMARAMP *)pRamp); + wined3d_device_set_gamma_ramp(This->wined3d_device, iSwapChain, Flags, (const WINED3DGAMMARAMP *)pRamp); wined3d_mutex_unlock(); } -static void WINAPI IDirect3DDevice9Impl_GetGammaRamp(LPDIRECT3DDEVICE9EX iface, UINT iSwapChain, D3DGAMMARAMP* pRamp) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static void WINAPI IDirect3DDevice9Impl_GetGammaRamp(IDirect3DDevice9Ex *iface, UINT iSwapChain, + D3DGAMMARAMP *pRamp) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); TRACE("iface %p, swapchain %u, ramp %p.\n", iface, iSwapChain, pRamp); /* Note: D3DGAMMARAMP is compatible with WINED3DGAMMARAMP */ wined3d_mutex_lock(); - IWineD3DDevice_GetGammaRamp(This->WineD3DDevice, iSwapChain, (WINED3DGAMMARAMP *) pRamp); + wined3d_device_get_gamma_ramp(This->wined3d_device, iSwapChain, (WINED3DGAMMARAMP *)pRamp); wined3d_mutex_unlock(); } @@ -754,7 +748,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_CreateTexture(IDirect3DDevice9Ex *ifa UINT width, UINT height, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool, IDirect3DTexture9 **texture, HANDLE *shared_handle) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); IDirect3DTexture9Impl *object; HRESULT hr; @@ -777,7 +771,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_CreateTexture(IDirect3DDevice9Ex *ifa } TRACE("Created texture %p.\n", object); - *texture = (IDirect3DTexture9 *)object; + *texture = &object->IDirect3DTexture9_iface; return D3D_OK; } @@ -786,7 +780,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_CreateVolumeTexture(IDirect3DDevice9E UINT width, UINT height, UINT depth, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool, IDirect3DVolumeTexture9 **texture, HANDLE *shared_handle) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); IDirect3DVolumeTexture9Impl *object; HRESULT hr; @@ -811,7 +805,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_CreateVolumeTexture(IDirect3DDevice9E } TRACE("Created volume texture %p.\n", object); - *texture = (IDirect3DVolumeTexture9 *)object; + *texture = &object->IDirect3DVolumeTexture9_iface; return D3D_OK; } @@ -820,7 +814,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_CreateCubeTexture(IDirect3DDevice9Ex UINT edge_length, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool, IDirect3DCubeTexture9 **texture, HANDLE *shared_handle) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); IDirect3DCubeTexture9Impl *object; HRESULT hr; @@ -843,15 +837,16 @@ static HRESULT WINAPI IDirect3DDevice9Impl_CreateCubeTexture(IDirect3DDevice9Ex } TRACE("Created cube texture %p.\n", object); - *texture = (IDirect3DCubeTexture9 *)object; + *texture = &object->IDirect3DCubeTexture9_iface; return D3D_OK; } -static HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexBuffer(IDirect3DDevice9Ex *iface, UINT size, DWORD usage, - DWORD fvf, D3DPOOL pool, IDirect3DVertexBuffer9 **buffer, HANDLE *shared_handle) +static HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexBuffer(IDirect3DDevice9Ex *iface, UINT size, + DWORD usage, DWORD fvf, D3DPOOL pool, IDirect3DVertexBuffer9 **buffer, + HANDLE *shared_handle) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); IDirect3DVertexBuffer9Impl *object; HRESULT hr; @@ -879,10 +874,11 @@ static HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexBuffer(IDirect3DDevice9Ex return D3D_OK; } -static HRESULT WINAPI IDirect3DDevice9Impl_CreateIndexBuffer(IDirect3DDevice9Ex *iface, UINT size, DWORD usage, - D3DFORMAT format, D3DPOOL pool, IDirect3DIndexBuffer9 **buffer, HANDLE *shared_handle) +static HRESULT WINAPI IDirect3DDevice9Impl_CreateIndexBuffer(IDirect3DDevice9Ex *iface, UINT size, + DWORD usage, D3DFORMAT format, D3DPOOL pool, IDirect3DIndexBuffer9 **buffer, + HANDLE *shared_handle) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); IDirect3DIndexBuffer9Impl *object; HRESULT hr; @@ -910,18 +906,18 @@ static HRESULT WINAPI IDirect3DDevice9Impl_CreateIndexBuffer(IDirect3DDevice9Ex return D3D_OK; } -static HRESULT IDirect3DDevice9Impl_CreateSurface(LPDIRECT3DDEVICE9EX iface, UINT Width, UINT Height, - D3DFORMAT Format, BOOL Lockable, BOOL Discard, UINT Level, IDirect3DSurface9 **ppSurface, - UINT Usage, D3DPOOL Pool, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality) +static HRESULT IDirect3DDevice9Impl_CreateSurface(IDirect3DDevice9Impl *device, UINT Width, + UINT Height, D3DFORMAT Format, BOOL Lockable, BOOL Discard, UINT Level, + IDirect3DSurface9 **ppSurface, UINT Usage, D3DPOOL Pool, D3DMULTISAMPLE_TYPE MultiSample, + DWORD MultisampleQuality) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; IDirect3DSurface9Impl *object; HRESULT hr; - TRACE("iface %p, width %u, height %u, format %#x, lockable %#x, discard %#x, level %u, surface %p.\n" + TRACE("device %p, width %u, height %u, format %#x, lockable %#x, discard %#x, level %u, surface %p.\n" "usage %#x, pool %#x, multisample_type %#x, multisample_quality %u.\n", - iface, Width, Height, Format, Lockable, Discard, Level, ppSurface, - Usage, Pool, MultiSample, MultisampleQuality); + device, Width, Height, Format, Lockable, Discard, Level, ppSurface, Usage, Pool, + MultiSample, MultisampleQuality); object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DSurface9Impl)); if (!object) @@ -930,8 +926,8 @@ static HRESULT IDirect3DDevice9Impl_CreateSurface(LPDIRECT3DDEVICE9EX iface, UIN return D3DERR_OUTOFVIDEOMEMORY; } - hr = surface_init(object, This, Width, Height, Format, Lockable, Discard, - Level, Usage, Pool, MultiSample, MultisampleQuality); + hr = surface_init(object, device, Width, Height, Format, Lockable, Discard, Level, Usage, Pool, + MultiSample, MultisampleQuality); if (FAILED(hr)) { WARN("Failed to initialize surface, hr %#x.\n", hr); @@ -945,10 +941,11 @@ static HRESULT IDirect3DDevice9Impl_CreateSurface(LPDIRECT3DDEVICE9EX iface, UIN return D3D_OK; } -static HRESULT WINAPI IDirect3DDevice9Impl_CreateRenderTarget(IDirect3DDevice9Ex *iface, UINT Width, UINT Height, - D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, BOOL Lockable, - IDirect3DSurface9 **ppSurface, HANDLE *pSharedHandle) +static HRESULT WINAPI IDirect3DDevice9Impl_CreateRenderTarget(IDirect3DDevice9Ex *iface, UINT Width, + UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, + BOOL Lockable, IDirect3DSurface9 **ppSurface, HANDLE *pSharedHandle) { + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, width %u, height %u, format %#x, multisample_type %#x, multisample_quality %u.\n" @@ -956,16 +953,19 @@ static HRESULT WINAPI IDirect3DDevice9Impl_CreateRenderTarget(IDirect3DDevice9Ex iface, Width, Height, Format, MultiSample, MultisampleQuality, Lockable, ppSurface, pSharedHandle); - hr = IDirect3DDevice9Impl_CreateSurface(iface, Width, Height, Format, Lockable, FALSE /* Discard */, - 0 /* Level */, ppSurface, D3DUSAGE_RENDERTARGET, D3DPOOL_DEFAULT, MultiSample, MultisampleQuality); + hr = IDirect3DDevice9Impl_CreateSurface(This, Width, Height, Format, Lockable, + FALSE /* Discard */, 0 /* Level */, ppSurface, D3DUSAGE_RENDERTARGET, D3DPOOL_DEFAULT, + MultiSample, MultisampleQuality); return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_CreateDepthStencilSurface(LPDIRECT3DDEVICE9EX iface, UINT Width, UINT Height, - D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, - DWORD MultisampleQuality, BOOL Discard, - IDirect3DSurface9 **ppSurface, HANDLE* pSharedHandle) { +static HRESULT WINAPI IDirect3DDevice9Impl_CreateDepthStencilSurface(IDirect3DDevice9Ex *iface, + UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, + DWORD MultisampleQuality, BOOL Discard, IDirect3DSurface9 **ppSurface, + HANDLE *pSharedHandle) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, width %u, height %u, format %#x, multisample_type %#x, multisample_quality %u.\n" @@ -973,35 +973,45 @@ static HRESULT WINAPI IDirect3DDevice9Impl_CreateDepthStencilSurface(LPDIRECT3 iface, Width, Height, Format, MultiSample, MultisampleQuality, Discard, ppSurface, pSharedHandle); - hr = IDirect3DDevice9Impl_CreateSurface(iface, Width, Height, Format, TRUE /* Lockable */, Discard, - 0 /* Level */, ppSurface, D3DUSAGE_DEPTHSTENCIL, D3DPOOL_DEFAULT, MultiSample, MultisampleQuality); + hr = IDirect3DDevice9Impl_CreateSurface(This, Width, Height, Format, TRUE /* Lockable */, + Discard, 0 /* Level */, ppSurface, D3DUSAGE_DEPTHSTENCIL, D3DPOOL_DEFAULT, MultiSample, + MultisampleQuality); return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_UpdateSurface(LPDIRECT3DDEVICE9EX iface, IDirect3DSurface9* pSourceSurface, CONST RECT* pSourceRect, IDirect3DSurface9* pDestinationSurface, CONST POINT* pDestPoint) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI IDirect3DDevice9Impl_UpdateSurface(IDirect3DDevice9Ex *iface, + IDirect3DSurface9 *pSourceSurface, const RECT *pSourceRect, + IDirect3DSurface9 *pDestinationSurface, const POINT *pDestPoint) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, src_surface %p, src_rect %p, dst_surface %p, dst_point %p.\n", iface, pSourceSurface, pSourceRect, pDestinationSurface, pDestPoint); wined3d_mutex_lock(); - hr = IWineD3DDevice_UpdateSurface(This->WineD3DDevice, ((IDirect3DSurface9Impl *)pSourceSurface)->wineD3DSurface, pSourceRect, ((IDirect3DSurface9Impl *)pDestinationSurface)->wineD3DSurface, pDestPoint); + hr = wined3d_device_update_surface(This->wined3d_device, + ((IDirect3DSurface9Impl *)pSourceSurface)->wined3d_surface, pSourceRect, + ((IDirect3DSurface9Impl *)pDestinationSurface)->wined3d_surface, pDestPoint); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_UpdateTexture(LPDIRECT3DDEVICE9EX iface, IDirect3DBaseTexture9* pSourceTexture, IDirect3DBaseTexture9* pDestinationTexture) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI IDirect3DDevice9Impl_UpdateTexture(IDirect3DDevice9Ex *iface, + IDirect3DBaseTexture9 *src_texture, IDirect3DBaseTexture9 *dst_texture) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; - TRACE("iface %p, src_texture %p, dst_texture %p.\n", iface, pSourceTexture, pDestinationTexture); + TRACE("iface %p, src_texture %p, dst_texture %p.\n", iface, src_texture, dst_texture); wined3d_mutex_lock(); - hr = IWineD3DDevice_UpdateTexture(This->WineD3DDevice, ((IDirect3DBaseTexture9Impl *)pSourceTexture)->wineD3DBaseTexture, ((IDirect3DBaseTexture9Impl *)pDestinationTexture)->wineD3DBaseTexture); + hr = wined3d_device_update_texture(This->wined3d_device, + ((IDirect3DBaseTexture9Impl *)src_texture)->wined3d_texture, + ((IDirect3DBaseTexture9Impl *)dst_texture)->wined3d_texture); wined3d_mutex_unlock(); return hr; @@ -1017,21 +1027,24 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetRenderTargetData(IDirect3DDevice9E TRACE("iface %p, render_target %p, dst_surface %p.\n", iface, pRenderTarget, pDestSurface); wined3d_mutex_lock(); - hr = IWineD3DSurface_BltFast(destSurface->wineD3DSurface, 0, 0, renderTarget->wineD3DSurface, NULL, WINEDDBLTFAST_NOCOLORKEY); + hr = wined3d_surface_bltfast(destSurface->wined3d_surface, 0, 0, + renderTarget->wined3d_surface, NULL, WINEDDBLTFAST_NOCOLORKEY); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_GetFrontBufferData(LPDIRECT3DDEVICE9EX iface, UINT iSwapChain, IDirect3DSurface9* pDestSurface) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI IDirect3DDevice9Impl_GetFrontBufferData(IDirect3DDevice9Ex *iface, + UINT iSwapChain, IDirect3DSurface9 *pDestSurface) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); IDirect3DSurface9Impl *destSurface = (IDirect3DSurface9Impl *)pDestSurface; HRESULT hr; TRACE("iface %p, swapchain %u, dst_surface %p.\n", iface, iSwapChain, pDestSurface); wined3d_mutex_lock(); - hr = IWineD3DDevice_GetFrontBufferData(This->WineD3DDevice, iSwapChain, destSurface->wineD3DSurface); + hr = wined3d_device_get_front_buffer_data(This->wined3d_device, iSwapChain, destSurface->wined3d_surface); wined3d_mutex_unlock(); return hr; @@ -1048,7 +1061,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_StretchRect(IDirect3DDevice9Ex *iface iface, pSourceSurface, pSourceRect, pDestSurface, pDestRect, Filter); wined3d_mutex_lock(); - hr = IWineD3DSurface_Blt(dst->wineD3DSurface, pDestRect, src->wineD3DSurface, pSourceRect, 0, NULL, Filter); + hr = wined3d_surface_blt(dst->wined3d_surface, pDestRect, src->wined3d_surface, pSourceRect, 0, NULL, Filter); wined3d_mutex_unlock(); return hr; @@ -1064,41 +1077,41 @@ static HRESULT WINAPI IDirect3DDevice9Impl_ColorFill(IDirect3DDevice9Ex *iface, (color & 0xff) / 255.0f, ((color >> 24) & 0xff) / 255.0f, }; - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); IDirect3DSurface9Impl *surface = (IDirect3DSurface9Impl *)pSurface; - WINED3DPOOL pool; - WINED3DRESOURCETYPE restype; - DWORD usage; - WINED3DSURFACE_DESC desc; + struct wined3d_resource *wined3d_resource; + struct wined3d_resource_desc desc; HRESULT hr; TRACE("iface %p, surface %p, rect %p, color 0x%08x.\n", iface, pSurface, pRect, color); wined3d_mutex_lock(); - IWineD3DSurface_GetDesc(surface->wineD3DSurface, &desc); - usage = desc.usage; - pool = desc.pool; - restype = desc.resource_type; + wined3d_resource = wined3d_surface_get_resource(surface->wined3d_surface); + wined3d_resource_get_desc(wined3d_resource, &desc); - /* This method is only allowed with surfaces that are render targets, or offscreen plain surfaces - * in D3DPOOL_DEFAULT - */ - if(!(usage & WINED3DUSAGE_RENDERTARGET) && (pool != WINED3DPOOL_DEFAULT || restype != WINED3DRTYPE_SURFACE)) { + /* This method is only allowed with surfaces that are render targets, or + * offscreen plain surfaces in D3DPOOL_DEFAULT. */ + if (!(desc.usage & WINED3DUSAGE_RENDERTARGET) && desc.pool != WINED3DPOOL_DEFAULT) + { wined3d_mutex_unlock(); WARN("Surface is not a render target, or not a stand-alone D3DPOOL_DEFAULT surface\n"); return D3DERR_INVALIDCALL; } /* Colorfill can only be used on rendertarget surfaces, or offscreen plain surfaces in D3DPOOL_DEFAULT */ - hr = IWineD3DDevice_ColorFill(This->WineD3DDevice, surface->wineD3DSurface, pRect, &c); + hr = wined3d_device_color_fill(This->wined3d_device, surface->wined3d_surface, pRect, &c); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_CreateOffscreenPlainSurface(LPDIRECT3DDEVICE9EX iface, UINT Width, UINT Height, D3DFORMAT Format, D3DPOOL Pool, IDirect3DSurface9 **ppSurface, HANDLE* pSharedHandle) { +static HRESULT WINAPI IDirect3DDevice9Impl_CreateOffscreenPlainSurface(IDirect3DDevice9Ex *iface, + UINT Width, UINT Height, D3DFORMAT Format, D3DPOOL Pool, IDirect3DSurface9 **ppSurface, + HANDLE *pSharedHandle) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, width %u, height %u, format %#x, pool %#x, surface %p, shared_handle %p.\n", @@ -1115,16 +1128,18 @@ static HRESULT WINAPI IDirect3DDevice9Impl_CreateOffscreenPlainSurface(LPDIREC Why, their always lockable? should I change the usage to dynamic? */ - hr = IDirect3DDevice9Impl_CreateSurface(iface, Width, Height, Format, TRUE /* Lockable */, FALSE /* Discard */, - 0 /* Level */, ppSurface, 0 /* Usage (undefined/none) */, (WINED3DPOOL)Pool, D3DMULTISAMPLE_NONE, - 0 /* MultisampleQuality */); + hr = IDirect3DDevice9Impl_CreateSurface(This, Width, Height, Format, TRUE /* Lockable */, + FALSE /* Discard */, 0 /* Level */, ppSurface, 0 /* Usage (undefined/none) */, + (WINED3DPOOL)Pool, D3DMULTISAMPLE_NONE, 0 /* MultisampleQuality */); return hr; } /* TODO: move to wineD3D */ -static HRESULT WINAPI IDirect3DDevice9Impl_SetRenderTarget(LPDIRECT3DDEVICE9EX iface, DWORD RenderTargetIndex, IDirect3DSurface9* pRenderTarget) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI IDirect3DDevice9Impl_SetRenderTarget(IDirect3DDevice9Ex *iface, + DWORD RenderTargetIndex, IDirect3DSurface9 *pRenderTarget) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); IDirect3DSurface9Impl *pSurface = (IDirect3DSurface9Impl*)pRenderTarget; HRESULT hr; @@ -1137,7 +1152,8 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetRenderTarget(LPDIRECT3DDEVICE9EX } wined3d_mutex_lock(); - hr = IWineD3DDevice_SetRenderTarget(This->WineD3DDevice, RenderTargetIndex, pSurface ? pSurface->wineD3DSurface : NULL, TRUE); + hr = wined3d_device_set_render_target(This->wined3d_device, RenderTargetIndex, + pSurface ? pSurface->wined3d_surface : NULL, TRUE); wined3d_mutex_unlock(); return hr; @@ -1146,8 +1162,8 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetRenderTarget(LPDIRECT3DDEVICE9EX static HRESULT WINAPI IDirect3DDevice9Impl_GetRenderTarget(IDirect3DDevice9Ex *iface, DWORD RenderTargetIndex, IDirect3DSurface9 **ppRenderTarget) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; - IWineD3DSurface *pRenderTarget; + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); + struct wined3d_surface *wined3d_surface; HRESULT hr; TRACE("iface %p, idx %u, surface %p.\n", iface, RenderTargetIndex, ppRenderTarget); @@ -1164,21 +1180,21 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetRenderTarget(IDirect3DDevice9Ex *i wined3d_mutex_lock(); - hr=IWineD3DDevice_GetRenderTarget(This->WineD3DDevice,RenderTargetIndex,&pRenderTarget); + hr = wined3d_device_get_render_target(This->wined3d_device, RenderTargetIndex, &wined3d_surface); if (FAILED(hr)) { FIXME("Call to IWineD3DDevice_GetRenderTarget failed, hr %#x\n", hr); } - else if (!pRenderTarget) + else if (!wined3d_surface) { *ppRenderTarget = NULL; } else { - *ppRenderTarget = IWineD3DSurface_GetParent(pRenderTarget); + *ppRenderTarget = wined3d_surface_get_parent(wined3d_surface); IDirect3DSurface9_AddRef(*ppRenderTarget); - IWineD3DSurface_Release(pRenderTarget); + wined3d_surface_decref(wined3d_surface); } wined3d_mutex_unlock(); @@ -1186,8 +1202,10 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetRenderTarget(IDirect3DDevice9Ex *i return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_SetDepthStencilSurface(LPDIRECT3DDEVICE9EX iface, IDirect3DSurface9* pZStencilSurface) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI IDirect3DDevice9Impl_SetDepthStencilSurface(IDirect3DDevice9Ex *iface, + IDirect3DSurface9 *pZStencilSurface) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); IDirect3DSurface9Impl *pSurface; HRESULT hr; @@ -1196,7 +1214,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetDepthStencilSurface(LPDIRECT3DDE pSurface = (IDirect3DSurface9Impl*)pZStencilSurface; wined3d_mutex_lock(); - hr = IWineD3DDevice_SetDepthStencilSurface(This->WineD3DDevice, NULL==pSurface ? NULL : pSurface->wineD3DSurface); + hr = wined3d_device_set_depth_stencil(This->wined3d_device, pSurface ? pSurface->wined3d_surface : NULL); wined3d_mutex_unlock(); return hr; @@ -1205,8 +1223,8 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetDepthStencilSurface(LPDIRECT3DDE static HRESULT WINAPI IDirect3DDevice9Impl_GetDepthStencilSurface(IDirect3DDevice9Ex *iface, IDirect3DSurface9 **ppZStencilSurface) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; - IWineD3DSurface *pZStencilSurface; + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); + struct wined3d_surface *wined3d_surface; HRESULT hr; TRACE("iface %p, depth_stencil %p.\n", iface, ppZStencilSurface); @@ -1216,12 +1234,12 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetDepthStencilSurface(IDirect3DDevic } wined3d_mutex_lock(); - hr = IWineD3DDevice_GetDepthStencilSurface(This->WineD3DDevice,&pZStencilSurface); + hr = wined3d_device_get_depth_stencil(This->wined3d_device, &wined3d_surface); if (SUCCEEDED(hr)) { - *ppZStencilSurface = IWineD3DSurface_GetParent(pZStencilSurface); + *ppZStencilSurface = wined3d_surface_get_parent(wined3d_surface); IDirect3DSurface9_AddRef(*ppZStencilSurface); - IWineD3DSurface_Release(pZStencilSurface); + wined3d_surface_decref(wined3d_surface); } else { @@ -1234,34 +1252,38 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetDepthStencilSurface(IDirect3DDevic return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_BeginScene(LPDIRECT3DDEVICE9EX iface) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI IDirect3DDevice9Impl_BeginScene(IDirect3DDevice9Ex *iface) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - hr = IWineD3DDevice_BeginScene(This->WineD3DDevice); + hr = wined3d_device_begin_scene(This->wined3d_device); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_EndScene(LPDIRECT3DDEVICE9EX iface) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_EndScene(IDirect3DDevice9Ex *iface) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - hr = IWineD3DDevice_EndScene(This->WineD3DDevice); + hr = wined3d_device_end_scene(This->wined3d_device); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_Clear(LPDIRECT3DDEVICE9EX iface, DWORD Count, CONST D3DRECT* pRects, DWORD Flags, D3DCOLOR Color, float Z, DWORD Stencil) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI IDirect3DDevice9Impl_Clear(IDirect3DDevice9Ex *iface, DWORD Count, + const D3DRECT *pRects, DWORD Flags, D3DCOLOR Color, float Z, DWORD Stencil) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, rect_count %u, rects %p, flags %#x, color 0x%08x, z %.8e, stencil %u.\n", @@ -1269,211 +1291,241 @@ static HRESULT WINAPI IDirect3DDevice9Impl_Clear(LPDIRECT3DDEVICE9EX iface, DW /* Note: D3DRECT is compatible with WINED3DRECT */ wined3d_mutex_lock(); - hr = IWineD3DDevice_Clear(This->WineD3DDevice, Count, (const RECT *)pRects, Flags, Color, Z, Stencil); + hr = wined3d_device_clear(This->wined3d_device, Count, (const RECT *)pRects, Flags, Color, Z, Stencil); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_SetTransform(LPDIRECT3DDEVICE9EX iface, D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX* lpMatrix) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI IDirect3DDevice9Impl_SetTransform(IDirect3DDevice9Ex *iface, + D3DTRANSFORMSTATETYPE State, const D3DMATRIX *lpMatrix) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, state %#x, matrix %p.\n", iface, State, lpMatrix); /* Note: D3DMATRIX is compatible with WINED3DMATRIX */ wined3d_mutex_lock(); - hr = IWineD3DDevice_SetTransform(This->WineD3DDevice, State, (CONST WINED3DMATRIX*) lpMatrix); + hr = wined3d_device_set_transform(This->wined3d_device, State, (const WINED3DMATRIX *)lpMatrix); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_GetTransform(LPDIRECT3DDEVICE9EX iface, D3DTRANSFORMSTATETYPE State, D3DMATRIX* pMatrix) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI IDirect3DDevice9Impl_GetTransform(IDirect3DDevice9Ex *iface, + D3DTRANSFORMSTATETYPE State, D3DMATRIX *pMatrix) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, state %#x, matrix %p.\n", iface, State, pMatrix); /* Note: D3DMATRIX is compatible with WINED3DMATRIX */ wined3d_mutex_lock(); - hr = IWineD3DDevice_GetTransform(This->WineD3DDevice, State, (WINED3DMATRIX*) pMatrix); + hr = wined3d_device_get_transform(This->wined3d_device, State, (WINED3DMATRIX *)pMatrix); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_MultiplyTransform(LPDIRECT3DDEVICE9EX iface, D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX* pMatrix) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI IDirect3DDevice9Impl_MultiplyTransform(IDirect3DDevice9Ex *iface, + D3DTRANSFORMSTATETYPE State, const D3DMATRIX *pMatrix) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, state %#x, matrix %p.\n", iface, State, pMatrix); /* Note: D3DMATRIX is compatible with WINED3DMATRIX */ wined3d_mutex_lock(); - hr = IWineD3DDevice_MultiplyTransform(This->WineD3DDevice, State, (CONST WINED3DMATRIX*) pMatrix); + hr = wined3d_device_multiply_transform(This->wined3d_device, State, (const WINED3DMATRIX *)pMatrix); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_SetViewport(LPDIRECT3DDEVICE9EX iface, CONST D3DVIEWPORT9* pViewport) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI IDirect3DDevice9Impl_SetViewport(IDirect3DDevice9Ex *iface, + const D3DVIEWPORT9 *pViewport) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, viewport %p.\n", iface, pViewport); /* Note: D3DVIEWPORT9 is compatible with WINED3DVIEWPORT */ wined3d_mutex_lock(); - hr = IWineD3DDevice_SetViewport(This->WineD3DDevice, (const WINED3DVIEWPORT *)pViewport); + hr = wined3d_device_set_viewport(This->wined3d_device, (const WINED3DVIEWPORT *)pViewport); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_GetViewport(LPDIRECT3DDEVICE9EX iface, D3DVIEWPORT9* pViewport) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI IDirect3DDevice9Impl_GetViewport(IDirect3DDevice9Ex *iface, + D3DVIEWPORT9 *pViewport) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, viewport %p.\n", iface, pViewport); /* Note: D3DVIEWPORT9 is compatible with WINED3DVIEWPORT */ wined3d_mutex_lock(); - hr = IWineD3DDevice_GetViewport(This->WineD3DDevice, (WINED3DVIEWPORT *)pViewport); + hr = wined3d_device_get_viewport(This->wined3d_device, (WINED3DVIEWPORT *)pViewport); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_SetMaterial(LPDIRECT3DDEVICE9EX iface, CONST D3DMATERIAL9* pMaterial) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI IDirect3DDevice9Impl_SetMaterial(IDirect3DDevice9Ex *iface, + const D3DMATERIAL9 *pMaterial) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, material %p.\n", iface, pMaterial); /* Note: D3DMATERIAL9 is compatible with WINED3DMATERIAL */ wined3d_mutex_lock(); - hr = IWineD3DDevice_SetMaterial(This->WineD3DDevice, (const WINED3DMATERIAL *)pMaterial); + hr = wined3d_device_set_material(This->wined3d_device, (const WINED3DMATERIAL *)pMaterial); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_GetMaterial(LPDIRECT3DDEVICE9EX iface, D3DMATERIAL9* pMaterial) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI IDirect3DDevice9Impl_GetMaterial(IDirect3DDevice9Ex *iface, + D3DMATERIAL9 *pMaterial) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, material %p.\n", iface, pMaterial); /* Note: D3DMATERIAL9 is compatible with WINED3DMATERIAL */ wined3d_mutex_lock(); - hr = IWineD3DDevice_GetMaterial(This->WineD3DDevice, (WINED3DMATERIAL *)pMaterial); + hr = wined3d_device_get_material(This->wined3d_device, (WINED3DMATERIAL *)pMaterial); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_SetLight(LPDIRECT3DDEVICE9EX iface, DWORD Index, CONST D3DLIGHT9* pLight) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI IDirect3DDevice9Impl_SetLight(IDirect3DDevice9Ex *iface, DWORD Index, + const D3DLIGHT9 *pLight) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, index %u, light %p.\n", iface, Index, pLight); /* Note: D3DLIGHT9 is compatible with WINED3DLIGHT */ wined3d_mutex_lock(); - hr = IWineD3DDevice_SetLight(This->WineD3DDevice, Index, (const WINED3DLIGHT *)pLight); + hr = wined3d_device_set_light(This->wined3d_device, Index, (const WINED3DLIGHT *)pLight); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_GetLight(LPDIRECT3DDEVICE9EX iface, DWORD Index, D3DLIGHT9* pLight) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI IDirect3DDevice9Impl_GetLight(IDirect3DDevice9Ex *iface, DWORD Index, + D3DLIGHT9 *pLight) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, index %u, light %p.\n", iface, Index, pLight); /* Note: D3DLIGHT9 is compatible with WINED3DLIGHT */ wined3d_mutex_lock(); - hr = IWineD3DDevice_GetLight(This->WineD3DDevice, Index, (WINED3DLIGHT *)pLight); + hr = wined3d_device_get_light(This->wined3d_device, Index, (WINED3DLIGHT *)pLight); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_LightEnable(LPDIRECT3DDEVICE9EX iface, DWORD Index, BOOL Enable) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI IDirect3DDevice9Impl_LightEnable(IDirect3DDevice9Ex *iface, DWORD Index, + BOOL Enable) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, index %u, enable %#x.\n", iface, Index, Enable); wined3d_mutex_lock(); - hr = IWineD3DDevice_SetLightEnable(This->WineD3DDevice, Index, Enable); + hr = wined3d_device_set_light_enable(This->wined3d_device, Index, Enable); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_GetLightEnable(LPDIRECT3DDEVICE9EX iface, DWORD Index, BOOL* pEnable) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI IDirect3DDevice9Impl_GetLightEnable(IDirect3DDevice9Ex *iface, DWORD Index, + BOOL *pEnable) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, index %u, enable %p.\n", iface, Index, pEnable); wined3d_mutex_lock(); - hr = IWineD3DDevice_GetLightEnable(This->WineD3DDevice, Index, pEnable); + hr = wined3d_device_get_light_enable(This->wined3d_device, Index, pEnable); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_SetClipPlane(LPDIRECT3DDEVICE9EX iface, DWORD Index, CONST float* pPlane) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI IDirect3DDevice9Impl_SetClipPlane(IDirect3DDevice9Ex *iface, DWORD Index, + const float *pPlane) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, index %u, plane %p.\n", iface, Index, pPlane); wined3d_mutex_lock(); - hr = IWineD3DDevice_SetClipPlane(This->WineD3DDevice, Index, pPlane); + hr = wined3d_device_set_clip_plane(This->wined3d_device, Index, pPlane); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_GetClipPlane(LPDIRECT3DDEVICE9EX iface, DWORD Index, float* pPlane) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI IDirect3DDevice9Impl_GetClipPlane(IDirect3DDevice9Ex *iface, DWORD Index, + float *pPlane) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, index %u, plane %p.\n", iface, Index, pPlane); wined3d_mutex_lock(); - hr = IWineD3DDevice_GetClipPlane(This->WineD3DDevice, Index, pPlane); + hr = wined3d_device_get_clip_plane(This->wined3d_device, Index, pPlane); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_SetRenderState(LPDIRECT3DDEVICE9EX iface, D3DRENDERSTATETYPE State, DWORD Value) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_SetRenderState(IDirect3DDevice9Ex *iface, + D3DRENDERSTATETYPE State, DWORD Value) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, state %#x, value %#x.\n", iface, State, Value); wined3d_mutex_lock(); - hr = IWineD3DDevice_SetRenderState(This->WineD3DDevice, State, Value); + hr = wined3d_device_set_render_state(This->wined3d_device, State, Value); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_GetRenderState(LPDIRECT3DDEVICE9EX iface, D3DRENDERSTATETYPE State, DWORD* pValue) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI IDirect3DDevice9Impl_GetRenderState(IDirect3DDevice9Ex *iface, + D3DRENDERSTATETYPE State, DWORD *pValue) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, state %#x, value %p.\n", iface, State, pValue); wined3d_mutex_lock(); - hr = IWineD3DDevice_GetRenderState(This->WineD3DDevice, State, pValue); + hr = wined3d_device_get_render_state(This->wined3d_device, State, pValue); wined3d_mutex_unlock(); return hr; @@ -1482,7 +1534,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetRenderState(LPDIRECT3DDEVICE9EX static HRESULT WINAPI IDirect3DDevice9Impl_CreateStateBlock(IDirect3DDevice9Ex *iface, D3DSTATEBLOCKTYPE type, IDirect3DStateBlock9 **stateblock) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); IDirect3DStateBlock9Impl *object; HRESULT hr; @@ -1510,36 +1562,37 @@ static HRESULT WINAPI IDirect3DDevice9Impl_CreateStateBlock(IDirect3DDevice9Ex * } TRACE("Created stateblock %p.\n", object); - *stateblock = (IDirect3DStateBlock9 *)object; + *stateblock = &object->IDirect3DStateBlock9_iface; return D3D_OK; } static HRESULT WINAPI IDirect3DDevice9Impl_BeginStateBlock(IDirect3DDevice9Ex *iface) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - hr = IWineD3DDevice_BeginStateBlock(This->WineD3DDevice); + hr = wined3d_device_begin_stateblock(This->wined3d_device); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_EndStateBlock(IDirect3DDevice9Ex *iface, IDirect3DStateBlock9 **stateblock) +static HRESULT WINAPI IDirect3DDevice9Impl_EndStateBlock(IDirect3DDevice9Ex *iface, + IDirect3DStateBlock9 **stateblock) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; - IWineD3DStateBlock *wined3d_stateblock; + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); + struct wined3d_stateblock *wined3d_stateblock; IDirect3DStateBlock9Impl *object; HRESULT hr; TRACE("iface %p, stateblock %p.\n", iface, stateblock); wined3d_mutex_lock(); - hr = IWineD3DDevice_EndStateBlock(This->WineD3DDevice, &wined3d_stateblock); + hr = wined3d_device_end_stateblock(This->wined3d_device, &wined3d_stateblock); wined3d_mutex_unlock(); if (FAILED(hr)) { @@ -1551,7 +1604,9 @@ static HRESULT WINAPI IDirect3DDevice9Impl_EndStateBlock(IDirect3DDevice9Ex *ifa if (!object) { ERR("Failed to allocate stateblock memory.\n"); - IWineD3DStateBlock_Release(wined3d_stateblock); + wined3d_mutex_lock(); + wined3d_stateblock_decref(wined3d_stateblock); + wined3d_mutex_unlock(); return E_OUTOFMEMORY; } @@ -1559,48 +1614,54 @@ static HRESULT WINAPI IDirect3DDevice9Impl_EndStateBlock(IDirect3DDevice9Ex *ifa if (FAILED(hr)) { WARN("Failed to initialize stateblock, hr %#x.\n", hr); - IWineD3DStateBlock_Release(wined3d_stateblock); + wined3d_mutex_lock(); + wined3d_stateblock_decref(wined3d_stateblock); + wined3d_mutex_unlock(); HeapFree(GetProcessHeap(), 0, object); return hr; } TRACE("Created stateblock %p.\n", object); - *stateblock = (IDirect3DStateBlock9 *)object; + *stateblock = &object->IDirect3DStateBlock9_iface; return D3D_OK; } -static HRESULT WINAPI IDirect3DDevice9Impl_SetClipStatus(LPDIRECT3DDEVICE9EX iface, CONST D3DCLIPSTATUS9* pClipStatus) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; - HRESULT hr; - - TRACE("iface %p, clip_status %p.\n", iface, pClipStatus); - - wined3d_mutex_lock(); - hr = IWineD3DDevice_SetClipStatus(This->WineD3DDevice, (const WINED3DCLIPSTATUS *)pClipStatus); - wined3d_mutex_unlock(); - - return hr; -} - -static HRESULT WINAPI IDirect3DDevice9Impl_GetClipStatus(LPDIRECT3DDEVICE9EX iface, D3DCLIPSTATUS9* pClipStatus) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; - HRESULT hr; - - TRACE("iface %p, clip_status %p.\n", iface, pClipStatus); - - wined3d_mutex_lock(); - hr = IWineD3DDevice_GetClipStatus(This->WineD3DDevice, (WINED3DCLIPSTATUS *)pClipStatus); - wined3d_mutex_unlock(); - - return hr; -} - -static HRESULT WINAPI IDirect3DDevice9Impl_GetTexture(IDirect3DDevice9Ex *iface, - DWORD Stage, IDirect3DBaseTexture9 **ppTexture) +static HRESULT WINAPI IDirect3DDevice9Impl_SetClipStatus(IDirect3DDevice9Ex *iface, + const D3DCLIPSTATUS9 *pClipStatus) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; - IWineD3DBaseTexture *retTexture = NULL; + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); + HRESULT hr; + + TRACE("iface %p, clip_status %p.\n", iface, pClipStatus); + + wined3d_mutex_lock(); + hr = wined3d_device_set_clip_status(This->wined3d_device, (const WINED3DCLIPSTATUS *)pClipStatus); + wined3d_mutex_unlock(); + + return hr; +} + +static HRESULT WINAPI IDirect3DDevice9Impl_GetClipStatus(IDirect3DDevice9Ex *iface, + D3DCLIPSTATUS9 *pClipStatus) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); + HRESULT hr; + + TRACE("iface %p, clip_status %p.\n", iface, pClipStatus); + + wined3d_mutex_lock(); + hr = wined3d_device_get_clip_status(This->wined3d_device, (WINED3DCLIPSTATUS *)pClipStatus); + wined3d_mutex_unlock(); + + return hr; +} + +static HRESULT WINAPI IDirect3DDevice9Impl_GetTexture(IDirect3DDevice9Ex *iface, DWORD Stage, + IDirect3DBaseTexture9 **ppTexture) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); + struct wined3d_texture *wined3d_texture = NULL; HRESULT hr; TRACE("iface %p, stage %u, texture %p.\n", iface, Stage, ppTexture); @@ -1610,18 +1671,18 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetTexture(IDirect3DDevice9Ex *iface, } wined3d_mutex_lock(); - hr = IWineD3DDevice_GetTexture(This->WineD3DDevice, Stage, &retTexture); - if (SUCCEEDED(hr) && retTexture) + hr = wined3d_device_get_texture(This->wined3d_device, Stage, &wined3d_texture); + if (SUCCEEDED(hr) && wined3d_texture) { - *ppTexture = IWineD3DBaseTexture_GetParent(retTexture); - IWineD3DBaseTexture_AddRef(*ppTexture); - IWineD3DBaseTexture_Release(retTexture); + *ppTexture = wined3d_texture_get_parent(wined3d_texture); + IDirect3DBaseTexture9_AddRef(*ppTexture); + wined3d_texture_decref(wined3d_texture); } else { if (FAILED(hr)) { - WARN("Call to get texture (%d) failed (%p)\n", Stage, retTexture); + WARN("Call to get texture (%u) failed (%p).\n", Stage, wined3d_texture); } *ppTexture = NULL; } @@ -1630,15 +1691,17 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetTexture(IDirect3DDevice9Ex *iface, return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_SetTexture(LPDIRECT3DDEVICE9EX iface, DWORD Stage, IDirect3DBaseTexture9* pTexture) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI IDirect3DDevice9Impl_SetTexture(IDirect3DDevice9Ex *iface, DWORD stage, + IDirect3DBaseTexture9 *texture) +{ + IDirect3DDevice9Impl *device = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; - TRACE("iface %p, stage %u, texture %p.\n", iface, Stage, pTexture); + TRACE("iface %p, stage %u, texture %p.\n", iface, stage, texture); wined3d_mutex_lock(); - hr = IWineD3DDevice_SetTexture(This->WineD3DDevice, Stage, - pTexture==NULL ? NULL:((IDirect3DBaseTexture9Impl *)pTexture)->wineD3DBaseTexture); + hr = wined3d_device_set_texture(device->wined3d_device, stage, + texture ? ((IDirect3DBaseTexture9Impl *)texture)->wined3d_texture : NULL); wined3d_mutex_unlock(); return hr; @@ -1681,9 +1744,10 @@ static const WINED3DTEXTURESTAGESTATETYPE tss_lookup[] = WINED3DTSS_CONSTANT, /* 32, D3DTSS_CONSTANT */ }; -static HRESULT WINAPI IDirect3DDevice9Impl_GetTextureStageState(LPDIRECT3DDEVICE9EX iface, DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD *pValue) +static HRESULT WINAPI IDirect3DDevice9Impl_GetTextureStageState(IDirect3DDevice9Ex *iface, + DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD *pValue) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, stage %u, state %#x, value %p.\n", iface, Stage, Type, pValue); @@ -1695,15 +1759,16 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetTextureStageState(LPDIRECT3DDEVI } wined3d_mutex_lock(); - hr = IWineD3DDevice_GetTextureStageState(This->WineD3DDevice, Stage, tss_lookup[Type], pValue); + hr = wined3d_device_get_texture_stage_state(This->wined3d_device, Stage, tss_lookup[Type], pValue); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_SetTextureStageState(LPDIRECT3DDEVICE9EX iface, DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD Value) +static HRESULT WINAPI IDirect3DDevice9Impl_SetTextureStageState(IDirect3DDevice9Ex *iface, + DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD Value) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, stage %u, state %#x, value %#x.\n", iface, Stage, Type, Value); @@ -1715,7 +1780,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetTextureStageState(LPDIRECT3DDEVI } wined3d_mutex_lock(); - hr = IWineD3DDevice_SetTextureStageState(This->WineD3DDevice, Stage, tss_lookup[Type], Value); + hr = wined3d_device_set_texture_stage_state(This->wined3d_device, Stage, tss_lookup[Type], Value); wined3d_mutex_unlock(); return hr; @@ -1724,197 +1789,217 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetTextureStageState(LPDIRECT3DDEVI static HRESULT WINAPI IDirect3DDevice9Impl_GetSamplerState(IDirect3DDevice9Ex *iface, DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD *pValue) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, sampler %u, state %#x, value %p.\n", iface, Sampler, Type, pValue); wined3d_mutex_lock(); - hr = IWineD3DDevice_GetSamplerState(This->WineD3DDevice, Sampler, Type, pValue); + hr = wined3d_device_get_sampler_state(This->wined3d_device, Sampler, Type, pValue); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_SetSamplerState(LPDIRECT3DDEVICE9EX iface, DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD Value) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDevice9Impl_SetSamplerState(IDirect3DDevice9Ex *iface, + DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD Value) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, sampler %u, state %#x, value %#x.\n", iface, Sampler, Type, Value); wined3d_mutex_lock(); - hr = IWineD3DDevice_SetSamplerState(This->WineD3DDevice, Sampler, Type, Value); + hr = wined3d_device_set_sampler_state(This->wined3d_device, Sampler, Type, Value); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_ValidateDevice(LPDIRECT3DDEVICE9EX iface, DWORD* pNumPasses) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI IDirect3DDevice9Impl_ValidateDevice(IDirect3DDevice9Ex *iface, + DWORD *pNumPasses) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, pass_count %p.\n", iface, pNumPasses); wined3d_mutex_lock(); - hr = IWineD3DDevice_ValidateDevice(This->WineD3DDevice, pNumPasses); + hr = wined3d_device_validate_device(This->wined3d_device, pNumPasses); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_SetPaletteEntries(IDirect3DDevice9Ex *iface, UINT PaletteNumber, - const PALETTEENTRY *pEntries) +static HRESULT WINAPI IDirect3DDevice9Impl_SetPaletteEntries(IDirect3DDevice9Ex *iface, + UINT PaletteNumber, const PALETTEENTRY *pEntries) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, palette_idx %u, entries %p.\n", iface, PaletteNumber, pEntries); wined3d_mutex_lock(); - hr = IWineD3DDevice_SetPaletteEntries(This->WineD3DDevice, PaletteNumber, pEntries); + hr = wined3d_device_set_palette_entries(This->wined3d_device, PaletteNumber, pEntries); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_GetPaletteEntries(LPDIRECT3DDEVICE9EX iface, UINT PaletteNumber, PALETTEENTRY* pEntries) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI IDirect3DDevice9Impl_GetPaletteEntries(IDirect3DDevice9Ex *iface, + UINT PaletteNumber, PALETTEENTRY *pEntries) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, palette_idx %u, entries %p.\n", iface, PaletteNumber, pEntries); wined3d_mutex_lock(); - hr = IWineD3DDevice_GetPaletteEntries(This->WineD3DDevice, PaletteNumber, pEntries); + hr = wined3d_device_get_palette_entries(This->wined3d_device, PaletteNumber, pEntries); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_SetCurrentTexturePalette(LPDIRECT3DDEVICE9EX iface, UINT PaletteNumber) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI IDirect3DDevice9Impl_SetCurrentTexturePalette(IDirect3DDevice9Ex *iface, + UINT PaletteNumber) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, palette_idx %u.\n", iface, PaletteNumber); wined3d_mutex_lock(); - hr = IWineD3DDevice_SetCurrentTexturePalette(This->WineD3DDevice, PaletteNumber); + hr = wined3d_device_set_current_texture_palette(This->wined3d_device, PaletteNumber); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_GetCurrentTexturePalette(LPDIRECT3DDEVICE9EX iface, UINT* PaletteNumber) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI IDirect3DDevice9Impl_GetCurrentTexturePalette(IDirect3DDevice9Ex *iface, + UINT *PaletteNumber) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, palette_idx %p.\n", iface, PaletteNumber); wined3d_mutex_lock(); - hr = IWineD3DDevice_GetCurrentTexturePalette(This->WineD3DDevice, PaletteNumber); + hr = wined3d_device_get_current_texture_palette(This->wined3d_device, PaletteNumber); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_SetScissorRect(LPDIRECT3DDEVICE9EX iface, CONST RECT* pRect) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI IDirect3DDevice9Impl_SetScissorRect(IDirect3DDevice9Ex *iface, + const RECT *pRect) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, rect %p.\n", iface, pRect); wined3d_mutex_lock(); - hr = IWineD3DDevice_SetScissorRect(This->WineD3DDevice, pRect); + hr = wined3d_device_set_scissor_rect(This->wined3d_device, pRect); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_GetScissorRect(LPDIRECT3DDEVICE9EX iface, RECT* pRect) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI IDirect3DDevice9Impl_GetScissorRect(IDirect3DDevice9Ex *iface, RECT *pRect) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, rect %p.\n", iface, pRect); wined3d_mutex_lock(); - hr = IWineD3DDevice_GetScissorRect(This->WineD3DDevice, pRect); + hr = wined3d_device_get_scissor_rect(This->wined3d_device, pRect); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_SetSoftwareVertexProcessing(LPDIRECT3DDEVICE9EX iface, BOOL bSoftware) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI IDirect3DDevice9Impl_SetSoftwareVertexProcessing(IDirect3DDevice9Ex *iface, + BOOL bSoftware) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, software %#x.\n", iface, bSoftware); wined3d_mutex_lock(); - hr = IWineD3DDevice_SetSoftwareVertexProcessing(This->WineD3DDevice, bSoftware); + hr = wined3d_device_set_software_vertex_processing(This->wined3d_device, bSoftware); wined3d_mutex_unlock(); return hr; } -static BOOL WINAPI IDirect3DDevice9Impl_GetSoftwareVertexProcessing(LPDIRECT3DDEVICE9EX iface) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static BOOL WINAPI IDirect3DDevice9Impl_GetSoftwareVertexProcessing(IDirect3DDevice9Ex *iface) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); BOOL ret; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - ret = IWineD3DDevice_GetSoftwareVertexProcessing(This->WineD3DDevice); + ret = wined3d_device_get_software_vertex_processing(This->wined3d_device); wined3d_mutex_unlock(); return ret; } -static HRESULT WINAPI IDirect3DDevice9Impl_SetNPatchMode(LPDIRECT3DDEVICE9EX iface, float nSegments) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI IDirect3DDevice9Impl_SetNPatchMode(IDirect3DDevice9Ex *iface, float nSegments) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, segment_count %.8e.\n", iface, nSegments); wined3d_mutex_lock(); - hr = IWineD3DDevice_SetNPatchMode(This->WineD3DDevice, nSegments); + hr = wined3d_device_set_npatch_mode(This->wined3d_device, nSegments); wined3d_mutex_unlock(); return hr; } -static float WINAPI IDirect3DDevice9Impl_GetNPatchMode(LPDIRECT3DDEVICE9EX iface) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static float WINAPI IDirect3DDevice9Impl_GetNPatchMode(IDirect3DDevice9Ex *iface) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); float ret; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - ret = IWineD3DDevice_GetNPatchMode(This->WineD3DDevice); + ret = wined3d_device_get_npatch_mode(This->wined3d_device); wined3d_mutex_unlock(); return ret; } -static HRESULT WINAPI IDirect3DDevice9Impl_DrawPrimitive(IDirect3DDevice9Ex *iface, D3DPRIMITIVETYPE PrimitiveType, - UINT StartVertex, UINT PrimitiveCount) +static HRESULT WINAPI IDirect3DDevice9Impl_DrawPrimitive(IDirect3DDevice9Ex *iface, + D3DPRIMITIVETYPE PrimitiveType, UINT StartVertex, UINT PrimitiveCount) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, primitive_type %#x, start_vertex %u, primitive_count %u.\n", iface, PrimitiveType, StartVertex, PrimitiveCount); wined3d_mutex_lock(); - IWineD3DDevice_SetPrimitiveType(This->WineD3DDevice, PrimitiveType); - hr = IWineD3DDevice_DrawPrimitive(This->WineD3DDevice, StartVertex, + wined3d_device_set_primitive_type(This->wined3d_device, PrimitiveType); + hr = wined3d_device_draw_primitive(This->wined3d_device, StartVertex, vertex_count_from_primitive_count(PrimitiveType, PrimitiveCount)); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_DrawIndexedPrimitive(LPDIRECT3DDEVICE9EX iface, D3DPRIMITIVETYPE PrimitiveType, - INT BaseVertexIndex, UINT MinVertexIndex, UINT NumVertices, UINT startIndex, UINT primCount) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI IDirect3DDevice9Impl_DrawIndexedPrimitive(IDirect3DDevice9Ex *iface, + D3DPRIMITIVETYPE PrimitiveType, INT BaseVertexIndex, UINT MinVertexIndex, UINT NumVertices, + UINT startIndex, UINT primCount) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, primitive_type %#x, base_vertex_idx %u, min_vertex_idx %u,\n" @@ -1923,27 +2008,28 @@ static HRESULT WINAPI IDirect3DDevice9Impl_DrawIndexedPrimitive(LPDIRECT3DDEVI NumVertices, startIndex, primCount); wined3d_mutex_lock(); - IWineD3DDevice_SetBaseVertexIndex(This->WineD3DDevice, BaseVertexIndex); - IWineD3DDevice_SetPrimitiveType(This->WineD3DDevice, PrimitiveType); - hr = IWineD3DDevice_DrawIndexedPrimitive(This->WineD3DDevice, startIndex, + wined3d_device_set_base_vertex_index(This->wined3d_device, BaseVertexIndex); + wined3d_device_set_primitive_type(This->wined3d_device, PrimitiveType); + hr = wined3d_device_draw_indexed_primitive(This->wined3d_device, startIndex, vertex_count_from_primitive_count(PrimitiveType, primCount)); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_DrawPrimitiveUP(IDirect3DDevice9Ex *iface, D3DPRIMITIVETYPE PrimitiveType, - UINT PrimitiveCount, const void *pVertexStreamZeroData, UINT VertexStreamZeroStride) +static HRESULT WINAPI IDirect3DDevice9Impl_DrawPrimitiveUP(IDirect3DDevice9Ex *iface, + D3DPRIMITIVETYPE PrimitiveType, UINT PrimitiveCount, const void *pVertexStreamZeroData, + UINT VertexStreamZeroStride) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, primitive_type %#x, primitive_count %u, data %p, stride %u.\n", iface, PrimitiveType, PrimitiveCount, pVertexStreamZeroData, VertexStreamZeroStride); wined3d_mutex_lock(); - IWineD3DDevice_SetPrimitiveType(This->WineD3DDevice, PrimitiveType); - hr = IWineD3DDevice_DrawPrimitiveUP(This->WineD3DDevice, + wined3d_device_set_primitive_type(This->wined3d_device, PrimitiveType); + hr = wined3d_device_draw_primitive_up(This->wined3d_device, vertex_count_from_primitive_count(PrimitiveType, PrimitiveCount), pVertexStreamZeroData, VertexStreamZeroStride); wined3d_mutex_unlock(); @@ -1951,10 +2037,12 @@ static HRESULT WINAPI IDirect3DDevice9Impl_DrawPrimitiveUP(IDirect3DDevice9Ex *i return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_DrawIndexedPrimitiveUP(LPDIRECT3DDEVICE9EX iface, D3DPRIMITIVETYPE PrimitiveType, UINT MinVertexIndex, - UINT NumVertexIndices, UINT PrimitiveCount, CONST void* pIndexData, - D3DFORMAT IndexDataFormat, CONST void* pVertexStreamZeroData, UINT VertexStreamZeroStride) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI IDirect3DDevice9Impl_DrawIndexedPrimitiveUP(IDirect3DDevice9Ex *iface, + D3DPRIMITIVETYPE PrimitiveType, UINT MinVertexIndex, UINT NumVertexIndices, + UINT PrimitiveCount, const void *pIndexData, D3DFORMAT IndexDataFormat, + const void *pVertexStreamZeroData, UINT VertexStreamZeroStride) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, primitive_type %#x, min_vertex_idx %u, index_count %u, primitive_count %u,\n" @@ -1963,8 +2051,8 @@ static HRESULT WINAPI IDirect3DDevice9Impl_DrawIndexedPrimitiveUP(LPDIRECT3DDE pIndexData, IndexDataFormat, pVertexStreamZeroData, VertexStreamZeroStride); wined3d_mutex_lock(); - IWineD3DDevice_SetPrimitiveType(This->WineD3DDevice, PrimitiveType); - hr = IWineD3DDevice_DrawIndexedPrimitiveUP(This->WineD3DDevice, + wined3d_device_set_primitive_type(This->wined3d_device, PrimitiveType); + hr = wined3d_device_draw_indexed_primitive_up(This->wined3d_device, vertex_count_from_primitive_count(PrimitiveType, PrimitiveCount), pIndexData, wined3dformat_from_d3dformat(IndexDataFormat), pVertexStreamZeroData, VertexStreamZeroStride); wined3d_mutex_unlock(); @@ -1972,8 +2060,11 @@ static HRESULT WINAPI IDirect3DDevice9Impl_DrawIndexedPrimitiveUP(LPDIRECT3DDE return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_ProcessVertices(LPDIRECT3DDEVICE9EX iface, UINT SrcStartIndex, UINT DestIndex, UINT VertexCount, IDirect3DVertexBuffer9* pDestBuffer, IDirect3DVertexDeclaration9* pVertexDecl, DWORD Flags) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI IDirect3DDevice9Impl_ProcessVertices(IDirect3DDevice9Ex *iface, + UINT SrcStartIndex, UINT DestIndex, UINT VertexCount, IDirect3DVertexBuffer9 *pDestBuffer, + IDirect3DVertexDeclaration9 *pVertexDecl, DWORD Flags) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); IDirect3DVertexDeclaration9Impl *Decl = (IDirect3DVertexDeclaration9Impl *) pVertexDecl; HRESULT hr; IDirect3DVertexBuffer9Impl *dest = (IDirect3DVertexBuffer9Impl *) pDestBuffer; @@ -1982,7 +2073,8 @@ static HRESULT WINAPI IDirect3DDevice9Impl_ProcessVertices(LPDIRECT3DDEVICE9EX iface, SrcStartIndex, DestIndex, VertexCount, pDestBuffer, pVertexDecl, Flags); wined3d_mutex_lock(); - hr = IWineD3DDevice_ProcessVertices(This->WineD3DDevice,SrcStartIndex, DestIndex, VertexCount, dest->wineD3DVertexBuffer, Decl ? Decl->wineD3DVertexDeclaration : NULL, Flags, dest->fvf); + hr = wined3d_device_process_vertices(This->wined3d_device, SrcStartIndex, DestIndex, VertexCount, + dest->wineD3DVertexBuffer, Decl ? Decl->wineD3DVertexDeclaration : NULL, Flags, dest->fvf); wined3d_mutex_unlock(); return hr; @@ -1991,7 +2083,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_ProcessVertices(LPDIRECT3DDEVICE9EX static HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexDeclaration(IDirect3DDevice9Ex *iface, const D3DVERTEXELEMENT9 *elements, IDirect3DVertexDeclaration9 **declaration) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); IDirect3DVertexDeclaration9Impl *object; HRESULT hr; @@ -2027,12 +2119,13 @@ static HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexDeclaration(IDirect3DDevi static HRESULT WINAPI IDirect3DDevice9Impl_SetVertexDeclaration(IDirect3DDevice9Ex *iface, IDirect3DVertexDeclaration9 *declaration) { + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, declaration %p.\n", iface, declaration); wined3d_mutex_lock(); - hr = IWineD3DDevice_SetVertexDeclaration(((IDirect3DDevice9Impl *)iface)->WineD3DDevice, + hr = wined3d_device_set_vertex_declaration(This->wined3d_device, declaration ? ((IDirect3DVertexDeclaration9Impl *)declaration)->wineD3DVertexDeclaration : NULL); wined3d_mutex_unlock(); @@ -2042,7 +2135,8 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetVertexDeclaration(IDirect3DDevice9 static HRESULT WINAPI IDirect3DDevice9Impl_GetVertexDeclaration(IDirect3DDevice9Ex *iface, IDirect3DVertexDeclaration9 **declaration) { - IWineD3DVertexDeclaration *wined3d_declaration = NULL; + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); + struct wined3d_vertex_declaration *wined3d_declaration = NULL; HRESULT hr; TRACE("iface %p, declaration %p.\n", iface, declaration); @@ -2050,12 +2144,12 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetVertexDeclaration(IDirect3DDevice9 if (!declaration) return D3DERR_INVALIDCALL; wined3d_mutex_lock(); - hr = IWineD3DDevice_GetVertexDeclaration(((IDirect3DDevice9Impl *)iface)->WineD3DDevice, &wined3d_declaration); + hr = wined3d_device_get_vertex_declaration(This->wined3d_device, &wined3d_declaration); if (SUCCEEDED(hr) && wined3d_declaration) { - *declaration = IWineD3DVertexDeclaration_GetParent(wined3d_declaration); + *declaration = wined3d_vertex_declaration_get_parent(wined3d_declaration); IDirect3DVertexDeclaration9_AddRef(*declaration); - IWineD3DVertexDeclaration_Release(wined3d_declaration); + wined3d_vertex_declaration_decref(wined3d_declaration); } else { @@ -2095,7 +2189,8 @@ static IDirect3DVertexDeclaration9 *getConvertedDecl(IDirect3DDevice9Impl *This, hr = vdecl_convert_fvf(fvf, &elements); if (hr != S_OK) return NULL; - hr = IDirect3DDevice9Impl_CreateVertexDeclaration((IDirect3DDevice9Ex *) This, elements, &pDecl); + hr = IDirect3DDevice9Impl_CreateVertexDeclaration(&This->IDirect3DDevice9Ex_iface, elements, + &pDecl); HeapFree(GetProcessHeap(), 0, elements); /* CreateVertexDeclaration makes a copy */ if (hr != S_OK) return NULL; @@ -2124,8 +2219,9 @@ static IDirect3DVertexDeclaration9 *getConvertedDecl(IDirect3DDevice9Impl *This, return pDecl; } -static HRESULT WINAPI IDirect3DDevice9Impl_SetFVF(LPDIRECT3DDEVICE9EX iface, DWORD FVF) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI IDirect3DDevice9Impl_SetFVF(IDirect3DDevice9Ex *iface, DWORD FVF) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); IDirect3DVertexDeclaration9 *decl; HRESULT hr; @@ -2187,7 +2283,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetFVF(IDirect3DDevice9Ex *iface, DWO static HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexShader(IDirect3DDevice9Ex *iface, const DWORD *byte_code, IDirect3DVertexShader9 **shader) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); IDirect3DVertexShader9Impl *object; HRESULT hr; @@ -2217,13 +2313,14 @@ static HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexShader(IDirect3DDevice9Ex static HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShader(IDirect3DDevice9Ex *iface, IDirect3DVertexShader9 *shader) { + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, shader %p.\n", iface, shader); wined3d_mutex_lock(); - hr = IWineD3DDevice_SetVertexShader(((IDirect3DDevice9Impl *)iface)->WineD3DDevice, - shader ? ((IDirect3DVertexShader9Impl *)shader)->wineD3DVertexShader : NULL); + hr = wined3d_device_set_vertex_shader(This->wined3d_device, + shader ? ((IDirect3DVertexShader9Impl *)shader)->wined3d_shader : NULL); wined3d_mutex_unlock(); return hr; @@ -2232,17 +2329,18 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShader(IDirect3DDevice9Ex *i static HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShader(IDirect3DDevice9Ex *iface, IDirect3DVertexShader9 **shader) { - IWineD3DVertexShader *wined3d_shader; + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); + struct wined3d_shader *wined3d_shader; TRACE("iface %p, shader %p.\n", iface, shader); wined3d_mutex_lock(); - wined3d_shader = IWineD3DDevice_GetVertexShader(((IDirect3DDevice9Impl *)iface)->WineD3DDevice); + wined3d_shader = wined3d_device_get_vertex_shader(This->wined3d_device); if (wined3d_shader) { - *shader = IWineD3DVertexShader_GetParent(wined3d_shader); + *shader = wined3d_shader_get_parent(wined3d_shader); IDirect3DVertexShader9_AddRef(*shader); - IWineD3DVertexShader_Release(wined3d_shader); + wined3d_shader_decref(wined3d_shader); } else { @@ -2258,6 +2356,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShader(IDirect3DDevice9Ex *i static HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantF(IDirect3DDevice9Ex *iface, UINT reg_idx, const float *data, UINT count) { + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, reg_idx %u, data %p, count %u.\n", iface, reg_idx, data, count); @@ -2270,7 +2369,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantF(IDirect3DDev } wined3d_mutex_lock(); - hr = IWineD3DDevice_SetVertexShaderConstantF(((IDirect3DDevice9Impl *)iface)->WineD3DDevice, reg_idx, data, count); + hr = wined3d_device_set_vs_consts_f(This->wined3d_device, reg_idx, data, count); wined3d_mutex_unlock(); return hr; @@ -2279,6 +2378,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantF(IDirect3DDev static HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShaderConstantF(IDirect3DDevice9Ex *iface, UINT reg_idx, float *data, UINT count) { + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, reg_idx %u, data %p, count %u.\n", iface, reg_idx, data, count); @@ -2291,7 +2391,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShaderConstantF(IDirect3DDev } wined3d_mutex_lock(); - hr = IWineD3DDevice_GetVertexShaderConstantF(((IDirect3DDevice9Impl *)iface)->WineD3DDevice, reg_idx, data, count); + hr = wined3d_device_get_vs_consts_f(This->wined3d_device, reg_idx, data, count); wined3d_mutex_unlock(); return hr; @@ -2300,12 +2400,13 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShaderConstantF(IDirect3DDev static HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantI(IDirect3DDevice9Ex *iface, UINT reg_idx, const int *data, UINT count) { + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, reg_idx %u, data %p, count %u.\n", iface, reg_idx, data, count); wined3d_mutex_lock(); - hr = IWineD3DDevice_SetVertexShaderConstantI(((IDirect3DDevice9Impl *)iface)->WineD3DDevice, reg_idx, data, count); + hr = wined3d_device_set_vs_consts_i(This->wined3d_device, reg_idx, data, count); wined3d_mutex_unlock(); return hr; @@ -2314,12 +2415,13 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantI(IDirect3DDev static HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShaderConstantI(IDirect3DDevice9Ex *iface, UINT reg_idx, int *data, UINT count) { + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, reg_idx %u, data %p, count %u.\n", iface, reg_idx, data, count); wined3d_mutex_lock(); - hr = IWineD3DDevice_GetVertexShaderConstantI(((IDirect3DDevice9Impl *)iface)->WineD3DDevice, reg_idx, data, count); + hr = wined3d_device_get_vs_consts_i(This->wined3d_device, reg_idx, data, count); wined3d_mutex_unlock(); return hr; @@ -2328,12 +2430,13 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShaderConstantI(IDirect3DDev static HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantB(IDirect3DDevice9Ex *iface, UINT reg_idx, const BOOL *data, UINT count) { + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, reg_idx %u, data %p, count %u.\n", iface, reg_idx, data, count); wined3d_mutex_lock(); - hr = IWineD3DDevice_SetVertexShaderConstantB(((IDirect3DDevice9Impl *)iface)->WineD3DDevice, reg_idx, data, count); + hr = wined3d_device_set_vs_consts_b(This->wined3d_device, reg_idx, data, count); wined3d_mutex_unlock(); return hr; @@ -2342,26 +2445,29 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantB(IDirect3DDev static HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShaderConstantB(IDirect3DDevice9Ex *iface, UINT reg_idx, BOOL *data, UINT count) { + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, reg_idx %u, data %p, count %u.\n", iface, reg_idx, data, count); wined3d_mutex_lock(); - hr = IWineD3DDevice_GetVertexShaderConstantB(((IDirect3DDevice9Impl *)iface)->WineD3DDevice, reg_idx, data, count); + hr = wined3d_device_get_vs_consts_b(This->wined3d_device, reg_idx, data, count); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_SetStreamSource(LPDIRECT3DDEVICE9EX iface, UINT StreamNumber, IDirect3DVertexBuffer9* pStreamData, UINT OffsetInBytes, UINT Stride) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI IDirect3DDevice9Impl_SetStreamSource(IDirect3DDevice9Ex *iface, + UINT StreamNumber, IDirect3DVertexBuffer9 *pStreamData, UINT OffsetInBytes, UINT Stride) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, stream_idx %u, buffer %p, offset %u, stride %u.\n", iface, StreamNumber, pStreamData, OffsetInBytes, Stride); wined3d_mutex_lock(); - hr = IWineD3DDevice_SetStreamSource(This->WineD3DDevice, StreamNumber, + hr = wined3d_device_set_stream_source(This->wined3d_device, StreamNumber, pStreamData ? ((IDirect3DVertexBuffer9Impl *)pStreamData)->wineD3DVertexBuffer : NULL, OffsetInBytes, Stride); wined3d_mutex_unlock(); @@ -2370,10 +2476,10 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetStreamSource(LPDIRECT3DDEVICE9EX i } static HRESULT WINAPI IDirect3DDevice9Impl_GetStreamSource(IDirect3DDevice9Ex *iface, - UINT StreamNumber, IDirect3DVertexBuffer9 **pStream, UINT* OffsetInBytes, UINT* pStride) + UINT StreamNumber, IDirect3DVertexBuffer9 **pStream, UINT *OffsetInBytes, UINT *pStride) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; - IWineD3DBuffer *retStream = NULL; + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); + struct wined3d_buffer *retStream = NULL; HRESULT hr; TRACE("iface %p, stream_idx %u, buffer %p, offset %p, stride %p.\n", @@ -2384,12 +2490,12 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetStreamSource(IDirect3DDevice9Ex *i } wined3d_mutex_lock(); - hr = IWineD3DDevice_GetStreamSource(This->WineD3DDevice, StreamNumber, &retStream, OffsetInBytes, pStride); + hr = wined3d_device_get_stream_source(This->wined3d_device, StreamNumber, &retStream, OffsetInBytes, pStride); if (SUCCEEDED(hr) && retStream) { - *pStream = IWineD3DBuffer_GetParent(retStream); + *pStream = wined3d_buffer_get_parent(retStream); IDirect3DVertexBuffer9_AddRef(*pStream); - IWineD3DBuffer_Release(retStream); + wined3d_buffer_decref(retStream); } else { @@ -2404,43 +2510,47 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetStreamSource(IDirect3DDevice9Ex *i return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_SetStreamSourceFreq(IDirect3DDevice9Ex *iface, UINT StreamNumber, - UINT Divider) +static HRESULT WINAPI IDirect3DDevice9Impl_SetStreamSourceFreq(IDirect3DDevice9Ex *iface, + UINT StreamNumber, UINT Divider) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, stream_idx %u, freq %u.\n", iface, StreamNumber, Divider); wined3d_mutex_lock(); - hr = IWineD3DDevice_SetStreamSourceFreq(This->WineD3DDevice, StreamNumber, Divider); + hr = wined3d_device_set_stream_source_freq(This->wined3d_device, StreamNumber, Divider); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_GetStreamSourceFreq(LPDIRECT3DDEVICE9EX iface, UINT StreamNumber, UINT* Divider) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI IDirect3DDevice9Impl_GetStreamSourceFreq(IDirect3DDevice9Ex *iface, + UINT StreamNumber, UINT *Divider) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, stream_idx %u, freq %p.\n", iface, StreamNumber, Divider); wined3d_mutex_lock(); - hr = IWineD3DDevice_GetStreamSourceFreq(This->WineD3DDevice, StreamNumber, Divider); + hr = wined3d_device_get_stream_source_freq(This->wined3d_device, StreamNumber, Divider); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_SetIndices(LPDIRECT3DDEVICE9EX iface, IDirect3DIndexBuffer9* pIndexData) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI IDirect3DDevice9Impl_SetIndices(IDirect3DDevice9Ex *iface, + IDirect3DIndexBuffer9 *pIndexData) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; IDirect3DIndexBuffer9Impl *ib = (IDirect3DIndexBuffer9Impl *) pIndexData; TRACE("iface %p, buffer %p.\n", iface, pIndexData); wined3d_mutex_lock(); - hr = IWineD3DDevice_SetIndexBuffer(This->WineD3DDevice, + hr = wined3d_device_set_index_buffer(This->wined3d_device, ib ? ib->wineD3DIndexBuffer : NULL, ib ? ib->format : WINED3DFMT_UNKNOWN); wined3d_mutex_unlock(); @@ -2448,10 +2558,11 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetIndices(LPDIRECT3DDEVICE9EX ifac return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_GetIndices(IDirect3DDevice9Ex *iface, IDirect3DIndexBuffer9 **ppIndexData) +static HRESULT WINAPI IDirect3DDevice9Impl_GetIndices(IDirect3DDevice9Ex *iface, + IDirect3DIndexBuffer9 **ppIndexData) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; - IWineD3DBuffer *retIndexData = NULL; + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); + struct wined3d_buffer *retIndexData = NULL; HRESULT hr; TRACE("iface %p, buffer %p.\n", iface, ppIndexData); @@ -2461,12 +2572,12 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetIndices(IDirect3DDevice9Ex *iface, } wined3d_mutex_lock(); - hr = IWineD3DDevice_GetIndexBuffer(This->WineD3DDevice, &retIndexData); + hr = wined3d_device_get_index_buffer(This->wined3d_device, &retIndexData); if (SUCCEEDED(hr) && retIndexData) { - *ppIndexData = IWineD3DBuffer_GetParent(retIndexData); + *ppIndexData = wined3d_buffer_get_parent(retIndexData); IDirect3DIndexBuffer9_AddRef(*ppIndexData); - IWineD3DBuffer_Release(retIndexData); + wined3d_buffer_decref(retIndexData); } else { @@ -2481,7 +2592,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetIndices(IDirect3DDevice9Ex *iface, static HRESULT WINAPI IDirect3DDevice9Impl_CreatePixelShader(IDirect3DDevice9Ex *iface, const DWORD *byte_code, IDirect3DPixelShader9 **shader) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); IDirect3DPixelShader9Impl *object; HRESULT hr; @@ -2511,13 +2622,14 @@ static HRESULT WINAPI IDirect3DDevice9Impl_CreatePixelShader(IDirect3DDevice9Ex static HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShader(IDirect3DDevice9Ex *iface, IDirect3DPixelShader9 *shader) { + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, shader %p.\n", iface, shader); wined3d_mutex_lock(); - hr = IWineD3DDevice_SetPixelShader(((IDirect3DDevice9Impl *)iface)->WineD3DDevice, - shader ? ((IDirect3DPixelShader9Impl *)shader)->wineD3DPixelShader : NULL); + hr = wined3d_device_set_pixel_shader(This->wined3d_device, + shader ? ((IDirect3DPixelShader9Impl *)shader)->wined3d_shader : NULL); wined3d_mutex_unlock(); return hr; @@ -2526,19 +2638,20 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShader(IDirect3DDevice9Ex *if static HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShader(IDirect3DDevice9Ex *iface, IDirect3DPixelShader9 **shader) { - IWineD3DPixelShader *wined3d_shader; + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); + struct wined3d_shader *wined3d_shader; TRACE("iface %p, shader %p.\n", iface, shader); if (!shader) return D3DERR_INVALIDCALL; wined3d_mutex_lock(); - wined3d_shader = IWineD3DDevice_GetPixelShader(((IDirect3DDevice9Impl *)iface)->WineD3DDevice); + wined3d_shader = wined3d_device_get_pixel_shader(This->wined3d_device); if (wined3d_shader) { - *shader = IWineD3DPixelShader_GetParent(wined3d_shader); + *shader = wined3d_shader_get_parent(wined3d_shader); IDirect3DPixelShader9_AddRef(*shader); - IWineD3DPixelShader_Release(wined3d_shader); + wined3d_shader_decref(wined3d_shader); } else { @@ -2554,12 +2667,13 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShader(IDirect3DDevice9Ex *if static HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShaderConstantF(IDirect3DDevice9Ex *iface, UINT reg_idx, const float *data, UINT count) { + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, reg_idx %u, data %p, count %u.\n", iface, reg_idx, data, count); wined3d_mutex_lock(); - hr = IWineD3DDevice_SetPixelShaderConstantF(((IDirect3DDevice9Impl *)iface)->WineD3DDevice, reg_idx, data, count); + hr = wined3d_device_set_ps_consts_f(This->wined3d_device, reg_idx, data, count); wined3d_mutex_unlock(); return hr; @@ -2568,12 +2682,13 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShaderConstantF(IDirect3DDevi static HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShaderConstantF(IDirect3DDevice9Ex *iface, UINT reg_idx, float *data, UINT count) { + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, reg_idx %u, data %p, count %u.\n", iface, reg_idx, data, count); wined3d_mutex_lock(); - hr = IWineD3DDevice_GetPixelShaderConstantF(((IDirect3DDevice9Impl *)iface)->WineD3DDevice, reg_idx, data, count); + hr = wined3d_device_get_ps_consts_f(This->wined3d_device, reg_idx, data, count); wined3d_mutex_unlock(); return hr; @@ -2582,12 +2697,13 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShaderConstantF(IDirect3DDevi static HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShaderConstantI(IDirect3DDevice9Ex *iface, UINT reg_idx, const int *data, UINT count) { + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, reg_idx %u, data %p, count %u.\n", iface, reg_idx, data, count); wined3d_mutex_lock(); - hr = IWineD3DDevice_SetPixelShaderConstantI(((IDirect3DDevice9Impl *)iface)->WineD3DDevice, reg_idx, data, count); + hr = wined3d_device_set_ps_consts_i(This->wined3d_device, reg_idx, data, count); wined3d_mutex_unlock(); return hr; @@ -2596,12 +2712,13 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShaderConstantI(IDirect3DDevi static HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShaderConstantI(IDirect3DDevice9Ex *iface, UINT reg_idx, int *data, UINT count) { + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, reg_idx %u, data %p, count %u.\n", iface, reg_idx, data, count); wined3d_mutex_lock(); - hr = IWineD3DDevice_GetPixelShaderConstantI(((IDirect3DDevice9Impl *)iface)->WineD3DDevice, reg_idx, data, count); + hr = wined3d_device_get_ps_consts_i(This->wined3d_device, reg_idx, data, count); wined3d_mutex_unlock(); return hr; @@ -2610,12 +2727,13 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShaderConstantI(IDirect3DDevi static HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShaderConstantB(IDirect3DDevice9Ex *iface, UINT reg_idx, const BOOL *data, UINT count) { + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, reg_idx %u, data %p, count %u.\n", iface, reg_idx, data, count); wined3d_mutex_lock(); - hr = IWineD3DDevice_SetPixelShaderConstantB(((IDirect3DDevice9Impl *)iface)->WineD3DDevice, reg_idx, data, count); + hr = wined3d_device_set_ps_consts_b(This->wined3d_device, reg_idx, data, count); wined3d_mutex_unlock(); return hr; @@ -2624,62 +2742,70 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShaderConstantB(IDirect3DDevi static HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShaderConstantB(IDirect3DDevice9Ex *iface, UINT reg_idx, BOOL *data, UINT count) { + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, reg_idx %u, data %p, count %u.\n", iface, reg_idx, data, count); wined3d_mutex_lock(); - hr = IWineD3DDevice_GetPixelShaderConstantB(((IDirect3DDevice9Impl *)iface)->WineD3DDevice, reg_idx, data, count); + hr = wined3d_device_get_ps_consts_b(This->wined3d_device, reg_idx, data, count); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_DrawRectPatch(LPDIRECT3DDEVICE9EX iface, UINT Handle, CONST float* pNumSegs, CONST D3DRECTPATCH_INFO* pRectPatchInfo) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI IDirect3DDevice9Impl_DrawRectPatch(IDirect3DDevice9Ex *iface, UINT Handle, + const float *pNumSegs, const D3DRECTPATCH_INFO *pRectPatchInfo) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, handle %#x, segment_count %p, patch_info %p.\n", iface, Handle, pNumSegs, pRectPatchInfo); wined3d_mutex_lock(); - hr = IWineD3DDevice_DrawRectPatch(This->WineD3DDevice, Handle, pNumSegs, (CONST WINED3DRECTPATCH_INFO *)pRectPatchInfo); + hr = wined3d_device_draw_rect_patch(This->wined3d_device, Handle, + pNumSegs, (const WINED3DRECTPATCH_INFO *)pRectPatchInfo); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_DrawTriPatch(LPDIRECT3DDEVICE9EX iface, UINT Handle, CONST float* pNumSegs, CONST D3DTRIPATCH_INFO* pTriPatchInfo) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI IDirect3DDevice9Impl_DrawTriPatch(IDirect3DDevice9Ex *iface, UINT Handle, + const float *pNumSegs, const D3DTRIPATCH_INFO *pTriPatchInfo) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, handle %#x, segment_count %p, patch_info %p.\n", iface, Handle, pNumSegs, pTriPatchInfo); wined3d_mutex_lock(); - hr = IWineD3DDevice_DrawTriPatch(This->WineD3DDevice, Handle, pNumSegs, (CONST WINED3DTRIPATCH_INFO *)pTriPatchInfo); + hr = wined3d_device_draw_tri_patch(This->wined3d_device, Handle, + pNumSegs, (const WINED3DTRIPATCH_INFO *)pTriPatchInfo); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_DeletePatch(LPDIRECT3DDEVICE9EX iface, UINT Handle) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; +static HRESULT WINAPI IDirect3DDevice9Impl_DeletePatch(IDirect3DDevice9Ex *iface, UINT Handle) +{ + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); HRESULT hr; TRACE("iface %p, handle %#x.\n", iface, Handle); wined3d_mutex_lock(); - hr = IWineD3DDevice_DeletePatch(This->WineD3DDevice, Handle); + hr = wined3d_device_delete_patch(This->wined3d_device, Handle); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DDevice9Impl_CreateQuery(IDirect3DDevice9Ex *iface, - D3DQUERYTYPE type, IDirect3DQuery9 **query) +static HRESULT WINAPI IDirect3DDevice9Impl_CreateQuery(IDirect3DDevice9Ex *iface, D3DQUERYTYPE type, + IDirect3DQuery9 **query) { - IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; + IDirect3DDevice9Impl *This = impl_from_IDirect3DDevice9Ex(iface); IDirect3DQuery9Impl *object; HRESULT hr; @@ -2701,8 +2827,8 @@ static HRESULT WINAPI IDirect3DDevice9Impl_CreateQuery(IDirect3DDevice9Ex *iface } TRACE("Created query %p.\n", object); - if (query) *query = (IDirect3DQuery9 *)object; - else IDirect3DQuery9_Release((IDirect3DQuery9 *)object); + if (query) *query = &object->IDirect3DQuery9_iface; + else IDirect3DQuery9_Release(&object->IDirect3DQuery9_iface); return D3D_OK; } @@ -2713,7 +2839,7 @@ static HRESULT WINAPI IDirect3DDevice9ExImpl_SetConvolutionMonoKernel(IDirect3DD FIXME("iface %p, width %u, height %u, rows %p, columns %p stub!\n", iface, width, height, rows, columns); - return WINED3DERR_INVALIDCALL; + return E_NOTIMPL; } static HRESULT WINAPI IDirect3DDevice9ExImpl_ComposeRects(IDirect3DDevice9Ex *iface, @@ -2725,7 +2851,7 @@ static HRESULT WINAPI IDirect3DDevice9ExImpl_ComposeRects(IDirect3DDevice9Ex *if iface, src_surface, dst_surface, src_descs, rect_count, dst_descs, operation, offset_x, offset_y); - return WINED3DERR_INVALIDCALL; + return E_NOTIMPL; } static HRESULT WINAPI IDirect3DDevice9ExImpl_PresentEx(IDirect3DDevice9Ex *iface, @@ -2735,28 +2861,28 @@ static HRESULT WINAPI IDirect3DDevice9ExImpl_PresentEx(IDirect3DDevice9Ex *iface FIXME("iface %p, src_rect %p, dst_rect %p, dst_window_override %p, dirty_region %p, flags %#x stub!\n", iface, src_rect, dst_rect, dst_window_override, dirty_region, flags); - return WINED3DERR_INVALIDCALL; + return E_NOTIMPL; } static HRESULT WINAPI IDirect3DDevice9ExImpl_GetGPUThreadPriority(IDirect3DDevice9Ex *iface, INT *priority) { FIXME("iface %p, priority %p stub!\n", iface, priority); - return WINED3DERR_INVALIDCALL; + return E_NOTIMPL; } static HRESULT WINAPI IDirect3DDevice9ExImpl_SetGPUThreadPriority(IDirect3DDevice9Ex *iface, INT priority) { FIXME("iface %p, priority %d stub!\n", iface, priority); - return WINED3DERR_INVALIDCALL; + return E_NOTIMPL; } static HRESULT WINAPI IDirect3DDevice9ExImpl_WaitForVBlank(IDirect3DDevice9Ex *iface, UINT swapchain_idx) { FIXME("iface %p, swapchain_idx %u stub!\n", iface, swapchain_idx); - return WINED3DERR_INVALIDCALL; + return E_NOTIMPL; } static HRESULT WINAPI IDirect3DDevice9ExImpl_CheckResourceResidency(IDirect3DDevice9Ex *iface, @@ -2765,14 +2891,14 @@ static HRESULT WINAPI IDirect3DDevice9ExImpl_CheckResourceResidency(IDirect3DDev FIXME("iface %p, resources %p, resource_count %u stub!\n", iface, resources, resource_count); - return WINED3DERR_INVALIDCALL; + return E_NOTIMPL; } static HRESULT WINAPI IDirect3DDevice9ExImpl_SetMaximumFrameLatency(IDirect3DDevice9Ex *iface, UINT max_latency) { FIXME("iface %p, max_latency %u stub!\n", iface, max_latency); - return WINED3DERR_INVALIDCALL; + return E_NOTIMPL; } static HRESULT WINAPI IDirect3DDevice9ExImpl_GetMaximumFrameLatency(IDirect3DDevice9Ex *iface, UINT *max_latency) @@ -2781,14 +2907,19 @@ static HRESULT WINAPI IDirect3DDevice9ExImpl_GetMaximumFrameLatency(IDirect3DDev *max_latency = 2; - return WINED3DERR_INVALIDCALL; + return E_NOTIMPL; } static HRESULT WINAPI IDirect3DDevice9ExImpl_CheckDeviceState(IDirect3DDevice9Ex *iface, HWND dst_window) { - FIXME("iface %p, dst_window %p stub!\n", iface, dst_window); + static int i; - return WINED3DERR_INVALIDCALL; + TRACE("iface %p, dst_window %p stub!\n", iface, dst_window); + + if (!i++) + FIXME("iface %p, dst_window %p stub!\n", iface, dst_window); + + return D3D_OK; } static HRESULT WINAPI IDirect3DDevice9ExImpl_CreateRenderTargetEx(IDirect3DDevice9Ex *iface, @@ -2800,7 +2931,7 @@ static HRESULT WINAPI IDirect3DDevice9ExImpl_CreateRenderTargetEx(IDirect3DDevic iface, width, height, format, multisample_type, multisample_quality, lockable, surface, shared_handle, usage); - return WINED3DERR_INVALIDCALL; + return E_NOTIMPL; } static HRESULT WINAPI IDirect3DDevice9ExImpl_CreateOffscreenPlainSurfaceEx(IDirect3DDevice9Ex *iface, @@ -2810,7 +2941,7 @@ static HRESULT WINAPI IDirect3DDevice9ExImpl_CreateOffscreenPlainSurfaceEx(IDire FIXME("iface %p, width %u, height %u, format %#x, pool %#x, surface %p, shared_handle %p, usage %#x stub!\n", iface, width, height, format, pool, surface, shared_handle, usage); - return WINED3DERR_INVALIDCALL; + return E_NOTIMPL; } static HRESULT WINAPI IDirect3DDevice9ExImpl_CreateDepthStencilSurfaceEx(IDirect3DDevice9Ex *iface, @@ -2822,7 +2953,7 @@ static HRESULT WINAPI IDirect3DDevice9ExImpl_CreateDepthStencilSurfaceEx(IDirect iface, width, height, format, multisample_type, multisample_quality, discard, surface, shared_handle, usage); - return WINED3DERR_INVALIDCALL; + return E_NOTIMPL; } static HRESULT WINAPI IDirect3DDevice9ExImpl_ResetEx(IDirect3DDevice9Ex *iface, @@ -2830,7 +2961,7 @@ static HRESULT WINAPI IDirect3DDevice9ExImpl_ResetEx(IDirect3DDevice9Ex *iface, { FIXME("iface %p, present_parameters %p, mode %p stub!\n", iface, present_parameters, mode); - return WINED3DERR_INVALIDCALL; + return E_NOTIMPL; } static HRESULT WINAPI IDirect3DDevice9ExImpl_GetDisplayModeEx(IDirect3DDevice9Ex *iface, @@ -2838,7 +2969,7 @@ static HRESULT WINAPI IDirect3DDevice9ExImpl_GetDisplayModeEx(IDirect3DDevice9 { FIXME("iface %p, swapchain_idx %u, mode %p, rotation %p stub!\n", iface, swapchain_idx, mode, rotation); - return WINED3DERR_INVALIDCALL; + return E_NOTIMPL; } static const IDirect3DDevice9ExVtbl Direct3DDevice9_Vtbl = @@ -2982,149 +3113,130 @@ static const IDirect3DDevice9ExVtbl Direct3DDevice9_Vtbl = IDirect3DDevice9ExImpl_GetDisplayModeEx }; -/* IWineD3DDeviceParent IUnknown methods */ - -static inline struct IDirect3DDevice9Impl *device_from_device_parent(IWineD3DDeviceParent *iface) +static inline struct IDirect3DDevice9Impl *device_from_device_parent(struct wined3d_device_parent *device_parent) { - return (struct IDirect3DDevice9Impl *)((char*)iface - - FIELD_OFFSET(struct IDirect3DDevice9Impl, device_parent_vtbl)); + return CONTAINING_RECORD(device_parent, struct IDirect3DDevice9Impl, device_parent); } -static HRESULT STDMETHODCALLTYPE device_parent_QueryInterface(IWineD3DDeviceParent *iface, REFIID riid, void **object) +static void CDECL device_parent_wined3d_device_created(struct wined3d_device_parent *device_parent, + struct wined3d_device *device) { - struct IDirect3DDevice9Impl *This = device_from_device_parent(iface); - return IDirect3DDevice9Impl_QueryInterface((IDirect3DDevice9Ex *)This, riid, object); + TRACE("device_parent %p, device %p.\n", device_parent, device); } -static ULONG STDMETHODCALLTYPE device_parent_AddRef(IWineD3DDeviceParent *iface) +static HRESULT CDECL device_parent_create_surface(struct wined3d_device_parent *device_parent, + void *container_parent, UINT width, UINT height, enum wined3d_format_id format, DWORD usage, + WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, struct wined3d_surface **surface) { - struct IDirect3DDevice9Impl *This = device_from_device_parent(iface); - return IDirect3DDevice9Impl_AddRef((IDirect3DDevice9Ex *)This); -} - -static ULONG STDMETHODCALLTYPE device_parent_Release(IWineD3DDeviceParent *iface) -{ - struct IDirect3DDevice9Impl *This = device_from_device_parent(iface); - return IDirect3DDevice9Impl_Release((IDirect3DDevice9Ex *)This); -} - -/* IWineD3DDeviceParent methods */ - -static void STDMETHODCALLTYPE device_parent_WineD3DDeviceCreated(IWineD3DDeviceParent *iface, IWineD3DDevice *device) -{ - TRACE("iface %p, device %p\n", iface, device); -} - -static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParent *iface, - IUnknown *superior, UINT width, UINT height, enum wined3d_format_id format, DWORD usage, - WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, IWineD3DSurface **surface) -{ - struct IDirect3DDevice9Impl *This = device_from_device_parent(iface); + struct IDirect3DDevice9Impl *device = device_from_device_parent(device_parent); IDirect3DSurface9Impl *d3d_surface; BOOL lockable = TRUE; HRESULT hr; - TRACE("iface %p, superior %p, width %u, height %u, format %#x, usage %#x,\n" - "\tpool %#x, level %u, face %u, surface %p\n", - iface, superior, width, height, format, usage, pool, level, face, surface); + TRACE("device_parent %p, container_parent %p, width %u, height %u, format %#x, usage %#x,\n" + "\tpool %#x, level %u, face %u, surface %p.\n", + device_parent, container_parent, width, height, format, usage, pool, level, face, surface); if (pool == WINED3DPOOL_DEFAULT && !(usage & D3DUSAGE_DYNAMIC)) lockable = FALSE; - hr = IDirect3DDevice9Impl_CreateSurface((IDirect3DDevice9Ex *)This, width, height, + hr = IDirect3DDevice9Impl_CreateSurface(device, width, height, d3dformat_from_wined3dformat(format), lockable, FALSE /* Discard */, level, (IDirect3DSurface9 **)&d3d_surface, usage, pool, D3DMULTISAMPLE_NONE, 0 /* MultisampleQuality */); if (FAILED(hr)) { - ERR("(%p) CreateSurface failed, returning %#x\n", iface, hr); + WARN("Failed to create surface, hr %#x.\n", hr); return hr; } - *surface = d3d_surface->wineD3DSurface; - IWineD3DSurface_AddRef(*surface); + *surface = d3d_surface->wined3d_surface; + wined3d_surface_incref(*surface); - d3d_surface->container = superior; + d3d_surface->container = container_parent; IDirect3DDevice9Ex_Release(d3d_surface->parentDevice); d3d_surface->parentDevice = NULL; IDirect3DSurface9_Release((IDirect3DSurface9 *)d3d_surface); - d3d_surface->forwardReference = superior; + d3d_surface->forwardReference = container_parent; return hr; } -static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDeviceParent *iface, - IUnknown *superior, UINT width, UINT height, enum wined3d_format_id format, +static HRESULT CDECL device_parent_create_rendertarget(struct wined3d_device_parent *device_parent, + void *container_parent, UINT width, UINT height, enum wined3d_format_id format, WINED3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality, BOOL lockable, - IWineD3DSurface **surface) + struct wined3d_surface **surface) { - struct IDirect3DDevice9Impl *This = device_from_device_parent(iface); + struct IDirect3DDevice9Impl *device = device_from_device_parent(device_parent); IDirect3DSurface9Impl *d3d_surface; HRESULT hr; - TRACE("iface %p, superior %p, width %u, height %u, format %#x, multisample_type %#x,\n" - "\tmultisample_quality %u, lockable %u, surface %p\n", - iface, superior, width, height, format, multisample_type, multisample_quality, lockable, surface); + TRACE("device_parent %p, container_parent %p, width %u, height %u, format %#x, multisample_type %#x,\n" + "\tmultisample_quality %u, lockable %u, surface %p.\n", + device_parent, container_parent, width, height, format, multisample_type, + multisample_quality, lockable, surface); - hr = IDirect3DDevice9Impl_CreateRenderTarget((IDirect3DDevice9Ex *)This, width, height, + hr = IDirect3DDevice9Impl_CreateRenderTarget(&device->IDirect3DDevice9Ex_iface, width, height, d3dformat_from_wined3dformat(format), multisample_type, multisample_quality, lockable, (IDirect3DSurface9 **)&d3d_surface, NULL); if (FAILED(hr)) { - ERR("(%p) CreateRenderTarget failed, returning %#x\n", iface, hr); + WARN("Failed to create rendertarget, hr %#x.\n", hr); return hr; } - *surface = d3d_surface->wineD3DSurface; - IWineD3DSurface_AddRef(*surface); + *surface = d3d_surface->wined3d_surface; + wined3d_surface_incref(*surface); - d3d_surface->container = superior; + d3d_surface->container = container_parent; /* Implicit surfaces are created with an refcount of 0 */ IDirect3DSurface9_Release((IDirect3DSurface9 *)d3d_surface); return hr; } -static HRESULT STDMETHODCALLTYPE device_parent_CreateDepthStencilSurface(IWineD3DDeviceParent *iface, +static HRESULT CDECL device_parent_create_depth_stencil(struct wined3d_device_parent *device_parent, UINT width, UINT height, enum wined3d_format_id format, WINED3DMULTISAMPLE_TYPE multisample_type, - DWORD multisample_quality, BOOL discard, IWineD3DSurface **surface) + DWORD multisample_quality, BOOL discard, struct wined3d_surface **surface) { - struct IDirect3DDevice9Impl *This = device_from_device_parent(iface); + struct IDirect3DDevice9Impl *device = device_from_device_parent(device_parent); IDirect3DSurface9Impl *d3d_surface; HRESULT hr; - TRACE("iface %p, width %u, height %u, format %#x, multisample_type %#x,\n" - "\tmultisample_quality %u, discard %u, surface %p\n", - iface, width, height, format, multisample_type, multisample_quality, discard, surface); + TRACE("device_parent %p, width %u, height %u, format %#x, multisample_type %#x,\n" + "\tmultisample_quality %u, discard %u, surface %p.\n", + device_parent, width, height, format, multisample_type, multisample_quality, discard, surface); - hr = IDirect3DDevice9Impl_CreateDepthStencilSurface((IDirect3DDevice9Ex *)This, width, height, - d3dformat_from_wined3dformat(format), multisample_type, multisample_quality, discard, - (IDirect3DSurface9 **)&d3d_surface, NULL); + hr = IDirect3DDevice9Impl_CreateDepthStencilSurface(&device->IDirect3DDevice9Ex_iface, width, + height, d3dformat_from_wined3dformat(format), multisample_type, multisample_quality, + discard, (IDirect3DSurface9 **)&d3d_surface, NULL); if (FAILED(hr)) { - ERR("(%p) CreateDepthStencilSurface failed, returning %#x\n", iface, hr); + WARN("Failed to create depth/stencil surface, hr %#x.\n", hr); return hr; } - *surface = d3d_surface->wineD3DSurface; - IWineD3DSurface_AddRef(*surface); - d3d_surface->container = (IUnknown *)This; + *surface = d3d_surface->wined3d_surface; + wined3d_surface_incref(*surface); + d3d_surface->container = (IUnknown *)&device->IDirect3DDevice9Ex_iface; /* Implicit surfaces are created with an refcount of 0 */ IDirect3DSurface9_Release((IDirect3DSurface9 *)d3d_surface); return hr; } -static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent *iface, - IUnknown *superior, UINT width, UINT height, UINT depth, enum wined3d_format_id format, - WINED3DPOOL pool, DWORD usage, IWineD3DVolume **volume) +static HRESULT CDECL device_parent_create_volume(struct wined3d_device_parent *device_parent, + void *container_parent, UINT width, UINT height, UINT depth, enum wined3d_format_id format, + WINED3DPOOL pool, DWORD usage, struct wined3d_volume **volume) { - struct IDirect3DDevice9Impl *This = device_from_device_parent(iface); + struct IDirect3DDevice9Impl *device = device_from_device_parent(device_parent); IDirect3DVolume9Impl *object; HRESULT hr; - TRACE("iface %p, superior %p, width %u, height %u, depth %u, format %#x, pool %#x, usage %#x, volume %p\n", - iface, superior, width, height, depth, format, pool, usage, volume); + TRACE("device_parent %p, container_parent %p, width %u, height %u, depth %u, " + "format %#x, pool %#x, usage %#x, volume %p\n", + device_parent, container_parent, width, height, depth, + format, pool, usage, volume); /* Allocate the storage for the device */ object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); @@ -3135,7 +3247,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent return D3DERR_OUTOFVIDEOMEMORY; } - hr = volume_init(object, This, width, height, depth, usage, format, pool); + hr = volume_init(object, device, width, height, depth, usage, format, pool); if (FAILED(hr)) { WARN("Failed to initialize volume, hr %#x.\n", hr); @@ -3143,27 +3255,27 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent return hr; } - *volume = object->wineD3DVolume; - IWineD3DVolume_AddRef(*volume); - IDirect3DVolume9_Release((IDirect3DVolume9 *)object); + *volume = object->wined3d_volume; + wined3d_volume_incref(*volume); + IDirect3DVolume9_Release(&object->IDirect3DVolume9_iface); - object->container = superior; - object->forwardReference = superior; + object->container = container_parent; + object->forwardReference = container_parent; - TRACE("(%p) Created volume %p\n", iface, object); + TRACE("Created volume %p.\n", object); return hr; } -static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDeviceParent *iface, - WINED3DPRESENT_PARAMETERS *present_parameters, IWineD3DSwapChain **swapchain) +static HRESULT CDECL device_parent_create_swapchain(struct wined3d_device_parent *device_parent, + WINED3DPRESENT_PARAMETERS *present_parameters, struct wined3d_swapchain **swapchain) { - struct IDirect3DDevice9Impl *This = device_from_device_parent(iface); - IDirect3DSwapChain9Impl *d3d_swapchain; + struct IDirect3DDevice9Impl *device = device_from_device_parent(device_parent); D3DPRESENT_PARAMETERS local_parameters; + IDirect3DSwapChain9 *d3d_swapchain; HRESULT hr; - TRACE("iface %p, present_parameters %p, swapchain %p\n", iface, present_parameters, swapchain); + TRACE("device_parent %p, present_parameters %p, swapchain %p\n", device_parent, present_parameters, swapchain); /* Copy the presentation parameters */ local_parameters.BackBufferWidth = present_parameters->BackBufferWidth; @@ -3181,18 +3293,17 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDevicePar local_parameters.FullScreen_RefreshRateInHz = present_parameters->FullScreen_RefreshRateInHz; local_parameters.PresentationInterval = present_parameters->PresentationInterval; - hr = IDirect3DDevice9Impl_CreateAdditionalSwapChain((IDirect3DDevice9Ex *)This, - &local_parameters, (IDirect3DSwapChain9 **)&d3d_swapchain); + hr = IDirect3DDevice9Impl_CreateAdditionalSwapChain(&device->IDirect3DDevice9Ex_iface, + &local_parameters, &d3d_swapchain); if (FAILED(hr)) { - ERR("(%p) CreateAdditionalSwapChain failed, returning %#x\n", iface, hr); + WARN("Failed to create swapchain, hr %#x.\n", hr); *swapchain = NULL; return hr; } - *swapchain = d3d_swapchain->wineD3DSwapChain; - d3d_swapchain->isImplicit = TRUE; - /* Implicit swap chains are created with an refcount of 0 */ + *swapchain = ((IDirect3DSwapChain9Impl *)d3d_swapchain)->wined3d_swapchain; + wined3d_swapchain_incref(*swapchain); IDirect3DSwapChain9_Release((IDirect3DSwapChain9 *)d3d_swapchain); /* Copy back the presentation parameters */ @@ -3214,19 +3325,14 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDevicePar return hr; } -static const IWineD3DDeviceParentVtbl d3d9_wined3d_device_parent_vtbl = +static const struct wined3d_device_parent_ops d3d9_wined3d_device_parent_ops = { - /* IUnknown methods */ - device_parent_QueryInterface, - device_parent_AddRef, - device_parent_Release, - /* IWineD3DDeviceParent methods */ - device_parent_WineD3DDeviceCreated, - device_parent_CreateSurface, - device_parent_CreateRenderTarget, - device_parent_CreateDepthStencilSurface, - device_parent_CreateVolume, - device_parent_CreateSwapChain, + device_parent_wined3d_device_created, + device_parent_create_surface, + device_parent_create_rendertarget, + device_parent_create_depth_stencil, + device_parent_create_volume, + device_parent_create_swapchain, }; static void setup_fpu(void) @@ -3241,22 +3347,25 @@ static void setup_fpu(void) #endif } -HRESULT device_init(IDirect3DDevice9Impl *device, IWineD3D *wined3d, UINT adapter, D3DDEVTYPE device_type, - HWND focus_window, DWORD flags, D3DPRESENT_PARAMETERS *parameters) +HRESULT device_init(IDirect3DDevice9Impl *device, struct wined3d *wined3d, UINT adapter, D3DDEVTYPE device_type, + HWND focus_window, DWORD flags, D3DPRESENT_PARAMETERS *parameters, D3DDISPLAYMODEEX *mode) { WINED3DPRESENT_PARAMETERS *wined3d_parameters; UINT i, count = 1; HRESULT hr; - device->lpVtbl = &Direct3DDevice9_Vtbl; - device->device_parent_vtbl = &d3d9_wined3d_device_parent_vtbl; + if (mode) + FIXME("Ignoring display mode.\n"); + + device->IDirect3DDevice9Ex_iface.lpVtbl = &Direct3DDevice9_Vtbl; + device->device_parent.ops = &d3d9_wined3d_device_parent_ops; device->ref = 1; if (!(flags & D3DCREATE_FPU_PRESERVE)) setup_fpu(); wined3d_mutex_lock(); - hr = IWineD3D_CreateDevice(wined3d, adapter, device_type, focus_window, flags, - (IWineD3DDeviceParent *)&device->device_parent_vtbl, &device->WineD3DDevice); + hr = wined3d_device_create(wined3d, adapter, device_type, focus_window, flags, + &device->device_parent, &device->wined3d_device); if (FAILED(hr)) { WARN("Failed to create wined3d device, hr %#x.\n", hr); @@ -3264,33 +3373,45 @@ HRESULT device_init(IDirect3DDevice9Impl *device, IWineD3D *wined3d, UINT adapte return hr; } - if (!parameters->Windowed) - { - if (!focus_window) focus_window = parameters->hDeviceWindow; - if (FAILED(hr = IWineD3DDevice_AcquireFocusWindow(device->WineD3DDevice, focus_window))) - { - ERR("Failed to acquire focus window, hr %#x.\n", hr); - IWineD3DDevice_Release(device->WineD3DDevice); - wined3d_mutex_unlock(); - return hr; - } - } - if (flags & D3DCREATE_ADAPTERGROUP_DEVICE) { WINED3DCAPS caps; - IWineD3D_GetDeviceCaps(wined3d, adapter, device_type, &caps); + wined3d_get_device_caps(wined3d, adapter, device_type, &caps); count = caps.NumberOfAdaptersInGroup; } - if (flags & D3DCREATE_MULTITHREADED) IWineD3DDevice_SetMultithreaded(device->WineD3DDevice); + if (flags & D3DCREATE_MULTITHREADED) + wined3d_device_set_multithreaded(device->wined3d_device); + + if (!parameters->Windowed) + { + if (!focus_window) + focus_window = parameters->hDeviceWindow; + if (FAILED(hr = wined3d_device_acquire_focus_window(device->wined3d_device, focus_window))) + { + ERR("Failed to acquire focus window, hr %#x.\n", hr); + wined3d_device_decref(device->wined3d_device); + wined3d_mutex_unlock(); + return hr; + } + + for (i = 0; i < count; ++i) + { + HWND device_window = parameters[i].hDeviceWindow; + + if (!device_window) device_window = focus_window; + wined3d_device_setup_fullscreen_window(device->wined3d_device, device_window, + parameters[i].BackBufferWidth, + parameters[i].BackBufferHeight); + } + } wined3d_parameters = HeapAlloc(GetProcessHeap(), 0, sizeof(*wined3d_parameters) * count); if (!wined3d_parameters) { ERR("Failed to allocate wined3d parameters.\n"); - IWineD3DDevice_Release(device->WineD3DDevice); + wined3d_device_decref(device->wined3d_device); wined3d_mutex_unlock(); return E_OUTOFMEMORY; } @@ -3315,13 +3436,13 @@ HRESULT device_init(IDirect3DDevice9Impl *device, IWineD3D *wined3d, UINT adapte wined3d_parameters[i].AutoRestoreDisplayMode = TRUE; } - hr = IWineD3DDevice_Init3D(device->WineD3DDevice, wined3d_parameters); + hr = wined3d_device_init_3d(device->wined3d_device, wined3d_parameters); if (FAILED(hr)) { WARN("Failed to initialize 3D, hr %#x.\n", hr); - IWineD3DDevice_ReleaseFocusWindow(device->WineD3DDevice); + wined3d_device_release_focus_window(device->wined3d_device); HeapFree(GetProcessHeap(), 0, wined3d_parameters); - IWineD3DDevice_Release(device->WineD3DDevice); + wined3d_device_decref(device->wined3d_device); wined3d_mutex_unlock(); return hr; } @@ -3355,9 +3476,9 @@ HRESULT device_init(IDirect3DDevice9Impl *device, IWineD3D *wined3d, UINT adapte { ERR("Failed to allocate FVF vertex declaration map memory.\n"); wined3d_mutex_lock(); - IWineD3DDevice_Uninit3D(device->WineD3DDevice, D3D9CB_DestroySwapChain); - IWineD3DDevice_ReleaseFocusWindow(device->WineD3DDevice); - IWineD3DDevice_Release(device->WineD3DDevice); + wined3d_device_uninit_3d(device->wined3d_device); + wined3d_device_release_focus_window(device->wined3d_device); + wined3d_device_decref(device->wined3d_device); wined3d_mutex_unlock(); return E_OUTOFMEMORY; } diff --git a/dll/directx/wine/d3d9/directx.c b/dll/directx/wine/d3d9/directx.c index 1fcc8c47fcf..7a22c30223d 100644 --- a/dll/directx/wine/d3d9/directx.c +++ b/dll/directx/wine/d3d9/directx.c @@ -24,10 +24,14 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d9); -/* IDirect3D9 IUnknown parts follow: */ -static HRESULT WINAPI IDirect3D9Impl_QueryInterface(LPDIRECT3D9EX iface, REFIID riid, LPVOID* ppobj) +static inline IDirect3D9Impl *impl_from_IDirect3D9Ex(IDirect3D9Ex *iface) { - IDirect3D9Impl *This = (IDirect3D9Impl *)iface; + return CONTAINING_RECORD(iface, IDirect3D9Impl, IDirect3D9Ex_iface); +} + +static HRESULT WINAPI IDirect3D9Impl_QueryInterface(IDirect3D9Ex *iface, REFIID riid, void **ppobj) +{ + IDirect3D9Impl *This = impl_from_IDirect3D9Ex(iface); TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), ppobj); @@ -55,8 +59,9 @@ static HRESULT WINAPI IDirect3D9Impl_QueryInterface(LPDIRECT3D9EX iface, REFIID return E_NOINTERFACE; } -static ULONG WINAPI IDirect3D9Impl_AddRef(LPDIRECT3D9EX iface) { - IDirect3D9Impl *This = (IDirect3D9Impl *)iface; +static ULONG WINAPI IDirect3D9Impl_AddRef(IDirect3D9Ex *iface) +{ + IDirect3D9Impl *This = impl_from_IDirect3D9Ex(iface); ULONG ref = InterlockedIncrement(&This->ref); TRACE("%p increasing refcount to %u.\n", iface, ref); @@ -64,15 +69,16 @@ static ULONG WINAPI IDirect3D9Impl_AddRef(LPDIRECT3D9EX iface) { return ref; } -static ULONG WINAPI IDirect3D9Impl_Release(LPDIRECT3D9EX iface) { - IDirect3D9Impl *This = (IDirect3D9Impl *)iface; +static ULONG WINAPI IDirect3D9Impl_Release(IDirect3D9Ex *iface) +{ + IDirect3D9Impl *This = impl_from_IDirect3D9Ex(iface); ULONG ref = InterlockedDecrement(&This->ref); TRACE("%p decreasing refcount to %u.\n", iface, ref); if (ref == 0) { wined3d_mutex_lock(); - IWineD3D_Release(This->WineD3D); + wined3d_decref(This->WineD3D); wined3d_mutex_unlock(); HeapFree(GetProcessHeap(), 0, This); @@ -82,34 +88,39 @@ static ULONG WINAPI IDirect3D9Impl_Release(LPDIRECT3D9EX iface) { } /* IDirect3D9 Interface follow: */ -static HRESULT WINAPI IDirect3D9Impl_RegisterSoftwareDevice(LPDIRECT3D9EX iface, void* pInitializeFunction) { - IDirect3D9Impl *This = (IDirect3D9Impl *)iface; +static HRESULT WINAPI IDirect3D9Impl_RegisterSoftwareDevice(IDirect3D9Ex *iface, + void *pInitializeFunction) +{ + IDirect3D9Impl *This = impl_from_IDirect3D9Ex(iface); HRESULT hr; TRACE("iface %p, init_function %p.\n", iface, pInitializeFunction); wined3d_mutex_lock(); - hr = IWineD3D_RegisterSoftwareDevice(This->WineD3D, pInitializeFunction); + hr = wined3d_register_software_device(This->WineD3D, pInitializeFunction); wined3d_mutex_unlock(); return hr; } -static UINT WINAPI IDirect3D9Impl_GetAdapterCount(LPDIRECT3D9EX iface) { - IDirect3D9Impl *This = (IDirect3D9Impl *)iface; +static UINT WINAPI IDirect3D9Impl_GetAdapterCount(IDirect3D9Ex *iface) +{ + IDirect3D9Impl *This = impl_from_IDirect3D9Ex(iface); HRESULT hr; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - hr = IWineD3D_GetAdapterCount(This->WineD3D); + hr = wined3d_get_adapter_count(This->WineD3D); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3D9Impl_GetAdapterIdentifier(LPDIRECT3D9EX iface, UINT Adapter, DWORD Flags, D3DADAPTER_IDENTIFIER9* pIdentifier) { - IDirect3D9Impl *This = (IDirect3D9Impl *)iface; +static HRESULT WINAPI IDirect3D9Impl_GetAdapterIdentifier(IDirect3D9Ex *iface, UINT Adapter, + DWORD Flags, D3DADAPTER_IDENTIFIER9 *pIdentifier) +{ + IDirect3D9Impl *This = impl_from_IDirect3D9Ex(iface); WINED3DADAPTER_IDENTIFIER adapter_id; HRESULT hr; @@ -124,7 +135,7 @@ static HRESULT WINAPI IDirect3D9Impl_GetAdapterIdentifier(LPDIRECT3D9EX iface, U adapter_id.device_name_size = sizeof(pIdentifier->DeviceName); wined3d_mutex_lock(); - hr = IWineD3D_GetAdapterIdentifier(This->WineD3D, Adapter, Flags, &adapter_id); + hr = wined3d_get_adapter_identifier(This->WineD3D, Adapter, Flags, &adapter_id); wined3d_mutex_unlock(); pIdentifier->DriverVersion = adapter_id.driver_version; @@ -138,8 +149,10 @@ static HRESULT WINAPI IDirect3D9Impl_GetAdapterIdentifier(LPDIRECT3D9EX iface, U return hr; } -static UINT WINAPI IDirect3D9Impl_GetAdapterModeCount(LPDIRECT3D9EX iface, UINT Adapter, D3DFORMAT Format) { - IDirect3D9Impl *This = (IDirect3D9Impl *)iface; +static UINT WINAPI IDirect3D9Impl_GetAdapterModeCount(IDirect3D9Ex *iface, UINT Adapter, + D3DFORMAT Format) +{ + IDirect3D9Impl *This = impl_from_IDirect3D9Ex(iface); HRESULT hr; TRACE("iface %p, adapter %u, format %#x.\n", iface, Adapter, Format); @@ -150,14 +163,16 @@ static UINT WINAPI IDirect3D9Impl_GetAdapterModeCount(LPDIRECT3D9EX iface, UINT } wined3d_mutex_lock(); - hr = IWineD3D_GetAdapterModeCount(This->WineD3D, Adapter, wined3dformat_from_d3dformat(Format)); + hr = wined3d_get_adapter_mode_count(This->WineD3D, Adapter, wined3dformat_from_d3dformat(Format)); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3D9Impl_EnumAdapterModes(LPDIRECT3D9EX iface, UINT Adapter, D3DFORMAT Format, UINT Mode, D3DDISPLAYMODE* pMode) { - IDirect3D9Impl *This = (IDirect3D9Impl *)iface; +static HRESULT WINAPI IDirect3D9Impl_EnumAdapterModes(IDirect3D9Ex *iface, UINT Adapter, + D3DFORMAT Format, UINT Mode, D3DDISPLAYMODE *pMode) +{ + IDirect3D9Impl *This = impl_from_IDirect3D9Ex(iface); HRESULT hr; TRACE("iface %p, adapter %u, format %#x, mode_idx %u, mode %p.\n", @@ -169,7 +184,7 @@ static HRESULT WINAPI IDirect3D9Impl_EnumAdapterModes(LPDIRECT3D9EX iface, UINT return D3DERR_INVALIDCALL; wined3d_mutex_lock(); - hr = IWineD3D_EnumAdapterModes(This->WineD3D, Adapter, wined3dformat_from_d3dformat(Format), + hr = wined3d_enum_adapter_modes(This->WineD3D, Adapter, wined3dformat_from_d3dformat(Format), Mode, (WINED3DDISPLAYMODE *) pMode); wined3d_mutex_unlock(); @@ -178,14 +193,16 @@ static HRESULT WINAPI IDirect3D9Impl_EnumAdapterModes(LPDIRECT3D9EX iface, UINT return hr; } -static HRESULT WINAPI IDirect3D9Impl_GetAdapterDisplayMode(LPDIRECT3D9EX iface, UINT Adapter, D3DDISPLAYMODE* pMode) { - IDirect3D9Impl *This = (IDirect3D9Impl *)iface; +static HRESULT WINAPI IDirect3D9Impl_GetAdapterDisplayMode(IDirect3D9Ex *iface, UINT Adapter, + D3DDISPLAYMODE *pMode) +{ + IDirect3D9Impl *This = impl_from_IDirect3D9Ex(iface); HRESULT hr; TRACE("iface %p, adapter %u, mode %p.\n", iface, Adapter, pMode); wined3d_mutex_lock(); - hr = IWineD3D_GetAdapterDisplayMode(This->WineD3D, Adapter, (WINED3DDISPLAYMODE *) pMode); + hr = wined3d_get_adapter_display_mode(This->WineD3D, Adapter, (WINED3DDISPLAYMODE *)pMode); wined3d_mutex_unlock(); if (SUCCEEDED(hr)) pMode->Format = d3dformat_from_wined3dformat(pMode->Format); @@ -196,24 +213,25 @@ static HRESULT WINAPI IDirect3D9Impl_GetAdapterDisplayMode(LPDIRECT3D9EX iface, static HRESULT WINAPI IDirect3D9Impl_CheckDeviceType(IDirect3D9Ex *iface, UINT Adapter, D3DDEVTYPE CheckType, D3DFORMAT DisplayFormat, D3DFORMAT BackBufferFormat, BOOL Windowed) { - IDirect3D9Impl *This = (IDirect3D9Impl *)iface; + IDirect3D9Impl *This = impl_from_IDirect3D9Ex(iface); HRESULT hr; TRACE("iface %p, adapter %u, device_type %#x, display_format %#x, backbuffer_format %#x, windowed %#x.\n", iface, Adapter, CheckType, DisplayFormat, BackBufferFormat, Windowed); wined3d_mutex_lock(); - hr = IWineD3D_CheckDeviceType(This->WineD3D, Adapter, CheckType, wined3dformat_from_d3dformat(DisplayFormat), + hr = wined3d_check_device_type(This->WineD3D, Adapter, CheckType, wined3dformat_from_d3dformat(DisplayFormat), wined3dformat_from_d3dformat(BackBufferFormat), Windowed); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3D9Impl_CheckDeviceFormat(IDirect3D9Ex *iface, UINT Adapter, D3DDEVTYPE DeviceType, - D3DFORMAT AdapterFormat, DWORD Usage, D3DRESOURCETYPE RType, D3DFORMAT CheckFormat) +static HRESULT WINAPI IDirect3D9Impl_CheckDeviceFormat(IDirect3D9Ex *iface, UINT Adapter, + D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, DWORD Usage, D3DRESOURCETYPE RType, + D3DFORMAT CheckFormat) { - IDirect3D9Impl *This = (IDirect3D9Impl *)iface; + IDirect3D9Impl *This = impl_from_IDirect3D9Ex(iface); HRESULT hr; WINED3DRESOURCETYPE WineD3DRType; @@ -244,7 +262,7 @@ static HRESULT WINAPI IDirect3D9Impl_CheckDeviceFormat(IDirect3D9Ex *iface, UINT } wined3d_mutex_lock(); - hr = IWineD3D_CheckDeviceFormat(This->WineD3D, Adapter, DeviceType, wined3dformat_from_d3dformat(AdapterFormat), + hr = wined3d_check_device_format(This->WineD3D, Adapter, DeviceType, wined3dformat_from_d3dformat(AdapterFormat), Usage, WineD3DRType, wined3dformat_from_d3dformat(CheckFormat), SURFACE_OPENGL); wined3d_mutex_unlock(); @@ -252,17 +270,17 @@ static HRESULT WINAPI IDirect3D9Impl_CheckDeviceFormat(IDirect3D9Ex *iface, UINT } static HRESULT WINAPI IDirect3D9Impl_CheckDeviceMultiSampleType(IDirect3D9Ex *iface, UINT Adapter, - D3DDEVTYPE DeviceType, D3DFORMAT SurfaceFormat, BOOL Windowed, D3DMULTISAMPLE_TYPE MultiSampleType, - DWORD *pQualityLevels) + D3DDEVTYPE DeviceType, D3DFORMAT SurfaceFormat, BOOL Windowed, + D3DMULTISAMPLE_TYPE MultiSampleType, DWORD *pQualityLevels) { - IDirect3D9Impl *This = (IDirect3D9Impl *)iface; + IDirect3D9Impl *This = impl_from_IDirect3D9Ex(iface); HRESULT hr; TRACE("iface %p, adapter %u, device_type %#x, format %#x, windowed %#x, multisample_type %#x, levels %p.\n", iface, Adapter, DeviceType, SurfaceFormat, Windowed, MultiSampleType, pQualityLevels); wined3d_mutex_lock(); - hr = IWineD3D_CheckDeviceMultiSampleType(This->WineD3D, Adapter, DeviceType, + hr = wined3d_check_device_multisample_type(This->WineD3D, Adapter, DeviceType, wined3dformat_from_d3dformat(SurfaceFormat), Windowed, MultiSampleType, pQualityLevels); wined3d_mutex_unlock(); @@ -270,16 +288,17 @@ static HRESULT WINAPI IDirect3D9Impl_CheckDeviceMultiSampleType(IDirect3D9Ex *if } static HRESULT WINAPI IDirect3D9Impl_CheckDepthStencilMatch(IDirect3D9Ex *iface, UINT Adapter, - D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, D3DFORMAT RenderTargetFormat, D3DFORMAT DepthStencilFormat) + D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, D3DFORMAT RenderTargetFormat, + D3DFORMAT DepthStencilFormat) { - IDirect3D9Impl *This = (IDirect3D9Impl *)iface; + IDirect3D9Impl *This = impl_from_IDirect3D9Ex(iface); HRESULT hr; TRACE("iface %p, adapter %u, device_type %#x, adapter_format %#x, rt_format %#x, ds_format %#x.\n", iface, Adapter, DeviceType, AdapterFormat, RenderTargetFormat, DepthStencilFormat); wined3d_mutex_lock(); - hr = IWineD3D_CheckDepthStencilMatch(This->WineD3D, Adapter, DeviceType, + hr = wined3d_check_depth_stencil_match(This->WineD3D, Adapter, DeviceType, wined3dformat_from_d3dformat(AdapterFormat), wined3dformat_from_d3dformat(RenderTargetFormat), wined3dformat_from_d3dformat(DepthStencilFormat)); wined3d_mutex_unlock(); @@ -287,15 +306,17 @@ static HRESULT WINAPI IDirect3D9Impl_CheckDepthStencilMatch(IDirect3D9Ex *iface, return hr; } -static HRESULT WINAPI IDirect3D9Impl_CheckDeviceFormatConversion(LPDIRECT3D9EX iface, UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT SourceFormat, D3DFORMAT TargetFormat) { - IDirect3D9Impl *This = (IDirect3D9Impl *)iface; +static HRESULT WINAPI IDirect3D9Impl_CheckDeviceFormatConversion(IDirect3D9Ex *iface, UINT Adapter, + D3DDEVTYPE DeviceType, D3DFORMAT SourceFormat, D3DFORMAT TargetFormat) +{ + IDirect3D9Impl *This = impl_from_IDirect3D9Ex(iface); HRESULT hr; TRACE("iface %p, adapter %u, device_type %#x, src_format %#x, dst_format %#x.\n", iface, Adapter, DeviceType, SourceFormat, TargetFormat); wined3d_mutex_lock(); - hr = IWineD3D_CheckDeviceFormatConversion(This->WineD3D, Adapter, DeviceType, + hr = wined3d_check_device_format_conversion(This->WineD3D, Adapter, DeviceType, wined3dformat_from_d3dformat(SourceFormat), wined3dformat_from_d3dformat(TargetFormat)); wined3d_mutex_unlock(); @@ -362,8 +383,10 @@ void filter_caps(D3DCAPS9* pCaps) pCaps->NumSimultaneousRTs = min(D3D9_MAX_SIMULTANEOUS_RENDERTARGETS, pCaps->NumSimultaneousRTs); } -static HRESULT WINAPI IDirect3D9Impl_GetDeviceCaps(LPDIRECT3D9EX iface, UINT Adapter, D3DDEVTYPE DeviceType, D3DCAPS9* pCaps) { - IDirect3D9Impl *This = (IDirect3D9Impl *)iface; +static HRESULT WINAPI IDirect3D9Impl_GetDeviceCaps(IDirect3D9Ex *iface, UINT Adapter, + D3DDEVTYPE DeviceType, D3DCAPS9 *pCaps) +{ + IDirect3D9Impl *This = impl_from_IDirect3D9Ex(iface); HRESULT hrc = D3D_OK; WINED3DCAPS *pWineCaps; @@ -379,7 +402,7 @@ static HRESULT WINAPI IDirect3D9Impl_GetDeviceCaps(LPDIRECT3D9EX iface, UINT Ada memset(pCaps, 0, sizeof(*pCaps)); wined3d_mutex_lock(); - hrc = IWineD3D_GetDeviceCaps(This->WineD3D, Adapter, DeviceType, pWineCaps); + hrc = wined3d_get_device_caps(This->WineD3D, Adapter, DeviceType, pWineCaps); wined3d_mutex_unlock(); WINECAPSTOD3D9CAPS(pCaps, pWineCaps) @@ -394,14 +417,15 @@ static HRESULT WINAPI IDirect3D9Impl_GetDeviceCaps(LPDIRECT3D9EX iface, UINT Ada return hrc; } -static HMONITOR WINAPI IDirect3D9Impl_GetAdapterMonitor(LPDIRECT3D9EX iface, UINT Adapter) { - IDirect3D9Impl *This = (IDirect3D9Impl *)iface; +static HMONITOR WINAPI IDirect3D9Impl_GetAdapterMonitor(IDirect3D9Ex *iface, UINT Adapter) +{ + IDirect3D9Impl *This = impl_from_IDirect3D9Ex(iface); HMONITOR ret; TRACE("iface %p, adapter %u.\n", iface, Adapter); wined3d_mutex_lock(); - ret = IWineD3D_GetAdapterMonitor(This->WineD3D, Adapter); + ret = wined3d_get_adapter_monitor(This->WineD3D, Adapter); wined3d_mutex_unlock(); return ret; @@ -411,7 +435,7 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3D9Impl_CreateDevice(IDirect3D9Ex D3DDEVTYPE device_type, HWND focus_window, DWORD flags, D3DPRESENT_PARAMETERS *parameters, IDirect3DDevice9 **device) { - IDirect3D9Impl *This = (IDirect3D9Impl *)iface; + IDirect3D9Impl *This = impl_from_IDirect3D9Ex(iface); IDirect3DDevice9Impl *object; HRESULT hr; @@ -425,7 +449,7 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3D9Impl_CreateDevice(IDirect3D9Ex return E_OUTOFMEMORY; } - hr = device_init(object, This->WineD3D, adapter, device_type, focus_window, flags, parameters); + hr = device_init(object, This->WineD3D, adapter, device_type, focus_window, flags, parameters, NULL); if (FAILED(hr)) { WARN("Failed to initialize device, hr %#x.\n", hr); @@ -444,7 +468,7 @@ static UINT WINAPI IDirect3D9ExImpl_GetAdapterModeCountEx(IDirect3D9Ex *iface, { FIXME("iface %p, adapter %u, filter %p stub!\n", iface, adapter, filter); - return D3DERR_DRIVERINTERNALERROR; + return E_NOTIMPL; } static HRESULT WINAPI IDirect3D9ExImpl_EnumAdapterModesEx(IDirect3D9Ex *iface, @@ -453,7 +477,7 @@ static HRESULT WINAPI IDirect3D9ExImpl_EnumAdapterModesEx(IDirect3D9Ex *iface, FIXME("iface %p, adapter %u, filter %p, mode_idx %u, mode %p stub!\n", iface, adapter, filter, mode_idx, mode); - return D3DERR_DRIVERINTERNALERROR; + return E_NOTIMPL; } static HRESULT WINAPI IDirect3D9ExImpl_GetAdapterDisplayModeEx(IDirect3D9Ex *iface, @@ -462,26 +486,44 @@ static HRESULT WINAPI IDirect3D9ExImpl_GetAdapterDisplayModeEx(IDirect3D9Ex *ifa FIXME("iface %p, adapter %u, mode %p, rotation %p stub!\n", iface, adapter, mode, rotation); - return D3DERR_DRIVERINTERNALERROR; + return E_NOTIMPL; } static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3D9ExImpl_CreateDeviceEx(IDirect3D9Ex *iface, UINT adapter, D3DDEVTYPE device_type, HWND focus_window, DWORD flags, D3DPRESENT_PARAMETERS *parameters, D3DDISPLAYMODEEX *mode, IDirect3DDevice9Ex **device) { - FIXME("iface %p, adapter %u, device_type %#x, focus_window %p, flags %#x,\n" - "parameters %p, mode %p, device %p stub!\n", - iface, adapter, device_type, focus_window, flags, - parameters, mode, device); + IDirect3D9Impl *d3d9 = impl_from_IDirect3D9Ex(iface); + IDirect3DDevice9Impl *object; + HRESULT hr; - *device = NULL; + TRACE("iface %p, adapter %u, device_type %#x, focus_window %p, flags %#x, parameters %p, mode %p, device %p.\n", + iface, adapter, device_type, focus_window, flags, parameters, mode, device); - return D3DERR_DRIVERINTERNALERROR; + object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); + if (!object) + { + ERR("Failed to allocate device memory.\n"); + return E_OUTOFMEMORY; + } + + hr = device_init(object, d3d9->WineD3D, adapter, device_type, focus_window, flags, parameters, mode); + if (FAILED(hr)) + { + WARN("Failed to initialize device, hr %#x.\n", hr); + HeapFree(GetProcessHeap(), 0, object); + return hr; + } + + TRACE("Created device %p.\n", object); + *device = &object->IDirect3DDevice9Ex_iface; + + return D3D_OK; } static HRESULT WINAPI IDirect3D9ExImpl_GetAdapterLUID(IDirect3D9Ex *iface, UINT adapter, LUID *luid) { - IDirect3D9Impl *This = (IDirect3D9Impl *)iface; + IDirect3D9Impl *This = impl_from_IDirect3D9Ex(iface); WINED3DADAPTER_IDENTIFIER adapter_id; HRESULT hr; @@ -492,7 +534,7 @@ static HRESULT WINAPI IDirect3D9ExImpl_GetAdapterLUID(IDirect3D9Ex *iface, UINT adapter_id.device_name_size = 0; wined3d_mutex_lock(); - hr = IWineD3D_GetAdapterIdentifier(This->WineD3D, adapter, 0, &adapter_id); + hr = wined3d_get_adapter_identifier(This->WineD3D, adapter, 0, &adapter_id); wined3d_mutex_unlock(); memcpy(luid, &adapter_id.adapter_luid, sizeof(*luid)); diff --git a/dll/directx/wine/d3d9/query.c b/dll/directx/wine/d3d9/query.c index 4a5869696fb..42523320f33 100644 --- a/dll/directx/wine/d3d9/query.c +++ b/dll/directx/wine/d3d9/query.c @@ -25,9 +25,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d9); -/* IDirect3DQuery9 IUnknown parts follow: */ -static HRESULT WINAPI IDirect3DQuery9Impl_QueryInterface(LPDIRECT3DQUERY9 iface, REFIID riid, LPVOID* ppobj) { - IDirect3DQuery9Impl *This = (IDirect3DQuery9Impl *)iface; +static inline IDirect3DQuery9Impl *impl_from_IDirect3DQuery9(IDirect3DQuery9 *iface) +{ + return CONTAINING_RECORD(iface, IDirect3DQuery9Impl, IDirect3DQuery9_iface); +} + +static HRESULT WINAPI IDirect3DQuery9Impl_QueryInterface(IDirect3DQuery9 *iface, REFIID riid, + void **ppobj) +{ + IDirect3DQuery9Impl *This = impl_from_IDirect3DQuery9(iface); TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), ppobj); @@ -43,8 +49,9 @@ static HRESULT WINAPI IDirect3DQuery9Impl_QueryInterface(LPDIRECT3DQUERY9 iface, return E_NOINTERFACE; } -static ULONG WINAPI IDirect3DQuery9Impl_AddRef(LPDIRECT3DQUERY9 iface) { - IDirect3DQuery9Impl *This = (IDirect3DQuery9Impl *)iface; +static ULONG WINAPI IDirect3DQuery9Impl_AddRef(IDirect3DQuery9 *iface) +{ + IDirect3DQuery9Impl *This = impl_from_IDirect3DQuery9(iface); ULONG ref = InterlockedIncrement(&This->ref); TRACE("%p increasing refcount to %u.\n", iface, ref); @@ -52,15 +59,16 @@ static ULONG WINAPI IDirect3DQuery9Impl_AddRef(LPDIRECT3DQUERY9 iface) { return ref; } -static ULONG WINAPI IDirect3DQuery9Impl_Release(LPDIRECT3DQUERY9 iface) { - IDirect3DQuery9Impl *This = (IDirect3DQuery9Impl *)iface; +static ULONG WINAPI IDirect3DQuery9Impl_Release(IDirect3DQuery9 *iface) +{ + IDirect3DQuery9Impl *This = impl_from_IDirect3DQuery9(iface); ULONG ref = InterlockedDecrement(&This->ref); TRACE("%p decreasing refcount to %u.\n", iface, ref); if (ref == 0) { wined3d_mutex_lock(); - IWineD3DQuery_Release(This->wineD3DQuery); + wined3d_query_decref(This->wineD3DQuery); wined3d_mutex_unlock(); IDirect3DDevice9Ex_Release(This->parentDevice); @@ -69,10 +77,10 @@ static ULONG WINAPI IDirect3DQuery9Impl_Release(LPDIRECT3DQUERY9 iface) { return ref; } -/* IDirect3DQuery9 Interface follow: */ -static HRESULT WINAPI IDirect3DQuery9Impl_GetDevice(IDirect3DQuery9 *iface, IDirect3DDevice9 **device) +static HRESULT WINAPI IDirect3DQuery9Impl_GetDevice(IDirect3DQuery9 *iface, + IDirect3DDevice9 **device) { - IDirect3DQuery9Impl *This = (IDirect3DQuery9Impl *)iface; + IDirect3DQuery9Impl *This = impl_from_IDirect3DQuery9(iface); TRACE("iface %p, device %p.\n", iface, device); @@ -84,54 +92,59 @@ static HRESULT WINAPI IDirect3DQuery9Impl_GetDevice(IDirect3DQuery9 *iface, IDir return D3D_OK; } -static D3DQUERYTYPE WINAPI IDirect3DQuery9Impl_GetType(LPDIRECT3DQUERY9 iface) { - IDirect3DQuery9Impl *This = (IDirect3DQuery9Impl *)iface; - HRESULT hr; +static D3DQUERYTYPE WINAPI IDirect3DQuery9Impl_GetType(IDirect3DQuery9 *iface) +{ + IDirect3DQuery9Impl *This = impl_from_IDirect3DQuery9(iface); + D3DQUERYTYPE type; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - hr = IWineD3DQuery_GetType(This->wineD3DQuery); + type = wined3d_query_get_type(This->wineD3DQuery); wined3d_mutex_unlock(); - return hr; + return type; } -static DWORD WINAPI IDirect3DQuery9Impl_GetDataSize(LPDIRECT3DQUERY9 iface) { - IDirect3DQuery9Impl *This = (IDirect3DQuery9Impl *)iface; +static DWORD WINAPI IDirect3DQuery9Impl_GetDataSize(IDirect3DQuery9 *iface) +{ + IDirect3DQuery9Impl *This = impl_from_IDirect3DQuery9(iface); DWORD ret; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - ret = IWineD3DQuery_GetDataSize(This->wineD3DQuery); + ret = wined3d_query_get_data_size(This->wineD3DQuery); wined3d_mutex_unlock(); return ret; } -static HRESULT WINAPI IDirect3DQuery9Impl_Issue(LPDIRECT3DQUERY9 iface, DWORD dwIssueFlags) { - IDirect3DQuery9Impl *This = (IDirect3DQuery9Impl *)iface; +static HRESULT WINAPI IDirect3DQuery9Impl_Issue(IDirect3DQuery9 *iface, DWORD dwIssueFlags) +{ + IDirect3DQuery9Impl *This = impl_from_IDirect3DQuery9(iface); HRESULT hr; TRACE("iface %p, flags %#x.\n", iface, dwIssueFlags); wined3d_mutex_lock(); - hr = IWineD3DQuery_Issue(This->wineD3DQuery, dwIssueFlags); + hr = wined3d_query_issue(This->wineD3DQuery, dwIssueFlags); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DQuery9Impl_GetData(LPDIRECT3DQUERY9 iface, void* pData, DWORD dwSize, DWORD dwGetDataFlags) { - IDirect3DQuery9Impl *This = (IDirect3DQuery9Impl *)iface; +static HRESULT WINAPI IDirect3DQuery9Impl_GetData(IDirect3DQuery9 *iface, void *pData, + DWORD dwSize, DWORD dwGetDataFlags) +{ + IDirect3DQuery9Impl *This = impl_from_IDirect3DQuery9(iface); HRESULT hr; TRACE("iface %p, data %p, size %u, flags %#x.\n", iface, pData, dwSize, dwGetDataFlags); wined3d_mutex_lock(); - hr = IWineD3DQuery_GetData(This->wineD3DQuery, pData, dwSize, dwGetDataFlags); + hr = wined3d_query_get_data(This->wineD3DQuery, pData, dwSize, dwGetDataFlags); wined3d_mutex_unlock(); return hr; @@ -154,11 +167,11 @@ HRESULT query_init(IDirect3DQuery9Impl *query, IDirect3DDevice9Impl *device, D3D { HRESULT hr; - query->lpVtbl = &Direct3DQuery9_Vtbl; + query->IDirect3DQuery9_iface.lpVtbl = &Direct3DQuery9_Vtbl; query->ref = 1; wined3d_mutex_lock(); - hr = IWineD3DDevice_CreateQuery(device->WineD3DDevice, type, &query->wineD3DQuery); + hr = wined3d_query_create(device->wined3d_device, type, &query->wineD3DQuery); wined3d_mutex_unlock(); if (FAILED(hr)) { @@ -166,7 +179,7 @@ HRESULT query_init(IDirect3DQuery9Impl *query, IDirect3DDevice9Impl *device, D3D return hr; } - query->parentDevice = (IDirect3DDevice9Ex *)device; + query->parentDevice = &device->IDirect3DDevice9Ex_iface; IDirect3DDevice9Ex_AddRef(query->parentDevice); return D3D_OK; diff --git a/dll/directx/wine/d3d9/shader.c b/dll/directx/wine/d3d9/shader.c index c6656e524c3..c36600dcd60 100644 --- a/dll/directx/wine/d3d9/shader.c +++ b/dll/directx/wine/d3d9/shader.c @@ -51,7 +51,7 @@ static ULONG WINAPI d3d9_vertexshader_AddRef(IDirect3DVertexShader9 *iface) { IDirect3DDevice9Ex_AddRef(shader->parentDevice); wined3d_mutex_lock(); - IWineD3DVertexShader_AddRef(shader->wineD3DVertexShader); + wined3d_shader_incref(shader->wined3d_shader); wined3d_mutex_unlock(); } @@ -70,7 +70,7 @@ static ULONG WINAPI d3d9_vertexshader_Release(IDirect3DVertexShader9 *iface) IDirect3DDevice9Ex *device = shader->parentDevice; wined3d_mutex_lock(); - IWineD3DVertexShader_Release(shader->wineD3DVertexShader); + wined3d_shader_decref(shader->wined3d_shader); wined3d_mutex_unlock(); /* Release the device last, as it may cause the device to be destroyed. */ @@ -100,7 +100,7 @@ static HRESULT WINAPI d3d9_vertexshader_GetFunction(IDirect3DVertexShader9 *ifac TRACE("iface %p, data %p, data_size %p.\n", iface, data, data_size); wined3d_mutex_lock(); - hr = IWineD3DVertexShader_GetFunction(((IDirect3DVertexShader9Impl *)iface)->wineD3DVertexShader, data, data_size); + hr = wined3d_shader_get_byte_code(((IDirect3DVertexShader9Impl *)iface)->wined3d_shader, data, data_size); wined3d_mutex_unlock(); return hr; @@ -135,8 +135,8 @@ HRESULT vertexshader_init(IDirect3DVertexShader9Impl *shader, IDirect3DDevice9Im shader->lpVtbl = &d3d9_vertexshader_vtbl; wined3d_mutex_lock(); - hr = IWineD3DDevice_CreateVertexShader(device->WineD3DDevice, byte_code, NULL, - shader, &d3d9_vertexshader_wined3d_parent_ops, &shader->wineD3DVertexShader); + hr = wined3d_shader_create_vs(device->wined3d_device, byte_code, NULL, + shader, &d3d9_vertexshader_wined3d_parent_ops, &shader->wined3d_shader); wined3d_mutex_unlock(); if (FAILED(hr)) { @@ -144,7 +144,7 @@ HRESULT vertexshader_init(IDirect3DVertexShader9Impl *shader, IDirect3DDevice9Im return hr; } - shader->parentDevice = (IDirect3DDevice9Ex *)device; + shader->parentDevice = &device->IDirect3DDevice9Ex_iface; IDirect3DDevice9Ex_AddRef(shader->parentDevice); return D3D_OK; @@ -179,7 +179,7 @@ static ULONG WINAPI d3d9_pixelshader_AddRef(IDirect3DPixelShader9 *iface) { IDirect3DDevice9Ex_AddRef(shader->parentDevice); wined3d_mutex_lock(); - IWineD3DPixelShader_AddRef(shader->wineD3DPixelShader); + wined3d_shader_incref(shader->wined3d_shader); wined3d_mutex_unlock(); } @@ -198,7 +198,7 @@ static ULONG WINAPI d3d9_pixelshader_Release(IDirect3DPixelShader9 *iface) IDirect3DDevice9Ex *device = shader->parentDevice; wined3d_mutex_lock(); - IWineD3DPixelShader_Release(shader->wineD3DPixelShader); + wined3d_shader_decref(shader->wined3d_shader); wined3d_mutex_unlock(); /* Release the device last, as it may cause the device to be destroyed. */ @@ -227,7 +227,7 @@ static HRESULT WINAPI d3d9_pixelshader_GetFunction(IDirect3DPixelShader9 *iface, TRACE("iface %p, data %p, data_size %p.\n", iface, data, data_size); wined3d_mutex_lock(); - hr = IWineD3DPixelShader_GetFunction(((IDirect3DPixelShader9Impl *)iface)->wineD3DPixelShader, data, data_size); + hr = wined3d_shader_get_byte_code(((IDirect3DPixelShader9Impl *)iface)->wined3d_shader, data, data_size); wined3d_mutex_unlock(); return hr; @@ -262,8 +262,8 @@ HRESULT pixelshader_init(IDirect3DPixelShader9Impl *shader, IDirect3DDevice9Impl shader->lpVtbl = &d3d9_pixelshader_vtbl; wined3d_mutex_lock(); - hr = IWineD3DDevice_CreatePixelShader(device->WineD3DDevice, byte_code, NULL, shader, - &d3d9_pixelshader_wined3d_parent_ops, &shader->wineD3DPixelShader); + hr = wined3d_shader_create_ps(device->wined3d_device, byte_code, NULL, shader, + &d3d9_pixelshader_wined3d_parent_ops, &shader->wined3d_shader); wined3d_mutex_unlock(); if (FAILED(hr)) { @@ -271,7 +271,7 @@ HRESULT pixelshader_init(IDirect3DPixelShader9Impl *shader, IDirect3DDevice9Impl return hr; } - shader->parentDevice = (IDirect3DDevice9Ex *)device; + shader->parentDevice = &device->IDirect3DDevice9Ex_iface; IDirect3DDevice9Ex_AddRef(shader->parentDevice); return D3D_OK; diff --git a/dll/directx/wine/d3d9/stateblock.c b/dll/directx/wine/d3d9/stateblock.c index 01a882eea54..06f8aedba75 100644 --- a/dll/directx/wine/d3d9/stateblock.c +++ b/dll/directx/wine/d3d9/stateblock.c @@ -25,9 +25,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d9); -/* IDirect3DStateBlock9 IUnknown parts follow: */ -static HRESULT WINAPI IDirect3DStateBlock9Impl_QueryInterface(LPDIRECT3DSTATEBLOCK9 iface, REFIID riid, LPVOID* ppobj) { - IDirect3DStateBlock9Impl *This = (IDirect3DStateBlock9Impl *)iface; +static inline IDirect3DStateBlock9Impl *impl_from_IDirect3DStateBlock9(IDirect3DStateBlock9 *iface) +{ + return CONTAINING_RECORD(iface, IDirect3DStateBlock9Impl, IDirect3DStateBlock9_iface); +} + +static HRESULT WINAPI IDirect3DStateBlock9Impl_QueryInterface(IDirect3DStateBlock9 *iface, + REFIID riid, void **ppobj) +{ + IDirect3DStateBlock9Impl *This = impl_from_IDirect3DStateBlock9(iface); TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), ppobj); @@ -43,8 +49,9 @@ static HRESULT WINAPI IDirect3DStateBlock9Impl_QueryInterface(LPDIRECT3DSTATEBLO return E_NOINTERFACE; } -static ULONG WINAPI IDirect3DStateBlock9Impl_AddRef(LPDIRECT3DSTATEBLOCK9 iface) { - IDirect3DStateBlock9Impl *This = (IDirect3DStateBlock9Impl *)iface; +static ULONG WINAPI IDirect3DStateBlock9Impl_AddRef(IDirect3DStateBlock9 *iface) +{ + IDirect3DStateBlock9Impl *This = impl_from_IDirect3DStateBlock9(iface); ULONG ref = InterlockedIncrement(&This->ref); TRACE("%p increasing refcount to %u.\n", iface, ref); @@ -52,15 +59,16 @@ static ULONG WINAPI IDirect3DStateBlock9Impl_AddRef(LPDIRECT3DSTATEBLOCK9 iface) return ref; } -static ULONG WINAPI IDirect3DStateBlock9Impl_Release(LPDIRECT3DSTATEBLOCK9 iface) { - IDirect3DStateBlock9Impl *This = (IDirect3DStateBlock9Impl *)iface; +static ULONG WINAPI IDirect3DStateBlock9Impl_Release(IDirect3DStateBlock9 *iface) +{ + IDirect3DStateBlock9Impl *This = impl_from_IDirect3DStateBlock9(iface); ULONG ref = InterlockedDecrement(&This->ref); TRACE("%p decreasing refcount to %u.\n", iface, ref); if (ref == 0) { wined3d_mutex_lock(); - IWineD3DStateBlock_Release(This->wineD3DStateBlock); + wined3d_stateblock_decref(This->wined3d_stateblock); wined3d_mutex_unlock(); IDirect3DDevice9Ex_Release(This->parentDevice); @@ -70,9 +78,10 @@ static ULONG WINAPI IDirect3DStateBlock9Impl_Release(LPDIRECT3DSTATEBLOCK9 iface } /* IDirect3DStateBlock9 Interface follow: */ -static HRESULT WINAPI IDirect3DStateBlock9Impl_GetDevice(IDirect3DStateBlock9 *iface, IDirect3DDevice9 **device) +static HRESULT WINAPI IDirect3DStateBlock9Impl_GetDevice(IDirect3DStateBlock9 *iface, + IDirect3DDevice9 **device) { - IDirect3DStateBlock9Impl *This = (IDirect3DStateBlock9Impl *)iface; + IDirect3DStateBlock9Impl *This = impl_from_IDirect3DStateBlock9(iface); TRACE("iface %p, device %p.\n", iface, device); @@ -84,27 +93,29 @@ static HRESULT WINAPI IDirect3DStateBlock9Impl_GetDevice(IDirect3DStateBlock9 *i return D3D_OK; } -static HRESULT WINAPI IDirect3DStateBlock9Impl_Capture(LPDIRECT3DSTATEBLOCK9 iface) { - IDirect3DStateBlock9Impl *This = (IDirect3DStateBlock9Impl *)iface; +static HRESULT WINAPI IDirect3DStateBlock9Impl_Capture(IDirect3DStateBlock9 *iface) +{ + IDirect3DStateBlock9Impl *This = impl_from_IDirect3DStateBlock9(iface); HRESULT hr; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - hr = IWineD3DStateBlock_Capture(This->wineD3DStateBlock); + hr = wined3d_stateblock_capture(This->wined3d_stateblock); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DStateBlock9Impl_Apply(LPDIRECT3DSTATEBLOCK9 iface) { - IDirect3DStateBlock9Impl *This = (IDirect3DStateBlock9Impl *)iface; +static HRESULT WINAPI IDirect3DStateBlock9Impl_Apply(IDirect3DStateBlock9 *iface) +{ + IDirect3DStateBlock9Impl *This = impl_from_IDirect3DStateBlock9(iface); HRESULT hr; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - hr = IWineD3DStateBlock_Apply(This->wineD3DStateBlock); + hr = wined3d_stateblock_apply(This->wined3d_stateblock); wined3d_mutex_unlock(); return hr; @@ -124,22 +135,22 @@ static const IDirect3DStateBlock9Vtbl Direct3DStateBlock9_Vtbl = }; HRESULT stateblock_init(IDirect3DStateBlock9Impl *stateblock, IDirect3DDevice9Impl *device, - D3DSTATEBLOCKTYPE type, IWineD3DStateBlock *wined3d_stateblock) + D3DSTATEBLOCKTYPE type, struct wined3d_stateblock *wined3d_stateblock) { HRESULT hr; - stateblock->lpVtbl = &Direct3DStateBlock9_Vtbl; + stateblock->IDirect3DStateBlock9_iface.lpVtbl = &Direct3DStateBlock9_Vtbl; stateblock->ref = 1; if (wined3d_stateblock) { - stateblock->wineD3DStateBlock = wined3d_stateblock; + stateblock->wined3d_stateblock = wined3d_stateblock; } else { wined3d_mutex_lock(); - hr = IWineD3DDevice_CreateStateBlock(device->WineD3DDevice, - (WINED3DSTATEBLOCKTYPE)type, &stateblock->wineD3DStateBlock); + hr = wined3d_stateblock_create(device->wined3d_device, + (WINED3DSTATEBLOCKTYPE)type, &stateblock->wined3d_stateblock); wined3d_mutex_unlock(); if (FAILED(hr)) { @@ -148,7 +159,7 @@ HRESULT stateblock_init(IDirect3DStateBlock9Impl *stateblock, IDirect3DDevice9Im } } - stateblock->parentDevice = (IDirect3DDevice9Ex *)device; + stateblock->parentDevice = &device->IDirect3DDevice9Ex_iface; IDirect3DDevice9Ex_AddRef(stateblock->parentDevice); return D3D_OK; diff --git a/dll/directx/wine/d3d9/surface.c b/dll/directx/wine/d3d9/surface.c index de3fb779e0d..1d66bde2d90 100644 --- a/dll/directx/wine/d3d9/surface.c +++ b/dll/directx/wine/d3d9/surface.c @@ -62,7 +62,7 @@ static ULONG WINAPI IDirect3DSurface9Impl_AddRef(LPDIRECT3DSURFACE9 iface) { { if (This->parentDevice) IDirect3DDevice9Ex_AddRef(This->parentDevice); wined3d_mutex_lock(); - IWineD3DSurface_AddRef(This->wineD3DSurface); + wined3d_surface_incref(This->wined3d_surface); wined3d_mutex_unlock(); } @@ -90,7 +90,7 @@ static ULONG WINAPI IDirect3DSurface9Impl_Release(LPDIRECT3DSURFACE9 iface) { IDirect3DDevice9Ex *parentDevice = This->parentDevice; wined3d_mutex_lock(); - IWineD3DSurface_Release(This->wineD3DSurface); + wined3d_surface_decref(This->wined3d_surface); wined3d_mutex_unlock(); /* Release the device last, as it may cause the device to be destroyed. */ @@ -141,7 +141,7 @@ static HRESULT WINAPI IDirect3DSurface9Impl_SetPrivateData(LPDIRECT3DSURFACE9 if iface, debugstr_guid(refguid), pData, SizeOfData, Flags); wined3d_mutex_lock(); - hr = IWineD3DSurface_SetPrivateData(This->wineD3DSurface, refguid, pData, SizeOfData, Flags); + hr = wined3d_surface_set_private_data(This->wined3d_surface, refguid, pData, SizeOfData, Flags); wined3d_mutex_unlock(); return hr; @@ -155,7 +155,7 @@ static HRESULT WINAPI IDirect3DSurface9Impl_GetPrivateData(LPDIRECT3DSURFACE9 if iface, debugstr_guid(refguid), pData, pSizeOfData); wined3d_mutex_lock(); - hr = IWineD3DSurface_GetPrivateData(This->wineD3DSurface, refguid, pData, pSizeOfData); + hr = wined3d_surface_get_private_data(This->wined3d_surface, refguid, pData, pSizeOfData); wined3d_mutex_unlock(); return hr; @@ -168,7 +168,7 @@ static HRESULT WINAPI IDirect3DSurface9Impl_FreePrivateData(LPDIRECT3DSURFACE9 i TRACE("iface %p, guid %s.\n", iface, debugstr_guid(refguid)); wined3d_mutex_lock(); - hr = IWineD3DSurface_FreePrivateData(This->wineD3DSurface, refguid); + hr = wined3d_surface_free_private_data(This->wined3d_surface, refguid); wined3d_mutex_unlock(); return hr; @@ -181,7 +181,7 @@ static DWORD WINAPI IDirect3DSurface9Impl_SetPriority(LPDIRECT3DSURFACE9 iface, TRACE("iface %p, priority %u.\n", iface, PriorityNew); wined3d_mutex_lock(); - hr = IWineD3DSurface_SetPriority(This->wineD3DSurface, PriorityNew); + hr = wined3d_surface_set_priority(This->wined3d_surface, PriorityNew); wined3d_mutex_unlock(); return hr; @@ -194,7 +194,7 @@ static DWORD WINAPI IDirect3DSurface9Impl_GetPriority(LPDIRECT3DSURFACE9 iface) TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - hr = IWineD3DSurface_GetPriority(This->wineD3DSurface); + hr = wined3d_surface_get_priority(This->wined3d_surface); wined3d_mutex_unlock(); return hr; @@ -206,21 +206,15 @@ static void WINAPI IDirect3DSurface9Impl_PreLoad(LPDIRECT3DSURFACE9 iface) { TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - IWineD3DSurface_PreLoad(This->wineD3DSurface); + wined3d_surface_preload(This->wined3d_surface); wined3d_mutex_unlock(); } -static D3DRESOURCETYPE WINAPI IDirect3DSurface9Impl_GetType(LPDIRECT3DSURFACE9 iface) { - IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface; - D3DRESOURCETYPE ret; - +static D3DRESOURCETYPE WINAPI IDirect3DSurface9Impl_GetType(IDirect3DSurface9 *iface) +{ TRACE("iface %p.\n", iface); - wined3d_mutex_lock(); - ret = IWineD3DSurface_GetType(This->wineD3DSurface); - wined3d_mutex_unlock(); - - return ret; + return D3DRTYPE_SURFACE; } /* IDirect3DSurface9 Interface follow: */ @@ -232,10 +226,6 @@ static HRESULT WINAPI IDirect3DSurface9Impl_GetContainer(LPDIRECT3DSURFACE9 ifac if (!This->container) return E_NOINTERFACE; - if (!ppContainer) { - ERR("Called without a valid ppContainer\n"); - } - res = IUnknown_QueryInterface(This->container, riid, ppContainer); TRACE("Returning ppContainer %p, *ppContainer %p\n", ppContainer, *ppContainer); @@ -243,24 +233,27 @@ static HRESULT WINAPI IDirect3DSurface9Impl_GetContainer(LPDIRECT3DSURFACE9 ifac return res; } -static HRESULT WINAPI IDirect3DSurface9Impl_GetDesc(LPDIRECT3DSURFACE9 iface, D3DSURFACE_DESC* pDesc) { +static HRESULT WINAPI IDirect3DSurface9Impl_GetDesc(IDirect3DSurface9 *iface, D3DSURFACE_DESC *desc) +{ IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface; - WINED3DSURFACE_DESC wined3ddesc; + struct wined3d_resource_desc wined3d_desc; + struct wined3d_resource *wined3d_resource; - TRACE("iface %p, desc %p.\n", iface, pDesc); + TRACE("iface %p, desc %p.\n", iface, desc); wined3d_mutex_lock(); - IWineD3DSurface_GetDesc(This->wineD3DSurface, &wined3ddesc); + wined3d_resource = wined3d_surface_get_resource(This->wined3d_surface); + wined3d_resource_get_desc(wined3d_resource, &wined3d_desc); wined3d_mutex_unlock(); - pDesc->Format = d3dformat_from_wined3dformat(wined3ddesc.format); - pDesc->Type = wined3ddesc.resource_type; - pDesc->Usage = wined3ddesc.usage; - pDesc->Pool = wined3ddesc.pool; - pDesc->MultiSampleType = wined3ddesc.multisample_type; - pDesc->MultiSampleQuality = wined3ddesc.multisample_quality; - pDesc->Width = wined3ddesc.width; - pDesc->Height = wined3ddesc.height; + desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format); + desc->Type = wined3d_desc.resource_type; + desc->Usage = wined3d_desc.usage; + desc->Pool = wined3d_desc.pool; + desc->MultiSampleType = wined3d_desc.multisample_type; + desc->MultiSampleQuality = wined3d_desc.multisample_quality; + desc->Width = wined3d_desc.width; + desc->Height = wined3d_desc.height; return D3D_OK; } @@ -272,7 +265,7 @@ static HRESULT WINAPI IDirect3DSurface9Impl_LockRect(LPDIRECT3DSURFACE9 iface, D TRACE("iface %p, locked_rect %p, rect %p, flags %#x.\n", iface, pLockedRect, pRect, Flags); wined3d_mutex_lock(); - hr = IWineD3DSurface_LockRect(This->wineD3DSurface, (WINED3DLOCKED_RECT *) pLockedRect, pRect, Flags); + hr = wined3d_surface_map(This->wined3d_surface, (WINED3DLOCKED_RECT *)pLockedRect, pRect, Flags); wined3d_mutex_unlock(); return hr; @@ -285,7 +278,7 @@ static HRESULT WINAPI IDirect3DSurface9Impl_UnlockRect(LPDIRECT3DSURFACE9 iface) TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - hr = IWineD3DSurface_UnlockRect(This->wineD3DSurface); + hr = wined3d_surface_unmap(This->wined3d_surface); wined3d_mutex_unlock(); switch(hr) @@ -309,7 +302,7 @@ static HRESULT WINAPI IDirect3DSurface9Impl_GetDC(LPDIRECT3DSURFACE9 iface, HDC* } wined3d_mutex_lock(); - hr = IWineD3DSurface_GetDC(This->wineD3DSurface, phdc); + hr = wined3d_surface_getdc(This->wined3d_surface, phdc); wined3d_mutex_unlock(); return hr; @@ -322,11 +315,12 @@ static HRESULT WINAPI IDirect3DSurface9Impl_ReleaseDC(LPDIRECT3DSURFACE9 iface, TRACE("iface %p, hdc %p.\n", iface, hdc); wined3d_mutex_lock(); - hr = IWineD3DSurface_ReleaseDC(This->wineD3DSurface, hdc); + hr = wined3d_surface_releasedc(This->wined3d_surface, hdc); wined3d_mutex_unlock(); - switch(hr) { - case WINEDDERR_NODC: return WINED3DERR_INVALIDCALL; + switch (hr) + { + case WINEDDERR_NODC: return D3DERR_INVALIDCALL; default: return hr; } } @@ -398,9 +392,9 @@ HRESULT surface_init(IDirect3DSurface9Impl *surface, IDirect3DDevice9Impl *devic } wined3d_mutex_lock(); - hr = IWineD3DDevice_CreateSurface(device->WineD3DDevice, width, height, wined3dformat_from_d3dformat(format), + hr = wined3d_surface_create(device->wined3d_device, width, height, wined3dformat_from_d3dformat(format), lockable, discard, level, usage & WINED3DUSAGE_MASK, (WINED3DPOOL)pool, multisample_type, - multisample_quality, SURFACE_OPENGL, surface, &d3d9_surface_wined3d_parent_ops, &surface->wineD3DSurface); + multisample_quality, SURFACE_OPENGL, surface, &d3d9_surface_wined3d_parent_ops, &surface->wined3d_surface); wined3d_mutex_unlock(); if (FAILED(hr)) { @@ -408,7 +402,7 @@ HRESULT surface_init(IDirect3DSurface9Impl *surface, IDirect3DDevice9Impl *devic return hr; } - surface->parentDevice = (IDirect3DDevice9Ex *)device; + surface->parentDevice = &device->IDirect3DDevice9Ex_iface; IDirect3DDevice9Ex_AddRef(surface->parentDevice); return D3D_OK; diff --git a/dll/directx/wine/d3d9/swapchain.c b/dll/directx/wine/d3d9/swapchain.c index 0d523914f92..26437079970 100644 --- a/dll/directx/wine/d3d9/swapchain.c +++ b/dll/directx/wine/d3d9/swapchain.c @@ -50,7 +50,15 @@ static ULONG WINAPI IDirect3DSwapChain9Impl_AddRef(LPDIRECT3DSWAPCHAIN9 iface) { TRACE("%p increasing refcount to %u.\n", iface, ref); - if(ref == 1 && This->parentDevice) IDirect3DDevice9Ex_AddRef(This->parentDevice); + if (ref == 1) + { + if (This->parentDevice) + IDirect3DDevice9Ex_AddRef(This->parentDevice); + + wined3d_mutex_lock(); + wined3d_swapchain_incref(This->wined3d_swapchain); + wined3d_mutex_unlock(); + } return ref; } @@ -64,13 +72,9 @@ static ULONG WINAPI IDirect3DSwapChain9Impl_Release(LPDIRECT3DSWAPCHAIN9 iface) if (ref == 0) { IDirect3DDevice9Ex *parentDevice = This->parentDevice; - if (!This->isImplicit) { - wined3d_mutex_lock(); - IWineD3DSwapChain_Destroy(This->wineD3DSwapChain); - wined3d_mutex_unlock(); - - HeapFree(GetProcessHeap(), 0, This); - } + wined3d_mutex_lock(); + wined3d_swapchain_decref(This->wined3d_swapchain); + wined3d_mutex_unlock(); /* Release the device last, as it may cause the device to be destroyed. */ if (parentDevice) IDirect3DDevice9Ex_Release(parentDevice); @@ -87,7 +91,8 @@ static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DSwapChain9Impl_Present(LPDIRECT iface, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion, dwFlags); wined3d_mutex_lock(); - hr = IWineD3DSwapChain_Present(This->wineD3DSwapChain, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion, dwFlags); + hr = wined3d_swapchain_present(This->wined3d_swapchain, pSourceRect, + pDestRect, hDestWindowOverride, pDirtyRegion, dwFlags); wined3d_mutex_unlock(); return hr; @@ -100,7 +105,8 @@ static HRESULT WINAPI IDirect3DSwapChain9Impl_GetFrontBufferData(LPDIRECT3DSWAPC TRACE("iface %p, surface %p.\n", iface, pDestSurface); wined3d_mutex_lock(); - hr = IWineD3DSwapChain_GetFrontBufferData(This->wineD3DSwapChain, ((IDirect3DSurface9Impl *)pDestSurface)->wineD3DSurface); + hr = wined3d_swapchain_get_front_buffer_data(This->wined3d_swapchain, + ((IDirect3DSurface9Impl *)pDestSurface)->wined3d_surface); wined3d_mutex_unlock(); return hr; @@ -110,20 +116,20 @@ static HRESULT WINAPI IDirect3DSwapChain9Impl_GetBackBuffer(IDirect3DSwapChain9 UINT iBackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface9 **ppBackBuffer) { IDirect3DSwapChain9Impl *This = (IDirect3DSwapChain9Impl *)iface; - IWineD3DSurface *mySurface = NULL; + struct wined3d_surface *wined3d_surface = NULL; HRESULT hr; TRACE("iface %p, backbuffer_idx %u, backbuffer_type %#x, backbuffer %p.\n", iface, iBackBuffer, Type, ppBackBuffer); wined3d_mutex_lock(); - hr = IWineD3DSwapChain_GetBackBuffer(This->wineD3DSwapChain, iBackBuffer, - (WINED3DBACKBUFFER_TYPE)Type, &mySurface); - if (SUCCEEDED(hr) && mySurface) + hr = wined3d_swapchain_get_back_buffer(This->wined3d_swapchain, + iBackBuffer, (WINED3DBACKBUFFER_TYPE)Type, &wined3d_surface); + if (SUCCEEDED(hr) && wined3d_surface) { - *ppBackBuffer = IWineD3DSurface_GetParent(mySurface); + *ppBackBuffer = wined3d_surface_get_parent(wined3d_surface); IDirect3DSurface9_AddRef(*ppBackBuffer); - IWineD3DSurface_Release(mySurface); + wined3d_surface_decref(wined3d_surface); } wined3d_mutex_unlock(); @@ -138,7 +144,7 @@ static HRESULT WINAPI IDirect3DSwapChain9Impl_GetRasterStatus(LPDIRECT3DSWAPCHAI TRACE("iface %p, raster_status %p.\n", iface, pRasterStatus); wined3d_mutex_lock(); - hr = IWineD3DSwapChain_GetRasterStatus(This->wineD3DSwapChain, (WINED3DRASTER_STATUS *) pRasterStatus); + hr = wined3d_swapchain_get_raster_status(This->wined3d_swapchain, (WINED3DRASTER_STATUS *)pRasterStatus); wined3d_mutex_unlock(); return hr; @@ -151,7 +157,7 @@ static HRESULT WINAPI IDirect3DSwapChain9Impl_GetDisplayMode(LPDIRECT3DSWAPCHAIN TRACE("iface %p, mode %p.\n", iface, pMode); wined3d_mutex_lock(); - hr = IWineD3DSwapChain_GetDisplayMode(This->wineD3DSwapChain, (WINED3DDISPLAYMODE *) pMode); + hr = wined3d_swapchain_get_display_mode(This->wined3d_swapchain, (WINED3DDISPLAYMODE *)pMode); wined3d_mutex_unlock(); if (SUCCEEDED(hr)) pMode->Format = d3dformat_from_wined3dformat(pMode->Format); @@ -181,7 +187,7 @@ static HRESULT WINAPI IDirect3DSwapChain9Impl_GetPresentParameters(LPDIRECT3DSWA TRACE("iface %p, parameters %p.\n", iface, pPresentationParameters); wined3d_mutex_lock(); - hr = IWineD3DSwapChain_GetPresentParameters(This->wineD3DSwapChain, &winePresentParameters); + hr = wined3d_swapchain_get_present_parameters(This->wined3d_swapchain, &winePresentParameters); wined3d_mutex_unlock(); pPresentationParameters->BackBufferWidth = winePresentParameters.BackBufferWidth; @@ -217,6 +223,16 @@ static const IDirect3DSwapChain9Vtbl Direct3DSwapChain9_Vtbl = IDirect3DSwapChain9Impl_GetPresentParameters }; +static void STDMETHODCALLTYPE d3d9_swapchain_wined3d_object_released(void *parent) +{ + HeapFree(GetProcessHeap(), 0, parent); +} + +static const struct wined3d_parent_ops d3d9_swapchain_wined3d_parent_ops = +{ + d3d9_swapchain_wined3d_object_released, +}; + HRESULT swapchain_init(IDirect3DSwapChain9Impl *swapchain, IDirect3DDevice9Impl *device, D3DPRESENT_PARAMETERS *present_parameters) { @@ -243,8 +259,9 @@ HRESULT swapchain_init(IDirect3DSwapChain9Impl *swapchain, IDirect3DDevice9Impl wined3d_parameters.AutoRestoreDisplayMode = TRUE; wined3d_mutex_lock(); - hr = IWineD3DDevice_CreateSwapChain(device->WineD3DDevice, &wined3d_parameters, - SURFACE_OPENGL, swapchain, &swapchain->wineD3DSwapChain); + hr = wined3d_swapchain_create(device->wined3d_device, &wined3d_parameters, + SURFACE_OPENGL, swapchain, &d3d9_swapchain_wined3d_parent_ops, + &swapchain->wined3d_swapchain); wined3d_mutex_unlock(); present_parameters->BackBufferWidth = wined3d_parameters.BackBufferWidth; @@ -268,7 +285,7 @@ HRESULT swapchain_init(IDirect3DSwapChain9Impl *swapchain, IDirect3DDevice9Impl return hr; } - swapchain->parentDevice = (IDirect3DDevice9Ex *)device; + swapchain->parentDevice = &device->IDirect3DDevice9Ex_iface; IDirect3DDevice9Ex_AddRef(swapchain->parentDevice); return D3D_OK; diff --git a/dll/directx/wine/d3d9/texture.c b/dll/directx/wine/d3d9/texture.c index dbe9798ab64..d1df0f5ee7b 100644 --- a/dll/directx/wine/d3d9/texture.c +++ b/dll/directx/wine/d3d9/texture.c @@ -25,9 +25,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d9); -/* IDirect3DTexture9 IUnknown parts follow: */ -static HRESULT WINAPI IDirect3DTexture9Impl_QueryInterface(LPDIRECT3DTEXTURE9 iface, REFIID riid, LPVOID* ppobj) { - IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface; +static inline IDirect3DTexture9Impl *impl_from_IDirect3DTexture9(IDirect3DTexture9 *iface) +{ + return CONTAINING_RECORD(iface, IDirect3DTexture9Impl, IDirect3DTexture9_iface); +} + +static HRESULT WINAPI IDirect3DTexture9Impl_QueryInterface(IDirect3DTexture9 *iface, REFIID riid, + void **ppobj) +{ + IDirect3DTexture9Impl *This = impl_from_IDirect3DTexture9(iface); TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), ppobj); @@ -45,8 +51,9 @@ static HRESULT WINAPI IDirect3DTexture9Impl_QueryInterface(LPDIRECT3DTEXTURE9 if return E_NOINTERFACE; } -static ULONG WINAPI IDirect3DTexture9Impl_AddRef(LPDIRECT3DTEXTURE9 iface) { - IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface; +static ULONG WINAPI IDirect3DTexture9Impl_AddRef(IDirect3DTexture9 *iface) +{ + IDirect3DTexture9Impl *This = impl_from_IDirect3DTexture9(iface); ULONG ref = InterlockedIncrement(&This->ref); TRACE("%p increasing refcount to %u.\n", iface, ref); @@ -55,15 +62,16 @@ static ULONG WINAPI IDirect3DTexture9Impl_AddRef(LPDIRECT3DTEXTURE9 iface) { { IDirect3DDevice9Ex_AddRef(This->parentDevice); wined3d_mutex_lock(); - IWineD3DTexture_AddRef(This->wineD3DTexture); + wined3d_texture_incref(This->wined3d_texture); wined3d_mutex_unlock(); } return ref; } -static ULONG WINAPI IDirect3DTexture9Impl_Release(LPDIRECT3DTEXTURE9 iface) { - IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface; +static ULONG WINAPI IDirect3DTexture9Impl_Release(IDirect3DTexture9 *iface) +{ + IDirect3DTexture9Impl *This = impl_from_IDirect3DTexture9(iface); ULONG ref = InterlockedDecrement(&This->ref); TRACE("%p decreasing refcount to %u.\n", iface, ref); @@ -72,7 +80,7 @@ static ULONG WINAPI IDirect3DTexture9Impl_Release(LPDIRECT3DTEXTURE9 iface) { IDirect3DDevice9Ex *parentDevice = This->parentDevice; wined3d_mutex_lock(); - IWineD3DTexture_Release(This->wineD3DTexture); + wined3d_texture_decref(This->wined3d_texture); wined3d_mutex_unlock(); /* Release the device last, as it may cause the device to be destroyed. */ @@ -81,10 +89,10 @@ static ULONG WINAPI IDirect3DTexture9Impl_Release(LPDIRECT3DTEXTURE9 iface) { return ref; } -/* IDirect3DTexture9 IDirect3DResource9 Interface follow: */ -static HRESULT WINAPI IDirect3DTexture9Impl_GetDevice(IDirect3DTexture9 *iface, IDirect3DDevice9 **device) +static HRESULT WINAPI IDirect3DTexture9Impl_GetDevice(IDirect3DTexture9 *iface, + IDirect3DDevice9 **device) { - IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface; + IDirect3DTexture9Impl *This = impl_from_IDirect3DTexture9(iface); TRACE("iface %p, device %p.\n", iface, device); @@ -96,256 +104,305 @@ static HRESULT WINAPI IDirect3DTexture9Impl_GetDevice(IDirect3DTexture9 *iface, return D3D_OK; } -static HRESULT WINAPI IDirect3DTexture9Impl_SetPrivateData(LPDIRECT3DTEXTURE9 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) { - IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface; +static HRESULT WINAPI IDirect3DTexture9Impl_SetPrivateData(IDirect3DTexture9 *iface, + REFGUID refguid, const void *pData, DWORD SizeOfData, DWORD Flags) +{ + IDirect3DTexture9Impl *This = impl_from_IDirect3DTexture9(iface); HRESULT hr; TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n", iface, debugstr_guid(refguid), pData, SizeOfData, Flags); wined3d_mutex_lock(); - hr = IWineD3DTexture_SetPrivateData(This->wineD3DTexture, refguid, pData, SizeOfData, Flags); + hr = wined3d_texture_set_private_data(This->wined3d_texture, refguid, pData, SizeOfData, Flags); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DTexture9Impl_GetPrivateData(LPDIRECT3DTEXTURE9 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) { - IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface; +static HRESULT WINAPI IDirect3DTexture9Impl_GetPrivateData(IDirect3DTexture9 *iface, + REFGUID refguid, void *pData, DWORD *pSizeOfData) +{ + IDirect3DTexture9Impl *This = impl_from_IDirect3DTexture9(iface); HRESULT hr; TRACE("iface %p, guid %s, data %p, data_size %p.\n", iface, debugstr_guid(refguid), pData, pSizeOfData); wined3d_mutex_lock(); - hr = IWineD3DTexture_GetPrivateData(This->wineD3DTexture, refguid, pData, pSizeOfData); + hr = wined3d_texture_get_private_data(This->wined3d_texture, refguid, pData, pSizeOfData); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DTexture9Impl_FreePrivateData(LPDIRECT3DTEXTURE9 iface, REFGUID refguid) { - IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface; +static HRESULT WINAPI IDirect3DTexture9Impl_FreePrivateData(IDirect3DTexture9 *iface, + REFGUID refguid) +{ + IDirect3DTexture9Impl *This = impl_from_IDirect3DTexture9(iface); HRESULT hr; TRACE("iface %p, guid %s.\n", iface, debugstr_guid(refguid)); wined3d_mutex_lock(); - hr = IWineD3DTexture_FreePrivateData(This->wineD3DTexture, refguid); + hr = wined3d_texture_free_private_data(This->wined3d_texture, refguid); wined3d_mutex_unlock(); return hr; } -static DWORD WINAPI IDirect3DTexture9Impl_SetPriority(LPDIRECT3DTEXTURE9 iface, DWORD PriorityNew) { - IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface; +static DWORD WINAPI IDirect3DTexture9Impl_SetPriority(IDirect3DTexture9 *iface, DWORD PriorityNew) +{ + IDirect3DTexture9Impl *This = impl_from_IDirect3DTexture9(iface); DWORD ret; TRACE("iface %p, priority %u.\n", iface, PriorityNew); wined3d_mutex_lock(); - ret = IWineD3DTexture_SetPriority(This->wineD3DTexture, PriorityNew); + ret = wined3d_texture_set_priority(This->wined3d_texture, PriorityNew); wined3d_mutex_unlock(); return ret; } -static DWORD WINAPI IDirect3DTexture9Impl_GetPriority(LPDIRECT3DTEXTURE9 iface) { - IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface; +static DWORD WINAPI IDirect3DTexture9Impl_GetPriority(IDirect3DTexture9 *iface) +{ + IDirect3DTexture9Impl *This = impl_from_IDirect3DTexture9(iface); DWORD ret; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - ret = IWineD3DTexture_GetPriority(This->wineD3DTexture); + ret = wined3d_texture_get_priority(This->wined3d_texture); wined3d_mutex_unlock(); return ret; } -static void WINAPI IDirect3DTexture9Impl_PreLoad(LPDIRECT3DTEXTURE9 iface) { - IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface; +static void WINAPI IDirect3DTexture9Impl_PreLoad(IDirect3DTexture9 *iface) +{ + IDirect3DTexture9Impl *This = impl_from_IDirect3DTexture9(iface); TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - IWineD3DTexture_PreLoad(This->wineD3DTexture); + wined3d_texture_preload(This->wined3d_texture); wined3d_mutex_unlock(); } -static D3DRESOURCETYPE WINAPI IDirect3DTexture9Impl_GetType(LPDIRECT3DTEXTURE9 iface) { - IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface; +static D3DRESOURCETYPE WINAPI IDirect3DTexture9Impl_GetType(IDirect3DTexture9 *iface) +{ + IDirect3DTexture9Impl *This = impl_from_IDirect3DTexture9(iface); HRESULT ret; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - ret = IWineD3DTexture_GetType(This->wineD3DTexture); + ret = wined3d_texture_get_type(This->wined3d_texture); wined3d_mutex_unlock(); return ret; } /* IDirect3DTexture9 IDirect3DBaseTexture9 Interface follow: */ -static DWORD WINAPI IDirect3DTexture9Impl_SetLOD(LPDIRECT3DTEXTURE9 iface, DWORD LODNew) { - IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface; +static DWORD WINAPI IDirect3DTexture9Impl_SetLOD(IDirect3DTexture9 *iface, DWORD LODNew) +{ + IDirect3DTexture9Impl *This = impl_from_IDirect3DTexture9(iface); DWORD ret; TRACE("iface %p, lod %u.\n", iface, LODNew); wined3d_mutex_lock(); - ret = IWineD3DTexture_SetLOD(This->wineD3DTexture, LODNew); + ret = wined3d_texture_set_lod(This->wined3d_texture, LODNew); wined3d_mutex_unlock(); return ret; } -static DWORD WINAPI IDirect3DTexture9Impl_GetLOD(LPDIRECT3DTEXTURE9 iface) { - IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface; +static DWORD WINAPI IDirect3DTexture9Impl_GetLOD(IDirect3DTexture9 *iface) +{ + IDirect3DTexture9Impl *This = impl_from_IDirect3DTexture9(iface); DWORD ret; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - ret = IWineD3DTexture_GetLOD(This->wineD3DTexture); + ret = wined3d_texture_get_lod(This->wined3d_texture); wined3d_mutex_unlock(); return ret; } -static DWORD WINAPI IDirect3DTexture9Impl_GetLevelCount(LPDIRECT3DTEXTURE9 iface) { - IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface; +static DWORD WINAPI IDirect3DTexture9Impl_GetLevelCount(IDirect3DTexture9 *iface) +{ + IDirect3DTexture9Impl *This = impl_from_IDirect3DTexture9(iface); DWORD ret; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - ret = IWineD3DTexture_GetLevelCount(This->wineD3DTexture); + ret = wined3d_texture_get_level_count(This->wined3d_texture); wined3d_mutex_unlock(); return ret; } -static HRESULT WINAPI IDirect3DTexture9Impl_SetAutoGenFilterType(LPDIRECT3DTEXTURE9 iface, D3DTEXTUREFILTERTYPE FilterType) { - IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface; +static HRESULT WINAPI IDirect3DTexture9Impl_SetAutoGenFilterType(IDirect3DTexture9 *iface, + D3DTEXTUREFILTERTYPE FilterType) +{ + IDirect3DTexture9Impl *This = impl_from_IDirect3DTexture9(iface); HRESULT hr; TRACE("iface %p, filter_type %#x.\n", iface, FilterType); wined3d_mutex_lock(); - hr = IWineD3DTexture_SetAutoGenFilterType(This->wineD3DTexture, (WINED3DTEXTUREFILTERTYPE) FilterType); + hr = wined3d_texture_set_autogen_filter_type(This->wined3d_texture, (WINED3DTEXTUREFILTERTYPE)FilterType); wined3d_mutex_unlock(); return hr; } -static D3DTEXTUREFILTERTYPE WINAPI IDirect3DTexture9Impl_GetAutoGenFilterType(LPDIRECT3DTEXTURE9 iface) { - IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface; +static D3DTEXTUREFILTERTYPE WINAPI IDirect3DTexture9Impl_GetAutoGenFilterType(IDirect3DTexture9 *iface) +{ + IDirect3DTexture9Impl *This = impl_from_IDirect3DTexture9(iface); D3DTEXTUREFILTERTYPE ret; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - ret = (D3DTEXTUREFILTERTYPE) IWineD3DTexture_GetAutoGenFilterType(This->wineD3DTexture); + ret = (D3DTEXTUREFILTERTYPE)wined3d_texture_get_autogen_filter_type(This->wined3d_texture); wined3d_mutex_unlock(); return ret; } -static void WINAPI IDirect3DTexture9Impl_GenerateMipSubLevels(LPDIRECT3DTEXTURE9 iface) { - IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface; +static void WINAPI IDirect3DTexture9Impl_GenerateMipSubLevels(IDirect3DTexture9 *iface) +{ + IDirect3DTexture9Impl *This = impl_from_IDirect3DTexture9(iface); TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - IWineD3DTexture_GenerateMipSubLevels(This->wineD3DTexture); + wined3d_texture_generate_mipmaps(This->wined3d_texture); wined3d_mutex_unlock(); } -/* IDirect3DTexture9 Interface follow: */ -static HRESULT WINAPI IDirect3DTexture9Impl_GetLevelDesc(LPDIRECT3DTEXTURE9 iface, UINT Level, D3DSURFACE_DESC* pDesc) { - IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface; - WINED3DSURFACE_DESC wined3ddesc; - HRESULT hr; +static HRESULT WINAPI IDirect3DTexture9Impl_GetLevelDesc(IDirect3DTexture9 *iface, + UINT level, D3DSURFACE_DESC *desc) +{ + IDirect3DTexture9Impl *texture = impl_from_IDirect3DTexture9(iface); + struct wined3d_resource *sub_resource; + HRESULT hr = D3D_OK; - TRACE("iface %p, level %u, desc %p.\n", iface, Level, pDesc); + TRACE("iface %p, level %u, desc %p.\n", iface, level, desc); wined3d_mutex_lock(); - hr = IWineD3DTexture_GetLevelDesc(This->wineD3DTexture, Level, &wined3ddesc); - wined3d_mutex_unlock(); - - if (SUCCEEDED(hr)) + if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, level))) + hr = D3DERR_INVALIDCALL; + else { - pDesc->Format = d3dformat_from_wined3dformat(wined3ddesc.format); - pDesc->Type = wined3ddesc.resource_type; - pDesc->Usage = wined3ddesc.usage; - pDesc->Pool = wined3ddesc.pool; - pDesc->MultiSampleType = wined3ddesc.multisample_type; - pDesc->MultiSampleQuality = wined3ddesc.multisample_quality; - pDesc->Width = wined3ddesc.width; - pDesc->Height = wined3ddesc.height; + struct wined3d_resource_desc wined3d_desc; + + wined3d_resource_get_desc(sub_resource, &wined3d_desc); + desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format); + desc->Type = wined3d_desc.resource_type; + desc->Usage = wined3d_desc.usage; + desc->Pool = wined3d_desc.pool; + desc->MultiSampleType = wined3d_desc.multisample_type; + desc->MultiSampleQuality = wined3d_desc.multisample_quality; + desc->Width = wined3d_desc.width; + desc->Height = wined3d_desc.height; } + wined3d_mutex_unlock(); return hr; } static HRESULT WINAPI IDirect3DTexture9Impl_GetSurfaceLevel(IDirect3DTexture9 *iface, - UINT Level, IDirect3DSurface9 **ppSurfaceLevel) + UINT level, IDirect3DSurface9 **surface) { - IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface; - IWineD3DSurface *mySurface = NULL; - HRESULT hr; + IDirect3DTexture9Impl *texture = impl_from_IDirect3DTexture9(iface); + struct wined3d_resource *sub_resource; - TRACE("iface %p, level %u, surface %p.\n", iface, Level, ppSurfaceLevel); + TRACE("iface %p, level %u, surface %p.\n", iface, level, surface); wined3d_mutex_lock(); - hr = IWineD3DTexture_GetSurfaceLevel(This->wineD3DTexture, Level, &mySurface); - if (SUCCEEDED(hr) && ppSurfaceLevel) + if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, level))) { - *ppSurfaceLevel = IWineD3DSurface_GetParent(mySurface); - IDirect3DSurface9_AddRef(*ppSurfaceLevel); - IWineD3DSurface_Release(mySurface); + wined3d_mutex_unlock(); + return D3DERR_INVALIDCALL; } + + *surface = wined3d_resource_get_parent(sub_resource); + IDirect3DSurface9_AddRef(*surface); wined3d_mutex_unlock(); - return hr; + return D3D_OK; } -static HRESULT WINAPI IDirect3DTexture9Impl_LockRect(LPDIRECT3DTEXTURE9 iface, UINT Level, D3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags) { - IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface; +static HRESULT WINAPI IDirect3DTexture9Impl_LockRect(IDirect3DTexture9 *iface, + UINT level, D3DLOCKED_RECT *locked_rect, const RECT *rect, DWORD flags) +{ + IDirect3DTexture9Impl *texture = impl_from_IDirect3DTexture9(iface); + struct wined3d_resource *sub_resource; HRESULT hr; TRACE("iface %p, level %u, locked_rect %p, rect %p, flags %#x.\n", - iface, Level, pLockedRect, pRect, Flags); + iface, level, locked_rect, rect, flags); wined3d_mutex_lock(); - hr = IWineD3DTexture_LockRect(This->wineD3DTexture, Level, (WINED3DLOCKED_RECT *) pLockedRect, pRect, Flags); + if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, level))) + hr = D3DERR_INVALIDCALL; + else + hr = IDirect3DSurface9_LockRect((IDirect3DSurface9 *)wined3d_resource_get_parent(sub_resource), + locked_rect, rect, flags); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DTexture9Impl_UnlockRect(LPDIRECT3DTEXTURE9 iface, UINT Level) { - IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface; +static HRESULT WINAPI IDirect3DTexture9Impl_UnlockRect(IDirect3DTexture9 *iface, UINT level) +{ + IDirect3DTexture9Impl *texture = impl_from_IDirect3DTexture9(iface); + struct wined3d_resource *sub_resource; HRESULT hr; - TRACE("iface %p, level %u.\n", iface, Level); + TRACE("iface %p, level %u.\n", iface, level); wined3d_mutex_lock(); - hr = IWineD3DTexture_UnlockRect(This->wineD3DTexture, Level); + if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, level))) + hr = D3DERR_INVALIDCALL; + else + hr = IDirect3DSurface9_UnlockRect((IDirect3DSurface9 *)wined3d_resource_get_parent(sub_resource)); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DTexture9Impl_AddDirtyRect(LPDIRECT3DTEXTURE9 iface, CONST RECT* pDirtyRect) { - IDirect3DTexture9Impl *This = (IDirect3DTexture9Impl *)iface; +static HRESULT WINAPI IDirect3DTexture9Impl_AddDirtyRect(IDirect3DTexture9 *iface, + const RECT *dirty_rect) +{ + IDirect3DTexture9Impl *texture = impl_from_IDirect3DTexture9(iface); HRESULT hr; - TRACE("iface %p, dirty_rect %p.\n", iface, pDirtyRect); + TRACE("iface %p, dirty_rect %s.\n", + iface, wine_dbgstr_rect(dirty_rect)); wined3d_mutex_lock(); - hr = IWineD3DTexture_AddDirtyRect(This->wineD3DTexture, pDirtyRect); + if (!dirty_rect) + hr = wined3d_texture_add_dirty_region(texture->wined3d_texture, 0, NULL); + else + { + WINED3DBOX dirty_region; + + dirty_region.Left = dirty_rect->left; + dirty_region.Top = dirty_rect->top; + dirty_region.Right = dirty_rect->right; + dirty_region.Bottom = dirty_rect->bottom; + dirty_region.Front = 0; + dirty_region.Back = 1; + hr = wined3d_texture_add_dirty_region(texture->wined3d_texture, 0, &dirty_region); + } wined3d_mutex_unlock(); return hr; @@ -396,13 +453,13 @@ HRESULT texture_init(IDirect3DTexture9Impl *texture, IDirect3DDevice9Impl *devic { HRESULT hr; - texture->lpVtbl = &Direct3DTexture9_Vtbl; + texture->IDirect3DTexture9_iface.lpVtbl = &Direct3DTexture9_Vtbl; texture->ref = 1; wined3d_mutex_lock(); - hr = IWineD3DDevice_CreateTexture(device->WineD3DDevice, width, height, levels, + hr = wined3d_texture_create_2d(device->wined3d_device, width, height, levels, usage & WINED3DUSAGE_MASK, wined3dformat_from_d3dformat(format), pool, - texture, &d3d9_texture_wined3d_parent_ops, &texture->wineD3DTexture); + texture, &d3d9_texture_wined3d_parent_ops, &texture->wined3d_texture); wined3d_mutex_unlock(); if (FAILED(hr)) { @@ -410,7 +467,7 @@ HRESULT texture_init(IDirect3DTexture9Impl *texture, IDirect3DDevice9Impl *devic return hr; } - texture->parentDevice = (IDirect3DDevice9Ex *)device; + texture->parentDevice = &device->IDirect3DDevice9Ex_iface; IDirect3DDevice9Ex_AddRef(texture->parentDevice); return D3D_OK; diff --git a/dll/directx/wine/d3d9/vertexdeclaration.c b/dll/directx/wine/d3d9/vertexdeclaration.c index 88f912f1dba..62246147d3c 100644 --- a/dll/directx/wine/d3d9/vertexdeclaration.c +++ b/dll/directx/wine/d3d9/vertexdeclaration.c @@ -222,7 +222,7 @@ static ULONG WINAPI IDirect3DVertexDeclaration9Impl_AddRef(LPDIRECT3DVERTEXDECLA if (!This->convFVF) { wined3d_mutex_lock(); - IWineD3DVertexDeclaration_AddRef(This->wineD3DVertexDeclaration); + wined3d_vertex_declaration_incref(This->wineD3DVertexDeclaration); wined3d_mutex_unlock(); } } @@ -239,7 +239,7 @@ void IDirect3DVertexDeclaration9Impl_Destroy(LPDIRECT3DVERTEXDECLARATION9 iface) } wined3d_mutex_lock(); - IWineD3DVertexDeclaration_Release(This->wineD3DVertexDeclaration); + wined3d_vertex_declaration_decref(This->wineD3DVertexDeclaration); wined3d_mutex_unlock(); } @@ -395,7 +395,7 @@ HRESULT vertexdeclaration_init(IDirect3DVertexDeclaration9Impl *declaration, declaration->element_count = element_count; wined3d_mutex_lock(); - hr = IWineD3DDevice_CreateVertexDeclaration(device->WineD3DDevice, wined3d_elements, wined3d_element_count, + hr = wined3d_vertex_declaration_create(device->wined3d_device, wined3d_elements, wined3d_element_count, declaration, &d3d9_vertexdeclaration_wined3d_parent_ops, &declaration->wineD3DVertexDeclaration); wined3d_mutex_unlock(); HeapFree(GetProcessHeap(), 0, wined3d_elements); @@ -406,7 +406,7 @@ HRESULT vertexdeclaration_init(IDirect3DVertexDeclaration9Impl *declaration, return hr; } - declaration->parentDevice = (IDirect3DDevice9Ex *)device; + declaration->parentDevice = &device->IDirect3DDevice9Ex_iface; IDirect3DDevice9Ex_AddRef(declaration->parentDevice); return D3D_OK; diff --git a/dll/directx/wine/d3d9/volume.c b/dll/directx/wine/d3d9/volume.c index 1ecd2b27d29..ba495b644d0 100644 --- a/dll/directx/wine/d3d9/volume.c +++ b/dll/directx/wine/d3d9/volume.c @@ -24,9 +24,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d9); -/* IDirect3DVolume9 IUnknown parts follow: */ -static HRESULT WINAPI IDirect3DVolume9Impl_QueryInterface(LPDIRECT3DVOLUME9 iface, REFIID riid, LPVOID* ppobj) { - IDirect3DVolume9Impl *This = (IDirect3DVolume9Impl *)iface; +static inline IDirect3DVolume9Impl *impl_from_IDirect3DVolume9(IDirect3DVolume9 *iface) +{ + return CONTAINING_RECORD(iface, IDirect3DVolume9Impl, IDirect3DVolume9_iface); +} + +static HRESULT WINAPI IDirect3DVolume9Impl_QueryInterface(IDirect3DVolume9 *iface, REFIID riid, + void **ppobj) +{ + IDirect3DVolume9Impl *This = impl_from_IDirect3DVolume9(iface); TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), ppobj); @@ -42,8 +48,9 @@ static HRESULT WINAPI IDirect3DVolume9Impl_QueryInterface(LPDIRECT3DVOLUME9 ifac return E_NOINTERFACE; } -static ULONG WINAPI IDirect3DVolume9Impl_AddRef(LPDIRECT3DVOLUME9 iface) { - IDirect3DVolume9Impl *This = (IDirect3DVolume9Impl *)iface; +static ULONG WINAPI IDirect3DVolume9Impl_AddRef(IDirect3DVolume9 *iface) +{ + IDirect3DVolume9Impl *This = impl_from_IDirect3DVolume9(iface); TRACE("iface %p.\n", iface); @@ -60,7 +67,7 @@ static ULONG WINAPI IDirect3DVolume9Impl_AddRef(LPDIRECT3DVOLUME9 iface) { if (ref == 1) { wined3d_mutex_lock(); - IWineD3DVolume_AddRef(This->wineD3DVolume); + wined3d_volume_incref(This->wined3d_volume); wined3d_mutex_unlock(); } @@ -68,8 +75,9 @@ static ULONG WINAPI IDirect3DVolume9Impl_AddRef(LPDIRECT3DVOLUME9 iface) { } } -static ULONG WINAPI IDirect3DVolume9Impl_Release(LPDIRECT3DVOLUME9 iface) { - IDirect3DVolume9Impl *This = (IDirect3DVolume9Impl *)iface; +static ULONG WINAPI IDirect3DVolume9Impl_Release(IDirect3DVolume9 *iface) +{ + IDirect3DVolume9Impl *This = impl_from_IDirect3DVolume9(iface); TRACE("iface %p.\n", iface); @@ -85,7 +93,7 @@ static ULONG WINAPI IDirect3DVolume9Impl_Release(LPDIRECT3DVOLUME9 iface) { if (ref == 0) { wined3d_mutex_lock(); - IWineD3DVolume_Release(This->wineD3DVolume); + wined3d_volume_decref(This->wined3d_volume); wined3d_mutex_unlock(); } @@ -93,10 +101,10 @@ static ULONG WINAPI IDirect3DVolume9Impl_Release(LPDIRECT3DVOLUME9 iface) { } } -/* IDirect3DVolume9 Interface follow: */ -static HRESULT WINAPI IDirect3DVolume9Impl_GetDevice(IDirect3DVolume9 *iface, IDirect3DDevice9 **device) +static HRESULT WINAPI IDirect3DVolume9Impl_GetDevice(IDirect3DVolume9 *iface, + IDirect3DDevice9 **device) { - IDirect3DVolume9Impl *This = (IDirect3DVolume9Impl *)iface; + IDirect3DVolume9Impl *This = impl_from_IDirect3DVolume9(iface); IDirect3DResource9 *resource; HRESULT hr; @@ -114,65 +122,62 @@ static HRESULT WINAPI IDirect3DVolume9Impl_GetDevice(IDirect3DVolume9 *iface, ID return hr; } -static HRESULT WINAPI IDirect3DVolume9Impl_SetPrivateData(LPDIRECT3DVOLUME9 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) { - IDirect3DVolume9Impl *This = (IDirect3DVolume9Impl *)iface; +static HRESULT WINAPI IDirect3DVolume9Impl_SetPrivateData(IDirect3DVolume9 *iface, REFGUID refguid, + const void *pData, DWORD SizeOfData, DWORD Flags) +{ + IDirect3DVolume9Impl *This = impl_from_IDirect3DVolume9(iface); HRESULT hr; TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n", iface, debugstr_guid(refguid), pData, SizeOfData, Flags); wined3d_mutex_lock(); - - hr = IWineD3DVolume_SetPrivateData(This->wineD3DVolume, refguid, pData, SizeOfData, Flags); - + hr = wined3d_volume_set_private_data(This->wined3d_volume, refguid, pData, SizeOfData, Flags); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DVolume9Impl_GetPrivateData(LPDIRECT3DVOLUME9 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) { - IDirect3DVolume9Impl *This = (IDirect3DVolume9Impl *)iface; +static HRESULT WINAPI IDirect3DVolume9Impl_GetPrivateData(IDirect3DVolume9 *iface, REFGUID refguid, + void *pData, DWORD *pSizeOfData) +{ + IDirect3DVolume9Impl *This = impl_from_IDirect3DVolume9(iface); HRESULT hr; TRACE("iface %p, guid %s, data %p, data_size %p.\n", iface, debugstr_guid(refguid), pData, pSizeOfData); wined3d_mutex_lock(); - - hr = IWineD3DVolume_GetPrivateData(This->wineD3DVolume, refguid, pData, pSizeOfData); - + hr = wined3d_volume_get_private_data(This->wined3d_volume, refguid, pData, pSizeOfData); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DVolume9Impl_FreePrivateData(LPDIRECT3DVOLUME9 iface, REFGUID refguid) { - IDirect3DVolume9Impl *This = (IDirect3DVolume9Impl *)iface; +static HRESULT WINAPI IDirect3DVolume9Impl_FreePrivateData(IDirect3DVolume9 *iface, REFGUID refguid) +{ + IDirect3DVolume9Impl *This = impl_from_IDirect3DVolume9(iface); HRESULT hr; TRACE("iface %p, guid %s.\n", iface, debugstr_guid(refguid)); wined3d_mutex_lock(); - - hr = IWineD3DVolume_FreePrivateData(This->wineD3DVolume, refguid); - + hr = wined3d_volume_free_private_data(This->wined3d_volume, refguid); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DVolume9Impl_GetContainer(LPDIRECT3DVOLUME9 iface, REFIID riid, void** ppContainer) { - IDirect3DVolume9Impl *This = (IDirect3DVolume9Impl *)iface; +static HRESULT WINAPI IDirect3DVolume9Impl_GetContainer(IDirect3DVolume9 *iface, REFIID riid, + void **ppContainer) +{ + IDirect3DVolume9Impl *This = impl_from_IDirect3DVolume9(iface); HRESULT res; TRACE("iface %p, riid %s, container %p.\n", iface, debugstr_guid(riid), ppContainer); if (!This->container) return E_NOINTERFACE; - if (!ppContainer) { - ERR("Called without a valid ppContainer.\n"); - } - res = IUnknown_QueryInterface(This->container, riid, ppContainer); TRACE("Returning ppContainer %p, *ppContainer %p\n", ppContainer, *ppContainer); @@ -180,56 +185,56 @@ static HRESULT WINAPI IDirect3DVolume9Impl_GetContainer(LPDIRECT3DVOLUME9 iface, return res; } -static HRESULT WINAPI IDirect3DVolume9Impl_GetDesc(LPDIRECT3DVOLUME9 iface, D3DVOLUME_DESC* pDesc) { - IDirect3DVolume9Impl *This = (IDirect3DVolume9Impl *)iface; - WINED3DVOLUME_DESC wined3ddesc; +static HRESULT WINAPI IDirect3DVolume9Impl_GetDesc(IDirect3DVolume9 *iface, D3DVOLUME_DESC *desc) +{ + IDirect3DVolume9Impl *This = impl_from_IDirect3DVolume9(iface); + struct wined3d_resource_desc wined3d_desc; + struct wined3d_resource *wined3d_resource; - TRACE("iface %p, desc %p.\n", iface, pDesc); + TRACE("iface %p, desc %p.\n", iface, desc); wined3d_mutex_lock(); - - IWineD3DVolume_GetDesc(This->wineD3DVolume, &wined3ddesc); - + wined3d_resource = wined3d_volume_get_resource(This->wined3d_volume); + wined3d_resource_get_desc(wined3d_resource, &wined3d_desc); wined3d_mutex_unlock(); - pDesc->Format = d3dformat_from_wined3dformat(wined3ddesc.Format); - pDesc->Type = wined3ddesc.Type; - pDesc->Usage = wined3ddesc.Usage; - pDesc->Pool = wined3ddesc.Pool; - pDesc->Width = wined3ddesc.Width; - pDesc->Height = wined3ddesc.Height; - pDesc->Depth = wined3ddesc.Depth; + desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format); + desc->Type = wined3d_desc.resource_type; + desc->Usage = wined3d_desc.usage; + desc->Pool = wined3d_desc.pool; + desc->Width = wined3d_desc.width; + desc->Height = wined3d_desc.height; + desc->Depth = wined3d_desc.depth; return D3D_OK; } -static HRESULT WINAPI IDirect3DVolume9Impl_LockBox(LPDIRECT3DVOLUME9 iface, D3DLOCKED_BOX* pLockedVolume, CONST D3DBOX* pBox, DWORD Flags) { - IDirect3DVolume9Impl *This = (IDirect3DVolume9Impl *)iface; +static HRESULT WINAPI IDirect3DVolume9Impl_LockBox(IDirect3DVolume9 *iface, + D3DLOCKED_BOX *pLockedVolume, const D3DBOX *pBox, DWORD Flags) +{ + IDirect3DVolume9Impl *This = impl_from_IDirect3DVolume9(iface); HRESULT hr; TRACE("iface %p, locked_box %p, box %p, flags %#x.\n", iface, pLockedVolume, pBox, Flags); wined3d_mutex_lock(); - - hr = IWineD3DVolume_LockBox(This->wineD3DVolume, (WINED3DLOCKED_BOX *)pLockedVolume, + hr = wined3d_volume_map(This->wined3d_volume, (WINED3DLOCKED_BOX *)pLockedVolume, (const WINED3DBOX *)pBox, Flags); - wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DVolume9Impl_UnlockBox(LPDIRECT3DVOLUME9 iface) { - IDirect3DVolume9Impl *This = (IDirect3DVolume9Impl *)iface; +static HRESULT WINAPI IDirect3DVolume9Impl_UnlockBox(IDirect3DVolume9 *iface) +{ + IDirect3DVolume9Impl *This = impl_from_IDirect3DVolume9(iface); HRESULT hr; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - - hr = IWineD3DVolume_UnlockBox(This->wineD3DVolume); - + hr = wined3d_volume_unmap(This->wined3d_volume); wined3d_mutex_unlock(); return hr; @@ -267,11 +272,11 @@ HRESULT volume_init(IDirect3DVolume9Impl *volume, IDirect3DDevice9Impl *device, { HRESULT hr; - volume->lpVtbl = &Direct3DVolume9_Vtbl; + volume->IDirect3DVolume9_iface.lpVtbl = &Direct3DVolume9_Vtbl; volume->ref = 1; - hr = IWineD3DDevice_CreateVolume(device->WineD3DDevice, width, height, depth, usage & WINED3DUSAGE_MASK, - format, pool, volume, &d3d9_volume_wined3d_parent_ops, &volume->wineD3DVolume); + hr = wined3d_volume_create(device->wined3d_device, width, height, depth, usage & WINED3DUSAGE_MASK, + format, pool, volume, &d3d9_volume_wined3d_parent_ops, &volume->wined3d_volume); if (FAILED(hr)) { WARN("Failed to create wined3d volume, hr %#x.\n", hr); diff --git a/dll/directx/wine/d3d9/volumetexture.c b/dll/directx/wine/d3d9/volumetexture.c index 7ce46237cc3..9528e9b8dd5 100644 --- a/dll/directx/wine/d3d9/volumetexture.c +++ b/dll/directx/wine/d3d9/volumetexture.c @@ -24,9 +24,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d9); -/* IDirect3DVolumeTexture9 IUnknown parts follow: */ -static HRESULT WINAPI IDirect3DVolumeTexture9Impl_QueryInterface(LPDIRECT3DVOLUMETEXTURE9 iface, REFIID riid, LPVOID* ppobj) { - IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; +static inline IDirect3DVolumeTexture9Impl *impl_from_IDirect3DVolumeTexture9(IDirect3DVolumeTexture9 *iface) +{ + return CONTAINING_RECORD(iface, IDirect3DVolumeTexture9Impl, IDirect3DVolumeTexture9_iface); +} + +static HRESULT WINAPI IDirect3DVolumeTexture9Impl_QueryInterface(IDirect3DVolumeTexture9 *iface, + REFIID riid, void **ppobj) +{ + IDirect3DVolumeTexture9Impl *This = impl_from_IDirect3DVolumeTexture9(iface); TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), ppobj); @@ -44,8 +50,9 @@ static HRESULT WINAPI IDirect3DVolumeTexture9Impl_QueryInterface(LPDIRECT3DVOLUM return E_NOINTERFACE; } -static ULONG WINAPI IDirect3DVolumeTexture9Impl_AddRef(LPDIRECT3DVOLUMETEXTURE9 iface) { - IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; +static ULONG WINAPI IDirect3DVolumeTexture9Impl_AddRef(IDirect3DVolumeTexture9 *iface) +{ + IDirect3DVolumeTexture9Impl *This = impl_from_IDirect3DVolumeTexture9(iface); ULONG ref = InterlockedIncrement(&This->ref); TRACE("%p increasing refcount to %u.\n", iface, ref); @@ -54,15 +61,16 @@ static ULONG WINAPI IDirect3DVolumeTexture9Impl_AddRef(LPDIRECT3DVOLUMETEXTURE9 { IDirect3DDevice9Ex_AddRef(This->parentDevice); wined3d_mutex_lock(); - IWineD3DVolumeTexture_AddRef(This->wineD3DVolumeTexture); + wined3d_texture_incref(This->wined3d_texture); wined3d_mutex_unlock(); } return ref; } -static ULONG WINAPI IDirect3DVolumeTexture9Impl_Release(LPDIRECT3DVOLUMETEXTURE9 iface) { - IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; +static ULONG WINAPI IDirect3DVolumeTexture9Impl_Release(IDirect3DVolumeTexture9 *iface) +{ + IDirect3DVolumeTexture9Impl *This = impl_from_IDirect3DVolumeTexture9(iface); ULONG ref = InterlockedDecrement(&This->ref); TRACE("%p decreasing refcount to %u.\n", iface, ref); @@ -71,7 +79,7 @@ static ULONG WINAPI IDirect3DVolumeTexture9Impl_Release(LPDIRECT3DVOLUMETEXTURE9 IDirect3DDevice9Ex *parentDevice = This->parentDevice; wined3d_mutex_lock(); - IWineD3DVolumeTexture_Release(This->wineD3DVolumeTexture); + wined3d_texture_decref(This->wined3d_texture); wined3d_mutex_unlock(); /* Release the device last, as it may cause the device to be destroyed. */ @@ -80,10 +88,10 @@ static ULONG WINAPI IDirect3DVolumeTexture9Impl_Release(LPDIRECT3DVOLUMETEXTURE9 return ref; } -/* IDirect3DVolumeTexture9 IDirect3DResource9 Interface follow: */ -static HRESULT WINAPI IDirect3DVolumeTexture9Impl_GetDevice(IDirect3DVolumeTexture9 *iface, IDirect3DDevice9 **device) +static HRESULT WINAPI IDirect3DVolumeTexture9Impl_GetDevice(IDirect3DVolumeTexture9 *iface, + IDirect3DDevice9 **device) { - IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; + IDirect3DVolumeTexture9Impl *This = impl_from_IDirect3DVolumeTexture9(iface); TRACE("iface %p, device %p.\n", iface, device); @@ -95,292 +103,291 @@ static HRESULT WINAPI IDirect3DVolumeTexture9Impl_GetDevice(IDirect3DVolumeTextu return D3D_OK; } -static HRESULT WINAPI IDirect3DVolumeTexture9Impl_SetPrivateData(LPDIRECT3DVOLUMETEXTURE9 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) { - IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; +static HRESULT WINAPI IDirect3DVolumeTexture9Impl_SetPrivateData(IDirect3DVolumeTexture9 *iface, + REFGUID refguid, const void *pData, DWORD SizeOfData, DWORD Flags) +{ + IDirect3DVolumeTexture9Impl *This = impl_from_IDirect3DVolumeTexture9(iface); HRESULT hr; TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n", iface, debugstr_guid(refguid), pData, SizeOfData, Flags); wined3d_mutex_lock(); - - hr = IWineD3DVolumeTexture_SetPrivateData(This->wineD3DVolumeTexture, refguid, pData, SizeOfData, Flags); - + hr = wined3d_texture_set_private_data(This->wined3d_texture, refguid, pData, SizeOfData, Flags); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DVolumeTexture9Impl_GetPrivateData(LPDIRECT3DVOLUMETEXTURE9 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) { - IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; +static HRESULT WINAPI IDirect3DVolumeTexture9Impl_GetPrivateData(IDirect3DVolumeTexture9 *iface, + REFGUID refguid, void *pData, DWORD *pSizeOfData) +{ + IDirect3DVolumeTexture9Impl *This = impl_from_IDirect3DVolumeTexture9(iface); HRESULT hr; TRACE("iface %p, guid %s, data %p, data_size %p.\n", iface, debugstr_guid(refguid), pData, pSizeOfData); wined3d_mutex_lock(); - - hr = IWineD3DVolumeTexture_GetPrivateData(This->wineD3DVolumeTexture, refguid, pData, pSizeOfData); - + hr = wined3d_texture_get_private_data(This->wined3d_texture, refguid, pData, pSizeOfData); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DVolumeTexture9Impl_FreePrivateData(LPDIRECT3DVOLUMETEXTURE9 iface, REFGUID refguid) { - IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; +static HRESULT WINAPI IDirect3DVolumeTexture9Impl_FreePrivateData(IDirect3DVolumeTexture9 *iface, + REFGUID refguid) +{ + IDirect3DVolumeTexture9Impl *This = impl_from_IDirect3DVolumeTexture9(iface); HRESULT hr; TRACE("iface %p, guid %s.\n", iface, debugstr_guid(refguid)); wined3d_mutex_lock(); - - hr = IWineD3DVolumeTexture_FreePrivateData(This->wineD3DVolumeTexture, refguid); - + hr = wined3d_texture_free_private_data(This->wined3d_texture, refguid); wined3d_mutex_unlock(); return hr; } -static DWORD WINAPI IDirect3DVolumeTexture9Impl_SetPriority(LPDIRECT3DVOLUMETEXTURE9 iface, DWORD PriorityNew) { - IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; +static DWORD WINAPI IDirect3DVolumeTexture9Impl_SetPriority(IDirect3DVolumeTexture9 *iface, + DWORD PriorityNew) +{ + IDirect3DVolumeTexture9Impl *This = impl_from_IDirect3DVolumeTexture9(iface); DWORD priority; TRACE("iface %p, priority %u.\n", iface, PriorityNew); wined3d_mutex_lock(); - - priority = IWineD3DVolumeTexture_SetPriority(This->wineD3DVolumeTexture, PriorityNew); - + priority = wined3d_texture_set_priority(This->wined3d_texture, PriorityNew); wined3d_mutex_unlock(); return priority; } -static DWORD WINAPI IDirect3DVolumeTexture9Impl_GetPriority(LPDIRECT3DVOLUMETEXTURE9 iface) { - IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; +static DWORD WINAPI IDirect3DVolumeTexture9Impl_GetPriority(IDirect3DVolumeTexture9 *iface) +{ + IDirect3DVolumeTexture9Impl *This = impl_from_IDirect3DVolumeTexture9(iface); DWORD priority; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - - priority = IWineD3DVolumeTexture_GetPriority(This->wineD3DVolumeTexture); - + priority = wined3d_texture_get_priority(This->wined3d_texture); wined3d_mutex_unlock(); return priority; } -static void WINAPI IDirect3DVolumeTexture9Impl_PreLoad(LPDIRECT3DVOLUMETEXTURE9 iface) { - IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; +static void WINAPI IDirect3DVolumeTexture9Impl_PreLoad(IDirect3DVolumeTexture9 *iface) +{ + IDirect3DVolumeTexture9Impl *This = impl_from_IDirect3DVolumeTexture9(iface); TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - - IWineD3DVolumeTexture_PreLoad(This->wineD3DVolumeTexture); - + wined3d_texture_preload(This->wined3d_texture); wined3d_mutex_unlock(); } -static D3DRESOURCETYPE WINAPI IDirect3DVolumeTexture9Impl_GetType(LPDIRECT3DVOLUMETEXTURE9 iface) { - IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; +static D3DRESOURCETYPE WINAPI IDirect3DVolumeTexture9Impl_GetType(IDirect3DVolumeTexture9 *iface) +{ + IDirect3DVolumeTexture9Impl *This = impl_from_IDirect3DVolumeTexture9(iface); D3DRESOURCETYPE type; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - - type = IWineD3DVolumeTexture_GetType(This->wineD3DVolumeTexture); - + type = wined3d_texture_get_type(This->wined3d_texture); wined3d_mutex_unlock(); return type; } -/* IDirect3DVolumeTexture9 IDirect3DBaseTexture9 Interface follow: */ -static DWORD WINAPI IDirect3DVolumeTexture9Impl_SetLOD(LPDIRECT3DVOLUMETEXTURE9 iface, DWORD LODNew) { - IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; +static DWORD WINAPI IDirect3DVolumeTexture9Impl_SetLOD(IDirect3DVolumeTexture9 *iface, DWORD LODNew) +{ + IDirect3DVolumeTexture9Impl *This = impl_from_IDirect3DVolumeTexture9(iface); DWORD lod; TRACE("iface %p, lod %u.\n", iface, LODNew); wined3d_mutex_lock(); - - lod = IWineD3DVolumeTexture_SetLOD(This->wineD3DVolumeTexture, LODNew); - + lod = wined3d_texture_set_lod(This->wined3d_texture, LODNew); wined3d_mutex_unlock(); return lod; } -static DWORD WINAPI IDirect3DVolumeTexture9Impl_GetLOD(LPDIRECT3DVOLUMETEXTURE9 iface) { - IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; +static DWORD WINAPI IDirect3DVolumeTexture9Impl_GetLOD(IDirect3DVolumeTexture9 *iface) +{ + IDirect3DVolumeTexture9Impl *This = impl_from_IDirect3DVolumeTexture9(iface); DWORD lod; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - - lod = IWineD3DVolumeTexture_GetLOD(This->wineD3DVolumeTexture); - + lod = wined3d_texture_get_lod(This->wined3d_texture); wined3d_mutex_unlock(); return lod; } -static DWORD WINAPI IDirect3DVolumeTexture9Impl_GetLevelCount(LPDIRECT3DVOLUMETEXTURE9 iface) { - IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; +static DWORD WINAPI IDirect3DVolumeTexture9Impl_GetLevelCount(IDirect3DVolumeTexture9 *iface) +{ + IDirect3DVolumeTexture9Impl *This = impl_from_IDirect3DVolumeTexture9(iface); DWORD level_count; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - - level_count = IWineD3DVolumeTexture_GetLevelCount(This->wineD3DVolumeTexture); - + level_count = wined3d_texture_get_level_count(This->wined3d_texture); wined3d_mutex_unlock(); return level_count; } -static HRESULT WINAPI IDirect3DVolumeTexture9Impl_SetAutoGenFilterType(LPDIRECT3DVOLUMETEXTURE9 iface, D3DTEXTUREFILTERTYPE FilterType) { - IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; +static HRESULT WINAPI IDirect3DVolumeTexture9Impl_SetAutoGenFilterType(IDirect3DVolumeTexture9 *iface, + D3DTEXTUREFILTERTYPE FilterType) +{ + IDirect3DVolumeTexture9Impl *This = impl_from_IDirect3DVolumeTexture9(iface); HRESULT hr; TRACE("iface %p, filter_type %#x.\n", iface, FilterType); wined3d_mutex_lock(); - - hr = IWineD3DVolumeTexture_SetAutoGenFilterType(This->wineD3DVolumeTexture, (WINED3DTEXTUREFILTERTYPE) FilterType); - + hr = wined3d_texture_set_autogen_filter_type(This->wined3d_texture, (WINED3DTEXTUREFILTERTYPE)FilterType); wined3d_mutex_unlock(); return hr; } -static D3DTEXTUREFILTERTYPE WINAPI IDirect3DVolumeTexture9Impl_GetAutoGenFilterType(LPDIRECT3DVOLUMETEXTURE9 iface) { - IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; +static D3DTEXTUREFILTERTYPE WINAPI IDirect3DVolumeTexture9Impl_GetAutoGenFilterType(IDirect3DVolumeTexture9 *iface) +{ + IDirect3DVolumeTexture9Impl *This = impl_from_IDirect3DVolumeTexture9(iface); D3DTEXTUREFILTERTYPE filter_type; TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - - filter_type = (D3DTEXTUREFILTERTYPE)IWineD3DVolumeTexture_GetAutoGenFilterType(This->wineD3DVolumeTexture); - + filter_type = (D3DTEXTUREFILTERTYPE)wined3d_texture_get_autogen_filter_type(This->wined3d_texture); wined3d_mutex_unlock(); return filter_type; } -static void WINAPI IDirect3DVolumeTexture9Impl_GenerateMipSubLevels(LPDIRECT3DVOLUMETEXTURE9 iface) { - IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; +static void WINAPI IDirect3DVolumeTexture9Impl_GenerateMipSubLevels(IDirect3DVolumeTexture9 *iface) +{ + IDirect3DVolumeTexture9Impl *This = impl_from_IDirect3DVolumeTexture9(iface); TRACE("iface %p.\n", iface); wined3d_mutex_lock(); - - IWineD3DVolumeTexture_GenerateMipSubLevels(This->wineD3DVolumeTexture); - + wined3d_texture_generate_mipmaps(This->wined3d_texture); wined3d_mutex_unlock(); } -/* IDirect3DVolumeTexture9 Interface follow: */ -static HRESULT WINAPI IDirect3DVolumeTexture9Impl_GetLevelDesc(LPDIRECT3DVOLUMETEXTURE9 iface, UINT Level, D3DVOLUME_DESC* pDesc) { - IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; - WINED3DVOLUME_DESC wined3ddesc; - HRESULT hr; +static HRESULT WINAPI IDirect3DVolumeTexture9Impl_GetLevelDesc(IDirect3DVolumeTexture9 *iface, + UINT level, D3DVOLUME_DESC *desc) +{ + IDirect3DVolumeTexture9Impl *texture = impl_from_IDirect3DVolumeTexture9(iface); + struct wined3d_resource *sub_resource; + HRESULT hr = D3D_OK; - TRACE("iface %p, level %u, desc %p.\n", iface, Level, pDesc); + TRACE("iface %p, level %u, desc %p.\n", iface, level, desc); wined3d_mutex_lock(); - - hr = IWineD3DVolumeTexture_GetLevelDesc(This->wineD3DVolumeTexture, Level, &wined3ddesc); - - wined3d_mutex_unlock(); - - if (SUCCEEDED(hr)) + if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, level))) + hr = D3DERR_INVALIDCALL; + else { - pDesc->Format = d3dformat_from_wined3dformat(wined3ddesc.Format); - pDesc->Type = wined3ddesc.Type; - pDesc->Usage = wined3ddesc.Usage; - pDesc->Pool = wined3ddesc.Pool; - pDesc->Width = wined3ddesc.Width; - pDesc->Height = wined3ddesc.Height; - pDesc->Depth = wined3ddesc.Depth; + struct wined3d_resource_desc wined3d_desc; + + wined3d_resource_get_desc(sub_resource, &wined3d_desc); + desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format); + desc->Type = wined3d_desc.resource_type; + desc->Usage = wined3d_desc.usage; + desc->Pool = wined3d_desc.pool; + desc->Width = wined3d_desc.width; + desc->Height = wined3d_desc.height; + desc->Depth = wined3d_desc.depth; } + wined3d_mutex_unlock(); return hr; } static HRESULT WINAPI IDirect3DVolumeTexture9Impl_GetVolumeLevel(IDirect3DVolumeTexture9 *iface, - UINT Level, IDirect3DVolume9 **ppVolumeLevel) + UINT level, IDirect3DVolume9 **volume) { - IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; - IWineD3DVolume *myVolume = NULL; - HRESULT hr; + IDirect3DVolumeTexture9Impl *texture = impl_from_IDirect3DVolumeTexture9(iface); + struct wined3d_resource *sub_resource; - TRACE("iface %p, level %u, volume %p.\n", iface, Level, ppVolumeLevel); + TRACE("iface %p, level %u, volume %p.\n", iface, level, volume); wined3d_mutex_lock(); - - hr = IWineD3DVolumeTexture_GetVolumeLevel(This->wineD3DVolumeTexture, Level, &myVolume); - if (SUCCEEDED(hr) && ppVolumeLevel) + if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, level))) { - *ppVolumeLevel = IWineD3DVolumeTexture_GetParent(myVolume); - IDirect3DVolumeTexture9_AddRef(*ppVolumeLevel); - IWineD3DVolumeTexture_Release(myVolume); + wined3d_mutex_unlock(); + return D3DERR_INVALIDCALL; } + *volume = wined3d_resource_get_parent(sub_resource); + IDirect3DVolume9_AddRef(*volume); wined3d_mutex_unlock(); - return hr; + return D3D_OK; } -static HRESULT WINAPI IDirect3DVolumeTexture9Impl_LockBox(LPDIRECT3DVOLUMETEXTURE9 iface, UINT Level, D3DLOCKED_BOX* pLockedVolume, CONST D3DBOX* pBox, DWORD Flags) { - IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; +static HRESULT WINAPI IDirect3DVolumeTexture9Impl_LockBox(IDirect3DVolumeTexture9 *iface, + UINT level, D3DLOCKED_BOX *locked_box, const D3DBOX *box, DWORD flags) +{ + IDirect3DVolumeTexture9Impl *texture = impl_from_IDirect3DVolumeTexture9(iface); + struct wined3d_resource *sub_resource; HRESULT hr; TRACE("iface %p, level %u, locked_box %p, box %p, flags %#x.\n", - iface, Level, pLockedVolume, pBox, Flags); + iface, level, locked_box, box, flags); wined3d_mutex_lock(); - - hr = IWineD3DVolumeTexture_LockBox(This->wineD3DVolumeTexture, Level, (WINED3DLOCKED_BOX *)pLockedVolume, - (const WINED3DBOX *)pBox, Flags); - + if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, level))) + hr = D3DERR_INVALIDCALL; + else + hr = IDirect3DVolume9_LockBox((IDirect3DVolume9 *)wined3d_resource_get_parent(sub_resource), + locked_box, box, flags); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DVolumeTexture9Impl_UnlockBox(LPDIRECT3DVOLUMETEXTURE9 iface, UINT Level) { - IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; +static HRESULT WINAPI IDirect3DVolumeTexture9Impl_UnlockBox(IDirect3DVolumeTexture9 *iface, + UINT level) +{ + IDirect3DVolumeTexture9Impl *texture = impl_from_IDirect3DVolumeTexture9(iface); + struct wined3d_resource *sub_resource; HRESULT hr; - TRACE("iface %p, level %u.\n", iface, Level); + TRACE("iface %p, level %u.\n", iface, level); wined3d_mutex_lock(); - - hr = IWineD3DVolumeTexture_UnlockBox(This->wineD3DVolumeTexture, Level); - + if (!(sub_resource = wined3d_texture_get_sub_resource(texture->wined3d_texture, level))) + hr = D3DERR_INVALIDCALL; + else + hr = IDirect3DVolume9_UnlockBox((IDirect3DVolume9 *)wined3d_resource_get_parent(sub_resource)); wined3d_mutex_unlock(); return hr; } -static HRESULT WINAPI IDirect3DVolumeTexture9Impl_AddDirtyBox(LPDIRECT3DVOLUMETEXTURE9 iface, CONST D3DBOX* pDirtyBox) { - IDirect3DVolumeTexture9Impl *This = (IDirect3DVolumeTexture9Impl *)iface; +static HRESULT WINAPI IDirect3DVolumeTexture9Impl_AddDirtyBox(IDirect3DVolumeTexture9 *iface, + const D3DBOX *dirty_box) +{ + IDirect3DVolumeTexture9Impl *texture = impl_from_IDirect3DVolumeTexture9(iface); HRESULT hr; - TRACE("iface %p, dirty_box %p.\n", iface, pDirtyBox); + TRACE("iface %p, dirty_box %p.\n", iface, dirty_box); wined3d_mutex_lock(); - - hr = IWineD3DVolumeTexture_AddDirtyBox(This->wineD3DVolumeTexture, (CONST WINED3DBOX *)pDirtyBox); - + hr = wined3d_texture_add_dirty_region(texture->wined3d_texture, 0, (const WINED3DBOX *)dirty_box); wined3d_mutex_unlock(); return hr; @@ -432,13 +439,13 @@ HRESULT volumetexture_init(IDirect3DVolumeTexture9Impl *texture, IDirect3DDevice { HRESULT hr; - texture->lpVtbl = &Direct3DVolumeTexture9_Vtbl; + texture->IDirect3DVolumeTexture9_iface.lpVtbl = &Direct3DVolumeTexture9_Vtbl; texture->ref = 1; wined3d_mutex_lock(); - hr = IWineD3DDevice_CreateVolumeTexture(device->WineD3DDevice, width, height, depth, levels, + hr = wined3d_texture_create_3d(device->wined3d_device, width, height, depth, levels, usage & WINED3DUSAGE_MASK, wined3dformat_from_d3dformat(format), pool, texture, - &d3d9_volumetexture_wined3d_parent_ops, &texture->wineD3DVolumeTexture); + &d3d9_volumetexture_wined3d_parent_ops, &texture->wined3d_texture); wined3d_mutex_unlock(); if (FAILED(hr)) { @@ -446,7 +453,7 @@ HRESULT volumetexture_init(IDirect3DVolumeTexture9Impl *texture, IDirect3DDevice return hr; } - texture->parentDevice = (IDirect3DDevice9Ex *)device; + texture->parentDevice = &device->IDirect3DDevice9Ex_iface; IDirect3DDevice9Ex_AddRef(texture->parentDevice); return D3D_OK; diff --git a/dll/directx/wine/d3dx9_24/CMakeLists.txt b/dll/directx/wine/d3dx9_24/CMakeLists.txt index 39ce0ce0371..5ad6cb35f9e 100644 --- a/dll/directx/wine/d3dx9_24/CMakeLists.txt +++ b/dll/directx/wine/d3dx9_24/CMakeLists.txt @@ -24,7 +24,6 @@ add_importlibs(d3dx9_24 user32 gdi32 advapi32 - wined3d msvcrt kernel32 ntdll) diff --git a/dll/directx/wine/d3dx9_24/d3dx9_24.rbuild b/dll/directx/wine/d3dx9_24/d3dx9_24.rbuild index a59b236c196..fc25312e0d0 100644 --- a/dll/directx/wine/d3dx9_24/d3dx9_24.rbuild +++ b/dll/directx/wine/d3dx9_24/d3dx9_24.rbuild @@ -11,7 +11,6 @@ user32 gdi32 advapi32 - wined3d d3dx9_24_main.c version.rc diff --git a/dll/directx/wine/d3dx9_25/CMakeLists.txt b/dll/directx/wine/d3dx9_25/CMakeLists.txt index 98c9a7f9e79..c7b5b2c2a61 100644 --- a/dll/directx/wine/d3dx9_25/CMakeLists.txt +++ b/dll/directx/wine/d3dx9_25/CMakeLists.txt @@ -25,7 +25,6 @@ add_importlibs(d3dx9_25 user32 gdi32 advapi32 - wined3d msvcrt kernel32 ntdll) diff --git a/dll/directx/wine/d3dx9_25/d3dx9_25.rbuild b/dll/directx/wine/d3dx9_25/d3dx9_25.rbuild index 0fadc998ba1..129135cc691 100644 --- a/dll/directx/wine/d3dx9_25/d3dx9_25.rbuild +++ b/dll/directx/wine/d3dx9_25/d3dx9_25.rbuild @@ -11,7 +11,6 @@ user32 gdi32 advapi32 - wined3d d3dx9_25_main.c version.rc diff --git a/dll/directx/wine/d3dx9_26/CMakeLists.txt b/dll/directx/wine/d3dx9_26/CMakeLists.txt index 82f45db4c0e..efb2eeb47a2 100644 --- a/dll/directx/wine/d3dx9_26/CMakeLists.txt +++ b/dll/directx/wine/d3dx9_26/CMakeLists.txt @@ -25,7 +25,6 @@ add_importlibs(d3dx9_26 user32 gdi32 advapi32 - wined3d msvcrt kernel32 ntdll) diff --git a/dll/directx/wine/d3dx9_26/d3dx9_26.rbuild b/dll/directx/wine/d3dx9_26/d3dx9_26.rbuild index 1a5965c2513..887eff22f66 100644 --- a/dll/directx/wine/d3dx9_26/d3dx9_26.rbuild +++ b/dll/directx/wine/d3dx9_26/d3dx9_26.rbuild @@ -11,7 +11,6 @@ user32 gdi32 advapi32 - wined3d d3dx9_26_main.c version.rc diff --git a/dll/directx/wine/d3dx9_27/CMakeLists.txt b/dll/directx/wine/d3dx9_27/CMakeLists.txt index 595fb303814..974974657cc 100644 --- a/dll/directx/wine/d3dx9_27/CMakeLists.txt +++ b/dll/directx/wine/d3dx9_27/CMakeLists.txt @@ -25,7 +25,6 @@ add_importlibs(d3dx9_27 user32 gdi32 advapi32 - wined3d msvcrt kernel32 ntdll) diff --git a/dll/directx/wine/d3dx9_27/d3dx9_27.rbuild b/dll/directx/wine/d3dx9_27/d3dx9_27.rbuild index daea575dc78..c0664299983 100644 --- a/dll/directx/wine/d3dx9_27/d3dx9_27.rbuild +++ b/dll/directx/wine/d3dx9_27/d3dx9_27.rbuild @@ -11,7 +11,6 @@ user32 gdi32 advapi32 - wined3d d3dx9_27_main.c version.rc diff --git a/dll/directx/wine/d3dx9_28/CMakeLists.txt b/dll/directx/wine/d3dx9_28/CMakeLists.txt index 1abdaf0b692..5d34deb88b8 100644 --- a/dll/directx/wine/d3dx9_28/CMakeLists.txt +++ b/dll/directx/wine/d3dx9_28/CMakeLists.txt @@ -25,7 +25,6 @@ add_importlibs(d3dx9_28 user32 gdi32 advapi32 - wined3d msvcrt kernel32 ntdll) diff --git a/dll/directx/wine/d3dx9_28/d3dx9_28.rbuild b/dll/directx/wine/d3dx9_28/d3dx9_28.rbuild index 79f53825d46..cb47d5f047d 100644 --- a/dll/directx/wine/d3dx9_28/d3dx9_28.rbuild +++ b/dll/directx/wine/d3dx9_28/d3dx9_28.rbuild @@ -11,7 +11,6 @@ user32 gdi32 advapi32 - wined3d d3dx9_28_main.c version.rc diff --git a/dll/directx/wine/d3dx9_29/CMakeLists.txt b/dll/directx/wine/d3dx9_29/CMakeLists.txt index 431a7830835..e0d576f3b1f 100644 --- a/dll/directx/wine/d3dx9_29/CMakeLists.txt +++ b/dll/directx/wine/d3dx9_29/CMakeLists.txt @@ -25,7 +25,6 @@ add_importlibs(d3dx9_29 user32 gdi32 advapi32 - wined3d msvcrt kernel32 ntdll) diff --git a/dll/directx/wine/d3dx9_29/d3dx9_29.rbuild b/dll/directx/wine/d3dx9_29/d3dx9_29.rbuild index 61898fcf4f5..d1c5e2ea161 100644 --- a/dll/directx/wine/d3dx9_29/d3dx9_29.rbuild +++ b/dll/directx/wine/d3dx9_29/d3dx9_29.rbuild @@ -11,7 +11,6 @@ user32 gdi32 advapi32 - wined3d d3dx9_29_main.c version.rc diff --git a/dll/directx/wine/d3dx9_30/CMakeLists.txt b/dll/directx/wine/d3dx9_30/CMakeLists.txt index d6d00c81cf3..00ce311e881 100644 --- a/dll/directx/wine/d3dx9_30/CMakeLists.txt +++ b/dll/directx/wine/d3dx9_30/CMakeLists.txt @@ -25,7 +25,6 @@ add_importlibs(d3dx9_30 user32 gdi32 advapi32 - wined3d msvcrt kernel32 ntdll) diff --git a/dll/directx/wine/d3dx9_30/d3dx9_30.rbuild b/dll/directx/wine/d3dx9_30/d3dx9_30.rbuild index e7c5eb68535..c47ef1c688e 100644 --- a/dll/directx/wine/d3dx9_30/d3dx9_30.rbuild +++ b/dll/directx/wine/d3dx9_30/d3dx9_30.rbuild @@ -11,7 +11,6 @@ user32 gdi32 advapi32 - wined3d d3dx9_30_main.c version.rc diff --git a/dll/directx/wine/d3dx9_31/CMakeLists.txt b/dll/directx/wine/d3dx9_31/CMakeLists.txt index aa45584de71..84ad7f4bff5 100644 --- a/dll/directx/wine/d3dx9_31/CMakeLists.txt +++ b/dll/directx/wine/d3dx9_31/CMakeLists.txt @@ -24,7 +24,6 @@ add_importlibs(d3dx9_31 user32 gdi32 advapi32 - wined3d msvcrt kernel32 ntdll) diff --git a/dll/directx/wine/d3dx9_31/d3dx9_31.rbuild b/dll/directx/wine/d3dx9_31/d3dx9_31.rbuild index 86b91f21f86..01c2bc4fd1e 100644 --- a/dll/directx/wine/d3dx9_31/d3dx9_31.rbuild +++ b/dll/directx/wine/d3dx9_31/d3dx9_31.rbuild @@ -11,7 +11,6 @@ user32 gdi32 advapi32 - wined3d d3dx9_31_main.c version.rc diff --git a/dll/directx/wine/d3dx9_32/CMakeLists.txt b/dll/directx/wine/d3dx9_32/CMakeLists.txt index 249e8195303..2daf736e121 100644 --- a/dll/directx/wine/d3dx9_32/CMakeLists.txt +++ b/dll/directx/wine/d3dx9_32/CMakeLists.txt @@ -24,7 +24,6 @@ add_importlibs(d3dx9_32 user32 gdi32 advapi32 - wined3d msvcrt kernel32 ntdll) diff --git a/dll/directx/wine/d3dx9_32/d3dx9_32.rbuild b/dll/directx/wine/d3dx9_32/d3dx9_32.rbuild index f8bc87fa318..fd2dbeee065 100644 --- a/dll/directx/wine/d3dx9_32/d3dx9_32.rbuild +++ b/dll/directx/wine/d3dx9_32/d3dx9_32.rbuild @@ -11,7 +11,6 @@ user32 gdi32 advapi32 - wined3d d3dx9_32_main.c version.rc diff --git a/dll/directx/wine/d3dx9_33/CMakeLists.txt b/dll/directx/wine/d3dx9_33/CMakeLists.txt index cefe373c27c..be87694c231 100644 --- a/dll/directx/wine/d3dx9_33/CMakeLists.txt +++ b/dll/directx/wine/d3dx9_33/CMakeLists.txt @@ -24,7 +24,6 @@ add_importlibs(d3dx9_33 user32 gdi32 advapi32 - wined3d msvcrt kernel32 ntdll) diff --git a/dll/directx/wine/d3dx9_33/d3dx9_33.rbuild b/dll/directx/wine/d3dx9_33/d3dx9_33.rbuild index d45efae1f40..4c7ea881fc9 100644 --- a/dll/directx/wine/d3dx9_33/d3dx9_33.rbuild +++ b/dll/directx/wine/d3dx9_33/d3dx9_33.rbuild @@ -11,7 +11,6 @@ user32 gdi32 advapi32 - wined3d d3dx9_33_main.c version.rc diff --git a/dll/directx/wine/d3dx9_34/CMakeLists.txt b/dll/directx/wine/d3dx9_34/CMakeLists.txt index 7353481b206..80ae9093171 100644 --- a/dll/directx/wine/d3dx9_34/CMakeLists.txt +++ b/dll/directx/wine/d3dx9_34/CMakeLists.txt @@ -24,7 +24,6 @@ add_importlibs(d3dx9_34 user32 gdi32 advapi32 - wined3d msvcrt kernel32 ntdll) diff --git a/dll/directx/wine/d3dx9_34/d3dx9_34.rbuild b/dll/directx/wine/d3dx9_34/d3dx9_34.rbuild index 778d6adce91..b297ab1e7f9 100644 --- a/dll/directx/wine/d3dx9_34/d3dx9_34.rbuild +++ b/dll/directx/wine/d3dx9_34/d3dx9_34.rbuild @@ -11,7 +11,6 @@ user32 gdi32 advapi32 - wined3d d3dx9_34_main.c version.rc diff --git a/dll/directx/wine/d3dx9_35/CMakeLists.txt b/dll/directx/wine/d3dx9_35/CMakeLists.txt index 361ffa4671e..f71621388ab 100644 --- a/dll/directx/wine/d3dx9_35/CMakeLists.txt +++ b/dll/directx/wine/d3dx9_35/CMakeLists.txt @@ -23,7 +23,6 @@ add_importlibs(d3dx9_35 user32 gdi32 advapi32 - wined3d msvcrt kernel32 ntdll) diff --git a/dll/directx/wine/d3dx9_35/d3dx9_35.rbuild b/dll/directx/wine/d3dx9_35/d3dx9_35.rbuild index 35bb8b42720..06087a6900d 100644 --- a/dll/directx/wine/d3dx9_35/d3dx9_35.rbuild +++ b/dll/directx/wine/d3dx9_35/d3dx9_35.rbuild @@ -11,7 +11,6 @@ user32 gdi32 advapi32 - wined3d d3dx9_35_main.c version.rc diff --git a/dll/directx/wine/d3dx9_36/CMakeLists.txt b/dll/directx/wine/d3dx9_36/CMakeLists.txt index 34ca20bf6a6..1d5c48876a9 100644 --- a/dll/directx/wine/d3dx9_36/CMakeLists.txt +++ b/dll/directx/wine/d3dx9_36/CMakeLists.txt @@ -32,7 +32,6 @@ add_importlibs(d3dx9_36 user32 gdi32 advapi32 - wined3d msvcrt kernel32 ntdll) diff --git a/dll/directx/wine/d3dx9_36/d3dx9_36.rbuild b/dll/directx/wine/d3dx9_36/d3dx9_36.rbuild index 52fc95074c7..b44f95fd57e 100644 --- a/dll/directx/wine/d3dx9_36/d3dx9_36.rbuild +++ b/dll/directx/wine/d3dx9_36/d3dx9_36.rbuild @@ -12,7 +12,6 @@ gdi32 advapi32 msvcrt - wined3d core.c d3dx9_36_main.c diff --git a/dll/directx/wine/d3dx9_37/CMakeLists.txt b/dll/directx/wine/d3dx9_37/CMakeLists.txt index cd49aee8e97..ac929e8263d 100644 --- a/dll/directx/wine/d3dx9_37/CMakeLists.txt +++ b/dll/directx/wine/d3dx9_37/CMakeLists.txt @@ -23,7 +23,6 @@ add_importlibs(d3dx9_37 user32 gdi32 advapi32 - wined3d msvcrt kernel32 ntdll) diff --git a/dll/directx/wine/d3dx9_37/d3dx9_37.rbuild b/dll/directx/wine/d3dx9_37/d3dx9_37.rbuild index 56a701bd5d4..0d1ecddcc40 100644 --- a/dll/directx/wine/d3dx9_37/d3dx9_37.rbuild +++ b/dll/directx/wine/d3dx9_37/d3dx9_37.rbuild @@ -11,7 +11,6 @@ user32 gdi32 advapi32 - wined3d d3dx9_37_main.c version.rc diff --git a/dll/directx/wine/d3dx9_38/CMakeLists.txt b/dll/directx/wine/d3dx9_38/CMakeLists.txt index a5d8f25ac4a..9fccb7207cd 100644 --- a/dll/directx/wine/d3dx9_38/CMakeLists.txt +++ b/dll/directx/wine/d3dx9_38/CMakeLists.txt @@ -23,7 +23,6 @@ add_importlibs(d3dx9_38 user32 gdi32 advapi32 - wined3d msvcrt kernel32 ntdll) diff --git a/dll/directx/wine/d3dx9_38/d3dx9_38.rbuild b/dll/directx/wine/d3dx9_38/d3dx9_38.rbuild index 1bf726c9928..14d4e0c4445 100644 --- a/dll/directx/wine/d3dx9_38/d3dx9_38.rbuild +++ b/dll/directx/wine/d3dx9_38/d3dx9_38.rbuild @@ -11,7 +11,6 @@ user32 gdi32 advapi32 - wined3d d3dx9_38_main.c version.rc diff --git a/dll/directx/wine/d3dx9_39/CMakeLists.txt b/dll/directx/wine/d3dx9_39/CMakeLists.txt index 84597ea257c..668b18dc006 100644 --- a/dll/directx/wine/d3dx9_39/CMakeLists.txt +++ b/dll/directx/wine/d3dx9_39/CMakeLists.txt @@ -23,7 +23,6 @@ add_importlibs(d3dx9_39 user32 gdi32 advapi32 - wined3d msvcrt kernel32 ntdll) diff --git a/dll/directx/wine/d3dx9_39/d3dx9_39.rbuild b/dll/directx/wine/d3dx9_39/d3dx9_39.rbuild index 2b16c77c65e..9969cc2e96c 100644 --- a/dll/directx/wine/d3dx9_39/d3dx9_39.rbuild +++ b/dll/directx/wine/d3dx9_39/d3dx9_39.rbuild @@ -11,7 +11,6 @@ user32 gdi32 advapi32 - wined3d d3dx9_39_main.c version.rc diff --git a/dll/directx/wine/d3dx9_40/CMakeLists.txt b/dll/directx/wine/d3dx9_40/CMakeLists.txt index c9cfe0ae082..7c80c06f2cf 100644 --- a/dll/directx/wine/d3dx9_40/CMakeLists.txt +++ b/dll/directx/wine/d3dx9_40/CMakeLists.txt @@ -23,7 +23,6 @@ add_importlibs(d3dx9_40 user32 gdi32 advapi32 - wined3d msvcrt kernel32 ntdll) diff --git a/dll/directx/wine/d3dx9_40/d3dx9_40.rbuild b/dll/directx/wine/d3dx9_40/d3dx9_40.rbuild index f6bb05dd6c4..478bcc82ff8 100644 --- a/dll/directx/wine/d3dx9_40/d3dx9_40.rbuild +++ b/dll/directx/wine/d3dx9_40/d3dx9_40.rbuild @@ -11,7 +11,6 @@ user32 gdi32 advapi32 - wined3d d3dx9_40_main.c version.rc diff --git a/dll/directx/wine/d3dx9_41/CMakeLists.txt b/dll/directx/wine/d3dx9_41/CMakeLists.txt index e8fbf0eeee0..4a6b5d5d73a 100644 --- a/dll/directx/wine/d3dx9_41/CMakeLists.txt +++ b/dll/directx/wine/d3dx9_41/CMakeLists.txt @@ -23,7 +23,6 @@ add_importlibs(d3dx9_41 user32 gdi32 advapi32 - wined3d msvcrt kernel32 ntdll) diff --git a/dll/directx/wine/d3dx9_41/d3dx9_41.rbuild b/dll/directx/wine/d3dx9_41/d3dx9_41.rbuild index 386bc8b8fe9..bd4a36b010b 100644 --- a/dll/directx/wine/d3dx9_41/d3dx9_41.rbuild +++ b/dll/directx/wine/d3dx9_41/d3dx9_41.rbuild @@ -11,7 +11,6 @@ user32 gdi32 advapi32 - wined3d d3dx9_41_main.c version.rc diff --git a/dll/directx/wine/d3dx9_42/CMakeLists.txt b/dll/directx/wine/d3dx9_42/CMakeLists.txt index 75ee61b765d..0bcaa8ccb37 100644 --- a/dll/directx/wine/d3dx9_42/CMakeLists.txt +++ b/dll/directx/wine/d3dx9_42/CMakeLists.txt @@ -23,7 +23,6 @@ add_importlibs(d3dx9_42 user32 gdi32 advapi32 - wined3d msvcrt kernel32 ntdll) diff --git a/dll/directx/wine/d3dx9_42/d3dx9_42.rbuild b/dll/directx/wine/d3dx9_42/d3dx9_42.rbuild index d10af3a3b29..0cbf2df0a7d 100644 --- a/dll/directx/wine/d3dx9_42/d3dx9_42.rbuild +++ b/dll/directx/wine/d3dx9_42/d3dx9_42.rbuild @@ -11,7 +11,6 @@ user32 gdi32 advapi32 - wined3d d3dx9_42_main.c version.rc diff --git a/dll/directx/wine/ddraw/CMakeLists.txt b/dll/directx/wine/ddraw/CMakeLists.txt index 81732d6678b..042f2b11647 100644 --- a/dll/directx/wine/ddraw/CMakeLists.txt +++ b/dll/directx/wine/ddraw/CMakeLists.txt @@ -22,7 +22,6 @@ list(APPEND SOURCE main.c material.c palette.c - parent.c regsvr.c stubs.c surface.c @@ -40,7 +39,6 @@ target_link_libraries(ddraw wine uuid dxguid - wined3d_guid ${PSEH_LIB}) add_importlibs(ddraw @@ -54,5 +52,6 @@ add_importlibs(ddraw ntdll) add_dependencies(ddraw wineheaders) +add_pch(ddraw ddraw_private.h) add_cd_file(TARGET ddraw DESTINATION reactos/system32 FOR all) add_importlib_target(ddraw.spec) diff --git a/dll/directx/wine/ddraw/clipper.c b/dll/directx/wine/ddraw/clipper.c index b4c493c4bad..c9290c85a50 100644 --- a/dll/directx/wine/ddraw/clipper.c +++ b/dll/directx/wine/ddraw/clipper.c @@ -95,7 +95,7 @@ static ULONG WINAPI IDirectDrawClipperImpl_Release(IDirectDrawClipper *iface) { if (ref == 0) { EnterCriticalSection(&ddraw_cs); - IWineD3DClipper_Release(This->wineD3DClipper); + wined3d_clipper_decref(This->wineD3DClipper); HeapFree(GetProcessHeap(), 0, This); LeaveCriticalSection(&ddraw_cs); return 0; @@ -127,9 +127,7 @@ static HRESULT WINAPI IDirectDrawClipperImpl_SetHwnd( TRACE("iface %p, flags %#x, window %p.\n", iface, dwFlags, hWnd); EnterCriticalSection(&ddraw_cs); - hr = IWineD3DClipper_SetHWnd(This->wineD3DClipper, - dwFlags, - hWnd); + hr = wined3d_clipper_set_window(This->wineD3DClipper, dwFlags, hWnd); LeaveCriticalSection(&ddraw_cs); switch(hr) { @@ -167,10 +165,7 @@ static HRESULT WINAPI IDirectDrawClipperImpl_GetClipList( iface, wine_dbgstr_rect(lpRect), lpClipList, lpdwSize); EnterCriticalSection(&ddraw_cs); - hr = IWineD3DClipper_GetClipList(This->wineD3DClipper, - lpRect, - lpClipList, - lpdwSize); + hr = wined3d_clipper_get_clip_list(This->wineD3DClipper, lpRect, lpClipList, lpdwSize); LeaveCriticalSection(&ddraw_cs); return hr; } @@ -198,9 +193,7 @@ static HRESULT WINAPI IDirectDrawClipperImpl_SetClipList( TRACE("iface %p, clip_list %p, flags %#x.\n", iface, lprgn, dwFlag); EnterCriticalSection(&ddraw_cs); - hr = IWineD3DClipper_SetClipList(This->wineD3DClipper, - lprgn, - dwFlag); + hr = wined3d_clipper_set_clip_list(This->wineD3DClipper, lprgn, dwFlag); LeaveCriticalSection(&ddraw_cs); return hr; } @@ -225,8 +218,7 @@ static HRESULT WINAPI IDirectDrawClipperImpl_GetHWnd( TRACE("iface %p, window %p.\n", iface, hWndPtr); EnterCriticalSection(&ddraw_cs); - hr = IWineD3DClipper_GetHWnd(This->wineD3DClipper, - hWndPtr); + hr = wined3d_clipper_get_window(This->wineD3DClipper, hWndPtr); LeaveCriticalSection(&ddraw_cs); return hr; } @@ -307,7 +299,7 @@ HRESULT ddraw_clipper_init(IDirectDrawClipperImpl *clipper) { clipper->lpVtbl = &ddraw_clipper_vtbl; clipper->ref = 1; - clipper->wineD3DClipper = pWineDirect3DCreateClipper(); + clipper->wineD3DClipper = wined3d_clipper_create(); if (!clipper->wineD3DClipper) { WARN("Failed to create wined3d clipper.\n"); diff --git a/dll/directx/wine/ddraw/ddraw.c b/dll/directx/wine/ddraw/ddraw.c index bef9cf0f8a6..0c6ba3c2656 100644 --- a/dll/directx/wine/ddraw/ddraw.c +++ b/dll/directx/wine/ddraw/ddraw.c @@ -46,24 +46,49 @@ const struct wined3d_parent_ops ddraw_null_wined3d_parent_ops = ddraw_null_wined3d_object_destroyed, }; -static inline IDirectDrawImpl *ddraw_from_ddraw1(IDirectDraw *iface) +static inline IDirectDrawImpl *impl_from_IDirectDraw(IDirectDraw *iface) { - return (IDirectDrawImpl *)((char*)iface - FIELD_OFFSET(IDirectDrawImpl, IDirectDraw_vtbl)); + return CONTAINING_RECORD(iface, IDirectDrawImpl, IDirectDraw_iface); } -static inline IDirectDrawImpl *ddraw_from_ddraw2(IDirectDraw2 *iface) +static inline IDirectDrawImpl *impl_from_IDirectDraw2(IDirectDraw2 *iface) { - return (IDirectDrawImpl *)((char*)iface - FIELD_OFFSET(IDirectDrawImpl, IDirectDraw2_vtbl)); + return CONTAINING_RECORD(iface, IDirectDrawImpl, IDirectDraw2_iface); } -static inline IDirectDrawImpl *ddraw_from_ddraw3(IDirectDraw3 *iface) +static inline IDirectDrawImpl *impl_from_IDirectDraw3(IDirectDraw3 *iface) { - return (IDirectDrawImpl *)((char*)iface - FIELD_OFFSET(IDirectDrawImpl, IDirectDraw3_vtbl)); + return CONTAINING_RECORD(iface, IDirectDrawImpl, IDirectDraw3_iface); } -static inline IDirectDrawImpl *ddraw_from_ddraw4(IDirectDraw4 *iface) +static inline IDirectDrawImpl *impl_from_IDirectDraw4(IDirectDraw4 *iface) { - return (IDirectDrawImpl *)((char*)iface - FIELD_OFFSET(IDirectDrawImpl, IDirectDraw4_vtbl)); + return CONTAINING_RECORD(iface, IDirectDrawImpl, IDirectDraw4_iface); +} + +static inline IDirectDrawImpl *impl_from_IDirectDraw7(IDirectDraw7 *iface) +{ + return CONTAINING_RECORD(iface, IDirectDrawImpl, IDirectDraw7_iface); +} + +static inline IDirectDrawImpl *impl_from_IDirect3D(IDirect3D *iface) +{ + return CONTAINING_RECORD(iface, IDirectDrawImpl, IDirect3D_iface); +} + +static inline IDirectDrawImpl *impl_from_IDirect3D2(IDirect3D2 *iface) +{ + return CONTAINING_RECORD(iface, IDirectDrawImpl, IDirect3D2_iface); +} + +static inline IDirectDrawImpl *impl_from_IDirect3D3(IDirect3D3 *iface) +{ + return CONTAINING_RECORD(iface, IDirectDrawImpl, IDirect3D3_iface); +} + +static inline IDirectDrawImpl *impl_from_IDirect3D7(IDirect3D7 *iface) +{ + return CONTAINING_RECORD(iface, IDirectDrawImpl, IDirect3D7_iface); } /***************************************************************************** @@ -92,7 +117,7 @@ static inline IDirectDrawImpl *ddraw_from_ddraw4(IDirectDraw4 *iface) *****************************************************************************/ static HRESULT WINAPI ddraw7_QueryInterface(IDirectDraw7 *iface, REFIID refiid, void **obj) { - IDirectDrawImpl *This = (IDirectDrawImpl *)iface; + IDirectDrawImpl *This = impl_from_IDirectDraw7(iface); TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(refiid), obj); @@ -117,7 +142,7 @@ static HRESULT WINAPI ddraw7_QueryInterface(IDirectDraw7 *iface, REFIID refiid, } else if ( IsEqualGUID( &IID_IDirectDraw4, refiid ) ) { - *obj = &This->IDirectDraw4_vtbl; + *obj = &This->IDirectDraw4_iface; TRACE("(%p) Returning IDirectDraw4 interface at %p\n", This, *obj); } else if ( IsEqualGUID( &IID_IDirectDraw3, refiid ) ) @@ -130,12 +155,12 @@ static HRESULT WINAPI ddraw7_QueryInterface(IDirectDraw7 *iface, REFIID refiid, } else if ( IsEqualGUID( &IID_IDirectDraw2, refiid ) ) { - *obj = &This->IDirectDraw2_vtbl; + *obj = &This->IDirectDraw2_iface; TRACE("(%p) Returning IDirectDraw2 interface at %p\n", This, *obj); } else if ( IsEqualGUID( &IID_IDirectDraw, refiid ) ) { - *obj = &This->IDirectDraw_vtbl; + *obj = &This->IDirectDraw_iface; TRACE("(%p) Returning IDirectDraw interface at %p\n", This, *obj); } @@ -174,33 +199,28 @@ static HRESULT WINAPI ddraw7_QueryInterface(IDirectDraw7 *iface, REFIID refiid, if ( IsEqualGUID( &IID_IDirect3D , refiid ) ) { This->d3dversion = 1; - *obj = &This->IDirect3D_vtbl; + *obj = &This->IDirect3D_iface; TRACE(" returning Direct3D interface at %p.\n", *obj); } else if ( IsEqualGUID( &IID_IDirect3D2 , refiid ) ) { This->d3dversion = 2; - *obj = &This->IDirect3D2_vtbl; + *obj = &This->IDirect3D2_iface; TRACE(" returning Direct3D2 interface at %p.\n", *obj); } else if ( IsEqualGUID( &IID_IDirect3D3 , refiid ) ) { This->d3dversion = 3; - *obj = &This->IDirect3D3_vtbl; + *obj = &This->IDirect3D3_iface; TRACE(" returning Direct3D3 interface at %p.\n", *obj); } else if(IsEqualGUID( &IID_IDirect3D7 , refiid )) { This->d3dversion = 7; - *obj = &This->IDirect3D7_vtbl; + *obj = &This->IDirect3D7_iface; TRACE(" returning Direct3D7 interface at %p.\n", *obj); } } - else if (IsEqualGUID(refiid, &IID_IWineD3DDeviceParent)) - { - *obj = &This->device_parent_vtbl; - } - /* Unknown interface */ else { @@ -216,58 +236,74 @@ static HRESULT WINAPI ddraw7_QueryInterface(IDirectDraw7 *iface, REFIID refiid, static HRESULT WINAPI ddraw4_QueryInterface(IDirectDraw4 *iface, REFIID riid, void **object) { + IDirectDrawImpl *This = impl_from_IDirectDraw4(iface); + TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object); - return ddraw7_QueryInterface((IDirectDraw7 *)ddraw_from_ddraw4(iface), riid, object); + return ddraw7_QueryInterface(&This->IDirectDraw7_iface, riid, object); } static HRESULT WINAPI ddraw3_QueryInterface(IDirectDraw3 *iface, REFIID riid, void **object) { + IDirectDrawImpl *This = impl_from_IDirectDraw3(iface); + TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object); - return ddraw7_QueryInterface((IDirectDraw7 *)ddraw_from_ddraw3(iface), riid, object); + return ddraw7_QueryInterface(&This->IDirectDraw7_iface, riid, object); } static HRESULT WINAPI ddraw2_QueryInterface(IDirectDraw2 *iface, REFIID riid, void **object) { + IDirectDrawImpl *This = impl_from_IDirectDraw2(iface); + TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object); - return ddraw7_QueryInterface((IDirectDraw7 *)ddraw_from_ddraw2(iface), riid, object); + return ddraw7_QueryInterface(&This->IDirectDraw7_iface, riid, object); } static HRESULT WINAPI ddraw1_QueryInterface(IDirectDraw *iface, REFIID riid, void **object) { + IDirectDrawImpl *This = impl_from_IDirectDraw(iface); + TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object); - return ddraw7_QueryInterface((IDirectDraw7 *)ddraw_from_ddraw1(iface), riid, object); + return ddraw7_QueryInterface(&This->IDirectDraw7_iface, riid, object); } static HRESULT WINAPI d3d7_QueryInterface(IDirect3D7 *iface, REFIID riid, void **object) { + IDirectDrawImpl *This = impl_from_IDirect3D7(iface); + TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object); - return ddraw7_QueryInterface((IDirectDraw7 *)ddraw_from_d3d7(iface), riid, object); + return ddraw7_QueryInterface(&This->IDirectDraw7_iface, riid, object); } static HRESULT WINAPI d3d3_QueryInterface(IDirect3D3 *iface, REFIID riid, void **object) { + IDirectDrawImpl *This = impl_from_IDirect3D3(iface); + TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object); - return ddraw7_QueryInterface((IDirectDraw7 *)ddraw_from_d3d3(iface), riid, object); + return ddraw7_QueryInterface(&This->IDirectDraw7_iface, riid, object); } static HRESULT WINAPI d3d2_QueryInterface(IDirect3D2 *iface, REFIID riid, void **object) { + IDirectDrawImpl *This = impl_from_IDirect3D2(iface); + TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object); - return ddraw7_QueryInterface((IDirectDraw7 *)ddraw_from_d3d2(iface), riid, object); + return ddraw7_QueryInterface(&This->IDirectDraw7_iface, riid, object); } static HRESULT WINAPI d3d1_QueryInterface(IDirect3D *iface, REFIID riid, void **object) { + IDirectDrawImpl *This = impl_from_IDirect3D(iface); + TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object); - return ddraw7_QueryInterface((IDirectDraw7 *)ddraw_from_d3d1(iface), riid, object); + return ddraw7_QueryInterface(&This->IDirectDraw7_iface, riid, object); } /***************************************************************************** @@ -290,7 +326,7 @@ static HRESULT WINAPI d3d1_QueryInterface(IDirect3D *iface, REFIID riid, void ** *****************************************************************************/ static ULONG WINAPI ddraw7_AddRef(IDirectDraw7 *iface) { - IDirectDrawImpl *This = (IDirectDrawImpl *)iface; + IDirectDrawImpl *This = impl_from_IDirectDraw7(iface); ULONG ref = InterlockedIncrement(&This->ref7); TRACE("%p increasing refcount to %u.\n", This, ref); @@ -302,78 +338,86 @@ static ULONG WINAPI ddraw7_AddRef(IDirectDraw7 *iface) static ULONG WINAPI ddraw4_AddRef(IDirectDraw4 *iface) { - IDirectDrawImpl *ddraw = ddraw_from_ddraw4(iface); - ULONG ref = InterlockedIncrement(&ddraw->ref4); + IDirectDrawImpl *This = impl_from_IDirectDraw4(iface); + ULONG ref = InterlockedIncrement(&This->ref4); - TRACE("%p increasing refcount to %u.\n", ddraw, ref); + TRACE("%p increasing refcount to %u.\n", This, ref); - if (ref == 1) InterlockedIncrement(&ddraw->numIfaces); + if (ref == 1) InterlockedIncrement(&This->numIfaces); return ref; } static ULONG WINAPI ddraw3_AddRef(IDirectDraw3 *iface) { - IDirectDrawImpl *ddraw = ddraw_from_ddraw3(iface); - ULONG ref = InterlockedIncrement(&ddraw->ref3); + IDirectDrawImpl *This = impl_from_IDirectDraw3(iface); + ULONG ref = InterlockedIncrement(&This->ref3); - TRACE("%p increasing refcount to %u.\n", ddraw, ref); + TRACE("%p increasing refcount to %u.\n", This, ref); - if (ref == 1) InterlockedIncrement(&ddraw->numIfaces); + if (ref == 1) InterlockedIncrement(&This->numIfaces); return ref; } static ULONG WINAPI ddraw2_AddRef(IDirectDraw2 *iface) { - IDirectDrawImpl *ddraw = ddraw_from_ddraw2(iface); - ULONG ref = InterlockedIncrement(&ddraw->ref2); + IDirectDrawImpl *This = impl_from_IDirectDraw2(iface); + ULONG ref = InterlockedIncrement(&This->ref2); - TRACE("%p increasing refcount to %u.\n", ddraw, ref); + TRACE("%p increasing refcount to %u.\n", This, ref); - if (ref == 1) InterlockedIncrement(&ddraw->numIfaces); + if (ref == 1) InterlockedIncrement(&This->numIfaces); return ref; } static ULONG WINAPI ddraw1_AddRef(IDirectDraw *iface) { - IDirectDrawImpl *ddraw = ddraw_from_ddraw1(iface); - ULONG ref = InterlockedIncrement(&ddraw->ref1); + IDirectDrawImpl *This = impl_from_IDirectDraw(iface); + ULONG ref = InterlockedIncrement(&This->ref1); - TRACE("%p increasing refcount to %u.\n", ddraw, ref); + TRACE("%p increasing refcount to %u.\n", This, ref); - if (ref == 1) InterlockedIncrement(&ddraw->numIfaces); + if (ref == 1) InterlockedIncrement(&This->numIfaces); return ref; } static ULONG WINAPI d3d7_AddRef(IDirect3D7 *iface) { + IDirectDrawImpl *This = impl_from_IDirect3D7(iface); + TRACE("iface %p.\n", iface); - return ddraw7_AddRef((IDirectDraw7 *)ddraw_from_d3d7(iface)); + return ddraw7_AddRef(&This->IDirectDraw7_iface); } static ULONG WINAPI d3d3_AddRef(IDirect3D3 *iface) { + IDirectDrawImpl *This = impl_from_IDirect3D3(iface); + TRACE("iface %p.\n", iface); - return ddraw1_AddRef((IDirectDraw *)&ddraw_from_d3d3(iface)->IDirectDraw_vtbl); + return ddraw1_AddRef(&This->IDirectDraw_iface); } static ULONG WINAPI d3d2_AddRef(IDirect3D2 *iface) { + IDirectDrawImpl *This = impl_from_IDirect3D2(iface); + TRACE("iface %p.\n", iface); - return ddraw1_AddRef((IDirectDraw *)&ddraw_from_d3d2(iface)->IDirectDraw_vtbl); + return ddraw1_AddRef(&This->IDirectDraw_iface); } static ULONG WINAPI d3d1_AddRef(IDirect3D *iface) { + IDirectDrawImpl *This = impl_from_IDirect3D(iface); + TRACE("iface %p.\n", iface); - return ddraw1_AddRef((IDirectDraw *)&ddraw_from_d3d1(iface)->IDirectDraw_vtbl); + return ddraw1_AddRef(&This->IDirectDraw_iface); } /***************************************************************************** @@ -388,8 +432,8 @@ static ULONG WINAPI d3d1_AddRef(IDirect3D *iface) *****************************************************************************/ static void ddraw_destroy(IDirectDrawImpl *This) { - IDirectDraw7_SetCooperativeLevel((IDirectDraw7 *)This, NULL, DDSCL_NORMAL); - IDirectDraw7_RestoreDisplayMode((IDirectDraw7 *)This); + IDirectDraw7_SetCooperativeLevel(&This->IDirectDraw7_iface, NULL, DDSCL_NORMAL); + IDirectDraw7_RestoreDisplayMode(&This->IDirectDraw7_iface); /* Destroy the device window if we created one */ if(This->devicewindow != 0) @@ -404,8 +448,8 @@ static void ddraw_destroy(IDirectDrawImpl *This) LeaveCriticalSection(&ddraw_cs); /* Release the attached WineD3D stuff */ - IWineD3DDevice_Release(This->wineD3DDevice); - IWineD3D_Release(This->wineD3D); + wined3d_device_decref(This->wined3d_device); + wined3d_decref(This->wineD3D); /* Now free the object */ HeapFree(GetProcessHeap(), 0, This); @@ -420,7 +464,7 @@ static void ddraw_destroy(IDirectDrawImpl *This) *****************************************************************************/ static ULONG WINAPI ddraw7_Release(IDirectDraw7 *iface) { - IDirectDrawImpl *This = (IDirectDrawImpl *)iface; + IDirectDrawImpl *This = impl_from_IDirectDraw7(iface); ULONG ref = InterlockedDecrement(&This->ref7); TRACE("%p decreasing refcount to %u.\n", This, ref); @@ -433,82 +477,90 @@ static ULONG WINAPI ddraw7_Release(IDirectDraw7 *iface) static ULONG WINAPI ddraw4_Release(IDirectDraw4 *iface) { - IDirectDrawImpl *ddraw = ddraw_from_ddraw4(iface); - ULONG ref = InterlockedDecrement(&ddraw->ref4); + IDirectDrawImpl *This = impl_from_IDirectDraw4(iface); + ULONG ref = InterlockedDecrement(&This->ref4); - TRACE("%p decreasing refcount to %u.\n", ddraw, ref); + TRACE("%p decreasing refcount to %u.\n", This, ref); - if (!ref && !InterlockedDecrement(&ddraw->numIfaces)) - ddraw_destroy(ddraw); + if (!ref && !InterlockedDecrement(&This->numIfaces)) + ddraw_destroy(This); return ref; } static ULONG WINAPI ddraw3_Release(IDirectDraw3 *iface) { - IDirectDrawImpl *ddraw = ddraw_from_ddraw3(iface); - ULONG ref = InterlockedDecrement(&ddraw->ref3); + IDirectDrawImpl *This = impl_from_IDirectDraw3(iface); + ULONG ref = InterlockedDecrement(&This->ref3); - TRACE("%p decreasing refcount to %u.\n", ddraw, ref); + TRACE("%p decreasing refcount to %u.\n", This, ref); - if (!ref && !InterlockedDecrement(&ddraw->numIfaces)) - ddraw_destroy(ddraw); + if (!ref && !InterlockedDecrement(&This->numIfaces)) + ddraw_destroy(This); return ref; } static ULONG WINAPI ddraw2_Release(IDirectDraw2 *iface) { - IDirectDrawImpl *ddraw = ddraw_from_ddraw2(iface); - ULONG ref = InterlockedDecrement(&ddraw->ref2); + IDirectDrawImpl *This = impl_from_IDirectDraw2(iface); + ULONG ref = InterlockedDecrement(&This->ref2); - TRACE("%p decreasing refcount to %u.\n", ddraw, ref); + TRACE("%p decreasing refcount to %u.\n", This, ref); - if (!ref && !InterlockedDecrement(&ddraw->numIfaces)) - ddraw_destroy(ddraw); + if (!ref && !InterlockedDecrement(&This->numIfaces)) + ddraw_destroy(This); return ref; } static ULONG WINAPI ddraw1_Release(IDirectDraw *iface) { - IDirectDrawImpl *ddraw = ddraw_from_ddraw1(iface); - ULONG ref = InterlockedDecrement(&ddraw->ref1); + IDirectDrawImpl *This = impl_from_IDirectDraw(iface); + ULONG ref = InterlockedDecrement(&This->ref1); - TRACE("%p decreasing refcount to %u.\n", ddraw, ref); + TRACE("%p decreasing refcount to %u.\n", This, ref); - if (!ref && !InterlockedDecrement(&ddraw->numIfaces)) - ddraw_destroy(ddraw); + if (!ref && !InterlockedDecrement(&This->numIfaces)) + ddraw_destroy(This); return ref; } static ULONG WINAPI d3d7_Release(IDirect3D7 *iface) { + IDirectDrawImpl *This = impl_from_IDirect3D7(iface); + TRACE("iface %p.\n", iface); - return ddraw7_Release((IDirectDraw7 *)ddraw_from_d3d7(iface)); + return ddraw7_Release(&This->IDirectDraw7_iface); } static ULONG WINAPI d3d3_Release(IDirect3D3 *iface) { + IDirectDrawImpl *This = impl_from_IDirect3D3(iface); + TRACE("iface %p.\n", iface); - return ddraw1_Release((IDirectDraw *)&ddraw_from_d3d3(iface)->IDirectDraw_vtbl); + return ddraw1_Release(&This->IDirectDraw_iface); } static ULONG WINAPI d3d2_Release(IDirect3D2 *iface) { + IDirectDrawImpl *This = impl_from_IDirect3D2(iface); + TRACE("iface %p.\n", iface); - return ddraw1_Release((IDirectDraw *)&ddraw_from_d3d2(iface)->IDirectDraw_vtbl); + return ddraw1_Release(&This->IDirectDraw_iface); } static ULONG WINAPI d3d1_Release(IDirect3D *iface) { + IDirectDrawImpl *This = impl_from_IDirect3D(iface); + TRACE("iface %p.\n", iface); - return ddraw1_Release((IDirectDraw *)&ddraw_from_d3d1(iface)->IDirectDraw_vtbl); + return ddraw1_Release(&This->IDirectDraw_iface); } /***************************************************************************** @@ -561,7 +613,7 @@ static ULONG WINAPI d3d1_Release(IDirect3D *iface) *****************************************************************************/ static HRESULT WINAPI ddraw7_SetCooperativeLevel(IDirectDraw7 *iface, HWND hwnd, DWORD cooplevel) { - IDirectDrawImpl *This = (IDirectDrawImpl *)iface; + IDirectDrawImpl *This = impl_from_IDirectDraw7(iface); HWND window; TRACE("iface %p, window %p, flags %#x.\n", iface, hwnd, cooplevel); @@ -586,21 +638,23 @@ static HRESULT WINAPI ddraw7_SetCooperativeLevel(IDirectDraw7 *iface, HWND hwnd, if(cooplevel & DDSCL_SETFOCUSWINDOW) { /* This isn't compatible with a lot of flags */ - if(cooplevel & ( DDSCL_MULTITHREADED | - DDSCL_FPUSETUP | - DDSCL_FPUPRESERVE | - DDSCL_ALLOWREBOOT | - DDSCL_ALLOWMODEX | - DDSCL_SETDEVICEWINDOW | - DDSCL_NORMAL | - DDSCL_EXCLUSIVE | - DDSCL_FULLSCREEN ) ) + if(cooplevel & ( DDSCL_MULTITHREADED | + DDSCL_CREATEDEVICEWINDOW | + DDSCL_FPUSETUP | + DDSCL_FPUPRESERVE | + DDSCL_ALLOWREBOOT | + DDSCL_ALLOWMODEX | + DDSCL_SETDEVICEWINDOW | + DDSCL_NORMAL | + DDSCL_EXCLUSIVE | + DDSCL_FULLSCREEN ) ) { TRACE("Called with incompatible flags, returning DDERR_INVALIDPARAMS\n"); LeaveCriticalSection(&ddraw_cs); return DDERR_INVALIDPARAMS; } - else if( (This->cooperative_level & DDSCL_FULLSCREEN) && window) + + if( (This->cooperative_level & DDSCL_EXCLUSIVE) && window ) { TRACE("Setting DDSCL_SETFOCUSWINDOW with an already set window, returning DDERR_HWNDALREADYSET\n"); LeaveCriticalSection(&ddraw_cs); @@ -620,79 +674,62 @@ static HRESULT WINAPI ddraw7_SetCooperativeLevel(IDirectDraw7 *iface, HWND hwnd, DestroyWindow(This->devicewindow); This->devicewindow = NULL; } + + LeaveCriticalSection(&ddraw_cs); + return DD_OK; } - /* DDSCL_NORMAL or DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE */ - if(cooplevel & DDSCL_NORMAL) + + if(cooplevel & DDSCL_EXCLUSIVE) { - /* Can't coexist with fullscreen or exclusive */ - if(cooplevel & (DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE) ) + if( !(cooplevel & DDSCL_FULLSCREEN) || !hwnd ) { - TRACE("(%p) DDSCL_NORMAL is not compative with DDSCL_FULLSCREEN or DDSCL_EXCLUSIVE\n", This); + TRACE("(%p) DDSCL_EXCLUSIVE needs DDSCL_FULLSCREEN and a window\n", This); LeaveCriticalSection(&ddraw_cs); return DDERR_INVALIDPARAMS; } - - /* Switching from fullscreen? */ - if(This->cooperative_level & DDSCL_FULLSCREEN) - { - This->cooperative_level &= ~DDSCL_FULLSCREEN; - This->cooperative_level &= ~DDSCL_EXCLUSIVE; - This->cooperative_level &= ~DDSCL_ALLOWMODEX; - - IWineD3DDevice_ReleaseFocusWindow(This->wineD3DDevice); - } - - /* Don't override focus windows or private device windows */ - if( hwnd && - !(This->focuswindow) && - !(This->devicewindow) && - (hwnd != window) ) - { - This->dest_window = hwnd; - } } - else if(cooplevel & DDSCL_FULLSCREEN) + else if( !(cooplevel & DDSCL_NORMAL) ) { - /* Needs DDSCL_EXCLUSIVE */ - if(!(cooplevel & DDSCL_EXCLUSIVE) ) - { - TRACE("(%p) DDSCL_FULLSCREEN needs DDSCL_EXCLUSIVE\n", This); - LeaveCriticalSection(&ddraw_cs); - return DDERR_INVALIDPARAMS; - } - /* Need a HWND - if(hwnd == 0) - { - TRACE("(%p) DDSCL_FULLSCREEN needs a HWND\n", This); - return DDERR_INVALIDPARAMS; - } - */ - - This->cooperative_level &= ~DDSCL_NORMAL; - - /* Don't override focus windows or private device windows */ - if( hwnd && - !(This->focuswindow) && - !(This->devicewindow) && - (hwnd != window) ) - { - HRESULT hr = IWineD3DDevice_AcquireFocusWindow(This->wineD3DDevice, hwnd); - if (FAILED(hr)) - { - ERR("Failed to acquire focus window, hr %#x.\n", hr); - LeaveCriticalSection(&ddraw_cs); - return hr; - } - This->dest_window = hwnd; - } - } - else if(cooplevel & DDSCL_EXCLUSIVE) - { - TRACE("(%p) DDSCL_EXCLUSIVE needs DDSCL_FULLSCREEN\n", This); + TRACE("(%p) SetCooperativeLevel needs at least SetFocusWindow or Exclusive or Normal mode\n", This); LeaveCriticalSection(&ddraw_cs); return DDERR_INVALIDPARAMS; } + if ((This->cooperative_level & DDSCL_EXCLUSIVE) + && (hwnd != window || !(cooplevel & DDSCL_EXCLUSIVE))) + wined3d_device_release_focus_window(This->wined3d_device); + + if ((cooplevel & DDSCL_FULLSCREEN) != (This->cooperative_level & DDSCL_FULLSCREEN) || hwnd != window) + { + if (This->cooperative_level & DDSCL_FULLSCREEN) + wined3d_device_restore_fullscreen_window(This->wined3d_device, window); + + if (cooplevel & DDSCL_FULLSCREEN) + { + WINED3DDISPLAYMODE display_mode; + + wined3d_get_adapter_display_mode(This->wineD3D, WINED3DADAPTER_DEFAULT, &display_mode); + wined3d_device_setup_fullscreen_window(This->wined3d_device, hwnd, + display_mode.Width, display_mode.Height); + } + } + + if ((cooplevel & DDSCL_EXCLUSIVE) + && (hwnd != window || !(This->cooperative_level & DDSCL_EXCLUSIVE))) + { + HRESULT hr = wined3d_device_acquire_focus_window(This->wined3d_device, hwnd); + if (FAILED(hr)) + { + ERR("Failed to acquire focus window, hr %#x.\n", hr); + LeaveCriticalSection(&ddraw_cs); + return hr; + } + } + + /* Don't override focus windows or private device windows */ + if (hwnd && !This->focuswindow && !This->devicewindow && (hwnd != window)) + This->dest_window = hwnd; + if(cooplevel & DDSCL_CREATEDEVICEWINDOW) { /* Don't create a device window if a focus window is set */ @@ -716,11 +753,8 @@ static HRESULT WINAPI ddraw7_SetCooperativeLevel(IDirectDraw7 *iface, HWND hwnd, } } - if(cooplevel & DDSCL_MULTITHREADED && !(This->cooperative_level & DDSCL_MULTITHREADED)) - { - /* Enable thread safety in wined3d */ - IWineD3DDevice_SetMultithreaded(This->wineD3DDevice); - } + if (cooplevel & DDSCL_MULTITHREADED && !(This->cooperative_level & DDSCL_MULTITHREADED)) + wined3d_device_set_multithreaded(This->wined3d_device); /* Unhandled flags */ if(cooplevel & DDSCL_ALLOWREBOOT) @@ -731,7 +765,7 @@ static HRESULT WINAPI ddraw7_SetCooperativeLevel(IDirectDraw7 *iface, HWND hwnd, WARN("(%p) Unhandled flag DDSCL_FPUSETUP, harmless\n", This); /* Store the cooperative_level */ - This->cooperative_level |= cooplevel; + This->cooperative_level = cooplevel; TRACE("SetCooperativeLevel retuning DD_OK\n"); LeaveCriticalSection(&ddraw_cs); return DD_OK; @@ -739,30 +773,38 @@ static HRESULT WINAPI ddraw7_SetCooperativeLevel(IDirectDraw7 *iface, HWND hwnd, static HRESULT WINAPI ddraw4_SetCooperativeLevel(IDirectDraw4 *iface, HWND window, DWORD flags) { + IDirectDrawImpl *This = impl_from_IDirectDraw4(iface); + TRACE("iface %p, window %p, flags %#x.\n", iface, window, flags); - return ddraw7_SetCooperativeLevel((IDirectDraw7 *)ddraw_from_ddraw4(iface), window, flags); + return ddraw7_SetCooperativeLevel(&This->IDirectDraw7_iface, window, flags); } static HRESULT WINAPI ddraw3_SetCooperativeLevel(IDirectDraw3 *iface, HWND window, DWORD flags) { + IDirectDrawImpl *This = impl_from_IDirectDraw3(iface); + TRACE("iface %p, window %p, flags %#x.\n", iface, window, flags); - return ddraw7_SetCooperativeLevel((IDirectDraw7 *)ddraw_from_ddraw3(iface), window, flags); + return ddraw7_SetCooperativeLevel(&This->IDirectDraw7_iface, window, flags); } static HRESULT WINAPI ddraw2_SetCooperativeLevel(IDirectDraw2 *iface, HWND window, DWORD flags) { + IDirectDrawImpl *This = impl_from_IDirectDraw2(iface); + TRACE("iface %p, window %p, flags %#x.\n", iface, window, flags); - return ddraw7_SetCooperativeLevel((IDirectDraw7 *)ddraw_from_ddraw2(iface), window, flags); + return ddraw7_SetCooperativeLevel(&This->IDirectDraw7_iface, window, flags); } static HRESULT WINAPI ddraw1_SetCooperativeLevel(IDirectDraw *iface, HWND window, DWORD flags) { + IDirectDrawImpl *This = impl_from_IDirectDraw(iface); + TRACE("iface %p, window %p, flags %#x.\n", iface, window, flags); - return ddraw7_SetCooperativeLevel((IDirectDraw7 *)ddraw_from_ddraw1(iface), window, flags); + return ddraw7_SetCooperativeLevel(&This->IDirectDraw7_iface, window, flags); } /***************************************************************************** @@ -777,15 +819,15 @@ static HRESULT WINAPI ddraw1_SetCooperativeLevel(IDirectDraw *iface, HWND window * ddraw7_SetDisplayMode. * *****************************************************************************/ -static HRESULT ddraw_set_display_mode(IDirectDraw7 *iface, DWORD Width, DWORD Height, +static HRESULT ddraw_set_display_mode(IDirectDrawImpl *ddraw, DWORD Width, DWORD Height, DWORD BPP, DWORD RefreshRate, DWORD Flags) { - IDirectDrawImpl *This = (IDirectDrawImpl *)iface; + enum wined3d_format_id format; WINED3DDISPLAYMODE Mode; HRESULT hr; - TRACE("iface %p, width %u, height %u, bpp %u, refresh_rate %u, flags %#x.\n", - iface, Width, Height, BPP, RefreshRate, Flags); + TRACE("ddraw %p, width %u, height %u, bpp %u, refresh_rate %u, flags %#x.\n", ddraw, Width, + Height, BPP, RefreshRate, Flags); EnterCriticalSection(&ddraw_cs); if( !Width || !Height ) @@ -796,8 +838,32 @@ static HRESULT ddraw_set_display_mode(IDirectDraw7 *iface, DWORD Width, DWORD He return DD_OK; } + switch(BPP) + { + case 8: format = WINED3DFMT_P8_UINT; break; + case 15: format = WINED3DFMT_B5G5R5X1_UNORM; break; + case 16: format = WINED3DFMT_B5G6R5_UNORM; break; + case 24: format = WINED3DFMT_B8G8R8_UNORM; break; + case 32: format = WINED3DFMT_B8G8R8X8_UNORM; break; + default: format = WINED3DFMT_UNKNOWN; break; + } + + if (FAILED(hr = wined3d_device_get_display_mode(ddraw->wined3d_device, 0, &Mode))) + { + ERR("Failed to get current display mode, hr %#x.\n", hr); + } + else if (Mode.Width == Width + && Mode.Height == Height + && Mode.Format == format + && Mode.RefreshRate == RefreshRate) + { + TRACE("Skipping redundant mode setting call.\n"); + LeaveCriticalSection(&ddraw_cs); + return DD_OK; + } + /* Check the exclusive mode - if(!(This->cooperative_level & DDSCL_EXCLUSIVE)) + if(!(ddraw->cooperative_level & DDSCL_EXCLUSIVE)) return DDERR_NOEXCLUSIVEMODE; * This is WRONG. Don't know if the SDK is completely * wrong and if there are any conditions when DDERR_NOEXCLUSIVE @@ -808,14 +874,7 @@ static HRESULT ddraw_set_display_mode(IDirectDraw7 *iface, DWORD Width, DWORD He Mode.Width = Width; Mode.Height = Height; Mode.RefreshRate = RefreshRate; - switch(BPP) - { - case 8: Mode.Format = WINED3DFMT_P8_UINT; break; - case 15: Mode.Format = WINED3DFMT_B5G5R5X1_UNORM; break; - case 16: Mode.Format = WINED3DFMT_B5G6R5_UNORM; break; - case 24: Mode.Format = WINED3DFMT_B8G8R8_UNORM; break; - case 32: Mode.Format = WINED3DFMT_B8G8R8X8_UNORM; break; - } + Mode.Format = format; /* TODO: The possible return values from msdn suggest that * the screen mode can't be changed if a surface is locked @@ -823,9 +882,14 @@ static HRESULT ddraw_set_display_mode(IDirectDraw7 *iface, DWORD Width, DWORD He */ /* TODO: Lose the primary surface */ - hr = IWineD3DDevice_SetDisplayMode(This->wineD3DDevice, - 0, /* First swapchain */ - &Mode); + hr = wined3d_device_set_display_mode(ddraw->wined3d_device, 0, &Mode); + + if (ddraw->cooperative_level & DDSCL_EXCLUSIVE) + { + wined3d_device_restore_fullscreen_window(ddraw->wined3d_device, ddraw->dest_window); + wined3d_device_setup_fullscreen_window(ddraw->wined3d_device, ddraw->dest_window, Width, Height); + } + LeaveCriticalSection(&ddraw_cs); switch(hr) { @@ -859,6 +923,8 @@ static HRESULT ddraw_set_display_mode(IDirectDraw7 *iface, DWORD Width, DWORD He static HRESULT WINAPI ddraw7_SetDisplayMode(IDirectDraw7 *iface, DWORD Width, DWORD Height, DWORD BPP, DWORD RefreshRate, DWORD Flags) { + IDirectDrawImpl *This = impl_from_IDirectDraw7(iface); + TRACE("iface %p, width %u, height %u, bpp %u, refresh_rate %u, flags %#x.\n", iface, Width, Height, BPP, RefreshRate, Flags); @@ -869,44 +935,49 @@ static HRESULT WINAPI ddraw7_SetDisplayMode(IDirectDraw7 *iface, DWORD Width, DW RefreshRate = force_refresh_rate; } - return ddraw_set_display_mode(iface, Width, Height, BPP, RefreshRate, Flags); + return ddraw_set_display_mode(This, Width, Height, BPP, RefreshRate, Flags); } -static HRESULT WINAPI ddraw4_SetDisplayMode(IDirectDraw4 *iface, - DWORD width, DWORD height, DWORD bpp, DWORD refresh_rate, DWORD flags) +static HRESULT WINAPI ddraw4_SetDisplayMode(IDirectDraw4 *iface, DWORD width, DWORD height, + DWORD bpp, DWORD refresh_rate, DWORD flags) { + IDirectDrawImpl *This = impl_from_IDirectDraw4(iface); + TRACE("iface %p, width %u, height %u, bpp %u, refresh_rate %u, flags %#x.\n", iface, width, height, bpp, refresh_rate, flags); - return ddraw7_SetDisplayMode((IDirectDraw7 *)ddraw_from_ddraw4(iface), - width, height, bpp, refresh_rate, flags); + return ddraw7_SetDisplayMode(&This->IDirectDraw7_iface, width, height, bpp, refresh_rate, flags); } -static HRESULT WINAPI ddraw3_SetDisplayMode(IDirectDraw3 *iface, - DWORD width, DWORD height, DWORD bpp, DWORD refresh_rate, DWORD flags) +static HRESULT WINAPI ddraw3_SetDisplayMode(IDirectDraw3 *iface, DWORD width, DWORD height, + DWORD bpp, DWORD refresh_rate, DWORD flags) { + IDirectDrawImpl *This = impl_from_IDirectDraw3(iface); + TRACE("iface %p, width %u, height %u, bpp %u, refresh_rate %u, flags %#x.\n", iface, width, height, bpp, refresh_rate, flags); - return ddraw7_SetDisplayMode((IDirectDraw7 *)ddraw_from_ddraw3(iface), - width, height, bpp, refresh_rate, flags); + return ddraw7_SetDisplayMode(&This->IDirectDraw7_iface, width, height, bpp, refresh_rate, flags); } static HRESULT WINAPI ddraw2_SetDisplayMode(IDirectDraw2 *iface, DWORD width, DWORD height, DWORD bpp, DWORD refresh_rate, DWORD flags) { + IDirectDrawImpl *This = impl_from_IDirectDraw2(iface); + TRACE("iface %p, width %u, height %u, bpp %u, refresh_rate %u, flags %#x.\n", iface, width, height, bpp, refresh_rate, flags); - return ddraw7_SetDisplayMode((IDirectDraw7 *)ddraw_from_ddraw2(iface), - width, height, bpp, refresh_rate, flags); + return ddraw7_SetDisplayMode(&This->IDirectDraw7_iface, width, height, bpp, refresh_rate, flags); } static HRESULT WINAPI ddraw1_SetDisplayMode(IDirectDraw *iface, DWORD width, DWORD height, DWORD bpp) { + IDirectDrawImpl *This = impl_from_IDirectDraw(iface); + TRACE("iface %p, width %u, height %u, bpp %u.\n", iface, width, height, bpp); - return ddraw7_SetDisplayMode((IDirectDraw7 *)ddraw_from_ddraw1(iface), width, height, bpp, 0, 0); + return ddraw7_SetDisplayMode(&This->IDirectDraw7_iface, width, height, bpp, 0, 0); } /***************************************************************************** @@ -932,39 +1003,47 @@ static HRESULT WINAPI ddraw1_SetDisplayMode(IDirectDraw *iface, DWORD width, DWO *****************************************************************************/ static HRESULT WINAPI ddraw7_RestoreDisplayMode(IDirectDraw7 *iface) { - IDirectDrawImpl *This = (IDirectDrawImpl *)iface; + IDirectDrawImpl *This = impl_from_IDirectDraw7(iface); TRACE("iface %p.\n", iface); - return ddraw_set_display_mode(iface, This->orig_width, This->orig_height, This->orig_bpp, 0, 0); + return ddraw_set_display_mode(This, This->orig_width, This->orig_height, This->orig_bpp, 0, 0); } static HRESULT WINAPI ddraw4_RestoreDisplayMode(IDirectDraw4 *iface) { + IDirectDrawImpl *This = impl_from_IDirectDraw4(iface); + TRACE("iface %p.\n", iface); - return ddraw7_RestoreDisplayMode((IDirectDraw7 *)ddraw_from_ddraw4(iface)); + return ddraw7_RestoreDisplayMode(&This->IDirectDraw7_iface); } static HRESULT WINAPI ddraw3_RestoreDisplayMode(IDirectDraw3 *iface) { + IDirectDrawImpl *This = impl_from_IDirectDraw3(iface); + TRACE("iface %p.\n", iface); - return ddraw7_RestoreDisplayMode((IDirectDraw7 *)ddraw_from_ddraw3(iface)); + return ddraw7_RestoreDisplayMode(&This->IDirectDraw7_iface); } static HRESULT WINAPI ddraw2_RestoreDisplayMode(IDirectDraw2 *iface) { + IDirectDrawImpl *This = impl_from_IDirectDraw2(iface); + TRACE("iface %p.\n", iface); - return ddraw7_RestoreDisplayMode((IDirectDraw7 *)ddraw_from_ddraw2(iface)); + return ddraw7_RestoreDisplayMode(&This->IDirectDraw7_iface); } static HRESULT WINAPI ddraw1_RestoreDisplayMode(IDirectDraw *iface) { + IDirectDrawImpl *This = impl_from_IDirectDraw(iface); + TRACE("iface %p.\n", iface); - return ddraw7_RestoreDisplayMode((IDirectDraw7 *)ddraw_from_ddraw1(iface)); + return ddraw7_RestoreDisplayMode(&This->IDirectDraw7_iface); } /***************************************************************************** @@ -984,12 +1063,11 @@ static HRESULT WINAPI ddraw1_RestoreDisplayMode(IDirectDraw *iface) *****************************************************************************/ static HRESULT WINAPI ddraw7_GetCaps(IDirectDraw7 *iface, DDCAPS *DriverCaps, DDCAPS *HELCaps) { - IDirectDrawImpl *This = (IDirectDrawImpl *)iface; + IDirectDrawImpl *This = impl_from_IDirectDraw7(iface); DDCAPS caps; WINED3DCAPS winecaps; HRESULT hr; DDSCAPS2 ddscaps = {0, 0, 0, {0}}; - TRACE("(%p)->(%p,%p)\n", This, DriverCaps, HELCaps); TRACE("iface %p, driver_caps %p, hel_caps %p.\n", iface, DriverCaps, HELCaps); @@ -1004,8 +1082,9 @@ static HRESULT WINAPI ddraw7_GetCaps(IDirectDraw7 *iface, DDCAPS *DriverCaps, DD memset(&winecaps, 0, sizeof(winecaps)); caps.dwSize = sizeof(caps); EnterCriticalSection(&ddraw_cs); - hr = IWineD3DDevice_GetDeviceCaps(This->wineD3DDevice, &winecaps); - if(FAILED(hr)) { + hr = wined3d_device_get_device_caps(This->wined3d_device, &winecaps); + if (FAILED(hr)) + { WARN("IWineD3DDevice::GetDeviceCaps failed\n"); LeaveCriticalSection(&ddraw_cs); return hr; @@ -1071,30 +1150,38 @@ static HRESULT WINAPI ddraw7_GetCaps(IDirectDraw7 *iface, DDCAPS *DriverCaps, DD static HRESULT WINAPI ddraw4_GetCaps(IDirectDraw4 *iface, DDCAPS *driver_caps, DDCAPS *hel_caps) { + IDirectDrawImpl *This = impl_from_IDirectDraw4(iface); + TRACE("iface %p, driver_caps %p, hel_caps %p.\n", iface, driver_caps, hel_caps); - return ddraw7_GetCaps((IDirectDraw7 *)ddraw_from_ddraw4(iface), driver_caps, hel_caps); + return ddraw7_GetCaps(&This->IDirectDraw7_iface, driver_caps, hel_caps); } static HRESULT WINAPI ddraw3_GetCaps(IDirectDraw3 *iface, DDCAPS *driver_caps, DDCAPS *hel_caps) { + IDirectDrawImpl *This = impl_from_IDirectDraw3(iface); + TRACE("iface %p, driver_caps %p, hel_caps %p.\n", iface, driver_caps, hel_caps); - return ddraw7_GetCaps((IDirectDraw7 *)ddraw_from_ddraw3(iface), driver_caps, hel_caps); + return ddraw7_GetCaps(&This->IDirectDraw7_iface, driver_caps, hel_caps); } static HRESULT WINAPI ddraw2_GetCaps(IDirectDraw2 *iface, DDCAPS *driver_caps, DDCAPS *hel_caps) { + IDirectDrawImpl *This = impl_from_IDirectDraw2(iface); + TRACE("iface %p, driver_caps %p, hel_caps %p.\n", iface, driver_caps, hel_caps); - return ddraw7_GetCaps((IDirectDraw7 *)ddraw_from_ddraw2(iface), driver_caps, hel_caps); + return ddraw7_GetCaps(&This->IDirectDraw7_iface, driver_caps, hel_caps); } static HRESULT WINAPI ddraw1_GetCaps(IDirectDraw *iface, DDCAPS *driver_caps, DDCAPS *hel_caps) { + IDirectDrawImpl *This = impl_from_IDirectDraw(iface); + TRACE("iface %p, driver_caps %p, hel_caps %p.\n", iface, driver_caps, hel_caps); - return ddraw7_GetCaps((IDirectDraw7 *)ddraw_from_ddraw1(iface), driver_caps, hel_caps); + return ddraw7_GetCaps(&This->IDirectDraw7_iface, driver_caps, hel_caps); } /***************************************************************************** @@ -1115,30 +1202,38 @@ static HRESULT WINAPI ddraw7_Compact(IDirectDraw7 *iface) static HRESULT WINAPI ddraw4_Compact(IDirectDraw4 *iface) { + IDirectDrawImpl *This = impl_from_IDirectDraw4(iface); + TRACE("iface %p.\n", iface); - return ddraw7_Compact((IDirectDraw7 *)ddraw_from_ddraw4(iface)); + return ddraw7_Compact(&This->IDirectDraw7_iface); } static HRESULT WINAPI ddraw3_Compact(IDirectDraw3 *iface) { + IDirectDrawImpl *This = impl_from_IDirectDraw3(iface); + TRACE("iface %p.\n", iface); - return ddraw7_Compact((IDirectDraw7 *)ddraw_from_ddraw3(iface)); + return ddraw7_Compact(&This->IDirectDraw7_iface); } static HRESULT WINAPI ddraw2_Compact(IDirectDraw2 *iface) { + IDirectDrawImpl *This = impl_from_IDirectDraw2(iface); + TRACE("iface %p.\n", iface); - return ddraw7_Compact((IDirectDraw7 *)ddraw_from_ddraw2(iface)); + return ddraw7_Compact(&This->IDirectDraw7_iface); } static HRESULT WINAPI ddraw1_Compact(IDirectDraw *iface) { + IDirectDrawImpl *This = impl_from_IDirectDraw(iface); + TRACE("iface %p.\n", iface); - return ddraw7_Compact((IDirectDraw7 *)ddraw_from_ddraw1(iface)); + return ddraw7_Compact(&This->IDirectDraw7_iface); } /***************************************************************************** @@ -1157,7 +1252,7 @@ static HRESULT WINAPI ddraw1_Compact(IDirectDraw *iface) *****************************************************************************/ static HRESULT WINAPI ddraw7_GetDisplayMode(IDirectDraw7 *iface, DDSURFACEDESC2 *DDSD) { - IDirectDrawImpl *This = (IDirectDrawImpl *)iface; + IDirectDrawImpl *This = impl_from_IDirectDraw7(iface); HRESULT hr; WINED3DDISPLAYMODE Mode; DWORD Size; @@ -1173,12 +1268,9 @@ static HRESULT WINAPI ddraw7_GetDisplayMode(IDirectDraw7 *iface, DDSURFACEDESC2 } /* The necessary members of LPDDSURFACEDESC and LPDDSURFACEDESC2 are equal, - * so one method can be used for all versions (Hopefully) - */ - hr = IWineD3DDevice_GetDisplayMode(This->wineD3DDevice, - 0 /* swapchain 0 */, - &Mode); - if( hr != D3D_OK ) + * so one method can be used for all versions (Hopefully) */ + hr = wined3d_device_get_display_mode(This->wined3d_device, 0, &Mode); + if (FAILED(hr)) { ERR(" (%p) IWineD3DDevice::GetDisplayMode returned %08x\n", This, hr); LeaveCriticalSection(&ddraw_cs); @@ -1210,30 +1302,38 @@ static HRESULT WINAPI ddraw7_GetDisplayMode(IDirectDraw7 *iface, DDSURFACEDESC2 static HRESULT WINAPI ddraw4_GetDisplayMode(IDirectDraw4 *iface, DDSURFACEDESC2 *surface_desc) { + IDirectDrawImpl *This = impl_from_IDirectDraw4(iface); + TRACE("iface %p, surface_desc %p.\n", iface, surface_desc); - return ddraw7_GetDisplayMode((IDirectDraw7 *)ddraw_from_ddraw4(iface), surface_desc); + return ddraw7_GetDisplayMode(&This->IDirectDraw7_iface, surface_desc); } static HRESULT WINAPI ddraw3_GetDisplayMode(IDirectDraw3 *iface, DDSURFACEDESC *surface_desc) { + IDirectDrawImpl *This = impl_from_IDirectDraw3(iface); + TRACE("iface %p, surface_desc %p.\n", iface, surface_desc); - return ddraw7_GetDisplayMode((IDirectDraw7 *)ddraw_from_ddraw3(iface), (DDSURFACEDESC2 *)surface_desc); + return ddraw7_GetDisplayMode(&This->IDirectDraw7_iface, (DDSURFACEDESC2 *)surface_desc); } static HRESULT WINAPI ddraw2_GetDisplayMode(IDirectDraw2 *iface, DDSURFACEDESC *surface_desc) { + IDirectDrawImpl *This = impl_from_IDirectDraw2(iface); + TRACE("iface %p, surface_desc %p.\n", iface, surface_desc); - return ddraw7_GetDisplayMode((IDirectDraw7 *)ddraw_from_ddraw2(iface), (DDSURFACEDESC2 *)surface_desc); + return ddraw7_GetDisplayMode(&This->IDirectDraw7_iface, (DDSURFACEDESC2 *)surface_desc); } static HRESULT WINAPI ddraw1_GetDisplayMode(IDirectDraw *iface, DDSURFACEDESC *surface_desc) { + IDirectDrawImpl *This = impl_from_IDirectDraw(iface); + TRACE("iface %p, surface_desc %p.\n", iface, surface_desc); - return ddraw7_GetDisplayMode((IDirectDraw7 *)ddraw_from_ddraw1(iface), (DDSURFACEDESC2 *)surface_desc); + return ddraw7_GetDisplayMode(&This->IDirectDraw7_iface, (DDSURFACEDESC2 *)surface_desc); } /***************************************************************************** @@ -1255,7 +1355,7 @@ static HRESULT WINAPI ddraw1_GetDisplayMode(IDirectDraw *iface, DDSURFACEDESC *s *****************************************************************************/ static HRESULT WINAPI ddraw7_GetFourCCCodes(IDirectDraw7 *iface, DWORD *NumCodes, DWORD *Codes) { - IDirectDrawImpl *This = (IDirectDrawImpl *)iface; + IDirectDrawImpl *This = impl_from_IDirectDraw7(iface); static const enum wined3d_format_id formats[] = { WINED3DFMT_YUY2, WINED3DFMT_UYVY, WINED3DFMT_YV12, @@ -1269,28 +1369,21 @@ static HRESULT WINAPI ddraw7_GetFourCCCodes(IDirectDraw7 *iface, DWORD *NumCodes TRACE("iface %p, codes_count %p, codes %p.\n", iface, NumCodes, Codes); - IWineD3DDevice_GetDisplayMode(This->wineD3DDevice, - 0 /* swapchain 0 */, - &d3ddm); + wined3d_device_get_display_mode(This->wined3d_device, 0, &d3ddm); outsize = NumCodes && Codes ? *NumCodes : 0; if(type == SURFACE_UNKNOWN) type = SURFACE_GDI; - for(i = 0; i < (sizeof(formats) / sizeof(formats[0])); i++) { - hr = IWineD3D_CheckDeviceFormat(This->wineD3D, - WINED3DADAPTER_DEFAULT, - WINED3DDEVTYPE_HAL, - d3ddm.Format /* AdapterFormat */, - 0 /* usage */, - WINED3DRTYPE_SURFACE, - formats[i], - type); - if(SUCCEEDED(hr)) { - if(count < outsize) { + for (i = 0; i < (sizeof(formats) / sizeof(formats[0])); ++i) + { + hr = wined3d_check_device_format(This->wineD3D, WINED3DADAPTER_DEFAULT, WINED3DDEVTYPE_HAL, + d3ddm.Format, 0, WINED3DRTYPE_SURFACE, formats[i], type); + if (SUCCEEDED(hr)) + { + if (count < outsize) Codes[count] = formats[i]; - } - count++; + ++count; } } if(NumCodes) { @@ -1303,30 +1396,38 @@ static HRESULT WINAPI ddraw7_GetFourCCCodes(IDirectDraw7 *iface, DWORD *NumCodes static HRESULT WINAPI ddraw4_GetFourCCCodes(IDirectDraw4 *iface, DWORD *codes_count, DWORD *codes) { + IDirectDrawImpl *This = impl_from_IDirectDraw4(iface); + TRACE("iface %p, codes_count %p, codes %p.\n", iface, codes_count, codes); - return ddraw7_GetFourCCCodes((IDirectDraw7 *)ddraw_from_ddraw4(iface), codes_count, codes); + return ddraw7_GetFourCCCodes(&This->IDirectDraw7_iface, codes_count, codes); } static HRESULT WINAPI ddraw3_GetFourCCCodes(IDirectDraw3 *iface, DWORD *codes_count, DWORD *codes) { + IDirectDrawImpl *This = impl_from_IDirectDraw3(iface); + TRACE("iface %p, codes_count %p, codes %p.\n", iface, codes_count, codes); - return ddraw7_GetFourCCCodes((IDirectDraw7 *)ddraw_from_ddraw3(iface), codes_count, codes); + return ddraw7_GetFourCCCodes(&This->IDirectDraw7_iface, codes_count, codes); } static HRESULT WINAPI ddraw2_GetFourCCCodes(IDirectDraw2 *iface, DWORD *codes_count, DWORD *codes) { + IDirectDrawImpl *This = impl_from_IDirectDraw2(iface); + TRACE("iface %p, codes_count %p, codes %p.\n", iface, codes_count, codes); - return ddraw7_GetFourCCCodes((IDirectDraw7 *)ddraw_from_ddraw2(iface), codes_count, codes); + return ddraw7_GetFourCCCodes(&This->IDirectDraw7_iface, codes_count, codes); } static HRESULT WINAPI ddraw1_GetFourCCCodes(IDirectDraw *iface, DWORD *codes_count, DWORD *codes) { + IDirectDrawImpl *This = impl_from_IDirectDraw(iface); + TRACE("iface %p, codes_count %p, codes %p.\n", iface, codes_count, codes); - return ddraw7_GetFourCCCodes((IDirectDraw7 *)ddraw_from_ddraw1(iface), codes_count, codes); + return ddraw7_GetFourCCCodes(&This->IDirectDraw7_iface, codes_count, codes); } /***************************************************************************** @@ -1356,30 +1457,38 @@ static HRESULT WINAPI ddraw7_GetMonitorFrequency(IDirectDraw7 *iface, DWORD *Fre static HRESULT WINAPI ddraw4_GetMonitorFrequency(IDirectDraw4 *iface, DWORD *frequency) { + IDirectDrawImpl *This = impl_from_IDirectDraw4(iface); + TRACE("iface %p, frequency %p.\n", iface, frequency); - return ddraw7_GetMonitorFrequency((IDirectDraw7 *)ddraw_from_ddraw4(iface), frequency); + return ddraw7_GetMonitorFrequency(&This->IDirectDraw7_iface, frequency); } static HRESULT WINAPI ddraw3_GetMonitorFrequency(IDirectDraw3 *iface, DWORD *frequency) { + IDirectDrawImpl *This = impl_from_IDirectDraw3(iface); + TRACE("iface %p, frequency %p.\n", iface, frequency); - return ddraw7_GetMonitorFrequency((IDirectDraw7 *)ddraw_from_ddraw3(iface), frequency); + return ddraw7_GetMonitorFrequency(&This->IDirectDraw7_iface, frequency); } static HRESULT WINAPI ddraw2_GetMonitorFrequency(IDirectDraw2 *iface, DWORD *frequency) { + IDirectDrawImpl *This = impl_from_IDirectDraw2(iface); + TRACE("iface %p, frequency %p.\n", iface, frequency); - return ddraw7_GetMonitorFrequency((IDirectDraw7 *)ddraw_from_ddraw2(iface), frequency); + return ddraw7_GetMonitorFrequency(&This->IDirectDraw7_iface, frequency); } static HRESULT WINAPI ddraw1_GetMonitorFrequency(IDirectDraw *iface, DWORD *frequency) { + IDirectDrawImpl *This = impl_from_IDirectDraw(iface); + TRACE("iface %p, frequency %p.\n", iface, frequency); - return ddraw7_GetMonitorFrequency((IDirectDraw7 *)ddraw_from_ddraw1(iface), frequency); + return ddraw7_GetMonitorFrequency(&This->IDirectDraw7_iface, frequency); } /***************************************************************************** @@ -1398,7 +1507,7 @@ static HRESULT WINAPI ddraw1_GetMonitorFrequency(IDirectDraw *iface, DWORD *freq *****************************************************************************/ static HRESULT WINAPI ddraw7_GetVerticalBlankStatus(IDirectDraw7 *iface, BOOL *status) { - IDirectDrawImpl *This = (IDirectDrawImpl *)iface; + IDirectDrawImpl *This = impl_from_IDirectDraw7(iface); TRACE("iface %p, status %p.\n", iface, status); @@ -1418,30 +1527,38 @@ static HRESULT WINAPI ddraw7_GetVerticalBlankStatus(IDirectDraw7 *iface, BOOL *s static HRESULT WINAPI ddraw4_GetVerticalBlankStatus(IDirectDraw4 *iface, BOOL *status) { + IDirectDrawImpl *This = impl_from_IDirectDraw4(iface); + TRACE("iface %p, status %p.\n", iface, status); - return ddraw7_GetVerticalBlankStatus((IDirectDraw7 *)ddraw_from_ddraw4(iface), status); + return ddraw7_GetVerticalBlankStatus(&This->IDirectDraw7_iface, status); } static HRESULT WINAPI ddraw3_GetVerticalBlankStatus(IDirectDraw3 *iface, BOOL *status) { + IDirectDrawImpl *This = impl_from_IDirectDraw3(iface); + TRACE("iface %p, status %p.\n", iface, status); - return ddraw7_GetVerticalBlankStatus((IDirectDraw7 *)ddraw_from_ddraw3(iface), status); + return ddraw7_GetVerticalBlankStatus(&This->IDirectDraw7_iface, status); } static HRESULT WINAPI ddraw2_GetVerticalBlankStatus(IDirectDraw2 *iface, BOOL *status) { + IDirectDrawImpl *This = impl_from_IDirectDraw2(iface); + TRACE("iface %p, status %p.\n", iface, status); - return ddraw7_GetVerticalBlankStatus((IDirectDraw7 *)ddraw_from_ddraw2(iface), status); + return ddraw7_GetVerticalBlankStatus(&This->IDirectDraw7_iface, status); } static HRESULT WINAPI ddraw1_GetVerticalBlankStatus(IDirectDraw *iface, BOOL *status) { + IDirectDrawImpl *This = impl_from_IDirectDraw(iface); + TRACE("iface %p, status %p.\n", iface, status); - return ddraw7_GetVerticalBlankStatus((IDirectDraw7 *)ddraw_from_ddraw1(iface), status); + return ddraw7_GetVerticalBlankStatus(&This->IDirectDraw7_iface, status); } /***************************************************************************** @@ -1459,9 +1576,10 @@ static HRESULT WINAPI ddraw1_GetVerticalBlankStatus(IDirectDraw *iface, BOOL *st * DDERR_INVALIDPARAMS of free and total are NULL * *****************************************************************************/ -static HRESULT WINAPI ddraw7_GetAvailableVidMem(IDirectDraw7 *iface, DDSCAPS2 *Caps, DWORD *total, DWORD *free) +static HRESULT WINAPI ddraw7_GetAvailableVidMem(IDirectDraw7 *iface, DDSCAPS2 *Caps, DWORD *total, + DWORD *free) { - IDirectDrawImpl *This = (IDirectDrawImpl *)iface; + IDirectDrawImpl *This = impl_from_IDirectDraw7(iface); TRACE("iface %p, caps %p, total %p, free %p.\n", iface, Caps, total, free); @@ -1483,8 +1601,10 @@ static HRESULT WINAPI ddraw7_GetAvailableVidMem(IDirectDraw7 *iface, DDSCAPS2 *C return DDERR_INVALIDPARAMS; } - if(total) *total = This->total_vidmem; - if(free) *free = IWineD3DDevice_GetAvailableTextureMem(This->wineD3DDevice); + if (total) + *total = This->total_vidmem; + if (free) + *free = wined3d_device_get_available_texture_mem(This->wined3d_device); LeaveCriticalSection(&ddraw_cs); return DD_OK; @@ -1493,31 +1613,35 @@ static HRESULT WINAPI ddraw7_GetAvailableVidMem(IDirectDraw7 *iface, DDSCAPS2 *C static HRESULT WINAPI ddraw4_GetAvailableVidMem(IDirectDraw4 *iface, DDSCAPS2 *caps, DWORD *total, DWORD *free) { + IDirectDrawImpl *This = impl_from_IDirectDraw4(iface); + TRACE("iface %p, caps %p, total %p, free %p.\n", iface, caps, total, free); - return ddraw7_GetAvailableVidMem((IDirectDraw7 *)ddraw_from_ddraw4(iface), caps, total, free); + return ddraw7_GetAvailableVidMem(&This->IDirectDraw7_iface, caps, total, free); } -static HRESULT WINAPI ddraw3_GetAvailableVidMem(IDirectDraw3 *iface, - DDSCAPS *caps, DWORD *total, DWORD *free) +static HRESULT WINAPI ddraw3_GetAvailableVidMem(IDirectDraw3 *iface, DDSCAPS *caps, DWORD *total, + DWORD *free) { + IDirectDrawImpl *This = impl_from_IDirectDraw3(iface); DDSCAPS2 caps2; TRACE("iface %p, caps %p, total %p, free %p.\n", iface, caps, total, free); DDRAW_Convert_DDSCAPS_1_To_2(caps, &caps2); - return ddraw7_GetAvailableVidMem((IDirectDraw7 *)ddraw_from_ddraw3(iface), &caps2, total, free); + return ddraw7_GetAvailableVidMem(&This->IDirectDraw7_iface, &caps2, total, free); } static HRESULT WINAPI ddraw2_GetAvailableVidMem(IDirectDraw2 *iface, DDSCAPS *caps, DWORD *total, DWORD *free) { + IDirectDrawImpl *This = impl_from_IDirectDraw2(iface); DDSCAPS2 caps2; TRACE("iface %p, caps %p, total %p, free %p.\n", iface, caps, total, free); DDRAW_Convert_DDSCAPS_1_To_2(caps, &caps2); - return ddraw7_GetAvailableVidMem((IDirectDraw7 *)ddraw_from_ddraw2(iface), &caps2, total, free); + return ddraw7_GetAvailableVidMem(&This->IDirectDraw7_iface, &caps2, total, free); } /***************************************************************************** @@ -1536,7 +1660,7 @@ static HRESULT WINAPI ddraw2_GetAvailableVidMem(IDirectDraw2 *iface, *****************************************************************************/ static HRESULT WINAPI ddraw7_Initialize(IDirectDraw7 *iface, GUID *Guid) { - IDirectDrawImpl *This = (IDirectDrawImpl *)iface; + IDirectDrawImpl *This = impl_from_IDirectDraw7(iface); TRACE("iface %p, guid %s.\n", iface, debugstr_guid(Guid)); @@ -1552,30 +1676,38 @@ static HRESULT WINAPI ddraw7_Initialize(IDirectDraw7 *iface, GUID *Guid) static HRESULT WINAPI ddraw4_Initialize(IDirectDraw4 *iface, GUID *guid) { + IDirectDrawImpl *This = impl_from_IDirectDraw4(iface); + TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid)); - return ddraw7_Initialize((IDirectDraw7 *)ddraw_from_ddraw4(iface), guid); + return ddraw7_Initialize(&This->IDirectDraw7_iface, guid); } static HRESULT WINAPI ddraw3_Initialize(IDirectDraw3 *iface, GUID *guid) { + IDirectDrawImpl *This = impl_from_IDirectDraw3(iface); + TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid)); - return ddraw7_Initialize((IDirectDraw7 *)ddraw_from_ddraw3(iface), guid); + return ddraw7_Initialize(&This->IDirectDraw7_iface, guid); } static HRESULT WINAPI ddraw2_Initialize(IDirectDraw2 *iface, GUID *guid) { + IDirectDrawImpl *This = impl_from_IDirectDraw2(iface); + TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid)); - return ddraw7_Initialize((IDirectDraw7 *)ddraw_from_ddraw2(iface), guid); + return ddraw7_Initialize(&This->IDirectDraw7_iface, guid); } static HRESULT WINAPI ddraw1_Initialize(IDirectDraw *iface, GUID *guid) { + IDirectDrawImpl *This = impl_from_IDirectDraw(iface); + TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid)); - return ddraw7_Initialize((IDirectDraw7 *)ddraw_from_ddraw1(iface), guid); + return ddraw7_Initialize(&This->IDirectDraw7_iface, guid); } static HRESULT WINAPI d3d1_Initialize(IDirect3D *iface, REFIID riid) @@ -1607,30 +1739,38 @@ static HRESULT WINAPI ddraw7_FlipToGDISurface(IDirectDraw7 *iface) static HRESULT WINAPI ddraw4_FlipToGDISurface(IDirectDraw4 *iface) { + IDirectDrawImpl *This = impl_from_IDirectDraw4(iface); + TRACE("iface %p.\n", iface); - return ddraw7_FlipToGDISurface((IDirectDraw7 *)ddraw_from_ddraw4(iface)); + return ddraw7_FlipToGDISurface(&This->IDirectDraw7_iface); } static HRESULT WINAPI ddraw3_FlipToGDISurface(IDirectDraw3 *iface) { + IDirectDrawImpl *This = impl_from_IDirectDraw3(iface); + TRACE("iface %p.\n", iface); - return ddraw7_FlipToGDISurface((IDirectDraw7 *)ddraw_from_ddraw3(iface)); + return ddraw7_FlipToGDISurface(&This->IDirectDraw7_iface); } static HRESULT WINAPI ddraw2_FlipToGDISurface(IDirectDraw2 *iface) { + IDirectDrawImpl *This = impl_from_IDirectDraw2(iface); + TRACE("iface %p.\n", iface); - return ddraw7_FlipToGDISurface((IDirectDraw7 *)ddraw_from_ddraw2(iface)); + return ddraw7_FlipToGDISurface(&This->IDirectDraw7_iface); } static HRESULT WINAPI ddraw1_FlipToGDISurface(IDirectDraw *iface) { + IDirectDrawImpl *This = impl_from_IDirectDraw(iface); + TRACE("iface %p.\n", iface); - return ddraw7_FlipToGDISurface((IDirectDraw7 *)ddraw_from_ddraw1(iface)); + return ddraw7_FlipToGDISurface(&This->IDirectDraw7_iface); } /***************************************************************************** @@ -1672,30 +1812,38 @@ static HRESULT WINAPI ddraw7_WaitForVerticalBlank(IDirectDraw7 *iface, DWORD Fla static HRESULT WINAPI ddraw4_WaitForVerticalBlank(IDirectDraw4 *iface, DWORD flags, HANDLE event) { + IDirectDrawImpl *This = impl_from_IDirectDraw4(iface); + TRACE("iface %p, flags %#x, event %p.\n", iface, flags, event); - return ddraw7_WaitForVerticalBlank((IDirectDraw7 *)ddraw_from_ddraw4(iface), flags, event); + return ddraw7_WaitForVerticalBlank(&This->IDirectDraw7_iface, flags, event); } static HRESULT WINAPI ddraw3_WaitForVerticalBlank(IDirectDraw3 *iface, DWORD flags, HANDLE event) { + IDirectDrawImpl *This = impl_from_IDirectDraw3(iface); + TRACE("iface %p, flags %#x, event %p.\n", iface, flags, event); - return ddraw7_WaitForVerticalBlank((IDirectDraw7 *)ddraw_from_ddraw3(iface), flags, event); + return ddraw7_WaitForVerticalBlank(&This->IDirectDraw7_iface, flags, event); } static HRESULT WINAPI ddraw2_WaitForVerticalBlank(IDirectDraw2 *iface, DWORD flags, HANDLE event) { + IDirectDrawImpl *This = impl_from_IDirectDraw2(iface); + TRACE("iface %p, flags %#x, event %p.\n", iface, flags, event); - return ddraw7_WaitForVerticalBlank((IDirectDraw7 *)ddraw_from_ddraw2(iface), flags, event); + return ddraw7_WaitForVerticalBlank(&This->IDirectDraw7_iface, flags, event); } static HRESULT WINAPI ddraw1_WaitForVerticalBlank(IDirectDraw *iface, DWORD flags, HANDLE event) { + IDirectDrawImpl *This = impl_from_IDirectDraw(iface); + TRACE("iface %p, flags %#x, event %p.\n", iface, flags, event); - return ddraw7_WaitForVerticalBlank((IDirectDraw7 *)ddraw_from_ddraw1(iface), flags, event); + return ddraw7_WaitForVerticalBlank(&This->IDirectDraw7_iface, flags, event); } /***************************************************************************** @@ -1712,7 +1860,7 @@ static HRESULT WINAPI ddraw1_WaitForVerticalBlank(IDirectDraw *iface, DWORD flag *****************************************************************************/ static HRESULT WINAPI ddraw7_GetScanLine(IDirectDraw7 *iface, DWORD *Scanline) { - IDirectDrawImpl *This = (IDirectDrawImpl *)iface; + IDirectDrawImpl *This = impl_from_IDirectDraw7(iface); static BOOL hide = FALSE; WINED3DDISPLAYMODE Mode; @@ -1726,9 +1874,7 @@ static HRESULT WINAPI ddraw7_GetScanLine(IDirectDraw7 *iface, DWORD *Scanline) hide = TRUE; } - IWineD3DDevice_GetDisplayMode(This->wineD3DDevice, - 0, - &Mode); + wined3d_device_get_display_mode(This->wined3d_device, 0, &Mode); /* Fake the line sweeping of the monitor */ /* FIXME: We should synchronize with a source to keep the refresh rate */ @@ -1743,30 +1889,38 @@ static HRESULT WINAPI ddraw7_GetScanLine(IDirectDraw7 *iface, DWORD *Scanline) static HRESULT WINAPI ddraw4_GetScanLine(IDirectDraw4 *iface, DWORD *line) { + IDirectDrawImpl *This = impl_from_IDirectDraw4(iface); + TRACE("iface %p, line %p.\n", iface, line); - return ddraw7_GetScanLine((IDirectDraw7 *)ddraw_from_ddraw4(iface), line); + return ddraw7_GetScanLine(&This->IDirectDraw7_iface, line); } static HRESULT WINAPI ddraw3_GetScanLine(IDirectDraw3 *iface, DWORD *line) { + IDirectDrawImpl *This = impl_from_IDirectDraw3(iface); + TRACE("iface %p, line %p.\n", iface, line); - return ddraw7_GetScanLine((IDirectDraw7 *)ddraw_from_ddraw3(iface), line); + return ddraw7_GetScanLine(&This->IDirectDraw7_iface, line); } static HRESULT WINAPI ddraw2_GetScanLine(IDirectDraw2 *iface, DWORD *line) { + IDirectDrawImpl *This = impl_from_IDirectDraw2(iface); + TRACE("iface %p, line %p.\n", iface, line); - return ddraw7_GetScanLine((IDirectDraw7 *)ddraw_from_ddraw2(iface), line); + return ddraw7_GetScanLine(&This->IDirectDraw7_iface, line); } static HRESULT WINAPI ddraw1_GetScanLine(IDirectDraw *iface, DWORD *line) { + IDirectDrawImpl *This = impl_from_IDirectDraw(iface); + TRACE("iface %p, line %p.\n", iface, line); - return ddraw7_GetScanLine((IDirectDraw7 *)ddraw_from_ddraw1(iface), line); + return ddraw7_GetScanLine(&This->IDirectDraw7_iface, line); } /***************************************************************************** @@ -1790,9 +1944,11 @@ static HRESULT WINAPI ddraw7_TestCooperativeLevel(IDirectDraw7 *iface) static HRESULT WINAPI ddraw4_TestCooperativeLevel(IDirectDraw4 *iface) { + IDirectDrawImpl *This = impl_from_IDirectDraw4(iface); + TRACE("iface %p.\n", iface); - return ddraw7_TestCooperativeLevel((IDirectDraw7 *)ddraw_from_ddraw4(iface)); + return ddraw7_TestCooperativeLevel(&This->IDirectDraw7_iface); } /***************************************************************************** @@ -1811,8 +1967,8 @@ static HRESULT WINAPI ddraw4_TestCooperativeLevel(IDirectDraw4 *iface) *****************************************************************************/ static HRESULT WINAPI ddraw7_GetGDISurface(IDirectDraw7 *iface, IDirectDrawSurface7 **GDISurface) { - IDirectDrawImpl *This = (IDirectDrawImpl *)iface; - IWineD3DSurface *Surf; + IDirectDrawImpl *This = impl_from_IDirectDraw7(iface); + struct wined3d_surface *wined3d_surface; IDirectDrawSurface7 *ddsurf; HRESULT hr; DDSCAPS2 ddsCaps; @@ -1820,25 +1976,19 @@ static HRESULT WINAPI ddraw7_GetGDISurface(IDirectDraw7 *iface, IDirectDrawSurfa TRACE("iface %p, surface %p.\n", iface, GDISurface); /* Get the back buffer from the wineD3DDevice and search its - * attached surfaces for the front buffer - */ + * attached surfaces for the front buffer. */ EnterCriticalSection(&ddraw_cs); - hr = IWineD3DDevice_GetBackBuffer(This->wineD3DDevice, - 0, /* SwapChain */ - 0, /* first back buffer*/ - WINED3DBACKBUFFER_TYPE_MONO, - &Surf); - - if( (hr != D3D_OK) || - (!Surf) ) + hr = wined3d_device_get_back_buffer(This->wined3d_device, + 0, 0, WINED3DBACKBUFFER_TYPE_MONO, &wined3d_surface); + if (FAILED(hr) || !wined3d_surface) { ERR("IWineD3DDevice::GetBackBuffer failed\n"); LeaveCriticalSection(&ddraw_cs); return DDERR_NOTFOUND; } - ddsurf = IWineD3DSurface_GetParent(Surf); - IWineD3DSurface_Release(Surf); + ddsurf = wined3d_surface_get_parent(wined3d_surface); + wined3d_surface_decref(wined3d_surface); /* Find the front buffer */ ddsCaps.dwCaps = DDSCAPS_FRONTBUFFER; @@ -1857,19 +2007,22 @@ static HRESULT WINAPI ddraw7_GetGDISurface(IDirectDraw7 *iface, IDirectDrawSurfa static HRESULT WINAPI ddraw4_GetGDISurface(IDirectDraw4 *iface, IDirectDrawSurface4 **surface) { + IDirectDrawImpl *This = impl_from_IDirectDraw4(iface); + TRACE("iface %p, surface %p.\n", iface, surface); - return ddraw7_GetGDISurface((IDirectDraw7 *)ddraw_from_ddraw4(iface), (IDirectDrawSurface7 **)surface); + return ddraw7_GetGDISurface(&This->IDirectDraw7_iface, (IDirectDrawSurface7 **)surface); } static HRESULT WINAPI ddraw3_GetGDISurface(IDirectDraw3 *iface, IDirectDrawSurface **surface) { + IDirectDrawImpl *This = impl_from_IDirectDraw3(iface); IDirectDrawSurface7 *surface7; HRESULT hr; TRACE("iface %p, surface %p.\n", iface, surface); - hr = ddraw7_GetGDISurface((IDirectDraw7 *)ddraw_from_ddraw3(iface), &surface7); + hr = ddraw7_GetGDISurface(&This->IDirectDraw7_iface, &surface7); *surface = surface7 ? (IDirectDrawSurface *)&((IDirectDrawSurfaceImpl *)surface7)->IDirectDrawSurface3_vtbl : NULL; return hr; @@ -1877,12 +2030,13 @@ static HRESULT WINAPI ddraw3_GetGDISurface(IDirectDraw3 *iface, IDirectDrawSurfa static HRESULT WINAPI ddraw2_GetGDISurface(IDirectDraw2 *iface, IDirectDrawSurface **surface) { + IDirectDrawImpl *This = impl_from_IDirectDraw2(iface); IDirectDrawSurface7 *surface7; HRESULT hr; TRACE("iface %p, surface %p.\n", iface, surface); - hr = ddraw7_GetGDISurface((IDirectDraw7 *)ddraw_from_ddraw2(iface), &surface7); + hr = ddraw7_GetGDISurface(&This->IDirectDraw7_iface, &surface7); *surface = surface7 ? (IDirectDrawSurface *)&((IDirectDrawSurfaceImpl *)surface7)->IDirectDrawSurface3_vtbl : NULL; return hr; @@ -1890,12 +2044,13 @@ static HRESULT WINAPI ddraw2_GetGDISurface(IDirectDraw2 *iface, IDirectDrawSurfa static HRESULT WINAPI ddraw1_GetGDISurface(IDirectDraw *iface, IDirectDrawSurface **surface) { + IDirectDrawImpl *This = impl_from_IDirectDraw(iface); IDirectDrawSurface7 *surface7; HRESULT hr; TRACE("iface %p, surface %p.\n", iface, surface); - hr = ddraw7_GetGDISurface((IDirectDraw7 *)ddraw_from_ddraw1(iface), &surface7); + hr = ddraw7_GetGDISurface(&This->IDirectDraw7_iface, &surface7); *surface = surface7 ? (IDirectDrawSurface *)&((IDirectDrawSurfaceImpl *)surface7)->IDirectDrawSurface3_vtbl : NULL; return hr; @@ -1925,7 +2080,8 @@ static HRESULT CALLBACK EnumDisplayModesCallbackThunk(DDSURFACEDESC2 *surface_de * the DDSD parameter. * * Params: - * Flags: can be DDEDM_REFRESHRATES and DDEDM_STANDARDVGAMODES + * Flags: can be DDEDM_REFRESHRATES and DDEDM_STANDARDVGAMODES. For old ddraw + * versions (3 and older?) this is reserved and must be 0. * DDSD: Surface description to filter the modes * Context: Pointer passed back to the callback function * cb: Application-provided callback function @@ -1938,13 +2094,13 @@ static HRESULT CALLBACK EnumDisplayModesCallbackThunk(DDSURFACEDESC2 *surface_de static HRESULT WINAPI ddraw7_EnumDisplayModes(IDirectDraw7 *iface, DWORD Flags, DDSURFACEDESC2 *DDSD, void *Context, LPDDENUMMODESCALLBACK2 cb) { - IDirectDrawImpl *This = (IDirectDrawImpl *)iface; + IDirectDrawImpl *This = impl_from_IDirectDraw7(iface); unsigned int modenum, fmt; - enum wined3d_format_id pixelformat = WINED3DFMT_UNKNOWN; WINED3DDISPLAYMODE mode; DDSURFACEDESC2 callback_sd; WINED3DDISPLAYMODE *enum_modes = NULL; unsigned enum_mode_count = 0, enum_mode_array_size = 0; + DDPIXELFORMAT pixelformat; static const enum wined3d_format_id checkFormatList[] = { @@ -1964,12 +2120,6 @@ static HRESULT WINAPI ddraw7_EnumDisplayModes(IDirectDraw7 *iface, DWORD Flags, return DDERR_INVALIDPARAMS; } - if(DDSD) - { - if ((DDSD->dwFlags & DDSD_PIXELFORMAT) && (DDSD->u4.ddpfPixelFormat.dwFlags & DDPF_RGB) ) - pixelformat = PixelFormat_DD2WineD3D(&DDSD->u4.ddpfPixelFormat); - } - if(!(Flags & DDEDM_REFRESHRATES)) { enum_mode_array_size = 16; @@ -1982,24 +2132,21 @@ static HRESULT WINAPI ddraw7_EnumDisplayModes(IDirectDraw7 *iface, DWORD Flags, } } + pixelformat.dwSize = sizeof(pixelformat); for(fmt = 0; fmt < (sizeof(checkFormatList) / sizeof(checkFormatList[0])); fmt++) { - if(pixelformat != WINED3DFMT_UNKNOWN && checkFormatList[fmt] != pixelformat) - { - continue; - } - modenum = 0; - while(IWineD3D_EnumAdapterModes(This->wineD3D, - WINED3DADAPTER_DEFAULT, - checkFormatList[fmt], - modenum++, - &mode) == WINED3D_OK) + while (wined3d_enum_adapter_modes(This->wineD3D, WINED3DADAPTER_DEFAULT, + checkFormatList[fmt], modenum++, &mode) == WINED3D_OK) { + PixelFormat_WineD3DtoDD(&pixelformat, mode.Format); if(DDSD) { if(DDSD->dwFlags & DDSD_WIDTH && mode.Width != DDSD->dwWidth) continue; if(DDSD->dwFlags & DDSD_HEIGHT && mode.Height != DDSD->dwHeight) continue; + if(DDSD->dwFlags & DDSD_REFRESHRATE && mode.RefreshRate != DDSD->u2.dwRefreshRate) continue; + if (DDSD->dwFlags & DDSD_PIXELFORMAT && + pixelformat.u1.dwRGBBitCount != DDSD->u4.ddpfPixelFormat.u1.dwRGBBitCount) continue; } if(!(Flags & DDEDM_REFRESHRATES)) @@ -2028,17 +2175,16 @@ static HRESULT WINAPI ddraw7_EnumDisplayModes(IDirectDraw7 *iface, DWORD Flags, callback_sd.dwSize = sizeof(callback_sd); callback_sd.u4.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT); - callback_sd.dwFlags = DDSD_HEIGHT|DDSD_WIDTH|DDSD_PIXELFORMAT|DDSD_PITCH; + callback_sd.dwFlags = DDSD_HEIGHT|DDSD_WIDTH|DDSD_PIXELFORMAT|DDSD_PITCH|DDSD_REFRESHRATE; if(Flags & DDEDM_REFRESHRATES) { - callback_sd.dwFlags |= DDSD_REFRESHRATE; callback_sd.u2.dwRefreshRate = mode.RefreshRate; } callback_sd.dwWidth = mode.Width; callback_sd.dwHeight = mode.Height; - PixelFormat_WineD3DtoDD(&callback_sd.u4.ddpfPixelFormat, mode.Format); + callback_sd.u4.ddpfPixelFormat=pixelformat; /* Calc pitch and DWORD align like MSDN says */ callback_sd.u1.lPitch = (callback_sd.u4.ddpfPixelFormat.u1.dwRGBBitCount / 8) * mode.Width; @@ -2089,16 +2235,18 @@ static HRESULT WINAPI ddraw7_EnumDisplayModes(IDirectDraw7 *iface, DWORD Flags, static HRESULT WINAPI ddraw4_EnumDisplayModes(IDirectDraw4 *iface, DWORD flags, DDSURFACEDESC2 *surface_desc, void *context, LPDDENUMMODESCALLBACK2 callback) { + IDirectDrawImpl *This = impl_from_IDirectDraw4(iface); + TRACE("iface %p, flags %#x, surface_desc %p, context %p, callback %p.\n", iface, flags, surface_desc, context, callback); - return ddraw7_EnumDisplayModes((IDirectDraw7 *)ddraw_from_ddraw4(iface), flags, - surface_desc, context, callback); + return ddraw7_EnumDisplayModes(&This->IDirectDraw7_iface, flags, surface_desc, context, callback); } static HRESULT WINAPI ddraw3_EnumDisplayModes(IDirectDraw3 *iface, DWORD flags, DDSURFACEDESC *surface_desc, void *context, LPDDENUMMODESCALLBACK callback) { + IDirectDrawImpl *This = impl_from_IDirectDraw3(iface); struct displaymodescallback_context cbcontext; TRACE("iface %p, flags %#x, surface_desc %p, context %p, callback %p.\n", @@ -2107,13 +2255,14 @@ static HRESULT WINAPI ddraw3_EnumDisplayModes(IDirectDraw3 *iface, DWORD flags, cbcontext.func = callback; cbcontext.context = context; - return ddraw7_EnumDisplayModes((IDirectDraw7 *)ddraw_from_ddraw3(iface), flags, - (DDSURFACEDESC2 *)surface_desc, &cbcontext, EnumDisplayModesCallbackThunk); + return ddraw7_EnumDisplayModes(&This->IDirectDraw7_iface, flags, (DDSURFACEDESC2 *)surface_desc, + &cbcontext, EnumDisplayModesCallbackThunk); } static HRESULT WINAPI ddraw2_EnumDisplayModes(IDirectDraw2 *iface, DWORD flags, DDSURFACEDESC *surface_desc, void *context, LPDDENUMMODESCALLBACK callback) { + IDirectDrawImpl *This = impl_from_IDirectDraw2(iface); struct displaymodescallback_context cbcontext; TRACE("iface %p, flags %#x, surface_desc %p, context %p, callback %p.\n", @@ -2122,13 +2271,14 @@ static HRESULT WINAPI ddraw2_EnumDisplayModes(IDirectDraw2 *iface, DWORD flags, cbcontext.func = callback; cbcontext.context = context; - return ddraw7_EnumDisplayModes((IDirectDraw7 *)ddraw_from_ddraw2(iface), flags, - (DDSURFACEDESC2 *)surface_desc, &cbcontext, EnumDisplayModesCallbackThunk); + return ddraw7_EnumDisplayModes(&This->IDirectDraw7_iface, flags, (DDSURFACEDESC2 *)surface_desc, + &cbcontext, EnumDisplayModesCallbackThunk); } static HRESULT WINAPI ddraw1_EnumDisplayModes(IDirectDraw *iface, DWORD flags, DDSURFACEDESC *surface_desc, void *context, LPDDENUMMODESCALLBACK callback) { + IDirectDrawImpl *This = impl_from_IDirectDraw(iface); struct displaymodescallback_context cbcontext; TRACE("iface %p, flags %#x, surface_desc %p, context %p, callback %p.\n", @@ -2137,8 +2287,8 @@ static HRESULT WINAPI ddraw1_EnumDisplayModes(IDirectDraw *iface, DWORD flags, cbcontext.func = callback; cbcontext.context = context; - return ddraw7_EnumDisplayModes((IDirectDraw7 *)ddraw_from_ddraw1(iface), flags, - (DDSURFACEDESC2 *)surface_desc, &cbcontext, EnumDisplayModesCallbackThunk); + return ddraw7_EnumDisplayModes(&This->IDirectDraw7_iface, flags, (DDSURFACEDESC2 *)surface_desc, + &cbcontext, EnumDisplayModesCallbackThunk); } /***************************************************************************** @@ -2203,12 +2353,13 @@ static HRESULT WINAPI ddraw7_GetDeviceIdentifier(IDirectDraw7 *iface, static HRESULT WINAPI ddraw4_GetDeviceIdentifier(IDirectDraw4 *iface, DDDEVICEIDENTIFIER *identifier, DWORD flags) { + IDirectDrawImpl *This = impl_from_IDirectDraw4(iface); DDDEVICEIDENTIFIER2 identifier2; HRESULT hr; TRACE("iface %p, identifier %p, flags %#x.\n", iface, identifier, flags); - hr = ddraw7_GetDeviceIdentifier((IDirectDraw7 *)ddraw_from_ddraw4(iface), &identifier2, flags); + hr = ddraw7_GetDeviceIdentifier(&This->IDirectDraw7_iface, &identifier2, flags); DDRAW_Convert_DDDEVICEIDENTIFIER_2_To_1(&identifier2, identifier); return hr; @@ -2228,17 +2379,18 @@ static HRESULT WINAPI ddraw4_GetDeviceIdentifier(IDirectDraw4 *iface, * Always returns DD_OK because it's a stub * *****************************************************************************/ -static HRESULT WINAPI ddraw7_GetSurfaceFromDC(IDirectDraw7 *iface, HDC hdc, IDirectDrawSurface7 **Surface) +static HRESULT WINAPI ddraw7_GetSurfaceFromDC(IDirectDraw7 *iface, HDC hdc, + IDirectDrawSurface7 **Surface) { - IDirectDrawImpl *This = (IDirectDrawImpl *)iface; - IWineD3DSurface *wined3d_surface; + IDirectDrawImpl *This = impl_from_IDirectDraw7(iface); + struct wined3d_surface *wined3d_surface; HRESULT hr; TRACE("iface %p, dc %p, surface %p.\n", iface, hdc, Surface); if (!Surface) return E_INVALIDARG; - hr = IWineD3DDevice_GetSurfaceFromDC(This->wineD3DDevice, hdc, &wined3d_surface); + hr = wined3d_device_get_surface_from_dc(This->wined3d_device, hdc, &wined3d_surface); if (FAILED(hr)) { TRACE("No surface found for dc %p.\n", hdc); @@ -2246,14 +2398,16 @@ static HRESULT WINAPI ddraw7_GetSurfaceFromDC(IDirectDraw7 *iface, HDC hdc, IDir return DDERR_NOTFOUND; } - *Surface = IWineD3DSurface_GetParent(wined3d_surface); + *Surface = wined3d_surface_get_parent(wined3d_surface); IDirectDrawSurface7_AddRef(*Surface); TRACE("Returning surface %p.\n", Surface); return DD_OK; } -static HRESULT WINAPI ddraw4_GetSurfaceFromDC(IDirectDraw4 *iface, HDC dc, IDirectDrawSurface4 **surface) +static HRESULT WINAPI ddraw4_GetSurfaceFromDC(IDirectDraw4 *iface, HDC dc, + IDirectDrawSurface4 **surface) { + IDirectDrawImpl *This = impl_from_IDirectDraw4(iface); IDirectDrawSurface7 *surface7; HRESULT hr; @@ -2261,18 +2415,20 @@ static HRESULT WINAPI ddraw4_GetSurfaceFromDC(IDirectDraw4 *iface, HDC dc, IDire if (!surface) return E_INVALIDARG; - hr = ddraw7_GetSurfaceFromDC((IDirectDraw7 *)ddraw_from_ddraw4(iface), dc, &surface7); + hr = ddraw7_GetSurfaceFromDC(&This->IDirectDraw7_iface, dc, &surface7); *surface = surface7 ? (IDirectDrawSurface4 *)&((IDirectDrawSurfaceImpl *)surface7)->IDirectDrawSurface3_vtbl : NULL; return hr; } -static HRESULT WINAPI ddraw3_GetSurfaceFromDC(IDirectDraw3 *iface, HDC dc, IDirectDrawSurface **surface) +static HRESULT WINAPI ddraw3_GetSurfaceFromDC(IDirectDraw3 *iface, HDC dc, + IDirectDrawSurface **surface) { + IDirectDrawImpl *This = impl_from_IDirectDraw3(iface); + TRACE("iface %p, dc %p, surface %p.\n", iface, dc, surface); - return ddraw7_GetSurfaceFromDC((IDirectDraw7 *)ddraw_from_ddraw3(iface), - dc, (IDirectDrawSurface7 **)surface); + return ddraw7_GetSurfaceFromDC(&This->IDirectDraw7_iface, dc, (IDirectDrawSurface7 **)surface); } /***************************************************************************** @@ -2300,9 +2456,11 @@ static HRESULT WINAPI ddraw7_RestoreAllSurfaces(IDirectDraw7 *iface) static HRESULT WINAPI ddraw4_RestoreAllSurfaces(IDirectDraw4 *iface) { + IDirectDrawImpl *This = impl_from_IDirectDraw4(iface); + TRACE("iface %p.\n", iface); - return ddraw7_RestoreAllSurfaces((IDirectDraw7 *)ddraw_from_ddraw4(iface)); + return ddraw7_RestoreAllSurfaces(&This->IDirectDraw7_iface); } /***************************************************************************** @@ -2356,22 +2514,14 @@ static HRESULT WINAPI ddraw7_StartModeTest(IDirectDraw7 *iface, SIZE *Modes, DWO HRESULT WINAPI ddraw_recreate_surfaces_cb(IDirectDrawSurface7 *surf, DDSURFACEDESC2 *desc, void *Context) { IDirectDrawSurfaceImpl *surfImpl = (IDirectDrawSurfaceImpl *)surf; + struct wined3d_resource_desc wined3d_desc; + struct wined3d_resource *wined3d_resource; IDirectDrawImpl *This = surfImpl->ddraw; - IWineD3DSurface *wineD3DSurface; - IWineD3DSwapChain *swapchain; + struct wined3d_surface *wined3d_surface; + struct wined3d_swapchain *swapchain; + struct wined3d_clipper *clipper; void *parent; HRESULT hr; - IWineD3DClipper *clipper = NULL; - - WINED3DSURFACE_DESC Desc; - enum wined3d_format_id Format; - DWORD Usage; - WINED3DPOOL Pool; - - WINED3DMULTISAMPLE_TYPE MultiSampleType; - DWORD MultiSampleQuality; - UINT Width; - UINT Height; TRACE("surface %p, surface_desc %p, context %p.\n", surf, desc, Context); @@ -2382,51 +2532,46 @@ HRESULT WINAPI ddraw_recreate_surfaces_cb(IDirectDrawSurface7 *surf, DDSURFACEDE if(surfImpl->ImplType == This->ImplType) return DDENUMRET_OK; /* Continue */ /* Get the objects */ - swapchain = surfImpl->wineD3DSwapChain; - surfImpl->wineD3DSwapChain = NULL; - wineD3DSurface = surfImpl->WineD3DSurface; + swapchain = surfImpl->wined3d_swapchain; + surfImpl->wined3d_swapchain = NULL; + wined3d_surface = surfImpl->wined3d_surface; /* get the clipper */ - IWineD3DSurface_GetClipper(wineD3DSurface, &clipper); + clipper = wined3d_surface_get_clipper(wined3d_surface); /* Get the surface properties */ - IWineD3DSurface_GetDesc(wineD3DSurface, &Desc); + wined3d_resource = wined3d_surface_get_resource(wined3d_surface); + wined3d_resource_get_desc(wined3d_resource, &wined3d_desc); - Format = Desc.format; - Usage = Desc.usage; - Pool = Desc.pool; - MultiSampleType = Desc.multisample_type; - MultiSampleQuality = Desc.multisample_quality; - Width = Desc.width; - Height = Desc.height; - - parent = IWineD3DSurface_GetParent(wineD3DSurface); - hr = IWineD3DDevice_CreateSurface(This->wineD3DDevice, Width, Height, Format, TRUE /* Lockable */, - FALSE /* Discard */, surfImpl->mipmap_level, Usage, Pool, MultiSampleType, MultiSampleQuality, - This->ImplType, parent, &ddraw_null_wined3d_parent_ops, &surfImpl->WineD3DSurface); + parent = wined3d_surface_get_parent(wined3d_surface); + hr = wined3d_surface_create(This->wined3d_device, wined3d_desc.width, wined3d_desc.height, + wined3d_desc.format, TRUE, FALSE, surfImpl->mipmap_level, wined3d_desc.usage, wined3d_desc.pool, + wined3d_desc.multisample_type, wined3d_desc.multisample_quality, This->ImplType, + parent, &ddraw_surface_wined3d_parent_ops, &surfImpl->wined3d_surface); if (FAILED(hr)) { - surfImpl->WineD3DSurface = wineD3DSurface; + surfImpl->wined3d_surface = wined3d_surface; return hr; } - IWineD3DSurface_SetClipper(surfImpl->WineD3DSurface, clipper); + wined3d_surface_set_clipper(surfImpl->wined3d_surface, clipper); /* TODO: Copy the surface content, except for render targets */ /* If there's a swapchain, it owns the wined3d surfaces. So Destroy * the swapchain */ - if(swapchain) { + if (swapchain) + { /* The backbuffers have the swapchain set as well, but the primary - * owns it and destroys it - */ - if(surfImpl->surface_desc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE) { - IWineD3DDevice_UninitGDI(This->wineD3DDevice, D3D7CB_DestroySwapChain); - } + * owns it and destroys it. */ + if (surfImpl->surface_desc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE) + wined3d_device_uninit_gdi(This->wined3d_device); surfImpl->isRenderTarget = FALSE; - } else { - if(IWineD3DSurface_Release(wineD3DSurface) == 0) + } + else + { + if (!wined3d_surface_decref(wined3d_surface)) TRACE("Surface released successful, next surface\n"); else ERR("Something's still holding the old WineD3DSurface\n"); @@ -2434,10 +2579,6 @@ HRESULT WINAPI ddraw_recreate_surfaces_cb(IDirectDrawSurface7 *surf, DDSURFACEDE surfImpl->ImplType = This->ImplType; - if(clipper) - { - IWineD3DClipper_Release(clipper); - } return DDENUMRET_OK; } @@ -2459,24 +2600,15 @@ static HRESULT ddraw_recreate_surfaces(IDirectDrawImpl *This) /* Should happen almost never */ FIXME("(%p) Switching to non-opengl surfaces with d3d started. Is this a bug?\n", This); /* Shutdown d3d */ - IWineD3DDevice_Uninit3D(This->wineD3DDevice, D3D7CB_DestroySwapChain); + wined3d_device_uninit_3d(This->wined3d_device); } /* Contrary: D3D starting is handled by the caller, because it knows the render target */ memset(&desc, 0, sizeof(desc)); desc.dwSize = sizeof(desc); - return IDirectDraw7_EnumSurfaces((IDirectDraw7 *)This, 0, &desc, This, ddraw_recreate_surfaces_cb); -} - -ULONG WINAPI D3D7CB_DestroySwapChain(IWineD3DSwapChain *pSwapChain) -{ - IUnknown *swapChainParent; - - TRACE("swapchain %p.\n", pSwapChain); - - swapChainParent = IWineD3DSwapChain_GetParent(pSwapChain); - return IUnknown_Release(swapChainParent); + return IDirectDraw7_EnumSurfaces(&This->IDirectDraw7_iface, 0, &desc, This, + ddraw_recreate_surfaces_cb); } /***************************************************************************** @@ -2737,11 +2869,12 @@ static HRESULT ddraw_attach_d3d_device(IDirectDrawImpl *ddraw, IDirectDrawSurfac localParameters.Flags = 0; localParameters.FullScreen_RefreshRateInHz = WINED3DPRESENT_RATE_DEFAULT; localParameters.PresentationInterval = WINED3DPRESENT_INTERVAL_DEFAULT; + localParameters.AutoRestoreDisplayMode = FALSE; /* Set this NOW, otherwise creating the depth stencil surface will cause a * recursive loop until ram or emulated video memory is full. */ ddraw->d3d_initialized = TRUE; - hr = IWineD3DDevice_Init3D(ddraw->wineD3DDevice, &localParameters); + hr = wined3d_device_init_3d(ddraw->wined3d_device, &localParameters); if (FAILED(hr)) { ddraw->d3d_target = NULL; @@ -2755,7 +2888,7 @@ static HRESULT ddraw_attach_d3d_device(IDirectDrawImpl *ddraw, IDirectDrawSurfac { ERR("Error allocating an array for the converted vertex decls.\n"); ddraw->declArraySize = 0; - hr = IWineD3DDevice_Uninit3D(ddraw->wineD3DDevice, D3D7CB_DestroySwapChain); + hr = wined3d_device_uninit_3d(ddraw->wined3d_device); return E_OUTOFMEMORY; } @@ -2791,14 +2924,15 @@ static HRESULT ddraw_create_gdi_swapchain(IDirectDrawImpl *ddraw, IDirectDrawSur presentation_parameters.Flags = 0; presentation_parameters.FullScreen_RefreshRateInHz = WINED3DPRESENT_RATE_DEFAULT; presentation_parameters.PresentationInterval = WINED3DPRESENT_INTERVAL_DEFAULT; + presentation_parameters.AutoRestoreDisplayMode = FALSE; ddraw->d3d_target = primary; - hr = IWineD3DDevice_InitGDI(ddraw->wineD3DDevice, &presentation_parameters); + hr = wined3d_device_init_gdi(ddraw->wined3d_device, &presentation_parameters); ddraw->d3d_target = NULL; if (FAILED(hr)) { WARN("Failed to initialize GDI ddraw implementation, hr %#x.\n", hr); - primary->wineD3DSwapChain = NULL; + primary->wined3d_swapchain = NULL; } return hr; @@ -2881,10 +3015,9 @@ static HRESULT ddraw_create_gdi_swapchain(IDirectDrawImpl *ddraw, IDirectDrawSur * DDERR_* if an error occurs * *****************************************************************************/ -static HRESULT CreateSurface(IDirectDraw7 *iface, - DDSURFACEDESC2 *DDSD, IDirectDrawSurface7 **Surf, IUnknown *UnkOuter) +static HRESULT CreateSurface(IDirectDrawImpl *ddraw, DDSURFACEDESC2 *DDSD, + IDirectDrawSurface7 **Surf, IUnknown *UnkOuter) { - IDirectDrawImpl *This = (IDirectDrawImpl *)iface; IDirectDrawSurfaceImpl *object = NULL; HRESULT hr; LONG extra_surfaces = 0; @@ -2892,27 +3025,26 @@ static HRESULT CreateSurface(IDirectDraw7 *iface, WINED3DDISPLAYMODE Mode; const DWORD sysvidmem = DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY; - TRACE("iface %p, surface_desc %p, surface %p, outer_unknown %p.\n", - iface, DDSD, Surf, UnkOuter); + TRACE("ddraw %p, surface_desc %p, surface %p, outer_unknown %p.\n", ddraw, DDSD, Surf, UnkOuter); /* Some checks before we start */ if (TRACE_ON(ddraw)) { - TRACE(" (%p) Requesting surface desc :\n", This); + TRACE(" (%p) Requesting surface desc :\n", ddraw); DDRAW_dump_surface_desc(DDSD); } EnterCriticalSection(&ddraw_cs); if (UnkOuter != NULL) { - FIXME("(%p) : outer != NULL?\n", This); + FIXME("(%p) : outer != NULL?\n", ddraw); LeaveCriticalSection(&ddraw_cs); return CLASS_E_NOAGGREGATION; /* unchecked */ } if (Surf == NULL) { - FIXME("(%p) You want to get back a surface? Don't give NULL ptrs!\n", This); + FIXME("(%p) You want to get back a surface? Don't give NULL ptrs!\n", ddraw); LeaveCriticalSection(&ddraw_cs); return E_POINTER; /* unchecked */ } @@ -2932,14 +3064,15 @@ static HRESULT CreateSurface(IDirectDraw7 *iface, if ((DDSD->dwFlags & DDSD_LPSURFACE) && (DDSD->lpSurface == NULL)) { /* Frank Herbert's Dune specifies a null pointer for the surface, ignore the LPSURFACE field */ - WARN("(%p) Null surface pointer specified, ignore it!\n", This); + WARN("(%p) Null surface pointer specified, ignore it!\n", ddraw); DDSD->dwFlags &= ~DDSD_LPSURFACE; } if((DDSD->ddsCaps.dwCaps & (DDSCAPS_FLIP | DDSCAPS_PRIMARYSURFACE)) == (DDSCAPS_FLIP | DDSCAPS_PRIMARYSURFACE) && - !(This->cooperative_level & DDSCL_EXCLUSIVE)) + !(ddraw->cooperative_level & DDSCL_EXCLUSIVE)) { - TRACE("(%p): Attempt to create a flipable primary surface without DDSCL_EXCLUSIVE set\n", This); + TRACE("(%p): Attempt to create a flipable primary surface without DDSCL_EXCLUSIVE set\n", + ddraw); *Surf = NULL; LeaveCriticalSection(&ddraw_cs); return DDERR_NOEXCLUSIVEMODE; @@ -2992,20 +3125,15 @@ static HRESULT CreateSurface(IDirectDraw7 *iface, DDSD->ddsCaps.dwCaps2 &= ~DDSCAPS2_MIPMAPSUBLEVEL; /* Modify some flags */ - memset(&desc2, 0, sizeof(desc2)); - desc2.dwSize = sizeof(desc2); /* For the struct copy */ - DD_STRUCT_COPY_BYSIZE(&desc2, DDSD); - desc2.dwSize = sizeof(desc2); /* To override a possibly smaller size */ + copy_to_surfacedesc2(&desc2, DDSD); desc2.u4.ddpfPixelFormat.dwSize=sizeof(DDPIXELFORMAT); /* Just to be sure */ /* Get the video mode from WineD3D - we will need it */ - hr = IWineD3DDevice_GetDisplayMode(This->wineD3DDevice, - 0, /* Swapchain 0 */ - &Mode); - if(FAILED(hr)) + hr = wined3d_device_get_display_mode(ddraw->wined3d_device, 0, &Mode); + if (FAILED(hr)) { ERR("Failed to read display mode from wined3d\n"); - switch(This->orig_bpp) + switch(ddraw->orig_bpp) { case 8: Mode.Format = WINED3DFMT_P8_UINT; @@ -3027,8 +3155,8 @@ static HRESULT CreateSurface(IDirectDraw7 *iface, Mode.Format = WINED3DFMT_B8G8R8X8_UNORM; break; } - Mode.Width = This->orig_width; - Mode.Height = This->orig_height; + Mode.Width = ddraw->orig_width; + Mode.Height = ddraw->orig_height; } /* No pixelformat given? Use the current screen format */ @@ -3083,6 +3211,12 @@ static HRESULT CreateSurface(IDirectDraw7 *iface, desc2.dwHeight = Mode.Height; } + if (!desc2.dwWidth || !desc2.dwHeight) + { + LeaveCriticalSection(&ddraw_cs); + return DDERR_INVALIDPARAMS; + } + /* Mipmap count fixes */ if(desc2.ddsCaps.dwCaps & DDSCAPS_MIPMAP) { @@ -3138,7 +3272,7 @@ static HRESULT CreateSurface(IDirectDraw7 *iface, } /* Create the first surface */ - hr = ddraw_create_surface(This, &desc2, &object, 0); + hr = ddraw_create_surface(ddraw, &desc2, &object, 0); if (FAILED(hr)) { WARN("ddraw_create_surface failed, hr %#x.\n", hr); @@ -3167,24 +3301,24 @@ static HRESULT CreateSurface(IDirectDraw7 *iface, { desc2.ddsCaps.dwCaps2 &= ~DDSCAPS2_CUBEMAP_ALLFACES; desc2.ddsCaps.dwCaps2 |= DDSCAPS2_CUBEMAP_NEGATIVEZ; - hr |= CreateAdditionalSurfaces(This, object, extra_surfaces + 1, desc2, TRUE); + hr |= CreateAdditionalSurfaces(ddraw, object, extra_surfaces + 1, desc2, TRUE); desc2.ddsCaps.dwCaps2 &= ~DDSCAPS2_CUBEMAP_NEGATIVEZ; desc2.ddsCaps.dwCaps2 |= DDSCAPS2_CUBEMAP_POSITIVEZ; - hr |= CreateAdditionalSurfaces(This, object, extra_surfaces + 1, desc2, TRUE); + hr |= CreateAdditionalSurfaces(ddraw, object, extra_surfaces + 1, desc2, TRUE); desc2.ddsCaps.dwCaps2 &= ~DDSCAPS2_CUBEMAP_POSITIVEZ; desc2.ddsCaps.dwCaps2 |= DDSCAPS2_CUBEMAP_NEGATIVEY; - hr |= CreateAdditionalSurfaces(This, object, extra_surfaces + 1, desc2, TRUE); + hr |= CreateAdditionalSurfaces(ddraw, object, extra_surfaces + 1, desc2, TRUE); desc2.ddsCaps.dwCaps2 &= ~DDSCAPS2_CUBEMAP_NEGATIVEY; desc2.ddsCaps.dwCaps2 |= DDSCAPS2_CUBEMAP_POSITIVEY; - hr |= CreateAdditionalSurfaces(This, object, extra_surfaces + 1, desc2, TRUE); + hr |= CreateAdditionalSurfaces(ddraw, object, extra_surfaces + 1, desc2, TRUE); desc2.ddsCaps.dwCaps2 &= ~DDSCAPS2_CUBEMAP_POSITIVEY; desc2.ddsCaps.dwCaps2 |= DDSCAPS2_CUBEMAP_NEGATIVEX; - hr |= CreateAdditionalSurfaces(This, object, extra_surfaces + 1, desc2, TRUE); + hr |= CreateAdditionalSurfaces(ddraw, object, extra_surfaces + 1, desc2, TRUE); desc2.ddsCaps.dwCaps2 &= ~DDSCAPS2_CUBEMAP_NEGATIVEX; desc2.ddsCaps.dwCaps2 |= DDSCAPS2_CUBEMAP_POSITIVEX; } - hr |= CreateAdditionalSurfaces(This, object, extra_surfaces, desc2, FALSE); + hr |= CreateAdditionalSurfaces(ddraw, object, extra_surfaces, desc2, FALSE); if(hr != DD_OK) { /* This destroys and possibly created surfaces too */ @@ -3201,14 +3335,14 @@ static HRESULT CreateSurface(IDirectDraw7 *iface, * the render target as first surface. In this case the render target creation * will cause the 3D init. */ - if( (This->ImplType == SURFACE_OPENGL) && !(This->d3d_initialized) && + if( (ddraw->ImplType == SURFACE_OPENGL) && !(ddraw->d3d_initialized) && desc2.ddsCaps.dwCaps & (DDSCAPS_PRIMARYSURFACE | DDSCAPS_3DDEVICE) ) { IDirectDrawSurfaceImpl *target = object, *surface; struct list *entry; /* Search for the primary to use as render target */ - LIST_FOR_EACH(entry, &This->surface_list) + LIST_FOR_EACH(entry, &ddraw->surface_list) { surface = LIST_ENTRY(entry, IDirectDrawSurfaceImpl, surface_list_entry); if((surface->surface_desc.ddsCaps.dwCaps & (DDSCAPS_PRIMARYSURFACE | DDSCAPS_FRONTBUFFER)) == @@ -3221,8 +3355,8 @@ static HRESULT CreateSurface(IDirectDraw7 *iface, } } - TRACE("(%p) Attaching a D3DDevice, rendertarget = %p\n", This, target); - hr = ddraw_attach_d3d_device(This, target); + TRACE("(%p) Attaching a D3DDevice, rendertarget = %p\n", ddraw, target); + hr = ddraw_attach_d3d_device(ddraw, target); if (hr != D3D_OK) { IDirectDrawSurfaceImpl *release_surf; @@ -3246,70 +3380,32 @@ static HRESULT CreateSurface(IDirectDraw7 *iface, return hr; } } - else if(!(This->d3d_initialized) && desc2.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE) + else if(!(ddraw->d3d_initialized) && desc2.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE) { - ddraw_create_gdi_swapchain(This, object); + ddraw_create_gdi_swapchain(ddraw, object); } /* Addref the ddraw interface to keep an reference for each surface */ - IDirectDraw7_AddRef(iface); - object->ifaceToRelease = (IUnknown *) iface; + IDirectDraw7_AddRef(&ddraw->IDirectDraw7_iface); + object->ifaceToRelease = (IUnknown *)&ddraw->IDirectDraw7_iface; /* Create a WineD3DTexture if a texture was requested */ - if(desc2.ddsCaps.dwCaps & DDSCAPS_TEXTURE) + if (desc2.ddsCaps.dwCaps & DDSCAPS_TEXTURE) { - enum wined3d_format_id Format; - UINT levels; - WINED3DPOOL Pool = WINED3DPOOL_DEFAULT; - - This->tex_root = object; - - if(desc2.ddsCaps.dwCaps & DDSCAPS_MIPMAP) - { - /* a mipmap is created, create enough levels */ - levels = desc2.u2.dwMipMapCount; - } - else - { - /* No mipmap is created, create one level */ - levels = 1; - } - - /* DDSCAPS_SYSTEMMEMORY textures are in WINED3DPOOL_SYSTEMMEM */ - if(DDSD->ddsCaps.dwCaps & DDSCAPS_SYSTEMMEMORY) - { - Pool = WINED3DPOOL_SYSTEMMEM; - } - /* Should I forward the MANAGED cap to the managed pool ? */ - - /* Get the format. It's set already by CreateNewSurface */ - Format = PixelFormat_DD2WineD3D(&object->surface_desc.u4.ddpfPixelFormat); - - /* The surfaces are already created, the callback only - * passes the IWineD3DSurface to WineD3D - */ - if(desc2.ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP) - { - hr = IWineD3DDevice_CreateCubeTexture(This->wineD3DDevice, DDSD->dwWidth /* Edgelength */, levels, - 0 /* usage */, Format, Pool, object, &ddraw_null_wined3d_parent_ops, - (IWineD3DCubeTexture **)&object->wineD3DTexture); - } - else - { - hr = IWineD3DDevice_CreateTexture(This->wineD3DDevice, DDSD->dwWidth, DDSD->dwHeight, levels, - 0 /* usage */, Format, Pool, object, &ddraw_null_wined3d_parent_ops, - (IWineD3DTexture **)&object->wineD3DTexture); - } - This->tex_root = NULL; + ddraw->tex_root = object; + ddraw_surface_create_texture(object); + ddraw->tex_root = NULL; } LeaveCriticalSection(&ddraw_cs); return hr; } -static HRESULT WINAPI ddraw7_CreateSurface(IDirectDraw7 *iface, - DDSURFACEDESC2 *surface_desc, IDirectDrawSurface7 **surface, IUnknown *outer_unknown) +static HRESULT WINAPI ddraw7_CreateSurface(IDirectDraw7 *iface, DDSURFACEDESC2 *surface_desc, + IDirectDrawSurface7 **surface, IUnknown *outer_unknown) { + IDirectDrawImpl *This = impl_from_IDirectDraw7(iface); + TRACE("iface %p, surface_desc %p, surface %p, outer_unknown %p.\n", iface, surface_desc, surface, outer_unknown); @@ -3331,13 +3427,13 @@ static HRESULT WINAPI ddraw7_CreateSurface(IDirectDraw7 *iface, return DDERR_INVALIDCAPS; } - return CreateSurface(iface, surface_desc, surface, outer_unknown); + return CreateSurface(This, surface_desc, surface, outer_unknown); } static HRESULT WINAPI ddraw4_CreateSurface(IDirectDraw4 *iface, DDSURFACEDESC2 *surface_desc, IDirectDrawSurface4 **surface, IUnknown *outer_unknown) { - IDirectDrawImpl *ddraw = ddraw_from_ddraw4(iface); + IDirectDrawImpl *This = impl_from_IDirectDraw4(iface); IDirectDrawSurfaceImpl *impl; HRESULT hr; @@ -3362,12 +3458,12 @@ static HRESULT WINAPI ddraw4_CreateSurface(IDirectDraw4 *iface, return DDERR_INVALIDCAPS; } - hr = CreateSurface((IDirectDraw7 *)ddraw, surface_desc, (IDirectDrawSurface7 **)surface, outer_unknown); + hr = CreateSurface(This, surface_desc, (IDirectDrawSurface7 **)surface, outer_unknown); impl = (IDirectDrawSurfaceImpl *)*surface; if (SUCCEEDED(hr) && impl) { ddraw_set_surface_version(impl, 4); - IDirectDraw7_Release((IDirectDraw7 *)ddraw); + IDirectDraw7_Release(&This->IDirectDraw7_iface); IDirectDraw4_AddRef(iface); impl->ifaceToRelease = (IUnknown *)iface; } @@ -3375,10 +3471,10 @@ static HRESULT WINAPI ddraw4_CreateSurface(IDirectDraw4 *iface, return hr; } -static HRESULT WINAPI ddraw3_CreateSurface(IDirectDraw3 *iface, - DDSURFACEDESC *surface_desc, IDirectDrawSurface **surface, IUnknown *outer_unknown) +static HRESULT WINAPI ddraw3_CreateSurface(IDirectDraw3 *iface, DDSURFACEDESC *surface_desc, + IDirectDrawSurface **surface, IUnknown *outer_unknown) { - IDirectDrawImpl *ddraw = ddraw_from_ddraw3(iface); + IDirectDrawImpl *This = impl_from_IDirectDraw3(iface); IDirectDrawSurface7 *surface7; IDirectDrawSurfaceImpl *impl; HRESULT hr; @@ -3404,7 +3500,7 @@ static HRESULT WINAPI ddraw3_CreateSurface(IDirectDraw3 *iface, return DDERR_INVALIDCAPS; } - hr = CreateSurface((IDirectDraw7 *)ddraw, (DDSURFACEDESC2 *)surface_desc, &surface7, outer_unknown); + hr = CreateSurface(This, (DDSURFACEDESC2 *)surface_desc, &surface7, outer_unknown); if (FAILED(hr)) { *surface = NULL; @@ -3414,7 +3510,7 @@ static HRESULT WINAPI ddraw3_CreateSurface(IDirectDraw3 *iface, impl = (IDirectDrawSurfaceImpl *)surface7; *surface = (IDirectDrawSurface *)&impl->IDirectDrawSurface3_vtbl; ddraw_set_surface_version(impl, 3); - IDirectDraw7_Release((IDirectDraw7 *)ddraw); + IDirectDraw7_Release(&This->IDirectDraw7_iface); IDirectDraw3_AddRef(iface); impl->ifaceToRelease = (IUnknown *)iface; @@ -3424,7 +3520,7 @@ static HRESULT WINAPI ddraw3_CreateSurface(IDirectDraw3 *iface, static HRESULT WINAPI ddraw2_CreateSurface(IDirectDraw2 *iface, DDSURFACEDESC *surface_desc, IDirectDrawSurface **surface, IUnknown *outer_unknown) { - IDirectDrawImpl *ddraw = ddraw_from_ddraw2(iface); + IDirectDrawImpl *This = impl_from_IDirectDraw2(iface); IDirectDrawSurface7 *surface7; IDirectDrawSurfaceImpl *impl; HRESULT hr; @@ -3450,7 +3546,7 @@ static HRESULT WINAPI ddraw2_CreateSurface(IDirectDraw2 *iface, return DDERR_INVALIDCAPS; } - hr = CreateSurface((IDirectDraw7 *)ddraw, (DDSURFACEDESC2 *)surface_desc, &surface7, outer_unknown); + hr = CreateSurface(This, (DDSURFACEDESC2 *)surface_desc, &surface7, outer_unknown); if (FAILED(hr)) { *surface = NULL; @@ -3460,7 +3556,7 @@ static HRESULT WINAPI ddraw2_CreateSurface(IDirectDraw2 *iface, impl = (IDirectDrawSurfaceImpl *)surface7; *surface = (IDirectDrawSurface *)&impl->IDirectDrawSurface3_vtbl; ddraw_set_surface_version(impl, 2); - IDirectDraw7_Release((IDirectDraw7 *)ddraw); + IDirectDraw7_Release(&This->IDirectDraw7_iface); impl->ifaceToRelease = NULL; return hr; @@ -3469,7 +3565,7 @@ static HRESULT WINAPI ddraw2_CreateSurface(IDirectDraw2 *iface, static HRESULT WINAPI ddraw1_CreateSurface(IDirectDraw *iface, DDSURFACEDESC *surface_desc, IDirectDrawSurface **surface, IUnknown *outer_unknown) { - IDirectDrawImpl *ddraw = ddraw_from_ddraw1(iface); + IDirectDrawImpl *This = impl_from_IDirectDraw(iface); IDirectDrawSurface7 *surface7; IDirectDrawSurfaceImpl *impl; HRESULT hr; @@ -3486,7 +3582,7 @@ static HRESULT WINAPI ddraw1_CreateSurface(IDirectDraw *iface, /* Remove front buffer flag, this causes failure in v7, and its added to normal * primaries anyway. */ surface_desc->ddsCaps.dwCaps &= ~DDSCAPS_FRONTBUFFER; - hr = CreateSurface((IDirectDraw7 *)ddraw, (DDSURFACEDESC2 *)surface_desc, &surface7, outer_unknown); + hr = CreateSurface(This, (DDSURFACEDESC2 *)surface_desc, &surface7, outer_unknown); if (FAILED(hr)) { *surface = NULL; @@ -3496,7 +3592,7 @@ static HRESULT WINAPI ddraw1_CreateSurface(IDirectDraw *iface, impl = (IDirectDrawSurfaceImpl *)surface7; *surface = (IDirectDrawSurface *)&impl->IDirectDrawSurface3_vtbl; ddraw_set_surface_version(impl, 1); - IDirectDraw7_Release((IDirectDraw7 *)ddraw); + IDirectDraw7_Release(&This->IDirectDraw7_iface); impl->ifaceToRelease = NULL; return hr; @@ -3657,7 +3753,7 @@ static HRESULT WINAPI ddraw7_EnumSurfaces(IDirectDraw7 *iface, DWORD Flags, * because WineDDraw doesn't handle ddraw-like surface * caps structures */ - IDirectDrawImpl *This = (IDirectDrawImpl *)iface; + IDirectDrawImpl *This = impl_from_IDirectDraw7(iface); IDirectDrawSurfaceImpl *surf; BOOL all, nomatch; DDSURFACEDESC2 desc; @@ -3699,16 +3795,19 @@ static HRESULT WINAPI ddraw7_EnumSurfaces(IDirectDraw7 *iface, DWORD Flags, static HRESULT WINAPI ddraw4_EnumSurfaces(IDirectDraw4 *iface, DWORD flags, DDSURFACEDESC2 *surface_desc, void *context, LPDDENUMSURFACESCALLBACK2 callback) { + IDirectDrawImpl *This = impl_from_IDirectDraw4(iface); + TRACE("iface %p, flags %#x, surface_desc %p, context %p, callback %p.\n", iface, flags, surface_desc, context, callback); - return ddraw7_EnumSurfaces((IDirectDraw7 *)ddraw_from_ddraw4(iface), - flags, surface_desc, context, (LPDDENUMSURFACESCALLBACK7)callback); + return ddraw7_EnumSurfaces(&This->IDirectDraw7_iface, flags, surface_desc, context, + (LPDDENUMSURFACESCALLBACK7)callback); } static HRESULT WINAPI ddraw3_EnumSurfaces(IDirectDraw3 *iface, DWORD flags, DDSURFACEDESC *surface_desc, void *context, LPDDENUMSURFACESCALLBACK callback) { + IDirectDrawImpl *This = impl_from_IDirectDraw3(iface); struct surfacescallback_context cbcontext; TRACE("iface %p, flags %#x, surface_desc %p, context %p, callback %p.\n", @@ -3717,13 +3816,14 @@ static HRESULT WINAPI ddraw3_EnumSurfaces(IDirectDraw3 *iface, DWORD flags, cbcontext.func = callback; cbcontext.context = context; - return ddraw7_EnumSurfaces((IDirectDraw7 *)ddraw_from_ddraw3(iface), flags, - (DDSURFACEDESC2 *)surface_desc, &cbcontext, EnumSurfacesCallbackThunk); + return ddraw7_EnumSurfaces(&This->IDirectDraw7_iface, flags, (DDSURFACEDESC2 *)surface_desc, + &cbcontext, EnumSurfacesCallbackThunk); } static HRESULT WINAPI ddraw2_EnumSurfaces(IDirectDraw2 *iface, DWORD flags, DDSURFACEDESC *surface_desc, void *context, LPDDENUMSURFACESCALLBACK callback) { + IDirectDrawImpl *This = impl_from_IDirectDraw2(iface); struct surfacescallback_context cbcontext; TRACE("iface %p, flags %#x, surface_desc %p, context %p, callback %p.\n", @@ -3732,13 +3832,14 @@ static HRESULT WINAPI ddraw2_EnumSurfaces(IDirectDraw2 *iface, DWORD flags, cbcontext.func = callback; cbcontext.context = context; - return ddraw7_EnumSurfaces((IDirectDraw7 *)ddraw_from_ddraw2(iface), flags, - (DDSURFACEDESC2 *)surface_desc, &cbcontext, EnumSurfacesCallbackThunk); + return ddraw7_EnumSurfaces(&This->IDirectDraw7_iface, flags, (DDSURFACEDESC2 *)surface_desc, + &cbcontext, EnumSurfacesCallbackThunk); } static HRESULT WINAPI ddraw1_EnumSurfaces(IDirectDraw *iface, DWORD flags, DDSURFACEDESC *surface_desc, void *context, LPDDENUMSURFACESCALLBACK callback) { + IDirectDrawImpl *This = impl_from_IDirectDraw(iface); struct surfacescallback_context cbcontext; TRACE("iface %p, flags %#x, surface_desc %p, context %p, callback %p.\n", @@ -3747,8 +3848,8 @@ static HRESULT WINAPI ddraw1_EnumSurfaces(IDirectDraw *iface, DWORD flags, cbcontext.func = callback; cbcontext.context = context; - return ddraw7_EnumSurfaces((IDirectDraw7 *)ddraw_from_ddraw1(iface), flags, - (DDSURFACEDESC2 *)surface_desc, &cbcontext, EnumSurfacesCallbackThunk); + return ddraw7_EnumSurfaces(&This->IDirectDraw7_iface, flags, (DDSURFACEDESC2 *)surface_desc, + &cbcontext, EnumSurfacesCallbackThunk); } /***************************************************************************** @@ -3784,12 +3885,6 @@ DirectDrawCreateClipper(DWORD Flags, return CLASS_E_NOAGGREGATION; } - if (!LoadWineD3D()) - { - LeaveCriticalSection(&ddraw_cs); - return DDERR_NODIRECTDRAWSUPPORT; - } - object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectDrawClipperImpl)); if (object == NULL) @@ -3828,40 +3923,48 @@ static HRESULT WINAPI ddraw7_CreateClipper(IDirectDraw7 *iface, DWORD Flags, return DirectDrawCreateClipper(Flags, Clipper, UnkOuter); } -static HRESULT WINAPI ddraw4_CreateClipper(IDirectDraw4 *iface, - DWORD flags, IDirectDrawClipper **clipper, IUnknown *outer_unknown) +static HRESULT WINAPI ddraw4_CreateClipper(IDirectDraw4 *iface, DWORD flags, + IDirectDrawClipper **clipper, IUnknown *outer_unknown) { + IDirectDrawImpl *This = impl_from_IDirectDraw4(iface); + TRACE("iface %p, flags %#x, clipper %p, outer_unknown %p.\n", iface, flags, clipper, outer_unknown); - return ddraw7_CreateClipper((IDirectDraw7 *)ddraw_from_ddraw4(iface), flags, clipper, outer_unknown); + return ddraw7_CreateClipper(&This->IDirectDraw7_iface, flags, clipper, outer_unknown); } -static HRESULT WINAPI ddraw3_CreateClipper(IDirectDraw3 *iface, - DWORD flags, IDirectDrawClipper **clipper, IUnknown *outer_unknown) +static HRESULT WINAPI ddraw3_CreateClipper(IDirectDraw3 *iface, DWORD flags, + IDirectDrawClipper **clipper, IUnknown *outer_unknown) { + IDirectDrawImpl *This = impl_from_IDirectDraw3(iface); + TRACE("iface %p, flags %#x, clipper %p, outer_unknown %p.\n", iface, flags, clipper, outer_unknown); - return ddraw7_CreateClipper((IDirectDraw7 *)ddraw_from_ddraw3(iface), flags, clipper, outer_unknown); + return ddraw7_CreateClipper(&This->IDirectDraw7_iface, flags, clipper, outer_unknown); } static HRESULT WINAPI ddraw2_CreateClipper(IDirectDraw2 *iface, DWORD flags, IDirectDrawClipper **clipper, IUnknown *outer_unknown) { + IDirectDrawImpl *This = impl_from_IDirectDraw2(iface); + TRACE("iface %p, flags %#x, clipper %p, outer_unknown %p.\n", iface, flags, clipper, outer_unknown); - return ddraw7_CreateClipper((IDirectDraw7 *)ddraw_from_ddraw2(iface), flags, clipper, outer_unknown); + return ddraw7_CreateClipper(&This->IDirectDraw7_iface, flags, clipper, outer_unknown); } static HRESULT WINAPI ddraw1_CreateClipper(IDirectDraw *iface, DWORD flags, IDirectDrawClipper **clipper, IUnknown *outer_unknown) { + IDirectDrawImpl *This = impl_from_IDirectDraw(iface); + TRACE("iface %p, flags %#x, clipper %p, outer_unknown %p.\n", iface, flags, clipper, outer_unknown); - return ddraw7_CreateClipper((IDirectDraw7 *)ddraw_from_ddraw1(iface), flags, clipper, outer_unknown); + return ddraw7_CreateClipper(&This->IDirectDraw7_iface, flags, clipper, outer_unknown); } /***************************************************************************** @@ -3884,7 +3987,7 @@ static HRESULT WINAPI ddraw1_CreateClipper(IDirectDraw *iface, static HRESULT WINAPI ddraw7_CreatePalette(IDirectDraw7 *iface, DWORD Flags, PALETTEENTRY *ColorTable, IDirectDrawPalette **Palette, IUnknown *pUnkOuter) { - IDirectDrawImpl *This = (IDirectDrawImpl *)iface; + IDirectDrawImpl *This = impl_from_IDirectDraw7(iface); IDirectDrawPaletteImpl *object; HRESULT hr; @@ -3930,20 +4033,20 @@ static HRESULT WINAPI ddraw7_CreatePalette(IDirectDraw7 *iface, DWORD Flags, return DD_OK; } -static HRESULT WINAPI ddraw4_CreatePalette(IDirectDraw4 *iface, DWORD flags, - PALETTEENTRY *entries, IDirectDrawPalette **palette, IUnknown *outer_unknown) +static HRESULT WINAPI ddraw4_CreatePalette(IDirectDraw4 *iface, DWORD flags, PALETTEENTRY *entries, + IDirectDrawPalette **palette, IUnknown *outer_unknown) { - IDirectDrawImpl *ddraw = ddraw_from_ddraw4(iface); + IDirectDrawImpl *This = impl_from_IDirectDraw4(iface); HRESULT hr; TRACE("iface %p, flags %#x, entries %p, palette %p, outer_unknown %p.\n", iface, flags, entries, palette, outer_unknown); - hr = ddraw7_CreatePalette((IDirectDraw7 *)ddraw, flags, entries, palette, outer_unknown); + hr = ddraw7_CreatePalette(&This->IDirectDraw7_iface, flags, entries, palette, outer_unknown); if (SUCCEEDED(hr) && *palette) { IDirectDrawPaletteImpl *impl = (IDirectDrawPaletteImpl *)*palette; - IDirectDraw7_Release((IDirectDraw7 *)ddraw); + IDirectDraw7_Release(&This->IDirectDraw7_iface); IDirectDraw4_AddRef(iface); impl->ifaceToRelease = (IUnknown *)iface; } @@ -3953,17 +4056,17 @@ static HRESULT WINAPI ddraw4_CreatePalette(IDirectDraw4 *iface, DWORD flags, static HRESULT WINAPI ddraw3_CreatePalette(IDirectDraw3 *iface, DWORD flags, PALETTEENTRY *entries, IDirectDrawPalette **palette, IUnknown *outer_unknown) { - IDirectDrawImpl *ddraw = ddraw_from_ddraw3(iface); + IDirectDrawImpl *This = impl_from_IDirectDraw3(iface); HRESULT hr; TRACE("iface %p, flags %#x, entries %p, palette %p, outer_unknown %p.\n", iface, flags, entries, palette, outer_unknown); - hr = ddraw7_CreatePalette((IDirectDraw7 *)ddraw, flags, entries, palette, outer_unknown); + hr = ddraw7_CreatePalette(&This->IDirectDraw7_iface, flags, entries, palette, outer_unknown); if (SUCCEEDED(hr) && *palette) { IDirectDrawPaletteImpl *impl = (IDirectDrawPaletteImpl *)*palette; - IDirectDraw7_Release((IDirectDraw7 *)ddraw); + IDirectDraw7_Release(&This->IDirectDraw7_iface); IDirectDraw4_AddRef(iface); impl->ifaceToRelease = (IUnknown *)iface; } @@ -3974,17 +4077,17 @@ static HRESULT WINAPI ddraw3_CreatePalette(IDirectDraw3 *iface, DWORD flags, static HRESULT WINAPI ddraw2_CreatePalette(IDirectDraw2 *iface, DWORD flags, PALETTEENTRY *entries, IDirectDrawPalette **palette, IUnknown *outer_unknown) { - IDirectDrawImpl *ddraw = ddraw_from_ddraw2(iface); + IDirectDrawImpl *This = impl_from_IDirectDraw2(iface); HRESULT hr; TRACE("iface %p, flags %#x, entries %p, palette %p, outer_unknown %p.\n", iface, flags, entries, palette, outer_unknown); - hr = ddraw7_CreatePalette((IDirectDraw7 *)ddraw, flags, entries, palette, outer_unknown); + hr = ddraw7_CreatePalette(&This->IDirectDraw7_iface, flags, entries, palette, outer_unknown); if (SUCCEEDED(hr) && *palette) { IDirectDrawPaletteImpl *impl = (IDirectDrawPaletteImpl *)*palette; - IDirectDraw7_Release((IDirectDraw7 *)ddraw); + IDirectDraw7_Release(&This->IDirectDraw7_iface); impl->ifaceToRelease = NULL; } @@ -3994,17 +4097,17 @@ static HRESULT WINAPI ddraw2_CreatePalette(IDirectDraw2 *iface, DWORD flags, static HRESULT WINAPI ddraw1_CreatePalette(IDirectDraw *iface, DWORD flags, PALETTEENTRY *entries, IDirectDrawPalette **palette, IUnknown *outer_unknown) { - IDirectDrawImpl *ddraw = ddraw_from_ddraw1(iface); + IDirectDrawImpl *This = impl_from_IDirectDraw(iface); HRESULT hr; TRACE("iface %p, flags %#x, entries %p, palette %p, outer_unknown %p.\n", iface, flags, entries, palette, outer_unknown); - hr = ddraw7_CreatePalette((IDirectDraw7 *)ddraw, flags, entries, palette, outer_unknown); + hr = ddraw7_CreatePalette(&This->IDirectDraw7_iface, flags, entries, palette, outer_unknown); if (SUCCEEDED(hr) && *palette) { IDirectDrawPaletteImpl *impl = (IDirectDrawPaletteImpl *)*palette; - IDirectDraw7_Release((IDirectDraw7 *)ddraw); + IDirectDraw7_Release(&This->IDirectDraw7_iface); impl->ifaceToRelease = NULL; } @@ -4042,24 +4145,27 @@ static HRESULT WINAPI ddraw7_DuplicateSurface(IDirectDraw7 *iface, NULL); } -static HRESULT WINAPI ddraw4_DuplicateSurface(IDirectDraw4 *iface, - IDirectDrawSurface4 *src, IDirectDrawSurface4 **dst) +static HRESULT WINAPI ddraw4_DuplicateSurface(IDirectDraw4 *iface, IDirectDrawSurface4 *src, + IDirectDrawSurface4 **dst) { + IDirectDrawImpl *This = impl_from_IDirectDraw4(iface); + TRACE("iface %p, src %p, dst %p.\n", iface, src, dst); - return ddraw7_DuplicateSurface((IDirectDraw7 *)ddraw_from_ddraw4(iface), - (IDirectDrawSurface7 *)src, (IDirectDrawSurface7 **)dst); + return ddraw7_DuplicateSurface(&This->IDirectDraw7_iface, (IDirectDrawSurface7 *)src, + (IDirectDrawSurface7 **)dst); } -static HRESULT WINAPI ddraw3_DuplicateSurface(IDirectDraw3 *iface, - IDirectDrawSurface *src, IDirectDrawSurface **dst) +static HRESULT WINAPI ddraw3_DuplicateSurface(IDirectDraw3 *iface, IDirectDrawSurface *src, + IDirectDrawSurface **dst) { + IDirectDrawImpl *This = impl_from_IDirectDraw3(iface); IDirectDrawSurface7 *src7, *dst7; HRESULT hr; TRACE("iface %p, src %p, dst %p.\n", iface, src, dst); src7 = (IDirectDrawSurface7 *)surface_from_surface3((IDirectDrawSurface3 *)src); - hr = ddraw7_DuplicateSurface((IDirectDraw7 *)ddraw_from_ddraw3(iface), src7, &dst7); + hr = ddraw7_DuplicateSurface(&This->IDirectDraw7_iface, src7, &dst7); if (FAILED(hr)) return hr; *dst = (IDirectDrawSurface *)&((IDirectDrawSurfaceImpl *)dst7)->IDirectDrawSurface3_vtbl; @@ -4069,27 +4175,29 @@ static HRESULT WINAPI ddraw3_DuplicateSurface(IDirectDraw3 *iface, static HRESULT WINAPI ddraw2_DuplicateSurface(IDirectDraw2 *iface, IDirectDrawSurface *src, IDirectDrawSurface **dst) { + IDirectDrawImpl *This = impl_from_IDirectDraw2(iface); IDirectDrawSurface7 *src7, *dst7; HRESULT hr; TRACE("iface %p, src %p, dst %p.\n", iface, src, dst); src7 = (IDirectDrawSurface7 *)surface_from_surface3((IDirectDrawSurface3 *)src); - hr = ddraw7_DuplicateSurface((IDirectDraw7 *)ddraw_from_ddraw2(iface), src7, &dst7); + hr = ddraw7_DuplicateSurface(&This->IDirectDraw7_iface, src7, &dst7); if (FAILED(hr)) return hr; *dst = (IDirectDrawSurface *)&((IDirectDrawSurfaceImpl *)dst7)->IDirectDrawSurface3_vtbl; return hr; } -static HRESULT WINAPI ddraw1_DuplicateSurface(IDirectDraw *iface, - IDirectDrawSurface *src, IDirectDrawSurface **dst) +static HRESULT WINAPI ddraw1_DuplicateSurface(IDirectDraw *iface, IDirectDrawSurface *src, + IDirectDrawSurface **dst) { + IDirectDrawImpl *This = impl_from_IDirectDraw(iface); IDirectDrawSurface7 *src7, *dst7; HRESULT hr; TRACE("iface %p, src %p, dst %p.\n", iface, src, dst); src7 = (IDirectDrawSurface7 *)surface_from_surface3((IDirectDrawSurface3 *)src); - hr = ddraw7_DuplicateSurface((IDirectDraw7 *)ddraw_from_ddraw1(iface), src7, &dst7); + hr = ddraw7_DuplicateSurface(&This->IDirectDraw7_iface, src7, &dst7); if (FAILED(hr)) return hr; *dst = (IDirectDrawSurface *)&((IDirectDrawSurfaceImpl *)dst7)->IDirectDrawSurface3_vtbl; @@ -4119,7 +4227,7 @@ static HRESULT WINAPI d3d7_EnumDevices(IDirect3D7 *iface, LPD3DENUMDEVICESCALLBA char interface_name_rgb[] = "WINE Direct3D7 RGB Software Emulation using WineD3D"; char device_name_rgb[] = "Wine D3D7 RGB"; - IDirectDrawImpl *ddraw = ddraw_from_d3d7(iface); + IDirectDrawImpl *This = impl_from_IDirect3D7(iface); D3DDEVICEDESC7 device_desc7; D3DDEVICEDESC device_desc1; HRESULT hr; @@ -4128,7 +4236,7 @@ static HRESULT WINAPI d3d7_EnumDevices(IDirect3D7 *iface, LPD3DENUMDEVICESCALLBA EnterCriticalSection(&ddraw_cs); - hr = IDirect3DImpl_GetCaps(ddraw->wineD3D, &device_desc1, &device_desc7); + hr = IDirect3DImpl_GetCaps(This->wineD3D, &device_desc1, &device_desc7); if (hr != D3D_OK) { LeaveCriticalSection(&ddraw_cs); @@ -4170,7 +4278,7 @@ static HRESULT WINAPI d3d3_EnumDevices(IDirect3D3 *iface, LPD3DENUMDEVICESCALLBA { static CHAR wined3d_description[] = "Wine D3DDevice using WineD3D and OpenGL"; - IDirectDrawImpl *ddraw = ddraw_from_d3d3(iface); + IDirectDrawImpl *This = impl_from_IDirect3D3(iface); D3DDEVICEDESC device_desc1, hal_desc, hel_desc; D3DDEVICEDESC7 device_desc7; HRESULT hr; @@ -4185,7 +4293,7 @@ static HRESULT WINAPI d3d3_EnumDevices(IDirect3D3 *iface, LPD3DENUMDEVICESCALLBA EnterCriticalSection(&ddraw_cs); - hr = IDirect3DImpl_GetCaps(ddraw->wineD3D, &device_desc1, &device_desc7); + hr = IDirect3DImpl_GetCaps(This->wineD3D, &device_desc1, &device_desc7); if (hr != D3D_OK) { LeaveCriticalSection(&ddraw_cs); @@ -4211,7 +4319,7 @@ static HRESULT WINAPI d3d3_EnumDevices(IDirect3D3 *iface, LPD3DENUMDEVICESCALLBA * limitation flag), and it refuses all devices that have the perspective * flag set. This way it refuses the emulation device, and HAL devices * never have POW2 unset in d3d7 on windows. */ - if (ddraw->d3dversion != 1) + if (This->d3dversion != 1) { static CHAR reference_description[] = "RGB Direct3D emulation"; @@ -4260,16 +4368,20 @@ static HRESULT WINAPI d3d3_EnumDevices(IDirect3D3 *iface, LPD3DENUMDEVICESCALLBA static HRESULT WINAPI d3d2_EnumDevices(IDirect3D2 *iface, LPD3DENUMDEVICESCALLBACK callback, void *context) { + IDirectDrawImpl *This = impl_from_IDirect3D2(iface); + TRACE("iface %p, callback %p, context %p.\n", iface, callback, context); - return d3d3_EnumDevices((IDirect3D3 *)&ddraw_from_d3d2(iface)->IDirect3D3_vtbl, callback, context); + return d3d3_EnumDevices(&This->IDirect3D3_iface, callback, context); } static HRESULT WINAPI d3d1_EnumDevices(IDirect3D *iface, LPD3DENUMDEVICESCALLBACK callback, void *context) { + IDirectDrawImpl *This = impl_from_IDirect3D(iface); + TRACE("iface %p, callback %p, context %p.\n", iface, callback, context); - return d3d3_EnumDevices((IDirect3D3 *)&ddraw_from_d3d1(iface)->IDirect3D3_vtbl, callback, context); + return d3d3_EnumDevices(&This->IDirect3D3_iface, callback, context); } /***************************************************************************** @@ -4293,8 +4405,10 @@ static HRESULT WINAPI d3d1_EnumDevices(IDirect3D *iface, LPD3DENUMDEVICESCALLBAC * CLASS_E_NOAGGREGATION if outer_unknown != NULL * *****************************************************************************/ -static HRESULT WINAPI d3d3_CreateLight(IDirect3D3 *iface, IDirect3DLight **light, IUnknown *outer_unknown) +static HRESULT WINAPI d3d3_CreateLight(IDirect3D3 *iface, IDirect3DLight **light, + IUnknown *outer_unknown) { + IDirectDrawImpl *This = impl_from_IDirect3D3(iface); IDirect3DLightImpl *object; TRACE("iface %p, light %p, outer_unknown %p.\n", iface, light, outer_unknown); @@ -4308,7 +4422,7 @@ static HRESULT WINAPI d3d3_CreateLight(IDirect3D3 *iface, IDirect3DLight **light return DDERR_OUTOFMEMORY; } - d3d_light_init(object, ddraw_from_d3d3(iface)); + d3d_light_init(object, This); TRACE("Created light %p.\n", object); *light = (IDirect3DLight *)object; @@ -4318,16 +4432,20 @@ static HRESULT WINAPI d3d3_CreateLight(IDirect3D3 *iface, IDirect3DLight **light static HRESULT WINAPI d3d2_CreateLight(IDirect3D2 *iface, IDirect3DLight **light, IUnknown *outer_unknown) { + IDirectDrawImpl *This = impl_from_IDirect3D2(iface); + TRACE("iface %p, light %p, outer_unknown %p.\n", iface, light, outer_unknown); - return d3d3_CreateLight((IDirect3D3 *)&ddraw_from_d3d2(iface)->IDirect3D3_vtbl, light, outer_unknown); + return d3d3_CreateLight(&This->IDirect3D3_iface, light, outer_unknown); } static HRESULT WINAPI d3d1_CreateLight(IDirect3D *iface, IDirect3DLight **light, IUnknown *outer_unknown) { + IDirectDrawImpl *This = impl_from_IDirect3D(iface); + TRACE("iface %p, light %p, outer_unknown %p.\n", iface, light, outer_unknown); - return d3d3_CreateLight((IDirect3D3 *)&ddraw_from_d3d1(iface)->IDirect3D3_vtbl, light, outer_unknown); + return d3d3_CreateLight(&This->IDirect3D3_iface, light, outer_unknown); } /***************************************************************************** @@ -4350,8 +4468,10 @@ static HRESULT WINAPI d3d1_CreateLight(IDirect3D *iface, IDirect3DLight **light, * CLASS_E_NOAGGREGATION if outer_unknown != NULL * *****************************************************************************/ -static HRESULT WINAPI d3d3_CreateMaterial(IDirect3D3 *iface, IDirect3DMaterial3 **material, IUnknown *outer_unknown) +static HRESULT WINAPI d3d3_CreateMaterial(IDirect3D3 *iface, IDirect3DMaterial3 **material, + IUnknown *outer_unknown) { + IDirectDrawImpl *This = impl_from_IDirect3D3(iface); IDirect3DMaterialImpl *object; TRACE("iface %p, material %p, outer_unknown %p.\n", iface, material, outer_unknown); @@ -4365,7 +4485,7 @@ static HRESULT WINAPI d3d3_CreateMaterial(IDirect3D3 *iface, IDirect3DMaterial3 return DDERR_OUTOFMEMORY; } - d3d_material_init(object, ddraw_from_d3d3(iface)); + d3d_material_init(object, This); TRACE("Created material %p.\n", object); *material = (IDirect3DMaterial3 *)object; @@ -4375,12 +4495,13 @@ static HRESULT WINAPI d3d3_CreateMaterial(IDirect3D3 *iface, IDirect3DMaterial3 static HRESULT WINAPI d3d2_CreateMaterial(IDirect3D2 *iface, IDirect3DMaterial2 **material, IUnknown *outer_unknown) { + IDirectDrawImpl *This = impl_from_IDirect3D2(iface); IDirect3DMaterial3 *material3; HRESULT hr; TRACE("iface %p, material %p, outer_unknown %p.\n", iface, material, outer_unknown); - hr = d3d3_CreateMaterial((IDirect3D3 *)&ddraw_from_d3d2(iface)->IDirect3D3_vtbl, &material3, outer_unknown); + hr = d3d3_CreateMaterial(&This->IDirect3D3_iface, &material3, outer_unknown); *material = material3 ? (IDirect3DMaterial2 *)&((IDirect3DMaterialImpl *)material3)->IDirect3DMaterial2_vtbl : NULL; TRACE("Returning material %p.\n", *material); @@ -4393,9 +4514,11 @@ static HRESULT WINAPI d3d1_CreateMaterial(IDirect3D *iface, IDirect3DMaterial ** IDirect3DMaterial3 *material3; HRESULT hr; + IDirectDrawImpl *This = impl_from_IDirect3D(iface); + TRACE("iface %p, material %p, outer_unknown %p.\n", iface, material, outer_unknown); - hr = d3d3_CreateMaterial((IDirect3D3 *)&ddraw_from_d3d1(iface)->IDirect3D3_vtbl, &material3, outer_unknown); + hr = d3d3_CreateMaterial(&This->IDirect3D3_iface, &material3, outer_unknown); *material = material3 ? (IDirect3DMaterial *)&((IDirect3DMaterialImpl *)material3)->IDirect3DMaterial_vtbl : NULL; TRACE("Returning material %p.\n", *material); @@ -4423,8 +4546,10 @@ static HRESULT WINAPI d3d1_CreateMaterial(IDirect3D *iface, IDirect3DMaterial ** * CLASS_E_NOAGGREGATION if outer_unknown != NULL * *****************************************************************************/ -static HRESULT WINAPI d3d3_CreateViewport(IDirect3D3 *iface, IDirect3DViewport3 **viewport, IUnknown *outer_unknown) +static HRESULT WINAPI d3d3_CreateViewport(IDirect3D3 *iface, IDirect3DViewport3 **viewport, + IUnknown *outer_unknown) { + IDirectDrawImpl *This = impl_from_IDirect3D3(iface); IDirect3DViewportImpl *object; TRACE("iface %p, viewport %p, outer_unknown %p.\n", iface, viewport, outer_unknown); @@ -4438,7 +4563,7 @@ static HRESULT WINAPI d3d3_CreateViewport(IDirect3D3 *iface, IDirect3DViewport3 return DDERR_OUTOFMEMORY; } - d3d_viewport_init(object, ddraw_from_d3d3(iface)); + d3d_viewport_init(object, This); TRACE("Created viewport %p.\n", object); *viewport = (IDirect3DViewport3 *)object; @@ -4448,18 +4573,22 @@ static HRESULT WINAPI d3d3_CreateViewport(IDirect3D3 *iface, IDirect3DViewport3 static HRESULT WINAPI d3d2_CreateViewport(IDirect3D2 *iface, IDirect3DViewport2 **viewport, IUnknown *outer_unknown) { + IDirectDrawImpl *This = impl_from_IDirect3D2(iface); + TRACE("iface %p, viewport %p, outer_unknown %p.\n", iface, viewport, outer_unknown); - return d3d3_CreateViewport((IDirect3D3 *)&ddraw_from_d3d2(iface)->IDirect3D3_vtbl, - (IDirect3DViewport3 **)viewport, outer_unknown); + return d3d3_CreateViewport(&This->IDirect3D3_iface, (IDirect3DViewport3 **)viewport, + outer_unknown); } static HRESULT WINAPI d3d1_CreateViewport(IDirect3D *iface, IDirect3DViewport **viewport, IUnknown *outer_unknown) { + IDirectDrawImpl *This = impl_from_IDirect3D(iface); + TRACE("iface %p, viewport %p, outer_unknown %p.\n", iface, viewport, outer_unknown); - return d3d3_CreateViewport((IDirect3D3 *)&ddraw_from_d3d1(iface)->IDirect3D3_vtbl, - (IDirect3DViewport3 **)viewport, outer_unknown); + return d3d3_CreateViewport(&This->IDirect3D3_iface, (IDirect3DViewport3 **)viewport, + outer_unknown); } /***************************************************************************** @@ -4480,7 +4609,7 @@ static HRESULT WINAPI d3d1_CreateViewport(IDirect3D *iface, IDirect3DViewport ** *****************************************************************************/ static HRESULT WINAPI d3d3_FindDevice(IDirect3D3 *iface, D3DFINDDEVICESEARCH *fds, D3DFINDDEVICERESULT *fdr) { - IDirectDrawImpl *ddraw = ddraw_from_d3d3(iface); + IDirectDrawImpl *This = impl_from_IDirect3D3(iface); D3DDEVICEDESC7 desc7; D3DDEVICEDESC desc1; HRESULT hr; @@ -4513,7 +4642,7 @@ static HRESULT WINAPI d3d3_FindDevice(IDirect3D3 *iface, D3DFINDDEVICESEARCH *fd } /* Get the caps */ - hr = IDirect3DImpl_GetCaps(ddraw->wineD3D, &desc1, &desc7); + hr = IDirect3DImpl_GetCaps(This->wineD3D, &desc1, &desc7); if (hr != D3D_OK) return hr; /* Now return our own GUID */ @@ -4528,16 +4657,20 @@ static HRESULT WINAPI d3d3_FindDevice(IDirect3D3 *iface, D3DFINDDEVICESEARCH *fd static HRESULT WINAPI d3d2_FindDevice(IDirect3D2 *iface, D3DFINDDEVICESEARCH *fds, D3DFINDDEVICERESULT *fdr) { + IDirectDrawImpl *This = impl_from_IDirect3D2(iface); + TRACE("iface %p, fds %p, fdr %p.\n", iface, fds, fdr); - return d3d3_FindDevice((IDirect3D3 *)&ddraw_from_d3d2(iface)->IDirect3D3_vtbl, fds, fdr); + return d3d3_FindDevice(&This->IDirect3D3_iface, fds, fdr); } static HRESULT WINAPI d3d1_FindDevice(IDirect3D *iface, D3DFINDDEVICESEARCH *fds, D3DFINDDEVICERESULT *fdr) { + IDirectDrawImpl *This = impl_from_IDirect3D(iface); + TRACE("iface %p, fds %p, fdr %p.\n", iface, fds, fdr); - return d3d3_FindDevice((IDirect3D3 *)&ddraw_from_d3d1(iface)->IDirect3D3_vtbl, fds, fdr); + return d3d3_FindDevice(&This->IDirect3D3_iface, fds, fdr); } /***************************************************************************** @@ -4565,7 +4698,7 @@ static HRESULT WINAPI d3d7_CreateDevice(IDirect3D7 *iface, REFCLSID riid, IDirectDrawSurface7 *surface, IDirect3DDevice7 **device) { IDirectDrawSurfaceImpl *target = (IDirectDrawSurfaceImpl *)surface; - IDirectDrawImpl *ddraw = ddraw_from_d3d7(iface); + IDirectDrawImpl *This = impl_from_IDirect3D7(iface); IDirect3DDeviceImpl *object; HRESULT hr; @@ -4575,7 +4708,7 @@ static HRESULT WINAPI d3d7_CreateDevice(IDirect3D7 *iface, REFCLSID riid, *device = NULL; /* Fail device creation if non-opengl surfaces are used. */ - if (ddraw->ImplType != SURFACE_OPENGL) + if (This->ImplType != SURFACE_OPENGL) { ERR("The application wants to create a Direct3D device, but non-opengl surfaces are set in the registry.\n"); ERR("Please set the surface implementation to opengl or autodetection to allow 3D rendering.\n"); @@ -4586,7 +4719,7 @@ static HRESULT WINAPI d3d7_CreateDevice(IDirect3D7 *iface, REFCLSID riid, return DDERR_NO3D; } - if (ddraw->d3ddevice) + if (This->d3ddevice) { FIXME("Only one Direct3D device per DirectDraw object supported.\n"); LeaveCriticalSection(&ddraw_cs); @@ -4601,7 +4734,7 @@ static HRESULT WINAPI d3d7_CreateDevice(IDirect3D7 *iface, REFCLSID riid, return DDERR_OUTOFMEMORY; } - hr = d3d_device_init(object, ddraw, target); + hr = d3d_device_init(object, This, target); if (FAILED(hr)) { WARN("Failed to initialize device, hr %#x.\n", hr); @@ -4620,6 +4753,7 @@ static HRESULT WINAPI d3d7_CreateDevice(IDirect3D7 *iface, REFCLSID riid, static HRESULT WINAPI d3d3_CreateDevice(IDirect3D3 *iface, REFCLSID riid, IDirectDrawSurface4 *surface, IDirect3DDevice3 **device, IUnknown *outer_unknown) { + IDirectDrawImpl *This = impl_from_IDirect3D3(iface); HRESULT hr; TRACE("iface %p, riid %s, surface %p, device %p, outer_unknown %p.\n", @@ -4627,8 +4761,8 @@ static HRESULT WINAPI d3d3_CreateDevice(IDirect3D3 *iface, REFCLSID riid, if (outer_unknown) return CLASS_E_NOAGGREGATION; - hr = d3d7_CreateDevice((IDirect3D7 *)&ddraw_from_d3d3(iface)->IDirect3D7_vtbl, riid, - (IDirectDrawSurface7 *)surface, (IDirect3DDevice7 **)device); + hr = d3d7_CreateDevice(&This->IDirect3D7_iface, riid, (IDirectDrawSurface7 *)surface, + (IDirect3DDevice7 **)device); if (*device) *device = (IDirect3DDevice3 *)&((IDirect3DDeviceImpl *)*device)->IDirect3DDevice3_vtbl; return hr; @@ -4637,12 +4771,13 @@ static HRESULT WINAPI d3d3_CreateDevice(IDirect3D3 *iface, REFCLSID riid, static HRESULT WINAPI d3d2_CreateDevice(IDirect3D2 *iface, REFCLSID riid, IDirectDrawSurface *surface, IDirect3DDevice2 **device) { + IDirectDrawImpl *This = impl_from_IDirect3D2(iface); HRESULT hr; TRACE("iface %p, riid %s, surface %p, device %p.\n", iface, debugstr_guid(riid), surface, device); - hr = d3d7_CreateDevice((IDirect3D7 *)&ddraw_from_d3d2(iface)->IDirect3D7_vtbl, riid, + hr = d3d7_CreateDevice(&This->IDirect3D7_iface, riid, surface ? (IDirectDrawSurface7 *)surface_from_surface3((IDirectDrawSurface3 *)surface) : NULL, (IDirect3DDevice7 **)device); if (*device) *device = (IDirect3DDevice2 *)&((IDirect3DDeviceImpl *)*device)->IDirect3DDevice2_vtbl; @@ -4673,6 +4808,7 @@ static HRESULT WINAPI d3d2_CreateDevice(IDirect3D2 *iface, REFCLSID riid, static HRESULT WINAPI d3d7_CreateVertexBuffer(IDirect3D7 *iface, D3DVERTEXBUFFERDESC *desc, IDirect3DVertexBuffer7 **vertex_buffer, DWORD flags) { + IDirectDrawImpl *This = impl_from_IDirect3D7(iface); IDirect3DVertexBufferImpl *object; HRESULT hr; @@ -4695,7 +4831,7 @@ static HRESULT WINAPI d3d7_CreateVertexBuffer(IDirect3D7 *iface, D3DVERTEXBUFFER return DDERR_OUTOFMEMORY; } - hr = d3d_vertex_buffer_init(object, ddraw_from_d3d7(iface), desc); + hr = d3d_vertex_buffer_init(object, This, desc); if (FAILED(hr)) { WARN("Failed to initialize vertex buffer, hr %#x.\n", hr); @@ -4712,7 +4848,7 @@ static HRESULT WINAPI d3d7_CreateVertexBuffer(IDirect3D7 *iface, D3DVERTEXBUFFER static HRESULT WINAPI d3d3_CreateVertexBuffer(IDirect3D3 *iface, D3DVERTEXBUFFERDESC *desc, IDirect3DVertexBuffer **vertex_buffer, DWORD flags, IUnknown *outer_unknown) { - IDirectDrawImpl *This = ddraw_from_d3d3(iface); + IDirectDrawImpl *This = impl_from_IDirect3D3(iface); HRESULT hr; TRACE("iface %p, desc %p, vertex_buffer %p, flags %#x, outer_unknown %p.\n", @@ -4720,8 +4856,8 @@ static HRESULT WINAPI d3d3_CreateVertexBuffer(IDirect3D3 *iface, D3DVERTEXBUFFER if (outer_unknown) return CLASS_E_NOAGGREGATION; - hr = d3d7_CreateVertexBuffer((IDirect3D7 *)&This->IDirect3D7_vtbl, - desc, (IDirect3DVertexBuffer7 **)vertex_buffer, flags); + hr = d3d7_CreateVertexBuffer(&This->IDirect3D7_iface, desc, + (IDirect3DVertexBuffer7 **)vertex_buffer, flags); if (*vertex_buffer) *vertex_buffer = (IDirect3DVertexBuffer *)&((IDirect3DVertexBufferImpl *)*vertex_buffer)->IDirect3DVertexBuffer_vtbl; @@ -4749,7 +4885,7 @@ static HRESULT WINAPI d3d3_CreateVertexBuffer(IDirect3D3 *iface, D3DVERTEXBUFFER static HRESULT WINAPI d3d7_EnumZBufferFormats(IDirect3D7 *iface, REFCLSID device_iid, LPD3DENUMPIXELFORMATSCALLBACK callback, void *context) { - IDirectDrawImpl *ddraw = ddraw_from_d3d7(iface); + IDirectDrawImpl *This = impl_from_IDirect3D7(iface); WINED3DDISPLAYMODE d3ddm; WINED3DDEVTYPE type; unsigned int i; @@ -4808,11 +4944,11 @@ static HRESULT WINAPI d3d7_EnumZBufferFormats(IDirect3D7 *iface, REFCLSID device * not like that we'll have to find some workaround, like iterating over * all imaginable formats and collecting all the depth stencil formats we * can get. */ - hr = IWineD3DDevice_GetDisplayMode(ddraw->wineD3DDevice, 0, &d3ddm); + hr = wined3d_device_get_display_mode(This->wined3d_device, 0, &d3ddm); for (i = 0; i < (sizeof(formats) / sizeof(*formats)); ++i) { - hr = IWineD3D_CheckDeviceFormat(ddraw->wineD3D, WINED3DADAPTER_DEFAULT, type, d3ddm.Format, + hr = wined3d_check_device_format(This->wineD3D, WINED3DADAPTER_DEFAULT, type, d3ddm.Format, WINED3DUSAGE_DEPTHSTENCIL, WINED3DRTYPE_SURFACE, formats[i], SURFACE_OPENGL); if (SUCCEEDED(hr)) { @@ -4841,11 +4977,12 @@ static HRESULT WINAPI d3d7_EnumZBufferFormats(IDirect3D7 *iface, REFCLSID device static HRESULT WINAPI d3d3_EnumZBufferFormats(IDirect3D3 *iface, REFCLSID device_iid, LPD3DENUMPIXELFORMATSCALLBACK callback, void *context) { + IDirectDrawImpl *This = impl_from_IDirect3D3(iface); + TRACE("iface %p, device_iid %s, callback %p, context %p.\n", iface, debugstr_guid(device_iid), callback, context); - return d3d7_EnumZBufferFormats((IDirect3D7 *)&ddraw_from_d3d3(iface)->IDirect3D7_vtbl, - device_iid, callback, context); + return d3d7_EnumZBufferFormats(&This->IDirect3D7_iface, device_iid, callback, context); } /***************************************************************************** @@ -4872,9 +5009,11 @@ static HRESULT WINAPI d3d7_EvictManagedTextures(IDirect3D7 *iface) static HRESULT WINAPI d3d3_EvictManagedTextures(IDirect3D3 *iface) { + IDirectDrawImpl *This = impl_from_IDirect3D3(iface); + TRACE("iface %p.\n", iface); - return d3d7_EvictManagedTextures((IDirect3D7 *)&ddraw_from_d3d3(iface)->IDirect3D7_vtbl); + return d3d7_EvictManagedTextures(&This->IDirect3D7_iface); } /***************************************************************************** @@ -4893,7 +5032,7 @@ static HRESULT WINAPI d3d3_EvictManagedTextures(IDirect3D3 *iface) * D3D_OK on success, or the return value of IWineD3D::GetCaps * *****************************************************************************/ -HRESULT IDirect3DImpl_GetCaps(IWineD3D *wined3d, D3DDEVICEDESC *desc1, D3DDEVICEDESC7 *desc7) +HRESULT IDirect3DImpl_GetCaps(const struct wined3d *wined3d, D3DDEVICEDESC *desc1, D3DDEVICEDESC7 *desc7) { WINED3DCAPS wined3d_caps; HRESULT hr; @@ -4903,7 +5042,7 @@ HRESULT IDirect3DImpl_GetCaps(IWineD3D *wined3d, D3DDEVICEDESC *desc1, D3DDEVICE memset(&wined3d_caps, 0, sizeof(wined3d_caps)); EnterCriticalSection(&ddraw_cs); - hr = IWineD3D_GetDeviceCaps(wined3d, 0, WINED3DDEVTYPE_HAL, &wined3d_caps); + hr = wined3d_get_device_caps(wined3d, 0, WINED3DDEVTYPE_HAL, &wined3d_caps); LeaveCriticalSection(&ddraw_cs); if (FAILED(hr)) { @@ -5428,14 +5567,13 @@ static const struct IDirect3DVtbl d3d1_vtbl = * fvf: Fvf to find the decl for * * Returns: - * NULL in case of an error, the IWineD3DVertexDeclaration interface for the - * fvf otherwise. + * NULL in case of an error, the vertex declaration for the FVF otherwise. * *****************************************************************************/ -IWineD3DVertexDeclaration *ddraw_find_decl(IDirectDrawImpl *This, DWORD fvf) +struct wined3d_vertex_declaration *ddraw_find_decl(IDirectDrawImpl *This, DWORD fvf) { + struct wined3d_vertex_declaration *pDecl = NULL; HRESULT hr; - IWineD3DVertexDeclaration* pDecl = NULL; int p, low, high; /* deliberately signed */ struct FvfToDecl *convertedDecls = This->decls; @@ -5457,7 +5595,7 @@ IWineD3DVertexDeclaration *ddraw_find_decl(IDirectDrawImpl *This, DWORD fvf) } TRACE("not found. Creating and inserting at position %d.\n", low); - hr = IWineD3DDevice_CreateVertexDeclarationFromFVF(This->wineD3DDevice, + hr = wined3d_vertex_declaration_create_from_fvf(This->wined3d_device, fvf, This, &ddraw_null_wined3d_parent_ops, &pDecl); if (hr != S_OK) return NULL; @@ -5465,9 +5603,9 @@ IWineD3DVertexDeclaration *ddraw_find_decl(IDirectDrawImpl *This, DWORD fvf) int grow = max(This->declArraySize / 2, 8); convertedDecls = HeapReAlloc(GetProcessHeap(), 0, convertedDecls, sizeof(convertedDecls[0]) * (This->numConvertedDecls + grow)); - if(!convertedDecls) { - /* This will destroy it */ - IWineD3DVertexDeclaration_Release(pDecl); + if (!convertedDecls) + { + wined3d_vertex_declaration_decref(pDecl); return NULL; } This->decls = convertedDecls; @@ -5483,50 +5621,29 @@ IWineD3DVertexDeclaration *ddraw_find_decl(IDirectDrawImpl *This, DWORD fvf) return pDecl; } -/* IWineD3DDeviceParent IUnknown methods */ - -static inline struct IDirectDrawImpl *ddraw_from_device_parent(IWineD3DDeviceParent *iface) +static inline struct IDirectDrawImpl *ddraw_from_device_parent(struct wined3d_device_parent *device_parent) { - return (struct IDirectDrawImpl *)((char*)iface - FIELD_OFFSET(struct IDirectDrawImpl, device_parent_vtbl)); + return CONTAINING_RECORD(device_parent, struct IDirectDrawImpl, device_parent); } -static HRESULT STDMETHODCALLTYPE device_parent_QueryInterface(IWineD3DDeviceParent *iface, REFIID riid, void **object) +static void CDECL device_parent_wined3d_device_created(struct wined3d_device_parent *device_parent, + struct wined3d_device *device) { - struct IDirectDrawImpl *This = ddraw_from_device_parent(iface); - return ddraw7_QueryInterface((IDirectDraw7 *)This, riid, object); + TRACE("device_parent %p, device %p.\n", device_parent, device); } -static ULONG STDMETHODCALLTYPE device_parent_AddRef(IWineD3DDeviceParent *iface) +static HRESULT CDECL device_parent_create_surface(struct wined3d_device_parent *device_parent, + void *container_parent, UINT width, UINT height, enum wined3d_format_id format, DWORD usage, + WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, struct wined3d_surface **surface) { - struct IDirectDrawImpl *This = ddraw_from_device_parent(iface); - return ddraw7_AddRef((IDirectDraw7 *)This); -} - -static ULONG STDMETHODCALLTYPE device_parent_Release(IWineD3DDeviceParent *iface) -{ - struct IDirectDrawImpl *This = ddraw_from_device_parent(iface); - return ddraw7_Release((IDirectDraw7 *)This); -} - -/* IWineD3DDeviceParent methods */ - -static void STDMETHODCALLTYPE device_parent_WineD3DDeviceCreated(IWineD3DDeviceParent *iface, IWineD3DDevice *device) -{ - TRACE("iface %p, device %p\n", iface, device); -} - -static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParent *iface, - IUnknown *superior, UINT width, UINT height, enum wined3d_format_id format, DWORD usage, - WINED3DPOOL pool, UINT level, WINED3DCUBEMAP_FACES face, IWineD3DSurface **surface) -{ - struct IDirectDrawImpl *This = ddraw_from_device_parent(iface); + struct IDirectDrawImpl *ddraw = ddraw_from_device_parent(device_parent); IDirectDrawSurfaceImpl *surf = NULL; UINT i = 0; - DDSCAPS2 searchcaps = This->tex_root->surface_desc.ddsCaps; + DDSCAPS2 searchcaps = ddraw->tex_root->surface_desc.ddsCaps; - TRACE("iface %p, superior %p, width %u, height %u, format %#x, usage %#x,\n" - "\tpool %#x, level %u, face %u, surface %p\n", - iface, superior, width, height, format, usage, pool, level, face, surface); + TRACE("device_parent %p, container_parent %p, width %u, height %u, format %#x, usage %#x,\n" + "\tpool %#x, level %u, face %u, surface %p.\n", + device_parent, container_parent, width, height, format, usage, pool, level, face, surface); searchcaps.dwCaps2 &= ~DDSCAPS2_CUBEMAP_ALLFACES; switch(face) @@ -5537,7 +5654,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParen { searchcaps.dwCaps2 |= DDSCAPS2_CUBEMAP_POSITIVEX; } - surf = This->tex_root; break; + surf = ddraw->tex_root; break; case WINED3DCUBEMAP_FACE_NEGATIVE_X: TRACE("Asked for negative x\n"); searchcaps.dwCaps2 |= DDSCAPS2_CUBEMAP_NEGATIVEX; break; @@ -5559,7 +5676,7 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParen if (!surf) { IDirectDrawSurface7 *attached; - IDirectDrawSurface7_GetAttachedSurface((IDirectDrawSurface7 *)This->tex_root, &searchcaps, &attached); + IDirectDrawSurface7_GetAttachedSurface((IDirectDrawSurface7 *)ddraw->tex_root, &searchcaps, &attached); surf = (IDirectDrawSurfaceImpl *)attached; IDirectDrawSurface7_Release(attached); } @@ -5577,8 +5694,8 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateSurface(IWineD3DDeviceParen } /* Return the surface */ - *surface = surf->WineD3DSurface; - IWineD3DSurface_AddRef(*surface); + *surface = surf->wined3d_surface; + wined3d_surface_incref(*surface); TRACE("Returning wineD3DSurface %p, it belongs to surface %p\n", *surface, surf); @@ -5606,18 +5723,19 @@ static HRESULT WINAPI findRenderTarget(IDirectDrawSurface7 *surface, DDSURFACEDE return DDENUMRET_OK; } -static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDeviceParent *iface, - IUnknown *superior, UINT width, UINT height, enum wined3d_format_id format, +static HRESULT CDECL device_parent_create_rendertarget(struct wined3d_device_parent *device_parent, + void *container_parent, UINT width, UINT height, enum wined3d_format_id format, WINED3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality, BOOL lockable, - IWineD3DSurface **surface) + struct wined3d_surface **surface) { - struct IDirectDrawImpl *This = ddraw_from_device_parent(iface); - IDirectDrawSurfaceImpl *d3d_surface = This->d3d_target; + struct IDirectDrawImpl *ddraw = ddraw_from_device_parent(device_parent); + IDirectDrawSurfaceImpl *d3d_surface = ddraw->d3d_target; IDirectDrawSurfaceImpl *target = NULL; - TRACE("iface %p, superior %p, width %u, height %u, format %#x, multisample_type %#x,\n" - "\tmultisample_quality %u, lockable %u, surface %p\n", - iface, superior, width, height, format, multisample_type, multisample_quality, lockable, surface); + TRACE("device_parent %p, container_parent %p, width %u, height %u, format %#x, multisample_type %#x,\n" + "\tmultisample_quality %u, lockable %u, surface %p.\n", + device_parent, container_parent, width, height, format, multisample_type, + multisample_quality, lockable, surface); if (d3d_surface->isRenderTarget) { @@ -5630,14 +5748,14 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDevice if (!target) { - target = This->d3d_target; - ERR(" (%p) : No DirectDrawSurface found to create the back buffer. Using the front buffer as back buffer. Uncertain consequences\n", This); + target = ddraw->d3d_target; + ERR(" (%p) : No DirectDrawSurface found to create the back buffer. Using the front buffer as back buffer. Uncertain consequences\n", ddraw); } /* TODO: Return failure if the dimensions do not match, but this shouldn't happen */ - *surface = target->WineD3DSurface; - IWineD3DSurface_AddRef(*surface); + *surface = target->wined3d_surface; + wined3d_surface_incref(*surface); target->isRenderTarget = TRUE; TRACE("Returning wineD3DSurface %p, it belongs to surface %p\n", *surface, d3d_surface); @@ -5645,18 +5763,18 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateRenderTarget(IWineD3DDevice return D3D_OK; } -static HRESULT STDMETHODCALLTYPE device_parent_CreateDepthStencilSurface(IWineD3DDeviceParent *iface, +static HRESULT CDECL device_parent_create_depth_stencil(struct wined3d_device_parent *device_parent, UINT width, UINT height, enum wined3d_format_id format, WINED3DMULTISAMPLE_TYPE multisample_type, - DWORD multisample_quality, BOOL discard, IWineD3DSurface **surface) + DWORD multisample_quality, BOOL discard, struct wined3d_surface **surface) { - struct IDirectDrawImpl *This = ddraw_from_device_parent(iface); + struct IDirectDrawImpl *ddraw = ddraw_from_device_parent(device_parent); IDirectDrawSurfaceImpl *ddraw_surface; DDSURFACEDESC2 ddsd; HRESULT hr; - TRACE("iface %p, width %u, height %u, format %#x, multisample_type %#x,\n" - "\tmultisample_quality %u, discard %u, surface %p\n", - iface, width, height, format, multisample_type, multisample_quality, discard, surface); + TRACE("device_parent %p, width %u, height %u, format %#x, multisample_type %#x,\n" + "\tmultisample_quality %u, discard %u, surface %p.\n", + device_parent, width, height, format, multisample_type, multisample_quality, discard, surface); *surface = NULL; @@ -5677,89 +5795,74 @@ static HRESULT STDMETHODCALLTYPE device_parent_CreateDepthStencilSurface(IWineD3 ddsd.dwFlags ^= DDSD_PIXELFORMAT; } - This->depthstencil = TRUE; - hr = IDirectDraw7_CreateSurface((IDirectDraw7 *)This, &ddsd, (IDirectDrawSurface7 **)&ddraw_surface, NULL); - This->depthstencil = FALSE; - if(FAILED(hr)) + ddraw->depthstencil = TRUE; + hr = IDirectDraw7_CreateSurface(&ddraw->IDirectDraw7_iface, &ddsd, + (IDirectDrawSurface7 **)&ddraw_surface, NULL); + ddraw->depthstencil = FALSE; + if (FAILED(hr)) { - ERR(" (%p) Creating a DepthStencil Surface failed, result = %x\n", This, hr); + WARN("Failed to create depth/stencil surface, hr %#x.\n", hr); return hr; } - *surface = ddraw_surface->WineD3DSurface; - IWineD3DSurface_AddRef(*surface); + *surface = ddraw_surface->wined3d_surface; + wined3d_surface_incref(*surface); IDirectDrawSurface7_Release((IDirectDrawSurface7 *)ddraw_surface); return D3D_OK; } -static HRESULT STDMETHODCALLTYPE device_parent_CreateVolume(IWineD3DDeviceParent *iface, - IUnknown *superior, UINT width, UINT height, UINT depth, enum wined3d_format_id format, - WINED3DPOOL pool, DWORD usage, IWineD3DVolume **volume) +static HRESULT CDECL device_parent_create_volume(struct wined3d_device_parent *device_parent, + void *container_parent, UINT width, UINT height, UINT depth, enum wined3d_format_id format, + WINED3DPOOL pool, DWORD usage, struct wined3d_volume **volume) { - TRACE("iface %p, superior %p, width %u, height %u, depth %u, format %#x, pool %#x, usage %#x, volume %p\n", - iface, superior, width, height, depth, format, pool, usage, volume); + TRACE("device_parent %p, container_parent %p, width %u, height %u, depth %u, " + "format %#x, pool %#x, usage %#x, volume %p.\n", + device_parent, container_parent, width, height, depth, + format, pool, usage, volume); ERR("Not implemented!\n"); return E_NOTIMPL; } -static HRESULT STDMETHODCALLTYPE device_parent_CreateSwapChain(IWineD3DDeviceParent *iface, - WINED3DPRESENT_PARAMETERS *present_parameters, IWineD3DSwapChain **swapchain) +static HRESULT CDECL device_parent_create_swapchain(struct wined3d_device_parent *device_parent, + WINED3DPRESENT_PARAMETERS *present_parameters, struct wined3d_swapchain **swapchain) { - struct IDirectDrawImpl *This = ddraw_from_device_parent(iface); + struct IDirectDrawImpl *ddraw = ddraw_from_device_parent(device_parent); IDirectDrawSurfaceImpl *iterator; - IParentImpl *object; HRESULT hr; - TRACE("iface %p, present_parameters %p, swapchain %p\n", iface, present_parameters, swapchain); + TRACE("device_parent %p, present_parameters %p, swapchain %p.\n", device_parent, present_parameters, swapchain); - object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IParentImpl)); - if (!object) - { - FIXME("Allocation of memory failed\n"); - *swapchain = NULL; - return DDERR_OUTOFVIDEOMEMORY; - } - - ddraw_parent_init(object); - - hr = IWineD3DDevice_CreateSwapChain(This->wineD3DDevice, present_parameters, - This->ImplType, object, swapchain); + hr = wined3d_swapchain_create(ddraw->wined3d_device, present_parameters, + ddraw->ImplType, NULL, &ddraw_null_wined3d_parent_ops, swapchain); if (FAILED(hr)) { - FIXME("(%p) CreateSwapChain failed, returning %#x\n", iface, hr); - HeapFree(GetProcessHeap(), 0 , object); + WARN("Failed to create swapchain, hr %#x.\n", hr); *swapchain = NULL; return hr; } - object->child = (IUnknown *)*swapchain; - This->d3d_target->wineD3DSwapChain = *swapchain; - iterator = This->d3d_target->complex_array[0]; + ddraw->d3d_target->wined3d_swapchain = *swapchain; + iterator = ddraw->d3d_target->complex_array[0]; while (iterator) { - iterator->wineD3DSwapChain = *swapchain; + iterator->wined3d_swapchain = *swapchain; iterator = iterator->complex_array[0]; } return hr; } -static const IWineD3DDeviceParentVtbl ddraw_wined3d_device_parent_vtbl = +static const struct wined3d_device_parent_ops ddraw_wined3d_device_parent_ops = { - /* IUnknown methods */ - device_parent_QueryInterface, - device_parent_AddRef, - device_parent_Release, - /* IWineD3DDeviceParent methods */ - device_parent_WineD3DDeviceCreated, - device_parent_CreateSurface, - device_parent_CreateRenderTarget, - device_parent_CreateDepthStencilSurface, - device_parent_CreateVolume, - device_parent_CreateSwapChain, + device_parent_wined3d_device_created, + device_parent_create_surface, + device_parent_create_rendertarget, + device_parent_create_depth_stencil, + device_parent_create_volume, + device_parent_create_swapchain, }; HRESULT ddraw_init(IDirectDrawImpl *ddraw, WINED3DDEVTYPE device_type) @@ -5767,16 +5870,16 @@ HRESULT ddraw_init(IDirectDrawImpl *ddraw, WINED3DDEVTYPE device_type) HRESULT hr; HDC hDC; - ddraw->lpVtbl = &ddraw7_vtbl; - ddraw->IDirectDraw_vtbl = &ddraw1_vtbl; - ddraw->IDirectDraw2_vtbl = &ddraw2_vtbl; - ddraw->IDirectDraw3_vtbl = &ddraw3_vtbl; - ddraw->IDirectDraw4_vtbl = &ddraw4_vtbl; - ddraw->IDirect3D_vtbl = &d3d1_vtbl; - ddraw->IDirect3D2_vtbl = &d3d2_vtbl; - ddraw->IDirect3D3_vtbl = &d3d3_vtbl; - ddraw->IDirect3D7_vtbl = &d3d7_vtbl; - ddraw->device_parent_vtbl = &ddraw_wined3d_device_parent_vtbl; + ddraw->IDirectDraw7_iface.lpVtbl = &ddraw7_vtbl; + ddraw->IDirectDraw_iface.lpVtbl = &ddraw1_vtbl; + ddraw->IDirectDraw2_iface.lpVtbl = &ddraw2_vtbl; + ddraw->IDirectDraw3_iface.lpVtbl = &ddraw3_vtbl; + ddraw->IDirectDraw4_iface.lpVtbl = &ddraw4_vtbl; + ddraw->IDirect3D_iface.lpVtbl = &d3d1_vtbl; + ddraw->IDirect3D2_iface.lpVtbl = &d3d2_vtbl; + ddraw->IDirect3D3_iface.lpVtbl = &d3d3_vtbl; + ddraw->IDirect3D7_iface.lpVtbl = &d3d7_vtbl; + ddraw->device_parent.ops = &ddraw_wined3d_device_parent_ops; ddraw->numIfaces = 1; ddraw->ref7 = 1; @@ -5791,30 +5894,24 @@ HRESULT ddraw_init(IDirectDrawImpl *ddraw, WINED3DDEVTYPE device_type) ddraw->orig_width = GetSystemMetrics(SM_CXSCREEN); ddraw->orig_height = GetSystemMetrics(SM_CYSCREEN); - if (!LoadWineD3D()) - { - ERR("Failed to load wined3d - broken OpenGL setup?\n"); - return DDERR_NODIRECTDRAWSUPPORT; - } - - ddraw->wineD3D = pWineDirect3DCreate(7, (IUnknown *)ddraw); + ddraw->wineD3D = wined3d_create(7, &ddraw->IDirectDraw7_iface); if (!ddraw->wineD3D) { WARN("Failed to create a wined3d object.\n"); return E_OUTOFMEMORY; } - hr = IWineD3D_CreateDevice(ddraw->wineD3D, WINED3DADAPTER_DEFAULT, device_type, NULL, 0, - (IWineD3DDeviceParent *)&ddraw->device_parent_vtbl, &ddraw->wineD3DDevice); + hr = wined3d_device_create(ddraw->wineD3D, WINED3DADAPTER_DEFAULT, device_type, + NULL, 0, &ddraw->device_parent, &ddraw->wined3d_device); if (FAILED(hr)) { WARN("Failed to create a wined3d device, hr %#x.\n", hr); - IWineD3D_Release(ddraw->wineD3D); + wined3d_decref(ddraw->wineD3D); return hr; } /* Get the amount of video memory */ - ddraw->total_vidmem = IWineD3DDevice_GetAvailableTextureMem(ddraw->wineD3DDevice); + ddraw->total_vidmem = wined3d_device_get_available_texture_mem(ddraw->wined3d_device); list_init(&ddraw->surface_list); diff --git a/dll/directx/wine/ddraw/ddraw.rbuild b/dll/directx/wine/ddraw/ddraw.rbuild index d221726dfac..3f336ceb8d9 100644 --- a/dll/directx/wine/ddraw/ddraw.rbuild +++ b/dll/directx/wine/ddraw/ddraw.rbuild @@ -27,7 +27,6 @@ main.c material.c palette.c - parent.c regsvr.c stubs.c surface.c @@ -35,6 +34,7 @@ version.rc vertexbuffer.c viewport.c + ddraw_private.h wineheaders diff --git a/dll/directx/wine/ddraw/ddraw_private.h b/dll/directx/wine/ddraw/ddraw_private.h index 91662fe3003..78e69b77aad 100644 --- a/dll/directx/wine/ddraw/ddraw_private.h +++ b/dll/directx/wine/ddraw/ddraw_private.h @@ -38,32 +38,9 @@ #include "wine/wined3d.h" #include "legacy.h" +extern const struct wined3d_parent_ops ddraw_surface_wined3d_parent_ops DECLSPEC_HIDDEN; extern const struct wined3d_parent_ops ddraw_null_wined3d_parent_ops DECLSPEC_HIDDEN; -/***************************************************************************** - * IParent - a helper interface - *****************************************************************************/ -DEFINE_GUID(IID_IParent, 0xc20e4c88, 0x74e7, 0x4940, 0xba, 0x9f, 0x2e, 0x32, 0x3f, 0x9d, 0xc9, 0x81); -typedef struct IParent *LPPARENT, *PPARENT; - -#define INTERFACE IParent -DECLARE_INTERFACE_(IParent,IUnknown) -{ - /*** IUnknown methods ***/ - STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; - STDMETHOD_(ULONG,AddRef)(THIS) PURE; - STDMETHOD_(ULONG,Release)(THIS) PURE; -}; -#undef INTERFACE - -#if !defined(__cplusplus) || defined(CINTERFACE) -/*** IUnknown methods ***/ -#define IParent_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) -#define IParent_AddRef(p) (p)->lpVtbl->AddRef(p) -#define IParent_Release(p) (p)->lpVtbl->Release(p) -#endif - - /* Typdef the interfaces */ typedef struct IDirectDrawImpl IDirectDrawImpl; typedef struct IDirectDrawSurfaceImpl IDirectDrawSurfaceImpl; @@ -75,10 +52,6 @@ typedef struct IDirect3DViewportImpl IDirect3DViewportImpl; typedef struct IDirect3DMaterialImpl IDirect3DMaterialImpl; typedef struct IDirect3DExecuteBufferImpl IDirect3DExecuteBufferImpl; typedef struct IDirect3DVertexBufferImpl IDirect3DVertexBufferImpl; -typedef struct IParentImpl IParentImpl; - -/* Callbacks for implicit object destruction */ -extern ULONG WINAPI D3D7CB_DestroySwapChain(IWineD3DSwapChain *pSwapChain) DECLSPEC_HIDDEN; /* Global critical section */ extern CRITICAL_SECTION ddraw_cs DECLSPEC_HIDDEN; @@ -91,29 +64,29 @@ extern DWORD force_refresh_rate DECLSPEC_HIDDEN; struct FvfToDecl { DWORD fvf; - IWineD3DVertexDeclaration *decl; + struct wined3d_vertex_declaration *decl; }; struct IDirectDrawImpl { - /* IUnknown fields */ - const IDirectDraw7Vtbl *lpVtbl; - const IDirectDraw4Vtbl *IDirectDraw4_vtbl; - const IDirectDraw3Vtbl *IDirectDraw3_vtbl; - const IDirectDraw2Vtbl *IDirectDraw2_vtbl; - const IDirectDrawVtbl *IDirectDraw_vtbl; - const IDirect3D7Vtbl *IDirect3D7_vtbl; - const IDirect3D3Vtbl *IDirect3D3_vtbl; - const IDirect3D2Vtbl *IDirect3D2_vtbl; - const IDirect3DVtbl *IDirect3D_vtbl; - const IWineD3DDeviceParentVtbl *device_parent_vtbl; + /* Interfaces */ + IDirectDraw7 IDirectDraw7_iface; + IDirectDraw4 IDirectDraw4_iface; + IDirectDraw3 IDirectDraw3_iface; + IDirectDraw2 IDirectDraw2_iface; + IDirectDraw IDirectDraw_iface; + IDirect3D7 IDirect3D7_iface; + IDirect3D3 IDirect3D3_iface; + IDirect3D2 IDirect3D2_iface; + IDirect3D IDirect3D_iface; + struct wined3d_device_parent device_parent; /* See comment in IDirectDraw::AddRef */ LONG ref7, ref4, ref2, ref3, ref1, numIfaces; /* WineD3D linkage */ - IWineD3D *wineD3D; - IWineD3DDevice *wineD3DDevice; + struct wined3d *wineD3D; + struct wined3d_device *wined3d_device; BOOL d3d_initialized; /* Misc ddraw fields */ @@ -183,35 +156,11 @@ void DDRAW_Convert_DDSCAPS_1_To_2(const DDSCAPS *pIn, DDSCAPS2 *pOut) DECLSPEC_H void DDRAW_Convert_DDDEVICEIDENTIFIER_2_To_1(const DDDEVICEIDENTIFIER2 *pIn, DDDEVICEIDENTIFIER *pOut) DECLSPEC_HIDDEN; HRESULT WINAPI ddraw_recreate_surfaces_cb(IDirectDrawSurface7 *surf, DDSURFACEDESC2 *desc, void *Context) DECLSPEC_HIDDEN; -IWineD3DVertexDeclaration *ddraw_find_decl(IDirectDrawImpl *This, DWORD fvf) DECLSPEC_HIDDEN; - -static inline IDirectDrawImpl *ddraw_from_d3d1(IDirect3D *iface) -{ - return (IDirectDrawImpl *)((char*)iface - FIELD_OFFSET(IDirectDrawImpl, IDirect3D_vtbl)); -} - -static inline IDirectDrawImpl *ddraw_from_d3d2(IDirect3D2 *iface) -{ - return (IDirectDrawImpl *)((char*)iface - FIELD_OFFSET(IDirectDrawImpl, IDirect3D2_vtbl)); -} - -static inline IDirectDrawImpl *ddraw_from_d3d3(IDirect3D3 *iface) -{ - return (IDirectDrawImpl *)((char*)iface - FIELD_OFFSET(IDirectDrawImpl, IDirect3D3_vtbl)); -} - -static inline IDirectDrawImpl *ddraw_from_d3d7(IDirect3D7 *iface) -{ - return (IDirectDrawImpl *)((char*)iface - FIELD_OFFSET(IDirectDrawImpl, IDirect3D7_vtbl)); -} +struct wined3d_vertex_declaration *ddraw_find_decl(IDirectDrawImpl *This, DWORD fvf) DECLSPEC_HIDDEN; /* The default surface type */ extern WINED3DSURFTYPE DefaultSurfaceType DECLSPEC_HIDDEN; -extern typeof(WineDirect3DCreateClipper) *pWineDirect3DCreateClipper DECLSPEC_HIDDEN; -extern typeof(WineDirect3DCreate) *pWineDirect3DCreate DECLSPEC_HIDDEN; - - /***************************************************************************** * IDirectDrawSurface implementation structure *****************************************************************************/ @@ -232,9 +181,9 @@ struct IDirectDrawSurfaceImpl /* Connections to other Objects */ IDirectDrawImpl *ddraw; - IWineD3DSurface *WineD3DSurface; - IWineD3DBaseTexture *wineD3DTexture; - IWineD3DSwapChain *wineD3DSwapChain; + struct wined3d_surface *wined3d_surface; + struct wined3d_texture *wined3d_texture; + struct wined3d_swapchain *wined3d_swapchain; /* This implementation handles attaching surfaces to other surfaces */ IDirectDrawSurfaceImpl *next_attached; @@ -272,6 +221,7 @@ struct IDirectDrawSurfaceImpl DWORD Handle; }; +HRESULT ddraw_surface_create_texture(IDirectDrawSurfaceImpl *surface) DECLSPEC_HIDDEN; void ddraw_surface_destroy(IDirectDrawSurfaceImpl *surface) DECLSPEC_HIDDEN; HRESULT ddraw_surface_init(IDirectDrawSurfaceImpl *surface, IDirectDrawImpl *ddraw, DDSURFACEDESC2 *desc, UINT mip_level, WINED3DSURFTYPE surface_type) DECLSPEC_HIDDEN; @@ -295,26 +245,6 @@ static inline IDirectDrawSurfaceImpl *surface_from_surface3(IDirectDrawSurface3 #define PFGET_BPP(pf) (pf.dwFlags&DDPF_PALETTEINDEXED8?1:((pf.dwRGBBitCount+7)/8)) #define GET_BPP(desc) PFGET_BPP(desc.ddpfPixelFormat) -/***************************************************************************** - * IParent Implementation - *****************************************************************************/ -struct IParentImpl -{ - /* IUnknown fields */ - const IParentVtbl *lpVtbl; - LONG ref; - - /* IParentImpl fields */ - IUnknown *child; - -}; - -void ddraw_parent_init(IParentImpl *parent) DECLSPEC_HIDDEN; - -/***************************************************************************** - * IDirect3DDevice implementation - *****************************************************************************/ - #define DDRAW_INVALID_HANDLE ~0U enum ddraw_handle_type @@ -356,13 +286,13 @@ struct IDirect3DDeviceImpl LONG ref; /* Other object connections */ - IWineD3DDevice *wineD3DDevice; + struct wined3d_device *wined3d_device; IDirectDrawImpl *ddraw; - IWineD3DBuffer *indexbuffer; + struct wined3d_buffer *indexbuffer; IDirectDrawSurfaceImpl *target; /* Viewport management */ - IDirect3DViewportImpl *viewport_list; + struct list viewport_list; IDirect3DViewportImpl *current_viewport; D3DVIEWPORT7 active_viewport; @@ -393,7 +323,8 @@ HRESULT d3d_device_init(IDirect3DDeviceImpl *device, IDirectDrawImpl *ddraw, extern const GUID IID_D3DDEVICE_WineD3D DECLSPEC_HIDDEN; /* Helper functions */ -HRESULT IDirect3DImpl_GetCaps(IWineD3D *WineD3D, D3DDEVICEDESC *Desc123, D3DDEVICEDESC7 *Desc7) DECLSPEC_HIDDEN; +HRESULT IDirect3DImpl_GetCaps(const struct wined3d *wined3d, + D3DDEVICEDESC *Desc123, D3DDEVICEDESC7 *Desc7) DECLSPEC_HIDDEN; WINED3DZBUFFERTYPE IDirect3DDeviceImpl_UpdateDepthStencil(IDirect3DDeviceImpl *This) DECLSPEC_HIDDEN; static inline IDirect3DDeviceImpl *device_from_device1(IDirect3DDevice *iface) @@ -435,7 +366,7 @@ struct IDirectDrawClipperImpl const IDirectDrawClipperVtbl *lpVtbl; LONG ref; - IWineD3DClipper *wineD3DClipper; + struct wined3d_clipper *wineD3DClipper; BOOL initialized; }; @@ -450,8 +381,7 @@ struct IDirectDrawPaletteImpl const IDirectDrawPaletteVtbl *lpVtbl; LONG ref; - /* WineD3D uplink */ - IWineD3DPalette *wineD3DPalette; + struct wined3d_palette *wineD3DPalette; /* IDirectDrawPalette fields */ IUnknown *ifaceToRelease; @@ -460,17 +390,6 @@ struct IDirectDrawPaletteImpl HRESULT ddraw_palette_init(IDirectDrawPaletteImpl *palette, IDirectDrawImpl *ddraw, DWORD flags, PALETTEENTRY *entries) DECLSPEC_HIDDEN; -/****************************************************************************** - * DirectDraw ClassFactory implementation - incomplete - ******************************************************************************/ -typedef struct -{ - const IClassFactoryVtbl *lpVtbl; - - LONG ref; - HRESULT (*pfnCreateInstance)(IUnknown *pUnkOuter, REFIID iid, LPVOID *ppObj); -} IClassFactoryImpl; - /* Helper structures */ struct object_creation_info { @@ -498,8 +417,7 @@ struct IDirect3DLightImpl DWORD dwLightIndex; - /* Chained list used for adding / removing from viewports */ - IDirect3DLightImpl *next; + struct list entry; }; /* Helper functions */ @@ -554,11 +472,8 @@ struct IDirect3DViewportImpl D3DVIEWPORT2 vp2; } viewports; - /* Field used to chain viewports together */ - IDirect3DViewportImpl *next; - - /* Lights list */ - IDirect3DLightImpl *lights; + struct list entry; + struct list light_list; /* Background material */ IDirect3DMaterialImpl *background; @@ -599,8 +514,8 @@ HRESULT d3d_execute_buffer_init(IDirect3DExecuteBufferImpl *execute_buffer, IDirect3DDeviceImpl *device, D3DEXECUTEBUFFERDESC *desc) DECLSPEC_HIDDEN; /* The execute function */ -void IDirect3DExecuteBufferImpl_Execute(IDirect3DExecuteBufferImpl *This, - IDirect3DDeviceImpl *Device, IDirect3DViewportImpl *ViewportImpl) DECLSPEC_HIDDEN; +HRESULT d3d_execute_buffer_execute(IDirect3DExecuteBufferImpl *execute_buffer, + IDirect3DDeviceImpl *device, IDirect3DViewportImpl *viewport) DECLSPEC_HIDDEN; /***************************************************************************** * IDirect3DVertexBuffer @@ -613,8 +528,8 @@ struct IDirect3DVertexBufferImpl LONG ref; /*** WineD3D and ddraw links ***/ - IWineD3DBuffer *wineD3DVertexBuffer; - IWineD3DVertexDeclaration *wineD3DVertexDeclaration; + struct wined3d_buffer *wineD3DVertexBuffer; + struct wined3d_vertex_declaration *wineD3DVertexDeclaration; IDirectDrawImpl *ddraw; /*** Storage for D3D7 specific things ***/ @@ -654,11 +569,6 @@ void DDRAW_dump_cooperativelevel(DWORD cooplevel) DECLSPEC_HIDDEN; * IDirect3DExecuteBuffer isn't in WineD3D */ void multiply_matrix(LPD3DMATRIX dest, const D3DMATRIX *src1, const D3DMATRIX *src2) DECLSPEC_HIDDEN; -void multiply_matrix_D3D_way(LPD3DMATRIX result, const D3DMATRIX *m1, const D3DMATRIX *m2) DECLSPEC_HIDDEN; - -/* Helper function in main.c */ -BOOL LoadWineD3D(void) DECLSPEC_HIDDEN; - /* Used for generic dumping */ typedef struct { @@ -679,22 +589,30 @@ typedef struct /* Structure copy */ #define ME(x,f,e) { x, #x, (void (*)(const void *))(f), offsetof(STRUCT, e) } -#define DD_STRUCT_COPY_BYSIZE(to,from) \ - do { \ - DWORD __size = (to)->dwSize; \ - DWORD __copysize = __size; \ - DWORD __resetsize = __size; \ - assert(to != from); \ - if (__resetsize > sizeof(*to)) \ - __resetsize = sizeof(*to); \ - memset(to,0,__resetsize); \ - if ((from)->dwSize < __size) \ - __copysize = (from)->dwSize; \ - memcpy(to,from,__copysize); \ - (to)->dwSize = __size;/*restore size*/ \ - } while (0) +#define DD_STRUCT_COPY_BYSIZE_(to,from,from_size) \ + do { \ + DWORD __size = (to)->dwSize; \ + DWORD __copysize = min(__size, from_size); \ + assert(to != from); \ + memcpy(to, from, __copysize); \ + memset((char*)(to) + __copysize, 0, __size - __copysize); \ + (to)->dwSize = __size; /* restore size */ \ + } while (0) +#define DD_STRUCT_COPY_BYSIZE(to,from) DD_STRUCT_COPY_BYSIZE_(to,from,(from)->dwSize) -#endif +#define SIZEOF_END_PADDING(type, last_field) \ + (sizeof(type) - offsetof(type, last_field) - sizeof(((type *)0)->last_field)) + +static inline void copy_to_surfacedesc2(DDSURFACEDESC2 *to, DDSURFACEDESC2 *from) +{ + DWORD from_size = from->dwSize; + if (from_size == sizeof(DDSURFACEDESC)) + from_size -= SIZEOF_END_PADDING(DDSURFACEDESC, ddsCaps); + to->dwSize = sizeof(DDSURFACEDESC2); /* for struct copy */ + DD_STRUCT_COPY_BYSIZE_(to, from, from_size); +} HRESULT hr_ddraw_from_wined3d(HRESULT hr) DECLSPEC_HIDDEN; + +#endif diff --git a/dll/directx/wine/ddraw/device.c b/dll/directx/wine/ddraw/device.c index 9f0f631724c..ad5edfe9019 100644 --- a/dll/directx/wine/ddraw/device.c +++ b/dll/directx/wine/ddraw/device.c @@ -116,47 +116,47 @@ IDirect3DDeviceImpl_7_QueryInterface(IDirect3DDevice7 *iface, *obj = iface; } - /* Check DirectDraw Interfacs */ + /* Check DirectDraw Interfaces. */ else if( IsEqualGUID( &IID_IDirectDraw7, refiid ) ) { - *obj = This->ddraw; + *obj = &This->ddraw->IDirectDraw7_iface; TRACE("(%p) Returning IDirectDraw7 interface at %p\n", This, *obj); } else if ( IsEqualGUID( &IID_IDirectDraw4, refiid ) ) { - *obj = &This->ddraw->IDirectDraw4_vtbl; + *obj = &This->ddraw->IDirectDraw4_iface; TRACE("(%p) Returning IDirectDraw4 interface at %p\n", This, *obj); } else if ( IsEqualGUID( &IID_IDirectDraw2, refiid ) ) { - *obj = &This->ddraw->IDirectDraw2_vtbl; + *obj = &This->ddraw->IDirectDraw2_iface; TRACE("(%p) Returning IDirectDraw2 interface at %p\n", This, *obj); } else if( IsEqualGUID( &IID_IDirectDraw, refiid ) ) { - *obj = &This->ddraw->IDirectDraw_vtbl; + *obj = &This->ddraw->IDirectDraw_iface; TRACE("(%p) Returning IDirectDraw interface at %p\n", This, *obj); } /* Direct3D */ else if ( IsEqualGUID( &IID_IDirect3D , refiid ) ) { - *obj = &This->ddraw->IDirect3D_vtbl; + *obj = &This->ddraw->IDirect3D_iface; TRACE("(%p) Returning IDirect3D interface at %p\n", This, *obj); } else if ( IsEqualGUID( &IID_IDirect3D2 , refiid ) ) { - *obj = &This->ddraw->IDirect3D2_vtbl; + *obj = &This->ddraw->IDirect3D2_iface; TRACE("(%p) Returning IDirect3D2 interface at %p\n", This, *obj); } else if ( IsEqualGUID( &IID_IDirect3D3 , refiid ) ) { - *obj = &This->ddraw->IDirect3D3_vtbl; + *obj = &This->ddraw->IDirect3D3_iface; TRACE("(%p) Returning IDirect3D3 interface at %p\n", This, *obj); } else if ( IsEqualGUID( &IID_IDirect3D7 , refiid ) ) { - *obj = &This->ddraw->IDirect3D7_vtbl; + *obj = &This->ddraw->IDirect3D7_iface; TRACE("(%p) Returning IDirect3D7 interface at %p\n", This, *obj); } @@ -191,30 +191,24 @@ IDirect3DDeviceImpl_7_QueryInterface(IDirect3DDevice7 *iface, return D3D_OK; } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_3_QueryInterface(IDirect3DDevice3 *iface, - REFIID riid, - void **obj) +static HRESULT WINAPI IDirect3DDeviceImpl_3_QueryInterface(IDirect3DDevice3 *iface, REFIID riid, + void **obj) { TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), obj); return IDirect3DDevice7_QueryInterface((IDirect3DDevice7 *)device_from_device3(iface), riid, obj); } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_2_QueryInterface(IDirect3DDevice2 *iface, - REFIID riid, - void **obj) +static HRESULT WINAPI IDirect3DDeviceImpl_2_QueryInterface(IDirect3DDevice2 *iface, REFIID riid, + void **obj) { TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), obj); return IDirect3DDevice7_QueryInterface((IDirect3DDevice7 *)device_from_device2(iface), riid, obj); } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_1_QueryInterface(IDirect3DDevice *iface, - REFIID riid, - void **obp) +static HRESULT WINAPI IDirect3DDeviceImpl_1_QueryInterface(IDirect3DDevice *iface, REFIID riid, + void **obp) { TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), obp); @@ -244,24 +238,21 @@ IDirect3DDeviceImpl_7_AddRef(IDirect3DDevice7 *iface) return ref; } -static ULONG WINAPI -Thunk_IDirect3DDeviceImpl_3_AddRef(IDirect3DDevice3 *iface) +static ULONG WINAPI IDirect3DDeviceImpl_3_AddRef(IDirect3DDevice3 *iface) { TRACE("iface %p.\n", iface); return IDirect3DDevice7_AddRef((IDirect3DDevice7 *)device_from_device3(iface)); } -static ULONG WINAPI -Thunk_IDirect3DDeviceImpl_2_AddRef(IDirect3DDevice2 *iface) +static ULONG WINAPI IDirect3DDeviceImpl_2_AddRef(IDirect3DDevice2 *iface) { TRACE("iface %p.\n", iface); return IDirect3DDevice7_AddRef((IDirect3DDevice7 *)device_from_device2(iface)); } -static ULONG WINAPI -Thunk_IDirect3DDeviceImpl_1_AddRef(IDirect3DDevice *iface) +static ULONG WINAPI IDirect3DDeviceImpl_1_AddRef(IDirect3DDevice *iface) { TRACE("iface %p.\n", iface); @@ -294,33 +285,24 @@ IDirect3DDeviceImpl_7_Release(IDirect3DDevice7 *iface) */ if (ref == 0) { - IParent *IndexBufferParent; DWORD i; EnterCriticalSection(&ddraw_cs); - /* Free the index buffer. */ - IWineD3DDevice_SetIndexBuffer(This->wineD3DDevice, NULL, WINED3DFMT_UNKNOWN); - IndexBufferParent = IWineD3DBuffer_GetParent(This->indexbuffer); - if (IParent_Release(IndexBufferParent)) - { - ERR(" (%p) Something is still holding the index buffer parent %p\n", This, IndexBufferParent); - } - /* There is no need to unset the vertex buffer here, IWineD3DDevice_Uninit3D will do that when - * destroying the primary stateblock. If a vertex buffer is destroyed while it is bound - * IDirect3DVertexBuffer::Release will unset it. - */ + /* There is no need to unset any resources here, wined3d will take + * care of that on Uninit3D(). */ + + /* Free the index buffer. */ + wined3d_buffer_decref(This->indexbuffer); /* Set the device up to render to the front buffer since the back * buffer will vanish soon. */ - IWineD3DDevice_SetRenderTarget(This->wineD3DDevice, 0, - This->ddraw->d3d_target->WineD3DSurface, TRUE); + wined3d_device_set_render_target(This->wined3d_device, 0, + This->ddraw->d3d_target->wined3d_surface, TRUE); - /* Release the WineD3DDevice. This won't destroy it */ - if(IWineD3DDevice_Release(This->wineD3DDevice) <= 0) - { - ERR(" (%p) The wineD3D device %p was destroyed unexpectedly. Prepare for trouble\n", This, This->wineD3DDevice); - } + /* Release the WineD3DDevice. This won't destroy it. */ + if (!wined3d_device_decref(This->wined3d_device)) + ERR("The wined3d device (%p) was destroyed unexpectedly.\n", This->wined3d_device); /* The texture handles should be unset by now, but there might be some bits * missing in our reference counting(needs test). Do a sanity check. */ @@ -392,24 +374,21 @@ IDirect3DDeviceImpl_7_Release(IDirect3DDevice7 *iface) return ref; } -static ULONG WINAPI -Thunk_IDirect3DDeviceImpl_3_Release(IDirect3DDevice3 *iface) +static ULONG WINAPI IDirect3DDeviceImpl_3_Release(IDirect3DDevice3 *iface) { TRACE("iface %p.\n", iface); return IDirect3DDevice7_Release((IDirect3DDevice7 *)device_from_device3(iface)); } -static ULONG WINAPI -Thunk_IDirect3DDeviceImpl_2_Release(IDirect3DDevice2 *iface) +static ULONG WINAPI IDirect3DDeviceImpl_2_Release(IDirect3DDevice2 *iface) { TRACE("iface %p.\n", iface); return IDirect3DDevice7_Release((IDirect3DDevice7 *)device_from_device2(iface)); } -static ULONG WINAPI -Thunk_IDirect3DDeviceImpl_1_Release(IDirect3DDevice *iface) +static ULONG WINAPI IDirect3DDeviceImpl_1_Release(IDirect3DDevice *iface) { TRACE("iface %p.\n", iface); @@ -531,20 +510,16 @@ IDirect3DDeviceImpl_3_GetCaps(IDirect3DDevice3 *iface, return D3D_OK; } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_2_GetCaps(IDirect3DDevice2 *iface, - D3DDEVICEDESC *D3DHWDevDesc, - D3DDEVICEDESC *D3DHELDevDesc) +static HRESULT WINAPI IDirect3DDeviceImpl_2_GetCaps(IDirect3DDevice2 *iface, + D3DDEVICEDESC *D3DHWDevDesc, D3DDEVICEDESC *D3DHELDevDesc) { IDirect3DDeviceImpl *This = device_from_device2(iface); TRACE("iface %p, hw_desc %p, hel_desc %p.\n", iface, D3DHWDevDesc, D3DHELDevDesc); return IDirect3DDevice3_GetCaps((IDirect3DDevice3 *)&This->IDirect3DDevice3_vtbl, D3DHWDevDesc, D3DHELDevDesc); } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_1_GetCaps(IDirect3DDevice *iface, - D3DDEVICEDESC *D3DHWDevDesc, - D3DDEVICEDESC *D3DHELDevDesc) +static HRESULT WINAPI IDirect3DDeviceImpl_1_GetCaps(IDirect3DDevice *iface, + D3DDEVICEDESC *D3DHWDevDesc, D3DDEVICEDESC *D3DHELDevDesc) { IDirect3DDeviceImpl *This = device_from_device1(iface); TRACE("iface %p, hw_desc %p, hel_desc %p.\n", iface, D3DHWDevDesc, D3DHELDevDesc); @@ -589,10 +564,8 @@ IDirect3DDeviceImpl_2_SwapTextureHandles(IDirect3DDevice2 *iface, return D3D_OK; } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_1_SwapTextureHandles(IDirect3DDevice *iface, - IDirect3DTexture *D3DTex1, - IDirect3DTexture *D3DTex2) +static HRESULT WINAPI IDirect3DDeviceImpl_1_SwapTextureHandles(IDirect3DDevice *iface, + IDirect3DTexture *D3DTex1, IDirect3DTexture *D3DTex2) { IDirect3DDeviceImpl *This = device_from_device1(iface); IDirectDrawSurfaceImpl *surf1 = surface_from_texture1(D3DTex1); @@ -642,9 +615,7 @@ IDirect3DDeviceImpl_3_GetStats(IDirect3DDevice3 *iface, return D3D_OK; } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_2_GetStats(IDirect3DDevice2 *iface, - D3DSTATS *Stats) +static HRESULT WINAPI IDirect3DDeviceImpl_2_GetStats(IDirect3DDevice2 *iface, D3DSTATS *Stats) { IDirect3DDeviceImpl *This = device_from_device2(iface); @@ -653,9 +624,7 @@ Thunk_IDirect3DDeviceImpl_2_GetStats(IDirect3DDevice2 *iface, return IDirect3DDevice3_GetStats((IDirect3DDevice3 *)&This->IDirect3DDevice3_vtbl, Stats); } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_1_GetStats(IDirect3DDevice *iface, - D3DSTATS *Stats) +static HRESULT WINAPI IDirect3DDeviceImpl_1_GetStats(IDirect3DDevice *iface, D3DSTATS *Stats) { IDirect3DDeviceImpl *This = device_from_device1(iface); @@ -747,6 +716,7 @@ IDirect3DDeviceImpl_1_Execute(IDirect3DDevice *iface, IDirect3DDeviceImpl *This = device_from_device1(iface); IDirect3DExecuteBufferImpl *Direct3DExecuteBufferImpl = (IDirect3DExecuteBufferImpl *)ExecuteBuffer; IDirect3DViewportImpl *Direct3DViewportImpl = (IDirect3DViewportImpl *)Viewport; + HRESULT hr; TRACE("iface %p, buffer %p, viewport %p, flags %#x.\n", iface, ExecuteBuffer, Viewport, Flags); @@ -755,10 +725,10 @@ IDirect3DDeviceImpl_1_Execute(IDirect3DDevice *iface, /* Execute... */ EnterCriticalSection(&ddraw_cs); - IDirect3DExecuteBufferImpl_Execute(Direct3DExecuteBufferImpl, This, Direct3DViewportImpl); + hr = d3d_execute_buffer_execute(Direct3DExecuteBufferImpl, This, Direct3DViewportImpl); LeaveCriticalSection(&ddraw_cs); - return D3D_OK; + return hr; } /***************************************************************************** @@ -792,8 +762,7 @@ IDirect3DDeviceImpl_3_AddViewport(IDirect3DDevice3 *iface, return DDERR_INVALIDPARAMS; EnterCriticalSection(&ddraw_cs); - vp->next = This->viewport_list; - This->viewport_list = vp; + list_add_head(&This->viewport_list, &vp->entry); vp->active_device = This; /* Viewport must be usable for Clear() after AddViewport, so set active_device here. */ LeaveCriticalSection(&ddraw_cs); @@ -801,9 +770,8 @@ IDirect3DDeviceImpl_3_AddViewport(IDirect3DDevice3 *iface, return D3D_OK; } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_2_AddViewport(IDirect3DDevice2 *iface, - IDirect3DViewport2 *Direct3DViewport2) +static HRESULT WINAPI IDirect3DDeviceImpl_2_AddViewport(IDirect3DDevice2 *iface, + IDirect3DViewport2 *Direct3DViewport2) { IDirect3DDeviceImpl *This = device_from_device2(iface); IDirect3DViewportImpl *vp = (IDirect3DViewportImpl *)Direct3DViewport2; @@ -813,9 +781,8 @@ Thunk_IDirect3DDeviceImpl_2_AddViewport(IDirect3DDevice2 *iface, return IDirect3DDevice3_AddViewport((IDirect3DDevice3 *)&This->IDirect3DDevice3_vtbl, (IDirect3DViewport3 *)vp); } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_1_AddViewport(IDirect3DDevice *iface, - IDirect3DViewport *Direct3DViewport) +static HRESULT WINAPI IDirect3DDeviceImpl_1_AddViewport(IDirect3DDevice *iface, + IDirect3DViewport *Direct3DViewport) { IDirect3DDeviceImpl *This = device_from_device1(iface); IDirect3DViewportImpl *vp = (IDirect3DViewportImpl *)Direct3DViewport; @@ -841,39 +808,31 @@ Thunk_IDirect3DDeviceImpl_1_AddViewport(IDirect3DDevice *iface, * DDERR_INVALIDPARAMS if the viewport wasn't found in the list * *****************************************************************************/ -static HRESULT WINAPI -IDirect3DDeviceImpl_3_DeleteViewport(IDirect3DDevice3 *iface, - IDirect3DViewport3 *Viewport) +static HRESULT WINAPI IDirect3DDeviceImpl_3_DeleteViewport(IDirect3DDevice3 *iface, IDirect3DViewport3 *viewport) { - IDirect3DDeviceImpl *This = device_from_device3(iface); - IDirect3DViewportImpl *vp = (IDirect3DViewportImpl *) Viewport; - IDirect3DViewportImpl *cur_viewport, *prev_viewport = NULL; + IDirect3DDeviceImpl *device = device_from_device3(iface); + IDirect3DViewportImpl *vp = (IDirect3DViewportImpl *)viewport; - TRACE("iface %p, viewport %p.\n", iface, Viewport); + TRACE("iface %p, viewport %p.\n", iface, viewport); EnterCriticalSection(&ddraw_cs); - cur_viewport = This->viewport_list; - while (cur_viewport != NULL) + + if (vp->active_device != device) { - if (cur_viewport == vp) - { - if (prev_viewport == NULL) This->viewport_list = cur_viewport->next; - else prev_viewport->next = cur_viewport->next; - /* TODO : add desactivate of the viewport and all associated lights... */ - LeaveCriticalSection(&ddraw_cs); - return D3D_OK; - } - prev_viewport = cur_viewport; - cur_viewport = cur_viewport->next; + WARN("Viewport %p active device is %p.\n", vp, vp->active_device); + LeaveCriticalSection(&ddraw_cs); + return DDERR_INVALIDPARAMS; } + vp->active_device = NULL; + list_remove(&vp->entry); + LeaveCriticalSection(&ddraw_cs); - return DDERR_INVALIDPARAMS; + return D3D_OK; } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_2_DeleteViewport(IDirect3DDevice2 *iface, - IDirect3DViewport2 *Direct3DViewport2) +static HRESULT WINAPI IDirect3DDeviceImpl_2_DeleteViewport(IDirect3DDevice2 *iface, + IDirect3DViewport2 *Direct3DViewport2) { IDirect3DDeviceImpl *This = device_from_device2(iface); IDirect3DViewportImpl *vp = (IDirect3DViewportImpl *)Direct3DViewport2; @@ -883,9 +842,8 @@ Thunk_IDirect3DDeviceImpl_2_DeleteViewport(IDirect3DDevice2 *iface, return IDirect3DDevice3_DeleteViewport((IDirect3DDevice3 *)&This->IDirect3DDevice3_vtbl, (IDirect3DViewport3 *)vp); } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_1_DeleteViewport(IDirect3DDevice *iface, - IDirect3DViewport *Direct3DViewport) +static HRESULT WINAPI IDirect3DDeviceImpl_1_DeleteViewport(IDirect3DDevice *iface, + IDirect3DViewport *Direct3DViewport) { IDirect3DDeviceImpl *This = device_from_device1(iface); IDirect3DViewportImpl *vp = (IDirect3DViewportImpl *)Direct3DViewport; @@ -921,7 +879,7 @@ IDirect3DDeviceImpl_3_NextViewport(IDirect3DDevice3 *iface, { IDirect3DDeviceImpl *This = device_from_device3(iface); IDirect3DViewportImpl *vp = (IDirect3DViewportImpl *)Viewport3; - IDirect3DViewportImpl *res = NULL; + struct list *entry; TRACE("iface %p, viewport %p, next %p, flags %#x.\n", iface, Viewport3, lplpDirect3DViewport3, Flags); @@ -937,41 +895,35 @@ IDirect3DDeviceImpl_3_NextViewport(IDirect3DDevice3 *iface, switch (Flags) { case D3DNEXT_NEXT: - { - res = vp->next; - } - break; + entry = list_next(&This->viewport_list, &vp->entry); + break; + case D3DNEXT_HEAD: - { - res = This->viewport_list; - } - break; + entry = list_head(&This->viewport_list); + break; + case D3DNEXT_TAIL: - { - IDirect3DViewportImpl *cur_viewport = This->viewport_list; - if (cur_viewport != NULL) - { - while (cur_viewport->next != NULL) cur_viewport = cur_viewport->next; - } - res = cur_viewport; - } - break; + entry = list_tail(&This->viewport_list); + break; + default: + WARN("Invalid flags %#x.\n", Flags); *lplpDirect3DViewport3 = NULL; LeaveCriticalSection(&ddraw_cs); return DDERR_INVALIDPARAMS; } - *lplpDirect3DViewport3 = (IDirect3DViewport3 *)res; + if (entry) + *lplpDirect3DViewport3 = (IDirect3DViewport3 *)LIST_ENTRY(entry, IDirect3DViewportImpl, entry); + else + *lplpDirect3DViewport3 = NULL; + LeaveCriticalSection(&ddraw_cs); return D3D_OK; } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_2_NextViewport(IDirect3DDevice2 *iface, - IDirect3DViewport2 *Viewport2, - IDirect3DViewport2 **lplpDirect3DViewport2, - DWORD Flags) +static HRESULT WINAPI IDirect3DDeviceImpl_2_NextViewport(IDirect3DDevice2 *iface, + IDirect3DViewport2 *Viewport2, IDirect3DViewport2 **lplpDirect3DViewport2, DWORD Flags) { IDirect3DDeviceImpl *This = device_from_device2(iface); IDirect3DViewportImpl *vp = (IDirect3DViewportImpl *)Viewport2; @@ -987,11 +939,8 @@ Thunk_IDirect3DDeviceImpl_2_NextViewport(IDirect3DDevice2 *iface, return hr; } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_1_NextViewport(IDirect3DDevice *iface, - IDirect3DViewport *Viewport, - IDirect3DViewport **lplpDirect3DViewport, - DWORD Flags) +static HRESULT WINAPI IDirect3DDeviceImpl_1_NextViewport(IDirect3DDevice *iface, + IDirect3DViewport *Viewport, IDirect3DViewport **lplpDirect3DViewport, DWORD Flags) { IDirect3DDeviceImpl *This = device_from_device1(iface); IDirect3DViewportImpl *vp = (IDirect3DViewportImpl *)Viewport; @@ -1135,10 +1084,9 @@ IDirect3DDeviceImpl_7_EnumTextureFormats(IDirect3DDevice7 *iface, EnterCriticalSection(&ddraw_cs); memset(&mode, 0, sizeof(mode)); - hr = IWineD3DDevice_GetDisplayMode(This->ddraw->wineD3DDevice, - 0, - &mode); - if(FAILED(hr)) { + hr = wined3d_device_get_display_mode(This->ddraw->wined3d_device, 0, &mode); + if (FAILED(hr)) + { LeaveCriticalSection(&ddraw_cs); WARN("Cannot get the current adapter format\n"); return hr; @@ -1146,15 +1094,9 @@ IDirect3DDeviceImpl_7_EnumTextureFormats(IDirect3DDevice7 *iface, for (i = 0; i < sizeof(FormatList) / sizeof(*FormatList); ++i) { - hr = IWineD3D_CheckDeviceFormat(This->ddraw->wineD3D, - WINED3DADAPTER_DEFAULT, - WINED3DDEVTYPE_HAL, - mode.Format, - 0 /* Usage */, - WINED3DRTYPE_TEXTURE, - FormatList[i], - SURFACE_OPENGL); - if(hr == D3D_OK) + hr = wined3d_check_device_format(This->ddraw->wineD3D, WINED3DADAPTER_DEFAULT, WINED3DDEVTYPE_HAL, + mode.Format, 0, WINED3DRTYPE_TEXTURE, FormatList[i], SURFACE_OPENGL); + if (hr == D3D_OK) { DDPIXELFORMAT pformat; @@ -1175,15 +1117,10 @@ IDirect3DDeviceImpl_7_EnumTextureFormats(IDirect3DDevice7 *iface, for (i = 0; i < sizeof(BumpFormatList) / sizeof(*BumpFormatList); ++i) { - hr = IWineD3D_CheckDeviceFormat(This->ddraw->wineD3D, - WINED3DADAPTER_DEFAULT, - WINED3DDEVTYPE_HAL, - mode.Format, - WINED3DUSAGE_QUERY_LEGACYBUMPMAP, - WINED3DRTYPE_TEXTURE, - BumpFormatList[i], - SURFACE_OPENGL); - if(hr == D3D_OK) + hr = wined3d_check_device_format(This->ddraw->wineD3D, WINED3DADAPTER_DEFAULT, + WINED3DDEVTYPE_HAL, mode.Format, WINED3DUSAGE_QUERY_LEGACYBUMPMAP, + WINED3DRTYPE_TEXTURE, BumpFormatList[i], SURFACE_OPENGL); + if (hr == D3D_OK) { DDPIXELFORMAT pformat; @@ -1229,10 +1166,8 @@ IDirect3DDeviceImpl_7_EnumTextureFormats_FPUPreserve(IDirect3DDevice7 *iface, return hr; } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_3_EnumTextureFormats(IDirect3DDevice3 *iface, - LPD3DENUMPIXELFORMATSCALLBACK Callback, - void *Arg) +static HRESULT WINAPI IDirect3DDeviceImpl_3_EnumTextureFormats(IDirect3DDevice3 *iface, + LPD3DENUMPIXELFORMATSCALLBACK Callback, void *Arg) { IDirect3DDeviceImpl *This = device_from_device3(iface); @@ -1287,10 +1222,9 @@ IDirect3DDeviceImpl_2_EnumTextureFormats(IDirect3DDevice2 *iface, EnterCriticalSection(&ddraw_cs); memset(&mode, 0, sizeof(mode)); - hr = IWineD3DDevice_GetDisplayMode(This->ddraw->wineD3DDevice, - 0, - &mode); - if(FAILED(hr)) { + hr = wined3d_device_get_display_mode(This->ddraw->wined3d_device, 0, &mode); + if (FAILED(hr)) + { LeaveCriticalSection(&ddraw_cs); WARN("Cannot get the current adapter format\n"); return hr; @@ -1298,15 +1232,9 @@ IDirect3DDeviceImpl_2_EnumTextureFormats(IDirect3DDevice2 *iface, for (i = 0; i < sizeof(FormatList) / sizeof(*FormatList); ++i) { - hr = IWineD3D_CheckDeviceFormat(This->ddraw->wineD3D, - 0 /* Adapter */, - WINED3DDEVTYPE_HAL, - mode.Format, - 0 /* Usage */, - WINED3DRTYPE_TEXTURE, - FormatList[i], - SURFACE_OPENGL); - if(hr == D3D_OK) + hr = wined3d_check_device_format(This->ddraw->wineD3D, 0, WINED3DDEVTYPE_HAL, + mode.Format, 0, WINED3DRTYPE_TEXTURE, FormatList[i], SURFACE_OPENGL); + if (hr == D3D_OK) { DDSURFACEDESC sdesc; @@ -1332,10 +1260,8 @@ IDirect3DDeviceImpl_2_EnumTextureFormats(IDirect3DDevice2 *iface, return D3D_OK; } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_1_EnumTextureFormats(IDirect3DDevice *iface, - LPD3DENUMTEXTUREFORMATSCALLBACK Callback, - void *Arg) +static HRESULT WINAPI IDirect3DDeviceImpl_1_EnumTextureFormats(IDirect3DDevice *iface, + LPD3DENUMTEXTUREFORMATSCALLBACK Callback, void *Arg) { IDirect3DDeviceImpl *This = device_from_device1(iface); @@ -1443,24 +1369,14 @@ IDirect3DDeviceImpl_1_SetMatrix(IDirect3DDevice *iface, *m = *D3DMatrix; - if(This->world == D3DMatHandle) - { - IWineD3DDevice_SetTransform(This->wineD3DDevice, - WINED3DTS_WORLDMATRIX(0), - (WINED3DMATRIX *) D3DMatrix); - } - if(This->view == D3DMatHandle) - { - IWineD3DDevice_SetTransform(This->wineD3DDevice, - WINED3DTS_VIEW, - (WINED3DMATRIX *) D3DMatrix); - } - if(This->proj == D3DMatHandle) - { - IWineD3DDevice_SetTransform(This->wineD3DDevice, - WINED3DTS_PROJECTION, - (WINED3DMATRIX *) D3DMatrix); - } + if (D3DMatHandle == This->world) + wined3d_device_set_transform(This->wined3d_device, WINED3DTS_WORLDMATRIX(0), (WINED3DMATRIX *)D3DMatrix); + + if (D3DMatHandle == This->view) + wined3d_device_set_transform(This->wined3d_device, WINED3DTS_VIEW, (WINED3DMATRIX *)D3DMatrix); + + if (D3DMatHandle == This->proj) + wined3d_device_set_transform(This->wined3d_device, WINED3DTS_PROJECTION, (WINED3DMATRIX *)D3DMatrix); LeaveCriticalSection(&ddraw_cs); return D3D_OK; @@ -1574,7 +1490,7 @@ IDirect3DDeviceImpl_7_BeginScene(IDirect3DDevice7 *iface) TRACE("iface %p.\n", iface); EnterCriticalSection(&ddraw_cs); - hr = IWineD3DDevice_BeginScene(This->wineD3DDevice); + hr = wined3d_device_begin_scene(This->wined3d_device); LeaveCriticalSection(&ddraw_cs); if(hr == WINED3D_OK) return D3D_OK; else return D3DERR_SCENE_IN_SCENE; /* TODO: Other possible causes of failure */ @@ -1599,24 +1515,21 @@ IDirect3DDeviceImpl_7_BeginScene_FPUPreserve(IDirect3DDevice7 *iface) return hr; } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_3_BeginScene(IDirect3DDevice3 *iface) +static HRESULT WINAPI IDirect3DDeviceImpl_3_BeginScene(IDirect3DDevice3 *iface) { TRACE("iface %p.\n", iface); return IDirect3DDevice7_BeginScene((IDirect3DDevice7 *)device_from_device3(iface)); } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_2_BeginScene(IDirect3DDevice2 *iface) +static HRESULT WINAPI IDirect3DDeviceImpl_2_BeginScene(IDirect3DDevice2 *iface) { TRACE("iface %p.\n", iface); return IDirect3DDevice7_BeginScene((IDirect3DDevice7 *)device_from_device2(iface)); } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_1_BeginScene(IDirect3DDevice *iface) +static HRESULT WINAPI IDirect3DDeviceImpl_1_BeginScene(IDirect3DDevice *iface) { TRACE("iface %p.\n", iface); @@ -1646,7 +1559,7 @@ IDirect3DDeviceImpl_7_EndScene(IDirect3DDevice7 *iface) TRACE("iface %p.\n", iface); EnterCriticalSection(&ddraw_cs); - hr = IWineD3DDevice_EndScene(This->wineD3DDevice); + hr = wined3d_device_end_scene(This->wined3d_device); LeaveCriticalSection(&ddraw_cs); if(hr == WINED3D_OK) return D3D_OK; else return D3DERR_SCENE_NOT_IN_SCENE; @@ -1671,24 +1584,21 @@ IDirect3DDeviceImpl_7_EndScene_FPUPreserve(IDirect3DDevice7 *iface) return hr; } -static HRESULT WINAPI DECLSPEC_HOTPATCH -Thunk_IDirect3DDeviceImpl_3_EndScene(IDirect3DDevice3 *iface) +static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDeviceImpl_3_EndScene(IDirect3DDevice3 *iface) { TRACE("iface %p.\n", iface); return IDirect3DDevice7_EndScene((IDirect3DDevice7 *)device_from_device3(iface)); } -static HRESULT WINAPI DECLSPEC_HOTPATCH -Thunk_IDirect3DDeviceImpl_2_EndScene(IDirect3DDevice2 *iface) +static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDeviceImpl_2_EndScene(IDirect3DDevice2 *iface) { TRACE("iface %p.\n", iface); return IDirect3DDevice7_EndScene((IDirect3DDevice7 *)device_from_device2(iface)); } -static HRESULT WINAPI DECLSPEC_HOTPATCH -Thunk_IDirect3DDeviceImpl_1_EndScene(IDirect3DDevice *iface) +static HRESULT WINAPI DECLSPEC_HOTPATCH IDirect3DDeviceImpl_1_EndScene(IDirect3DDevice *iface) { TRACE("iface %p.\n", iface); @@ -1720,63 +1630,57 @@ IDirect3DDeviceImpl_7_GetDirect3D(IDirect3DDevice7 *iface, if(!Direct3D7) return DDERR_INVALIDPARAMS; - *Direct3D7 = (IDirect3D7 *)&This->ddraw->IDirect3D7_vtbl; + *Direct3D7 = &This->ddraw->IDirect3D7_iface; IDirect3D7_AddRef(*Direct3D7); TRACE(" returning interface %p\n", *Direct3D7); return D3D_OK; } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_3_GetDirect3D(IDirect3DDevice3 *iface, - IDirect3D3 **Direct3D3) +static HRESULT WINAPI IDirect3DDeviceImpl_3_GetDirect3D(IDirect3DDevice3 *iface, + IDirect3D3 **Direct3D3) { IDirect3DDeviceImpl *This = device_from_device3(iface); - HRESULT ret; - IDirect3D7 *ret_ptr; TRACE("iface %p, d3d %p.\n", iface, Direct3D3); - ret = IDirect3DDevice7_GetDirect3D((IDirect3DDevice7 *)This, &ret_ptr); - if(ret != D3D_OK) - return ret; - *Direct3D3 = ret_ptr ? (IDirect3D3 *)&ddraw_from_d3d7(ret_ptr)->IDirect3D3_vtbl : NULL; + if(!Direct3D3) + return DDERR_INVALIDPARAMS; + + IDirect3D3_AddRef(&This->ddraw->IDirect3D3_iface); + *Direct3D3 = &This->ddraw->IDirect3D3_iface; TRACE(" returning interface %p\n", *Direct3D3); return D3D_OK; } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_2_GetDirect3D(IDirect3DDevice2 *iface, - IDirect3D2 **Direct3D2) +static HRESULT WINAPI IDirect3DDeviceImpl_2_GetDirect3D(IDirect3DDevice2 *iface, + IDirect3D2 **Direct3D2) { IDirect3DDeviceImpl *This = device_from_device2(iface); - HRESULT ret; - IDirect3D7 *ret_ptr; TRACE("iface %p, d3d %p.\n", iface, Direct3D2); - ret = IDirect3DDevice7_GetDirect3D((IDirect3DDevice7 *)This, &ret_ptr); - if(ret != D3D_OK) - return ret; - *Direct3D2 = ret_ptr ? (IDirect3D2 *)&ddraw_from_d3d7(ret_ptr)->IDirect3D2_vtbl : NULL; + if(!Direct3D2) + return DDERR_INVALIDPARAMS; + + IDirect3D2_AddRef(&This->ddraw->IDirect3D2_iface); + *Direct3D2 = &This->ddraw->IDirect3D2_iface; TRACE(" returning interface %p\n", *Direct3D2); return D3D_OK; } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_1_GetDirect3D(IDirect3DDevice *iface, - IDirect3D **Direct3D) +static HRESULT WINAPI IDirect3DDeviceImpl_1_GetDirect3D(IDirect3DDevice *iface, + IDirect3D **Direct3D) { IDirect3DDeviceImpl *This = device_from_device1(iface); - HRESULT ret; - IDirect3D7 *ret_ptr; TRACE("iface %p, d3d %p.\n", iface, Direct3D); - ret = IDirect3DDevice7_GetDirect3D((IDirect3DDevice7 *)This, &ret_ptr); - if(ret != D3D_OK) - return ret; - *Direct3D = ret_ptr ? (IDirect3D *)&ddraw_from_d3d7(ret_ptr)->IDirect3D_vtbl : NULL; + if(!Direct3D) + return DDERR_INVALIDPARAMS; + + IDirect3D_AddRef(&This->ddraw->IDirect3D_iface); + *Direct3D = &This->ddraw->IDirect3D_iface; TRACE(" returning interface %p\n", *Direct3D); return D3D_OK; } @@ -1814,7 +1718,12 @@ IDirect3DDeviceImpl_3_SetCurrentViewport(IDirect3DDevice3 *iface, return D3D_OK; } - /* Should check if the viewport was added or not */ + if (vp->active_device != This) + { + WARN("Viewport %p active device is %p.\n", vp, vp->active_device); + LeaveCriticalSection(&ddraw_cs); + return DDERR_INVALIDPARAMS; + } /* Release previous viewport and AddRef the new one */ if (This->current_viewport) @@ -1829,16 +1738,14 @@ IDirect3DDeviceImpl_3_SetCurrentViewport(IDirect3DDevice3 *iface, This->current_viewport = vp; /* Activate this viewport */ - This->current_viewport->active_device = This; viewport_activate(This->current_viewport, FALSE); LeaveCriticalSection(&ddraw_cs); return D3D_OK; } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_2_SetCurrentViewport(IDirect3DDevice2 *iface, - IDirect3DViewport2 *Direct3DViewport2) +static HRESULT WINAPI IDirect3DDeviceImpl_2_SetCurrentViewport(IDirect3DDevice2 *iface, + IDirect3DViewport2 *Direct3DViewport2) { IDirect3DDeviceImpl *This = device_from_device2(iface); IDirect3DViewportImpl *vp = (IDirect3DViewportImpl *)Direct3DViewport2; @@ -1887,9 +1794,8 @@ IDirect3DDeviceImpl_3_GetCurrentViewport(IDirect3DDevice3 *iface, return D3D_OK; } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_2_GetCurrentViewport(IDirect3DDevice2 *iface, - IDirect3DViewport2 **Direct3DViewport2) +static HRESULT WINAPI IDirect3DDeviceImpl_2_GetCurrentViewport(IDirect3DDevice2 *iface, + IDirect3DViewport2 **Direct3DViewport2) { IDirect3DDeviceImpl *This = device_from_device2(iface); HRESULT hr; @@ -1941,10 +1847,8 @@ IDirect3DDeviceImpl_7_SetRenderTarget(IDirect3DDevice7 *iface, return D3D_OK; } - hr = IWineD3DDevice_SetRenderTarget(This->wineD3DDevice, - 0, - Target ? Target->WineD3DSurface : NULL, - FALSE); + hr = wined3d_device_set_render_target(This->wined3d_device, 0, + Target ? Target->wined3d_surface : NULL, FALSE); if(hr != D3D_OK) { LeaveCriticalSection(&ddraw_cs); @@ -1981,10 +1885,8 @@ IDirect3DDeviceImpl_7_SetRenderTarget_FPUPreserve(IDirect3DDevice7 *iface, return hr; } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_3_SetRenderTarget(IDirect3DDevice3 *iface, - IDirectDrawSurface4 *NewRenderTarget, - DWORD Flags) +static HRESULT WINAPI IDirect3DDeviceImpl_3_SetRenderTarget(IDirect3DDevice3 *iface, + IDirectDrawSurface4 *NewRenderTarget, DWORD Flags) { IDirect3DDeviceImpl *This = device_from_device3(iface); IDirectDrawSurfaceImpl *Target = (IDirectDrawSurfaceImpl *)NewRenderTarget; @@ -1994,10 +1896,8 @@ Thunk_IDirect3DDeviceImpl_3_SetRenderTarget(IDirect3DDevice3 *iface, return IDirect3DDevice7_SetRenderTarget((IDirect3DDevice7 *)This, (IDirectDrawSurface7 *)Target, Flags); } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_2_SetRenderTarget(IDirect3DDevice2 *iface, - IDirectDrawSurface *NewRenderTarget, - DWORD Flags) +static HRESULT WINAPI IDirect3DDeviceImpl_2_SetRenderTarget(IDirect3DDevice2 *iface, + IDirectDrawSurface *NewRenderTarget, DWORD Flags) { IDirect3DDeviceImpl *This = device_from_device2(iface); IDirectDrawSurfaceImpl *Target = (IDirectDrawSurfaceImpl *)NewRenderTarget; @@ -2043,9 +1943,8 @@ IDirect3DDeviceImpl_7_GetRenderTarget(IDirect3DDevice7 *iface, return D3D_OK; } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_3_GetRenderTarget(IDirect3DDevice3 *iface, - IDirectDrawSurface4 **RenderTarget) +static HRESULT WINAPI IDirect3DDeviceImpl_3_GetRenderTarget(IDirect3DDevice3 *iface, + IDirectDrawSurface4 **RenderTarget) { IDirect3DDeviceImpl *This = device_from_device3(iface); HRESULT hr; @@ -2057,9 +1956,8 @@ Thunk_IDirect3DDeviceImpl_3_GetRenderTarget(IDirect3DDevice3 *iface, return D3D_OK; } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_2_GetRenderTarget(IDirect3DDevice2 *iface, - IDirectDrawSurface **RenderTarget) +static HRESULT WINAPI IDirect3DDeviceImpl_2_GetRenderTarget(IDirect3DDevice2 *iface, + IDirectDrawSurface **RenderTarget) { IDirect3DDeviceImpl *This = device_from_device2(iface); HRESULT hr; @@ -2113,11 +2011,8 @@ IDirect3DDeviceImpl_3_Begin(IDirect3DDevice3 *iface, return D3D_OK; } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_2_Begin(IDirect3DDevice2 *iface, - D3DPRIMITIVETYPE d3dpt, - D3DVERTEXTYPE dwVertexTypeDesc, - DWORD dwFlags) +static HRESULT WINAPI IDirect3DDeviceImpl_2_Begin(IDirect3DDevice2 *iface, D3DPRIMITIVETYPE d3dpt, + D3DVERTEXTYPE dwVertexTypeDesc, DWORD dwFlags) { DWORD FVF; IDirect3DDeviceImpl *This = device_from_device2(iface); @@ -2172,13 +2067,9 @@ IDirect3DDeviceImpl_3_BeginIndexed(IDirect3DDevice3 *iface, } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_2_BeginIndexed(IDirect3DDevice2 *iface, - D3DPRIMITIVETYPE d3dptPrimitiveType, - D3DVERTEXTYPE d3dvtVertexType, - void *lpvVertices, - DWORD dwNumVertices, - DWORD dwFlags) +static HRESULT WINAPI IDirect3DDeviceImpl_2_BeginIndexed(IDirect3DDevice2 *iface, + D3DPRIMITIVETYPE d3dptPrimitiveType, D3DVERTEXTYPE d3dvtVertexType, + void *lpvVertices, DWORD dwNumVertices, DWORD dwFlags) { DWORD FVF; IDirect3DDeviceImpl *This = device_from_device2(iface); @@ -2248,9 +2139,7 @@ IDirect3DDeviceImpl_3_Vertex(IDirect3DDevice3 *iface, return D3D_OK; } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_2_Vertex(IDirect3DDevice2 *iface, - void *lpVertexType) +static HRESULT WINAPI IDirect3DDeviceImpl_2_Vertex(IDirect3DDevice2 *iface, void *lpVertexType) { IDirect3DDeviceImpl *This = device_from_device2(iface); @@ -2281,9 +2170,7 @@ IDirect3DDeviceImpl_3_Index(IDirect3DDevice3 *iface, return D3D_OK; } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_2_Index(IDirect3DDevice2 *iface, - WORD wVertexIndex) +static HRESULT WINAPI IDirect3DDeviceImpl_2_Index(IDirect3DDevice2 *iface, WORD wVertexIndex) { IDirect3DDeviceImpl *This = device_from_device2(iface); @@ -2322,9 +2209,7 @@ IDirect3DDeviceImpl_3_End(IDirect3DDevice3 *iface, This->vertex_type, This->vertex_buffer, This->nb_vertices, This->render_flags); } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_2_End(IDirect3DDevice2 *iface, - DWORD dwFlags) +static HRESULT WINAPI IDirect3DDeviceImpl_2_End(IDirect3DDevice2 *iface, DWORD dwFlags) { IDirect3DDeviceImpl *This = device_from_device2(iface); @@ -2350,6 +2235,8 @@ Thunk_IDirect3DDeviceImpl_2_End(IDirect3DDevice2 *iface, * DDERR_INVALIDPARAMS if Value == NULL * *****************************************************************************/ +static const float zbias_factor = -0.000005f; + static HRESULT IDirect3DDeviceImpl_7_GetRenderState(IDirect3DDevice7 *iface, D3DRENDERSTATETYPE RenderStateType, @@ -2370,9 +2257,7 @@ IDirect3DDeviceImpl_7_GetRenderState(IDirect3DDevice7 *iface, { WINED3DTEXTUREFILTERTYPE tex_mag; - hr = IWineD3DDevice_GetSamplerState(This->wineD3DDevice, - 0, WINED3DSAMP_MAGFILTER, - &tex_mag); + hr = wined3d_device_get_sampler_state(This->wined3d_device, 0, WINED3DSAMP_MAGFILTER, &tex_mag); switch (tex_mag) { @@ -2394,14 +2279,14 @@ IDirect3DDeviceImpl_7_GetRenderState(IDirect3DDevice7 *iface, WINED3DTEXTUREFILTERTYPE tex_min; WINED3DTEXTUREFILTERTYPE tex_mip; - hr = IWineD3DDevice_GetSamplerState(This->wineD3DDevice, + hr = wined3d_device_get_sampler_state(This->wined3d_device, 0, WINED3DSAMP_MINFILTER, &tex_min); if (FAILED(hr)) { LeaveCriticalSection(&ddraw_cs); return hr; } - hr = IWineD3DDevice_GetSamplerState(This->wineD3DDevice, + hr = wined3d_device_get_sampler_state(This->wined3d_device, 0, WINED3DSAMP_MIPFILTER, &tex_mip); switch (tex_min) @@ -2452,14 +2337,12 @@ IDirect3DDeviceImpl_7_GetRenderState(IDirect3DDevice7 *iface, case D3DRENDERSTATE_TEXTUREADDRESS: case D3DRENDERSTATE_TEXTUREADDRESSU: - hr = IWineD3DDevice_GetSamplerState(This->wineD3DDevice, - 0, WINED3DSAMP_ADDRESSU, - Value); + hr = wined3d_device_get_sampler_state(This->wined3d_device, + 0, WINED3DSAMP_ADDRESSU, Value); break; case D3DRENDERSTATE_TEXTUREADDRESSV: - hr = IWineD3DDevice_GetSamplerState(This->wineD3DDevice, - 0, WINED3DSAMP_ADDRESSV, - Value); + hr = wined3d_device_get_sampler_state(This->wined3d_device, + 0, WINED3DSAMP_ADDRESSV, Value); break; case D3DRENDERSTATE_BORDERCOLOR: @@ -2473,6 +2356,20 @@ IDirect3DDeviceImpl_7_GetRenderState(IDirect3DDevice7 *iface, hr = DDERR_INVALIDPARAMS; break; + case D3DRENDERSTATE_ZBIAS: + { + union + { + DWORD d; + float f; + } wined3d_value; + + hr = wined3d_device_get_render_state(This->wined3d_device, WINED3DRS_DEPTHBIAS, &wined3d_value.d); + if (SUCCEEDED(hr)) + *Value = wined3d_value.f / zbias_factor; + break; + } + default: if (RenderStateType >= D3DRENDERSTATE_STIPPLEPATTERN00 && RenderStateType <= D3DRENDERSTATE_STIPPLEPATTERN31) @@ -2482,9 +2379,7 @@ IDirect3DDeviceImpl_7_GetRenderState(IDirect3DDevice7 *iface, hr = E_NOTIMPL; break; } - hr = IWineD3DDevice_GetRenderState(This->wineD3DDevice, - RenderStateType, - Value); + hr = wined3d_device_get_render_state(This->wined3d_device, RenderStateType, Value); } LeaveCriticalSection(&ddraw_cs); return hr; @@ -2528,21 +2423,20 @@ IDirect3DDeviceImpl_3_GetRenderState(IDirect3DDevice3 *iface, case D3DRENDERSTATE_TEXTUREHANDLE: { /* This state is wrapped to SetTexture in SetRenderState, so - * it has to be wrapped to GetTexture here - */ - IWineD3DBaseTexture *tex = NULL; + * it has to be wrapped to GetTexture here. */ + struct wined3d_texture *tex = NULL; *lpdwRenderState = 0; EnterCriticalSection(&ddraw_cs); - hr = IWineD3DDevice_GetTexture(This->wineD3DDevice, 0, &tex); + hr = wined3d_device_get_texture(This->wined3d_device, 0, &tex); if (SUCCEEDED(hr) && tex) { /* The parent of the texture is the IDirectDrawSurface7 * interface of the ddraw surface. */ - IDirectDrawSurfaceImpl *parent = IWineD3DBaseTexture_GetParent(tex); + IDirectDrawSurfaceImpl *parent = wined3d_texture_get_parent(tex); if (parent) *lpdwRenderState = parent->Handle; - IWineD3DBaseTexture_Release(tex); + wined3d_texture_decref(tex); } LeaveCriticalSection(&ddraw_cs); @@ -2561,12 +2455,12 @@ IDirect3DDeviceImpl_3_GetRenderState(IDirect3DDevice3 *iface, This->legacyTextureBlending = TRUE; - IWineD3DDevice_GetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_COLOROP, &colorop); - IWineD3DDevice_GetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_COLORARG1, &colorarg1); - IWineD3DDevice_GetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_COLORARG2, &colorarg2); - IWineD3DDevice_GetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_ALPHAOP, &alphaop); - IWineD3DDevice_GetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_ALPHAARG1, &alphaarg1); - IWineD3DDevice_GetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_ALPHAARG2, &alphaarg2); + wined3d_device_get_texture_stage_state(This->wined3d_device, 0, WINED3DTSS_COLOROP, &colorop); + wined3d_device_get_texture_stage_state(This->wined3d_device, 0, WINED3DTSS_COLORARG1, &colorarg1); + wined3d_device_get_texture_stage_state(This->wined3d_device, 0, WINED3DTSS_COLORARG2, &colorarg2); + wined3d_device_get_texture_stage_state(This->wined3d_device, 0, WINED3DTSS_ALPHAOP, &alphaop); + wined3d_device_get_texture_stage_state(This->wined3d_device, 0, WINED3DTSS_ALPHAARG1, &alphaarg1); + wined3d_device_get_texture_stage_state(This->wined3d_device, 0, WINED3DTSS_ALPHAARG2, &alphaarg2); if (colorop == WINED3DTOP_SELECTARG1 && colorarg1 == WINED3DTA_TEXTURE && alphaop == WINED3DTOP_SELECTARG1 && alphaarg1 == WINED3DTA_TEXTURE) @@ -2585,27 +2479,28 @@ IDirect3DDeviceImpl_3_GetRenderState(IDirect3DDevice3 *iface, } else { + struct wined3d_texture *tex = NULL; HRESULT hr; BOOL tex_alpha = FALSE; - IWineD3DBaseTexture *tex = NULL; - WINED3DSURFACE_DESC desc; DDPIXELFORMAT ddfmt; - hr = IWineD3DDevice_GetTexture(This->wineD3DDevice, - 0, - &tex); + hr = wined3d_device_get_texture(This->wined3d_device, 0, &tex); if(hr == WINED3D_OK && tex) { - hr = IWineD3DTexture_GetLevelDesc((IWineD3DTexture*) tex, 0, &desc); - if (SUCCEEDED(hr)) + struct wined3d_resource *sub_resource; + + if ((sub_resource = wined3d_texture_get_sub_resource(tex, 0))) { + struct wined3d_resource_desc desc; + + wined3d_resource_get_desc(sub_resource, &desc); ddfmt.dwSize = sizeof(ddfmt); PixelFormat_WineD3DtoDD(&ddfmt, desc.format); if (ddfmt.u5.dwRGBAlphaBitMask) tex_alpha = TRUE; } - IWineD3DBaseTexture_Release(tex); + wined3d_texture_decref(tex); } if (!(colorop == WINED3DTOP_MODULATE && colorarg1 == WINED3DTA_TEXTURE && colorarg2 == WINED3DTA_CURRENT && @@ -2628,10 +2523,8 @@ IDirect3DDeviceImpl_3_GetRenderState(IDirect3DDevice3 *iface, } } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_2_GetRenderState(IDirect3DDevice2 *iface, - D3DRENDERSTATETYPE dwRenderStateType, - DWORD *lpdwRenderState) +static HRESULT WINAPI IDirect3DDeviceImpl_2_GetRenderState(IDirect3DDevice2 *iface, + D3DRENDERSTATETYPE dwRenderStateType, DWORD *lpdwRenderState) { IDirect3DDeviceImpl *This = device_from_device2(iface); @@ -2707,9 +2600,7 @@ IDirect3DDeviceImpl_7_SetRenderState(IDirect3DDevice7 *iface, break; } - hr = IWineD3DDevice_SetSamplerState(This->wineD3DDevice, - 0, WINED3DSAMP_MAGFILTER, - tex_mag); + hr = wined3d_device_set_sampler_state(This->wined3d_device, 0, WINED3DSAMP_MAGFILTER, tex_mag); break; } @@ -2752,28 +2643,24 @@ IDirect3DDeviceImpl_7_SetRenderState(IDirect3DDevice7 *iface, break; } - IWineD3DDevice_SetSamplerState(This->wineD3DDevice, + wined3d_device_set_sampler_state(This->wined3d_device, 0, WINED3DSAMP_MIPFILTER, tex_mip); - hr = IWineD3DDevice_SetSamplerState(This->wineD3DDevice, - 0, WINED3DSAMP_MINFILTER, - tex_min); + hr = wined3d_device_set_sampler_state(This->wined3d_device, + 0, WINED3DSAMP_MINFILTER, tex_min); break; } case D3DRENDERSTATE_TEXTUREADDRESS: - IWineD3DDevice_SetSamplerState(This->wineD3DDevice, - 0, WINED3DSAMP_ADDRESSV, - Value); + wined3d_device_set_sampler_state(This->wined3d_device, + 0, WINED3DSAMP_ADDRESSV, Value); /* Drop through */ case D3DRENDERSTATE_TEXTUREADDRESSU: - hr = IWineD3DDevice_SetSamplerState(This->wineD3DDevice, - 0, WINED3DSAMP_ADDRESSU, - Value); + hr = wined3d_device_set_sampler_state(This->wined3d_device, + 0, WINED3DSAMP_ADDRESSU, Value); break; case D3DRENDERSTATE_TEXTUREADDRESSV: - hr = IWineD3DDevice_SetSamplerState(This->wineD3DDevice, - 0, WINED3DSAMP_ADDRESSV, - Value); + hr = wined3d_device_set_sampler_state(This->wined3d_device, + 0, WINED3DSAMP_ADDRESSV, Value); break; case D3DRENDERSTATE_BORDERCOLOR: @@ -2789,6 +2676,18 @@ IDirect3DDeviceImpl_7_SetRenderState(IDirect3DDevice7 *iface, hr = DDERR_INVALIDPARAMS; break; + case D3DRENDERSTATE_ZBIAS: + { + union + { + DWORD d; + float f; + } wined3d_value; + wined3d_value.f = Value * zbias_factor; + hr = wined3d_device_set_render_state(This->wined3d_device, WINED3DRS_DEPTHBIAS, wined3d_value.d); + break; + } + default: if (RenderStateType >= D3DRENDERSTATE_STIPPLEPATTERN00 && RenderStateType <= D3DRENDERSTATE_STIPPLEPATTERN31) @@ -2799,9 +2698,7 @@ IDirect3DDeviceImpl_7_SetRenderState(IDirect3DDevice7 *iface, break; } - hr = IWineD3DDevice_SetRenderState(This->wineD3DDevice, - RenderStateType, - Value); + hr = wined3d_device_set_render_state(This->wined3d_device, RenderStateType, Value); break; } LeaveCriticalSection(&ddraw_cs); @@ -2870,9 +2767,7 @@ IDirect3DDeviceImpl_3_SetRenderState(IDirect3DDevice3 *iface, if(Value == 0) { - hr = IWineD3DDevice_SetTexture(This->wineD3DDevice, - 0, - NULL); + hr = wined3d_device_set_texture(This->wined3d_device, 0, NULL); break; } @@ -2896,73 +2791,99 @@ IDirect3DDeviceImpl_3_SetRenderState(IDirect3DDevice3 *iface, { case D3DTBLEND_MODULATE: { + struct wined3d_texture *tex = NULL; BOOL tex_alpha = FALSE; - IWineD3DBaseTexture *tex = NULL; - WINED3DSURFACE_DESC desc; DDPIXELFORMAT ddfmt; - hr = IWineD3DDevice_GetTexture(This->wineD3DDevice, - 0, - &tex); + hr = wined3d_device_get_texture(This->wined3d_device, 0, &tex); if(hr == WINED3D_OK && tex) { - memset(&desc, 0, sizeof(desc)); - hr = IWineD3DTexture_GetLevelDesc((IWineD3DTexture*) tex, 0, &desc); - if (SUCCEEDED(hr)) + struct wined3d_resource *sub_resource; + + if ((sub_resource = wined3d_texture_get_sub_resource(tex, 0))) { + struct wined3d_resource_desc desc; + + wined3d_resource_get_desc(sub_resource, &desc); ddfmt.dwSize = sizeof(ddfmt); PixelFormat_WineD3DtoDD(&ddfmt, desc.format); if (ddfmt.u5.dwRGBAlphaBitMask) tex_alpha = TRUE; } - IWineD3DBaseTexture_Release(tex); + wined3d_texture_decref(tex); } if (tex_alpha) - IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_ALPHAOP, WINED3DTOP_SELECTARG1); + wined3d_device_set_texture_stage_state(This->wined3d_device, + 0, WINED3DTSS_ALPHAOP, WINED3DTOP_SELECTARG1); else - IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_ALPHAOP, WINED3DTOP_SELECTARG2); - IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_ALPHAARG1, WINED3DTA_TEXTURE); - IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_ALPHAARG2, WINED3DTA_CURRENT); - IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_COLORARG1, WINED3DTA_TEXTURE); - IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_COLORARG2, WINED3DTA_CURRENT); - IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_COLOROP, WINED3DTOP_MODULATE); - + wined3d_device_set_texture_stage_state(This->wined3d_device, + 0, WINED3DTSS_ALPHAOP, WINED3DTOP_SELECTARG2); + wined3d_device_set_texture_stage_state(This->wined3d_device, + 0, WINED3DTSS_ALPHAARG1, WINED3DTA_TEXTURE); + wined3d_device_set_texture_stage_state(This->wined3d_device, + 0, WINED3DTSS_ALPHAARG2, WINED3DTA_CURRENT); + wined3d_device_set_texture_stage_state(This->wined3d_device, + 0, WINED3DTSS_COLORARG1, WINED3DTA_TEXTURE); + wined3d_device_set_texture_stage_state(This->wined3d_device, + 0, WINED3DTSS_COLORARG2, WINED3DTA_CURRENT); + wined3d_device_set_texture_stage_state(This->wined3d_device, + 0, WINED3DTSS_COLOROP, WINED3DTOP_MODULATE); break; } case D3DTBLEND_ADD: - IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_COLOROP, WINED3DTOP_ADD); - IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_COLORARG1, WINED3DTA_TEXTURE); - IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_COLORARG2, WINED3DTA_CURRENT); - IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_ALPHAOP, WINED3DTOP_SELECTARG2); - IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_ALPHAARG2, WINED3DTA_CURRENT); + wined3d_device_set_texture_stage_state(This->wined3d_device, + 0, WINED3DTSS_COLOROP, WINED3DTOP_ADD); + wined3d_device_set_texture_stage_state(This->wined3d_device, + 0, WINED3DTSS_COLORARG1, WINED3DTA_TEXTURE); + wined3d_device_set_texture_stage_state(This->wined3d_device, + 0, WINED3DTSS_COLORARG2, WINED3DTA_CURRENT); + wined3d_device_set_texture_stage_state(This->wined3d_device, + 0, WINED3DTSS_ALPHAOP, WINED3DTOP_SELECTARG2); + wined3d_device_set_texture_stage_state(This->wined3d_device, + 0, WINED3DTSS_ALPHAARG2, WINED3DTA_CURRENT); break; case D3DTBLEND_MODULATEALPHA: - IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_COLORARG1, WINED3DTA_TEXTURE); - IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_ALPHAARG1, WINED3DTA_TEXTURE); - IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_COLORARG2, WINED3DTA_CURRENT); - IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_ALPHAARG2, WINED3DTA_CURRENT); - IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_COLOROP, WINED3DTOP_MODULATE); - IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_ALPHAOP, WINED3DTOP_MODULATE); + wined3d_device_set_texture_stage_state(This->wined3d_device, + 0, WINED3DTSS_COLORARG1, WINED3DTA_TEXTURE); + wined3d_device_set_texture_stage_state(This->wined3d_device, + 0, WINED3DTSS_ALPHAARG1, WINED3DTA_TEXTURE); + wined3d_device_set_texture_stage_state(This->wined3d_device, + 0, WINED3DTSS_COLORARG2, WINED3DTA_CURRENT); + wined3d_device_set_texture_stage_state(This->wined3d_device, + 0, WINED3DTSS_ALPHAARG2, WINED3DTA_CURRENT); + wined3d_device_set_texture_stage_state(This->wined3d_device, + 0, WINED3DTSS_COLOROP, WINED3DTOP_MODULATE); + wined3d_device_set_texture_stage_state(This->wined3d_device, + 0, WINED3DTSS_ALPHAOP, WINED3DTOP_MODULATE); break; case D3DTBLEND_COPY: case D3DTBLEND_DECAL: - IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_COLORARG1, WINED3DTA_TEXTURE); - IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_ALPHAARG1, WINED3DTA_TEXTURE); - IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_COLOROP, WINED3DTOP_SELECTARG1); - IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_ALPHAOP, WINED3DTOP_SELECTARG1); + wined3d_device_set_texture_stage_state(This->wined3d_device, + 0, WINED3DTSS_COLORARG1, WINED3DTA_TEXTURE); + wined3d_device_set_texture_stage_state(This->wined3d_device, + 0, WINED3DTSS_ALPHAARG1, WINED3DTA_TEXTURE); + wined3d_device_set_texture_stage_state(This->wined3d_device, + 0, WINED3DTSS_COLOROP, WINED3DTOP_SELECTARG1); + wined3d_device_set_texture_stage_state(This->wined3d_device, + 0, WINED3DTSS_ALPHAOP, WINED3DTOP_SELECTARG1); break; case D3DTBLEND_DECALALPHA: - IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_COLOROP, WINED3DTOP_BLENDTEXTUREALPHA); - IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_COLORARG1, WINED3DTA_TEXTURE); - IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_COLORARG2, WINED3DTA_CURRENT); - IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_ALPHAOP, WINED3DTOP_SELECTARG2); - IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_ALPHAARG2, WINED3DTA_CURRENT); + wined3d_device_set_texture_stage_state(This->wined3d_device, + 0, WINED3DTSS_COLOROP, WINED3DTOP_BLENDTEXTUREALPHA); + wined3d_device_set_texture_stage_state(This->wined3d_device, + 0, WINED3DTSS_COLORARG1, WINED3DTA_TEXTURE); + wined3d_device_set_texture_stage_state(This->wined3d_device, + 0, WINED3DTSS_COLORARG2, WINED3DTA_CURRENT); + wined3d_device_set_texture_stage_state(This->wined3d_device, + 0, WINED3DTSS_ALPHAOP, WINED3DTOP_SELECTARG2); + wined3d_device_set_texture_stage_state(This->wined3d_device, + 0, WINED3DTSS_ALPHAARG2, WINED3DTA_CURRENT); break; default: @@ -2983,10 +2904,8 @@ IDirect3DDeviceImpl_3_SetRenderState(IDirect3DDevice3 *iface, return hr; } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_2_SetRenderState(IDirect3DDevice2 *iface, - D3DRENDERSTATETYPE RenderStateType, - DWORD Value) +static HRESULT WINAPI IDirect3DDeviceImpl_2_SetRenderState(IDirect3DDevice2 *iface, + D3DRENDERSTATETYPE RenderStateType, DWORD Value) { IDirect3DDeviceImpl *This = device_from_device2(iface); @@ -3100,10 +3019,8 @@ IDirect3DDeviceImpl_3_SetLightState(IDirect3DDevice3 *iface, return D3D_OK; } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_2_SetLightState(IDirect3DDevice2 *iface, - D3DLIGHTSTATETYPE LightStateType, - DWORD Value) +static HRESULT WINAPI IDirect3DDeviceImpl_2_SetLightState(IDirect3DDevice2 *iface, + D3DLIGHTSTATETYPE LightStateType, DWORD Value) { IDirect3DDeviceImpl *This = device_from_device2(iface); @@ -3196,10 +3113,8 @@ IDirect3DDeviceImpl_3_GetLightState(IDirect3DDevice3 *iface, return D3D_OK; } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_2_GetLightState(IDirect3DDevice2 *iface, - D3DLIGHTSTATETYPE LightStateType, - DWORD *Value) +static HRESULT WINAPI IDirect3DDeviceImpl_2_GetLightState(IDirect3DDevice2 *iface, + D3DLIGHTSTATETYPE LightStateType, DWORD *Value) { IDirect3DDeviceImpl *This = device_from_device2(iface); @@ -3249,14 +3164,12 @@ IDirect3DDeviceImpl_7_SetTransform(IDirect3DDevice7 *iface, default: type = TransformStateType; } - if(!Matrix) - return DDERR_INVALIDPARAMS; + if (!Matrix) + return DDERR_INVALIDPARAMS; /* Note: D3DMATRIX is compatible with WINED3DMATRIX */ EnterCriticalSection(&ddraw_cs); - hr = IWineD3DDevice_SetTransform(This->wineD3DDevice, - type, - (WINED3DMATRIX*) Matrix); + hr = wined3d_device_set_transform(This->wined3d_device, type, (WINED3DMATRIX *)Matrix); LeaveCriticalSection(&ddraw_cs); return hr; } @@ -3284,10 +3197,8 @@ IDirect3DDeviceImpl_7_SetTransform_FPUPreserve(IDirect3DDevice7 *iface, return hr; } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_3_SetTransform(IDirect3DDevice3 *iface, - D3DTRANSFORMSTATETYPE TransformStateType, - D3DMATRIX *D3DMatrix) +static HRESULT WINAPI IDirect3DDeviceImpl_3_SetTransform(IDirect3DDevice3 *iface, + D3DTRANSFORMSTATETYPE TransformStateType, D3DMATRIX *D3DMatrix) { IDirect3DDeviceImpl *This = device_from_device3(iface); @@ -3296,10 +3207,8 @@ Thunk_IDirect3DDeviceImpl_3_SetTransform(IDirect3DDevice3 *iface, return IDirect3DDevice7_SetTransform((IDirect3DDevice7 *)This, TransformStateType, D3DMatrix); } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_2_SetTransform(IDirect3DDevice2 *iface, - D3DTRANSFORMSTATETYPE TransformStateType, - D3DMATRIX *D3DMatrix) +static HRESULT WINAPI IDirect3DDeviceImpl_2_SetTransform(IDirect3DDevice2 *iface, + D3DTRANSFORMSTATETYPE TransformStateType, D3DMATRIX *D3DMatrix) { IDirect3DDeviceImpl *This = device_from_device2(iface); @@ -3350,7 +3259,7 @@ IDirect3DDeviceImpl_7_GetTransform(IDirect3DDevice7 *iface, /* Note: D3DMATRIX is compatible with WINED3DMATRIX */ EnterCriticalSection(&ddraw_cs); - hr = IWineD3DDevice_GetTransform(This->wineD3DDevice, type, (WINED3DMATRIX*) Matrix); + hr = wined3d_device_get_transform(This->wined3d_device, type, (WINED3DMATRIX *)Matrix); LeaveCriticalSection(&ddraw_cs); return hr; } @@ -3378,10 +3287,8 @@ IDirect3DDeviceImpl_7_GetTransform_FPUPreserve(IDirect3DDevice7 *iface, return hr; } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_3_GetTransform(IDirect3DDevice3 *iface, - D3DTRANSFORMSTATETYPE TransformStateType, - D3DMATRIX *D3DMatrix) +static HRESULT WINAPI IDirect3DDeviceImpl_3_GetTransform(IDirect3DDevice3 *iface, + D3DTRANSFORMSTATETYPE TransformStateType, D3DMATRIX *D3DMatrix) { IDirect3DDeviceImpl *This = device_from_device3(iface); @@ -3390,10 +3297,8 @@ Thunk_IDirect3DDeviceImpl_3_GetTransform(IDirect3DDevice3 *iface, return IDirect3DDevice7_GetTransform((IDirect3DDevice7 *)This, TransformStateType, D3DMatrix); } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_2_GetTransform(IDirect3DDevice2 *iface, - D3DTRANSFORMSTATETYPE TransformStateType, - D3DMATRIX *D3DMatrix) +static HRESULT WINAPI IDirect3DDeviceImpl_2_GetTransform(IDirect3DDevice2 *iface, + D3DTRANSFORMSTATETYPE TransformStateType, D3DMATRIX *D3DMatrix) { IDirect3DDeviceImpl *This = device_from_device2(iface); @@ -3442,9 +3347,8 @@ IDirect3DDeviceImpl_7_MultiplyTransform(IDirect3DDevice7 *iface, /* Note: D3DMATRIX is compatible with WINED3DMATRIX */ EnterCriticalSection(&ddraw_cs); - hr = IWineD3DDevice_MultiplyTransform(This->wineD3DDevice, - type, - (WINED3DMATRIX*) D3DMatrix); + hr = wined3d_device_multiply_transform(This->wined3d_device, + type, (WINED3DMATRIX *)D3DMatrix); LeaveCriticalSection(&ddraw_cs); return hr; } @@ -3472,10 +3376,8 @@ IDirect3DDeviceImpl_7_MultiplyTransform_FPUPreserve(IDirect3DDevice7 *iface, return hr; } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_3_MultiplyTransform(IDirect3DDevice3 *iface, - D3DTRANSFORMSTATETYPE TransformStateType, - D3DMATRIX *D3DMatrix) +static HRESULT WINAPI IDirect3DDeviceImpl_3_MultiplyTransform(IDirect3DDevice3 *iface, + D3DTRANSFORMSTATETYPE TransformStateType, D3DMATRIX *D3DMatrix) { IDirect3DDeviceImpl *This = device_from_device3(iface); @@ -3484,10 +3386,8 @@ Thunk_IDirect3DDeviceImpl_3_MultiplyTransform(IDirect3DDevice3 *iface, return IDirect3DDevice7_MultiplyTransform((IDirect3DDevice7 *)This, TransformStateType, D3DMatrix); } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_2_MultiplyTransform(IDirect3DDevice2 *iface, - D3DTRANSFORMSTATETYPE TransformStateType, - D3DMATRIX *D3DMatrix) +static HRESULT WINAPI IDirect3DDeviceImpl_2_MultiplyTransform(IDirect3DDevice2 *iface, + D3DTRANSFORMSTATETYPE TransformStateType, D3DMATRIX *D3DMatrix) { IDirect3DDeviceImpl *This = device_from_device2(iface); @@ -3540,7 +3440,7 @@ IDirect3DDeviceImpl_7_DrawPrimitive(IDirect3DDevice7 *iface, /* Set the FVF */ EnterCriticalSection(&ddraw_cs); - hr = IWineD3DDevice_SetVertexDeclaration(This->wineD3DDevice, ddraw_find_decl(This->ddraw, VertexType)); + hr = wined3d_device_set_vertex_declaration(This->wined3d_device, ddraw_find_decl(This->ddraw, VertexType)); if(hr != D3D_OK) { LeaveCriticalSection(&ddraw_cs); @@ -3548,8 +3448,8 @@ IDirect3DDeviceImpl_7_DrawPrimitive(IDirect3DDevice7 *iface, } /* This method translates to the user pointer draw of WineD3D */ - IWineD3DDevice_SetPrimitiveType(This->wineD3DDevice, PrimitiveType); - hr = IWineD3DDevice_DrawPrimitiveUP(This->wineD3DDevice, VertexCount, Vertices, stride); + wined3d_device_set_primitive_type(This->wined3d_device, PrimitiveType); + hr = wined3d_device_draw_primitive_up(This->wined3d_device, VertexCount, Vertices, stride); LeaveCriticalSection(&ddraw_cs); return hr; } @@ -3583,13 +3483,9 @@ IDirect3DDeviceImpl_7_DrawPrimitive_FPUPreserve(IDirect3DDevice7 *iface, return hr; } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_3_DrawPrimitive(IDirect3DDevice3 *iface, - D3DPRIMITIVETYPE PrimitiveType, - DWORD VertexType, - void *Vertices, - DWORD VertexCount, - DWORD Flags) +static HRESULT WINAPI IDirect3DDeviceImpl_3_DrawPrimitive(IDirect3DDevice3 *iface, + D3DPRIMITIVETYPE PrimitiveType, DWORD VertexType, void *Vertices, DWORD VertexCount, + DWORD Flags) { TRACE("iface %p, primitive_type %#x, FVF %#x, vertices %p, vertex_count %u, flags %#x.\n", iface, PrimitiveType, VertexType, Vertices, VertexCount, Flags); @@ -3598,13 +3494,9 @@ Thunk_IDirect3DDeviceImpl_3_DrawPrimitive(IDirect3DDevice3 *iface, PrimitiveType, VertexType, Vertices, VertexCount, Flags); } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_2_DrawPrimitive(IDirect3DDevice2 *iface, - D3DPRIMITIVETYPE PrimitiveType, - D3DVERTEXTYPE VertexType, - void *Vertices, - DWORD VertexCount, - DWORD Flags) +static HRESULT WINAPI IDirect3DDeviceImpl_2_DrawPrimitive(IDirect3DDevice2 *iface, + D3DPRIMITIVETYPE PrimitiveType, D3DVERTEXTYPE VertexType, void *Vertices, + DWORD VertexCount, DWORD Flags) { DWORD FVF; @@ -3667,7 +3559,7 @@ IDirect3DDeviceImpl_7_DrawIndexedPrimitive(IDirect3DDevice7 *iface, /* Set the D3DDevice's FVF */ EnterCriticalSection(&ddraw_cs); - hr = IWineD3DDevice_SetVertexDeclaration(This->wineD3DDevice, ddraw_find_decl(This->ddraw, VertexType)); + hr = wined3d_device_set_vertex_declaration(This->wined3d_device, ddraw_find_decl(This->ddraw, VertexType)); if(FAILED(hr)) { ERR(" (%p) Setting the FVF failed, hr = %x!\n", This, hr); @@ -3675,8 +3567,8 @@ IDirect3DDeviceImpl_7_DrawIndexedPrimitive(IDirect3DDevice7 *iface, return hr; } - IWineD3DDevice_SetPrimitiveType(This->wineD3DDevice, PrimitiveType); - hr = IWineD3DDevice_DrawIndexedPrimitiveUP(This->wineD3DDevice, IndexCount, Indices, + wined3d_device_set_primitive_type(This->wined3d_device, PrimitiveType); + hr = wined3d_device_draw_indexed_primitive_up(This->wined3d_device, IndexCount, Indices, WINED3DFMT_R16_UINT, Vertices, get_flexible_vertex_size(VertexType)); LeaveCriticalSection(&ddraw_cs); return hr; @@ -3715,15 +3607,9 @@ IDirect3DDeviceImpl_7_DrawIndexedPrimitive_FPUPreserve(IDirect3DDevice7 *iface, return hr; } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_3_DrawIndexedPrimitive(IDirect3DDevice3 *iface, - D3DPRIMITIVETYPE PrimitiveType, - DWORD VertexType, - void *Vertices, - DWORD VertexCount, - WORD *Indices, - DWORD IndexCount, - DWORD Flags) +static HRESULT WINAPI IDirect3DDeviceImpl_3_DrawIndexedPrimitive(IDirect3DDevice3 *iface, + D3DPRIMITIVETYPE PrimitiveType, DWORD VertexType, void *Vertices, DWORD VertexCount, + WORD *Indices, DWORD IndexCount, DWORD Flags) { TRACE("iface %p, primitive_type %#x, FVF %#x, vertices %p, vertex_count %u, indices %p, index_count %u, flags %#x.\n", iface, PrimitiveType, VertexType, Vertices, VertexCount, Indices, IndexCount, Flags); @@ -3732,15 +3618,9 @@ Thunk_IDirect3DDeviceImpl_3_DrawIndexedPrimitive(IDirect3DDevice3 *iface, PrimitiveType, VertexType, Vertices, VertexCount, Indices, IndexCount, Flags); } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_2_DrawIndexedPrimitive(IDirect3DDevice2 *iface, - D3DPRIMITIVETYPE PrimitiveType, - D3DVERTEXTYPE VertexType, - void *Vertices, - DWORD VertexCount, - WORD *Indices, - DWORD IndexCount, - DWORD Flags) +static HRESULT WINAPI IDirect3DDeviceImpl_2_DrawIndexedPrimitive(IDirect3DDevice2 *iface, + D3DPRIMITIVETYPE PrimitiveType, D3DVERTEXTYPE VertexType, void *Vertices, + DWORD VertexCount, WORD *Indices, DWORD IndexCount, DWORD Flags) { DWORD FVF; @@ -3790,18 +3670,16 @@ IDirect3DDeviceImpl_7_SetClipStatus(IDirect3DDevice7 *iface, return D3D_OK; } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_3_SetClipStatus(IDirect3DDevice3 *iface, - D3DCLIPSTATUS *ClipStatus) +static HRESULT WINAPI IDirect3DDeviceImpl_3_SetClipStatus(IDirect3DDevice3 *iface, + D3DCLIPSTATUS *ClipStatus) { TRACE("iface %p, clip_status %p.\n", iface, ClipStatus); return IDirect3DDevice7_SetClipStatus((IDirect3DDevice7 *)device_from_device3(iface), ClipStatus); } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_2_SetClipStatus(IDirect3DDevice2 *iface, - D3DCLIPSTATUS *ClipStatus) +static HRESULT WINAPI IDirect3DDeviceImpl_2_SetClipStatus(IDirect3DDevice2 *iface, + D3DCLIPSTATUS *ClipStatus) { TRACE("iface %p, clip_status %p.\n", iface, ClipStatus); @@ -3831,18 +3709,16 @@ IDirect3DDeviceImpl_7_GetClipStatus(IDirect3DDevice7 *iface, return D3D_OK; } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_3_GetClipStatus(IDirect3DDevice3 *iface, - D3DCLIPSTATUS *ClipStatus) +static HRESULT WINAPI IDirect3DDeviceImpl_3_GetClipStatus(IDirect3DDevice3 *iface, + D3DCLIPSTATUS *ClipStatus) { TRACE("iface %p, clip_status %p.\n", iface, ClipStatus); return IDirect3DDevice7_GetClipStatus((IDirect3DDevice7 *)device_from_device3(iface), ClipStatus); } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_2_GetClipStatus(IDirect3DDevice2 *iface, - D3DCLIPSTATUS *ClipStatus) +static HRESULT WINAPI IDirect3DDeviceImpl_2_GetClipStatus(IDirect3DDevice2 *iface, + D3DCLIPSTATUS *ClipStatus) { TRACE("iface %p, clip_status %p.\n", iface, ClipStatus); @@ -3944,8 +3820,8 @@ IDirect3DDeviceImpl_7_DrawPrimitiveStrided(IDirect3DDevice7 *iface, /* WineD3D doesn't need the FVF here */ EnterCriticalSection(&ddraw_cs); - IWineD3DDevice_SetPrimitiveType(This->wineD3DDevice, PrimitiveType); - hr = IWineD3DDevice_DrawPrimitiveStrided(This->wineD3DDevice, VertexCount, &WineD3DStrided); + wined3d_device_set_primitive_type(This->wined3d_device, PrimitiveType); + hr = wined3d_device_draw_primitive_strided(This->wined3d_device, VertexCount, &WineD3DStrided); LeaveCriticalSection(&ddraw_cs); return hr; } @@ -3979,13 +3855,9 @@ IDirect3DDeviceImpl_7_DrawPrimitiveStrided_FPUPreserve(IDirect3DDevice7 *iface, return hr; } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_3_DrawPrimitiveStrided(IDirect3DDevice3 *iface, - D3DPRIMITIVETYPE PrimitiveType, - DWORD VertexType, - D3DDRAWPRIMITIVESTRIDEDDATA *D3DDrawPrimStrideData, - DWORD VertexCount, - DWORD Flags) +static HRESULT WINAPI IDirect3DDeviceImpl_3_DrawPrimitiveStrided(IDirect3DDevice3 *iface, + D3DPRIMITIVETYPE PrimitiveType, DWORD VertexType, + D3DDRAWPRIMITIVESTRIDEDDATA *D3DDrawPrimStrideData, DWORD VertexCount, DWORD Flags) { TRACE("iface %p, primitive_type %#x, FVF %#x, strided_data %p, vertex_count %u, flags %#x.\n", iface, PrimitiveType, VertexType, D3DDrawPrimStrideData, VertexCount, Flags); @@ -4087,8 +3959,8 @@ IDirect3DDeviceImpl_7_DrawIndexedPrimitiveStrided(IDirect3DDevice7 *iface, /* WineD3D doesn't need the FVF here */ EnterCriticalSection(&ddraw_cs); - IWineD3DDevice_SetPrimitiveType(This->wineD3DDevice, PrimitiveType); - hr = IWineD3DDevice_DrawIndexedPrimitiveStrided(This->wineD3DDevice, + wined3d_device_set_primitive_type(This->wined3d_device, PrimitiveType); + hr = wined3d_device_draw_indexed_primitive_strided(This->wined3d_device, IndexCount, &WineD3DStrided, VertexCount, Indices, WINED3DFMT_R16_UINT); LeaveCriticalSection(&ddraw_cs); return hr; @@ -4127,15 +3999,10 @@ IDirect3DDeviceImpl_7_DrawIndexedPrimitiveStrided_FPUPreserve(IDirect3DDevice7 * return hr; } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_3_DrawIndexedPrimitiveStrided(IDirect3DDevice3 *iface, - D3DPRIMITIVETYPE PrimitiveType, - DWORD VertexType, - D3DDRAWPRIMITIVESTRIDEDDATA *D3DDrawPrimStrideData, - DWORD VertexCount, - WORD *Indices, - DWORD IndexCount, - DWORD Flags) +static HRESULT WINAPI IDirect3DDeviceImpl_3_DrawIndexedPrimitiveStrided(IDirect3DDevice3 *iface, + D3DPRIMITIVETYPE PrimitiveType, DWORD VertexType, + D3DDRAWPRIMITIVESTRIDEDDATA *D3DDrawPrimStrideData, DWORD VertexCount, WORD *Indices, + DWORD IndexCount, DWORD Flags) { TRACE("iface %p, primitive_type %#x, FVF %#x, strided_data %p, vertex_count %u, indices %p, index_count %u, flags %#x.\n", iface, PrimitiveType, VertexType, D3DDrawPrimStrideData, VertexCount, Indices, IndexCount, Flags); @@ -4188,9 +4055,8 @@ IDirect3DDeviceImpl_7_DrawPrimitiveVB(IDirect3DDevice7 *iface, stride = get_flexible_vertex_size(vb->fvf); EnterCriticalSection(&ddraw_cs); - hr = IWineD3DDevice_SetVertexDeclaration(This->wineD3DDevice, - vb->wineD3DVertexDeclaration); - if(FAILED(hr)) + hr = wined3d_device_set_vertex_declaration(This->wined3d_device, vb->wineD3DVertexDeclaration); + if (FAILED(hr)) { ERR(" (%p) Setting the FVF failed, hr = %x!\n", This, hr); LeaveCriticalSection(&ddraw_cs); @@ -4198,11 +4064,7 @@ IDirect3DDeviceImpl_7_DrawPrimitiveVB(IDirect3DDevice7 *iface, } /* Set the vertex stream source */ - hr = IWineD3DDevice_SetStreamSource(This->wineD3DDevice, - 0 /* StreamNumber */, - vb->wineD3DVertexBuffer, - 0 /* StartVertex - we pass this to DrawPrimitive */, - stride); + hr = wined3d_device_set_stream_source(This->wined3d_device, 0, vb->wineD3DVertexBuffer, 0, stride); if(hr != D3D_OK) { ERR("(%p) IDirect3DDevice::SetStreamSource failed with hr = %08x\n", This, hr); @@ -4211,8 +4073,8 @@ IDirect3DDeviceImpl_7_DrawPrimitiveVB(IDirect3DDevice7 *iface, } /* Now draw the primitives */ - IWineD3DDevice_SetPrimitiveType(This->wineD3DDevice, PrimitiveType); - hr = IWineD3DDevice_DrawPrimitive(This->wineD3DDevice, StartVertex, NumVertices); + wined3d_device_set_primitive_type(This->wined3d_device, PrimitiveType); + hr = wined3d_device_draw_primitive(This->wined3d_device, StartVertex, NumVertices); LeaveCriticalSection(&ddraw_cs); return hr; } @@ -4246,13 +4108,9 @@ IDirect3DDeviceImpl_7_DrawPrimitiveVB_FPUPreserve(IDirect3DDevice7 *iface, return hr; } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_3_DrawPrimitiveVB(IDirect3DDevice3 *iface, - D3DPRIMITIVETYPE PrimitiveType, - IDirect3DVertexBuffer *D3DVertexBuf, - DWORD StartVertex, - DWORD NumVertices, - DWORD Flags) +static HRESULT WINAPI IDirect3DDeviceImpl_3_DrawPrimitiveVB(IDirect3DDevice3 *iface, + D3DPRIMITIVETYPE PrimitiveType, IDirect3DVertexBuffer *D3DVertexBuf, DWORD StartVertex, + DWORD NumVertices, DWORD Flags) { IDirect3DVertexBufferImpl *vb = D3DVertexBuf ? vb_from_vb1(D3DVertexBuf) : NULL; @@ -4294,9 +4152,10 @@ IDirect3DDeviceImpl_7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface, IDirect3DDeviceImpl *This = (IDirect3DDeviceImpl *)iface; IDirect3DVertexBufferImpl *vb = (IDirect3DVertexBufferImpl *)D3DVertexBuf; DWORD stride = get_flexible_vertex_size(vb->fvf); + struct wined3d_resource *wined3d_resource; + struct wined3d_resource_desc desc; WORD *LockedIndices; HRESULT hr; - WINED3DBUFFER_DESC desc; TRACE("iface %p, primitive_type %#x, vb %p, start_vertex %u, vertex_count %u, indices %p, index_count %u, flags %#x.\n", iface, PrimitiveType, D3DVertexBuf, StartVertex, NumVertices, Indices, IndexCount, Flags); @@ -4310,9 +4169,8 @@ IDirect3DDeviceImpl_7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface, EnterCriticalSection(&ddraw_cs); - hr = IWineD3DDevice_SetVertexDeclaration(This->wineD3DDevice, - vb->wineD3DVertexDeclaration); - if(FAILED(hr)) + hr = wined3d_device_set_vertex_declaration(This->wined3d_device, vb->wineD3DVertexDeclaration); + if (FAILED(hr)) { ERR(" (%p) Setting the FVF failed, hr = %x!\n", This, hr); LeaveCriticalSection(&ddraw_cs); @@ -4321,18 +4179,17 @@ IDirect3DDeviceImpl_7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface, /* check that the buffer is large enough to hold the indices, * reallocate if necessary. */ - IWineD3DBuffer_GetDesc(This->indexbuffer, &desc); - if (desc.Size < IndexCount * sizeof(WORD)) + wined3d_resource = wined3d_buffer_get_resource(This->indexbuffer); + wined3d_resource_get_desc(wined3d_resource, &desc); + if (desc.size < IndexCount * sizeof(WORD)) { - UINT size = max(desc.Size * 2, IndexCount * sizeof(WORD)); - IWineD3DBuffer *buffer; - IParentImpl *parent; + UINT size = max(desc.size * 2, IndexCount * sizeof(WORD)); + struct wined3d_buffer *buffer; TRACE("Growing index buffer to %u bytes\n", size); - parent = IWineD3DBuffer_GetParent(This->indexbuffer); - hr = IWineD3DDevice_CreateIndexBuffer(This->wineD3DDevice, size, WINED3DUSAGE_DYNAMIC /* Usage */, - WINED3DPOOL_DEFAULT, parent, &ddraw_null_wined3d_parent_ops, &buffer); + hr = wined3d_buffer_create_ib(This->wined3d_device, size, WINED3DUSAGE_DYNAMIC /* Usage */, + WINED3DPOOL_DEFAULT, NULL, &ddraw_null_wined3d_parent_ops, &buffer); if (FAILED(hr)) { ERR("(%p) IWineD3DDevice::CreateIndexBuffer failed with hr = %08x\n", This, hr); @@ -4340,50 +4197,32 @@ IDirect3DDeviceImpl_7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface, return hr; } - IWineD3DBuffer_Release(This->indexbuffer); + wined3d_buffer_decref(This->indexbuffer); This->indexbuffer = buffer; - - parent->child = (IUnknown *)buffer; } - /* copy the index stream into the index buffer. - * A new IWineD3DDevice method could be created - * which takes an user pointer containing the indices - * or a SetData-Method for the index buffer, which - * overrides the index buffer data with our pointer. - */ - hr = IWineD3DBuffer_Map(This->indexbuffer, - 0 /* OffSetToLock */, - IndexCount * sizeof(WORD), - (BYTE **) &LockedIndices, - 0 /* Flags */); - if(hr != D3D_OK) + /* Copy the index stream into the index buffer. A new IWineD3DDevice + * method could be created which takes an user pointer containing the + * indices or a SetData-Method for the index buffer, which overrides the + * index buffer data with our pointer. */ + hr = wined3d_buffer_map(This->indexbuffer, 0, IndexCount * sizeof(WORD), + (BYTE **)&LockedIndices, 0); + if (FAILED(hr)) { - ERR("(%p) IWineD3DBuffer::Map failed with hr = %08x\n", This, hr); + ERR("Failed to map buffer, hr %#x.\n", hr); LeaveCriticalSection(&ddraw_cs); return hr; } memcpy(LockedIndices, Indices, IndexCount * sizeof(WORD)); - hr = IWineD3DBuffer_Unmap(This->indexbuffer); - if(hr != D3D_OK) - { - ERR("(%p) IWineD3DBuffer::Unmap failed with hr = %08x\n", This, hr); - LeaveCriticalSection(&ddraw_cs); - return hr; - } + wined3d_buffer_unmap(This->indexbuffer); /* Set the index stream */ - IWineD3DDevice_SetBaseVertexIndex(This->wineD3DDevice, StartVertex); - hr = IWineD3DDevice_SetIndexBuffer(This->wineD3DDevice, This->indexbuffer, - WINED3DFMT_R16_UINT); + wined3d_device_set_base_vertex_index(This->wined3d_device, StartVertex); + hr = wined3d_device_set_index_buffer(This->wined3d_device, This->indexbuffer, WINED3DFMT_R16_UINT); /* Set the vertex stream source */ - hr = IWineD3DDevice_SetStreamSource(This->wineD3DDevice, - 0 /* StreamNumber */, - vb->wineD3DVertexBuffer, - 0 /* offset, we pass this to DrawIndexedPrimitive */, - stride); - if(hr != D3D_OK) + hr = wined3d_device_set_stream_source(This->wined3d_device, 0, vb->wineD3DVertexBuffer, 0, stride); + if (FAILED(hr)) { ERR("(%p) IDirect3DDevice::SetStreamSource failed with hr = %08x\n", This, hr); LeaveCriticalSection(&ddraw_cs); @@ -4391,8 +4230,8 @@ IDirect3DDeviceImpl_7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface, } - IWineD3DDevice_SetPrimitiveType(This->wineD3DDevice, PrimitiveType); - hr = IWineD3DDevice_DrawIndexedPrimitive(This->wineD3DDevice, 0 /* StartIndex */, IndexCount); + wined3d_device_set_primitive_type(This->wined3d_device, PrimitiveType); + hr = wined3d_device_draw_indexed_primitive(This->wined3d_device, 0, IndexCount); LeaveCriticalSection(&ddraw_cs); return hr; @@ -4431,13 +4270,9 @@ IDirect3DDeviceImpl_7_DrawIndexedPrimitiveVB_FPUPreserve(IDirect3DDevice7 *iface return hr; } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_3_DrawIndexedPrimitiveVB(IDirect3DDevice3 *iface, - D3DPRIMITIVETYPE PrimitiveType, - IDirect3DVertexBuffer *D3DVertexBuf, - WORD *Indices, - DWORD IndexCount, - DWORD Flags) +static HRESULT WINAPI IDirect3DDeviceImpl_3_DrawIndexedPrimitiveVB(IDirect3DDevice3 *iface, + D3DPRIMITIVETYPE PrimitiveType, IDirect3DVertexBuffer *D3DVertexBuf, WORD *Indices, + DWORD IndexCount, DWORD Flags) { IDirect3DVertexBufferImpl *VB = vb_from_vb1(D3DVertexBuf); @@ -4508,11 +4343,11 @@ IDirect3DDeviceImpl_7_ComputeSphereVisibility(IDirect3DDevice7 *iface, if ( hr != DD_OK ) return DDERR_INVALIDPARAMS; hr = IDirect3DDeviceImpl_7_GetTransform(iface, D3DTRANSFORMSTATE_VIEW, &temp); if ( hr != DD_OK ) return DDERR_INVALIDPARAMS; - multiply_matrix_D3D_way(&m, &m, &temp); + multiply_matrix(&m, &temp, &m); hr = IDirect3DDeviceImpl_7_GetTransform(iface, D3DTRANSFORMSTATE_PROJECTION, &temp); if ( hr != DD_OK ) return DDERR_INVALIDPARAMS; - multiply_matrix_D3D_way(&m, &m, &temp); + multiply_matrix(&m, &temp, &m); /* Left plane */ vec[0].u1.x = m._14 + m._11; @@ -4559,13 +4394,8 @@ IDirect3DDeviceImpl_7_ComputeSphereVisibility(IDirect3DDevice7 *iface, return D3D_OK; } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_3_ComputeSphereVisibility(IDirect3DDevice3 *iface, - D3DVECTOR *Centers, - D3DVALUE *Radii, - DWORD NumSpheres, - DWORD Flags, - DWORD *ReturnValues) +static HRESULT WINAPI IDirect3DDeviceImpl_3_ComputeSphereVisibility(IDirect3DDevice3 *iface, + D3DVECTOR *Centers, D3DVALUE *Radii, DWORD NumSpheres, DWORD Flags, DWORD *ReturnValues) { TRACE("iface %p, centers %p, radii %p, sphere_count %u, flags %#x, return_values %p.\n", iface, Centers, Radii, NumSpheres, Flags, ReturnValues); @@ -4599,7 +4429,7 @@ IDirect3DDeviceImpl_7_GetTexture(IDirect3DDevice7 *iface, IDirectDrawSurface7 **Texture) { IDirect3DDeviceImpl *This = (IDirect3DDeviceImpl *)iface; - IWineD3DBaseTexture *Surf; + struct wined3d_texture *wined3d_texture; HRESULT hr; TRACE("iface %p, stage %u, texture %p.\n", iface, Stage, Texture); @@ -4611,15 +4441,15 @@ IDirect3DDeviceImpl_7_GetTexture(IDirect3DDevice7 *iface, } EnterCriticalSection(&ddraw_cs); - hr = IWineD3DDevice_GetTexture(This->wineD3DDevice, Stage, &Surf); - if( (hr != D3D_OK) || (!Surf) ) + hr = wined3d_device_get_texture(This->wined3d_device, Stage, &wined3d_texture); + if (FAILED(hr) || !wined3d_texture) { *Texture = NULL; LeaveCriticalSection(&ddraw_cs); return hr; } - *Texture = IWineD3DBaseTexture_GetParent(Surf); + *Texture = wined3d_texture_get_parent(wined3d_texture); IDirectDrawSurface7_AddRef(*Texture); LeaveCriticalSection(&ddraw_cs); return hr; @@ -4648,10 +4478,8 @@ IDirect3DDeviceImpl_7_GetTexture_FPUPreserve(IDirect3DDevice7 *iface, return hr; } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_3_GetTexture(IDirect3DDevice3 *iface, - DWORD Stage, - IDirect3DTexture2 **Texture2) +static HRESULT WINAPI IDirect3DDeviceImpl_3_GetTexture(IDirect3DDevice3 *iface, DWORD Stage, + IDirect3DTexture2 **Texture2) { HRESULT ret; IDirectDrawSurface7 *ret_val; @@ -4696,9 +4524,8 @@ IDirect3DDeviceImpl_7_SetTexture(IDirect3DDevice7 *iface, /* Texture may be NULL here */ EnterCriticalSection(&ddraw_cs); - hr = IWineD3DDevice_SetTexture(This->wineD3DDevice, - Stage, - surf ? surf->wineD3DTexture : NULL); + hr = wined3d_device_set_texture(This->wined3d_device, + Stage, surf ? surf->wined3d_texture : NULL); LeaveCriticalSection(&ddraw_cs); return hr; } @@ -4749,35 +4576,34 @@ IDirect3DDeviceImpl_3_SetTexture(IDirect3DDevice3 *iface, { /* This fixup is required by the way D3DTBLEND_MODULATE maps to texture stage states. See IDirect3DDeviceImpl_3_SetRenderState for details. */ + struct wined3d_texture *tex = NULL; BOOL tex_alpha = FALSE; - IWineD3DBaseTexture *tex = NULL; - WINED3DSURFACE_DESC desc; DDPIXELFORMAT ddfmt; HRESULT result; - result = IWineD3DDevice_GetTexture(This->wineD3DDevice, - 0, - &tex); - - if(result == WINED3D_OK && tex) + result = wined3d_device_get_texture(This->wined3d_device, 0, &tex); + if (result == WINED3D_OK && tex) { - memset(&desc, 0, sizeof(desc)); - result = IWineD3DTexture_GetLevelDesc((IWineD3DTexture*) tex, 0, &desc); - if (SUCCEEDED(result)) + struct wined3d_resource *sub_resource; + + if ((sub_resource = wined3d_texture_get_sub_resource(tex, 0))) { + struct wined3d_resource_desc desc; + + wined3d_resource_get_desc(sub_resource, &desc); ddfmt.dwSize = sizeof(ddfmt); PixelFormat_WineD3DtoDD(&ddfmt, desc.format); if (ddfmt.u5.dwRGBAlphaBitMask) tex_alpha = TRUE; } - IWineD3DBaseTexture_Release(tex); + wined3d_texture_decref(tex); } /* Arg 1/2 are already set to WINED3DTA_TEXTURE/WINED3DTA_CURRENT in case of D3DTBLEND_MODULATE */ if (tex_alpha) - IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_ALPHAOP, WINED3DTOP_SELECTARG1); + wined3d_device_set_texture_stage_state(This->wined3d_device, 0, WINED3DTSS_ALPHAOP, WINED3DTOP_SELECTARG1); else - IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, 0, WINED3DTSS_ALPHAOP, WINED3DTOP_SELECTARG2); + wined3d_device_set_texture_stage_state(This->wined3d_device, 0, WINED3DTSS_ALPHAOP, WINED3DTOP_SELECTARG2); } LeaveCriticalSection(&ddraw_cs); @@ -4865,7 +4691,7 @@ IDirect3DDeviceImpl_7_GetTextureStageState(IDirect3DDevice7 *iface, if (l->sampler_state) { - hr = IWineD3DDevice_GetSamplerState(This->wineD3DDevice, Stage, l->state, State); + hr = wined3d_device_get_sampler_state(This->wined3d_device, Stage, l->state, State); switch(TexStageStateType) { @@ -4909,7 +4735,7 @@ IDirect3DDeviceImpl_7_GetTextureStageState(IDirect3DDevice7 *iface, } else { - hr = IWineD3DDevice_GetTextureStageState(This->wineD3DDevice, Stage, l->state, State); + hr = wined3d_device_get_texture_stage_state(This->wined3d_device, Stage, l->state, State); } LeaveCriticalSection(&ddraw_cs); @@ -4941,11 +4767,8 @@ IDirect3DDeviceImpl_7_GetTextureStageState_FPUPreserve(IDirect3DDevice7 *iface, return hr; } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_3_GetTextureStageState(IDirect3DDevice3 *iface, - DWORD Stage, - D3DTEXTURESTAGESTATETYPE TexStageStateType, - DWORD *State) +static HRESULT WINAPI IDirect3DDeviceImpl_3_GetTextureStageState(IDirect3DDevice3 *iface, + DWORD Stage, D3DTEXTURESTAGESTATETYPE TexStageStateType, DWORD *State) { TRACE("iface %p, stage %u, state %#x, value %p.\n", iface, Stage, TexStageStateType, State); @@ -5035,18 +4858,18 @@ IDirect3DDeviceImpl_7_SetTextureStageState(IDirect3DDevice7 *iface, } case D3DTSS_ADDRESS: - IWineD3DDevice_SetSamplerState(This->wineD3DDevice, Stage, WINED3DSAMP_ADDRESSV, State); + wined3d_device_set_sampler_state(This->wined3d_device, Stage, WINED3DSAMP_ADDRESSV, State); break; default: break; } - hr = IWineD3DDevice_SetSamplerState(This->wineD3DDevice, Stage, l->state, State); + hr = wined3d_device_set_sampler_state(This->wined3d_device, Stage, l->state, State); } else { - hr = IWineD3DDevice_SetTextureStageState(This->wineD3DDevice, Stage, l->state, State); + hr = wined3d_device_set_texture_stage_state(This->wined3d_device, Stage, l->state, State); } LeaveCriticalSection(&ddraw_cs); @@ -5078,11 +4901,8 @@ IDirect3DDeviceImpl_7_SetTextureStageState_FPUPreserve(IDirect3DDevice7 *iface, return hr; } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_3_SetTextureStageState(IDirect3DDevice3 *iface, - DWORD Stage, - D3DTEXTURESTAGESTATETYPE TexStageStateType, - DWORD State) +static HRESULT WINAPI IDirect3DDeviceImpl_3_SetTextureStageState(IDirect3DDevice3 *iface, + DWORD Stage, D3DTEXTURESTAGESTATETYPE TexStageStateType, DWORD State) { TRACE("iface %p, stage %u, state %#x, value %#x.\n", iface, Stage, TexStageStateType, State); @@ -5119,7 +4939,7 @@ IDirect3DDeviceImpl_7_ValidateDevice(IDirect3DDevice7 *iface, TRACE("iface %p, pass_count %p.\n", iface, NumPasses); EnterCriticalSection(&ddraw_cs); - hr = IWineD3DDevice_ValidateDevice(This->wineD3DDevice, NumPasses); + hr = wined3d_device_validate_device(This->wined3d_device, NumPasses); LeaveCriticalSection(&ddraw_cs); return hr; } @@ -5145,9 +4965,7 @@ IDirect3DDeviceImpl_7_ValidateDevice_FPUPreserve(IDirect3DDevice7 *iface, return hr; } -static HRESULT WINAPI -Thunk_IDirect3DDeviceImpl_3_ValidateDevice(IDirect3DDevice3 *iface, - DWORD *Passes) +static HRESULT WINAPI IDirect3DDeviceImpl_3_ValidateDevice(IDirect3DDevice3 *iface, DWORD *Passes) { TRACE("iface %p, pass_count %p.\n", iface, Passes); @@ -5191,7 +5009,7 @@ IDirect3DDeviceImpl_7_Clear(IDirect3DDevice7 *iface, iface, Count, Rects, Flags, Color, Z, Stencil); EnterCriticalSection(&ddraw_cs); - hr = IWineD3DDevice_Clear(This->wineD3DDevice, Count, (RECT *)Rects, Flags, Color, Z, Stencil); + hr = wined3d_device_clear(This->wined3d_device, Count, (RECT *)Rects, Flags, Color, Z, Stencil); LeaveCriticalSection(&ddraw_cs); return hr; } @@ -5258,8 +5076,7 @@ IDirect3DDeviceImpl_7_SetViewport(IDirect3DDevice7 *iface, /* Note: D3DVIEWPORT7 is compatible with WINED3DVIEWPORT */ EnterCriticalSection(&ddraw_cs); - hr = IWineD3DDevice_SetViewport(This->wineD3DDevice, - (WINED3DVIEWPORT*) Data); + hr = wined3d_device_set_viewport(This->wined3d_device, (WINED3DVIEWPORT *)Data); LeaveCriticalSection(&ddraw_cs); return hr; } @@ -5315,8 +5132,7 @@ IDirect3DDeviceImpl_7_GetViewport(IDirect3DDevice7 *iface, /* Note: D3DVIEWPORT7 is compatible with WINED3DVIEWPORT */ EnterCriticalSection(&ddraw_cs); - hr = IWineD3DDevice_GetViewport(This->wineD3DDevice, - (WINED3DVIEWPORT*) Data); + hr = wined3d_device_get_viewport(This->wined3d_device, (WINED3DVIEWPORT *)Data); LeaveCriticalSection(&ddraw_cs); return hr_ddraw_from_wined3d(hr); @@ -5371,8 +5187,7 @@ IDirect3DDeviceImpl_7_SetMaterial(IDirect3DDevice7 *iface, if (!Mat) return DDERR_INVALIDPARAMS; /* Note: D3DMATERIAL7 is compatible with WINED3DMATERIAL */ EnterCriticalSection(&ddraw_cs); - hr = IWineD3DDevice_SetMaterial(This->wineD3DDevice, - (WINED3DMATERIAL*) Mat); + hr = wined3d_device_set_material(This->wined3d_device, (WINED3DMATERIAL *)Mat); LeaveCriticalSection(&ddraw_cs); return hr_ddraw_from_wined3d(hr); } @@ -5425,8 +5240,7 @@ IDirect3DDeviceImpl_7_GetMaterial(IDirect3DDevice7 *iface, EnterCriticalSection(&ddraw_cs); /* Note: D3DMATERIAL7 is compatible with WINED3DMATERIAL */ - hr = IWineD3DDevice_GetMaterial(This->wineD3DDevice, - (WINED3DMATERIAL*) Mat); + hr = wined3d_device_get_material(This->wined3d_device, (WINED3DMATERIAL *)Mat); LeaveCriticalSection(&ddraw_cs); return hr_ddraw_from_wined3d(hr); } @@ -5480,9 +5294,7 @@ IDirect3DDeviceImpl_7_SetLight(IDirect3DDevice7 *iface, EnterCriticalSection(&ddraw_cs); /* Note: D3DLIGHT7 is compatible with WINED3DLIGHT */ - hr = IWineD3DDevice_SetLight(This->wineD3DDevice, - LightIndex, - (WINED3DLIGHT*) Light); + hr = wined3d_device_set_light(This->wined3d_device, LightIndex, (WINED3DLIGHT *)Light); LeaveCriticalSection(&ddraw_cs); return hr_ddraw_from_wined3d(hr); } @@ -5536,9 +5348,7 @@ IDirect3DDeviceImpl_7_GetLight(IDirect3DDevice7 *iface, EnterCriticalSection(&ddraw_cs); /* Note: D3DLIGHT7 is compatible with WINED3DLIGHT */ - rc = IWineD3DDevice_GetLight(This->wineD3DDevice, - LightIndex, - (WINED3DLIGHT*) Light); + rc = wined3d_device_get_light(This->wined3d_device, LightIndex, (WINED3DLIGHT *)Light); /* Translate the result. WineD3D returns other values than D3D7 */ LeaveCriticalSection(&ddraw_cs); @@ -5589,7 +5399,7 @@ IDirect3DDeviceImpl_7_BeginStateBlock(IDirect3DDevice7 *iface) TRACE("iface %p.\n", iface); EnterCriticalSection(&ddraw_cs); - hr = IWineD3DDevice_BeginStateBlock(This->wineD3DDevice); + hr = wined3d_device_begin_stateblock(This->wined3d_device); LeaveCriticalSection(&ddraw_cs); return hr_ddraw_from_wined3d(hr); } @@ -5635,7 +5445,7 @@ IDirect3DDeviceImpl_7_EndStateBlock(IDirect3DDevice7 *iface, DWORD *BlockHandle) { IDirect3DDeviceImpl *This = (IDirect3DDeviceImpl *)iface; - IWineD3DStateBlock *wined3d_sb; + struct wined3d_stateblock *wined3d_sb; HRESULT hr; DWORD h; @@ -5649,7 +5459,7 @@ IDirect3DDeviceImpl_7_EndStateBlock(IDirect3DDevice7 *iface, EnterCriticalSection(&ddraw_cs); - hr = IWineD3DDevice_EndStateBlock(This->wineD3DDevice, &wined3d_sb); + hr = wined3d_device_end_stateblock(This->wined3d_device, &wined3d_sb); if (FAILED(hr)) { WARN("Failed to end stateblock, hr %#x.\n", hr); @@ -5662,7 +5472,7 @@ IDirect3DDeviceImpl_7_EndStateBlock(IDirect3DDevice7 *iface, if (h == DDRAW_INVALID_HANDLE) { ERR("Failed to allocate a stateblock handle.\n"); - IWineD3DStateBlock_Release(wined3d_sb); + wined3d_stateblock_decref(wined3d_sb); LeaveCriticalSection(&ddraw_cs); *BlockHandle = 0; return DDERR_OUTOFMEMORY; @@ -5724,7 +5534,7 @@ IDirect3DDeviceImpl_7_PreLoad(IDirect3DDevice7 *iface, return DDERR_INVALIDPARAMS; EnterCriticalSection(&ddraw_cs); - IWineD3DSurface_PreLoad(surf->WineD3DSurface); + wined3d_surface_preload(surf->wined3d_surface); LeaveCriticalSection(&ddraw_cs); return D3D_OK; } @@ -5768,7 +5578,7 @@ IDirect3DDeviceImpl_7_ApplyStateBlock(IDirect3DDevice7 *iface, DWORD BlockHandle) { IDirect3DDeviceImpl *This = (IDirect3DDeviceImpl *)iface; - IWineD3DStateBlock *wined3d_sb; + struct wined3d_stateblock *wined3d_sb; HRESULT hr; TRACE("iface %p, stateblock %#x.\n", iface, BlockHandle); @@ -5783,7 +5593,7 @@ IDirect3DDeviceImpl_7_ApplyStateBlock(IDirect3DDevice7 *iface, return D3DERR_INVALIDSTATEBLOCK; } - hr = IWineD3DStateBlock_Apply(wined3d_sb); + hr = wined3d_stateblock_apply(wined3d_sb); LeaveCriticalSection(&ddraw_cs); return hr_ddraw_from_wined3d(hr); @@ -5831,7 +5641,7 @@ IDirect3DDeviceImpl_7_CaptureStateBlock(IDirect3DDevice7 *iface, DWORD BlockHandle) { IDirect3DDeviceImpl *This = (IDirect3DDeviceImpl *)iface; - IWineD3DStateBlock *wined3d_sb; + struct wined3d_stateblock *wined3d_sb; HRESULT hr; TRACE("iface %p, stateblock %#x.\n", iface, BlockHandle); @@ -5846,7 +5656,7 @@ IDirect3DDeviceImpl_7_CaptureStateBlock(IDirect3DDevice7 *iface, return D3DERR_INVALIDSTATEBLOCK; } - hr = IWineD3DStateBlock_Capture(wined3d_sb); + hr = wined3d_stateblock_capture(wined3d_sb); LeaveCriticalSection(&ddraw_cs); return hr_ddraw_from_wined3d(hr); } @@ -5892,7 +5702,7 @@ IDirect3DDeviceImpl_7_DeleteStateBlock(IDirect3DDevice7 *iface, DWORD BlockHandle) { IDirect3DDeviceImpl *This = (IDirect3DDeviceImpl *)iface; - IWineD3DStateBlock *wined3d_sb; + struct wined3d_stateblock *wined3d_sb; ULONG ref; TRACE("iface %p, stateblock %#x.\n", iface, BlockHandle); @@ -5907,7 +5717,7 @@ IDirect3DDeviceImpl_7_DeleteStateBlock(IDirect3DDevice7 *iface, return D3DERR_INVALIDSTATEBLOCK; } - if ((ref = IWineD3DStateBlock_Release(wined3d_sb))) + if ((ref = wined3d_stateblock_decref(wined3d_sb))) { ERR("Something is still holding stateblock %p (refcount %u).\n", wined3d_sb, ref); } @@ -5959,7 +5769,7 @@ IDirect3DDeviceImpl_7_CreateStateBlock(IDirect3DDevice7 *iface, DWORD *BlockHandle) { IDirect3DDeviceImpl *This = (IDirect3DDeviceImpl *)iface; - IWineD3DStateBlock *wined3d_sb; + struct wined3d_stateblock *wined3d_sb; HRESULT hr; DWORD h; @@ -5979,7 +5789,7 @@ IDirect3DDeviceImpl_7_CreateStateBlock(IDirect3DDevice7 *iface, EnterCriticalSection(&ddraw_cs); /* The D3DSTATEBLOCKTYPE enum is fine here. */ - hr = IWineD3DDevice_CreateStateBlock(This->wineD3DDevice, Type, &wined3d_sb); + hr = wined3d_stateblock_create(This->wined3d_device, Type, &wined3d_sb); if (FAILED(hr)) { WARN("Failed to create stateblock, hr %#x.\n", hr); @@ -5991,7 +5801,7 @@ IDirect3DDeviceImpl_7_CreateStateBlock(IDirect3DDevice7 *iface, if (h == DDRAW_INVALID_HANDLE) { ERR("Failed to allocate stateblock handle.\n"); - IWineD3DStateBlock_Release(wined3d_sb); + wined3d_stateblock_decref(wined3d_sb); LeaveCriticalSection(&ddraw_cs); return DDERR_OUTOFMEMORY; } @@ -6135,19 +5945,20 @@ static void copy_mipmap_chain(IDirect3DDeviceImpl *device, if (src_level->surface_desc.dwWidth == dest_level->surface_desc.dwWidth && src_level->surface_desc.dwHeight == dest_level->surface_desc.dwHeight) { - /* Try UpdateSurface that may perform a more direct opengl loading. But skip this if destination is paletted texture and has no palette. - * Some games like Sacrifice set palette after Load, and it is a waste of effort to try to load texture without palette and generates - * warnings in wined3d. */ + /* Try UpdateSurface that may perform a more direct OpenGL + * loading. But skip this if destination is paletted texture and + * has no palette. Some games like Sacrifice set palette after + * Load, and it is a waste of effort to try to load texture + * without palette and generates warnings in wined3d. */ if (!palette_missing) - hr = IWineD3DDevice_UpdateSurface(device->wineD3DDevice, src_level->WineD3DSurface, &rect, dest_level->WineD3DSurface, - &point); + hr = wined3d_device_update_surface(device->wined3d_device, src_level->wined3d_surface, + &rect, dest_level->wined3d_surface, &point); if (palette_missing || FAILED(hr)) { /* UpdateSurface may fail e.g. if dest is in system memory. Fall back to BltFast that is less strict. */ - IWineD3DSurface_BltFast(dest_level->WineD3DSurface, - point.x, point.y, - src_level->WineD3DSurface, &rect, 0); + wined3d_surface_bltfast(dest_level->wined3d_surface, point.x, point.y, + src_level->wined3d_surface, &rect, 0); } ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE; @@ -6434,7 +6245,7 @@ IDirect3DDeviceImpl_7_LightEnable(IDirect3DDevice7 *iface, TRACE("iface %p, light_idx %u, enabled %#x.\n", iface, LightIndex, Enable); EnterCriticalSection(&ddraw_cs); - hr = IWineD3DDevice_SetLightEnable(This->wineD3DDevice, LightIndex, Enable); + hr = wined3d_device_set_light_enable(This->wined3d_device, LightIndex, Enable); LeaveCriticalSection(&ddraw_cs); return hr_ddraw_from_wined3d(hr); } @@ -6493,7 +6304,7 @@ IDirect3DDeviceImpl_7_GetLightEnable(IDirect3DDevice7 *iface, return DDERR_INVALIDPARAMS; EnterCriticalSection(&ddraw_cs); - hr = IWineD3DDevice_GetLightEnable(This->wineD3DDevice, LightIndex, Enable); + hr = wined3d_device_get_light_enable(This->wined3d_device, LightIndex, Enable); LeaveCriticalSection(&ddraw_cs); return hr_ddraw_from_wined3d(hr); } @@ -6552,7 +6363,7 @@ IDirect3DDeviceImpl_7_SetClipPlane(IDirect3DDevice7 *iface, return DDERR_INVALIDPARAMS; EnterCriticalSection(&ddraw_cs); - hr = IWineD3DDevice_SetClipPlane(This->wineD3DDevice, Index, PlaneEquation); + hr = wined3d_device_set_clip_plane(This->wined3d_device, Index, PlaneEquation); LeaveCriticalSection(&ddraw_cs); return hr; } @@ -6609,7 +6420,7 @@ IDirect3DDeviceImpl_7_GetClipPlane(IDirect3DDevice7 *iface, return DDERR_INVALIDPARAMS; EnterCriticalSection(&ddraw_cs); - hr = IWineD3DDevice_GetClipPlane(This->wineD3DDevice, Index, PlaneEquation); + hr = wined3d_device_get_clip_plane(This->wined3d_device, Index, PlaneEquation); LeaveCriticalSection(&ddraw_cs); return hr; } @@ -6800,23 +6611,23 @@ static const struct IDirect3DDevice7Vtbl d3d_device7_fpu_preserve_vtbl = static const struct IDirect3DDevice3Vtbl d3d_device3_vtbl = { /*** IUnknown Methods ***/ - Thunk_IDirect3DDeviceImpl_3_QueryInterface, - Thunk_IDirect3DDeviceImpl_3_AddRef, - Thunk_IDirect3DDeviceImpl_3_Release, + IDirect3DDeviceImpl_3_QueryInterface, + IDirect3DDeviceImpl_3_AddRef, + IDirect3DDeviceImpl_3_Release, /*** IDirect3DDevice3 ***/ IDirect3DDeviceImpl_3_GetCaps, IDirect3DDeviceImpl_3_GetStats, IDirect3DDeviceImpl_3_AddViewport, IDirect3DDeviceImpl_3_DeleteViewport, IDirect3DDeviceImpl_3_NextViewport, - Thunk_IDirect3DDeviceImpl_3_EnumTextureFormats, - Thunk_IDirect3DDeviceImpl_3_BeginScene, - Thunk_IDirect3DDeviceImpl_3_EndScene, - Thunk_IDirect3DDeviceImpl_3_GetDirect3D, + IDirect3DDeviceImpl_3_EnumTextureFormats, + IDirect3DDeviceImpl_3_BeginScene, + IDirect3DDeviceImpl_3_EndScene, + IDirect3DDeviceImpl_3_GetDirect3D, IDirect3DDeviceImpl_3_SetCurrentViewport, IDirect3DDeviceImpl_3_GetCurrentViewport, - Thunk_IDirect3DDeviceImpl_3_SetRenderTarget, - Thunk_IDirect3DDeviceImpl_3_GetRenderTarget, + IDirect3DDeviceImpl_3_SetRenderTarget, + IDirect3DDeviceImpl_3_GetRenderTarget, IDirect3DDeviceImpl_3_Begin, IDirect3DDeviceImpl_3_BeginIndexed, IDirect3DDeviceImpl_3_Vertex, @@ -6826,90 +6637,90 @@ static const struct IDirect3DDevice3Vtbl d3d_device3_vtbl = IDirect3DDeviceImpl_3_SetRenderState, IDirect3DDeviceImpl_3_GetLightState, IDirect3DDeviceImpl_3_SetLightState, - Thunk_IDirect3DDeviceImpl_3_SetTransform, - Thunk_IDirect3DDeviceImpl_3_GetTransform, - Thunk_IDirect3DDeviceImpl_3_MultiplyTransform, - Thunk_IDirect3DDeviceImpl_3_DrawPrimitive, - Thunk_IDirect3DDeviceImpl_3_DrawIndexedPrimitive, - Thunk_IDirect3DDeviceImpl_3_SetClipStatus, - Thunk_IDirect3DDeviceImpl_3_GetClipStatus, - Thunk_IDirect3DDeviceImpl_3_DrawPrimitiveStrided, - Thunk_IDirect3DDeviceImpl_3_DrawIndexedPrimitiveStrided, - Thunk_IDirect3DDeviceImpl_3_DrawPrimitiveVB, - Thunk_IDirect3DDeviceImpl_3_DrawIndexedPrimitiveVB, - Thunk_IDirect3DDeviceImpl_3_ComputeSphereVisibility, - Thunk_IDirect3DDeviceImpl_3_GetTexture, + IDirect3DDeviceImpl_3_SetTransform, + IDirect3DDeviceImpl_3_GetTransform, + IDirect3DDeviceImpl_3_MultiplyTransform, + IDirect3DDeviceImpl_3_DrawPrimitive, + IDirect3DDeviceImpl_3_DrawIndexedPrimitive, + IDirect3DDeviceImpl_3_SetClipStatus, + IDirect3DDeviceImpl_3_GetClipStatus, + IDirect3DDeviceImpl_3_DrawPrimitiveStrided, + IDirect3DDeviceImpl_3_DrawIndexedPrimitiveStrided, + IDirect3DDeviceImpl_3_DrawPrimitiveVB, + IDirect3DDeviceImpl_3_DrawIndexedPrimitiveVB, + IDirect3DDeviceImpl_3_ComputeSphereVisibility, + IDirect3DDeviceImpl_3_GetTexture, IDirect3DDeviceImpl_3_SetTexture, - Thunk_IDirect3DDeviceImpl_3_GetTextureStageState, - Thunk_IDirect3DDeviceImpl_3_SetTextureStageState, - Thunk_IDirect3DDeviceImpl_3_ValidateDevice + IDirect3DDeviceImpl_3_GetTextureStageState, + IDirect3DDeviceImpl_3_SetTextureStageState, + IDirect3DDeviceImpl_3_ValidateDevice }; static const struct IDirect3DDevice2Vtbl d3d_device2_vtbl = { /*** IUnknown Methods ***/ - Thunk_IDirect3DDeviceImpl_2_QueryInterface, - Thunk_IDirect3DDeviceImpl_2_AddRef, - Thunk_IDirect3DDeviceImpl_2_Release, + IDirect3DDeviceImpl_2_QueryInterface, + IDirect3DDeviceImpl_2_AddRef, + IDirect3DDeviceImpl_2_Release, /*** IDirect3DDevice2 ***/ - Thunk_IDirect3DDeviceImpl_2_GetCaps, + IDirect3DDeviceImpl_2_GetCaps, IDirect3DDeviceImpl_2_SwapTextureHandles, - Thunk_IDirect3DDeviceImpl_2_GetStats, - Thunk_IDirect3DDeviceImpl_2_AddViewport, - Thunk_IDirect3DDeviceImpl_2_DeleteViewport, - Thunk_IDirect3DDeviceImpl_2_NextViewport, + IDirect3DDeviceImpl_2_GetStats, + IDirect3DDeviceImpl_2_AddViewport, + IDirect3DDeviceImpl_2_DeleteViewport, + IDirect3DDeviceImpl_2_NextViewport, IDirect3DDeviceImpl_2_EnumTextureFormats, - Thunk_IDirect3DDeviceImpl_2_BeginScene, - Thunk_IDirect3DDeviceImpl_2_EndScene, - Thunk_IDirect3DDeviceImpl_2_GetDirect3D, - Thunk_IDirect3DDeviceImpl_2_SetCurrentViewport, - Thunk_IDirect3DDeviceImpl_2_GetCurrentViewport, - Thunk_IDirect3DDeviceImpl_2_SetRenderTarget, - Thunk_IDirect3DDeviceImpl_2_GetRenderTarget, - Thunk_IDirect3DDeviceImpl_2_Begin, - Thunk_IDirect3DDeviceImpl_2_BeginIndexed, - Thunk_IDirect3DDeviceImpl_2_Vertex, - Thunk_IDirect3DDeviceImpl_2_Index, - Thunk_IDirect3DDeviceImpl_2_End, - Thunk_IDirect3DDeviceImpl_2_GetRenderState, - Thunk_IDirect3DDeviceImpl_2_SetRenderState, - Thunk_IDirect3DDeviceImpl_2_GetLightState, - Thunk_IDirect3DDeviceImpl_2_SetLightState, - Thunk_IDirect3DDeviceImpl_2_SetTransform, - Thunk_IDirect3DDeviceImpl_2_GetTransform, - Thunk_IDirect3DDeviceImpl_2_MultiplyTransform, - Thunk_IDirect3DDeviceImpl_2_DrawPrimitive, - Thunk_IDirect3DDeviceImpl_2_DrawIndexedPrimitive, - Thunk_IDirect3DDeviceImpl_2_SetClipStatus, - Thunk_IDirect3DDeviceImpl_2_GetClipStatus + IDirect3DDeviceImpl_2_BeginScene, + IDirect3DDeviceImpl_2_EndScene, + IDirect3DDeviceImpl_2_GetDirect3D, + IDirect3DDeviceImpl_2_SetCurrentViewport, + IDirect3DDeviceImpl_2_GetCurrentViewport, + IDirect3DDeviceImpl_2_SetRenderTarget, + IDirect3DDeviceImpl_2_GetRenderTarget, + IDirect3DDeviceImpl_2_Begin, + IDirect3DDeviceImpl_2_BeginIndexed, + IDirect3DDeviceImpl_2_Vertex, + IDirect3DDeviceImpl_2_Index, + IDirect3DDeviceImpl_2_End, + IDirect3DDeviceImpl_2_GetRenderState, + IDirect3DDeviceImpl_2_SetRenderState, + IDirect3DDeviceImpl_2_GetLightState, + IDirect3DDeviceImpl_2_SetLightState, + IDirect3DDeviceImpl_2_SetTransform, + IDirect3DDeviceImpl_2_GetTransform, + IDirect3DDeviceImpl_2_MultiplyTransform, + IDirect3DDeviceImpl_2_DrawPrimitive, + IDirect3DDeviceImpl_2_DrawIndexedPrimitive, + IDirect3DDeviceImpl_2_SetClipStatus, + IDirect3DDeviceImpl_2_GetClipStatus }; static const struct IDirect3DDeviceVtbl d3d_device1_vtbl = { /*** IUnknown Methods ***/ - Thunk_IDirect3DDeviceImpl_1_QueryInterface, - Thunk_IDirect3DDeviceImpl_1_AddRef, - Thunk_IDirect3DDeviceImpl_1_Release, + IDirect3DDeviceImpl_1_QueryInterface, + IDirect3DDeviceImpl_1_AddRef, + IDirect3DDeviceImpl_1_Release, /*** IDirect3DDevice1 ***/ IDirect3DDeviceImpl_1_Initialize, - Thunk_IDirect3DDeviceImpl_1_GetCaps, - Thunk_IDirect3DDeviceImpl_1_SwapTextureHandles, + IDirect3DDeviceImpl_1_GetCaps, + IDirect3DDeviceImpl_1_SwapTextureHandles, IDirect3DDeviceImpl_1_CreateExecuteBuffer, - Thunk_IDirect3DDeviceImpl_1_GetStats, + IDirect3DDeviceImpl_1_GetStats, IDirect3DDeviceImpl_1_Execute, - Thunk_IDirect3DDeviceImpl_1_AddViewport, - Thunk_IDirect3DDeviceImpl_1_DeleteViewport, - Thunk_IDirect3DDeviceImpl_1_NextViewport, + IDirect3DDeviceImpl_1_AddViewport, + IDirect3DDeviceImpl_1_DeleteViewport, + IDirect3DDeviceImpl_1_NextViewport, IDirect3DDeviceImpl_1_Pick, IDirect3DDeviceImpl_1_GetPickRecords, - Thunk_IDirect3DDeviceImpl_1_EnumTextureFormats, + IDirect3DDeviceImpl_1_EnumTextureFormats, IDirect3DDeviceImpl_1_CreateMatrix, IDirect3DDeviceImpl_1_SetMatrix, IDirect3DDeviceImpl_1_GetMatrix, IDirect3DDeviceImpl_1_DeleteMatrix, - Thunk_IDirect3DDeviceImpl_1_BeginScene, - Thunk_IDirect3DDeviceImpl_1_EndScene, - Thunk_IDirect3DDeviceImpl_1_GetDirect3D + IDirect3DDeviceImpl_1_BeginScene, + IDirect3DDeviceImpl_1_EndScene, + IDirect3DDeviceImpl_1_GetDirect3D }; /***************************************************************************** @@ -6933,15 +6744,13 @@ IDirect3DDeviceImpl_UpdateDepthStencil(IDirect3DDeviceImpl *This) if(!depthStencil) { TRACE("Setting wined3d depth stencil to NULL\n"); - IWineD3DDevice_SetDepthStencilSurface(This->wineD3DDevice, - NULL); + wined3d_device_set_depth_stencil(This->wined3d_device, NULL); return WINED3DZB_FALSE; } dsi = (IDirectDrawSurfaceImpl *)depthStencil; - TRACE("Setting wined3d depth stencil to %p (wined3d %p)\n", dsi, dsi->WineD3DSurface); - IWineD3DDevice_SetDepthStencilSurface(This->wineD3DDevice, - dsi->WineD3DSurface); + TRACE("Setting wined3d depth stencil to %p (wined3d %p)\n", dsi, dsi->wined3d_surface); + wined3d_device_set_depth_stencil(This->wined3d_device, dsi->wined3d_surface); IDirectDrawSurface7_Release(depthStencil); return WINED3DZB_TRUE; @@ -6949,7 +6758,6 @@ IDirect3DDeviceImpl_UpdateDepthStencil(IDirect3DDeviceImpl *This) HRESULT d3d_device_init(IDirect3DDeviceImpl *device, IDirectDrawImpl *ddraw, IDirectDrawSurfaceImpl *target) { - IParentImpl *index_buffer_parent; HRESULT hr; if (ddraw->cooperative_level & DDSCL_FPUPRESERVE) @@ -6963,6 +6771,7 @@ HRESULT d3d_device_init(IDirect3DDeviceImpl *device, IDirectDrawImpl *ddraw, IDi device->ref = 1; device->ddraw = ddraw; device->target = target; + list_init(&device->viewport_list); if (!ddraw_handle_table_init(&device->handle_table, 64)) { @@ -6973,38 +6782,26 @@ HRESULT d3d_device_init(IDirect3DDeviceImpl *device, IDirectDrawImpl *ddraw, IDi device->legacyTextureBlending = FALSE; /* Create an index buffer, it's needed for indexed drawing */ - index_buffer_parent = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*index_buffer_parent)); - if (!index_buffer_parent) - { - ERR("Failed to allocate index buffer parent memory.\n"); - ddraw_handle_table_destroy(&device->handle_table); - return DDERR_OUTOFMEMORY; - } - - ddraw_parent_init(index_buffer_parent); - - hr = IWineD3DDevice_CreateIndexBuffer(ddraw->wineD3DDevice, 0x40000 /* Length. Don't know how long it should be */, - WINED3DUSAGE_DYNAMIC /* Usage */, WINED3DPOOL_DEFAULT, index_buffer_parent, + hr = wined3d_buffer_create_ib(ddraw->wined3d_device, 0x40000 /* Length. Don't know how long it should be */, + WINED3DUSAGE_DYNAMIC /* Usage */, WINED3DPOOL_DEFAULT, NULL, &ddraw_null_wined3d_parent_ops, &device->indexbuffer); if (FAILED(hr)) { ERR("Failed to create an index buffer, hr %#x.\n", hr); - HeapFree(GetProcessHeap(), 0, index_buffer_parent); ddraw_handle_table_destroy(&device->handle_table); return hr; } - index_buffer_parent->child = (IUnknown *)device->indexbuffer; /* This is for convenience. */ - device->wineD3DDevice = ddraw->wineD3DDevice; - IWineD3DDevice_AddRef(ddraw->wineD3DDevice); + device->wined3d_device = ddraw->wined3d_device; + wined3d_device_incref(ddraw->wined3d_device); /* Render to the back buffer */ - hr = IWineD3DDevice_SetRenderTarget(ddraw->wineD3DDevice, 0, target->WineD3DSurface, TRUE); + hr = wined3d_device_set_render_target(ddraw->wined3d_device, 0, target->wined3d_surface, TRUE); if (FAILED(hr)) { ERR("Failed to set render target, hr %#x.\n", hr); - IParent_Release((IParent *)index_buffer_parent); + wined3d_buffer_decref(device->indexbuffer); ddraw_handle_table_destroy(&device->handle_table); return hr; } @@ -7023,7 +6820,7 @@ HRESULT d3d_device_init(IDirect3DDeviceImpl *device, IDirectDrawImpl *ddraw, IDi ddraw->d3ddevice = device; - IWineD3DDevice_SetRenderState(ddraw->wineD3DDevice, WINED3DRS_ZENABLE, + wined3d_device_set_render_state(ddraw->wined3d_device, WINED3DRS_ZENABLE, IDirect3DDeviceImpl_UpdateDepthStencil(device)); return D3D_OK; diff --git a/dll/directx/wine/ddraw/executebuffer.c b/dll/directx/wine/ddraw/executebuffer.c index d4d2dd0b72f..86a3aa9e581 100644 --- a/dll/directx/wine/ddraw/executebuffer.c +++ b/dll/directx/wine/ddraw/executebuffer.c @@ -68,10 +68,8 @@ static void _dump_D3DEXECUTEBUFFERDESC(const D3DEXECUTEBUFFERDESC *lpDesc) { * Viewport: Viewport for this operation * *****************************************************************************/ -void -IDirect3DExecuteBufferImpl_Execute(IDirect3DExecuteBufferImpl *This, - IDirect3DDeviceImpl *lpDevice, - IDirect3DViewportImpl *lpViewport) +HRESULT d3d_execute_buffer_execute(IDirect3DExecuteBufferImpl *This, + IDirect3DDeviceImpl *lpDevice, IDirect3DViewportImpl *lpViewport) { /* DWORD bs = This->desc.dwBufferSize; */ DWORD vs = This->data.dwVertexOffset; @@ -81,10 +79,14 @@ IDirect3DExecuteBufferImpl_Execute(IDirect3DExecuteBufferImpl *This, char *instr = (char *)This->desc.lpData + is; - /* Should check if the viewport was added or not to the device */ + if (lpViewport->active_device != lpDevice) + { + WARN("Viewport %p active device is %p.\n", + lpViewport, lpViewport->active_device); + return DDERR_INVALIDPARAMS; + } /* Activate the viewport */ - lpViewport->active_device = lpDevice; viewport_activate(lpViewport, FALSE); TRACE("ExecuteData :\n"); @@ -153,11 +155,8 @@ IDirect3DExecuteBufferImpl_Execute(IDirect3DExecuteBufferImpl *This, } /* IDirect3DDevices have color keying always enabled - * enable it before drawing. This overwrites any ALPHA* - * render state - */ - IWineD3DDevice_SetRenderState(lpDevice->wineD3DDevice, - WINED3DRS_COLORKEYENABLE, - 1); + * render state. */ + wined3d_device_set_render_state(lpDevice->wined3d_device, WINED3DRS_COLORKEYENABLE, 1); IDirect3DDevice7_DrawIndexedPrimitive((IDirect3DDevice7 *)lpDevice, D3DPT_TRIANGLELIST, D3DFVF_TLVERTEX, tl_vx, 0, This->indices, count * 3, 0); } break; @@ -316,18 +315,12 @@ IDirect3DExecuteBufferImpl_Execute(IDirect3DExecuteBufferImpl *This, /* Get the transform and world matrix */ /* Note: D3DMATRIX is compatible with WINED3DMATRIX */ - - IWineD3DDevice_GetTransform(lpDevice->wineD3DDevice, - D3DTRANSFORMSTATE_VIEW, - (WINED3DMATRIX*) &view_mat); - - IWineD3DDevice_GetTransform(lpDevice->wineD3DDevice, - D3DTRANSFORMSTATE_PROJECTION, - (WINED3DMATRIX*) &proj_mat); - - IWineD3DDevice_GetTransform(lpDevice->wineD3DDevice, - WINED3DTS_WORLDMATRIX(0), - (WINED3DMATRIX*) &world_mat); + wined3d_device_get_transform(lpDevice->wined3d_device, + D3DTRANSFORMSTATE_VIEW, (WINED3DMATRIX *)&view_mat); + wined3d_device_get_transform(lpDevice->wined3d_device, + D3DTRANSFORMSTATE_PROJECTION, (WINED3DMATRIX *)&proj_mat); + wined3d_device_get_transform(lpDevice->wined3d_device, + WINED3DTS_WORLDMATRIX(0), (WINED3DMATRIX *)&world_mat); for (i = 0; i < count; i++) { LPD3DPROCESSVERTICES ci = (LPD3DPROCESSVERTICES) instr; @@ -551,7 +544,7 @@ IDirect3DExecuteBufferImpl_Execute(IDirect3DExecuteBufferImpl *This, } end_of_buffer: - ; + return D3D_OK; } /***************************************************************************** diff --git a/dll/directx/wine/ddraw/main.c b/dll/directx/wine/ddraw/main.c index 217a2cbcff8..875e1947f8d 100644 --- a/dll/directx/wine/ddraw/main.c +++ b/dll/directx/wine/ddraw/main.c @@ -38,8 +38,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(ddraw); /* The configured default surface */ WINED3DSURFTYPE DefaultSurfaceType = SURFACE_UNKNOWN; -typeof(WineDirect3DCreateClipper) *pWineDirect3DCreateClipper DECLSPEC_HIDDEN; -typeof(WineDirect3DCreate) *pWineDirect3DCreate DECLSPEC_HIDDEN; + /* DDraw list and critical section */ static struct list global_ddraw_list = LIST_INIT(global_ddraw_list); @@ -167,31 +166,6 @@ void *ddraw_get_object(struct ddraw_handle_table *t, DWORD handle, enum ddraw_ha return entry->object; } -/* - * Helper Function for DDRAW_Create and DirectDrawCreateClipper for - * lazy loading of the Wine D3D driver. - * - * Returns - * TRUE on success - * FALSE on failure. - */ - -BOOL LoadWineD3D(void) -{ - static HMODULE hWineD3D = (HMODULE) -1; - if (hWineD3D == (HMODULE) -1) - { - hWineD3D = LoadLibraryA("wined3d"); - if (hWineD3D) - { - pWineDirect3DCreate = (typeof(WineDirect3DCreate) *)GetProcAddress(hWineD3D, "WineDirect3DCreate"); - pWineDirect3DCreateClipper = (typeof(WineDirect3DCreateClipper) *) GetProcAddress(hWineD3D, "WineDirect3DCreateClipper"); - return TRUE; - } - } - return hWineD3D != NULL; -} - /*********************************************************************** * * Helper function for DirectDrawCreate and friends @@ -270,8 +244,8 @@ DDRAW_Create(const GUID *guid, return hr; } - hr = IDirectDraw7_QueryInterface((IDirectDraw7 *)This, iid, DD); - IDirectDraw7_Release((IDirectDraw7 *)This); + hr = IDirectDraw7_QueryInterface(&This->IDirectDraw7_iface, iid, DD); + IDirectDraw7_Release(&This->IDirectDraw7_iface); if (SUCCEEDED(hr)) list_add_head(&global_ddraw_list, &This->ddraw_list_entry); else WARN("Failed to query interface %s from ddraw object %p.\n", debugstr_guid(iid), This); @@ -525,6 +499,23 @@ static const struct object_creation_info object_creation[] = { &CLSID_DirectDrawClipper, CF_CreateDirectDrawClipper } }; + +/****************************************************************************** + * DirectDraw ClassFactory implementation + ******************************************************************************/ +typedef struct +{ + IClassFactory IClassFactory_iface; + + LONG ref; + HRESULT (*pfnCreateInstance)(IUnknown *pUnkOuter, REFIID iid, LPVOID *ppObj); +} IClassFactoryImpl; + +static inline IClassFactoryImpl *impl_from_IClassFactory(IClassFactory *iface) +{ + return CONTAINING_RECORD(iface, IClassFactoryImpl, IClassFactory_iface); +} + /******************************************************************************* * IDirectDrawClassFactory::QueryInterface * @@ -539,12 +530,10 @@ static const struct object_creation_info object_creation[] = * Failure: E_NOINTERFACE * *******************************************************************************/ -static HRESULT WINAPI -IDirectDrawClassFactoryImpl_QueryInterface(IClassFactory *iface, - REFIID riid, - void **obj) +static HRESULT WINAPI IDirectDrawClassFactoryImpl_QueryInterface(IClassFactory *iface, REFIID riid, + void **obj) { - IClassFactoryImpl *This = (IClassFactoryImpl *)iface; + IClassFactoryImpl *This = impl_from_IClassFactory(iface); TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), obj); @@ -569,10 +558,9 @@ IDirectDrawClassFactoryImpl_QueryInterface(IClassFactory *iface, * The new refcount * *******************************************************************************/ -static ULONG WINAPI -IDirectDrawClassFactoryImpl_AddRef(IClassFactory *iface) +static ULONG WINAPI IDirectDrawClassFactoryImpl_AddRef(IClassFactory *iface) { - IClassFactoryImpl *This = (IClassFactoryImpl *)iface; + IClassFactoryImpl *This = impl_from_IClassFactory(iface); ULONG ref = InterlockedIncrement(&This->ref); TRACE("%p increasing refcount to %u.\n", This, ref); @@ -590,10 +578,9 @@ IDirectDrawClassFactoryImpl_AddRef(IClassFactory *iface) * The new refcount * *******************************************************************************/ -static ULONG WINAPI -IDirectDrawClassFactoryImpl_Release(IClassFactory *iface) +static ULONG WINAPI IDirectDrawClassFactoryImpl_Release(IClassFactory *iface) { - IClassFactoryImpl *This = (IClassFactoryImpl *)iface; + IClassFactoryImpl *This = impl_from_IClassFactory(iface); ULONG ref = InterlockedDecrement(&This->ref); TRACE("%p decreasing refcount to %u.\n", This, ref); @@ -617,13 +604,10 @@ IDirectDrawClassFactoryImpl_Release(IClassFactory *iface) * ??? * *******************************************************************************/ -static HRESULT WINAPI -IDirectDrawClassFactoryImpl_CreateInstance(IClassFactory *iface, - IUnknown *UnkOuter, - REFIID riid, - void **obj) +static HRESULT WINAPI IDirectDrawClassFactoryImpl_CreateInstance(IClassFactory *iface, + IUnknown *UnkOuter, REFIID riid, void **obj) { - IClassFactoryImpl *This = (IClassFactoryImpl *)iface; + IClassFactoryImpl *This = impl_from_IClassFactory(iface); TRACE("iface %p, outer_unknown %p, riid %s, object %p.\n", iface, UnkOuter, debugstr_guid(riid), obj); @@ -706,7 +690,7 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv) factory = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*factory)); if (factory == NULL) return E_OUTOFMEMORY; - factory->lpVtbl = &IClassFactory_Vtbl; + factory->IClassFactory_iface.lpVtbl = &IClassFactory_Vtbl; factory->ref = 1; factory->pfnCreateInstance = object_creation[i].pfnCreateInstance; @@ -916,11 +900,11 @@ DllMain(HINSTANCE hInstDLL, WARN("DDraw %p has a refcount of %d\n", ddraw, ddraw->ref7 + ddraw->ref4 + ddraw->ref3 + ddraw->ref2 + ddraw->ref1); /* Add references to each interface to avoid freeing them unexpectedly */ - IDirectDraw_AddRef((IDirectDraw *)&ddraw->IDirectDraw_vtbl); - IDirectDraw2_AddRef((IDirectDraw2 *)&ddraw->IDirectDraw2_vtbl); - IDirectDraw3_AddRef((IDirectDraw3 *)&ddraw->IDirectDraw3_vtbl); - IDirectDraw4_AddRef((IDirectDraw4 *)&ddraw->IDirectDraw4_vtbl); - IDirectDraw7_AddRef((IDirectDraw7 *)ddraw); + IDirectDraw_AddRef(&ddraw->IDirectDraw_iface); + IDirectDraw2_AddRef(&ddraw->IDirectDraw2_iface); + IDirectDraw3_AddRef(&ddraw->IDirectDraw3_iface); + IDirectDraw4_AddRef(&ddraw->IDirectDraw4_iface); + IDirectDraw7_AddRef(&ddraw->IDirectDraw7_iface); /* Does a D3D device exist? Destroy it * TODO: Destroy all Vertex buffers, Lights, Materials @@ -939,8 +923,8 @@ DllMain(HINSTANCE hInstDLL, desc.dwSize = sizeof(desc); for(i = 0; i <= 1; i++) { - hr = IDirectDraw7_EnumSurfaces((IDirectDraw7 *)ddraw, - DDENUMSURFACES_ALL, &desc, ddraw, DestroyCallback); + hr = IDirectDraw7_EnumSurfaces(&ddraw->IDirectDraw7_iface, DDENUMSURFACES_ALL, + &desc, ddraw, DestroyCallback); if(hr != D3D_OK) ERR("(%p) EnumSurfaces failed, prepare for trouble\n", ddraw); } @@ -952,11 +936,11 @@ DllMain(HINSTANCE hInstDLL, /* Release all hanging references to destroy the objects. This * restores the screen mode too */ - while(IDirectDraw_Release((IDirectDraw *)&ddraw->IDirectDraw_vtbl)); - while(IDirectDraw2_Release((IDirectDraw2 *)&ddraw->IDirectDraw2_vtbl)); - while(IDirectDraw3_Release((IDirectDraw3 *)&ddraw->IDirectDraw3_vtbl)); - while(IDirectDraw4_Release((IDirectDraw4 *)&ddraw->IDirectDraw4_vtbl)); - while(IDirectDraw7_Release((IDirectDraw7 *)ddraw)); + while(IDirectDraw_Release(&ddraw->IDirectDraw_iface)); + while(IDirectDraw2_Release(&ddraw->IDirectDraw2_iface)); + while(IDirectDraw3_Release(&ddraw->IDirectDraw3_iface)); + while(IDirectDraw4_Release(&ddraw->IDirectDraw4_iface)); + while(IDirectDraw7_Release(&ddraw->IDirectDraw7_iface)); } } diff --git a/dll/directx/wine/ddraw/material.c b/dll/directx/wine/ddraw/material.c index 42d5edcbce5..e137bfcbed5 100644 --- a/dll/directx/wine/ddraw/material.c +++ b/dll/directx/wine/ddraw/material.c @@ -326,7 +326,7 @@ IDirect3DMaterialImpl_GetHandle(IDirect3DMaterial3 *iface, return D3D_OK; } -static HRESULT WINAPI Thunk_IDirect3DMaterialImpl_2_GetHandle(IDirect3DMaterial2 *iface, +static HRESULT WINAPI IDirect3DMaterialImpl_2_GetHandle(IDirect3DMaterial2 *iface, IDirect3DDevice2 *lpDirect3DDevice2, D3DMATERIALHANDLE *lpHandle) { TRACE("iface %p, device %p, handle %p.\n", iface, lpDirect3DDevice2, lpHandle); @@ -335,7 +335,7 @@ static HRESULT WINAPI Thunk_IDirect3DMaterialImpl_2_GetHandle(IDirect3DMaterial2 (IDirect3DDevice3 *)&device_from_device2(lpDirect3DDevice2)->IDirect3DDevice3_vtbl : NULL, lpHandle); } -static HRESULT WINAPI Thunk_IDirect3DMaterialImpl_1_GetHandle(IDirect3DMaterial *iface, +static HRESULT WINAPI IDirect3DMaterialImpl_1_GetHandle(IDirect3DMaterial *iface, IDirect3DDevice *lpDirect3DDevice, D3DMATERIALHANDLE *lpHandle) { TRACE("iface %p, device %p, handle %p.\n", iface, lpDirect3DDevice, lpHandle); @@ -344,88 +344,76 @@ static HRESULT WINAPI Thunk_IDirect3DMaterialImpl_1_GetHandle(IDirect3DMaterial (IDirect3DDevice3 *)&device_from_device1(lpDirect3DDevice)->IDirect3DDevice3_vtbl : NULL, lpHandle); } -static HRESULT WINAPI -Thunk_IDirect3DMaterialImpl_2_QueryInterface(LPDIRECT3DMATERIAL2 iface, - REFIID riid, - LPVOID* obp) +static HRESULT WINAPI IDirect3DMaterialImpl_2_QueryInterface(LPDIRECT3DMATERIAL2 iface, REFIID riid, + LPVOID* obp) { TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), obp); return IDirect3DMaterial3_QueryInterface((IDirect3DMaterial3 *)material_from_material2(iface), riid, obp); } -static HRESULT WINAPI -Thunk_IDirect3DMaterialImpl_1_QueryInterface(LPDIRECT3DMATERIAL iface, - REFIID riid, - LPVOID* obp) +static HRESULT WINAPI IDirect3DMaterialImpl_1_QueryInterface(LPDIRECT3DMATERIAL iface, REFIID riid, + LPVOID* obp) { TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), obp); return IDirect3DMaterial3_QueryInterface((IDirect3DMaterial3 *)material_from_material1(iface), riid, obp); } -static ULONG WINAPI -Thunk_IDirect3DMaterialImpl_2_AddRef(LPDIRECT3DMATERIAL2 iface) +static ULONG WINAPI IDirect3DMaterialImpl_2_AddRef(LPDIRECT3DMATERIAL2 iface) { TRACE("iface %p.\n", iface); return IDirect3DMaterial3_AddRef((IDirect3DMaterial3 *)material_from_material2(iface)); } -static ULONG WINAPI -Thunk_IDirect3DMaterialImpl_1_AddRef(LPDIRECT3DMATERIAL iface) +static ULONG WINAPI IDirect3DMaterialImpl_1_AddRef(LPDIRECT3DMATERIAL iface) { TRACE("iface %p.\n", iface); return IDirect3DMaterial3_AddRef((IDirect3DMaterial3 *)material_from_material1(iface)); } -static ULONG WINAPI -Thunk_IDirect3DMaterialImpl_2_Release(LPDIRECT3DMATERIAL2 iface) +static ULONG WINAPI IDirect3DMaterialImpl_2_Release(LPDIRECT3DMATERIAL2 iface) { TRACE("iface %p.\n", iface); return IDirect3DMaterial3_Release((IDirect3DMaterial3 *)material_from_material2(iface)); } -static ULONG WINAPI -Thunk_IDirect3DMaterialImpl_1_Release(LPDIRECT3DMATERIAL iface) +static ULONG WINAPI IDirect3DMaterialImpl_1_Release(LPDIRECT3DMATERIAL iface) { TRACE("iface %p.\n", iface); return IDirect3DMaterial3_Release((IDirect3DMaterial3 *)material_from_material1(iface)); } -static HRESULT WINAPI -Thunk_IDirect3DMaterialImpl_2_SetMaterial(LPDIRECT3DMATERIAL2 iface, - LPD3DMATERIAL lpMat) +static HRESULT WINAPI IDirect3DMaterialImpl_2_SetMaterial(LPDIRECT3DMATERIAL2 iface, + LPD3DMATERIAL lpMat) { TRACE("iface %p, material %p.\n", iface, lpMat); return IDirect3DMaterial3_SetMaterial((IDirect3DMaterial3 *)material_from_material2(iface), lpMat); } -static HRESULT WINAPI -Thunk_IDirect3DMaterialImpl_1_SetMaterial(LPDIRECT3DMATERIAL iface, - LPD3DMATERIAL lpMat) +static HRESULT WINAPI IDirect3DMaterialImpl_1_SetMaterial(LPDIRECT3DMATERIAL iface, + LPD3DMATERIAL lpMat) { TRACE("iface %p, material %p.\n", iface, lpMat); return IDirect3DMaterial3_SetMaterial((IDirect3DMaterial3 *)material_from_material1(iface), lpMat); } -static HRESULT WINAPI -Thunk_IDirect3DMaterialImpl_2_GetMaterial(LPDIRECT3DMATERIAL2 iface, - LPD3DMATERIAL lpMat) +static HRESULT WINAPI IDirect3DMaterialImpl_2_GetMaterial(LPDIRECT3DMATERIAL2 iface, + LPD3DMATERIAL lpMat) { TRACE("iface %p, material %p.\n", iface, lpMat); return IDirect3DMaterial3_GetMaterial((IDirect3DMaterial3 *)material_from_material2(iface), lpMat); } -static HRESULT WINAPI -Thunk_IDirect3DMaterialImpl_1_GetMaterial(LPDIRECT3DMATERIAL iface, - LPD3DMATERIAL lpMat) +static HRESULT WINAPI IDirect3DMaterialImpl_1_GetMaterial(LPDIRECT3DMATERIAL iface, + LPD3DMATERIAL lpMat) { TRACE("iface %p, material %p.\n", iface, lpMat); @@ -471,26 +459,26 @@ static const struct IDirect3DMaterial3Vtbl d3d_material3_vtbl = static const struct IDirect3DMaterial2Vtbl d3d_material2_vtbl = { /*** IUnknown Methods ***/ - Thunk_IDirect3DMaterialImpl_2_QueryInterface, - Thunk_IDirect3DMaterialImpl_2_AddRef, - Thunk_IDirect3DMaterialImpl_2_Release, + IDirect3DMaterialImpl_2_QueryInterface, + IDirect3DMaterialImpl_2_AddRef, + IDirect3DMaterialImpl_2_Release, /*** IDirect3DMaterial2 Methods ***/ - Thunk_IDirect3DMaterialImpl_2_SetMaterial, - Thunk_IDirect3DMaterialImpl_2_GetMaterial, - Thunk_IDirect3DMaterialImpl_2_GetHandle, + IDirect3DMaterialImpl_2_SetMaterial, + IDirect3DMaterialImpl_2_GetMaterial, + IDirect3DMaterialImpl_2_GetHandle, }; static const struct IDirect3DMaterialVtbl d3d_material1_vtbl = { /*** IUnknown Methods ***/ - Thunk_IDirect3DMaterialImpl_1_QueryInterface, - Thunk_IDirect3DMaterialImpl_1_AddRef, - Thunk_IDirect3DMaterialImpl_1_Release, + IDirect3DMaterialImpl_1_QueryInterface, + IDirect3DMaterialImpl_1_AddRef, + IDirect3DMaterialImpl_1_Release, /*** IDirect3DMaterial1 Methods ***/ IDirect3DMaterialImpl_Initialize, - Thunk_IDirect3DMaterialImpl_1_SetMaterial, - Thunk_IDirect3DMaterialImpl_1_GetMaterial, - Thunk_IDirect3DMaterialImpl_1_GetHandle, + IDirect3DMaterialImpl_1_SetMaterial, + IDirect3DMaterialImpl_1_GetMaterial, + IDirect3DMaterialImpl_1_GetHandle, IDirect3DMaterialImpl_Reserve, IDirect3DMaterialImpl_Unreserve }; diff --git a/dll/directx/wine/ddraw/palette.c b/dll/directx/wine/ddraw/palette.c index 7064ba02790..b68cf82d4f0 100644 --- a/dll/directx/wine/ddraw/palette.c +++ b/dll/directx/wine/ddraw/palette.c @@ -98,7 +98,7 @@ IDirectDrawPaletteImpl_Release(IDirectDrawPalette *iface) if (ref == 0) { EnterCriticalSection(&ddraw_cs); - IWineD3DPalette_Release(This->wineD3DPalette); + wined3d_palette_decref(This->wineD3DPalette); if(This->ifaceToRelease) { IUnknown_Release(This->ifaceToRelease); @@ -156,14 +156,14 @@ IDirectDrawPaletteImpl_GetCaps(IDirectDrawPalette *iface, DWORD *Caps) { IDirectDrawPaletteImpl *This = (IDirectDrawPaletteImpl *)iface; - HRESULT hr; TRACE("iface %p, caps %p.\n", iface, Caps); EnterCriticalSection(&ddraw_cs); - hr = IWineD3DPalette_GetCaps(This->wineD3DPalette, Caps); + *Caps = wined3d_palette_get_flags(This->wineD3DPalette); LeaveCriticalSection(&ddraw_cs); - return hr; + + return D3D_OK; } /***************************************************************************** @@ -201,7 +201,7 @@ IDirectDrawPaletteImpl_SetEntries(IDirectDrawPalette *iface, return DDERR_INVALIDPARAMS; EnterCriticalSection(&ddraw_cs); - hr = IWineD3DPalette_SetEntries(This->wineD3DPalette, Flags, Start, Count, PalEnt); + hr = wined3d_palette_set_entries(This->wineD3DPalette, Flags, Start, Count, PalEnt); LeaveCriticalSection(&ddraw_cs); return hr; } @@ -240,7 +240,7 @@ IDirectDrawPaletteImpl_GetEntries(IDirectDrawPalette *iface, return DDERR_INVALIDPARAMS; EnterCriticalSection(&ddraw_cs); - hr = IWineD3DPalette_GetEntries(This->wineD3DPalette, Flags, Start, Count, PalEnt); + hr = wined3d_palette_get_entries(This->wineD3DPalette, Flags, Start, Count, PalEnt); LeaveCriticalSection(&ddraw_cs); return hr; } @@ -266,7 +266,7 @@ HRESULT ddraw_palette_init(IDirectDrawPaletteImpl *palette, palette->lpVtbl = &ddraw_palette_vtbl; palette->ref = 1; - hr = IWineD3DDevice_CreatePalette(ddraw->wineD3DDevice, flags, + hr = wined3d_palette_create(ddraw->wined3d_device, flags, entries, palette, &palette->wineD3DPalette); if (FAILED(hr)) { @@ -274,7 +274,7 @@ HRESULT ddraw_palette_init(IDirectDrawPaletteImpl *palette, return hr; } - palette->ifaceToRelease = (IUnknown *)ddraw; + palette->ifaceToRelease = (IUnknown *)&ddraw->IDirectDraw7_iface; IUnknown_AddRef(palette->ifaceToRelease); return DD_OK; diff --git a/dll/directx/wine/ddraw/surface.c b/dll/directx/wine/ddraw/surface.c index cff2f95aab4..ee30d8666d3 100644 --- a/dll/directx/wine/ddraw/surface.c +++ b/dll/directx/wine/ddraw/surface.c @@ -102,7 +102,8 @@ static HRESULT WINAPI ddraw_surface7_QueryInterface(IDirectDrawSurface7 *iface, IDirect3DDevice7 *d3d; /* Call into IDirect3D7 for creation */ - IDirect3D7_CreateDevice((IDirect3D7 *)&This->ddraw->IDirect3D7_vtbl, riid, (IDirectDrawSurface7 *)This, &d3d); + IDirect3D7_CreateDevice(&This->ddraw->IDirect3D7_iface, riid, (IDirectDrawSurface7 *)This, + &d3d); if (d3d) { @@ -179,10 +180,13 @@ static ULONG WINAPI ddraw_surface7_AddRef(IDirectDrawSurface7 *iface) TRACE("%p increasing refcount to %u.\n", This, refCount); - if (refCount == 1 && This->WineD3DSurface) + if (refCount == 1) { EnterCriticalSection(&ddraw_cs); - IWineD3DSurface_AddRef(This->WineD3DSurface); + if (This->wined3d_surface) + wined3d_surface_incref(This->wined3d_surface); + if (This->wined3d_texture) + wined3d_texture_incref(This->wined3d_texture); LeaveCriticalSection(&ddraw_cs); } @@ -243,53 +247,100 @@ void ddraw_surface_destroy(IDirectDrawSurfaceImpl *This) WARN("(%p): Destroying surface with refount %d\n", This, This->ref); } - /* Check for attached surfaces and detach them */ - if(This->first_attached != This) + if (This->wined3d_surface) + wined3d_surface_decref(This->wined3d_surface); +} + +static void ddraw_surface_cleanup(IDirectDrawSurfaceImpl *surface) +{ + IDirectDrawSurfaceImpl *surf; + IUnknown *ifaceToRelease; + UINT i; + + TRACE("surface %p.\n", surface); + + if (surface->wined3d_swapchain) { - /* Well, this shouldn't happen: The surface being attached is addref()ed - * in AddAttachedSurface, so it shouldn't be released until DeleteAttachedSurface - * is called, because the refcount is held. It looks like the app released() - * it often enough to force this - */ - IDirectDrawSurface7 *root = (IDirectDrawSurface7 *)This->first_attached; - IDirectDrawSurface7 *detach = (IDirectDrawSurface7 *)This; + IDirectDrawImpl *ddraw = surface->ddraw; - FIXME("(%p) Freeing a surface that is attached to surface %p\n", This, This->first_attached); - - /* The refcount will drop to -1 here */ - if(IDirectDrawSurface7_DeleteAttachedSurface(root, 0, detach) != DD_OK) + /* If it's the render target, destroy the D3D device. */ + if (ddraw->d3d_initialized && surface == ddraw->d3d_target) { - ERR("(%p) DeleteAttachedSurface failed!\n", This); + TRACE("Destroying the render target, uninitializing D3D.\n"); + + for (i = 0; i < ddraw->numConvertedDecls; ++i) + { + wined3d_vertex_declaration_decref(ddraw->decls[i].decl); + } + HeapFree(GetProcessHeap(), 0, ddraw->decls); + ddraw->numConvertedDecls = 0; + + if (FAILED(wined3d_device_uninit_3d(ddraw->wined3d_device))) + { + ERR("Failed to uninit 3D.\n"); + } + else + { + /* Free the d3d window if one was created. */ + if (ddraw->d3d_window && ddraw->d3d_window != ddraw->dest_window) + { + TRACE("Destroying the hidden render window %p.\n", ddraw->d3d_window); + DestroyWindow(ddraw->d3d_window); + ddraw->d3d_window = 0; + } + } + + ddraw->d3d_initialized = FALSE; + ddraw->d3d_target = NULL; + } + else + { + wined3d_device_uninit_gdi(ddraw->wined3d_device); + } + + surface->wined3d_swapchain = NULL; + + /* Reset to the default surface implementation type. This is needed + * if applications use non render target surfaces and expect blits to + * work after destroying the render target. + * + * TODO: Recreate existing offscreen surfaces. */ + ddraw->ImplType = DefaultSurfaceType; + + TRACE("D3D unloaded.\n"); + } + + /* The refcount test shows that the palette is detached when the surface + * is destroyed. */ + IDirectDrawSurface7_SetPalette((IDirectDrawSurface7 *)surface, NULL); + + /* Loop through all complex attached surfaces and destroy them. + * + * Yet again, only the root can have more than one complexly attached + * surface, all the others have a total of one. */ + for (i = 0; i < MAX_COMPLEX_ATTACHED; ++i) + { + if (!surface->complex_array[i]) + break; + + surf = surface->complex_array[i]; + surface->complex_array[i] = NULL; + while (surf) + { + IDirectDrawSurfaceImpl *destroy = surf; + surf = surf->complex_array[0]; /* Iterate through the "tree" */ + ddraw_surface_destroy(destroy); /* Destroy it */ } } - while(This->next_attached != NULL) - { - IDirectDrawSurface7 *root = (IDirectDrawSurface7 *)This; - IDirectDrawSurface7 *detach = (IDirectDrawSurface7 *)This->next_attached; + ifaceToRelease = surface->ifaceToRelease; - if(IDirectDrawSurface7_DeleteAttachedSurface(root, 0, detach) != DD_OK) - { - ERR("(%p) DeleteAttachedSurface failed!\n", This); - assert(0); - } - } + /* Destroy the root surface. */ + ddraw_surface_destroy(surface); - /* Now destroy the surface. Wait: It could have been released if we are a texture */ - if(This->WineD3DSurface) - IWineD3DSurface_Release(This->WineD3DSurface); - - /* Having a texture handle set implies that the device still exists */ - if(This->Handle) - { - ddraw_free_handle(&This->ddraw->d3ddevice->handle_table, This->Handle - 1, DDRAW_HANDLE_SURFACE); - } - - /* Reduce the ddraw surface count */ - InterlockedDecrement(&This->ddraw->surfaces); - list_remove(&This->surface_list_entry); - - HeapFree(GetProcessHeap(), 0, This); + /* Reduce the ddraw refcount */ + if (ifaceToRelease) + IUnknown_Release(ifaceToRelease); } /***************************************************************************** @@ -330,12 +381,6 @@ static ULONG WINAPI ddraw_surface7_Release(IDirectDrawSurface7 *iface) if (ref == 0) { - - IDirectDrawSurfaceImpl *surf; - IDirectDrawImpl *ddraw; - IUnknown *ifaceToRelease = This->ifaceToRelease; - UINT i; - /* Complex attached surfaces are destroyed implicitly when the root is released */ EnterCriticalSection(&ddraw_cs); if(!This->is_complex_root) @@ -344,101 +389,10 @@ static ULONG WINAPI ddraw_surface7_Release(IDirectDrawSurface7 *iface) LeaveCriticalSection(&ddraw_cs); return ref; } - ddraw = This->ddraw; - - /* If it's a texture, destroy the WineD3DTexture. - * WineD3D will destroy the IParent interfaces - * of the sublevels, which destroys the WineD3DSurfaces. - * Set the surfaces to NULL to avoid destroying them again later - */ - if(This->wineD3DTexture) - { - IWineD3DBaseTexture_Release(This->wineD3DTexture); - } - /* If it's the RenderTarget, destroy the d3ddevice */ - else if(This->wineD3DSwapChain) - { - if((ddraw->d3d_initialized) && (This == ddraw->d3d_target)) { - TRACE("(%p) Destroying the render target, uninitializing D3D\n", This); - - /* Unset any index buffer, just to be sure */ - IWineD3DDevice_SetIndexBuffer(ddraw->wineD3DDevice, NULL, WINED3DFMT_UNKNOWN); - IWineD3DDevice_SetDepthStencilSurface(ddraw->wineD3DDevice, NULL); - IWineD3DDevice_SetVertexDeclaration(ddraw->wineD3DDevice, NULL); - for(i = 0; i < ddraw->numConvertedDecls; i++) - { - IWineD3DVertexDeclaration_Release(ddraw->decls[i].decl); - } - HeapFree(GetProcessHeap(), 0, ddraw->decls); - ddraw->numConvertedDecls = 0; - - if (FAILED(IWineD3DDevice_Uninit3D(ddraw->wineD3DDevice, D3D7CB_DestroySwapChain))) - { - /* Not good */ - ERR("(%p) Failed to uninit 3D\n", This); - } - else - { - /* Free the d3d window if one was created */ - if(ddraw->d3d_window != 0 && ddraw->d3d_window != ddraw->dest_window) - { - TRACE(" (%p) Destroying the hidden render window %p\n", This, ddraw->d3d_window); - DestroyWindow(ddraw->d3d_window); - ddraw->d3d_window = 0; - } - /* Unset the pointers */ - } - - This->wineD3DSwapChain = NULL; /* Uninit3D releases the swapchain */ - ddraw->d3d_initialized = FALSE; - ddraw->d3d_target = NULL; - } else { - IWineD3DDevice_UninitGDI(ddraw->wineD3DDevice, D3D7CB_DestroySwapChain); - This->wineD3DSwapChain = NULL; - } - - /* Reset to the default surface implementation type. This is needed if apps use - * non render target surfaces and expect blits to work after destroying the render - * target. - * - * TODO: Recreate existing offscreen surfaces - */ - ddraw->ImplType = DefaultSurfaceType; - - /* Write a trace because D3D unloading was the reason for many - * crashes during development. - */ - TRACE("(%p) D3D unloaded\n", This); - } - - /* The refcount test shows that the palette is detached when the surface is destroyed */ - IDirectDrawSurface7_SetPalette((IDirectDrawSurface7 *)This, NULL); - - /* Loop through all complex attached surfaces, - * and destroy them. - * - * Yet again, only the root can have more than one complexly attached surface, all the others - * have a total of one; - */ - for(i = 0; i < MAX_COMPLEX_ATTACHED; i++) - { - if(!This->complex_array[i]) break; - - surf = This->complex_array[i]; - This->complex_array[i] = NULL; - while(surf) - { - IDirectDrawSurfaceImpl *destroy = surf; - surf = surf->complex_array[0]; /* Iterate through the "tree" */ - ddraw_surface_destroy(destroy); /* Destroy it */ - } - } - - /* Destroy the root surface. */ - ddraw_surface_destroy(This); - - /* Reduce the ddraw refcount */ - if(ifaceToRelease) IUnknown_Release(ifaceToRelease); + if (This->wined3d_texture) /* If it's a texture, destroy the wined3d texture. */ + wined3d_texture_decref(This->wined3d_texture); + else + ddraw_surface_cleanup(This); LeaveCriticalSection(&ddraw_cs); } @@ -679,11 +633,8 @@ static HRESULT WINAPI ddraw_surface7_Lock(IDirectDrawSurface7 *iface, } } - hr = IWineD3DSurface_LockRect(This->WineD3DSurface, - &LockedRect, - Rect, - Flags); - if(hr != D3D_OK) + hr = wined3d_surface_map(This->wined3d_surface, &LockedRect, Rect, Flags); + if (FAILED(hr)) { LeaveCriticalSection(&ddraw_cs); switch(hr) @@ -744,8 +695,8 @@ static HRESULT WINAPI ddraw_surface7_Unlock(IDirectDrawSurface7 *iface, RECT *pR TRACE("iface %p, rect %s.\n", iface, wine_dbgstr_rect(pRect)); EnterCriticalSection(&ddraw_cs); - hr = IWineD3DSurface_UnlockRect(This->WineD3DSurface); - if(SUCCEEDED(hr)) + hr = wined3d_surface_unmap(This->wined3d_surface); + if (SUCCEEDED(hr)) { This->surface_desc.lpSurface = NULL; } @@ -817,9 +768,7 @@ static HRESULT WINAPI ddraw_surface7_Flip(IDirectDrawSurface7 *iface, IDirectDra ddraw_surface7_Release(Override7); } - hr = IWineD3DSurface_Flip(This->WineD3DSurface, - Override->WineD3DSurface, - Flags); + hr = wined3d_surface_flip(This->wined3d_surface, Override->wined3d_surface, Flags); LeaveCriticalSection(&ddraw_cs); return hr; } @@ -856,7 +805,7 @@ static HRESULT WINAPI ddraw_surface7_Blt(IDirectDrawSurface7 *iface, RECT *DestR IDirectDrawSurfaceImpl *Src = (IDirectDrawSurfaceImpl *)SrcSurface; HRESULT hr; - TRACE("iface %p, dst_rect %s, src_surface %p, src_rect %p, flags %#x, fx %p.\n", + TRACE("iface %p, dst_rect %s, src_surface %p, src_rect %s, flags %#x, fx %p.\n", iface, wine_dbgstr_rect(DestRect), SrcSurface, wine_dbgstr_rect(SrcRect), Flags, DDBltFx); /* Check for validity of the flags here. WineD3D Has the software-opengl selection path and would have @@ -903,17 +852,12 @@ static HRESULT WINAPI ddraw_surface7_Blt(IDirectDrawSurface7 *iface, RECT *DestR return DDERR_INVALIDPARAMS; } - /* TODO: Check if the DDBltFx contains any ddraw surface pointers. If it does, copy the struct, - * and replace the ddraw surfaces with the wined3d surfaces - * So far no blitting operations using surfaces in the bltfx struct are supported anyway. - */ - hr = IWineD3DSurface_Blt(This->WineD3DSurface, - DestRect, - Src ? Src->WineD3DSurface : NULL, - SrcRect, - Flags, - (WINEDDBLTFX *) DDBltFx, - WINED3DTEXF_POINT); + /* TODO: Check if the DDBltFx contains any ddraw surface pointers. If it + * does, copy the struct, and replace the ddraw surfaces with the wined3d + * surfaces. So far no blitting operations using surfaces in the bltfx + * struct are supported anyway. */ + hr = wined3d_surface_blt(This->wined3d_surface, DestRect, Src ? Src->wined3d_surface : NULL, + SrcRect, Flags, (WINEDDBLTFX *)DDBltFx, WINED3DTEXF_LINEAR); LeaveCriticalSection(&ddraw_cs); switch(hr) @@ -927,7 +871,7 @@ static HRESULT WINAPI ddraw_surface7_Blt(IDirectDrawSurface7 *iface, RECT *DestR static HRESULT WINAPI ddraw_surface3_Blt(IDirectDrawSurface3 *iface, RECT *dst_rect, IDirectDrawSurface3 *src_surface, RECT *src_rect, DWORD flags, DDBLTFX *fx) { - TRACE("iface %p, dst_rect %s, src_surface %p, src_rect %p, flags %#x, fx %p.\n", + TRACE("iface %p, dst_rect %s, src_surface %p, src_rect %s, flags %#x, fx %p.\n", iface, wine_dbgstr_rect(dst_rect), src_surface, wine_dbgstr_rect(src_rect), flags, fx); return ddraw_surface7_Blt((IDirectDrawSurface7 *)surface_from_surface3(iface), dst_rect, @@ -1199,8 +1143,7 @@ static HRESULT WINAPI ddraw_surface7_GetDC(IDirectDrawSurface7 *iface, HDC *hdc) return DDERR_INVALIDPARAMS; EnterCriticalSection(&ddraw_cs); - hr = IWineD3DSurface_GetDC(This->WineD3DSurface, - hdc); + hr = wined3d_surface_getdc(This->wined3d_surface, hdc); LeaveCriticalSection(&ddraw_cs); switch(hr) { @@ -1243,7 +1186,7 @@ static HRESULT WINAPI ddraw_surface7_ReleaseDC(IDirectDrawSurface7 *iface, HDC h TRACE("iface %p, dc %p.\n", iface, hdc); EnterCriticalSection(&ddraw_cs); - hr = IWineD3DSurface_ReleaseDC(This->WineD3DSurface, hdc); + hr = wined3d_surface_releasedc(This->wined3d_surface, hdc); LeaveCriticalSection(&ddraw_cs); return hr; } @@ -1316,7 +1259,7 @@ static HRESULT WINAPI ddraw_surface7_SetPriority(IDirectDrawSurface7 *iface, DWO TRACE("iface %p, priority %u.\n", iface, Priority); EnterCriticalSection(&ddraw_cs); - hr = IWineD3DSurface_SetPriority(This->WineD3DSurface, Priority); + hr = wined3d_surface_set_priority(This->wined3d_surface, Priority); LeaveCriticalSection(&ddraw_cs); return hr; } @@ -1347,7 +1290,7 @@ static HRESULT WINAPI ddraw_surface7_GetPriority(IDirectDrawSurface7 *iface, DWO } EnterCriticalSection(&ddraw_cs); - *Priority = IWineD3DSurface_GetPriority(This->WineD3DSurface); + *Priority = wined3d_surface_get_priority(This->wined3d_surface); LeaveCriticalSection(&ddraw_cs); return DD_OK; } @@ -1379,11 +1322,7 @@ static HRESULT WINAPI ddraw_surface7_SetPrivateData(IDirectDrawSurface7 *iface, iface, debugstr_guid(tag), Data, Size, Flags); EnterCriticalSection(&ddraw_cs); - hr = IWineD3DSurface_SetPrivateData(This->WineD3DSurface, - tag, - Data, - Size, - Flags); + hr = wined3d_surface_set_private_data(This->wined3d_surface, tag, Data, Size, Flags); LeaveCriticalSection(&ddraw_cs); switch(hr) { @@ -1420,10 +1359,7 @@ static HRESULT WINAPI ddraw_surface7_GetPrivateData(IDirectDrawSurface7 *iface, return DDERR_INVALIDPARAMS; EnterCriticalSection(&ddraw_cs); - hr = IWineD3DSurface_GetPrivateData(This->WineD3DSurface, - tag, - Data, - Size); + hr = wined3d_surface_get_private_data(This->wined3d_surface, tag, Data, Size); LeaveCriticalSection(&ddraw_cs); return hr; } @@ -1449,7 +1385,7 @@ static HRESULT WINAPI ddraw_surface7_FreePrivateData(IDirectDrawSurface7 *iface, TRACE("iface %p, tag %s.\n", iface, debugstr_guid(tag)); EnterCriticalSection(&ddraw_cs); - hr = IWineD3DSurface_FreePrivateData(This->WineD3DSurface, tag); + hr = wined3d_surface_free_private_data(This->wined3d_surface, tag); LeaveCriticalSection(&ddraw_cs); return hr; } @@ -1680,7 +1616,7 @@ static HRESULT WINAPI ddraw_surface7_GetBltStatus(IDirectDrawSurface7 *iface, DW TRACE("iface %p, flags %#x.\n", iface, Flags); EnterCriticalSection(&ddraw_cs); - hr = IWineD3DSurface_GetBltStatus(This->WineD3DSurface, Flags); + hr = wined3d_surface_get_blt_status(This->wined3d_surface, Flags); LeaveCriticalSection(&ddraw_cs); switch(hr) { @@ -1795,7 +1731,7 @@ static HRESULT WINAPI ddraw_surface7_GetFlipStatus(IDirectDrawSurface7 *iface, D TRACE("iface %p, flags %#x.\n", iface, Flags); EnterCriticalSection(&ddraw_cs); - hr = IWineD3DSurface_GetFlipStatus(This->WineD3DSurface, Flags); + hr = wined3d_surface_get_flip_status(This->wined3d_surface, Flags); LeaveCriticalSection(&ddraw_cs); switch(hr) { @@ -1831,9 +1767,7 @@ static HRESULT WINAPI ddraw_surface7_GetOverlayPosition(IDirectDrawSurface7 *ifa TRACE("iface %p, x %p, y %p.\n", iface, X, Y); EnterCriticalSection(&ddraw_cs); - hr = IWineD3DSurface_GetOverlayPosition(This->WineD3DSurface, - X, - Y); + hr = wined3d_surface_get_overlay_position(This->wined3d_surface, X, Y); LeaveCriticalSection(&ddraw_cs); return hr; } @@ -2029,7 +1963,7 @@ static HRESULT WINAPI ddraw_surface7_IsLost(IDirectDrawSurface7 *iface) return DDERR_SURFACELOST; } - hr = IWineD3DSurface_IsLost(This->WineD3DSurface); + hr = wined3d_surface_is_lost(This->wined3d_surface); LeaveCriticalSection(&ddraw_cs); switch(hr) { @@ -2073,7 +2007,7 @@ static HRESULT WINAPI ddraw_surface7_Restore(IDirectDrawSurface7 *iface) IDirectDrawSurface_AddRef(iface); ddraw_recreate_surfaces_cb(iface, &This->surface_desc, NULL /* Not needed */); } - hr = IWineD3DSurface_Restore(This->WineD3DSurface); + hr = wined3d_surface_restore(This->wined3d_surface); LeaveCriticalSection(&ddraw_cs); return hr; } @@ -2105,9 +2039,7 @@ static HRESULT WINAPI ddraw_surface7_SetOverlayPosition(IDirectDrawSurface7 *ifa TRACE("iface %p, x %d, y %d.\n", iface, X, Y); EnterCriticalSection(&ddraw_cs); - hr = IWineD3DSurface_SetOverlayPosition(This->WineD3DSurface, - X, - Y); + hr = wined3d_surface_set_overlay_position(This->wined3d_surface, X, Y); LeaveCriticalSection(&ddraw_cs); return hr; } @@ -2145,12 +2077,8 @@ static HRESULT WINAPI ddraw_surface7_UpdateOverlay(IDirectDrawSurface7 *iface, R iface, wine_dbgstr_rect(SrcRect), DstSurface, wine_dbgstr_rect(DstRect), Flags, FX); EnterCriticalSection(&ddraw_cs); - hr = IWineD3DSurface_UpdateOverlay(This->WineD3DSurface, - SrcRect, - Dst ? Dst->WineD3DSurface : NULL, - DstRect, - Flags, - (WINEDDOVERLAYFX *) FX); + hr = wined3d_surface_update_overlay(This->wined3d_surface, SrcRect, + Dst ? Dst->wined3d_surface : NULL, DstRect, Flags, (WINEDDOVERLAYFX *)FX); LeaveCriticalSection(&ddraw_cs); switch(hr) { case WINED3DERR_INVALIDCALL: return DDERR_INVALIDPARAMS; @@ -2219,9 +2147,8 @@ static HRESULT WINAPI ddraw_surface7_UpdateOverlayZOrder(IDirectDrawSurface7 *if TRACE("iface %p, flags %#x, reference %p.\n", iface, Flags, DDSRef); EnterCriticalSection(&ddraw_cs); - hr = IWineD3DSurface_UpdateOverlayZOrder(This->WineD3DSurface, - Flags, - Ref ? Ref->WineD3DSurface : NULL); + hr = wined3d_surface_update_overlay_z_order(This->wined3d_surface, + Flags, Ref ? Ref->wined3d_surface : NULL); LeaveCriticalSection(&ddraw_cs); return hr; } @@ -2261,19 +2188,19 @@ static HRESULT WINAPI ddraw_surface7_GetDDInterface(IDirectDrawSurface7 *iface, switch(This->version) { case 7: - *DD = This->ddraw; + *DD = &This->ddraw->IDirectDraw7_iface; break; case 4: - *DD = &This->ddraw->IDirectDraw4_vtbl; + *DD = &This->ddraw->IDirectDraw4_iface; break; case 2: - *DD = &This->ddraw->IDirectDraw2_vtbl; + *DD = &This->ddraw->IDirectDraw2_iface; break; case 1: - *DD = &This->ddraw->IDirectDraw_vtbl; + *DD = &This->ddraw->IDirectDraw_iface; break; } @@ -2359,15 +2286,14 @@ static HRESULT WINAPI ddraw_surface7_SetLOD(IDirectDrawSurface7 *iface, DWORD Ma return DDERR_INVALIDOBJECT; } - if(!This->wineD3DTexture) + if (!This->wined3d_texture) { ERR("(%p) The DirectDraw texture has no WineD3DTexture!\n", This); LeaveCriticalSection(&ddraw_cs); return DDERR_INVALIDOBJECT; } - hr = IWineD3DBaseTexture_SetLOD(This->wineD3DTexture, - MaxLOD); + hr = wined3d_texture_set_lod(This->wined3d_texture, MaxLOD); LeaveCriticalSection(&ddraw_cs); return hr; } @@ -2402,7 +2328,7 @@ static HRESULT WINAPI ddraw_surface7_GetLOD(IDirectDrawSurface7 *iface, DWORD *M return DDERR_INVALIDOBJECT; } - *MaxLOD = IWineD3DBaseTexture_GetLOD(This->wineD3DTexture); + *MaxLOD = wined3d_texture_get_lod(This->wined3d_texture); LeaveCriticalSection(&ddraw_cs); return DD_OK; } @@ -2468,11 +2394,8 @@ static HRESULT WINAPI ddraw_surface7_BltFast(IDirectDrawSurface7 *iface, DWORD d } EnterCriticalSection(&ddraw_cs); - hr = IWineD3DSurface_BltFast(This->WineD3DSurface, - dstx, dsty, - src ? src->WineD3DSurface : NULL, - rsrc, - trans); + hr = wined3d_surface_bltfast(This->wined3d_surface, dstx, dsty, + src ? src->wined3d_surface : NULL, rsrc, trans); LeaveCriticalSection(&ddraw_cs); switch(hr) { @@ -2574,21 +2497,20 @@ static HRESULT WINAPI ddraw_surface7_SetClipper(IDirectDrawSurface7 *iface, IDir if(oldClipper) IDirectDrawClipper_Release((IDirectDrawClipper *)oldClipper); - hr = IWineD3DSurface_SetClipper(This->WineD3DSurface, This->clipper ? This->clipper->wineD3DClipper : NULL); + hr = wined3d_surface_set_clipper(This->wined3d_surface, + This->clipper ? This->clipper->wineD3DClipper : NULL); - if(This->wineD3DSwapChain) { + if (This->wined3d_swapchain) + { clipWindow = NULL; if(Clipper) { IDirectDrawClipper_GetHWnd(Clipper, &clipWindow); } - if(clipWindow) { - IWineD3DSwapChain_SetDestWindowOverride(This->wineD3DSwapChain, - clipWindow); - } else { - IWineD3DSwapChain_SetDestWindowOverride(This->wineD3DSwapChain, - This->ddraw->d3d_window); - } + if (clipWindow) + wined3d_swapchain_set_window(This->wined3d_swapchain, clipWindow); + else + wined3d_swapchain_set_window(This->wined3d_swapchain, This->ddraw->d3d_window); } LeaveCriticalSection(&ddraw_cs); @@ -2642,9 +2564,8 @@ static HRESULT WINAPI ddraw_surface7_SetSurfaceDesc(IDirectDrawSurface7 *iface, } if(newFormat != PixelFormat_DD2WineD3D(&This->surface_desc.u4.ddpfPixelFormat) ) { - hr = IWineD3DSurface_SetFormat(This->WineD3DSurface, - newFormat); - if(hr != DD_OK) + hr = wined3d_surface_set_format(This->wined3d_surface, newFormat); + if (FAILED(hr)) { LeaveCriticalSection(&ddraw_cs); return hr; @@ -2653,32 +2574,28 @@ static HRESULT WINAPI ddraw_surface7_SetSurfaceDesc(IDirectDrawSurface7 *iface, } if (DDSD->dwFlags & DDSD_CKDESTOVERLAY) { - IWineD3DSurface_SetColorKey(This->WineD3DSurface, - DDCKEY_DESTOVERLAY, - (WINEDDCOLORKEY *) &DDSD->u3.ddckCKDestOverlay); + wined3d_surface_set_color_key(This->wined3d_surface, DDCKEY_DESTOVERLAY, + (WINEDDCOLORKEY *)&DDSD->u3.ddckCKDestOverlay); } if (DDSD->dwFlags & DDSD_CKDESTBLT) { - IWineD3DSurface_SetColorKey(This->WineD3DSurface, - DDCKEY_DESTBLT, - (WINEDDCOLORKEY *) &DDSD->ddckCKDestBlt); + wined3d_surface_set_color_key(This->wined3d_surface, DDCKEY_DESTBLT, + (WINEDDCOLORKEY *)&DDSD->ddckCKDestBlt); } if (DDSD->dwFlags & DDSD_CKSRCOVERLAY) { - IWineD3DSurface_SetColorKey(This->WineD3DSurface, - DDCKEY_SRCOVERLAY, - (WINEDDCOLORKEY *) &DDSD->ddckCKSrcOverlay); + wined3d_surface_set_color_key(This->wined3d_surface, DDCKEY_SRCOVERLAY, + (WINEDDCOLORKEY *)&DDSD->ddckCKSrcOverlay); } if (DDSD->dwFlags & DDSD_CKSRCBLT) { - IWineD3DSurface_SetColorKey(This->WineD3DSurface, - DDCKEY_SRCBLT, - (WINEDDCOLORKEY *) &DDSD->ddckCKSrcBlt); + wined3d_surface_set_color_key(This->wined3d_surface, DDCKEY_SRCBLT, + (WINEDDCOLORKEY *)&DDSD->ddckCKSrcBlt); } if (DDSD->dwFlags & DDSD_LPSURFACE && DDSD->lpSurface) { - hr = IWineD3DSurface_SetMem(This->WineD3DSurface, DDSD->lpSurface); - if(hr != WINED3D_OK) + hr = wined3d_surface_set_mem(This->wined3d_surface, DDSD->lpSurface); + if (FAILED(hr)) { /* No need for a trace here, wined3d does that for us */ switch(hr) @@ -2724,8 +2641,8 @@ static HRESULT WINAPI ddraw_surface3_SetSurfaceDesc(IDirectDrawSurface3 *iface, static HRESULT WINAPI ddraw_surface7_GetPalette(IDirectDrawSurface7 *iface, IDirectDrawPalette **Pal) { IDirectDrawSurfaceImpl *This = (IDirectDrawSurfaceImpl *)iface; - IWineD3DPalette *wPal; - HRESULT hr; + struct wined3d_palette *wined3d_palette; + HRESULT hr = DD_OK; TRACE("iface %p, palette %p.\n", iface, Pal); @@ -2733,16 +2650,10 @@ static HRESULT WINAPI ddraw_surface7_GetPalette(IDirectDrawSurface7 *iface, IDir return DDERR_INVALIDPARAMS; EnterCriticalSection(&ddraw_cs); - hr = IWineD3DSurface_GetPalette(This->WineD3DSurface, &wPal); - if(hr != DD_OK) + wined3d_palette = wined3d_surface_get_palette(This->wined3d_surface); + if (wined3d_palette) { - LeaveCriticalSection(&ddraw_cs); - return hr; - } - - if(wPal) - { - *Pal = IWineD3DPalette_GetParent(wPal); + *Pal = wined3d_palette_get_parent(wined3d_palette); IDirectDrawPalette_AddRef(*Pal); } else @@ -2785,10 +2696,8 @@ SetColorKeyEnum(IDirectDrawSurface7 *surface, struct SCKContext *ctx = context; HRESULT hr; - hr = IWineD3DSurface_SetColorKey(This->WineD3DSurface, - ctx->Flags, - ctx->CKey); - if(hr != DD_OK) + hr = wined3d_surface_set_color_key(This->wined3d_surface, ctx->Flags, ctx->CKey); + if (FAILED(hr)) { WARN("IWineD3DSurface_SetColorKey failed, hr = %08x\n", hr); ctx->ret = hr; @@ -2884,7 +2793,7 @@ static HRESULT WINAPI ddraw_surface7_SetColorKey(IDirectDrawSurface7 *iface, DWO return DDERR_INVALIDPARAMS; } } - ctx.ret = IWineD3DSurface_SetColorKey(This->WineD3DSurface, Flags, ctx.CKey); + ctx.ret = wined3d_surface_set_color_key(This->wined3d_surface, Flags, ctx.CKey); ddraw_surface7_EnumAttachedSurfaces(iface, &ctx, SetColorKeyEnum); LeaveCriticalSection(&ddraw_cs); switch(ctx.ret) @@ -2939,8 +2848,7 @@ static HRESULT WINAPI ddraw_surface7_SetPalette(IDirectDrawSurface7 *iface, IDir if(oldPal) IDirectDrawPalette_Release(oldPal); /* For the GetPalette */ /* Set the new Palette */ - IWineD3DSurface_SetPalette(This->WineD3DSurface, - PalImpl ? PalImpl->wineD3DPalette : NULL); + wined3d_surface_set_palette(This->wined3d_surface, PalImpl ? PalImpl->wineD3DPalette : NULL); /* AddRef the Palette */ if(Pal) IDirectDrawPalette_AddRef(Pal); @@ -3015,7 +2923,7 @@ static HRESULT WINAPI ddraw_gamma_control_GetGammaRamp(IDirectDrawGammaControl * if (surface->surface_desc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE) { /* Note: DDGAMMARAMP is compatible with WINED3DGAMMARAMP. */ - IWineD3DDevice_GetGammaRamp(surface->ddraw->wineD3DDevice, 0, (WINED3DGAMMARAMP *)gamma_ramp); + wined3d_device_get_gamma_ramp(surface->ddraw->wined3d_device, 0, (WINED3DGAMMARAMP *)gamma_ramp); } else { @@ -3057,7 +2965,7 @@ static HRESULT WINAPI ddraw_gamma_control_SetGammaRamp(IDirectDrawGammaControl * if (surface->surface_desc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE) { /* Note: DDGAMMARAMP is compatible with WINED3DGAMMARAMP */ - IWineD3DDevice_SetGammaRamp(surface->ddraw->wineD3DDevice, 0, flags, (WINED3DGAMMARAMP *)gamma_ramp); + wined3d_device_set_gamma_ramp(surface->ddraw->wined3d_device, 0, flags, (WINED3DGAMMARAMP *)gamma_ramp); } else { @@ -3234,7 +3142,7 @@ static HRESULT WINAPI d3d_texture2_Load(IDirect3DTexture2 *iface, IDirect3DTextu for (;;) { - IWineD3DPalette *wined3d_dst_pal, *wined3d_src_pal; + struct wined3d_palette *wined3d_dst_pal, *wined3d_src_pal; IDirectDrawPalette *dst_pal = NULL, *src_pal = NULL; DDSURFACEDESC *src_desc, *dst_desc; @@ -3245,23 +3153,13 @@ static HRESULT WINAPI d3d_texture2_Load(IDirect3DTexture2 *iface, IDirect3DTextu dst_surface->surface_desc.ddsCaps.dwCaps &= ~DDSCAPS_ALLOCONLOAD; /* Get the palettes */ - hr = IWineD3DSurface_GetPalette(dst_surface->WineD3DSurface, &wined3d_dst_pal); - if (FAILED(hr)) - { - ERR("Failed to get destination palette, hr %#x.\n", hr); - LeaveCriticalSection(&ddraw_cs); - return D3DERR_TEXTURE_LOAD_FAILED; - } - if (wined3d_dst_pal) dst_pal = IWineD3DPalette_GetParent(wined3d_dst_pal); + wined3d_dst_pal = wined3d_surface_get_palette(dst_surface->wined3d_surface); + if (wined3d_dst_pal) + dst_pal = wined3d_palette_get_parent(wined3d_dst_pal); - hr = IWineD3DSurface_GetPalette(src_surface->WineD3DSurface, &wined3d_src_pal); - if (FAILED(hr)) - { - ERR("Failed to get source palette, hr %#x.\n", hr); - LeaveCriticalSection(&ddraw_cs); - return D3DERR_TEXTURE_LOAD_FAILED; - } - if (wined3d_src_pal) src_pal = IWineD3DPalette_GetParent(wined3d_src_pal); + wined3d_src_pal = wined3d_surface_get_palette(src_surface->wined3d_surface); + if (wined3d_src_pal) + src_pal = wined3d_palette_get_parent(wined3d_src_pal); if (src_pal) { @@ -3302,7 +3200,7 @@ static HRESULT WINAPI d3d_texture2_Load(IDirect3DTexture2 *iface, IDirect3DTextu /* Copy the main memory texture into the surface that corresponds * to the OpenGL texture object. */ - hr = IWineD3DSurface_LockRect(src_surface->WineD3DSurface, &src_rect, NULL, 0); + hr = wined3d_surface_map(src_surface->wined3d_surface, &src_rect, NULL, 0); if (FAILED(hr)) { ERR("Failed to lock source surface, hr %#x.\n", hr); @@ -3310,11 +3208,11 @@ static HRESULT WINAPI d3d_texture2_Load(IDirect3DTexture2 *iface, IDirect3DTextu return D3DERR_TEXTURE_LOAD_FAILED; } - hr = IWineD3DSurface_LockRect(dst_surface->WineD3DSurface, &dst_rect, NULL, 0); + hr = wined3d_surface_map(dst_surface->wined3d_surface, &dst_rect, NULL, 0); if (FAILED(hr)) { ERR("Failed to lock destination surface, hr %#x.\n", hr); - IWineD3DSurface_UnlockRect(src_surface->WineD3DSurface); + wined3d_surface_unmap(src_surface->wined3d_surface); LeaveCriticalSection(&ddraw_cs); return D3DERR_TEXTURE_LOAD_FAILED; } @@ -3324,8 +3222,8 @@ static HRESULT WINAPI d3d_texture2_Load(IDirect3DTexture2 *iface, IDirect3DTextu else memcpy(dst_rect.pBits, src_rect.pBits, src_rect.Pitch * src_desc->dwHeight); - IWineD3DSurface_UnlockRect(src_surface->WineD3DSurface); - IWineD3DSurface_UnlockRect(dst_surface->WineD3DSurface); + wined3d_surface_unmap(src_surface->wined3d_surface); + wined3d_surface_unmap(dst_surface->wined3d_surface); } if (src_surface->surface_desc.ddsCaps.dwCaps & DDSCAPS_MIPMAP) @@ -3501,11 +3399,103 @@ static const struct IDirect3DTextureVtbl d3d_texture1_vtbl = d3d_texture1_Unload, }; +static void STDMETHODCALLTYPE ddraw_surface_wined3d_object_destroyed(void *parent) +{ + IDirectDrawSurfaceImpl *surface = parent; + + TRACE("surface %p.\n", surface); + + /* Check for attached surfaces and detach them. */ + if (surface->first_attached != surface) + { + IDirectDrawSurface7 *root = (IDirectDrawSurface7 *)surface->first_attached; + IDirectDrawSurface7 *detach = (IDirectDrawSurface7 *)surface; + + /* Well, this shouldn't happen: The surface being attached is + * referenced in AddAttachedSurface(), so it shouldn't be released + * until DeleteAttachedSurface() is called, because the refcount is + * held. It looks like the application released it often enough to + * force this. */ + WARN("Surface is still attached to surface %p.\n", surface->first_attached); + + /* The refcount will drop to -1 here */ + if (FAILED(IDirectDrawSurface7_DeleteAttachedSurface(root, 0, detach))) + ERR("DeleteAttachedSurface failed.\n"); + } + + while (surface->next_attached) + { + IDirectDrawSurface7 *root = (IDirectDrawSurface7 *)surface; + IDirectDrawSurface7 *detach = (IDirectDrawSurface7 *)surface->next_attached; + + if (FAILED(IDirectDrawSurface7_DeleteAttachedSurface(root, 0, detach))) + ERR("DeleteAttachedSurface failed.\n"); + } + + /* Having a texture handle set implies that the device still exists. */ + if (surface->Handle) + ddraw_free_handle(&surface->ddraw->d3ddevice->handle_table, surface->Handle - 1, DDRAW_HANDLE_SURFACE); + + /* Reduce the ddraw surface count. */ + InterlockedDecrement(&surface->ddraw->surfaces); + list_remove(&surface->surface_list_entry); + + HeapFree(GetProcessHeap(), 0, surface); +} + +const struct wined3d_parent_ops ddraw_surface_wined3d_parent_ops = +{ + ddraw_surface_wined3d_object_destroyed, +}; + +static void STDMETHODCALLTYPE ddraw_texture_wined3d_object_destroyed(void *parent) +{ + IDirectDrawSurfaceImpl *surface = parent; + + TRACE("surface %p.\n", surface); + + ddraw_surface_cleanup(surface); +} + +static const struct wined3d_parent_ops ddraw_texture_wined3d_parent_ops = +{ + ddraw_texture_wined3d_object_destroyed, +}; + +HRESULT ddraw_surface_create_texture(IDirectDrawSurfaceImpl *surface) +{ + const DDSURFACEDESC2 *desc = &surface->surface_desc; + enum wined3d_format_id format; + WINED3DPOOL pool; + UINT levels; + + if (desc->ddsCaps.dwCaps & DDSCAPS_MIPMAP) + levels = desc->u2.dwMipMapCount; + else + levels = 1; + + /* DDSCAPS_SYSTEMMEMORY textures are in WINED3DPOOL_SYSTEMMEM. + * Should I forward the MANAGED cap to the managed pool? */ + if (desc->ddsCaps.dwCaps & DDSCAPS_SYSTEMMEMORY) + pool = WINED3DPOOL_SYSTEMMEM; + else + pool = WINED3DPOOL_DEFAULT; + + format = PixelFormat_DD2WineD3D(&surface->surface_desc.u4.ddpfPixelFormat); + if (desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP) + return wined3d_texture_create_cube(surface->ddraw->wined3d_device, desc->dwWidth, + levels, 0, format, pool, surface, &ddraw_texture_wined3d_parent_ops, &surface->wined3d_texture); + else + return wined3d_texture_create_2d(surface->ddraw->wined3d_device, desc->dwWidth, desc->dwHeight, + levels, 0, format, pool, surface, &ddraw_texture_wined3d_parent_ops, &surface->wined3d_texture); +} + HRESULT ddraw_surface_init(IDirectDrawSurfaceImpl *surface, IDirectDrawImpl *ddraw, DDSURFACEDESC2 *desc, UINT mip_level, WINED3DSURFTYPE surface_type) { + struct wined3d_resource_desc wined3d_desc; + struct wined3d_resource *wined3d_resource; WINED3DPOOL pool = WINED3DPOOL_DEFAULT; - WINED3DSURFACE_DESC wined3d_desc; enum wined3d_format_id format; DWORD usage = 0; HRESULT hr; @@ -3519,12 +3509,17 @@ HRESULT ddraw_surface_init(IDirectDrawSurfaceImpl *surface, IDirectDrawImpl *ddr desc->ddsCaps.dwCaps |= DDSCAPS_LOCALVIDMEM | DDSCAPS_VIDEOMEMORY; } - if (desc->ddsCaps.dwCaps & (DDSCAPS_PRIMARYSURFACE | DDSCAPS_3DDEVICE)) + if (desc->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE) { usage |= WINED3DUSAGE_RENDERTARGET; desc->ddsCaps.dwCaps |= DDSCAPS_VISIBLE; } + if ((desc->ddsCaps.dwCaps & DDSCAPS_3DDEVICE) && !(desc->ddsCaps.dwCaps & DDSCAPS_ZBUFFER)) + { + usage |= WINED3DUSAGE_RENDERTARGET; + } + if (desc->ddsCaps.dwCaps & (DDSCAPS_OVERLAY)) { usage |= WINED3DUSAGE_OVERLAY; @@ -3570,17 +3565,15 @@ HRESULT ddraw_surface_init(IDirectDrawSurfaceImpl *surface, IDirectDrawImpl *ddr surface->version = 7; surface->ddraw = ddraw; - surface->surface_desc.dwSize = sizeof(DDSURFACEDESC2); - surface->surface_desc.u4.ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT); - DD_STRUCT_COPY_BYSIZE(&surface->surface_desc, desc); + copy_to_surfacedesc2(&surface->surface_desc, desc); surface->first_attached = surface; surface->ImplType = surface_type; - hr = IWineD3DDevice_CreateSurface(ddraw->wineD3DDevice, desc->dwWidth, desc->dwHeight, format, + hr = wined3d_surface_create(ddraw->wined3d_device, desc->dwWidth, desc->dwHeight, format, TRUE /* Lockable */, FALSE /* Discard */, mip_level, usage, pool, WINED3DMULTISAMPLE_NONE, 0 /* MultiSampleQuality */, surface_type, surface, - &ddraw_null_wined3d_parent_ops, &surface->WineD3DSurface); + &ddraw_surface_wined3d_parent_ops, &surface->wined3d_surface); if (FAILED(hr)) { WARN("Failed to create wined3d surface, hr %#x.\n", hr); @@ -3588,7 +3581,8 @@ HRESULT ddraw_surface_init(IDirectDrawSurfaceImpl *surface, IDirectDrawImpl *ddr } surface->surface_desc.dwFlags |= DDSD_PIXELFORMAT; - IWineD3DSurface_GetDesc(surface->WineD3DSurface, &wined3d_desc); + wined3d_resource = wined3d_surface_get_resource(surface->wined3d_surface); + wined3d_resource_get_desc(wined3d_resource, &wined3d_desc); format = wined3d_desc.format; if (format == WINED3DFMT_UNKNOWN) @@ -3615,36 +3609,36 @@ HRESULT ddraw_surface_init(IDirectDrawSurfaceImpl *surface, IDirectDrawImpl *ddr else { surface->surface_desc.dwFlags |= DDSD_PITCH; - surface->surface_desc.u1.lPitch = IWineD3DSurface_GetPitch(surface->WineD3DSurface); + surface->surface_desc.u1.lPitch = wined3d_surface_get_pitch(surface->wined3d_surface); } if (desc->dwFlags & DDSD_CKDESTOVERLAY) { - IWineD3DSurface_SetColorKey(surface->WineD3DSurface, - DDCKEY_DESTOVERLAY, (WINEDDCOLORKEY *)&desc->u3.ddckCKDestOverlay); + wined3d_surface_set_color_key(surface->wined3d_surface, DDCKEY_DESTOVERLAY, + (WINEDDCOLORKEY *)&desc->u3.ddckCKDestOverlay); } if (desc->dwFlags & DDSD_CKDESTBLT) { - IWineD3DSurface_SetColorKey(surface->WineD3DSurface, - DDCKEY_DESTBLT, (WINEDDCOLORKEY *)&desc->ddckCKDestBlt); + wined3d_surface_set_color_key(surface->wined3d_surface, DDCKEY_DESTBLT, + (WINEDDCOLORKEY *)&desc->ddckCKDestBlt); } if (desc->dwFlags & DDSD_CKSRCOVERLAY) { - IWineD3DSurface_SetColorKey(surface->WineD3DSurface, - DDCKEY_SRCOVERLAY, (WINEDDCOLORKEY *)&desc->ddckCKSrcOverlay); + wined3d_surface_set_color_key(surface->wined3d_surface, DDCKEY_SRCOVERLAY, + (WINEDDCOLORKEY *)&desc->ddckCKSrcOverlay); } if (desc->dwFlags & DDSD_CKSRCBLT) { - IWineD3DSurface_SetColorKey(surface->WineD3DSurface, - DDCKEY_SRCBLT, (WINEDDCOLORKEY *)&desc->ddckCKSrcBlt); + wined3d_surface_set_color_key(surface->wined3d_surface, DDCKEY_SRCBLT, + (WINEDDCOLORKEY *)&desc->ddckCKSrcBlt); } if (desc->dwFlags & DDSD_LPSURFACE) { - hr = IWineD3DSurface_SetMem(surface->WineD3DSurface, desc->lpSurface); + hr = wined3d_surface_set_mem(surface->wined3d_surface, desc->lpSurface); if (FAILED(hr)) { ERR("Failed to set surface memory, hr %#x.\n", hr); - IWineD3DSurface_Release(surface->WineD3DSurface); + wined3d_surface_decref(surface->wined3d_surface); return hr; } } diff --git a/dll/directx/wine/ddraw/utils.c b/dll/directx/wine/ddraw/utils.c index 039a3a05776..62e4b43ba90 100644 --- a/dll/directx/wine/ddraw/utils.c +++ b/dll/directx/wine/ddraw/utils.c @@ -1172,30 +1172,6 @@ multiply_matrix(D3DMATRIX *dest, memcpy(dest, &temp, 16 * sizeof(D3DVALUE)); } -void multiply_matrix_D3D_way(D3DMATRIX* result, const D3DMATRIX *m1, const D3DMATRIX *m2) -{ - D3DMATRIX temp; - - temp._11 = m1->_11 * m2->_11 + m1->_12 * m2->_21 + m1->_13 * m2->_31 + m1->_14 * m2->_41; - temp._12 = m1->_11 * m2->_12 + m1->_12 * m2->_22 + m1->_13 * m2->_32 + m1->_14 * m2->_42; - temp._13 = m1->_11 * m2->_13 + m1->_12 * m2->_23 + m1->_13 * m2->_33 + m1->_14 * m2->_43; - temp._14 = m1->_11 * m2->_14 + m1->_12 * m2->_24 + m1->_13 * m2->_34 + m1->_14 * m2->_44; - temp._21 = m1->_21 * m2->_11 + m1->_22 * m2->_21 + m1->_23 * m2->_31 + m1->_24 * m2->_41; - temp._22 = m1->_21 * m2->_12 + m1->_22 * m2->_22 + m1->_23 * m2->_32 + m1->_24 * m2->_42; - temp._23 = m1->_21 * m2->_13 + m1->_22 * m2->_23 + m1->_23 * m2->_33 + m1->_24 * m2->_43; - temp._24 = m1->_21 * m2->_14 + m1->_22 * m2->_24 + m1->_23 * m2->_34 + m1->_24 * m2->_44; - temp._31 = m1->_31 * m2->_11 + m1->_32 * m2->_21 + m1->_33 * m2->_31 + m1->_34 * m2->_41; - temp._32 = m1->_31 * m2->_12 + m1->_32 * m2->_22 + m1->_33 * m2->_32 + m1->_34 * m2->_42; - temp._33 = m1->_31 * m2->_13 + m1->_32 * m2->_23 + m1->_33 * m2->_33 + m1->_34 * m2->_43; - temp._34 = m1->_31 * m2->_14 + m1->_32 * m2->_24 + m1->_33 * m2->_34 + m1->_34 * m2->_44; - temp._41 = m1->_41 * m2->_11 + m1->_42 * m2->_21 + m1->_43 * m2->_31 + m1->_44 * m2->_41; - temp._42 = m1->_41 * m2->_12 + m1->_42 * m2->_22 + m1->_43 * m2->_32 + m1->_44 * m2->_42; - temp._43 = m1->_41 * m2->_13 + m1->_42 * m2->_23 + m1->_43 * m2->_33 + m1->_44 * m2->_43; - temp._44 = m1->_41 * m2->_14 + m1->_42 * m2->_24 + m1->_43 * m2->_34 + m1->_44 * m2->_44; - - *result = temp; -} - HRESULT hr_ddraw_from_wined3d(HRESULT hr) { diff --git a/dll/directx/wine/ddraw/vertexbuffer.c b/dll/directx/wine/ddraw/vertexbuffer.c index 36087f280f7..af4e8bcab84 100644 --- a/dll/directx/wine/ddraw/vertexbuffer.c +++ b/dll/directx/wine/ddraw/vertexbuffer.c @@ -82,10 +82,8 @@ IDirect3DVertexBufferImpl_QueryInterface(IDirect3DVertexBuffer7 *iface, return E_NOINTERFACE; } -static HRESULT WINAPI -Thunk_IDirect3DVertexBufferImpl_1_QueryInterface(IDirect3DVertexBuffer *iface, - REFIID riid, - void **obj) +static HRESULT WINAPI IDirect3DVertexBufferImpl_1_QueryInterface(IDirect3DVertexBuffer *iface, + REFIID riid, void **obj) { TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), obj); @@ -112,8 +110,7 @@ IDirect3DVertexBufferImpl_AddRef(IDirect3DVertexBuffer7 *iface) return ref; } -static ULONG WINAPI -Thunk_IDirect3DVertexBufferImpl_1_AddRef(IDirect3DVertexBuffer *iface) +static ULONG WINAPI IDirect3DVertexBufferImpl_1_AddRef(IDirect3DVertexBuffer *iface) { TRACE("iface %p.\n", iface); @@ -140,34 +137,23 @@ IDirect3DVertexBufferImpl_Release(IDirect3DVertexBuffer7 *iface) if (ref == 0) { - IWineD3DBuffer *curVB = NULL; + struct wined3d_buffer *curVB = NULL; UINT offset, stride; EnterCriticalSection(&ddraw_cs); - /* D3D7 Vertex buffers don't stay bound in the device, they are passed as a parameter - * to drawPrimitiveVB. DrawPrimitiveVB sets them as the stream source in wined3d, - * and they should get unset there before they are destroyed - */ - IWineD3DDevice_GetStreamSource(This->ddraw->wineD3DDevice, - 0 /* Stream number */, - &curVB, - &offset, - &stride); - if(curVB == This->wineD3DVertexBuffer) - { - IWineD3DDevice_SetStreamSource(This->ddraw->wineD3DDevice, - 0 /* Steam number */, - NULL /* stream data */, - 0 /* Offset */, - 0 /* stride */); - } - if(curVB) - { - IWineD3DBuffer_Release(curVB); /* For the GetStreamSource */ - } + /* D3D7 Vertex buffers don't stay bound in the device, they are passed + * as a parameter to drawPrimitiveVB. DrawPrimitiveVB sets them as the + * stream source in wined3d, and they should get unset there before + * they are destroyed. */ + wined3d_device_get_stream_source(This->ddraw->wined3d_device, + 0, &curVB, &offset, &stride); + if (curVB == This->wineD3DVertexBuffer) + wined3d_device_set_stream_source(This->ddraw->wined3d_device, 0, NULL, 0, 0); + if (curVB) + wined3d_buffer_decref(curVB); /* For the GetStreamSource */ - IWineD3DVertexDeclaration_Release(This->wineD3DVertexDeclaration); - IWineD3DBuffer_Release(This->wineD3DVertexBuffer); + wined3d_vertex_declaration_decref(This->wineD3DVertexDeclaration); + wined3d_buffer_decref(This->wineD3DVertexBuffer); LeaveCriticalSection(&ddraw_cs); HeapFree(GetProcessHeap(), 0, This); @@ -176,8 +162,7 @@ IDirect3DVertexBufferImpl_Release(IDirect3DVertexBuffer7 *iface) return ref; } -static ULONG WINAPI -Thunk_IDirect3DVertexBufferImpl_1_Release(IDirect3DVertexBuffer *iface) +static ULONG WINAPI IDirect3DVertexBufferImpl_1_Release(IDirect3DVertexBuffer *iface) { TRACE("iface %p.\n", iface); @@ -214,7 +199,8 @@ IDirect3DVertexBufferImpl_Lock(IDirect3DVertexBuffer7 *iface, DWORD *Size) { IDirect3DVertexBufferImpl *This = (IDirect3DVertexBufferImpl *)iface; - WINED3DBUFFER_DESC Desc; + struct wined3d_resource_desc wined3d_desc; + struct wined3d_resource *wined3d_resource; HRESULT hr; DWORD wined3d_flags = 0; @@ -232,21 +218,18 @@ IDirect3DVertexBufferImpl_Lock(IDirect3DVertexBuffer7 *iface, if(Size) { /* Get the size, for returning it, and for locking */ - IWineD3DBuffer_GetDesc(This->wineD3DVertexBuffer, &Desc); - *Size = Desc.Size; + wined3d_resource = wined3d_buffer_get_resource(This->wineD3DVertexBuffer); + wined3d_resource_get_desc(wined3d_resource, &wined3d_desc); + *Size = wined3d_desc.size; } - hr = IWineD3DBuffer_Map(This->wineD3DVertexBuffer, 0 /* OffsetToLock */, - 0 /* SizeToLock, 0 == Full lock */, (BYTE **)Data, wined3d_flags); + hr = wined3d_buffer_map(This->wineD3DVertexBuffer, 0, 0, (BYTE **)Data, wined3d_flags); LeaveCriticalSection(&ddraw_cs); return hr; } -static HRESULT WINAPI -Thunk_IDirect3DVertexBufferImpl_1_Lock(IDirect3DVertexBuffer *iface, - DWORD Flags, - void **Data, - DWORD *Size) +static HRESULT WINAPI IDirect3DVertexBufferImpl_1_Lock(IDirect3DVertexBuffer *iface, DWORD Flags, + void **Data, DWORD *Size) { TRACE("iface %p, flags %#x, data %p, data_size %p.\n", iface, Flags, Data, Size); @@ -266,19 +249,17 @@ static HRESULT WINAPI IDirect3DVertexBufferImpl_Unlock(IDirect3DVertexBuffer7 *iface) { IDirect3DVertexBufferImpl *This = (IDirect3DVertexBufferImpl *)iface; - HRESULT hr; TRACE("iface %p.\n", iface); EnterCriticalSection(&ddraw_cs); - hr = IWineD3DBuffer_Unmap(This->wineD3DVertexBuffer); + wined3d_buffer_unmap(This->wineD3DVertexBuffer); LeaveCriticalSection(&ddraw_cs); - return hr; + return D3D_OK; } -static HRESULT WINAPI -Thunk_IDirect3DVertexBufferImpl_1_Unlock(IDirect3DVertexBuffer *iface) +static HRESULT WINAPI IDirect3DVertexBufferImpl_1_Unlock(IDirect3DVertexBuffer *iface) { TRACE("iface %p.\n", iface); @@ -345,50 +326,26 @@ IDirect3DVertexBufferImpl_ProcessVertices(IDirect3DVertexBuffer7 *iface, * the vertex ops */ doClip = VertexOp & D3DVOP_CLIP ? TRUE : FALSE; - IWineD3DDevice_GetRenderState(D3D->wineD3DDevice, - WINED3DRS_CLIPPING, - (DWORD *) &oldClip); - if(doClip != oldClip) - { - IWineD3DDevice_SetRenderState(D3D->wineD3DDevice, - WINED3DRS_CLIPPING, - doClip); - } + wined3d_device_get_render_state(D3D->wined3d_device, WINED3DRS_CLIPPING, (DWORD *)&oldClip); + if (doClip != oldClip) + wined3d_device_set_render_state(D3D->wined3d_device, WINED3DRS_CLIPPING, doClip); - IWineD3DDevice_SetStreamSource(D3D->wineD3DDevice, - 0, /* Stream No */ - Src->wineD3DVertexBuffer, - 0, /* Offset */ - get_flexible_vertex_size(Src->fvf)); - IWineD3DDevice_SetVertexDeclaration(D3D->wineD3DDevice, - Src->wineD3DVertexDeclaration); - hr = IWineD3DDevice_ProcessVertices(D3D->wineD3DDevice, - SrcIndex, - DestIndex, - Count, - This->wineD3DVertexBuffer, - NULL /* Output vdecl */, - Flags, - This->fvf); + wined3d_device_set_stream_source(D3D->wined3d_device, + 0, Src->wineD3DVertexBuffer, 0, get_flexible_vertex_size(Src->fvf)); + wined3d_device_set_vertex_declaration(D3D->wined3d_device, Src->wineD3DVertexDeclaration); + hr = wined3d_device_process_vertices(D3D->wined3d_device, SrcIndex, DestIndex, + Count, This->wineD3DVertexBuffer, NULL, Flags, This->fvf); /* Restore the states if needed */ - if(doClip != oldClip) - IWineD3DDevice_SetRenderState(D3D->wineD3DDevice, - WINED3DRS_CLIPPING, - oldClip); + if (doClip != oldClip) + wined3d_device_set_render_state(D3D->wined3d_device, WINED3DRS_CLIPPING, oldClip); LeaveCriticalSection(&ddraw_cs); return hr; } -static HRESULT WINAPI -Thunk_IDirect3DVertexBufferImpl_1_ProcessVertices(IDirect3DVertexBuffer *iface, - DWORD VertexOp, - DWORD DestIndex, - DWORD Count, - IDirect3DVertexBuffer *SrcBuffer, - DWORD SrcIndex, - IDirect3DDevice3 *D3DDevice, - DWORD Flags) +static HRESULT WINAPI IDirect3DVertexBufferImpl_1_ProcessVertices(IDirect3DVertexBuffer *iface, + DWORD VertexOp, DWORD DestIndex, DWORD Count, IDirect3DVertexBuffer *SrcBuffer, + DWORD SrcIndex, IDirect3DDevice3 *D3DDevice, DWORD Flags) { IDirect3DVertexBufferImpl *Src = SrcBuffer ? vb_from_vb1(SrcBuffer) : NULL; IDirect3DDeviceImpl *D3D = D3DDevice ? device_from_device3(D3DDevice) : NULL; @@ -418,27 +375,28 @@ IDirect3DVertexBufferImpl_GetVertexBufferDesc(IDirect3DVertexBuffer7 *iface, D3DVERTEXBUFFERDESC *Desc) { IDirect3DVertexBufferImpl *This = (IDirect3DVertexBufferImpl *)iface; - WINED3DBUFFER_DESC WDesc; + struct wined3d_resource_desc wined3d_desc; + struct wined3d_resource *wined3d_resource; TRACE("iface %p, desc %p.\n", iface, Desc); if(!Desc) return DDERR_INVALIDPARAMS; EnterCriticalSection(&ddraw_cs); - IWineD3DBuffer_GetDesc(This->wineD3DVertexBuffer, &WDesc); + wined3d_resource = wined3d_buffer_get_resource(This->wineD3DVertexBuffer); + wined3d_resource_get_desc(wined3d_resource, &wined3d_desc); LeaveCriticalSection(&ddraw_cs); /* Now fill the Desc structure */ Desc->dwCaps = This->Caps; Desc->dwFVF = This->fvf; - Desc->dwNumVertices = WDesc.Size / get_flexible_vertex_size(This->fvf); + Desc->dwNumVertices = wined3d_desc.size / get_flexible_vertex_size(This->fvf); return D3D_OK; } -static HRESULT WINAPI -Thunk_IDirect3DVertexBufferImpl_1_GetVertexBufferDesc(IDirect3DVertexBuffer *iface, - D3DVERTEXBUFFERDESC *Desc) +static HRESULT WINAPI IDirect3DVertexBufferImpl_1_GetVertexBufferDesc(IDirect3DVertexBuffer *iface, + D3DVERTEXBUFFERDESC *Desc) { TRACE("iface %p, desc %p.\n", iface, Desc); @@ -485,10 +443,8 @@ IDirect3DVertexBufferImpl_Optimize(IDirect3DVertexBuffer7 *iface, return DD_OK; } -static HRESULT WINAPI -Thunk_IDirect3DVertexBufferImpl_1_Optimize(IDirect3DVertexBuffer *iface, - IDirect3DDevice3 *D3DDevice, - DWORD Flags) +static HRESULT WINAPI IDirect3DVertexBufferImpl_1_Optimize(IDirect3DVertexBuffer *iface, + IDirect3DDevice3 *D3DDevice, DWORD Flags) { IDirect3DDeviceImpl *D3D = D3DDevice ? device_from_device3(D3DDevice) : NULL; @@ -559,15 +515,15 @@ static const struct IDirect3DVertexBuffer7Vtbl d3d_vertex_buffer7_vtbl = static const struct IDirect3DVertexBufferVtbl d3d_vertex_buffer1_vtbl = { /*** IUnknown Methods ***/ - Thunk_IDirect3DVertexBufferImpl_1_QueryInterface, - Thunk_IDirect3DVertexBufferImpl_1_AddRef, - Thunk_IDirect3DVertexBufferImpl_1_Release, + IDirect3DVertexBufferImpl_1_QueryInterface, + IDirect3DVertexBufferImpl_1_AddRef, + IDirect3DVertexBufferImpl_1_Release, /*** IDirect3DVertexBuffer Methods ***/ - Thunk_IDirect3DVertexBufferImpl_1_Lock, - Thunk_IDirect3DVertexBufferImpl_1_Unlock, - Thunk_IDirect3DVertexBufferImpl_1_ProcessVertices, - Thunk_IDirect3DVertexBufferImpl_1_GetVertexBufferDesc, - Thunk_IDirect3DVertexBufferImpl_1_Optimize + IDirect3DVertexBufferImpl_1_Lock, + IDirect3DVertexBufferImpl_1_Unlock, + IDirect3DVertexBufferImpl_1_ProcessVertices, + IDirect3DVertexBufferImpl_1_GetVertexBufferDesc, + IDirect3DVertexBufferImpl_1_Optimize }; HRESULT d3d_vertex_buffer_init(IDirect3DVertexBufferImpl *buffer, @@ -589,7 +545,7 @@ HRESULT d3d_vertex_buffer_init(IDirect3DVertexBufferImpl *buffer, EnterCriticalSection(&ddraw_cs); - hr = IWineD3DDevice_CreateVertexBuffer(ddraw->wineD3DDevice, + hr = wined3d_buffer_create_vb(ddraw->wined3d_device, get_flexible_vertex_size(desc->dwFVF) * desc->dwNumVertices, usage, desc->dwCaps & D3DVBCAPS_SYSTEMMEMORY ? WINED3DPOOL_SYSTEMMEM : WINED3DPOOL_DEFAULT, buffer, &ddraw_null_wined3d_parent_ops, &buffer->wineD3DVertexBuffer); @@ -608,12 +564,12 @@ HRESULT d3d_vertex_buffer_init(IDirect3DVertexBufferImpl *buffer, if (!buffer->wineD3DVertexDeclaration) { ERR("Failed to find vertex declaration for fvf %#x.\n", desc->dwFVF); - IWineD3DBuffer_Release(buffer->wineD3DVertexBuffer); + wined3d_buffer_decref(buffer->wineD3DVertexBuffer); LeaveCriticalSection(&ddraw_cs); return DDERR_INVALIDPARAMS; } - IWineD3DVertexDeclaration_AddRef(buffer->wineD3DVertexDeclaration); + wined3d_vertex_declaration_incref(buffer->wineD3DVertexDeclaration); LeaveCriticalSection(&ddraw_cs); diff --git a/dll/directx/wine/ddraw/viewport.c b/dll/directx/wine/ddraw/viewport.c index 6e0725e604e..08af7e2380f 100644 --- a/dll/directx/wine/ddraw/viewport.c +++ b/dll/directx/wine/ddraw/viewport.c @@ -36,18 +36,18 @@ WINE_DEFAULT_DEBUG_CHANNEL(ddraw); * activates the viewport using IDirect3DDevice7::SetViewport * *****************************************************************************/ -void viewport_activate(IDirect3DViewportImpl* This, BOOL ignore_lights) { - IDirect3DLightImpl* light; +void viewport_activate(IDirect3DViewportImpl *This, BOOL ignore_lights) +{ D3DVIEWPORT7 vp; - if (!ignore_lights) { - /* Activate all the lights associated with this context */ - light = This->lights; + if (!ignore_lights) + { + IDirect3DLightImpl *light; - while (light) + /* Activate all the lights associated with this context */ + LIST_FOR_EACH_ENTRY(light, &This->light_list, IDirect3DLightImpl, entry) { light_activate(light); - light = light->next; } } @@ -387,17 +387,12 @@ IDirect3DViewportImpl_TransformVertices(IDirect3DViewport3 *iface, EnterCriticalSection(&ddraw_cs); - IWineD3DDevice_GetTransform(This->active_device->wineD3DDevice, - D3DTRANSFORMSTATE_VIEW, - (WINED3DMATRIX*) &view_mat); - - IWineD3DDevice_GetTransform(This->active_device->wineD3DDevice, - D3DTRANSFORMSTATE_PROJECTION, - (WINED3DMATRIX*) &proj_mat); - - IWineD3DDevice_GetTransform(This->active_device->wineD3DDevice, - WINED3DTS_WORLDMATRIX(0), - (WINED3DMATRIX*) &world_mat); + wined3d_device_get_transform(This->active_device->wined3d_device, + D3DTRANSFORMSTATE_VIEW, (WINED3DMATRIX *)&view_mat); + wined3d_device_get_transform(This->active_device->wined3d_device, + D3DTRANSFORMSTATE_PROJECTION, (WINED3DMATRIX *)&proj_mat); + wined3d_device_get_transform(This->active_device->wined3d_device, + WINED3DTS_WORLDMATRIX(0), (WINED3DMATRIX *)&world_mat); multiply_matrix(&mat,&view_mat,&world_mat); multiply_matrix(&mat,&proj_mat,&mat); @@ -749,8 +744,7 @@ IDirect3DViewportImpl_AddLight(IDirect3DViewport3 *iface, This->map_lights |= 1<next = This->lights; - This->lights = lpDirect3DLightImpl; + list_add_head(&This->light_list, &lpDirect3DLightImpl->entry); IDirect3DLight_AddRef(lpDirect3DLight); /* Attach the light to the viewport */ @@ -782,33 +776,29 @@ IDirect3DViewportImpl_DeleteLight(IDirect3DViewport3 *iface, IDirect3DLight *lpDirect3DLight) { IDirect3DViewportImpl *This = (IDirect3DViewportImpl *)iface; - IDirect3DLightImpl *lpDirect3DLightImpl = (IDirect3DLightImpl *)lpDirect3DLight; - IDirect3DLightImpl *cur_light, *prev_light = NULL; + IDirect3DLightImpl *l = (IDirect3DLightImpl *)lpDirect3DLight; TRACE("iface %p, light %p.\n", iface, lpDirect3DLight); EnterCriticalSection(&ddraw_cs); - cur_light = This->lights; - while (cur_light != NULL) { - if (cur_light == lpDirect3DLightImpl) - { - light_deactivate(lpDirect3DLightImpl); - if (!prev_light) This->lights = cur_light->next; - else prev_light->next = cur_light->next; - /* Detach the light from the viewport. */ - cur_light->active_viewport = NULL; - IDirect3DLight_Release((IDirect3DLight *)cur_light); - --This->num_lights; - This->map_lights &= ~(1 << lpDirect3DLightImpl->dwLightIndex); - LeaveCriticalSection(&ddraw_cs); - return D3D_OK; - } - prev_light = cur_light; - cur_light = cur_light->next; + + if (l->active_viewport != This) + { + WARN("Light %p active viewport is %p.\n", l, l->active_viewport); + LeaveCriticalSection(&ddraw_cs); + return DDERR_INVALIDPARAMS; } + + light_deactivate(l); + list_remove(&l->entry); + l->active_viewport = NULL; + IDirect3DLight_Release(lpDirect3DLight); + --This->num_lights; + This->map_lights &= ~(1 << l->dwLightIndex); + LeaveCriticalSection(&ddraw_cs); - return DDERR_INVALIDPARAMS; + return D3D_OK; } /***************************************************************************** @@ -831,7 +821,9 @@ IDirect3DViewportImpl_NextLight(IDirect3DViewport3 *iface, DWORD dwFlags) { IDirect3DViewportImpl *This = (IDirect3DViewportImpl *)iface; - IDirect3DLightImpl *cur_light, *prev_light = NULL; + IDirect3DLightImpl *l = (IDirect3DLightImpl *)lpDirect3DLight; + struct list *entry; + HRESULT hr; TRACE("iface %p, light %p, next_light %p, flags %#x.\n", iface, lpDirect3DLight, lplpDirect3DLight, dwFlags); @@ -839,47 +831,50 @@ IDirect3DViewportImpl_NextLight(IDirect3DViewport3 *iface, if (!lplpDirect3DLight) return DDERR_INVALIDPARAMS; - *lplpDirect3DLight = NULL; - EnterCriticalSection(&ddraw_cs); - cur_light = This->lights; - - switch (dwFlags) { + switch (dwFlags) + { case D3DNEXT_NEXT: - if (!lpDirect3DLight) { - LeaveCriticalSection(&ddraw_cs); - return DDERR_INVALIDPARAMS; - } - while (cur_light != NULL) { - if (cur_light == (IDirect3DLightImpl *)lpDirect3DLight) { - *lplpDirect3DLight = (IDirect3DLight*)cur_light->next; - break; - } - cur_light = cur_light->next; + if (!l || l->active_viewport != This) + { + if (l) + WARN("Light %p active viewport is %p.\n", l, l->active_viewport); + entry = NULL; } + else + entry = list_next(&This->light_list, &l->entry); break; + case D3DNEXT_HEAD: - *lplpDirect3DLight = (IDirect3DLight*)This->lights; + entry = list_head(&This->light_list); break; + case D3DNEXT_TAIL: - while (cur_light != NULL) { - prev_light = cur_light; - cur_light = cur_light->next; - } - *lplpDirect3DLight = (IDirect3DLight*)prev_light; + entry = list_tail(&This->light_list); break; + default: - ERR("Unknown flag %d\n", dwFlags); + entry = NULL; + WARN("Invalid flags %#x.\n", dwFlags); break; } - if (*lplpDirect3DLight) + if (entry) + { + *lplpDirect3DLight = (IDirect3DLight *)LIST_ENTRY(entry, IDirect3DLightImpl, entry); IDirect3DLight_AddRef(*lplpDirect3DLight); + hr = D3D_OK; + } + else + { + *lplpDirect3DLight = NULL; + hr = DDERR_INVALIDPARAMS; + } LeaveCriticalSection(&ddraw_cs); - return *lplpDirect3DLight ? D3D_OK : DDERR_INVALIDPARAMS; + return hr; } /***************************************************************************** @@ -1131,4 +1126,5 @@ void d3d_viewport_init(IDirect3DViewportImpl *viewport, IDirectDrawImpl *ddraw) viewport->ref = 1; viewport->ddraw = ddraw; viewport->use_vp2 = 0xff; + list_init(&viewport->light_list); } diff --git a/dll/directx/wine/wined3d/CMakeLists.txt b/dll/directx/wine/wined3d/CMakeLists.txt index 4a45c3b7b58..a7b742b28ed 100644 --- a/dll/directx/wine/wined3d/CMakeLists.txt +++ b/dll/directx/wine/wined3d/CMakeLists.txt @@ -18,11 +18,9 @@ spec2def(wined3d.dll wined3d.spec) list(APPEND SOURCE ati_fragment_shader.c arb_program_shader.c - basetexture.c buffer.c clipper.c context.c - cubetexture.c device.c directx.c drawprim.c @@ -37,18 +35,13 @@ list(APPEND SOURCE shader_sm4.c state.c stateblock.c - surface_base.c surface.c - surface_gdi.c swapchain.c - swapchain_base.c - swapchain_gdi.c texture.c utils.c vertexdeclaration.c view.c volume.c - volumetexture.c wined3d_main.c version.rc ${CMAKE_CURRENT_BINARY_DIR}/wined3d.def) @@ -62,7 +55,7 @@ endif() add_library(wined3d SHARED ${SOURCE}) set_module_type(wined3d win32dll) -target_link_libraries(wined3d wine uuid wined3d_guid) +target_link_libraries(wined3d wine) add_importlibs(wined3d user32 @@ -74,5 +67,6 @@ add_importlibs(wined3d ntdll) add_dependencies(wined3d wineheaders) +add_pch(wined3d wined3d_private.h) add_cd_file(TARGET wined3d DESTINATION reactos/system32 FOR all) add_importlib_target(wined3d.spec) diff --git a/dll/directx/wine/wined3d/arb_program_shader.c b/dll/directx/wine/wined3d/arb_program_shader.c index c053e7faf10..ee5bf86d88a 100644 --- a/dll/directx/wine/wined3d/arb_program_shader.c +++ b/dll/directx/wine/wined3d/arb_program_shader.c @@ -78,47 +78,6 @@ static void shader_arb_dump_program_source(const char *source) HeapFree(GetProcessHeap(), 0, tmp); } -/* GL locking for state handlers is done by the caller. */ -static BOOL need_rel_addr_const(IWineD3DBaseShaderImpl *shader, const struct wined3d_gl_info *gl_info) -{ - if (shader->baseShader.reg_maps.shader_version.type == WINED3D_SHADER_TYPE_VERTEX) - { - if (((IWineD3DVertexShaderImpl *)shader)->rel_offset) return TRUE; - } - if (!shader->baseShader.reg_maps.usesmova) return FALSE; - return !gl_info->supported[NV_VERTEX_PROGRAM2_OPTION]; -} - -/* Returns TRUE if result.clip from GL_NV_vertex_program2 should be used and FALSE otherwise */ -static inline BOOL use_nv_clip(const struct wined3d_gl_info *gl_info) -{ - return gl_info->supported[NV_VERTEX_PROGRAM2_OPTION] - && !(gl_info->quirks & WINED3D_QUIRK_NV_CLIP_BROKEN); -} - -static BOOL need_helper_const(IWineD3DBaseShaderImpl *shader, const struct wined3d_gl_info *gl_info) -{ - if (need_rel_addr_const(shader, gl_info)) return TRUE; - if (!gl_info->supported[NV_VERTEX_PROGRAM]) return TRUE; /* Need to init colors. */ - if (gl_info->quirks & WINED3D_QUIRK_ARB_VS_OFFSET_LIMIT) return TRUE; /* Load the immval offset. */ - if (gl_info->quirks & WINED3D_QUIRK_SET_TEXCOORD_W) return TRUE; /* Have to init texcoords. */ - if (!use_nv_clip(gl_info)) return TRUE; /* Init the clip texcoord */ - if (shader->baseShader.reg_maps.usesnrm) return TRUE; /* 0.0 */ - if (shader->baseShader.reg_maps.usesrcp) return TRUE; /* EPS */ - return FALSE; -} - -static unsigned int reserved_vs_const(IWineD3DBaseShaderImpl *shader, const struct wined3d_gl_info *gl_info) -{ - unsigned int ret = 1; - /* We use one PARAM for the pos fixup, and in some cases one to load - * some immediate values into the shader - */ - if(need_helper_const(shader, gl_info)) ret++; - if(need_rel_addr_const(shader, gl_info)) ret++; - return ret; -} - enum arb_helper_value { ARB_ZERO, @@ -145,7 +104,7 @@ static const char *arb_get_helper_value(enum wined3d_shader_type shader, enum ar case ARB_ZERO: return "ps_helper_const.x"; case ARB_ONE: return "ps_helper_const.y"; case ARB_TWO: return "coefmul.x"; - case ARB_0001: return "helper_const.xxxy"; + case ARB_0001: return "ps_helper_const.xxxy"; case ARB_EPS: return "ps_helper_const.z"; default: break; } @@ -335,6 +294,7 @@ struct arb_pshader_private { struct arb_vshader_private { struct arb_vs_compiled_shader *gl_shaders; UINT num_gl_shaders, shader_array_size; + UINT rel_offset; }; struct shader_arb_priv @@ -355,9 +315,45 @@ struct shader_arb_priv DWORD ps_sig_number; }; -/******************************************************** - * ARB_[vertex/fragment]_program helper functions follow - ********************************************************/ +/* GL locking for state handlers is done by the caller. */ +static BOOL need_rel_addr_const(const struct arb_vshader_private *shader_data, + const struct wined3d_shader_reg_maps *reg_maps, const struct wined3d_gl_info *gl_info) +{ + if (shader_data->rel_offset) return TRUE; + if (!reg_maps->usesmova) return FALSE; + return !gl_info->supported[NV_VERTEX_PROGRAM2_OPTION]; +} + +/* Returns TRUE if result.clip from GL_NV_vertex_program2 should be used and FALSE otherwise */ +static inline BOOL use_nv_clip(const struct wined3d_gl_info *gl_info) +{ + return gl_info->supported[NV_VERTEX_PROGRAM2_OPTION] + && !(gl_info->quirks & WINED3D_QUIRK_NV_CLIP_BROKEN); +} + +static BOOL need_helper_const(const struct arb_vshader_private *shader_data, + const struct wined3d_shader_reg_maps *reg_maps, const struct wined3d_gl_info *gl_info) +{ + if (need_rel_addr_const(shader_data, reg_maps, gl_info)) return TRUE; + if (!gl_info->supported[NV_VERTEX_PROGRAM]) return TRUE; /* Need to init colors. */ + if (gl_info->quirks & WINED3D_QUIRK_ARB_VS_OFFSET_LIMIT) return TRUE; /* Load the immval offset. */ + if (gl_info->quirks & WINED3D_QUIRK_SET_TEXCOORD_W) return TRUE; /* Have to init texcoords. */ + if (!use_nv_clip(gl_info)) return TRUE; /* Init the clip texcoord */ + if (reg_maps->usesnrm) return TRUE; /* 0.0 */ + if (reg_maps->usespow) return TRUE; /* EPS, 0.0 and 1.0 */ + return FALSE; +} + +static unsigned int reserved_vs_const(const struct arb_vshader_private *shader_data, + const struct wined3d_shader_reg_maps *reg_maps, const struct wined3d_gl_info *gl_info) +{ + unsigned int ret = 1; + /* We use one PARAM for the pos fixup, and in some cases one to load + * some immediate values into the shader. */ + if (need_helper_const(shader_data, reg_maps, gl_info)) ++ret; + if (need_rel_addr_const(shader_data, reg_maps, gl_info)) ++ret; + return ret; +} /* Loads floating point constants into the currently set ARB_vertex/fragment_program. * When constant_list == NULL, it will load all the constants. @@ -366,7 +362,7 @@ struct shader_arb_priv * or GL_FRAGMENT_PROGRAM_ARB (for pixel shaders) */ /* GL locking is done by the caller */ -static unsigned int shader_arb_load_constantsF(IWineD3DBaseShaderImpl *This, const struct wined3d_gl_info *gl_info, +static unsigned int shader_arb_load_constantsF(struct wined3d_shader *shader, const struct wined3d_gl_info *gl_info, GLuint target_type, unsigned int max_constants, const float *constants, char *dirty_consts) { local_constant* lconst; @@ -386,7 +382,7 @@ static unsigned int shader_arb_load_constantsF(IWineD3DBaseShaderImpl *This, con i = 0; /* In 1.X pixel shaders constants are implicitly clamped in the range [-1;1] */ - if (target_type == GL_FRAGMENT_PROGRAM_ARB && This->baseShader.reg_maps.shader_version.major == 1) + if (target_type == GL_FRAGMENT_PROGRAM_ARB && shader->reg_maps.shader_version.major == 1) { float lcl_const[4]; /* ps 1.x supports only 8 constants, clamp only those. When switching between 1.x and higher @@ -455,9 +451,12 @@ static unsigned int shader_arb_load_constantsF(IWineD3DBaseShaderImpl *This, con checkGLcall("glProgramEnvParameter4fvARB()"); /* Load immediate constants */ - if(This->baseShader.load_local_constsF) { - if (TRACE_ON(d3d_shader)) { - LIST_FOR_EACH_ENTRY(lconst, &This->baseShader.constantsF, local_constant, entry) { + if (shader->load_local_constsF) + { + if (TRACE_ON(d3d_shader)) + { + LIST_FOR_EACH_ENTRY(lconst, &shader->constantsF, local_constant, entry) + { GLfloat* values = (GLfloat*)lconst->value; TRACE_(d3d_constants)("Loading local constants %i: %f, %f, %f, %f\n", lconst->idx, values[0], values[1], values[2], values[3]); @@ -465,7 +464,8 @@ static unsigned int shader_arb_load_constantsF(IWineD3DBaseShaderImpl *This, con } /* Immediate constants are clamped for 1.X shaders at loading times */ ret = 0; - LIST_FOR_EACH_ENTRY(lconst, &This->baseShader.constantsF, local_constant, entry) { + LIST_FOR_EACH_ENTRY(lconst, &shader->constantsF, local_constant, entry) + { dirty_consts[lconst->idx] = 1; /* Dirtify so the non-immediate constant overwrites it next time */ ret = max(ret, lconst->idx + 1); GL_EXTCALL(glProgramEnvParameter4fvARB(target_type, lconst->idx, (GLfloat*)lconst->value)); @@ -480,20 +480,13 @@ static unsigned int shader_arb_load_constantsF(IWineD3DBaseShaderImpl *This, con /** * Loads the texture dimensions for NP2 fixup into the currently set ARB_[vertex/fragment]_programs. */ -static void shader_arb_load_np2fixup_constants( - IWineD3DDevice* device, - char usePixelShader, - char useVertexShader) { +static void shader_arb_load_np2fixup_constants(void *shader_priv, + const struct wined3d_gl_info *gl_info, const struct wined3d_state *state) +{ + const struct shader_arb_priv * priv = shader_priv; - IWineD3DDeviceImpl* deviceImpl = (IWineD3DDeviceImpl *) device; - const struct shader_arb_priv* const priv = (const struct shader_arb_priv *) deviceImpl->shader_priv; - IWineD3DStateBlockImpl* stateBlock = deviceImpl->stateBlock; - const struct wined3d_gl_info *gl_info = &deviceImpl->adapter->gl_info; - - if (!usePixelShader) { - /* NP2 texcoord fixup is (currently) only done for pixelshaders. */ - return; - } + /* NP2 texcoord fixup is (currently) only done for pixelshaders. */ + if (!use_ps(state)) return; if (priv->compiled_fprog && priv->compiled_fprog->np2fixup_info.super.active) { const struct arb_ps_np2fixup_info* const fixup = &priv->compiled_fprog->np2fixup_info; @@ -501,9 +494,10 @@ static void shader_arb_load_np2fixup_constants( WORD active = fixup->super.active; GLfloat np2fixup_constants[4 * MAX_FRAGMENT_SAMPLERS]; - for (i = 0; active; active >>= 1, ++i) { + for (i = 0; active; active >>= 1, ++i) + { + const struct wined3d_texture *tex = state->textures[i]; const unsigned char idx = fixup->super.idx[i]; - const IWineD3DBaseTextureImpl *tex = stateBlock->state.textures[i]; GLfloat *tex_dim = &np2fixup_constants[(idx >> 1) * 4]; if (!(active & 1)) continue; @@ -513,10 +507,15 @@ static void shader_arb_load_np2fixup_constants( continue; } - if (idx % 2) { - tex_dim[2] = tex->baseTexture.pow2Matrix[0]; tex_dim[3] = tex->baseTexture.pow2Matrix[5]; - } else { - tex_dim[0] = tex->baseTexture.pow2Matrix[0]; tex_dim[1] = tex->baseTexture.pow2Matrix[5]; + if (idx % 2) + { + tex_dim[2] = tex->pow2_matrix[0]; + tex_dim[3] = tex->pow2_matrix[5]; + } + else + { + tex_dim[0] = tex->pow2_matrix[0]; + tex_dim[1] = tex->pow2_matrix[5]; } } @@ -528,21 +527,18 @@ static void shader_arb_load_np2fixup_constants( } /* GL locking is done by the caller. */ -static inline void shader_arb_ps_local_constants(IWineD3DDeviceImpl* deviceImpl) +static void shader_arb_ps_local_constants(const struct arb_ps_compiled_shader *gl_shader, + const struct wined3d_context *context, const struct wined3d_state *state, UINT rt_height) { - const struct wined3d_context *context = context_get_current(); - IWineD3DStateBlockImpl* stateBlock = deviceImpl->stateBlock; const struct wined3d_gl_info *gl_info = context->gl_info; unsigned char i; - struct shader_arb_priv *priv = deviceImpl->shader_priv; - const struct arb_ps_compiled_shader *gl_shader = priv->compiled_fprog; for(i = 0; i < gl_shader->numbumpenvmatconsts; i++) { int texunit = gl_shader->bumpenvmatconst[i].texunit; /* The state manager takes care that this function is always called if the bump env matrix changes */ - const float *data = (const float *)&stateBlock->state.texture_states[texunit][WINED3DTSS_BUMPENVMAT00]; + const float *data = (const float *)&state->texture_states[texunit][WINED3DTSS_BUMPENVMAT00]; GL_EXTCALL(glProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, gl_shader->bumpenvmatconst[i].const_num, data)); @@ -553,7 +549,7 @@ static inline void shader_arb_ps_local_constants(IWineD3DDeviceImpl* deviceImpl) * don't care about them. The pointers are valid for sure because the stateblock is bigger. * (they're WINED3DTSS_TEXTURETRANSFORMFLAGS and WINED3DTSS_ADDRESSW, so most likely 0 or NaN */ - const float *scale = (const float *)&stateBlock->state.texture_states[texunit][WINED3DTSS_BUMPENVLSCALE]; + const float *scale = (const float *)&state->texture_states[texunit][WINED3DTSS_BUMPENVLSCALE]; GL_EXTCALL(glProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, gl_shader->luminanceconst[i].const_num, scale)); } @@ -568,8 +564,7 @@ static inline void shader_arb_ps_local_constants(IWineD3DDeviceImpl* deviceImpl) * ycorrection.w: 0.0 */ float val[4]; - val[0] = context->render_offscreen ? 0.0f - : deviceImpl->render_targets[0]->currentDesc.Height; + val[0] = context->render_offscreen ? 0.0f : (float) rt_height; val[1] = context->render_offscreen ? 1.0f : -1.0f; val[2] = 1.0f; val[3] = 0.0f; @@ -584,9 +579,9 @@ static inline void shader_arb_ps_local_constants(IWineD3DDeviceImpl* deviceImpl) if(gl_shader->int_consts[i] != WINED3D_CONST_NUM_UNUSED) { float val[4]; - val[0] = (float)stateBlock->state.ps_consts_i[4 * i]; - val[1] = (float)stateBlock->state.ps_consts_i[4 * i + 1]; - val[2] = (float)stateBlock->state.ps_consts_i[4 * i + 2]; + val[0] = (float)state->ps_consts_i[4 * i]; + val[1] = (float)state->ps_consts_i[4 * i + 1]; + val[2] = (float)state->ps_consts_i[4 * i + 2]; val[3] = -1.0f; GL_EXTCALL(glProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, gl_shader->int_consts[i], val)); @@ -596,29 +591,27 @@ static inline void shader_arb_ps_local_constants(IWineD3DDeviceImpl* deviceImpl) } /* GL locking is done by the caller. */ -static inline void shader_arb_vs_local_constants(IWineD3DDeviceImpl* deviceImpl) +static void shader_arb_vs_local_constants(const struct arb_vs_compiled_shader *gl_shader, + const struct wined3d_context *context, const struct wined3d_state *state) { - IWineD3DStateBlockImpl* stateBlock; - const struct wined3d_gl_info *gl_info = &deviceImpl->adapter->gl_info; + const struct wined3d_gl_info *gl_info = context->gl_info; + float position_fixup[4]; unsigned char i; - struct shader_arb_priv *priv = deviceImpl->shader_priv; - const struct arb_vs_compiled_shader *gl_shader = priv->compiled_vprog; /* Upload the position fixup */ - GL_EXTCALL(glProgramLocalParameter4fvARB(GL_VERTEX_PROGRAM_ARB, gl_shader->pos_fixup, deviceImpl->posFixup)); + shader_get_position_fixup(context, state, position_fixup); + GL_EXTCALL(glProgramLocalParameter4fvARB(GL_VERTEX_PROGRAM_ARB, gl_shader->pos_fixup, position_fixup)); if (!gl_shader->num_int_consts) return; - stateBlock = deviceImpl->stateBlock; - for(i = 0; i < MAX_CONST_I; i++) { if(gl_shader->int_consts[i] != WINED3D_CONST_NUM_UNUSED) { float val[4]; - val[0] = (float)stateBlock->state.vs_consts_i[4 * i]; - val[1] = (float)stateBlock->state.vs_consts_i[4 * i + 1]; - val[2] = (float)stateBlock->state.vs_consts_i[4 * i + 2]; + val[0] = (float)state->vs_consts_i[4 * i]; + val[1] = (float)state->vs_consts_i[4 * i + 1]; + val[2] = (float)state->vs_consts_i[4 * i + 2]; val[3] = -1.0f; GL_EXTCALL(glProgramLocalParameter4fvARB(GL_VERTEX_PROGRAM_ARB, gl_shader->int_consts[i], val)); @@ -636,83 +629,88 @@ static inline void shader_arb_vs_local_constants(IWineD3DDeviceImpl* deviceImpl) /* GL locking is done by the caller (state handler) */ static void shader_arb_load_constants(const struct wined3d_context *context, char usePixelShader, char useVertexShader) { - IWineD3DDeviceImpl *device = context->swapchain->device; - IWineD3DStateBlockImpl* stateBlock = device->stateBlock; + struct wined3d_device *device = context->swapchain->device; + struct wined3d_stateblock *stateBlock = device->stateBlock; const struct wined3d_gl_info *gl_info = context->gl_info; + struct shader_arb_priv *priv = device->shader_priv; if (useVertexShader) { - IWineD3DBaseShaderImpl *vshader = (IWineD3DBaseShaderImpl *)stateBlock->state.vertex_shader; + struct wined3d_shader *vshader = stateBlock->state.vertex_shader; + const struct arb_vs_compiled_shader *gl_shader = priv->compiled_vprog; /* Load DirectX 9 float constants for vertex shader */ device->highest_dirty_vs_const = shader_arb_load_constantsF(vshader, gl_info, GL_VERTEX_PROGRAM_ARB, device->highest_dirty_vs_const, stateBlock->state.vs_consts_f, context->vshader_const_dirty); - shader_arb_vs_local_constants(device); + shader_arb_vs_local_constants(gl_shader, context, &stateBlock->state); } if (usePixelShader) { - IWineD3DBaseShaderImpl *pshader = (IWineD3DBaseShaderImpl *)stateBlock->state.pixel_shader; + struct wined3d_shader *pshader = stateBlock->state.pixel_shader; + const struct arb_ps_compiled_shader *gl_shader = priv->compiled_fprog; + UINT rt_height = device->fb.render_targets[0]->resource.height; /* Load DirectX 9 float constants for pixel shader */ device->highest_dirty_ps_const = shader_arb_load_constantsF(pshader, gl_info, GL_FRAGMENT_PROGRAM_ARB, device->highest_dirty_ps_const, stateBlock->state.ps_consts_f, context->pshader_const_dirty); - shader_arb_ps_local_constants(device); + shader_arb_ps_local_constants(gl_shader, context, &stateBlock->state, rt_height); } } -static void shader_arb_update_float_vertex_constants(IWineD3DDevice *iface, UINT start, UINT count) +static void shader_arb_update_float_vertex_constants(struct wined3d_device *device, UINT start, UINT count) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; struct wined3d_context *context = context_get_current(); /* We don't want shader constant dirtification to be an O(contexts), so just dirtify the active * context. On a context switch the old context will be fully dirtified */ - if (!context || context->swapchain->device != This) return; + if (!context || context->swapchain->device != device) return; memset(context->vshader_const_dirty + start, 1, sizeof(*context->vshader_const_dirty) * count); - This->highest_dirty_vs_const = max(This->highest_dirty_vs_const, start + count); + device->highest_dirty_vs_const = max(device->highest_dirty_vs_const, start + count); } -static void shader_arb_update_float_pixel_constants(IWineD3DDevice *iface, UINT start, UINT count) +static void shader_arb_update_float_pixel_constants(struct wined3d_device *device, UINT start, UINT count) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; struct wined3d_context *context = context_get_current(); /* We don't want shader constant dirtification to be an O(contexts), so just dirtify the active * context. On a context switch the old context will be fully dirtified */ - if (!context || context->swapchain->device != This) return; + if (!context || context->swapchain->device != device) return; memset(context->pshader_const_dirty + start, 1, sizeof(*context->pshader_const_dirty) * count); - This->highest_dirty_ps_const = max(This->highest_dirty_ps_const, start + count); + device->highest_dirty_ps_const = max(device->highest_dirty_ps_const, start + count); } -static DWORD *local_const_mapping(IWineD3DBaseShaderImpl *This) +static DWORD *local_const_mapping(const struct wined3d_shader *shader) { DWORD *ret; DWORD idx = 0; const local_constant *lconst; - if(This->baseShader.load_local_constsF || list_empty(&This->baseShader.constantsF)) return NULL; + if (shader->load_local_constsF || list_empty(&shader->constantsF)) + return NULL; - ret = HeapAlloc(GetProcessHeap(), 0, sizeof(DWORD) * This->baseShader.limits.constant_float); - if(!ret) { + ret = HeapAlloc(GetProcessHeap(), 0, sizeof(DWORD) * shader->limits.constant_float); + if (!ret) + { ERR("Out of memory\n"); return NULL; } - LIST_FOR_EACH_ENTRY(lconst, &This->baseShader.constantsF, local_constant, entry) { + LIST_FOR_EACH_ENTRY(lconst, &shader->constantsF, local_constant, entry) + { ret[lconst->idx] = idx++; } return ret; } /* Generate the variable & register declarations for the ARB_vertex_program output target */ -static DWORD shader_generate_arb_declarations(IWineD3DBaseShader *iface, const shader_reg_maps *reg_maps, - struct wined3d_shader_buffer *buffer, const struct wined3d_gl_info *gl_info, DWORD *lconst_map, +static DWORD shader_generate_arb_declarations(struct wined3d_shader *shader, + const struct wined3d_shader_reg_maps *reg_maps, struct wined3d_shader_buffer *buffer, + const struct wined3d_gl_info *gl_info, DWORD *lconst_map, DWORD *num_clipplanes, struct shader_arb_ctx_priv *ctx) { - IWineD3DBaseShaderImpl* This = (IWineD3DBaseShaderImpl*) iface; DWORD i, next_local = 0; char pshader = shader_is_pshader_version(reg_maps->shader_version.type); unsigned max_constantsF; @@ -738,6 +736,7 @@ static DWORD shader_generate_arb_declarations(IWineD3DBaseShader *iface, const s } else { + const struct arb_vshader_private *shader_data = shader->backend_data; max_constantsF = gl_info->limits.arb_vs_native_constants; /* 96 is the minimum MAX_PROGRAM_ENV_PARAMETERS_ARB value. * Also prevents max_constantsF from becoming less than 0 and @@ -745,13 +744,14 @@ static DWORD shader_generate_arb_declarations(IWineD3DBaseShader *iface, const s if (max_constantsF < 96) max_constantsF = gl_info->limits.arb_vs_float_constants; - if(This->baseShader.reg_maps.usesrelconstF) { + if (reg_maps->usesrelconstF) + { DWORD highest_constf = 0, clip_limit; - max_constantsF -= reserved_vs_const(This, gl_info); - max_constantsF -= count_bits(This->baseShader.reg_maps.integer_constants); + max_constantsF -= reserved_vs_const(shader_data, reg_maps, gl_info); + max_constantsF -= count_bits(reg_maps->integer_constants); - for(i = 0; i < This->baseShader.limits.constant_float; i++) + for (i = 0; i < shader->limits.constant_float; ++i) { DWORD idx = i >> 5; DWORD shift = i & 0x1f; @@ -805,8 +805,10 @@ static DWORD shader_generate_arb_declarations(IWineD3DBaseShader *iface, const s /* Load local constants using the program-local space, * this avoids reloading them each time the shader is used */ - if(lconst_map) { - LIST_FOR_EACH_ENTRY(lconst, &This->baseShader.constantsF, local_constant, entry) { + if (lconst_map) + { + LIST_FOR_EACH_ENTRY(lconst, &shader->constantsF, local_constant, entry) + { shader_addline(buffer, "PARAM C%u = program.local[%u];\n", lconst->idx, lconst_map[lconst->idx]); next_local = max(next_local, lconst_map[lconst->idx] + 1); @@ -826,7 +828,7 @@ static DWORD shader_generate_arb_declarations(IWineD3DBaseShader *iface, const s } /* Avoid declaring more constants than needed */ - max_constantsF = min(max_constantsF, This->baseShader.limits.constant_float); + max_constantsF = min(max_constantsF, shader->limits.constant_float); /* we use the array-based constants array if the local constants are marked for loading, * because then we use indirect addressing, or when the local constant list is empty, @@ -834,7 +836,8 @@ static DWORD shader_generate_arb_declarations(IWineD3DBaseShader *iface, const s * local constants do not declare the loaded constants as an array because ARB compilers usually * do not optimize unused constants away */ - if(This->baseShader.reg_maps.usesrelconstF) { + if (reg_maps->usesrelconstF) + { /* Need to PARAM the environment parameters (constants) so we can use relative addressing */ shader_addline(buffer, "PARAM C[%d] = { program.env[0..%d] };\n", max_constantsF, max_constantsF - 1); @@ -843,7 +846,8 @@ static DWORD shader_generate_arb_declarations(IWineD3DBaseShader *iface, const s DWORD idx, mask; idx = i >> 5; mask = 1 << (i & 0x1f); - if(!shader_constant_is_local(This, i) && (This->baseShader.reg_maps.constf[idx] & mask)) { + if (!shader_constant_is_local(shader, i) && (reg_maps->constf[idx] & mask)) + { shader_addline(buffer, "PARAM C%d = program.env[%d];\n",i, i); } } @@ -940,8 +944,9 @@ static void shader_arb_get_register_name(const struct wined3d_shader_instruction { /* oPos, oFog and oPts in D3D */ static const char * const rastout_reg_names[] = {"TMP_OUT", "result.fogcoord", "result.pointsize"}; - IWineD3DBaseShaderImpl *This = (IWineD3DBaseShaderImpl *)ins->ctx->shader; - BOOL pshader = shader_is_pshader_version(This->baseShader.reg_maps.shader_version.type); + struct wined3d_shader *shader = ins->ctx->shader; + const struct wined3d_shader_reg_maps *reg_maps = ins->ctx->reg_maps; + BOOL pshader = shader_is_pshader_version(reg_maps->shader_version.type); struct shader_arb_ctx_priv *ctx = ins->ctx->backend_data; *is_color = FALSE; @@ -955,7 +960,7 @@ static void shader_arb_get_register_name(const struct wined3d_shader_instruction case WINED3DSPR_INPUT: if (pshader) { - if(This->baseShader.reg_maps.shader_version.major < 3) + if (reg_maps->shader_version.major < 3) { if (!reg->idx) strcpy(register_name, "fragment.color.primary"); else strcpy(register_name, "fragment.color.secondary"); @@ -980,7 +985,7 @@ static void shader_arb_get_register_name(const struct wined3d_shader_instruction sprintf(register_name, "out_of_bounds_%u", idx); } } - else if(This->baseShader.reg_maps.input_registers & 0x0300) + else if (reg_maps->input_registers & 0x0300) { /* There are two ways basically: * @@ -1041,10 +1046,12 @@ static void shader_arb_get_register_name(const struct wined3d_shader_instruction case WINED3DSPR_CONST: if (!pshader && reg->rel_addr) { + const struct arb_vshader_private *shader_data = shader->backend_data; + UINT rel_offset = shader_data->rel_offset; BOOL aL = FALSE; char rel_reg[50]; - UINT rel_offset = ((IWineD3DVertexShaderImpl *)This)->rel_offset; - if(This->baseShader.reg_maps.shader_version.major < 2) { + if (reg_maps->shader_version.major < 2) + { sprintf(rel_reg, "A0.x"); } else { shader_arb_get_src_param(ins, reg->rel_addr, 0, rel_reg); @@ -1067,7 +1074,7 @@ static void shader_arb_get_register_name(const struct wined3d_shader_instruction } else { - if (This->baseShader.reg_maps.usesrelconstF) + if (reg_maps->usesrelconstF) sprintf(register_name, "C[%u]", reg->idx); else sprintf(register_name, "C%u", reg->idx); @@ -1075,9 +1082,11 @@ static void shader_arb_get_register_name(const struct wined3d_shader_instruction break; case WINED3DSPR_TEXTURE: /* case WINED3DSPR_ADDR: */ - if (pshader) { - if(This->baseShader.reg_maps.shader_version.major == 1 && - This->baseShader.reg_maps.shader_version.minor <= 3) { + if (pshader) + { + if (reg_maps->shader_version.major == 1 + && reg_maps->shader_version.minor <= 3) + { /* In ps <= 1.3, Tx is a temporary register as destination to all instructions, * and as source to most instructions. For some instructions it is the texcoord * input. Those instructions know about the special use @@ -1090,7 +1099,7 @@ static void shader_arb_get_register_name(const struct wined3d_shader_instruction } else { - if(This->baseShader.reg_maps.shader_version.major == 1 || ctx->target_version >= NV2) + if (reg_maps->shader_version.major == 1 || ctx->target_version >= NV2) { sprintf(register_name, "A%u", reg->idx); } @@ -1109,7 +1118,7 @@ static void shader_arb_get_register_name(const struct wined3d_shader_instruction else { if(ctx->cur_ps_args->super.srgb_correction) FIXME("sRGB correction on higher render targets\n"); - if(This->baseShader.reg_maps.highest_render_target > 0) + if (reg_maps->rt_mask > 1) { sprintf(register_name, "result.color[%u]", reg->idx); } @@ -1142,7 +1151,7 @@ static void shader_arb_get_register_name(const struct wined3d_shader_instruction } else { - if(This->baseShader.reg_maps.shader_version.major < 3) + if (reg_maps->shader_version.major < 3) { strcpy(register_name, ctx->texcrd_output[reg->idx]); } @@ -1328,11 +1337,11 @@ static void shader_hw_sample(const struct wined3d_shader_instruction *ins, DWORD { struct wined3d_shader_buffer *buffer = ins->ctx->buffer; DWORD sampler_type = ins->ctx->reg_maps->sampler_type[sampler_idx]; - IWineD3DBaseTextureImpl *texture; + const struct wined3d_texture *texture; const char *tex_type; BOOL np2_fixup = FALSE; - IWineD3DBaseShaderImpl *This = (IWineD3DBaseShaderImpl *)ins->ctx->shader; - IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *) This->baseShader.device; + struct wined3d_shader *shader = ins->ctx->shader; + struct wined3d_device *device = shader->device; struct shader_arb_ctx_priv *priv = ins->ctx->backend_data; const char *mod; BOOL pshader = shader_is_pshader_version(ins->ctx->reg_maps->shader_version.type); @@ -1347,7 +1356,7 @@ static void shader_hw_sample(const struct wined3d_shader_instruction *ins, DWORD case WINED3DSTT_2D: texture = device->stateBlock->state.textures[sampler_idx]; - if (texture && texture->baseTexture.target == GL_TEXTURE_RECTANGLE_ARB) + if (texture && texture->target == GL_TEXTURE_RECTANGLE_ARB) { tex_type = "RECT"; } else { @@ -1476,7 +1485,7 @@ static void shader_arb_get_src_param(const struct wined3d_shader_instruction *in shader_addline(buffer, "MAD T%c, %s, %s, -%s;\n", 'A' + tmpreg, regstr, two, one); break; case WINED3DSPSM_SIGNNEG: - shader_addline(buffer, "MAD T%c, %s, %s, %s;\n", 'A' + tmpreg, regstr, two, one); + shader_addline(buffer, "MAD T%c, %s, -%s, %s;\n", 'A' + tmpreg, regstr, two, one); break; case WINED3DSPSM_COMP: shader_addline(buffer, "SUB T%c, %s, %s;\n", 'A' + tmpreg, one, regstr); @@ -1579,7 +1588,6 @@ static void pshader_hw_cnd(const struct wined3d_shader_instruction *ins) char src_name[3][50]; DWORD shader_version = WINED3D_SHADER_VERSION(ins->ctx->reg_maps->shader_version.major, ins->ctx->reg_maps->shader_version.minor); - BOOL is_color; shader_arb_get_dst_param(ins, dst, dst_name); shader_arb_get_src_param(ins, &ins->src[1], 1, src_name[1]); @@ -1588,7 +1596,9 @@ static void pshader_hw_cnd(const struct wined3d_shader_instruction *ins) if (shader_version <= WINED3D_SHADER_VERSION(1, 3) && ins->coissue) { shader_addline(buffer, "MOV%s %s, %s;\n", shader_arb_get_modifier(ins), dst_name, src_name[1]); - } else { + } + else + { struct wined3d_shader_src_param src0_copy = ins->src[0]; char extra_neg; @@ -1598,15 +1608,8 @@ static void pshader_hw_cnd(const struct wined3d_shader_instruction *ins) shader_arb_get_src_param(ins, &src0_copy, 0, src_name[0]); shader_arb_get_src_param(ins, &ins->src[2], 2, src_name[2]); shader_addline(buffer, "ADD TA, %c%s, coefdiv.x;\n", extra_neg, src_name[0]); - /* No modifiers supported on CMP */ - shader_addline(buffer, "CMP %s, TA, %s, %s;\n", dst_name, src_name[1], src_name[2]); - - /* _SAT on CMP doesn't make much sense, but it is not a pure NOP */ - if(ins->dst[0].modifiers & WINED3DSPDM_SATURATE) - { - shader_arb_get_register_name(ins, &dst->reg, src_name[0], &is_color); - shader_addline(buffer, "MOV_SAT %s, %s;\n", dst_name, dst_name); - } + shader_addline(buffer, "CMP%s %s, TA, %s, %s;\n", shader_arb_get_modifier(ins), + dst_name, src_name[1], src_name[2]); } } @@ -1616,7 +1619,6 @@ static void pshader_hw_cmp(const struct wined3d_shader_instruction *ins) struct wined3d_shader_buffer *buffer = ins->ctx->buffer; char dst_name[50]; char src_name[3][50]; - BOOL is_color; shader_arb_get_dst_param(ins, dst, dst_name); @@ -1625,15 +1627,8 @@ static void pshader_hw_cmp(const struct wined3d_shader_instruction *ins) shader_arb_get_src_param(ins, &ins->src[1], 1, src_name[1]); shader_arb_get_src_param(ins, &ins->src[2], 2, src_name[2]); - /* No modifiers are supported on CMP */ - shader_addline(buffer, "CMP %s, %s, %s, %s;\n", dst_name, - src_name[0], src_name[2], src_name[1]); - - if(ins->dst[0].modifiers & WINED3DSPDM_SATURATE) - { - shader_arb_get_register_name(ins, &dst->reg, src_name[0], &is_color); - shader_addline(buffer, "MOV_SAT %s, %s;\n", dst_name, src_name[0]); - } + shader_addline(buffer, "CMP%s %s, %s, %s, %s;\n", shader_arb_get_modifier(ins), + dst_name, src_name[0], src_name[2], src_name[1]); } /** Process the WINED3DSIO_DP2ADD instruction in ARB. @@ -1747,17 +1742,20 @@ static void shader_hw_nop(const struct wined3d_shader_instruction *ins) static void shader_hw_mov(const struct wined3d_shader_instruction *ins) { - IWineD3DBaseShaderImpl *shader = (IWineD3DBaseShaderImpl *)ins->ctx->shader; - BOOL pshader = shader_is_pshader_version(shader->baseShader.reg_maps.shader_version.type); + struct wined3d_shader *shader = ins->ctx->shader; + const struct wined3d_shader_reg_maps *reg_maps = ins->ctx->reg_maps; + BOOL pshader = shader_is_pshader_version(reg_maps->shader_version.type); struct shader_arb_ctx_priv *ctx = ins->ctx->backend_data; - const char *zero = arb_get_helper_value(shader->baseShader.reg_maps.shader_version.type, ARB_ZERO); - const char *one = arb_get_helper_value(shader->baseShader.reg_maps.shader_version.type, ARB_ONE); - const char *two = arb_get_helper_value(shader->baseShader.reg_maps.shader_version.type, ARB_TWO); + const char *zero = arb_get_helper_value(reg_maps->shader_version.type, ARB_ZERO); + const char *one = arb_get_helper_value(reg_maps->shader_version.type, ARB_ONE); + const char *two = arb_get_helper_value(reg_maps->shader_version.type, ARB_TWO); struct wined3d_shader_buffer *buffer = ins->ctx->buffer; char src0_param[256]; - if(ins->handler_idx == WINED3DSIH_MOVA) { + if (ins->handler_idx == WINED3DSIH_MOVA) + { + const struct arb_vshader_private *shader_data = shader->backend_data; char write_mask[6]; const char *offset = arb_get_helper_value(WINED3D_SHADER_TYPE_VERTEX, ARB_VS_REL_OFFSET); @@ -1784,19 +1782,22 @@ static void shader_hw_mov(const struct wined3d_shader_instruction *ins) shader_addline(buffer, "ABS TA%s, %s;\n", write_mask, src0_param); shader_addline(buffer, "ADD TA%s, TA, rel_addr_const.x;\n", write_mask); shader_addline(buffer, "FLR TA%s, TA;\n", write_mask); - if (((IWineD3DVertexShaderImpl *)shader)->rel_offset) + if (shader_data->rel_offset) { shader_addline(buffer, "ADD TA%s, TA, %s;\n", write_mask, offset); } shader_addline(buffer, "MUL A0_SHADOW%s, TA, A0_SHADOW;\n", write_mask); ((struct shader_arb_ctx_priv *)ins->ctx->backend_data)->addr_reg[0] = '\0'; - } else if (ins->ctx->reg_maps->shader_version.major == 1 - && !shader_is_pshader_version(ins->ctx->reg_maps->shader_version.type) + } + else if (reg_maps->shader_version.major == 1 + && !shader_is_pshader_version(reg_maps->shader_version.type) && ins->dst[0].reg.type == WINED3DSPR_ADDR) { + const struct arb_vshader_private *shader_data = shader->backend_data; src0_param[0] = '\0'; - if (((IWineD3DVertexShaderImpl *)shader)->rel_offset) + + if (shader_data->rel_offset) { const char *offset = arb_get_helper_value(WINED3D_SHADER_TYPE_VERTEX, ARB_VS_REL_OFFSET); shader_arb_get_src_param(ins, &ins->src[0], 0, src0_param); @@ -1816,8 +1817,7 @@ static void shader_hw_mov(const struct wined3d_shader_instruction *ins) } else if (ins->dst[0].reg.type == WINED3DSPR_COLOROUT && !ins->dst[0].reg.idx && pshader) { - IWineD3DPixelShaderImpl *ps = (IWineD3DPixelShaderImpl *) shader; - if(ctx->cur_ps_args->super.srgb_correction && ps->color0_mov) + if (ctx->cur_ps_args->super.srgb_correction && shader->u.ps.color0_mov) { shader_addline(buffer, "#mov handled in srgb write code\n"); return; @@ -2098,8 +2098,7 @@ static void pshader_hw_texm3x2pad(const struct wined3d_shader_instruction *ins) static void pshader_hw_texm3x2tex(const struct wined3d_shader_instruction *ins) { - IWineD3DBaseShaderImpl *shader = (IWineD3DBaseShaderImpl *)ins->ctx->shader; - IWineD3DDeviceImpl *deviceImpl = (IWineD3DDeviceImpl *)shader->baseShader.device; + struct shader_arb_ctx_priv *priv = ins->ctx->backend_data; DWORD flags; DWORD reg = ins->dst[0].reg.idx; struct wined3d_shader_buffer *buffer = ins->ctx->buffer; @@ -2114,14 +2113,13 @@ static void pshader_hw_texm3x2tex(const struct wined3d_shader_instruction *ins) shader_arb_get_dst_param(ins, &ins->dst[0], dst_str); shader_arb_get_src_param(ins, &ins->src[0], 0, src0_name); shader_addline(buffer, "DP3 %s.y, fragment.texcoord[%u], %s;\n", dst_reg, reg, src0_name); - flags = reg < MAX_TEXTURES ? deviceImpl->stateBlock->state.texture_states[reg][WINED3DTSS_TEXTURETRANSFORMFLAGS] : 0; + flags = reg < MAX_TEXTURES ? priv->cur_ps_args->super.tex_transform >> reg * WINED3D_PSARGS_TEXTRANSFORM_SHIFT : 0; shader_hw_sample(ins, reg, dst_str, dst_reg, flags & WINED3DTTFF_PROJECTED ? TEX_PROJ : 0, NULL, NULL); } static void pshader_hw_texm3x3pad(const struct wined3d_shader_instruction *ins) { - IWineD3DBaseShaderImpl *shader = (IWineD3DBaseShaderImpl *)ins->ctx->shader; - SHADER_PARSE_STATE *current_state = &shader->baseShader.parse_state; + struct wined3d_shader_tex_mx *tex_mx = ins->ctx->tex_mx; DWORD reg = ins->dst[0].reg.idx; struct wined3d_shader_buffer *buffer = ins->ctx->buffer; char src0_name[50], dst_name[50]; @@ -2132,20 +2130,19 @@ static void pshader_hw_texm3x3pad(const struct wined3d_shader_instruction *ins) * incrementing ins->dst[0].register_idx numbers. So the pad instruction already knows the final destination * register, and this register is uninitialized(otherwise the assembler complains that it is 'redeclared') */ - tmp_reg.idx = reg + 2 - current_state->current_row; + tmp_reg.idx = reg + 2 - tex_mx->current_row; shader_arb_get_register_name(ins, &tmp_reg, dst_name, &is_color); shader_arb_get_src_param(ins, &ins->src[0], 0, src0_name); shader_addline(buffer, "DP3 %s.%c, fragment.texcoord[%u], %s;\n", - dst_name, 'x' + current_state->current_row, reg, src0_name); - current_state->texcoord_w[current_state->current_row++] = reg; + dst_name, 'x' + tex_mx->current_row, reg, src0_name); + tex_mx->texcoord_w[tex_mx->current_row++] = reg; } static void pshader_hw_texm3x3tex(const struct wined3d_shader_instruction *ins) { - IWineD3DBaseShaderImpl *shader = (IWineD3DBaseShaderImpl *)ins->ctx->shader; - IWineD3DDeviceImpl *deviceImpl = (IWineD3DDeviceImpl *)shader->baseShader.device; - SHADER_PARSE_STATE *current_state = &shader->baseShader.parse_state; + struct shader_arb_ctx_priv *priv = ins->ctx->backend_data; + struct wined3d_shader_tex_mx *tex_mx = ins->ctx->tex_mx; DWORD flags; DWORD reg = ins->dst[0].reg.idx; struct wined3d_shader_buffer *buffer = ins->ctx->buffer; @@ -2159,16 +2156,15 @@ static void pshader_hw_texm3x3tex(const struct wined3d_shader_instruction *ins) /* Sample the texture using the calculated coordinates */ shader_arb_get_dst_param(ins, &ins->dst[0], dst_str); - flags = reg < MAX_TEXTURES ? deviceImpl->stateBlock->state.texture_states[reg][WINED3DTSS_TEXTURETRANSFORMFLAGS] : 0; + flags = reg < MAX_TEXTURES ? priv->cur_ps_args->super.tex_transform >> reg * WINED3D_PSARGS_TEXTRANSFORM_SHIFT : 0; shader_hw_sample(ins, reg, dst_str, dst_name, flags & WINED3DTTFF_PROJECTED ? TEX_PROJ : 0, NULL, NULL); - current_state->current_row = 0; + tex_mx->current_row = 0; } static void pshader_hw_texm3x3vspec(const struct wined3d_shader_instruction *ins) { - IWineD3DBaseShaderImpl *shader = (IWineD3DBaseShaderImpl *)ins->ctx->shader; - IWineD3DDeviceImpl *deviceImpl = (IWineD3DDeviceImpl *)shader->baseShader.device; - SHADER_PARSE_STATE *current_state = &shader->baseShader.parse_state; + struct shader_arb_ctx_priv *priv = ins->ctx->backend_data; + struct wined3d_shader_tex_mx *tex_mx = ins->ctx->tex_mx; DWORD flags; DWORD reg = ins->dst[0].reg.idx; struct wined3d_shader_buffer *buffer = ins->ctx->buffer; @@ -2185,8 +2181,8 @@ static void pshader_hw_texm3x3vspec(const struct wined3d_shader_instruction *ins shader_addline(buffer, "DP3 %s.z, fragment.texcoord[%u], %s;\n", dst_reg, reg, src0_name); /* Construct the eye-ray vector from w coordinates */ - shader_addline(buffer, "MOV TB.x, fragment.texcoord[%u].w;\n", current_state->texcoord_w[0]); - shader_addline(buffer, "MOV TB.y, fragment.texcoord[%u].w;\n", current_state->texcoord_w[1]); + shader_addline(buffer, "MOV TB.x, fragment.texcoord[%u].w;\n", tex_mx->texcoord_w[0]); + shader_addline(buffer, "MOV TB.y, fragment.texcoord[%u].w;\n", tex_mx->texcoord_w[1]); shader_addline(buffer, "MOV TB.z, fragment.texcoord[%u].w;\n", reg); /* Calculate reflection vector @@ -2201,16 +2197,15 @@ static void pshader_hw_texm3x3vspec(const struct wined3d_shader_instruction *ins /* Sample the texture using the calculated coordinates */ shader_arb_get_dst_param(ins, &ins->dst[0], dst_str); - flags = reg < MAX_TEXTURES ? deviceImpl->stateBlock->state.texture_states[reg][WINED3DTSS_TEXTURETRANSFORMFLAGS] : 0; + flags = reg < MAX_TEXTURES ? priv->cur_ps_args->super.tex_transform >> reg * WINED3D_PSARGS_TEXTRANSFORM_SHIFT : 0; shader_hw_sample(ins, reg, dst_str, dst_reg, flags & WINED3DTTFF_PROJECTED ? TEX_PROJ : 0, NULL, NULL); - current_state->current_row = 0; + tex_mx->current_row = 0; } static void pshader_hw_texm3x3spec(const struct wined3d_shader_instruction *ins) { - IWineD3DBaseShaderImpl *shader = (IWineD3DBaseShaderImpl *)ins->ctx->shader; - IWineD3DDeviceImpl *deviceImpl = (IWineD3DDeviceImpl *)shader->baseShader.device; - SHADER_PARSE_STATE *current_state = &shader->baseShader.parse_state; + struct shader_arb_ctx_priv *priv = ins->ctx->backend_data; + struct wined3d_shader_tex_mx *tex_mx = ins->ctx->tex_mx; DWORD flags; DWORD reg = ins->dst[0].reg.idx; struct wined3d_shader_buffer *buffer = ins->ctx->buffer; @@ -2243,9 +2238,9 @@ static void pshader_hw_texm3x3spec(const struct wined3d_shader_instruction *ins) /* Sample the texture using the calculated coordinates */ shader_arb_get_dst_param(ins, &ins->dst[0], dst_str); - flags = reg < MAX_TEXTURES ? deviceImpl->stateBlock->state.texture_states[reg][WINED3DTSS_TEXTURETRANSFORMFLAGS] : 0; + flags = reg < MAX_TEXTURES ? priv->cur_ps_args->super.tex_transform >> reg * WINED3D_PSARGS_TEXTRANSFORM_SHIFT : 0; shader_hw_sample(ins, reg, dst_str, dst_reg, flags & WINED3DTTFF_PROJECTED ? TEX_PROJ : 0, NULL, NULL); - current_state->current_row = 0; + tex_mx->current_row = 0; } static void pshader_hw_texdepth(const struct wined3d_shader_instruction *ins) @@ -2415,8 +2410,6 @@ static void shader_hw_mnxn(const struct wined3d_shader_instruction *ins) static void shader_hw_rcp(const struct wined3d_shader_instruction *ins) { struct wined3d_shader_buffer *buffer = ins->ctx->buffer; - struct shader_arb_ctx_priv *priv = ins->ctx->backend_data; - const char *flt_eps = arb_get_helper_value(ins->ctx->reg_maps->shader_version.type, ARB_EPS); char dst[50]; char src[50]; @@ -2431,23 +2424,7 @@ static void shader_hw_rcp(const struct wined3d_shader_instruction *ins) strcat(src, ".w"); } - /* TODO: If the destination is readable, and not the same as the source, the destination - * can be used instead of TA - */ - if (priv->target_version >= NV2) - { - shader_addline(buffer, "MOVC TA.x, %s;\n", src); - shader_addline(buffer, "MOV TA.x (EQ.x), %s;\n", flt_eps); - shader_addline(buffer, "RCP%s %s, TA.x;\n", shader_arb_get_modifier(ins), dst); - } - else - { - const char *zero = arb_get_helper_value(ins->ctx->reg_maps->shader_version.type, ARB_ZERO); - shader_addline(buffer, "ABS TA.x, %s;\n", src); - shader_addline(buffer, "SGE TA.y, -TA.x, %s;\n", zero); - shader_addline(buffer, "MAD TA.x, TA.y, %s, %s;\n", flt_eps, src); - shader_addline(buffer, "RCP%s %s, TA.x;\n", shader_arb_get_modifier(ins), dst); - } + shader_addline(buffer, "RCP%s %s, %s;\n", shader_arb_get_modifier(ins), dst, src); } static void shader_hw_scalar_op(const struct wined3d_shader_instruction *ins) @@ -2743,47 +2720,33 @@ static DWORD abs_modifier(DWORD mod, BOOL *need_abs) return mod; } -static void shader_hw_log_pow(const struct wined3d_shader_instruction *ins) +static void shader_hw_log(const struct wined3d_shader_instruction *ins) { struct wined3d_shader_buffer *buffer = ins->ctx->buffer; - char src0[50], src1[50], dst[50]; + char src0[50], dst[50]; struct wined3d_shader_src_param src0_copy = ins->src[0]; BOOL need_abs = FALSE; const char *instr; - BOOL arg2 = FALSE; switch(ins->handler_idx) { case WINED3DSIH_LOG: instr = "LG2"; break; case WINED3DSIH_LOGP: instr = "LOG"; break; - case WINED3DSIH_POW: instr = "POW"; arg2 = TRUE; break; default: ERR("Unexpected instruction %d\n", ins->handler_idx); return; } - /* LOG, LOGP and POW operate on the absolute value of the input */ + /* LOG and LOGP operate on the absolute value of the input */ src0_copy.modifiers = abs_modifier(src0_copy.modifiers, &need_abs); shader_arb_get_dst_param(ins, &ins->dst[0], dst); shader_arb_get_src_param(ins, &src0_copy, 0, src0); - if(arg2) shader_arb_get_src_param(ins, &ins->src[1], 1, src1); if(need_abs) { shader_addline(buffer, "ABS TA, %s;\n", src0); - if(arg2) - { - shader_addline(buffer, "%s%s %s, TA, %s;\n", instr, shader_arb_get_modifier(ins), dst, src1); - } - else - { - shader_addline(buffer, "%s%s %s, TA;\n", instr, shader_arb_get_modifier(ins), dst); - } - } - else if(arg2) - { - shader_addline(buffer, "%s%s %s, %s, %s;\n", instr, shader_arb_get_modifier(ins), dst, src0, src1); + shader_addline(buffer, "%s%s %s, TA;\n", instr, shader_arb_get_modifier(ins), dst); } else { @@ -2791,6 +2754,48 @@ static void shader_hw_log_pow(const struct wined3d_shader_instruction *ins) } } +static void shader_hw_pow(const struct wined3d_shader_instruction *ins) +{ + struct wined3d_shader_buffer *buffer = ins->ctx->buffer; + char src0[50], src1[50], dst[50]; + struct wined3d_shader_src_param src0_copy = ins->src[0]; + BOOL need_abs = FALSE; + struct shader_arb_ctx_priv *priv = ins->ctx->backend_data; + const char *one = arb_get_helper_value(ins->ctx->reg_maps->shader_version.type, ARB_ONE); + + /* POW operates on the absolute value of the input */ + src0_copy.modifiers = abs_modifier(src0_copy.modifiers, &need_abs); + + shader_arb_get_dst_param(ins, &ins->dst[0], dst); + shader_arb_get_src_param(ins, &src0_copy, 0, src0); + shader_arb_get_src_param(ins, &ins->src[1], 1, src1); + + if (need_abs) + shader_addline(buffer, "ABS TA.x, %s;\n", src0); + else + shader_addline(buffer, "MOV TA.x, %s;\n", src0); + + if (priv->target_version >= NV2) + { + shader_addline(buffer, "MOVC TA.y, %s;\n", src1); + shader_addline(buffer, "POW%s %s, TA.x, TA.y;\n", shader_arb_get_modifier(ins), dst); + shader_addline(buffer, "MOV %s (EQ.y), %s;\n", dst, one); + } + else + { + const char *zero = arb_get_helper_value(ins->ctx->reg_maps->shader_version.type, ARB_ZERO); + const char *flt_eps = arb_get_helper_value(ins->ctx->reg_maps->shader_version.type, ARB_EPS); + + shader_addline(buffer, "ABS TA.y, %s;\n", src1); + shader_addline(buffer, "SGE TA.y, -TA.y, %s;\n", zero); + /* Possibly add flt_eps to avoid getting float special values */ + shader_addline(buffer, "MAD TA.z, TA.y, %s, %s;\n", flt_eps, src1); + shader_addline(buffer, "POW%s TA.x, TA.x, TA.z;\n", shader_arb_get_modifier(ins)); + shader_addline(buffer, "MAD TA.x, -TA.x, TA.y, TA.x;\n"); + shader_addline(buffer, "MAD %s, TA.y, %s, TA.x;\n", dst, one); + } +} + static void shader_hw_loop(const struct wined3d_shader_instruction *ins) { struct wined3d_shader_buffer *buffer = ins->ctx->buffer; @@ -3101,12 +3106,11 @@ static void shader_hw_label(const struct wined3d_shader_instruction *ins) shader_addline(buffer, "l%u:\n", ins->src[0].reg.idx); } -static void vshader_add_footer(IWineD3DVertexShaderImpl *This, struct wined3d_shader_buffer *buffer, - const struct arb_vs_compile_args *args, struct shader_arb_ctx_priv *priv_ctx) +static void vshader_add_footer(struct shader_arb_ctx_priv *priv_ctx, + const struct arb_vshader_private *shader_data, const struct arb_vs_compile_args *args, + const struct wined3d_shader_reg_maps *reg_maps, const struct wined3d_gl_info *gl_info, + struct wined3d_shader_buffer *buffer) { - const shader_reg_maps *reg_maps = &This->baseShader.reg_maps; - IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)This->baseShader.device; - const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; unsigned int i; /* The D3DRS_FOGTABLEMODE render state defines if the shader-generated fog coord is used @@ -3114,35 +3118,24 @@ static void vshader_add_footer(IWineD3DVertexShaderImpl *This, struct wined3d_sh * the fog frag coord is thrown away. If the fog frag coord is used, but not written by * the shader, it is set to 0.0(fully fogged, since start = 1.0, end = 0.0) */ - if(args->super.fog_src == VS_FOG_Z) { + if (args->super.fog_src == VS_FOG_Z) shader_addline(buffer, "MOV result.fogcoord, TMP_OUT.z;\n"); - } else if (!reg_maps->fog) { - /* posFixup.x is always 1.0, so we can savely use it */ + else if (!reg_maps->fog) + /* posFixup.x is always 1.0, so we can safely use it */ shader_addline(buffer, "ADD result.fogcoord, posFixup.x, -posFixup.x;\n"); - } - /* Write the final position. - * - * OpenGL coordinates specify the center of the pixel while d3d coords specify - * the corner. The offsets are stored in z and w in posFixup. posFixup.y contains - * 1.0 or -1.0 to turn the rendering upside down for offscreen rendering. PosFixup.x - * contains 1.0 to allow a mad, but arb vs swizzles are too restricted for that. - */ - shader_addline(buffer, "MUL TA, posFixup, TMP_OUT.w;\n"); - shader_addline(buffer, "ADD TMP_OUT.x, TMP_OUT.x, TA.z;\n"); - shader_addline(buffer, "MAD TMP_OUT.y, TMP_OUT.y, posFixup.y, TA.w;\n"); - - if(use_nv_clip(gl_info) && priv_ctx->target_version >= NV2) + /* Clipplanes are always stored without y inversion */ + if (use_nv_clip(gl_info) && priv_ctx->target_version >= NV2) { - if(args->super.clip_enabled) + if (args->super.clip_enabled) { - for(i = 0; i < priv_ctx->vs_clipplanes; i++) + for (i = 0; i < priv_ctx->vs_clipplanes; i++) { shader_addline(buffer, "DP4 result.clip[%u].x, TMP_OUT, state.clip[%u].plane;\n", i, i); } } } - else if(args->clip.boolclip.clip_texcoord) + else if (args->clip.boolclip.clip_texcoord) { unsigned int cur_clip = 0; char component[4] = {'x', 'y', 'z', 'w'}; @@ -3150,13 +3143,13 @@ static void vshader_add_footer(IWineD3DVertexShaderImpl *This, struct wined3d_sh for (i = 0; i < gl_info->limits.clipplanes; ++i) { - if(args->clip.boolclip.clipplane_mask & (1 << i)) + if (args->clip.boolclip.clipplane_mask & (1 << i)) { shader_addline(buffer, "DP4 TA.%c, TMP_OUT, state.clip[%u].plane;\n", component[cur_clip++], i); } } - switch(cur_clip) + switch (cur_clip) { case 0: shader_addline(buffer, "MOV TA, %s;\n", zero); @@ -3175,13 +3168,27 @@ static void vshader_add_footer(IWineD3DVertexShaderImpl *This, struct wined3d_sh args->clip.boolclip.clip_texcoord - 1); } + /* Write the final position. + * + * OpenGL coordinates specify the center of the pixel while d3d coords specify + * the corner. The offsets are stored in z and w in posFixup. posFixup.y contains + * 1.0 or -1.0 to turn the rendering upside down for offscreen rendering. PosFixup.x + * contains 1.0 to allow a mad, but arb vs swizzles are too restricted for that. + */ + shader_addline(buffer, "MUL TA, posFixup, TMP_OUT.w;\n"); + shader_addline(buffer, "ADD TMP_OUT.x, TMP_OUT.x, TA.z;\n"); + shader_addline(buffer, "MAD TMP_OUT.y, TMP_OUT.y, posFixup.y, TA.w;\n"); + /* Z coord [0;1]->[-1;1] mapping, see comment in transform_projection in state.c * and the glsl equivalent */ - if(need_helper_const((IWineD3DBaseShaderImpl *) This, gl_info)) { + if (need_helper_const(shader_data, reg_maps, gl_info)) + { const char *two = arb_get_helper_value(WINED3D_SHADER_TYPE_VERTEX, ARB_TWO); shader_addline(buffer, "MAD TMP_OUT.z, TMP_OUT.z, %s, -TMP_OUT.w;\n", two); - } else { + } + else + { shader_addline(buffer, "ADD TMP_OUT.z, TMP_OUT.z, TMP_OUT.z;\n"); shader_addline(buffer, "ADD TMP_OUT.z, TMP_OUT.z, -TMP_OUT.w;\n"); } @@ -3195,14 +3202,15 @@ static void shader_hw_ret(const struct wined3d_shader_instruction *ins) { struct wined3d_shader_buffer *buffer = ins->ctx->buffer; struct shader_arb_ctx_priv *priv = ins->ctx->backend_data; - IWineD3DBaseShaderImpl *shader = (IWineD3DBaseShaderImpl *) ins->ctx->shader; + struct wined3d_shader *shader = ins->ctx->shader; BOOL vshader = shader_is_vshader_version(ins->ctx->reg_maps->shader_version.type); if(priv->target_version == ARB) return; if(vshader) { - if(priv->in_main_func) vshader_add_footer((IWineD3DVertexShaderImpl *) shader, buffer, priv->cur_vs_args, priv); + if (priv->in_main_func) vshader_add_footer(priv, shader->backend_data, + priv->cur_vs_args, ins->ctx->reg_maps, ins->ctx->gl_info, buffer); } shader_addline(buffer, "RET;\n"); @@ -3401,11 +3409,11 @@ static void arbfp_add_sRGB_correction(struct wined3d_shader_buffer *buffer, cons /* [0.0;1.0] clamping. Not needed, this is done implicitly */ } -static const DWORD *find_loop_control_values(IWineD3DBaseShaderImpl *This, DWORD idx) +static const DWORD *find_loop_control_values(const struct wined3d_shader *shader, DWORD idx) { const local_constant *constant; - LIST_FOR_EACH_ENTRY(constant, &This->baseShader.constantsI, local_constant, entry) + LIST_FOR_EACH_ENTRY(constant, &shader->constantsI, local_constant, entry) { if (constant->idx == idx) { @@ -3415,8 +3423,8 @@ static const DWORD *find_loop_control_values(IWineD3DBaseShaderImpl *This, DWORD return NULL; } -static void init_ps_input(const IWineD3DPixelShaderImpl *This, const struct arb_ps_compile_args *args, - struct shader_arb_ctx_priv *priv) +static void init_ps_input(const struct wined3d_shader *shader, + const struct arb_ps_compile_args *args, struct shader_arb_ctx_priv *priv) { static const char * const texcoords[8] = { @@ -3424,7 +3432,7 @@ static void init_ps_input(const IWineD3DPixelShaderImpl *This, const struct arb_ "fragment.texcoord[4]", "fragment.texcoord[5]", "fragment.texcoord[6]", "fragment.texcoord[7]" }; unsigned int i; - const struct wined3d_shader_signature_element *sig = This->baseShader.input_signature; + const struct wined3d_shader_signature_element *sig = shader->input_signature; const char *semantic_name; DWORD semantic_idx; @@ -3490,20 +3498,20 @@ static void init_ps_input(const IWineD3DPixelShaderImpl *This, const struct arb_ } /* GL locking is done by the caller */ -static GLuint shader_arb_generate_pshader(IWineD3DPixelShaderImpl *This, struct wined3d_shader_buffer *buffer, +static GLuint shader_arb_generate_pshader(struct wined3d_shader *shader, + const struct wined3d_gl_info *gl_info, struct wined3d_shader_buffer *buffer, const struct arb_ps_compile_args *args, struct arb_ps_compiled_shader *compiled) { - const shader_reg_maps* reg_maps = &This->baseShader.reg_maps; - CONST DWORD *function = This->baseShader.function; - const struct wined3d_gl_info *gl_info = &((IWineD3DDeviceImpl *)This->baseShader.device)->adapter->gl_info; + const struct wined3d_shader_reg_maps *reg_maps = &shader->reg_maps; + const DWORD *function = shader->function; const local_constant *lconst; GLuint retval; char fragcolor[16]; - DWORD *lconst_map = local_const_mapping((IWineD3DBaseShaderImpl *) This), next_local, cur; + DWORD *lconst_map = local_const_mapping(shader), next_local; struct shader_arb_ctx_priv priv_ctx; BOOL dcl_td = FALSE; BOOL want_nv_prog = FALSE; - struct arb_pshader_private *shader_priv = This->baseShader.backend_data; + struct arb_pshader_private *shader_priv = shader->backend_data; GLint errPos; DWORD map; @@ -3513,7 +3521,7 @@ static GLuint shader_arb_generate_pshader(IWineD3DPixelShaderImpl *This, struct for (i = 0, map = reg_maps->temporary; map; map >>= 1, ++i) { if (!(map & 1) - || (This->color0_mov && i == This->color0_reg) + || (shader->u.ps.color0_mov && i == shader->u.ps.color0_reg) || (reg_maps->shader_version.major < 2 && !i)) continue; @@ -3551,7 +3559,7 @@ static GLuint shader_arb_generate_pshader(IWineD3DPixelShaderImpl *This, struct priv_ctx.cur_ps_args = args; priv_ctx.compiled_fprog = compiled; priv_ctx.cur_np2fixup_info = &compiled->np2fixup_info; - init_ps_input(This, args, &priv_ctx); + init_ps_input(shader, args, &priv_ctx); list_init(&priv_ctx.control_frames); /* Avoid enabling NV_fragment_program* if we do not need it. @@ -3593,7 +3601,7 @@ static GLuint shader_arb_generate_pshader(IWineD3DPixelShaderImpl *This, struct priv_ctx.target_version = ARB; } - if(This->baseShader.reg_maps.highest_render_target > 0) + if (reg_maps->rt_mask > 1) { shader_addline(buffer, "OPTION ARB_draw_buffers;\n"); } @@ -3630,11 +3638,17 @@ static GLuint shader_arb_generate_pshader(IWineD3DPixelShaderImpl *This, struct if (reg_maps->shader_version.major < 2) { strcpy(fragcolor, "R0"); - } else { - if(args->super.srgb_correction) { - if(This->color0_mov) { - sprintf(fragcolor, "R%u", This->color0_reg); - } else { + } + else + { + if (args->super.srgb_correction) + { + if (shader->u.ps.color0_mov) + { + sprintf(fragcolor, "R%u", shader->u.ps.color0_reg); + } + else + { shader_addline(buffer, "TEMP TMP_COLOR;\n"); strcpy(fragcolor, "TMP_COLOR"); } @@ -3651,18 +3665,20 @@ static GLuint shader_arb_generate_pshader(IWineD3DPixelShaderImpl *This, struct } /* Base Declarations */ - next_local = shader_generate_arb_declarations((IWineD3DBaseShader *)This, - reg_maps, buffer, gl_info, lconst_map, NULL, &priv_ctx); + next_local = shader_generate_arb_declarations(shader, reg_maps, + buffer, gl_info, lconst_map, NULL, &priv_ctx); for (i = 0, map = reg_maps->bumpmat; map; map >>= 1, ++i) { + unsigned char bump_const; + if (!(map & 1)) continue; - cur = compiled->numbumpenvmatconsts; - compiled->bumpenvmatconst[cur].const_num = WINED3D_CONST_NUM_UNUSED; - compiled->bumpenvmatconst[cur].texunit = i; - compiled->luminanceconst[cur].const_num = WINED3D_CONST_NUM_UNUSED; - compiled->luminanceconst[cur].texunit = i; + bump_const = compiled->numbumpenvmatconsts; + compiled->bumpenvmatconst[bump_const].const_num = WINED3D_CONST_NUM_UNUSED; + compiled->bumpenvmatconst[bump_const].texunit = i; + compiled->luminanceconst[bump_const].const_num = WINED3D_CONST_NUM_UNUSED; + compiled->luminanceconst[bump_const].texunit = i; /* We can fit the constants into the constant limit for sure because texbem, texbeml, bem and beml are only supported * in 1.x shaders, and GL_ARB_fragment_program has a constant limit of 24 constants. So in the worst case we're loading @@ -3673,16 +3689,16 @@ static GLuint shader_arb_generate_pshader(IWineD3DPixelShaderImpl *This, struct * shaders in newer shader models. Since the bump env parameters have to share their space with NP2 fixup constants, * their location is shader dependent anyway and they cannot be loaded globally. */ - compiled->bumpenvmatconst[cur].const_num = next_local++; + compiled->bumpenvmatconst[bump_const].const_num = next_local++; shader_addline(buffer, "PARAM bumpenvmat%d = program.local[%d];\n", - i, compiled->bumpenvmatconst[cur].const_num); - compiled->numbumpenvmatconsts = cur + 1; + i, compiled->bumpenvmatconst[bump_const].const_num); + compiled->numbumpenvmatconsts = bump_const + 1; if (!(reg_maps->luminanceparams & (1 << i))) continue; - compiled->luminanceconst[cur].const_num = next_local++; + compiled->luminanceconst[bump_const].const_num = next_local++; shader_addline(buffer, "PARAM luminance%d = program.local[%d];\n", - i, compiled->luminanceconst[cur].const_num); + i, compiled->luminanceconst[bump_const].const_num); } for(i = 0; i < MAX_CONST_I; i++) @@ -3690,7 +3706,7 @@ static GLuint shader_arb_generate_pshader(IWineD3DPixelShaderImpl *This, struct compiled->int_consts[i] = WINED3D_CONST_NUM_UNUSED; if (reg_maps->integer_constants & (1 << i) && priv_ctx.target_version >= NV2) { - const DWORD *control_values = find_loop_control_values((IWineD3DBaseShaderImpl *) This, i); + const DWORD *control_values = find_loop_control_values(shader, i); if(control_values) { @@ -3735,6 +3751,7 @@ static GLuint shader_arb_generate_pshader(IWineD3DPixelShaderImpl *This, struct * applied / activated. This will probably result in wrong rendering of the texture, but will save us from * shader compilation errors and the subsequent errors when drawing with this shader. */ if (priv_ctx.cur_ps_args->super.np2_fixup) { + unsigned char cur_fixup_sampler = 0; struct arb_ps_np2fixup_info* const fixup = priv_ctx.cur_np2fixup_info; const WORD map = priv_ctx.cur_ps_args->super.np2_fixup; @@ -3743,13 +3760,12 @@ static GLuint shader_arb_generate_pshader(IWineD3DPixelShaderImpl *This, struct fixup->offset = next_local; fixup->super.active = 0; - cur = 0; for (i = 0; i < MAX_FRAGMENT_SAMPLERS; ++i) { if (!(map & (1 << i))) continue; - if (fixup->offset + (cur >> 1) < max_lconsts) { + if (fixup->offset + (cur_fixup_sampler >> 1) < max_lconsts) { fixup->super.active |= (1 << i); - fixup->super.idx[i] = cur++; + fixup->super.idx[i] = cur_fixup_sampler++; } else { FIXME("No free constant found to load NP2 fixup data into shader. " "Sampling from this texture will probably look wrong.\n"); @@ -3757,7 +3773,7 @@ static GLuint shader_arb_generate_pshader(IWineD3DPixelShaderImpl *This, struct } } - fixup->super.num_consts = (cur + 1) >> 1; + fixup->super.num_consts = (cur_fixup_sampler + 1) >> 1; if (fixup->super.num_consts) { shader_addline(buffer, "PARAM np2fixup[%u] = { program.env[%u..%u] };\n", fixup->super.num_consts, fixup->offset, fixup->super.num_consts + fixup->offset - 1); @@ -3772,7 +3788,7 @@ static GLuint shader_arb_generate_pshader(IWineD3DPixelShaderImpl *This, struct } /* Base Shader Body */ - shader_generate_main((IWineD3DBaseShader *)This, buffer, reg_maps, function, &priv_ctx); + shader_generate_main(shader, buffer, reg_maps, function, &priv_ctx); if(args->super.srgb_correction) { arbfp_add_sRGB_correction(buffer, fragcolor, srgbtmp[0], srgbtmp[1], srgbtmp[2], srgbtmp[3], @@ -3814,8 +3830,10 @@ static GLuint shader_arb_generate_pshader(IWineD3DPixelShaderImpl *This, struct } /* Load immediate constants */ - if(lconst_map) { - LIST_FOR_EACH_ENTRY(lconst, &This->baseShader.constantsF, local_constant, entry) { + if (lconst_map) + { + LIST_FOR_EACH_ENTRY(lconst, &shader->constantsF, local_constant, entry) + { const float *value = (const float *)lconst->value; GL_EXTCALL(glProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, lconst_map[lconst->idx], value)); checkGLcall("glProgramLocalParameter4fvARB"); @@ -3843,7 +3861,7 @@ static int compare_sig(const struct wined3d_shader_signature_element *sig1, cons if ((ret = strcmp(sig1[i].semantic_name, sig2[i].semantic_name))) return ret; if(sig1[i].semantic_idx != sig2[i].semantic_idx) return sig1[i].semantic_idx < sig2[i].semantic_idx ? -1 : 1; if(sig1[i].sysval_semantic != sig2[i].sysval_semantic) return sig1[i].sysval_semantic < sig2[i].sysval_semantic ? -1 : 1; - if(sig1[i].component_type != sig2[i].component_type) return sig1[i].sysval_semantic < sig2[i].component_type ? -1 : 1; + if(sig1[i].component_type != sig2[i].component_type) return sig1[i].component_type < sig2[i].component_type ? -1 : 1; if(sig1[i].register_idx != sig2[i].register_idx) return sig1[i].register_idx < sig2[i].register_idx ? -1 : 1; if(sig1[i].mask != sig2->mask) return sig1[i].mask < sig2[i].mask ? -1 : 1; } @@ -3892,8 +3910,8 @@ static DWORD find_input_signature(struct shader_arb_priv *priv, const struct win return found_sig->idx; } -static void init_output_registers(IWineD3DVertexShaderImpl *shader, DWORD sig_num, struct shader_arb_ctx_priv *priv_ctx, - struct arb_vs_compiled_shader *compiled) +static void init_output_registers(struct wined3d_shader *shader, DWORD sig_num, + struct shader_arb_ctx_priv *priv_ctx, struct arb_vs_compiled_shader *compiled) { unsigned int i, j; static const char * const texcoords[8] = @@ -3901,8 +3919,7 @@ static void init_output_registers(IWineD3DVertexShaderImpl *shader, DWORD sig_nu "result.texcoord[0]", "result.texcoord[1]", "result.texcoord[2]", "result.texcoord[3]", "result.texcoord[4]", "result.texcoord[5]", "result.texcoord[6]", "result.texcoord[7]" }; - IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *) shader->baseShader.device; - IWineD3DBaseShaderClass *baseshader = &shader->baseShader; + struct wined3d_device *device = shader->device; const struct wined3d_shader_signature_element *sig; const char *semantic_name; DWORD semantic_idx, reg_idx; @@ -3930,42 +3947,42 @@ static void init_output_registers(IWineD3DVertexShaderImpl *shader, DWORD sig_nu priv_ctx->fog_output = "result.fogcoord"; /* Map declared regs to builtins. Use "TA" to /dev/null unread output */ - for (i = 0; i < (sizeof(baseshader->output_signature) / sizeof(*baseshader->output_signature)); ++i) + for (i = 0; i < (sizeof(shader->output_signature) / sizeof(*shader->output_signature)); ++i) { - semantic_name = baseshader->output_signature[i].semantic_name; + semantic_name = shader->output_signature[i].semantic_name; if (!semantic_name) continue; if(shader_match_semantic(semantic_name, WINED3DDECLUSAGE_POSITION)) { TRACE("o%u is TMP_OUT\n", i); - if (!baseshader->output_signature[i].semantic_idx) priv_ctx->vs_output[i] = "TMP_OUT"; + if (!shader->output_signature[i].semantic_idx) priv_ctx->vs_output[i] = "TMP_OUT"; else priv_ctx->vs_output[i] = "TA"; } else if(shader_match_semantic(semantic_name, WINED3DDECLUSAGE_PSIZE)) { TRACE("o%u is result.pointsize\n", i); - if (!baseshader->output_signature[i].semantic_idx) priv_ctx->vs_output[i] = "result.pointsize"; + if (!shader->output_signature[i].semantic_idx) priv_ctx->vs_output[i] = "result.pointsize"; else priv_ctx->vs_output[i] = "TA"; } else if(shader_match_semantic(semantic_name, WINED3DDECLUSAGE_COLOR)) { - TRACE("o%u is result.color.?, idx %u\n", i, baseshader->output_signature[i].semantic_idx); - if (!baseshader->output_signature[i].semantic_idx) + TRACE("o%u is result.color.?, idx %u\n", i, shader->output_signature[i].semantic_idx); + if (!shader->output_signature[i].semantic_idx) priv_ctx->vs_output[i] = "result.color.primary"; - else if (baseshader->output_signature[i].semantic_idx == 1) + else if (shader->output_signature[i].semantic_idx == 1) priv_ctx->vs_output[i] = "result.color.secondary"; else priv_ctx->vs_output[i] = "TA"; } else if(shader_match_semantic(semantic_name, WINED3DDECLUSAGE_TEXCOORD)) { - TRACE("o%u is %s\n", i, texcoords[baseshader->output_signature[i].semantic_idx]); - if (baseshader->output_signature[i].semantic_idx >= 8) priv_ctx->vs_output[i] = "TA"; - else priv_ctx->vs_output[i] = texcoords[baseshader->output_signature[i].semantic_idx]; + TRACE("o%u is %s\n", i, texcoords[shader->output_signature[i].semantic_idx]); + if (shader->output_signature[i].semantic_idx >= 8) priv_ctx->vs_output[i] = "TA"; + else priv_ctx->vs_output[i] = texcoords[shader->output_signature[i].semantic_idx]; } else if(shader_match_semantic(semantic_name, WINED3DDECLUSAGE_FOG)) { TRACE("o%u is result.fogcoord\n", i); - if (baseshader->output_signature[i].semantic_idx > 0) priv_ctx->vs_output[i] = "TA"; + if (shader->output_signature[i].semantic_idx > 0) priv_ctx->vs_output[i] = "TA"; else priv_ctx->vs_output[i] = "result.fogcoord"; } else @@ -3979,7 +3996,7 @@ static void init_output_registers(IWineD3DVertexShaderImpl *shader, DWORD sig_nu /* Instead of searching for the signature in the signature list, read the one from the current pixel shader. * Its maybe not the shader where the signature came from, but it is the same signature and faster to find */ - sig = device->stateBlock->state.pixel_shader->baseShader.input_signature; + sig = device->stateBlock->state.pixel_shader->input_signature; TRACE("Pixel shader uses declared varyings\n"); /* Map builtin to declared. /dev/null the results by default to the TA temp reg */ @@ -4029,21 +4046,21 @@ static void init_output_registers(IWineD3DVertexShaderImpl *shader, DWORD sig_nu } /* Map declared to declared */ - for (i = 0; i < (sizeof(baseshader->output_signature) / sizeof(*baseshader->output_signature)); ++i) + for (i = 0; i < (sizeof(shader->output_signature) / sizeof(*shader->output_signature)); ++i) { /* Write unread output to TA to throw them away */ priv_ctx->vs_output[i] = "TA"; - semantic_name = baseshader->output_signature[i].semantic_name; + semantic_name = shader->output_signature[i].semantic_name; if (!semantic_name) continue; if (shader_match_semantic(semantic_name, WINED3DDECLUSAGE_POSITION) - && !baseshader->output_signature[i].semantic_idx) + && !shader->output_signature[i].semantic_idx) { priv_ctx->vs_output[i] = "TMP_OUT"; continue; } else if (shader_match_semantic(semantic_name, WINED3DDECLUSAGE_PSIZE) - && !baseshader->output_signature[i].semantic_idx) + && !shader->output_signature[i].semantic_idx) { priv_ctx->vs_output[i] = "result.pointsize"; continue; @@ -4054,7 +4071,7 @@ static void init_output_registers(IWineD3DVertexShaderImpl *shader, DWORD sig_nu if (!sig[j].semantic_name) continue; if (!strcmp(sig[j].semantic_name, semantic_name) - && sig[j].semantic_idx == baseshader->output_signature[i].semantic_idx) + && sig[j].semantic_idx == shader->output_signature[i].semantic_idx) { priv_ctx->vs_output[i] = decl_idx_to_string[sig[j].register_idx]; @@ -4069,16 +4086,16 @@ static void init_output_registers(IWineD3DVertexShaderImpl *shader, DWORD sig_nu } /* GL locking is done by the caller */ -static GLuint shader_arb_generate_vshader(IWineD3DVertexShaderImpl *This, struct wined3d_shader_buffer *buffer, +static GLuint shader_arb_generate_vshader(struct wined3d_shader *shader, + const struct wined3d_gl_info *gl_info, struct wined3d_shader_buffer *buffer, const struct arb_vs_compile_args *args, struct arb_vs_compiled_shader *compiled) { - const shader_reg_maps *reg_maps = &This->baseShader.reg_maps; - CONST DWORD *function = This->baseShader.function; - IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)This->baseShader.device; - const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; + const struct arb_vshader_private *shader_data = shader->backend_data; + const struct wined3d_shader_reg_maps *reg_maps = &shader->reg_maps; + const DWORD *function = shader->function; const local_constant *lconst; GLuint ret; - DWORD next_local, *lconst_map = local_const_mapping((IWineD3DBaseShaderImpl *) This); + DWORD next_local, *lconst_map = local_const_mapping(shader); struct shader_arb_ctx_priv priv_ctx; unsigned int i; GLint errPos; @@ -4086,7 +4103,7 @@ static GLuint shader_arb_generate_vshader(IWineD3DVertexShaderImpl *This, struct memset(&priv_ctx, 0, sizeof(priv_ctx)); priv_ctx.cur_vs_args = args; list_init(&priv_ctx.control_frames); - init_output_registers(This, args->ps_signature, &priv_ctx, compiled); + init_output_registers(shader, args->ps_signature, &priv_ctx, compiled); /* Create the hw ARB shader */ shader_addline(buffer, "!!ARBvp1.0\n"); @@ -4110,26 +4127,29 @@ static GLuint shader_arb_generate_vshader(IWineD3DVertexShaderImpl *This, struct } shader_addline(buffer, "TEMP TMP_OUT;\n"); - if(need_helper_const((IWineD3DBaseShaderImpl *) This, gl_info)) { + if (need_helper_const(shader_data, reg_maps, gl_info)) + { shader_addline(buffer, "PARAM helper_const = { 0.0, 1.0, 2.0, %1.10f};\n", eps); } - if(need_rel_addr_const((IWineD3DBaseShaderImpl *) This, gl_info)) { - shader_addline(buffer, "PARAM rel_addr_const = { 0.5, %d.0, 0.0, 0.0 };\n", This->rel_offset); + if (need_rel_addr_const(shader_data, reg_maps, gl_info)) + { + shader_addline(buffer, "PARAM rel_addr_const = { 0.5, %d.0, 0.0, 0.0 };\n", shader_data->rel_offset); shader_addline(buffer, "TEMP A0_SHADOW;\n"); } shader_addline(buffer, "TEMP TA;\n"); + shader_addline(buffer, "TEMP TB;\n"); /* Base Declarations */ - next_local = shader_generate_arb_declarations((IWineD3DBaseShader *)This, - reg_maps, buffer, gl_info, lconst_map, &priv_ctx.vs_clipplanes, &priv_ctx); + next_local = shader_generate_arb_declarations(shader, reg_maps, buffer, + gl_info, lconst_map, &priv_ctx.vs_clipplanes, &priv_ctx); for(i = 0; i < MAX_CONST_I; i++) { compiled->int_consts[i] = WINED3D_CONST_NUM_UNUSED; if(reg_maps->integer_constants & (1 << i) && priv_ctx.target_version >= NV2) { - const DWORD *control_values = find_loop_control_values((IWineD3DBaseShaderImpl *) This, i); + const DWORD *control_values = find_loop_control_values(shader, i); if(control_values) { @@ -4162,6 +4182,7 @@ static GLuint shader_arb_generate_vshader(IWineD3DVertexShaderImpl *This, struct */ if (!gl_info->supported[NV_VERTEX_PROGRAM]) { + struct wined3d_device *device = shader->device; const char *color_init = arb_get_helper_value(WINED3D_SHADER_TYPE_VERTEX, ARB_0001); shader_addline(buffer, "MOV result.color.secondary, %s;\n", color_init); @@ -4171,8 +4192,7 @@ static GLuint shader_arb_generate_vshader(IWineD3DVertexShaderImpl *This, struct const char *one = arb_get_helper_value(WINED3D_SHADER_TYPE_VERTEX, ARB_ONE); for(i = 0; i < min(8, MAX_REG_TEXCRD); i++) { - if (This->baseShader.reg_maps.texcoord_mask[i] - && This->baseShader.reg_maps.texcoord_mask[i] != WINED3DSP_WRITEMASK_ALL) + if (reg_maps->texcoord_mask[i] && reg_maps->texcoord_mask[i] != WINED3DSP_WRITEMASK_ALL) shader_addline(buffer, "MOV result.texcoord[%u].w, %s\n", i, one); } } @@ -4181,9 +4201,10 @@ static GLuint shader_arb_generate_vshader(IWineD3DVertexShaderImpl *This, struct /* The shader starts with the main function */ priv_ctx.in_main_func = TRUE; /* Base Shader Body */ - shader_generate_main((IWineD3DBaseShader *)This, buffer, reg_maps, function, &priv_ctx); + shader_generate_main(shader, buffer, reg_maps, function, &priv_ctx); - if(!priv_ctx.footer_written) vshader_add_footer(This, buffer, args, &priv_ctx); + if (!priv_ctx.footer_written) vshader_add_footer(&priv_ctx, + shader_data, args, reg_maps, gl_info, buffer); shader_addline(buffer, "END\n"); @@ -4216,8 +4237,10 @@ static GLuint shader_arb_generate_vshader(IWineD3DVertexShaderImpl *This, struct if (!native) WARN("Program exceeds native resource limits.\n"); /* Load immediate constants */ - if(lconst_map) { - LIST_FOR_EACH_ENTRY(lconst, &This->baseShader.constantsF, local_constant, entry) { + if (lconst_map) + { + LIST_FOR_EACH_ENTRY(lconst, &shader->constantsF, local_constant, entry) + { const float *value = (const float *)lconst->value; GL_EXTCALL(glProgramLocalParameter4fvARB(GL_VERTEX_PROGRAM_ARB, lconst_map[lconst->idx], value)); } @@ -4229,9 +4252,11 @@ static GLuint shader_arb_generate_vshader(IWineD3DVertexShaderImpl *This, struct } /* GL locking is done by the caller */ -static struct arb_ps_compiled_shader *find_arb_pshader(IWineD3DPixelShaderImpl *shader, const struct arb_ps_compile_args *args) +static struct arb_ps_compiled_shader *find_arb_pshader(struct wined3d_shader *shader, + const struct arb_ps_compile_args *args) { - IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)shader->baseShader.device; + struct wined3d_device *device = shader->device; + const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; UINT i; DWORD new_size; struct arb_ps_compiled_shader *new_array; @@ -4239,28 +4264,29 @@ static struct arb_ps_compiled_shader *find_arb_pshader(IWineD3DPixelShaderImpl * struct arb_pshader_private *shader_data; GLuint ret; - if (!shader->baseShader.backend_data) + if (!shader->backend_data) { - const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; struct shader_arb_priv *priv = device->shader_priv; - shader->baseShader.backend_data = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*shader_data)); - shader_data = shader->baseShader.backend_data; - shader_data->clamp_consts = shader->baseShader.reg_maps.shader_version.major == 1; + shader->backend_data = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*shader_data)); + shader_data = shader->backend_data; + shader_data->clamp_consts = shader->reg_maps.shader_version.major == 1; - if(shader->baseShader.reg_maps.shader_version.major < 3) shader_data->input_signature_idx = ~0; - else shader_data->input_signature_idx = find_input_signature(priv, shader->baseShader.input_signature); + if (shader->reg_maps.shader_version.major < 3) + shader_data->input_signature_idx = ~0; + else + shader_data->input_signature_idx = find_input_signature(priv, shader->input_signature); shader_data->has_signature_idx = TRUE; TRACE("Shader got assigned input signature index %u\n", shader_data->input_signature_idx); if (!device->vs_clipping) - shader_data->clipplane_emulation = shader_find_free_input_register(&shader->baseShader.reg_maps, + shader_data->clipplane_emulation = shader_find_free_input_register(&shader->reg_maps, gl_info->limits.texture_stages - 1); else shader_data->clipplane_emulation = ~0U; } - shader_data = shader->baseShader.backend_data; + shader_data = shader->backend_data; /* Usually we have very few GL shaders for each d3d shader(just 1 or maybe 2), * so a linear search is more performant than a hashmap or a binary search @@ -4294,8 +4320,7 @@ static struct arb_ps_compiled_shader *find_arb_pshader(IWineD3DPixelShaderImpl * shader_data->gl_shaders[shader_data->num_gl_shaders].args = *args; - pixelshader_update_samplers(&shader->baseShader.reg_maps, - (IWineD3DBaseTexture **)device->stateBlock->state.textures); + pixelshader_update_samplers(&shader->reg_maps, device->stateBlock->state.textures); if (!shader_buffer_init(&buffer)) { @@ -4303,8 +4328,8 @@ static struct arb_ps_compiled_shader *find_arb_pshader(IWineD3DPixelShaderImpl * return 0; } - ret = shader_arb_generate_pshader(shader, &buffer, args, - &shader_data->gl_shaders[shader_data->num_gl_shaders]); + ret = shader_arb_generate_pshader(shader, gl_info, &buffer, args, + &shader_data->gl_shaders[shader_data->num_gl_shaders]); shader_buffer_free(&buffer); shader_data->gl_shaders[shader_data->num_gl_shaders].prgId = ret; @@ -4324,22 +4349,42 @@ static inline BOOL vs_args_equal(const struct arb_vs_compile_args *stored, const return !memcmp(stored->loop_ctrl, new->loop_ctrl, sizeof(stored->loop_ctrl)); } -static struct arb_vs_compiled_shader *find_arb_vshader(IWineD3DVertexShaderImpl *shader, const struct arb_vs_compile_args *args) +static struct arb_vs_compiled_shader *find_arb_vshader(struct wined3d_shader *shader, + const struct arb_vs_compile_args *args) { + struct wined3d_device *device = shader->device; + const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; + DWORD use_map = device->strided_streams.use_map; UINT i; DWORD new_size; struct arb_vs_compiled_shader *new_array; - DWORD use_map = ((IWineD3DDeviceImpl *)shader->baseShader.device)->strided_streams.use_map; struct wined3d_shader_buffer buffer; struct arb_vshader_private *shader_data; GLuint ret; - const struct wined3d_gl_info *gl_info = &((IWineD3DDeviceImpl *)shader->baseShader.device)->adapter->gl_info; - if (!shader->baseShader.backend_data) + if (!shader->backend_data) { - shader->baseShader.backend_data = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*shader_data)); + const struct wined3d_shader_reg_maps *reg_maps = &shader->reg_maps; + + shader->backend_data = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*shader_data)); + shader_data = shader->backend_data; + + if ((gl_info->quirks & WINED3D_QUIRK_ARB_VS_OFFSET_LIMIT) + && reg_maps->min_rel_offset <= reg_maps->max_rel_offset) + { + if (reg_maps->max_rel_offset - reg_maps->min_rel_offset > 127) + { + FIXME("The difference between the minimum and maximum relative offset is > 127.\n"); + FIXME("Which this OpenGL implementation does not support. Try using GLSL.\n"); + FIXME("Min: %u, Max: %u.\n", reg_maps->min_rel_offset, reg_maps->max_rel_offset); + } + else if (reg_maps->max_rel_offset - reg_maps->min_rel_offset > 63) + shader_data->rel_offset = reg_maps->min_rel_offset + 63; + else if (reg_maps->max_rel_offset > 63) + shader_data->rel_offset = reg_maps->min_rel_offset; + } } - shader_data = shader->baseShader.backend_data; + shader_data = shader->backend_data; /* Usually we have very few GL shaders for each d3d shader(just 1 or maybe 2), * so a linear search is more performant than a hashmap or a binary search @@ -4382,7 +4427,7 @@ static struct arb_vs_compiled_shader *find_arb_vshader(IWineD3DVertexShaderImpl return 0; } - ret = shader_arb_generate_vshader(shader, &buffer, args, + ret = shader_arb_generate_vshader(shader, gl_info, &buffer, args, &shader_data->gl_shaders[shader_data->num_gl_shaders]); shader_buffer_free(&buffer); shader_data->gl_shaders[shader_data->num_gl_shaders].prgId = ret; @@ -4391,16 +4436,17 @@ static struct arb_vs_compiled_shader *find_arb_vshader(IWineD3DVertexShaderImpl } static void find_arb_ps_compile_args(const struct wined3d_state *state, - IWineD3DPixelShaderImpl *shader, struct arb_ps_compile_args *args) + const struct wined3d_shader *shader, struct arb_ps_compile_args *args) { + struct wined3d_device *device = shader->device; + const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; int i; WORD int_skip; - const struct wined3d_gl_info *gl_info = &((IWineD3DDeviceImpl *)shader->baseShader.device)->adapter->gl_info; find_ps_compile_args(state, shader, &args->super); /* This forces all local boolean constants to 1 to make them stateblock independent */ - args->bools = shader->baseShader.reg_maps.local_bool_consts; + args->bools = shader->reg_maps.local_bool_consts; for(i = 0; i < MAX_CONST_B; i++) { @@ -4412,7 +4458,7 @@ static void find_arb_ps_compile_args(const struct wined3d_state *state, * is quite expensive because it forces the driver to disable early Z discards. It is cheaper to * duplicate the shader than have a no-op KIL instruction in every shader */ - if ((!((IWineD3DDeviceImpl *)shader->baseShader.device)->vs_clipping) && use_vs(state) + if (!device->vs_clipping && use_vs(state) && state->render_states[WINED3DRS_CLIPPING] && state->render_states[WINED3DRS_CLIPPLANEENABLE]) args->clip = 1; @@ -4420,7 +4466,7 @@ static void find_arb_ps_compile_args(const struct wined3d_state *state, args->clip = 0; /* Skip if unused or local, or supported natively */ - int_skip = ~shader->baseShader.reg_maps.integer_constants | shader->baseShader.reg_maps.local_int_consts; + int_skip = ~shader->reg_maps.integer_constants | shader->reg_maps.local_int_consts; if (int_skip == 0xffff || gl_info->supported[NV_FRAGMENT_PROGRAM_OPTION]) { memset(&args->loop_ctrl, 0, sizeof(args->loop_ctrl)); @@ -4445,20 +4491,20 @@ static void find_arb_ps_compile_args(const struct wined3d_state *state, } static void find_arb_vs_compile_args(const struct wined3d_state *state, - IWineD3DVertexShaderImpl *shader, struct arb_vs_compile_args *args) + const struct wined3d_shader *shader, struct arb_vs_compile_args *args) { + struct wined3d_device *device = shader->device; + const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; int i; WORD int_skip; - IWineD3DDeviceImpl *dev = (IWineD3DDeviceImpl *)shader->baseShader.device; - const struct wined3d_gl_info *gl_info = &dev->adapter->gl_info; find_vs_compile_args(state, shader, &args->super); args->clip.boolclip_compare = 0; if (use_ps(state)) { - IWineD3DPixelShaderImpl *ps = state->pixel_shader; - struct arb_pshader_private *shader_priv = ps->baseShader.backend_data; + const struct wined3d_shader *ps = state->pixel_shader; + const struct arb_pshader_private *shader_priv = ps->backend_data; args->ps_signature = shader_priv->input_signature_idx; args->clip.boolclip.clip_texcoord = shader_priv->clipplane_emulation + 1; @@ -4466,7 +4512,7 @@ static void find_arb_vs_compile_args(const struct wined3d_state *state, else { args->ps_signature = ~0; - if(!dev->vs_clipping) + if (!device->vs_clipping) { args->clip.boolclip.clip_texcoord = ffp_clip_emul(state) ? gl_info->limits.texture_stages : 0; } @@ -4481,7 +4527,7 @@ static void find_arb_vs_compile_args(const struct wined3d_state *state, } /* This forces all local boolean constants to 1 to make them stateblock independent */ - args->clip.boolclip.bools = shader->baseShader.reg_maps.local_bool_consts; + args->clip.boolclip.bools = shader->reg_maps.local_bool_consts; /* TODO: Figure out if it would be better to store bool constants as bitmasks in the stateblock */ for(i = 0; i < MAX_CONST_B; i++) { @@ -4489,13 +4535,13 @@ static void find_arb_vs_compile_args(const struct wined3d_state *state, args->clip.boolclip.bools |= ( 1 << i); } - args->vertex.samplers[0] = dev->texUnitMap[MAX_FRAGMENT_SAMPLERS + 0]; - args->vertex.samplers[1] = dev->texUnitMap[MAX_FRAGMENT_SAMPLERS + 1]; - args->vertex.samplers[2] = dev->texUnitMap[MAX_FRAGMENT_SAMPLERS + 2]; + args->vertex.samplers[0] = device->texUnitMap[MAX_FRAGMENT_SAMPLERS + 0]; + args->vertex.samplers[1] = device->texUnitMap[MAX_FRAGMENT_SAMPLERS + 1]; + args->vertex.samplers[2] = device->texUnitMap[MAX_FRAGMENT_SAMPLERS + 2]; args->vertex.samplers[3] = 0; /* Skip if unused or local */ - int_skip = ~shader->baseShader.reg_maps.integer_constants | shader->baseShader.reg_maps.local_int_consts; + int_skip = ~shader->reg_maps.integer_constants | shader->reg_maps.local_int_consts; /* This is about flow control, not clipping. */ if (int_skip == 0xffff || gl_info->supported[NV_VERTEX_PROGRAM2_OPTION]) { @@ -4523,16 +4569,16 @@ static void find_arb_vs_compile_args(const struct wined3d_state *state, /* GL locking is done by the caller */ static void shader_arb_select(const struct wined3d_context *context, BOOL usePS, BOOL useVS) { - IWineD3DDeviceImpl *This = context->swapchain->device; - struct shader_arb_priv *priv = This->shader_priv; + struct wined3d_device *device = context->swapchain->device; + struct shader_arb_priv *priv = device->shader_priv; const struct wined3d_gl_info *gl_info = context->gl_info; - const struct wined3d_state *state = &This->stateBlock->state; + const struct wined3d_state *state = &device->stateBlock->state; int i; /* Deal with pixel shaders first so the vertex shader arg function has the input signature ready */ if (usePS) { - IWineD3DPixelShaderImpl *ps = state->pixel_shader; + struct wined3d_shader *ps = state->pixel_shader; struct arb_ps_compile_args compile_args; struct arb_ps_compiled_shader *compiled; @@ -4551,15 +4597,16 @@ static void shader_arb_select(const struct wined3d_context *context, BOOL usePS, glEnable(GL_FRAGMENT_PROGRAM_ARB); checkGLcall("glEnable(GL_FRAGMENT_PROGRAM_ARB);"); } - TRACE("(%p) : Bound fragment program %u and enabled GL_FRAGMENT_PROGRAM_ARB\n", This, priv->current_fprogram_id); + TRACE("(%p) : Bound fragment program %u and enabled GL_FRAGMENT_PROGRAM_ARB\n", + device, priv->current_fprogram_id); /* Pixel Shader 1.x constants are clamped to [-1;1], Pixel Shader 2.0 constants are not. If switching between * a 1.x and newer shader, reload the first 8 constants */ - if(priv->last_ps_const_clamped != ((struct arb_pshader_private *)ps->baseShader.backend_data)->clamp_consts) + if (priv->last_ps_const_clamped != ((struct arb_pshader_private *)ps->backend_data)->clamp_consts) { - priv->last_ps_const_clamped = ((struct arb_pshader_private *)ps->baseShader.backend_data)->clamp_consts; - This->highest_dirty_ps_const = max(This->highest_dirty_ps_const, 8); + priv->last_ps_const_clamped = ((struct arb_pshader_private *)ps->backend_data)->clamp_consts; + device->highest_dirty_ps_const = max(device->highest_dirty_ps_const, 8); for(i = 0; i < 8; i++) { context->pshader_const_dirty[i] = 1; @@ -4569,12 +4616,13 @@ static void shader_arb_select(const struct wined3d_context *context, BOOL usePS, } else { - shader_arb_ps_local_constants(This); + UINT rt_height = device->fb.render_targets[0]->resource.height; + shader_arb_ps_local_constants(compiled, context, state, rt_height); } /* Force constant reloading for the NP2 fixup (see comment in shader_glsl_select for more info) */ if (compiled->np2fixup_info.super.active) - shader_arb_load_np2fixup_constants((IWineD3DDevice *)This, usePS, useVS); + shader_arb_load_np2fixup_constants(priv, gl_info, state); } else if (gl_info->supported[ARB_FRAGMENT_PROGRAM] && !priv->use_arbfp_fixed_func) { @@ -4589,7 +4637,7 @@ static void shader_arb_select(const struct wined3d_context *context, BOOL usePS, if (useVS) { - IWineD3DVertexShaderImpl *vs = state->vertex_shader; + struct wined3d_shader *vs = state->vertex_shader; struct arb_vs_compile_args compile_args; struct arb_vs_compiled_shader *compiled; @@ -4606,8 +4654,8 @@ static void shader_arb_select(const struct wined3d_context *context, BOOL usePS, /* Enable OpenGL vertex programs */ glEnable(GL_VERTEX_PROGRAM_ARB); checkGLcall("glEnable(GL_VERTEX_PROGRAM_ARB);"); - TRACE("(%p) : Bound vertex program %u and enabled GL_VERTEX_PROGRAM_ARB\n", This, priv->current_vprogram_id); - shader_arb_vs_local_constants(This); + TRACE("(%p) : Bound vertex program %u and enabled GL_VERTEX_PROGRAM_ARB\n", device, priv->current_vprogram_id); + shader_arb_vs_local_constants(compiled, context, state); if(priv->last_vs_color_unclamp != compiled->need_color_unclamp) { priv->last_vs_color_unclamp = compiled->need_color_unclamp; @@ -4630,13 +4678,12 @@ static void shader_arb_select(const struct wined3d_context *context, BOOL usePS, } /* GL locking is done by the caller */ -static void shader_arb_select_depth_blt(IWineD3DDevice *iface, enum tex_types tex_type, const SIZE *ds_mask_size) +static void shader_arb_select_depth_blt(void *shader_priv, const struct wined3d_gl_info *gl_info, + enum tex_types tex_type, const SIZE *ds_mask_size) { const float mask[] = {0.0f, 0.0f, (float)ds_mask_size->cx, (float)ds_mask_size->cy}; - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; BOOL masked = ds_mask_size->cx && ds_mask_size->cy; - struct shader_arb_priv *priv = This->shader_priv; - const struct wined3d_gl_info *gl_info = &This->adapter->gl_info; + struct shader_arb_priv *priv = shader_priv; GLuint *blt_fprogram; if (!priv->depth_blt_vprogram_id) priv->depth_blt_vprogram_id = create_arb_blt_vertex_program(gl_info); @@ -4651,17 +4698,18 @@ static void shader_arb_select_depth_blt(IWineD3DDevice *iface, enum tex_types te } /* GL locking is done by the caller */ -static void shader_arb_deselect_depth_blt(IWineD3DDevice *iface) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - struct shader_arb_priv *priv = This->shader_priv; - const struct wined3d_gl_info *gl_info = &This->adapter->gl_info; +static void shader_arb_deselect_depth_blt(void *shader_priv, const struct wined3d_gl_info *gl_info) +{ + struct shader_arb_priv *priv = shader_priv; if (priv->current_vprogram_id) { GL_EXTCALL(glBindProgramARB(GL_VERTEX_PROGRAM_ARB, priv->current_vprogram_id)); checkGLcall("glBindProgramARB(GL_VERTEX_PROGRAM_ARB, vertexShader->prgId);"); - TRACE("(%p) : Bound vertex program %u and enabled GL_VERTEX_PROGRAM_ARB\n", This, priv->current_vprogram_id); - } else { + TRACE("Bound vertex program %u and enabled GL_VERTEX_PROGRAM_ARB.\n", priv->current_vprogram_id); + } + else + { glDisable(GL_VERTEX_PROGRAM_ARB); checkGLcall("glDisable(GL_VERTEX_PROGRAM_ARB)"); } @@ -4670,21 +4718,23 @@ static void shader_arb_deselect_depth_blt(IWineD3DDevice *iface) { GL_EXTCALL(glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, priv->current_fprogram_id)); checkGLcall("glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, pixelShader->prgId);"); - TRACE("(%p) : Bound fragment program %u and enabled GL_FRAGMENT_PROGRAM_ARB\n", This, priv->current_fprogram_id); - } else if(!priv->use_arbfp_fixed_func) { + TRACE("Bound fragment program %u and enabled GL_FRAGMENT_PROGRAM_ARB.\n", priv->current_fprogram_id); + } + else if(!priv->use_arbfp_fixed_func) + { glDisable(GL_FRAGMENT_PROGRAM_ARB); checkGLcall("glDisable(GL_FRAGMENT_PROGRAM_ARB)"); } } -static void shader_arb_destroy(IWineD3DBaseShader *iface) { - IWineD3DBaseShaderImpl *baseShader = (IWineD3DBaseShaderImpl *) iface; - IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)baseShader->baseShader.device; +static void shader_arb_destroy(struct wined3d_shader *shader) +{ + struct wined3d_device *device = shader->device; const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; - if (shader_is_pshader_version(baseShader->baseShader.reg_maps.shader_version.type)) + if (shader_is_pshader_version(shader->reg_maps.shader_version.type)) { - struct arb_pshader_private *shader_data = baseShader->baseShader.backend_data; + struct arb_pshader_private *shader_data = shader->backend_data; UINT i; if(!shader_data) return; /* This can happen if a shader was never compiled */ @@ -4706,11 +4756,11 @@ static void shader_arb_destroy(IWineD3DBaseShader *iface) { HeapFree(GetProcessHeap(), 0, shader_data->gl_shaders); HeapFree(GetProcessHeap(), 0, shader_data); - baseShader->baseShader.backend_data = NULL; + shader->backend_data = NULL; } else { - struct arb_vshader_private *shader_data = baseShader->baseShader.backend_data; + struct arb_vshader_private *shader_data = shader->backend_data; UINT i; if(!shader_data) return; /* This can happen if a shader was never compiled */ @@ -4732,7 +4782,7 @@ static void shader_arb_destroy(IWineD3DBaseShader *iface) { HeapFree(GetProcessHeap(), 0, shader_data->gl_shaders); HeapFree(GetProcessHeap(), 0, shader_data); - baseShader->baseShader.backend_data = NULL; + shader->backend_data = NULL; } } @@ -4750,8 +4800,8 @@ static const struct wine_rb_functions sig_tree_functions = sig_tree_compare }; -static HRESULT shader_arb_alloc(IWineD3DDevice *iface) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; +static HRESULT shader_arb_alloc(struct wined3d_device *device) +{ struct shader_arb_priv *priv = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*priv)); if(wine_rb_init(&priv->signature_tree, &sig_tree_functions) == -1) { @@ -4759,7 +4809,7 @@ static HRESULT shader_arb_alloc(IWineD3DDevice *iface) { HeapFree(GetProcessHeap(), 0, priv); return E_OUTOFMEMORY; } - This->shader_priv = priv; + device->shader_priv = priv; return WINED3D_OK; } @@ -4776,10 +4826,10 @@ static void release_signature(struct wine_rb_entry *entry, void *context) } /* Context activation is done by the caller. */ -static void shader_arb_free(IWineD3DDevice *iface) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - const struct wined3d_gl_info *gl_info = &This->adapter->gl_info; - struct shader_arb_priv *priv = This->shader_priv; +static void shader_arb_free(struct wined3d_device *device) +{ + const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; + struct shader_arb_priv *priv = device->shader_priv; int i; ENTER_GL(); @@ -4800,14 +4850,15 @@ static void shader_arb_free(IWineD3DDevice *iface) { LEAVE_GL(); wine_rb_destroy(&priv->signature_tree, release_signature, NULL); - HeapFree(GetProcessHeap(), 0, This->shader_priv); + HeapFree(GetProcessHeap(), 0, device->shader_priv); } -static BOOL shader_arb_dirty_const(IWineD3DDevice *iface) { +static BOOL shader_arb_dirty_const(void) +{ return TRUE; } -static void shader_arb_get_caps(const struct wined3d_gl_info *gl_info, struct shader_caps *pCaps) +static void shader_arb_get_caps(const struct wined3d_gl_info *gl_info, struct shader_caps *caps) { if (gl_info->supported[ARB_VERTEX_PROGRAM]) { @@ -4824,26 +4875,26 @@ static void shader_arb_get_caps(const struct wined3d_gl_info *gl_info, struct sh if (gl_info->supported[NV_VERTEX_PROGRAM3]) { - pCaps->VertexShaderVersion = WINED3DVS_VERSION(3,0); + caps->VertexShaderVersion = WINED3DVS_VERSION(3,0); TRACE_(d3d_caps)("Hardware vertex shader version 3.0 enabled (NV_VERTEX_PROGRAM3)\n"); } else if (vs_consts >= 256) { /* Shader Model 2.0 requires at least 256 vertex shader constants */ - pCaps->VertexShaderVersion = WINED3DVS_VERSION(2,0); + caps->VertexShaderVersion = WINED3DVS_VERSION(2,0); TRACE_(d3d_caps)("Hardware vertex shader version 2.0 enabled (ARB_PROGRAM)\n"); } else { - pCaps->VertexShaderVersion = WINED3DVS_VERSION(1,1); + caps->VertexShaderVersion = WINED3DVS_VERSION(1,1); TRACE_(d3d_caps)("Hardware vertex shader version 1.1 enabled (ARB_PROGRAM)\n"); } - pCaps->MaxVertexShaderConst = vs_consts; + caps->MaxVertexShaderConst = vs_consts; } else { - pCaps->VertexShaderVersion = 0; - pCaps->MaxVertexShaderConst = 0; + caps->VertexShaderVersion = 0; + caps->MaxVertexShaderConst = 0; } if (gl_info->supported[ARB_FRAGMENT_PROGRAM]) @@ -4859,31 +4910,31 @@ static void shader_arb_get_caps(const struct wined3d_gl_info *gl_info, struct sh if (gl_info->supported[NV_FRAGMENT_PROGRAM2]) { - pCaps->PixelShaderVersion = WINED3DPS_VERSION(3,0); + caps->PixelShaderVersion = WINED3DPS_VERSION(3,0); TRACE_(d3d_caps)("Hardware pixel shader version 3.0 enabled (NV_FRAGMENT_PROGRAM2)\n"); } else if (ps_consts >= 32) { /* Shader Model 2.0 requires at least 32 pixel shader constants */ - pCaps->PixelShaderVersion = WINED3DPS_VERSION(2,0); + caps->PixelShaderVersion = WINED3DPS_VERSION(2,0); TRACE_(d3d_caps)("Hardware pixel shader version 2.0 enabled (ARB_PROGRAM)\n"); } else { - pCaps->PixelShaderVersion = WINED3DPS_VERSION(1,4); + caps->PixelShaderVersion = WINED3DPS_VERSION(1,4); TRACE_(d3d_caps)("Hardware pixel shader version 1.4 enabled (ARB_PROGRAM)\n"); } - pCaps->PixelShader1xMaxValue = 8.0f; - pCaps->MaxPixelShaderConst = ps_consts; + caps->PixelShader1xMaxValue = 8.0f; + caps->MaxPixelShaderConst = ps_consts; } else { - pCaps->PixelShaderVersion = 0; - pCaps->PixelShader1xMaxValue = 0.0f; - pCaps->MaxPixelShaderConst = 0; + caps->PixelShaderVersion = 0; + caps->PixelShader1xMaxValue = 0.0f; + caps->MaxPixelShaderConst = 0; } - pCaps->VSClipping = use_nv_clip(gl_info); + caps->VSClipping = use_nv_clip(gl_info); } static BOOL shader_arb_color_fixup_supported(struct color_fixup_desc fixup) @@ -4948,6 +4999,7 @@ static const SHADER_HANDLER shader_arb_instruction_handler_table[WINED3DSIH_TABL /* WINED3DSIH_DEF */ NULL, /* WINED3DSIH_DEFB */ NULL, /* WINED3DSIH_DEFI */ NULL, + /* WINED3DSIH_DIV */ NULL, /* WINED3DSIH_DP2ADD */ pshader_hw_dp2add, /* WINED3DSIH_DP3 */ shader_hw_map2gl, /* WINED3DSIH_DP4 */ shader_hw_map2gl, @@ -4962,15 +5014,19 @@ static const SHADER_HANDLER shader_arb_instruction_handler_table[WINED3DSIH_TABL /* WINED3DSIH_EXP */ shader_hw_scalar_op, /* WINED3DSIH_EXPP */ shader_hw_scalar_op, /* WINED3DSIH_FRC */ shader_hw_map2gl, + /* WINED3DSIH_FTOI */ NULL, /* WINED3DSIH_IADD */ NULL, + /* WINED3DSIH_IEQ */ NULL, /* WINED3DSIH_IF */ NULL /* Hardcoded into the shader */, /* WINED3DSIH_IFC */ shader_hw_ifc, /* WINED3DSIH_IGE */ NULL, /* WINED3DSIH_IMUL */ NULL, + /* WINED3DSIH_ITOF */ NULL, /* WINED3DSIH_LABEL */ shader_hw_label, + /* WINED3DSIH_LD */ NULL, /* WINED3DSIH_LIT */ shader_hw_map2gl, - /* WINED3DSIH_LOG */ shader_hw_log_pow, - /* WINED3DSIH_LOGP */ shader_hw_log_pow, + /* WINED3DSIH_LOG */ shader_hw_log, + /* WINED3DSIH_LOGP */ shader_hw_log, /* WINED3DSIH_LOOP */ shader_hw_loop, /* WINED3DSIH_LRP */ shader_hw_lrp, /* WINED3DSIH_LT */ NULL, @@ -4989,16 +5045,20 @@ static const SHADER_HANDLER shader_arb_instruction_handler_table[WINED3DSIH_TABL /* WINED3DSIH_NOP */ shader_hw_nop, /* WINED3DSIH_NRM */ shader_hw_nrm, /* WINED3DSIH_PHASE */ NULL, - /* WINED3DSIH_POW */ shader_hw_log_pow, + /* WINED3DSIH_POW */ shader_hw_pow, /* WINED3DSIH_RCP */ shader_hw_rcp, /* WINED3DSIH_REP */ shader_hw_rep, /* WINED3DSIH_RET */ shader_hw_ret, /* WINED3DSIH_RSQ */ shader_hw_scalar_op, + /* WINED3DSIH_SAMPLE */ NULL, + /* WINED3DSIH_SAMPLE_GRAD */ NULL, + /* WINED3DSIH_SAMPLE_LOD */ NULL, /* WINED3DSIH_SETP */ NULL, /* WINED3DSIH_SGE */ shader_hw_map2gl, /* WINED3DSIH_SGN */ shader_hw_sgn, /* WINED3DSIH_SINCOS */ shader_hw_sincos, /* WINED3DSIH_SLT */ shader_hw_map2gl, + /* WINED3DSIH_SQRT */ NULL, /* WINED3DSIH_SUB */ shader_hw_map2gl, /* WINED3DSIH_TEX */ pshader_hw_tex, /* WINED3DSIH_TEXBEM */ pshader_hw_texbem, @@ -5022,20 +5082,23 @@ static const SHADER_HANDLER shader_arb_instruction_handler_table[WINED3DSIH_TABL /* WINED3DSIH_TEXREG2AR */ pshader_hw_texreg2ar, /* WINED3DSIH_TEXREG2GB */ pshader_hw_texreg2gb, /* WINED3DSIH_TEXREG2RGB */ pshader_hw_texreg2rgb, + /* WINED3DSIH_UTOF */ NULL, }; -static inline BOOL get_bool_const(const struct wined3d_shader_instruction *ins, IWineD3DBaseShaderImpl *This, DWORD idx) +static BOOL get_bool_const(const struct wined3d_shader_instruction *ins, + const struct wined3d_shader *shader, DWORD idx) { - BOOL vshader = shader_is_vshader_version(This->baseShader.reg_maps.shader_version.type); + const struct wined3d_shader_reg_maps *reg_maps = ins->ctx->reg_maps; + BOOL vshader = shader_is_vshader_version(reg_maps->shader_version.type); WORD bools = 0; WORD flag = (1 << idx); const local_constant *constant; struct shader_arb_ctx_priv *priv = ins->ctx->backend_data; - if(This->baseShader.reg_maps.local_bool_consts & flag) + if (reg_maps->local_bool_consts & flag) { /* What good is a if(bool) with a hardcoded local constant? I don't know, but handle it */ - LIST_FOR_EACH_ENTRY(constant, &This->baseShader.constantsB, local_constant, entry) + LIST_FOR_EACH_ENTRY(constant, &shader->constantsB, local_constant, entry) { if (constant->idx == idx) { @@ -5054,17 +5117,18 @@ static inline BOOL get_bool_const(const struct wined3d_shader_instruction *ins, } static void get_loop_control_const(const struct wined3d_shader_instruction *ins, - IWineD3DBaseShaderImpl *This, UINT idx, struct wined3d_shader_loop_control *loop_control) + const struct wined3d_shader *shader, UINT idx, struct wined3d_shader_loop_control *loop_control) { + const struct wined3d_shader_reg_maps *reg_maps = ins->ctx->reg_maps; struct shader_arb_ctx_priv *priv = ins->ctx->backend_data; /* Integer constants can either be a local constant, or they can be stored in the shader * type specific compile args. */ - if (This->baseShader.reg_maps.local_int_consts & (1 << idx)) + if (reg_maps->local_int_consts & (1 << idx)) { const local_constant *constant; - LIST_FOR_EACH_ENTRY(constant, &This->baseShader.constantsI, local_constant, entry) + LIST_FOR_EACH_ENTRY(constant, &shader->constantsI, local_constant, entry) { if (constant->idx == idx) { @@ -5083,7 +5147,7 @@ static void get_loop_control_const(const struct wined3d_shader_instruction *ins, return; } - switch (This->baseShader.reg_maps.shader_version.type) + switch (reg_maps->shader_version.type) { case WINED3D_SHADER_TYPE_VERTEX: /* Count and aL start value are unsigned */ @@ -5100,7 +5164,7 @@ static void get_loop_control_const(const struct wined3d_shader_instruction *ins, break; default: - FIXME("Unhandled shader type %#x.\n", This->baseShader.reg_maps.shader_version.type); + FIXME("Unhandled shader type %#x.\n", reg_maps->shader_version.type); break; } } @@ -5193,7 +5257,7 @@ static void free_recorded_instruction(struct list *list) static void shader_arb_handle_instruction(const struct wined3d_shader_instruction *ins) { SHADER_HANDLER hw_fct; struct shader_arb_ctx_priv *priv = ins->ctx->backend_data; - IWineD3DBaseShaderImpl *This = (IWineD3DBaseShaderImpl *)ins->ctx->shader; + struct wined3d_shader *shader = ins->ctx->shader; struct control_frame *control_frame; struct wined3d_shader_buffer *buffer = ins->ctx->buffer; BOOL bool_const; @@ -5224,7 +5288,7 @@ static void shader_arb_handle_instruction(const struct wined3d_shader_instructio list_init(&priv->record); priv->recording = TRUE; control_frame->outer_loop = TRUE; - get_loop_control_const(ins, This, ins->src[0].reg.idx, &control_frame->loop_control); + get_loop_control_const(ins, shader, ins->src[0].reg.idx, &control_frame->loop_control); return; /* Instruction is handled */ } /* Record this loop in the outer loop's recording */ @@ -5321,7 +5385,7 @@ static void shader_arb_handle_instruction(const struct wined3d_shader_instructio list_add_head(&priv->control_frames, &control_frame->entry); control_frame->type = IF; - bool_const = get_bool_const(ins, This, ins->src[0].reg.idx); + bool_const = get_bool_const(ins, shader, ins->src[0].reg.idx); if(ins->src[0].modifiers == WINED3DSPSM_NOT) bool_const = !bool_const; if (!priv->muted && !bool_const) { @@ -5408,7 +5472,8 @@ static void shader_arb_handle_instruction(const struct wined3d_shader_instructio shader_arb_add_instruction_modifiers(ins); } -const shader_backend_t arb_program_shader_backend = { +const struct wined3d_shader_backend_ops arb_program_shader_backend = +{ shader_arb_handle_instruction, shader_arb_select, shader_arb_select_depth_blt, @@ -5439,9 +5504,9 @@ struct arbfp_ffp_desc unsigned int num_textures_used; }; -/* Context activation is done by the caller. */ -static void arbfp_enable(IWineD3DDevice *iface, BOOL enable) { - ENTER_GL(); +/* Context activation and GL locking are done by the caller. */ +static void arbfp_enable(BOOL enable) +{ if(enable) { glEnable(GL_FRAGMENT_PROGRAM_ARB); checkGLcall("glEnable(GL_FRAGMENT_PROGRAM_ARB)"); @@ -5449,27 +5514,29 @@ static void arbfp_enable(IWineD3DDevice *iface, BOOL enable) { glDisable(GL_FRAGMENT_PROGRAM_ARB); checkGLcall("glDisable(GL_FRAGMENT_PROGRAM_ARB)"); } - LEAVE_GL(); } -static HRESULT arbfp_alloc(IWineD3DDevice *iface) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface; +static HRESULT arbfp_alloc(struct wined3d_device *device) +{ struct shader_arb_priv *priv; /* Share private data between the shader backend and the pipeline replacement, if both * are the arb implementation. This is needed to figure out whether ARBfp should be disabled * if no pixel shader is bound or not */ - if(This->shader_backend == &arb_program_shader_backend) { - This->fragment_priv = This->shader_priv; - } else { - This->fragment_priv = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct shader_arb_priv)); - if(!This->fragment_priv) return E_OUTOFMEMORY; + if (device->shader_backend == &arb_program_shader_backend) + { + device->fragment_priv = device->shader_priv; } - priv = This->fragment_priv; + else + { + device->fragment_priv = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct shader_arb_priv)); + if (!device->fragment_priv) return E_OUTOFMEMORY; + } + priv = device->fragment_priv; if (wine_rb_init(&priv->fragment_shaders, &wined3d_ffp_frag_program_rb_functions) == -1) { ERR("Failed to initialize rbtree.\n"); - HeapFree(GetProcessHeap(), 0, This->fragment_priv); + HeapFree(GetProcessHeap(), 0, device->fragment_priv); return E_OUTOFMEMORY; } priv->use_arbfp_fixed_func = TRUE; @@ -5490,15 +5557,16 @@ static void arbfp_free_ffpshader(struct wine_rb_entry *entry, void *context) } /* Context activation is done by the caller. */ -static void arbfp_free(IWineD3DDevice *iface) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface; - struct shader_arb_priv *priv = This->fragment_priv; +static void arbfp_free(struct wined3d_device *device) +{ + struct shader_arb_priv *priv = device->fragment_priv; - wine_rb_destroy(&priv->fragment_shaders, arbfp_free_ffpshader, &This->adapter->gl_info); + wine_rb_destroy(&priv->fragment_shaders, arbfp_free_ffpshader, &device->adapter->gl_info); priv->use_arbfp_fixed_func = FALSE; - if(This->shader_backend != &arb_program_shader_backend) { - HeapFree(GetProcessHeap(), 0, This->fragment_priv); + if (device->shader_backend != &arb_program_shader_backend) + { + HeapFree(GetProcessHeap(), 0, device->fragment_priv); } } @@ -5537,11 +5605,12 @@ static void arbfp_get_caps(const struct wined3d_gl_info *gl_info, struct fragmen caps->MaxSimultaneousTextures = min(gl_info->limits.fragment_samplers, 8); } -static void state_texfactor_arbfp(DWORD state_id, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_texfactor_arbfp(DWORD state_id, + struct wined3d_stateblock *stateblock, struct wined3d_context *context) { const struct wined3d_gl_info *gl_info = context->gl_info; const struct wined3d_state *state = &stateblock->state; - IWineD3DDeviceImpl *device = stateblock->device; + struct wined3d_device *device = stateblock->device; float col[4]; /* Don't load the parameter if we're using an arbfp pixel shader, otherwise we'll overwrite @@ -5562,11 +5631,11 @@ static void state_texfactor_arbfp(DWORD state_id, IWineD3DStateBlockImpl *stateb } static void state_arb_specularenable(DWORD state_id, - IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) + struct wined3d_stateblock *stateblock, struct wined3d_context *context) { const struct wined3d_gl_info *gl_info = context->gl_info; const struct wined3d_state *state = &stateblock->state; - IWineD3DDeviceImpl *device = stateblock->device; + struct wined3d_device *device = stateblock->device; float col[4]; /* Don't load the parameter if we're using an arbfp pixel shader, otherwise we'll overwrite @@ -5593,18 +5662,17 @@ static void state_arb_specularenable(DWORD state_id, checkGLcall("glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, ARB_FFP_CONST_SPECULAR_ENABLE, col)"); } -static void set_bumpmat_arbfp(DWORD state_id, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void set_bumpmat_arbfp(DWORD state_id, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { DWORD stage = (state_id - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1); const struct wined3d_gl_info *gl_info = context->gl_info; const struct wined3d_state *state = &stateblock->state; - IWineD3DDeviceImpl *device = stateblock->device; + struct wined3d_device *device = stateblock->device; float mat[2][2]; if (use_ps(state)) { - IWineD3DPixelShaderImpl *ps = state->pixel_shader; - if (stage && (ps->baseShader.reg_maps.bumpmat & (1 << stage))) + if (stage && (state->pixel_shader->reg_maps.bumpmat & (1 << stage))) { /* The pixel shader has to know the bump env matrix. Do a constants update if it isn't scheduled * anyway @@ -5631,18 +5699,18 @@ static void set_bumpmat_arbfp(DWORD state_id, IWineD3DStateBlockImpl *stateblock checkGLcall("glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, ARB_FFP_CONST_BUMPMAT(stage), &mat[0][0])"); } -static void tex_bumpenvlum_arbfp(DWORD state_id, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void tex_bumpenvlum_arbfp(DWORD state_id, + struct wined3d_stateblock *stateblock, struct wined3d_context *context) { DWORD stage = (state_id - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1); const struct wined3d_gl_info *gl_info = context->gl_info; const struct wined3d_state *state = &stateblock->state; - IWineD3DDeviceImpl *device = stateblock->device; + struct wined3d_device *device = stateblock->device; float param[4]; if (use_ps(state)) { - IWineD3DPixelShaderImpl *ps = state->pixel_shader; - if (stage && (ps->baseShader.reg_maps.luminanceparams & (1 << stage))) + if (stage && (state->pixel_shader->reg_maps.luminanceparams & (1 << stage))) { /* The pixel shader has to know the luminance offset. Do a constants update if it * isn't scheduled anyway @@ -5766,12 +5834,14 @@ static void gen_ffp_instr(struct wined3d_shader_buffer *buffer, unsigned int sta case WINED3DTOP_SELECTARG2: arg1 = arg2; + /* FALLTHROUGH */ case WINED3DTOP_SELECTARG1: shader_addline(buffer, "MOV %s%s, %s;\n", dstreg, dstmask, arg1); break; case WINED3DTOP_MODULATE4X: mul = 2; + /* FALLTHROUGH */ case WINED3DTOP_MODULATE2X: mul *= 2; if (!strcmp(dstreg, "result.color")) @@ -5779,6 +5849,7 @@ static void gen_ffp_instr(struct wined3d_shader_buffer *buffer, unsigned int sta dstreg = "ret"; mul_final_dest = TRUE; } + /* FALLTHROUGH */ case WINED3DTOP_MODULATE: shader_addline(buffer, "MUL %s%s, %s, %s;\n", dstreg, dstmask, arg1, arg2); break; @@ -5790,9 +5861,11 @@ static void gen_ffp_instr(struct wined3d_shader_buffer *buffer, unsigned int sta dstreg = "ret"; mul_final_dest = TRUE; } + /* FALLTHROUGH */ case WINED3DTOP_ADDSIGNED: shader_addline(buffer, "SUB arg2, %s, const.w;\n", arg2); arg2 = "arg2"; + /* FALLTHROUGH */ case WINED3DTOP_ADD: shader_addline(buffer, "ADD_SAT %s%s, %s, %s;\n", dstreg, dstmask, arg1, arg2); break; @@ -5883,7 +5956,7 @@ static void gen_ffp_instr(struct wined3d_shader_buffer *buffer, unsigned int sta } } -static GLuint gen_arbfp_ffp_shader(const struct ffp_frag_settings *settings, IWineD3DStateBlockImpl *stateblock) +static GLuint gen_arbfp_ffp_shader(const struct ffp_frag_settings *settings, struct wined3d_stateblock *stateblock) { const struct wined3d_gl_info *gl_info = &stateblock->device->adapter->gl_info; unsigned int stage; @@ -6160,11 +6233,11 @@ static GLuint gen_arbfp_ffp_shader(const struct ffp_frag_settings *settings, IWi return ret; } -static void fragment_prog_arbfp(DWORD state_id, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void fragment_prog_arbfp(DWORD state_id, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { const struct wined3d_gl_info *gl_info = context->gl_info; const struct wined3d_state *state = &stateblock->state; - IWineD3DDeviceImpl *device = stateblock->device; + struct wined3d_device *device = stateblock->device; struct shader_arb_priv *priv = device->fragment_priv; BOOL use_vshader = use_vs(state); BOOL use_pshader = use_ps(state); @@ -6258,7 +6331,7 @@ static void fragment_prog_arbfp(DWORD state_id, IWineD3DStateBlockImpl *stateblo * is that changing the fog start and fog end(which links to FOGENABLE in vertex) results in the * fragment_prog_arbfp function being called because FOGENABLE is dirty, which calls this function here */ -static void state_arbfp_fog(DWORD state_id, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_arbfp_fog(DWORD state_id, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { const struct wined3d_state *state = &stateblock->state; enum fogsource new_source; @@ -6293,11 +6366,10 @@ static void state_arbfp_fog(DWORD state_id, IWineD3DStateBlockImpl *stateblock, } } -static void textransform(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void textransform(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { - if(!isStateDirty(context, STATE_PIXELSHADER)) { + if (!isStateDirty(context, STATE_PIXELSHADER)) fragment_prog_arbfp(state, stateblock, context); - } } static const struct StateEntryTemplate arbfp_fragmentstate_template[] = { @@ -6422,14 +6494,6 @@ static const struct StateEntryTemplate arbfp_fragmentstate_template[] = { {STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT11), { STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT00), NULL }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVLSCALE), { STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVLSCALE), tex_bumpenvlum_arbfp }, WINED3D_GL_EXT_NONE }, {STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVLOFFSET), { STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVLSCALE), NULL }, WINED3D_GL_EXT_NONE }, - {STATE_SAMPLER(0), { STATE_SAMPLER(0), sampler_texdim }, WINED3D_GL_EXT_NONE }, - {STATE_SAMPLER(1), { STATE_SAMPLER(1), sampler_texdim }, WINED3D_GL_EXT_NONE }, - {STATE_SAMPLER(2), { STATE_SAMPLER(2), sampler_texdim }, WINED3D_GL_EXT_NONE }, - {STATE_SAMPLER(3), { STATE_SAMPLER(3), sampler_texdim }, WINED3D_GL_EXT_NONE }, - {STATE_SAMPLER(4), { STATE_SAMPLER(4), sampler_texdim }, WINED3D_GL_EXT_NONE }, - {STATE_SAMPLER(5), { STATE_SAMPLER(5), sampler_texdim }, WINED3D_GL_EXT_NONE }, - {STATE_SAMPLER(6), { STATE_SAMPLER(6), sampler_texdim }, WINED3D_GL_EXT_NONE }, - {STATE_SAMPLER(7), { STATE_SAMPLER(7), sampler_texdim }, WINED3D_GL_EXT_NONE }, {STATE_PIXELSHADER, { STATE_PIXELSHADER, fragment_prog_arbfp }, WINED3D_GL_EXT_NONE }, {STATE_RENDER(WINED3DRS_FOGENABLE), { STATE_RENDER(WINED3DRS_FOGENABLE), state_arbfp_fog }, WINED3D_GL_EXT_NONE }, {STATE_RENDER(WINED3DRS_FOGTABLEMODE), { STATE_RENDER(WINED3DRS_FOGENABLE), NULL }, WINED3D_GL_EXT_NONE }, @@ -6469,8 +6533,8 @@ struct arbfp_blit_priv { GLuint palette_texture; }; -static HRESULT arbfp_blit_alloc(IWineD3DDevice *iface) { - IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *) iface; +static HRESULT arbfp_blit_alloc(struct wined3d_device *device) +{ device->blit_priv = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct arbfp_blit_priv)); if(!device->blit_priv) { ERR("Out of memory\n"); @@ -6480,8 +6544,8 @@ static HRESULT arbfp_blit_alloc(IWineD3DDevice *iface) { } /* Context activation is done by the caller. */ -static void arbfp_blit_free(IWineD3DDevice *iface) { - IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *) iface; +static void arbfp_blit_free(struct wined3d_device *device) +{ const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; struct arbfp_blit_priv *priv = device->blit_priv; @@ -6737,12 +6801,11 @@ static BOOL gen_yv12_read(struct wined3d_shader_buffer *buffer, GLenum textype, return TRUE; } -static GLuint gen_p8_shader(IWineD3DDeviceImpl *device, GLenum textype) +static GLuint gen_p8_shader(struct arbfp_blit_priv *priv, + const struct wined3d_gl_info *gl_info, GLenum textype) { - const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; GLenum shader; struct wined3d_shader_buffer buffer; - struct arbfp_blit_priv *priv = device->blit_priv; GLint pos; /* Shader header */ @@ -6805,10 +6868,10 @@ static GLuint gen_p8_shader(IWineD3DDeviceImpl *device, GLenum textype) } /* Context activation is done by the caller. */ -static void upload_palette(IWineD3DSurfaceImpl *surface) +static void upload_palette(struct wined3d_surface *surface) { BYTE table[256][4]; - IWineD3DDeviceImpl *device = surface->resource.device; + struct wined3d_device *device = surface->resource.device; const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; struct arbfp_blit_priv *priv = device->blit_priv; BOOL colorkey = (surface->CKeyFlags & WINEDDSD_CKSRCBLT) ? TRUE : FALSE; @@ -6838,13 +6901,12 @@ static void upload_palette(IWineD3DSurfaceImpl *surface) } /* Context activation is done by the caller. */ -static GLuint gen_yuv_shader(IWineD3DDeviceImpl *device, enum complex_fixup yuv_fixup, GLenum textype) +static GLuint gen_yuv_shader(struct arbfp_blit_priv *priv, const struct wined3d_gl_info *gl_info, + enum complex_fixup yuv_fixup, GLenum textype) { - const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; GLenum shader; struct wined3d_shader_buffer buffer; char luminance_component; - struct arbfp_blit_priv *priv = device->blit_priv; GLint pos; /* Shader header */ @@ -6995,13 +7057,11 @@ static GLuint gen_yuv_shader(IWineD3DDeviceImpl *device, enum complex_fixup yuv_ } /* Context activation is done by the caller. */ -static HRESULT arbfp_blit_set(IWineD3DDevice *iface, IWineD3DSurfaceImpl *surface) +static HRESULT arbfp_blit_set(void *blit_priv, const struct wined3d_gl_info *gl_info, struct wined3d_surface *surface) { GLenum shader; - IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *) iface; - const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; float size[4] = {(float) surface->pow2Width, (float) surface->pow2Height, 1.0f, 1.0f}; - struct arbfp_blit_priv *priv = device->blit_priv; + struct arbfp_blit_priv *priv = blit_priv; enum complex_fixup fixup; GLenum textype = surface->texture_target; @@ -7035,7 +7095,7 @@ static HRESULT arbfp_blit_set(IWineD3DDevice *iface, IWineD3DSurfaceImpl *surfac case COMPLEX_FIXUP_P8: shader = textype == GL_TEXTURE_RECTANGLE_ARB ? priv->p8_rect_shader : priv->p8_2d_shader; - if (!shader) shader = gen_p8_shader(device, textype); + if (!shader) shader = gen_p8_shader(priv, gl_info, textype); upload_palette(surface); break; @@ -7049,7 +7109,7 @@ static HRESULT arbfp_blit_set(IWineD3DDevice *iface, IWineD3DSurfaceImpl *surfac return E_NOTIMPL; } - if (!shader) shader = gen_yuv_shader(device, fixup, textype); + if (!shader) shader = gen_yuv_shader(priv, gl_info, fixup, textype); ENTER_GL(); glEnable(GL_FRAGMENT_PROGRAM_ARB); @@ -7064,10 +7124,8 @@ static HRESULT arbfp_blit_set(IWineD3DDevice *iface, IWineD3DSurfaceImpl *surfac } /* Context activation is done by the caller. */ -static void arbfp_blit_unset(IWineD3DDevice *iface) { - IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *) iface; - const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; - +static void arbfp_blit_unset(const struct wined3d_gl_info *gl_info) +{ ENTER_GL(); glDisable(GL_FRAGMENT_PROGRAM_ARB); checkGLcall("glDisable(GL_FRAGMENT_PROGRAM_ARB)"); @@ -7086,13 +7144,16 @@ static void arbfp_blit_unset(IWineD3DDevice *iface) { LEAVE_GL(); } -static BOOL arbfp_blit_supported(const struct wined3d_gl_info *gl_info, enum blit_operation blit_op, +static BOOL arbfp_blit_supported(const struct wined3d_gl_info *gl_info, enum wined3d_blit_op blit_op, const RECT *src_rect, DWORD src_usage, WINED3DPOOL src_pool, const struct wined3d_format *src_format, const RECT *dst_rect, DWORD dst_usage, WINED3DPOOL dst_pool, const struct wined3d_format *dst_format) { enum complex_fixup src_fixup; - if (blit_op != BLIT_OP_BLIT) + if (!gl_info->supported[ARB_FRAGMENT_PROGRAM]) + return FALSE; + + if (blit_op != WINED3D_BLIT_OP_COLOR_BLIT) { TRACE("Unsupported blit_op=%d\n", blit_op); return FALSE; @@ -7140,11 +7201,9 @@ static BOOL arbfp_blit_supported(const struct wined3d_gl_info *gl_info, enum bli } } -HRESULT arbfp_blit_surface(IWineD3DDeviceImpl *device, IWineD3DSurfaceImpl *src_surface, const RECT *src_rect, - IWineD3DSurfaceImpl *dst_surface, const RECT *dst_rect_in, enum blit_operation blit_op, - DWORD Filter) +HRESULT arbfp_blit_surface(struct wined3d_device *device, struct wined3d_surface *src_surface, const RECT *src_rect, + struct wined3d_surface *dst_surface, const RECT *dst_rect_in, enum wined3d_blit_op blit_op, DWORD Filter) { - IWineD3DSwapChainImpl *dst_swapchain; struct wined3d_context *context; RECT dst_rect = *dst_rect_in; @@ -7155,17 +7214,10 @@ HRESULT arbfp_blit_surface(IWineD3DDeviceImpl *device, IWineD3DSurfaceImpl *src_ context = context_acquire(device, dst_surface); context_apply_blit_state(context, device); - /* The coordinates of the ddraw front buffer are always fullscreen ('screen coordinates', - * while OpenGL coordinates are window relative. - * Also beware of the origin difference(top left vs bottom left). - * Also beware that the front buffer's surface size is screen width x screen height, - * whereas the real gl drawable size is the size of the window. */ - dst_swapchain = dst_surface->container.type == WINED3D_CONTAINER_SWAPCHAIN - ? dst_surface->container.u.swapchain : NULL; - if (dst_swapchain && dst_surface == dst_swapchain->front_buffer) - surface_translate_frontbuffer_coords(dst_surface, context->win_handle, &dst_rect); + if (!surface_is_offscreen(dst_surface)) + surface_translate_drawable_coords(dst_surface, context->win_handle, &dst_rect); - arbfp_blit_set((IWineD3DDevice *)device, src_surface); + arbfp_blit_set(device->blit_priv, context->gl_info, src_surface); ENTER_GL(); @@ -7175,11 +7227,11 @@ HRESULT arbfp_blit_surface(IWineD3DDeviceImpl *device, IWineD3DSurfaceImpl *src_ LEAVE_GL(); /* Leave the opengl state valid for blitting */ - arbfp_blit_unset((IWineD3DDevice *)device); + arbfp_blit_unset(context->gl_info); - if (wined3d_settings.strict_draw_ordering || (dst_swapchain - && (dst_surface == dst_swapchain->front_buffer - || dst_swapchain->num_contexts > 1))) + if (wined3d_settings.strict_draw_ordering + || (dst_surface->container.type == WINED3D_CONTAINER_SWAPCHAIN + && (dst_surface->container.u.swapchain->front_buffer == dst_surface))) wglFlush(); /* Flush to ensure ordering across contexts. */ context_release(context); @@ -7189,18 +7241,27 @@ HRESULT arbfp_blit_surface(IWineD3DDeviceImpl *device, IWineD3DSurfaceImpl *src_ } /* Do not call while under the GL lock. */ -static HRESULT arbfp_blit_color_fill(IWineD3DDeviceImpl *device, IWineD3DSurfaceImpl *dst_surface, +static HRESULT arbfp_blit_color_fill(struct wined3d_device *device, struct wined3d_surface *dst_surface, const RECT *dst_rect, const WINED3DCOLORVALUE *color) { FIXME("Color filling not implemented by arbfp_blit\n"); return WINED3DERR_INVALIDCALL; } +/* Do not call while under the GL lock. */ +static HRESULT arbfp_blit_depth_fill(struct wined3d_device *device, + struct wined3d_surface *surface, const RECT *rect, float depth) +{ + FIXME("Depth filling not implemented by arbfp_blit.\n"); + return WINED3DERR_INVALIDCALL; +} + const struct blit_shader arbfp_blit = { arbfp_blit_alloc, arbfp_blit_free, arbfp_blit_set, arbfp_blit_unset, arbfp_blit_supported, - arbfp_blit_color_fill + arbfp_blit_color_fill, + arbfp_blit_depth_fill, }; diff --git a/dll/directx/wine/wined3d/ati_fragment_shader.c b/dll/directx/wine/wined3d/ati_fragment_shader.c index 35838e18d73..02817573cb8 100644 --- a/dll/directx/wine/wined3d/ati_fragment_shader.c +++ b/dll/directx/wine/wined3d/ati_fragment_shader.c @@ -796,13 +796,13 @@ static GLuint gen_ati_shader(const struct texture_stage_op op[MAX_TEXTURES], con return ret; } -static void set_tex_op_atifs(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void set_tex_op_atifs(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { const struct wined3d_gl_info *gl_info = context->gl_info; - IWineD3DDeviceImpl *This = stateblock->device; + struct wined3d_device *device = stateblock->device; const struct atifs_ffp_desc *desc; - struct ffp_frag_settings settings; - struct atifs_private_data *priv = This->fragment_priv; + struct ffp_frag_settings settings; + struct atifs_private_data *priv = device->fragment_priv; DWORD mapped_stage; unsigned int i; @@ -832,8 +832,9 @@ static void set_tex_op_atifs(DWORD state, IWineD3DStateBlockImpl *stateblock, st /* GL_ATI_fragment_shader depends on the GL_TEXTURE_xD enable settings. Update the texture stages * used by this shader */ - for(i = 0; i < desc->num_textures_used; i++) { - mapped_stage = This->texUnitMap[i]; + for (i = 0; i < desc->num_textures_used; ++i) + { + mapped_stage = device->texUnitMap[i]; if (mapped_stage != WINED3D_UNMAPPED_STAGE) { GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + mapped_stage)); @@ -845,7 +846,7 @@ static void set_tex_op_atifs(DWORD state, IWineD3DStateBlockImpl *stateblock, st GL_EXTCALL(glBindFragmentShaderATI(desc->shader)); } -static void state_texfactor_atifs(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_texfactor_atifs(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { const struct wined3d_gl_info *gl_info = context->gl_info; float col[4]; @@ -855,7 +856,7 @@ static void state_texfactor_atifs(DWORD state, IWineD3DStateBlockImpl *statebloc checkGLcall("glSetFragmentShaderConstantATI(ATI_FFP_CONST_TFACTOR, col)"); } -static void set_bumpmat(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void set_bumpmat(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1); const struct wined3d_gl_info *gl_info = context->gl_info; @@ -880,17 +881,17 @@ static void set_bumpmat(DWORD state, IWineD3DStateBlockImpl *stateblock, struct checkGLcall("glSetFragmentShaderConstantATI(ATI_FFP_CONST_BUMPMAT(stage), mat)"); } -static void textransform(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void textransform(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { - if(!isStateDirty(context, STATE_PIXELSHADER)) { + if (!isStateDirty(context, STATE_PIXELSHADER)) set_tex_op_atifs(state, stateblock, context); - } } -static void atifs_apply_pixelshader(DWORD state_id, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void atifs_apply_pixelshader(DWORD state_id, + struct wined3d_stateblock *stateblock, struct wined3d_context *context) { const struct wined3d_state *state = &stateblock->state; - IWineD3DDeviceImpl *device = stateblock->device; + struct wined3d_device *device = stateblock->device; BOOL use_vshader = use_vs(state); context->last_was_pshader = use_ps(state); @@ -913,7 +914,7 @@ static void atifs_apply_pixelshader(DWORD state_id, IWineD3DStateBlockImpl *stat } } -static void atifs_srgbwriteenable(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void atifs_srgbwriteenable(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { if (stateblock->state.render_states[WINED3DRS_SRGBWRITEENABLE]) WARN("sRGB writes are not supported by this fragment pipe.\n"); @@ -1053,9 +1054,9 @@ static const struct StateEntryTemplate atifs_fragmentstate_template[] = { {0 /* Terminate */, { 0, 0 }, WINED3D_GL_EXT_NONE }, }; -/* Context activation is done by the caller. */ -static void atifs_enable(IWineD3DDevice *iface, BOOL enable) { - ENTER_GL(); +/* Context activation and GL locking are done by the caller. */ +static void atifs_enable(BOOL enable) +{ if(enable) { glEnable(GL_FRAGMENT_SHADER_ATI); checkGLcall("glEnable(GL_FRAGMENT_SHADER_ATI)"); @@ -1063,7 +1064,6 @@ static void atifs_enable(IWineD3DDevice *iface, BOOL enable) { glDisable(GL_FRAGMENT_SHADER_ATI); checkGLcall("glDisable(GL_FRAGMENT_SHADER_ATI)"); } - LEAVE_GL(); } static void atifs_get_caps(const struct wined3d_gl_info *gl_info, struct fragment_caps *caps) @@ -1113,20 +1113,21 @@ static void atifs_get_caps(const struct wined3d_gl_info *gl_info, struct fragmen caps->MaxSimultaneousTextures = 6; } -static HRESULT atifs_alloc(IWineD3DDevice *iface) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface; +static HRESULT atifs_alloc(struct wined3d_device *device) +{ struct atifs_private_data *priv; - This->fragment_priv = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct atifs_private_data)); - if(!This->fragment_priv) { + device->fragment_priv = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct atifs_private_data)); + if (!device->fragment_priv) + { ERR("Out of memory\n"); return E_OUTOFMEMORY; } - priv = This->fragment_priv; + priv = device->fragment_priv; if (wine_rb_init(&priv->fragment_shaders, &wined3d_ffp_frag_program_rb_functions) == -1) { ERR("Failed to initialize rbtree.\n"); - HeapFree(GetProcessHeap(), 0, This->fragment_priv); + HeapFree(GetProcessHeap(), 0, device->fragment_priv); return E_OUTOFMEMORY; } return WINED3D_OK; @@ -1135,8 +1136,8 @@ static HRESULT atifs_alloc(IWineD3DDevice *iface) { /* Context activation is done by the caller. */ static void atifs_free_ffpshader(struct wine_rb_entry *entry, void *context) { - IWineD3DDeviceImpl *This = context; - const struct wined3d_gl_info *gl_info = &This->adapter->gl_info; + struct wined3d_device *device = context; + const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; struct atifs_ffp_desc *entry_ati = WINE_RB_ENTRY_VALUE(entry, struct atifs_ffp_desc, parent.entry); ENTER_GL(); @@ -1147,14 +1148,14 @@ static void atifs_free_ffpshader(struct wine_rb_entry *entry, void *context) } /* Context activation is done by the caller. */ -static void atifs_free(IWineD3DDevice *iface) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface; - struct atifs_private_data *priv = This->fragment_priv; +static void atifs_free(struct wined3d_device *device) +{ + struct atifs_private_data *priv = device->fragment_priv; - wine_rb_destroy(&priv->fragment_shaders, atifs_free_ffpshader, This); + wine_rb_destroy(&priv->fragment_shaders, atifs_free_ffpshader, device); HeapFree(GetProcessHeap(), 0, priv); - This->fragment_priv = NULL; + device->fragment_priv = NULL; } static BOOL atifs_color_fixup_supported(struct color_fixup_desc fixup) diff --git a/dll/directx/wine/wined3d/basetexture.c b/dll/directx/wine/wined3d/basetexture.c deleted file mode 100644 index bf3b4d4ff70..00000000000 --- a/dll/directx/wine/wined3d/basetexture.c +++ /dev/null @@ -1,542 +0,0 @@ -/* - * IWineD3DBaseTexture Implementation - * - * Copyright 2002-2004 Jason Edmeades - * Copyright 2002-2004 Raphael Junqueira - * Copyright 2005 Oliver Stieber - * Copyright 2007-2008 Stefan Dösinger for CodeWeavers - * Copyright 2009 Henri Verbeet for CodeWeavers - * - * 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 "config.h" -#include "wined3d_private.h" - -WINE_DEFAULT_DEBUG_CHANNEL(d3d_texture); - -HRESULT basetexture_init(IWineD3DBaseTextureImpl *texture, UINT layer_count, UINT level_count, - WINED3DRESOURCETYPE resource_type, IWineD3DDeviceImpl *device, UINT size, DWORD usage, - const struct wined3d_format *format, WINED3DPOOL pool, void *parent, - const struct wined3d_parent_ops *parent_ops) -{ - HRESULT hr; - - hr = resource_init((IWineD3DResource *)texture, resource_type, device, - size, usage, format, pool, parent, parent_ops); - if (FAILED(hr)) - { - WARN("Failed to initialize resource, returning %#x\n", hr); - return hr; - } - - texture->baseTexture.sub_resources = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, - level_count * layer_count * sizeof(*texture->baseTexture.sub_resources)); - if (!texture->baseTexture.sub_resources) - { - ERR("Failed to allocate sub-resource array.\n"); - resource_cleanup((IWineD3DResource *)texture); - return E_OUTOFMEMORY; - } - - texture->baseTexture.layer_count = layer_count; - texture->baseTexture.level_count = level_count; - texture->baseTexture.filterType = (usage & WINED3DUSAGE_AUTOGENMIPMAP) ? WINED3DTEXF_LINEAR : WINED3DTEXF_NONE; - texture->baseTexture.LOD = 0; - texture->baseTexture.texture_rgb.dirty = TRUE; - texture->baseTexture.texture_srgb.dirty = TRUE; - texture->baseTexture.is_srgb = FALSE; - texture->baseTexture.pow2Matrix_identity = TRUE; - - if (texture->resource.format->Flags & WINED3DFMT_FLAG_FILTERING) - { - texture->baseTexture.minMipLookup = minMipLookup; - texture->baseTexture.magLookup = magLookup; - } - else - { - texture->baseTexture.minMipLookup = minMipLookup_noFilter; - texture->baseTexture.magLookup = magLookup_noFilter; - } - - return WINED3D_OK; -} - -void basetexture_cleanup(IWineD3DBaseTexture *iface) -{ - basetexture_unload(iface); - HeapFree(GetProcessHeap(), 0, ((IWineD3DBaseTextureImpl *)iface)->baseTexture.sub_resources); - resource_cleanup((IWineD3DResource *)iface); -} - -IWineD3DResourceImpl *basetexture_get_sub_resource(IWineD3DBaseTextureImpl *texture, UINT layer, UINT level) -{ - if (layer >= texture->baseTexture.layer_count) - { - WARN("layer %u >= layer_count %u.\n", layer, texture->baseTexture.layer_count); - return NULL; - } - - if (level >= texture->baseTexture.level_count) - { - WARN("level %u >= level_count %u.\n", level, texture->baseTexture.level_count); - return NULL; - } - - return texture->baseTexture.sub_resources[layer * texture->baseTexture.level_count + level]; -} - -/* A GL context is provided by the caller */ -static void gltexture_delete(struct gl_texture *tex) -{ - ENTER_GL(); - glDeleteTextures(1, &tex->name); - LEAVE_GL(); - tex->name = 0; -} - -void basetexture_unload(IWineD3DBaseTexture *iface) -{ - IWineD3DTextureImpl *This = (IWineD3DTextureImpl *)iface; - IWineD3DDeviceImpl *device = This->resource.device; - struct wined3d_context *context = NULL; - - if (This->baseTexture.texture_rgb.name || This->baseTexture.texture_srgb.name) - { - context = context_acquire(device, NULL); - } - - if(This->baseTexture.texture_rgb.name) { - gltexture_delete(&This->baseTexture.texture_rgb); - } - if(This->baseTexture.texture_srgb.name) { - gltexture_delete(&This->baseTexture.texture_srgb); - } - - if (context) context_release(context); - - This->baseTexture.texture_rgb.dirty = TRUE; - This->baseTexture.texture_srgb.dirty = TRUE; - - resource_unload((IWineD3DResourceImpl *)This); -} - -DWORD basetexture_set_lod(IWineD3DBaseTexture *iface, DWORD LODNew) -{ - IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface; - DWORD old = This->baseTexture.LOD; - - /* The d3d9:texture test shows that SetLOD is ignored on non-managed - * textures. The call always returns 0, and GetLOD always returns 0 - */ - if (This->resource.pool != WINED3DPOOL_MANAGED) { - TRACE("Ignoring SetLOD on %s texture, returning 0\n", debug_d3dpool(This->resource.pool)); - return 0; - } - - if (LODNew >= This->baseTexture.level_count) - LODNew = This->baseTexture.level_count - 1; - - if(This->baseTexture.LOD != LODNew) { - This->baseTexture.LOD = LODNew; - - This->baseTexture.texture_rgb.states[WINED3DTEXSTA_MAXMIPLEVEL] = ~0U; - This->baseTexture.texture_srgb.states[WINED3DTEXSTA_MAXMIPLEVEL] = ~0U; - if(This->baseTexture.bindCount) { - IWineD3DDeviceImpl_MarkStateDirty(This->resource.device, STATE_SAMPLER(This->baseTexture.sampler)); - } - } - - TRACE("(%p) : set LOD to %d\n", This, This->baseTexture.LOD); - - return old; -} - -DWORD basetexture_get_lod(IWineD3DBaseTexture *iface) -{ - IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface; - - TRACE("(%p) : returning %d\n", This, This->baseTexture.LOD); - - return This->baseTexture.LOD; -} - -DWORD basetexture_get_level_count(IWineD3DBaseTexture *iface) -{ - IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface; - TRACE("iface %p, returning %u.\n", iface, This->baseTexture.level_count); - return This->baseTexture.level_count; -} - -HRESULT basetexture_set_autogen_filter_type(IWineD3DBaseTexture *iface, WINED3DTEXTUREFILTERTYPE FilterType) -{ - IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface; - IWineD3DDeviceImpl *device = This->resource.device; - GLenum textureDimensions = This->baseTexture.target; - - if (!(This->resource.usage & WINED3DUSAGE_AUTOGENMIPMAP)) { - TRACE("(%p) : returning invalid call\n", This); - return WINED3DERR_INVALIDCALL; - } - if(This->baseTexture.filterType != FilterType) { - /* What about multithreading? Do we want all the context overhead just to set this value? - * Or should we delay the applying until the texture is used for drawing? For now, apply - * immediately. - */ - struct wined3d_context *context = context_acquire(device, NULL); - - ENTER_GL(); - glBindTexture(textureDimensions, This->baseTexture.texture_rgb.name); - checkGLcall("glBindTexture"); - switch(FilterType) { - case WINED3DTEXF_NONE: - case WINED3DTEXF_POINT: - glTexParameteri(textureDimensions, GL_GENERATE_MIPMAP_HINT_SGIS, GL_FASTEST); - checkGLcall("glTexParameteri(textureDimensions, GL_GENERATE_MIPMAP_HINT_SGIS, GL_FASTEST)"); - - break; - case WINED3DTEXF_LINEAR: - glTexParameteri(textureDimensions, GL_GENERATE_MIPMAP_HINT_SGIS, GL_NICEST); - checkGLcall("glTexParameteri(textureDimensions, GL_GENERATE_MIPMAP_HINT_SGIS, GL_NICEST)"); - - break; - default: - WARN("Unexpected filter type %d, setting to GL_NICEST\n", FilterType); - glTexParameteri(textureDimensions, GL_GENERATE_MIPMAP_HINT_SGIS, GL_NICEST); - checkGLcall("glTexParameteri(textureDimensions, GL_GENERATE_MIPMAP_HINT_SGIS, GL_NICEST)"); - } - LEAVE_GL(); - - context_release(context); - } - This->baseTexture.filterType = FilterType; - TRACE("(%p) :\n", This); - return WINED3D_OK; -} - -WINED3DTEXTUREFILTERTYPE basetexture_get_autogen_filter_type(IWineD3DBaseTexture *iface) -{ - IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface; - - FIXME("(%p) : stub\n", This); - - return This->baseTexture.filterType; -} - -void basetexture_generate_mipmaps(IWineD3DBaseTexture *iface) -{ - /* TODO: Implement filters using GL_SGI_generate_mipmaps. */ - FIXME("iface %p stub!\n", iface); -} - -BOOL basetexture_set_dirty(IWineD3DBaseTexture *iface, BOOL dirty) -{ - BOOL old; - IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface; - old = This->baseTexture.texture_rgb.dirty || This->baseTexture.texture_srgb.dirty; - This->baseTexture.texture_rgb.dirty = dirty; - This->baseTexture.texture_srgb.dirty = dirty; - return old; -} - -BOOL basetexture_get_dirty(IWineD3DBaseTexture *iface) -{ - IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface; - return This->baseTexture.texture_rgb.dirty || This->baseTexture.texture_srgb.dirty; -} - -/* Context activation is done by the caller. */ -HRESULT basetexture_bind(IWineD3DBaseTexture *iface, BOOL srgb, BOOL *set_surface_desc) -{ - IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface; - HRESULT hr = WINED3D_OK; - GLenum textureDimensions; - BOOL isNewTexture = FALSE; - struct gl_texture *gl_tex; - TRACE("(%p) : About to bind texture\n", This); - - This->baseTexture.is_srgb = srgb; /* SRGB mode cache for PreLoad calls outside drawprim */ - if(srgb) { - gl_tex = &This->baseTexture.texture_srgb; - } else { - gl_tex = &This->baseTexture.texture_rgb; - } - - textureDimensions = This->baseTexture.target; - ENTER_GL(); - /* Generate a texture name if we don't already have one */ - if (!gl_tex->name) - { - *set_surface_desc = TRUE; - glGenTextures(1, &gl_tex->name); - checkGLcall("glGenTextures"); - TRACE("Generated texture %d\n", gl_tex->name); - if (This->resource.pool == WINED3DPOOL_DEFAULT) { - /* Tell opengl to try and keep this texture in video ram (well mostly) */ - GLclampf tmp; - tmp = 0.9f; - glPrioritizeTextures(1, &gl_tex->name, &tmp); - - } - /* Initialise the state of the texture object - to the openGL defaults, not the directx defaults */ - gl_tex->states[WINED3DTEXSTA_ADDRESSU] = WINED3DTADDRESS_WRAP; - gl_tex->states[WINED3DTEXSTA_ADDRESSV] = WINED3DTADDRESS_WRAP; - gl_tex->states[WINED3DTEXSTA_ADDRESSW] = WINED3DTADDRESS_WRAP; - gl_tex->states[WINED3DTEXSTA_BORDERCOLOR] = 0; - gl_tex->states[WINED3DTEXSTA_MAGFILTER] = WINED3DTEXF_LINEAR; - gl_tex->states[WINED3DTEXSTA_MINFILTER] = WINED3DTEXF_POINT; /* GL_NEAREST_MIPMAP_LINEAR */ - gl_tex->states[WINED3DTEXSTA_MIPFILTER] = WINED3DTEXF_LINEAR; /* GL_NEAREST_MIPMAP_LINEAR */ - gl_tex->states[WINED3DTEXSTA_MAXMIPLEVEL] = 0; - gl_tex->states[WINED3DTEXSTA_MAXANISOTROPY] = 1; - gl_tex->states[WINED3DTEXSTA_SRGBTEXTURE] = 0; - gl_tex->states[WINED3DTEXSTA_SHADOW] = FALSE; - IWineD3DBaseTexture_SetDirty(iface, TRUE); - isNewTexture = TRUE; - - if(This->resource.usage & WINED3DUSAGE_AUTOGENMIPMAP) { - /* This means double binding the texture at creation, but keeps the code simpler all - * in all, and the run-time path free from additional checks - */ - glBindTexture(textureDimensions, gl_tex->name); - checkGLcall("glBindTexture"); - glTexParameteri(textureDimensions, GL_GENERATE_MIPMAP_SGIS, GL_TRUE); - checkGLcall("glTexParameteri(textureDimensions, GL_GENERATE_MIPMAP_SGIS, GL_TRUE)"); - } - } else { - *set_surface_desc = FALSE; - } - - /* Bind the texture */ - if (gl_tex->name) - { - glBindTexture(textureDimensions, gl_tex->name); - checkGLcall("glBindTexture"); - if (isNewTexture) { - /* For a new texture we have to set the textures levels after binding the texture. - * In theory this is all we should ever have to do, but because ATI's drivers are broken, we - * also need to set the texture dimensions before the texture is set - * Beware that texture rectangles do not support mipmapping, but set the maxmiplevel if we're - * relying on the partial GL_ARB_texture_non_power_of_two emulation with texture rectangles - * (ie, do not care for cond_np2 here, just look for GL_TEXTURE_RECTANGLE_ARB) - */ - if (textureDimensions != GL_TEXTURE_RECTANGLE_ARB) - { - TRACE("Setting GL_TEXTURE_MAX_LEVEL to %u.\n", This->baseTexture.level_count - 1); - glTexParameteri(textureDimensions, GL_TEXTURE_MAX_LEVEL, This->baseTexture.level_count - 1); - checkGLcall("glTexParameteri(textureDimensions, GL_TEXTURE_MAX_LEVEL, This->baseTexture.level_count)"); - } - if(textureDimensions==GL_TEXTURE_CUBE_MAP_ARB) { - /* Cubemaps are always set to clamp, regardless of the sampler state. */ - glTexParameteri(textureDimensions, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(textureDimensions, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glTexParameteri(textureDimensions, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE); - } - } - } else { /* this only happened if we've run out of openGL textures */ - WARN("This texture doesn't have an openGL texture assigned to it\n"); - hr = WINED3DERR_INVALIDCALL; - } - - LEAVE_GL(); - return hr; -} - -/* GL locking is done by the caller */ -static void apply_wrap(const struct wined3d_gl_info *gl_info, GLenum target, - WINED3DTEXTUREADDRESS d3d_wrap, GLenum param, BOOL cond_np2) -{ - GLint gl_wrap; - - if (d3d_wrap < WINED3DTADDRESS_WRAP || d3d_wrap > WINED3DTADDRESS_MIRRORONCE) - { - FIXME("Unrecognized or unsupported WINED3DTEXTUREADDRESS %#x.\n", d3d_wrap); - return; - } - - if (target == GL_TEXTURE_CUBE_MAP_ARB - || (cond_np2 && d3d_wrap == WINED3DTADDRESS_WRAP)) - { - /* Cubemaps are always set to clamp, regardless of the sampler state. */ - gl_wrap = GL_CLAMP_TO_EDGE; - } - else - { - gl_wrap = gl_info->wrap_lookup[d3d_wrap - WINED3DTADDRESS_WRAP]; - } - - TRACE("Setting param %#x to %#x for target %#x.\n", param, gl_wrap, target); - glTexParameteri(target, param, gl_wrap); - checkGLcall("glTexParameteri(target, param, gl_wrap)"); -} - -/* GL locking is done by the caller (state handler) */ -void basetexture_apply_state_changes(IWineD3DBaseTexture *iface, - const DWORD textureStates[WINED3D_HIGHEST_TEXTURE_STATE + 1], - const DWORD samplerStates[WINED3D_HIGHEST_SAMPLER_STATE + 1], - const struct wined3d_gl_info *gl_info) -{ - IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface; - GLenum textureDimensions = This->baseTexture.target; - DWORD state; - BOOL cond_np2 = IWineD3DBaseTexture_IsCondNP2(iface); - DWORD aniso; - struct gl_texture *gl_tex; - - TRACE("iface %p, textureStates %p, samplerStates %p\n", iface, textureStates, samplerStates); - - if(This->baseTexture.is_srgb) { - gl_tex = &This->baseTexture.texture_srgb; - } else { - gl_tex = &This->baseTexture.texture_rgb; - } - - /* This function relies on the correct texture being bound and loaded. */ - - if(samplerStates[WINED3DSAMP_ADDRESSU] != gl_tex->states[WINED3DTEXSTA_ADDRESSU]) { - state = samplerStates[WINED3DSAMP_ADDRESSU]; - apply_wrap(gl_info, textureDimensions, state, GL_TEXTURE_WRAP_S, cond_np2); - gl_tex->states[WINED3DTEXSTA_ADDRESSU] = state; - } - - if(samplerStates[WINED3DSAMP_ADDRESSV] != gl_tex->states[WINED3DTEXSTA_ADDRESSV]) { - state = samplerStates[WINED3DSAMP_ADDRESSV]; - apply_wrap(gl_info, textureDimensions, state, GL_TEXTURE_WRAP_T, cond_np2); - gl_tex->states[WINED3DTEXSTA_ADDRESSV] = state; - } - - if(samplerStates[WINED3DSAMP_ADDRESSW] != gl_tex->states[WINED3DTEXSTA_ADDRESSW]) { - state = samplerStates[WINED3DSAMP_ADDRESSW]; - apply_wrap(gl_info, textureDimensions, state, GL_TEXTURE_WRAP_R, cond_np2); - gl_tex->states[WINED3DTEXSTA_ADDRESSW] = state; - } - - if(samplerStates[WINED3DSAMP_BORDERCOLOR] != gl_tex->states[WINED3DTEXSTA_BORDERCOLOR]) { - float col[4]; - - state = samplerStates[WINED3DSAMP_BORDERCOLOR]; - D3DCOLORTOGLFLOAT4(state, col); - TRACE("Setting border color for %u to %x\n", textureDimensions, state); - glTexParameterfv(textureDimensions, GL_TEXTURE_BORDER_COLOR, &col[0]); - checkGLcall("glTexParameteri(..., GL_TEXTURE_BORDER_COLOR, ...)"); - gl_tex->states[WINED3DTEXSTA_BORDERCOLOR] = state; - } - - if(samplerStates[WINED3DSAMP_MAGFILTER] != gl_tex->states[WINED3DTEXSTA_MAGFILTER]) { - GLint glValue; - state = samplerStates[WINED3DSAMP_MAGFILTER]; - if (state > WINED3DTEXF_ANISOTROPIC) { - FIXME("Unrecognized or unsupported MAGFILTER* value %d\n", state); - } - - glValue = wined3d_gl_mag_filter(This->baseTexture.magLookup, - min(max(state, WINED3DTEXF_POINT), WINED3DTEXF_LINEAR)); - TRACE("ValueMAG=%d setting MAGFILTER to %x\n", state, glValue); - glTexParameteri(textureDimensions, GL_TEXTURE_MAG_FILTER, glValue); - - gl_tex->states[WINED3DTEXSTA_MAGFILTER] = state; - } - - if((samplerStates[WINED3DSAMP_MINFILTER] != gl_tex->states[WINED3DTEXSTA_MINFILTER] || - samplerStates[WINED3DSAMP_MIPFILTER] != gl_tex->states[WINED3DTEXSTA_MIPFILTER] || - samplerStates[WINED3DSAMP_MAXMIPLEVEL] != gl_tex->states[WINED3DTEXSTA_MAXMIPLEVEL])) { - GLint glValue; - - gl_tex->states[WINED3DTEXSTA_MIPFILTER] = samplerStates[WINED3DSAMP_MIPFILTER]; - gl_tex->states[WINED3DTEXSTA_MINFILTER] = samplerStates[WINED3DSAMP_MINFILTER]; - gl_tex->states[WINED3DTEXSTA_MAXMIPLEVEL] = samplerStates[WINED3DSAMP_MAXMIPLEVEL]; - - if (gl_tex->states[WINED3DTEXSTA_MINFILTER] > WINED3DTEXF_ANISOTROPIC - || gl_tex->states[WINED3DTEXSTA_MIPFILTER] > WINED3DTEXF_ANISOTROPIC) - { - - FIXME("Unrecognized or unsupported D3DSAMP_MINFILTER value %d D3DSAMP_MIPFILTER value %d\n", - gl_tex->states[WINED3DTEXSTA_MINFILTER], - gl_tex->states[WINED3DTEXSTA_MIPFILTER]); - } - glValue = wined3d_gl_min_mip_filter(This->baseTexture.minMipLookup, - min(max(samplerStates[WINED3DSAMP_MINFILTER], WINED3DTEXF_POINT), WINED3DTEXF_LINEAR), - min(max(samplerStates[WINED3DSAMP_MIPFILTER], WINED3DTEXF_NONE), WINED3DTEXF_LINEAR)); - - TRACE("ValueMIN=%d, ValueMIP=%d, setting MINFILTER to %x\n", - samplerStates[WINED3DSAMP_MINFILTER], - samplerStates[WINED3DSAMP_MIPFILTER], glValue); - glTexParameteri(textureDimensions, GL_TEXTURE_MIN_FILTER, glValue); - checkGLcall("glTexParameter GL_TEXTURE_MIN_FILTER, ..."); - - if (!cond_np2) - { - if (gl_tex->states[WINED3DTEXSTA_MIPFILTER] == WINED3DTEXF_NONE) - glValue = This->baseTexture.LOD; - else if (gl_tex->states[WINED3DTEXSTA_MAXMIPLEVEL] >= This->baseTexture.level_count) - glValue = This->baseTexture.level_count - 1; - else if (gl_tex->states[WINED3DTEXSTA_MAXMIPLEVEL] < This->baseTexture.LOD) - /* baseTexture.LOD is already clamped in the setter */ - glValue = This->baseTexture.LOD; - else - glValue = gl_tex->states[WINED3DTEXSTA_MAXMIPLEVEL]; - - /* Note that D3DSAMP_MAXMIPLEVEL specifies the biggest mipmap(default 0), while - * GL_TEXTURE_MAX_LEVEL specifies the smallest mimap used(default 1000). - * So D3DSAMP_MAXMIPLEVEL is the same as GL_TEXTURE_BASE_LEVEL. - */ - glTexParameteri(textureDimensions, GL_TEXTURE_BASE_LEVEL, glValue); - } - } - - if ((gl_tex->states[WINED3DTEXSTA_MAGFILTER] != WINED3DTEXF_ANISOTROPIC - && gl_tex->states[WINED3DTEXSTA_MINFILTER] != WINED3DTEXF_ANISOTROPIC - && gl_tex->states[WINED3DTEXSTA_MIPFILTER] != WINED3DTEXF_ANISOTROPIC) - || cond_np2) - { - aniso = 1; - } - else - { - aniso = samplerStates[WINED3DSAMP_MAXANISOTROPY]; - } - - if (gl_tex->states[WINED3DTEXSTA_MAXANISOTROPY] != aniso) - { - if (gl_info->supported[EXT_TEXTURE_FILTER_ANISOTROPIC]) - { - glTexParameteri(textureDimensions, GL_TEXTURE_MAX_ANISOTROPY_EXT, aniso); - checkGLcall("glTexParameteri(GL_TEXTURE_MAX_ANISOTROPY_EXT, aniso)"); - } - else - { - WARN("Anisotropic filtering not supported.\n"); - } - gl_tex->states[WINED3DTEXSTA_MAXANISOTROPY] = aniso; - } - - if (!(This->resource.format->Flags & WINED3DFMT_FLAG_SHADOW) - != !gl_tex->states[WINED3DTEXSTA_SHADOW]) - { - if (This->resource.format->Flags & WINED3DFMT_FLAG_SHADOW) - { - glTexParameteri(textureDimensions, GL_DEPTH_TEXTURE_MODE_ARB, GL_LUMINANCE); - glTexParameteri(textureDimensions, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE_ARB); - checkGLcall("glTexParameteri(textureDimensions, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE_ARB)"); - gl_tex->states[WINED3DTEXSTA_SHADOW] = TRUE; - } - else - { - glTexParameteri(textureDimensions, GL_TEXTURE_COMPARE_MODE_ARB, GL_NONE); - checkGLcall("glTexParameteri(textureDimensions, GL_TEXTURE_COMPARE_MODE_ARB, GL_NONE)"); - gl_tex->states[WINED3DTEXSTA_SHADOW] = FALSE; - } - } -} diff --git a/dll/directx/wine/wined3d/buffer.c b/dll/directx/wine/wined3d/buffer.c index 23b4a4ad67c..f2f806ec3e5 100644 --- a/dll/directx/wine/wined3d/buffer.c +++ b/dll/directx/wine/wined3d/buffer.c @@ -4,7 +4,7 @@ * Copyright 2004 Christian Costa * Copyright 2005 Oliver Stieber * Copyright 2007-2010 Stefan Dösinger for CodeWeavers - * Copyright 2009 Henri Verbeet for CodeWeavers + * Copyright 2009-2010 Henri Verbeet for CodeWeavers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -287,11 +287,9 @@ static BOOL buffer_process_converted_attribute(struct wined3d_buffer *This, static BOOL buffer_check_attribute(struct wined3d_buffer *This, const struct wined3d_stream_info *si, UINT attrib_idx, const BOOL check_d3dcolor, const BOOL is_ffp_position, const BOOL is_ffp_color, - DWORD *stride_this_run, BOOL *float16_used) + DWORD *stride_this_run) { const struct wined3d_stream_info_element *attrib = &si->elements[attrib_idx]; - IWineD3DDeviceImpl *device = This->resource.device; - const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; enum wined3d_format_id format; BOOL ret = FALSE; @@ -304,16 +302,7 @@ static BOOL buffer_check_attribute(struct wined3d_buffer *This, const struct win format = attrib->format->id; /* Look for newly appeared conversion */ - if (!gl_info->supported[ARB_HALF_FLOAT_VERTEX] - && (format == WINED3DFMT_R16G16_FLOAT || format == WINED3DFMT_R16G16B16A16_FLOAT)) - { - ret = buffer_process_converted_attribute(This, CONV_FLOAT16_2, attrib, stride_this_run); - - if (is_ffp_position) FIXME("Test FLOAT16 fixed function processing positions\n"); - else if (is_ffp_color) FIXME("test FLOAT16 fixed function processing colors\n"); - *float16_used = TRUE; - } - else if (check_d3dcolor && format == WINED3DFMT_B8G8R8A8_UNORM) + if (check_d3dcolor && format == WINED3DFMT_B8G8R8A8_UNORM) { ret = buffer_process_converted_attribute(This, CONV_D3DCOLOR, attrib, stride_this_run); @@ -331,81 +320,15 @@ static BOOL buffer_check_attribute(struct wined3d_buffer *This, const struct win return ret; } -static UINT *find_conversion_shift(struct wined3d_buffer *This, - const struct wined3d_stream_info *strided, UINT stride) -{ - UINT *ret, i, j, shift, orig_type_size; - - if (!stride) - { - TRACE("No shift\n"); - return NULL; - } - - This->conversion_stride = stride; - ret = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DWORD) * stride); - for (i = 0; i < MAX_ATTRIBS; ++i) - { - enum wined3d_format_id format; - - if (!(strided->use_map & (1 << i)) || strided->elements[i].buffer_object != This->buffer_object) continue; - - format = strided->elements[i].format->id; - if (format == WINED3DFMT_R16G16_FLOAT) - { - shift = 4; - } - else if (format == WINED3DFMT_R16G16B16A16_FLOAT) - { - shift = 8; - /* Pre-shift the last 4 bytes in the FLOAT16_4 by 4 bytes - this makes FLOAT16_2 and FLOAT16_4 conversions - * compatible - */ - for (j = 4; j < 8; ++j) - { - ret[(DWORD_PTR)strided->elements[i].data + j] += 4; - } - } - else - { - shift = 0; - } - This->conversion_stride += shift; - - if (shift) - { - orig_type_size = strided->elements[i].format->component_count - * strided->elements[i].format->component_size; - for (j = (DWORD_PTR)strided->elements[i].data + orig_type_size; j < stride; ++j) - { - ret[j] += shift; - } - } - } - - if (TRACE_ON(d3d)) - { - TRACE("Dumping conversion shift:\n"); - for (i = 0; i < stride; ++i) - { - TRACE("[%d]", ret[i]); - } - TRACE("\n"); - } - - return ret; -} - static BOOL buffer_find_decl(struct wined3d_buffer *This) { - IWineD3DDeviceImpl *device = This->resource.device; + struct wined3d_device *device = This->resource.device; const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; const struct wined3d_stream_info *si = &device->strided_streams; const struct wined3d_state *state = &device->stateBlock->state; UINT stride_this_run = 0; - BOOL float16_used = FALSE; BOOL ret = FALSE; - unsigned int i; + BOOL support_d3dcolor = gl_info->supported[ARB_VERTEX_ARRAY_BGRA]; /* In d3d7 the vertex buffer declaration NEVER changes because it is stored in the d3d7 vertex buffer. * Once we have our declaration there is no need to look it up again. Index buffers also never need @@ -416,6 +339,20 @@ static BOOL buffer_find_decl(struct wined3d_buffer *This) if(This->resource.usage & WINED3DUSAGE_STATICDECL) return FALSE; } + if (use_vs(state)) + { + TRACE("Vertex shaders used, no VBO conversion is needed\n"); + if(This->conversion_map) + { + HeapFree(GetProcessHeap(), 0, This->conversion_map); + This->conversion_map = NULL; + This->stride = 0; + return TRUE; + } + + return FALSE; + } + TRACE("Finding vertex buffer conversion information\n"); /* Certain declaration types need some fixups before we can pass them to * opengl. This means D3DCOLOR attributes with fixed function vertex @@ -461,79 +398,31 @@ static BOOL buffer_find_decl(struct wined3d_buffer *This) * conversion types depend on the semantic as well, for example a FLOAT4 * texcoord needs no conversion while a FLOAT4 positiont needs one */ - if (use_vs(state)) - { - TRACE("vshader\n"); - /* If the current vertex declaration is marked for no half float conversion don't bother to - * analyse the strided streams in depth, just set them up for no conversion. Return decl changed - * if we used conversion before - */ - if (!state->vertex_declaration->half_float_conv_needed) - { - if (This->conversion_map) - { - TRACE("Now using shaders without conversion, but conversion used before\n"); - HeapFree(GetProcessHeap(), 0, This->conversion_map); - HeapFree(GetProcessHeap(), 0, This->conversion_shift); - This->conversion_map = NULL; - This->stride = 0; - This->conversion_shift = NULL; - This->conversion_stride = 0; - return TRUE; - } - else - { - return FALSE; - } - } - for (i = 0; i < MAX_ATTRIBS; ++i) - { - ret = buffer_check_attribute(This, si, i, FALSE, FALSE, FALSE, &stride_this_run, &float16_used) || ret; - } - /* Recalculate the conversion shift map if the declaration has changed, - * and we're using float16 conversion or used it on the last run - */ - if (ret && (float16_used || This->conversion_map)) - { - HeapFree(GetProcessHeap(), 0, This->conversion_shift); - This->conversion_shift = find_conversion_shift(This, si, This->stride); - } - } - else - { - /* Fixed function is a bit trickier. We have to take care for D3DCOLOR types, FLOAT4 positions and of course - * FLOAT16s if not supported. Also, we can't iterate over the array, so use macros to generate code for all - * the attributes that our current fixed function pipeline implementation cares for. - */ - BOOL support_d3dcolor = gl_info->supported[ARB_VERTEX_ARRAY_BGRA]; - ret = buffer_check_attribute(This, si, WINED3D_FFP_POSITION, - TRUE, TRUE, FALSE, &stride_this_run, &float16_used) || ret; - ret = buffer_check_attribute(This, si, WINED3D_FFP_NORMAL, - TRUE, FALSE, FALSE, &stride_this_run, &float16_used) || ret; - ret = buffer_check_attribute(This, si, WINED3D_FFP_DIFFUSE, - !support_d3dcolor, FALSE, TRUE, &stride_this_run, &float16_used) || ret; - ret = buffer_check_attribute(This, si, WINED3D_FFP_SPECULAR, - !support_d3dcolor, FALSE, TRUE, &stride_this_run, &float16_used) || ret; - ret = buffer_check_attribute(This, si, WINED3D_FFP_TEXCOORD0, - TRUE, FALSE, FALSE, &stride_this_run, &float16_used) || ret; - ret = buffer_check_attribute(This, si, WINED3D_FFP_TEXCOORD1, - TRUE, FALSE, FALSE, &stride_this_run, &float16_used) || ret; - ret = buffer_check_attribute(This, si, WINED3D_FFP_TEXCOORD2, - TRUE, FALSE, FALSE, &stride_this_run, &float16_used) || ret; - ret = buffer_check_attribute(This, si, WINED3D_FFP_TEXCOORD3, - TRUE, FALSE, FALSE, &stride_this_run, &float16_used) || ret; - ret = buffer_check_attribute(This, si, WINED3D_FFP_TEXCOORD4, - TRUE, FALSE, FALSE, &stride_this_run, &float16_used) || ret; - ret = buffer_check_attribute(This, si, WINED3D_FFP_TEXCOORD5, - TRUE, FALSE, FALSE, &stride_this_run, &float16_used) || ret; - ret = buffer_check_attribute(This, si, WINED3D_FFP_TEXCOORD6, - TRUE, FALSE, FALSE, &stride_this_run, &float16_used) || ret; - ret = buffer_check_attribute(This, si, WINED3D_FFP_TEXCOORD7, - TRUE, FALSE, FALSE, &stride_this_run, &float16_used) || ret; - - if (float16_used) FIXME("Float16 conversion used with fixed function vertex processing\n"); - } + ret = buffer_check_attribute(This, si, WINED3D_FFP_POSITION, + TRUE, TRUE, FALSE, &stride_this_run) || ret; + ret = buffer_check_attribute(This, si, WINED3D_FFP_NORMAL, + TRUE, FALSE, FALSE, &stride_this_run) || ret; + ret = buffer_check_attribute(This, si, WINED3D_FFP_DIFFUSE, + !support_d3dcolor, FALSE, TRUE, &stride_this_run) || ret; + ret = buffer_check_attribute(This, si, WINED3D_FFP_SPECULAR, + !support_d3dcolor, FALSE, TRUE, &stride_this_run) || ret; + ret = buffer_check_attribute(This, si, WINED3D_FFP_TEXCOORD0, + TRUE, FALSE, FALSE, &stride_this_run) || ret; + ret = buffer_check_attribute(This, si, WINED3D_FFP_TEXCOORD1, + TRUE, FALSE, FALSE, &stride_this_run) || ret; + ret = buffer_check_attribute(This, si, WINED3D_FFP_TEXCOORD2, + TRUE, FALSE, FALSE, &stride_this_run) || ret; + ret = buffer_check_attribute(This, si, WINED3D_FFP_TEXCOORD3, + TRUE, FALSE, FALSE, &stride_this_run) || ret; + ret = buffer_check_attribute(This, si, WINED3D_FFP_TEXCOORD4, + TRUE, FALSE, FALSE, &stride_this_run) || ret; + ret = buffer_check_attribute(This, si, WINED3D_FFP_TEXCOORD5, + TRUE, FALSE, FALSE, &stride_this_run) || ret; + ret = buffer_check_attribute(This, si, WINED3D_FFP_TEXCOORD6, + TRUE, FALSE, FALSE, &stride_this_run) || ret; + ret = buffer_check_attribute(This, si, WINED3D_FFP_TEXCOORD7, + TRUE, FALSE, FALSE, &stride_this_run) || ret; if (!stride_this_run && This->conversion_map) { @@ -549,36 +438,6 @@ static BOOL buffer_find_decl(struct wined3d_buffer *This) return ret; } -/* Context activation is done by the caller. */ -static void buffer_check_buffer_object_size(struct wined3d_buffer *This, const struct wined3d_gl_info *gl_info) -{ - UINT size = This->conversion_stride ? - This->conversion_stride * (This->resource.size / This->stride) : This->resource.size; - if (This->buffer_object_size != size) - { - TRACE("Old size %u, creating new size %u\n", This->buffer_object_size, size); - - if(This->buffer_type_hint == GL_ELEMENT_ARRAY_BUFFER_ARB) - { - IWineD3DDeviceImpl_MarkStateDirty(This->resource.device, STATE_INDEXBUFFER); - } - - /* Rescue the data before resizing the buffer object if we do not have our backup copy */ - if(!(This->flags & WINED3D_BUFFER_DOUBLEBUFFER)) - { - buffer_get_sysmem(This, gl_info); - } - - ENTER_GL(); - GL_EXTCALL(glBindBufferARB(This->buffer_type_hint, This->buffer_object)); - checkGLcall("glBindBufferARB"); - GL_EXTCALL(glBufferDataARB(This->buffer_type_hint, size, NULL, This->buffer_object_usage)); - This->buffer_object_size = size; - checkGLcall("glBufferDataARB"); - LEAVE_GL(); - } -} - static inline void fixup_d3dcolor(DWORD *dst_color) { DWORD src_color = *dst_color; @@ -611,24 +470,23 @@ static inline void fixup_transformed_pos(float *p) } /* Context activation is done by the caller. */ -const BYTE *buffer_get_memory(IWineD3DBuffer *iface, const struct wined3d_gl_info *gl_info, GLuint *buffer_object) +const BYTE *buffer_get_memory(struct wined3d_buffer *buffer, + const struct wined3d_gl_info *gl_info, GLuint *buffer_object) { - struct wined3d_buffer *This = (struct wined3d_buffer *)iface; - - *buffer_object = This->buffer_object; - if (!This->buffer_object) + *buffer_object = buffer->buffer_object; + if (!buffer->buffer_object) { - if (This->flags & WINED3D_BUFFER_CREATEBO) + if (buffer->flags & WINED3D_BUFFER_CREATEBO) { - buffer_create_buffer_object(This, gl_info); - This->flags &= ~WINED3D_BUFFER_CREATEBO; - if (This->buffer_object) + buffer_create_buffer_object(buffer, gl_info); + buffer->flags &= ~WINED3D_BUFFER_CREATEBO; + if (buffer->buffer_object) { - *buffer_object = This->buffer_object; + *buffer_object = buffer->buffer_object; return NULL; } } - return This->resource.allocatedMemory; + return buffer->resource.allocatedMemory; } else { @@ -636,36 +494,11 @@ const BYTE *buffer_get_memory(IWineD3DBuffer *iface, const struct wined3d_gl_inf } } -/* IUnknown methods */ - -static HRESULT STDMETHODCALLTYPE buffer_QueryInterface(IWineD3DBuffer *iface, - REFIID riid, void **object) +ULONG CDECL wined3d_buffer_incref(struct wined3d_buffer *buffer) { - TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object); + ULONG refcount = InterlockedIncrement(&buffer->resource.ref); - if (IsEqualGUID(riid, &IID_IWineD3DBuffer) - || IsEqualGUID(riid, &IID_IWineD3DResource) - || IsEqualGUID(riid, &IID_IWineD3DBase) - || IsEqualGUID(riid, &IID_IUnknown)) - { - IUnknown_AddRef(iface); - *object = iface; - return S_OK; - } - - WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid)); - - *object = NULL; - - return E_NOINTERFACE; -} - -static ULONG STDMETHODCALLTYPE buffer_AddRef(IWineD3DBuffer *iface) -{ - struct wined3d_buffer *This = (struct wined3d_buffer *)iface; - ULONG refcount = InterlockedIncrement(&This->resource.ref); - - TRACE("%p increasing refcount to %u\n", This, refcount); + TRACE("%p increasing refcount to %u.\n", buffer, refcount); return refcount; } @@ -678,6 +511,12 @@ BYTE *buffer_get_sysmem(struct wined3d_buffer *This, const struct wined3d_gl_inf This->resource.heapMemory = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->resource.size + RESOURCE_ALIGNMENT); This->resource.allocatedMemory = (BYTE *)(((ULONG_PTR)This->resource.heapMemory + (RESOURCE_ALIGNMENT - 1)) & ~(RESOURCE_ALIGNMENT - 1)); + + if (This->buffer_type_hint == GL_ELEMENT_ARRAY_BUFFER_ARB) + { + IWineD3DDeviceImpl_MarkStateDirty(This->resource.device, STATE_INDEXBUFFER); + } + ENTER_GL(); GL_EXTCALL(glBindBufferARB(This->buffer_type_hint, This->buffer_object)); GL_EXTCALL(glGetBufferSubDataARB(This->buffer_type_hint, 0, This->resource.size, This->resource.allocatedMemory)); @@ -688,99 +527,93 @@ BYTE *buffer_get_sysmem(struct wined3d_buffer *This, const struct wined3d_gl_inf } /* Do not call while under the GL lock. */ -static void STDMETHODCALLTYPE buffer_UnLoad(IWineD3DBuffer *iface) +static void buffer_unload(struct wined3d_resource *resource) { - struct wined3d_buffer *This = (struct wined3d_buffer *)iface; + struct wined3d_buffer *buffer = buffer_from_resource(resource); - TRACE("iface %p\n", iface); + TRACE("buffer %p.\n", buffer); - if (This->buffer_object) + if (buffer->buffer_object) { - IWineD3DDeviceImpl *device = This->resource.device; + struct wined3d_device *device = resource->device; struct wined3d_context *context; context = context_acquire(device, NULL); /* Download the buffer, but don't permanently enable double buffering */ - if(!(This->flags & WINED3D_BUFFER_DOUBLEBUFFER)) + if (!(buffer->flags & WINED3D_BUFFER_DOUBLEBUFFER)) { - buffer_get_sysmem(This, context->gl_info); - This->flags &= ~WINED3D_BUFFER_DOUBLEBUFFER; + buffer_get_sysmem(buffer, context->gl_info); + buffer->flags &= ~WINED3D_BUFFER_DOUBLEBUFFER; } - delete_gl_buffer(This, context->gl_info); - This->flags |= WINED3D_BUFFER_CREATEBO; /* Recreate the buffer object next load */ - buffer_clear_dirty_areas(This); + delete_gl_buffer(buffer, context->gl_info); + buffer->flags |= WINED3D_BUFFER_CREATEBO; /* Recreate the buffer object next load */ + buffer_clear_dirty_areas(buffer); context_release(context); - HeapFree(GetProcessHeap(), 0, This->conversion_shift); - This->conversion_shift = NULL; - HeapFree(GetProcessHeap(), 0, This->conversion_map); - This->conversion_map = NULL; - This->stride = 0; - This->conversion_stride = 0; - This->flags &= ~WINED3D_BUFFER_HASDESC; + HeapFree(GetProcessHeap(), 0, buffer->conversion_map); + buffer->conversion_map = NULL; + buffer->stride = 0; + buffer->conversion_stride = 0; + buffer->flags &= ~WINED3D_BUFFER_HASDESC; } - resource_unload((IWineD3DResourceImpl *)This); + resource_unload(resource); } /* Do not call while under the GL lock. */ -static ULONG STDMETHODCALLTYPE buffer_Release(IWineD3DBuffer *iface) +ULONG CDECL wined3d_buffer_decref(struct wined3d_buffer *buffer) { - struct wined3d_buffer *This = (struct wined3d_buffer *)iface; - ULONG refcount = InterlockedDecrement(&This->resource.ref); + ULONG refcount = InterlockedDecrement(&buffer->resource.ref); - TRACE("%p decreasing refcount to %u\n", This, refcount); + TRACE("%p decreasing refcount to %u.\n", buffer, refcount); if (!refcount) { - buffer_UnLoad(iface); - resource_cleanup((IWineD3DResource *)iface); - This->resource.parent_ops->wined3d_object_destroyed(This->resource.parent); - HeapFree(GetProcessHeap(), 0, This->maps); - HeapFree(GetProcessHeap(), 0, This); + buffer_unload(&buffer->resource); + resource_cleanup(&buffer->resource); + buffer->resource.parent_ops->wined3d_object_destroyed(buffer->resource.parent); + HeapFree(GetProcessHeap(), 0, buffer->maps); + HeapFree(GetProcessHeap(), 0, buffer); } return refcount; } -/* IWineD3DBase methods */ -static void * STDMETHODCALLTYPE buffer_GetParent(IWineD3DBuffer *iface) +void * CDECL wined3d_buffer_get_parent(const struct wined3d_buffer *buffer) { - TRACE("iface %p.\n", iface); + TRACE("buffer %p.\n", buffer); - return ((struct wined3d_buffer *)iface)->resource.parent; + return buffer->resource.parent; } -/* IWineD3DResource methods */ - -static HRESULT STDMETHODCALLTYPE buffer_SetPrivateData(IWineD3DBuffer *iface, +HRESULT CDECL wined3d_buffer_set_private_data(struct wined3d_buffer *buffer, REFGUID guid, const void *data, DWORD data_size, DWORD flags) { - return resource_set_private_data((IWineD3DResource *)iface, guid, data, data_size, flags); + return resource_set_private_data(&buffer->resource, guid, data, data_size, flags); } -static HRESULT STDMETHODCALLTYPE buffer_GetPrivateData(IWineD3DBuffer *iface, +HRESULT CDECL wined3d_buffer_get_private_data(const struct wined3d_buffer *buffer, REFGUID guid, void *data, DWORD *data_size) { - return resource_get_private_data((IWineD3DResource *)iface, guid, data, data_size); + return resource_get_private_data(&buffer->resource, guid, data, data_size); } -static HRESULT STDMETHODCALLTYPE buffer_FreePrivateData(IWineD3DBuffer *iface, REFGUID guid) +HRESULT CDECL wined3d_buffer_free_private_data(struct wined3d_buffer *buffer, REFGUID guid) { - return resource_free_private_data((IWineD3DResource *)iface, guid); + return resource_free_private_data(&buffer->resource, guid); } -static DWORD STDMETHODCALLTYPE buffer_SetPriority(IWineD3DBuffer *iface, DWORD priority) +DWORD CDECL wined3d_buffer_set_priority(struct wined3d_buffer *buffer, DWORD priority) { - return resource_set_priority((IWineD3DResource *)iface, priority); + return resource_set_priority(&buffer->resource, priority); } -static DWORD STDMETHODCALLTYPE buffer_GetPriority(IWineD3DBuffer *iface) +DWORD CDECL wined3d_buffer_get_priority(const struct wined3d_buffer *buffer) { - return resource_get_priority((IWineD3DResource *)iface); + return resource_get_priority(&buffer->resource); } /* The caller provides a context and binds the buffer */ @@ -857,120 +690,124 @@ drop_query: /* The caller provides a GL context */ static void buffer_direct_upload(struct wined3d_buffer *This, const struct wined3d_gl_info *gl_info, DWORD flags) { - BYTE *map; - UINT start = 0, len = 0; + BYTE *map; + UINT start = 0, len = 0; + + ENTER_GL(); + + /* This potentially invalidates the element array buffer binding, but the + * caller always takes care of this. */ + GL_EXTCALL(glBindBufferARB(This->buffer_type_hint, This->buffer_object)); + checkGLcall("glBindBufferARB"); + if (gl_info->supported[ARB_MAP_BUFFER_RANGE]) + { + GLbitfield mapflags; + mapflags = GL_MAP_WRITE_BIT | GL_MAP_FLUSH_EXPLICIT_BIT; + if (flags & WINED3D_BUFFER_DISCARD) + { + mapflags |= GL_MAP_UNSYNCHRONIZED_BIT | GL_MAP_INVALIDATE_BUFFER_BIT; + } + else if (flags & WINED3D_BUFFER_NOSYNC) + { + mapflags |= GL_MAP_UNSYNCHRONIZED_BIT; + } + map = GL_EXTCALL(glMapBufferRange(This->buffer_type_hint, 0, + This->resource.size, mapflags)); + checkGLcall("glMapBufferRange"); + } + else + { + if (This->flags & WINED3D_BUFFER_APPLESYNC) + { + DWORD syncflags = 0; + if (flags & WINED3D_BUFFER_DISCARD) syncflags |= WINED3DLOCK_DISCARD; + if (flags & WINED3D_BUFFER_NOSYNC) syncflags |= WINED3DLOCK_NOOVERWRITE; + LEAVE_GL(); + buffer_sync_apple(This, syncflags, gl_info); + ENTER_GL(); + } + map = GL_EXTCALL(glMapBufferARB(This->buffer_type_hint, GL_WRITE_ONLY_ARB)); + checkGLcall("glMapBufferARB"); + } + if (!map) + { + LEAVE_GL(); + ERR("Failed to map opengl buffer\n"); + return; + } + + while (This->modified_areas) + { + This->modified_areas--; + start = This->maps[This->modified_areas].offset; + len = This->maps[This->modified_areas].size; + + memcpy(map + start, This->resource.allocatedMemory + start, len); - ENTER_GL(); - GL_EXTCALL(glBindBufferARB(This->buffer_type_hint, This->buffer_object)); - checkGLcall("glBindBufferARB"); if (gl_info->supported[ARB_MAP_BUFFER_RANGE]) { - GLbitfield mapflags; - mapflags = GL_MAP_WRITE_BIT | GL_MAP_FLUSH_EXPLICIT_BIT; - if (flags & WINED3D_BUFFER_DISCARD) - { - mapflags |= GL_MAP_UNSYNCHRONIZED_BIT | GL_MAP_INVALIDATE_BUFFER_BIT; - } - else if (flags & WINED3D_BUFFER_NOSYNC) - { - mapflags |= GL_MAP_UNSYNCHRONIZED_BIT; - } - map = GL_EXTCALL(glMapBufferRange(This->buffer_type_hint, 0, - This->resource.size, mapflags)); - checkGLcall("glMapBufferRange"); + GL_EXTCALL(glFlushMappedBufferRange(This->buffer_type_hint, start, len)); + checkGLcall("glFlushMappedBufferRange"); } - else + else if (This->flags & WINED3D_BUFFER_FLUSH) { - if (This->flags & WINED3D_BUFFER_APPLESYNC) - { - DWORD syncflags = 0; - if (flags & WINED3D_BUFFER_DISCARD) syncflags |= WINED3DLOCK_DISCARD; - if (flags & WINED3D_BUFFER_NOSYNC) syncflags |= WINED3DLOCK_NOOVERWRITE; - LEAVE_GL(); - buffer_sync_apple(This, syncflags, gl_info); - ENTER_GL(); - } - map = GL_EXTCALL(glMapBufferARB(This->buffer_type_hint, GL_WRITE_ONLY_ARB)); - checkGLcall("glMapBufferARB"); - } - if (!map) - { - LEAVE_GL(); - ERR("Failed to map opengl buffer\n"); - return; + GL_EXTCALL(glFlushMappedBufferRangeAPPLE(This->buffer_type_hint, start, len)); + checkGLcall("glFlushMappedBufferRangeAPPLE"); } + } + GL_EXTCALL(glUnmapBufferARB(This->buffer_type_hint)); + checkGLcall("glUnmapBufferARB"); - while(This->modified_areas) - { - This->modified_areas--; - start = This->maps[This->modified_areas].offset; - len = This->maps[This->modified_areas].size; - - memcpy(map + start, This->resource.allocatedMemory + start, len); - - if (gl_info->supported[ARB_MAP_BUFFER_RANGE]) - { - GL_EXTCALL(glFlushMappedBufferRange(This->buffer_type_hint, start, len)); - checkGLcall("glFlushMappedBufferRange"); - } - else if (This->flags & WINED3D_BUFFER_FLUSH) - { - GL_EXTCALL(glFlushMappedBufferRangeAPPLE(This->buffer_type_hint, start, len)); - checkGLcall("glFlushMappedBufferRangeAPPLE"); - } - } - GL_EXTCALL(glUnmapBufferARB(This->buffer_type_hint)); - checkGLcall("glUnmapBufferARB"); - LEAVE_GL(); + LEAVE_GL(); } /* Do not call while under the GL lock. */ -static void STDMETHODCALLTYPE buffer_PreLoad(IWineD3DBuffer *iface) +void CDECL wined3d_buffer_preload(struct wined3d_buffer *buffer) { - struct wined3d_buffer *This = (struct wined3d_buffer *)iface; - IWineD3DDeviceImpl *device = This->resource.device; + DWORD flags = buffer->flags & (WINED3D_BUFFER_NOSYNC | WINED3D_BUFFER_DISCARD); + struct wined3d_device *device = buffer->resource.device; UINT start = 0, end = 0, len = 0, vertices; const struct wined3d_gl_info *gl_info; struct wined3d_context *context; BOOL decl_changed = FALSE; unsigned int i, j; BYTE *data; - DWORD flags = This->flags & (WINED3D_BUFFER_NOSYNC | WINED3D_BUFFER_DISCARD); - TRACE("iface %p\n", iface); - This->flags &= ~(WINED3D_BUFFER_NOSYNC | WINED3D_BUFFER_DISCARD); + TRACE("buffer %p.\n", buffer); - context = context_acquire(device, NULL); - gl_info = context->gl_info; + buffer->flags &= ~(WINED3D_BUFFER_NOSYNC | WINED3D_BUFFER_DISCARD); - if (!This->buffer_object) + if (!buffer->buffer_object) { /* TODO: Make converting independent from VBOs */ - if (This->flags & WINED3D_BUFFER_CREATEBO) + if (buffer->flags & WINED3D_BUFFER_CREATEBO) { - buffer_create_buffer_object(This, gl_info); - This->flags &= ~WINED3D_BUFFER_CREATEBO; + context = context_acquire(device, NULL); + buffer_create_buffer_object(buffer, context->gl_info); + context_release(context); + buffer->flags &= ~WINED3D_BUFFER_CREATEBO; } else { /* Not doing any conversion */ - goto end; + return; } } /* Reading the declaration makes only sense if the stateblock is finalized and the buffer bound to a stream */ - if (device->isInDraw && This->bind_count > 0) + if (device->isInDraw && buffer->bind_count > 0) { - decl_changed = buffer_find_decl(This); - This->flags |= WINED3D_BUFFER_HASDESC; + decl_changed = buffer_find_decl(buffer); + buffer->flags |= WINED3D_BUFFER_HASDESC; } - if (!decl_changed && !(This->flags & WINED3D_BUFFER_HASDESC && buffer_is_dirty(This))) + if (!decl_changed && !(buffer->flags & WINED3D_BUFFER_HASDESC && buffer_is_dirty(buffer))) { - context_release(context); - ++This->draw_count; - if (This->draw_count > VB_RESETDECLCHANGE) This->decl_change_count = 0; - if (This->draw_count > VB_RESETFULLCONVS) This->full_conversion_count = 0; + ++buffer->draw_count; + if (buffer->draw_count > VB_RESETDECLCHANGE) + buffer->decl_change_count = 0; + if (buffer->draw_count > VB_RESETFULLCONVS) + buffer->full_conversion_count = 0; return; } @@ -980,34 +817,33 @@ static void STDMETHODCALLTYPE buffer_PreLoad(IWineD3DBuffer *iface) */ if (decl_changed) { - ++This->decl_change_count; - This->draw_count = 0; + ++buffer->decl_change_count; + buffer->draw_count = 0; - if (This->decl_change_count > VB_MAXDECLCHANGES || - (This->conversion_map && (This->resource.usage & WINED3DUSAGE_DYNAMIC))) + if (buffer->decl_change_count > VB_MAXDECLCHANGES + || (buffer->conversion_map && (buffer->resource.usage & WINED3DUSAGE_DYNAMIC))) { FIXME("Too many declaration changes or converting dynamic buffer, stopping converting\n"); - IWineD3DBuffer_UnLoad(iface); - This->flags &= ~WINED3D_BUFFER_CREATEBO; + buffer_unload(&buffer->resource); + buffer->flags &= ~WINED3D_BUFFER_CREATEBO; - /* The stream source state handler might have read the memory of the vertex buffer already - * and got the memory in the vbo which is not valid any longer. Dirtify the stream source - * to force a reload. This happens only once per changed vertexbuffer and should occur rather - * rarely - */ + /* The stream source state handler might have read the memory of + * the vertex buffer already and got the memory in the vbo which + * is not valid any longer. Dirtify the stream source to force a + * reload. This happens only once per changed vertexbuffer and + * should occur rather rarely. */ IWineD3DDeviceImpl_MarkStateDirty(device, STATE_STREAMSRC); - goto end; + return; } - buffer_check_buffer_object_size(This, gl_info); /* The declaration changed, reload the whole buffer */ WARN("Reloading buffer because of decl change\n"); - buffer_clear_dirty_areas(This); - if(!buffer_add_dirty_area(This, 0, 0)) + buffer_clear_dirty_areas(buffer); + if (!buffer_add_dirty_area(buffer, 0, 0)) { ERR("buffer_add_dirty_area failed, this is not expected\n"); - goto end; + return; } /* Avoid unfenced updates, we might overwrite more areas of the buffer than the application * cleared for unsynchronized updates @@ -1020,172 +856,111 @@ static void STDMETHODCALLTYPE buffer_PreLoad(IWineD3DBuffer *iface) * changes it every minute drop the VBO after VB_MAX_DECL_CHANGES minutes. So count draws without * decl changes and reset the decl change count after a specific number of them */ - if(buffer_is_fully_dirty(This)) + if (buffer->conversion_map && buffer_is_fully_dirty(buffer)) { - ++This->full_conversion_count; - if(This->full_conversion_count > VB_MAXFULLCONVERSIONS) + ++buffer->full_conversion_count; + if (buffer->full_conversion_count > VB_MAXFULLCONVERSIONS) { - FIXME("Too many full buffer conversions, stopping converting\n"); - IWineD3DBuffer_UnLoad(iface); - This->flags &= ~WINED3D_BUFFER_CREATEBO; + FIXME("Too many full buffer conversions, stopping converting.\n"); + buffer_unload(&buffer->resource); + buffer->flags &= ~WINED3D_BUFFER_CREATEBO; IWineD3DDeviceImpl_MarkStateDirty(device, STATE_STREAMSRC); - goto end; + return; } } else { - ++This->draw_count; - if (This->draw_count > VB_RESETDECLCHANGE) This->decl_change_count = 0; - if (This->draw_count > VB_RESETFULLCONVS) This->full_conversion_count = 0; + ++buffer->draw_count; + if (buffer->draw_count > VB_RESETDECLCHANGE) + buffer->decl_change_count = 0; + if (buffer->draw_count > VB_RESETFULLCONVS) + buffer->full_conversion_count = 0; } } - if(This->buffer_type_hint == GL_ELEMENT_ARRAY_BUFFER_ARB) - { - IWineD3DDeviceImpl_MarkStateDirty(This->resource.device, STATE_INDEXBUFFER); - } + if (buffer->buffer_type_hint == GL_ELEMENT_ARRAY_BUFFER_ARB) + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_INDEXBUFFER); - if (!This->conversion_map) + if (!buffer->conversion_map) { - /* That means that there is nothing to fixup. Just upload from This->resource.allocatedMemory - * directly into the vbo. Do not free the system memory copy because drawPrimitive may need it if - * the stride is 0, for instancing emulation, vertex blending emulation or shader emulation. - */ - TRACE("No conversion needed\n"); + /* That means that there is nothing to fixup. Just upload from + * buffer->resource.allocatedMemory directly into the vbo. Do not + * free the system memory copy because drawPrimitive may need it if + * the stride is 0, for instancing emulation, vertex blending + * emulation or shader emulation. */ + TRACE("No conversion needed.\n"); /* Nothing to do because we locked directly into the vbo */ - if (!(This->flags & WINED3D_BUFFER_DOUBLEBUFFER)) + if (!(buffer->flags & WINED3D_BUFFER_DOUBLEBUFFER)) { - context_release(context); return; } - buffer_direct_upload(This, context->gl_info, flags); + context = context_acquire(device, NULL); + buffer_direct_upload(buffer, context->gl_info, flags); context_release(context); return; } - if(!(This->flags & WINED3D_BUFFER_DOUBLEBUFFER)) + context = context_acquire(device, NULL); + gl_info = context->gl_info; + + if(!(buffer->flags & WINED3D_BUFFER_DOUBLEBUFFER)) { - buffer_get_sysmem(This, gl_info); + buffer_get_sysmem(buffer, gl_info); } /* Now for each vertex in the buffer that needs conversion */ - vertices = This->resource.size / This->stride; + vertices = buffer->resource.size / buffer->stride; - if (This->conversion_shift) + data = HeapAlloc(GetProcessHeap(), 0, buffer->resource.size); + + while(buffer->modified_areas) { - TRACE("Shifted conversion\n"); - data = HeapAlloc(GetProcessHeap(), 0, vertices * This->conversion_stride); - - start = 0; - len = This->resource.size; + buffer->modified_areas--; + start = buffer->maps[buffer->modified_areas].offset; + len = buffer->maps[buffer->modified_areas].size; end = start + len; - if (This->maps[0].offset || This->maps[0].size != This->resource.size) + memcpy(data + start, buffer->resource.allocatedMemory + start, end - start); + for (i = start / buffer->stride; i < min((end / buffer->stride) + 1, vertices); ++i) { - FIXME("Implement partial buffer load with shifted conversion\n"); - } - - for (i = start / This->stride; i < min((end / This->stride) + 1, vertices); ++i) - { - for (j = 0; j < This->stride; ++j) + for (j = 0; j < buffer->stride; ++j) { - switch(This->conversion_map[j]) + switch (buffer->conversion_map[j]) { case CONV_NONE: - data[This->conversion_stride * i + j + This->conversion_shift[j]] - = This->resource.allocatedMemory[This->stride * i + j]; + /* Done already */ + j += 3; + break; + case CONV_D3DCOLOR: + fixup_d3dcolor((DWORD *) (data + i * buffer->stride + j)); + j += 3; break; - case CONV_FLOAT16_2: - { - float *out = (float *)(&data[This->conversion_stride * i + j + This->conversion_shift[j]]); - const WORD *in = (WORD *)(&This->resource.allocatedMemory[i * This->stride + j]); - - out[1] = float_16_to_32(in + 1); - out[0] = float_16_to_32(in + 0); - j += 3; /* Skip 3 additional bytes,as a FLOAT16_2 has 4 bytes */ + case CONV_POSITIONT: + fixup_transformed_pos((float *) (data + i * buffer->stride + j)); + j += 15; break; - } - default: - FIXME("Unimplemented conversion %d in shifted conversion\n", This->conversion_map[j]); - break; + FIXME("Unimplemented conversion %d in shifted conversion\n", buffer->conversion_map[j]); } } } ENTER_GL(); - GL_EXTCALL(glBindBufferARB(This->buffer_type_hint, This->buffer_object)); + GL_EXTCALL(glBindBufferARB(buffer->buffer_type_hint, buffer->buffer_object)); checkGLcall("glBindBufferARB"); - GL_EXTCALL(glBufferSubDataARB(This->buffer_type_hint, 0, vertices * This->conversion_stride, data)); + GL_EXTCALL(glBufferSubDataARB(buffer->buffer_type_hint, start, len, data + start)); checkGLcall("glBufferSubDataARB"); LEAVE_GL(); } - else - { - data = HeapAlloc(GetProcessHeap(), 0, This->resource.size); - - while(This->modified_areas) - { - This->modified_areas--; - start = This->maps[This->modified_areas].offset; - len = This->maps[This->modified_areas].size; - end = start + len; - - memcpy(data + start, This->resource.allocatedMemory + start, end - start); - for (i = start / This->stride; i < min((end / This->stride) + 1, vertices); ++i) - { - for (j = 0; j < This->stride; ++j) - { - switch(This->conversion_map[j]) - { - case CONV_NONE: - /* Done already */ - j += 3; - break; - case CONV_D3DCOLOR: - fixup_d3dcolor((DWORD *) (data + i * This->stride + j)); - j += 3; - break; - - case CONV_POSITIONT: - fixup_transformed_pos((float *) (data + i * This->stride + j)); - j += 15; - break; - - case CONV_FLOAT16_2: - ERR("Did not expect FLOAT16 conversion in unshifted conversion\n"); - default: - FIXME("Unimplemented conversion %d in shifted conversion\n", This->conversion_map[j]); - } - } - } - - ENTER_GL(); - GL_EXTCALL(glBindBufferARB(This->buffer_type_hint, This->buffer_object)); - checkGLcall("glBindBufferARB"); - GL_EXTCALL(glBufferSubDataARB(This->buffer_type_hint, start, len, data + start)); - checkGLcall("glBufferSubDataARB"); - LEAVE_GL(); - } - } HeapFree(GetProcessHeap(), 0, data); - -end: context_release(context); } -static WINED3DRESOURCETYPE STDMETHODCALLTYPE buffer_GetType(IWineD3DBuffer *iface) -{ - return resource_get_type((IWineD3DResource *)iface); -} - -/* IWineD3DBuffer methods */ - static DWORD buffer_sanitize_flags(struct wined3d_buffer *buffer, DWORD flags) { /* Not all flags make sense together, but Windows never returns an error. Catch the @@ -1236,75 +1011,80 @@ static GLbitfield buffer_gl_map_flags(DWORD d3d_flags) return ret; } -static HRESULT STDMETHODCALLTYPE buffer_Map(IWineD3DBuffer *iface, UINT offset, UINT size, BYTE **data, DWORD flags) +struct wined3d_resource * CDECL wined3d_buffer_get_resource(struct wined3d_buffer *buffer) { - struct wined3d_buffer *This = (struct wined3d_buffer *)iface; + TRACE("buffer %p.\n", buffer); + + return &buffer->resource; +} + +HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UINT size, BYTE **data, DWORD flags) +{ + BOOL dirty = buffer_is_dirty(buffer); LONG count; - BOOL dirty = buffer_is_dirty(This); - TRACE("iface %p, offset %u, size %u, data %p, flags %#x\n", iface, offset, size, data, flags); + TRACE("buffer %p, offset %u, size %u, data %p, flags %#x\n", buffer, offset, size, data, flags); - flags = buffer_sanitize_flags(This, flags); + flags = buffer_sanitize_flags(buffer, flags); if (!(flags & WINED3DLOCK_READONLY)) { - if (!buffer_add_dirty_area(This, offset, size)) return E_OUTOFMEMORY; + if (!buffer_add_dirty_area(buffer, offset, size)) return E_OUTOFMEMORY; } - count = InterlockedIncrement(&This->lock_count); + count = InterlockedIncrement(&buffer->lock_count); - if (This->buffer_object) + if (buffer->buffer_object) { - if(!(This->flags & WINED3D_BUFFER_DOUBLEBUFFER)) + if (!(buffer->flags & WINED3D_BUFFER_DOUBLEBUFFER)) { - if(count == 1) + if (count == 1) { - IWineD3DDeviceImpl *device = This->resource.device; + struct wined3d_device *device = buffer->resource.device; struct wined3d_context *context; const struct wined3d_gl_info *gl_info; - if(This->buffer_type_hint == GL_ELEMENT_ARRAY_BUFFER_ARB) - { - IWineD3DDeviceImpl_MarkStateDirty(This->resource.device, STATE_INDEXBUFFER); - } + if (buffer->buffer_type_hint == GL_ELEMENT_ARRAY_BUFFER_ARB) + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_INDEXBUFFER); context = context_acquire(device, NULL); gl_info = context->gl_info; ENTER_GL(); - GL_EXTCALL(glBindBufferARB(This->buffer_type_hint, This->buffer_object)); + GL_EXTCALL(glBindBufferARB(buffer->buffer_type_hint, buffer->buffer_object)); if (gl_info->supported[ARB_MAP_BUFFER_RANGE]) { GLbitfield mapflags = buffer_gl_map_flags(flags); - This->resource.allocatedMemory = GL_EXTCALL(glMapBufferRange(This->buffer_type_hint, 0, - This->resource.size, mapflags)); + buffer->resource.allocatedMemory = GL_EXTCALL(glMapBufferRange(buffer->buffer_type_hint, + 0, buffer->resource.size, mapflags)); checkGLcall("glMapBufferRange"); } else { - if(This->flags & WINED3D_BUFFER_APPLESYNC) + if (buffer->flags & WINED3D_BUFFER_APPLESYNC) { LEAVE_GL(); - buffer_sync_apple(This, flags, gl_info); + buffer_sync_apple(buffer, flags, gl_info); ENTER_GL(); } - This->resource.allocatedMemory = GL_EXTCALL(glMapBufferARB(This->buffer_type_hint, GL_READ_WRITE_ARB)); + buffer->resource.allocatedMemory = GL_EXTCALL(glMapBufferARB(buffer->buffer_type_hint, + GL_READ_WRITE_ARB)); checkGLcall("glMapBufferARB"); } LEAVE_GL(); - if (((DWORD_PTR) This->resource.allocatedMemory) & (RESOURCE_ALIGNMENT - 1)) + if (((DWORD_PTR)buffer->resource.allocatedMemory) & (RESOURCE_ALIGNMENT - 1)) { - WARN("Pointer %p is not %u byte aligned, falling back to double buffered operation\n", - This->resource.allocatedMemory, RESOURCE_ALIGNMENT); + WARN("Pointer %p is not %u byte aligned, falling back to double buffered operation.\n", + buffer->resource.allocatedMemory, RESOURCE_ALIGNMENT); ENTER_GL(); - GL_EXTCALL(glUnmapBufferARB(This->buffer_type_hint)); + GL_EXTCALL(glUnmapBufferARB(buffer->buffer_type_hint)); checkGLcall("glUnmapBufferARB"); LEAVE_GL(); - This->resource.allocatedMemory = NULL; + buffer->resource.allocatedMemory = NULL; - buffer_get_sysmem(This, gl_info); - TRACE("New pointer is %p\n", This->resource.allocatedMemory); + buffer_get_sysmem(buffer, gl_info); + TRACE("New pointer is %p.\n", buffer->resource.allocatedMemory); } context_release(context); } @@ -1313,143 +1093,108 @@ static HRESULT STDMETHODCALLTYPE buffer_Map(IWineD3DBuffer *iface, UINT offset, { if (dirty) { - if (This->flags & WINED3D_BUFFER_NOSYNC && !(flags & WINED3DLOCK_NOOVERWRITE)) + if (buffer->flags & WINED3D_BUFFER_NOSYNC && !(flags & WINED3DLOCK_NOOVERWRITE)) { - This->flags &= ~WINED3D_BUFFER_NOSYNC; + buffer->flags &= ~WINED3D_BUFFER_NOSYNC; } } else if(flags & WINED3DLOCK_NOOVERWRITE) { - This->flags |= WINED3D_BUFFER_NOSYNC; + buffer->flags |= WINED3D_BUFFER_NOSYNC; } if (flags & WINED3DLOCK_DISCARD) { - This->flags |= WINED3D_BUFFER_DISCARD; + buffer->flags |= WINED3D_BUFFER_DISCARD; } } } - *data = This->resource.allocatedMemory + offset; + *data = buffer->resource.allocatedMemory + offset; - TRACE("Returning memory at %p (base %p, offset %u)\n", *data, This->resource.allocatedMemory, offset); - /* TODO: check Flags compatibility with This->currentDesc.Usage (see MSDN) */ + TRACE("Returning memory at %p (base %p, offset %u).\n", *data, buffer->resource.allocatedMemory, offset); + /* TODO: check Flags compatibility with buffer->currentDesc.Usage (see MSDN) */ return WINED3D_OK; } -static HRESULT STDMETHODCALLTYPE buffer_Unmap(IWineD3DBuffer *iface) +void CDECL wined3d_buffer_unmap(struct wined3d_buffer *buffer) { - struct wined3d_buffer *This = (struct wined3d_buffer *)iface; ULONG i; - TRACE("(%p)\n", This); + TRACE("buffer %p.\n", buffer); /* In the case that the number of Unmap calls > the * number of Map calls, d3d returns always D3D_OK. * This is also needed to prevent Map from returning garbage on * the next call (this will happen if the lock_count is < 0). */ - if (!This->lock_count) + if (!buffer->lock_count) { - TRACE("Unmap called without a previous Map call!\n"); - return WINED3D_OK; + WARN("Unmap called without a previous map call.\n"); + return; } - if (InterlockedDecrement(&This->lock_count)) + if (InterlockedDecrement(&buffer->lock_count)) { /* Delay loading the buffer until everything is unlocked */ - TRACE("Ignoring unlock\n"); - return WINED3D_OK; + TRACE("Ignoring unmap.\n"); + return; } - if(!(This->flags & WINED3D_BUFFER_DOUBLEBUFFER) && This->buffer_object) + if (!(buffer->flags & WINED3D_BUFFER_DOUBLEBUFFER) && buffer->buffer_object) { - IWineD3DDeviceImpl *device = This->resource.device; + struct wined3d_device *device = buffer->resource.device; const struct wined3d_gl_info *gl_info; struct wined3d_context *context; - if(This->buffer_type_hint == GL_ELEMENT_ARRAY_BUFFER_ARB) + if (buffer->buffer_type_hint == GL_ELEMENT_ARRAY_BUFFER_ARB) { - IWineD3DDeviceImpl_MarkStateDirty(This->resource.device, STATE_INDEXBUFFER); + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_INDEXBUFFER); } context = context_acquire(device, NULL); gl_info = context->gl_info; ENTER_GL(); - GL_EXTCALL(glBindBufferARB(This->buffer_type_hint, This->buffer_object)); + GL_EXTCALL(glBindBufferARB(buffer->buffer_type_hint, buffer->buffer_object)); if (gl_info->supported[ARB_MAP_BUFFER_RANGE]) { - for(i = 0; i < This->modified_areas; i++) + for (i = 0; i < buffer->modified_areas; ++i) { - GL_EXTCALL(glFlushMappedBufferRange(This->buffer_type_hint, - This->maps[i].offset, - This->maps[i].size)); + GL_EXTCALL(glFlushMappedBufferRange(buffer->buffer_type_hint, + buffer->maps[i].offset, buffer->maps[i].size)); checkGLcall("glFlushMappedBufferRange"); } } - else if (This->flags & WINED3D_BUFFER_FLUSH) + else if (buffer->flags & WINED3D_BUFFER_FLUSH) { - for(i = 0; i < This->modified_areas; i++) + for (i = 0; i < buffer->modified_areas; ++i) { - GL_EXTCALL(glFlushMappedBufferRangeAPPLE(This->buffer_type_hint, - This->maps[i].offset, - This->maps[i].size)); + GL_EXTCALL(glFlushMappedBufferRangeAPPLE(buffer->buffer_type_hint, + buffer->maps[i].offset, buffer->maps[i].size)); checkGLcall("glFlushMappedBufferRangeAPPLE"); } } - GL_EXTCALL(glUnmapBufferARB(This->buffer_type_hint)); + GL_EXTCALL(glUnmapBufferARB(buffer->buffer_type_hint)); LEAVE_GL(); context_release(context); - This->resource.allocatedMemory = NULL; - buffer_clear_dirty_areas(This); + buffer->resource.allocatedMemory = NULL; + buffer_clear_dirty_areas(buffer); } - else if (This->flags & WINED3D_BUFFER_HASDESC) + else if (buffer->flags & WINED3D_BUFFER_HASDESC) { - buffer_PreLoad(iface); + wined3d_buffer_preload(buffer); } - - return WINED3D_OK; } -static void STDMETHODCALLTYPE buffer_GetDesc(IWineD3DBuffer *iface, WINED3DBUFFER_DESC *desc) +static const struct wined3d_resource_ops buffer_resource_ops = { - struct wined3d_buffer *This = (struct wined3d_buffer *)iface; - - TRACE("(%p)\n", This); - - desc->Type = This->resource.resourceType; - desc->Usage = This->resource.usage; - desc->Pool = This->resource.pool; - desc->Size = This->resource.size; -} - -static const struct IWineD3DBufferVtbl wined3d_buffer_vtbl = -{ - /* IUnknown methods */ - buffer_QueryInterface, - buffer_AddRef, - buffer_Release, - /* IWineD3DBase methods */ - buffer_GetParent, - /* IWineD3DResource methods */ - buffer_SetPrivateData, - buffer_GetPrivateData, - buffer_FreePrivateData, - buffer_SetPriority, - buffer_GetPriority, - buffer_PreLoad, - buffer_UnLoad, - buffer_GetType, - /* IWineD3DBuffer methods */ - buffer_Map, - buffer_Unmap, - buffer_GetDesc, + buffer_unload, }; -HRESULT buffer_init(struct wined3d_buffer *buffer, IWineD3DDeviceImpl *device, +static HRESULT buffer_init(struct wined3d_buffer *buffer, struct wined3d_device *device, UINT size, DWORD usage, enum wined3d_format_id format_id, WINED3DPOOL pool, GLenum bind_hint, const char *data, void *parent, const struct wined3d_parent_ops *parent_ops) { @@ -1464,10 +1209,9 @@ HRESULT buffer_init(struct wined3d_buffer *buffer, IWineD3DDeviceImpl *device, return WINED3DERR_INVALIDCALL; } - buffer->vtbl = &wined3d_buffer_vtbl; - - hr = resource_init((IWineD3DResource *)buffer, WINED3DRTYPE_BUFFER, - device, size, usage, format, pool, parent, parent_ops); + hr = resource_init(&buffer->resource, device, WINED3DRTYPE_BUFFER, format, + WINED3DMULTISAMPLE_NONE, 0, usage, pool, size, 1, 1, size, + parent, parent_ops, &buffer_resource_ops); if (FAILED(hr)) { WARN("Failed to initialize resource, hr %#x\n", hr); @@ -1509,36 +1253,137 @@ HRESULT buffer_init(struct wined3d_buffer *buffer, IWineD3DDeviceImpl *device, { BYTE *ptr; - hr = IWineD3DBuffer_Map((IWineD3DBuffer *)buffer, 0, size, &ptr, 0); + hr = wined3d_buffer_map(buffer, 0, size, &ptr, 0); if (FAILED(hr)) { ERR("Failed to map buffer, hr %#x\n", hr); - buffer_UnLoad((IWineD3DBuffer *)buffer); - resource_cleanup((IWineD3DResource *)buffer); + buffer_unload(&buffer->resource); + resource_cleanup(&buffer->resource); return hr; } memcpy(ptr, data, size); - hr = IWineD3DBuffer_Unmap((IWineD3DBuffer *)buffer); - if (FAILED(hr)) - { - ERR("Failed to unmap buffer, hr %#x\n", hr); - buffer_UnLoad((IWineD3DBuffer *)buffer); - resource_cleanup((IWineD3DResource *)buffer); - return hr; - } + wined3d_buffer_unmap(buffer); } buffer->maps = HeapAlloc(GetProcessHeap(), 0, sizeof(*buffer->maps)); if (!buffer->maps) { ERR("Out of memory\n"); - buffer_UnLoad((IWineD3DBuffer *)buffer); - resource_cleanup((IWineD3DResource *)buffer); + buffer_unload(&buffer->resource); + resource_cleanup(&buffer->resource); return E_OUTOFMEMORY; } buffer->maps_size = 1; return WINED3D_OK; } + +HRESULT CDECL wined3d_buffer_create(struct wined3d_device *device, struct wined3d_buffer_desc *desc, const void *data, + void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_buffer **buffer) +{ + struct wined3d_buffer *object; + HRESULT hr; + + TRACE("device %p, desc %p, data %p, parent %p, buffer %p\n", device, desc, data, parent, buffer); + + object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); + if (!object) + { + ERR("Failed to allocate memory\n"); + return E_OUTOFMEMORY; + } + + FIXME("Ignoring access flags (pool)\n"); + + hr = buffer_init(object, device, desc->byte_width, desc->usage, WINED3DFMT_UNKNOWN, + WINED3DPOOL_MANAGED, GL_ARRAY_BUFFER_ARB, data, parent, parent_ops); + if (FAILED(hr)) + { + WARN("Failed to initialize buffer, hr %#x.\n", hr); + HeapFree(GetProcessHeap(), 0, object); + return hr; + } + object->desc = *desc; + + TRACE("Created buffer %p.\n", object); + + *buffer = object; + + return WINED3D_OK; +} + +HRESULT CDECL wined3d_buffer_create_vb(struct wined3d_device *device, UINT size, DWORD usage, WINED3DPOOL pool, + void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_buffer **buffer) +{ + struct wined3d_buffer *object; + HRESULT hr; + + TRACE("device %p, size %u, usage %#x, pool %#x, parent %p, parent_ops %p, buffer %p.\n", + device, size, usage, pool, parent, parent_ops, buffer); + + if (pool == WINED3DPOOL_SCRATCH) + { + /* The d3d9 tests shows that this is not allowed. It doesn't make much + * sense anyway, SCRATCH buffers wouldn't be usable anywhere. */ + WARN("Vertex buffer in WINED3DPOOL_SCRATCH requested, returning WINED3DERR_INVALIDCALL.\n"); + *buffer = NULL; + return WINED3DERR_INVALIDCALL; + } + + object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); + if (!object) + { + ERR("Out of memory\n"); + *buffer = NULL; + return WINED3DERR_OUTOFVIDEOMEMORY; + } + + hr = buffer_init(object, device, size, usage, WINED3DFMT_VERTEXDATA, + pool, GL_ARRAY_BUFFER_ARB, NULL, parent, parent_ops); + if (FAILED(hr)) + { + WARN("Failed to initialize buffer, hr %#x.\n", hr); + HeapFree(GetProcessHeap(), 0, object); + return hr; + } + + TRACE("Created buffer %p.\n", object); + *buffer = object; + + return WINED3D_OK; +} + +HRESULT CDECL wined3d_buffer_create_ib(struct wined3d_device *device, UINT size, DWORD usage, WINED3DPOOL pool, + void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_buffer **buffer) +{ + struct wined3d_buffer *object; + HRESULT hr; + + TRACE("device %p, size %u, usage %#x, pool %#x, parent %p, parent_ops %p, buffer %p.\n", + device, size, usage, pool, parent, parent_ops, buffer); + + object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); + if (!object) + { + ERR("Out of memory\n"); + *buffer = NULL; + return WINED3DERR_OUTOFVIDEOMEMORY; + } + + hr = buffer_init(object, device, size, usage | WINED3DUSAGE_STATICDECL, + WINED3DFMT_UNKNOWN, pool, GL_ELEMENT_ARRAY_BUFFER_ARB, NULL, + parent, parent_ops); + if (FAILED(hr)) + { + WARN("Failed to initialize buffer, hr %#x\n", hr); + HeapFree(GetProcessHeap(), 0, object); + return hr; + } + + TRACE("Created buffer %p.\n", object); + *buffer = object; + + return WINED3D_OK; +} diff --git a/dll/directx/wine/wined3d/clipper.c b/dll/directx/wine/wined3d/clipper.c index 48ce06f76d4..e5131d7f749 100644 --- a/dll/directx/wine/wined3d/clipper.c +++ b/dll/directx/wine/wined3d/clipper.c @@ -28,70 +28,51 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d); -static HRESULT WINAPI IWineD3DClipperImpl_QueryInterface(IWineD3DClipper *iface, REFIID riid, void **object) +ULONG CDECL wined3d_clipper_incref(struct wined3d_clipper *clipper) { - TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object); + ULONG refcount = InterlockedIncrement(&clipper->ref); - if (IsEqualGUID(riid, &IID_IWineD3DClipper) - || IsEqualGUID(riid, &IID_IUnknown)) + TRACE("%p increasing refcount to %u.\n", clipper, refcount); + + return refcount; +} + +ULONG CDECL wined3d_clipper_decref(struct wined3d_clipper *clipper) +{ + ULONG refcount = InterlockedDecrement(&clipper->ref); + + TRACE("%p decreasing refcount to %u.\n", clipper, refcount); + + if (!refcount) + HeapFree(GetProcessHeap(), 0, clipper); + + return refcount; +} + +HRESULT CDECL wined3d_clipper_set_window(struct wined3d_clipper *clipper, DWORD flags, HWND window) +{ + TRACE("clipper %p, flags %#x, window %p.\n", clipper, flags, window); + + if (flags) { - IUnknown_AddRef(iface); - *object = iface; - return S_OK; - } - - WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid)); - - *object = NULL; - return E_NOINTERFACE; -} - -static ULONG WINAPI IWineD3DClipperImpl_AddRef(IWineD3DClipper *iface ) -{ - IWineD3DClipperImpl *This = (IWineD3DClipperImpl *)iface; - ULONG ref = InterlockedIncrement(&This->ref); - - TRACE("(%p)->() incrementing from %u.\n", This, ref - 1); - - return ref; -} - -static ULONG WINAPI IWineD3DClipperImpl_Release(IWineD3DClipper *iface) -{ - IWineD3DClipperImpl *This = (IWineD3DClipperImpl *)iface; - ULONG ref = InterlockedDecrement(&This->ref); - - TRACE("(%p)->() decrementing from %u.\n", This, ref + 1); - - if (!ref) HeapFree(GetProcessHeap(), 0, This); - - return ref; -} - -static HRESULT WINAPI IWineD3DClipperImpl_SetHwnd(IWineD3DClipper *iface, DWORD Flags, HWND hWnd) -{ - IWineD3DClipperImpl *This = (IWineD3DClipperImpl *)iface; - - TRACE("(%p)->(0x%08x,%p)\n", This, Flags, hWnd); - if( Flags ) - { - FIXME("Flags = 0x%08x, not supported.\n",Flags); + FIXME("flags %#x, not supported.\n", flags); return WINED3DERR_INVALIDCALL; } - This->hWnd = hWnd; + clipper->hWnd = window; + return WINED3D_OK; } -static HRESULT WINAPI IWineD3DClipperImpl_GetClipList(IWineD3DClipper *iface, const RECT *Rect, - RGNDATA *ClipList, DWORD *Size) +HRESULT CDECL wined3d_clipper_get_clip_list(const struct wined3d_clipper *clipper, const RECT *rect, + RGNDATA *clip_list, DWORD *clip_list_size) { - IWineD3DClipperImpl *This = (IWineD3DClipperImpl *)iface; - TRACE("(%p,%p,%p,%p)\n", This, Rect, ClipList, Size); + TRACE("clipper %p, rect %s, clip_list %p, clip_list_size %p.\n", + clipper, wine_dbgstr_rect(rect), clip_list, clip_list_size); - if (This->hWnd) + if (clipper->hWnd) { - HDC hDC = GetDCEx(This->hWnd, NULL, DCX_WINDOW); + HDC hDC = GetDCEx(clipper->hWnd, NULL, DCX_WINDOW); if (hDC) { HRGN hRgn = CreateRectRgn(0,0,0,0); @@ -101,55 +82,60 @@ static HRESULT WINAPI IWineD3DClipperImpl_GetClipList(IWineD3DClipper *iface, co { /* map region to screen coordinates */ POINT org; - GetDCOrgEx( hDC, &org ); - OffsetRgn( hRgn, org.x, org.y ); + GetDCOrgEx(hDC, &org); + OffsetRgn(hRgn, org.x, org.y); } - if (Rect) + if (rect) { - HRGN hRgnClip = CreateRectRgn(Rect->left, Rect->top, - Rect->right, Rect->bottom); + HRGN hRgnClip = CreateRectRgn(rect->left, rect->top, + rect->right, rect->bottom); CombineRgn(hRgn, hRgn, hRgnClip, RGN_AND); DeleteObject(hRgnClip); } - *Size = GetRegionData(hRgn, *Size, ClipList); + *clip_list_size = GetRegionData(hRgn, *clip_list_size, clip_list); } DeleteObject(hRgn); - ReleaseDC(This->hWnd, hDC); + ReleaseDC(clipper->hWnd, hDC); } return WINED3D_OK; } else { - static int warned = 0; - if (warned++ < 10) - FIXME("(%p,%p,%p,%p),stub!\n",This,Rect,ClipList,Size); - if (Size) *Size=0; + static unsigned int once; + + if (!once++) + FIXME("clipper %p, rect %s, clip_list %p, clip_list_size %p stub!\n", + clipper, wine_dbgstr_rect(rect), clip_list, clip_list_size); + + if (clip_list_size) + *clip_list_size = 0; + return WINEDDERR_NOCLIPLIST; } } -static HRESULT WINAPI IWineD3DClipperImpl_SetClipList(IWineD3DClipper *iface, const RGNDATA *rgn, DWORD Flags) +HRESULT CDECL wined3d_clipper_set_clip_list(struct wined3d_clipper *clipper, const RGNDATA *region, DWORD flags) { - static int warned = 0; + static unsigned int once; - if (warned++ < 10 || !rgn) - FIXME("iface %p, region %p, flags %#x stub!\n", iface, rgn, Flags); + if (!once++ || !region) + FIXME("clipper %p, region %p, flags %#x stub!\n", clipper, region, flags); return WINED3D_OK; } -static HRESULT WINAPI IWineD3DClipperImpl_GetHwnd(IWineD3DClipper *iface, HWND *hwnd) +HRESULT CDECL wined3d_clipper_get_window(const struct wined3d_clipper *clipper, HWND *window) { - IWineD3DClipperImpl *This = (IWineD3DClipperImpl *)iface; - TRACE("(%p)->(%p)\n", This, hwnd); + TRACE("clipper %p, window %p.\n", clipper, window); + + *window = clipper->hWnd; - *hwnd = This->hWnd; return WINED3D_OK; } -static HRESULT WINAPI IWineD3DClipperImpl_IsClipListChanged(IWineD3DClipper *iface, BOOL *changed) +HRESULT CDECL wined3d_clipper_is_clip_list_changed(const struct wined3d_clipper *clipper, BOOL *changed) { - FIXME("iface %p, changed %p stub!\n", iface, changed); + FIXME("clipper %p, changed %p stub!\n", clipper, changed); /* XXX What is safest? */ *changed = FALSE; @@ -157,33 +143,20 @@ static HRESULT WINAPI IWineD3DClipperImpl_IsClipListChanged(IWineD3DClipper *ifa return WINED3D_OK; } -static const IWineD3DClipperVtbl IWineD3DClipper_Vtbl = +struct wined3d_clipper * CDECL wined3d_clipper_create(void) { - IWineD3DClipperImpl_QueryInterface, - IWineD3DClipperImpl_AddRef, - IWineD3DClipperImpl_Release, - IWineD3DClipperImpl_GetClipList, - IWineD3DClipperImpl_GetHwnd, - IWineD3DClipperImpl_IsClipListChanged, - IWineD3DClipperImpl_SetClipList, - IWineD3DClipperImpl_SetHwnd -}; - -IWineD3DClipper * WINAPI WineDirect3DCreateClipper(void) -{ - IWineD3DClipperImpl *obj; + struct wined3d_clipper *clipper; TRACE("\n"); - obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*obj)); - if(!obj) + clipper = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*clipper)); + if (!clipper) { ERR("Out of memory when trying to allocate a WineD3D Clipper\n"); return NULL; } - obj->lpVtbl = &IWineD3DClipper_Vtbl; + wined3d_clipper_incref(clipper); - IWineD3DClipper_AddRef((IWineD3DClipper *)obj); - return (IWineD3DClipper *) obj; + return clipper; } diff --git a/dll/directx/wine/wined3d/context.c b/dll/directx/wine/wined3d/context.c index 6f9d9d7ce22..04942527e07 100644 --- a/dll/directx/wine/wined3d/context.c +++ b/dll/directx/wine/wined3d/context.c @@ -2,7 +2,7 @@ * Context and render target management in wined3d * * Copyright 2007-2008 Stefan Dösinger for CodeWeavers - * Copyright 2009 Henri Verbeet for CodeWeavers + * Copyright 2009-2011 Henri Verbeet for CodeWeavers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -112,13 +112,14 @@ static void context_destroy_fbo(struct wined3d_context *context, GLuint *fbo) } /* GL locking is done by the caller */ -static void context_apply_attachment_filter_states(IWineD3DSurfaceImpl *surface, DWORD location) +static void context_apply_attachment_filter_states(const struct wined3d_context *context, + struct wined3d_surface *surface, DWORD location) { /* Update base texture states array */ if (surface->container.type == WINED3D_CONTAINER_TEXTURE) { - IWineD3DBaseTextureImpl *texture_impl = surface->container.u.texture; - IWineD3DDeviceImpl *device = surface->resource.device; + struct wined3d_texture *texture = surface->container.u.texture; + struct wined3d_device *device = surface->resource.device; BOOL update_minfilter = FALSE; BOOL update_magfilter = FALSE; struct gl_texture *gl_tex; @@ -126,16 +127,13 @@ static void context_apply_attachment_filter_states(IWineD3DSurfaceImpl *surface, switch (location) { case SFLAG_INTEXTURE: - gl_tex = &texture_impl->baseTexture.texture_rgb; - break; - case SFLAG_INSRGBTEX: - gl_tex = &texture_impl->baseTexture.texture_srgb; + gl_tex = wined3d_texture_get_gl_texture(texture, + context->gl_info, location == SFLAG_INSRGBTEX); break; default: ERR("Unsupported location %s (%#x).\n", debug_surflocation(location), location); - IWineD3DBaseTexture_Release((IWineD3DBaseTexture *)texture_impl); return; } @@ -153,10 +151,10 @@ static void context_apply_attachment_filter_states(IWineD3DSurfaceImpl *surface, update_magfilter = TRUE; } - if (texture_impl->baseTexture.bindCount) + if (texture->bind_count) { WARN("Render targets should not be bound to a sampler\n"); - IWineD3DDeviceImpl_MarkStateDirty(device, STATE_SAMPLER(texture_impl->baseTexture.sampler)); + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_SAMPLER(texture->sampler)); } if (update_minfilter || update_magfilter) @@ -193,7 +191,7 @@ static void context_apply_attachment_filter_states(IWineD3DSurfaceImpl *surface, /* GL locking is done by the caller */ void context_attach_depth_stencil_fbo(struct wined3d_context *context, - GLenum fbo_target, IWineD3DSurfaceImpl *depth_stencil, BOOL use_render_buffer) + GLenum fbo_target, struct wined3d_surface *depth_stencil, BOOL use_render_buffer) { const struct wined3d_gl_info *gl_info = context->gl_info; @@ -201,7 +199,7 @@ void context_attach_depth_stencil_fbo(struct wined3d_context *context, if (depth_stencil) { - DWORD format_flags = depth_stencil->resource.format->Flags; + DWORD format_flags = depth_stencil->resource.format->flags; if (use_render_buffer && depth_stencil->current_renderbuffer) { @@ -222,7 +220,7 @@ void context_attach_depth_stencil_fbo(struct wined3d_context *context, else { surface_prepare_texture(depth_stencil, gl_info, FALSE); - context_apply_attachment_filter_states(depth_stencil, SFLAG_INTEXTURE); + context_apply_attachment_filter_states(context, depth_stencil, SFLAG_INTEXTURE); if (format_flags & WINED3DFMT_FLAG_DEPTH) { @@ -265,28 +263,26 @@ void context_attach_depth_stencil_fbo(struct wined3d_context *context, /* GL locking is done by the caller */ static void context_attach_surface_fbo(const struct wined3d_context *context, - GLenum fbo_target, DWORD idx, IWineD3DSurfaceImpl *surface, DWORD location) + GLenum fbo_target, DWORD idx, struct wined3d_surface *surface, DWORD location) { const struct wined3d_gl_info *gl_info = context->gl_info; TRACE("Attach surface %p to %u\n", surface, idx); - if (surface) + if (surface && surface->resource.format->id != WINED3DFMT_NULL) { + BOOL srgb; + switch (location) { case SFLAG_INTEXTURE: - surface_prepare_texture(surface, gl_info, FALSE); - context_apply_attachment_filter_states(surface, location); - gl_info->fbo_ops.glFramebufferTexture2D(fbo_target, GL_COLOR_ATTACHMENT0 + idx, - surface->texture_target, surface->texture_name, surface->texture_level); - break; - case SFLAG_INSRGBTEX: - surface_prepare_texture(surface, gl_info, TRUE); - context_apply_attachment_filter_states(surface, location); + srgb = location == SFLAG_INSRGBTEX; + surface_prepare_texture(surface, gl_info, srgb); + context_apply_attachment_filter_states(context, surface, location); gl_info->fbo_ops.glFramebufferTexture2D(fbo_target, GL_COLOR_ATTACHMENT0 + idx, - surface->texture_target, surface->texture_name_srgb, surface->texture_level); + surface->texture_target, surface_get_texture_name(surface, gl_info, srgb), + surface->texture_level); break; default: @@ -303,7 +299,7 @@ static void context_attach_surface_fbo(const struct wined3d_context *context, } /* GL locking is done by the caller */ -static void context_check_fbo_status(struct wined3d_context *context, GLenum target) +void context_check_fbo_status(struct wined3d_context *context, GLenum target) { const struct wined3d_gl_info *gl_info = context->gl_info; GLenum status; @@ -312,9 +308,12 @@ static void context_check_fbo_status(struct wined3d_context *context, GLenum tar if (status == GL_FRAMEBUFFER_COMPLETE) { TRACE("FBO complete\n"); - } else { - IWineD3DSurfaceImpl *attachment; + } + else + { + struct wined3d_surface *attachment; unsigned int i; + FIXME("FBO status %s (%#x)\n", debug_fbostatus(status), status); if (!context->current_fbo) @@ -348,7 +347,7 @@ static void context_check_fbo_status(struct wined3d_context *context, GLenum tar } static struct fbo_entry *context_create_fbo_entry(struct wined3d_context *context, - IWineD3DSurfaceImpl **render_targets, IWineD3DSurfaceImpl *depth_stencil, DWORD location) + struct wined3d_surface **render_targets, struct wined3d_surface *depth_stencil, DWORD location) { const struct wined3d_gl_info *gl_info = context->gl_info; struct fbo_entry *entry; @@ -366,7 +365,7 @@ static struct fbo_entry *context_create_fbo_entry(struct wined3d_context *contex /* GL locking is done by the caller */ static void context_reuse_fbo_entry(struct wined3d_context *context, GLenum target, - IWineD3DSurfaceImpl **render_targets, IWineD3DSurfaceImpl *depth_stencil, + struct wined3d_surface **render_targets, struct wined3d_surface *depth_stencil, DWORD location, struct fbo_entry *entry) { const struct wined3d_gl_info *gl_info = context->gl_info; @@ -397,11 +396,21 @@ static void context_destroy_fbo_entry(struct wined3d_context *context, struct fb /* GL locking is done by the caller */ static struct fbo_entry *context_find_fbo_entry(struct wined3d_context *context, GLenum target, - IWineD3DSurfaceImpl **render_targets, IWineD3DSurfaceImpl *depth_stencil, DWORD location) + struct wined3d_surface **render_targets, struct wined3d_surface *depth_stencil, DWORD location) { const struct wined3d_gl_info *gl_info = context->gl_info; struct fbo_entry *entry; + if (depth_stencil && render_targets && render_targets[0]) + { + if (depth_stencil->resource.width < render_targets[0]->resource.width || + depth_stencil->resource.height < render_targets[0]->resource.height) + { + WARN("Depth stencil is smaller than the primary color buffer, disabling\n"); + depth_stencil = NULL; + } + } + LIST_FOR_EACH_ENTRY(entry, &context->fbo_list, struct fbo_entry, entry) { if (!memcmp(entry->render_targets, @@ -449,10 +458,7 @@ static void context_apply_fbo_entry(struct wined3d_context *context, GLenum targ /* Apply depth targets */ if (entry->depth_stencil) - { - surface_set_compatible_renderbuffer(entry->depth_stencil, - entry->render_targets[0]->pow2Width, entry->render_targets[0]->pow2Height); - } + surface_set_compatible_renderbuffer(entry->depth_stencil, entry->render_targets[0]); context_attach_depth_stencil_fbo(context, target, entry->depth_stencil, TRUE); entry->attached = TRUE; @@ -462,16 +468,16 @@ static void context_apply_fbo_entry(struct wined3d_context *context, GLenum targ for (i = 0; i < gl_info->limits.buffers; ++i) { if (entry->render_targets[i]) - context_apply_attachment_filter_states(entry->render_targets[i], entry->location); + context_apply_attachment_filter_states(context, entry->render_targets[i], entry->location); } if (entry->depth_stencil) - context_apply_attachment_filter_states(entry->depth_stencil, SFLAG_INTEXTURE); + context_apply_attachment_filter_states(context, entry->depth_stencil, SFLAG_INTEXTURE); } } /* GL locking is done by the caller */ static void context_apply_fbo_state(struct wined3d_context *context, GLenum target, - IWineD3DSurfaceImpl **render_targets, IWineD3DSurfaceImpl *depth_stencil, DWORD location) + struct wined3d_surface **render_targets, struct wined3d_surface *depth_stencil, DWORD location) { struct fbo_entry *entry, *entry2; @@ -496,15 +502,13 @@ static void context_apply_fbo_state(struct wined3d_context *context, GLenum targ context->current_fbo = NULL; context_bind_fbo(context, target, NULL); } - - context_check_fbo_status(context, target); } /* GL locking is done by the caller */ void context_apply_fbo_state_blit(struct wined3d_context *context, GLenum target, - IWineD3DSurfaceImpl *render_target, IWineD3DSurfaceImpl *depth_stencil, DWORD location) + struct wined3d_surface *render_target, struct wined3d_surface *depth_stencil, DWORD location) { - if (surface_is_offscreen(render_target)) + if (location != SFLAG_INDRAWABLE || surface_is_offscreen(render_target)) { UINT clear_size = (context->gl_info->limits.buffers - 1) * sizeof(*context->blit_targets); context->blit_targets[0] = render_target; @@ -648,12 +652,12 @@ void context_free_event_query(struct wined3d_event_query *query) typedef void (context_fbo_entry_func_t)(struct wined3d_context *context, struct fbo_entry *entry); -static void context_enum_surface_fbo_entries(IWineD3DDeviceImpl *device, - IWineD3DSurfaceImpl *surface, context_fbo_entry_func_t *callback) +static void context_enum_surface_fbo_entries(struct wined3d_device *device, + struct wined3d_surface *surface, context_fbo_entry_func_t *callback) { UINT i; - for (i = 0; i < device->numContexts; ++i) + for (i = 0; i < device->context_count; ++i) { struct wined3d_context *context = device->contexts[i]; const struct wined3d_gl_info *gl_info = context->gl_info; @@ -689,14 +693,15 @@ static void context_queue_fbo_entry_destruction(struct wined3d_context *context, list_add_head(&context->fbo_destroy_list, &entry->entry); } -void context_resource_released(IWineD3DDeviceImpl *device, IWineD3DResource *resource, WINED3DRESOURCETYPE type) +void context_resource_released(struct wined3d_device *device, + struct wined3d_resource *resource, WINED3DRESOURCETYPE type) { if (!device->d3d_initialized) return; switch (type) { case WINED3DRTYPE_SURFACE: - context_enum_surface_fbo_entries(device, (IWineD3DSurfaceImpl *)resource, + context_enum_surface_fbo_entries(device, surface_from_resource(resource), context_queue_fbo_entry_destruction); break; @@ -710,12 +715,13 @@ static void context_detach_fbo_entry(struct wined3d_context *context, struct fbo entry->attached = FALSE; } -void context_resource_unloaded(IWineD3DDeviceImpl *device, IWineD3DResource *resource, WINED3DRESOURCETYPE type) +void context_resource_unloaded(struct wined3d_device *device, + struct wined3d_resource *resource, WINED3DRESOURCETYPE type) { switch (type) { case WINED3DRTYPE_SURFACE: - context_enum_surface_fbo_entries(device, (IWineD3DSurfaceImpl *)resource, + context_enum_surface_fbo_entries(device, surface_from_resource(resource), context_detach_fbo_entry); break; @@ -724,7 +730,7 @@ void context_resource_unloaded(IWineD3DDeviceImpl *device, IWineD3DResource *res } } -void context_surface_update(struct wined3d_context *context, IWineD3DSurfaceImpl *surface) +void context_surface_update(struct wined3d_context *context, struct wined3d_surface *surface) { const struct wined3d_gl_info *gl_info = context->gl_info; struct fbo_entry *entry = context->current_fbo; @@ -790,14 +796,98 @@ static BOOL context_set_pixel_format(const struct wined3d_gl_info *gl_info, HDC return TRUE; } +static BOOL context_set_gl_context(struct wined3d_context *ctx) +{ + struct wined3d_swapchain *swapchain = ctx->swapchain; + + if (!pwglMakeCurrent(ctx->hdc, ctx->glCtx)) + { + WARN("Failed to make GL context %p current on device context %p, last error %#x.\n", + ctx->glCtx, ctx->hdc, GetLastError()); + ctx->valid = 0; + WARN("Trying fallback to the backup window.\n"); + + if (!swapchain->backup_dc) + { + TRACE("Creating the backup window for swapchain %p.\n", swapchain); + swapchain->backup_wnd = CreateWindowA(WINED3D_OPENGL_WINDOW_CLASS_NAME, "WineD3D fake window", + WS_OVERLAPPEDWINDOW, 10, 10, 10, 10, NULL, NULL, NULL, NULL); + if (!swapchain->backup_wnd) + { + ERR("Failed to create a window.\n"); + goto fail; + } + swapchain->backup_dc = GetDC(swapchain->backup_wnd); + if (!swapchain->backup_dc) + { + ERR("Failed to get a DC.\n"); + goto fail; + } + if (!context_set_pixel_format(ctx->gl_info, swapchain->backup_dc, ctx->pixel_format)) + { + ERR("Failed to set pixel format %d on device context %p.\n", + ctx->pixel_format, swapchain->backup_dc); + goto fail; + } + } + + if (!pwglMakeCurrent(swapchain->backup_dc, ctx->glCtx)) + { + ERR("Fallback to backup window (dc %p) failed too, last error %#x.\n", + swapchain->backup_dc, GetLastError()); + context_set_current(NULL); + return FALSE; + } + } + return TRUE; + +fail: + if (swapchain->backup_dc) + { + ReleaseDC(swapchain->backup_wnd, swapchain->backup_dc); + swapchain->backup_dc = NULL; + } + if (swapchain->backup_wnd) + { + DestroyWindow(swapchain->backup_wnd); + swapchain->backup_wnd = NULL; + } + context_set_current(NULL); + return FALSE; +} + +static void context_restore_gl_context(HDC dc, HGLRC gl_ctx) +{ + if (!pwglMakeCurrent(dc, gl_ctx)) + { + ERR("Failed to restore GL context %p on device context %p, last error %#x.\n", + gl_ctx, dc, GetLastError()); + context_set_current(NULL); + } +} + static void context_update_window(struct wined3d_context *context) { + if (context->win_handle == context->swapchain->win_handle) + return; + TRACE("Updating context %p window from %p to %p.\n", context, context->win_handle, context->swapchain->win_handle); if (context->valid) { - if (!ReleaseDC(context->win_handle, context->hdc)) + /* You'd figure ReleaseDC() would fail if the DC doesn't match the + * window. However, that's not what actually happens, and there are + * user32 tests that confirm ReleaseDC() with the wrong window is + * supposed to succeed. So explicitly check that the DC belongs to + * the window, since we want to avoid releasing a DC that belongs to + * some other window if the original window was already destroyed. */ + if (WindowFromDC(context->hdc) != context->win_handle) + { + WARN("DC %p does not belong to window %p.\n", + context->hdc, context->win_handle); + } + else if (!ReleaseDC(context->win_handle, context->hdc)) { ERR("Failed to release device context %p, last error %#x.\n", context->hdc, GetLastError()); @@ -820,12 +910,7 @@ static void context_update_window(struct wined3d_context *context) goto err; } - if (!pwglMakeCurrent(context->hdc, context->glCtx)) - { - ERR("Failed to make GL context %p current on device context %p, last error %#x.\n", - context->glCtx, context->hdc, GetLastError()); - goto err; - } + context_set_gl_context(context); return; @@ -833,22 +918,6 @@ err: context->valid = 0; } -/* Do not call while under the GL lock. */ -static void context_validate(struct wined3d_context *context) -{ - HWND wnd = WindowFromDC(context->hdc); - - if (wnd != context->win_handle) - { - WARN("DC %p belongs to window %p instead of %p.\n", - context->hdc, wnd, context->win_handle); - context->valid = 0; - } - - if (context->win_handle != context->swapchain->win_handle) - context_update_window(context); -} - /* Do not call while under the GL lock. */ static void context_destroy_gl_resources(struct wined3d_context *context) { @@ -863,8 +932,9 @@ static void context_destroy_gl_resources(struct wined3d_context *context) restore_ctx = pwglGetCurrentContext(); restore_dc = pwglGetCurrentDC(); - context_validate(context); - if (context->valid && restore_ctx != context->glCtx) pwglMakeCurrent(context->hdc, context->glCtx); + context_update_window(context); + if (context->valid && restore_ctx != context->glCtx) + context_set_gl_context(context); else restore_ctx = NULL; ENTER_GL(); @@ -919,7 +989,10 @@ static void context_destroy_gl_resources(struct wined3d_context *context) if (gl_info->supported[ARB_SYNC]) { - if (event_query->object.sync) GL_EXTCALL(glDeleteSync(event_query->object.sync)); + for (i = 0; i < context->free_event_query_count; ++i) + { + GL_EXTCALL(glDeleteSync(context->free_event_queries[i].sync)); + } } else if (gl_info->supported[APPLE_FENCE]) { @@ -946,12 +1019,7 @@ static void context_destroy_gl_resources(struct wined3d_context *context) if (restore_ctx) { - if (!pwglMakeCurrent(restore_dc, restore_ctx)) - { - DWORD err = GetLastError(); - ERR("Failed to restore GL context %p on device context %p, last error %#x.\n", - restore_ctx, restore_dc, err); - } + context_restore_gl_context(restore_dc, restore_ctx); } else if (pwglGetCurrentContext() && !pwglMakeCurrent(NULL, NULL)) { @@ -1009,15 +1077,15 @@ BOOL context_set_current(struct wined3d_context *ctx) if (ctx) { - TRACE("Switching to D3D context %p, GL context %p, device context %p.\n", ctx, ctx->glCtx, ctx->hdc); - if (!pwglMakeCurrent(ctx->hdc, ctx->glCtx)) + if (!ctx->valid) { - DWORD err = GetLastError(); - ERR("Failed to make GL context %p current on device context %p, last error %#x.\n", - ctx->glCtx, ctx->hdc, err); - TlsSetValue(wined3d_context_tls_idx, NULL); + ERR("Trying to make invalid context %p current\n", ctx); return FALSE; } + + TRACE("Switching to D3D context %p, GL context %p, device context %p.\n", ctx, ctx->glCtx, ctx->hdc); + if (!context_set_gl_context(ctx)) + return FALSE; ctx->current = 1; } else if(pwglGetCurrentContext()) @@ -1050,12 +1118,7 @@ void context_release(struct wined3d_context *context) if (!--context->level && context->restore_ctx) { TRACE("Restoring GL context %p on device context %p.\n", context->restore_ctx, context->restore_dc); - if (!pwglMakeCurrent(context->restore_dc, context->restore_ctx)) - { - DWORD err = GetLastError(); - ERR("Failed to restore GL context %p on device context %p, last error %#x.\n", - context->restore_ctx, context->restore_dc, err); - } + context_restore_gl_context(context->restore_dc, context->restore_ctx); context->restore_ctx = NULL; context->restore_dc = NULL; } @@ -1108,14 +1171,14 @@ static void Context_MarkStateDirty(struct wined3d_context *context, DWORD state, } /* This function takes care of WineD3D pixel format selection. */ -static int WineD3D_ChoosePixelFormat(IWineD3DDeviceImpl *This, HDC hdc, +static int WineD3D_ChoosePixelFormat(struct wined3d_device *device, HDC hdc, const struct wined3d_format *color_format, const struct wined3d_format *ds_format, BOOL auxBuffers, int numSamples, BOOL findCompatible) { int iPixelFormat=0; unsigned int matchtry; - short redBits, greenBits, blueBits, alphaBits, colorBits; - short depthBits=0, stencilBits=0; + BYTE redBits, greenBits, blueBits, alphaBits, colorBits; + BYTE depthBits=0, stencilBits=0; static const struct { @@ -1141,7 +1204,7 @@ static int WineD3D_ChoosePixelFormat(IWineD3DDeviceImpl *This, HDC hdc, }; int i = 0; - int nCfgs = This->adapter->nCfgs; + int nCfgs = device->adapter->nCfgs; TRACE("ColorFormat=%s, DepthStencilFormat=%s, auxBuffers=%d, numSamples=%d, findCompatible=%d\n", debug_d3dformat(color_format->id), debug_d3dformat(ds_format->id), @@ -1156,10 +1219,12 @@ static int WineD3D_ChoosePixelFormat(IWineD3DDeviceImpl *This, HDC hdc, getDepthStencilBits(ds_format, &depthBits, &stencilBits); - for(matchtry = 0; matchtry < (sizeof(matches) / sizeof(matches[0])) && !iPixelFormat; matchtry++) { - for(i=0; iadapter->cfgs[i]; BOOL exactDepthMatch = TRUE; - WineD3D_PixelFormat *cfg = &This->adapter->cfgs[i]; /* For now only accept RGBA formats. Perhaps some day we will * allow floating point formats for pbuffers. */ @@ -1208,7 +1273,8 @@ static int WineD3D_ChoosePixelFormat(IWineD3DDeviceImpl *This, HDC hdc, * even when we don't need stencil because it could affect performance EXCEPT * on cards which don't offer depth formats without stencil like the i915 drivers * on Linux. */ - if(stencilBits != cfg->stencilSize && !(This->adapter->brokenStencil && stencilBits <= cfg->stencilSize)) + if (stencilBits != cfg->stencilSize + && !(device->adapter->brokenStencil && stencilBits <= cfg->stencilSize)) continue; /* Check multisampling support */ @@ -1268,10 +1334,10 @@ static int WineD3D_ChoosePixelFormat(IWineD3DDeviceImpl *This, HDC hdc, } /* Do not call while under the GL lock. */ -struct wined3d_context *context_create(IWineD3DSwapChainImpl *swapchain, - IWineD3DSurfaceImpl *target, const struct wined3d_format *ds_format) +struct wined3d_context *context_create(struct wined3d_swapchain *swapchain, + struct wined3d_surface *target, const struct wined3d_format *ds_format) { - IWineD3DDeviceImpl *device = swapchain->device; + struct wined3d_device *device = swapchain->device; const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; const struct wined3d_format *color_format; struct wined3d_context *ret; @@ -1280,6 +1346,7 @@ struct wined3d_context *context_create(IWineD3DSwapChainImpl *swapchain, int numSamples = 0; int pixel_format; unsigned int s; + int swap_interval; DWORD state; HGLRC ctx; HDC hdc; @@ -1314,7 +1381,7 @@ struct wined3d_context *context_create(IWineD3DSwapChainImpl *swapchain, } /* DirectDraw supports 8bit paletted render targets and these are used by - * old games like Starcraft and C&C. Most modern hardware doesn't support + * old games like StarCraft and C&C. Most modern hardware doesn't support * 8bit natively so we perform some form of 8bit -> 32bit conversion. The * conversion (ab)uses the alpha component for storing the palette index. * For this reason we require a format with 8bit alpha, so request @@ -1361,7 +1428,7 @@ struct wined3d_context *context_create(IWineD3DSwapChainImpl *swapchain, } ctx = pwglCreateContext(hdc); - if (device->numContexts) + if (device->context_count) { if (!pwglShareLists(device->contexts[0]->glCtx, ctx)) { @@ -1410,7 +1477,7 @@ struct wined3d_context *context_create(IWineD3DSwapChainImpl *swapchain, ret->hdc = hdc; ret->pixel_format = pixel_format; - if (device->shader_backend->shader_dirtifyable_constants((IWineD3DDevice *)device)) + if (device->shader_backend->shader_dirtifyable_constants()) { /* Create the dirty constants array and initialize them to dirty */ ret->vshader_const_dirty = HeapAlloc(GetProcessHeap(), 0, @@ -1460,6 +1527,36 @@ struct wined3d_context *context_create(IWineD3DSwapChainImpl *swapchain, goto out; } + switch (swapchain->presentParms.PresentationInterval) + { + case WINED3DPRESENT_INTERVAL_IMMEDIATE: + swap_interval = 0; + break; + case WINED3DPRESENT_INTERVAL_DEFAULT: + case WINED3DPRESENT_INTERVAL_ONE: + swap_interval = 1; + break; + case WINED3DPRESENT_INTERVAL_TWO: + swap_interval = 2; + break; + case WINED3DPRESENT_INTERVAL_THREE: + swap_interval = 3; + break; + case WINED3DPRESENT_INTERVAL_FOUR: + swap_interval = 4; + break; + default: + FIXME("Unknown presentation interval %08x\n", swapchain->presentParms.PresentationInterval); + swap_interval = 1; + } + + if (gl_info->supported[WGL_EXT_SWAP_CONTROL]) + { + if (!GL_EXTCALL(wglSwapIntervalEXT(swap_interval))) + ERR("wglSwapIntervalEXT failed to set swap interval %d for context %p, last error %#x\n", + swap_interval, ret, GetLastError()); + } + ENTER_GL(); glGetIntegerv(GL_AUX_BUFFERS, &ret->aux_buffers); @@ -1544,23 +1641,6 @@ struct wined3d_context *context_create(IWineD3DSwapChainImpl *swapchain, checkGLcall("glTexEnvi(GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, GL_TRUE)"); } - if (gl_info->supported[WINED3D_GL_VERSION_2_0]) - { - /* Windows doesn't support to query the glPointParameteri function pointer, so use the - * NV_POINT_SPRITE extension. - */ - if (glPointParameteri) - { - glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, GL_UPPER_LEFT); - checkGLcall("glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, GL_UPPER_LEFT)"); - } - else if (gl_info->supported[NV_POINT_SPRITE]) - { - GL_EXTCALL(glPointParameteriNV(GL_POINT_SPRITE_COORD_ORIGIN, GL_UPPER_LEFT)); - checkGLcall("glPointParameteriNV(GL_POINT_SPRITE_COORD_ORIGIN, GL_UPPER_LEFT)"); - } - } - if (gl_info->supported[ARB_PROVOKING_VERTEX]) { GL_EXTCALL(glProvokingVertex(GL_FIRST_VERTEX_CONVENTION)); @@ -1569,11 +1649,10 @@ struct wined3d_context *context_create(IWineD3DSwapChainImpl *swapchain, { GL_EXTCALL(glProvokingVertexEXT(GL_FIRST_VERTEX_CONVENTION_EXT)); } + device->frag_pipe->enable_extension(TRUE); LEAVE_GL(); - device->frag_pipe->enable_extension((IWineD3DDevice *)device, TRUE); - TRACE("Created context %p.\n", ret); return ret; @@ -1590,7 +1669,7 @@ out: } /* Do not call while under the GL lock. */ -void context_destroy(IWineD3DDeviceImpl *This, struct wined3d_context *context) +void context_destroy(struct wined3d_device *device, struct wined3d_context *context) { BOOL destroy; @@ -1612,7 +1691,7 @@ void context_destroy(IWineD3DDeviceImpl *This, struct wined3d_context *context) HeapFree(GetProcessHeap(), 0, context->blit_targets); HeapFree(GetProcessHeap(), 0, context->vshader_const_dirty); HeapFree(GetProcessHeap(), 0, context->pshader_const_dirty); - device_context_remove(This, context); + device_context_remove(device, context); if (destroy) HeapFree(GetProcessHeap(), 0, context); } @@ -1622,7 +1701,7 @@ static inline void set_blit_dimension(UINT width, UINT height) { checkGLcall("glMatrixMode(GL_PROJECTION)"); glLoadIdentity(); checkGLcall("glLoadIdentity()"); - glOrtho(0, width, height, 0, 0.0, -1.0); + glOrtho(0, width, 0, height, 0.0, -1.0); checkGLcall("glOrtho"); glViewport(0, 0, width, height); checkGLcall("glViewport"); @@ -1645,13 +1724,13 @@ static inline void set_blit_dimension(UINT width, UINT height) { * *****************************************************************************/ /* Context activation is done by the caller. */ -static void SetupForBlit(IWineD3DDeviceImpl *This, struct wined3d_context *context) +static void SetupForBlit(struct wined3d_device *device, struct wined3d_context *context) { int i; - const struct StateEntry *StateTable = This->StateTable; + const struct StateEntry *StateTable = device->StateTable; const struct wined3d_gl_info *gl_info = context->gl_info; - UINT width = context->current_rt->currentDesc.Width; - UINT height = context->current_rt->currentDesc.Height; + UINT width = context->current_rt->resource.width; + UINT height = context->current_rt->resource.height; DWORD sampler; TRACE("Setting up context %p for blitting\n", context); @@ -1675,7 +1754,7 @@ static void SetupForBlit(IWineD3DDeviceImpl *This, struct wined3d_context *conte /* Disable shaders */ ENTER_GL(); - This->shader_backend->shader_select(context, FALSE, FALSE); + device->shader_backend->shader_select(context, FALSE, FALSE); LEAVE_GL(); Context_MarkStateDirty(context, STATE_VSHADER, StateTable); @@ -1696,7 +1775,7 @@ static void SetupForBlit(IWineD3DDeviceImpl *This, struct wined3d_context *conte */ for (i = gl_info->limits.textures - 1; i > 0 ; --i) { - sampler = This->rev_tex_unit_map[i]; + sampler = device->rev_tex_unit_map[i]; GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + i)); checkGLcall("glActiveTextureARB"); @@ -1729,7 +1808,7 @@ static void SetupForBlit(IWineD3DDeviceImpl *This, struct wined3d_context *conte GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB)); checkGLcall("glActiveTextureARB"); - sampler = This->rev_tex_unit_map[0]; + sampler = device->rev_tex_unit_map[0]; if (gl_info->supported[ARB_TEXTURE_CUBE_MAP]) { @@ -1758,7 +1837,7 @@ static void SetupForBlit(IWineD3DDeviceImpl *This, struct wined3d_context *conte glTexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, 0.0f); - checkGLcall("glTexEnvi GL_TEXTURE_LOD_BIAS_EXT ..."); + checkGLcall("glTexEnvf GL_TEXTURE_LOD_BIAS_EXT ..."); } if (sampler != WINED3D_UNMAPPED_STAGE) @@ -1833,44 +1912,19 @@ static void SetupForBlit(IWineD3DDeviceImpl *This, struct wined3d_context *conte Context_MarkStateDirty(context, STATE_RENDER(WINED3DRS_CLIPPING), StateTable); set_blit_dimension(width, height); + device->frag_pipe->enable_extension(FALSE); LEAVE_GL(); context->blit_w = width; context->blit_h = height; Context_MarkStateDirty(context, STATE_VIEWPORT, StateTable); Context_MarkStateDirty(context, STATE_TRANSFORM(WINED3DTS_PROJECTION), StateTable); - - - This->frag_pipe->enable_extension((IWineD3DDevice *) This, FALSE); -} - -/***************************************************************************** - * findThreadContextForSwapChain - * - * Searches a swapchain for all contexts and picks one for the thread tid. - * If none can be found the swapchain is requested to create a new context - * - *****************************************************************************/ -static struct wined3d_context *findThreadContextForSwapChain(IWineD3DSwapChain *swapchain, DWORD tid) -{ - unsigned int i; - - for(i = 0; i < ((IWineD3DSwapChainImpl *) swapchain)->num_contexts; i++) { - if(((IWineD3DSwapChainImpl *) swapchain)->context[i]->tid == tid) { - return ((IWineD3DSwapChainImpl *) swapchain)->context[i]; - } - - } - - /* Create a new context for the thread */ - return swapchain_create_context_for_thread(swapchain); } /* Do not call while under the GL lock. */ -static struct wined3d_context *FindContext(IWineD3DDeviceImpl *This, IWineD3DSurfaceImpl *target) +static struct wined3d_context *FindContext(struct wined3d_device *device, struct wined3d_surface *target) { struct wined3d_context *current_context = context_get_current(); - DWORD tid = GetCurrentThreadId(); struct wined3d_context *context; if (current_context && current_context->destroyed) current_context = NULL; @@ -1879,13 +1933,13 @@ static struct wined3d_context *FindContext(IWineD3DDeviceImpl *This, IWineD3DSur { if (current_context && current_context->current_rt - && current_context->swapchain->device == This) + && current_context->swapchain->device == device) { target = current_context->current_rt; } else { - IWineD3DSwapChainImpl *swapchain = (IWineD3DSwapChainImpl *)This->swapchains[0]; + struct wined3d_swapchain *swapchain = device->swapchains[0]; if (swapchain->back_buffers) target = swapchain->back_buffers[0]; else target = swapchain->front_buffer; } @@ -1893,74 +1947,67 @@ static struct wined3d_context *FindContext(IWineD3DDeviceImpl *This, IWineD3DSur if (current_context && current_context->current_rt == target) { - context_validate(current_context); + context_update_window(current_context); return current_context; } if (target->container.type == WINED3D_CONTAINER_SWAPCHAIN) { - IWineD3DSwapChain *swapchain; - TRACE("Rendering onscreen\n"); - swapchain = (IWineD3DSwapChain *)target->container.u.swapchain; - context = findThreadContextForSwapChain(swapchain, tid); + context = swapchain_get_context(target->container.u.swapchain); } else { TRACE("Rendering offscreen\n"); - /* Stay with the currently active context. */ - if (current_context && current_context->swapchain->device == This) - { + /* Stay with the current context if possible. Otherwise use the + * context for the primary swapchain. */ + if (current_context && current_context->swapchain->device == device) context = current_context; - } else - { - /* This may happen if the app jumps straight into offscreen rendering - * Start using the context of the primary swapchain. tid == 0 is no problem - * for findThreadContextForSwapChain. - * - * Can also happen on thread switches - in that case findThreadContextForSwapChain - * is perfect to call. */ - context = findThreadContextForSwapChain(This->swapchains[0], tid); - } + context = swapchain_get_context(device->swapchains[0]); } - context_validate(context); + context_update_window(context); return context; } -/* Context activation is done by the caller. */ -static void context_apply_draw_buffers(struct wined3d_context *context, UINT rt_count, IWineD3DSurfaceImpl **rts) +/* Context activation and GL locking are done by the caller. */ +static void context_apply_draw_buffers(struct wined3d_context *context, DWORD rt_mask, struct wined3d_surface **rts) { - if (!surface_is_offscreen(rts[0])) + if (!rt_mask) + { + glDrawBuffer(GL_NONE); + checkGLcall("glDrawBuffer()"); + } + else if (!surface_is_offscreen(rts[0])) { - ENTER_GL(); glDrawBuffer(surface_get_gl_buffer(rts[0])); checkGLcall("glDrawBuffer()"); - LEAVE_GL(); } else { - ENTER_GL(); if (wined3d_settings.offscreen_rendering_mode == ORM_FBO) { const struct wined3d_gl_info *gl_info = context->gl_info; - unsigned int i; + unsigned int i = 0; - for (i = 0; i < gl_info->limits.buffers; ++i) + while (rt_mask) { - if (i < rt_count && rts[i]) + if ((rt_mask & 1) && rts[i] && rts[i]->resource.format->id != WINED3DFMT_NULL) context->draw_buffers[i] = GL_COLOR_ATTACHMENT0 + i; else context->draw_buffers[i] = GL_NONE; + + rt_mask >>= 1; + ++i; } if (gl_info->supported[ARB_DRAW_BUFFERS]) { - GL_EXTCALL(glDrawBuffersARB(gl_info->limits.buffers, context->draw_buffers)); + GL_EXTCALL(glDrawBuffersARB(i, context->draw_buffers)); checkGLcall("glDrawBuffers()"); } else @@ -1974,7 +2021,6 @@ static void context_apply_draw_buffers(struct wined3d_context *context, UINT rt_ glDrawBuffer(rts[0]->resource.device->offscreenBuffer); checkGLcall("glDrawBuffer()"); } - LEAVE_GL(); } } @@ -1989,29 +2035,10 @@ void context_set_draw_buffer(struct wined3d_context *context, GLenum buffer) static inline void context_set_render_offscreen(struct wined3d_context *context, const struct StateEntry *StateTable, BOOL offscreen) { - const struct wined3d_gl_info *gl_info = context->gl_info; - if (context->render_offscreen == offscreen) return; - if (gl_info->supported[WINED3D_GL_VERSION_2_0]) - { - /* Windows doesn't support to query the glPointParameteri function pointer, so use the - * NV_POINT_SPRITE extension. - */ - if (glPointParameteri) - { - glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, offscreen ? GL_LOWER_LEFT : GL_UPPER_LEFT); - checkGLcall("glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, ...)"); - } - else if (gl_info->supported[NV_POINT_SPRITE]) - { - GL_EXTCALL(glPointParameteriNV(GL_POINT_SPRITE_COORD_ORIGIN, offscreen ? GL_LOWER_LEFT : GL_UPPER_LEFT)); - checkGLcall("glPointParameteriNV(GL_POINT_SPRITE_COORD_ORIGIN, ...)"); - } - } - + Context_MarkStateDirty(context, STATE_POINTSPRITECOORDORIGIN, StateTable); Context_MarkStateDirty(context, STATE_TRANSFORM(WINED3DTS_PROJECTION), StateTable); - Context_MarkStateDirty(context, STATE_VDECL, StateTable); Context_MarkStateDirty(context, STATE_VIEWPORT, StateTable); Context_MarkStateDirty(context, STATE_SCISSORRECT, StateTable); Context_MarkStateDirty(context, STATE_FRONTFACE, StateTable); @@ -2021,10 +2048,10 @@ static inline void context_set_render_offscreen(struct wined3d_context *context, static BOOL match_depth_stencil_format(const struct wined3d_format *existing, const struct wined3d_format *required) { - short existing_depth, existing_stencil, required_depth, required_stencil; + BYTE existing_depth, existing_stencil, required_depth, required_stencil; - if(existing == required) return TRUE; - if((existing->Flags & WINED3DFMT_FLAG_FLOAT) != (required->Flags & WINED3DFMT_FLAG_FLOAT)) return FALSE; + if (existing == required) return TRUE; + if ((existing->flags & WINED3DFMT_FLAG_FLOAT) != (required->flags & WINED3DFMT_FLAG_FLOAT)) return FALSE; getDepthStencilBits(existing, &existing_depth, &existing_stencil); getDepthStencilBits(required, &required_depth, &required_stencil); @@ -2035,12 +2062,13 @@ static BOOL match_depth_stencil_format(const struct wined3d_format *existing, if(required_stencil && required_stencil != existing_stencil) return FALSE; return TRUE; } + /* The caller provides a context */ -static void context_validate_onscreen_formats(IWineD3DDeviceImpl *device, - struct wined3d_context *context, IWineD3DSurfaceImpl *depth_stencil) +static void context_validate_onscreen_formats(struct wined3d_device *device, + struct wined3d_context *context, struct wined3d_surface *depth_stencil) { /* Onscreen surfaces are always in a swapchain */ - IWineD3DSwapChainImpl *swapchain = context->current_rt->container.u.swapchain; + struct wined3d_swapchain *swapchain = context->current_rt->container.u.swapchain; if (context->render_offscreen || !depth_stencil) return; if (match_depth_stencil_format(swapchain->ds_format, depth_stencil->resource.format)) return; @@ -2057,7 +2085,7 @@ static void context_validate_onscreen_formats(IWineD3DDeviceImpl *device, } /* Context activation is done by the caller. */ -void context_apply_blit_state(struct wined3d_context *context, IWineD3DDeviceImpl *device) +void context_apply_blit_state(struct wined3d_context *context, struct wined3d_device *device) { if (wined3d_settings.offscreen_rendering_mode == ORM_FBO) { @@ -2065,7 +2093,6 @@ void context_apply_blit_state(struct wined3d_context *context, IWineD3DDeviceImp if (context->render_offscreen) { - FIXME("Applying blit state for an offscreen target with ORM_FBO. This should be avoided.\n"); surface_internal_preload(context->current_rt, SRGB_RGB); ENTER_GL(); @@ -2082,6 +2109,7 @@ void context_apply_blit_state(struct wined3d_context *context, IWineD3DDeviceImp context->draw_buffer_dirty = TRUE; } + ENTER_GL(); if (context->draw_buffer_dirty) { context_apply_draw_buffers(context, 1, &context->current_rt); @@ -2089,27 +2117,56 @@ void context_apply_blit_state(struct wined3d_context *context, IWineD3DDeviceImp context->draw_buffer_dirty = FALSE; } + if (wined3d_settings.offscreen_rendering_mode == ORM_FBO) + { + context_check_fbo_status(context, GL_FRAMEBUFFER); + } + LEAVE_GL(); + SetupForBlit(device, context); } +static BOOL context_validate_rt_config(UINT rt_count, + struct wined3d_surface **rts, struct wined3d_surface *ds) +{ + unsigned int i; + + if (ds) return TRUE; + + for (i = 0; i < rt_count; ++i) + { + if (rts[i] && rts[i]->resource.format->id != WINED3DFMT_NULL) + return TRUE; + } + + WARN("Invalid render target config, need at least one attachment.\n"); + return FALSE; +} + /* Context activation is done by the caller. */ -void context_apply_clear_state(struct wined3d_context *context, IWineD3DDeviceImpl *device, - UINT rt_count, IWineD3DSurfaceImpl **rts, IWineD3DSurfaceImpl *depth_stencil) +BOOL context_apply_clear_state(struct wined3d_context *context, struct wined3d_device *device, + UINT rt_count, struct wined3d_surface **rts, struct wined3d_surface *depth_stencil) { const struct StateEntry *state_table = device->StateTable; + DWORD rt_mask = 0; UINT i; + if (!context_validate_rt_config(rt_count, rts, depth_stencil)) + return FALSE; + + if (wined3d_settings.offscreen_rendering_mode == ORM_FBO) { context_validate_onscreen_formats(device, context, depth_stencil); ENTER_GL(); - if (surface_is_offscreen(rts[0])) + if (!rt_count || surface_is_offscreen(rts[0])) { for (i = 0; i < rt_count; ++i) { context->blit_targets[i] = rts[i]; + rt_mask |= (1 << i); } while (i < context->gl_info->limits.buffers) { @@ -2117,27 +2174,39 @@ void context_apply_clear_state(struct wined3d_context *context, IWineD3DDeviceIm ++i; } context_apply_fbo_state(context, GL_FRAMEBUFFER, context->blit_targets, depth_stencil, SFLAG_INTEXTURE); + glReadBuffer(GL_NONE); + checkGLcall("glReadBuffer"); } else { context_apply_fbo_state(context, GL_FRAMEBUFFER, NULL, NULL, SFLAG_INDRAWABLE); + rt_mask = 1; } LEAVE_GL(); } + else + { + rt_mask = 1; + } - context_apply_draw_buffers(context, rt_count, rts); + ENTER_GL(); + context_apply_draw_buffers(context, rt_mask, rts); context->draw_buffer_dirty = TRUE; + if (wined3d_settings.offscreen_rendering_mode == ORM_FBO) + { + context_check_fbo_status(context, GL_FRAMEBUFFER); + } + if (context->last_was_blit) { - device->frag_pipe->enable_extension((IWineD3DDevice *)device, TRUE); + device->frag_pipe->enable_extension(TRUE); } /* Blending and clearing should be orthogonal, but tests on the nvidia * driver show that disabling blending when clearing improves the clearing * performance incredibly. */ - ENTER_GL(); glDisable(GL_BLEND); glEnable(GL_SCISSOR_TEST); checkGLcall("glEnable GL_SCISSOR_TEST"); @@ -2147,25 +2216,32 @@ void context_apply_clear_state(struct wined3d_context *context, IWineD3DDeviceIm Context_MarkStateDirty(context, STATE_RENDER(WINED3DRS_ALPHABLENDENABLE), state_table); Context_MarkStateDirty(context, STATE_RENDER(WINED3DRS_SCISSORTESTENABLE), state_table); Context_MarkStateDirty(context, STATE_SCISSORRECT, state_table); + + return TRUE; } /* Context activation is done by the caller. */ -void context_apply_draw_state(struct wined3d_context *context, IWineD3DDeviceImpl *device) +BOOL context_apply_draw_state(struct wined3d_context *context, struct wined3d_device *device) { const struct StateEntry *state_table = device->StateTable; + const struct wined3d_fb_state *fb = &device->fb; unsigned int i; + if (!context_validate_rt_config(context->gl_info->limits.buffers, + fb->render_targets, fb->depth_stencil)) + return FALSE; + /* Preload resources before FBO setup. Texture preload in particular may * result in changes to the current FBO, due to using e.g. FBO blits for * updating a resource location. */ - IWineD3DDeviceImpl_FindTexUnitMap(device); + device_update_tex_unit_map(device); device_preload_textures(device); if (isStateDirty(context, STATE_VDECL)) device_update_stream_info(device, context->gl_info); if (wined3d_settings.offscreen_rendering_mode == ORM_FBO) { - context_validate_onscreen_formats(device, context, device->depth_stencil); + context_validate_onscreen_formats(device, context, fb->depth_stencil); if (!context->render_offscreen) { @@ -2176,24 +2252,34 @@ void context_apply_draw_state(struct wined3d_context *context, IWineD3DDeviceImp else { ENTER_GL(); - context_apply_fbo_state(context, GL_FRAMEBUFFER, device->render_targets, - device->depth_stencil, SFLAG_INTEXTURE); + context_apply_fbo_state(context, GL_FRAMEBUFFER, fb->render_targets, fb->depth_stencil, SFLAG_INTEXTURE); + glReadBuffer(GL_NONE); + checkGLcall("glReadBuffer"); LEAVE_GL(); } } + ENTER_GL(); if (context->draw_buffer_dirty) { - context_apply_draw_buffers(context, context->gl_info->limits.buffers, device->render_targets); + const struct wined3d_shader *ps = device->stateBlock->state.pixel_shader; + DWORD rt_mask = ps ? ps->reg_maps.rt_mask : 1; + + rt_mask &= device->valid_rt_mask; + context_apply_draw_buffers(context, rt_mask, fb->render_targets); context->draw_buffer_dirty = FALSE; } + if (wined3d_settings.offscreen_rendering_mode == ORM_FBO) + { + context_check_fbo_status(context, GL_FRAMEBUFFER); + } + if (context->last_was_blit) { - device->frag_pipe->enable_extension((IWineD3DDevice *)device, TRUE); + device->frag_pipe->enable_extension(TRUE); } - ENTER_GL(); for (i = 0; i < context->numDirtyEntries; ++i) { DWORD rep = context->dirtyArray[i]; @@ -2205,10 +2291,12 @@ void context_apply_draw_state(struct wined3d_context *context, IWineD3DDeviceImp LEAVE_GL(); context->numDirtyEntries = 0; /* This makes the whole list clean */ context->last_was_blit = FALSE; + + return TRUE; } -static void context_setup_target(IWineD3DDeviceImpl *device, - struct wined3d_context *context, IWineD3DSurfaceImpl *target) +static void context_setup_target(struct wined3d_device *device, + struct wined3d_context *context, struct wined3d_surface *target) { BOOL old_render_offscreen = context->render_offscreen, render_offscreen; const struct StateEntry *StateTable = device->StateTable; @@ -2232,12 +2320,12 @@ static void context_setup_target(IWineD3DDeviceImpl *device, { /* Disable blending when the alpha mask has changed and when a format doesn't support blending. */ if ((old->alpha_mask && !new->alpha_mask) || (!old->alpha_mask && new->alpha_mask) - || !(new->Flags & WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING)) + || !(new->flags & WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING)) { Context_MarkStateDirty(context, STATE_RENDER(WINED3DRS_ALPHABLENDENABLE), StateTable); } /* Update sRGB writing when switching between formats that do/do not support sRGB writing */ - if ((old->Flags & WINED3DFMT_FLAG_SRGB_WRITE) != (new->Flags & WINED3DFMT_FLAG_SRGB_WRITE)) + if ((old->flags & WINED3DFMT_FLAG_SRGB_WRITE) != (new->flags & WINED3DFMT_FLAG_SRGB_WRITE)) { Context_MarkStateDirty(context, STATE_RENDER(WINED3DRS_SRGBWRITEENABLE), StateTable); } @@ -2255,14 +2343,8 @@ static void context_setup_target(IWineD3DDeviceImpl *device, { /* Read the back buffer of the old drawable into the destination texture. */ if (context->current_rt->texture_name_srgb) - { - surface_internal_preload(context->current_rt, SRGB_BOTH); - } - else - { - surface_internal_preload(context->current_rt, SRGB_RGB); - } - + surface_internal_preload(context->current_rt, SRGB_SRGB); + surface_internal_preload(context->current_rt, SRGB_RGB); surface_modify_location(context->current_rt, SFLAG_INDRAWABLE, FALSE); } } @@ -2273,7 +2355,7 @@ static void context_setup_target(IWineD3DDeviceImpl *device, } /* Do not call while under the GL lock. */ -struct wined3d_context *context_acquire(IWineD3DDeviceImpl *device, IWineD3DSurfaceImpl *target) +struct wined3d_context *context_acquire(struct wined3d_device *device, struct wined3d_surface *target) { struct wined3d_context *current_context = context_get_current(); struct wined3d_context *context; @@ -2287,8 +2369,16 @@ struct wined3d_context *context_acquire(IWineD3DDeviceImpl *device, IWineD3DSurf if (context != current_context) { - if (!context_set_current(context)) ERR("Failed to activate the new context.\n"); - else device->frag_pipe->enable_extension((IWineD3DDevice *)device, !context->last_was_blit); + if (!context_set_current(context)) + { + ERR("Failed to activate the new context.\n"); + } + else + { + ENTER_GL(); + device->frag_pipe->enable_extension(!context->last_was_blit); + LEAVE_GL(); + } if (context->vshader_const_dirty) { @@ -2305,12 +2395,7 @@ struct wined3d_context *context_acquire(IWineD3DDeviceImpl *device, IWineD3DSurf } else if (context->restore_ctx) { - if (!pwglMakeCurrent(context->hdc, context->glCtx)) - { - DWORD err = GetLastError(); - ERR("Failed to make GL context %p current on device context %p, last error %#x.\n", - context->hdc, context->glCtx, err); - } + context_set_gl_context(context); } return context; diff --git a/dll/directx/wine/wined3d/cubetexture.c b/dll/directx/wine/wined3d/cubetexture.c deleted file mode 100644 index 2d2c04c2c21..00000000000 --- a/dll/directx/wine/wined3d/cubetexture.c +++ /dev/null @@ -1,573 +0,0 @@ -/* - * IWineD3DCubeTexture implementation - * - * Copyright 2002-2005 Jason Edmeades - * Copyright 2002-2005 Raphael Junqueira - * Copyright 2005 Oliver Stieber - * Copyright 2007-2008 Stefan Dösinger for CodeWeavers - * Copyright 2009 Henri Verbeet for CodeWeavers - * - * 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 "config.h" -#include "wined3d_private.h" - -WINE_DEFAULT_DEBUG_CHANNEL(d3d_texture); - -/* Do not call while under the GL lock. */ -static void cubetexture_internal_preload(IWineD3DBaseTexture *iface, enum WINED3DSRGB srgb) -{ - /* Override the IWineD3DResource Preload method. */ - IWineD3DCubeTextureImpl *This = (IWineD3DCubeTextureImpl *)iface; - UINT sub_count = This->baseTexture.level_count * This->baseTexture.layer_count; - IWineD3DDeviceImpl *device = This->resource.device; - struct wined3d_context *context = NULL; - BOOL srgb_mode; - BOOL *dirty; - UINT i; - - switch (srgb) - { - case SRGB_RGB: - srgb_mode = FALSE; - break; - - case SRGB_BOTH: - cubetexture_internal_preload(iface, SRGB_RGB); - /* Fallthrough */ - - case SRGB_SRGB: - srgb_mode = TRUE; - break; - - default: - srgb_mode = This->baseTexture.is_srgb; - break; - } - dirty = srgb_mode ? &This->baseTexture.texture_srgb.dirty : &This->baseTexture.texture_rgb.dirty; - - TRACE("(%p) : About to load texture: dirtified(%u).\n", This, *dirty); - - /* We only have to activate a context for gl when we're not drawing. - * In most cases PreLoad will be called during draw and a context was - * activated at the beginning of drawPrimitive. */ - if (!device->isInDraw) - { - /* No danger of recursive calls, context_acquire() sets isInDraw to true - * when loading offscreen render targets into their texture. */ - context = context_acquire(device, NULL); - } - - if (This->resource.format->id == WINED3DFMT_P8_UINT - || This->resource.format->id == WINED3DFMT_P8_UINT_A8_UNORM) - { - for (i = 0; i < sub_count; ++i) - { - IWineD3DSurfaceImpl *surface = (IWineD3DSurfaceImpl *)This->baseTexture.sub_resources[i]; - - if (palette9_changed(surface)) - { - TRACE("Reloading surface %p because the d3d8/9 palette was changed.\n", surface); - /* TODO: This is not necessarily needed with hw palettized texture support. */ - surface_load_location(surface, SFLAG_INSYSMEM, NULL); - /* Make sure the texture is reloaded because of the palette change, - * this kills performance though :( */ - surface_modify_location(surface, SFLAG_INTEXTURE, FALSE); - } - } - } - - /* If the texture is marked dirty or the srgb sampler setting has changed - * since the last load then reload the surfaces. */ - if (*dirty) - { - for (i = 0; i < sub_count; ++i) - { - IWineD3DSurface_LoadTexture((IWineD3DSurface *)This->baseTexture.sub_resources[i], srgb_mode); - } - } - else - { - TRACE("(%p) Texture not dirty, nothing to do.\n" , iface); - } - - /* No longer dirty. */ - *dirty = FALSE; - - if (context) context_release(context); -} - -static void cubetexture_cleanup(IWineD3DCubeTextureImpl *This) -{ - UINT sub_count = This->baseTexture.level_count * This->baseTexture.layer_count; - UINT i; - - TRACE("(%p) : Cleaning up.\n", This); - - for (i = 0; i < sub_count; ++i) - { - IWineD3DSurfaceImpl *surface = (IWineD3DSurfaceImpl *)This->baseTexture.sub_resources[i]; - - if (surface) - { - /* Clean out the texture name we gave to the surface so that the - * surface doesn't try and release it. */ - surface_set_texture_name(surface, 0, TRUE); - surface_set_texture_name(surface, 0, FALSE); - surface_set_texture_target(surface, 0); - surface_set_container(surface, WINED3D_CONTAINER_NONE, NULL); - IWineD3DSurface_Release((IWineD3DSurface *)surface); - } - } - basetexture_cleanup((IWineD3DBaseTexture *)This); -} - -/* ******************************************* - IWineD3DCubeTexture IUnknown parts follow - ******************************************* */ - -static HRESULT WINAPI IWineD3DCubeTextureImpl_QueryInterface(IWineD3DCubeTexture *iface, REFIID riid, LPVOID *ppobj) -{ - IWineD3DCubeTextureImpl *This = (IWineD3DCubeTextureImpl *)iface; - TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(riid),ppobj); - if (IsEqualGUID(riid, &IID_IUnknown) - || IsEqualGUID(riid, &IID_IWineD3DBase) - || IsEqualGUID(riid, &IID_IWineD3DResource) - || IsEqualGUID(riid, &IID_IWineD3DBaseTexture) - || IsEqualGUID(riid, &IID_IWineD3DCubeTexture)) { - IUnknown_AddRef(iface); - *ppobj = This; - return S_OK; - } - *ppobj = NULL; - return E_NOINTERFACE; -} - -static ULONG WINAPI IWineD3DCubeTextureImpl_AddRef(IWineD3DCubeTexture *iface) { - IWineD3DCubeTextureImpl *This = (IWineD3DCubeTextureImpl *)iface; - TRACE("(%p) : AddRef increasing from %d\n", This, This->resource.ref); - return InterlockedIncrement(&This->resource.ref); -} - -/* Do not call while under the GL lock. */ -static ULONG WINAPI IWineD3DCubeTextureImpl_Release(IWineD3DCubeTexture *iface) { - IWineD3DCubeTextureImpl *This = (IWineD3DCubeTextureImpl *)iface; - ULONG ref; - TRACE("(%p) : Releasing from %d\n", This, This->resource.ref); - ref = InterlockedDecrement(&This->resource.ref); - if (!ref) - { - cubetexture_cleanup(This); - This->resource.parent_ops->wined3d_object_destroyed(This->resource.parent); - HeapFree(GetProcessHeap(), 0, This); - } - return ref; -} - -/* **************************************************** - IWineD3DCubeTexture IWineD3DResource parts follow - **************************************************** */ -static HRESULT WINAPI IWineD3DCubeTextureImpl_SetPrivateData(IWineD3DCubeTexture *iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) { - return resource_set_private_data((IWineD3DResource *)iface, refguid, pData, SizeOfData, Flags); -} - -static HRESULT WINAPI IWineD3DCubeTextureImpl_GetPrivateData(IWineD3DCubeTexture *iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) { - return resource_get_private_data((IWineD3DResource *)iface, refguid, pData, pSizeOfData); -} - -static HRESULT WINAPI IWineD3DCubeTextureImpl_FreePrivateData(IWineD3DCubeTexture *iface, REFGUID refguid) { - return resource_free_private_data((IWineD3DResource *)iface, refguid); -} - -static DWORD WINAPI IWineD3DCubeTextureImpl_SetPriority(IWineD3DCubeTexture *iface, DWORD PriorityNew) { - return resource_set_priority((IWineD3DResource *)iface, PriorityNew); -} - -static DWORD WINAPI IWineD3DCubeTextureImpl_GetPriority(IWineD3DCubeTexture *iface) { - return resource_get_priority((IWineD3DResource *)iface); -} - -/* Do not call while under the GL lock. */ -static void WINAPI IWineD3DCubeTextureImpl_PreLoad(IWineD3DCubeTexture *iface) { - cubetexture_internal_preload((IWineD3DBaseTexture *) iface, SRGB_ANY); -} - -/* Do not call while under the GL lock. */ -static void WINAPI IWineD3DCubeTextureImpl_UnLoad(IWineD3DCubeTexture *iface) -{ - IWineD3DCubeTextureImpl *This = (IWineD3DCubeTextureImpl *)iface; - UINT sub_count = This->baseTexture.level_count * This->baseTexture.layer_count; - UINT i; - - TRACE("iface %p.\n", iface); - - /* Unload all the surfaces and reset the texture name. If UnLoad was called on the - * surface before, this one will be a NOP and vice versa. Unloading an unloaded - * surface is fine. */ - - for (i = 0; i < sub_count; ++i) - { - IWineD3DSurfaceImpl *surface = (IWineD3DSurfaceImpl *)This->baseTexture.sub_resources[i]; - - IWineD3DSurface_UnLoad((IWineD3DSurface *)surface); - surface_set_texture_name(surface, 0, TRUE); - surface_set_texture_name(surface, 0, FALSE); - } - - basetexture_unload((IWineD3DBaseTexture *)iface); -} - -static WINED3DRESOURCETYPE WINAPI IWineD3DCubeTextureImpl_GetType(IWineD3DCubeTexture *iface) { - return resource_get_type((IWineD3DResource *)iface); -} - -static void * WINAPI IWineD3DCubeTextureImpl_GetParent(IWineD3DCubeTexture *iface) -{ - TRACE("iface %p.\n", iface); - - return ((IWineD3DCubeTextureImpl *)iface)->resource.parent; -} - -/* ****************************************************** - IWineD3DCubeTexture IWineD3DBaseTexture parts follow - ****************************************************** */ -static DWORD WINAPI IWineD3DCubeTextureImpl_SetLOD(IWineD3DCubeTexture *iface, DWORD LODNew) { - return basetexture_set_lod((IWineD3DBaseTexture *)iface, LODNew); -} - -static DWORD WINAPI IWineD3DCubeTextureImpl_GetLOD(IWineD3DCubeTexture *iface) { - return basetexture_get_lod((IWineD3DBaseTexture *)iface); -} - -static DWORD WINAPI IWineD3DCubeTextureImpl_GetLevelCount(IWineD3DCubeTexture *iface) { - return basetexture_get_level_count((IWineD3DBaseTexture *)iface); -} - -static HRESULT WINAPI IWineD3DCubeTextureImpl_SetAutoGenFilterType(IWineD3DCubeTexture *iface, WINED3DTEXTUREFILTERTYPE FilterType) { - return basetexture_set_autogen_filter_type((IWineD3DBaseTexture *)iface, FilterType); -} - -static WINED3DTEXTUREFILTERTYPE WINAPI IWineD3DCubeTextureImpl_GetAutoGenFilterType(IWineD3DCubeTexture *iface) { - return basetexture_get_autogen_filter_type((IWineD3DBaseTexture *)iface); -} - -static void WINAPI IWineD3DCubeTextureImpl_GenerateMipSubLevels(IWineD3DCubeTexture *iface) { - basetexture_generate_mipmaps((IWineD3DBaseTexture *)iface); -} - -/* Internal function, No d3d mapping */ -static BOOL WINAPI IWineD3DCubeTextureImpl_SetDirty(IWineD3DCubeTexture *iface, BOOL dirty) { - return basetexture_set_dirty((IWineD3DBaseTexture *)iface, dirty); -} - -/* Internal function, No d3d mapping */ -static BOOL WINAPI IWineD3DCubeTextureImpl_GetDirty(IWineD3DCubeTexture *iface) { - return basetexture_get_dirty((IWineD3DBaseTexture *)iface); -} - -/* Context activation is done by the caller. */ -static HRESULT WINAPI IWineD3DCubeTextureImpl_BindTexture(IWineD3DCubeTexture *iface, BOOL srgb) { - IWineD3DCubeTextureImpl *This = (IWineD3DCubeTextureImpl *)iface; - BOOL set_gl_texture_desc; - HRESULT hr; - - TRACE("(%p) : relay to BaseTexture\n", This); - - hr = basetexture_bind((IWineD3DBaseTexture *)iface, srgb, &set_gl_texture_desc); - if (set_gl_texture_desc && SUCCEEDED(hr)) - { - UINT sub_count = This->baseTexture.level_count * This->baseTexture.layer_count; - UINT i; - - for (i = 0; i < sub_count; ++i) - { - IWineD3DSurfaceImpl *surface = (IWineD3DSurfaceImpl *)This->baseTexture.sub_resources[i]; - - if (This->baseTexture.is_srgb) - surface_set_texture_name(surface, This->baseTexture.texture_srgb.name, TRUE); - else - surface_set_texture_name(surface, This->baseTexture.texture_rgb.name, FALSE); - } - } - - return hr; -} - -static BOOL WINAPI IWineD3DCubeTextureImpl_IsCondNP2(IWineD3DCubeTexture *iface) -{ - TRACE("iface %p.\n", iface); - - return FALSE; -} - -/* ******************************************* - IWineD3DCubeTexture IWineD3DCubeTexture parts follow - ******************************************* */ -static HRESULT WINAPI IWineD3DCubeTextureImpl_GetLevelDesc(IWineD3DCubeTexture *iface, - UINT level, WINED3DSURFACE_DESC *desc) -{ - IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)iface; - IWineD3DSurface *surface; - - TRACE("iface %p, level %u, desc %p.\n", iface, level, desc); - - if (!(surface = (IWineD3DSurface *)basetexture_get_sub_resource(texture, 0, level))) - { - WARN("Failed to get sub-resource.\n"); - return WINED3DERR_INVALIDCALL; - } - - IWineD3DSurface_GetDesc(surface, desc); - - return WINED3D_OK; -} - -static HRESULT WINAPI IWineD3DCubeTextureImpl_GetCubeMapSurface(IWineD3DCubeTexture *iface, - WINED3DCUBEMAP_FACES face, UINT level, IWineD3DSurface **surface) -{ - IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)iface; - IWineD3DSurface *s; - - TRACE("iface %p, face %u, level %u, surface %p.\n", - iface, face, level, surface); - - if (!(s = (IWineD3DSurface *)basetexture_get_sub_resource(texture, face, level))) - { - WARN("Failed to get sub-resource.\n"); - return WINED3DERR_INVALIDCALL; - } - - IWineD3DSurface_AddRef(s); - *surface = s; - - TRACE("Returning surface %p.\n", *surface); - - return WINED3D_OK; -} - -static HRESULT WINAPI IWineD3DCubeTextureImpl_LockRect(IWineD3DCubeTexture *iface, - WINED3DCUBEMAP_FACES face, UINT level, WINED3DLOCKED_RECT *locked_rect, const RECT *rect, DWORD flags) -{ - IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)iface; - IWineD3DSurface *surface; - - TRACE("iface %p, face %u, level %u, locked_rect %p, rect %s, flags %#x.\n", - iface, face, level, locked_rect, wine_dbgstr_rect(rect), flags); - - if (!(surface = (IWineD3DSurface *)basetexture_get_sub_resource(texture, face, level))) - { - WARN("Failed to get sub-resource.\n"); - return WINED3DERR_INVALIDCALL; - } - - return IWineD3DSurface_LockRect(surface, locked_rect, rect, flags); -} - -static HRESULT WINAPI IWineD3DCubeTextureImpl_UnlockRect(IWineD3DCubeTexture *iface, - WINED3DCUBEMAP_FACES face, UINT level) -{ - IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)iface; - IWineD3DSurface *surface; - - TRACE("iface %p, face %u, level %u.\n", - iface, face, level); - - if (!(surface = (IWineD3DSurface *)basetexture_get_sub_resource(texture, face, level))) - { - WARN("Failed to get sub-resource.\n"); - return WINED3DERR_INVALIDCALL; - } - - return IWineD3DSurface_UnlockRect(surface); -} - -static HRESULT WINAPI IWineD3DCubeTextureImpl_AddDirtyRect(IWineD3DCubeTexture *iface, - WINED3DCUBEMAP_FACES face, const RECT *dirty_rect) -{ - IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)iface; - IWineD3DSurfaceImpl *surface; - - TRACE("iface %p, face %u, dirty_rect %s.\n", - iface, face, wine_dbgstr_rect(dirty_rect)); - - if (!(surface = (IWineD3DSurfaceImpl *)basetexture_get_sub_resource(texture, face, 0))) - { - WARN("Failed to get sub-resource.\n"); - return WINED3DERR_INVALIDCALL; - } - - texture->baseTexture.texture_rgb.dirty = TRUE; - texture->baseTexture.texture_srgb.dirty = TRUE; - surface_add_dirty_rect(surface, dirty_rect); - - return WINED3D_OK; -} - -static const IWineD3DCubeTextureVtbl IWineD3DCubeTexture_Vtbl = -{ - /* IUnknown */ - IWineD3DCubeTextureImpl_QueryInterface, - IWineD3DCubeTextureImpl_AddRef, - IWineD3DCubeTextureImpl_Release, - /* IWineD3DResource */ - IWineD3DCubeTextureImpl_GetParent, - IWineD3DCubeTextureImpl_SetPrivateData, - IWineD3DCubeTextureImpl_GetPrivateData, - IWineD3DCubeTextureImpl_FreePrivateData, - IWineD3DCubeTextureImpl_SetPriority, - IWineD3DCubeTextureImpl_GetPriority, - IWineD3DCubeTextureImpl_PreLoad, - IWineD3DCubeTextureImpl_UnLoad, - IWineD3DCubeTextureImpl_GetType, - /* IWineD3DBaseTexture */ - IWineD3DCubeTextureImpl_SetLOD, - IWineD3DCubeTextureImpl_GetLOD, - IWineD3DCubeTextureImpl_GetLevelCount, - IWineD3DCubeTextureImpl_SetAutoGenFilterType, - IWineD3DCubeTextureImpl_GetAutoGenFilterType, - IWineD3DCubeTextureImpl_GenerateMipSubLevels, - IWineD3DCubeTextureImpl_SetDirty, - IWineD3DCubeTextureImpl_GetDirty, - IWineD3DCubeTextureImpl_BindTexture, - IWineD3DCubeTextureImpl_IsCondNP2, - /* IWineD3DCubeTexture */ - IWineD3DCubeTextureImpl_GetLevelDesc, - IWineD3DCubeTextureImpl_GetCubeMapSurface, - IWineD3DCubeTextureImpl_LockRect, - IWineD3DCubeTextureImpl_UnlockRect, - IWineD3DCubeTextureImpl_AddDirtyRect -}; - -HRESULT cubetexture_init(IWineD3DCubeTextureImpl *texture, UINT edge_length, UINT levels, - IWineD3DDeviceImpl *device, DWORD usage, enum wined3d_format_id format_id, WINED3DPOOL pool, - void *parent, const struct wined3d_parent_ops *parent_ops) -{ - const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; - const struct wined3d_format *format = wined3d_get_format(gl_info, format_id); - UINT pow2_edge_length; - unsigned int i, j; - UINT tmp_w; - HRESULT hr; - - /* TODO: It should only be possible to create textures for formats - * that are reported as supported. */ - if (WINED3DFMT_UNKNOWN >= format_id) - { - WARN("(%p) : Texture cannot be created with a format of WINED3DFMT_UNKNOWN.\n", texture); - return WINED3DERR_INVALIDCALL; - } - - if (!gl_info->supported[ARB_TEXTURE_CUBE_MAP] && pool != WINED3DPOOL_SCRATCH) - { - WARN("(%p) : Tried to create not supported cube texture.\n", texture); - return WINED3DERR_INVALIDCALL; - } - - /* Calculate levels for mip mapping */ - if (usage & WINED3DUSAGE_AUTOGENMIPMAP) - { - if (!gl_info->supported[SGIS_GENERATE_MIPMAP]) - { - WARN("No mipmap generation support, returning D3DERR_INVALIDCALL.\n"); - return WINED3DERR_INVALIDCALL; - } - - if (levels > 1) - { - WARN("D3DUSAGE_AUTOGENMIPMAP is set, and level count > 1, returning D3DERR_INVALIDCALL.\n"); - return WINED3DERR_INVALIDCALL; - } - - levels = 1; - } - else if (!levels) - { - levels = wined3d_log2i(edge_length) + 1; - TRACE("Calculated levels = %u.\n", levels); - } - - texture->lpVtbl = &IWineD3DCubeTexture_Vtbl; - - hr = basetexture_init((IWineD3DBaseTextureImpl *)texture, 6, levels, - WINED3DRTYPE_CUBETEXTURE, device, 0, usage, format, pool, parent, parent_ops); - if (FAILED(hr)) - { - WARN("Failed to initialize basetexture, returning %#x\n", hr); - return hr; - } - - /* Find the nearest pow2 match. */ - pow2_edge_length = 1; - while (pow2_edge_length < edge_length) pow2_edge_length <<= 1; - - if (gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO] || (edge_length == pow2_edge_length)) - { - /* Precalculated scaling for 'faked' non power of two texture coords. */ - texture->baseTexture.pow2Matrix[0] = 1.0f; - texture->baseTexture.pow2Matrix[5] = 1.0f; - texture->baseTexture.pow2Matrix[10] = 1.0f; - texture->baseTexture.pow2Matrix[15] = 1.0f; - } - else - { - /* Precalculated scaling for 'faked' non power of two texture coords. */ - texture->baseTexture.pow2Matrix[0] = ((float)edge_length) / ((float)pow2_edge_length); - texture->baseTexture.pow2Matrix[5] = ((float)edge_length) / ((float)pow2_edge_length); - texture->baseTexture.pow2Matrix[10] = ((float)edge_length) / ((float)pow2_edge_length); - texture->baseTexture.pow2Matrix[15] = 1.0f; - texture->baseTexture.pow2Matrix_identity = FALSE; - } - texture->baseTexture.target = GL_TEXTURE_CUBE_MAP_ARB; - - /* Generate all the surfaces. */ - tmp_w = edge_length; - for (i = 0; i < texture->baseTexture.level_count; ++i) - { - /* Create the 6 faces. */ - for (j = 0; j < 6; ++j) - { - static const GLenum cube_targets[6] = - { - GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB, - GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB, - GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB, - GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB, - GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB, - GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB, - }; - UINT idx = j * texture->baseTexture.level_count + i; - IWineD3DSurface *surface; - - hr = IWineD3DDeviceParent_CreateSurface(device->device_parent, parent, tmp_w, tmp_w, - format_id, usage, pool, i /* Level */, j, &surface); - if (FAILED(hr)) - { - FIXME("(%p) Failed to create surface, hr %#x.\n", texture, hr); - cubetexture_cleanup(texture); - return hr; - } - - surface_set_container((IWineD3DSurfaceImpl *)surface, WINED3D_CONTAINER_TEXTURE, (IWineD3DBase *)texture); - surface_set_texture_target((IWineD3DSurfaceImpl *)surface, cube_targets[j]); - texture->baseTexture.sub_resources[idx] = (IWineD3DResourceImpl *)surface; - TRACE("Created surface level %u @ %p.\n", i, surface); - } - tmp_w = max(1, tmp_w >> 1); - } - texture->baseTexture.internal_preload = cubetexture_internal_preload; - - return WINED3D_OK; -} diff --git a/dll/directx/wine/wined3d/device.c b/dll/directx/wine/wined3d/device.c index 97acd5f9946..8724cdfb3e8 100644 --- a/dll/directx/wine/wined3d/device.c +++ b/dll/directx/wine/wined3d/device.c @@ -9,7 +9,7 @@ * Copyright 2006-2008 Stefan Dösinger for CodeWeavers * Copyright 2006-2008 Henri Verbeet * Copyright 2007 Andrew Riedi - * Copyright 2009 Henri Verbeet for CodeWeavers + * Copyright 2009-2011 Henri Verbeet for CodeWeavers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -173,11 +173,11 @@ static BOOL fixed_get_input(BYTE usage, BYTE usage_idx, unsigned int *regnum) } /* Context activation is done by the caller. */ -void device_stream_info_from_declaration(IWineD3DDeviceImpl *This, +void device_stream_info_from_declaration(struct wined3d_device *device, BOOL use_vshader, struct wined3d_stream_info *stream_info, BOOL *fixup) { /* We need to deal with frequency data! */ - IWineD3DVertexDeclarationImpl *declaration = This->stateBlock->state.vertex_declaration; + struct wined3d_vertex_declaration *declaration = device->stateBlock->state.vertex_declaration; unsigned int i; stream_info->use_map = 0; @@ -191,7 +191,7 @@ void device_stream_info_from_declaration(IWineD3DDeviceImpl *This, for (i = 0; i < declaration->element_count; ++i) { const struct wined3d_vertex_declaration_element *element = &declaration->elements[i]; - struct wined3d_buffer *buffer = This->stateBlock->state.streams[element->input_slot].buffer; + struct wined3d_buffer *buffer = device->stateBlock->state.streams[element->input_slot].buffer; GLuint buffer_object = 0; const BYTE *data = NULL; BOOL stride_used; @@ -203,8 +203,8 @@ void device_stream_info_from_declaration(IWineD3DDeviceImpl *This, if (!buffer) continue; - stride = This->stateBlock->state.streams[element->input_slot].stride; - if (This->stateBlock->state.user_stream) + stride = device->stateBlock->state.streams[element->input_slot].stride; + if (device->stateBlock->state.user_stream) { TRACE("Stream %u is UP, %p\n", element->input_slot, buffer); buffer_object = 0; @@ -213,20 +213,20 @@ void device_stream_info_from_declaration(IWineD3DDeviceImpl *This, else { TRACE("Stream %u isn't UP, %p\n", element->input_slot, buffer); - data = buffer_get_memory((IWineD3DBuffer *)buffer, &This->adapter->gl_info, &buffer_object); + data = buffer_get_memory(buffer, &device->adapter->gl_info, &buffer_object); /* Can't use vbo's if the base vertex index is negative. OpenGL doesn't accept negative offsets * (or rather offsets bigger than the vbo, because the pointer is unsigned), so use system memory * sources. In most sane cases the pointer - offset will still be > 0, otherwise it will wrap * around to some big value. Hope that with the indices, the driver wraps it back internally. If * not, drawStridedSlow is needed, including a vertex buffer path. */ - if (This->stateBlock->state.load_base_vertex_index < 0) + if (device->stateBlock->state.load_base_vertex_index < 0) { WARN("load_base_vertex_index is < 0 (%d), not using VBOs.\n", - This->stateBlock->state.load_base_vertex_index); + device->stateBlock->state.load_base_vertex_index); buffer_object = 0; - data = buffer_get_sysmem(buffer, &This->adapter->gl_info); - if ((UINT_PTR)data < -This->stateBlock->state.load_base_vertex_index * stride) + data = buffer_get_sysmem(buffer, &device->adapter->gl_info); + if ((UINT_PTR)data < -device->stateBlock->state.load_base_vertex_index * stride) { FIXME("System memory vertex data load offset is negative!\n"); } @@ -260,7 +260,7 @@ void device_stream_info_from_declaration(IWineD3DDeviceImpl *This, /* TODO: Assuming vertexdeclarations are usually used with the * same or a similar shader, it might be worth it to store the * last used output slot and try that one first. */ - stride_used = vshader_get_input(This->stateBlock->state.vertex_shader, + stride_used = vshader_get_input(device->stateBlock->state.vertex_shader, element->usage, element->usage_idx, &idx); } else @@ -297,7 +297,7 @@ void device_stream_info_from_declaration(IWineD3DDeviceImpl *This, stream_info->elements[idx].stream_idx = element->input_slot; stream_info->elements[idx].buffer_object = buffer_object; - if (!This->adapter->gl_info.supported[ARB_VERTEX_ARRAY_BGRA] + if (!device->adapter->gl_info.supported[ARB_VERTEX_ARRAY_BGRA] && element->format->id == WINED3DFMT_B8G8R8A8_UNORM) { stream_info->swizzle_map |= 1 << idx; @@ -306,8 +306,8 @@ void device_stream_info_from_declaration(IWineD3DDeviceImpl *This, } } - This->num_buffer_queries = 0; - if (!This->stateBlock->state.user_stream) + device->num_buffer_queries = 0; + if (!device->stateBlock->state.user_stream) { WORD map = stream_info->use_map; @@ -320,18 +320,18 @@ void device_stream_info_from_declaration(IWineD3DDeviceImpl *This, if (!(map & 1)) continue; element = &stream_info->elements[i]; - buffer = This->stateBlock->state.streams[element->stream_idx].buffer; - IWineD3DBuffer_PreLoad((IWineD3DBuffer *)buffer); + buffer = device->stateBlock->state.streams[element->stream_idx].buffer; + wined3d_buffer_preload(buffer); /* If PreLoad dropped the buffer object, update the stream info. */ if (buffer->buffer_object != element->buffer_object) { element->buffer_object = 0; - element->data = buffer_get_sysmem(buffer, &This->adapter->gl_info) + (ptrdiff_t)element->data; + element->data = buffer_get_sysmem(buffer, &device->adapter->gl_info) + (ptrdiff_t)element->data; } if (buffer->query) - This->buffer_queries[This->num_buffer_queries++] = buffer->query; + device->buffer_queries[device->num_buffer_queries++] = buffer->query; } } } @@ -405,7 +405,7 @@ static void device_trace_strided_stream_info(const struct wined3d_stream_info *s } /* Context activation is done by the caller. */ -void device_update_stream_info(IWineD3DDeviceImpl *device, const struct wined3d_gl_info *gl_info) +void device_update_stream_info(struct wined3d_device *device, const struct wined3d_gl_info *gl_info) { struct wined3d_stream_info *stream_info = &device->strided_streams; const struct wined3d_state *state = &device->stateBlock->state; @@ -455,15 +455,15 @@ void device_update_stream_info(IWineD3DDeviceImpl *device, const struct wined3d_ static void device_preload_texture(const struct wined3d_state *state, unsigned int idx) { - IWineD3DBaseTextureImpl *texture; + struct wined3d_texture *texture; enum WINED3DSRGB srgb; if (!(texture = state->textures[idx])) return; srgb = state->sampler_states[idx][WINED3DSAMP_SRGBTEXTURE] ? SRGB_SRGB : SRGB_RGB; - texture->baseTexture.internal_preload((IWineD3DBaseTexture *)texture, srgb); + texture->texture_ops->texture_preload(texture, srgb); } -void device_preload_textures(IWineD3DDeviceImpl *device) +void device_preload_textures(struct wined3d_device *device) { const struct wined3d_state *state = &device->stateBlock->state; unsigned int i; @@ -472,7 +472,7 @@ void device_preload_textures(IWineD3DDeviceImpl *device) { for (i = 0; i < MAX_VERTEX_SAMPLERS; ++i) { - if (state->vertex_shader->baseShader.reg_maps.sampler_type[i]) + if (state->vertex_shader->reg_maps.sampler_type[i]) device_preload_texture(state, MAX_FRAGMENT_SAMPLERS + i); } } @@ -481,7 +481,7 @@ void device_preload_textures(IWineD3DDeviceImpl *device) { for (i = 0; i < MAX_FRAGMENT_SAMPLERS; ++i) { - if (state->pixel_shader->baseShader.reg_maps.sampler_type[i]) + if (state->pixel_shader->reg_maps.sampler_type[i]) device_preload_texture(state, i); } } @@ -497,14 +497,15 @@ void device_preload_textures(IWineD3DDeviceImpl *device) } } -BOOL device_context_add(IWineD3DDeviceImpl *device, struct wined3d_context *context) +BOOL device_context_add(struct wined3d_device *device, struct wined3d_context *context) { struct wined3d_context **new_array; TRACE("Adding context %p.\n", context); if (!device->contexts) new_array = HeapAlloc(GetProcessHeap(), 0, sizeof(*new_array)); - else new_array = HeapReAlloc(GetProcessHeap(), 0, device->contexts, sizeof(*new_array) * (device->numContexts + 1)); + else new_array = HeapReAlloc(GetProcessHeap(), 0, device->contexts, + sizeof(*new_array) * (device->context_count + 1)); if (!new_array) { @@ -512,12 +513,12 @@ BOOL device_context_add(IWineD3DDeviceImpl *device, struct wined3d_context *cont return FALSE; } - new_array[device->numContexts++] = context; + new_array[device->context_count++] = context; device->contexts = new_array; return TRUE; } -void device_context_remove(IWineD3DDeviceImpl *device, struct wined3d_context *context) +void device_context_remove(struct wined3d_device *device, struct wined3d_context *context) { struct wined3d_context **new_array; BOOL found = FALSE; @@ -525,7 +526,7 @@ void device_context_remove(IWineD3DDeviceImpl *device, struct wined3d_context *c TRACE("Removing context %p.\n", context); - for (i = 0; i < device->numContexts; ++i) + for (i = 0; i < device->context_count; ++i) { if (device->contexts[i] == context) { @@ -540,15 +541,15 @@ void device_context_remove(IWineD3DDeviceImpl *device, struct wined3d_context *c return; } - if (!--device->numContexts) + if (!--device->context_count) { HeapFree(GetProcessHeap(), 0, device->contexts); device->contexts = NULL; return; } - memmove(&device->contexts[i], &device->contexts[i + 1], (device->numContexts - i) * sizeof(*device->contexts)); - new_array = HeapReAlloc(GetProcessHeap(), 0, device->contexts, device->numContexts * sizeof(*device->contexts)); + memmove(&device->contexts[i], &device->contexts[i + 1], (device->context_count - i) * sizeof(*device->contexts)); + new_array = HeapReAlloc(GetProcessHeap(), 0, device->contexts, device->context_count * sizeof(*device->contexts)); if (!new_array) { ERR("Failed to shrink context array. Oh well.\n"); @@ -558,9 +559,9 @@ void device_context_remove(IWineD3DDeviceImpl *device, struct wined3d_context *c device->contexts = new_array; } -void device_get_draw_rect(IWineD3DDeviceImpl *device, RECT *rect) +void device_get_draw_rect(struct wined3d_device *device, RECT *rect) { - IWineD3DStateBlockImpl *stateblock = device->stateBlock; + struct wined3d_stateblock *stateblock = device->stateBlock; WINED3DVIEWPORT *vp = &stateblock->state.viewport; SetRect(rect, vp->X, vp->Y, vp->X + vp->Width, vp->Y + vp->Height); @@ -572,8 +573,8 @@ void device_get_draw_rect(IWineD3DDeviceImpl *device, RECT *rect) } /* Do not call while under the GL lock. */ -void device_switch_onscreen_ds(IWineD3DDeviceImpl *device, - struct wined3d_context *context, IWineD3DSurfaceImpl *depth_stencil) +void device_switch_onscreen_ds(struct wined3d_device *device, + struct wined3d_context *context, struct wined3d_surface *depth_stencil) { if (device->onscreen_depth_stencil) { @@ -581,35 +582,35 @@ void device_switch_onscreen_ds(IWineD3DDeviceImpl *device, surface_modify_ds_location(device->onscreen_depth_stencil, SFLAG_DS_OFFSCREEN, device->onscreen_depth_stencil->ds_current_size.cx, device->onscreen_depth_stencil->ds_current_size.cy); - IWineD3DSurface_Release((IWineD3DSurface *)device->onscreen_depth_stencil); + wined3d_surface_decref(device->onscreen_depth_stencil); } device->onscreen_depth_stencil = depth_stencil; - IWineD3DSurface_AddRef((IWineD3DSurface *)device->onscreen_depth_stencil); + wined3d_surface_incref(device->onscreen_depth_stencil); } -static BOOL is_full_clear(IWineD3DSurfaceImpl *target, const RECT *draw_rect, const RECT *clear_rect) +static BOOL is_full_clear(struct wined3d_surface *target, const RECT *draw_rect, const RECT *clear_rect) { /* partial draw rect */ if (draw_rect->left || draw_rect->top - || draw_rect->right < target->currentDesc.Width - || draw_rect->bottom < target->currentDesc.Height) + || draw_rect->right < target->resource.width + || draw_rect->bottom < target->resource.height) return FALSE; /* partial clear rect */ if (clear_rect && (clear_rect->left > 0 || clear_rect->top > 0 - || clear_rect->right < target->currentDesc.Width - || clear_rect->bottom < target->currentDesc.Height)) + || clear_rect->right < target->resource.width + || clear_rect->bottom < target->resource.height)) return FALSE; return TRUE; } -static void prepare_ds_clear(IWineD3DSurfaceImpl *ds, struct wined3d_context *context, +static void prepare_ds_clear(struct wined3d_surface *ds, struct wined3d_context *context, DWORD location, const RECT *draw_rect, UINT rect_count, const RECT *clear_rect) { RECT current_rect, r; - if (ds->Flags & location) + if (ds->flags & location) SetRect(¤t_rect, 0, 0, ds->ds_current_size.cx, ds->ds_current_size.cy); @@ -650,16 +651,16 @@ static void prepare_ds_clear(IWineD3DSurfaceImpl *ds, struct wined3d_context *co } /* Do not call while under the GL lock. */ -HRESULT device_clear_render_targets(IWineD3DDeviceImpl *device, UINT rt_count, IWineD3DSurfaceImpl **rts, - UINT rect_count, const RECT *rects, const RECT *draw_rect, DWORD flags, - const WINED3DCOLORVALUE *color, float depth, DWORD stencil) +HRESULT device_clear_render_targets(struct wined3d_device *device, UINT rt_count, struct wined3d_surface **rts, + struct wined3d_surface *depth_stencil, UINT rect_count, const RECT *rects, const RECT *draw_rect, + DWORD flags, const WINED3DCOLORVALUE *color, float depth, DWORD stencil) { const RECT *clear_rect = (rect_count > 0 && rects) ? (const RECT *)rects : NULL; - IWineD3DSurfaceImpl *depth_stencil = device->depth_stencil; - IWineD3DSurfaceImpl *target = rts[0]; + struct wined3d_surface *target = rt_count ? rts[0] : NULL; UINT drawable_width, drawable_height; struct wined3d_context *context; GLbitfield clear_mask = 0; + BOOL render_offscreen; unsigned int i; /* When we're clearing parts of the drawable, make sure that the target surface is well up to date in the @@ -686,9 +687,24 @@ HRESULT device_clear_render_targets(IWineD3DDeviceImpl *device, UINT rt_count, I return WINED3D_OK; } - context_apply_clear_state(context, device, rt_count, rts, depth_stencil); + if (!context_apply_clear_state(context, device, rt_count, rts, depth_stencil)) + { + context_release(context); + WARN("Failed to apply clear state, skipping clear.\n"); + return WINED3D_OK; + } - target->get_drawable_size(context, &drawable_width, &drawable_height); + if (target) + { + render_offscreen = context->render_offscreen; + target->get_drawable_size(context, &drawable_width, &drawable_height); + } + else + { + render_offscreen = TRUE; + drawable_width = depth_stencil->pow2Width; + drawable_height = depth_stencil->pow2Height; + } ENTER_GL(); @@ -709,7 +725,7 @@ HRESULT device_clear_render_targets(IWineD3DDeviceImpl *device, UINT rt_count, I if (flags & WINED3DCLEAR_ZBUFFER) { - DWORD location = context->render_offscreen ? SFLAG_DS_OFFSCREEN : SFLAG_DS_ONSCREEN; + DWORD location = render_offscreen ? SFLAG_DS_OFFSCREEN : SFLAG_DS_ONSCREEN; if (location == SFLAG_DS_ONSCREEN && depth_stencil != device->onscreen_depth_stencil) { @@ -746,7 +762,7 @@ HRESULT device_clear_render_targets(IWineD3DDeviceImpl *device, UINT rt_count, I if (!clear_rect) { - if (context->render_offscreen) + if (render_offscreen) { glScissor(draw_rect->left, draw_rect->top, draw_rect->right - draw_rect->left, draw_rect->bottom - draw_rect->top); @@ -783,7 +799,7 @@ HRESULT device_clear_render_targets(IWineD3DDeviceImpl *device, UINT rt_count, I continue; } - if (context->render_offscreen) + if (render_offscreen) { glScissor(current_rect.left, current_rect.top, current_rect.right - current_rect.left, current_rect.bottom - current_rect.top); @@ -802,7 +818,8 @@ HRESULT device_clear_render_targets(IWineD3DDeviceImpl *device, UINT rt_count, I LEAVE_GL(); - if (wined3d_settings.strict_draw_ordering || (target->container.type == WINED3D_CONTAINER_SWAPCHAIN + if (wined3d_settings.strict_draw_ordering || (flags & WINED3DCLEAR_TARGET + && target->container.type == WINED3D_CONTAINER_SWAPCHAIN && target->container.u.swapchain->front_buffer == target)) wglFlush(); /* Flush to ensure ordering across contexts. */ @@ -811,828 +828,90 @@ HRESULT device_clear_render_targets(IWineD3DDeviceImpl *device, UINT rt_count, I return WINED3D_OK; } - -/********************************************************** - * IUnknown parts follows - **********************************************************/ - -static HRESULT WINAPI IWineD3DDeviceImpl_QueryInterface(IWineD3DDevice *iface, REFIID riid, void **object) +ULONG CDECL wined3d_device_incref(struct wined3d_device *device) { - TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object); + ULONG refcount = InterlockedIncrement(&device->ref); - if (IsEqualGUID(riid, &IID_IWineD3DDevice) - || IsEqualGUID(riid, &IID_IUnknown)) + TRACE("%p increasing refcount to %u.\n", device, refcount); + + return refcount; +} + +ULONG CDECL wined3d_device_decref(struct wined3d_device *device) +{ + ULONG refcount = InterlockedDecrement(&device->ref); + + TRACE("%p decreasing refcount to %u.\n", device, refcount); + + if (!refcount) { - IUnknown_AddRef(iface); - *object = iface; - return S_OK; - } - - WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid)); - - *object = NULL; - return E_NOINTERFACE; -} - -static ULONG WINAPI IWineD3DDeviceImpl_AddRef(IWineD3DDevice *iface) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - ULONG refCount = InterlockedIncrement(&This->ref); - - TRACE("(%p) : AddRef increasing from %d\n", This, refCount - 1); - return refCount; -} - -static ULONG WINAPI IWineD3DDeviceImpl_Release(IWineD3DDevice *iface) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - ULONG refCount = InterlockedDecrement(&This->ref); - - TRACE("(%p) : Releasing from %d\n", This, refCount + 1); - - if (!refCount) { UINT i; - for (i = 0; i < sizeof(This->multistate_funcs)/sizeof(This->multistate_funcs[0]); ++i) { - HeapFree(GetProcessHeap(), 0, This->multistate_funcs[i]); - This->multistate_funcs[i] = NULL; + for (i = 0; i < sizeof(device->multistate_funcs) / sizeof(device->multistate_funcs[0]); ++i) + { + HeapFree(GetProcessHeap(), 0, device->multistate_funcs[i]); + device->multistate_funcs[i] = NULL; } - /* TODO: Clean up all the surfaces and textures! */ - /* NOTE: You must release the parent if the object was created via a callback - ** ***************************/ - - if (!list_empty(&This->resources)) + if (!list_empty(&device->resources)) { - IWineD3DResourceImpl *resource; - FIXME("(%p) Device released with resources still bound, acceptable but unexpected\n", This); + struct wined3d_resource *resource; - LIST_FOR_EACH_ENTRY(resource, &This->resources, IWineD3DResourceImpl, resource.resource_list_entry) + FIXME("Device released with resources still bound, acceptable but unexpected.\n"); + + LIST_FOR_EACH_ENTRY(resource, &device->resources, struct wined3d_resource, resource_list_entry) { - WINED3DRESOURCETYPE type = IWineD3DResource_GetType((IWineD3DResource *)resource); FIXME("Leftover resource %p with type %s (%#x).\n", - resource, debug_d3dresourcetype(type), type); + resource, debug_d3dresourcetype(resource->resourceType), resource->resourceType); } } - if(This->contexts) ERR("Context array not freed!\n"); - if (This->hardwareCursor) DestroyCursor(This->hardwareCursor); - This->haveHardwareCursor = FALSE; + if (device->contexts) + ERR("Context array not freed!\n"); + if (device->hardwareCursor) + DestroyCursor(device->hardwareCursor); + device->hardwareCursor = 0; - IWineD3D_Release(This->wined3d); - This->wined3d = NULL; - HeapFree(GetProcessHeap(), 0, This); - TRACE("Freed device %p\n", This); - This = NULL; + wined3d_decref(device->wined3d); + device->wined3d = NULL; + HeapFree(GetProcessHeap(), 0, device); + TRACE("Freed device %p.\n", device); } - return refCount; + + return refcount; } -static HRESULT WINAPI IWineD3DDeviceImpl_CreateBuffer(IWineD3DDevice *iface, struct wined3d_buffer_desc *desc, - const void *data, void *parent, const struct wined3d_parent_ops *parent_ops, IWineD3DBuffer **buffer) +UINT CDECL wined3d_device_get_swapchain_count(struct wined3d_device *device) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - struct wined3d_buffer *object; - HRESULT hr; + TRACE("device %p.\n", device); - TRACE("iface %p, desc %p, data %p, parent %p, buffer %p\n", iface, desc, data, parent, buffer); - - object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); - if (!object) - { - ERR("Failed to allocate memory\n"); - return E_OUTOFMEMORY; - } - - FIXME("Ignoring access flags (pool)\n"); - - hr = buffer_init(object, This, desc->byte_width, desc->usage, WINED3DFMT_UNKNOWN, - WINED3DPOOL_MANAGED, GL_ARRAY_BUFFER_ARB, data, parent, parent_ops); - if (FAILED(hr)) - { - WARN("Failed to initialize buffer, hr %#x.\n", hr); - HeapFree(GetProcessHeap(), 0, object); - return hr; - } - object->desc = *desc; - - TRACE("Created buffer %p.\n", object); - - *buffer = (IWineD3DBuffer *)object; - - return WINED3D_OK; + return device->swapchain_count; } -static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexBuffer(IWineD3DDevice *iface, - UINT Size, DWORD Usage, WINED3DPOOL Pool, void *parent, - const struct wined3d_parent_ops *parent_ops, IWineD3DBuffer **ppVertexBuffer) +HRESULT CDECL wined3d_device_get_swapchain(struct wined3d_device *device, + UINT swapchain_idx, struct wined3d_swapchain **swapchain) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - struct wined3d_buffer *object; - HRESULT hr; + TRACE("device %p, swapchain_idx %u, swapchain %p.\n", + device, swapchain_idx, swapchain); - TRACE("iface %p, size %u, usage %#x, pool %#x, buffer %p, parent %p, parent_ops %p.\n", - iface, Size, Usage, Pool, ppVertexBuffer, parent, parent_ops); - - if (Pool == WINED3DPOOL_SCRATCH) + if (swapchain_idx >= device->swapchain_count) { - /* The d3d9 testsuit shows that this is not allowed. It doesn't make much sense - * anyway, SCRATCH vertex buffers aren't usable anywhere - */ - WARN("Vertex buffer in D3DPOOL_SCRATCH requested, returning WINED3DERR_INVALIDCALL\n"); - *ppVertexBuffer = NULL; + WARN("swapchain_idx %u >= swapchain_count %u.\n", + swapchain_idx, device->swapchain_count); + *swapchain = NULL; + return WINED3DERR_INVALIDCALL; } - object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); - if (!object) - { - ERR("Out of memory\n"); - *ppVertexBuffer = NULL; - return WINED3DERR_OUTOFVIDEOMEMORY; - } - - hr = buffer_init(object, This, Size, Usage, WINED3DFMT_VERTEXDATA, - Pool, GL_ARRAY_BUFFER_ARB, NULL, parent, parent_ops); - if (FAILED(hr)) - { - WARN("Failed to initialize buffer, hr %#x.\n", hr); - HeapFree(GetProcessHeap(), 0, object); - return hr; - } - - TRACE("Created buffer %p.\n", object); - *ppVertexBuffer = (IWineD3DBuffer *)object; + *swapchain = device->swapchains[swapchain_idx]; + wined3d_swapchain_incref(*swapchain); + TRACE("Returning %p.\n", *swapchain); return WINED3D_OK; } -static HRESULT WINAPI IWineD3DDeviceImpl_CreateIndexBuffer(IWineD3DDevice *iface, - UINT Length, DWORD Usage, WINED3DPOOL Pool, void *parent, - const struct wined3d_parent_ops *parent_ops, IWineD3DBuffer **ppIndexBuffer) +static void IWineD3DDeviceImpl_LoadLogo(struct wined3d_device *device, const char *filename) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - struct wined3d_buffer *object; - HRESULT hr; - - TRACE("(%p) Creating index buffer\n", This); - - /* Allocate the storage for the device */ - object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); - if (!object) - { - ERR("Out of memory\n"); - *ppIndexBuffer = NULL; - return WINED3DERR_OUTOFVIDEOMEMORY; - } - - hr = buffer_init(object, This, Length, Usage | WINED3DUSAGE_STATICDECL, - WINED3DFMT_UNKNOWN, Pool, GL_ELEMENT_ARRAY_BUFFER_ARB, NULL, - parent, parent_ops); - if (FAILED(hr)) - { - WARN("Failed to initialize buffer, hr %#x\n", hr); - HeapFree(GetProcessHeap(), 0, object); - return hr; - } - - TRACE("Created buffer %p.\n", object); - - *ppIndexBuffer = (IWineD3DBuffer *) object; - - return WINED3D_OK; -} - -static HRESULT WINAPI IWineD3DDeviceImpl_CreateStateBlock(IWineD3DDevice *iface, - WINED3DSTATEBLOCKTYPE type, IWineD3DStateBlock **stateblock) -{ - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - IWineD3DStateBlockImpl *object; - HRESULT hr; - - object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); - if(!object) - { - ERR("Failed to allocate stateblock memory.\n"); - return E_OUTOFMEMORY; - } - - hr = stateblock_init(object, This, type); - if (FAILED(hr)) - { - WARN("Failed to initialize stateblock, hr %#x.\n", hr); - HeapFree(GetProcessHeap(), 0, object); - return hr; - } - - TRACE("Created stateblock %p.\n", object); - *stateblock = (IWineD3DStateBlock *)object; - - return WINED3D_OK; -} - -static HRESULT WINAPI IWineD3DDeviceImpl_CreateSurface(IWineD3DDevice *iface, UINT Width, UINT Height, - enum wined3d_format_id Format, BOOL Lockable, BOOL Discard, UINT Level, DWORD Usage, WINED3DPOOL Pool, - WINED3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, WINED3DSURFTYPE Impl, - void *parent, const struct wined3d_parent_ops *parent_ops, IWineD3DSurface **surface) -{ - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - IWineD3DSurfaceImpl *object; - HRESULT hr; - - TRACE("iface %p, width %u, height %u, format %s (%#x), lockable %#x, discard %#x, level %u\n", - iface, Width, Height, debug_d3dformat(Format), Format, Lockable, Discard, Level); - TRACE("surface %p, usage %s (%#x), pool %s (%#x), multisample_type %#x, multisample_quality %u\n", - surface, debug_d3dusage(Usage), Usage, debug_d3dpool(Pool), Pool, MultiSample, MultisampleQuality); - TRACE("surface_type %#x, parent %p, parent_ops %p.\n", Impl, parent, parent_ops); - - if (Impl == SURFACE_OPENGL && !This->adapter) - { - ERR("OpenGL surfaces are not available without OpenGL.\n"); - return WINED3DERR_NOTAVAILABLE; - } - - object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); - if (!object) - { - ERR("Failed to allocate surface memory.\n"); - return WINED3DERR_OUTOFVIDEOMEMORY; - } - - hr = surface_init(object, Impl, This->surface_alignment, Width, Height, Level, Lockable, - Discard, MultiSample, MultisampleQuality, This, Usage, Format, Pool, parent, parent_ops); - if (FAILED(hr)) - { - WARN("Failed to initialize surface, returning %#x.\n", hr); - HeapFree(GetProcessHeap(), 0, object); - return hr; - } - - TRACE("(%p) : Created surface %p\n", This, object); - - *surface = (IWineD3DSurface *)object; - - return hr; -} - -static HRESULT WINAPI IWineD3DDeviceImpl_CreateRendertargetView(IWineD3DDevice *iface, - IWineD3DResource *resource, void *parent, IWineD3DRendertargetView **rendertarget_view) -{ - struct wined3d_rendertarget_view *object; - - TRACE("iface %p, resource %p, parent %p, rendertarget_view %p.\n", - iface, resource, parent, rendertarget_view); - - object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); - if (!object) - { - ERR("Failed to allocate memory\n"); - return E_OUTOFMEMORY; - } - - wined3d_rendertarget_view_init(object, resource, parent); - - TRACE("Created render target view %p.\n", object); - *rendertarget_view = (IWineD3DRendertargetView *)object; - - return WINED3D_OK; -} - -static HRESULT WINAPI IWineD3DDeviceImpl_CreateTexture(IWineD3DDevice *iface, - UINT Width, UINT Height, UINT Levels, DWORD Usage, enum wined3d_format_id Format, WINED3DPOOL Pool, - void *parent, const struct wined3d_parent_ops *parent_ops, IWineD3DTexture **ppTexture) -{ - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - IWineD3DTextureImpl *object; - HRESULT hr; - - TRACE("(%p) : Width %d, Height %d, Levels %d, Usage %#x\n", This, Width, Height, Levels, Usage); - TRACE("Format %#x (%s), Pool %#x, ppTexture %p, parent %p\n", - Format, debug_d3dformat(Format), Pool, ppTexture, parent); - - object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); - if (!object) - { - ERR("Out of memory\n"); - *ppTexture = NULL; - return WINED3DERR_OUTOFVIDEOMEMORY; - } - - hr = texture_init(object, Width, Height, Levels, This, Usage, Format, Pool, parent, parent_ops); - if (FAILED(hr)) - { - WARN("Failed to initialize texture, returning %#x\n", hr); - HeapFree(GetProcessHeap(), 0, object); - *ppTexture = NULL; - return hr; - } - - *ppTexture = (IWineD3DTexture *)object; - - TRACE("(%p) : Created texture %p\n", This, object); - - return WINED3D_OK; -} - -static HRESULT WINAPI IWineD3DDeviceImpl_CreateVolumeTexture(IWineD3DDevice *iface, - UINT Width, UINT Height, UINT Depth, UINT Levels, DWORD Usage, enum wined3d_format_id Format, WINED3DPOOL Pool, - void *parent, const struct wined3d_parent_ops *parent_ops, IWineD3DVolumeTexture **ppVolumeTexture) -{ - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - IWineD3DVolumeTextureImpl *object; - HRESULT hr; - - TRACE("(%p) : W(%u) H(%u) D(%u), Lvl(%u) Usage(%#x), Fmt(%u,%s), Pool(%s)\n", This, Width, Height, - Depth, Levels, Usage, Format, debug_d3dformat(Format), debug_d3dpool(Pool)); - - object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); - if (!object) - { - ERR("Out of memory\n"); - *ppVolumeTexture = NULL; - return WINED3DERR_OUTOFVIDEOMEMORY; - } - - hr = volumetexture_init(object, Width, Height, Depth, Levels, This, Usage, Format, Pool, parent, parent_ops); - if (FAILED(hr)) - { - WARN("Failed to initialize volumetexture, returning %#x\n", hr); - HeapFree(GetProcessHeap(), 0, object); - *ppVolumeTexture = NULL; - return hr; - } - - TRACE("(%p) : Created volume texture %p.\n", This, object); - *ppVolumeTexture = (IWineD3DVolumeTexture *)object; - - return WINED3D_OK; -} - -static HRESULT WINAPI IWineD3DDeviceImpl_CreateVolume(IWineD3DDevice *iface, UINT Width, UINT Height, - UINT Depth, DWORD Usage, enum wined3d_format_id Format, WINED3DPOOL Pool, void *parent, - const struct wined3d_parent_ops *parent_ops, IWineD3DVolume **ppVolume) -{ - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - IWineD3DVolumeImpl *object; - HRESULT hr; - - TRACE("(%p) : W(%d) H(%d) D(%d), Usage(%d), Fmt(%u,%s), Pool(%s)\n", This, Width, Height, - Depth, Usage, Format, debug_d3dformat(Format), debug_d3dpool(Pool)); - - object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); - if (!object) - { - ERR("Out of memory\n"); - *ppVolume = NULL; - return WINED3DERR_OUTOFVIDEOMEMORY; - } - - hr = volume_init(object, This, Width, Height, Depth, Usage, Format, Pool, parent, parent_ops); - if (FAILED(hr)) - { - WARN("Failed to initialize volume, returning %#x.\n", hr); - HeapFree(GetProcessHeap(), 0, object); - return hr; - } - - TRACE("(%p) : Created volume %p.\n", This, object); - *ppVolume = (IWineD3DVolume *)object; - - return WINED3D_OK; -} - -static HRESULT WINAPI IWineD3DDeviceImpl_CreateCubeTexture(IWineD3DDevice *iface, UINT EdgeLength, UINT Levels, - DWORD Usage, enum wined3d_format_id Format, WINED3DPOOL Pool, void *parent, - const struct wined3d_parent_ops *parent_ops, IWineD3DCubeTexture **ppCubeTexture) -{ - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - IWineD3DCubeTextureImpl *object; /** NOTE: impl ref allowed since this is a create function **/ - HRESULT hr; - - object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); - if (!object) - { - ERR("Out of memory\n"); - *ppCubeTexture = NULL; - return WINED3DERR_OUTOFVIDEOMEMORY; - } - - hr = cubetexture_init(object, EdgeLength, Levels, This, Usage, Format, Pool, parent, parent_ops); - if (FAILED(hr)) - { - WARN("Failed to initialize cubetexture, returning %#x\n", hr); - HeapFree(GetProcessHeap(), 0, object); - *ppCubeTexture = NULL; - return hr; - } - - TRACE("(%p) : Created Cube Texture %p\n", This, object); - *ppCubeTexture = (IWineD3DCubeTexture *)object; - - return WINED3D_OK; -} - -static HRESULT WINAPI IWineD3DDeviceImpl_CreateQuery(IWineD3DDevice *iface, - WINED3DQUERYTYPE type, IWineD3DQuery **query) -{ - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - IWineD3DQueryImpl *object; - HRESULT hr; - - TRACE("iface %p, type %#x, query %p.\n", iface, type, query); - - object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); - if (!object) - { - ERR("Failed to allocate query memory.\n"); - return E_OUTOFMEMORY; - } - - hr = query_init(object, This, type); - if (FAILED(hr)) - { - WARN("Failed to initialize query, hr %#x.\n", hr); - HeapFree(GetProcessHeap(), 0, object); - return hr; - } - - TRACE("Created query %p.\n", object); - *query = (IWineD3DQuery *)object; - - return WINED3D_OK; -} - -/* Do not call while under the GL lock. */ -static HRESULT WINAPI IWineD3DDeviceImpl_CreateSwapChain(IWineD3DDevice *iface, - WINED3DPRESENT_PARAMETERS *present_parameters, WINED3DSURFTYPE surface_type, - void *parent, IWineD3DSwapChain **swapchain) -{ - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - IWineD3DSwapChainImpl *object; - HRESULT hr; - - TRACE("iface %p, present_parameters %p, swapchain %p, parent %p, surface_type %#x.\n", - iface, present_parameters, swapchain, parent, surface_type); - - object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); - if (!object) - { - ERR("Failed to allocate swapchain memory.\n"); - return E_OUTOFMEMORY; - } - - hr = swapchain_init(object, surface_type, This, present_parameters, parent); - if (FAILED(hr)) - { - WARN("Failed to initialize swapchain, hr %#x.\n", hr); - HeapFree(GetProcessHeap(), 0, object); - return hr; - } - - TRACE("Created swapchain %p.\n", object); - *swapchain = (IWineD3DSwapChain *)object; - - return WINED3D_OK; -} - -/** NOTE: These are ahead of the other getters and setters to save using a forward declaration **/ -static UINT WINAPI IWineD3DDeviceImpl_GetNumberOfSwapChains(IWineD3DDevice *iface) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - TRACE("(%p)\n", This); - - return This->NumberOfSwapChains; -} - -static HRESULT WINAPI IWineD3DDeviceImpl_GetSwapChain(IWineD3DDevice *iface, UINT iSwapChain, IWineD3DSwapChain **pSwapChain) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - TRACE("(%p) : swapchain %d\n", This, iSwapChain); - - if(iSwapChain < This->NumberOfSwapChains) { - *pSwapChain = This->swapchains[iSwapChain]; - IWineD3DSwapChain_AddRef(*pSwapChain); - TRACE("(%p) returning %p\n", This, *pSwapChain); - return WINED3D_OK; - } else { - TRACE("Swapchain out of range\n"); - *pSwapChain = NULL; - return WINED3DERR_INVALIDCALL; - } -} - -static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexDeclaration(IWineD3DDevice *iface, - const WINED3DVERTEXELEMENT *elements, UINT element_count, void *parent, - const struct wined3d_parent_ops *parent_ops, IWineD3DVertexDeclaration **declaration) -{ - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - IWineD3DVertexDeclarationImpl *object = NULL; - HRESULT hr; - - TRACE("iface %p, declaration %p, parent %p, elements %p, element_count %u.\n", - iface, declaration, parent, elements, element_count); - - object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); - if(!object) - { - ERR("Failed to allocate vertex declaration memory.\n"); - return E_OUTOFMEMORY; - } - - hr = vertexdeclaration_init(object, This, elements, element_count, parent, parent_ops); - if (FAILED(hr)) - { - WARN("Failed to initialize vertex declaration, hr %#x.\n", hr); - HeapFree(GetProcessHeap(), 0, object); - return hr; - } - - TRACE("Created vertex declaration %p.\n", object); - *declaration = (IWineD3DVertexDeclaration *)object; - - return WINED3D_OK; -} - -struct wined3d_fvf_convert_state -{ - const struct wined3d_gl_info *gl_info; - WINED3DVERTEXELEMENT *elements; - UINT offset; - UINT idx; -}; - -static void append_decl_element(struct wined3d_fvf_convert_state *state, - enum wined3d_format_id format_id, WINED3DDECLUSAGE usage, UINT usage_idx) -{ - WINED3DVERTEXELEMENT *elements = state->elements; - const struct wined3d_format *format; - UINT offset = state->offset; - UINT idx = state->idx; - - elements[idx].format = format_id; - elements[idx].input_slot = 0; - elements[idx].offset = offset; - elements[idx].output_slot = 0; - elements[idx].method = WINED3DDECLMETHOD_DEFAULT; - elements[idx].usage = usage; - elements[idx].usage_idx = usage_idx; - - format = wined3d_get_format(state->gl_info, format_id); - state->offset += format->component_count * format->component_size; - ++state->idx; -} - -static unsigned int ConvertFvfToDeclaration(IWineD3DDeviceImpl *This, /* For the GL info, which has the type table */ - DWORD fvf, WINED3DVERTEXELEMENT **ppVertexElements) -{ - const struct wined3d_gl_info *gl_info = &This->adapter->gl_info; - BOOL has_pos = !!(fvf & WINED3DFVF_POSITION_MASK); - BOOL has_blend = (fvf & WINED3DFVF_XYZB5) > WINED3DFVF_XYZRHW; - BOOL has_blend_idx = has_blend && - (((fvf & WINED3DFVF_XYZB5) == WINED3DFVF_XYZB5) || - (fvf & WINED3DFVF_LASTBETA_D3DCOLOR) || - (fvf & WINED3DFVF_LASTBETA_UBYTE4)); - BOOL has_normal = !!(fvf & WINED3DFVF_NORMAL); - BOOL has_psize = !!(fvf & WINED3DFVF_PSIZE); - BOOL has_diffuse = !!(fvf & WINED3DFVF_DIFFUSE); - BOOL has_specular = !!(fvf & WINED3DFVF_SPECULAR); - - DWORD num_textures = (fvf & WINED3DFVF_TEXCOUNT_MASK) >> WINED3DFVF_TEXCOUNT_SHIFT; - DWORD texcoords = (fvf & 0xFFFF0000) >> 16; - struct wined3d_fvf_convert_state state; - unsigned int size; - unsigned int idx; - DWORD num_blends = 1 + (((fvf & WINED3DFVF_XYZB5) - WINED3DFVF_XYZB1) >> 1); - if (has_blend_idx) num_blends--; - - /* Compute declaration size */ - size = has_pos + (has_blend && num_blends > 0) + has_blend_idx + has_normal + - has_psize + has_diffuse + has_specular + num_textures; - - state.gl_info = gl_info; - state.elements = HeapAlloc(GetProcessHeap(), 0, size * sizeof(*state.elements)); - if (!state.elements) return ~0U; - state.offset = 0; - state.idx = 0; - - if (has_pos) - { - if (!has_blend && (fvf & WINED3DFVF_XYZRHW)) - append_decl_element(&state, WINED3DFMT_R32G32B32A32_FLOAT, WINED3DDECLUSAGE_POSITIONT, 0); - else if ((fvf & WINED3DFVF_XYZW) == WINED3DFVF_XYZW) - append_decl_element(&state, WINED3DFMT_R32G32B32A32_FLOAT, WINED3DDECLUSAGE_POSITION, 0); - else - append_decl_element(&state, WINED3DFMT_R32G32B32_FLOAT, WINED3DDECLUSAGE_POSITION, 0); - } - - if (has_blend && (num_blends > 0)) - { - if ((fvf & WINED3DFVF_XYZB5) == WINED3DFVF_XYZB2 && (fvf & WINED3DFVF_LASTBETA_D3DCOLOR)) - append_decl_element(&state, WINED3DFMT_B8G8R8A8_UNORM, WINED3DDECLUSAGE_BLENDWEIGHT, 0); - else - { - switch (num_blends) - { - case 1: - append_decl_element(&state, WINED3DFMT_R32_FLOAT, WINED3DDECLUSAGE_BLENDWEIGHT, 0); - break; - case 2: - append_decl_element(&state, WINED3DFMT_R32G32_FLOAT, WINED3DDECLUSAGE_BLENDWEIGHT, 0); - break; - case 3: - append_decl_element(&state, WINED3DFMT_R32G32B32_FLOAT, WINED3DDECLUSAGE_BLENDWEIGHT, 0); - break; - case 4: - append_decl_element(&state, WINED3DFMT_R32G32B32A32_FLOAT, WINED3DDECLUSAGE_BLENDWEIGHT, 0); - break; - default: - ERR("Unexpected amount of blend values: %u\n", num_blends); - } - } - } - - if (has_blend_idx) - { - if ((fvf & WINED3DFVF_LASTBETA_UBYTE4) - || ((fvf & WINED3DFVF_XYZB5) == WINED3DFVF_XYZB2 && (fvf & WINED3DFVF_LASTBETA_D3DCOLOR))) - append_decl_element(&state, WINED3DFMT_R8G8B8A8_UINT, WINED3DDECLUSAGE_BLENDINDICES, 0); - else if (fvf & WINED3DFVF_LASTBETA_D3DCOLOR) - append_decl_element(&state, WINED3DFMT_B8G8R8A8_UNORM, WINED3DDECLUSAGE_BLENDINDICES, 0); - else - append_decl_element(&state, WINED3DFMT_R32_FLOAT, WINED3DDECLUSAGE_BLENDINDICES, 0); - } - - if (has_normal) append_decl_element(&state, WINED3DFMT_R32G32B32_FLOAT, WINED3DDECLUSAGE_NORMAL, 0); - if (has_psize) append_decl_element(&state, WINED3DFMT_R32_FLOAT, WINED3DDECLUSAGE_PSIZE, 0); - if (has_diffuse) append_decl_element(&state, WINED3DFMT_B8G8R8A8_UNORM, WINED3DDECLUSAGE_COLOR, 0); - if (has_specular) append_decl_element(&state, WINED3DFMT_B8G8R8A8_UNORM, WINED3DDECLUSAGE_COLOR, 1); - - for (idx = 0; idx < num_textures; ++idx) - { - switch ((texcoords >> (idx * 2)) & 0x03) - { - case WINED3DFVF_TEXTUREFORMAT1: - append_decl_element(&state, WINED3DFMT_R32_FLOAT, WINED3DDECLUSAGE_TEXCOORD, idx); - break; - case WINED3DFVF_TEXTUREFORMAT2: - append_decl_element(&state, WINED3DFMT_R32G32_FLOAT, WINED3DDECLUSAGE_TEXCOORD, idx); - break; - case WINED3DFVF_TEXTUREFORMAT3: - append_decl_element(&state, WINED3DFMT_R32G32B32_FLOAT, WINED3DDECLUSAGE_TEXCOORD, idx); - break; - case WINED3DFVF_TEXTUREFORMAT4: - append_decl_element(&state, WINED3DFMT_R32G32B32A32_FLOAT, WINED3DDECLUSAGE_TEXCOORD, idx); - break; - } - } - - *ppVertexElements = state.elements; - return size; -} - -static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexDeclarationFromFVF(IWineD3DDevice *iface, - DWORD fvf, void *parent, const struct wined3d_parent_ops *parent_ops, - IWineD3DVertexDeclaration **declaration) -{ - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface; - WINED3DVERTEXELEMENT *elements; - unsigned int size; - DWORD hr; - - TRACE("iface %p, declaration %p, parent %p, fvf %#x.\n", iface, declaration, parent, fvf); - - size = ConvertFvfToDeclaration(This, fvf, &elements); - if (size == ~0U) return E_OUTOFMEMORY; - - hr = IWineD3DDeviceImpl_CreateVertexDeclaration(iface, elements, size, parent, parent_ops, declaration); - HeapFree(GetProcessHeap(), 0, elements); - return hr; -} - -static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexShader(IWineD3DDevice *iface, - const DWORD *pFunction, const struct wined3d_shader_signature *output_signature, - void *parent, const struct wined3d_parent_ops *parent_ops, - IWineD3DVertexShader **ppVertexShader) -{ - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - IWineD3DVertexShaderImpl *object; - HRESULT hr; - - if (This->vs_selected_mode == SHADER_NONE) - return WINED3DERR_INVALIDCALL; - - object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); - if (!object) - { - ERR("Failed to allocate shader memory.\n"); - return E_OUTOFMEMORY; - } - - hr = vertexshader_init(object, This, pFunction, output_signature, parent, parent_ops); - if (FAILED(hr)) - { - WARN("Failed to initialize vertex shader, hr %#x.\n", hr); - HeapFree(GetProcessHeap(), 0, object); - return hr; - } - - TRACE("Created vertex shader %p.\n", object); - *ppVertexShader = (IWineD3DVertexShader *)object; - - return WINED3D_OK; -} - -static HRESULT WINAPI IWineD3DDeviceImpl_CreateGeometryShader(IWineD3DDevice *iface, - const DWORD *byte_code, const struct wined3d_shader_signature *output_signature, - void *parent, const struct wined3d_parent_ops *parent_ops, - IWineD3DGeometryShader **shader) -{ - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - struct wined3d_geometryshader *object; - HRESULT hr; - - object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); - if (!object) - { - ERR("Failed to allocate shader memory.\n"); - return E_OUTOFMEMORY; - } - - hr = geometryshader_init(object, This, byte_code, output_signature, parent, parent_ops); - if (FAILED(hr)) - { - WARN("Failed to initialize geometry shader, hr %#x.\n", hr); - HeapFree(GetProcessHeap(), 0, object); - return hr; - } - - TRACE("Created geometry shader %p.\n", object); - *shader = (IWineD3DGeometryShader *)object; - - return WINED3D_OK; -} - -static HRESULT WINAPI IWineD3DDeviceImpl_CreatePixelShader(IWineD3DDevice *iface, - const DWORD *pFunction, const struct wined3d_shader_signature *output_signature, - void *parent, const struct wined3d_parent_ops *parent_ops, - IWineD3DPixelShader **ppPixelShader) -{ - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - IWineD3DPixelShaderImpl *object; - HRESULT hr; - - if (This->ps_selected_mode == SHADER_NONE) - return WINED3DERR_INVALIDCALL; - - object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); - if (!object) - { - ERR("Failed to allocate shader memory.\n"); - return E_OUTOFMEMORY; - } - - hr = pixelshader_init(object, This, pFunction, output_signature, parent, parent_ops); - if (FAILED(hr)) - { - WARN("Failed to initialize pixel shader, hr %#x.\n", hr); - HeapFree(GetProcessHeap(), 0, object); - return hr; - } - - TRACE("Created pixel shader %p.\n", object); - *ppPixelShader = (IWineD3DPixelShader *)object; - - return WINED3D_OK; -} - -static HRESULT WINAPI IWineD3DDeviceImpl_CreatePalette(IWineD3DDevice *iface, DWORD Flags, - const PALETTEENTRY *PalEnt, void *parent, IWineD3DPalette **Palette) -{ - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface; - IWineD3DPaletteImpl *object; - HRESULT hr; - - TRACE("iface %p, flags %#x, entries %p, palette %p, parent %p.\n", - iface, Flags, PalEnt, Palette, parent); - - object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); - if (!object) - { - ERR("Failed to allocate palette memory.\n"); - return E_OUTOFMEMORY; - } - - hr = wined3d_palette_init(object, This, Flags, PalEnt, parent); - if (FAILED(hr)) - { - WARN("Failed to initialize palette, hr %#x.\n", hr); - HeapFree(GetProcessHeap(), 0, object); - return hr; - } - - TRACE("Created palette %p.\n", object); - *Palette = (IWineD3DPalette *)object; - - return WINED3D_OK; -} - -static void IWineD3DDeviceImpl_LoadLogo(IWineD3DDeviceImpl *This, const char *filename) { HBITMAP hbm; BITMAP bm; HRESULT hr; @@ -1657,30 +936,31 @@ static void IWineD3DDeviceImpl_LoadLogo(IWineD3DDeviceImpl *This, const char *fi bm.bmHeight = 32; } - hr = IWineD3DDevice_CreateSurface((IWineD3DDevice *)This, bm.bmWidth, bm.bmHeight, WINED3DFMT_B5G6R5_UNORM, TRUE, + hr = wined3d_surface_create(device, bm.bmWidth, bm.bmHeight, WINED3DFMT_B5G6R5_UNORM, TRUE, FALSE, 0, 0, WINED3DPOOL_DEFAULT, WINED3DMULTISAMPLE_NONE, 0, SURFACE_OPENGL, NULL, - &wined3d_null_parent_ops, &This->logo_surface); + &wined3d_null_parent_ops, &device->logo_surface); if (FAILED(hr)) { ERR("Wine logo requested, but failed to create surface, hr %#x.\n", hr); goto out; } - if(dcb) { - hr = IWineD3DSurface_GetDC(This->logo_surface, &dcs); - if(FAILED(hr)) goto out; + if (dcb) + { + if (FAILED(hr = wined3d_surface_getdc(device->logo_surface, &dcs))) + goto out; BitBlt(dcs, 0, 0, bm.bmWidth, bm.bmHeight, dcb, 0, 0, SRCCOPY); - IWineD3DSurface_ReleaseDC(This->logo_surface, dcs); + wined3d_surface_releasedc(device->logo_surface, dcs); colorkey.dwColorSpaceLowValue = 0; colorkey.dwColorSpaceHighValue = 0; - IWineD3DSurface_SetColorKey(This->logo_surface, WINEDDCKEY_SRCBLT, &colorkey); + wined3d_surface_set_color_key(device->logo_surface, WINEDDCKEY_SRCBLT, &colorkey); } else { const WINED3DCOLORVALUE c = {1.0f, 1.0f, 1.0f, 1.0f}; /* Fill the surface with a white color to show that wined3d is there */ - IWineD3DDevice_ColorFill((IWineD3DDevice *)This, This->logo_surface, NULL, &c); + wined3d_device_color_fill(device, device->logo_surface, NULL, &c); } out: @@ -1689,9 +969,9 @@ out: } /* Context activation is done by the caller. */ -static void create_dummy_textures(IWineD3DDeviceImpl *This) +static void create_dummy_textures(struct wined3d_device *device) { - const struct wined3d_gl_info *gl_info = &This->adapter->gl_info; + const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; unsigned int i; /* Under DirectX you can have texture stage operations even if no texture is bound, whereas opengl will only do texture operations when a valid texture is @@ -1716,13 +996,13 @@ static void create_dummy_textures(IWineD3DDeviceImpl *This) checkGLcall("glActiveTextureARB"); /* Generate an opengl texture name */ - glGenTextures(1, &This->dummyTextureName[i]); + glGenTextures(1, &device->dummyTextureName[i]); checkGLcall("glGenTextures"); - TRACE("Dummy Texture %d given name %d\n", i, This->dummyTextureName[i]); + TRACE("Dummy Texture %d given name %d.\n", i, device->dummyTextureName[i]); /* Generate a dummy 2d texture (not using 1d because they cause many * DRI drivers fall back to sw) */ - glBindTexture(GL_TEXTURE_2D, This->dummyTextureName[i]); + glBindTexture(GL_TEXTURE_2D, device->dummyTextureName[i]); checkGLcall("glBindTexture"); glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, 1, 1, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, &white); @@ -1740,7 +1020,7 @@ static void create_dummy_textures(IWineD3DDeviceImpl *This) } /* Context activation is done by the caller. */ -static void destroy_dummy_textures(IWineD3DDeviceImpl *device, const struct wined3d_gl_info *gl_info) +static void destroy_dummy_textures(struct wined3d_device *device, const struct wined3d_gl_info *gl_info) { ENTER_GL(); glDeleteTextures(gl_info->limits.textures, device->dummyTextureName); @@ -1750,9 +1030,92 @@ static void destroy_dummy_textures(IWineD3DDeviceImpl *device, const struct wine memset(device->dummyTextureName, 0, gl_info->limits.textures * sizeof(*device->dummyTextureName)); } -static HRESULT WINAPI IWineD3DDeviceImpl_AcquireFocusWindow(IWineD3DDevice *iface, HWND window) +static LONG fullscreen_style(LONG style) { - IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface; + /* Make sure the window is managed, otherwise we won't get keyboard input. */ + style |= WS_POPUP | WS_SYSMENU; + style &= ~(WS_CAPTION | WS_THICKFRAME); + + return style; +} + +static LONG fullscreen_exstyle(LONG exstyle) +{ + /* Filter out window decorations. */ + exstyle &= ~(WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE); + + return exstyle; +} + +void CDECL wined3d_device_setup_fullscreen_window(struct wined3d_device *device, HWND window, UINT w, UINT h) +{ + BOOL filter_messages; + LONG style, exstyle; + + TRACE("Setting up window %p for fullscreen mode.\n", window); + + if (device->style || device->exStyle) + { + ERR("Changing the window style for window %p, but another style (%08x, %08x) is already stored.\n", + window, device->style, device->exStyle); + } + + device->style = GetWindowLongW(window, GWL_STYLE); + device->exStyle = GetWindowLongW(window, GWL_EXSTYLE); + + style = fullscreen_style(device->style); + exstyle = fullscreen_exstyle(device->exStyle); + + TRACE("Old style was %08x, %08x, setting to %08x, %08x.\n", + device->style, device->exStyle, style, exstyle); + + filter_messages = device->filter_messages; + device->filter_messages = TRUE; + + SetWindowLongW(window, GWL_STYLE, style); + SetWindowLongW(window, GWL_EXSTYLE, exstyle); + SetWindowPos(window, HWND_TOP, 0, 0, w, h, SWP_FRAMECHANGED | SWP_SHOWWINDOW | SWP_NOACTIVATE); + + device->filter_messages = filter_messages; +} + +void CDECL wined3d_device_restore_fullscreen_window(struct wined3d_device *device, HWND window) +{ + BOOL filter_messages; + LONG style, exstyle; + + if (!device->style && !device->exStyle) return; + + TRACE("Restoring window style of window %p to %08x, %08x.\n", + window, device->style, device->exStyle); + + style = GetWindowLongW(window, GWL_STYLE); + exstyle = GetWindowLongW(window, GWL_EXSTYLE); + + filter_messages = device->filter_messages; + device->filter_messages = TRUE; + + /* Only restore the style if the application didn't modify it during the + * fullscreen phase. Some applications change it before calling Reset() + * when switching between windowed and fullscreen modes (HL2), some + * depend on the original style (Eve Online). */ + if (style == fullscreen_style(device->style) && exstyle == fullscreen_exstyle(device->exStyle)) + { + SetWindowLongW(window, GWL_STYLE, device->style); + SetWindowLongW(window, GWL_EXSTYLE, device->exStyle); + } + SetWindowPos(window, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE); + + device->filter_messages = filter_messages; + + /* Delete the old values. */ + device->style = 0; + device->exStyle = 0; +} + +HRESULT CDECL wined3d_device_acquire_focus_window(struct wined3d_device *device, HWND window) +{ + TRACE("device %p, window %p.\n", device, window); if (!wined3d_register_window(window, device)) { @@ -1761,131 +1124,146 @@ static HRESULT WINAPI IWineD3DDeviceImpl_AcquireFocusWindow(IWineD3DDevice *ifac } device->focus_window = window; - SetForegroundWindow(window); + SetWindowPos(window, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); return WINED3D_OK; } -static void WINAPI IWineD3DDeviceImpl_ReleaseFocusWindow(IWineD3DDevice *iface) +void CDECL wined3d_device_release_focus_window(struct wined3d_device *device) { - IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface; + TRACE("device %p.\n", device); if (device->focus_window) wined3d_unregister_window(device->focus_window); device->focus_window = NULL; } -static HRESULT WINAPI IWineD3DDeviceImpl_Init3D(IWineD3DDevice *iface, - WINED3DPRESENT_PARAMETERS *pPresentationParameters) +HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device, + WINED3DPRESENT_PARAMETERS *present_parameters) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface; - const struct wined3d_gl_info *gl_info = &This->adapter->gl_info; - IWineD3DSwapChainImpl *swapchain = NULL; + const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; + struct wined3d_swapchain *swapchain = NULL; struct wined3d_context *context; HRESULT hr; DWORD state; unsigned int i; - TRACE("(%p)->(%p)\n", This, pPresentationParameters); + TRACE("device %p, present_parameters %p.\n", device, present_parameters); - if(This->d3d_initialized) return WINED3DERR_INVALIDCALL; - if(!This->adapter->opengl) return WINED3DERR_INVALIDCALL; + if (device->d3d_initialized) + return WINED3DERR_INVALIDCALL; + if (!device->adapter->opengl) + return WINED3DERR_INVALIDCALL; - TRACE("(%p) : Creating stateblock\n", This); - hr = IWineD3DDevice_CreateStateBlock(iface, WINED3DSBT_INIT, (IWineD3DStateBlock **)&This->stateBlock); + TRACE("Creating stateblock.\n"); + hr = wined3d_stateblock_create(device, WINED3DSBT_INIT, &device->stateBlock); if (FAILED(hr)) { WARN("Failed to create stateblock\n"); goto err_out; } - TRACE("(%p) : Created stateblock (%p)\n", This, This->stateBlock); - This->updateStateBlock = This->stateBlock; - IWineD3DStateBlock_AddRef((IWineD3DStateBlock*)This->updateStateBlock); - This->render_targets = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, - sizeof(*This->render_targets) * gl_info->limits.buffers); + TRACE("Created stateblock %p.\n", device->stateBlock); + device->updateStateBlock = device->stateBlock; + wined3d_stateblock_incref(device->updateStateBlock); - This->NumberOfPalettes = 1; - This->palettes = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(PALETTEENTRY*)); - if (!This->palettes || !This->render_targets) + device->valid_rt_mask = 0; + for (i = 0; i < gl_info->limits.buffers; ++i) + device->valid_rt_mask |= (1 << i); + device->fb.render_targets = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, + sizeof(*device->fb.render_targets) * gl_info->limits.buffers); + + device->palette_count = 1; + device->palettes = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(PALETTEENTRY*)); + if (!device->palettes || !device->fb.render_targets) { ERR("Out of memory!\n"); hr = E_OUTOFMEMORY; goto err_out; } - This->palettes[0] = HeapAlloc(GetProcessHeap(), 0, sizeof(PALETTEENTRY) * 256); - if(!This->palettes[0]) { + + device->palettes[0] = HeapAlloc(GetProcessHeap(), 0, sizeof(PALETTEENTRY) * 256); + if (!device->palettes[0]) + { ERR("Out of memory!\n"); hr = E_OUTOFMEMORY; goto err_out; } - for (i = 0; i < 256; ++i) { - This->palettes[0][i].peRed = 0xFF; - This->palettes[0][i].peGreen = 0xFF; - This->palettes[0][i].peBlue = 0xFF; - This->palettes[0][i].peFlags = 0xFF; + + for (i = 0; i < 256; ++i) + { + device->palettes[0][i].peRed = 0xff; + device->palettes[0][i].peGreen = 0xff; + device->palettes[0][i].peBlue = 0xff; + device->palettes[0][i].peFlags = 0xff; } - This->currentPalette = 0; + device->currentPalette = 0; /* Initialize the texture unit mapping to a 1:1 mapping */ for (state = 0; state < MAX_COMBINED_SAMPLERS; ++state) { if (state < gl_info->limits.fragment_samplers) { - This->texUnitMap[state] = state; - This->rev_tex_unit_map[state] = state; - } else { - This->texUnitMap[state] = WINED3D_UNMAPPED_STAGE; - This->rev_tex_unit_map[state] = WINED3D_UNMAPPED_STAGE; + device->texUnitMap[state] = state; + device->rev_tex_unit_map[state] = state; + } + else + { + device->texUnitMap[state] = WINED3D_UNMAPPED_STAGE; + device->rev_tex_unit_map[state] = WINED3D_UNMAPPED_STAGE; } } /* Setup the implicit swapchain. This also initializes a context. */ TRACE("Creating implicit swapchain\n"); - hr = IWineD3DDeviceParent_CreateSwapChain(This->device_parent, - pPresentationParameters, (IWineD3DSwapChain **)&swapchain); + hr = device->device_parent->ops->create_swapchain(device->device_parent, + present_parameters, &swapchain); if (FAILED(hr)) { WARN("Failed to create implicit swapchain\n"); goto err_out; } - This->NumberOfSwapChains = 1; - This->swapchains = HeapAlloc(GetProcessHeap(), 0, This->NumberOfSwapChains * sizeof(IWineD3DSwapChain *)); - if(!This->swapchains) { + device->swapchain_count = 1; + device->swapchains = HeapAlloc(GetProcessHeap(), 0, device->swapchain_count * sizeof(*device->swapchains)); + if (!device->swapchains) + { ERR("Out of memory!\n"); goto err_out; } - This->swapchains[0] = (IWineD3DSwapChain *) swapchain; + device->swapchains[0] = swapchain; if (swapchain->back_buffers && swapchain->back_buffers[0]) { TRACE("Setting rendertarget to %p.\n", swapchain->back_buffers); - This->render_targets[0] = swapchain->back_buffers[0]; + device->fb.render_targets[0] = swapchain->back_buffers[0]; } else { TRACE("Setting rendertarget to %p.\n", swapchain->front_buffer); - This->render_targets[0] = swapchain->front_buffer; + device->fb.render_targets[0] = swapchain->front_buffer; } - IWineD3DSurface_AddRef((IWineD3DSurface *)This->render_targets[0]); + wined3d_surface_incref(device->fb.render_targets[0]); /* Depth Stencil support */ - This->depth_stencil = This->auto_depth_stencil; - if (This->depth_stencil) - IWineD3DSurface_AddRef((IWineD3DSurface *)This->depth_stencil); + device->fb.depth_stencil = device->auto_depth_stencil; + if (device->fb.depth_stencil) + wined3d_surface_incref(device->fb.depth_stencil); - hr = This->shader_backend->shader_alloc_private(iface); - if(FAILED(hr)) { + hr = device->shader_backend->shader_alloc_private(device); + if (FAILED(hr)) + { TRACE("Shader private data couldn't be allocated\n"); goto err_out; } - hr = This->frag_pipe->alloc_private(iface); - if(FAILED(hr)) { + hr = device->frag_pipe->alloc_private(device); + if (FAILED(hr)) + { TRACE("Fragment pipeline private data couldn't be allocated\n"); goto err_out; } - hr = This->blitter->alloc_private(iface); - if(FAILED(hr)) { + hr = device->blitter->alloc_private(device); + if (FAILED(hr)) + { TRACE("Blitter private data couldn't be allocated\n"); goto err_out; } @@ -1893,23 +1271,22 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Init3D(IWineD3DDevice *iface, /* Set up some starting GL setup */ /* Setup all the devices defaults */ - stateblock_init_default_state(This->stateBlock); + stateblock_init_default_state(device->stateBlock); - context = context_acquire(This, swapchain->front_buffer); + context = context_acquire(device, swapchain->front_buffer); - create_dummy_textures(This); + create_dummy_textures(device); ENTER_GL(); /* Initialize the current view state */ - This->view_ident = 1; - This->contexts[0]->last_was_rhw = 0; - glGetIntegerv(GL_MAX_LIGHTS, &This->maxConcurrentLights); - checkGLcall("glGetIntegerv(GL_MAX_LIGHTS, &This->maxConcurrentLights)"); + device->view_ident = 1; + device->contexts[0]->last_was_rhw = 0; - switch(wined3d_settings.offscreen_rendering_mode) { + switch (wined3d_settings.offscreen_rendering_mode) + { case ORM_FBO: - This->offscreenBuffer = GL_COLOR_ATTACHMENT0; + device->offscreenBuffer = GL_COLOR_ATTACHMENT0; break; case ORM_BACKBUFFER: @@ -1917,265 +1294,272 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Init3D(IWineD3DDevice *iface, if (context_get_current()->aux_buffers > 0) { TRACE("Using auxilliary buffer for offscreen rendering\n"); - This->offscreenBuffer = GL_AUX0; - } else { + device->offscreenBuffer = GL_AUX0; + } + else + { TRACE("Using back buffer for offscreen rendering\n"); - This->offscreenBuffer = GL_BACK; + device->offscreenBuffer = GL_BACK; } } } - TRACE("(%p) All defaults now set up, leaving Init3D with %p\n", This, This); + TRACE("All defaults now set up, leaving 3D init.\n"); LEAVE_GL(); context_release(context); /* Clear the screen */ - IWineD3DDevice_Clear((IWineD3DDevice *) This, 0, NULL, - WINED3DCLEAR_TARGET | pPresentationParameters->EnableAutoDepthStencil ? WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL : 0, - 0x00, 1.0f, 0); + wined3d_device_clear(device, 0, NULL, WINED3DCLEAR_TARGET + | (present_parameters->EnableAutoDepthStencil ? WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL : 0), + 0x00, 1.0f, 0); - This->d3d_initialized = TRUE; + device->d3d_initialized = TRUE; - if(wined3d_settings.logo) { - IWineD3DDeviceImpl_LoadLogo(This, wined3d_settings.logo); - } - This->highest_dirty_ps_const = 0; - This->highest_dirty_vs_const = 0; + if (wined3d_settings.logo) + IWineD3DDeviceImpl_LoadLogo(device, wined3d_settings.logo); + device->highest_dirty_ps_const = 0; + device->highest_dirty_vs_const = 0; return WINED3D_OK; err_out: - HeapFree(GetProcessHeap(), 0, This->render_targets); - HeapFree(GetProcessHeap(), 0, This->swapchains); - This->NumberOfSwapChains = 0; - if(This->palettes) { - HeapFree(GetProcessHeap(), 0, This->palettes[0]); - HeapFree(GetProcessHeap(), 0, This->palettes); + HeapFree(GetProcessHeap(), 0, device->fb.render_targets); + HeapFree(GetProcessHeap(), 0, device->swapchains); + device->swapchain_count = 0; + if (device->palettes) + { + HeapFree(GetProcessHeap(), 0, device->palettes[0]); + HeapFree(GetProcessHeap(), 0, device->palettes); } - This->NumberOfPalettes = 0; - if(swapchain) { - IWineD3DSwapChain_Release( (IWineD3DSwapChain *) swapchain); - } - if(This->stateBlock) { - IWineD3DStateBlock_Release((IWineD3DStateBlock *) This->stateBlock); - This->stateBlock = NULL; - } - if (This->blit_priv) { - This->blitter->free_private(iface); - } - if (This->fragment_priv) { - This->frag_pipe->free_private(iface); - } - if (This->shader_priv) { - This->shader_backend->shader_free_private(iface); + device->palette_count = 0; + if (swapchain) + wined3d_swapchain_decref(swapchain); + if (device->stateBlock) + { + wined3d_stateblock_decref(device->stateBlock); + device->stateBlock = NULL; } + if (device->blit_priv) + device->blitter->free_private(device); + if (device->fragment_priv) + device->frag_pipe->free_private(device); + if (device->shader_priv) + device->shader_backend->shader_free_private(device); + return hr; } -static HRESULT WINAPI IWineD3DDeviceImpl_InitGDI(IWineD3DDevice *iface, - WINED3DPRESENT_PARAMETERS *pPresentationParameters) +HRESULT CDECL wined3d_device_init_gdi(struct wined3d_device *device, + WINED3DPRESENT_PARAMETERS *present_parameters) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface; - IWineD3DSwapChainImpl *swapchain = NULL; + struct wined3d_swapchain *swapchain = NULL; HRESULT hr; + TRACE("device %p, present_parameters %p.\n", device, present_parameters); + /* Setup the implicit swapchain */ TRACE("Creating implicit swapchain\n"); - hr = IWineD3DDeviceParent_CreateSwapChain(This->device_parent, - pPresentationParameters, (IWineD3DSwapChain **)&swapchain); + hr = device->device_parent->ops->create_swapchain(device->device_parent, + present_parameters, &swapchain); if (FAILED(hr)) { WARN("Failed to create implicit swapchain\n"); goto err_out; } - This->NumberOfSwapChains = 1; - This->swapchains = HeapAlloc(GetProcessHeap(), 0, This->NumberOfSwapChains * sizeof(IWineD3DSwapChain *)); - if(!This->swapchains) { + device->swapchain_count = 1; + device->swapchains = HeapAlloc(GetProcessHeap(), 0, device->swapchain_count * sizeof(*device->swapchains)); + if (!device->swapchains) + { ERR("Out of memory!\n"); goto err_out; } - This->swapchains[0] = (IWineD3DSwapChain *) swapchain; + device->swapchains[0] = swapchain; return WINED3D_OK; err_out: - IWineD3DSwapChain_Release((IWineD3DSwapChain *) swapchain); + wined3d_swapchain_decref(swapchain); return hr; } -static HRESULT WINAPI device_unload_resource(IWineD3DResource *resource, void *ctx) +static HRESULT WINAPI device_unload_resource(struct wined3d_resource *resource, void *data) { - IWineD3DResource_UnLoad(resource); - IWineD3DResource_Release(resource); - return WINED3D_OK; + TRACE("Unloading resource %p.\n", resource); + + resource->resource_ops->resource_unload(resource); + + return S_OK; } -static HRESULT WINAPI IWineD3DDeviceImpl_Uninit3D(IWineD3DDevice *iface, - D3DCB_DESTROYSWAPCHAINFN D3DCB_DestroySwapChain) +HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface; const struct wined3d_gl_info *gl_info; struct wined3d_context *context; - int sampler; + struct wined3d_surface *surface; UINT i; - TRACE("(%p)\n", This); - if(!This->d3d_initialized) return WINED3DERR_INVALIDCALL; + TRACE("device %p.\n", device); + if (!device->d3d_initialized) + return WINED3DERR_INVALIDCALL; + + /* Force making the context current again, to verify it is still valid + * (workaround for broken drivers) */ + context_set_current(NULL); /* I don't think that the interface guarantees that the device is destroyed from the same thread * it was created. Thus make sure a context is active for the glDelete* calls */ - context = context_acquire(This, NULL); + context = context_acquire(device, NULL); gl_info = context->gl_info; - if(This->logo_surface) IWineD3DSurface_Release(This->logo_surface); + if (device->logo_surface) + wined3d_surface_decref(device->logo_surface); /* Unload resources */ - IWineD3DDevice_EnumResources(iface, device_unload_resource, NULL); + wined3d_device_enum_resources(device, device_unload_resource, NULL); TRACE("Deleting high order patches\n"); for(i = 0; i < PATCHMAP_SIZE; i++) { struct list *e1, *e2; struct WineD3DRectPatch *patch; - LIST_FOR_EACH_SAFE(e1, e2, &This->patches[i]) { + LIST_FOR_EACH_SAFE(e1, e2, &device->patches[i]) + { patch = LIST_ENTRY(e1, struct WineD3DRectPatch, entry); - IWineD3DDevice_DeletePatch(iface, patch->Handle); + wined3d_device_delete_patch(device, patch->Handle); } } /* Delete the mouse cursor texture */ - if(This->cursorTexture) { + if (device->cursorTexture) + { ENTER_GL(); - glDeleteTextures(1, &This->cursorTexture); + glDeleteTextures(1, &device->cursorTexture); LEAVE_GL(); - This->cursorTexture = 0; - } - - for (sampler = 0; sampler < MAX_FRAGMENT_SAMPLERS; ++sampler) { - IWineD3DDevice_SetTexture(iface, sampler, NULL); - } - for (sampler = 0; sampler < MAX_VERTEX_SAMPLERS; ++sampler) { - IWineD3DDevice_SetTexture(iface, WINED3DVERTEXTEXTURESAMPLER0 + sampler, NULL); + device->cursorTexture = 0; } /* Destroy the depth blt resources, they will be invalid after the reset. Also free shader * private data, it might contain opengl pointers */ - if(This->depth_blt_texture) { + if (device->depth_blt_texture) + { ENTER_GL(); - glDeleteTextures(1, &This->depth_blt_texture); + glDeleteTextures(1, &device->depth_blt_texture); LEAVE_GL(); - This->depth_blt_texture = 0; + device->depth_blt_texture = 0; } - if (This->depth_blt_rb) { + if (device->depth_blt_rb) + { ENTER_GL(); - gl_info->fbo_ops.glDeleteRenderbuffers(1, &This->depth_blt_rb); + gl_info->fbo_ops.glDeleteRenderbuffers(1, &device->depth_blt_rb); LEAVE_GL(); - This->depth_blt_rb = 0; - This->depth_blt_rb_w = 0; - This->depth_blt_rb_h = 0; + device->depth_blt_rb = 0; + device->depth_blt_rb_w = 0; + device->depth_blt_rb_h = 0; } /* Release the update stateblock */ - if(IWineD3DStateBlock_Release((IWineD3DStateBlock *)This->updateStateBlock) > 0){ - if(This->updateStateBlock != This->stateBlock) - FIXME("(%p) Something's still holding the Update stateblock\n",This); + if (wined3d_stateblock_decref(device->updateStateBlock)) + { + if (device->updateStateBlock != device->stateBlock) + FIXME("Something's still holding the update stateblock.\n"); } - This->updateStateBlock = NULL; + device->updateStateBlock = NULL; - { /* because were not doing proper internal refcounts releasing the primary state block - causes recursion with the extra checks in ResourceReleased, to avoid this we have - to set this->stateBlock = NULL; first */ - IWineD3DStateBlock *stateBlock = (IWineD3DStateBlock *)This->stateBlock; - This->stateBlock = NULL; + { + struct wined3d_stateblock *stateblock = device->stateBlock; + device->stateBlock = NULL; /* Release the stateblock */ - if(IWineD3DStateBlock_Release(stateBlock) > 0){ - FIXME("(%p) Something's still holding the Update stateblock\n",This); - } + if (wined3d_stateblock_decref(stateblock)) + FIXME("Something's still holding the stateblock.\n"); } /* Destroy the shader backend. Note that this has to happen after all shaders are destroyed. */ - This->blitter->free_private(iface); - This->frag_pipe->free_private(iface); - This->shader_backend->shader_free_private(iface); + device->blitter->free_private(device); + device->frag_pipe->free_private(device); + device->shader_backend->shader_free_private(device); /* Release the buffers (with sanity checks)*/ - if (This->onscreen_depth_stencil) + if (device->onscreen_depth_stencil) { - IWineD3DSurface_Release((IWineD3DSurface *)This->onscreen_depth_stencil); - This->onscreen_depth_stencil = NULL; + surface = device->onscreen_depth_stencil; + device->onscreen_depth_stencil = NULL; + wined3d_surface_decref(surface); } - if (This->depth_stencil) + if (device->fb.depth_stencil) { - IWineD3DSurfaceImpl *ds = This->depth_stencil; + surface = device->fb.depth_stencil; - TRACE("Releasing depth/stencil buffer %p.\n", ds); + TRACE("Releasing depth/stencil buffer %p.\n", surface); - This->depth_stencil = NULL; - if (IWineD3DSurface_Release((IWineD3DSurface *)ds) - && ds != This->auto_depth_stencil) - { - ERR("Something is still holding a reference to depth/stencil buffer %p.\n", ds); - } + device->fb.depth_stencil = NULL; + if (wined3d_surface_decref(surface) + && surface != device->auto_depth_stencil) + ERR("Something is still holding a reference to depth/stencil buffer %p.\n", surface); } - TRACE("Releasing the render target at %p\n", This->render_targets[0]); - IWineD3DSurface_Release((IWineD3DSurface *)This->render_targets[0]); - - TRACE("Setting rendertarget to NULL\n"); - This->render_targets[0] = NULL; - - if (This->auto_depth_stencil) + if (device->auto_depth_stencil) { - if (IWineD3DSurface_Release((IWineD3DSurface *)This->auto_depth_stencil)) - { - FIXME("(%p) Something's still holding the auto depth stencil buffer\n", This); - } - This->auto_depth_stencil = NULL; + surface = device->auto_depth_stencil; + device->auto_depth_stencil = NULL; + if (wined3d_surface_decref(surface)) + FIXME("Something's still holding the auto depth stencil buffer (%p).\n", surface); } + for (i = 1; i < gl_info->limits.buffers; ++i) + { + wined3d_device_set_render_target(device, i, NULL, FALSE); + } + + surface = device->fb.render_targets[0]; + TRACE("Setting rendertarget 0 to NULL\n"); + device->fb.render_targets[0] = NULL; + TRACE("Releasing the render target at %p\n", surface); + wined3d_surface_decref(surface); + context_release(context); - for(i=0; i < This->NumberOfSwapChains; i++) { - TRACE("Releasing the implicit swapchain %d\n", i); - if (D3DCB_DestroySwapChain(This->swapchains[i]) > 0) { - FIXME("(%p) Something's still holding the implicit swapchain\n", This); - } + for (i = 0; i < device->swapchain_count; ++i) + { + TRACE("Releasing the implicit swapchain %u.\n", i); + if (wined3d_swapchain_decref(device->swapchains[i])) + FIXME("Something's still holding the implicit swapchain.\n"); } - HeapFree(GetProcessHeap(), 0, This->swapchains); - This->swapchains = NULL; - This->NumberOfSwapChains = 0; + HeapFree(GetProcessHeap(), 0, device->swapchains); + device->swapchains = NULL; + device->swapchain_count = 0; - for (i = 0; i < This->NumberOfPalettes; i++) HeapFree(GetProcessHeap(), 0, This->palettes[i]); - HeapFree(GetProcessHeap(), 0, This->palettes); - This->palettes = NULL; - This->NumberOfPalettes = 0; + for (i = 0; i < device->palette_count; ++i) + HeapFree(GetProcessHeap(), 0, device->palettes[i]); + HeapFree(GetProcessHeap(), 0, device->palettes); + device->palettes = NULL; + device->palette_count = 0; - HeapFree(GetProcessHeap(), 0, This->render_targets); - This->render_targets = NULL; + HeapFree(GetProcessHeap(), 0, device->fb.render_targets); + device->fb.render_targets = NULL; - This->d3d_initialized = FALSE; + device->d3d_initialized = FALSE; return WINED3D_OK; } -static HRESULT WINAPI IWineD3DDeviceImpl_UninitGDI(IWineD3DDevice *iface, D3DCB_DESTROYSWAPCHAINFN D3DCB_DestroySwapChain) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface; +HRESULT CDECL wined3d_device_uninit_gdi(struct wined3d_device *device) +{ unsigned int i; - for(i=0; i < This->NumberOfSwapChains; i++) { - TRACE("Releasing the implicit swapchain %d\n", i); - if (D3DCB_DestroySwapChain(This->swapchains[i]) > 0) { - FIXME("(%p) Something's still holding the implicit swapchain\n", This); - } + for (i = 0; i < device->swapchain_count; ++i) + { + TRACE("Releasing the implicit swapchain %u.\n", i); + if (wined3d_swapchain_decref(device->swapchains[i])) + FIXME("Something's still holding the implicit swapchain.\n"); } - HeapFree(GetProcessHeap(), 0, This->swapchains); - This->swapchains = NULL; - This->NumberOfSwapChains = 0; + HeapFree(GetProcessHeap(), 0, device->swapchains); + device->swapchains = NULL; + device->swapchain_count = 0; return WINED3D_OK; } @@ -2185,22 +1569,24 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UninitGDI(IWineD3DDevice *iface, D3DCB_ * * There is no way to deactivate thread safety once it is enabled. */ -static void WINAPI IWineD3DDeviceImpl_SetMultithreaded(IWineD3DDevice *iface) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface; +void CDECL wined3d_device_set_multithreaded(struct wined3d_device *device) +{ + TRACE("device %p.\n", device); - /*For now just store the flag(needed in case of ddraw) */ - This->createParms.BehaviorFlags |= WINED3DCREATE_MULTITHREADED; + /* For now just store the flag (needed in case of ddraw). */ + device->createParms.BehaviorFlags |= WINED3DCREATE_MULTITHREADED; } -static HRESULT WINAPI IWineD3DDeviceImpl_SetDisplayMode(IWineD3DDevice *iface, UINT iSwapChain, - const WINED3DDISPLAYMODE* pMode) { +HRESULT CDECL wined3d_device_set_display_mode(struct wined3d_device *device, + UINT swapchain_idx, const WINED3DDISPLAYMODE *mode) +{ + const struct wined3d_format *format = wined3d_get_format(&device->adapter->gl_info, mode->Format); DEVMODEW devmode; - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - const struct wined3d_format *format = wined3d_get_format(&This->adapter->gl_info, pMode->Format); LONG ret; RECT clip_rc; - TRACE("(%p)->(%d,%p) Mode=%dx%dx@%d, %s\n", This, iSwapChain, pMode, pMode->Width, pMode->Height, pMode->RefreshRate, debug_d3dformat(pMode->Format)); + TRACE("device %p, swapchain_idx %u, mode %p (%ux%u@%u %s).\n", device, swapchain_idx, mode, + mode->Width, mode->Height, mode->RefreshRate, debug_d3dformat(mode->Format)); /* Resize the screen even without a window: * The app could have unset it with SetCooperativeLevel, but not called @@ -2212,16 +1598,16 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetDisplayMode(IWineD3DDevice *iface, U devmode.dmSize = sizeof(devmode); devmode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT; devmode.dmBitsPerPel = format->byte_count * CHAR_BIT; - devmode.dmPelsWidth = pMode->Width; - devmode.dmPelsHeight = pMode->Height; + devmode.dmPelsWidth = mode->Width; + devmode.dmPelsHeight = mode->Height; - devmode.dmDisplayFrequency = pMode->RefreshRate; - if (pMode->RefreshRate) + devmode.dmDisplayFrequency = mode->RefreshRate; + if (mode->RefreshRate) devmode.dmFields |= DM_DISPLAYFREQUENCY; /* Only change the mode if necessary */ - if (This->ddraw_width == pMode->Width && This->ddraw_height == pMode->Height - && This->ddraw_format == pMode->Format && !pMode->RefreshRate) + if (device->ddraw_width == mode->Width && device->ddraw_height == mode->Height + && device->ddraw_format == mode->Format && !mode->RefreshRate) return WINED3D_OK; ret = ChangeDisplaySettingsExW(NULL, &devmode, NULL, CDS_FULLSCREEN, NULL); @@ -2240,310 +1626,296 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetDisplayMode(IWineD3DDevice *iface, U } /* Store the new values */ - This->ddraw_width = pMode->Width; - This->ddraw_height = pMode->Height; - This->ddraw_format = pMode->Format; + device->ddraw_width = mode->Width; + device->ddraw_height = mode->Height; + device->ddraw_format = mode->Format; /* And finally clip mouse to our screen */ - SetRect(&clip_rc, 0, 0, pMode->Width, pMode->Height); + SetRect(&clip_rc, 0, 0, mode->Width, mode->Height); ClipCursor(&clip_rc); return WINED3D_OK; } -static HRESULT WINAPI IWineD3DDeviceImpl_GetDirect3D(IWineD3DDevice *iface, IWineD3D **ppD3D) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - *ppD3D = This->wined3d; - TRACE("Returning %p.\n", *ppD3D); - IWineD3D_AddRef(*ppD3D); - return WINED3D_OK; -} - -static UINT WINAPI IWineD3DDeviceImpl_GetAvailableTextureMem(IWineD3DDevice *iface) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - - TRACE("(%p) : simulating %dMB, returning %dMB left\n", This, - (This->adapter->TextureRam/(1024*1024)), - ((This->adapter->TextureRam - This->adapter->UsedTextureRam) / (1024*1024))); - /* return simulated texture memory left */ - return (This->adapter->TextureRam - This->adapter->UsedTextureRam); -} - -/***** - * Get / Set Stream Source - *****/ -static HRESULT WINAPI IWineD3DDeviceImpl_SetStreamSource(IWineD3DDevice *iface, UINT StreamNumber, - IWineD3DBuffer *pStreamData, UINT OffsetInBytes, UINT Stride) +HRESULT CDECL wined3d_device_get_wined3d(struct wined3d_device *device, struct wined3d **wined3d) +{ + TRACE("device %p, wined3d %p.\n", device, wined3d); + + *wined3d = device->wined3d; + wined3d_incref(*wined3d); + + TRACE("Returning %p.\n", *wined3d); + + return WINED3D_OK; +} + +UINT CDECL wined3d_device_get_available_texture_mem(struct wined3d_device *device) +{ + TRACE("device %p.\n", device); + + TRACE("Emulating %d MB, returning %d MB left.\n", + device->adapter->TextureRam / (1024 * 1024), + (device->adapter->TextureRam - device->adapter->UsedTextureRam) / (1024 * 1024)); + + return device->adapter->TextureRam - device->adapter->UsedTextureRam; +} + +HRESULT CDECL wined3d_device_set_stream_source(struct wined3d_device *device, UINT stream_idx, + struct wined3d_buffer *buffer, UINT offset, UINT stride) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; struct wined3d_stream_state *stream; - IWineD3DBuffer *oldSrc; + struct wined3d_buffer *prev_buffer; - TRACE("iface %p, stream_idx %u, buffer %p, offset %u, stride %u.\n", - iface, StreamNumber, pStreamData, OffsetInBytes, Stride); + TRACE("device %p, stream_idx %u, buffer %p, offset %u, stride %u.\n", + device, stream_idx, buffer, offset, stride); - if (StreamNumber >= MAX_STREAMS) { - WARN("Stream out of range %d\n", StreamNumber); + if (stream_idx >= MAX_STREAMS) + { + WARN("Stream index %u out of range.\n", stream_idx); return WINED3DERR_INVALIDCALL; - } else if(OffsetInBytes & 0x3) { - WARN("OffsetInBytes is not 4 byte aligned: %d\n", OffsetInBytes); + } + else if (offset & 0x3) + { + WARN("Offset %u is not 4 byte aligned.\n", offset); return WINED3DERR_INVALIDCALL; } - stream = &This->updateStateBlock->state.streams[StreamNumber]; - oldSrc = (IWineD3DBuffer *)stream->buffer; + stream = &device->updateStateBlock->state.streams[stream_idx]; + prev_buffer = stream->buffer; - This->updateStateBlock->changed.streamSource |= 1 << StreamNumber; + device->updateStateBlock->changed.streamSource |= 1 << stream_idx; - if (oldSrc == pStreamData - && stream->stride == Stride - && stream->offset == OffsetInBytes) + if (prev_buffer == buffer + && stream->stride == stride + && stream->offset == offset) { - TRACE("Application is setting the old values over, nothing to do\n"); + TRACE("Application is setting the old values over, nothing to do.\n"); return WINED3D_OK; } - stream->buffer = (struct wined3d_buffer *)pStreamData; - if (pStreamData) + stream->buffer = buffer; + if (buffer) { - stream->stride = Stride; - stream->offset = OffsetInBytes; + stream->stride = stride; + stream->offset = offset; } - /* Handle recording of state blocks */ - if (This->isRecordingState) { - TRACE("Recording... not performing anything\n"); - if (pStreamData) IWineD3DBuffer_AddRef(pStreamData); - if (oldSrc) IWineD3DBuffer_Release(oldSrc); + /* Handle recording of state blocks. */ + if (device->isRecordingState) + { + TRACE("Recording... not performing anything.\n"); + if (buffer) + wined3d_buffer_incref(buffer); + if (prev_buffer) + wined3d_buffer_decref(prev_buffer); return WINED3D_OK; } - if (pStreamData) + if (buffer) { - InterlockedIncrement(&((struct wined3d_buffer *)pStreamData)->bind_count); - IWineD3DBuffer_AddRef(pStreamData); + InterlockedIncrement(&buffer->bind_count); + wined3d_buffer_incref(buffer); } - if (oldSrc) + if (prev_buffer) { - InterlockedDecrement(&((struct wined3d_buffer *)oldSrc)->bind_count); - IWineD3DBuffer_Release(oldSrc); + InterlockedDecrement(&prev_buffer->bind_count); + wined3d_buffer_decref(prev_buffer); } - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_STREAMSRC); + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_STREAMSRC); return WINED3D_OK; } -static HRESULT WINAPI IWineD3DDeviceImpl_GetStreamSource(IWineD3DDevice *iface, - UINT StreamNumber, IWineD3DBuffer **pStream, UINT *pOffset, UINT *pStride) +HRESULT CDECL wined3d_device_get_stream_source(struct wined3d_device *device, + UINT stream_idx, struct wined3d_buffer **buffer, UINT *offset, UINT *stride) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; struct wined3d_stream_state *stream; - TRACE("iface %p, stream_idx %u, buffer %p, offset %p, stride %p.\n", - iface, StreamNumber, pStream, pOffset, pStride); + TRACE("device %p, stream_idx %u, buffer %p, offset %p, stride %p.\n", + device, stream_idx, buffer, offset, stride); - if (StreamNumber >= MAX_STREAMS) + if (stream_idx >= MAX_STREAMS) { - WARN("Stream out of range %d\n", StreamNumber); + WARN("Stream index %u out of range.\n", stream_idx); return WINED3DERR_INVALIDCALL; } - stream = &This->stateBlock->state.streams[StreamNumber]; - *pStream = (IWineD3DBuffer *)stream->buffer; - *pStride = stream->stride; - if (pOffset) *pOffset = stream->offset; - - if (*pStream) IWineD3DBuffer_AddRef(*pStream); + stream = &device->stateBlock->state.streams[stream_idx]; + *buffer = stream->buffer; + if (*buffer) + wined3d_buffer_incref(*buffer); + if (offset) + *offset = stream->offset; + *stride = stream->stride; return WINED3D_OK; } -static HRESULT WINAPI IWineD3DDeviceImpl_SetStreamSourceFreq(IWineD3DDevice *iface, UINT StreamNumber, UINT Divider) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; +HRESULT CDECL wined3d_device_set_stream_source_freq(struct wined3d_device *device, UINT stream_idx, UINT divider) +{ struct wined3d_stream_state *stream; - UINT oldFlags, oldFreq; + UINT old_flags, old_freq; - TRACE("iface %p, stream_idx %u, divider %#x.\n", iface, StreamNumber, Divider); + TRACE("device %p, stream_idx %u, divider %#x.\n", device, stream_idx, divider); - /* Verify input at least in d3d9 this is invalid. */ - if ((Divider & WINED3DSTREAMSOURCE_INSTANCEDATA) && (Divider & WINED3DSTREAMSOURCE_INDEXEDDATA)) + /* Verify input. At least in d3d9 this is invalid. */ + if ((divider & WINED3DSTREAMSOURCE_INSTANCEDATA) && (divider & WINED3DSTREAMSOURCE_INDEXEDDATA)) { - WARN("INSTANCEDATA and INDEXEDDATA were set, returning D3DERR_INVALIDCALL\n"); + WARN("INSTANCEDATA and INDEXEDDATA were set, returning D3DERR_INVALIDCALL.\n"); return WINED3DERR_INVALIDCALL; } - if ((Divider & WINED3DSTREAMSOURCE_INSTANCEDATA) && !StreamNumber) + if ((divider & WINED3DSTREAMSOURCE_INSTANCEDATA) && !stream_idx) { - WARN("INSTANCEDATA used on stream 0, returning D3DERR_INVALIDCALL\n"); + WARN("INSTANCEDATA used on stream 0, returning D3DERR_INVALIDCALL.\n"); return WINED3DERR_INVALIDCALL; } - if (!Divider) + if (!divider) { - WARN("Divider is 0, returning D3DERR_INVALIDCALL\n"); + WARN("Divider is 0, returning D3DERR_INVALIDCALL.\n"); return WINED3DERR_INVALIDCALL; } - stream = &This->updateStateBlock->state.streams[StreamNumber]; - oldFlags = stream->flags; - oldFreq = stream->frequency; + stream = &device->updateStateBlock->state.streams[stream_idx]; + old_flags = stream->flags; + old_freq = stream->frequency; - stream->flags = Divider & (WINED3DSTREAMSOURCE_INSTANCEDATA | WINED3DSTREAMSOURCE_INDEXEDDATA); - stream->frequency = Divider & 0x7FFFFF; + stream->flags = divider & (WINED3DSTREAMSOURCE_INSTANCEDATA | WINED3DSTREAMSOURCE_INDEXEDDATA); + stream->frequency = divider & 0x7fffff; - This->updateStateBlock->changed.streamFreq |= 1 << StreamNumber; + device->updateStateBlock->changed.streamFreq |= 1 << stream_idx; - if (stream->frequency != oldFreq || stream->flags != oldFlags) - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_STREAMSRC); + if (stream->frequency != old_freq || stream->flags != old_flags) + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_STREAMSRC); return WINED3D_OK; } -static HRESULT WINAPI IWineD3DDeviceImpl_GetStreamSourceFreq(IWineD3DDevice *iface, UINT StreamNumber, UINT* Divider) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; +HRESULT CDECL wined3d_device_get_stream_source_freq(struct wined3d_device *device, UINT stream_idx, UINT *divider) +{ struct wined3d_stream_state *stream; - TRACE("iface %p, stream_idx %u, divider %p.\n", iface, StreamNumber, Divider); + TRACE("device %p, stream_idx %u, divider %p.\n", device, stream_idx, divider); - stream = &This->updateStateBlock->state.streams[StreamNumber]; - *Divider = stream->flags | stream->frequency; + stream = &device->updateStateBlock->state.streams[stream_idx]; + *divider = stream->flags | stream->frequency; - TRACE("Returning %#x.\n", *Divider); + TRACE("Returning %#x.\n", *divider); return WINED3D_OK; } -/***** - * Get / Set & Multiply Transform - *****/ -static HRESULT WINAPI IWineD3DDeviceImpl_SetTransform(IWineD3DDevice *iface, WINED3DTRANSFORMSTATETYPE d3dts, CONST WINED3DMATRIX* lpmatrix) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; +HRESULT CDECL wined3d_device_set_transform(struct wined3d_device *device, + WINED3DTRANSFORMSTATETYPE d3dts, const WINED3DMATRIX *matrix) +{ + TRACE("device %p, state %s, matrix %p.\n", + device, debug_d3dtstype(d3dts), matrix); - /* Most of this routine, comments included copied from ddraw tree initially: */ - TRACE("(%p) : Transform State=%s\n", This, debug_d3dtstype(d3dts)); - - /* Handle recording of state blocks */ - if (This->isRecordingState) { - TRACE("Recording... not performing anything\n"); - This->updateStateBlock->changed.transform[d3dts >> 5] |= 1 << (d3dts & 0x1f); - This->updateStateBlock->state.transforms[d3dts] = *lpmatrix; + /* Handle recording of state blocks. */ + if (device->isRecordingState) + { + TRACE("Recording... not performing anything.\n"); + device->updateStateBlock->changed.transform[d3dts >> 5] |= 1 << (d3dts & 0x1f); + device->updateStateBlock->state.transforms[d3dts] = *matrix; return WINED3D_OK; } - /* - * If the new matrix is the same as the current one, + /* If the new matrix is the same as the current one, * we cut off any further processing. this seems to be a reasonable * optimization because as was noticed, some apps (warcraft3 for example) * tend towards setting the same matrix repeatedly for some reason. * - * From here on we assume that the new matrix is different, wherever it matters. - */ - if (!memcmp(&This->stateBlock->state.transforms[d3dts].u.m[0][0], lpmatrix, sizeof(*lpmatrix))) + * From here on we assume that the new matrix is different, wherever it matters. */ + if (!memcmp(&device->stateBlock->state.transforms[d3dts].u.m[0][0], matrix, sizeof(*matrix))) { - TRACE("The app is setting the same matrix over again\n"); + TRACE("The application is setting the same matrix over again.\n"); return WINED3D_OK; } - else - { - conv_mat(lpmatrix, &This->stateBlock->state.transforms[d3dts].u.m[0][0]); - } - /* - ScreenCoord = ProjectionMat * ViewMat * WorldMat * ObjectCoord - where ViewMat = Camera space, WorldMat = world space. + conv_mat(matrix, &device->stateBlock->state.transforms[d3dts].u.m[0][0]); - In OpenGL, camera and world space is combined into GL_MODELVIEW - matrix. The Projection matrix stay projection matrix. - */ + /* ScreenCoord = ProjectionMat * ViewMat * WorldMat * ObjectCoord + * where ViewMat = Camera space, WorldMat = world space. + * + * In OpenGL, camera and world space is combined into GL_MODELVIEW + * matrix. The Projection matrix stay projection matrix. */ - /* Capture the times we can just ignore the change for now */ - if (d3dts == WINED3DTS_VIEW) { /* handle the VIEW matrix */ - This->view_ident = !memcmp(lpmatrix, identity, 16 * sizeof(float)); - /* Handled by the state manager */ - } + if (d3dts == WINED3DTS_VIEW) + device->view_ident = !memcmp(matrix, identity, 16 * sizeof(float)); - if (d3dts < WINED3DTS_WORLDMATRIX(This->adapter->gl_info.limits.blends)) - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_TRANSFORM(d3dts)); + if (d3dts < WINED3DTS_WORLDMATRIX(device->adapter->gl_info.limits.blends)) + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_TRANSFORM(d3dts)); return WINED3D_OK; } -static HRESULT WINAPI IWineD3DDeviceImpl_GetTransform(IWineD3DDevice *iface, +HRESULT CDECL wined3d_device_get_transform(struct wined3d_device *device, WINED3DTRANSFORMSTATETYPE state, WINED3DMATRIX *matrix) { - IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface; - - TRACE("iface %p, state %s, matrix %p.\n", iface, debug_d3dtstype(state), matrix); + TRACE("device %p, state %s, matrix %p.\n", device, debug_d3dtstype(state), matrix); *matrix = device->stateBlock->state.transforms[state]; return WINED3D_OK; } -static HRESULT WINAPI IWineD3DDeviceImpl_MultiplyTransform(IWineD3DDevice *iface, WINED3DTRANSFORMSTATETYPE State, CONST WINED3DMATRIX* pMatrix) { +HRESULT CDECL wined3d_device_multiply_transform(struct wined3d_device *device, + WINED3DTRANSFORMSTATETYPE state, const WINED3DMATRIX *matrix) +{ const WINED3DMATRIX *mat = NULL; WINED3DMATRIX temp; + TRACE("device %p, state %s, matrix %p.\n", device, debug_d3dtstype(state), matrix); + /* Note: Using 'updateStateBlock' rather than 'stateblock' in the code * below means it will be recorded in a state block change, but it * works regardless where it is recorded. - * If this is found to be wrong, change to StateBlock. - */ - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - TRACE("(%p) : For state %s\n", This, debug_d3dtstype(State)); + * If this is found to be wrong, change to StateBlock. */ - if (State <= HIGHEST_TRANSFORMSTATE) - { - mat = &This->updateStateBlock->state.transforms[State]; - } + if (state <= HIGHEST_TRANSFORMSTATE) + mat = &device->updateStateBlock->state.transforms[state]; else - { - FIXME("Unhandled transform state!!\n"); - } + FIXME("Unhandled transform state %#x.\n", state); - multiply_matrix(&temp, mat, pMatrix); + multiply_matrix(&temp, mat, matrix); - /* Apply change via set transform - will reapply to eg. lights this way */ - return IWineD3DDeviceImpl_SetTransform(iface, State, &temp); + /* Apply change via set transform - will reapply to eg. lights this way. */ + return wined3d_device_set_transform(device, state, &temp); } -/***** - * Get / Set Light - *****/ -/* Note lights are real special cases. Although the device caps state only eg. 8 are supported, - you can reference any indexes you want as long as that number max are enabled at any - one point in time! Therefore since the indexes can be anything, we need a hashmap of them. - However, this causes stateblock problems. When capturing the state block, I duplicate the hashmap, - but when recording, just build a chain pretty much of commands to be replayed. */ - -static HRESULT WINAPI IWineD3DDeviceImpl_SetLight(IWineD3DDevice *iface, DWORD Index, CONST WINED3DLIGHT* pLight) { - float rho; +/* Note lights are real special cases. Although the device caps state only + * e.g. 8 are supported, you can reference any indexes you want as long as + * that number max are enabled at any one point in time. Therefore since the + * indices can be anything, we need a hashmap of them. However, this causes + * stateblock problems. When capturing the state block, I duplicate the + * hashmap, but when recording, just build a chain pretty much of commands to + * be replayed. */ +HRESULT CDECL wined3d_device_set_light(struct wined3d_device *device, UINT light_idx, const WINED3DLIGHT *light) +{ + UINT hash_idx = LIGHTMAP_HASHFUNC(light_idx); struct wined3d_light_info *object = NULL; - UINT Hi = LIGHTMAP_HASHFUNC(Index); struct list *e; + float rho; - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - TRACE("(%p) : Idx(%d), pLight(%p). Hash index is %d\n", This, Index, pLight, Hi); + TRACE("device %p, light_idx %u, light %p.\n", device, light_idx, light); - /* Check the parameter range. Need for speed most wanted sets junk lights which confuse - * the gl driver. - */ - if(!pLight) { - WARN("Light pointer = NULL, returning WINED3DERR_INVALIDCALL\n"); + /* Check the parameter range. Need for speed most wanted sets junk lights + * which confuse the GL driver. */ + if (!light) return WINED3DERR_INVALIDCALL; - } - switch(pLight->Type) { + switch (light->Type) + { case WINED3DLIGHT_POINT: case WINED3DLIGHT_SPOT: case WINED3DLIGHT_PARALLELPOINT: case WINED3DLIGHT_GLSPOT: - /* Incorrect attenuation values can cause the gl driver to crash. Happens with Need for speed - * most wanted - */ - if (pLight->Attenuation0 < 0.0f || pLight->Attenuation1 < 0.0f || pLight->Attenuation2 < 0.0f) + /* Incorrect attenuation values can cause the gl driver to crash. + * Happens with Need for speed most wanted. */ + if (light->Attenuation0 < 0.0f || light->Attenuation1 < 0.0f || light->Attenuation2 < 0.0f) { - WARN("Attenuation is negative, returning WINED3DERR_INVALIDCALL\n"); + WARN("Attenuation is negative, returning WINED3DERR_INVALIDCALL.\n"); return WINED3DERR_INVALIDCALL; } break; @@ -2557,882 +1929,902 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetLight(IWineD3DDevice *iface, DWORD I return WINED3DERR_INVALIDCALL; } - LIST_FOR_EACH(e, &This->updateStateBlock->state.light_map[Hi]) + LIST_FOR_EACH(e, &device->updateStateBlock->state.light_map[hash_idx]) { object = LIST_ENTRY(e, struct wined3d_light_info, entry); - if(object->OriginalIndex == Index) break; + if (object->OriginalIndex == light_idx) + break; object = NULL; } - if(!object) { + if (!object) + { TRACE("Adding new light\n"); object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); - if(!object) { + if (!object) + { ERR("Out of memory error when allocating a light\n"); return E_OUTOFMEMORY; } - list_add_head(&This->updateStateBlock->state.light_map[Hi], &object->entry); + list_add_head(&device->updateStateBlock->state.light_map[hash_idx], &object->entry); object->glIndex = -1; - object->OriginalIndex = Index; + object->OriginalIndex = light_idx; } - /* Initialize the object */ - TRACE("Light %d setting to type %d, Diffuse(%f,%f,%f,%f), Specular(%f,%f,%f,%f), Ambient(%f,%f,%f,%f)\n", Index, pLight->Type, - pLight->Diffuse.r, pLight->Diffuse.g, pLight->Diffuse.b, pLight->Diffuse.a, - pLight->Specular.r, pLight->Specular.g, pLight->Specular.b, pLight->Specular.a, - pLight->Ambient.r, pLight->Ambient.g, pLight->Ambient.b, pLight->Ambient.a); - TRACE("... Pos(%f,%f,%f), Dirn(%f,%f,%f)\n", pLight->Position.x, pLight->Position.y, pLight->Position.z, - pLight->Direction.x, pLight->Direction.y, pLight->Direction.z); - TRACE("... Range(%f), Falloff(%f), Theta(%f), Phi(%f)\n", pLight->Range, pLight->Falloff, pLight->Theta, pLight->Phi); + /* Initialize the object. */ + TRACE("Light %d setting to type %d, Diffuse(%f,%f,%f,%f), Specular(%f,%f,%f,%f), Ambient(%f,%f,%f,%f)\n", + light_idx, light->Type, + light->Diffuse.r, light->Diffuse.g, light->Diffuse.b, light->Diffuse.a, + light->Specular.r, light->Specular.g, light->Specular.b, light->Specular.a, + light->Ambient.r, light->Ambient.g, light->Ambient.b, light->Ambient.a); + TRACE("... Pos(%f,%f,%f), Dir(%f,%f,%f)\n", light->Position.x, light->Position.y, light->Position.z, + light->Direction.x, light->Direction.y, light->Direction.z); + TRACE("... Range(%f), Falloff(%f), Theta(%f), Phi(%f)\n", + light->Range, light->Falloff, light->Theta, light->Phi); - /* Save away the information */ - object->OriginalParms = *pLight; + /* Save away the information. */ + object->OriginalParms = *light; - switch (pLight->Type) { - case WINED3DLIGHT_POINT: - /* Position */ - object->lightPosn[0] = pLight->Position.x; - object->lightPosn[1] = pLight->Position.y; - object->lightPosn[2] = pLight->Position.z; - object->lightPosn[3] = 1.0f; - object->cutoff = 180.0f; - /* FIXME: Range */ - break; + switch (light->Type) + { + case WINED3DLIGHT_POINT: + /* Position */ + object->lightPosn[0] = light->Position.x; + object->lightPosn[1] = light->Position.y; + object->lightPosn[2] = light->Position.z; + object->lightPosn[3] = 1.0f; + object->cutoff = 180.0f; + /* FIXME: Range */ + break; - case WINED3DLIGHT_DIRECTIONAL: - /* Direction */ - object->lightPosn[0] = -pLight->Direction.x; - object->lightPosn[1] = -pLight->Direction.y; - object->lightPosn[2] = -pLight->Direction.z; - object->lightPosn[3] = 0.0f; - object->exponent = 0.0f; - object->cutoff = 180.0f; - break; - - case WINED3DLIGHT_SPOT: - /* Position */ - object->lightPosn[0] = pLight->Position.x; - object->lightPosn[1] = pLight->Position.y; - object->lightPosn[2] = pLight->Position.z; - object->lightPosn[3] = 1.0f; - - /* Direction */ - object->lightDirn[0] = pLight->Direction.x; - object->lightDirn[1] = pLight->Direction.y; - object->lightDirn[2] = pLight->Direction.z; - object->lightDirn[3] = 1.0f; - - /* - * opengl-ish and d3d-ish spot lights use too different models for the - * light "intensity" as a function of the angle towards the main light direction, - * so we only can approximate very roughly. - * however spot lights are rather rarely used in games (if ever used at all). - * furthermore if still used, probably nobody pays attention to such details. - */ - if (!pLight->Falloff) - { - /* Falloff = 0 is easy, because d3d's and opengl's spot light equations have the - * falloff resp. exponent parameter as an exponent, so the spot light lighting - * will always be 1.0 for both of them, and we don't have to care for the - * rest of the rather complex calculation - */ + case WINED3DLIGHT_DIRECTIONAL: + /* Direction */ + object->lightPosn[0] = -light->Direction.x; + object->lightPosn[1] = -light->Direction.y; + object->lightPosn[2] = -light->Direction.z; + object->lightPosn[3] = 0.0f; object->exponent = 0.0f; - } else { - rho = pLight->Theta + (pLight->Phi - pLight->Theta)/(2*pLight->Falloff); - if (rho < 0.0001f) rho = 0.0001f; - object->exponent = -0.3f/logf(cosf(rho/2)); - } - if (object->exponent > 128.0f) - { - object->exponent = 128.0f; - } - object->cutoff = (float) (pLight->Phi*90/M_PI); + object->cutoff = 180.0f; + break; - /* FIXME: Range */ - break; + case WINED3DLIGHT_SPOT: + /* Position */ + object->lightPosn[0] = light->Position.x; + object->lightPosn[1] = light->Position.y; + object->lightPosn[2] = light->Position.z; + object->lightPosn[3] = 1.0f; - default: - FIXME("Unrecognized light type %d\n", pLight->Type); + /* Direction */ + object->lightDirn[0] = light->Direction.x; + object->lightDirn[1] = light->Direction.y; + object->lightDirn[2] = light->Direction.z; + object->lightDirn[3] = 1.0f; + + /* opengl-ish and d3d-ish spot lights use too different models + * for the light "intensity" as a function of the angle towards + * the main light direction, so we only can approximate very + * roughly. However, spot lights are rather rarely used in games + * (if ever used at all). Furthermore if still used, probably + * nobody pays attention to such details. */ + if (!light->Falloff) + { + /* Falloff = 0 is easy, because d3d's and opengl's spot light + * equations have the falloff resp. exponent parameter as an + * exponent, so the spot light lighting will always be 1.0 for + * both of them, and we don't have to care for the rest of the + * rather complex calculation. */ + object->exponent = 0.0f; + } + else + { + rho = light->Theta + (light->Phi - light->Theta) / (2 * light->Falloff); + if (rho < 0.0001f) + rho = 0.0001f; + object->exponent = -0.3f / logf(cosf(rho / 2)); + } + + if (object->exponent > 128.0f) + object->exponent = 128.0f; + + object->cutoff = (float)(light->Phi * 90 / M_PI); + /* FIXME: Range */ + break; + + default: + FIXME("Unrecognized light type %#x.\n", light->Type); } - /* Update the live definitions if the light is currently assigned a glIndex */ - if (object->glIndex != -1 && !This->isRecordingState) { - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_ACTIVELIGHT(object->glIndex)); - } + /* Update the live definitions if the light is currently assigned a glIndex. */ + if (object->glIndex != -1 && !device->isRecordingState) + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_ACTIVELIGHT(object->glIndex)); + return WINED3D_OK; } -static HRESULT WINAPI IWineD3DDeviceImpl_GetLight(IWineD3DDevice *iface, DWORD Index, WINED3DLIGHT *pLight) +HRESULT CDECL wined3d_device_get_light(struct wined3d_device *device, UINT light_idx, WINED3DLIGHT *light) { - struct wined3d_light_info *lightInfo = NULL; - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - DWORD Hi = LIGHTMAP_HASHFUNC(Index); + UINT hash_idx = LIGHTMAP_HASHFUNC(light_idx); + struct wined3d_light_info *light_info = NULL; struct list *e; - TRACE("(%p) : Idx(%d), pLight(%p)\n", This, Index, pLight); - LIST_FOR_EACH(e, &This->stateBlock->state.light_map[Hi]) + TRACE("device %p, light_idx %u, light %p.\n", device, light_idx, light); + + LIST_FOR_EACH(e, &device->stateBlock->state.light_map[hash_idx]) { - lightInfo = LIST_ENTRY(e, struct wined3d_light_info, entry); - if(lightInfo->OriginalIndex == Index) break; - lightInfo = NULL; + light_info = LIST_ENTRY(e, struct wined3d_light_info, entry); + if (light_info->OriginalIndex == light_idx) + break; + light_info = NULL; } - if (!lightInfo) + if (!light_info) { TRACE("Light information requested but light not defined\n"); return WINED3DERR_INVALIDCALL; } - *pLight = lightInfo->OriginalParms; + *light = light_info->OriginalParms; return WINED3D_OK; } -/***** - * Get / Set Light Enable - * (Note for consistency, renamed d3dx function by adding the 'set' prefix) - *****/ -static HRESULT WINAPI IWineD3DDeviceImpl_SetLightEnable(IWineD3DDevice *iface, DWORD Index, BOOL Enable) +HRESULT CDECL wined3d_device_set_light_enable(struct wined3d_device *device, UINT light_idx, BOOL enable) { - struct wined3d_light_info *lightInfo = NULL; - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - UINT Hi = LIGHTMAP_HASHFUNC(Index); + UINT hash_idx = LIGHTMAP_HASHFUNC(light_idx); + struct wined3d_light_info *light_info = NULL; struct list *e; - TRACE("(%p) : Idx(%d), enable? %d\n", This, Index, Enable); - LIST_FOR_EACH(e, &This->updateStateBlock->state.light_map[Hi]) + TRACE("device %p, light_idx %u, enable %#x.\n", device, light_idx, enable); + + LIST_FOR_EACH(e, &device->updateStateBlock->state.light_map[hash_idx]) { - lightInfo = LIST_ENTRY(e, struct wined3d_light_info, entry); - if(lightInfo->OriginalIndex == Index) break; - lightInfo = NULL; + light_info = LIST_ENTRY(e, struct wined3d_light_info, entry); + if (light_info->OriginalIndex == light_idx) + break; + light_info = NULL; } - TRACE("Found light: %p\n", lightInfo); + TRACE("Found light %p.\n", light_info); - /* Special case - enabling an undefined light creates one with a strict set of parms! */ - if (!lightInfo) + /* Special case - enabling an undefined light creates one with a strict set of parameters. */ + if (!light_info) { TRACE("Light enabled requested but light not defined, so defining one!\n"); - IWineD3DDeviceImpl_SetLight(iface, Index, &WINED3D_default_light); + wined3d_device_set_light(device, light_idx, &WINED3D_default_light); - /* Search for it again! Should be fairly quick as near head of list */ - LIST_FOR_EACH(e, &This->updateStateBlock->state.light_map[Hi]) + /* Search for it again! Should be fairly quick as near head of list. */ + LIST_FOR_EACH(e, &device->updateStateBlock->state.light_map[hash_idx]) { - lightInfo = LIST_ENTRY(e, struct wined3d_light_info, entry); - if(lightInfo->OriginalIndex == Index) break; - lightInfo = NULL; + light_info = LIST_ENTRY(e, struct wined3d_light_info, entry); + if (light_info->OriginalIndex == light_idx) + break; + light_info = NULL; } - if (!lightInfo) + if (!light_info) { FIXME("Adding default lights has failed dismally\n"); return WINED3DERR_INVALIDCALL; } } - if(!Enable) { - if(lightInfo->glIndex != -1) { - if(!This->isRecordingState) { - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_ACTIVELIGHT(lightInfo->glIndex)); - } + if (!enable) + { + if (light_info->glIndex != -1) + { + if (!device->isRecordingState) + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_ACTIVELIGHT(light_info->glIndex)); - This->updateStateBlock->state.lights[lightInfo->glIndex] = NULL; - lightInfo->glIndex = -1; - } else { + device->updateStateBlock->state.lights[light_info->glIndex] = NULL; + light_info->glIndex = -1; + } + else + { TRACE("Light already disabled, nothing to do\n"); } - lightInfo->enabled = FALSE; - } else { - lightInfo->enabled = TRUE; - if (lightInfo->glIndex != -1) { - /* nop */ + light_info->enabled = FALSE; + } + else + { + light_info->enabled = TRUE; + if (light_info->glIndex != -1) + { TRACE("Nothing to do as light was enabled\n"); - } else { - int i; - /* Find a free gl light */ - for (i = 0; i < This->maxConcurrentLights; ++i) + } + else + { + unsigned int i; + const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; + /* Find a free GL light. */ + for (i = 0; i < gl_info->limits.lights; ++i) { - if (!This->updateStateBlock->state.lights[i]) + if (!device->updateStateBlock->state.lights[i]) { - This->updateStateBlock->state.lights[i] = lightInfo; - lightInfo->glIndex = i; + device->updateStateBlock->state.lights[i] = light_info; + light_info->glIndex = i; break; } } - if(lightInfo->glIndex == -1) { + if (light_info->glIndex == -1) + { /* Our tests show that Windows returns D3D_OK in this situation, even with * D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_PUREDEVICE devices. This * is consistent among ddraw, d3d8 and d3d9. GetLightEnable returns TRUE * as well for those lights. * - * TODO: Test how this affects rendering - */ + * TODO: Test how this affects rendering. */ WARN("Too many concurrently active lights\n"); return WINED3D_OK; } - /* i == lightInfo->glIndex */ - if(!This->isRecordingState) { - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_ACTIVELIGHT(i)); - } + /* i == light_info->glIndex */ + if (!device->isRecordingState) + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_ACTIVELIGHT(i)); } } return WINED3D_OK; } -static HRESULT WINAPI IWineD3DDeviceImpl_GetLightEnable(IWineD3DDevice *iface, DWORD Index,BOOL* pEnable) +HRESULT CDECL wined3d_device_get_light_enable(struct wined3d_device *device, UINT light_idx, BOOL *enable) { - struct wined3d_light_info *lightInfo = NULL; - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; + UINT hash_idx = LIGHTMAP_HASHFUNC(light_idx); + struct wined3d_light_info *light_info = NULL; struct list *e; - UINT Hi = LIGHTMAP_HASHFUNC(Index); - TRACE("(%p) : for idx(%d)\n", This, Index); - LIST_FOR_EACH(e, &This->stateBlock->state.light_map[Hi]) + TRACE("device %p, light_idx %u, enable %p.\n", device, light_idx, enable); + + LIST_FOR_EACH(e, &device->stateBlock->state.light_map[hash_idx]) { - lightInfo = LIST_ENTRY(e, struct wined3d_light_info, entry); - if(lightInfo->OriginalIndex == Index) break; - lightInfo = NULL; + light_info = LIST_ENTRY(e, struct wined3d_light_info, entry); + if (light_info->OriginalIndex == light_idx) + break; + light_info = NULL; } - if (!lightInfo) + if (!light_info) { - TRACE("Light enabled state requested but light not defined\n"); + TRACE("Light enabled state requested but light not defined.\n"); return WINED3DERR_INVALIDCALL; } /* true is 128 according to SetLightEnable */ - *pEnable = lightInfo->enabled ? 128 : 0; + *enable = light_info->enabled ? 128 : 0; return WINED3D_OK; } -/***** - * Get / Set Clip Planes - *****/ -static HRESULT WINAPI IWineD3DDeviceImpl_SetClipPlane(IWineD3DDevice *iface, DWORD Index, CONST float *pPlane) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - TRACE("(%p) : for idx %d, %p\n", This, Index, pPlane); - - /* Validate Index */ - if (Index >= This->adapter->gl_info.limits.clipplanes) - { - TRACE("Application has requested clipplane this device doesn't support\n"); - return WINED3DERR_INVALIDCALL; - } - - This->updateStateBlock->changed.clipplane |= 1 << Index; - - if (This->updateStateBlock->state.clip_planes[Index][0] == pPlane[0] - && This->updateStateBlock->state.clip_planes[Index][1] == pPlane[1] - && This->updateStateBlock->state.clip_planes[Index][2] == pPlane[2] - && This->updateStateBlock->state.clip_planes[Index][3] == pPlane[3]) - { - TRACE("Application is setting old values over, nothing to do\n"); - return WINED3D_OK; - } - - This->updateStateBlock->state.clip_planes[Index][0] = pPlane[0]; - This->updateStateBlock->state.clip_planes[Index][1] = pPlane[1]; - This->updateStateBlock->state.clip_planes[Index][2] = pPlane[2]; - This->updateStateBlock->state.clip_planes[Index][3] = pPlane[3]; - - /* Handle recording of state blocks */ - if (This->isRecordingState) { - TRACE("Recording... not performing anything\n"); - return WINED3D_OK; - } - - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_CLIPPLANE(Index)); - - return WINED3D_OK; -} - -static HRESULT WINAPI IWineD3DDeviceImpl_GetClipPlane(IWineD3DDevice *iface, DWORD Index, float *pPlane) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - TRACE("(%p) : for idx %d\n", This, Index); - - /* Validate Index */ - if (Index >= This->adapter->gl_info.limits.clipplanes) - { - TRACE("Application has requested clipplane this device doesn't support\n"); - return WINED3DERR_INVALIDCALL; - } - - pPlane[0] = (float)This->stateBlock->state.clip_planes[Index][0]; - pPlane[1] = (float)This->stateBlock->state.clip_planes[Index][1]; - pPlane[2] = (float)This->stateBlock->state.clip_planes[Index][2]; - pPlane[3] = (float)This->stateBlock->state.clip_planes[Index][3]; - return WINED3D_OK; -} - -/***** - * Get / Set Clip Plane Status - * WARNING: This code relies on the fact that D3DCLIPSTATUS8 == D3DCLIPSTATUS9 - *****/ -static HRESULT WINAPI IWineD3DDeviceImpl_SetClipStatus(IWineD3DDevice *iface, CONST WINED3DCLIPSTATUS* pClipStatus) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - FIXME("(%p) : stub\n", This); - - if (!pClipStatus) - return WINED3DERR_INVALIDCALL; - - This->updateStateBlock->state.clip_status.ClipUnion = pClipStatus->ClipUnion; - This->updateStateBlock->state.clip_status.ClipIntersection = pClipStatus->ClipIntersection; - return WINED3D_OK; -} - -static HRESULT WINAPI IWineD3DDeviceImpl_GetClipStatus(IWineD3DDevice *iface, WINED3DCLIPSTATUS* pClipStatus) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - FIXME("(%p) : stub\n", This); - - if (!pClipStatus) - return WINED3DERR_INVALIDCALL; - - pClipStatus->ClipUnion = This->updateStateBlock->state.clip_status.ClipUnion; - pClipStatus->ClipIntersection = This->updateStateBlock->state.clip_status.ClipIntersection; - return WINED3D_OK; -} - -/***** - * Get / Set Material - *****/ -static HRESULT WINAPI IWineD3DDeviceImpl_SetMaterial(IWineD3DDevice *iface, CONST WINED3DMATERIAL* pMaterial) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - - This->updateStateBlock->changed.material = TRUE; - This->updateStateBlock->state.material = *pMaterial; - - /* Handle recording of state blocks */ - if (This->isRecordingState) { - TRACE("Recording... not performing anything\n"); - return WINED3D_OK; - } - - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_MATERIAL); - return WINED3D_OK; -} - -static HRESULT WINAPI IWineD3DDeviceImpl_GetMaterial(IWineD3DDevice *iface, WINED3DMATERIAL* pMaterial) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - *pMaterial = This->updateStateBlock->state.material; - TRACE("(%p) : Diffuse (%f,%f,%f,%f)\n", This, pMaterial->Diffuse.r, pMaterial->Diffuse.g, - pMaterial->Diffuse.b, pMaterial->Diffuse.a); - TRACE("(%p) : Ambient (%f,%f,%f,%f)\n", This, pMaterial->Ambient.r, pMaterial->Ambient.g, - pMaterial->Ambient.b, pMaterial->Ambient.a); - TRACE("(%p) : Specular (%f,%f,%f,%f)\n", This, pMaterial->Specular.r, pMaterial->Specular.g, - pMaterial->Specular.b, pMaterial->Specular.a); - TRACE("(%p) : Emissive (%f,%f,%f,%f)\n", This, pMaterial->Emissive.r, pMaterial->Emissive.g, - pMaterial->Emissive.b, pMaterial->Emissive.a); - TRACE("(%p) : Power (%f)\n", This, pMaterial->Power); - - return WINED3D_OK; -} - -/***** - * Get / Set Indices - *****/ -static HRESULT WINAPI IWineD3DDeviceImpl_SetIndexBuffer(IWineD3DDevice *iface, - IWineD3DBuffer *pIndexData, enum wined3d_format_id fmt) +HRESULT CDECL wined3d_device_set_clip_plane(struct wined3d_device *device, UINT plane_idx, const float *plane) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - IWineD3DBuffer *oldIdxs; + TRACE("device %p, plane_idx %u, plane %p.\n", device, plane_idx, plane); - TRACE("(%p) : Setting to %p\n", This, pIndexData); - oldIdxs = (IWineD3DBuffer *)This->updateStateBlock->state.index_buffer; + /* Validate plane_idx. */ + if (plane_idx >= device->adapter->gl_info.limits.clipplanes) + { + TRACE("Application has requested clipplane this device doesn't support.\n"); + return WINED3DERR_INVALIDCALL; + } - This->updateStateBlock->changed.indices = TRUE; - This->updateStateBlock->state.index_buffer = (struct wined3d_buffer *)pIndexData; - This->updateStateBlock->state.index_format = fmt; + device->updateStateBlock->changed.clipplane |= 1 << plane_idx; - /* Handle recording of state blocks */ - if (This->isRecordingState) { - TRACE("Recording... not performing anything\n"); - if(pIndexData) IWineD3DBuffer_AddRef(pIndexData); - if(oldIdxs) IWineD3DBuffer_Release(oldIdxs); + if (device->updateStateBlock->state.clip_planes[plane_idx][0] == plane[0] + && device->updateStateBlock->state.clip_planes[plane_idx][1] == plane[1] + && device->updateStateBlock->state.clip_planes[plane_idx][2] == plane[2] + && device->updateStateBlock->state.clip_planes[plane_idx][3] == plane[3]) + { + TRACE("Application is setting old values over, nothing to do.\n"); return WINED3D_OK; } - if(oldIdxs != pIndexData) { - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_INDEXBUFFER); - if(pIndexData) { - InterlockedIncrement(&((struct wined3d_buffer *)pIndexData)->bind_count); - IWineD3DBuffer_AddRef(pIndexData); + device->updateStateBlock->state.clip_planes[plane_idx][0] = plane[0]; + device->updateStateBlock->state.clip_planes[plane_idx][1] = plane[1]; + device->updateStateBlock->state.clip_planes[plane_idx][2] = plane[2]; + device->updateStateBlock->state.clip_planes[plane_idx][3] = plane[3]; + + /* Handle recording of state blocks. */ + if (device->isRecordingState) + { + TRACE("Recording... not performing anything.\n"); + return WINED3D_OK; + } + + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_CLIPPLANE(plane_idx)); + + return WINED3D_OK; +} + +HRESULT CDECL wined3d_device_get_clip_plane(struct wined3d_device *device, UINT plane_idx, float *plane) +{ + TRACE("device %p, plane_idx %u, plane %p.\n", device, plane_idx, plane); + + /* Validate plane_idx. */ + if (plane_idx >= device->adapter->gl_info.limits.clipplanes) + { + TRACE("Application has requested clipplane this device doesn't support.\n"); + return WINED3DERR_INVALIDCALL; + } + + plane[0] = (float)device->stateBlock->state.clip_planes[plane_idx][0]; + plane[1] = (float)device->stateBlock->state.clip_planes[plane_idx][1]; + plane[2] = (float)device->stateBlock->state.clip_planes[plane_idx][2]; + plane[3] = (float)device->stateBlock->state.clip_planes[plane_idx][3]; + + return WINED3D_OK; +} + +HRESULT CDECL wined3d_device_set_clip_status(struct wined3d_device *device, const WINED3DCLIPSTATUS *clip_status) +{ + FIXME("device %p, clip_status %p stub!\n", device, clip_status); + + if (!clip_status) + return WINED3DERR_INVALIDCALL; + + device->updateStateBlock->state.clip_status.ClipUnion = clip_status->ClipUnion; + device->updateStateBlock->state.clip_status.ClipIntersection = clip_status->ClipIntersection; + + return WINED3D_OK; +} + +HRESULT CDECL wined3d_device_get_clip_status(struct wined3d_device *device, WINED3DCLIPSTATUS *clip_status) +{ + FIXME("device %p, clip_status %p stub!\n", device, clip_status); + + if (!clip_status) + return WINED3DERR_INVALIDCALL; + + clip_status->ClipUnion = device->updateStateBlock->state.clip_status.ClipUnion; + clip_status->ClipIntersection = device->updateStateBlock->state.clip_status.ClipIntersection; + + return WINED3D_OK; +} + +HRESULT CDECL wined3d_device_set_material(struct wined3d_device *device, const WINED3DMATERIAL *material) +{ + TRACE("device %p, material %p.\n", device, material); + + device->updateStateBlock->changed.material = TRUE; + device->updateStateBlock->state.material = *material; + + /* Handle recording of state blocks */ + if (device->isRecordingState) + { + TRACE("Recording... not performing anything.\n"); + return WINED3D_OK; + } + + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_MATERIAL); + + return WINED3D_OK; +} + +HRESULT CDECL wined3d_device_get_material(struct wined3d_device *device, WINED3DMATERIAL *material) +{ + TRACE("device %p, material %p.\n", device, material); + + *material = device->updateStateBlock->state.material; + + TRACE("Diffuse {%.8e, %.8e, %.8e, %.8e}\n", + material->Diffuse.r, material->Diffuse.g, + material->Diffuse.b, material->Diffuse.a); + TRACE("Ambient {%.8e, %.8e, %.8e, %.8e}\n", + material->Ambient.r, material->Ambient.g, + material->Ambient.b, material->Ambient.a); + TRACE("Specular {%.8e, %.8e, %.8e, %.8e}\n", + material->Specular.r, material->Specular.g, + material->Specular.b, material->Specular.a); + TRACE("Emissive {%.8e, %.8e, %.8e, %.8e}\n", + material->Emissive.r, material->Emissive.g, + material->Emissive.b, material->Emissive.a); + TRACE("Power %.8e.\n", material->Power); + + return WINED3D_OK; +} + +HRESULT CDECL wined3d_device_set_index_buffer(struct wined3d_device *device, + struct wined3d_buffer *buffer, enum wined3d_format_id format_id) +{ + struct wined3d_buffer *prev_buffer; + + TRACE("device %p, buffer %p, format %s.\n", + device, buffer, debug_d3dformat(format_id)); + + prev_buffer = device->updateStateBlock->state.index_buffer; + + device->updateStateBlock->changed.indices = TRUE; + device->updateStateBlock->state.index_buffer = buffer; + device->updateStateBlock->state.index_format = format_id; + + /* Handle recording of state blocks. */ + if (device->isRecordingState) + { + TRACE("Recording... not performing anything.\n"); + if (buffer) + wined3d_buffer_incref(buffer); + if (prev_buffer) + wined3d_buffer_decref(prev_buffer); + return WINED3D_OK; + } + + if (prev_buffer != buffer) + { + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_INDEXBUFFER); + if (buffer) + { + InterlockedIncrement(&buffer->bind_count); + wined3d_buffer_incref(buffer); } - if(oldIdxs) { - InterlockedDecrement(&((struct wined3d_buffer *)oldIdxs)->bind_count); - IWineD3DBuffer_Release(oldIdxs); + if (prev_buffer) + { + InterlockedDecrement(&prev_buffer->bind_count); + wined3d_buffer_decref(prev_buffer); } } return WINED3D_OK; } -static HRESULT WINAPI IWineD3DDeviceImpl_GetIndexBuffer(IWineD3DDevice *iface, IWineD3DBuffer **ppIndexData) +HRESULT CDECL wined3d_device_get_index_buffer(struct wined3d_device *device, struct wined3d_buffer **buffer) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; + TRACE("device %p, buffer %p.\n", device, buffer); - *ppIndexData = (IWineD3DBuffer *)This->stateBlock->state.index_buffer; + *buffer = device->stateBlock->state.index_buffer; - /* up ref count on ppindexdata */ - if (*ppIndexData) { - IWineD3DBuffer_AddRef(*ppIndexData); - TRACE("(%p) index data set to %p\n", This, ppIndexData); - }else{ - TRACE("(%p) No index data set\n", This); - } - TRACE("Returning %p\n", *ppIndexData); + if (*buffer) + wined3d_buffer_incref(*buffer); + + TRACE("Returning %p.\n", *buffer); return WINED3D_OK; } /* Method to offer d3d9 a simple way to set the base vertex index without messing with the index buffer */ -static HRESULT WINAPI IWineD3DDeviceImpl_SetBaseVertexIndex(IWineD3DDevice *iface, INT BaseIndex) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - TRACE("(%p)->(%d)\n", This, BaseIndex); +HRESULT CDECL wined3d_device_set_base_vertex_index(struct wined3d_device *device, INT base_index) +{ + TRACE("device %p, base_index %d.\n", device, base_index); - if (This->updateStateBlock->state.base_vertex_index == BaseIndex) + if (device->updateStateBlock->state.base_vertex_index == base_index) { TRACE("Application is setting the old value over, nothing to do\n"); return WINED3D_OK; } - This->updateStateBlock->state.base_vertex_index = BaseIndex; + device->updateStateBlock->state.base_vertex_index = base_index; - if (This->isRecordingState) { + if (device->isRecordingState) + { TRACE("Recording... not performing anything\n"); return WINED3D_OK; } + /* The base vertex index affects the stream sources */ - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_STREAMSRC); - return WINED3D_OK; -} - -static HRESULT WINAPI IWineD3DDeviceImpl_GetBaseVertexIndex(IWineD3DDevice *iface, INT* base_index) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - TRACE("(%p) : base_index %p\n", This, base_index); - - *base_index = This->stateBlock->state.base_vertex_index; - - TRACE("Returning %u\n", *base_index); + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_STREAMSRC); return WINED3D_OK; } -/***** - * Get / Set Viewports - *****/ -static HRESULT WINAPI IWineD3DDeviceImpl_SetViewport(IWineD3DDevice *iface, CONST WINED3DVIEWPORT* pViewport) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; +INT CDECL wined3d_device_get_base_vertex_index(struct wined3d_device *device) +{ + TRACE("device %p.\n", device); - TRACE("(%p)\n", This); - This->updateStateBlock->changed.viewport = TRUE; - This->updateStateBlock->state.viewport = *pViewport; + return device->stateBlock->state.base_vertex_index; +} + +HRESULT CDECL wined3d_device_set_viewport(struct wined3d_device *device, const WINED3DVIEWPORT *viewport) +{ + TRACE("device %p, viewport %p.\n", device, viewport); + TRACE("x %u, y %u, w %u, h %u, minz %.8e, maxz %.8e.\n", + viewport->X, viewport->Y, viewport->Width, viewport->Height, viewport->MinZ, viewport->MaxZ); + + device->updateStateBlock->changed.viewport = TRUE; + device->updateStateBlock->state.viewport = *viewport; /* Handle recording of state blocks */ - if (This->isRecordingState) { - TRACE("Recording... not performing anything\n"); - return WINED3D_OK; - } - - TRACE("(%p) : x=%d, y=%d, wid=%d, hei=%d, minz=%f, maxz=%f\n", This, - pViewport->X, pViewport->Y, pViewport->Width, pViewport->Height, pViewport->MinZ, pViewport->MaxZ); - - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VIEWPORT); - return WINED3D_OK; - -} - -static HRESULT WINAPI IWineD3DDeviceImpl_GetViewport(IWineD3DDevice *iface, WINED3DVIEWPORT* pViewport) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - TRACE("(%p)\n", This); - *pViewport = This->stateBlock->state.viewport; - return WINED3D_OK; -} - -static HRESULT WINAPI IWineD3DDeviceImpl_SetRenderState(IWineD3DDevice *iface, - WINED3DRENDERSTATETYPE State, DWORD Value) -{ - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - DWORD oldValue = This->stateBlock->state.render_states[State]; - - TRACE("iface %p, state %s (%#x), value %#x.\n", iface, debug_d3drenderstate(State), State, Value); - - This->updateStateBlock->changed.renderState[State >> 5] |= 1 << (State & 0x1f); - This->updateStateBlock->state.render_states[State] = Value; - - /* Handle recording of state blocks */ - if (This->isRecordingState) { - TRACE("Recording... not performing anything\n"); - return WINED3D_OK; - } - - /* Compared here and not before the assignment to allow proper stateblock recording */ - if(Value == oldValue) { - TRACE("Application is setting the old value over, nothing to do\n"); - } else { - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_RENDER(State)); - } - - return WINED3D_OK; -} - -static HRESULT WINAPI IWineD3DDeviceImpl_GetRenderState(IWineD3DDevice *iface, - WINED3DRENDERSTATETYPE State, DWORD *pValue) -{ - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - - TRACE("iface %p, state %s (%#x), value %p.\n", iface, debug_d3drenderstate(State), State, pValue); - - *pValue = This->stateBlock->state.render_states[State]; - return WINED3D_OK; -} - -/***** - * Get / Set Sampler States - * TODO: Verify against dx9 definitions - *****/ - -static HRESULT WINAPI IWineD3DDeviceImpl_SetSamplerState(IWineD3DDevice *iface, DWORD Sampler, WINED3DSAMPLERSTATETYPE Type, DWORD Value) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - DWORD oldValue; - - TRACE("(%p) : Sampler %#x, Type %s (%#x), Value %#x\n", - This, Sampler, debug_d3dsamplerstate(Type), Type, Value); - - if (Sampler >= WINED3DVERTEXTEXTURESAMPLER0 && Sampler <= WINED3DVERTEXTEXTURESAMPLER3) { - Sampler -= (WINED3DVERTEXTEXTURESAMPLER0 - MAX_FRAGMENT_SAMPLERS); - } - - if (Sampler >= sizeof(This->stateBlock->state.sampler_states) / sizeof(*This->stateBlock->state.sampler_states)) + if (device->isRecordingState) { - ERR("Current Sampler overflows sampleState0 array (sampler %d)\n", Sampler); + TRACE("Recording... not performing anything\n"); + return WINED3D_OK; + } + + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_VIEWPORT); + + return WINED3D_OK; +} + +HRESULT CDECL wined3d_device_get_viewport(struct wined3d_device *device, WINED3DVIEWPORT *viewport) +{ + TRACE("device %p, viewport %p.\n", device, viewport); + + *viewport = device->stateBlock->state.viewport; + + return WINED3D_OK; +} + +HRESULT CDECL wined3d_device_set_render_state(struct wined3d_device *device, + WINED3DRENDERSTATETYPE state, DWORD value) +{ + DWORD old_value = device->stateBlock->state.render_states[state]; + + TRACE("device %p, state %s (%#x), value %#x.\n", device, debug_d3drenderstate(state), state, value); + + device->updateStateBlock->changed.renderState[state >> 5] |= 1 << (state & 0x1f); + device->updateStateBlock->state.render_states[state] = value; + + /* Handle recording of state blocks. */ + if (device->isRecordingState) + { + TRACE("Recording... not performing anything.\n"); + return WINED3D_OK; + } + + /* Compared here and not before the assignment to allow proper stateblock recording. */ + if (value == old_value) + TRACE("Application is setting the old value over, nothing to do.\n"); + else + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_RENDER(state)); + + return WINED3D_OK; +} + +HRESULT CDECL wined3d_device_get_render_state(struct wined3d_device *device, + WINED3DRENDERSTATETYPE state, DWORD *value) +{ + TRACE("device %p, state %s (%#x), value %p.\n", device, debug_d3drenderstate(state), state, value); + + *value = device->stateBlock->state.render_states[state]; + + return WINED3D_OK; +} + +HRESULT CDECL wined3d_device_set_sampler_state(struct wined3d_device *device, + UINT sampler_idx, WINED3DSAMPLERSTATETYPE state, DWORD value) +{ + DWORD old_value; + + TRACE("device %p, sampler_idx %u, state %s, value %#x.\n", + device, sampler_idx, debug_d3dsamplerstate(state), value); + + if (sampler_idx >= WINED3DVERTEXTEXTURESAMPLER0 && sampler_idx <= WINED3DVERTEXTEXTURESAMPLER3) + sampler_idx -= (WINED3DVERTEXTEXTURESAMPLER0 - MAX_FRAGMENT_SAMPLERS); + + if (sampler_idx >= sizeof(device->stateBlock->state.sampler_states) + / sizeof(*device->stateBlock->state.sampler_states)) + { + WARN("Invalid sampler %u.\n", sampler_idx); return WINED3D_OK; /* Windows accepts overflowing this array ... we do not. */ } - oldValue = This->stateBlock->state.sampler_states[Sampler][Type]; - This->updateStateBlock->state.sampler_states[Sampler][Type] = Value; - This->updateStateBlock->changed.samplerState[Sampler] |= 1 << Type; + old_value = device->stateBlock->state.sampler_states[sampler_idx][state]; + device->updateStateBlock->state.sampler_states[sampler_idx][state] = value; + device->updateStateBlock->changed.samplerState[sampler_idx] |= 1 << state; - /* Handle recording of state blocks */ - if (This->isRecordingState) { - TRACE("Recording... not performing anything\n"); + /* Handle recording of state blocks. */ + if (device->isRecordingState) + { + TRACE("Recording... not performing anything.\n"); return WINED3D_OK; } - if(oldValue == Value) { - TRACE("Application is setting the old value over, nothing to do\n"); + if (old_value == value) + { + TRACE("Application is setting the old value over, nothing to do.\n"); return WINED3D_OK; } - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_SAMPLER(Sampler)); + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_SAMPLER(sampler_idx)); return WINED3D_OK; } -static HRESULT WINAPI IWineD3DDeviceImpl_GetSamplerState(IWineD3DDevice *iface, DWORD Sampler, WINED3DSAMPLERSTATETYPE Type, DWORD* Value) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; +HRESULT CDECL wined3d_device_get_sampler_state(struct wined3d_device *device, + UINT sampler_idx, WINED3DSAMPLERSTATETYPE state, DWORD *value) +{ + TRACE("device %p, sampler_idx %u, state %s, value %p.\n", + device, sampler_idx, debug_d3dsamplerstate(state), value); - TRACE("(%p) : Sampler %#x, Type %s (%#x)\n", - This, Sampler, debug_d3dsamplerstate(Type), Type); + if (sampler_idx >= WINED3DVERTEXTEXTURESAMPLER0 && sampler_idx <= WINED3DVERTEXTEXTURESAMPLER3) + sampler_idx -= (WINED3DVERTEXTEXTURESAMPLER0 - MAX_FRAGMENT_SAMPLERS); - if (Sampler >= WINED3DVERTEXTEXTURESAMPLER0 && Sampler <= WINED3DVERTEXTEXTURESAMPLER3) { - Sampler -= (WINED3DVERTEXTEXTURESAMPLER0 - MAX_FRAGMENT_SAMPLERS); - } - - if (Sampler >= sizeof(This->stateBlock->state.sampler_states) / sizeof(*This->stateBlock->state.sampler_states)) + if (sampler_idx >= sizeof(device->stateBlock->state.sampler_states) + / sizeof(*device->stateBlock->state.sampler_states)) { - ERR("Current Sampler overflows sampleState0 array (sampler %d)\n", Sampler); + WARN("Invalid sampler %u.\n", sampler_idx); return WINED3D_OK; /* Windows accepts overflowing this array ... we do not. */ } - *Value = This->stateBlock->state.sampler_states[Sampler][Type]; - TRACE("(%p) : Returning %#x\n", This, *Value); + + *value = device->stateBlock->state.sampler_states[sampler_idx][state]; + TRACE("Returning %#x.\n", *value); return WINED3D_OK; } -static HRESULT WINAPI IWineD3DDeviceImpl_SetScissorRect(IWineD3DDevice *iface, CONST RECT* pRect) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; +HRESULT CDECL wined3d_device_set_scissor_rect(struct wined3d_device *device, const RECT *rect) +{ + TRACE("device %p, rect %s.\n", device, wine_dbgstr_rect(rect)); - This->updateStateBlock->changed.scissorRect = TRUE; - if (EqualRect(&This->updateStateBlock->state.scissor_rect, pRect)) + device->updateStateBlock->changed.scissorRect = TRUE; + if (EqualRect(&device->updateStateBlock->state.scissor_rect, rect)) { TRACE("App is setting the old scissor rectangle over, nothing to do.\n"); return WINED3D_OK; } - CopyRect(&This->updateStateBlock->state.scissor_rect, pRect); + CopyRect(&device->updateStateBlock->state.scissor_rect, rect); - if(This->isRecordingState) { - TRACE("Recording... not performing anything\n"); + if (device->isRecordingState) + { + TRACE("Recording... not performing anything.\n"); return WINED3D_OK; } - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_SCISSORRECT); + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_SCISSORRECT); return WINED3D_OK; } -static HRESULT WINAPI IWineD3DDeviceImpl_GetScissorRect(IWineD3DDevice *iface, RECT* pRect) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - - *pRect = This->updateStateBlock->state.scissor_rect; - TRACE("(%p)Returning a Scissor Rect of %d:%d-%d:%d\n", This, pRect->left, pRect->top, pRect->right, pRect->bottom); - return WINED3D_OK; -} - -static HRESULT WINAPI IWineD3DDeviceImpl_SetVertexDeclaration(IWineD3DDevice* iface, IWineD3DVertexDeclaration* pDecl) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface; - IWineD3DVertexDeclaration *oldDecl = (IWineD3DVertexDeclaration *)This->updateStateBlock->state.vertex_declaration; - - TRACE("(%p) : pDecl=%p\n", This, pDecl); - - if (pDecl) IWineD3DVertexDeclaration_AddRef(pDecl); - if (oldDecl) IWineD3DVertexDeclaration_Release(oldDecl); - - This->updateStateBlock->state.vertex_declaration = (IWineD3DVertexDeclarationImpl *)pDecl; - This->updateStateBlock->changed.vertexDecl = TRUE; - - if (This->isRecordingState) { - TRACE("Recording... not performing anything\n"); - return WINED3D_OK; - } else if(pDecl == oldDecl) { - /* Checked after the assignment to allow proper stateblock recording */ - TRACE("Application is setting the old declaration over, nothing to do\n"); - return WINED3D_OK; - } - - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VDECL); - return WINED3D_OK; -} - -static HRESULT WINAPI IWineD3DDeviceImpl_GetVertexDeclaration(IWineD3DDevice* iface, IWineD3DVertexDeclaration** ppDecl) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - - TRACE("(%p) : ppDecl=%p\n", This, ppDecl); - - *ppDecl = (IWineD3DVertexDeclaration *)This->stateBlock->state.vertex_declaration; - if (*ppDecl) IWineD3DVertexDeclaration_AddRef(*ppDecl); - return WINED3D_OK; -} - -static HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShader(IWineD3DDevice *iface, IWineD3DVertexShader *pShader) +HRESULT CDECL wined3d_device_get_scissor_rect(struct wined3d_device *device, RECT *rect) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - IWineD3DVertexShader *oldShader = (IWineD3DVertexShader *)This->updateStateBlock->state.vertex_shader; + TRACE("device %p, rect %p.\n", device, rect); - This->updateStateBlock->state.vertex_shader = (IWineD3DVertexShaderImpl *)pShader; - This->updateStateBlock->changed.vertexShader = TRUE; - - if (This->isRecordingState) { - if(pShader) IWineD3DVertexShader_AddRef(pShader); - if(oldShader) IWineD3DVertexShader_Release(oldShader); - TRACE("Recording... not performing anything\n"); - return WINED3D_OK; - } else if(oldShader == pShader) { - /* Checked here to allow proper stateblock recording */ - TRACE("App is setting the old shader over, nothing to do\n"); - return WINED3D_OK; - } - - TRACE("(%p) : setting pShader(%p)\n", This, pShader); - if(pShader) IWineD3DVertexShader_AddRef(pShader); - if(oldShader) IWineD3DVertexShader_Release(oldShader); - - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VSHADER); + *rect = device->updateStateBlock->state.scissor_rect; + TRACE("Returning rect %s.\n", wine_dbgstr_rect(rect)); return WINED3D_OK; } -static IWineD3DVertexShader * WINAPI IWineD3DDeviceImpl_GetVertexShader(IWineD3DDevice *iface) +HRESULT CDECL wined3d_device_set_vertex_declaration(struct wined3d_device *device, + struct wined3d_vertex_declaration *declaration) { - IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface; - IWineD3DVertexShader *shader; + struct wined3d_vertex_declaration *prev = device->updateStateBlock->state.vertex_declaration; - TRACE("iface %p.\n", iface); + TRACE("device %p, declaration %p.\n", device, declaration); - shader = (IWineD3DVertexShader *)device->stateBlock->state.vertex_shader; - if (shader) IWineD3DVertexShader_AddRef(shader); + if (declaration) + wined3d_vertex_declaration_incref(declaration); + if (prev) + wined3d_vertex_declaration_decref(prev); + + device->updateStateBlock->state.vertex_declaration = declaration; + device->updateStateBlock->changed.vertexDecl = TRUE; + + if (device->isRecordingState) + { + TRACE("Recording... not performing anything.\n"); + return WINED3D_OK; + } + else if (declaration == prev) + { + /* Checked after the assignment to allow proper stateblock recording. */ + TRACE("Application is setting the old declaration over, nothing to do.\n"); + return WINED3D_OK; + } + + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_VDECL); + return WINED3D_OK; +} + +HRESULT CDECL wined3d_device_get_vertex_declaration(struct wined3d_device *device, + struct wined3d_vertex_declaration **declaration) +{ + TRACE("device %p, declaration %p.\n", device, declaration); + + *declaration = device->stateBlock->state.vertex_declaration; + if (*declaration) + wined3d_vertex_declaration_incref(*declaration); + + return WINED3D_OK; +} + +HRESULT CDECL wined3d_device_set_vertex_shader(struct wined3d_device *device, struct wined3d_shader *shader) +{ + struct wined3d_shader *prev = device->updateStateBlock->state.vertex_shader; + + TRACE("device %p, shader %p.\n", device, shader); + + device->updateStateBlock->state.vertex_shader = shader; + device->updateStateBlock->changed.vertexShader = TRUE; + + if (device->isRecordingState) + { + if (shader) + wined3d_shader_incref(shader); + if (prev) + wined3d_shader_decref(prev); + TRACE("Recording... not performing anything.\n"); + return WINED3D_OK; + } + + if (shader == prev) + { + TRACE("Application is setting the old shader over, nothing to do.\n"); + return WINED3D_OK; + } + + if (shader) + wined3d_shader_incref(shader); + if (prev) + wined3d_shader_decref(prev); + + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_VSHADER); + + return WINED3D_OK; +} + +struct wined3d_shader * CDECL wined3d_device_get_vertex_shader(struct wined3d_device *device) +{ + struct wined3d_shader *shader; + + TRACE("device %p.\n", device); + + shader = device->stateBlock->state.vertex_shader; + if (shader) + wined3d_shader_incref(shader); TRACE("Returning %p.\n", shader); return shader; } -static HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShaderConstantB( - IWineD3DDevice *iface, - UINT start, - CONST BOOL *srcData, - UINT count) { - - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - unsigned int i, cnt = min(count, MAX_CONST_B - start); - - TRACE("(iface %p, srcData %p, start %d, count %d)\n", - iface, srcData, start, count); - - if (!srcData || start >= MAX_CONST_B) return WINED3DERR_INVALIDCALL; - - memcpy(&This->updateStateBlock->state.vs_consts_b[start], srcData, cnt * sizeof(BOOL)); - for (i = 0; i < cnt; i++) - TRACE("Set BOOL constant %u to %s\n", start + i, srcData[i]? "true":"false"); - - for (i = start; i < cnt + start; ++i) { - This->updateStateBlock->changed.vertexShaderConstantsB |= (1 << i); - } - - if (!This->isRecordingState) IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VERTEXSHADERCONSTANT); - - return WINED3D_OK; -} - -static HRESULT WINAPI IWineD3DDeviceImpl_GetVertexShaderConstantB( - IWineD3DDevice *iface, - UINT start, - BOOL *dstData, - UINT count) { - - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - int cnt = min(count, MAX_CONST_B - start); - - TRACE("(iface %p, dstData %p, start %d, count %d)\n", - iface, dstData, start, count); - - if (!dstData || cnt < 0) - return WINED3DERR_INVALIDCALL; - - memcpy(dstData, &This->stateBlock->state.vs_consts_b[start], cnt * sizeof(BOOL)); - return WINED3D_OK; -} - -static HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShaderConstantI( - IWineD3DDevice *iface, - UINT start, - CONST int *srcData, - UINT count) { - - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - unsigned int i, cnt = min(count, MAX_CONST_I - start); - - TRACE("(iface %p, srcData %p, start %d, count %d)\n", - iface, srcData, start, count); - - if (!srcData || start >= MAX_CONST_I) return WINED3DERR_INVALIDCALL; - - memcpy(&This->updateStateBlock->state.vs_consts_i[start * 4], srcData, cnt * sizeof(int) * 4); - for (i = 0; i < cnt; i++) - TRACE("Set INT constant %u to { %d, %d, %d, %d }\n", start + i, - srcData[i*4], srcData[i*4+1], srcData[i*4+2], srcData[i*4+3]); - - for (i = start; i < cnt + start; ++i) { - This->updateStateBlock->changed.vertexShaderConstantsI |= (1 << i); - } - - if (!This->isRecordingState) IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VERTEXSHADERCONSTANT); - - return WINED3D_OK; -} - -static HRESULT WINAPI IWineD3DDeviceImpl_GetVertexShaderConstantI( - IWineD3DDevice *iface, - UINT start, - int *dstData, - UINT count) { - - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - int cnt = min(count, MAX_CONST_I - start); - - TRACE("(iface %p, dstData %p, start %d, count %d)\n", - iface, dstData, start, count); - - if (!dstData || ((signed int)MAX_CONST_I - (signed int)start) <= 0) - return WINED3DERR_INVALIDCALL; - - memcpy(dstData, &This->stateBlock->state.vs_consts_i[start * 4], cnt * sizeof(int) * 4); - return WINED3D_OK; -} - -static HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShaderConstantF( - IWineD3DDevice *iface, - UINT start, - CONST float *srcData, - UINT count) { - - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; +HRESULT CDECL wined3d_device_set_vs_consts_b(struct wined3d_device *device, + UINT start_register, const BOOL *constants, UINT bool_count) +{ + UINT count = min(bool_count, MAX_CONST_B - start_register); UINT i; - TRACE("(iface %p, srcData %p, start %d, count %d)\n", - iface, srcData, start, count); + TRACE("device %p, start_register %u, constants %p, bool_count %u.\n", + device, start_register, constants, bool_count); - /* Specifically test start > limit to catch MAX_UINT overflows when adding start + count */ - if (!srcData || start + count > This->d3d_vshader_constantF || start > This->d3d_vshader_constantF) + if (!constants || start_register >= MAX_CONST_B) return WINED3DERR_INVALIDCALL; - memcpy(&This->updateStateBlock->state.vs_consts_f[start * 4], srcData, count * sizeof(float) * 4); - if(TRACE_ON(d3d)) { - for (i = 0; i < count; i++) - TRACE("Set FLOAT constant %u to { %f, %f, %f, %f }\n", start + i, - srcData[i*4], srcData[i*4+1], srcData[i*4+2], srcData[i*4+3]); - } + memcpy(&device->updateStateBlock->state.vs_consts_b[start_register], constants, count * sizeof(BOOL)); + for (i = 0; i < count; ++i) + TRACE("Set BOOL constant %u to %s.\n", start_register + i, constants[i] ? "true" : "false"); - if (!This->isRecordingState) - { - This->shader_backend->shader_update_float_vertex_constants(iface, start, count); - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VERTEXSHADERCONSTANT); - } + for (i = start_register; i < count + start_register; ++i) + device->updateStateBlock->changed.vertexShaderConstantsB |= (1 << i); - memset(This->updateStateBlock->changed.vertexShaderConstantsF + start, 1, - sizeof(*This->updateStateBlock->changed.vertexShaderConstantsF) * count); + if (!device->isRecordingState) + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_VERTEXSHADERCONSTANT); return WINED3D_OK; } -static HRESULT WINAPI IWineD3DDeviceImpl_GetVertexShaderConstantF( - IWineD3DDevice *iface, - UINT start, - float *dstData, - UINT count) { - - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - int cnt = min(count, This->d3d_vshader_constantF - start); - - TRACE("(iface %p, dstData %p, start %d, count %d)\n", - iface, dstData, start, count); - - if (!dstData || cnt < 0) - return WINED3DERR_INVALIDCALL; - - memcpy(dstData, &This->stateBlock->state.vs_consts_f[start * 4], cnt * sizeof(float) * 4); - return WINED3D_OK; -} - -static inline void markTextureStagesDirty(IWineD3DDeviceImpl *This, DWORD stage) { - DWORD i; - for(i = 0; i <= WINED3D_HIGHEST_TEXTURE_STATE; ++i) - { - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_TEXTURESTAGE(stage, i)); - } -} - -static void device_map_stage(IWineD3DDeviceImpl *This, DWORD stage, DWORD unit) +HRESULT CDECL wined3d_device_get_vs_consts_b(struct wined3d_device *device, + UINT start_register, BOOL *constants, UINT bool_count) { - DWORD i = This->rev_tex_unit_map[unit]; - DWORD j = This->texUnitMap[stage]; + UINT count = min(bool_count, MAX_CONST_B - start_register); - This->texUnitMap[stage] = unit; - if (i != WINED3D_UNMAPPED_STAGE && i != stage) + TRACE("device %p, start_register %u, constants %p, bool_count %u.\n", + device, start_register, constants, bool_count); + + if (!constants || start_register >= MAX_CONST_B) + return WINED3DERR_INVALIDCALL; + + memcpy(constants, &device->stateBlock->state.vs_consts_b[start_register], count * sizeof(BOOL)); + + return WINED3D_OK; +} + +HRESULT CDECL wined3d_device_set_vs_consts_i(struct wined3d_device *device, + UINT start_register, const int *constants, UINT vector4i_count) +{ + UINT count = min(vector4i_count, MAX_CONST_I - start_register); + UINT i; + + TRACE("device %p, start_register %u, constants %p, vector4i_count %u.\n", + device, start_register, constants, vector4i_count); + + if (!constants || start_register >= MAX_CONST_I) + return WINED3DERR_INVALIDCALL; + + memcpy(&device->updateStateBlock->state.vs_consts_i[start_register * 4], constants, count * sizeof(int) * 4); + for (i = 0; i < count; ++i) + TRACE("Set INT constant %u to {%d, %d, %d, %d}.\n", start_register + i, + constants[i * 4], constants[i * 4 + 1], + constants[i * 4 + 2], constants[i * 4 + 3]); + + for (i = start_register; i < count + start_register; ++i) + device->updateStateBlock->changed.vertexShaderConstantsI |= (1 << i); + + if (!device->isRecordingState) + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_VERTEXSHADERCONSTANT); + + return WINED3D_OK; +} + +HRESULT CDECL wined3d_device_get_vs_consts_i(struct wined3d_device *device, + UINT start_register, int *constants, UINT vector4i_count) +{ + UINT count = min(vector4i_count, MAX_CONST_I - start_register); + + TRACE("device %p, start_register %u, constants %p, vector4i_count %u.\n", + device, start_register, constants, vector4i_count); + + if (!constants || start_register >= MAX_CONST_I) + return WINED3DERR_INVALIDCALL; + + memcpy(constants, &device->stateBlock->state.vs_consts_i[start_register * 4], count * sizeof(int) * 4); + return WINED3D_OK; +} + +HRESULT CDECL wined3d_device_set_vs_consts_f(struct wined3d_device *device, + UINT start_register, const float *constants, UINT vector4f_count) +{ + UINT i; + + TRACE("device %p, start_register %u, constants %p, vector4f_count %u.\n", + device, start_register, constants, vector4f_count); + + /* Specifically test start_register > limit to catch MAX_UINT overflows + * when adding start_register + vector4f_count. */ + if (!constants + || start_register + vector4f_count > device->d3d_vshader_constantF + || start_register > device->d3d_vshader_constantF) + return WINED3DERR_INVALIDCALL; + + memcpy(&device->updateStateBlock->state.vs_consts_f[start_register * 4], + constants, vector4f_count * sizeof(float) * 4); + if (TRACE_ON(d3d)) { - This->texUnitMap[i] = WINED3D_UNMAPPED_STAGE; + for (i = 0; i < vector4f_count; ++i) + TRACE("Set FLOAT constant %u to {%.8e, %.8e, %.8e, %.8e}.\n", start_register + i, + constants[i * 4], constants[i * 4 + 1], + constants[i * 4 + 2], constants[i * 4 + 3]); } - This->rev_tex_unit_map[unit] = stage; - if (j != WINED3D_UNMAPPED_STAGE && j != unit) + if (!device->isRecordingState) { - This->rev_tex_unit_map[j] = WINED3D_UNMAPPED_STAGE; + device->shader_backend->shader_update_float_vertex_constants(device, start_register, vector4f_count); + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_VERTEXSHADERCONSTANT); + } + + memset(device->updateStateBlock->changed.vertexShaderConstantsF + start_register, 1, + sizeof(*device->updateStateBlock->changed.vertexShaderConstantsF) * vector4f_count); + + return WINED3D_OK; +} + +HRESULT CDECL wined3d_device_get_vs_consts_f(struct wined3d_device *device, + UINT start_register, float *constants, UINT vector4f_count) +{ + int count = min(vector4f_count, device->d3d_vshader_constantF - start_register); + + TRACE("device %p, start_register %u, constants %p, vector4f_count %u.\n", + device, start_register, constants, vector4f_count); + + if (!constants || count < 0) + return WINED3DERR_INVALIDCALL; + + memcpy(constants, &device->stateBlock->state.vs_consts_f[start_register * 4], count * sizeof(float) * 4); + + return WINED3D_OK; +} + +static inline void markTextureStagesDirty(struct wined3d_device *device, DWORD stage) +{ + DWORD i; + + for (i = 0; i <= WINED3D_HIGHEST_TEXTURE_STATE; ++i) + { + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_TEXTURESTAGE(stage, i)); } } -static void device_update_fixed_function_usage_map(IWineD3DDeviceImpl *This) { - int i; +static void device_map_stage(struct wined3d_device *device, DWORD stage, DWORD unit) +{ + DWORD i = device->rev_tex_unit_map[unit]; + DWORD j = device->texUnitMap[stage]; - This->fixed_function_usage_map = 0; + device->texUnitMap[stage] = unit; + if (i != WINED3D_UNMAPPED_STAGE && i != stage) + device->texUnitMap[i] = WINED3D_UNMAPPED_STAGE; + + device->rev_tex_unit_map[unit] = stage; + if (j != WINED3D_UNMAPPED_STAGE && j != unit) + device->rev_tex_unit_map[j] = WINED3D_UNMAPPED_STAGE; +} + +static void device_update_fixed_function_usage_map(struct wined3d_device *device) +{ + UINT i; + + device->fixed_function_usage_map = 0; for (i = 0; i < MAX_TEXTURES; ++i) { - const struct wined3d_state *state = &This->stateBlock->state; + const struct wined3d_state *state = &device->stateBlock->state; WINED3DTEXTUREOP color_op = state->texture_states[i][WINED3DTSS_COLOROP]; WINED3DTEXTUREOP alpha_op = state->texture_states[i][WINED3DTSS_ALPHAOP]; DWORD color_arg1 = state->texture_states[i][WINED3DTSS_COLORARG1] & WINED3DTA_SELECTMASK; @@ -3449,38 +2841,39 @@ static void device_update_fixed_function_usage_map(IWineD3DDeviceImpl *This) { if (((color_arg1 == WINED3DTA_TEXTURE) && color_op != WINED3DTOP_SELECTARG2) || ((color_arg2 == WINED3DTA_TEXTURE) && color_op != WINED3DTOP_SELECTARG1) - || ((color_arg3 == WINED3DTA_TEXTURE) && (color_op == WINED3DTOP_MULTIPLYADD || color_op == WINED3DTOP_LERP)) + || ((color_arg3 == WINED3DTA_TEXTURE) + && (color_op == WINED3DTOP_MULTIPLYADD || color_op == WINED3DTOP_LERP)) || ((alpha_arg1 == WINED3DTA_TEXTURE) && alpha_op != WINED3DTOP_SELECTARG2) || ((alpha_arg2 == WINED3DTA_TEXTURE) && alpha_op != WINED3DTOP_SELECTARG1) - || ((alpha_arg3 == WINED3DTA_TEXTURE) && (alpha_op == WINED3DTOP_MULTIPLYADD || alpha_op == WINED3DTOP_LERP))) { - This->fixed_function_usage_map |= (1 << i); - } + || ((alpha_arg3 == WINED3DTA_TEXTURE) + && (alpha_op == WINED3DTOP_MULTIPLYADD || alpha_op == WINED3DTOP_LERP))) + device->fixed_function_usage_map |= (1 << i); - if ((color_op == WINED3DTOP_BUMPENVMAP || color_op == WINED3DTOP_BUMPENVMAPLUMINANCE) && i < MAX_TEXTURES - 1) { - This->fixed_function_usage_map |= (1 << (i + 1)); - } + if ((color_op == WINED3DTOP_BUMPENVMAP || color_op == WINED3DTOP_BUMPENVMAPLUMINANCE) && i < MAX_TEXTURES - 1) + device->fixed_function_usage_map |= (1 << (i + 1)); } } -static void device_map_fixed_function_samplers(IWineD3DDeviceImpl *This, const struct wined3d_gl_info *gl_info) +static void device_map_fixed_function_samplers(struct wined3d_device *device, const struct wined3d_gl_info *gl_info) { unsigned int i, tex; WORD ffu_map; - device_update_fixed_function_usage_map(This); - ffu_map = This->fixed_function_usage_map; + device_update_fixed_function_usage_map(device); + ffu_map = device->fixed_function_usage_map; - if (This->max_ffp_textures == gl_info->limits.texture_stages - || This->stateBlock->state.lowest_disabled_stage <= This->max_ffp_textures) + if (device->max_ffp_textures == gl_info->limits.texture_stages + || device->stateBlock->state.lowest_disabled_stage <= device->max_ffp_textures) { for (i = 0; ffu_map; ffu_map >>= 1, ++i) { if (!(ffu_map & 1)) continue; - if (This->texUnitMap[i] != i) { - device_map_stage(This, i, i); - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_SAMPLER(i)); - markTextureStagesDirty(This, i); + if (device->texUnitMap[i] != i) + { + device_map_stage(device, i, i); + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_SAMPLER(i)); + markTextureStagesDirty(device, i); } } return; @@ -3492,39 +2885,42 @@ static void device_map_fixed_function_samplers(IWineD3DDeviceImpl *This, const s { if (!(ffu_map & 1)) continue; - if (This->texUnitMap[i] != tex) { - device_map_stage(This, i, tex); - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_SAMPLER(i)); - markTextureStagesDirty(This, i); + if (device->texUnitMap[i] != tex) + { + device_map_stage(device, i, tex); + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_SAMPLER(i)); + markTextureStagesDirty(device, i); } ++tex; } } -static void device_map_psamplers(IWineD3DDeviceImpl *This, const struct wined3d_gl_info *gl_info) +static void device_map_psamplers(struct wined3d_device *device, const struct wined3d_gl_info *gl_info) { const WINED3DSAMPLER_TEXTURE_TYPE *sampler_type = - This->stateBlock->state.pixel_shader->baseShader.reg_maps.sampler_type; + device->stateBlock->state.pixel_shader->reg_maps.sampler_type; unsigned int i; - for (i = 0; i < MAX_FRAGMENT_SAMPLERS; ++i) { - if (sampler_type[i] && This->texUnitMap[i] != i) + for (i = 0; i < MAX_FRAGMENT_SAMPLERS; ++i) + { + if (sampler_type[i] && device->texUnitMap[i] != i) { - device_map_stage(This, i, i); - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_SAMPLER(i)); + device_map_stage(device, i, i); + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_SAMPLER(i)); if (i < gl_info->limits.texture_stages) { - markTextureStagesDirty(This, i); + markTextureStagesDirty(device, i); } } } } -static BOOL device_unit_free_for_vs(IWineD3DDeviceImpl *This, const WINED3DSAMPLER_TEXTURE_TYPE *pshader_sampler_tokens, +static BOOL device_unit_free_for_vs(struct wined3d_device *device, + const WINED3DSAMPLER_TEXTURE_TYPE *pshader_sampler_tokens, const WINED3DSAMPLER_TEXTURE_TYPE *vshader_sampler_tokens, DWORD unit) { - DWORD current_mapping = This->rev_tex_unit_map[unit]; + DWORD current_mapping = device->rev_tex_unit_map[unit]; /* Not currently used */ if (current_mapping == WINED3D_UNMAPPED_STAGE) return TRUE; @@ -3534,7 +2930,7 @@ static BOOL device_unit_free_for_vs(IWineD3DDeviceImpl *This, const WINED3DSAMPL if (!pshader_sampler_tokens) { /* No pixel shader, check fixed function */ - return current_mapping >= MAX_TEXTURES || !(This->fixed_function_usage_map & (1 << current_mapping)); + return current_mapping >= MAX_TEXTURES || !(device->fixed_function_usage_map & (1 << current_mapping)); } /* Pixel shader, check the shader's sampler map */ @@ -3545,38 +2941,37 @@ static BOOL device_unit_free_for_vs(IWineD3DDeviceImpl *This, const WINED3DSAMPL return !vshader_sampler_tokens[current_mapping - MAX_FRAGMENT_SAMPLERS]; } -static void device_map_vsamplers(IWineD3DDeviceImpl *This, BOOL ps, const struct wined3d_gl_info *gl_info) +static void device_map_vsamplers(struct wined3d_device *device, BOOL ps, const struct wined3d_gl_info *gl_info) { const WINED3DSAMPLER_TEXTURE_TYPE *vshader_sampler_type = - This->stateBlock->state.vertex_shader->baseShader.reg_maps.sampler_type; + device->stateBlock->state.vertex_shader->reg_maps.sampler_type; const WINED3DSAMPLER_TEXTURE_TYPE *pshader_sampler_type = NULL; int start = min(MAX_COMBINED_SAMPLERS, gl_info->limits.combined_samplers) - 1; int i; if (ps) { - IWineD3DPixelShaderImpl *pshader = This->stateBlock->state.pixel_shader; - /* Note that we only care if a sampler is sampled or not, not the sampler's specific type. * Otherwise we'd need to call shader_update_samplers() here for 1.x pixelshaders. */ - pshader_sampler_type = pshader->baseShader.reg_maps.sampler_type; + pshader_sampler_type = device->stateBlock->state.pixel_shader->reg_maps.sampler_type; } for (i = 0; i < MAX_VERTEX_SAMPLERS; ++i) { DWORD vsampler_idx = i + MAX_FRAGMENT_SAMPLERS; if (vshader_sampler_type[i]) { - if (This->texUnitMap[vsampler_idx] != WINED3D_UNMAPPED_STAGE) + if (device->texUnitMap[vsampler_idx] != WINED3D_UNMAPPED_STAGE) { /* Already mapped somewhere */ continue; } - while (start >= 0) { - if (device_unit_free_for_vs(This, pshader_sampler_type, vshader_sampler_type, start)) + while (start >= 0) + { + if (device_unit_free_for_vs(device, pshader_sampler_type, vshader_sampler_type, start)) { - device_map_stage(This, vsampler_idx, start); - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_SAMPLER(vsampler_idx)); + device_map_stage(device, vsampler_idx, start); + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_SAMPLER(vsampler_idx)); --start; break; @@ -3588,10 +2983,10 @@ static void device_map_vsamplers(IWineD3DDeviceImpl *This, BOOL ps, const struct } } -void IWineD3DDeviceImpl_FindTexUnitMap(IWineD3DDeviceImpl *This) +void device_update_tex_unit_map(struct wined3d_device *device) { - const struct wined3d_gl_info *gl_info = &This->adapter->gl_info; - const struct wined3d_state *state = &This->stateBlock->state; + const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; + const struct wined3d_state *state = &device->stateBlock->state; BOOL vs = use_vs(state); BOOL ps = use_ps(state); /* @@ -3601,214 +2996,209 @@ void IWineD3DDeviceImpl_FindTexUnitMap(IWineD3DDeviceImpl *This) * -> When the mapping of a stage is changed, sampler and ALL texture stage states have * to be reset. Because of that try to work with a 1:1 mapping as much as possible */ - if (ps) device_map_psamplers(This, gl_info); - else device_map_fixed_function_samplers(This, gl_info); + if (ps) + device_map_psamplers(device, gl_info); + else + device_map_fixed_function_samplers(device, gl_info); - if (vs) device_map_vsamplers(This, ps, gl_info); + if (vs) + device_map_vsamplers(device, ps, gl_info); } -static HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShader(IWineD3DDevice *iface, IWineD3DPixelShader *pShader) +HRESULT CDECL wined3d_device_set_pixel_shader(struct wined3d_device *device, struct wined3d_shader *shader) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - IWineD3DPixelShader *oldShader = (IWineD3DPixelShader *)This->updateStateBlock->state.pixel_shader; - This->updateStateBlock->state.pixel_shader = (IWineD3DPixelShaderImpl *)pShader; - This->updateStateBlock->changed.pixelShader = TRUE; + struct wined3d_shader *prev = device->updateStateBlock->state.pixel_shader; - /* Handle recording of state blocks */ - if (This->isRecordingState) { - TRACE("Recording... not performing anything\n"); - } + TRACE("device %p, shader %p.\n", device, shader); - if (This->isRecordingState) { - TRACE("Recording... not performing anything\n"); - if(pShader) IWineD3DPixelShader_AddRef(pShader); - if(oldShader) IWineD3DPixelShader_Release(oldShader); + device->updateStateBlock->state.pixel_shader = shader; + device->updateStateBlock->changed.pixelShader = TRUE; + + if (device->isRecordingState) + { + if (shader) + wined3d_shader_incref(shader); + if (prev) + wined3d_shader_decref(prev); + TRACE("Recording... not performing anything.\n"); return WINED3D_OK; } - if(pShader == oldShader) { - TRACE("App is setting the old pixel shader over, nothing to do\n"); + if (shader == prev) + { + TRACE("Application is setting the old shader over, nothing to do.\n"); return WINED3D_OK; } - if(pShader) IWineD3DPixelShader_AddRef(pShader); - if(oldShader) IWineD3DPixelShader_Release(oldShader); + if (shader) + wined3d_shader_incref(shader); + if (prev) + wined3d_shader_decref(prev); - TRACE("(%p) : setting pShader(%p)\n", This, pShader); - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_PIXELSHADER); + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_PIXELSHADER); return WINED3D_OK; } -static IWineD3DPixelShader * WINAPI IWineD3DDeviceImpl_GetPixelShader(IWineD3DDevice *iface) +struct wined3d_shader * CDECL wined3d_device_get_pixel_shader(struct wined3d_device *device) { - IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface; - IWineD3DPixelShader *shader; + struct wined3d_shader *shader; - TRACE("iface %p.\n", iface); + TRACE("device %p.\n", device); - shader = (IWineD3DPixelShader *)device->stateBlock->state.pixel_shader; - if (shader) IWineD3DPixelShader_AddRef(shader); + shader = device->stateBlock->state.pixel_shader; + if (shader) + wined3d_shader_incref(shader); TRACE("Returning %p.\n", shader); return shader; } -static HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShaderConstantB( - IWineD3DDevice *iface, - UINT start, - CONST BOOL *srcData, - UINT count) { - - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - unsigned int i, cnt = min(count, MAX_CONST_B - start); - - TRACE("(iface %p, srcData %p, start %u, count %u)\n", - iface, srcData, start, count); - - if (!srcData || start >= MAX_CONST_B) return WINED3DERR_INVALIDCALL; - - memcpy(&This->updateStateBlock->state.ps_consts_b[start], srcData, cnt * sizeof(BOOL)); - for (i = 0; i < cnt; i++) - TRACE("Set BOOL constant %u to %s\n", start + i, srcData[i]? "true":"false"); - - for (i = start; i < cnt + start; ++i) { - This->updateStateBlock->changed.pixelShaderConstantsB |= (1 << i); - } - - if (!This->isRecordingState) IWineD3DDeviceImpl_MarkStateDirty(This, STATE_PIXELSHADERCONSTANT); - - return WINED3D_OK; -} - -static HRESULT WINAPI IWineD3DDeviceImpl_GetPixelShaderConstantB( - IWineD3DDevice *iface, - UINT start, - BOOL *dstData, - UINT count) { - - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - int cnt = min(count, MAX_CONST_B - start); - - TRACE("(iface %p, dstData %p, start %d, count %d)\n", - iface, dstData, start, count); - - if (!dstData || cnt < 0) - return WINED3DERR_INVALIDCALL; - - memcpy(dstData, &This->stateBlock->state.ps_consts_b[start], cnt * sizeof(BOOL)); - return WINED3D_OK; -} - -static HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShaderConstantI( - IWineD3DDevice *iface, - UINT start, - CONST int *srcData, - UINT count) { - - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - unsigned int i, cnt = min(count, MAX_CONST_I - start); - - TRACE("(iface %p, srcData %p, start %u, count %u)\n", - iface, srcData, start, count); - - if (!srcData || start >= MAX_CONST_I) return WINED3DERR_INVALIDCALL; - - memcpy(&This->updateStateBlock->state.ps_consts_i[start * 4], srcData, cnt * sizeof(int) * 4); - for (i = 0; i < cnt; i++) - TRACE("Set INT constant %u to { %d, %d, %d, %d }\n", start + i, - srcData[i*4], srcData[i*4+1], srcData[i*4+2], srcData[i*4+3]); - - for (i = start; i < cnt + start; ++i) { - This->updateStateBlock->changed.pixelShaderConstantsI |= (1 << i); - } - - if (!This->isRecordingState) IWineD3DDeviceImpl_MarkStateDirty(This, STATE_PIXELSHADERCONSTANT); - - return WINED3D_OK; -} - -static HRESULT WINAPI IWineD3DDeviceImpl_GetPixelShaderConstantI( - IWineD3DDevice *iface, - UINT start, - int *dstData, - UINT count) { - - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - int cnt = min(count, MAX_CONST_I - start); - - TRACE("(iface %p, dstData %p, start %d, count %d)\n", - iface, dstData, start, count); - - if (!dstData || cnt < 0) - return WINED3DERR_INVALIDCALL; - - memcpy(dstData, &This->stateBlock->state.ps_consts_i[start * 4], cnt * sizeof(int) * 4); - return WINED3D_OK; -} - -static HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShaderConstantF( - IWineD3DDevice *iface, - UINT start, - CONST float *srcData, - UINT count) { - - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; +HRESULT CDECL wined3d_device_set_ps_consts_b(struct wined3d_device *device, + UINT start_register, const BOOL *constants, UINT bool_count) +{ + UINT count = min(bool_count, MAX_CONST_B - start_register); UINT i; - TRACE("(iface %p, srcData %p, start %d, count %d)\n", - iface, srcData, start, count); + TRACE("device %p, start_register %u, constants %p, bool_count %u.\n", + device, start_register, constants, bool_count); - /* Specifically test start > limit to catch MAX_UINT overflows when adding start + count */ - if (!srcData || start + count > This->d3d_pshader_constantF || start > This->d3d_pshader_constantF) + if (!constants || start_register >= MAX_CONST_B) return WINED3DERR_INVALIDCALL; - memcpy(&This->updateStateBlock->state.ps_consts_f[start * 4], srcData, count * sizeof(float) * 4); - if(TRACE_ON(d3d)) { - for (i = 0; i < count; i++) - TRACE("Set FLOAT constant %u to { %f, %f, %f, %f }\n", start + i, - srcData[i*4], srcData[i*4+1], srcData[i*4+2], srcData[i*4+3]); - } + memcpy(&device->updateStateBlock->state.ps_consts_b[start_register], constants, count * sizeof(BOOL)); + for (i = 0; i < count; ++i) + TRACE("Set BOOL constant %u to %s.\n", start_register + i, constants[i] ? "true" : "false"); - if (!This->isRecordingState) - { - This->shader_backend->shader_update_float_pixel_constants(iface, start, count); - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_PIXELSHADERCONSTANT); - } + for (i = start_register; i < count + start_register; ++i) + device->updateStateBlock->changed.pixelShaderConstantsB |= (1 << i); - memset(This->updateStateBlock->changed.pixelShaderConstantsF + start, 1, - sizeof(*This->updateStateBlock->changed.pixelShaderConstantsF) * count); + if (!device->isRecordingState) + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_PIXELSHADERCONSTANT); return WINED3D_OK; } -static HRESULT WINAPI IWineD3DDeviceImpl_GetPixelShaderConstantF( - IWineD3DDevice *iface, - UINT start, - float *dstData, - UINT count) { +HRESULT CDECL wined3d_device_get_ps_consts_b(struct wined3d_device *device, + UINT start_register, BOOL *constants, UINT bool_count) +{ + UINT count = min(bool_count, MAX_CONST_B - start_register); - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - int cnt = min(count, This->d3d_pshader_constantF - start); + TRACE("device %p, start_register %u, constants %p, bool_count %u.\n", + device, start_register, constants, bool_count); - TRACE("(iface %p, dstData %p, start %d, count %d)\n", - iface, dstData, start, count); - - if (!dstData || cnt < 0) + if (!constants || start_register >= MAX_CONST_B) return WINED3DERR_INVALIDCALL; - memcpy(dstData, &This->stateBlock->state.ps_consts_f[start * 4], cnt * sizeof(float) * 4); + memcpy(constants, &device->stateBlock->state.ps_consts_b[start_register], count * sizeof(BOOL)); + + return WINED3D_OK; +} + +HRESULT CDECL wined3d_device_set_ps_consts_i(struct wined3d_device *device, + UINT start_register, const int *constants, UINT vector4i_count) +{ + UINT count = min(vector4i_count, MAX_CONST_I - start_register); + UINT i; + + TRACE("device %p, start_register %u, constants %p, vector4i_count %u.\n", + device, start_register, constants, vector4i_count); + + if (!constants || start_register >= MAX_CONST_I) + return WINED3DERR_INVALIDCALL; + + memcpy(&device->updateStateBlock->state.ps_consts_i[start_register * 4], constants, count * sizeof(int) * 4); + for (i = 0; i < count; ++i) + TRACE("Set INT constant %u to {%d, %d, %d, %d}.\n", start_register + i, + constants[i * 4], constants[i * 4 + 1], + constants[i * 4 + 2], constants[i * 4 + 3]); + + for (i = start_register; i < count + start_register; ++i) + device->updateStateBlock->changed.pixelShaderConstantsI |= (1 << i); + + if (!device->isRecordingState) + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_PIXELSHADERCONSTANT); + + return WINED3D_OK; +} + +HRESULT CDECL wined3d_device_get_ps_consts_i(struct wined3d_device *device, + UINT start_register, int *constants, UINT vector4i_count) +{ + UINT count = min(vector4i_count, MAX_CONST_I - start_register); + + TRACE("device %p, start_register %u, constants %p, vector4i_count %u.\n", + device, start_register, constants, vector4i_count); + + if (!constants || start_register >= MAX_CONST_I) + return WINED3DERR_INVALIDCALL; + + memcpy(constants, &device->stateBlock->state.ps_consts_i[start_register * 4], count * sizeof(int) * 4); + + return WINED3D_OK; +} + +HRESULT CDECL wined3d_device_set_ps_consts_f(struct wined3d_device *device, + UINT start_register, const float *constants, UINT vector4f_count) +{ + UINT i; + + TRACE("device %p, start_register %u, constants %p, vector4f_count %u.\n", + device, start_register, constants, vector4f_count); + + /* Specifically test start_register > limit to catch MAX_UINT overflows + * when adding start_register + vector4f_count. */ + if (!constants + || start_register + vector4f_count > device->d3d_pshader_constantF + || start_register > device->d3d_pshader_constantF) + return WINED3DERR_INVALIDCALL; + + memcpy(&device->updateStateBlock->state.ps_consts_f[start_register * 4], + constants, vector4f_count * sizeof(float) * 4); + if (TRACE_ON(d3d)) + { + for (i = 0; i < vector4f_count; ++i) + TRACE("Set FLOAT constant %u to {%.8e, %.8e, %.8e, %.8e}.\n", start_register + i, + constants[i * 4], constants[i * 4 + 1], + constants[i * 4 + 2], constants[i * 4 + 3]); + } + + if (!device->isRecordingState) + { + device->shader_backend->shader_update_float_pixel_constants(device, start_register, vector4f_count); + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_PIXELSHADERCONSTANT); + } + + memset(device->updateStateBlock->changed.pixelShaderConstantsF + start_register, 1, + sizeof(*device->updateStateBlock->changed.pixelShaderConstantsF) * vector4f_count); + + return WINED3D_OK; +} + +HRESULT CDECL wined3d_device_get_ps_consts_f(struct wined3d_device *device, + UINT start_register, float *constants, UINT vector4f_count) +{ + int count = min(vector4f_count, device->d3d_pshader_constantF - start_register); + + TRACE("device %p, start_register %u, constants %p, vector4f_count %u.\n", + device, start_register, constants, vector4f_count); + + if (!constants || count < 0) + return WINED3DERR_INVALIDCALL; + + memcpy(constants, &device->stateBlock->state.ps_consts_f[start_register * 4], count * sizeof(float) * 4); + return WINED3D_OK; } /* Context activation is done by the caller. */ /* Do not call while under the GL lock. */ #define copy_and_next(dest, src, size) memcpy(dest, src, size); dest += (size) -static HRESULT process_vertices_strided(IWineD3DDeviceImpl *This, DWORD dwDestIndex, DWORD dwCount, - const struct wined3d_stream_info *stream_info, struct wined3d_buffer *dest, DWORD dwFlags, +static HRESULT process_vertices_strided(struct wined3d_device *device, DWORD dwDestIndex, DWORD dwCount, + const struct wined3d_stream_info *stream_info, struct wined3d_buffer *dest, DWORD flags, DWORD DestFVF) { - const struct wined3d_gl_info *gl_info = &This->adapter->gl_info; + const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; char *dest_ptr, *dest_conv = NULL, *dest_conv_addr = NULL; unsigned int i; WINED3DVIEWPORT vp; @@ -3836,7 +3226,7 @@ static HRESULT process_vertices_strided(IWineD3DDeviceImpl *This, DWORD dwDestIn if (!dest->buffer_object && gl_info->supported[ARB_VERTEX_BUFFER_OBJECT]) { dest->flags |= WINED3D_BUFFER_CREATEBO; - IWineD3DBuffer_PreLoad((IWineD3DBuffer *)dest); + wined3d_buffer_preload(dest); } if (dest->buffer_object) @@ -3855,7 +3245,7 @@ static HRESULT process_vertices_strided(IWineD3DDeviceImpl *This, DWORD dwDestIn dest_conv = dest_conv_addr; } - if (This->stateBlock->state.render_states[WINED3DRS_CLIPPING]) + if (device->stateBlock->state.render_states[WINED3DRS_CLIPPING]) { static BOOL warned = FALSE; /* @@ -3874,15 +3264,9 @@ static HRESULT process_vertices_strided(IWineD3DDeviceImpl *This, DWORD dwDestIn } else doClip = FALSE; dest_ptr = ((char *)buffer_get_sysmem(dest, gl_info)) + dwDestIndex * get_flexible_vertex_size(DestFVF); - IWineD3DDevice_GetTransform( (IWineD3DDevice *) This, - WINED3DTS_VIEW, - &view_mat); - IWineD3DDevice_GetTransform( (IWineD3DDevice *) This, - WINED3DTS_PROJECTION, - &proj_mat); - IWineD3DDevice_GetTransform( (IWineD3DDevice *) This, - WINED3DTS_WORLDMATRIX(0), - &world_mat); + wined3d_device_get_transform(device, WINED3DTS_VIEW, &view_mat); + wined3d_device_get_transform(device, WINED3DTS_PROJECTION, &proj_mat); + wined3d_device_get_transform(device, WINED3DTS_WORLDMATRIX(0), &world_mat); TRACE("View mat:\n"); TRACE("%f %f %f %f\n", view_mat.u.s._11, view_mat.u.s._12, view_mat.u.s._13, view_mat.u.s._14); @@ -3903,7 +3287,7 @@ static HRESULT process_vertices_strided(IWineD3DDeviceImpl *This, DWORD dwDestIn TRACE("%f %f %f %f\n", world_mat.u.s._41, world_mat.u.s._42, world_mat.u.s._43, world_mat.u.s._44); /* Get the viewport */ - IWineD3DDevice_GetViewport( (IWineD3DDevice *) This, &vp); + wined3d_device_get_viewport(device, &vp); TRACE("Viewport: X=%d, Y=%d, Width=%d, Height=%d, MinZ=%f, MaxZ=%f\n", vp.X, vp.Y, vp.Width, vp.Height, vp.MinZ, vp.MaxZ); @@ -4147,35 +3531,37 @@ static HRESULT process_vertices_strided(IWineD3DDeviceImpl *This, DWORD dwDestIn #undef copy_and_next /* Do not call while under the GL lock. */ -static HRESULT WINAPI IWineD3DDeviceImpl_ProcessVertices(IWineD3DDevice *iface, UINT SrcStartIndex, UINT DestIndex, - UINT VertexCount, IWineD3DBuffer *pDestBuffer, IWineD3DVertexDeclaration *pVertexDecl, DWORD Flags, - DWORD DestFVF) +HRESULT CDECL wined3d_device_process_vertices(struct wined3d_device *device, + UINT src_start_idx, UINT dst_idx, UINT vertex_count, struct wined3d_buffer *dst_buffer, + struct wined3d_vertex_declaration *declaration, DWORD flags, DWORD dst_fvf) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; + BOOL vbo = FALSE, streamWasUP = device->stateBlock->state.user_stream; struct wined3d_stream_info stream_info; const struct wined3d_gl_info *gl_info; struct wined3d_context *context; - BOOL vbo = FALSE, streamWasUP = This->stateBlock->state.user_stream; HRESULT hr; - TRACE("(%p)->(%d,%d,%d,%p,%p,%d\n", This, SrcStartIndex, DestIndex, VertexCount, pDestBuffer, pVertexDecl, Flags); + TRACE("device %p, src_start_idx %u, dst_idx %u, vertex_count %u, " + "dst_buffer %p, declaration %p, flags %#x, dst_fvf %#x.\n", + device, src_start_idx, dst_idx, vertex_count, + dst_buffer, declaration, flags, dst_fvf); - if(pVertexDecl) { - ERR("Output vertex declaration not implemented yet\n"); - } + if (declaration) + FIXME("Output vertex declaration not implemented yet.\n"); /* Need any context to write to the vbo. */ - context = context_acquire(This, NULL); + context = context_acquire(device, NULL); gl_info = context->gl_info; /* ProcessVertices reads from vertex buffers, which have to be assigned. DrawPrimitive and DrawPrimitiveUP * control the streamIsUP flag, thus restore it afterwards. */ - This->stateBlock->state.user_stream = FALSE; - device_stream_info_from_declaration(This, FALSE, &stream_info, &vbo); - This->stateBlock->state.user_stream = streamWasUP; + device->stateBlock->state.user_stream = FALSE; + device_stream_info_from_declaration(device, FALSE, &stream_info, &vbo); + device->stateBlock->state.user_stream = streamWasUP; - if(vbo || SrcStartIndex) { + if (vbo || src_start_idx) + { unsigned int i; /* ProcessVertices can't convert FROM a vbo, and vertex buffers used to source into ProcessVertices are * unlikely to ever be used for drawing. Release vbos in those buffers and fix up the stream_info structure @@ -4191,7 +3577,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_ProcessVertices(IWineD3DDevice *iface, e = &stream_info.elements[i]; if (e->buffer_object) { - struct wined3d_buffer *vb = This->stateBlock->state.streams[e->stream_idx].buffer; + struct wined3d_buffer *vb = device->stateBlock->state.streams[e->stream_idx].buffer; e->buffer_object = 0; e->data = (BYTE *)((ULONG_PTR)e->data + (ULONG_PTR)buffer_get_sysmem(vb, gl_info)); ENTER_GL(); @@ -4199,160 +3585,159 @@ static HRESULT WINAPI IWineD3DDeviceImpl_ProcessVertices(IWineD3DDevice *iface, vb->buffer_object = 0; LEAVE_GL(); } - if (e->data) e->data += e->stride * SrcStartIndex; + if (e->data) + e->data += e->stride * src_start_idx; } } - hr = process_vertices_strided(This, DestIndex, VertexCount, &stream_info, - (struct wined3d_buffer *)pDestBuffer, Flags, DestFVF); + hr = process_vertices_strided(device, dst_idx, vertex_count, + &stream_info, dst_buffer, flags, dst_fvf); context_release(context); return hr; } -/***** - * Get / Set Texture Stage States - * TODO: Verify against dx9 definitions - *****/ -static HRESULT WINAPI IWineD3DDeviceImpl_SetTextureStageState(IWineD3DDevice *iface, DWORD Stage, WINED3DTEXTURESTAGESTATETYPE Type, DWORD Value) +HRESULT CDECL wined3d_device_set_texture_stage_state(struct wined3d_device *device, + UINT stage, WINED3DTEXTURESTAGESTATETYPE state, DWORD value) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - const struct wined3d_gl_info *gl_info = &This->adapter->gl_info; - DWORD oldValue; + const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; + DWORD old_value; - TRACE("(%p) : Stage=%d, Type=%s(%d), Value=%d\n", This, Stage, debug_d3dtexturestate(Type), Type, Value); + TRACE("device %p, stage %u, state %s, value %#x.\n", + device, stage, debug_d3dtexturestate(state), value); - if (Type > WINED3D_HIGHEST_TEXTURE_STATE) + if (state > WINED3D_HIGHEST_TEXTURE_STATE) { - WARN("Invalid Type %d passed.\n", Type); + WARN("Invalid state %#x passed.\n", state); return WINED3D_OK; } - if (Stage >= gl_info->limits.texture_stages) + if (stage >= gl_info->limits.texture_stages) { WARN("Attempting to set stage %u which is higher than the max stage %u, ignoring.\n", - Stage, gl_info->limits.texture_stages - 1); + stage, gl_info->limits.texture_stages - 1); return WINED3D_OK; } - oldValue = This->updateStateBlock->state.texture_states[Stage][Type]; - This->updateStateBlock->changed.textureState[Stage] |= 1 << Type; - This->updateStateBlock->state.texture_states[Stage][Type] = Value; + old_value = device->updateStateBlock->state.texture_states[stage][state]; + device->updateStateBlock->changed.textureState[stage] |= 1 << state; + device->updateStateBlock->state.texture_states[stage][state] = value; - if (This->isRecordingState) { - TRACE("Recording... not performing anything\n"); + if (device->isRecordingState) + { + TRACE("Recording... not performing anything.\n"); return WINED3D_OK; } - /* Checked after the assignments to allow proper stateblock recording */ - if(oldValue == Value) { - TRACE("App is setting the old value over, nothing to do\n"); + /* Checked after the assignments to allow proper stateblock recording. */ + if (old_value == value) + { + TRACE("Application is setting the old value over, nothing to do.\n"); return WINED3D_OK; } - if (Stage > This->stateBlock->state.lowest_disabled_stage - && This->StateTable[STATE_TEXTURESTAGE(0, Type)].representative + if (stage > device->stateBlock->state.lowest_disabled_stage + && device->StateTable[STATE_TEXTURESTAGE(0, state)].representative == STATE_TEXTURESTAGE(0, WINED3DTSS_COLOROP)) { - /* Colorop change above lowest disabled stage? That won't change anything in the gl setup - * Changes in other states are important on disabled stages too - */ + /* Colorop change above lowest disabled stage? That won't change + * anything in the GL setup. Changes in other states are important on + * disabled stages too. */ return WINED3D_OK; } - if(Type == WINED3DTSS_COLOROP) { + if (state == WINED3DTSS_COLOROP) + { unsigned int i; - if(Value == WINED3DTOP_DISABLE && oldValue != WINED3DTOP_DISABLE) { - /* Previously enabled stage disabled now. Make sure to dirtify all enabled stages above Stage, - * they have to be disabled + if (value == WINED3DTOP_DISABLE && old_value != WINED3DTOP_DISABLE) + { + /* Previously enabled stage disabled now. Make sure to dirtify + * all enabled stages above stage, they have to be disabled. * - * The current stage is dirtified below. - */ - for (i = Stage + 1; i < This->stateBlock->state.lowest_disabled_stage; ++i) + * The current stage is dirtified below. */ + for (i = stage + 1; i < device->stateBlock->state.lowest_disabled_stage; ++i) { - TRACE("Additionally dirtifying stage %u\n", i); - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_TEXTURESTAGE(i, WINED3DTSS_COLOROP)); + TRACE("Additionally dirtifying stage %u.\n", i); + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_TEXTURESTAGE(i, WINED3DTSS_COLOROP)); } - This->stateBlock->state.lowest_disabled_stage = Stage; - TRACE("New lowest disabled: %u\n", Stage); - } else if(Value != WINED3DTOP_DISABLE && oldValue == WINED3DTOP_DISABLE) { - /* Previously disabled stage enabled. Stages above it may need enabling - * stage must be lowest_disabled_stage here, if it's bigger success is returned above, - * and stages below the lowest disabled stage can't be enabled(because they are enabled already). + device->stateBlock->state.lowest_disabled_stage = stage; + TRACE("New lowest disabled: %u.\n", stage); + } + else if (value != WINED3DTOP_DISABLE && old_value == WINED3DTOP_DISABLE) + { + /* Previously disabled stage enabled. Stages above it may need + * enabling. Stage must be lowest_disabled_stage here, if it's + * bigger success is returned above, and stages below the lowest + * disabled stage can't be enabled (because they are enabled + * already). * - * Again stage Stage doesn't need to be dirtified here, it is handled below. - */ - - for (i = Stage + 1; i < This->adapter->gl_info.limits.texture_stages; ++i) + * Again stage stage doesn't need to be dirtified here, it is + * handled below. */ + for (i = stage + 1; i < gl_info->limits.texture_stages; ++i) { - if (This->updateStateBlock->state.texture_states[i][WINED3DTSS_COLOROP] == WINED3DTOP_DISABLE) + if (device->updateStateBlock->state.texture_states[i][WINED3DTSS_COLOROP] == WINED3DTOP_DISABLE) break; - TRACE("Additionally dirtifying stage %u due to enable\n", i); - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_TEXTURESTAGE(i, WINED3DTSS_COLOROP)); + TRACE("Additionally dirtifying stage %u due to enable.\n", i); + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_TEXTURESTAGE(i, WINED3DTSS_COLOROP)); } - This->stateBlock->state.lowest_disabled_stage = i; - TRACE("New lowest disabled: %u\n", i); + device->stateBlock->state.lowest_disabled_stage = i; + TRACE("New lowest disabled: %u.\n", i); } } - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_TEXTURESTAGE(Stage, Type)); + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_TEXTURESTAGE(stage, state)); return WINED3D_OK; } -static HRESULT WINAPI IWineD3DDeviceImpl_GetTextureStageState(IWineD3DDevice *iface, DWORD Stage, WINED3DTEXTURESTAGESTATETYPE Type, DWORD *pValue) +HRESULT CDECL wined3d_device_get_texture_stage_state(struct wined3d_device *device, + UINT stage, WINED3DTEXTURESTAGESTATETYPE state, DWORD *value) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; + TRACE("device %p, stage %u, state %s, value %p.\n", + device, stage, debug_d3dtexturestate(state), value); - TRACE("iface %p, stage %u, state %s, value %p.\n", - iface, Stage, debug_d3dtexturestate(Type), pValue); - - if (Type > WINED3D_HIGHEST_TEXTURE_STATE) + if (state > WINED3D_HIGHEST_TEXTURE_STATE) { - WARN("Invalid Type %d passed.\n", Type); + WARN("Invalid state %#x passed.\n", state); return WINED3D_OK; } - *pValue = This->updateStateBlock->state.texture_states[Stage][Type]; - TRACE("Returning %#x.\n", *pValue); + *value = device->updateStateBlock->state.texture_states[stage][state]; + TRACE("Returning %#x.\n", *value); return WINED3D_OK; } -/***** - * Get / Set Texture - *****/ -static HRESULT WINAPI IWineD3DDeviceImpl_SetTexture(IWineD3DDevice *iface, - DWORD stage, IWineD3DBaseTexture *texture) +HRESULT CDECL wined3d_device_set_texture(struct wined3d_device *device, + UINT stage, struct wined3d_texture *texture) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - const struct wined3d_gl_info *gl_info = &This->adapter->gl_info; - IWineD3DBaseTexture *prev; + const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; + struct wined3d_texture *prev; - TRACE("iface %p, stage %u, texture %p.\n", iface, stage, texture); + TRACE("device %p, stage %u, texture %p.\n", device, stage, texture); if (stage >= WINED3DVERTEXTEXTURESAMPLER0 && stage <= WINED3DVERTEXTEXTURESAMPLER3) stage -= (WINED3DVERTEXTEXTURESAMPLER0 - MAX_FRAGMENT_SAMPLERS); /* Windows accepts overflowing this array... we do not. */ - if (stage >= sizeof(This->stateBlock->state.textures) / sizeof(*This->stateBlock->state.textures)) + if (stage >= sizeof(device->stateBlock->state.textures) / sizeof(*device->stateBlock->state.textures)) { WARN("Ignoring invalid stage %u.\n", stage); return WINED3D_OK; } /* SetTexture isn't allowed on textures in WINED3DPOOL_SCRATCH */ - if (texture && ((IWineD3DTextureImpl *)texture)->resource.pool == WINED3DPOOL_SCRATCH) + if (texture && texture->resource.pool == WINED3DPOOL_SCRATCH) { WARN("Rejecting attempt to set scratch texture.\n"); return WINED3DERR_INVALIDCALL; } - This->updateStateBlock->changed.textures |= 1 << stage; + device->updateStateBlock->changed.textures |= 1 << stage; - prev = (IWineD3DBaseTexture *)This->updateStateBlock->state.textures[stage]; + prev = device->updateStateBlock->state.textures[stage]; TRACE("Previous texture %p.\n", prev); if (texture == prev) @@ -4362,55 +3747,53 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetTexture(IWineD3DDevice *iface, } TRACE("Setting new texture to %p.\n", texture); - This->updateStateBlock->state.textures[stage] = (IWineD3DBaseTextureImpl *)texture; + device->updateStateBlock->state.textures[stage] = texture; - if (This->isRecordingState) + if (device->isRecordingState) { TRACE("Recording... not performing anything\n"); - if (texture) IWineD3DBaseTexture_AddRef(texture); - if (prev) IWineD3DBaseTexture_Release(prev); + if (texture) wined3d_texture_incref(texture); + if (prev) wined3d_texture_decref(prev); return WINED3D_OK; } if (texture) { - IWineD3DBaseTextureImpl *t = (IWineD3DBaseTextureImpl *)texture; - LONG bind_count = InterlockedIncrement(&t->baseTexture.bindCount); - GLenum dimensions = t->baseTexture.target; + LONG bind_count = InterlockedIncrement(&texture->bind_count); - IWineD3DBaseTexture_AddRef(texture); + wined3d_texture_incref(texture); - if (!prev || dimensions != ((IWineD3DBaseTextureImpl *)prev)->baseTexture.target) - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_PIXELSHADER); + if (!prev || texture->target != prev->target) + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_PIXELSHADER); if (!prev && stage < gl_info->limits.texture_stages) { /* The source arguments for color and alpha ops have different * meanings when a NULL texture is bound, so the COLOROP and * ALPHAOP have to be dirtified. */ - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_TEXTURESTAGE(stage, WINED3DTSS_COLOROP)); - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_TEXTURESTAGE(stage, WINED3DTSS_ALPHAOP)); + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_TEXTURESTAGE(stage, WINED3DTSS_COLOROP)); + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_TEXTURESTAGE(stage, WINED3DTSS_ALPHAOP)); } - if (bind_count == 1) t->baseTexture.sampler = stage; + if (bind_count == 1) + texture->sampler = stage; } if (prev) { - IWineD3DBaseTextureImpl *t = (IWineD3DBaseTextureImpl *)prev; - LONG bind_count = InterlockedDecrement(&t->baseTexture.bindCount); + LONG bind_count = InterlockedDecrement(&prev->bind_count); - IWineD3DBaseTexture_Release(prev); + wined3d_texture_decref(prev); if (!texture && stage < gl_info->limits.texture_stages) { - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_TEXTURESTAGE(stage, WINED3DTSS_COLOROP)); - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_TEXTURESTAGE(stage, WINED3DTSS_ALPHAOP)); + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_TEXTURESTAGE(stage, WINED3DTSS_COLOROP)); + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_TEXTURESTAGE(stage, WINED3DTSS_ALPHAOP)); } - if (bind_count && t->baseTexture.sampler == stage) + if (bind_count && prev->sampler == stage) { unsigned int i; @@ -4419,66 +3802,62 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetTexture(IWineD3DDevice *iface, TRACE("Searching for other stages the texture is bound to.\n"); for (i = 0; i < MAX_COMBINED_SAMPLERS; ++i) { - if (This->updateStateBlock->state.textures[i] == t) + if (device->updateStateBlock->state.textures[i] == prev) { TRACE("Texture is also bound to stage %u.\n", i); - t->baseTexture.sampler = i; + prev->sampler = i; break; } } } } - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_SAMPLER(stage)); + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_SAMPLER(stage)); return WINED3D_OK; } -static HRESULT WINAPI IWineD3DDeviceImpl_GetTexture(IWineD3DDevice *iface, DWORD Stage, IWineD3DBaseTexture** ppTexture) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; +HRESULT CDECL wined3d_device_get_texture(struct wined3d_device *device, + UINT stage, struct wined3d_texture **texture) +{ + TRACE("device %p, stage %u, texture %p.\n", device, stage, texture); - TRACE("(%p) : Stage %#x, ppTexture %p\n", This, Stage, ppTexture); + if (stage >= WINED3DVERTEXTEXTURESAMPLER0 && stage <= WINED3DVERTEXTEXTURESAMPLER3) + stage -= (WINED3DVERTEXTEXTURESAMPLER0 - MAX_FRAGMENT_SAMPLERS); - if (Stage >= WINED3DVERTEXTEXTURESAMPLER0 && Stage <= WINED3DVERTEXTEXTURESAMPLER3) { - Stage -= (WINED3DVERTEXTEXTURESAMPLER0 - MAX_FRAGMENT_SAMPLERS); - } - - if (Stage >= sizeof(This->stateBlock->state.textures) / sizeof(*This->stateBlock->state.textures)) + if (stage >= sizeof(device->stateBlock->state.textures) / sizeof(*device->stateBlock->state.textures)) { - ERR("Current stage overflows textures array (stage %d)\n", Stage); + WARN("Ignoring invalid stage %u.\n", stage); return WINED3D_OK; /* Windows accepts overflowing this array ... we do not. */ } - *ppTexture = (IWineD3DBaseTexture *)This->stateBlock->state.textures[Stage]; - if (*ppTexture) - IWineD3DBaseTexture_AddRef(*ppTexture); + *texture = device->stateBlock->state.textures[stage]; + if (*texture) + wined3d_texture_incref(*texture); - TRACE("(%p) : Returning %p\n", This, *ppTexture); + TRACE("Returning %p.\n", *texture); return WINED3D_OK; } -/***** - * Get Back Buffer - *****/ -static HRESULT WINAPI IWineD3DDeviceImpl_GetBackBuffer(IWineD3DDevice *iface, UINT swapchain_idx, - UINT backbuffer_idx, WINED3DBACKBUFFER_TYPE backbuffer_type, IWineD3DSurface **backbuffer) +HRESULT CDECL wined3d_device_get_back_buffer(struct wined3d_device *device, UINT swapchain_idx, + UINT backbuffer_idx, WINED3DBACKBUFFER_TYPE backbuffer_type, struct wined3d_surface **backbuffer) { - IWineD3DSwapChain *swapchain; + struct wined3d_swapchain *swapchain; HRESULT hr; - TRACE("iface %p, swapchain_idx %u, backbuffer_idx %u, backbuffer_type %#x, backbuffer %p.\n", - iface, swapchain_idx, backbuffer_idx, backbuffer_type, backbuffer); + TRACE("device %p, swapchain_idx %u, backbuffer_idx %u, backbuffer_type %#x, backbuffer %p.\n", + device, swapchain_idx, backbuffer_idx, backbuffer_type, backbuffer); - hr = IWineD3DDeviceImpl_GetSwapChain(iface, swapchain_idx, &swapchain); + hr = wined3d_device_get_swapchain(device, swapchain_idx, &swapchain); if (FAILED(hr)) { WARN("Failed to get swapchain %u, hr %#x.\n", swapchain_idx, hr); return hr; } - hr = IWineD3DSwapChain_GetBackBuffer(swapchain, backbuffer_idx, backbuffer_type, backbuffer); - IWineD3DSwapChain_Release(swapchain); + hr = wined3d_swapchain_get_back_buffer(swapchain, backbuffer_idx, backbuffer_type, backbuffer); + wined3d_swapchain_decref(swapchain); if (FAILED(hr)) { WARN("Failed to get backbuffer %u, hr %#x.\n", backbuffer_idx, hr); @@ -4488,371 +3867,377 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetBackBuffer(IWineD3DDevice *iface, UI return WINED3D_OK; } -static HRESULT WINAPI IWineD3DDeviceImpl_GetDeviceCaps(IWineD3DDevice *iface, WINED3DCAPS* pCaps) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - WARN("(%p) : stub, calling idirect3d for now\n", This); - return IWineD3D_GetDeviceCaps(This->wined3d, This->adapter->ordinal, This->devType, pCaps); +HRESULT CDECL wined3d_device_get_device_caps(struct wined3d_device *device, WINED3DCAPS *caps) +{ + TRACE("device %p, caps %p.\n", device, caps); + + return wined3d_get_device_caps(device->wined3d, device->adapter->ordinal, device->devType, caps); } -static HRESULT WINAPI IWineD3DDeviceImpl_GetDisplayMode(IWineD3DDevice *iface, UINT iSwapChain, WINED3DDISPLAYMODE* pMode) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - IWineD3DSwapChain *swapChain; +HRESULT CDECL wined3d_device_get_display_mode(struct wined3d_device *device, + UINT swapchain_idx, WINED3DDISPLAYMODE *mode) +{ + struct wined3d_swapchain *swapchain; HRESULT hr; - if(iSwapChain > 0) { - hr = IWineD3DDeviceImpl_GetSwapChain(iface, iSwapChain, &swapChain); - if (hr == WINED3D_OK) { - hr = IWineD3DSwapChain_GetDisplayMode(swapChain, pMode); - IWineD3DSwapChain_Release(swapChain); - } else { - FIXME("(%p) Error getting display mode\n", This); - } - } else { - /* Don't read the real display mode, - but return the stored mode instead. X11 can't change the color - depth, and some apps are pretty angry if they SetDisplayMode from - 24 to 16 bpp and find out that GetDisplayMode still returns 24 bpp + TRACE("device %p, swapchain_idx %u, mode %p.\n", device, swapchain_idx, mode); - Also don't relay to the swapchain because with ddraw it's possible - that there isn't a swapchain at all */ - pMode->Width = This->ddraw_width; - pMode->Height = This->ddraw_height; - pMode->Format = This->ddraw_format; - pMode->RefreshRate = 0; + if (swapchain_idx) + { + hr = wined3d_device_get_swapchain(device, swapchain_idx, &swapchain); + if (SUCCEEDED(hr)) + { + hr = wined3d_swapchain_get_display_mode(swapchain, mode); + wined3d_swapchain_decref(swapchain); + } + } + else + { + /* Don't read the real display mode, but return the stored mode + * instead. X11 can't change the color depth, and some apps are + * pretty angry if they SetDisplayMode from 24 to 16 bpp and find out + * that GetDisplayMode still returns 24 bpp. + * + * Also don't relay to the swapchain because with ddraw it's possible + * that there isn't a swapchain at all. */ + mode->Width = device->ddraw_width; + mode->Height = device->ddraw_height; + mode->Format = device->ddraw_format; + mode->RefreshRate = 0; hr = WINED3D_OK; } return hr; } -/***** - * Stateblock related functions - *****/ - -static HRESULT WINAPI IWineD3DDeviceImpl_BeginStateBlock(IWineD3DDevice *iface) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - IWineD3DStateBlock *stateblock; +HRESULT CDECL wined3d_device_begin_stateblock(struct wined3d_device *device) +{ + struct wined3d_stateblock *stateblock; HRESULT hr; - TRACE("(%p)\n", This); + TRACE("device %p.\n", device); - if (This->isRecordingState) return WINED3DERR_INVALIDCALL; + if (device->isRecordingState) + return WINED3DERR_INVALIDCALL; - hr = IWineD3DDeviceImpl_CreateStateBlock(iface, WINED3DSBT_RECORDED, &stateblock); - if (FAILED(hr)) return hr; + hr = wined3d_stateblock_create(device, WINED3DSBT_RECORDED, &stateblock); + if (FAILED(hr)) + return hr; - IWineD3DStateBlock_Release((IWineD3DStateBlock*)This->updateStateBlock); - This->updateStateBlock = (IWineD3DStateBlockImpl *)stateblock; - This->isRecordingState = TRUE; + wined3d_stateblock_decref(device->updateStateBlock); + device->updateStateBlock = stateblock; + device->isRecordingState = TRUE; - TRACE("(%p) recording stateblock %p\n", This, stateblock); + TRACE("Recording stateblock %p.\n", stateblock); return WINED3D_OK; } -static HRESULT WINAPI IWineD3DDeviceImpl_EndStateBlock(IWineD3DDevice *iface, IWineD3DStateBlock** ppStateBlock) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - IWineD3DStateBlockImpl *object = This->updateStateBlock; +HRESULT CDECL wined3d_device_end_stateblock(struct wined3d_device *device, + struct wined3d_stateblock **stateblock) +{ + struct wined3d_stateblock *object = device->updateStateBlock; - if (!This->isRecordingState) { - WARN("(%p) not recording! returning error\n", This); - *ppStateBlock = NULL; + TRACE("device %p, stateblock %p.\n", device, stateblock); + + if (!device->isRecordingState) + { + WARN("Not recording.\n"); + *stateblock = NULL; return WINED3DERR_INVALIDCALL; } stateblock_init_contained_states(object); - *ppStateBlock = (IWineD3DStateBlock*) object; - This->isRecordingState = FALSE; - This->updateStateBlock = This->stateBlock; - IWineD3DStateBlock_AddRef((IWineD3DStateBlock*)This->updateStateBlock); - /* IWineD3DStateBlock_AddRef(*ppStateBlock); don't need to do this, since we should really just release UpdateStateBlock first */ - TRACE("(%p) returning token (ptr to stateblock) of %p\n", This, *ppStateBlock); + *stateblock = object; + device->isRecordingState = FALSE; + device->updateStateBlock = device->stateBlock; + wined3d_stateblock_incref(device->updateStateBlock); + + TRACE("Returning stateblock %p.\n", *stateblock); + return WINED3D_OK; } -/***** - * Scene related functions - *****/ -static HRESULT WINAPI IWineD3DDeviceImpl_BeginScene(IWineD3DDevice *iface) { +HRESULT CDECL wined3d_device_begin_scene(struct wined3d_device *device) +{ /* At the moment we have no need for any functionality at the beginning - of a scene */ - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - TRACE("(%p)\n", This); + * of a scene. */ + TRACE("device %p.\n", device); - if(This->inScene) { - TRACE("Already in Scene, returning WINED3DERR_INVALIDCALL\n"); + if (device->inScene) + { + WARN("Already in scene, returning WINED3DERR_INVALIDCALL.\n"); return WINED3DERR_INVALIDCALL; } - This->inScene = TRUE; + device->inScene = TRUE; return WINED3D_OK; } -static HRESULT WINAPI IWineD3DDeviceImpl_EndScene(IWineD3DDevice *iface) +HRESULT CDECL wined3d_device_end_scene(struct wined3d_device *device) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; struct wined3d_context *context; - TRACE("(%p)\n", This); + TRACE("device %p.\n", device); - if(!This->inScene) { - TRACE("Not in scene, returning WINED3DERR_INVALIDCALL\n"); + if (!device->inScene) + { + WARN("Not in scene, returning WINED3DERR_INVALIDCALL.\n"); return WINED3DERR_INVALIDCALL; } - context = context_acquire(This, NULL); + context = context_acquire(device, NULL); /* We only have to do this if we need to read the, swapbuffers performs a flush for us */ wglFlush(); /* No checkGLcall here to avoid locking the lock just for checking a call that hardly ever * fails. */ context_release(context); - This->inScene = FALSE; + device->inScene = FALSE; return WINED3D_OK; } -static HRESULT WINAPI IWineD3DDeviceImpl_Present(IWineD3DDevice *iface, - const RECT *pSourceRect, const RECT *pDestRect, - HWND hDestWindowOverride, const RGNDATA *pDirtyRegion) +HRESULT CDECL wined3d_device_present(struct wined3d_device *device, const RECT *src_rect, + const RECT *dst_rect, HWND dst_window_override, const RGNDATA *dirty_region) { - IWineD3DSwapChain *swapChain = NULL; - int i; - int swapchains = IWineD3DDeviceImpl_GetNumberOfSwapChains(iface); + UINT i; - TRACE("iface %p.\n", iface); + TRACE("device %p, src_rect %s, dst_rect %s, dst_window_override %p, dirty_region %p.\n", + device, wine_dbgstr_rect(src_rect), wine_dbgstr_rect(dst_rect), + dst_window_override, dirty_region); - for(i = 0 ; i < swapchains ; i ++) { - - IWineD3DDeviceImpl_GetSwapChain(iface, i, &swapChain); - TRACE("Presenting chain %d, %p.\n", i, swapChain); - IWineD3DSwapChain_Present(swapChain, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion, 0); - IWineD3DSwapChain_Release(swapChain); + for (i = 0; i < device->swapchain_count; ++i) + { + wined3d_swapchain_present(device->swapchains[i], src_rect, + dst_rect, dst_window_override, dirty_region, 0); } return WINED3D_OK; } /* Do not call while under the GL lock. */ -static HRESULT WINAPI IWineD3DDeviceImpl_Clear(IWineD3DDevice *iface, DWORD rect_count, +HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_count, const RECT *rects, DWORD flags, WINED3DCOLOR color, float depth, DWORD stencil) { const WINED3DCOLORVALUE c = {D3DCOLOR_R(color), D3DCOLOR_G(color), D3DCOLOR_B(color), D3DCOLOR_A(color)}; - IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface; RECT draw_rect; - TRACE("iface %p, rect_count %u, rects %p, flags %#x, color 0x%08x, depth %.8e, stencil %u.\n", - iface, rect_count, rects, flags, color, depth, stencil); + TRACE("device %p, rect_count %u, rects %p, flags %#x, color 0x%08x, depth %.8e, stencil %u.\n", + device, rect_count, rects, flags, color, depth, stencil); - if (flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL) && !device->depth_stencil) + if (flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL)) { - WARN("Clearing depth and/or stencil without a depth stencil buffer attached, returning WINED3DERR_INVALIDCALL\n"); - /* TODO: What about depth stencil buffers without stencil bits? */ - return WINED3DERR_INVALIDCALL; + struct wined3d_surface *ds = device->fb.depth_stencil; + if (!ds) + { + WARN("Clearing depth and/or stencil without a depth stencil buffer attached, returning WINED3DERR_INVALIDCALL\n"); + /* TODO: What about depth stencil buffers without stencil bits? */ + return WINED3DERR_INVALIDCALL; + } + else if (flags & WINED3DCLEAR_TARGET) + { + if (ds->resource.width < device->fb.render_targets[0]->resource.width + || ds->resource.height < device->fb.render_targets[0]->resource.height) + { + WARN("Silently ignoring depth and target clear with mismatching sizes\n"); + return WINED3D_OK; + } + } } device_get_draw_rect(device, &draw_rect); return device_clear_render_targets(device, device->adapter->gl_info.limits.buffers, - device->render_targets, rect_count, rects, &draw_rect, flags, &c, depth, stencil); + device->fb.render_targets, device->fb.depth_stencil, rect_count, rects, + &draw_rect, flags, &c, depth, stencil); } -/***** - * Drawing functions - *****/ - -static void WINAPI IWineD3DDeviceImpl_SetPrimitiveType(IWineD3DDevice *iface, +void CDECL wined3d_device_set_primitive_type(struct wined3d_device *device, WINED3DPRIMITIVETYPE primitive_type) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; + TRACE("device %p, primitive_type %s\n", device, debug_d3dprimitivetype(primitive_type)); - TRACE("iface %p, primitive_type %s\n", iface, debug_d3dprimitivetype(primitive_type)); - - This->updateStateBlock->changed.primitive_type = TRUE; - This->updateStateBlock->state.gl_primitive_type = gl_primitive_type_from_d3d(primitive_type); + device->updateStateBlock->changed.primitive_type = TRUE; + device->updateStateBlock->state.gl_primitive_type = gl_primitive_type_from_d3d(primitive_type); } -static void WINAPI IWineD3DDeviceImpl_GetPrimitiveType(IWineD3DDevice *iface, +void CDECL wined3d_device_get_primitive_type(struct wined3d_device *device, WINED3DPRIMITIVETYPE *primitive_type) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; + TRACE("device %p, primitive_type %p\n", device, primitive_type); - TRACE("iface %p, primitive_type %p\n", iface, primitive_type); - - *primitive_type = d3d_primitive_type_from_gl(This->stateBlock->state.gl_primitive_type); + *primitive_type = d3d_primitive_type_from_gl(device->stateBlock->state.gl_primitive_type); TRACE("Returning %s\n", debug_d3dprimitivetype(*primitive_type)); } -static HRESULT WINAPI IWineD3DDeviceImpl_DrawPrimitive(IWineD3DDevice *iface, UINT StartVertex, UINT vertex_count) +HRESULT CDECL wined3d_device_draw_primitive(struct wined3d_device *device, UINT start_vertex, UINT vertex_count) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; + TRACE("device %p, start_vertex %u, vertex_count %u.\n", device, start_vertex, vertex_count); - TRACE("(%p) : start %u, count %u\n", This, StartVertex, vertex_count); - - if (!This->stateBlock->state.vertex_declaration) + if (!device->stateBlock->state.vertex_declaration) { - WARN("(%p) : Called without a valid vertex declaration set\n", This); + WARN("Called without a valid vertex declaration set.\n"); return WINED3DERR_INVALIDCALL; } /* The index buffer is not needed here, but restore it, otherwise it is hell to keep track of */ - if (This->stateBlock->state.user_stream) + if (device->stateBlock->state.user_stream) { - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_INDEXBUFFER); - This->stateBlock->state.user_stream = FALSE; + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_INDEXBUFFER); + device->stateBlock->state.user_stream = FALSE; } - if (This->stateBlock->state.load_base_vertex_index) + if (device->stateBlock->state.load_base_vertex_index) { - This->stateBlock->state.load_base_vertex_index = 0; - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_STREAMSRC); + device->stateBlock->state.load_base_vertex_index = 0; + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_STREAMSRC); } - /* Account for the loading offset due to index buffers. Instead of reloading all sources correct it with the startvertex parameter */ - drawPrimitive(iface, vertex_count, StartVertex /* start_idx */, 0 /* indxSize */, NULL /* indxData */); + + /* Account for the loading offset due to index buffers. Instead of + * reloading all sources correct it with the startvertex parameter. */ + drawPrimitive(device, vertex_count, start_vertex, 0, NULL); return WINED3D_OK; } -static HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitive(IWineD3DDevice *iface, UINT startIndex, UINT index_count) +HRESULT CDECL wined3d_device_draw_indexed_primitive(struct wined3d_device *device, UINT start_idx, UINT index_count) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; struct wined3d_buffer *index_buffer; - UINT idxStride = 2; + UINT index_size = 2; GLuint vbo; - index_buffer = This->stateBlock->state.index_buffer; + TRACE("device %p, start_idx %u, index_count %u.\n", device, start_idx, index_count); + + index_buffer = device->stateBlock->state.index_buffer; if (!index_buffer) { /* D3D9 returns D3DERR_INVALIDCALL when DrawIndexedPrimitive is called * without an index buffer set. (The first time at least...) * D3D8 simply dies, but I doubt it can do much harm to return * D3DERR_INVALIDCALL there as well. */ - WARN("(%p) : Called without a valid index buffer set, returning WINED3DERR_INVALIDCALL\n", This); + WARN("Called without a valid index buffer set, returning WINED3DERR_INVALIDCALL.\n"); return WINED3DERR_INVALIDCALL; } - if (!This->stateBlock->state.vertex_declaration) + if (!device->stateBlock->state.vertex_declaration) { - WARN("(%p) : Called without a valid vertex declaration set\n", This); + WARN("Called without a valid vertex declaration set.\n"); return WINED3DERR_INVALIDCALL; } - if (This->stateBlock->state.user_stream) + if (device->stateBlock->state.user_stream) { - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_INDEXBUFFER); - This->stateBlock->state.user_stream = FALSE; + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_INDEXBUFFER); + device->stateBlock->state.user_stream = FALSE; } vbo = index_buffer->buffer_object; - TRACE("(%p) : startIndex %u, index count %u.\n", This, startIndex, index_count); - - if (This->stateBlock->state.index_format == WINED3DFMT_R16_UINT) - idxStride = 2; + if (device->stateBlock->state.index_format == WINED3DFMT_R16_UINT) + index_size = 2; else - idxStride = 4; + index_size = 4; - if (This->stateBlock->state.load_base_vertex_index != This->stateBlock->state.base_vertex_index) + if (device->stateBlock->state.load_base_vertex_index != device->stateBlock->state.base_vertex_index) { - This->stateBlock->state.load_base_vertex_index = This->stateBlock->state.base_vertex_index; - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_STREAMSRC); + device->stateBlock->state.load_base_vertex_index = device->stateBlock->state.base_vertex_index; + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_STREAMSRC); } - drawPrimitive(iface, index_count, startIndex, idxStride, + drawPrimitive(device, index_count, start_idx, index_size, vbo ? NULL : index_buffer->resource.allocatedMemory); return WINED3D_OK; } -static HRESULT WINAPI IWineD3DDeviceImpl_DrawPrimitiveUP(IWineD3DDevice *iface, UINT vertex_count, - const void *pVertexStreamZeroData, UINT VertexStreamZeroStride) +HRESULT CDECL wined3d_device_draw_primitive_up(struct wined3d_device *device, UINT vertex_count, + const void *stream_data, UINT stream_stride) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; struct wined3d_stream_state *stream; - IWineD3DBuffer *vb; + struct wined3d_buffer *vb; - TRACE("(%p) : vertex count %u, pVtxData %p, stride %u\n", - This, vertex_count, pVertexStreamZeroData, VertexStreamZeroStride); + TRACE("device %p, vertex count %u, stream_data %p, stream_stride %u.\n", + device, vertex_count, stream_data, stream_stride); - if (!This->stateBlock->state.vertex_declaration) + if (!device->stateBlock->state.vertex_declaration) { - WARN("(%p) : Called without a valid vertex declaration set\n", This); + WARN("Called without a valid vertex declaration set.\n"); return WINED3DERR_INVALIDCALL; } /* Note in the following, it's not this type, but that's the purpose of streamIsUP */ - stream = &This->stateBlock->state.streams[0]; - vb = (IWineD3DBuffer *)stream->buffer; - stream->buffer = (struct wined3d_buffer *)pVertexStreamZeroData; - if (vb) IWineD3DBuffer_Release(vb); + stream = &device->stateBlock->state.streams[0]; + vb = stream->buffer; + stream->buffer = (struct wined3d_buffer *)stream_data; + if (vb) + wined3d_buffer_decref(vb); stream->offset = 0; - stream->stride = VertexStreamZeroStride; - This->stateBlock->state.user_stream = TRUE; - This->stateBlock->state.load_base_vertex_index = 0; + stream->stride = stream_stride; + device->stateBlock->state.user_stream = TRUE; + device->stateBlock->state.load_base_vertex_index = 0; /* TODO: Only mark dirty if drawing from a different UP address */ - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_STREAMSRC); + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_STREAMSRC); - drawPrimitive(iface, vertex_count, 0 /* start_idx */, 0 /* indxSize*/, NULL /* indxData */); + drawPrimitive(device, vertex_count, 0, 0, NULL); /* MSDN specifies stream zero settings must be set to NULL */ stream->buffer = NULL; stream->stride = 0; - /* stream zero settings set to null at end, as per the msdn. No need to mark dirty here, the app has to set - * the new stream sources or use UP drawing again - */ + /* stream zero settings set to null at end, as per the msdn. No need to + * mark dirty here, the app has to set the new stream sources or use UP + * drawing again. */ return WINED3D_OK; } -static HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitiveUP(IWineD3DDevice *iface, - UINT index_count, const void *pIndexData, enum wined3d_format_id IndexDataFormat, - const void *pVertexStreamZeroData, UINT VertexStreamZeroStride) +HRESULT CDECL wined3d_device_draw_indexed_primitive_up(struct wined3d_device *device, + UINT index_count, const void *index_data, enum wined3d_format_id index_data_format_id, + const void *stream_data, UINT stream_stride) { - int idxStride; - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; struct wined3d_stream_state *stream; - IWineD3DBuffer *vb; - IWineD3DBuffer *ib; + struct wined3d_buffer *vb, *ib; + UINT index_size; - TRACE("(%p) : index count %u, pidxdata %p, IdxFmt %u, pVtxdata %p, stride=%u.\n", - This, index_count, pIndexData, IndexDataFormat, pVertexStreamZeroData, VertexStreamZeroStride); + TRACE("device %p, index_count %u, index_data %p, index_data_format %s, stream_data %p, stream_stride %u.\n", + device, index_count, index_data, debug_d3dformat(index_data_format_id), stream_data, stream_stride); - if (!This->stateBlock->state.vertex_declaration) + if (!device->stateBlock->state.vertex_declaration) { - WARN("(%p) : Called without a valid vertex declaration set\n", This); + WARN("(%p) : Called without a valid vertex declaration set\n", device); return WINED3DERR_INVALIDCALL; } - if (IndexDataFormat == WINED3DFMT_R16_UINT) { - idxStride = 2; - } else { - idxStride = 4; - } + if (index_data_format_id == WINED3DFMT_R16_UINT) + index_size = 2; + else + index_size = 4; - stream = &This->stateBlock->state.streams[0]; - vb = (IWineD3DBuffer *)stream->buffer; - stream->buffer = (struct wined3d_buffer *)pVertexStreamZeroData; - if (vb) IWineD3DBuffer_Release(vb); + stream = &device->stateBlock->state.streams[0]; + vb = stream->buffer; + stream->buffer = (struct wined3d_buffer *)stream_data; + if (vb) + wined3d_buffer_decref(vb); stream->offset = 0; - stream->stride = VertexStreamZeroStride; - This->stateBlock->state.user_stream = TRUE; + stream->stride = stream_stride; + device->stateBlock->state.user_stream = TRUE; /* Set to 0 as per msdn. Do it now due to the stream source loading during drawPrimitive */ - This->stateBlock->state.base_vertex_index = 0; - This->stateBlock->state.load_base_vertex_index = 0; + device->stateBlock->state.base_vertex_index = 0; + device->stateBlock->state.load_base_vertex_index = 0; /* Mark the state dirty until we have nicer tracking of the stream source pointers */ - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VDECL); - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_INDEXBUFFER); + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_VDECL); + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_INDEXBUFFER); - drawPrimitive(iface, index_count, 0 /* start_idx */, idxStride, pIndexData); + drawPrimitive(device, index_count, 0, index_size, index_data); /* MSDN specifies stream zero settings and index buffer must be set to NULL */ stream->buffer = NULL; stream->stride = 0; - ib = (IWineD3DBuffer *)This->stateBlock->state.index_buffer; + ib = device->stateBlock->state.index_buffer; if (ib) { - IWineD3DBuffer_Release(ib); - This->stateBlock->state.index_buffer = NULL; + wined3d_buffer_decref(ib); + device->stateBlock->state.index_buffer = NULL; } /* No need to mark the stream source state dirty here. Either the app calls UP drawing again, or it has to call * SetStreamSource to specify a vertex buffer @@ -4861,86 +4246,82 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitiveUP(IWineD3DDevice * return WINED3D_OK; } -static HRESULT WINAPI IWineD3DDeviceImpl_DrawPrimitiveStrided(IWineD3DDevice *iface, - UINT vertex_count, const WineDirect3DVertexStridedData *DrawPrimStrideData) +HRESULT CDECL wined3d_device_draw_primitive_strided(struct wined3d_device *device, + UINT vertex_count, const WineDirect3DVertexStridedData *strided_data) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface; - - /* Mark the state dirty until we have nicer tracking - * its fine to change baseVertexIndex because that call is only called by ddraw which does not need - * that value. - */ - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VDECL); - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_INDEXBUFFER); - This->stateBlock->state.base_vertex_index = 0; - This->up_strided = DrawPrimStrideData; - drawPrimitive(iface, vertex_count, 0, 0, NULL); - This->up_strided = NULL; + /* Mark the state dirty until we have nicer tracking. It's fine to change + * baseVertexIndex because that call is only called by ddraw which does + * not need that value. */ + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_VDECL); + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_INDEXBUFFER); + device->stateBlock->state.base_vertex_index = 0; + device->up_strided = strided_data; + drawPrimitive(device, vertex_count, 0, 0, NULL); + device->up_strided = NULL; return WINED3D_OK; } -static HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitiveStrided(IWineD3DDevice *iface, - UINT vertex_count, const WineDirect3DVertexStridedData *DrawPrimStrideData, - UINT NumVertices, const void *pIndexData, enum wined3d_format_id IndexDataFormat) +HRESULT CDECL wined3d_device_draw_indexed_primitive_strided(struct wined3d_device *device, + UINT index_count, const WineDirect3DVertexStridedData *strided_data, + UINT vertex_count, const void *index_data, enum wined3d_format_id index_data_format_id) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface; - DWORD idxSize = (IndexDataFormat == WINED3DFMT_R32_UINT ? 4 : 2); + UINT index_size = index_data_format_id == WINED3DFMT_R32_UINT ? 4 : 2; /* Mark the state dirty until we have nicer tracking * its fine to change baseVertexIndex because that call is only called by ddraw which does not need * that value. */ - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VDECL); - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_INDEXBUFFER); - This->stateBlock->state.user_stream = TRUE; - This->stateBlock->state.base_vertex_index = 0; - This->up_strided = DrawPrimStrideData; - drawPrimitive(iface, vertex_count, 0 /* start_idx */, idxSize, pIndexData); - This->up_strided = NULL; + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_VDECL); + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_INDEXBUFFER); + device->stateBlock->state.user_stream = TRUE; + device->stateBlock->state.base_vertex_index = 0; + device->up_strided = strided_data; + drawPrimitive(device, index_count, 0, index_size, index_data); + device->up_strided = NULL; return WINED3D_OK; } /* This is a helper function for UpdateTexture, there is no UpdateVolume method in D3D. */ -static HRESULT IWineD3DDeviceImpl_UpdateVolume(IWineD3DDevice *iface, - IWineD3DVolume *pSourceVolume, IWineD3DVolume *pDestinationVolume) +static HRESULT IWineD3DDeviceImpl_UpdateVolume(struct wined3d_device *device, + struct wined3d_volume *src_volume, struct wined3d_volume *dst_volume) { WINED3DLOCKED_BOX src; WINED3DLOCKED_BOX dst; HRESULT hr; - TRACE("iface %p, src_volume %p, dst_volume %p.\n", - iface, pSourceVolume, pDestinationVolume); + TRACE("device %p, src_volume %p, dst_volume %p.\n", + device, src_volume, dst_volume); - /* TODO: Implement direct loading into the gl volume instead of using memcpy and - * dirtification to improve loading performance. - */ - hr = IWineD3DVolume_LockBox(pSourceVolume, &src, NULL, WINED3DLOCK_READONLY); - if(FAILED(hr)) return hr; - hr = IWineD3DVolume_LockBox(pDestinationVolume, &dst, NULL, WINED3DLOCK_DISCARD); - if(FAILED(hr)) { - IWineD3DVolume_UnlockBox(pSourceVolume); - return hr; + /* TODO: Implement direct loading into the gl volume instead of using + * memcpy and dirtification to improve loading performance. */ + hr = wined3d_volume_map(src_volume, &src, NULL, WINED3DLOCK_READONLY); + if (FAILED(hr)) return hr; + hr = wined3d_volume_map(dst_volume, &dst, NULL, WINED3DLOCK_DISCARD); + if (FAILED(hr)) + { + wined3d_volume_unmap(src_volume); + return hr; } - memcpy(dst.pBits, src.pBits, ((IWineD3DVolumeImpl *) pDestinationVolume)->resource.size); + memcpy(dst.pBits, src.pBits, dst_volume->resource.size); + + hr = wined3d_volume_unmap(dst_volume); + if (FAILED(hr)) + wined3d_volume_unmap(src_volume); + else + hr = wined3d_volume_unmap(src_volume); - hr = IWineD3DVolume_UnlockBox(pDestinationVolume); - if(FAILED(hr)) { - IWineD3DVolume_UnlockBox(pSourceVolume); - } else { - hr = IWineD3DVolume_UnlockBox(pSourceVolume); - } return hr; } -static HRESULT WINAPI IWineD3DDeviceImpl_UpdateTexture(IWineD3DDevice *iface, - IWineD3DBaseTexture *src_texture, IWineD3DBaseTexture *dst_texture) +HRESULT CDECL wined3d_device_update_texture(struct wined3d_device *device, + struct wined3d_texture *src_texture, struct wined3d_texture *dst_texture) { unsigned int level_count, i; WINED3DRESOURCETYPE type; HRESULT hr; - TRACE("iface %p, src_texture %p, dst_texture %p.\n", iface, src_texture, dst_texture); + TRACE("device %p, src_texture %p, dst_texture %p.\n", device, src_texture, dst_texture); /* Verify that the source and destination textures are non-NULL. */ if (!src_texture || !dst_texture) @@ -4956,39 +4337,37 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateTexture(IWineD3DDevice *iface, } /* Verify that the source and destination textures are the same type. */ - type = IWineD3DBaseTexture_GetType(src_texture); - if (IWineD3DBaseTexture_GetType(dst_texture) != type) + type = wined3d_texture_get_type(src_texture); + if (wined3d_texture_get_type(dst_texture) != type) { WARN("Source and destination have different types, returning WINED3DERR_INVALIDCALL.\n"); return WINED3DERR_INVALIDCALL; } /* Check that both textures have the identical numbers of levels. */ - level_count = IWineD3DBaseTexture_GetLevelCount(src_texture); - if (IWineD3DBaseTexture_GetLevelCount(dst_texture) != level_count) + level_count = wined3d_texture_get_level_count(src_texture); + if (wined3d_texture_get_level_count(dst_texture) != level_count) { WARN("Source and destination have different level counts, returning WINED3DERR_INVALIDCALL.\n"); return WINED3DERR_INVALIDCALL; } /* Make sure that the destination texture is loaded. */ - ((IWineD3DBaseTextureImpl *)dst_texture)->baseTexture.internal_preload(dst_texture, SRGB_RGB); + dst_texture->texture_ops->texture_preload(dst_texture, SRGB_RGB); /* Update every surface level of the texture. */ switch (type) { case WINED3DRTYPE_TEXTURE: { - IWineD3DSurface *src_surface; - IWineD3DSurface *dst_surface; + struct wined3d_surface *src_surface; + struct wined3d_surface *dst_surface; for (i = 0; i < level_count; ++i) { - IWineD3DTexture_GetSurfaceLevel((IWineD3DTexture *)src_texture, i, &src_surface); - IWineD3DTexture_GetSurfaceLevel((IWineD3DTexture *)dst_texture, i, &dst_surface); - hr = IWineD3DDevice_UpdateSurface(iface, src_surface, NULL, dst_surface, NULL); - IWineD3DSurface_Release(dst_surface); - IWineD3DSurface_Release(src_surface); + src_surface = surface_from_resource(wined3d_texture_get_sub_resource(src_texture, i)); + dst_surface = surface_from_resource(wined3d_texture_get_sub_resource(dst_texture, i)); + hr = wined3d_device_update_surface(device, src_surface, NULL, dst_surface, NULL); if (FAILED(hr)) { WARN("IWineD3DDevice_UpdateSurface failed, hr %#x.\n", hr); @@ -5000,29 +4379,18 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateTexture(IWineD3DDevice *iface, case WINED3DRTYPE_CUBETEXTURE: { - IWineD3DSurface *src_surface; - IWineD3DSurface *dst_surface; - WINED3DCUBEMAP_FACES face; + struct wined3d_surface *src_surface; + struct wined3d_surface *dst_surface; - for (i = 0; i < level_count; ++i) + for (i = 0; i < level_count * 6; ++i) { - /* Update each cube face. */ - for (face = WINED3DCUBEMAP_FACE_POSITIVE_X; face <= WINED3DCUBEMAP_FACE_NEGATIVE_Z; ++face) + src_surface = surface_from_resource(wined3d_texture_get_sub_resource(src_texture, i)); + dst_surface = surface_from_resource(wined3d_texture_get_sub_resource(dst_texture, i)); + hr = wined3d_device_update_surface(device, src_surface, NULL, dst_surface, NULL); + if (FAILED(hr)) { - hr = IWineD3DCubeTexture_GetCubeMapSurface((IWineD3DCubeTexture *)src_texture, - face, i, &src_surface); - if (FAILED(hr)) ERR("Failed to get src cube surface face %u, level %u, hr %#x.\n", face, i, hr); - hr = IWineD3DCubeTexture_GetCubeMapSurface((IWineD3DCubeTexture *)dst_texture, - face, i, &dst_surface); - if (FAILED(hr)) ERR("Failed to get dst cube surface face %u, level %u, hr %#x.\n", face, i, hr); - hr = IWineD3DDevice_UpdateSurface(iface, src_surface, NULL, dst_surface, NULL); - IWineD3DSurface_Release(dst_surface); - IWineD3DSurface_Release(src_surface); - if (FAILED(hr)) - { - WARN("IWineD3DDevice_UpdateSurface failed, hr %#x.\n", hr); - return hr; - } + WARN("IWineD3DDevice_UpdateSurface failed, hr %#x.\n", hr); + return hr; } } break; @@ -5030,16 +4398,11 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateTexture(IWineD3DDevice *iface, case WINED3DRTYPE_VOLUMETEXTURE: { - IWineD3DVolume *src_volume; - IWineD3DVolume *dst_volume; - for (i = 0; i < level_count; ++i) { - IWineD3DVolumeTexture_GetVolumeLevel((IWineD3DVolumeTexture *)src_texture, i, &src_volume); - IWineD3DVolumeTexture_GetVolumeLevel((IWineD3DVolumeTexture *)dst_texture, i, &dst_volume); - hr = IWineD3DDeviceImpl_UpdateVolume(iface, src_volume, dst_volume); - IWineD3DVolume_Release(dst_volume); - IWineD3DVolume_Release(src_volume); + hr = IWineD3DDeviceImpl_UpdateVolume(device, + volume_from_resource(wined3d_texture_get_sub_resource(src_texture, i)), + volume_from_resource(wined3d_texture_get_sub_resource(dst_texture, i))); if (FAILED(hr)) { WARN("IWineD3DDeviceImpl_UpdateVolume failed, hr %#x.\n", hr); @@ -5057,78 +4420,93 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateTexture(IWineD3DDevice *iface, return WINED3D_OK; } -static HRESULT WINAPI IWineD3DDeviceImpl_GetFrontBufferData(IWineD3DDevice *iface, - UINT swapchain_idx, IWineD3DSurface *dst_surface) +HRESULT CDECL wined3d_device_get_front_buffer_data(struct wined3d_device *device, + UINT swapchain_idx, struct wined3d_surface *dst_surface) { - IWineD3DSwapChain *swapchain; + struct wined3d_swapchain *swapchain; HRESULT hr; - TRACE("iface %p, swapchain_idx %u, dst_surface %p.\n", iface, swapchain_idx, dst_surface); + TRACE("device %p, swapchain_idx %u, dst_surface %p.\n", device, swapchain_idx, dst_surface); - hr = IWineD3DDeviceImpl_GetSwapChain(iface, swapchain_idx, &swapchain); + hr = wined3d_device_get_swapchain(device, swapchain_idx, &swapchain); if (FAILED(hr)) return hr; - hr = IWineD3DSwapChain_GetFrontBufferData(swapchain, dst_surface); - IWineD3DSwapChain_Release(swapchain); + hr = wined3d_swapchain_get_front_buffer_data(swapchain, dst_surface); + wined3d_swapchain_decref(swapchain); return hr; } -static HRESULT WINAPI IWineD3DDeviceImpl_ValidateDevice(IWineD3DDevice *iface, DWORD* pNumPasses) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - IWineD3DBaseTextureImpl *texture; +HRESULT CDECL wined3d_device_validate_device(struct wined3d_device *device, DWORD *num_passes) +{ + const struct wined3d_state *state = &device->stateBlock->state; + struct wined3d_texture *texture; DWORD i; - TRACE("(%p) : %p\n", This, pNumPasses); + TRACE("device %p, num_passes %p.\n", device, num_passes); for (i = 0; i < MAX_COMBINED_SAMPLERS; ++i) { - if (This->stateBlock->state.sampler_states[i][WINED3DSAMP_MINFILTER] == WINED3DTEXF_NONE) + if (state->sampler_states[i][WINED3DSAMP_MINFILTER] == WINED3DTEXF_NONE) { WARN("Sampler state %u has minfilter D3DTEXF_NONE, returning D3DERR_UNSUPPORTEDTEXTUREFILTER\n", i); return WINED3DERR_UNSUPPORTEDTEXTUREFILTER; } - if (This->stateBlock->state.sampler_states[i][WINED3DSAMP_MAGFILTER] == WINED3DTEXF_NONE) + if (state->sampler_states[i][WINED3DSAMP_MAGFILTER] == WINED3DTEXF_NONE) { WARN("Sampler state %u has magfilter D3DTEXF_NONE, returning D3DERR_UNSUPPORTEDTEXTUREFILTER\n", i); return WINED3DERR_UNSUPPORTEDTEXTUREFILTER; } - texture = This->stateBlock->state.textures[i]; - if (!texture || texture->resource.format->Flags & WINED3DFMT_FLAG_FILTERING) continue; + texture = state->textures[i]; + if (!texture || texture->resource.format->flags & WINED3DFMT_FLAG_FILTERING) continue; - if (This->stateBlock->state.sampler_states[i][WINED3DSAMP_MAGFILTER] != WINED3DTEXF_POINT) + if (state->sampler_states[i][WINED3DSAMP_MAGFILTER] != WINED3DTEXF_POINT) { WARN("Non-filterable texture and mag filter enabled on samper %u, returning E_FAIL\n", i); return E_FAIL; } - if (This->stateBlock->state.sampler_states[i][WINED3DSAMP_MINFILTER] != WINED3DTEXF_POINT) + if (state->sampler_states[i][WINED3DSAMP_MINFILTER] != WINED3DTEXF_POINT) { WARN("Non-filterable texture and min filter enabled on samper %u, returning E_FAIL\n", i); return E_FAIL; } - if (This->stateBlock->state.sampler_states[i][WINED3DSAMP_MIPFILTER] != WINED3DTEXF_NONE - && This->stateBlock->state.sampler_states[i][WINED3DSAMP_MIPFILTER] != WINED3DTEXF_POINT) + if (state->sampler_states[i][WINED3DSAMP_MIPFILTER] != WINED3DTEXF_NONE + && state->sampler_states[i][WINED3DSAMP_MIPFILTER] != WINED3DTEXF_POINT) { WARN("Non-filterable texture and mip filter enabled on samper %u, returning E_FAIL\n", i); return E_FAIL; } } + if (state->render_states[WINED3DRS_ZENABLE] || state->render_states[WINED3DRS_ZWRITEENABLE] || + state->render_states[WINED3DRS_STENCILENABLE]) + { + struct wined3d_surface *ds = device->fb.depth_stencil; + struct wined3d_surface *target = device->fb.render_targets[0]; + + if(ds && target + && (ds->resource.width < target->resource.width || ds->resource.height < target->resource.height)) + { + WARN("Depth stencil is smaller than the color buffer, returning D3DERR_CONFLICTINGRENDERSTATE\n"); + return WINED3DERR_CONFLICTINGRENDERSTATE; + } + } + /* return a sensible default */ - *pNumPasses = 1; + *num_passes = 1; TRACE("returning D3D_OK\n"); return WINED3D_OK; } -static void dirtify_p8_texture_samplers(IWineD3DDeviceImpl *device) +static void dirtify_p8_texture_samplers(struct wined3d_device *device) { - int i; + UINT i; for (i = 0; i < MAX_COMBINED_SAMPLERS; ++i) { - IWineD3DBaseTextureImpl *texture = device->stateBlock->state.textures[i]; + struct wined3d_texture *texture = device->stateBlock->state.textures[i]; if (texture && (texture->resource.format->id == WINED3DFMT_P8_UINT || texture->resource.format->id == WINED3DFMT_P8_UINT_A8_UNORM)) { @@ -5137,147 +4515,172 @@ static void dirtify_p8_texture_samplers(IWineD3DDeviceImpl *device) } } -static HRESULT WINAPI IWineD3DDeviceImpl_SetPaletteEntries(IWineD3DDevice *iface, UINT PaletteNumber, CONST PALETTEENTRY* pEntries) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - int j; - UINT NewSize; - PALETTEENTRY **palettes; +HRESULT CDECL wined3d_device_set_palette_entries(struct wined3d_device *device, + UINT palette_idx, const PALETTEENTRY *entries) +{ + UINT i; - TRACE("(%p) : PaletteNumber %u\n", This, PaletteNumber); + TRACE("device %p, palette_idx %u, entries %p.\n", device, palette_idx, entries); - if (PaletteNumber >= MAX_PALETTES) { - ERR("(%p) : (%u) Out of range 0-%u, returning Invalid Call\n", This, PaletteNumber, MAX_PALETTES); + if (palette_idx >= MAX_PALETTES) + { + WARN("Invalid palette index %u.\n", palette_idx); return WINED3DERR_INVALIDCALL; } - if (PaletteNumber >= This->NumberOfPalettes) { - NewSize = This->NumberOfPalettes; - do { - NewSize *= 2; - } while(PaletteNumber >= NewSize); - palettes = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->palettes, sizeof(PALETTEENTRY*) * NewSize); - if (!palettes) { + if (palette_idx >= device->palette_count) + { + UINT new_size = device->palette_count; + PALETTEENTRY **palettes; + + do + { + new_size *= 2; + } while (palette_idx >= new_size); + palettes = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, device->palettes, sizeof(*palettes) * new_size); + if (!palettes) + { ERR("Out of memory!\n"); return E_OUTOFMEMORY; } - This->palettes = palettes; - This->NumberOfPalettes = NewSize; + device->palettes = palettes; + device->palette_count = new_size; } - if (!This->palettes[PaletteNumber]) { - This->palettes[PaletteNumber] = HeapAlloc(GetProcessHeap(), 0, sizeof(PALETTEENTRY) * 256); - if (!This->palettes[PaletteNumber]) { + if (!device->palettes[palette_idx]) + { + device->palettes[palette_idx] = HeapAlloc(GetProcessHeap(), 0, sizeof(PALETTEENTRY) * 256); + if (!device->palettes[palette_idx]) + { ERR("Out of memory!\n"); return E_OUTOFMEMORY; } } - for (j = 0; j < 256; ++j) { - This->palettes[PaletteNumber][j].peRed = pEntries[j].peRed; - This->palettes[PaletteNumber][j].peGreen = pEntries[j].peGreen; - This->palettes[PaletteNumber][j].peBlue = pEntries[j].peBlue; - This->palettes[PaletteNumber][j].peFlags = pEntries[j].peFlags; - } - if (PaletteNumber == This->currentPalette) dirtify_p8_texture_samplers(This); - TRACE("(%p) : returning\n", This); - return WINED3D_OK; -} - -static HRESULT WINAPI IWineD3DDeviceImpl_GetPaletteEntries(IWineD3DDevice *iface, UINT PaletteNumber, PALETTEENTRY* pEntries) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - int j; - TRACE("(%p) : PaletteNumber %u\n", This, PaletteNumber); - if (PaletteNumber >= This->NumberOfPalettes || !This->palettes[PaletteNumber]) { - /* What happens in such situation isn't documented; Native seems to silently abort - on such conditions. Return Invalid Call. */ - ERR("(%p) : (%u) Nonexistent palette. NumberOfPalettes %u\n", This, PaletteNumber, This->NumberOfPalettes); - return WINED3DERR_INVALIDCALL; - } - for (j = 0; j < 256; ++j) { - pEntries[j].peRed = This->palettes[PaletteNumber][j].peRed; - pEntries[j].peGreen = This->palettes[PaletteNumber][j].peGreen; - pEntries[j].peBlue = This->palettes[PaletteNumber][j].peBlue; - pEntries[j].peFlags = This->palettes[PaletteNumber][j].peFlags; - } - TRACE("(%p) : returning\n", This); - return WINED3D_OK; -} - -static HRESULT WINAPI IWineD3DDeviceImpl_SetCurrentTexturePalette(IWineD3DDevice *iface, UINT PaletteNumber) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - TRACE("(%p) : PaletteNumber %u\n", This, PaletteNumber); - /* Native appears to silently abort on attempt to make an uninitialized palette current and render. - (tested with reference rasterizer). Return Invalid Call. */ - if (PaletteNumber >= This->NumberOfPalettes || !This->palettes[PaletteNumber]) { - ERR("(%p) : (%u) Nonexistent palette. NumberOfPalettes %u\n", This, PaletteNumber, This->NumberOfPalettes); - return WINED3DERR_INVALIDCALL; - } - /*TODO: stateblocks */ - if (This->currentPalette != PaletteNumber) { - This->currentPalette = PaletteNumber; - dirtify_p8_texture_samplers(This); - } - TRACE("(%p) : returning\n", This); - return WINED3D_OK; -} - -static HRESULT WINAPI IWineD3DDeviceImpl_GetCurrentTexturePalette(IWineD3DDevice *iface, UINT* PaletteNumber) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - - if (!PaletteNumber) + for (i = 0; i < 256; ++i) { - WARN("(%p) : returning Invalid Call\n", This); - return WINED3DERR_INVALIDCALL; + device->palettes[palette_idx][i].peRed = entries[i].peRed; + device->palettes[palette_idx][i].peGreen = entries[i].peGreen; + device->palettes[palette_idx][i].peBlue = entries[i].peBlue; + device->palettes[palette_idx][i].peFlags = entries[i].peFlags; } - /*TODO: stateblocks */ - *PaletteNumber = This->currentPalette; - TRACE("(%p) : returning %u\n", This, *PaletteNumber); + + if (palette_idx == device->currentPalette) + dirtify_p8_texture_samplers(device); + return WINED3D_OK; } -static HRESULT WINAPI IWineD3DDeviceImpl_SetSoftwareVertexProcessing(IWineD3DDevice *iface, BOOL bSoftware) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; +HRESULT CDECL wined3d_device_get_palette_entries(struct wined3d_device *device, + UINT palette_idx, PALETTEENTRY *entries) +{ + UINT i; + + TRACE("device %p, palette_idx %u, entries %p.\n", device, palette_idx, entries); + + if (palette_idx >= device->palette_count || !device->palettes[palette_idx]) + { + /* What happens in such situation isn't documented; Native seems to + * silently abort on such conditions. */ + WARN("Invalid palette index %u.\n", palette_idx); + return WINED3DERR_INVALIDCALL; + } + + for (i = 0; i < 256; ++i) + { + entries[i].peRed = device->palettes[palette_idx][i].peRed; + entries[i].peGreen = device->palettes[palette_idx][i].peGreen; + entries[i].peBlue = device->palettes[palette_idx][i].peBlue; + entries[i].peFlags = device->palettes[palette_idx][i].peFlags; + } + + return WINED3D_OK; +} + +HRESULT CDECL wined3d_device_set_current_texture_palette(struct wined3d_device *device, UINT palette_idx) +{ + TRACE("device %p, palette_idx %u.\n", device, palette_idx); + + /* Native appears to silently abort on attempt to make an uninitialized + * palette current and render. (tested with reference rasterizer). */ + if (palette_idx >= device->palette_count || !device->palettes[palette_idx]) + { + WARN("Invalid palette index %u.\n", palette_idx); + return WINED3DERR_INVALIDCALL; + } + + /* TODO: stateblocks? */ + if (device->currentPalette != palette_idx) + { + device->currentPalette = palette_idx; + dirtify_p8_texture_samplers(device); + } + + return WINED3D_OK; +} + +HRESULT CDECL wined3d_device_get_current_texture_palette(struct wined3d_device *device, UINT *palette_idx) +{ + TRACE("device %p, palette_idx %p.\n", device, palette_idx); + + if (!palette_idx) + return WINED3DERR_INVALIDCALL; + + *palette_idx = device->currentPalette; + + return WINED3D_OK; +} + +HRESULT CDECL wined3d_device_set_software_vertex_processing(struct wined3d_device *device, BOOL software) +{ static BOOL warned; + + TRACE("device %p, software %#x.\n", device, software); + if (!warned) { - FIXME("(%p) : stub\n", This); + FIXME("device %p, software %#x stub!\n", device, software); warned = TRUE; } - This->softwareVertexProcessing = bSoftware; + device->softwareVertexProcessing = software; + return WINED3D_OK; } - -static BOOL WINAPI IWineD3DDeviceImpl_GetSoftwareVertexProcessing(IWineD3DDevice *iface) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; +BOOL CDECL wined3d_device_get_software_vertex_processing(struct wined3d_device *device) +{ static BOOL warned; + + TRACE("device %p.\n", device); + if (!warned) { - FIXME("(%p) : stub\n", This); + TRACE("device %p stub!\n", device); warned = TRUE; } - return This->softwareVertexProcessing; + + return device->softwareVertexProcessing; } -static HRESULT WINAPI IWineD3DDeviceImpl_GetRasterStatus(IWineD3DDevice *iface, +HRESULT CDECL wined3d_device_get_raster_status(struct wined3d_device *device, UINT swapchain_idx, WINED3DRASTER_STATUS *raster_status) { - IWineD3DSwapChain *swapchain; + struct wined3d_swapchain *swapchain; HRESULT hr; - TRACE("iface %p, swapchain_idx %u, raster_status %p.\n", - iface, swapchain_idx, raster_status); + TRACE("device %p, swapchain_idx %u, raster_status %p.\n", + device, swapchain_idx, raster_status); - hr = IWineD3DDeviceImpl_GetSwapChain(iface, swapchain_idx, &swapchain); + hr = wined3d_device_get_swapchain(device, swapchain_idx, &swapchain); if (FAILED(hr)) { WARN("Failed to get swapchain %u, hr %#x.\n", swapchain_idx, hr); return hr; } - hr = IWineD3DSwapChain_GetRasterStatus(swapchain, raster_status); - IWineD3DSwapChain_Release(swapchain); + hr = wined3d_swapchain_get_raster_status(swapchain, raster_status); + wined3d_swapchain_decref(swapchain); if (FAILED(hr)) { WARN("Failed to get raster status, hr %#x.\n", hr); @@ -5287,37 +4690,43 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetRasterStatus(IWineD3DDevice *iface, return WINED3D_OK; } -static HRESULT WINAPI IWineD3DDeviceImpl_SetNPatchMode(IWineD3DDevice *iface, float nSegments) +HRESULT CDECL wined3d_device_set_npatch_mode(struct wined3d_device *device, float segments) { static BOOL warned; - if(nSegments != 0.0f) { + + TRACE("device %p, segments %.8e.\n", device, segments); + + if (segments != 0.0f) + { if (!warned) { - FIXME("iface %p, nSegments %.8e stub!\n", iface, nSegments); + FIXME("device %p, segments %.8e stub!\n", device, segments); warned = TRUE; } } + return WINED3D_OK; } -static float WINAPI IWineD3DDeviceImpl_GetNPatchMode(IWineD3DDevice *iface) +float CDECL wined3d_device_get_npatch_mode(struct wined3d_device *device) { static BOOL warned; + + TRACE("device %p.\n", device); + if (!warned) { - FIXME("iface %p stub!\n", iface); + FIXME("device %p stub!\n", device); warned = TRUE; } + return 0.0f; } -static HRESULT WINAPI IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface, - IWineD3DSurface *src_surface, const RECT *src_rect, - IWineD3DSurface *dst_surface, const POINT *dst_point) +HRESULT CDECL wined3d_device_update_surface(struct wined3d_device *device, + struct wined3d_surface *src_surface, const RECT *src_rect, + struct wined3d_surface *dst_surface, const POINT *dst_point) { - IWineD3DSurfaceImpl *src_impl = (IWineD3DSurfaceImpl *)src_surface; - IWineD3DSurfaceImpl *dst_impl = (IWineD3DSurfaceImpl *)dst_surface; - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; const struct wined3d_format *src_format; const struct wined3d_format *dst_format; const struct wined3d_gl_info *gl_info; @@ -5330,19 +4739,19 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface, DWORD sampler; struct wined3d_format format; - TRACE("iface %p, src_surface %p, src_rect %s, dst_surface %p, dst_point %s.\n", - iface, src_surface, wine_dbgstr_rect(src_rect), + TRACE("device %p, src_surface %p, src_rect %s, dst_surface %p, dst_point %s.\n", + device, src_surface, wine_dbgstr_rect(src_rect), dst_surface, wine_dbgstr_point(dst_point)); - if (src_impl->resource.pool != WINED3DPOOL_SYSTEMMEM || dst_impl->resource.pool != WINED3DPOOL_DEFAULT) + if (src_surface->resource.pool != WINED3DPOOL_SYSTEMMEM || dst_surface->resource.pool != WINED3DPOOL_DEFAULT) { WARN("source %p must be SYSTEMMEM and dest %p must be DEFAULT, returning WINED3DERR_INVALIDCALL\n", src_surface, dst_surface); return WINED3DERR_INVALIDCALL; } - src_format = src_impl->resource.format; - dst_format = dst_impl->resource.format; + src_format = src_surface->resource.format; + dst_format = dst_surface->resource.format; if (src_format->id != dst_format->id) { @@ -5357,11 +4766,11 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface, * surface to the destination's sysmem copy. If surface conversion is * needed, use BltFast instead to copy in sysmem and use regular surface * loading. */ - d3dfmt_get_conv(dst_impl, FALSE, TRUE, &format, &convert); + d3dfmt_get_conv(dst_surface, FALSE, TRUE, &format, &convert); if (convert != NO_CONVERSION || format.convert) - return IWineD3DSurface_BltFast(dst_surface, dst_x, dst_y, src_surface, src_rect, 0); + return wined3d_surface_bltfast(dst_surface, dst_x, dst_y, src_surface, src_rect, 0); - context = context_acquire(This, NULL); + context = context_acquire(device, NULL); gl_info = context->gl_info; ENTER_GL(); @@ -5370,20 +4779,20 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface, LEAVE_GL(); /* Make sure the surface is loaded and up to date */ - surface_internal_preload(dst_impl, SRGB_RGB); - IWineD3DSurface_BindTexture(dst_surface, FALSE); + surface_internal_preload(dst_surface, SRGB_RGB); + surface_bind(dst_surface, gl_info, FALSE); - src_w = src_impl->currentDesc.Width; - src_h = src_impl->currentDesc.Height; + src_w = src_surface->resource.width; + src_h = src_surface->resource.height; update_w = src_rect ? src_rect->right - src_rect->left : src_w; update_h = src_rect ? src_rect->bottom - src_rect->top : src_h; - data = IWineD3DSurface_GetData(src_surface); + data = src_surface->resource.allocatedMemory; if (!data) ERR("Source surface has no allocated memory, but should be a sysmem surface.\n"); ENTER_GL(); - if (dst_format->Flags & WINED3DFMT_FLAG_COMPRESSED) + if (dst_format->flags & WINED3DFMT_FLAG_COMPRESSED) { UINT row_length = wined3d_format_calculate_size(src_format, 1, update_w, 1); UINT row_count = (update_h + src_format->block_height - 1) / src_format->block_height; @@ -5396,12 +4805,12 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface, } TRACE("glCompressedTexSubImage2DARB, target %#x, level %d, x %d, y %d, w %d, h %d, " - "format %#x, image_size %#x, data %p.\n", dst_impl->texture_target, dst_impl->texture_level, + "format %#x, image_size %#x, data %p.\n", dst_surface->texture_target, dst_surface->texture_level, dst_x, dst_y, update_w, update_h, dst_format->glFormat, row_count * row_length, data); if (row_length == src_pitch) { - GL_EXTCALL(glCompressedTexSubImage2DARB(dst_impl->texture_target, dst_impl->texture_level, + GL_EXTCALL(glCompressedTexSubImage2DARB(dst_surface->texture_target, dst_surface->texture_level, dst_x, dst_y, update_w, update_h, dst_format->glInternal, row_count * row_length, data)); } else @@ -5412,7 +4821,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface, * can't use the unpack row length like below. */ for (row = 0, y = dst_y; row < row_count; ++row) { - GL_EXTCALL(glCompressedTexSubImage2DARB(dst_impl->texture_target, dst_impl->texture_level, + GL_EXTCALL(glCompressedTexSubImage2DARB(dst_surface->texture_target, dst_surface->texture_level, dst_x, y, update_w, src_format->block_height, dst_format->glInternal, row_length, data)); y += src_format->block_height; data += src_pitch; @@ -5429,11 +4838,11 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface, } TRACE("glTexSubImage2D, target %#x, level %d, x %d, y %d, w %d, h %d, format %#x, type %#x, data %p.\n", - dst_impl->texture_target, dst_impl->texture_level, dst_x, dst_y, + dst_surface->texture_target, dst_surface->texture_level, dst_x, dst_y, update_w, update_h, dst_format->glFormat, dst_format->glType, data); glPixelStorei(GL_UNPACK_ROW_LENGTH, src_w); - glTexSubImage2D(dst_impl->texture_target, dst_impl->texture_level, dst_x, dst_y, + glTexSubImage2D(dst_surface->texture_target, dst_surface->texture_level, dst_x, dst_y, update_w, update_h, dst_format->glFormat, dst_format->glType, data); glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); checkGLcall("glTexSubImage2D"); @@ -5442,51 +4851,61 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface, LEAVE_GL(); context_release(context); - surface_modify_location(dst_impl, SFLAG_INTEXTURE, TRUE); - sampler = This->rev_tex_unit_map[0]; + surface_modify_location(dst_surface, SFLAG_INTEXTURE, TRUE); + sampler = device->rev_tex_unit_map[0]; if (sampler != WINED3D_UNMAPPED_STAGE) { - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_SAMPLER(sampler)); + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_SAMPLER(sampler)); } return WINED3D_OK; } -static HRESULT WINAPI IWineD3DDeviceImpl_DrawRectPatch(IWineD3DDevice *iface, UINT Handle, CONST float* pNumSegs, CONST WINED3DRECTPATCH_INFO* pRectPatchInfo) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; +HRESULT CDECL wined3d_device_draw_rect_patch(struct wined3d_device *device, UINT handle, + const float *num_segs, const WINED3DRECTPATCH_INFO *rect_patch_info) +{ struct WineD3DRectPatch *patch; GLenum old_primitive_type; unsigned int i; struct list *e; BOOL found; - TRACE("(%p) Handle(%d) noSegs(%p) rectpatch(%p)\n", This, Handle, pNumSegs, pRectPatchInfo); - if(!(Handle || pRectPatchInfo)) { + TRACE("device %p, handle %#x, num_segs %p, rect_patch_info %p.\n", + device, handle, num_segs, rect_patch_info); + + if (!(handle || rect_patch_info)) + { /* TODO: Write a test for the return value, thus the FIXME */ - FIXME("Both Handle and pRectPatchInfo are NULL\n"); + FIXME("Both handle and rect_patch_info are NULL.\n"); return WINED3DERR_INVALIDCALL; } - if(Handle) { - i = PATCHMAP_HASHFUNC(Handle); + if (handle) + { + i = PATCHMAP_HASHFUNC(handle); found = FALSE; - LIST_FOR_EACH(e, &This->patches[i]) { + LIST_FOR_EACH(e, &device->patches[i]) + { patch = LIST_ENTRY(e, struct WineD3DRectPatch, entry); - if(patch->Handle == Handle) { + if (patch->Handle == handle) + { found = TRUE; break; } } - if(!found) { + if (!found) + { TRACE("Patch does not exist. Creating a new one\n"); patch = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*patch)); - patch->Handle = Handle; - list_add_head(&This->patches[i], &patch->entry); + patch->Handle = handle; + list_add_head(&device->patches[i], &patch->entry); } else { TRACE("Found existing patch %p\n", patch); } - } else { + } + else + { /* Since opengl does not load tesselated vertex attributes into numbered vertex * attributes we have to tesselate, read back, and draw. This needs a patch * management structure instance. Create one. @@ -5498,68 +4917,73 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawRectPatch(IWineD3DDevice *iface, UI patch = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*patch)); } - if (pNumSegs[0] != patch->numSegs[0] || pNumSegs[1] != patch->numSegs[1] - || pNumSegs[2] != patch->numSegs[2] || pNumSegs[3] != patch->numSegs[3] - || (pRectPatchInfo && memcmp(pRectPatchInfo, &patch->RectPatchInfo, sizeof(*pRectPatchInfo)))) + if (num_segs[0] != patch->numSegs[0] || num_segs[1] != patch->numSegs[1] + || num_segs[2] != patch->numSegs[2] || num_segs[3] != patch->numSegs[3] + || (rect_patch_info && memcmp(rect_patch_info, &patch->RectPatchInfo, sizeof(*rect_patch_info)))) { HRESULT hr; TRACE("Tesselation density or patch info changed, retesselating\n"); - if(pRectPatchInfo) { - patch->RectPatchInfo = *pRectPatchInfo; - } - patch->numSegs[0] = pNumSegs[0]; - patch->numSegs[1] = pNumSegs[1]; - patch->numSegs[2] = pNumSegs[2]; - patch->numSegs[3] = pNumSegs[3]; + if (rect_patch_info) + patch->RectPatchInfo = *rect_patch_info; - hr = tesselate_rectpatch(This, patch); - if(FAILED(hr)) { - WARN("Patch tesselation failed\n"); + patch->numSegs[0] = num_segs[0]; + patch->numSegs[1] = num_segs[1]; + patch->numSegs[2] = num_segs[2]; + patch->numSegs[3] = num_segs[3]; + + hr = tesselate_rectpatch(device, patch); + if (FAILED(hr)) + { + WARN("Patch tesselation failed.\n"); /* Do not release the handle to store the params of the patch */ - if(!Handle) { + if (!handle) HeapFree(GetProcessHeap(), 0, patch); - } + return hr; } } - This->currentPatch = patch; - old_primitive_type = This->stateBlock->state.gl_primitive_type; - This->stateBlock->state.gl_primitive_type = GL_TRIANGLES; - IWineD3DDevice_DrawPrimitiveStrided(iface, patch->numSegs[0] * patch->numSegs[1] * 2 * 3, &patch->strided); - This->stateBlock->state.gl_primitive_type = old_primitive_type; - This->currentPatch = NULL; + device->currentPatch = patch; + old_primitive_type = device->stateBlock->state.gl_primitive_type; + device->stateBlock->state.gl_primitive_type = GL_TRIANGLES; + wined3d_device_draw_primitive_strided(device, patch->numSegs[0] * patch->numSegs[1] * 2 * 3, &patch->strided); + device->stateBlock->state.gl_primitive_type = old_primitive_type; + device->currentPatch = NULL; /* Destroy uncached patches */ - if(!Handle) { + if (!handle) + { HeapFree(GetProcessHeap(), 0, patch->mem); HeapFree(GetProcessHeap(), 0, patch); } return WINED3D_OK; } -static HRESULT WINAPI IWineD3DDeviceImpl_DrawTriPatch(IWineD3DDevice *iface, - UINT handle, const float *segment_count, const WINED3DTRIPATCH_INFO *patch_info) +HRESULT CDECL wined3d_device_draw_tri_patch(struct wined3d_device *device, UINT handle, + const float *segment_count, const WINED3DTRIPATCH_INFO *patch_info) { - FIXME("iface %p, handle %#x, segment_count %p, patch_info %p stub!\n", - iface, handle, segment_count, patch_info); + FIXME("device %p, handle %#x, segment_count %p, patch_info %p stub!\n", + device, handle, segment_count, patch_info); return WINED3D_OK; } -static HRESULT WINAPI IWineD3DDeviceImpl_DeletePatch(IWineD3DDevice *iface, UINT Handle) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - int i; +HRESULT CDECL wined3d_device_delete_patch(struct wined3d_device *device, UINT handle) +{ struct WineD3DRectPatch *patch; struct list *e; - TRACE("(%p) Handle(%d)\n", This, Handle); + int i; - i = PATCHMAP_HASHFUNC(Handle); - LIST_FOR_EACH(e, &This->patches[i]) { + TRACE("device %p, handle %#x.\n", device, handle); + + i = PATCHMAP_HASHFUNC(handle); + LIST_FOR_EACH(e, &device->patches[i]) + { patch = LIST_ENTRY(e, struct WineD3DRectPatch, entry); - if(patch->Handle == Handle) { + if (patch->Handle == handle) + { TRACE("Deleting patch %p\n", patch); list_remove(&patch->entry); HeapFree(GetProcessHeap(), 0, patch->mem); @@ -5574,59 +4998,45 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DeletePatch(IWineD3DDevice *iface, UINT } /* Do not call while under the GL lock. */ -static HRESULT WINAPI IWineD3DDeviceImpl_ColorFill(IWineD3DDevice *iface, - IWineD3DSurface *surface, const RECT *rect, const WINED3DCOLORVALUE *color) +HRESULT CDECL wined3d_device_color_fill(struct wined3d_device *device, + struct wined3d_surface *surface, const RECT *rect, const WINED3DCOLORVALUE *color) { - IWineD3DSurfaceImpl *s = (IWineD3DSurfaceImpl *)surface; - - TRACE("iface %p, surface %p, rect %s, color {%.8e, %.8e, %.8e, %.8e}.\n", - iface, surface, wine_dbgstr_rect(rect), + TRACE("device %p, surface %p, rect %s, color {%.8e, %.8e, %.8e, %.8e}.\n", + device, surface, wine_dbgstr_rect(rect), color->r, color->g, color->b, color->a); - if (s->resource.pool != WINED3DPOOL_DEFAULT && s->resource.pool != WINED3DPOOL_SYSTEMMEM) + if (surface->resource.pool != WINED3DPOOL_DEFAULT && surface->resource.pool != WINED3DPOOL_SYSTEMMEM) { FIXME("call to colorfill with non WINED3DPOOL_DEFAULT or WINED3DPOOL_SYSTEMMEM surface\n"); return WINED3DERR_INVALIDCALL; } - return surface_color_fill(s, rect, color); + return surface_color_fill(surface, rect, color); } /* Do not call while under the GL lock. */ -static void WINAPI IWineD3DDeviceImpl_ClearRendertargetView(IWineD3DDevice *iface, - IWineD3DRendertargetView *rendertarget_view, const WINED3DCOLORVALUE *color) +void CDECL wined3d_device_clear_rendertarget_view(struct wined3d_device *device, + struct wined3d_rendertarget_view *rendertarget_view, const WINED3DCOLORVALUE *color) { - IWineD3DResource *resource; + struct wined3d_resource *resource; HRESULT hr; - hr = IWineD3DRendertargetView_GetResource(rendertarget_view, &resource); - if (FAILED(hr)) - { - ERR("Failed to get resource, hr %#x\n", hr); - return; - } - - if (IWineD3DResource_GetType(resource) != WINED3DRTYPE_SURFACE) + resource = rendertarget_view->resource; + if (resource->resourceType != WINED3DRTYPE_SURFACE) { FIXME("Only supported on surface resources\n"); - IWineD3DResource_Release(resource); return; } - hr = surface_color_fill((IWineD3DSurfaceImpl *)resource, NULL, color); + hr = surface_color_fill(surface_from_resource(resource), NULL, color); if (FAILED(hr)) ERR("Color fill failed, hr %#x.\n", hr); - - IWineD3DResource_Release(resource); } -/* rendertarget and depth stencil functions */ -static HRESULT WINAPI IWineD3DDeviceImpl_GetRenderTarget(IWineD3DDevice *iface, - DWORD render_target_idx, IWineD3DSurface **render_target) +HRESULT CDECL wined3d_device_get_render_target(struct wined3d_device *device, + UINT render_target_idx, struct wined3d_surface **render_target) { - IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface; - - TRACE("iface %p, render_target_idx %u, render_target %p.\n", - iface, render_target_idx, render_target); + TRACE("device %p, render_target_idx %u, render_target %p.\n", + device, render_target_idx, render_target); if (render_target_idx >= device->adapter->gl_info.limits.buffers) { @@ -5634,36 +5044,37 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetRenderTarget(IWineD3DDevice *iface, return WINED3DERR_INVALIDCALL; } - *render_target = (IWineD3DSurface *)device->render_targets[render_target_idx]; - if (*render_target) IWineD3DSurface_AddRef(*render_target); + *render_target = device->fb.render_targets[render_target_idx]; + if (*render_target) + wined3d_surface_incref(*render_target); TRACE("Returning render target %p.\n", *render_target); return WINED3D_OK; } -static HRESULT WINAPI IWineD3DDeviceImpl_GetDepthStencilSurface(IWineD3DDevice *iface, IWineD3DSurface **depth_stencil) +HRESULT CDECL wined3d_device_get_depth_stencil(struct wined3d_device *device, struct wined3d_surface **depth_stencil) { - IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface; + TRACE("device %p, depth_stencil %p.\n", device, depth_stencil); - TRACE("iface %p, depth_stencil %p.\n", iface, depth_stencil); - - *depth_stencil = (IWineD3DSurface *)device->depth_stencil; + *depth_stencil = device->fb.depth_stencil; TRACE("Returning depth/stencil surface %p.\n", *depth_stencil); - if (!*depth_stencil) return WINED3DERR_NOTFOUND; - IWineD3DSurface_AddRef(*depth_stencil); + + if (!*depth_stencil) + return WINED3DERR_NOTFOUND; + + wined3d_surface_incref(*depth_stencil); return WINED3D_OK; } -static HRESULT WINAPI IWineD3DDeviceImpl_SetRenderTarget(IWineD3DDevice *iface, - DWORD render_target_idx, IWineD3DSurface *render_target, BOOL set_viewport) +HRESULT CDECL wined3d_device_set_render_target(struct wined3d_device *device, + UINT render_target_idx, struct wined3d_surface *render_target, BOOL set_viewport) { - IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)iface; - IWineD3DSurfaceImpl *prev; + struct wined3d_surface *prev; - TRACE("iface %p, render_target_idx %u, render_target %p, set_viewport %#x.\n", - iface, render_target_idx, render_target, set_viewport); + TRACE("device %p, render_target_idx %u, render_target %p, set_viewport %#x.\n", + device, render_target_idx, render_target, set_viewport); if (render_target_idx >= device->adapter->gl_info.limits.buffers) { @@ -5671,8 +5082,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetRenderTarget(IWineD3DDevice *iface, return WINED3DERR_INVALIDCALL; } - prev = device->render_targets[render_target_idx]; - if (render_target == (IWineD3DSurface *)prev) + prev = device->fb.render_targets[render_target_idx]; + if (render_target == prev) { TRACE("Trying to do a NOP SetRenderTarget operation.\n"); return WINED3D_OK; @@ -5685,17 +5096,19 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetRenderTarget(IWineD3DDevice *iface, return WINED3DERR_INVALIDCALL; } - if (render_target && !(((IWineD3DSurfaceImpl *)render_target)->resource.usage & WINED3DUSAGE_RENDERTARGET)) + if (render_target && !(render_target->resource.usage & WINED3DUSAGE_RENDERTARGET)) { FIXME("Surface %p doesn't have render target usage.\n", render_target); return WINED3DERR_INVALIDCALL; } - if (render_target) IWineD3DSurface_AddRef(render_target); - device->render_targets[render_target_idx] = (IWineD3DSurfaceImpl *)render_target; + if (render_target) + wined3d_surface_incref(render_target); + device->fb.render_targets[render_target_idx] = render_target; /* Release after the assignment, to prevent device_resource_released() * from seeing the surface as still in use. */ - if (prev) IWineD3DSurface_Release((IWineD3DSurface *)prev); + if (prev) + wined3d_surface_decref(prev); /* Render target 0 is special. */ if (!render_target_idx && set_viewport) @@ -5703,8 +5116,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetRenderTarget(IWineD3DDevice *iface, /* Set the viewport and scissor rectangles, if requested. Tests show * that stateblock recording is ignored, the change goes directly * into the primary stateblock. */ - device->stateBlock->state.viewport.Height = device->render_targets[0]->currentDesc.Height; - device->stateBlock->state.viewport.Width = device->render_targets[0]->currentDesc.Width; + device->stateBlock->state.viewport.Height = device->fb.render_targets[0]->resource.height; + device->stateBlock->state.viewport.Width = device->fb.render_targets[0]->resource.width; device->stateBlock->state.viewport.X = 0; device->stateBlock->state.viewport.Y = 0; device->stateBlock->state.viewport.MaxZ = 1.0f; @@ -5721,175 +5134,172 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetRenderTarget(IWineD3DDevice *iface, return WINED3D_OK; } -static HRESULT WINAPI IWineD3DDeviceImpl_SetDepthStencilSurface(IWineD3DDevice *iface, IWineD3DSurface *depth_stencil) +HRESULT CDECL wined3d_device_set_depth_stencil(struct wined3d_device *device, struct wined3d_surface *depth_stencil) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - IWineD3DSurfaceImpl *tmp; + struct wined3d_surface *prev = device->fb.depth_stencil; - TRACE("device %p, depth_stencil %p, old depth_stencil %p.\n", This, depth_stencil, This->depth_stencil); + TRACE("device %p, depth_stencil %p, old depth_stencil %p.\n", + device, depth_stencil, prev); - if (This->depth_stencil == (IWineD3DSurfaceImpl *)depth_stencil) + if (prev == depth_stencil) { TRACE("Trying to do a NOP SetRenderTarget operation.\n"); return WINED3D_OK; } - if (This->depth_stencil) + if (prev) { - if (((IWineD3DSwapChainImpl *)This->swapchains[0])->presentParms.Flags & WINED3DPRESENTFLAG_DISCARD_DEPTHSTENCIL - || This->depth_stencil->Flags & SFLAG_DISCARD) + if (device->swapchains[0]->presentParms.Flags & WINED3DPRESENTFLAG_DISCARD_DEPTHSTENCIL + || prev->flags & SFLAG_DISCARD) { - surface_modify_ds_location(This->depth_stencil, SFLAG_DS_DISCARDED, - This->depth_stencil->currentDesc.Width, - This->depth_stencil->currentDesc.Height); - if (This->depth_stencil == This->onscreen_depth_stencil) + surface_modify_ds_location(prev, SFLAG_DS_DISCARDED, + prev->resource.width, prev->resource.height); + if (prev == device->onscreen_depth_stencil) { - IWineD3DSurface_Release((IWineD3DSurface *)This->onscreen_depth_stencil); - This->onscreen_depth_stencil = NULL; + wined3d_surface_decref(device->onscreen_depth_stencil); + device->onscreen_depth_stencil = NULL; } } } - tmp = This->depth_stencil; - This->depth_stencil = (IWineD3DSurfaceImpl *)depth_stencil; - if (This->depth_stencil) IWineD3DSurface_AddRef((IWineD3DSurface *)This->depth_stencil); - if (tmp) IWineD3DSurface_Release((IWineD3DSurface *)tmp); + device->fb.depth_stencil = depth_stencil; + if (depth_stencil) + wined3d_surface_incref(depth_stencil); + if (prev) + wined3d_surface_decref(prev); - if ((!tmp && depth_stencil) || (!depth_stencil && tmp)) + if (!prev != !depth_stencil) { /* Swapping NULL / non NULL depth stencil affects the depth and tests */ - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_RENDER(WINED3DRS_ZENABLE)); - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_RENDER(WINED3DRS_STENCILENABLE)); - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_RENDER(WINED3DRS_STENCILWRITEMASK)); + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_RENDER(WINED3DRS_ZENABLE)); + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_RENDER(WINED3DRS_STENCILENABLE)); + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_RENDER(WINED3DRS_STENCILWRITEMASK)); + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_RENDER(WINED3DRS_DEPTHBIAS)); + } + else if (prev && prev->resource.format->depth_size != depth_stencil->resource.format->depth_size) + { + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_RENDER(WINED3DRS_DEPTHBIAS)); } return WINED3D_OK; } -static HRESULT WINAPI IWineD3DDeviceImpl_SetCursorProperties(IWineD3DDevice *iface, - UINT XHotSpot, UINT YHotSpot, IWineD3DSurface *cursor_image) +HRESULT CDECL wined3d_device_set_cursor_properties(struct wined3d_device *device, + UINT x_hotspot, UINT y_hotspot, struct wined3d_surface *cursor_image) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - IWineD3DSurfaceImpl *s = (IWineD3DSurfaceImpl *)cursor_image; WINED3DLOCKED_RECT lockedRect; - TRACE("iface %p, hotspot_x %u, hotspot_y %u, cursor_image %p.\n", - iface, XHotSpot, YHotSpot, cursor_image); + TRACE("device %p, x_hotspot %u, y_hotspot %u, cursor_image %p.\n", + device, x_hotspot, y_hotspot, cursor_image); /* some basic validation checks */ - if (This->cursorTexture) + if (device->cursorTexture) { - struct wined3d_context *context = context_acquire(This, NULL); + struct wined3d_context *context = context_acquire(device, NULL); ENTER_GL(); - glDeleteTextures(1, &This->cursorTexture); + glDeleteTextures(1, &device->cursorTexture); LEAVE_GL(); context_release(context); - This->cursorTexture = 0; + device->cursorTexture = 0; } - if ((s->currentDesc.Width == 32) && (s->currentDesc.Height == 32)) - This->haveHardwareCursor = TRUE; - else - This->haveHardwareCursor = FALSE; - if (cursor_image) { WINED3DLOCKED_RECT rect; /* MSDN: Cursor must be A8R8G8B8 */ - if (s->resource.format->id != WINED3DFMT_B8G8R8A8_UNORM) + if (cursor_image->resource.format->id != WINED3DFMT_B8G8R8A8_UNORM) { WARN("surface %p has an invalid format.\n", cursor_image); return WINED3DERR_INVALIDCALL; } /* MSDN: Cursor must be smaller than the display mode */ - if (s->currentDesc.Width > This->ddraw_width - || s->currentDesc.Height > This->ddraw_height) + if (cursor_image->resource.width > device->ddraw_width + || cursor_image->resource.height > device->ddraw_height) { WARN("Surface %p dimensions are %ux%u, but screen dimensions are %ux%u.\n", - s, s->currentDesc.Width, s->currentDesc.Height, This->ddraw_width, This->ddraw_height); + cursor_image, cursor_image->resource.width, cursor_image->resource.height, + device->ddraw_width, device->ddraw_height); return WINED3DERR_INVALIDCALL; } - if (!This->haveHardwareCursor) { - /* TODO: MSDN: Cursor sizes must be a power of 2 */ + /* TODO: MSDN: Cursor sizes must be a power of 2 */ - /* Do not store the surface's pointer because the application may - * release it after setting the cursor image. Windows doesn't - * addref the set surface, so we can't do this either without - * creating circular refcount dependencies. Copy out the gl texture - * instead. - */ - This->cursorWidth = s->currentDesc.Width; - This->cursorHeight = s->currentDesc.Height; - if (SUCCEEDED(IWineD3DSurface_LockRect(cursor_image, &rect, NULL, WINED3DLOCK_READONLY))) + /* Do not store the surface's pointer because the application may + * release it after setting the cursor image. Windows doesn't + * addref the set surface, so we can't do this either without + * creating circular refcount dependencies. Copy out the gl texture + * instead. */ + device->cursorWidth = cursor_image->resource.width; + device->cursorHeight = cursor_image->resource.height; + if (SUCCEEDED(wined3d_surface_map(cursor_image, &rect, NULL, WINED3DLOCK_READONLY))) + { + const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; + const struct wined3d_format *format = wined3d_get_format(gl_info, WINED3DFMT_B8G8R8A8_UNORM); + struct wined3d_context *context; + char *mem, *bits = rect.pBits; + GLint intfmt = format->glInternal; + GLint gl_format = format->glFormat; + GLint type = format->glType; + INT height = device->cursorHeight; + INT width = device->cursorWidth; + INT bpp = format->byte_count; + DWORD sampler; + INT i; + + /* Reformat the texture memory (pitch and width can be + * different) */ + mem = HeapAlloc(GetProcessHeap(), 0, width * height * bpp); + for(i = 0; i < height; i++) + memcpy(&mem[width * bpp * i], &bits[rect.Pitch * i], width * bpp); + wined3d_surface_unmap(cursor_image); + + context = context_acquire(device, NULL); + + ENTER_GL(); + + if (gl_info->supported[APPLE_CLIENT_STORAGE]) { - const struct wined3d_gl_info *gl_info = &This->adapter->gl_info; - const struct wined3d_format *format = wined3d_get_format(gl_info, WINED3DFMT_B8G8R8A8_UNORM); - struct wined3d_context *context; - char *mem, *bits = rect.pBits; - GLint intfmt = format->glInternal; - GLint gl_format = format->glFormat; - GLint type = format->glType; - INT height = This->cursorHeight; - INT width = This->cursorWidth; - INT bpp = format->byte_count; - DWORD sampler; - INT i; - - /* Reformat the texture memory (pitch and width can be - * different) */ - mem = HeapAlloc(GetProcessHeap(), 0, width * height * bpp); - for(i = 0; i < height; i++) - memcpy(&mem[width * bpp * i], &bits[rect.Pitch * i], width * bpp); - IWineD3DSurface_UnlockRect(cursor_image); - - context = context_acquire(This, NULL); - - ENTER_GL(); - - if (gl_info->supported[APPLE_CLIENT_STORAGE]) - { - glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE); - checkGLcall("glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE)"); - } - - /* Make sure that a proper texture unit is selected */ - GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB)); - checkGLcall("glActiveTextureARB"); - sampler = This->rev_tex_unit_map[0]; - if (sampler != WINED3D_UNMAPPED_STAGE) - { - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_SAMPLER(sampler)); - } - /* Create a new cursor texture */ - glGenTextures(1, &This->cursorTexture); - checkGLcall("glGenTextures"); - glBindTexture(GL_TEXTURE_2D, This->cursorTexture); - checkGLcall("glBindTexture"); - /* Copy the bitmap memory into the cursor texture */ - glTexImage2D(GL_TEXTURE_2D, 0, intfmt, width, height, 0, gl_format, type, mem); - HeapFree(GetProcessHeap(), 0, mem); - checkGLcall("glTexImage2D"); - - if (gl_info->supported[APPLE_CLIENT_STORAGE]) - { - glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE); - checkGLcall("glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE)"); - } - - LEAVE_GL(); - - context_release(context); + glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE); + checkGLcall("glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE)"); } - else + + /* Make sure that a proper texture unit is selected */ + GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB)); + checkGLcall("glActiveTextureARB"); + sampler = device->rev_tex_unit_map[0]; + if (sampler != WINED3D_UNMAPPED_STAGE) { - FIXME("A cursor texture was not returned.\n"); - This->cursorTexture = 0; + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_SAMPLER(sampler)); } + /* Create a new cursor texture */ + glGenTextures(1, &device->cursorTexture); + checkGLcall("glGenTextures"); + glBindTexture(GL_TEXTURE_2D, device->cursorTexture); + checkGLcall("glBindTexture"); + /* Copy the bitmap memory into the cursor texture */ + glTexImage2D(GL_TEXTURE_2D, 0, intfmt, width, height, 0, gl_format, type, mem); + checkGLcall("glTexImage2D"); + HeapFree(GetProcessHeap(), 0, mem); + + if (gl_info->supported[APPLE_CLIENT_STORAGE]) + { + glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE); + checkGLcall("glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE)"); + } + + LEAVE_GL(); + + context_release(context); } else + { + FIXME("A cursor texture was not returned.\n"); + device->cursorTexture = 0; + } + + if (cursor_image->resource.width == 32 && cursor_image->resource.height == 32) { /* Draw a hardware cursor */ ICONINFO cursorInfo; @@ -5898,104 +5308,126 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetCursorProperties(IWineD3DDevice *ifa * 32-bit cursors. 32x32 bits split into 32-bit chunks == 32 * chunks. */ DWORD *maskBits = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, - (s->currentDesc.Width * s->currentDesc.Height / 8)); - IWineD3DSurface_LockRect(cursor_image, &lockedRect, NULL, + (cursor_image->resource.width * cursor_image->resource.height / 8)); + wined3d_surface_map(cursor_image, &lockedRect, NULL, WINED3DLOCK_NO_DIRTY_UPDATE | WINED3DLOCK_READONLY); - TRACE("width: %u height: %u.\n", s->currentDesc.Width, s->currentDesc.Height); + TRACE("width: %u height: %u.\n", cursor_image->resource.width, cursor_image->resource.height); cursorInfo.fIcon = FALSE; - cursorInfo.xHotspot = XHotSpot; - cursorInfo.yHotspot = YHotSpot; - cursorInfo.hbmMask = CreateBitmap(s->currentDesc.Width, s->currentDesc.Height, 1, 1, maskBits); - cursorInfo.hbmColor = CreateBitmap(s->currentDesc.Width, s->currentDesc.Height, 1, 32, lockedRect.pBits); - IWineD3DSurface_UnlockRect(cursor_image); + cursorInfo.xHotspot = x_hotspot; + cursorInfo.yHotspot = y_hotspot; + cursorInfo.hbmMask = CreateBitmap(cursor_image->resource.width, cursor_image->resource.height, + 1, 1, maskBits); + cursorInfo.hbmColor = CreateBitmap(cursor_image->resource.width, cursor_image->resource.height, + 1, 32, lockedRect.pBits); + wined3d_surface_unmap(cursor_image); /* Create our cursor and clean up. */ cursor = CreateIconIndirect(&cursorInfo); - SetCursor(cursor); if (cursorInfo.hbmMask) DeleteObject(cursorInfo.hbmMask); if (cursorInfo.hbmColor) DeleteObject(cursorInfo.hbmColor); - if (This->hardwareCursor) DestroyCursor(This->hardwareCursor); - This->hardwareCursor = cursor; + if (device->hardwareCursor) DestroyCursor(device->hardwareCursor); + device->hardwareCursor = cursor; + if (device->bCursorVisible) SetCursor( cursor ); HeapFree(GetProcessHeap(), 0, maskBits); } } - This->xHotSpot = XHotSpot; - This->yHotSpot = YHotSpot; + device->xHotSpot = x_hotspot; + device->yHotSpot = y_hotspot; return WINED3D_OK; } -static void WINAPI IWineD3DDeviceImpl_SetCursorPosition(IWineD3DDevice* iface, int XScreenSpace, int YScreenSpace, DWORD Flags) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface; - TRACE("(%p) : SetPos to (%u,%u)\n", This, XScreenSpace, YScreenSpace); +void CDECL wined3d_device_set_cursor_position(struct wined3d_device *device, + int x_screen_space, int y_screen_space, DWORD flags) +{ + TRACE("device %p, x %d, y %d, flags %#x.\n", + device, x_screen_space, y_screen_space, flags); - This->xScreenSpace = XScreenSpace; - This->yScreenSpace = YScreenSpace; - - return; + device->xScreenSpace = x_screen_space; + device->yScreenSpace = y_screen_space; + /* switch to the software cursor if position diverges from the hardware one */ + if (device->hardwareCursor) + { + POINT pt; + GetCursorPos( &pt ); + if (x_screen_space != pt.x || y_screen_space != pt.y) + { + if (device->bCursorVisible) SetCursor( NULL ); + DestroyCursor( device->hardwareCursor ); + device->hardwareCursor = 0; + } + } } -static BOOL WINAPI IWineD3DDeviceImpl_ShowCursor(IWineD3DDevice* iface, BOOL bShow) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface; - BOOL oldVisible = This->bCursorVisible; - POINT pt; +BOOL CDECL wined3d_device_show_cursor(struct wined3d_device *device, BOOL show) +{ + BOOL oldVisible = device->bCursorVisible; - TRACE("(%p) : visible(%d)\n", This, bShow); + TRACE("device %p, show %#x.\n", device, show); /* * When ShowCursor is first called it should make the cursor appear at the OS's last - * known cursor position. Because of this, some applications just repetitively call - * ShowCursor in order to update the cursor's position. This behavior is undocumented. + * known cursor position. */ - GetCursorPos(&pt); - This->xScreenSpace = pt.x; - This->yScreenSpace = pt.y; + if (show && !oldVisible) + { + POINT pt; + GetCursorPos(&pt); + device->xScreenSpace = pt.x; + device->yScreenSpace = pt.y; + } - if (This->haveHardwareCursor) { - This->bCursorVisible = bShow; - if (bShow) - SetCursor(This->hardwareCursor); + if (device->hardwareCursor) + { + device->bCursorVisible = show; + if (show) + SetCursor(device->hardwareCursor); else SetCursor(NULL); } else { - if (This->cursorTexture) - This->bCursorVisible = bShow; + if (device->cursorTexture) + device->bCursorVisible = show; } return oldVisible; } -static HRESULT WINAPI evict_managed_resource(IWineD3DResource *resource, void *data) { +static HRESULT WINAPI evict_managed_resource(struct wined3d_resource *resource, void *data) +{ TRACE("checking resource %p for eviction\n", resource); - if(((IWineD3DResourceImpl *) resource)->resource.pool == WINED3DPOOL_MANAGED) { - TRACE("Evicting %p\n", resource); - IWineD3DResource_UnLoad(resource); + + if (resource->pool == WINED3DPOOL_MANAGED) + { + TRACE("Evicting %p.\n", resource); + resource->resource_ops->resource_unload(resource); } - IWineD3DResource_Release(resource); + return S_OK; } -static HRESULT WINAPI IWineD3DDeviceImpl_EvictManagedResources(IWineD3DDevice *iface) +HRESULT CDECL wined3d_device_evict_managed_resources(struct wined3d_device *device) { - TRACE("iface %p.\n", iface); + TRACE("device %p.\n", device); - IWineD3DDevice_EnumResources(iface, evict_managed_resource, NULL); + wined3d_device_enum_resources(device, evict_managed_resource, NULL); /* Invalidate stream sources, the buffer(s) may have been evicted. */ - IWineD3DDeviceImpl_MarkStateDirty((IWineD3DDeviceImpl *)iface, STATE_STREAMSRC); + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_STREAMSRC); return WINED3D_OK; } -static HRESULT updateSurfaceDesc(IWineD3DSurfaceImpl *surface, const WINED3DPRESENT_PARAMETERS* pPresentationParameters) +static HRESULT updateSurfaceDesc(struct wined3d_surface *surface, + const WINED3DPRESENT_PARAMETERS *pPresentationParameters) { - IWineD3DDeviceImpl *device = surface->resource.device; + struct wined3d_device *device = surface->resource.device; const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; /* Reallocate proper memory for the front and back buffer and adjust their sizes */ - if(surface->Flags & SFLAG_DIBSECTION) { + if (surface->flags & SFLAG_DIBSECTION) + { /* Release the DC */ SelectObject(surface->hDC, surface->dib.holdbitmap); DeleteDC(surface->hDC); @@ -6003,10 +5435,10 @@ static HRESULT updateSurfaceDesc(IWineD3DSurfaceImpl *surface, const WINED3DPRES DeleteObject(surface->dib.DIBsection); surface->dib.bitmap_data = NULL; surface->resource.allocatedMemory = NULL; - surface->Flags &= ~SFLAG_DIBSECTION; + surface->flags &= ~SFLAG_DIBSECTION; } - surface->currentDesc.Width = pPresentationParameters->BackBufferWidth; - surface->currentDesc.Height = pPresentationParameters->BackBufferHeight; + surface->resource.width = pPresentationParameters->BackBufferWidth; + surface->resource.height = pPresentationParameters->BackBufferHeight; if (gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO] || gl_info->supported[ARB_TEXTURE_RECTANGLE] || gl_info->supported[WINED3D_GL_NORMALIZED_TEXRECT]) { @@ -6026,18 +5458,21 @@ static HRESULT updateSurfaceDesc(IWineD3DSurfaceImpl *surface, const WINED3DPRES LEAVE_GL(); context_release(context); surface->texture_name = 0; - surface->Flags &= ~SFLAG_CLIENT; + surface->flags &= ~SFLAG_CLIENT; } - if(surface->pow2Width != pPresentationParameters->BackBufferWidth || - surface->pow2Height != pPresentationParameters->BackBufferHeight) { - surface->Flags |= SFLAG_NONPOW2; - } else { - surface->Flags &= ~SFLAG_NONPOW2; + if (surface->pow2Width != pPresentationParameters->BackBufferWidth + || surface->pow2Height != pPresentationParameters->BackBufferHeight) + { + surface->flags |= SFLAG_NONPOW2; + } + else + { + surface->flags &= ~SFLAG_NONPOW2; } HeapFree(GetProcessHeap(), 0, surface->resource.heapMemory); surface->resource.allocatedMemory = NULL; surface->resource.heapMemory = NULL; - surface->resource.size = IWineD3DSurface_GetPitch((IWineD3DSurface *) surface) * surface->pow2Width; + surface->resource.size = wined3d_surface_get_pitch(surface) * surface->pow2Width; /* Put all surfaces into sysmem - the drawable might disappear if the backbuffer was rendered * to a FBO */ @@ -6048,14 +5483,7 @@ static HRESULT updateSurfaceDesc(IWineD3DSurfaceImpl *surface, const WINED3DPRES return WINED3D_OK; } -static HRESULT WINAPI reset_unload_resources(IWineD3DResource *resource, void *data) { - TRACE("Unloading resource %p\n", resource); - IWineD3DResource_UnLoad(resource); - IWineD3DResource_Release(resource); - return S_OK; -} - -static BOOL is_display_mode_supported(IWineD3DDeviceImpl *This, const WINED3DPRESENT_PARAMETERS *pp) +static BOOL is_display_mode_supported(struct wined3d_device *device, const WINED3DPRESENT_PARAMETERS *pp) { UINT i, count; WINED3DDISPLAYMODE m; @@ -6066,61 +5494,62 @@ static BOOL is_display_mode_supported(IWineD3DDeviceImpl *This, const WINED3DPRE if(!pp->BackBufferWidth) return TRUE; if(!pp->BackBufferHeight) return TRUE; - count = IWineD3D_GetAdapterModeCount(This->wined3d, This->adapter->ordinal, WINED3DFMT_UNKNOWN); - for(i = 0; i < count; i++) { + count = wined3d_get_adapter_mode_count(device->wined3d, device->adapter->ordinal, WINED3DFMT_UNKNOWN); + for (i = 0; i < count; ++i) + { memset(&m, 0, sizeof(m)); - hr = IWineD3D_EnumAdapterModes(This->wined3d, This->adapter->ordinal, WINED3DFMT_UNKNOWN, i, &m); - if(FAILED(hr)) { - ERR("EnumAdapterModes failed\n"); - } - if(m.Width == pp->BackBufferWidth && m.Height == pp->BackBufferHeight) { - /* Mode found, it is supported */ + hr = wined3d_enum_adapter_modes(device->wined3d, device->adapter->ordinal, WINED3DFMT_UNKNOWN, i, &m); + if (FAILED(hr)) + ERR("Failed to enumerate adapter mode.\n"); + if (m.Width == pp->BackBufferWidth && m.Height == pp->BackBufferHeight) + /* Mode found, it is supported. */ return TRUE; - } } /* Mode not found -> not supported */ return FALSE; } /* Do not call while under the GL lock. */ -static void delete_opengl_contexts(IWineD3DDevice *iface, IWineD3DSwapChainImpl *swapchain) +static void delete_opengl_contexts(struct wined3d_device *device, struct wined3d_swapchain *swapchain) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface; const struct wined3d_gl_info *gl_info; struct wined3d_context *context; - IWineD3DBaseShaderImpl *shader; + struct wined3d_shader *shader; - context = context_acquire(This, NULL); + context = context_acquire(device, NULL); gl_info = context->gl_info; - IWineD3DDevice_EnumResources(iface, reset_unload_resources, NULL); - LIST_FOR_EACH_ENTRY(shader, &This->shaders, IWineD3DBaseShaderImpl, baseShader.shader_list_entry) { - This->shader_backend->shader_destroy((IWineD3DBaseShader *) shader); + wined3d_device_enum_resources(device, device_unload_resource, NULL); + LIST_FOR_EACH_ENTRY(shader, &device->shaders, struct wined3d_shader, shader_list_entry) + { + device->shader_backend->shader_destroy(shader); } ENTER_GL(); - if(This->depth_blt_texture) { - glDeleteTextures(1, &This->depth_blt_texture); - This->depth_blt_texture = 0; + if (device->depth_blt_texture) + { + glDeleteTextures(1, &device->depth_blt_texture); + device->depth_blt_texture = 0; } - if (This->depth_blt_rb) { - gl_info->fbo_ops.glDeleteRenderbuffers(1, &This->depth_blt_rb); - This->depth_blt_rb = 0; - This->depth_blt_rb_w = 0; - This->depth_blt_rb_h = 0; + if (device->depth_blt_rb) + { + gl_info->fbo_ops.glDeleteRenderbuffers(1, &device->depth_blt_rb); + device->depth_blt_rb = 0; + device->depth_blt_rb_w = 0; + device->depth_blt_rb_h = 0; } LEAVE_GL(); - This->blitter->free_private(iface); - This->frag_pipe->free_private(iface); - This->shader_backend->shader_free_private(iface); - destroy_dummy_textures(This, gl_info); + device->blitter->free_private(device); + device->frag_pipe->free_private(device); + device->shader_backend->shader_free_private(device); + destroy_dummy_textures(device, gl_info); context_release(context); - while (This->numContexts) + while (device->context_count) { - context_destroy(This, This->contexts[0]); + context_destroy(device, device->contexts[0]); } HeapFree(GetProcessHeap(), 0, swapchain->context); swapchain->context = NULL; @@ -6128,12 +5557,11 @@ static void delete_opengl_contexts(IWineD3DDevice *iface, IWineD3DSwapChainImpl } /* Do not call while under the GL lock. */ -static HRESULT create_primary_opengl_context(IWineD3DDevice *iface, IWineD3DSwapChainImpl *swapchain) +static HRESULT create_primary_opengl_context(struct wined3d_device *device, struct wined3d_swapchain *swapchain) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface; struct wined3d_context *context; + struct wined3d_surface *target; HRESULT hr; - IWineD3DSurfaceImpl *target; /* Recreate the primary swapchain's context */ swapchain->context = HeapAlloc(GetProcessHeap(), 0, sizeof(*swapchain->context)); @@ -6153,67 +5581,70 @@ static HRESULT create_primary_opengl_context(IWineD3DDevice *iface, IWineD3DSwap swapchain->context[0] = context; swapchain->num_contexts = 1; - create_dummy_textures(This); + create_dummy_textures(device); context_release(context); - hr = This->shader_backend->shader_alloc_private(iface); + hr = device->shader_backend->shader_alloc_private(device); if (FAILED(hr)) { ERR("Failed to allocate shader private data, hr %#x.\n", hr); goto err; } - hr = This->frag_pipe->alloc_private(iface); + hr = device->frag_pipe->alloc_private(device); if (FAILED(hr)) { ERR("Failed to allocate fragment pipe private data, hr %#x.\n", hr); - This->shader_backend->shader_free_private(iface); + device->shader_backend->shader_free_private(device); goto err; } - hr = This->blitter->alloc_private(iface); + hr = device->blitter->alloc_private(device); if (FAILED(hr)) { ERR("Failed to allocate blitter private data, hr %#x.\n", hr); - This->frag_pipe->free_private(iface); - This->shader_backend->shader_free_private(iface); + device->frag_pipe->free_private(device); + device->shader_backend->shader_free_private(device); goto err; } return WINED3D_OK; err: - context_acquire(This, NULL); - destroy_dummy_textures(This, context->gl_info); + context_acquire(device, NULL); + destroy_dummy_textures(device, context->gl_info); context_release(context); - context_destroy(This, context); + context_destroy(device, context); HeapFree(GetProcessHeap(), 0, swapchain->context); swapchain->num_contexts = 0; return hr; } /* Do not call while under the GL lock. */ -static HRESULT WINAPI IWineD3DDeviceImpl_Reset(IWineD3DDevice *iface, - WINED3DPRESENT_PARAMETERS *pPresentationParameters) +HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, + WINED3DPRESENT_PARAMETERS *present_parameters) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface; - IWineD3DSwapChainImpl *swapchain; - HRESULT hr; + struct wined3d_swapchain *swapchain; BOOL DisplayModeChanged = FALSE; WINED3DDISPLAYMODE mode; - TRACE("(%p)\n", This); + HRESULT hr; - hr = IWineD3DDevice_GetSwapChain(iface, 0, (IWineD3DSwapChain **) &swapchain); - if(FAILED(hr)) { + TRACE("device %p, present_parameters %p.\n", device, present_parameters); + + hr = wined3d_device_get_swapchain(device, 0, &swapchain); + if (FAILED(hr)) + { ERR("Failed to get the first implicit swapchain\n"); return hr; } - if(!is_display_mode_supported(This, pPresentationParameters)) { + if (!is_display_mode_supported(device, present_parameters)) + { WARN("Rejecting Reset() call because the requested display mode is not supported\n"); - WARN("Requested mode: %d, %d\n", pPresentationParameters->BackBufferWidth, - pPresentationParameters->BackBufferHeight); - IWineD3DSwapChain_Release((IWineD3DSwapChain *)swapchain); + WARN("Requested mode: %d, %d.\n", + present_parameters->BackBufferWidth, + present_parameters->BackBufferHeight); + wined3d_swapchain_decref(swapchain); return WINED3DERR_INVALIDCALL; } @@ -6225,198 +5656,201 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Reset(IWineD3DDevice *iface, * TODO: Figure out what happens to explicit swapchains, or if we have more than one implicit swapchain */ TRACE("New params:\n"); - TRACE("BackBufferWidth = %d\n", pPresentationParameters->BackBufferWidth); - TRACE("BackBufferHeight = %d\n", pPresentationParameters->BackBufferHeight); - TRACE("BackBufferFormat = %s\n", debug_d3dformat(pPresentationParameters->BackBufferFormat)); - TRACE("BackBufferCount = %d\n", pPresentationParameters->BackBufferCount); - TRACE("MultiSampleType = %d\n", pPresentationParameters->MultiSampleType); - TRACE("MultiSampleQuality = %d\n", pPresentationParameters->MultiSampleQuality); - TRACE("SwapEffect = %d\n", pPresentationParameters->SwapEffect); - TRACE("hDeviceWindow = %p\n", pPresentationParameters->hDeviceWindow); - TRACE("Windowed = %s\n", pPresentationParameters->Windowed ? "true" : "false"); - TRACE("EnableAutoDepthStencil = %s\n", pPresentationParameters->EnableAutoDepthStencil ? "true" : "false"); - TRACE("Flags = %08x\n", pPresentationParameters->Flags); - TRACE("FullScreen_RefreshRateInHz = %d\n", pPresentationParameters->FullScreen_RefreshRateInHz); - TRACE("PresentationInterval = %d\n", pPresentationParameters->PresentationInterval); + TRACE("BackBufferWidth = %d\n", present_parameters->BackBufferWidth); + TRACE("BackBufferHeight = %d\n", present_parameters->BackBufferHeight); + TRACE("BackBufferFormat = %s\n", debug_d3dformat(present_parameters->BackBufferFormat)); + TRACE("BackBufferCount = %d\n", present_parameters->BackBufferCount); + TRACE("MultiSampleType = %d\n", present_parameters->MultiSampleType); + TRACE("MultiSampleQuality = %d\n", present_parameters->MultiSampleQuality); + TRACE("SwapEffect = %d\n", present_parameters->SwapEffect); + TRACE("hDeviceWindow = %p\n", present_parameters->hDeviceWindow); + TRACE("Windowed = %s\n", present_parameters->Windowed ? "true" : "false"); + TRACE("EnableAutoDepthStencil = %s\n", present_parameters->EnableAutoDepthStencil ? "true" : "false"); + TRACE("Flags = %08x\n", present_parameters->Flags); + TRACE("FullScreen_RefreshRateInHz = %d\n", present_parameters->FullScreen_RefreshRateInHz); + TRACE("PresentationInterval = %d\n", present_parameters->PresentationInterval); /* No special treatment of these parameters. Just store them */ - swapchain->presentParms.SwapEffect = pPresentationParameters->SwapEffect; - swapchain->presentParms.Flags = pPresentationParameters->Flags; - swapchain->presentParms.PresentationInterval = pPresentationParameters->PresentationInterval; - swapchain->presentParms.FullScreen_RefreshRateInHz = pPresentationParameters->FullScreen_RefreshRateInHz; + swapchain->presentParms.SwapEffect = present_parameters->SwapEffect; + swapchain->presentParms.Flags = present_parameters->Flags; + swapchain->presentParms.PresentationInterval = present_parameters->PresentationInterval; + swapchain->presentParms.FullScreen_RefreshRateInHz = present_parameters->FullScreen_RefreshRateInHz; /* What to do about these? */ - if (pPresentationParameters->BackBufferCount - && pPresentationParameters->BackBufferCount != swapchain->presentParms.BackBufferCount) - ERR("Cannot change the back buffer count yet\n"); + if (present_parameters->BackBufferCount + && present_parameters->BackBufferCount != swapchain->presentParms.BackBufferCount) + FIXME("Cannot change the back buffer count yet.\n"); - if(pPresentationParameters->BackBufferFormat != WINED3DFMT_UNKNOWN && - pPresentationParameters->BackBufferFormat != swapchain->presentParms.BackBufferFormat) { - ERR("Cannot change the back buffer format yet\n"); - } + if (present_parameters->BackBufferFormat != WINED3DFMT_UNKNOWN + && present_parameters->BackBufferFormat != swapchain->presentParms.BackBufferFormat) + FIXME("Cannot change the back buffer format yet.\n"); - if (pPresentationParameters->hDeviceWindow - && pPresentationParameters->hDeviceWindow != swapchain->presentParms.hDeviceWindow) - ERR("Cannot change the device window yet\n"); + if (present_parameters->hDeviceWindow + && present_parameters->hDeviceWindow != swapchain->presentParms.hDeviceWindow) + FIXME("Cannot change the device window yet.\n"); - if (pPresentationParameters->EnableAutoDepthStencil && !This->auto_depth_stencil) + if (present_parameters->EnableAutoDepthStencil && !device->auto_depth_stencil) { HRESULT hrc; TRACE("Creating the depth stencil buffer\n"); - hrc = IWineD3DDeviceParent_CreateDepthStencilSurface(This->device_parent, - pPresentationParameters->BackBufferWidth, - pPresentationParameters->BackBufferHeight, - pPresentationParameters->AutoDepthStencilFormat, - pPresentationParameters->MultiSampleType, - pPresentationParameters->MultiSampleQuality, + hrc = device->device_parent->ops->create_depth_stencil(device->device_parent, + present_parameters->BackBufferWidth, + present_parameters->BackBufferHeight, + present_parameters->AutoDepthStencilFormat, + present_parameters->MultiSampleType, + present_parameters->MultiSampleQuality, FALSE, - (IWineD3DSurface **)&This->auto_depth_stencil); - - if (FAILED(hrc)) { - ERR("Failed to create the depth stencil buffer\n"); - IWineD3DSwapChain_Release((IWineD3DSwapChain *) swapchain); + &device->auto_depth_stencil); + if (FAILED(hrc)) + { + ERR("Failed to create the depth stencil buffer.\n"); + wined3d_swapchain_decref(swapchain); return WINED3DERR_INVALIDCALL; } } - if (This->onscreen_depth_stencil) + if (device->onscreen_depth_stencil) { - IWineD3DSurface_Release((IWineD3DSurface *)This->onscreen_depth_stencil); - This->onscreen_depth_stencil = NULL; + wined3d_surface_decref(device->onscreen_depth_stencil); + device->onscreen_depth_stencil = NULL; } /* Reset the depth stencil */ - if (pPresentationParameters->EnableAutoDepthStencil) - IWineD3DDevice_SetDepthStencilSurface(iface, (IWineD3DSurface *)This->auto_depth_stencil); + if (present_parameters->EnableAutoDepthStencil) + wined3d_device_set_depth_stencil(device, device->auto_depth_stencil); else - IWineD3DDevice_SetDepthStencilSurface(iface, NULL); + wined3d_device_set_depth_stencil(device, NULL); TRACE("Resetting stateblock\n"); - IWineD3DStateBlock_Release((IWineD3DStateBlock *)This->updateStateBlock); - IWineD3DStateBlock_Release((IWineD3DStateBlock *)This->stateBlock); + wined3d_stateblock_decref(device->updateStateBlock); + wined3d_stateblock_decref(device->stateBlock); - delete_opengl_contexts(iface, swapchain); + delete_opengl_contexts(device, swapchain); - if(pPresentationParameters->Windowed) { + if (present_parameters->Windowed) + { mode.Width = swapchain->orig_width; mode.Height = swapchain->orig_height; mode.RefreshRate = 0; mode.Format = swapchain->presentParms.BackBufferFormat; - } else { - mode.Width = pPresentationParameters->BackBufferWidth; - mode.Height = pPresentationParameters->BackBufferHeight; - mode.RefreshRate = pPresentationParameters->FullScreen_RefreshRateInHz; + } + else + { + mode.Width = present_parameters->BackBufferWidth; + mode.Height = present_parameters->BackBufferHeight; + mode.RefreshRate = present_parameters->FullScreen_RefreshRateInHz; mode.Format = swapchain->presentParms.BackBufferFormat; } /* Should Width == 800 && Height == 0 set 800x600? */ - if (pPresentationParameters->BackBufferWidth && pPresentationParameters->BackBufferHeight - && (pPresentationParameters->BackBufferWidth != swapchain->presentParms.BackBufferWidth - || pPresentationParameters->BackBufferHeight != swapchain->presentParms.BackBufferHeight)) + if (present_parameters->BackBufferWidth && present_parameters->BackBufferHeight + && (present_parameters->BackBufferWidth != swapchain->presentParms.BackBufferWidth + || present_parameters->BackBufferHeight != swapchain->presentParms.BackBufferHeight)) { UINT i; - if(!pPresentationParameters->Windowed) { + if (!present_parameters->Windowed) DisplayModeChanged = TRUE; - } - swapchain->presentParms.BackBufferWidth = pPresentationParameters->BackBufferWidth; - swapchain->presentParms.BackBufferHeight = pPresentationParameters->BackBufferHeight; - hr = updateSurfaceDesc(swapchain->front_buffer, pPresentationParameters); - if(FAILED(hr)) + swapchain->presentParms.BackBufferWidth = present_parameters->BackBufferWidth; + swapchain->presentParms.BackBufferHeight = present_parameters->BackBufferHeight; + + hr = updateSurfaceDesc(swapchain->front_buffer, present_parameters); + if (FAILED(hr)) { - IWineD3DSwapChain_Release((IWineD3DSwapChain *) swapchain); + wined3d_swapchain_decref(swapchain); return hr; } for (i = 0; i < swapchain->presentParms.BackBufferCount; ++i) { - hr = updateSurfaceDesc(swapchain->back_buffers[i], pPresentationParameters); - if(FAILED(hr)) + hr = updateSurfaceDesc(swapchain->back_buffers[i], present_parameters); + if (FAILED(hr)) { - IWineD3DSwapChain_Release((IWineD3DSwapChain *) swapchain); + wined3d_swapchain_decref(swapchain); return hr; } } - if (This->auto_depth_stencil) + if (device->auto_depth_stencil) { - hr = updateSurfaceDesc(This->auto_depth_stencil, pPresentationParameters); - if(FAILED(hr)) + hr = updateSurfaceDesc(device->auto_depth_stencil, present_parameters); + if (FAILED(hr)) { - IWineD3DSwapChain_Release((IWineD3DSwapChain *) swapchain); + wined3d_swapchain_decref(swapchain); return hr; } } } - if (!pPresentationParameters->Windowed != !swapchain->presentParms.Windowed + if (!present_parameters->Windowed != !swapchain->presentParms.Windowed || DisplayModeChanged) { - BOOL filter = This->filter_messages; - This->filter_messages = TRUE; + wined3d_device_set_display_mode(device, 0, &mode); - IWineD3DDevice_SetDisplayMode(iface, 0, &mode); - - if (!pPresentationParameters->Windowed) + if (!present_parameters->Windowed) { if (swapchain->presentParms.Windowed) { - HWND focus_window = This->createParms.hFocusWindow; - if (!focus_window) focus_window = pPresentationParameters->hDeviceWindow; - if (FAILED(hr = IWineD3DDevice_AcquireFocusWindow(iface, focus_window))) + HWND focus_window = device->createParms.hFocusWindow; + if (!focus_window) + focus_window = present_parameters->hDeviceWindow; + if (FAILED(hr = wined3d_device_acquire_focus_window(device, focus_window))) { ERR("Failed to acquire focus window, hr %#x.\n", hr); - IWineD3DSwapChain_Release((IWineD3DSwapChain *)swapchain); + wined3d_swapchain_decref(swapchain); return hr; } /* switch from windowed to fs */ - swapchain_setup_fullscreen_window(swapchain, pPresentationParameters->BackBufferWidth, - pPresentationParameters->BackBufferHeight); + wined3d_device_setup_fullscreen_window(device, swapchain->device_window, + present_parameters->BackBufferWidth, + present_parameters->BackBufferHeight); } else { /* Fullscreen -> fullscreen mode change */ MoveWindow(swapchain->device_window, 0, 0, - pPresentationParameters->BackBufferWidth, pPresentationParameters->BackBufferHeight, + present_parameters->BackBufferWidth, present_parameters->BackBufferHeight, TRUE); } } else if (!swapchain->presentParms.Windowed) { /* Fullscreen -> windowed switch */ - swapchain_restore_fullscreen_window(swapchain); - IWineD3DDevice_ReleaseFocusWindow(iface); + wined3d_device_restore_fullscreen_window(device, swapchain->device_window); + wined3d_device_release_focus_window(device); } - swapchain->presentParms.Windowed = pPresentationParameters->Windowed; - - This->filter_messages = filter; + swapchain->presentParms.Windowed = present_parameters->Windowed; } - else if (!pPresentationParameters->Windowed) + else if (!present_parameters->Windowed) { - DWORD style = This->style, exStyle = This->exStyle; + DWORD style = device->style; + DWORD exStyle = device->exStyle; /* If we're in fullscreen, and the mode wasn't changed, we have to get the window back into * the right position. Some applications(Battlefield 2, Guild Wars) move it and then call * Reset to clear up their mess. Guild Wars also loses the device during that. */ - This->style = 0; - This->exStyle = 0; - swapchain_setup_fullscreen_window(swapchain, pPresentationParameters->BackBufferWidth, - pPresentationParameters->BackBufferHeight); - This->style = style; - This->exStyle = exStyle; + device->style = 0; + device->exStyle = 0; + wined3d_device_setup_fullscreen_window(device, swapchain->device_window, + present_parameters->BackBufferWidth, + present_parameters->BackBufferHeight); + device->style = style; + device->exStyle = exStyle; } /* Note: No parent needed for initial internal stateblock */ - hr = IWineD3DDevice_CreateStateBlock(iface, WINED3DSBT_INIT, (IWineD3DStateBlock **)&This->stateBlock); - if (FAILED(hr)) ERR("Resetting the stateblock failed with error 0x%08x\n", hr); - else TRACE("Created stateblock %p\n", This->stateBlock); - This->updateStateBlock = This->stateBlock; - IWineD3DStateBlock_AddRef((IWineD3DStateBlock *)This->updateStateBlock); + hr = wined3d_stateblock_create(device, WINED3DSBT_INIT, &device->stateBlock); + if (FAILED(hr)) + ERR("Resetting the stateblock failed with error %#x.\n", hr); + else + TRACE("Created stateblock %p.\n", device->stateBlock); + device->updateStateBlock = device->stateBlock; + wined3d_stateblock_incref(device->updateStateBlock); - stateblock_init_default_state(This->stateBlock); + stateblock_init_default_state(device->stateBlock); if(wined3d_settings.offscreen_rendering_mode == ORM_FBO) { @@ -6444,8 +5878,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Reset(IWineD3DDevice *iface, } } - hr = create_primary_opengl_context(iface, swapchain); - IWineD3DSwapChain_Release((IWineD3DSwapChain *) swapchain); + hr = create_primary_opengl_context(device, swapchain); + wined3d_swapchain_decref(swapchain); /* All done. There is no need to reload resources or shaders, this will happen automatically on the * first use @@ -6453,9 +5887,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Reset(IWineD3DDevice *iface, return hr; } -static HRESULT WINAPI IWineD3DDeviceImpl_SetDialogBoxMode(IWineD3DDevice *iface, BOOL enable_dialogs) +HRESULT CDECL wined3d_device_set_dialog_box_mode(struct wined3d_device *device, BOOL enable_dialogs) { - TRACE("iface %p, enable_dialogs %#x.\n", iface, enable_dialogs); + TRACE("device %p, enable_dialogs %#x.\n", device, enable_dialogs); if (!enable_dialogs) FIXME("Dialogs cannot be disabled yet.\n"); @@ -6463,62 +5897,61 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetDialogBoxMode(IWineD3DDevice *iface, } -static HRESULT WINAPI IWineD3DDeviceImpl_GetCreationParameters(IWineD3DDevice *iface, WINED3DDEVICE_CREATION_PARAMETERS *pParameters) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface; - TRACE("(%p) : pParameters %p\n", This, pParameters); +HRESULT CDECL wined3d_device_get_creation_parameters(struct wined3d_device *device, + WINED3DDEVICE_CREATION_PARAMETERS *parameters) +{ + TRACE("device %p, parameters %p.\n", device, parameters); - *pParameters = This->createParms; + *parameters = device->createParms; return WINED3D_OK; } -static void WINAPI IWineD3DDeviceImpl_SetGammaRamp(IWineD3DDevice * iface, UINT iSwapChain, DWORD Flags, CONST WINED3DGAMMARAMP* pRamp) { - IWineD3DSwapChain *swapchain; +void CDECL wined3d_device_set_gamma_ramp(struct wined3d_device *device, + UINT swapchain_idx, DWORD flags, const WINED3DGAMMARAMP *ramp) +{ + struct wined3d_swapchain *swapchain; - TRACE("Relaying to swapchain\n"); + TRACE("device %p, swapchain_idx %u, flags %#x, ramp %p.\n", + device, swapchain_idx, flags, ramp); - if (IWineD3DDeviceImpl_GetSwapChain(iface, iSwapChain, &swapchain) == WINED3D_OK) { - IWineD3DSwapChain_SetGammaRamp(swapchain, Flags, pRamp); - IWineD3DSwapChain_Release(swapchain); + if (SUCCEEDED(wined3d_device_get_swapchain(device, swapchain_idx, &swapchain))) + { + wined3d_swapchain_set_gamma_ramp(swapchain, flags, ramp); + wined3d_swapchain_decref(swapchain); } } -static void WINAPI IWineD3DDeviceImpl_GetGammaRamp(IWineD3DDevice *iface, UINT iSwapChain, WINED3DGAMMARAMP* pRamp) { - IWineD3DSwapChain *swapchain; +void CDECL wined3d_device_get_gamma_ramp(struct wined3d_device *device, UINT swapchain_idx, WINED3DGAMMARAMP *ramp) +{ + struct wined3d_swapchain *swapchain; - TRACE("Relaying to swapchain\n"); + TRACE("device %p, swapchain_idx %u, ramp %p.\n", + device, swapchain_idx, ramp); - if (IWineD3DDeviceImpl_GetSwapChain(iface, iSwapChain, &swapchain) == WINED3D_OK) { - IWineD3DSwapChain_GetGammaRamp(swapchain, pRamp); - IWineD3DSwapChain_Release(swapchain); + if (SUCCEEDED(wined3d_device_get_swapchain(device, swapchain_idx, &swapchain))) + { + wined3d_swapchain_get_gamma_ramp(swapchain, ramp); + wined3d_swapchain_decref(swapchain); } } - -/** ******************************************************** -* Notification functions -** ********************************************************/ -/** This function must be called in the release of a resource when ref == 0, -* the contents of resource must still be correct, -* any handles to other resource held by the caller must be closed -* (e.g. a texture should release all held surfaces because telling the device that it's been released.) - *****************************************************/ -void device_resource_add(IWineD3DDeviceImpl *This, IWineD3DResource *resource) +void device_resource_add(struct wined3d_device *device, struct wined3d_resource *resource) { - TRACE("(%p) : Adding resource %p\n", This, resource); + TRACE("device %p, resource %p.\n", device, resource); - list_add_head(&This->resources, &((IWineD3DResourceImpl *) resource)->resource.resource_list_entry); + list_add_head(&device->resources, &resource->resource_list_entry); } -static void device_resource_remove(IWineD3DDeviceImpl *This, IWineD3DResource *resource) +static void device_resource_remove(struct wined3d_device *device, struct wined3d_resource *resource) { - TRACE("(%p) : Removing resource %p\n", This, resource); + TRACE("device %p, resource %p.\n", device, resource); - list_remove(&((IWineD3DResourceImpl *) resource)->resource.resource_list_entry); + list_remove(&resource->resource_list_entry); } -void device_resource_released(IWineD3DDeviceImpl *device, IWineD3DResource *resource) +void device_resource_released(struct wined3d_device *device, struct wined3d_resource *resource) { - WINED3DRESOURCETYPE type = IWineD3DResource_GetType(resource); + WINED3DRESOURCETYPE type = resource->resourceType; unsigned int i; TRACE("device %p, resource %p, type %s.\n", device, resource, debug_d3dresourcetype(type)); @@ -6528,21 +5961,25 @@ void device_resource_released(IWineD3DDeviceImpl *device, IWineD3DResource *reso switch (type) { case WINED3DRTYPE_SURFACE: - if (!device->d3d_initialized) break; - - for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { - if (device->render_targets[i] == (IWineD3DSurfaceImpl *)resource) + struct wined3d_surface *surface = surface_from_resource(resource); + + if (!device->d3d_initialized) break; + + for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { - ERR("Surface %p is still in use as render target %u.\n", resource, i); - device->render_targets[i] = NULL; + if (device->fb.render_targets[i] == surface) + { + ERR("Surface %p is still in use as render target %u.\n", surface, i); + device->fb.render_targets[i] = NULL; + } } - } - if (device->depth_stencil == (IWineD3DSurfaceImpl *)resource) - { - ERR("Surface %p is still in use as depth/stencil buffer.\n", resource); - device->depth_stencil = NULL; + if (device->fb.depth_stencil == surface) + { + ERR("Surface %p is still in use as depth/stencil buffer.\n", surface); + device->fb.depth_stencil = NULL; + } } break; @@ -6551,57 +5988,62 @@ void device_resource_released(IWineD3DDeviceImpl *device, IWineD3DResource *reso case WINED3DRTYPE_VOLUMETEXTURE: for (i = 0; i < MAX_COMBINED_SAMPLERS; ++i) { - if (device->stateBlock && device->stateBlock->state.textures[i] == (IWineD3DBaseTextureImpl *)resource) + struct wined3d_texture *texture = wined3d_texture_from_resource(resource); + + if (device->stateBlock && device->stateBlock->state.textures[i] == texture) { ERR("Texture %p is still in use by stateblock %p, stage %u.\n", - resource, device->stateBlock, i); + texture, device->stateBlock, i); device->stateBlock->state.textures[i] = NULL; } if (device->updateStateBlock != device->stateBlock - && device->updateStateBlock->state.textures[i] == (IWineD3DBaseTextureImpl *)resource) + && device->updateStateBlock->state.textures[i] == texture) { ERR("Texture %p is still in use by stateblock %p, stage %u.\n", - resource, device->updateStateBlock, i); + texture, device->updateStateBlock, i); device->updateStateBlock->state.textures[i] = NULL; } } break; case WINED3DRTYPE_BUFFER: - for (i = 0; i < MAX_STREAMS; ++i) { - if (device->stateBlock - && device->stateBlock->state.streams[i].buffer == (struct wined3d_buffer *)resource) + struct wined3d_buffer *buffer = buffer_from_resource(resource); + + for (i = 0; i < MAX_STREAMS; ++i) { - ERR("Buffer %p is still in use by stateblock %p, stream %u.\n", - resource, device->stateBlock, i); - device->stateBlock->state.streams[i].buffer = NULL; + if (device->stateBlock && device->stateBlock->state.streams[i].buffer == buffer) + { + ERR("Buffer %p is still in use by stateblock %p, stream %u.\n", + buffer, device->stateBlock, i); + device->stateBlock->state.streams[i].buffer = NULL; + } + + if (device->updateStateBlock != device->stateBlock + && device->updateStateBlock->state.streams[i].buffer == buffer) + { + ERR("Buffer %p is still in use by stateblock %p, stream %u.\n", + buffer, device->updateStateBlock, i); + device->updateStateBlock->state.streams[i].buffer = NULL; + } + + } + + if (device->stateBlock && device->stateBlock->state.index_buffer == buffer) + { + ERR("Buffer %p is still in use by stateblock %p as index buffer.\n", + buffer, device->stateBlock); + device->stateBlock->state.index_buffer = NULL; } if (device->updateStateBlock != device->stateBlock - && device->updateStateBlock->state.streams[i].buffer == (struct wined3d_buffer *)resource) + && device->updateStateBlock->state.index_buffer == buffer) { - ERR("Buffer %p is still in use by stateblock %p, stream %u.\n", - resource, device->updateStateBlock, i); - device->updateStateBlock->state.streams[i].buffer = NULL; + ERR("Buffer %p is still in use by stateblock %p as index buffer.\n", + buffer, device->updateStateBlock); + device->updateStateBlock->state.index_buffer = NULL; } - - } - - if (device->stateBlock && device->stateBlock->state.index_buffer == (struct wined3d_buffer *)resource) - { - ERR("Buffer %p is still in use by stateblock %p as index buffer.\n", - resource, device->stateBlock); - device->stateBlock->state.index_buffer = NULL; - } - - if (device->updateStateBlock != device->stateBlock - && device->updateStateBlock->state.index_buffer == (struct wined3d_buffer *)resource) - { - ERR("Buffer %p is still in use by stateblock %p as index buffer.\n", - resource, device->updateStateBlock); - device->updateStateBlock->state.index_buffer = NULL; } break; @@ -6615,38 +6057,43 @@ void device_resource_released(IWineD3DDeviceImpl *device, IWineD3DResource *reso TRACE("Resource released.\n"); } -static HRESULT WINAPI IWineD3DDeviceImpl_EnumResources(IWineD3DDevice *iface, D3DCB_ENUMRESOURCES pCallback, void *pData) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface; - IWineD3DResourceImpl *resource, *cursor; - HRESULT ret; - TRACE("(%p)->(%p,%p)\n", This, pCallback, pData); +HRESULT CDECL wined3d_device_enum_resources(struct wined3d_device *device, + D3DCB_ENUMRESOURCES callback, void *data) +{ + struct wined3d_resource *resource, *cursor; - LIST_FOR_EACH_ENTRY_SAFE(resource, cursor, &This->resources, IWineD3DResourceImpl, resource.resource_list_entry) { - TRACE("enumerating resource %p\n", resource); - IWineD3DResource_AddRef((IWineD3DResource *) resource); - ret = pCallback((IWineD3DResource *) resource, pData); - if(ret == S_FALSE) { - TRACE("Canceling enumeration\n"); + TRACE("device %p, callback %p, data %p.\n", device, callback, data); + + LIST_FOR_EACH_ENTRY_SAFE(resource, cursor, &device->resources, struct wined3d_resource, resource_list_entry) + { + TRACE("enumerating resource %p.\n", resource); + if (callback(resource, data) == S_FALSE) + { + TRACE("Canceling enumeration.\n"); break; } } + return WINED3D_OK; } -static HRESULT WINAPI IWineD3DDeviceImpl_GetSurfaceFromDC(IWineD3DDevice *iface, HDC dc, IWineD3DSurface **surface) +HRESULT CDECL wined3d_device_get_surface_from_dc(struct wined3d_device *device, + HDC dc, struct wined3d_surface **surface) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface; - IWineD3DResourceImpl *resource; + struct wined3d_resource *resource; - LIST_FOR_EACH_ENTRY(resource, &This->resources, IWineD3DResourceImpl, resource.resource_list_entry) + TRACE("device %p, dc %p, surface %p.\n", device, dc, surface); + + LIST_FOR_EACH_ENTRY(resource, &device->resources, struct wined3d_resource, resource_list_entry) { - WINED3DRESOURCETYPE type = IWineD3DResource_GetType((IWineD3DResource *)resource); - if (type == WINED3DRTYPE_SURFACE) + if (resource->resourceType == WINED3DRTYPE_SURFACE) { - if (((IWineD3DSurfaceImpl *)resource)->hDC == dc) + struct wined3d_surface *s = surface_from_resource(resource); + + if (s->hDC == dc) { - TRACE("Found surface %p for dc %p.\n", resource, dc); - *surface = (IWineD3DSurface *)resource; + TRACE("Found surface %p for dc %p.\n", s, dc); + *surface = s; return WINED3D_OK; } } @@ -6655,161 +6102,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetSurfaceFromDC(IWineD3DDevice *iface, return WINED3DERR_INVALIDCALL; } -/********************************************************** - * IWineD3DDevice VTbl follows - **********************************************************/ - -static const IWineD3DDeviceVtbl IWineD3DDevice_Vtbl = -{ - /*** IUnknown methods ***/ - IWineD3DDeviceImpl_QueryInterface, - IWineD3DDeviceImpl_AddRef, - IWineD3DDeviceImpl_Release, - /*** IWineD3DDevice methods ***/ - /*** Creation methods**/ - IWineD3DDeviceImpl_CreateBuffer, - IWineD3DDeviceImpl_CreateVertexBuffer, - IWineD3DDeviceImpl_CreateIndexBuffer, - IWineD3DDeviceImpl_CreateStateBlock, - IWineD3DDeviceImpl_CreateSurface, - IWineD3DDeviceImpl_CreateRendertargetView, - IWineD3DDeviceImpl_CreateTexture, - IWineD3DDeviceImpl_CreateVolumeTexture, - IWineD3DDeviceImpl_CreateVolume, - IWineD3DDeviceImpl_CreateCubeTexture, - IWineD3DDeviceImpl_CreateQuery, - IWineD3DDeviceImpl_CreateSwapChain, - IWineD3DDeviceImpl_CreateVertexDeclaration, - IWineD3DDeviceImpl_CreateVertexDeclarationFromFVF, - IWineD3DDeviceImpl_CreateVertexShader, - IWineD3DDeviceImpl_CreateGeometryShader, - IWineD3DDeviceImpl_CreatePixelShader, - IWineD3DDeviceImpl_CreatePalette, - /*** Odd functions **/ - IWineD3DDeviceImpl_Init3D, - IWineD3DDeviceImpl_InitGDI, - IWineD3DDeviceImpl_Uninit3D, - IWineD3DDeviceImpl_UninitGDI, - IWineD3DDeviceImpl_SetMultithreaded, - IWineD3DDeviceImpl_EvictManagedResources, - IWineD3DDeviceImpl_GetAvailableTextureMem, - IWineD3DDeviceImpl_GetBackBuffer, - IWineD3DDeviceImpl_GetCreationParameters, - IWineD3DDeviceImpl_GetDeviceCaps, - IWineD3DDeviceImpl_GetDirect3D, - IWineD3DDeviceImpl_GetDisplayMode, - IWineD3DDeviceImpl_SetDisplayMode, - IWineD3DDeviceImpl_GetNumberOfSwapChains, - IWineD3DDeviceImpl_GetRasterStatus, - IWineD3DDeviceImpl_GetSwapChain, - IWineD3DDeviceImpl_Reset, - IWineD3DDeviceImpl_SetDialogBoxMode, - IWineD3DDeviceImpl_SetCursorProperties, - IWineD3DDeviceImpl_SetCursorPosition, - IWineD3DDeviceImpl_ShowCursor, - /*** Getters and setters **/ - IWineD3DDeviceImpl_SetClipPlane, - IWineD3DDeviceImpl_GetClipPlane, - IWineD3DDeviceImpl_SetClipStatus, - IWineD3DDeviceImpl_GetClipStatus, - IWineD3DDeviceImpl_SetCurrentTexturePalette, - IWineD3DDeviceImpl_GetCurrentTexturePalette, - IWineD3DDeviceImpl_SetDepthStencilSurface, - IWineD3DDeviceImpl_GetDepthStencilSurface, - IWineD3DDeviceImpl_SetGammaRamp, - IWineD3DDeviceImpl_GetGammaRamp, - IWineD3DDeviceImpl_SetIndexBuffer, - IWineD3DDeviceImpl_GetIndexBuffer, - IWineD3DDeviceImpl_SetBaseVertexIndex, - IWineD3DDeviceImpl_GetBaseVertexIndex, - IWineD3DDeviceImpl_SetLight, - IWineD3DDeviceImpl_GetLight, - IWineD3DDeviceImpl_SetLightEnable, - IWineD3DDeviceImpl_GetLightEnable, - IWineD3DDeviceImpl_SetMaterial, - IWineD3DDeviceImpl_GetMaterial, - IWineD3DDeviceImpl_SetNPatchMode, - IWineD3DDeviceImpl_GetNPatchMode, - IWineD3DDeviceImpl_SetPaletteEntries, - IWineD3DDeviceImpl_GetPaletteEntries, - IWineD3DDeviceImpl_SetPixelShader, - IWineD3DDeviceImpl_GetPixelShader, - IWineD3DDeviceImpl_SetPixelShaderConstantB, - IWineD3DDeviceImpl_GetPixelShaderConstantB, - IWineD3DDeviceImpl_SetPixelShaderConstantI, - IWineD3DDeviceImpl_GetPixelShaderConstantI, - IWineD3DDeviceImpl_SetPixelShaderConstantF, - IWineD3DDeviceImpl_GetPixelShaderConstantF, - IWineD3DDeviceImpl_SetRenderState, - IWineD3DDeviceImpl_GetRenderState, - IWineD3DDeviceImpl_SetRenderTarget, - IWineD3DDeviceImpl_GetRenderTarget, - IWineD3DDeviceImpl_SetSamplerState, - IWineD3DDeviceImpl_GetSamplerState, - IWineD3DDeviceImpl_SetScissorRect, - IWineD3DDeviceImpl_GetScissorRect, - IWineD3DDeviceImpl_SetSoftwareVertexProcessing, - IWineD3DDeviceImpl_GetSoftwareVertexProcessing, - IWineD3DDeviceImpl_SetStreamSource, - IWineD3DDeviceImpl_GetStreamSource, - IWineD3DDeviceImpl_SetStreamSourceFreq, - IWineD3DDeviceImpl_GetStreamSourceFreq, - IWineD3DDeviceImpl_SetTexture, - IWineD3DDeviceImpl_GetTexture, - IWineD3DDeviceImpl_SetTextureStageState, - IWineD3DDeviceImpl_GetTextureStageState, - IWineD3DDeviceImpl_SetTransform, - IWineD3DDeviceImpl_GetTransform, - IWineD3DDeviceImpl_SetVertexDeclaration, - IWineD3DDeviceImpl_GetVertexDeclaration, - IWineD3DDeviceImpl_SetVertexShader, - IWineD3DDeviceImpl_GetVertexShader, - IWineD3DDeviceImpl_SetVertexShaderConstantB, - IWineD3DDeviceImpl_GetVertexShaderConstantB, - IWineD3DDeviceImpl_SetVertexShaderConstantI, - IWineD3DDeviceImpl_GetVertexShaderConstantI, - IWineD3DDeviceImpl_SetVertexShaderConstantF, - IWineD3DDeviceImpl_GetVertexShaderConstantF, - IWineD3DDeviceImpl_SetViewport, - IWineD3DDeviceImpl_GetViewport, - IWineD3DDeviceImpl_MultiplyTransform, - IWineD3DDeviceImpl_ValidateDevice, - IWineD3DDeviceImpl_ProcessVertices, - /*** State block ***/ - IWineD3DDeviceImpl_BeginStateBlock, - IWineD3DDeviceImpl_EndStateBlock, - /*** Scene management ***/ - IWineD3DDeviceImpl_BeginScene, - IWineD3DDeviceImpl_EndScene, - IWineD3DDeviceImpl_Present, - IWineD3DDeviceImpl_Clear, - IWineD3DDeviceImpl_ClearRendertargetView, - /*** Drawing ***/ - IWineD3DDeviceImpl_SetPrimitiveType, - IWineD3DDeviceImpl_GetPrimitiveType, - IWineD3DDeviceImpl_DrawPrimitive, - IWineD3DDeviceImpl_DrawIndexedPrimitive, - IWineD3DDeviceImpl_DrawPrimitiveUP, - IWineD3DDeviceImpl_DrawIndexedPrimitiveUP, - IWineD3DDeviceImpl_DrawPrimitiveStrided, - IWineD3DDeviceImpl_DrawIndexedPrimitiveStrided, - IWineD3DDeviceImpl_DrawRectPatch, - IWineD3DDeviceImpl_DrawTriPatch, - IWineD3DDeviceImpl_DeletePatch, - IWineD3DDeviceImpl_ColorFill, - IWineD3DDeviceImpl_UpdateTexture, - IWineD3DDeviceImpl_UpdateSurface, - IWineD3DDeviceImpl_GetFrontBufferData, - /*** object tracking ***/ - IWineD3DDeviceImpl_EnumResources, - IWineD3DDeviceImpl_GetSurfaceFromDC, - IWineD3DDeviceImpl_AcquireFocusWindow, - IWineD3DDeviceImpl_ReleaseFocusWindow, -}; - -HRESULT device_init(IWineD3DDeviceImpl *device, IWineD3DImpl *wined3d, +HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d, UINT adapter_idx, WINED3DDEVTYPE device_type, HWND focus_window, DWORD flags, - IWineD3DDeviceParent *device_parent) + struct wined3d_device_parent *device_parent) { struct wined3d_adapter *adapter = &wined3d->adapters[adapter_idx]; const struct fragment_pipeline *fragment_pipeline; @@ -6819,24 +6114,22 @@ HRESULT device_init(IWineD3DDeviceImpl *device, IWineD3DImpl *wined3d, unsigned int i; HRESULT hr; - device->lpVtbl = &IWineD3DDevice_Vtbl; device->ref = 1; - device->wined3d = (IWineD3D *)wined3d; - IWineD3D_AddRef(device->wined3d); + device->wined3d = wined3d; + wined3d_incref(device->wined3d); device->adapter = wined3d->adapter_count ? adapter : NULL; device->device_parent = device_parent; list_init(&device->resources); list_init(&device->shaders); device->surface_alignment = wined3d->dxVersion == 7 ? DDRAW_PITCH_ALIGNMENT : D3D8_PITCH_ALIGNMENT; - device->posFixup[0] = 1.0f; /* This is needed to get the x coord unmodified through a MAD. */ /* Get the initial screen setup for ddraw. */ - hr = IWineD3D_GetAdapterDisplayMode((IWineD3D *)wined3d, adapter_idx, &mode); + hr = wined3d_get_adapter_display_mode(wined3d, adapter_idx, &mode); if (FAILED(hr)) { ERR("Failed to get the adapter's display mode, hr %#x.\n", hr); - IWineD3D_Release(device->wined3d); + wined3d_decref(device->wined3d); return hr; } device->ddraw_width = mode.Width; @@ -6874,7 +6167,7 @@ HRESULT device_init(IWineD3DDeviceImpl *device, IWineD3DImpl *wined3d, if (FAILED(hr)) { ERR("Failed to compile state table, hr %#x.\n", hr); - IWineD3D_Release(device->wined3d); + wined3d_decref(device->wined3d); return hr; } } @@ -6884,15 +6177,17 @@ HRESULT device_init(IWineD3DDeviceImpl *device, IWineD3DImpl *wined3d, } -void IWineD3DDeviceImpl_MarkStateDirty(IWineD3DDeviceImpl *This, DWORD state) { - DWORD rep = This->StateTable[state].representative; +void IWineD3DDeviceImpl_MarkStateDirty(struct wined3d_device *device, DWORD state) +{ + DWORD rep = device->StateTable[state].representative; struct wined3d_context *context; DWORD idx; BYTE shift; UINT i; - for(i = 0; i < This->numContexts; i++) { - context = This->contexts[i]; + for (i = 0; i < device->context_count; ++i) + { + context = device->contexts[i]; if(isStateDirty(context, rep)) continue; context->dirtyArray[context->numDirtyEntries++] = rep; @@ -6911,7 +6206,7 @@ void get_drawable_size_fbo(struct wined3d_context *context, UINT *width, UINT *h void get_drawable_size_backbuffer(struct wined3d_context *context, UINT *width, UINT *height) { - IWineD3DSwapChainImpl *swapchain = context->swapchain; + struct wined3d_swapchain *swapchain = context->swapchain; /* The drawable size of a backbuffer / aux buffer offscreen target is the size of the * current context's drawable, which is the size of the back buffer of the swapchain * the active context belongs to. */ @@ -6919,14 +6214,17 @@ void get_drawable_size_backbuffer(struct wined3d_context *context, UINT *width, *height = swapchain->presentParms.BackBufferHeight; } -LRESULT device_process_message(IWineD3DDeviceImpl *device, HWND window, +LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL unicode, UINT message, WPARAM wparam, LPARAM lparam, WNDPROC proc) { if (device->filter_messages) { TRACE("Filtering message: window %p, message %#x, wparam %#lx, lparam %#lx.\n", window, message, wparam, lparam); - return DefWindowProcW(window, message, wparam, lparam); + if (unicode) + return DefWindowProcW(window, message, wparam, lparam); + else + return DefWindowProcA(window, message, wparam, lparam); } if (message == WM_DESTROY) @@ -6938,5 +6236,8 @@ LRESULT device_process_message(IWineD3DDeviceImpl *device, HWND window, else ERR("Window %p is not the focus window for device %p.\n", window, device); } - return CallWindowProcW(proc, window, message, wparam, lparam); + if (unicode) + return CallWindowProcW(proc, window, message, wparam, lparam); + else + return CallWindowProcA(proc, window, message, wparam, lparam); } diff --git a/dll/directx/wine/wined3d/directx.c b/dll/directx/wine/wined3d/directx.c index 1df2eaa8082..f8cad58e59e 100644 --- a/dll/directx/wine/wined3d/directx.c +++ b/dll/directx/wine/wined3d/directx.c @@ -6,7 +6,7 @@ * Copyright 2004 Christian Costa * Copyright 2005 Oliver Stieber * Copyright 2007-2008 Stefan Dösinger for CodeWeavers - * Copyright 2009 Henri Verbeet for CodeWeavers + * Copyright 2009-2010 Henri Verbeet for CodeWeavers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -61,7 +61,6 @@ static const struct { {"GL_ARB_geometry_shader4", ARB_GEOMETRY_SHADER4, 0 }, {"GL_ARB_half_float_pixel", ARB_HALF_FLOAT_PIXEL, 0 }, {"GL_ARB_half_float_vertex", ARB_HALF_FLOAT_VERTEX, 0 }, - {"GL_ARB_imaging", ARB_IMAGING, 0 }, {"GL_ARB_map_buffer_range", ARB_MAP_BUFFER_RANGE, 0 }, {"GL_ARB_multisample", ARB_MULTISAMPLE, 0 }, /* needs GLX_ARB_MULTISAMPLE as well */ {"GL_ARB_multitexture", ARB_MULTITEXTURE, 0 }, @@ -105,6 +104,7 @@ static const struct { {"GL_EXT_blend_equation_separate", EXT_BLEND_EQUATION_SEPARATE, 0 }, {"GL_EXT_blend_func_separate", EXT_BLEND_FUNC_SEPARATE, 0 }, {"GL_EXT_blend_minmax", EXT_BLEND_MINMAX, 0 }, + {"GL_EXT_blend_subtract", EXT_BLEND_SUBTRACT, 0 }, {"GL_EXT_depth_bounds_test", EXT_DEPTH_BOUNDS_TEST, 0 }, {"GL_EXT_draw_buffers2", EXT_DRAW_BUFFERS2, 0 }, {"GL_EXT_fog_coord", EXT_FOG_COORD, 0 }, @@ -129,6 +129,7 @@ static const struct { {"GL_EXT_texture_filter_anisotropic", EXT_TEXTURE_FILTER_ANISOTROPIC, 0 }, {"GL_EXT_texture_lod_bias", EXT_TEXTURE_LOD_BIAS, 0 }, {"GL_EXT_texture_sRGB", EXT_TEXTURE_SRGB, 0 }, + {"GL_EXT_texture_sRGB_decode", EXT_TEXTURE_SRGB_DECODE, 0 }, {"GL_EXT_vertex_array_bgra", EXT_VERTEX_ARRAY_BGRA, 0 }, /* NV */ @@ -328,7 +329,7 @@ fail: } /* Adjust the amount of used texture memory */ -unsigned int WineD3DAdapterChangeGLRam(IWineD3DDeviceImpl *device, unsigned int glram) +unsigned int WineD3DAdapterChangeGLRam(struct wined3d_device *device, int glram) { struct wined3d_adapter *adapter = device->adapter; @@ -343,52 +344,33 @@ static void wined3d_adapter_cleanup(struct wined3d_adapter *adapter) HeapFree(GetProcessHeap(), 0, adapter->cfgs); } -/********************************************************** - * IUnknown parts follows - **********************************************************/ - -static HRESULT WINAPI IWineD3DImpl_QueryInterface(IWineD3D *iface,REFIID riid,LPVOID *ppobj) +ULONG CDECL wined3d_incref(struct wined3d *wined3d) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; + ULONG refcount = InterlockedIncrement(&wined3d->ref); - TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(riid),ppobj); - if (IsEqualGUID(riid, &IID_IUnknown) - || IsEqualGUID(riid, &IID_IWineD3DBase) - || IsEqualGUID(riid, &IID_IWineD3DDevice)) { - IUnknown_AddRef(iface); - *ppobj = This; - return S_OK; - } - *ppobj = NULL; - return E_NOINTERFACE; + TRACE("%p increasing refcount to %u.\n", wined3d, refcount); + + return refcount; } -static ULONG WINAPI IWineD3DImpl_AddRef(IWineD3D *iface) { - IWineD3DImpl *This = (IWineD3DImpl *)iface; - ULONG refCount = InterlockedIncrement(&This->ref); +ULONG CDECL wined3d_decref(struct wined3d *wined3d) +{ + ULONG refcount = InterlockedDecrement(&wined3d->ref); - TRACE("(%p) : AddRef increasing from %d\n", This, refCount - 1); - return refCount; -} + TRACE("%p decreasing refcount to %u.\n", wined3d, refcount); -static ULONG WINAPI IWineD3DImpl_Release(IWineD3D *iface) { - IWineD3DImpl *This = (IWineD3DImpl *)iface; - ULONG ref; - TRACE("(%p) : Releasing from %d\n", This, This->ref); - ref = InterlockedDecrement(&This->ref); - - if (!ref) + if (!refcount) { unsigned int i; - for (i = 0; i < This->adapter_count; ++i) + for (i = 0; i < wined3d->adapter_count; ++i) { - wined3d_adapter_cleanup(&This->adapters[i]); + wined3d_adapter_cleanup(&wined3d->adapters[i]); } - HeapFree(GetProcessHeap(), 0, This); + HeapFree(GetProcessHeap(), 0, wined3d); } - return ref; + return refcount; } /********************************************************** @@ -442,13 +424,13 @@ static DWORD ver_for_ext(GL_SupportedExt ext) return 0; } -static BOOL match_ati_r300_to_500(const struct wined3d_gl_info *gl_info, const char *gl_renderer, +static BOOL match_amd_r300_to_500(const struct wined3d_gl_info *gl_info, const char *gl_renderer, enum wined3d_gl_vendor gl_vendor, enum wined3d_pci_vendor card_vendor, enum wined3d_pci_device device) { - if (card_vendor != HW_VENDOR_ATI) return FALSE; - if (device == CARD_ATI_RADEON_9500) return TRUE; - if (device == CARD_ATI_RADEON_X700) return TRUE; - if (device == CARD_ATI_RADEON_X1600) return TRUE; + if (card_vendor != HW_VENDOR_AMD) return FALSE; + if (device == CARD_AMD_RADEON_9500) return TRUE; + if (device == CARD_AMD_RADEON_X700) return TRUE; + if (device == CARD_AMD_RADEON_X1600) return TRUE; return FALSE; } @@ -573,8 +555,8 @@ static BOOL match_apple_nonr500ati(const struct wined3d_gl_info *gl_info, const enum wined3d_gl_vendor gl_vendor, enum wined3d_pci_vendor card_vendor, enum wined3d_pci_device device) { if (gl_vendor != GL_VENDOR_APPLE) return FALSE; - if (card_vendor != HW_VENDOR_ATI) return FALSE; - if (device == CARD_ATI_RADEON_X1600) return FALSE; + if (card_vendor != HW_VENDOR_AMD) return FALSE; + if (device == CARD_AMD_RADEON_X1600) return FALSE; return TRUE; } @@ -774,7 +756,7 @@ static void quirk_one_point_sprite(struct wined3d_gl_info *gl_info) } } -static void quirk_ati_dx9(struct wined3d_gl_info *gl_info) +static void quirk_amd_dx9(struct wined3d_gl_info *gl_info) { quirk_arb_constants(gl_info); @@ -879,9 +861,9 @@ struct driver_quirk static const struct driver_quirk quirk_table[] = { { - match_ati_r300_to_500, - quirk_ati_dx9, - "ATI GLSL constant and normalized texrect quirk" + match_amd_r300_to_500, + quirk_amd_dx9, + "AMD GLSL constant and normalized texrect quirk" }, /* MacOS advertises more GLSL vertex shader uniforms than supported by the hardware, and if more are * used it falls back to software. While the compiler can detect if the shader uses all declared @@ -995,17 +977,17 @@ struct driver_version_information /* The driver version table contains driver information for different devices on several OS versions. */ static const struct driver_version_information driver_version_table[] = { - /* ATI + /* AMD * - Radeon HD2x00 (R600) and up supported by current drivers. - * - Radeon 9500 (R300) - X1*00 (R5xx) supported upto Catalyst 9.3 (Linux) and 10.2 (XP/Vista/Win7) - * - Radeon 7xxx (R100) - 9250 (RV250) supported upto Catalyst 6.11 (XP) - * - Rage 128 supported upto XP, latest official build 6.13.3279 dated October 2001 */ - {DRIVER_ATI_RAGE_128PRO, DRIVER_MODEL_NT5X, "ati2dvaa.dll", 13, 3279, 0}, - {DRIVER_ATI_R100, DRIVER_MODEL_NT5X, "ati2dvag.dll", 14, 10, 6614}, - {DRIVER_ATI_R300, DRIVER_MODEL_NT5X, "ati2dvag.dll", 14, 10, 6764}, - {DRIVER_ATI_R600, DRIVER_MODEL_NT5X, "ati2dvag.dll", 14, 10, 8681}, - {DRIVER_ATI_R300, DRIVER_MODEL_NT6X, "atiumdag.dll", 14, 10, 741 }, - {DRIVER_ATI_R600, DRIVER_MODEL_NT6X, "atiumdag.dll", 14, 10, 741 }, + * - Radeon 9500 (R300) - X1*00 (R5xx) supported up to Catalyst 9.3 (Linux) and 10.2 (XP/Vista/Win7) + * - Radeon 7xxx (R100) - 9250 (RV250) supported up to Catalyst 6.11 (XP) + * - Rage 128 supported up to XP, latest official build 6.13.3279 dated October 2001 */ + {DRIVER_AMD_RAGE_128PRO, DRIVER_MODEL_NT5X, "ati2dvaa.dll", 13, 3279, 0}, + {DRIVER_AMD_R100, DRIVER_MODEL_NT5X, "ati2dvag.dll", 14, 10, 6614}, + {DRIVER_AMD_R300, DRIVER_MODEL_NT5X, "ati2dvag.dll", 14, 10, 6764}, + {DRIVER_AMD_R600, DRIVER_MODEL_NT5X, "ati2dvag.dll", 14, 10, 8681}, + {DRIVER_AMD_R300, DRIVER_MODEL_NT6X, "atiumdag.dll", 14, 10, 741 }, + {DRIVER_AMD_R600, DRIVER_MODEL_NT6X, "atiumdag.dll", 14, 10, 741 }, /* Intel * The drivers are unified but not all versions support all GPUs. At some point the 2k/xp @@ -1027,8 +1009,8 @@ static const struct driver_version_information driver_version_table[] = {DRIVER_NVIDIA_TNT, DRIVER_MODEL_NT5X, "nv4_disp.dll", 14, 10, 7186}, {DRIVER_NVIDIA_GEFORCE2MX, DRIVER_MODEL_NT5X, "nv4_disp.dll", 14, 10, 9371}, {DRIVER_NVIDIA_GEFORCEFX, DRIVER_MODEL_NT5X, "nv4_disp.dll", 14, 11, 7516}, - {DRIVER_NVIDIA_GEFORCE6, DRIVER_MODEL_NT5X, "nv4_disp.dll", 15, 11, 9745}, - {DRIVER_NVIDIA_GEFORCE6, DRIVER_MODEL_NT6X, "nvd3dum.dll", 15, 11, 9745}, + {DRIVER_NVIDIA_GEFORCE6, DRIVER_MODEL_NT5X, "nv4_disp.dll", 15, 12, 6658}, + {DRIVER_NVIDIA_GEFORCE6, DRIVER_MODEL_NT6X, "nvd3dum.dll", 15, 12, 6658}, }; struct gpu_description @@ -1080,30 +1062,46 @@ static const struct gpu_description gpu_description_table[] = {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX260, "NVIDIA GeForce GTX 260", DRIVER_NVIDIA_GEFORCE6, 1024}, {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX275, "NVIDIA GeForce GTX 275", DRIVER_NVIDIA_GEFORCE6, 896 }, {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX280, "NVIDIA GeForce GTX 280", DRIVER_NVIDIA_GEFORCE6, 1024}, + {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GT320M, "NVIDIA GeForce GT 320M", DRIVER_NVIDIA_GEFORCE6, 1024}, {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GT325M, "NVIDIA GeForce GT 325M", DRIVER_NVIDIA_GEFORCE6, 1024}, + {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GT330, "NVIDIA GeForce GT 330", DRIVER_NVIDIA_GEFORCE6, 1024}, {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTS350M, "NVIDIA GeForce GTS 350M", DRIVER_NVIDIA_GEFORCE6, 1024}, + {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GT420, "NVIDIA GeForce GT 420", DRIVER_NVIDIA_GEFORCE6, 2048}, + {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GT430, "NVIDIA GeForce GT 430", DRIVER_NVIDIA_GEFORCE6, 1024}, + {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GT440, "NVIDIA GeForce GT 440", DRIVER_NVIDIA_GEFORCE6, 1024}, + {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTS450, "NVIDIA GeForce GTS 450", DRIVER_NVIDIA_GEFORCE6, 1024}, {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX460, "NVIDIA GeForce GTX 460", DRIVER_NVIDIA_GEFORCE6, 768 }, {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX465, "NVIDIA GeForce GTX 465", DRIVER_NVIDIA_GEFORCE6, 1024}, {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX470, "NVIDIA GeForce GTX 470", DRIVER_NVIDIA_GEFORCE6, 1280}, {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX480, "NVIDIA GeForce GTX 480", DRIVER_NVIDIA_GEFORCE6, 1536}, - /* ATI cards */ - {HW_VENDOR_ATI, CARD_ATI_RAGE_128PRO, "ATI Rage Fury", DRIVER_ATI_RAGE_128PRO, 16 }, - {HW_VENDOR_ATI, CARD_ATI_RADEON_7200, "ATI RADEON 7200 SERIES", DRIVER_ATI_R100, 32 }, - {HW_VENDOR_ATI, CARD_ATI_RADEON_8500, "ATI RADEON 8500 SERIES", DRIVER_ATI_R100, 64 }, - {HW_VENDOR_ATI, CARD_ATI_RADEON_9500, "ATI Radeon 9500", DRIVER_ATI_R300, 64 }, - {HW_VENDOR_ATI, CARD_ATI_RADEON_XPRESS_200M, "ATI RADEON XPRESS 200M Series", DRIVER_ATI_R300, 64 }, - {HW_VENDOR_ATI, CARD_ATI_RADEON_X700, "ATI Radeon X700 SE", DRIVER_ATI_R300, 128 }, - {HW_VENDOR_ATI, CARD_ATI_RADEON_X1600, "ATI Radeon X1600 Series", DRIVER_ATI_R300, 128 }, - {HW_VENDOR_ATI, CARD_ATI_RADEON_HD2350, "ATI Mobility Radeon HD 2350", DRIVER_ATI_R600, 256 }, - {HW_VENDOR_ATI, CARD_ATI_RADEON_HD2600, "ATI Mobility Radeon HD 2600", DRIVER_ATI_R600, 256 }, - {HW_VENDOR_ATI, CARD_ATI_RADEON_HD2900, "ATI Radeon HD 2900 XT", DRIVER_ATI_R600, 512 }, - {HW_VENDOR_ATI, CARD_ATI_RADEON_HD3200, "ATI Radeon HD 3200 Graphics", DRIVER_ATI_R600, 128 }, - {HW_VENDOR_ATI, CARD_ATI_RADEON_HD4350, "ATI Radeon HD 4350", DRIVER_ATI_R600, 256 }, - {HW_VENDOR_ATI, CARD_ATI_RADEON_HD4600, "ATI Radeon HD 4600 Series", DRIVER_ATI_R600, 512 }, - {HW_VENDOR_ATI, CARD_ATI_RADEON_HD4700, "ATI Radeon HD 4700 Series", DRIVER_ATI_R600, 512 }, - {HW_VENDOR_ATI, CARD_ATI_RADEON_HD4800, "ATI Radeon HD 4800 Series", DRIVER_ATI_R600, 512 }, - {HW_VENDOR_ATI, CARD_ATI_RADEON_HD5700, "ATI Radeon HD 5700 Series", DRIVER_ATI_R600, 512 }, - {HW_VENDOR_ATI, CARD_ATI_RADEON_HD5800, "ATI Radeon HD 5800 Series", DRIVER_ATI_R600, 1024}, + {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX560, "NVIDIA GeForce GTX 560 TI", DRIVER_NVIDIA_GEFORCE6, 1024}, + {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX570, "NVIDIA GeForce GTX 570", DRIVER_NVIDIA_GEFORCE6, 1280}, + {HW_VENDOR_NVIDIA, CARD_NVIDIA_GEFORCE_GTX580, "NVIDIA GeForce GTX 580", DRIVER_NVIDIA_GEFORCE6, 1536}, + + /* AMD cards */ + {HW_VENDOR_AMD, CARD_AMD_RAGE_128PRO, "ATI Rage Fury", DRIVER_AMD_RAGE_128PRO, 16 }, + {HW_VENDOR_AMD, CARD_AMD_RADEON_7200, "ATI RADEON 7200 SERIES", DRIVER_AMD_R100, 32 }, + {HW_VENDOR_AMD, CARD_AMD_RADEON_8500, "ATI RADEON 8500 SERIES", DRIVER_AMD_R100, 64 }, + {HW_VENDOR_AMD, CARD_AMD_RADEON_9500, "ATI Radeon 9500", DRIVER_AMD_R300, 64 }, + {HW_VENDOR_AMD, CARD_AMD_RADEON_XPRESS_200M, "ATI RADEON XPRESS 200M Series", DRIVER_AMD_R300, 64 }, + {HW_VENDOR_AMD, CARD_AMD_RADEON_X700, "ATI Radeon X700 SE", DRIVER_AMD_R300, 128 }, + {HW_VENDOR_AMD, CARD_AMD_RADEON_X1600, "ATI Radeon X1600 Series", DRIVER_AMD_R300, 128 }, + {HW_VENDOR_AMD, CARD_AMD_RADEON_HD2350, "ATI Mobility Radeon HD 2350", DRIVER_AMD_R600, 256 }, + {HW_VENDOR_AMD, CARD_AMD_RADEON_HD2600, "ATI Mobility Radeon HD 2600", DRIVER_AMD_R600, 256 }, + {HW_VENDOR_AMD, CARD_AMD_RADEON_HD2900, "ATI Radeon HD 2900 XT", DRIVER_AMD_R600, 512 }, + {HW_VENDOR_AMD, CARD_AMD_RADEON_HD3200, "ATI Radeon HD 3200 Graphics", DRIVER_AMD_R600, 128 }, + {HW_VENDOR_AMD, CARD_AMD_RADEON_HD4350, "ATI Radeon HD 4350", DRIVER_AMD_R600, 256 }, + {HW_VENDOR_AMD, CARD_AMD_RADEON_HD4600, "ATI Radeon HD 4600 Series", DRIVER_AMD_R600, 512 }, + {HW_VENDOR_AMD, CARD_AMD_RADEON_HD4700, "ATI Radeon HD 4700 Series", DRIVER_AMD_R600, 512 }, + {HW_VENDOR_AMD, CARD_AMD_RADEON_HD4800, "ATI Radeon HD 4800 Series", DRIVER_AMD_R600, 512 }, + {HW_VENDOR_AMD, CARD_AMD_RADEON_HD5400, "ATI Radeon HD 5400 Series", DRIVER_AMD_R600, 512 }, + {HW_VENDOR_AMD, CARD_AMD_RADEON_HD5600, "ATI Radeon HD 5600 Series", DRIVER_AMD_R600, 512 }, + {HW_VENDOR_AMD, CARD_AMD_RADEON_HD5700, "ATI Radeon HD 5700 Series", DRIVER_AMD_R600, 512 }, + {HW_VENDOR_AMD, CARD_AMD_RADEON_HD5800, "ATI Radeon HD 5800 Series", DRIVER_AMD_R600, 1024}, + {HW_VENDOR_AMD, CARD_AMD_RADEON_HD5900, "ATI Radeon HD 5900 Series", DRIVER_AMD_R600, 1024}, + {HW_VENDOR_AMD, CARD_AMD_RADEON_HD6310, "AMD Radeon HD 6310 Graphics", DRIVER_AMD_R600, 1024}, + {HW_VENDOR_AMD, CARD_AMD_RADEON_HD6800, "AMD Radeon HD 6800 Series", DRIVER_AMD_R600, 1024}, + {HW_VENDOR_AMD, CARD_AMD_RADEON_HD6900, "AMD Radeon HD 6900 Series", DRIVER_AMD_R600, 2048}, /* Intel cards */ {HW_VENDOR_INTEL, CARD_INTEL_I830G, "Intel(R) 82830M Graphics Controller", DRIVER_INTEL_GMA800, 32 }, {HW_VENDOR_INTEL, CARD_INTEL_I855G, "Intel(R) 82852/82855 GM/GME Graphics Controller", DRIVER_INTEL_GMA800, 32 }, @@ -1111,7 +1109,8 @@ static const struct gpu_description gpu_description_table[] = {HW_VENDOR_INTEL, CARD_INTEL_I915G, "Intel(R) 82915G/GV/910GL Express Chipset Family", DRIVER_INTEL_GMA900, 64 }, {HW_VENDOR_INTEL, CARD_INTEL_I915GM, "Mobile Intel(R) 915GM/GMS,910GML Express Chipset Family", DRIVER_INTEL_GMA900, 64 }, {HW_VENDOR_INTEL, CARD_INTEL_I945GM, "Mobile Intel(R) 945GM Express Chipset Family", DRIVER_INTEL_GMA950, 64 }, - {HW_VENDOR_INTEL, CARD_INTEL_X3100, "Mobile Intel(R) 965 Express Chipset Family", DRIVER_INTEL_GMA3000, 128} + {HW_VENDOR_INTEL, CARD_INTEL_X3100, "Mobile Intel(R) 965 Express Chipset Family", DRIVER_INTEL_GMA3000, 128}, + {HW_VENDOR_INTEL, CARD_INTEL_GM45, "Mobile Intel(R) GM45 Express Chipset Family", DRIVER_INTEL_GMA3000, 512} }; static const struct driver_version_information *get_driver_version_info(enum wined3d_display_driver driver, @@ -1367,18 +1366,20 @@ static enum wined3d_gl_vendor wined3d_guess_gl_vendor(struct wined3d_gl_info *gl static enum wined3d_pci_vendor wined3d_guess_card_vendor(const char *gl_vendor_string, const char *gl_renderer) { - if (strstr(gl_vendor_string, "NVIDIA")) + if (strstr(gl_vendor_string, "NVIDIA") + || strstr(gl_vendor_string, "nouveau")) return HW_VENDOR_NVIDIA; if (strstr(gl_vendor_string, "ATI") || strstr(gl_vendor_string, "Advanced Micro Devices, Inc.") || strstr(gl_vendor_string, "X.Org R300 Project") + || strstr(gl_renderer, "AMD") || strstr(gl_renderer, "R100") || strstr(gl_renderer, "R200") || strstr(gl_renderer, "R300") || strstr(gl_renderer, "R600") || strstr(gl_renderer, "R700")) - return HW_VENDOR_ATI; + return HW_VENDOR_AMD; if (strstr(gl_vendor_string, "Intel(R)") /* Intel switched from Intel(R) to Intel® recently, so just match Intel. */ @@ -1401,161 +1402,74 @@ static enum wined3d_pci_vendor wined3d_guess_card_vendor(const char *gl_vendor_s static enum wined3d_pci_device select_card_nvidia_binary(const struct wined3d_gl_info *gl_info, const char *gl_renderer) { + unsigned int i; + if (WINE_D3D10_CAPABLE(gl_info)) { - /* Geforce 400 - highend */ - if (strstr(gl_renderer, "GTX 480")) + static const struct { - return CARD_NVIDIA_GEFORCE_GTX480; + const char *renderer; + enum wined3d_pci_device id; } + cards[] = + { + {"GTX 580", CARD_NVIDIA_GEFORCE_GTX580}, /* Geforce 500 - highend */ + {"GTX 570", CARD_NVIDIA_GEFORCE_GTX570}, /* Geforce 500 - midend high */ + {"GTX 560 TI", CARD_NVIDIA_GEFORCE_GTX560}, /* Geforce 500 - midend */ + {"GTX 480", CARD_NVIDIA_GEFORCE_GTX480}, /* Geforce 400 - highend */ + {"GTX 470", CARD_NVIDIA_GEFORCE_GTX470}, /* Geforce 400 - midend high */ + {"GTX 465", CARD_NVIDIA_GEFORCE_GTX465}, /* Geforce 400 - midend */ + {"GTX 460", CARD_NVIDIA_GEFORCE_GTX460}, /* Geforce 400 - midend */ + {"GTS 450", CARD_NVIDIA_GEFORCE_GTS450}, /* Geforce 400 - midend low */ + {"GT 440", CARD_NVIDIA_GEFORCE_GT440}, /* Geforce 400 - lowend */ + {"GT 430", CARD_NVIDIA_GEFORCE_GT430}, /* Geforce 400 - lowend */ + {"GT 420", CARD_NVIDIA_GEFORCE_GT420}, /* Geforce 400 - lowend */ + {"GT 330", CARD_NVIDIA_GEFORCE_GT330}, /* Geforce 300 - highend */ + {"GTS 360M", CARD_NVIDIA_GEFORCE_GTS350M}, /* Geforce 300 - highend mobile */ + {"GTS 350M", CARD_NVIDIA_GEFORCE_GTS350M}, /* Geforce 300 - highend mobile */ + {"GT 330M", CARD_NVIDIA_GEFORCE_GT325M}, /* Geforce 300 - midend mobile */ + {"GT 325M", CARD_NVIDIA_GEFORCE_GT325M}, /* Geforce 300 - midend mobile */ + {"GT 320M", CARD_NVIDIA_GEFORCE_GT320M}, /* Geforce 300 - midend mobile */ + {"GTX 295", CARD_NVIDIA_GEFORCE_GTX280}, /* Geforce 200 - highend */ + {"GTX 285", CARD_NVIDIA_GEFORCE_GTX280}, /* Geforce 200 - highend */ + {"GTX 280", CARD_NVIDIA_GEFORCE_GTX280}, /* Geforce 200 - highend */ + {"GTX 275", CARD_NVIDIA_GEFORCE_GTX275}, /* Geforce 200 - midend high */ + {"GTX 260", CARD_NVIDIA_GEFORCE_GTX260}, /* Geforce 200 - midend */ + {"GT 240", CARD_NVIDIA_GEFORCE_GT240}, /* Geforce 200 - midend */ + {"GT 220", CARD_NVIDIA_GEFORCE_GT220}, /* Geforce 200 - lowend */ + {"Geforce 310", CARD_NVIDIA_GEFORCE_210}, /* Geforce 200 - lowend */ + {"Geforce 305", CARD_NVIDIA_GEFORCE_210}, /* Geforce 200 - lowend */ + {"Geforce 210", CARD_NVIDIA_GEFORCE_210}, /* Geforce 200 - lowend */ + {"G 210", CARD_NVIDIA_GEFORCE_210}, /* Geforce 200 - lowend */ + {"GTS 250", CARD_NVIDIA_GEFORCE_9800GT}, /* Geforce 9 - highend / Geforce 200 - midend */ + {"GTS 150", CARD_NVIDIA_GEFORCE_9800GT}, /* Geforce 9 - highend / Geforce 200 - midend */ + {"9800", CARD_NVIDIA_GEFORCE_9800GT}, /* Geforce 9 - highend / Geforce 200 - midend */ + {"GT 140", CARD_NVIDIA_GEFORCE_9600GT}, /* Geforce 9 - midend */ + {"9600", CARD_NVIDIA_GEFORCE_9600GT}, /* Geforce 9 - midend */ + {"GT 130", CARD_NVIDIA_GEFORCE_9500GT}, /* Geforce 9 - midend low / Geforce 200 - low */ + {"GT 120", CARD_NVIDIA_GEFORCE_9500GT}, /* Geforce 9 - midend low / Geforce 200 - low */ + {"9500", CARD_NVIDIA_GEFORCE_9500GT}, /* Geforce 9 - midend low / Geforce 200 - low */ + {"9400", CARD_NVIDIA_GEFORCE_9400GT}, /* Geforce 9 - lowend */ + {"9300", CARD_NVIDIA_GEFORCE_9200}, /* Geforce 9 - lowend low */ + {"9200", CARD_NVIDIA_GEFORCE_9200}, /* Geforce 9 - lowend low */ + {"9100", CARD_NVIDIA_GEFORCE_9200}, /* Geforce 9 - lowend low */ + {"G 100", CARD_NVIDIA_GEFORCE_9200}, /* Geforce 9 - lowend low */ + {"8800 GTX", CARD_NVIDIA_GEFORCE_8800GTX}, /* Geforce 8 - highend high */ + {"8800", CARD_NVIDIA_GEFORCE_8800GTS}, /* Geforce 8 - highend */ + {"8600 M", CARD_NVIDIA_GEFORCE_8600MGT}, /* Geforce 8 - midend mobile */ + {"8700", CARD_NVIDIA_GEFORCE_8600GT}, /* Geforce 8 - midend */ + {"8600", CARD_NVIDIA_GEFORCE_8600GT}, /* Geforce 8 - midend */ + {"8500", CARD_NVIDIA_GEFORCE_8400GS}, /* Geforce 8 - mid-lowend */ + {"8400", CARD_NVIDIA_GEFORCE_8400GS}, /* Geforce 8 - mid-lowend */ + {"8300", CARD_NVIDIA_GEFORCE_8300GS}, /* Geforce 8 - lowend */ + {"8200", CARD_NVIDIA_GEFORCE_8300GS}, /* Geforce 8 - lowend */ + {"8100", CARD_NVIDIA_GEFORCE_8300GS}, /* Geforce 8 - lowend */ + }; - /* Geforce 400 - midend high */ - if (strstr(gl_renderer, "GTX 470")) + for (i = 0; i < sizeof(cards) / sizeof(*cards); ++i) { - return CARD_NVIDIA_GEFORCE_GTX470; - } - - /* Geforce 400 - midend */ - if (strstr(gl_renderer, "GTX 465")) - { - return CARD_NVIDIA_GEFORCE_GTX465; - } - - /* Geforce 400 - midend */ - if (strstr(gl_renderer, "GTX 460")) - { - return CARD_NVIDIA_GEFORCE_GTX460; - } - - /* Geforce 300 highend mobile */ - if (strstr(gl_renderer, "GTS 350M") - || strstr(gl_renderer, "GTS 360M")) - { - return CARD_NVIDIA_GEFORCE_GTS350M; - } - - /* Geforce 300 midend mobile (Geforce GT 325M/330M use the same core) */ - if (strstr(gl_renderer, "GT 325M") - || strstr(gl_renderer, "GT 330M")) - { - return CARD_NVIDIA_GEFORCE_GT325M; - } - - /* Geforce 200 - highend */ - if (strstr(gl_renderer, "GTX 280") - || strstr(gl_renderer, "GTX 285") - || strstr(gl_renderer, "GTX 295")) - { - return CARD_NVIDIA_GEFORCE_GTX280; - } - - /* Geforce 200 - midend high */ - if (strstr(gl_renderer, "GTX 275")) - { - return CARD_NVIDIA_GEFORCE_GTX275; - } - - /* Geforce 200 - midend */ - if (strstr(gl_renderer, "GTX 260")) - { - return CARD_NVIDIA_GEFORCE_GTX260; - } - /* Geforce 200 - midend */ - if (strstr(gl_renderer, "GT 240")) - { - return CARD_NVIDIA_GEFORCE_GT240; - } - - /* Geforce 200 lowend */ - if (strstr(gl_renderer, "GT 220")) - { - return CARD_NVIDIA_GEFORCE_GT220; - } - /* Geforce 200 lowend (Geforce 305/310 use the same core) */ - if (strstr(gl_renderer, "Geforce 210") - || strstr(gl_renderer, "G 210") - || strstr(gl_renderer, "Geforce 305") - || strstr(gl_renderer, "Geforce 310")) - { - return CARD_NVIDIA_GEFORCE_210; - } - - /* Geforce9 - highend / Geforce 200 - midend (GTS 150/250 are based on the same core) */ - if (strstr(gl_renderer, "9800") - || strstr(gl_renderer, "GTS 150") - || strstr(gl_renderer, "GTS 250")) - { - return CARD_NVIDIA_GEFORCE_9800GT; - } - - /* Geforce9 - midend (GT 140 uses the same core as the 9600GT) */ - if (strstr(gl_renderer, "9600") - || strstr(gl_renderer, "GT 140")) - { - return CARD_NVIDIA_GEFORCE_9600GT; - } - - /* Geforce9 - midend low / Geforce 200 - low */ - if (strstr(gl_renderer, "9500") - || strstr(gl_renderer, "GT 120") - || strstr(gl_renderer, "GT 130")) - { - return CARD_NVIDIA_GEFORCE_9500GT; - } - - /* Geforce9 - lowend */ - if (strstr(gl_renderer, "9400")) - { - return CARD_NVIDIA_GEFORCE_9400GT; - } - - /* Geforce9 - lowend low */ - if (strstr(gl_renderer, "9100") - || strstr(gl_renderer, "9200") - || strstr(gl_renderer, "9300") - || strstr(gl_renderer, "G 100")) - { - return CARD_NVIDIA_GEFORCE_9200; - } - - /* Geforce8 - highend high*/ - if (strstr(gl_renderer, "8800 GTX")) - { - return CARD_NVIDIA_GEFORCE_8800GTX; - } - - /* Geforce8 - highend */ - if (strstr(gl_renderer, "8800")) - { - return CARD_NVIDIA_GEFORCE_8800GTS; - } - - /* Geforce8 - midend mobile */ - if (strstr(gl_renderer, "8600 M")) - { - return CARD_NVIDIA_GEFORCE_8600MGT; - } - - /* Geforce8 - midend */ - if (strstr(gl_renderer, "8600") - || strstr(gl_renderer, "8700")) - { - return CARD_NVIDIA_GEFORCE_8600GT; - } - - /* Geforce8 - mid-lowend */ - if (strstr(gl_renderer, "8400") - || strstr(gl_renderer, "8500")) - { - return CARD_NVIDIA_GEFORCE_8400GS; - } - - /* Geforce8 - lowend */ - if (strstr(gl_renderer, "8100") - || strstr(gl_renderer, "8200") - || strstr(gl_renderer, "8300")) - { - return CARD_NVIDIA_GEFORCE_8300GS; + if (strstr(gl_renderer, cards[i].renderer)) + return cards[i].id; } /* Geforce8-compatible fall back if the GPU is not in the list yet */ @@ -1567,50 +1481,35 @@ static enum wined3d_pci_device select_card_nvidia_binary(const struct wined3d_gl */ if (WINE_D3D9_CAPABLE(gl_info) && gl_info->supported[NV_VERTEX_PROGRAM3]) { - /* Geforce7 - highend */ - if (strstr(gl_renderer, "7800") - || strstr(gl_renderer, "7900") - || strstr(gl_renderer, "7950") - || strstr(gl_renderer, "Quadro FX 4") - || strstr(gl_renderer, "Quadro FX 5")) + static const struct { - return CARD_NVIDIA_GEFORCE_7800GT; + const char *renderer; + enum wined3d_pci_device id; + } + cards[] = + { + {"Quadro FX 5", CARD_NVIDIA_GEFORCE_7800GT}, /* Geforce 7 - highend */ + {"Quadro FX 4", CARD_NVIDIA_GEFORCE_7800GT}, /* Geforce 7 - highend */ + {"7950", CARD_NVIDIA_GEFORCE_7800GT}, /* Geforce 7 - highend */ + {"7900", CARD_NVIDIA_GEFORCE_7800GT}, /* Geforce 7 - highend */ + {"7800", CARD_NVIDIA_GEFORCE_7800GT}, /* Geforce 7 - highend */ + {"7700", CARD_NVIDIA_GEFORCE_7600}, /* Geforce 7 - midend */ + {"7600", CARD_NVIDIA_GEFORCE_7600}, /* Geforce 7 - midend */ + {"7400", CARD_NVIDIA_GEFORCE_7400}, /* Geforce 7 - lower medium */ + {"7300", CARD_NVIDIA_GEFORCE_7300}, /* Geforce 7 - lowend */ + {"6800", CARD_NVIDIA_GEFORCE_6800}, /* Geforce 6 - highend */ + {"6700", CARD_NVIDIA_GEFORCE_6600GT}, /* Geforce 6 - midend */ + {"6610", CARD_NVIDIA_GEFORCE_6600GT}, /* Geforce 6 - midend */ + {"6600", CARD_NVIDIA_GEFORCE_6600GT}, /* Geforce 6 - midend */ + }; + + for (i = 0; i < sizeof(cards) / sizeof(*cards); ++i) + { + if (strstr(gl_renderer, cards[i].renderer)) + return cards[i].id; } - /* Geforce7 midend */ - if (strstr(gl_renderer, "7600") - || strstr(gl_renderer, "7700")) - { - return CARD_NVIDIA_GEFORCE_7600; - } - - /* Geforce7 lower medium */ - if (strstr(gl_renderer, "7400")) - { - return CARD_NVIDIA_GEFORCE_7400; - } - - /* Geforce7 lowend */ - if (strstr(gl_renderer, "7300")) - { - return CARD_NVIDIA_GEFORCE_7300; - } - - /* Geforce6 highend */ - if (strstr(gl_renderer, "6800")) - { - return CARD_NVIDIA_GEFORCE_6800; - } - - /* Geforce6 - midend */ - if (strstr(gl_renderer, "6600") - || strstr(gl_renderer, "6610") - || strstr(gl_renderer, "6700")) - { - return CARD_NVIDIA_GEFORCE_6600GT; - } - - /* Geforce6/7 lowend */ + /* Geforce 6/7 - lowend */ return CARD_NVIDIA_GEFORCE_6200; /* Geforce 6100/6150/6200/7300/7400/7500 */ } @@ -1676,7 +1575,7 @@ static enum wined3d_pci_device select_card_nvidia_binary(const struct wined3d_gl return CARD_NVIDIA_RIVA_TNT; /* Riva TNT, Vanta */ } -static enum wined3d_pci_device select_card_ati_binary(const struct wined3d_gl_info *gl_info, +static enum wined3d_pci_device select_card_amd_binary(const struct wined3d_gl_info *gl_info, const char *gl_renderer) { /* See http://developer.amd.com/drivers/pc_vendor_id/Pages/default.aspx @@ -1685,93 +1584,67 @@ static enum wined3d_pci_device select_card_ati_binary(const struct wined3d_gl_in * eg HD 4800 is returned for multiple cards, even for RV790 based ones. */ if (WINE_D3D10_CAPABLE(gl_info)) { - /* Radeon EG CYPRESS XT / PRO HD5800 - highend */ - if (strstr(gl_renderer, "HD 5800") /* Radeon EG CYPRESS HD58xx generic renderer string */ - || strstr(gl_renderer, "HD 5850") /* Radeon EG CYPRESS XT */ - || strstr(gl_renderer, "HD 5870")) /* Radeon EG CYPRESS PRO */ - { - return CARD_ATI_RADEON_HD5800; - } + unsigned int i; - /* Radeon EG JUNIPER XT / LE HD5700 - midend */ - if (strstr(gl_renderer, "HD 5700") /* Radeon EG JUNIPER HD57xx generic renderer string */ - || strstr(gl_renderer, "HD 5750") /* Radeon EG JUNIPER LE */ - || strstr(gl_renderer, "HD 5770")) /* Radeon EG JUNIPER XT */ + static const struct { - return CARD_ATI_RADEON_HD5700; + const char *renderer; + enum wined3d_pci_device id; } - - /* Radeon R7xx HD4800 - highend */ - if (strstr(gl_renderer, "HD 4800") /* Radeon RV7xx HD48xx generic renderer string */ - || strstr(gl_renderer, "HD 4830") /* Radeon RV770 */ - || strstr(gl_renderer, "HD 4850") /* Radeon RV770 */ - || strstr(gl_renderer, "HD 4870") /* Radeon RV770 */ - || strstr(gl_renderer, "HD 4890")) /* Radeon RV790 */ + cards[] = { - return CARD_ATI_RADEON_HD4800; - } + /* Evergreen */ + {"HD 5870", CARD_AMD_RADEON_HD5800}, /* Radeon EG CYPRESS PRO */ + {"HD 5850", CARD_AMD_RADEON_HD5800}, /* Radeon EG CYPRESS XT */ + {"HD 5800", CARD_AMD_RADEON_HD5800}, /* Radeon EG CYPRESS HD58xx generic renderer string */ + {"HD 5770", CARD_AMD_RADEON_HD5700}, /* Radeon EG JUNIPER XT */ + {"HD 5750", CARD_AMD_RADEON_HD5700}, /* Radeon EG JUNIPER LE */ + {"HD 5700", CARD_AMD_RADEON_HD5700}, /* Radeon EG JUNIPER HD57xx generic renderer string */ + {"HD 5670", CARD_AMD_RADEON_HD5600}, /* Radeon EG REDWOOD XT */ + {"HD 5570", CARD_AMD_RADEON_HD5600}, /* Radeon EG REDWOOD PRO mapped to HD5600 series */ + {"HD 5550", CARD_AMD_RADEON_HD5600}, /* Radeon EG REDWOOD LE mapped to HD5600 series */ + {"HD 5450", CARD_AMD_RADEON_HD5400}, /* Radeon EG CEDAR PRO */ + /* R700 */ + {"HD 4890", CARD_AMD_RADEON_HD4800}, /* Radeon RV790 */ + {"HD 4870", CARD_AMD_RADEON_HD4800}, /* Radeon RV770 */ + {"HD 4850", CARD_AMD_RADEON_HD4800}, /* Radeon RV770 */ + {"HD 4830", CARD_AMD_RADEON_HD4800}, /* Radeon RV770 */ + {"HD 4800", CARD_AMD_RADEON_HD4800}, /* Radeon RV7xx HD48xx generic renderer string */ + {"HD 4770", CARD_AMD_RADEON_HD4700}, /* Radeon RV740 */ + {"HD 4700", CARD_AMD_RADEON_HD4700}, /* Radeon RV7xx HD47xx generic renderer string */ + {"HD 4670", CARD_AMD_RADEON_HD4600}, /* Radeon RV730 */ + {"HD 4650", CARD_AMD_RADEON_HD4600}, /* Radeon RV730 */ + {"HD 4600", CARD_AMD_RADEON_HD4600}, /* Radeon RV730 */ + {"HD 4550", CARD_AMD_RADEON_HD4350}, /* Radeon RV710 */ + {"HD 4350", CARD_AMD_RADEON_HD4350}, /* Radeon RV710 */ + /* R600/R700 integrated */ + {"HD 3300", CARD_AMD_RADEON_HD3200}, + {"HD 3200", CARD_AMD_RADEON_HD3200}, + {"HD 3100", CARD_AMD_RADEON_HD3200}, + /* R600 */ + {"HD 3870", CARD_AMD_RADEON_HD2900}, /* HD2900/HD3800 - highend */ + {"HD 3850", CARD_AMD_RADEON_HD2900}, /* HD2900/HD3800 - highend */ + {"HD 2900", CARD_AMD_RADEON_HD2900}, /* HD2900/HD3800 - highend */ + {"HD 3830", CARD_AMD_RADEON_HD2600}, /* China-only midend */ + {"HD 3690", CARD_AMD_RADEON_HD2600}, /* HD2600/HD3600 - midend */ + {"HD 3650", CARD_AMD_RADEON_HD2600}, /* HD2600/HD3600 - midend */ + {"HD 2600", CARD_AMD_RADEON_HD2600}, /* HD2600/HD3600 - midend */ + {"HD 3470", CARD_AMD_RADEON_HD2350}, /* HD2350/HD2400/HD3400 - lowend */ + {"HD 3450", CARD_AMD_RADEON_HD2350}, /* HD2350/HD2400/HD3400 - lowend */ + {"HD 3430", CARD_AMD_RADEON_HD2350}, /* HD2350/HD2400/HD3400 - lowend */ + {"HD 3400", CARD_AMD_RADEON_HD2350}, /* HD2350/HD2400/HD3400 - lowend */ + {"HD 2400", CARD_AMD_RADEON_HD2350}, /* HD2350/HD2400/HD3400 - lowend */ + {"HD 2350", CARD_AMD_RADEON_HD2350}, /* HD2350/HD2400/HD3400 - lowend */ + }; - /* Radeon R740 HD4700 - midend */ - if (strstr(gl_renderer, "HD 4700") /* Radeon RV770 */ - || strstr(gl_renderer, "HD 4770")) /* Radeon RV740 */ + for (i = 0; i < sizeof(cards) / sizeof(*cards); ++i) { - return CARD_ATI_RADEON_HD4700; - } - - /* Radeon R730 HD4600 - midend */ - if (strstr(gl_renderer, "HD 4600") /* Radeon RV730 */ - || strstr(gl_renderer, "HD 4650") /* Radeon RV730 */ - || strstr(gl_renderer, "HD 4670")) /* Radeon RV730 */ - { - return CARD_ATI_RADEON_HD4600; - } - - /* Radeon R710 HD4500/HD4350 - lowend */ - if (strstr(gl_renderer, "HD 4350") /* Radeon RV710 */ - || strstr(gl_renderer, "HD 4550")) /* Radeon RV710 */ - { - return CARD_ATI_RADEON_HD4350; - } - - /* Radeon R6xx HD2900/HD3800 - highend */ - if (strstr(gl_renderer, "HD 2900") - || strstr(gl_renderer, "HD 3870") - || strstr(gl_renderer, "HD 3850")) - { - return CARD_ATI_RADEON_HD2900; - } - - /* Radeon R6xx HD2600/HD3600 - midend; HD3830 is China-only midend */ - if (strstr(gl_renderer, "HD 2600") - || strstr(gl_renderer, "HD 3830") - || strstr(gl_renderer, "HD 3690") - || strstr(gl_renderer, "HD 3650")) - { - return CARD_ATI_RADEON_HD2600; - } - - /* Radeon R6xx HD2350/HD2400/HD3400 - lowend - * Note HD2300=DX9, HD2350=DX10 */ - if (strstr(gl_renderer, "HD 2350") - || strstr(gl_renderer, "HD 2400") - || strstr(gl_renderer, "HD 3470") - || strstr(gl_renderer, "HD 3450") - || strstr(gl_renderer, "HD 3430") - || strstr(gl_renderer, "HD 3400")) - { - return CARD_ATI_RADEON_HD2350; - } - - /* Radeon R6xx/R7xx integrated */ - if (strstr(gl_renderer, "HD 3100") - || strstr(gl_renderer, "HD 3200") - || strstr(gl_renderer, "HD 3300")) - { - return CARD_ATI_RADEON_HD3200; + if (strstr(gl_renderer, cards[i].renderer)) + return cards[i].id; } /* Default for when no GPU has been found */ - return CARD_ATI_RADEON_HD3200; + return CARD_AMD_RADEON_HD3200; } if (WINE_D3D8_CAPABLE(gl_info)) @@ -1783,7 +1656,7 @@ static enum wined3d_pci_device select_card_ati_binary(const struct wined3d_gl_in || strstr(gl_renderer, "X1900") || strstr(gl_renderer, "X1950")) { - return CARD_ATI_RADEON_X1600; + return CARD_AMD_RADEON_X1600; } /* Radeon R4xx + X1300/X1400/X1450/X1550/X2300/X2500/HD2300 (lowend R5xx) @@ -1800,35 +1673,36 @@ static enum wined3d_pci_device select_card_ati_binary(const struct wined3d_gl_in || strstr(gl_renderer, "HD 2300") ) { - return CARD_ATI_RADEON_X700; + return CARD_AMD_RADEON_X700; } /* Radeon Xpress Series - onboard, DX9b, Shader 2.0, 300-400MHz */ if (strstr(gl_renderer, "Radeon Xpress")) { - return CARD_ATI_RADEON_XPRESS_200M; + return CARD_AMD_RADEON_XPRESS_200M; } /* Radeon R3xx */ - return CARD_ATI_RADEON_9500; /* Radeon 9500/9550/9600/9700/9800/X300/X550/X600 */ + return CARD_AMD_RADEON_9500; /* Radeon 9500/9550/9600/9700/9800/X300/X550/X600 */ } if (WINE_D3D8_CAPABLE(gl_info)) { - return CARD_ATI_RADEON_8500; /* Radeon 8500/9000/9100/9200/9300 */ + return CARD_AMD_RADEON_8500; /* Radeon 8500/9000/9100/9200/9300 */ } if (WINE_D3D7_CAPABLE(gl_info)) { - return CARD_ATI_RADEON_7200; /* Radeon 7000/7100/7200/7500 */ + return CARD_AMD_RADEON_7200; /* Radeon 7000/7100/7200/7500 */ } - return CARD_ATI_RAGE_128PRO; + return CARD_AMD_RAGE_128PRO; } static enum wined3d_pci_device select_card_intel(const struct wined3d_gl_info *gl_info, const char *gl_renderer) { + if (strstr(gl_renderer, "GM45")) return CARD_INTEL_GM45; if (strstr(gl_renderer, "X3100") || strstr(gl_renderer, "965GM")) { /* MacOS calls the card GMA X3100, otherwise known as GM965/GL960 */ @@ -1850,195 +1724,225 @@ static enum wined3d_pci_device select_card_intel(const struct wined3d_gl_info *g } -static enum wined3d_pci_device select_card_ati_mesa(const struct wined3d_gl_info *gl_info, +static enum wined3d_pci_device select_card_amd_mesa(const struct wined3d_gl_info *gl_info, const char *gl_renderer) { + unsigned int i; + /* See http://developer.amd.com/drivers/pc_vendor_id/Pages/default.aspx * * Beware: renderer string do not match exact card model, * eg HD 4800 is returned for multiple cards, even for RV790 based ones. */ if (strstr(gl_renderer, "Gallium")) { - /* Radeon R7xx HD4800 - highend */ - if (strstr(gl_renderer, "R700") /* Radeon R7xx HD48xx generic renderer string */ - || strstr(gl_renderer, "RV770") /* Radeon RV770 */ - || strstr(gl_renderer, "RV790")) /* Radeon RV790 */ + /* 20101109 - These are never returned by current Gallium radeon + * drivers: R700, RV790, R680, RV535, RV516, R410, RS485, RV360, RV351. + * + * These are returned but not handled: RC410, RV380. */ + static const struct { - return CARD_ATI_RADEON_HD4800; + const char *renderer; + enum wined3d_pci_device id; } - - /* Radeon R740 HD4700 - midend */ - if (strstr(gl_renderer, "RV740")) /* Radeon RV740 */ + cards[] = { - return CARD_ATI_RADEON_HD4700; - } + /* Northern Islands */ + {"CAYMAN", CARD_AMD_RADEON_HD6900}, + {"BARTS", CARD_AMD_RADEON_HD6800}, + {"PALM", CARD_AMD_RADEON_HD6310}, + /* Evergreen */ + {"HEMLOCK", CARD_AMD_RADEON_HD5900}, + {"CYPRESS", CARD_AMD_RADEON_HD5800}, + {"JUNIPER", CARD_AMD_RADEON_HD5700}, + {"REDWOOD", CARD_AMD_RADEON_HD5600}, + {"CEDAR", CARD_AMD_RADEON_HD5400}, + /* R700 */ + {"R700", CARD_AMD_RADEON_HD4800}, /* HD4800 - highend */ + {"RV790", CARD_AMD_RADEON_HD4800}, + {"RV770", CARD_AMD_RADEON_HD4800}, + {"RV740", CARD_AMD_RADEON_HD4700}, /* HD4700 - midend */ + {"RV730", CARD_AMD_RADEON_HD4600}, /* HD4600 - midend */ + {"RV710", CARD_AMD_RADEON_HD4350}, /* HD4500/HD4350 - lowend */ + /* R600/R700 integrated */ + {"RS880", CARD_AMD_RADEON_HD3200}, + {"RS780", CARD_AMD_RADEON_HD3200}, + /* R600 */ + {"R680", CARD_AMD_RADEON_HD2900}, /* HD2900/HD3800 - highend */ + {"R600", CARD_AMD_RADEON_HD2900}, + {"RV670", CARD_AMD_RADEON_HD2900}, + {"RV635", CARD_AMD_RADEON_HD2600}, /* HD2600/HD3600 - midend; HD3830 is China-only midend */ + {"RV630", CARD_AMD_RADEON_HD2600}, + {"RV620", CARD_AMD_RADEON_HD2350}, /* HD2350/HD2400/HD3400 - lowend */ + {"RV610", CARD_AMD_RADEON_HD2350}, + /* R500 */ + {"R580", CARD_AMD_RADEON_X1600}, + {"R520", CARD_AMD_RADEON_X1600}, + {"RV570", CARD_AMD_RADEON_X1600}, + {"RV560", CARD_AMD_RADEON_X1600}, + {"RV535", CARD_AMD_RADEON_X1600}, + {"RV530", CARD_AMD_RADEON_X1600}, + {"RV516", CARD_AMD_RADEON_X700}, /* X700 is actually R400. */ + {"RV515", CARD_AMD_RADEON_X700}, + /* R400 */ + {"R481", CARD_AMD_RADEON_X700}, + {"R480", CARD_AMD_RADEON_X700}, + {"R430", CARD_AMD_RADEON_X700}, + {"R423", CARD_AMD_RADEON_X700}, + {"R420", CARD_AMD_RADEON_X700}, + {"R410", CARD_AMD_RADEON_X700}, + {"RV410", CARD_AMD_RADEON_X700}, + /* Radeon Xpress - onboard, DX9b, Shader 2.0, 300-400MHz */ + {"RS740", CARD_AMD_RADEON_XPRESS_200M}, + {"RS690", CARD_AMD_RADEON_XPRESS_200M}, + {"RS600", CARD_AMD_RADEON_XPRESS_200M}, + {"RS485", CARD_AMD_RADEON_XPRESS_200M}, + {"RS482", CARD_AMD_RADEON_XPRESS_200M}, + {"RS480", CARD_AMD_RADEON_XPRESS_200M}, + {"RS400", CARD_AMD_RADEON_XPRESS_200M}, + /* R300 */ + {"R360", CARD_AMD_RADEON_9500}, + {"R350", CARD_AMD_RADEON_9500}, + {"R300", CARD_AMD_RADEON_9500}, + {"RV370", CARD_AMD_RADEON_9500}, + {"RV360", CARD_AMD_RADEON_9500}, + {"RV351", CARD_AMD_RADEON_9500}, + {"RV350", CARD_AMD_RADEON_9500}, + }; - /* Radeon R730 HD4600 - midend */ - if (strstr(gl_renderer, "RV730")) /* Radeon RV730 */ + for (i = 0; i < sizeof(cards) / sizeof(*cards); ++i) { - return CARD_ATI_RADEON_HD4600; - } - - /* Radeon R710 HD4500/HD4350 - lowend */ - if (strstr(gl_renderer, "RV710")) /* Radeon RV710 */ - { - return CARD_ATI_RADEON_HD4350; - } - - /* Radeon R6xx HD2900/HD3800 - highend */ - if (strstr(gl_renderer, "R600") - || strstr(gl_renderer, "RV670") - || strstr(gl_renderer, "R680")) - { - return CARD_ATI_RADEON_HD2900; - } - - /* Radeon R6xx HD2600/HD3600 - midend; HD3830 is China-only midend */ - if (strstr(gl_renderer, "RV630") - || strstr(gl_renderer, "RV635")) - { - return CARD_ATI_RADEON_HD2600; - } - - /* Radeon R6xx HD2350/HD2400/HD3400 - lowend */ - if (strstr(gl_renderer, "RV610") - || strstr(gl_renderer, "RV620")) - { - return CARD_ATI_RADEON_HD2350; - } - - /* Radeon R6xx/R7xx integrated */ - if (strstr(gl_renderer, "RS780") - || strstr(gl_renderer, "RS880")) - { - return CARD_ATI_RADEON_HD3200; - } - - /* Radeon R5xx */ - if (strstr(gl_renderer, "RV530") - || strstr(gl_renderer, "RV535") - || strstr(gl_renderer, "RV560") - || strstr(gl_renderer, "R520") - || strstr(gl_renderer, "RV570") - || strstr(gl_renderer, "R580")) - { - return CARD_ATI_RADEON_X1600; - } - - /* Radeon R4xx + X1300/X1400/X1450/X1550/X2300 (lowend R5xx) */ - if (strstr(gl_renderer, "R410") - || strstr(gl_renderer, "R420") - || strstr(gl_renderer, "R423") - || strstr(gl_renderer, "R430") - || strstr(gl_renderer, "R480") - || strstr(gl_renderer, "R481") - || strstr(gl_renderer, "RV410") - || strstr(gl_renderer, "RV515") - || strstr(gl_renderer, "RV516")) - { - return CARD_ATI_RADEON_X700; - } - - /* Radeon Xpress Series - onboard, DX9b, Shader 2.0, 300-400MHz */ - if (strstr(gl_renderer, "RS400") - || strstr(gl_renderer, "RS480") - || strstr(gl_renderer, "RS482") - || strstr(gl_renderer, "RS485") - || strstr(gl_renderer, "RS600") - || strstr(gl_renderer, "RS690") - || strstr(gl_renderer, "RS740")) - { - return CARD_ATI_RADEON_XPRESS_200M; - } - - /* Radeon R3xx */ - if (strstr(gl_renderer, "R300") - || strstr(gl_renderer, "RV350") - || strstr(gl_renderer, "RV351") - || strstr(gl_renderer, "RV360") - || strstr(gl_renderer, "RV370") - || strstr(gl_renderer, "R350") - || strstr(gl_renderer, "R360")) - { - return CARD_ATI_RADEON_9500; /* Radeon 9500/9550/9600/9700/9800/X300/X550/X600 */ + if (strstr(gl_renderer, cards[i].renderer)) + return cards[i].id; } } if (WINE_D3D9_CAPABLE(gl_info)) { - /* Radeon R7xx HD4800 - highend */ - if (strstr(gl_renderer, "(R700") /* Radeon R7xx HD48xx generic renderer string */ - || strstr(gl_renderer, "(RV770") /* Radeon RV770 */ - || strstr(gl_renderer, "(RV790")) /* Radeon RV790 */ + static const struct { - return CARD_ATI_RADEON_HD4800; + const char *renderer; + enum wined3d_pci_device id; } - - /* Radeon R740 HD4700 - midend */ - if (strstr(gl_renderer, "(RV740")) /* Radeon RV740 */ + cards[] = { - return CARD_ATI_RADEON_HD4700; - } + /* R700 */ + {"(R700", CARD_AMD_RADEON_HD4800}, /* HD4800 - highend */ + {"(RV790", CARD_AMD_RADEON_HD4800}, + {"(RV770", CARD_AMD_RADEON_HD4800}, + {"(RV740", CARD_AMD_RADEON_HD4700}, /* HD4700 - midend */ + {"(RV730", CARD_AMD_RADEON_HD4600}, /* HD4600 - midend */ + {"(RV710", CARD_AMD_RADEON_HD4350}, /* HD4500/HD4350 - lowend */ + /* R600/R700 integrated */ + {"RS880", CARD_AMD_RADEON_HD3200}, + {"RS780", CARD_AMD_RADEON_HD3200}, + /* R600 */ + {"(R680", CARD_AMD_RADEON_HD2900}, /* HD2900/HD3800 - highend */ + {"(R600", CARD_AMD_RADEON_HD2900}, + {"(RV670", CARD_AMD_RADEON_HD2900}, + {"(RV635", CARD_AMD_RADEON_HD2600}, /* HD2600/HD3600 - midend; HD3830 is China-only midend */ + {"(RV630", CARD_AMD_RADEON_HD2600}, + {"(RV620", CARD_AMD_RADEON_HD2350}, /* HD2300/HD2400/HD3400 - lowend */ + {"(RV610", CARD_AMD_RADEON_HD2350}, + }; - /* Radeon R730 HD4600 - midend */ - if (strstr(gl_renderer, "(RV730")) /* Radeon RV730 */ + for (i = 0; i < sizeof(cards) / sizeof(*cards); ++i) { - return CARD_ATI_RADEON_HD4600; - } - - /* Radeon R710 HD4500/HD4350 - lowend */ - if (strstr(gl_renderer, "(RV710")) /* Radeon RV710 */ - { - return CARD_ATI_RADEON_HD4350; - } - - /* Radeon R6xx HD2900/HD3800 - highend */ - if (strstr(gl_renderer, "(R600") - || strstr(gl_renderer, "(RV670") - || strstr(gl_renderer, "(R680")) - { - return CARD_ATI_RADEON_HD2900; - } - - /* Radeon R6xx HD2600/HD3600 - midend; HD3830 is China-only midend */ - if (strstr(gl_renderer, "(RV630") - || strstr(gl_renderer, "(RV635")) - { - return CARD_ATI_RADEON_HD2600; - } - - /* Radeon R6xx HD2300/HD2400/HD3400 - lowend */ - if (strstr(gl_renderer, "(RV610") - || strstr(gl_renderer, "(RV620")) - { - return CARD_ATI_RADEON_HD2350; - } - - /* Radeon R6xx/R7xx integrated */ - if (strstr(gl_renderer, "(RS780") - || strstr(gl_renderer, "(RS880")) - { - return CARD_ATI_RADEON_HD3200; + if (strstr(gl_renderer, cards[i].renderer)) + return cards[i].id; } } if (WINE_D3D8_CAPABLE(gl_info)) { - return CARD_ATI_RADEON_8500; /* Radeon 8500/9000/9100/9200/9300 */ + return CARD_AMD_RADEON_8500; /* Radeon 8500/9000/9100/9200/9300 */ } if (WINE_D3D7_CAPABLE(gl_info)) { - return CARD_ATI_RADEON_7200; /* Radeon 7000/7100/7200/7500 */ + return CARD_AMD_RADEON_7200; /* Radeon 7000/7100/7200/7500 */ } - return CARD_ATI_RAGE_128PRO; + return CARD_AMD_RAGE_128PRO; } static enum wined3d_pci_device select_card_nvidia_mesa(const struct wined3d_gl_info *gl_info, const char *gl_renderer) { - FIXME_(d3d_caps)("Card selection not handled for Mesa Nouveau driver\n"); + if (strstr(gl_renderer, "Gallium")) + { + unsigned int i; + + static const struct + { + const char *renderer; + enum wined3d_pci_device id; + } + cards[] = + { + {"NVC8", CARD_NVIDIA_GEFORCE_GTX570}, + {"NVC4", CARD_NVIDIA_GEFORCE_GTX460}, + {"NVC3", CARD_NVIDIA_GEFORCE_GT440}, + {"NVC0", CARD_NVIDIA_GEFORCE_GTX480}, + {"NVAF", CARD_NVIDIA_GEFORCE_GT320M}, + {"NVAC", CARD_NVIDIA_GEFORCE_8200}, + {"NVAA", CARD_NVIDIA_GEFORCE_8200}, + {"NVA8", CARD_NVIDIA_GEFORCE_210}, + {"NVA5", CARD_NVIDIA_GEFORCE_GT220}, + {"NVA3", CARD_NVIDIA_GEFORCE_GT240}, + {"NVA0", CARD_NVIDIA_GEFORCE_GTX280}, + {"NV98", CARD_NVIDIA_GEFORCE_9200}, + {"NV96", CARD_NVIDIA_GEFORCE_9400GT}, + {"NV94", CARD_NVIDIA_GEFORCE_9600GT}, + {"NV92", CARD_NVIDIA_GEFORCE_9800GT}, + {"NV86", CARD_NVIDIA_GEFORCE_8500GT}, + {"NV84", CARD_NVIDIA_GEFORCE_8600GT}, + {"NV68", CARD_NVIDIA_GEFORCE_6200}, /* 7050 */ + {"NV67", CARD_NVIDIA_GEFORCE_6200}, /* 7000M */ + {"NV63", CARD_NVIDIA_GEFORCE_6200}, /* 7100 */ + {"NV50", CARD_NVIDIA_GEFORCE_8800GTX}, + {"NV4E", CARD_NVIDIA_GEFORCE_6200}, /* 6100 Go / 6150 Go */ + {"NV4C", CARD_NVIDIA_GEFORCE_6200}, /* 6150SE */ + {"NV4B", CARD_NVIDIA_GEFORCE_7600}, + {"NV4A", CARD_NVIDIA_GEFORCE_6200}, + {"NV49", CARD_NVIDIA_GEFORCE_7800GT}, /* 7900 */ + {"NV47", CARD_NVIDIA_GEFORCE_7800GT}, + {"NV46", CARD_NVIDIA_GEFORCE_7400}, + {"NV45", CARD_NVIDIA_GEFORCE_6800}, + {"NV44", CARD_NVIDIA_GEFORCE_6200}, + {"NV43", CARD_NVIDIA_GEFORCE_6600GT}, + {"NV42", CARD_NVIDIA_GEFORCE_6800}, + {"NV41", CARD_NVIDIA_GEFORCE_6800}, + {"NV40", CARD_NVIDIA_GEFORCE_6800}, + {"NV38", CARD_NVIDIA_GEFORCEFX_5800}, /* FX 5950 Ultra */ + {"NV36", CARD_NVIDIA_GEFORCEFX_5800}, /* FX 5700/5750 */ + {"NV35", CARD_NVIDIA_GEFORCEFX_5800}, /* FX 5900 */ + {"NV34", CARD_NVIDIA_GEFORCEFX_5200}, + {"NV31", CARD_NVIDIA_GEFORCEFX_5600}, + {"NV30", CARD_NVIDIA_GEFORCEFX_5800}, + {"NV28", CARD_NVIDIA_GEFORCE4_TI4200}, + {"NV25", CARD_NVIDIA_GEFORCE4_TI4200}, + {"NV20", CARD_NVIDIA_GEFORCE3}, + {"NV1F", CARD_NVIDIA_GEFORCE4_MX}, /* GF4 MX IGP */ + {"NV1A", CARD_NVIDIA_GEFORCE2}, /* GF2 IGP */ + {"NV18", CARD_NVIDIA_GEFORCE4_MX}, + {"NV17", CARD_NVIDIA_GEFORCE4_MX}, + {"NV16", CARD_NVIDIA_GEFORCE2}, + {"NV15", CARD_NVIDIA_GEFORCE2}, + {"NV11", CARD_NVIDIA_GEFORCE2_MX}, + {"NV10", CARD_NVIDIA_GEFORCE}, + {"NV05", CARD_NVIDIA_RIVA_TNT2}, + {"NV04", CARD_NVIDIA_RIVA_TNT}, + {"NV03", CARD_NVIDIA_RIVA_128}, + }; + + for (i = 0; i < sizeof(cards) / sizeof(*cards); ++i) + { + if (strstr(gl_renderer, cards[i].renderer)) + return cards[i].id; + } + } + + FIXME_(d3d_caps)("Unknown renderer %s.\n", debugstr_a(gl_renderer)); if (WINE_D3D9_CAPABLE(gl_info)) return CARD_NVIDIA_GEFORCEFX_5600; if (WINE_D3D8_CAPABLE(gl_info)) return CARD_NVIDIA_GEFORCE3; if (WINE_D3D7_CAPABLE(gl_info)) return CARD_NVIDIA_GEFORCE; @@ -2059,10 +1963,10 @@ static const struct vendor_card_selection vendor_card_select_table[] = { {GL_VENDOR_NVIDIA, HW_VENDOR_NVIDIA, "Nvidia binary driver", select_card_nvidia_binary}, {GL_VENDOR_APPLE, HW_VENDOR_NVIDIA, "Apple OSX NVidia binary driver", select_card_nvidia_binary}, - {GL_VENDOR_APPLE, HW_VENDOR_ATI, "Apple OSX AMD/ATI binary driver", select_card_ati_binary}, + {GL_VENDOR_APPLE, HW_VENDOR_AMD, "Apple OSX AMD/ATI binary driver", select_card_amd_binary}, {GL_VENDOR_APPLE, HW_VENDOR_INTEL, "Apple OSX Intel binary driver", select_card_intel}, - {GL_VENDOR_FGLRX, HW_VENDOR_ATI, "AMD/ATI binary driver", select_card_ati_binary}, - {GL_VENDOR_MESA, HW_VENDOR_ATI, "Mesa AMD/ATI driver", select_card_ati_mesa}, + {GL_VENDOR_FGLRX, HW_VENDOR_AMD, "AMD/ATI binary driver", select_card_amd_binary}, + {GL_VENDOR_MESA, HW_VENDOR_AMD, "Mesa AMD/ATI driver", select_card_amd_mesa}, {GL_VENDOR_MESA, HW_VENDOR_NVIDIA, "Mesa Nouveau driver", select_card_nvidia_mesa}, {GL_VENDOR_MESA, HW_VENDOR_INTEL, "Mesa Intel driver", select_card_intel}, {GL_VENDOR_INTEL, HW_VENDOR_INTEL, "Mesa Intel driver", select_card_intel} @@ -2167,7 +2071,7 @@ static const struct fragment_pipeline *select_fragment_implementation(struct win else return &ffp_fragment_pipeline; } -static const shader_backend_t *select_shader_backend(struct wined3d_adapter *adapter) +static const struct wined3d_shader_backend_ops *select_shader_backend(struct wined3d_adapter *adapter) { int vs_selected_mode, ps_selected_mode; @@ -2750,6 +2654,10 @@ static BOOL IWineD3DImpl_FillGLCaps(struct wined3d_adapter *adapter) gl_info->supported[WGL_ARB_PIXEL_FORMAT] = TRUE; TRACE_(d3d_caps)("FOUND: WGL_ARB_pixel_format support\n"); } + if (!strcmp(ThisExtn, "WGL_EXT_swap_control")) { + gl_info->supported[WGL_EXT_SWAP_CONTROL] = TRUE; + TRACE_(d3d_caps)("FOUND: WGL_EXT_swap_control support\n"); + } if (!strcmp(ThisExtn, "WGL_WINE_pixel_format_passthrough")) { gl_info->supported[WGL_WINE_PIXEL_FORMAT_PASSTHROUGH] = TRUE; TRACE_(d3d_caps)("FOUND: WGL_WINE_pixel_format_passthrough support\n"); @@ -2765,55 +2673,47 @@ static BOOL IWineD3DImpl_FillGLCaps(struct wined3d_adapter *adapter) return TRUE; } -/********************************************************** - * IWineD3D implementation follows - **********************************************************/ +UINT CDECL wined3d_get_adapter_count(const struct wined3d *wined3d) +{ + TRACE_(d3d_caps)("wined3d %p, reporting %u adapters.\n", + wined3d, wined3d->adapter_count); -static UINT WINAPI IWineD3DImpl_GetAdapterCount (IWineD3D *iface) { - IWineD3DImpl *This = (IWineD3DImpl *)iface; - - TRACE_(d3d_caps)("(%p): Reporting %u adapters\n", This, This->adapter_count); - - return This->adapter_count; + return wined3d->adapter_count; } -static HRESULT WINAPI IWineD3DImpl_RegisterSoftwareDevice(IWineD3D *iface, void *init_function) +HRESULT CDECL wined3d_register_software_device(struct wined3d *wined3d, void *init_function) { - FIXME("iface %p, init_function %p stub!\n", iface, init_function); + FIXME("wined3d %p, init_function %p stub!\n", wined3d, init_function); return WINED3D_OK; } -static HMONITOR WINAPI IWineD3DImpl_GetAdapterMonitor(IWineD3D *iface, UINT Adapter) { - IWineD3DImpl *This = (IWineD3DImpl *)iface; +HMONITOR CDECL wined3d_get_adapter_monitor(const struct wined3d *wined3d, UINT adapter_idx) +{ + TRACE_(d3d_caps)("wined3d %p, adapter_idx %u.\n", wined3d, adapter_idx); - TRACE_(d3d_caps)("(%p)->(%d)\n", This, Adapter); - - if (Adapter >= IWineD3DImpl_GetAdapterCount(iface)) { + if (adapter_idx >= wined3d->adapter_count) return NULL; - } - return MonitorFromPoint(This->adapters[Adapter].monitorPoint, MONITOR_DEFAULTTOPRIMARY); + return MonitorFromPoint(wined3d->adapters[adapter_idx].monitorPoint, MONITOR_DEFAULTTOPRIMARY); } /* FIXME: GetAdapterModeCount and EnumAdapterModes currently only returns modes of the same bpp but different resolutions */ /* Note: dx9 supplies a format. Calls from d3d8 supply WINED3DFMT_UNKNOWN */ -static UINT WINAPI IWineD3DImpl_GetAdapterModeCount(IWineD3D *iface, UINT Adapter, enum wined3d_format_id format_id) +UINT CDECL wined3d_get_adapter_mode_count(const struct wined3d *wined3d, UINT adapter_idx, + enum wined3d_format_id format_id) { - IWineD3DImpl *This = (IWineD3DImpl *)iface; + TRACE_(d3d_caps)("wined3d %p, adapter_idx %u, format %s.\n", wined3d, adapter_idx, debug_d3dformat(format_id)); - TRACE_(d3d_caps)("iface %p, adapter %u, format_id: %s.\n", iface, Adapter, debug_d3dformat(format_id)); - - if (Adapter >= IWineD3D_GetAdapterCount(iface)) { + if (adapter_idx >= wined3d->adapter_count) return 0; - } /* TODO: Store modes per adapter and read it from the adapter structure */ - if (Adapter == 0) + if (!adapter_idx) { - const struct wined3d_format *format = wined3d_get_format(&This->adapters[Adapter].gl_info, format_id); + const struct wined3d_format *format = wined3d_get_format(&wined3d->adapters[adapter_idx].gl_info, format_id); UINT format_bits = format->byte_count * CHAR_BIT; unsigned int i = 0; unsigned int j = 0; @@ -2837,34 +2737,36 @@ static UINT WINAPI IWineD3DImpl_GetAdapterModeCount(IWineD3D *iface, UINT Adapte } } - TRACE_(d3d_caps)("(%p}->(Adapter: %d) => %d (out of %d)\n", This, Adapter, i, j); + TRACE_(d3d_caps)("Returning %u matching modes (out of %u total) for adapter %u.\n", i, j, adapter_idx); + return i; - } else { - FIXME_(d3d_caps)("Adapter not primary display\n"); } + else + { + FIXME_(d3d_caps)("Adapter not primary display.\n"); + } + return 0; } /* Note: dx9 supplies a format. Calls from d3d8 supply WINED3DFMT_UNKNOWN */ -static HRESULT WINAPI IWineD3DImpl_EnumAdapterModes(IWineD3D *iface, UINT Adapter, - enum wined3d_format_id format_id, UINT Mode, WINED3DDISPLAYMODE *pMode) +HRESULT CDECL wined3d_enum_adapter_modes(const struct wined3d *wined3d, UINT adapter_idx, + enum wined3d_format_id format_id, UINT mode_idx, WINED3DDISPLAYMODE *mode) { - IWineD3DImpl *This = (IWineD3DImpl *)iface; - - TRACE_(d3d_caps)("iface %p, adapter_idx %u, format %s, mode_idx %u, mode %p.\n", - iface, Adapter, debug_d3dformat(format_id), Mode, pMode); + TRACE_(d3d_caps)("wined3d %p, adapter_idx %u, format %s, mode_idx %u, mode %p.\n", + wined3d, adapter_idx, debug_d3dformat(format_id), mode_idx, mode); /* Validate the parameters as much as possible */ - if (!pMode || Adapter >= IWineD3DImpl_GetAdapterCount(iface) - || Mode >= IWineD3DImpl_GetAdapterModeCount(iface, Adapter, format_id)) + if (!mode || adapter_idx >= wined3d->adapter_count + || mode_idx >= wined3d_get_adapter_mode_count(wined3d, adapter_idx, format_id)) { return WINED3DERR_INVALIDCALL; } /* TODO: Store modes per adapter and read it from the adapter structure */ - if (Adapter == 0) + if (!adapter_idx) { - const struct wined3d_format *format = wined3d_get_format(&This->adapters[Adapter].gl_info, format_id); + const struct wined3d_format *format = wined3d_get_format(&wined3d->adapters[adapter_idx].gl_info, format_id); UINT format_bits = format->byte_count * CHAR_BIT; DEVMODEW DevModeW; int ModeIdx = 0; @@ -2877,7 +2779,7 @@ static HRESULT WINAPI IWineD3DImpl_EnumAdapterModes(IWineD3D *iface, UINT Adapte /* If we are filtering to a specific format (D3D9), then need to skip all unrelated modes, but if mode is irrelevant (D3D8), then we can just count through the ones with valid bit depths */ - while ((i<=Mode) && EnumDisplaySettingsExW(NULL, j++, &DevModeW, 0)) + while (i <= mode_idx && EnumDisplaySettingsExW(NULL, j++, &DevModeW, 0)) { if (format_id == WINED3DFMT_UNKNOWN) { @@ -2898,28 +2800,28 @@ static HRESULT WINAPI IWineD3DImpl_EnumAdapterModes(IWineD3D *iface, UINT Adapte ModeIdx = j - 1; /* Now get the display mode via the calculated index */ - if (EnumDisplaySettingsExW(NULL, ModeIdx, &DevModeW, 0)) { - pMode->Width = DevModeW.dmPelsWidth; - pMode->Height = DevModeW.dmPelsHeight; - pMode->RefreshRate = DEFAULT_REFRESH_RATE; + if (EnumDisplaySettingsExW(NULL, ModeIdx, &DevModeW, 0)) + { + mode->Width = DevModeW.dmPelsWidth; + mode->Height = DevModeW.dmPelsHeight; + mode->RefreshRate = DEFAULT_REFRESH_RATE; if (DevModeW.dmFields & DM_DISPLAYFREQUENCY) - pMode->RefreshRate = DevModeW.dmDisplayFrequency; + mode->RefreshRate = DevModeW.dmDisplayFrequency; if (format_id == WINED3DFMT_UNKNOWN) - pMode->Format = pixelformat_for_depth(DevModeW.dmBitsPerPel); + mode->Format = pixelformat_for_depth(DevModeW.dmBitsPerPel); else - pMode->Format = format_id; + mode->Format = format_id; } else { - TRACE_(d3d_caps)("Requested mode out of range %d\n", Mode); + TRACE_(d3d_caps)("Requested mode %u out of range.\n", mode_idx); return WINED3DERR_INVALIDCALL; } - TRACE_(d3d_caps)("W %d H %d rr %d fmt (%x - %s) bpp %u\n", pMode->Width, pMode->Height, - pMode->RefreshRate, pMode->Format, debug_d3dformat(pMode->Format), - DevModeW.dmBitsPerPel); - + TRACE_(d3d_caps)("W %d H %d rr %d fmt (%x - %s) bpp %u\n", + mode->Width, mode->Height, mode->RefreshRate, mode->Format, + debug_d3dformat(mode->Format), DevModeW.dmBitsPerPel); } else { @@ -2929,115 +2831,116 @@ static HRESULT WINAPI IWineD3DImpl_EnumAdapterModes(IWineD3D *iface, UINT Adapte return WINED3D_OK; } -static HRESULT WINAPI IWineD3DImpl_GetAdapterDisplayMode(IWineD3D *iface, UINT Adapter, WINED3DDISPLAYMODE *pMode) +HRESULT CDECL wined3d_get_adapter_display_mode(const struct wined3d *wined3d, UINT adapter_idx, + WINED3DDISPLAYMODE *mode) { - TRACE("iface %p, adapter_idx %u, display_mode %p.\n", iface, Adapter, pMode); + TRACE("wined3d %p, adapter_idx %u, display_mode %p.\n", wined3d, adapter_idx, mode); - if (!pMode || Adapter >= IWineD3D_GetAdapterCount(iface)) + if (!mode || adapter_idx >= wined3d->adapter_count) return WINED3DERR_INVALIDCALL; - if (Adapter == 0) { /* Display */ - int bpp = 0; + if (!adapter_idx) + { DEVMODEW DevModeW; + unsigned int bpp; ZeroMemory(&DevModeW, sizeof(DevModeW)); DevModeW.dmSize = sizeof(DevModeW); EnumDisplaySettingsExW(NULL, ENUM_CURRENT_SETTINGS, &DevModeW, 0); - pMode->Width = DevModeW.dmPelsWidth; - pMode->Height = DevModeW.dmPelsHeight; - bpp = DevModeW.dmBitsPerPel; - pMode->RefreshRate = DEFAULT_REFRESH_RATE; + mode->Width = DevModeW.dmPelsWidth; + mode->Height = DevModeW.dmPelsHeight; + bpp = DevModeW.dmBitsPerPel; + mode->RefreshRate = DEFAULT_REFRESH_RATE; if (DevModeW.dmFields&DM_DISPLAYFREQUENCY) - { - pMode->RefreshRate = DevModeW.dmDisplayFrequency; - } - - pMode->Format = pixelformat_for_depth(bpp); - } else { + mode->RefreshRate = DevModeW.dmDisplayFrequency; + mode->Format = pixelformat_for_depth(bpp); + } + else + { FIXME_(d3d_caps)("Adapter not primary display\n"); } - TRACE_(d3d_caps)("returning w:%d, h:%d, ref:%d, fmt:%s\n", pMode->Width, - pMode->Height, pMode->RefreshRate, debug_d3dformat(pMode->Format)); + TRACE_(d3d_caps)("returning w:%d, h:%d, ref:%d, fmt:%s\n", mode->Width, + mode->Height, mode->RefreshRate, debug_d3dformat(mode->Format)); return WINED3D_OK; } /* NOTE: due to structure differences between dx8 and dx9 D3DADAPTER_IDENTIFIER, and fields being inserted in the middle, a new structure is used in place */ -static HRESULT WINAPI IWineD3DImpl_GetAdapterIdentifier(IWineD3D *iface, UINT Adapter, DWORD Flags, - WINED3DADAPTER_IDENTIFIER* pIdentifier) { - IWineD3DImpl *This = (IWineD3DImpl *)iface; - struct wined3d_adapter *adapter; +HRESULT CDECL wined3d_get_adapter_identifier(const struct wined3d *wined3d, + UINT adapter_idx, DWORD flags, WINED3DADAPTER_IDENTIFIER *identifier) +{ + const struct wined3d_adapter *adapter; size_t len; - TRACE_(d3d_caps)("(%p}->(Adapter: %d, Flags: %x, pId=%p)\n", This, Adapter, Flags, pIdentifier); + TRACE_(d3d_caps)("wined3d %p, adapter_idx %u, flags %#x, indentifier %p.\n", + wined3d, adapter_idx, flags, identifier); - if (Adapter >= IWineD3D_GetAdapterCount(iface)) { + if (adapter_idx >= wined3d->adapter_count) return WINED3DERR_INVALIDCALL; - } - adapter = &This->adapters[Adapter]; + adapter = &wined3d->adapters[adapter_idx]; /* Return the information requested */ TRACE_(d3d_caps)("device/Vendor Name and Version detection using FillGLCaps\n"); - if (pIdentifier->driver_size) + if (identifier->driver_size) { const char *name = adapter->driver_info.name; - len = min(strlen(name), pIdentifier->driver_size - 1); - memcpy(pIdentifier->driver, name, len); - pIdentifier->driver[len] = '\0'; + len = min(strlen(name), identifier->driver_size - 1); + memcpy(identifier->driver, name, len); + identifier->driver[len] = '\0'; } - if (pIdentifier->description_size) + if (identifier->description_size) { const char *description = adapter->driver_info.description; - len = min(strlen(description), pIdentifier->description_size - 1); - memcpy(pIdentifier->description, description, len); - pIdentifier->description[len] = '\0'; + len = min(strlen(description), identifier->description_size - 1); + memcpy(identifier->description, description, len); + identifier->description[len] = '\0'; } /* Note that d3d8 doesn't supply a device name. */ - if (pIdentifier->device_name_size) + if (identifier->device_name_size) { static const char *device_name = "\\\\.\\DISPLAY1"; /* FIXME: May depend on desktop? */ len = strlen(device_name); - if (len >= pIdentifier->device_name_size) + if (len >= identifier->device_name_size) { ERR("Device name size too small.\n"); return WINED3DERR_INVALIDCALL; } - memcpy(pIdentifier->device_name, device_name, len); - pIdentifier->device_name[len] = '\0'; + memcpy(identifier->device_name, device_name, len); + identifier->device_name[len] = '\0'; } - pIdentifier->driver_version.u.HighPart = adapter->driver_info.version_high; - pIdentifier->driver_version.u.LowPart = adapter->driver_info.version_low; - pIdentifier->vendor_id = adapter->driver_info.vendor; - pIdentifier->device_id = adapter->driver_info.device; - pIdentifier->subsystem_id = 0; - pIdentifier->revision = 0; - memcpy(&pIdentifier->device_identifier, &IID_D3DDEVICE_D3DUID, sizeof(pIdentifier->device_identifier)); - pIdentifier->whql_level = (Flags & WINED3DENUM_NO_WHQL_LEVEL) ? 0 : 1; - memcpy(&pIdentifier->adapter_luid, &adapter->luid, sizeof(pIdentifier->adapter_luid)); - pIdentifier->video_memory = adapter->TextureRam; + identifier->driver_version.u.HighPart = adapter->driver_info.version_high; + identifier->driver_version.u.LowPart = adapter->driver_info.version_low; + identifier->vendor_id = adapter->driver_info.vendor; + identifier->device_id = adapter->driver_info.device; + identifier->subsystem_id = 0; + identifier->revision = 0; + memcpy(&identifier->device_identifier, &IID_D3DDEVICE_D3DUID, sizeof(identifier->device_identifier)); + identifier->whql_level = (flags & WINED3DENUM_NO_WHQL_LEVEL) ? 0 : 1; + memcpy(&identifier->adapter_luid, &adapter->luid, sizeof(identifier->adapter_luid)); + identifier->video_memory = adapter->TextureRam; return WINED3D_OK; } static BOOL IWineD3DImpl_IsPixelFormatCompatibleWithRenderFmt(const struct wined3d_gl_info *gl_info, - const WineD3D_PixelFormat *cfg, const struct wined3d_format *format) + const struct wined3d_pixel_format *cfg, const struct wined3d_format *format) { - short redSize, greenSize, blueSize, alphaSize, colorBits; + BYTE redSize, greenSize, blueSize, alphaSize, colorBits; if(!cfg) return FALSE; /* Float formats need FBOs. If FBOs are used this function isn't called */ - if (format->Flags & WINED3DFMT_FLAG_FLOAT) return FALSE; + if (format->flags & WINED3DFMT_FLAG_FLOAT) return FALSE; if(cfg->iPixelType == WGL_TYPE_RGBA_ARB) { /* Integer RGBA formats */ if (!getColorBits(format, &redSize, &greenSize, &blueSize, &alphaSize, &colorBits)) @@ -3066,9 +2969,9 @@ static BOOL IWineD3DImpl_IsPixelFormatCompatibleWithRenderFmt(const struct wined } static BOOL IWineD3DImpl_IsPixelFormatCompatibleWithDepthFmt(const struct wined3d_gl_info *gl_info, - const WineD3D_PixelFormat *cfg, const struct wined3d_format *format) + const struct wined3d_pixel_format *cfg, const struct wined3d_format *format) { - short depthSize, stencilSize; + BYTE depthSize, stencilSize; BOOL lockable = FALSE; if(!cfg) @@ -3081,7 +2984,7 @@ static BOOL IWineD3DImpl_IsPixelFormatCompatibleWithDepthFmt(const struct wined3 } /* Float formats need FBOs. If FBOs are used this function isn't called */ - if (format->Flags & WINED3DFMT_FLAG_FLOAT) return FALSE; + if (format->flags & WINED3DFMT_FLAG_FLOAT) return FALSE; if ((format->id == WINED3DFMT_D16_LOCKABLE) || (format->id == WINED3DFMT_D32_FLOAT)) lockable = TRUE; @@ -3100,138 +3003,136 @@ static BOOL IWineD3DImpl_IsPixelFormatCompatibleWithDepthFmt(const struct wined3 return TRUE; } -static HRESULT WINAPI IWineD3DImpl_CheckDepthStencilMatch(IWineD3D *iface, - UINT Adapter, WINED3DDEVTYPE DeviceType, enum wined3d_format_id AdapterFormat, - enum wined3d_format_id RenderTargetFormat, enum wined3d_format_id DepthStencilFormat) +HRESULT CDECL wined3d_check_depth_stencil_match(const struct wined3d *wined3d, + UINT adapter_idx, WINED3DDEVTYPE device_type, enum wined3d_format_id adapter_format_id, + enum wined3d_format_id render_target_format_id, enum wined3d_format_id depth_stencil_format_id) { - IWineD3DImpl *This = (IWineD3DImpl *)iface; - int nCfgs; - const WineD3D_PixelFormat *cfgs; - const struct wined3d_adapter *adapter; const struct wined3d_format *rt_format; const struct wined3d_format *ds_format; - int it; + const struct wined3d_adapter *adapter; - WARN_(d3d_caps)("(%p)-> (STUB) (Adptr:%d, DevType:(%x,%s), AdptFmt:(%x,%s), RendrTgtFmt:(%x,%s), DepthStencilFmt:(%x,%s))\n", - This, Adapter, - DeviceType, debug_d3ddevicetype(DeviceType), - AdapterFormat, debug_d3dformat(AdapterFormat), - RenderTargetFormat, debug_d3dformat(RenderTargetFormat), - DepthStencilFormat, debug_d3dformat(DepthStencilFormat)); + TRACE_(d3d_caps)("wined3d %p, adapter_idx %u, device_type %s,\n" + "adapter_format %s, render_target_format %s, depth_stencil_format %s.\n", + wined3d, adapter_idx, debug_d3ddevicetype(device_type), debug_d3dformat(adapter_format_id), + debug_d3dformat(render_target_format_id), debug_d3dformat(depth_stencil_format_id)); - if (Adapter >= IWineD3D_GetAdapterCount(iface)) { - TRACE("(%p) Failed: Atapter (%u) higher than supported adapters (%u) returning WINED3DERR_INVALIDCALL\n", This, Adapter, IWineD3D_GetAdapterCount(iface)); + if (adapter_idx >= wined3d->adapter_count) return WINED3DERR_INVALIDCALL; - } - adapter = &This->adapters[Adapter]; - rt_format = wined3d_get_format(&adapter->gl_info, RenderTargetFormat); - ds_format = wined3d_get_format(&adapter->gl_info, DepthStencilFormat); + adapter = &wined3d->adapters[adapter_idx]; + rt_format = wined3d_get_format(&adapter->gl_info, render_target_format_id); + ds_format = wined3d_get_format(&adapter->gl_info, depth_stencil_format_id); if (wined3d_settings.offscreen_rendering_mode == ORM_FBO) { - if ((rt_format->Flags & WINED3DFMT_FLAG_RENDERTARGET) - && (ds_format->Flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL))) + if ((rt_format->flags & WINED3DFMT_FLAG_RENDERTARGET) + && (ds_format->flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL))) { - TRACE_(d3d_caps)("(%p) : Formats matched\n", This); + TRACE_(d3d_caps)("Formats match.\n"); return WINED3D_OK; } } else { + const struct wined3d_pixel_format *cfgs; + unsigned int cfg_count; + unsigned int i; + cfgs = adapter->cfgs; - nCfgs = adapter->nCfgs; - for (it = 0; it < nCfgs; ++it) + cfg_count = adapter->nCfgs; + for (i = 0; i < cfg_count; ++i) { - if (IWineD3DImpl_IsPixelFormatCompatibleWithRenderFmt(&adapter->gl_info, &cfgs[it], rt_format)) + if (IWineD3DImpl_IsPixelFormatCompatibleWithRenderFmt(&adapter->gl_info, &cfgs[i], rt_format)) { - if (IWineD3DImpl_IsPixelFormatCompatibleWithDepthFmt(&adapter->gl_info, &cfgs[it], ds_format)) + if (IWineD3DImpl_IsPixelFormatCompatibleWithDepthFmt(&adapter->gl_info, &cfgs[i], ds_format)) { - TRACE_(d3d_caps)("(%p) : Formats matched\n", This); + TRACE_(d3d_caps)("Formats match.\n"); return WINED3D_OK; } } } } - WARN_(d3d_caps)("unsupported format pair: %s and %s\n", debug_d3dformat(RenderTargetFormat), debug_d3dformat(DepthStencilFormat)); + + TRACE_(d3d_caps)("Unsupported format pair: %s and %s.\n", + debug_d3dformat(render_target_format_id), + debug_d3dformat(depth_stencil_format_id)); return WINED3DERR_NOTAVAILABLE; } -static HRESULT WINAPI IWineD3DImpl_CheckDeviceMultiSampleType(IWineD3D *iface, UINT Adapter, - WINED3DDEVTYPE DeviceType, enum wined3d_format_id SurfaceFormat, BOOL Windowed, - WINED3DMULTISAMPLE_TYPE MultiSampleType, DWORD *pQualityLevels) +HRESULT CDECL wined3d_check_device_multisample_type(const struct wined3d *wined3d, UINT adapter_idx, + WINED3DDEVTYPE device_type, enum wined3d_format_id surface_format_id, BOOL windowed, + WINED3DMULTISAMPLE_TYPE multisample_type, DWORD *quality_levels) { - IWineD3DImpl *This = (IWineD3DImpl *)iface; const struct wined3d_adapter *adapter; const struct wined3d_format *format; - TRACE_(d3d_caps)("(%p)-> (Adptr:%d, DevType:(%x,%s), SurfFmt:(%x,%s), Win?%d, MultiSamp:%x, pQual:%p)\n", - This, - Adapter, - DeviceType, debug_d3ddevicetype(DeviceType), - SurfaceFormat, debug_d3dformat(SurfaceFormat), - Windowed, - MultiSampleType, - pQualityLevels); + TRACE_(d3d_caps)("wined3d %p, adapter_idx %u, device_type %s, surface_format %s,\n" + "windowed %#x, multisample_type %#x, quality_levels %p.\n", + wined3d, adapter_idx, debug_d3ddevicetype(device_type), debug_d3dformat(surface_format_id), + windowed, multisample_type, quality_levels); - if (Adapter >= IWineD3D_GetAdapterCount(iface)) { + if (adapter_idx >= wined3d->adapter_count) return WINED3DERR_INVALIDCALL; - } - /* TODO: handle Windowed, add more quality levels */ + /* TODO: Handle windowed, add more quality levels. */ - if (WINED3DMULTISAMPLE_NONE == MultiSampleType) { - if(pQualityLevels) *pQualityLevels = 1; + if (WINED3DMULTISAMPLE_NONE == multisample_type) + { + if (quality_levels) *quality_levels = 1; return WINED3D_OK; } /* By default multisampling is disabled right now as it causes issues * on some Nvidia driver versions and it doesn't work well in combination * with FBOs yet. */ - if(!wined3d_settings.allow_multisampling) + if (!wined3d_settings.allow_multisampling) return WINED3DERR_NOTAVAILABLE; - adapter = &This->adapters[Adapter]; - format = wined3d_get_format(&adapter->gl_info, SurfaceFormat); + adapter = &wined3d->adapters[adapter_idx]; + format = wined3d_get_format(&adapter->gl_info, surface_format_id); if (!format) return WINED3DERR_INVALIDCALL; - if (format->Flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL)) + if (format->flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL)) { - int i, nCfgs; - const WineD3D_PixelFormat *cfgs; + const struct wined3d_pixel_format *cfgs; + unsigned int i, cfg_count; cfgs = adapter->cfgs; - nCfgs = adapter->nCfgs; - for(i=0; inCfgs; + for (i = 0; i < cfg_count; ++i) + { + if(cfgs[i].numSamples != multisample_type) continue; if (!IWineD3DImpl_IsPixelFormatCompatibleWithDepthFmt(&adapter->gl_info, &cfgs[i], format)) continue; - TRACE("Found iPixelFormat=%d to support MultiSampleType=%d for format %s\n", cfgs[i].iPixelFormat, MultiSampleType, debug_d3dformat(SurfaceFormat)); + TRACE("Found pixel format %u to support multisample_type %#x for format %s.\n", + cfgs[i].iPixelFormat, multisample_type, debug_d3dformat(surface_format_id)); + + if (quality_levels) *quality_levels = 1; - if(pQualityLevels) - *pQualityLevels = 1; /* Guess at a value! */ return WINED3D_OK; } } - else if (format->Flags & WINED3DFMT_FLAG_RENDERTARGET) + else if (format->flags & WINED3DFMT_FLAG_RENDERTARGET) { - short redSize, greenSize, blueSize, alphaSize, colorBits; - int i, nCfgs; - const WineD3D_PixelFormat *cfgs; + BYTE redSize, greenSize, blueSize, alphaSize, colorBits; + const struct wined3d_pixel_format *cfgs; + unsigned int i, cfg_count; if (!getColorBits(format, &redSize, &greenSize, &blueSize, &alphaSize, &colorBits)) { - ERR("Unable to color bits for format %#x, can't check multisampling capability!\n", SurfaceFormat); + ERR("Unable to get color bits for format %s, can't check multisampling capability.\n", + debug_d3dformat(surface_format_id)); return WINED3DERR_NOTAVAILABLE; } cfgs = adapter->cfgs; - nCfgs = adapter->nCfgs; - for(i=0; inCfgs; + for (i = 0; i < cfg_count; ++i) + { + if(cfgs[i].numSamples != multisample_type) continue; if(cfgs[i].redSize != redSize) continue; @@ -3239,16 +3140,18 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceMultiSampleType(IWineD3D *iface, U continue; if(cfgs[i].blueSize != blueSize) continue; - /* Not all drivers report alpha-less formats since they use 32-bit anyway, so accept alpha even if we didn't ask for it. */ + /* Not all drivers report alpha-less formats since they use 32-bit + * anyway, so accept alpha even if we didn't ask for it. */ if(alphaSize && cfgs[i].alphaSize != alphaSize) continue; if (cfgs[i].colorSize != (format->byte_count << 3)) continue; - TRACE("Found iPixelFormat=%d to support MultiSampleType=%d for format %s\n", cfgs[i].iPixelFormat, MultiSampleType, debug_d3dformat(SurfaceFormat)); + TRACE("Found pixel format %u to support multisample_type %#x for format %s.\n", + cfgs[i].iPixelFormat, multisample_type, debug_d3dformat(surface_format_id)); + + if (quality_levels) *quality_levels = 1; - if(pQualityLevels) - *pQualityLevels = 1; /* Guess at a value! */ return WINED3D_OK; } } @@ -3256,17 +3159,17 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceMultiSampleType(IWineD3D *iface, U } /* Check if we support bumpmapping for a format */ -static BOOL CheckBumpMapCapability(struct wined3d_adapter *adapter, const struct wined3d_format *format) +static BOOL CheckBumpMapCapability(const struct wined3d_adapter *adapter, const struct wined3d_format *format) { /* Ask the fixed function pipeline implementation if it can deal * with the conversion. If we've got a GL extension giving native * support this will be an identity conversion. */ - return (format->Flags & WINED3DFMT_FLAG_BUMPMAP) + return (format->flags & WINED3DFMT_FLAG_BUMPMAP) && adapter->fragment_pipe->color_fixup_supported(format->color_fixup); } /* Check if the given DisplayFormat + DepthStencilFormat combination is valid for the Adapter */ -static BOOL CheckDepthStencilCapability(struct wined3d_adapter *adapter, +static BOOL CheckDepthStencilCapability(const struct wined3d_adapter *adapter, const struct wined3d_format *display_format, const struct wined3d_format *ds_format) { int it=0; @@ -3277,14 +3180,14 @@ static BOOL CheckDepthStencilCapability(struct wined3d_adapter *adapter, if (wined3d_settings.offscreen_rendering_mode == ORM_FBO) { /* With FBOs WGL limitations do not apply, but the format needs to be FBO attachable */ - if (ds_format->Flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL)) return TRUE; + if (ds_format->flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL)) return TRUE; } else { /* Walk through all WGL pixel formats to find a match */ for (it = 0; it < adapter->nCfgs; ++it) { - WineD3D_PixelFormat *cfg = &adapter->cfgs[it]; + const struct wined3d_pixel_format *cfg = &adapter->cfgs[it]; if (IWineD3DImpl_IsPixelFormatCompatibleWithRenderFmt(&adapter->gl_info, cfg, display_format)) { if (IWineD3DImpl_IsPixelFormatCompatibleWithDepthFmt(&adapter->gl_info, cfg, ds_format)) @@ -3298,26 +3201,26 @@ static BOOL CheckDepthStencilCapability(struct wined3d_adapter *adapter, return FALSE; } -static BOOL CheckFilterCapability(struct wined3d_adapter *adapter, const struct wined3d_format *format) +static BOOL CheckFilterCapability(const struct wined3d_adapter *adapter, const struct wined3d_format *format) { /* The flags entry of a format contains the filtering capability */ - if (format->Flags & WINED3DFMT_FLAG_FILTERING) return TRUE; + if (format->flags & WINED3DFMT_FLAG_FILTERING) return TRUE; return FALSE; } /* Check the render target capabilities of a format */ -static BOOL CheckRenderTargetCapability(struct wined3d_adapter *adapter, +static BOOL CheckRenderTargetCapability(const struct wined3d_adapter *adapter, const struct wined3d_format *adapter_format, const struct wined3d_format *check_format) { /* Filter out non-RT formats */ - if (!(check_format->Flags & WINED3DFMT_FLAG_RENDERTARGET)) return FALSE; + if (!(check_format->flags & WINED3DFMT_FLAG_RENDERTARGET)) return FALSE; if (wined3d_settings.offscreen_rendering_mode == ORM_BACKBUFFER) { - WineD3D_PixelFormat *cfgs = adapter->cfgs; + BYTE AdapterRed, AdapterGreen, AdapterBlue, AdapterAlpha, AdapterTotalSize; + BYTE CheckRed, CheckGreen, CheckBlue, CheckAlpha, CheckTotalSize; + const struct wined3d_pixel_format *cfgs = adapter->cfgs; int it; - short AdapterRed, AdapterGreen, AdapterBlue, AdapterAlpha, AdapterTotalSize; - short CheckRed, CheckGreen, CheckBlue, CheckAlpha, CheckTotalSize; getColorBits(adapter_format, &AdapterRed, &AdapterGreen, &AdapterBlue, &AdapterAlpha, &AdapterTotalSize); getColorBits(check_format, &CheckRed, &CheckGreen, &CheckBlue, &CheckAlpha, &CheckTotalSize); @@ -3351,17 +3254,17 @@ static BOOL CheckRenderTargetCapability(struct wined3d_adapter *adapter, return FALSE; } -static BOOL CheckSrgbReadCapability(struct wined3d_adapter *adapter, const struct wined3d_format *format) +static BOOL CheckSrgbReadCapability(const struct wined3d_adapter *adapter, const struct wined3d_format *format) { - return adapter->gl_info.supported[EXT_TEXTURE_SRGB] && (format->Flags & WINED3DFMT_FLAG_SRGB_READ); + return format->flags & WINED3DFMT_FLAG_SRGB_READ; } -static BOOL CheckSrgbWriteCapability(struct wined3d_adapter *adapter, const struct wined3d_format *format) +static BOOL CheckSrgbWriteCapability(const struct wined3d_adapter *adapter, const struct wined3d_format *format) { /* Only offer SRGB writing on X8R8G8B8/A8R8G8B8 when we use ARB or GLSL shaders as we are * doing the color fixup in shaders. * Note Windows drivers (at least on the Geforce 8800) also offer this on R5G6B5. */ - if (format->Flags & WINED3DFMT_FLAG_SRGB_WRITE) + if (format->flags & WINED3DFMT_FLAG_SRGB_WRITE) { int vs_selected_mode; int ps_selected_mode; @@ -3378,16 +3281,16 @@ static BOOL CheckSrgbWriteCapability(struct wined3d_adapter *adapter, const stru } /* Check if a format support blending in combination with pixel shaders */ -static BOOL CheckPostPixelShaderBlendingCapability(struct wined3d_adapter *adapter, +static BOOL CheckPostPixelShaderBlendingCapability(const struct wined3d_adapter *adapter, const struct wined3d_format *format) { /* The flags entry of a format contains the post pixel shader blending capability */ - if (format->Flags & WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING) return TRUE; + if (format->flags & WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING) return TRUE; return FALSE; } -static BOOL CheckWrapAndMipCapability(struct wined3d_adapter *adapter, const struct wined3d_format *format) +static BOOL CheckWrapAndMipCapability(const struct wined3d_adapter *adapter, const struct wined3d_format *format) { /* OpenGL supports mipmapping on all formats basically. Wrapping is unsupported, * but we have to report mipmapping so we cannot reject this flag. Tests show that @@ -3402,7 +3305,7 @@ static BOOL CheckWrapAndMipCapability(struct wined3d_adapter *adapter, const str } /* Check if a texture format is supported on the given adapter */ -static BOOL CheckTextureCapability(struct wined3d_adapter *adapter, const struct wined3d_format *format) +static BOOL CheckTextureCapability(const struct wined3d_adapter *adapter, const struct wined3d_format *format) { const struct wined3d_gl_info *gl_info = &adapter->gl_info; @@ -3470,6 +3373,12 @@ static BOOL CheckTextureCapability(struct wined3d_adapter *adapter, const struct case WINED3DFMT_D32_FLOAT: return TRUE; + case WINED3DFMT_INTZ: + if (gl_info->supported[EXT_PACKED_DEPTH_STENCIL] + || gl_info->supported[ARB_FRAMEBUFFER_OBJECT]) + return TRUE; + return FALSE; + /***** * Not supported everywhere(depends on GL_ATI_envmap_bumpmap or * GL_NV_texture_shader). Emulated by shaders @@ -3637,6 +3546,11 @@ static BOOL CheckTextureCapability(struct wined3d_adapter *adapter, const struct TRACE_(d3d_caps)("[FAILED]\n"); return FALSE; + case WINED3DFMT_NULL: + if (gl_info->supported[ARB_FRAMEBUFFER_OBJECT]) + return TRUE; + return FALSE; + case WINED3DFMT_UNKNOWN: return FALSE; @@ -3647,7 +3561,7 @@ static BOOL CheckTextureCapability(struct wined3d_adapter *adapter, const struct return FALSE; } -static BOOL CheckSurfaceCapability(struct wined3d_adapter *adapter, +static BOOL CheckSurfaceCapability(const struct wined3d_adapter *adapter, const struct wined3d_format *adapter_format, const struct wined3d_format *check_format, WINED3DSURFTYPE SurfaceType) @@ -3688,7 +3602,7 @@ static BOOL CheckSurfaceCapability(struct wined3d_adapter *adapter, if (CheckDepthStencilCapability(adapter, adapter_format, check_format)) return TRUE; /* If opengl can't process the format natively, the blitter may be able to convert it */ - if (adapter->blitter->blit_supported(&adapter->gl_info, BLIT_OP_BLIT, + if (adapter->blitter->blit_supported(&adapter->gl_info, WINED3D_BLIT_OP_COLOR_BLIT, NULL, WINED3DPOOL_DEFAULT, 0, check_format, NULL, WINED3DPOOL_DEFAULT, 0, adapter_format)) { @@ -3701,37 +3615,32 @@ static BOOL CheckSurfaceCapability(struct wined3d_adapter *adapter, return FALSE; } -static BOOL CheckVertexTextureCapability(struct wined3d_adapter *adapter, +static BOOL CheckVertexTextureCapability(const struct wined3d_adapter *adapter, const struct wined3d_format *format) { - return adapter->gl_info.limits.vertex_samplers && (format->Flags & WINED3DFMT_FLAG_VTF); + return adapter->gl_info.limits.vertex_samplers && (format->flags & WINED3DFMT_FLAG_VTF); } -static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapter, WINED3DDEVTYPE DeviceType, - enum wined3d_format_id AdapterFormat, DWORD Usage, WINED3DRESOURCETYPE RType, - enum wined3d_format_id CheckFormat, WINED3DSURFTYPE SurfaceType) +HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT adapter_idx, + WINED3DDEVTYPE device_type, enum wined3d_format_id adapter_format_id, DWORD usage, + WINED3DRESOURCETYPE resource_type, enum wined3d_format_id check_format_id, WINED3DSURFTYPE surface_type) { - IWineD3DImpl *This = (IWineD3DImpl *)iface; - struct wined3d_adapter *adapter = &This->adapters[Adapter]; + const struct wined3d_adapter *adapter = &wined3d->adapters[adapter_idx]; const struct wined3d_gl_info *gl_info = &adapter->gl_info; - const struct wined3d_format *format = wined3d_get_format(gl_info, CheckFormat); - const struct wined3d_format *adapter_format = wined3d_get_format(gl_info, AdapterFormat); - DWORD UsageCaps = 0; + const struct wined3d_format *adapter_format = wined3d_get_format(gl_info, adapter_format_id); + const struct wined3d_format *format = wined3d_get_format(gl_info, check_format_id); + DWORD usage_caps = 0; - TRACE_(d3d_caps)("(%p)-> (STUB) (Adptr:%d, DevType:(%u,%s), AdptFmt:(%u,%s), Use:(%u,%s,%s), ResTyp:(%x,%s), CheckFmt:(%u,%s))\n", - This, - Adapter, - DeviceType, debug_d3ddevicetype(DeviceType), - AdapterFormat, debug_d3dformat(AdapterFormat), - Usage, debug_d3dusage(Usage), debug_d3dusagequery(Usage), - RType, debug_d3dresourcetype(RType), - CheckFormat, debug_d3dformat(CheckFormat)); + TRACE_(d3d_caps)("wined3d %p, adapter_idx %u, device_type %s, adapter_format %s, usage %s, %s,\n" + "resource_type %s, check_format %s, surface_type %#x.\n", + wined3d, adapter_idx, debug_d3ddevicetype(device_type), debug_d3dformat(adapter_format_id), + debug_d3dusage(usage), debug_d3dusagequery(usage), debug_d3dresourcetype(resource_type), + debug_d3dformat(check_format_id), surface_type); - if (Adapter >= IWineD3D_GetAdapterCount(iface)) { + if (adapter_idx >= wined3d->adapter_count) return WINED3DERR_INVALIDCALL; - } - switch (RType) + switch (resource_type) { case WINED3DRTYPE_CUBETEXTURE: /* Cubetexture allows: @@ -3743,7 +3652,7 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt * - WINED3DUSAGE_SOFTWAREPROCESSING * - WINED3DUSAGE_QUERY_WRAPANDMIP */ - if (SurfaceType != SURFACE_OPENGL) + if (surface_type != SURFACE_OPENGL) { TRACE_(d3d_caps)("[FAILED]\n"); return WINED3DERR_NOTAVAILABLE; @@ -3761,92 +3670,92 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt return WINED3DERR_NOTAVAILABLE; } - if (Usage & WINED3DUSAGE_AUTOGENMIPMAP) + if (usage & WINED3DUSAGE_AUTOGENMIPMAP) { if (!gl_info->supported[SGIS_GENERATE_MIPMAP]) /* When autogenmipmap isn't around continue and return * WINED3DOK_NOAUTOGEN instead of D3D_OK. */ TRACE_(d3d_caps)("[FAILED] - No autogenmipmap support, but continuing\n"); else - UsageCaps |= WINED3DUSAGE_AUTOGENMIPMAP; + usage_caps |= WINED3DUSAGE_AUTOGENMIPMAP; } /* Always report dynamic locking. */ - if (Usage & WINED3DUSAGE_DYNAMIC) - UsageCaps |= WINED3DUSAGE_DYNAMIC; + if (usage & WINED3DUSAGE_DYNAMIC) + usage_caps |= WINED3DUSAGE_DYNAMIC; - if (Usage & WINED3DUSAGE_RENDERTARGET) + if (usage & WINED3DUSAGE_RENDERTARGET) { if (!CheckRenderTargetCapability(adapter, adapter_format, format)) { TRACE_(d3d_caps)("[FAILED] - No rendertarget support\n"); return WINED3DERR_NOTAVAILABLE; } - UsageCaps |= WINED3DUSAGE_RENDERTARGET; + usage_caps |= WINED3DUSAGE_RENDERTARGET; } /* Always report software processing. */ - if (Usage & WINED3DUSAGE_SOFTWAREPROCESSING) - UsageCaps |= WINED3DUSAGE_SOFTWAREPROCESSING; + if (usage & WINED3DUSAGE_SOFTWAREPROCESSING) + usage_caps |= WINED3DUSAGE_SOFTWAREPROCESSING; - if (Usage & WINED3DUSAGE_QUERY_FILTER) + if (usage & WINED3DUSAGE_QUERY_FILTER) { if (!CheckFilterCapability(adapter, format)) { TRACE_(d3d_caps)("[FAILED] - No query filter support\n"); return WINED3DERR_NOTAVAILABLE; } - UsageCaps |= WINED3DUSAGE_QUERY_FILTER; + usage_caps |= WINED3DUSAGE_QUERY_FILTER; } - if (Usage & WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING) + if (usage & WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING) { if (!CheckPostPixelShaderBlendingCapability(adapter, format)) { TRACE_(d3d_caps)("[FAILED] - No query post pixelshader blending support\n"); return WINED3DERR_NOTAVAILABLE; } - UsageCaps |= WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING; + usage_caps |= WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING; } - if (Usage & WINED3DUSAGE_QUERY_SRGBREAD) + if (usage & WINED3DUSAGE_QUERY_SRGBREAD) { if (!CheckSrgbReadCapability(adapter, format)) { TRACE_(d3d_caps)("[FAILED] - No query srgbread support\n"); return WINED3DERR_NOTAVAILABLE; } - UsageCaps |= WINED3DUSAGE_QUERY_SRGBREAD; + usage_caps |= WINED3DUSAGE_QUERY_SRGBREAD; } - if (Usage & WINED3DUSAGE_QUERY_SRGBWRITE) + if (usage & WINED3DUSAGE_QUERY_SRGBWRITE) { if (!CheckSrgbWriteCapability(adapter, format)) { TRACE_(d3d_caps)("[FAILED] - No query srgbwrite support\n"); return WINED3DERR_NOTAVAILABLE; } - UsageCaps |= WINED3DUSAGE_QUERY_SRGBWRITE; + usage_caps |= WINED3DUSAGE_QUERY_SRGBWRITE; } - if (Usage & WINED3DUSAGE_QUERY_VERTEXTEXTURE) + if (usage & WINED3DUSAGE_QUERY_VERTEXTEXTURE) { if (!CheckVertexTextureCapability(adapter, format)) { TRACE_(d3d_caps)("[FAILED] - No query vertextexture support\n"); return WINED3DERR_NOTAVAILABLE; } - UsageCaps |= WINED3DUSAGE_QUERY_VERTEXTEXTURE; + usage_caps |= WINED3DUSAGE_QUERY_VERTEXTEXTURE; } - if (Usage & WINED3DUSAGE_QUERY_WRAPANDMIP) + if (usage & WINED3DUSAGE_QUERY_WRAPANDMIP) { if (!CheckWrapAndMipCapability(adapter, format)) { TRACE_(d3d_caps)("[FAILED] - No wrapping and mipmapping support\n"); return WINED3DERR_NOTAVAILABLE; } - UsageCaps |= WINED3DUSAGE_QUERY_WRAPANDMIP; + usage_caps |= WINED3DUSAGE_QUERY_WRAPANDMIP; } break; @@ -3856,40 +3765,40 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt * - WINED3DUSAGE_NONSECURE (d3d9ex) * - WINED3DUSAGE_RENDERTARGET */ - if (!CheckSurfaceCapability(adapter, adapter_format, format, SurfaceType)) + if (!CheckSurfaceCapability(adapter, adapter_format, format, surface_type)) { TRACE_(d3d_caps)("[FAILED] - Not supported for plain surfaces\n"); return WINED3DERR_NOTAVAILABLE; } - if (Usage & WINED3DUSAGE_DEPTHSTENCIL) + if (usage & WINED3DUSAGE_DEPTHSTENCIL) { if (!CheckDepthStencilCapability(adapter, adapter_format, format)) { TRACE_(d3d_caps)("[FAILED] - No depthstencil support\n"); return WINED3DERR_NOTAVAILABLE; } - UsageCaps |= WINED3DUSAGE_DEPTHSTENCIL; + usage_caps |= WINED3DUSAGE_DEPTHSTENCIL; } - if (Usage & WINED3DUSAGE_RENDERTARGET) + if (usage & WINED3DUSAGE_RENDERTARGET) { if (!CheckRenderTargetCapability(adapter, adapter_format, format)) { TRACE_(d3d_caps)("[FAILED] - No rendertarget support\n"); return WINED3DERR_NOTAVAILABLE; } - UsageCaps |= WINED3DUSAGE_RENDERTARGET; + usage_caps |= WINED3DUSAGE_RENDERTARGET; } - if (Usage & WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING) + if (usage & WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING) { if (!CheckPostPixelShaderBlendingCapability(adapter, format)) { TRACE_(d3d_caps)("[FAILED] - No query post pixelshader blending support\n"); return WINED3DERR_NOTAVAILABLE; } - UsageCaps |= WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING; + usage_caps |= WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING; } break; @@ -3905,7 +3814,7 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt * - WINED3DUSAGE_TEXTAPI (d3d9ex) * - WINED3DUSAGE_QUERY_WRAPANDMIP */ - if (SurfaceType != SURFACE_OPENGL) + if (surface_type != SURFACE_OPENGL) { TRACE_(d3d_caps)("[FAILED]\n"); return WINED3DERR_NOTAVAILABLE; @@ -3917,117 +3826,117 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt return WINED3DERR_NOTAVAILABLE; } - if (Usage & WINED3DUSAGE_AUTOGENMIPMAP) + if (usage & WINED3DUSAGE_AUTOGENMIPMAP) { if (!gl_info->supported[SGIS_GENERATE_MIPMAP]) /* When autogenmipmap isn't around continue and return * WINED3DOK_NOAUTOGEN instead of D3D_OK. */ TRACE_(d3d_caps)("[FAILED] - No autogenmipmap support, but continuing\n"); else - UsageCaps |= WINED3DUSAGE_AUTOGENMIPMAP; + usage_caps |= WINED3DUSAGE_AUTOGENMIPMAP; } /* Always report dynamic locking. */ - if (Usage & WINED3DUSAGE_DYNAMIC) - UsageCaps |= WINED3DUSAGE_DYNAMIC; + if (usage & WINED3DUSAGE_DYNAMIC) + usage_caps |= WINED3DUSAGE_DYNAMIC; - if (Usage & WINED3DUSAGE_RENDERTARGET) + if (usage & WINED3DUSAGE_RENDERTARGET) { if (!CheckRenderTargetCapability(adapter, adapter_format, format)) { TRACE_(d3d_caps)("[FAILED] - No rendertarget support\n"); return WINED3DERR_NOTAVAILABLE; } - UsageCaps |= WINED3DUSAGE_RENDERTARGET; + usage_caps |= WINED3DUSAGE_RENDERTARGET; } /* Always report software processing. */ - if (Usage & WINED3DUSAGE_SOFTWAREPROCESSING) - UsageCaps |= WINED3DUSAGE_SOFTWAREPROCESSING; + if (usage & WINED3DUSAGE_SOFTWAREPROCESSING) + usage_caps |= WINED3DUSAGE_SOFTWAREPROCESSING; - if (Usage & WINED3DUSAGE_QUERY_FILTER) + if (usage & WINED3DUSAGE_QUERY_FILTER) { if (!CheckFilterCapability(adapter, format)) { TRACE_(d3d_caps)("[FAILED] - No query filter support\n"); return WINED3DERR_NOTAVAILABLE; } - UsageCaps |= WINED3DUSAGE_QUERY_FILTER; + usage_caps |= WINED3DUSAGE_QUERY_FILTER; } - if (Usage & WINED3DUSAGE_QUERY_LEGACYBUMPMAP) + if (usage & WINED3DUSAGE_QUERY_LEGACYBUMPMAP) { if (!CheckBumpMapCapability(adapter, format)) { TRACE_(d3d_caps)("[FAILED] - No legacy bumpmap support\n"); return WINED3DERR_NOTAVAILABLE; } - UsageCaps |= WINED3DUSAGE_QUERY_LEGACYBUMPMAP; + usage_caps |= WINED3DUSAGE_QUERY_LEGACYBUMPMAP; } - if (Usage & WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING) + if (usage & WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING) { if (!CheckPostPixelShaderBlendingCapability(adapter, format)) { TRACE_(d3d_caps)("[FAILED] - No query post pixelshader blending support\n"); return WINED3DERR_NOTAVAILABLE; } - UsageCaps |= WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING; + usage_caps |= WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING; } - if (Usage & WINED3DUSAGE_QUERY_SRGBREAD) + if (usage & WINED3DUSAGE_QUERY_SRGBREAD) { if (!CheckSrgbReadCapability(adapter, format)) { TRACE_(d3d_caps)("[FAILED] - No query srgbread support\n"); return WINED3DERR_NOTAVAILABLE; } - UsageCaps |= WINED3DUSAGE_QUERY_SRGBREAD; + usage_caps |= WINED3DUSAGE_QUERY_SRGBREAD; } - if (Usage & WINED3DUSAGE_QUERY_SRGBWRITE) + if (usage & WINED3DUSAGE_QUERY_SRGBWRITE) { if (!CheckSrgbWriteCapability(adapter, format)) { TRACE_(d3d_caps)("[FAILED] - No query srgbwrite support\n"); return WINED3DERR_NOTAVAILABLE; } - UsageCaps |= WINED3DUSAGE_QUERY_SRGBWRITE; + usage_caps |= WINED3DUSAGE_QUERY_SRGBWRITE; } - if (Usage & WINED3DUSAGE_QUERY_VERTEXTEXTURE) + if (usage & WINED3DUSAGE_QUERY_VERTEXTEXTURE) { if (!CheckVertexTextureCapability(adapter, format)) { TRACE_(d3d_caps)("[FAILED] - No query vertextexture support\n"); return WINED3DERR_NOTAVAILABLE; } - UsageCaps |= WINED3DUSAGE_QUERY_VERTEXTEXTURE; + usage_caps |= WINED3DUSAGE_QUERY_VERTEXTEXTURE; } - if (Usage & WINED3DUSAGE_QUERY_WRAPANDMIP) + if (usage & WINED3DUSAGE_QUERY_WRAPANDMIP) { if (!CheckWrapAndMipCapability(adapter, format)) { TRACE_(d3d_caps)("[FAILED] - No wrapping and mipmapping support\n"); return WINED3DERR_NOTAVAILABLE; } - UsageCaps |= WINED3DUSAGE_QUERY_WRAPANDMIP; + usage_caps |= WINED3DUSAGE_QUERY_WRAPANDMIP; } - if (Usage & WINED3DUSAGE_DEPTHSTENCIL) + if (usage & WINED3DUSAGE_DEPTHSTENCIL) { if (!CheckDepthStencilCapability(adapter, adapter_format, format)) { TRACE_(d3d_caps)("[FAILED] - No depth stencil support\n"); return WINED3DERR_NOTAVAILABLE; } - if ((format->Flags & WINED3DFMT_FLAG_SHADOW) && !gl_info->supported[ARB_SHADOW]) + if ((format->flags & WINED3DFMT_FLAG_SHADOW) && !gl_info->supported[ARB_SHADOW]) { TRACE_(d3d_caps)("[FAILED] - No shadow sampler support.\n"); return WINED3DERR_NOTAVAILABLE; } - UsageCaps |= WINED3DUSAGE_DEPTHSTENCIL; + usage_caps |= WINED3DUSAGE_DEPTHSTENCIL; } break; @@ -4043,7 +3952,7 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt * - D3DUSAGE_SOFTWAREPROCESSING * - D3DUSAGE_QUERY_WRAPANDMIP */ - if (SurfaceType != SURFACE_OPENGL) + if (surface_type != SURFACE_OPENGL) { TRACE_(d3d_caps)("[FAILED]\n"); return WINED3DERR_NOTAVAILABLE; @@ -4068,7 +3977,7 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt * leading applications into temptation. The windows drivers don't * support most of those formats on volumes anyway, except for * WINED3DFMT_R32_FLOAT. */ - switch (CheckFormat) + switch (check_format_id) { case WINED3DFMT_P8_UINT: case WINED3DFMT_L4A4_UNORM: @@ -4116,118 +4025,115 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapt } /* Always report dynamic locking. */ - if (Usage & WINED3DUSAGE_DYNAMIC) - UsageCaps |= WINED3DUSAGE_DYNAMIC; + if (usage & WINED3DUSAGE_DYNAMIC) + usage_caps |= WINED3DUSAGE_DYNAMIC; /* Always report software processing. */ - if (Usage & WINED3DUSAGE_SOFTWAREPROCESSING) - UsageCaps |= WINED3DUSAGE_SOFTWAREPROCESSING; + if (usage & WINED3DUSAGE_SOFTWAREPROCESSING) + usage_caps |= WINED3DUSAGE_SOFTWAREPROCESSING; - if (Usage & WINED3DUSAGE_QUERY_FILTER) + if (usage & WINED3DUSAGE_QUERY_FILTER) { if (!CheckFilterCapability(adapter, format)) { TRACE_(d3d_caps)("[FAILED] - No query filter support\n"); return WINED3DERR_NOTAVAILABLE; } - UsageCaps |= WINED3DUSAGE_QUERY_FILTER; + usage_caps |= WINED3DUSAGE_QUERY_FILTER; } - if (Usage & WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING) + if (usage & WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING) { if (!CheckPostPixelShaderBlendingCapability(adapter, format)) { TRACE_(d3d_caps)("[FAILED] - No query post pixelshader blending support\n"); return WINED3DERR_NOTAVAILABLE; } - UsageCaps |= WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING; + usage_caps |= WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING; } - if (Usage & WINED3DUSAGE_QUERY_SRGBREAD) + if (usage & WINED3DUSAGE_QUERY_SRGBREAD) { if (!CheckSrgbReadCapability(adapter, format)) { TRACE_(d3d_caps)("[FAILED] - No query srgbread support\n"); return WINED3DERR_NOTAVAILABLE; } - UsageCaps |= WINED3DUSAGE_QUERY_SRGBREAD; + usage_caps |= WINED3DUSAGE_QUERY_SRGBREAD; } - if (Usage & WINED3DUSAGE_QUERY_SRGBWRITE) + if (usage & WINED3DUSAGE_QUERY_SRGBWRITE) { if (!CheckSrgbWriteCapability(adapter, format)) { TRACE_(d3d_caps)("[FAILED] - No query srgbwrite support\n"); return WINED3DERR_NOTAVAILABLE; } - UsageCaps |= WINED3DUSAGE_QUERY_SRGBWRITE; + usage_caps |= WINED3DUSAGE_QUERY_SRGBWRITE; } - if (Usage & WINED3DUSAGE_QUERY_VERTEXTEXTURE) + if (usage & WINED3DUSAGE_QUERY_VERTEXTEXTURE) { if (!CheckVertexTextureCapability(adapter, format)) { TRACE_(d3d_caps)("[FAILED] - No query vertextexture support\n"); return WINED3DERR_NOTAVAILABLE; } - UsageCaps |= WINED3DUSAGE_QUERY_VERTEXTEXTURE; + usage_caps |= WINED3DUSAGE_QUERY_VERTEXTEXTURE; } - if (Usage & WINED3DUSAGE_QUERY_WRAPANDMIP) + if (usage & WINED3DUSAGE_QUERY_WRAPANDMIP) { if (!CheckWrapAndMipCapability(adapter, format)) { TRACE_(d3d_caps)("[FAILED] - No wrapping and mipmapping support\n"); return WINED3DERR_NOTAVAILABLE; } - UsageCaps |= WINED3DUSAGE_QUERY_WRAPANDMIP; + usage_caps |= WINED3DUSAGE_QUERY_WRAPANDMIP; } break; default: - FIXME_(d3d_caps)("Unhandled resource type %s.\n", debug_d3dresourcetype(RType)); + FIXME_(d3d_caps)("Unhandled resource type %s.\n", debug_d3dresourcetype(resource_type)); return WINED3DERR_NOTAVAILABLE; } - /* When the UsageCaps exactly matches Usage return WINED3D_OK except for + /* When the usage_caps exactly matches usage return WINED3D_OK except for * the situation in which WINED3DUSAGE_AUTOGENMIPMAP isn't around, then * WINED3DOK_NOAUTOGEN is returned if all the other usage flags match. */ - if (UsageCaps == Usage) + if (usage_caps == usage) return WINED3D_OK; - if (UsageCaps == (Usage & ~WINED3DUSAGE_AUTOGENMIPMAP)) + if (usage_caps == (usage & ~WINED3DUSAGE_AUTOGENMIPMAP)) return WINED3DOK_NOAUTOGEN; - TRACE_(d3d_caps)("[FAILED] - Usage %#x requested for CheckFormat %s and RType %s but only %#x is available\n", - Usage, debug_d3dformat(CheckFormat), debug_d3dresourcetype(RType), UsageCaps); + TRACE_(d3d_caps)("[FAILED] - Usage %#x requested for format %s and resource_type %s but only %#x is available.\n", + usage, debug_d3dformat(check_format_id), debug_d3dresourcetype(resource_type), usage_caps); return WINED3DERR_NOTAVAILABLE; } -static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormatConversion(IWineD3D *iface, UINT adapter_idx, +HRESULT CDECL wined3d_check_device_format_conversion(const struct wined3d *wined3d, UINT adapter_idx, WINED3DDEVTYPE device_type, enum wined3d_format_id src_format, enum wined3d_format_id dst_format) { - FIXME("iface %p, adapter_idx %u, device_type %s, src_format %s, dst_format %s stub!\n", - iface, adapter_idx, debug_d3ddevicetype(device_type), debug_d3dformat(src_format), + FIXME("wined3d %p, adapter_idx %u, device_type %s, src_format %s, dst_format %s stub!\n", + wined3d, adapter_idx, debug_d3ddevicetype(device_type), debug_d3dformat(src_format), debug_d3dformat(dst_format)); return WINED3D_OK; } -static HRESULT WINAPI IWineD3DImpl_CheckDeviceType(IWineD3D *iface, UINT adapter_idx, WINED3DDEVTYPE device_type, +HRESULT CDECL wined3d_check_device_type(const struct wined3d *wined3d, UINT adapter_idx, WINED3DDEVTYPE device_type, enum wined3d_format_id display_format, enum wined3d_format_id backbuffer_format, BOOL windowed) { UINT mode_count; HRESULT hr; - TRACE("iface %p, adapter_idx %u, device_type %s, display_format %s, backbuffer_format %s, windowed %#x.\n", - iface, adapter_idx, debug_d3ddevicetype(device_type), debug_d3dformat(display_format), + TRACE("wined3d %p, adapter_idx %u, device_type %s, display_format %s, backbuffer_format %s, windowed %#x.\n", + wined3d, adapter_idx, debug_d3ddevicetype(device_type), debug_d3dformat(display_format), debug_d3dformat(backbuffer_format), windowed); - if (adapter_idx >= IWineD3D_GetAdapterCount(iface)) - { - WARN_(d3d_caps)("adapter_idx >= IWineD3D_GetAdapterCount(iface), returning WINED3DERR_INVALIDCALL\n"); + if (adapter_idx >= wined3d->adapter_count) return WINED3DERR_INVALIDCALL; - } /* The task of this function is to check whether a certain display / backbuffer format * combination is available on the given adapter. In fullscreen mode microsoft specified @@ -4249,7 +4155,7 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceType(IWineD3D *iface, UINT adapter } /* If the requested display format is not available, don't continue. */ - mode_count = IWineD3DImpl_GetAdapterModeCount(iface, adapter_idx, display_format); + mode_count = wined3d_get_adapter_mode_count(wined3d, adapter_idx, display_format); if (!mode_count) { TRACE_(d3d_caps)("No available modes for display format %s.\n", debug_d3dformat(display_format)); @@ -4306,7 +4212,7 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceType(IWineD3D *iface, UINT adapter } /* Use CheckDeviceFormat to see if the backbuffer_format is usable with the given display_format */ - hr = IWineD3DImpl_CheckDeviceFormat(iface, adapter_idx, device_type, display_format, + hr = wined3d_check_device_format(wined3d, adapter_idx, device_type, display_format, WINED3DUSAGE_RENDERTARGET, WINED3DRTYPE_SURFACE, backbuffer_format, SURFACE_OPENGL); if (FAILED(hr)) TRACE_(d3d_caps)("Unsupported display/backbuffer format combination %s / %s.\n", @@ -4318,10 +4224,10 @@ static HRESULT WINAPI IWineD3DImpl_CheckDeviceType(IWineD3D *iface, UINT adapter /* Note: d3d8 passes in a pointer to a D3DCAPS8 structure, which is a true subset of a D3DCAPS9 structure. However, it has to come via a void * as the d3d8 interface cannot import the d3d9 header */ -static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, WINED3DDEVTYPE DeviceType, WINED3DCAPS* pCaps) { - - IWineD3DImpl *This = (IWineD3DImpl *)iface; - struct wined3d_adapter *adapter = &This->adapters[Adapter]; +HRESULT CDECL wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapter_idx, + WINED3DDEVTYPE device_type, WINED3DCAPS *caps) +{ + const struct wined3d_adapter *adapter = &wined3d->adapters[adapter_idx]; const struct wined3d_gl_info *gl_info = &adapter->gl_info; int vs_selected_mode; int ps_selected_mode; @@ -4329,40 +4235,39 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, struct fragment_caps fragment_caps; DWORD ckey_caps, blit_caps, fx_caps, pal_caps; - TRACE_(d3d_caps)("(%p)->(Adptr:%d, DevType: %x, pCaps: %p)\n", This, Adapter, DeviceType, pCaps); + TRACE_(d3d_caps)("wined3d %p, adapter_idx %u, device_type %s, caps %p.\n", + wined3d, adapter_idx, debug_d3ddevicetype(device_type), caps); - if (Adapter >= IWineD3D_GetAdapterCount(iface)) { + if (adapter_idx >= wined3d->adapter_count) return WINED3DERR_INVALIDCALL; - } select_shader_mode(&adapter->gl_info, &ps_selected_mode, &vs_selected_mode); /* ------------------------------------------------ The following fields apply to both d3d8 and d3d9 ------------------------------------------------ */ - pCaps->DeviceType = (DeviceType == WINED3DDEVTYPE_HAL) ? WINED3DDEVTYPE_HAL : WINED3DDEVTYPE_REF; /* Not quite true, but use h/w supported by opengl I suppose */ - pCaps->AdapterOrdinal = Adapter; + /* Not quite true, but use h/w supported by opengl I suppose */ + caps->DeviceType = (device_type == WINED3DDEVTYPE_HAL) ? WINED3DDEVTYPE_HAL : WINED3DDEVTYPE_REF; + caps->AdapterOrdinal = adapter_idx; - pCaps->Caps = 0; - pCaps->Caps2 = WINED3DCAPS2_CANRENDERWINDOWED | + caps->Caps = 0; + caps->Caps2 = WINED3DCAPS2_CANRENDERWINDOWED | WINED3DCAPS2_FULLSCREENGAMMA | WINED3DCAPS2_DYNAMICTEXTURES; if (gl_info->supported[SGIS_GENERATE_MIPMAP]) - { - pCaps->Caps2 |= WINED3DCAPS2_CANAUTOGENMIPMAP; - } + caps->Caps2 |= WINED3DCAPS2_CANAUTOGENMIPMAP; - pCaps->Caps3 = WINED3DCAPS3_ALPHA_FULLSCREEN_FLIP_OR_DISCARD | + caps->Caps3 = WINED3DCAPS3_ALPHA_FULLSCREEN_FLIP_OR_DISCARD | WINED3DCAPS3_COPY_TO_VIDMEM | WINED3DCAPS3_COPY_TO_SYSTEMMEM; - pCaps->PresentationIntervals = WINED3DPRESENT_INTERVAL_IMMEDIATE | + caps->PresentationIntervals = WINED3DPRESENT_INTERVAL_IMMEDIATE | WINED3DPRESENT_INTERVAL_ONE; - pCaps->CursorCaps = WINED3DCURSORCAPS_COLOR | + caps->CursorCaps = WINED3DCURSORCAPS_COLOR | WINED3DCURSORCAPS_LOWRES; - pCaps->DevCaps = WINED3DDEVCAPS_FLOATTLVERTEX | + caps->DevCaps = WINED3DDEVCAPS_FLOATTLVERTEX | WINED3DDEVCAPS_EXECUTESYSTEMMEMORY | WINED3DDEVCAPS_TLVERTEXSYSTEMMEMORY| WINED3DDEVCAPS_TLVERTEXVIDEOMEMORY | @@ -4378,7 +4283,7 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, WINED3DDEVCAPS_DRAWPRIMITIVES2EX | WINED3DDEVCAPS_RTPATCHES; - pCaps->PrimitiveMiscCaps = WINED3DPMISCCAPS_CULLNONE | + caps->PrimitiveMiscCaps = WINED3DPMISCCAPS_CULLNONE | WINED3DPMISCCAPS_CULLCCW | WINED3DPMISCCAPS_CULLCW | WINED3DPMISCCAPS_COLORWRITEENABLE | @@ -4394,11 +4299,11 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, WINED3DPMISCCAPS_FOGVERTEXCLAMPED */ if (gl_info->supported[EXT_BLEND_EQUATION_SEPARATE] && gl_info->supported[EXT_BLEND_FUNC_SEPARATE]) - pCaps->PrimitiveMiscCaps |= WINED3DPMISCCAPS_SEPARATEALPHABLEND; + caps->PrimitiveMiscCaps |= WINED3DPMISCCAPS_SEPARATEALPHABLEND; if (gl_info->supported[EXT_DRAW_BUFFERS2]) - pCaps->PrimitiveMiscCaps |= WINED3DPMISCCAPS_INDEPENDENTWRITEMASKS; + caps->PrimitiveMiscCaps |= WINED3DPMISCCAPS_INDEPENDENTWRITEMASKS; - pCaps->RasterCaps = WINED3DPRASTERCAPS_DITHER | + caps->RasterCaps = WINED3DPRASTERCAPS_DITHER | WINED3DPRASTERCAPS_PAT | WINED3DPRASTERCAPS_WFOG | WINED3DPRASTERCAPS_ZFOG | @@ -4413,13 +4318,13 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, if (gl_info->supported[EXT_TEXTURE_FILTER_ANISOTROPIC]) { - pCaps->RasterCaps |= WINED3DPRASTERCAPS_ANISOTROPY | + caps->RasterCaps |= WINED3DPRASTERCAPS_ANISOTROPY | WINED3DPRASTERCAPS_ZBIAS | WINED3DPRASTERCAPS_MIPMAPLODBIAS; } if (gl_info->supported[NV_FOG_DISTANCE]) { - pCaps->RasterCaps |= WINED3DPRASTERCAPS_FOGRANGE; + caps->RasterCaps |= WINED3DPRASTERCAPS_FOGRANGE; } /* FIXME Add: WINED3DPRASTERCAPS_COLORPERSPECTIVE @@ -4428,7 +4333,7 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, WINED3DPRASTERCAPS_ZBUFFERLESSHSR WINED3DPRASTERCAPS_WBUFFER */ - pCaps->ZCmpCaps = WINED3DPCMPCAPS_ALWAYS | + caps->ZCmpCaps = WINED3DPCMPCAPS_ALWAYS | WINED3DPCMPCAPS_EQUAL | WINED3DPCMPCAPS_GREATER | WINED3DPCMPCAPS_GREATEREQUAL | @@ -4437,7 +4342,7 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, WINED3DPCMPCAPS_NEVER | WINED3DPCMPCAPS_NOTEQUAL; - pCaps->SrcBlendCaps = WINED3DPBLENDCAPS_BOTHINVSRCALPHA | + caps->SrcBlendCaps = WINED3DPBLENDCAPS_BOTHINVSRCALPHA | WINED3DPBLENDCAPS_BOTHSRCALPHA | WINED3DPBLENDCAPS_DESTALPHA | WINED3DPBLENDCAPS_DESTCOLOR | @@ -4451,7 +4356,7 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, WINED3DPBLENDCAPS_SRCCOLOR | WINED3DPBLENDCAPS_ZERO; - pCaps->DestBlendCaps = WINED3DPBLENDCAPS_DESTALPHA | + caps->DestBlendCaps = WINED3DPBLENDCAPS_DESTALPHA | WINED3DPBLENDCAPS_DESTCOLOR | WINED3DPBLENDCAPS_INVDESTALPHA | WINED3DPBLENDCAPS_INVDESTCOLOR | @@ -4470,12 +4375,12 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, if (gl_info->supported[EXT_BLEND_COLOR]) { - pCaps->SrcBlendCaps |= WINED3DPBLENDCAPS_BLENDFACTOR; - pCaps->DestBlendCaps |= WINED3DPBLENDCAPS_BLENDFACTOR; + caps->SrcBlendCaps |= WINED3DPBLENDCAPS_BLENDFACTOR; + caps->DestBlendCaps |= WINED3DPBLENDCAPS_BLENDFACTOR; } - pCaps->AlphaCmpCaps = WINED3DPCMPCAPS_ALWAYS | + caps->AlphaCmpCaps = WINED3DPCMPCAPS_ALWAYS | WINED3DPCMPCAPS_EQUAL | WINED3DPCMPCAPS_GREATER | WINED3DPCMPCAPS_GREATEREQUAL | @@ -4484,7 +4389,7 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, WINED3DPCMPCAPS_NEVER | WINED3DPCMPCAPS_NOTEQUAL; - pCaps->ShadeCaps = WINED3DPSHADECAPS_SPECULARGOURAUDRGB | + caps->ShadeCaps = WINED3DPSHADECAPS_SPECULARGOURAUDRGB | WINED3DPSHADECAPS_COLORGOURAUDRGB | WINED3DPSHADECAPS_ALPHAFLATBLEND | WINED3DPSHADECAPS_ALPHAGOURAUDBLEND | @@ -4493,7 +4398,7 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, WINED3DPSHADECAPS_FOGGOURAUD | WINED3DPSHADECAPS_SPECULARFLATRGB; - pCaps->TextureCaps = WINED3DPTEXTURECAPS_ALPHA | + caps->TextureCaps = WINED3DPTEXTURECAPS_ALPHA | WINED3DPTEXTURECAPS_ALPHAPALETTE | WINED3DPTEXTURECAPS_TRANSPARENCY | WINED3DPTEXTURECAPS_BORDER | @@ -4503,26 +4408,31 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, if (!gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO]) { - pCaps->TextureCaps |= WINED3DPTEXTURECAPS_POW2 | + caps->TextureCaps |= WINED3DPTEXTURECAPS_POW2 | WINED3DPTEXTURECAPS_NONPOW2CONDITIONAL; } if (gl_info->supported[EXT_TEXTURE3D]) { - pCaps->TextureCaps |= WINED3DPTEXTURECAPS_VOLUMEMAP | - WINED3DPTEXTURECAPS_MIPVOLUMEMAP | - WINED3DPTEXTURECAPS_VOLUMEMAP_POW2; + caps->TextureCaps |= WINED3DPTEXTURECAPS_VOLUMEMAP | + WINED3DPTEXTURECAPS_MIPVOLUMEMAP; + if (!gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO]) + { + caps->TextureCaps |= WINED3DPTEXTURECAPS_VOLUMEMAP_POW2; + } } if (gl_info->supported[ARB_TEXTURE_CUBE_MAP]) { - pCaps->TextureCaps |= WINED3DPTEXTURECAPS_CUBEMAP | - WINED3DPTEXTURECAPS_MIPCUBEMAP | - WINED3DPTEXTURECAPS_CUBEMAP_POW2; - + caps->TextureCaps |= WINED3DPTEXTURECAPS_CUBEMAP | + WINED3DPTEXTURECAPS_MIPCUBEMAP; + if (!gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO]) + { + caps->TextureCaps |= WINED3DPTEXTURECAPS_CUBEMAP_POW2; + } } - pCaps->TextureFilterCaps = WINED3DPTFILTERCAPS_MAGFLINEAR | + caps->TextureFilterCaps = WINED3DPTFILTERCAPS_MAGFLINEAR | WINED3DPTFILTERCAPS_MAGFPOINT | WINED3DPTFILTERCAPS_MINFLINEAR | WINED3DPTFILTERCAPS_MINFPOINT | @@ -4537,13 +4447,13 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, if (gl_info->supported[EXT_TEXTURE_FILTER_ANISOTROPIC]) { - pCaps->TextureFilterCaps |= WINED3DPTFILTERCAPS_MAGFANISOTROPIC | + caps->TextureFilterCaps |= WINED3DPTFILTERCAPS_MAGFANISOTROPIC | WINED3DPTFILTERCAPS_MINFANISOTROPIC; } if (gl_info->supported[ARB_TEXTURE_CUBE_MAP]) { - pCaps->CubeTextureFilterCaps = WINED3DPTFILTERCAPS_MAGFLINEAR | + caps->CubeTextureFilterCaps = WINED3DPTFILTERCAPS_MAGFLINEAR | WINED3DPTFILTERCAPS_MAGFPOINT | WINED3DPTFILTERCAPS_MINFLINEAR | WINED3DPTFILTERCAPS_MINFPOINT | @@ -4558,15 +4468,18 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, if (gl_info->supported[EXT_TEXTURE_FILTER_ANISOTROPIC]) { - pCaps->CubeTextureFilterCaps |= WINED3DPTFILTERCAPS_MAGFANISOTROPIC | + caps->CubeTextureFilterCaps |= WINED3DPTFILTERCAPS_MAGFANISOTROPIC | WINED3DPTFILTERCAPS_MINFANISOTROPIC; } - } else - pCaps->CubeTextureFilterCaps = 0; + } + else + { + caps->CubeTextureFilterCaps = 0; + } if (gl_info->supported[EXT_TEXTURE3D]) { - pCaps->VolumeTextureFilterCaps = WINED3DPTFILTERCAPS_MAGFLINEAR | + caps->VolumeTextureFilterCaps = WINED3DPTFILTERCAPS_MAGFLINEAR | WINED3DPTFILTERCAPS_MAGFPOINT | WINED3DPTFILTERCAPS_MINFLINEAR | WINED3DPTFILTERCAPS_MINFPOINT | @@ -4578,47 +4491,53 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, WINED3DPTFILTERCAPS_MIPLINEAR | WINED3DPTFILTERCAPS_MIPNEAREST | WINED3DPTFILTERCAPS_NEAREST; - } else - pCaps->VolumeTextureFilterCaps = 0; + } + else + { + caps->VolumeTextureFilterCaps = 0; + } - pCaps->TextureAddressCaps = WINED3DPTADDRESSCAPS_INDEPENDENTUV | + caps->TextureAddressCaps = WINED3DPTADDRESSCAPS_INDEPENDENTUV | WINED3DPTADDRESSCAPS_CLAMP | WINED3DPTADDRESSCAPS_WRAP; if (gl_info->supported[ARB_TEXTURE_BORDER_CLAMP]) { - pCaps->TextureAddressCaps |= WINED3DPTADDRESSCAPS_BORDER; + caps->TextureAddressCaps |= WINED3DPTADDRESSCAPS_BORDER; } if (gl_info->supported[ARB_TEXTURE_MIRRORED_REPEAT]) { - pCaps->TextureAddressCaps |= WINED3DPTADDRESSCAPS_MIRROR; + caps->TextureAddressCaps |= WINED3DPTADDRESSCAPS_MIRROR; } if (gl_info->supported[ATI_TEXTURE_MIRROR_ONCE]) { - pCaps->TextureAddressCaps |= WINED3DPTADDRESSCAPS_MIRRORONCE; + caps->TextureAddressCaps |= WINED3DPTADDRESSCAPS_MIRRORONCE; } if (gl_info->supported[EXT_TEXTURE3D]) { - pCaps->VolumeTextureAddressCaps = WINED3DPTADDRESSCAPS_INDEPENDENTUV | + caps->VolumeTextureAddressCaps = WINED3DPTADDRESSCAPS_INDEPENDENTUV | WINED3DPTADDRESSCAPS_CLAMP | WINED3DPTADDRESSCAPS_WRAP; if (gl_info->supported[ARB_TEXTURE_BORDER_CLAMP]) { - pCaps->VolumeTextureAddressCaps |= WINED3DPTADDRESSCAPS_BORDER; + caps->VolumeTextureAddressCaps |= WINED3DPTADDRESSCAPS_BORDER; } if (gl_info->supported[ARB_TEXTURE_MIRRORED_REPEAT]) { - pCaps->VolumeTextureAddressCaps |= WINED3DPTADDRESSCAPS_MIRROR; + caps->VolumeTextureAddressCaps |= WINED3DPTADDRESSCAPS_MIRROR; } if (gl_info->supported[ATI_TEXTURE_MIRROR_ONCE]) { - pCaps->VolumeTextureAddressCaps |= WINED3DPTADDRESSCAPS_MIRRORONCE; + caps->VolumeTextureAddressCaps |= WINED3DPTADDRESSCAPS_MIRRORONCE; } - } else - pCaps->VolumeTextureAddressCaps = 0; + } + else + { + caps->VolumeTextureAddressCaps = 0; + } - pCaps->LineCaps = WINED3DLINECAPS_TEXTURE | + caps->LineCaps = WINED3DLINECAPS_TEXTURE | WINED3DLINECAPS_ZTEST | WINED3DLINECAPS_BLEND | WINED3DLINECAPS_ALPHACMP | @@ -4627,26 +4546,26 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, * idea how generating the smoothing alpha values works; the result is different */ - pCaps->MaxTextureWidth = gl_info->limits.texture_size; - pCaps->MaxTextureHeight = gl_info->limits.texture_size; + caps->MaxTextureWidth = gl_info->limits.texture_size; + caps->MaxTextureHeight = gl_info->limits.texture_size; if (gl_info->supported[EXT_TEXTURE3D]) - pCaps->MaxVolumeExtent = gl_info->limits.texture3d_size; + caps->MaxVolumeExtent = gl_info->limits.texture3d_size; else - pCaps->MaxVolumeExtent = 0; + caps->MaxVolumeExtent = 0; - pCaps->MaxTextureRepeat = 32768; - pCaps->MaxTextureAspectRatio = gl_info->limits.texture_size; - pCaps->MaxVertexW = 1.0f; + caps->MaxTextureRepeat = 32768; + caps->MaxTextureAspectRatio = gl_info->limits.texture_size; + caps->MaxVertexW = 1.0f; - pCaps->GuardBandLeft = 0.0f; - pCaps->GuardBandTop = 0.0f; - pCaps->GuardBandRight = 0.0f; - pCaps->GuardBandBottom = 0.0f; + caps->GuardBandLeft = 0.0f; + caps->GuardBandTop = 0.0f; + caps->GuardBandRight = 0.0f; + caps->GuardBandBottom = 0.0f; - pCaps->ExtentsAdjust = 0.0f; + caps->ExtentsAdjust = 0.0f; - pCaps->StencilCaps = WINED3DSTENCILCAPS_DECRSAT | + caps->StencilCaps = WINED3DSTENCILCAPS_DECRSAT | WINED3DSTENCILCAPS_INCRSAT | WINED3DSTENCILCAPS_INVERT | WINED3DSTENCILCAPS_KEEP | @@ -4654,162 +4573,185 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, WINED3DSTENCILCAPS_ZERO; if (gl_info->supported[EXT_STENCIL_WRAP]) { - pCaps->StencilCaps |= WINED3DSTENCILCAPS_DECR | + caps->StencilCaps |= WINED3DSTENCILCAPS_DECR | WINED3DSTENCILCAPS_INCR; } if (gl_info->supported[EXT_STENCIL_TWO_SIDE] || gl_info->supported[ATI_SEPARATE_STENCIL]) { - pCaps->StencilCaps |= WINED3DSTENCILCAPS_TWOSIDED; + caps->StencilCaps |= WINED3DSTENCILCAPS_TWOSIDED; } - pCaps->FVFCaps = WINED3DFVFCAPS_PSIZE | 0x0008; /* 8 texture coords */ + caps->FVFCaps = WINED3DFVFCAPS_PSIZE | 0x0008; /* 8 texture coords */ - pCaps->MaxUserClipPlanes = gl_info->limits.clipplanes; - pCaps->MaxActiveLights = gl_info->limits.lights; + caps->MaxUserClipPlanes = gl_info->limits.clipplanes; + caps->MaxActiveLights = gl_info->limits.lights; - pCaps->MaxVertexBlendMatrices = gl_info->limits.blends; - pCaps->MaxVertexBlendMatrixIndex = 0; + caps->MaxVertexBlendMatrices = gl_info->limits.blends; + caps->MaxVertexBlendMatrixIndex = 0; - pCaps->MaxAnisotropy = gl_info->limits.anisotropy; - pCaps->MaxPointSize = gl_info->limits.pointsize_max; + caps->MaxAnisotropy = gl_info->limits.anisotropy; + caps->MaxPointSize = gl_info->limits.pointsize_max; /* FIXME: Add D3DVTXPCAPS_TWEENING, D3DVTXPCAPS_TEXGEN_SPHEREMAP */ - pCaps->VertexProcessingCaps = WINED3DVTXPCAPS_DIRECTIONALLIGHTS | + caps->VertexProcessingCaps = WINED3DVTXPCAPS_DIRECTIONALLIGHTS | WINED3DVTXPCAPS_MATERIALSOURCE7 | WINED3DVTXPCAPS_POSITIONALLIGHTS | WINED3DVTXPCAPS_LOCALVIEWER | WINED3DVTXPCAPS_VERTEXFOG | WINED3DVTXPCAPS_TEXGEN; - pCaps->MaxPrimitiveCount = 0xFFFFF; /* For now set 2^20-1 which is used by most >=Geforce3/Radeon8500 cards */ - pCaps->MaxVertexIndex = 0xFFFFF; - pCaps->MaxStreams = MAX_STREAMS; - pCaps->MaxStreamStride = 1024; + caps->MaxPrimitiveCount = 0xFFFFF; /* For now set 2^20-1 which is used by most >=Geforce3/Radeon8500 cards */ + caps->MaxVertexIndex = 0xFFFFF; + caps->MaxStreams = MAX_STREAMS; + caps->MaxStreamStride = 1024; /* d3d9.dll sets D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES here because StretchRects is implemented in d3d9 */ - pCaps->DevCaps2 = WINED3DDEVCAPS2_STREAMOFFSET | - WINED3DDEVCAPS2_VERTEXELEMENTSCANSHARESTREAMOFFSET; - pCaps->MaxNpatchTessellationLevel = 0; - pCaps->MasterAdapterOrdinal = 0; - pCaps->AdapterOrdinalInGroup = 0; - pCaps->NumberOfAdaptersInGroup = 1; + caps->DevCaps2 = WINED3DDEVCAPS2_STREAMOFFSET | + WINED3DDEVCAPS2_VERTEXELEMENTSCANSHARESTREAMOFFSET; + caps->MaxNpatchTessellationLevel = 0; + caps->MasterAdapterOrdinal = 0; + caps->AdapterOrdinalInGroup = 0; + caps->NumberOfAdaptersInGroup = 1; - pCaps->NumSimultaneousRTs = gl_info->limits.buffers; + caps->NumSimultaneousRTs = gl_info->limits.buffers; - pCaps->StretchRectFilterCaps = WINED3DPTFILTERCAPS_MINFPOINT | + caps->StretchRectFilterCaps = WINED3DPTFILTERCAPS_MINFPOINT | WINED3DPTFILTERCAPS_MAGFPOINT | WINED3DPTFILTERCAPS_MINFLINEAR | WINED3DPTFILTERCAPS_MAGFLINEAR; - pCaps->VertexTextureFilterCaps = 0; + caps->VertexTextureFilterCaps = 0; adapter->shader_backend->shader_get_caps(&adapter->gl_info, &shader_caps); adapter->fragment_pipe->get_caps(&adapter->gl_info, &fragment_caps); /* Add shader misc caps. Only some of them belong to the shader parts of the pipeline */ - pCaps->PrimitiveMiscCaps |= fragment_caps.PrimitiveMiscCaps; + caps->PrimitiveMiscCaps |= fragment_caps.PrimitiveMiscCaps; /* This takes care for disabling vertex shader or pixel shader caps while leaving the other one enabled. * Ignore shader model capabilities if disabled in config */ - if(vs_selected_mode == SHADER_NONE) { + if (vs_selected_mode == SHADER_NONE) + { TRACE_(d3d_caps)("Vertex shader disabled in config, reporting version 0.0\n"); - pCaps->VertexShaderVersion = WINED3DVS_VERSION(0,0); - pCaps->MaxVertexShaderConst = 0; - } else { - pCaps->VertexShaderVersion = shader_caps.VertexShaderVersion; - pCaps->MaxVertexShaderConst = shader_caps.MaxVertexShaderConst; + caps->VertexShaderVersion = WINED3DVS_VERSION(0,0); + caps->MaxVertexShaderConst = 0; + } + else + { + caps->VertexShaderVersion = shader_caps.VertexShaderVersion; + caps->MaxVertexShaderConst = shader_caps.MaxVertexShaderConst; } - if(ps_selected_mode == SHADER_NONE) { + if (ps_selected_mode == SHADER_NONE) + { TRACE_(d3d_caps)("Pixel shader disabled in config, reporting version 0.0\n"); - pCaps->PixelShaderVersion = WINED3DPS_VERSION(0,0); - pCaps->PixelShader1xMaxValue = 0.0f; + caps->PixelShaderVersion = WINED3DPS_VERSION(0,0); + caps->PixelShader1xMaxValue = 0.0f; } else { - pCaps->PixelShaderVersion = shader_caps.PixelShaderVersion; - pCaps->PixelShader1xMaxValue = shader_caps.PixelShader1xMaxValue; + caps->PixelShaderVersion = shader_caps.PixelShaderVersion; + caps->PixelShader1xMaxValue = shader_caps.PixelShader1xMaxValue; } - pCaps->TextureOpCaps = fragment_caps.TextureOpCaps; - pCaps->MaxTextureBlendStages = fragment_caps.MaxTextureBlendStages; - pCaps->MaxSimultaneousTextures = fragment_caps.MaxSimultaneousTextures; + caps->TextureOpCaps = fragment_caps.TextureOpCaps; + caps->MaxTextureBlendStages = fragment_caps.MaxTextureBlendStages; + caps->MaxSimultaneousTextures = fragment_caps.MaxSimultaneousTextures; /* The following caps are shader specific, but they are things we cannot detect, or which * are the same among all shader models. So to avoid code duplication set the shader version * specific, but otherwise constant caps here */ - if(pCaps->VertexShaderVersion == WINED3DVS_VERSION(3,0)) { - /* Where possible set the caps based on OpenGL extensions and if they aren't set (in case of software rendering) - use the VS 3.0 from MSDN or else if there's OpenGL spec use a hardcoded value minimum VS3.0 value. */ - pCaps->VS20Caps.Caps = WINED3DVS20CAPS_PREDICATION; - pCaps->VS20Caps.DynamicFlowControlDepth = WINED3DVS20_MAX_DYNAMICFLOWCONTROLDEPTH; /* VS 3.0 requires MAX_DYNAMICFLOWCONTROLDEPTH (24) */ - pCaps->VS20Caps.NumTemps = max(32, adapter->gl_info.limits.arb_vs_temps); - pCaps->VS20Caps.StaticFlowControlDepth = WINED3DVS20_MAX_STATICFLOWCONTROLDEPTH ; /* level of nesting in loops / if-statements; VS 3.0 requires MAX (4) */ - - pCaps->MaxVShaderInstructionsExecuted = 65535; /* VS 3.0 needs at least 65535, some cards even use 2^32-1 */ - pCaps->MaxVertexShader30InstructionSlots = max(512, adapter->gl_info.limits.arb_vs_instructions); - } - else if (pCaps->VertexShaderVersion == WINED3DVS_VERSION(2,0)) + if (caps->VertexShaderVersion == WINED3DVS_VERSION(3,0)) { - pCaps->VS20Caps.Caps = 0; - pCaps->VS20Caps.DynamicFlowControlDepth = WINED3DVS20_MIN_DYNAMICFLOWCONTROLDEPTH; - pCaps->VS20Caps.NumTemps = max(12, adapter->gl_info.limits.arb_vs_temps); - pCaps->VS20Caps.StaticFlowControlDepth = 1; + /* Where possible set the caps based on OpenGL extensions and if they + * aren't set (in case of software rendering) use the VS 3.0 from + * MSDN or else if there's OpenGL spec use a hardcoded value minimum + * VS3.0 value. */ + caps->VS20Caps.Caps = WINED3DVS20CAPS_PREDICATION; + /* VS 3.0 requires MAX_DYNAMICFLOWCONTROLDEPTH (24) */ + caps->VS20Caps.DynamicFlowControlDepth = WINED3DVS20_MAX_DYNAMICFLOWCONTROLDEPTH; + caps->VS20Caps.NumTemps = max(32, adapter->gl_info.limits.arb_vs_temps); + /* level of nesting in loops / if-statements; VS 3.0 requires MAX (4) */ + caps->VS20Caps.StaticFlowControlDepth = WINED3DVS20_MAX_STATICFLOWCONTROLDEPTH; - pCaps->MaxVShaderInstructionsExecuted = 65535; - pCaps->MaxVertexShader30InstructionSlots = 0; - } else { /* VS 1.x */ - pCaps->VS20Caps.Caps = 0; - pCaps->VS20Caps.DynamicFlowControlDepth = 0; - pCaps->VS20Caps.NumTemps = 0; - pCaps->VS20Caps.StaticFlowControlDepth = 0; + caps->MaxVShaderInstructionsExecuted = 65535; /* VS 3.0 needs at least 65535, some cards even use 2^32-1 */ + caps->MaxVertexShader30InstructionSlots = max(512, adapter->gl_info.limits.arb_vs_instructions); + } + else if (caps->VertexShaderVersion == WINED3DVS_VERSION(2,0)) + { + caps->VS20Caps.Caps = 0; + caps->VS20Caps.DynamicFlowControlDepth = WINED3DVS20_MIN_DYNAMICFLOWCONTROLDEPTH; + caps->VS20Caps.NumTemps = max(12, adapter->gl_info.limits.arb_vs_temps); + caps->VS20Caps.StaticFlowControlDepth = 1; - pCaps->MaxVShaderInstructionsExecuted = 0; - pCaps->MaxVertexShader30InstructionSlots = 0; + caps->MaxVShaderInstructionsExecuted = 65535; + caps->MaxVertexShader30InstructionSlots = 0; + } + else + { /* VS 1.x */ + caps->VS20Caps.Caps = 0; + caps->VS20Caps.DynamicFlowControlDepth = 0; + caps->VS20Caps.NumTemps = 0; + caps->VS20Caps.StaticFlowControlDepth = 0; + + caps->MaxVShaderInstructionsExecuted = 0; + caps->MaxVertexShader30InstructionSlots = 0; } - if(pCaps->PixelShaderVersion == WINED3DPS_VERSION(3,0)) { - /* Where possible set the caps based on OpenGL extensions and if they aren't set (in case of software rendering) - use the PS 3.0 from MSDN or else if there's OpenGL spec use a hardcoded value minimum PS 3.0 value. */ + if (caps->PixelShaderVersion == WINED3DPS_VERSION(3,0)) + { + /* Where possible set the caps based on OpenGL extensions and if they + * aren't set (in case of software rendering) use the PS 3.0 from + * MSDN or else if there's OpenGL spec use a hardcoded value minimum + * PS 3.0 value. */ - /* Caps is more or less undocumented on MSDN but it appears to be used for PS20Caps based on results from R9600/FX5900/Geforce6800 cards from Windows */ - pCaps->PS20Caps.Caps = WINED3DPS20CAPS_ARBITRARYSWIZZLE | + /* Caps is more or less undocumented on MSDN but it appears to be + * used for PS20Caps based on results from R9600/FX5900/Geforce6800 + * cards from Windows */ + caps->PS20Caps.Caps = WINED3DPS20CAPS_ARBITRARYSWIZZLE | WINED3DPS20CAPS_GRADIENTINSTRUCTIONS | WINED3DPS20CAPS_PREDICATION | WINED3DPS20CAPS_NODEPENDENTREADLIMIT | WINED3DPS20CAPS_NOTEXINSTRUCTIONLIMIT; - pCaps->PS20Caps.DynamicFlowControlDepth = WINED3DPS20_MAX_DYNAMICFLOWCONTROLDEPTH; /* PS 3.0 requires MAX_DYNAMICFLOWCONTROLDEPTH (24) */ - pCaps->PS20Caps.NumTemps = max(32, adapter->gl_info.limits.arb_ps_temps); - pCaps->PS20Caps.StaticFlowControlDepth = WINED3DPS20_MAX_STATICFLOWCONTROLDEPTH; /* PS 3.0 requires MAX_STATICFLOWCONTROLDEPTH (4) */ - pCaps->PS20Caps.NumInstructionSlots = WINED3DPS20_MAX_NUMINSTRUCTIONSLOTS; /* PS 3.0 requires MAX_NUMINSTRUCTIONSLOTS (512) */ + /* PS 3.0 requires MAX_DYNAMICFLOWCONTROLDEPTH (24) */ + caps->PS20Caps.DynamicFlowControlDepth = WINED3DPS20_MAX_DYNAMICFLOWCONTROLDEPTH; + caps->PS20Caps.NumTemps = max(32, adapter->gl_info.limits.arb_ps_temps); + /* PS 3.0 requires MAX_STATICFLOWCONTROLDEPTH (4) */ + caps->PS20Caps.StaticFlowControlDepth = WINED3DPS20_MAX_STATICFLOWCONTROLDEPTH; + /* PS 3.0 requires MAX_NUMINSTRUCTIONSLOTS (512) */ + caps->PS20Caps.NumInstructionSlots = WINED3DPS20_MAX_NUMINSTRUCTIONSLOTS; - pCaps->MaxPShaderInstructionsExecuted = 65535; - pCaps->MaxPixelShader30InstructionSlots = max(WINED3DMIN30SHADERINSTRUCTIONS, + caps->MaxPShaderInstructionsExecuted = 65535; + caps->MaxPixelShader30InstructionSlots = max(WINED3DMIN30SHADERINSTRUCTIONS, adapter->gl_info.limits.arb_ps_instructions); } - else if(pCaps->PixelShaderVersion == WINED3DPS_VERSION(2,0)) + else if(caps->PixelShaderVersion == WINED3DPS_VERSION(2,0)) { /* Below we assume PS2.0 specs, not extended 2.0a(GeforceFX)/2.0b(Radeon R3xx) ones */ - pCaps->PS20Caps.Caps = 0; - pCaps->PS20Caps.DynamicFlowControlDepth = 0; /* WINED3DVS20_MIN_DYNAMICFLOWCONTROLDEPTH = 0 */ - pCaps->PS20Caps.NumTemps = max(12, adapter->gl_info.limits.arb_ps_temps); - pCaps->PS20Caps.StaticFlowControlDepth = WINED3DPS20_MIN_STATICFLOWCONTROLDEPTH; /* Minimum: 1 */ - pCaps->PS20Caps.NumInstructionSlots = WINED3DPS20_MIN_NUMINSTRUCTIONSLOTS; /* Minimum number (64 ALU + 32 Texture), a GeforceFX uses 512 */ + caps->PS20Caps.Caps = 0; + caps->PS20Caps.DynamicFlowControlDepth = 0; /* WINED3DVS20_MIN_DYNAMICFLOWCONTROLDEPTH = 0 */ + caps->PS20Caps.NumTemps = max(12, adapter->gl_info.limits.arb_ps_temps); + caps->PS20Caps.StaticFlowControlDepth = WINED3DPS20_MIN_STATICFLOWCONTROLDEPTH; /* Minimum: 1 */ + /* Minimum number (64 ALU + 32 Texture), a GeforceFX uses 512 */ + caps->PS20Caps.NumInstructionSlots = WINED3DPS20_MIN_NUMINSTRUCTIONSLOTS; - pCaps->MaxPShaderInstructionsExecuted = 512; /* Minimum value, a GeforceFX uses 1024 */ - pCaps->MaxPixelShader30InstructionSlots = 0; - } else { /* PS 1.x */ - pCaps->PS20Caps.Caps = 0; - pCaps->PS20Caps.DynamicFlowControlDepth = 0; - pCaps->PS20Caps.NumTemps = 0; - pCaps->PS20Caps.StaticFlowControlDepth = 0; - pCaps->PS20Caps.NumInstructionSlots = 0; + caps->MaxPShaderInstructionsExecuted = 512; /* Minimum value, a GeforceFX uses 1024 */ + caps->MaxPixelShader30InstructionSlots = 0; + } + else /* PS 1.x */ + { + caps->PS20Caps.Caps = 0; + caps->PS20Caps.DynamicFlowControlDepth = 0; + caps->PS20Caps.NumTemps = 0; + caps->PS20Caps.StaticFlowControlDepth = 0; + caps->PS20Caps.NumInstructionSlots = 0; - pCaps->MaxPShaderInstructionsExecuted = 0; - pCaps->MaxPixelShader30InstructionSlots = 0; + caps->MaxPShaderInstructionsExecuted = 0; + caps->MaxPixelShader30InstructionSlots = 0; } - if(pCaps->VertexShaderVersion >= WINED3DVS_VERSION(2,0)) { + if (caps->VertexShaderVersion >= WINED3DVS_VERSION(2,0)) + { /* OpenGL supports all the formats below, perhaps not always * without conversion, but it supports them. * Further GLSL doesn't seem to have an official unsigned type so @@ -4817,17 +4759,20 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, * We might need to add some clamping in the shader engine to * support it. * TODO: WINED3DDTCAPS_USHORT2N, WINED3DDTCAPS_USHORT4N, WINED3DDTCAPS_UDEC3, WINED3DDTCAPS_DEC3N */ - pCaps->DeclTypes = WINED3DDTCAPS_UBYTE4 | - WINED3DDTCAPS_UBYTE4N | - WINED3DDTCAPS_SHORT2N | - WINED3DDTCAPS_SHORT4N; + caps->DeclTypes = WINED3DDTCAPS_UBYTE4 | + WINED3DDTCAPS_UBYTE4N | + WINED3DDTCAPS_SHORT2N | + WINED3DDTCAPS_SHORT4N; if (gl_info->supported[ARB_HALF_FLOAT_VERTEX]) { - pCaps->DeclTypes |= WINED3DDTCAPS_FLOAT16_2 | - WINED3DDTCAPS_FLOAT16_4; + caps->DeclTypes |= WINED3DDTCAPS_FLOAT16_2 | + WINED3DDTCAPS_FLOAT16_4; } - } else - pCaps->DeclTypes = 0; + } + else + { + caps->DeclTypes = 0; + } /* Set DirectDraw helper Caps */ ckey_caps = WINEDDCKEYCAPS_DESTBLT | @@ -4858,28 +4803,28 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, WINEDDPCAPS_PRIMARYSURFACE; /* Fill the ddraw caps structure */ - pCaps->DirectDrawCaps.Caps = WINEDDCAPS_GDI | + caps->DirectDrawCaps.Caps = WINEDDCAPS_GDI | WINEDDCAPS_PALETTE | blit_caps; - pCaps->DirectDrawCaps.Caps2 = WINEDDCAPS2_CERTIFIED | + caps->DirectDrawCaps.Caps2 = WINEDDCAPS2_CERTIFIED | WINEDDCAPS2_NOPAGELOCKREQUIRED | WINEDDCAPS2_PRIMARYGAMMA | WINEDDCAPS2_WIDESURFACES | WINEDDCAPS2_CANRENDERWINDOWED; - pCaps->DirectDrawCaps.CKeyCaps = ckey_caps; - pCaps->DirectDrawCaps.FXCaps = fx_caps; - pCaps->DirectDrawCaps.PalCaps = pal_caps; - pCaps->DirectDrawCaps.SVBCaps = blit_caps; - pCaps->DirectDrawCaps.SVBCKeyCaps = ckey_caps; - pCaps->DirectDrawCaps.SVBFXCaps = fx_caps; - pCaps->DirectDrawCaps.VSBCaps = blit_caps; - pCaps->DirectDrawCaps.VSBCKeyCaps = ckey_caps; - pCaps->DirectDrawCaps.VSBFXCaps = fx_caps; - pCaps->DirectDrawCaps.SSBCaps = blit_caps; - pCaps->DirectDrawCaps.SSBCKeyCaps = ckey_caps; - pCaps->DirectDrawCaps.SSBFXCaps = fx_caps; + caps->DirectDrawCaps.CKeyCaps = ckey_caps; + caps->DirectDrawCaps.FXCaps = fx_caps; + caps->DirectDrawCaps.PalCaps = pal_caps; + caps->DirectDrawCaps.SVBCaps = blit_caps; + caps->DirectDrawCaps.SVBCKeyCaps = ckey_caps; + caps->DirectDrawCaps.SVBFXCaps = fx_caps; + caps->DirectDrawCaps.VSBCaps = blit_caps; + caps->DirectDrawCaps.VSBCKeyCaps = ckey_caps; + caps->DirectDrawCaps.VSBFXCaps = fx_caps; + caps->DirectDrawCaps.SSBCaps = blit_caps; + caps->DirectDrawCaps.SSBCKeyCaps = ckey_caps; + caps->DirectDrawCaps.SSBFXCaps = fx_caps; - pCaps->DirectDrawCaps.ddsCaps = WINEDDSCAPS_ALPHA | + caps->DirectDrawCaps.ddsCaps = WINEDDSCAPS_ALPHA | WINEDDSCAPS_BACKBUFFER | WINEDDSCAPS_FLIP | WINEDDSCAPS_FRONTBUFFER | @@ -4889,37 +4834,34 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, WINEDDSCAPS_SYSTEMMEMORY | WINEDDSCAPS_VIDEOMEMORY | WINEDDSCAPS_VISIBLE; - pCaps->DirectDrawCaps.StrideAlign = DDRAW_PITCH_ALIGNMENT; + caps->DirectDrawCaps.StrideAlign = DDRAW_PITCH_ALIGNMENT; /* Set D3D caps if OpenGL is available. */ if (adapter->opengl) { - pCaps->DirectDrawCaps.ddsCaps |=WINEDDSCAPS_3DDEVICE | + caps->DirectDrawCaps.ddsCaps |= WINEDDSCAPS_3DDEVICE | WINEDDSCAPS_MIPMAP | WINEDDSCAPS_TEXTURE | WINEDDSCAPS_ZBUFFER; - pCaps->DirectDrawCaps.Caps |= WINEDDCAPS_3D; + caps->DirectDrawCaps.Caps |= WINEDDCAPS_3D; } return WINED3D_OK; } -static HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT adapter_idx, WINED3DDEVTYPE device_type, - HWND focus_window, DWORD flags, IWineD3DDeviceParent *device_parent, IWineD3DDevice **device) +HRESULT CDECL wined3d_device_create(struct wined3d *wined3d, UINT adapter_idx, WINED3DDEVTYPE device_type, + HWND focus_window, DWORD flags, struct wined3d_device_parent *device_parent, struct wined3d_device **device) { - IWineD3DImpl *This = (IWineD3DImpl *)iface; - IWineD3DDeviceImpl *object; + struct wined3d_device *object; HRESULT hr; - TRACE("iface %p, adapter_idx %u, device_type %#x, focus_window %p, flags %#x, device_parent %p, device %p.\n", - iface, adapter_idx, device_type, focus_window, flags, device_parent, device); + TRACE("wined3d %p, adapter_idx %u, device_type %#x, focus_window %p, flags %#x, device_parent %p, device %p.\n", + wined3d, adapter_idx, device_type, focus_window, flags, device_parent, device); /* Validate the adapter number. If no adapters are available(no GL), ignore the adapter * number and create a device without a 3D adapter for 2D only operation. */ - if (IWineD3D_GetAdapterCount(iface) && adapter_idx >= IWineD3D_GetAdapterCount(iface)) - { + if (wined3d->adapter_count && adapter_idx >= wined3d->adapter_count) return WINED3DERR_INVALIDCALL; - } object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if (!object) @@ -4928,7 +4870,7 @@ static HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT adapter_id return E_OUTOFMEMORY; } - hr = device_init(object, This, adapter_idx, device_type, focus_window, flags, device_parent); + hr = device_init(object, wined3d, adapter_idx, device_type, focus_window, flags, device_parent); if (FAILED(hr)) { WARN("Failed to initialize device, hr %#x.\n", hr); @@ -4937,18 +4879,18 @@ static HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT adapter_id } TRACE("Created device %p.\n", object); - *device = (IWineD3DDevice *)object; + *device = object; - IWineD3DDeviceParent_WineD3DDeviceCreated(device_parent, *device); + device_parent->ops->wined3d_device_created(device_parent, *device); return WINED3D_OK; } -static void * WINAPI IWineD3DImpl_GetParent(IWineD3D *iface) +void * CDECL wined3d_get_parent(const struct wined3d *wined3d) { - TRACE("iface %p.\n", iface); + TRACE("wined3d %p.\n", wined3d); - return ((IWineD3DImpl *)iface)->parent; + return wined3d->parent; } static void WINE_GLAPI invalid_func(const void *data) @@ -5138,7 +5080,7 @@ static void fillGLAttribFuncs(const struct wined3d_gl_info *gl_info) } /* Do not call while under the GL lock. */ -static BOOL InitAdapters(IWineD3DImpl *This) +static BOOL InitAdapters(struct wined3d *wined3d) { static HMODULE mod_gl; BOOL ret; @@ -5195,13 +5137,13 @@ static BOOL InitAdapters(IWineD3DImpl *This) /* For now only one default adapter */ { - struct wined3d_adapter *adapter = &This->adapters[0]; + struct wined3d_adapter *adapter = &wined3d->adapters[0]; const struct wined3d_gl_info *gl_info = &adapter->gl_info; struct wined3d_fake_gl_ctx fake_gl_ctx = {0}; + struct wined3d_pixel_format *cfgs; int iPixelFormat; int res; int i; - WineD3D_PixelFormat *cfgs; DISPLAY_DEVICEW DisplayDevice; HDC hdc; @@ -5260,7 +5202,7 @@ static BOOL InitAdapters(IWineD3DImpl *This) attribute = WGL_NUMBER_PIXEL_FORMATS_ARB; GL_EXTCALL(wglGetPixelFormatAttribivARB(hdc, 0, 0, 1, &attribute, &adapter->nCfgs)); - adapter->cfgs = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, adapter->nCfgs *sizeof(WineD3D_PixelFormat)); + adapter->cfgs = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, adapter->nCfgs * sizeof(*adapter->cfgs)); cfgs = adapter->cfgs; attribs[nAttribs++] = WGL_RED_BITS_ARB; attribs[nAttribs++] = WGL_GREEN_BITS_ARB; @@ -5320,7 +5262,7 @@ static BOOL InitAdapters(IWineD3DImpl *This) else { int nCfgs = DescribePixelFormat(hdc, 0, 0, 0); - adapter->cfgs = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, nCfgs*sizeof(WineD3D_PixelFormat)); + adapter->cfgs = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, nCfgs * sizeof(*adapter->cfgs)); adapter->nCfgs = 0; /* We won't accept all formats e.g. software accelerated ones will be skipped */ cfgs = adapter->cfgs; @@ -5401,61 +5343,32 @@ static BOOL InitAdapters(IWineD3DImpl *This) fillGLAttribFuncs(&adapter->gl_info); adapter->opengl = TRUE; } - This->adapter_count = 1; - TRACE("%u adapters successfully initialized\n", This->adapter_count); + wined3d->adapter_count = 1; + TRACE("%u adapters successfully initialized.\n", wined3d->adapter_count); return TRUE; nogl_adapter: /* Initialize an adapter for ddraw-only memory counting */ - memset(This->adapters, 0, sizeof(This->adapters)); - This->adapters[0].ordinal = 0; - This->adapters[0].opengl = FALSE; - This->adapters[0].monitorPoint.x = -1; - This->adapters[0].monitorPoint.y = -1; + memset(wined3d->adapters, 0, sizeof(wined3d->adapters)); + wined3d->adapters[0].ordinal = 0; + wined3d->adapters[0].opengl = FALSE; + wined3d->adapters[0].monitorPoint.x = -1; + wined3d->adapters[0].monitorPoint.y = -1; - This->adapters[0].driver_info.name = "Display"; - This->adapters[0].driver_info.description = "WineD3D DirectDraw Emulation"; - if(wined3d_settings.emulated_textureram) { - This->adapters[0].TextureRam = wined3d_settings.emulated_textureram; - } else { - This->adapters[0].TextureRam = 8 * 1024 * 1024; /* This is plenty for a DDraw-only card */ - } + wined3d->adapters[0].driver_info.name = "Display"; + wined3d->adapters[0].driver_info.description = "WineD3D DirectDraw Emulation"; + if (wined3d_settings.emulated_textureram) + wined3d->adapters[0].TextureRam = wined3d_settings.emulated_textureram; + else + wined3d->adapters[0].TextureRam = 8 * 1024 * 1024; /* This is plenty for a DDraw-only card */ - initPixelFormatsNoGL(&This->adapters[0].gl_info); + initPixelFormatsNoGL(&wined3d->adapters[0].gl_info); - This->adapter_count = 1; + wined3d->adapter_count = 1; return FALSE; } -/********************************************************** - * IWineD3D VTbl follows - **********************************************************/ - -static const struct IWineD3DVtbl IWineD3D_Vtbl = -{ - /* IUnknown */ - IWineD3DImpl_QueryInterface, - IWineD3DImpl_AddRef, - IWineD3DImpl_Release, - /* IWineD3D */ - IWineD3DImpl_GetParent, - IWineD3DImpl_GetAdapterCount, - IWineD3DImpl_RegisterSoftwareDevice, - IWineD3DImpl_GetAdapterMonitor, - IWineD3DImpl_GetAdapterModeCount, - IWineD3DImpl_EnumAdapterModes, - IWineD3DImpl_GetAdapterDisplayMode, - IWineD3DImpl_GetAdapterIdentifier, - IWineD3DImpl_CheckDeviceMultiSampleType, - IWineD3DImpl_CheckDepthStencilMatch, - IWineD3DImpl_CheckDeviceType, - IWineD3DImpl_CheckDeviceFormat, - IWineD3DImpl_CheckDeviceFormatConversion, - IWineD3DImpl_GetDeviceCaps, - IWineD3DImpl_CreateDevice -}; - static void STDMETHODCALLTYPE wined3d_null_wined3d_object_destroyed(void *parent) {} const struct wined3d_parent_ops wined3d_null_parent_ops = @@ -5464,9 +5377,8 @@ const struct wined3d_parent_ops wined3d_null_parent_ops = }; /* Do not call while under the GL lock. */ -HRESULT wined3d_init(IWineD3DImpl *wined3d, UINT version, void *parent) +HRESULT wined3d_init(struct wined3d *wined3d, UINT version, void *parent) { - wined3d->lpVtbl = &IWineD3D_Vtbl; wined3d->dxVersion = version; wined3d->ref = 1; wined3d->parent = parent; diff --git a/dll/directx/wine/wined3d/drawprim.c b/dll/directx/wine/wined3d/drawprim.c index 6b6102bc330..4dbba92710b 100644 --- a/dll/directx/wine/wined3d/drawprim.c +++ b/dll/directx/wine/wined3d/drawprim.c @@ -55,7 +55,7 @@ static void drawStridedFast(GLenum primitive_type, UINT count, UINT idx_size, co */ /* GL locking is done by the caller */ -static void drawStridedSlow(IWineD3DDevice *iface, const struct wined3d_context *context, +static void drawStridedSlow(struct wined3d_device *device, const struct wined3d_context *context, const struct wined3d_stream_info *si, UINT NumVertexes, GLenum glPrimType, const void *idxData, UINT idxSize, UINT startIdx) { @@ -63,8 +63,7 @@ static void drawStridedSlow(IWineD3DDevice *iface, const struct wined3d_context const WORD *pIdxBufS = NULL; const DWORD *pIdxBufL = NULL; UINT vx_index; - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - const struct wined3d_state *state = &This->stateBlock->state; + const struct wined3d_state *state = &device->stateBlock->state; const struct wined3d_stream_state *streams = state->streams; LONG SkipnStrides = startIdx + state->load_base_vertex_index; BOOL pixelShader = use_ps(state); @@ -166,7 +165,7 @@ static void drawStridedSlow(IWineD3DDevice *iface, const struct wined3d_context for (textureNo = 0; textureNo < texture_stages; ++textureNo) { int coordIdx = state->texture_states[textureNo][WINED3DTSS_TEXCOORDINDEX]; - DWORD texture_idx = This->texUnitMap[textureNo]; + DWORD texture_idx = device->texUnitMap[textureNo]; if (!gl_info->supported[ARB_MULTITEXTURE] && textureNo > 0) { @@ -238,7 +237,7 @@ static void drawStridedSlow(IWineD3DDevice *iface, const struct wined3d_context coord_idx = state->texture_states[texture][WINED3DTSS_TEXCOORDINDEX]; ptr = texCoords[coord_idx] + (SkipnStrides * si->elements[WINED3D_FFP_TEXCOORD0 + coord_idx].stride); - texture_idx = This->texUnitMap[texture]; + texture_idx = device->texUnitMap[texture]; multi_texcoord_funcs[si->elements[WINED3D_FFP_TEXCOORD0 + coord_idx].format->emit_idx]( GL_TEXTURE0_ARB + texture_idx, ptr); } @@ -275,7 +274,7 @@ static void drawStridedSlow(IWineD3DDevice *iface, const struct wined3d_context if (specular_fog) { DWORD specularColor = *(const DWORD *)ptrToCoords; - GL_EXTCALL(glFogCoordfEXT(specularColor >> 24)); + GL_EXTCALL(glFogCoordfEXT((float) (specularColor >> 24))); } } @@ -559,11 +558,9 @@ static void remove_vbos(const struct wined3d_gl_info *gl_info, } /* Routine common to the draw primitive and draw indexed primitive routines */ -void drawPrimitive(IWineD3DDevice *iface, UINT index_count, UINT StartIdx, UINT idxSize, const void *idxData) +void drawPrimitive(struct wined3d_device *device, UINT index_count, UINT StartIdx, UINT idxSize, const void *idxData) { - - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - const struct wined3d_state *state = &This->stateBlock->state; + const struct wined3d_state *state = &device->stateBlock->state; struct wined3d_context *context; unsigned int i; @@ -572,9 +569,9 @@ void drawPrimitive(IWineD3DDevice *iface, UINT index_count, UINT StartIdx, UINT if (state->render_states[WINED3DRS_COLORWRITEENABLE]) { /* Invalidate the back buffer memory so LockRect will read it the next time */ - for (i = 0; i < This->adapter->gl_info.limits.buffers; ++i) + for (i = 0; i < device->adapter->gl_info.limits.buffers; ++i) { - IWineD3DSurfaceImpl *target = This->render_targets[i]; + struct wined3d_surface *target = device->fb.render_targets[i]; if (target) { surface_load_location(target, SFLAG_INDRAWABLE, NULL); @@ -584,9 +581,9 @@ void drawPrimitive(IWineD3DDevice *iface, UINT index_count, UINT StartIdx, UINT } /* Signals other modules that a drawing is in progress and the stateblock finalized */ - This->isInDraw = TRUE; + device->isInDraw = TRUE; - context = context_acquire(This, This->render_targets[0]); + context = context_acquire(device, device->fb.render_targets[0]); if (!context->valid) { context_release(context); @@ -594,42 +591,44 @@ void drawPrimitive(IWineD3DDevice *iface, UINT index_count, UINT StartIdx, UINT return; } - context_apply_draw_state(context, This); + if (!context_apply_draw_state(context, device)) + { + context_release(context); + WARN("Unable to apply draw state, skipping draw.\n"); + return; + } - if (This->depth_stencil) + if (device->fb.depth_stencil) { /* Note that this depends on the context_acquire() call above to set - * This->render_offscreen properly. We don't currently take the + * context->render_offscreen properly. We don't currently take the * Z-compare function into account, but we could skip loading the * depthstencil for D3DCMP_NEVER and D3DCMP_ALWAYS as well. Also note * that we never copy the stencil data.*/ DWORD location = context->render_offscreen ? SFLAG_DS_OFFSCREEN : SFLAG_DS_ONSCREEN; if (state->render_states[WINED3DRS_ZWRITEENABLE] || state->render_states[WINED3DRS_ZENABLE]) { + struct wined3d_surface *ds = device->fb.depth_stencil; RECT current_rect, draw_rect, r; - if (location == SFLAG_DS_ONSCREEN && This->depth_stencil != This->onscreen_depth_stencil) - device_switch_onscreen_ds(This, context, This->depth_stencil); + if (location == SFLAG_DS_ONSCREEN && ds != device->onscreen_depth_stencil) + device_switch_onscreen_ds(device, context, ds); - if (This->depth_stencil->Flags & location) - SetRect(¤t_rect, 0, 0, - This->depth_stencil->ds_current_size.cx, - This->depth_stencil->ds_current_size.cy); + if (ds->flags & location) + SetRect(¤t_rect, 0, 0, ds->ds_current_size.cx, ds->ds_current_size.cy); else SetRectEmpty(¤t_rect); - device_get_draw_rect(This, &draw_rect); + device_get_draw_rect(device, &draw_rect); IntersectRect(&r, &draw_rect, ¤t_rect); if (!EqualRect(&r, &draw_rect)) - surface_load_ds_location(This->depth_stencil, context, location); + surface_load_ds_location(ds, context, location); if (state->render_states[WINED3DRS_ZWRITEENABLE]) { - surface_modify_ds_location(This->depth_stencil, location, - This->depth_stencil->ds_current_size.cx, - This->depth_stencil->ds_current_size.cy); - surface_modify_location(This->depth_stencil, SFLAG_INDRAWABLE, TRUE); + surface_modify_ds_location(ds, location, ds->ds_current_size.cx, ds->ds_current_size.cy); + surface_modify_location(ds, SFLAG_INDRAWABLE, TRUE); } } } @@ -648,12 +647,12 @@ void drawPrimitive(IWineD3DDevice *iface, UINT index_count, UINT StartIdx, UINT { GLenum glPrimType = state->gl_primitive_type; BOOL emulation = FALSE; - const struct wined3d_stream_info *stream_info = &This->strided_streams; + const struct wined3d_stream_info *stream_info = &device->strided_streams; struct wined3d_stream_info stridedlcl; if (!use_vs(state)) { - if (!This->strided_streams.position_transformed && context->num_untracked_materials + if (!stream_info->position_transformed && context->num_untracked_materials && state->render_states[WINED3DRS_LIGHTING]) { static BOOL warned; @@ -682,12 +681,12 @@ void drawPrimitive(IWineD3DDevice *iface, UINT index_count, UINT StartIdx, UINT if(emulation) { stream_info = &stridedlcl; - memcpy(&stridedlcl, &This->strided_streams, sizeof(stridedlcl)); + memcpy(&stridedlcl, &device->strided_streams, sizeof(stridedlcl)); remove_vbos(context->gl_info, state, &stridedlcl); } } - if (This->useDrawStridedSlow || emulation) + if (device->useDrawStridedSlow || emulation) { /* Immediate mode drawing */ if (use_vs(state)) @@ -704,11 +703,11 @@ void drawPrimitive(IWineD3DDevice *iface, UINT index_count, UINT StartIdx, UINT } else { - drawStridedSlow(iface, context, stream_info, index_count, + drawStridedSlow(device, context, stream_info, index_count, glPrimType, idxData, idxSize, StartIdx); } } - else if (This->instancedDraw) + else if (device->instancedDraw) { /* Instancing emulation with mixing immediate mode and arrays */ drawStridedInstanced(context->gl_info, state, stream_info, @@ -723,9 +722,9 @@ void drawPrimitive(IWineD3DDevice *iface, UINT index_count, UINT StartIdx, UINT /* Finished updating the screen, restore lock */ LEAVE_GL(); - for(i = 0; i < This->num_buffer_queries; i++) + for(i = 0; i < device->num_buffer_queries; ++i) { - wined3d_event_query_issue(This->buffer_queries[i], This); + wined3d_event_query_issue(device->buffer_queries[i], device); } if (wined3d_settings.strict_draw_ordering) wglFlush(); /* Flush to ensure ordering across contexts. */ @@ -735,7 +734,7 @@ void drawPrimitive(IWineD3DDevice *iface, UINT index_count, UINT StartIdx, UINT TRACE("Done all gl drawing\n"); /* Control goes back to the device, stateblock values may change again */ - This->isInDraw = FALSE; + device->isInDraw = FALSE; } static void normalize_normal(float *n) { @@ -769,8 +768,8 @@ static void normalize_normal(float *n) { * responsible of taking care that either the gl states are restored, or the context activated * for drawing to reset the lastWasBlit flag. */ -HRESULT tesselate_rectpatch(IWineD3DDeviceImpl *This, - struct WineD3DRectPatch *patch) { +HRESULT tesselate_rectpatch(struct wined3d_device *This, struct WineD3DRectPatch *patch) +{ unsigned int i, j, num_quads, out_vertex_size, buffer_size, d3d_out_vertex_size; float max_x = 0.0f, max_y = 0.0f, max_z = 0.0f, neg_z = 0.0f; struct wined3d_stream_info stream_info; @@ -842,7 +841,7 @@ HRESULT tesselate_rectpatch(IWineD3DDeviceImpl *This, glMatrixMode(GL_PROJECTION); checkGLcall("glMatrixMode(GL_PROJECTION)"); glLoadIdentity(); - checkGLcall("glLoadIndentity()"); + checkGLcall("glLoadIdentity()"); glScalef(1.0f / (max_x), 1.0f / (max_y), max_z == 0.0f ? 1.0f : 1.0f / (2.0f * max_z)); glTranslatef(0.0f, 0.0f, 0.5f); checkGLcall("glScalef"); diff --git a/dll/directx/wine/wined3d/gl_compat.c b/dll/directx/wine/wined3d/gl_compat.c index 0f8eaba83d2..57564452f46 100644 --- a/dll/directx/wine/wined3d/gl_compat.c +++ b/dll/directx/wine/wined3d/gl_compat.c @@ -178,9 +178,9 @@ static void WINE_GLAPI wine_glFogi(GLenum pname, GLint param) { } } else { if(pname == GL_FOG_START) { - ctx->fogstart = param; + ctx->fogstart = (float) param; } else if(pname == GL_FOG_END) { - ctx->fogend = param; + ctx->fogend = (float) param; } old_fogcoord_glFogi(pname, param); } @@ -199,9 +199,9 @@ static void WINE_GLAPI wine_glFogiv(GLenum pname, const GLint *param) { } } else { if(pname == GL_FOG_START) { - ctx->fogstart = *param; + ctx->fogstart = (float) *param; } else if(pname == GL_FOG_END) { - ctx->fogend = *param; + ctx->fogend = (float) *param; } old_fogcoord_glFogiv(pname, param); } @@ -331,13 +331,13 @@ static void WINE_GLAPI wine_glFogCoordfEXT(GLfloat f) { ctx->fog_coord_value = f; } static void WINE_GLAPI wine_glFogCoorddEXT(GLdouble f) { - wine_glFogCoordfEXT(f); + wine_glFogCoordfEXT((GLfloat) f); } static void WINE_GLAPI wine_glFogCoordfvEXT(const GLfloat *f) { wine_glFogCoordfEXT(*f); } static void WINE_GLAPI wine_glFogCoorddvEXT(const GLdouble *f) { - wine_glFogCoordfEXT(*f); + wine_glFogCoordfEXT((GLfloat) *f); } /* End GL_EXT_fog_coord emulation */ diff --git a/dll/directx/wine/wined3d/glsl_shader.c b/dll/directx/wine/wined3d/glsl_shader.c index 0b5bb3671d3..9b8cd5b4007 100644 --- a/dll/directx/wine/wined3d/glsl_shader.c +++ b/dll/directx/wine/wined3d/glsl_shader.c @@ -4,7 +4,7 @@ * Copyright 2006 Jason Green * Copyright 2006-2007 Henri Verbeet * Copyright 2007-2008 Stefan Dösinger for CodeWeavers - * Copyright 2009 Henri Verbeet for CodeWeavers + * Copyright 2009-2011 Henri Verbeet for CodeWeavers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -109,20 +109,21 @@ struct glsl_shader_prog_link { GLint luminanceoffset_location[MAX_TEXTURES]; GLint ycorrection_location; GLenum vertex_color_clamp; - IWineD3DVertexShader *vshader; - IWineD3DPixelShader *pshader; + const struct wined3d_shader *vshader; + const struct wined3d_shader *pshader; struct vs_compile_args vs_args; struct ps_compile_args ps_args; UINT constant_version; const struct ps_np2fixup_info *np2Fixup_info; }; -typedef struct { - IWineD3DVertexShader *vshader; - IWineD3DPixelShader *pshader; +struct glsl_program_key +{ + const struct wined3d_shader *vshader; + const struct wined3d_shader *pshader; struct ps_compile_args ps_args; struct vs_compile_args vs_args; -} glsl_program_key_t; +}; struct shader_glsl_ctx_priv { const struct vs_compile_args *cur_vs_args; @@ -534,27 +535,27 @@ static inline void walk_constant_heap_clamped(const struct wined3d_gl_info *gl_i /* Loads floating point constants (aka uniforms) into the currently set GLSL program. */ /* GL locking is done by the caller */ -static void shader_glsl_load_constantsF(IWineD3DBaseShaderImpl *This, const struct wined3d_gl_info *gl_info, +static void shader_glsl_load_constantsF(const struct wined3d_shader *shader, const struct wined3d_gl_info *gl_info, const float *constants, const GLint *constant_locations, const struct constant_heap *heap, unsigned char *stack, UINT version) { const local_constant *lconst; /* 1.X pshaders have the constants clamped to [-1;1] implicitly. */ - if (This->baseShader.reg_maps.shader_version.major == 1 - && shader_is_pshader_version(This->baseShader.reg_maps.shader_version.type)) + if (shader->reg_maps.shader_version.major == 1 + && shader_is_pshader_version(shader->reg_maps.shader_version.type)) walk_constant_heap_clamped(gl_info, constants, constant_locations, heap, stack, version); else walk_constant_heap(gl_info, constants, constant_locations, heap, stack, version); - if (!This->baseShader.load_local_constsF) + if (!shader->load_local_constsF) { TRACE("No need to load local float constants for this shader\n"); return; } /* Immediate constants are clamped to [-1;1] at shader creation time if needed */ - LIST_FOR_EACH_ENTRY(lconst, &This->baseShader.constantsF, local_constant, entry) + LIST_FOR_EACH_ENTRY(lconst, &shader->constantsF, local_constant, entry) { GLint location = constant_locations[lconst->idx]; /* We found this uniform name in the program - go ahead and send the data */ @@ -565,7 +566,7 @@ static void shader_glsl_load_constantsF(IWineD3DBaseShaderImpl *This, const stru /* Loads integer constants (aka uniforms) into the currently set GLSL program. */ /* GL locking is done by the caller */ -static void shader_glsl_load_constantsI(IWineD3DBaseShaderImpl *This, const struct wined3d_gl_info *gl_info, +static void shader_glsl_load_constantsI(const struct wined3d_shader *shader, const struct wined3d_gl_info *gl_info, const GLint locations[MAX_CONST_I], const int *constants, WORD constants_set) { unsigned int i; @@ -584,8 +585,9 @@ static void shader_glsl_load_constantsI(IWineD3DBaseShaderImpl *This, const stru } /* Load immediate constants */ - ptr = list_head(&This->baseShader.constantsI); - while (ptr) { + ptr = list_head(&shader->constantsI); + while (ptr) + { const struct local_constant *lconst = LIST_ENTRY(ptr, const struct local_constant, entry); unsigned int idx = lconst->idx; const GLint *values = (const GLint *)lconst->value; @@ -596,13 +598,13 @@ static void shader_glsl_load_constantsI(IWineD3DBaseShaderImpl *This, const stru /* We found this uniform name in the program - go ahead and send the data */ GL_EXTCALL(glUniform4ivARB(locations[idx], 1, values)); checkGLcall("glUniform4ivARB"); - ptr = list_next(&This->baseShader.constantsI, ptr); + ptr = list_next(&shader->constantsI, ptr); } } /* Loads boolean constants (aka uniforms) into the currently set GLSL program. */ /* GL locking is done by the caller */ -static void shader_glsl_load_constantsB(IWineD3DBaseShaderImpl *This, const struct wined3d_gl_info *gl_info, +static void shader_glsl_load_constantsB(const struct wined3d_shader *shader, const struct wined3d_gl_info *gl_info, GLhandleARB programId, const BOOL *constants, WORD constants_set) { GLint tmp_loc; @@ -611,7 +613,7 @@ static void shader_glsl_load_constantsB(IWineD3DBaseShaderImpl *This, const stru const char *prefix; struct list* ptr; - switch (This->baseShader.reg_maps.shader_version.type) + switch (shader->reg_maps.shader_version.type) { case WINED3D_SHADER_TYPE_VERTEX: prefix = "VB"; @@ -627,7 +629,7 @@ static void shader_glsl_load_constantsB(IWineD3DBaseShaderImpl *This, const stru default: FIXME("Unknown shader type %#x.\n", - This->baseShader.reg_maps.shader_version.type); + shader->reg_maps.shader_version.type); prefix = "UB"; break; } @@ -653,8 +655,9 @@ static void shader_glsl_load_constantsB(IWineD3DBaseShaderImpl *This, const stru } /* Load immediate constants */ - ptr = list_head(&This->baseShader.constantsB); - while (ptr) { + ptr = list_head(&shader->constantsB); + while (ptr) + { const struct local_constant *lconst = LIST_ENTRY(ptr, const struct local_constant, entry); unsigned int idx = lconst->idx; const GLint *values = (const GLint *)lconst->value; @@ -668,7 +671,7 @@ static void shader_glsl_load_constantsB(IWineD3DBaseShaderImpl *This, const stru GL_EXTCALL(glUniform1ivARB(tmp_loc, 1, values)); checkGLcall("glUniform1ivARB"); } - ptr = list_next(&This->baseShader.constantsB, ptr); + ptr = list_next(&shader->constantsB, ptr); } } @@ -681,34 +684,28 @@ static void reset_program_constant_version(struct wine_rb_entry *entry, void *co * Loads the texture dimensions for NP2 fixup into the currently set GLSL program. */ /* GL locking is done by the caller (state handler) */ -static void shader_glsl_load_np2fixup_constants( - IWineD3DDevice* device, - char usePixelShader, - char useVertexShader) { +static void shader_glsl_load_np2fixup_constants(void *shader_priv, + const struct wined3d_gl_info *gl_info, const struct wined3d_state *state) +{ + struct shader_glsl_priv *glsl_priv = shader_priv; + const struct glsl_shader_prog_link *prog = glsl_priv->glsl_program; - const IWineD3DDeviceImpl* deviceImpl = (const IWineD3DDeviceImpl*) device; - const struct glsl_shader_prog_link* prog = ((struct shader_glsl_priv *)(deviceImpl->shader_priv))->glsl_program; + /* No GLSL program set - nothing to do. */ + if (!prog) return; - if (!prog) { - /* No GLSL program set - nothing to do. */ - return; - } + /* NP2 texcoord fixup is (currently) only done for pixelshaders. */ + if (!use_ps(state)) return; - if (!usePixelShader) { - /* NP2 texcoord fixup is (currently) only done for pixelshaders. */ - return; - } - - if (prog->ps_args.np2_fixup && -1 != prog->np2Fixup_location) { - const struct wined3d_gl_info *gl_info = &deviceImpl->adapter->gl_info; - const IWineD3DStateBlockImpl* stateBlock = (const IWineD3DStateBlockImpl*) deviceImpl->stateBlock; + if (prog->ps_args.np2_fixup && prog->np2Fixup_location != -1) + { UINT i; UINT fixup = prog->ps_args.np2_fixup; GLfloat np2fixup_constants[4 * MAX_FRAGMENT_SAMPLERS]; - for (i = 0; fixup; fixup >>= 1, ++i) { + for (i = 0; fixup; fixup >>= 1, ++i) + { + const struct wined3d_texture *tex = state->textures[i]; const unsigned char idx = prog->np2Fixup_info->idx[i]; - const IWineD3DBaseTextureImpl *tex = stateBlock->state.textures[i]; GLfloat *tex_dim = &np2fixup_constants[(idx >> 1) * 4]; if (!tex) @@ -717,10 +714,15 @@ static void shader_glsl_load_np2fixup_constants( continue; } - if (idx % 2) { - tex_dim[2] = tex->baseTexture.pow2Matrix[0]; tex_dim[3] = tex->baseTexture.pow2Matrix[5]; - } else { - tex_dim[0] = tex->baseTexture.pow2Matrix[0]; tex_dim[1] = tex->baseTexture.pow2Matrix[5]; + if (idx % 2) + { + tex_dim[2] = tex->pow2_matrix[0]; + tex_dim[3] = tex->pow2_matrix[5]; + } + else + { + tex_dim[0] = tex->pow2_matrix[0]; + tex_dim[1] = tex->pow2_matrix[5]; } } @@ -736,9 +738,10 @@ static void shader_glsl_load_constants(const struct wined3d_context *context, char usePixelShader, char useVertexShader) { const struct wined3d_gl_info *gl_info = context->gl_info; - IWineD3DDeviceImpl *device = context->swapchain->device; - IWineD3DStateBlockImpl* stateBlock = device->stateBlock; + struct wined3d_device *device = context->swapchain->device; + struct wined3d_stateblock *stateBlock = device->stateBlock; struct shader_glsl_priv *priv = device->shader_priv; + float position_fixup[4]; GLhandleARB programId; struct glsl_shader_prog_link *prog = priv->glsl_program; @@ -754,7 +757,7 @@ static void shader_glsl_load_constants(const struct wined3d_context *context, if (useVertexShader) { - IWineD3DBaseShaderImpl *vshader = (IWineD3DBaseShaderImpl *)stateBlock->state.vertex_shader; + const struct wined3d_shader *vshader = stateBlock->state.vertex_shader; /* Load DirectX 9 float constants/uniforms for vertex shader */ shader_glsl_load_constantsF(vshader, gl_info, stateBlock->state.vs_consts_f, @@ -762,20 +765,21 @@ static void shader_glsl_load_constants(const struct wined3d_context *context, /* Load DirectX 9 integer constants/uniforms for vertex shader */ shader_glsl_load_constantsI(vshader, gl_info, prog->vuniformI_locations, stateBlock->state.vs_consts_i, - stateBlock->changed.vertexShaderConstantsI & vshader->baseShader.reg_maps.integer_constants); + stateBlock->changed.vertexShaderConstantsI & vshader->reg_maps.integer_constants); /* Load DirectX 9 boolean constants/uniforms for vertex shader */ shader_glsl_load_constantsB(vshader, gl_info, programId, stateBlock->state.vs_consts_b, - stateBlock->changed.vertexShaderConstantsB & vshader->baseShader.reg_maps.boolean_constants); + stateBlock->changed.vertexShaderConstantsB & vshader->reg_maps.boolean_constants); /* Upload the position fixup params */ - GL_EXTCALL(glUniform4fvARB(prog->posFixup_location, 1, &device->posFixup[0])); + shader_get_position_fixup(context, &stateBlock->state, position_fixup); + GL_EXTCALL(glUniform4fvARB(prog->posFixup_location, 1, position_fixup)); checkGLcall("glUniform4fvARB"); } if (usePixelShader) { - IWineD3DBaseShaderImpl *pshader = (IWineD3DBaseShaderImpl *)stateBlock->state.pixel_shader; + const struct wined3d_shader *pshader = stateBlock->state.pixel_shader; /* Load DirectX 9 float constants/uniforms for pixel shader */ shader_glsl_load_constantsF(pshader, gl_info, stateBlock->state.ps_consts_f, @@ -783,11 +787,11 @@ static void shader_glsl_load_constants(const struct wined3d_context *context, /* Load DirectX 9 integer constants/uniforms for pixel shader */ shader_glsl_load_constantsI(pshader, gl_info, prog->puniformI_locations, stateBlock->state.ps_consts_i, - stateBlock->changed.pixelShaderConstantsI & pshader->baseShader.reg_maps.integer_constants); + stateBlock->changed.pixelShaderConstantsI & pshader->reg_maps.integer_constants); /* Load DirectX 9 boolean constants/uniforms for pixel shader */ shader_glsl_load_constantsB(pshader, gl_info, programId, stateBlock->state.ps_consts_b, - stateBlock->changed.pixelShaderConstantsB & pshader->baseShader.reg_maps.boolean_constants); + stateBlock->changed.pixelShaderConstantsB & pshader->reg_maps.boolean_constants); /* Upload the environment bump map matrix if needed. The needsbumpmat member specifies the texture stage to load the matrix from. * It can't be 0 for a valid texbem instruction. @@ -816,7 +820,8 @@ static void shader_glsl_load_constants(const struct wined3d_context *context, } } - if(((IWineD3DPixelShaderImpl *) pshader)->vpos_uniform) { + if (pshader->u.ps.vpos_uniform) + { float correction_params[4]; if (context->render_offscreen) @@ -825,7 +830,7 @@ static void shader_glsl_load_constants(const struct wined3d_context *context, correction_params[1] = 1.0f; } else { /* position is window relative, not viewport relative */ - correction_params[0] = context->current_rt->currentDesc.Height; + correction_params[0] = (float) context->current_rt->resource.height; correction_params[1] = -1.0f; } GL_EXTCALL(glUniform4fvARB(prog->ycorrection_location, 1, correction_params)); @@ -867,32 +872,30 @@ static inline void update_heap_entry(struct constant_heap *heap, unsigned int id positions[idx] = heap_idx; } -static void shader_glsl_update_float_vertex_constants(IWineD3DDevice *iface, UINT start, UINT count) +static void shader_glsl_update_float_vertex_constants(struct wined3d_device *device, UINT start, UINT count) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - struct shader_glsl_priv *priv = This->shader_priv; + struct shader_glsl_priv *priv = device->shader_priv; struct constant_heap *heap = &priv->vconst_heap; UINT i; for (i = start; i < count + start; ++i) { - if (!This->stateBlock->changed.vertexShaderConstantsF[i]) + if (!device->stateBlock->changed.vertexShaderConstantsF[i]) update_heap_entry(heap, i, heap->size++, priv->next_constant_version); else update_heap_entry(heap, i, heap->positions[i], priv->next_constant_version); } } -static void shader_glsl_update_float_pixel_constants(IWineD3DDevice *iface, UINT start, UINT count) +static void shader_glsl_update_float_pixel_constants(struct wined3d_device *device, UINT start, UINT count) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - struct shader_glsl_priv *priv = This->shader_priv; + struct shader_glsl_priv *priv = device->shader_priv; struct constant_heap *heap = &priv->pconst_heap; UINT i; for (i = start; i < count + start; ++i) { - if (!This->stateBlock->changed.pixelShaderConstantsF[i]) + if (!device->stateBlock->changed.pixelShaderConstantsF[i]) update_heap_entry(heap, i, heap->size++, priv->next_constant_version); else update_heap_entry(heap, i, heap->positions[i], priv->next_constant_version); @@ -912,14 +915,13 @@ static unsigned int vec4_varyings(DWORD shader_major, const struct wined3d_gl_in /** Generate the variable & register declarations for the GLSL output target */ static void shader_generate_glsl_declarations(const struct wined3d_context *context, - struct wined3d_shader_buffer *buffer, IWineD3DBaseShader *iface, - const shader_reg_maps *reg_maps, struct shader_glsl_ctx_priv *ctx_priv) + struct wined3d_shader_buffer *buffer, struct wined3d_shader *shader, + const struct wined3d_shader_reg_maps *reg_maps, struct shader_glsl_ctx_priv *ctx_priv) { - IWineD3DBaseShaderImpl* This = (IWineD3DBaseShaderImpl*) iface; - IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *) This->baseShader.device; - const struct wined3d_state *state = &device->stateBlock->state; + const struct wined3d_state *state = &shader->device->stateBlock->state; const struct ps_compile_args *ps_args = ctx_priv->cur_ps_args; const struct wined3d_gl_info *gl_info = context->gl_info; + const struct wined3d_fb_state *fb = &shader->device->fb; unsigned int i, extra_constants_needed = 0; const local_constant *lconst; DWORD map; @@ -935,7 +937,8 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont } /* Declare the constants (aka uniforms) */ - if (This->baseShader.limits.constant_float > 0) { + if (shader->limits.constant_float > 0) + { unsigned max_constantsF; /* Unless the shader uses indirect addressing, always declare the maximum array size and ignore that we need some * uniforms privately. E.g. if GL supports 256 uniforms, and we need 2 for the pos fixup and immediate values, still @@ -957,25 +960,29 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont } else { - if(This->baseShader.reg_maps.usesrelconstF) { - /* Subtract the other potential uniforms from the max available (bools, ints, and 1 row of projection matrix). - * Subtract another uniform for immediate values, which have to be loaded via uniform by the driver as well. - * The shader code only uses 0.5, 2.0, 1.0, 128 and -128 in vertex shader code, so one vec4 should be enough - * (Unfortunately the Nvidia driver doesn't store 128 and -128 in one float). + if (reg_maps->usesrelconstF) + { + /* Subtract the other potential uniforms from the max + * available (bools, ints, and 1 row of projection matrix). + * Subtract another uniform for immediate values, which have + * to be loaded via uniform by the driver as well. The shader + * code only uses 0.5, 2.0, 1.0, 128 and -128 in vertex + * shader code, so one vec4 should be enough. (Unfortunately + * the Nvidia driver doesn't store 128 and -128 in one float). * - * Writing gl_ClipVertex requires one uniform for each clipplane as well. - */ + * Writing gl_ClipVertex requires one uniform for each + * clipplane as well. */ max_constantsF = gl_info->limits.glsl_vs_float_constants - 3; if(ctx_priv->cur_vs_args->clip_enabled) { max_constantsF -= gl_info->limits.clipplanes; } - max_constantsF -= count_bits(This->baseShader.reg_maps.integer_constants); + max_constantsF -= count_bits(reg_maps->integer_constants); /* Strictly speaking a bool only uses one scalar, but the nvidia(Linux) compiler doesn't pack them properly, * so each scalar requires a full vec4. We could work around this by packing the booleans ourselves, but * for now take this into account when calculating the number of available constants */ - max_constantsF -= count_bits(This->baseShader.reg_maps.boolean_constants); + max_constantsF -= count_bits(reg_maps->boolean_constants); /* Set by driver quirks in directx.c */ max_constantsF -= gl_info->reserved_glsl_constants; } @@ -984,18 +991,18 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont max_constantsF = gl_info->limits.glsl_vs_float_constants; } } - max_constantsF = min(This->baseShader.limits.constant_float, max_constantsF); + max_constantsF = min(shader->limits.constant_float, max_constantsF); shader_addline(buffer, "uniform vec4 %cC[%u];\n", prefix, max_constantsF); } - /* Always declare the full set of constants, the compiler can remove the unused ones because d3d doesn't(yet) - * support indirect int and bool constant addressing. This avoids problems if the app uses e.g. i0 and i9. - */ - if (This->baseShader.limits.constant_int > 0 && This->baseShader.reg_maps.integer_constants) - shader_addline(buffer, "uniform ivec4 %cI[%u];\n", prefix, This->baseShader.limits.constant_int); + /* Always declare the full set of constants, the compiler can remove the + * unused ones because d3d doesn't (yet) support indirect int and bool + * constant addressing. This avoids problems if the app uses e.g. i0 and i9. */ + if (shader->limits.constant_int > 0 && reg_maps->integer_constants) + shader_addline(buffer, "uniform ivec4 %cI[%u];\n", prefix, shader->limits.constant_int); - if (This->baseShader.limits.constant_bool > 0 && This->baseShader.reg_maps.boolean_constants) - shader_addline(buffer, "uniform bool %cB[%u];\n", prefix, This->baseShader.limits.constant_bool); + if (shader->limits.constant_bool > 0 && reg_maps->boolean_constants) + shader_addline(buffer, "uniform bool %cB[%u];\n", prefix, shader->limits.constant_bool); if (!pshader) { @@ -1029,19 +1036,21 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont } if (reg_maps->vpos || reg_maps->usesdsy) { - if (This->baseShader.limits.constant_float + extra_constants_needed + if (shader->limits.constant_float + extra_constants_needed + 1 < gl_info->limits.glsl_ps_float_constants) { shader_addline(buffer, "uniform vec4 ycorrection;\n"); - ((IWineD3DPixelShaderImpl *) This)->vpos_uniform = 1; + shader->u.ps.vpos_uniform = 1; extra_constants_needed++; - } else { + } + else + { /* This happens because we do not have proper tracking of the constant registers that are * actually used, only the max limit of the shader version */ FIXME("Cannot find a free uniform for vpos correction params\n"); shader_addline(buffer, "const vec4 ycorrection = vec4(%f, %f, 0.0, 0.0);\n", - context->render_offscreen ? 0.0f : device->render_targets[0]->currentDesc.Height, + context->render_offscreen ? 0.0f : fb->render_targets[0]->resource.height, context->render_offscreen ? 1.0f : -1.0f); } shader_addline(buffer, "vec4 vpos;\n"); @@ -1049,10 +1058,11 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont } /* Declare texture samplers */ - for (i = 0; i < This->baseShader.limits.sampler; i++) { + for (i = 0; i < shader->limits.sampler; ++i) + { if (reg_maps->sampler_type[i]) { - IWineD3DBaseTextureImpl *texture; + const struct wined3d_texture *texture; switch (reg_maps->sampler_type[i]) { @@ -1066,14 +1076,14 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont texture = state->textures[i]; if (pshader && ps_args->shadow & (1 << i)) { - if (texture && texture->baseTexture.target == GL_TEXTURE_RECTANGLE_ARB) + if (texture && texture->target == GL_TEXTURE_RECTANGLE_ARB) shader_addline(buffer, "uniform sampler2DRectShadow %csampler%u;\n", prefix, i); else shader_addline(buffer, "uniform sampler2DShadow %csampler%u;\n", prefix, i); } else { - if (texture && texture->baseTexture.target == GL_TEXTURE_RECTANGLE_ARB) + if (texture && texture->target == GL_TEXTURE_RECTANGLE_ARB) shader_addline(buffer, "uniform sampler2DRect %csampler%u;\n", prefix, i); else shader_addline(buffer, "uniform sampler2D %csampler%u;\n", prefix, i); @@ -1109,8 +1119,10 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont * samplerNP2Fixup stores texture dimensions and is updated through * shader_glsl_load_np2fixup_constants when the sampler changes. */ - for (i = 0; i < This->baseShader.limits.sampler; ++i) { - if (reg_maps->sampler_type[i]) { + for (i = 0; i < shader->limits.sampler; ++i) + { + if (reg_maps->sampler_type[i]) + { if (!(ps_args->np2_fixup & (1 << i))) continue; if (WINED3DSTT_2D != reg_maps->sampler_type[i]) { @@ -1156,9 +1168,8 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont } /* Declare output register temporaries */ - if(This->baseShader.limits.packed_output) { - shader_addline(buffer, "vec4 OUT[%u];\n", This->baseShader.limits.packed_output); - } + if (shader->limits.packed_output) + shader_addline(buffer, "vec4 OUT[%u];\n", shader->limits.packed_output); /* Declare temporary variables */ for (i = 0, map = reg_maps->temporary; map; map >>= 1, ++i) @@ -1189,8 +1200,10 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont * They can't be hardcoded into the shader text via LC = {x, y, z, w}; because the * float -> string conversion can cause precision loss. */ - if(!This->baseShader.load_local_constsF) { - LIST_FOR_EACH_ENTRY(lconst, &This->baseShader.constantsF, local_constant, entry) { + if (!shader->load_local_constsF) + { + LIST_FOR_EACH_ENTRY(lconst, &shader->constantsF, local_constant, entry) + { shader_addline(buffer, "uniform vec4 %cLC%u;\n", prefix, lconst->idx); } } @@ -1201,7 +1214,7 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont /* DirectX apps expect integer values, while OpenGL drivers add approximately 0.5. This causes * off-by-one problems as spotted by the vPos d3d9 visual test. Unfortunately the ATI cards do * not add exactly 0.5, but rather something like 0.49999999 or 0.50000001, which still causes - * precision troubles when we just substract 0.5. + * precision troubles when we just subtract 0.5. * * To deal with that just floor() the position. This will eliminate the fraction on all cards. * @@ -1305,9 +1318,10 @@ static void shader_glsl_get_register_name(const struct wined3d_shader_register * /* oPos, oFog and oPts in D3D */ static const char * const hwrastout_reg_names[] = {"OUT[10]", "OUT[11].x", "OUT[11].y"}; - IWineD3DBaseShaderImpl *This = (IWineD3DBaseShaderImpl *)ins->ctx->shader; + struct wined3d_shader *shader = ins->ctx->shader; + const struct wined3d_shader_reg_maps *reg_maps = ins->ctx->reg_maps; const struct wined3d_gl_info *gl_info = ins->ctx->gl_info; - char pshader = shader_is_pshader_version(This->baseShader.reg_maps.shader_version.type); + char pshader = shader_is_pshader_version(reg_maps->shader_version.type); *is_color = FALSE; @@ -1328,10 +1342,10 @@ static void shader_glsl_get_register_name(const struct wined3d_shader_register * } /* pixel shaders >= 3.0 */ - if (This->baseShader.reg_maps.shader_version.major >= 3) + if (reg_maps->shader_version.major >= 3) { - DWORD idx = ((IWineD3DPixelShaderImpl *)This)->input_reg_map[reg->idx]; - unsigned int in_count = vec4_varyings(This->baseShader.reg_maps.shader_version.major, gl_info); + DWORD idx = shader->u.ps.input_reg_map[reg->idx]; + unsigned int in_count = vec4_varyings(reg_maps->shader_version.major, gl_info); if (reg->rel_addr) { @@ -1343,7 +1357,7 @@ static void shader_glsl_get_register_name(const struct wined3d_shader_register * * operation there */ if (idx) { - if (((IWineD3DPixelShaderImpl *)This)->declared_in_count > in_count) + if (shader->u.ps.declared_in_count > in_count) { sprintf(register_name, "((%s + %u) > %d ? (%s + %u) > %d ? gl_SecondaryColor : gl_Color : IN[%s + %u])", @@ -1357,7 +1371,7 @@ static void shader_glsl_get_register_name(const struct wined3d_shader_register * } else { - if (((IWineD3DPixelShaderImpl *)This)->declared_in_count > in_count) + if (shader->u.ps.declared_in_count > in_count) { sprintf(register_name, "((%s) > %d ? (%s) > %d ? gl_SecondaryColor : gl_Color : IN[%s])", rel_param.param_str, in_count - 1, rel_param.param_str, in_count, @@ -1398,7 +1412,7 @@ static void shader_glsl_get_register_name(const struct wined3d_shader_register * } else { - if (shader_constant_is_local(This, reg->idx)) + if (shader_constant_is_local(shader, reg->idx)) sprintf(register_name, "%cLC%u", prefix, reg->idx); else sprintf(register_name, "%cC[%u]", prefix, reg->idx); @@ -1422,7 +1436,7 @@ static void shader_glsl_get_register_name(const struct wined3d_shader_register * break; case WINED3DSPR_LOOP: - sprintf(register_name, "aL%u", This->baseShader.cur_loop_regno - 1); + sprintf(register_name, "aL%u", ins->ctx->loop_state->current_reg - 1); break; case WINED3DSPR_SAMPLER: @@ -2219,13 +2233,13 @@ static void shader_glsl_pow(const struct wined3d_shader_instruction *ins) if (dst_size > 1) { - shader_addline(buffer, "vec%u(pow(abs(%s), %s)));\n", - dst_size, src0_param.param_str, src1_param.param_str); + shader_addline(buffer, "vec%u(%s == 0.0 ? 1.0 : pow(abs(%s), %s)));\n", + dst_size, src1_param.param_str, src0_param.param_str, src1_param.param_str); } else { - shader_addline(buffer, "pow(abs(%s), %s));\n", - src0_param.param_str, src1_param.param_str); + shader_addline(buffer, "%s == 0.0 ? 1.0 : pow(abs(%s), %s));\n", + src1_param.param_str, src0_param.param_str, src1_param.param_str); } } @@ -2311,16 +2325,18 @@ static void shader_glsl_nrm(const struct wined3d_shader_instruction *ins) mask_size = shader_glsl_get_write_mask_size(write_mask); shader_glsl_add_src_param(ins, &ins->src[0], write_mask, &src_param); - shader_addline(buffer, "tmp0.x = length(%s);\n", src_param.param_str); + shader_addline(buffer, "tmp0.x = dot(%s, %s);\n", + src_param.param_str, src_param.param_str); shader_glsl_append_dst(buffer, ins); + if (mask_size > 1) { - shader_addline(buffer, "tmp0.x == 0.0 ? vec%u(0.0) : (%s / tmp0.x));\n", + shader_addline(buffer, "tmp0.x == 0.0 ? vec%u(0.0) : (%s * inversesqrt(tmp0.x)));\n", mask_size, src_param.param_str); } else { - shader_addline(buffer, "tmp0.x == 0.0 ? 0.0 : (%s / tmp0.x));\n", + shader_addline(buffer, "tmp0.x == 0.0 ? 0.0 : (%s * inversesqrt(tmp0.x)));\n", src_param.param_str); } } @@ -2825,8 +2841,9 @@ static void shader_glsl_sgn(const struct wined3d_shader_instruction *ins) /* FIXME: I don't think nested loops will work correctly this way. */ static void shader_glsl_loop(const struct wined3d_shader_instruction *ins) { + struct wined3d_shader_loop_state *loop_state = ins->ctx->loop_state; glsl_src_param_t src1_param; - IWineD3DBaseShaderImpl *shader = (IWineD3DBaseShaderImpl *)ins->ctx->shader; + struct wined3d_shader *shader = ins->ctx->shader; const DWORD *control_values = NULL; const local_constant *constant; @@ -2839,7 +2856,8 @@ static void shader_glsl_loop(const struct wined3d_shader_instruction *ins) */ if (ins->src[1].reg.type == WINED3DSPR_CONSTINT) { - LIST_FOR_EACH_ENTRY(constant, &shader->baseShader.constantsI, local_constant, entry) { + LIST_FOR_EACH_ENTRY(constant, &shader->constantsI, local_constant, entry) + { if (constant->idx == ins->src[1].reg.idx) { control_values = constant->value; @@ -2858,57 +2876,58 @@ static void shader_glsl_loop(const struct wined3d_shader_instruction *ins) if (loop_control.step > 0) { shader_addline(ins->ctx->buffer, "for (aL%u = %u; aL%u < (%u * %d + %u); aL%u += %d) {\n", - shader->baseShader.cur_loop_depth, loop_control.start, - shader->baseShader.cur_loop_depth, loop_control.count, loop_control.step, loop_control.start, - shader->baseShader.cur_loop_depth, loop_control.step); + loop_state->current_depth, loop_control.start, + loop_state->current_depth, loop_control.count, loop_control.step, loop_control.start, + loop_state->current_depth, loop_control.step); } else if (loop_control.step < 0) { shader_addline(ins->ctx->buffer, "for (aL%u = %u; aL%u > (%u * %d + %u); aL%u += %d) {\n", - shader->baseShader.cur_loop_depth, loop_control.start, - shader->baseShader.cur_loop_depth, loop_control.count, loop_control.step, loop_control.start, - shader->baseShader.cur_loop_depth, loop_control.step); + loop_state->current_depth, loop_control.start, + loop_state->current_depth, loop_control.count, loop_control.step, loop_control.start, + loop_state->current_depth, loop_control.step); } else { shader_addline(ins->ctx->buffer, "for (aL%u = %u, tmpInt%u = 0; tmpInt%u < %u; tmpInt%u++) {\n", - shader->baseShader.cur_loop_depth, loop_control.start, shader->baseShader.cur_loop_depth, - shader->baseShader.cur_loop_depth, loop_control.count, - shader->baseShader.cur_loop_depth); + loop_state->current_depth, loop_control.start, loop_state->current_depth, + loop_state->current_depth, loop_control.count, + loop_state->current_depth); } } else { shader_addline(ins->ctx->buffer, "for (tmpInt%u = 0, aL%u = %s.y; tmpInt%u < %s.x; tmpInt%u++, aL%u += %s.z) {\n", - shader->baseShader.cur_loop_depth, shader->baseShader.cur_loop_regno, - src1_param.reg_name, shader->baseShader.cur_loop_depth, src1_param.reg_name, - shader->baseShader.cur_loop_depth, shader->baseShader.cur_loop_regno, src1_param.reg_name); + loop_state->current_depth, loop_state->current_reg, + src1_param.reg_name, loop_state->current_depth, src1_param.reg_name, + loop_state->current_depth, loop_state->current_reg, src1_param.reg_name); } - shader->baseShader.cur_loop_depth++; - shader->baseShader.cur_loop_regno++; + ++loop_state->current_depth; + ++loop_state->current_reg; } static void shader_glsl_end(const struct wined3d_shader_instruction *ins) { - IWineD3DBaseShaderImpl *shader = (IWineD3DBaseShaderImpl *)ins->ctx->shader; + struct wined3d_shader_loop_state *loop_state = ins->ctx->loop_state; shader_addline(ins->ctx->buffer, "}\n"); if (ins->handler_idx == WINED3DSIH_ENDLOOP) { - shader->baseShader.cur_loop_depth--; - shader->baseShader.cur_loop_regno--; + --loop_state->current_depth; + --loop_state->current_reg; } if (ins->handler_idx == WINED3DSIH_ENDREP) { - shader->baseShader.cur_loop_depth--; + --loop_state->current_depth; } } static void shader_glsl_rep(const struct wined3d_shader_instruction *ins) { - IWineD3DBaseShaderImpl *shader = (IWineD3DBaseShaderImpl *)ins->ctx->shader; + struct wined3d_shader *shader = ins->ctx->shader; + struct wined3d_shader_loop_state *loop_state = ins->ctx->loop_state; glsl_src_param_t src0_param; const DWORD *control_values = NULL; const local_constant *constant; @@ -2916,7 +2935,7 @@ static void shader_glsl_rep(const struct wined3d_shader_instruction *ins) /* Try to hardcode local values to help the GLSL compiler to unroll and optimize the loop */ if (ins->src[0].reg.type == WINED3DSPR_CONSTINT) { - LIST_FOR_EACH_ENTRY(constant, &shader->baseShader.constantsI, local_constant, entry) + LIST_FOR_EACH_ENTRY(constant, &shader->constantsI, local_constant, entry) { if (constant->idx == ins->src[0].reg.idx) { @@ -2926,17 +2945,21 @@ static void shader_glsl_rep(const struct wined3d_shader_instruction *ins) } } - if(control_values) { + if (control_values) + { shader_addline(ins->ctx->buffer, "for (tmpInt%d = 0; tmpInt%d < %d; tmpInt%d++) {\n", - shader->baseShader.cur_loop_depth, shader->baseShader.cur_loop_depth, - control_values[0], shader->baseShader.cur_loop_depth); - } else { + loop_state->current_depth, loop_state->current_depth, + control_values[0], loop_state->current_depth); + } + else + { shader_glsl_add_src_param(ins, &ins->src[0], WINED3DSP_WRITEMASK_0, &src0_param); shader_addline(ins->ctx->buffer, "for (tmpInt%d = 0; tmpInt%d < %s; tmpInt%d++) {\n", - shader->baseShader.cur_loop_depth, shader->baseShader.cur_loop_depth, - src0_param.param_str, shader->baseShader.cur_loop_depth); + loop_state->current_depth, loop_state->current_depth, + src0_param.param_str, loop_state->current_depth); } - shader->baseShader.cur_loop_depth++; + + ++loop_state->current_depth; } static void shader_glsl_if(const struct wined3d_shader_instruction *ins) @@ -3013,12 +3036,12 @@ static void shader_glsl_ret(const struct wined3d_shader_instruction *ins) ********************************************/ static void shader_glsl_tex(const struct wined3d_shader_instruction *ins) { - IWineD3DBaseShaderImpl *shader = (IWineD3DBaseShaderImpl *)ins->ctx->shader; - IWineD3DDeviceImpl *deviceImpl = (IWineD3DDeviceImpl *)shader->baseShader.device; + struct wined3d_shader *shader = ins->ctx->shader; + struct wined3d_device *device = shader->device; DWORD shader_version = WINED3D_SHADER_VERSION(ins->ctx->reg_maps->shader_version.major, ins->ctx->reg_maps->shader_version.minor); glsl_sample_function_t sample_function; - IWineD3DBaseTextureImpl *texture; + const struct wined3d_texture *texture; DWORD sample_flags = 0; DWORD sampler_idx; DWORD mask = 0, swizzle; @@ -3027,7 +3050,7 @@ static void shader_glsl_tex(const struct wined3d_shader_instruction *ins) * 2.0+: Use provided sampler source. */ if (shader_version < WINED3D_SHADER_VERSION(2,0)) sampler_idx = ins->dst[0].reg.idx; else sampler_idx = ins->src[1].reg.idx; - texture = deviceImpl->stateBlock->state.textures[sampler_idx]; + texture = device->stateBlock->state.textures[sampler_idx]; if (shader_version < WINED3D_SHADER_VERSION(1,4)) { @@ -3068,7 +3091,7 @@ static void shader_glsl_tex(const struct wined3d_shader_instruction *ins) } } - if (texture && texture->baseTexture.target == GL_TEXTURE_RECTANGLE_ARB) + if (texture && texture->target == GL_TEXTURE_RECTANGLE_ARB) sample_flags |= WINED3D_GLSL_SAMPLE_RECT; shader_glsl_get_sample_function(ins->ctx, sampler_idx, sample_flags, &sample_function); @@ -3103,15 +3126,15 @@ static void shader_glsl_tex(const struct wined3d_shader_instruction *ins) static void shader_glsl_texldd(const struct wined3d_shader_instruction *ins) { - IWineD3DBaseShaderImpl *This = (IWineD3DBaseShaderImpl *)ins->ctx->shader; - IWineD3DDeviceImpl* deviceImpl = (IWineD3DDeviceImpl*) This->baseShader.device; + struct wined3d_shader *shader = ins->ctx->shader; + struct wined3d_device *device = shader->device; const struct wined3d_gl_info *gl_info = ins->ctx->gl_info; glsl_sample_function_t sample_function; glsl_src_param_t coord_param, dx_param, dy_param; DWORD sample_flags = WINED3D_GLSL_SAMPLE_GRAD; DWORD sampler_idx; DWORD swizzle = ins->src[1].swizzle; - IWineD3DBaseTextureImpl *texture; + const struct wined3d_texture *texture; if (!gl_info->supported[ARB_SHADER_TEXTURE_LOD] && !gl_info->supported[EXT_GPU_SHADER4]) { @@ -3121,8 +3144,8 @@ static void shader_glsl_texldd(const struct wined3d_shader_instruction *ins) } sampler_idx = ins->src[1].reg.idx; - texture = deviceImpl->stateBlock->state.textures[sampler_idx]; - if (texture && texture->baseTexture.target == GL_TEXTURE_RECTANGLE_ARB) + texture = device->stateBlock->state.textures[sampler_idx]; + if (texture && texture->target == GL_TEXTURE_RECTANGLE_ARB) sample_flags |= WINED3D_GLSL_SAMPLE_RECT; shader_glsl_get_sample_function(ins->ctx, sampler_idx, sample_flags, &sample_function); @@ -3136,19 +3159,19 @@ static void shader_glsl_texldd(const struct wined3d_shader_instruction *ins) static void shader_glsl_texldl(const struct wined3d_shader_instruction *ins) { - IWineD3DBaseShaderImpl *This = (IWineD3DBaseShaderImpl *)ins->ctx->shader; - IWineD3DDeviceImpl* deviceImpl = (IWineD3DDeviceImpl*) This->baseShader.device; + struct wined3d_shader *shader = ins->ctx->shader; + struct wined3d_device *device = shader->device; const struct wined3d_gl_info *gl_info = ins->ctx->gl_info; glsl_sample_function_t sample_function; glsl_src_param_t coord_param, lod_param; DWORD sample_flags = WINED3D_GLSL_SAMPLE_LOD; DWORD sampler_idx; DWORD swizzle = ins->src[1].swizzle; - IWineD3DBaseTextureImpl *texture; + const struct wined3d_texture *texture; sampler_idx = ins->src[1].reg.idx; - texture = deviceImpl->stateBlock->state.textures[sampler_idx]; - if (texture && texture->baseTexture.target == GL_TEXTURE_RECTANGLE_ARB) + texture = device->stateBlock->state.textures[sampler_idx]; + if (texture && texture->target == GL_TEXTURE_RECTANGLE_ARB) sample_flags |= WINED3D_GLSL_SAMPLE_RECT; shader_glsl_get_sample_function(ins->ctx, sampler_idx, sample_flags, &sample_function); @@ -3330,16 +3353,15 @@ static void shader_glsl_texm3x2pad(const struct wined3d_shader_instruction *ins) * Calculate the 1st or 2nd row of a 3-row matrix multiplication. */ static void shader_glsl_texm3x3pad(const struct wined3d_shader_instruction *ins) { - IWineD3DBaseShaderImpl *shader = (IWineD3DBaseShaderImpl *)ins->ctx->shader; DWORD src_mask = WINED3DSP_WRITEMASK_0 | WINED3DSP_WRITEMASK_1 | WINED3DSP_WRITEMASK_2; DWORD reg = ins->dst[0].reg.idx; struct wined3d_shader_buffer *buffer = ins->ctx->buffer; - SHADER_PARSE_STATE* current_state = &shader->baseShader.parse_state; + struct wined3d_shader_tex_mx *tex_mx = ins->ctx->tex_mx; glsl_src_param_t src0_param; shader_glsl_add_src_param(ins, &ins->src[0], src_mask, &src0_param); - shader_addline(buffer, "tmp0.%c = dot(T%u.xyz, %s);\n", 'x' + current_state->current_row, reg, src0_param.param_str); - current_state->texcoord_w[current_state->current_row++] = reg; + shader_addline(buffer, "tmp0.%c = dot(T%u.xyz, %s);\n", 'x' + tex_mx->current_row, reg, src0_param.param_str); + tex_mx->texcoord_w[tex_mx->current_row++] = reg; } static void shader_glsl_texm3x2tex(const struct wined3d_shader_instruction *ins) @@ -3364,8 +3386,7 @@ static void shader_glsl_texm3x2tex(const struct wined3d_shader_instruction *ins) static void shader_glsl_texm3x3tex(const struct wined3d_shader_instruction *ins) { DWORD src_mask = WINED3DSP_WRITEMASK_0 | WINED3DSP_WRITEMASK_1 | WINED3DSP_WRITEMASK_2; - IWineD3DBaseShaderImpl *shader = (IWineD3DBaseShaderImpl *)ins->ctx->shader; - SHADER_PARSE_STATE *current_state = &shader->baseShader.parse_state; + struct wined3d_shader_tex_mx *tex_mx = ins->ctx->tex_mx; glsl_src_param_t src0_param; DWORD reg = ins->dst[0].reg.idx; glsl_sample_function_t sample_function; @@ -3379,7 +3400,7 @@ static void shader_glsl_texm3x3tex(const struct wined3d_shader_instruction *ins) /* Sample the texture using the calculated coordinates */ shader_glsl_gen_sample_code(ins, reg, &sample_function, WINED3DSP_NOSWIZZLE, NULL, NULL, NULL, "tmp0.xyz"); - current_state->current_row = 0; + tex_mx->current_row = 0; } /** Process the WINED3DSIO_TEXM3X3 instruction in GLSL @@ -3387,8 +3408,7 @@ static void shader_glsl_texm3x3tex(const struct wined3d_shader_instruction *ins) static void shader_glsl_texm3x3(const struct wined3d_shader_instruction *ins) { DWORD src_mask = WINED3DSP_WRITEMASK_0 | WINED3DSP_WRITEMASK_1 | WINED3DSP_WRITEMASK_2; - IWineD3DBaseShaderImpl *shader = (IWineD3DBaseShaderImpl *)ins->ctx->shader; - SHADER_PARSE_STATE *current_state = &shader->baseShader.parse_state; + struct wined3d_shader_tex_mx *tex_mx = ins->ctx->tex_mx; glsl_src_param_t src0_param; char dst_mask[6]; DWORD reg = ins->dst[0].reg.idx; @@ -3399,19 +3419,18 @@ static void shader_glsl_texm3x3(const struct wined3d_shader_instruction *ins) shader_glsl_get_write_mask(&ins->dst[0], dst_mask); shader_addline(ins->ctx->buffer, "vec4(tmp0.xy, dot(T%u.xyz, %s), 1.0)%s);\n", reg, src0_param.param_str, dst_mask); - current_state->current_row = 0; + tex_mx->current_row = 0; } /* Process the WINED3DSIO_TEXM3X3SPEC instruction in GLSL * Perform the final texture lookup based on the previous 2 3x3 matrix multiplies */ static void shader_glsl_texm3x3spec(const struct wined3d_shader_instruction *ins) { - IWineD3DBaseShaderImpl *shader = (IWineD3DBaseShaderImpl *)ins->ctx->shader; DWORD reg = ins->dst[0].reg.idx; glsl_src_param_t src0_param; glsl_src_param_t src1_param; struct wined3d_shader_buffer *buffer = ins->ctx->buffer; - SHADER_PARSE_STATE* current_state = &shader->baseShader.parse_state; + struct wined3d_shader_tex_mx *tex_mx = ins->ctx->tex_mx; DWORD src_mask = WINED3DSP_WRITEMASK_0 | WINED3DSP_WRITEMASK_1 | WINED3DSP_WRITEMASK_2; glsl_sample_function_t sample_function; @@ -3429,17 +3448,16 @@ static void shader_glsl_texm3x3spec(const struct wined3d_shader_instruction *ins /* Sample the texture */ shader_glsl_gen_sample_code(ins, reg, &sample_function, WINED3DSP_NOSWIZZLE, NULL, NULL, NULL, "tmp0.xyz"); - current_state->current_row = 0; + tex_mx->current_row = 0; } /* Process the WINED3DSIO_TEXM3X3VSPEC instruction in GLSL * Perform the final texture lookup based on the previous 2 3x3 matrix multiplies */ static void shader_glsl_texm3x3vspec(const struct wined3d_shader_instruction *ins) { - IWineD3DBaseShaderImpl *shader = (IWineD3DBaseShaderImpl *)ins->ctx->shader; DWORD reg = ins->dst[0].reg.idx; struct wined3d_shader_buffer *buffer = ins->ctx->buffer; - SHADER_PARSE_STATE* current_state = &shader->baseShader.parse_state; + struct wined3d_shader_tex_mx *tex_mx = ins->ctx->tex_mx; glsl_src_param_t src0_param; DWORD src_mask = WINED3DSP_WRITEMASK_0 | WINED3DSP_WRITEMASK_1 | WINED3DSP_WRITEMASK_2; glsl_sample_function_t sample_function; @@ -3451,7 +3469,7 @@ static void shader_glsl_texm3x3vspec(const struct wined3d_shader_instruction *in /* Construct the eye-ray vector from w coordinates */ shader_addline(buffer, "tmp1.xyz = normalize(vec3(gl_TexCoord[%u].w, gl_TexCoord[%u].w, gl_TexCoord[%u].w));\n", - current_state->texcoord_w[0], current_state->texcoord_w[1], reg); + tex_mx->texcoord_w[0], tex_mx->texcoord_w[1], reg); shader_addline(buffer, "tmp0.xyz = -reflect(tmp1.xyz, normalize(tmp0.xyz));\n"); /* Dependent read, not valid with conditional NP2 */ @@ -3460,7 +3478,7 @@ static void shader_glsl_texm3x3vspec(const struct wined3d_shader_instruction *in /* Sample the texture using the calculated coordinates */ shader_glsl_gen_sample_code(ins, reg, &sample_function, WINED3DSP_NOSWIZZLE, NULL, NULL, NULL, "tmp0.xyz"); - current_state->current_row = 0; + tex_mx->current_row = 0; } /** Process the WINED3DSIO_TEXBEM instruction in GLSL. @@ -3630,13 +3648,13 @@ static void shader_glsl_dp2add(const struct wined3d_shader_instruction *ins) } } -static void shader_glsl_input_pack(IWineD3DPixelShader *iface, struct wined3d_shader_buffer *buffer, - const struct wined3d_shader_signature_element *input_signature, const struct shader_reg_maps *reg_maps, +static void shader_glsl_input_pack(const struct wined3d_shader *shader, struct wined3d_shader_buffer *buffer, + const struct wined3d_shader_signature_element *input_signature, + const struct wined3d_shader_reg_maps *reg_maps, enum vertexprocessing_mode vertexprocessing) { - unsigned int i; - IWineD3DPixelShaderImpl *This = (IWineD3DPixelShaderImpl *)iface; WORD map = reg_maps->input_registers; + unsigned int i; for (i = 0; map; map >>= 1, ++i) { @@ -3655,27 +3673,27 @@ static void shader_glsl_input_pack(IWineD3DPixelShader *iface, struct wined3d_sh { if (semantic_idx < 8 && vertexprocessing == pretransformed) shader_addline(buffer, "IN[%u]%s = gl_TexCoord[%u]%s;\n", - This->input_reg_map[i], reg_mask, semantic_idx, reg_mask); + shader->u.ps.input_reg_map[i], reg_mask, semantic_idx, reg_mask); else shader_addline(buffer, "IN[%u]%s = vec4(0.0, 0.0, 0.0, 0.0)%s;\n", - This->input_reg_map[i], reg_mask, reg_mask); + shader->u.ps.input_reg_map[i], reg_mask, reg_mask); } else if (shader_match_semantic(semantic_name, WINED3DDECLUSAGE_COLOR)) { if (!semantic_idx) shader_addline(buffer, "IN[%u]%s = vec4(gl_Color)%s;\n", - This->input_reg_map[i], reg_mask, reg_mask); + shader->u.ps.input_reg_map[i], reg_mask, reg_mask); else if (semantic_idx == 1) shader_addline(buffer, "IN[%u]%s = vec4(gl_SecondaryColor)%s;\n", - This->input_reg_map[i], reg_mask, reg_mask); + shader->u.ps.input_reg_map[i], reg_mask, reg_mask); else shader_addline(buffer, "IN[%u]%s = vec4(0.0, 0.0, 0.0, 0.0)%s;\n", - This->input_reg_map[i], reg_mask, reg_mask); + shader->u.ps.input_reg_map[i], reg_mask, reg_mask); } else { shader_addline(buffer, "IN[%u]%s = vec4(0.0, 0.0, 0.0, 0.0)%s;\n", - This->input_reg_map[i], reg_mask, reg_mask); + shader->u.ps.input_reg_map[i], reg_mask, reg_mask); } } } @@ -3684,8 +3702,9 @@ static void shader_glsl_input_pack(IWineD3DPixelShader *iface, struct wined3d_sh * Vertex Shader Specific Code begins here ********************************************/ -static void add_glsl_program_entry(struct shader_glsl_priv *priv, struct glsl_shader_prog_link *entry) { - glsl_program_key_t key; +static void add_glsl_program_entry(struct shader_glsl_priv *priv, struct glsl_shader_prog_link *entry) +{ + struct glsl_program_key key; key.vshader = entry->vshader; key.pshader = entry->pshader; @@ -3699,10 +3718,11 @@ static void add_glsl_program_entry(struct shader_glsl_priv *priv, struct glsl_sh } static struct glsl_shader_prog_link *get_glsl_program_entry(struct shader_glsl_priv *priv, - IWineD3DVertexShader *vshader, IWineD3DPixelShader *pshader, struct vs_compile_args *vs_args, - struct ps_compile_args *ps_args) { + const struct wined3d_shader *vshader, const struct wined3d_shader *pshader, + struct vs_compile_args *vs_args, struct ps_compile_args *ps_args) +{ struct wine_rb_entry *entry; - glsl_program_key_t key; + struct glsl_program_key key; key.vshader = vshader; key.pshader = pshader; @@ -3717,7 +3737,7 @@ static struct glsl_shader_prog_link *get_glsl_program_entry(struct shader_glsl_p static void delete_glsl_program_entry(struct shader_glsl_priv *priv, const struct wined3d_gl_info *gl_info, struct glsl_shader_prog_link *entry) { - glsl_program_key_t key; + struct glsl_program_key key; key.vshader = entry->vshader; key.pshader = entry->pshader; @@ -3733,9 +3753,12 @@ static void delete_glsl_program_entry(struct shader_glsl_priv *priv, const struc HeapFree(GetProcessHeap(), 0, entry); } -static void handle_ps3_input(struct wined3d_shader_buffer *buffer, const struct wined3d_gl_info *gl_info, const DWORD *map, - const struct wined3d_shader_signature_element *input_signature, const struct shader_reg_maps *reg_maps_in, - const struct wined3d_shader_signature_element *output_signature, const struct shader_reg_maps *reg_maps_out) +static void handle_ps3_input(struct wined3d_shader_buffer *buffer, + const struct wined3d_gl_info *gl_info, const DWORD *map, + const struct wined3d_shader_signature_element *input_signature, + const struct wined3d_shader_reg_maps *reg_maps_in, + const struct wined3d_shader_signature_element *output_signature, + const struct wined3d_shader_reg_maps *reg_maps_out) { unsigned int i, j; const char *semantic_name_in; @@ -3789,7 +3812,7 @@ static void handle_ps3_input(struct wined3d_shader_buffer *buffer, const struct set[in_idx] = mask; shader_glsl_write_mask_to_str(mask, reg_mask); - shader_addline(buffer, "%s%s = clamp(OUT[%u]%s, -FLT_MAX, FLT_MAX);\n", + shader_addline(buffer, "%s%s = OUT[%u]%s;\n", destination, reg_mask, j, reg_mask); } } @@ -3823,23 +3846,21 @@ static void handle_ps3_input(struct wined3d_shader_buffer *buffer, const struct /* GL locking is done by the caller */ static GLhandleARB generate_param_reorder_function(struct wined3d_shader_buffer *buffer, - IWineD3DVertexShader *vertexshader, IWineD3DPixelShader *pixelshader, const struct wined3d_gl_info *gl_info) + const struct wined3d_shader *vs, const struct wined3d_shader *ps, + const struct wined3d_gl_info *gl_info) { GLhandleARB ret = 0; - IWineD3DVertexShaderImpl *vs = (IWineD3DVertexShaderImpl *) vertexshader; - IWineD3DPixelShaderImpl *ps = (IWineD3DPixelShaderImpl *) pixelshader; - DWORD ps_major = ps ? ps->baseShader.reg_maps.shader_version.major : 0; + DWORD ps_major = ps ? ps->reg_maps.shader_version.major : 0; unsigned int i; const char *semantic_name; UINT semantic_idx; char reg_mask[6]; - const struct wined3d_shader_signature_element *output_signature = vs->baseShader.output_signature; - WORD map = vs->baseShader.reg_maps.output_registers; + const struct wined3d_shader_signature_element *output_signature = vs->output_signature; + WORD map = vs->reg_maps.output_registers; shader_buffer_clear(buffer); shader_addline(buffer, "#version 120\n"); - shader_addline(buffer, "const float FLT_MAX = 1e38;\n"); if (ps_major < 3) { @@ -3859,15 +3880,15 @@ static GLhandleARB generate_param_reorder_function(struct wined3d_shader_buffer if (shader_match_semantic(semantic_name, WINED3DDECLUSAGE_COLOR)) { if (!semantic_idx) - shader_addline(buffer, "gl_FrontColor%s = clamp(OUT[%u]%s, -FLT_MAX, FLT_MAX);\n", + shader_addline(buffer, "gl_FrontColor%s = OUT[%u]%s;\n", reg_mask, i, reg_mask); else if (semantic_idx == 1) - shader_addline(buffer, "gl_FrontSecondaryColor%s = clamp(OUT[%u]%s, -FLT_MAX, FLT_MAX);\n", + shader_addline(buffer, "gl_FrontSecondaryColor%s = OUT[%u]%s;\n", reg_mask, i, reg_mask); } else if (shader_match_semantic(semantic_name, WINED3DDECLUSAGE_POSITION)) { - shader_addline(buffer, "gl_Position%s = clamp(OUT[%u]%s, -FLT_MAX, FLT_MAX);\n", + shader_addline(buffer, "gl_Position%s = OUT[%u]%s;\n", reg_mask, i, reg_mask); } else if (shader_match_semantic(semantic_name, WINED3DDECLUSAGE_TEXCOORD)) @@ -3877,7 +3898,7 @@ static GLhandleARB generate_param_reorder_function(struct wined3d_shader_buffer if (!(gl_info->quirks & WINED3D_QUIRK_SET_TEXCOORD_W) || ps_major > 0) write_mask |= WINED3DSP_WRITEMASK_3; - shader_addline(buffer, "gl_TexCoord[%u]%s = clamp(OUT[%u]%s, -FLT_MAX, FLT_MAX);\n", + shader_addline(buffer, "gl_TexCoord[%u]%s = OUT[%u]%s;\n", semantic_idx, reg_mask, i, reg_mask); if (!(write_mask & WINED3DSP_WRITEMASK_3)) shader_addline(buffer, "gl_TexCoord[%u].w = 1.0;\n", semantic_idx); @@ -3885,11 +3906,11 @@ static GLhandleARB generate_param_reorder_function(struct wined3d_shader_buffer } else if (shader_match_semantic(semantic_name, WINED3DDECLUSAGE_PSIZE)) { - shader_addline(buffer, "gl_PointSize = clamp(OUT[%u].%c, -FLT_MAX, FLT_MAX);\n", i, reg_mask[1]); + shader_addline(buffer, "gl_PointSize = OUT[%u].%c;\n", i, reg_mask[1]); } else if (shader_match_semantic(semantic_name, WINED3DDECLUSAGE_FOG)) { - shader_addline(buffer, "gl_FogFragCoord = clamp(OUT[%u].%c, -FLT_MAX, FLT_MAX);\n", i, reg_mask[1]); + shader_addline(buffer, "gl_FogFragCoord = OUT[%u].%c;\n", i, reg_mask[1]); } } shader_addline(buffer, "}\n"); @@ -3911,18 +3932,18 @@ static GLhandleARB generate_param_reorder_function(struct wined3d_shader_buffer if (shader_match_semantic(semantic_name, WINED3DDECLUSAGE_POSITION)) { - shader_addline(buffer, "gl_Position%s = clamp(OUT[%u]%s, -FLT_MAX, FLT_MAX);\n", + shader_addline(buffer, "gl_Position%s = OUT[%u]%s;\n", reg_mask, i, reg_mask); } else if (shader_match_semantic(semantic_name, WINED3DDECLUSAGE_PSIZE)) { - shader_addline(buffer, "gl_PointSize = clamp(OUT[%u].%c, -FLT_MAX, FLT_MAX);\n", i, reg_mask[1]); + shader_addline(buffer, "gl_PointSize = OUT[%u].%c;\n", i, reg_mask[1]); } } /* Then, fix the pixel shader input */ - handle_ps3_input(buffer, gl_info, ps->input_reg_map, ps->baseShader.input_signature, - &ps->baseShader.reg_maps, output_signature, &vs->baseShader.reg_maps); + handle_ps3_input(buffer, gl_info, ps->u.ps.input_reg_map, ps->input_signature, + &ps->reg_maps, output_signature, &vs->reg_maps); shader_addline(buffer, "}\n"); } @@ -3935,15 +3956,16 @@ static GLhandleARB generate_param_reorder_function(struct wined3d_shader_buffer } /* GL locking is done by the caller */ -static void hardcode_local_constants(IWineD3DBaseShaderImpl *shader, const struct wined3d_gl_info *gl_info, - GLhandleARB programId, char prefix) +static void hardcode_local_constants(const struct wined3d_shader *shader, + const struct wined3d_gl_info *gl_info, GLhandleARB programId, char prefix) { const local_constant *lconst; GLint tmp_loc; const float *value; char glsl_name[8]; - LIST_FOR_EACH_ENTRY(lconst, &shader->baseShader.constantsF, local_constant, entry) { + LIST_FOR_EACH_ENTRY(lconst, &shader->constantsF, local_constant, entry) + { value = (const float *)lconst->value; snprintf(glsl_name, sizeof(glsl_name), "%cLC%u", prefix, lconst->idx); tmp_loc = GL_EXTCALL(glGetUniformLocationARB(programId, glsl_name)); @@ -3954,12 +3976,12 @@ static void hardcode_local_constants(IWineD3DBaseShaderImpl *shader, const struc /* GL locking is done by the caller */ static GLuint shader_glsl_generate_pshader(const struct wined3d_context *context, - struct wined3d_shader_buffer *buffer, IWineD3DPixelShaderImpl *This, + struct wined3d_shader_buffer *buffer, struct wined3d_shader *shader, const struct ps_compile_args *args, struct ps_np2fixup_info *np2fixup_info) { - const struct shader_reg_maps *reg_maps = &This->baseShader.reg_maps; + const struct wined3d_shader_reg_maps *reg_maps = &shader->reg_maps; const struct wined3d_gl_info *gl_info = context->gl_info; - CONST DWORD *function = This->baseShader.function; + const DWORD *function = shader->function; struct shader_glsl_ctx_priv priv_ctx; /* Create the hw GLSL shader object and assign it as the shader->prgId */ @@ -3988,17 +4010,14 @@ static GLuint shader_glsl_generate_pshader(const struct wined3d_context *context } /* Base Declarations */ - shader_generate_glsl_declarations(context, buffer, (IWineD3DBaseShader *)This, reg_maps, &priv_ctx); + shader_generate_glsl_declarations(context, buffer, shader, reg_maps, &priv_ctx); /* Pack 3.0 inputs */ if (reg_maps->shader_version.major >= 3 && args->vp_mode != vertexshader) - { - shader_glsl_input_pack((IWineD3DPixelShader *) This, buffer, - This->baseShader.input_signature, reg_maps, args->vp_mode); - } + shader_glsl_input_pack(shader, buffer, shader->input_signature, reg_maps, args->vp_mode); /* Base Shader Body */ - shader_generate_main((IWineD3DBaseShader *)This, buffer, reg_maps, function, &priv_ctx); + shader_generate_main(shader, buffer, reg_maps, function, &priv_ctx); /* Pixel shaders < 2.0 place the resulting color in R0 implicitly */ if (reg_maps->shader_version.major < 2) @@ -4058,12 +4077,12 @@ static GLuint shader_glsl_generate_pshader(const struct wined3d_context *context /* GL locking is done by the caller */ static GLuint shader_glsl_generate_vshader(const struct wined3d_context *context, - struct wined3d_shader_buffer *buffer, IWineD3DVertexShaderImpl *This, + struct wined3d_shader_buffer *buffer, struct wined3d_shader *shader, const struct vs_compile_args *args) { - const struct shader_reg_maps *reg_maps = &This->baseShader.reg_maps; + const struct wined3d_shader_reg_maps *reg_maps = &shader->reg_maps; const struct wined3d_gl_info *gl_info = context->gl_info; - CONST DWORD *function = This->baseShader.function; + const DWORD *function = shader->function; struct shader_glsl_ctx_priv priv_ctx; /* Create the hw GLSL shader program and assign it as the shader->prgId */ @@ -4072,18 +4091,16 @@ static GLuint shader_glsl_generate_vshader(const struct wined3d_context *context shader_addline(buffer, "#version 120\n"); if (gl_info->supported[EXT_GPU_SHADER4]) - { shader_addline(buffer, "#extension GL_EXT_gpu_shader4 : enable\n"); - } memset(&priv_ctx, 0, sizeof(priv_ctx)); priv_ctx.cur_vs_args = args; /* Base Declarations */ - shader_generate_glsl_declarations(context, buffer, (IWineD3DBaseShader *)This, reg_maps, &priv_ctx); + shader_generate_glsl_declarations(context, buffer, shader, reg_maps, &priv_ctx); /* Base Shader Body */ - shader_generate_main((IWineD3DBaseShader*)This, buffer, reg_maps, function, &priv_ctx); + shader_generate_main(shader, buffer, reg_maps, function, &priv_ctx); /* Unpack outputs */ shader_addline(buffer, "order_ps_input(OUT);\n"); @@ -4093,11 +4110,14 @@ static GLuint shader_glsl_generate_vshader(const struct wined3d_context *context * the fog frag coord is thrown away. If the fog frag coord is used, but not written by * the shader, it is set to 0.0(fully fogged, since start = 1.0, end = 0.0) */ - if(args->fog_src == VS_FOG_Z) { + if (args->fog_src == VS_FOG_Z) shader_addline(buffer, "gl_FogFragCoord = gl_Position.z;\n"); - } else if (!reg_maps->fog) { + else if (!reg_maps->fog) shader_addline(buffer, "gl_FogFragCoord = 0.0;\n"); - } + + /* We always store the clipplanes without y inversion */ + if (args->clip_enabled) + shader_addline(buffer, "gl_ClipVertex = gl_Position;\n"); /* Write the final position. * @@ -4108,9 +4128,6 @@ static GLuint shader_glsl_generate_vshader(const struct wined3d_context *context */ shader_addline(buffer, "gl_Position.y = gl_Position.y * posFixup.y;\n"); shader_addline(buffer, "gl_Position.xy += posFixup.zw * gl_Position.ww;\n"); - if(args->clip_enabled) { - shader_addline(buffer, "gl_ClipVertex = gl_Position;\n"); - } /* Z coord [0;1]->[-1;1] mapping, see comment in transform_projection in state.c * @@ -4129,10 +4146,10 @@ static GLuint shader_glsl_generate_vshader(const struct wined3d_context *context } static GLhandleARB find_glsl_pshader(const struct wined3d_context *context, - struct wined3d_shader_buffer *buffer, IWineD3DPixelShaderImpl *shader, + struct wined3d_shader_buffer *buffer, struct wined3d_shader *shader, const struct ps_compile_args *args, const struct ps_np2fixup_info **np2fixup_info) { - struct wined3d_state *state = &((IWineD3DDeviceImpl *)shader->baseShader.device)->stateBlock->state; + struct wined3d_state *state = &shader->device->stateBlock->state; UINT i; DWORD new_size; struct glsl_ps_compiled_shader *new_array; @@ -4140,16 +4157,16 @@ static GLhandleARB find_glsl_pshader(const struct wined3d_context *context, struct ps_np2fixup_info *np2fixup = NULL; GLhandleARB ret; - if (!shader->baseShader.backend_data) + if (!shader->backend_data) { - shader->baseShader.backend_data = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*shader_data)); - if (!shader->baseShader.backend_data) + shader->backend_data = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*shader_data)); + if (!shader->backend_data) { ERR("Failed to allocate backend data.\n"); return 0; } } - shader_data = shader->baseShader.backend_data; + shader_data = shader->backend_data; /* Usually we have very few GL shaders for each d3d shader(just 1 or maybe 2), * so a linear search is more performant than a hashmap or a binary search @@ -4189,7 +4206,7 @@ static GLhandleARB find_glsl_pshader(const struct wined3d_context *context, memset(&shader_data->gl_shaders[shader_data->num_gl_shaders].np2fixup, 0, sizeof(struct ps_np2fixup_info)); if (args->np2_fixup) np2fixup = &shader_data->gl_shaders[shader_data->num_gl_shaders].np2fixup; - pixelshader_update_samplers(&shader->baseShader.reg_maps, (IWineD3DBaseTexture **)state->textures); + pixelshader_update_samplers(&shader->reg_maps, state->textures); shader_buffer_clear(buffer); ret = shader_glsl_generate_pshader(context, buffer, shader, args, np2fixup); @@ -4207,26 +4224,26 @@ static inline BOOL vs_args_equal(const struct vs_compile_args *stored, const str } static GLhandleARB find_glsl_vshader(const struct wined3d_context *context, - struct wined3d_shader_buffer *buffer, IWineD3DVertexShaderImpl *shader, + struct wined3d_shader_buffer *buffer, struct wined3d_shader *shader, const struct vs_compile_args *args) { UINT i; DWORD new_size; struct glsl_vs_compiled_shader *new_array; - DWORD use_map = ((IWineD3DDeviceImpl *)shader->baseShader.device)->strided_streams.use_map; + DWORD use_map = shader->device->strided_streams.use_map; struct glsl_vshader_private *shader_data; GLhandleARB ret; - if (!shader->baseShader.backend_data) + if (!shader->backend_data) { - shader->baseShader.backend_data = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*shader_data)); - if (!shader->baseShader.backend_data) + shader->backend_data = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*shader_data)); + if (!shader->backend_data) { ERR("Failed to allocate backend data.\n"); return 0; } } - shader_data = shader->baseShader.backend_data; + shader_data = shader->backend_data; /* Usually we have very few GL shaders for each d3d shader(just 1 or maybe 2), * so a linear search is more performant than a hashmap or a binary search @@ -4279,11 +4296,11 @@ static GLhandleARB find_glsl_vshader(const struct wined3d_context *context, /* GL locking is done by the caller */ static void set_glsl_shader_program(const struct wined3d_context *context, - IWineD3DDeviceImpl *device, BOOL use_ps, BOOL use_vs) + struct wined3d_device *device, BOOL use_ps, BOOL use_vs) { const struct wined3d_state *state = &device->stateBlock->state; - IWineD3DVertexShader *vshader = use_vs ? (IWineD3DVertexShader *)state->vertex_shader : NULL; - IWineD3DPixelShader *pshader = use_ps ? (IWineD3DPixelShader *)state->pixel_shader : NULL; + struct wined3d_shader *vshader = use_vs ? state->vertex_shader : NULL; + struct wined3d_shader *pshader = use_ps ? state->pixel_shader : NULL; const struct wined3d_gl_info *gl_info = context->gl_info; struct shader_glsl_priv *priv = device->shader_priv; struct glsl_shader_prog_link *entry = NULL; @@ -4294,11 +4311,12 @@ static void set_glsl_shader_program(const struct wined3d_context *context, struct ps_compile_args ps_compile_args; struct vs_compile_args vs_compile_args; - if (vshader) find_vs_compile_args(state, (IWineD3DVertexShaderImpl *)vshader, &vs_compile_args); - if (pshader) find_ps_compile_args(state, (IWineD3DPixelShaderImpl *)pshader, &ps_compile_args); + if (vshader) find_vs_compile_args(state, vshader, &vs_compile_args); + if (pshader) find_ps_compile_args(state, pshader, &ps_compile_args); entry = get_glsl_program_entry(priv, vshader, pshader, &vs_compile_args, &ps_compile_args); - if (entry) { + if (entry) + { priv->glsl_program = entry; return; } @@ -4325,9 +4343,8 @@ static void set_glsl_shader_program(const struct wined3d_context *context, /* Attach GLSL vshader */ if (vshader) { - GLhandleARB vshader_id = find_glsl_vshader(context, &priv->shader_buffer, - (IWineD3DVertexShaderImpl *)vshader, &vs_compile_args); - WORD map = ((IWineD3DBaseShaderImpl *)vshader)->baseShader.reg_maps.input_registers; + GLhandleARB vshader_id = find_glsl_vshader(context, &priv->shader_buffer, vshader, &vs_compile_args); + WORD map = vshader->reg_maps.input_registers; char tmp_name[10]; reorder_shader_id = generate_param_reorder_function(&priv->shader_buffer, vshader, pshader, gl_info); @@ -4361,19 +4378,19 @@ static void set_glsl_shader_program(const struct wined3d_context *context, } checkGLcall("glBindAttribLocationARB"); - list_add_head(&((IWineD3DBaseShaderImpl *)vshader)->baseShader.linked_programs, &entry->vshader_entry); + list_add_head(&vshader->linked_programs, &entry->vshader_entry); } /* Attach GLSL pshader */ if (pshader) { GLhandleARB pshader_id = find_glsl_pshader(context, &priv->shader_buffer, - (IWineD3DPixelShaderImpl *)pshader, &ps_compile_args, &entry->np2Fixup_info); + pshader, &ps_compile_args, &entry->np2Fixup_info); TRACE("Attaching GLSL shader object %u to program %u\n", pshader_id, programId); GL_EXTCALL(glAttachObjectARB(programId, pshader_id)); checkGLcall("glAttachObjectARB"); - list_add_head(&((IWineD3DBaseShaderImpl *)pshader)->baseShader.linked_programs, &entry->pshader_entry); + list_add_head(&pshader->linked_programs, &entry->pshader_entry); } /* Link the program */ @@ -4431,9 +4448,8 @@ static void set_glsl_shader_program(const struct wined3d_context *context, entry->ycorrection_location = GL_EXTCALL(glGetUniformLocationARB(programId, "ycorrection")); checkGLcall("Find glsl program uniform locations"); - if (pshader - && ((IWineD3DPixelShaderImpl *)pshader)->baseShader.reg_maps.shader_version.major >= 3 - && ((IWineD3DPixelShaderImpl *)pshader)->declared_in_count > vec4_varyings(3, gl_info)) + if (pshader && pshader->reg_maps.shader_version.major >= 3 + && pshader->u.ps.declared_in_count > vec4_varyings(3, gl_info)) { TRACE("Shader %d needs vertex color clamping disabled\n", programId); entry->vertex_color_clamp = GL_FALSE; @@ -4460,14 +4476,10 @@ static void set_glsl_shader_program(const struct wined3d_context *context, * load them now to have them hardcoded in the GLSL program. This saves some CPU cycles * later */ - if (pshader && !((IWineD3DBaseShaderImpl *)pshader)->baseShader.load_local_constsF) - { - hardcode_local_constants((IWineD3DBaseShaderImpl *) pshader, gl_info, programId, 'P'); - } - if (vshader && !((IWineD3DBaseShaderImpl *)vshader)->baseShader.load_local_constsF) - { - hardcode_local_constants((IWineD3DBaseShaderImpl *) vshader, gl_info, programId, 'V'); - } + if (pshader && !pshader->load_local_constsF) + hardcode_local_constants(pshader, gl_info, programId, 'P'); + if (vshader && !vshader->load_local_constsF) + hardcode_local_constants(vshader, gl_info, programId, 'V'); } /* GL locking is done by the caller */ @@ -4556,7 +4568,7 @@ static GLhandleARB create_glsl_blt_shader(const struct wined3d_gl_info *gl_info, if (!blt_pshader) { FIXME("tex_type %#x not supported\n", tex_type); - tex_type = tex_2d; + return 0; } vshader_id = GL_EXTCALL(glCreateShaderObjectARB(GL_VERTEX_SHADER_ARB)); @@ -4584,7 +4596,7 @@ static GLhandleARB create_glsl_blt_shader(const struct wined3d_gl_info *gl_info, static void shader_glsl_select(const struct wined3d_context *context, BOOL usePS, BOOL useVS) { const struct wined3d_gl_info *gl_info = context->gl_info; - IWineD3DDeviceImpl *device = context->swapchain->device; + struct wined3d_device *device = context->swapchain->device; struct shader_glsl_priv *priv = device->shader_priv; GLhandleARB program_id = 0; GLenum old_vertex_color_clamp, current_vertex_color_clamp; @@ -4619,18 +4631,16 @@ static void shader_glsl_select(const struct wined3d_context *context, BOOL usePS * called between selecting the shader and using it, which results in wrong fixup for some frames. */ if (priv->glsl_program && priv->glsl_program->np2Fixup_info) { - shader_glsl_load_np2fixup_constants((IWineD3DDevice *)device, usePS, useVS); + shader_glsl_load_np2fixup_constants(priv, gl_info, &device->stateBlock->state); } } /* GL locking is done by the caller */ -static void shader_glsl_select_depth_blt(IWineD3DDevice *iface, +static void shader_glsl_select_depth_blt(void *shader_priv, const struct wined3d_gl_info *gl_info, enum tex_types tex_type, const SIZE *ds_mask_size) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - const struct wined3d_gl_info *gl_info = &This->adapter->gl_info; BOOL masked = ds_mask_size->cx && ds_mask_size->cy; - struct shader_glsl_priv *priv = This->shader_priv; + struct shader_glsl_priv *priv = shader_priv; GLhandleARB *blt_program; GLint loc; @@ -4655,10 +4665,9 @@ static void shader_glsl_select_depth_blt(IWineD3DDevice *iface, } /* GL locking is done by the caller */ -static void shader_glsl_deselect_depth_blt(IWineD3DDevice *iface) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - const struct wined3d_gl_info *gl_info = &This->adapter->gl_info; - struct shader_glsl_priv *priv = This->shader_priv; +static void shader_glsl_deselect_depth_blt(void *shader_priv, const struct wined3d_gl_info *gl_info) +{ + struct shader_glsl_priv *priv = shader_priv; GLhandleARB program_id; program_id = priv->glsl_program ? priv->glsl_program->programId : 0; @@ -4668,52 +4677,52 @@ static void shader_glsl_deselect_depth_blt(IWineD3DDevice *iface) { checkGLcall("glUseProgramObjectARB"); } -static void shader_glsl_destroy(IWineD3DBaseShader *iface) { - const struct list *linked_programs; - IWineD3DBaseShaderImpl *This = (IWineD3DBaseShaderImpl *) iface; - IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)This->baseShader.device; +static void shader_glsl_destroy(struct wined3d_shader *shader) +{ + struct wined3d_device *device = shader->device; struct shader_glsl_priv *priv = device->shader_priv; const struct wined3d_gl_info *gl_info; + const struct list *linked_programs; struct wined3d_context *context; - /* Note: Do not use QueryInterface here to find out which shader type this is because this code - * can be called from IWineD3DBaseShader::Release - */ - char pshader = shader_is_pshader_version(This->baseShader.reg_maps.shader_version.type); + char pshader = shader_is_pshader_version(shader->reg_maps.shader_version.type); + + if (pshader) + { + struct glsl_pshader_private *shader_data = shader->backend_data; - if(pshader) { - struct glsl_pshader_private *shader_data; - shader_data = This->baseShader.backend_data; if (!shader_data || !shader_data->num_gl_shaders) { HeapFree(GetProcessHeap(), 0, shader_data); - This->baseShader.backend_data = NULL; + shader->backend_data = NULL; return; } context = context_acquire(device, NULL); gl_info = context->gl_info; - if (priv->glsl_program && (IWineD3DBaseShader *)priv->glsl_program->pshader == iface) + if (priv->glsl_program && priv->glsl_program->pshader == shader) { ENTER_GL(); shader_glsl_select(context, FALSE, FALSE); LEAVE_GL(); } - } else { - struct glsl_vshader_private *shader_data; - shader_data = This->baseShader.backend_data; + } + else + { + struct glsl_vshader_private *shader_data = shader->backend_data; + if (!shader_data || !shader_data->num_gl_shaders) { HeapFree(GetProcessHeap(), 0, shader_data); - This->baseShader.backend_data = NULL; + shader->backend_data = NULL; return; } context = context_acquire(device, NULL); gl_info = context->gl_info; - if (priv->glsl_program && (IWineD3DBaseShader *)priv->glsl_program->vshader == iface) + if (priv->glsl_program && priv->glsl_program->vshader == shader) { ENTER_GL(); shader_glsl_select(context, FALSE, FALSE); @@ -4721,7 +4730,7 @@ static void shader_glsl_destroy(IWineD3DBaseShader *iface) { } } - linked_programs = &This->baseShader.linked_programs; + linked_programs = &shader->linked_programs; TRACE("Deleting linked programs\n"); if (linked_programs->next) { @@ -4740,9 +4749,10 @@ static void shader_glsl_destroy(IWineD3DBaseShader *iface) { LEAVE_GL(); } - if(pshader) { + if (pshader) + { + struct glsl_pshader_private *shader_data = shader->backend_data; UINT i; - struct glsl_pshader_private *shader_data = This->baseShader.backend_data; ENTER_GL(); for(i = 0; i < shader_data->num_gl_shaders; i++) { @@ -4755,8 +4765,8 @@ static void shader_glsl_destroy(IWineD3DBaseShader *iface) { } else { + struct glsl_vshader_private *shader_data = shader->backend_data; UINT i; - struct glsl_vshader_private *shader_data = This->baseShader.backend_data; ENTER_GL(); for(i = 0; i < shader_data->num_gl_shaders; i++) { @@ -4768,15 +4778,15 @@ static void shader_glsl_destroy(IWineD3DBaseShader *iface) { HeapFree(GetProcessHeap(), 0, shader_data->gl_shaders); } - HeapFree(GetProcessHeap(), 0, This->baseShader.backend_data); - This->baseShader.backend_data = NULL; + HeapFree(GetProcessHeap(), 0, shader->backend_data); + shader->backend_data = NULL; context_release(context); } static int glsl_program_key_compare(const void *key, const struct wine_rb_entry *entry) { - const glsl_program_key_t *k = key; + const struct glsl_program_key *k = key; const struct glsl_shader_prog_link *prog = WINE_RB_ENTRY_VALUE(entry, const struct glsl_shader_prog_link, program_lookup_entry); int cmp; @@ -4825,9 +4835,9 @@ static const struct wine_rb_functions wined3d_glsl_program_rb_functions = glsl_program_key_compare, }; -static HRESULT shader_glsl_alloc(IWineD3DDevice *iface) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - const struct wined3d_gl_info *gl_info = &This->adapter->gl_info; +static HRESULT shader_glsl_alloc(struct wined3d_device *device) +{ + const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; struct shader_glsl_priv *priv = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct shader_glsl_priv)); SIZE_T stack_size = wined3d_log2i(max(gl_info->limits.glsl_vs_float_constants, gl_info->limits.glsl_ps_float_constants)) + 1; @@ -4865,7 +4875,7 @@ static HRESULT shader_glsl_alloc(IWineD3DDevice *iface) { priv->next_constant_version = 1; - This->shader_priv = priv; + device->shader_priv = priv; return WINED3D_OK; fail: @@ -4878,10 +4888,10 @@ fail: } /* Context activation is done by the caller. */ -static void shader_glsl_free(IWineD3DDevice *iface) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - const struct wined3d_gl_info *gl_info = &This->adapter->gl_info; - struct shader_glsl_priv *priv = This->shader_priv; +static void shader_glsl_free(struct wined3d_device *device) +{ + const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; + struct shader_glsl_priv *priv = device->shader_priv; int i; ENTER_GL(); @@ -4904,51 +4914,49 @@ static void shader_glsl_free(IWineD3DDevice *iface) { HeapFree(GetProcessHeap(), 0, priv->stack); shader_buffer_free(&priv->shader_buffer); - HeapFree(GetProcessHeap(), 0, This->shader_priv); - This->shader_priv = NULL; + HeapFree(GetProcessHeap(), 0, device->shader_priv); + device->shader_priv = NULL; } -static BOOL shader_glsl_dirty_const(IWineD3DDevice *iface) { +static BOOL shader_glsl_dirty_const(void) +{ /* TODO: GL_EXT_bindable_uniform can be used to share constants across shaders */ return FALSE; } -static void shader_glsl_get_caps(const struct wined3d_gl_info *gl_info, struct shader_caps *pCaps) +static void shader_glsl_get_caps(const struct wined3d_gl_info *gl_info, struct shader_caps *caps) { - /* Nvidia Geforce6/7 or Ati R4xx/R5xx cards with GLSL support, support VS 3.0 but older Nvidia/Ati - * models with GLSL support only support 2.0. In case of nvidia we can detect VS 2.0 support based - * on the version of NV_vertex_program. - * For Ati cards there's no way using glsl (it abstracts the lowlevel info away) and also not - * using ARB_vertex_program. It is safe to assume that when a card supports pixel shader 2.0 it - * supports vertex shader 2.0 too and the way around. We can detect ps2.0 using the maximum number - * of native instructions, so use that here. For more info see the pixel shader versioning code below. - */ - if ((gl_info->supported[NV_VERTEX_PROGRAM2] && !gl_info->supported[NV_VERTEX_PROGRAM3]) - || gl_info->limits.arb_ps_instructions <= 512) - pCaps->VertexShaderVersion = WINED3DVS_VERSION(2,0); - else - pCaps->VertexShaderVersion = WINED3DVS_VERSION(3,0); - TRACE_(d3d_caps)("Hardware vertex shader version %d.%d enabled (GLSL)\n", (pCaps->VertexShaderVersion >> 8) & 0xff, pCaps->VertexShaderVersion & 0xff); - pCaps->MaxVertexShaderConst = gl_info->limits.glsl_vs_float_constants; - - /* Older DX9-class videocards (GeforceFX / Radeon >9500/X*00) only support pixel shader 2.0/2.0a/2.0b. - * In OpenGL the extensions related to GLSL abstract lowlevel GL info away which is needed - * to distinguish between 2.0 and 3.0 (and 2.0a/2.0b). In case of Nvidia we use their fragment - * program extensions. On other hardware including ATI GL_ARB_fragment_program offers the info - * in max native instructions. Intel and others also offer the info in this extension but they - * don't support GLSL (at least on Windows). + /* NVIDIA GeForce 6 / 7 or ATI R4xx / R5xx cards with GLSL support + * support SM3, but older NVIDIA / ATI models with GLSL support only + * support SM2. In case of NVIDIA we can detect SM3 support based on the + * version of NV_vertex_program / NV_fragment_program. For other cards we + * try to detect SM3 based on the maximum number of native fragment + * program instructions. PS2.0 requires at least 96 instructions, 2.0a/b + * goes up to 512. Assume that if the number of instructions is 512 or + * less we have to do with SM2 hardware. NOTE: SM3 requires 512 or more + * instructions but ATI and NVIDIA offer more than that (1024 vs 4096) on + * their most basic SM3 hardware. * - * PS2.0 requires at least 96 instructions, 2.0a/2.0b go up to 512. Assume that if the number - * of instructions is 512 or less we have to do with ps2.0 hardware. - * NOTE: ps3.0 hardware requires 512 or more instructions but ati and nvidia offer 'enough' (1024 vs 4096) on their most basic ps3.0 hardware. - */ - if ((gl_info->supported[NV_FRAGMENT_PROGRAM] && !gl_info->supported[NV_FRAGMENT_PROGRAM2]) - || gl_info->limits.arb_ps_instructions <= 512) - pCaps->PixelShaderVersion = WINED3DPS_VERSION(2,0); + * ARB_shader_texture_lod is a requirement for SM3 (texldd). Ideally we'd + * make this a hard requirement, but the extension is still somewhat new, + * and relatively few SM3 shaders actually depend on it. For the moment + * just use it to enable SM3 (20110423). */ + if ((gl_info->supported[NV_VERTEX_PROGRAM3] && gl_info->supported[NV_FRAGMENT_PROGRAM2]) + || gl_info->limits.arb_ps_instructions > 512 + || gl_info->supported[ARB_SHADER_TEXTURE_LOD] + || gl_info->supported[EXT_GPU_SHADER4]) + { + caps->VertexShaderVersion = WINED3DVS_VERSION(3,0); + caps->PixelShaderVersion = WINED3DPS_VERSION(3,0); + } else - pCaps->PixelShaderVersion = WINED3DPS_VERSION(3,0); + { + caps->VertexShaderVersion = WINED3DVS_VERSION(2,0); + caps->PixelShaderVersion = WINED3DPS_VERSION(2,0); + } - pCaps->MaxPixelShaderConst = gl_info->limits.glsl_ps_float_constants; + caps->MaxVertexShaderConst = gl_info->limits.glsl_vs_float_constants; + caps->MaxPixelShaderConst = gl_info->limits.glsl_ps_float_constants; /* FIXME: The following line is card dependent. -8.0 to 8.0 is the * Direct3D minimum requirement. @@ -4962,10 +4970,14 @@ static void shader_glsl_get_caps(const struct wined3d_gl_info *gl_info, struct s * the shader will generate incorrect results too. Unfortunately, GL deliberately doesn't * offer a way to query this. */ - pCaps->PixelShader1xMaxValue = 8.0; - TRACE_(d3d_caps)("Hardware pixel shader version %d.%d enabled (GLSL)\n", (pCaps->PixelShaderVersion >> 8) & 0xff, pCaps->PixelShaderVersion & 0xff); + caps->PixelShader1xMaxValue = 8.0; - pCaps->VSClipping = TRUE; + caps->VSClipping = TRUE; + + TRACE_(d3d_caps)("Hardware vertex shader version %u.%u enabled (GLSL).\n", + (caps->VertexShaderVersion >> 8) & 0xff, caps->VertexShaderVersion & 0xff); + TRACE_(d3d_caps)("Hardware pixel shader version %u.%u enabled (GLSL).\n", + (caps->PixelShaderVersion >> 8) & 0xff, caps->PixelShaderVersion & 0xff); } static BOOL shader_glsl_color_fixup_supported(struct color_fixup_desc fixup) @@ -5006,6 +5018,7 @@ static const SHADER_HANDLER shader_glsl_instruction_handler_table[WINED3DSIH_TAB /* WINED3DSIH_DEF */ NULL, /* WINED3DSIH_DEFB */ NULL, /* WINED3DSIH_DEFI */ NULL, + /* WINED3DSIH_DIV */ NULL, /* WINED3DSIH_DP2ADD */ shader_glsl_dp2add, /* WINED3DSIH_DP3 */ shader_glsl_dot, /* WINED3DSIH_DP4 */ shader_glsl_dot, @@ -5020,12 +5033,16 @@ static const SHADER_HANDLER shader_glsl_instruction_handler_table[WINED3DSIH_TAB /* WINED3DSIH_EXP */ shader_glsl_map2gl, /* WINED3DSIH_EXPP */ shader_glsl_expp, /* WINED3DSIH_FRC */ shader_glsl_map2gl, + /* WINED3DSIH_FTOI */ NULL, /* WINED3DSIH_IADD */ NULL, + /* WINED3DSIH_IEQ */ NULL, /* WINED3DSIH_IF */ shader_glsl_if, /* WINED3DSIH_IFC */ shader_glsl_ifc, /* WINED3DSIH_IGE */ NULL, /* WINED3DSIH_IMUL */ NULL, + /* WINED3DSIH_ITOF */ NULL, /* WINED3DSIH_LABEL */ shader_glsl_label, + /* WINED3DSIH_LD */ NULL, /* WINED3DSIH_LIT */ shader_glsl_lit, /* WINED3DSIH_LOG */ shader_glsl_log, /* WINED3DSIH_LOGP */ shader_glsl_log, @@ -5052,11 +5069,15 @@ static const SHADER_HANDLER shader_glsl_instruction_handler_table[WINED3DSIH_TAB /* WINED3DSIH_REP */ shader_glsl_rep, /* WINED3DSIH_RET */ shader_glsl_ret, /* WINED3DSIH_RSQ */ shader_glsl_rsq, + /* WINED3DSIH_SAMPLE */ NULL, + /* WINED3DSIH_SAMPLE_GRAD */ NULL, + /* WINED3DSIH_SAMPLE_LOD */ NULL, /* WINED3DSIH_SETP */ NULL, /* WINED3DSIH_SGE */ shader_glsl_compare, /* WINED3DSIH_SGN */ shader_glsl_sgn, /* WINED3DSIH_SINCOS */ shader_glsl_sincos, /* WINED3DSIH_SLT */ shader_glsl_compare, + /* WINED3DSIH_SQRT */ NULL, /* WINED3DSIH_SUB */ shader_glsl_arith, /* WINED3DSIH_TEX */ shader_glsl_tex, /* WINED3DSIH_TEXBEM */ shader_glsl_texbem, @@ -5080,6 +5101,7 @@ static const SHADER_HANDLER shader_glsl_instruction_handler_table[WINED3DSIH_TAB /* WINED3DSIH_TEXREG2AR */ shader_glsl_texreg2ar, /* WINED3DSIH_TEXREG2GB */ shader_glsl_texreg2gb, /* WINED3DSIH_TEXREG2RGB */ shader_glsl_texreg2rgb, + /* WINED3DSIH_UTOF */ NULL, }; static void shader_glsl_handle_instruction(const struct wined3d_shader_instruction *ins) { @@ -5099,7 +5121,8 @@ static void shader_glsl_handle_instruction(const struct wined3d_shader_instructi shader_glsl_add_instruction_modifiers(ins); } -const shader_backend_t glsl_shader_backend = { +const struct wined3d_shader_backend_ops glsl_shader_backend = +{ shader_glsl_handle_instruction, shader_glsl_select, shader_glsl_select_depth_blt, diff --git a/dll/directx/wine/wined3d/nvidia_texture_shader.c b/dll/directx/wine/wined3d/nvidia_texture_shader.c index 00a51f85dfa..f20fc7ac6a7 100644 --- a/dll/directx/wine/wined3d/nvidia_texture_shader.c +++ b/dll/directx/wine/wined3d/nvidia_texture_shader.c @@ -45,7 +45,7 @@ static void nvts_activate_dimensions(const struct wined3d_state *state, DWORD st if (state->textures[stage]) { - switch (state->textures[stage]->baseTexture.target) + switch (state->textures[stage]->target) { case GL_TEXTURE_2D: glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, bumpmap ? GL_OFFSET_TEXTURE_2D_NV : GL_TEXTURE_2D); @@ -456,7 +456,7 @@ void set_tex_op_nvrc(const struct wined3d_gl_info *gl_info, const struct wined3d } -static void nvrc_colorop(DWORD state_id, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void nvrc_colorop(DWORD state_id, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { DWORD stage = (state_id - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1); BOOL tex_used = stateblock->device->fixed_function_usage_map & (1 << stage); @@ -566,7 +566,7 @@ static void nvrc_colorop(DWORD state_id, IWineD3DStateBlockImpl *stateblock, str } } -static void nvts_texdim(DWORD state_id, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void nvts_texdim(DWORD state_id, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { DWORD sampler = state_id - STATE_SAMPLER(0); DWORD mapped_stage = stateblock->device->texUnitMap[sampler]; @@ -583,7 +583,7 @@ static void nvts_texdim(DWORD state_id, IWineD3DStateBlockImpl *stateblock, stru nvts_activate_dimensions(state, sampler, context); } -static void nvts_bumpenvmat(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void nvts_bumpenvmat(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1); DWORD mapped_stage = stateblock->device->texUnitMap[stage + 1]; @@ -612,7 +612,7 @@ static void nvts_bumpenvmat(DWORD state, IWineD3DStateBlockImpl *stateblock, str } } -static void nvrc_texfactor(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void nvrc_texfactor(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { const struct wined3d_gl_info *gl_info = context->gl_info; float col[4]; @@ -621,11 +621,11 @@ static void nvrc_texfactor(DWORD state, IWineD3DStateBlockImpl *stateblock, stru } /* Context activation is done by the caller. */ -static void nvrc_enable(IWineD3DDevice *iface, BOOL enable) { } +static void nvrc_enable(BOOL enable) {} -/* Context activation is done by the caller. */ -static void nvts_enable(IWineD3DDevice *iface, BOOL enable) { - ENTER_GL(); +/* Context activation and GL locking are done by the caller. */ +static void nvts_enable(BOOL enable) +{ if(enable) { glEnable(GL_TEXTURE_SHADER_NV); checkGLcall("glEnable(GL_TEXTURE_SHADER_NV)"); @@ -633,68 +633,66 @@ static void nvts_enable(IWineD3DDevice *iface, BOOL enable) { glDisable(GL_TEXTURE_SHADER_NV); checkGLcall("glDisable(GL_TEXTURE_SHADER_NV)"); } - LEAVE_GL(); } -static void nvrc_fragment_get_caps(const struct wined3d_gl_info *gl_info, struct fragment_caps *pCaps) +static void nvrc_fragment_get_caps(const struct wined3d_gl_info *gl_info, struct fragment_caps *caps) { - pCaps->PrimitiveMiscCaps = WINED3DPMISCCAPS_TSSARGTEMP; + caps->PrimitiveMiscCaps = WINED3DPMISCCAPS_TSSARGTEMP; /* The caps below can be supported but aren't handled yet in utils.c * 'd3dta_to_combiner_input', disable them until support is fixed */ #if 0 if (gl_info->supported[NV_REGISTER_COMBINERS2]) - pCaps->PrimitiveMiscCaps |= WINED3DPMISCCAPS_PERSTAGECONSTANT; + caps->PrimitiveMiscCaps |= WINED3DPMISCCAPS_PERSTAGECONSTANT; #endif - pCaps->TextureOpCaps = WINED3DTEXOPCAPS_ADD | - WINED3DTEXOPCAPS_ADDSIGNED | - WINED3DTEXOPCAPS_ADDSIGNED2X | - WINED3DTEXOPCAPS_MODULATE | - WINED3DTEXOPCAPS_MODULATE2X | - WINED3DTEXOPCAPS_MODULATE4X | - WINED3DTEXOPCAPS_SELECTARG1 | - WINED3DTEXOPCAPS_SELECTARG2 | - WINED3DTEXOPCAPS_DISABLE | - WINED3DTEXOPCAPS_BLENDDIFFUSEALPHA | - WINED3DTEXOPCAPS_BLENDTEXTUREALPHA | - WINED3DTEXOPCAPS_BLENDFACTORALPHA | - WINED3DTEXOPCAPS_BLENDCURRENTALPHA | - WINED3DTEXOPCAPS_LERP | - WINED3DTEXOPCAPS_SUBTRACT | - WINED3DTEXOPCAPS_ADDSMOOTH | - WINED3DTEXOPCAPS_MULTIPLYADD | - WINED3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR | - WINED3DTEXOPCAPS_MODULATECOLOR_ADDALPHA | - WINED3DTEXOPCAPS_BLENDTEXTUREALPHAPM | - WINED3DTEXOPCAPS_DOTPRODUCT3 | - WINED3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR | - WINED3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA; + caps->TextureOpCaps = WINED3DTEXOPCAPS_ADD + | WINED3DTEXOPCAPS_ADDSIGNED + | WINED3DTEXOPCAPS_ADDSIGNED2X + | WINED3DTEXOPCAPS_MODULATE + | WINED3DTEXOPCAPS_MODULATE2X + | WINED3DTEXOPCAPS_MODULATE4X + | WINED3DTEXOPCAPS_SELECTARG1 + | WINED3DTEXOPCAPS_SELECTARG2 + | WINED3DTEXOPCAPS_DISABLE + | WINED3DTEXOPCAPS_BLENDDIFFUSEALPHA + | WINED3DTEXOPCAPS_BLENDTEXTUREALPHA + | WINED3DTEXOPCAPS_BLENDFACTORALPHA + | WINED3DTEXOPCAPS_BLENDCURRENTALPHA + | WINED3DTEXOPCAPS_LERP + | WINED3DTEXOPCAPS_SUBTRACT + | WINED3DTEXOPCAPS_ADDSMOOTH + | WINED3DTEXOPCAPS_MULTIPLYADD + | WINED3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR + | WINED3DTEXOPCAPS_MODULATECOLOR_ADDALPHA + | WINED3DTEXOPCAPS_BLENDTEXTUREALPHAPM + | WINED3DTEXOPCAPS_DOTPRODUCT3 + | WINED3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR + | WINED3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA; if (gl_info->supported[NV_TEXTURE_SHADER2]) { /* Bump mapping is supported already in NV_TEXTURE_SHADER, but that extension does * not support 3D textures. This asks for trouble if an app uses both bump mapping * and 3D textures. It also allows us to keep the code simpler by having texture - * shaders constantly enabled. - */ - pCaps->TextureOpCaps |= WINED3DTEXOPCAPS_BUMPENVMAP; + * shaders constantly enabled. */ + caps->TextureOpCaps |= WINED3DTEXOPCAPS_BUMPENVMAP; /* TODO: Luminance bump map? */ } #if 0 /* FIXME: Add - pCaps->TextureOpCaps |= WINED3DTEXOPCAPS_BUMPENVMAPLUMINANCE + caps->TextureOpCaps |= WINED3DTEXOPCAPS_BUMPENVMAPLUMINANCE WINED3DTEXOPCAPS_PREMODULATE */ #endif - pCaps->MaxTextureBlendStages = min(MAX_TEXTURES, gl_info->limits.general_combiners); - pCaps->MaxSimultaneousTextures = gl_info->limits.textures; + caps->MaxTextureBlendStages = min(MAX_TEXTURES, gl_info->limits.general_combiners); + caps->MaxSimultaneousTextures = gl_info->limits.textures; } -static HRESULT nvrc_fragment_alloc(IWineD3DDevice *iface) { return WINED3D_OK; } +static HRESULT nvrc_fragment_alloc(struct wined3d_device *device) { return WINED3D_OK; } /* Context activation is done by the caller. */ -static void nvrc_fragment_free(IWineD3DDevice *iface) {} +static void nvrc_fragment_free(struct wined3d_device *device) {} /* Two fixed function pipeline implementations using GL_NV_register_combiners and * GL_NV_texture_shader. The nvts_fragment_pipeline assumes that both extensions diff --git a/dll/directx/wine/wined3d/palette.c b/dll/directx/wine/wined3d/palette.c index 2b7ce2cfc20..1fcc6ba1c9a 100644 --- a/dll/directx/wine/wined3d/palette.c +++ b/dll/directx/wine/wined3d/palette.c @@ -30,183 +30,145 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d); #define SIZE_BITS (WINEDDPCAPS_1BIT | WINEDDPCAPS_2BIT | WINEDDPCAPS_4BIT | WINEDDPCAPS_8BIT) -static HRESULT WINAPI IWineD3DPaletteImpl_QueryInterface(IWineD3DPalette *iface, REFIID riid, void **object) +ULONG CDECL wined3d_palette_incref(struct wined3d_palette *palette) { - TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object); + ULONG refcount = InterlockedIncrement(&palette->ref); - if (IsEqualGUID(riid, &IID_IWineD3DPalette) - || IsEqualGUID(riid, &IID_IWineD3DBase) - || IsEqualGUID(riid, &IID_IUnknown)) + TRACE("%p increasing refcount to %u.\n", palette, refcount); + + return refcount; +} + +ULONG CDECL wined3d_palette_decref(struct wined3d_palette *palette) +{ + ULONG refcount = InterlockedDecrement(&palette->ref); + + TRACE("%p decreasing refcount to %u.\n", palette, refcount); + + if (!refcount) { - IUnknown_AddRef(iface); - *object = iface; - return S_OK; + DeleteObject(palette->hpal); + HeapFree(GetProcessHeap(), 0, palette); } - WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid)); - - *object = NULL; - return E_NOINTERFACE; + return refcount; } -static ULONG WINAPI IWineD3DPaletteImpl_AddRef(IWineD3DPalette *iface) { - IWineD3DPaletteImpl *This = (IWineD3DPaletteImpl *)iface; - ULONG ref = InterlockedIncrement(&This->ref); - - TRACE("(%p)->() incrementing from %u.\n", This, ref - 1); - - return ref; -} - -static ULONG WINAPI IWineD3DPaletteImpl_Release(IWineD3DPalette *iface) { - IWineD3DPaletteImpl *This = (IWineD3DPaletteImpl *)iface; - ULONG ref = InterlockedDecrement(&This->ref); - - TRACE("(%p)->() decrementing from %u.\n", This, ref + 1); - - if (!ref) { - DeleteObject(This->hpal); - HeapFree(GetProcessHeap(), 0, This); - return 0; - } - - return ref; -} - -/* Not called from the vtable */ -static WORD IWineD3DPaletteImpl_Size(DWORD dwFlags) +static WORD wined3d_palette_size(DWORD flags) { - switch (dwFlags & SIZE_BITS) { + switch (flags & SIZE_BITS) + { case WINEDDPCAPS_1BIT: return 2; case WINEDDPCAPS_2BIT: return 4; case WINEDDPCAPS_4BIT: return 16; case WINEDDPCAPS_8BIT: return 256; default: - FIXME("Unhandled size bits %#x.\n", dwFlags & SIZE_BITS); + FIXME("Unhandled size bits %#x.\n", flags & SIZE_BITS); return 256; } } -static HRESULT WINAPI IWineD3DPaletteImpl_GetEntries(IWineD3DPalette *iface, DWORD Flags, DWORD Start, DWORD Count, PALETTEENTRY *PalEnt) { - IWineD3DPaletteImpl *This = (IWineD3DPaletteImpl *)iface; +HRESULT CDECL wined3d_palette_get_entries(const struct wined3d_palette *palette, + DWORD flags, DWORD start, DWORD count, PALETTEENTRY *entries) +{ + TRACE("palette %p, flags %#x, start %u, count %u, entries %p.\n", + palette, flags, start, count, entries); - TRACE("(%p)->(%08x,%d,%d,%p)\n",This,Flags,Start,Count,PalEnt); - - if (Flags) return WINED3DERR_INVALIDCALL; /* unchecked */ - if (Start + Count > IWineD3DPaletteImpl_Size(This->Flags)) + if (flags) return WINED3DERR_INVALIDCALL; /* unchecked */ + if (start + count > wined3d_palette_size(palette->flags)) return WINED3DERR_INVALIDCALL; - if (This->Flags & WINEDDPCAPS_8BITENTRIES) + if (palette->flags & WINEDDPCAPS_8BITENTRIES) { + BYTE *entry = (BYTE *)entries; unsigned int i; - LPBYTE entry = (LPBYTE)PalEnt; - for (i=Start; i < Count+Start; i++) - *entry++ = This->palents[i].peRed; + for (i = start; i < count + start; ++i) + *entry++ = palette->palents[i].peRed; } else - memcpy(PalEnt, This->palents+Start, Count * sizeof(PALETTEENTRY)); + memcpy(entries, palette->palents + start, count * sizeof(*entries)); return WINED3D_OK; } -static HRESULT WINAPI IWineD3DPaletteImpl_SetEntries(IWineD3DPalette *iface, - DWORD Flags, DWORD Start, DWORD Count, const PALETTEENTRY *PalEnt) +HRESULT CDECL wined3d_palette_set_entries(struct wined3d_palette *palette, + DWORD flags, DWORD start, DWORD count, const PALETTEENTRY *entries) { - IWineD3DPaletteImpl *This = (IWineD3DPaletteImpl *)iface; - IWineD3DResourceImpl *res; + struct wined3d_resource *resource; - TRACE("(%p)->(%08x,%d,%d,%p)\n",This,Flags,Start,Count,PalEnt); - TRACE("Palette flags: %#x\n", This->Flags); + TRACE("palette %p, flags %#x, start %u, count %u, entries %p.\n", + palette, flags, start, count, entries); + TRACE("Palette flags: %#x.\n", palette->flags); - if (This->Flags & WINEDDPCAPS_8BITENTRIES) { + if (palette->flags & WINEDDPCAPS_8BITENTRIES) + { + const BYTE *entry = (const BYTE *)entries; unsigned int i; - const BYTE* entry = (const BYTE*)PalEnt; - for (i=Start; i < Count+Start; i++) - This->palents[i].peRed = *entry++; + for (i = start; i < count + start; ++i) + palette->palents[i].peRed = *entry++; } - else { - memcpy(This->palents+Start, PalEnt, Count * sizeof(PALETTEENTRY)); + else + { + memcpy(palette->palents + start, entries, count * sizeof(*palette->palents)); /* When WINEDDCAPS_ALLOW256 isn't set we need to override entry 0 with black and 255 with white */ - if(!(This->Flags & WINEDDPCAPS_ALLOW256)) + if (!(palette->flags & WINEDDPCAPS_ALLOW256)) { TRACE("WINEDDPCAPS_ALLOW256 set, overriding palette entry 0 with black and 255 with white\n"); - This->palents[0].peRed = 0; - This->palents[0].peGreen = 0; - This->palents[0].peBlue = 0; + palette->palents[0].peRed = 0; + palette->palents[0].peGreen = 0; + palette->palents[0].peBlue = 0; - This->palents[255].peRed = 255; - This->palents[255].peGreen = 255; - This->palents[255].peBlue = 255; + palette->palents[255].peRed = 255; + palette->palents[255].peGreen = 255; + palette->palents[255].peBlue = 255; } - if (This->hpal) - SetPaletteEntries(This->hpal, Start, Count, This->palents+Start); + if (palette->hpal) + SetPaletteEntries(palette->hpal, start, count, palette->palents + start); } -#if 0 - /* Now, if we are in 'depth conversion mode', update the screen palette */ - /* FIXME: we need to update the image or we won't get palette fading. */ - if (This->ddraw->d->palette_convert) - This->ddraw->d->palette_convert(palent,This->screen_palents,start,count); -#endif - /* If the palette is attached to the render target, update all render targets */ - - LIST_FOR_EACH_ENTRY(res, &This->device->resources, IWineD3DResourceImpl, resource.resource_list_entry) + LIST_FOR_EACH_ENTRY(resource, &palette->device->resources, struct wined3d_resource, resource_list_entry) { - if(IWineD3DResource_GetType((IWineD3DResource *) res) == WINED3DRTYPE_SURFACE) { - IWineD3DSurfaceImpl *impl = (IWineD3DSurfaceImpl *) res; - if(impl->palette == This) - IWineD3DSurface_RealizePalette((IWineD3DSurface *) res); + if (resource->resourceType == WINED3DRTYPE_SURFACE) + { + struct wined3d_surface *surface = surface_from_resource(resource); + if (surface->palette == palette) + surface->surface_ops->surface_realize_palette(surface); } } return WINED3D_OK; } -static HRESULT WINAPI IWineD3DPaletteImpl_GetCaps(IWineD3DPalette *iface, DWORD *Caps) { - IWineD3DPaletteImpl *This = (IWineD3DPaletteImpl *)iface; - TRACE("(%p)->(%p)\n", This, Caps); +DWORD CDECL wined3d_palette_get_flags(const struct wined3d_palette *palette) +{ + TRACE("palette %p.\n", palette); - *Caps = This->Flags; - return WINED3D_OK; + return palette->flags; } -static void * WINAPI IWineD3DPaletteImpl_GetParent(IWineD3DPalette *iface) +void * CDECL wined3d_palette_get_parent(const struct wined3d_palette *palette) { - TRACE("iface %p.\n", iface); + TRACE("palette %p.\n", palette); - return ((IWineD3DPaletteImpl *)iface)->parent; + return palette->parent; } -static const IWineD3DPaletteVtbl IWineD3DPalette_Vtbl = -{ - /*** IUnknown ***/ - IWineD3DPaletteImpl_QueryInterface, - IWineD3DPaletteImpl_AddRef, - IWineD3DPaletteImpl_Release, - /*** IWineD3DPalette ***/ - IWineD3DPaletteImpl_GetParent, - IWineD3DPaletteImpl_GetEntries, - IWineD3DPaletteImpl_GetCaps, - IWineD3DPaletteImpl_SetEntries -}; - -HRESULT wined3d_palette_init(IWineD3DPaletteImpl *palette, IWineD3DDeviceImpl *device, +static HRESULT wined3d_palette_init(struct wined3d_palette *palette, struct wined3d_device *device, DWORD flags, const PALETTEENTRY *entries, void *parent) { HRESULT hr; - palette->lpVtbl = &IWineD3DPalette_Vtbl; palette->ref = 1; palette->parent = parent; palette->device = device; - palette->Flags = flags; + palette->flags = flags; - palette->palNumEntries = IWineD3DPaletteImpl_Size(flags); + palette->palNumEntries = wined3d_palette_size(flags); palette->hpal = CreatePalette((const LOGPALETTE *)&palette->palVersion); if (!palette->hpal) { @@ -214,7 +176,7 @@ HRESULT wined3d_palette_init(IWineD3DPaletteImpl *palette, IWineD3DDeviceImpl *d return E_FAIL; } - hr = IWineD3DPalette_SetEntries((IWineD3DPalette *)palette, 0, 0, IWineD3DPaletteImpl_Size(flags), entries); + hr = wined3d_palette_set_entries(palette, 0, 0, wined3d_palette_size(flags), entries); if (FAILED(hr)) { WARN("Failed to set palette entries, hr %#x.\n", hr); @@ -224,3 +186,33 @@ HRESULT wined3d_palette_init(IWineD3DPaletteImpl *palette, IWineD3DDeviceImpl *d return WINED3D_OK; } + +HRESULT CDECL wined3d_palette_create(struct wined3d_device *device, DWORD flags, + const PALETTEENTRY *entries, void *parent, struct wined3d_palette **palette) +{ + struct wined3d_palette *object; + HRESULT hr; + + TRACE("device %p, flags %#x, entries %p, palette %p, parent %p.\n", + device, flags, entries, palette, parent); + + object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); + if (!object) + { + ERR("Failed to allocate palette memory.\n"); + return E_OUTOFMEMORY; + } + + hr = wined3d_palette_init(object, device, flags, entries, parent); + if (FAILED(hr)) + { + WARN("Failed to initialize palette, hr %#x.\n", hr); + HeapFree(GetProcessHeap(), 0, object); + return hr; + } + + TRACE("Created palette %p.\n", object); + *palette = object; + + return WINED3D_OK; +} diff --git a/dll/directx/wine/wined3d/query.c b/dll/directx/wine/wined3d/query.c index 254efbed825..ca4426f5cc7 100644 --- a/dll/directx/wine/wined3d/query.c +++ b/dll/directx/wine/wined3d/query.c @@ -3,7 +3,7 @@ * * Copyright 2005 Oliver Stieber * Copyright 2007-2008 Stefan Dösinger for CodeWeavers - * Copyright 2009 Henri Verbeet for CodeWeavers. + * Copyright 2009-2010 Henri Verbeet for CodeWeavers. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -37,7 +37,8 @@ void wined3d_event_query_destroy(struct wined3d_event_query *query) HeapFree(GetProcessHeap(), 0, query); } -enum wined3d_event_query_result wined3d_event_query_test(struct wined3d_event_query *query, IWineD3DDeviceImpl *device) +static enum wined3d_event_query_result wined3d_event_query_test(struct wined3d_event_query *query, + struct wined3d_device *device) { struct wined3d_context *context; const struct wined3d_gl_info *gl_info; @@ -111,7 +112,8 @@ enum wined3d_event_query_result wined3d_event_query_test(struct wined3d_event_qu return ret; } -enum wined3d_event_query_result wined3d_event_query_finish(struct wined3d_event_query *query, IWineD3DDeviceImpl *device) +enum wined3d_event_query_result wined3d_event_query_finish(struct wined3d_event_query *query, + struct wined3d_device *device) { struct wined3d_context *context; const struct wined3d_gl_info *gl_info; @@ -179,7 +181,7 @@ enum wined3d_event_query_result wined3d_event_query_finish(struct wined3d_event_ return ret; } -void wined3d_event_query_issue(struct wined3d_event_query *query, IWineD3DDeviceImpl *device) +void wined3d_event_query_issue(struct wined3d_event_query *query, struct wined3d_device *device) { const struct wined3d_gl_info *gl_info; struct wined3d_context *context; @@ -230,64 +232,74 @@ void wined3d_event_query_issue(struct wined3d_event_query *query, IWineD3DDevice context_release(context); } -static HRESULT WINAPI IWineD3DQueryImpl_QueryInterface(IWineD3DQuery *iface, REFIID riid, void **object) +ULONG CDECL wined3d_query_incref(struct wined3d_query *query) { - TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object); + ULONG refcount = InterlockedIncrement(&query->ref); - if (IsEqualGUID(riid, &IID_IWineD3DQuery) - || IsEqualGUID(riid, &IID_IUnknown)) - { - IUnknown_AddRef(iface); - *object = iface; - return S_OK; - } + TRACE("%p increasing refcount to %u.\n", query, refcount); - WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid)); - - *object = NULL; - return E_NOINTERFACE; + return refcount; } -static ULONG WINAPI IWineD3DQueryImpl_AddRef(IWineD3DQuery *iface) { - IWineD3DQueryImpl *This = (IWineD3DQueryImpl *)iface; - TRACE("(%p) : AddRef increasing from %d\n", This, This->ref); - return InterlockedIncrement(&This->ref); -} +ULONG CDECL wined3d_query_decref(struct wined3d_query *query) +{ + ULONG refcount = InterlockedDecrement(&query->ref); -static ULONG WINAPI IWineD3DQueryImpl_Release(IWineD3DQuery *iface) { - IWineD3DQueryImpl *This = (IWineD3DQueryImpl *)iface; - ULONG ref; - TRACE("(%p) : Releasing from %d\n", This, This->ref); - ref = InterlockedDecrement(&This->ref); + TRACE("%p decreasing refcount to %u.\n", query, refcount); - if (!ref) + if (!refcount) { /* Queries are specific to the GL context that created them. Not * deleting the query will obviously leak it, but that's still better * than potentially deleting a different query with the same id in this * context, and (still) leaking the actual query. */ - if (This->type == WINED3DQUERYTYPE_EVENT) + if (query->type == WINED3DQUERYTYPE_EVENT) { - struct wined3d_event_query *query = This->extendedData; - if (query) wined3d_event_query_destroy(query); + struct wined3d_event_query *event_query = query->extendedData; + if (event_query) wined3d_event_query_destroy(event_query); } - else if (This->type == WINED3DQUERYTYPE_OCCLUSION) + else if (query->type == WINED3DQUERYTYPE_OCCLUSION) { - struct wined3d_occlusion_query *query = This->extendedData; + struct wined3d_occlusion_query *oq = query->extendedData; - if (query->context) context_free_occlusion_query(query); - HeapFree(GetProcessHeap(), 0, This->extendedData); + if (oq->context) context_free_occlusion_query(oq); + HeapFree(GetProcessHeap(), 0, query->extendedData); } - HeapFree(GetProcessHeap(), 0, This); + HeapFree(GetProcessHeap(), 0, query); } - return ref; + + return refcount; } -static HRESULT WINAPI IWineD3DOcclusionQueryImpl_GetData(IWineD3DQuery* iface, void* pData, DWORD dwSize, DWORD dwGetDataFlags) { - IWineD3DQueryImpl *This = (IWineD3DQueryImpl *) iface; - struct wined3d_occlusion_query *query = This->extendedData; - IWineD3DDeviceImpl *device = This->device; +HRESULT CDECL wined3d_query_get_data(struct wined3d_query *query, + void *data, UINT data_size, DWORD flags) +{ + TRACE("query %p, data %p, data_size %u, flags %#x.\n", + query, data, data_size, flags); + + return query->query_ops->query_get_data(query, data, data_size, flags); +} + +UINT CDECL wined3d_query_get_data_size(const struct wined3d_query *query) +{ + TRACE("query %p.\n", query); + + return query->data_size; +} + +HRESULT CDECL wined3d_query_issue(struct wined3d_query *query, DWORD flags) +{ + TRACE("query %p, flags %#x.\n", query, flags); + + return query->query_ops->query_issue(query, flags); +} + +static HRESULT wined3d_occlusion_query_ops_get_data(struct wined3d_query *query, + void *pData, DWORD dwSize, DWORD flags) +{ + struct wined3d_occlusion_query *oq = query->extendedData; + struct wined3d_device *device = query->device; const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; struct wined3d_context *context; DWORD* data = pData; @@ -295,11 +307,12 @@ static HRESULT WINAPI IWineD3DOcclusionQueryImpl_GetData(IWineD3DQuery* iface, GLuint samples; HRESULT res; - TRACE("(%p) : type D3DQUERY_OCCLUSION, pData %p, dwSize %#x, dwGetDataFlags %#x\n", This, pData, dwSize, dwGetDataFlags); + TRACE("(%p) : type D3DQUERY_OCCLUSION, pData %p, dwSize %#x, flags %#x.\n", query, pData, dwSize, flags); - if (!query->context) This->state = QUERY_CREATED; + if (!oq->context) + query->state = QUERY_CREATED; - if (This->state == QUERY_CREATED) + if (query->state == QUERY_CREATED) { /* D3D allows GetData on a new query, OpenGL doesn't. So just invent the data ourselves */ TRACE("Query wasn't yet started, returning S_OK\n"); @@ -307,7 +320,7 @@ static HRESULT WINAPI IWineD3DOcclusionQueryImpl_GetData(IWineD3DQuery* iface, return S_OK; } - if (This->state == QUERY_BUILDING) + if (query->state == QUERY_BUILDING) { /* Msdn says this returns an error, but our tests show that S_FALSE is returned */ TRACE("Query is building, returning S_FALSE\n"); @@ -316,33 +329,33 @@ static HRESULT WINAPI IWineD3DOcclusionQueryImpl_GetData(IWineD3DQuery* iface, if (!gl_info->supported[ARB_OCCLUSION_QUERY]) { - WARN("(%p) : Occlusion queries not supported. Returning 1.\n", This); + WARN("%p Occlusion queries not supported. Returning 1.\n", query); *data = 1; return S_OK; } - if (query->context->tid != GetCurrentThreadId()) + if (oq->context->tid != GetCurrentThreadId()) { - FIXME("%p Wrong thread, returning 1.\n", This); + FIXME("%p Wrong thread, returning 1.\n", query); *data = 1; return S_OK; } - context = context_acquire(This->device, query->context->current_rt); + context = context_acquire(query->device, oq->context->current_rt); ENTER_GL(); - GL_EXTCALL(glGetQueryObjectuivARB(query->id, GL_QUERY_RESULT_AVAILABLE_ARB, &available)); + GL_EXTCALL(glGetQueryObjectuivARB(oq->id, GL_QUERY_RESULT_AVAILABLE_ARB, &available)); checkGLcall("glGetQueryObjectuivARB(GL_QUERY_RESULT_AVAILABLE)"); - TRACE("(%p) : available %d.\n", This, available); + TRACE("available %#x.\n", available); if (available) { if (data) { - GL_EXTCALL(glGetQueryObjectuivARB(query->id, GL_QUERY_RESULT_ARB, &samples)); + GL_EXTCALL(glGetQueryObjectuivARB(oq->id, GL_QUERY_RESULT_ARB, &samples)); checkGLcall("glGetQueryObjectuivARB(GL_QUERY_RESULT)"); - TRACE("(%p) : Returning %d samples.\n", This, samples); + TRACE("Returning %d samples.\n", samples); *data = samples; } res = S_OK; @@ -359,23 +372,24 @@ static HRESULT WINAPI IWineD3DOcclusionQueryImpl_GetData(IWineD3DQuery* iface, return res; } -static HRESULT WINAPI IWineD3DEventQueryImpl_GetData(IWineD3DQuery* iface, void* pData, DWORD dwSize, DWORD dwGetDataFlags) { - IWineD3DQueryImpl *This = (IWineD3DQueryImpl *) iface; - struct wined3d_event_query *query = This->extendedData; +static HRESULT wined3d_event_query_ops_get_data(struct wined3d_query *query, + void *pData, DWORD dwSize, DWORD flags) +{ + struct wined3d_event_query *event_query = query->extendedData; BOOL *data = pData; enum wined3d_event_query_result ret; - TRACE("(%p) : type D3DQUERY_EVENT, pData %p, dwSize %#x, dwGetDataFlags %#x\n", This, pData, dwSize, dwGetDataFlags); + TRACE("query %p, pData %p, dwSize %#x, flags %#x.\n", query, pData, dwSize, flags); if (!pData || !dwSize) return S_OK; - if (!query) + if (!event_query) { - WARN("(%p): Event query not supported by GL, reporting GPU idle\n", This); + WARN("Event query not supported by GL, reporting GPU idle.\n"); *data = TRUE; return S_OK; } - ret = wined3d_event_query_test(query, This->device); + ret = wined3d_event_query_test(event_query, query->device); switch(ret) { case WINED3D_EVENT_QUERY_OK: @@ -388,7 +402,7 @@ static HRESULT WINAPI IWineD3DEventQueryImpl_GetData(IWineD3DQuery* iface, void break; case WINED3D_EVENT_QUERY_WRONG_THREAD: - FIXME("(%p) Wrong thread, reporting GPU idle.\n", This); + FIXME("(%p) Wrong thread, reporting GPU idle.\n", query); *data = TRUE; break; @@ -400,77 +414,69 @@ static HRESULT WINAPI IWineD3DEventQueryImpl_GetData(IWineD3DQuery* iface, void return S_OK; } -static DWORD WINAPI IWineD3DEventQueryImpl_GetDataSize(IWineD3DQuery* iface){ - TRACE("(%p) : type D3DQUERY_EVENT\n", iface); +WINED3DQUERYTYPE CDECL wined3d_query_get_type(const struct wined3d_query *query) +{ + TRACE("query %p.\n", query); - return sizeof(BOOL); + return query->type; } -static DWORD WINAPI IWineD3DOcclusionQueryImpl_GetDataSize(IWineD3DQuery* iface){ - TRACE("(%p) : type D3DQUERY_OCCLUSION\n", iface); +static HRESULT wined3d_event_query_ops_issue(struct wined3d_query *query, DWORD flags) +{ + TRACE("query %p, flags %#x.\n", query, flags); - return sizeof(DWORD); -} - -static WINED3DQUERYTYPE WINAPI IWineD3DQueryImpl_GetType(IWineD3DQuery* iface){ - IWineD3DQueryImpl *This = (IWineD3DQueryImpl *)iface; - return This->type; -} - -static HRESULT WINAPI IWineD3DEventQueryImpl_Issue(IWineD3DQuery* iface, DWORD dwIssueFlags) { - IWineD3DQueryImpl *This = (IWineD3DQueryImpl *)iface; - - TRACE("(%p) : dwIssueFlags %#x, type D3DQUERY_EVENT\n", This, dwIssueFlags); - if (dwIssueFlags & WINED3DISSUE_END) + TRACE("(%p) : flags %#x, type D3DQUERY_EVENT\n", query, flags); + if (flags & WINED3DISSUE_END) { - struct wined3d_event_query *query = This->extendedData; + struct wined3d_event_query *event_query = query->extendedData; /* Faked event query support */ - if (!query) return WINED3D_OK; + if (!event_query) return WINED3D_OK; - wined3d_event_query_issue(query, This->device); + wined3d_event_query_issue(event_query, query->device); } - else if(dwIssueFlags & WINED3DISSUE_BEGIN) + else if (flags & WINED3DISSUE_BEGIN) { /* Started implicitly at device creation */ ERR("Event query issued with START flag - what to do?\n"); } - if(dwIssueFlags & WINED3DISSUE_BEGIN) { - This->state = QUERY_BUILDING; - } else { - This->state = QUERY_SIGNALLED; - } + if (flags & WINED3DISSUE_BEGIN) + query->state = QUERY_BUILDING; + else + query->state = QUERY_SIGNALLED; return WINED3D_OK; } -static HRESULT WINAPI IWineD3DOcclusionQueryImpl_Issue(IWineD3DQuery* iface, DWORD dwIssueFlags) { - IWineD3DQueryImpl *This = (IWineD3DQueryImpl *)iface; - IWineD3DDeviceImpl *device = This->device; +static HRESULT wined3d_occlusion_query_ops_issue(struct wined3d_query *query, DWORD flags) +{ + struct wined3d_device *device = query->device; const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; + TRACE("query %p, flags %#x.\n", query, flags); + if (gl_info->supported[ARB_OCCLUSION_QUERY]) { - struct wined3d_occlusion_query *query = This->extendedData; + struct wined3d_occlusion_query *oq = query->extendedData; struct wined3d_context *context; /* This is allowed according to msdn and our tests. Reset the query and restart */ - if (dwIssueFlags & WINED3DISSUE_BEGIN) + if (flags & WINED3DISSUE_BEGIN) { - if (This->state == QUERY_BUILDING) + if (query->state == QUERY_BUILDING) { - if (query->context->tid != GetCurrentThreadId()) + if (oq->context->tid != GetCurrentThreadId()) { FIXME("Wrong thread, can't restart query.\n"); - context_free_occlusion_query(query); - context = context_acquire(This->device, NULL); - context_alloc_occlusion_query(context, query); + context_free_occlusion_query(oq); + context = context_acquire(query->device, NULL); + context_alloc_occlusion_query(context, oq); } else { - context = context_acquire(This->device, query->context->current_rt); + context = context_acquire(query->device, oq->context->current_rt); ENTER_GL(); GL_EXTCALL(glEndQueryARB(GL_SAMPLES_PASSED_ARB)); @@ -480,32 +486,33 @@ static HRESULT WINAPI IWineD3DOcclusionQueryImpl_Issue(IWineD3DQuery* iface, D } else { - if (query->context) context_free_occlusion_query(query); - context = context_acquire(This->device, NULL); - context_alloc_occlusion_query(context, query); + if (oq->context) context_free_occlusion_query(oq); + context = context_acquire(query->device, NULL); + context_alloc_occlusion_query(context, oq); } ENTER_GL(); - GL_EXTCALL(glBeginQueryARB(GL_SAMPLES_PASSED_ARB, query->id)); + GL_EXTCALL(glBeginQueryARB(GL_SAMPLES_PASSED_ARB, oq->id)); checkGLcall("glBeginQuery()"); LEAVE_GL(); context_release(context); } - if (dwIssueFlags & WINED3DISSUE_END) { + if (flags & WINED3DISSUE_END) + { /* Msdn says _END on a non-building occlusion query returns an error, but * our tests show that it returns OK. But OpenGL doesn't like it, so avoid * generating an error */ - if (This->state == QUERY_BUILDING) + if (query->state == QUERY_BUILDING) { - if (query->context->tid != GetCurrentThreadId()) + if (oq->context->tid != GetCurrentThreadId()) { FIXME("Wrong thread, can't end query.\n"); } else { - context = context_acquire(This->device, query->context->current_rt); + context = context_acquire(query->device, oq->context->current_rt); ENTER_GL(); GL_EXTCALL(glEndQueryARB(GL_SAMPLES_PASSED_ARB)); @@ -516,45 +523,33 @@ static HRESULT WINAPI IWineD3DOcclusionQueryImpl_Issue(IWineD3DQuery* iface, D } } } - } else { - FIXME("(%p) : Occlusion queries not supported\n", This); + } + else + { + FIXME("%p Occlusion queries not supported.\n", query); } - if(dwIssueFlags & WINED3DISSUE_BEGIN) { - This->state = QUERY_BUILDING; - } else { - This->state = QUERY_SIGNALLED; - } + if (flags & WINED3DISSUE_BEGIN) + query->state = QUERY_BUILDING; + else + query->state = QUERY_SIGNALLED; + return WINED3D_OK; /* can be WINED3DERR_INVALIDCALL. */ } -static const IWineD3DQueryVtbl IWineD3DEventQuery_Vtbl = +static const struct wined3d_query_ops event_query_ops = { - /*** IUnknown methods ***/ - IWineD3DQueryImpl_QueryInterface, - IWineD3DQueryImpl_AddRef, - IWineD3DQueryImpl_Release, - /*** IWineD3Dquery methods ***/ - IWineD3DEventQueryImpl_GetData, - IWineD3DEventQueryImpl_GetDataSize, - IWineD3DQueryImpl_GetType, - IWineD3DEventQueryImpl_Issue + wined3d_event_query_ops_get_data, + wined3d_event_query_ops_issue, }; -static const IWineD3DQueryVtbl IWineD3DOcclusionQuery_Vtbl = +static const struct wined3d_query_ops occlusion_query_ops = { - /*** IUnknown methods ***/ - IWineD3DQueryImpl_QueryInterface, - IWineD3DQueryImpl_AddRef, - IWineD3DQueryImpl_Release, - /*** IWineD3Dquery methods ***/ - IWineD3DOcclusionQueryImpl_GetData, - IWineD3DOcclusionQueryImpl_GetDataSize, - IWineD3DQueryImpl_GetType, - IWineD3DOcclusionQueryImpl_Issue + wined3d_occlusion_query_ops_get_data, + wined3d_occlusion_query_ops_issue, }; -HRESULT query_init(IWineD3DQueryImpl *query, IWineD3DDeviceImpl *device, WINED3DQUERYTYPE type) +static HRESULT query_init(struct wined3d_query *query, struct wined3d_device *device, WINED3DQUERYTYPE type) { const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; @@ -567,7 +562,8 @@ HRESULT query_init(IWineD3DQueryImpl *query, IWineD3DDeviceImpl *device, WINED3D WARN("Unsupported in local OpenGL implementation: ARB_OCCLUSION_QUERY.\n"); return WINED3DERR_NOTAVAILABLE; } - query->lpVtbl = &IWineD3DOcclusionQuery_Vtbl; + query->query_ops = &occlusion_query_ops; + query->data_size = sizeof(DWORD); query->extendedData = HeapAlloc(GetProcessHeap(), 0, sizeof(struct wined3d_occlusion_query)); if (!query->extendedData) { @@ -587,7 +583,8 @@ HRESULT query_init(IWineD3DQueryImpl *query, IWineD3DDeviceImpl *device, WINED3D * lowering performance. */ FIXME("Event query: Unimplemented, but pretending to be supported.\n"); } - query->lpVtbl = &IWineD3DEventQuery_Vtbl; + query->query_ops = &event_query_ops; + query->data_size = sizeof(BOOL); query->extendedData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct wined3d_event_query)); if (!query->extendedData) { @@ -620,3 +617,32 @@ HRESULT query_init(IWineD3DQueryImpl *query, IWineD3DDeviceImpl *device, WINED3D return WINED3D_OK; } + +HRESULT CDECL wined3d_query_create(struct wined3d_device *device, + WINED3DQUERYTYPE type, struct wined3d_query **query) +{ + struct wined3d_query *object; + HRESULT hr; + + TRACE("device %p, type %#x, query %p.\n", device, type, query); + + object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); + if (!object) + { + ERR("Failed to allocate query memory.\n"); + return E_OUTOFMEMORY; + } + + hr = query_init(object, device, type); + if (FAILED(hr)) + { + WARN("Failed to initialize query, hr %#x.\n", hr); + HeapFree(GetProcessHeap(), 0, object); + return hr; + } + + TRACE("Created query %p.\n", object); + *query = object; + + return WINED3D_OK; +} diff --git a/dll/directx/wine/wined3d/resource.c b/dll/directx/wine/wined3d/resource.c index c95cf1b8b55..4060bc67861 100644 --- a/dll/directx/wine/wined3d/resource.c +++ b/dll/directx/wine/wined3d/resource.c @@ -5,7 +5,7 @@ * Copyright 2003-2004 Raphael Junqueira * Copyright 2004 Christian Costa * Copyright 2005 Oliver Stieber - * Copyright 2009 Henri Verbeet for CodeWeavers + * Copyright 2009-2010 Henri Verbeet for CodeWeavers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -27,24 +27,87 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d); -HRESULT resource_init(IWineD3DResource *iface, WINED3DRESOURCETYPE resource_type, - IWineD3DDeviceImpl *device, UINT size, DWORD usage, const struct wined3d_format *format, - WINED3DPOOL pool, void *parent, const struct wined3d_parent_ops *parent_ops) +struct private_data { - struct IWineD3DResourceClass *resource = &((IWineD3DResourceImpl *)iface)->resource; + struct list entry; + GUID tag; + DWORD flags; /* DDSPD_* */ + + union + { + void *data; + IUnknown *object; + } ptr; + + DWORD size; +}; + +static DWORD resource_access_from_pool(WINED3DPOOL pool) +{ + switch (pool) + { + case WINED3DPOOL_DEFAULT: + return WINED3D_RESOURCE_ACCESS_GPU; + + case WINED3DPOOL_MANAGED: + return WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_CPU; + + case WINED3DPOOL_SYSTEMMEM: + return WINED3D_RESOURCE_ACCESS_CPU; + + case WINED3DPOOL_SCRATCH: + return WINED3D_RESOURCE_ACCESS_SCRATCH; + + default: + FIXME("Unhandled pool %#x.\n", pool); + return 0; + } +} + +static void resource_check_usage(DWORD usage) +{ + static const DWORD handled = WINED3DUSAGE_RENDERTARGET + | WINED3DUSAGE_DEPTHSTENCIL + | WINED3DUSAGE_DYNAMIC + | WINED3DUSAGE_AUTOGENMIPMAP + | WINED3DUSAGE_STATICDECL + | WINED3DUSAGE_OVERLAY; + + if (usage & ~handled) + FIXME("Unhandled usage flags %#x.\n", usage & ~handled); +} + +HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *device, + WINED3DRESOURCETYPE resource_type, const struct wined3d_format *format, + WINED3DMULTISAMPLE_TYPE multisample_type, UINT multisample_quality, + DWORD usage, WINED3DPOOL pool, UINT width, UINT height, UINT depth, UINT size, + void *parent, const struct wined3d_parent_ops *parent_ops, + const struct wined3d_resource_ops *resource_ops) +{ + resource->ref = 1; resource->device = device; resource->resourceType = resource_type; - resource->ref = 1; - resource->pool = pool; resource->format = format; + resource->multisample_type = multisample_type; + resource->multisample_quality = multisample_quality; resource->usage = usage; + resource->pool = pool; + resource->access_flags = resource_access_from_pool(pool); + if (usage & WINED3DUSAGE_DYNAMIC) + resource->access_flags |= WINED3D_RESOURCE_ACCESS_CPU; + resource->width = width; + resource->height = height; + resource->depth = depth; resource->size = size; resource->priority = 0; resource->parent = parent; resource->parent_ops = parent_ops; + resource->resource_ops = resource_ops; list_init(&resource->privateData); + resource_check_usage(usage); + if (size) { resource->heapMemory = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size + RESOURCE_ALIGNMENT); @@ -58,12 +121,13 @@ HRESULT resource_init(IWineD3DResource *iface, WINED3DRESOURCETYPE resource_type { resource->heapMemory = NULL; } - resource->allocatedMemory = (BYTE *)(((ULONG_PTR)resource->heapMemory + (RESOURCE_ALIGNMENT - 1)) & ~(RESOURCE_ALIGNMENT - 1)); + resource->allocatedMemory = (BYTE *)(((ULONG_PTR)resource->heapMemory + + (RESOURCE_ALIGNMENT - 1)) & ~(RESOURCE_ALIGNMENT - 1)); /* Check that we have enough video ram left */ if (pool == WINED3DPOOL_DEFAULT) { - if (size > IWineD3DDevice_GetAvailableTextureMem((IWineD3DDevice *)device)) + if (size > wined3d_device_get_available_texture_mem(device)) { ERR("Out of adapter memory\n"); HeapFree(GetProcessHeap(), 0, resource->heapMemory); @@ -72,54 +136,56 @@ HRESULT resource_init(IWineD3DResource *iface, WINED3DRESOURCETYPE resource_type WineD3DAdapterChangeGLRam(device, size); } - device_resource_add(device, iface); + device_resource_add(device, resource); return WINED3D_OK; } -void resource_cleanup(IWineD3DResource *iface) +void resource_cleanup(struct wined3d_resource *resource) { - IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface; + struct private_data *data; struct list *e1, *e2; - PrivateData *data; HRESULT hr; - TRACE("(%p) Cleaning up resource\n", This); - if (This->resource.pool == WINED3DPOOL_DEFAULT) { - TRACE("Decrementing device memory pool by %u\n", This->resource.size); - WineD3DAdapterChangeGLRam(This->resource.device, -This->resource.size); + TRACE("Cleaning up resource %p.\n", resource); + + if (resource->pool == WINED3DPOOL_DEFAULT) + { + TRACE("Decrementing device memory pool by %u.\n", resource->size); + WineD3DAdapterChangeGLRam(resource->device, 0 - resource->size); } - LIST_FOR_EACH_SAFE(e1, e2, &This->resource.privateData) { - data = LIST_ENTRY(e1, PrivateData, entry); - hr = resource_free_private_data(iface, &data->tag); - if(hr != WINED3D_OK) { - ERR("Failed to free private data when destroying resource %p, hr = %08x\n", This, hr); - } + LIST_FOR_EACH_SAFE(e1, e2, &resource->privateData) + { + data = LIST_ENTRY(e1, struct private_data, entry); + hr = resource_free_private_data(resource, &data->tag); + if (FAILED(hr)) + ERR("Failed to free private data when destroying resource %p, hr = %#x.\n", resource, hr); } - HeapFree(GetProcessHeap(), 0, This->resource.heapMemory); - This->resource.allocatedMemory = 0; - This->resource.heapMemory = 0; + HeapFree(GetProcessHeap(), 0, resource->heapMemory); + resource->allocatedMemory = 0; + resource->heapMemory = 0; - if (This->resource.device) device_resource_released(This->resource.device, iface); + if (resource->device) + device_resource_released(resource->device, resource); } -void resource_unload(IWineD3DResourceImpl *resource) +void resource_unload(struct wined3d_resource *resource) { - context_resource_unloaded(resource->resource.device, (IWineD3DResource *)resource, - resource->resource.resourceType); + context_resource_unloaded(resource->device, + resource, resource->resourceType); } -static PrivateData* resource_find_private_data(IWineD3DResourceImpl *This, REFGUID tag) +static struct private_data *resource_find_private_data(const struct wined3d_resource *resource, REFGUID tag) { - PrivateData *data; + struct private_data *data; struct list *entry; TRACE("Searching for private data %s\n", debugstr_guid(tag)); - LIST_FOR_EACH(entry, &This->resource.privateData) + LIST_FOR_EACH(entry, &resource->privateData) { - data = LIST_ENTRY(entry, PrivateData, entry); + data = LIST_ENTRY(entry, struct private_data, entry); if (IsEqualGUID(&data->tag, tag)) { TRACE("Found %p\n", data); return data; @@ -129,85 +195,91 @@ static PrivateData* resource_find_private_data(IWineD3DResourceImpl *This, REFGU return NULL; } -HRESULT resource_set_private_data(IWineD3DResource *iface, REFGUID refguid, - const void *pData, DWORD SizeOfData, DWORD Flags) +HRESULT resource_set_private_data(struct wined3d_resource *resource, REFGUID guid, + const void *data, DWORD data_size, DWORD flags) { - IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface; - PrivateData *data; + struct private_data *d; - TRACE("(%p) : %s %p %d %d\n", This, debugstr_guid(refguid), pData, SizeOfData, Flags); - resource_free_private_data(iface, refguid); + TRACE("resource %p, riid %s, data %p, data_size %u, flags %#x.\n", + resource, debugstr_guid(guid), data, data_size, flags); - data = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*data)); - if (!data) return E_OUTOFMEMORY; + resource_free_private_data(resource, guid); - data->tag = *refguid; - data->flags = Flags; + d = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*d)); + if (!d) return E_OUTOFMEMORY; - if (Flags & WINED3DSPD_IUNKNOWN) { - if(SizeOfData != sizeof(IUnknown *)) { - WARN("IUnknown data with size %d, returning WINED3DERR_INVALIDCALL\n", SizeOfData); - HeapFree(GetProcessHeap(), 0, data); + d->tag = *guid; + d->flags = flags; + + if (flags & WINED3DSPD_IUNKNOWN) + { + if (data_size != sizeof(IUnknown *)) + { + WARN("IUnknown data with size %u, returning WINED3DERR_INVALIDCALL.\n", data_size); + HeapFree(GetProcessHeap(), 0, d); return WINED3DERR_INVALIDCALL; } - data->ptr.object = (LPUNKNOWN)pData; - data->size = sizeof(LPUNKNOWN); - IUnknown_AddRef(data->ptr.object); + d->ptr.object = (IUnknown *)data; + d->size = sizeof(IUnknown *); + IUnknown_AddRef(d->ptr.object); } else { - data->ptr.data = HeapAlloc(GetProcessHeap(), 0, SizeOfData); - if (!data->ptr.data) + d->ptr.data = HeapAlloc(GetProcessHeap(), 0, data_size); + if (!d->ptr.data) { - HeapFree(GetProcessHeap(), 0, data); + HeapFree(GetProcessHeap(), 0, d); return E_OUTOFMEMORY; } - data->size = SizeOfData; - memcpy(data->ptr.data, pData, SizeOfData); + d->size = data_size; + memcpy(d->ptr.data, data, data_size); } - list_add_tail(&This->resource.privateData, &data->entry); + list_add_tail(&resource->privateData, &d->entry); return WINED3D_OK; } -HRESULT resource_get_private_data(IWineD3DResource *iface, REFGUID refguid, void *pData, DWORD *pSizeOfData) +HRESULT resource_get_private_data(const struct wined3d_resource *resource, REFGUID guid, void *data, DWORD *data_size) { - IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface; - PrivateData *data; + const struct private_data *d; - TRACE("(%p) : %p %p %p\n", This, refguid, pData, pSizeOfData); - data = resource_find_private_data(This, refguid); - if (!data) return WINED3DERR_NOTFOUND; + TRACE("resource %p, guid %s, data %p, data_size %p.\n", + resource, debugstr_guid(guid), data, data_size); - if (*pSizeOfData < data->size) { - *pSizeOfData = data->size; + d = resource_find_private_data(resource, guid); + if (!d) return WINED3DERR_NOTFOUND; + + if (*data_size < d->size) + { + *data_size = d->size; return WINED3DERR_MOREDATA; } - if (data->flags & WINED3DSPD_IUNKNOWN) { - *(LPUNKNOWN *)pData = data->ptr.object; - if (((IWineD3DImpl *)This->resource.device->wined3d)->dxVersion != 7) + if (d->flags & WINED3DSPD_IUNKNOWN) + { + *(IUnknown **)data = d->ptr.object; + if (resource->device->wined3d->dxVersion != 7) { - /* D3D8 and D3D9 addref the private data, DDraw does not. This can't be handled in - * ddraw because it doesn't know if the pointer returned is an IUnknown * or just a - * Blob - */ - IUnknown_AddRef(data->ptr.object); + /* D3D8 and D3D9 addref the private data, DDraw does not. This + * can't be handled in ddraw because it doesn't know if the + * pointer returned is an IUnknown * or just a blob. */ + IUnknown_AddRef(d->ptr.object); } } - else { - memcpy(pData, data->ptr.data, data->size); + else + { + memcpy(data, d->ptr.data, d->size); } return WINED3D_OK; } -HRESULT resource_free_private_data(IWineD3DResource *iface, REFGUID refguid) +HRESULT resource_free_private_data(struct wined3d_resource *resource, REFGUID guid) { - IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface; - PrivateData *data; + struct private_data *data; - TRACE("(%p) : %s\n", This, debugstr_guid(refguid)); - data = resource_find_private_data(This, refguid); + TRACE("resource %p, guid %s.\n", resource, debugstr_guid(guid)); + + data = resource_find_private_data(resource, guid); if (!data) return WINED3DERR_NOTFOUND; if (data->flags & WINED3DSPD_IUNKNOWN) @@ -226,25 +298,35 @@ HRESULT resource_free_private_data(IWineD3DResource *iface, REFGUID refguid) return WINED3D_OK; } -DWORD resource_set_priority(IWineD3DResource *iface, DWORD PriorityNew) +DWORD resource_set_priority(struct wined3d_resource *resource, DWORD priority) { - IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface; - DWORD PriorityOld = This->resource.priority; - This->resource.priority = PriorityNew; - TRACE("(%p) : new priority %d, returning old priority %d\n", This, PriorityNew, PriorityOld ); - return PriorityOld; + DWORD prev = resource->priority; + resource->priority = priority; + TRACE("resource %p, new priority %u, returning old priority %u.\n", resource, priority, prev); + return prev; } -DWORD resource_get_priority(IWineD3DResource *iface) +DWORD resource_get_priority(const struct wined3d_resource *resource) { - IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface; - TRACE("(%p) : returning %d\n", This, This->resource.priority ); - return This->resource.priority; + TRACE("resource %p, returning %u.\n", resource, resource->priority); + return resource->priority; } -WINED3DRESOURCETYPE resource_get_type(IWineD3DResource *iface) +void * CDECL wined3d_resource_get_parent(const struct wined3d_resource *resource) { - IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface; - TRACE("(%p) : returning %d\n", This, This->resource.resourceType); - return This->resource.resourceType; + return resource->parent; +} + +void CDECL wined3d_resource_get_desc(const struct wined3d_resource *resource, struct wined3d_resource_desc *desc) +{ + desc->resource_type = resource->resourceType; + desc->format = resource->format->id; + desc->multisample_type = resource->multisample_type; + desc->multisample_quality = resource->multisample_quality; + desc->usage = resource->usage; + desc->pool = resource->pool; + desc->width = resource->width; + desc->height = resource->height; + desc->depth = resource->depth; + desc->size = resource->size; } diff --git a/dll/directx/wine/wined3d/shader.c b/dll/directx/wine/wined3d/shader.c index bc39b3b2aa8..79a27595f02 100644 --- a/dll/directx/wine/wined3d/shader.c +++ b/dll/directx/wine/wined3d/shader.c @@ -5,7 +5,7 @@ * Copyright 2005 Oliver Stieber * Copyright 2006 Ivan Gyurdiev * Copyright 2007-2008 Stefan Dösinger for CodeWeavers - * Copyright 2009 Henri Verbeet for CodeWeavers + * Copyright 2009-2011 Henri Verbeet for CodeWeavers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -52,6 +52,7 @@ static const char * const shader_opcode_names[] = /* WINED3DSIH_DEF */ "def", /* WINED3DSIH_DEFB */ "defb", /* WINED3DSIH_DEFI */ "defi", + /* WINED3DSIH_DIV */ "div", /* WINED3DSIH_DP2ADD */ "dp2add", /* WINED3DSIH_DP3 */ "dp3", /* WINED3DSIH_DP4 */ "dp4", @@ -66,12 +67,16 @@ static const char * const shader_opcode_names[] = /* WINED3DSIH_EXP */ "exp", /* WINED3DSIH_EXPP */ "expp", /* WINED3DSIH_FRC */ "frc", + /* WINED3DSIH_FTOI */ "ftoi", /* WINED3DSIH_IADD */ "iadd", + /* WINED3DSIH_IEQ */ "ieq", /* WINED3DSIH_IF */ "if", /* WINED3DSIH_IFC */ "ifc", /* WINED3DSIH_IGE */ "ige", /* WINED3DSIH_IMUL */ "imul", + /* WINED3DSIH_ITOF */ "itof", /* WINED3DSIH_LABEL */ "label", + /* WINED3DSIH_LD */ "ld", /* WINED3DSIH_LIT */ "lit", /* WINED3DSIH_LOG */ "log", /* WINED3DSIH_LOGP */ "logp", @@ -98,11 +103,15 @@ static const char * const shader_opcode_names[] = /* WINED3DSIH_REP */ "rep", /* WINED3DSIH_RET */ "ret", /* WINED3DSIH_RSQ */ "rsq", + /* WINED3DSIH_SAMPLE */ "sample", + /* WINED3DSIH_SAMPLE_GRAD */ "sample_d", + /* WINED3DSIH_SAMPLE_LOD */ "sample_l", /* WINED3DSIH_SETP */ "setp", /* WINED3DSIH_SGE */ "sge", /* WINED3DSIH_SGN */ "sgn", /* WINED3DSIH_SINCOS */ "sincos", /* WINED3DSIH_SLT */ "slt", + /* WINED3DSIH_SQRT */ "sqrt", /* WINED3DSIH_SUB */ "sub", /* WINED3DSIH_TEX */ "texld", /* WINED3DSIH_TEXBEM */ "texbem", @@ -126,6 +135,7 @@ static const char * const shader_opcode_names[] = /* WINED3DSIH_TEXREG2AR */ "texreg2ar", /* WINED3DSIH_TEXREG2GB */ "texreg2gb", /* WINED3DSIH_TEXREG2RGB */ "texreg2rgb", + /* WINED3DSIH_UTOF */ "utof", }; static const char * const semantic_names[] = @@ -288,11 +298,11 @@ int shader_addline(struct wined3d_shader_buffer *buffer, const char *format, ... return ret; } -static void shader_init(struct IWineD3DBaseShaderClass *shader, IWineD3DDeviceImpl *device, +static void shader_init(struct wined3d_shader *shader, struct wined3d_device *device, void *parent, const struct wined3d_parent_ops *parent_ops) { shader->ref = 1; - shader->device = (IWineD3DDevice *)device; + shader->device = device; shader->parent = parent; shader->parent_ops = parent_ops; list_init(&shader->linked_programs); @@ -338,7 +348,7 @@ static inline void set_bitmap_bit(DWORD *bitmap, DWORD bit) bitmap[idx] |= (1 << shift); } -static void shader_record_register_usage(IWineD3DBaseShaderImpl *shader, struct shader_reg_maps *reg_maps, +static void shader_record_register_usage(struct wined3d_shader *shader, struct wined3d_shader_reg_maps *reg_maps, const struct wined3d_shader_register *reg, enum wined3d_shader_type shader_type) { switch (reg->type) @@ -363,12 +373,12 @@ static void shader_record_register_usage(IWineD3DBaseShaderImpl *shader, struct unsigned int i; for (i = 0; i < MAX_REG_INPUT; ++i) { - ((IWineD3DPixelShaderImpl *)shader)->input_reg_used[i] = TRUE; + shader->u.ps.input_reg_used[i] = TRUE; } } else { - ((IWineD3DPixelShaderImpl *)shader)->input_reg_used[reg->idx] = TRUE; + shader->u.ps.input_reg_used[reg->idx] = TRUE; } } else reg_maps->input_registers |= 1 << reg->idx; @@ -389,17 +399,8 @@ static void shader_record_register_usage(IWineD3DBaseShaderImpl *shader, struct case WINED3DSPR_CONST: if (reg->rel_addr) { - if (shader_type != WINED3D_SHADER_TYPE_PIXEL) - { - if (reg->idx < ((IWineD3DVertexShaderImpl *)shader)->min_rel_offset) - { - ((IWineD3DVertexShaderImpl *)shader)->min_rel_offset = reg->idx; - } - if (reg->idx > ((IWineD3DVertexShaderImpl *)shader)->max_rel_offset) - { - ((IWineD3DVertexShaderImpl *)shader)->max_rel_offset = reg->idx; - } - } + if (reg->idx < reg_maps->min_rel_offset) reg_maps->min_rel_offset = reg->idx; + if (reg->idx > reg_maps->max_rel_offset) reg_maps->max_rel_offset = reg->idx; reg_maps->usesrelconstF = TRUE; } else @@ -417,7 +418,7 @@ static void shader_record_register_usage(IWineD3DBaseShaderImpl *shader, struct break; case WINED3DSPR_COLOROUT: - reg_maps->highest_render_target = max(reg_maps->highest_render_target, reg->idx); + reg_maps->rt_mask |= (1 << reg->idx); break; default: @@ -447,24 +448,17 @@ static unsigned int get_instr_extra_regcount(enum WINED3D_SHADER_INSTRUCTION_HAN } /* Note that this does not count the loop register as an address register. */ -static HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct wined3d_shader_frontend *fe, - struct shader_reg_maps *reg_maps, struct wined3d_shader_signature_element *input_signature, +static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const struct wined3d_shader_frontend *fe, + struct wined3d_shader_reg_maps *reg_maps, struct wined3d_shader_signature_element *input_signature, struct wined3d_shader_signature_element *output_signature, const DWORD *byte_code, DWORD constf_size) { - IWineD3DBaseShaderImpl *shader = (IWineD3DBaseShaderImpl *)iface; unsigned int cur_loop_depth = 0, max_loop_depth = 0; - void *fe_data = shader->baseShader.frontend_data; + void *fe_data = shader->frontend_data; struct wined3d_shader_version shader_version; const DWORD *ptr = byte_code; memset(reg_maps, 0, sizeof(*reg_maps)); - - /* get_registers_used() is called on every compile on some 1.x shaders, - * which can result in stacking up a collection of local constants. - * Delete the old constants if existing. */ - shader_delete_constant_list(&shader->baseShader.constantsF); - shader_delete_constant_list(&shader->baseShader.constantsB); - shader_delete_constant_list(&shader->baseShader.constantsI); + reg_maps->min_rel_offset = ~0U; fe->shader_read_header(fe_data, &ptr, &shader_version); reg_maps->shader_version = shader_version; @@ -559,7 +553,7 @@ static HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct else if (value[3] > 1.0f) value[3] = 1.0f; } - list_add_head(&shader->baseShader.constantsF, &lconst->entry); + list_add_head(&shader->constantsF, &lconst->entry); } else if (ins.handler_idx == WINED3DSIH_DEFI) { @@ -575,7 +569,7 @@ static HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct memcpy(lconst->value, ptr, 4 * sizeof(DWORD)); ptr += 4; - list_add_head(&shader->baseShader.constantsI, &lconst->entry); + list_add_head(&shader->constantsI, &lconst->entry); reg_maps->local_int_consts |= (1 << dst.reg.idx); } else if (ins.handler_idx == WINED3DSIH_DEFB) @@ -592,7 +586,7 @@ static HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct memcpy(lconst->value, ptr, sizeof(DWORD)); ++ptr; - list_add_head(&shader->baseShader.constantsB, &lconst->entry); + list_add_head(&shader->constantsB, &lconst->entry); reg_maps->local_bool_consts |= (1 << dst.reg.idx); } /* If there's a loop in the shader. */ @@ -634,7 +628,7 @@ static HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct else { BOOL color0_mov = FALSE; - int i, limit; + unsigned int i, limit; /* This will loop over all the registers and try to * make a bitmask of the ones we're interested in. @@ -722,19 +716,16 @@ static HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct if (shader_version.type == WINED3D_SHADER_TYPE_PIXEL) { - IWineD3DPixelShaderImpl *ps = (IWineD3DPixelShaderImpl *)shader; - if (dst_param.reg.type == WINED3DSPR_COLOROUT && !dst_param.reg.idx) { - /* Many 2.0 and 3.0 pixel shaders end with a MOV from a temp register to - * COLOROUT 0. If we know this in advance, the ARB shader backend can skip - * the mov and perform the sRGB write correction from the source register. - * - * However, if the mov is only partial, we can't do this, and if the write - * comes from an instruction other than MOV it is hard to do as well. If - * COLOROUT 0 is overwritten partially later, the marker is dropped again. */ - - ps->color0_mov = FALSE; + /* Many 2.0 and 3.0 pixel shaders end with a MOV from a temp register to + * COLOROUT 0. If we know this in advance, the ARB shader backend can skip + * the mov and perform the sRGB write correction from the source register. + * + * However, if the mov is only partial, we can't do this, and if the write + * comes from an instruction other than MOV it is hard to do as well. If + * COLOROUT 0 is overwritten partially later, the marker is dropped again. */ + shader->u.ps.color0_mov = FALSE; if (ins.handler_idx == WINED3DSIH_MOV && dst_param.write_mask == WINED3DSP_WRITEMASK_ALL) { @@ -745,9 +736,10 @@ static HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct /* Also drop the MOV marker if the source register is overwritten prior to the shader * end */ - else if (dst_param.reg.type == WINED3DSPR_TEMP && dst_param.reg.idx == ps->color0_reg) + else if (dst_param.reg.type == WINED3DSPR_TEMP + && dst_param.reg.idx == shader->u.ps.color0_reg) { - ps->color0_mov = FALSE; + shader->u.ps.color0_mov = FALSE; } } @@ -796,7 +788,7 @@ static HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct else if (ins.handler_idx == WINED3DSIH_MOVA) reg_maps->usesmova = 1; else if (ins.handler_idx == WINED3DSIH_IFC) reg_maps->usesifc = 1; else if (ins.handler_idx == WINED3DSIH_CALL) reg_maps->usescall = 1; - else if (ins.handler_idx == WINED3DSIH_RCP) reg_maps->usesrcp = 1; + else if (ins.handler_idx == WINED3DSIH_POW) reg_maps->usespow = 1; limit = ins.src_count + (ins.predicate ? 1 : 0); for (i = 0; i < limit; ++i) @@ -817,12 +809,11 @@ static HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct if (color0_mov) { - IWineD3DPixelShaderImpl *ps = (IWineD3DPixelShaderImpl *)shader; if (src_param.reg.type == WINED3DSPR_TEMP && src_param.swizzle == WINED3DSP_NOSWIZZLE) { - ps->color0_mov = TRUE; - ps->color0_reg = src_param.reg.idx; + shader->u.ps.color0_mov = TRUE; + shader->u.ps.color0_reg = src_param.reg.idx; } } } @@ -830,12 +821,17 @@ static HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, const struct } reg_maps->loop_depth = max_loop_depth; - shader->baseShader.functionLength = ((const char *)ptr - (const char *)byte_code); + /* PS before 2.0 don't have explicit color outputs. Instead the value of + * R0 is written to the render target. */ + if (shader_version.major < 2 && shader_version.type == WINED3D_SHADER_TYPE_PIXEL) + reg_maps->rt_mask |= (1 << 0); + + shader->functionLength = ((const char *)ptr - (const char *)byte_code); return WINED3D_OK; } -unsigned int shader_find_free_input_register(const struct shader_reg_maps *reg_maps, unsigned int max) +unsigned int shader_find_free_input_register(const struct wined3d_shader_reg_maps *reg_maps, unsigned int max) { DWORD map = 1 << max; map |= map - 1; @@ -1023,6 +1019,10 @@ static void shader_dump_register(const struct wined3d_shader_register *reg, TRACE("null"); break; + case WINED3DSPR_RESOURCE: + TRACE("t"); + break; + default: TRACE("unhandled_rtype(%#x)", reg->type); break; @@ -1164,34 +1164,40 @@ void shader_dump_src_param(const struct wined3d_shader_src_param *param, /* Shared code in order to generate the bulk of the shader string. * NOTE: A description of how to parse tokens can be found on MSDN. */ -void shader_generate_main(IWineD3DBaseShader *iface, struct wined3d_shader_buffer *buffer, - const shader_reg_maps *reg_maps, const DWORD *byte_code, void *backend_ctx) +void shader_generate_main(struct wined3d_shader *shader, struct wined3d_shader_buffer *buffer, + const struct wined3d_shader_reg_maps *reg_maps, const DWORD *byte_code, void *backend_ctx) { - IWineD3DBaseShaderImpl *shader = (IWineD3DBaseShaderImpl *)iface; - IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)shader->baseShader.device; - const struct wined3d_shader_frontend *fe = shader->baseShader.frontend; - void *fe_data = shader->baseShader.frontend_data; + struct wined3d_device *device = shader->device; + const struct wined3d_shader_frontend *fe = shader->frontend; + void *fe_data = shader->frontend_data; struct wined3d_shader_src_param dst_rel_addr[2]; struct wined3d_shader_src_param src_rel_addr[4]; struct wined3d_shader_dst_param dst_param[2]; struct wined3d_shader_src_param src_param[4]; struct wined3d_shader_version shader_version; + struct wined3d_shader_loop_state loop_state; struct wined3d_shader_instruction ins; + struct wined3d_shader_tex_mx tex_mx; struct wined3d_shader_context ctx; const DWORD *ptr = byte_code; DWORD i; /* Initialize current parsing state. */ - ctx.shader = iface; + tex_mx.current_row = 0; + loop_state.current_depth = 0; + loop_state.current_reg = 0; + + ctx.shader = shader; ctx.gl_info = &device->adapter->gl_info; ctx.reg_maps = reg_maps; ctx.buffer = buffer; + ctx.tex_mx = &tex_mx; + ctx.loop_state = &loop_state; ctx.backend_data = backend_ctx; ins.ctx = &ctx; ins.dst = dst_param; ins.src = src_param; - shader->baseShader.parse_state.current_row = 0; fe->shader_read_header(fe_data, &ptr, &shader_version); @@ -1469,36 +1475,34 @@ static void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe } } -static void shader_cleanup(IWineD3DBaseShader *iface) +static void shader_cleanup(struct wined3d_shader *shader) { - IWineD3DBaseShaderImpl *shader = (IWineD3DBaseShaderImpl *)iface; + shader->device->shader_backend->shader_destroy(shader); + HeapFree(GetProcessHeap(), 0, shader->reg_maps.constf); + HeapFree(GetProcessHeap(), 0, shader->function); + shader_delete_constant_list(&shader->constantsF); + shader_delete_constant_list(&shader->constantsB); + shader_delete_constant_list(&shader->constantsI); + list_remove(&shader->shader_list_entry); - ((IWineD3DDeviceImpl *)shader->baseShader.device)->shader_backend->shader_destroy(iface); - HeapFree(GetProcessHeap(), 0, shader->baseShader.reg_maps.constf); - HeapFree(GetProcessHeap(), 0, shader->baseShader.function); - shader_delete_constant_list(&shader->baseShader.constantsF); - shader_delete_constant_list(&shader->baseShader.constantsB); - shader_delete_constant_list(&shader->baseShader.constantsI); - list_remove(&shader->baseShader.shader_list_entry); - - if (shader->baseShader.frontend && shader->baseShader.frontend_data) - { - shader->baseShader.frontend->shader_free(shader->baseShader.frontend_data); - } + if (shader->frontend && shader->frontend_data) + shader->frontend->shader_free(shader->frontend_data); } static void shader_none_handle_instruction(const struct wined3d_shader_instruction *ins) {} static void shader_none_select(const struct wined3d_context *context, BOOL usePS, BOOL useVS) {} -static void shader_none_select_depth_blt(IWineD3DDevice *iface, enum tex_types tex_type, const SIZE *ds_mask_size) {} -static void shader_none_deselect_depth_blt(IWineD3DDevice *iface) {} -static void shader_none_update_float_vertex_constants(IWineD3DDevice *iface, UINT start, UINT count) {} -static void shader_none_update_float_pixel_constants(IWineD3DDevice *iface, UINT start, UINT count) {} +static void shader_none_select_depth_blt(void *shader_priv, const struct wined3d_gl_info *gl_info, + enum tex_types tex_type, const SIZE *ds_mask_size) {} +static void shader_none_deselect_depth_blt(void *shader_priv, const struct wined3d_gl_info *gl_info) {} +static void shader_none_update_float_vertex_constants(struct wined3d_device *device, UINT start, UINT count) {} +static void shader_none_update_float_pixel_constants(struct wined3d_device *device, UINT start, UINT count) {} static void shader_none_load_constants(const struct wined3d_context *context, char usePS, char useVS) {} -static void shader_none_load_np2fixup_constants(IWineD3DDevice *iface, char usePS, char useVS) {} -static void shader_none_destroy(IWineD3DBaseShader *iface) {} -static HRESULT shader_none_alloc(IWineD3DDevice *iface) {return WINED3D_OK;} -static void shader_none_free(IWineD3DDevice *iface) {} -static BOOL shader_none_dirty_const(IWineD3DDevice *iface) {return FALSE;} +static void shader_none_load_np2fixup_constants(void *shader_priv, + const struct wined3d_gl_info *gl_info, const struct wined3d_state *state) {} +static void shader_none_destroy(struct wined3d_shader *shader) {} +static HRESULT shader_none_alloc(struct wined3d_device *device) {return WINED3D_OK;} +static void shader_none_free(struct wined3d_device *device) {} +static BOOL shader_none_dirty_const(void) {return FALSE;} static void shader_none_get_caps(const struct wined3d_gl_info *gl_info, struct shader_caps *caps) { @@ -1530,7 +1534,8 @@ static BOOL shader_none_color_fixup_supported(struct color_fixup_desc fixup) return FALSE; } -const shader_backend_t none_shader_backend = { +const struct wined3d_shader_backend_ops none_shader_backend = +{ shader_none_handle_instruction, shader_none_select, shader_none_select_depth_blt, @@ -1547,31 +1552,10 @@ const shader_backend_t none_shader_backend = { shader_none_color_fixup_supported, }; -static HRESULT shader_get_function(IWineD3DBaseShaderImpl *shader, void *data, UINT *data_size) -{ - if (!data) - { - *data_size = shader->baseShader.functionLength; - return WINED3D_OK; - } - - if (*data_size < shader->baseShader.functionLength) - { - /* MSDN claims (for d3d8 at least) that if *pSizeOfData is smaller - * than the required size we should write the required size and - * return D3DERR_MOREDATA. That's not actually true. */ - return WINED3DERR_INVALIDCALL; - } - - memcpy(data, shader->baseShader.function, shader->baseShader.functionLength); - - return WINED3D_OK; -} - -static HRESULT shader_set_function(IWineD3DBaseShaderImpl *shader, const DWORD *byte_code, +static HRESULT shader_set_function(struct wined3d_shader *shader, const DWORD *byte_code, const struct wined3d_shader_signature *output_signature, DWORD float_const_count) { - struct shader_reg_maps *reg_maps = &shader->baseShader.reg_maps; + struct wined3d_shader_reg_maps *reg_maps = &shader->reg_maps; const struct wined3d_shader_frontend *fe; HRESULT hr; @@ -1584,59 +1568,40 @@ static HRESULT shader_set_function(IWineD3DBaseShaderImpl *shader, const DWORD * FIXME("Unable to find frontend for shader.\n"); return WINED3DERR_INVALIDCALL; } - shader->baseShader.frontend = fe; - shader->baseShader.frontend_data = fe->shader_init(byte_code, output_signature); - if (!shader->baseShader.frontend_data) + shader->frontend = fe; + shader->frontend_data = fe->shader_init(byte_code, output_signature); + if (!shader->frontend_data) { FIXME("Failed to initialize frontend.\n"); return WINED3DERR_INVALIDCALL; } /* First pass: trace shader. */ - if (TRACE_ON(d3d_shader)) shader_trace_init(fe, shader->baseShader.frontend_data, byte_code); + if (TRACE_ON(d3d_shader)) + shader_trace_init(fe, shader->frontend_data, byte_code); /* Initialize immediate constant lists. */ - list_init(&shader->baseShader.constantsF); - list_init(&shader->baseShader.constantsB); - list_init(&shader->baseShader.constantsI); + list_init(&shader->constantsF); + list_init(&shader->constantsB); + list_init(&shader->constantsI); /* Second pass: figure out which registers are used, what the semantics are, etc. */ - hr = shader_get_registers_used((IWineD3DBaseShader *)shader, fe, - reg_maps, shader->baseShader.input_signature, shader->baseShader.output_signature, + hr = shader_get_registers_used(shader, fe, + reg_maps, shader->input_signature, shader->output_signature, byte_code, float_const_count); if (FAILED(hr)) return hr; - shader->baseShader.function = HeapAlloc(GetProcessHeap(), 0, shader->baseShader.functionLength); - if (!shader->baseShader.function) return E_OUTOFMEMORY; - memcpy(shader->baseShader.function, byte_code, shader->baseShader.functionLength); + shader->function = HeapAlloc(GetProcessHeap(), 0, shader->functionLength); + if (!shader->function) + return E_OUTOFMEMORY; + memcpy(shader->function, byte_code, shader->functionLength); return WINED3D_OK; } -static HRESULT STDMETHODCALLTYPE vertexshader_QueryInterface(IWineD3DVertexShader *iface, REFIID riid, void **object) +ULONG CDECL wined3d_shader_incref(struct wined3d_shader *shader) { - TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object); - - if (IsEqualGUID(riid, &IID_IWineD3DVertexShader) - || IsEqualGUID(riid, &IID_IWineD3DBaseShader) - || IsEqualGUID(riid, &IID_IWineD3DBase) - || IsEqualGUID(riid, &IID_IUnknown)) - { - IUnknown_AddRef(iface); - *object = iface; - return S_OK; - } - - WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid)); - - *object = NULL; - return E_NOINTERFACE; -} - -static ULONG STDMETHODCALLTYPE vertexshader_AddRef(IWineD3DVertexShader *iface) -{ - IWineD3DVertexShaderImpl *shader = (IWineD3DVertexShaderImpl *)iface; - ULONG refcount = InterlockedIncrement(&shader->baseShader.ref); + ULONG refcount = InterlockedIncrement(&shader->ref); TRACE("%p increasing refcount to %u.\n", shader, refcount); @@ -1644,89 +1609,91 @@ static ULONG STDMETHODCALLTYPE vertexshader_AddRef(IWineD3DVertexShader *iface) } /* Do not call while under the GL lock. */ -static ULONG STDMETHODCALLTYPE vertexshader_Release(IWineD3DVertexShader *iface) +ULONG CDECL wined3d_shader_decref(struct wined3d_shader *shader) { - IWineD3DVertexShaderImpl *shader = (IWineD3DVertexShaderImpl *)iface; - ULONG refcount = InterlockedDecrement(&shader->baseShader.ref); + ULONG refcount = InterlockedDecrement(&shader->ref); TRACE("%p decreasing refcount to %u.\n", shader, refcount); if (!refcount) { - shader_cleanup((IWineD3DBaseShader *)iface); - shader->baseShader.parent_ops->wined3d_object_destroyed(shader->baseShader.parent); + shader_cleanup(shader); + shader->parent_ops->wined3d_object_destroyed(shader->parent); HeapFree(GetProcessHeap(), 0, shader); } return refcount; } -static void * STDMETHODCALLTYPE vertexshader_GetParent(IWineD3DVertexShader *iface) +void * CDECL wined3d_shader_get_parent(const struct wined3d_shader *shader) { - TRACE("iface %p.\n", iface); + TRACE("shader %p.\n", shader); - return ((IWineD3DBaseShaderImpl *)iface)->baseShader.parent; + return shader->parent; } -static HRESULT STDMETHODCALLTYPE vertexshader_GetFunction(IWineD3DVertexShader *iface, void *data, UINT *data_size) +HRESULT CDECL wined3d_shader_get_byte_code(const struct wined3d_shader *shader, + void *byte_code, UINT *byte_code_size) { - TRACE("iface %p, data %p, data_size %p.\n", iface, data, data_size); + TRACE("shader %p, byte_code %p, byte_code_size %p.\n", shader, byte_code, byte_code_size); - return shader_get_function((IWineD3DBaseShaderImpl *)iface, data, data_size); + if (!byte_code) + { + *byte_code_size = shader->functionLength; + return WINED3D_OK; + } + + if (*byte_code_size < shader->functionLength) + { + /* MSDN claims (for d3d8 at least) that if *byte_code_size is smaller + * than the required size we should write the required size and + * return D3DERR_MOREDATA. That's not actually true. */ + return WINED3DERR_INVALIDCALL; + } + + memcpy(byte_code, shader->function, shader->functionLength); + + return WINED3D_OK; } /* Set local constants for d3d8 shaders. */ -static HRESULT STDMETHODCALLTYPE vertexshader_SetLocalConstantsF(IWineD3DVertexShader *iface, +HRESULT CDECL wined3d_shader_set_local_constants_float(struct wined3d_shader *shader, UINT start_idx, const float *src_data, UINT count) { - IWineD3DVertexShaderImpl *shader =(IWineD3DVertexShaderImpl *)iface; - IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)shader->baseShader.device; - UINT i, end_idx; + UINT end_idx = start_idx + count; + UINT i; - TRACE("iface %p, start_idx %u, src_data %p, count %u.\n", iface, start_idx, src_data, count); + TRACE("shader %p, start_idx %u, src_data %p, count %u.\n", shader, start_idx, src_data, count); - end_idx = start_idx + count; - if (end_idx > device->d3d_vshader_constantF) + if (end_idx > shader->limits.constant_float) { - WARN("end_idx %u > float constants limit %u.\n", end_idx, device->d3d_vshader_constantF); - end_idx = device->d3d_vshader_constantF; + WARN("end_idx %u > float constants limit %u.\n", + end_idx, shader->limits.constant_float); + end_idx = shader->limits.constant_float; } for (i = start_idx; i < end_idx; ++i) { - local_constant* lconst = HeapAlloc(GetProcessHeap(), 0, sizeof(local_constant)); - if (!lconst) return E_OUTOFMEMORY; + struct local_constant *lconst = HeapAlloc(GetProcessHeap(), 0, sizeof(local_constant)); + if (!lconst) + return E_OUTOFMEMORY; lconst->idx = i; memcpy(lconst->value, src_data + (i - start_idx) * 4 /* 4 components */, 4 * sizeof(float)); - list_add_head(&shader->baseShader.constantsF, &lconst->entry); + list_add_head(&shader->constantsF, &lconst->entry); } return WINED3D_OK; } -static const IWineD3DVertexShaderVtbl IWineD3DVertexShader_Vtbl = -{ - /* IUnknown methods */ - vertexshader_QueryInterface, - vertexshader_AddRef, - vertexshader_Release, - /* IWineD3DBase methods */ - vertexshader_GetParent, - /* IWineD3DBaseShader methods */ - vertexshader_GetFunction, - /* IWineD3DVertexShader methods */ - vertexshader_SetLocalConstantsF, -}; - void find_vs_compile_args(const struct wined3d_state *state, - IWineD3DVertexShaderImpl *shader, struct vs_compile_args *args) + const struct wined3d_shader *shader, struct vs_compile_args *args) { args->fog_src = state->render_states[WINED3DRS_FOGTABLEMODE] == WINED3DFOG_NONE ? VS_FOG_COORD : VS_FOG_Z; args->clip_enabled = state->render_states[WINED3DRS_CLIPPING] && state->render_states[WINED3DRS_CLIPPLANEENABLE]; - args->swizzle_map = ((IWineD3DDeviceImpl *)shader->baseShader.device)->strided_streams.swizzle_map; + args->swizzle_map = shader->device->strided_streams.swizzle_map; } static BOOL match_usage(BYTE usage1, BYTE usage_idx1, BYTE usage2, BYTE usage_idx2) @@ -1739,18 +1706,18 @@ static BOOL match_usage(BYTE usage1, BYTE usage_idx1, BYTE usage2, BYTE usage_id return FALSE; } -BOOL vshader_get_input(struct IWineD3DVertexShaderImpl *shader, +BOOL vshader_get_input(struct wined3d_shader *shader, BYTE usage_req, BYTE usage_idx_req, unsigned int *regnum) { - WORD map = shader->baseShader.reg_maps.input_registers; + WORD map = shader->reg_maps.input_registers; unsigned int i; for (i = 0; map; map >>= 1, ++i) { if (!(map & 1)) continue; - if (match_usage(shader->attributes[i].usage, - shader->attributes[i].usage_idx, usage_req, usage_idx_req)) + if (match_usage(shader->u.vs.attributes[i].usage, + shader->u.vs.attributes[i].usage_idx, usage_req, usage_idx_req)) { *regnum = i; return TRUE; @@ -1759,43 +1726,43 @@ BOOL vshader_get_input(struct IWineD3DVertexShaderImpl *shader, return FALSE; } -static void vertexshader_set_limits(IWineD3DVertexShaderImpl *shader) +static void vertexshader_set_limits(struct wined3d_shader *shader) { - DWORD shader_version = WINED3D_SHADER_VERSION(shader->baseShader.reg_maps.shader_version.major, - shader->baseShader.reg_maps.shader_version.minor); - IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)shader->baseShader.device; + DWORD shader_version = WINED3D_SHADER_VERSION(shader->reg_maps.shader_version.major, + shader->reg_maps.shader_version.minor); + struct wined3d_device *device = shader->device; - shader->baseShader.limits.texcoord = 0; - shader->baseShader.limits.attributes = 16; - shader->baseShader.limits.packed_input = 0; + shader->limits.texcoord = 0; + shader->limits.attributes = 16; + shader->limits.packed_input = 0; switch (shader_version) { case WINED3D_SHADER_VERSION(1, 0): case WINED3D_SHADER_VERSION(1, 1): - shader->baseShader.limits.temporary = 12; - shader->baseShader.limits.constant_bool = 0; - shader->baseShader.limits.constant_int = 0; - shader->baseShader.limits.address = 1; - shader->baseShader.limits.packed_output = 12; - shader->baseShader.limits.sampler = 0; - shader->baseShader.limits.label = 0; + shader->limits.temporary = 12; + shader->limits.constant_bool = 0; + shader->limits.constant_int = 0; + shader->limits.address = 1; + shader->limits.packed_output = 12; + shader->limits.sampler = 0; + shader->limits.label = 0; /* TODO: vs_1_1 has a minimum of 96 constants. What happens when * a vs_1_1 shader is used on a vs_3_0 capable card that has 256 * constants? */ - shader->baseShader.limits.constant_float = min(256, device->d3d_vshader_constantF); + shader->limits.constant_float = min(256, device->d3d_vshader_constantF); break; case WINED3D_SHADER_VERSION(2, 0): case WINED3D_SHADER_VERSION(2, 1): - shader->baseShader.limits.temporary = 12; - shader->baseShader.limits.constant_bool = 16; - shader->baseShader.limits.constant_int = 16; - shader->baseShader.limits.address = 1; - shader->baseShader.limits.packed_output = 12; - shader->baseShader.limits.sampler = 0; - shader->baseShader.limits.label = 16; - shader->baseShader.limits.constant_float = min(256, device->d3d_vshader_constantF); + shader->limits.temporary = 12; + shader->limits.constant_bool = 16; + shader->limits.constant_int = 16; + shader->limits.address = 1; + shader->limits.packed_output = 12; + shader->limits.sampler = 0; + shader->limits.label = 16; + shader->limits.constant_float = min(256, device->d3d_vshader_constantF); break; case WINED3D_SHADER_VERSION(4, 0): @@ -1803,68 +1770,65 @@ static void vertexshader_set_limits(IWineD3DVertexShaderImpl *shader) /* Fall through. */ case WINED3D_SHADER_VERSION(3, 0): - shader->baseShader.limits.temporary = 32; - shader->baseShader.limits.constant_bool = 32; - shader->baseShader.limits.constant_int = 32; - shader->baseShader.limits.address = 1; - shader->baseShader.limits.packed_output = 12; - shader->baseShader.limits.sampler = 4; - shader->baseShader.limits.label = 16; /* FIXME: 2048 */ + shader->limits.temporary = 32; + shader->limits.constant_bool = 32; + shader->limits.constant_int = 32; + shader->limits.address = 1; + shader->limits.packed_output = 12; + shader->limits.sampler = 4; + shader->limits.label = 16; /* FIXME: 2048 */ /* DX10 cards on Windows advertise a d3d9 constant limit of 256 * even though they are capable of supporting much more (GL * drivers advertise 1024). d3d9.dll and d3d8.dll clamp the * wined3d-advertised maximum. Clamp the constant limit for <= 3.0 * shaders to 256. */ - shader->baseShader.limits.constant_float = min(256, device->d3d_vshader_constantF); + shader->limits.constant_float = min(256, device->d3d_vshader_constantF); break; default: - shader->baseShader.limits.temporary = 12; - shader->baseShader.limits.constant_bool = 16; - shader->baseShader.limits.constant_int = 16; - shader->baseShader.limits.address = 1; - shader->baseShader.limits.packed_output = 12; - shader->baseShader.limits.sampler = 0; - shader->baseShader.limits.label = 16; - shader->baseShader.limits.constant_float = min(256, device->d3d_vshader_constantF); + shader->limits.temporary = 12; + shader->limits.constant_bool = 16; + shader->limits.constant_int = 16; + shader->limits.address = 1; + shader->limits.packed_output = 12; + shader->limits.sampler = 0; + shader->limits.label = 16; + shader->limits.constant_float = min(256, device->d3d_vshader_constantF); FIXME("Unrecognized vertex shader version \"%u.%u\".\n", - shader->baseShader.reg_maps.shader_version.major, - shader->baseShader.reg_maps.shader_version.minor); + shader->reg_maps.shader_version.major, + shader->reg_maps.shader_version.minor); } } -HRESULT vertexshader_init(IWineD3DVertexShaderImpl *shader, IWineD3DDeviceImpl *device, +static HRESULT vertexshader_init(struct wined3d_shader *shader, struct wined3d_device *device, const DWORD *byte_code, const struct wined3d_shader_signature *output_signature, void *parent, const struct wined3d_parent_ops *parent_ops) { - const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; - struct shader_reg_maps *reg_maps = &shader->baseShader.reg_maps; + struct wined3d_shader_reg_maps *reg_maps = &shader->reg_maps; unsigned int i; HRESULT hr; WORD map; if (!byte_code) return WINED3DERR_INVALIDCALL; - shader->lpVtbl = &IWineD3DVertexShader_Vtbl; - shader_init(&shader->baseShader, device, parent, parent_ops); - - hr = shader_set_function((IWineD3DBaseShaderImpl *)shader, byte_code, - output_signature, device->d3d_vshader_constantF); + shader_init(shader, device, parent, parent_ops); + hr = shader_set_function(shader, byte_code, output_signature, device->d3d_vshader_constantF); if (FAILED(hr)) { WARN("Failed to set function, hr %#x.\n", hr); - shader_cleanup((IWineD3DBaseShader *)shader); + shader_cleanup(shader); return hr; } - map = shader->baseShader.reg_maps.input_registers; + map = reg_maps->input_registers; for (i = 0; map; map >>= 1, ++i) { - if (!(map & 1) || !shader->baseShader.input_signature[i].semantic_name) continue; + if (!(map & 1) || !shader->input_signature[i].semantic_name) + continue; - shader->attributes[i].usage = - shader_usage_from_semantic_name(shader->baseShader.input_signature[i].semantic_name); - shader->attributes[i].usage_idx = shader->baseShader.input_signature[i].semantic_idx; + shader->u.vs.attributes[i].usage = + shader_usage_from_semantic_name(shader->input_signature[i].semantic_name); + shader->u.vs.attributes[i].usage_idx = shader->input_signature[i].semantic_idx; } if (output_signature) @@ -1873,229 +1837,54 @@ HRESULT vertexshader_init(IWineD3DVertexShaderImpl *shader, IWineD3DDeviceImpl * { struct wined3d_shader_signature_element *e = &output_signature->elements[i]; reg_maps->output_registers |= 1 << e->register_idx; - shader->baseShader.output_signature[e->register_idx] = *e; + shader->output_signature[e->register_idx] = *e; } } vertexshader_set_limits(shader); - if (device->vs_selected_mode == SHADER_ARB - && (gl_info->quirks & WINED3D_QUIRK_ARB_VS_OFFSET_LIMIT) - && shader->min_rel_offset <= shader->max_rel_offset) - { - if (shader->max_rel_offset - shader->min_rel_offset > 127) - { - FIXME("The difference between the minimum and maximum relative offset is > 127.\n"); - FIXME("Which this OpenGL implementation does not support. Try using GLSL.\n"); - FIXME("Min: %d, Max: %d.\n", shader->min_rel_offset, shader->max_rel_offset); - } - else if (shader->max_rel_offset - shader->min_rel_offset > 63) - { - shader->rel_offset = shader->min_rel_offset + 63; - } - else if (shader->max_rel_offset > 63) - { - shader->rel_offset = shader->min_rel_offset; - } - else - { - shader->rel_offset = 0; - } - } - - shader->baseShader.load_local_constsF = shader->baseShader.reg_maps.usesrelconstF - && !list_empty(&shader->baseShader.constantsF); + shader->load_local_constsF = reg_maps->usesrelconstF + && !list_empty(&shader->constantsF); return WINED3D_OK; } -static HRESULT STDMETHODCALLTYPE geometryshader_QueryInterface(IWineD3DGeometryShader *iface, - REFIID riid, void **object) -{ - TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object); - - if (IsEqualGUID(riid, &IID_IWineD3DGeometryShader) - || IsEqualGUID(riid, &IID_IWineD3DBaseShader) - || IsEqualGUID(riid, &IID_IWineD3DBase) - || IsEqualGUID(riid, &IID_IUnknown)) - { - IUnknown_AddRef(iface); - *object = iface; - return S_OK; - } - - WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid)); - - *object = NULL; - return E_NOINTERFACE; -} - -static ULONG STDMETHODCALLTYPE geometryshader_AddRef(IWineD3DGeometryShader *iface) -{ - struct wined3d_geometryshader *shader = (struct wined3d_geometryshader *)iface; - ULONG refcount = InterlockedIncrement(&shader->base_shader.ref); - - TRACE("%p increasing refcount to %u.\n", shader, refcount); - - return refcount; -} - -/* Do not call while under the GL lock. */ -static ULONG STDMETHODCALLTYPE geometryshader_Release(IWineD3DGeometryShader *iface) -{ - struct wined3d_geometryshader *shader = (struct wined3d_geometryshader *)iface; - ULONG refcount = InterlockedDecrement(&shader->base_shader.ref); - - TRACE("%p decreasing refcount to %u.\n", shader, refcount); - - if (!refcount) - { - shader_cleanup((IWineD3DBaseShader *)iface); - shader->base_shader.parent_ops->wined3d_object_destroyed(shader->base_shader.parent); - HeapFree(GetProcessHeap(), 0, shader); - } - - return refcount; -} - -static void * STDMETHODCALLTYPE geometryshader_GetParent(IWineD3DGeometryShader *iface) -{ - TRACE("iface %p.\n", iface); - - return ((IWineD3DBaseShaderImpl *)iface)->baseShader.parent; -} - -static HRESULT STDMETHODCALLTYPE geometryshader_GetFunction(IWineD3DGeometryShader *iface, void *data, UINT *data_size) -{ - TRACE("iface %p, data %p, data_size %p.\n", iface, data, data_size); - - return shader_get_function((IWineD3DBaseShaderImpl *)iface, data, data_size); -} - -static const IWineD3DGeometryShaderVtbl wined3d_geometryshader_vtbl = -{ - /* IUnknown methods */ - geometryshader_QueryInterface, - geometryshader_AddRef, - geometryshader_Release, - /* IWineD3DBase methods */ - geometryshader_GetParent, - /* IWineD3DBaseShader methods */ - geometryshader_GetFunction, -}; - -HRESULT geometryshader_init(struct wined3d_geometryshader *shader, IWineD3DDeviceImpl *device, +static HRESULT geometryshader_init(struct wined3d_shader *shader, struct wined3d_device *device, const DWORD *byte_code, const struct wined3d_shader_signature *output_signature, void *parent, const struct wined3d_parent_ops *parent_ops) { HRESULT hr; - shader->vtbl = &wined3d_geometryshader_vtbl; - shader_init(&shader->base_shader, device, parent, parent_ops); - - hr = shader_set_function((IWineD3DBaseShaderImpl *)shader, byte_code, output_signature, 0); + shader_init(shader, device, parent, parent_ops); + hr = shader_set_function(shader, byte_code, output_signature, 0); if (FAILED(hr)) { WARN("Failed to set function, hr %#x.\n", hr); - shader_cleanup((IWineD3DBaseShader *)shader); + shader_cleanup(shader); return hr; } - shader->base_shader.load_local_constsF = FALSE; + shader->load_local_constsF = FALSE; return WINED3D_OK; } -static HRESULT STDMETHODCALLTYPE pixelshader_QueryInterface(IWineD3DPixelShader *iface, REFIID riid, void **object) -{ - TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object); - - if (IsEqualGUID(riid, &IID_IWineD3DPixelShader) - || IsEqualGUID(riid, &IID_IWineD3DBaseShader) - || IsEqualGUID(riid, &IID_IWineD3DBase) - || IsEqualGUID(riid, &IID_IUnknown)) - { - IUnknown_AddRef(iface); - *object = iface; - return S_OK; - } - - WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid)); - - *object = NULL; - return E_NOINTERFACE; -} - -static ULONG STDMETHODCALLTYPE pixelshader_AddRef(IWineD3DPixelShader *iface) -{ - IWineD3DPixelShaderImpl *shader = (IWineD3DPixelShaderImpl *)iface; - ULONG refcount = InterlockedIncrement(&shader->baseShader.ref); - - TRACE("%p increasing refcount to %u.\n", shader, refcount); - - return refcount; -} - -/* Do not call while under the GL lock. */ -static ULONG STDMETHODCALLTYPE pixelshader_Release(IWineD3DPixelShader *iface) -{ - IWineD3DPixelShaderImpl *shader = (IWineD3DPixelShaderImpl *)iface; - ULONG refcount = InterlockedDecrement(&shader->baseShader.ref); - - TRACE("%p decreasing refcount to %u.\n", shader, refcount); - - if (!refcount) - { - shader_cleanup((IWineD3DBaseShader *)iface); - shader->baseShader.parent_ops->wined3d_object_destroyed(shader->baseShader.parent); - HeapFree(GetProcessHeap(), 0, shader); - } - - return refcount; -} - -static void * STDMETHODCALLTYPE pixelshader_GetParent(IWineD3DPixelShader *iface) -{ - TRACE("iface %p.\n", iface); - - return ((IWineD3DBaseShaderImpl *)iface)->baseShader.parent; -} - -static HRESULT STDMETHODCALLTYPE pixelshader_GetFunction(IWineD3DPixelShader *iface, void *data, UINT *data_size) -{ - TRACE("iface %p, data %p, data_size %p.\n", iface, data, data_size); - - return shader_get_function((IWineD3DBaseShaderImpl *)iface, data, data_size); -} - -static const IWineD3DPixelShaderVtbl IWineD3DPixelShader_Vtbl = -{ - /* IUnknown methods */ - pixelshader_QueryInterface, - pixelshader_AddRef, - pixelshader_Release, - /* IWineD3DBase methods */ - pixelshader_GetParent, - /* IWineD3DBaseShader methods */ - pixelshader_GetFunction -}; - void find_ps_compile_args(const struct wined3d_state *state, - IWineD3DPixelShaderImpl *shader, struct ps_compile_args *args) + const struct wined3d_shader *shader, struct ps_compile_args *args) { - IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *)shader->baseShader.device; - IWineD3DBaseTextureImpl *texture; + struct wined3d_device *device = shader->device; + const struct wined3d_texture *texture; UINT i; memset(args, 0, sizeof(*args)); /* FIXME: Make sure all bits are set. */ if (state->render_states[WINED3DRS_SRGBWRITEENABLE]) { - IWineD3DSurfaceImpl *rt = device->render_targets[0]; - if(rt->resource.format->Flags & WINED3DFMT_FLAG_SRGB_WRITE) args->srgb_correction = 1; + struct wined3d_surface *rt = device->fb.render_targets[0]; + if (rt->resource.format->flags & WINED3DFMT_FLAG_SRGB_WRITE) args->srgb_correction = 1; } - if (shader->baseShader.reg_maps.shader_version.major == 1 - && shader->baseShader.reg_maps.shader_version.minor <= 3) + if (shader->reg_maps.shader_version.major == 1 + && shader->reg_maps.shader_version.minor <= 3) { for (i = 0; i < 4; ++i) { @@ -2109,7 +1898,9 @@ void find_ps_compile_args(const struct wined3d_state *state, for (i = 0; i < MAX_FRAGMENT_SAMPLERS; ++i) { - if (!shader->baseShader.reg_maps.sampler_type[i]) continue; + if (!shader->reg_maps.sampler_type[i]) + continue; + texture = state->textures[i]; if (!texture) { @@ -2118,16 +1909,14 @@ void find_ps_compile_args(const struct wined3d_state *state, } args->color_fixup[i] = texture->resource.format->color_fixup; - if (texture->resource.format->Flags & WINED3DFMT_FLAG_SHADOW) + if (texture->resource.format->flags & WINED3DFMT_FLAG_SHADOW) args->shadow |= 1 << i; /* Flag samplers that need NP2 texcoord fixup. */ - if (!texture->baseTexture.pow2Matrix_identity) - { + if (!(texture->flags & WINED3D_TEXTURE_POW2_MAT_IDENT)) args->np2_fixup |= (1 << i); - } } - if (shader->baseShader.reg_maps.shader_version.major >= 3) + if (shader->reg_maps.shader_version.major >= 3) { if (device->strided_streams.position_transformed) { @@ -2178,14 +1967,14 @@ void find_ps_compile_args(const struct wined3d_state *state, } } -static void pixelshader_set_limits(IWineD3DPixelShaderImpl *shader) +static void pixelshader_set_limits(struct wined3d_shader *shader) { - DWORD shader_version = WINED3D_SHADER_VERSION(shader->baseShader.reg_maps.shader_version.major, - shader->baseShader.reg_maps.shader_version.minor); + DWORD shader_version = WINED3D_SHADER_VERSION(shader->reg_maps.shader_version.major, + shader->reg_maps.shader_version.minor); - shader->baseShader.limits.attributes = 0; - shader->baseShader.limits.address = 0; - shader->baseShader.limits.packed_output = 0; + shader->limits.attributes = 0; + shader->limits.address = 0; + shader->limits.packed_output = 0; switch (shader_version) { @@ -2193,47 +1982,47 @@ static void pixelshader_set_limits(IWineD3DPixelShaderImpl *shader) case WINED3D_SHADER_VERSION(1, 1): case WINED3D_SHADER_VERSION(1, 2): case WINED3D_SHADER_VERSION(1, 3): - shader->baseShader.limits.temporary = 2; - shader->baseShader.limits.constant_float = 8; - shader->baseShader.limits.constant_int = 0; - shader->baseShader.limits.constant_bool = 0; - shader->baseShader.limits.texcoord = 4; - shader->baseShader.limits.sampler = 4; - shader->baseShader.limits.packed_input = 0; - shader->baseShader.limits.label = 0; + shader->limits.temporary = 2; + shader->limits.constant_float = 8; + shader->limits.constant_int = 0; + shader->limits.constant_bool = 0; + shader->limits.texcoord = 4; + shader->limits.sampler = 4; + shader->limits.packed_input = 0; + shader->limits.label = 0; break; case WINED3D_SHADER_VERSION(1, 4): - shader->baseShader.limits.temporary = 6; - shader->baseShader.limits.constant_float = 8; - shader->baseShader.limits.constant_int = 0; - shader->baseShader.limits.constant_bool = 0; - shader->baseShader.limits.texcoord = 6; - shader->baseShader.limits.sampler = 6; - shader->baseShader.limits.packed_input = 0; - shader->baseShader.limits.label = 0; + shader->limits.temporary = 6; + shader->limits.constant_float = 8; + shader->limits.constant_int = 0; + shader->limits.constant_bool = 0; + shader->limits.texcoord = 6; + shader->limits.sampler = 6; + shader->limits.packed_input = 0; + shader->limits.label = 0; break; /* FIXME: Temporaries must match D3DPSHADERCAPS2_0.NumTemps. */ case WINED3D_SHADER_VERSION(2, 0): - shader->baseShader.limits.temporary = 32; - shader->baseShader.limits.constant_float = 32; - shader->baseShader.limits.constant_int = 16; - shader->baseShader.limits.constant_bool = 16; - shader->baseShader.limits.texcoord = 8; - shader->baseShader.limits.sampler = 16; - shader->baseShader.limits.packed_input = 0; + shader->limits.temporary = 32; + shader->limits.constant_float = 32; + shader->limits.constant_int = 16; + shader->limits.constant_bool = 16; + shader->limits.texcoord = 8; + shader->limits.sampler = 16; + shader->limits.packed_input = 0; break; case WINED3D_SHADER_VERSION(2, 1): - shader->baseShader.limits.temporary = 32; - shader->baseShader.limits.constant_float = 32; - shader->baseShader.limits.constant_int = 16; - shader->baseShader.limits.constant_bool = 16; - shader->baseShader.limits.texcoord = 8; - shader->baseShader.limits.sampler = 16; - shader->baseShader.limits.packed_input = 0; - shader->baseShader.limits.label = 16; + shader->limits.temporary = 32; + shader->limits.constant_float = 32; + shader->limits.constant_int = 16; + shader->limits.constant_bool = 16; + shader->limits.texcoord = 8; + shader->limits.sampler = 16; + shader->limits.packed_input = 0; + shader->limits.label = 16; break; case WINED3D_SHADER_VERSION(4, 0): @@ -2241,32 +2030,32 @@ static void pixelshader_set_limits(IWineD3DPixelShaderImpl *shader) /* Fall through. */ case WINED3D_SHADER_VERSION(3, 0): - shader->baseShader.limits.temporary = 32; - shader->baseShader.limits.constant_float = 224; - shader->baseShader.limits.constant_int = 16; - shader->baseShader.limits.constant_bool = 16; - shader->baseShader.limits.texcoord = 0; - shader->baseShader.limits.sampler = 16; - shader->baseShader.limits.packed_input = 12; - shader->baseShader.limits.label = 16; /* FIXME: 2048 */ + shader->limits.temporary = 32; + shader->limits.constant_float = 224; + shader->limits.constant_int = 16; + shader->limits.constant_bool = 16; + shader->limits.texcoord = 0; + shader->limits.sampler = 16; + shader->limits.packed_input = 12; + shader->limits.label = 16; /* FIXME: 2048 */ break; default: - shader->baseShader.limits.temporary = 32; - shader->baseShader.limits.constant_float = 32; - shader->baseShader.limits.constant_int = 16; - shader->baseShader.limits.constant_bool = 16; - shader->baseShader.limits.texcoord = 8; - shader->baseShader.limits.sampler = 16; - shader->baseShader.limits.packed_input = 0; - shader->baseShader.limits.label = 0; + shader->limits.temporary = 32; + shader->limits.constant_float = 32; + shader->limits.constant_int = 16; + shader->limits.constant_bool = 16; + shader->limits.texcoord = 8; + shader->limits.sampler = 16; + shader->limits.packed_input = 0; + shader->limits.label = 0; FIXME("Unrecognized pixel shader version %u.%u\n", - shader->baseShader.reg_maps.shader_version.major, - shader->baseShader.reg_maps.shader_version.minor); + shader->reg_maps.shader_version.major, + shader->reg_maps.shader_version.minor); } } -HRESULT pixelshader_init(IWineD3DPixelShaderImpl *shader, IWineD3DDeviceImpl *device, +static HRESULT pixelshader_init(struct wined3d_shader *shader, struct wined3d_device *device, const DWORD *byte_code, const struct wined3d_shader_signature *output_signature, void *parent, const struct wined3d_parent_ops *parent_ops) { @@ -2276,15 +2065,12 @@ HRESULT pixelshader_init(IWineD3DPixelShaderImpl *shader, IWineD3DDeviceImpl *de if (!byte_code) return WINED3DERR_INVALIDCALL; - shader->lpVtbl = &IWineD3DPixelShader_Vtbl; - shader_init(&shader->baseShader, device, parent, parent_ops); - - hr = shader_set_function((IWineD3DBaseShaderImpl *)shader, byte_code, - output_signature, device->d3d_pshader_constantF); + shader_init(shader, device, parent, parent_ops); + hr = shader_set_function(shader, byte_code, output_signature, device->d3d_pshader_constantF); if (FAILED(hr)) { WARN("Failed to set function, hr %#x.\n", hr); - shader_cleanup((IWineD3DBaseShader *)shader); + shader_cleanup(shader); return hr; } @@ -2292,7 +2078,7 @@ HRESULT pixelshader_init(IWineD3DPixelShaderImpl *shader, IWineD3DDeviceImpl *de for (i = 0; i < MAX_REG_INPUT; ++i) { - if (shader->input_reg_used[i]) + if (shader->u.ps.input_reg_used[i]) { ++num_regs_used; highest_reg_used = i; @@ -2314,27 +2100,28 @@ HRESULT pixelshader_init(IWineD3DPixelShaderImpl *shader, IWineD3DDeviceImpl *de for (i = 0; i < MAX_REG_INPUT; ++i) { - shader->input_reg_map[i] = i; + shader->u.ps.input_reg_map[i] = i; } - shader->declared_in_count = highest_reg_used + 1; + shader->u.ps.declared_in_count = highest_reg_used + 1; } else { - shader->declared_in_count = 0; + shader->u.ps.declared_in_count = 0; for (i = 0; i < MAX_REG_INPUT; ++i) { - if (shader->input_reg_used[i]) shader->input_reg_map[i] = shader->declared_in_count++; - else shader->input_reg_map[i] = ~0U; + if (shader->u.ps.input_reg_used[i]) + shader->u.ps.input_reg_map[i] = shader->u.ps.declared_in_count++; + else shader->u.ps.input_reg_map[i] = ~0U; } } - shader->baseShader.load_local_constsF = FALSE; + shader->load_local_constsF = FALSE; return WINED3D_OK; } -void pixelshader_update_samplers(struct shader_reg_maps *reg_maps, IWineD3DBaseTexture * const *textures) +void pixelshader_update_samplers(struct wined3d_shader_reg_maps *reg_maps, struct wined3d_texture * const *textures) { WINED3DSAMPLER_TEXTURE_TYPE *sampler_type = reg_maps->sampler_type; unsigned int i; @@ -2353,7 +2140,7 @@ void pixelshader_update_samplers(struct shader_reg_maps *reg_maps, IWineD3DBaseT continue; } - switch (((IWineD3DBaseTextureImpl *)textures[i])->baseTexture.target) + switch (textures[i]->target) { case GL_TEXTURE_RECTANGLE_ARB: case GL_TEXTURE_2D: @@ -2372,9 +2159,107 @@ void pixelshader_update_samplers(struct shader_reg_maps *reg_maps, IWineD3DBaseT break; default: - FIXME("Unrecognized texture type %#x, using 2D.\n", - ((IWineD3DBaseTextureImpl *)textures[i])->baseTexture.target); + FIXME("Unrecognized texture type %#x, using 2D.\n", textures[i]->target); sampler_type[i] = WINED3DSTT_2D; } } } + +HRESULT CDECL wined3d_shader_create_gs(struct wined3d_device *device, const DWORD *byte_code, + const struct wined3d_shader_signature *output_signature, void *parent, + const struct wined3d_parent_ops *parent_ops, struct wined3d_shader **shader) +{ + struct wined3d_shader *object; + HRESULT hr; + + TRACE("device %p, byte_code %p, output_signature %p, parent %p, parent_ops %p, shader %p.\n", + device, byte_code, output_signature, parent, parent_ops, shader); + + object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); + if (!object) + { + ERR("Failed to allocate shader memory.\n"); + return E_OUTOFMEMORY; + } + + hr = geometryshader_init(object, device, byte_code, output_signature, parent, parent_ops); + if (FAILED(hr)) + { + WARN("Failed to initialize geometry shader, hr %#x.\n", hr); + HeapFree(GetProcessHeap(), 0, object); + return hr; + } + + TRACE("Created geometry shader %p.\n", object); + *shader = object; + + return WINED3D_OK; +} + +HRESULT CDECL wined3d_shader_create_ps(struct wined3d_device *device, const DWORD *byte_code, + const struct wined3d_shader_signature *output_signature, void *parent, + const struct wined3d_parent_ops *parent_ops, struct wined3d_shader **shader) +{ + struct wined3d_shader *object; + HRESULT hr; + + TRACE("device %p, byte_code %p, output_signature %p, parent %p, parent_ops %p, shader %p.\n", + device, byte_code, output_signature, parent, parent_ops, shader); + + if (device->ps_selected_mode == SHADER_NONE) + return WINED3DERR_INVALIDCALL; + + object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); + if (!object) + { + ERR("Failed to allocate shader memory.\n"); + return E_OUTOFMEMORY; + } + + hr = pixelshader_init(object, device, byte_code, output_signature, parent, parent_ops); + if (FAILED(hr)) + { + WARN("Failed to initialize pixel shader, hr %#x.\n", hr); + HeapFree(GetProcessHeap(), 0, object); + return hr; + } + + TRACE("Created pixel shader %p.\n", object); + *shader = object; + + return WINED3D_OK; +} + +HRESULT CDECL wined3d_shader_create_vs(struct wined3d_device *device, const DWORD *byte_code, + const struct wined3d_shader_signature *output_signature, void *parent, + const struct wined3d_parent_ops *parent_ops, struct wined3d_shader **shader) +{ + struct wined3d_shader *object; + HRESULT hr; + + TRACE("device %p, byte_code %p, output_signature %p, parent %p, parent_ops %p, shader %p.\n", + device, byte_code, output_signature, parent, parent_ops, shader); + + if (device->vs_selected_mode == SHADER_NONE) + return WINED3DERR_INVALIDCALL; + + object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); + if (!object) + { + ERR("Failed to allocate shader memory.\n"); + return E_OUTOFMEMORY; + } + + hr = vertexshader_init(object, device, byte_code, output_signature, parent, parent_ops); + if (FAILED(hr)) + { + WARN("Failed to initialize vertex shader, hr %#x.\n", hr); + HeapFree(GetProcessHeap(), 0, object); + return hr; + } + + TRACE("Created vertex shader %p.\n", object); + *shader = object; + + return WINED3D_OK; +} diff --git a/dll/directx/wine/wined3d/shader_sm4.c b/dll/directx/wine/wined3d/shader_sm4.c index a43861498bc..d0b36c6715c 100644 --- a/dll/directx/wine/wined3d/shader_sm4.c +++ b/dll/directx/wine/wined3d/shader_sm4.c @@ -23,11 +23,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader); +#define WINED3D_SM4_INSTRUCTION_MODIFIER (1 << 31) + #define WINED3D_SM4_INSTRUCTION_LENGTH_SHIFT 24 #define WINED3D_SM4_INSTRUCTION_LENGTH_MASK (0xf << WINED3D_SM4_INSTRUCTION_LENGTH_SHIFT) #define WINED3D_SM4_OPCODE_MASK 0xff +#define WINED3D_SM4_REGISTER_MODIFIER (1 << 31) + #define WINED3D_SM4_REGISTER_ORDER_SHIFT 20 #define WINED3D_SM4_REGISTER_ORDER_MASK (0x3 << WINED3D_SM4_REGISTER_ORDER_SHIFT) @@ -48,34 +52,44 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader); enum wined3d_sm4_opcode { - WINED3D_SM4_OP_ADD = 0x00, - WINED3D_SM4_OP_AND = 0x01, - WINED3D_SM4_OP_BREAK = 0x02, - WINED3D_SM4_OP_BREAKC = 0x03, - WINED3D_SM4_OP_CUT = 0x09, - WINED3D_SM4_OP_DP3 = 0x10, - WINED3D_SM4_OP_DP4 = 0x11, - WINED3D_SM4_OP_EMIT = 0x13, - WINED3D_SM4_OP_ENDIF = 0x15, - WINED3D_SM4_OP_ENDLOOP = 0x16, - WINED3D_SM4_OP_EXP = 0x19, - WINED3D_SM4_OP_FRC = 0x1a, - WINED3D_SM4_OP_IADD = 0x1e, - WINED3D_SM4_OP_IF = 0x1f, - WINED3D_SM4_OP_IGE = 0x21, - WINED3D_SM4_OP_IMUL = 0x26, - WINED3D_SM4_OP_LOG = 0x2f, - WINED3D_SM4_OP_LOOP = 0x30, - WINED3D_SM4_OP_LT = 0x31, - WINED3D_SM4_OP_MAD = 0x32, - WINED3D_SM4_OP_MIN = 0x33, - WINED3D_SM4_OP_MAX = 0x34, - WINED3D_SM4_OP_MOV = 0x36, - WINED3D_SM4_OP_MOVC = 0x37, - WINED3D_SM4_OP_MUL = 0x38, - WINED3D_SM4_OP_RET = 0x3e, - WINED3D_SM4_OP_RSQ = 0x44, - WINED3D_SM4_OP_SINCOS = 0x4d, + WINED3D_SM4_OP_ADD = 0x00, + WINED3D_SM4_OP_AND = 0x01, + WINED3D_SM4_OP_BREAK = 0x02, + WINED3D_SM4_OP_BREAKC = 0x03, + WINED3D_SM4_OP_CUT = 0x09, + WINED3D_SM4_OP_DIV = 0x0e, + WINED3D_SM4_OP_DP3 = 0x10, + WINED3D_SM4_OP_DP4 = 0x11, + WINED3D_SM4_OP_EMIT = 0x13, + WINED3D_SM4_OP_ENDIF = 0x15, + WINED3D_SM4_OP_ENDLOOP = 0x16, + WINED3D_SM4_OP_EXP = 0x19, + WINED3D_SM4_OP_FRC = 0x1a, + WINED3D_SM4_OP_FTOI = 0x1b, + WINED3D_SM4_OP_IADD = 0x1e, + WINED3D_SM4_OP_IF = 0x1f, + WINED3D_SM4_OP_IEQ = 0x20, + WINED3D_SM4_OP_IGE = 0x21, + WINED3D_SM4_OP_IMUL = 0x26, + WINED3D_SM4_OP_ITOF = 0x2b, + WINED3D_SM4_OP_LD = 0x2d, + WINED3D_SM4_OP_LOG = 0x2f, + WINED3D_SM4_OP_LOOP = 0x30, + WINED3D_SM4_OP_LT = 0x31, + WINED3D_SM4_OP_MAD = 0x32, + WINED3D_SM4_OP_MIN = 0x33, + WINED3D_SM4_OP_MAX = 0x34, + WINED3D_SM4_OP_MOV = 0x36, + WINED3D_SM4_OP_MOVC = 0x37, + WINED3D_SM4_OP_MUL = 0x38, + WINED3D_SM4_OP_RET = 0x3e, + WINED3D_SM4_OP_RSQ = 0x44, + WINED3D_SM4_OP_SAMPLE = 0x45, + WINED3D_SM4_OP_SAMPLE_LOD = 0x48, + WINED3D_SM4_OP_SAMPLE_GRAD = 0x49, + WINED3D_SM4_OP_SQRT = 0x4b, + WINED3D_SM4_OP_SINCOS = 0x4d, + WINED3D_SM4_OP_UTOF = 0x56, }; enum wined3d_sm4_register_type @@ -84,6 +98,7 @@ enum wined3d_sm4_register_type WINED3D_SM4_RT_INPUT = 0x1, WINED3D_SM4_RT_OUTPUT = 0x2, WINED3D_SM4_RT_IMMCONST = 0x4, + WINED3D_SM4_RT_SAMPLER = 0x6, WINED3D_SM4_RT_CONSTBUFFER = 0x8, WINED3D_SM4_RT_NULL = 0xd, }; @@ -118,34 +133,44 @@ struct sysval_map static const struct wined3d_sm4_opcode_info opcode_table[] = { - {WINED3D_SM4_OP_ADD, WINED3DSIH_ADD, 1, 2}, - {WINED3D_SM4_OP_AND, WINED3DSIH_AND, 1, 2}, - {WINED3D_SM4_OP_BREAK, WINED3DSIH_BREAK, 0, 0}, - {WINED3D_SM4_OP_BREAKC, WINED3DSIH_BREAKP, 0, 1}, - {WINED3D_SM4_OP_CUT, WINED3DSIH_CUT, 0, 0}, - {WINED3D_SM4_OP_DP3, WINED3DSIH_DP3, 1, 2}, - {WINED3D_SM4_OP_DP4, WINED3DSIH_DP4, 1, 2}, - {WINED3D_SM4_OP_EMIT, WINED3DSIH_EMIT, 0, 0}, - {WINED3D_SM4_OP_ENDIF, WINED3DSIH_ENDIF, 0, 0}, - {WINED3D_SM4_OP_ENDLOOP,WINED3DSIH_ENDLOOP, 0, 0}, - {WINED3D_SM4_OP_EXP, WINED3DSIH_EXP, 1, 1}, - {WINED3D_SM4_OP_FRC, WINED3DSIH_FRC, 1, 1}, - {WINED3D_SM4_OP_IADD, WINED3DSIH_IADD, 1, 2}, - {WINED3D_SM4_OP_IF, WINED3DSIH_IF, 0, 1}, - {WINED3D_SM4_OP_IGE, WINED3DSIH_IGE, 1, 2}, - {WINED3D_SM4_OP_IMUL, WINED3DSIH_IMUL, 2, 2}, - {WINED3D_SM4_OP_LOG, WINED3DSIH_LOG, 1, 1}, - {WINED3D_SM4_OP_LOOP, WINED3DSIH_LOOP, 0, 0}, - {WINED3D_SM4_OP_LT, WINED3DSIH_LT, 1, 2}, - {WINED3D_SM4_OP_MAD, WINED3DSIH_MAD, 1, 3}, - {WINED3D_SM4_OP_MIN, WINED3DSIH_MIN, 1, 2}, - {WINED3D_SM4_OP_MAX, WINED3DSIH_MAX, 1, 2}, - {WINED3D_SM4_OP_MOV, WINED3DSIH_MOV, 1, 1}, - {WINED3D_SM4_OP_MOVC, WINED3DSIH_MOVC, 1, 3}, - {WINED3D_SM4_OP_MUL, WINED3DSIH_MUL, 1, 2}, - {WINED3D_SM4_OP_RET, WINED3DSIH_RET, 0, 0}, - {WINED3D_SM4_OP_RSQ, WINED3DSIH_RSQ, 1, 1}, - {WINED3D_SM4_OP_SINCOS, WINED3DSIH_SINCOS, 2, 1}, + {WINED3D_SM4_OP_ADD, WINED3DSIH_ADD, 1, 2}, + {WINED3D_SM4_OP_AND, WINED3DSIH_AND, 1, 2}, + {WINED3D_SM4_OP_BREAK, WINED3DSIH_BREAK, 0, 0}, + {WINED3D_SM4_OP_BREAKC, WINED3DSIH_BREAKP, 0, 1}, + {WINED3D_SM4_OP_CUT, WINED3DSIH_CUT, 0, 0}, + {WINED3D_SM4_OP_DIV, WINED3DSIH_DIV, 1, 2}, + {WINED3D_SM4_OP_DP3, WINED3DSIH_DP3, 1, 2}, + {WINED3D_SM4_OP_DP4, WINED3DSIH_DP4, 1, 2}, + {WINED3D_SM4_OP_EMIT, WINED3DSIH_EMIT, 0, 0}, + {WINED3D_SM4_OP_ENDIF, WINED3DSIH_ENDIF, 0, 0}, + {WINED3D_SM4_OP_ENDLOOP, WINED3DSIH_ENDLOOP, 0, 0}, + {WINED3D_SM4_OP_EXP, WINED3DSIH_EXP, 1, 1}, + {WINED3D_SM4_OP_FRC, WINED3DSIH_FRC, 1, 1}, + {WINED3D_SM4_OP_FTOI, WINED3DSIH_FTOI, 1, 1}, + {WINED3D_SM4_OP_IADD, WINED3DSIH_IADD, 1, 2}, + {WINED3D_SM4_OP_IF, WINED3DSIH_IF, 0, 1}, + {WINED3D_SM4_OP_IEQ, WINED3DSIH_IEQ, 1, 2}, + {WINED3D_SM4_OP_IGE, WINED3DSIH_IGE, 1, 2}, + {WINED3D_SM4_OP_IMUL, WINED3DSIH_IMUL, 2, 2}, + {WINED3D_SM4_OP_ITOF, WINED3DSIH_ITOF, 1, 1}, + {WINED3D_SM4_OP_LD, WINED3DSIH_LD, 1, 2}, + {WINED3D_SM4_OP_LOG, WINED3DSIH_LOG, 1, 1}, + {WINED3D_SM4_OP_LOOP, WINED3DSIH_LOOP, 0, 0}, + {WINED3D_SM4_OP_LT, WINED3DSIH_LT, 1, 2}, + {WINED3D_SM4_OP_MAD, WINED3DSIH_MAD, 1, 3}, + {WINED3D_SM4_OP_MIN, WINED3DSIH_MIN, 1, 2}, + {WINED3D_SM4_OP_MAX, WINED3DSIH_MAX, 1, 2}, + {WINED3D_SM4_OP_MOV, WINED3DSIH_MOV, 1, 1}, + {WINED3D_SM4_OP_MOVC, WINED3DSIH_MOVC, 1, 3}, + {WINED3D_SM4_OP_MUL, WINED3DSIH_MUL, 1, 2}, + {WINED3D_SM4_OP_RET, WINED3DSIH_RET, 0, 0}, + {WINED3D_SM4_OP_RSQ, WINED3DSIH_RSQ, 1, 1}, + {WINED3D_SM4_OP_SAMPLE, WINED3DSIH_SAMPLE, 1, 3}, + {WINED3D_SM4_OP_SAMPLE_LOD, WINED3DSIH_SAMPLE_LOD, 1, 4}, + {WINED3D_SM4_OP_SAMPLE_GRAD,WINED3DSIH_SAMPLE_GRAD, 1, 5}, + {WINED3D_SM4_OP_SQRT, WINED3DSIH_SQRT, 1, 1}, + {WINED3D_SM4_OP_SINCOS, WINED3DSIH_SINCOS, 2, 1}, + {WINED3D_SM4_OP_UTOF, WINED3DSIH_UTOF, 1, 1}, }; static const WINED3DSHADER_PARAM_REGISTER_TYPE register_type_table[] = @@ -156,8 +181,8 @@ static const WINED3DSHADER_PARAM_REGISTER_TYPE register_type_table[] = /* UNKNOWN */ 0, /* WINED3D_SM4_RT_IMMCONST */ WINED3DSPR_IMMCONST, /* UNKNOWN */ 0, - /* UNKNOWN */ 0, - /* UNKNOWN */ 0, + /* WINED3D_SM4_RT_SAMPLER */ WINED3DSPR_SAMPLER, + /* WINED3D_SM4_RT_RESOURCE */ WINED3DSPR_RESOURCE, /* WINED3D_SM4_RT_CONSTBUFFER */ WINED3DSPR_CONSTBUFFER, /* UNKNOWN */ 0, /* UNKNOWN */ 0, @@ -315,6 +340,12 @@ static void shader_sm4_read_opcode(void *data, const DWORD **ptr, struct wined3d ins->predicate = 0; ins->dst_count = opcode_info->dst_count; ins->src_count = opcode_info->src_count; + + if (token & WINED3D_SM4_INSTRUCTION_MODIFIER) + { + DWORD modifier = *(*ptr)++; + FIXME("Skipping modifier 0x%08x.\n", modifier); + } } static void shader_sm4_read_src_param(void *data, const DWORD **ptr, struct wined3d_shader_src_param *src_param, @@ -336,6 +367,34 @@ static void shader_sm4_read_src_param(void *data, const DWORD **ptr, struct wine src_param->reg.type = register_type_table[register_type]; } + if (token & WINED3D_SM4_REGISTER_MODIFIER) + { + DWORD modifier = *(*ptr)++; + + /* FIXME: This will probably break down at some point. The SM4 + * modifiers look like flags, while wined3d currently has an enum + * with possible combinations, e.g. WINED3DSPSM_ABSNEG. */ + switch (modifier) + { + case 0x41: + src_param->modifiers = WINED3DSPSM_NEG; + break; + + case 0x81: + src_param->modifiers = WINED3DSPSM_ABS; + break; + + default: + FIXME("Skipping modifier 0x%08x.\n", modifier); + src_param->modifiers = WINED3DSPSM_NONE; + break; + } + } + else + { + src_param->modifiers = WINED3DSPSM_NONE; + } + order = (token & WINED3D_SM4_REGISTER_ORDER_MASK) >> WINED3D_SM4_REGISTER_ORDER_SHIFT; if (order < 1) src_param->reg.idx = ~0U; @@ -376,7 +435,6 @@ static void shader_sm4_read_src_param(void *data, const DWORD **ptr, struct wine src_param->swizzle = (token & WINED3D_SM4_SWIZZLE_MASK) >> WINED3D_SM4_SWIZZLE_SHIFT; } - src_param->modifiers = 0; src_param->reg.rel_addr = NULL; map_register(priv, &src_param->reg); diff --git a/dll/directx/wine/wined3d/state.c b/dll/directx/wine/wined3d/state.c index 6a415eee807..a43cc383ca1 100644 --- a/dll/directx/wine/wined3d/state.c +++ b/dll/directx/wine/wined3d/state.c @@ -8,7 +8,7 @@ * Copyright 2005 Oliver Stieber * Copyright 2006 Henri Verbeet * Copyright 2006-2008 Stefan Dösinger for CodeWeavers - * Copyright 2009 Henri Verbeet for CodeWeavers + * Copyright 2009-2011 Henri Verbeet for CodeWeavers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -37,19 +37,19 @@ WINE_DECLARE_DEBUG_CHANNEL(d3d_shader); /* GL locking for state handlers is done by the caller. */ -static void state_blendop(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context); +static void state_blendop(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context); -static void state_undefined(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_undefined(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { ERR("Undefined state.\n"); } -static void state_nop(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_nop(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { TRACE("%s: nop in current pipe config.\n", debug_d3dstate(state)); } -static void state_fillmode(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_fillmode(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { WINED3DFILLMODE Value = stateblock->state.render_states[WINED3DRS_FILLMODE]; @@ -71,7 +71,7 @@ static void state_fillmode(DWORD state, IWineD3DStateBlockImpl *stateblock, stru } } -static void state_lighting(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_lighting(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { /* Lighting is not enabled if transformed vertices are drawn * but lighting does not affect the stream sources, so it is not grouped for performance reasons. @@ -94,10 +94,10 @@ static void state_lighting(DWORD state, IWineD3DStateBlockImpl *stateblock, stru } } -static void state_zenable(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_zenable(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { /* No z test without depth stencil buffers */ - if (!stateblock->device->depth_stencil) + if (!stateblock->device->fb.depth_stencil) { TRACE("No Z buffer - disabling depth test\n"); glDisable(GL_DEPTH_TEST); /* This also disables z writing in gl */ @@ -126,7 +126,7 @@ static void state_zenable(DWORD state, IWineD3DStateBlockImpl *stateblock, struc } } -static void state_cullmode(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_cullmode(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { /* glFrontFace() is set in context.c at context init and on an * offscreen / onscreen rendering switch. */ @@ -154,7 +154,7 @@ static void state_cullmode(DWORD state, IWineD3DStateBlockImpl *stateblock, stru } } -static void state_shademode(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_shademode(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { switch (stateblock->state.render_states[WINED3DRS_SHADEMODE]) { @@ -175,7 +175,7 @@ static void state_shademode(DWORD state, IWineD3DStateBlockImpl *stateblock, str } } -static void state_ditherenable(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_ditherenable(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { if (stateblock->state.render_states[WINED3DRS_DITHERENABLE]) { @@ -189,7 +189,7 @@ static void state_ditherenable(DWORD state, IWineD3DStateBlockImpl *stateblock, } } -static void state_zwritenable(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_zwritenable(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { /* TODO: Test if in d3d z writing is enabled even if ZENABLE is off. * If yes, this has to be merged with ZENABLE and ZFUNC. */ @@ -205,7 +205,7 @@ static void state_zwritenable(DWORD state, IWineD3DStateBlockImpl *stateblock, s } } -static void state_zfunc(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_zfunc(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { GLenum depth_func = CompareFunc(stateblock->state.render_states[WINED3DRS_ZFUNC]); @@ -230,7 +230,7 @@ static void state_zfunc(DWORD state, IWineD3DStateBlockImpl *stateblock, struct checkGLcall("glDepthFunc"); } -static void state_ambient(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_ambient(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { float col[4]; D3DCOLORTOGLFLOAT4(stateblock->state.render_states[WINED3DRS_AMBIENT], col); @@ -240,12 +240,54 @@ static void state_ambient(DWORD state, IWineD3DStateBlockImpl *stateblock, struc checkGLcall("glLightModel for MODEL_AMBIENT"); } -static void state_blend(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static GLenum gl_blend_factor(WINED3DBLEND factor, const struct wined3d_format *dst_format) { - IWineD3DSurfaceImpl *target = stateblock->device->render_targets[0]; + switch (factor) + { + case WINED3DBLEND_ZERO: + return GL_ZERO; + case WINED3DBLEND_ONE: + return GL_ONE; + case WINED3DBLEND_SRCCOLOR: + return GL_SRC_COLOR; + case WINED3DBLEND_INVSRCCOLOR: + return GL_ONE_MINUS_SRC_COLOR; + case WINED3DBLEND_SRCALPHA: + return GL_SRC_ALPHA; + case WINED3DBLEND_INVSRCALPHA: + return GL_ONE_MINUS_SRC_ALPHA; + case WINED3DBLEND_DESTCOLOR: + return GL_DST_COLOR; + case WINED3DBLEND_INVDESTCOLOR: + return GL_ONE_MINUS_DST_COLOR; + /* To compensate for the lack of format switching with backbuffer + * offscreen rendering, and with onscreen rendering, we modify the + * alpha test parameters for (INV)DESTALPHA if the render target + * doesn't support alpha blending. A nonexistent alpha channel + * returns 1.0, so WINED3DBLEND_DESTALPHA becomes GL_ONE, and + * WINED3DBLEND_INVDESTALPHA becomes GL_ZERO. */ + case WINED3DBLEND_DESTALPHA: + return dst_format->alpha_mask ? GL_DST_ALPHA : GL_ONE; + case WINED3DBLEND_INVDESTALPHA: + return dst_format->alpha_mask ? GL_ONE_MINUS_DST_ALPHA : GL_ZERO; + case WINED3DBLEND_SRCALPHASAT: + return GL_SRC_ALPHA_SATURATE; + case WINED3DBLEND_BLENDFACTOR: + return GL_CONSTANT_COLOR_EXT; + case WINED3DBLEND_INVBLENDFACTOR: + return GL_ONE_MINUS_CONSTANT_COLOR_EXT; + default: + FIXME("Unhandled blend factor %#x.\n", factor); + return GL_NONE; + } +} + +static void state_blend(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) +{ + struct wined3d_surface *target = stateblock->device->fb.render_targets[0]; const struct wined3d_gl_info *gl_info = context->gl_info; - int srcBlend = GL_ZERO; - int dstBlend = GL_ZERO; + GLenum srcBlend, dstBlend; + WINED3DBLEND d3d_blend; /* According to the red book, GL_LINE_SMOOTH needs GL_BLEND with specific * blending parameters to work. */ @@ -257,7 +299,7 @@ static void state_blend(DWORD state, IWineD3DStateBlockImpl *stateblock, struct * With blending on we could face a big performance penalty. * The d3d9 visual test confirms the behavior. */ if (context->render_offscreen - && !(target->resource.format->Flags & WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING)) + && !(target->resource.format->flags & WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING)) { glDisable(GL_BLEND); checkGLcall("glDisable GL_BLEND"); @@ -273,86 +315,25 @@ static void state_blend(DWORD state, IWineD3DStateBlockImpl *stateblock, struct return; }; - switch (stateblock->state.render_states[WINED3DRS_DESTBLEND]) + /* WINED3DBLEND_BOTHSRCALPHA and WINED3DBLEND_BOTHINVSRCALPHA are legacy + * source blending values which are still valid up to d3d9. They should + * not occur as dest blend values. */ + d3d_blend = stateblock->state.render_states[WINED3DRS_SRCBLEND]; + if (d3d_blend == WINED3DBLEND_BOTHSRCALPHA) { - case WINED3DBLEND_ZERO : dstBlend = GL_ZERO; break; - case WINED3DBLEND_ONE : dstBlend = GL_ONE; break; - case WINED3DBLEND_SRCCOLOR : dstBlend = GL_SRC_COLOR; break; - case WINED3DBLEND_INVSRCCOLOR : dstBlend = GL_ONE_MINUS_SRC_COLOR; break; - case WINED3DBLEND_SRCALPHA : dstBlend = GL_SRC_ALPHA; break; - case WINED3DBLEND_INVSRCALPHA : dstBlend = GL_ONE_MINUS_SRC_ALPHA; break; - case WINED3DBLEND_DESTCOLOR : dstBlend = GL_DST_COLOR; break; - case WINED3DBLEND_INVDESTCOLOR : dstBlend = GL_ONE_MINUS_DST_COLOR; break; - - /* To compensate the lack of format switching with backbuffer offscreen rendering, - * and with onscreen rendering, we modify the alpha test parameters for (INV)DESTALPHA - * if the render target doesn't support alpha blending. A nonexistent alpha channel - * returns 1.0, so D3DBLEND_DESTALPHA is GL_ONE, and D3DBLEND_INVDESTALPHA is GL_ZERO - */ - case WINED3DBLEND_DESTALPHA : - dstBlend = target->resource.format->alpha_mask ? GL_DST_ALPHA : GL_ONE; - break; - case WINED3DBLEND_INVDESTALPHA : - dstBlend = target->resource.format->alpha_mask ? GL_ONE_MINUS_DST_ALPHA : GL_ZERO; - break; - - case WINED3DBLEND_SRCALPHASAT : - dstBlend = GL_SRC_ALPHA_SATURATE; - WARN("Application uses SRCALPHASAT as dest blend factor, expect problems\n"); - break; - - /* WINED3DBLEND_BOTHSRCALPHA and WINED3DBLEND_BOTHINVSRCALPHA are legacy source blending - * values which are still valid up to d3d9. They should not occur as dest blend values - */ - case WINED3DBLEND_BOTHSRCALPHA : dstBlend = GL_SRC_ALPHA; - srcBlend = GL_SRC_ALPHA; - FIXME("WINED3DRS_DESTBLEND = WINED3DBLEND_BOTHSRCALPHA, what to do?\n"); - break; - - case WINED3DBLEND_BOTHINVSRCALPHA : dstBlend = GL_ONE_MINUS_SRC_ALPHA; - srcBlend = GL_ONE_MINUS_SRC_ALPHA; - FIXME("WINED3DRS_DESTBLEND = WINED3DBLEND_BOTHINVSRCALPHA, what to do?\n"); - break; - - case WINED3DBLEND_BLENDFACTOR : dstBlend = GL_CONSTANT_COLOR; break; - case WINED3DBLEND_INVBLENDFACTOR : dstBlend = GL_ONE_MINUS_CONSTANT_COLOR; break; - default: - FIXME("Unrecognized dst blend value %#x.\n", - stateblock->state.render_states[WINED3DRS_DESTBLEND]); + srcBlend = GL_SRC_ALPHA; + dstBlend = GL_ONE_MINUS_SRC_ALPHA; } - - switch (stateblock->state.render_states[WINED3DRS_SRCBLEND]) + else if (d3d_blend == WINED3DBLEND_BOTHINVSRCALPHA) { - case WINED3DBLEND_ZERO : srcBlend = GL_ZERO; break; - case WINED3DBLEND_ONE : srcBlend = GL_ONE; break; - case WINED3DBLEND_SRCCOLOR : srcBlend = GL_SRC_COLOR; break; - case WINED3DBLEND_INVSRCCOLOR : srcBlend = GL_ONE_MINUS_SRC_COLOR; break; - case WINED3DBLEND_SRCALPHA : srcBlend = GL_SRC_ALPHA; break; - case WINED3DBLEND_INVSRCALPHA : srcBlend = GL_ONE_MINUS_SRC_ALPHA; break; - case WINED3DBLEND_DESTCOLOR : srcBlend = GL_DST_COLOR; break; - case WINED3DBLEND_INVDESTCOLOR : srcBlend = GL_ONE_MINUS_DST_COLOR; break; - case WINED3DBLEND_SRCALPHASAT : srcBlend = GL_SRC_ALPHA_SATURATE; break; - - case WINED3DBLEND_DESTALPHA : - srcBlend = target->resource.format->alpha_mask ? GL_DST_ALPHA : GL_ONE; - break; - case WINED3DBLEND_INVDESTALPHA : - srcBlend = target->resource.format->alpha_mask ? GL_ONE_MINUS_DST_ALPHA : GL_ZERO; - break; - - case WINED3DBLEND_BOTHSRCALPHA : srcBlend = GL_SRC_ALPHA; - dstBlend = GL_ONE_MINUS_SRC_ALPHA; - break; - - case WINED3DBLEND_BOTHINVSRCALPHA : srcBlend = GL_ONE_MINUS_SRC_ALPHA; - dstBlend = GL_SRC_ALPHA; - break; - - case WINED3DBLEND_BLENDFACTOR : srcBlend = GL_CONSTANT_COLOR; break; - case WINED3DBLEND_INVBLENDFACTOR : srcBlend = GL_ONE_MINUS_CONSTANT_COLOR; break; - default: - FIXME("Unrecognized src blend value %#x.\n", - stateblock->state.render_states[WINED3DRS_SRCBLEND]); + srcBlend = GL_ONE_MINUS_SRC_ALPHA; + dstBlend = GL_SRC_ALPHA; + } + else + { + srcBlend = gl_blend_factor(d3d_blend, target->resource.format); + dstBlend = gl_blend_factor(stateblock->state.render_states[WINED3DRS_DESTBLEND], + target->resource.format); } if (stateblock->state.render_states[WINED3DRS_EDGEANTIALIAS] @@ -378,8 +359,7 @@ static void state_blend(DWORD state, IWineD3DStateBlockImpl *stateblock, struct if (stateblock->state.render_states[WINED3DRS_SEPARATEALPHABLENDENABLE]) { - int srcBlendAlpha = GL_ZERO; - int dstBlendAlpha = GL_ZERO; + GLenum srcBlendAlpha, dstBlendAlpha; /* Separate alpha blending requires GL_EXT_blend_function_separate, so make sure it is around */ if (!context->gl_info->supported[EXT_BLEND_FUNC_SEPARATE]) @@ -388,68 +368,25 @@ static void state_blend(DWORD state, IWineD3DStateBlockImpl *stateblock, struct return; } - switch (stateblock->state.render_states[WINED3DRS_DESTBLENDALPHA]) + /* WINED3DBLEND_BOTHSRCALPHA and WINED3DBLEND_BOTHINVSRCALPHA are legacy + * source blending values which are still valid up to d3d9. They should + * not occur as dest blend values. */ + d3d_blend = stateblock->state.render_states[WINED3DRS_SRCBLENDALPHA]; + if (d3d_blend == WINED3DBLEND_BOTHSRCALPHA) { - case WINED3DBLEND_ZERO : dstBlendAlpha = GL_ZERO; break; - case WINED3DBLEND_ONE : dstBlendAlpha = GL_ONE; break; - case WINED3DBLEND_SRCCOLOR : dstBlendAlpha = GL_SRC_COLOR; break; - case WINED3DBLEND_INVSRCCOLOR : dstBlendAlpha = GL_ONE_MINUS_SRC_COLOR; break; - case WINED3DBLEND_SRCALPHA : dstBlendAlpha = GL_SRC_ALPHA; break; - case WINED3DBLEND_INVSRCALPHA : dstBlendAlpha = GL_ONE_MINUS_SRC_ALPHA; break; - case WINED3DBLEND_DESTCOLOR : dstBlendAlpha = GL_DST_COLOR; break; - case WINED3DBLEND_INVDESTCOLOR : dstBlendAlpha = GL_ONE_MINUS_DST_COLOR; break; - case WINED3DBLEND_DESTALPHA : dstBlendAlpha = GL_DST_ALPHA; break; - case WINED3DBLEND_INVDESTALPHA : dstBlendAlpha = GL_DST_ALPHA; break; - case WINED3DBLEND_SRCALPHASAT : - dstBlend = GL_SRC_ALPHA_SATURATE; - WARN("Application uses SRCALPHASAT as dest blend factor, expect problems\n"); - break; - /* WINED3DBLEND_BOTHSRCALPHA and WINED3DBLEND_BOTHINVSRCALPHA are legacy source blending - * values which are still valid up to d3d9. They should not occur as dest blend values - */ - case WINED3DBLEND_BOTHSRCALPHA : - dstBlendAlpha = GL_SRC_ALPHA; - srcBlendAlpha = GL_SRC_ALPHA; - FIXME("WINED3DRS_DESTBLENDALPHA = WINED3DBLEND_BOTHSRCALPHA, what to do?\n"); - break; - case WINED3DBLEND_BOTHINVSRCALPHA : - dstBlendAlpha = GL_ONE_MINUS_SRC_ALPHA; - srcBlendAlpha = GL_ONE_MINUS_SRC_ALPHA; - FIXME("WINED3DRS_DESTBLENDALPHA = WINED3DBLEND_BOTHINVSRCALPHA, what to do?\n"); - break; - case WINED3DBLEND_BLENDFACTOR : dstBlendAlpha = GL_CONSTANT_COLOR; break; - case WINED3DBLEND_INVBLENDFACTOR : dstBlendAlpha = GL_ONE_MINUS_CONSTANT_COLOR; break; - default: - FIXME("Unrecognized dst blend alpha value %#x.\n", - stateblock->state.render_states[WINED3DRS_DESTBLENDALPHA]); + srcBlendAlpha = GL_SRC_ALPHA; + dstBlendAlpha = GL_ONE_MINUS_SRC_ALPHA; } - - switch (stateblock->state.render_states[WINED3DRS_SRCBLENDALPHA]) + else if (d3d_blend == WINED3DBLEND_BOTHINVSRCALPHA) { - case WINED3DBLEND_ZERO : srcBlendAlpha = GL_ZERO; break; - case WINED3DBLEND_ONE : srcBlendAlpha = GL_ONE; break; - case WINED3DBLEND_SRCCOLOR : srcBlendAlpha = GL_SRC_COLOR; break; - case WINED3DBLEND_INVSRCCOLOR : srcBlendAlpha = GL_ONE_MINUS_SRC_COLOR; break; - case WINED3DBLEND_SRCALPHA : srcBlendAlpha = GL_SRC_ALPHA; break; - case WINED3DBLEND_INVSRCALPHA : srcBlendAlpha = GL_ONE_MINUS_SRC_ALPHA; break; - case WINED3DBLEND_DESTCOLOR : srcBlendAlpha = GL_DST_COLOR; break; - case WINED3DBLEND_INVDESTCOLOR : srcBlendAlpha = GL_ONE_MINUS_DST_COLOR; break; - case WINED3DBLEND_SRCALPHASAT : srcBlendAlpha = GL_SRC_ALPHA_SATURATE; break; - case WINED3DBLEND_DESTALPHA : srcBlendAlpha = GL_DST_ALPHA; break; - case WINED3DBLEND_INVDESTALPHA : srcBlendAlpha = GL_DST_ALPHA; break; - case WINED3DBLEND_BOTHSRCALPHA : - srcBlendAlpha = GL_SRC_ALPHA; - dstBlendAlpha = GL_ONE_MINUS_SRC_ALPHA; - break; - case WINED3DBLEND_BOTHINVSRCALPHA : - srcBlendAlpha = GL_ONE_MINUS_SRC_ALPHA; - dstBlendAlpha = GL_SRC_ALPHA; - break; - case WINED3DBLEND_BLENDFACTOR : srcBlendAlpha = GL_CONSTANT_COLOR; break; - case WINED3DBLEND_INVBLENDFACTOR : srcBlendAlpha = GL_ONE_MINUS_CONSTANT_COLOR; break; - default: - FIXME("Unrecognized src blend alpha value %#x.\n", - stateblock->state.render_states[WINED3DRS_SRCBLENDALPHA]); + srcBlendAlpha = GL_ONE_MINUS_SRC_ALPHA; + dstBlendAlpha = GL_SRC_ALPHA; + } + else + { + srcBlendAlpha = gl_blend_factor(d3d_blend, target->resource.format); + dstBlendAlpha = gl_blend_factor(stateblock->state.render_states[WINED3DRS_DESTBLENDALPHA], + target->resource.format); } GL_EXTCALL(glBlendFuncSeparateEXT(srcBlend, dstBlend, srcBlendAlpha, dstBlendAlpha)); @@ -466,12 +403,12 @@ static void state_blend(DWORD state, IWineD3DStateBlockImpl *stateblock, struct stateblock_apply_state(STATE_TEXTURESTAGE(0, WINED3DTSS_ALPHAOP), stateblock, context); } -static void state_blendfactor_w(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_blendfactor_w(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { WARN("Unsupported in local OpenGL implementation: glBlendColorEXT\n"); } -static void state_blendfactor(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_blendfactor(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { const struct wined3d_gl_info *gl_info = context->gl_info; float col[4]; @@ -482,7 +419,7 @@ static void state_blendfactor(DWORD state, IWineD3DStateBlockImpl *stateblock, s checkGLcall("glBlendColor"); } -static void state_alpha(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_alpha(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { int glParm = 0; float ref; @@ -498,12 +435,12 @@ static void state_alpha(DWORD state, IWineD3DStateBlockImpl *stateblock, struct */ if (stateblock->state.textures[0]) { - IWineD3DBaseTextureImpl *texture = stateblock->state.textures[0]; - GLenum texture_dimensions = texture->baseTexture.target; + struct wined3d_texture *texture = stateblock->state.textures[0]; + GLenum texture_dimensions = texture->target; if (texture_dimensions == GL_TEXTURE_2D || texture_dimensions == GL_TEXTURE_RECTANGLE_ARB) { - IWineD3DSurfaceImpl *surf = (IWineD3DSurfaceImpl *)texture->baseTexture.sub_resources[0]; + struct wined3d_surface *surf = surface_from_resource(texture->sub_resources[0]); if (surf->CKeyFlags & WINEDDSD_CKSRCBLT) { @@ -547,7 +484,7 @@ static void state_alpha(DWORD state, IWineD3DStateBlockImpl *stateblock, struct } } -static void state_clipping(DWORD state_id, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_clipping(DWORD state_id, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { const struct wined3d_gl_info *gl_info = context->gl_info; const struct wined3d_state *state = &stateblock->state; @@ -629,16 +566,36 @@ static void state_clipping(DWORD state_id, IWineD3DStateBlockImpl *stateblock, s } } -static void state_blendop_w(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_blendop_w(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { WARN("Unsupported in local OpenGL implementation: glBlendEquation\n"); } -static void state_blendop(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static GLenum gl_blend_op(WINED3DBLENDOP op) +{ + switch (op) + { + case WINED3DBLENDOP_ADD: + return GL_FUNC_ADD_EXT; + case WINED3DBLENDOP_SUBTRACT: + return GL_FUNC_SUBTRACT_EXT; + case WINED3DBLENDOP_REVSUBTRACT: + return GL_FUNC_REVERSE_SUBTRACT_EXT; + case WINED3DBLENDOP_MIN: + return GL_MIN_EXT; + case WINED3DBLENDOP_MAX: + return GL_MAX_EXT; + default: + FIXME("Unhandled blend op %#x.\n", op); + return GL_NONE; + } +} + +static void state_blendop(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { const struct wined3d_gl_info *gl_info = context->gl_info; - int blendEquation = GL_FUNC_ADD; - int blendEquationAlpha = GL_FUNC_ADD; + int blendEquation = GL_FUNC_ADD_EXT; + int blendEquationAlpha = GL_FUNC_ADD_EXT; /* BLENDOPALPHA requires GL_EXT_blend_equation_separate, so make sure it is around */ if (stateblock->state.render_states[WINED3DRS_BLENDOPALPHA] @@ -648,29 +605,8 @@ static void state_blendop(DWORD state, IWineD3DStateBlockImpl *stateblock, struc return; } - switch (stateblock->state.render_states[WINED3DRS_BLENDOP]) - { - case WINED3DBLENDOP_ADD : blendEquation = GL_FUNC_ADD; break; - case WINED3DBLENDOP_SUBTRACT : blendEquation = GL_FUNC_SUBTRACT; break; - case WINED3DBLENDOP_REVSUBTRACT : blendEquation = GL_FUNC_REVERSE_SUBTRACT; break; - case WINED3DBLENDOP_MIN : blendEquation = GL_MIN; break; - case WINED3DBLENDOP_MAX : blendEquation = GL_MAX; break; - default: - FIXME("Unrecognized/Unhandled D3DBLENDOP value %#x.\n", - stateblock->state.render_states[WINED3DRS_BLENDOP]); - } - - switch (stateblock->state.render_states[WINED3DRS_BLENDOPALPHA]) - { - case WINED3DBLENDOP_ADD : blendEquationAlpha = GL_FUNC_ADD; break; - case WINED3DBLENDOP_SUBTRACT : blendEquationAlpha = GL_FUNC_SUBTRACT; break; - case WINED3DBLENDOP_REVSUBTRACT : blendEquationAlpha = GL_FUNC_REVERSE_SUBTRACT; break; - case WINED3DBLENDOP_MIN : blendEquationAlpha = GL_MIN; break; - case WINED3DBLENDOP_MAX : blendEquationAlpha = GL_MAX; break; - default: - FIXME("Unrecognized/Unhandled D3DBLENDOP value %#x\n", - stateblock->state.render_states[WINED3DRS_BLENDOPALPHA]); - } + blendEquation = gl_blend_op(stateblock->state.render_states[WINED3DRS_BLENDOP]); + blendEquationAlpha = gl_blend_op(stateblock->state.render_states[WINED3DRS_BLENDOPALPHA]); if (stateblock->state.render_states[WINED3DRS_SEPARATEALPHABLENDENABLE]) { @@ -684,7 +620,7 @@ static void state_blendop(DWORD state, IWineD3DStateBlockImpl *stateblock, struc } } -static void state_specularenable(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_specularenable(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { const struct wined3d_gl_info *gl_info = context->gl_info; /* Originally this used glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL,GL_SEPARATE_SPECULAR_COLOR) @@ -801,7 +737,7 @@ static void state_specularenable(DWORD state, IWineD3DStateBlockImpl *stateblock checkGLcall("glMaterialfv(GL_EMISSION)"); } -static void state_texfactor(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_texfactor(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { const struct wined3d_gl_info *gl_info = context->gl_info; unsigned int i; @@ -841,7 +777,7 @@ static void renderstate_stencil_twosided(struct wined3d_context *context, GLint checkGLcall("glStencilOp(...)"); } -static void state_stencil(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_stencil(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { const struct wined3d_gl_info *gl_info = context->gl_info; DWORD onesided_enable = FALSE; @@ -858,7 +794,7 @@ static void state_stencil(DWORD state, IWineD3DStateBlockImpl *stateblock, struc GLint stencilPass_ccw = GL_KEEP; /* No stencil test without a stencil buffer. */ - if (!stateblock->device->depth_stencil) + if (!stateblock->device->fb.depth_stencil) { glDisable(GL_STENCIL_TEST); checkGLcall("glDisable GL_STENCIL_TEST"); @@ -939,9 +875,9 @@ static void state_stencil(DWORD state, IWineD3DStateBlockImpl *stateblock, struc } } -static void state_stencilwrite2s(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_stencilwrite2s(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { - DWORD mask = stateblock->device->depth_stencil ? stateblock->state.render_states[WINED3DRS_STENCILWRITEMASK] : 0; + DWORD mask = stateblock->device->fb.depth_stencil ? stateblock->state.render_states[WINED3DRS_STENCILWRITEMASK] : 0; const struct wined3d_gl_info *gl_info = context->gl_info; GL_EXTCALL(glActiveStencilFaceEXT(GL_BACK)); @@ -953,15 +889,15 @@ static void state_stencilwrite2s(DWORD state, IWineD3DStateBlockImpl *stateblock glStencilMask(mask); } -static void state_stencilwrite(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_stencilwrite(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { - DWORD mask = stateblock->device->depth_stencil ? stateblock->state.render_states[WINED3DRS_STENCILWRITEMASK] : 0; + DWORD mask = stateblock->device->fb.depth_stencil ? stateblock->state.render_states[WINED3DRS_STENCILWRITEMASK] : 0; glStencilMask(mask); checkGLcall("glStencilMask"); } -static void state_fog_vertexpart(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_fog_vertexpart(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { TRACE("state %#x, stateblock %p, context %p\n", state, stateblock, context); @@ -1001,7 +937,7 @@ static void state_fog_vertexpart(DWORD state, IWineD3DStateBlockImpl *stateblock } } -void state_fogstartend(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +void state_fogstartend(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { float fogstart, fogend; union { @@ -1027,7 +963,7 @@ void state_fogstartend(DWORD state, IWineD3DStateBlockImpl *stateblock, struct w fogend = tmpvalue.f; /* In GL, fogstart == fogend disables fog, in D3D everything's fogged.*/ if(fogstart == fogend) { - fogstart = -1.0f / 0.0f; + fogstart = -INFINITY; fogend = 0.0f; } break; @@ -1050,7 +986,7 @@ void state_fogstartend(DWORD state, IWineD3DStateBlockImpl *stateblock, struct w TRACE("Fog End == %f\n", fogend); } -void state_fog_fragpart(DWORD state_id, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +void state_fog_fragpart(DWORD state_id, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { const struct wined3d_state *state = &stateblock->state; enum fogsource new_source; @@ -1202,13 +1138,13 @@ void state_fog_fragpart(DWORD state_id, IWineD3DStateBlockImpl *stateblock, stru } } -static void state_rangefog_w(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_rangefog_w(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { if (stateblock->state.render_states[WINED3DRS_RANGEFOGENABLE]) WARN("Range fog enabled, but not supported by this opengl implementation\n"); } -static void state_rangefog(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_rangefog(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { if (stateblock->state.render_states[WINED3DRS_RANGEFOGENABLE]) { @@ -1220,7 +1156,7 @@ static void state_rangefog(DWORD state, IWineD3DStateBlockImpl *stateblock, stru } } -void state_fogcolor(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +void state_fogcolor(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { float col[4]; D3DCOLORTOGLFLOAT4(stateblock->state.render_states[WINED3DRS_FOGCOLOR], col); @@ -1228,7 +1164,7 @@ void state_fogcolor(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wine checkGLcall("glFog GL_FOG_COLOR"); } -void state_fogdensity(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +void state_fogdensity(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { union { DWORD d; @@ -1239,10 +1175,10 @@ void state_fogdensity(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wi checkGLcall("glFogf(GL_FOG_DENSITY, (float) Value)"); } -static void state_colormat(DWORD state_id, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_colormat(DWORD state_id, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { const struct wined3d_state *state = &stateblock->state; - IWineD3DDeviceImpl *device = stateblock->device; + struct wined3d_device *device = stateblock->device; GLenum Parm = 0; /* Depends on the decoded vertex declaration to read the existence of diffuse data. @@ -1363,7 +1299,7 @@ static void state_colormat(DWORD state_id, IWineD3DStateBlockImpl *stateblock, s context->tracking_parm = Parm; } -static void state_linepattern(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_linepattern(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { union { DWORD d; @@ -1384,37 +1320,7 @@ static void state_linepattern(DWORD state, IWineD3DStateBlockImpl *stateblock, s } } -static void state_zbias(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) -{ - union { - DWORD d; - float f; - } tmpvalue; - - if (stateblock->state.render_states[WINED3DRS_ZBIAS]) - { - tmpvalue.d = stateblock->state.render_states[WINED3DRS_ZBIAS]; - TRACE("ZBias value %f\n", tmpvalue.f); - glPolygonOffset(0, -tmpvalue.f); - checkGLcall("glPolygonOffset(0, -Value)"); - glEnable(GL_POLYGON_OFFSET_FILL); - checkGLcall("glEnable(GL_POLYGON_OFFSET_FILL);"); - glEnable(GL_POLYGON_OFFSET_LINE); - checkGLcall("glEnable(GL_POLYGON_OFFSET_LINE);"); - glEnable(GL_POLYGON_OFFSET_POINT); - checkGLcall("glEnable(GL_POLYGON_OFFSET_POINT);"); - } else { - glDisable(GL_POLYGON_OFFSET_FILL); - checkGLcall("glDisable(GL_POLYGON_OFFSET_FILL);"); - glDisable(GL_POLYGON_OFFSET_LINE); - checkGLcall("glDisable(GL_POLYGON_OFFSET_LINE);"); - glDisable(GL_POLYGON_OFFSET_POINT); - checkGLcall("glDisable(GL_POLYGON_OFFSET_POINT);"); - } -} - - -static void state_normalize(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_normalize(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { if(isStateDirty(context, STATE_VDECL)) { return; @@ -1434,7 +1340,7 @@ static void state_normalize(DWORD state, IWineD3DStateBlockImpl *stateblock, str } } -static void state_psizemin_w(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_psizemin_w(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { union { DWORD d; @@ -1454,7 +1360,7 @@ static void state_psizemin_w(DWORD state, IWineD3DStateBlockImpl *stateblock, st } -static void state_psizemin_ext(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_psizemin_ext(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { const struct wined3d_gl_info *gl_info = context->gl_info; union @@ -1477,7 +1383,7 @@ static void state_psizemin_ext(DWORD state, IWineD3DStateBlockImpl *stateblock, checkGLcall("glPointParameterfEXT(...)"); } -static void state_psizemin_arb(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_psizemin_arb(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { const struct wined3d_gl_info *gl_info = context->gl_info; union @@ -1500,7 +1406,7 @@ static void state_psizemin_arb(DWORD state, IWineD3DStateBlockImpl *stateblock, checkGLcall("glPointParameterfARB(...)"); } -static void state_pscale(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_pscale(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { const struct wined3d_gl_info *gl_info = context->gl_info; /* TODO: Group this with the viewport */ @@ -1579,12 +1485,12 @@ static void state_pscale(DWORD state, IWineD3DStateBlockImpl *stateblock, struct checkGLcall("glPointSize(...);"); } -static void state_debug_monitor(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_debug_monitor(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { WARN("token: %#x\n", stateblock->state.render_states[WINED3DRS_DEBUGMONITORTOKEN]); } -static void state_colorwrite(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_colorwrite(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { DWORD mask0 = stateblock->state.render_states[WINED3DRS_COLORWRITEENABLE]; DWORD mask1 = stateblock->state.render_states[WINED3DRS_COLORWRITEENABLE1]; @@ -1620,27 +1526,27 @@ static void set_color_mask(const struct wined3d_gl_info *gl_info, UINT index, DW mask & WINED3DCOLORWRITEENABLE_ALPHA ? GL_TRUE : GL_FALSE)); } -static void state_colorwrite0(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_colorwrite0(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { set_color_mask(context->gl_info, 0, stateblock->state.render_states[WINED3DRS_COLORWRITEENABLE]); } -static void state_colorwrite1(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_colorwrite1(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { set_color_mask(context->gl_info, 1, stateblock->state.render_states[WINED3DRS_COLORWRITEENABLE1]); } -static void state_colorwrite2(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_colorwrite2(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { set_color_mask(context->gl_info, 2, stateblock->state.render_states[WINED3DRS_COLORWRITEENABLE2]); } -static void state_colorwrite3(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_colorwrite3(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { set_color_mask(context->gl_info, 3, stateblock->state.render_states[WINED3DRS_COLORWRITEENABLE3]); } -static void state_localviewer(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_localviewer(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { if (stateblock->state.render_states[WINED3DRS_LOCALVIEWER]) { @@ -1652,7 +1558,7 @@ static void state_localviewer(DWORD state, IWineD3DStateBlockImpl *stateblock, s } } -static void state_lastpixel(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_lastpixel(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { if (stateblock->state.render_states[WINED3DRS_LASTPIXEL]) { @@ -1668,7 +1574,7 @@ static void state_lastpixel(DWORD state, IWineD3DStateBlockImpl *stateblock, str } } -static void state_pointsprite_w(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_pointsprite_w(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { static BOOL warned; @@ -1681,7 +1587,7 @@ static void state_pointsprite_w(DWORD state, IWineD3DStateBlockImpl *stateblock, } } -static void state_pointsprite(DWORD state_id, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_pointsprite(DWORD state_id, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { const struct wined3d_gl_info *gl_info = context->gl_info; const struct wined3d_state *state = &stateblock->state; @@ -1707,7 +1613,7 @@ static void state_pointsprite(DWORD state_id, IWineD3DStateBlockImpl *stateblock } } -static void state_wrap(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_wrap(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { /** http://www.cosc.brocku.ca/Offerings/3P98/course/lectures/texture/ @@ -1738,13 +1644,13 @@ static void state_wrap(DWORD state, IWineD3DStateBlockImpl *stateblock, struct w } } -static void state_msaa_w(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_msaa_w(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { if (stateblock->state.render_states[WINED3DRS_MULTISAMPLEANTIALIAS]) WARN("Multisample antialiasing not supported by gl\n"); } -static void state_msaa(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_msaa(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { if (stateblock->state.render_states[WINED3DRS_MULTISAMPLEANTIALIAS]) { @@ -1756,7 +1662,7 @@ static void state_msaa(DWORD state, IWineD3DStateBlockImpl *stateblock, struct w } } -static void state_scissor(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_scissor(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { if (stateblock->state.render_states[WINED3DRS_SCISSORTESTENABLE]) { @@ -1774,14 +1680,17 @@ static void state_scissor(DWORD state, IWineD3DStateBlockImpl *stateblock, struc * convert from D3D to GL we need to divide the D3D depth bias by that value. * There's no practical way to retrieve that value from a given GL * implementation, but the D3D application has essentially the same problem, - * which makes a guess of 1e-6f seem reasonable here. Note that - * SLOPESCALEDEPTHBIAS is a scaling factor for the depth slope, and doesn't - * need to be scaled. */ -static void state_depthbias(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) + * which makes a guess of the depth buffer format's highest possible value a + * reasonable guess. Note that SLOPESCALEDEPTHBIAS is a scaling factor for the + * depth slope, and doesn't need to be scaled. */ +static void state_depthbias(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { if (stateblock->state.render_states[WINED3DRS_SLOPESCALEDEPTHBIAS] || stateblock->state.render_states[WINED3DRS_DEPTHBIAS]) { + struct wined3d_surface *depth = stateblock->device->fb.depth_stencil; + float scale; + union { DWORD d; @@ -1794,7 +1703,21 @@ static void state_depthbias(DWORD state, IWineD3DStateBlockImpl *stateblock, str glEnable(GL_POLYGON_OFFSET_FILL); checkGLcall("glEnable(GL_POLYGON_OFFSET_FILL)"); - glPolygonOffset(scale_bias.f, const_bias.f * 1e6f); + if (depth) + { + const struct wined3d_format *fmt = depth->resource.format; + scale = powf(2, fmt->depth_size) - 1; + TRACE("Depth format %s, using depthbias scale of %f\n", + debug_d3dformat(fmt->id), scale); + } + else + { + /* The context manager will reapply this state on a depth stencil change */ + TRACE("No depth stencil, using depthbias scale of 0.0\n"); + scale = 0; + } + + glPolygonOffset(scale_bias.f, const_bias.f * scale); checkGLcall("glPolygonOffset(...)"); } else { glDisable(GL_POLYGON_OFFSET_FILL); @@ -1802,13 +1725,13 @@ static void state_depthbias(DWORD state, IWineD3DStateBlockImpl *stateblock, str } } -static void state_zvisible(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_zvisible(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { if (stateblock->state.render_states[WINED3DRS_ZVISIBLE]) FIXME("WINED3DRS_ZVISIBLE not implemented.\n"); } -static void state_perspective(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_perspective(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { if (stateblock->state.render_states[WINED3DRS_TEXTUREPERSPECTIVE]) { @@ -1820,33 +1743,33 @@ static void state_perspective(DWORD state, IWineD3DStateBlockImpl *stateblock, s } } -static void state_stippledalpha(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_stippledalpha(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { if (stateblock->state.render_states[WINED3DRS_STIPPLEDALPHA]) FIXME(" Stippled Alpha not supported yet.\n"); } -static void state_antialias(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_antialias(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { if (stateblock->state.render_states[WINED3DRS_ANTIALIAS]) FIXME("Antialias not supported yet.\n"); } -static void state_multisampmask(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_multisampmask(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { if (stateblock->state.render_states[WINED3DRS_MULTISAMPLEMASK] != 0xffffffff) FIXME("WINED3DRS_MULTISAMPLEMASK %#x not yet implemented.\n", stateblock->state.render_states[WINED3DRS_MULTISAMPLEMASK]); } -static void state_patchedgestyle(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_patchedgestyle(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { if (stateblock->state.render_states[WINED3DRS_PATCHEDGESTYLE] != WINED3DPATCHEDGE_DISCRETE) FIXME("WINED3DRS_PATCHEDGESTYLE %#x not yet implemented.\n", stateblock->state.render_states[WINED3DRS_PATCHEDGESTYLE]); } -static void state_patchsegments(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_patchsegments(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { union { DWORD d; @@ -1866,28 +1789,28 @@ static void state_patchsegments(DWORD state, IWineD3DStateBlockImpl *stateblock, } } -static void state_positiondegree(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_positiondegree(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { if (stateblock->state.render_states[WINED3DRS_POSITIONDEGREE] != WINED3DDEGREE_CUBIC) FIXME("WINED3DRS_POSITIONDEGREE %#x not yet implemented.\n", stateblock->state.render_states[WINED3DRS_POSITIONDEGREE]); } -static void state_normaldegree(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_normaldegree(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { if (stateblock->state.render_states[WINED3DRS_NORMALDEGREE] != WINED3DDEGREE_LINEAR) FIXME("WINED3DRS_NORMALDEGREE %#x not yet implemented.\n", stateblock->state.render_states[WINED3DRS_NORMALDEGREE]); } -static void state_tessellation(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_tessellation(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { if (stateblock->state.render_states[WINED3DRS_ENABLEADAPTIVETESSELLATION]) FIXME("WINED3DRS_ENABLEADAPTIVETESSELLATION %#x not yet implemented.\n", stateblock->state.render_states[WINED3DRS_ENABLEADAPTIVETESSELLATION]); } -static void state_nvdb(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_nvdb(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { union { DWORD d; @@ -1923,91 +1846,91 @@ static void state_nvdb(DWORD state, IWineD3DStateBlockImpl *stateblock, struct w state_tessellation(state, stateblock, context); } -static void state_wrapu(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_wrapu(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { if (stateblock->state.render_states[WINED3DRS_WRAPU]) FIXME("Render state WINED3DRS_WRAPU not implemented yet.\n"); } -static void state_wrapv(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_wrapv(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { if (stateblock->state.render_states[WINED3DRS_WRAPV]) FIXME("Render state WINED3DRS_WRAPV not implemented yet.\n"); } -static void state_monoenable(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_monoenable(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { if (stateblock->state.render_states[WINED3DRS_MONOENABLE]) FIXME("Render state WINED3DRS_MONOENABLE not implemented yet.\n"); } -static void state_rop2(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_rop2(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { if (stateblock->state.render_states[WINED3DRS_ROP2]) FIXME("Render state WINED3DRS_ROP2 not implemented yet.\n"); } -static void state_planemask(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_planemask(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { if (stateblock->state.render_states[WINED3DRS_PLANEMASK]) FIXME("Render state WINED3DRS_PLANEMASK not implemented yet.\n"); } -static void state_subpixel(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_subpixel(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { if (stateblock->state.render_states[WINED3DRS_SUBPIXEL]) FIXME("Render state WINED3DRS_SUBPIXEL not implemented yet.\n"); } -static void state_subpixelx(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_subpixelx(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { if (stateblock->state.render_states[WINED3DRS_SUBPIXELX]) FIXME("Render state WINED3DRS_SUBPIXELX not implemented yet.\n"); } -static void state_stippleenable(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_stippleenable(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { if (stateblock->state.render_states[WINED3DRS_STIPPLEENABLE]) FIXME("Render state WINED3DRS_STIPPLEENABLE not implemented yet.\n"); } -static void state_mipmaplodbias(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_mipmaplodbias(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { if (stateblock->state.render_states[WINED3DRS_MIPMAPLODBIAS]) FIXME("Render state WINED3DRS_MIPMAPLODBIAS not implemented yet.\n"); } -static void state_anisotropy(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_anisotropy(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { if (stateblock->state.render_states[WINED3DRS_ANISOTROPY]) FIXME("Render state WINED3DRS_ANISOTROPY not implemented yet.\n"); } -static void state_flushbatch(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_flushbatch(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { if (stateblock->state.render_states[WINED3DRS_FLUSHBATCH]) FIXME("Render state WINED3DRS_FLUSHBATCH not implemented yet.\n"); } -static void state_translucentsi(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_translucentsi(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { if (stateblock->state.render_states[WINED3DRS_TRANSLUCENTSORTINDEPENDENT]) FIXME("Render state WINED3DRS_TRANSLUCENTSORTINDEPENDENT not implemented yet.\n"); } -static void state_extents(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_extents(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { if (stateblock->state.render_states[WINED3DRS_EXTENTS]) FIXME("Render state WINED3DRS_EXTENTS not implemented yet.\n"); } -static void state_ckeyblend(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_ckeyblend(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { if (stateblock->state.render_states[WINED3DRS_COLORKEYBLENDENABLE]) FIXME("Render state WINED3DRS_COLORKEYBLENDENABLE not implemented yet.\n"); } -static void state_swvp(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_swvp(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { if (stateblock->state.render_states[WINED3DRS_SOFTWAREVERTEXPROCESSING]) FIXME("Software vertex processing not implemented.\n"); @@ -3100,7 +3023,7 @@ static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined } -static void tex_colorop(DWORD state_id, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void tex_colorop(DWORD state_id, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { DWORD stage = (state_id - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1); BOOL tex_used = stateblock->device->fixed_function_usage_map & (1 << stage); @@ -3163,7 +3086,7 @@ static void tex_colorop(DWORD state_id, IWineD3DStateBlockImpl *stateblock, stru state->texture_states[stage][WINED3DTSS_COLORARG0]); } -void tex_alphaop(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +void tex_alphaop(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1); BOOL tex_used = stateblock->device->fixed_function_usage_map & (1 << stage); @@ -3191,12 +3114,12 @@ void tex_alphaop(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d if (stateblock->state.render_states[WINED3DRS_COLORKEYENABLE] && !stage && stateblock->state.textures[0]) { - IWineD3DBaseTextureImpl *texture = stateblock->state.textures[0]; - GLenum texture_dimensions = texture->baseTexture.target; + struct wined3d_texture *texture = stateblock->state.textures[0]; + GLenum texture_dimensions = texture->target; if (texture_dimensions == GL_TEXTURE_2D || texture_dimensions == GL_TEXTURE_RECTANGLE_ARB) { - IWineD3DSurfaceImpl *surf = (IWineD3DSurfaceImpl *)texture->baseTexture.sub_resources[0]; + struct wined3d_surface *surf = surface_from_resource(texture->sub_resources[0]); if (surf->CKeyFlags & WINEDDSD_CKSRCBLT && !surf->resource.format->alpha_mask) { @@ -3264,7 +3187,7 @@ void tex_alphaop(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d } } -static void transform_texture(DWORD state_id, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void transform_texture(DWORD state_id, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { DWORD texUnit = (state_id - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1); DWORD mapped_stage = stateblock->device->texUnitMap[texUnit]; @@ -3307,7 +3230,7 @@ static void transform_texture(DWORD state_id, IWineD3DStateBlockImpl *stateblock if (!use_ps(state)) { TRACE("Non power two matrix multiply fixup\n"); - glMultMatrixf(state->textures[texUnit]->baseTexture.pow2Matrix); + glMultMatrixf(state->textures[texUnit]->pow2_matrix); } } } @@ -3323,7 +3246,7 @@ static void unloadTexCoords(const struct wined3d_gl_info *gl_info) } } -static void loadTexCoords(const struct wined3d_gl_info *gl_info, IWineD3DStateBlockImpl *stateblock, +static void loadTexCoords(const struct wined3d_gl_info *gl_info, struct wined3d_stateblock *stateblock, const struct wined3d_stream_info *si, GLuint *curVBO) { unsigned int mapped_stage = 0; @@ -3374,7 +3297,7 @@ static void loadTexCoords(const struct wined3d_gl_info *gl_info, IWineD3DStateBl checkGLcall("loadTexCoords"); } -static void tex_coordindex(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void tex_coordindex(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1); DWORD mapped_stage = stateblock->device->texUnitMap[stage]; @@ -3550,10 +3473,10 @@ static void tex_coordindex(DWORD state, IWineD3DStateBlockImpl *stateblock, stru } } -static void shaderconstant(DWORD state_id, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void shaderconstant(DWORD state_id, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { const struct wined3d_state *state = &stateblock->state; - IWineD3DDeviceImpl *device = stateblock->device; + struct wined3d_device *device = stateblock->device; /* Vertex and pixel shader states will call a shader upload, don't do anything as long one of them * has an update pending @@ -3566,12 +3489,12 @@ static void shaderconstant(DWORD state_id, IWineD3DStateBlockImpl *stateblock, s device->shader_backend->shader_load_constants(context, use_ps(state), use_vs(state)); } -static void tex_bumpenvlscale(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void tex_bumpenvlscale(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1); - IWineD3DPixelShaderImpl *ps = stateblock->state.pixel_shader; + const struct wined3d_shader *ps = stateblock->state.pixel_shader; - if (ps && stage && (ps->baseShader.reg_maps.luminanceparams & (1 << stage))) + if (ps && stage && (ps->reg_maps.luminanceparams & (1 << stage))) { /* The pixel shader has to know the luminance scale. Do a constants update if it * isn't scheduled anyway @@ -3583,23 +3506,24 @@ static void tex_bumpenvlscale(DWORD state, IWineD3DStateBlockImpl *stateblock, s } } -static void sampler_texmatrix(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void sampler_texmatrix(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { const DWORD sampler = state - STATE_SAMPLER(0); - IWineD3DBaseTextureImpl *texture = stateblock->state.textures[sampler]; + struct wined3d_texture *texture = stateblock->state.textures[sampler]; TRACE("state %#x, stateblock %p, context %p\n", state, stateblock, context); if(!texture) return; /* The fixed function np2 texture emulation uses the texture matrix to fix up the coordinates - * basetexture_apply_state_changes() multiplies the set matrix with a fixup matrix. Before the + * wined3d_texture_apply_state_changes() multiplies the set matrix with a fixup matrix. Before the * scaling is reapplied or removed, the texture matrix has to be reapplied * * The mapped stage is already active because the sampler() function below, which is part of the * misc pipeline */ - if(sampler < MAX_TEXTURES) { - const BOOL texIsPow2 = !texture->baseTexture.pow2Matrix_identity; + if (sampler < MAX_TEXTURES) + { + const BOOL texIsPow2 = !(texture->flags & WINED3D_TEXTURE_POW2_MAT_IDENT); if (texIsPow2 || (context->lastWasPow2Texture & (1 << sampler))) { @@ -3611,10 +3535,11 @@ static void sampler_texmatrix(DWORD state, IWineD3DStateBlockImpl *stateblock, s } } -static void sampler(DWORD state_id, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void sampler(DWORD state_id, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { DWORD sampler = state_id - STATE_SAMPLER(0); - DWORD mapped_stage = stateblock->device->texUnitMap[sampler]; + struct wined3d_device *device = stateblock->device; + DWORD mapped_stage = device->texUnitMap[sampler]; const struct wined3d_gl_info *gl_info = context->gl_info; const struct wined3d_state *state = &stateblock->state; union { @@ -3642,13 +3567,11 @@ static void sampler(DWORD state_id, IWineD3DStateBlockImpl *stateblock, struct w if (state->textures[sampler]) { - IWineD3DBaseTexture *texture = (IWineD3DBaseTexture *)state->textures[sampler]; + struct wined3d_texture *texture = state->textures[sampler]; BOOL srgb = state->sampler_states[sampler][WINED3DSAMP_SRGBTEXTURE]; - IWineD3DBaseTexture_BindTexture(texture, srgb); - basetexture_apply_state_changes(texture, - state->texture_states[sampler], - state->sampler_states[sampler], gl_info); + texture->texture_ops->texture_bind(texture, gl_info, srgb); + wined3d_texture_apply_state_changes(texture, state->sampler_states[sampler], gl_info); if (gl_info->supported[EXT_TEXTURE_LOD_BIAS]) { @@ -3656,7 +3579,7 @@ static void sampler(DWORD state_id, IWineD3DStateBlockImpl *stateblock, struct w glTexEnvf(GL_TEXTURE_FILTER_CONTROL_EXT, GL_TEXTURE_LOD_BIAS_EXT, tmpvalue.f); - checkGLcall("glTexEnvi(GL_TEXTURE_LOD_BIAS_EXT, ...)"); + checkGLcall("glTexEnvf(GL_TEXTURE_LOD_BIAS_EXT, ...)"); } if (!use_ps(state) && sampler < state->lowest_disabled_stage) @@ -3671,12 +3594,8 @@ static void sampler(DWORD state_id, IWineD3DStateBlockImpl *stateblock, struct w } /* Trigger shader constant reloading (for NP2 texcoord fixup) */ - if (!state->textures[sampler]->baseTexture.pow2Matrix_identity) - { - IWineD3DDeviceImpl *d3ddevice = stateblock->device; - d3ddevice->shader_backend->shader_load_np2fixup_constants( - (IWineD3DDevice*)d3ddevice, use_ps(state), use_vs(state)); - } + if (!(texture->flags & WINED3D_TEXTURE_POW2_MAT_IDENT)) + device->shader_backend->shader_load_np2fixup_constants(device->shader_priv, gl_info, state); } else if (mapped_stage < gl_info->limits.textures) { @@ -3691,15 +3610,15 @@ static void sampler(DWORD state_id, IWineD3DStateBlockImpl *stateblock, struct w state_alpha(WINED3DRS_COLORKEYENABLE, stateblock, context); } } /* Otherwise tex_colorop disables the stage */ - glBindTexture(GL_TEXTURE_2D, stateblock->device->dummyTextureName[sampler]); - checkGLcall("glBindTexture(GL_TEXTURE_2D, stateblock->device->dummyTextureName[sampler])"); + glBindTexture(GL_TEXTURE_2D, device->dummyTextureName[sampler]); + checkGLcall("glBindTexture(GL_TEXTURE_2D, device->dummyTextureName[sampler])"); } } -void apply_pixelshader(DWORD state_id, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +void apply_pixelshader(DWORD state_id, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { const struct wined3d_state *state = &stateblock->state; - IWineD3DDeviceImpl *device = stateblock->device; + struct wined3d_device *device = stateblock->device; BOOL use_vshader = use_vs(state); BOOL use_pshader = use_ps(state); unsigned int i; @@ -3741,12 +3660,12 @@ void apply_pixelshader(DWORD state_id, IWineD3DStateBlockImpl *stateblock, struc } } -static void shader_bumpenvmat(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void shader_bumpenvmat(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / (WINED3D_HIGHEST_TEXTURE_STATE + 1); - IWineD3DPixelShaderImpl *ps = stateblock->state.pixel_shader; + const struct wined3d_shader *ps = stateblock->state.pixel_shader; - if (ps && stage && (ps->baseShader.reg_maps.bumpmat & (1 << stage))) + if (ps && stage && (ps->reg_maps.bumpmat & (1 << stage))) { /* The pixel shader has to know the bump env matrix. Do a constants update if it isn't scheduled * anyway @@ -3758,7 +3677,7 @@ static void shader_bumpenvmat(DWORD state, IWineD3DStateBlockImpl *stateblock, s } } -static void transform_world(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void transform_world(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { /* This function is called by transform_view below if the view matrix was changed too * @@ -3790,7 +3709,7 @@ static void transform_world(DWORD state, IWineD3DStateBlockImpl *stateblock, str } } -static void clipplane(DWORD state_id, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void clipplane(DWORD state_id, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { const struct wined3d_state *state = &stateblock->state; UINT index = state_id - STATE_CLIPPLANE(0); @@ -3800,24 +3719,17 @@ static void clipplane(DWORD state_id, IWineD3DStateBlockImpl *stateblock, struct return; } + glMatrixMode(GL_MODELVIEW); + glPushMatrix(); + /* Clip Plane settings are affected by the model view in OpenGL, the View transform in direct3d */ if (!use_vs(state)) - { - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); glLoadMatrixf(&state->transforms[WINED3DTS_VIEW].u.m[0][0]); - } else - { /* with vertex shaders, clip planes are not transformed in direct3d, * in OpenGL they are still transformed by the model view. - * Use this to swap the y coordinate if necessary */ - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); glLoadIdentity(); - if (context->render_offscreen) glScalef(1.0f, -1.0f, 1.0f); - } TRACE("Clipplane [%.8e, %.8e, %.8e, %.8e]\n", state->clip_planes[index][0], @@ -3830,7 +3742,7 @@ static void clipplane(DWORD state_id, IWineD3DStateBlockImpl *stateblock, struct glPopMatrix(); } -static void transform_worldex(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void transform_worldex(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { UINT matrix = state - STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(0)); GLenum glMat; @@ -3874,7 +3786,7 @@ static void transform_worldex(DWORD state, IWineD3DStateBlockImpl *stateblock, s } } -static void state_vertexblend_w(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_vertexblend_w(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { WINED3DVERTEXBLENDFLAGS f = stateblock->state.render_states[WINED3DRS_VERTEXBLEND]; static unsigned int once; @@ -3885,7 +3797,7 @@ static void state_vertexblend_w(DWORD state, IWineD3DStateBlockImpl *stateblock, else WARN("Vertex blend flags %#x not supported.\n", f); } -static void state_vertexblend(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void state_vertexblend(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { WINED3DVERTEXBLENDFLAGS val = stateblock->state.render_states[WINED3DRS_VERTEXBLEND]; const struct wined3d_gl_info *gl_info = context->gl_info; @@ -3929,7 +3841,7 @@ static void state_vertexblend(DWORD state, IWineD3DStateBlockImpl *stateblock, s } } -static void transform_view(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void transform_view(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { const struct wined3d_gl_info *gl_info = context->gl_info; const struct wined3d_light_info *light = NULL; @@ -3947,7 +3859,7 @@ static void transform_view(DWORD state, IWineD3DStateBlockImpl *stateblock, stru checkGLcall("glLoadMatrixf(...)"); /* Reset lights. TODO: Call light apply func */ - for (k = 0; k < stateblock->device->maxConcurrentLights; ++k) + for (k = 0; k < gl_info->limits.lights; ++k) { light = stateblock->state.lights[k]; if(!light) continue; @@ -3991,7 +3903,7 @@ static void transform_view(DWORD state, IWineD3DStateBlockImpl *stateblock, stru } } -static void transform_projection(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void transform_projection(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { glMatrixMode(GL_PROJECTION); checkGLcall("glMatrixMode(GL_PROJECTION)"); @@ -4137,14 +4049,13 @@ static inline void unloadNumberedArrays(struct wined3d_context *context) } } -static inline void loadNumberedArrays(IWineD3DStateBlockImpl *stateblock, +static void loadNumberedArrays(struct wined3d_stateblock *stateblock, const struct wined3d_stream_info *stream_info, struct wined3d_context *context) { const struct wined3d_gl_info *gl_info = context->gl_info; GLuint curVBO = gl_info->supported[ARB_VERTEX_BUFFER_OBJECT] ? ~0U : 0; int i; struct wined3d_buffer *vb; - DWORD_PTR shift_index; /* Default to no instancing */ stateblock->device->instancedDraw = FALSE; @@ -4184,31 +4095,12 @@ static inline void loadNumberedArrays(IWineD3DStateBlockImpl *stateblock, * curVBO will be 0. If there is a vertex buffer but no vbo we * won't be load converted attributes anyway. */ vb = stream->buffer; - if (curVBO && vb->conversion_shift) - { - TRACE("Loading attribute from shifted buffer\n"); - TRACE("Attrib %d has original stride %d, new stride %d\n", - i, stream_info->elements[i].stride, vb->conversion_stride); - TRACE("Original offset %p, additional offset 0x%08x\n", - stream_info->elements[i].data, vb->conversion_shift[(DWORD_PTR)stream_info->elements[i].data]); - TRACE("Opengl type %#x\n", stream_info->elements[i].format->gl_vtx_type); - shift_index = ((DWORD_PTR)stream_info->elements[i].data + stream->offset); - shift_index = shift_index % stream_info->elements[i].stride; - GL_EXTCALL(glVertexAttribPointerARB(i, stream_info->elements[i].format->gl_vtx_format, - stream_info->elements[i].format->gl_vtx_type, - stream_info->elements[i].format->gl_normalized, - vb->conversion_stride, stream_info->elements[i].data + vb->conversion_shift[shift_index] - + stateblock->state.load_base_vertex_index * stream_info->elements[i].stride - + stream->offset)); - - } else { - GL_EXTCALL(glVertexAttribPointerARB(i, stream_info->elements[i].format->gl_vtx_format, - stream_info->elements[i].format->gl_vtx_type, - stream_info->elements[i].format->gl_normalized, - stream_info->elements[i].stride, stream_info->elements[i].data - + stateblock->state.load_base_vertex_index * stream_info->elements[i].stride - + stream->offset)); - } + GL_EXTCALL(glVertexAttribPointerARB(i, stream_info->elements[i].format->gl_vtx_format, + stream_info->elements[i].format->gl_vtx_type, + stream_info->elements[i].format->gl_normalized, + stream_info->elements[i].stride, stream_info->elements[i].data + + stateblock->state.load_base_vertex_index * stream_info->elements[i].stride + + stream->offset)); if (!(context->numbered_array_mask & (1 << i))) { @@ -4320,7 +4212,7 @@ static inline void loadNumberedArrays(IWineD3DStateBlockImpl *stateblock, } /* Used from 2 different functions, and too big to justify making it inlined */ -static void loadVertexData(const struct wined3d_context *context, IWineD3DStateBlockImpl *stateblock, +static void loadVertexData(const struct wined3d_context *context, struct wined3d_stateblock *stateblock, const struct wined3d_stream_info *si) { const struct wined3d_gl_info *gl_info = context->gl_info; @@ -4389,7 +4281,7 @@ static void loadVertexData(const struct wined3d_context *context, IWineD3DStateB { static const GLbyte one = 1; GL_EXTCALL(glWeightbvARB(1, &one)); - checkGLcall("glWeightivARB(gl_info->max_blends, weights)"); + checkGLcall("glWeightbvARB(gl_info->max_blends, weights)"); } } @@ -4583,9 +4475,9 @@ static void loadVertexData(const struct wined3d_context *context, IWineD3DStateB loadTexCoords(gl_info, stateblock, si, &curVBO); } -static void streamsrc(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void streamsrc(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { - IWineD3DDeviceImpl *device = stateblock->device; + struct wined3d_device *device = stateblock->device; BOOL load_numbered = use_vs(&stateblock->state) && !device->useDrawStridedSlow; BOOL load_named = !use_vs(&stateblock->state) && !device->useDrawStridedSlow; @@ -4615,27 +4507,21 @@ static void streamsrc(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wi } } -static void vertexdeclaration(DWORD state_id, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void vertexdeclaration(DWORD state_id, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { const struct wined3d_gl_info *gl_info = context->gl_info; const struct wined3d_state *state = &stateblock->state; + struct wined3d_device *device = stateblock->device; BOOL useVertexShaderFunction = use_vs(state); BOOL usePixelShaderFunction = use_ps(state); BOOL updateFog = FALSE; - IWineD3DDeviceImpl *device = stateblock->device; BOOL transformed; BOOL wasrhw = context->last_was_rhw; unsigned int i; transformed = device->strided_streams.position_transformed; - if(transformed != context->last_was_rhw && !useVertexShaderFunction) { + if (transformed != context->last_was_rhw && !useVertexShaderFunction) updateFog = TRUE; - } - - /* Reapply lighting if it is not scheduled for reapplication already */ - if(!isStateDirty(context, STATE_RENDER(WINED3DRS_LIGHTING))) { - state_lighting(STATE_RENDER(WINED3DRS_LIGHTING), stateblock, context); - } if (transformed) { context->last_was_rhw = TRUE; @@ -4645,20 +4531,6 @@ static void vertexdeclaration(DWORD state_id, IWineD3DStateBlockImpl *stateblock context->last_was_rhw = FALSE; /* This turns off the Z scale trick to 'disable' viewport frustum clipping in rhw mode*/ device->untransformed = TRUE; - - /* Todo for sw shaders: Vertex Shader output is already transformed, so set up identity matrices - * Not needed as long as only hw shaders are supported - */ - - /* This sets the shader output position correction constants. - * TODO: Move to the viewport state - */ - if (useVertexShaderFunction) - { - GLfloat yoffset = -(63.0f / 64.0f) / stateblock->state.viewport.Height; - device->posFixup[1] = context->render_offscreen ? -1.0f : 1.0f; - device->posFixup[3] = device->posFixup[1] * yoffset; - } } /* Don't have to apply the matrices when vertex shaders are used. When vshaders are turned @@ -4693,6 +4565,9 @@ static void vertexdeclaration(DWORD state_id, IWineD3DStateBlockImpl *stateblock if(!isStateDirty(context, STATE_RENDER(WINED3DRS_COLORVERTEX))) { state_colormat(STATE_RENDER(WINED3DRS_COLORVERTEX), stateblock, context); } + if(!isStateDirty(context, STATE_RENDER(WINED3DRS_LIGHTING))) { + state_lighting(STATE_RENDER(WINED3DRS_LIGHTING), stateblock, context); + } if(context->last_was_vshader) { updateFog = TRUE; @@ -4777,14 +4652,16 @@ static void vertexdeclaration(DWORD state_id, IWineD3DStateBlockImpl *stateblock } } -static void viewport_miscpart(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void viewport_miscpart(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { - IWineD3DSurfaceImpl *target = stateblock->device->render_targets[0]; + struct wined3d_surface *target = stateblock->device->fb.render_targets[0]; UINT width, height; WINED3DVIEWPORT vp = stateblock->state.viewport; - if(vp.Width > target->currentDesc.Width) vp.Width = target->currentDesc.Width; - if(vp.Height > target->currentDesc.Height) vp.Height = target->currentDesc.Height; + if (vp.Width > target->resource.width) + vp.Width = target->resource.width; + if (vp.Height > target->resource.height) + vp.Height = target->resource.height; glDepthRange(vp.MinZ, vp.MaxZ); checkGLcall("glDepthRange"); @@ -4804,24 +4681,20 @@ static void viewport_miscpart(DWORD state, IWineD3DStateBlockImpl *stateblock, s checkGLcall("glViewport"); } -static void viewport_vertexpart(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void viewport_vertexpart(DWORD state_id, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { - GLfloat yoffset = -(63.0f / 64.0f) / stateblock->state.viewport.Height; - - stateblock->device->posFixup[2] = (63.0f / 64.0f) / stateblock->state.viewport.Width; - stateblock->device->posFixup[3] = stateblock->device->posFixup[1] * yoffset; - if(!isStateDirty(context, STATE_TRANSFORM(WINED3DTS_PROJECTION))) { transform_projection(STATE_TRANSFORM(WINED3DTS_PROJECTION), stateblock, context); } if(!isStateDirty(context, STATE_RENDER(WINED3DRS_POINTSCALEENABLE))) { state_pscale(STATE_RENDER(WINED3DRS_POINTSCALEENABLE), stateblock, context); } + /* Update the position fixup. */ if (!isStateDirty(context, STATE_VERTEXSHADERCONSTANT)) shaderconstant(STATE_VERTEXSHADERCONSTANT, stateblock, context); } -static void light(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void light(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { UINT Index = state - STATE_ACTIVELIGHT(0); const struct wined3d_light_info *lightInfo = stateblock->state.lights[Index]; @@ -4935,9 +4808,9 @@ static void light(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3 } } -static void scissorrect(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void scissorrect(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { - IWineD3DSurfaceImpl *target = stateblock->device->render_targets[0]; + struct wined3d_surface *target = stateblock->device->fb.render_targets[0]; RECT *pRect = &stateblock->state.scissor_rect; UINT height; UINT width; @@ -4958,7 +4831,7 @@ static void scissorrect(DWORD state, IWineD3DStateBlockImpl *stateblock, struct checkGLcall("glScissor"); } -static void indexbuffer(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void indexbuffer(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { const struct wined3d_gl_info *gl_info = context->gl_info; @@ -4973,7 +4846,7 @@ static void indexbuffer(DWORD state, IWineD3DStateBlockImpl *stateblock, struct } } -static void frontface(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void frontface(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { if (context->render_offscreen) { @@ -4985,6 +4858,34 @@ static void frontface(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wi } } +static void psorigin_w(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) +{ + static BOOL warned; + + if (!warned) + { + WARN("Point sprite coordinate origin switching not supported.\n"); + warned = TRUE; + } +} + +static void psorigin(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) +{ + const struct wined3d_gl_info *gl_info = context->gl_info; + GLint origin = context->render_offscreen ? GL_LOWER_LEFT : GL_UPPER_LEFT; + + if (glPointParameteri) + { + glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, origin); + checkGLcall("glPointParameteri(GL_POINT_SPRITE_COORD_ORIGIN, ...)"); + } + else if (gl_info->supported[NV_POINT_SPRITE]) + { + GL_EXTCALL(glPointParameteriNV(GL_POINT_SPRITE_COORD_ORIGIN, origin)); + checkGLcall("glPointParameteriNV(GL_POINT_SPRITE_COORD_ORIGIN, ...)"); + } +} + const struct StateEntryTemplate misc_state_template[] = { { STATE_RENDER(WINED3DRS_SRCBLEND), { STATE_RENDER(WINED3DRS_ALPHABLENDENABLE), NULL }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3DRS_DESTBLEND), { STATE_RENDER(WINED3DRS_ALPHABLENDENABLE), NULL }, WINED3D_GL_EXT_NONE }, @@ -5000,6 +4901,9 @@ const struct StateEntryTemplate misc_state_template[] = { { STATE_VDECL, { STATE_VDECL, streamsrc }, WINED3D_GL_EXT_NONE }, { STATE_FRONTFACE, { STATE_FRONTFACE, frontface }, WINED3D_GL_EXT_NONE }, { STATE_SCISSORRECT, { STATE_SCISSORRECT, scissorrect }, WINED3D_GL_EXT_NONE }, + { STATE_POINTSPRITECOORDORIGIN, { STATE_POINTSPRITECOORDORIGIN, psorigin }, WINED3D_GL_VERSION_2_0 }, + { STATE_POINTSPRITECOORDORIGIN, { STATE_POINTSPRITECOORDORIGIN, psorigin_w }, WINED3D_GL_EXT_NONE }, + /* TODO: Move shader constant loading to vertex and fragment pipeline repectively, as soon as the pshader and * vshader loadings are untied from each other */ @@ -5080,7 +4984,6 @@ const struct StateEntryTemplate misc_state_template[] = { { STATE_RENDER(WINED3DRS_SUBPIXEL), { STATE_RENDER(WINED3DRS_SUBPIXEL), state_subpixel }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3DRS_SUBPIXELX), { STATE_RENDER(WINED3DRS_SUBPIXELX), state_subpixelx }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3DRS_STIPPLEDALPHA), { STATE_RENDER(WINED3DRS_STIPPLEDALPHA), state_stippledalpha }, WINED3D_GL_EXT_NONE }, - { STATE_RENDER(WINED3DRS_ZBIAS), { STATE_RENDER(WINED3DRS_ZBIAS), state_zbias }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3DRS_STIPPLEENABLE), { STATE_RENDER(WINED3DRS_STIPPLEENABLE), state_stippleenable }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3DRS_MIPMAPLODBIAS), { STATE_RENDER(WINED3DRS_MIPMAPLODBIAS), state_mipmaplodbias }, WINED3D_GL_EXT_NONE }, { STATE_RENDER(WINED3DRS_ANISOTROPY), { STATE_RENDER(WINED3DRS_ANISOTROPY), state_anisotropy }, WINED3D_GL_EXT_NONE }, @@ -5675,51 +5578,51 @@ static const struct StateEntryTemplate ffp_fragmentstate_template[] = { {0 /* Terminate */, { 0, 0 }, WINED3D_GL_EXT_NONE }, }; -/* Context activation is done by the caller. */ -static void ffp_enable(IWineD3DDevice *iface, BOOL enable) { } +/* Context activation and GL locking are done by the caller. */ +static void ffp_enable(BOOL enable) {} -static void ffp_fragment_get_caps(const struct wined3d_gl_info *gl_info, struct fragment_caps *pCaps) +static void ffp_fragment_get_caps(const struct wined3d_gl_info *gl_info, struct fragment_caps *caps) { - pCaps->PrimitiveMiscCaps = 0; - pCaps->TextureOpCaps = WINED3DTEXOPCAPS_ADD | - WINED3DTEXOPCAPS_ADDSIGNED | - WINED3DTEXOPCAPS_ADDSIGNED2X | - WINED3DTEXOPCAPS_MODULATE | - WINED3DTEXOPCAPS_MODULATE2X | - WINED3DTEXOPCAPS_MODULATE4X | - WINED3DTEXOPCAPS_SELECTARG1 | - WINED3DTEXOPCAPS_SELECTARG2 | - WINED3DTEXOPCAPS_DISABLE; + caps->PrimitiveMiscCaps = 0; + caps->TextureOpCaps = WINED3DTEXOPCAPS_ADD + | WINED3DTEXOPCAPS_ADDSIGNED + | WINED3DTEXOPCAPS_ADDSIGNED2X + | WINED3DTEXOPCAPS_MODULATE + | WINED3DTEXOPCAPS_MODULATE2X + | WINED3DTEXOPCAPS_MODULATE4X + | WINED3DTEXOPCAPS_SELECTARG1 + | WINED3DTEXOPCAPS_SELECTARG2 + | WINED3DTEXOPCAPS_DISABLE; if (gl_info->supported[ARB_TEXTURE_ENV_COMBINE] || gl_info->supported[EXT_TEXTURE_ENV_COMBINE] || gl_info->supported[NV_TEXTURE_ENV_COMBINE4]) { - pCaps->TextureOpCaps |= WINED3DTEXOPCAPS_BLENDDIFFUSEALPHA | - WINED3DTEXOPCAPS_BLENDTEXTUREALPHA | - WINED3DTEXOPCAPS_BLENDFACTORALPHA | - WINED3DTEXOPCAPS_BLENDCURRENTALPHA | - WINED3DTEXOPCAPS_LERP | - WINED3DTEXOPCAPS_SUBTRACT; + caps->TextureOpCaps |= WINED3DTEXOPCAPS_BLENDDIFFUSEALPHA + | WINED3DTEXOPCAPS_BLENDTEXTUREALPHA + | WINED3DTEXOPCAPS_BLENDFACTORALPHA + | WINED3DTEXOPCAPS_BLENDCURRENTALPHA + | WINED3DTEXOPCAPS_LERP + | WINED3DTEXOPCAPS_SUBTRACT; } if (gl_info->supported[ATI_TEXTURE_ENV_COMBINE3] || gl_info->supported[NV_TEXTURE_ENV_COMBINE4]) { - pCaps->TextureOpCaps |= WINED3DTEXOPCAPS_ADDSMOOTH | - WINED3DTEXOPCAPS_MULTIPLYADD | - WINED3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR | - WINED3DTEXOPCAPS_MODULATECOLOR_ADDALPHA | - WINED3DTEXOPCAPS_BLENDTEXTUREALPHAPM; + caps->TextureOpCaps |= WINED3DTEXOPCAPS_ADDSMOOTH + | WINED3DTEXOPCAPS_MULTIPLYADD + | WINED3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR + | WINED3DTEXOPCAPS_MODULATECOLOR_ADDALPHA + | WINED3DTEXOPCAPS_BLENDTEXTUREALPHAPM; } if (gl_info->supported[ARB_TEXTURE_ENV_DOT3]) - pCaps->TextureOpCaps |= WINED3DTEXOPCAPS_DOTPRODUCT3; + caps->TextureOpCaps |= WINED3DTEXOPCAPS_DOTPRODUCT3; - pCaps->MaxTextureBlendStages = gl_info->limits.textures; - pCaps->MaxSimultaneousTextures = gl_info->limits.textures; + caps->MaxTextureBlendStages = gl_info->limits.textures; + caps->MaxSimultaneousTextures = gl_info->limits.textures; } -static HRESULT ffp_fragment_alloc(IWineD3DDevice *iface) { return WINED3D_OK; } -static void ffp_fragment_free(IWineD3DDevice *iface) {} +static HRESULT ffp_fragment_alloc(struct wined3d_device *device) { return WINED3D_OK; } +static void ffp_fragment_free(struct wined3d_device *device) {} static BOOL ffp_color_fixup_supported(struct color_fixup_desc fixup) { if (TRACE_ON(d3d)) @@ -5756,13 +5659,13 @@ static unsigned int num_handlers(const APPLYSTATEFUNC *funcs) return i; } -static void multistate_apply_2(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void multistate_apply_2(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { stateblock->device->multistate_funcs[state][0](state, stateblock, context); stateblock->device->multistate_funcs[state][1](state, stateblock, context); } -static void multistate_apply_3(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +static void multistate_apply_3(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { stateblock->device->multistate_funcs[state][0](state, stateblock, context); stateblock->device->multistate_funcs[state][1](state, stateblock, context); @@ -5812,6 +5715,7 @@ static void validate_state_table(struct StateEntry *state_table) { 17, 18}, { 21, 21}, { 42, 45}, + { 47, 47}, { 61, 127}, {149, 150}, {169, 169}, @@ -5832,6 +5736,7 @@ static void validate_state_table(struct StateEntry *state_table) STATE_VIEWPORT, STATE_SCISSORRECT, STATE_FRONTFACE, + STATE_POINTSPRITECOORDORIGIN, }; unsigned int i, current; diff --git a/dll/directx/wine/wined3d/stateblock.c b/dll/directx/wine/wined3d/stateblock.c index de8ee8eff21..5beea287376 100644 --- a/dll/directx/wine/wined3d/stateblock.c +++ b/dll/directx/wine/wined3d/stateblock.c @@ -191,9 +191,9 @@ static const DWORD vertex_states_sampler[] = /* Allocates the correct amount of space for pixel and vertex shader constants, * along with their set/changed flags on the given stateblock object */ -static HRESULT stateblock_allocate_shader_constants(IWineD3DStateBlockImpl *object) +static HRESULT stateblock_allocate_shader_constants(struct wined3d_stateblock *object) { - IWineD3DDeviceImpl *device = object->device; + struct wined3d_device *device = object->device; /* Allocate space for floating point constants */ object->state.ps_consts_f = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, @@ -327,9 +327,9 @@ static void stateblock_savedstates_set_vertex(SAVEDSTATES *states, const DWORD n memset(states->vertexShaderConstantsF, TRUE, sizeof(BOOL) * num_constants); } -void stateblock_init_contained_states(IWineD3DStateBlockImpl *stateblock) +void stateblock_init_contained_states(struct wined3d_stateblock *stateblock) { - IWineD3DDeviceImpl *device = stateblock->device; + struct wined3d_device *device = stateblock->device; unsigned int i, j; for (i = 0; i <= WINEHIGHEST_RENDER_STATE >> 5; ++i) @@ -439,7 +439,7 @@ void stateblock_init_contained_states(IWineD3DStateBlockImpl *stateblock) } } -static void stateblock_init_lights(IWineD3DStateBlockImpl *stateblock, struct list *light_map) +static void stateblock_init_lights(struct wined3d_stateblock *stateblock, struct list *light_map) { unsigned int i; @@ -457,68 +457,68 @@ static void stateblock_init_lights(IWineD3DStateBlockImpl *stateblock, struct li } } -/********************************************************** - * IWineD3DStateBlockImpl IUnknown parts follows - **********************************************************/ -static HRESULT WINAPI IWineD3DStateBlockImpl_QueryInterface(IWineD3DStateBlock *iface,REFIID riid,LPVOID *ppobj) +ULONG CDECL wined3d_stateblock_incref(struct wined3d_stateblock *stateblock) { - IWineD3DStateBlockImpl *This = (IWineD3DStateBlockImpl *)iface; - TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(riid),ppobj); - if (IsEqualGUID(riid, &IID_IUnknown) - || IsEqualGUID(riid, &IID_IWineD3DStateBlock)) + ULONG refcount = InterlockedIncrement(&stateblock->ref); + + TRACE("%p increasing refcount to %u.\n", stateblock, refcount); + + return refcount; +} + +ULONG CDECL wined3d_stateblock_decref(struct wined3d_stateblock *stateblock) +{ + ULONG refcount = InterlockedDecrement(&stateblock->ref); + + TRACE("%p decreasing refcount to %u\n", stateblock, refcount); + + if (!refcount) { - IUnknown_AddRef(iface); - *ppobj = This; - return S_OK; - } - *ppobj = NULL; - return E_NOINTERFACE; -} - -static ULONG WINAPI IWineD3DStateBlockImpl_AddRef(IWineD3DStateBlock *iface) { - IWineD3DStateBlockImpl *This = (IWineD3DStateBlockImpl *)iface; - ULONG refCount = InterlockedIncrement(&This->ref); - - TRACE("(%p) : AddRef increasing from %d\n", This, refCount - 1); - return refCount; -} - -static ULONG WINAPI IWineD3DStateBlockImpl_Release(IWineD3DStateBlock *iface) { - IWineD3DStateBlockImpl *This = (IWineD3DStateBlockImpl *)iface; - ULONG refCount = InterlockedDecrement(&This->ref); - - TRACE("(%p) : Releasing from %d\n", This, refCount + 1); - - if (!refCount) { + struct wined3d_buffer *buffer; int counter; - if (This->state.vertex_declaration) - IWineD3DVertexDeclaration_Release((IWineD3DVertexDeclaration *)This->state.vertex_declaration); + if (stateblock->state.vertex_declaration) + wined3d_vertex_declaration_decref(stateblock->state.vertex_declaration); for (counter = 0; counter < MAX_COMBINED_SAMPLERS; counter++) { - if (This->state.textures[counter]) - IWineD3DBaseTexture_Release((IWineD3DBaseTexture *)This->state.textures[counter]); + struct wined3d_texture *texture = stateblock->state.textures[counter]; + if (texture) + { + stateblock->state.textures[counter] = NULL; + wined3d_texture_decref(texture); + } } for (counter = 0; counter < MAX_STREAMS; ++counter) { - struct wined3d_buffer *buffer = This->state.streams[counter].buffer; + buffer = stateblock->state.streams[counter].buffer; if (buffer) { - if (IWineD3DBuffer_Release((IWineD3DBuffer *)buffer)) + stateblock->state.streams[counter].buffer = NULL; + if (wined3d_buffer_decref(buffer)) { WARN("Buffer %p still referenced by stateblock, stream %u.\n", buffer, counter); } } } - if (This->state.index_buffer) IWineD3DBuffer_Release((IWineD3DBuffer *)This->state.index_buffer); - if (This->state.vertex_shader) IWineD3DVertexShader_Release((IWineD3DVertexShader *)This->state.vertex_shader); - if (This->state.pixel_shader) IWineD3DPixelShader_Release((IWineD3DPixelShader *)This->state.pixel_shader); - for(counter = 0; counter < LIGHTMAP_SIZE; counter++) { + buffer = stateblock->state.index_buffer; + if (buffer) + { + stateblock->state.index_buffer = NULL; + wined3d_buffer_decref(buffer); + } + + if (stateblock->state.vertex_shader) + wined3d_shader_decref(stateblock->state.vertex_shader); + if (stateblock->state.pixel_shader) + wined3d_shader_decref(stateblock->state.pixel_shader); + + for (counter = 0; counter < LIGHTMAP_SIZE; ++counter) + { struct list *e1, *e2; - LIST_FOR_EACH_SAFE(e1, e2, &This->state.light_map[counter]) + LIST_FOR_EACH_SAFE(e1, e2, &stateblock->state.light_map[counter]) { struct wined3d_light_info *light = LIST_ENTRY(e1, struct wined3d_light_info, entry); list_remove(&light->entry); @@ -526,15 +526,16 @@ static ULONG WINAPI IWineD3DStateBlockImpl_Release(IWineD3DStateBlock *iface) { } } - HeapFree(GetProcessHeap(), 0, This->state.vs_consts_f); - HeapFree(GetProcessHeap(), 0, This->changed.vertexShaderConstantsF); - HeapFree(GetProcessHeap(), 0, This->state.ps_consts_f); - HeapFree(GetProcessHeap(), 0, This->changed.pixelShaderConstantsF); - HeapFree(GetProcessHeap(), 0, This->contained_vs_consts_f); - HeapFree(GetProcessHeap(), 0, This->contained_ps_consts_f); - HeapFree(GetProcessHeap(), 0, This); + HeapFree(GetProcessHeap(), 0, stateblock->state.vs_consts_f); + HeapFree(GetProcessHeap(), 0, stateblock->changed.vertexShaderConstantsF); + HeapFree(GetProcessHeap(), 0, stateblock->state.ps_consts_f); + HeapFree(GetProcessHeap(), 0, stateblock->changed.pixelShaderConstantsF); + HeapFree(GetProcessHeap(), 0, stateblock->contained_vs_consts_f); + HeapFree(GetProcessHeap(), 0, stateblock->contained_ps_consts_f); + HeapFree(GetProcessHeap(), 0, stateblock); } - return refCount; + + return refcount; } static void wined3d_state_record_lights(struct wined3d_state *dst_state, const struct wined3d_state *src_state) @@ -594,33 +595,32 @@ static void wined3d_state_record_lights(struct wined3d_state *dst_state, const s } } -static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface) +HRESULT CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock) { - IWineD3DStateBlockImpl *This = (IWineD3DStateBlockImpl *)iface; - const struct wined3d_state *src_state = &This->device->stateBlock->state; + const struct wined3d_state *src_state = &stateblock->device->stateBlock->state; unsigned int i; DWORD map; - TRACE("iface %p.\n", iface); + TRACE("stateblock %p.\n", stateblock); TRACE("Capturing state %p.\n", src_state); - if (This->changed.vertexShader && This->state.vertex_shader != src_state->vertex_shader) + if (stateblock->changed.vertexShader && stateblock->state.vertex_shader != src_state->vertex_shader) { TRACE("Updating vertex shader from %p to %p\n", - This->state.vertex_shader, src_state->vertex_shader); + stateblock->state.vertex_shader, src_state->vertex_shader); if (src_state->vertex_shader) - IWineD3DVertexShader_AddRef((IWineD3DVertexShader *)src_state->vertex_shader); - if (This->state.vertex_shader) - IWineD3DVertexShader_Release((IWineD3DVertexShader *)This->state.vertex_shader); - This->state.vertex_shader = src_state->vertex_shader; + wined3d_shader_incref(src_state->vertex_shader); + if (stateblock->state.vertex_shader) + wined3d_shader_decref(stateblock->state.vertex_shader); + stateblock->state.vertex_shader = src_state->vertex_shader; } - /* Vertex Shader Float Constants */ - for (i = 0; i < This->num_contained_vs_consts_f; ++i) + /* Vertex shader float constants. */ + for (i = 0; i < stateblock->num_contained_vs_consts_f; ++i) { - unsigned int idx = This->contained_vs_consts_f[i]; + unsigned int idx = stateblock->contained_vs_consts_f[i]; TRACE("Setting vs_consts_f[%u] to {%.8e, %.8e, %.8e, %.8e}.\n", idx, src_state->vs_consts_f[idx * 4 + 0], @@ -628,16 +628,16 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface) src_state->vs_consts_f[idx * 4 + 2], src_state->vs_consts_f[idx * 4 + 3]); - This->state.vs_consts_f[idx * 4 + 0] = src_state->vs_consts_f[idx * 4 + 0]; - This->state.vs_consts_f[idx * 4 + 1] = src_state->vs_consts_f[idx * 4 + 1]; - This->state.vs_consts_f[idx * 4 + 2] = src_state->vs_consts_f[idx * 4 + 2]; - This->state.vs_consts_f[idx * 4 + 3] = src_state->vs_consts_f[idx * 4 + 3]; + stateblock->state.vs_consts_f[idx * 4 + 0] = src_state->vs_consts_f[idx * 4 + 0]; + stateblock->state.vs_consts_f[idx * 4 + 1] = src_state->vs_consts_f[idx * 4 + 1]; + stateblock->state.vs_consts_f[idx * 4 + 2] = src_state->vs_consts_f[idx * 4 + 2]; + stateblock->state.vs_consts_f[idx * 4 + 3] = src_state->vs_consts_f[idx * 4 + 3]; } - /* Vertex Shader Integer Constants */ - for (i = 0; i < This->num_contained_vs_consts_i; ++i) + /* Vertex shader integer constants. */ + for (i = 0; i < stateblock->num_contained_vs_consts_i; ++i) { - unsigned int idx = This->contained_vs_consts_i[i]; + unsigned int idx = stateblock->contained_vs_consts_i[i]; TRACE("Setting vs_consts[%u] to {%d, %d, %d, %d}.\n", idx, src_state->vs_consts_i[idx * 4 + 0], @@ -645,27 +645,27 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface) src_state->vs_consts_i[idx * 4 + 2], src_state->vs_consts_i[idx * 4 + 3]); - This->state.vs_consts_i[idx * 4 + 0] = src_state->vs_consts_i[idx * 4 + 0]; - This->state.vs_consts_i[idx * 4 + 1] = src_state->vs_consts_i[idx * 4 + 1]; - This->state.vs_consts_i[idx * 4 + 2] = src_state->vs_consts_i[idx * 4 + 2]; - This->state.vs_consts_i[idx * 4 + 3] = src_state->vs_consts_i[idx * 4 + 3]; + stateblock->state.vs_consts_i[idx * 4 + 0] = src_state->vs_consts_i[idx * 4 + 0]; + stateblock->state.vs_consts_i[idx * 4 + 1] = src_state->vs_consts_i[idx * 4 + 1]; + stateblock->state.vs_consts_i[idx * 4 + 2] = src_state->vs_consts_i[idx * 4 + 2]; + stateblock->state.vs_consts_i[idx * 4 + 3] = src_state->vs_consts_i[idx * 4 + 3]; } - /* Vertex Shader Boolean Constants */ - for (i = 0; i < This->num_contained_vs_consts_b; ++i) + /* Vertex shader boolean constants. */ + for (i = 0; i < stateblock->num_contained_vs_consts_b; ++i) { - unsigned int idx = This->contained_vs_consts_b[i]; + unsigned int idx = stateblock->contained_vs_consts_b[i]; TRACE("Setting vs_consts_b[%u] to %s.\n", idx, src_state->vs_consts_b[idx] ? "TRUE" : "FALSE"); - This->state.vs_consts_b[idx] = src_state->vs_consts_b[idx]; + stateblock->state.vs_consts_b[idx] = src_state->vs_consts_b[idx]; } - /* Pixel Shader Float Constants */ - for (i = 0; i < This->num_contained_ps_consts_f; ++i) + /* Pixel shader float constants. */ + for (i = 0; i < stateblock->num_contained_ps_consts_f; ++i) { - unsigned int idx = This->contained_ps_consts_f[i]; + unsigned int idx = stateblock->contained_ps_consts_f[i]; TRACE("Setting ps_consts_f[%u] to {%.8e, %.8e, %.8e, %.8e}.\n", idx, src_state->ps_consts_f[idx * 4 + 0], @@ -673,217 +673,219 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface) src_state->ps_consts_f[idx * 4 + 2], src_state->ps_consts_f[idx * 4 + 3]); - This->state.ps_consts_f[idx * 4 + 0] = src_state->ps_consts_f[idx * 4 + 0]; - This->state.ps_consts_f[idx * 4 + 1] = src_state->ps_consts_f[idx * 4 + 1]; - This->state.ps_consts_f[idx * 4 + 2] = src_state->ps_consts_f[idx * 4 + 2]; - This->state.ps_consts_f[idx * 4 + 3] = src_state->ps_consts_f[idx * 4 + 3]; + stateblock->state.ps_consts_f[idx * 4 + 0] = src_state->ps_consts_f[idx * 4 + 0]; + stateblock->state.ps_consts_f[idx * 4 + 1] = src_state->ps_consts_f[idx * 4 + 1]; + stateblock->state.ps_consts_f[idx * 4 + 2] = src_state->ps_consts_f[idx * 4 + 2]; + stateblock->state.ps_consts_f[idx * 4 + 3] = src_state->ps_consts_f[idx * 4 + 3]; } - /* Pixel Shader Integer Constants */ - for (i = 0; i < This->num_contained_ps_consts_i; ++i) + /* Pixel shader integer constants. */ + for (i = 0; i < stateblock->num_contained_ps_consts_i; ++i) { - unsigned int idx = This->contained_ps_consts_i[i]; + unsigned int idx = stateblock->contained_ps_consts_i[i]; TRACE("Setting ps_consts_i[%u] to {%d, %d, %d, %d}.\n", idx, src_state->ps_consts_i[idx * 4 + 0], src_state->ps_consts_i[idx * 4 + 1], src_state->ps_consts_i[idx * 4 + 2], src_state->ps_consts_i[idx * 4 + 3]); - This->state.ps_consts_i[idx * 4 + 0] = src_state->ps_consts_i[idx * 4 + 0]; - This->state.ps_consts_i[idx * 4 + 1] = src_state->ps_consts_i[idx * 4 + 1]; - This->state.ps_consts_i[idx * 4 + 2] = src_state->ps_consts_i[idx * 4 + 2]; - This->state.ps_consts_i[idx * 4 + 3] = src_state->ps_consts_i[idx * 4 + 3]; + stateblock->state.ps_consts_i[idx * 4 + 0] = src_state->ps_consts_i[idx * 4 + 0]; + stateblock->state.ps_consts_i[idx * 4 + 1] = src_state->ps_consts_i[idx * 4 + 1]; + stateblock->state.ps_consts_i[idx * 4 + 2] = src_state->ps_consts_i[idx * 4 + 2]; + stateblock->state.ps_consts_i[idx * 4 + 3] = src_state->ps_consts_i[idx * 4 + 3]; } - /* Pixel Shader Boolean Constants */ - for (i = 0; i < This->num_contained_ps_consts_b; ++i) + /* Pixel shader boolean constants. */ + for (i = 0; i < stateblock->num_contained_ps_consts_b; ++i) { - unsigned int idx = This->contained_ps_consts_b[i]; + unsigned int idx = stateblock->contained_ps_consts_b[i]; TRACE("Setting ps_consts_b[%u] to %s.\n", idx, src_state->ps_consts_b[idx] ? "TRUE" : "FALSE"); - This->state.ps_consts_b[idx] = src_state->ps_consts_b[idx]; + stateblock->state.ps_consts_b[idx] = src_state->ps_consts_b[idx]; } /* Others + Render & Texture */ - for (i = 0; i < This->num_contained_transform_states; ++i) + for (i = 0; i < stateblock->num_contained_transform_states; ++i) { - WINED3DTRANSFORMSTATETYPE transform = This->contained_transform_states[i]; + WINED3DTRANSFORMSTATETYPE transform = stateblock->contained_transform_states[i]; TRACE("Updating transform %#x.\n", transform); - This->state.transforms[transform] = src_state->transforms[transform]; + stateblock->state.transforms[transform] = src_state->transforms[transform]; } - if (This->changed.primitive_type) - This->state.gl_primitive_type = src_state->gl_primitive_type; + if (stateblock->changed.primitive_type) + stateblock->state.gl_primitive_type = src_state->gl_primitive_type; - if (This->changed.indices - && ((This->state.index_buffer != src_state->index_buffer) - || (This->state.base_vertex_index != src_state->base_vertex_index) - || (This->state.index_format != src_state->index_format))) + if (stateblock->changed.indices + && ((stateblock->state.index_buffer != src_state->index_buffer) + || (stateblock->state.base_vertex_index != src_state->base_vertex_index) + || (stateblock->state.index_format != src_state->index_format))) { TRACE("Updating index buffer to %p, base vertex index to %d.\n", src_state->index_buffer, src_state->base_vertex_index); if (src_state->index_buffer) - IWineD3DBuffer_AddRef((IWineD3DBuffer *)src_state->index_buffer); - if (This->state.index_buffer) - IWineD3DBuffer_Release((IWineD3DBuffer *)This->state.index_buffer); - This->state.index_buffer = src_state->index_buffer; - This->state.base_vertex_index = src_state->base_vertex_index; - This->state.index_format = src_state->index_format; + wined3d_buffer_incref(src_state->index_buffer); + if (stateblock->state.index_buffer) + wined3d_buffer_decref(stateblock->state.index_buffer); + stateblock->state.index_buffer = src_state->index_buffer; + stateblock->state.base_vertex_index = src_state->base_vertex_index; + stateblock->state.index_format = src_state->index_format; } - if (This->changed.vertexDecl && This->state.vertex_declaration != src_state->vertex_declaration) + if (stateblock->changed.vertexDecl && stateblock->state.vertex_declaration != src_state->vertex_declaration) { TRACE("Updating vertex declaration from %p to %p.\n", - This->state.vertex_declaration, src_state->vertex_declaration); + stateblock->state.vertex_declaration, src_state->vertex_declaration); if (src_state->vertex_declaration) - IWineD3DVertexDeclaration_AddRef((IWineD3DVertexDeclaration *)src_state->vertex_declaration); - if (This->state.vertex_declaration) - IWineD3DVertexDeclaration_Release((IWineD3DVertexDeclaration *)This->state.vertex_declaration); - This->state.vertex_declaration = src_state->vertex_declaration; + wined3d_vertex_declaration_incref(src_state->vertex_declaration); + if (stateblock->state.vertex_declaration) + wined3d_vertex_declaration_decref(stateblock->state.vertex_declaration); + stateblock->state.vertex_declaration = src_state->vertex_declaration; } - if (This->changed.material && memcmp(&src_state->material, &This->state.material, sizeof(This->state.material))) + if (stateblock->changed.material + && memcmp(&src_state->material, &stateblock->state.material, sizeof(stateblock->state.material))) { TRACE("Updating material.\n"); - This->state.material = src_state->material; + stateblock->state.material = src_state->material; } - if (This->changed.viewport && memcmp(&src_state->viewport, &This->state.viewport, sizeof(This->state.viewport))) + if (stateblock->changed.viewport + && memcmp(&src_state->viewport, &stateblock->state.viewport, sizeof(stateblock->state.viewport))) { TRACE("Updating viewport.\n"); - This->state.viewport = src_state->viewport; + stateblock->state.viewport = src_state->viewport; } - if (This->changed.scissorRect && memcmp(&src_state->scissor_rect, - &This->state.scissor_rect, sizeof(This->state.scissor_rect))) + if (stateblock->changed.scissorRect && memcmp(&src_state->scissor_rect, + &stateblock->state.scissor_rect, sizeof(stateblock->state.scissor_rect))) { TRACE("Updating scissor rect.\n"); - This->state.scissor_rect = src_state->scissor_rect; + stateblock->state.scissor_rect = src_state->scissor_rect; } - map = This->changed.streamSource; + map = stateblock->changed.streamSource; for (i = 0; map; map >>= 1, ++i) { if (!(map & 1)) continue; - if (This->state.streams[i].stride != src_state->streams[i].stride - || This->state.streams[i].buffer != src_state->streams[i].buffer) + if (stateblock->state.streams[i].stride != src_state->streams[i].stride + || stateblock->state.streams[i].buffer != src_state->streams[i].buffer) { TRACE("Updating stream source %u to %p, stride to %u.\n", i, src_state->streams[i].buffer, src_state->streams[i].stride); - This->state.streams[i].stride = src_state->streams[i].stride; + stateblock->state.streams[i].stride = src_state->streams[i].stride; if (src_state->streams[i].buffer) - IWineD3DBuffer_AddRef((IWineD3DBuffer *)src_state->streams[i].buffer); - if (This->state.streams[i].buffer) - IWineD3DBuffer_Release((IWineD3DBuffer *)This->state.streams[i].buffer); - This->state.streams[i].buffer = src_state->streams[i].buffer; + wined3d_buffer_incref(src_state->streams[i].buffer); + if (stateblock->state.streams[i].buffer) + wined3d_buffer_decref(stateblock->state.streams[i].buffer); + stateblock->state.streams[i].buffer = src_state->streams[i].buffer; } } - map = This->changed.streamFreq; + map = stateblock->changed.streamFreq; for (i = 0; map; map >>= 1, ++i) { if (!(map & 1)) continue; - if (This->state.streams[i].frequency != src_state->streams[i].frequency - || This->state.streams[i].flags != src_state->streams[i].flags) + if (stateblock->state.streams[i].frequency != src_state->streams[i].frequency + || stateblock->state.streams[i].flags != src_state->streams[i].flags) { TRACE("Updating stream frequency %u to %u flags to %#x.\n", i, src_state->streams[i].frequency, src_state->streams[i].flags); - This->state.streams[i].frequency = src_state->streams[i].frequency; - This->state.streams[i].flags = src_state->streams[i].flags; + stateblock->state.streams[i].frequency = src_state->streams[i].frequency; + stateblock->state.streams[i].flags = src_state->streams[i].flags; } } - map = This->changed.clipplane; + map = stateblock->changed.clipplane; for (i = 0; map; map >>= 1, ++i) { if (!(map & 1)) continue; - if (memcmp(src_state->clip_planes[i], This->state.clip_planes[i], sizeof(*This->state.clip_planes))) + if (memcmp(src_state->clip_planes[i], stateblock->state.clip_planes[i], sizeof(*stateblock->state.clip_planes))) { TRACE("Updating clipplane %u.\n", i); - memcpy(This->state.clip_planes[i], src_state->clip_planes[i], sizeof(*This->state.clip_planes)); + memcpy(stateblock->state.clip_planes[i], src_state->clip_planes[i], sizeof(*stateblock->state.clip_planes)); } } /* Render */ - for (i = 0; i < This->num_contained_render_states; ++i) + for (i = 0; i < stateblock->num_contained_render_states; ++i) { - WINED3DRENDERSTATETYPE rs = This->contained_render_states[i]; + WINED3DRENDERSTATETYPE rs = stateblock->contained_render_states[i]; TRACE("Updating render state %#x to %u.\n", rs, src_state->render_states[rs]); - This->state.render_states[rs] = src_state->render_states[rs]; + stateblock->state.render_states[rs] = src_state->render_states[rs]; } /* Texture states */ - for (i = 0; i < This->num_contained_tss_states; ++i) + for (i = 0; i < stateblock->num_contained_tss_states; ++i) { - DWORD stage = This->contained_tss_states[i].stage; - DWORD state = This->contained_tss_states[i].state; + DWORD stage = stateblock->contained_tss_states[i].stage; + DWORD state = stateblock->contained_tss_states[i].state; TRACE("Updating texturestage state %u, %u to %#x (was %#x).\n", stage, state, - src_state->texture_states[stage][state], This->state.texture_states[stage][state]); + src_state->texture_states[stage][state], stateblock->state.texture_states[stage][state]); - This->state.texture_states[stage][state] = src_state->texture_states[stage][state]; + stateblock->state.texture_states[stage][state] = src_state->texture_states[stage][state]; } /* Samplers */ - map = This->changed.textures; + map = stateblock->changed.textures; for (i = 0; map; map >>= 1, ++i) { if (!(map & 1)) continue; TRACE("Updating texture %u to %p (was %p).\n", - i, src_state->textures[i], This->state.textures[i]); + i, src_state->textures[i], stateblock->state.textures[i]); if (src_state->textures[i]) - IWineD3DBaseTexture_AddRef((IWineD3DBaseTexture *)src_state->textures[i]); - if (This->state.textures[i]) - IWineD3DBaseTexture_Release((IWineD3DBaseTexture *)This->state.textures[i]); - This->state.textures[i] = src_state->textures[i]; + wined3d_texture_incref(src_state->textures[i]); + if (stateblock->state.textures[i]) + wined3d_texture_decref(stateblock->state.textures[i]); + stateblock->state.textures[i] = src_state->textures[i]; } - for (i = 0; i < This->num_contained_sampler_states; ++i) + for (i = 0; i < stateblock->num_contained_sampler_states; ++i) { - DWORD stage = This->contained_sampler_states[i].stage; - DWORD state = This->contained_sampler_states[i].state; + DWORD stage = stateblock->contained_sampler_states[i].stage; + DWORD state = stateblock->contained_sampler_states[i].state; TRACE("Updating sampler state %u, %u to %#x (was %#x).\n", stage, state, - src_state->sampler_states[stage][state], This->state.sampler_states[stage][state]); + src_state->sampler_states[stage][state], stateblock->state.sampler_states[stage][state]); - This->state.sampler_states[stage][state] = src_state->sampler_states[stage][state]; + stateblock->state.sampler_states[stage][state] = src_state->sampler_states[stage][state]; } - if (This->changed.pixelShader && This->state.pixel_shader != src_state->pixel_shader) + if (stateblock->changed.pixelShader && stateblock->state.pixel_shader != src_state->pixel_shader) { if (src_state->pixel_shader) - IWineD3DPixelShader_AddRef((IWineD3DPixelShader *)src_state->pixel_shader); - if (This->state.pixel_shader) - IWineD3DPixelShader_Release((IWineD3DPixelShader *)This->state.pixel_shader); - This->state.pixel_shader = src_state->pixel_shader; + wined3d_shader_incref(src_state->pixel_shader); + if (stateblock->state.pixel_shader) + wined3d_shader_decref(stateblock->state.pixel_shader); + stateblock->state.pixel_shader = src_state->pixel_shader; } - wined3d_state_record_lights(&This->state, src_state); + wined3d_state_record_lights(&stateblock->state, src_state); TRACE("Captue done.\n"); return WINED3D_OK; } -static void apply_lights(IWineD3DDevice *device, const struct wined3d_state *state) +static void apply_lights(struct wined3d_device *device, const struct wined3d_state *state) { UINT i; @@ -895,148 +897,139 @@ static void apply_lights(IWineD3DDevice *device, const struct wined3d_state *sta { const struct wined3d_light_info *light = LIST_ENTRY(e, struct wined3d_light_info, entry); - IWineD3DDevice_SetLight(device, light->OriginalIndex, &light->OriginalParms); - IWineD3DDevice_SetLightEnable(device, light->OriginalIndex, light->glIndex != -1); + wined3d_device_set_light(device, light->OriginalIndex, &light->OriginalParms); + wined3d_device_set_light_enable(device, light->OriginalIndex, light->glIndex != -1); } } } -static HRESULT WINAPI IWineD3DStateBlockImpl_Apply(IWineD3DStateBlock *iface) +HRESULT CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock) { - IWineD3DStateBlockImpl *This = (IWineD3DStateBlockImpl *)iface; - IWineD3DDevice *device = (IWineD3DDevice *)This->device; + struct wined3d_device *device = stateblock->device; unsigned int i; DWORD map; - TRACE("(%p) : Applying state block %p ------------------v\n", This, device); + TRACE("Applying stateblock %p to device %p.\n", stateblock, device); + TRACE("Blocktype: %#x.\n", stateblock->blockType); - TRACE("Blocktype: %d\n", This->blockType); + if (stateblock->changed.vertexShader) + wined3d_device_set_vertex_shader(device, stateblock->state.vertex_shader); - if (This->changed.vertexShader) - IWineD3DDevice_SetVertexShader(device, (IWineD3DVertexShader *)This->state.vertex_shader); - - /* Vertex Shader Constants */ - for (i = 0; i < This->num_contained_vs_consts_f; ++i) + /* Vertex Shader Constants. */ + for (i = 0; i < stateblock->num_contained_vs_consts_f; ++i) { - IWineD3DDevice_SetVertexShaderConstantF(device, This->contained_vs_consts_f[i], - This->state.vs_consts_f + This->contained_vs_consts_f[i] * 4, 1); + wined3d_device_set_vs_consts_f(device, stateblock->contained_vs_consts_f[i], + stateblock->state.vs_consts_f + stateblock->contained_vs_consts_f[i] * 4, 1); } - for (i = 0; i < This->num_contained_vs_consts_i; ++i) + for (i = 0; i < stateblock->num_contained_vs_consts_i; ++i) { - IWineD3DDevice_SetVertexShaderConstantI(device, This->contained_vs_consts_i[i], - This->state.vs_consts_i + This->contained_vs_consts_i[i] * 4, 1); + wined3d_device_set_vs_consts_i(device, stateblock->contained_vs_consts_i[i], + stateblock->state.vs_consts_i + stateblock->contained_vs_consts_i[i] * 4, 1); } - for (i = 0; i < This->num_contained_vs_consts_b; ++i) + for (i = 0; i < stateblock->num_contained_vs_consts_b; ++i) { - IWineD3DDevice_SetVertexShaderConstantB(device, This->contained_vs_consts_b[i], - This->state.vs_consts_b + This->contained_vs_consts_b[i], 1); + wined3d_device_set_vs_consts_b(device, stateblock->contained_vs_consts_b[i], + stateblock->state.vs_consts_b + stateblock->contained_vs_consts_b[i], 1); } - apply_lights(device, &This->state); + apply_lights(device, &stateblock->state); - if (This->changed.pixelShader) - IWineD3DDevice_SetPixelShader(device, (IWineD3DPixelShader *)This->state.pixel_shader); + if (stateblock->changed.pixelShader) + wined3d_device_set_pixel_shader(device, stateblock->state.pixel_shader); - /* Pixel Shader Constants */ - for (i = 0; i < This->num_contained_ps_consts_f; ++i) + /* Pixel Shader Constants. */ + for (i = 0; i < stateblock->num_contained_ps_consts_f; ++i) { - IWineD3DDevice_SetPixelShaderConstantF(device, This->contained_ps_consts_f[i], - This->state.ps_consts_f + This->contained_ps_consts_f[i] * 4, 1); + wined3d_device_set_ps_consts_f(device, stateblock->contained_ps_consts_f[i], + stateblock->state.ps_consts_f + stateblock->contained_ps_consts_f[i] * 4, 1); } - for (i = 0; i < This->num_contained_ps_consts_i; ++i) + for (i = 0; i < stateblock->num_contained_ps_consts_i; ++i) { - IWineD3DDevice_SetPixelShaderConstantI(device, This->contained_ps_consts_i[i], - This->state.ps_consts_i + This->contained_ps_consts_i[i] * 4, 1); + wined3d_device_set_ps_consts_i(device, stateblock->contained_ps_consts_i[i], + stateblock->state.ps_consts_i + stateblock->contained_ps_consts_i[i] * 4, 1); } - for (i = 0; i < This->num_contained_ps_consts_b; ++i) + for (i = 0; i < stateblock->num_contained_ps_consts_b; ++i) { - IWineD3DDevice_SetPixelShaderConstantB(device, This->contained_ps_consts_b[i], - This->state.ps_consts_b + This->contained_ps_consts_b[i], 1); + wined3d_device_set_ps_consts_b(device, stateblock->contained_ps_consts_b[i], + stateblock->state.ps_consts_b + stateblock->contained_ps_consts_b[i], 1); } - /* Render */ - for (i = 0; i < This->num_contained_render_states; ++i) + /* Render states. */ + for (i = 0; i < stateblock->num_contained_render_states; ++i) { - IWineD3DDevice_SetRenderState(device, This->contained_render_states[i], - This->state.render_states[This->contained_render_states[i]]); + wined3d_device_set_render_state(device, stateblock->contained_render_states[i], + stateblock->state.render_states[stateblock->contained_render_states[i]]); } - /* Texture states */ - for (i = 0; i < This->num_contained_tss_states; ++i) + /* Texture states. */ + for (i = 0; i < stateblock->num_contained_tss_states; ++i) { - DWORD stage = This->contained_tss_states[i].stage; - DWORD state = This->contained_tss_states[i].state; + DWORD stage = stateblock->contained_tss_states[i].stage; + DWORD state = stateblock->contained_tss_states[i].state; - IWineD3DDevice_SetTextureStageState(device, stage, state, This->state.texture_states[stage][state]); + wined3d_device_set_texture_stage_state(device, stage, state, stateblock->state.texture_states[stage][state]); } - /* Sampler states */ - for (i = 0; i < This->num_contained_sampler_states; ++i) + /* Sampler states. */ + for (i = 0; i < stateblock->num_contained_sampler_states; ++i) { - DWORD stage = This->contained_sampler_states[i].stage; - DWORD state = This->contained_sampler_states[i].state; - DWORD value = This->state.sampler_states[stage][state]; + DWORD stage = stateblock->contained_sampler_states[i].stage; + DWORD state = stateblock->contained_sampler_states[i].state; + DWORD value = stateblock->state.sampler_states[stage][state]; if (stage >= MAX_FRAGMENT_SAMPLERS) stage += WINED3DVERTEXTEXTURESAMPLER0 - MAX_FRAGMENT_SAMPLERS; - IWineD3DDevice_SetSamplerState(device, stage, state, value); + wined3d_device_set_sampler_state(device, stage, state, value); } - for (i = 0; i < This->num_contained_transform_states; ++i) + /* Transform states. */ + for (i = 0; i < stateblock->num_contained_transform_states; ++i) { - IWineD3DDevice_SetTransform(device, This->contained_transform_states[i], - &This->state.transforms[This->contained_transform_states[i]]); + wined3d_device_set_transform(device, stateblock->contained_transform_states[i], + &stateblock->state.transforms[stateblock->contained_transform_states[i]]); } - if (This->changed.primitive_type) + if (stateblock->changed.primitive_type) { - This->device->updateStateBlock->changed.primitive_type = TRUE; - This->device->updateStateBlock->state.gl_primitive_type = This->state.gl_primitive_type; + stateblock->device->updateStateBlock->changed.primitive_type = TRUE; + stateblock->device->updateStateBlock->state.gl_primitive_type = stateblock->state.gl_primitive_type; } - if (This->changed.indices) + if (stateblock->changed.indices) { - IWineD3DDevice_SetIndexBuffer(device, (IWineD3DBuffer *)This->state.index_buffer, This->state.index_format); - IWineD3DDevice_SetBaseVertexIndex(device, This->state.base_vertex_index); + wined3d_device_set_index_buffer(device, stateblock->state.index_buffer, stateblock->state.index_format); + wined3d_device_set_base_vertex_index(device, stateblock->state.base_vertex_index); } - if (This->changed.vertexDecl && This->state.vertex_declaration) - { - IWineD3DDevice_SetVertexDeclaration(device, (IWineD3DVertexDeclaration *)This->state.vertex_declaration); - } + if (stateblock->changed.vertexDecl && stateblock->state.vertex_declaration) + wined3d_device_set_vertex_declaration(device, stateblock->state.vertex_declaration); - if (This->changed.material) - { - IWineD3DDevice_SetMaterial(device, &This->state.material); - } + if (stateblock->changed.material) + wined3d_device_set_material(device, &stateblock->state.material); - if (This->changed.viewport) - { - IWineD3DDevice_SetViewport(device, &This->state.viewport); - } + if (stateblock->changed.viewport) + wined3d_device_set_viewport(device, &stateblock->state.viewport); - if (This->changed.scissorRect) - { - IWineD3DDevice_SetScissorRect(device, &This->state.scissor_rect); - } + if (stateblock->changed.scissorRect) + wined3d_device_set_scissor_rect(device, &stateblock->state.scissor_rect); - map = This->changed.streamSource; + map = stateblock->changed.streamSource; for (i = 0; map; map >>= 1, ++i) { if (map & 1) - IWineD3DDevice_SetStreamSource(device, i, - (IWineD3DBuffer *)This->state.streams[i].buffer, - 0, This->state.streams[i].stride); + wined3d_device_set_stream_source(device, i, + stateblock->state.streams[i].buffer, + 0, stateblock->state.streams[i].stride); } - map = This->changed.streamFreq; + map = stateblock->changed.streamFreq; for (i = 0; map; map >>= 1, ++i) { if (map & 1) - IWineD3DDevice_SetStreamSourceFreq(device, i, - This->state.streams[i].frequency | This->state.streams[i].flags); + wined3d_device_set_stream_source_freq(device, i, + stateblock->state.streams[i].frequency | stateblock->state.streams[i].flags); } - map = This->changed.textures; + map = stateblock->changed.textures; for (i = 0; map; map >>= 1, ++i) { DWORD stage; @@ -1044,40 +1037,41 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Apply(IWineD3DStateBlock *iface) if (!(map & 1)) continue; stage = i < MAX_FRAGMENT_SAMPLERS ? i : WINED3DVERTEXTEXTURESAMPLER0 + i - MAX_FRAGMENT_SAMPLERS; - IWineD3DDevice_SetTexture(device, stage, (IWineD3DBaseTexture *)This->state.textures[i]); + wined3d_device_set_texture(device, stage, stateblock->state.textures[i]); } - map = This->changed.clipplane; + map = stateblock->changed.clipplane; for (i = 0; map; map >>= 1, ++i) { float clip[4]; if (!(map & 1)) continue; - clip[0] = This->state.clip_planes[i][0]; - clip[1] = This->state.clip_planes[i][1]; - clip[2] = This->state.clip_planes[i][2]; - clip[3] = This->state.clip_planes[i][3]; - IWineD3DDevice_SetClipPlane(device, i, clip); + clip[0] = (float) stateblock->state.clip_planes[i][0]; + clip[1] = (float) stateblock->state.clip_planes[i][1]; + clip[2] = (float) stateblock->state.clip_planes[i][2]; + clip[3] = (float) stateblock->state.clip_planes[i][3]; + wined3d_device_set_clip_plane(device, i, clip); } - This->device->stateBlock->state.lowest_disabled_stage = MAX_TEXTURES - 1; + stateblock->device->stateBlock->state.lowest_disabled_stage = MAX_TEXTURES - 1; for (i = 0; i < MAX_TEXTURES - 1; ++i) { - if (This->device->stateBlock->state.texture_states[i][WINED3DTSS_COLOROP] == WINED3DTOP_DISABLE) + if (stateblock->device->stateBlock->state.texture_states[i][WINED3DTSS_COLOROP] == WINED3DTOP_DISABLE) { - This->device->stateBlock->state.lowest_disabled_stage = i; + stateblock->device->stateBlock->state.lowest_disabled_stage = i; break; } } - TRACE("(%p) : Applied state block %p ------------------^\n", This, device); + + TRACE("Applied stateblock %p.\n", stateblock); return WINED3D_OK; } -void stateblock_init_default_state(IWineD3DStateBlockImpl *stateblock) +void stateblock_init_default_state(struct wined3d_stateblock *stateblock) { - IWineD3DDeviceImpl *device = stateblock->device; + struct wined3d_device *device = stateblock->device; const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; struct wined3d_state *state = &stateblock->state; union { @@ -1089,8 +1083,8 @@ void stateblock_init_default_state(IWineD3DStateBlockImpl *stateblock) DWORD d; } tmpfloat; unsigned int i; - IWineD3DSwapChain *swapchain; - IWineD3DSurface *backbuffer; + struct wined3d_swapchain *swapchain; + struct wined3d_surface *backbuffer; HRESULT hr; TRACE("stateblock %p.\n", stateblock); @@ -1139,7 +1133,6 @@ void stateblock_init_default_state(IWineD3DStateBlockImpl *stateblock) tmpfloat.f = 1.0f; state->render_states[WINED3DRS_FOGDENSITY] = tmpfloat.d; state->render_states[WINED3DRS_EDGEANTIALIAS] = FALSE; - state->render_states[WINED3DRS_ZBIAS] = 0; state->render_states[WINED3DRS_RANGEFOGENABLE] = FALSE; state->render_states[WINED3DRS_STENCILENABLE] = FALSE; state->render_states[WINED3DRS_STENCILFAIL] = WINED3DSTENCILOP_KEEP; @@ -1294,16 +1287,16 @@ void stateblock_init_default_state(IWineD3DStateBlockImpl *stateblock) } /* check the return values, because the GetBackBuffer call isn't valid for ddraw */ - hr = IWineD3DDevice_GetSwapChain((IWineD3DDevice *)device, 0, &swapchain); + hr = wined3d_device_get_swapchain(device, 0, &swapchain); if (SUCCEEDED(hr) && swapchain) { - hr = IWineD3DSwapChain_GetBackBuffer(swapchain, 0, WINED3DBACKBUFFER_TYPE_MONO, &backbuffer); + hr = wined3d_swapchain_get_back_buffer(swapchain, 0, WINED3DBACKBUFFER_TYPE_MONO, &backbuffer); if (SUCCEEDED(hr) && backbuffer) { - WINED3DSURFACE_DESC desc; + struct wined3d_resource_desc desc; - IWineD3DSurface_GetDesc(backbuffer, &desc); - IWineD3DSurface_Release(backbuffer); + wined3d_resource_get_desc(&backbuffer->resource, &desc); + wined3d_surface_decref(backbuffer); /* Set the default scissor rect values */ state->scissor_rect.left = 0; @@ -1315,38 +1308,23 @@ void stateblock_init_default_state(IWineD3DStateBlockImpl *stateblock) /* Set the default viewport */ state->viewport.X = 0; state->viewport.Y = 0; - state->viewport.Width = ((IWineD3DSwapChainImpl *)swapchain)->presentParms.BackBufferWidth; - state->viewport.Height = ((IWineD3DSwapChainImpl *)swapchain)->presentParms.BackBufferHeight; + state->viewport.Width = swapchain->presentParms.BackBufferWidth; + state->viewport.Height = swapchain->presentParms.BackBufferHeight; state->viewport.MinZ = 0.0f; state->viewport.MaxZ = 1.0f; - IWineD3DSwapChain_Release(swapchain); + wined3d_swapchain_decref(swapchain); } TRACE("Done.\n"); } -/********************************************************** - * IWineD3DStateBlock VTbl follows - **********************************************************/ - -static const IWineD3DStateBlockVtbl IWineD3DStateBlock_Vtbl = -{ - /* IUnknown */ - IWineD3DStateBlockImpl_QueryInterface, - IWineD3DStateBlockImpl_AddRef, - IWineD3DStateBlockImpl_Release, - /* IWineD3DStateBlock */ - IWineD3DStateBlockImpl_Capture, - IWineD3DStateBlockImpl_Apply, -}; - -HRESULT stateblock_init(IWineD3DStateBlockImpl *stateblock, IWineD3DDeviceImpl *device, WINED3DSTATEBLOCKTYPE type) +static HRESULT stateblock_init(struct wined3d_stateblock *stateblock, + struct wined3d_device *device, WINED3DSTATEBLOCKTYPE type) { unsigned int i; HRESULT hr; - stateblock->lpVtbl = &IWineD3DStateBlock_Vtbl; stateblock->ref = 1; stateblock->device = device; stateblock->blockType = type; @@ -1389,7 +1367,37 @@ HRESULT stateblock_init(IWineD3DStateBlockImpl *stateblock, IWineD3DDeviceImpl * } stateblock_init_contained_states(stateblock); - IWineD3DStateBlockImpl_Capture((IWineD3DStateBlock *)stateblock); + wined3d_stateblock_capture(stateblock); + + return WINED3D_OK; +} + +HRESULT CDECL wined3d_stateblock_create(struct wined3d_device *device, + WINED3DSTATEBLOCKTYPE type, struct wined3d_stateblock **stateblock) +{ + struct wined3d_stateblock *object; + HRESULT hr; + + TRACE("device %p, type %#x, stateblock %p.\n", + device, type, stateblock); + + object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); + if (!object) + { + ERR("Failed to allocate stateblock memory.\n"); + return E_OUTOFMEMORY; + } + + hr = stateblock_init(object, device, type); + if (FAILED(hr)) + { + WARN("Failed to initialize stateblock, hr %#x.\n", hr); + HeapFree(GetProcessHeap(), 0, object); + return hr; + } + + TRACE("Created stateblock %p.\n", object); + *stateblock = object; return WINED3D_OK; } diff --git a/dll/directx/wine/wined3d/surface.c b/dll/directx/wine/wined3d/surface.c index 442ce757920..91b16a6fa0e 100644 --- a/dll/directx/wine/wined3d/surface.c +++ b/dll/directx/wine/wined3d/surface.c @@ -1,7 +1,6 @@ /* - * IWineD3DSurface Implementation - * - * Copyright 1998 Lionel Ulmer + * Copyright 1997-2000 Marcus Meissner + * Copyright 1998-2000 Lionel Ulmer * Copyright 2000-2001 TransGaming Technologies Inc. * Copyright 2002-2005 Jason Edmeades * Copyright 2002-2003 Raphael Junqueira @@ -10,7 +9,7 @@ * Copyright 2006-2008 Stefan Dösinger for CodeWeavers * Copyright 2007-2008 Henri Verbeet * Copyright 2006-2008 Roderick Colenbrander - * Copyright 2009 Henri Verbeet for CodeWeavers + * Copyright 2009-2011 Henri Verbeet for CodeWeavers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -34,34 +33,43 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d_surface); WINE_DECLARE_DEBUG_CHANNEL(d3d); -static void surface_cleanup(IWineD3DSurfaceImpl *This) -{ - TRACE("(%p) : Cleaning up.\n", This); +static HRESULT surface_cpu_blt(struct wined3d_surface *dst_surface, const RECT *dst_rect, + struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags, + const WINEDDBLTFX *fx, WINED3DTEXTUREFILTERTYPE filter); +static HRESULT surface_cpu_bltfast(struct wined3d_surface *dst_surface, DWORD dst_x, DWORD dst_y, + struct wined3d_surface *src_surface, const RECT *src_rect, DWORD trans); +static HRESULT IWineD3DSurfaceImpl_BltOverride(struct wined3d_surface *dst_surface, const RECT *dst_rect, + struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags, const WINEDDBLTFX *fx, + WINED3DTEXTUREFILTERTYPE filter); - if (This->texture_name || (This->Flags & SFLAG_PBO) || !list_empty(&This->renderbuffers)) +static void surface_cleanup(struct wined3d_surface *surface) +{ + TRACE("surface %p.\n", surface); + + if (surface->texture_name || (surface->flags & SFLAG_PBO) || !list_empty(&surface->renderbuffers)) { + struct wined3d_renderbuffer_entry *entry, *entry2; const struct wined3d_gl_info *gl_info; - renderbuffer_entry_t *entry, *entry2; struct wined3d_context *context; - context = context_acquire(This->resource.device, NULL); + context = context_acquire(surface->resource.device, NULL); gl_info = context->gl_info; ENTER_GL(); - if (This->texture_name) + if (surface->texture_name) { - TRACE("Deleting texture %u.\n", This->texture_name); - glDeleteTextures(1, &This->texture_name); + TRACE("Deleting texture %u.\n", surface->texture_name); + glDeleteTextures(1, &surface->texture_name); } - if (This->Flags & SFLAG_PBO) + if (surface->flags & SFLAG_PBO) { - TRACE("Deleting PBO %u.\n", This->pbo); - GL_EXTCALL(glDeleteBuffersARB(1, &This->pbo)); + TRACE("Deleting PBO %u.\n", surface->pbo); + GL_EXTCALL(glDeleteBuffersARB(1, &surface->pbo)); } - LIST_FOR_EACH_ENTRY_SAFE(entry, entry2, &This->renderbuffers, renderbuffer_entry_t, entry) + LIST_FOR_EACH_ENTRY_SAFE(entry, entry2, &surface->renderbuffers, struct wined3d_renderbuffer_entry, entry) { TRACE("Deleting renderbuffer %u.\n", entry->id); gl_info->fbo_ops.glDeleteRenderbuffers(1, &entry->id); @@ -73,26 +81,28 @@ static void surface_cleanup(IWineD3DSurfaceImpl *This) context_release(context); } - if (This->Flags & SFLAG_DIBSECTION) + if (surface->flags & SFLAG_DIBSECTION) { /* Release the DC. */ - SelectObject(This->hDC, This->dib.holdbitmap); - DeleteDC(This->hDC); + SelectObject(surface->hDC, surface->dib.holdbitmap); + DeleteDC(surface->hDC); /* Release the DIB section. */ - DeleteObject(This->dib.DIBsection); - This->dib.bitmap_data = NULL; - This->resource.allocatedMemory = NULL; + DeleteObject(surface->dib.DIBsection); + surface->dib.bitmap_data = NULL; + surface->resource.allocatedMemory = NULL; } - if (This->Flags & SFLAG_USERPTR) IWineD3DSurface_SetMem((IWineD3DSurface *)This, NULL); - if (This->overlay_dest) list_remove(&This->overlay_entry); + if (surface->flags & SFLAG_USERPTR) + wined3d_surface_set_mem(surface, NULL); + if (surface->overlay_dest) + list_remove(&surface->overlay_entry); - HeapFree(GetProcessHeap(), 0, This->palette9); + HeapFree(GetProcessHeap(), 0, surface->palette9); - resource_cleanup((IWineD3DResource *)This); + resource_cleanup(&surface->resource); } -void surface_set_container(IWineD3DSurfaceImpl *surface, enum wined3d_container_type type, IWineD3DBase *container) +void surface_set_container(struct wined3d_surface *surface, enum wined3d_container_type type, void *container) { TRACE("surface %p, container %p.\n", surface, container); @@ -149,22 +159,11 @@ static inline void cube_coords_float(const RECT *r, UINT w, UINT h, struct float f->b = ((r->bottom * 2.0f) / h) - 1.0f; } -static void surface_get_blt_info(GLenum target, const RECT *rect_in, GLsizei w, GLsizei h, struct blt_info *info) +static void surface_get_blt_info(GLenum target, const RECT *rect, GLsizei w, GLsizei h, struct blt_info *info) { GLfloat (*coords)[3] = info->coords; - RECT rect; struct float_rect f; - if (rect_in) - rect = *rect_in; - else - { - rect.left = 0; - rect.top = h; - rect.right = w; - rect.bottom = 0; - } - switch (target) { default: @@ -174,20 +173,20 @@ static void surface_get_blt_info(GLenum target, const RECT *rect_in, GLsizei w, info->binding = GL_TEXTURE_BINDING_2D; info->bind_target = GL_TEXTURE_2D; info->tex_type = tex_2d; - coords[0][0] = (float)rect.left / w; - coords[0][1] = (float)rect.top / h; + coords[0][0] = (float)rect->left / w; + coords[0][1] = (float)rect->top / h; coords[0][2] = 0.0f; - coords[1][0] = (float)rect.right / w; - coords[1][1] = (float)rect.top / h; + coords[1][0] = (float)rect->right / w; + coords[1][1] = (float)rect->top / h; coords[1][2] = 0.0f; - coords[2][0] = (float)rect.left / w; - coords[2][1] = (float)rect.bottom / h; + coords[2][0] = (float)rect->left / w; + coords[2][1] = (float)rect->bottom / h; coords[2][2] = 0.0f; - coords[3][0] = (float)rect.right / w; - coords[3][1] = (float)rect.bottom / h; + coords[3][0] = (float)rect->right / w; + coords[3][1] = (float)rect->bottom / h; coords[3][2] = 0.0f; break; @@ -195,17 +194,17 @@ static void surface_get_blt_info(GLenum target, const RECT *rect_in, GLsizei w, info->binding = GL_TEXTURE_BINDING_RECTANGLE_ARB; info->bind_target = GL_TEXTURE_RECTANGLE_ARB; info->tex_type = tex_rect; - coords[0][0] = rect.left; coords[0][1] = rect.top; coords[0][2] = 0.0f; - coords[1][0] = rect.right; coords[1][1] = rect.top; coords[1][2] = 0.0f; - coords[2][0] = rect.left; coords[2][1] = rect.bottom; coords[2][2] = 0.0f; - coords[3][0] = rect.right; coords[3][1] = rect.bottom; coords[3][2] = 0.0f; + coords[0][0] = rect->left; coords[0][1] = rect->top; coords[0][2] = 0.0f; + coords[1][0] = rect->right; coords[1][1] = rect->top; coords[1][2] = 0.0f; + coords[2][0] = rect->left; coords[2][1] = rect->bottom; coords[2][2] = 0.0f; + coords[3][0] = rect->right; coords[3][1] = rect->bottom; coords[3][2] = 0.0f; break; case GL_TEXTURE_CUBE_MAP_POSITIVE_X: info->binding = GL_TEXTURE_BINDING_CUBE_MAP_ARB; info->bind_target = GL_TEXTURE_CUBE_MAP_ARB; info->tex_type = tex_cube; - cube_coords_float(&rect, w, h, &f); + cube_coords_float(rect, w, h, &f); coords[0][0] = 1.0f; coords[0][1] = -f.t; coords[0][2] = -f.l; coords[1][0] = 1.0f; coords[1][1] = -f.t; coords[1][2] = -f.r; @@ -217,7 +216,7 @@ static void surface_get_blt_info(GLenum target, const RECT *rect_in, GLsizei w, info->binding = GL_TEXTURE_BINDING_CUBE_MAP_ARB; info->bind_target = GL_TEXTURE_CUBE_MAP_ARB; info->tex_type = tex_cube; - cube_coords_float(&rect, w, h, &f); + cube_coords_float(rect, w, h, &f); coords[0][0] = -1.0f; coords[0][1] = -f.t; coords[0][2] = f.l; coords[1][0] = -1.0f; coords[1][1] = -f.t; coords[1][2] = f.r; @@ -229,7 +228,7 @@ static void surface_get_blt_info(GLenum target, const RECT *rect_in, GLsizei w, info->binding = GL_TEXTURE_BINDING_CUBE_MAP_ARB; info->bind_target = GL_TEXTURE_CUBE_MAP_ARB; info->tex_type = tex_cube; - cube_coords_float(&rect, w, h, &f); + cube_coords_float(rect, w, h, &f); coords[0][0] = f.l; coords[0][1] = 1.0f; coords[0][2] = f.t; coords[1][0] = f.r; coords[1][1] = 1.0f; coords[1][2] = f.t; @@ -241,7 +240,7 @@ static void surface_get_blt_info(GLenum target, const RECT *rect_in, GLsizei w, info->binding = GL_TEXTURE_BINDING_CUBE_MAP_ARB; info->bind_target = GL_TEXTURE_CUBE_MAP_ARB; info->tex_type = tex_cube; - cube_coords_float(&rect, w, h, &f); + cube_coords_float(rect, w, h, &f); coords[0][0] = f.l; coords[0][1] = -1.0f; coords[0][2] = -f.t; coords[1][0] = f.r; coords[1][1] = -1.0f; coords[1][2] = -f.t; @@ -253,7 +252,7 @@ static void surface_get_blt_info(GLenum target, const RECT *rect_in, GLsizei w, info->binding = GL_TEXTURE_BINDING_CUBE_MAP_ARB; info->bind_target = GL_TEXTURE_CUBE_MAP_ARB; info->tex_type = tex_cube; - cube_coords_float(&rect, w, h, &f); + cube_coords_float(rect, w, h, &f); coords[0][0] = f.l; coords[0][1] = -f.t; coords[0][2] = 1.0f; coords[1][0] = f.r; coords[1][1] = -f.t; coords[1][2] = 1.0f; @@ -265,7 +264,7 @@ static void surface_get_blt_info(GLenum target, const RECT *rect_in, GLsizei w, info->binding = GL_TEXTURE_BINDING_CUBE_MAP_ARB; info->bind_target = GL_TEXTURE_CUBE_MAP_ARB; info->tex_type = tex_cube; - cube_coords_float(&rect, w, h, &f); + cube_coords_float(rect, w, h, &f); coords[0][0] = -f.l; coords[0][1] = -f.t; coords[0][2] = -1.0f; coords[1][0] = -f.r; coords[1][1] = -f.t; coords[1][2] = -1.0f; @@ -275,7 +274,7 @@ static void surface_get_blt_info(GLenum target, const RECT *rect_in, GLsizei w, } } -static inline void surface_get_rect(IWineD3DSurfaceImpl *This, const RECT *rect_in, RECT *rect_out) +static inline void surface_get_rect(struct wined3d_surface *surface, const RECT *rect_in, RECT *rect_out) { if (rect_in) *rect_out = *rect_in; @@ -283,13 +282,14 @@ static inline void surface_get_rect(IWineD3DSurfaceImpl *This, const RECT *rect_ { rect_out->left = 0; rect_out->top = 0; - rect_out->right = This->currentDesc.Width; - rect_out->bottom = This->currentDesc.Height; + rect_out->right = surface->resource.width; + rect_out->bottom = surface->resource.height; } } /* GL locking and context activation is done by the caller */ -void draw_textured_quad(IWineD3DSurfaceImpl *src_surface, const RECT *src_rect, const RECT *dst_rect, WINED3DTEXTUREFILTERTYPE Filter) +void draw_textured_quad(struct wined3d_surface *src_surface, const RECT *src_rect, + const RECT *dst_rect, WINED3DTEXTUREFILTERTYPE Filter) { struct blt_info info; @@ -337,139 +337,1554 @@ void draw_textured_quad(IWineD3DSurfaceImpl *src_surface, const RECT *src_rect, * container about this to get the filters reset properly next draw. */ if (src_surface->container.type == WINED3D_CONTAINER_TEXTURE) { - IWineD3DBaseTextureImpl *texture = src_surface->container.u.texture; - texture->baseTexture.texture_rgb.states[WINED3DTEXSTA_MAGFILTER] = WINED3DTEXF_POINT; - texture->baseTexture.texture_rgb.states[WINED3DTEXSTA_MINFILTER] = WINED3DTEXF_POINT; - texture->baseTexture.texture_rgb.states[WINED3DTEXSTA_MIPFILTER] = WINED3DTEXF_NONE; + struct wined3d_texture *texture = src_surface->container.u.texture; + texture->texture_rgb.states[WINED3DTEXSTA_MAGFILTER] = WINED3DTEXF_POINT; + texture->texture_rgb.states[WINED3DTEXSTA_MINFILTER] = WINED3DTEXF_POINT; + texture->texture_rgb.states[WINED3DTEXSTA_MIPFILTER] = WINED3DTEXF_NONE; } } -HRESULT surface_init(IWineD3DSurfaceImpl *surface, WINED3DSURFTYPE surface_type, UINT alignment, - UINT width, UINT height, UINT level, BOOL lockable, BOOL discard, WINED3DMULTISAMPLE_TYPE multisample_type, - UINT multisample_quality, IWineD3DDeviceImpl *device, DWORD usage, enum wined3d_format_id format_id, - WINED3DPOOL pool, void *parent, const struct wined3d_parent_ops *parent_ops) +static HRESULT surface_create_dib_section(struct wined3d_surface *surface) { - const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; - const struct wined3d_format *format = wined3d_get_format(gl_info, format_id); - void (*cleanup)(IWineD3DSurfaceImpl *This); - unsigned int resource_size; - HRESULT hr; + const struct wined3d_format *format = surface->resource.format; + SYSTEM_INFO sysInfo; + BITMAPINFO *b_info; + int extraline = 0; + DWORD *masks; + UINT usage; + HDC dc; - if (multisample_quality > 0) + TRACE("surface %p.\n", surface); + + if (!(format->flags & WINED3DFMT_FLAG_GETDC)) { - FIXME("multisample_quality set to %u, substituting 0\n", multisample_quality); - multisample_quality = 0; + WARN("Cannot use GetDC on a %s surface.\n", debug_d3dformat(format->id)); + return WINED3DERR_INVALIDCALL; } - /* FIXME: Check that the format is supported by the device. */ - - resource_size = wined3d_format_calculate_size(format, alignment, width, height); - - /* Look at the implementation and set the correct Vtable. */ - switch (surface_type) + switch (format->byte_count) { - case SURFACE_OPENGL: - surface->lpVtbl = &IWineD3DSurface_Vtbl; - cleanup = surface_cleanup; + case 2: + case 4: + /* Allocate extra space to store the RGB bit masks. */ + b_info = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(BITMAPINFOHEADER) + 3 * sizeof(DWORD)); break; - case SURFACE_GDI: - surface->lpVtbl = &IWineGDISurface_Vtbl; - cleanup = surface_gdi_cleanup; + case 3: + b_info = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(BITMAPINFOHEADER)); break; default: - ERR("Requested unknown surface implementation %#x.\n", surface_type); + /* Allocate extra space for a palette. */ + b_info = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, + sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * (1 << (format->byte_count * 8))); + break; + } + + if (!b_info) + return E_OUTOFMEMORY; + + /* Some applications access the surface in via DWORDs, and do not take + * the necessary care at the end of the surface. So we need at least + * 4 extra bytes at the end of the surface. Check against the page size, + * if the last page used for the surface has at least 4 spare bytes we're + * safe, otherwise add an extra line to the DIB section. */ + GetSystemInfo(&sysInfo); + if( ((surface->resource.size + 3) % sysInfo.dwPageSize) < 4) + { + extraline = 1; + TRACE("Adding an extra line to the DIB section.\n"); + } + + b_info->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + /* TODO: Is there a nicer way to force a specific alignment? (8 byte for ddraw) */ + b_info->bmiHeader.biWidth = wined3d_surface_get_pitch(surface) / format->byte_count; + b_info->bmiHeader.biHeight = 0 - surface->resource.height - extraline; + b_info->bmiHeader.biSizeImage = (surface->resource.height + extraline) + * wined3d_surface_get_pitch(surface); + b_info->bmiHeader.biPlanes = 1; + b_info->bmiHeader.biBitCount = format->byte_count * 8; + + b_info->bmiHeader.biXPelsPerMeter = 0; + b_info->bmiHeader.biYPelsPerMeter = 0; + b_info->bmiHeader.biClrUsed = 0; + b_info->bmiHeader.biClrImportant = 0; + + /* Get the bit masks */ + masks = (DWORD *)b_info->bmiColors; + switch (surface->resource.format->id) + { + case WINED3DFMT_B8G8R8_UNORM: + usage = DIB_RGB_COLORS; + b_info->bmiHeader.biCompression = BI_RGB; + break; + + case WINED3DFMT_B5G5R5X1_UNORM: + case WINED3DFMT_B5G5R5A1_UNORM: + case WINED3DFMT_B4G4R4A4_UNORM: + case WINED3DFMT_B4G4R4X4_UNORM: + case WINED3DFMT_B2G3R3_UNORM: + case WINED3DFMT_B2G3R3A8_UNORM: + case WINED3DFMT_R10G10B10A2_UNORM: + case WINED3DFMT_R8G8B8A8_UNORM: + case WINED3DFMT_R8G8B8X8_UNORM: + case WINED3DFMT_B10G10R10A2_UNORM: + case WINED3DFMT_B5G6R5_UNORM: + case WINED3DFMT_R16G16B16A16_UNORM: + usage = 0; + b_info->bmiHeader.biCompression = BI_BITFIELDS; + masks[0] = format->red_mask; + masks[1] = format->green_mask; + masks[2] = format->blue_mask; + break; + + default: + /* Don't know palette */ + b_info->bmiHeader.biCompression = BI_RGB; + usage = 0; + break; + } + + if (!(dc = GetDC(0))) + { + HeapFree(GetProcessHeap(), 0, b_info); + return HRESULT_FROM_WIN32(GetLastError()); + } + + TRACE("Creating a DIB section with size %dx%dx%d, size=%d.\n", + b_info->bmiHeader.biWidth, b_info->bmiHeader.biHeight, + b_info->bmiHeader.biBitCount, b_info->bmiHeader.biSizeImage); + surface->dib.DIBsection = CreateDIBSection(dc, b_info, usage, &surface->dib.bitmap_data, 0, 0); + ReleaseDC(0, dc); + + if (!surface->dib.DIBsection) + { + ERR("Failed to create DIB section.\n"); + HeapFree(GetProcessHeap(), 0, b_info); + return HRESULT_FROM_WIN32(GetLastError()); + } + + TRACE("DIBSection at %p.\n", surface->dib.bitmap_data); + /* Copy the existing surface to the dib section. */ + if (surface->resource.allocatedMemory) + { + memcpy(surface->dib.bitmap_data, surface->resource.allocatedMemory, + surface->resource.height * wined3d_surface_get_pitch(surface)); + } + else + { + /* This is to make maps read the GL texture although memory is allocated. */ + surface->flags &= ~SFLAG_INSYSMEM; + } + surface->dib.bitmap_size = b_info->bmiHeader.biSizeImage; + + HeapFree(GetProcessHeap(), 0, b_info); + + /* Now allocate a DC. */ + surface->hDC = CreateCompatibleDC(0); + surface->dib.holdbitmap = SelectObject(surface->hDC, surface->dib.DIBsection); + TRACE("Using wined3d palette %p.\n", surface->palette); + SelectPalette(surface->hDC, surface->palette ? surface->palette->hpal : 0, FALSE); + + surface->flags |= SFLAG_DIBSECTION; + + HeapFree(GetProcessHeap(), 0, surface->resource.heapMemory); + surface->resource.heapMemory = NULL; + + return WINED3D_OK; +} + +static void surface_prepare_system_memory(struct wined3d_surface *surface) +{ + struct wined3d_device *device = surface->resource.device; + const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; + + TRACE("surface %p.\n", surface); + + /* Performance optimization: Count how often a surface is locked, if it is + * locked regularly do not throw away the system memory copy. This avoids + * the need to download the surface from OpenGL all the time. The surface + * is still downloaded if the OpenGL texture is changed. */ + if (!(surface->flags & SFLAG_DYNLOCK)) + { + if (++surface->lockCount > MAXLOCKCOUNT) + { + TRACE("Surface is locked regularly, not freeing the system memory copy any more.\n"); + surface->flags |= SFLAG_DYNLOCK; + } + } + + /* Create a PBO for dynamically locked surfaces but don't do it for + * converted or NPOT surfaces. Also don't create a PBO for systemmem + * surfaces. */ + if (gl_info->supported[ARB_PIXEL_BUFFER_OBJECT] && (surface->flags & SFLAG_DYNLOCK) + && !(surface->flags & (SFLAG_PBO | SFLAG_CONVERTED | SFLAG_NONPOW2)) + && (surface->resource.pool != WINED3DPOOL_SYSTEMMEM)) + { + struct wined3d_context *context; + GLenum error; + + context = context_acquire(device, NULL); + ENTER_GL(); + + GL_EXTCALL(glGenBuffersARB(1, &surface->pbo)); + error = glGetError(); + if (!surface->pbo || error != GL_NO_ERROR) + ERR("Failed to create a PBO with error %s (%#x).\n", debug_glerror(error), error); + + TRACE("Binding PBO %u.\n", surface->pbo); + + GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, surface->pbo)); + checkGLcall("glBindBufferARB"); + + GL_EXTCALL(glBufferDataARB(GL_PIXEL_UNPACK_BUFFER_ARB, surface->resource.size + 4, + surface->resource.allocatedMemory, GL_STREAM_DRAW_ARB)); + checkGLcall("glBufferDataARB"); + + GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0)); + checkGLcall("glBindBufferARB"); + + /* We don't need the system memory anymore and we can't even use it for PBOs. */ + if (!(surface->flags & SFLAG_CLIENT)) + { + HeapFree(GetProcessHeap(), 0, surface->resource.heapMemory); + surface->resource.heapMemory = NULL; + } + surface->resource.allocatedMemory = NULL; + surface->flags |= SFLAG_PBO; + LEAVE_GL(); + context_release(context); + } + else if (!(surface->resource.allocatedMemory || surface->flags & SFLAG_PBO)) + { + /* Whatever surface we have, make sure that there is memory allocated + * for the downloaded copy, or a PBO to map. */ + if (!surface->resource.heapMemory) + surface->resource.heapMemory = HeapAlloc(GetProcessHeap(), 0, surface->resource.size + RESOURCE_ALIGNMENT); + + surface->resource.allocatedMemory = (BYTE *)(((ULONG_PTR)surface->resource.heapMemory + + (RESOURCE_ALIGNMENT - 1)) & ~(RESOURCE_ALIGNMENT - 1)); + + if (surface->flags & SFLAG_INSYSMEM) + ERR("Surface without memory or PBO has SFLAG_INSYSMEM set.\n"); + } +} + +static void surface_evict_sysmem(struct wined3d_surface *surface) +{ + if (surface->flags & SFLAG_DONOTFREE) + return; + + HeapFree(GetProcessHeap(), 0, surface->resource.heapMemory); + surface->resource.allocatedMemory = NULL; + surface->resource.heapMemory = NULL; + surface_modify_location(surface, SFLAG_INSYSMEM, FALSE); +} + +/* Context activation is done by the caller. */ +static void surface_bind_and_dirtify(struct wined3d_surface *surface, + const struct wined3d_gl_info *gl_info, BOOL srgb) +{ + struct wined3d_device *device = surface->resource.device; + DWORD active_sampler; + GLint active_texture; + + /* We don't need a specific texture unit, but after binding the texture + * the current unit is dirty. Read the unit back instead of switching to + * 0, this avoids messing around with the state manager's GL states. The + * current texture unit should always be a valid one. + * + * To be more specific, this is tricky because we can implicitly be + * called from sampler() in state.c. This means we can't touch anything + * other than whatever happens to be the currently active texture, or we + * would risk marking already applied sampler states dirty again. + * + * TODO: Track the current active texture per GL context instead of using + * glGet(). */ + + ENTER_GL(); + glGetIntegerv(GL_ACTIVE_TEXTURE, &active_texture); + LEAVE_GL(); + active_sampler = device->rev_tex_unit_map[active_texture - GL_TEXTURE0_ARB]; + + if (active_sampler != WINED3D_UNMAPPED_STAGE) + { + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_SAMPLER(active_sampler)); + } + surface_bind(surface, gl_info, srgb); +} + +static void surface_force_reload(struct wined3d_surface *surface) +{ + surface->flags &= ~(SFLAG_ALLOCATED | SFLAG_SRGBALLOCATED); +} + +static void surface_release_client_storage(struct wined3d_surface *surface) +{ + struct wined3d_context *context = context_acquire(surface->resource.device, NULL); + + ENTER_GL(); + glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE); + if (surface->texture_name) + { + surface_bind_and_dirtify(surface, context->gl_info, FALSE); + glTexImage2D(surface->texture_target, surface->texture_level, + GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL); + } + if (surface->texture_name_srgb) + { + surface_bind_and_dirtify(surface, context->gl_info, TRUE); + glTexImage2D(surface->texture_target, surface->texture_level, + GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL); + } + glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE); + LEAVE_GL(); + + context_release(context); + + surface_modify_location(surface, SFLAG_INSRGBTEX, FALSE); + surface_modify_location(surface, SFLAG_INTEXTURE, FALSE); + surface_force_reload(surface); +} + +static HRESULT surface_private_setup(struct wined3d_surface *surface) +{ + /* TODO: Check against the maximum texture sizes supported by the video card. */ + const struct wined3d_gl_info *gl_info = &surface->resource.device->adapter->gl_info; + unsigned int pow2Width, pow2Height; + + TRACE("surface %p.\n", surface); + + surface->texture_name = 0; + surface->texture_target = GL_TEXTURE_2D; + + /* Non-power2 support */ + if (gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO] || gl_info->supported[WINED3D_GL_NORMALIZED_TEXRECT]) + { + pow2Width = surface->resource.width; + pow2Height = surface->resource.height; + } + else + { + /* Find the nearest pow2 match */ + pow2Width = pow2Height = 1; + while (pow2Width < surface->resource.width) + pow2Width <<= 1; + while (pow2Height < surface->resource.height) + pow2Height <<= 1; + } + surface->pow2Width = pow2Width; + surface->pow2Height = pow2Height; + + if (pow2Width > surface->resource.width || pow2Height > surface->resource.height) + { + /* TODO: Add support for non power two compressed textures. */ + if (surface->resource.format->flags & WINED3DFMT_FLAG_COMPRESSED) + { + FIXME("(%p) Compressed non-power-two textures are not supported w(%d) h(%d)\n", + surface, surface->resource.width, surface->resource.height); + return WINED3DERR_NOTAVAILABLE; + } + } + + if (pow2Width != surface->resource.width + || pow2Height != surface->resource.height) + { + surface->flags |= SFLAG_NONPOW2; + } + + if ((surface->pow2Width > gl_info->limits.texture_size || surface->pow2Height > gl_info->limits.texture_size) + && !(surface->resource.usage & (WINED3DUSAGE_RENDERTARGET | WINED3DUSAGE_DEPTHSTENCIL))) + { + /* One of three options: + * 1: Do the same as we do with NPOT and scale the texture, (any + * texture ops would require the texture to be scaled which is + * potentially slow) + * 2: Set the texture to the maximum size (bad idea). + * 3: WARN and return WINED3DERR_NOTAVAILABLE; + * 4: Create the surface, but allow it to be used only for DirectDraw + * Blts. Some apps (e.g. Swat 3) create textures with a Height of + * 16 and a Width > 3000 and blt 16x16 letter areas from them to + * the render target. */ + if (surface->resource.pool == WINED3DPOOL_DEFAULT || surface->resource.pool == WINED3DPOOL_MANAGED) + { + WARN("Unable to allocate a surface which exceeds the maximum OpenGL texture size.\n"); + return WINED3DERR_NOTAVAILABLE; + } + + /* We should never use this surface in combination with OpenGL! */ + TRACE("Creating an oversized surface: %ux%u.\n", + surface->pow2Width, surface->pow2Height); + } + else + { + /* Don't use ARB_TEXTURE_RECTANGLE in case the surface format is P8 + * and EXT_PALETTED_TEXTURE is used in combination with texture + * uploads (RTL_READTEX/RTL_TEXTEX). The reason is that + * EXT_PALETTED_TEXTURE doesn't work in combination with + * ARB_TEXTURE_RECTANGLE. */ + if (surface->flags & SFLAG_NONPOW2 && gl_info->supported[ARB_TEXTURE_RECTANGLE] + && !(surface->resource.format->id == WINED3DFMT_P8_UINT + && gl_info->supported[EXT_PALETTED_TEXTURE] + && wined3d_settings.rendertargetlock_mode == RTL_READTEX)) + { + surface->texture_target = GL_TEXTURE_RECTANGLE_ARB; + surface->pow2Width = surface->resource.width; + surface->pow2Height = surface->resource.height; + surface->flags &= ~(SFLAG_NONPOW2 | SFLAG_NORMCOORD); + } + } + + switch (wined3d_settings.offscreen_rendering_mode) + { + case ORM_FBO: + surface->get_drawable_size = get_drawable_size_fbo; + break; + + case ORM_BACKBUFFER: + surface->get_drawable_size = get_drawable_size_backbuffer; + break; + + default: + ERR("Unhandled offscreen rendering mode %#x.\n", wined3d_settings.offscreen_rendering_mode); return WINED3DERR_INVALIDCALL; } - hr = resource_init((IWineD3DResource *)surface, WINED3DRTYPE_SURFACE, - device, resource_size, usage, format, pool, parent, parent_ops); - if (FAILED(hr)) + surface->flags |= SFLAG_INSYSMEM; + + return WINED3D_OK; +} + +static void surface_realize_palette(struct wined3d_surface *surface) +{ + struct wined3d_palette *palette = surface->palette; + + TRACE("surface %p.\n", surface); + + if (!palette) return; + + if (surface->resource.format->id == WINED3DFMT_P8_UINT + || surface->resource.format->id == WINED3DFMT_P8_UINT_A8_UNORM) { - WARN("Failed to initialize resource, returning %#x.\n", hr); - return hr; - } + if (surface->resource.usage & WINED3DUSAGE_RENDERTARGET) + { + /* Make sure the texture is up to date. This call doesn't do + * anything if the texture is already up to date. */ + surface_load_location(surface, SFLAG_INTEXTURE, NULL); - /* "Standalone" surface. */ - surface_set_container(surface, WINED3D_CONTAINER_NONE, NULL); - - surface->currentDesc.Width = width; - surface->currentDesc.Height = height; - surface->currentDesc.MultiSampleType = multisample_type; - surface->currentDesc.MultiSampleQuality = multisample_quality; - surface->texture_level = level; - list_init(&surface->overlays); - - /* Flags */ - surface->Flags = SFLAG_NORMCOORD; /* Default to normalized coords. */ - if (discard) surface->Flags |= SFLAG_DISCARD; - if (lockable || format_id == WINED3DFMT_D16_LOCKABLE) surface->Flags |= SFLAG_LOCKABLE; - - /* Quick lockable sanity check. - * TODO: remove this after surfaces, usage and lockability have been debugged properly - * this function is too deep to need to care about things like this. - * Levels need to be checked too, since they all affect what can be done. */ - switch (pool) - { - case WINED3DPOOL_SCRATCH: - if(!lockable) + /* We want to force a palette refresh, so mark the drawable as not being up to date */ + if (!surface_is_offscreen(surface)) + surface_modify_location(surface, SFLAG_INDRAWABLE, FALSE); + } + else + { + if (!(surface->flags & SFLAG_INSYSMEM)) { - FIXME("Called with a pool of SCRATCH and a lockable of FALSE " - "which are mutually exclusive, setting lockable to TRUE.\n"); - lockable = TRUE; + TRACE("Palette changed with surface that does not have an up to date system memory copy.\n"); + surface_load_location(surface, SFLAG_INSYSMEM, NULL); } - break; - - case WINED3DPOOL_SYSTEMMEM: - if (!lockable) - FIXME("Called with a pool of SYSTEMMEM and a lockable of FALSE, this is acceptable but unexpected.\n"); - break; - - case WINED3DPOOL_MANAGED: - if (usage & WINED3DUSAGE_DYNAMIC) - FIXME("Called with a pool of MANAGED and a usage of DYNAMIC which are mutually exclusive.\n"); - break; - - case WINED3DPOOL_DEFAULT: - if (lockable && !(usage & (WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_RENDERTARGET | WINED3DUSAGE_DEPTHSTENCIL))) - WARN("Creating a lockable surface with a POOL of DEFAULT, that doesn't specify DYNAMIC usage.\n"); - break; - - default: - FIXME("Unknown pool %#x.\n", pool); - break; - }; - - if (usage & WINED3DUSAGE_RENDERTARGET && pool != WINED3DPOOL_DEFAULT) - { - FIXME("Trying to create a render target that isn't in the default pool.\n"); + surface_modify_location(surface, SFLAG_INSYSMEM, TRUE); + } } - /* Mark the texture as dirty so that it gets loaded first time around. */ - surface_add_dirty_rect(surface, NULL); - list_init(&surface->renderbuffers); - - TRACE("surface %p, memory %p, size %u\n", surface, surface->resource.allocatedMemory, surface->resource.size); - - /* Call the private setup routine */ - hr = IWineD3DSurface_PrivateSetup((IWineD3DSurface *)surface); - if (FAILED(hr)) + if (surface->flags & SFLAG_DIBSECTION) { - ERR("Private setup failed, returning %#x\n", hr); - cleanup(surface); - return hr; + RGBQUAD col[256]; + unsigned int i; + + TRACE("Updating the DC's palette.\n"); + + for (i = 0; i < 256; ++i) + { + col[i].rgbRed = palette->palents[i].peRed; + col[i].rgbGreen = palette->palents[i].peGreen; + col[i].rgbBlue = palette->palents[i].peBlue; + col[i].rgbReserved = 0; + } + SetDIBColorTable(surface->hDC, 0, 256, col); } + /* Propagate the changes to the drawable when we have a palette. */ + if (surface->resource.usage & WINED3DUSAGE_RENDERTARGET) + surface_load_location(surface, SFLAG_INDRAWABLE, NULL); +} + +static HRESULT surface_draw_overlay(struct wined3d_surface *surface) +{ + HRESULT hr; + + /* If there's no destination surface there is nothing to do. */ + if (!surface->overlay_dest) + return WINED3D_OK; + + /* Blt calls ModifyLocation on the dest surface, which in turn calls + * DrawOverlay to update the overlay. Prevent an endless recursion. */ + if (surface->overlay_dest->flags & SFLAG_INOVERLAYDRAW) + return WINED3D_OK; + + surface->overlay_dest->flags |= SFLAG_INOVERLAYDRAW; + hr = wined3d_surface_blt(surface->overlay_dest, &surface->overlay_destrect, surface, + &surface->overlay_srcrect, WINEDDBLT_WAIT, NULL, WINED3DTEXF_LINEAR); + surface->overlay_dest->flags &= ~SFLAG_INOVERLAYDRAW; + return hr; } -static void surface_force_reload(IWineD3DSurfaceImpl *surface) +static void surface_preload(struct wined3d_surface *surface) { - surface->Flags &= ~(SFLAG_ALLOCATED | SFLAG_SRGBALLOCATED); + TRACE("surface %p.\n", surface); + + surface_internal_preload(surface, SRGB_ANY); } -void surface_set_texture_name(IWineD3DSurfaceImpl *surface, GLuint new_name, BOOL srgb) +static void surface_map(struct wined3d_surface *surface, const RECT *rect, DWORD flags) +{ + struct wined3d_device *device = surface->resource.device; + const RECT *pass_rect = rect; + + TRACE("surface %p, rect %s, flags %#x.\n", + surface, wine_dbgstr_rect(rect), flags); + + if (flags & WINED3DLOCK_DISCARD) + { + TRACE("WINED3DLOCK_DISCARD flag passed, marking SYSMEM as up to date.\n"); + surface_prepare_system_memory(surface); + surface_modify_location(surface, SFLAG_INSYSMEM, TRUE); + } + else + { + /* surface_load_location() does not check if the rectangle specifies + * the full surface. Most callers don't need that, so do it here. */ + if (rect && !rect->top && !rect->left + && rect->right == surface->resource.width + && rect->bottom == surface->resource.height) + pass_rect = NULL; + + if (!(wined3d_settings.rendertargetlock_mode == RTL_DISABLE + && ((surface->container.type == WINED3D_CONTAINER_SWAPCHAIN) + || surface == device->fb.render_targets[0]))) + surface_load_location(surface, SFLAG_INSYSMEM, pass_rect); + } + + if (surface->flags & SFLAG_PBO) + { + const struct wined3d_gl_info *gl_info; + struct wined3d_context *context; + + context = context_acquire(device, NULL); + gl_info = context->gl_info; + + ENTER_GL(); + GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, surface->pbo)); + checkGLcall("glBindBufferARB"); + + /* This shouldn't happen but could occur if some other function + * didn't handle the PBO properly. */ + if (surface->resource.allocatedMemory) + ERR("The surface already has PBO memory allocated.\n"); + + surface->resource.allocatedMemory = GL_EXTCALL(glMapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, GL_READ_WRITE_ARB)); + checkGLcall("glMapBufferARB"); + + /* Make sure the PBO isn't set anymore in order not to break non-PBO + * calls. */ + GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0)); + checkGLcall("glBindBufferARB"); + + LEAVE_GL(); + context_release(context); + } + + if (!(flags & (WINED3DLOCK_NO_DIRTY_UPDATE | WINED3DLOCK_READONLY))) + { + if (!rect) + surface_add_dirty_rect(surface, NULL); + else + { + WINED3DBOX b; + + b.Left = rect->left; + b.Top = rect->top; + b.Right = rect->right; + b.Bottom = rect->bottom; + b.Front = 0; + b.Back = 1; + surface_add_dirty_rect(surface, &b); + } + } +} + +static void surface_unmap(struct wined3d_surface *surface) +{ + struct wined3d_device *device = surface->resource.device; + BOOL fullsurface; + + TRACE("surface %p.\n", surface); + + memset(&surface->lockedRect, 0, sizeof(surface->lockedRect)); + + if (surface->flags & SFLAG_PBO) + { + const struct wined3d_gl_info *gl_info; + struct wined3d_context *context; + + TRACE("Freeing PBO memory.\n"); + + context = context_acquire(device, NULL); + gl_info = context->gl_info; + + ENTER_GL(); + GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, surface->pbo)); + GL_EXTCALL(glUnmapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB)); + GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0)); + checkGLcall("glUnmapBufferARB"); + LEAVE_GL(); + context_release(context); + + surface->resource.allocatedMemory = NULL; + } + + TRACE("dirtyfied %u.\n", surface->flags & (SFLAG_INDRAWABLE | SFLAG_INTEXTURE) ? 0 : 1); + + if (surface->flags & (SFLAG_INDRAWABLE | SFLAG_INTEXTURE)) + { + TRACE("Not dirtified, nothing to do.\n"); + goto done; + } + + if (surface->container.type == WINED3D_CONTAINER_SWAPCHAIN + || (device->fb.render_targets && surface == device->fb.render_targets[0])) + { + if (wined3d_settings.rendertargetlock_mode == RTL_DISABLE) + { + static BOOL warned = FALSE; + if (!warned) + { + ERR("The application tries to write to the render target, but render target locking is disabled.\n"); + warned = TRUE; + } + goto done; + } + + if (!surface->dirtyRect.left && !surface->dirtyRect.top + && surface->dirtyRect.right == surface->resource.width + && surface->dirtyRect.bottom == surface->resource.height) + { + fullsurface = TRUE; + } + else + { + /* TODO: Proper partial rectangle tracking. */ + fullsurface = FALSE; + surface->flags |= SFLAG_INSYSMEM; + } + + surface_load_location(surface, SFLAG_INDRAWABLE, fullsurface ? NULL : &surface->dirtyRect); + + /* Partial rectangle tracking is not commonly implemented, it is only + * done for render targets. INSYSMEM was set before to tell + * surface_load_location() where to read the rectangle from. + * Indrawable is set because all modifications from the partial + * sysmem copy are written back to the drawable, thus the surface is + * merged again in the drawable. The sysmem copy is not fully up to + * date because only a subrectangle was read in Map(). */ + if (!fullsurface) + { + surface_modify_location(surface, SFLAG_INDRAWABLE, TRUE); + surface_evict_sysmem(surface); + } + + surface->dirtyRect.left = surface->resource.width; + surface->dirtyRect.top = surface->resource.height; + surface->dirtyRect.right = 0; + surface->dirtyRect.bottom = 0; + } + else if (surface->resource.format->flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL)) + { + FIXME("Depth / stencil buffer locking is not implemented.\n"); + } + +done: + /* Overlays have to be redrawn manually after changes with the GL implementation */ + if (surface->overlay_dest) + surface->surface_ops->surface_draw_overlay(surface); +} + +static HRESULT surface_getdc(struct wined3d_surface *surface) +{ + WINED3DLOCKED_RECT lock; + HRESULT hr; + + TRACE("surface %p.\n", surface); + + /* Create a DIB section if there isn't a dc yet. */ + if (!surface->hDC) + { + if (surface->flags & SFLAG_CLIENT) + { + surface_load_location(surface, SFLAG_INSYSMEM, NULL); + surface_release_client_storage(surface); + } + hr = surface_create_dib_section(surface); + if (FAILED(hr)) + return WINED3DERR_INVALIDCALL; + + /* Use the DIB section from now on if we are not using a PBO. */ + if (!(surface->flags & SFLAG_PBO)) + surface->resource.allocatedMemory = surface->dib.bitmap_data; + } + + /* Map the surface. */ + hr = wined3d_surface_map(surface, &lock, NULL, 0); + if (FAILED(hr)) + ERR("Map failed, hr %#x.\n", hr); + + /* Sync the DIB with the PBO. This can't be done earlier because Map() + * activates the allocatedMemory. */ + if (surface->flags & SFLAG_PBO) + memcpy(surface->dib.bitmap_data, surface->resource.allocatedMemory, surface->dib.bitmap_size); + + return hr; +} + +static HRESULT surface_flip(struct wined3d_surface *surface, struct wined3d_surface *override) +{ + TRACE("surface %p, override %p.\n", surface, override); + + /* Flipping is only supported on render targets and overlays. */ + if (!(surface->resource.usage & (WINED3DUSAGE_RENDERTARGET | WINED3DUSAGE_OVERLAY))) + { + WARN("Tried to flip a non-render target, non-overlay surface.\n"); + return WINEDDERR_NOTFLIPPABLE; + } + + if (surface->resource.usage & WINED3DUSAGE_OVERLAY) + { + flip_surface(surface, override); + + /* Update the overlay if it is visible */ + if (surface->overlay_dest) + return surface->surface_ops->surface_draw_overlay(surface); + else + return WINED3D_OK; + } + + return WINED3D_OK; +} + +static BOOL surface_is_full_rect(struct wined3d_surface *surface, const RECT *r) +{ + if ((r->left && r->right) || abs(r->right - r->left) != surface->resource.width) + return FALSE; + if ((r->top && r->bottom) || abs(r->bottom - r->top) != surface->resource.height) + return FALSE; + return TRUE; +} + +static void wined3d_surface_depth_blt_fbo(struct wined3d_device *device, struct wined3d_surface *src_surface, + const RECT *src_rect, struct wined3d_surface *dst_surface, const RECT *dst_rect) +{ + const struct wined3d_gl_info *gl_info; + struct wined3d_context *context; + DWORD src_mask, dst_mask; + GLbitfield gl_mask; + + TRACE("device %p, src_surface %p, src_rect %s, dst_surface %p, dst_rect %s.\n", + device, src_surface, wine_dbgstr_rect(src_rect), + dst_surface, wine_dbgstr_rect(dst_rect)); + + src_mask = src_surface->resource.format->flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL); + dst_mask = dst_surface->resource.format->flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL); + + if (src_mask != dst_mask) + { + ERR("Incompatible formats %s and %s.\n", + debug_d3dformat(src_surface->resource.format->id), + debug_d3dformat(dst_surface->resource.format->id)); + return; + } + + if (!src_mask) + { + ERR("Not a depth / stencil format: %s.\n", + debug_d3dformat(src_surface->resource.format->id)); + return; + } + + gl_mask = 0; + if (src_mask & WINED3DFMT_FLAG_DEPTH) + gl_mask |= GL_DEPTH_BUFFER_BIT; + if (src_mask & WINED3DFMT_FLAG_STENCIL) + gl_mask |= GL_STENCIL_BUFFER_BIT; + + /* Make sure the locations are up-to-date. Loading the destination + * surface isn't required if the entire surface is overwritten. */ + surface_load_location(src_surface, SFLAG_INTEXTURE, NULL); + if (!surface_is_full_rect(dst_surface, dst_rect)) + surface_load_location(dst_surface, SFLAG_INTEXTURE, NULL); + + context = context_acquire(device, NULL); + if (!context->valid) + { + context_release(context); + WARN("Invalid context, skipping blit.\n"); + return; + } + + gl_info = context->gl_info; + + ENTER_GL(); + + context_apply_fbo_state_blit(context, GL_READ_FRAMEBUFFER, NULL, src_surface, SFLAG_INTEXTURE); + glReadBuffer(GL_NONE); + checkGLcall("glReadBuffer()"); + context_check_fbo_status(context, GL_READ_FRAMEBUFFER); + + context_apply_fbo_state_blit(context, GL_DRAW_FRAMEBUFFER, NULL, dst_surface, SFLAG_INTEXTURE); + context_set_draw_buffer(context, GL_NONE); + context_check_fbo_status(context, GL_DRAW_FRAMEBUFFER); + + if (gl_mask & GL_DEPTH_BUFFER_BIT) + { + glDepthMask(GL_TRUE); + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_RENDER(WINED3DRS_ZWRITEENABLE)); + } + if (gl_mask & GL_STENCIL_BUFFER_BIT) + { + if (context->gl_info->supported[EXT_STENCIL_TWO_SIDE]) + { + glDisable(GL_STENCIL_TEST_TWO_SIDE_EXT); + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_RENDER(WINED3DRS_TWOSIDEDSTENCILMODE)); + } + glStencilMask(~0U); + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_RENDER(WINED3DRS_STENCILWRITEMASK)); + } + + glDisable(GL_SCISSOR_TEST); + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_RENDER(WINED3DRS_SCISSORTESTENABLE)); + + gl_info->fbo_ops.glBlitFramebuffer(src_rect->left, src_rect->top, src_rect->right, src_rect->bottom, + dst_rect->left, dst_rect->top, dst_rect->right, dst_rect->bottom, gl_mask, GL_NEAREST); + checkGLcall("glBlitFramebuffer()"); + + LEAVE_GL(); + + if (wined3d_settings.strict_draw_ordering) + wglFlush(); /* Flush to ensure ordering across contexts. */ + + context_release(context); +} + +static BOOL fbo_blit_supported(const struct wined3d_gl_info *gl_info, enum wined3d_blit_op blit_op, + const RECT *src_rect, DWORD src_usage, WINED3DPOOL src_pool, const struct wined3d_format *src_format, + const RECT *dst_rect, DWORD dst_usage, WINED3DPOOL dst_pool, const struct wined3d_format *dst_format) +{ + if ((wined3d_settings.offscreen_rendering_mode != ORM_FBO) || !gl_info->fbo_ops.glBlitFramebuffer) + return FALSE; + + /* Source and/or destination need to be on the GL side */ + if (src_pool == WINED3DPOOL_SYSTEMMEM || dst_pool == WINED3DPOOL_SYSTEMMEM) + return FALSE; + + switch (blit_op) + { + case WINED3D_BLIT_OP_COLOR_BLIT: + if (!((src_format->flags & WINED3DFMT_FLAG_FBO_ATTACHABLE) || (src_usage & WINED3DUSAGE_RENDERTARGET))) + return FALSE; + if (!((dst_format->flags & WINED3DFMT_FLAG_FBO_ATTACHABLE) || (dst_usage & WINED3DUSAGE_RENDERTARGET))) + return FALSE; + break; + + case WINED3D_BLIT_OP_DEPTH_BLIT: + if (!(src_format->flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL))) + return FALSE; + if (!(dst_format->flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL))) + return FALSE; + break; + + default: + return FALSE; + } + + if (!(src_format->id == dst_format->id + || (is_identity_fixup(src_format->color_fixup) + && is_identity_fixup(dst_format->color_fixup)))) + return FALSE; + + return TRUE; +} + +static BOOL surface_convert_depth_to_float(struct wined3d_surface *surface, DWORD depth, float *float_depth) +{ + const struct wined3d_format *format = surface->resource.format; + + switch (format->id) + { + case WINED3DFMT_S1_UINT_D15_UNORM: + *float_depth = depth / (float)0x00007fff; + break; + + case WINED3DFMT_D16_UNORM: + *float_depth = depth / (float)0x0000ffff; + break; + + case WINED3DFMT_D24_UNORM_S8_UINT: + case WINED3DFMT_X8D24_UNORM: + *float_depth = depth / (float)0x00ffffff; + break; + + case WINED3DFMT_D32_UNORM: + *float_depth = depth / (float)0xffffffff; + break; + + default: + ERR("Unhandled conversion from %s to floating point.\n", debug_d3dformat(format->id)); + return FALSE; + } + + return TRUE; +} + +/* Do not call while under the GL lock. */ +static HRESULT wined3d_surface_depth_fill(struct wined3d_surface *surface, const RECT *rect, float depth) +{ + const struct wined3d_resource *resource = &surface->resource; + struct wined3d_device *device = resource->device; + const struct blit_shader *blitter; + + blitter = wined3d_select_blitter(&device->adapter->gl_info, WINED3D_BLIT_OP_DEPTH_FILL, + NULL, 0, 0, NULL, rect, resource->usage, resource->pool, resource->format); + if (!blitter) + { + FIXME("No blitter is capable of performing the requested depth fill operation.\n"); + return WINED3DERR_INVALIDCALL; + } + + return blitter->depth_fill(device, surface, rect, depth); +} + +static HRESULT wined3d_surface_depth_blt(struct wined3d_surface *src_surface, const RECT *src_rect, + struct wined3d_surface *dst_surface, const RECT *dst_rect) +{ + struct wined3d_device *device = src_surface->resource.device; + + if (!fbo_blit_supported(&device->adapter->gl_info, WINED3D_BLIT_OP_DEPTH_BLIT, + src_rect, src_surface->resource.usage, src_surface->resource.pool, src_surface->resource.format, + dst_rect, dst_surface->resource.usage, dst_surface->resource.pool, dst_surface->resource.format)) + return WINED3DERR_INVALIDCALL; + + wined3d_surface_depth_blt_fbo(device, src_surface, src_rect, dst_surface, dst_rect); + + surface_modify_ds_location(dst_surface, SFLAG_DS_OFFSCREEN, + dst_surface->ds_current_size.cx, dst_surface->ds_current_size.cy); + surface_modify_location(dst_surface, SFLAG_INDRAWABLE, TRUE); + + return WINED3D_OK; +} + +/* Do not call while under the GL lock. */ +static HRESULT surface_blt(struct wined3d_surface *dst_surface, const RECT *dst_rect_in, + struct wined3d_surface *src_surface, const RECT *src_rect_in, DWORD flags, + const WINEDDBLTFX *fx, WINED3DTEXTUREFILTERTYPE filter) +{ + struct wined3d_device *device = dst_surface->resource.device; + DWORD src_ds_flags, dst_ds_flags; + + TRACE("dst_surface %p, dst_rect %s, src_surface %p, src_rect %s, flags %#x, fx %p, filter %s.\n", + dst_surface, wine_dbgstr_rect(dst_rect_in), src_surface, wine_dbgstr_rect(src_rect_in), + flags, fx, debug_d3dtexturefiltertype(filter)); + TRACE("Usage is %s.\n", debug_d3dusage(dst_surface->resource.usage)); + + if ((dst_surface->flags & SFLAG_LOCKED) || (src_surface && (src_surface->flags & SFLAG_LOCKED))) + { + WARN(" Surface is busy, returning DDERR_SURFACEBUSY\n"); + return WINEDDERR_SURFACEBUSY; + } + + dst_ds_flags = dst_surface->resource.format->flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL); + if (src_surface) + src_ds_flags = src_surface->resource.format->flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL); + else + src_ds_flags = 0; + + if (src_ds_flags || dst_ds_flags) + { + if (flags & WINEDDBLT_DEPTHFILL) + { + float depth; + RECT rect; + + TRACE("Depth fill.\n"); + + surface_get_rect(dst_surface, dst_rect_in, &rect); + + if (!surface_convert_depth_to_float(dst_surface, fx->u5.dwFillDepth, &depth)) + return WINED3DERR_INVALIDCALL; + + if (SUCCEEDED(wined3d_surface_depth_fill(dst_surface, &rect, depth))) + return WINED3D_OK; + } + else + { + RECT src_rect, dst_rect; + + /* Accessing depth / stencil surfaces is supposed to fail while in + * a scene, except for fills, which seem to work. */ + if (device->inScene) + { + WARN("Rejecting depth / stencil access while in scene.\n"); + return WINED3DERR_INVALIDCALL; + } + + if (src_ds_flags != dst_ds_flags) + { + WARN("Rejecting depth / stencil blit between incompatible formats.\n"); + return WINED3DERR_INVALIDCALL; + } + + if (src_rect_in && (src_rect_in->top || src_rect_in->left + || src_rect_in->bottom != src_surface->resource.height + || src_rect_in->right != src_surface->resource.width)) + { + WARN("Rejecting depth / stencil blit with invalid source rect %s.\n", + wine_dbgstr_rect(src_rect_in)); + return WINED3DERR_INVALIDCALL; + } + + if (dst_rect_in && (dst_rect_in->top || dst_rect_in->left + || dst_rect_in->bottom != dst_surface->resource.height + || dst_rect_in->right != dst_surface->resource.width)) + { + WARN("Rejecting depth / stencil blit with invalid destination rect %s.\n", + wine_dbgstr_rect(src_rect_in)); + return WINED3DERR_INVALIDCALL; + } + + if (src_surface->resource.height != dst_surface->resource.height + || src_surface->resource.width != dst_surface->resource.width) + { + WARN("Rejecting depth / stencil blit with mismatched surface sizes.\n"); + return WINED3DERR_INVALIDCALL; + } + + surface_get_rect(src_surface, src_rect_in, &src_rect); + surface_get_rect(dst_surface, dst_rect_in, &dst_rect); + + if (SUCCEEDED(wined3d_surface_depth_blt(src_surface, &src_rect, dst_surface, &dst_rect))) + return WINED3D_OK; + } + } + + /* Special cases for render targets. */ + if ((dst_surface->resource.usage & WINED3DUSAGE_RENDERTARGET) + || (src_surface && (src_surface->resource.usage & WINED3DUSAGE_RENDERTARGET))) + { + if (SUCCEEDED(IWineD3DSurfaceImpl_BltOverride(dst_surface, dst_rect_in, + src_surface, src_rect_in, flags, fx, filter))) + return WINED3D_OK; + } + + /* For the rest call the X11 surface implementation. For render targets + * this should be implemented OpenGL accelerated in BltOverride, other + * blits are rather rare. */ + return surface_cpu_blt(dst_surface, dst_rect_in, src_surface, src_rect_in, flags, fx, filter); +} + +/* Do not call while under the GL lock. */ +static HRESULT surface_bltfast(struct wined3d_surface *dst_surface, DWORD dst_x, DWORD dst_y, + struct wined3d_surface *src_surface, const RECT *src_rect_in, DWORD trans) +{ + struct wined3d_device *device = dst_surface->resource.device; + + TRACE("dst_surface %p, dst_x %u, dst_y %u, src_surface %p, src_rect %s, flags %#x.\n", + dst_surface, dst_x, dst_y, src_surface, wine_dbgstr_rect(src_rect_in), trans); + + if ((dst_surface->flags & SFLAG_LOCKED) || (src_surface->flags & SFLAG_LOCKED)) + { + WARN("Surface is busy, returning WINEDDERR_SURFACEBUSY.\n"); + return WINEDDERR_SURFACEBUSY; + } + + if (device->inScene && (dst_surface == device->fb.depth_stencil || src_surface == device->fb.depth_stencil)) + { + WARN("Attempt to access the depth / stencil surface while in a scene.\n"); + return WINED3DERR_INVALIDCALL; + } + + /* Special cases for RenderTargets */ + if ((dst_surface->resource.usage & WINED3DUSAGE_RENDERTARGET) + || (src_surface->resource.usage & WINED3DUSAGE_RENDERTARGET)) + { + + RECT src_rect, dst_rect; + DWORD flags = 0; + + surface_get_rect(src_surface, src_rect_in, &src_rect); + + dst_rect.left = dst_x; + dst_rect.top = dst_y; + dst_rect.right = dst_x + src_rect.right - src_rect.left; + dst_rect.bottom = dst_y + src_rect.bottom - src_rect.top; + + /* Convert BltFast flags into Blt ones because BltOverride is called + * from Blt as well. */ + if (trans & WINEDDBLTFAST_SRCCOLORKEY) + flags |= WINEDDBLT_KEYSRC; + if (trans & WINEDDBLTFAST_DESTCOLORKEY) + flags |= WINEDDBLT_KEYDEST; + if (trans & WINEDDBLTFAST_WAIT) + flags |= WINEDDBLT_WAIT; + if (trans & WINEDDBLTFAST_DONOTWAIT) + flags |= WINEDDBLT_DONOTWAIT; + + if (SUCCEEDED(IWineD3DSurfaceImpl_BltOverride(dst_surface, + &dst_rect, src_surface, &src_rect, flags, NULL, WINED3DTEXF_POINT))) + return WINED3D_OK; + } + + return surface_cpu_bltfast(dst_surface, dst_x, dst_y, src_surface, src_rect_in, trans); +} + +static HRESULT surface_set_mem(struct wined3d_surface *surface, void *mem) +{ + TRACE("surface %p, mem %p.\n", surface, mem); + + if (mem && mem != surface->resource.allocatedMemory) + { + void *release = NULL; + + /* Do I have to copy the old surface content? */ + if (surface->flags & SFLAG_DIBSECTION) + { + SelectObject(surface->hDC, surface->dib.holdbitmap); + DeleteDC(surface->hDC); + /* Release the DIB section. */ + DeleteObject(surface->dib.DIBsection); + surface->dib.bitmap_data = NULL; + surface->resource.allocatedMemory = NULL; + surface->hDC = NULL; + surface->flags &= ~SFLAG_DIBSECTION; + } + else if (!(surface->flags & SFLAG_USERPTR)) + { + release = surface->resource.heapMemory; + surface->resource.heapMemory = NULL; + } + surface->resource.allocatedMemory = mem; + surface->flags |= SFLAG_USERPTR; + + /* Now the surface memory is most up do date. Invalidate drawable and texture. */ + surface_modify_location(surface, SFLAG_INSYSMEM, TRUE); + + /* For client textures OpenGL has to be notified. */ + if (surface->flags & SFLAG_CLIENT) + surface_release_client_storage(surface); + + /* Now free the old memory if any. */ + HeapFree(GetProcessHeap(), 0, release); + } + else if (surface->flags & SFLAG_USERPTR) + { + /* Map and GetDC will re-create the dib section and allocated memory. */ + surface->resource.allocatedMemory = NULL; + /* HeapMemory should be NULL already. */ + if (surface->resource.heapMemory) + ERR("User pointer surface has heap memory allocated.\n"); + surface->flags &= ~(SFLAG_USERPTR | SFLAG_INSYSMEM); + + if (surface->flags & SFLAG_CLIENT) + surface_release_client_storage(surface); + + surface_prepare_system_memory(surface); + surface_modify_location(surface, SFLAG_INSYSMEM, TRUE); + } + + return WINED3D_OK; +} + +/* Context activation is done by the caller. */ +static void surface_remove_pbo(struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info) +{ + if (!surface->resource.heapMemory) + { + surface->resource.heapMemory = HeapAlloc(GetProcessHeap(), 0, surface->resource.size + RESOURCE_ALIGNMENT); + surface->resource.allocatedMemory = (BYTE *)(((ULONG_PTR)surface->resource.heapMemory + + (RESOURCE_ALIGNMENT - 1)) & ~(RESOURCE_ALIGNMENT - 1)); + } + + ENTER_GL(); + GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, surface->pbo)); + checkGLcall("glBindBufferARB(GL_PIXEL_UNPACK_BUFFER, surface->pbo)"); + GL_EXTCALL(glGetBufferSubDataARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0, + surface->resource.size, surface->resource.allocatedMemory)); + checkGLcall("glGetBufferSubDataARB"); + GL_EXTCALL(glDeleteBuffersARB(1, &surface->pbo)); + checkGLcall("glDeleteBuffersARB"); + LEAVE_GL(); + + surface->pbo = 0; + surface->flags &= ~SFLAG_PBO; +} + +/* Do not call while under the GL lock. */ +static void surface_unload(struct wined3d_resource *resource) +{ + struct wined3d_surface *surface = surface_from_resource(resource); + struct wined3d_renderbuffer_entry *entry, *entry2; + struct wined3d_device *device = resource->device; + const struct wined3d_gl_info *gl_info; + struct wined3d_context *context; + + TRACE("surface %p.\n", surface); + + if (resource->pool == WINED3DPOOL_DEFAULT) + { + /* Default pool resources are supposed to be destroyed before Reset is called. + * Implicit resources stay however. So this means we have an implicit render target + * or depth stencil. The content may be destroyed, but we still have to tear down + * opengl resources, so we cannot leave early. + * + * Put the surfaces into sysmem, and reset the content. The D3D content is undefined, + * but we can't set the sysmem INDRAWABLE because when we're rendering the swapchain + * or the depth stencil into an FBO the texture or render buffer will be removed + * and all flags get lost + */ + surface_init_sysmem(surface); + } + else + { + /* Load the surface into system memory */ + surface_load_location(surface, SFLAG_INSYSMEM, NULL); + surface_modify_location(surface, SFLAG_INDRAWABLE, FALSE); + } + surface_modify_location(surface, SFLAG_INTEXTURE, FALSE); + surface_modify_location(surface, SFLAG_INSRGBTEX, FALSE); + surface->flags &= ~(SFLAG_ALLOCATED | SFLAG_SRGBALLOCATED); + + context = context_acquire(device, NULL); + gl_info = context->gl_info; + + /* Destroy PBOs, but load them into real sysmem before */ + if (surface->flags & SFLAG_PBO) + surface_remove_pbo(surface, gl_info); + + /* Destroy fbo render buffers. This is needed for implicit render targets, for + * all application-created targets the application has to release the surface + * before calling _Reset + */ + LIST_FOR_EACH_ENTRY_SAFE(entry, entry2, &surface->renderbuffers, struct wined3d_renderbuffer_entry, entry) + { + ENTER_GL(); + gl_info->fbo_ops.glDeleteRenderbuffers(1, &entry->id); + LEAVE_GL(); + list_remove(&entry->entry); + HeapFree(GetProcessHeap(), 0, entry); + } + list_init(&surface->renderbuffers); + surface->current_renderbuffer = NULL; + + /* If we're in a texture, the texture name belongs to the texture. + * Otherwise, destroy it. */ + if (surface->container.type != WINED3D_CONTAINER_TEXTURE) + { + ENTER_GL(); + glDeleteTextures(1, &surface->texture_name); + surface->texture_name = 0; + glDeleteTextures(1, &surface->texture_name_srgb); + surface->texture_name_srgb = 0; + LEAVE_GL(); + } + + context_release(context); + + resource_unload(resource); +} + +static const struct wined3d_resource_ops surface_resource_ops = +{ + surface_unload, +}; + +static const struct wined3d_surface_ops surface_ops = +{ + surface_private_setup, + surface_cleanup, + surface_realize_palette, + surface_draw_overlay, + surface_preload, + surface_map, + surface_unmap, + surface_getdc, + surface_flip, + surface_blt, + surface_bltfast, + surface_set_mem, +}; + +/***************************************************************************** + * Initializes the GDI surface, aka creates the DIB section we render to + * The DIB section creation is done by calling GetDC, which will create the + * section and releasing the dc to allow the app to use it. The dib section + * will stay until the surface is released + * + * GDI surfaces do not need to be a power of 2 in size, so the pow2 sizes + * are set to the real sizes to save memory. The NONPOW2 flag is unset to + * avoid confusion in the shared surface code. + * + * Returns: + * WINED3D_OK on success + * The return values of called methods on failure + * + *****************************************************************************/ +static HRESULT gdi_surface_private_setup(struct wined3d_surface *surface) +{ + HRESULT hr; + + TRACE("surface %p.\n", surface); + + if (surface->resource.usage & WINED3DUSAGE_OVERLAY) + { + ERR("Overlays not yet supported by GDI surfaces.\n"); + return WINED3DERR_INVALIDCALL; + } + + /* Sysmem textures have memory already allocated - release it, + * this avoids an unnecessary memcpy. */ + hr = surface_create_dib_section(surface); + if (SUCCEEDED(hr)) + { + HeapFree(GetProcessHeap(), 0, surface->resource.heapMemory); + surface->resource.heapMemory = NULL; + surface->resource.allocatedMemory = surface->dib.bitmap_data; + } + + /* We don't mind the nonpow2 stuff in GDI. */ + surface->pow2Width = surface->resource.width; + surface->pow2Height = surface->resource.height; + + return WINED3D_OK; +} + +static void surface_gdi_cleanup(struct wined3d_surface *surface) +{ + TRACE("surface %p.\n", surface); + + if (surface->flags & SFLAG_DIBSECTION) + { + /* Release the DC. */ + SelectObject(surface->hDC, surface->dib.holdbitmap); + DeleteDC(surface->hDC); + /* Release the DIB section. */ + DeleteObject(surface->dib.DIBsection); + surface->dib.bitmap_data = NULL; + surface->resource.allocatedMemory = NULL; + } + + if (surface->flags & SFLAG_USERPTR) + wined3d_surface_set_mem(surface, NULL); + if (surface->overlay_dest) + list_remove(&surface->overlay_entry); + + HeapFree(GetProcessHeap(), 0, surface->palette9); + + resource_cleanup(&surface->resource); +} + +static void gdi_surface_realize_palette(struct wined3d_surface *surface) +{ + struct wined3d_palette *palette = surface->palette; + + TRACE("surface %p.\n", surface); + + if (!palette) return; + + if (surface->flags & SFLAG_DIBSECTION) + { + RGBQUAD col[256]; + unsigned int i; + + TRACE("Updating the DC's palette.\n"); + + for (i = 0; i < 256; ++i) + { + col[i].rgbRed = palette->palents[i].peRed; + col[i].rgbGreen = palette->palents[i].peGreen; + col[i].rgbBlue = palette->palents[i].peBlue; + col[i].rgbReserved = 0; + } + SetDIBColorTable(surface->hDC, 0, 256, col); + } + + /* Update the image because of the palette change. Some games like e.g. + * Red Alert call SetEntries a lot to implement fading. */ + /* Tell the swapchain to update the screen. */ + if (surface->container.type == WINED3D_CONTAINER_SWAPCHAIN) + { + struct wined3d_swapchain *swapchain = surface->container.u.swapchain; + if (surface == swapchain->front_buffer) + { + x11_copy_to_screen(swapchain, NULL); + } + } +} + +static HRESULT gdi_surface_draw_overlay(struct wined3d_surface *surface) +{ + FIXME("GDI surfaces can't draw overlays yet.\n"); + return E_FAIL; +} + +static void gdi_surface_preload(struct wined3d_surface *surface) +{ + TRACE("surface %p.\n", surface); + + ERR("Preloading GDI surfaces is not supported.\n"); +} + +static void gdi_surface_map(struct wined3d_surface *surface, const RECT *rect, DWORD flags) +{ + TRACE("surface %p, rect %s, flags %#x.\n", + surface, wine_dbgstr_rect(rect), flags); + + if (!surface->resource.allocatedMemory) + { + /* This happens on gdi surfaces if the application set a user pointer + * and resets it. Recreate the DIB section. */ + surface_create_dib_section(surface); + surface->resource.allocatedMemory = surface->dib.bitmap_data; + } +} + +static void gdi_surface_unmap(struct wined3d_surface *surface) +{ + TRACE("surface %p.\n", surface); + + /* Tell the swapchain to update the screen. */ + if (surface->container.type == WINED3D_CONTAINER_SWAPCHAIN) + { + struct wined3d_swapchain *swapchain = surface->container.u.swapchain; + if (surface == swapchain->front_buffer) + { + x11_copy_to_screen(swapchain, &surface->lockedRect); + } + } + + memset(&surface->lockedRect, 0, sizeof(RECT)); +} + +static HRESULT gdi_surface_getdc(struct wined3d_surface *surface) +{ + WINED3DLOCKED_RECT lock; + HRESULT hr; + + TRACE("surface %p.\n", surface); + + /* Should have a DIB section already. */ + if (!(surface->flags & SFLAG_DIBSECTION)) + { + WARN("DC not supported on this surface\n"); + return WINED3DERR_INVALIDCALL; + } + + /* Map the surface. */ + hr = wined3d_surface_map(surface, &lock, NULL, 0); + if (FAILED(hr)) + ERR("Map failed, hr %#x.\n", hr); + + return hr; +} + +static HRESULT gdi_surface_flip(struct wined3d_surface *surface, struct wined3d_surface *override) +{ + TRACE("surface %p, override %p.\n", surface, override); + + return WINED3D_OK; +} + +static HRESULT gdi_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst_rect, + struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags, + const WINEDDBLTFX *fx, WINED3DTEXTUREFILTERTYPE filter) +{ + TRACE("dst_surface %p, dst_rect %s, src_surface %p, src_rect %s, flags %#x, fx %p, filter %s.\n", + dst_surface, wine_dbgstr_rect(dst_rect), src_surface, wine_dbgstr_rect(src_rect), + flags, fx, debug_d3dtexturefiltertype(filter)); + + return surface_cpu_blt(dst_surface, dst_rect, src_surface, src_rect, flags, fx, filter); +} + +static HRESULT gdi_surface_bltfast(struct wined3d_surface *dst_surface, DWORD dst_x, DWORD dst_y, + struct wined3d_surface *src_surface, const RECT *src_rect, DWORD trans) +{ + TRACE("dst_surface %p, dst_x %u, dst_y %u, src_surface %p, src_rect %s, flags %#x.\n", + dst_surface, dst_x, dst_y, src_surface, wine_dbgstr_rect(src_rect), trans); + + return surface_cpu_bltfast(dst_surface, dst_x, dst_y, src_surface, src_rect, trans); +} + +static HRESULT gdi_surface_set_mem(struct wined3d_surface *surface, void *mem) +{ + TRACE("surface %p, mem %p.\n", surface, mem); + + /* Render targets depend on their hdc, and we can't create an hdc on a user pointer. */ + if (surface->resource.usage & WINED3DUSAGE_RENDERTARGET) + { + ERR("Not supported on render targets.\n"); + return WINED3DERR_INVALIDCALL; + } + + if (mem && mem != surface->resource.allocatedMemory) + { + void *release = NULL; + + /* Do I have to copy the old surface content? */ + if (surface->flags & SFLAG_DIBSECTION) + { + SelectObject(surface->hDC, surface->dib.holdbitmap); + DeleteDC(surface->hDC); + /* Release the DIB section. */ + DeleteObject(surface->dib.DIBsection); + surface->dib.bitmap_data = NULL; + surface->resource.allocatedMemory = NULL; + surface->hDC = NULL; + surface->flags &= ~SFLAG_DIBSECTION; + } + else if (!(surface->flags & SFLAG_USERPTR)) + { + release = surface->resource.allocatedMemory; + } + surface->resource.allocatedMemory = mem; + surface->flags |= SFLAG_USERPTR | SFLAG_INSYSMEM; + + /* Now free the old memory, if any. */ + HeapFree(GetProcessHeap(), 0, release); + } + else if (surface->flags & SFLAG_USERPTR) + { + /* Map() and GetDC() will re-create the dib section and allocated memory. */ + surface->resource.allocatedMemory = NULL; + surface->flags &= ~SFLAG_USERPTR; + } + + return WINED3D_OK; +} + +static const struct wined3d_surface_ops gdi_surface_ops = +{ + gdi_surface_private_setup, + surface_gdi_cleanup, + gdi_surface_realize_palette, + gdi_surface_draw_overlay, + gdi_surface_preload, + gdi_surface_map, + gdi_surface_unmap, + gdi_surface_getdc, + gdi_surface_flip, + gdi_surface_blt, + gdi_surface_bltfast, + gdi_surface_set_mem, +}; + +void surface_set_texture_name(struct wined3d_surface *surface, GLuint new_name, BOOL srgb) { GLuint *name; DWORD flag; @@ -491,7 +1906,7 @@ void surface_set_texture_name(IWineD3DSurfaceImpl *surface, GLuint new_name, BOO { /* FIXME: We shouldn't need to remove SFLAG_INTEXTURE if the * surface has no texture name yet. See if we can get rid of this. */ - if (surface->Flags & flag) + if (surface->flags & flag) ERR("Surface has %s set, but no texture name.\n", debug_surflocation(flag)); surface_modify_location(surface, flag, FALSE); } @@ -500,7 +1915,7 @@ void surface_set_texture_name(IWineD3DSurfaceImpl *surface, GLuint new_name, BOO surface_force_reload(surface); } -void surface_set_texture_target(IWineD3DSurfaceImpl *surface, GLenum target) +void surface_set_texture_target(struct wined3d_surface *surface, GLenum target) { TRACE("surface %p, target %#x.\n", surface, target); @@ -508,11 +1923,11 @@ void surface_set_texture_target(IWineD3DSurfaceImpl *surface, GLenum target) { if (target == GL_TEXTURE_RECTANGLE_ARB) { - surface->Flags &= ~SFLAG_NORMCOORD; + surface->flags &= ~SFLAG_NORMCOORD; } else if (surface->texture_target == GL_TEXTURE_RECTANGLE_ARB) { - surface->Flags |= SFLAG_NORMCOORD; + surface->flags |= SFLAG_NORMCOORD; } } surface->texture_target = target; @@ -520,39 +1935,62 @@ void surface_set_texture_target(IWineD3DSurfaceImpl *surface, GLenum target) } /* Context activation is done by the caller. */ -static void surface_bind_and_dirtify(IWineD3DSurfaceImpl *This, BOOL srgb) { - DWORD active_sampler; +void surface_bind(struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info, BOOL srgb) +{ + TRACE("surface %p, gl_info %p, srgb %#x.\n", surface, gl_info, srgb); - /* We don't need a specific texture unit, but after binding the texture the current unit is dirty. - * Read the unit back instead of switching to 0, this avoids messing around with the state manager's - * gl states. The current texture unit should always be a valid one. - * - * To be more specific, this is tricky because we can implicitly be called - * from sampler() in state.c. This means we can't touch anything other than - * whatever happens to be the currently active texture, or we would risk - * marking already applied sampler states dirty again. - * - * TODO: Track the current active texture per GL context instead of using glGet - */ - GLint active_texture; - ENTER_GL(); - glGetIntegerv(GL_ACTIVE_TEXTURE, &active_texture); - LEAVE_GL(); - active_sampler = This->resource.device->rev_tex_unit_map[active_texture - GL_TEXTURE0_ARB]; - - if (active_sampler != WINED3D_UNMAPPED_STAGE) + if (surface->container.type == WINED3D_CONTAINER_TEXTURE) { - IWineD3DDeviceImpl_MarkStateDirty(This->resource.device, STATE_SAMPLER(active_sampler)); + struct wined3d_texture *texture = surface->container.u.texture; + + TRACE("Passing to container (%p).\n", texture); + texture->texture_ops->texture_bind(texture, gl_info, srgb); + } + else + { + if (surface->texture_level) + { + ERR("Standalone surface %p is non-zero texture level %u.\n", + surface, surface->texture_level); + } + + if (srgb) + ERR("Trying to bind standalone surface %p as sRGB.\n", surface); + + ENTER_GL(); + + if (!surface->texture_name) + { + glGenTextures(1, &surface->texture_name); + checkGLcall("glGenTextures"); + + TRACE("Surface %p given name %u.\n", surface, surface->texture_name); + + glBindTexture(surface->texture_target, surface->texture_name); + checkGLcall("glBindTexture"); + glTexParameteri(surface->texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(surface->texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glTexParameteri(surface->texture_target, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE); + glTexParameteri(surface->texture_target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(surface->texture_target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + checkGLcall("glTexParameteri"); + } + else + { + glBindTexture(surface->texture_target, surface->texture_name); + checkGLcall("glBindTexture"); + } + + LEAVE_GL(); } - IWineD3DSurface_BindTexture((IWineD3DSurface *)This, srgb); } /* This function checks if the primary render target uses the 8bit paletted format. */ -static BOOL primary_render_target_is_p8(IWineD3DDeviceImpl *device) +static BOOL primary_render_target_is_p8(struct wined3d_device *device) { - if (device->render_targets && device->render_targets[0]) + if (device->fb.render_targets && device->fb.render_targets[0]) { - IWineD3DSurfaceImpl *render_target = device->render_targets[0]; + struct wined3d_surface *render_target = device->fb.render_targets[0]; if ((render_target->resource.usage & WINED3DUSAGE_RENDERTARGET) && (render_target->resource.format->id == WINED3DFMT_P8_UINT)) return TRUE; @@ -563,12 +2001,12 @@ static BOOL primary_render_target_is_p8(IWineD3DDeviceImpl *device) /* This call just downloads data, the caller is responsible for binding the * correct texture. */ /* Context activation is done by the caller. */ -static void surface_download_data(IWineD3DSurfaceImpl *This, const struct wined3d_gl_info *gl_info) +static void surface_download_data(struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info) { - const struct wined3d_format *format = This->resource.format; + const struct wined3d_format *format = surface->resource.format; - /* Only support read back of converted P8 surfaces */ - if (This->Flags & SFLAG_CONVERTED && format->id != WINED3DFMT_P8_UINT) + /* Only support read back of converted P8 surfaces. */ + if (surface->flags & SFLAG_CONVERTED && format->id != WINED3DFMT_P8_UINT) { FIXME("Readback conversion not supported for format %s.\n", debug_d3dformat(format->id)); return; @@ -576,72 +2014,81 @@ static void surface_download_data(IWineD3DSurfaceImpl *This, const struct wined3 ENTER_GL(); - if (format->Flags & WINED3DFMT_FLAG_COMPRESSED) + if (format->flags & WINED3DFMT_FLAG_COMPRESSED) { TRACE("(%p) : Calling glGetCompressedTexImageARB level %d, format %#x, type %#x, data %p.\n", - This, This->texture_level, format->glFormat, format->glType, - This->resource.allocatedMemory); + surface, surface->texture_level, format->glFormat, format->glType, + surface->resource.allocatedMemory); - if (This->Flags & SFLAG_PBO) + if (surface->flags & SFLAG_PBO) { - GL_EXTCALL(glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, This->pbo)); + GL_EXTCALL(glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, surface->pbo)); checkGLcall("glBindBufferARB"); - GL_EXTCALL(glGetCompressedTexImageARB(This->texture_target, This->texture_level, NULL)); + GL_EXTCALL(glGetCompressedTexImageARB(surface->texture_target, surface->texture_level, NULL)); checkGLcall("glGetCompressedTexImageARB"); GL_EXTCALL(glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, 0)); checkGLcall("glBindBufferARB"); } else { - GL_EXTCALL(glGetCompressedTexImageARB(This->texture_target, - This->texture_level, This->resource.allocatedMemory)); + GL_EXTCALL(glGetCompressedTexImageARB(surface->texture_target, + surface->texture_level, surface->resource.allocatedMemory)); checkGLcall("glGetCompressedTexImageARB"); } LEAVE_GL(); - } else { + } + else + { void *mem; GLenum gl_format = format->glFormat; GLenum gl_type = format->glType; int src_pitch = 0; int dst_pitch = 0; - /* In case of P8 the index is stored in the alpha component if the primary render target uses P8 */ - if (format->id == WINED3DFMT_P8_UINT && primary_render_target_is_p8(This->resource.device)) + /* In case of P8 the index is stored in the alpha component if the primary render target uses P8. */ + if (format->id == WINED3DFMT_P8_UINT && primary_render_target_is_p8(surface->resource.device)) { gl_format = GL_ALPHA; gl_type = GL_UNSIGNED_BYTE; } - if (This->Flags & SFLAG_NONPOW2) { - unsigned char alignment = This->resource.device->surface_alignment; - src_pitch = format->byte_count * This->pow2Width; - dst_pitch = IWineD3DSurface_GetPitch((IWineD3DSurface *) This); + if (surface->flags & SFLAG_NONPOW2) + { + unsigned char alignment = surface->resource.device->surface_alignment; + src_pitch = format->byte_count * surface->pow2Width; + dst_pitch = wined3d_surface_get_pitch(surface); src_pitch = (src_pitch + alignment - 1) & ~(alignment - 1); - mem = HeapAlloc(GetProcessHeap(), 0, src_pitch * This->pow2Height); - } else { - mem = This->resource.allocatedMemory; + mem = HeapAlloc(GetProcessHeap(), 0, src_pitch * surface->pow2Height); + } + else + { + mem = surface->resource.allocatedMemory; } TRACE("(%p) : Calling glGetTexImage level %d, format %#x, type %#x, data %p\n", - This, This->texture_level, gl_format, gl_type, mem); + surface, surface->texture_level, gl_format, gl_type, mem); - if(This->Flags & SFLAG_PBO) { - GL_EXTCALL(glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, This->pbo)); + if (surface->flags & SFLAG_PBO) + { + GL_EXTCALL(glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, surface->pbo)); checkGLcall("glBindBufferARB"); - glGetTexImage(This->texture_target, This->texture_level, gl_format, gl_type, NULL); + glGetTexImage(surface->texture_target, surface->texture_level, gl_format, gl_type, NULL); checkGLcall("glGetTexImage"); GL_EXTCALL(glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, 0)); checkGLcall("glBindBufferARB"); - } else { - glGetTexImage(This->texture_target, This->texture_level, gl_format, gl_type, mem); + } + else + { + glGetTexImage(surface->texture_target, surface->texture_level, gl_format, gl_type, mem); checkGLcall("glGetTexImage"); } LEAVE_GL(); - if (This->Flags & SFLAG_NONPOW2) { + if (surface->flags & SFLAG_NONPOW2) + { const BYTE *src_data; BYTE *dst_data; UINT y; @@ -689,16 +2136,16 @@ static void surface_download_data(IWineD3DSurfaceImpl *This, const struct wined3 * standard texture with a non-power2 width instead of texture boxed up to be a power2 texture. * * internally the texture is still stored in a boxed format so any references to textureName will - * get a boxed texture with width pow2width and not a texture of width currentDesc.Width. + * get a boxed texture with width pow2width and not a texture of width resource.width. * * Performance should not be an issue, because applications normally do not lock the surfaces when * rendering. If an app does, the SFLAG_DYNLOCK flag will kick in and the memory copy won't be released, - * and doesn't have to be re-read. - */ + * and doesn't have to be re-read. */ src_data = mem; - dst_data = This->resource.allocatedMemory; - TRACE("(%p) : Repacking the surface data from pitch %d to pitch %d\n", This, src_pitch, dst_pitch); - for (y = 1 ; y < This->currentDesc.Height; y++) { + dst_data = surface->resource.allocatedMemory; + TRACE("(%p) : Repacking the surface data from pitch %d to pitch %d\n", surface, src_pitch, dst_pitch); + for (y = 1; y < surface->resource.height; ++y) + { /* skip the first row */ src_data += src_pitch; dst_data += dst_pitch; @@ -710,24 +2157,24 @@ static void surface_download_data(IWineD3DSurfaceImpl *This, const struct wined3 } /* Surface has now been downloaded */ - This->Flags |= SFLAG_INSYSMEM; + surface->flags |= SFLAG_INSYSMEM; } /* This call just uploads data, the caller is responsible for binding the * correct texture. */ /* Context activation is done by the caller. */ -static void surface_upload_data(IWineD3DSurfaceImpl *This, const struct wined3d_gl_info *gl_info, +static void surface_upload_data(struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info, const struct wined3d_format *format, BOOL srgb, const GLvoid *data) { - GLsizei width = This->currentDesc.Width; - GLsizei height = This->currentDesc.Height; + GLsizei width = surface->resource.width; + GLsizei height = surface->resource.height; GLenum internal; if (srgb) { internal = format->glGammaInternal; } - else if (This->resource.usage & WINED3DUSAGE_RENDERTARGET && surface_is_offscreen(This)) + else if (surface->resource.usage & WINED3DUSAGE_RENDERTARGET && surface_is_offscreen(surface)) { internal = format->rtInternal; } @@ -736,42 +2183,42 @@ static void surface_upload_data(IWineD3DSurfaceImpl *This, const struct wined3d_ internal = format->glInternal; } - TRACE("This %p, internal %#x, width %d, height %d, format %#x, type %#x, data %p.\n", - This, internal, width, height, format->glFormat, format->glType, data); + TRACE("surface %p, internal %#x, width %d, height %d, format %#x, type %#x, data %p.\n", + surface, internal, width, height, format->glFormat, format->glType, data); TRACE("target %#x, level %u, resource size %u.\n", - This->texture_target, This->texture_level, This->resource.size); + surface->texture_target, surface->texture_level, surface->resource.size); if (format->heightscale != 1.0f && format->heightscale != 0.0f) height *= format->heightscale; ENTER_GL(); - if (This->Flags & SFLAG_PBO) + if (surface->flags & SFLAG_PBO) { - GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, This->pbo)); + GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, surface->pbo)); checkGLcall("glBindBufferARB"); - TRACE("(%p) pbo: %#x, data: %p.\n", This, This->pbo, data); + TRACE("(%p) pbo: %#x, data: %p.\n", surface, surface->pbo, data); data = NULL; } - if (format->Flags & WINED3DFMT_FLAG_COMPRESSED) + if (format->flags & WINED3DFMT_FLAG_COMPRESSED) { TRACE("Calling glCompressedTexSubImage2DARB.\n"); - GL_EXTCALL(glCompressedTexSubImage2DARB(This->texture_target, This->texture_level, - 0, 0, width, height, internal, This->resource.size, data)); + GL_EXTCALL(glCompressedTexSubImage2DARB(surface->texture_target, surface->texture_level, + 0, 0, width, height, internal, surface->resource.size, data)); checkGLcall("glCompressedTexSubImage2DARB"); } else { TRACE("Calling glTexSubImage2D.\n"); - glTexSubImage2D(This->texture_target, This->texture_level, + glTexSubImage2D(surface->texture_target, surface->texture_level, 0, 0, width, height, format->glFormat, format->glType, data); checkGLcall("glTexSubImage2D"); } - if (This->Flags & SFLAG_PBO) + if (surface->flags & SFLAG_PBO) { GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0)); checkGLcall("glBindBufferARB"); @@ -781,12 +2228,12 @@ static void surface_upload_data(IWineD3DSurfaceImpl *This, const struct wined3d_ if (gl_info->quirks & WINED3D_QUIRK_FBO_TEX_UPDATE) { - IWineD3DDeviceImpl *device = This->resource.device; + struct wined3d_device *device = surface->resource.device; unsigned int i; - for (i = 0; i < device->numContexts; ++i) + for (i = 0; i < device->context_count; ++i) { - context_surface_update(device->contexts[i], This); + context_surface_update(device->contexts[i], surface); } } } @@ -794,12 +2241,12 @@ static void surface_upload_data(IWineD3DSurfaceImpl *This, const struct wined3d_ /* This call just allocates the texture, the caller is responsible for binding * the correct texture. */ /* Context activation is done by the caller. */ -static void surface_allocate_surface(IWineD3DSurfaceImpl *This, const struct wined3d_gl_info *gl_info, +static void surface_allocate_surface(struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info, const struct wined3d_format *format, BOOL srgb) { BOOL enable_client_storage = FALSE; - GLsizei width = This->pow2Width; - GLsizei height = This->pow2Height; + GLsizei width = surface->pow2Width; + GLsizei height = surface->pow2Height; const BYTE *mem = NULL; GLenum internal; @@ -807,7 +2254,7 @@ static void surface_allocate_surface(IWineD3DSurfaceImpl *This, const struct win { internal = format->glGammaInternal; } - else if (This->resource.usage & WINED3DUSAGE_RENDERTARGET && surface_is_offscreen(This)) + else if (surface->resource.usage & WINED3DUSAGE_RENDERTARGET && surface_is_offscreen(surface)) { internal = format->rtInternal; } @@ -819,15 +2266,15 @@ static void surface_allocate_surface(IWineD3DSurfaceImpl *This, const struct win if (format->heightscale != 1.0f && format->heightscale != 0.0f) height *= format->heightscale; TRACE("(%p) : Creating surface (target %#x) level %d, d3d format %s, internal format %#x, width %d, height %d, gl format %#x, gl type=%#x\n", - This, This->texture_target, This->texture_level, debug_d3dformat(format->id), + surface, surface->texture_target, surface->texture_level, debug_d3dformat(format->id), internal, width, height, format->glFormat, format->glType); ENTER_GL(); if (gl_info->supported[APPLE_CLIENT_STORAGE]) { - if (This->Flags & (SFLAG_NONPOW2 | SFLAG_DIBSECTION | SFLAG_CONVERTED) - || !This->resource.allocatedMemory) + if (surface->flags & (SFLAG_NONPOW2 | SFLAG_DIBSECTION | SFLAG_CONVERTED) + || !surface->resource.allocatedMemory) { /* In some cases we want to disable client storage. * SFLAG_NONPOW2 has a bigger opengl texture than the client memory, and different pitches @@ -837,27 +2284,30 @@ static void surface_allocate_surface(IWineD3DSurfaceImpl *This, const struct win */ glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE); checkGLcall("glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE)"); - This->Flags &= ~SFLAG_CLIENT; + surface->flags &= ~SFLAG_CLIENT; enable_client_storage = TRUE; - } else { - This->Flags |= SFLAG_CLIENT; + } + else + { + surface->flags |= SFLAG_CLIENT; - /* Point opengl to our allocated texture memory. Do not use resource.allocatedMemory here because - * it might point into a pbo. Instead use heapMemory, but get the alignment right. - */ - mem = (BYTE *)(((ULONG_PTR) This->resource.heapMemory + (RESOURCE_ALIGNMENT - 1)) & ~(RESOURCE_ALIGNMENT - 1)); + /* Point OpenGL to our allocated texture memory. Do not use + * resource.allocatedMemory here because it might point into a + * PBO. Instead use heapMemory, but get the alignment right. */ + mem = (BYTE *)(((ULONG_PTR)surface->resource.heapMemory + + (RESOURCE_ALIGNMENT - 1)) & ~(RESOURCE_ALIGNMENT - 1)); } } - if (format->Flags & WINED3DFMT_FLAG_COMPRESSED && mem) + if (format->flags & WINED3DFMT_FLAG_COMPRESSED && mem) { - GL_EXTCALL(glCompressedTexImage2DARB(This->texture_target, This->texture_level, - internal, width, height, 0, This->resource.size, mem)); + GL_EXTCALL(glCompressedTexImage2DARB(surface->texture_target, surface->texture_level, + internal, width, height, 0, surface->resource.size, mem)); checkGLcall("glCompressedTexImage2DARB"); } else { - glTexImage2D(This->texture_target, This->texture_level, + glTexImage2D(surface->texture_target, surface->texture_level, internal, width, height, 0, format->glFormat, format->glType, mem); checkGLcall("glTexImage2D"); } @@ -873,12 +2323,24 @@ static void surface_allocate_surface(IWineD3DSurfaceImpl *This, const struct win * render target dimensions. With FBOs, the dimensions have to be an exact match. */ /* TODO: We should synchronize the renderbuffer's content with the texture's content. */ /* GL locking is done by the caller */ -void surface_set_compatible_renderbuffer(IWineD3DSurfaceImpl *surface, unsigned int width, unsigned int height) +void surface_set_compatible_renderbuffer(struct wined3d_surface *surface, struct wined3d_surface *rt) { const struct wined3d_gl_info *gl_info = &surface->resource.device->adapter->gl_info; - renderbuffer_entry_t *entry; + struct wined3d_renderbuffer_entry *entry; GLuint renderbuffer = 0; unsigned int src_width, src_height; + unsigned int width, height; + + if (rt && rt->resource.format->id != WINED3DFMT_NULL) + { + width = rt->pow2Width; + height = rt->pow2Height; + } + else + { + width = surface->pow2Width; + height = surface->pow2Height; + } src_width = surface->pow2Width; src_height = surface->pow2Height; @@ -895,7 +2357,7 @@ void surface_set_compatible_renderbuffer(IWineD3DSurfaceImpl *surface, unsigned } /* Look if we've already got a renderbuffer of the correct dimensions */ - LIST_FOR_EACH_ENTRY(entry, &surface->renderbuffers, renderbuffer_entry_t, entry) + LIST_FOR_EACH_ENTRY(entry, &surface->renderbuffers, struct wined3d_renderbuffer_entry, entry) { if (entry->width == width && entry->height == height) { @@ -912,7 +2374,7 @@ void surface_set_compatible_renderbuffer(IWineD3DSurfaceImpl *surface, unsigned gl_info->fbo_ops.glRenderbufferStorage(GL_RENDERBUFFER, surface->resource.format->glInternal, width, height); - entry = HeapAlloc(GetProcessHeap(), 0, sizeof(renderbuffer_entry_t)); + entry = HeapAlloc(GetProcessHeap(), 0, sizeof(*entry)); entry->width = width; entry->height = height; entry->id = renderbuffer; @@ -924,9 +2386,9 @@ void surface_set_compatible_renderbuffer(IWineD3DSurfaceImpl *surface, unsigned checkGLcall("set_compatible_renderbuffer"); } -GLenum surface_get_gl_buffer(IWineD3DSurfaceImpl *surface) +GLenum surface_get_gl_buffer(struct wined3d_surface *surface) { - IWineD3DSwapChainImpl *swapchain = surface->container.u.swapchain; + struct wined3d_swapchain *swapchain = surface->container.u.swapchain; TRACE("surface %p.\n", surface); @@ -957,42 +2419,43 @@ GLenum surface_get_gl_buffer(IWineD3DSurfaceImpl *surface) } /* Slightly inefficient way to handle multiple dirty rects but it works :) */ -void surface_add_dirty_rect(IWineD3DSurfaceImpl *surface, const RECT *dirty_rect) +void surface_add_dirty_rect(struct wined3d_surface *surface, const WINED3DBOX *dirty_rect) { - TRACE("surface %p, dirty_rect %s.\n", surface, wine_dbgstr_rect(dirty_rect)); + TRACE("surface %p, dirty_rect %p.\n", surface, dirty_rect); - if (!(surface->Flags & SFLAG_INSYSMEM) && (surface->Flags & SFLAG_INTEXTURE)) + if (!(surface->flags & SFLAG_INSYSMEM) && (surface->flags & SFLAG_INTEXTURE)) /* No partial locking for textures yet. */ surface_load_location(surface, SFLAG_INSYSMEM, NULL); surface_modify_location(surface, SFLAG_INSYSMEM, TRUE); if (dirty_rect) { - surface->dirtyRect.left = min(surface->dirtyRect.left, dirty_rect->left); - surface->dirtyRect.top = min(surface->dirtyRect.top, dirty_rect->top); - surface->dirtyRect.right = max(surface->dirtyRect.right, dirty_rect->right); - surface->dirtyRect.bottom = max(surface->dirtyRect.bottom, dirty_rect->bottom); + surface->dirtyRect.left = min(surface->dirtyRect.left, dirty_rect->Left); + surface->dirtyRect.top = min(surface->dirtyRect.top, dirty_rect->Top); + surface->dirtyRect.right = max(surface->dirtyRect.right, dirty_rect->Right); + surface->dirtyRect.bottom = max(surface->dirtyRect.bottom, dirty_rect->Bottom); } else { surface->dirtyRect.left = 0; surface->dirtyRect.top = 0; - surface->dirtyRect.right = surface->currentDesc.Width; - surface->dirtyRect.bottom = surface->currentDesc.Height; + surface->dirtyRect.right = surface->resource.width; + surface->dirtyRect.bottom = surface->resource.height; } - /* if the container is a basetexture then mark it dirty. */ + /* if the container is a texture then mark it dirty. */ if (surface->container.type == WINED3D_CONTAINER_TEXTURE) { TRACE("Passing to container.\n"); - IWineD3DBaseTexture_SetDirty((IWineD3DBaseTexture *)surface->container.u.texture, TRUE); + wined3d_texture_set_dirty(surface->container.u.texture, TRUE); } } -static BOOL surface_convert_color_to_float(IWineD3DSurfaceImpl *surface, DWORD color, WINED3DCOLORVALUE *float_color) +static BOOL surface_convert_color_to_float(struct wined3d_surface *surface, + DWORD color, WINED3DCOLORVALUE *float_color) { const struct wined3d_format *format = surface->resource.format; - IWineD3DDeviceImpl *device = surface->resource.device; + struct wined3d_device *device = surface->resource.device; switch (format->id) { @@ -1042,42 +2505,1145 @@ static BOOL surface_convert_color_to_float(IWineD3DSurfaceImpl *surface, DWORD c return TRUE; } -/* Do not call while under the GL lock. */ -static ULONG WINAPI IWineD3DSurfaceImpl_Release(IWineD3DSurface *iface) +HRESULT surface_load(struct wined3d_surface *surface, BOOL srgb) { - IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface; - ULONG ref = InterlockedDecrement(&This->resource.ref); - TRACE("(%p) : Releasing from %d\n", This, ref + 1); + DWORD flag = srgb ? SFLAG_INSRGBTEX : SFLAG_INTEXTURE; - if (!ref) + TRACE("surface %p, srgb %#x.\n", surface, srgb); + + if (surface->resource.pool == WINED3DPOOL_SCRATCH) { - surface_cleanup(This); - This->resource.parent_ops->wined3d_object_destroyed(This->resource.parent); - - TRACE("(%p) Released.\n", This); - HeapFree(GetProcessHeap(), 0, This); + ERR("Not supported on scratch surfaces.\n"); + return WINED3DERR_INVALIDCALL; } - return ref; + if (!(surface->flags & flag)) + { + TRACE("Reloading because surface is dirty\n"); + } + /* Reload if either the texture and sysmem have different ideas about the + * color key, or the actual key values changed. */ + else if (!(surface->flags & SFLAG_GLCKEY) != !(surface->CKeyFlags & WINEDDSD_CKSRCBLT) + || ((surface->CKeyFlags & WINEDDSD_CKSRCBLT) + && (surface->glCKey.dwColorSpaceLowValue != surface->SrcBltCKey.dwColorSpaceLowValue + || surface->glCKey.dwColorSpaceHighValue != surface->SrcBltCKey.dwColorSpaceHighValue))) + { + TRACE("Reloading because of color keying\n"); + /* To perform the color key conversion we need a sysmem copy of + * the surface. Make sure we have it. */ + + surface_load_location(surface, SFLAG_INSYSMEM, NULL); + /* Make sure the texture is reloaded because of the color key change, + * this kills performance though :( */ + /* TODO: This is not necessarily needed with hw palettized texture support. */ + surface_modify_location(surface, SFLAG_INSYSMEM, TRUE); + } + else + { + TRACE("surface is already in texture\n"); + return WINED3D_OK; + } + + /* No partial locking for textures yet. */ + surface_load_location(surface, flag, NULL); + surface_evict_sysmem(surface); + + return WINED3D_OK; } -/* **************************************************** - IWineD3DSurface IWineD3DResource parts follow - **************************************************** */ +/* See also float_16_to_32() in wined3d_private.h */ +static inline unsigned short float_32_to_16(const float *in) +{ + int exp = 0; + float tmp = fabsf(*in); + unsigned int mantissa; + unsigned short ret; + + /* Deal with special numbers */ + if (*in == 0.0f) + return 0x0000; + if (isnan(*in)) + return 0x7c01; + if (isinf(*in)) + return (*in < 0.0f ? 0xfc00 : 0x7c00); + + if (tmp < powf(2, 10)) + { + do + { + tmp = tmp * 2.0f; + exp--; + } while (tmp < powf(2, 10)); + } + else if (tmp >= powf(2, 11)) + { + do + { + tmp /= 2.0f; + exp++; + } while (tmp >= powf(2, 11)); + } + + mantissa = (unsigned int)tmp; + if (tmp - mantissa >= 0.5f) + ++mantissa; /* Round to nearest, away from zero. */ + + exp += 10; /* Normalize the mantissa. */ + exp += 15; /* Exponent is encoded with excess 15. */ + + if (exp > 30) /* too big */ + { + ret = 0x7c00; /* INF */ + } + else if (exp <= 0) + { + /* exp == 0: Non-normalized mantissa. Returns 0x0000 (=0.0) for too small numbers. */ + while (exp <= 0) + { + mantissa = mantissa >> 1; + ++exp; + } + ret = mantissa & 0x3ff; + } + else + { + ret = (exp << 10) | (mantissa & 0x3ff); + } + + ret |= ((*in < 0.0f ? 1 : 0) << 15); /* Add the sign */ + return ret; +} + +ULONG CDECL wined3d_surface_incref(struct wined3d_surface *surface) +{ + ULONG refcount; + + TRACE("Surface %p, container %p of type %#x.\n", + surface, surface->container.u.base, surface->container.type); + + switch (surface->container.type) + { + case WINED3D_CONTAINER_TEXTURE: + return wined3d_texture_incref(surface->container.u.texture); + + case WINED3D_CONTAINER_SWAPCHAIN: + return wined3d_swapchain_incref(surface->container.u.swapchain); + + default: + ERR("Unhandled container type %#x.\n", surface->container.type); + case WINED3D_CONTAINER_NONE: + break; + } + + refcount = InterlockedIncrement(&surface->resource.ref); + TRACE("%p increasing refcount to %u.\n", surface, refcount); + + return refcount; +} /* Do not call while under the GL lock. */ -void surface_internal_preload(IWineD3DSurfaceImpl *surface, enum WINED3DSRGB srgb) +ULONG CDECL wined3d_surface_decref(struct wined3d_surface *surface) { - IWineD3DDeviceImpl *device = surface->resource.device; + ULONG refcount; + + TRACE("Surface %p, container %p of type %#x.\n", + surface, surface->container.u.base, surface->container.type); + + switch (surface->container.type) + { + case WINED3D_CONTAINER_TEXTURE: + return wined3d_texture_decref(surface->container.u.texture); + + case WINED3D_CONTAINER_SWAPCHAIN: + return wined3d_swapchain_decref(surface->container.u.swapchain); + + default: + ERR("Unhandled container type %#x.\n", surface->container.type); + case WINED3D_CONTAINER_NONE: + break; + } + + refcount = InterlockedDecrement(&surface->resource.ref); + TRACE("%p decreasing refcount to %u.\n", surface, refcount); + + if (!refcount) + { + surface->surface_ops->surface_cleanup(surface); + surface->resource.parent_ops->wined3d_object_destroyed(surface->resource.parent); + + TRACE("Destroyed surface %p.\n", surface); + HeapFree(GetProcessHeap(), 0, surface); + } + + return refcount; +} + +HRESULT CDECL wined3d_surface_set_private_data(struct wined3d_surface *surface, + REFGUID riid, const void *data, DWORD data_size, DWORD flags) +{ + return resource_set_private_data(&surface->resource, riid, data, data_size, flags); +} + +HRESULT CDECL wined3d_surface_get_private_data(const struct wined3d_surface *surface, + REFGUID guid, void *data, DWORD *data_size) +{ + return resource_get_private_data(&surface->resource, guid, data, data_size); +} + +HRESULT CDECL wined3d_surface_free_private_data(struct wined3d_surface *surface, REFGUID refguid) +{ + return resource_free_private_data(&surface->resource, refguid); +} + +DWORD CDECL wined3d_surface_set_priority(struct wined3d_surface *surface, DWORD priority) +{ + return resource_set_priority(&surface->resource, priority); +} + +DWORD CDECL wined3d_surface_get_priority(const struct wined3d_surface *surface) +{ + return resource_get_priority(&surface->resource); +} + +void CDECL wined3d_surface_preload(struct wined3d_surface *surface) +{ + TRACE("surface %p.\n", surface); + + surface->surface_ops->surface_preload(surface); +} + +void * CDECL wined3d_surface_get_parent(const struct wined3d_surface *surface) +{ + TRACE("surface %p.\n", surface); + + return surface->resource.parent; +} + +struct wined3d_resource * CDECL wined3d_surface_get_resource(struct wined3d_surface *surface) +{ + TRACE("surface %p.\n", surface); + + return &surface->resource; +} + +HRESULT CDECL wined3d_surface_get_blt_status(const struct wined3d_surface *surface, DWORD flags) +{ + TRACE("surface %p, flags %#x.\n", surface, flags); + + switch (flags) + { + case WINEDDGBS_CANBLT: + case WINEDDGBS_ISBLTDONE: + return WINED3D_OK; + + default: + return WINED3DERR_INVALIDCALL; + } +} + +HRESULT CDECL wined3d_surface_get_flip_status(const struct wined3d_surface *surface, DWORD flags) +{ + TRACE("surface %p, flags %#x.\n", surface, flags); + + /* XXX: DDERR_INVALIDSURFACETYPE */ + + switch (flags) + { + case WINEDDGFS_CANFLIP: + case WINEDDGFS_ISFLIPDONE: + return WINED3D_OK; + + default: + return WINED3DERR_INVALIDCALL; + } +} + +HRESULT CDECL wined3d_surface_is_lost(const struct wined3d_surface *surface) +{ + TRACE("surface %p.\n", surface); + + /* D3D8 and 9 loose full devices, ddraw only surfaces. */ + return surface->flags & SFLAG_LOST ? WINED3DERR_DEVICELOST : WINED3D_OK; +} + +HRESULT CDECL wined3d_surface_restore(struct wined3d_surface *surface) +{ + TRACE("surface %p.\n", surface); + + /* So far we don't lose anything :) */ + surface->flags &= ~SFLAG_LOST; + return WINED3D_OK; +} + +HRESULT CDECL wined3d_surface_set_palette(struct wined3d_surface *surface, struct wined3d_palette *palette) +{ + TRACE("surface %p, palette %p.\n", surface, palette); + + if (surface->palette == palette) + { + TRACE("Nop palette change.\n"); + return WINED3D_OK; + } + + if (surface->palette && (surface->resource.usage & WINED3DUSAGE_RENDERTARGET)) + surface->palette->flags &= ~WINEDDPCAPS_PRIMARYSURFACE; + + surface->palette = palette; + + if (palette) + { + if (surface->resource.usage & WINED3DUSAGE_RENDERTARGET) + palette->flags |= WINEDDPCAPS_PRIMARYSURFACE; + + surface->surface_ops->surface_realize_palette(surface); + } + + return WINED3D_OK; +} + +HRESULT CDECL wined3d_surface_set_color_key(struct wined3d_surface *surface, + DWORD flags, const WINEDDCOLORKEY *color_key) +{ + TRACE("surface %p, flags %#x, color_key %p.\n", surface, flags, color_key); + + if (flags & WINEDDCKEY_COLORSPACE) + { + FIXME(" colorkey value not supported (%08x) !\n", flags); + return WINED3DERR_INVALIDCALL; + } + + /* Dirtify the surface, but only if a key was changed. */ + if (color_key) + { + switch (flags & ~WINEDDCKEY_COLORSPACE) + { + case WINEDDCKEY_DESTBLT: + surface->DestBltCKey = *color_key; + surface->CKeyFlags |= WINEDDSD_CKDESTBLT; + break; + + case WINEDDCKEY_DESTOVERLAY: + surface->DestOverlayCKey = *color_key; + surface->CKeyFlags |= WINEDDSD_CKDESTOVERLAY; + break; + + case WINEDDCKEY_SRCOVERLAY: + surface->SrcOverlayCKey = *color_key; + surface->CKeyFlags |= WINEDDSD_CKSRCOVERLAY; + break; + + case WINEDDCKEY_SRCBLT: + surface->SrcBltCKey = *color_key; + surface->CKeyFlags |= WINEDDSD_CKSRCBLT; + break; + } + } + else + { + switch (flags & ~WINEDDCKEY_COLORSPACE) + { + case WINEDDCKEY_DESTBLT: + surface->CKeyFlags &= ~WINEDDSD_CKDESTBLT; + break; + + case WINEDDCKEY_DESTOVERLAY: + surface->CKeyFlags &= ~WINEDDSD_CKDESTOVERLAY; + break; + + case WINEDDCKEY_SRCOVERLAY: + surface->CKeyFlags &= ~WINEDDSD_CKSRCOVERLAY; + break; + + case WINEDDCKEY_SRCBLT: + surface->CKeyFlags &= ~WINEDDSD_CKSRCBLT; + break; + } + } + + return WINED3D_OK; +} + +struct wined3d_palette * CDECL wined3d_surface_get_palette(const struct wined3d_surface *surface) +{ + TRACE("surface %p.\n", surface); + + return surface->palette; +} + +DWORD CDECL wined3d_surface_get_pitch(const struct wined3d_surface *surface) +{ + const struct wined3d_format *format = surface->resource.format; + DWORD pitch; + + TRACE("surface %p.\n", surface); + + if ((format->flags & (WINED3DFMT_FLAG_COMPRESSED | WINED3DFMT_FLAG_BROKEN_PITCH)) == WINED3DFMT_FLAG_COMPRESSED) + { + /* Since compressed formats are block based, pitch means the amount of + * bytes to the next row of block rather than the next row of pixels. */ + UINT row_block_count = (surface->resource.width + format->block_width - 1) / format->block_width; + pitch = row_block_count * format->block_byte_count; + } + else + { + unsigned char alignment = surface->resource.device->surface_alignment; + pitch = surface->resource.format->byte_count * surface->resource.width; /* Bytes / row */ + pitch = (pitch + alignment - 1) & ~(alignment - 1); + } + + TRACE("Returning %u.\n", pitch); + + return pitch; +} + +HRESULT CDECL wined3d_surface_set_mem(struct wined3d_surface *surface, void *mem) +{ + TRACE("surface %p, mem %p.\n", surface, mem); + + if (surface->flags & (SFLAG_LOCKED | SFLAG_DCINUSE)) + { + WARN("Surface is locked or the DC is in use.\n"); + return WINED3DERR_INVALIDCALL; + } + + return surface->surface_ops->surface_set_mem(surface, mem); +} + +HRESULT CDECL wined3d_surface_set_overlay_position(struct wined3d_surface *surface, LONG x, LONG y) +{ + LONG w, h; + + TRACE("surface %p, x %d, y %d.\n", surface, x, y); + + if (!(surface->resource.usage & WINED3DUSAGE_OVERLAY)) + { + WARN("Not an overlay surface.\n"); + return WINEDDERR_NOTAOVERLAYSURFACE; + } + + w = surface->overlay_destrect.right - surface->overlay_destrect.left; + h = surface->overlay_destrect.bottom - surface->overlay_destrect.top; + surface->overlay_destrect.left = x; + surface->overlay_destrect.top = y; + surface->overlay_destrect.right = x + w; + surface->overlay_destrect.bottom = y + h; + + surface->surface_ops->surface_draw_overlay(surface); + + return WINED3D_OK; +} + +HRESULT CDECL wined3d_surface_get_overlay_position(const struct wined3d_surface *surface, LONG *x, LONG *y) +{ + TRACE("surface %p, x %p, y %p.\n", surface, x, y); + + if (!(surface->resource.usage & WINED3DUSAGE_OVERLAY)) + { + TRACE("Not an overlay surface.\n"); + return WINEDDERR_NOTAOVERLAYSURFACE; + } + + if (!surface->overlay_dest) + { + TRACE("Overlay not visible.\n"); + *x = 0; + *y = 0; + return WINEDDERR_OVERLAYNOTVISIBLE; + } + + *x = surface->overlay_destrect.left; + *y = surface->overlay_destrect.top; + + TRACE("Returning position %d, %d.\n", *x, *y); + + return WINED3D_OK; +} + +HRESULT CDECL wined3d_surface_update_overlay_z_order(struct wined3d_surface *surface, + DWORD flags, struct wined3d_surface *ref) +{ + FIXME("surface %p, flags %#x, ref %p stub!\n", surface, flags, ref); + + if (!(surface->resource.usage & WINED3DUSAGE_OVERLAY)) + { + TRACE("Not an overlay surface.\n"); + return WINEDDERR_NOTAOVERLAYSURFACE; + } + + return WINED3D_OK; +} + +HRESULT CDECL wined3d_surface_update_overlay(struct wined3d_surface *surface, const RECT *src_rect, + struct wined3d_surface *dst_surface, const RECT *dst_rect, DWORD flags, const WINEDDOVERLAYFX *fx) +{ + TRACE("surface %p, src_rect %s, dst_surface %p, dst_rect %s, flags %#x, fx %p.\n", + surface, wine_dbgstr_rect(src_rect), dst_surface, wine_dbgstr_rect(dst_rect), flags, fx); + + if (!(surface->resource.usage & WINED3DUSAGE_OVERLAY)) + { + WARN("Not an overlay surface.\n"); + return WINEDDERR_NOTAOVERLAYSURFACE; + } + else if (!dst_surface) + { + WARN("Dest surface is NULL.\n"); + return WINED3DERR_INVALIDCALL; + } + + if (src_rect) + { + surface->overlay_srcrect = *src_rect; + } + else + { + surface->overlay_srcrect.left = 0; + surface->overlay_srcrect.top = 0; + surface->overlay_srcrect.right = surface->resource.width; + surface->overlay_srcrect.bottom = surface->resource.height; + } + + if (dst_rect) + { + surface->overlay_destrect = *dst_rect; + } + else + { + surface->overlay_destrect.left = 0; + surface->overlay_destrect.top = 0; + surface->overlay_destrect.right = dst_surface ? dst_surface->resource.width : 0; + surface->overlay_destrect.bottom = dst_surface ? dst_surface->resource.height : 0; + } + + if (surface->overlay_dest && (surface->overlay_dest != dst_surface || flags & WINEDDOVER_HIDE)) + { + list_remove(&surface->overlay_entry); + } + + if (flags & WINEDDOVER_SHOW) + { + if (surface->overlay_dest != dst_surface) + { + surface->overlay_dest = dst_surface; + list_add_tail(&dst_surface->overlays, &surface->overlay_entry); + } + } + else if (flags & WINEDDOVER_HIDE) + { + /* tests show that the rectangles are erased on hide */ + surface->overlay_srcrect.left = 0; surface->overlay_srcrect.top = 0; + surface->overlay_srcrect.right = 0; surface->overlay_srcrect.bottom = 0; + surface->overlay_destrect.left = 0; surface->overlay_destrect.top = 0; + surface->overlay_destrect.right = 0; surface->overlay_destrect.bottom = 0; + surface->overlay_dest = NULL; + } + + surface->surface_ops->surface_draw_overlay(surface); + + return WINED3D_OK; +} + +HRESULT CDECL wined3d_surface_set_clipper(struct wined3d_surface *surface, struct wined3d_clipper *clipper) +{ + TRACE("surface %p, clipper %p.\n", surface, clipper); + + surface->clipper = clipper; + + return WINED3D_OK; +} + +struct wined3d_clipper * CDECL wined3d_surface_get_clipper(const struct wined3d_surface *surface) +{ + TRACE("surface %p.\n", surface); + + return surface->clipper; +} + +HRESULT CDECL wined3d_surface_set_format(struct wined3d_surface *surface, enum wined3d_format_id format_id) +{ + const struct wined3d_format *format = wined3d_get_format(&surface->resource.device->adapter->gl_info, format_id); + + TRACE("surface %p, format %s.\n", surface, debug_d3dformat(format_id)); + + if (surface->resource.format->id != WINED3DFMT_UNKNOWN) + { + FIXME("The format of the surface must be WINED3DFORMAT_UNKNOWN.\n"); + return WINED3DERR_INVALIDCALL; + } + + surface->resource.size = wined3d_format_calculate_size(format, surface->resource.device->surface_alignment, + surface->pow2Width, surface->pow2Height); + surface->flags |= (WINED3DFMT_D16_LOCKABLE == format_id) ? SFLAG_LOCKABLE : 0; + surface->flags &= ~(SFLAG_ALLOCATED | SFLAG_SRGBALLOCATED); + surface->resource.format = format; + + TRACE("size %u, byte_count %u\n", surface->resource.size, format->byte_count); + TRACE("glFormat %#x, glInternal %#x, glType %#x.\n", + format->glFormat, format->glInternal, format->glType); + + return WINED3D_OK; +} + +static void convert_r32_float_r16_float(const BYTE *src, BYTE *dst, + DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h) +{ + unsigned short *dst_s; + const float *src_f; + unsigned int x, y; + + TRACE("Converting %ux%u pixels, pitches %u %u.\n", w, h, pitch_in, pitch_out); + + for (y = 0; y < h; ++y) + { + src_f = (const float *)(src + y * pitch_in); + dst_s = (unsigned short *) (dst + y * pitch_out); + for (x = 0; x < w; ++x) + { + dst_s[x] = float_32_to_16(src_f + x); + } + } +} + +static void convert_r5g6b5_x8r8g8b8(const BYTE *src, BYTE *dst, + DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h) +{ + static const unsigned char convert_5to8[] = + { + 0x00, 0x08, 0x10, 0x19, 0x21, 0x29, 0x31, 0x3a, + 0x42, 0x4a, 0x52, 0x5a, 0x63, 0x6b, 0x73, 0x7b, + 0x84, 0x8c, 0x94, 0x9c, 0xa5, 0xad, 0xb5, 0xbd, + 0xc5, 0xce, 0xd6, 0xde, 0xe6, 0xef, 0xf7, 0xff, + }; + static const unsigned char convert_6to8[] = + { + 0x00, 0x04, 0x08, 0x0c, 0x10, 0x14, 0x18, 0x1c, + 0x20, 0x24, 0x28, 0x2d, 0x31, 0x35, 0x39, 0x3d, + 0x41, 0x45, 0x49, 0x4d, 0x51, 0x55, 0x59, 0x5d, + 0x61, 0x65, 0x69, 0x6d, 0x71, 0x75, 0x79, 0x7d, + 0x82, 0x86, 0x8a, 0x8e, 0x92, 0x96, 0x9a, 0x9e, + 0xa2, 0xa6, 0xaa, 0xae, 0xb2, 0xb6, 0xba, 0xbe, + 0xc2, 0xc6, 0xca, 0xce, 0xd2, 0xd7, 0xdb, 0xdf, + 0xe3, 0xe7, 0xeb, 0xef, 0xf3, 0xf7, 0xfb, 0xff, + }; + unsigned int x, y; + + TRACE("Converting %ux%u pixels, pitches %u %u.\n", w, h, pitch_in, pitch_out); + + for (y = 0; y < h; ++y) + { + const WORD *src_line = (const WORD *)(src + y * pitch_in); + DWORD *dst_line = (DWORD *)(dst + y * pitch_out); + for (x = 0; x < w; ++x) + { + WORD pixel = src_line[x]; + dst_line[x] = 0xff000000 + | convert_5to8[(pixel & 0xf800) >> 11] << 16 + | convert_6to8[(pixel & 0x07e0) >> 5] << 8 + | convert_5to8[(pixel & 0x001f)]; + } + } +} + +static void convert_a8r8g8b8_x8r8g8b8(const BYTE *src, BYTE *dst, + DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h) +{ + unsigned int x, y; + + TRACE("Converting %ux%u pixels, pitches %u %u.\n", w, h, pitch_in, pitch_out); + + for (y = 0; y < h; ++y) + { + const DWORD *src_line = (const DWORD *)(src + y * pitch_in); + DWORD *dst_line = (DWORD *)(dst + y * pitch_out); + + for (x = 0; x < w; ++x) + { + dst_line[x] = 0xff000000 | (src_line[x] & 0xffffff); + } + } +} + +static inline BYTE cliptobyte(int x) +{ + return (BYTE)((x < 0) ? 0 : ((x > 255) ? 255 : x)); +} + +static void convert_yuy2_x8r8g8b8(const BYTE *src, BYTE *dst, + DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h) +{ + int c2, d, e, r2 = 0, g2 = 0, b2 = 0; + unsigned int x, y; + + TRACE("Converting %ux%u pixels, pitches %u %u.\n", w, h, pitch_in, pitch_out); + + for (y = 0; y < h; ++y) + { + const BYTE *src_line = src + y * pitch_in; + DWORD *dst_line = (DWORD *)(dst + y * pitch_out); + for (x = 0; x < w; ++x) + { + /* YUV to RGB conversion formulas from http://en.wikipedia.org/wiki/YUV: + * C = Y - 16; D = U - 128; E = V - 128; + * R = cliptobyte((298 * C + 409 * E + 128) >> 8); + * G = cliptobyte((298 * C - 100 * D - 208 * E + 128) >> 8); + * B = cliptobyte((298 * C + 516 * D + 128) >> 8); + * Two adjacent YUY2 pixels are stored as four bytes: Y0 U Y1 V . + * U and V are shared between the pixels. */ + if (!(x & 1)) /* For every even pixel, read new U and V. */ + { + d = (int) src_line[1] - 128; + e = (int) src_line[3] - 128; + r2 = 409 * e + 128; + g2 = - 100 * d - 208 * e + 128; + b2 = 516 * d + 128; + } + c2 = 298 * ((int) src_line[0] - 16); + dst_line[x] = 0xff000000 + | cliptobyte((c2 + r2) >> 8) << 16 /* red */ + | cliptobyte((c2 + g2) >> 8) << 8 /* green */ + | cliptobyte((c2 + b2) >> 8); /* blue */ + /* Scale RGB values to 0..255 range, + * then clip them if still not in range (may be negative), + * then shift them within DWORD if necessary. */ + src_line += 2; + } + } +} + +static void convert_yuy2_r5g6b5(const BYTE *src, BYTE *dst, + DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h) +{ + unsigned int x, y; + int c2, d, e, r2 = 0, g2 = 0, b2 = 0; + + TRACE("Converting %ux%u pixels, pitches %u %u\n", w, h, pitch_in, pitch_out); + + for (y = 0; y < h; ++y) + { + const BYTE *src_line = src + y * pitch_in; + WORD *dst_line = (WORD *)(dst + y * pitch_out); + for (x = 0; x < w; ++x) + { + /* YUV to RGB conversion formulas from http://en.wikipedia.org/wiki/YUV: + * C = Y - 16; D = U - 128; E = V - 128; + * R = cliptobyte((298 * C + 409 * E + 128) >> 8); + * G = cliptobyte((298 * C - 100 * D - 208 * E + 128) >> 8); + * B = cliptobyte((298 * C + 516 * D + 128) >> 8); + * Two adjacent YUY2 pixels are stored as four bytes: Y0 U Y1 V . + * U and V are shared between the pixels. */ + if (!(x & 1)) /* For every even pixel, read new U and V. */ + { + d = (int) src_line[1] - 128; + e = (int) src_line[3] - 128; + r2 = 409 * e + 128; + g2 = - 100 * d - 208 * e + 128; + b2 = 516 * d + 128; + } + c2 = 298 * ((int) src_line[0] - 16); + dst_line[x] = (cliptobyte((c2 + r2) >> 8) >> 3) << 11 /* red */ + | (cliptobyte((c2 + g2) >> 8) >> 2) << 5 /* green */ + | (cliptobyte((c2 + b2) >> 8) >> 3); /* blue */ + /* Scale RGB values to 0..255 range, + * then clip them if still not in range (may be negative), + * then shift them within DWORD if necessary. */ + src_line += 2; + } + } +} + +struct d3dfmt_convertor_desc +{ + enum wined3d_format_id from, to; + void (*convert)(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h); +}; + +static const struct d3dfmt_convertor_desc convertors[] = +{ + {WINED3DFMT_R32_FLOAT, WINED3DFMT_R16_FLOAT, convert_r32_float_r16_float}, + {WINED3DFMT_B5G6R5_UNORM, WINED3DFMT_B8G8R8X8_UNORM, convert_r5g6b5_x8r8g8b8}, + {WINED3DFMT_B8G8R8A8_UNORM, WINED3DFMT_B8G8R8X8_UNORM, convert_a8r8g8b8_x8r8g8b8}, + {WINED3DFMT_YUY2, WINED3DFMT_B8G8R8X8_UNORM, convert_yuy2_x8r8g8b8}, + {WINED3DFMT_YUY2, WINED3DFMT_B5G6R5_UNORM, convert_yuy2_r5g6b5}, +}; + +static inline const struct d3dfmt_convertor_desc *find_convertor(enum wined3d_format_id from, + enum wined3d_format_id to) +{ + unsigned int i; + + for (i = 0; i < (sizeof(convertors) / sizeof(*convertors)); ++i) + { + if (convertors[i].from == from && convertors[i].to == to) + return &convertors[i]; + } + + return NULL; +} + +/***************************************************************************** + * surface_convert_format + * + * Creates a duplicate of a surface in a different format. Is used by Blt to + * blit between surfaces with different formats. + * + * Parameters + * source: Source surface + * fmt: Requested destination format + * + *****************************************************************************/ +static struct wined3d_surface *surface_convert_format(struct wined3d_surface *source, enum wined3d_format_id to_fmt) +{ + const struct d3dfmt_convertor_desc *conv; + WINED3DLOCKED_RECT lock_src, lock_dst; + struct wined3d_surface *ret = NULL; + HRESULT hr; + + conv = find_convertor(source->resource.format->id, to_fmt); + if (!conv) + { + FIXME("Cannot find a conversion function from format %s to %s.\n", + debug_d3dformat(source->resource.format->id), debug_d3dformat(to_fmt)); + return NULL; + } + + wined3d_surface_create(source->resource.device, source->resource.width, + source->resource.height, to_fmt, TRUE /* lockable */, TRUE /* discard */, 0 /* level */, + 0 /* usage */, WINED3DPOOL_SCRATCH, WINED3DMULTISAMPLE_NONE /* TODO: Multisampled conversion */, + 0 /* MultiSampleQuality */, source->surface_type, NULL /* parent */, &wined3d_null_parent_ops, &ret); + if (!ret) + { + ERR("Failed to create a destination surface for conversion.\n"); + return NULL; + } + + memset(&lock_src, 0, sizeof(lock_src)); + memset(&lock_dst, 0, sizeof(lock_dst)); + + hr = wined3d_surface_map(source, &lock_src, NULL, WINED3DLOCK_READONLY); + if (FAILED(hr)) + { + ERR("Failed to lock the source surface.\n"); + wined3d_surface_decref(ret); + return NULL; + } + hr = wined3d_surface_map(ret, &lock_dst, NULL, WINED3DLOCK_READONLY); + if (FAILED(hr)) + { + ERR("Failed to lock the destination surface.\n"); + wined3d_surface_unmap(source); + wined3d_surface_decref(ret); + return NULL; + } + + conv->convert(lock_src.pBits, lock_dst.pBits, lock_src.Pitch, lock_dst.Pitch, + source->resource.width, source->resource.height); + + wined3d_surface_unmap(ret); + wined3d_surface_unmap(source); + + return ret; +} + +static HRESULT _Blt_ColorFill(BYTE *buf, unsigned int width, unsigned int height, + unsigned int bpp, UINT pitch, DWORD color) +{ + BYTE *first; + int x, y; + + /* Do first row */ + +#define COLORFILL_ROW(type) \ +do { \ + type *d = (type *)buf; \ + for (x = 0; x < width; ++x) \ + d[x] = (type)color; \ +} while(0) + + switch (bpp) + { + case 1: + COLORFILL_ROW(BYTE); + break; + + case 2: + COLORFILL_ROW(WORD); + break; + + case 3: + { + BYTE *d = buf; + for (x = 0; x < width; ++x, d += 3) + { + d[0] = (color ) & 0xFF; + d[1] = (color >> 8) & 0xFF; + d[2] = (color >> 16) & 0xFF; + } + break; + } + case 4: + COLORFILL_ROW(DWORD); + break; + + default: + FIXME("Color fill not implemented for bpp %u!\n", bpp * 8); + return WINED3DERR_NOTAVAILABLE; + } + +#undef COLORFILL_ROW + + /* Now copy first row. */ + first = buf; + for (y = 1; y < height; ++y) + { + buf += pitch; + memcpy(buf, first, width * bpp); + } + + return WINED3D_OK; +} + +/* Do not call while under the GL lock. */ +HRESULT CDECL wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst_rect, + struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags, + const WINEDDBLTFX *fx, WINED3DTEXTUREFILTERTYPE filter) +{ + TRACE("dst_surface %p, dst_rect %s, src_surface %p, src_rect %s, flags %#x, fx %p, filter %s.\n", + dst_surface, wine_dbgstr_rect(dst_rect), src_surface, wine_dbgstr_rect(src_rect), + flags, fx, debug_d3dtexturefiltertype(filter)); + + return dst_surface->surface_ops->surface_blt(dst_surface, + dst_rect, src_surface, src_rect, flags, fx, filter); +} + +/* Do not call while under the GL lock. */ +HRESULT CDECL wined3d_surface_bltfast(struct wined3d_surface *dst_surface, DWORD dst_x, DWORD dst_y, + struct wined3d_surface *src_surface, const RECT *src_rect, DWORD trans) +{ + TRACE("dst_surface %p, dst_x %u, dst_y %u, src_surface %p, src_rect %s, trans %#x.\n", + dst_surface, dst_x, dst_y, src_surface, wine_dbgstr_rect(src_rect), trans); + + return dst_surface->surface_ops->surface_bltfast(dst_surface, + dst_x, dst_y, src_surface, src_rect, trans); +} + +HRESULT CDECL wined3d_surface_unmap(struct wined3d_surface *surface) +{ + TRACE("surface %p.\n", surface); + + if (!(surface->flags & SFLAG_LOCKED)) + { + WARN("Trying to unmap unmapped surface.\n"); + return WINEDDERR_NOTLOCKED; + } + surface->flags &= ~SFLAG_LOCKED; + + surface->surface_ops->surface_unmap(surface); + + return WINED3D_OK; +} + +HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface, + WINED3DLOCKED_RECT *locked_rect, const RECT *rect, DWORD flags) +{ + TRACE("surface %p, locked_rect %p, rect %s, flags %#x.\n", + surface, locked_rect, wine_dbgstr_rect(rect), flags); + + if (surface->flags & SFLAG_LOCKED) + { + WARN("Surface is already mapped.\n"); + return WINED3DERR_INVALIDCALL; + } + surface->flags |= SFLAG_LOCKED; + + if (!(surface->flags & SFLAG_LOCKABLE)) + WARN("Trying to lock unlockable surface.\n"); + + surface->surface_ops->surface_map(surface, rect, flags); + + locked_rect->Pitch = wined3d_surface_get_pitch(surface); + + if (!rect) + { + locked_rect->pBits = surface->resource.allocatedMemory; + surface->lockedRect.left = 0; + surface->lockedRect.top = 0; + surface->lockedRect.right = surface->resource.width; + surface->lockedRect.bottom = surface->resource.height; + } + else + { + const struct wined3d_format *format = surface->resource.format; + + if ((format->flags & (WINED3DFMT_FLAG_COMPRESSED | WINED3DFMT_FLAG_BROKEN_PITCH)) == WINED3DFMT_FLAG_COMPRESSED) + { + /* Compressed textures are block based, so calculate the offset of + * the block that contains the top-left pixel of the locked rectangle. */ + locked_rect->pBits = surface->resource.allocatedMemory + + ((rect->top / format->block_height) * locked_rect->Pitch) + + ((rect->left / format->block_width) * format->block_byte_count); + } + else + { + locked_rect->pBits = surface->resource.allocatedMemory + + (locked_rect->Pitch * rect->top) + + (rect->left * format->byte_count); + } + surface->lockedRect.left = rect->left; + surface->lockedRect.top = rect->top; + surface->lockedRect.right = rect->right; + surface->lockedRect.bottom = rect->bottom; + } + + TRACE("Locked rect %s.\n", wine_dbgstr_rect(&surface->lockedRect)); + TRACE("Returning memory %p, pitch %u.\n", locked_rect->pBits, locked_rect->Pitch); + + return WINED3D_OK; +} + +HRESULT CDECL wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc) +{ + HRESULT hr; + + TRACE("surface %p, dc %p.\n", surface, dc); + + if (surface->flags & SFLAG_USERPTR) + { + ERR("Not supported on surfaces with application-provided memory.\n"); + return WINEDDERR_NODC; + } + + /* Give more detailed info for ddraw. */ + if (surface->flags & SFLAG_DCINUSE) + return WINEDDERR_DCALREADYCREATED; + + /* Can't GetDC if the surface is locked. */ + if (surface->flags & SFLAG_LOCKED) + return WINED3DERR_INVALIDCALL; + + hr = surface->surface_ops->surface_getdc(surface); + if (FAILED(hr)) + return hr; + + if (surface->resource.format->id == WINED3DFMT_P8_UINT + || surface->resource.format->id == WINED3DFMT_P8_UINT_A8_UNORM) + { + /* GetDC on palettized formats is unsupported in D3D9, and the method + * is missing in D3D8, so this should only be used for DX <=7 + * surfaces (with non-device palettes). */ + const PALETTEENTRY *pal = NULL; + + if (surface->palette) + { + pal = surface->palette->palents; + } + else + { + struct wined3d_swapchain *swapchain = surface->resource.device->swapchains[0]; + struct wined3d_surface *dds_primary = swapchain->front_buffer; + + if (dds_primary && dds_primary->palette) + pal = dds_primary->palette->palents; + } + + if (pal) + { + RGBQUAD col[256]; + unsigned int i; + + for (i = 0; i < 256; ++i) + { + col[i].rgbRed = pal[i].peRed; + col[i].rgbGreen = pal[i].peGreen; + col[i].rgbBlue = pal[i].peBlue; + col[i].rgbReserved = 0; + } + SetDIBColorTable(surface->hDC, 0, 256, col); + } + } + + surface->flags |= SFLAG_DCINUSE; + + *dc = surface->hDC; + TRACE("Returning dc %p.\n", *dc); + + return WINED3D_OK; +} + +HRESULT CDECL wined3d_surface_releasedc(struct wined3d_surface *surface, HDC dc) +{ + TRACE("surface %p, dc %p.\n", surface, dc); + + if (!(surface->flags & SFLAG_DCINUSE)) + return WINEDDERR_NODC; + + if (surface->hDC != dc) + { + WARN("Application tries to release invalid DC %p, surface DC is %p.\n", + dc, surface->hDC); + return WINEDDERR_NODC; + } + + if ((surface->flags & SFLAG_PBO) && surface->resource.allocatedMemory) + { + /* Copy the contents of the DIB over to the PBO. */ + memcpy(surface->resource.allocatedMemory, surface->dib.bitmap_data, surface->dib.bitmap_size); + } + + /* We locked first, so unlock now. */ + wined3d_surface_unmap(surface); + + surface->flags &= ~SFLAG_DCINUSE; + + return WINED3D_OK; +} + +HRESULT CDECL wined3d_surface_flip(struct wined3d_surface *surface, struct wined3d_surface *override, DWORD flags) +{ + struct wined3d_swapchain *swapchain; + HRESULT hr; + + TRACE("surface %p, override %p, flags %#x.\n", surface, override, flags); + + if (surface->container.type != WINED3D_CONTAINER_SWAPCHAIN) + { + ERR("Flipped surface is not on a swapchain.\n"); + return WINEDDERR_NOTFLIPPABLE; + } + swapchain = surface->container.u.swapchain; + + hr = surface->surface_ops->surface_flip(surface, override); + if (FAILED(hr)) + return hr; + + /* Just overwrite the swapchain presentation interval. This is ok because + * only ddraw apps can call Flip, and only d3d8 and d3d9 applications + * specify the presentation interval. */ + if (!(flags & (WINEDDFLIP_NOVSYNC | WINEDDFLIP_INTERVAL2 | WINEDDFLIP_INTERVAL3 | WINEDDFLIP_INTERVAL4))) + swapchain->presentParms.PresentationInterval = WINED3DPRESENT_INTERVAL_ONE; + else if (flags & WINEDDFLIP_NOVSYNC) + swapchain->presentParms.PresentationInterval = WINED3DPRESENT_INTERVAL_IMMEDIATE; + else if (flags & WINEDDFLIP_INTERVAL2) + swapchain->presentParms.PresentationInterval = WINED3DPRESENT_INTERVAL_TWO; + else if (flags & WINEDDFLIP_INTERVAL3) + swapchain->presentParms.PresentationInterval = WINED3DPRESENT_INTERVAL_THREE; + else + swapchain->presentParms.PresentationInterval = WINED3DPRESENT_INTERVAL_FOUR; + + return wined3d_swapchain_present(swapchain, NULL, NULL, swapchain->win_handle, NULL, 0); +} + +/* Do not call while under the GL lock. */ +void surface_internal_preload(struct wined3d_surface *surface, enum WINED3DSRGB srgb) +{ + struct wined3d_device *device = surface->resource.device; TRACE("iface %p, srgb %#x.\n", surface, srgb); if (surface->container.type == WINED3D_CONTAINER_TEXTURE) { - IWineD3DBaseTextureImpl *texture = surface->container.u.texture; + struct wined3d_texture *texture = surface->container.u.texture; - TRACE("Passing to container.\n"); - texture->baseTexture.internal_preload((IWineD3DBaseTexture *)texture, srgb); + TRACE("Passing to container (%p).\n", texture); + texture->texture_ops->texture_preload(texture, srgb); } else { @@ -1100,7 +3666,7 @@ void surface_internal_preload(IWineD3DSurfaceImpl *surface, enum WINED3DSRGB srg } } - IWineD3DSurface_LoadTexture((IWineD3DSurface *)surface, srgb == SRGB_SRGB ? TRUE : FALSE); + surface_load(surface, srgb == SRGB_SRGB ? TRUE : FALSE); if (surface->resource.pool == WINED3DPOOL_DEFAULT) { @@ -1116,32 +3682,7 @@ void surface_internal_preload(IWineD3DSurfaceImpl *surface, enum WINED3DSRGB srg } } -static void WINAPI IWineD3DSurfaceImpl_PreLoad(IWineD3DSurface *iface) -{ - surface_internal_preload((IWineD3DSurfaceImpl *)iface, SRGB_ANY); -} - -/* Context activation is done by the caller. */ -static void surface_remove_pbo(IWineD3DSurfaceImpl *This, const struct wined3d_gl_info *gl_info) -{ - This->resource.heapMemory = HeapAlloc(GetProcessHeap() ,0 , This->resource.size + RESOURCE_ALIGNMENT); - This->resource.allocatedMemory = - (BYTE *)(((ULONG_PTR) This->resource.heapMemory + (RESOURCE_ALIGNMENT - 1)) & ~(RESOURCE_ALIGNMENT - 1)); - - ENTER_GL(); - GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, This->pbo)); - checkGLcall("glBindBufferARB(GL_PIXEL_UNPACK_BUFFER, This->pbo)"); - GL_EXTCALL(glGetBufferSubDataARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0, This->resource.size, This->resource.allocatedMemory)); - checkGLcall("glGetBufferSubDataARB"); - GL_EXTCALL(glDeleteBuffersARB(1, &This->pbo)); - checkGLcall("glDeleteBuffersARB"); - LEAVE_GL(); - - This->pbo = 0; - This->Flags &= ~SFLAG_PBO; -} - -BOOL surface_init_sysmem(IWineD3DSurfaceImpl *surface) +BOOL surface_init_sysmem(struct wined3d_surface *surface) { if (!surface->resource.allocatedMemory) { @@ -1165,86 +3706,10 @@ BOOL surface_init_sysmem(IWineD3DSurfaceImpl *surface) return TRUE; } -/* Do not call while under the GL lock. */ -static void WINAPI IWineD3DSurfaceImpl_UnLoad(IWineD3DSurface *iface) -{ - IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface; - IWineD3DDeviceImpl *device = This->resource.device; - const struct wined3d_gl_info *gl_info; - renderbuffer_entry_t *entry, *entry2; - struct wined3d_context *context; - - TRACE("(%p)\n", iface); - - if(This->resource.pool == WINED3DPOOL_DEFAULT) { - /* Default pool resources are supposed to be destroyed before Reset is called. - * Implicit resources stay however. So this means we have an implicit render target - * or depth stencil. The content may be destroyed, but we still have to tear down - * opengl resources, so we cannot leave early. - * - * Put the surfaces into sysmem, and reset the content. The D3D content is undefined, - * but we can't set the sysmem INDRAWABLE because when we're rendering the swapchain - * or the depth stencil into an FBO the texture or render buffer will be removed - * and all flags get lost - */ - surface_init_sysmem(This); - } - else - { - /* Load the surface into system memory */ - surface_load_location(This, SFLAG_INSYSMEM, NULL); - surface_modify_location(This, SFLAG_INDRAWABLE, FALSE); - } - surface_modify_location(This, SFLAG_INTEXTURE, FALSE); - surface_modify_location(This, SFLAG_INSRGBTEX, FALSE); - This->Flags &= ~(SFLAG_ALLOCATED | SFLAG_SRGBALLOCATED); - - context = context_acquire(device, NULL); - gl_info = context->gl_info; - - /* Destroy PBOs, but load them into real sysmem before */ - if (This->Flags & SFLAG_PBO) - surface_remove_pbo(This, gl_info); - - /* Destroy fbo render buffers. This is needed for implicit render targets, for - * all application-created targets the application has to release the surface - * before calling _Reset - */ - LIST_FOR_EACH_ENTRY_SAFE(entry, entry2, &This->renderbuffers, renderbuffer_entry_t, entry) { - ENTER_GL(); - gl_info->fbo_ops.glDeleteRenderbuffers(1, &entry->id); - LEAVE_GL(); - list_remove(&entry->entry); - HeapFree(GetProcessHeap(), 0, entry); - } - list_init(&This->renderbuffers); - This->current_renderbuffer = NULL; - - /* If we're in a texture, the texture name belongs to the texture. - * Otherwise, destroy it. */ - if (This->container.type != WINED3D_CONTAINER_TEXTURE) - { - ENTER_GL(); - glDeleteTextures(1, &This->texture_name); - This->texture_name = 0; - glDeleteTextures(1, &This->texture_name_srgb); - This->texture_name_srgb = 0; - LEAVE_GL(); - } - - context_release(context); - - resource_unload((IWineD3DResourceImpl *)This); -} - -/* ****************************************************** - IWineD3DSurface IWineD3DSurface parts follow - ****************************************************** */ - /* Read the framebuffer back into the surface */ -static void read_from_framebuffer(IWineD3DSurfaceImpl *This, const RECT *rect, void *dest, UINT pitch) +static void read_from_framebuffer(struct wined3d_surface *surface, const RECT *rect, void *dest, UINT pitch) { - IWineD3DDeviceImpl *device = This->resource.device; + struct wined3d_device *device = surface->resource.device; const struct wined3d_gl_info *gl_info; struct wined3d_context *context; BYTE *mem; @@ -1268,12 +3733,7 @@ static void read_from_framebuffer(IWineD3DSurfaceImpl *This, const RECT *rect, v return; } - /* Activate the surface. Set it up for blitting now, although not necessarily needed for LockRect. - * Certain graphics drivers seem to dislike some enabled states when reading from opengl, the blitting usage - * should help here. Furthermore unlockrect will need the context set up for blitting. The context manager will find - * context->last_was_blit set on the unlock. - */ - context = context_acquire(device, This); + context = context_acquire(device, surface); context_apply_blit_state(context, device); gl_info = context->gl_info; @@ -1283,37 +3743,39 @@ static void read_from_framebuffer(IWineD3DSurfaceImpl *This, const RECT *rect, v * There is no need to keep track of the current read buffer or reset it, every part of the code * that reads sets the read buffer as desired. */ - if (surface_is_offscreen(This)) + if (surface_is_offscreen(surface)) { - /* Locking the primary render target which is not on a swapchain(=offscreen render target). - * Read from the back buffer - */ - TRACE("Locking offscreen render target\n"); + /* Mapping the primary render target which is not on a swapchain. + * Read from the back buffer. */ + TRACE("Mapping offscreen render target.\n"); glReadBuffer(device->offscreenBuffer); srcIsUpsideDown = TRUE; } else { /* Onscreen surfaces are always part of a swapchain */ - GLenum buffer = surface_get_gl_buffer(This); - TRACE("Locking %#x buffer\n", buffer); + GLenum buffer = surface_get_gl_buffer(surface); + TRACE("Mapping %#x buffer.\n", buffer); glReadBuffer(buffer); checkGLcall("glReadBuffer"); srcIsUpsideDown = FALSE; } /* TODO: Get rid of the extra rectangle comparison and construction of a full surface rectangle */ - if(!rect) { + if (!rect) + { local_rect.left = 0; local_rect.top = 0; - local_rect.right = This->currentDesc.Width; - local_rect.bottom = This->currentDesc.Height; - } else { + local_rect.right = surface->resource.width; + local_rect.bottom = surface->resource.height; + } + else + { local_rect = *rect; } /* TODO: Get rid of the extra GetPitch call, LockRect does that too. Cache the pitch */ - switch (This->resource.format->id) + switch (surface->resource.format->id) { case WINED3DFMT_P8_UINT: { @@ -1323,8 +3785,10 @@ static void read_from_framebuffer(IWineD3DSurfaceImpl *This, const RECT *rect, v fmt = GL_ALPHA; type = GL_UNSIGNED_BYTE; mem = dest; - bpp = This->resource.format->byte_count; - } else { + bpp = surface->resource.format->byte_count; + } + else + { /* GL can't return palettized data, so read ARGB pixels into a * separate block of memory and convert them into palettized format * in software. Slow, but if the app means to use palettized render @@ -1337,26 +3801,28 @@ static void read_from_framebuffer(IWineD3DSurfaceImpl *This, const RECT *rect, v fmt = GL_RGB; type = GL_UNSIGNED_BYTE; pitch *= 3; - mem = HeapAlloc(GetProcessHeap(), 0, This->resource.size * 3); - if(!mem) { + mem = HeapAlloc(GetProcessHeap(), 0, surface->resource.size * 3); + if (!mem) + { ERR("Out of memory\n"); LEAVE_GL(); return; } - bpp = This->resource.format->byte_count * 3; + bpp = surface->resource.format->byte_count * 3; } } break; default: mem = dest; - fmt = This->resource.format->glFormat; - type = This->resource.format->glType; - bpp = This->resource.format->byte_count; + fmt = surface->resource.format->glFormat; + type = surface->resource.format->glType; + bpp = surface->resource.format->byte_count; } - if(This->Flags & SFLAG_PBO) { - GL_EXTCALL(glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, This->pbo)); + if (surface->flags & SFLAG_PBO) + { + GL_EXTCALL(glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, surface->pbo)); checkGLcall("glBindBufferARB"); if (mem) { @@ -1374,17 +3840,17 @@ static void read_from_framebuffer(IWineD3DSurfaceImpl *This, const RECT *rect, v checkGLcall("glGetIntegerv"); /* Setup pixel store pack state -- to glReadPixels into the correct place */ - glPixelStorei(GL_PACK_ROW_LENGTH, This->currentDesc.Width); + glPixelStorei(GL_PACK_ROW_LENGTH, surface->resource.width); checkGLcall("glPixelStorei"); glPixelStorei(GL_PACK_SKIP_PIXELS, local_rect.left); checkGLcall("glPixelStorei"); glPixelStorei(GL_PACK_SKIP_ROWS, local_rect.top); checkGLcall("glPixelStorei"); - glReadPixels(local_rect.left, (!srcIsUpsideDown) ? (This->currentDesc.Height - local_rect.bottom) : local_rect.top , - local_rect.right - local_rect.left, - local_rect.bottom - local_rect.top, - fmt, type, mem); + glReadPixels(local_rect.left, !srcIsUpsideDown ? (surface->resource.height - local_rect.bottom) : local_rect.top, + local_rect.right - local_rect.left, + local_rect.bottom - local_rect.top, + fmt, type, mem); checkGLcall("glReadPixels"); /* Reset previous pixel store pack state */ @@ -1395,7 +3861,8 @@ static void read_from_framebuffer(IWineD3DSurfaceImpl *This, const RECT *rect, v glPixelStorei(GL_PACK_SKIP_ROWS, skipRow); checkGLcall("glPixelStorei"); - if(This->Flags & SFLAG_PBO) { + if (surface->flags & SFLAG_PBO) + { GL_EXTCALL(glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, 0)); checkGLcall("glBindBufferARB"); @@ -1403,8 +3870,9 @@ static void read_from_framebuffer(IWineD3DSurfaceImpl *This, const RECT *rect, v * to get a pointer to it and perform the flipping in software. This is a lot * faster than calling glReadPixels for each line. In case we want more speed * we should rerender it flipped in a FBO and read the data back from the FBO. */ - if(!srcIsUpsideDown) { - GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, This->pbo)); + if (!srcIsUpsideDown) + { + GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, surface->pbo)); checkGLcall("glBindBufferARB"); mem = GL_EXTCALL(glMapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, GL_READ_WRITE_ARB)); @@ -1423,7 +3891,8 @@ static void read_from_framebuffer(IWineD3DSurfaceImpl *This, const RECT *rect, v row = HeapAlloc(GetProcessHeap(), 0, len); if(!row) { ERR("Out of memory\n"); - if (This->resource.format->id == WINED3DFMT_P8_UINT) HeapFree(GetProcessHeap(), 0, mem); + if (surface->resource.format->id == WINED3DFMT_P8_UINT) + HeapFree(GetProcessHeap(), 0, mem); LEAVE_GL(); return; } @@ -1440,7 +3909,8 @@ static void read_from_framebuffer(IWineD3DSurfaceImpl *This, const RECT *rect, v HeapFree(GetProcessHeap(), 0, row); /* Unmap the temp PBO buffer */ - if(This->Flags & SFLAG_PBO) { + if (surface->flags & SFLAG_PBO) + { GL_EXTCALL(glUnmapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB)); GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0)); } @@ -1449,23 +3919,26 @@ static void read_from_framebuffer(IWineD3DSurfaceImpl *This, const RECT *rect, v LEAVE_GL(); context_release(context); - /* For P8 textures we need to perform an inverse palette lookup. This is done by searching for a palette - * index which matches the RGB value. Note this isn't guaranteed to work when there are multiple entries for - * the same color but we have no choice. - * In case of P8 render targets, the index is stored in the alpha component so no conversion is needed. - */ - if (This->resource.format->id == WINED3DFMT_P8_UINT && !primary_render_target_is_p8(device)) + /* For P8 textures we need to perform an inverse palette lookup. This is + * done by searching for a palette index which matches the RGB value. + * Note this isn't guaranteed to work when there are multiple entries for + * the same color but we have no choice. In case of P8 render targets, + * the index is stored in the alpha component so no conversion is needed. */ + if (surface->resource.format->id == WINED3DFMT_P8_UINT && !primary_render_target_is_p8(device)) { const PALETTEENTRY *pal = NULL; DWORD width = pitch / 3; int x, y, c; - if(This->palette) { - pal = This->palette->palents; - } else { + if (surface->palette) + { + pal = surface->palette->palents; + } + else + { ERR("Palette is missing, cannot perform inverse palette lookup\n"); HeapFree(GetProcessHeap(), 0, mem); - return ; + return; } for(y = local_rect.top; y < local_rect.bottom; y++) { @@ -1491,13 +3964,13 @@ static void read_from_framebuffer(IWineD3DSurfaceImpl *This, const RECT *rect, v } /* Read the framebuffer contents into a texture */ -static void read_from_framebuffer_texture(IWineD3DSurfaceImpl *This, BOOL srgb) +static void read_from_framebuffer_texture(struct wined3d_surface *surface, BOOL srgb) { - IWineD3DDeviceImpl *device = This->resource.device; + struct wined3d_device *device = surface->resource.device; const struct wined3d_gl_info *gl_info; struct wined3d_context *context; - if (!surface_is_offscreen(This)) + if (!surface_is_offscreen(surface)) { /* We would need to flip onscreen surfaces, but there's no efficient * way to do that here. It makes more sense for the caller to @@ -1510,21 +3983,21 @@ static void read_from_framebuffer_texture(IWineD3DSurfaceImpl *This, BOOL srgb) * locking during offscreen rendering). RESOURCELOAD is ok because glCopyTexSubImage2D isn't affected by any * states in the stateblock, and no driver was found yet that had bugs in that regard. */ - context = context_acquire(device, This); + context = context_acquire(device, surface); gl_info = context->gl_info; - surface_prepare_texture(This, gl_info, srgb); - surface_bind_and_dirtify(This, srgb); + surface_prepare_texture(surface, gl_info, srgb); + surface_bind_and_dirtify(surface, gl_info, srgb); - TRACE("Reading back offscreen render target %p.\n", This); + TRACE("Reading back offscreen render target %p.\n", surface); ENTER_GL(); glReadBuffer(device->offscreenBuffer); checkGLcall("glReadBuffer"); - glCopyTexSubImage2D(This->texture_target, This->texture_level, - 0, 0, 0, 0, This->currentDesc.Width, This->currentDesc.Height); + glCopyTexSubImage2D(surface->texture_target, surface->texture_level, + 0, 0, 0, 0, surface->resource.width, surface->resource.height); checkGLcall("glCopyTexSubImage2D"); LEAVE_GL(); @@ -1533,38 +4006,38 @@ static void read_from_framebuffer_texture(IWineD3DSurfaceImpl *This, BOOL srgb) } /* Context activation is done by the caller. */ -static void surface_prepare_texture_internal(IWineD3DSurfaceImpl *surface, +static void surface_prepare_texture_internal(struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info, BOOL srgb) { DWORD alloc_flag = srgb ? SFLAG_SRGBALLOCATED : SFLAG_ALLOCATED; CONVERT_TYPES convert; struct wined3d_format format; - if (surface->Flags & alloc_flag) return; + if (surface->flags & alloc_flag) return; d3dfmt_get_conv(surface, TRUE, TRUE, &format, &convert); - if (convert != NO_CONVERSION || format.convert) surface->Flags |= SFLAG_CONVERTED; - else surface->Flags &= ~SFLAG_CONVERTED; + if (convert != NO_CONVERSION || format.convert) surface->flags |= SFLAG_CONVERTED; + else surface->flags &= ~SFLAG_CONVERTED; - surface_bind_and_dirtify(surface, srgb); + surface_bind_and_dirtify(surface, gl_info, srgb); surface_allocate_surface(surface, gl_info, &format, srgb); - surface->Flags |= alloc_flag; + surface->flags |= alloc_flag; } /* Context activation is done by the caller. */ -void surface_prepare_texture(IWineD3DSurfaceImpl *surface, const struct wined3d_gl_info *gl_info, BOOL srgb) +void surface_prepare_texture(struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info, BOOL srgb) { if (surface->container.type == WINED3D_CONTAINER_TEXTURE) { - IWineD3DBaseTextureImpl *texture = surface->container.u.texture; - UINT sub_count = texture->baseTexture.level_count * texture->baseTexture.layer_count; + struct wined3d_texture *texture = surface->container.u.texture; + UINT sub_count = texture->level_count * texture->layer_count; UINT i; TRACE("surface %p is a subresource of texture %p.\n", surface, texture); for (i = 0; i < sub_count; ++i) { - IWineD3DSurfaceImpl *s = (IWineD3DSurfaceImpl *)texture->baseTexture.sub_resources[i]; + struct wined3d_surface *s = surface_from_resource(texture->sub_resources[i]); surface_prepare_texture_internal(s, gl_info, srgb); } @@ -1574,563 +4047,96 @@ void surface_prepare_texture(IWineD3DSurfaceImpl *surface, const struct wined3d_ surface_prepare_texture_internal(surface, gl_info, srgb); } -static void surface_prepare_system_memory(IWineD3DSurfaceImpl *This) +static void flush_to_framebuffer_drawpixels(struct wined3d_surface *surface, + const RECT *rect, GLenum fmt, GLenum type, UINT bpp, const BYTE *mem) { - IWineD3DDeviceImpl *device = This->resource.device; - const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; - - /* Performance optimization: Count how often a surface is locked, if it is locked regularly do not throw away the system memory copy. - * This avoids the need to download the surface from opengl all the time. The surface is still downloaded if the opengl texture is - * changed - */ - if(!(This->Flags & SFLAG_DYNLOCK)) { - This->lockCount++; - /* MAXLOCKCOUNT is defined in wined3d_private.h */ - if(This->lockCount > MAXLOCKCOUNT) { - TRACE("Surface is locked regularly, not freeing the system memory copy any more\n"); - This->Flags |= SFLAG_DYNLOCK; - } - } - - /* Create a PBO for dynamically locked surfaces but don't do it for converted or non-pow2 surfaces. - * Also don't create a PBO for systemmem surfaces. - */ - if (gl_info->supported[ARB_PIXEL_BUFFER_OBJECT] && (This->Flags & SFLAG_DYNLOCK) - && !(This->Flags & (SFLAG_PBO | SFLAG_CONVERTED | SFLAG_NONPOW2)) - && (This->resource.pool != WINED3DPOOL_SYSTEMMEM)) - { - GLenum error; - struct wined3d_context *context; - - context = context_acquire(device, NULL); - ENTER_GL(); - - GL_EXTCALL(glGenBuffersARB(1, &This->pbo)); - error = glGetError(); - if (!This->pbo || error != GL_NO_ERROR) - ERR("Failed to bind the PBO with error %s (%#x)\n", debug_glerror(error), error); - - TRACE("Attaching pbo=%#x to (%p)\n", This->pbo, This); - - GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, This->pbo)); - checkGLcall("glBindBufferARB"); - - GL_EXTCALL(glBufferDataARB(GL_PIXEL_UNPACK_BUFFER_ARB, This->resource.size + 4, This->resource.allocatedMemory, GL_STREAM_DRAW_ARB)); - checkGLcall("glBufferDataARB"); - - GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0)); - checkGLcall("glBindBufferARB"); - - /* We don't need the system memory anymore and we can't even use it for PBOs */ - if(!(This->Flags & SFLAG_CLIENT)) { - HeapFree(GetProcessHeap(), 0, This->resource.heapMemory); - This->resource.heapMemory = NULL; - } - This->resource.allocatedMemory = NULL; - This->Flags |= SFLAG_PBO; - LEAVE_GL(); - context_release(context); - } - else if (!(This->resource.allocatedMemory || This->Flags & SFLAG_PBO)) - { - /* Whatever surface we have, make sure that there is memory allocated for the downloaded copy, - * or a pbo to map - */ - if(!This->resource.heapMemory) { - This->resource.heapMemory = HeapAlloc(GetProcessHeap() ,0 , This->resource.size + RESOURCE_ALIGNMENT); - } - This->resource.allocatedMemory = - (BYTE *)(((ULONG_PTR) This->resource.heapMemory + (RESOURCE_ALIGNMENT - 1)) & ~(RESOURCE_ALIGNMENT - 1)); - if(This->Flags & SFLAG_INSYSMEM) { - ERR("Surface without memory or pbo has SFLAG_INSYSMEM set!\n"); - } - } -} - -static HRESULT WINAPI IWineD3DSurfaceImpl_LockRect(IWineD3DSurface *iface, WINED3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags) { - IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface; - IWineD3DDeviceImpl *device = This->resource.device; - const RECT *pass_rect = pRect; - - TRACE("iface %p, locked_rect %p, rect %s, flags %#x.\n", - iface, pLockedRect, wine_dbgstr_rect(pRect), Flags); - - /* This is also done in the base class, but we have to verify this before loading any data from - * gl into the sysmem copy. The PBO may be mapped, a different rectangle locked, the discard flag - * may interfere, and all other bad things may happen - */ - if (This->Flags & SFLAG_LOCKED) { - WARN("Surface is already locked, returning D3DERR_INVALIDCALL\n"); - return WINED3DERR_INVALIDCALL; - } - This->Flags |= SFLAG_LOCKED; - - if (!(This->Flags & SFLAG_LOCKABLE)) - { - TRACE("Warning: trying to lock unlockable surf@%p\n", This); - } - - if (Flags & WINED3DLOCK_DISCARD) { - /* Set SFLAG_INSYSMEM, so we'll never try to download the data from the texture. */ - TRACE("WINED3DLOCK_DISCARD flag passed, marking local copy as up to date\n"); - surface_prepare_system_memory(This); /* Makes sure memory is allocated */ - This->Flags |= SFLAG_INSYSMEM; - goto lock_end; - } - - if (This->Flags & SFLAG_INSYSMEM) { - TRACE("Local copy is up to date, not downloading data\n"); - surface_prepare_system_memory(This); /* Makes sure memory is allocated */ - goto lock_end; - } - - /* surface_load_location() does not check if the rectangle specifies - * the full surface. Most callers don't need that, so do it here. */ - if (pRect && !pRect->top && !pRect->left - && pRect->right == This->currentDesc.Width - && pRect->bottom == This->currentDesc.Height) - { - pass_rect = NULL; - } - - if (!(wined3d_settings.rendertargetlock_mode == RTL_DISABLE - && ((This->container.type == WINED3D_CONTAINER_SWAPCHAIN) || This == device->render_targets[0]))) - { - surface_load_location(This, SFLAG_INSYSMEM, pass_rect); - } - -lock_end: - if (This->Flags & SFLAG_PBO) - { - const struct wined3d_gl_info *gl_info; - struct wined3d_context *context; - - context = context_acquire(device, NULL); - gl_info = context->gl_info; - - ENTER_GL(); - GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, This->pbo)); - checkGLcall("glBindBufferARB"); - - /* This shouldn't happen but could occur if some other function didn't handle the PBO properly */ - if(This->resource.allocatedMemory) { - ERR("The surface already has PBO memory allocated!\n"); - } - - This->resource.allocatedMemory = GL_EXTCALL(glMapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, GL_READ_WRITE_ARB)); - checkGLcall("glMapBufferARB"); - - /* Make sure the pbo isn't set anymore in order not to break non-pbo calls */ - GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0)); - checkGLcall("glBindBufferARB"); - - LEAVE_GL(); - context_release(context); - } - - if (Flags & (WINED3DLOCK_NO_DIRTY_UPDATE | WINED3DLOCK_READONLY)) { - /* Don't dirtify */ - } - else - { - surface_add_dirty_rect(This, pRect); - - if (This->container.type == WINED3D_CONTAINER_TEXTURE) - { - TRACE("Making container dirty.\n"); - IWineD3DBaseTexture_SetDirty((IWineD3DBaseTexture *)This->container.u.texture, TRUE); - } - else - { - TRACE("Surface is standalone, no need to dirty the container\n"); - } - } - - return IWineD3DBaseSurfaceImpl_LockRect(iface, pLockedRect, pRect, Flags); -} - -static void flush_to_framebuffer_drawpixels(IWineD3DSurfaceImpl *This, GLenum fmt, GLenum type, UINT bpp, const BYTE *mem) { - GLint prev_store; - GLint prev_rasterpos[4]; - GLint skipBytes = 0; - UINT pitch = IWineD3DSurface_GetPitch((IWineD3DSurface *) This); /* target is argb, 4 byte */ - IWineD3DDeviceImpl *device = This->resource.device; + struct wined3d_device *device = surface->resource.device; + UINT pitch = wined3d_surface_get_pitch(surface); const struct wined3d_gl_info *gl_info; struct wined3d_context *context; + RECT local_rect; + UINT w, h; + + surface_get_rect(surface, rect, &local_rect); + + mem += local_rect.top * pitch + local_rect.left * bpp; + w = local_rect.right - local_rect.left; + h = local_rect.bottom - local_rect.top; /* Activate the correct context for the render target */ - context = context_acquire(device, This); + context = context_acquire(device, surface); context_apply_blit_state(context, device); gl_info = context->gl_info; ENTER_GL(); - if (!surface_is_offscreen(This)) + if (!surface_is_offscreen(surface)) { - GLenum buffer = surface_get_gl_buffer(This); + GLenum buffer = surface_get_gl_buffer(surface); TRACE("Unlocking %#x buffer.\n", buffer); context_set_draw_buffer(context, buffer); + + surface_translate_drawable_coords(surface, context->win_handle, &local_rect); + glPixelZoom(1.0f, -1.0f); } else { /* Primary offscreen render target */ TRACE("Offscreen render target.\n"); context_set_draw_buffer(context, device->offscreenBuffer); + + glPixelZoom(1.0f, 1.0f); } - glGetIntegerv(GL_PACK_SWAP_BYTES, &prev_store); - checkGLcall("glGetIntegerv"); - glGetIntegerv(GL_CURRENT_RASTER_POSITION, &prev_rasterpos[0]); - checkGLcall("glGetIntegerv"); - glPixelZoom(1.0f, -1.0f); - checkGLcall("glPixelZoom"); - - /* If not fullscreen, we need to skip a number of bytes to find the next row of data */ - glGetIntegerv(GL_UNPACK_ROW_LENGTH, &skipBytes); - glPixelStorei(GL_UNPACK_ROW_LENGTH, This->currentDesc.Width); - - glRasterPos3i(This->lockedRect.left, This->lockedRect.top, 1); + glRasterPos3i(local_rect.left, local_rect.top, 1); checkGLcall("glRasterPos3i"); - /* Some drivers(radeon dri, others?) don't like exceptions during - * glDrawPixels. If the surface is a DIB section, it might be in GDIMode - * after ReleaseDC. Reading it will cause an exception, which x11drv will - * catch to put the dib section in InSync mode, which leads to a crash - * and a blocked x server on my radeon card. - * - * The following lines read the dib section so it is put in InSync mode - * before glDrawPixels is called and the crash is prevented. There won't - * be any interfering gdi accesses, because UnlockRect is called from - * ReleaseDC, and the app won't use the dc any more afterwards. - */ - if((This->Flags & SFLAG_DIBSECTION) && !(This->Flags & SFLAG_PBO)) { - volatile BYTE read; - read = This->resource.allocatedMemory[0]; - } + /* If not fullscreen, we need to skip a number of bytes to find the next row of data */ + glPixelStorei(GL_UNPACK_ROW_LENGTH, surface->resource.width); - if(This->Flags & SFLAG_PBO) { - GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, This->pbo)); + if (surface->flags & SFLAG_PBO) + { + GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, surface->pbo)); checkGLcall("glBindBufferARB"); } - /* When the surface is locked we only have to refresh the locked part else we need to update the whole image */ - if(This->Flags & SFLAG_LOCKED) { - glDrawPixels(This->lockedRect.right - This->lockedRect.left, - (This->lockedRect.bottom - This->lockedRect.top)-1, - fmt, type, - mem + bpp * This->lockedRect.left + pitch * This->lockedRect.top); - checkGLcall("glDrawPixels"); - } else { - glDrawPixels(This->currentDesc.Width, - This->currentDesc.Height, - fmt, type, mem); - checkGLcall("glDrawPixels"); - } + glDrawPixels(w, h, fmt, type, mem); + checkGLcall("glDrawPixels"); - if(This->Flags & SFLAG_PBO) { + if (surface->flags & SFLAG_PBO) + { GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0)); checkGLcall("glBindBufferARB"); } - glPixelZoom(1.0f, 1.0f); - checkGLcall("glPixelZoom"); - - glRasterPos3iv(&prev_rasterpos[0]); - checkGLcall("glRasterPos3iv"); - - /* Reset to previous pack row length */ - glPixelStorei(GL_UNPACK_ROW_LENGTH, skipBytes); - checkGLcall("glPixelStorei(GL_UNPACK_ROW_LENGTH)"); + glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); + checkGLcall("glPixelStorei(GL_UNPACK_ROW_LENGTH, 0)"); LEAVE_GL(); + + if (wined3d_settings.strict_draw_ordering + || (surface->container.type == WINED3D_CONTAINER_SWAPCHAIN + && surface->container.u.swapchain->front_buffer == surface)) + wglFlush(); + context_release(context); } -static HRESULT WINAPI IWineD3DSurfaceImpl_UnlockRect(IWineD3DSurface *iface) { - IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface; - IWineD3DDeviceImpl *device = This->resource.device; - BOOL fullsurface; - - if (!(This->Flags & SFLAG_LOCKED)) { - WARN("trying to Unlock an unlocked surf@%p\n", This); - return WINEDDERR_NOTLOCKED; - } - - if (This->Flags & SFLAG_PBO) - { - const struct wined3d_gl_info *gl_info; - struct wined3d_context *context; - - TRACE("Freeing PBO memory\n"); - - context = context_acquire(device, NULL); - gl_info = context->gl_info; - - ENTER_GL(); - GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, This->pbo)); - GL_EXTCALL(glUnmapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB)); - GL_EXTCALL(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0)); - checkGLcall("glUnmapBufferARB"); - LEAVE_GL(); - context_release(context); - - This->resource.allocatedMemory = NULL; - } - - TRACE("(%p) : dirtyfied(%d)\n", This, This->Flags & (SFLAG_INDRAWABLE | SFLAG_INTEXTURE) ? 0 : 1); - - if (This->Flags & (SFLAG_INDRAWABLE | SFLAG_INTEXTURE)) { - TRACE("(%p) : Not Dirtified so nothing to do, return now\n", This); - goto unlock_end; - } - - if (This->container.type == WINED3D_CONTAINER_SWAPCHAIN - || (device->render_targets && This == device->render_targets[0])) - { - if(wined3d_settings.rendertargetlock_mode == RTL_DISABLE) { - static BOOL warned = FALSE; - if(!warned) { - ERR("The application tries to write to the render target, but render target locking is disabled\n"); - warned = TRUE; - } - goto unlock_end; - } - - if (!This->dirtyRect.left && !This->dirtyRect.top - && This->dirtyRect.right == This->currentDesc.Width - && This->dirtyRect.bottom == This->currentDesc.Height) - { - fullsurface = TRUE; - } else { - /* TODO: Proper partial rectangle tracking */ - fullsurface = FALSE; - This->Flags |= SFLAG_INSYSMEM; - } - - switch(wined3d_settings.rendertargetlock_mode) { - case RTL_READTEX: - surface_load_location(This, SFLAG_INTEXTURE, NULL /* partial texture loading not supported yet */); - /* drop through */ - - case RTL_READDRAW: - surface_load_location(This, SFLAG_INDRAWABLE, fullsurface ? NULL : &This->dirtyRect); - break; - } - - if(!fullsurface) { - /* Partial rectangle tracking is not commonly implemented, it is only done for render targets. Overwrite - * the flags to bring them back into a sane state. INSYSMEM was set before to tell LoadLocation where - * to read the rectangle from. Indrawable is set because all modifications from the partial sysmem copy - * are written back to the drawable, thus the surface is merged again in the drawable. The sysmem copy is - * not fully up to date because only a subrectangle was read in LockRect. - */ - This->Flags &= ~SFLAG_INSYSMEM; - This->Flags |= SFLAG_INDRAWABLE; - } - - This->dirtyRect.left = This->currentDesc.Width; - This->dirtyRect.top = This->currentDesc.Height; - This->dirtyRect.right = 0; - This->dirtyRect.bottom = 0; - } - else if (This == device->depth_stencil) - { - FIXME("Depth Stencil buffer locking is not implemented\n"); - } else { - /* The rest should be a normal texture */ - /* Check if the texture is bound, if yes dirtify the sampler to force a re-upload of the texture - * Can't load the texture here because PreLoad may destroy and recreate the gl texture, so sampler - * states need resetting - */ - if (This->container.type == WINED3D_CONTAINER_TEXTURE) - { - IWineD3DBaseTextureImpl *texture = This->container.u.texture; - if (texture->baseTexture.bindCount) - IWineD3DDeviceImpl_MarkStateDirty(device, STATE_SAMPLER(texture->baseTexture.sampler)); - } - } - - unlock_end: - This->Flags &= ~SFLAG_LOCKED; - memset(&This->lockedRect, 0, sizeof(RECT)); - - /* Overlays have to be redrawn manually after changes with the GL implementation */ - if(This->overlay_dest) { - IWineD3DSurface_DrawOverlay(iface); - } - return WINED3D_OK; -} - -static void surface_release_client_storage(IWineD3DSurfaceImpl *surface) -{ - struct wined3d_context *context; - - context = context_acquire(surface->resource.device, NULL); - - ENTER_GL(); - glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE); - if (surface->texture_name) - { - surface_bind_and_dirtify(surface, FALSE); - glTexImage2D(surface->texture_target, surface->texture_level, - GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL); - } - if (surface->texture_name_srgb) - { - surface_bind_and_dirtify(surface, TRUE); - glTexImage2D(surface->texture_target, surface->texture_level, - GL_RGB, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL); - } - glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE); - - LEAVE_GL(); - context_release(context); - - surface_modify_location(surface, SFLAG_INSRGBTEX, FALSE); - surface_modify_location(surface, SFLAG_INTEXTURE, FALSE); - surface_force_reload(surface); -} - -static HRESULT WINAPI IWineD3DSurfaceImpl_GetDC(IWineD3DSurface *iface, HDC *pHDC) -{ - IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface; - WINED3DLOCKED_RECT lock; - HRESULT hr; - RGBQUAD col[256]; - - TRACE("(%p)->(%p)\n",This,pHDC); - - if(This->Flags & SFLAG_USERPTR) { - ERR("Not supported on surfaces with an application-provided surfaces\n"); - return WINEDDERR_NODC; - } - - /* Give more detailed info for ddraw */ - if (This->Flags & SFLAG_DCINUSE) - return WINEDDERR_DCALREADYCREATED; - - /* Can't GetDC if the surface is locked */ - if (This->Flags & SFLAG_LOCKED) - return WINED3DERR_INVALIDCALL; - - memset(&lock, 0, sizeof(lock)); /* To be sure */ - - /* Create a DIB section if there isn't a hdc yet */ - if (!This->hDC) - { - if (This->Flags & SFLAG_CLIENT) - { - surface_load_location(This, SFLAG_INSYSMEM, NULL); - surface_release_client_storage(This); - } - hr = IWineD3DBaseSurfaceImpl_CreateDIBSection(iface); - if(FAILED(hr)) return WINED3DERR_INVALIDCALL; - - /* Use the dib section from now on if we are not using a PBO */ - if(!(This->Flags & SFLAG_PBO)) - This->resource.allocatedMemory = This->dib.bitmap_data; - } - - /* Lock the surface */ - hr = IWineD3DSurface_LockRect(iface, - &lock, - NULL, - 0); - - if(This->Flags & SFLAG_PBO) { - /* Sync the DIB with the PBO. This can't be done earlier because LockRect activates the allocatedMemory */ - memcpy(This->dib.bitmap_data, This->resource.allocatedMemory, This->dib.bitmap_size); - } - - if(FAILED(hr)) { - ERR("IWineD3DSurface_LockRect failed with hr = %08x\n", hr); - /* keep the dib section */ - return hr; - } - - if (This->resource.format->id == WINED3DFMT_P8_UINT - || This->resource.format->id == WINED3DFMT_P8_UINT_A8_UNORM) - { - /* GetDC on palettized formats is unsupported in D3D9, and the method is missing in - D3D8, so this should only be used for DX <=7 surfaces (with non-device palettes) */ - unsigned int n; - const PALETTEENTRY *pal = NULL; - - if(This->palette) { - pal = This->palette->palents; - } else { - IWineD3DSurfaceImpl *dds_primary; - IWineD3DSwapChainImpl *swapchain; - swapchain = (IWineD3DSwapChainImpl *)This->resource.device->swapchains[0]; - dds_primary = swapchain->front_buffer; - if (dds_primary && dds_primary->palette) - pal = dds_primary->palette->palents; - } - - if (pal) { - for (n=0; n<256; n++) { - col[n].rgbRed = pal[n].peRed; - col[n].rgbGreen = pal[n].peGreen; - col[n].rgbBlue = pal[n].peBlue; - col[n].rgbReserved = 0; - } - SetDIBColorTable(This->hDC, 0, 256, col); - } - } - - *pHDC = This->hDC; - TRACE("returning %p\n",*pHDC); - This->Flags |= SFLAG_DCINUSE; - - return WINED3D_OK; -} - -static HRESULT WINAPI IWineD3DSurfaceImpl_ReleaseDC(IWineD3DSurface *iface, HDC hDC) -{ - IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface; - - TRACE("(%p)->(%p)\n",This,hDC); - - if (!(This->Flags & SFLAG_DCINUSE)) - return WINEDDERR_NODC; - - if (This->hDC !=hDC) { - WARN("Application tries to release an invalid DC(%p), surface dc is %p\n", hDC, This->hDC); - return WINEDDERR_NODC; - } - - if((This->Flags & SFLAG_PBO) && This->resource.allocatedMemory) { - /* Copy the contents of the DIB over to the PBO */ - memcpy(This->resource.allocatedMemory, This->dib.bitmap_data, This->dib.bitmap_size); - } - - /* we locked first, so unlock now */ - IWineD3DSurface_UnlockRect(iface); - - This->Flags &= ~SFLAG_DCINUSE; - - return WINED3D_OK; -} - -/* ****************************************************** - IWineD3DSurface Internal (No mapping to directx api) parts follow - ****************************************************** */ - -HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck, +HRESULT d3dfmt_get_conv(struct wined3d_surface *surface, BOOL need_alpha_ck, BOOL use_texturing, struct wined3d_format *format, CONVERT_TYPES *convert) { - BOOL colorkey_active = need_alpha_ck && (This->CKeyFlags & WINEDDSD_CKSRCBLT); - IWineD3DDeviceImpl *device = This->resource.device; + BOOL colorkey_active = need_alpha_ck && (surface->CKeyFlags & WINEDDSD_CKSRCBLT); + struct wined3d_device *device = surface->resource.device; const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; BOOL blit_supported = FALSE; /* Copy the default values from the surface. Below we might perform fixups */ /* TODO: get rid of color keying desc fixups by using e.g. a table. */ - *format = *This->resource.format; + *format = *surface->resource.format; *convert = NO_CONVERSION; /* Ok, now look if we have to do any conversion */ - switch (This->resource.format->id) + switch (surface->resource.format->id) { case WINED3DFMT_P8_UINT: /* Below the call to blit_supported is disabled for Wine 1.2 @@ -2142,9 +4148,9 @@ HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck, * 8-bit blits need to be handled by the blit_shader. * TODO: get rid of this #if 0. */ #if 0 - blit_supported = device->blitter->blit_supported(&device->adapter->gl_info, BLIT_OP_BLIT, - &rect, This->resource.usage, This->resource.pool, This->resource.format, - &rect, This->resource.usage, This->resource.pool, This->resource.format); + blit_supported = device->blitter->blit_supported(&device->adapter->gl_info, WINED3D_BLIT_OP_COLOR_BLIT, + &rect, surface->resource.usage, surface->resource.pool, surface->resource.format, + &rect, surface->resource.usage, surface->resource.pool, surface->resource.format); #endif blit_supported = gl_info->supported[EXT_PALETTED_TEXTURE] || gl_info->supported[ARB_FRAGMENT_PROGRAM]; @@ -2154,7 +4160,7 @@ HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck, * in which the main render target uses p8. Some games like GTA Vice City use P8 for texturing which * conflicts with this. */ - if (!((blit_supported && device->render_targets && This == device->render_targets[0])) + if (!((blit_supported && device->fb.render_targets && surface == device->fb.render_targets[0])) || colorkey_active || !use_texturing) { format->glFormat = GL_RGBA; @@ -2230,10 +4236,10 @@ HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck, return WINED3D_OK; } -void d3dfmt_p8_init_palette(IWineD3DSurfaceImpl *This, BYTE table[256][4], BOOL colorkey) +void d3dfmt_p8_init_palette(struct wined3d_surface *surface, BYTE table[256][4], BOOL colorkey) { - IWineD3DDeviceImpl *device = This->resource.device; - IWineD3DPaletteImpl *pal = This->palette; + struct wined3d_device *device = surface->resource.device; + struct wined3d_palette *pal = surface->palette; BOOL index_in_alpha = FALSE; unsigned int i; @@ -2246,7 +4252,7 @@ void d3dfmt_p8_init_palette(IWineD3DSurfaceImpl *This, BYTE table[256][4], BOOL if (!pal) { - UINT dxVersion = ((IWineD3DImpl *)device->wined3d)->dxVersion; + UINT dxVersion = device->wined3d->dxVersion; /* In DirectDraw the palette is a property of the surface, there are no such things as device palettes. */ if (dxVersion <= 7) @@ -2293,12 +4299,12 @@ void d3dfmt_p8_init_palette(IWineD3DSurfaceImpl *This, BYTE table[256][4], BOOL { table[i][3] = i; } - else if (colorkey && (i >= This->SrcBltCKey.dwColorSpaceLowValue) - && (i <= This->SrcBltCKey.dwColorSpaceHighValue)) + else if (colorkey && (i >= surface->SrcBltCKey.dwColorSpaceLowValue) + && (i <= surface->SrcBltCKey.dwColorSpaceHighValue)) { table[i][3] = 0x00; } - else if(pal->Flags & WINEDDPCAPS_ALPHA) + else if (pal->flags & WINEDDPCAPS_ALPHA) { table[i][3] = pal->palents[i].peFlags; } @@ -2311,11 +4317,11 @@ void d3dfmt_p8_init_palette(IWineD3DSurfaceImpl *This, BYTE table[256][4], BOOL } static HRESULT d3dfmt_convert_surface(const BYTE *src, BYTE *dst, UINT pitch, UINT width, - UINT height, UINT outpitch, CONVERT_TYPES convert, IWineD3DSurfaceImpl *This) + UINT height, UINT outpitch, CONVERT_TYPES convert, struct wined3d_surface *surface) { const BYTE *source; BYTE *dest; - TRACE("(%p)->(%p),(%d,%d,%d,%d,%p)\n", src, dst, pitch, height, outpitch, convert,This); + TRACE("(%p)->(%p),(%d,%d,%d,%d,%p)\n", src, dst, pitch, height, outpitch, convert, surface); switch (convert) { case NO_CONVERSION: @@ -2329,7 +4335,7 @@ static HRESULT d3dfmt_convert_surface(const BYTE *src, BYTE *dst, UINT pitch, UI BYTE table[256][4]; unsigned int x, y; - d3dfmt_p8_init_palette(This, table, (convert == CONVERT_PALETTED_CK)); + d3dfmt_p8_init_palette(surface, table, (convert == CONVERT_PALETTED_CK)); for (y = 0; y < height; y++) { @@ -2371,10 +4377,9 @@ static HRESULT d3dfmt_convert_surface(const BYTE *src, BYTE *dst, UINT pitch, UI for (x = 0; x < width; x++ ) { WORD color = *Source++; *Dest = ((color & 0xFFC0) | ((color & 0x1F) << 1)); - if ((color < This->SrcBltCKey.dwColorSpaceLowValue) || - (color > This->SrcBltCKey.dwColorSpaceHighValue)) { + if ((color < surface->SrcBltCKey.dwColorSpaceLowValue) + || (color > surface->SrcBltCKey.dwColorSpaceHighValue)) *Dest |= 0x0001; - } Dest++; } } @@ -2394,13 +4399,11 @@ static HRESULT d3dfmt_convert_surface(const BYTE *src, BYTE *dst, UINT pitch, UI for (x = 0; x < width; x++ ) { WORD color = *Source++; *Dest = color; - if ((color < This->SrcBltCKey.dwColorSpaceLowValue) || - (color > This->SrcBltCKey.dwColorSpaceHighValue)) { + if ((color < surface->SrcBltCKey.dwColorSpaceLowValue) + || (color > surface->SrcBltCKey.dwColorSpaceHighValue)) *Dest |= (1 << 15); - } - else { + else *Dest &= ~(1 << 15); - } Dest++; } } @@ -2418,10 +4421,9 @@ static HRESULT d3dfmt_convert_surface(const BYTE *src, BYTE *dst, UINT pitch, UI for (x = 0; x < width; x++) { DWORD color = ((DWORD)source[0] << 16) + ((DWORD)source[1] << 8) + (DWORD)source[2] ; DWORD dstcolor = color << 8; - if ((color < This->SrcBltCKey.dwColorSpaceLowValue) || - (color > This->SrcBltCKey.dwColorSpaceHighValue)) { + if ((color < surface->SrcBltCKey.dwColorSpaceLowValue) + || (color > surface->SrcBltCKey.dwColorSpaceHighValue)) dstcolor |= 0xff; - } *(DWORD*)dest = dstcolor; source += 3; dest += 4; @@ -2441,10 +4443,9 @@ static HRESULT d3dfmt_convert_surface(const BYTE *src, BYTE *dst, UINT pitch, UI for (x = 0; x < width; x++) { DWORD color = 0xffffff & *(const DWORD*)source; DWORD dstcolor = color << 8; - if ((color < This->SrcBltCKey.dwColorSpaceLowValue) || - (color > This->SrcBltCKey.dwColorSpaceHighValue)) { + if ((color < surface->SrcBltCKey.dwColorSpaceLowValue) + || (color > surface->SrcBltCKey.dwColorSpaceHighValue)) dstcolor |= 0xff; - } *(DWORD*)dest = dstcolor; source += 4; dest += 4; @@ -2459,12 +4460,12 @@ static HRESULT d3dfmt_convert_surface(const BYTE *src, BYTE *dst, UINT pitch, UI return WINED3D_OK; } -BOOL palette9_changed(IWineD3DSurfaceImpl *This) +BOOL palette9_changed(struct wined3d_surface *surface) { - IWineD3DDeviceImpl *device = This->resource.device; + struct wined3d_device *device = surface->resource.device; - if (This->palette || (This->resource.format->id != WINED3DFMT_P8_UINT - && This->resource.format->id != WINED3DFMT_P8_UINT_A8_UNORM)) + if (surface->palette || (surface->resource.format->id != WINED3DFMT_P8_UINT + && surface->resource.format->id != WINED3DFMT_P8_UINT_A8_UNORM)) { /* If a ddraw-style palette is attached assume no d3d9 palette change. * Also the palette isn't interesting if the surface format isn't P8 or A8P8 @@ -2472,199 +4473,24 @@ BOOL palette9_changed(IWineD3DSurfaceImpl *This) return FALSE; } - if (This->palette9) + if (surface->palette9) { - if (!memcmp(This->palette9, device->palettes[device->currentPalette], sizeof(PALETTEENTRY) * 256)) + if (!memcmp(surface->palette9, device->palettes[device->currentPalette], sizeof(PALETTEENTRY) * 256)) { return FALSE; } - } else { - This->palette9 = HeapAlloc(GetProcessHeap(), 0, sizeof(PALETTEENTRY) * 256); - } - memcpy(This->palette9, device->palettes[device->currentPalette], sizeof(PALETTEENTRY) * 256); - return TRUE; -} - -static HRESULT WINAPI IWineD3DSurfaceImpl_LoadTexture(IWineD3DSurface *iface, BOOL srgb_mode) { - IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface; - DWORD flag = srgb_mode ? SFLAG_INSRGBTEX : SFLAG_INTEXTURE; - - TRACE("iface %p, srgb %#x.\n", iface, srgb_mode); - - if (!(This->Flags & flag)) { - TRACE("Reloading because surface is dirty\n"); - } else if(/* Reload: gl texture has ck, now no ckey is set OR */ - ((This->Flags & SFLAG_GLCKEY) && (!(This->CKeyFlags & WINEDDSD_CKSRCBLT))) || - /* Reload: vice versa OR */ - ((!(This->Flags & SFLAG_GLCKEY)) && (This->CKeyFlags & WINEDDSD_CKSRCBLT)) || - /* Also reload: Color key is active AND the color key has changed */ - ((This->CKeyFlags & WINEDDSD_CKSRCBLT) && ( - (This->glCKey.dwColorSpaceLowValue != This->SrcBltCKey.dwColorSpaceLowValue) || - (This->glCKey.dwColorSpaceHighValue != This->SrcBltCKey.dwColorSpaceHighValue)))) { - TRACE("Reloading because of color keying\n"); - /* To perform the color key conversion we need a sysmem copy of - * the surface. Make sure we have it - */ - - surface_load_location(This, SFLAG_INSYSMEM, NULL); - /* Make sure the texture is reloaded because of the color key change, this kills performance though :( */ - /* TODO: This is not necessarily needed with hw palettized texture support */ - surface_modify_location(This, SFLAG_INSYSMEM, TRUE); - } else { - TRACE("surface is already in texture\n"); - return WINED3D_OK; - } - - /* Resources are placed in system RAM and do not need to be recreated when a device is lost. - * These resources are not bound by device size or format restrictions. Because of this, - * these resources cannot be accessed by the Direct3D device nor set as textures or render targets. - * However, these resources can always be created, locked, and copied. - */ - if (This->resource.pool == WINED3DPOOL_SCRATCH ) - { - FIXME("(%p) Operation not supported for scratch textures\n",This); - return WINED3DERR_INVALIDCALL; - } - - surface_load_location(This, flag, NULL /* no partial locking for textures yet */); - - if (!(This->Flags & SFLAG_DONOTFREE)) { - HeapFree(GetProcessHeap(), 0, This->resource.heapMemory); - This->resource.allocatedMemory = NULL; - This->resource.heapMemory = NULL; - surface_modify_location(This, SFLAG_INSYSMEM, FALSE); - } - - return WINED3D_OK; -} - -/* Context activation is done by the caller. */ -static void WINAPI IWineD3DSurfaceImpl_BindTexture(IWineD3DSurface *iface, BOOL srgb) -{ - IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface; - - TRACE("iface %p, srgb %#x.\n", iface, srgb); - - if (This->container.type == WINED3D_CONTAINER_TEXTURE) - { - TRACE("Passing to container.\n"); - IWineD3DBaseTexture_BindTexture((IWineD3DBaseTexture *)This->container.u.texture, srgb); } else { - GLuint *name; - - TRACE("(%p) : Binding surface\n", This); - - name = srgb ? &This->texture_name_srgb : &This->texture_name; - - ENTER_GL(); - - if (!This->texture_level) - { - if (!*name) { - glGenTextures(1, name); - checkGLcall("glGenTextures"); - TRACE("Surface %p given name %d\n", This, *name); - - glBindTexture(This->texture_target, *name); - checkGLcall("glBindTexture"); - glTexParameteri(This->texture_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - checkGLcall("glTexParameteri(dimension, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE)"); - glTexParameteri(This->texture_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - checkGLcall("glTexParameteri(dimension, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE)"); - glTexParameteri(This->texture_target, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE); - checkGLcall("glTexParameteri(dimension, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE)"); - glTexParameteri(This->texture_target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - checkGLcall("glTexParameteri(dimension, GL_TEXTURE_MIN_FILTER, GL_NEAREST)"); - glTexParameteri(This->texture_target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - checkGLcall("glTexParameteri(dimension, GL_TEXTURE_MAG_FILTER, GL_NEAREST)"); - } - /* This is where we should be reducing the amount of GLMemoryUsed */ - } else if (*name) { - /* Mipmap surfaces should have a base texture container */ - ERR("Mipmap surface has a glTexture bound to it!\n"); - } - - glBindTexture(This->texture_target, *name); - checkGLcall("glBindTexture"); - - LEAVE_GL(); + surface->palette9 = HeapAlloc(GetProcessHeap(), 0, sizeof(PALETTEENTRY) * 256); } + memcpy(surface->palette9, device->palettes[device->currentPalette], sizeof(PALETTEENTRY) * 256); + + return TRUE; } -static HRESULT WINAPI IWineD3DSurfaceImpl_SetFormat(IWineD3DSurface *iface, enum wined3d_format_id format) +void flip_surface(struct wined3d_surface *front, struct wined3d_surface *back) { - IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface; - HRESULT hr; - - TRACE("(%p) : Calling base function first\n", This); - hr = IWineD3DBaseSurfaceImpl_SetFormat(iface, format); - if(SUCCEEDED(hr)) { - This->Flags &= ~(SFLAG_ALLOCATED | SFLAG_SRGBALLOCATED); - TRACE("(%p) : glFormat %d, glFormatInternal %d, glType %d\n", This, This->resource.format->glFormat, - This->resource.format->glInternal, This->resource.format->glType); - } - return hr; -} - -static HRESULT WINAPI IWineD3DSurfaceImpl_SetMem(IWineD3DSurface *iface, void *Mem) { - IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface; - - if(This->Flags & (SFLAG_LOCKED | SFLAG_DCINUSE)) { - WARN("Surface is locked or the HDC is in use\n"); - return WINED3DERR_INVALIDCALL; - } - - if(Mem && Mem != This->resource.allocatedMemory) { - void *release = NULL; - - /* Do I have to copy the old surface content? */ - if(This->Flags & SFLAG_DIBSECTION) { - /* Release the DC. No need to hold the critical section for the update - * Thread because this thread runs only on front buffers, but this method - * fails for render targets in the check above. - */ - SelectObject(This->hDC, This->dib.holdbitmap); - DeleteDC(This->hDC); - /* Release the DIB section */ - DeleteObject(This->dib.DIBsection); - This->dib.bitmap_data = NULL; - This->resource.allocatedMemory = NULL; - This->hDC = NULL; - This->Flags &= ~SFLAG_DIBSECTION; - } else if(!(This->Flags & SFLAG_USERPTR)) { - release = This->resource.heapMemory; - This->resource.heapMemory = NULL; - } - This->resource.allocatedMemory = Mem; - This->Flags |= SFLAG_USERPTR | SFLAG_INSYSMEM; - - /* Now the surface memory is most up do date. Invalidate drawable and texture */ - surface_modify_location(This, SFLAG_INSYSMEM, TRUE); - - /* For client textures opengl has to be notified */ - if (This->Flags & SFLAG_CLIENT) - surface_release_client_storage(This); - - /* Now free the old memory if any */ - HeapFree(GetProcessHeap(), 0, release); - } else if(This->Flags & SFLAG_USERPTR) { - /* LockRect and GetDC will re-create the dib section and allocated memory */ - This->resource.allocatedMemory = NULL; - /* HeapMemory should be NULL already */ - if (This->resource.heapMemory) - ERR("User pointer surface has heap memory allocated.\n"); - This->Flags &= ~SFLAG_USERPTR; - - if (This->Flags & SFLAG_CLIENT) - surface_release_client_storage(This); - } - return WINED3D_OK; -} - -void flip_surface(IWineD3DSurfaceImpl *front, IWineD3DSurfaceImpl *back) { - /* Flip the surface contents */ /* Flip the DC */ { @@ -2677,15 +4503,15 @@ void flip_surface(IWineD3DSurfaceImpl *front, IWineD3DSurfaceImpl *back) { /* Flip the DIBsection */ { HBITMAP tmp; - BOOL hasDib = front->Flags & SFLAG_DIBSECTION; + BOOL hasDib = front->flags & SFLAG_DIBSECTION; tmp = front->dib.DIBsection; front->dib.DIBsection = back->dib.DIBsection; back->dib.DIBsection = tmp; - if(back->Flags & SFLAG_DIBSECTION) front->Flags |= SFLAG_DIBSECTION; - else front->Flags &= ~SFLAG_DIBSECTION; - if(hasDib) back->Flags |= SFLAG_DIBSECTION; - else back->Flags &= ~SFLAG_DIBSECTION; + if (back->flags & SFLAG_DIBSECTION) front->flags |= SFLAG_DIBSECTION; + else front->flags &= ~SFLAG_DIBSECTION; + if (hasDib) back->flags |= SFLAG_DIBSECTION; + else back->flags &= ~SFLAG_DIBSECTION; } /* Flip the surface data */ @@ -2731,82 +4557,24 @@ void flip_surface(IWineD3DSurfaceImpl *front, IWineD3DSurfaceImpl *back) { tmp = back->texture_name_srgb; back->texture_name_srgb = front->texture_name_srgb; front->texture_name_srgb = tmp; + + resource_unload(&back->resource); + resource_unload(&front->resource); } { - DWORD tmp_flags = back->Flags; - back->Flags = front->Flags; - front->Flags = tmp_flags; + DWORD tmp_flags = back->flags; + back->flags = front->flags; + front->flags = tmp_flags; } } -static HRESULT WINAPI IWineD3DSurfaceImpl_Flip(IWineD3DSurface *iface, IWineD3DSurface *override, DWORD Flags) { - IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface; - IWineD3DSwapChainImpl *swapchain = NULL; - - TRACE("(%p)->(%p,%x)\n", This, override, Flags); - - /* Flipping is only supported on RenderTargets and overlays*/ - if( !(This->resource.usage & (WINED3DUSAGE_RENDERTARGET | WINED3DUSAGE_OVERLAY)) ) { - WARN("Tried to flip a non-render target, non-overlay surface\n"); - return WINEDDERR_NOTFLIPPABLE; - } - - if(This->resource.usage & WINED3DUSAGE_OVERLAY) { - flip_surface(This, (IWineD3DSurfaceImpl *) override); - - /* Update the overlay if it is visible */ - if(This->overlay_dest) { - return IWineD3DSurface_DrawOverlay((IWineD3DSurface *) This); - } else { - return WINED3D_OK; - } - } - - if(override) { - /* DDraw sets this for the X11 surfaces, so don't confuse the user - * FIXME("(%p) Target override is not supported by now\n", This); - * Additionally, it isn't really possible to support triple-buffering - * properly on opengl at all - */ - } - - if (This->container.type != WINED3D_CONTAINER_SWAPCHAIN) - { - ERR("Flipped surface is not on a swapchain\n"); - return WINEDDERR_NOTFLIPPABLE; - } - swapchain = This->container.u.swapchain; - - /* Just overwrite the swapchain presentation interval. This is ok because only ddraw apps can call Flip, - * and only d3d8 and d3d9 apps specify the presentation interval - */ - if (!(Flags & (WINEDDFLIP_NOVSYNC | WINEDDFLIP_INTERVAL2 | WINEDDFLIP_INTERVAL3 | WINEDDFLIP_INTERVAL4))) - { - /* Most common case first to avoid wasting time on all the other cases */ - swapchain->presentParms.PresentationInterval = WINED3DPRESENT_INTERVAL_ONE; - } else if(Flags & WINEDDFLIP_NOVSYNC) { - swapchain->presentParms.PresentationInterval = WINED3DPRESENT_INTERVAL_IMMEDIATE; - } else if(Flags & WINEDDFLIP_INTERVAL2) { - swapchain->presentParms.PresentationInterval = WINED3DPRESENT_INTERVAL_TWO; - } else if(Flags & WINEDDFLIP_INTERVAL3) { - swapchain->presentParms.PresentationInterval = WINED3DPRESENT_INTERVAL_THREE; - } else { - swapchain->presentParms.PresentationInterval = WINED3DPRESENT_INTERVAL_FOUR; - } - - /* Flipping a OpenGL surface -> Use WineD3DDevice::Present */ - return IWineD3DSwapChain_Present((IWineD3DSwapChain *)swapchain, - NULL, NULL, swapchain->win_handle, NULL, 0); -} - -/* Does a direct frame buffer -> texture copy. Stretching is done - * with single pixel copy calls - */ -static void fb_copy_to_texture_direct(IWineD3DSurfaceImpl *dst_surface, IWineD3DSurfaceImpl *src_surface, +/* Does a direct frame buffer -> texture copy. Stretching is done with single + * pixel copy calls. */ +static void fb_copy_to_texture_direct(struct wined3d_surface *dst_surface, struct wined3d_surface *src_surface, const RECT *src_rect, const RECT *dst_rect_in, WINED3DTEXTUREFILTERTYPE Filter) { - IWineD3DDeviceImpl *device = dst_surface->resource.device; + struct wined3d_device *device = dst_surface->resource.device; float xrel, yrel; UINT row; struct wined3d_context *context; @@ -2868,10 +4636,12 @@ static void fb_copy_to_texture_direct(IWineD3DSurfaceImpl *dst_surface, IWineD3D glCopyTexSubImage2D(dst_surface->texture_target, dst_surface->texture_level, dst_rect.left /*xoffset */, dst_rect.top /* y offset */, - src_rect->left, src_surface->currentDesc.Height - src_rect->bottom, + src_rect->left, src_surface->resource.height - src_rect->bottom, dst_rect.right - dst_rect.left, dst_rect.bottom - dst_rect.top); - } else { - UINT yoffset = src_surface->currentDesc.Height - src_rect->top + dst_rect.top - 1; + } + else + { + UINT yoffset = src_surface->resource.height - src_rect->top + dst_rect.top - 1; /* I have to process this row by row to swap the image, * otherwise it would be upside down, so stretching in y direction * doesn't cost extra time @@ -2913,15 +4683,15 @@ static void fb_copy_to_texture_direct(IWineD3DSurfaceImpl *dst_surface, IWineD3D } /* Uses the hardware to stretch and flip the image */ -static void fb_copy_to_texture_hwstretch(IWineD3DSurfaceImpl *dst_surface, IWineD3DSurfaceImpl *src_surface, +static void fb_copy_to_texture_hwstretch(struct wined3d_surface *dst_surface, struct wined3d_surface *src_surface, const RECT *src_rect, const RECT *dst_rect_in, WINED3DTEXTUREFILTERTYPE Filter) { - IWineD3DDeviceImpl *device = dst_surface->resource.device; + struct wined3d_device *device = dst_surface->resource.device; + struct wined3d_swapchain *src_swapchain = NULL; GLuint src, backup = 0; - IWineD3DSwapChainImpl *src_swapchain = NULL; float left, right, top, bottom; /* Texture coordinates */ - UINT fbwidth = src_surface->currentDesc.Width; - UINT fbheight = src_surface->currentDesc.Height; + UINT fbwidth = src_surface->resource.width; + UINT fbheight = src_surface->resource.height; struct wined3d_context *context; GLenum drawBuffer = GL_BACK; GLenum texture_target; @@ -2976,7 +4746,7 @@ static void fb_copy_to_texture_hwstretch(IWineD3DSurfaceImpl *dst_surface, IWine checkGLcall("glEnable(texture_target)"); /* For now invalidate the texture copy of the back buffer. Drawable and sysmem copy are untouched */ - src_surface->Flags &= ~SFLAG_INTEXTURE; + src_surface->flags &= ~SFLAG_INTEXTURE; } /* Make sure that the top pixel is always above the bottom pixel, and keep a separate upside down flag @@ -3064,18 +4834,18 @@ static void fb_copy_to_texture_hwstretch(IWineD3DSurfaceImpl *dst_surface, IWine left = src_rect->left; right = src_rect->right; - if (upsidedown) + if (!upsidedown) { - top = src_surface->currentDesc.Height - src_rect->top; - bottom = src_surface->currentDesc.Height - src_rect->bottom; + top = src_surface->resource.height - src_rect->top; + bottom = src_surface->resource.height - src_rect->bottom; } else { - top = src_surface->currentDesc.Height - src_rect->bottom; - bottom = src_surface->currentDesc.Height - src_rect->top; + top = src_surface->resource.height - src_rect->bottom; + bottom = src_surface->resource.height - src_rect->top; } - if (src_surface->Flags & SFLAG_NORMCOORD) + if (src_surface->flags & SFLAG_NORMCOORD) { left /= src_surface->pow2Width; right /= src_surface->pow2Width; @@ -3093,19 +4863,19 @@ static void fb_copy_to_texture_hwstretch(IWineD3DSurfaceImpl *dst_surface, IWine glBegin(GL_QUADS); /* bottom left */ glTexCoord2f(left, bottom); - glVertex2i(0, fbheight); + glVertex2i(0, 0); /* top left */ glTexCoord2f(left, top); - glVertex2i(0, fbheight - dst_rect.bottom - dst_rect.top); + glVertex2i(0, dst_rect.bottom - dst_rect.top); /* top right */ glTexCoord2f(right, top); - glVertex2i(dst_rect.right - dst_rect.left, fbheight - dst_rect.bottom - dst_rect.top); + glVertex2i(dst_rect.right - dst_rect.left, dst_rect.bottom - dst_rect.top); /* bottom right */ glTexCoord2f(right, bottom); - glVertex2i(dst_rect.right - dst_rect.left, fbheight); + glVertex2i(dst_rect.right - dst_rect.left, 0); glEnd(); checkGLcall("glEnd and previous"); @@ -3151,21 +4921,21 @@ static void fb_copy_to_texture_hwstretch(IWineD3DSurfaceImpl *dst_surface, IWine glBegin(GL_QUADS); /* top left */ - glTexCoord2f(0.0f, (float)fbheight / (float)src_surface->pow2Height); - glVertex2i(0, 0); - - /* bottom left */ glTexCoord2f(0.0f, 0.0f); glVertex2i(0, fbheight); - /* bottom right */ - glTexCoord2f((float)fbwidth / (float)src_surface->pow2Width, 0.0f); - glVertex2i(fbwidth, src_surface->currentDesc.Height); + /* bottom left */ + glTexCoord2f(0.0f, (float)fbheight / (float)src_surface->pow2Height); + glVertex2i(0, 0); - /* top right */ + /* bottom right */ glTexCoord2f((float)fbwidth / (float)src_surface->pow2Width, (float)fbheight / (float)src_surface->pow2Height); glVertex2i(fbwidth, 0); + + /* top right */ + glTexCoord2f((float)fbwidth / (float)src_surface->pow2Width, 0.0f); + glVertex2i(fbwidth, fbheight); glEnd(); } glDisable(texture_target); @@ -3194,40 +4964,40 @@ static void fb_copy_to_texture_hwstretch(IWineD3DSurfaceImpl *dst_surface, IWine surface_modify_location(dst_surface, SFLAG_INTEXTURE, TRUE); } -/* Until the blit_shader is ready, define some prototypes here. */ -static BOOL fbo_blit_supported(const struct wined3d_gl_info *gl_info, enum blit_operation blit_op, - const RECT *src_rect, DWORD src_usage, WINED3DPOOL src_pool, const struct wined3d_format *src_format, - const RECT *dst_rect, DWORD dst_usage, WINED3DPOOL dst_pool, const struct wined3d_format *dst_format); - /* Front buffer coordinates are always full screen coordinates, but our GL * drawable is limited to the window's client area. The sysmem and texture * copies do have the full screen size. Note that GL has a bottom-left * origin, while D3D has a top-left origin. */ -void surface_translate_frontbuffer_coords(IWineD3DSurfaceImpl *surface, HWND window, RECT *rect) +void surface_translate_drawable_coords(struct wined3d_surface *surface, HWND window, RECT *rect) { - POINT offset = {0, surface->currentDesc.Height}; - RECT windowsize; + UINT drawable_height; - GetClientRect(window, &windowsize); - offset.y -= windowsize.bottom - windowsize.top; - ScreenToClient(window, &offset); - OffsetRect(rect, offset.x, offset.y); -} + if (surface->container.type == WINED3D_CONTAINER_SWAPCHAIN + && surface == surface->container.u.swapchain->front_buffer) + { + POINT offset = {0, 0}; + RECT windowsize; -static BOOL surface_is_full_rect(IWineD3DSurfaceImpl *surface, const RECT *r) -{ - if ((r->left && r->right) || abs(r->right - r->left) != surface->currentDesc.Width) - return FALSE; - if ((r->top && r->bottom) || abs(r->bottom - r->top) != surface->currentDesc.Height) - return FALSE; - return TRUE; + ScreenToClient(window, &offset); + OffsetRect(rect, offset.x, offset.y); + + GetClientRect(window, &windowsize); + drawable_height = windowsize.bottom - windowsize.top; + } + else + { + drawable_height = surface->resource.height; + } + + rect->top = drawable_height - rect->top; + rect->bottom = drawable_height - rect->bottom; } /* blit between surface locations. onscreen on different swapchains is not supported. * depth / stencil is not supported. */ -static void surface_blt_fbo(IWineD3DDeviceImpl *device, const WINED3DTEXTUREFILTERTYPE filter, - IWineD3DSurfaceImpl *src_surface, DWORD src_location, const RECT *src_rect_in, - IWineD3DSurfaceImpl *dst_surface, DWORD dst_location, const RECT *dst_rect_in) +static void surface_blt_fbo(struct wined3d_device *device, const WINED3DTEXTUREFILTERTYPE filter, + struct wined3d_surface *src_surface, DWORD src_location, const RECT *src_rect_in, + struct wined3d_surface *dst_surface, DWORD dst_location, const RECT *dst_rect_in) { const struct wined3d_gl_info *gl_info; struct wined3d_context *context; @@ -3289,11 +5059,7 @@ static void surface_blt_fbo(IWineD3DDeviceImpl *device, const WINED3DTEXTUREFILT TRACE("Source surface %p is onscreen.\n", src_surface); - if (buffer == GL_FRONT) - surface_translate_frontbuffer_coords(src_surface, context->win_handle, &src_rect); - - src_rect.top = src_surface->currentDesc.Height - src_rect.top; - src_rect.bottom = src_surface->currentDesc.Height - src_rect.bottom; + surface_translate_drawable_coords(src_surface, context->win_handle, &src_rect); ENTER_GL(); context_bind_fbo(context, GL_READ_FRAMEBUFFER, NULL); @@ -3308,6 +5074,7 @@ static void surface_blt_fbo(IWineD3DDeviceImpl *device, const WINED3DTEXTUREFILT glReadBuffer(GL_COLOR_ATTACHMENT0); checkGLcall("glReadBuffer()"); } + context_check_fbo_status(context, GL_READ_FRAMEBUFFER); LEAVE_GL(); if (dst_location == SFLAG_INDRAWABLE) @@ -3316,11 +5083,7 @@ static void surface_blt_fbo(IWineD3DDeviceImpl *device, const WINED3DTEXTUREFILT TRACE("Destination surface %p is onscreen.\n", dst_surface); - if (buffer == GL_FRONT) - surface_translate_frontbuffer_coords(dst_surface, context->win_handle, &dst_rect); - - dst_rect.top = dst_surface->currentDesc.Height - dst_rect.top; - dst_rect.bottom = dst_surface->currentDesc.Height - dst_rect.bottom; + surface_translate_drawable_coords(dst_surface, context->win_handle, &dst_rect); ENTER_GL(); context_bind_fbo(context, GL_DRAW_FRAMEBUFFER, NULL); @@ -3334,6 +5097,7 @@ static void surface_blt_fbo(IWineD3DDeviceImpl *device, const WINED3DTEXTUREFILT context_apply_fbo_state_blit(context, GL_DRAW_FRAMEBUFFER, dst_surface, NULL, dst_location); context_set_draw_buffer(context, GL_COLOR_ATTACHMENT0); } + context_check_fbo_status(context, GL_DRAW_FRAMEBUFFER); glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); IWineD3DDeviceImpl_MarkStateDirty(device, STATE_RENDER(WINED3DRS_COLORWRITEENABLE)); @@ -3350,18 +5114,90 @@ static void surface_blt_fbo(IWineD3DDeviceImpl *device, const WINED3DTEXTUREFILT LEAVE_GL(); - if (wined3d_settings.strict_draw_ordering) wglFlush(); /* Flush to ensure ordering across contexts. */ + if (wined3d_settings.strict_draw_ordering + || (dst_location == SFLAG_INDRAWABLE + && dst_surface->container.u.swapchain->front_buffer == dst_surface)) + wglFlush(); + + context_release(context); +} + +static void surface_blt_to_drawable(struct wined3d_device *device, + WINED3DTEXTUREFILTERTYPE filter, BOOL color_key, + struct wined3d_surface *src_surface, const RECT *src_rect_in, + struct wined3d_surface *dst_surface, const RECT *dst_rect_in) +{ + struct wined3d_context *context; + RECT src_rect, dst_rect; + + src_rect = *src_rect_in; + dst_rect = *dst_rect_in; + + /* Make sure the surface is up-to-date. This should probably use + * surface_load_location() and worry about the destination surface too, + * unless we're overwriting it completely. */ + surface_internal_preload(src_surface, SRGB_RGB); + + /* Activate the destination context, set it up for blitting */ + context = context_acquire(device, dst_surface); + context_apply_blit_state(context, device); + + if (!surface_is_offscreen(dst_surface)) + surface_translate_drawable_coords(dst_surface, context->win_handle, &dst_rect); + + device->blitter->set_shader(device->blit_priv, context->gl_info, src_surface); + + ENTER_GL(); + + if (color_key) + { + glEnable(GL_ALPHA_TEST); + checkGLcall("glEnable(GL_ALPHA_TEST)"); + + /* When the primary render target uses P8, the alpha component + * contains the palette index. Which means that the colorkey is one of + * the palette entries. In other cases pixels that should be masked + * away have alpha set to 0. */ + if (primary_render_target_is_p8(device)) + glAlphaFunc(GL_NOTEQUAL, (float)src_surface->SrcBltCKey.dwColorSpaceLowValue / 256.0f); + else + glAlphaFunc(GL_NOTEQUAL, 0.0f); + checkGLcall("glAlphaFunc"); + } + else + { + glDisable(GL_ALPHA_TEST); + checkGLcall("glDisable(GL_ALPHA_TEST)"); + } + + draw_textured_quad(src_surface, &src_rect, &dst_rect, filter); + + if (color_key) + { + glDisable(GL_ALPHA_TEST); + checkGLcall("glDisable(GL_ALPHA_TEST)"); + } + + LEAVE_GL(); + + /* Leave the opengl state valid for blitting */ + device->blitter->unset_shader(context->gl_info); + + if (wined3d_settings.strict_draw_ordering + || (dst_surface->container.type == WINED3D_CONTAINER_SWAPCHAIN + && (dst_surface->container.u.swapchain->front_buffer == dst_surface))) + wglFlush(); /* Flush to ensure ordering across contexts. */ context_release(context); } /* Do not call while under the GL lock. */ -HRESULT surface_color_fill(IWineD3DSurfaceImpl *s, const RECT *rect, const WINED3DCOLORVALUE *color) +HRESULT surface_color_fill(struct wined3d_surface *s, const RECT *rect, const WINED3DCOLORVALUE *color) { - IWineD3DDeviceImpl *device = s->resource.device; + struct wined3d_device *device = s->resource.device; const struct blit_shader *blitter; - blitter = wined3d_select_blitter(&device->adapter->gl_info, BLIT_OP_COLOR_FILL, + blitter = wined3d_select_blitter(&device->adapter->gl_info, WINED3D_BLIT_OP_COLOR_FILL, NULL, 0, 0, NULL, rect, s->resource.usage, s->resource.pool, s->resource.format); if (!blitter) { @@ -3372,20 +5208,19 @@ HRESULT surface_color_fill(IWineD3DSurfaceImpl *s, const RECT *rect, const WINED return blitter->color_fill(device, s, rect, color); } -/* Not called from the VTable */ /* Do not call while under the GL lock. */ -static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *dst_surface, const RECT *DestRect, - IWineD3DSurfaceImpl *src_surface, const RECT *SrcRect, DWORD Flags, const WINEDDBLTFX *DDBltFx, +static HRESULT IWineD3DSurfaceImpl_BltOverride(struct wined3d_surface *dst_surface, const RECT *DestRect, + struct wined3d_surface *src_surface, const RECT *SrcRect, DWORD flags, const WINEDDBLTFX *DDBltFx, WINED3DTEXTUREFILTERTYPE Filter) { - IWineD3DDeviceImpl *device = dst_surface->resource.device; + struct wined3d_device *device = dst_surface->resource.device; const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; - IWineD3DSwapChainImpl *srcSwapchain = NULL, *dstSwapchain = NULL; + struct wined3d_swapchain *srcSwapchain = NULL, *dstSwapchain = NULL; RECT dst_rect, src_rect; TRACE("dst_surface %p, dst_rect %s, src_surface %p, src_rect %s, flags %#x, blt_fx %p, filter %s.\n", dst_surface, wine_dbgstr_rect(DestRect), src_surface, wine_dbgstr_rect(SrcRect), - Flags, DDBltFx, debug_d3dtexturefiltertype(Filter)); + flags, DDBltFx, debug_d3dtexturefiltertype(Filter)); /* Get the swapchain. One of the surfaces has to be a primary surface */ if (dst_surface->resource.pool == WINED3DPOOL_SYSTEMMEM) @@ -3411,15 +5246,16 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *dst_surface, /* Early sort out of cases where no render target is used */ if (!dstSwapchain && !srcSwapchain - && src_surface != device->render_targets[0] - && dst_surface != device->render_targets[0]) + && src_surface != device->fb.render_targets[0] + && dst_surface != device->fb.render_targets[0]) { TRACE("No surface is render target, not using hardware blit.\n"); return WINED3DERR_INVALIDCALL; } /* No destination color keying supported */ - if(Flags & (WINEDDBLT_KEYDEST | WINEDDBLT_KEYDESTOVERRIDE)) { + if (flags & (WINEDDBLT_KEYDEST | WINEDDBLT_KEYDESTOVERRIDE)) + { /* Can we support that with glBlendFunc if blitting to the frame buffer? */ TRACE("Destination color key not supported in accelerated Blit, falling back to software\n"); return WINED3DERR_INVALIDCALL; @@ -3445,8 +5281,8 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *dst_surface, TRACE("Looking if a Present can be done...\n"); /* Source Rectangle must be full surface */ if (src_rect.left || src_rect.top - || src_rect.right != src_surface->currentDesc.Width - || src_rect.bottom != src_surface->currentDesc.Height) + || src_rect.right != src_surface->resource.width + || src_rect.bottom != src_surface->resource.height) { TRACE("No, Source rectangle doesn't match\n"); break; @@ -3460,16 +5296,16 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *dst_surface, } /* Destination must be full surface or match the clipping rectangle */ - if (dst_surface->clipper && ((IWineD3DClipperImpl *)dst_surface->clipper)->hWnd) + if (dst_surface->clipper && dst_surface->clipper->hWnd) { RECT cliprect; POINT pos[2]; - GetClientRect(((IWineD3DClipperImpl *)dst_surface->clipper)->hWnd, &cliprect); + GetClientRect(dst_surface->clipper->hWnd, &cliprect); pos[0].x = dst_rect.left; pos[0].y = dst_rect.top; pos[1].x = dst_rect.right; pos[1].y = dst_rect.bottom; - MapWindowPoints(GetDesktopWindow(), ((IWineD3DClipperImpl *)dst_surface->clipper)->hWnd, pos, 2); + MapWindowPoints(GetDesktopWindow(), dst_surface->clipper->hWnd, pos, 2); if(pos[0].x != cliprect.left || pos[0].y != cliprect.top || pos[1].x != cliprect.right || pos[1].y != cliprect.bottom) @@ -3481,8 +5317,8 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *dst_surface, } } else if (dst_rect.left || dst_rect.top - || dst_rect.right != dst_surface->currentDesc.Width - || dst_rect.bottom != dst_surface->currentDesc.Height) + || dst_rect.right != dst_surface->resource.width + || dst_rect.bottom != dst_surface->resource.height) { TRACE("No, dest rectangle doesn't match(surface size)\n"); break; @@ -3491,7 +5327,7 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *dst_surface, TRACE("Yes\n"); /* These flags are unimportant for the flag check, remove them */ - if (!(Flags & ~(WINEDDBLT_DONOTWAIT | WINEDDBLT_WAIT))) + if (!(flags & ~(WINEDDBLT_DONOTWAIT | WINEDDBLT_WAIT))) { WINED3DSWAPEFFECT orig_swap = dstSwapchain->presentParms.SwapEffect; @@ -3513,9 +5349,8 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *dst_surface, dstSwapchain->presentParms.SwapEffect = WINED3DSWAPEFFECT_COPY; dstSwapchain->presentParms.PresentationInterval = WINED3DPRESENT_INTERVAL_IMMEDIATE; - TRACE("Full screen back buffer -> front buffer blt, performing a flip instead\n"); - IWineD3DSwapChain_Present((IWineD3DSwapChain *)dstSwapchain, - NULL, NULL, dstSwapchain->win_handle, NULL, 0); + TRACE("Full screen back buffer -> front buffer blt, performing a flip instead.\n"); + wined3d_swapchain_present(dstSwapchain, NULL, NULL, dstSwapchain->win_handle, NULL, 0); dstSwapchain->presentParms.SwapEffect = orig_swap; @@ -3536,16 +5371,16 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *dst_surface, else if (dstSwapchain) { /* Handled with regular texture -> swapchain blit */ - if (src_surface == device->render_targets[0]) + if (src_surface == device->fb.render_targets[0]) TRACE("Blit from active render target to a swapchain\n"); } - else if (srcSwapchain && dst_surface == device->render_targets[0]) + else if (srcSwapchain && dst_surface == device->fb.render_targets[0]) { FIXME("Implement blit from a swapchain to the active render target\n"); return WINED3DERR_INVALIDCALL; } - if ((srcSwapchain || src_surface == device->render_targets[0]) && !dstSwapchain) + if ((srcSwapchain || src_surface == device->fb.render_targets[0]) && !dstSwapchain) { /* Blit from render target to texture */ BOOL stretchx; @@ -3558,7 +5393,8 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *dst_surface, return WINED3DERR_INVALIDCALL; } - if(Flags & (WINEDDBLT_KEYSRC | WINEDDBLT_KEYSRCOVERRIDE)) { + if (flags & (WINEDDBLT_KEYSRC | WINEDDBLT_KEYSRCOVERRIDE)) + { TRACE("Color keying not supported by frame buffer to texture blit\n"); return WINED3DERR_INVALIDCALL; /* Destination color key is checked above */ @@ -3583,9 +5419,8 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *dst_surface, * * If EXT_framebuffer_blit is supported that can be used instead. Note that EXT_framebuffer_blit implies * FBO support, so it doesn't really make sense to try and make it work with different offscreen rendering - * backends. - */ - if (fbo_blit_supported(gl_info, BLIT_OP_BLIT, + * backends. */ + if (fbo_blit_supported(gl_info, WINED3D_BLIT_OP_COLOR_BLIT, &src_rect, src_surface->resource.usage, src_surface->resource.pool, src_surface->resource.format, &dst_rect, dst_surface->resource.usage, dst_surface->resource.pool, dst_surface->resource.format)) { @@ -3594,8 +5429,8 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *dst_surface, dst_surface, SFLAG_INDRAWABLE, &dst_rect); surface_modify_location(dst_surface, SFLAG_INDRAWABLE, TRUE); } - else if (!stretchx || dst_rect.right - dst_rect.left > src_surface->currentDesc.Width - || dst_rect.bottom - dst_rect.top > src_surface->currentDesc.Height) + else if (!stretchx || dst_rect.right - dst_rect.left > src_surface->resource.width + || dst_rect.bottom - dst_rect.top > src_surface->resource.height) { TRACE("No stretching in x direction, using direct framebuffer -> texture copy\n"); fb_copy_to_texture_direct(dst_surface, src_surface, &src_rect, &dst_rect, Filter); @@ -3604,7 +5439,7 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *dst_surface, fb_copy_to_texture_hwstretch(dst_surface, src_surface, &src_rect, &dst_rect, Filter); } - if (!(dst_surface->Flags & SFLAG_DONOTFREE)) + if (!(dst_surface->flags & SFLAG_DONOTFREE)) { HeapFree(GetProcessHeap(), 0, dst_surface->resource.heapMemory); dst_surface->resource.allocatedMemory = NULL; @@ -3612,7 +5447,7 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *dst_surface, } else { - dst_surface->Flags &= ~SFLAG_INSYSMEM; + dst_surface->flags &= ~SFLAG_INSYSMEM; } return WINED3D_OK; @@ -3622,12 +5457,11 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *dst_surface, /* Blit from offscreen surface to render target */ DWORD oldCKeyFlags = src_surface->CKeyFlags; WINEDDCOLORKEY oldBltCKey = src_surface->SrcBltCKey; - struct wined3d_context *context; TRACE("Blt from surface %p to rendertarget %p\n", src_surface, dst_surface); - if (!(Flags & (WINEDDBLT_KEYSRC | WINEDDBLT_KEYSRCOVERRIDE)) - && fbo_blit_supported(gl_info, BLIT_OP_BLIT, + if (!(flags & (WINEDDBLT_KEYSRC | WINEDDBLT_KEYSRCOVERRIDE)) + && fbo_blit_supported(gl_info, WINED3D_BLIT_OP_COLOR_BLIT, &src_rect, src_surface->resource.usage, src_surface->resource.pool, src_surface->resource.format, &dst_rect, dst_surface->resource.usage, dst_surface->resource.pool, @@ -3643,14 +5477,23 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *dst_surface, return WINED3D_OK; } - if (!(Flags & (WINEDDBLT_KEYSRC | WINEDDBLT_KEYSRCOVERRIDE)) - && arbfp_blit.blit_supported(gl_info, BLIT_OP_BLIT, + if (!(flags & (WINEDDBLT_KEYSRC | WINEDDBLT_KEYSRCOVERRIDE)) + && arbfp_blit.blit_supported(gl_info, WINED3D_BLIT_OP_COLOR_BLIT, &src_rect, src_surface->resource.usage, src_surface->resource.pool, src_surface->resource.format, &dst_rect, dst_surface->resource.usage, dst_surface->resource.pool, dst_surface->resource.format)) { - return arbfp_blit_surface(device, src_surface, &src_rect, dst_surface, &dst_rect, BLIT_OP_BLIT, Filter); + return arbfp_blit_surface(device, src_surface, &src_rect, dst_surface, &dst_rect, + WINED3D_BLIT_OP_COLOR_BLIT, Filter); + } + + if (!device->blitter->blit_supported(gl_info, WINED3D_BLIT_OP_COLOR_BLIT, + &src_rect, src_surface->resource.usage, src_surface->resource.pool, src_surface->resource.format, + &dst_rect, dst_surface->resource.usage, dst_surface->resource.pool, dst_surface->resource.format)) + { + FIXME("Unsupported blit operation falling back to software\n"); + return WINED3DERR_INVALIDCALL; } /* Color keying: Check if we have to do a color keyed blt, @@ -3660,86 +5503,29 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *dst_surface, * The surface keeps track of the color key last used to load the opengl surface. * PreLoad will catch the change to the flags and color key and reload if necessary. */ - if(Flags & WINEDDBLT_KEYSRC) { + if (flags & WINEDDBLT_KEYSRC) + { /* Use color key from surface */ - } else if(Flags & WINEDDBLT_KEYSRCOVERRIDE) { + } + else if (flags & WINEDDBLT_KEYSRCOVERRIDE) + { /* Use color key from DDBltFx */ src_surface->CKeyFlags |= WINEDDSD_CKSRCBLT; src_surface->SrcBltCKey = DDBltFx->ddckSrcColorkey; - } else { + } + else + { /* Do not use color key */ src_surface->CKeyFlags &= ~WINEDDSD_CKSRCBLT; } - /* Now load the surface */ - surface_internal_preload(src_surface, SRGB_RGB); - - /* Activate the destination context, set it up for blitting */ - context = context_acquire(device, dst_surface); - context_apply_blit_state(context, device); - - if (dstSwapchain && dst_surface == dstSwapchain->front_buffer) - surface_translate_frontbuffer_coords(dst_surface, context->win_handle, &dst_rect); - - if (!device->blitter->blit_supported(gl_info, BLIT_OP_BLIT, - &src_rect, src_surface->resource.usage, src_surface->resource.pool, src_surface->resource.format, - &dst_rect, dst_surface->resource.usage, dst_surface->resource.pool, dst_surface->resource.format)) - { - FIXME("Unsupported blit operation falling back to software\n"); - return WINED3DERR_INVALIDCALL; - } - - device->blitter->set_shader((IWineD3DDevice *)device, src_surface); - - ENTER_GL(); - - /* This is for color keying */ - if(Flags & (WINEDDBLT_KEYSRC | WINEDDBLT_KEYSRCOVERRIDE)) { - glEnable(GL_ALPHA_TEST); - checkGLcall("glEnable(GL_ALPHA_TEST)"); - - /* When the primary render target uses P8, the alpha component contains the palette index. - * Which means that the colorkey is one of the palette entries. In other cases pixels that - * should be masked away have alpha set to 0. */ - if (primary_render_target_is_p8(device)) - glAlphaFunc(GL_NOTEQUAL, (float)src_surface->SrcBltCKey.dwColorSpaceLowValue / 256.0f); - else - glAlphaFunc(GL_NOTEQUAL, 0.0f); - checkGLcall("glAlphaFunc"); - } else { - glDisable(GL_ALPHA_TEST); - checkGLcall("glDisable(GL_ALPHA_TEST)"); - } - - /* Draw a textured quad - */ - draw_textured_quad(src_surface, &src_rect, &dst_rect, Filter); - - if(Flags & (WINEDDBLT_KEYSRC | WINEDDBLT_KEYSRCOVERRIDE)) { - glDisable(GL_ALPHA_TEST); - checkGLcall("glDisable(GL_ALPHA_TEST)"); - } + surface_blt_to_drawable(device, Filter, flags & (WINEDDBLT_KEYSRC | WINEDDBLT_KEYSRCOVERRIDE), + src_surface, &src_rect, dst_surface, &dst_rect); /* Restore the color key parameters */ src_surface->CKeyFlags = oldCKeyFlags; src_surface->SrcBltCKey = oldBltCKey; - LEAVE_GL(); - - /* Leave the opengl state valid for blitting */ - device->blitter->unset_shader((IWineD3DDevice *)device); - - if (wined3d_settings.strict_draw_ordering || (dstSwapchain - && (dst_surface == dstSwapchain->front_buffer - || dstSwapchain->num_contexts > 1))) - wglFlush(); /* Flush to ensure ordering across contexts. */ - - context_release(context); - - /* TODO: If the surface is locked often, perform the Blt in software on the memory instead */ - /* The surface is now in the drawable. On onscreen surfaces or without fbos the texture - * is outdated now - */ surface_modify_location(dst_surface, SFLAG_INDRAWABLE, TRUE); return WINED3D_OK; @@ -3747,7 +5533,7 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *dst_surface, else { /* Source-Less Blit to render target */ - if (Flags & WINEDDBLT_COLORFILL) + if (flags & WINEDDBLT_COLORFILL) { WINED3DCOLORVALUE color; @@ -3766,305 +5552,15 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *dst_surface, return WINED3DERR_INVALIDCALL; } -static HRESULT IWineD3DSurfaceImpl_BltZ(IWineD3DSurfaceImpl *This, const RECT *DestRect, - IWineD3DSurface *src_surface, const RECT *src_rect, DWORD Flags, const WINEDDBLTFX *DDBltFx) -{ - IWineD3DDeviceImpl *device = This->resource.device; - float depth; - - if (Flags & WINEDDBLT_DEPTHFILL) - { - switch (This->resource.format->id) - { - case WINED3DFMT_D16_UNORM: - depth = (float) DDBltFx->u5.dwFillDepth / (float) 0x0000ffff; - break; - case WINED3DFMT_S1_UINT_D15_UNORM: - depth = (float) DDBltFx->u5.dwFillDepth / (float) 0x00007fff; - break; - case WINED3DFMT_D24_UNORM_S8_UINT: - case WINED3DFMT_X8D24_UNORM: - depth = (float) DDBltFx->u5.dwFillDepth / (float) 0x00ffffff; - break; - case WINED3DFMT_D32_UNORM: - depth = (float) DDBltFx->u5.dwFillDepth / (float) 0xffffffff; - break; - default: - depth = 0.0f; - ERR("Unexpected format for depth fill: %s.\n", debug_d3dformat(This->resource.format->id)); - } - - return IWineD3DDevice_Clear((IWineD3DDevice *)device, DestRect ? 1 : 0, DestRect, - WINED3DCLEAR_ZBUFFER, 0x00000000, depth, 0x00000000); - } - - FIXME("(%p): Unsupp depthstencil blit\n", This); - return WINED3DERR_INVALIDCALL; -} - -static HRESULT WINAPI IWineD3DSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT *DestRect, - IWineD3DSurface *src_surface, const RECT *SrcRect, DWORD Flags, - const WINEDDBLTFX *DDBltFx, WINED3DTEXTUREFILTERTYPE Filter) -{ - IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface; - IWineD3DSurfaceImpl *src = (IWineD3DSurfaceImpl *)src_surface; - IWineD3DDeviceImpl *device = This->resource.device; - - TRACE("iface %p, dst_rect %s, src_surface %p, src_rect %s, flags %#x, fx %p, filter %s.\n", - iface, wine_dbgstr_rect(DestRect), src_surface, wine_dbgstr_rect(SrcRect), - Flags, DDBltFx, debug_d3dtexturefiltertype(Filter)); - TRACE("Usage is %s.\n", debug_d3dusage(This->resource.usage)); - - if ((This->Flags & SFLAG_LOCKED) || (src && (src->Flags & SFLAG_LOCKED))) - { - WARN(" Surface is busy, returning DDERR_SURFACEBUSY\n"); - return WINEDDERR_SURFACEBUSY; - } - - /* Accessing the depth stencil is supposed to fail between a BeginScene and EndScene pair, - * except depth blits, which seem to work - */ - if (This == device->depth_stencil || (src && src == device->depth_stencil)) - { - if (device->inScene && !(Flags & WINEDDBLT_DEPTHFILL)) - { - TRACE("Attempt to access the depth stencil surface in a BeginScene / EndScene pair, returning WINED3DERR_INVALIDCALL\n"); - return WINED3DERR_INVALIDCALL; - } - else if (SUCCEEDED(IWineD3DSurfaceImpl_BltZ(This, DestRect, src_surface, SrcRect, Flags, DDBltFx))) - { - TRACE("Z Blit override handled the blit\n"); - return WINED3D_OK; - } - } - - /* Special cases for RenderTargets */ - if ((This->resource.usage & WINED3DUSAGE_RENDERTARGET) - || (src && (src->resource.usage & WINED3DUSAGE_RENDERTARGET))) - { - if (SUCCEEDED(IWineD3DSurfaceImpl_BltOverride(This, DestRect, src, SrcRect, Flags, DDBltFx, Filter))) - return WINED3D_OK; - } - - /* For the rest call the X11 surface implementation. - * For RenderTargets this should be implemented OpenGL accelerated in BltOverride, - * other Blts are rather rare. */ - return IWineD3DBaseSurfaceImpl_Blt(iface, DestRect, src_surface, SrcRect, Flags, DDBltFx, Filter); -} - -static HRESULT WINAPI IWineD3DSurfaceImpl_BltFast(IWineD3DSurface *iface, DWORD dstx, DWORD dsty, - IWineD3DSurface *src_surface, const RECT *rsrc, DWORD trans) -{ - IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface; - IWineD3DSurfaceImpl *src = (IWineD3DSurfaceImpl *)src_surface; - IWineD3DDeviceImpl *device = This->resource.device; - - TRACE("iface %p, dst_x %u, dst_y %u, src_surface %p, src_rect %s, flags %#x.\n", - iface, dstx, dsty, src_surface, wine_dbgstr_rect(rsrc), trans); - - if ((This->Flags & SFLAG_LOCKED) || (src->Flags & SFLAG_LOCKED)) - { - WARN(" Surface is busy, returning DDERR_SURFACEBUSY\n"); - return WINEDDERR_SURFACEBUSY; - } - - if (device->inScene && (This == device->depth_stencil || src == device->depth_stencil)) - { - TRACE("Attempt to access the depth stencil surface in a BeginScene / EndScene pair, returning WINED3DERR_INVALIDCALL\n"); - return WINED3DERR_INVALIDCALL; - } - - /* Special cases for RenderTargets */ - if ((This->resource.usage & WINED3DUSAGE_RENDERTARGET) - || (src->resource.usage & WINED3DUSAGE_RENDERTARGET)) - { - - RECT SrcRect, DstRect; - DWORD Flags=0; - - surface_get_rect(src, rsrc, &SrcRect); - - DstRect.left = dstx; - DstRect.top=dsty; - DstRect.right = dstx + SrcRect.right - SrcRect.left; - DstRect.bottom = dsty + SrcRect.bottom - SrcRect.top; - - /* Convert BltFast flags into Btl ones because it is called from SurfaceImpl_Blt as well */ - if(trans & WINEDDBLTFAST_SRCCOLORKEY) - Flags |= WINEDDBLT_KEYSRC; - if(trans & WINEDDBLTFAST_DESTCOLORKEY) - Flags |= WINEDDBLT_KEYDEST; - if(trans & WINEDDBLTFAST_WAIT) - Flags |= WINEDDBLT_WAIT; - if(trans & WINEDDBLTFAST_DONOTWAIT) - Flags |= WINEDDBLT_DONOTWAIT; - - if (SUCCEEDED(IWineD3DSurfaceImpl_BltOverride(This, - &DstRect, src, &SrcRect, Flags, NULL, WINED3DTEXF_POINT))) - return WINED3D_OK; - } - - return IWineD3DBaseSurfaceImpl_BltFast(iface, dstx, dsty, src_surface, rsrc, trans); -} - -static HRESULT WINAPI IWineD3DSurfaceImpl_RealizePalette(IWineD3DSurface *iface) -{ - IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface; - RGBQUAD col[256]; - IWineD3DPaletteImpl *pal = This->palette; - unsigned int n; - TRACE("(%p)\n", This); - - if (!pal) return WINED3D_OK; - - if (This->resource.format->id == WINED3DFMT_P8_UINT - || This->resource.format->id == WINED3DFMT_P8_UINT_A8_UNORM) - { - if (This->resource.usage & WINED3DUSAGE_RENDERTARGET) - { - /* Make sure the texture is up to date. This call doesn't do - * anything if the texture is already up to date. */ - surface_load_location(This, SFLAG_INTEXTURE, NULL); - - /* We want to force a palette refresh, so mark the drawable as not being up to date */ - surface_modify_location(This, SFLAG_INDRAWABLE, FALSE); - } - else - { - if (!(This->Flags & SFLAG_INSYSMEM)) - { - TRACE("Palette changed with surface that does not have an up to date system memory copy.\n"); - surface_load_location(This, SFLAG_INSYSMEM, NULL); - } - TRACE("Dirtifying surface\n"); - surface_modify_location(This, SFLAG_INSYSMEM, TRUE); - } - } - - if(This->Flags & SFLAG_DIBSECTION) { - TRACE("(%p): Updating the hdc's palette\n", This); - for (n=0; n<256; n++) { - col[n].rgbRed = pal->palents[n].peRed; - col[n].rgbGreen = pal->palents[n].peGreen; - col[n].rgbBlue = pal->palents[n].peBlue; - col[n].rgbReserved = 0; - } - SetDIBColorTable(This->hDC, 0, 256, col); - } - - /* Propagate the changes to the drawable when we have a palette. */ - if (This->resource.usage & WINED3DUSAGE_RENDERTARGET) - surface_load_location(This, SFLAG_INDRAWABLE, NULL); - - return WINED3D_OK; -} - -static HRESULT WINAPI IWineD3DSurfaceImpl_PrivateSetup(IWineD3DSurface *iface) { - /** Check against the maximum texture sizes supported by the video card **/ - IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface; - const struct wined3d_gl_info *gl_info = &This->resource.device->adapter->gl_info; - unsigned int pow2Width, pow2Height; - - This->texture_name = 0; - This->texture_target = GL_TEXTURE_2D; - - /* Non-power2 support */ - if (gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO] || gl_info->supported[WINED3D_GL_NORMALIZED_TEXRECT]) - { - pow2Width = This->currentDesc.Width; - pow2Height = This->currentDesc.Height; - } - else - { - /* Find the nearest pow2 match */ - pow2Width = pow2Height = 1; - while (pow2Width < This->currentDesc.Width) pow2Width <<= 1; - while (pow2Height < This->currentDesc.Height) pow2Height <<= 1; - } - This->pow2Width = pow2Width; - This->pow2Height = pow2Height; - - if (pow2Width > This->currentDesc.Width || pow2Height > This->currentDesc.Height) - { - /* TODO: Add support for non power two compressed textures. */ - if (This->resource.format->Flags & WINED3DFMT_FLAG_COMPRESSED) - { - FIXME("(%p) Compressed non-power-two textures are not supported w(%d) h(%d)\n", - This, This->currentDesc.Width, This->currentDesc.Height); - return WINED3DERR_NOTAVAILABLE; - } - } - - if(pow2Width != This->currentDesc.Width || - pow2Height != This->currentDesc.Height) { - This->Flags |= SFLAG_NONPOW2; - } - - TRACE("%p\n", This); - if ((This->pow2Width > gl_info->limits.texture_size || This->pow2Height > gl_info->limits.texture_size) - && !(This->resource.usage & (WINED3DUSAGE_RENDERTARGET | WINED3DUSAGE_DEPTHSTENCIL))) - { - /* one of three options - 1: Do the same as we do with nonpow 2 and scale the texture, (any texture ops would require the texture to be scaled which is potentially slow) - 2: Set the texture to the maximum size (bad idea) - 3: WARN and return WINED3DERR_NOTAVAILABLE; - 4: Create the surface, but allow it to be used only for DirectDraw Blts. Some apps(e.g. Swat 3) create textures with a Height of 16 and a Width > 3000 and blt 16x16 letter areas from them to the render target. - */ - if(This->resource.pool == WINED3DPOOL_DEFAULT || This->resource.pool == WINED3DPOOL_MANAGED) - { - WARN("(%p) Unable to allocate a surface which exceeds the maximum OpenGL texture size\n", This); - return WINED3DERR_NOTAVAILABLE; - } - - /* We should never use this surface in combination with OpenGL! */ - TRACE("(%p) Creating an oversized surface: %ux%u\n", This, This->pow2Width, This->pow2Height); - } - else - { - /* Don't use ARB_TEXTURE_RECTANGLE in case the surface format is P8 and EXT_PALETTED_TEXTURE - is used in combination with texture uploads (RTL_READTEX/RTL_TEXTEX). The reason is that EXT_PALETTED_TEXTURE - doesn't work in combination with ARB_TEXTURE_RECTANGLE. - */ - if (This->Flags & SFLAG_NONPOW2 && gl_info->supported[ARB_TEXTURE_RECTANGLE] - && !(This->resource.format->id == WINED3DFMT_P8_UINT - && gl_info->supported[EXT_PALETTED_TEXTURE] - && wined3d_settings.rendertargetlock_mode == RTL_READTEX)) - { - This->texture_target = GL_TEXTURE_RECTANGLE_ARB; - This->pow2Width = This->currentDesc.Width; - This->pow2Height = This->currentDesc.Height; - This->Flags &= ~(SFLAG_NONPOW2 | SFLAG_NORMCOORD); - } - } - - switch (wined3d_settings.offscreen_rendering_mode) - { - case ORM_FBO: - This->get_drawable_size = get_drawable_size_fbo; - break; - - case ORM_BACKBUFFER: - This->get_drawable_size = get_drawable_size_backbuffer; - break; - - default: - ERR("Unhandled offscreen rendering mode %#x.\n", wined3d_settings.offscreen_rendering_mode); - return WINED3DERR_INVALIDCALL; - } - - This->Flags |= SFLAG_INSYSMEM; - - return WINED3D_OK; -} - /* GL locking is done by the caller */ -static void surface_depth_blt(IWineD3DSurfaceImpl *This, const struct wined3d_gl_info *gl_info, +static void surface_depth_blt(struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info, GLuint texture, GLsizei w, GLsizei h, GLenum target) { - IWineD3DDeviceImpl *device = This->resource.device; + struct wined3d_device *device = surface->resource.device; GLint compare_mode = GL_NONE; struct blt_info info; GLint old_binding = 0; + RECT rect; glPushAttrib(GL_ENABLE_BIT | GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_VIEWPORT_BIT); @@ -4077,9 +5573,10 @@ static void surface_depth_blt(IWineD3DSurfaceImpl *This, const struct wined3d_gl glDepthFunc(GL_ALWAYS); glDepthMask(GL_TRUE); glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); - glViewport(0, 0, w, h); + glViewport(0, surface->pow2Height - h, w, h); - surface_get_blt_info(target, NULL, w, h, &info); + SetRect(&rect, 0, h, w, 0); + surface_get_blt_info(target, &rect, surface->pow2Width, surface->pow2Height, &info); GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB)); glGetIntegerv(info.binding, &old_binding); glBindTexture(info.bind_target, texture); @@ -4089,8 +5586,8 @@ static void surface_depth_blt(IWineD3DSurfaceImpl *This, const struct wined3d_gl if (compare_mode != GL_NONE) glTexParameteri(info.bind_target, GL_TEXTURE_COMPARE_MODE_ARB, GL_NONE); } - device->shader_backend->shader_select_depth_blt((IWineD3DDevice *)device, - info.tex_type, &This->ds_current_size); + device->shader_backend->shader_select_depth_blt(device->shader_priv, + gl_info, info.tex_type, &surface->ds_current_size); glBegin(GL_TRIANGLE_STRIP); glTexCoord3fv(info.coords[0]); @@ -4108,10 +5605,10 @@ static void surface_depth_blt(IWineD3DSurfaceImpl *This, const struct wined3d_gl glPopAttrib(); - device->shader_backend->shader_deselect_depth_blt((IWineD3DDevice *)device); + device->shader_backend->shader_deselect_depth_blt(device->shader_priv, gl_info); } -void surface_modify_ds_location(IWineD3DSurfaceImpl *surface, +void surface_modify_ds_location(struct wined3d_surface *surface, DWORD location, UINT w, UINT h) { TRACE("surface %p, new location %#x, w %u, h %u.\n", surface, location, w, h); @@ -4121,29 +5618,37 @@ void surface_modify_ds_location(IWineD3DSurfaceImpl *surface, surface->ds_current_size.cx = w; surface->ds_current_size.cy = h; - surface->Flags &= ~SFLAG_DS_LOCATIONS; - surface->Flags |= location; + surface->flags &= ~SFLAG_DS_LOCATIONS; + surface->flags |= location; } /* Context activation is done by the caller. */ -void surface_load_ds_location(IWineD3DSurfaceImpl *surface, struct wined3d_context *context, DWORD location) +void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_context *context, DWORD location) { - IWineD3DDeviceImpl *device = surface->resource.device; + struct wined3d_device *device = surface->resource.device; const struct wined3d_gl_info *gl_info = context->gl_info; + GLsizei w, h; TRACE("surface %p, new location %#x.\n", surface, location); /* TODO: Make this work for modes other than FBO */ if (wined3d_settings.offscreen_rendering_mode != ORM_FBO) return; - if (!(surface->Flags & location)) + if (!(surface->flags & location)) { + w = surface->ds_current_size.cx; + h = surface->ds_current_size.cy; surface->ds_current_size.cx = 0; surface->ds_current_size.cy = 0; } + else + { + w = surface->resource.width; + h = surface->resource.height; + } - if (surface->ds_current_size.cx == surface->currentDesc.Width - && surface->ds_current_size.cy == surface->currentDesc.Height) + if (surface->ds_current_size.cx == surface->resource.width + && surface->ds_current_size.cy == surface->resource.height) { TRACE("Location (%#x) is already up to date.\n", location); return; @@ -4155,10 +5660,17 @@ void surface_load_ds_location(IWineD3DSurfaceImpl *surface, struct wined3d_conte return; } - if (!(surface->Flags & SFLAG_LOCATIONS)) + if (!(surface->flags & SFLAG_DS_LOCATIONS)) { + /* This mostly happens when a depth / stencil is used without being + * cleared first. In principle we could upload from sysmem, or + * explicitly clear before first usage. For the moment there don't + * appear to be a lot of applications depending on this, so a FIXME + * should do. */ FIXME("No up to date depth stencil location.\n"); - surface->Flags |= location; + surface->flags |= location; + surface->ds_current_size.cx = surface->resource.width; + surface->ds_current_size.cy = surface->resource.height; return; } @@ -4166,14 +5678,13 @@ void surface_load_ds_location(IWineD3DSurfaceImpl *surface, struct wined3d_conte { GLint old_binding = 0; GLenum bind_target; - GLsizei w, h; /* The render target is allowed to be smaller than the depth/stencil * buffer, so the onscreen depth/stencil buffer is potentially smaller * than the offscreen surface. Don't overwrite the offscreen surface * with undefined data. */ - w = min(surface->currentDesc.Width, context->swapchain->presentParms.BackBufferWidth); - h = min(surface->currentDesc.Height, context->swapchain->presentParms.BackBufferHeight); + w = min(w, context->swapchain->presentParms.BackBufferWidth); + h = min(h, context->swapchain->presentParms.BackBufferHeight); TRACE("Copying onscreen depth buffer to depth texture.\n"); @@ -4248,7 +5759,7 @@ void surface_load_ds_location(IWineD3DSurfaceImpl *surface, struct wined3d_conte context_bind_fbo(context, GL_FRAMEBUFFER, NULL); surface_depth_blt(surface, gl_info, surface->texture_name, - surface->currentDesc.Width, surface->currentDesc.Height, surface->texture_target); + w, h, surface->texture_target); checkGLcall("depth_blt"); if (context->current_fbo) context_bind_fbo(context, GL_FRAMEBUFFER, &context->current_fbo->id); @@ -4262,14 +5773,15 @@ void surface_load_ds_location(IWineD3DSurfaceImpl *surface, struct wined3d_conte ERR("Invalid location (%#x) specified.\n", location); } - surface->Flags |= location; - surface->ds_current_size.cx = surface->currentDesc.Width; - surface->ds_current_size.cy = surface->currentDesc.Height; + surface->flags |= location; + surface->ds_current_size.cx = surface->resource.width; + surface->ds_current_size.cy = surface->resource.height; } -void surface_modify_location(IWineD3DSurfaceImpl *surface, DWORD flag, BOOL persistent) +void surface_modify_location(struct wined3d_surface *surface, DWORD flag, BOOL persistent) { - IWineD3DSurfaceImpl *overlay; + const struct wined3d_gl_info *gl_info = &surface->resource.device->adapter->gl_info; + struct wined3d_surface *overlay; TRACE("surface %p, location %s, persistent %#x.\n", surface, debug_surflocation(flag), persistent); @@ -4287,93 +5799,75 @@ void surface_modify_location(IWineD3DSurfaceImpl *surface, DWORD flag, BOOL pers } } + if (flag & (SFLAG_INTEXTURE | SFLAG_INSRGBTEX) + && gl_info->supported[EXT_TEXTURE_SRGB_DECODE]) + { + flag |= (SFLAG_INTEXTURE | SFLAG_INSRGBTEX); + } + if (persistent) { - if (((surface->Flags & SFLAG_INTEXTURE) && !(flag & SFLAG_INTEXTURE)) - || ((surface->Flags & SFLAG_INSRGBTEX) && !(flag & SFLAG_INSRGBTEX))) + if (((surface->flags & SFLAG_INTEXTURE) && !(flag & SFLAG_INTEXTURE)) + || ((surface->flags & SFLAG_INSRGBTEX) && !(flag & SFLAG_INSRGBTEX))) { if (surface->container.type == WINED3D_CONTAINER_TEXTURE) { TRACE("Passing to container.\n"); - IWineD3DBaseTexture_SetDirty((IWineD3DBaseTexture *)surface->container.u.texture, TRUE); + wined3d_texture_set_dirty(surface->container.u.texture, TRUE); } } - surface->Flags &= ~SFLAG_LOCATIONS; - surface->Flags |= flag; + surface->flags &= ~SFLAG_LOCATIONS; + surface->flags |= flag; /* Redraw emulated overlays, if any */ if (flag & SFLAG_INDRAWABLE && !list_empty(&surface->overlays)) { - LIST_FOR_EACH_ENTRY(overlay, &surface->overlays, IWineD3DSurfaceImpl, overlay_entry) + LIST_FOR_EACH_ENTRY(overlay, &surface->overlays, struct wined3d_surface, overlay_entry) { - IWineD3DSurface_DrawOverlay((IWineD3DSurface *)overlay); + overlay->surface_ops->surface_draw_overlay(overlay); } } } else { - if ((surface->Flags & (SFLAG_INTEXTURE | SFLAG_INSRGBTEX)) && (flag & (SFLAG_INTEXTURE | SFLAG_INSRGBTEX))) + if ((surface->flags & (SFLAG_INTEXTURE | SFLAG_INSRGBTEX)) && (flag & (SFLAG_INTEXTURE | SFLAG_INSRGBTEX))) { if (surface->container.type == WINED3D_CONTAINER_TEXTURE) { TRACE("Passing to container\n"); - IWineD3DBaseTexture_SetDirty((IWineD3DBaseTexture *)surface->container.u.texture, TRUE); + wined3d_texture_set_dirty(surface->container.u.texture, TRUE); } } - surface->Flags &= ~flag; + surface->flags &= ~flag; } - if (!(surface->Flags & SFLAG_LOCATIONS)) + if (!(surface->flags & SFLAG_LOCATIONS)) { ERR("Surface %p does not have any up to date location.\n", surface); } } -static inline void surface_blt_to_drawable(IWineD3DSurfaceImpl *This, const RECT *rect_in) +static DWORD resource_access_from_location(DWORD location) { - IWineD3DDeviceImpl *device = This->resource.device; - IWineD3DSwapChainImpl *swapchain; - struct wined3d_context *context; - RECT src_rect, dst_rect; - - surface_get_rect(This, rect_in, &src_rect); - - context = context_acquire(device, This); - context_apply_blit_state(context, device); - if (context->render_offscreen) + switch (location) { - dst_rect.left = src_rect.left; - dst_rect.right = src_rect.right; - dst_rect.top = src_rect.bottom; - dst_rect.bottom = src_rect.top; + case SFLAG_INSYSMEM: + return WINED3D_RESOURCE_ACCESS_CPU; + + case SFLAG_INDRAWABLE: + case SFLAG_INSRGBTEX: + case SFLAG_INTEXTURE: + return WINED3D_RESOURCE_ACCESS_GPU; + + default: + FIXME("Unhandled location %#x.\n", location); + return 0; } - else - { - dst_rect = src_rect; - } - - swapchain = This->container.type == WINED3D_CONTAINER_SWAPCHAIN ? This->container.u.swapchain : NULL; - if (swapchain && This == swapchain->front_buffer) - surface_translate_frontbuffer_coords(This, context->win_handle, &dst_rect); - - device->blitter->set_shader((IWineD3DDevice *) device, This); - - ENTER_GL(); - draw_textured_quad(This, &src_rect, &dst_rect, WINED3DTEXF_POINT); - LEAVE_GL(); - - device->blitter->unset_shader((IWineD3DDevice *) device); - - if (wined3d_settings.strict_draw_ordering || (swapchain - && (This == swapchain->front_buffer || swapchain->num_contexts > 1))) - wglFlush(); /* Flush to ensure ordering across contexts. */ - - context_release(context); } -HRESULT surface_load_location(IWineD3DSurfaceImpl *surface, DWORD flag, const RECT *rect) +HRESULT surface_load_location(struct wined3d_surface *surface, DWORD flag, const RECT *rect) { - IWineD3DDeviceImpl *device = surface->resource.device; + struct wined3d_device *device = surface->resource.device; const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; BOOL drawable_read_ok = surface_is_offscreen(surface); struct wined3d_format format; @@ -4416,16 +5910,29 @@ HRESULT surface_load_location(IWineD3DSurfaceImpl *surface, DWORD flag, const RE } } - if (surface->Flags & flag) + if (flag == SFLAG_INSRGBTEX && gl_info->supported[EXT_TEXTURE_SRGB_DECODE]) + { + flag = SFLAG_INTEXTURE; + } + + if (surface->flags & flag) { TRACE("Location already up to date\n"); return WINED3D_OK; } - if (!(surface->Flags & SFLAG_LOCATIONS)) + if (WARN_ON(d3d_surface)) + { + DWORD required_access = resource_access_from_location(flag); + if ((surface->resource.access_flags & required_access) != required_access) + WARN("Operation requires %#x access, but surface only has %#x.\n", + required_access, surface->resource.access_flags); + } + + if (!(surface->flags & SFLAG_LOCATIONS)) { ERR("Surface %p does not have any up to date location.\n", surface); - surface->Flags |= SFLAG_LOST; + surface->flags |= SFLAG_LOST; return WINED3DERR_DEVICELOST; } @@ -4434,13 +5941,13 @@ HRESULT surface_load_location(IWineD3DSurfaceImpl *surface, DWORD flag, const RE surface_prepare_system_memory(surface); /* Download the surface to system memory */ - if (surface->Flags & (SFLAG_INTEXTURE | SFLAG_INSRGBTEX)) + if (surface->flags & (SFLAG_INTEXTURE | SFLAG_INSRGBTEX)) { struct wined3d_context *context = NULL; if (!device->isInDraw) context = context_acquire(device, NULL); - surface_bind_and_dirtify(surface, !(surface->Flags & SFLAG_INTEXTURE)); + surface_bind_and_dirtify(surface, gl_info, !(surface->flags & SFLAG_INTEXTURE)); surface_download_data(surface, gl_info); if (context) context_release(context); @@ -4449,19 +5956,25 @@ HRESULT surface_load_location(IWineD3DSurfaceImpl *surface, DWORD flag, const RE { /* Note: It might be faster to download into a texture first. */ read_from_framebuffer(surface, rect, surface->resource.allocatedMemory, - IWineD3DSurface_GetPitch((IWineD3DSurface *)surface)); + wined3d_surface_get_pitch(surface)); } } else if (flag == SFLAG_INDRAWABLE) { - if (surface->Flags & SFLAG_INTEXTURE) + if (wined3d_settings.rendertargetlock_mode == RTL_READTEX) + surface_load_location(surface, SFLAG_INTEXTURE, NULL); + + if (surface->flags & SFLAG_INTEXTURE) { - surface_blt_to_drawable(surface, rect); + RECT r; + + surface_get_rect(surface, rect, &r); + surface_blt_to_drawable(device, WINED3DTEXF_POINT, FALSE, surface, &r, surface, &r); } else { int byte_count; - if ((surface->Flags & SFLAG_LOCATIONS) == SFLAG_INSRGBTEX) + if ((surface->flags & SFLAG_LOCATIONS) == SFLAG_INSRGBTEX) { /* This needs a shader to convert the srgb data sampled from the GL texture into RGB * values, otherwise we get incorrect values in the target. For now go the slow way @@ -4474,12 +5987,12 @@ HRESULT surface_load_location(IWineD3DSurfaceImpl *surface, DWORD flag, const RE FALSE /* We won't use textures */, &format, &convert); /* The width is in 'length' not in bytes */ - width = surface->currentDesc.Width; - pitch = IWineD3DSurface_GetPitch((IWineD3DSurface *)surface); + width = surface->resource.width; + pitch = wined3d_surface_get_pitch(surface); /* Don't use PBOs for converted surfaces. During PBO conversion we look at SFLAG_CONVERTED * but it isn't set (yet) in all cases it is getting called. */ - if ((convert != NO_CONVERSION) && (surface->Flags & SFLAG_PBO)) + if ((convert != NO_CONVERSION) && (surface->flags & SFLAG_PBO)) { struct wined3d_context *context = NULL; @@ -4492,7 +6005,7 @@ HRESULT surface_load_location(IWineD3DSurfaceImpl *surface, DWORD flag, const RE if ((convert != NO_CONVERSION) && surface->resource.allocatedMemory) { - int height = surface->currentDesc.Height; + int height = surface->resource.height; byte_count = format.conv_byte_count; /* Stick to the alignment for the converted surface too, makes it easier to load the surface */ @@ -4507,19 +6020,19 @@ HRESULT surface_load_location(IWineD3DSurfaceImpl *surface, DWORD flag, const RE d3dfmt_convert_surface(surface->resource.allocatedMemory, mem, pitch, width, height, outpitch, convert, surface); - surface->Flags |= SFLAG_CONVERTED; + surface->flags |= SFLAG_CONVERTED; } else { - surface->Flags &= ~SFLAG_CONVERTED; + surface->flags &= ~SFLAG_CONVERTED; mem = surface->resource.allocatedMemory; byte_count = format.byte_count; } - flush_to_framebuffer_drawpixels(surface, format.glFormat, format.glType, byte_count, mem); + flush_to_framebuffer_drawpixels(surface, rect, format.glFormat, format.glType, byte_count, mem); /* Don't delete PBO memory */ - if ((mem != surface->resource.allocatedMemory) && !(surface->Flags & SFLAG_PBO)) + if ((mem != surface->resource.allocatedMemory) && !(surface->flags & SFLAG_PBO)) HeapFree(GetProcessHeap(), 0, mem); } } @@ -4527,18 +6040,18 @@ HRESULT surface_load_location(IWineD3DSurfaceImpl *surface, DWORD flag, const RE { const DWORD attach_flags = WINED3DFMT_FLAG_FBO_ATTACHABLE | WINED3DFMT_FLAG_FBO_ATTACHABLE_SRGB; - if (drawable_read_ok && (surface->Flags & SFLAG_INDRAWABLE)) + if (drawable_read_ok && (surface->flags & SFLAG_INDRAWABLE)) { read_from_framebuffer_texture(surface, flag == SFLAG_INSRGBTEX); } - else if (surface->Flags & (SFLAG_INSRGBTEX | SFLAG_INTEXTURE) - && (surface->resource.format->Flags & attach_flags) == attach_flags - && fbo_blit_supported(gl_info, BLIT_OP_BLIT, + else if (surface->flags & (SFLAG_INSRGBTEX | SFLAG_INTEXTURE) + && (surface->resource.format->flags & attach_flags) == attach_flags + && fbo_blit_supported(gl_info, WINED3D_BLIT_OP_COLOR_BLIT, NULL, surface->resource.usage, surface->resource.pool, surface->resource.format, NULL, surface->resource.usage, surface->resource.pool, surface->resource.format)) { DWORD src_location = flag == SFLAG_INSRGBTEX ? SFLAG_INTEXTURE : SFLAG_INSRGBTEX; - RECT rect = {0, 0, surface->currentDesc.Width, surface->currentDesc.Height}; + RECT rect = {0, 0, surface->resource.width, surface->resource.height}; surface_blt_fbo(surface->resource.device, WINED3DTEXF_POINT, surface, src_location, &rect, surface, flag, &rect); @@ -4554,7 +6067,7 @@ HRESULT surface_load_location(IWineD3DSurfaceImpl *surface, DWORD flag, const RE if (srgb) { - if ((surface->Flags & (SFLAG_INTEXTURE | SFLAG_INSYSMEM)) == SFLAG_INTEXTURE) + if ((surface->flags & (SFLAG_INTEXTURE | SFLAG_INSYSMEM)) == SFLAG_INTEXTURE) { /* Performance warning... */ FIXME("Downloading RGB surface %p to reload it as sRGB.\n", surface); @@ -4563,14 +6076,14 @@ HRESULT surface_load_location(IWineD3DSurfaceImpl *surface, DWORD flag, const RE } else { - if ((surface->Flags & (SFLAG_INSRGBTEX | SFLAG_INSYSMEM)) == SFLAG_INSRGBTEX) + if ((surface->flags & (SFLAG_INSRGBTEX | SFLAG_INSYSMEM)) == SFLAG_INSRGBTEX) { /* Performance warning... */ FIXME("Downloading sRGB surface %p to reload it as RGB.\n", surface); surface_load_location(surface, SFLAG_INSYSMEM, rect); } } - if (!(surface->Flags & SFLAG_INSYSMEM)) + if (!(surface->flags & SFLAG_INSYSMEM)) { WARN("Trying to load a texture from sysmem, but SFLAG_INSYSMEM is not set.\n"); /* Lets hope we get it from somewhere... */ @@ -4580,22 +6093,22 @@ HRESULT surface_load_location(IWineD3DSurfaceImpl *surface, DWORD flag, const RE if (!device->isInDraw) context = context_acquire(device, NULL); surface_prepare_texture(surface, gl_info, srgb); - surface_bind_and_dirtify(surface, srgb); + surface_bind_and_dirtify(surface, gl_info, srgb); if (surface->CKeyFlags & WINEDDSD_CKSRCBLT) { - surface->Flags |= SFLAG_GLCKEY; + surface->flags |= SFLAG_GLCKEY; surface->glCKey = surface->SrcBltCKey; } - else surface->Flags &= ~SFLAG_GLCKEY; + else surface->flags &= ~SFLAG_GLCKEY; /* The width is in 'length' not in bytes */ - width = surface->currentDesc.Width; - pitch = IWineD3DSurface_GetPitch((IWineD3DSurface *)surface); + width = surface->resource.width; + pitch = wined3d_surface_get_pitch(surface); /* Don't use PBOs for converted surfaces. During PBO conversion we look at SFLAG_CONVERTED * but it isn't set (yet) in all cases it is getting called. */ - if ((convert != NO_CONVERSION || format.convert) && (surface->Flags & SFLAG_PBO)) + if ((convert != NO_CONVERSION || format.convert) && (surface->flags & SFLAG_PBO)) { TRACE("Removing the pbo attached to surface %p.\n", surface); surface_remove_pbo(surface, gl_info); @@ -4604,7 +6117,7 @@ HRESULT surface_load_location(IWineD3DSurfaceImpl *surface, DWORD flag, const RE if (format.convert) { /* This code is entered for texture formats which need a fixup. */ - int height = surface->currentDesc.Height; + UINT height = surface->resource.height; /* Stick to the alignment for the converted surface too, makes it easier to load the surface */ outpitch = width * format.conv_byte_count; @@ -4621,7 +6134,7 @@ HRESULT surface_load_location(IWineD3DSurfaceImpl *surface, DWORD flag, const RE else if (convert != NO_CONVERSION && surface->resource.allocatedMemory) { /* This code is only entered for color keying fixups */ - int height = surface->currentDesc.Height; + UINT height = surface->resource.height; /* Stick to the alignment for the converted surface too, makes it easier to load the surface */ outpitch = width * format.conv_byte_count; @@ -4646,7 +6159,7 @@ HRESULT surface_load_location(IWineD3DSurfaceImpl *surface, DWORD flag, const RE glPixelStorei(GL_UNPACK_ROW_LENGTH, width); LEAVE_GL(); - if (mem || (surface->Flags & SFLAG_PBO)) + if (mem || (surface->flags & SFLAG_PBO)) surface_upload_data(surface, gl_info, &format, srgb, mem); /* Restore the default pitch */ @@ -4657,51 +6170,37 @@ HRESULT surface_load_location(IWineD3DSurfaceImpl *surface, DWORD flag, const RE if (context) context_release(context); /* Don't delete PBO memory */ - if ((mem != surface->resource.allocatedMemory) && !(surface->Flags & SFLAG_PBO)) + if ((mem != surface->resource.allocatedMemory) && !(surface->flags & SFLAG_PBO)) HeapFree(GetProcessHeap(), 0, mem); } } - if (!rect) surface->Flags |= flag; + if (!rect) + { + surface->flags |= flag; - if (in_fbo && (surface->Flags & (SFLAG_INTEXTURE | SFLAG_INDRAWABLE))) + if (flag != SFLAG_INSYSMEM && (surface->flags & SFLAG_INSYSMEM)) + surface_evict_sysmem(surface); + } + + if (in_fbo && (surface->flags & (SFLAG_INTEXTURE | SFLAG_INDRAWABLE))) { /* With ORM_FBO, SFLAG_INTEXTURE and SFLAG_INDRAWABLE are the same for offscreen targets. */ - surface->Flags |= (SFLAG_INTEXTURE | SFLAG_INDRAWABLE); + surface->flags |= (SFLAG_INTEXTURE | SFLAG_INDRAWABLE); + } + + if (surface->flags & (SFLAG_INTEXTURE | SFLAG_INSRGBTEX) + && gl_info->supported[EXT_TEXTURE_SRGB_DECODE]) + { + surface->flags |= (SFLAG_INTEXTURE | SFLAG_INSRGBTEX); } return WINED3D_OK; } -static WINED3DSURFTYPE WINAPI IWineD3DSurfaceImpl_GetImplType(IWineD3DSurface *iface) { - return SURFACE_OPENGL; -} - -static HRESULT WINAPI IWineD3DSurfaceImpl_DrawOverlay(IWineD3DSurface *iface) { - IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface; - HRESULT hr; - - /* If there's no destination surface there is nothing to do */ - if(!This->overlay_dest) return WINED3D_OK; - - /* Blt calls ModifyLocation on the dest surface, which in turn calls DrawOverlay to - * update the overlay. Prevent an endless recursion - */ - if(This->overlay_dest->Flags & SFLAG_INOVERLAYDRAW) { - return WINED3D_OK; - } - This->overlay_dest->Flags |= SFLAG_INOVERLAYDRAW; - hr = IWineD3DSurfaceImpl_Blt((IWineD3DSurface *) This->overlay_dest, &This->overlay_destrect, - iface, &This->overlay_srcrect, WINEDDBLT_WAIT, - NULL, WINED3DTEXF_LINEAR); - This->overlay_dest->Flags &= ~SFLAG_INOVERLAYDRAW; - - return hr; -} - -BOOL surface_is_offscreen(IWineD3DSurfaceImpl *surface) +BOOL surface_is_offscreen(struct wined3d_surface *surface) { - IWineD3DSwapChainImpl *swapchain = surface->container.u.swapchain; + struct wined3d_swapchain *swapchain = surface->container.u.swapchain; /* Not on a swapchain - must be offscreen */ if (surface->container.type != WINED3D_CONTAINER_SWAPCHAIN) return TRUE; @@ -4714,64 +6213,13 @@ BOOL surface_is_offscreen(IWineD3DSurfaceImpl *surface) return swapchain->render_to_fbo; } -const IWineD3DSurfaceVtbl IWineD3DSurface_Vtbl = -{ - /* IUnknown */ - IWineD3DBaseSurfaceImpl_QueryInterface, - IWineD3DBaseSurfaceImpl_AddRef, - IWineD3DSurfaceImpl_Release, - /* IWineD3DResource */ - IWineD3DBaseSurfaceImpl_GetParent, - IWineD3DBaseSurfaceImpl_SetPrivateData, - IWineD3DBaseSurfaceImpl_GetPrivateData, - IWineD3DBaseSurfaceImpl_FreePrivateData, - IWineD3DBaseSurfaceImpl_SetPriority, - IWineD3DBaseSurfaceImpl_GetPriority, - IWineD3DSurfaceImpl_PreLoad, - IWineD3DSurfaceImpl_UnLoad, - IWineD3DBaseSurfaceImpl_GetType, - /* IWineD3DSurface */ - IWineD3DBaseSurfaceImpl_GetDesc, - IWineD3DSurfaceImpl_LockRect, - IWineD3DSurfaceImpl_UnlockRect, - IWineD3DSurfaceImpl_GetDC, - IWineD3DSurfaceImpl_ReleaseDC, - IWineD3DSurfaceImpl_Flip, - IWineD3DSurfaceImpl_Blt, - IWineD3DBaseSurfaceImpl_GetBltStatus, - IWineD3DBaseSurfaceImpl_GetFlipStatus, - IWineD3DBaseSurfaceImpl_IsLost, - IWineD3DBaseSurfaceImpl_Restore, - IWineD3DSurfaceImpl_BltFast, - IWineD3DBaseSurfaceImpl_GetPalette, - IWineD3DBaseSurfaceImpl_SetPalette, - IWineD3DSurfaceImpl_RealizePalette, - IWineD3DBaseSurfaceImpl_SetColorKey, - IWineD3DBaseSurfaceImpl_GetPitch, - IWineD3DSurfaceImpl_SetMem, - IWineD3DBaseSurfaceImpl_SetOverlayPosition, - IWineD3DBaseSurfaceImpl_GetOverlayPosition, - IWineD3DBaseSurfaceImpl_UpdateOverlayZOrder, - IWineD3DBaseSurfaceImpl_UpdateOverlay, - IWineD3DBaseSurfaceImpl_SetClipper, - IWineD3DBaseSurfaceImpl_GetClipper, - /* Internal use: */ - IWineD3DSurfaceImpl_LoadTexture, - IWineD3DSurfaceImpl_BindTexture, - IWineD3DBaseSurfaceImpl_GetData, - IWineD3DSurfaceImpl_SetFormat, - IWineD3DSurfaceImpl_PrivateSetup, - IWineD3DSurfaceImpl_GetImplType, - IWineD3DSurfaceImpl_DrawOverlay -}; - -static HRESULT ffp_blit_alloc(IWineD3DDevice *iface) { return WINED3D_OK; } +static HRESULT ffp_blit_alloc(struct wined3d_device *device) { return WINED3D_OK; } /* Context activation is done by the caller. */ -static void ffp_blit_free(IWineD3DDevice *iface) { } +static void ffp_blit_free(struct wined3d_device *device) { } /* This function is used in case of 8bit paletted textures using GL_EXT_paletted_texture */ /* Context activation is done by the caller. */ -static void ffp_blit_p8_upload_palette(IWineD3DSurfaceImpl *surface, const struct wined3d_gl_info *gl_info) +static void ffp_blit_p8_upload_palette(struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info) { BYTE table[256][4]; BOOL colorkey_active = (surface->CKeyFlags & WINEDDSD_CKSRCBLT) ? TRUE : FALSE; @@ -4785,10 +6233,8 @@ static void ffp_blit_p8_upload_palette(IWineD3DSurfaceImpl *surface, const struc } /* Context activation is done by the caller. */ -static HRESULT ffp_blit_set(IWineD3DDevice *iface, IWineD3DSurfaceImpl *surface) +static HRESULT ffp_blit_set(void *blit_priv, const struct wined3d_gl_info *gl_info, struct wined3d_surface *surface) { - IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *) iface; - const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; enum complex_fixup fixup = get_complex_fixup(surface->resource.format->color_fixup); /* When EXT_PALETTED_TEXTURE is around, palette conversion is done by the GPU @@ -4805,11 +6251,8 @@ static HRESULT ffp_blit_set(IWineD3DDevice *iface, IWineD3DSurfaceImpl *surface) } /* Context activation is done by the caller. */ -static void ffp_blit_unset(IWineD3DDevice *iface) +static void ffp_blit_unset(const struct wined3d_gl_info *gl_info) { - IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *) iface; - const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; - ENTER_GL(); glDisable(GL_TEXTURE_2D); checkGLcall("glDisable(GL_TEXTURE_2D)"); @@ -4826,67 +6269,80 @@ static void ffp_blit_unset(IWineD3DDevice *iface) LEAVE_GL(); } -static BOOL ffp_blit_supported(const struct wined3d_gl_info *gl_info, enum blit_operation blit_op, +static BOOL ffp_blit_supported(const struct wined3d_gl_info *gl_info, enum wined3d_blit_op blit_op, const RECT *src_rect, DWORD src_usage, WINED3DPOOL src_pool, const struct wined3d_format *src_format, const RECT *dst_rect, DWORD dst_usage, WINED3DPOOL dst_pool, const struct wined3d_format *dst_format) { enum complex_fixup src_fixup; - if (blit_op == BLIT_OP_COLOR_FILL) + switch (blit_op) { - if (!(dst_usage & WINED3DUSAGE_RENDERTARGET)) - { - TRACE("Color fill not supported\n"); + case WINED3D_BLIT_OP_COLOR_BLIT: + src_fixup = get_complex_fixup(src_format->color_fixup); + if (TRACE_ON(d3d_surface) && TRACE_ON(d3d)) + { + TRACE("Checking support for fixup:\n"); + dump_color_fixup_desc(src_format->color_fixup); + } + + if (!is_identity_fixup(dst_format->color_fixup)) + { + TRACE("Destination fixups are not supported\n"); + return FALSE; + } + + if (src_fixup == COMPLEX_FIXUP_P8 && gl_info->supported[EXT_PALETTED_TEXTURE]) + { + TRACE("P8 fixup supported\n"); + return TRUE; + } + + /* We only support identity conversions. */ + if (is_identity_fixup(src_format->color_fixup)) + { + TRACE("[OK]\n"); + return TRUE; + } + + TRACE("[FAILED]\n"); return FALSE; - } - return TRUE; + case WINED3D_BLIT_OP_COLOR_FILL: + if (!(dst_usage & WINED3DUSAGE_RENDERTARGET)) + { + TRACE("Color fill not supported\n"); + return FALSE; + } + + return TRUE; + + case WINED3D_BLIT_OP_DEPTH_FILL: + return TRUE; + + default: + TRACE("Unsupported blit_op=%d\n", blit_op); + return FALSE; } - - src_fixup = get_complex_fixup(src_format->color_fixup); - if (TRACE_ON(d3d_surface) && TRACE_ON(d3d)) - { - TRACE("Checking support for fixup:\n"); - dump_color_fixup_desc(src_format->color_fixup); - } - - if (blit_op != BLIT_OP_BLIT) - { - TRACE("Unsupported blit_op=%d\n", blit_op); - return FALSE; - } - - if (!is_identity_fixup(dst_format->color_fixup)) - { - TRACE("Destination fixups are not supported\n"); - return FALSE; - } - - if (src_fixup == COMPLEX_FIXUP_P8 && gl_info->supported[EXT_PALETTED_TEXTURE]) - { - TRACE("P8 fixup supported\n"); - return TRUE; - } - - /* We only support identity conversions. */ - if (is_identity_fixup(src_format->color_fixup)) - { - TRACE("[OK]\n"); - return TRUE; - } - - TRACE("[FAILED]\n"); - return FALSE; } /* Do not call while under the GL lock. */ -static HRESULT ffp_blit_color_fill(IWineD3DDeviceImpl *device, IWineD3DSurfaceImpl *dst_surface, +static HRESULT ffp_blit_color_fill(struct wined3d_device *device, struct wined3d_surface *dst_surface, const RECT *dst_rect, const WINED3DCOLORVALUE *color) { - const RECT draw_rect = {0, 0, dst_surface->currentDesc.Width, dst_surface->currentDesc.Height}; + const RECT draw_rect = {0, 0, dst_surface->resource.width, dst_surface->resource.height}; - return device_clear_render_targets(device, 1 /* rt_count */, &dst_surface, 1 /* rect_count */, - dst_rect, &draw_rect, WINED3DCLEAR_TARGET, color, 0.0f /* depth */, 0 /* stencil */); + return device_clear_render_targets(device, 1, &dst_surface, NULL, + 1, dst_rect, &draw_rect, WINED3DCLEAR_TARGET, color, 0.0f, 0); +} + +/* Do not call while under the GL lock. */ +static HRESULT ffp_blit_depth_fill(struct wined3d_device *device, + struct wined3d_surface *surface, const RECT *rect, float depth) +{ + const RECT draw_rect = {0, 0, surface->resource.width, surface->resource.height}; + + return device_clear_render_targets(device, 0, NULL, surface, + 1, rect, &draw_rect, WINED3DCLEAR_ZBUFFER, 0, depth, 0); } const struct blit_shader ffp_blit = { @@ -4895,35 +6351,36 @@ const struct blit_shader ffp_blit = { ffp_blit_set, ffp_blit_unset, ffp_blit_supported, - ffp_blit_color_fill + ffp_blit_color_fill, + ffp_blit_depth_fill, }; -static HRESULT cpu_blit_alloc(IWineD3DDevice *iface) +static HRESULT cpu_blit_alloc(struct wined3d_device *device) { return WINED3D_OK; } /* Context activation is done by the caller. */ -static void cpu_blit_free(IWineD3DDevice *iface) +static void cpu_blit_free(struct wined3d_device *device) { } /* Context activation is done by the caller. */ -static HRESULT cpu_blit_set(IWineD3DDevice *iface, IWineD3DSurfaceImpl *surface) +static HRESULT cpu_blit_set(void *blit_priv, const struct wined3d_gl_info *gl_info, struct wined3d_surface *surface) { return WINED3D_OK; } /* Context activation is done by the caller. */ -static void cpu_blit_unset(IWineD3DDevice *iface) +static void cpu_blit_unset(const struct wined3d_gl_info *gl_info) { } -static BOOL cpu_blit_supported(const struct wined3d_gl_info *gl_info, enum blit_operation blit_op, +static BOOL cpu_blit_supported(const struct wined3d_gl_info *gl_info, enum wined3d_blit_op blit_op, const RECT *src_rect, DWORD src_usage, WINED3DPOOL src_pool, const struct wined3d_format *src_format, const RECT *dst_rect, DWORD dst_usage, WINED3DPOOL dst_pool, const struct wined3d_format *dst_format) { - if (blit_op == BLIT_OP_COLOR_FILL) + if (blit_op == WINED3D_BLIT_OP_COLOR_FILL) { return TRUE; } @@ -4931,8 +6388,915 @@ static BOOL cpu_blit_supported(const struct wined3d_gl_info *gl_info, enum blit_ return FALSE; } +static HRESULT surface_cpu_blt(struct wined3d_surface *dst_surface, const RECT *dst_rect, + struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags, + const WINEDDBLTFX *fx, WINED3DTEXTUREFILTERTYPE filter) +{ + int bpp, srcheight, srcwidth, dstheight, dstwidth, width; + const struct wined3d_format *src_format, *dst_format; + struct wined3d_surface *orig_src = src_surface; + WINED3DLOCKED_RECT dlock, slock; + HRESULT hr = WINED3D_OK; + const BYTE *sbuf; + RECT xdst,xsrc; + BYTE *dbuf; + int x, y; + + TRACE("dst_surface %p, dst_rect %s, src_surface %p, src_rect %s, flags %#x, fx %p, filter %s.\n", + dst_surface, wine_dbgstr_rect(dst_rect), src_surface, wine_dbgstr_rect(src_rect), + flags, fx, debug_d3dtexturefiltertype(filter)); + + if ((dst_surface->flags & SFLAG_LOCKED) || (src_surface && (src_surface->flags & SFLAG_LOCKED))) + { + WARN("Surface is busy, returning WINEDDERR_SURFACEBUSY\n"); + return WINEDDERR_SURFACEBUSY; + } + + /* First check for the validity of source / destination rectangles. + * This was verified using a test application and by MSDN. */ + if (src_rect) + { + if (src_surface) + { + if (src_rect->right < src_rect->left || src_rect->bottom < src_rect->top + || src_rect->left > src_surface->resource.width || src_rect->left < 0 + || src_rect->top > src_surface->resource.height || src_rect->top < 0 + || src_rect->right > src_surface->resource.width || src_rect->right < 0 + || src_rect->bottom > src_surface->resource.height || src_rect->bottom < 0) + { + WARN("Application gave us bad source rectangle for Blt.\n"); + return WINEDDERR_INVALIDRECT; + } + + if (!src_rect->right || !src_rect->bottom + || src_rect->left == (int)src_surface->resource.width + || src_rect->top == (int)src_surface->resource.height) + { + TRACE("Nothing to be done.\n"); + return WINED3D_OK; + } + } + + xsrc = *src_rect; + } + else if (src_surface) + { + xsrc.left = 0; + xsrc.top = 0; + xsrc.right = src_surface->resource.width; + xsrc.bottom = src_surface->resource.height; + } + else + { + memset(&xsrc, 0, sizeof(xsrc)); + } + + if (dst_rect) + { + /* For the Destination rect, it can be out of bounds on the condition + * that a clipper is set for the given surface. */ + if (!dst_surface->clipper && (dst_rect->right < dst_rect->left || dst_rect->bottom < dst_rect->top + || dst_rect->left > dst_surface->resource.width || dst_rect->left < 0 + || dst_rect->top > dst_surface->resource.height || dst_rect->top < 0 + || dst_rect->right > dst_surface->resource.width || dst_rect->right < 0 + || dst_rect->bottom > dst_surface->resource.height || dst_rect->bottom < 0)) + { + WARN("Application gave us bad destination rectangle for Blt without a clipper set.\n"); + return WINEDDERR_INVALIDRECT; + } + + if (dst_rect->right <= 0 || dst_rect->bottom <= 0 + || dst_rect->left >= (int)dst_surface->resource.width + || dst_rect->top >= (int)dst_surface->resource.height) + { + TRACE("Nothing to be done.\n"); + return WINED3D_OK; + } + + if (!src_surface) + { + RECT full_rect; + + full_rect.left = 0; + full_rect.top = 0; + full_rect.right = dst_surface->resource.width; + full_rect.bottom = dst_surface->resource.height; + IntersectRect(&xdst, &full_rect, dst_rect); + } + else + { + BOOL clip_horiz, clip_vert; + + xdst = *dst_rect; + clip_horiz = xdst.left < 0 || xdst.right > (int)dst_surface->resource.width; + clip_vert = xdst.top < 0 || xdst.bottom > (int)dst_surface->resource.height; + + if (clip_vert || clip_horiz) + { + /* Now check if this is a special case or not... */ + if ((flags & WINEDDBLT_DDFX) + || (clip_horiz && xdst.right - xdst.left != xsrc.right - xsrc.left) + || (clip_vert && xdst.bottom - xdst.top != xsrc.bottom - xsrc.top)) + { + WARN("Out of screen rectangle in special case. Not handled right now.\n"); + return WINED3D_OK; + } + + if (clip_horiz) + { + if (xdst.left < 0) + { + xsrc.left -= xdst.left; + xdst.left = 0; + } + if (xdst.right > dst_surface->resource.width) + { + xsrc.right -= (xdst.right - (int)dst_surface->resource.width); + xdst.right = (int)dst_surface->resource.width; + } + } + + if (clip_vert) + { + if (xdst.top < 0) + { + xsrc.top -= xdst.top; + xdst.top = 0; + } + if (xdst.bottom > dst_surface->resource.height) + { + xsrc.bottom -= (xdst.bottom - (int)dst_surface->resource.height); + xdst.bottom = (int)dst_surface->resource.height; + } + } + + /* And check if after clipping something is still to be done... */ + if ((xdst.right <= 0) || (xdst.bottom <= 0) + || (xdst.left >= (int)dst_surface->resource.width) + || (xdst.top >= (int)dst_surface->resource.height) + || (xsrc.right <= 0) || (xsrc.bottom <= 0) + || (xsrc.left >= (int)src_surface->resource.width) + || (xsrc.top >= (int)src_surface->resource.height)) + { + TRACE("Nothing to be done after clipping.\n"); + return WINED3D_OK; + } + } + } + } + else + { + xdst.left = 0; + xdst.top = 0; + xdst.right = dst_surface->resource.width; + xdst.bottom = dst_surface->resource.height; + } + + if (src_surface == dst_surface) + { + wined3d_surface_map(dst_surface, &dlock, NULL, 0); + slock = dlock; + src_format = dst_surface->resource.format; + dst_format = src_format; + } + else + { + dst_format = dst_surface->resource.format; + if (src_surface) + { + if (dst_surface->resource.format->id != src_surface->resource.format->id) + { + src_surface = surface_convert_format(src_surface, dst_format->id); + if (!src_surface) + { + /* The conv function writes a FIXME */ + WARN("Cannot convert source surface format to dest format.\n"); + goto release; + } + } + wined3d_surface_map(src_surface, &slock, NULL, WINED3DLOCK_READONLY); + src_format = src_surface->resource.format; + } + else + { + src_format = dst_format; + } + if (dst_rect) + wined3d_surface_map(dst_surface, &dlock, &xdst, 0); + else + wined3d_surface_map(dst_surface, &dlock, NULL, 0); + } + + if (!fx || !(fx->dwDDFX)) flags &= ~WINEDDBLT_DDFX; + + if (src_format->flags & dst_format->flags & WINED3DFMT_FLAG_FOURCC) + { + if (!dst_rect || src_surface == dst_surface) + { + memcpy(dlock.pBits, slock.pBits, dst_surface->resource.size); + goto release; + } + } + + bpp = dst_surface->resource.format->byte_count; + srcheight = xsrc.bottom - xsrc.top; + srcwidth = xsrc.right - xsrc.left; + dstheight = xdst.bottom - xdst.top; + dstwidth = xdst.right - xdst.left; + width = (xdst.right - xdst.left) * bpp; + + if (dst_rect && src_surface != dst_surface) + dbuf = dlock.pBits; + else + dbuf = (BYTE*)dlock.pBits+(xdst.top*dlock.Pitch)+(xdst.left*bpp); + + if (flags & WINEDDBLT_WAIT) + { + flags &= ~WINEDDBLT_WAIT; + } + if (flags & WINEDDBLT_ASYNC) + { + static BOOL displayed = FALSE; + if (!displayed) + FIXME("Can't handle WINEDDBLT_ASYNC flag right now.\n"); + displayed = TRUE; + flags &= ~WINEDDBLT_ASYNC; + } + if (flags & WINEDDBLT_DONOTWAIT) + { + /* WINEDDBLT_DONOTWAIT appeared in DX7 */ + static BOOL displayed = FALSE; + if (!displayed) + FIXME("Can't handle WINEDDBLT_DONOTWAIT flag right now.\n"); + displayed = TRUE; + flags &= ~WINEDDBLT_DONOTWAIT; + } + + /* First, all the 'source-less' blits */ + if (flags & WINEDDBLT_COLORFILL) + { + hr = _Blt_ColorFill(dbuf, dstwidth, dstheight, bpp, dlock.Pitch, fx->u5.dwFillColor); + flags &= ~WINEDDBLT_COLORFILL; + } + + if (flags & WINEDDBLT_DEPTHFILL) + { + FIXME("DDBLT_DEPTHFILL needs to be implemented!\n"); + } + if (flags & WINEDDBLT_ROP) + { + /* Catch some degenerate cases here. */ + switch (fx->dwROP) + { + case BLACKNESS: + hr = _Blt_ColorFill(dbuf,dstwidth,dstheight,bpp,dlock.Pitch,0); + break; + case 0xAA0029: /* No-op */ + break; + case WHITENESS: + hr = _Blt_ColorFill(dbuf,dstwidth,dstheight,bpp,dlock.Pitch,~0); + break; + case SRCCOPY: /* Well, we do that below? */ + break; + default: + FIXME("Unsupported raster op: %08x Pattern: %p\n", fx->dwROP, fx->u5.lpDDSPattern); + goto error; + } + flags &= ~WINEDDBLT_ROP; + } + if (flags & WINEDDBLT_DDROPS) + { + FIXME("\tDdraw Raster Ops: %08x Pattern: %p\n", fx->dwDDROP, fx->u5.lpDDSPattern); + } + /* Now the 'with source' blits. */ + if (src_surface) + { + const BYTE *sbase; + int sx, xinc, sy, yinc; + + if (!dstwidth || !dstheight) /* Hmm... stupid program? */ + goto release; + + if (filter != WINED3DTEXF_NONE && filter != WINED3DTEXF_POINT + && (srcwidth != dstwidth || srcheight != dstheight)) + { + /* Can happen when d3d9 apps do a StretchRect() call which isn't handled in GL. */ + FIXME("Filter %s not supported in software blit.\n", debug_d3dtexturefiltertype(filter)); + } + + sbase = (BYTE*)slock.pBits+(xsrc.top*slock.Pitch)+xsrc.left*bpp; + xinc = (srcwidth << 16) / dstwidth; + yinc = (srcheight << 16) / dstheight; + + if (!flags) + { + /* No effects, we can cheat here. */ + if (dstwidth == srcwidth) + { + if (dstheight == srcheight) + { + /* No stretching in either direction. This needs to be as + * fast as possible. */ + sbuf = sbase; + + /* Check for overlapping surfaces. */ + if (src_surface != dst_surface || xdst.top < xsrc.top + || xdst.right <= xsrc.left || xsrc.right <= xdst.left) + { + /* No overlap, or dst above src, so copy from top downwards. */ + for (y = 0; y < dstheight; ++y) + { + memcpy(dbuf, sbuf, width); + sbuf += slock.Pitch; + dbuf += dlock.Pitch; + } + } + else if (xdst.top > xsrc.top) + { + /* Copy from bottom upwards. */ + sbuf += (slock.Pitch*dstheight); + dbuf += (dlock.Pitch*dstheight); + for (y = 0; y < dstheight; ++y) + { + sbuf -= slock.Pitch; + dbuf -= dlock.Pitch; + memcpy(dbuf, sbuf, width); + } + } + else + { + /* Src and dst overlapping on the same line, use memmove. */ + for (y = 0; y < dstheight; ++y) + { + memmove(dbuf, sbuf, width); + sbuf += slock.Pitch; + dbuf += dlock.Pitch; + } + } + } + else + { + /* Stretching in y direction only. */ + for (y = sy = 0; y < dstheight; ++y, sy += yinc) + { + sbuf = sbase + (sy >> 16) * slock.Pitch; + memcpy(dbuf, sbuf, width); + dbuf += dlock.Pitch; + } + } + } + else + { + /* Stretching in X direction. */ + int last_sy = -1; + for (y = sy = 0; y < dstheight; ++y, sy += yinc) + { + sbuf = sbase + (sy >> 16) * slock.Pitch; + + if ((sy >> 16) == (last_sy >> 16)) + { + /* This source row is the same as last source row - + * Copy the already stretched row. */ + memcpy(dbuf, dbuf - dlock.Pitch, width); + } + else + { +#define STRETCH_ROW(type) \ +do { \ + const type *s = (const type *)sbuf; \ + type *d = (type *)dbuf; \ + for (x = sx = 0; x < dstwidth; ++x, sx += xinc) \ + d[x] = s[sx >> 16]; \ +} while(0) + + switch(bpp) + { + case 1: + STRETCH_ROW(BYTE); + break; + case 2: + STRETCH_ROW(WORD); + break; + case 4: + STRETCH_ROW(DWORD); + break; + case 3: + { + const BYTE *s; + BYTE *d = dbuf; + for (x = sx = 0; x < dstwidth; x++, sx+= xinc) + { + DWORD pixel; + + s = sbuf + 3 * (sx >> 16); + pixel = s[0] | (s[1] << 8) | (s[2] << 16); + d[0] = (pixel ) & 0xff; + d[1] = (pixel >> 8) & 0xff; + d[2] = (pixel >> 16) & 0xff; + d += 3; + } + break; + } + default: + FIXME("Stretched blit not implemented for bpp %u!\n", bpp * 8); + hr = WINED3DERR_NOTAVAILABLE; + goto error; + } +#undef STRETCH_ROW + } + dbuf += dlock.Pitch; + last_sy = sy; + } + } + } + else + { + LONG dstyinc = dlock.Pitch, dstxinc = bpp; + DWORD keylow = 0xFFFFFFFF, keyhigh = 0, keymask = 0xFFFFFFFF; + DWORD destkeylow = 0x0, destkeyhigh = 0xFFFFFFFF, destkeymask = 0xFFFFFFFF; + if (flags & (WINEDDBLT_KEYSRC | WINEDDBLT_KEYDEST | WINEDDBLT_KEYSRCOVERRIDE | WINEDDBLT_KEYDESTOVERRIDE)) + { + /* The color keying flags are checked for correctness in ddraw */ + if (flags & WINEDDBLT_KEYSRC) + { + keylow = src_surface->SrcBltCKey.dwColorSpaceLowValue; + keyhigh = src_surface->SrcBltCKey.dwColorSpaceHighValue; + } + else if (flags & WINEDDBLT_KEYSRCOVERRIDE) + { + keylow = fx->ddckSrcColorkey.dwColorSpaceLowValue; + keyhigh = fx->ddckSrcColorkey.dwColorSpaceHighValue; + } + + if (flags & WINEDDBLT_KEYDEST) + { + /* Destination color keys are taken from the source surface! */ + destkeylow = src_surface->DestBltCKey.dwColorSpaceLowValue; + destkeyhigh = src_surface->DestBltCKey.dwColorSpaceHighValue; + } + else if (flags & WINEDDBLT_KEYDESTOVERRIDE) + { + destkeylow = fx->ddckDestColorkey.dwColorSpaceLowValue; + destkeyhigh = fx->ddckDestColorkey.dwColorSpaceHighValue; + } + + if (bpp == 1) + { + keymask = 0xff; + } + else + { + keymask = src_format->red_mask + | src_format->green_mask + | src_format->blue_mask; + } + flags &= ~(WINEDDBLT_KEYSRC | WINEDDBLT_KEYDEST | WINEDDBLT_KEYSRCOVERRIDE | WINEDDBLT_KEYDESTOVERRIDE); + } + + if (flags & WINEDDBLT_DDFX) + { + BYTE *dTopLeft, *dTopRight, *dBottomLeft, *dBottomRight, *tmp; + LONG tmpxy; + dTopLeft = dbuf; + dTopRight = dbuf + ((dstwidth - 1) * bpp); + dBottomLeft = dTopLeft + ((dstheight - 1) * dlock.Pitch); + dBottomRight = dBottomLeft + ((dstwidth - 1) * bpp); + + if (fx->dwDDFX & WINEDDBLTFX_ARITHSTRETCHY) + { + /* I don't think we need to do anything about this flag */ + WARN("flags=DDBLT_DDFX nothing done for WINEDDBLTFX_ARITHSTRETCHY\n"); + } + if (fx->dwDDFX & WINEDDBLTFX_MIRRORLEFTRIGHT) + { + tmp = dTopRight; + dTopRight = dTopLeft; + dTopLeft = tmp; + tmp = dBottomRight; + dBottomRight = dBottomLeft; + dBottomLeft = tmp; + dstxinc = dstxinc * -1; + } + if (fx->dwDDFX & WINEDDBLTFX_MIRRORUPDOWN) + { + tmp = dTopLeft; + dTopLeft = dBottomLeft; + dBottomLeft = tmp; + tmp = dTopRight; + dTopRight = dBottomRight; + dBottomRight = tmp; + dstyinc = dstyinc * -1; + } + if (fx->dwDDFX & WINEDDBLTFX_NOTEARING) + { + /* I don't think we need to do anything about this flag */ + WARN("flags=DDBLT_DDFX nothing done for WINEDDBLTFX_NOTEARING\n"); + } + if (fx->dwDDFX & WINEDDBLTFX_ROTATE180) + { + tmp = dBottomRight; + dBottomRight = dTopLeft; + dTopLeft = tmp; + tmp = dBottomLeft; + dBottomLeft = dTopRight; + dTopRight = tmp; + dstxinc = dstxinc * -1; + dstyinc = dstyinc * -1; + } + if (fx->dwDDFX & WINEDDBLTFX_ROTATE270) + { + tmp = dTopLeft; + dTopLeft = dBottomLeft; + dBottomLeft = dBottomRight; + dBottomRight = dTopRight; + dTopRight = tmp; + tmpxy = dstxinc; + dstxinc = dstyinc; + dstyinc = tmpxy; + dstxinc = dstxinc * -1; + } + if (fx->dwDDFX & WINEDDBLTFX_ROTATE90) + { + tmp = dTopLeft; + dTopLeft = dTopRight; + dTopRight = dBottomRight; + dBottomRight = dBottomLeft; + dBottomLeft = tmp; + tmpxy = dstxinc; + dstxinc = dstyinc; + dstyinc = tmpxy; + dstyinc = dstyinc * -1; + } + if (fx->dwDDFX & WINEDDBLTFX_ZBUFFERBASEDEST) + { + /* I don't think we need to do anything about this flag */ + WARN("flags=WINEDDBLT_DDFX nothing done for WINEDDBLTFX_ZBUFFERBASEDEST\n"); + } + dbuf = dTopLeft; + flags &= ~(WINEDDBLT_DDFX); + } + +#define COPY_COLORKEY_FX(type) \ +do { \ + const type *s; \ + type *d = (type *)dbuf, *dx, tmp; \ + for (y = sy = 0; y < dstheight; ++y, sy += yinc) \ + { \ + s = (const type *)(sbase + (sy >> 16) * slock.Pitch); \ + dx = d; \ + for (x = sx = 0; x < dstwidth; ++x, sx += xinc) \ + { \ + tmp = s[sx >> 16]; \ + if (((tmp & keymask) < keylow || (tmp & keymask) > keyhigh) \ + && ((dx[0] & destkeymask) >= destkeylow && (dx[0] & destkeymask) <= destkeyhigh)) \ + { \ + dx[0] = tmp; \ + } \ + dx = (type *)(((BYTE *)dx) + dstxinc); \ + } \ + d = (type *)(((BYTE *)d) + dstyinc); \ + } \ +} while(0) + + switch (bpp) + { + case 1: + COPY_COLORKEY_FX(BYTE); + break; + case 2: + COPY_COLORKEY_FX(WORD); + break; + case 4: + COPY_COLORKEY_FX(DWORD); + break; + case 3: + { + const BYTE *s; + BYTE *d = dbuf, *dx; + for (y = sy = 0; y < dstheight; ++y, sy += yinc) + { + sbuf = sbase + (sy >> 16) * slock.Pitch; + dx = d; + for (x = sx = 0; x < dstwidth; ++x, sx+= xinc) + { + DWORD pixel, dpixel = 0; + s = sbuf + 3 * (sx>>16); + pixel = s[0] | (s[1] << 8) | (s[2] << 16); + dpixel = dx[0] | (dx[1] << 8 ) | (dx[2] << 16); + if (((pixel & keymask) < keylow || (pixel & keymask) > keyhigh) + && ((dpixel & keymask) >= destkeylow || (dpixel & keymask) <= keyhigh)) + { + dx[0] = (pixel ) & 0xff; + dx[1] = (pixel >> 8) & 0xff; + dx[2] = (pixel >> 16) & 0xff; + } + dx += dstxinc; + } + d += dstyinc; + } + break; + } + default: + FIXME("%s color-keyed blit not implemented for bpp %u!\n", + (flags & WINEDDBLT_KEYSRC) ? "Source" : "Destination", bpp * 8); + hr = WINED3DERR_NOTAVAILABLE; + goto error; +#undef COPY_COLORKEY_FX + } + } + } + +error: + if (flags && FIXME_ON(d3d_surface)) + { + FIXME("\tUnsupported flags: %#x.\n", flags); + } + +release: + wined3d_surface_unmap(dst_surface); + if (src_surface && src_surface != dst_surface) + wined3d_surface_unmap(src_surface); + /* Release the converted surface, if any. */ + if (src_surface && src_surface != orig_src) + wined3d_surface_decref(src_surface); + + return hr; +} + +static HRESULT surface_cpu_bltfast(struct wined3d_surface *dst_surface, DWORD dst_x, DWORD dst_y, + struct wined3d_surface *src_surface, const RECT *src_rect, DWORD trans) +{ + const struct wined3d_format *src_format, *dst_format; + RECT lock_src, lock_dst, lock_union; + WINED3DLOCKED_RECT dlock, slock; + HRESULT hr = WINED3D_OK; + int bpp, w, h, x, y; + const BYTE *sbuf; + BYTE *dbuf; + RECT rsrc2; + + TRACE("dst_surface %p, dst_x %u, dst_y %u, src_surface %p, src_rect %s, flags %#x.\n", + dst_surface, dst_x, dst_y, src_surface, wine_dbgstr_rect(src_rect), trans); + + if ((dst_surface->flags & SFLAG_LOCKED) || (src_surface->flags & SFLAG_LOCKED)) + { + WARN(" Surface is busy, returning DDERR_SURFACEBUSY\n"); + return WINEDDERR_SURFACEBUSY; + } + + if (!src_rect) + { + WARN("src_rect is NULL!\n"); + rsrc2.left = 0; + rsrc2.top = 0; + rsrc2.right = src_surface->resource.width; + rsrc2.bottom = src_surface->resource.height; + src_rect = &rsrc2; + } + + /* Check source rect for validity. Copied from normal Blt. Fixes Baldur's Gate. */ + if ((src_rect->bottom > src_surface->resource.height) || (src_rect->bottom < 0) + || (src_rect->top > src_surface->resource.height) || (src_rect->top < 0) + || (src_rect->left > src_surface->resource.width) || (src_rect->left < 0) + || (src_rect->right > src_surface->resource.width) || (src_rect->right < 0) + || (src_rect->right < src_rect->left) || (src_rect->bottom < src_rect->top)) + { + WARN("Application gave us bad source rectangle for BltFast.\n"); + return WINEDDERR_INVALIDRECT; + } + + h = src_rect->bottom - src_rect->top; + if (h > dst_surface->resource.height - dst_y) + h = dst_surface->resource.height - dst_y; + if (h > src_surface->resource.height - src_rect->top) + h = src_surface->resource.height - src_rect->top; + if (h <= 0) + return WINEDDERR_INVALIDRECT; + + w = src_rect->right - src_rect->left; + if (w > dst_surface->resource.width - dst_x) + w = dst_surface->resource.width - dst_x; + if (w > src_surface->resource.width - src_rect->left) + w = src_surface->resource.width - src_rect->left; + if (w <= 0) + return WINEDDERR_INVALIDRECT; + + /* Now compute the locking rectangle... */ + lock_src.left = src_rect->left; + lock_src.top = src_rect->top; + lock_src.right = lock_src.left + w; + lock_src.bottom = lock_src.top + h; + + lock_dst.left = dst_x; + lock_dst.top = dst_y; + lock_dst.right = dst_x + w; + lock_dst.bottom = dst_y + h; + + bpp = dst_surface->resource.format->byte_count; + + /* We need to lock the surfaces, or we won't get refreshes when done. */ + if (src_surface == dst_surface) + { + int pitch; + + UnionRect(&lock_union, &lock_src, &lock_dst); + + /* Lock the union of the two rectangles. */ + hr = wined3d_surface_map(dst_surface, &dlock, &lock_union, 0); + if (FAILED(hr)) + goto error; + + pitch = dlock.Pitch; + slock.Pitch = dlock.Pitch; + + /* Since slock was originally copied from this surface's description, we can just reuse it. */ + sbuf = dst_surface->resource.allocatedMemory + lock_src.top * pitch + lock_src.left * bpp; + dbuf = dst_surface->resource.allocatedMemory + lock_dst.top * pitch + lock_dst.left * bpp; + src_format = src_surface->resource.format; + dst_format = src_format; + } + else + { + hr = wined3d_surface_map(src_surface, &slock, &lock_src, WINED3DLOCK_READONLY); + if (FAILED(hr)) + goto error; + hr = wined3d_surface_map(dst_surface, &dlock, &lock_dst, 0); + if (FAILED(hr)) + goto error; + + sbuf = slock.pBits; + dbuf = dlock.pBits; + TRACE("Dst is at %p, Src is at %p.\n", dbuf, sbuf); + + src_format = src_surface->resource.format; + dst_format = dst_surface->resource.format; + } + + /* Handle compressed surfaces first... */ + if (src_format->flags & dst_format->flags & WINED3DFMT_FLAG_COMPRESSED) + { + UINT row_block_count; + + TRACE("compressed -> compressed copy\n"); + if (trans) + FIXME("trans arg not supported when a compressed surface is involved\n"); + if (dst_x || dst_y) + FIXME("offset for destination surface is not supported\n"); + if (src_surface->resource.format->id != dst_surface->resource.format->id) + { + FIXME("compressed -> compressed copy only supported for the same type of surface\n"); + hr = WINED3DERR_WRONGTEXTUREFORMAT; + goto error; + } + + row_block_count = (w + dst_format->block_width - 1) / dst_format->block_width; + for (y = 0; y < h; y += dst_format->block_height) + { + memcpy(dbuf, sbuf, row_block_count * dst_format->block_byte_count); + dbuf += dlock.Pitch; + sbuf += slock.Pitch; + } + + goto error; + } + if ((src_format->flags & WINED3DFMT_FLAG_COMPRESSED) && !(dst_format->flags & WINED3DFMT_FLAG_COMPRESSED)) + { + /* TODO: Use the libtxc_dxtn.so shared library to do software + * decompression. */ + ERR("Software decompression not supported.\n"); + goto error; + } + + if (trans & (WINEDDBLTFAST_SRCCOLORKEY | WINEDDBLTFAST_DESTCOLORKEY)) + { + DWORD keylow, keyhigh; + DWORD mask = src_surface->resource.format->red_mask + | src_surface->resource.format->green_mask + | src_surface->resource.format->blue_mask; + + /* For some 8-bit formats like L8 and P8 color masks don't make sense */ + if (!mask && bpp == 1) + mask = 0xff; + + TRACE("Color keyed copy.\n"); + if (trans & WINEDDBLTFAST_SRCCOLORKEY) + { + keylow = src_surface->SrcBltCKey.dwColorSpaceLowValue; + keyhigh = src_surface->SrcBltCKey.dwColorSpaceHighValue; + } + else + { + /* I'm not sure if this is correct. */ + FIXME("WINEDDBLTFAST_DESTCOLORKEY not fully supported yet.\n"); + keylow = dst_surface->DestBltCKey.dwColorSpaceLowValue; + keyhigh = dst_surface->DestBltCKey.dwColorSpaceHighValue; + } + +#define COPYBOX_COLORKEY(type) \ +do { \ + const type *s = (const type *)sbuf; \ + type *d = (type *)dbuf; \ + type tmp; \ + for (y = 0; y < h; y++) \ + { \ + for (x = 0; x < w; x++) \ + { \ + tmp = s[x]; \ + if ((tmp & mask) < keylow || (tmp & mask) > keyhigh) d[x] = tmp; \ + } \ + s = (const type *)((const BYTE *)s + slock.Pitch); \ + d = (type *)((BYTE *)d + dlock.Pitch); \ + } \ +} while(0) + + switch (bpp) + { + case 1: + COPYBOX_COLORKEY(BYTE); + break; + case 2: + COPYBOX_COLORKEY(WORD); + break; + case 4: + COPYBOX_COLORKEY(DWORD); + break; + case 3: + { + const BYTE *s; + DWORD tmp; + BYTE *d; + s = sbuf; + d = dbuf; + for (y = 0; y < h; ++y) + { + for (x = 0; x < w * 3; x += 3) + { + tmp = (DWORD)s[x] + ((DWORD)s[x + 1] << 8) + ((DWORD)s[x + 2] << 16); + if (tmp < keylow || tmp > keyhigh) + { + d[x + 0] = s[x + 0]; + d[x + 1] = s[x + 1]; + d[x + 2] = s[x + 2]; + } + } + s += slock.Pitch; + d += dlock.Pitch; + } + break; + } + default: + FIXME("Source color key blitting not supported for bpp %u.\n", bpp * 8); + hr = WINED3DERR_NOTAVAILABLE; + goto error; + } +#undef COPYBOX_COLORKEY + TRACE("Copy done.\n"); + } + else + { + int width = w * bpp; + INT sbufpitch, dbufpitch; + + TRACE("No color key copy.\n"); + /* Handle overlapping surfaces. */ + if (sbuf < dbuf) + { + sbuf += (h - 1) * slock.Pitch; + dbuf += (h - 1) * dlock.Pitch; + sbufpitch = -slock.Pitch; + dbufpitch = -dlock.Pitch; + } + else + { + sbufpitch = slock.Pitch; + dbufpitch = dlock.Pitch; + } + for (y = 0; y < h; ++y) + { + /* This is pretty easy, a line for line memcpy. */ + memmove(dbuf, sbuf, width); + sbuf += sbufpitch; + dbuf += dbufpitch; + } + TRACE("Copy done.\n"); + } + +error: + if (src_surface == dst_surface) + { + wined3d_surface_unmap(dst_surface); + } + else + { + wined3d_surface_unmap(dst_surface); + wined3d_surface_unmap(src_surface); + } + + return hr; +} + /* Do not call while under the GL lock. */ -static HRESULT cpu_blit_color_fill(IWineD3DDeviceImpl *device, IWineD3DSurfaceImpl *dst_surface, +static HRESULT cpu_blit_color_fill(struct wined3d_device *device, struct wined3d_surface *dst_surface, const RECT *dst_rect, const WINED3DCOLORVALUE *color) { WINEDDBLTFX BltFx; @@ -4940,8 +7304,16 @@ static HRESULT cpu_blit_color_fill(IWineD3DDeviceImpl *device, IWineD3DSurfaceIm memset(&BltFx, 0, sizeof(BltFx)); BltFx.dwSize = sizeof(BltFx); BltFx.u5.dwFillColor = wined3d_format_convert_from_float(dst_surface->resource.format, color); - return IWineD3DBaseSurfaceImpl_Blt((IWineD3DSurface*)dst_surface, dst_rect, - NULL, NULL, WINEDDBLT_COLORFILL, &BltFx, WINED3DTEXF_POINT); + return wined3d_surface_blt(dst_surface, dst_rect, NULL, NULL, + WINEDDBLT_COLORFILL, &BltFx, WINED3DTEXF_POINT); +} + +/* Do not call while under the GL lock. */ +static HRESULT cpu_blit_depth_fill(struct wined3d_device *device, + struct wined3d_surface *surface, const RECT *rect, float depth) +{ + FIXME("Depth filling not implemented by cpu_blit.\n"); + return WINED3DERR_INVALIDCALL; } const struct blit_shader cpu_blit = { @@ -4950,38 +7322,175 @@ const struct blit_shader cpu_blit = { cpu_blit_set, cpu_blit_unset, cpu_blit_supported, - cpu_blit_color_fill + cpu_blit_color_fill, + cpu_blit_depth_fill, }; -static BOOL fbo_blit_supported(const struct wined3d_gl_info *gl_info, enum blit_operation blit_op, - const RECT *src_rect, DWORD src_usage, WINED3DPOOL src_pool, const struct wined3d_format *src_format, - const RECT *dst_rect, DWORD dst_usage, WINED3DPOOL dst_pool, const struct wined3d_format *dst_format) +static HRESULT surface_init(struct wined3d_surface *surface, WINED3DSURFTYPE surface_type, UINT alignment, + UINT width, UINT height, UINT level, BOOL lockable, BOOL discard, WINED3DMULTISAMPLE_TYPE multisample_type, + UINT multisample_quality, struct wined3d_device *device, DWORD usage, enum wined3d_format_id format_id, + WINED3DPOOL pool, void *parent, const struct wined3d_parent_ops *parent_ops) { - if ((wined3d_settings.offscreen_rendering_mode != ORM_FBO) || !gl_info->fbo_ops.glBlitFramebuffer) - return FALSE; + const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; + const struct wined3d_format *format = wined3d_get_format(gl_info, format_id); + unsigned int resource_size; + HRESULT hr; - /* We only support blitting. Things like color keying / color fill should - * be handled by other blitters. - */ - if (blit_op != BLIT_OP_BLIT) - return FALSE; + if (multisample_quality > 0) + { + FIXME("multisample_quality set to %u, substituting 0.\n", multisample_quality); + multisample_quality = 0; + } - /* Source and/or destination need to be on the GL side */ - if (src_pool == WINED3DPOOL_SYSTEMMEM || dst_pool == WINED3DPOOL_SYSTEMMEM) - return FALSE; + /* Quick lockable sanity check. + * TODO: remove this after surfaces, usage and lockability have been debugged properly + * this function is too deep to need to care about things like this. + * Levels need to be checked too, since they all affect what can be done. */ + switch (pool) + { + case WINED3DPOOL_SCRATCH: + if (!lockable) + { + FIXME("Called with a pool of SCRATCH and a lockable of FALSE " + "which are mutually exclusive, setting lockable to TRUE.\n"); + lockable = TRUE; + } + break; - if (!((src_format->Flags & WINED3DFMT_FLAG_FBO_ATTACHABLE) || (src_usage & WINED3DUSAGE_RENDERTARGET)) - && ((dst_format->Flags & WINED3DFMT_FLAG_FBO_ATTACHABLE) || (dst_usage & WINED3DUSAGE_RENDERTARGET))) - return FALSE; + case WINED3DPOOL_SYSTEMMEM: + if (!lockable) + FIXME("Called with a pool of SYSTEMMEM and a lockable of FALSE, this is acceptable but unexpected.\n"); + break; - if (!is_identity_fixup(src_format->color_fixup) - || !is_identity_fixup(dst_format->color_fixup)) - return FALSE; + case WINED3DPOOL_MANAGED: + if (usage & WINED3DUSAGE_DYNAMIC) + FIXME("Called with a pool of MANAGED and a usage of DYNAMIC which are mutually exclusive.\n"); + break; - if (!(src_format->id == dst_format->id - || (is_identity_fixup(src_format->color_fixup) - && is_identity_fixup(dst_format->color_fixup)))) - return FALSE; + case WINED3DPOOL_DEFAULT: + if (lockable && !(usage & (WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_RENDERTARGET | WINED3DUSAGE_DEPTHSTENCIL))) + WARN("Creating a lockable surface with a POOL of DEFAULT, that doesn't specify DYNAMIC usage.\n"); + break; - return TRUE; + default: + FIXME("Unknown pool %#x.\n", pool); + break; + }; + + if (usage & WINED3DUSAGE_RENDERTARGET && pool != WINED3DPOOL_DEFAULT) + FIXME("Trying to create a render target that isn't in the default pool.\n"); + + /* FIXME: Check that the format is supported by the device. */ + + resource_size = wined3d_format_calculate_size(format, alignment, width, height); + if (!resource_size) + return WINED3DERR_INVALIDCALL; + + surface->surface_type = surface_type; + + switch (surface_type) + { + case SURFACE_OPENGL: + surface->surface_ops = &surface_ops; + break; + + case SURFACE_GDI: + surface->surface_ops = &gdi_surface_ops; + break; + + default: + ERR("Requested unknown surface implementation %#x.\n", surface_type); + return WINED3DERR_INVALIDCALL; + } + + hr = resource_init(&surface->resource, device, WINED3DRTYPE_SURFACE, format, + multisample_type, multisample_quality, usage, pool, width, height, 1, + resource_size, parent, parent_ops, &surface_resource_ops); + if (FAILED(hr)) + { + WARN("Failed to initialize resource, returning %#x.\n", hr); + return hr; + } + + /* "Standalone" surface. */ + surface_set_container(surface, WINED3D_CONTAINER_NONE, NULL); + + surface->texture_level = level; + list_init(&surface->overlays); + + /* Flags */ + surface->flags = SFLAG_NORMCOORD; /* Default to normalized coords. */ + if (discard) + surface->flags |= SFLAG_DISCARD; + if (lockable || format_id == WINED3DFMT_D16_LOCKABLE) + surface->flags |= SFLAG_LOCKABLE; + /* I'm not sure if this qualifies as a hack or as an optimization. It + * seems reasonable to assume that lockable render targets will get + * locked, so we might as well set SFLAG_DYNLOCK right at surface + * creation. However, the other reason we want to do this is that several + * ddraw applications access surface memory while the surface isn't + * mapped. The SFLAG_DYNLOCK behaviour of keeping SYSMEM around for + * future locks prevents these from crashing. */ + if (lockable && (usage & WINED3DUSAGE_RENDERTARGET)) + surface->flags |= SFLAG_DYNLOCK; + + /* Mark the texture as dirty so that it gets loaded first time around. */ + surface_add_dirty_rect(surface, NULL); + list_init(&surface->renderbuffers); + + TRACE("surface %p, memory %p, size %u\n", + surface, surface->resource.allocatedMemory, surface->resource.size); + + /* Call the private setup routine */ + hr = surface->surface_ops->surface_private_setup(surface); + if (FAILED(hr)) + { + ERR("Private setup failed, returning %#x\n", hr); + surface->surface_ops->surface_cleanup(surface); + return hr; + } + + return hr; +} + +HRESULT CDECL wined3d_surface_create(struct wined3d_device *device, UINT width, UINT height, + enum wined3d_format_id format_id, BOOL lockable, BOOL discard, UINT level, DWORD usage, WINED3DPOOL pool, + WINED3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality, WINED3DSURFTYPE surface_type, + void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_surface **surface) +{ + struct wined3d_surface *object; + HRESULT hr; + + TRACE("device %p, width %u, height %u, format %s, lockable %#x, discard %#x, level %u\n", + device, width, height, debug_d3dformat(format_id), lockable, discard, level); + TRACE("surface %p, usage %s (%#x), pool %s, multisample_type %#x, multisample_quality %u\n", + surface, debug_d3dusage(usage), usage, debug_d3dpool(pool), multisample_type, multisample_quality); + TRACE("surface_type %#x, parent %p, parent_ops %p.\n", surface_type, parent, parent_ops); + + if (surface_type == SURFACE_OPENGL && !device->adapter) + { + ERR("OpenGL surfaces are not available without OpenGL.\n"); + return WINED3DERR_NOTAVAILABLE; + } + + object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); + if (!object) + { + ERR("Failed to allocate surface memory.\n"); + return WINED3DERR_OUTOFVIDEOMEMORY; + } + + hr = surface_init(object, surface_type, device->surface_alignment, width, height, level, lockable, + discard, multisample_type, multisample_quality, device, usage, format_id, pool, parent, parent_ops); + if (FAILED(hr)) + { + WARN("Failed to initialize surface, returning %#x.\n", hr); + HeapFree(GetProcessHeap(), 0, object); + return hr; + } + + TRACE("Created surface %p.\n", object); + *surface = object; + + return hr; } diff --git a/dll/directx/wine/wined3d/surface_base.c b/dll/directx/wine/wined3d/surface_base.c deleted file mode 100644 index e4dd853b0b3..00000000000 --- a/dll/directx/wine/wined3d/surface_base.c +++ /dev/null @@ -1,1875 +0,0 @@ -/* - * IWineD3DSurface Implementation of management(non-rendering) functions - * - * Copyright 1998 Lionel Ulmer - * Copyright 2000-2001 TransGaming Technologies Inc. - * Copyright 2002-2005 Jason Edmeades - * Copyright 2002-2003 Raphael Junqueira - * Copyright 2004 Christian Costa - * Copyright 2005 Oliver Stieber - * Copyright 2006-2008 Stefan Dösinger for CodeWeavers - * Copyright 2007 Henri Verbeet - * Copyright 2006-2007 Roderick Colenbrander - * Copyright 2009 Henri Verbeet for CodeWeavers - * - * 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 "config.h" -#include "wine/port.h" -#include "wined3d_private.h" - -WINE_DEFAULT_DEBUG_CHANNEL(d3d_surface); - -/* See also float_16_to_32() in wined3d_private.h */ -static inline unsigned short float_32_to_16(const float *in) -{ - int exp = 0; - float tmp = fabs(*in); - unsigned int mantissa; - unsigned short ret; - - /* Deal with special numbers */ - if (*in == 0.0f) return 0x0000; - if(isnan(*in)) return 0x7C01; - if (isinf(*in)) return (*in < 0.0f ? 0xFC00 : 0x7c00); - - if(tmp < powf(2, 10)) { - do - { - tmp = tmp * 2.0f; - exp--; - }while(tmp < powf(2, 10)); - } else if(tmp >= powf(2, 11)) { - do - { - tmp /= 2.0f; - exp++; - }while(tmp >= powf(2, 11)); - } - - mantissa = (unsigned int) tmp; - if(tmp - mantissa >= 0.5f) mantissa++; /* round to nearest, away from zero */ - - exp += 10; /* Normalize the mantissa */ - exp += 15; /* Exponent is encoded with excess 15 */ - - if(exp > 30) { /* too big */ - ret = 0x7c00; /* INF */ - } else if(exp <= 0) { - /* exp == 0: Non-normalized mantissa. Returns 0x0000 (=0.0) for too small numbers */ - while(exp <= 0) { - mantissa = mantissa >> 1; - exp++; - } - ret = mantissa & 0x3ff; - } else { - ret = (exp << 10) | (mantissa & 0x3ff); - } - - ret |= ((*in < 0.0f ? 1 : 0) << 15); /* Add the sign */ - return ret; -} - -/* ******************************************* - IWineD3DSurface IUnknown parts follow - ******************************************* */ -HRESULT WINAPI IWineD3DBaseSurfaceImpl_QueryInterface(IWineD3DSurface *iface, REFIID riid, LPVOID *ppobj) -{ - IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface; - /* Warn ,but be nice about things */ - TRACE("(%p)->(%s,%p)\n", This,debugstr_guid(riid),ppobj); - - if (IsEqualGUID(riid, &IID_IUnknown) - || IsEqualGUID(riid, &IID_IWineD3DBase) - || IsEqualGUID(riid, &IID_IWineD3DResource) - || IsEqualGUID(riid, &IID_IWineD3DSurface)) { - IUnknown_AddRef((IUnknown*)iface); - *ppobj = This; - return S_OK; - } - *ppobj = NULL; - return E_NOINTERFACE; -} - -ULONG WINAPI IWineD3DBaseSurfaceImpl_AddRef(IWineD3DSurface *iface) { - IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface; - ULONG ref = InterlockedIncrement(&This->resource.ref); - TRACE("(%p) : AddRef increasing from %d\n", This,ref - 1); - return ref; -} - -/* **************************************************** - IWineD3DSurface IWineD3DResource parts follow - **************************************************** */ -HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetPrivateData(IWineD3DSurface *iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) { - return resource_set_private_data((IWineD3DResource *)iface, refguid, pData, SizeOfData, Flags); -} - -HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetPrivateData(IWineD3DSurface *iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) { - return resource_get_private_data((IWineD3DResource *)iface, refguid, pData, pSizeOfData); -} - -HRESULT WINAPI IWineD3DBaseSurfaceImpl_FreePrivateData(IWineD3DSurface *iface, REFGUID refguid) { - return resource_free_private_data((IWineD3DResource *)iface, refguid); -} - -DWORD WINAPI IWineD3DBaseSurfaceImpl_SetPriority(IWineD3DSurface *iface, DWORD PriorityNew) { - return resource_set_priority((IWineD3DResource *)iface, PriorityNew); -} - -DWORD WINAPI IWineD3DBaseSurfaceImpl_GetPriority(IWineD3DSurface *iface) { - return resource_get_priority((IWineD3DResource *)iface); -} - -WINED3DRESOURCETYPE WINAPI IWineD3DBaseSurfaceImpl_GetType(IWineD3DSurface *iface) { - TRACE("(%p) : calling resourceimpl_GetType\n", iface); - return resource_get_type((IWineD3DResource *)iface); -} - -void * WINAPI IWineD3DBaseSurfaceImpl_GetParent(IWineD3DSurface *iface) -{ - TRACE("iface %p.\n", iface); - - return ((IWineD3DSurfaceImpl *)iface)->resource.parent; -} - -void WINAPI IWineD3DBaseSurfaceImpl_GetDesc(IWineD3DSurface *iface, WINED3DSURFACE_DESC *desc) -{ - IWineD3DSurfaceImpl *surface = (IWineD3DSurfaceImpl *)iface; - - TRACE("iface %p, desc %p.\n", iface, desc); - - desc->format = surface->resource.format->id; - desc->resource_type = surface->resource.resourceType; - desc->usage = surface->resource.usage; - desc->pool = surface->resource.pool; - desc->size = surface->resource.size; /* dx8 only */ - desc->multisample_type = surface->currentDesc.MultiSampleType; - desc->multisample_quality = surface->currentDesc.MultiSampleQuality; - desc->width = surface->currentDesc.Width; - desc->height = surface->currentDesc.Height; -} - -HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetBltStatus(IWineD3DSurface *iface, DWORD Flags) -{ - TRACE("iface %p, flags %#x.\n", iface, Flags); - - switch (Flags) - { - case WINEDDGBS_CANBLT: - case WINEDDGBS_ISBLTDONE: - return WINED3D_OK; - - default: - return WINED3DERR_INVALIDCALL; - } -} - -HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetFlipStatus(IWineD3DSurface *iface, DWORD Flags) { - /* XXX: DDERR_INVALIDSURFACETYPE */ - - TRACE("(%p)->(%08x)\n",iface,Flags); - switch (Flags) { - case WINEDDGFS_CANFLIP: - case WINEDDGFS_ISFLIPDONE: - return WINED3D_OK; - - default: - return WINED3DERR_INVALIDCALL; - } -} - -HRESULT WINAPI IWineD3DBaseSurfaceImpl_IsLost(IWineD3DSurface *iface) { - IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface; - TRACE("(%p)\n", This); - - /* D3D8 and 9 loose full devices, ddraw only surfaces */ - return This->Flags & SFLAG_LOST ? WINED3DERR_DEVICELOST : WINED3D_OK; -} - -HRESULT WINAPI IWineD3DBaseSurfaceImpl_Restore(IWineD3DSurface *iface) { - IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface; - TRACE("(%p)\n", This); - - /* So far we don't lose anything :) */ - This->Flags &= ~SFLAG_LOST; - return WINED3D_OK; -} - -HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetPalette(IWineD3DSurface *iface, IWineD3DPalette *Pal) { - IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface; - IWineD3DPaletteImpl *PalImpl = (IWineD3DPaletteImpl *) Pal; - TRACE("(%p)->(%p)\n", This, Pal); - - if(This->palette == PalImpl) { - TRACE("Nop palette change\n"); - return WINED3D_OK; - } - - if (This->palette) - if (This->resource.usage & WINED3DUSAGE_RENDERTARGET) - This->palette->Flags &= ~WINEDDPCAPS_PRIMARYSURFACE; - - This->palette = PalImpl; - - if (PalImpl) - { - if (This->resource.usage & WINED3DUSAGE_RENDERTARGET) - PalImpl->Flags |= WINEDDPCAPS_PRIMARYSURFACE; - - return IWineD3DSurface_RealizePalette(iface); - } - else return WINED3D_OK; -} - -HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetColorKey(IWineD3DSurface *iface, DWORD Flags, const WINEDDCOLORKEY *CKey) -{ - IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface; - TRACE("(%p)->(%08x,%p)\n", This, Flags, CKey); - - if (Flags & WINEDDCKEY_COLORSPACE) - { - FIXME(" colorkey value not supported (%08x) !\n", Flags); - return WINED3DERR_INVALIDCALL; - } - - /* Dirtify the surface, but only if a key was changed */ - if(CKey) { - switch (Flags & ~WINEDDCKEY_COLORSPACE) { - case WINEDDCKEY_DESTBLT: - This->DestBltCKey = *CKey; - This->CKeyFlags |= WINEDDSD_CKDESTBLT; - break; - - case WINEDDCKEY_DESTOVERLAY: - This->DestOverlayCKey = *CKey; - This->CKeyFlags |= WINEDDSD_CKDESTOVERLAY; - break; - - case WINEDDCKEY_SRCOVERLAY: - This->SrcOverlayCKey = *CKey; - This->CKeyFlags |= WINEDDSD_CKSRCOVERLAY; - break; - - case WINEDDCKEY_SRCBLT: - This->SrcBltCKey = *CKey; - This->CKeyFlags |= WINEDDSD_CKSRCBLT; - break; - } - } - else { - switch (Flags & ~WINEDDCKEY_COLORSPACE) { - case WINEDDCKEY_DESTBLT: - This->CKeyFlags &= ~WINEDDSD_CKDESTBLT; - break; - - case WINEDDCKEY_DESTOVERLAY: - This->CKeyFlags &= ~WINEDDSD_CKDESTOVERLAY; - break; - - case WINEDDCKEY_SRCOVERLAY: - This->CKeyFlags &= ~WINEDDSD_CKSRCOVERLAY; - break; - - case WINEDDCKEY_SRCBLT: - This->CKeyFlags &= ~WINEDDSD_CKSRCBLT; - break; - } - } - - return WINED3D_OK; -} - -HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetPalette(IWineD3DSurface *iface, IWineD3DPalette **Pal) { - IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface; - TRACE("(%p)->(%p)\n", This, Pal); - - *Pal = (IWineD3DPalette *) This->palette; - return WINED3D_OK; -} - -DWORD WINAPI IWineD3DBaseSurfaceImpl_GetPitch(IWineD3DSurface *iface) -{ - IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface; - const struct wined3d_format *format = This->resource.format; - DWORD ret; - TRACE("(%p)\n", This); - - if ((format->Flags & (WINED3DFMT_FLAG_COMPRESSED | WINED3DFMT_FLAG_BROKEN_PITCH)) == WINED3DFMT_FLAG_COMPRESSED) - { - /* Since compressed formats are block based, pitch means the amount of - * bytes to the next row of block rather than the next row of pixels. */ - UINT row_block_count = (This->currentDesc.Width + format->block_width - 1) / format->block_width; - ret = row_block_count * format->block_byte_count; - } - else - { - unsigned char alignment = This->resource.device->surface_alignment; - ret = This->resource.format->byte_count * This->currentDesc.Width; /* Bytes / row */ - ret = (ret + alignment - 1) & ~(alignment - 1); - } - TRACE("(%p) Returning %d\n", This, ret); - return ret; -} - -HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetOverlayPosition(IWineD3DSurface *iface, LONG X, LONG Y) { - IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface; - LONG w, h; - - TRACE("(%p)->(%d,%d) Stub!\n", This, X, Y); - - if(!(This->resource.usage & WINED3DUSAGE_OVERLAY)) - { - TRACE("(%p): Not an overlay surface\n", This); - return WINEDDERR_NOTAOVERLAYSURFACE; - } - - w = This->overlay_destrect.right - This->overlay_destrect.left; - h = This->overlay_destrect.bottom - This->overlay_destrect.top; - This->overlay_destrect.left = X; - This->overlay_destrect.top = Y; - This->overlay_destrect.right = X + w; - This->overlay_destrect.bottom = Y + h; - - IWineD3DSurface_DrawOverlay(iface); - - return WINED3D_OK; -} - -HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetOverlayPosition(IWineD3DSurface *iface, LONG *X, LONG *Y) { - IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface; - HRESULT hr; - - TRACE("(%p)->(%p,%p)\n", This, X, Y); - - if(!(This->resource.usage & WINED3DUSAGE_OVERLAY)) - { - TRACE("(%p): Not an overlay surface\n", This); - return WINEDDERR_NOTAOVERLAYSURFACE; - } - - if (!This->overlay_dest) - { - *X = 0; *Y = 0; - hr = WINEDDERR_OVERLAYNOTVISIBLE; - } else { - *X = This->overlay_destrect.left; - *Y = This->overlay_destrect.top; - hr = WINED3D_OK; - } - - TRACE("Returning 0x%08x, position %d, %d\n", hr, *X, *Y); - return hr; -} - -HRESULT WINAPI IWineD3DBaseSurfaceImpl_UpdateOverlayZOrder(IWineD3DSurface *iface, DWORD Flags, IWineD3DSurface *Ref) { - IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface; - - FIXME("iface %p, flags %#x, ref %p stub!\n", iface, Flags, Ref); - - if(!(This->resource.usage & WINED3DUSAGE_OVERLAY)) - { - TRACE("(%p): Not an overlay surface\n", This); - return WINEDDERR_NOTAOVERLAYSURFACE; - } - - return WINED3D_OK; -} - -HRESULT WINAPI IWineD3DBaseSurfaceImpl_UpdateOverlay(IWineD3DSurface *iface, const RECT *SrcRect, - IWineD3DSurface *DstSurface, const RECT *DstRect, DWORD Flags, const WINEDDOVERLAYFX *FX) -{ - IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface; - IWineD3DSurfaceImpl *Dst = (IWineD3DSurfaceImpl *) DstSurface; - TRACE("(%p)->(%p, %p, %p, %08x, %p)\n", This, SrcRect, Dst, DstRect, Flags, FX); - - if(!(This->resource.usage & WINED3DUSAGE_OVERLAY)) - { - WARN("(%p): Not an overlay surface\n", This); - return WINEDDERR_NOTAOVERLAYSURFACE; - } else if(!DstSurface) { - WARN("(%p): Dest surface is NULL\n", This); - return WINED3DERR_INVALIDCALL; - } - - if(SrcRect) { - This->overlay_srcrect = *SrcRect; - } else { - This->overlay_srcrect.left = 0; - This->overlay_srcrect.top = 0; - This->overlay_srcrect.right = This->currentDesc.Width; - This->overlay_srcrect.bottom = This->currentDesc.Height; - } - - if(DstRect) { - This->overlay_destrect = *DstRect; - } else { - This->overlay_destrect.left = 0; - This->overlay_destrect.top = 0; - This->overlay_destrect.right = Dst ? Dst->currentDesc.Width : 0; - This->overlay_destrect.bottom = Dst ? Dst->currentDesc.Height : 0; - } - - if(This->overlay_dest && (This->overlay_dest != Dst || Flags & WINEDDOVER_HIDE)) { - list_remove(&This->overlay_entry); - } - - if(Flags & WINEDDOVER_SHOW) { - if(This->overlay_dest != Dst) { - This->overlay_dest = Dst; - list_add_tail(&Dst->overlays, &This->overlay_entry); - } - } else if(Flags & WINEDDOVER_HIDE) { - /* tests show that the rectangles are erased on hide */ - This->overlay_srcrect.left = 0; This->overlay_srcrect.top = 0; - This->overlay_srcrect.right = 0; This->overlay_srcrect.bottom = 0; - This->overlay_destrect.left = 0; This->overlay_destrect.top = 0; - This->overlay_destrect.right = 0; This->overlay_destrect.bottom = 0; - This->overlay_dest = NULL; - } - - IWineD3DSurface_DrawOverlay(iface); - - return WINED3D_OK; -} - -HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetClipper(IWineD3DSurface *iface, IWineD3DClipper *clipper) -{ - IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface; - TRACE("(%p)->(%p)\n", This, clipper); - - This->clipper = clipper; - return WINED3D_OK; -} - -HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetClipper(IWineD3DSurface *iface, IWineD3DClipper **clipper) -{ - IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface; - TRACE("(%p)->(%p)\n", This, clipper); - - *clipper = This->clipper; - if(*clipper) { - IWineD3DClipper_AddRef(*clipper); - } - return WINED3D_OK; -} - -HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetFormat(IWineD3DSurface *iface, enum wined3d_format_id format_id) -{ - IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface; - const struct wined3d_format *format = wined3d_get_format(&This->resource.device->adapter->gl_info, format_id); - - if (This->resource.format->id != WINED3DFMT_UNKNOWN) - { - FIXME("(%p) : The format of the surface must be WINED3DFORMAT_UNKNOWN\n", This); - return WINED3DERR_INVALIDCALL; - } - - TRACE("(%p) : Setting texture format to %s (%#x).\n", This, debug_d3dformat(format_id), format_id); - - This->resource.size = wined3d_format_calculate_size(format, This->resource.device->surface_alignment, - This->pow2Width, This->pow2Height); - - This->Flags |= (WINED3DFMT_D16_LOCKABLE == format_id) ? SFLAG_LOCKABLE : 0; - - This->resource.format = format; - - TRACE("(%p) : Size %d, bytesPerPixel %d\n", This, This->resource.size, format->byte_count); - - return WINED3D_OK; -} - -HRESULT IWineD3DBaseSurfaceImpl_CreateDIBSection(IWineD3DSurface *iface) -{ - IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface; - const struct wined3d_format *format = This->resource.format; - int extraline = 0; - SYSTEM_INFO sysInfo; - BITMAPINFO* b_info; - HDC ddc; - DWORD *masks; - UINT usage; - - if (!(format->Flags & WINED3DFMT_FLAG_GETDC)) - { - WARN("Cannot use GetDC on a %s surface\n", debug_d3dformat(format->id)); - return WINED3DERR_INVALIDCALL; - } - - switch (format->byte_count) - { - case 2: - case 4: - /* Allocate extra space to store the RGB bit masks. */ - b_info = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(BITMAPINFOHEADER) + 3 * sizeof(DWORD)); - break; - - case 3: - b_info = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(BITMAPINFOHEADER)); - break; - - default: - /* Allocate extra space for a palette. */ - b_info = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, - sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * (1 << (format->byte_count * 8))); - break; - } - - if (!b_info) - return E_OUTOFMEMORY; - - /* Some apps access the surface in via DWORDs, and do not take the necessary care at the end of the - * surface. So we need at least extra 4 bytes at the end of the surface. Check against the page size, - * if the last page used for the surface has at least 4 spare bytes we're safe, otherwise - * add an extra line to the dib section - */ - GetSystemInfo(&sysInfo); - if( ((This->resource.size + 3) % sysInfo.dwPageSize) < 4) { - extraline = 1; - TRACE("Adding an extra line to the dib section\n"); - } - - b_info->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - /* TODO: Is there a nicer way to force a specific alignment? (8 byte for ddraw) */ - b_info->bmiHeader.biWidth = IWineD3DSurface_GetPitch(iface) / format->byte_count; - b_info->bmiHeader.biHeight = -This->currentDesc.Height -extraline; - b_info->bmiHeader.biSizeImage = ( This->currentDesc.Height + extraline) * IWineD3DSurface_GetPitch(iface); - b_info->bmiHeader.biPlanes = 1; - b_info->bmiHeader.biBitCount = format->byte_count * 8; - - b_info->bmiHeader.biXPelsPerMeter = 0; - b_info->bmiHeader.biYPelsPerMeter = 0; - b_info->bmiHeader.biClrUsed = 0; - b_info->bmiHeader.biClrImportant = 0; - - /* Get the bit masks */ - masks = (DWORD *)b_info->bmiColors; - switch (This->resource.format->id) - { - case WINED3DFMT_B8G8R8_UNORM: - usage = DIB_RGB_COLORS; - b_info->bmiHeader.biCompression = BI_RGB; - break; - - case WINED3DFMT_B5G5R5X1_UNORM: - case WINED3DFMT_B5G5R5A1_UNORM: - case WINED3DFMT_B4G4R4A4_UNORM: - case WINED3DFMT_B4G4R4X4_UNORM: - case WINED3DFMT_B2G3R3_UNORM: - case WINED3DFMT_B2G3R3A8_UNORM: - case WINED3DFMT_R10G10B10A2_UNORM: - case WINED3DFMT_R8G8B8A8_UNORM: - case WINED3DFMT_R8G8B8X8_UNORM: - case WINED3DFMT_B10G10R10A2_UNORM: - case WINED3DFMT_B5G6R5_UNORM: - case WINED3DFMT_R16G16B16A16_UNORM: - usage = 0; - b_info->bmiHeader.biCompression = BI_BITFIELDS; - masks[0] = format->red_mask; - masks[1] = format->green_mask; - masks[2] = format->blue_mask; - break; - - default: - /* Don't know palette */ - b_info->bmiHeader.biCompression = BI_RGB; - usage = 0; - break; - } - - if (!(ddc = GetDC(0))) - { - HeapFree(GetProcessHeap(), 0, b_info); - return HRESULT_FROM_WIN32(GetLastError()); - } - - TRACE("Creating a DIB section with size %dx%dx%d, size=%d\n", b_info->bmiHeader.biWidth, b_info->bmiHeader.biHeight, b_info->bmiHeader.biBitCount, b_info->bmiHeader.biSizeImage); - This->dib.DIBsection = CreateDIBSection(ddc, b_info, usage, &This->dib.bitmap_data, 0 /* Handle */, 0 /* Offset */); - ReleaseDC(0, ddc); - - if (!This->dib.DIBsection) { - ERR("CreateDIBSection failed!\n"); - HeapFree(GetProcessHeap(), 0, b_info); - return HRESULT_FROM_WIN32(GetLastError()); - } - - TRACE("DIBSection at : %p\n", This->dib.bitmap_data); - /* copy the existing surface to the dib section */ - if(This->resource.allocatedMemory) { - memcpy(This->dib.bitmap_data, This->resource.allocatedMemory, This->currentDesc.Height * IWineD3DSurface_GetPitch(iface)); - } else { - /* This is to make LockRect read the gl Texture although memory is allocated */ - This->Flags &= ~SFLAG_INSYSMEM; - } - This->dib.bitmap_size = b_info->bmiHeader.biSizeImage; - - HeapFree(GetProcessHeap(), 0, b_info); - - /* Now allocate a HDC */ - This->hDC = CreateCompatibleDC(0); - This->dib.holdbitmap = SelectObject(This->hDC, This->dib.DIBsection); - TRACE("using wined3d palette %p\n", This->palette); - SelectPalette(This->hDC, - This->palette ? This->palette->hpal : 0, - FALSE); - - This->Flags |= SFLAG_DIBSECTION; - - HeapFree(GetProcessHeap(), 0, This->resource.heapMemory); - This->resource.heapMemory = NULL; - - return WINED3D_OK; -} - -static void convert_r32_float_r16_float(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, - unsigned int w, unsigned int h) -{ - unsigned int x, y; - const float *src_f; - unsigned short *dst_s; - - TRACE("Converting %dx%d pixels, pitches %d %d\n", w, h, pitch_in, pitch_out); - for(y = 0; y < h; y++) { - src_f = (const float *)(src + y * pitch_in); - dst_s = (unsigned short *) (dst + y * pitch_out); - for(x = 0; x < w; x++) { - dst_s[x] = float_32_to_16(src_f + x); - } - } -} - -static void convert_r5g6b5_x8r8g8b8(const BYTE *src, BYTE *dst, - DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h) -{ - static const unsigned char convert_5to8[] = - { - 0x00, 0x08, 0x10, 0x19, 0x21, 0x29, 0x31, 0x3a, - 0x42, 0x4a, 0x52, 0x5a, 0x63, 0x6b, 0x73, 0x7b, - 0x84, 0x8c, 0x94, 0x9c, 0xa5, 0xad, 0xb5, 0xbd, - 0xc5, 0xce, 0xd6, 0xde, 0xe6, 0xef, 0xf7, 0xff, - }; - static const unsigned char convert_6to8[] = - { - 0x00, 0x04, 0x08, 0x0c, 0x10, 0x14, 0x18, 0x1c, - 0x20, 0x24, 0x28, 0x2d, 0x31, 0x35, 0x39, 0x3d, - 0x41, 0x45, 0x49, 0x4d, 0x51, 0x55, 0x59, 0x5d, - 0x61, 0x65, 0x69, 0x6d, 0x71, 0x75, 0x79, 0x7d, - 0x82, 0x86, 0x8a, 0x8e, 0x92, 0x96, 0x9a, 0x9e, - 0xa2, 0xa6, 0xaa, 0xae, 0xb2, 0xb6, 0xba, 0xbe, - 0xc2, 0xc6, 0xca, 0xce, 0xd2, 0xd7, 0xdb, 0xdf, - 0xe3, 0xe7, 0xeb, 0xef, 0xf3, 0xf7, 0xfb, 0xff, - }; - unsigned int x, y; - - TRACE("Converting %ux%u pixels, pitches %u %u\n", w, h, pitch_in, pitch_out); - - for (y = 0; y < h; ++y) - { - const WORD *src_line = (const WORD *)(src + y * pitch_in); - DWORD *dst_line = (DWORD *)(dst + y * pitch_out); - for (x = 0; x < w; ++x) - { - WORD pixel = src_line[x]; - dst_line[x] = 0xff000000 - | convert_5to8[(pixel & 0xf800) >> 11] << 16 - | convert_6to8[(pixel & 0x07e0) >> 5] << 8 - | convert_5to8[(pixel & 0x001f)]; - } - } -} - -static void convert_a8r8g8b8_x8r8g8b8(const BYTE *src, BYTE *dst, - DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h) -{ - unsigned int x, y; - - TRACE("Converting %ux%u pixels, pitches %u %u\n", w, h, pitch_in, pitch_out); - - for (y = 0; y < h; ++y) - { - const DWORD *src_line = (const DWORD *)(src + y * pitch_in); - DWORD *dst_line = (DWORD *)(dst + y * pitch_out); - - for (x = 0; x < w; ++x) - { - dst_line[x] = 0xff000000 | (src_line[x] & 0xffffff); - } - } -} - -static inline BYTE cliptobyte(int x) -{ - return (BYTE) ((x < 0) ? 0 : ((x > 255) ? 255 : x)); -} - -static void convert_yuy2_x8r8g8b8(const BYTE *src, BYTE *dst, - DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h) -{ - unsigned int x, y; - int c2, d, e, r2 = 0, g2 = 0, b2 = 0; - - TRACE("Converting %ux%u pixels, pitches %u %u\n", w, h, pitch_in, pitch_out); - - for (y = 0; y < h; ++y) - { - const BYTE *src_line = src + y * pitch_in; - DWORD *dst_line = (DWORD *)(dst + y * pitch_out); - for (x = 0; x < w; ++x) - { - /* YUV to RGB conversion formulas from http://en.wikipedia.org/wiki/YUV: - * C = Y - 16; D = U - 128; E = V - 128; - * R = cliptobyte((298 * C + 409 * E + 128) >> 8); - * G = cliptobyte((298 * C - 100 * D - 208 * E + 128) >> 8); - * B = cliptobyte((298 * C + 516 * D + 128) >> 8); - * Two adjacent YUY2 pixels are stored as four bytes: Y0 U Y1 V . - * U and V are shared between the pixels. - */ - if (!(x & 1)) /* for every even pixel, read new U and V */ - { - d = (int) src_line[1] - 128; - e = (int) src_line[3] - 128; - r2 = 409 * e + 128; - g2 = - 100 * d - 208 * e + 128; - b2 = 516 * d + 128; - } - c2 = 298 * ((int) src_line[0] - 16); - dst_line[x] = 0xff000000 - | cliptobyte((c2 + r2) >> 8) << 16 /* red */ - | cliptobyte((c2 + g2) >> 8) << 8 /* green */ - | cliptobyte((c2 + b2) >> 8); /* blue */ - /* Scale RGB values to 0..255 range, - * then clip them if still not in range (may be negative), - * then shift them within DWORD if necessary. - */ - src_line += 2; - } - } -} - -struct d3dfmt_convertor_desc -{ - enum wined3d_format_id from, to; - void (*convert)(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h); -}; - -static const struct d3dfmt_convertor_desc convertors[] = -{ - {WINED3DFMT_R32_FLOAT, WINED3DFMT_R16_FLOAT, convert_r32_float_r16_float}, - {WINED3DFMT_B5G6R5_UNORM, WINED3DFMT_B8G8R8X8_UNORM, convert_r5g6b5_x8r8g8b8}, - {WINED3DFMT_B8G8R8A8_UNORM, WINED3DFMT_B8G8R8X8_UNORM, convert_a8r8g8b8_x8r8g8b8}, - {WINED3DFMT_YUY2, WINED3DFMT_B8G8R8X8_UNORM, convert_yuy2_x8r8g8b8}, -}; - -static inline const struct d3dfmt_convertor_desc *find_convertor(enum wined3d_format_id from, enum wined3d_format_id to) -{ - unsigned int i; - for(i = 0; i < (sizeof(convertors) / sizeof(convertors[0])); i++) { - if(convertors[i].from == from && convertors[i].to == to) { - return &convertors[i]; - } - } - return NULL; -} - -/***************************************************************************** - * surface_convert_format - * - * Creates a duplicate of a surface in a different format. Is used by Blt to - * blit between surfaces with different formats - * - * Parameters - * source: Source surface - * fmt: Requested destination format - * - *****************************************************************************/ -static IWineD3DSurfaceImpl *surface_convert_format(IWineD3DSurfaceImpl *source, enum wined3d_format_id to_fmt) -{ - IWineD3DSurface *ret = NULL; - const struct d3dfmt_convertor_desc *conv; - WINED3DLOCKED_RECT lock_src, lock_dst; - HRESULT hr; - - conv = find_convertor(source->resource.format->id, to_fmt); - if (!conv) - { - FIXME("Cannot find a conversion function from format %s to %s.\n", - debug_d3dformat(source->resource.format->id), debug_d3dformat(to_fmt)); - return NULL; - } - - IWineD3DDevice_CreateSurface((IWineD3DDevice *)source->resource.device, source->currentDesc.Width, - source->currentDesc.Height, to_fmt, TRUE /* lockable */, TRUE /* discard */, 0 /* level */, - 0 /* usage */, WINED3DPOOL_SCRATCH, WINED3DMULTISAMPLE_NONE /* TODO: Multisampled conversion */, - 0 /* MultiSampleQuality */, IWineD3DSurface_GetImplType((IWineD3DSurface *) source), - NULL /* parent */, &wined3d_null_parent_ops, &ret); - if(!ret) { - ERR("Failed to create a destination surface for conversion\n"); - return NULL; - } - - memset(&lock_src, 0, sizeof(lock_src)); - memset(&lock_dst, 0, sizeof(lock_dst)); - - hr = IWineD3DSurface_LockRect((IWineD3DSurface *) source, &lock_src, NULL, WINED3DLOCK_READONLY); - if(FAILED(hr)) { - ERR("Failed to lock the source surface\n"); - IWineD3DSurface_Release(ret); - return NULL; - } - hr = IWineD3DSurface_LockRect(ret, &lock_dst, NULL, WINED3DLOCK_READONLY); - if(FAILED(hr)) { - ERR("Failed to lock the dest surface\n"); - IWineD3DSurface_UnlockRect((IWineD3DSurface *) source); - IWineD3DSurface_Release(ret); - return NULL; - } - - conv->convert(lock_src.pBits, lock_dst.pBits, lock_src.Pitch, lock_dst.Pitch, - source->currentDesc.Width, source->currentDesc.Height); - - IWineD3DSurface_UnlockRect(ret); - IWineD3DSurface_UnlockRect((IWineD3DSurface *) source); - - return (IWineD3DSurfaceImpl *) ret; -} - -/***************************************************************************** - * _Blt_ColorFill - * - * Helper function that fills a memory area with a specific color - * - * Params: - * buf: memory address to start filling at - * width, height: Dimensions of the area to fill - * bpp: Bit depth of the surface - * lPitch: pitch of the surface - * color: Color to fill with - * - *****************************************************************************/ -static HRESULT - _Blt_ColorFill(BYTE *buf, - int width, int height, - int bpp, LONG lPitch, - DWORD color) -{ - int x, y; - LPBYTE first; - - /* Do first row */ - -#define COLORFILL_ROW(type) \ - { \ - type *d = (type *) buf; \ - for (x = 0; x < width; x++) \ - d[x] = (type) color; \ - break; \ -} - switch(bpp) - { - case 1: COLORFILL_ROW(BYTE) - case 2: COLORFILL_ROW(WORD) - case 3: - { - BYTE *d = buf; - for (x = 0; x < width; x++,d+=3) - { - d[0] = (color ) & 0xFF; - d[1] = (color>> 8) & 0xFF; - d[2] = (color>>16) & 0xFF; - } - break; - } - case 4: COLORFILL_ROW(DWORD) - default: - FIXME("Color fill not implemented for bpp %d!\n", bpp*8); - return WINED3DERR_NOTAVAILABLE; - } - -#undef COLORFILL_ROW - - /* Now copy first row */ - first = buf; - for (y = 1; y < height; y++) - { - buf += lPitch; - memcpy(buf, first, width * bpp); - } - return WINED3D_OK; -} - -/***************************************************************************** - * IWineD3DSurface::Blt, SW emulation version - * - * Performs a blit to a surface, with or without a source surface. - * This is the main functionality of DirectDraw - * - * Params: - * DestRect: Destination rectangle to write to - * src_surface: Source surface, can be NULL - * SrcRect: Source rectangle - *****************************************************************************/ -HRESULT WINAPI IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT *DestRect, IWineD3DSurface *src_surface, - const RECT *SrcRect, DWORD Flags, const WINEDDBLTFX *DDBltFx, WINED3DTEXTUREFILTERTYPE Filter) -{ - IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface; - IWineD3DSurfaceImpl *src = (IWineD3DSurfaceImpl *)src_surface; - RECT xdst,xsrc; - HRESULT ret = WINED3D_OK; - WINED3DLOCKED_RECT dlock, slock; - int bpp, srcheight, srcwidth, dstheight, dstwidth, width; - const struct wined3d_format *sEntry, *dEntry; - int x, y; - const BYTE *sbuf; - BYTE *dbuf; - - TRACE("iface %p, dst_rect %s, src_surface %p, src_rect %s, flags %#x, fx %p, filter %s.\n", - iface, wine_dbgstr_rect(DestRect), src_surface, wine_dbgstr_rect(SrcRect), - Flags, DDBltFx, debug_d3dtexturefiltertype(Filter)); - - if ((This->Flags & SFLAG_LOCKED) || (src && (src->Flags & SFLAG_LOCKED))) - { - WARN(" Surface is busy, returning DDERR_SURFACEBUSY\n"); - return WINEDDERR_SURFACEBUSY; - } - - if(Filter != WINED3DTEXF_NONE && Filter != WINED3DTEXF_POINT) { - /* Can happen when d3d9 apps do a StretchRect call which isn't handled in gl */ - FIXME("Filters not supported in software blit\n"); - } - - /* First check for the validity of source / destination rectangles. - * This was verified using a test application + by MSDN. */ - - if (SrcRect) - { - if (src) - { - if (SrcRect->right < SrcRect->left || SrcRect->bottom < SrcRect->top - || SrcRect->left > src->currentDesc.Width || SrcRect->left < 0 - || SrcRect->top > src->currentDesc.Height || SrcRect->top < 0 - || SrcRect->right > src->currentDesc.Width || SrcRect->right < 0 - || SrcRect->bottom > src->currentDesc.Height || SrcRect->bottom < 0) - { - WARN("Application gave us bad source rectangle for Blt.\n"); - return WINEDDERR_INVALIDRECT; - } - - if (!SrcRect->right || !SrcRect->bottom - || SrcRect->left == (int)src->currentDesc.Width - || SrcRect->top == (int)src->currentDesc.Height) - { - TRACE("Nothing to be done.\n"); - return WINED3D_OK; - } - } - - xsrc = *SrcRect; - } - else if (src) - { - xsrc.left = 0; - xsrc.top = 0; - xsrc.right = src->currentDesc.Width; - xsrc.bottom = src->currentDesc.Height; - } - else - { - memset(&xsrc, 0, sizeof(xsrc)); - } - - if (DestRect) - { - /* For the Destination rect, it can be out of bounds on the condition - * that a clipper is set for the given surface. */ - if (!This->clipper && (DestRect->right < DestRect->left || DestRect->bottom < DestRect->top - || DestRect->left > This->currentDesc.Width || DestRect->left < 0 - || DestRect->top > This->currentDesc.Height || DestRect->top < 0 - || DestRect->right > This->currentDesc.Width || DestRect->right < 0 - || DestRect->bottom > This->currentDesc.Height || DestRect->bottom < 0)) - { - WARN("Application gave us bad destination rectangle for Blt without a clipper set.\n"); - return WINEDDERR_INVALIDRECT; - } - - if (DestRect->right <= 0 || DestRect->bottom <= 0 - || DestRect->left >= (int)This->currentDesc.Width - || DestRect->top >= (int)This->currentDesc.Height) - { - TRACE("Nothing to be done.\n"); - return WINED3D_OK; - } - - if (!src) - { - RECT full_rect; - - full_rect.left = 0; - full_rect.top = 0; - full_rect.right = This->currentDesc.Width; - full_rect.bottom = This->currentDesc.Height; - IntersectRect(&xdst, &full_rect, DestRect); - } - else - { - BOOL clip_horiz, clip_vert; - - xdst = *DestRect; - clip_horiz = xdst.left < 0 || xdst.right > (int)This->currentDesc.Width; - clip_vert = xdst.top < 0 || xdst.bottom > (int)This->currentDesc.Height; - - if (clip_vert || clip_horiz) - { - /* Now check if this is a special case or not... */ - if ((Flags & WINEDDBLT_DDFX) - || (clip_horiz && xdst.right - xdst.left != xsrc.right - xsrc.left) - || (clip_vert && xdst.bottom - xdst.top != xsrc.bottom - xsrc.top)) - { - WARN("Out of screen rectangle in special case. Not handled right now.\n"); - return WINED3D_OK; - } - - if (clip_horiz) - { - if (xdst.left < 0) - { - xsrc.left -= xdst.left; - xdst.left = 0; - } - if (xdst.right > This->currentDesc.Width) - { - xsrc.right -= (xdst.right - (int)This->currentDesc.Width); - xdst.right = (int)This->currentDesc.Width; - } - } - - if (clip_vert) - { - if (xdst.top < 0) - { - xsrc.top -= xdst.top; - xdst.top = 0; - } - if (xdst.bottom > This->currentDesc.Height) - { - xsrc.bottom -= (xdst.bottom - (int)This->currentDesc.Height); - xdst.bottom = (int)This->currentDesc.Height; - } - } - - /* And check if after clipping something is still to be done... */ - if ((xdst.right <= 0) || (xdst.bottom <= 0) - || (xdst.left >= (int)This->currentDesc.Width) - || (xdst.top >= (int)This->currentDesc.Height) - || (xsrc.right <= 0) || (xsrc.bottom <= 0) - || (xsrc.left >= (int)src->currentDesc.Width) - || (xsrc.top >= (int)src->currentDesc.Height)) - { - TRACE("Nothing to be done after clipping.\n"); - return WINED3D_OK; - } - } - } - } - else - { - xdst.left = 0; - xdst.top = 0; - xdst.right = This->currentDesc.Width; - xdst.bottom = This->currentDesc.Height; - } - - if (src == This) - { - IWineD3DSurface_LockRect(iface, &dlock, NULL, 0); - slock = dlock; - sEntry = This->resource.format; - dEntry = sEntry; - } - else - { - dEntry = This->resource.format; - if (src) - { - if (This->resource.format->id != src->resource.format->id) - { - src = surface_convert_format(src, dEntry->id); - if (!src) - { - /* The conv function writes a FIXME */ - WARN("Cannot convert source surface format to dest format\n"); - goto release; - } - } - IWineD3DSurface_LockRect((IWineD3DSurface *)src, &slock, NULL, WINED3DLOCK_READONLY); - sEntry = src->resource.format; - } - else - { - sEntry = dEntry; - } - if (DestRect) - IWineD3DSurface_LockRect(iface, &dlock, &xdst, 0); - else - IWineD3DSurface_LockRect(iface, &dlock, NULL, 0); - } - - if (!DDBltFx || !(DDBltFx->dwDDFX)) Flags &= ~WINEDDBLT_DDFX; - - if (sEntry->Flags & dEntry->Flags & WINED3DFMT_FLAG_FOURCC) - { - if (!DestRect || src == This) - { - memcpy(dlock.pBits, slock.pBits, This->resource.size); - goto release; - } - } - - bpp = This->resource.format->byte_count; - srcheight = xsrc.bottom - xsrc.top; - srcwidth = xsrc.right - xsrc.left; - dstheight = xdst.bottom - xdst.top; - dstwidth = xdst.right - xdst.left; - width = (xdst.right - xdst.left) * bpp; - - if (DestRect && src != This) - dbuf = dlock.pBits; - else - dbuf = (BYTE*)dlock.pBits+(xdst.top*dlock.Pitch)+(xdst.left*bpp); - - if (Flags & WINEDDBLT_WAIT) - { - Flags &= ~WINEDDBLT_WAIT; - } - if (Flags & WINEDDBLT_ASYNC) - { - static BOOL displayed = FALSE; - if (!displayed) - FIXME("Can't handle WINEDDBLT_ASYNC flag right now.\n"); - displayed = TRUE; - Flags &= ~WINEDDBLT_ASYNC; - } - if (Flags & WINEDDBLT_DONOTWAIT) - { - /* WINEDDBLT_DONOTWAIT appeared in DX7 */ - static BOOL displayed = FALSE; - if (!displayed) - FIXME("Can't handle WINEDDBLT_DONOTWAIT flag right now.\n"); - displayed = TRUE; - Flags &= ~WINEDDBLT_DONOTWAIT; - } - - /* First, all the 'source-less' blits */ - if (Flags & WINEDDBLT_COLORFILL) - { - ret = _Blt_ColorFill(dbuf, dstwidth, dstheight, bpp, - dlock.Pitch, DDBltFx->u5.dwFillColor); - Flags &= ~WINEDDBLT_COLORFILL; - } - - if (Flags & WINEDDBLT_DEPTHFILL) - { - FIXME("DDBLT_DEPTHFILL needs to be implemented!\n"); - } - if (Flags & WINEDDBLT_ROP) - { - /* Catch some degenerate cases here */ - switch(DDBltFx->dwROP) - { - case BLACKNESS: - ret = _Blt_ColorFill(dbuf,dstwidth,dstheight,bpp,dlock.Pitch,0); - break; - case 0xAA0029: /* No-op */ - break; - case WHITENESS: - ret = _Blt_ColorFill(dbuf,dstwidth,dstheight,bpp,dlock.Pitch,~0); - break; - case SRCCOPY: /* well, we do that below ? */ - break; - default: - FIXME("Unsupported raster op: %08x Pattern: %p\n", DDBltFx->dwROP, DDBltFx->u5.lpDDSPattern); - goto error; - } - Flags &= ~WINEDDBLT_ROP; - } - if (Flags & WINEDDBLT_DDROPS) - { - FIXME("\tDdraw Raster Ops: %08x Pattern: %p\n", DDBltFx->dwDDROP, DDBltFx->u5.lpDDSPattern); - } - /* Now the 'with source' blits */ - if (src) - { - const BYTE *sbase; - int sx, xinc, sy, yinc; - - if (!dstwidth || !dstheight) /* hmm... stupid program ? */ - goto release; - sbase = (BYTE*)slock.pBits+(xsrc.top*slock.Pitch)+xsrc.left*bpp; - xinc = (srcwidth << 16) / dstwidth; - yinc = (srcheight << 16) / dstheight; - - if (!Flags) - { - /* No effects, we can cheat here */ - if (dstwidth == srcwidth) - { - if (dstheight == srcheight) - { - /* No stretching in either direction. This needs to be as - * fast as possible */ - sbuf = sbase; - - /* check for overlapping surfaces */ - if (src != This || xdst.top < xsrc.top || - xdst.right <= xsrc.left || xsrc.right <= xdst.left) - { - /* no overlap, or dst above src, so copy from top downwards */ - for (y = 0; y < dstheight; y++) - { - memcpy(dbuf, sbuf, width); - sbuf += slock.Pitch; - dbuf += dlock.Pitch; - } - } - else if (xdst.top > xsrc.top) /* copy from bottom upwards */ - { - sbuf += (slock.Pitch*dstheight); - dbuf += (dlock.Pitch*dstheight); - for (y = 0; y < dstheight; y++) - { - sbuf -= slock.Pitch; - dbuf -= dlock.Pitch; - memcpy(dbuf, sbuf, width); - } - } - else /* src and dst overlapping on the same line, use memmove */ - { - for (y = 0; y < dstheight; y++) - { - memmove(dbuf, sbuf, width); - sbuf += slock.Pitch; - dbuf += dlock.Pitch; - } - } - } else { - /* Stretching in Y direction only */ - for (y = sy = 0; y < dstheight; y++, sy += yinc) { - sbuf = sbase + (sy >> 16) * slock.Pitch; - memcpy(dbuf, sbuf, width); - dbuf += dlock.Pitch; - } - } - } - else - { - /* Stretching in X direction */ - int last_sy = -1; - for (y = sy = 0; y < dstheight; y++, sy += yinc) - { - sbuf = sbase + (sy >> 16) * slock.Pitch; - - if ((sy >> 16) == (last_sy >> 16)) - { - /* this sourcerow is the same as last sourcerow - - * copy already stretched row - */ - memcpy(dbuf, dbuf - dlock.Pitch, width); - } - else - { -#define STRETCH_ROW(type) { \ - const type *s = (const type *)sbuf; \ - type *d = (type *)dbuf; \ - for (x = sx = 0; x < dstwidth; x++, sx += xinc) \ - d[x] = s[sx >> 16]; \ - break; } - - switch(bpp) - { - case 1: STRETCH_ROW(BYTE) - case 2: STRETCH_ROW(WORD) - case 4: STRETCH_ROW(DWORD) - case 3: - { - const BYTE *s; - BYTE *d = dbuf; - for (x = sx = 0; x < dstwidth; x++, sx+= xinc) - { - DWORD pixel; - - s = sbuf+3*(sx>>16); - pixel = s[0]|(s[1]<<8)|(s[2]<<16); - d[0] = (pixel )&0xff; - d[1] = (pixel>> 8)&0xff; - d[2] = (pixel>>16)&0xff; - d+=3; - } - break; - } - default: - FIXME("Stretched blit not implemented for bpp %d!\n", bpp*8); - ret = WINED3DERR_NOTAVAILABLE; - goto error; - } -#undef STRETCH_ROW - } - dbuf += dlock.Pitch; - last_sy = sy; - } - } - } - else - { - LONG dstyinc = dlock.Pitch, dstxinc = bpp; - DWORD keylow = 0xFFFFFFFF, keyhigh = 0, keymask = 0xFFFFFFFF; - DWORD destkeylow = 0x0, destkeyhigh = 0xFFFFFFFF, destkeymask = 0xFFFFFFFF; - if (Flags & (WINEDDBLT_KEYSRC | WINEDDBLT_KEYDEST | WINEDDBLT_KEYSRCOVERRIDE | WINEDDBLT_KEYDESTOVERRIDE)) - { - /* The color keying flags are checked for correctness in ddraw */ - if (Flags & WINEDDBLT_KEYSRC) - { - keylow = src->SrcBltCKey.dwColorSpaceLowValue; - keyhigh = src->SrcBltCKey.dwColorSpaceHighValue; - } - else if (Flags & WINEDDBLT_KEYSRCOVERRIDE) - { - keylow = DDBltFx->ddckSrcColorkey.dwColorSpaceLowValue; - keyhigh = DDBltFx->ddckSrcColorkey.dwColorSpaceHighValue; - } - - if (Flags & WINEDDBLT_KEYDEST) - { - /* Destination color keys are taken from the source surface ! */ - destkeylow = src->DestBltCKey.dwColorSpaceLowValue; - destkeyhigh = src->DestBltCKey.dwColorSpaceHighValue; - } - else if (Flags & WINEDDBLT_KEYDESTOVERRIDE) - { - destkeylow = DDBltFx->ddckDestColorkey.dwColorSpaceLowValue; - destkeyhigh = DDBltFx->ddckDestColorkey.dwColorSpaceHighValue; - } - - if(bpp == 1) - { - keymask = 0xff; - } - else - { - keymask = sEntry->red_mask - | sEntry->green_mask - | sEntry->blue_mask; - } - Flags &= ~(WINEDDBLT_KEYSRC | WINEDDBLT_KEYDEST | WINEDDBLT_KEYSRCOVERRIDE | WINEDDBLT_KEYDESTOVERRIDE); - } - - if (Flags & WINEDDBLT_DDFX) - { - LPBYTE dTopLeft, dTopRight, dBottomLeft, dBottomRight, tmp; - LONG tmpxy; - dTopLeft = dbuf; - dTopRight = dbuf+((dstwidth-1)*bpp); - dBottomLeft = dTopLeft+((dstheight-1)*dlock.Pitch); - dBottomRight = dBottomLeft+((dstwidth-1)*bpp); - - if (DDBltFx->dwDDFX & WINEDDBLTFX_ARITHSTRETCHY) - { - /* I don't think we need to do anything about this flag */ - WARN("Flags=DDBLT_DDFX nothing done for WINEDDBLTFX_ARITHSTRETCHY\n"); - } - if (DDBltFx->dwDDFX & WINEDDBLTFX_MIRRORLEFTRIGHT) - { - tmp = dTopRight; - dTopRight = dTopLeft; - dTopLeft = tmp; - tmp = dBottomRight; - dBottomRight = dBottomLeft; - dBottomLeft = tmp; - dstxinc = dstxinc *-1; - } - if (DDBltFx->dwDDFX & WINEDDBLTFX_MIRRORUPDOWN) - { - tmp = dTopLeft; - dTopLeft = dBottomLeft; - dBottomLeft = tmp; - tmp = dTopRight; - dTopRight = dBottomRight; - dBottomRight = tmp; - dstyinc = dstyinc *-1; - } - if (DDBltFx->dwDDFX & WINEDDBLTFX_NOTEARING) - { - /* I don't think we need to do anything about this flag */ - WARN("Flags=DDBLT_DDFX nothing done for WINEDDBLTFX_NOTEARING\n"); - } - if (DDBltFx->dwDDFX & WINEDDBLTFX_ROTATE180) - { - tmp = dBottomRight; - dBottomRight = dTopLeft; - dTopLeft = tmp; - tmp = dBottomLeft; - dBottomLeft = dTopRight; - dTopRight = tmp; - dstxinc = dstxinc * -1; - dstyinc = dstyinc * -1; - } - if (DDBltFx->dwDDFX & WINEDDBLTFX_ROTATE270) - { - tmp = dTopLeft; - dTopLeft = dBottomLeft; - dBottomLeft = dBottomRight; - dBottomRight = dTopRight; - dTopRight = tmp; - tmpxy = dstxinc; - dstxinc = dstyinc; - dstyinc = tmpxy; - dstxinc = dstxinc * -1; - } - if (DDBltFx->dwDDFX & WINEDDBLTFX_ROTATE90) - { - tmp = dTopLeft; - dTopLeft = dTopRight; - dTopRight = dBottomRight; - dBottomRight = dBottomLeft; - dBottomLeft = tmp; - tmpxy = dstxinc; - dstxinc = dstyinc; - dstyinc = tmpxy; - dstyinc = dstyinc * -1; - } - if (DDBltFx->dwDDFX & WINEDDBLTFX_ZBUFFERBASEDEST) - { - /* I don't think we need to do anything about this flag */ - WARN("Flags=WINEDDBLT_DDFX nothing done for WINEDDBLTFX_ZBUFFERBASEDEST\n"); - } - dbuf = dTopLeft; - Flags &= ~(WINEDDBLT_DDFX); - } - -#define COPY_COLORKEY_FX(type) { \ - const type *s; \ - type *d = (type *)dbuf, *dx, tmp; \ - for (y = sy = 0; y < dstheight; y++, sy += yinc) { \ - s = (const type*)(sbase + (sy >> 16) * slock.Pitch); \ - dx = d; \ - for (x = sx = 0; x < dstwidth; x++, sx += xinc) { \ - tmp = s[sx >> 16]; \ - if (((tmp & keymask) < keylow || (tmp & keymask) > keyhigh) && \ - ((dx[0] & destkeymask) >= destkeylow && (dx[0] & destkeymask) <= destkeyhigh)) { \ - dx[0] = tmp; \ - } \ - dx = (type*)(((LPBYTE)dx)+dstxinc); \ - } \ - d = (type*)(((LPBYTE)d)+dstyinc); \ - } \ - break; } - - switch (bpp) { - case 1: COPY_COLORKEY_FX(BYTE) - case 2: COPY_COLORKEY_FX(WORD) - case 4: COPY_COLORKEY_FX(DWORD) - case 3: - { - const BYTE *s; - BYTE *d = dbuf, *dx; - for (y = sy = 0; y < dstheight; y++, sy += yinc) - { - sbuf = sbase + (sy >> 16) * slock.Pitch; - dx = d; - for (x = sx = 0; x < dstwidth; x++, sx+= xinc) - { - DWORD pixel, dpixel = 0; - s = sbuf+3*(sx>>16); - pixel = s[0]|(s[1]<<8)|(s[2]<<16); - dpixel = dx[0]|(dx[1]<<8)|(dx[2]<<16); - if (((pixel & keymask) < keylow || (pixel & keymask) > keyhigh) && - ((dpixel & keymask) >= destkeylow || (dpixel & keymask) <= keyhigh)) - { - dx[0] = (pixel )&0xff; - dx[1] = (pixel>> 8)&0xff; - dx[2] = (pixel>>16)&0xff; - } - dx+= dstxinc; - } - d += dstyinc; - } - break; - } - default: - FIXME("%s color-keyed blit not implemented for bpp %d!\n", - (Flags & WINEDDBLT_KEYSRC) ? "Source" : "Destination", bpp*8); - ret = WINED3DERR_NOTAVAILABLE; - goto error; -#undef COPY_COLORKEY_FX - } - } - } - -error: - if (Flags && FIXME_ON(d3d_surface)) - { - FIXME("\tUnsupported flags: %08x\n", Flags); - } - -release: - IWineD3DSurface_UnlockRect(iface); - if (src && src != This) IWineD3DSurface_UnlockRect((IWineD3DSurface *)src); - /* Release the converted surface if any */ - if (src && src_surface != (IWineD3DSurface *)src) IWineD3DSurface_Release((IWineD3DSurface *)src); - return ret; -} - -/***************************************************************************** - * IWineD3DSurface::BltFast, SW emulation version - * - * This is the software implementation of BltFast, as used by GDI surfaces - * and as a fallback for OpenGL surfaces. This code is taken from the old - * DirectDraw code, and was originally written by TransGaming. - * - * Params: - * dstx: - * dsty: - * src_surface: Source surface to copy from - * rsrc: Source rectangle - * trans: Some Flags - * - * Returns: - * WINED3D_OK on success - * - *****************************************************************************/ -HRESULT WINAPI IWineD3DBaseSurfaceImpl_BltFast(IWineD3DSurface *iface, DWORD dstx, DWORD dsty, - IWineD3DSurface *src_surface, const RECT *rsrc, DWORD trans) -{ - IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface; - IWineD3DSurfaceImpl *src = (IWineD3DSurfaceImpl *)src_surface; - - int bpp, w, h, x, y; - WINED3DLOCKED_RECT dlock,slock; - HRESULT ret = WINED3D_OK; - RECT rsrc2; - RECT lock_src, lock_dst, lock_union; - const BYTE *sbuf; - BYTE *dbuf; - const struct wined3d_format *sEntry, *dEntry; - - TRACE("iface %p, dst_x %u, dst_y %u, src_surface %p, src_rect %s, flags %#x.\n", - iface, dstx, dsty, src_surface, wine_dbgstr_rect(rsrc), trans); - - if ((This->Flags & SFLAG_LOCKED) || (src->Flags & SFLAG_LOCKED)) - { - WARN(" Surface is busy, returning DDERR_SURFACEBUSY\n"); - return WINEDDERR_SURFACEBUSY; - } - - if (!rsrc) - { - WARN("rsrc is NULL!\n"); - rsrc2.left = 0; - rsrc2.top = 0; - rsrc2.right = src->currentDesc.Width; - rsrc2.bottom = src->currentDesc.Height; - rsrc = &rsrc2; - } - - /* Check source rect for validity. Copied from normal Blt. Fixes Baldur's Gate.*/ - if ((rsrc->bottom > src->currentDesc.Height) || (rsrc->bottom < 0) - || (rsrc->top > src->currentDesc.Height) || (rsrc->top < 0) - || (rsrc->left > src->currentDesc.Width) || (rsrc->left < 0) - || (rsrc->right > src->currentDesc.Width) || (rsrc->right < 0) - || (rsrc->right < rsrc->left) || (rsrc->bottom < rsrc->top)) - { - WARN("Application gave us bad source rectangle for BltFast.\n"); - return WINEDDERR_INVALIDRECT; - } - - h = rsrc->bottom - rsrc->top; - if (h > This->currentDesc.Height-dsty) h = This->currentDesc.Height-dsty; - if (h > src->currentDesc.Height-rsrc->top) h = src->currentDesc.Height-rsrc->top; - if (h <= 0) return WINEDDERR_INVALIDRECT; - - w = rsrc->right - rsrc->left; - if (w > This->currentDesc.Width-dstx) w = This->currentDesc.Width-dstx; - if (w > src->currentDesc.Width-rsrc->left) w = src->currentDesc.Width-rsrc->left; - if (w <= 0) return WINEDDERR_INVALIDRECT; - - /* Now compute the locking rectangle... */ - lock_src.left = rsrc->left; - lock_src.top = rsrc->top; - lock_src.right = lock_src.left + w; - lock_src.bottom = lock_src.top + h; - - lock_dst.left = dstx; - lock_dst.top = dsty; - lock_dst.right = dstx + w; - lock_dst.bottom = dsty + h; - - bpp = This->resource.format->byte_count; - - /* We need to lock the surfaces, or we won't get refreshes when done. */ - if (src == This) - { - int pitch; - - UnionRect(&lock_union, &lock_src, &lock_dst); - - /* Lock the union of the two rectangles */ - ret = IWineD3DSurface_LockRect(iface, &dlock, &lock_union, 0); - if(ret != WINED3D_OK) goto error; - - pitch = dlock.Pitch; - slock.Pitch = dlock.Pitch; - - /* Since slock was originally copied from this surface's description, we can just reuse it */ - sbuf = This->resource.allocatedMemory + lock_src.top * pitch + lock_src.left * bpp; - dbuf = This->resource.allocatedMemory + lock_dst.top * pitch + lock_dst.left * bpp; - sEntry = src->resource.format; - dEntry = sEntry; - } - else - { - ret = IWineD3DSurface_LockRect(src_surface, &slock, &lock_src, WINED3DLOCK_READONLY); - if(ret != WINED3D_OK) goto error; - ret = IWineD3DSurface_LockRect(iface, &dlock, &lock_dst, 0); - if(ret != WINED3D_OK) goto error; - - sbuf = slock.pBits; - dbuf = dlock.pBits; - TRACE("Dst is at %p, Src is at %p\n", dbuf, sbuf); - - sEntry = src->resource.format; - dEntry = This->resource.format; - } - - /* Handle compressed surfaces first... */ - if (sEntry->Flags & dEntry->Flags & WINED3DFMT_FLAG_COMPRESSED) - { - UINT row_block_count; - - TRACE("compressed -> compressed copy\n"); - if (trans) - FIXME("trans arg not supported when a compressed surface is involved\n"); - if (dstx || dsty) - FIXME("offset for destination surface is not supported\n"); - if (src->resource.format->id != This->resource.format->id) - { - FIXME("compressed -> compressed copy only supported for the same type of surface\n"); - ret = WINED3DERR_WRONGTEXTUREFORMAT; - goto error; - } - - row_block_count = (w + dEntry->block_width - 1) / dEntry->block_width; - for (y = 0; y < h; y += dEntry->block_height) - { - memcpy(dbuf, sbuf, row_block_count * dEntry->block_byte_count); - dbuf += dlock.Pitch; - sbuf += slock.Pitch; - } - - goto error; - } - if ((sEntry->Flags & WINED3DFMT_FLAG_COMPRESSED) && !(dEntry->Flags & WINED3DFMT_FLAG_COMPRESSED)) - { - /* TODO: Use the libtxc_dxtn.so shared library to do - * software decompression - */ - ERR("Software decompression not supported.\n"); - goto error; - } - - if (trans & (WINEDDBLTFAST_SRCCOLORKEY | WINEDDBLTFAST_DESTCOLORKEY)) - { - DWORD keylow, keyhigh; - DWORD mask = src->resource.format->red_mask - | src->resource.format->green_mask - | src->resource.format->blue_mask; - - /* For some 8-bit formats like L8 and P8 color masks don't make sense */ - if(!mask && bpp==1) - mask = 0xff; - - TRACE("Color keyed copy\n"); - if (trans & WINEDDBLTFAST_SRCCOLORKEY) - { - keylow = src->SrcBltCKey.dwColorSpaceLowValue; - keyhigh = src->SrcBltCKey.dwColorSpaceHighValue; - } - else - { - /* I'm not sure if this is correct */ - FIXME("WINEDDBLTFAST_DESTCOLORKEY not fully supported yet.\n"); - keylow = This->DestBltCKey.dwColorSpaceLowValue; - keyhigh = This->DestBltCKey.dwColorSpaceHighValue; - } - -#define COPYBOX_COLORKEY(type) { \ - const type *s = (const type *)sbuf; \ - type *d = (type *)dbuf; \ - type tmp; \ - for (y = 0; y < h; y++) { \ - for (x = 0; x < w; x++) { \ - tmp = s[x]; \ - if ((tmp & mask) < keylow || (tmp & mask) > keyhigh) d[x] = tmp; \ - } \ - s = (const type *)((const BYTE *)s + slock.Pitch); \ - d = (type *)((BYTE *)d + dlock.Pitch); \ - } \ - break; \ - } - - switch (bpp) { - case 1: COPYBOX_COLORKEY(BYTE) - case 2: COPYBOX_COLORKEY(WORD) - case 4: COPYBOX_COLORKEY(DWORD) - case 3: - { - const BYTE *s; - BYTE *d; - DWORD tmp; - s = sbuf; - d = dbuf; - for (y = 0; y < h; y++) - { - for (x = 0; x < w * 3; x += 3) - { - tmp = (DWORD)s[x] + ((DWORD)s[x + 1] << 8) + ((DWORD)s[x + 2] << 16); - if (tmp < keylow || tmp > keyhigh) - { - d[x + 0] = s[x + 0]; - d[x + 1] = s[x + 1]; - d[x + 2] = s[x + 2]; - } - } - s += slock.Pitch; - d += dlock.Pitch; - } - break; - } - default: - FIXME("Source color key blitting not supported for bpp %d\n",bpp*8); - ret = WINED3DERR_NOTAVAILABLE; - goto error; - } -#undef COPYBOX_COLORKEY - TRACE("Copy Done\n"); - } - else - { - int width = w * bpp; - INT sbufpitch, dbufpitch; - - TRACE("NO color key copy\n"); - /* Handle overlapping surfaces */ - if (sbuf < dbuf) - { - sbuf += (h - 1) * slock.Pitch; - dbuf += (h - 1) * dlock.Pitch; - sbufpitch = -slock.Pitch; - dbufpitch = -dlock.Pitch; - } - else - { - sbufpitch = slock.Pitch; - dbufpitch = dlock.Pitch; - } - for (y = 0; y < h; y++) - { - /* This is pretty easy, a line for line memcpy */ - memmove(dbuf, sbuf, width); - sbuf += sbufpitch; - dbuf += dbufpitch; - } - TRACE("Copy done\n"); - } - -error: - if (src == This) - { - IWineD3DSurface_UnlockRect(iface); - } - else - { - IWineD3DSurface_UnlockRect(iface); - IWineD3DSurface_UnlockRect(src_surface); - } - - return ret; -} - -HRESULT WINAPI IWineD3DBaseSurfaceImpl_LockRect(IWineD3DSurface *iface, WINED3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags) -{ - IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface; - - TRACE("(%p) : rect@%p flags(%08x), output lockedRect@%p, memory@%p\n", - This, pRect, Flags, pLockedRect, This->resource.allocatedMemory); - - pLockedRect->Pitch = IWineD3DSurface_GetPitch(iface); - - if (!pRect) - { - pLockedRect->pBits = This->resource.allocatedMemory; - This->lockedRect.left = 0; - This->lockedRect.top = 0; - This->lockedRect.right = This->currentDesc.Width; - This->lockedRect.bottom = This->currentDesc.Height; - - TRACE("Locked Rect (%p) = l %d, t %d, r %d, b %d\n", - &This->lockedRect, This->lockedRect.left, This->lockedRect.top, - This->lockedRect.right, This->lockedRect.bottom); - } - else - { - const struct wined3d_format *format = This->resource.format; - - TRACE("Lock Rect (%p) = l %d, t %d, r %d, b %d\n", - pRect, pRect->left, pRect->top, pRect->right, pRect->bottom); - - if ((format->Flags & (WINED3DFMT_FLAG_COMPRESSED | WINED3DFMT_FLAG_BROKEN_PITCH)) == WINED3DFMT_FLAG_COMPRESSED) - { - /* Compressed textures are block based, so calculate the offset of - * the block that contains the top-left pixel of the locked rectangle. */ - pLockedRect->pBits = This->resource.allocatedMemory - + ((pRect->top / format->block_height) * pLockedRect->Pitch) - + ((pRect->left / format->block_width) * format->block_byte_count); - } - else - { - pLockedRect->pBits = This->resource.allocatedMemory + - (pLockedRect->Pitch * pRect->top) + - (pRect->left * format->byte_count); - } - This->lockedRect.left = pRect->left; - This->lockedRect.top = pRect->top; - This->lockedRect.right = pRect->right; - This->lockedRect.bottom = pRect->bottom; - } - - /* No dirtifying is needed for this surface implementation */ - TRACE("returning memory@%p, pitch(%d)\n", pLockedRect->pBits, pLockedRect->Pitch); - - return WINED3D_OK; -} - -/* TODO: think about moving this down to resource? */ -const void *WINAPI IWineD3DBaseSurfaceImpl_GetData(IWineD3DSurface *iface) -{ - IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface; - - /* This should only be called for sysmem textures, it may be a good idea - * to extend this to all pools at some point in the future */ - if (This->resource.pool != WINED3DPOOL_SYSTEMMEM) - { - FIXME("(%p) Attempting to get system memory for a non-system memory texture\n", iface); - } - return This->resource.allocatedMemory; -} diff --git a/dll/directx/wine/wined3d/surface_gdi.c b/dll/directx/wine/wined3d/surface_gdi.c deleted file mode 100644 index a640b794ee5..00000000000 --- a/dll/directx/wine/wined3d/surface_gdi.c +++ /dev/null @@ -1,538 +0,0 @@ -/* - * 2D Surface implementation without OpenGL - * - * Copyright 1997-2000 Marcus Meissner - * Copyright 1998-2000 Lionel Ulmer - * Copyright 2000-2001 TransGaming Technologies Inc. - * Copyright 2002-2005 Jason Edmeades - * Copyright 2002-2003 Raphael Junqueira - * Copyright 2004 Christian Costa - * Copyright 2005 Oliver Stieber - * Copyright 2006-2008 Stefan Dösinger - * - * 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 "config.h" -#include "wine/port.h" -#include "wined3d_private.h" - -#include - -/* Use the d3d_surface debug channel to have one channel for all surfaces */ -WINE_DEFAULT_DEBUG_CHANNEL(d3d_surface); - -void surface_gdi_cleanup(IWineD3DSurfaceImpl *This) -{ - TRACE("(%p) : Cleaning up.\n", This); - - if (This->Flags & SFLAG_DIBSECTION) - { - /* Release the DC. */ - SelectObject(This->hDC, This->dib.holdbitmap); - DeleteDC(This->hDC); - /* Release the DIB section. */ - DeleteObject(This->dib.DIBsection); - This->dib.bitmap_data = NULL; - This->resource.allocatedMemory = NULL; - } - - if (This->Flags & SFLAG_USERPTR) IWineD3DSurface_SetMem((IWineD3DSurface *)This, NULL); - if (This->overlay_dest) list_remove(&This->overlay_entry); - - HeapFree(GetProcessHeap(), 0, This->palette9); - - resource_cleanup((IWineD3DResource *)This); -} - -/***************************************************************************** - * IWineD3DSurface::Release, GDI version - * - * In general a normal COM Release method, but the GDI version doesn't have - * to destroy all the GL things. - * - *****************************************************************************/ -static ULONG WINAPI IWineGDISurfaceImpl_Release(IWineD3DSurface *iface) { - IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface; - ULONG ref = InterlockedDecrement(&This->resource.ref); - TRACE("(%p) : Releasing from %d\n", This, ref + 1); - - if (!ref) - { - surface_gdi_cleanup(This); - - TRACE("(%p) Released.\n", This); - HeapFree(GetProcessHeap(), 0, This); - } - - return ref; -} - -/***************************************************************************** - * IWineD3DSurface::PreLoad, GDI version - * - * This call is unsupported on GDI surfaces, if it's called something went - * wrong in the parent library. Write an informative warning - * - *****************************************************************************/ -static void WINAPI -IWineGDISurfaceImpl_PreLoad(IWineD3DSurface *iface) -{ - ERR("(%p): PreLoad is not supported on X11 surfaces!\n", iface); - ERR("(%p): Most likely the parent library did something wrong.\n", iface); - ERR("(%p): Please report to wine-devel\n", iface); -} - -/***************************************************************************** - * IWineD3DSurface::UnLoad, GDI version - * - * This call is unsupported on GDI surfaces, if it's called something went - * wrong in the parent library. Write an informative warning. - * - *****************************************************************************/ -static void WINAPI IWineGDISurfaceImpl_UnLoad(IWineD3DSurface *iface) -{ - ERR("(%p): UnLoad is not supported on X11 surfaces!\n", iface); - ERR("(%p): Most likely the parent library did something wrong.\n", iface); - ERR("(%p): Please report to wine-devel\n", iface); -} - -/***************************************************************************** - * IWineD3DSurface::LockRect, GDI version - * - * Locks the surface and returns a pointer to the surface memory - * - * Params: - * pLockedRect: Address to return the locking info at - * pRect: Rectangle to lock - * Flags: Some flags - * - * Returns: - * WINED3D_OK on success - * WINED3DERR_INVALIDCALL on errors - * - *****************************************************************************/ -static HRESULT WINAPI -IWineGDISurfaceImpl_LockRect(IWineD3DSurface *iface, - WINED3DLOCKED_RECT* pLockedRect, - CONST RECT* pRect, - DWORD Flags) -{ - IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface; - - /* Already locked? */ - if(This->Flags & SFLAG_LOCKED) - { - WARN("(%p) Surface already locked\n", This); - /* What should I return here? */ - return WINED3DERR_INVALIDCALL; - } - This->Flags |= SFLAG_LOCKED; - - if(!This->resource.allocatedMemory) { - /* This happens on gdi surfaces if the application set a user pointer and resets it. - * Recreate the DIB section - */ - IWineD3DBaseSurfaceImpl_CreateDIBSection(iface); - This->resource.allocatedMemory = This->dib.bitmap_data; - } - - return IWineD3DBaseSurfaceImpl_LockRect(iface, pLockedRect, pRect, Flags); -} - -/***************************************************************************** - * IWineD3DSurface::UnlockRect, GDI version - * - * Unlocks a surface. This implementation doesn't do much, except updating - * the window if the front buffer is unlocked - * - * Returns: - * WINED3D_OK on success - * WINED3DERR_INVALIDCALL on failure - * - *****************************************************************************/ -static HRESULT WINAPI -IWineGDISurfaceImpl_UnlockRect(IWineD3DSurface *iface) -{ - IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface; - TRACE("(%p)\n", This); - - if (!(This->Flags & SFLAG_LOCKED)) - { - WARN("trying to Unlock an unlocked surf@%p\n", This); - return WINEDDERR_NOTLOCKED; - } - - /* Tell the swapchain to update the screen */ - if (This->container.type == WINED3D_CONTAINER_SWAPCHAIN) - { - IWineD3DSwapChainImpl *swapchain = This->container.u.swapchain; - if (This == swapchain->front_buffer) - { - x11_copy_to_screen(swapchain, &This->lockedRect); - } - } - - This->Flags &= ~SFLAG_LOCKED; - memset(&This->lockedRect, 0, sizeof(RECT)); - return WINED3D_OK; -} - -/***************************************************************************** - * IWineD3DSurface::Flip, GDI version - * - * Flips 2 flipping enabled surfaces. Determining the 2 targets is done by - * the parent library. This implementation changes the data pointers of the - * surfaces and copies the new front buffer content to the screen - * - * Params: - * override: Flipping target(e.g. back buffer) - * - * Returns: - * WINED3D_OK on success - * - *****************************************************************************/ -static HRESULT WINAPI -IWineGDISurfaceImpl_Flip(IWineD3DSurface *iface, - IWineD3DSurface *override, - DWORD Flags) -{ - IWineD3DSurfaceImpl *surface = (IWineD3DSurfaceImpl *)iface; - IWineD3DSwapChainImpl *swapchain; - HRESULT hr; - - if (surface->container.type != WINED3D_CONTAINER_SWAPCHAIN) - { - ERR("Flipped surface is not on a swapchain\n"); - return WINEDDERR_NOTFLIPPABLE; - } - - swapchain = surface->container.u.swapchain; - hr = IWineD3DSwapChain_Present((IWineD3DSwapChain *)swapchain, - NULL, NULL, swapchain->win_handle, NULL, 0); - - return hr; -} - -/***************************************************************************** - * IWineD3DSurface::LoadTexture, GDI version - * - * This is mutually unsupported by GDI surfaces - * - * Returns: - * D3DERR_INVALIDCALL - * - *****************************************************************************/ -static HRESULT WINAPI -IWineGDISurfaceImpl_LoadTexture(IWineD3DSurface *iface, BOOL srgb_mode) -{ - ERR("Unsupported on X11 surfaces\n"); - return WINED3DERR_INVALIDCALL; -} - -static void WINAPI IWineGDISurfaceImpl_BindTexture(IWineD3DSurface *iface, BOOL srgb) -{ - ERR("Not supported.\n"); -} - -static HRESULT WINAPI IWineGDISurfaceImpl_GetDC(IWineD3DSurface *iface, HDC *pHDC) { - IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface; - WINED3DLOCKED_RECT lock; - HRESULT hr; - RGBQUAD col[256]; - - TRACE("(%p)->(%p)\n",This,pHDC); - - if(!(This->Flags & SFLAG_DIBSECTION)) - { - WARN("DC not supported on this surface\n"); - return WINED3DERR_INVALIDCALL; - } - - if(This->Flags & SFLAG_USERPTR) { - ERR("Not supported on surfaces with an application-provided surfaces\n"); - return WINEDDERR_NODC; - } - - /* Give more detailed info for ddraw */ - if (This->Flags & SFLAG_DCINUSE) - return WINEDDERR_DCALREADYCREATED; - - /* Can't GetDC if the surface is locked */ - if (This->Flags & SFLAG_LOCKED) - return WINED3DERR_INVALIDCALL; - - memset(&lock, 0, sizeof(lock)); /* To be sure */ - - /* Should have a DIB section already */ - - /* Lock the surface */ - hr = IWineD3DSurface_LockRect(iface, - &lock, - NULL, - 0); - if(FAILED(hr)) { - ERR("IWineD3DSurface_LockRect failed with hr = %08x\n", hr); - /* keep the dib section */ - return hr; - } - - if (This->resource.format->id == WINED3DFMT_P8_UINT - || This->resource.format->id == WINED3DFMT_P8_UINT_A8_UNORM) - { - unsigned int n; - const PALETTEENTRY *pal = NULL; - - if(This->palette) { - pal = This->palette->palents; - } else { - IWineD3DSurfaceImpl *dds_primary; - IWineD3DSwapChainImpl *swapchain; - swapchain = (IWineD3DSwapChainImpl *)This->resource.device->swapchains[0]; - dds_primary = swapchain->front_buffer; - if (dds_primary && dds_primary->palette) - pal = dds_primary->palette->palents; - } - - if (pal) { - for (n=0; n<256; n++) { - col[n].rgbRed = pal[n].peRed; - col[n].rgbGreen = pal[n].peGreen; - col[n].rgbBlue = pal[n].peBlue; - col[n].rgbReserved = 0; - } - SetDIBColorTable(This->hDC, 0, 256, col); - } - } - - *pHDC = This->hDC; - TRACE("returning %p\n",*pHDC); - This->Flags |= SFLAG_DCINUSE; - - return WINED3D_OK; -} - -static HRESULT WINAPI IWineGDISurfaceImpl_ReleaseDC(IWineD3DSurface *iface, HDC hDC) { - IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface; - - TRACE("(%p)->(%p)\n",This,hDC); - - if (!(This->Flags & SFLAG_DCINUSE)) - return WINEDDERR_NODC; - - if (This->hDC !=hDC) { - WARN("Application tries to release an invalid DC(%p), surface dc is %p\n", hDC, This->hDC); - return WINEDDERR_NODC; - } - - /* we locked first, so unlock now */ - IWineD3DSurface_UnlockRect(iface); - - This->Flags &= ~SFLAG_DCINUSE; - - return WINED3D_OK; -} - -static HRESULT WINAPI IWineGDISurfaceImpl_RealizePalette(IWineD3DSurface *iface) { - IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface; - RGBQUAD col[256]; - IWineD3DPaletteImpl *pal = This->palette; - unsigned int n; - TRACE("(%p)\n", This); - - if (!pal) return WINED3D_OK; - - if(This->Flags & SFLAG_DIBSECTION) { - TRACE("(%p): Updating the hdc's palette\n", This); - for (n=0; n<256; n++) { - col[n].rgbRed = pal->palents[n].peRed; - col[n].rgbGreen = pal->palents[n].peGreen; - col[n].rgbBlue = pal->palents[n].peBlue; - col[n].rgbReserved = 0; - } - SetDIBColorTable(This->hDC, 0, 256, col); - } - - /* Update the image because of the palette change. Some games like e.g Red Alert - call SetEntries a lot to implement fading. */ - /* Tell the swapchain to update the screen */ - if (This->container.type == WINED3D_CONTAINER_SWAPCHAIN) - { - IWineD3DSwapChainImpl *swapchain = This->container.u.swapchain; - if (This == swapchain->front_buffer) - { - x11_copy_to_screen(swapchain, NULL); - } - } - - return WINED3D_OK; -} - -/***************************************************************************** - * IWineD3DSurface::PrivateSetup, GDI version - * - * Initializes the GDI surface, aka creates the DIB section we render to - * The DIB section creation is done by calling GetDC, which will create the - * section and releasing the dc to allow the app to use it. The dib section - * will stay until the surface is released - * - * GDI surfaces do not need to be a power of 2 in size, so the pow2 sizes - * are set to the real sizes to save memory. The NONPOW2 flag is unset to - * avoid confusion in the shared surface code. - * - * Returns: - * WINED3D_OK on success - * The return values of called methods on failure - * - *****************************************************************************/ -static HRESULT WINAPI -IWineGDISurfaceImpl_PrivateSetup(IWineD3DSurface *iface) -{ - IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface; - HRESULT hr; - - if(This->resource.usage & WINED3DUSAGE_OVERLAY) - { - ERR("(%p) Overlays not yet supported by GDI surfaces\n", This); - return WINED3DERR_INVALIDCALL; - } - - /* Sysmem textures have memory already allocated - - * release it, this avoids an unnecessary memcpy - */ - hr = IWineD3DBaseSurfaceImpl_CreateDIBSection(iface); - if(SUCCEEDED(hr)) - { - HeapFree(GetProcessHeap(), 0, This->resource.heapMemory); - This->resource.heapMemory = NULL; - This->resource.allocatedMemory = This->dib.bitmap_data; - } - - /* We don't mind the nonpow2 stuff in GDI */ - This->pow2Width = This->currentDesc.Width; - This->pow2Height = This->currentDesc.Height; - - return WINED3D_OK; -} - -static HRESULT WINAPI IWineGDISurfaceImpl_SetMem(IWineD3DSurface *iface, void *Mem) { - IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface; - - /* Render targets depend on their hdc, and we can't create an hdc on a user pointer */ - if(This->resource.usage & WINED3DUSAGE_RENDERTARGET) { - ERR("Not supported on render targets\n"); - return WINED3DERR_INVALIDCALL; - } - - if(This->Flags & (SFLAG_LOCKED | SFLAG_DCINUSE)) { - WARN("Surface is locked or the HDC is in use\n"); - return WINED3DERR_INVALIDCALL; - } - - if(Mem && Mem != This->resource.allocatedMemory) { - void *release = NULL; - - /* Do I have to copy the old surface content? */ - if(This->Flags & SFLAG_DIBSECTION) { - /* Release the DC. No need to hold the critical section for the update - * Thread because this thread runs only on front buffers, but this method - * fails for render targets in the check above. - */ - SelectObject(This->hDC, This->dib.holdbitmap); - DeleteDC(This->hDC); - /* Release the DIB section */ - DeleteObject(This->dib.DIBsection); - This->dib.bitmap_data = NULL; - This->resource.allocatedMemory = NULL; - This->hDC = NULL; - This->Flags &= ~SFLAG_DIBSECTION; - } else if(!(This->Flags & SFLAG_USERPTR)) { - release = This->resource.allocatedMemory; - } - This->resource.allocatedMemory = Mem; - This->Flags |= SFLAG_USERPTR | SFLAG_INSYSMEM; - - /* Now free the old memory if any */ - HeapFree(GetProcessHeap(), 0, release); - } else if(This->Flags & SFLAG_USERPTR) { - /* LockRect and GetDC will re-create the dib section and allocated memory */ - This->resource.allocatedMemory = NULL; - This->Flags &= ~SFLAG_USERPTR; - } - return WINED3D_OK; -} - -static WINED3DSURFTYPE WINAPI IWineGDISurfaceImpl_GetImplType(IWineD3DSurface *iface) { - return SURFACE_GDI; -} - -static HRESULT WINAPI IWineGDISurfaceImpl_DrawOverlay(IWineD3DSurface *iface) { - FIXME("GDI surfaces can't draw overlays yet\n"); - return E_FAIL; -} - -/* FIXME: This vtable should not use any IWineD3DSurface* implementation functions, - * only IWineD3DBaseSurface and IWineGDISurface ones. - */ -const IWineD3DSurfaceVtbl IWineGDISurface_Vtbl = -{ - /* IUnknown */ - IWineD3DBaseSurfaceImpl_QueryInterface, - IWineD3DBaseSurfaceImpl_AddRef, - IWineGDISurfaceImpl_Release, - /* IWineD3DResource */ - IWineD3DBaseSurfaceImpl_GetParent, - IWineD3DBaseSurfaceImpl_SetPrivateData, - IWineD3DBaseSurfaceImpl_GetPrivateData, - IWineD3DBaseSurfaceImpl_FreePrivateData, - IWineD3DBaseSurfaceImpl_SetPriority, - IWineD3DBaseSurfaceImpl_GetPriority, - IWineGDISurfaceImpl_PreLoad, - IWineGDISurfaceImpl_UnLoad, - IWineD3DBaseSurfaceImpl_GetType, - /* IWineD3DSurface */ - IWineD3DBaseSurfaceImpl_GetDesc, - IWineGDISurfaceImpl_LockRect, - IWineGDISurfaceImpl_UnlockRect, - IWineGDISurfaceImpl_GetDC, - IWineGDISurfaceImpl_ReleaseDC, - IWineGDISurfaceImpl_Flip, - IWineD3DBaseSurfaceImpl_Blt, - IWineD3DBaseSurfaceImpl_GetBltStatus, - IWineD3DBaseSurfaceImpl_GetFlipStatus, - IWineD3DBaseSurfaceImpl_IsLost, - IWineD3DBaseSurfaceImpl_Restore, - IWineD3DBaseSurfaceImpl_BltFast, - IWineD3DBaseSurfaceImpl_GetPalette, - IWineD3DBaseSurfaceImpl_SetPalette, - IWineGDISurfaceImpl_RealizePalette, - IWineD3DBaseSurfaceImpl_SetColorKey, - IWineD3DBaseSurfaceImpl_GetPitch, - IWineGDISurfaceImpl_SetMem, - IWineD3DBaseSurfaceImpl_SetOverlayPosition, - IWineD3DBaseSurfaceImpl_GetOverlayPosition, - IWineD3DBaseSurfaceImpl_UpdateOverlayZOrder, - IWineD3DBaseSurfaceImpl_UpdateOverlay, - IWineD3DBaseSurfaceImpl_SetClipper, - IWineD3DBaseSurfaceImpl_GetClipper, - /* Internal use: */ - IWineGDISurfaceImpl_LoadTexture, - IWineGDISurfaceImpl_BindTexture, - IWineD3DBaseSurfaceImpl_GetData, - IWineD3DBaseSurfaceImpl_SetFormat, - IWineGDISurfaceImpl_PrivateSetup, - IWineGDISurfaceImpl_GetImplType, - IWineGDISurfaceImpl_DrawOverlay -}; diff --git a/dll/directx/wine/wined3d/swapchain.c b/dll/directx/wine/wined3d/swapchain.c index 35558adadaa..0b32eca0a91 100644 --- a/dll/directx/wine/wined3d/swapchain.c +++ b/dll/directx/wine/wined3d/swapchain.c @@ -1,105 +1,287 @@ /* - *IDirect3DSwapChain9 implementation + * Copyright 2002-2003 Jason Edmeades + * Copyright 2002-2003 Raphael Junqueira + * Copyright 2005 Oliver Stieber + * Copyright 2007-2008 Stefan Dösinger for CodeWeavers + * Copyright 2011 Henri Verbeet for CodeWeavers * - *Copyright 2002-2003 Jason Edmeades - *Copyright 2002-2003 Raphael Junqueira - *Copyright 2005 Oliver Stieber - *Copyright 2007-2008 Stefan Dösinger for CodeWeavers + * 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 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. * - *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 + * 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 "config.h" #include "wined3d_private.h" - -/*TODO: some of the additional parameters may be required to - set the gamma ramp (for some weird reason microsoft have left swap gammaramp in device - but it operates on a swapchain, it may be a good idea to move it to IWineD3DSwapChain for IWineD3D)*/ - - WINE_DEFAULT_DEBUG_CHANNEL(d3d); WINE_DECLARE_DEBUG_CHANNEL(fps); /* Do not call while under the GL lock. */ -static void WINAPI IWineD3DSwapChainImpl_Destroy(IWineD3DSwapChain *iface) +static void swapchain_cleanup(struct wined3d_swapchain *swapchain) { - IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface; WINED3DDISPLAYMODE mode; - unsigned int i; + UINT i; - TRACE("Destroying swapchain %p\n", iface); + TRACE("Destroying swapchain %p.\n", swapchain); - IWineD3DSwapChain_SetGammaRamp(iface, 0, &This->orig_gamma); + wined3d_swapchain_set_gamma_ramp(swapchain, 0, &swapchain->orig_gamma); - /* Release the swapchain's draw buffers. Make sure This->back_buffers[0] is - * the last buffer to be destroyed, FindContext() depends on that. */ - if (This->front_buffer) + /* Release the swapchain's draw buffers. Make sure swapchain->back_buffers[0] + * is the last buffer to be destroyed, FindContext() depends on that. */ + if (swapchain->front_buffer) { - surface_set_container(This->front_buffer, WINED3D_CONTAINER_NONE, NULL); - if (IWineD3DSurface_Release((IWineD3DSurface *)This->front_buffer)) - { - WARN("(%p) Something's still holding the front buffer (%p).\n", - This, This->front_buffer); - } - This->front_buffer = NULL; + surface_set_container(swapchain->front_buffer, WINED3D_CONTAINER_NONE, NULL); + if (wined3d_surface_decref(swapchain->front_buffer)) + WARN("Something's still holding the front buffer (%p).\n", swapchain->front_buffer); + swapchain->front_buffer = NULL; } - if (This->back_buffers) + if (swapchain->back_buffers) { - UINT i = This->presentParms.BackBufferCount; + i = swapchain->presentParms.BackBufferCount; while (i--) { - surface_set_container(This->back_buffers[i], WINED3D_CONTAINER_NONE, NULL); - if (IWineD3DSurface_Release((IWineD3DSurface *)This->back_buffers[i])) - WARN("(%p) Something's still holding back buffer %u (%p).\n", - This, i, This->back_buffers[i]); + surface_set_container(swapchain->back_buffers[i], WINED3D_CONTAINER_NONE, NULL); + if (wined3d_surface_decref(swapchain->back_buffers[i])) + WARN("Something's still holding back buffer %u (%p).\n", i, swapchain->back_buffers[i]); } - HeapFree(GetProcessHeap(), 0, This->back_buffers); - This->back_buffers = NULL; + HeapFree(GetProcessHeap(), 0, swapchain->back_buffers); + swapchain->back_buffers = NULL; } - for (i = 0; i < This->num_contexts; ++i) + for (i = 0; i < swapchain->num_contexts; ++i) { - context_destroy(This->device, This->context[i]); + context_destroy(swapchain->device, swapchain->context[i]); } - /* Restore the screen resolution if we rendered in fullscreen - * This will restore the screen resolution to what it was before creating the swapchain. In case of d3d8 and d3d9 - * this will be the original desktop resolution. In case of d3d7 this will be a NOP because ddraw sets the resolution - * before starting up Direct3D, thus orig_width and orig_height will be equal to the modes in the presentation params - */ - if (!This->presentParms.Windowed && This->presentParms.AutoRestoreDisplayMode) + HeapFree(GetProcessHeap(), 0, swapchain->context); + + /* Restore the screen resolution if we rendered in fullscreen. + * This will restore the screen resolution to what it was before creating + * the swapchain. In case of d3d8 and d3d9 this will be the original + * desktop resolution. In case of d3d7 this will be a NOP because ddraw + * sets the resolution before starting up Direct3D, thus orig_width and + * orig_height will be equal to the modes in the presentation params. */ + if (!swapchain->presentParms.Windowed && swapchain->presentParms.AutoRestoreDisplayMode) { - mode.Width = This->orig_width; - mode.Height = This->orig_height; + mode.Width = swapchain->orig_width; + mode.Height = swapchain->orig_height; mode.RefreshRate = 0; - mode.Format = This->orig_fmt; - IWineD3DDevice_SetDisplayMode((IWineD3DDevice *)This->device, 0, &mode); + mode.Format = swapchain->orig_fmt; + wined3d_device_set_display_mode(swapchain->device, 0, &mode); } - HeapFree(GetProcessHeap(), 0, This->context); - HeapFree(GetProcessHeap(), 0, This); + if (swapchain->backup_dc) + { + TRACE("Destroying backup wined3d window %p, dc %p.\n", swapchain->backup_wnd, swapchain->backup_dc); + + ReleaseDC(swapchain->backup_wnd, swapchain->backup_dc); + DestroyWindow(swapchain->backup_wnd); + } +} + +ULONG CDECL wined3d_swapchain_incref(struct wined3d_swapchain *swapchain) +{ + ULONG refcount = InterlockedIncrement(&swapchain->ref); + + TRACE("%p increasing refcount to %u.\n", swapchain, refcount); + + return refcount; +} + +/* Do not call while under the GL lock. */ +ULONG CDECL wined3d_swapchain_decref(struct wined3d_swapchain *swapchain) +{ + ULONG refcount = InterlockedDecrement(&swapchain->ref); + + TRACE("%p decreasing refcount to %u.\n", swapchain, refcount); + + if (!refcount) + { + swapchain_cleanup(swapchain); + swapchain->parent_ops->wined3d_object_destroyed(swapchain->parent); + HeapFree(GetProcessHeap(), 0, swapchain); + } + + return refcount; +} + +void * CDECL wined3d_swapchain_get_parent(const struct wined3d_swapchain *swapchain) +{ + TRACE("swapchain %p.\n", swapchain); + + return swapchain->parent; +} + +HRESULT CDECL wined3d_swapchain_set_window(struct wined3d_swapchain *swapchain, HWND window) +{ + if (!window) + window = swapchain->device_window; + if (window == swapchain->win_handle) + return WINED3D_OK; + + TRACE("Setting swapchain %p window from %p to %p.\n", + swapchain, swapchain->win_handle, window); + swapchain->win_handle = window; + + return WINED3D_OK; +} + +HRESULT CDECL wined3d_swapchain_present(struct wined3d_swapchain *swapchain, + const RECT *src_rect, const RECT *dst_rect, HWND dst_window_override, + const RGNDATA *dirty_region, DWORD flags) +{ + TRACE("swapchain %p, src_rect %s, dst_rect %s, dst_window_override %p, dirty_region %p, flags %#x.\n", + swapchain, wine_dbgstr_rect(src_rect), wine_dbgstr_rect(dst_rect), + dst_window_override, dirty_region, flags); + + wined3d_swapchain_set_window(swapchain, dst_window_override); + + return swapchain->swapchain_ops->swapchain_present(swapchain, + src_rect, dst_rect, dirty_region, flags); +} + +HRESULT CDECL wined3d_swapchain_get_front_buffer_data(const struct wined3d_swapchain *swapchain, + struct wined3d_surface *dst_surface) +{ + POINT offset = {0, 0}; + + TRACE("swapchain %p, dst_surface %p.\n", swapchain, dst_surface); + + if (swapchain->presentParms.Windowed) + MapWindowPoints(swapchain->win_handle, NULL, &offset, 1); + + wined3d_surface_bltfast(dst_surface, offset.x, offset.y, swapchain->front_buffer, NULL, 0); + + return WINED3D_OK; +} + +HRESULT CDECL wined3d_swapchain_get_back_buffer(const struct wined3d_swapchain *swapchain, + UINT back_buffer_idx, WINED3DBACKBUFFER_TYPE type, struct wined3d_surface **back_buffer) +{ + TRACE("swapchain %p, back_buffer_idx %u, type %#x, back_buffer %p.\n", + swapchain, back_buffer_idx, type, back_buffer); + + /* Return invalid if there is no backbuffer array, otherwise it will + * crash when ddraw is used (there swapchain->back_buffers is always + * NULL). We need this because this function is called from + * stateblock_init_default_state() to get the default scissorrect + * dimensions. */ + if (!swapchain->back_buffers || back_buffer_idx >= swapchain->presentParms.BackBufferCount) + { + WARN("Invalid back buffer index.\n"); + /* Native d3d9 doesn't set NULL here, just as wine's d3d9. But set it + * here in wined3d to avoid problems in other libs. */ + *back_buffer = NULL; + return WINED3DERR_INVALIDCALL; + } + + *back_buffer = swapchain->back_buffers[back_buffer_idx]; + if (*back_buffer) + wined3d_surface_incref(*back_buffer); + + TRACE("Returning back buffer %p.\n", *back_buffer); + + return WINED3D_OK; +} + +HRESULT CDECL wined3d_swapchain_get_raster_status(const struct wined3d_swapchain *swapchain, + WINED3DRASTER_STATUS *raster_status) +{ + static BOOL warned; + /* No OpenGL equivalent */ + if (!warned) + { + FIXME("swapchain %p, raster_status %p stub!\n", swapchain, raster_status); + warned = TRUE; + } + + /* Obtaining the raster status is a widely implemented but optional + * feature. When this method returns OK StarCraft 2 expects the + * raster_status->InVBlank value to actually change over time. To prevent + * StarCraft 2 from running in an infinite loop at startup this method + * returns INVALIDCALL. */ + return WINED3DERR_INVALIDCALL; +} + +HRESULT CDECL wined3d_swapchain_get_display_mode(const struct wined3d_swapchain *swapchain, WINED3DDISPLAYMODE *mode) +{ + HRESULT hr; + + TRACE("swapchain %p, mode %p.\n", swapchain, mode); + + hr = wined3d_get_adapter_display_mode(swapchain->device->wined3d, swapchain->device->adapter->ordinal, mode); + + TRACE("Returning w %u, h %u, refresh rate %u, format %s.\n", + mode->Width, mode->Height, mode->RefreshRate, debug_d3dformat(mode->Format)); + + return hr; +} + +struct wined3d_device * CDECL wined3d_swapchain_get_device(const struct wined3d_swapchain *swapchain) +{ + TRACE("swapchain %p.\n", swapchain); + + return swapchain->device; +} + +HRESULT CDECL wined3d_swapchain_get_present_parameters(const struct wined3d_swapchain *swapchain, + WINED3DPRESENT_PARAMETERS *present_parameters) +{ + TRACE("swapchain %p, present_parameters %p.\n", swapchain, present_parameters); + + *present_parameters = swapchain->presentParms; + + return WINED3D_OK; +} + +HRESULT CDECL wined3d_swapchain_set_gamma_ramp(const struct wined3d_swapchain *swapchain, + DWORD flags, const WINED3DGAMMARAMP *ramp) +{ + HDC dc; + + TRACE("swapchain %p, flags %#x, ramp %p.\n", swapchain, flags, ramp); + + if (flags) + FIXME("Ignoring flags %#x.\n", flags); + + dc = GetDC(swapchain->device_window); + SetDeviceGammaRamp(dc, (void *)ramp); + ReleaseDC(swapchain->device_window, dc); + + return WINED3D_OK; +} + +HRESULT CDECL wined3d_swapchain_get_gamma_ramp(const struct wined3d_swapchain *swapchain, + WINED3DGAMMARAMP *ramp) +{ + HDC dc; + + TRACE("swapchain %p, ramp %p.\n", swapchain, ramp); + + dc = GetDC(swapchain->device_window); + GetDeviceGammaRamp(dc, ramp); + ReleaseDC(swapchain->device_window, dc); + + return WINED3D_OK; } /* A GL context is provided by the caller */ -static void swapchain_blit(IWineD3DSwapChainImpl *This, struct wined3d_context *context, - const RECT *src_rect, const RECT *dst_rect) +static void swapchain_blit(struct wined3d_swapchain *swapchain, + struct wined3d_context *context, const RECT *src_rect, const RECT *dst_rect) { - IWineD3DDeviceImpl *device = This->device; - IWineD3DSurfaceImpl *backbuffer = This->back_buffers[0]; + struct wined3d_surface *backbuffer = swapchain->back_buffers[0]; + struct wined3d_device *device = swapchain->device; UINT src_w = src_rect->right - src_rect->left; UINT src_h = src_rect->bottom - src_rect->top; GLenum gl_filter; @@ -108,14 +290,14 @@ static void swapchain_blit(IWineD3DSwapChainImpl *This, struct wined3d_context * UINT win_h; TRACE("swapchain %p, context %p, src_rect %s, dst_rect %s.\n", - This, context, wine_dbgstr_rect(src_rect), wine_dbgstr_rect(dst_rect)); + swapchain, context, wine_dbgstr_rect(src_rect), wine_dbgstr_rect(dst_rect)); if (src_w == dst_rect->right - dst_rect->left && src_h == dst_rect->bottom - dst_rect->top) gl_filter = GL_NEAREST; else gl_filter = GL_LINEAR; - GetClientRect(This->win_handle, &win_rect); + GetClientRect(swapchain->win_handle, &win_rect); win_h = win_rect.bottom - win_rect.top; if (gl_info->fbo_ops.glBlitFramebuffer && is_identity_fixup(backbuffer->resource.format->color_fixup)) @@ -123,6 +305,7 @@ static void swapchain_blit(IWineD3DSwapChainImpl *This, struct wined3d_context * ENTER_GL(); context_apply_fbo_state_blit(context, GL_READ_FRAMEBUFFER, backbuffer, NULL, SFLAG_INTEXTURE); glReadBuffer(GL_COLOR_ATTACHMENT0); + context_check_fbo_status(context, GL_READ_FRAMEBUFFER); context_bind_fbo(context, GL_DRAW_FRAMEBUFFER, NULL); context_set_draw_buffer(context, GL_BACK); @@ -134,7 +317,7 @@ static void swapchain_blit(IWineD3DSwapChainImpl *This, struct wined3d_context * IWineD3DDeviceImpl_MarkStateDirty(device, STATE_RENDER(WINED3DRS_COLORWRITEENABLE3)); glDisable(GL_SCISSOR_TEST); - IWineD3DDeviceImpl_MarkStateDirty(This->device, STATE_RENDER(WINED3DRS_SCISSORTESTENABLE)); + IWineD3DDeviceImpl_MarkStateDirty(device, STATE_RENDER(WINED3DRS_SCISSORTESTENABLE)); /* Note that the texture is upside down */ gl_info->fbo_ops.glBlitFramebuffer(src_rect->left, src_rect->top, src_rect->right, src_rect->bottom, @@ -151,10 +334,10 @@ static void swapchain_blit(IWineD3DSwapChainImpl *This, struct wined3d_context * float tex_right = src_rect->right; float tex_bottom = src_rect->bottom; - context2 = context_acquire(This->device, This->back_buffers[0]); + context2 = context_acquire(device, swapchain->back_buffers[0]); context_apply_blit_state(context2, device); - if(backbuffer->Flags & SFLAG_NORMCOORD) + if (backbuffer->flags & SFLAG_NORMCOORD) { tex_left /= src_w; tex_right /= src_w; @@ -171,7 +354,7 @@ static void swapchain_blit(IWineD3DSwapChainImpl *This, struct wined3d_context * /* Set up the texture. The surface is not in a IWineD3D*Texture container, * so there are no d3d texture settings to dirtify */ - device->blitter->set_shader((IWineD3DDevice *) device, backbuffer); + device->blitter->set_shader(device->blit_priv, context2->gl_info, backbuffer); glTexParameteri(backbuffer->texture_target, GL_TEXTURE_MIN_FILTER, gl_filter); glTexParameteri(backbuffer->texture_target, GL_TEXTURE_MAG_FILTER, gl_filter); @@ -212,7 +395,7 @@ static void swapchain_blit(IWineD3DSwapChainImpl *This, struct wined3d_context * glPopMatrix(); glPopAttrib(); - device->blitter->unset_shader((IWineD3DDevice *) device); + device->blitter->unset_shader(context->gl_info); checkGLcall("Swapchain present blit(manual)\n"); LEAVE_GL(); @@ -220,18 +403,16 @@ static void swapchain_blit(IWineD3DSwapChainImpl *This, struct wined3d_context * } } -static HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface, CONST RECT *pSourceRect, CONST RECT *pDestRect, HWND hDestWindowOverride, CONST RGNDATA *pDirtyRegion, DWORD dwFlags) { - IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface; +static HRESULT swapchain_gl_present(struct wined3d_swapchain *swapchain, const RECT *src_rect_in, + const RECT *dst_rect_in, const RGNDATA *dirty_region, DWORD flags) +{ + const struct wined3d_fb_state *fb = &swapchain->device->fb; const struct wined3d_gl_info *gl_info; struct wined3d_context *context; RECT src_rect, dst_rect; BOOL render_to_fbo; - unsigned int sync; - int retval; - IWineD3DSwapChain_SetDestWindowOverride(iface, hDestWindowOverride); - - context = context_acquire(This->device, This->back_buffers[0]); + context = context_acquire(swapchain->device, swapchain->back_buffers[0]); if (!context->valid) { context_release(context); @@ -242,15 +423,17 @@ static HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface, CO gl_info = context->gl_info; /* Render the cursor onto the back buffer, using our nifty directdraw blitting code :-) */ - if (This->device->bCursorVisible && This->device->cursorTexture) + if (swapchain->device->bCursorVisible && + swapchain->device->cursorTexture && + !swapchain->device->hardwareCursor) { - IWineD3DSurfaceImpl cursor; + struct wined3d_surface cursor; RECT destRect = { - This->device->xScreenSpace - This->device->xHotSpot, - This->device->yScreenSpace - This->device->yHotSpot, - This->device->xScreenSpace + This->device->cursorWidth - This->device->xHotSpot, - This->device->yScreenSpace + This->device->cursorHeight - This->device->yHotSpot, + swapchain->device->xScreenSpace - swapchain->device->xHotSpot, + swapchain->device->yScreenSpace - swapchain->device->yHotSpot, + swapchain->device->xScreenSpace + swapchain->device->cursorWidth - swapchain->device->xHotSpot, + swapchain->device->yScreenSpace + swapchain->device->cursorHeight - swapchain->device->yHotSpot, }; TRACE("Rendering the cursor. Creating fake surface at %p\n", &cursor); /* Build a fake surface to call the Blitting code. It is not possible to use the interface passed by @@ -258,49 +441,47 @@ static HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface, CO * allows to use the Blitting engine and avoid copying the whole texture -> render target blitting code. */ memset(&cursor, 0, sizeof(cursor)); - cursor.lpVtbl = &IWineD3DSurface_Vtbl; cursor.resource.ref = 1; - cursor.resource.device = This->device; + cursor.resource.device = swapchain->device; cursor.resource.pool = WINED3DPOOL_SCRATCH; cursor.resource.format = wined3d_get_format(gl_info, WINED3DFMT_B8G8R8A8_UNORM); cursor.resource.resourceType = WINED3DRTYPE_SURFACE; - cursor.texture_name = This->device->cursorTexture; + cursor.texture_name = swapchain->device->cursorTexture; cursor.texture_target = GL_TEXTURE_2D; cursor.texture_level = 0; - cursor.currentDesc.Width = This->device->cursorWidth; - cursor.currentDesc.Height = This->device->cursorHeight; + cursor.resource.width = swapchain->device->cursorWidth; + cursor.resource.height = swapchain->device->cursorHeight; /* The cursor must have pow2 sizes */ - cursor.pow2Width = cursor.currentDesc.Width; - cursor.pow2Height = cursor.currentDesc.Height; + cursor.pow2Width = cursor.resource.width; + cursor.pow2Height = cursor.resource.height; /* The surface is in the texture */ - cursor.Flags |= SFLAG_INTEXTURE; + cursor.flags |= SFLAG_INTEXTURE; /* DDBLT_KEYSRC will cause BltOverride to enable the alpha test with GL_NOTEQUAL, 0.0, * which is exactly what we want :-) */ - if (This->presentParms.Windowed) { - MapWindowPoints(NULL, This->win_handle, (LPPOINT)&destRect, 2); - } - IWineD3DSurface_Blt((IWineD3DSurface *)This->back_buffers[0], &destRect, (IWineD3DSurface *)&cursor, - NULL, WINEDDBLT_KEYSRC, NULL, WINED3DTEXF_POINT); + if (swapchain->presentParms.Windowed) + MapWindowPoints(NULL, swapchain->win_handle, (LPPOINT)&destRect, 2); + wined3d_surface_blt(swapchain->back_buffers[0], &destRect, + &cursor, NULL, WINEDDBLT_KEYSRC, NULL, WINED3DTEXF_POINT); } - if (This->device->logo_surface) + if (swapchain->device->logo_surface) { /* Blit the logo into the upper left corner of the drawable. */ - IWineD3DSurface_BltFast((IWineD3DSurface *)This->back_buffers[0], 0, 0, - This->device->logo_surface, NULL, WINEDDBLTFAST_SRCCOLORKEY); + wined3d_surface_bltfast(swapchain->back_buffers[0], 0, 0, + swapchain->device->logo_surface, NULL, WINEDDBLTFAST_SRCCOLORKEY); } TRACE("Presenting HDC %p.\n", context->hdc); - render_to_fbo = This->render_to_fbo; + render_to_fbo = swapchain->render_to_fbo; - if (pSourceRect) + if (src_rect_in) { - src_rect = *pSourceRect; + src_rect = *src_rect_in; if (!render_to_fbo && (src_rect.left || src_rect.top - || src_rect.right != This->presentParms.BackBufferWidth - || src_rect.bottom != This->presentParms.BackBufferHeight)) + || src_rect.right != swapchain->presentParms.BackBufferWidth + || src_rect.bottom != swapchain->presentParms.BackBufferHeight)) { render_to_fbo = TRUE; } @@ -309,16 +490,18 @@ static HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface, CO { src_rect.left = 0; src_rect.top = 0; - src_rect.right = This->presentParms.BackBufferWidth; - src_rect.bottom = This->presentParms.BackBufferHeight; + src_rect.right = swapchain->presentParms.BackBufferWidth; + src_rect.bottom = swapchain->presentParms.BackBufferHeight; } - if (pDestRect) dst_rect = *pDestRect; - else GetClientRect(This->win_handle, &dst_rect); + if (dst_rect_in) + dst_rect = *dst_rect_in; + else + GetClientRect(swapchain->win_handle, &dst_rect); if (!render_to_fbo && (dst_rect.left || dst_rect.top - || dst_rect.right != This->presentParms.BackBufferWidth - || dst_rect.bottom != This->presentParms.BackBufferHeight)) + || dst_rect.right != swapchain->presentParms.BackBufferWidth + || dst_rect.bottom != swapchain->presentParms.BackBufferHeight)) { render_to_fbo = TRUE; } @@ -330,31 +513,29 @@ static HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface, CO * Note that FBO_blit from the backbuffer to the frontbuffer cannot solve * all these issues - this fails if the window is smaller than the backbuffer. */ - if (!This->render_to_fbo && render_to_fbo && wined3d_settings.offscreen_rendering_mode == ORM_FBO) + if (!swapchain->render_to_fbo && render_to_fbo && wined3d_settings.offscreen_rendering_mode == ORM_FBO) { - surface_load_location(This->back_buffers[0], SFLAG_INTEXTURE, NULL); - surface_modify_location(This->back_buffers[0], SFLAG_INDRAWABLE, FALSE); - This->render_to_fbo = TRUE; + surface_load_location(swapchain->back_buffers[0], SFLAG_INTEXTURE, NULL); + surface_modify_location(swapchain->back_buffers[0], SFLAG_INDRAWABLE, FALSE); + swapchain->render_to_fbo = TRUE; } - if(This->render_to_fbo) + if (swapchain->render_to_fbo) { /* This codepath should only be hit with the COPY swapeffect. Otherwise a backbuffer- * window size mismatch is impossible(fullscreen) and src and dst rectangles are * not allowed(they need the COPY swapeffect) * * The DISCARD swap effect is ok as well since any backbuffer content is allowed after - * the swap - */ - if(This->presentParms.SwapEffect == WINED3DSWAPEFFECT_FLIP ) - { + * the swap. */ + if (swapchain->presentParms.SwapEffect == WINED3DSWAPEFFECT_FLIP) FIXME("Render-to-fbo with WINED3DSWAPEFFECT_FLIP\n"); - } - swapchain_blit(This, context, &src_rect, &dst_rect); + swapchain_blit(swapchain, context, &src_rect, &dst_rect); } - if (This->num_contexts > 1) wglFinish(); + if (swapchain->num_contexts > 1) + wglFinish(); SwapBuffers(context->hdc); /* TODO: cycle through the swapchain buffers */ TRACE("SwapBuffers called, Starting new frame\n"); @@ -362,12 +543,15 @@ static HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface, CO if (TRACE_ON(fps)) { DWORD time = GetTickCount(); - This->frames++; + ++swapchain->frames; + /* every 1.5 seconds */ - if (time - This->prev_time > 1500) { - TRACE_(fps)("%p @ approx %.2ffps\n", This, 1000.0*This->frames/(time - This->prev_time)); - This->prev_time = time; - This->frames = 0; + if (time - swapchain->prev_time > 1500) + { + TRACE_(fps)("%p @ approx %.2ffps\n", + swapchain, 1000.0 * swapchain->frames / (time - swapchain->prev_time)); + swapchain->prev_time = time; + swapchain->frames = 0; } } @@ -385,23 +569,23 @@ static HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface, CO * gets a dark background image. If we clear it with a bright ugly color, the game's * bug shows up much more than it does on Windows, and the players see single pixels * with wrong colors. - * (The Max Payne bug has been confirmed on Windows with the debug runtime) - */ - if (FALSE && This->presentParms.SwapEffect == WINED3DSWAPEFFECT_DISCARD) { + * (The Max Payne bug has been confirmed on Windows with the debug runtime) */ + if (FALSE && swapchain->presentParms.SwapEffect == WINED3DSWAPEFFECT_DISCARD) + { TRACE("Clearing the color buffer with cyan color\n"); - IWineD3DDevice_Clear((IWineD3DDevice *)This->device, 0, NULL, + wined3d_device_clear(swapchain->device, 0, NULL, WINED3DCLEAR_TARGET, 0xff00ffff, 1.0f, 0); } - if (!This->render_to_fbo && ((This->front_buffer->Flags & SFLAG_INSYSMEM) - || (This->back_buffers[0]->Flags & SFLAG_INSYSMEM))) + if (!swapchain->render_to_fbo && ((swapchain->front_buffer->flags & SFLAG_INSYSMEM) + || (swapchain->back_buffers[0]->flags & SFLAG_INSYSMEM))) { /* Both memory copies of the surfaces are ok, flip them around too instead of dirtifying * Doesn't work with render_to_fbo because we're not flipping */ - IWineD3DSurfaceImpl *front = This->front_buffer; - IWineD3DSurfaceImpl *back = This->back_buffers[0]; + struct wined3d_surface *front = swapchain->front_buffer; + struct wined3d_surface *back = swapchain->back_buffers[0]; if(front->resource.size == back->resource.size) { DWORD fbflags; @@ -409,11 +593,10 @@ static HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface, CO /* Tell the front buffer surface that is has been modified. However, * the other locations were preserved during that, so keep the flags. - * This serves to update the emulated overlay, if any - */ - fbflags = front->Flags; + * This serves to update the emulated overlay, if any. */ + fbflags = front->flags; surface_modify_location(front, SFLAG_INDRAWABLE, TRUE); - front->Flags = fbflags; + front->flags = fbflags; } else { @@ -423,206 +606,207 @@ static HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface, CO } else { - surface_modify_location(This->front_buffer, SFLAG_INDRAWABLE, TRUE); + surface_modify_location(swapchain->front_buffer, SFLAG_INDRAWABLE, TRUE); /* If the swapeffect is DISCARD, the back buffer is undefined. That means the SYSMEM * and INTEXTURE copies can keep their old content if they have any defined content. * If the swapeffect is COPY, the content remains the same. If it is FLIP however, * the texture / sysmem copy needs to be reloaded from the drawable */ - if (This->presentParms.SwapEffect == WINED3DSWAPEFFECT_FLIP) - { - surface_modify_location(This->back_buffers[0], SFLAG_INDRAWABLE, TRUE); - } + if (swapchain->presentParms.SwapEffect == WINED3DSWAPEFFECT_FLIP) + surface_modify_location(swapchain->back_buffers[0], SFLAG_INDRAWABLE, TRUE); } - if (This->device->depth_stencil) + if (fb->depth_stencil) { - if (This->presentParms.Flags & WINED3DPRESENTFLAG_DISCARD_DEPTHSTENCIL - || This->device->depth_stencil->Flags & SFLAG_DISCARD) + if (swapchain->presentParms.Flags & WINED3DPRESENTFLAG_DISCARD_DEPTHSTENCIL + || fb->depth_stencil->flags & SFLAG_DISCARD) { - surface_modify_ds_location(This->device->depth_stencil, SFLAG_DS_DISCARDED, - This->device->depth_stencil->currentDesc.Width, - This->device->depth_stencil->currentDesc.Height); - if (This->device->depth_stencil == This->device->onscreen_depth_stencil) + surface_modify_ds_location(fb->depth_stencil, SFLAG_DS_DISCARDED, + fb->depth_stencil->resource.width, + fb->depth_stencil->resource.height); + if (fb->depth_stencil == swapchain->device->onscreen_depth_stencil) { - IWineD3DSurface_Release((IWineD3DSurface *)This->device->onscreen_depth_stencil); - This->device->onscreen_depth_stencil = NULL; + wined3d_surface_decref(swapchain->device->onscreen_depth_stencil); + swapchain->device->onscreen_depth_stencil = NULL; } } } - if (This->presentParms.PresentationInterval != WINED3DPRESENT_INTERVAL_IMMEDIATE - && gl_info->supported[SGI_VIDEO_SYNC]) - { - if ((retval = GL_EXTCALL(glXGetVideoSyncSGI(&sync)))) - ERR("glXGetVideoSyncSGI failed(retval = %d\n", retval); - - switch(This->presentParms.PresentationInterval) { - case WINED3DPRESENT_INTERVAL_DEFAULT: - case WINED3DPRESENT_INTERVAL_ONE: - if(sync <= This->vSyncCounter) { - retval = GL_EXTCALL(glXWaitVideoSyncSGI(1, 0, &This->vSyncCounter)); - } else { - This->vSyncCounter = sync; - } - break; - case WINED3DPRESENT_INTERVAL_TWO: - if(sync <= This->vSyncCounter + 1) { - retval = GL_EXTCALL(glXWaitVideoSyncSGI(2, This->vSyncCounter & 0x1, &This->vSyncCounter)); - } else { - This->vSyncCounter = sync; - } - break; - case WINED3DPRESENT_INTERVAL_THREE: - if(sync <= This->vSyncCounter + 2) { - retval = GL_EXTCALL(glXWaitVideoSyncSGI(3, This->vSyncCounter % 0x3, &This->vSyncCounter)); - } else { - This->vSyncCounter = sync; - } - break; - case WINED3DPRESENT_INTERVAL_FOUR: - if(sync <= This->vSyncCounter + 3) { - retval = GL_EXTCALL(glXWaitVideoSyncSGI(4, This->vSyncCounter & 0x3, &This->vSyncCounter)); - } else { - This->vSyncCounter = sync; - } - break; - default: - FIXME("Unknown presentation interval %08x\n", This->presentParms.PresentationInterval); - } - } - context_release(context); TRACE("returning\n"); return WINED3D_OK; } -static HRESULT WINAPI IWineD3DSwapChainImpl_SetDestWindowOverride(IWineD3DSwapChain *iface, HWND window) +static const struct wined3d_swapchain_ops swapchain_gl_ops = { - IWineD3DSwapChainImpl *swapchain = (IWineD3DSwapChainImpl *)iface; + swapchain_gl_present, +}; - if (!window) window = swapchain->device_window; - if (window == swapchain->win_handle) return WINED3D_OK; +/* Helper function that blits the front buffer contents to the target window. */ +void x11_copy_to_screen(struct wined3d_swapchain *swapchain, const RECT *rect) +{ + struct wined3d_surface *front; + POINT offset = {0, 0}; + HDC src_dc, dst_dc; + RECT draw_rect; + HWND window; - TRACE("Setting swapchain %p window from %p to %p\n", swapchain, swapchain->win_handle, window); - swapchain->win_handle = window; + TRACE("swapchain %p, rect %s.\n", swapchain, wine_dbgstr_rect(rect)); + + front = swapchain->front_buffer; + if (!(front->resource.usage & WINED3DUSAGE_RENDERTARGET)) + return; + + TRACE("Copying surface %p to screen.\n", front); + + src_dc = front->hDC; + window = swapchain->win_handle; + dst_dc = GetDCEx(window, 0, DCX_CLIPSIBLINGS | DCX_CACHE); + + /* Front buffer coordinates are screen coordinates. Map them to the + * destination window if not fullscreened. */ + if (swapchain->presentParms.Windowed) + ClientToScreen(window, &offset); + + TRACE("offset %s.\n", wine_dbgstr_point(&offset)); + +#if 0 + /* FIXME: This doesn't work... if users really want to run + * X in 8bpp, then we need to call directly into display.drv + * (or Wine's equivalent), and force a private colormap + * without default entries. */ + if (front->palette) + { + SelectPalette(dst_dc, front->palette->hpal, FALSE); + RealizePalette(dst_dc); /* sends messages => deadlocks */ + } +#endif + + draw_rect.left = 0; + draw_rect.right = front->resource.width; + draw_rect.top = 0; + draw_rect.bottom = front->resource.height; + +#if 0 + /* TODO: Support clippers. */ + if (front->clipper) + { + RECT xrc; + HWND hwnd = ((IWineD3DClipperImpl *)front->clipper)->hWnd; + if (hwnd && GetClientRect(hwnd,&xrc)) + { + OffsetRect(&xrc, offset.x, offset.y); + IntersectRect(&draw_rect, &draw_rect, &xrc); + } + } +#endif + + if (!rect) + { + /* Only use this if the caller did not pass a rectangle, since + * due to double locking this could be the wrong one... */ + if (front->lockedRect.left != front->lockedRect.right) + IntersectRect(&draw_rect, &draw_rect, &front->lockedRect); + } + else + { + IntersectRect(&draw_rect, &draw_rect, rect); + } + + BitBlt(dst_dc, draw_rect.left - offset.x, draw_rect.top - offset.y, + draw_rect.right - draw_rect.left, draw_rect.bottom - draw_rect.top, + src_dc, draw_rect.left, draw_rect.top, SRCCOPY); + ReleaseDC(window, dst_dc); +} + +static HRESULT swapchain_gdi_present(struct wined3d_swapchain *swapchain, const RECT *src_rect_in, + const RECT *dst_rect_in, const RGNDATA *dirty_region, DWORD flags) +{ + struct wined3d_surface *front, *back; + + if (!swapchain->back_buffers) + { + WARN("Swapchain doesn't have a backbuffer, returning WINED3DERR_INVALIDCALL\n"); + return WINED3DERR_INVALIDCALL; + } + front = swapchain->front_buffer; + back = swapchain->back_buffers[0]; + + /* Flip the DC. */ + { + HDC tmp; + tmp = front->hDC; + front->hDC = back->hDC; + back->hDC = tmp; + } + + /* Flip the DIBsection. */ + { + HBITMAP tmp; + tmp = front->dib.DIBsection; + front->dib.DIBsection = back->dib.DIBsection; + back->dib.DIBsection = tmp; + } + + /* Flip the surface data. */ + { + void *tmp; + + tmp = front->dib.bitmap_data; + front->dib.bitmap_data = back->dib.bitmap_data; + back->dib.bitmap_data = tmp; + + tmp = front->resource.allocatedMemory; + front->resource.allocatedMemory = back->resource.allocatedMemory; + back->resource.allocatedMemory = tmp; + + if (front->resource.heapMemory) + ERR("GDI Surface %p has heap memory allocated.\n", front); + + if (back->resource.heapMemory) + ERR("GDI Surface %p has heap memory allocated.\n", back); + } + + /* Client_memory should not be different, but just in case. */ + { + BOOL tmp; + tmp = front->dib.client_memory; + front->dib.client_memory = back->dib.client_memory; + back->dib.client_memory = tmp; + } + + /* FPS support */ + if (TRACE_ON(fps)) + { + static LONG prev_time, frames; + DWORD time = GetTickCount(); + + ++frames; + + /* every 1.5 seconds */ + if (time - prev_time > 1500) + { + TRACE_(fps)("@ approx %.2ffps\n", 1000.0 * frames / (time - prev_time)); + prev_time = time; + frames = 0; + } + } + + x11_copy_to_screen(swapchain, NULL); return WINED3D_OK; } -static const IWineD3DSwapChainVtbl IWineD3DSwapChain_Vtbl = +static const struct wined3d_swapchain_ops swapchain_gdi_ops = { - /* IUnknown */ - IWineD3DBaseSwapChainImpl_QueryInterface, - IWineD3DBaseSwapChainImpl_AddRef, - IWineD3DBaseSwapChainImpl_Release, - /* IWineD3DSwapChain */ - IWineD3DBaseSwapChainImpl_GetParent, - IWineD3DSwapChainImpl_Destroy, - IWineD3DBaseSwapChainImpl_GetDevice, - IWineD3DSwapChainImpl_Present, - IWineD3DSwapChainImpl_SetDestWindowOverride, - IWineD3DBaseSwapChainImpl_GetFrontBufferData, - IWineD3DBaseSwapChainImpl_GetBackBuffer, - IWineD3DBaseSwapChainImpl_GetRasterStatus, - IWineD3DBaseSwapChainImpl_GetDisplayMode, - IWineD3DBaseSwapChainImpl_GetPresentParameters, - IWineD3DBaseSwapChainImpl_SetGammaRamp, - IWineD3DBaseSwapChainImpl_GetGammaRamp + swapchain_gdi_present, }; -static LONG fullscreen_style(LONG style) -{ - /* Make sure the window is managed, otherwise we won't get keyboard input. */ - style |= WS_POPUP | WS_SYSMENU; - style &= ~(WS_CAPTION | WS_THICKFRAME); - - return style; -} - -static LONG fullscreen_exstyle(LONG exstyle) -{ - /* Filter out window decorations. */ - exstyle &= ~(WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE); - - return exstyle; -} - -void swapchain_setup_fullscreen_window(IWineD3DSwapChainImpl *swapchain, UINT w, UINT h) -{ - IWineD3DDeviceImpl *device = swapchain->device; - HWND window = swapchain->device_window; - BOOL filter_messages; - LONG style, exstyle; - - TRACE("Setting up window %p for fullscreen mode.\n", window); - - if (device->style || device->exStyle) - { - ERR("Changing the window style for window %p, but another style (%08x, %08x) is already stored.\n", - window, device->style, device->exStyle); - } - - device->style = GetWindowLongW(window, GWL_STYLE); - device->exStyle = GetWindowLongW(window, GWL_EXSTYLE); - - style = fullscreen_style(device->style); - exstyle = fullscreen_exstyle(device->exStyle); - - TRACE("Old style was %08x, %08x, setting to %08x, %08x.\n", - device->style, device->exStyle, style, exstyle); - - filter_messages = device->filter_messages; - device->filter_messages = TRUE; - - SetWindowLongW(window, GWL_STYLE, style); - SetWindowLongW(window, GWL_EXSTYLE, exstyle); - SetWindowPos(window, HWND_TOP, 0, 0, w, h, SWP_FRAMECHANGED | SWP_SHOWWINDOW | SWP_NOACTIVATE); - - device->filter_messages = filter_messages; -} - -void swapchain_restore_fullscreen_window(IWineD3DSwapChainImpl *swapchain) -{ - IWineD3DDeviceImpl *device = swapchain->device; - HWND window = swapchain->device_window; - BOOL filter_messages; - LONG style, exstyle; - - if (!device->style && !device->exStyle) return; - - TRACE("Restoring window style of window %p to %08x, %08x.\n", - window, device->style, device->exStyle); - - style = GetWindowLongW(window, GWL_STYLE); - exstyle = GetWindowLongW(window, GWL_EXSTYLE); - - filter_messages = device->filter_messages; - device->filter_messages = TRUE; - - /* Only restore the style if the application didn't modify it during the - * fullscreen phase. Some applications change it before calling Reset() - * when switching between windowed and fullscreen modes (HL2), some - * depend on the original style (Eve Online). */ - if (style == fullscreen_style(device->style) && exstyle == fullscreen_exstyle(device->exStyle)) - { - SetWindowLongW(window, GWL_STYLE, device->style); - SetWindowLongW(window, GWL_EXSTYLE, device->exStyle); - } - SetWindowPos(window, 0, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER); - - device->filter_messages = filter_messages; - - /* Delete the old values. */ - device->style = 0; - device->exStyle = 0; -} - - /* Do not call while under the GL lock. */ -HRESULT swapchain_init(IWineD3DSwapChainImpl *swapchain, WINED3DSURFTYPE surface_type, - IWineD3DDeviceImpl *device, WINED3DPRESENT_PARAMETERS *present_parameters, void *parent) +static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, WINED3DSURFTYPE surface_type, + struct wined3d_device *device, WINED3DPRESENT_PARAMETERS *present_parameters, + void *parent, const struct wined3d_parent_ops *parent_ops) { const struct wined3d_adapter *adapter = device->adapter; const struct wined3d_format *format; @@ -649,11 +833,11 @@ HRESULT swapchain_init(IWineD3DSwapChainImpl *swapchain, WINED3DSURFTYPE surface switch (surface_type) { case SURFACE_GDI: - swapchain->lpVtbl = &IWineGDISwapChain_Vtbl; + swapchain->swapchain_ops = &swapchain_gdi_ops; break; case SURFACE_OPENGL: - swapchain->lpVtbl = &IWineD3DSwapChain_Vtbl; + swapchain->swapchain_ops = &swapchain_gl_ops; break; case SURFACE_UNKNOWN: @@ -665,17 +849,12 @@ HRESULT swapchain_init(IWineD3DSwapChainImpl *swapchain, WINED3DSURFTYPE surface swapchain->device = device; swapchain->parent = parent; + swapchain->parent_ops = parent_ops; swapchain->ref = 1; swapchain->win_handle = window; swapchain->device_window = window; - if (!present_parameters->Windowed && window) - { - swapchain_setup_fullscreen_window(swapchain, present_parameters->BackBufferWidth, - present_parameters->BackBufferHeight); - } - - IWineD3D_GetAdapterDisplayMode(device->wined3d, adapter->ordinal, &mode); + wined3d_get_adapter_display_mode(device->wined3d, adapter->ordinal, &mode); swapchain->orig_width = mode.Width; swapchain->orig_height = mode.Height; swapchain->orig_fmt = mode.Format; @@ -720,18 +899,18 @@ HRESULT swapchain_init(IWineD3DSwapChainImpl *swapchain, WINED3DSURFTYPE surface } TRACE("Creating front buffer.\n"); - hr = IWineD3DDeviceParent_CreateRenderTarget(device->device_parent, parent, + hr = device->device_parent->ops->create_rendertarget(device->device_parent, parent, swapchain->presentParms.BackBufferWidth, swapchain->presentParms.BackBufferHeight, swapchain->presentParms.BackBufferFormat, swapchain->presentParms.MultiSampleType, swapchain->presentParms.MultiSampleQuality, TRUE /* Lockable */, - (IWineD3DSurface **)&swapchain->front_buffer); + &swapchain->front_buffer); if (FAILED(hr)) { WARN("Failed to create front buffer, hr %#x.\n", hr); goto err; } - surface_set_container(swapchain->front_buffer, WINED3D_CONTAINER_SWAPCHAIN, (IWineD3DBase *)swapchain); + surface_set_container(swapchain->front_buffer, WINED3D_CONTAINER_SWAPCHAIN, swapchain); if (surface_type == SURFACE_OPENGL) { surface_modify_location(swapchain->front_buffer, SFLAG_INDRAWABLE, TRUE); @@ -751,7 +930,7 @@ HRESULT swapchain_init(IWineD3DSwapChainImpl *swapchain, WINED3DSURFTYPE surface mode.Format = present_parameters->BackBufferFormat; mode.RefreshRate = present_parameters->FullScreen_RefreshRateInHz; - hr = IWineD3DDevice_SetDisplayMode((IWineD3DDevice *)device, 0, &mode); + hr = wined3d_device_set_display_mode(device, 0, &mode); if (FAILED(hr)) { WARN("Failed to set display mode, hr %#x.\n", hr); @@ -760,15 +939,6 @@ HRESULT swapchain_init(IWineD3DSwapChainImpl *swapchain, WINED3DSURFTYPE surface displaymode_set = TRUE; } - swapchain->context = HeapAlloc(GetProcessHeap(), 0, sizeof(swapchain->context)); - if (!swapchain->context) - { - ERR("Failed to create the context array.\n"); - hr = E_OUTOFMEMORY; - goto err; - } - swapchain->num_contexts = 1; - if (surface_type == SURFACE_OPENGL) { static const enum wined3d_format_id formats[] = @@ -782,6 +952,15 @@ HRESULT swapchain_init(IWineD3DSwapChainImpl *swapchain, WINED3DSURFTYPE surface const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; + swapchain->context = HeapAlloc(GetProcessHeap(), 0, sizeof(swapchain->context)); + if (!swapchain->context) + { + ERR("Failed to create the context array.\n"); + hr = E_OUTOFMEMORY; + goto err; + } + swapchain->num_contexts = 1; + /* In WGL both color, depth and stencil are features of a pixel format. In case of D3D they are separate. * You are able to add a depth + stencil surface at a later stage when you need it. * In order to support this properly in WineD3D we need the ability to recreate the opengl context and @@ -816,10 +995,6 @@ HRESULT swapchain_init(IWineD3DSwapChainImpl *swapchain, WINED3DSURFTYPE surface } context_release(swapchain->context[0]); } - else - { - swapchain->context[0] = NULL; - } if (swapchain->presentParms.BackBufferCount > 0) { @@ -835,18 +1010,18 @@ HRESULT swapchain_init(IWineD3DSwapChainImpl *swapchain, WINED3DSURFTYPE surface for (i = 0; i < swapchain->presentParms.BackBufferCount; ++i) { TRACE("Creating back buffer %u.\n", i); - hr = IWineD3DDeviceParent_CreateRenderTarget(device->device_parent, parent, + hr = device->device_parent->ops->create_rendertarget(device->device_parent, parent, swapchain->presentParms.BackBufferWidth, swapchain->presentParms.BackBufferHeight, swapchain->presentParms.BackBufferFormat, swapchain->presentParms.MultiSampleType, swapchain->presentParms.MultiSampleQuality, TRUE /* Lockable */, - (IWineD3DSurface **)&swapchain->back_buffers[i]); + &swapchain->back_buffers[i]); if (FAILED(hr)) { WARN("Failed to create back buffer %u, hr %#x.\n", i, hr); goto err; } - surface_set_container(swapchain->back_buffers[i], WINED3D_CONTAINER_SWAPCHAIN, (IWineD3DBase *)swapchain); + surface_set_container(swapchain->back_buffers[i], WINED3D_CONTAINER_SWAPCHAIN, swapchain); } } @@ -856,11 +1031,11 @@ HRESULT swapchain_init(IWineD3DSwapChainImpl *swapchain, WINED3DSURFTYPE surface TRACE("Creating depth/stencil buffer.\n"); if (!device->auto_depth_stencil) { - hr = IWineD3DDeviceParent_CreateDepthStencilSurface(device->device_parent, + hr = device->device_parent->ops->create_depth_stencil(device->device_parent, swapchain->presentParms.BackBufferWidth, swapchain->presentParms.BackBufferHeight, swapchain->presentParms.AutoDepthStencilFormat, swapchain->presentParms.MultiSampleType, swapchain->presentParms.MultiSampleQuality, FALSE /* FIXME: Discard */, - (IWineD3DSurface **)&device->auto_depth_stencil); + &device->auto_depth_stencil); if (FAILED(hr)) { WARN("Failed to create the auto depth stencil, hr %#x.\n", hr); @@ -871,7 +1046,7 @@ HRESULT swapchain_init(IWineD3DSwapChainImpl *swapchain, WINED3DSURFTYPE surface } } - IWineD3DSwapChain_GetGammaRamp((IWineD3DSwapChain *)swapchain, &swapchain->orig_gamma); + wined3d_swapchain_get_gamma_ramp(swapchain, &swapchain->orig_gamma); return WINED3D_OK; @@ -896,7 +1071,8 @@ err: { for (i = 0; i < swapchain->presentParms.BackBufferCount; ++i) { - if (swapchain->back_buffers[i]) IWineD3DSurface_Release((IWineD3DSurface *)swapchain->back_buffers[i]); + if (swapchain->back_buffers[i]) + wined3d_surface_decref(swapchain->back_buffers[i]); } HeapFree(GetProcessHeap(), 0, swapchain->back_buffers); } @@ -912,47 +1088,95 @@ err: HeapFree(GetProcessHeap(), 0, swapchain->context); } - if (swapchain->front_buffer) IWineD3DSurface_Release((IWineD3DSurface *)swapchain->front_buffer); + if (swapchain->front_buffer) + wined3d_surface_decref(swapchain->front_buffer); return hr; } /* Do not call while under the GL lock. */ -struct wined3d_context *swapchain_create_context_for_thread(IWineD3DSwapChain *iface) +HRESULT CDECL wined3d_swapchain_create(struct wined3d_device *device, + WINED3DPRESENT_PARAMETERS *present_parameters, WINED3DSURFTYPE surface_type, + void *parent, const struct wined3d_parent_ops *parent_ops, + struct wined3d_swapchain **swapchain) +{ + struct wined3d_swapchain *object; + HRESULT hr; + + TRACE("device %p, present_parameters %p, swapchain %p, parent %p, surface_type %#x.\n", + device, present_parameters, swapchain, parent, surface_type); + + object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); + if (!object) + { + ERR("Failed to allocate swapchain memory.\n"); + return E_OUTOFMEMORY; + } + + hr = swapchain_init(object, surface_type, device, present_parameters, parent, parent_ops); + if (FAILED(hr)) + { + WARN("Failed to initialize swapchain, hr %#x.\n", hr); + HeapFree(GetProcessHeap(), 0, object); + return hr; + } + + TRACE("Created swapchain %p.\n", object); + *swapchain = object; + + return WINED3D_OK; +} + +/* Do not call while under the GL lock. */ +static struct wined3d_context *swapchain_create_context(struct wined3d_swapchain *swapchain) { - IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *) iface; struct wined3d_context **newArray; struct wined3d_context *ctx; - TRACE("Creating a new context for swapchain %p, thread %d\n", This, GetCurrentThreadId()); + TRACE("Creating a new context for swapchain %p, thread %u.\n", swapchain, GetCurrentThreadId()); - if (!(ctx = context_create(This, This->front_buffer, This->ds_format))) + if (!(ctx = context_create(swapchain, swapchain->front_buffer, swapchain->ds_format))) { ERR("Failed to create a new context for the swapchain\n"); return NULL; } context_release(ctx); - newArray = HeapAlloc(GetProcessHeap(), 0, sizeof(*newArray) * (This->num_contexts + 1)); + newArray = HeapAlloc(GetProcessHeap(), 0, sizeof(*newArray) * (swapchain->num_contexts + 1)); if(!newArray) { ERR("Out of memory when trying to allocate a new context array\n"); - context_destroy(This->device, ctx); + context_destroy(swapchain->device, ctx); return NULL; } - memcpy(newArray, This->context, sizeof(*newArray) * This->num_contexts); - HeapFree(GetProcessHeap(), 0, This->context); - newArray[This->num_contexts] = ctx; - This->context = newArray; - This->num_contexts++; + memcpy(newArray, swapchain->context, sizeof(*newArray) * swapchain->num_contexts); + HeapFree(GetProcessHeap(), 0, swapchain->context); + newArray[swapchain->num_contexts] = ctx; + swapchain->context = newArray; + swapchain->num_contexts++; TRACE("Returning context %p\n", ctx); return ctx; } +struct wined3d_context *swapchain_get_context(struct wined3d_swapchain *swapchain) +{ + DWORD tid = GetCurrentThreadId(); + unsigned int i; + + for (i = 0; i < swapchain->num_contexts; ++i) + { + if (swapchain->context[i]->tid == tid) + return swapchain->context[i]; + } + + /* Create a new context for the thread */ + return swapchain_create_context(swapchain); +} + void get_drawable_size_swapchain(struct wined3d_context *context, UINT *width, UINT *height) { /* The drawable size of an onscreen drawable is the surface size. * (Actually: The window size, but the surface is created in window size) */ - *width = context->current_rt->currentDesc.Width; - *height = context->current_rt->currentDesc.Height; + *width = context->current_rt->resource.width; + *height = context->current_rt->resource.height; } diff --git a/dll/directx/wine/wined3d/swapchain_base.c b/dll/directx/wine/wined3d/swapchain_base.c deleted file mode 100644 index 083585fbb56..00000000000 --- a/dll/directx/wine/wined3d/swapchain_base.c +++ /dev/null @@ -1,194 +0,0 @@ -/* - *IDirect3DSwapChain9 implementation - * - *Copyright 2002-2003 Jason Edmeades - *Copyright 2002-2003 Raphael Junqueira - *Copyright 2005 Oliver Stieber - *Copyright 2007-2008 Stefan Dösinger for CodeWeavers - * - *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 "config.h" -#include "wined3d_private.h" - -WINE_DEFAULT_DEBUG_CHANNEL(d3d); - -/* IDirect3DSwapChain IUnknown parts follow: */ -HRESULT WINAPI IWineD3DBaseSwapChainImpl_QueryInterface(IWineD3DSwapChain *iface, REFIID riid, void **object) -{ - TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object); - - if (IsEqualGUID(riid, &IID_IWineD3DSwapChain) - || IsEqualGUID(riid, &IID_IWineD3DBase) - || IsEqualGUID(riid, &IID_IUnknown)) - { - IUnknown_AddRef(iface); - *object = iface; - return S_OK; - } - - WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid)); - - *object = NULL; - return E_NOINTERFACE; -} - -ULONG WINAPI IWineD3DBaseSwapChainImpl_AddRef(IWineD3DSwapChain *iface) { - IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface; - DWORD refCount = InterlockedIncrement(&This->ref); - TRACE("(%p) : AddRef increasing from %d\n", This, refCount - 1); - return refCount; -} - -/* Do not call while under the GL lock. */ -ULONG WINAPI IWineD3DBaseSwapChainImpl_Release(IWineD3DSwapChain *iface) -{ - IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface; - DWORD refCount; - refCount = InterlockedDecrement(&This->ref); - TRACE("(%p) : ReleaseRef to %d\n", This, refCount); - - if (!refCount) IWineD3DSwapChain_Destroy(iface); - - return refCount; -} - -void * WINAPI IWineD3DBaseSwapChainImpl_GetParent(IWineD3DSwapChain *iface) -{ - TRACE("iface %p.\n", iface); - - return ((IWineD3DSwapChainImpl *)iface)->parent; -} - -HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetFrontBufferData(IWineD3DSwapChain *iface, IWineD3DSurface *dst_surface) -{ - IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface; - POINT start; - - TRACE("iface %p, dst_surface %p.\n", iface, dst_surface); - - start.x = 0; - start.y = 0; - - if (This->presentParms.Windowed) { - MapWindowPoints(This->win_handle, NULL, &start, 1); - } - - IWineD3DSurface_BltFast(dst_surface, start.x, start.y, (IWineD3DSurface *)This->front_buffer, NULL, 0); - return WINED3D_OK; -} - -HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetBackBuffer(IWineD3DSwapChain *iface, - UINT back_buffer_idx, WINED3DBACKBUFFER_TYPE type, IWineD3DSurface **back_buffer) -{ - IWineD3DSwapChainImpl *swapchain = (IWineD3DSwapChainImpl *)iface; - - TRACE("iface %p, back_buffer_idx %u, type %#x, back_buffer %p.\n", - iface, back_buffer_idx, type, back_buffer); - - /* Return invalid if there is no backbuffer array, otherwise it will - * crash when ddraw is used (there swapchain->back_buffers is always NULL). - * We need this because this function is called from - * IWineD3DStateBlockImpl_InitStartupStateBlock() to get the default - * scissorrect dimensions. */ - if (!swapchain->back_buffers || back_buffer_idx >= swapchain->presentParms.BackBufferCount) - { - WARN("Invalid back buffer index.\n"); - /* Native d3d9 doesn't set NULL here, just as wine's d3d9. But set it - * here in wined3d to avoid problems in other libs. */ - *back_buffer = NULL; - return WINED3DERR_INVALIDCALL; - } - - *back_buffer = (IWineD3DSurface *)swapchain->back_buffers[back_buffer_idx]; - if (*back_buffer) IWineD3DSurface_AddRef(*back_buffer); - - TRACE("Returning back buffer %p.\n", *back_buffer); - - return WINED3D_OK; -} - -HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetRasterStatus(IWineD3DSwapChain *iface, WINED3DRASTER_STATUS *pRasterStatus) { - static BOOL warned; - /* No OpenGL equivalent */ - if (!warned) - { - FIXME("iface %p, raster_status %p stub!\n", iface, pRasterStatus); - warned = TRUE; - } - /* Obtaining the raster status is a widely implemented but optional feature. - * When this method returns OK then the application Starcraft 2 expects that - * the pRasterStatus->InVBlank value differs over time. To prevent Starcraft 2 - * from running in an infinite loop at startup this method returns INVALIDCALL. - */ - return WINED3DERR_INVALIDCALL; -} - -HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetDisplayMode(IWineD3DSwapChain *iface, WINED3DDISPLAYMODE*pMode) { - IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface; - HRESULT hr; - - TRACE("(%p)->(%p): Calling GetAdapterDisplayMode\n", This, pMode); - hr = IWineD3D_GetAdapterDisplayMode(This->device->wined3d, This->device->adapter->ordinal, pMode); - - TRACE("(%p) : returning w(%d) h(%d) rr(%d) fmt(%u,%s)\n", This, pMode->Width, pMode->Height, pMode->RefreshRate, - pMode->Format, debug_d3dformat(pMode->Format)); - return hr; -} - -HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetDevice(IWineD3DSwapChain *iface, IWineD3DDevice **device) -{ - IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface; - - *device = (IWineD3DDevice *)This->device; - IWineD3DDevice_AddRef(*device); - - TRACE("(%p) : returning %p\n", This, *device); - return WINED3D_OK; -} - -HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetPresentParameters(IWineD3DSwapChain *iface, WINED3DPRESENT_PARAMETERS *pPresentationParameters) { - IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface; - TRACE("(%p)\n", This); - - *pPresentationParameters = This->presentParms; - - return WINED3D_OK; -} - -HRESULT WINAPI IWineD3DBaseSwapChainImpl_SetGammaRamp(IWineD3DSwapChain *iface, DWORD Flags, CONST WINED3DGAMMARAMP *pRamp){ - - IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface; - HDC hDC; - TRACE("(%p) : pRamp@%p flags(%d)\n", This, pRamp, Flags); - hDC = GetDC(This->device_window); - SetDeviceGammaRamp(hDC, (LPVOID)pRamp); - ReleaseDC(This->device_window, hDC); - return WINED3D_OK; - -} - -HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetGammaRamp(IWineD3DSwapChain *iface, WINED3DGAMMARAMP *pRamp){ - - IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface; - HDC hDC; - TRACE("(%p) : pRamp@%p\n", This, pRamp); - hDC = GetDC(This->device_window); - GetDeviceGammaRamp(hDC, pRamp); - ReleaseDC(This->device_window, hDC); - return WINED3D_OK; - -} diff --git a/dll/directx/wine/wined3d/swapchain_gdi.c b/dll/directx/wine/wined3d/swapchain_gdi.c deleted file mode 100644 index 8920caec85c..00000000000 --- a/dll/directx/wine/wined3d/swapchain_gdi.c +++ /dev/null @@ -1,270 +0,0 @@ -/* - *IDirect3DSwapChain9 implementation - * - *Copyright 2002-2003 Jason Edmeades - *Copyright 2002-2003 Raphael Junqueira - *Copyright 2005 Oliver Stieber - *Copyright 2007-2008 Stefan Dösinger for CodeWeavers - * - *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 "config.h" -#include "wined3d_private.h" - -WINE_DEFAULT_DEBUG_CHANNEL(d3d); -WINE_DECLARE_DEBUG_CHANNEL(fps); - -static void WINAPI IWineGDISwapChainImpl_Destroy(IWineD3DSwapChain *iface) -{ - IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface; - WINED3DDISPLAYMODE mode; - - TRACE("Destroying swapchain %p\n", iface); - - IWineD3DSwapChain_SetGammaRamp(iface, 0, &This->orig_gamma); - - /* release the ref to the front and back buffer parents */ - if (This->front_buffer) - { - surface_set_container(This->front_buffer, WINED3D_CONTAINER_NONE, NULL); - if (IWineD3DSurface_Release((IWineD3DSurface *)This->front_buffer) > 0) - { - WARN("(%p) Something's still holding the front buffer\n",This); - } - } - - if (This->back_buffers) - { - UINT i; - for (i = 0; i < This->presentParms.BackBufferCount; ++i) - { - surface_set_container(This->back_buffers[i], WINED3D_CONTAINER_NONE, NULL); - if (IWineD3DSurface_Release((IWineD3DSurface *)This->back_buffers[i])) - { - WARN("(%p) Something's still holding the back buffer\n",This); - } - } - HeapFree(GetProcessHeap(), 0, This->back_buffers); - } - - /* Restore the screen resolution if we rendered in fullscreen - * This will restore the screen resolution to what it was before creating the swapchain. In case of d3d8 and d3d9 - * this will be the original desktop resolution. In case of d3d7 this will be a NOP because ddraw sets the resolution - * before starting up Direct3D, thus orig_width and orig_height will be equal to the modes in the presentation params - */ - if (!This->presentParms.Windowed && This->presentParms.AutoRestoreDisplayMode) - { - mode.Width = This->orig_width; - mode.Height = This->orig_height; - mode.RefreshRate = 0; - mode.Format = This->orig_fmt; - IWineD3DDevice_SetDisplayMode((IWineD3DDevice *)This->device, 0, &mode); - } - - HeapFree(GetProcessHeap(), 0, This->context); - HeapFree(GetProcessHeap(), 0, This); -} - -/***************************************************************************** - * x11_copy_to_screen - * - * Helper function that blts the front buffer contents to the target window - * - * Params: - * This: Surface to copy from - * rc: Rectangle to copy - * - *****************************************************************************/ -void x11_copy_to_screen(IWineD3DSwapChainImpl *This, const RECT *rc) -{ - IWineD3DSurfaceImpl *front = This->front_buffer; - - if(front->resource.usage & WINED3DUSAGE_RENDERTARGET) { - POINT offset = {0,0}; - HWND hDisplayWnd; - HDC hDisplayDC; - HDC hSurfaceDC = 0; - RECT drawrect; - TRACE("(%p)->(%p): Copying to screen\n", front, rc); - - hSurfaceDC = front->hDC; - - hDisplayWnd = This->win_handle; - hDisplayDC = GetDCEx(hDisplayWnd, 0, DCX_CLIPSIBLINGS|DCX_CACHE); - if(rc) { - TRACE(" copying rect (%d,%d)->(%d,%d), offset (%d,%d)\n", - rc->left, rc->top, rc->right, rc->bottom, offset.x, offset.y); - } - - /* Front buffer coordinates are screen coordinates. Map them to the destination - * window if not fullscreened - */ - if(This->presentParms.Windowed) { - ClientToScreen(hDisplayWnd, &offset); - } -#if 0 - /* FIXME: This doesn't work... if users really want to run - * X in 8bpp, then we need to call directly into display.drv - * (or Wine's equivalent), and force a private colormap - * without default entries. */ - if (front->palette) { - SelectPalette(hDisplayDC, front->palette->hpal, FALSE); - RealizePalette(hDisplayDC); /* sends messages => deadlocks */ - } -#endif - drawrect.left = 0; - drawrect.right = front->currentDesc.Width; - drawrect.top = 0; - drawrect.bottom = front->currentDesc.Height; - -#if 0 - /* TODO: Support clippers */ - if (front->clipper) - { - RECT xrc; - HWND hwnd = ((IWineD3DClipperImpl *) front->clipper)->hWnd; - if (hwnd && GetClientRect(hwnd,&xrc)) - { - OffsetRect(&xrc,offset.x,offset.y); - IntersectRect(&drawrect,&drawrect,&xrc); - } - } -#endif - if (rc) { - IntersectRect(&drawrect,&drawrect,rc); - } - else { - /* Only use this if the caller did not pass a rectangle, since - * due to double locking this could be the wrong one ... - */ - if (front->lockedRect.left != front->lockedRect.right) { - IntersectRect(&drawrect,&drawrect,&front->lockedRect); - } - } - - BitBlt(hDisplayDC, - drawrect.left-offset.x, drawrect.top-offset.y, - drawrect.right-drawrect.left, drawrect.bottom-drawrect.top, - hSurfaceDC, - drawrect.left, drawrect.top, - SRCCOPY); - ReleaseDC(hDisplayWnd, hDisplayDC); - } -} - -static HRESULT WINAPI IWineGDISwapChainImpl_SetDestWindowOverride(IWineD3DSwapChain *iface, HWND window) { - IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface; - - This->win_handle = window; - return WINED3D_OK; -} - -static HRESULT WINAPI IWineGDISwapChainImpl_Present(IWineD3DSwapChain *iface, CONST RECT *pSourceRect, CONST RECT *pDestRect, HWND hDestWindowOverride, CONST RGNDATA *pDirtyRegion, DWORD dwFlags) { - IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *) iface; - IWineD3DSurfaceImpl *front, *back; - - if (!This->back_buffers) - { - WARN("Swapchain doesn't have a backbuffer, returning WINED3DERR_INVALIDCALL\n"); - return WINED3DERR_INVALIDCALL; - } - front = This->front_buffer; - back = This->back_buffers[0]; - - /* Flip the DC */ - { - HDC tmp; - tmp = front->hDC; - front->hDC = back->hDC; - back->hDC = tmp; - } - - /* Flip the DIBsection */ - { - HBITMAP tmp; - tmp = front->dib.DIBsection; - front->dib.DIBsection = back->dib.DIBsection; - back->dib.DIBsection = tmp; - } - - /* Flip the surface data */ - { - void* tmp; - - tmp = front->dib.bitmap_data; - front->dib.bitmap_data = back->dib.bitmap_data; - back->dib.bitmap_data = tmp; - - tmp = front->resource.allocatedMemory; - front->resource.allocatedMemory = back->resource.allocatedMemory; - back->resource.allocatedMemory = tmp; - - if(front->resource.heapMemory) { - ERR("GDI Surface %p has heap memory allocated\n", front); - } - if(back->resource.heapMemory) { - ERR("GDI Surface %p has heap memory allocated\n", back); - } - } - - /* client_memory should not be different, but just in case */ - { - BOOL tmp; - tmp = front->dib.client_memory; - front->dib.client_memory = back->dib.client_memory; - back->dib.client_memory = tmp; - } - - /* FPS support */ - if (TRACE_ON(fps)) - { - static LONG prev_time, frames; - - DWORD time = GetTickCount(); - frames++; - /* every 1.5 seconds */ - if (time - prev_time > 1500) { - TRACE_(fps)("@ approx %.2ffps\n", 1000.0*frames/(time - prev_time)); - prev_time = time; - frames = 0; - } - } - - x11_copy_to_screen(This, NULL); - - return WINED3D_OK; -} - -const IWineD3DSwapChainVtbl IWineGDISwapChain_Vtbl = -{ - /* IUnknown */ - IWineD3DBaseSwapChainImpl_QueryInterface, - IWineD3DBaseSwapChainImpl_AddRef, - IWineD3DBaseSwapChainImpl_Release, - /* IWineD3DSwapChain */ - IWineD3DBaseSwapChainImpl_GetParent, - IWineGDISwapChainImpl_Destroy, - IWineD3DBaseSwapChainImpl_GetDevice, - IWineGDISwapChainImpl_Present, - IWineGDISwapChainImpl_SetDestWindowOverride, - IWineD3DBaseSwapChainImpl_GetFrontBufferData, - IWineD3DBaseSwapChainImpl_GetBackBuffer, - IWineD3DBaseSwapChainImpl_GetRasterStatus, - IWineD3DBaseSwapChainImpl_GetDisplayMode, - IWineD3DBaseSwapChainImpl_GetPresentParameters, - IWineD3DBaseSwapChainImpl_SetGammaRamp, - IWineD3DBaseSwapChainImpl_GetGammaRamp -}; diff --git a/dll/directx/wine/wined3d/texture.c b/dll/directx/wine/wined3d/texture.c index ce95567f547..34801b8e510 100644 --- a/dll/directx/wine/wined3d/texture.c +++ b/dll/directx/wine/wined3d/texture.c @@ -1,11 +1,9 @@ /* - * IWineD3DTexture implementation - * * Copyright 2002-2005 Jason Edmeades * Copyright 2002-2005 Raphael Junqueira * Copyright 2005 Oliver Stieber * Copyright 2007-2008 Stefan Dösinger for CodeWeavers - * Copyright 2009 Henri Verbeet for CodeWeavers + * Copyright 2009-2011 Henri Verbeet for CodeWeavers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -27,270 +25,610 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d_texture); -/* Do not call while under the GL lock. */ -static void texture_internal_preload(IWineD3DBaseTexture *iface, enum WINED3DSRGB srgb) +static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struct wined3d_texture_ops *texture_ops, + UINT layer_count, UINT level_count, WINED3DRESOURCETYPE resource_type, struct wined3d_device *device, + DWORD usage, const struct wined3d_format *format, WINED3DPOOL pool, void *parent, + const struct wined3d_parent_ops *parent_ops, const struct wined3d_resource_ops *resource_ops) { - /* Override the IWineD3DResource PreLoad method. */ - IWineD3DTextureImpl *This = (IWineD3DTextureImpl *)iface; - IWineD3DDeviceImpl *device = This->resource.device; - struct wined3d_context *context = NULL; - unsigned int i; - BOOL srgb_mode; - BOOL *dirty; + HRESULT hr; - TRACE("(%p) : About to load texture.\n", This); - - switch (srgb) + hr = resource_init(&texture->resource, device, resource_type, format, + WINED3DMULTISAMPLE_NONE, 0, usage, pool, 0, 0, 0, 0, + parent, parent_ops, resource_ops); + if (FAILED(hr)) { - case SRGB_RGB: - srgb_mode = FALSE; - break; - - case SRGB_BOTH: - texture_internal_preload(iface, SRGB_RGB); - /* Fallthrough */ - - case SRGB_SRGB: - srgb_mode = TRUE; - break; - - default: - srgb_mode = This->baseTexture.is_srgb; - break; + WARN("Failed to initialize resource, returning %#x\n", hr); + return hr; } - dirty = srgb_mode ? &This->baseTexture.texture_srgb.dirty : &This->baseTexture.texture_rgb.dirty; - if (!device->isInDraw) + texture->texture_ops = texture_ops; + texture->sub_resources = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, + level_count * layer_count * sizeof(*texture->sub_resources)); + if (!texture->sub_resources) + { + ERR("Failed to allocate sub-resource array.\n"); + resource_cleanup(&texture->resource); + return E_OUTOFMEMORY; + } + + texture->layer_count = layer_count; + texture->level_count = level_count; + texture->filter_type = (usage & WINED3DUSAGE_AUTOGENMIPMAP) ? WINED3DTEXF_LINEAR : WINED3DTEXF_NONE; + texture->lod = 0; + texture->texture_rgb.dirty = TRUE; + texture->texture_srgb.dirty = TRUE; + texture->flags = WINED3D_TEXTURE_POW2_MAT_IDENT; + + if (texture->resource.format->flags & WINED3DFMT_FLAG_FILTERING) + { + texture->min_mip_lookup = minMipLookup; + texture->mag_lookup = magLookup; + } + else + { + texture->min_mip_lookup = minMipLookup_noFilter; + texture->mag_lookup = magLookup_noFilter; + } + + return WINED3D_OK; +} + +/* A GL context is provided by the caller */ +static void gltexture_delete(struct gl_texture *tex) +{ + ENTER_GL(); + glDeleteTextures(1, &tex->name); + LEAVE_GL(); + tex->name = 0; +} + +static void wined3d_texture_unload(struct wined3d_texture *texture) +{ + struct wined3d_device *device = texture->resource.device; + struct wined3d_context *context = NULL; + + if (texture->texture_rgb.name || texture->texture_srgb.name) { - /* context_acquire() sets isInDraw to TRUE when loading a pbuffer into a texture, - * thus no danger of recursive calls. */ context = context_acquire(device, NULL); } - if (This->resource.format->id == WINED3DFMT_P8_UINT - || This->resource.format->id == WINED3DFMT_P8_UINT_A8_UNORM) + if (texture->texture_rgb.name) + gltexture_delete(&texture->texture_rgb); + + if (texture->texture_srgb.name) + gltexture_delete(&texture->texture_srgb); + + if (context) context_release(context); + + wined3d_texture_set_dirty(texture, TRUE); + + resource_unload(&texture->resource); +} + +static void wined3d_texture_cleanup(struct wined3d_texture *texture) +{ + UINT sub_count = texture->level_count * texture->layer_count; + UINT i; + + TRACE("texture %p.\n", texture); + + for (i = 0; i < sub_count; ++i) { - for (i = 0; i < This->baseTexture.level_count; ++i) - { - IWineD3DSurfaceImpl *surface = (IWineD3DSurfaceImpl *)This->baseTexture.sub_resources[i]; - if (palette9_changed(surface)) - { - TRACE("Reloading surface because the d3d8/9 palette was changed.\n"); - /* TODO: This is not necessarily needed with hw palettized texture support. */ - surface_load_location(surface, SFLAG_INSYSMEM, NULL); - /* Make sure the texture is reloaded because of the palette change, this kills performance though :( */ - surface_modify_location(surface, SFLAG_INTEXTURE, FALSE); - } - } + struct wined3d_resource *sub_resource = texture->sub_resources[i]; + + if (sub_resource) + texture->texture_ops->texture_sub_resource_cleanup(sub_resource); } - /* If the texture is marked dirty or the srgb sampler setting has changed - * since the last load then reload the surfaces. */ - if (*dirty) + wined3d_texture_unload(texture); + HeapFree(GetProcessHeap(), 0, texture->sub_resources); + resource_cleanup(&texture->resource); +} + +void wined3d_texture_set_dirty(struct wined3d_texture *texture, BOOL dirty) +{ + texture->texture_rgb.dirty = dirty; + texture->texture_srgb.dirty = dirty; +} + +/* Context activation is done by the caller. */ +static HRESULT wined3d_texture_bind(struct wined3d_texture *texture, + const struct wined3d_gl_info *gl_info, BOOL srgb, BOOL *set_surface_desc) +{ + struct gl_texture *gl_tex; + BOOL new_texture = FALSE; + HRESULT hr = WINED3D_OK; + GLenum target; + + TRACE("texture %p, srgb %#x, set_surface_desc %p.\n", texture, srgb, set_surface_desc); + + /* sRGB mode cache for preload() calls outside drawprim. */ + if (srgb) + texture->flags |= WINED3D_TEXTURE_IS_SRGB; + else + texture->flags &= ~WINED3D_TEXTURE_IS_SRGB; + + gl_tex = wined3d_texture_get_gl_texture(texture, gl_info, srgb); + target = texture->target; + + ENTER_GL(); + /* Generate a texture name if we don't already have one. */ + if (!gl_tex->name) { - for (i = 0; i < This->baseTexture.level_count; ++i) + *set_surface_desc = TRUE; + glGenTextures(1, &gl_tex->name); + checkGLcall("glGenTextures"); + TRACE("Generated texture %d.\n", gl_tex->name); + if (texture->resource.pool == WINED3DPOOL_DEFAULT) { - IWineD3DSurface_LoadTexture((IWineD3DSurface *)This->baseTexture.sub_resources[i], srgb_mode); + /* Tell OpenGL to try and keep this texture in video ram (well mostly). */ + GLclampf tmp = 0.9f; + glPrioritizeTextures(1, &gl_tex->name, &tmp); + } + /* Initialise the state of the texture object to the OpenGL defaults, + * not the D3D defaults. */ + gl_tex->states[WINED3DTEXSTA_ADDRESSU] = WINED3DTADDRESS_WRAP; + gl_tex->states[WINED3DTEXSTA_ADDRESSV] = WINED3DTADDRESS_WRAP; + gl_tex->states[WINED3DTEXSTA_ADDRESSW] = WINED3DTADDRESS_WRAP; + gl_tex->states[WINED3DTEXSTA_BORDERCOLOR] = 0; + gl_tex->states[WINED3DTEXSTA_MAGFILTER] = WINED3DTEXF_LINEAR; + gl_tex->states[WINED3DTEXSTA_MINFILTER] = WINED3DTEXF_POINT; /* GL_NEAREST_MIPMAP_LINEAR */ + gl_tex->states[WINED3DTEXSTA_MIPFILTER] = WINED3DTEXF_LINEAR; /* GL_NEAREST_MIPMAP_LINEAR */ + gl_tex->states[WINED3DTEXSTA_MAXMIPLEVEL] = 0; + gl_tex->states[WINED3DTEXSTA_MAXANISOTROPY] = 1; + if (gl_info->supported[EXT_TEXTURE_SRGB_DECODE]) + gl_tex->states[WINED3DTEXSTA_SRGBTEXTURE] = TRUE; + else + gl_tex->states[WINED3DTEXSTA_SRGBTEXTURE] = srgb; + gl_tex->states[WINED3DTEXSTA_SHADOW] = FALSE; + wined3d_texture_set_dirty(texture, TRUE); + new_texture = TRUE; + + if (texture->resource.usage & WINED3DUSAGE_AUTOGENMIPMAP) + { + /* This means double binding the texture at creation, but keeps + * the code simpler all in all, and the run-time path free from + * additional checks. */ + glBindTexture(target, gl_tex->name); + checkGLcall("glBindTexture"); + glTexParameteri(target, GL_GENERATE_MIPMAP_SGIS, GL_TRUE); + checkGLcall("glTexParameteri(target, GL_GENERATE_MIPMAP_SGIS, GL_TRUE)"); } } else { - TRACE("(%p) Texture not dirty, nothing to do.\n", iface); + *set_surface_desc = FALSE; } - if (context) context_release(context); + if (gl_tex->name) + { + glBindTexture(target, gl_tex->name); + checkGLcall("glBindTexture"); + if (new_texture) + { + /* For a new texture we have to set the texture levels after + * binding the texture. Beware that texture rectangles do not + * support mipmapping, but set the maxmiplevel if we're relying + * on the partial GL_ARB_texture_non_power_of_two emulation with + * texture rectangles. (I.e., do not care about cond_np2 here, + * just look for GL_TEXTURE_RECTANGLE_ARB.) */ + if (target != GL_TEXTURE_RECTANGLE_ARB) + { + TRACE("Setting GL_TEXTURE_MAX_LEVEL to %u.\n", texture->level_count - 1); + glTexParameteri(target, GL_TEXTURE_MAX_LEVEL, texture->level_count - 1); + checkGLcall("glTexParameteri(target, GL_TEXTURE_MAX_LEVEL, texture->level_count)"); + } + if (target == GL_TEXTURE_CUBE_MAP_ARB) + { + /* Cubemaps are always set to clamp, regardless of the sampler state. */ + glTexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glTexParameteri(target, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE); + } + } + } + else + { + ERR("This texture doesn't have an OpenGL texture assigned to it.\n"); + hr = WINED3DERR_INVALIDCALL; + } - /* No longer dirty. */ - *dirty = FALSE; + LEAVE_GL(); + return hr; } -static void texture_cleanup(IWineD3DTextureImpl *This) +/* GL locking is done by the caller */ +static void apply_wrap(const struct wined3d_gl_info *gl_info, GLenum target, + WINED3DTEXTUREADDRESS d3d_wrap, GLenum param, BOOL cond_np2) { - unsigned int i; + GLint gl_wrap; - TRACE("(%p) : Cleaning up\n", This); - - for (i = 0; i < This->baseTexture.level_count; ++i) + if (d3d_wrap < WINED3DTADDRESS_WRAP || d3d_wrap > WINED3DTADDRESS_MIRRORONCE) { - IWineD3DSurfaceImpl *surface = (IWineD3DSurfaceImpl *)This->baseTexture.sub_resources[i]; - if (surface) + FIXME("Unrecognized or unsupported WINED3DTEXTUREADDRESS %#x.\n", d3d_wrap); + return; + } + + /* Cubemaps are always set to clamp, regardless of the sampler state. */ + if (target == GL_TEXTURE_CUBE_MAP_ARB + || (cond_np2 && d3d_wrap == WINED3DTADDRESS_WRAP)) + gl_wrap = GL_CLAMP_TO_EDGE; + else + gl_wrap = gl_info->wrap_lookup[d3d_wrap - WINED3DTADDRESS_WRAP]; + + TRACE("Setting param %#x to %#x for target %#x.\n", param, gl_wrap, target); + glTexParameteri(target, param, gl_wrap); + checkGLcall("glTexParameteri(target, param, gl_wrap)"); +} + +/* GL locking is done by the caller (state handler) */ +void wined3d_texture_apply_state_changes(struct wined3d_texture *texture, + const DWORD sampler_states[WINED3D_HIGHEST_SAMPLER_STATE + 1], + const struct wined3d_gl_info *gl_info) +{ + BOOL cond_np2 = texture->flags & WINED3D_TEXTURE_COND_NP2; + GLenum target = texture->target; + struct gl_texture *gl_tex; + DWORD state; + DWORD aniso; + + TRACE("texture %p, sampler_states %p.\n", texture, sampler_states); + + gl_tex = wined3d_texture_get_gl_texture(texture, gl_info, + texture->flags & WINED3D_TEXTURE_IS_SRGB); + + /* This function relies on the correct texture being bound and loaded. */ + + if (sampler_states[WINED3DSAMP_ADDRESSU] != gl_tex->states[WINED3DTEXSTA_ADDRESSU]) + { + state = sampler_states[WINED3DSAMP_ADDRESSU]; + apply_wrap(gl_info, target, state, GL_TEXTURE_WRAP_S, cond_np2); + gl_tex->states[WINED3DTEXSTA_ADDRESSU] = state; + } + + if (sampler_states[WINED3DSAMP_ADDRESSV] != gl_tex->states[WINED3DTEXSTA_ADDRESSV]) + { + state = sampler_states[WINED3DSAMP_ADDRESSV]; + apply_wrap(gl_info, target, state, GL_TEXTURE_WRAP_T, cond_np2); + gl_tex->states[WINED3DTEXSTA_ADDRESSV] = state; + } + + if (sampler_states[WINED3DSAMP_ADDRESSW] != gl_tex->states[WINED3DTEXSTA_ADDRESSW]) + { + state = sampler_states[WINED3DSAMP_ADDRESSW]; + apply_wrap(gl_info, target, state, GL_TEXTURE_WRAP_R, cond_np2); + gl_tex->states[WINED3DTEXSTA_ADDRESSW] = state; + } + + if (sampler_states[WINED3DSAMP_BORDERCOLOR] != gl_tex->states[WINED3DTEXSTA_BORDERCOLOR]) + { + float col[4]; + + state = sampler_states[WINED3DSAMP_BORDERCOLOR]; + D3DCOLORTOGLFLOAT4(state, col); + TRACE("Setting border color for %#x to %#x.\n", target, state); + glTexParameterfv(target, GL_TEXTURE_BORDER_COLOR, &col[0]); + checkGLcall("glTexParameterfv(..., GL_TEXTURE_BORDER_COLOR, ...)"); + gl_tex->states[WINED3DTEXSTA_BORDERCOLOR] = state; + } + + if (sampler_states[WINED3DSAMP_MAGFILTER] != gl_tex->states[WINED3DTEXSTA_MAGFILTER]) + { + GLint gl_value; + + state = sampler_states[WINED3DSAMP_MAGFILTER]; + if (state > WINED3DTEXF_ANISOTROPIC) + FIXME("Unrecognized or unsupported MAGFILTER* value %d.\n", state); + + gl_value = wined3d_gl_mag_filter(texture->mag_lookup, + min(max(state, WINED3DTEXF_POINT), WINED3DTEXF_LINEAR)); + TRACE("ValueMAG=%#x setting MAGFILTER to %#x.\n", state, gl_value); + glTexParameteri(target, GL_TEXTURE_MAG_FILTER, gl_value); + + gl_tex->states[WINED3DTEXSTA_MAGFILTER] = state; + } + + if ((sampler_states[WINED3DSAMP_MINFILTER] != gl_tex->states[WINED3DTEXSTA_MINFILTER] + || sampler_states[WINED3DSAMP_MIPFILTER] != gl_tex->states[WINED3DTEXSTA_MIPFILTER] + || sampler_states[WINED3DSAMP_MAXMIPLEVEL] != gl_tex->states[WINED3DTEXSTA_MAXMIPLEVEL])) + { + GLint gl_value; + + gl_tex->states[WINED3DTEXSTA_MIPFILTER] = sampler_states[WINED3DSAMP_MIPFILTER]; + gl_tex->states[WINED3DTEXSTA_MINFILTER] = sampler_states[WINED3DSAMP_MINFILTER]; + gl_tex->states[WINED3DTEXSTA_MAXMIPLEVEL] = sampler_states[WINED3DSAMP_MAXMIPLEVEL]; + + if (gl_tex->states[WINED3DTEXSTA_MINFILTER] > WINED3DTEXF_ANISOTROPIC + || gl_tex->states[WINED3DTEXSTA_MIPFILTER] > WINED3DTEXF_ANISOTROPIC) { - /* Clean out the texture name we gave to the surface so that the - * surface doesn't try and release it */ - surface_set_texture_name(surface, 0, TRUE); - surface_set_texture_name(surface, 0, FALSE); - surface_set_texture_target(surface, 0); - surface_set_container(surface, WINED3D_CONTAINER_NONE, NULL); - IWineD3DSurface_Release((IWineD3DSurface *)surface); + FIXME("Unrecognized or unsupported D3DSAMP_MINFILTER value %#x D3DSAMP_MIPFILTER value %#x.\n", + gl_tex->states[WINED3DTEXSTA_MINFILTER], + gl_tex->states[WINED3DTEXSTA_MIPFILTER]); + } + gl_value = wined3d_gl_min_mip_filter(texture->min_mip_lookup, + min(max(sampler_states[WINED3DSAMP_MINFILTER], WINED3DTEXF_POINT), WINED3DTEXF_LINEAR), + min(max(sampler_states[WINED3DSAMP_MIPFILTER], WINED3DTEXF_NONE), WINED3DTEXF_LINEAR)); + + TRACE("ValueMIN=%#x, ValueMIP=%#x, setting MINFILTER to %#x.\n", + sampler_states[WINED3DSAMP_MINFILTER], + sampler_states[WINED3DSAMP_MIPFILTER], gl_value); + glTexParameteri(target, GL_TEXTURE_MIN_FILTER, gl_value); + checkGLcall("glTexParameter GL_TEXTURE_MIN_FILTER, ..."); + + if (!cond_np2) + { + if (gl_tex->states[WINED3DTEXSTA_MIPFILTER] == WINED3DTEXF_NONE) + gl_value = texture->lod; + else if (gl_tex->states[WINED3DTEXSTA_MAXMIPLEVEL] >= texture->level_count) + gl_value = texture->level_count - 1; + else if (gl_tex->states[WINED3DTEXSTA_MAXMIPLEVEL] < texture->lod) + /* texture->lod is already clamped in the setter. */ + gl_value = texture->lod; + else + gl_value = gl_tex->states[WINED3DTEXSTA_MAXMIPLEVEL]; + + /* Note that WINED3DSAMP_MAXMIPLEVEL specifies the largest mipmap + * (default 0), while GL_TEXTURE_MAX_LEVEL specifies the smallest + * mimap used (default 1000). So WINED3DSAMP_MAXMIPLEVEL + * corresponds to GL_TEXTURE_BASE_LEVEL. */ + glTexParameteri(target, GL_TEXTURE_BASE_LEVEL, gl_value); } } - TRACE("(%p) : Cleaning up base texture\n", This); - basetexture_cleanup((IWineD3DBaseTexture *)This); -} + if ((gl_tex->states[WINED3DTEXSTA_MAGFILTER] != WINED3DTEXF_ANISOTROPIC + && gl_tex->states[WINED3DTEXSTA_MINFILTER] != WINED3DTEXF_ANISOTROPIC + && gl_tex->states[WINED3DTEXSTA_MIPFILTER] != WINED3DTEXF_ANISOTROPIC) + || cond_np2) + aniso = 1; + else + aniso = sampler_states[WINED3DSAMP_MAXANISOTROPY]; -/* ******************************************* - IWineD3DTexture IUnknown parts follow - ******************************************* */ - -static HRESULT WINAPI IWineD3DTextureImpl_QueryInterface(IWineD3DTexture *iface, REFIID riid, LPVOID *ppobj) -{ - IWineD3DTextureImpl *This = (IWineD3DTextureImpl *)iface; - TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(riid),ppobj); - if (IsEqualGUID(riid, &IID_IUnknown) - || IsEqualGUID(riid, &IID_IWineD3DBase) - || IsEqualGUID(riid, &IID_IWineD3DResource) - || IsEqualGUID(riid, &IID_IWineD3DBaseTexture) - || IsEqualGUID(riid, &IID_IWineD3DTexture)){ - IUnknown_AddRef(iface); - *ppobj = This; - return WINED3D_OK; - } - *ppobj = NULL; - return E_NOINTERFACE; -} - -static ULONG WINAPI IWineD3DTextureImpl_AddRef(IWineD3DTexture *iface) { - IWineD3DTextureImpl *This = (IWineD3DTextureImpl *)iface; - TRACE("(%p) : AddRef increasing from %d\n", This, This->resource.ref); - return InterlockedIncrement(&This->resource.ref); -} - -/* Do not call while under the GL lock. */ -static ULONG WINAPI IWineD3DTextureImpl_Release(IWineD3DTexture *iface) { - IWineD3DTextureImpl *This = (IWineD3DTextureImpl *)iface; - ULONG ref; - TRACE("(%p) : Releasing from %d\n", This, This->resource.ref); - ref = InterlockedDecrement(&This->resource.ref); - if (!ref) + if (gl_tex->states[WINED3DTEXSTA_MAXANISOTROPY] != aniso) { - texture_cleanup(This); - This->resource.parent_ops->wined3d_object_destroyed(This->resource.parent); - HeapFree(GetProcessHeap(), 0, This); + if (gl_info->supported[EXT_TEXTURE_FILTER_ANISOTROPIC]) + { + glTexParameteri(target, GL_TEXTURE_MAX_ANISOTROPY_EXT, aniso); + checkGLcall("glTexParameteri(GL_TEXTURE_MAX_ANISOTROPY_EXT, aniso)"); + } + else + { + WARN("Anisotropic filtering not supported.\n"); + } + gl_tex->states[WINED3DTEXSTA_MAXANISOTROPY] = aniso; } - return ref; -} - -/* **************************************************** - IWineD3DTexture IWineD3DResource parts follow - **************************************************** */ -static HRESULT WINAPI IWineD3DTextureImpl_SetPrivateData(IWineD3DTexture *iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) { - return resource_set_private_data((IWineD3DResource *)iface, refguid, pData, SizeOfData, Flags); -} - -static HRESULT WINAPI IWineD3DTextureImpl_GetPrivateData(IWineD3DTexture *iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) { - return resource_get_private_data((IWineD3DResource *)iface, refguid, pData, pSizeOfData); -} - -static HRESULT WINAPI IWineD3DTextureImpl_FreePrivateData(IWineD3DTexture *iface, REFGUID refguid) { - return resource_free_private_data((IWineD3DResource *)iface, refguid); -} - -static DWORD WINAPI IWineD3DTextureImpl_SetPriority(IWineD3DTexture *iface, DWORD PriorityNew) { - return resource_set_priority((IWineD3DResource *)iface, PriorityNew); -} - -static DWORD WINAPI IWineD3DTextureImpl_GetPriority(IWineD3DTexture *iface) { - return resource_get_priority((IWineD3DResource *)iface); -} - -/* Do not call while under the GL lock. */ -static void WINAPI IWineD3DTextureImpl_PreLoad(IWineD3DTexture *iface) { - texture_internal_preload((IWineD3DBaseTexture *) iface, SRGB_ANY); -} - -/* Do not call while under the GL lock. */ -static void WINAPI IWineD3DTextureImpl_UnLoad(IWineD3DTexture *iface) { - unsigned int i; - IWineD3DTextureImpl *This = (IWineD3DTextureImpl *)iface; - TRACE("(%p)\n", This); - - /* Unload all the surfaces and reset the texture name. If UnLoad was called on the - * surface before, this one will be a NOP and vice versa. Unloading an unloaded - * surface is fine - */ - for (i = 0; i < This->baseTexture.level_count; ++i) + /* These should always be the same unless EXT_texture_sRGB_decode is supported. */ + if (sampler_states[WINED3DSAMP_SRGBTEXTURE] != gl_tex->states[WINED3DTEXSTA_SRGBTEXTURE]) { - IWineD3DSurfaceImpl *surface = (IWineD3DSurfaceImpl *)This->baseTexture.sub_resources[i]; - IWineD3DSurface_UnLoad((IWineD3DSurface *)surface); - surface_set_texture_name(surface, 0, FALSE); /* Delete rgb name */ - surface_set_texture_name(surface, 0, TRUE); /* delete srgb name */ + glTexParameteri(target, GL_TEXTURE_SRGB_DECODE_EXT, + sampler_states[WINED3DSAMP_SRGBTEXTURE] ? GL_DECODE_EXT : GL_SKIP_DECODE_EXT); + checkGLcall("glTexParameteri(GL_TEXTURE_SRGB_DECODE_EXT)"); } - basetexture_unload((IWineD3DBaseTexture *)iface); + if (!(texture->resource.format->flags & WINED3DFMT_FLAG_SHADOW) + != !gl_tex->states[WINED3DTEXSTA_SHADOW]) + { + if (texture->resource.format->flags & WINED3DFMT_FLAG_SHADOW) + { + glTexParameteri(target, GL_DEPTH_TEXTURE_MODE_ARB, GL_LUMINANCE); + glTexParameteri(target, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE_ARB); + checkGLcall("glTexParameteri(target, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE_ARB)"); + gl_tex->states[WINED3DTEXSTA_SHADOW] = TRUE; + } + else + { + glTexParameteri(target, GL_TEXTURE_COMPARE_MODE_ARB, GL_NONE); + checkGLcall("glTexParameteri(target, GL_TEXTURE_COMPARE_MODE_ARB, GL_NONE)"); + gl_tex->states[WINED3DTEXSTA_SHADOW] = FALSE; + } + } } -static WINED3DRESOURCETYPE WINAPI IWineD3DTextureImpl_GetType(IWineD3DTexture *iface) { - return resource_get_type((IWineD3DResource *)iface); -} - -static void * WINAPI IWineD3DTextureImpl_GetParent(IWineD3DTexture *iface) +ULONG CDECL wined3d_texture_incref(struct wined3d_texture *texture) { - TRACE("iface %p.\n", iface); + ULONG refcount = InterlockedIncrement(&texture->resource.ref); - return ((IWineD3DTextureImpl *)iface)->resource.parent; + TRACE("%p increasing refcount to %u.\n", texture, refcount); + + return refcount; } -/* ****************************************************** - IWineD3DTexture IWineD3DBaseTexture parts follow - ****************************************************** */ -static DWORD WINAPI IWineD3DTextureImpl_SetLOD(IWineD3DTexture *iface, DWORD LODNew) { - return basetexture_set_lod((IWineD3DBaseTexture *)iface, LODNew); +/* Do not call while under the GL lock. */ +ULONG CDECL wined3d_texture_decref(struct wined3d_texture *texture) +{ + ULONG refcount = InterlockedDecrement(&texture->resource.ref); + + TRACE("%p decreasing refcount to %u.\n", texture, refcount); + + if (!refcount) + { + wined3d_texture_cleanup(texture); + texture->resource.parent_ops->wined3d_object_destroyed(texture->resource.parent); + HeapFree(GetProcessHeap(), 0, texture); + } + + return refcount; } -static DWORD WINAPI IWineD3DTextureImpl_GetLOD(IWineD3DTexture *iface) { - return basetexture_get_lod((IWineD3DBaseTexture *)iface); +HRESULT CDECL wined3d_texture_set_private_data(struct wined3d_texture *texture, + REFGUID guid, const void *data, DWORD data_size, DWORD flags) +{ + return resource_set_private_data(&texture->resource, guid, data, data_size, flags); } -static DWORD WINAPI IWineD3DTextureImpl_GetLevelCount(IWineD3DTexture *iface) { - return basetexture_get_level_count((IWineD3DBaseTexture *)iface); +HRESULT CDECL wined3d_texture_get_private_data(const struct wined3d_texture *texture, + REFGUID guid, void *data, DWORD *data_size) +{ + return resource_get_private_data(&texture->resource, guid, data, data_size); } -static HRESULT WINAPI IWineD3DTextureImpl_SetAutoGenFilterType(IWineD3DTexture *iface, WINED3DTEXTUREFILTERTYPE FilterType) { - return basetexture_set_autogen_filter_type((IWineD3DBaseTexture *)iface, FilterType); +HRESULT CDECL wined3d_texture_free_private_data(struct wined3d_texture *texture, REFGUID guid) +{ + return resource_free_private_data(&texture->resource, guid); } -static WINED3DTEXTUREFILTERTYPE WINAPI IWineD3DTextureImpl_GetAutoGenFilterType(IWineD3DTexture *iface) { - return basetexture_get_autogen_filter_type((IWineD3DBaseTexture *)iface); +DWORD CDECL wined3d_texture_set_priority(struct wined3d_texture *texture, DWORD priority) +{ + return resource_set_priority(&texture->resource, priority); } -static void WINAPI IWineD3DTextureImpl_GenerateMipSubLevels(IWineD3DTexture *iface) { - basetexture_generate_mipmaps((IWineD3DBaseTexture *)iface); +DWORD CDECL wined3d_texture_get_priority(const struct wined3d_texture *texture) +{ + return resource_get_priority(&texture->resource); } -/* Internal function, No d3d mapping */ -static BOOL WINAPI IWineD3DTextureImpl_SetDirty(IWineD3DTexture *iface, BOOL dirty) { - return basetexture_set_dirty((IWineD3DBaseTexture *)iface, dirty); +/* Do not call while under the GL lock. */ +void CDECL wined3d_texture_preload(struct wined3d_texture *texture) +{ + texture->texture_ops->texture_preload(texture, SRGB_ANY); } -static BOOL WINAPI IWineD3DTextureImpl_GetDirty(IWineD3DTexture *iface) { - return basetexture_get_dirty((IWineD3DBaseTexture *)iface); +WINED3DRESOURCETYPE CDECL wined3d_texture_get_type(const struct wined3d_texture *texture) +{ + TRACE("texture %p.\n", texture); + + return texture->resource.resourceType; +} + +void * CDECL wined3d_texture_get_parent(const struct wined3d_texture *texture) +{ + TRACE("texture %p.\n", texture); + + return texture->resource.parent; +} + +DWORD CDECL wined3d_texture_set_lod(struct wined3d_texture *texture, DWORD lod) +{ + DWORD old = texture->lod; + + TRACE("texture %p, lod %u.\n", texture, lod); + + /* The d3d9:texture test shows that SetLOD is ignored on non-managed + * textures. The call always returns 0, and GetLOD always returns 0. */ + if (texture->resource.pool != WINED3DPOOL_MANAGED) + { + TRACE("Ignoring SetLOD on %s texture, returning 0.\n", debug_d3dpool(texture->resource.pool)); + return 0; + } + + if (lod >= texture->level_count) + lod = texture->level_count - 1; + + if (texture->lod != lod) + { + texture->lod = lod; + + texture->texture_rgb.states[WINED3DTEXSTA_MAXMIPLEVEL] = ~0U; + texture->texture_srgb.states[WINED3DTEXSTA_MAXMIPLEVEL] = ~0U; + if (texture->bind_count) + IWineD3DDeviceImpl_MarkStateDirty(texture->resource.device, STATE_SAMPLER(texture->sampler)); + } + + return old; +} + +DWORD CDECL wined3d_texture_get_lod(const struct wined3d_texture *texture) +{ + TRACE("texture %p, returning %u.\n", texture, texture->lod); + + return texture->lod; +} + +DWORD CDECL wined3d_texture_get_level_count(const struct wined3d_texture *texture) +{ + TRACE("texture %p, returning %u.\n", texture, texture->level_count); + + return texture->level_count; +} + +HRESULT CDECL wined3d_texture_set_autogen_filter_type(struct wined3d_texture *texture, + WINED3DTEXTUREFILTERTYPE filter_type) +{ + FIXME("texture %p, filter_type %s stub!\n", texture, debug_d3dtexturefiltertype(filter_type)); + + if (!(texture->resource.usage & WINED3DUSAGE_AUTOGENMIPMAP)) + { + WARN("Texture doesn't have AUTOGENMIPMAP usage.\n"); + return WINED3DERR_INVALIDCALL; + } + + texture->filter_type = filter_type; + + return WINED3D_OK; +} + +WINED3DTEXTUREFILTERTYPE CDECL wined3d_texture_get_autogen_filter_type(const struct wined3d_texture *texture) +{ + TRACE("texture %p.\n", texture); + + return texture->filter_type; +} + +void CDECL wined3d_texture_generate_mipmaps(struct wined3d_texture *texture) +{ + /* TODO: Implement filters using GL_SGI_generate_mipmaps. */ + FIXME("texture %p stub!\n", texture); +} + +struct wined3d_resource * CDECL wined3d_texture_get_sub_resource(struct wined3d_texture *texture, + UINT sub_resource_idx) +{ + UINT sub_count = texture->level_count * texture->layer_count; + + TRACE("texture %p, sub_resource_idx %u.\n", texture, sub_resource_idx); + + if (sub_resource_idx >= sub_count) + { + WARN("sub_resource_idx %u >= sub_count %u.\n", sub_resource_idx, sub_count); + return NULL; + } + + return texture->sub_resources[sub_resource_idx]; +} + +HRESULT CDECL wined3d_texture_add_dirty_region(struct wined3d_texture *texture, + UINT layer, const WINED3DBOX *dirty_region) +{ + struct wined3d_resource *sub_resource; + + TRACE("texture %p, layer %u, dirty_region %p.\n", texture, layer, dirty_region); + + if (!(sub_resource = wined3d_texture_get_sub_resource(texture, layer * texture->level_count))) + { + WARN("Failed to get sub-resource.\n"); + return WINED3DERR_INVALIDCALL; + } + + wined3d_texture_set_dirty(texture, TRUE); + texture->texture_ops->texture_sub_resource_add_dirty_region(sub_resource, dirty_region); + + return WINED3D_OK; } /* Context activation is done by the caller. */ -static HRESULT WINAPI IWineD3DTextureImpl_BindTexture(IWineD3DTexture *iface, BOOL srgb) { - IWineD3DTextureImpl *This = (IWineD3DTextureImpl *)iface; +static HRESULT texture2d_bind(struct wined3d_texture *texture, + const struct wined3d_gl_info *gl_info, BOOL srgb) +{ BOOL set_gl_texture_desc; HRESULT hr; - TRACE("(%p) : relay to BaseTexture\n", This); + TRACE("texture %p, gl_info %p, srgb %#x.\n", texture, gl_info, srgb); - hr = basetexture_bind((IWineD3DBaseTexture *)iface, srgb, &set_gl_texture_desc); - if (set_gl_texture_desc && SUCCEEDED(hr)) { - UINT i; + hr = wined3d_texture_bind(texture, gl_info, srgb, &set_gl_texture_desc); + if (set_gl_texture_desc && SUCCEEDED(hr)) + { + UINT sub_count = texture->level_count * texture->layer_count; + BOOL srgb_tex = !gl_info->supported[EXT_TEXTURE_SRGB_DECODE] + && (texture->flags & WINED3D_TEXTURE_IS_SRGB); struct gl_texture *gl_tex; + UINT i; - if(This->baseTexture.is_srgb) { - gl_tex = &This->baseTexture.texture_srgb; - } else { - gl_tex = &This->baseTexture.texture_rgb; - } + gl_tex = wined3d_texture_get_gl_texture(texture, gl_info, srgb_tex); - for (i = 0; i < This->baseTexture.level_count; ++i) + for (i = 0; i < sub_count; ++i) { - IWineD3DSurfaceImpl *surface = (IWineD3DSurfaceImpl *)This->baseTexture.sub_resources[i]; - surface_set_texture_name(surface, gl_tex->name, This->baseTexture.is_srgb); + struct wined3d_surface *surface = surface_from_resource(texture->sub_resources[i]); + surface_set_texture_name(surface, gl_tex->name, srgb_tex); } /* Conditinal non power of two textures use a different clamping @@ -301,9 +639,9 @@ static HRESULT WINAPI IWineD3DTextureImpl_BindTexture(IWineD3DTexture *iface, BO * state. The same applies to filtering. Even if the texture has only * one mip level, the default LINEAR_MIPMAP_LINEAR filter causes a SW * fallback on macos. */ - if (IWineD3DBaseTexture_IsCondNP2(iface)) + if (texture->flags & WINED3D_TEXTURE_COND_NP2) { - GLenum target = This->baseTexture.target; + GLenum target = texture->target; ENTER_GL(); glTexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); @@ -326,147 +664,257 @@ static HRESULT WINAPI IWineD3DTextureImpl_BindTexture(IWineD3DTexture *iface, BO return hr; } -static BOOL WINAPI IWineD3DTextureImpl_IsCondNP2(IWineD3DTexture *iface) { - IWineD3DTextureImpl *This = (IWineD3DTextureImpl *)iface; - TRACE("(%p)\n", This); +static BOOL texture_srgb_mode(struct wined3d_texture *texture, enum WINED3DSRGB srgb) +{ + switch (srgb) + { + case SRGB_RGB: + return FALSE; - return This->cond_np2; + case SRGB_SRGB: + return TRUE; + + default: + return texture->flags & WINED3D_TEXTURE_IS_SRGB; + } } -/* ******************************************* - IWineD3DTexture IWineD3DTexture parts follow - ******************************************* */ -static HRESULT WINAPI IWineD3DTextureImpl_GetLevelDesc(IWineD3DTexture *iface, UINT level, WINED3DSURFACE_DESC *desc) +/* Do not call while under the GL lock. */ +static void texture2d_preload(struct wined3d_texture *texture, enum WINED3DSRGB srgb) { - IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)iface; - IWineD3DSurface *surface; + UINT sub_count = texture->level_count * texture->layer_count; + struct wined3d_device *device = texture->resource.device; + const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; + struct wined3d_context *context = NULL; + struct gl_texture *gl_tex; + BOOL srgb_mode; + UINT i; - TRACE("iface %p, level %u, desc %p.\n", iface, level, desc); + TRACE("texture %p, srgb %#x.\n", texture, srgb); - if (!(surface = (IWineD3DSurface *)basetexture_get_sub_resource(texture, 0, level))) + srgb_mode = texture_srgb_mode(texture, srgb); + gl_tex = wined3d_texture_get_gl_texture(texture, gl_info, srgb_mode); + + if (!device->isInDraw) { - WARN("Failed to get sub-resource.\n"); - return WINED3DERR_INVALIDCALL; + /* No danger of recursive calls, context_acquire() sets isInDraw to TRUE + * when loading offscreen render targets into the texture. */ + context = context_acquire(device, NULL); } - IWineD3DSurface_GetDesc(surface, desc); - - return WINED3D_OK; -} - -static HRESULT WINAPI IWineD3DTextureImpl_GetSurfaceLevel(IWineD3DTexture *iface, - UINT level, IWineD3DSurface **surface) -{ - IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)iface; - IWineD3DSurface *s; - - TRACE("iface %p, level %u, surface %p.\n", iface, level, surface); - - if (!(s = (IWineD3DSurface *)basetexture_get_sub_resource(texture, 0, level))) + if (texture->resource.format->id == WINED3DFMT_P8_UINT + || texture->resource.format->id == WINED3DFMT_P8_UINT_A8_UNORM) { - WARN("Failed to get sub-resource.\n"); - return WINED3DERR_INVALIDCALL; + for (i = 0; i < sub_count; ++i) + { + struct wined3d_surface *surface = surface_from_resource(texture->sub_resources[i]); + + if (palette9_changed(surface)) + { + TRACE("Reloading surface %p because the d3d8/9 palette was changed.\n", surface); + /* TODO: This is not necessarily needed with hw palettized texture support. */ + surface_load_location(surface, SFLAG_INSYSMEM, NULL); + /* Make sure the texture is reloaded because of the palette + * change, this kills performance though :( */ + surface_modify_location(surface, SFLAG_INTEXTURE, FALSE); + } + } } - IWineD3DSurface_AddRef(s); - *surface = s; - - TRACE("Returning surface %p.\n", *surface); - - return WINED3D_OK; -} - -static HRESULT WINAPI IWineD3DTextureImpl_LockRect(IWineD3DTexture *iface, - UINT level, WINED3DLOCKED_RECT *locked_rect, const RECT *rect, DWORD flags) -{ - IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)iface; - IWineD3DSurface *surface; - - TRACE("iface %p, level %u, locked_rect %p, rect %s, flags %#x.\n", - iface, level, locked_rect, wine_dbgstr_rect(rect), flags); - - if (!(surface = (IWineD3DSurface *)basetexture_get_sub_resource(texture, 0, level))) + if (gl_tex->dirty) { - WARN("Failed to get sub-resource.\n"); - return WINED3DERR_INVALIDCALL; + /* Reload the surfaces if the texture is marked dirty. */ + for (i = 0; i < sub_count; ++i) + { + surface_load(surface_from_resource(texture->sub_resources[i]), srgb_mode); + } + } + else + { + TRACE("Texture %p not dirty, nothing to do.\n", texture); } - return IWineD3DSurface_LockRect(surface, locked_rect, rect, flags); + /* No longer dirty. */ + gl_tex->dirty = FALSE; + + if (context) context_release(context); } -static HRESULT WINAPI IWineD3DTextureImpl_UnlockRect(IWineD3DTexture *iface, UINT level) +static void texture2d_sub_resource_add_dirty_region(struct wined3d_resource *sub_resource, + const WINED3DBOX *dirty_region) { - IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)iface; - IWineD3DSurface *surface; + surface_add_dirty_rect(surface_from_resource(sub_resource), dirty_region); +} - TRACE("iface %p, level %u.\n", iface, level); +static void texture2d_sub_resource_cleanup(struct wined3d_resource *sub_resource) +{ + struct wined3d_surface *surface = surface_from_resource(sub_resource); - if (!(surface = (IWineD3DSurface *)basetexture_get_sub_resource(texture, 0, level))) + /* Clean out the texture name we gave to the surface so that the + * surface doesn't try and release it. */ + surface_set_texture_name(surface, 0, TRUE); + surface_set_texture_name(surface, 0, FALSE); + surface_set_texture_target(surface, 0); + surface_set_container(surface, WINED3D_CONTAINER_NONE, NULL); + wined3d_surface_decref(surface); +} + +/* Do not call while under the GL lock. */ +static void texture2d_unload(struct wined3d_resource *resource) +{ + struct wined3d_texture *texture = wined3d_texture_from_resource(resource); + UINT sub_count = texture->level_count * texture->layer_count; + UINT i; + + TRACE("texture %p.\n", texture); + + for (i = 0; i < sub_count; ++i) { - WARN("Failed to get sub-resource.\n"); - return WINED3DERR_INVALIDCALL; + struct wined3d_resource *sub_resource = texture->sub_resources[i]; + struct wined3d_surface *surface = surface_from_resource(sub_resource); + + sub_resource->resource_ops->resource_unload(sub_resource); + surface_set_texture_name(surface, 0, FALSE); /* Delete RGB name */ + surface_set_texture_name(surface, 0, TRUE); /* Delete sRGB name */ } - return IWineD3DSurface_UnlockRect(surface); + wined3d_texture_unload(texture); } -static HRESULT WINAPI IWineD3DTextureImpl_AddDirtyRect(IWineD3DTexture *iface, const RECT *dirty_rect) +static const struct wined3d_texture_ops texture2d_ops = { - IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)iface; - IWineD3DSurfaceImpl *surface; - - TRACE("iface %p, dirty_rect %s.\n", iface, wine_dbgstr_rect(dirty_rect)); - - if (!(surface = (IWineD3DSurfaceImpl *)basetexture_get_sub_resource(texture, 0, 0))) - { - WARN("Failed to get sub-resource.\n"); - return WINED3DERR_INVALIDCALL; - } - - texture->baseTexture.texture_rgb.dirty = TRUE; - texture->baseTexture.texture_srgb.dirty = TRUE; - surface_add_dirty_rect(surface, dirty_rect); - - return WINED3D_OK; -} - -static const IWineD3DTextureVtbl IWineD3DTexture_Vtbl = -{ - /* IUnknown */ - IWineD3DTextureImpl_QueryInterface, - IWineD3DTextureImpl_AddRef, - IWineD3DTextureImpl_Release, - /* IWineD3DResource */ - IWineD3DTextureImpl_GetParent, - IWineD3DTextureImpl_SetPrivateData, - IWineD3DTextureImpl_GetPrivateData, - IWineD3DTextureImpl_FreePrivateData, - IWineD3DTextureImpl_SetPriority, - IWineD3DTextureImpl_GetPriority, - IWineD3DTextureImpl_PreLoad, - IWineD3DTextureImpl_UnLoad, - IWineD3DTextureImpl_GetType, - /* IWineD3DBaseTexture */ - IWineD3DTextureImpl_SetLOD, - IWineD3DTextureImpl_GetLOD, - IWineD3DTextureImpl_GetLevelCount, - IWineD3DTextureImpl_SetAutoGenFilterType, - IWineD3DTextureImpl_GetAutoGenFilterType, - IWineD3DTextureImpl_GenerateMipSubLevels, - IWineD3DTextureImpl_SetDirty, - IWineD3DTextureImpl_GetDirty, - IWineD3DTextureImpl_BindTexture, - IWineD3DTextureImpl_IsCondNP2, - /* IWineD3DTexture */ - IWineD3DTextureImpl_GetLevelDesc, - IWineD3DTextureImpl_GetSurfaceLevel, - IWineD3DTextureImpl_LockRect, - IWineD3DTextureImpl_UnlockRect, - IWineD3DTextureImpl_AddDirtyRect + texture2d_bind, + texture2d_preload, + texture2d_sub_resource_add_dirty_region, + texture2d_sub_resource_cleanup, }; -HRESULT texture_init(IWineD3DTextureImpl *texture, UINT width, UINT height, UINT levels, - IWineD3DDeviceImpl *device, DWORD usage, enum wined3d_format_id format_id, WINED3DPOOL pool, +static const struct wined3d_resource_ops texture2d_resource_ops = +{ + texture2d_unload, +}; + +static HRESULT cubetexture_init(struct wined3d_texture *texture, UINT edge_length, UINT levels, + struct wined3d_device *device, DWORD usage, enum wined3d_format_id format_id, WINED3DPOOL pool, + void *parent, const struct wined3d_parent_ops *parent_ops) +{ + const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; + const struct wined3d_format *format = wined3d_get_format(gl_info, format_id); + UINT pow2_edge_length; + unsigned int i, j; + UINT tmp_w; + HRESULT hr; + + /* TODO: It should only be possible to create textures for formats + * that are reported as supported. */ + if (WINED3DFMT_UNKNOWN >= format_id) + { + WARN("(%p) : Texture cannot be created with a format of WINED3DFMT_UNKNOWN.\n", texture); + return WINED3DERR_INVALIDCALL; + } + + if (!gl_info->supported[ARB_TEXTURE_CUBE_MAP] && pool != WINED3DPOOL_SCRATCH) + { + WARN("(%p) : Tried to create not supported cube texture.\n", texture); + return WINED3DERR_INVALIDCALL; + } + + /* Calculate levels for mip mapping */ + if (usage & WINED3DUSAGE_AUTOGENMIPMAP) + { + if (!gl_info->supported[SGIS_GENERATE_MIPMAP]) + { + WARN("No mipmap generation support, returning D3DERR_INVALIDCALL.\n"); + return WINED3DERR_INVALIDCALL; + } + + if (levels > 1) + { + WARN("D3DUSAGE_AUTOGENMIPMAP is set, and level count > 1, returning D3DERR_INVALIDCALL.\n"); + return WINED3DERR_INVALIDCALL; + } + + levels = 1; + } + else if (!levels) + { + levels = wined3d_log2i(edge_length) + 1; + TRACE("Calculated levels = %u.\n", levels); + } + + hr = wined3d_texture_init(texture, &texture2d_ops, 6, levels, + WINED3DRTYPE_CUBETEXTURE, device, usage, format, pool, + parent, parent_ops, &texture2d_resource_ops); + if (FAILED(hr)) + { + WARN("Failed to initialize texture, returning %#x\n", hr); + return hr; + } + + /* Find the nearest pow2 match. */ + pow2_edge_length = 1; + while (pow2_edge_length < edge_length) pow2_edge_length <<= 1; + + if (gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO] || (edge_length == pow2_edge_length)) + { + /* Precalculated scaling for 'faked' non power of two texture coords. */ + texture->pow2_matrix[0] = 1.0f; + texture->pow2_matrix[5] = 1.0f; + texture->pow2_matrix[10] = 1.0f; + texture->pow2_matrix[15] = 1.0f; + } + else + { + /* Precalculated scaling for 'faked' non power of two texture coords. */ + texture->pow2_matrix[0] = ((float)edge_length) / ((float)pow2_edge_length); + texture->pow2_matrix[5] = ((float)edge_length) / ((float)pow2_edge_length); + texture->pow2_matrix[10] = ((float)edge_length) / ((float)pow2_edge_length); + texture->pow2_matrix[15] = 1.0f; + texture->flags &= ~WINED3D_TEXTURE_POW2_MAT_IDENT; + } + texture->target = GL_TEXTURE_CUBE_MAP_ARB; + + /* Generate all the surfaces. */ + tmp_w = edge_length; + for (i = 0; i < texture->level_count; ++i) + { + /* Create the 6 faces. */ + for (j = 0; j < 6; ++j) + { + static const GLenum cube_targets[6] = + { + GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB, + GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB, + GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB, + GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB, + GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB, + GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB, + }; + UINT idx = j * texture->level_count + i; + struct wined3d_surface *surface; + + hr = device->device_parent->ops->create_surface(device->device_parent, parent, tmp_w, tmp_w, + format_id, usage, pool, i /* Level */, j, &surface); + if (FAILED(hr)) + { + FIXME("(%p) Failed to create surface, hr %#x.\n", texture, hr); + wined3d_texture_cleanup(texture); + return hr; + } + + surface_set_container(surface, WINED3D_CONTAINER_TEXTURE, texture); + surface_set_texture_target(surface, cube_targets[j]); + texture->sub_resources[idx] = &surface->resource; + TRACE("Created surface level %u @ %p.\n", i, surface); + } + tmp_w = max(1, tmp_w >> 1); + } + + return WINED3D_OK; +} + +static HRESULT texture_init(struct wined3d_texture *texture, UINT width, UINT height, UINT levels, + struct wined3d_device *device, DWORD usage, enum wined3d_format_id format_id, WINED3DPOOL pool, void *parent, const struct wined3d_parent_ops *parent_ops) { const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; @@ -531,13 +979,12 @@ HRESULT texture_init(IWineD3DTextureImpl *texture, UINT width, UINT height, UINT TRACE("Calculated levels = %u.\n", levels); } - texture->lpVtbl = &IWineD3DTexture_Vtbl; - - hr = basetexture_init((IWineD3DBaseTextureImpl *)texture, 1, levels, - WINED3DRTYPE_TEXTURE, device, 0, usage, format, pool, parent, parent_ops); + hr = wined3d_texture_init(texture, &texture2d_ops, 1, levels, + WINED3DRTYPE_TEXTURE, device, usage, format, pool, + parent, parent_ops, &texture2d_resource_ops); if (FAILED(hr)) { - WARN("Failed to initialize basetexture, returning %#x.\n", hr); + WARN("Failed to initialize texture, returning %#x.\n", hr); return hr; } @@ -547,83 +994,395 @@ HRESULT texture_init(IWineD3DTextureImpl *texture, UINT width, UINT height, UINT * doesn't work in combination with ARB_TEXTURE_RECTANGLE. */ if (gl_info->supported[WINED3D_GL_NORMALIZED_TEXRECT] && (width != pow2_width || height != pow2_height)) { - texture->baseTexture.pow2Matrix[0] = 1.0f; - texture->baseTexture.pow2Matrix[5] = 1.0f; - texture->baseTexture.pow2Matrix[10] = 1.0f; - texture->baseTexture.pow2Matrix[15] = 1.0f; - texture->baseTexture.target = GL_TEXTURE_2D; - texture->cond_np2 = TRUE; - texture->baseTexture.minMipLookup = minMipLookup_noFilter; + texture->pow2_matrix[0] = 1.0f; + texture->pow2_matrix[5] = 1.0f; + texture->pow2_matrix[10] = 1.0f; + texture->pow2_matrix[15] = 1.0f; + texture->target = GL_TEXTURE_2D; + texture->flags |= WINED3D_TEXTURE_COND_NP2; + texture->min_mip_lookup = minMipLookup_noFilter; } else if (gl_info->supported[ARB_TEXTURE_RECTANGLE] && (width != pow2_width || height != pow2_height) && !(format->id == WINED3DFMT_P8_UINT && gl_info->supported[EXT_PALETTED_TEXTURE] && wined3d_settings.rendertargetlock_mode == RTL_READTEX)) { - if ((width != 1) || (height != 1)) texture->baseTexture.pow2Matrix_identity = FALSE; + if (width != 1 || height != 1) + texture->flags &= ~WINED3D_TEXTURE_POW2_MAT_IDENT; - texture->baseTexture.pow2Matrix[0] = (float)width; - texture->baseTexture.pow2Matrix[5] = (float)height; - texture->baseTexture.pow2Matrix[10] = 1.0f; - texture->baseTexture.pow2Matrix[15] = 1.0f; - texture->baseTexture.target = GL_TEXTURE_RECTANGLE_ARB; - texture->cond_np2 = TRUE; + texture->pow2_matrix[0] = (float)width; + texture->pow2_matrix[5] = (float)height; + texture->pow2_matrix[10] = 1.0f; + texture->pow2_matrix[15] = 1.0f; + texture->target = GL_TEXTURE_RECTANGLE_ARB; + texture->flags |= WINED3D_TEXTURE_COND_NP2; - if(texture->resource.format->Flags & WINED3DFMT_FLAG_FILTERING) - { - texture->baseTexture.minMipLookup = minMipLookup_noMip; - } + if (texture->resource.format->flags & WINED3DFMT_FLAG_FILTERING) + texture->min_mip_lookup = minMipLookup_noMip; else - { - texture->baseTexture.minMipLookup = minMipLookup_noFilter; - } + texture->min_mip_lookup = minMipLookup_noFilter; } else { if ((width != pow2_width) || (height != pow2_height)) { - texture->baseTexture.pow2Matrix_identity = FALSE; - texture->baseTexture.pow2Matrix[0] = (((float)width) / ((float)pow2_width)); - texture->baseTexture.pow2Matrix[5] = (((float)height) / ((float)pow2_height)); + texture->pow2_matrix[0] = (((float)width) / ((float)pow2_width)); + texture->pow2_matrix[5] = (((float)height) / ((float)pow2_height)); + texture->flags &= ~WINED3D_TEXTURE_POW2_MAT_IDENT; } else { - texture->baseTexture.pow2Matrix[0] = 1.0f; - texture->baseTexture.pow2Matrix[5] = 1.0f; + texture->pow2_matrix[0] = 1.0f; + texture->pow2_matrix[5] = 1.0f; } - texture->baseTexture.pow2Matrix[10] = 1.0f; - texture->baseTexture.pow2Matrix[15] = 1.0f; - texture->baseTexture.target = GL_TEXTURE_2D; - texture->cond_np2 = FALSE; + texture->pow2_matrix[10] = 1.0f; + texture->pow2_matrix[15] = 1.0f; + texture->target = GL_TEXTURE_2D; } - TRACE("xf(%f) yf(%f)\n", texture->baseTexture.pow2Matrix[0], texture->baseTexture.pow2Matrix[5]); + TRACE("xf(%f) yf(%f)\n", texture->pow2_matrix[0], texture->pow2_matrix[5]); /* Generate all the surfaces. */ tmp_w = width; tmp_h = height; - for (i = 0; i < texture->baseTexture.level_count; ++i) + for (i = 0; i < texture->level_count; ++i) { - IWineD3DSurface *surface; + struct wined3d_surface *surface; /* Use the callback to create the texture surface. */ - hr = IWineD3DDeviceParent_CreateSurface(device->device_parent, parent, tmp_w, tmp_h, + hr = device->device_parent->ops->create_surface(device->device_parent, parent, tmp_w, tmp_h, format->id, usage, pool, i, 0, &surface); if (FAILED(hr)) { FIXME("Failed to create surface %p, hr %#x\n", texture, hr); - texture_cleanup(texture); + wined3d_texture_cleanup(texture); return hr; } - surface_set_container((IWineD3DSurfaceImpl *)surface, WINED3D_CONTAINER_TEXTURE, (IWineD3DBase *)texture); - surface_set_texture_target((IWineD3DSurfaceImpl *)surface, texture->baseTexture.target); - texture->baseTexture.sub_resources[i] = (IWineD3DResourceImpl *)surface; + surface_set_container(surface, WINED3D_CONTAINER_TEXTURE, texture); + surface_set_texture_target(surface, texture->target); + texture->sub_resources[i] = &surface->resource; TRACE("Created surface level %u @ %p.\n", i, surface); /* Calculate the next mipmap level. */ tmp_w = max(1, tmp_w >> 1); tmp_h = max(1, tmp_h >> 1); } - texture->baseTexture.internal_preload = texture_internal_preload; + + return WINED3D_OK; +} + +/* Context activation is done by the caller. */ +static HRESULT texture3d_bind(struct wined3d_texture *texture, + const struct wined3d_gl_info *gl_info, BOOL srgb) +{ + BOOL dummy; + + TRACE("texture %p, gl_info %p, srgb %#x.\n", texture, gl_info, srgb); + + return wined3d_texture_bind(texture, gl_info, srgb, &dummy); +} + +/* Do not call while under the GL lock. */ +static void texture3d_preload(struct wined3d_texture *texture, enum WINED3DSRGB srgb) +{ + struct wined3d_device *device = texture->resource.device; + struct wined3d_context *context = NULL; + BOOL srgb_was_toggled = FALSE; + unsigned int i; + + TRACE("texture %p, srgb %#x.\n", texture, srgb); + + if (!device->isInDraw) + context = context_acquire(device, NULL); + else if (texture->bind_count > 0) + { + BOOL texture_srgb = texture->flags & WINED3D_TEXTURE_IS_SRGB; + BOOL sampler_srgb = texture_srgb_mode(texture, srgb); + srgb_was_toggled = !texture_srgb != !sampler_srgb; + + if (srgb_was_toggled) + { + if (sampler_srgb) + texture->flags |= WINED3D_TEXTURE_IS_SRGB; + else + texture->flags &= ~WINED3D_TEXTURE_IS_SRGB; + } + } + + /* If the texture is marked dirty or the sRGB sampler setting has changed + * since the last load then reload the volumes. */ + if (texture->texture_rgb.dirty) + { + for (i = 0; i < texture->level_count; ++i) + { + volume_load(volume_from_resource(texture->sub_resources[i]), i, + texture->flags & WINED3D_TEXTURE_IS_SRGB); + } + } + else if (srgb_was_toggled) + { + for (i = 0; i < texture->level_count; ++i) + { + struct wined3d_volume *volume = volume_from_resource(texture->sub_resources[i]); + volume_add_dirty_box(volume, NULL); + volume_load(volume, i, texture->flags & WINED3D_TEXTURE_IS_SRGB); + } + } + else + { + TRACE("Texture %p not dirty, nothing to do.\n", texture); + } + + if (context) + context_release(context); + + /* No longer dirty */ + texture->texture_rgb.dirty = FALSE; +} + +static void texture3d_sub_resource_add_dirty_region(struct wined3d_resource *sub_resource, + const WINED3DBOX *dirty_region) +{ + volume_add_dirty_box(volume_from_resource(sub_resource), dirty_region); +} + +static void texture3d_sub_resource_cleanup(struct wined3d_resource *sub_resource) +{ + struct wined3d_volume *volume = volume_from_resource(sub_resource); + + /* Cleanup the container. */ + volume_set_container(volume, NULL); + wined3d_volume_decref(volume); +} + +/* Do not call while under the GL lock. */ +static void texture3d_unload(struct wined3d_resource *resource) +{ + struct wined3d_texture *texture = wined3d_texture_from_resource(resource); + UINT i; + + TRACE("texture %p.\n", texture); + + for (i = 0; i < texture->level_count; ++i) + { + struct wined3d_resource *sub_resource = texture->sub_resources[i]; + sub_resource->resource_ops->resource_unload(sub_resource); + } + + wined3d_texture_unload(texture); +} + +static const struct wined3d_texture_ops texture3d_ops = +{ + texture3d_bind, + texture3d_preload, + texture3d_sub_resource_add_dirty_region, + texture3d_sub_resource_cleanup, +}; + +static const struct wined3d_resource_ops texture3d_resource_ops = +{ + texture3d_unload, +}; + +static HRESULT volumetexture_init(struct wined3d_texture *texture, UINT width, UINT height, + UINT depth, UINT levels, struct wined3d_device *device, DWORD usage, enum wined3d_format_id format_id, + WINED3DPOOL pool, void *parent, const struct wined3d_parent_ops *parent_ops) +{ + const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; + const struct wined3d_format *format = wined3d_get_format(gl_info, format_id); + UINT tmp_w, tmp_h, tmp_d; + unsigned int i; + HRESULT hr; + + /* TODO: It should only be possible to create textures for formats + * that are reported as supported. */ + if (WINED3DFMT_UNKNOWN >= format_id) + { + WARN("(%p) : Texture cannot be created with a format of WINED3DFMT_UNKNOWN.\n", texture); + return WINED3DERR_INVALIDCALL; + } + + if (!gl_info->supported[EXT_TEXTURE3D]) + { + WARN("(%p) : Texture cannot be created - no volume texture support.\n", texture); + return WINED3DERR_INVALIDCALL; + } + + /* Calculate levels for mip mapping. */ + if (usage & WINED3DUSAGE_AUTOGENMIPMAP) + { + if (!gl_info->supported[SGIS_GENERATE_MIPMAP]) + { + WARN("No mipmap generation support, returning D3DERR_INVALIDCALL.\n"); + return WINED3DERR_INVALIDCALL; + } + + if (levels > 1) + { + WARN("D3DUSAGE_AUTOGENMIPMAP is set, and level count > 1, returning D3DERR_INVALIDCALL.\n"); + return WINED3DERR_INVALIDCALL; + } + + levels = 1; + } + else if (!levels) + { + levels = wined3d_log2i(max(max(width, height), depth)) + 1; + TRACE("Calculated levels = %u.\n", levels); + } + + hr = wined3d_texture_init(texture, &texture3d_ops, 1, levels, + WINED3DRTYPE_VOLUMETEXTURE, device, usage, format, pool, + parent, parent_ops, &texture3d_resource_ops); + if (FAILED(hr)) + { + WARN("Failed to initialize texture, returning %#x.\n", hr); + return hr; + } + + /* Is NP2 support for volumes needed? */ + texture->pow2_matrix[0] = 1.0f; + texture->pow2_matrix[5] = 1.0f; + texture->pow2_matrix[10] = 1.0f; + texture->pow2_matrix[15] = 1.0f; + texture->target = GL_TEXTURE_3D; + + /* Generate all the surfaces. */ + tmp_w = width; + tmp_h = height; + tmp_d = depth; + + for (i = 0; i < texture->level_count; ++i) + { + struct wined3d_volume *volume; + + /* Create the volume. */ + hr = device->device_parent->ops->create_volume(device->device_parent, parent, + tmp_w, tmp_h, tmp_d, format_id, pool, usage, &volume); + if (FAILED(hr)) + { + ERR("Creating a volume for the volume texture failed, hr %#x.\n", hr); + wined3d_texture_cleanup(texture); + return hr; + } + + /* Set its container to this texture. */ + volume_set_container(volume, texture); + texture->sub_resources[i] = &volume->resource; + + /* Calculate the next mipmap level. */ + tmp_w = max(1, tmp_w >> 1); + tmp_h = max(1, tmp_h >> 1); + tmp_d = max(1, tmp_d >> 1); + } + + return WINED3D_OK; +} + +HRESULT CDECL wined3d_texture_create_2d(struct wined3d_device *device, UINT width, UINT height, + UINT level_count, DWORD usage, enum wined3d_format_id format_id, WINED3DPOOL pool, void *parent, + const struct wined3d_parent_ops *parent_ops, struct wined3d_texture **texture) +{ + struct wined3d_texture *object; + HRESULT hr; + + TRACE("device %p, width %u, height %u, level_count %u, usage %#x\n", + device, width, height, level_count, usage); + TRACE("format %s, pool %#x, parent %p, parent_ops %p, texture %p.\n", + debug_d3dformat(format_id), pool, parent, parent_ops, texture); + + object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); + if (!object) + { + ERR("Out of memory.\n"); + *texture = NULL; + return WINED3DERR_OUTOFVIDEOMEMORY; + } + + hr = texture_init(object, width, height, level_count, + device, usage, format_id, pool, parent, parent_ops); + if (FAILED(hr)) + { + WARN("Failed to initialize texture, returning %#x.\n", hr); + HeapFree(GetProcessHeap(), 0, object); + *texture = NULL; + return hr; + } + + TRACE("Created texture %p.\n", object); + *texture = object; + + return WINED3D_OK; +} + +HRESULT CDECL wined3d_texture_create_3d(struct wined3d_device *device, UINT width, UINT height, UINT depth, + UINT level_count, DWORD usage, enum wined3d_format_id format_id, WINED3DPOOL pool, void *parent, + const struct wined3d_parent_ops *parent_ops, struct wined3d_texture **texture) +{ + struct wined3d_texture *object; + HRESULT hr; + + TRACE("device %p, width %u, height %u, depth %u, level_count %u, usage %#x\n", + device, width, height, depth, level_count, usage); + TRACE("format %s, pool %#x, parent %p, parent_ops %p, texture %p.\n", + debug_d3dformat(format_id), pool, parent, parent_ops, texture); + + object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); + if (!object) + { + ERR("Out of memory\n"); + *texture = NULL; + return WINED3DERR_OUTOFVIDEOMEMORY; + } + + hr = volumetexture_init(object, width, height, depth, level_count, + device, usage, format_id, pool, parent, parent_ops); + if (FAILED(hr)) + { + WARN("Failed to initialize volumetexture, returning %#x\n", hr); + HeapFree(GetProcessHeap(), 0, object); + *texture = NULL; + return hr; + } + + TRACE("Created texture %p.\n", object); + *texture = object; + + return WINED3D_OK; +} + +HRESULT CDECL wined3d_texture_create_cube(struct wined3d_device *device, UINT edge_length, + UINT level_count, DWORD usage, enum wined3d_format_id format_id, WINED3DPOOL pool, void *parent, + const struct wined3d_parent_ops *parent_ops, struct wined3d_texture **texture) +{ + struct wined3d_texture *object; + HRESULT hr; + + TRACE("device %p, edge_length %u, level_count %u, usage %#x\n", + device, edge_length, level_count, usage); + TRACE("format %s, pool %#x, parent %p, parent_ops %p, texture %p.\n", + debug_d3dformat(format_id), pool, parent, parent_ops, texture); + + object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); + if (!object) + { + ERR("Out of memory\n"); + *texture = NULL; + return WINED3DERR_OUTOFVIDEOMEMORY; + } + + hr = cubetexture_init(object, edge_length, level_count, + device, usage, format_id, pool, parent, parent_ops); + if (FAILED(hr)) + { + WARN("Failed to initialize cubetexture, returning %#x\n", hr); + HeapFree(GetProcessHeap(), 0, object); + *texture = NULL; + return hr; + } + + TRACE("Created texture %p.\n", object); + *texture = object; return WINED3D_OK; } diff --git a/dll/directx/wine/wined3d/utils.c b/dll/directx/wine/wined3d/utils.c index 2957c5a3e4e..25c0512ccc0 100644 --- a/dll/directx/wine/wined3d/utils.c +++ b/dll/directx/wine/wined3d/utils.c @@ -7,7 +7,7 @@ * Copyright 2005 Oliver Stieber * Copyright 2006-2008 Henri Verbeet * Copyright 2007-2008 Stefan Dösinger for CodeWeavers - * Copyright 2009 Henri Verbeet for CodeWeavers + * Copyright 2009-2010 Henri Verbeet for CodeWeavers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -34,7 +34,7 @@ struct StaticPixelFormatDesc enum wined3d_format_id id; DWORD alphaMask, redMask, greenMask, blueMask; UINT bpp; - short depthSize, stencilSize; + BYTE depthSize, stencilSize; }; /***************************************************************************** @@ -130,8 +130,10 @@ static const struct StaticPixelFormatDesc formats[] = /* Vendor-specific formats */ {WINED3DFMT_ATI2N, 0x0, 0x0, 0x0, 0x0, 1, 0, 0}, {WINED3DFMT_NVDB, 0x0, 0x0, 0x0, 0x0, 0, 0, 0}, + {WINED3DFMT_INTZ, 0x0, 0x0, 0x0, 0x0, 4, 24, 8}, {WINED3DFMT_NVHU, 0x0, 0x0, 0x0, 0x0, 2, 0, 0}, {WINED3DFMT_NVHS, 0x0, 0x0, 0x0, 0x0, 2, 0, 0}, + {WINED3DFMT_NULL, 0xff000000, 0x000000ff, 0x0000ff00, 0x00ff0000, 4, 0, 0}, }; struct wined3d_format_base_flags @@ -156,6 +158,8 @@ static const struct wined3d_format_base_flags format_base_flags[] = {WINED3DFMT_MULTI2_ARGB8, WINED3DFMT_FLAG_FOURCC}, {WINED3DFMT_G8R8_G8B8, WINED3DFMT_FLAG_FOURCC}, {WINED3DFMT_R8G8_B8G8, WINED3DFMT_FLAG_FOURCC}, + {WINED3DFMT_INTZ, WINED3DFMT_FLAG_FOURCC}, + {WINED3DFMT_NULL, WINED3DFMT_FLAG_FOURCC}, {WINED3DFMT_P8_UINT, WINED3DFMT_FLAG_GETDC}, {WINED3DFMT_B8G8R8_UNORM, WINED3DFMT_FLAG_GETDC}, {WINED3DFMT_B8G8R8A8_UNORM, WINED3DFMT_FLAG_GETDC}, @@ -342,10 +346,10 @@ static void convert_r8g8_snorm(const BYTE *src, BYTE *dst, UINT pitch, UINT widt Dest = dst + y * outpitch; for (x = 0; x < width; x++ ) { - LONG color = (*Source++); + const short color = (*Source++); /* B */ Dest[0] = 0xff; /* G */ Dest[1] = (color >> 8) + 128; /* V */ - /* R */ Dest[2] = (color) + 128; /* U */ + /* R */ Dest[2] = (color & 0xff) + 128; /* U */ Dest += 3; } } @@ -436,10 +440,10 @@ static void convert_r16g16_snorm(const BYTE *src, BYTE *dst, UINT pitch, UINT wi Dest = (unsigned short *) (dst + y * outpitch); for (x = 0; x < width; x++ ) { - DWORD color = (*Source++); + const DWORD color = (*Source++); /* B */ Dest[0] = 0xffff; /* G */ Dest[1] = (color >> 16) + 32768; /* V */ - /* R */ Dest[2] = (color ) + 32768; /* U */ + /* R */ Dest[2] = (color & 0xffff) + 32768; /* U */ Dest += 3; } } @@ -856,6 +860,20 @@ static const struct wined3d_format_texture_info format_texture_info[] = GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, 0, WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING, ARB_TEXTURE_COMPRESSION_RGTC, NULL}, + {WINED3DFMT_INTZ, GL_DEPTH24_STENCIL8_EXT, GL_DEPTH24_STENCIL8_EXT, 0, + GL_DEPTH_STENCIL_EXT, GL_UNSIGNED_INT_24_8_EXT, 0, + WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_DEPTH + | WINED3DFMT_FLAG_STENCIL, + EXT_PACKED_DEPTH_STENCIL, NULL}, + {WINED3DFMT_INTZ, GL_DEPTH24_STENCIL8, GL_DEPTH24_STENCIL8, 0, + GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, 0, + WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_DEPTH + | WINED3DFMT_FLAG_STENCIL, + ARB_FRAMEBUFFER_OBJECT, NULL}, + {WINED3DFMT_NULL, GL_RGBA8, GL_RGBA8, 0, + GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, 0, + WINED3DFMT_FLAG_RENDERTARGET, + ARB_FRAMEBUFFER_OBJECT, NULL}, }; static inline int getFmtIdx(enum wined3d_format_id format_id) @@ -916,7 +934,7 @@ static BOOL init_format_base_info(struct wined3d_gl_info *gl_info) return FALSE; } - gl_info->formats[fmt_idx].Flags |= format_base_flags[i].flags; + gl_info->formats[fmt_idx].flags |= format_base_flags[i].flags; } return TRUE; @@ -942,7 +960,7 @@ static BOOL init_format_compression_info(struct wined3d_gl_info *gl_info) format->block_width = format_compression_info[i].block_width; format->block_height = format_compression_info[i].block_height; format->block_byte_count = format_compression_info[i].block_byte_count; - format->Flags |= WINED3DFMT_FLAG_COMPRESSED; + format->flags |= WINED3DFMT_FLAG_COMPRESSED; } return TRUE; @@ -978,18 +996,18 @@ static void check_fbo_compat(const struct wined3d_gl_info *gl_info, struct wined if (status == GL_FRAMEBUFFER_COMPLETE) { TRACE("Format %s is supported as FBO color attachment.\n", debug_d3dformat(format->id)); - format->Flags |= WINED3DFMT_FLAG_FBO_ATTACHABLE; + format->flags |= WINED3DFMT_FLAG_FBO_ATTACHABLE; format->rtInternal = format->glInternal; } else { if (!format->rtInternal) { - if (format->Flags & WINED3DFMT_FLAG_RENDERTARGET) + if (format->flags & WINED3DFMT_FLAG_RENDERTARGET) { FIXME("Format %s with rendertarget flag is not supported as FBO color attachment," " and no fallback specified.\n", debug_d3dformat(format->id)); - format->Flags &= ~WINED3DFMT_FLAG_RENDERTARGET; + format->flags &= ~WINED3DFMT_FLAG_RENDERTARGET; } else { @@ -1024,12 +1042,12 @@ static void check_fbo_compat(const struct wined3d_gl_info *gl_info, struct wined { FIXME("Format %s rtInternal format is not supported as FBO color attachment.\n", debug_d3dformat(format->id)); - format->Flags &= ~WINED3DFMT_FLAG_RENDERTARGET; + format->flags &= ~WINED3DFMT_FLAG_RENDERTARGET; } } } - if (status == GL_FRAMEBUFFER_COMPLETE && format->Flags & WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING) + if (status == GL_FRAMEBUFFER_COMPLETE && format->flags & WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING) { GLuint rb; @@ -1050,7 +1068,7 @@ static void check_fbo_compat(const struct wined3d_gl_info *gl_info, struct wined { while(glGetError()); TRACE("Format doesn't support post-pixelshader blending.\n"); - format->Flags &= ~WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING; + format->flags &= ~WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING; } if (gl_info->supported[ARB_FRAMEBUFFER_OBJECT] @@ -1074,7 +1092,7 @@ static void check_fbo_compat(const struct wined3d_gl_info *gl_info, struct wined if (status == GL_FRAMEBUFFER_COMPLETE) { TRACE("Format %s's sRGB format is FBO attachable.\n", debug_d3dformat(format->id)); - format->Flags |= WINED3DFMT_FLAG_FBO_ATTACHABLE_SRGB; + format->flags |= WINED3DFMT_FLAG_FBO_ATTACHABLE_SRGB; } else { @@ -1109,14 +1127,14 @@ static void init_format_fbo_compat_info(struct wined3d_gl_info *gl_info) if (!format->glInternal) continue; - if (format->Flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL)) + if (format->flags & (WINED3DFMT_FLAG_DEPTH | WINED3DFMT_FLAG_STENCIL)) { TRACE("Skipping format %s because it's a depth/stencil format.\n", debug_d3dformat(format->id)); continue; } - if (format->Flags & WINED3DFMT_FLAG_COMPRESSED) + if (format->flags & WINED3DFMT_FLAG_COMPRESSED) { TRACE("Skipping format %s because it's a compressed format.\n", debug_d3dformat(format->id)); @@ -1163,15 +1181,36 @@ static BOOL init_format_texture_info(struct wined3d_gl_info *gl_info) if (!gl_info->supported[format_texture_info[i].extension]) continue; format = &gl_info->formats[fmt_idx]; + + /* ARB_texture_rg defines floating point formats, but only if + * ARB_texture_float is also supported. */ + if (!gl_info->supported[ARB_TEXTURE_FLOAT] + && (format->flags & WINED3DFMT_FLAG_FLOAT)) + continue; + format->glInternal = format_texture_info[i].gl_internal; format->glGammaInternal = format_texture_info[i].gl_srgb_internal; format->rtInternal = format_texture_info[i].gl_rt_internal; format->glFormat = format_texture_info[i].gl_format; format->glType = format_texture_info[i].gl_type; format->color_fixup = COLOR_FIXUP_IDENTITY; - format->Flags |= format_texture_info[i].flags; + format->flags |= format_texture_info[i].flags; format->heightscale = 1.0f; + if (format->glGammaInternal != format->glInternal) + { + /* Filter sRGB capabilities if EXT_texture_sRGB is not supported. */ + if (!gl_info->supported[EXT_TEXTURE_SRGB]) + { + format->glGammaInternal = format->glInternal; + format->flags &= ~(WINED3DFMT_FLAG_SRGB_READ | WINED3DFMT_FLAG_SRGB_WRITE); + } + else if (gl_info->supported[EXT_TEXTURE_SRGB_DECODE]) + { + format->glInternal = format->glGammaInternal; + } + } + /* Texture conversion stuff */ format->convert = format_texture_info[i].convert; format->conv_byte_count = format_texture_info[i].conv_byte_count; @@ -1326,7 +1365,7 @@ static void init_format_filter_info(struct wined3d_gl_info *gl_info, enum wined3 for(i = 0; i < (sizeof(fmts16) / sizeof(*fmts16)); i++) { fmt_idx = getFmtIdx(fmts16[i]); - gl_info->formats[fmt_idx].Flags |= WINED3DFMT_FLAG_FILTERING; + gl_info->formats[fmt_idx].flags |= WINED3DFMT_FLAG_FILTERING; } } return; @@ -1342,7 +1381,7 @@ static void init_format_filter_info(struct wined3d_gl_info *gl_info, enum wined3 if(filtered) { TRACE("Format %s supports filtering\n", debug_d3dformat(fmts16[i])); - format->Flags |= WINED3DFMT_FLAG_FILTERING; + format->flags |= WINED3DFMT_FLAG_FILTERING; } else { @@ -1565,7 +1604,7 @@ UINT wined3d_format_calculate_size(const struct wined3d_format *format, UINT ali { size = 0; } - else if (format->Flags & WINED3DFMT_FLAG_COMPRESSED) + else if (format->flags & WINED3DFMT_FLAG_COMPRESSED) { UINT row_block_count = (width + format->block_width - 1) / format->block_width; UINT row_count = (height + format->block_height - 1) / format->block_height; @@ -1576,7 +1615,11 @@ UINT wined3d_format_calculate_size(const struct wined3d_format *format, UINT ali size = height * (((width * format->byte_count) + alignment - 1) & ~(alignment - 1)); } - if (format->heightscale != 0.0f) size *= format->heightscale; + if (format->heightscale != 0.0f) + { + /* The D3D format requirements make sure that the resulting format is an integer again */ + size = (UINT) (size * format->heightscale); + } return size; } @@ -1720,6 +1763,8 @@ const char *debug_d3dformat(enum wined3d_format_id format_id) FMT_TO_STR(WINED3DFMT_B5G5R5A1_UNORM); FMT_TO_STR(WINED3DFMT_B8G8R8A8_UNORM); FMT_TO_STR(WINED3DFMT_B8G8R8X8_UNORM); + FMT_TO_STR(WINED3DFMT_INTZ); + FMT_TO_STR(WINED3DFMT_NULL); #undef FMT_TO_STR default: { @@ -1921,7 +1966,6 @@ const char *debug_d3drenderstate(WINED3DRENDERSTATETYPE state) D3DSTATE_TO_STR(WINED3DRS_EDGEANTIALIAS); D3DSTATE_TO_STR(WINED3DRS_COLORKEYENABLE); D3DSTATE_TO_STR(WINED3DRS_MIPMAPLODBIAS); - D3DSTATE_TO_STR(WINED3DRS_ZBIAS); D3DSTATE_TO_STR(WINED3DRS_RANGEFOGENABLE); D3DSTATE_TO_STR(WINED3DRS_ANISOTROPY); D3DSTATE_TO_STR(WINED3DRS_FLUSHBATCH); @@ -2193,6 +2237,8 @@ const char *debug_d3dstate(DWORD state) return "STATE_MATERIAL"; if (STATE_IS_FRONTFACE(state)) return "STATE_FRONTFACE"; + if (STATE_IS_POINTSPRITECOORDORIGIN(state)) + return "STATE_POINTSPRITECOORDORIGIN"; return wine_dbg_sprintf("UNKNOWN_STATE(%#x)", state); } @@ -2493,17 +2539,18 @@ unsigned int count_bits(unsigned int mask) /* Helper function for retrieving color info for ChoosePixelFormat and wglChoosePixelFormatARB. * The later function requires individual color components. */ BOOL getColorBits(const struct wined3d_format *format, - short *redSize, short *greenSize, short *blueSize, short *alphaSize, short *totalSize) + BYTE *redSize, BYTE *greenSize, BYTE *blueSize, BYTE *alphaSize, BYTE *totalSize) { TRACE("format %s.\n", debug_d3dformat(format->id)); switch (format->id) { + case WINED3DFMT_B10G10R10A2_UNORM: + case WINED3DFMT_R10G10B10A2_UNORM: case WINED3DFMT_B8G8R8X8_UNORM: case WINED3DFMT_B8G8R8_UNORM: case WINED3DFMT_B8G8R8A8_UNORM: case WINED3DFMT_R8G8B8A8_UNORM: - case WINED3DFMT_B10G10R10A2_UNORM: case WINED3DFMT_B5G5R5X1_UNORM: case WINED3DFMT_B5G5R5A1_UNORM: case WINED3DFMT_B5G6R5_UNORM: @@ -2530,7 +2577,7 @@ BOOL getColorBits(const struct wined3d_format *format, } /* Helper function for retrieving depth/stencil info for ChoosePixelFormat and wglChoosePixelFormatARB */ -BOOL getDepthStencilBits(const struct wined3d_format *format, short *depthSize, short *stencilSize) +BOOL getDepthStencilBits(const struct wined3d_format *format, BYTE *depthSize, BYTE *stencilSize) { TRACE("format %s.\n", debug_d3dformat(format->id)); @@ -2545,6 +2592,7 @@ BOOL getDepthStencilBits(const struct wined3d_format *format, short *depthSize, case WINED3DFMT_S8_UINT_D24_FLOAT: case WINED3DFMT_D32_UNORM: case WINED3DFMT_D32_FLOAT: + case WINED3DFMT_INTZ: break; default: FIXME("Unsupported depth/stencil format %s.\n", debug_d3dformat(format->id)); @@ -2689,7 +2737,8 @@ DWORD get_flexible_vertex_size(DWORD d3dvtVertexType) { return size; } -void gen_ffp_frag_op(IWineD3DStateBlockImpl *stateblock, struct ffp_frag_settings *settings, BOOL ignore_textype) { +void gen_ffp_frag_op(struct wined3d_stateblock *stateblock, struct ffp_frag_settings *settings, BOOL ignore_textype) +{ #define ARG1 0x01 #define ARG2 0x02 #define ARG0 0x04 @@ -2725,13 +2774,14 @@ void gen_ffp_frag_op(IWineD3DStateBlockImpl *stateblock, struct ffp_frag_setting unsigned int i; DWORD ttff; DWORD cop, aop, carg0, carg1, carg2, aarg0, aarg1, aarg2; - IWineD3DDeviceImpl *device = stateblock->device; - IWineD3DSurfaceImpl *rt = device->render_targets[0]; + struct wined3d_device *device = stateblock->device; + struct wined3d_surface *rt = device->fb.render_targets[0]; const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; for (i = 0; i < gl_info->limits.texture_stages; ++i) { - IWineD3DBaseTextureImpl *texture; + const struct wined3d_texture *texture; + settings->op[i].padding = 0; if (stateblock->state.texture_states[i][WINED3DTSS_COLOROP] == WINED3DTOP_DISABLE) { @@ -2756,7 +2806,7 @@ void gen_ffp_frag_op(IWineD3DStateBlockImpl *stateblock, struct ffp_frag_setting } else { - switch (texture->baseTexture.target) + switch (texture->target) { case GL_TEXTURE_1D: settings->op[i].tex_type = tex_1d; @@ -2813,12 +2863,14 @@ void gen_ffp_frag_op(IWineD3DStateBlockImpl *stateblock, struct ffp_frag_setting if (!i && stateblock->state.textures[0] && stateblock->state.render_states[WINED3DRS_COLORKEYENABLE]) { - IWineD3DBaseTextureImpl *texture = stateblock->state.textures[0]; - GLenum texture_dimensions = texture->baseTexture.target; + GLenum texture_dimensions; + + texture = stateblock->state.textures[0]; + texture_dimensions = texture->target; if (texture_dimensions == GL_TEXTURE_2D || texture_dimensions == GL_TEXTURE_RECTANGLE_ARB) { - IWineD3DSurfaceImpl *surf = (IWineD3DSurfaceImpl *)texture->baseTexture.sub_resources[0]; + struct wined3d_surface *surf = surface_from_resource(texture->sub_resources[0]); if (surf->CKeyFlags & WINEDDSD_CKSRCBLT && !surf->resource.format->alpha_mask) { @@ -2938,7 +2990,7 @@ void gen_ffp_frag_op(IWineD3DStateBlockImpl *stateblock, struct ffp_frag_setting } } if (stateblock->state.render_states[WINED3DRS_SRGBWRITEENABLE] - && rt->resource.format->Flags & WINED3DFMT_FLAG_SRGB_WRITE) + && rt->resource.format->flags & WINED3DFMT_FLAG_SRGB_WRITE) { settings->sRGB_write = 1; } else { @@ -2979,11 +3031,11 @@ void add_ffp_frag_shader(struct wine_rb_tree *shaders, struct ffp_frag_desc *des * Requires the caller to activate the correct unit before */ /* GL locking is done by the caller (state handler) */ -void texture_activate_dimensions(IWineD3DBaseTextureImpl *texture, const struct wined3d_gl_info *gl_info) +void texture_activate_dimensions(const struct wined3d_texture *texture, const struct wined3d_gl_info *gl_info) { if (texture) { - switch (texture->baseTexture.target) + switch (texture->target) { case GL_TEXTURE_2D: glDisable(GL_TEXTURE_3D); @@ -3064,7 +3116,7 @@ void texture_activate_dimensions(IWineD3DBaseTextureImpl *texture, const struct } /* GL locking is done by the caller (state handler) */ -void sampler_texdim(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) +void sampler_texdim(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { DWORD sampler = state - STATE_SAMPLER(0); DWORD mapped_stage = stateblock->device->texUnitMap[sampler]; @@ -3162,7 +3214,7 @@ void select_shader_mode(const struct wined3d_gl_info *gl_info, int *ps_selected, else *ps_selected = SHADER_NONE; } -const struct blit_shader *wined3d_select_blitter(const struct wined3d_gl_info *gl_info, enum blit_operation blit_op, +const struct blit_shader *wined3d_select_blitter(const struct wined3d_gl_info *gl_info, enum wined3d_blit_op blit_op, const RECT *src_rect, DWORD src_usage, WINED3DPOOL src_pool, const struct wined3d_format *src_format, const RECT *dst_rect, DWORD dst_usage, WINED3DPOOL dst_pool, const struct wined3d_format *dst_format) { diff --git a/dll/directx/wine/wined3d/vertexdeclaration.c b/dll/directx/wine/wined3d/vertexdeclaration.c index 59219f034c2..d5eae1604c0 100644 --- a/dll/directx/wine/wined3d/vertexdeclaration.c +++ b/dll/directx/wine/wined3d/vertexdeclaration.c @@ -37,53 +37,36 @@ static void dump_wined3dvertexelement(const WINED3DVERTEXELEMENT *element) { TRACE(" usage_idx: %u\n", element->usage_idx); } -/* ******************************************* - IWineD3DVertexDeclaration IUnknown parts follow - ******************************************* */ -static HRESULT WINAPI IWineD3DVertexDeclarationImpl_QueryInterface(IWineD3DVertexDeclaration *iface, REFIID riid, LPVOID *ppobj) +ULONG CDECL wined3d_vertex_declaration_incref(struct wined3d_vertex_declaration *declaration) { - IWineD3DVertexDeclarationImpl *This = (IWineD3DVertexDeclarationImpl *)iface; - TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(riid),ppobj); - if (IsEqualGUID(riid, &IID_IUnknown) - || IsEqualGUID(riid, &IID_IWineD3DBase) - || IsEqualGUID(riid, &IID_IWineD3DVertexDeclaration)){ - IUnknown_AddRef(iface); - *ppobj = This; - return S_OK; - } - *ppobj = NULL; - return E_NOINTERFACE; + ULONG refcount = InterlockedIncrement(&declaration->ref); + + TRACE("%p increasing refcount to %u.\n", declaration, refcount); + + return refcount; } -static ULONG WINAPI IWineD3DVertexDeclarationImpl_AddRef(IWineD3DVertexDeclaration *iface) { - IWineD3DVertexDeclarationImpl *This = (IWineD3DVertexDeclarationImpl *)iface; - TRACE("(%p) : AddRef increasing from %d\n", This, This->ref); - return InterlockedIncrement(&This->ref); -} +ULONG CDECL wined3d_vertex_declaration_decref(struct wined3d_vertex_declaration *declaration) +{ + ULONG refcount = InterlockedDecrement(&declaration->ref); -static ULONG WINAPI IWineD3DVertexDeclarationImpl_Release(IWineD3DVertexDeclaration *iface) { - IWineD3DVertexDeclarationImpl *This = (IWineD3DVertexDeclarationImpl *)iface; - ULONG ref; - TRACE("(%p) : Releasing from %d\n", This, This->ref); - ref = InterlockedDecrement(&This->ref); - if (!ref) + TRACE("%p decreasing refcount to %u.\n", declaration, refcount); + + if (!refcount) { - HeapFree(GetProcessHeap(), 0, This->elements); - This->parent_ops->wined3d_object_destroyed(This->parent); - HeapFree(GetProcessHeap(), 0, This); + HeapFree(GetProcessHeap(), 0, declaration->elements); + declaration->parent_ops->wined3d_object_destroyed(declaration->parent); + HeapFree(GetProcessHeap(), 0, declaration); } - return ref; + + return refcount; } -/* ******************************************* - IWineD3DVertexDeclaration parts follow - ******************************************* */ - -static void * WINAPI IWineD3DVertexDeclarationImpl_GetParent(IWineD3DVertexDeclaration *iface) +void * CDECL wined3d_vertex_declaration_get_parent(const struct wined3d_vertex_declaration *declaration) { - TRACE("iface %p.\n", iface); + TRACE("declaration %p.\n", declaration); - return ((IWineD3DVertexDeclarationImpl *)iface)->parent; + return declaration->parent; } static BOOL declaration_element_valid_ffp(const WINED3DVERTEXELEMENT *element) @@ -174,18 +157,8 @@ static BOOL declaration_element_valid_ffp(const WINED3DVERTEXELEMENT *element) } } -static const IWineD3DVertexDeclarationVtbl IWineD3DVertexDeclaration_Vtbl = -{ - /* IUnknown */ - IWineD3DVertexDeclarationImpl_QueryInterface, - IWineD3DVertexDeclarationImpl_AddRef, - IWineD3DVertexDeclarationImpl_Release, - /* IWineD3DVertexDeclaration */ - IWineD3DVertexDeclarationImpl_GetParent, -}; - -HRESULT vertexdeclaration_init(IWineD3DVertexDeclarationImpl *declaration, IWineD3DDeviceImpl *device, - const WINED3DVERTEXELEMENT *elements, UINT element_count, +static HRESULT vertexdeclaration_init(struct wined3d_vertex_declaration *declaration, + struct wined3d_device *device, const WINED3DVERTEXELEMENT *elements, UINT element_count, void *parent, const struct wined3d_parent_ops *parent_ops) { const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; @@ -200,7 +173,6 @@ HRESULT vertexdeclaration_init(IWineD3DVertexDeclarationImpl *declaration, IWine } } - declaration->lpVtbl = &IWineD3DVertexDeclaration_Vtbl; declaration->ref = 1; declaration->parent = parent; declaration->parent_ops = parent_ops; @@ -264,3 +236,189 @@ HRESULT vertexdeclaration_init(IWineD3DVertexDeclarationImpl *declaration, IWine return WINED3D_OK; } + +HRESULT CDECL wined3d_vertex_declaration_create(struct wined3d_device *device, + const WINED3DVERTEXELEMENT *elements, UINT element_count, void *parent, + const struct wined3d_parent_ops *parent_ops, struct wined3d_vertex_declaration **declaration) +{ + struct wined3d_vertex_declaration *object; + HRESULT hr; + + TRACE("device %p, elements %p, element_count %u, parent %p, parent_ops %p, declaration %p.\n", + device, elements, element_count, parent, parent_ops, declaration); + + object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); + if(!object) + { + ERR("Failed to allocate vertex declaration memory.\n"); + return E_OUTOFMEMORY; + } + + hr = vertexdeclaration_init(object, device, elements, element_count, parent, parent_ops); + if (FAILED(hr)) + { + WARN("Failed to initialize vertex declaration, hr %#x.\n", hr); + HeapFree(GetProcessHeap(), 0, object); + return hr; + } + + TRACE("Created vertex declaration %p.\n", object); + *declaration = object; + + return WINED3D_OK; +} + +struct wined3d_fvf_convert_state +{ + const struct wined3d_gl_info *gl_info; + WINED3DVERTEXELEMENT *elements; + UINT offset; + UINT idx; +}; + +static void append_decl_element(struct wined3d_fvf_convert_state *state, + enum wined3d_format_id format_id, WINED3DDECLUSAGE usage, UINT usage_idx) +{ + WINED3DVERTEXELEMENT *elements = state->elements; + const struct wined3d_format *format; + UINT offset = state->offset; + UINT idx = state->idx; + + elements[idx].format = format_id; + elements[idx].input_slot = 0; + elements[idx].offset = offset; + elements[idx].output_slot = 0; + elements[idx].method = WINED3DDECLMETHOD_DEFAULT; + elements[idx].usage = usage; + elements[idx].usage_idx = usage_idx; + + format = wined3d_get_format(state->gl_info, format_id); + state->offset += format->component_count * format->component_size; + ++state->idx; +} + +static unsigned int convert_fvf_to_declaration(const struct wined3d_gl_info *gl_info, + DWORD fvf, WINED3DVERTEXELEMENT **elements) +{ + BOOL has_pos = !!(fvf & WINED3DFVF_POSITION_MASK); + BOOL has_blend = (fvf & WINED3DFVF_XYZB5) > WINED3DFVF_XYZRHW; + BOOL has_blend_idx = has_blend && + (((fvf & WINED3DFVF_XYZB5) == WINED3DFVF_XYZB5) || + (fvf & WINED3DFVF_LASTBETA_D3DCOLOR) || + (fvf & WINED3DFVF_LASTBETA_UBYTE4)); + BOOL has_normal = !!(fvf & WINED3DFVF_NORMAL); + BOOL has_psize = !!(fvf & WINED3DFVF_PSIZE); + BOOL has_diffuse = !!(fvf & WINED3DFVF_DIFFUSE); + BOOL has_specular = !!(fvf & WINED3DFVF_SPECULAR); + + DWORD num_textures = (fvf & WINED3DFVF_TEXCOUNT_MASK) >> WINED3DFVF_TEXCOUNT_SHIFT; + DWORD texcoords = (fvf & 0xFFFF0000) >> 16; + struct wined3d_fvf_convert_state state; + unsigned int size; + unsigned int idx; + DWORD num_blends = 1 + (((fvf & WINED3DFVF_XYZB5) - WINED3DFVF_XYZB1) >> 1); + if (has_blend_idx) num_blends--; + + /* Compute declaration size */ + size = has_pos + (has_blend && num_blends > 0) + has_blend_idx + has_normal + + has_psize + has_diffuse + has_specular + num_textures; + + state.gl_info = gl_info; + state.elements = HeapAlloc(GetProcessHeap(), 0, size * sizeof(*state.elements)); + if (!state.elements) return ~0U; + state.offset = 0; + state.idx = 0; + + if (has_pos) + { + if (!has_blend && (fvf & WINED3DFVF_XYZRHW)) + append_decl_element(&state, WINED3DFMT_R32G32B32A32_FLOAT, WINED3DDECLUSAGE_POSITIONT, 0); + else if ((fvf & WINED3DFVF_XYZW) == WINED3DFVF_XYZW) + append_decl_element(&state, WINED3DFMT_R32G32B32A32_FLOAT, WINED3DDECLUSAGE_POSITION, 0); + else + append_decl_element(&state, WINED3DFMT_R32G32B32_FLOAT, WINED3DDECLUSAGE_POSITION, 0); + } + + if (has_blend && (num_blends > 0)) + { + if ((fvf & WINED3DFVF_XYZB5) == WINED3DFVF_XYZB2 && (fvf & WINED3DFVF_LASTBETA_D3DCOLOR)) + append_decl_element(&state, WINED3DFMT_B8G8R8A8_UNORM, WINED3DDECLUSAGE_BLENDWEIGHT, 0); + else + { + switch (num_blends) + { + case 1: + append_decl_element(&state, WINED3DFMT_R32_FLOAT, WINED3DDECLUSAGE_BLENDWEIGHT, 0); + break; + case 2: + append_decl_element(&state, WINED3DFMT_R32G32_FLOAT, WINED3DDECLUSAGE_BLENDWEIGHT, 0); + break; + case 3: + append_decl_element(&state, WINED3DFMT_R32G32B32_FLOAT, WINED3DDECLUSAGE_BLENDWEIGHT, 0); + break; + case 4: + append_decl_element(&state, WINED3DFMT_R32G32B32A32_FLOAT, WINED3DDECLUSAGE_BLENDWEIGHT, 0); + break; + default: + ERR("Unexpected amount of blend values: %u\n", num_blends); + } + } + } + + if (has_blend_idx) + { + if ((fvf & WINED3DFVF_LASTBETA_UBYTE4) + || ((fvf & WINED3DFVF_XYZB5) == WINED3DFVF_XYZB2 && (fvf & WINED3DFVF_LASTBETA_D3DCOLOR))) + append_decl_element(&state, WINED3DFMT_R8G8B8A8_UINT, WINED3DDECLUSAGE_BLENDINDICES, 0); + else if (fvf & WINED3DFVF_LASTBETA_D3DCOLOR) + append_decl_element(&state, WINED3DFMT_B8G8R8A8_UNORM, WINED3DDECLUSAGE_BLENDINDICES, 0); + else + append_decl_element(&state, WINED3DFMT_R32_FLOAT, WINED3DDECLUSAGE_BLENDINDICES, 0); + } + + if (has_normal) append_decl_element(&state, WINED3DFMT_R32G32B32_FLOAT, WINED3DDECLUSAGE_NORMAL, 0); + if (has_psize) append_decl_element(&state, WINED3DFMT_R32_FLOAT, WINED3DDECLUSAGE_PSIZE, 0); + if (has_diffuse) append_decl_element(&state, WINED3DFMT_B8G8R8A8_UNORM, WINED3DDECLUSAGE_COLOR, 0); + if (has_specular) append_decl_element(&state, WINED3DFMT_B8G8R8A8_UNORM, WINED3DDECLUSAGE_COLOR, 1); + + for (idx = 0; idx < num_textures; ++idx) + { + switch ((texcoords >> (idx * 2)) & 0x03) + { + case WINED3DFVF_TEXTUREFORMAT1: + append_decl_element(&state, WINED3DFMT_R32_FLOAT, WINED3DDECLUSAGE_TEXCOORD, idx); + break; + case WINED3DFVF_TEXTUREFORMAT2: + append_decl_element(&state, WINED3DFMT_R32G32_FLOAT, WINED3DDECLUSAGE_TEXCOORD, idx); + break; + case WINED3DFVF_TEXTUREFORMAT3: + append_decl_element(&state, WINED3DFMT_R32G32B32_FLOAT, WINED3DDECLUSAGE_TEXCOORD, idx); + break; + case WINED3DFVF_TEXTUREFORMAT4: + append_decl_element(&state, WINED3DFMT_R32G32B32A32_FLOAT, WINED3DDECLUSAGE_TEXCOORD, idx); + break; + } + } + + *elements = state.elements; + return size; +} + +HRESULT CDECL wined3d_vertex_declaration_create_from_fvf(struct wined3d_device *device, + DWORD fvf, void *parent, const struct wined3d_parent_ops *parent_ops, + struct wined3d_vertex_declaration **declaration) +{ + WINED3DVERTEXELEMENT *elements; + unsigned int size; + DWORD hr; + + TRACE("device %p, fvf %#x, parent %p, parent_ops %p, declaration %p.\n", + device, fvf, parent, parent_ops, declaration); + + size = convert_fvf_to_declaration(&device->adapter->gl_info, fvf, &elements); + if (size == ~0U) return E_OUTOFMEMORY; + + hr = wined3d_vertex_declaration_create(device, elements, size, parent, parent_ops, declaration); + HeapFree(GetProcessHeap(), 0, elements); + return hr; +} diff --git a/dll/directx/wine/wined3d/view.c b/dll/directx/wine/wined3d/view.c index e4e40fc38bb..872335f2bd5 100644 --- a/dll/directx/wine/wined3d/view.c +++ b/dll/directx/wine/wined3d/view.c @@ -1,5 +1,5 @@ /* - * Copyright 2009 Henri Verbeet for CodeWeavers + * Copyright 2009, 2011 Henri Verbeet for CodeWeavers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -24,94 +24,68 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d); -/* IUnknown methods */ - -static HRESULT STDMETHODCALLTYPE rendertarget_view_QueryInterface(IWineD3DRendertargetView *iface, - REFIID riid, void **object) +ULONG CDECL wined3d_rendertarget_view_incref(struct wined3d_rendertarget_view *view) { - TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object); + ULONG refcount = InterlockedIncrement(&view->refcount); - if (IsEqualGUID(riid, &IID_IWineD3DRendertargetView) - || IsEqualGUID(riid, &IID_IWineD3DBase) - || IsEqualGUID(riid, &IID_IUnknown)) - { - IUnknown_AddRef(iface); - *object = iface; - return S_OK; - } - - WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid)); - - *object = NULL; - return E_NOINTERFACE; -} - -static ULONG STDMETHODCALLTYPE rendertarget_view_AddRef(IWineD3DRendertargetView *iface) -{ - struct wined3d_rendertarget_view *This = (struct wined3d_rendertarget_view *)iface; - ULONG refcount = InterlockedIncrement(&This->refcount); - - TRACE("%p increasing refcount to %u\n", This, refcount); + TRACE("%p increasing refcount to %u.\n", view, refcount); return refcount; } -static ULONG STDMETHODCALLTYPE rendertarget_view_Release(IWineD3DRendertargetView *iface) +ULONG CDECL wined3d_rendertarget_view_decref(struct wined3d_rendertarget_view *view) { - struct wined3d_rendertarget_view *This = (struct wined3d_rendertarget_view *)iface; - ULONG refcount = InterlockedDecrement(&This->refcount); + ULONG refcount = InterlockedDecrement(&view->refcount); - TRACE("%p decreasing refcount to %u\n", This, refcount); + TRACE("%p decreasing refcount to %u.\n", view, refcount); if (!refcount) - { - IWineD3DResource_Release(This->resource); - HeapFree(GetProcessHeap(), 0, This); - } + HeapFree(GetProcessHeap(), 0, view); return refcount; } -/* IWineD3DBase methods */ - -static void * STDMETHODCALLTYPE rendertarget_view_GetParent(IWineD3DRendertargetView *iface) +void * CDECL wined3d_rendertarget_view_get_parent(const struct wined3d_rendertarget_view *view) { - TRACE("iface %p.\n", iface); + TRACE("view %p.\n", view); - return ((struct wined3d_rendertarget_view *)iface)->parent; + return view->parent; } -/* IWineD3DRendertargetView methods */ - -static HRESULT STDMETHODCALLTYPE rendertarget_view_GetResource(IWineD3DRendertargetView *iface, - IWineD3DResource **resource) +struct wined3d_resource * CDECL wined3d_rendertarget_view_get_resource(const struct wined3d_rendertarget_view *view) { - struct wined3d_rendertarget_view *This = (struct wined3d_rendertarget_view *)iface; + TRACE("view %p.\n", view); - IWineD3DResource_AddRef(This->resource); - *resource = This->resource; - - return WINED3D_OK; + return view->resource; } -static const struct IWineD3DRendertargetViewVtbl wined3d_rendertarget_view_vtbl = +static void wined3d_rendertarget_view_init(struct wined3d_rendertarget_view *view, + struct wined3d_resource *resource, void *parent) { - /* IUnknown methods */ - rendertarget_view_QueryInterface, - rendertarget_view_AddRef, - rendertarget_view_Release, - /* IWineD3DBase methods */ - rendertarget_view_GetParent, - /* IWineD3DRendertargetView methods */ - rendertarget_view_GetResource, -}; - -void wined3d_rendertarget_view_init(struct wined3d_rendertarget_view *view, - IWineD3DResource *resource, void *parent) -{ - view->vtbl = &wined3d_rendertarget_view_vtbl; view->refcount = 1; - IWineD3DResource_AddRef(resource); view->resource = resource; view->parent = parent; } + +HRESULT CDECL wined3d_rendertarget_view_create(struct wined3d_resource *resource, + void *parent, struct wined3d_rendertarget_view **rendertarget_view) +{ + struct wined3d_rendertarget_view *object; + + TRACE("resource %p, parent %p, rendertarget_view %p.\n", + resource, parent, rendertarget_view); + + object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); + if (!object) + { + ERR("Failed to allocate memory\n"); + return E_OUTOFMEMORY; + } + + wined3d_rendertarget_view_init(object, resource, parent); + + TRACE("Created render target view %p.\n", object); + *rendertarget_view = object; + + return WINED3D_OK; +} diff --git a/dll/directx/wine/wined3d/volume.c b/dll/directx/wine/wined3d/volume.c index 8d42d547329..e0f8ed6a4c6 100644 --- a/dll/directx/wine/wined3d/volume.c +++ b/dll/directx/wine/wined3d/volume.c @@ -1,10 +1,8 @@ /* - * IWineD3DVolume implementation - * * Copyright 2002-2005 Jason Edmeades * Copyright 2002-2005 Raphael Junqueira * Copyright 2005 Oliver Stieber - * Copyright 2009 Henri Verbeet for CodeWeavers + * Copyright 2009-2011 Henri Verbeet for CodeWeavers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -27,9 +25,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d_surface); /* Context activation is done by the caller. */ -static void volume_bind_and_dirtify(IWineD3DVolume *iface) { - IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface; - const struct wined3d_gl_info *gl_info = &This->resource.device->adapter->gl_info; +static void volume_bind_and_dirtify(struct wined3d_volume *volume, const struct wined3d_gl_info *gl_info) +{ + struct wined3d_texture *container = volume->container; DWORD active_sampler; /* We don't need a specific texture unit, but after binding the texture the current unit is dirty. @@ -49,285 +47,256 @@ static void volume_bind_and_dirtify(IWineD3DVolume *iface) { ENTER_GL(); glGetIntegerv(GL_ACTIVE_TEXTURE, &active_texture); LEAVE_GL(); - active_sampler = This->resource.device->rev_tex_unit_map[active_texture - GL_TEXTURE0_ARB]; + active_sampler = volume->resource.device->rev_tex_unit_map[active_texture - GL_TEXTURE0_ARB]; } else { active_sampler = 0; } if (active_sampler != WINED3D_UNMAPPED_STAGE) { - IWineD3DDeviceImpl_MarkStateDirty(This->resource.device, STATE_SAMPLER(active_sampler)); + IWineD3DDeviceImpl_MarkStateDirty(volume->resource.device, STATE_SAMPLER(active_sampler)); } - IWineD3DVolumeTexture_BindTexture((IWineD3DVolumeTexture *)This->container, FALSE); + container->texture_ops->texture_bind(container, gl_info, FALSE); } -void volume_add_dirty_box(IWineD3DVolume *iface, const WINED3DBOX *dirty_box) +void volume_add_dirty_box(struct wined3d_volume *volume, const WINED3DBOX *dirty_box) { - IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface; - - This->dirty = TRUE; + volume->dirty = TRUE; if (dirty_box) { - This->lockedBox.Left = min(This->lockedBox.Left, dirty_box->Left); - This->lockedBox.Top = min(This->lockedBox.Top, dirty_box->Top); - This->lockedBox.Front = min(This->lockedBox.Front, dirty_box->Front); - This->lockedBox.Right = max(This->lockedBox.Right, dirty_box->Right); - This->lockedBox.Bottom = max(This->lockedBox.Bottom, dirty_box->Bottom); - This->lockedBox.Back = max(This->lockedBox.Back, dirty_box->Back); + volume->lockedBox.Left = min(volume->lockedBox.Left, dirty_box->Left); + volume->lockedBox.Top = min(volume->lockedBox.Top, dirty_box->Top); + volume->lockedBox.Front = min(volume->lockedBox.Front, dirty_box->Front); + volume->lockedBox.Right = max(volume->lockedBox.Right, dirty_box->Right); + volume->lockedBox.Bottom = max(volume->lockedBox.Bottom, dirty_box->Bottom); + volume->lockedBox.Back = max(volume->lockedBox.Back, dirty_box->Back); } else { - This->lockedBox.Left = 0; - This->lockedBox.Top = 0; - This->lockedBox.Front = 0; - This->lockedBox.Right = This->currentDesc.Width; - This->lockedBox.Bottom = This->currentDesc.Height; - This->lockedBox.Back = This->currentDesc.Depth; + volume->lockedBox.Left = 0; + volume->lockedBox.Top = 0; + volume->lockedBox.Front = 0; + volume->lockedBox.Right = volume->resource.width; + volume->lockedBox.Bottom = volume->resource.height; + volume->lockedBox.Back = volume->resource.depth; } } -void volume_set_container(IWineD3DVolumeImpl *volume, struct IWineD3DVolumeTextureImpl *container) +void volume_set_container(struct wined3d_volume *volume, struct wined3d_texture *container) { TRACE("volume %p, container %p.\n", volume, container); volume->container = container; } -/* ******************************************* - IWineD3DVolume IUnknown parts follow - ******************************************* */ -static HRESULT WINAPI IWineD3DVolumeImpl_QueryInterface(IWineD3DVolume *iface, REFIID riid, void **object) +/* Context activation is done by the caller. */ +void volume_load(struct wined3d_volume *volume, UINT level, BOOL srgb_mode) { - TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object); + const struct wined3d_gl_info *gl_info = &volume->resource.device->adapter->gl_info; + const struct wined3d_format *format = volume->resource.format; - if (IsEqualGUID(riid, &IID_IWineD3DVolume) - || IsEqualGUID(riid, &IID_IWineD3DResource) - || IsEqualGUID(riid, &IID_IWineD3DBase) - || IsEqualGUID(riid, &IID_IUnknown)) - { - IUnknown_AddRef(iface); - *object = iface; - return S_OK; - } + TRACE("volume %p, level %u, srgb %#x, format %s (%#x).\n", + volume, level, srgb_mode, debug_d3dformat(format->id), format->id); - WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid)); + volume_bind_and_dirtify(volume, gl_info); - *object = NULL; - return E_NOINTERFACE; -} + ENTER_GL(); + GL_EXTCALL(glTexImage3DEXT(GL_TEXTURE_3D, level, format->glInternal, + volume->resource.width, volume->resource.height, volume->resource.depth, + 0, format->glFormat, format->glType, volume->resource.allocatedMemory)); + checkGLcall("glTexImage3D"); + LEAVE_GL(); -static ULONG WINAPI IWineD3DVolumeImpl_AddRef(IWineD3DVolume *iface) { - IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface; - TRACE("(%p) : AddRef increasing from %d\n", This, This->resource.ref); - return InterlockedIncrement(&This->resource.ref); + /* When adding code releasing volume->resource.allocatedMemory to save + * data keep in mind that GL_UNPACK_CLIENT_STORAGE_APPLE is enabled by + * default if supported(GL_APPLE_client_storage). Thus do not release + * volume->resource.allocatedMemory if GL_APPLE_client_storage is + * supported. */ } /* Do not call while under the GL lock. */ -static ULONG WINAPI IWineD3DVolumeImpl_Release(IWineD3DVolume *iface) { - IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface; - ULONG ref; - TRACE("(%p) : Releasing from %d\n", This, This->resource.ref); - ref = InterlockedDecrement(&This->resource.ref); - - if (!ref) - { - resource_cleanup((IWineD3DResource *)iface); - This->resource.parent_ops->wined3d_object_destroyed(This->resource.parent); - HeapFree(GetProcessHeap(), 0, This); - } - return ref; -} - -/* **************************************************** - IWineD3DVolume IWineD3DResource parts follow - **************************************************** */ -static void * WINAPI IWineD3DVolumeImpl_GetParent(IWineD3DVolume *iface) +static void volume_unload(struct wined3d_resource *resource) { - TRACE("iface %p.\n", iface); - - return ((IWineD3DVolumeImpl *)iface)->resource.parent; -} - -static HRESULT WINAPI IWineD3DVolumeImpl_SetPrivateData(IWineD3DVolume *iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) { - return resource_set_private_data((IWineD3DResource *)iface, refguid, pData, SizeOfData, Flags); -} - -static HRESULT WINAPI IWineD3DVolumeImpl_GetPrivateData(IWineD3DVolume *iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) { - return resource_get_private_data((IWineD3DResource *)iface, refguid, pData, pSizeOfData); -} - -static HRESULT WINAPI IWineD3DVolumeImpl_FreePrivateData(IWineD3DVolume *iface, REFGUID refguid) { - return resource_free_private_data((IWineD3DResource *)iface, refguid); -} - -static DWORD WINAPI IWineD3DVolumeImpl_SetPriority(IWineD3DVolume *iface, DWORD PriorityNew) { - return resource_set_priority((IWineD3DResource *)iface, PriorityNew); -} - -static DWORD WINAPI IWineD3DVolumeImpl_GetPriority(IWineD3DVolume *iface) { - return resource_get_priority((IWineD3DResource *)iface); -} - -/* Do not call while under the GL lock. */ -static void WINAPI IWineD3DVolumeImpl_PreLoad(IWineD3DVolume *iface) { - FIXME("iface %p stub!\n", iface); -} - -/* Do not call while under the GL lock. */ -static void WINAPI IWineD3DVolumeImpl_UnLoad(IWineD3DVolume *iface) -{ - TRACE("iface %p.\n", iface); + TRACE("texture %p.\n", resource); /* The whole content is shadowed on This->resource.allocatedMemory, and * the texture name is managed by the VolumeTexture container. */ - resource_unload((IWineD3DResourceImpl *)iface); + resource_unload(resource); } -static WINED3DRESOURCETYPE WINAPI IWineD3DVolumeImpl_GetType(IWineD3DVolume *iface) { - return resource_get_type((IWineD3DResource *)iface); -} - -static void WINAPI IWineD3DVolumeImpl_GetDesc(IWineD3DVolume *iface, WINED3DVOLUME_DESC *desc) +ULONG CDECL wined3d_volume_incref(struct wined3d_volume *volume) { - IWineD3DVolumeImpl *volume = (IWineD3DVolumeImpl *)iface; + ULONG refcount; - TRACE("iface %p, desc %p.\n", iface, desc); + if (volume->container) + { + TRACE("Forwarding to container %p.\n", volume->container); + return wined3d_texture_incref(volume->container); + } - desc->Format = volume->resource.format->id; - desc->Type = volume->resource.resourceType; - desc->Usage = volume->resource.usage; - desc->Pool = volume->resource.pool; - desc->Size = volume->resource.size; /* dx8 only */ - desc->Width = volume->currentDesc.Width; - desc->Height = volume->currentDesc.Height; - desc->Depth = volume->currentDesc.Depth; + refcount = InterlockedIncrement(&volume->resource.ref); + + TRACE("%p increasing refcount to %u.\n", volume, refcount); + + return refcount; } -static HRESULT WINAPI IWineD3DVolumeImpl_LockBox(IWineD3DVolume *iface, WINED3DLOCKED_BOX* pLockedVolume, CONST WINED3DBOX* pBox, DWORD Flags) { - IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface; - FIXME("(%p) : pBox=%p stub\n", This, pBox); +/* Do not call while under the GL lock. */ +ULONG CDECL wined3d_volume_decref(struct wined3d_volume *volume) +{ + ULONG refcount; - if(!This->resource.allocatedMemory) { - This->resource.allocatedMemory = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->resource.size); + if (volume->container) + { + TRACE("Forwarding to container %p.\n", volume->container); + return wined3d_texture_decref(volume->container); } - /* fixme: should we really lock as such? */ - TRACE("(%p) : box=%p, output pbox=%p, allMem=%p\n", This, pBox, pLockedVolume, This->resource.allocatedMemory); + refcount = InterlockedDecrement(&volume->resource.ref); - pLockedVolume->RowPitch = This->resource.format->byte_count * This->currentDesc.Width; /* Bytes / row */ - pLockedVolume->SlicePitch = This->resource.format->byte_count - * This->currentDesc.Width * This->currentDesc.Height; /* Bytes / slice */ - if (!pBox) { + TRACE("%p decreasing refcount to %u.\n", volume, refcount); + + if (!refcount) + { + resource_cleanup(&volume->resource); + volume->resource.parent_ops->wined3d_object_destroyed(volume->resource.parent); + HeapFree(GetProcessHeap(), 0, volume); + } + + return refcount; +} + +void * CDECL wined3d_volume_get_parent(const struct wined3d_volume *volume) +{ + TRACE("volume %p.\n", volume); + + return volume->resource.parent; +} + +HRESULT CDECL wined3d_volume_set_private_data(struct wined3d_volume *volume, + REFGUID guid, const void *data, DWORD data_size, DWORD flags) +{ + return resource_set_private_data(&volume->resource, guid, data, data_size, flags); +} + +HRESULT CDECL wined3d_volume_get_private_data(const struct wined3d_volume *volume, + REFGUID guid, void *data, DWORD *data_size) +{ + return resource_get_private_data(&volume->resource, guid, data, data_size); +} + +HRESULT CDECL wined3d_volume_free_private_data(struct wined3d_volume *volume, REFGUID guid) +{ + return resource_free_private_data(&volume->resource, guid); +} + +DWORD CDECL wined3d_volume_set_priority(struct wined3d_volume *volume, DWORD priority) +{ + return resource_set_priority(&volume->resource, priority); +} + +DWORD CDECL wined3d_volume_get_priority(const struct wined3d_volume *volume) +{ + return resource_get_priority(&volume->resource); +} + +/* Do not call while under the GL lock. */ +void CDECL wined3d_volume_preload(struct wined3d_volume *volume) +{ + FIXME("volume %p stub!\n", volume); +} + +struct wined3d_resource * CDECL wined3d_volume_get_resource(struct wined3d_volume *volume) +{ + TRACE("volume %p.\n", volume); + + return &volume->resource; +} + +HRESULT CDECL wined3d_volume_map(struct wined3d_volume *volume, + WINED3DLOCKED_BOX *locked_box, const WINED3DBOX *box, DWORD flags) +{ + TRACE("volume %p, locked_box %p, box %p, flags %#x.\n", + volume, locked_box, box, flags); + + if (!volume->resource.allocatedMemory) + volume->resource.allocatedMemory = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, volume->resource.size); + + TRACE("allocatedMemory %p.\n", volume->resource.allocatedMemory); + + locked_box->RowPitch = volume->resource.format->byte_count * volume->resource.width; /* Bytes / row */ + locked_box->SlicePitch = volume->resource.format->byte_count + * volume->resource.width * volume->resource.height; /* Bytes / slice */ + if (!box) + { TRACE("No box supplied - all is ok\n"); - pLockedVolume->pBits = This->resource.allocatedMemory; - This->lockedBox.Left = 0; - This->lockedBox.Top = 0; - This->lockedBox.Front = 0; - This->lockedBox.Right = This->currentDesc.Width; - This->lockedBox.Bottom = This->currentDesc.Height; - This->lockedBox.Back = This->currentDesc.Depth; - } else { - TRACE("Lock Box (%p) = l %d, t %d, r %d, b %d, fr %d, ba %d\n", pBox, pBox->Left, pBox->Top, pBox->Right, pBox->Bottom, pBox->Front, pBox->Back); - pLockedVolume->pBits = This->resource.allocatedMemory - + (pLockedVolume->SlicePitch * pBox->Front) /* FIXME: is front < back or vica versa? */ - + (pLockedVolume->RowPitch * pBox->Top) - + (pBox->Left * This->resource.format->byte_count); - This->lockedBox.Left = pBox->Left; - This->lockedBox.Top = pBox->Top; - This->lockedBox.Front = pBox->Front; - This->lockedBox.Right = pBox->Right; - This->lockedBox.Bottom = pBox->Bottom; - This->lockedBox.Back = pBox->Back; - } - - if (Flags & (WINED3DLOCK_NO_DIRTY_UPDATE | WINED3DLOCK_READONLY)) { - /* Don't dirtify */ + locked_box->pBits = volume->resource.allocatedMemory; + volume->lockedBox.Left = 0; + volume->lockedBox.Top = 0; + volume->lockedBox.Front = 0; + volume->lockedBox.Right = volume->resource.width; + volume->lockedBox.Bottom = volume->resource.height; + volume->lockedBox.Back = volume->resource.depth; } else { - volume_add_dirty_box(iface, &This->lockedBox); - This->container->baseTexture.texture_rgb.dirty = TRUE; - This->container->baseTexture.texture_srgb.dirty = TRUE; + TRACE("Lock Box (%p) = l %d, t %d, r %d, b %d, fr %d, ba %d\n", + box, box->Left, box->Top, box->Right, box->Bottom, box->Front, box->Back); + locked_box->pBits = volume->resource.allocatedMemory + + (locked_box->SlicePitch * box->Front) /* FIXME: is front < back or vica versa? */ + + (locked_box->RowPitch * box->Top) + + (box->Left * volume->resource.format->byte_count); + volume->lockedBox.Left = box->Left; + volume->lockedBox.Top = box->Top; + volume->lockedBox.Front = box->Front; + volume->lockedBox.Right = box->Right; + volume->lockedBox.Bottom = box->Bottom; + volume->lockedBox.Back = box->Back; } - This->locked = TRUE; - TRACE("returning memory@%p rpitch(%d) spitch(%d)\n", pLockedVolume->pBits, pLockedVolume->RowPitch, pLockedVolume->SlicePitch); + if (!(flags & (WINED3DLOCK_NO_DIRTY_UPDATE | WINED3DLOCK_READONLY))) + { + volume_add_dirty_box(volume, &volume->lockedBox); + wined3d_texture_set_dirty(volume->container, TRUE); + } + + volume->locked = TRUE; + + TRACE("Returning memory %p, row pitch %d, slice pitch %d.\n", + locked_box->pBits, locked_box->RowPitch, locked_box->SlicePitch); + return WINED3D_OK; } -static HRESULT WINAPI IWineD3DVolumeImpl_UnlockBox(IWineD3DVolume *iface) { - IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface; - if (!This->locked) +struct wined3d_volume * CDECL wined3d_volume_from_resource(struct wined3d_resource *resource) +{ + return volume_from_resource(resource); +} + +HRESULT CDECL wined3d_volume_unmap(struct wined3d_volume *volume) +{ + TRACE("volume %p.\n", volume); + + if (!volume->locked) { - WARN("Trying to unlock unlocked volume %p.\n", iface); + WARN("Trying to unlock unlocked volume %p.\n", volume); return WINED3DERR_INVALIDCALL; } - TRACE("(%p) : unlocking volume\n", This); - This->locked = FALSE; - memset(&This->lockedBox, 0, sizeof(RECT)); + + volume->locked = FALSE; + memset(&volume->lockedBox, 0, sizeof(volume->lockedBox)); + return WINED3D_OK; } -/* Internal use functions follow : */ - -/* Context activation is done by the caller. */ -static HRESULT WINAPI IWineD3DVolumeImpl_LoadTexture(IWineD3DVolume *iface, int gl_level, BOOL srgb_mode) +static const struct wined3d_resource_ops volume_resource_ops = { - IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface; - const struct wined3d_gl_info *gl_info = &This->resource.device->adapter->gl_info; - const struct wined3d_format *format = This->resource.format; - - TRACE("iface %p, level %u, srgb %#x, format %s (%#x).\n", - iface, gl_level, srgb_mode, debug_d3dformat(format->id), format->id); - - volume_bind_and_dirtify(iface); - - TRACE("Calling glTexImage3D %x level=%d, intfmt=%x, w=%d, h=%d,d=%d, 0=%d, glFmt=%x, glType=%x, Mem=%p\n", - GL_TEXTURE_3D, gl_level, format->glInternal, This->currentDesc.Width, This->currentDesc.Height, - This->currentDesc.Depth, 0, format->glFormat, format->glType, This->resource.allocatedMemory); - - ENTER_GL(); - GL_EXTCALL(glTexImage3DEXT(GL_TEXTURE_3D, gl_level, format->glInternal, - This->currentDesc.Width, This->currentDesc.Height, This->currentDesc.Depth, - 0, format->glFormat, format->glType, This->resource.allocatedMemory)); - checkGLcall("glTexImage3D"); - LEAVE_GL(); - - /* When adding code releasing This->resource.allocatedMemory to save data keep in mind that - * GL_UNPACK_CLIENT_STORAGE_APPLE is enabled by default if supported(GL_APPLE_client_storage). - * Thus do not release This->resource.allocatedMemory if GL_APPLE_client_storage is supported. - */ - return WINED3D_OK; - -} - -static const IWineD3DVolumeVtbl IWineD3DVolume_Vtbl = -{ - /* IUnknown */ - IWineD3DVolumeImpl_QueryInterface, - IWineD3DVolumeImpl_AddRef, - IWineD3DVolumeImpl_Release, - /* IWineD3DResource */ - IWineD3DVolumeImpl_GetParent, - IWineD3DVolumeImpl_SetPrivateData, - IWineD3DVolumeImpl_GetPrivateData, - IWineD3DVolumeImpl_FreePrivateData, - IWineD3DVolumeImpl_SetPriority, - IWineD3DVolumeImpl_GetPriority, - IWineD3DVolumeImpl_PreLoad, - IWineD3DVolumeImpl_UnLoad, - IWineD3DVolumeImpl_GetType, - /* IWineD3DVolume */ - IWineD3DVolumeImpl_GetDesc, - IWineD3DVolumeImpl_LockBox, - IWineD3DVolumeImpl_UnlockBox, - /* Internal interface */ - IWineD3DVolumeImpl_LoadTexture, + volume_unload, }; -HRESULT volume_init(IWineD3DVolumeImpl *volume, IWineD3DDeviceImpl *device, UINT width, +static HRESULT volume_init(struct wined3d_volume *volume, struct wined3d_device *device, UINT width, UINT height, UINT depth, DWORD usage, enum wined3d_format_id format_id, WINED3DPOOL pool, void *parent, const struct wined3d_parent_ops *parent_ops) { @@ -341,25 +310,55 @@ HRESULT volume_init(IWineD3DVolumeImpl *volume, IWineD3DDeviceImpl *device, UINT return WINED3DERR_INVALIDCALL; } - volume->lpVtbl = &IWineD3DVolume_Vtbl; - - hr = resource_init((IWineD3DResource *)volume, WINED3DRTYPE_VOLUME, device, - width * height * depth * format->byte_count, usage, format, pool, parent, parent_ops); + hr = resource_init(&volume->resource, device, WINED3DRTYPE_VOLUME, format, + WINED3DMULTISAMPLE_NONE, 0, usage, pool, width, height, depth, + width * height * depth * format->byte_count, parent, parent_ops, + &volume_resource_ops); if (FAILED(hr)) { WARN("Failed to initialize resource, returning %#x.\n", hr); return hr; } - volume->currentDesc.Width = width; - volume->currentDesc.Height = height; - volume->currentDesc.Depth = depth; volume->lockable = TRUE; volume->locked = FALSE; memset(&volume->lockedBox, 0, sizeof(volume->lockedBox)); volume->dirty = TRUE; - volume_add_dirty_box((IWineD3DVolume *)volume, NULL); + volume_add_dirty_box(volume, NULL); + + return WINED3D_OK; +} + +HRESULT CDECL wined3d_volume_create(struct wined3d_device *device, UINT width, UINT height, + UINT depth, DWORD usage, enum wined3d_format_id format_id, WINED3DPOOL pool, void *parent, + const struct wined3d_parent_ops *parent_ops, struct wined3d_volume **volume) +{ + struct wined3d_volume *object; + HRESULT hr; + + TRACE("device %p, width %u, height %u, depth %u, usage %#x, format %s, pool %s\n", + device, width, height, depth, usage, debug_d3dformat(format_id), debug_d3dpool(pool)); + TRACE("parent %p, parent_ops %p, volume %p.\n", parent, parent_ops, volume); + + object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); + if (!object) + { + ERR("Out of memory\n"); + *volume = NULL; + return WINED3DERR_OUTOFVIDEOMEMORY; + } + + hr = volume_init(object, device, width, height, depth, usage, format_id, pool, parent, parent_ops); + if (FAILED(hr)) + { + WARN("Failed to initialize volume, returning %#x.\n", hr); + HeapFree(GetProcessHeap(), 0, object); + return hr; + } + + TRACE("Created volume %p.\n", object); + *volume = object; return WINED3D_OK; } diff --git a/dll/directx/wine/wined3d/volumetexture.c b/dll/directx/wine/wined3d/volumetexture.c deleted file mode 100644 index a2c0c6d796a..00000000000 --- a/dll/directx/wine/wined3d/volumetexture.c +++ /dev/null @@ -1,481 +0,0 @@ -/* - * IWineD3DVolumeTexture implementation - * - * Copyright 2002-2005 Jason Edmeades - * Copyright 2002-2005 Raphael Junqueira - * Copyright 2005 Oliver Stieber - * Copyright 2009 Henri Verbeet for CodeWeavers - * - * 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 "config.h" -#include "wined3d_private.h" - -WINE_DEFAULT_DEBUG_CHANNEL(d3d_texture); - -/* Do not call while under the GL lock. */ -static void volumetexture_internal_preload(IWineD3DBaseTexture *iface, enum WINED3DSRGB srgb) -{ - /* Override the IWineD3DResource Preload method. */ - IWineD3DVolumeTextureImpl *This = (IWineD3DVolumeTextureImpl *)iface; - IWineD3DDeviceImpl *device = This->resource.device; - const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; - struct wined3d_context *context = NULL; - BOOL srgb_mode = This->baseTexture.is_srgb; - BOOL srgb_was_toggled = FALSE; - unsigned int i; - - TRACE("(%p) : About to load texture.\n", This); - - if (!device->isInDraw) context = context_acquire(device, NULL); - else if (gl_info->supported[EXT_TEXTURE_SRGB] && This->baseTexture.bindCount > 0) - { - srgb_mode = device->stateBlock->state.sampler_states[This->baseTexture.sampler][WINED3DSAMP_SRGBTEXTURE]; - srgb_was_toggled = This->baseTexture.is_srgb != srgb_mode; - This->baseTexture.is_srgb = srgb_mode; - } - - /* If the texture is marked dirty or the srgb sampler setting has changed - * since the last load then reload the volumes. */ - if (This->baseTexture.texture_rgb.dirty) - { - for (i = 0; i < This->baseTexture.level_count; ++i) - { - IWineD3DVolume *volume = (IWineD3DVolume *)This->baseTexture.sub_resources[i]; - IWineD3DVolume_LoadTexture(volume, i, srgb_mode); - } - } - else if (srgb_was_toggled) - { - for (i = 0; i < This->baseTexture.level_count; ++i) - { - IWineD3DVolume *volume = (IWineD3DVolume *)This->baseTexture.sub_resources[i]; - volume_add_dirty_box(volume, NULL); - IWineD3DVolume_LoadTexture(volume, i, srgb_mode); - } - } - else - { - TRACE("(%p) Texture not dirty, nothing to do.\n", iface); - } - - if (context) context_release(context); - - /* No longer dirty */ - This->baseTexture.texture_rgb.dirty = FALSE; -} - -static void volumetexture_cleanup(IWineD3DVolumeTextureImpl *This) -{ - unsigned int i; - - TRACE("(%p) : Cleaning up.\n", This); - - for (i = 0; i < This->baseTexture.level_count; ++i) - { - IWineD3DVolumeImpl *volume = (IWineD3DVolumeImpl *)This->baseTexture.sub_resources[i]; - - if (volume) - { - /* Cleanup the container. */ - volume_set_container(volume, NULL); - IWineD3DVolume_Release((IWineD3DVolume *)volume); - } - } - basetexture_cleanup((IWineD3DBaseTexture *)This); -} - -/* ******************************************* - IWineD3DTexture IUnknown parts follow - ******************************************* */ - -static HRESULT WINAPI IWineD3DVolumeTextureImpl_QueryInterface(IWineD3DVolumeTexture *iface, REFIID riid, LPVOID *ppobj) -{ - IWineD3DVolumeTextureImpl *This = (IWineD3DVolumeTextureImpl *)iface; - TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(riid),ppobj); - if (IsEqualGUID(riid, &IID_IUnknown) - || IsEqualGUID(riid, &IID_IWineD3DBase) - || IsEqualGUID(riid, &IID_IWineD3DResource) - || IsEqualGUID(riid, &IID_IWineD3DBaseTexture) - || IsEqualGUID(riid, &IID_IWineD3DVolumeTexture)) { - IUnknown_AddRef(iface); - *ppobj = This; - return S_OK; - } - *ppobj = NULL; - return E_NOINTERFACE; -} - -static ULONG WINAPI IWineD3DVolumeTextureImpl_AddRef(IWineD3DVolumeTexture *iface) { - IWineD3DVolumeTextureImpl *This = (IWineD3DVolumeTextureImpl *)iface; - TRACE("(%p) : AddRef increasing from %d\n", This, This->resource.ref); - return InterlockedIncrement(&This->resource.ref); -} - -/* Do not call while under the GL lock. */ -static ULONG WINAPI IWineD3DVolumeTextureImpl_Release(IWineD3DVolumeTexture *iface) { - IWineD3DVolumeTextureImpl *This = (IWineD3DVolumeTextureImpl *)iface; - ULONG ref; - TRACE("(%p) : Releasing from %d\n", This, This->resource.ref); - ref = InterlockedDecrement(&This->resource.ref); - if (!ref) - { - volumetexture_cleanup(This); - This->resource.parent_ops->wined3d_object_destroyed(This->resource.parent); - HeapFree(GetProcessHeap(), 0, This); - } - return ref; -} - -/* **************************************************** - IWineD3DVolumeTexture IWineD3DResource parts follow - **************************************************** */ -static HRESULT WINAPI IWineD3DVolumeTextureImpl_SetPrivateData(IWineD3DVolumeTexture *iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) { - return resource_set_private_data((IWineD3DResource *)iface, refguid, pData, SizeOfData, Flags); -} - -static HRESULT WINAPI IWineD3DVolumeTextureImpl_GetPrivateData(IWineD3DVolumeTexture *iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) { - return resource_get_private_data((IWineD3DResource *)iface, refguid, pData, pSizeOfData); -} - -static HRESULT WINAPI IWineD3DVolumeTextureImpl_FreePrivateData(IWineD3DVolumeTexture *iface, REFGUID refguid) { - return resource_free_private_data((IWineD3DResource *)iface, refguid); -} - -static DWORD WINAPI IWineD3DVolumeTextureImpl_SetPriority(IWineD3DVolumeTexture *iface, DWORD PriorityNew) { - return resource_set_priority((IWineD3DResource *)iface, PriorityNew); -} - -static DWORD WINAPI IWineD3DVolumeTextureImpl_GetPriority(IWineD3DVolumeTexture *iface) { - return resource_get_priority((IWineD3DResource *)iface); -} - -static void WINAPI IWineD3DVolumeTextureImpl_PreLoad(IWineD3DVolumeTexture *iface) { - volumetexture_internal_preload((IWineD3DBaseTexture *) iface, SRGB_ANY); -} - -/* Do not call while under the GL lock. */ -static void WINAPI IWineD3DVolumeTextureImpl_UnLoad(IWineD3DVolumeTexture *iface) { - unsigned int i; - IWineD3DVolumeTextureImpl *This = (IWineD3DVolumeTextureImpl *)iface; - TRACE("(%p)\n", This); - - /* Unload all the surfaces and reset the texture name. If UnLoad was called on the - * surface before, this one will be a NOP and vice versa. Unloading an unloaded - * surface is fine - */ - for (i = 0; i < This->baseTexture.level_count; ++i) - { - IWineD3DVolume_UnLoad((IWineD3DVolume *)This->baseTexture.sub_resources[i]); - } - - basetexture_unload((IWineD3DBaseTexture *)iface); -} - -static WINED3DRESOURCETYPE WINAPI IWineD3DVolumeTextureImpl_GetType(IWineD3DVolumeTexture *iface) { - return resource_get_type((IWineD3DResource *)iface); -} - -static void * WINAPI IWineD3DVolumeTextureImpl_GetParent(IWineD3DVolumeTexture *iface) -{ - TRACE("iface %p\n", iface); - - return ((IWineD3DVolumeTextureImpl *)iface)->resource.parent; -} - -/* ****************************************************** - IWineD3DVolumeTexture IWineD3DBaseTexture parts follow - ****************************************************** */ -static DWORD WINAPI IWineD3DVolumeTextureImpl_SetLOD(IWineD3DVolumeTexture *iface, DWORD LODNew) { - return basetexture_set_lod((IWineD3DBaseTexture *)iface, LODNew); -} - -static DWORD WINAPI IWineD3DVolumeTextureImpl_GetLOD(IWineD3DVolumeTexture *iface) { - return basetexture_get_lod((IWineD3DBaseTexture *)iface); -} - -static DWORD WINAPI IWineD3DVolumeTextureImpl_GetLevelCount(IWineD3DVolumeTexture *iface) { - return basetexture_get_level_count((IWineD3DBaseTexture *)iface); -} - -static HRESULT WINAPI IWineD3DVolumeTextureImpl_SetAutoGenFilterType(IWineD3DVolumeTexture *iface, WINED3DTEXTUREFILTERTYPE FilterType) { - return basetexture_set_autogen_filter_type((IWineD3DBaseTexture *)iface, FilterType); -} - -static WINED3DTEXTUREFILTERTYPE WINAPI IWineD3DVolumeTextureImpl_GetAutoGenFilterType(IWineD3DVolumeTexture *iface) { - return basetexture_get_autogen_filter_type((IWineD3DBaseTexture *)iface); -} - -static void WINAPI IWineD3DVolumeTextureImpl_GenerateMipSubLevels(IWineD3DVolumeTexture *iface) { - basetexture_generate_mipmaps((IWineD3DBaseTexture *)iface); -} - -/* Internal function, No d3d mapping */ -static BOOL WINAPI IWineD3DVolumeTextureImpl_SetDirty(IWineD3DVolumeTexture *iface, BOOL dirty) { - return basetexture_set_dirty((IWineD3DBaseTexture *)iface, dirty); -} - -static BOOL WINAPI IWineD3DVolumeTextureImpl_GetDirty(IWineD3DVolumeTexture *iface) { - return basetexture_get_dirty((IWineD3DBaseTexture *)iface); -} - -/* Context activation is done by the caller. */ -static HRESULT WINAPI IWineD3DVolumeTextureImpl_BindTexture(IWineD3DVolumeTexture *iface, BOOL srgb) -{ - BOOL dummy; - - TRACE("iface %p, srgb %#x.\n", iface, srgb); - - return basetexture_bind((IWineD3DBaseTexture *)iface, srgb, &dummy); -} - -static BOOL WINAPI IWineD3DVolumeTextureImpl_IsCondNP2(IWineD3DVolumeTexture *iface) -{ - TRACE("iface %p.\n", iface); - - return FALSE; -} - -/* ******************************************* - IWineD3DVolumeTexture IWineD3DVolumeTexture parts follow - ******************************************* */ -static HRESULT WINAPI IWineD3DVolumeTextureImpl_GetLevelDesc(IWineD3DVolumeTexture *iface, - UINT level, WINED3DVOLUME_DESC *desc) -{ - IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)iface; - IWineD3DVolume *volume; - - TRACE("iface %p, level %u, desc %p.\n", iface, level, desc); - - if (!(volume = (IWineD3DVolume *)basetexture_get_sub_resource(texture, 0, level))) - { - WARN("Failed to get sub-resource.\n"); - return WINED3DERR_INVALIDCALL; - } - - IWineD3DVolume_GetDesc(volume, desc); - - return WINED3D_OK; -} - -static HRESULT WINAPI IWineD3DVolumeTextureImpl_GetVolumeLevel(IWineD3DVolumeTexture *iface, - UINT level, IWineD3DVolume **volume) -{ - IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)iface; - IWineD3DVolume *v; - - TRACE("iface %p, level %u, volume %p.\n", iface, level, volume); - - if (!(v = (IWineD3DVolume *)basetexture_get_sub_resource(texture, 0, level))) - { - WARN("Failed to get sub-resource.\n"); - return WINED3DERR_INVALIDCALL; - } - - IWineD3DVolume_AddRef(v); - *volume = v; - - TRACE("Returning volume %p.\n", *volume); - - return WINED3D_OK; -} - -static HRESULT WINAPI IWineD3DVolumeTextureImpl_LockBox(IWineD3DVolumeTexture *iface, - UINT level, WINED3DLOCKED_BOX *locked_box, const WINED3DBOX *box, DWORD flags) -{ - IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)iface; - IWineD3DVolume *volume; - - TRACE("iface %p, level %u, locked_box %p, box %p, flags %#x.\n", - iface, level, locked_box, box, flags); - - if (!(volume = (IWineD3DVolume *)basetexture_get_sub_resource(texture, 0, level))) - { - WARN("Failed to get sub-resource.\n"); - return WINED3DERR_INVALIDCALL; - } - - return IWineD3DVolume_LockBox(volume, locked_box, box, flags); -} - -static HRESULT WINAPI IWineD3DVolumeTextureImpl_UnlockBox(IWineD3DVolumeTexture *iface, UINT level) -{ - IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)iface; - IWineD3DVolume *volume; - - TRACE("iface %p, level %u.\n", iface, level); - - if (!(volume = (IWineD3DVolume *)basetexture_get_sub_resource(texture, 0, level))) - { - WARN("Failed to get sub-resource.\n"); - return WINED3DERR_INVALIDCALL; - } - - return IWineD3DVolume_UnlockBox(volume); -} - -static HRESULT WINAPI IWineD3DVolumeTextureImpl_AddDirtyBox(IWineD3DVolumeTexture *iface, const WINED3DBOX *dirty_box) -{ - IWineD3DBaseTextureImpl *texture = (IWineD3DBaseTextureImpl *)iface; - IWineD3DVolume *volume; - - TRACE("iface %p, dirty_box %p.\n", iface, dirty_box); - - if (!(volume = (IWineD3DVolume *)basetexture_get_sub_resource(texture, 0, 0))) - { - WARN("Failed to get sub-resource.\n"); - return WINED3DERR_INVALIDCALL; - } - - texture->baseTexture.texture_rgb.dirty = TRUE; - texture->baseTexture.texture_srgb.dirty = TRUE; - volume_add_dirty_box(volume, dirty_box); - - return WINED3D_OK; -} - -static const IWineD3DVolumeTextureVtbl IWineD3DVolumeTexture_Vtbl = -{ - /* IUnknown */ - IWineD3DVolumeTextureImpl_QueryInterface, - IWineD3DVolumeTextureImpl_AddRef, - IWineD3DVolumeTextureImpl_Release, - /* resource */ - IWineD3DVolumeTextureImpl_GetParent, - IWineD3DVolumeTextureImpl_SetPrivateData, - IWineD3DVolumeTextureImpl_GetPrivateData, - IWineD3DVolumeTextureImpl_FreePrivateData, - IWineD3DVolumeTextureImpl_SetPriority, - IWineD3DVolumeTextureImpl_GetPriority, - IWineD3DVolumeTextureImpl_PreLoad, - IWineD3DVolumeTextureImpl_UnLoad, - IWineD3DVolumeTextureImpl_GetType, - /* BaseTexture */ - IWineD3DVolumeTextureImpl_SetLOD, - IWineD3DVolumeTextureImpl_GetLOD, - IWineD3DVolumeTextureImpl_GetLevelCount, - IWineD3DVolumeTextureImpl_SetAutoGenFilterType, - IWineD3DVolumeTextureImpl_GetAutoGenFilterType, - IWineD3DVolumeTextureImpl_GenerateMipSubLevels, - IWineD3DVolumeTextureImpl_SetDirty, - IWineD3DVolumeTextureImpl_GetDirty, - /* not in d3d */ - IWineD3DVolumeTextureImpl_BindTexture, - IWineD3DVolumeTextureImpl_IsCondNP2, - /* volume texture */ - IWineD3DVolumeTextureImpl_GetLevelDesc, - IWineD3DVolumeTextureImpl_GetVolumeLevel, - IWineD3DVolumeTextureImpl_LockBox, - IWineD3DVolumeTextureImpl_UnlockBox, - IWineD3DVolumeTextureImpl_AddDirtyBox -}; - -HRESULT volumetexture_init(IWineD3DVolumeTextureImpl *texture, UINT width, UINT height, - UINT depth, UINT levels, IWineD3DDeviceImpl *device, DWORD usage, enum wined3d_format_id format_id, - WINED3DPOOL pool, void *parent, const struct wined3d_parent_ops *parent_ops) -{ - const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; - const struct wined3d_format *format = wined3d_get_format(gl_info, format_id); - UINT tmp_w, tmp_h, tmp_d; - unsigned int i; - HRESULT hr; - - /* TODO: It should only be possible to create textures for formats - * that are reported as supported. */ - if (WINED3DFMT_UNKNOWN >= format_id) - { - WARN("(%p) : Texture cannot be created with a format of WINED3DFMT_UNKNOWN.\n", texture); - return WINED3DERR_INVALIDCALL; - } - - if (!gl_info->supported[EXT_TEXTURE3D]) - { - WARN("(%p) : Texture cannot be created - no volume texture support.\n", texture); - return WINED3DERR_INVALIDCALL; - } - - /* Calculate levels for mip mapping. */ - if (usage & WINED3DUSAGE_AUTOGENMIPMAP) - { - if (!gl_info->supported[SGIS_GENERATE_MIPMAP]) - { - WARN("No mipmap generation support, returning D3DERR_INVALIDCALL.\n"); - return WINED3DERR_INVALIDCALL; - } - - if (levels > 1) - { - WARN("D3DUSAGE_AUTOGENMIPMAP is set, and level count > 1, returning D3DERR_INVALIDCALL.\n"); - return WINED3DERR_INVALIDCALL; - } - - levels = 1; - } - else if (!levels) - { - levels = wined3d_log2i(max(max(width, height), depth)) + 1; - TRACE("Calculated levels = %u.\n", levels); - } - - texture->lpVtbl = &IWineD3DVolumeTexture_Vtbl; - - hr = basetexture_init((IWineD3DBaseTextureImpl *)texture, 1, levels, - WINED3DRTYPE_VOLUMETEXTURE, device, 0, usage, format, pool, parent, parent_ops); - if (FAILED(hr)) - { - WARN("Failed to initialize basetexture, returning %#x.\n", hr); - return hr; - } - - /* Is NP2 support for volumes needed? */ - texture->baseTexture.pow2Matrix[0] = 1.0f; - texture->baseTexture.pow2Matrix[5] = 1.0f; - texture->baseTexture.pow2Matrix[10] = 1.0f; - texture->baseTexture.pow2Matrix[15] = 1.0f; - texture->baseTexture.target = GL_TEXTURE_3D; - - /* Generate all the surfaces. */ - tmp_w = width; - tmp_h = height; - tmp_d = depth; - - for (i = 0; i < texture->baseTexture.level_count; ++i) - { - IWineD3DVolume *volume; - - /* Create the volume. */ - hr = IWineD3DDeviceParent_CreateVolume(device->device_parent, parent, - tmp_w, tmp_h, tmp_d, format_id, pool, usage, &volume); - if (FAILED(hr)) - { - ERR("Creating a volume for the volume texture failed, hr %#x.\n", hr); - volumetexture_cleanup(texture); - return hr; - } - - /* Set its container to this texture. */ - volume_set_container((IWineD3DVolumeImpl *)volume, texture); - texture->baseTexture.sub_resources[i] = (IWineD3DResourceImpl *)volume; - - /* Calculate the next mipmap level. */ - tmp_w = max(1, tmp_w >> 1); - tmp_h = max(1, tmp_h >> 1); - tmp_d = max(1, tmp_d >> 1); - } - texture->baseTexture.internal_preload = volumetexture_internal_preload; - - return WINED3D_OK; -} diff --git a/dll/directx/wine/wined3d/wined3d.rbuild b/dll/directx/wine/wined3d/wined3d.rbuild index 56fe6eea97c..18d6662ff35 100644 --- a/dll/directx/wine/wined3d/wined3d.rbuild +++ b/dll/directx/wine/wined3d/wined3d.rbuild @@ -17,11 +17,9 @@ ati_fragment_shader.c arb_program_shader.c - basetexture.c buffer.c clipper.c context.c - cubetexture.c device.c directx.c drawprim.c @@ -36,20 +34,16 @@ shader_sm4.c state.c stateblock.c - surface_base.c surface.c - surface_gdi.c swapchain.c - swapchain_base.c - swapchain_gdi.c texture.c utils.c vertexdeclaration.c view.c volume.c - volumetexture.c wined3d_main.c version.rc + wined3d_private.h powf.c sqrtf.c diff --git a/dll/directx/wine/wined3d/wined3d.spec b/dll/directx/wine/wined3d/wined3d.spec index c375b385d49..fd8e8ea4293 100644 --- a/dll/directx/wine/wined3d/wined3d.spec +++ b/dll/directx/wine/wined3d/wined3d.spec @@ -1,4 +1,298 @@ -@ stdcall WineDirect3DCreate(long ptr) -@ stdcall WineDirect3DCreateClipper() @ stdcall wined3d_mutex_lock() @ stdcall wined3d_mutex_unlock() + +@ cdecl wined3d_check_depth_stencil_match(ptr long long long long long) +@ cdecl wined3d_check_device_format(ptr long long long long long long long) +@ cdecl wined3d_check_device_format_conversion(ptr long long long long) +@ cdecl wined3d_check_device_multisample_type(ptr long long long long long ptr) +@ cdecl wined3d_check_device_type(ptr long long long long long) +@ cdecl wined3d_create(long ptr) +@ cdecl wined3d_decref(ptr) +@ cdecl wined3d_enum_adapter_modes(ptr long long long ptr) +@ cdecl wined3d_get_adapter_count(ptr) +@ cdecl wined3d_get_adapter_display_mode(ptr long ptr) +@ cdecl wined3d_get_adapter_identifier(ptr long long ptr) +@ cdecl wined3d_get_adapter_mode_count(ptr long long) +@ cdecl wined3d_get_adapter_monitor(ptr long) +@ cdecl wined3d_get_device_caps(ptr long long ptr) +@ cdecl wined3d_get_parent(ptr) +@ cdecl wined3d_incref(ptr) +@ cdecl wined3d_register_software_device(ptr ptr) + +@ cdecl wined3d_buffer_create(ptr ptr ptr ptr ptr ptr) +@ cdecl wined3d_buffer_create_ib(ptr long long long ptr ptr ptr) +@ cdecl wined3d_buffer_create_vb(ptr long long long ptr ptr ptr) +@ cdecl wined3d_buffer_decref(ptr) +@ cdecl wined3d_buffer_free_private_data(ptr ptr) +@ cdecl wined3d_buffer_get_parent(ptr) +@ cdecl wined3d_buffer_get_priority(ptr) +@ cdecl wined3d_buffer_get_private_data(ptr ptr ptr ptr) +@ cdecl wined3d_buffer_get_resource(ptr) +@ cdecl wined3d_buffer_incref(ptr) +@ cdecl wined3d_buffer_map(ptr long long ptr long) +@ cdecl wined3d_buffer_preload(ptr) +@ cdecl wined3d_buffer_set_priority(ptr long) +@ cdecl wined3d_buffer_set_private_data(ptr ptr ptr long long) +@ cdecl wined3d_buffer_unmap(ptr) + +@ cdecl wined3d_clipper_create() +@ cdecl wined3d_clipper_decref(ptr) +@ cdecl wined3d_clipper_get_clip_list(ptr ptr ptr ptr) +@ cdecl wined3d_clipper_get_window(ptr ptr) +@ cdecl wined3d_clipper_incref(ptr) +@ cdecl wined3d_clipper_is_clip_list_changed(ptr ptr) +@ cdecl wined3d_clipper_set_clip_list(ptr ptr long) +@ cdecl wined3d_clipper_set_window(ptr long ptr) + +@ cdecl wined3d_device_acquire_focus_window(ptr ptr) +@ cdecl wined3d_device_begin_scene(ptr) +@ cdecl wined3d_device_begin_stateblock(ptr) +@ cdecl wined3d_device_clear(ptr long ptr long long long long) +@ cdecl wined3d_device_clear_rendertarget_view(ptr ptr ptr) +@ cdecl wined3d_device_color_fill(ptr ptr ptr ptr) +@ cdecl wined3d_device_create(ptr long long ptr long ptr ptr) +@ cdecl wined3d_device_decref(ptr) +@ cdecl wined3d_device_delete_patch(ptr long) +@ cdecl wined3d_device_draw_indexed_primitive(ptr long long) +@ cdecl wined3d_device_draw_indexed_primitive_strided(ptr long ptr long ptr long) +@ cdecl wined3d_device_draw_indexed_primitive_up(ptr long ptr long ptr long) +@ cdecl wined3d_device_draw_primitive(ptr long long) +@ cdecl wined3d_device_draw_primitive_strided(ptr long ptr) +@ cdecl wined3d_device_draw_primitive_up(ptr long ptr long) +@ cdecl wined3d_device_draw_rect_patch(ptr long ptr ptr) +@ cdecl wined3d_device_draw_tri_patch(ptr long ptr ptr) +@ cdecl wined3d_device_end_scene(ptr) +@ cdecl wined3d_device_end_stateblock(ptr ptr) +@ cdecl wined3d_device_enum_resources(ptr ptr ptr) +@ cdecl wined3d_device_evict_managed_resources(ptr) +@ cdecl wined3d_device_get_available_texture_mem(ptr) +@ cdecl wined3d_device_get_back_buffer(ptr long long long ptr) +@ cdecl wined3d_device_get_base_vertex_index(ptr) +@ cdecl wined3d_device_get_clip_plane(ptr long ptr) +@ cdecl wined3d_device_get_clip_status(ptr ptr) +@ cdecl wined3d_device_get_creation_parameters(ptr ptr) +@ cdecl wined3d_device_get_current_texture_palette(ptr ptr) +@ cdecl wined3d_device_get_depth_stencil(ptr ptr) +@ cdecl wined3d_device_get_device_caps(ptr ptr) +@ cdecl wined3d_device_get_display_mode(ptr long ptr) +@ cdecl wined3d_device_get_front_buffer_data(ptr long ptr) +@ cdecl wined3d_device_get_gamma_ramp(ptr long ptr) +@ cdecl wined3d_device_get_index_buffer(ptr ptr) +@ cdecl wined3d_device_get_light(ptr long ptr) +@ cdecl wined3d_device_get_light_enable(ptr long ptr) +@ cdecl wined3d_device_get_material(ptr ptr) +@ cdecl wined3d_device_get_npatch_mode(ptr) +@ cdecl wined3d_device_get_palette_entries(ptr long ptr) +@ cdecl wined3d_device_get_pixel_shader(ptr) +@ cdecl wined3d_device_get_primitive_type(ptr ptr) +@ cdecl wined3d_device_get_ps_consts_b(ptr long ptr long) +@ cdecl wined3d_device_get_ps_consts_f(ptr long ptr long) +@ cdecl wined3d_device_get_ps_consts_i(ptr long ptr long) +@ cdecl wined3d_device_get_raster_status(ptr long ptr) +@ cdecl wined3d_device_get_render_state(ptr long ptr) +@ cdecl wined3d_device_get_render_target(ptr long ptr) +@ cdecl wined3d_device_get_sampler_state(ptr long long ptr) +@ cdecl wined3d_device_get_scissor_rect(ptr ptr) +@ cdecl wined3d_device_get_software_vertex_processing(ptr) +@ cdecl wined3d_device_get_stream_source(ptr long ptr ptr ptr) +@ cdecl wined3d_device_get_stream_source_freq(ptr long ptr) +@ cdecl wined3d_device_get_surface_from_dc(ptr ptr ptr) +@ cdecl wined3d_device_get_swapchain(ptr long ptr) +@ cdecl wined3d_device_get_swapchain_count(ptr) +@ cdecl wined3d_device_get_texture(ptr long ptr) +@ cdecl wined3d_device_get_texture_stage_state(ptr long long ptr) +@ cdecl wined3d_device_get_transform(ptr long ptr) +@ cdecl wined3d_device_get_vertex_declaration(ptr ptr) +@ cdecl wined3d_device_get_vertex_shader(ptr) +@ cdecl wined3d_device_get_viewport(ptr ptr) +@ cdecl wined3d_device_get_vs_consts_b(ptr long ptr long) +@ cdecl wined3d_device_get_vs_consts_f(ptr long ptr long) +@ cdecl wined3d_device_get_vs_consts_i(ptr long ptr long) +@ cdecl wined3d_device_get_wined3d(ptr ptr) +@ cdecl wined3d_device_incref(ptr) +@ cdecl wined3d_device_init_3d(ptr ptr) +@ cdecl wined3d_device_init_gdi(ptr ptr) +@ cdecl wined3d_device_multiply_transform(ptr long ptr) +@ cdecl wined3d_device_present(ptr ptr ptr ptr ptr) +@ cdecl wined3d_device_process_vertices(ptr long long long ptr ptr long long) +@ cdecl wined3d_device_release_focus_window(ptr) +@ cdecl wined3d_device_reset(ptr ptr) +@ cdecl wined3d_device_restore_fullscreen_window(ptr ptr) +@ cdecl wined3d_device_set_base_vertex_index(ptr long) +@ cdecl wined3d_device_set_clip_plane(ptr long ptr) +@ cdecl wined3d_device_set_clip_status(ptr ptr) +@ cdecl wined3d_device_set_current_texture_palette(ptr long) +@ cdecl wined3d_device_set_cursor_position(ptr long long long) +@ cdecl wined3d_device_set_cursor_properties(ptr long long ptr) +@ cdecl wined3d_device_set_depth_stencil(ptr ptr) +@ cdecl wined3d_device_set_dialog_box_mode(ptr long) +@ cdecl wined3d_device_set_display_mode(ptr long ptr) +@ cdecl wined3d_device_set_gamma_ramp(ptr long long ptr) +@ cdecl wined3d_device_set_index_buffer(ptr ptr long) +@ cdecl wined3d_device_set_light(ptr long ptr) +@ cdecl wined3d_device_set_light_enable(ptr long long) +@ cdecl wined3d_device_set_material(ptr ptr) +@ cdecl wined3d_device_set_multithreaded(ptr) +@ cdecl wined3d_device_set_npatch_mode(ptr long) +@ cdecl wined3d_device_set_palette_entries(ptr long ptr) +@ cdecl wined3d_device_set_pixel_shader(ptr ptr) +@ cdecl wined3d_device_set_primitive_type(ptr long) +@ cdecl wined3d_device_set_ps_consts_b(ptr long ptr long) +@ cdecl wined3d_device_set_ps_consts_f(ptr long ptr long) +@ cdecl wined3d_device_set_ps_consts_i(ptr long ptr long) +@ cdecl wined3d_device_set_render_state(ptr long long) +@ cdecl wined3d_device_set_render_target(ptr long ptr long) +@ cdecl wined3d_device_set_sampler_state(ptr long long long) +@ cdecl wined3d_device_set_scissor_rect(ptr ptr) +@ cdecl wined3d_device_set_software_vertex_processing(ptr long) +@ cdecl wined3d_device_set_stream_source(ptr long ptr long long) +@ cdecl wined3d_device_set_stream_source_freq(ptr long long) +@ cdecl wined3d_device_set_texture(ptr long ptr) +@ cdecl wined3d_device_set_texture_stage_state(ptr long long long) +@ cdecl wined3d_device_set_transform(ptr long ptr) +@ cdecl wined3d_device_set_vertex_declaration(ptr ptr) +@ cdecl wined3d_device_set_vertex_shader(ptr ptr) +@ cdecl wined3d_device_set_viewport(ptr ptr) +@ cdecl wined3d_device_set_vs_consts_b(ptr long ptr long) +@ cdecl wined3d_device_set_vs_consts_f(ptr long ptr long) +@ cdecl wined3d_device_set_vs_consts_i(ptr long ptr long) +@ cdecl wined3d_device_setup_fullscreen_window(ptr ptr long long) +@ cdecl wined3d_device_show_cursor(ptr long) +@ cdecl wined3d_device_uninit_3d(ptr) +@ cdecl wined3d_device_uninit_gdi(ptr) +@ cdecl wined3d_device_update_surface(ptr ptr ptr ptr ptr) +@ cdecl wined3d_device_update_texture(ptr ptr ptr) +@ cdecl wined3d_device_validate_device(ptr ptr) + +@ cdecl wined3d_palette_create(ptr long ptr ptr ptr) +@ cdecl wined3d_palette_decref(ptr) +@ cdecl wined3d_palette_get_entries(ptr long long long ptr) +@ cdecl wined3d_palette_get_flags(ptr) +@ cdecl wined3d_palette_get_parent(ptr) +@ cdecl wined3d_palette_incref(ptr) +@ cdecl wined3d_palette_set_entries(ptr long long long ptr) + +@ cdecl wined3d_query_create(ptr long ptr) +@ cdecl wined3d_query_decref(ptr) +@ cdecl wined3d_query_get_data(ptr ptr long long) +@ cdecl wined3d_query_get_data_size(ptr) +@ cdecl wined3d_query_get_type(ptr) +@ cdecl wined3d_query_incref(ptr) +@ cdecl wined3d_query_issue(ptr long) + +@ cdecl wined3d_resource_get_desc(ptr ptr) +@ cdecl wined3d_resource_get_parent(ptr) + +@ cdecl wined3d_rendertarget_view_create(ptr ptr ptr) +@ cdecl wined3d_rendertarget_view_decref(ptr) +@ cdecl wined3d_rendertarget_view_get_parent(ptr) +@ cdecl wined3d_rendertarget_view_get_resource(ptr) +@ cdecl wined3d_rendertarget_view_incref(ptr) + +@ cdecl wined3d_shader_create_gs(ptr ptr ptr ptr ptr ptr) +@ cdecl wined3d_shader_create_ps(ptr ptr ptr ptr ptr ptr) +@ cdecl wined3d_shader_create_vs(ptr ptr ptr ptr ptr ptr) +@ cdecl wined3d_shader_decref(ptr) +@ cdecl wined3d_shader_get_byte_code(ptr ptr ptr) +@ cdecl wined3d_shader_get_parent(ptr) +@ cdecl wined3d_shader_incref(ptr) +@ cdecl wined3d_shader_set_local_constants_float(ptr long ptr long) + +@ cdecl wined3d_stateblock_apply(ptr) +@ cdecl wined3d_stateblock_capture(ptr) +@ cdecl wined3d_stateblock_create(ptr long ptr) +@ cdecl wined3d_stateblock_decref(ptr) +@ cdecl wined3d_stateblock_incref(ptr) + +@ cdecl wined3d_surface_blt(ptr ptr ptr ptr long ptr long) +@ cdecl wined3d_surface_bltfast(ptr long long ptr ptr long) +@ cdecl wined3d_surface_create(ptr long long long long long long long long long long long ptr ptr ptr) +@ cdecl wined3d_surface_decref(ptr) +@ cdecl wined3d_surface_flip(ptr ptr long) +@ cdecl wined3d_surface_free_private_data(ptr ptr) +@ cdecl wined3d_surface_get_blt_status(ptr long) +@ cdecl wined3d_surface_get_clipper(ptr) +@ cdecl wined3d_surface_get_flip_status(ptr long) +@ cdecl wined3d_surface_get_overlay_position(ptr ptr ptr) +@ cdecl wined3d_surface_get_palette(ptr) +@ cdecl wined3d_surface_get_parent(ptr) +@ cdecl wined3d_surface_get_pitch(ptr) +@ cdecl wined3d_surface_get_priority(ptr) +@ cdecl wined3d_surface_get_private_data(ptr ptr ptr ptr) +@ cdecl wined3d_surface_get_resource(ptr) +@ cdecl wined3d_surface_getdc(ptr ptr) +@ cdecl wined3d_surface_incref(ptr) +@ cdecl wined3d_surface_is_lost(ptr) +@ cdecl wined3d_surface_map(ptr ptr ptr long) +@ cdecl wined3d_surface_preload(ptr) +@ cdecl wined3d_surface_releasedc(ptr ptr) +@ cdecl wined3d_surface_restore(ptr) +@ cdecl wined3d_surface_set_clipper(ptr ptr) +@ cdecl wined3d_surface_set_color_key(ptr long ptr) +@ cdecl wined3d_surface_set_format(ptr long) +@ cdecl wined3d_surface_set_mem(ptr ptr) +@ cdecl wined3d_surface_set_overlay_position(ptr long long) +@ cdecl wined3d_surface_set_palette(ptr ptr) +@ cdecl wined3d_surface_set_priority(ptr long) +@ cdecl wined3d_surface_set_private_data(ptr ptr ptr long long) +@ cdecl wined3d_surface_unmap(ptr) +@ cdecl wined3d_surface_update_overlay(ptr ptr ptr ptr long ptr) +@ cdecl wined3d_surface_update_overlay_z_order(ptr long ptr) + +@ cdecl wined3d_swapchain_create(ptr ptr long ptr ptr ptr) +@ cdecl wined3d_swapchain_decref(ptr) +@ cdecl wined3d_swapchain_get_back_buffer(ptr long long ptr) +@ cdecl wined3d_swapchain_get_device(ptr) +@ cdecl wined3d_swapchain_get_display_mode(ptr ptr) +@ cdecl wined3d_swapchain_get_front_buffer_data(ptr ptr) +@ cdecl wined3d_swapchain_get_gamma_ramp(ptr ptr) +@ cdecl wined3d_swapchain_get_parent(ptr) +@ cdecl wined3d_swapchain_get_present_parameters(ptr ptr) +@ cdecl wined3d_swapchain_get_raster_status(ptr ptr) +@ cdecl wined3d_swapchain_incref(ptr) +@ cdecl wined3d_swapchain_present(ptr ptr ptr ptr ptr long) +@ cdecl wined3d_swapchain_set_gamma_ramp(ptr long ptr) +@ cdecl wined3d_swapchain_set_window(ptr ptr) + +@ cdecl wined3d_texture_add_dirty_region(ptr long ptr) +@ cdecl wined3d_texture_create_2d(ptr long long long long long long ptr ptr ptr) +@ cdecl wined3d_texture_create_3d(ptr long long long long long long long ptr ptr ptr) +@ cdecl wined3d_texture_create_cube(ptr long long long long long ptr ptr ptr) +@ cdecl wined3d_texture_decref(ptr) +@ cdecl wined3d_texture_free_private_data(ptr ptr) +@ cdecl wined3d_texture_generate_mipmaps(ptr) +@ cdecl wined3d_texture_get_autogen_filter_type(ptr) +@ cdecl wined3d_texture_get_level_count(ptr) +@ cdecl wined3d_texture_get_lod(ptr) +@ cdecl wined3d_texture_get_parent(ptr) +@ cdecl wined3d_texture_get_priority(ptr) +@ cdecl wined3d_texture_get_private_data(ptr ptr ptr ptr) +@ cdecl wined3d_texture_get_sub_resource(ptr long) +@ cdecl wined3d_texture_get_type(ptr) +@ cdecl wined3d_texture_incref(ptr) +@ cdecl wined3d_texture_preload(ptr) +@ cdecl wined3d_texture_set_autogen_filter_type(ptr long) +@ cdecl wined3d_texture_set_lod(ptr long) +@ cdecl wined3d_texture_set_priority(ptr long) +@ cdecl wined3d_texture_set_private_data(ptr ptr ptr long long) + +@ cdecl wined3d_vertex_declaration_create(ptr ptr long ptr ptr ptr) +@ cdecl wined3d_vertex_declaration_create_from_fvf(ptr long ptr ptr ptr) +@ cdecl wined3d_vertex_declaration_decref(ptr) +@ cdecl wined3d_vertex_declaration_get_parent(ptr) +@ cdecl wined3d_vertex_declaration_incref(ptr) + +@ cdecl wined3d_volume_create(ptr long long long long long long ptr ptr ptr) +@ cdecl wined3d_volume_decref(ptr) +@ cdecl wined3d_volume_free_private_data(ptr ptr) +@ cdecl wined3d_volume_from_resource(ptr) +@ cdecl wined3d_volume_get_parent(ptr) +@ cdecl wined3d_volume_get_priority(ptr) +@ cdecl wined3d_volume_get_private_data(ptr ptr ptr ptr) +@ cdecl wined3d_volume_get_resource(ptr) +@ cdecl wined3d_volume_incref(ptr) +@ cdecl wined3d_volume_map(ptr ptr ptr long) +@ cdecl wined3d_volume_preload(ptr) +@ cdecl wined3d_volume_set_priority(ptr long) +@ cdecl wined3d_volume_set_private_data(ptr ptr ptr long long) +@ cdecl wined3d_volume_unmap(ptr) diff --git a/dll/directx/wine/wined3d/wined3d_gl.h b/dll/directx/wine/wined3d/wined3d_gl.h index 9c2c0c1594c..be50b2f672b 100644 --- a/dll/directx/wine/wined3d/wined3d_gl.h +++ b/dll/directx/wine/wined3d/wined3d_gl.h @@ -1744,7 +1744,6 @@ typedef enum wined3d_gl_extension ARB_GEOMETRY_SHADER4, ARB_HALF_FLOAT_PIXEL, ARB_HALF_FLOAT_VERTEX, - ARB_IMAGING, ARB_MAP_BUFFER_RANGE, ARB_MULTISAMPLE, ARB_MULTITEXTURE, @@ -1786,6 +1785,7 @@ typedef enum wined3d_gl_extension EXT_BLEND_EQUATION_SEPARATE, EXT_BLEND_FUNC_SEPARATE, EXT_BLEND_MINMAX, + EXT_BLEND_SUBTRACT, EXT_DRAW_BUFFERS2, EXT_DEPTH_BOUNDS_TEST, EXT_FOG_COORD, @@ -1810,6 +1810,7 @@ typedef enum wined3d_gl_extension EXT_TEXTURE_FILTER_ANISOTROPIC, EXT_TEXTURE_LOD_BIAS, EXT_TEXTURE_SRGB, + EXT_TEXTURE_SRGB_DECODE, EXT_VERTEX_ARRAY_BGRA, /* NVIDIA */ NV_DEPTH_CLAMP, @@ -1834,9 +1835,9 @@ typedef enum wined3d_gl_extension NV_VERTEX_PROGRAM3, /* SGI */ SGIS_GENERATE_MIPMAP, - SGI_VIDEO_SYNC, /* WGL extensions */ WGL_ARB_PIXEL_FORMAT, + WGL_EXT_SWAP_CONTROL, WGL_WINE_PIXEL_FORMAT_PASSTHROUGH, /* Internally used */ WINED3D_GL_NORMALIZED_TEXRECT, @@ -2146,88 +2147,6 @@ typedef void (WINE_GLAPI *PGLFNFRAMEBUFFERTEXTUREFACEARBPROC)(GLenum target, GLe #define GL_HALF_FLOAT 0x140b #endif -/* GL_ARB_imaging */ -#ifndef GL_ARB_imaging -#define GL_ARB_imaging 1 -#define GL_CONSTANT_COLOR 0x8001 -#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 -#define GL_CONSTANT_ALPHA 0x8003 -#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 -#define GL_BLEND_COLOR 0x8005 -#define GL_FUNC_ADD 0x8006 -#define GL_MIN 0x8007 -#define GL_MAX 0x8008 -#define GL_BLEND_EQUATION 0x8009 -#define GL_FUNC_SUBTRACT 0x800a -#define GL_FUNC_REVERSE_SUBTRACT 0x800b -#define GL_CONVOLUTION_1D 0x8010 -#define GL_CONVOLUTION_2D 0x8011 -#define GL_SEPARABLE_2D 0x8012 -#define GL_CONVOLUTION_BORDER_MODE 0x8013 -#define GL_CONVOLUTION_FILTER_SCALE 0x8014 -#define GL_CONVOLUTION_FILTER_BIAS 0x8015 -#define GL_REDUCE 0x8016 -#define GL_CONVOLUTION_FORMAT 0x8017 -#define GL_CONVOLUTION_WIDTH 0x8018 -#define GL_CONVOLUTION_HEIGHT 0x8019 -#define GL_MAX_CONVOLUTION_WIDTH 0x801a -#define GL_MAX_CONVOLUTION_HEIGHT 0x801b -#define GL_POST_CONVOLUTION_RED_SCALE 0x801d -#define GL_POST_CONVOLUTION_GREEN_SCALE 0x801f -#define GL_POST_CONVOLUTION_BLUE_SCALE 0x801e -#define GL_POST_CONVOLUTION_ALPHA_SCALE 0x801f -#define GL_POST_CONVOLUTION_RED_BIAS 0x8020 -#define GL_POST_CONVOLUTION_GREEN_BIAS 0x8021 -#define GL_POST_CONVOLUTION_BLUE_BIAS 0x8022 -#define GL_POST_CONVOLUTION_ALPHA_BIAS 0x8023 -#define GL_HISTOGRAM 0x8024 -#define GL_PROXY_HISTOGRAM 0x8025 -#define GL_HISTOGRAM_WIDTH 0x8026 -#define GL_HISTOGRAM_FORMAT 0x8027 -#define GL_HISTOGRAM_RED_SIZE 0x8028 -#define GL_HISTOGRAM_GREEN_SIZE 0x8029 -#define GL_HISTOGRAM_BLUE_SIZE 0x802a -#define GL_HISTOGRAM_ALPHA_SIZE 0x802b -#define GL_HISTOGRAM_LUMINANCE_SIZE 0x802c -#define GL_HISTOGRAM_SINK 0x802d -#define GL_MINMAX 0x802e -#define GL_MINMAX_FORMAT 0x802f -#define GL_MINMAX_SINK 0x8030 -#define GL_TABLE_TOO_LARGE 0x8031 -#define GL_COLOR_MATRIX 0x80b1 -#define GL_COLOR_MATRIX_STACK_DEPTH 0x80b2 -#define GL_MAX_COLOR_MATRIX_STACK_DEPTH 0x80b3 -#define GL_POST_COLOR_MATRIX_RED_SCALE 0x80b4 -#define GL_POST_COLOR_MATRIX_GREEN_SCALE 0x80b5 -#define GL_POST_COLOR_MATRIX_BLUE_SCALE 0x80b6 -#define GL_POST_COLOR_MATRIX_ALPHA_SCALE 0x80b7 -#define GL_POST_COLOR_MATRIX_RED_BIAS 0x80b8 -#define GL_POST_COLOR_MATRIX_GREEN_BIAS 0x80b9 -#define GL_POST_COLOR_MATRIX_BLUE_BIAS 0x80ba -#define GL_POST_COLOR_MATRIX_ALPHA_BIAS 0x80bb -#define GL_COLOR_TABLE 0x80d0 -#define GL_POST_CONVOLUTION_COLOR_TABLE 0x80d1 -#define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80d2 -#define GL_PROXY_COLOR_TABLE 0x80d3 -#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80d4 -#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80d5 -#define GL_COLOR_TABLE_SCALE 0x80d6 -#define GL_COLOR_TABLE_BIAS 0x80d7 -#define GL_COLOR_TABLE_FORMAT 0x80d8 -#define GL_COLOR_TABLE_WIDTH 0x80d9 -#define GL_COLOR_TABLE_RED_SIZE 0x80da -#define GL_COLOR_TABLE_GREEN_SIZE 0x80db -#define GL_COLOR_TABLE_BLUE_SIZE 0x80dc -#define GL_COLOR_TABLE_ALPHA_SIZE 0x80dd -#define GL_COLOR_TABLE_LUMINANCE_SIZE 0x80de -#define GL_COLOR_TABLE_INTENSITY_SIZE 0x80df -#define GL_CONSTANT_BORDER 0x8151 -#define GL_REPLICATE_BORDER 0x8153 -#define GL_CONVOLUTION_BORDER_COLOR 0x8154 -#endif -typedef void (WINE_GLAPI *PGLFNBLENDCOLORPROC)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); -typedef void (WINE_GLAPI *PGLFNBLENDEQUATIONPROC)(GLenum mode); - /* GL_ARB_map_buffer_range */ #ifndef GL_ARB_map_buffer_range #define GL_ARB_map_buffer_range 1 @@ -2969,6 +2888,18 @@ typedef void (WINE_GLAPI *PGLFNSTENCILFUNCSEPARATEATIPROC)(GLenum, GLenum, GLint #define GL_MIRROR_CLAMP_TO_EDGE_ATI 0x8743 #endif +/* GL_EXT_blend_color */ +#ifndef GL_EXT_blend_color +#define GL_EXT_blend_color 1 +#define GL_CONSTANT_COLOR_EXT 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR_EXT 0x8002 +#define GL_CONSTANT_ALPHA_EXT 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA_EXT 0x8004 +#define GL_BLEND_COLOR_EXT 0x8005 +#endif +typedef GLvoid (WINE_GLAPI *PGLFNBLENDCOLOREXTPROC)(GLclampf red, + GLclampf green, GLclampf blue, GLclampf alpha); + /* GL_EXT_blend_equation_separate */ typedef void (WINE_GLAPI *PGLFNBLENDEQUATIONSEPARATEEXTPROC)(GLenum modeRGB, GLenum modeAlpha); @@ -2983,6 +2914,23 @@ typedef void (WINE_GLAPI *PGLFNBLENDEQUATIONSEPARATEEXTPROC)(GLenum modeRGB, GLe typedef void (WINE_GLAPI *PGLFNBLENDFUNCSEPARATEEXTPROC)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +/* GL_EXT_blend_minmax */ +#ifndef GL_EXT_blend_minmax +#define GL_EXT_blend_minmax 1 +#define GL_FUNC_ADD_EXT 0x8006 +#define GL_MIN_EXT 0x8007 +#define GL_MAX_EXT 0x8008 +#define GL_BLEND_EQUATION_EXT 0x8009 +#endif +typedef void (WINE_GLAPI *PGLFNBLENDEQUATIONEXTPROC)(GLenum mode); + +/* GL_EXT_blend_subtract */ +#ifndef GL_EXT_blend_subtract +#define GL_EXT_blend_subtract 1 +#define GL_FUNC_SUBTRACT_EXT 0x800a +#define GL_FUNC_REVERSE_SUBTRACT_EXT 0x800b +#endif + /* GL_EXT_depth_bounds_test */ #ifndef GL_EXT_depth_bounds_test #define GL_EXT_depth_bounds_test 1 @@ -3412,6 +3360,14 @@ typedef void (WINE_GLAPI *PGLFNGETCOMPRESSEDTEXIMAGEPROC)(GLenum target, GLint l #define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8c4f #endif +/* GL_EXT_texture_sRGB_decode */ +#ifndef GL_EXT_texture_sRGB_decode +#define GL_EXT_texture_sRGB_decode 1 +#define GL_TEXTURE_SRGB_DECODE_EXT 0x8a48 +#define GL_DECODE_EXT 0x8a49 +#define GL_SKIP_DECODE_EXT 0x8a4a +#endif + /* GL_NV_depth_clamp */ #ifndef GL_NV_depth_clamp #define GL_NV_depth_clamp 1 @@ -3711,16 +3667,12 @@ typedef void (WINE_GLAPI *PGLFNGETCOMBINERSTAGEPARAMETERFVNVPROC)(GLenum stage, #endif /* GL_SGIS_generate_mipmap */ -#ifndef GLX_SGIS_generate_mipmap -#define GLX_SGIS_generate_mipmap 1 +#ifndef GL_SGIS_generate_mipmap +#define GL_SGIS_generate_mipmap 1 #define GL_GENERATE_MIPMAP_SGIS 0x8191 #define GL_GENERATE_MIPMAP_HINT_SGIS 0x8192 #endif -/* GLX_SGI_video_sync */ -typedef int (WINE_GLAPI *PGLXFNGETVIDEOSYNCSGIPROC)(unsigned int *); -typedef int (WINE_GLAPI *PGLXFNWAITVIDEOSYNCSGIPROC)(int, int, unsigned int *); - /* WGL_ARB_extensions_string */ typedef const char *(WINAPI *WINED3D_PFNWGLGETEXTENSIONSSTRINGARBPROC)(HDC hdc); @@ -3801,6 +3753,8 @@ typedef BOOL (WINAPI *WINED3D_PFNWGLCHOOSEPIXELFORMATARBPROC)(HDC hdc, const int typedef BOOL (WINAPI *WINED3D_PFNWGLSETPIXELFORMATWINE)(HDC hdc, int iPixelFormat, const PIXELFORMATDESCRIPTOR *ppfd); +typedef BOOL (WINAPI *WINED3D_PFNWGLSWAPINTERVALEXTPROC)(int interval); + #define GL_EXT_FUNCS_GEN \ /* GL_APPLE_fence */ \ USE_GL_FUNC(PGLFNGENFENCESAPPLEPROC, \ @@ -3885,11 +3839,6 @@ typedef BOOL (WINAPI *WINED3D_PFNWGLSETPIXELFORMATWINE)(HDC hdc, int iPixelForma glFramebufferTextureLayerARB, ARB_GEOMETRY_SHADER4, NULL) \ USE_GL_FUNC(PGLFNFRAMEBUFFERTEXTUREFACEARBPROC, \ glFramebufferTextureFaceARB, ARB_GEOMETRY_SHADER4, NULL) \ - /* GL_ARB_imaging, GL_EXT_blend_minmax */ \ - USE_GL_FUNC(PGLFNBLENDCOLORPROC, \ - glBlendColorEXT, EXT_BLEND_COLOR, NULL) \ - USE_GL_FUNC(PGLFNBLENDEQUATIONPROC, \ - glBlendEquationEXT, EXT_BLEND_MINMAX, NULL) \ /* GL_ARB_map_buffer_range */ \ USE_GL_FUNC(PGLFNMAPBUFFERRANGEPROC, \ glMapBufferRange, ARB_MAP_BUFFER_RANGE, NULL) \ @@ -4224,12 +4173,18 @@ typedef BOOL (WINAPI *WINED3D_PFNWGLSETPIXELFORMATWINE)(HDC hdc, int iPixelForma glStencilOpSeparateATI, ATI_SEPARATE_STENCIL, NULL) \ USE_GL_FUNC(PGLFNSTENCILFUNCSEPARATEATIPROC, \ glStencilFuncSeparateATI, ATI_SEPARATE_STENCIL, NULL) \ + /* GL_EXT_blend_color */ \ + USE_GL_FUNC(PGLFNBLENDCOLOREXTPROC, \ + glBlendColorEXT, EXT_BLEND_COLOR, NULL) \ /* GL_EXT_blend_equation_separate */ \ USE_GL_FUNC(PGLFNBLENDFUNCSEPARATEEXTPROC, \ glBlendFuncSeparateEXT, EXT_BLEND_FUNC_SEPARATE, NULL) \ /* GL_EXT_blend_func_separate */ \ USE_GL_FUNC(PGLFNBLENDEQUATIONSEPARATEEXTPROC, \ glBlendEquationSeparateEXT, EXT_BLEND_EQUATION_SEPARATE, NULL) \ + /* GL_EXT_blend_minmax */ \ + USE_GL_FUNC(PGLFNBLENDEQUATIONEXTPROC, \ + glBlendEquationEXT, EXT_BLEND_MINMAX, NULL) \ /* GL_EXT_depth_bounds_test */ \ USE_GL_FUNC(PGLFNDEPTHBOUNDSEXTPROC, \ glDepthBoundsEXT, EXT_DEPTH_BOUNDS_TEST, NULL) \ @@ -4530,17 +4485,13 @@ typedef BOOL (WINAPI *WINED3D_PFNWGLSETPIXELFORMATWINE)(HDC hdc, int iPixelForma glCombinerParameterivNV, NV_REGISTER_COMBINERS, NULL) \ USE_GL_FUNC(PGLFNFINALCOMBINERINPUTNVPROC, \ glFinalCombinerInputNV, NV_REGISTER_COMBINERS, NULL) \ - /* GLX_SGI_video_sync */ \ - USE_GL_FUNC(PGLXFNGETVIDEOSYNCSGIPROC, \ - glXGetVideoSyncSGI, SGI_VIDEO_SYNC, NULL) \ - USE_GL_FUNC(PGLXFNWAITVIDEOSYNCSGIPROC, \ - glXWaitVideoSyncSGI, SGI_VIDEO_SYNC, NULL) #define WGL_EXT_FUNCS_GEN \ USE_GL_FUNC(WINED3D_PFNWGLGETEXTENSIONSSTRINGARBPROC, wglGetExtensionsStringARB, 0, NULL) \ USE_GL_FUNC(WINED3D_PFNWGLGETPIXELFORMATATTRIBIVARBPROC, wglGetPixelFormatAttribivARB, 0, NULL) \ USE_GL_FUNC(WINED3D_PFNWGLGETPIXELFORMATATTRIBFVARBPROC, wglGetPixelFormatAttribfvARB, 0, NULL) \ USE_GL_FUNC(WINED3D_PFNWGLCHOOSEPIXELFORMATARBPROC, wglChoosePixelFormatARB, 0, NULL) \ - USE_GL_FUNC(WINED3D_PFNWGLSETPIXELFORMATWINE, wglSetPixelFormatWINE, 0, NULL) + USE_GL_FUNC(WINED3D_PFNWGLSETPIXELFORMATWINE, wglSetPixelFormatWINE, 0, NULL) \ + USE_GL_FUNC(WINED3D_PFNWGLSWAPINTERVALEXTPROC, wglSwapIntervalEXT, 0, NULL) #endif /* __WINE_WINED3D_GL */ diff --git a/dll/directx/wine/wined3d/wined3d_main.c b/dll/directx/wine/wined3d/wined3d_main.c index 26945efb860..4f7b1cb03a1 100644 --- a/dll/directx/wine/wined3d/wined3d_main.c +++ b/dll/directx/wine/wined3d/wined3d_main.c @@ -32,8 +32,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d); struct wined3d_wndproc { HWND window; + BOOL unicode; WNDPROC proc; - IWineD3DDeviceImpl *device; + struct wined3d_device *device; }; struct wined3d_wndproc_table @@ -61,7 +62,7 @@ static CRITICAL_SECTION wined3d_cs = {&wined3d_cs_debug, -1, 0, 0, 0, 0}; /* When updating default value here, make sure to update winecfg as well, * where appropriate. */ -wined3d_settings_t wined3d_settings = +struct wined3d_settings wined3d_settings = { VS_HW, /* Hardware by default */ PS_HW, /* Hardware by default */ @@ -77,9 +78,9 @@ wined3d_settings_t wined3d_settings = }; /* Do not call while under the GL lock. */ -IWineD3D * WINAPI WineDirect3DCreate(UINT version, void *parent) +struct wined3d * CDECL wined3d_create(UINT version, void *parent) { - IWineD3DImpl *object; + struct wined3d *object; HRESULT hr; object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); @@ -99,7 +100,7 @@ IWineD3D * WINAPI WineDirect3DCreate(UINT version, void *parent) TRACE("Created wined3d object %p for d3d%d support.\n", object, version); - return (IWineD3D *)object; + return object; } static DWORD get_config_key(HKEY defkey, HKEY appkey, const char *name, char *buffer, DWORD size) @@ -354,8 +355,13 @@ static BOOL wined3d_dll_destroy(HINSTANCE hInstDLL) for (i = 0; i < wndproc_table.count; ++i) { - struct wined3d_wndproc *entry = &wndproc_table.entries[i]; - SetWindowLongPtrW(entry->window, GWLP_WNDPROC, (LONG_PTR)entry->proc); + /* Trying to unregister these would be futile. These entries can only + * exist if either we skipped them in wined3d_unregister_window() due + * to the application replacing the wndproc after the entry was + * registered, or if the application still has an active wined3d + * device. In the latter case the application has bigger problems than + * these entries. */ + WARN("Leftover wndproc table entry %p.\n", &wndproc_table.entries[i]); } HeapFree(GetProcessHeap(), 0, wndproc_table.entries); @@ -393,7 +399,8 @@ static struct wined3d_wndproc *wined3d_find_wndproc(HWND window) static LRESULT CALLBACK wined3d_wndproc(HWND window, UINT message, WPARAM wparam, LPARAM lparam) { struct wined3d_wndproc *entry; - IWineD3DDeviceImpl *device; + struct wined3d_device *device; + BOOL unicode; WNDPROC proc; wined3d_mutex_lock(); @@ -407,18 +414,26 @@ static LRESULT CALLBACK wined3d_wndproc(HWND window, UINT message, WPARAM wparam } device = entry->device; + unicode = entry->unicode; proc = entry->proc; wined3d_mutex_unlock(); - return device_process_message(device, window, message, wparam, lparam, proc); + return device_process_message(device, window, unicode, message, wparam, lparam, proc); } -BOOL wined3d_register_window(HWND window, IWineD3DDeviceImpl *device) +BOOL wined3d_register_window(HWND window, struct wined3d_device *device) { struct wined3d_wndproc *entry; wined3d_mutex_lock(); + if (wined3d_find_wndproc(window)) + { + wined3d_mutex_unlock(); + WARN("Window %p is already registered with wined3d.\n", window); + return TRUE; + } + if (wndproc_table.size == wndproc_table.count) { unsigned int new_size = max(1, wndproc_table.size * 2); @@ -440,7 +455,14 @@ BOOL wined3d_register_window(HWND window, IWineD3DDeviceImpl *device) entry = &wndproc_table.entries[wndproc_table.count++]; entry->window = window; - entry->proc = (WNDPROC)SetWindowLongPtrW(window, GWLP_WNDPROC, (LONG_PTR)wined3d_wndproc); + entry->unicode = IsWindowUnicode(window); + /* Set a window proc that matches the window. Some applications (e.g. NoX) + * replace the window proc after we've set ours, and expect to be able to + * call the previous one (ours) directly, without using CallWindowProc(). */ + if (entry->unicode) + entry->proc = (WNDPROC)SetWindowLongPtrW(window, GWLP_WNDPROC, (LONG_PTR)wined3d_wndproc); + else + entry->proc = (WNDPROC)SetWindowLongPtrA(window, GWLP_WNDPROC, (LONG_PTR)wined3d_wndproc); entry->device = device; wined3d_mutex_unlock(); @@ -450,27 +472,49 @@ BOOL wined3d_register_window(HWND window, IWineD3DDeviceImpl *device) void wined3d_unregister_window(HWND window) { - unsigned int i; + struct wined3d_wndproc *entry, *last; + LONG_PTR proc; wined3d_mutex_lock(); - for (i = 0; i < wndproc_table.count; ++i) + + if (!(entry = wined3d_find_wndproc(window))) { - if (wndproc_table.entries[i].window == window) + wined3d_mutex_unlock(); + ERR("Window %p is not registered with wined3d.\n", window); + return; + } + + if (entry->unicode) + { + proc = GetWindowLongPtrW(window, GWLP_WNDPROC); + if (proc != (LONG_PTR)wined3d_wndproc) { - struct wined3d_wndproc *entry = &wndproc_table.entries[i]; - struct wined3d_wndproc *last = &wndproc_table.entries[--wndproc_table.count]; - - if (GetWindowLongPtrW(window, GWLP_WNDPROC) == (LONG_PTR)wined3d_wndproc) - SetWindowLongPtrW(window, GWLP_WNDPROC, (LONG_PTR)entry->proc); - if (entry != last) *entry = *last; wined3d_mutex_unlock(); - + WARN("Not unregistering window %p, window proc %#lx doesn't match wined3d window proc %p.\n", + window, proc, wined3d_wndproc); return; } - } - wined3d_mutex_unlock(); - ERR("Window %p is not registered with wined3d.\n", window); + SetWindowLongPtrW(window, GWLP_WNDPROC, (LONG_PTR)entry->proc); + } + else + { + proc = GetWindowLongPtrA(window, GWLP_WNDPROC); + if (proc != (LONG_PTR)wined3d_wndproc) + { + wined3d_mutex_unlock(); + WARN("Not unregistering window %p, window proc %#lx doesn't match wined3d window proc %p.\n", + window, proc, wined3d_wndproc); + return; + } + + SetWindowLongPtrA(window, GWLP_WNDPROC, (LONG_PTR)entry->proc); + } + + last = &wndproc_table.entries[--wndproc_table.count]; + if (entry != last) *entry = *last; + + wined3d_mutex_unlock(); } /* At process attach */ diff --git a/dll/directx/wine/wined3d/wined3d_private.h b/dll/directx/wine/wined3d/wined3d_private.h index 0b6f57efe52..88c300d7ac1 100644 --- a/dll/directx/wine/wined3d/wined3d_private.h +++ b/dll/directx/wine/wined3d/wined3d_private.h @@ -196,8 +196,8 @@ static inline float float_16_to_32(const unsigned short *in) { } else if(e < 31) { return sgn * powf(2, (float)e - 15.0f) * (1.0f + ((float)m / 1024.0f)); } else { - if(m == 0) return sgn / 0.0f; /* +INF / -INF */ - else return 0.0f / 0.0f; /* NAN */ + if(m == 0) return sgn * INFINITY; /* +INF / -INF */ + else return NAN; } } @@ -218,8 +218,8 @@ static inline float float_24_to_32(DWORD in) } else { - if (m == 0) return sgn / 0.0f; /* +INF / -INF */ - else return 0.0f / 0.0f; /* NAN */ + if (m == 0) return sgn * INFINITY; /* +INF / -INF */ + else return NAN; } } @@ -252,26 +252,27 @@ static inline float float_24_to_32(DWORD in) /* NOTE: When adding fields to this structure, make sure to update the default * values in wined3d_main.c as well. */ -typedef struct wined3d_settings_s { -/* vertex and pixel shader modes */ - int vs_mode; - int ps_mode; -/* Ideally, we don't want the user to have to request GLSL. If the hardware supports GLSL, - we should use it. However, until it's fully implemented, we'll leave it as a registry - setting for developers. */ - BOOL glslRequested; - int offscreen_rendering_mode; - int rendertargetlock_mode; - unsigned short pci_vendor_id; - unsigned short pci_device_id; -/* Memory tracking and object counting */ - unsigned int emulated_textureram; - char *logo; - int allow_multisampling; - BOOL strict_draw_ordering; -} wined3d_settings_t; +struct wined3d_settings +{ + /* vertex and pixel shader modes */ + int vs_mode; + int ps_mode; + /* Ideally, we don't want the user to have to request GLSL. If the + * hardware supports GLSL, we should use it. However, until it's fully + * implemented, we'll leave it as a registry setting for developers. */ + BOOL glslRequested; + int offscreen_rendering_mode; + int rendertargetlock_mode; + unsigned short pci_vendor_id; + unsigned short pci_device_id; + /* Memory tracking and object counting. */ + unsigned int emulated_textureram; + char *logo; + int allow_multisampling; + BOOL strict_draw_ordering; +}; -extern wined3d_settings_t wined3d_settings DECLSPEC_HIDDEN; +extern struct wined3d_settings wined3d_settings DECLSPEC_HIDDEN; typedef enum _WINED3DSAMPLER_TEXTURE_TYPE { @@ -309,6 +310,7 @@ typedef enum _WINED3DSHADER_PARAM_REGISTER_TYPE WINED3DSPR_IMMCONST, WINED3DSPR_CONSTBUFFER, WINED3DSPR_NULL, + WINED3DSPR_RESOURCE, } WINED3DSHADER_PARAM_REGISTER_TYPE; enum wined3d_immconst_type @@ -420,6 +422,7 @@ enum WINED3D_SHADER_INSTRUCTION_HANDLER WINED3DSIH_DEF, WINED3DSIH_DEFB, WINED3DSIH_DEFI, + WINED3DSIH_DIV, WINED3DSIH_DP2ADD, WINED3DSIH_DP3, WINED3DSIH_DP4, @@ -434,12 +437,16 @@ enum WINED3D_SHADER_INSTRUCTION_HANDLER WINED3DSIH_EXP, WINED3DSIH_EXPP, WINED3DSIH_FRC, + WINED3DSIH_FTOI, WINED3DSIH_IADD, + WINED3DSIH_IEQ, WINED3DSIH_IF, WINED3DSIH_IFC, WINED3DSIH_IGE, WINED3DSIH_IMUL, + WINED3DSIH_ITOF, WINED3DSIH_LABEL, + WINED3DSIH_LD, WINED3DSIH_LIT, WINED3DSIH_LOG, WINED3DSIH_LOGP, @@ -466,11 +473,15 @@ enum WINED3D_SHADER_INSTRUCTION_HANDLER WINED3DSIH_REP, WINED3DSIH_RET, WINED3DSIH_RSQ, + WINED3DSIH_SAMPLE, + WINED3DSIH_SAMPLE_GRAD, + WINED3DSIH_SAMPLE_LOD, WINED3DSIH_SETP, WINED3DSIH_SGE, WINED3DSIH_SGN, WINED3DSIH_SINCOS, WINED3DSIH_SLT, + WINED3DSIH_SQRT, WINED3DSIH_SUB, WINED3DSIH_TEX, WINED3DSIH_TEXBEM, @@ -494,6 +505,7 @@ enum WINED3D_SHADER_INSTRUCTION_HANDLER WINED3DSIH_TEXREG2AR, WINED3DSIH_TEXREG2GB, WINED3DSIH_TEXREG2RGB, + WINED3DSIH_UTOF, WINED3DSIH_TABLE_SIZE }; @@ -513,7 +525,7 @@ struct wined3d_shader_version #define WINED3D_SHADER_VERSION(major, minor) (((major) << 8) | (minor)) -typedef struct shader_reg_maps +struct wined3d_shader_reg_maps { struct wined3d_shader_version shader_version; BYTE texcoord; /* MAX_REG_TEXCRD, 8 */ @@ -545,21 +557,38 @@ typedef struct shader_reg_maps WORD usestexldl : 1; WORD usesifc : 1; WORD usescall : 1; - WORD usesrcp : 1; + WORD usespow : 1; WORD padding : 3; + DWORD rt_mask; /* Used render targets, 32 max. */ + /* Whether or not loops are used in this shader, and nesting depth */ unsigned loop_depth; - unsigned highest_render_target; + UINT min_rel_offset, max_rel_offset; +}; -} shader_reg_maps; +/* Keeps track of details for TEX_M#x# instructions which need to maintain + * state information between multiple instructions. */ +struct wined3d_shader_tex_mx +{ + unsigned int current_row; + DWORD texcoord_w[2]; +}; + +struct wined3d_shader_loop_state +{ + UINT current_depth; + UINT current_reg; +}; struct wined3d_shader_context { - IWineD3DBaseShader *shader; + struct wined3d_shader *shader; const struct wined3d_gl_info *gl_info; - const struct shader_reg_maps *reg_maps; + const struct wined3d_shader_reg_maps *reg_maps; struct wined3d_shader_buffer *buffer; + struct wined3d_shader_tex_mx *tex_mx; + struct wined3d_shader_loop_state *loop_state; void *backend_data; }; @@ -712,28 +741,31 @@ struct vs_compile_args { }; struct wined3d_context; +struct wined3d_state; -typedef struct { +struct wined3d_shader_backend_ops +{ void (*shader_handle_instruction)(const struct wined3d_shader_instruction *); void (*shader_select)(const struct wined3d_context *context, BOOL usePS, BOOL useVS); - void (*shader_select_depth_blt)(IWineD3DDevice *iface, enum tex_types tex_type, const SIZE *ds_mask_size); - void (*shader_deselect_depth_blt)(IWineD3DDevice *iface); - void (*shader_update_float_vertex_constants)(IWineD3DDevice *iface, UINT start, UINT count); - void (*shader_update_float_pixel_constants)(IWineD3DDevice *iface, UINT start, UINT count); + void (*shader_select_depth_blt)(void *shader_priv, const struct wined3d_gl_info *gl_info, + enum tex_types tex_type, const SIZE *ds_mask_size); + void (*shader_deselect_depth_blt)(void *shader_priv, const struct wined3d_gl_info *gl_info); + void (*shader_update_float_vertex_constants)(struct wined3d_device *device, UINT start, UINT count); + void (*shader_update_float_pixel_constants)(struct wined3d_device *device, UINT start, UINT count); void (*shader_load_constants)(const struct wined3d_context *context, char usePS, char useVS); - void (*shader_load_np2fixup_constants)(IWineD3DDevice *iface, char usePS, char useVS); - void (*shader_destroy)(IWineD3DBaseShader *iface); - HRESULT (*shader_alloc_private)(IWineD3DDevice *iface); - void (*shader_free_private)(IWineD3DDevice *iface); - BOOL (*shader_dirtifyable_constants)(IWineD3DDevice *iface); + void (*shader_load_np2fixup_constants)(void *shader_priv, const struct wined3d_gl_info *gl_info, + const struct wined3d_state *state); + void (*shader_destroy)(struct wined3d_shader *shader); + HRESULT (*shader_alloc_private)(struct wined3d_device *device); + void (*shader_free_private)(struct wined3d_device *device); + BOOL (*shader_dirtifyable_constants)(void); void (*shader_get_caps)(const struct wined3d_gl_info *gl_info, struct shader_caps *caps); BOOL (*shader_color_fixup_supported)(struct color_fixup_desc fixup); - void (*shader_add_instruction_modifiers)(const struct wined3d_shader_instruction *ins); -} shader_backend_t; +}; -extern const shader_backend_t glsl_shader_backend DECLSPEC_HIDDEN; -extern const shader_backend_t arb_program_shader_backend DECLSPEC_HIDDEN; -extern const shader_backend_t none_shader_backend DECLSPEC_HIDDEN; +extern const struct wined3d_shader_backend_ops glsl_shader_backend DECLSPEC_HIDDEN; +extern const struct wined3d_shader_backend_ops arb_program_shader_backend DECLSPEC_HIDDEN; +extern const struct wined3d_shader_backend_ops none_shader_backend DECLSPEC_HIDDEN; /* X11 locking */ @@ -818,13 +850,6 @@ do { si->elements[name].data, si->elements[name].stride, si->elements[name].format->id, \ si->elements[name].buffer_object, si->elements[name].stream_idx); } while(0) -/* Advance declaration of structures to satisfy compiler */ -typedef struct IWineD3DStateBlockImpl IWineD3DStateBlockImpl; -typedef struct IWineD3DSurfaceImpl IWineD3DSurfaceImpl; -typedef struct IWineD3DPaletteImpl IWineD3DPaletteImpl; -typedef struct IWineD3DDeviceImpl IWineD3DDeviceImpl; -typedef struct IWineD3DSwapChainImpl IWineD3DSwapChainImpl; - /* Global variables */ extern const float identity[16] DECLSPEC_HIDDEN; @@ -891,7 +916,7 @@ struct wined3d_stream_info */ /* Routine common to the draw primitive and draw indexed primitive routines */ -void drawPrimitive(IWineD3DDevice *iface, UINT index_count, +void drawPrimitive(struct wined3d_device *device, UINT index_count, UINT start_idx, UINT idxBytes, const void *idxData) DECLSPEC_HIDDEN; DWORD get_flexible_vertex_size(DWORD d3dvtVertexType) DECLSPEC_HIDDEN; @@ -961,7 +986,10 @@ extern glMultiTexCoordFunc multi_texcoord_funcs[WINED3D_FFP_EMIT_COUNT] DECLSPEC #define STATE_FRONTFACE (STATE_MATERIAL + 1) #define STATE_IS_FRONTFACE(a) ((a) == STATE_FRONTFACE) -#define STATE_HIGHEST (STATE_FRONTFACE) +#define STATE_POINTSPRITECOORDORIGIN (STATE_FRONTFACE + 1) +#define STATE_IS_POINTSPRITECOORDORIGIN(a) ((a) == STATE_POINTSPRITECOORDORIGIN) + +#define STATE_HIGHEST (STATE_POINTSPRITECOORDORIGIN) enum fogsource { FOGSOURCE_FFP, @@ -1001,9 +1029,9 @@ enum wined3d_event_query_result }; void wined3d_event_query_destroy(struct wined3d_event_query *query) DECLSPEC_HIDDEN; -enum wined3d_event_query_result wined3d_event_query_test(struct wined3d_event_query *query, IWineD3DDeviceImpl *device) DECLSPEC_HIDDEN; -enum wined3d_event_query_result wined3d_event_query_finish(struct wined3d_event_query *query, IWineD3DDeviceImpl *device) DECLSPEC_HIDDEN; -void wined3d_event_query_issue(struct wined3d_event_query *query, IWineD3DDeviceImpl *device) DECLSPEC_HIDDEN; +enum wined3d_event_query_result wined3d_event_query_finish(struct wined3d_event_query *query, + struct wined3d_device *device) DECLSPEC_HIDDEN; +void wined3d_event_query_issue(struct wined3d_event_query *query, struct wined3d_device *device) DECLSPEC_HIDDEN; BOOL wined3d_event_query_supported(const struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN; struct wined3d_context @@ -1019,8 +1047,8 @@ struct wined3d_context DWORD numDirtyEntries; DWORD isStateDirty[STATE_HIGHEST / (sizeof(DWORD) * CHAR_BIT) + 1]; /* Bitmap to find out quickly if a state is dirty */ - IWineD3DSwapChainImpl *swapchain; - IWineD3DSurfaceImpl *current_rt; + struct wined3d_swapchain *swapchain; + struct wined3d_surface *current_rt; DWORD tid; /* Thread ID which owns this context at the moment */ /* Stores some information about the context state for optimization */ @@ -1068,7 +1096,7 @@ struct wined3d_context GLuint fbo_read_binding; GLuint fbo_draw_binding; BOOL rebind_fbo; - IWineD3DSurfaceImpl **blit_targets; + struct wined3d_surface **blit_targets; GLenum *draw_buffers; /* Queries */ @@ -1089,7 +1117,7 @@ struct wined3d_context GLuint dummy_arbfp_prog; }; -typedef void (*APPLYSTATEFUNC)(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *ctx); +typedef void (*APPLYSTATEFUNC)(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *ctx); struct StateEntry { @@ -1114,10 +1142,10 @@ struct fragment_caps struct fragment_pipeline { - void (*enable_extension)(IWineD3DDevice *iface, BOOL enable); + void (*enable_extension)(BOOL enable); void (*get_caps)(const struct wined3d_gl_info *gl_info, struct fragment_caps *caps); - HRESULT (*alloc_private)(IWineD3DDevice *iface); - void (*free_private)(IWineD3DDevice *iface); + HRESULT (*alloc_private)(struct wined3d_device *device); + void (*free_private)(struct wined3d_device *device); BOOL (*color_fixup_supported)(struct color_fixup_desc fixup); const struct StateEntryTemplate *states; BOOL ffp_proj_control; @@ -1136,71 +1164,76 @@ HRESULT compile_state_table(struct StateEntry *StateTable, APPLYSTATEFUNC **dev_ const struct wined3d_gl_info *gl_info, const struct StateEntryTemplate *vertex, const struct fragment_pipeline *fragment, const struct StateEntryTemplate *misc) DECLSPEC_HIDDEN; -enum blit_operation +enum wined3d_blit_op { - BLIT_OP_BLIT, - BLIT_OP_COLOR_FILL + WINED3D_BLIT_OP_COLOR_BLIT, + WINED3D_BLIT_OP_COLOR_FILL, + WINED3D_BLIT_OP_DEPTH_FILL, + WINED3D_BLIT_OP_DEPTH_BLIT, }; /* Shaders for color conversions in blits. Do not do blit operations while * already under the GL lock. */ struct blit_shader { - HRESULT (*alloc_private)(IWineD3DDevice *iface); - void (*free_private)(IWineD3DDevice *iface); - HRESULT (*set_shader)(IWineD3DDevice *iface, IWineD3DSurfaceImpl *surface); - void (*unset_shader)(IWineD3DDevice *iface); - BOOL (*blit_supported)(const struct wined3d_gl_info *gl_info, enum blit_operation blit_op, + HRESULT (*alloc_private)(struct wined3d_device *device); + void (*free_private)(struct wined3d_device *device); + HRESULT (*set_shader)(void *blit_priv, const struct wined3d_gl_info *gl_info, struct wined3d_surface *surface); + void (*unset_shader)(const struct wined3d_gl_info *gl_info); + BOOL (*blit_supported)(const struct wined3d_gl_info *gl_info, enum wined3d_blit_op blit_op, const RECT *src_rect, DWORD src_usage, WINED3DPOOL src_pool, const struct wined3d_format *src_format, const RECT *dst_rect, DWORD dst_usage, WINED3DPOOL dst_pool, const struct wined3d_format *dst_format); - HRESULT (*color_fill)(IWineD3DDeviceImpl *device, IWineD3DSurfaceImpl *dst_surface, + HRESULT (*color_fill)(struct wined3d_device *device, struct wined3d_surface *dst_surface, const RECT *dst_rect, const WINED3DCOLORVALUE *color); + HRESULT (*depth_fill)(struct wined3d_device *device, + struct wined3d_surface *surface, const RECT *rect, float depth); }; extern const struct blit_shader ffp_blit DECLSPEC_HIDDEN; extern const struct blit_shader arbfp_blit DECLSPEC_HIDDEN; extern const struct blit_shader cpu_blit DECLSPEC_HIDDEN; -const struct blit_shader *wined3d_select_blitter(const struct wined3d_gl_info *gl_info, enum blit_operation blit_op, +const struct blit_shader *wined3d_select_blitter(const struct wined3d_gl_info *gl_info, enum wined3d_blit_op blit_op, const RECT *src_rect, DWORD src_usage, WINED3DPOOL src_pool, const struct wined3d_format *src_format, const RECT *dst_rect, DWORD dst_usage, WINED3DPOOL dst_pool, const struct wined3d_format *dst_format) DECLSPEC_HIDDEN; /* Temporary blit_shader helper functions */ -HRESULT arbfp_blit_surface(IWineD3DDeviceImpl *device, IWineD3DSurfaceImpl *src_surface, const RECT *src_rect, - IWineD3DSurfaceImpl *dst_surface, const RECT *dst_rect_in, enum blit_operation blit_op, - DWORD Filter) DECLSPEC_HIDDEN; +HRESULT arbfp_blit_surface(struct wined3d_device *device, struct wined3d_surface *src_surface, + const RECT *src_rect, struct wined3d_surface *dst_surface, const RECT *dst_rect_in, + enum wined3d_blit_op blit_op, DWORD Filter) DECLSPEC_HIDDEN; -struct wined3d_context *context_acquire(IWineD3DDeviceImpl *This, IWineD3DSurfaceImpl *target) DECLSPEC_HIDDEN; +struct wined3d_context *context_acquire(struct wined3d_device *device, struct wined3d_surface *target) DECLSPEC_HIDDEN; void context_alloc_event_query(struct wined3d_context *context, struct wined3d_event_query *query) DECLSPEC_HIDDEN; void context_alloc_occlusion_query(struct wined3d_context *context, struct wined3d_occlusion_query *query) DECLSPEC_HIDDEN; -void context_apply_blit_state(struct wined3d_context *context, IWineD3DDeviceImpl *device) DECLSPEC_HIDDEN; -void context_apply_clear_state(struct wined3d_context *context, IWineD3DDeviceImpl *device, - UINT rt_count, IWineD3DSurfaceImpl **rts, IWineD3DSurfaceImpl *depth_stencil) DECLSPEC_HIDDEN; -void context_apply_draw_state(struct wined3d_context *context, IWineD3DDeviceImpl *device) DECLSPEC_HIDDEN; +void context_apply_blit_state(struct wined3d_context *context, struct wined3d_device *device) DECLSPEC_HIDDEN; +BOOL context_apply_clear_state(struct wined3d_context *context, struct wined3d_device *device, + UINT rt_count, struct wined3d_surface **rts, struct wined3d_surface *depth_stencil) DECLSPEC_HIDDEN; +BOOL context_apply_draw_state(struct wined3d_context *context, struct wined3d_device *device) DECLSPEC_HIDDEN; void context_apply_fbo_state_blit(struct wined3d_context *context, GLenum target, - IWineD3DSurfaceImpl *render_target, IWineD3DSurfaceImpl *depth_stencil, DWORD location) DECLSPEC_HIDDEN; + struct wined3d_surface *render_target, struct wined3d_surface *depth_stencil, DWORD location) DECLSPEC_HIDDEN; void context_attach_depth_stencil_fbo(struct wined3d_context *context, - GLenum fbo_target, IWineD3DSurfaceImpl *depth_stencil, BOOL use_render_buffer) DECLSPEC_HIDDEN; + GLenum fbo_target, struct wined3d_surface *depth_stencil, BOOL use_render_buffer) DECLSPEC_HIDDEN; void context_bind_fbo(struct wined3d_context *context, GLenum target, GLuint *fbo) DECLSPEC_HIDDEN; -struct wined3d_context *context_create(IWineD3DSwapChainImpl *swapchain, IWineD3DSurfaceImpl *target, +void context_check_fbo_status(struct wined3d_context *context, GLenum target) DECLSPEC_HIDDEN; +struct wined3d_context *context_create(struct wined3d_swapchain *swapchain, struct wined3d_surface *target, const struct wined3d_format *ds_format) DECLSPEC_HIDDEN; -void context_destroy(IWineD3DDeviceImpl *This, struct wined3d_context *context) DECLSPEC_HIDDEN; +void context_destroy(struct wined3d_device *device, struct wined3d_context *context) DECLSPEC_HIDDEN; void context_free_event_query(struct wined3d_event_query *query) DECLSPEC_HIDDEN; void context_free_occlusion_query(struct wined3d_occlusion_query *query) DECLSPEC_HIDDEN; struct wined3d_context *context_get_current(void) DECLSPEC_HIDDEN; DWORD context_get_tls_idx(void) DECLSPEC_HIDDEN; void context_release(struct wined3d_context *context) DECLSPEC_HIDDEN; -void context_resource_released(IWineD3DDeviceImpl *device, - IWineD3DResource *resource, WINED3DRESOURCETYPE type) DECLSPEC_HIDDEN; -void context_resource_unloaded(IWineD3DDeviceImpl *device, - IWineD3DResource *resource, WINED3DRESOURCETYPE type) DECLSPEC_HIDDEN; +void context_resource_released(struct wined3d_device *device, + struct wined3d_resource *resource, WINED3DRESOURCETYPE type) DECLSPEC_HIDDEN; +void context_resource_unloaded(struct wined3d_device *device, + struct wined3d_resource *resource, WINED3DRESOURCETYPE type) DECLSPEC_HIDDEN; BOOL context_set_current(struct wined3d_context *ctx) DECLSPEC_HIDDEN; void context_set_draw_buffer(struct wined3d_context *context, GLenum buffer) DECLSPEC_HIDDEN; void context_set_tls_idx(DWORD idx) DECLSPEC_HIDDEN; -void context_surface_update(struct wined3d_context *context, IWineD3DSurfaceImpl *surface) DECLSPEC_HIDDEN; +void context_surface_update(struct wined3d_context *context, struct wined3d_surface *surface) DECLSPEC_HIDDEN; /* Macros for doing basic GPU detection based on opengl capabilities */ #define WINE_D3D6_CAPABLE(gl_info) (gl_info->supported[ARB_MULTITEXTURE]) @@ -1231,7 +1264,7 @@ struct wined3d_light_info /* The default light parameters */ extern const WINED3DLIGHT WINED3D_default_light DECLSPEC_HIDDEN; -typedef struct WineD3D_PixelFormat +struct wined3d_pixel_format { int iPixelFormat; /* WGL pixel format */ int iPixelType; /* WGL pixel type e.g. WGL_TYPE_RGBA_ARB, WGL_TYPE_RGBA_FLOAT_ARB or WGL_TYPE_COLORINDEX_ARB */ @@ -1241,17 +1274,17 @@ typedef struct WineD3D_PixelFormat BOOL doubleBuffer; int auxBuffers; int numSamples; -} WineD3D_PixelFormat; +}; /* The driver names reflect the lowest GPU supported - * by a certain driver, so DRIVER_ATI_R300 supports + * by a certain driver, so DRIVER_AMD_R300 supports * R3xx, R4xx and R5xx GPUs. */ enum wined3d_display_driver { - DRIVER_ATI_RAGE_128PRO, - DRIVER_ATI_R100, - DRIVER_ATI_R300, - DRIVER_ATI_R600, + DRIVER_AMD_RAGE_128PRO, + DRIVER_AMD_R100, + DRIVER_AMD_R300, + DRIVER_AMD_R600, DRIVER_INTEL_GMA800, DRIVER_INTEL_GMA900, DRIVER_INTEL_GMA950, @@ -1285,7 +1318,7 @@ enum wined3d_gl_vendor enum wined3d_pci_vendor { HW_VENDOR_SOFTWARE = 0x0000, - HW_VENDOR_ATI = 0x1002, + HW_VENDOR_AMD = 0x1002, HW_VENDOR_NVIDIA = 0x10de, HW_VENDOR_INTEL = 0x8086, }; @@ -1294,35 +1327,41 @@ enum wined3d_pci_device { CARD_WINE = 0x0000, - CARD_ATI_RAGE_128PRO = 0x5246, - CARD_ATI_RADEON_7200 = 0x5144, - CARD_ATI_RADEON_8500 = 0x514c, - CARD_ATI_RADEON_9500 = 0x4144, - CARD_ATI_RADEON_XPRESS_200M = 0x5955, - CARD_ATI_RADEON_X700 = 0x5e4c, - CARD_ATI_RADEON_X1600 = 0x71c2, - CARD_ATI_RADEON_HD2350 = 0x94c7, - CARD_ATI_RADEON_HD2600 = 0x9581, - CARD_ATI_RADEON_HD2900 = 0x9400, - CARD_ATI_RADEON_HD3200 = 0x9620, - CARD_ATI_RADEON_HD4350 = 0x954f, - CARD_ATI_RADEON_HD4550 = 0x9540, - CARD_ATI_RADEON_HD4600 = 0x9495, - CARD_ATI_RADEON_HD4650 = 0x9498, - CARD_ATI_RADEON_HD4670 = 0x9490, - CARD_ATI_RADEON_HD4700 = 0x944e, - CARD_ATI_RADEON_HD4770 = 0x94b3, - CARD_ATI_RADEON_HD4800 = 0x944c, /* Picked one value between 9440, 944c, 9442, 9460 */ - CARD_ATI_RADEON_HD4830 = 0x944c, - CARD_ATI_RADEON_HD4850 = 0x9442, - CARD_ATI_RADEON_HD4870 = 0x9440, - CARD_ATI_RADEON_HD4890 = 0x9460, - CARD_ATI_RADEON_HD5700 = 0x68BE, /* Picked HD5750 */ - CARD_ATI_RADEON_HD5750 = 0x68BE, - CARD_ATI_RADEON_HD5770 = 0x68B8, - CARD_ATI_RADEON_HD5800 = 0x6898, /* Picked HD5850 */ - CARD_ATI_RADEON_HD5850 = 0x6898, - CARD_ATI_RADEON_HD5870 = 0x6899, + CARD_AMD_RAGE_128PRO = 0x5246, + CARD_AMD_RADEON_7200 = 0x5144, + CARD_AMD_RADEON_8500 = 0x514c, + CARD_AMD_RADEON_9500 = 0x4144, + CARD_AMD_RADEON_XPRESS_200M = 0x5955, + CARD_AMD_RADEON_X700 = 0x5e4c, + CARD_AMD_RADEON_X1600 = 0x71c2, + CARD_AMD_RADEON_HD2350 = 0x94c7, + CARD_AMD_RADEON_HD2600 = 0x9581, + CARD_AMD_RADEON_HD2900 = 0x9400, + CARD_AMD_RADEON_HD3200 = 0x9620, + CARD_AMD_RADEON_HD4350 = 0x954f, + CARD_AMD_RADEON_HD4550 = 0x9540, + CARD_AMD_RADEON_HD4600 = 0x9495, + CARD_AMD_RADEON_HD4650 = 0x9498, + CARD_AMD_RADEON_HD4670 = 0x9490, + CARD_AMD_RADEON_HD4700 = 0x944e, + CARD_AMD_RADEON_HD4770 = 0x94b3, + CARD_AMD_RADEON_HD4800 = 0x944c, /* Picked one value between 9440, 944c, 9442, 9460 */ + CARD_AMD_RADEON_HD4830 = 0x944c, + CARD_AMD_RADEON_HD4850 = 0x9442, + CARD_AMD_RADEON_HD4870 = 0x9440, + CARD_AMD_RADEON_HD4890 = 0x9460, + CARD_AMD_RADEON_HD5400 = 0x68f9, + CARD_AMD_RADEON_HD5600 = 0x68d8, + CARD_AMD_RADEON_HD5700 = 0x68BE, /* Picked HD5750 */ + CARD_AMD_RADEON_HD5750 = 0x68BE, + CARD_AMD_RADEON_HD5770 = 0x68B8, + CARD_AMD_RADEON_HD5800 = 0x6898, /* Picked HD5850 */ + CARD_AMD_RADEON_HD5850 = 0x6898, + CARD_AMD_RADEON_HD5870 = 0x6899, + CARD_AMD_RADEON_HD5900 = 0x689c, + CARD_AMD_RADEON_HD6310 = 0x9803, + CARD_AMD_RADEON_HD6800 = 0x6739, + CARD_AMD_RADEON_HD6900 = 0x6719, CARD_NVIDIA_RIVA_128 = 0x0018, CARD_NVIDIA_RIVA_TNT = 0x0020, @@ -1363,12 +1402,21 @@ enum wined3d_pci_device CARD_NVIDIA_GEFORCE_GTX260 = 0x05e2, CARD_NVIDIA_GEFORCE_GTX275 = 0x05e6, CARD_NVIDIA_GEFORCE_GTX280 = 0x05e1, + CARD_NVIDIA_GEFORCE_GT320M = 0x0a2d, CARD_NVIDIA_GEFORCE_GT325M = 0x0a35, + CARD_NVIDIA_GEFORCE_GT330 = 0x0ca0, CARD_NVIDIA_GEFORCE_GTS350M = 0x0cb0, + CARD_NVIDIA_GEFORCE_GT420 = 0x0de2, + CARD_NVIDIA_GEFORCE_GT430 = 0x0de1, + CARD_NVIDIA_GEFORCE_GT440 = 0x0de0, + CARD_NVIDIA_GEFORCE_GTS450 = 0x0dc4, CARD_NVIDIA_GEFORCE_GTX460 = 0x0e22, CARD_NVIDIA_GEFORCE_GTX465 = 0x06c4, CARD_NVIDIA_GEFORCE_GTX470 = 0x06cd, CARD_NVIDIA_GEFORCE_GTX480 = 0x06c0, + CARD_NVIDIA_GEFORCE_GTX560 = 0x1200, + CARD_NVIDIA_GEFORCE_GTX570 = 0x1081, + CARD_NVIDIA_GEFORCE_GTX580 = 0x1080, CARD_INTEL_845G = 0x2562, CARD_INTEL_I830G = 0x3577, @@ -1378,6 +1426,7 @@ enum wined3d_pci_device CARD_INTEL_I915GM = 0x2592, CARD_INTEL_I945GM = 0x27a2, /* Same as GMA 950? */ CARD_INTEL_X3100 = 0x2a02, /* Found in Macs. Same as GM965/GL960 */ + CARD_INTEL_GM45 = 0x2a42, }; struct wined3d_fbo_ops @@ -1480,20 +1529,20 @@ struct wined3d_adapter struct wined3d_driver_info driver_info; WCHAR DeviceName[CCHDEVICENAME]; /* DeviceName for use with e.g. ChangeDisplaySettings */ int nCfgs; - WineD3D_PixelFormat *cfgs; + struct wined3d_pixel_format *cfgs; BOOL brokenStencil; /* Set on cards which only offer mixed depth+stencil */ unsigned int TextureRam; /* Amount of texture memory both video ram + AGP/TurboCache/HyperMemory/.. */ unsigned int UsedTextureRam; LUID luid; const struct fragment_pipeline *fragment_pipe; - const shader_backend_t *shader_backend; + const struct wined3d_shader_backend_ops *shader_backend; const struct blit_shader *blitter; }; BOOL initPixelFormats(struct wined3d_gl_info *gl_info, enum wined3d_pci_vendor vendor) DECLSPEC_HIDDEN; BOOL initPixelFormatsNoGL(struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN; -extern unsigned int WineD3DAdapterChangeGLRam(IWineD3DDeviceImpl *D3DDevice, unsigned int glram) DECLSPEC_HIDDEN; +extern unsigned int WineD3DAdapterChangeGLRam(struct wined3d_device *device, int glram) DECLSPEC_HIDDEN; extern void add_gl_compat_wrappers(struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN; /***************************************************************************** @@ -1510,7 +1559,7 @@ struct WineD3DRectPatch struct list entry; }; -HRESULT tesselate_rectpatch(IWineD3DDeviceImpl *This, struct WineD3DRectPatch *patch) DECLSPEC_HIDDEN; +HRESULT tesselate_rectpatch(struct wined3d_device *device, struct WineD3DRectPatch *patch) DECLSPEC_HIDDEN; enum projection_types { @@ -1565,31 +1614,23 @@ struct ffp_frag_desc extern const struct wine_rb_functions wined3d_ffp_frag_program_rb_functions DECLSPEC_HIDDEN; extern const struct wined3d_parent_ops wined3d_null_parent_ops DECLSPEC_HIDDEN; -void gen_ffp_frag_op(IWineD3DStateBlockImpl *stateblock, struct ffp_frag_settings *settings, +void gen_ffp_frag_op(struct wined3d_stateblock *stateblock, struct ffp_frag_settings *settings, BOOL ignore_textype) DECLSPEC_HIDDEN; const struct ffp_frag_desc *find_ffp_frag_shader(const struct wine_rb_tree *fragment_shaders, const struct ffp_frag_settings *settings) DECLSPEC_HIDDEN; void add_ffp_frag_shader(struct wine_rb_tree *shaders, struct ffp_frag_desc *desc) DECLSPEC_HIDDEN; -/***************************************************************************** - * IWineD3D implementation structure - */ -typedef struct IWineD3DImpl +struct wined3d { - /* IUnknown fields */ - const IWineD3DVtbl *lpVtbl; - LONG ref; /* Note: Ref counting not required */ - - /* WineD3D Information */ + LONG ref; void *parent; - UINT dxVersion; - + UINT dxVersion; UINT adapter_count; struct wined3d_adapter adapters[1]; -} IWineD3DImpl; +}; -HRESULT wined3d_init(IWineD3DImpl *wined3d, UINT version, void *parent) DECLSPEC_HIDDEN; -BOOL wined3d_register_window(HWND window, struct IWineD3DDeviceImpl *device) DECLSPEC_HIDDEN; +HRESULT wined3d_init(struct wined3d *wined3d, UINT version, void *parent) DECLSPEC_HIDDEN; +BOOL wined3d_register_window(HWND window, struct wined3d_device *device) DECLSPEC_HIDDEN; void wined3d_unregister_window(HWND window) DECLSPEC_HIDDEN; /***************************************************************************** @@ -1600,15 +1641,19 @@ void wined3d_unregister_window(HWND window) DECLSPEC_HIDDEN; /* Multithreaded flag. Removed from the public header to signal that IWineD3D::CreateDevice ignores it */ #define WINED3DCREATE_MULTITHREADED 0x00000004 -struct IWineD3DDeviceImpl +struct wined3d_fb_state { - /* IUnknown fields */ - const IWineD3DDeviceVtbl *lpVtbl; - LONG ref; /* Note: Ref counting not required */ + struct wined3d_surface **render_targets; + struct wined3d_surface *depth_stencil; +}; + +struct wined3d_device +{ + LONG ref; /* WineD3D Information */ - IWineD3DDeviceParent *device_parent; - IWineD3D *wined3d; + struct wined3d_device_parent *device_parent; + struct wined3d *wined3d; struct wined3d_adapter *adapter; /* Window styles to restore when switching fullscreen mode */ @@ -1616,13 +1661,12 @@ struct IWineD3DDeviceImpl LONG exStyle; /* X and GL Information */ - GLint maxConcurrentLights; GLenum offscreenBuffer; /* Selected capabilities */ int vs_selected_mode; int ps_selected_mode; - const shader_backend_t *shader_backend; + const struct wined3d_shader_backend_ops *shader_backend; void *shader_priv; void *fragment_priv; void *blit_priv; @@ -1642,14 +1686,13 @@ struct IWineD3DDeviceImpl WORD isRecordingState : 1; WORD isInDraw : 1; WORD bCursorVisible : 1; - WORD haveHardwareCursor : 1; WORD d3d_initialized : 1; WORD inScene : 1; /* A flag to check for proper BeginScene / EndScene call pairs */ WORD softwareVertexProcessing : 1; /* process vertex shaders using software or hardware */ WORD useDrawStridedSlow : 1; WORD instancedDraw : 1; WORD filter_messages : 1; - WORD padding : 3; + WORD padding : 4; BYTE fixed_function_usage_map; /* MAX_TEXTURES, 8 */ @@ -1658,31 +1701,31 @@ struct IWineD3DDeviceImpl unsigned char surface_alignment; /* Line Alignment of surfaces */ /* State block related */ - IWineD3DStateBlockImpl *stateBlock; - IWineD3DStateBlockImpl *updateStateBlock; + struct wined3d_stateblock *stateBlock; + struct wined3d_stateblock *updateStateBlock; /* Internal use fields */ WINED3DDEVICE_CREATION_PARAMETERS createParms; WINED3DDEVTYPE devType; HWND focus_window; - IWineD3DSwapChain **swapchains; - UINT NumberOfSwapChains; + struct wined3d_swapchain **swapchains; + UINT swapchain_count; struct list resources; /* a linked list to track resources created by the device */ struct list shaders; /* a linked list to track shaders (pixel and vertex) */ unsigned int highest_dirty_ps_const, highest_dirty_vs_const; /* Render Target Support */ - IWineD3DSurfaceImpl **render_targets; - IWineD3DSurfaceImpl *auto_depth_stencil; - IWineD3DSurfaceImpl *onscreen_depth_stencil; - IWineD3DSurfaceImpl *depth_stencil; + DWORD valid_rt_mask; + struct wined3d_fb_state fb; + struct wined3d_surface *onscreen_depth_stencil; + struct wined3d_surface *auto_depth_stencil; /* palettes texture management */ - UINT NumberOfPalettes; - PALETTEENTRY **palettes; - UINT currentPalette; + PALETTEENTRY **palettes; + UINT palette_count; + UINT currentPalette; /* For rendering to a texture using glCopyTexImage */ GLuint depth_blt_texture; @@ -1700,7 +1743,7 @@ struct IWineD3DDeviceImpl HCURSOR hardwareCursor; /* The Wine logo surface */ - IWineD3DSurface *logo_surface; + struct wined3d_surface *logo_surface; /* Textures for when no other textures are mapped */ UINT dummyTextureName[MAX_TEXTURES]; @@ -1709,9 +1752,6 @@ struct IWineD3DDeviceImpl DWORD ddraw_width, ddraw_height; enum wined3d_format_id ddraw_format; - /* Final position fixup constant */ - float posFixup[4]; - /* With register combiners we can skip junk texture stages */ DWORD texUnitMap[MAX_COMBINED_SAMPLERS]; DWORD rev_tex_unit_map[MAX_COMBINED_SAMPLERS]; @@ -1724,7 +1764,7 @@ struct IWineD3DDeviceImpl /* Context management */ struct wined3d_context **contexts; - UINT numContexts; + UINT context_count; /* High level patch management */ #define PATCHMAP_SIZE 43 @@ -1733,27 +1773,27 @@ struct IWineD3DDeviceImpl struct WineD3DRectPatch *currentPatch; }; -HRESULT device_clear_render_targets(IWineD3DDeviceImpl *device, UINT rt_count, IWineD3DSurfaceImpl **rts, - UINT rect_count, const RECT *rects, const RECT *draw_rect, DWORD flags, - const WINED3DCOLORVALUE *color, float depth, DWORD stencil) DECLSPEC_HIDDEN; -BOOL device_context_add(IWineD3DDeviceImpl *device, struct wined3d_context *context) DECLSPEC_HIDDEN; -void device_context_remove(IWineD3DDeviceImpl *device, struct wined3d_context *context) DECLSPEC_HIDDEN; -void device_get_draw_rect(IWineD3DDeviceImpl *device, RECT *rect) DECLSPEC_HIDDEN; -HRESULT device_init(IWineD3DDeviceImpl *device, IWineD3DImpl *wined3d, +HRESULT device_clear_render_targets(struct wined3d_device *device, UINT rt_count, struct wined3d_surface **rts, + struct wined3d_surface *depth_stencil, UINT rect_count, const RECT *rects, const RECT *draw_rect, + DWORD flags, const WINED3DCOLORVALUE *color, float depth, DWORD stencil) DECLSPEC_HIDDEN; +BOOL device_context_add(struct wined3d_device *device, struct wined3d_context *context) DECLSPEC_HIDDEN; +void device_context_remove(struct wined3d_device *device, struct wined3d_context *context) DECLSPEC_HIDDEN; +void device_get_draw_rect(struct wined3d_device *device, RECT *rect) DECLSPEC_HIDDEN; +HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d, UINT adapter_idx, WINED3DDEVTYPE device_type, HWND focus_window, DWORD flags, - IWineD3DDeviceParent *device_parent) DECLSPEC_HIDDEN; -void device_preload_textures(IWineD3DDeviceImpl *device) DECLSPEC_HIDDEN; -LRESULT device_process_message(IWineD3DDeviceImpl *device, HWND window, + struct wined3d_device_parent *device_parent) DECLSPEC_HIDDEN; +void device_preload_textures(struct wined3d_device *device) DECLSPEC_HIDDEN; +LRESULT device_process_message(struct wined3d_device *device, HWND window, BOOL unicode, UINT message, WPARAM wparam, LPARAM lparam, WNDPROC proc) DECLSPEC_HIDDEN; -void device_resource_add(IWineD3DDeviceImpl *This, IWineD3DResource *resource) DECLSPEC_HIDDEN; -void device_resource_released(IWineD3DDeviceImpl *This, IWineD3DResource *resource) DECLSPEC_HIDDEN; -void device_stream_info_from_declaration(IWineD3DDeviceImpl *This, +void device_resource_add(struct wined3d_device *device, struct wined3d_resource *resource) DECLSPEC_HIDDEN; +void device_resource_released(struct wined3d_device *device, struct wined3d_resource *resource) DECLSPEC_HIDDEN; +void device_stream_info_from_declaration(struct wined3d_device *device, BOOL use_vshader, struct wined3d_stream_info *stream_info, BOOL *fixup) DECLSPEC_HIDDEN; -void device_switch_onscreen_ds(IWineD3DDeviceImpl *device, struct wined3d_context *context, - IWineD3DSurfaceImpl *depth_stencil) DECLSPEC_HIDDEN; -void device_update_stream_info(IWineD3DDeviceImpl *device, const struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN; -void IWineD3DDeviceImpl_FindTexUnitMap(IWineD3DDeviceImpl *This) DECLSPEC_HIDDEN; -void IWineD3DDeviceImpl_MarkStateDirty(IWineD3DDeviceImpl *This, DWORD state) DECLSPEC_HIDDEN; +void device_switch_onscreen_ds(struct wined3d_device *device, struct wined3d_context *context, + struct wined3d_surface *depth_stencil) DECLSPEC_HIDDEN; +void device_update_stream_info(struct wined3d_device *device, const struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN; +void device_update_tex_unit_map(struct wined3d_device *device) DECLSPEC_HIDDEN; +void IWineD3DDeviceImpl_MarkStateDirty(struct wined3d_device *device, DWORD state) DECLSPEC_HIDDEN; static inline BOOL isStateDirty(struct wined3d_context *context, DWORD state) { @@ -1762,38 +1802,32 @@ static inline BOOL isStateDirty(struct wined3d_context *context, DWORD state) return context->isStateDirty[idx] & (1 << shift); } -/* Support for IWineD3DResource ::Set/Get/FreePrivateData. */ -typedef struct PrivateData +#define WINED3D_RESOURCE_ACCESS_GPU 0x1 +#define WINED3D_RESOURCE_ACCESS_CPU 0x2 +/* SCRATCH is mostly the same as CPU, but can't be used by the GPU at all, + * not even for resource uploads. */ +#define WINED3D_RESOURCE_ACCESS_SCRATCH 0x4 + +struct wined3d_resource_ops { - struct list entry; + void (*resource_unload)(struct wined3d_resource *resource); +}; - GUID tag; - DWORD flags; /* DDSPD_* */ - - union - { - LPVOID data; - LPUNKNOWN object; - } ptr; - - DWORD size; -} PrivateData; - -/***************************************************************************** - * IWineD3DResource implementation structure - */ -typedef struct IWineD3DResourceClass +struct wined3d_resource { - /* IUnknown fields */ - LONG ref; /* Note: Ref counting not required */ - - /* WineD3DResource Information */ + LONG ref; + struct wined3d_device *device; WINED3DRESOURCETYPE resourceType; - IWineD3DDeviceImpl *device; - WINED3DPOOL pool; - UINT size; - DWORD usage; const struct wined3d_format *format; + WINED3DMULTISAMPLE_TYPE multisample_type; + UINT multisample_quality; + DWORD usage; + WINED3DPOOL pool; + DWORD access_flags; + UINT width; + UINT height; + UINT depth; + UINT size; DWORD priority; BYTE *allocatedMemory; /* Pointer to the real data location */ BYTE *heapMemory; /* Pointer to the HeapAlloced block of memory */ @@ -1802,36 +1836,28 @@ typedef struct IWineD3DResourceClass void *parent; const struct wined3d_parent_ops *parent_ops; -} IWineD3DResourceClass; + const struct wined3d_resource_ops *resource_ops; +}; -typedef struct IWineD3DResourceImpl -{ - /* IUnknown & WineD3DResource Information */ - const IWineD3DResourceVtbl *lpVtbl; - IWineD3DResourceClass resource; -} IWineD3DResourceImpl; - -void resource_cleanup(IWineD3DResource *iface) DECLSPEC_HIDDEN; -HRESULT resource_free_private_data(IWineD3DResource *iface, REFGUID guid) DECLSPEC_HIDDEN; -DWORD resource_get_priority(IWineD3DResource *iface) DECLSPEC_HIDDEN; -HRESULT resource_get_private_data(IWineD3DResource *iface, REFGUID guid, +void resource_cleanup(struct wined3d_resource *resource) DECLSPEC_HIDDEN; +HRESULT resource_free_private_data(struct wined3d_resource *resource, REFGUID guid) DECLSPEC_HIDDEN; +DWORD resource_get_priority(const struct wined3d_resource *resource) DECLSPEC_HIDDEN; +HRESULT resource_get_private_data(const struct wined3d_resource *resource, REFGUID guid, void *data, DWORD *data_size) DECLSPEC_HIDDEN; -HRESULT resource_init(IWineD3DResource *iface, WINED3DRESOURCETYPE resource_type, - IWineD3DDeviceImpl *device, UINT size, DWORD usage, const struct wined3d_format *format, - WINED3DPOOL pool, void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN; -WINED3DRESOURCETYPE resource_get_type(IWineD3DResource *iface) DECLSPEC_HIDDEN; -DWORD resource_set_priority(IWineD3DResource *iface, DWORD new_priority) DECLSPEC_HIDDEN; -HRESULT resource_set_private_data(IWineD3DResource *iface, REFGUID guid, +HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *device, + WINED3DRESOURCETYPE resource_type, const struct wined3d_format *format, + WINED3DMULTISAMPLE_TYPE multisample_type, UINT multisample_quality, + DWORD usage, WINED3DPOOL pool, UINT width, UINT height, UINT depth, UINT size, + void *parent, const struct wined3d_parent_ops *parent_ops, + const struct wined3d_resource_ops *resource_ops) DECLSPEC_HIDDEN; +DWORD resource_set_priority(struct wined3d_resource *resource, DWORD priority) DECLSPEC_HIDDEN; +HRESULT resource_set_private_data(struct wined3d_resource *resource, REFGUID guid, const void *data, DWORD data_size, DWORD flags) DECLSPEC_HIDDEN; -void resource_unload(IWineD3DResourceImpl *resource) DECLSPEC_HIDDEN; +void resource_unload(struct wined3d_resource *resource) DECLSPEC_HIDDEN; /* Tests show that the start address of resources is 32 byte aligned */ #define RESOURCE_ALIGNMENT 16 -/***************************************************************************** - * IWineD3DBaseTexture D3D- > openGL state map lookups - */ - typedef enum winetexturestates { WINED3DTEXSTA_ADDRESSU = 0, WINED3DTEXSTA_ADDRESSV = 1, @@ -1852,7 +1878,6 @@ enum WINED3DSRGB SRGB_ANY = 0, /* Uses the cached value(e.g. external calls) */ SRGB_RGB = 1, /* Loads the rgb texture */ SRGB_SRGB = 2, /* Loads the srgb texture */ - SRGB_BOTH = 3, /* Loads both textures */ }; struct gl_texture @@ -1862,148 +1887,75 @@ struct gl_texture GLuint name; }; -/***************************************************************************** - * IWineD3DBaseTexture implementation structure (extends IWineD3DResourceImpl) - */ -typedef struct IWineD3DBaseTextureClass +struct wined3d_texture_ops { - struct gl_texture texture_rgb, texture_srgb; - IWineD3DResourceImpl **sub_resources; + HRESULT (*texture_bind)(struct wined3d_texture *texture, + const struct wined3d_gl_info *gl_info, BOOL srgb); + void (*texture_preload)(struct wined3d_texture *texture, enum WINED3DSRGB srgb); + void (*texture_sub_resource_add_dirty_region)(struct wined3d_resource *sub_resource, + const WINED3DBOX *dirty_region); + void (*texture_sub_resource_cleanup)(struct wined3d_resource *sub_resource); +}; + +#define WINED3D_TEXTURE_COND_NP2 0x1 +#define WINED3D_TEXTURE_POW2_MAT_IDENT 0x2 +#define WINED3D_TEXTURE_IS_SRGB 0x4 + +struct wined3d_texture +{ + struct wined3d_resource resource; + const struct wined3d_texture_ops *texture_ops; + struct gl_texture texture_rgb, texture_srgb; + struct wined3d_resource **sub_resources; UINT layer_count; UINT level_count; - float pow2Matrix[16]; - UINT LOD; - WINED3DTEXTUREFILTERTYPE filterType; - LONG bindCount; - DWORD sampler; - BOOL is_srgb; - BOOL pow2Matrix_identity; - const struct min_lookup *minMipLookup; - const GLenum *magLookup; + float pow2_matrix[16]; + UINT lod; + WINED3DTEXTUREFILTERTYPE filter_type; + LONG bind_count; + DWORD sampler; + DWORD flags; + const struct min_lookup *min_mip_lookup; + const GLenum *mag_lookup; GLenum target; - void (*internal_preload)(IWineD3DBaseTexture *iface, enum WINED3DSRGB srgb); -} IWineD3DBaseTextureClass; +}; -typedef struct IWineD3DBaseTextureImpl +static inline struct wined3d_texture *wined3d_texture_from_resource(struct wined3d_resource *resource) { - /* IUnknown & WineD3DResource Information */ - const IWineD3DBaseTextureVtbl *lpVtbl; - IWineD3DResourceClass resource; - IWineD3DBaseTextureClass baseTexture; + return CONTAINING_RECORD(resource, struct wined3d_texture, resource); +} -} IWineD3DBaseTextureImpl; +static inline struct gl_texture *wined3d_texture_get_gl_texture(struct wined3d_texture *texture, + const struct wined3d_gl_info *gl_info, BOOL srgb) +{ + return srgb && !gl_info->supported[EXT_TEXTURE_SRGB_DECODE] + ? &texture->texture_srgb : &texture->texture_rgb; +} -void basetexture_apply_state_changes(IWineD3DBaseTexture *iface, - const DWORD textureStates[WINED3D_HIGHEST_TEXTURE_STATE + 1], +void wined3d_texture_apply_state_changes(struct wined3d_texture *texture, const DWORD samplerStates[WINED3D_HIGHEST_SAMPLER_STATE + 1], const struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN; -HRESULT basetexture_bind(IWineD3DBaseTexture *iface, BOOL srgb, BOOL *set_surface_desc) DECLSPEC_HIDDEN; -void basetexture_cleanup(IWineD3DBaseTexture *iface) DECLSPEC_HIDDEN; -void basetexture_generate_mipmaps(IWineD3DBaseTexture *iface) DECLSPEC_HIDDEN; -WINED3DTEXTUREFILTERTYPE basetexture_get_autogen_filter_type(IWineD3DBaseTexture *iface) DECLSPEC_HIDDEN; -BOOL basetexture_get_dirty(IWineD3DBaseTexture *iface) DECLSPEC_HIDDEN; -DWORD basetexture_get_level_count(IWineD3DBaseTexture *iface) DECLSPEC_HIDDEN; -DWORD basetexture_get_lod(IWineD3DBaseTexture *iface) DECLSPEC_HIDDEN; -IWineD3DResourceImpl *basetexture_get_sub_resource(IWineD3DBaseTextureImpl *texture, - UINT layer, UINT level) DECLSPEC_HIDDEN; -HRESULT basetexture_init(IWineD3DBaseTextureImpl *texture, UINT layer_count, UINT level_count, - WINED3DRESOURCETYPE resource_type, IWineD3DDeviceImpl *device, UINT size, DWORD usage, - const struct wined3d_format *format, WINED3DPOOL pool, void *parent, - const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN; -HRESULT basetexture_set_autogen_filter_type(IWineD3DBaseTexture *iface, - WINED3DTEXTUREFILTERTYPE filter_type) DECLSPEC_HIDDEN; -BOOL basetexture_set_dirty(IWineD3DBaseTexture *iface, BOOL dirty) DECLSPEC_HIDDEN; -DWORD basetexture_set_lod(IWineD3DBaseTexture *iface, DWORD new_lod) DECLSPEC_HIDDEN; -void basetexture_unload(IWineD3DBaseTexture *iface) DECLSPEC_HIDDEN; +void wined3d_texture_set_dirty(struct wined3d_texture *texture, BOOL dirty) DECLSPEC_HIDDEN; -/***************************************************************************** - * IWineD3DTexture implementation structure (extends IWineD3DBaseTextureImpl) - */ -typedef struct IWineD3DTextureImpl +struct wined3d_volume { - /* IUnknown & WineD3DResource/WineD3DBaseTexture Information */ - const IWineD3DTextureVtbl *lpVtbl; - IWineD3DResourceClass resource; - IWineD3DBaseTextureClass baseTexture; - - /* IWineD3DTexture */ - BOOL cond_np2; - -} IWineD3DTextureImpl; - -HRESULT texture_init(IWineD3DTextureImpl *texture, UINT width, UINT height, UINT levels, - IWineD3DDeviceImpl *device, DWORD usage, enum wined3d_format_id format_id, WINED3DPOOL pool, - void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN; - -/***************************************************************************** - * IWineD3DCubeTexture implementation structure (extends IWineD3DBaseTextureImpl) - */ -typedef struct IWineD3DCubeTextureImpl -{ - /* IUnknown & WineD3DResource/WineD3DBaseTexture Information */ - const IWineD3DCubeTextureVtbl *lpVtbl; - IWineD3DResourceClass resource; - IWineD3DBaseTextureClass baseTexture; -} IWineD3DCubeTextureImpl; - -HRESULT cubetexture_init(IWineD3DCubeTextureImpl *texture, UINT edge_length, UINT levels, - IWineD3DDeviceImpl *device, DWORD usage, enum wined3d_format_id format_id, WINED3DPOOL pool, - void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN; - -typedef struct _WINED3DVOLUMET_DESC -{ - UINT Width; - UINT Height; - UINT Depth; -} WINED3DVOLUMET_DESC; - -/***************************************************************************** - * IWineD3DVolume implementation structure (extends IUnknown) - */ -typedef struct IWineD3DVolumeImpl -{ - /* IUnknown & WineD3DResource fields */ - const IWineD3DVolumeVtbl *lpVtbl; - IWineD3DResourceClass resource; - - /* WineD3DVolume Information */ - WINED3DVOLUMET_DESC currentDesc; - struct IWineD3DVolumeTextureImpl *container; + struct wined3d_resource resource; + struct wined3d_texture *container; BOOL lockable; BOOL locked; WINED3DBOX lockedBox; WINED3DBOX dirtyBox; BOOL dirty; -} IWineD3DVolumeImpl; +}; -void volume_add_dirty_box(IWineD3DVolume *iface, const WINED3DBOX *dirty_box) DECLSPEC_HIDDEN; -HRESULT volume_init(IWineD3DVolumeImpl *volume, IWineD3DDeviceImpl *device, UINT width, - UINT height, UINT depth, DWORD usage, enum wined3d_format_id format_id, WINED3DPOOL pool, - void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN; -void volume_set_container(IWineD3DVolumeImpl *volume, struct IWineD3DVolumeTextureImpl *container) DECLSPEC_HIDDEN; - -/***************************************************************************** - * IWineD3DVolumeTexture implementation structure (extends IWineD3DBaseTextureImpl) - */ -typedef struct IWineD3DVolumeTextureImpl +static inline struct wined3d_volume *volume_from_resource(struct wined3d_resource *resource) { - /* IUnknown & WineD3DResource/WineD3DBaseTexture Information */ - const IWineD3DVolumeTextureVtbl *lpVtbl; - IWineD3DResourceClass resource; - IWineD3DBaseTextureClass baseTexture; -} IWineD3DVolumeTextureImpl; + return CONTAINING_RECORD(resource, struct wined3d_volume, resource); +} -HRESULT volumetexture_init(IWineD3DVolumeTextureImpl *texture, UINT width, UINT height, - UINT depth, UINT levels, IWineD3DDeviceImpl *device, DWORD usage, enum wined3d_format_id format_id, - WINED3DPOOL pool, void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN; - -typedef struct _WINED3DSURFACET_DESC -{ - WINED3DMULTISAMPLE_TYPE MultiSampleType; - DWORD MultiSampleQuality; - UINT Width; - UINT Height; -} WINED3DSURFACET_DESC; +void volume_add_dirty_box(struct wined3d_volume *volume, const WINED3DBOX *dirty_box) DECLSPEC_HIDDEN; +void volume_load(struct wined3d_volume *volume, UINT level, BOOL srgb_mode) DECLSPEC_HIDDEN; +void volume_set_container(struct wined3d_volume *volume, struct wined3d_texture *container) DECLSPEC_HIDDEN; /***************************************************************************** * Structure for DIB Surfaces (GetDC and GDI surfaces) @@ -2016,33 +1968,30 @@ typedef struct wineD3DSurface_DIB { BOOL client_memory; } wineD3DSurface_DIB; -typedef struct { +struct wined3d_renderbuffer_entry +{ struct list entry; GLuint id; UINT width; UINT height; -} renderbuffer_entry_t; +}; struct fbo_entry { struct list entry; - IWineD3DSurfaceImpl **render_targets; - IWineD3DSurfaceImpl *depth_stencil; + struct wined3d_surface **render_targets; + struct wined3d_surface *depth_stencil; DWORD location; BOOL attached; GLuint id; }; -/***************************************************************************** - * IWineD3DClipp implementation structure - */ -typedef struct IWineD3DClipperImpl +struct wined3d_clipper { - const IWineD3DClipperVtbl *lpVtbl; LONG ref; HWND hWnd; -} IWineD3DClipperImpl; +}; enum wined3d_container_type { @@ -2056,30 +2005,42 @@ struct wined3d_subresource_container enum wined3d_container_type type; union { - struct IWineD3DBase *base; - struct IWineD3DSwapChainImpl *swapchain; - struct IWineD3DBaseTextureImpl *texture; + struct wined3d_swapchain *swapchain; + struct wined3d_texture *texture; + void *base; } u; }; -/***************************************************************************** - * IWineD3DSurface implementation structure - */ -struct IWineD3DSurfaceImpl +struct wined3d_surface_ops { - /* IUnknown & IWineD3DResource Information */ - const IWineD3DSurfaceVtbl *lpVtbl; - IWineD3DResourceClass resource; + HRESULT (*surface_private_setup)(struct wined3d_surface *surface); + void (*surface_cleanup)(struct wined3d_surface *surface); + void (*surface_realize_palette)(struct wined3d_surface *surface); + HRESULT (*surface_draw_overlay)(struct wined3d_surface *surface); + void (*surface_preload)(struct wined3d_surface *surface); + void (*surface_map)(struct wined3d_surface *surface, const RECT *rect, DWORD flags); + void (*surface_unmap)(struct wined3d_surface *surface); + HRESULT (*surface_getdc)(struct wined3d_surface *surface); + HRESULT (*surface_flip)(struct wined3d_surface *surface, struct wined3d_surface *override); + HRESULT (*surface_blt)(struct wined3d_surface *dst_surface, const RECT *dst_rect, + struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags, + const WINEDDBLTFX *fx, WINED3DTEXTUREFILTERTYPE filter); + HRESULT (*surface_bltfast)(struct wined3d_surface *dst_surface, DWORD dst_x, DWORD dst_y, + struct wined3d_surface *src_surface, const RECT *src_rect, DWORD trans); + HRESULT (*surface_set_mem)(struct wined3d_surface *surface, void *mem); +}; - /* IWineD3DSurface fields */ +struct wined3d_surface +{ + struct wined3d_resource resource; + const struct wined3d_surface_ops *surface_ops; struct wined3d_subresource_container container; - WINED3DSURFACET_DESC currentDesc; - IWineD3DPaletteImpl *palette; /* D3D7 style palette handling */ + struct wined3d_palette *palette; /* D3D7 style palette handling */ PALETTEENTRY *palette9; /* D3D8/9 style palette handling */ - /* TODO: move this off into a management class(maybe!) */ - DWORD Flags; + DWORD flags; + WINED3DSURFTYPE surface_type; UINT pow2Width; UINT pow2Height; @@ -2112,98 +2073,61 @@ struct IWineD3DSurfaceImpl WINEDDCOLORKEY glCKey; struct list renderbuffers; - renderbuffer_entry_t *current_renderbuffer; + struct wined3d_renderbuffer_entry *current_renderbuffer; SIZE ds_current_size; /* DirectDraw clippers */ - IWineD3DClipper *clipper; + struct wined3d_clipper *clipper; /* DirectDraw Overlay handling */ RECT overlay_srcrect; RECT overlay_destrect; - IWineD3DSurfaceImpl *overlay_dest; + struct wined3d_surface *overlay_dest; struct list overlays; struct list overlay_entry; }; -extern const IWineD3DSurfaceVtbl IWineD3DSurface_Vtbl DECLSPEC_HIDDEN; -extern const IWineD3DSurfaceVtbl IWineGDISurface_Vtbl DECLSPEC_HIDDEN; +static inline struct wined3d_surface *surface_from_resource(struct wined3d_resource *resource) +{ + return CONTAINING_RECORD(resource, struct wined3d_surface, resource); +} -void surface_add_dirty_rect(IWineD3DSurfaceImpl *surface, const RECT *dirty_rect) DECLSPEC_HIDDEN; -HRESULT surface_color_fill(IWineD3DSurfaceImpl *s, const RECT *rect, const WINED3DCOLORVALUE *color) DECLSPEC_HIDDEN; -void surface_gdi_cleanup(IWineD3DSurfaceImpl *This) DECLSPEC_HIDDEN; -GLenum surface_get_gl_buffer(IWineD3DSurfaceImpl *surface) DECLSPEC_HIDDEN; -HRESULT surface_init(IWineD3DSurfaceImpl *surface, WINED3DSURFTYPE surface_type, UINT alignment, - UINT width, UINT height, UINT level, BOOL lockable, BOOL discard, WINED3DMULTISAMPLE_TYPE multisample_type, - UINT multisample_quality, IWineD3DDeviceImpl *device, DWORD usage, enum wined3d_format_id format_id, - WINED3DPOOL pool, void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN; -BOOL surface_init_sysmem(IWineD3DSurfaceImpl *surface) DECLSPEC_HIDDEN; -void surface_internal_preload(IWineD3DSurfaceImpl *surface, enum WINED3DSRGB srgb) DECLSPEC_HIDDEN; -BOOL surface_is_offscreen(IWineD3DSurfaceImpl *iface) DECLSPEC_HIDDEN; -void surface_load_ds_location(IWineD3DSurfaceImpl *surface, +static inline GLuint surface_get_texture_name(struct wined3d_surface *surface, + const struct wined3d_gl_info *gl_info, BOOL srgb) +{ + return srgb && !gl_info->supported[EXT_TEXTURE_SRGB_DECODE] + ? surface->texture_name_srgb : surface->texture_name; +} + +void surface_add_dirty_rect(struct wined3d_surface *surface, const WINED3DBOX *dirty_rect) DECLSPEC_HIDDEN; +void surface_bind(struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info, BOOL srgb) DECLSPEC_HIDDEN; +HRESULT surface_color_fill(struct wined3d_surface *s, const RECT *rect, const WINED3DCOLORVALUE *color) DECLSPEC_HIDDEN; +GLenum surface_get_gl_buffer(struct wined3d_surface *surface) DECLSPEC_HIDDEN; +BOOL surface_init_sysmem(struct wined3d_surface *surface) DECLSPEC_HIDDEN; +void surface_internal_preload(struct wined3d_surface *surface, enum WINED3DSRGB srgb) DECLSPEC_HIDDEN; +BOOL surface_is_offscreen(struct wined3d_surface *surface) DECLSPEC_HIDDEN; +HRESULT surface_load(struct wined3d_surface *surface, BOOL srgb) DECLSPEC_HIDDEN; +void surface_load_ds_location(struct wined3d_surface *surface, struct wined3d_context *context, DWORD location) DECLSPEC_HIDDEN; -HRESULT surface_load_location(IWineD3DSurfaceImpl *surface, DWORD flag, const RECT *rect) DECLSPEC_HIDDEN; -void surface_modify_ds_location(IWineD3DSurfaceImpl *surface, DWORD location, UINT w, UINT h) DECLSPEC_HIDDEN; -void surface_modify_location(IWineD3DSurfaceImpl *surface, DWORD flag, BOOL persistent) DECLSPEC_HIDDEN; -void surface_prepare_texture(IWineD3DSurfaceImpl *surface, +HRESULT surface_load_location(struct wined3d_surface *surface, DWORD flag, const RECT *rect) DECLSPEC_HIDDEN; +void surface_modify_ds_location(struct wined3d_surface *surface, DWORD location, UINT w, UINT h) DECLSPEC_HIDDEN; +void surface_modify_location(struct wined3d_surface *surface, DWORD flag, BOOL persistent) DECLSPEC_HIDDEN; +void surface_prepare_texture(struct wined3d_surface *surface, const struct wined3d_gl_info *gl_info, BOOL srgb) DECLSPEC_HIDDEN; -void surface_set_compatible_renderbuffer(IWineD3DSurfaceImpl *surface, - unsigned int width, unsigned int height) DECLSPEC_HIDDEN; -void surface_set_container(IWineD3DSurfaceImpl *surface, - enum wined3d_container_type type, IWineD3DBase *container) DECLSPEC_HIDDEN; -void surface_set_texture_name(IWineD3DSurfaceImpl *surface, GLuint name, BOOL srgb_name) DECLSPEC_HIDDEN; -void surface_set_texture_target(IWineD3DSurfaceImpl *surface, GLenum target) DECLSPEC_HIDDEN; -void surface_translate_frontbuffer_coords(IWineD3DSurfaceImpl *surface, HWND window, RECT *rect) DECLSPEC_HIDDEN; - -/* Predeclare the shared Surface functions */ -HRESULT WINAPI IWineD3DBaseSurfaceImpl_QueryInterface(IWineD3DSurface *iface, - REFIID riid, LPVOID *ppobj) DECLSPEC_HIDDEN; -ULONG WINAPI IWineD3DBaseSurfaceImpl_AddRef(IWineD3DSurface *iface) DECLSPEC_HIDDEN; -void * WINAPI IWineD3DBaseSurfaceImpl_GetParent(IWineD3DSurface *iface) DECLSPEC_HIDDEN; -HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetPrivateData(IWineD3DSurface *iface, - REFGUID refguid, const void *pData, DWORD SizeOfData, DWORD Flags) DECLSPEC_HIDDEN; -HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetPrivateData(IWineD3DSurface *iface, - REFGUID refguid, void *pData, DWORD *pSizeOfData) DECLSPEC_HIDDEN; -HRESULT WINAPI IWineD3DBaseSurfaceImpl_FreePrivateData(IWineD3DSurface *iface, REFGUID refguid) DECLSPEC_HIDDEN; -DWORD WINAPI IWineD3DBaseSurfaceImpl_SetPriority(IWineD3DSurface *iface, DWORD PriorityNew) DECLSPEC_HIDDEN; -DWORD WINAPI IWineD3DBaseSurfaceImpl_GetPriority(IWineD3DSurface *iface) DECLSPEC_HIDDEN; -WINED3DRESOURCETYPE WINAPI IWineD3DBaseSurfaceImpl_GetType(IWineD3DSurface *iface) DECLSPEC_HIDDEN; -void WINAPI IWineD3DBaseSurfaceImpl_GetDesc(IWineD3DSurface *iface, WINED3DSURFACE_DESC *desc) DECLSPEC_HIDDEN; -HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetBltStatus(IWineD3DSurface *iface, DWORD Flags) DECLSPEC_HIDDEN; -HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetFlipStatus(IWineD3DSurface *iface, DWORD Flags) DECLSPEC_HIDDEN; -HRESULT WINAPI IWineD3DBaseSurfaceImpl_IsLost(IWineD3DSurface *iface) DECLSPEC_HIDDEN; -HRESULT WINAPI IWineD3DBaseSurfaceImpl_Restore(IWineD3DSurface *iface) DECLSPEC_HIDDEN; -HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetPalette(IWineD3DSurface *iface, IWineD3DPalette **Pal) DECLSPEC_HIDDEN; -HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetPalette(IWineD3DSurface *iface, IWineD3DPalette *Pal) DECLSPEC_HIDDEN; -HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetColorKey(IWineD3DSurface *iface, - DWORD Flags, const WINEDDCOLORKEY *CKey) DECLSPEC_HIDDEN; -DWORD WINAPI IWineD3DBaseSurfaceImpl_GetPitch(IWineD3DSurface *iface) DECLSPEC_HIDDEN; -HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetOverlayPosition(IWineD3DSurface *iface, LONG X, LONG Y) DECLSPEC_HIDDEN; -HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetOverlayPosition(IWineD3DSurface *iface, LONG *X, LONG *Y) DECLSPEC_HIDDEN; -HRESULT WINAPI IWineD3DBaseSurfaceImpl_UpdateOverlayZOrder(IWineD3DSurface *iface, - DWORD Flags, IWineD3DSurface *Ref) DECLSPEC_HIDDEN; -HRESULT WINAPI IWineD3DBaseSurfaceImpl_UpdateOverlay(IWineD3DSurface *iface, const RECT *SrcRect, - IWineD3DSurface *DstSurface, const RECT *DstRect, DWORD Flags, const WINEDDOVERLAYFX *FX) DECLSPEC_HIDDEN; -HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetClipper(IWineD3DSurface *iface, IWineD3DClipper *clipper) DECLSPEC_HIDDEN; -HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetClipper(IWineD3DSurface *iface, IWineD3DClipper **clipper) DECLSPEC_HIDDEN; -HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetFormat(IWineD3DSurface *iface, - enum wined3d_format_id format_id) DECLSPEC_HIDDEN; -HRESULT IWineD3DBaseSurfaceImpl_CreateDIBSection(IWineD3DSurface *iface) DECLSPEC_HIDDEN; -HRESULT WINAPI IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface, const RECT *dst_rect, IWineD3DSurface *src_surface, - const RECT *src_rect, DWORD flags, const WINEDDBLTFX *fx, WINED3DTEXTUREFILTERTYPE filter) DECLSPEC_HIDDEN; -HRESULT WINAPI IWineD3DBaseSurfaceImpl_BltFast(IWineD3DSurface *iface, DWORD dstx, DWORD dsty, - IWineD3DSurface *Source, const RECT *rsrc, DWORD trans) DECLSPEC_HIDDEN; -HRESULT WINAPI IWineD3DBaseSurfaceImpl_LockRect(IWineD3DSurface *iface, WINED3DLOCKED_RECT *pLockedRect, - const RECT *pRect, DWORD Flags) DECLSPEC_HIDDEN; -const void *WINAPI IWineD3DBaseSurfaceImpl_GetData(IWineD3DSurface *iface) DECLSPEC_HIDDEN; +void surface_set_compatible_renderbuffer(struct wined3d_surface *surface, struct wined3d_surface *rt) DECLSPEC_HIDDEN; +void surface_set_container(struct wined3d_surface *surface, + enum wined3d_container_type type, void *container) DECLSPEC_HIDDEN; +void surface_set_texture_name(struct wined3d_surface *surface, GLuint name, BOOL srgb_name) DECLSPEC_HIDDEN; +void surface_set_texture_target(struct wined3d_surface *surface, GLenum target) DECLSPEC_HIDDEN; +void surface_translate_drawable_coords(struct wined3d_surface *surface, HWND window, RECT *rect) DECLSPEC_HIDDEN; void get_drawable_size_swapchain(struct wined3d_context *context, UINT *width, UINT *height) DECLSPEC_HIDDEN; void get_drawable_size_backbuffer(struct wined3d_context *context, UINT *width, UINT *height) DECLSPEC_HIDDEN; void get_drawable_size_fbo(struct wined3d_context *context, UINT *width, UINT *height) DECLSPEC_HIDDEN; -void draw_textured_quad(IWineD3DSurfaceImpl *src_surface, const RECT *src_rect, +void draw_textured_quad(struct wined3d_surface *src_surface, const RECT *src_rect, const RECT *dst_rect, WINED3DTEXTUREFILTERTYPE Filter) DECLSPEC_HIDDEN; -void flip_surface(IWineD3DSurfaceImpl *front, IWineD3DSurfaceImpl *back) DECLSPEC_HIDDEN; +void flip_surface(struct wined3d_surface *front, struct wined3d_surface *back) DECLSPEC_HIDDEN; /* Surface flags: */ #define SFLAG_CONVERTED 0x00000002 /* Converted for color keying or Palettized */ @@ -2265,15 +2189,11 @@ typedef enum { CONVERT_RGB32_888 } CONVERT_TYPES; -HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *surface, BOOL need_alpha_ck, BOOL use_texturing, +HRESULT d3dfmt_get_conv(struct wined3d_surface *surface, BOOL need_alpha_ck, BOOL use_texturing, struct wined3d_format *format, CONVERT_TYPES *convert) DECLSPEC_HIDDEN; -void d3dfmt_p8_init_palette(IWineD3DSurfaceImpl *surface, BYTE table[256][4], BOOL colorkey) DECLSPEC_HIDDEN; +void d3dfmt_p8_init_palette(struct wined3d_surface *surface, BYTE table[256][4], BOOL colorkey) DECLSPEC_HIDDEN; -BOOL palette9_changed(IWineD3DSurfaceImpl *This) DECLSPEC_HIDDEN; - -/***************************************************************************** - * IWineD3DVertexDeclaration implementation structure - */ +BOOL palette9_changed(struct wined3d_surface *surface) DECLSPEC_HIDDEN; struct wined3d_vertex_declaration_element { @@ -2287,14 +2207,12 @@ struct wined3d_vertex_declaration_element BYTE usage_idx; }; -typedef struct IWineD3DVertexDeclarationImpl { - /* IUnknown Information */ - const IWineD3DVertexDeclarationVtbl *lpVtbl; - LONG ref; - +struct wined3d_vertex_declaration +{ + LONG ref; void *parent; const struct wined3d_parent_ops *parent_ops; - IWineD3DDeviceImpl *device; + struct wined3d_device *device; struct wined3d_vertex_declaration_element *elements; UINT element_count; @@ -2303,15 +2221,7 @@ typedef struct IWineD3DVertexDeclarationImpl { UINT num_streams; BOOL position_transformed; BOOL half_float_conv_needed; -} IWineD3DVertexDeclarationImpl; - -HRESULT vertexdeclaration_init(IWineD3DVertexDeclarationImpl *declaration, IWineD3DDeviceImpl *device, - const WINED3DVERTEXELEMENT *elements, UINT element_count, - void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN; - -/***************************************************************************** - * IWineD3DStateBlock implementation structure - */ +}; /* Internal state Block for Begin/End/Capture/Create/Apply info */ /* Note: Very long winded but gl Lists are not flexible enough */ @@ -2358,7 +2268,7 @@ struct wined3d_stream_state struct wined3d_state { - IWineD3DVertexDeclarationImpl *vertex_declaration; + struct wined3d_vertex_declaration *vertex_declaration; struct wined3d_stream_state streams[MAX_STREAMS + 1 /* tesselated pseudo-stream */]; BOOL user_stream; struct wined3d_buffer *index_buffer; @@ -2367,17 +2277,17 @@ struct wined3d_state INT load_base_vertex_index; /* Non-indexed drawing needs 0 here, indexed needs base_vertex_index. */ GLenum gl_primitive_type; - struct IWineD3DVertexShaderImpl *vertex_shader; + struct wined3d_shader *vertex_shader; BOOL vs_consts_b[MAX_CONST_B]; INT vs_consts_i[MAX_CONST_I * 4]; float *vs_consts_f; - struct IWineD3DPixelShaderImpl *pixel_shader; + struct wined3d_shader *pixel_shader; BOOL ps_consts_b[MAX_CONST_B]; INT ps_consts_i[MAX_CONST_I * 4]; float *ps_consts_f; - IWineD3DBaseTextureImpl *textures[MAX_COMBINED_SAMPLERS]; + struct wined3d_texture *textures[MAX_COMBINED_SAMPLERS]; DWORD sampler_states[MAX_COMBINED_SAMPLERS][WINED3D_HIGHEST_SAMPLER_STATE + 1]; DWORD texture_states[MAX_TEXTURES][WINED3D_HIGHEST_TEXTURE_STATE + 1]; DWORD lowest_disabled_stage; @@ -2398,14 +2308,10 @@ struct wined3d_state DWORD render_states[WINEHIGHEST_RENDER_STATE + 1]; }; -struct IWineD3DStateBlockImpl +struct wined3d_stateblock { - /* IUnknown fields */ - const IWineD3DStateBlockVtbl *lpVtbl; LONG ref; /* Note: Ref counting not required */ - - /* IWineD3DStateBlock information */ - IWineD3DDeviceImpl *device; + struct wined3d_device *device; WINED3DSTATEBLOCKTYPE blockType; /* Array indicating whether things have been set or changed */ @@ -2435,12 +2341,10 @@ struct IWineD3DStateBlockImpl unsigned int num_contained_sampler_states; }; -HRESULT stateblock_init(IWineD3DStateBlockImpl *stateblock, - IWineD3DDeviceImpl *device, WINED3DSTATEBLOCKTYPE type) DECLSPEC_HIDDEN; -void stateblock_init_contained_states(IWineD3DStateBlockImpl *object) DECLSPEC_HIDDEN; -void stateblock_init_default_state(IWineD3DStateBlockImpl *stateblock) DECLSPEC_HIDDEN; +void stateblock_init_contained_states(struct wined3d_stateblock *stateblock) DECLSPEC_HIDDEN; +void stateblock_init_default_state(struct wined3d_stateblock *stateblock) DECLSPEC_HIDDEN; -static inline void stateblock_apply_state(DWORD state, IWineD3DStateBlockImpl *stateblock, +static inline void stateblock_apply_state(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) { const struct StateEntry *statetable = stateblock->device->StateTable; @@ -2457,26 +2361,23 @@ enum query_state { QUERY_SIGNALLED, QUERY_BUILDING }; -/***************************************************************************** - * IWineD3DQueryImpl implementation structure (extends IUnknown) - */ -typedef struct IWineD3DQueryImpl + +struct wined3d_query_ops { - const IWineD3DQueryVtbl *lpVtbl; - LONG ref; /* Note: Ref counting not required */ + HRESULT (*query_get_data)(struct wined3d_query *query, void *data, DWORD data_size, DWORD flags); + HRESULT (*query_issue)(struct wined3d_query *query, DWORD flags); +}; - IWineD3DDeviceImpl *device; - - /* IWineD3DQuery fields */ +struct wined3d_query +{ + LONG ref; + const struct wined3d_query_ops *query_ops; + struct wined3d_device *device; enum query_state state; WINED3DQUERYTYPE type; - /* TODO: Think about using a IUnknown instead of a void* */ + DWORD data_size; void *extendedData; -} IWineD3DQueryImpl; - -HRESULT query_init(IWineD3DQueryImpl *query, IWineD3DDeviceImpl *device, WINED3DQUERYTYPE type) DECLSPEC_HIDDEN; - -/* IWineD3DBuffer */ +}; /* TODO: Add tests and support for FLOAT16_4 POSITIONT, D3DCOLOR position, other * fixed function semantics as D3DCOLOR or FLOAT16 */ @@ -2485,7 +2386,6 @@ enum wined3d_buffer_conversion_type CONV_NONE, CONV_D3DCOLOR, CONV_POSITIONT, - CONV_FLOAT16_2, /* Also handles FLOAT16_4 */ }; struct wined3d_map_range @@ -2505,8 +2405,7 @@ struct wined3d_map_range struct wined3d_buffer { - const struct IWineD3DBufferVtbl *vtbl; - IWineD3DResourceClass resource; + struct wined3d_resource resource; struct wined3d_buffer_desc desc; @@ -2528,93 +2427,63 @@ struct wined3d_buffer UINT stride; /* 0 if no conversion */ UINT conversion_stride; /* 0 if no shifted conversion */ enum wined3d_buffer_conversion_type *conversion_map; /* NULL if no conversion */ - /* Extra load offsets, for FLOAT16 conversion */ - UINT *conversion_shift; /* NULL if no shifted conversion */ }; -const BYTE *buffer_get_memory(IWineD3DBuffer *iface, const struct wined3d_gl_info *gl_info, +static inline struct wined3d_buffer *buffer_from_resource(struct wined3d_resource *resource) +{ + return CONTAINING_RECORD(resource, struct wined3d_buffer, resource); +} + +const BYTE *buffer_get_memory(struct wined3d_buffer *buffer, const struct wined3d_gl_info *gl_info, GLuint *buffer_object) DECLSPEC_HIDDEN; BYTE *buffer_get_sysmem(struct wined3d_buffer *This, const struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN; -HRESULT buffer_init(struct wined3d_buffer *buffer, IWineD3DDeviceImpl *device, - UINT size, DWORD usage, enum wined3d_format_id format_id, WINED3DPOOL pool, GLenum bind_hint, - const char *data, void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN; -/* IWineD3DRendertargetView */ struct wined3d_rendertarget_view { - const struct IWineD3DRendertargetViewVtbl *vtbl; LONG refcount; - IWineD3DResource *resource; + struct wined3d_resource *resource; void *parent; }; -void wined3d_rendertarget_view_init(struct wined3d_rendertarget_view *view, - IWineD3DResource *resource, void *parent) DECLSPEC_HIDDEN; - -/***************************************************************************** - * IWineD3DSwapChainImpl implementation structure (extends IUnknown) - */ - -struct IWineD3DSwapChainImpl +struct wined3d_swapchain_ops { - /*IUnknown part*/ - const IWineD3DSwapChainVtbl *lpVtbl; - LONG ref; /* Note: Ref counting not required */ + HRESULT (*swapchain_present)(struct wined3d_swapchain *swapchain, const RECT *src_rect, + const RECT *dst_rect, const RGNDATA *dirty_region, DWORD flags); +}; +struct wined3d_swapchain +{ + LONG ref; void *parent; - IWineD3DDeviceImpl *device; + const struct wined3d_parent_ops *parent_ops; + const struct wined3d_swapchain_ops *swapchain_ops; + struct wined3d_device *device; - /* IWineD3DSwapChain fields */ - IWineD3DSurfaceImpl **back_buffers; - IWineD3DSurfaceImpl *front_buffer; + struct wined3d_surface **back_buffers; + struct wined3d_surface *front_buffer; WINED3DPRESENT_PARAMETERS presentParms; - DWORD orig_width, orig_height; + DWORD orig_width, orig_height; enum wined3d_format_id orig_fmt; - WINED3DGAMMARAMP orig_gamma; - BOOL render_to_fbo; + WINED3DGAMMARAMP orig_gamma; + BOOL render_to_fbo; const struct wined3d_format *ds_format; LONG prev_time, frames; /* Performance tracking */ - unsigned int vSyncCounter; struct wined3d_context **context; - unsigned int num_contexts; + unsigned int num_contexts; - HWND win_handle; + HWND win_handle; HWND device_window; + + HDC backup_dc; + HWND backup_wnd; }; -extern const IWineD3DSwapChainVtbl IWineGDISwapChain_Vtbl DECLSPEC_HIDDEN; -void x11_copy_to_screen(IWineD3DSwapChainImpl *This, const RECT *rc) DECLSPEC_HIDDEN; +void x11_copy_to_screen(struct wined3d_swapchain *swapchain, const RECT *rect) DECLSPEC_HIDDEN; -HRESULT WINAPI IWineD3DBaseSwapChainImpl_QueryInterface(IWineD3DSwapChain *iface, - REFIID riid, LPVOID *ppobj) DECLSPEC_HIDDEN; -ULONG WINAPI IWineD3DBaseSwapChainImpl_AddRef(IWineD3DSwapChain *iface) DECLSPEC_HIDDEN; -ULONG WINAPI IWineD3DBaseSwapChainImpl_Release(IWineD3DSwapChain *iface) DECLSPEC_HIDDEN; -void * WINAPI IWineD3DBaseSwapChainImpl_GetParent(IWineD3DSwapChain *iface) DECLSPEC_HIDDEN; -HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetFrontBufferData(IWineD3DSwapChain *iface, - IWineD3DSurface *dst_surface) DECLSPEC_HIDDEN; -HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetBackBuffer(IWineD3DSwapChain *iface, UINT iBackBuffer, - WINED3DBACKBUFFER_TYPE Type, IWineD3DSurface **ppBackBuffer) DECLSPEC_HIDDEN; -HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetRasterStatus(IWineD3DSwapChain *iface, - WINED3DRASTER_STATUS *pRasterStatus) DECLSPEC_HIDDEN; -HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetDisplayMode(IWineD3DSwapChain *iface, - WINED3DDISPLAYMODE *pMode) DECLSPEC_HIDDEN; -HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetDevice(IWineD3DSwapChain *iface, - IWineD3DDevice **device) DECLSPEC_HIDDEN; -HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetPresentParameters(IWineD3DSwapChain *iface, - WINED3DPRESENT_PARAMETERS *pPresentationParameters) DECLSPEC_HIDDEN; -HRESULT WINAPI IWineD3DBaseSwapChainImpl_SetGammaRamp(IWineD3DSwapChain *iface, - DWORD Flags, const WINED3DGAMMARAMP *pRamp) DECLSPEC_HIDDEN; -HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetGammaRamp(IWineD3DSwapChain *iface, - WINED3DGAMMARAMP *pRamp) DECLSPEC_HIDDEN; - -struct wined3d_context *swapchain_create_context_for_thread(IWineD3DSwapChain *iface) DECLSPEC_HIDDEN; -HRESULT swapchain_init(IWineD3DSwapChainImpl *swapchain, WINED3DSURFTYPE surface_type, - IWineD3DDeviceImpl *device, WINED3DPRESENT_PARAMETERS *present_parameters, void *parent) DECLSPEC_HIDDEN; -void swapchain_restore_fullscreen_window(IWineD3DSwapChainImpl *swapchain) DECLSPEC_HIDDEN; -void swapchain_setup_fullscreen_window(IWineD3DSwapChainImpl *swapchain, UINT w, UINT h) DECLSPEC_HIDDEN; +struct wined3d_context *swapchain_get_context(struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN; #define DEFAULT_REFRESH_RATE 0 @@ -2631,7 +2500,7 @@ const char *debug_d3dusagequery(DWORD usagequery) DECLSPEC_HIDDEN; const char *debug_d3ddeclmethod(WINED3DDECLMETHOD method) DECLSPEC_HIDDEN; const char *debug_d3ddeclusage(BYTE usage) DECLSPEC_HIDDEN; const char *debug_d3dprimitivetype(WINED3DPRIMITIVETYPE PrimitiveType) DECLSPEC_HIDDEN; -const char *debug_d3drenderstate(WINED3DRENDERSTATETYPE state) DECLSPEC_HIDDEN; +const char *debug_d3drenderstate(DWORD state) DECLSPEC_HIDDEN; const char *debug_d3dsamplerstate(DWORD state) DECLSPEC_HIDDEN; const char *debug_d3dstate(DWORD state) DECLSPEC_HIDDEN; const char *debug_d3dtexturefiltertype(WINED3DTEXTUREFILTERTYPE filter_type) DECLSPEC_HIDDEN; @@ -2656,27 +2525,27 @@ void set_tex_op_nvrc(const struct wined3d_gl_info *gl_info, const struct wined3d INT texture_idx, DWORD dst) DECLSPEC_HIDDEN; void set_texture_matrix(const float *smat, DWORD flags, BOOL calculatedCoords, BOOL transformed, enum wined3d_format_id coordtype, BOOL ffp_can_disable_proj) DECLSPEC_HIDDEN; -void texture_activate_dimensions(IWineD3DBaseTextureImpl *texture, +void texture_activate_dimensions(const struct wined3d_texture *texture, const struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN; -void sampler_texdim(DWORD state, IWineD3DStateBlockImpl *stateblock, +void sampler_texdim(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) DECLSPEC_HIDDEN; -void tex_alphaop(DWORD state, IWineD3DStateBlockImpl *stateblock, +void tex_alphaop(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) DECLSPEC_HIDDEN; -void apply_pixelshader(DWORD state, IWineD3DStateBlockImpl *stateblock, +void apply_pixelshader(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) DECLSPEC_HIDDEN; -void state_fogcolor(DWORD state, IWineD3DStateBlockImpl *stateblock, +void state_fogcolor(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) DECLSPEC_HIDDEN; -void state_fogdensity(DWORD state, IWineD3DStateBlockImpl *stateblock, +void state_fogdensity(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) DECLSPEC_HIDDEN; -void state_fogstartend(DWORD state, IWineD3DStateBlockImpl *stateblock, +void state_fogstartend(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) DECLSPEC_HIDDEN; -void state_fog_fragpart(DWORD state, IWineD3DStateBlockImpl *stateblock, +void state_fog_fragpart(DWORD state, struct wined3d_stateblock *stateblock, struct wined3d_context *context) DECLSPEC_HIDDEN; BOOL getColorBits(const struct wined3d_format *format, - short *redSize, short *greenSize, short *blueSize, short *alphaSize, short *totalSize) DECLSPEC_HIDDEN; + BYTE *redSize, BYTE *greenSize, BYTE *blueSize, BYTE *alphaSize, BYTE *totalSize) DECLSPEC_HIDDEN; BOOL getDepthStencilBits(const struct wined3d_format *format, - short *depthSize, short *stencilSize) DECLSPEC_HIDDEN; + BYTE *depthSize, BYTE *stencilSize) DECLSPEC_HIDDEN; /* Math utils */ void multiply_matrix(WINED3DMATRIX *dest, const WINED3DMATRIX *src1, const WINED3DMATRIX *src2) DECLSPEC_HIDDEN; @@ -2691,7 +2560,8 @@ typedef struct local_constant { DWORD value[4]; } local_constant; -typedef struct SHADER_LIMITS { +struct wined3d_shader_limits +{ unsigned int temporary; unsigned int texcoord; unsigned int sampler; @@ -2703,14 +2573,7 @@ typedef struct SHADER_LIMITS { unsigned int packed_input; unsigned int attributes; unsigned int label; -} SHADER_LIMITS; - -/* Keeps track of details for TEX_M#x# shader opcodes which need to - * maintain state information between multiple codes */ -typedef struct SHADER_PARSE_STATE { - unsigned int current_row; - DWORD texcoord_w[2]; -} SHADER_PARSE_STATE; +}; #ifdef __GNUC__ #define PRINTF_ATTR(fmt,args) __attribute__((format (printf,fmt,args))) @@ -2723,21 +2586,34 @@ int shader_addline(struct wined3d_shader_buffer *buffer, const char *fmt, ...) P int shader_vaddline(struct wined3d_shader_buffer *buffer, const char *fmt, va_list args) DECLSPEC_HIDDEN; /* Vertex shader utility functions */ -extern BOOL vshader_get_input(struct IWineD3DVertexShaderImpl *shader, +extern BOOL vshader_get_input(struct wined3d_shader *shader, BYTE usage_req, BYTE usage_idx_req, unsigned int *regnum) DECLSPEC_HIDDEN; -/***************************************************************************** - * IDirect3DBaseShader implementation structure - */ -typedef struct IWineD3DBaseShaderClass +struct wined3d_vertex_shader { - LONG ref; - SHADER_LIMITS limits; - SHADER_PARSE_STATE parse_state; - DWORD *function; - UINT functionLength; - UINT cur_loop_depth, cur_loop_regno; - BOOL load_local_constsF; + struct wined3d_shader_attribute attributes[MAX_ATTRIBS]; +}; + +struct wined3d_pixel_shader +{ + /* Pixel shader input semantics */ + DWORD input_reg_map[MAX_REG_INPUT]; + BOOL input_reg_used[MAX_REG_INPUT]; + unsigned int declared_in_count; + + /* Some information about the shader behavior */ + char vpos_uniform; + BOOL color0_mov; + DWORD color0_reg; +}; + +struct wined3d_shader +{ + LONG ref; + struct wined3d_shader_limits limits; + DWORD *function; + UINT functionLength; + BOOL load_local_constsF; const struct wined3d_shader_frontend *frontend; void *frontend_data; void *backend_data; @@ -2752,24 +2628,29 @@ typedef struct IWineD3DBaseShaderClass struct list constantsB; struct list constantsF; struct list constantsI; - shader_reg_maps reg_maps; + struct wined3d_shader_reg_maps reg_maps; struct wined3d_shader_signature_element input_signature[max(MAX_ATTRIBS, MAX_REG_INPUT)]; struct wined3d_shader_signature_element output_signature[MAX_REG_OUTPUT]; /* Pointer to the parent device */ - IWineD3DDevice *device; - struct list shader_list_entry; + struct wined3d_device *device; + struct list shader_list_entry; -} IWineD3DBaseShaderClass; + union + { + struct wined3d_vertex_shader vs; + struct wined3d_pixel_shader ps; + } u; +}; -typedef struct IWineD3DBaseShaderImpl { - /* IUnknown */ - const IWineD3DBaseShaderVtbl *lpVtbl; +void pixelshader_update_samplers(struct wined3d_shader_reg_maps *reg_maps, + struct wined3d_texture * const *textures) DECLSPEC_HIDDEN; +void find_ps_compile_args(const struct wined3d_state *state, + const struct wined3d_shader *shader, struct ps_compile_args *args) DECLSPEC_HIDDEN; - /* IWineD3DBaseShader */ - IWineD3DBaseShaderClass baseShader; -} IWineD3DBaseShaderImpl; +void find_vs_compile_args(const struct wined3d_state *state, + const struct wined3d_shader *shader, struct vs_compile_args *args) DECLSPEC_HIDDEN; void shader_buffer_clear(struct wined3d_shader_buffer *buffer) DECLSPEC_HIDDEN; BOOL shader_buffer_init(struct wined3d_shader_buffer *buffer) DECLSPEC_HIDDEN; @@ -2778,9 +2659,10 @@ void shader_dump_src_param(const struct wined3d_shader_src_param *param, const struct wined3d_shader_version *shader_version) DECLSPEC_HIDDEN; void shader_dump_dst_param(const struct wined3d_shader_dst_param *param, const struct wined3d_shader_version *shader_version) DECLSPEC_HIDDEN; -unsigned int shader_find_free_input_register(const struct shader_reg_maps *reg_maps, unsigned int max) DECLSPEC_HIDDEN; -void shader_generate_main(IWineD3DBaseShader *iface, struct wined3d_shader_buffer *buffer, - const shader_reg_maps *reg_maps, const DWORD *pFunction, void *backend_ctx) DECLSPEC_HIDDEN; +unsigned int shader_find_free_input_register(const struct wined3d_shader_reg_maps *reg_maps, + unsigned int max) DECLSPEC_HIDDEN; +void shader_generate_main(struct wined3d_shader *shader, struct wined3d_shader_buffer *buffer, + const struct wined3d_shader_reg_maps *reg_maps, const DWORD *pFunction, void *backend_ctx) DECLSPEC_HIDDEN; BOOL shader_match_semantic(const char *semantic_name, WINED3DDECLUSAGE usage) DECLSPEC_HIDDEN; static inline BOOL shader_is_pshader_version(enum wined3d_shader_type type) @@ -2828,53 +2710,36 @@ static inline BOOL shader_is_scalar(const struct wined3d_shader_register *reg) } } -static inline BOOL shader_constant_is_local(IWineD3DBaseShaderImpl* This, DWORD reg) { - local_constant* lconst; +static inline void shader_get_position_fixup(const struct wined3d_context *context, + const struct wined3d_state *state, float *position_fixup) +{ + position_fixup[0] = 1.0f; + position_fixup[1] = 1.0f; + position_fixup[2] = (63.0f / 64.0f) / state->viewport.Width; + position_fixup[3] = -(63.0f / 64.0f) / state->viewport.Height; - if(This->baseShader.load_local_constsF) return FALSE; - LIST_FOR_EACH_ENTRY(lconst, &This->baseShader.constantsF, local_constant, entry) { - if(lconst->idx == reg) return TRUE; + if (context->render_offscreen) + { + position_fixup[1] *= -1.0f; + position_fixup[3] *= -1.0f; } - return FALSE; - } -/***************************************************************************** - * IDirect3DVertexShader implementation structures - */ -typedef struct IWineD3DVertexShaderImpl { - /* IUnknown parts */ - const IWineD3DVertexShaderVtbl *lpVtbl; - - /* IWineD3DBaseShader */ - IWineD3DBaseShaderClass baseShader; - - /* Vertex shader attributes. */ - struct wined3d_shader_attribute attributes[MAX_ATTRIBS]; - - UINT min_rel_offset, max_rel_offset; - UINT rel_offset; -} IWineD3DVertexShaderImpl; - -void find_vs_compile_args(const struct wined3d_state *state, - IWineD3DVertexShaderImpl *shader, struct vs_compile_args *args) DECLSPEC_HIDDEN; -HRESULT vertexshader_init(IWineD3DVertexShaderImpl *shader, IWineD3DDeviceImpl *device, - const DWORD *byte_code, const struct wined3d_shader_signature *output_signature, - void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN; - -struct wined3d_geometryshader +static inline BOOL shader_constant_is_local(const struct wined3d_shader *shader, DWORD reg) { - const struct IWineD3DGeometryShaderVtbl *vtbl; - IWineD3DBaseShaderClass base_shader; -}; + struct local_constant *lconst; -HRESULT geometryshader_init(struct wined3d_geometryshader *shader, IWineD3DDeviceImpl *device, - const DWORD *byte_code, const struct wined3d_shader_signature *output_signature, - void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN; + if (shader->load_local_constsF) + return FALSE; -/***************************************************************************** - * IDirect3DPixelShader implementation structure - */ + LIST_FOR_EACH_ENTRY(lconst, &shader->constantsF, local_constant, entry) + { + if (lconst->idx == reg) + return TRUE; + } + + return FALSE; +} /* Using additional shader constants (uniforms in GLSL / program environment * or local parameters in ARB) is costly: @@ -2893,34 +2758,6 @@ struct ps_np2fixup_info { WORD num_consts; }; -typedef struct IWineD3DPixelShaderImpl { - /* IUnknown parts */ - const IWineD3DPixelShaderVtbl *lpVtbl; - - /* IWineD3DBaseShader */ - IWineD3DBaseShaderClass baseShader; - - /* Pixel shader input semantics */ - DWORD input_reg_map[MAX_REG_INPUT]; - BOOL input_reg_used[MAX_REG_INPUT]; - unsigned int declared_in_count; - - /* Some information about the shader behavior */ - char vpos_uniform; - - BOOL color0_mov; - DWORD color0_reg; - -} IWineD3DPixelShaderImpl; - -HRESULT pixelshader_init(IWineD3DPixelShaderImpl *shader, IWineD3DDeviceImpl *device, - const DWORD *byte_code, const struct wined3d_shader_signature *output_signature, - void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN; -void pixelshader_update_samplers(struct shader_reg_maps *reg_maps, - IWineD3DBaseTexture * const *textures) DECLSPEC_HIDDEN; -void find_ps_compile_args(const struct wined3d_state *state, - IWineD3DPixelShaderImpl *shader, struct ps_compile_args *args) DECLSPEC_HIDDEN; - /* sRGB correction constants */ static const float srgb_cmp = 0.0031308f; static const float srgb_mul_low = 12.92f; @@ -2928,30 +2765,21 @@ static const float srgb_pow = 0.41666f; static const float srgb_mul_high = 1.055f; static const float srgb_sub_high = 0.055f; -/***************************************************************************** - * IWineD3DPalette implementation structure - */ -struct IWineD3DPaletteImpl { - /* IUnknown parts */ - const IWineD3DPaletteVtbl *lpVtbl; - LONG ref; - +struct wined3d_palette +{ + LONG ref; void *parent; - IWineD3DDeviceImpl *device; + struct wined3d_device *device; - /* IWineD3DPalette */ HPALETTE hpal; WORD palVersion; /*| */ WORD palNumEntries; /*| LOGPALETTE */ PALETTEENTRY palents[256]; /*| */ /* This is to store the palette in 'screen format' */ int screen_palents[256]; - DWORD Flags; + DWORD flags; }; -HRESULT wined3d_palette_init(IWineD3DPaletteImpl *palette, IWineD3DDeviceImpl *device, - DWORD flags, const PALETTEENTRY *entries, void *parent) DECLSPEC_HIDDEN; - /* DirectDraw utility functions */ extern enum wined3d_format_id pixelformat_for_depth(DWORD depth) DECLSPEC_HIDDEN; @@ -2987,8 +2815,8 @@ struct wined3d_format DWORD blue_mask; DWORD alpha_mask; UINT byte_count; - WORD depth_size; - WORD stencil_size; + BYTE depth_size; + BYTE stencil_size; UINT block_width; UINT block_height; @@ -3007,7 +2835,7 @@ struct wined3d_format GLint glFormat; GLint glType; UINT conv_byte_count; - unsigned int Flags; + unsigned int flags; float heightscale; struct color_fixup_desc color_fixup; void (*convert)(const BYTE *src, BYTE *dst, UINT pitch, UINT width, UINT height); @@ -3037,10 +2865,6 @@ static inline BOOL use_ps(const struct wined3d_state *state) /* The WNDCLASS-Name for the fake window which we use to retrieve the GL capabilities */ #define WINED3D_OPENGL_WINDOW_CLASS_NAME "WineD3D_OpenGL" -#define WINEMAKEFOURCC(ch0, ch1, ch2, ch3) \ - ((DWORD)(BYTE)(ch0) | ((DWORD)(BYTE)(ch1) << 8) | \ - ((DWORD)(BYTE)(ch2) << 16) | ((DWORD)(BYTE)(ch3) << 24 )) - #define MAKEDWORD_VERSION(maj, min) (((maj & 0xffff) << 16) | (min & 0xffff)) #endif diff --git a/dll/dll.rbuild b/dll/dll.rbuild index c602a970785..99bf1e93179 100644 --- a/dll/dll.rbuild +++ b/dll/dll.rbuild @@ -13,9 +13,6 @@ - - - diff --git a/dll/keyboard/kbdit/kbdit.c b/dll/keyboard/kbdit/kbdit.c index 4746f933660..99ebdaf43c2 100644 --- a/dll/keyboard/kbdit/kbdit.c +++ b/dll/keyboard/kbdit/kbdit.c @@ -86,7 +86,7 @@ ROSDATA USHORT scancode_to_vk[] = { /* 32 */ 'M', /* 33 */ VK_OEM_COMMA, /* 34 */ VK_OEM_PERIOD, -/* 35 */ VK_DIVIDE, +/* 35 */ VK_OEM_MINUS, /* 36 */ VK_RSHIFT, /* 37 */ VK_MULTIPLY, /* 38 */ VK_LMENU, diff --git a/dll/nls/CMakeLists.txt b/dll/nls/CMakeLists.txt index fbc21b3dd20..d6448d3ad32 100644 --- a/dll/nls/CMakeLists.txt +++ b/dll/nls/CMakeLists.txt @@ -1,3 +1,5 @@ -add_subdirectory(idndl) -add_subdirectory(normaliz) +if(NOT MSVC) + add_subdirectory(idndl) # FIXME: msvc build. +endif() +#add_subdirectory(normaliz) # Win Vista diff --git a/dll/nls/nls.rbuild b/dll/nls/nls.rbuild index 060c5e9585f..f5fdfe32190 100644 --- a/dll/nls/nls.rbuild +++ b/dll/nls/nls.rbuild @@ -7,9 +7,9 @@ - + diff --git a/dll/nls/normaliz/normaliz.def b/dll/nls/normaliz/normaliz.def deleted file mode 100644 index 71db24a9de3..00000000000 --- a/dll/nls/normaliz/normaliz.def +++ /dev/null @@ -1,37 +0,0 @@ -; Copyright (c) 2008, KJK::Hyperion -; All rights reserved. -; -; Redistribution and use in source and binary forms, with or without -; modification, are permitted provided that the following conditions are met: -; -; - Redistributions of source code must retain the above copyright notice, -; this list of conditions and the following disclaimer. -; -; - Redistributions in binary form must reproduce the above copyright notice, -; this list of conditions and the following disclaimer in the documentation -; and/or other materials provided with the distribution. -; -; - Neither the name of the ReactOS Foundation nor the names of its -; contributors may be used to endorse or promote products derived from this -; software without specific prior written permission. -; -; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -; ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -; LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -; CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -; ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -; POSSIBILITY OF SUCH DAMAGE. - -LIBRARY "normaliz.dll" - -EXPORTS - IdnToAscii@20 = kernel32.IdnToAscii @1 - IdnToNameprepUnicode@20 = kernel32.IdnToNameprepUnicode @2 - IdnToUnicode@20 = kernel32.IdnToUnicode @3 - IsNormalizedString@12 = kernel32.IsNormalizedString @4 - NormalizeString@20 = kernel32.NormalizeString @5 diff --git a/dll/nls/normaliz/normaliz.rbuild b/dll/nls/normaliz/normaliz.rbuild index f880fe7b927..7a73f0d93bf 100644 --- a/dll/nls/normaliz/normaliz.rbuild +++ b/dll/nls/normaliz/normaliz.rbuild @@ -1,6 +1,6 @@ - + dummy.c diff --git a/dll/ntdll/CMakeLists.txt b/dll/ntdll/CMakeLists.txt index 31090630436..9fd4bab21ea 100644 --- a/dll/ntdll/CMakeLists.txt +++ b/dll/ntdll/CMakeLists.txt @@ -15,13 +15,10 @@ list(APPEND SOURCE csr/capture.c csr/connect.c dbg/dbgui.c - ldr/actctx.c ldr/ldrapi.c ldr/ldrinit.c ldr/ldrpe.c ldr/ldrutils.c - ldr/startup.c - ldr/utils.c rtl/libsupp.c rtl/version.c def/ntdll.rc @@ -37,14 +34,13 @@ else() list(APPEND SOURCE dispatch/dispatch.c) endif(ARCH MATCHES i386) -add_library(ntdll SHARED - ${CMAKE_CURRENT_BINARY_DIR}/ntdll_ntdll.h.gch - ${SOURCE}) +add_library(ntdll SHARED ${SOURCE}) set_entrypoint(ntdll 0) if(MSVC) target_link_libraries(ntdll rtl) +add_linkerflag(ntdll /RELEASE) else() target_link_libraries(ntdll -Wl,--whole-archive rtl -Wl,--no-whole-archive) endif() @@ -55,7 +51,7 @@ target_link_libraries(ntdll ${PSEH_LIB}) set_image_base(ntdll ${baseaddress_ntdll}) -add_pch(ntdll ${CMAKE_CURRENT_SOURCE_DIR}/include/ntdll.h ${SOURCE}) +add_pch(ntdll include/ntdll.h) add_dependencies(ntdll ntstatus asm) add_cd_file(TARGET ntdll DESTINATION reactos/system32 NO_CAB FOR all) diff --git a/dll/ntdll/def/ntdll.pspec b/dll/ntdll/def/ntdll.pspec index e87b71c6bf1..d180138665d 100644 --- a/dll/ntdll/def/ntdll.pspec +++ b/dll/ntdll/def/ntdll.pspec @@ -413,12 +413,13 @@ //@ stdcall RtlAbortRXact @ stdcall RtlAbsoluteToSelfRelativeSD(ptr ptr ptr) @ stdcall RtlAcquirePebLock() +@ stdcall RtlAcquirePrivilege(ptr long long ptr) @ stdcall RtlAcquireResourceExclusive(ptr long) @ stdcall RtlAcquireResourceShared(ptr long) @ stdcall RtlAcquireSRWLockExclusive(ptr) @ stdcall RtlAcquireSRWLockShared(ptr) @ stdcall RtlActivateActivationContext(long ptr ptr) -//@ stdcall RtlActivateActivationContextEx +@ stdcall RtlActivateActivationContextEx(long ptr ptr ptr) @ fastcall RtlActivateActivationContextUnsafeFast(ptr ptr) @ stdcall RtlAddAccessAllowedAce(ptr long long ptr) @ stdcall RtlAddAccessAllowedAceEx(ptr long long long ptr) @@ -691,7 +692,7 @@ @ stdcall RtlIdentifierAuthoritySid(ptr) @ stdcall RtlImageDirectoryEntryToData(long long long ptr) @ stdcall RtlImageNtHeader(long) -//@ stdcall RtlImageNtHeaderEx +@ stdcall RtlImageNtHeaderEx(long ptr double ptr) @ stdcall RtlImageRvaToSection(ptr long long) @ stdcall RtlImageRvaToVa(ptr long long ptr) @ stdcall RtlImpersonateSelf(long) @@ -725,6 +726,7 @@ @ stdcall RtlInt64ToUnicodeString(double long ptr) @ stdcall RtlIntegerToChar(long long long ptr) @ stdcall RtlIntegerToUnicodeString(long long ptr) +@ stdcall -arch=win32 -ret64 RtlInterlockedCompareExchange64(ptr double double) @ stdcall -arch=i386,x86_64 RtlInterlockedFlushSList(ptr) @ stdcall -arch=i386,x86_64 RtlInterlockedPopEntrySList(ptr) @ stdcall -arch=i386,x86_64 RtlInterlockedPushEntrySList(ptr ptr) @@ -847,6 +849,7 @@ @ stdcall RtlReleaseActivationContext(ptr) //@ stdcall RtlReleaseMemoryStream @ stdcall RtlReleasePebLock() +@ stdcall RtlReleasePrivilege(ptr) @ stdcall RtlReleaseResource(ptr) @ stdcall RtlReleaseSRWLockExclusive(ptr) @ stdcall RtlReleaseSRWLockShared(ptr) diff --git a/dll/ntdll/def/ntdll.spec b/dll/ntdll/def/ntdll.spec index b1805ae7f3d..891306e5ad3 100644 --- a/dll/ntdll/def/ntdll.spec +++ b/dll/ntdll/def/ntdll.spec @@ -411,6 +411,7 @@ ;@ stdcall RtlAbortRXact @ stdcall RtlAbsoluteToSelfRelativeSD(ptr ptr ptr) @ stdcall RtlAcquirePebLock() +@ stdcall RtlAcquirePrivilege(ptr long long ptr) @ stdcall RtlAcquireResourceExclusive(ptr long) @ stdcall RtlAcquireResourceShared(ptr long) @ stdcall RtlAcquireSRWLockExclusive(ptr) @@ -723,7 +724,7 @@ @ stdcall RtlInt64ToUnicodeString(double long ptr) @ stdcall RtlIntegerToChar(long long long ptr) @ stdcall RtlIntegerToUnicodeString(long long ptr) -;@ stdcall RtlInterlockedCompareExchange64 +@ stdcall -arch=win32 -ret64 RtlInterlockedCompareExchange64(ptr double double) @ stdcall -arch=i386,x86_64 RtlInterlockedFlushSList(ptr) @ stdcall -arch=i386,x86_64 RtlInterlockedPopEntrySList(ptr) @ stdcall -arch=i386,x86_64 RtlInterlockedPushEntrySList(ptr ptr) @@ -846,6 +847,7 @@ @ stdcall RtlReleaseActivationContext(ptr) ;@ stdcall RtlReleaseMemoryStream @ stdcall RtlReleasePebLock() +@ stdcall RtlReleasePrivilege(ptr) @ stdcall RtlReleaseResource(ptr) @ stdcall RtlReleaseSRWLockExclusive(ptr) @ stdcall RtlReleaseSRWLockShared(ptr) diff --git a/dll/ntdll/dispatch/amd64/stubs.c b/dll/ntdll/dispatch/amd64/stubs.c index fe7b4a78656..f8c836496f1 100644 --- a/dll/ntdll/dispatch/amd64/stubs.c +++ b/dll/ntdll/dispatch/amd64/stubs.c @@ -41,3 +41,27 @@ KiUserApcDispatcher(IN PVOID NormalRoutine, UNIMPLEMENTED; return; } + +VOID +NTAPI +KiRaiseUserExceptionDispatcher() +{ + UNIMPLEMENTED; + return; +} + +VOID +NTAPI +KiUserCallbackDispatcher() +{ + UNIMPLEMENTED; + return; +} + +VOID +NTAPI +KiUserExceptionDispatcher() +{ + UNIMPLEMENTED; + return; +} diff --git a/dll/ntdll/dispatch/i386/dispatch.S b/dll/ntdll/dispatch/i386/dispatch.S index 25f7c34bcee..10706e21827 100644 --- a/dll/ntdll/dispatch/i386/dispatch.S +++ b/dll/ntdll/dispatch/i386/dispatch.S @@ -184,7 +184,8 @@ _KiRaiseUserExceptionDispatcher@0: PUBLIC _KiUserExceptionDispatcher@8 -_KiUserExceptionDispatcher@8: +.PROC KiUserExceptionDispatcher@8 + FPO 0, 0, 0, 0, 0, FRAME_FPO /* Clear direction flag */ cld @@ -240,9 +241,11 @@ Exit: call _RtlRaiseException@4 ret 8 +.ENDP KiUserExceptionDispatcher@8 PUBLIC _KiIntSystemCall@0 -_KiIntSystemCall@0: +.PROC KiIntSystemCall@0 + FPO 0, 0, 0, 0, 0, FRAME_FPO /* Set stack in EDX and do the interrupt */ lea edx, [esp+8] @@ -251,21 +254,26 @@ _KiIntSystemCall@0: /* Return to caller */ ret +.ENDP KiIntSystemCall@0 PUBLIC _KiFastSystemCall@0 -_KiFastSystemCall@0: +.PROC KiFastSystemCall@0 + FPO 0, 0, 0, 0, 0, FRAME_FPO /* Put ESP in EDX and do the SYSENTER */ mov edx, esp sysenter +.ENDP KiFastSystemCall@0 PUBLIC _KiFastSystemCallRet@0 -_KiFastSystemCallRet@0: +.PROC KiFastSystemCallRet@0 + FPO 0, 0, 0, 0, 0, FRAME_FPO /* Just return to caller */ ret +.ENDP KiFastSystemCallRet@0 PUBLIC _RtlpGetStackLimits@8 _RtlpGetStackLimits@8: diff --git a/dll/ntdll/include/ntdll.h b/dll/ntdll/include/ntdll.h index 6c05a3e9d35..edbce5ae68d 100644 --- a/dll/ntdll/include/ntdll.h +++ b/dll/ntdll/include/ntdll.h @@ -24,7 +24,19 @@ #define WIN32_NO_STATUS #include #define NTOS_MODE_USER -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include /* Internal NTDLL */ #include "ntdllp.h" diff --git a/dll/ntdll/include/ntdllp.h b/dll/ntdll/include/ntdllp.h index a01a960cef2..e343e8fd304 100644 --- a/dll/ntdll/include/ntdllp.h +++ b/dll/ntdll/include/ntdllp.h @@ -9,6 +9,16 @@ /* INCLUDES ******************************************************************/ #define LDR_HASH_TABLE_ENTRIES 32 +#define LDR_GET_HASH_ENTRY(x) (RtlUpcaseUnicodeChar((x)) & (LDR_HASH_TABLE_ENTRIES - 1)) + +/* LdrpUpdateLoadCount2 flags */ +#define LDRP_UPDATE_REFCOUNT 0x01 +#define LDRP_UPDATE_DEREFCOUNT 0x02 +#define LDRP_UPDATE_PIN 0x03 + +/* Loader flags */ +#define IMAGE_LOADER_FLAGS_COMPLUS 0x00000001 +#define IMAGE_LOADER_FLAGS_SYSTEM_GLOBAL 0x01000000 typedef struct _LDRP_TLS_DATA { @@ -16,29 +26,35 @@ typedef struct _LDRP_TLS_DATA IMAGE_TLS_DIRECTORY TlsDirectory; } LDRP_TLS_DATA, *PLDRP_TLS_DATA; -typedef BOOL -(NTAPI *PDLLMAIN_FUNC)(HANDLE hInst, - ULONG ul_reason_for_call, - LPVOID lpReserved); - /* Global data */ extern RTL_CRITICAL_SECTION LdrpLoaderLock; extern BOOLEAN LdrpInLdrInit; extern LIST_ENTRY LdrpHashTable[LDR_HASH_TABLE_ENTRIES]; extern BOOLEAN ShowSnaps; extern UNICODE_STRING LdrpDefaultPath; +extern HANDLE LdrpKnownDllObjectDirectory; +extern ULONG LdrpNumberOfProcessors; +extern ULONG LdrpFatalHardErrorCount; +extern PUNICODE_STRING LdrpTopLevelDllBeingLoaded; +extern PLDR_DATA_TABLE_ENTRY LdrpCurrentDllInitializer; +extern UNICODE_STRING LdrApiDefaultExtension; +extern BOOLEAN LdrpLdrDatabaseIsSetup; +extern ULONG LdrpActiveUnloadCount; +extern BOOLEAN LdrpShutdownInProgress; +extern UNICODE_STRING LdrpKnownDllPath; +extern PLDR_DATA_TABLE_ENTRY LdrpGetModuleHandleCache, LdrpLoadedDllHandleCache; /* ldrinit.c */ NTSTATUS NTAPI LdrpRunInitializeRoutines(IN PCONTEXT Context OPTIONAL); -NTSTATUS NTAPI LdrpInitializeThread(IN PCONTEXT Context); +VOID NTAPI LdrpInitializeThread(IN PCONTEXT Context); NTSTATUS NTAPI LdrpInitializeTls(VOID); NTSTATUS NTAPI LdrpAllocateTls(VOID); VOID NTAPI LdrpFreeTls(VOID); -VOID NTAPI LdrpTlsCallback(PVOID BaseAddress, ULONG Reason); -BOOLEAN NTAPI LdrpCallDllEntry(PDLLMAIN_FUNC EntryPoint, PVOID BaseAddress, ULONG Reason, PVOID Context); +VOID NTAPI LdrpCallTlsInitializers(PVOID BaseAddress, ULONG Reason); +BOOLEAN NTAPI LdrpCallInitRoutine(PDLL_INIT_ROUTINE EntryPoint, PVOID BaseAddress, ULONG Reason, PVOID Context); NTSTATUS NTAPI LdrpInitializeProcess(PCONTEXT Context, PVOID SystemArgument1); VOID NTAPI LdrpInitFailure(NTSTATUS Status); - +VOID NTAPI LdrpValidateImageForMp(IN PLDR_DATA_TABLE_ENTRY LdrDataTableEntry); /* ldrpe.c */ NTSTATUS @@ -79,9 +95,23 @@ LdrpLoadDll(IN BOOLEAN Redirected, OUT PVOID *BaseAddress, IN BOOLEAN CallInit); +VOID NTAPI +LdrpUpdateLoadCount2(IN PLDR_DATA_TABLE_ENTRY LdrEntry, + IN ULONG Flags); + ULONG NTAPI LdrpClearLoadInProgress(); +NTSTATUS +NTAPI +LdrpSetProtection(PVOID ViewBase, + BOOLEAN Restore); + +BOOLEAN +NTAPI +LdrpCheckForLoadedDllHandle(IN PVOID Base, + OUT PLDR_DATA_TABLE_ENTRY *LdrEntry); + BOOLEAN NTAPI LdrpCheckForLoadedDll(IN PWSTR DllPath, IN PUNICODE_STRING DllName, @@ -101,6 +131,9 @@ LdrpMapDll(IN PWSTR SearchPath OPTIONAL, PVOID NTAPI LdrpFetchAddressOfEntryPoint(PVOID ImageBase); +VOID NTAPI +LdrpFreeUnicodeString(PUNICODE_STRING String); + /* FIXME: Cleanup this mess */ typedef NTSTATUS (NTAPI *PEPFUNC)(PPEB); @@ -110,14 +143,21 @@ NTSTATUS LdrMapSections(HANDLE ProcessHandle, PIMAGE_NT_HEADERS NTHeaders); NTSTATUS LdrMapNTDllForProcess(HANDLE ProcessHandle, PHANDLE NTDllSectionHandle); -BOOLEAN LdrMappedAsDataFile(PVOID *BaseAddress); ULONG LdrpGetResidentSize(PIMAGE_NT_HEADERS NTHeaders); -PEPFUNC LdrPEStartup (PVOID ImageBase, - HANDLE SectionHandle, - PLDR_DATA_TABLE_ENTRY* Module, - PWSTR FullDosName); +NTSTATUS +NTAPI +LdrpLoadImportModule(IN PWSTR DllPath OPTIONAL, + IN LPSTR ImportName, + IN PVOID DllBase, + OUT PLDR_DATA_TABLE_ENTRY *DataTableEntry, + OUT PBOOLEAN Existing); + +VOID +NTAPI +LdrpFinalizeAndDeallocateDataTableEntry(IN PLDR_DATA_TABLE_ENTRY Entry); + extern HANDLE WindowsApiPort; /* EOF */ diff --git a/dll/ntdll/ldr/actctx.c b/dll/ntdll/ldr/actctx.c deleted file mode 100644 index c859e6bc7ce..00000000000 --- a/dll/ntdll/ldr/actctx.c +++ /dev/null @@ -1,91 +0,0 @@ - -#include -#define NDEBUG -#include - -#include "wine/unicode.h" - - -/*********************************************************************** - * create_module_activation_context - */ -NTSTATUS create_module_activation_context( LDR_DATA_TABLE_ENTRY *module ) -{ - NTSTATUS status; - LDR_RESOURCE_INFO info; - IMAGE_RESOURCE_DATA_ENTRY *entry; - - info.Type = (ULONG)RT_MANIFEST; - info.Name = (ULONG)ISOLATIONAWARE_MANIFEST_RESOURCE_ID; - info.Language = 0; - if (!(status = LdrFindResource_U( module->DllBase, &info, 3, &entry ))) - { - ACTCTXW ctx; - ctx.cbSize = sizeof(ctx); - ctx.lpSource = NULL; - ctx.dwFlags = ACTCTX_FLAG_RESOURCE_NAME_VALID | ACTCTX_FLAG_HMODULE_VALID; - ctx.hModule = module->DllBase; - ctx.lpResourceName = (LPCWSTR)ISOLATIONAWARE_MANIFEST_RESOURCE_ID; - status = RtlCreateActivationContext( &module->EntryPointActivationContext, &ctx ); - } - return status; -} - -NTSTATUS find_actctx_dll( LPCWSTR libname, WCHAR *fullname ) -{ - static const WCHAR winsxsW[] = {'\\','w','i','n','s','x','s','\\',0}; - /* FIXME: Handle modules that have a private manifest file - static const WCHAR dotManifestW[] = {'.','m','a','n','i','f','e','s','t',0}; */ - - ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION *info; - ACTCTX_SECTION_KEYED_DATA data; - UNICODE_STRING nameW; - NTSTATUS status; - SIZE_T needed, size = 1024; - - RtlInitUnicodeString( &nameW, libname ); - data.cbSize = sizeof(data); - status = RtlFindActivationContextSectionString( FIND_ACTCTX_SECTION_KEY_RETURN_HACTCTX, NULL, - ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION, - &nameW, &data ); - if (status != STATUS_SUCCESS) return status; - - for (;;) - { - if (!(info = RtlAllocateHeap( RtlGetProcessHeap(), 0, size ))) - { - status = STATUS_NO_MEMORY; - goto done; - } - status = RtlQueryInformationActivationContext( 0, data.hActCtx, &data.ulAssemblyRosterIndex, - AssemblyDetailedInformationInActivationContext, - info, size, &needed ); - if (status == STATUS_SUCCESS) break; - if (status != STATUS_BUFFER_TOO_SMALL) goto done; - RtlFreeHeap( RtlGetProcessHeap(), 0, info ); - size = needed; - } - - DPRINT("manafestpath === %S\n", info->lpAssemblyManifestPath); - DPRINT("DirectoryName === %S\n", info->lpAssemblyDirectoryName); - if (!info->lpAssemblyManifestPath || !info->lpAssemblyDirectoryName) - { - status = STATUS_SXS_KEY_NOT_FOUND; - goto done; - } - - DPRINT("%S. %S\n", info->lpAssemblyManifestPath, info->lpAssemblyDirectoryName); - wcscpy(fullname , SharedUserData->NtSystemRoot); - wcscat(fullname, winsxsW); - wcscat(fullname, info->lpAssemblyDirectoryName); - wcscat(fullname, L"\\"); - wcscat(fullname, libname); - DPRINT("Successfully found a side by side %S\n", fullname); - status = STATUS_SUCCESS; - -done: - RtlFreeHeap( RtlGetProcessHeap(), 0, info ); - RtlReleaseActivationContext( data.hActCtx ); - DPRINT("%S\n", fullname); - return status; -} diff --git a/dll/ntdll/ldr/elf.c b/dll/ntdll/ldr/elf.c deleted file mode 100644 index ecc82ce0c5d..00000000000 --- a/dll/ntdll/ldr/elf.c +++ /dev/null @@ -1,2824 +0,0 @@ -/* - * REACTOS ELF LOADER - * - * ELF run-time linker, ported from FreeBSD by KJK::Hyperion as part of the ELF - * support initiative. Original copyright, licensing and disclaimers follow - */ - -/*- - * Copyright 1996, 1997, 1998, 1999, 2000 John D. Polstra. - * Copyright 2003 Alexander Kabaev . - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD: src/libexec/rtld-elf/rtld.c,v 1.101 2004/11/02 09:42:21 ssouhlal Exp $ - */ - - -/* - * Dynamic linker for ELF. - * - * John Polstra . - */ - -#include -#define NDEBUG -#include - -#if 0 - -#ifndef __GNUC__ -#error "GCC is needed to compile this file" -#endif - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "debug.h" -#include "rtld.h" -#include "libmap.h" -#include "rtld_tls.h" - -#ifndef COMPAT_32BIT -#define PATH_RTLD "/libexec/ld-elf.so.1" -#else -#define PATH_RTLD "/libexec/ld-elf32.so.1" -#endif - -/* Types. */ -typedef void (*func_ptr_type)(); -typedef void * (*path_enum_proc) (const char *path, size_t len, void *arg); - -/* - * This structure provides a reentrant way to keep a list of objects and - * check which ones have already been processed in some way. - */ -typedef struct Struct_DoneList { - const Obj_Entry **objs; /* Array of object pointers */ - unsigned int num_alloc; /* Allocated size of the array */ - unsigned int num_used; /* Number of array slots used */ -} DoneList; - -/* - * Function declarations. - */ -static const char *basename(const char *); -static void die(void); -static void digest_dynamic(Obj_Entry *, int); -static Obj_Entry *digest_phdr(const Elf_Phdr *, int, caddr_t, const char *); -static Obj_Entry *dlcheck(void *); -static int do_search_info(const Obj_Entry *obj, int, struct dl_serinfo *); -static bool donelist_check(DoneList *, const Obj_Entry *); -static void errmsg_restore(char *); -static char *errmsg_save(void); -static void *fill_search_info(const char *, size_t, void *); -static char *find_library(const char *, const Obj_Entry *); -static const char *gethints(void); -static void init_dag(Obj_Entry *); -static void init_dag1(Obj_Entry *root, Obj_Entry *obj, DoneList *); -static void init_rtld(caddr_t); -static void initlist_add_neededs(Needed_Entry *needed, Objlist *list); -static void initlist_add_objects(Obj_Entry *obj, Obj_Entry **tail, - Objlist *list); -static bool is_exported(const Elf_Sym *); -static void linkmap_add(Obj_Entry *); -static void linkmap_delete(Obj_Entry *); -static int load_needed_objects(Obj_Entry *); -static int load_preload_objects(void); -static Obj_Entry *load_object(char *); -static Obj_Entry *obj_from_addr(const void *); -static void objlist_call_fini(Objlist *); -static void objlist_call_init(Objlist *); -static void objlist_clear(Objlist *); -static Objlist_Entry *objlist_find(Objlist *, const Obj_Entry *); -static void objlist_init(Objlist *); -static void objlist_push_head(Objlist *, Obj_Entry *); -static void objlist_push_tail(Objlist *, Obj_Entry *); -static void objlist_remove(Objlist *, Obj_Entry *); -static void objlist_remove_unref(Objlist *); -static void *path_enumerate(const char *, path_enum_proc, void *); -static int relocate_objects(Obj_Entry *, bool, Obj_Entry *); -static int rtld_dirname(const char *, char *); -static void rtld_exit(void); -static char *search_library_path(const char *, const char *); -static const void **get_program_var_addr(const char *name); -static void set_program_var(const char *, const void *); -static const Elf_Sym *symlook_default(const char *, unsigned long hash, - const Obj_Entry *refobj, const Obj_Entry **defobj_out, bool in_plt); -static const Elf_Sym *symlook_list(const char *, unsigned long, - Objlist *, const Obj_Entry **, bool in_plt, DoneList *); -static void trace_loaded_objects(Obj_Entry *obj); -static void unlink_object(Obj_Entry *); -static void unload_object(Obj_Entry *); -static void unref_dag(Obj_Entry *); -static void ref_dag(Obj_Entry *); - -void r_debug_state(struct r_debug*, struct link_map*); - -/* - * Data declarations. - */ -static char *error_message; /* Message for dlerror(), or NULL */ -struct r_debug r_debug; /* for GDB; */ -static bool libmap_disable; /* Disable libmap */ -static bool trust; /* False for setuid and setgid programs */ -static char *ld_bind_now; /* Environment variable for immediate binding */ -static char *ld_debug; /* Environment variable for debugging */ -static char *ld_library_path; /* Environment variable for search path */ -static char *ld_preload; /* Environment variable for libraries to - load first */ -static char *ld_tracing; /* Called from ldd to print libs */ -static Obj_Entry *obj_list; /* Head of linked list of shared objects */ -static Obj_Entry **obj_tail; /* Link field of last object in list */ -static Obj_Entry *obj_main; /* The main program shared object */ -static Obj_Entry obj_rtld; /* The dynamic linker shared object */ -static unsigned int obj_count; /* Number of objects in obj_list */ - -static Objlist list_global = /* Objects dlopened with RTLD_GLOBAL */ - STAILQ_HEAD_INITIALIZER(list_global); -static Objlist list_main = /* Objects loaded at program startup */ - STAILQ_HEAD_INITIALIZER(list_main); -static Objlist list_fini = /* Objects needing fini() calls */ - STAILQ_HEAD_INITIALIZER(list_fini); - -static Elf_Sym sym_zero; /* For resolving undefined weak refs. */ - -#define GDB_STATE(s,m) r_debug.r_state = s; r_debug_state(&r_debug,m); - -extern Elf_Dyn _DYNAMIC; -#pragma weak _DYNAMIC -#ifndef RTLD_IS_DYNAMIC -#define RTLD_IS_DYNAMIC() (&_DYNAMIC != NULL) -#endif - -/* - * These are the functions the dynamic linker exports to application - * programs. They are the only symbols the dynamic linker is willing - * to export from itself. - */ -static func_ptr_type exports[] = { - (func_ptr_type) &_rtld_error, - (func_ptr_type) &dlclose, - (func_ptr_type) &dlerror, - (func_ptr_type) &dlopen, - (func_ptr_type) &dlsym, - (func_ptr_type) &dladdr, - (func_ptr_type) &dllockinit, - (func_ptr_type) &dlinfo, - (func_ptr_type) &_rtld_thread_init, -#ifdef __i386__ - (func_ptr_type) &___tls_get_addr, -#endif - (func_ptr_type) &__tls_get_addr, - (func_ptr_type) &_rtld_allocate_tls, - (func_ptr_type) &_rtld_free_tls, - NULL -}; - -/* - * Global declarations normally provided by crt1. The dynamic linker is - * not built with crt1, so we have to provide them ourselves. - */ -char *__progname; -char **environ; - -/* - * Globals to control TLS allocation. - */ -size_t tls_last_offset; /* Static TLS offset of last module */ -size_t tls_last_size; /* Static TLS size of last module */ -size_t tls_static_space; /* Static TLS space allocated */ -int tls_dtv_generation = 1; /* Used to detect when dtv size changes */ -int tls_max_index = 1; /* Largest module index allocated */ - -/* - * Fill in a DoneList with an allocation large enough to hold all of - * the currently-loaded objects. Keep this as a macro since it calls - * alloca and we want that to occur within the scope of the caller. - */ -#define donelist_init(dlp) \ - ((dlp)->objs = alloca(obj_count * sizeof (dlp)->objs[0]), \ - assert((dlp)->objs != NULL), \ - (dlp)->num_alloc = obj_count, \ - (dlp)->num_used = 0) - -/* - * Main entry point for dynamic linking. The first argument is the - * stack pointer. The stack is expected to be laid out as described - * in the SVR4 ABI specification, Intel 386 Processor Supplement. - * Specifically, the stack pointer points to a word containing - * ARGC. Following that in the stack is a null-terminated sequence - * of pointers to argument strings. Then comes a null-terminated - * sequence of pointers to environment strings. Finally, there is a - * sequence of "auxiliary vector" entries. - * - * The second argument points to a place to store the dynamic linker's - * exit procedure pointer and the third to a place to store the main - * program's object. - * - * The return value is the main program's entry point. - */ -func_ptr_type -_rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp) -{ - Elf_Auxinfo *aux_info[AT_COUNT]; - int i; - int argc; - char **argv; - char **env; - Elf_Auxinfo *aux; - Elf_Auxinfo *auxp; - const char *argv0; - Objlist_Entry *entry; - Obj_Entry *obj; - Obj_Entry **preload_tail; - Objlist initlist; - int lockstate; - - /* - * On entry, the dynamic linker itself has not been relocated yet. - * Be very careful not to reference any global data until after - * init_rtld has returned. It is OK to reference file-scope statics - * and string constants, and to call static and global functions. - */ - - /* Find the auxiliary vector on the stack. */ - argc = *sp++; - argv = (char **) sp; - sp += argc + 1; /* Skip over arguments and NULL terminator */ - env = (char **) sp; - while (*sp++ != 0) /* Skip over environment, and NULL terminator */ - ; - aux = (Elf_Auxinfo *) sp; - - /* Digest the auxiliary vector. */ - for (i = 0; i < AT_COUNT; i++) - aux_info[i] = NULL; - for (auxp = aux; auxp->a_type != AT_NULL; auxp++) { - if (auxp->a_type < AT_COUNT) - aux_info[auxp->a_type] = auxp; - } - - /* Initialize and relocate ourselves. */ - assert(aux_info[AT_BASE] != NULL); - init_rtld((caddr_t) aux_info[AT_BASE]->a_un.a_ptr); - - __progname = obj_rtld.path; - argv0 = argv[0] != NULL ? argv[0] : "(null)"; - environ = env; - - trust = !issetugid(); - - ld_bind_now = getenv(LD_ "BIND_NOW"); - if (trust) { - ld_debug = getenv(LD_ "DEBUG"); - libmap_disable = getenv(LD_ "LIBMAP_DISABLE") != NULL; - ld_library_path = getenv(LD_ "LIBRARY_PATH"); - ld_preload = getenv(LD_ "PRELOAD"); - } - ld_tracing = getenv(LD_ "TRACE_LOADED_OBJECTS"); - - if (ld_debug != NULL && *ld_debug != '\0') - debug = 1; - dbg("%s is initialized, base address = %p", __progname, - (caddr_t) aux_info[AT_BASE]->a_un.a_ptr); - dbg("RTLD dynamic = %p", obj_rtld.dynamic); - dbg("RTLD pltgot = %p", obj_rtld.pltgot); - - /* - * Load the main program, or process its program header if it is - * already loaded. - */ - if (aux_info[AT_EXECFD] != NULL) { /* Load the main program. */ - int fd = aux_info[AT_EXECFD]->a_un.a_val; - dbg("loading main program"); - obj_main = map_object(fd, argv0, NULL); - close(fd); - if (obj_main == NULL) - die(); - } else { /* Main program already loaded. */ - const Elf_Phdr *phdr; - int phnum; - caddr_t entry; - - dbg("processing main program's program header"); - assert(aux_info[AT_PHDR] != NULL); - phdr = (const Elf_Phdr *) aux_info[AT_PHDR]->a_un.a_ptr; - assert(aux_info[AT_PHNUM] != NULL); - phnum = aux_info[AT_PHNUM]->a_un.a_val; - assert(aux_info[AT_PHENT] != NULL); - assert(aux_info[AT_PHENT]->a_un.a_val == sizeof(Elf_Phdr)); - assert(aux_info[AT_ENTRY] != NULL); - entry = (caddr_t) aux_info[AT_ENTRY]->a_un.a_ptr; - if ((obj_main = digest_phdr(phdr, phnum, entry, argv0)) == NULL) - die(); - } - - obj_main->path = xstrdup(argv0); - obj_main->mainprog = true; - - /* - * Get the actual dynamic linker pathname from the executable if - * possible. (It should always be possible.) That ensures that - * gdb will find the right dynamic linker even if a non-standard - * one is being used. - */ - if (obj_main->interp != NULL && - strcmp(obj_main->interp, obj_rtld.path) != 0) { - free(obj_rtld.path); - obj_rtld.path = xstrdup(obj_main->interp); - __progname = obj_rtld.path; - } - - digest_dynamic(obj_main, 0); - - linkmap_add(obj_main); - linkmap_add(&obj_rtld); - - /* Link the main program into the list of objects. */ - *obj_tail = obj_main; - obj_tail = &obj_main->next; - obj_count++; - /* Make sure we don't call the main program's init and fini functions. */ - obj_main->init = obj_main->fini = (Elf_Addr)NULL; - - /* Initialize a fake symbol for resolving undefined weak references. */ - sym_zero.st_info = ELF_ST_INFO(STB_GLOBAL, STT_NOTYPE); - sym_zero.st_shndx = SHN_UNDEF; - - if (!libmap_disable) - libmap_disable = (bool)lm_init(); - - dbg("loading LD_PRELOAD libraries"); - if (load_preload_objects() == -1) - die(); - preload_tail = obj_tail; - - dbg("loading needed objects"); - if (load_needed_objects(obj_main) == -1) - die(); - - /* Make a list of all objects loaded at startup. */ - for (obj = obj_list; obj != NULL; obj = obj->next) { - objlist_push_tail(&list_main, obj); - obj->refcount++; - } - - if (ld_tracing) { /* We're done */ - trace_loaded_objects(obj_main); - exit(0); - } - - if (getenv(LD_ "DUMP_REL_PRE") != NULL) { - dump_relocations(obj_main); - exit (0); - } - - /* setup TLS for main thread */ - dbg("initializing initial thread local storage"); - STAILQ_FOREACH(entry, &list_main, link) { - /* - * Allocate all the initial objects out of the static TLS - * block even if they didn't ask for it. - */ - allocate_tls_offset(entry->obj); - } - allocate_initial_tls(obj_list); - - if (relocate_objects(obj_main, - ld_bind_now != NULL && *ld_bind_now != '\0', &obj_rtld) == -1) - die(); - - dbg("doing copy relocations"); - if (do_copy_relocations(obj_main) == -1) - die(); - - if (getenv(LD_ "DUMP_REL_POST") != NULL) { - dump_relocations(obj_main); - exit (0); - } - - dbg("initializing key program variables"); - set_program_var("__progname", argv[0] != NULL ? basename(argv[0]) : ""); - set_program_var("environ", env); - - dbg("initializing thread locks"); - lockdflt_init(); - - /* Make a list of init functions to call. */ - objlist_init(&initlist); - initlist_add_objects(obj_list, preload_tail, &initlist); - - r_debug_state(NULL, &obj_main->linkmap); /* say hello to gdb! */ - - objlist_call_init(&initlist); - lockstate = wlock_acquire(rtld_bind_lock); - objlist_clear(&initlist); - wlock_release(rtld_bind_lock, lockstate); - - dbg("transferring control to program entry point = %p", obj_main->entry); - - /* Return the exit procedure and the program entry point. */ - *exit_proc = rtld_exit; - *objp = obj_main; - return (func_ptr_type) obj_main->entry; -} - -#endif /* 0 */ - -Elf_Addr -_rtld_bind(Obj_Entry *obj, Elf_Word reloff) -{ - const Elf_Rel *rel; - const Elf_Sym *def; - const Obj_Entry *defobj; - Elf_Addr *where; - Elf_Addr target; - int lockstate; - - lockstate = rlock_acquire(rtld_bind_lock); - if (obj->pltrel) - rel = (const Elf_Rel *) ((caddr_t) obj->pltrel + reloff); - else - rel = (const Elf_Rel *) ((caddr_t) obj->pltrela + reloff); - - where = (Elf_Addr *) (obj->relocbase + rel->r_offset); - def = find_symdef(ELF_R_SYM(rel->r_info), obj, &defobj, true, NULL); - if (def == NULL) - die(); - - target = (Elf_Addr)(defobj->relocbase + def->st_value); - - dbg("\"%s\" in \"%s\" ==> %p in \"%s\"", - defobj->strtab + def->st_name, basename(obj->path), - (void *)target, basename(defobj->path)); - - /* - * Write the new contents for the jmpslot. Note that depending on - * architecture, the value which we need to return back to the - * lazy binding trampoline may or may not be the target - * address. The value returned from reloc_jmpslot() is the value - * that the trampoline needs. - */ - target = reloc_jmpslot(where, target, defobj, obj, rel); - rlock_release(rtld_bind_lock, lockstate); - return target; -} - -#if 0 - -/* - * Error reporting function. Use it like printf. If formats the message - * into a buffer, and sets things up so that the next call to dlerror() - * will return the message. - */ -void -_rtld_error(const char *fmt, ...) -{ - static char buf[512]; - va_list ap; - - va_start(ap, fmt); - vsnprintf(buf, sizeof buf, fmt, ap); - error_message = buf; - va_end(ap); -} - -/* - * Return a dynamically-allocated copy of the current error message, if any. - */ -static char * -errmsg_save(void) -{ - return error_message == NULL ? NULL : xstrdup(error_message); -} - -/* - * Restore the current error message from a copy which was previously saved - * by errmsg_save(). The copy is freed. - */ -static void -errmsg_restore(char *saved_msg) -{ - if (saved_msg == NULL) - error_message = NULL; - else { - _rtld_error("%s", saved_msg); - free(saved_msg); - } -} - -static const char * -basename(const char *name) -{ - const char *p = strrchr(name, '/'); - return p != NULL ? p + 1 : name; -} - -static void -die(void) -{ - const char *msg = dlerror(); - - if (msg == NULL) - msg = "Fatal error"; - errx(1, "%s", msg); -} - -#endif /* 0 */ - -/* - * Process a shared object's DYNAMIC section, and save the important - * information in its Obj_Entry structure. - */ -static void -digest_dynamic(Obj_Entry *obj, int early) -{ - const Elf_Dyn *dynp; - Needed_Entry **needed_tail = &obj->needed; - const Elf_Dyn *dyn_rpath = NULL; - int plttype = DT_REL; - - obj->bind_now = false; - for (dynp = obj->dynamic; dynp->d_tag != DT_NULL; dynp++) { - switch (dynp->d_tag) { - - case DT_REL: - obj->rel = (const Elf_Rel *) (obj->relocbase + dynp->d_un.d_ptr); - break; - - case DT_RELSZ: - obj->relsize = dynp->d_un.d_val; - break; - - case DT_RELENT: - assert(dynp->d_un.d_val == sizeof(Elf_Rel)); - break; - - case DT_JMPREL: - obj->pltrel = (const Elf_Rel *) - (obj->relocbase + dynp->d_un.d_ptr); - break; - - case DT_PLTRELSZ: - obj->pltrelsize = dynp->d_un.d_val; - break; - - case DT_RELA: - obj->rela = (const Elf_Rela *) (obj->relocbase + dynp->d_un.d_ptr); - break; - - case DT_RELASZ: - obj->relasize = dynp->d_un.d_val; - break; - - case DT_RELAENT: - assert(dynp->d_un.d_val == sizeof(Elf_Rela)); - break; - - case DT_PLTREL: - plttype = dynp->d_un.d_val; - assert(dynp->d_un.d_val == DT_REL || plttype == DT_RELA); - break; - - case DT_SYMTAB: - obj->symtab = (const Elf_Sym *) - (obj->relocbase + dynp->d_un.d_ptr); - break; - - case DT_SYMENT: - assert(dynp->d_un.d_val == sizeof(Elf_Sym)); - break; - - case DT_STRTAB: - obj->strtab = (const char *) (obj->relocbase + dynp->d_un.d_ptr); - break; - - case DT_STRSZ: - obj->strsize = dynp->d_un.d_val; - break; - - case DT_HASH: - { - const Elf_Hashelt *hashtab = (const Elf_Hashelt *) - (obj->relocbase + dynp->d_un.d_ptr); - obj->nbuckets = hashtab[0]; - obj->nchains = hashtab[1]; - obj->buckets = hashtab + 2; - obj->chains = obj->buckets + obj->nbuckets; - } - break; - - case DT_NEEDED: - if (!obj->rtld) { - Needed_Entry *nep = NEW(Needed_Entry); - nep->name = dynp->d_un.d_val; - nep->obj = NULL; - nep->next = NULL; - - *needed_tail = nep; - needed_tail = &nep->next; - } - break; - - case DT_PLTGOT: - obj->pltgot = (Elf_Addr *) (obj->relocbase + dynp->d_un.d_ptr); - break; - - case DT_TEXTREL: - obj->textrel = true; - break; - - case DT_SYMBOLIC: - obj->symbolic = true; - break; - - case DT_RPATH: - case DT_RUNPATH: /* XXX: process separately */ - /* - * We have to wait until later to process this, because we - * might not have gotten the address of the string table yet. - */ - dyn_rpath = dynp; - break; - - case DT_SONAME: - /* Not used by the dynamic linker. */ - break; - - case DT_INIT: - obj->init = (Elf_Addr) (obj->relocbase + dynp->d_un.d_ptr); - break; - - case DT_FINI: - obj->fini = (Elf_Addr) (obj->relocbase + dynp->d_un.d_ptr); - break; - - case DT_DEBUG: - /* XXX - not implemented yet */ - if (!early) - dbg("Filling in DT_DEBUG entry"); - ((Elf_Dyn*)dynp)->d_un.d_ptr = (Elf_Addr) &r_debug; - break; - - case DT_FLAGS: - if (dynp->d_un.d_val & DF_ORIGIN) { - obj->origin_path = xmalloc(PATH_MAX); - if (rtld_dirname(obj->path, obj->origin_path) == -1) - die(); - } - if (dynp->d_un.d_val & DF_SYMBOLIC) - obj->symbolic = true; - if (dynp->d_un.d_val & DF_TEXTREL) - obj->textrel = true; - if (dynp->d_un.d_val & DF_BIND_NOW) - obj->bind_now = true; - if (dynp->d_un.d_val & DF_STATIC_TLS) - ; - break; - - default: - if (!early) { - dbg("Ignoring d_tag %ld = %#lx", (long)dynp->d_tag, - (long)dynp->d_tag); - } - break; - } - } - - obj->traced = false; - - if (plttype == DT_RELA) { - obj->pltrela = (const Elf_Rela *) obj->pltrel; - obj->pltrel = NULL; - obj->pltrelasize = obj->pltrelsize; - obj->pltrelsize = 0; - } - - if (dyn_rpath != NULL) - obj->rpath = obj->strtab + dyn_rpath->d_un.d_val; -} - -/* - * Process a shared object's program header. This is used only for the - * main program, when the kernel has already loaded the main program - * into memory before calling the dynamic linker. It creates and - * returns an Obj_Entry structure. - */ -static Obj_Entry * -digest_phdr(const Elf_Phdr *phdr, int phnum, caddr_t entry, const char *path) -{ - Obj_Entry *obj; - const Elf_Phdr *phlimit = phdr + phnum; - const Elf_Phdr *ph; - int nsegs = 0; - - obj = obj_new(); - for (ph = phdr; ph < phlimit; ph++) { - switch (ph->p_type) { - - case PT_PHDR: - if ((const Elf_Phdr *)ph->p_vaddr != phdr) { - _rtld_error("%s: invalid PT_PHDR", path); - return NULL; - } - obj->phdr = (const Elf_Phdr *) ph->p_vaddr; - obj->phsize = ph->p_memsz; - break; - - case PT_INTERP: - obj->interp = (const char *) ph->p_vaddr; - break; - - case PT_LOAD: - if (nsegs == 0) { /* First load segment */ - obj->vaddrbase = trunc_page(ph->p_vaddr); - obj->mapbase = (caddr_t) obj->vaddrbase; - obj->relocbase = obj->mapbase - obj->vaddrbase; - obj->textsize = round_page(ph->p_vaddr + ph->p_memsz) - - obj->vaddrbase; - } else { /* Last load segment */ - obj->mapsize = round_page(ph->p_vaddr + ph->p_memsz) - - obj->vaddrbase; - } - nsegs++; - break; - - case PT_DYNAMIC: - obj->dynamic = (const Elf_Dyn *) ph->p_vaddr; - break; - - case PT_TLS: - obj->tlsindex = 1; - obj->tlssize = ph->p_memsz; - obj->tlsalign = ph->p_align; - obj->tlsinitsize = ph->p_filesz; - obj->tlsinit = (void*) ph->p_vaddr; - break; - } - } - if (nsegs < 1) { - _rtld_error("%s: too few PT_LOAD segments", path); - return NULL; - } - - obj->entry = entry; - return obj; -} - -#if 0 - -static Obj_Entry * -dlcheck(void *handle) -{ - Obj_Entry *obj; - - for (obj = obj_list; obj != NULL; obj = obj->next) - if (obj == (Obj_Entry *) handle) - break; - - if (obj == NULL || obj->refcount == 0 || obj->dl_refcount == 0) { - _rtld_error("Invalid shared object handle %p", handle); - return NULL; - } - return obj; -} - -/* - * If the given object is already in the donelist, return true. Otherwise - * add the object to the list and return false. - */ -static bool -donelist_check(DoneList *dlp, const Obj_Entry *obj) -{ - unsigned int i; - - for (i = 0; i < dlp->num_used; i++) - if (dlp->objs[i] == obj) - return true; - /* - * Our donelist allocation should always be sufficient. But if - * our threads locking isn't working properly, more shared objects - * could have been loaded since we allocated the list. That should - * never happen, but we'll handle it properly just in case it does. - */ - if (dlp->num_used < dlp->num_alloc) - dlp->objs[dlp->num_used++] = obj; - return false; -} - -#endif /* 0 */ - -/* - * Hash function for symbol table lookup. Don't even think about changing - * this. It is specified by the System V ABI. - */ -unsigned long -elf_hash(const char *name) -{ - const unsigned char *p = (const unsigned char *) name; - unsigned long h = 0; - unsigned long g; - - while (*p != '\0') { - h = (h << 4) + *p++; - if ((g = h & 0xf0000000) != 0) - h ^= g >> 24; - h &= ~g; - } - return h; -} - -#if 0 - -/* - * Find the library with the given name, and return its full pathname. - * The returned string is dynamically allocated. Generates an error - * message and returns NULL if the library cannot be found. - * - * If the second argument is non-NULL, then it refers to an already- - * loaded shared object, whose library search path will be searched. - * - * The search order is: - * LD_LIBRARY_PATH - * rpath in the referencing file - * ldconfig hints - * /lib:/usr/lib - */ -static char * -find_library(const char *xname, const Obj_Entry *refobj) -{ - char *pathname; - char *name; - - if (strchr(xname, '/') != NULL) { /* Hard coded pathname */ - if (xname[0] != '/' && !trust) { - _rtld_error("Absolute pathname required for shared object \"%s\"", - xname); - return NULL; - } - return xstrdup(xname); - } - - if (libmap_disable || (refobj == NULL) || - (name = lm_find(refobj->path, xname)) == NULL) - name = (char *)xname; - - dbg(" Searching for \"%s\"", name); - - if ((pathname = search_library_path(name, ld_library_path)) != NULL || - (refobj != NULL && - (pathname = search_library_path(name, refobj->rpath)) != NULL) || - (pathname = search_library_path(name, gethints())) != NULL || - (pathname = search_library_path(name, STANDARD_LIBRARY_PATH)) != NULL) - return pathname; - - if(refobj != NULL && refobj->path != NULL) { - _rtld_error("Shared object \"%s\" not found, required by \"%s\"", - name, basename(refobj->path)); - } else { - _rtld_error("Shared object \"%s\" not found", name); - } - return NULL; -} - -#endif /* 0 */ - -/* - * Given a symbol number in a referencing object, find the corresponding - * definition of the symbol. Returns a pointer to the symbol, or NULL if - * no definition was found. Returns a pointer to the Obj_Entry of the - * defining object via the reference parameter DEFOBJ_OUT. - */ -const Elf_Sym * -find_symdef(unsigned long symnum, const Obj_Entry *refobj, - const Obj_Entry **defobj_out, bool in_plt, SymCache *cache) -{ - const Elf_Sym *ref; - const Elf_Sym *def; - const Obj_Entry *defobj; - const char *name; - unsigned long hash; - - /* - * If we have already found this symbol, get the information from - * the cache. - */ - if (symnum >= refobj->nchains) - return NULL; /* Bad object */ - if (cache != NULL && cache[symnum].sym != NULL) { - *defobj_out = cache[symnum].obj; - return cache[symnum].sym; - } - - ref = refobj->symtab + symnum; - name = refobj->strtab + ref->st_name; - defobj = NULL; - - /* - * We don't have to do a full scale lookup if the symbol is local. - * We know it will bind to the instance in this load module; to - * which we already have a pointer (ie ref). By not doing a lookup, - * we not only improve performance, but it also avoids unresolvable - * symbols when local symbols are not in the hash table. This has - * been seen with the ia64 toolchain. - */ - if (ELF_ST_BIND(ref->st_info) != STB_LOCAL) { - if (ELF_ST_TYPE(ref->st_info) == STT_SECTION) { - _rtld_error("%s: Bogus symbol table entry %lu", refobj->path, - symnum); - } - hash = elf_hash(name); - def = symlook_default(name, hash, refobj, &defobj, in_plt); - } else { - def = ref; - defobj = refobj; - } - - /* - * If we found no definition and the reference is weak, treat the - * symbol as having the value zero. - */ - if (def == NULL && ELF_ST_BIND(ref->st_info) == STB_WEAK) { - def = &sym_zero; - defobj = obj_main; - } - - if (def != NULL) { - *defobj_out = defobj; - /* Record the information in the cache to avoid subsequent lookups. */ - if (cache != NULL) { - cache[symnum].sym = def; - cache[symnum].obj = defobj; - } - } else { - if (refobj != &obj_rtld) - _rtld_error("%s: Undefined symbol \"%s\"", refobj->path, name); - } - return def; -} - -#if 0 - -/* - * Return the search path from the ldconfig hints file, reading it if - * necessary. Returns NULL if there are problems with the hints file, - * or if the search path there is empty. - */ -static const char * -gethints(void) -{ - static char *hints; - - if (hints == NULL) { - int fd; - struct elfhints_hdr hdr; - char *p; - - /* Keep from trying again in case the hints file is bad. */ - hints = ""; - - if ((fd = open(_PATH_ELF_HINTS, O_RDONLY)) == -1) - return NULL; - if (read(fd, &hdr, sizeof hdr) != sizeof hdr || - hdr.magic != ELFHINTS_MAGIC || - hdr.version != 1) { - close(fd); - return NULL; - } - p = xmalloc(hdr.dirlistlen + 1); - if (lseek(fd, hdr.strtab + hdr.dirlist, SEEK_SET) == -1 || - read(fd, p, hdr.dirlistlen + 1) != (ssize_t)hdr.dirlistlen + 1) { - free(p); - close(fd); - return NULL; - } - hints = p; - close(fd); - } - return hints[0] != '\0' ? hints : NULL; -} - -static void -init_dag(Obj_Entry *root) -{ - DoneList donelist; - - donelist_init(&donelist); - init_dag1(root, root, &donelist); -} - -static void -init_dag1(Obj_Entry *root, Obj_Entry *obj, DoneList *dlp) -{ - const Needed_Entry *needed; - - if (donelist_check(dlp, obj)) - return; - - obj->refcount++; - objlist_push_tail(&obj->dldags, root); - objlist_push_tail(&root->dagmembers, obj); - for (needed = obj->needed; needed != NULL; needed = needed->next) - if (needed->obj != NULL) - init_dag1(root, needed->obj, dlp); -} - -/* - * Initialize the dynamic linker. The argument is the address at which - * the dynamic linker has been mapped into memory. The primary task of - * this function is to relocate the dynamic linker. - */ -static void -init_rtld(caddr_t mapbase) -{ - Obj_Entry objtmp; /* Temporary rtld object */ - - /* - * Conjure up an Obj_Entry structure for the dynamic linker. - * - * The "path" member can't be initialized yet because string constatns - * cannot yet be acessed. Below we will set it correctly. - */ - memset(&objtmp, 0, sizeof(objtmp)); - objtmp.path = NULL; - objtmp.rtld = true; - objtmp.mapbase = mapbase; -#ifdef PIC - objtmp.relocbase = mapbase; -#endif - if (RTLD_IS_DYNAMIC()) { - objtmp.dynamic = rtld_dynamic(&objtmp); - digest_dynamic(&objtmp, 1); - assert(objtmp.needed == NULL); - assert(!objtmp.textrel); - - /* - * Temporarily put the dynamic linker entry into the object list, so - * that symbols can be found. - */ - - relocate_objects(&objtmp, true, &objtmp); - } - - /* Initialize the object list. */ - obj_tail = &obj_list; - - /* Now that non-local variables can be accesses, copy out obj_rtld. */ - memcpy(&obj_rtld, &objtmp, sizeof(obj_rtld)); - - /* Replace the path with a dynamically allocated copy. */ - obj_rtld.path = xstrdup(PATH_RTLD); - - r_debug.r_brk = r_debug_state; - r_debug.r_state = RT_CONSISTENT; -} - -/* - * Add the init functions from a needed object list (and its recursive - * needed objects) to "list". This is not used directly; it is a helper - * function for initlist_add_objects(). The write lock must be held - * when this function is called. - */ -static void -initlist_add_neededs(Needed_Entry *needed, Objlist *list) -{ - /* Recursively process the successor needed objects. */ - if (needed->next != NULL) - initlist_add_neededs(needed->next, list); - - /* Process the current needed object. */ - if (needed->obj != NULL) - initlist_add_objects(needed->obj, &needed->obj->next, list); -} - -/* - * Scan all of the DAGs rooted in the range of objects from "obj" to - * "tail" and add their init functions to "list". This recurses over - * the DAGs and ensure the proper init ordering such that each object's - * needed libraries are initialized before the object itself. At the - * same time, this function adds the objects to the global finalization - * list "list_fini" in the opposite order. The write lock must be - * held when this function is called. - */ -static void -initlist_add_objects(Obj_Entry *obj, Obj_Entry **tail, Objlist *list) -{ - if (obj->init_done) - return; - obj->init_done = true; - - /* Recursively process the successor objects. */ - if (&obj->next != tail) - initlist_add_objects(obj->next, tail, list); - - /* Recursively process the needed objects. */ - if (obj->needed != NULL) - initlist_add_neededs(obj->needed, list); - - /* Add the object to the init list. */ - if (obj->init != (Elf_Addr)NULL) - objlist_push_tail(list, obj); - - /* Add the object to the global fini list in the reverse order. */ - if (obj->fini != (Elf_Addr)NULL) - objlist_push_head(&list_fini, obj); -} - -#ifndef FPTR_TARGET -#define FPTR_TARGET(f) ((Elf_Addr) (f)) -#endif - -static bool -is_exported(const Elf_Sym *def) -{ - Elf_Addr value; - const func_ptr_type *p; - - value = (Elf_Addr)(obj_rtld.relocbase + def->st_value); - for (p = exports; *p != NULL; p++) - if (FPTR_TARGET(*p) == value) - return true; - return false; -} - -/* - * Given a shared object, traverse its list of needed objects, and load - * each of them. Returns 0 on success. Generates an error message and - * returns -1 on failure. - */ -static int -load_needed_objects(Obj_Entry *first) -{ - Obj_Entry *obj; - - for (obj = first; obj != NULL; obj = obj->next) { - Needed_Entry *needed; - - for (needed = obj->needed; needed != NULL; needed = needed->next) { - const char *name = obj->strtab + needed->name; - char *path = find_library(name, obj); - - needed->obj = NULL; - if (path == NULL && !ld_tracing) - return -1; - - if (path) { - needed->obj = load_object(path); - if (needed->obj == NULL && !ld_tracing) - return -1; /* XXX - cleanup */ - } - } - } - - return 0; -} - -static int -load_preload_objects(void) -{ - char *p = ld_preload; - static const char delim[] = " \t:;"; - - if (p == NULL) - return 0; - - p += strspn(p, delim); - while (*p != '\0') { - size_t len = strcspn(p, delim); - char *path; - char savech; - - savech = p[len]; - p[len] = '\0'; - if ((path = find_library(p, NULL)) == NULL) - return -1; - if (load_object(path) == NULL) - return -1; /* XXX - cleanup */ - p[len] = savech; - p += len; - p += strspn(p, delim); - } - return 0; -} - -/* - * Load a shared object into memory, if it is not already loaded. The - * argument must be a string allocated on the heap. This function assumes - * responsibility for freeing it when necessary. - * - * Returns a pointer to the Obj_Entry for the object. Returns NULL - * on failure. - */ -static Obj_Entry * -load_object(char *path) -{ - Obj_Entry *obj; - int fd = -1; - struct stat sb; - - for (obj = obj_list->next; obj != NULL; obj = obj->next) - if (strcmp(obj->path, path) == 0) - break; - - /* - * If we didn't find a match by pathname, open the file and check - * again by device and inode. This avoids false mismatches caused - * by multiple links or ".." in pathnames. - * - * To avoid a race, we open the file and use fstat() rather than - * using stat(). - */ - if (obj == NULL) { - if ((fd = open(path, O_RDONLY)) == -1) { - _rtld_error("Cannot open \"%s\"", path); - return NULL; - } - if (fstat(fd, &sb) == -1) { - _rtld_error("Cannot fstat \"%s\"", path); - close(fd); - return NULL; - } - for (obj = obj_list->next; obj != NULL; obj = obj->next) { - if (obj->ino == sb.st_ino && obj->dev == sb.st_dev) { - close(fd); - break; - } - } - } - - if (obj == NULL) { /* First use of this object, so we must map it in */ - dbg("loading \"%s\"", path); - obj = map_object(fd, path, &sb); - close(fd); - if (obj == NULL) { - free(path); - return NULL; - } - - obj->path = path; - digest_dynamic(obj, 0); - - *obj_tail = obj; - obj_tail = &obj->next; - obj_count++; - linkmap_add(obj); /* for GDB & dlinfo() */ - - dbg(" %p .. %p: %s", obj->mapbase, - obj->mapbase + obj->mapsize - 1, obj->path); - if (obj->textrel) - dbg(" WARNING: %s has impure text", obj->path); - } else - free(path); - - return obj; -} - -static Obj_Entry * -obj_from_addr(const void *addr) -{ - Obj_Entry *obj; - - for (obj = obj_list; obj != NULL; obj = obj->next) { - if (addr < (void *) obj->mapbase) - continue; - if (addr < (void *) (obj->mapbase + obj->mapsize)) - return obj; - } - return NULL; -} - -/* - * Call the finalization functions for each of the objects in "list" - * which are unreferenced. All of the objects are expected to have - * non-NULL fini functions. - */ -static void -objlist_call_fini(Objlist *list) -{ - Objlist_Entry *elm; - char *saved_msg; - - /* - * Preserve the current error message since a fini function might - * call into the dynamic linker and overwrite it. - */ - saved_msg = errmsg_save(); - STAILQ_FOREACH(elm, list, link) { - if (elm->obj->refcount == 0) { - dbg("calling fini function for %s at %p", elm->obj->path, - (void *)elm->obj->fini); - call_initfini_pointer(elm->obj, elm->obj->fini); - } - } - errmsg_restore(saved_msg); -} - -/* - * Call the initialization functions for each of the objects in - * "list". All of the objects are expected to have non-NULL init - * functions. - */ -static void -objlist_call_init(Objlist *list) -{ - Objlist_Entry *elm; - char *saved_msg; - - /* - * Preserve the current error message since an init function might - * call into the dynamic linker and overwrite it. - */ - saved_msg = errmsg_save(); - STAILQ_FOREACH(elm, list, link) { - dbg("calling init function for %s at %p", elm->obj->path, - (void *)elm->obj->init); - call_initfini_pointer(elm->obj, elm->obj->init); - } - errmsg_restore(saved_msg); -} - -static void -objlist_clear(Objlist *list) -{ - Objlist_Entry *elm; - - while (!STAILQ_EMPTY(list)) { - elm = STAILQ_FIRST(list); - STAILQ_REMOVE_HEAD(list, link); - free(elm); - } -} - -static Objlist_Entry * -objlist_find(Objlist *list, const Obj_Entry *obj) -{ - Objlist_Entry *elm; - - STAILQ_FOREACH(elm, list, link) - if (elm->obj == obj) - return elm; - return NULL; -} - -static void -objlist_init(Objlist *list) -{ - STAILQ_INIT(list); -} - -static void -objlist_push_head(Objlist *list, Obj_Entry *obj) -{ - Objlist_Entry *elm; - - elm = NEW(Objlist_Entry); - elm->obj = obj; - STAILQ_INSERT_HEAD(list, elm, link); -} - -static void -objlist_push_tail(Objlist *list, Obj_Entry *obj) -{ - Objlist_Entry *elm; - - elm = NEW(Objlist_Entry); - elm->obj = obj; - STAILQ_INSERT_TAIL(list, elm, link); -} - -static void -objlist_remove(Objlist *list, Obj_Entry *obj) -{ - Objlist_Entry *elm; - - if ((elm = objlist_find(list, obj)) != NULL) { - STAILQ_REMOVE(list, elm, Struct_Objlist_Entry, link); - free(elm); - } -} - -/* - * Remove all of the unreferenced objects from "list". - */ -static void -objlist_remove_unref(Objlist *list) -{ - Objlist newlist; - Objlist_Entry *elm; - - STAILQ_INIT(&newlist); - while (!STAILQ_EMPTY(list)) { - elm = STAILQ_FIRST(list); - STAILQ_REMOVE_HEAD(list, link); - if (elm->obj->refcount == 0) - free(elm); - else - STAILQ_INSERT_TAIL(&newlist, elm, link); - } - *list = newlist; -} - -#endif /* 0 */ - -/* - * Relocate newly-loaded shared objects. The argument is a pointer to - * the Obj_Entry for the first such object. All objects from the first - * to the end of the list of objects are relocated. Returns 0 on success, - * or -1 on failure. - */ -static int -relocate_objects(Obj_Entry *first, bool bind_now, Obj_Entry *rtldobj) -{ - Obj_Entry *obj; - - for (obj = first; obj != NULL; obj = obj->next) { - if (obj != rtldobj) - dbg("relocating \"%s\"", obj->path); - if (obj->nbuckets == 0 || obj->nchains == 0 || obj->buckets == NULL || - obj->symtab == NULL || obj->strtab == NULL) { - _rtld_error("%s: Shared object has no run-time symbol table", - obj->path); - return -1; - } - - if (obj->textrel) { - /* There are relocations to the write-protected text segment. */ - if (mprotect(obj->mapbase, obj->textsize, - PROT_READ|PROT_WRITE|PROT_EXEC) == -1) { - _rtld_error("%s: Cannot write-enable text segment: %s", - obj->path, strerror(errno)); - return -1; - } - } - - /* Process the non-PLT relocations. */ - if (reloc_non_plt(obj, rtldobj)) - return -1; - - if (obj->textrel) { /* Re-protected the text segment. */ - if (mprotect(obj->mapbase, obj->textsize, - PROT_READ|PROT_EXEC) == -1) { - _rtld_error("%s: Cannot write-protect text segment: %s", - obj->path, strerror(errno)); - return -1; - } - } - - /* Process the PLT relocations. */ - if (reloc_plt(obj) == -1) - return -1; - /* Relocate the jump slots if we are doing immediate binding. */ - if (obj->bind_now || bind_now) - if (reloc_jmpslots(obj) == -1) - return -1; - - - /* - * Set up the magic number and version in the Obj_Entry. These - * were checked in the crt1.o from the original ElfKit, so we - * set them for backward compatibility. - */ - obj->magic = RTLD_MAGIC; - obj->version = RTLD_VERSION; - - /* Set the special PLT or GOT entries. */ - init_pltgot(obj); - } - - return 0; -} - -#if 0 - -/* - * Cleanup procedure. It will be called (by the atexit mechanism) just - * before the process exits. - */ -static void -rtld_exit(void) -{ - Obj_Entry *obj; - - dbg("rtld_exit()"); - /* Clear all the reference counts so the fini functions will be called. */ - for (obj = obj_list; obj != NULL; obj = obj->next) - obj->refcount = 0; - objlist_call_fini(&list_fini); - /* No need to remove the items from the list, since we are exiting. */ - if (!libmap_disable) - lm_fini(); -} - -static void * -path_enumerate(const char *path, path_enum_proc callback, void *arg) -{ -#ifdef COMPAT_32BIT - const char *trans; -#endif - if (path == NULL) - return (NULL); - - path += strspn(path, ":;"); - while (*path != '\0') { - size_t len; - char *res; - - len = strcspn(path, ":;"); -#ifdef COMPAT_32BIT - trans = lm_findn(NULL, path, len); - if (trans) - res = callback(trans, strlen(trans), arg); - else -#endif - res = callback(path, len, arg); - - if (res != NULL) - return (res); - - path += len; - path += strspn(path, ":;"); - } - - return (NULL); -} - -struct try_library_args { - const char *name; - size_t namelen; - char *buffer; - size_t buflen; -}; - -static void * -try_library_path(const char *dir, size_t dirlen, void *param) -{ - struct try_library_args *arg; - - arg = param; - if (*dir == '/' || trust) { - char *pathname; - - if (dirlen + 1 + arg->namelen + 1 > arg->buflen) - return (NULL); - - pathname = arg->buffer; - strncpy(pathname, dir, dirlen); - pathname[dirlen] = '/'; - strcpy(pathname + dirlen + 1, arg->name); - - dbg(" Trying \"%s\"", pathname); - if (access(pathname, F_OK) == 0) { /* We found it */ - pathname = xmalloc(dirlen + 1 + arg->namelen + 1); - strcpy(pathname, arg->buffer); - return (pathname); - } - } - return (NULL); -} - -static char * -search_library_path(const char *name, const char *path) -{ - char *p; - struct try_library_args arg; - - if (path == NULL) - return NULL; - - arg.name = name; - arg.namelen = strlen(name); - arg.buffer = xmalloc(PATH_MAX); - arg.buflen = PATH_MAX; - - p = path_enumerate(path, try_library_path, &arg); - - free(arg.buffer); - - return (p); -} - -int -dlclose(void *handle) -{ - Obj_Entry *root; - int lockstate; - - lockstate = wlock_acquire(rtld_bind_lock); - root = dlcheck(handle); - if (root == NULL) { - wlock_release(rtld_bind_lock, lockstate); - return -1; - } - - /* Unreference the object and its dependencies. */ - root->dl_refcount--; - - unref_dag(root); - - if (root->refcount == 0) { - /* - * The object is no longer referenced, so we must unload it. - * First, call the fini functions with no locks held. - */ - wlock_release(rtld_bind_lock, lockstate); - objlist_call_fini(&list_fini); - lockstate = wlock_acquire(rtld_bind_lock); - objlist_remove_unref(&list_fini); - - /* Finish cleaning up the newly-unreferenced objects. */ - GDB_STATE(RT_DELETE,&root->linkmap); - unload_object(root); - GDB_STATE(RT_CONSISTENT,NULL); - } - wlock_release(rtld_bind_lock, lockstate); - return 0; -} - -const char * -dlerror(void) -{ - char *msg = error_message; - error_message = NULL; - return msg; -} - -/* - * This function is deprecated and has no effect. - */ -void -dllockinit(void *context, - void *(*lock_create)(void *context), - void (*rlock_acquire)(void *lock), - void (*wlock_acquire)(void *lock), - void (*lock_release)(void *lock), - void (*lock_destroy)(void *lock), - void (*context_destroy)(void *context)) -{ - static void *cur_context; - static void (*cur_context_destroy)(void *); - - /* Just destroy the context from the previous call, if necessary. */ - if (cur_context_destroy != NULL) - cur_context_destroy(cur_context); - cur_context = context; - cur_context_destroy = context_destroy; -} - -void * -dlopen(const char *name, int mode) -{ - Obj_Entry **old_obj_tail; - Obj_Entry *obj; - Objlist initlist; - int result, lockstate; - - ld_tracing = (mode & RTLD_TRACE) == 0 ? NULL : "1"; - if (ld_tracing != NULL) - environ = (char **)*get_program_var_addr("environ"); - - objlist_init(&initlist); - - lockstate = wlock_acquire(rtld_bind_lock); - GDB_STATE(RT_ADD,NULL); - - old_obj_tail = obj_tail; - obj = NULL; - if (name == NULL) { - obj = obj_main; - obj->refcount++; - } else { - char *path = find_library(name, obj_main); - if (path != NULL) - obj = load_object(path); - } - - if (obj) { - obj->dl_refcount++; - if (mode & RTLD_GLOBAL && objlist_find(&list_global, obj) == NULL) - objlist_push_tail(&list_global, obj); - mode &= RTLD_MODEMASK; - if (*old_obj_tail != NULL) { /* We loaded something new. */ - assert(*old_obj_tail == obj); - - result = load_needed_objects(obj); - if (result != -1 && ld_tracing) - goto trace; - - if (result == -1 || - (init_dag(obj), relocate_objects(obj, mode == RTLD_NOW, - &obj_rtld)) == -1) { - obj->dl_refcount--; - unref_dag(obj); - if (obj->refcount == 0) - unload_object(obj); - obj = NULL; - } else { - /* Make list of init functions to call. */ - initlist_add_objects(obj, &obj->next, &initlist); - } - } else { - - /* Bump the reference counts for objects on this DAG. */ - ref_dag(obj); - - if (ld_tracing) - goto trace; - } - } - - GDB_STATE(RT_CONSISTENT,obj ? &obj->linkmap : NULL); - - /* Call the init functions with no locks held. */ - wlock_release(rtld_bind_lock, lockstate); - objlist_call_init(&initlist); - lockstate = wlock_acquire(rtld_bind_lock); - objlist_clear(&initlist); - wlock_release(rtld_bind_lock, lockstate); - return obj; -trace: - trace_loaded_objects(obj); - wlock_release(rtld_bind_lock, lockstate); - exit(0); -} - -void * -dlsym(void *handle, const char *name) -{ - const Obj_Entry *obj; - unsigned long hash; - const Elf_Sym *def; - const Obj_Entry *defobj; - int lockstate; - - hash = elf_hash(name); - def = NULL; - defobj = NULL; - - lockstate = rlock_acquire(rtld_bind_lock); - if (handle == NULL || handle == RTLD_NEXT || - handle == RTLD_DEFAULT || handle == RTLD_SELF) { - void *retaddr; - - retaddr = __builtin_return_address(0); /* __GNUC__ only */ - if ((obj = obj_from_addr(retaddr)) == NULL) { - _rtld_error("Cannot determine caller's shared object"); - rlock_release(rtld_bind_lock, lockstate); - return NULL; - } - if (handle == NULL) { /* Just the caller's shared object. */ - def = symlook_obj(name, hash, obj, true); - defobj = obj; - } else if (handle == RTLD_NEXT || /* Objects after caller's */ - handle == RTLD_SELF) { /* ... caller included */ - if (handle == RTLD_NEXT) - obj = obj->next; - for (; obj != NULL; obj = obj->next) { - if ((def = symlook_obj(name, hash, obj, true)) != NULL) { - defobj = obj; - break; - } - } - } else { - assert(handle == RTLD_DEFAULT); - def = symlook_default(name, hash, obj, &defobj, true); - } - } else { - if ((obj = dlcheck(handle)) == NULL) { - rlock_release(rtld_bind_lock, lockstate); - return NULL; - } - - if (obj->mainprog) { - DoneList donelist; - - /* Search main program and all libraries loaded by it. */ - donelist_init(&donelist); - def = symlook_list(name, hash, &list_main, &defobj, true, - &donelist); - } else { - /* - * XXX - This isn't correct. The search should include the whole - * DAG rooted at the given object. - */ - def = symlook_obj(name, hash, obj, true); - defobj = obj; - } - } - - if (def != NULL) { - rlock_release(rtld_bind_lock, lockstate); - - /* - * The value required by the caller is derived from the value - * of the symbol. For the ia64 architecture, we need to - * construct a function descriptor which the caller can use to - * call the function with the right 'gp' value. For other - * architectures and for non-functions, the value is simply - * the relocated value of the symbol. - */ - if (ELF_ST_TYPE(def->st_info) == STT_FUNC) - return make_function_pointer(def, defobj); - else - return defobj->relocbase + def->st_value; - } - - _rtld_error("Undefined symbol \"%s\"", name); - rlock_release(rtld_bind_lock, lockstate); - return NULL; -} - -int -dladdr(const void *addr, Dl_info *info) -{ - const Obj_Entry *obj; - const Elf_Sym *def; - void *symbol_addr; - unsigned long symoffset; - int lockstate; - - lockstate = rlock_acquire(rtld_bind_lock); - obj = obj_from_addr(addr); - if (obj == NULL) { - _rtld_error("No shared object contains address"); - rlock_release(rtld_bind_lock, lockstate); - return 0; - } - info->dli_fname = obj->path; - info->dli_fbase = obj->mapbase; - info->dli_saddr = (void *)0; - info->dli_sname = NULL; - - /* - * Walk the symbol list looking for the symbol whose address is - * closest to the address sent in. - */ - for (symoffset = 0; symoffset < obj->nchains; symoffset++) { - def = obj->symtab + symoffset; - - /* - * For skip the symbol if st_shndx is either SHN_UNDEF or - * SHN_COMMON. - */ - if (def->st_shndx == SHN_UNDEF || def->st_shndx == SHN_COMMON) - continue; - - /* - * If the symbol is greater than the specified address, or if it - * is further away from addr than the current nearest symbol, - * then reject it. - */ - symbol_addr = obj->relocbase + def->st_value; - if (symbol_addr > addr || symbol_addr < info->dli_saddr) - continue; - - /* Update our idea of the nearest symbol. */ - info->dli_sname = obj->strtab + def->st_name; - info->dli_saddr = symbol_addr; - - /* Exact match? */ - if (info->dli_saddr == addr) - break; - } - rlock_release(rtld_bind_lock, lockstate); - return 1; -} - -int -dlinfo(void *handle, int request, void *p) -{ - const Obj_Entry *obj; - int error, lockstate; - - lockstate = rlock_acquire(rtld_bind_lock); - - if (handle == NULL || handle == RTLD_SELF) { - void *retaddr; - - retaddr = __builtin_return_address(0); /* __GNUC__ only */ - if ((obj = obj_from_addr(retaddr)) == NULL) - _rtld_error("Cannot determine caller's shared object"); - } else - obj = dlcheck(handle); - - if (obj == NULL) { - rlock_release(rtld_bind_lock, lockstate); - return (-1); - } - - error = 0; - switch (request) { - case RTLD_DI_LINKMAP: - *((struct link_map const **)p) = &obj->linkmap; - break; - case RTLD_DI_ORIGIN: - error = rtld_dirname(obj->path, p); - break; - - case RTLD_DI_SERINFOSIZE: - case RTLD_DI_SERINFO: - error = do_search_info(obj, request, (struct dl_serinfo *)p); - break; - - default: - _rtld_error("Invalid request %d passed to dlinfo()", request); - error = -1; - } - - rlock_release(rtld_bind_lock, lockstate); - - return (error); -} - -struct fill_search_info_args { - int request; - unsigned int flags; - Dl_serinfo *serinfo; - Dl_serpath *serpath; - char *strspace; -}; - -static void * -fill_search_info(const char *dir, size_t dirlen, void *param) -{ - struct fill_search_info_args *arg; - - arg = param; - - if (arg->request == RTLD_DI_SERINFOSIZE) { - arg->serinfo->dls_cnt ++; - arg->serinfo->dls_size += dirlen + 1; - } else { - struct dl_serpath *s_entry; - - s_entry = arg->serpath; - s_entry->dls_name = arg->strspace; - s_entry->dls_flags = arg->flags; - - strncpy(arg->strspace, dir, dirlen); - arg->strspace[dirlen] = '\0'; - - arg->strspace += dirlen + 1; - arg->serpath++; - } - - return (NULL); -} - -static int -do_search_info(const Obj_Entry *obj, int request, struct dl_serinfo *info) -{ - struct dl_serinfo _info; - struct fill_search_info_args args; - - args.request = RTLD_DI_SERINFOSIZE; - args.serinfo = &_info; - - _info.dls_size = __offsetof(struct dl_serinfo, dls_serpath); - _info.dls_cnt = 0; - - path_enumerate(ld_library_path, fill_search_info, &args); - path_enumerate(obj->rpath, fill_search_info, &args); - path_enumerate(gethints(), fill_search_info, &args); - path_enumerate(STANDARD_LIBRARY_PATH, fill_search_info, &args); - - - if (request == RTLD_DI_SERINFOSIZE) { - info->dls_size = _info.dls_size; - info->dls_cnt = _info.dls_cnt; - return (0); - } - - if (info->dls_cnt != _info.dls_cnt || info->dls_size != _info.dls_size) { - _rtld_error("Uninitialized Dl_serinfo struct passed to dlinfo()"); - return (-1); - } - - args.request = RTLD_DI_SERINFO; - args.serinfo = info; - args.serpath = &info->dls_serpath[0]; - args.strspace = (char *)&info->dls_serpath[_info.dls_cnt]; - - args.flags = LA_SER_LIBPATH; - if (path_enumerate(ld_library_path, fill_search_info, &args) != NULL) - return (-1); - - args.flags = LA_SER_RUNPATH; - if (path_enumerate(obj->rpath, fill_search_info, &args) != NULL) - return (-1); - - args.flags = LA_SER_CONFIG; - if (path_enumerate(gethints(), fill_search_info, &args) != NULL) - return (-1); - - args.flags = LA_SER_DEFAULT; - if (path_enumerate(STANDARD_LIBRARY_PATH, fill_search_info, &args) != NULL) - return (-1); - return (0); -} - -static int -rtld_dirname(const char *path, char *bname) -{ - const char *endp; - - /* Empty or NULL string gets treated as "." */ - if (path == NULL || *path == '\0') { - bname[0] = '.'; - bname[1] = '\0'; - return (0); - } - - /* Strip trailing slashes */ - endp = path + strlen(path) - 1; - while (endp > path && *endp == '/') - endp--; - - /* Find the start of the dir */ - while (endp > path && *endp != '/') - endp--; - - /* Either the dir is "/" or there are no slashes */ - if (endp == path) { - bname[0] = *endp == '/' ? '/' : '.'; - bname[1] = '\0'; - return (0); - } else { - do { - endp--; - } while (endp > path && *endp == '/'); - } - - if (endp - path + 2 > PATH_MAX) - { - _rtld_error("Filename is too long: %s", path); - return(-1); - } - - strncpy(bname, path, endp - path + 1); - bname[endp - path + 1] = '\0'; - return (0); -} - -static void -linkmap_add(Obj_Entry *obj) -{ - struct link_map *l = &obj->linkmap; - struct link_map *prev; - - obj->linkmap.l_name = obj->path; - obj->linkmap.l_addr = obj->mapbase; - obj->linkmap.l_ld = obj->dynamic; -#ifdef __mips__ - /* GDB needs load offset on MIPS to use the symbols */ - obj->linkmap.l_offs = obj->relocbase; -#endif - - if (r_debug.r_map == NULL) { - r_debug.r_map = l; - return; - } - - /* - * Scan to the end of the list, but not past the entry for the - * dynamic linker, which we want to keep at the very end. - */ - for (prev = r_debug.r_map; - prev->l_next != NULL && prev->l_next != &obj_rtld.linkmap; - prev = prev->l_next) - ; - - /* Link in the new entry. */ - l->l_prev = prev; - l->l_next = prev->l_next; - if (l->l_next != NULL) - l->l_next->l_prev = l; - prev->l_next = l; -} - -static void -linkmap_delete(Obj_Entry *obj) -{ - struct link_map *l = &obj->linkmap; - - if (l->l_prev == NULL) { - if ((r_debug.r_map = l->l_next) != NULL) - l->l_next->l_prev = NULL; - return; - } - - if ((l->l_prev->l_next = l->l_next) != NULL) - l->l_next->l_prev = l->l_prev; -} - -/* - * Function for the debugger to set a breakpoint on to gain control. - * - * The two parameters allow the debugger to easily find and determine - * what the runtime loader is doing and to whom it is doing it. - * - * When the loadhook trap is hit (r_debug_state, set at program - * initialization), the arguments can be found on the stack: - * - * +8 struct link_map *m - * +4 struct r_debug *rd - * +0 RetAddr - */ -void -r_debug_state(struct r_debug* rd, struct link_map *m) -{ -} - -/* - * Get address of the pointer variable in the main program. - */ -static const void ** -get_program_var_addr(const char *name) -{ - const Obj_Entry *obj; - unsigned long hash; - - hash = elf_hash(name); - for (obj = obj_main; obj != NULL; obj = obj->next) { - const Elf_Sym *def; - - if ((def = symlook_obj(name, hash, obj, false)) != NULL) { - const void **addr; - - addr = (const void **)(obj->relocbase + def->st_value); - return addr; - } - } - return NULL; -} - -/* - * Set a pointer variable in the main program to the given value. This - * is used to set key variables such as "environ" before any of the - * init functions are called. - */ -static void -set_program_var(const char *name, const void *value) -{ - const void **addr; - - if ((addr = get_program_var_addr(name)) != NULL) { - dbg("\"%s\": *%p <-- %p", name, addr, value); - *addr = value; - } -} - -/* - * Given a symbol name in a referencing object, find the corresponding - * definition of the symbol. Returns a pointer to the symbol, or NULL if - * no definition was found. Returns a pointer to the Obj_Entry of the - * defining object via the reference parameter DEFOBJ_OUT. - */ -static const Elf_Sym * -symlook_default(const char *name, unsigned long hash, - const Obj_Entry *refobj, const Obj_Entry **defobj_out, bool in_plt) -{ - DoneList donelist; - const Elf_Sym *def; - const Elf_Sym *symp; - const Obj_Entry *obj; - const Obj_Entry *defobj; - const Objlist_Entry *elm; - def = NULL; - defobj = NULL; - donelist_init(&donelist); - - /* Look first in the referencing object if linked symbolically. */ - if (refobj->symbolic && !donelist_check(&donelist, refobj)) { - symp = symlook_obj(name, hash, refobj, in_plt); - if (symp != NULL) { - def = symp; - defobj = refobj; - } - } - - /* Search all objects loaded at program start up. */ - if (def == NULL || ELF_ST_BIND(def->st_info) == STB_WEAK) { - symp = symlook_list(name, hash, &list_main, &obj, in_plt, &donelist); - if (symp != NULL && - (def == NULL || ELF_ST_BIND(symp->st_info) != STB_WEAK)) { - def = symp; - defobj = obj; - } - } - - /* Search all DAGs whose roots are RTLD_GLOBAL objects. */ - STAILQ_FOREACH(elm, &list_global, link) { - if (def != NULL && ELF_ST_BIND(def->st_info) != STB_WEAK) - break; - symp = symlook_list(name, hash, &elm->obj->dagmembers, &obj, in_plt, - &donelist); - if (symp != NULL && - (def == NULL || ELF_ST_BIND(symp->st_info) != STB_WEAK)) { - def = symp; - defobj = obj; - } - } - - /* Search all dlopened DAGs containing the referencing object. */ - STAILQ_FOREACH(elm, &refobj->dldags, link) { - if (def != NULL && ELF_ST_BIND(def->st_info) != STB_WEAK) - break; - symp = symlook_list(name, hash, &elm->obj->dagmembers, &obj, in_plt, - &donelist); - if (symp != NULL && - (def == NULL || ELF_ST_BIND(symp->st_info) != STB_WEAK)) { - def = symp; - defobj = obj; - } - } - - /* - * Search the dynamic linker itself, and possibly resolve the - * symbol from there. This is how the application links to - * dynamic linker services such as dlopen. Only the values listed - * in the "exports" array can be resolved from the dynamic linker. - */ - if (def == NULL || ELF_ST_BIND(def->st_info) == STB_WEAK) { - symp = symlook_obj(name, hash, &obj_rtld, in_plt); - if (symp != NULL && is_exported(symp)) { - def = symp; - defobj = &obj_rtld; - } - } - - if (def != NULL) - *defobj_out = defobj; - return def; -} - -static const Elf_Sym * -symlook_list(const char *name, unsigned long hash, Objlist *objlist, - const Obj_Entry **defobj_out, bool in_plt, DoneList *dlp) -{ - const Elf_Sym *symp; - const Elf_Sym *def; - const Obj_Entry *defobj; - const Objlist_Entry *elm; - - def = NULL; - defobj = NULL; - STAILQ_FOREACH(elm, objlist, link) { - if (donelist_check(dlp, elm->obj)) - continue; - if ((symp = symlook_obj(name, hash, elm->obj, in_plt)) != NULL) { - if (def == NULL || ELF_ST_BIND(symp->st_info) != STB_WEAK) { - def = symp; - defobj = elm->obj; - if (ELF_ST_BIND(def->st_info) != STB_WEAK) - break; - } - } - } - if (def != NULL) - *defobj_out = defobj; - return def; -} - -#endif /* 0 */ - -/* - * Search the symbol table of a single shared object for a symbol of - * the given name. Returns a pointer to the symbol, or NULL if no - * definition was found. - * - * The symbol's hash value is passed in for efficiency reasons; that - * eliminates many recomputations of the hash value. - */ -const Elf_Sym * -symlook_obj(const char *name, unsigned long hash, const Obj_Entry *obj, - bool in_plt) -{ - if (obj->buckets != NULL) { - unsigned long symnum = obj->buckets[hash % obj->nbuckets]; - - while (symnum != STN_UNDEF) { - const Elf_Sym *symp; - const char *strp; - - if (symnum >= obj->nchains) - return NULL; /* Bad object */ - symp = obj->symtab + symnum; - strp = obj->strtab + symp->st_name; - - if (name[0] == strp[0] && strcmp(name, strp) == 0) - return symp->st_shndx != SHN_UNDEF || - (!in_plt && symp->st_value != 0 && - ELF_ST_TYPE(symp->st_info) == STT_FUNC) ? symp : NULL; - - symnum = obj->chains[symnum]; - } - } - return NULL; -} - -#if 0 - -static void -trace_loaded_objects(Obj_Entry *obj) -{ - char *fmt1, *fmt2, *fmt, *main_local, *list_containers; - int c; - - if ((main_local = getenv(LD_ "TRACE_LOADED_OBJECTS_PROGNAME")) == NULL) - main_local = ""; - - if ((fmt1 = getenv(LD_ "TRACE_LOADED_OBJECTS_FMT1")) == NULL) - fmt1 = "\t%o => %p (%x)\n"; - - if ((fmt2 = getenv(LD_ "TRACE_LOADED_OBJECTS_FMT2")) == NULL) - fmt2 = "\t%o (%x)\n"; - - list_containers = getenv(LD_ "TRACE_LOADED_OBJECTS_ALL"); - - for (; obj; obj = obj->next) { - Needed_Entry *needed; - char *name, *path; - bool is_lib; - - if (list_containers && obj->needed != NULL) - printf("%s:\n", obj->path); - for (needed = obj->needed; needed; needed = needed->next) { - if (needed->obj != NULL) { - if (needed->obj->traced && !list_containers) - continue; - needed->obj->traced = true; - path = needed->obj->path; - } else - path = "not found"; - - name = (char *)obj->strtab + needed->name; - is_lib = strncmp(name, "lib", 3) == 0; /* XXX - bogus */ - - fmt = is_lib ? fmt1 : fmt2; - while ((c = *fmt++) != '\0') { - switch (c) { - default: - putchar(c); - continue; - case '\\': - switch (c = *fmt) { - case '\0': - continue; - case 'n': - putchar('\n'); - break; - case 't': - putchar('\t'); - break; - } - break; - case '%': - switch (c = *fmt) { - case '\0': - continue; - case '%': - default: - putchar(c); - break; - case 'A': - printf("%s", main_local); - break; - case 'a': - printf("%s", obj_main->path); - break; - case 'o': - printf("%s", name); - break; -#if 0 - case 'm': - printf("%d", sodp->sod_major); - break; - case 'n': - printf("%d", sodp->sod_minor); - break; -#endif - case 'p': - printf("%s", path); - break; - case 'x': - printf("%p", needed->obj ? needed->obj->mapbase : 0); - break; - } - break; - } - ++fmt; - } - } - } -} - -/* - * Unload a dlopened object and its dependencies from memory and from - * our data structures. It is assumed that the DAG rooted in the - * object has already been unreferenced, and that the object has a - * reference count of 0. - */ -static void -unload_object(Obj_Entry *root) -{ - Obj_Entry *obj; - Obj_Entry **linkp; - - assert(root->refcount == 0); - - /* - * Pass over the DAG removing unreferenced objects from - * appropriate lists. - */ - unlink_object(root); - - /* Unmap all objects that are no longer referenced. */ - linkp = &obj_list->next; - while ((obj = *linkp) != NULL) { - if (obj->refcount == 0) { - dbg("unloading \"%s\"", obj->path); - munmap(obj->mapbase, obj->mapsize); - linkmap_delete(obj); - *linkp = obj->next; - obj_count--; - obj_free(obj); - } else - linkp = &obj->next; - } - obj_tail = linkp; -} - -static void -unlink_object(Obj_Entry *root) -{ - Objlist_Entry *elm; - - if (root->refcount == 0) { - /* Remove the object from the RTLD_GLOBAL list. */ - objlist_remove(&list_global, root); - - /* Remove the object from all objects' DAG lists. */ - STAILQ_FOREACH(elm, &root->dagmembers , link) { - objlist_remove(&elm->obj->dldags, root); - if (elm->obj != root) - unlink_object(elm->obj); - } - } -} - -static void -ref_dag(Obj_Entry *root) -{ - Objlist_Entry *elm; - - STAILQ_FOREACH(elm, &root->dagmembers , link) - elm->obj->refcount++; -} - -static void -unref_dag(Obj_Entry *root) -{ - Objlist_Entry *elm; - - STAILQ_FOREACH(elm, &root->dagmembers , link) - elm->obj->refcount--; -} - -/* - * Common code for MD __tls_get_addr(). - */ -void * -tls_get_addr_common(Elf_Addr** dtvp, int index, size_t offset) -{ - Elf_Addr* dtv = *dtvp; - - /* Check dtv generation in case new modules have arrived */ - if (dtv[0] != tls_dtv_generation) { - Elf_Addr* newdtv; - int to_copy; - - newdtv = calloc(1, (tls_max_index + 2) * sizeof(Elf_Addr)); - to_copy = dtv[1]; - if (to_copy > tls_max_index) - to_copy = tls_max_index; - memcpy(&newdtv[2], &dtv[2], to_copy * sizeof(Elf_Addr)); - newdtv[0] = tls_dtv_generation; - newdtv[1] = tls_max_index; - free(dtv); - *dtvp = newdtv; - } - - /* Dynamically allocate module TLS if necessary */ - if (!dtv[index + 1]) - dtv[index + 1] = (Elf_Addr)allocate_module_tls(index); - - return (void*) (dtv[index + 1] + offset); -} - -/* XXX not sure what variants to use for arm. */ - -#if defined(__ia64__) || defined(__alpha__) || defined(__powerpc__) - -/* - * Allocate Static TLS using the Variant I method. - */ -void * -allocate_tls(Obj_Entry *objs, void *oldtls, size_t tcbsize, size_t tcbalign) -{ - Obj_Entry *obj; - size_t size; - char *tls; - Elf_Addr *dtv, *olddtv; - Elf_Addr addr; - int i; - - size = tls_static_space; - - tls = malloc(size); - dtv = malloc((tls_max_index + 2) * sizeof(Elf_Addr)); - - *(Elf_Addr**) tls = dtv; - - dtv[0] = tls_dtv_generation; - dtv[1] = tls_max_index; - - if (oldtls) { - /* - * Copy the static TLS block over whole. - */ - memcpy(tls + tcbsize, oldtls + tcbsize, tls_static_space - tcbsize); - - /* - * If any dynamic TLS blocks have been created tls_get_addr(), - * move them over. - */ - olddtv = *(Elf_Addr**) oldtls; - for (i = 0; i < olddtv[1]; i++) { - if (olddtv[i+2] < (Elf_Addr)oldtls || - olddtv[i+2] > (Elf_Addr)oldtls + tls_static_space) { - dtv[i+2] = olddtv[i+2]; - olddtv[i+2] = 0; - } - } - - /* - * We assume that all tls blocks are allocated with the same - * size and alignment. - */ - free_tls(oldtls, tcbsize, tcbalign); - } else { - for (obj = objs; obj; obj = obj->next) { - if (obj->tlsoffset) { - addr = (Elf_Addr)tls + obj->tlsoffset; - memset((void*) (addr + obj->tlsinitsize), - 0, obj->tlssize - obj->tlsinitsize); - if (obj->tlsinit) - memcpy((void*) addr, obj->tlsinit, - obj->tlsinitsize); - dtv[obj->tlsindex + 1] = addr; - } else if (obj->tlsindex) { - dtv[obj->tlsindex + 1] = 0; - } - } - } - - return tls; -} - -void -free_tls(void *tls, size_t tcbsize, size_t tcbalign) -{ - size_t size; - Elf_Addr* dtv; - int dtvsize, i; - Elf_Addr tlsstart, tlsend; - - /* - * Figure out the size of the initial TLS block so that we can - * find stuff which __tls_get_addr() allocated dynamically. - */ - size = tls_static_space; - - dtv = ((Elf_Addr**)tls)[0]; - dtvsize = dtv[1]; - tlsstart = (Elf_Addr) tls; - tlsend = tlsstart + size; - for (i = 0; i < dtvsize; i++) { - if (dtv[i+2] < tlsstart || dtv[i+2] > tlsend) { - free((void*) dtv[i+2]); - } - } - - free((void*) tlsstart); -} - -#endif - -#if defined(__i386__) || defined(__amd64__) || defined(__sparc64__) || \ - defined(__arm__) - -/* - * Allocate Static TLS using the Variant II method. - */ -void * -allocate_tls(Obj_Entry *objs, void *oldtls, size_t tcbsize, size_t tcbalign) -{ - Obj_Entry *obj; - size_t size; - char *tls; - Elf_Addr *dtv, *olddtv; - Elf_Addr segbase, oldsegbase, addr; - int i; - - size = round(tls_static_space, tcbalign); - - assert(tcbsize >= 2*sizeof(Elf_Addr)); - tls = malloc(size + tcbsize); - dtv = malloc((tls_max_index + 2) * sizeof(Elf_Addr)); - - segbase = (Elf_Addr)(tls + size); - ((Elf_Addr*)segbase)[0] = segbase; - ((Elf_Addr*)segbase)[1] = (Elf_Addr) dtv; - - dtv[0] = tls_dtv_generation; - dtv[1] = tls_max_index; - - if (oldtls) { - /* - * Copy the static TLS block over whole. - */ - oldsegbase = (Elf_Addr) oldtls; - memcpy((void *)(segbase - tls_static_space), - (const void *)(oldsegbase - tls_static_space), - tls_static_space); - - /* - * If any dynamic TLS blocks have been created tls_get_addr(), - * move them over. - */ - olddtv = ((Elf_Addr**)oldsegbase)[1]; - for (i = 0; i < olddtv[1]; i++) { - if (olddtv[i+2] < oldsegbase - size || olddtv[i+2] > oldsegbase) { - dtv[i+2] = olddtv[i+2]; - olddtv[i+2] = 0; - } - } - - /* - * We assume that this block was the one we created with - * allocate_initial_tls(). - */ - free_tls(oldtls, 2*sizeof(Elf_Addr), sizeof(Elf_Addr)); - } else { - for (obj = objs; obj; obj = obj->next) { - if (obj->tlsoffset) { - addr = segbase - obj->tlsoffset; - memset((void*) (addr + obj->tlsinitsize), - 0, obj->tlssize - obj->tlsinitsize); - if (obj->tlsinit) - memcpy((void*) addr, obj->tlsinit, obj->tlsinitsize); - dtv[obj->tlsindex + 1] = addr; - } else if (obj->tlsindex) { - dtv[obj->tlsindex + 1] = 0; - } - } - } - - return (void*) segbase; -} - -void -free_tls(void *tls, size_t tcbsize, size_t tcbalign) -{ - size_t size; - Elf_Addr* dtv; - int dtvsize, i; - Elf_Addr tlsstart, tlsend; - - /* - * Figure out the size of the initial TLS block so that we can - * find stuff which ___tls_get_addr() allocated dynamically. - */ - size = round(tls_static_space, tcbalign); - - dtv = ((Elf_Addr**)tls)[1]; - dtvsize = dtv[1]; - tlsend = (Elf_Addr) tls; - tlsstart = tlsend - size; - for (i = 0; i < dtvsize; i++) { - if (dtv[i+2] < tlsstart || dtv[i+2] > tlsend) { - free((void*) dtv[i+2]); - } - } - - free((void*) tlsstart); -} - -#endif - -/* - * Allocate TLS block for module with given index. - */ -void * -allocate_module_tls(int index) -{ - Obj_Entry* obj; - char* p; - - for (obj = obj_list; obj; obj = obj->next) { - if (obj->tlsindex == index) - break; - } - if (!obj) { - _rtld_error("Can't find module with TLS index %d", index); - die(); - } - - p = malloc(obj->tlssize); - memcpy(p, obj->tlsinit, obj->tlsinitsize); - memset(p + obj->tlsinitsize, 0, obj->tlssize - obj->tlsinitsize); - - return p; -} - -bool -allocate_tls_offset(Obj_Entry *obj) -{ - size_t off; - - if (obj->tls_done) - return true; - - if (obj->tlssize == 0) { - obj->tls_done = true; - return true; - } - - if (obj->tlsindex == 1) - off = calculate_first_tls_offset(obj->tlssize, obj->tlsalign); - else - off = calculate_tls_offset(tls_last_offset, tls_last_size, - obj->tlssize, obj->tlsalign); - - /* - * If we have already fixed the size of the static TLS block, we - * must stay within that size. When allocating the static TLS, we - * leave a small amount of space spare to be used for dynamically - * loading modules which use static TLS. - */ - if (tls_static_space) { - if (calculate_tls_end(off, obj->tlssize) > tls_static_space) - return false; - } - - tls_last_offset = obj->tlsoffset = off; - tls_last_size = obj->tlssize; - obj->tls_done = true; - - return true; -} - -void * -_rtld_allocate_tls(void *oldtls, size_t tcbsize, size_t tcbalign) -{ - return allocate_tls(obj_list, oldtls, tcbsize, tcbalign); -} - -void -_rtld_free_tls(void *tcb, size_t tcbsize, size_t tcbalign) -{ - free_tls(tcb, tcbsize, tcbalign); -} - -#endif /* 0 */ diff --git a/dll/ntdll/ldr/ldrapi.c b/dll/ntdll/ldr/ldrapi.c index e08f4ca5ec8..a2f11f8a701 100644 --- a/dll/ntdll/ldr/ldrapi.c +++ b/dll/ntdll/ldr/ldrapi.c @@ -15,10 +15,22 @@ /* GLOBALS *******************************************************************/ +LIST_ENTRY LdrpUnloadHead; LONG LdrpLoaderLockAcquisitonCount; +BOOLEAN LdrpShowRecursiveLoads, LdrpBreakOnRecursiveDllLoads; +UNICODE_STRING LdrApiDefaultExtension = RTL_CONSTANT_STRING(L".DLL"); /* FUNCTIONS *****************************************************************/ +ULONG_PTR +FORCEINLINE +LdrpMakeCookie(VOID) +{ + /* Generate a cookie */ + return (((ULONG_PTR)NtCurrentTeb()->RealClientId.UniqueThread & 0xFFF) << 16) | + _InterlockedIncrement(&LdrpLoaderLockAcquisitonCount); +} + /* * @implemented */ @@ -32,19 +44,17 @@ LdrUnlockLoaderLock(IN ULONG Flags, DPRINT("LdrUnlockLoaderLock(%x %x)\n", Flags, Cookie); /* Check for valid flags */ - if (Flags & ~1) + if (Flags & ~LDR_UNLOCK_LOADER_LOCK_FLAG_RAISE_ON_ERRORS) { /* Flags are invalid, check how to fail */ - if (Flags & LDR_LOCK_LOADER_LOCK_FLAG_RAISE_ON_ERRORS) + if (Flags & LDR_UNLOCK_LOADER_LOCK_FLAG_RAISE_ON_ERRORS) { /* The caller wants us to raise status */ RtlRaiseStatus(STATUS_INVALID_PARAMETER_1); } - else - { - /* A normal failure */ - return STATUS_INVALID_PARAMETER_1; - } + + /* A normal failure */ + return STATUS_INVALID_PARAMETER_1; } /* If we don't have a cookie, just return */ @@ -57,20 +67,18 @@ LdrUnlockLoaderLock(IN ULONG Flags, DPRINT1("LdrUnlockLoaderLock() called with an invalid cookie!\n"); /* Invalid cookie, check how to fail */ - if (Flags & LDR_LOCK_LOADER_LOCK_FLAG_RAISE_ON_ERRORS) + if (Flags & LDR_UNLOCK_LOADER_LOCK_FLAG_RAISE_ON_ERRORS) { /* The caller wants us to raise status */ RtlRaiseStatus(STATUS_INVALID_PARAMETER_2); } - else - { - /* A normal failure */ - return STATUS_INVALID_PARAMETER_2; - } + + /* A normal failure */ + return STATUS_INVALID_PARAMETER_2; } /* Ready to release the lock */ - if (Flags & LDR_LOCK_LOADER_LOCK_FLAG_RAISE_ON_ERRORS) + if (Flags & LDR_UNLOCK_LOADER_LOCK_FLAG_RAISE_ON_ERRORS) { /* Do a direct leave */ RtlLeaveCriticalSection(&LdrpLoaderLock); @@ -101,17 +109,16 @@ LdrUnlockLoaderLock(IN ULONG Flags, NTSTATUS NTAPI LdrLockLoaderLock(IN ULONG Flags, - OUT PULONG Result OPTIONAL, - OUT PULONG Cookie OPTIONAL) + OUT PULONG Disposition OPTIONAL, + OUT PULONG_PTR Cookie OPTIONAL) { - LONG OldCount; NTSTATUS Status = STATUS_SUCCESS; BOOLEAN InInit = LdrpInLdrInit; - DPRINT("LdrLockLoaderLock(%x %p %p)\n", Flags, Result, Cookie); + DPRINT("LdrLockLoaderLock(%x %p %p)\n", Flags, Disposition, Cookie); /* Zero out the outputs */ - if (Result) *Result = 0; + if (Disposition) *Disposition = LDR_LOCK_LOADER_LOCK_DISPOSITION_INVALID; if (Cookie) *Cookie = 0; /* Validate the flags */ @@ -143,8 +150,11 @@ LdrLockLoaderLock(IN ULONG Flags, return STATUS_INVALID_PARAMETER_3; } + /* Do or Do Not. There is no Try */ + ASSERT((Disposition != NULL) || !(Flags & LDR_LOCK_LOADER_LOCK_FLAG_TRY_ONLY)); + /* If the flag is set, make sure we have a valid pointer to use */ - if ((Flags & LDR_LOCK_LOADER_LOCK_FLAG_TRY_ONLY) && !(Result)) + if ((Flags & LDR_LOCK_LOADER_LOCK_FLAG_TRY_ONLY) && !(Disposition)) { /* No pointer to return the data to */ if (Flags & LDR_LOCK_LOADER_LOCK_FLAG_RAISE_ON_ERRORS) @@ -170,13 +180,13 @@ LdrLockLoaderLock(IN ULONG Flags, if (!RtlTryEnterCriticalSection(&LdrpLoaderLock)) { /* It's locked */ - *Result = LDR_LOCK_LOADER_LOCK_DISPOSITION_LOCK_NOT_ACQUIRED; - goto Quickie; + *Disposition = LDR_LOCK_LOADER_LOCK_DISPOSITION_LOCK_NOT_ACQUIRED; } else { /* It worked */ - *Result = LDR_LOCK_LOADER_LOCK_DISPOSITION_LOCK_ACQUIRED; + *Disposition = LDR_LOCK_LOADER_LOCK_DISPOSITION_LOCK_ACQUIRED; + *Cookie = LdrpMakeCookie(); } } else @@ -185,14 +195,9 @@ LdrLockLoaderLock(IN ULONG Flags, RtlEnterCriticalSection(&LdrpLoaderLock); /* See if result was requested */ - if (Result) *Result = LDR_LOCK_LOADER_LOCK_DISPOSITION_LOCK_ACQUIRED; + if (Disposition) *Disposition = LDR_LOCK_LOADER_LOCK_DISPOSITION_LOCK_ACQUIRED; + *Cookie = LdrpMakeCookie(); } - - /* Increase the acquisition count */ - OldCount = _InterlockedIncrement(&LdrpLoaderLockAcquisitonCount); - - /* Generate a cookie */ - *Cookie = (((ULONG)NtCurrentTeb()->RealClientId.UniqueThread & 0xFFF) << 16) | OldCount; } else { @@ -206,13 +211,13 @@ LdrLockLoaderLock(IN ULONG Flags, if (!RtlTryEnterCriticalSection(&LdrpLoaderLock)) { /* It's locked */ - *Result = LDR_LOCK_LOADER_LOCK_DISPOSITION_LOCK_NOT_ACQUIRED; - _SEH2_YIELD(return STATUS_SUCCESS); + *Disposition = LDR_LOCK_LOADER_LOCK_DISPOSITION_LOCK_NOT_ACQUIRED; } else { /* It worked */ - *Result = LDR_LOCK_LOADER_LOCK_DISPOSITION_LOCK_ACQUIRED; + *Disposition = LDR_LOCK_LOADER_LOCK_DISPOSITION_LOCK_ACQUIRED; + *Cookie = LdrpMakeCookie(); } } else @@ -221,14 +226,9 @@ LdrLockLoaderLock(IN ULONG Flags, RtlEnterCriticalSection(&LdrpLoaderLock); /* See if result was requested */ - if (Result) *Result = LDR_LOCK_LOADER_LOCK_DISPOSITION_LOCK_ACQUIRED; + if (Disposition) *Disposition = LDR_LOCK_LOADER_LOCK_DISPOSITION_LOCK_ACQUIRED; + *Cookie = LdrpMakeCookie(); } - - /* Increase the acquisition count */ - OldCount = _InterlockedIncrement(&LdrpLoaderLockAcquisitonCount); - - /* Generate a cookie */ - *Cookie = (((ULONG)NtCurrentTeb()->RealClientId.UniqueThread & 0xFFF) << 16) | OldCount; } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { @@ -238,10 +238,530 @@ LdrLockLoaderLock(IN ULONG Flags, _SEH2_END; } -Quickie: + /* Return status */ return Status; } +/* + * @implemented + */ +NTSTATUS +NTAPI +LdrLoadDll(IN PWSTR SearchPath OPTIONAL, + IN PULONG DllCharacteristics OPTIONAL, + IN PUNICODE_STRING DllName, + OUT PVOID *BaseAddress) +{ + WCHAR StringBuffer[MAX_PATH]; + UNICODE_STRING DllString1, DllString2; + BOOLEAN RedirectedDll = FALSE; + NTSTATUS Status; + ULONG Cookie; + PUNICODE_STRING OldTldDll; + PTEB Teb = NtCurrentTeb(); + + /* Initialize the strings */ + RtlInitEmptyUnicodeString(&DllString2, NULL, 0); + DllString1.Buffer = StringBuffer; + DllString1.Length = 0; + DllString1.MaximumLength = sizeof(StringBuffer); + + /* Check if the SxS Assemblies specify another file */ + Status = RtlDosApplyFileIsolationRedirection_Ustr(TRUE, + DllName, + &LdrApiDefaultExtension, + &DllString1, + &DllString2, + &DllName, + NULL, + NULL, + NULL); + + /* Check success */ + if (NT_SUCCESS(Status)) + { + /* Let Ldrp know */ + RedirectedDll = TRUE; + } + else if (Status != STATUS_SXS_KEY_NOT_FOUND) + { + /* Unrecoverable SxS failure; did we get a string? */ + if (DllString2.Buffer) RtlFreeUnicodeString(&DllString2); + return Status; + } + + /* Lock the loader lock */ + LdrLockLoaderLock(LDR_LOCK_LOADER_LOCK_FLAG_RAISE_ON_ERRORS, NULL, &Cookie); + + /* Check if there's a TLD DLL being loaded */ + OldTldDll = LdrpTopLevelDllBeingLoaded; + if (OldTldDll) + { + /* This is a recursive load, do something about it? */ + if ((ShowSnaps) || (LdrpShowRecursiveLoads) || (LdrpBreakOnRecursiveDllLoads)) + { + /* Print out debug messages */ + DPRINT1("[%lx, %lx] LDR: Recursive DLL Load\n", + Teb->RealClientId.UniqueProcess, + Teb->RealClientId.UniqueThread); + DPRINT1("[%lx, %lx] Previous DLL being loaded \"%wZ\"\n", + Teb->RealClientId.UniqueProcess, + Teb->RealClientId.UniqueThread, + OldTldDll); + DPRINT1("[%lx, %lx] DLL being requested \"%wZ\"\n", + Teb->RealClientId.UniqueProcess, + Teb->RealClientId.UniqueThread, + DllName); + + /* Was it initializing too? */ + if (!LdrpCurrentDllInitializer) + { + DPRINT1("[%lx, %lx] LDR: No DLL Initializer was running\n", + Teb->RealClientId.UniqueProcess, + Teb->RealClientId.UniqueThread); + } + else + { + DPRINT1("[%lx, %lx] DLL whose initializer was currently running \"%wZ\"\n", + Teb->ClientId.UniqueProcess, + Teb->ClientId.UniqueThread, + &LdrpCurrentDllInitializer->BaseDllName); + } + } + } + + /* Set this one as the TLD DLL being loaded*/ + LdrpTopLevelDllBeingLoaded = DllName; + + /* Load the DLL */ + Status = LdrpLoadDll(RedirectedDll, + SearchPath, + DllCharacteristics, + DllName, + BaseAddress, + TRUE); + if (NT_SUCCESS(Status)) + { + Status = STATUS_SUCCESS; + } + else if ((Status != STATUS_NO_SUCH_FILE) && + (Status != STATUS_DLL_NOT_FOUND) && + (Status != STATUS_OBJECT_NAME_NOT_FOUND) && + (Status != STATUS_DLL_INIT_FAILED)) + { + // 85 == DPFLTR_LDR_ID; + DbgPrintEx(85, + DPFLTR_WARNING_LEVEL, + "LDR: %s - failing because LdrpLoadDll(%wZ) returned status %x\n", + __FUNCTION__, + DllName, + Status); + } + + /* Restore the old TLD DLL */ + LdrpTopLevelDllBeingLoaded = OldTldDll; + + /* Release the lock */ + LdrUnlockLoaderLock(LDR_LOCK_LOADER_LOCK_FLAG_RAISE_ON_ERRORS, Cookie); + + /* Do we have a redirect string? */ + if (DllString2.Buffer) RtlFreeUnicodeString(&DllString2); + + /* Return */ + return Status; +} + +/* + * @implemented + */ +NTSTATUS +NTAPI +LdrFindEntryForAddress(PVOID Address, + PLDR_DATA_TABLE_ENTRY *Module) +{ + PLIST_ENTRY ListHead, NextEntry; + PLDR_DATA_TABLE_ENTRY LdrEntry; + PIMAGE_NT_HEADERS NtHeader; + PPEB_LDR_DATA Ldr = NtCurrentPeb()->Ldr; + ULONG_PTR DllBase, DllEnd; + + DPRINT("LdrFindEntryForAddress(Address %p)\n", Address); + + /* Nothing to do */ + if (!Ldr) return STATUS_NO_MORE_ENTRIES; + + /* Get the current entry */ + LdrEntry = Ldr->EntryInProgress; + if (LdrEntry) + { + /* Get the NT Headers */ + NtHeader = RtlImageNtHeader(LdrEntry->DllBase); + if (NtHeader) + { + /* Get the Image Base */ + DllBase = (ULONG_PTR)LdrEntry->DllBase; + DllEnd = DllBase + NtHeader->OptionalHeader.SizeOfImage; + + /* Check if they match */ + if (((ULONG_PTR)Address >= DllBase) && + ((ULONG_PTR)Address < DllEnd)) + { + /* Return it */ + *Module = LdrEntry; + return STATUS_SUCCESS; + } + } + } + + /* Loop the module list */ + ListHead = &Ldr->InMemoryOrderModuleList; + NextEntry = ListHead->Flink; + while (NextEntry != ListHead) + { + /* Get the entry and NT Headers */ + LdrEntry = CONTAINING_RECORD(NextEntry, LDR_DATA_TABLE_ENTRY, InMemoryOrderModuleList); + NtHeader = RtlImageNtHeader(LdrEntry->DllBase); + if (NtHeader) + { + /* Get the Image Base */ + DllBase = (ULONG_PTR)LdrEntry->DllBase; + DllEnd = DllBase + NtHeader->OptionalHeader.SizeOfImage; + + /* Check if they match */ + if (((ULONG_PTR)Address >= DllBase) && + ((ULONG_PTR)Address < DllEnd)) + { + /* Return it */ + *Module = LdrEntry; + return STATUS_SUCCESS; + } + + /* Next Entry */ + NextEntry = NextEntry->Flink; + } + } + + /* Nothing found */ + // 85 == DPFLTR_LDR_ID; + DbgPrintEx(85, DPFLTR_WARNING_LEVEL, "LDR: %s() exiting 0x%08lx\n", __FUNCTION__, STATUS_NO_MORE_ENTRIES); + return STATUS_NO_MORE_ENTRIES; +} + +/* + * @implemented + */ +NTSTATUS +NTAPI +LdrGetDllHandleEx(IN ULONG Flags, + IN PWSTR DllPath OPTIONAL, + IN PULONG DllCharacteristics OPTIONAL, + IN PUNICODE_STRING DllName, + OUT PVOID *DllHandle OPTIONAL) +{ + NTSTATUS Status; + PLDR_DATA_TABLE_ENTRY LdrEntry; + UNICODE_STRING RedirectName, DllString1, RawDllName; + PUNICODE_STRING pRedirectName, CompareName; + PWCHAR p1, p2, p3; + BOOLEAN Locked, RedirectedDll; + ULONG_PTR Cookie; + ULONG LoadFlag, Length; + + /* Initialize the strings */ + RtlInitEmptyUnicodeString(&DllString1, NULL, 0); + RtlInitEmptyUnicodeString(&RawDllName, NULL, 0); + RedirectName = *DllName; + pRedirectName = &RedirectName; + + /* Initialize state */ + RedirectedDll = Locked = FALSE; + LdrEntry = NULL; + Cookie = 0; + + /* Clear the handle */ + if (DllHandle) *DllHandle = NULL; + + /* Check for a valid flag combination */ + if ((Flags & ~(LDR_GET_DLL_HANDLE_EX_PIN | LDR_GET_DLL_HANDLE_EX_UNCHANGED_REFCOUNT)) || + (!DllHandle && !(Flags & LDR_GET_DLL_HANDLE_EX_PIN))) + { + DPRINT1("Flags are invalid or no DllHandle given\n"); + Status = STATUS_INVALID_PARAMETER; + goto Quickie; + } + + /* If not initializing */ + if (!LdrpInLdrInit) + { + /* Acquire the lock */ + Status = LdrLockLoaderLock(0, NULL, &Cookie); + if (!NT_SUCCESS(Status)) goto Quickie; + + /* Remember we own it */ + Locked = TRUE; + } + + /* Check if the SxS Assemblies specify another file */ + Status = RtlDosApplyFileIsolationRedirection_Ustr(TRUE, + pRedirectName, + &LdrApiDefaultExtension, + NULL, + &DllString1, + &pRedirectName, + NULL, + NULL, + NULL); + + /* Check success */ + if (NT_SUCCESS(Status)) + { + /* Let Ldrp know */ + RedirectedDll = TRUE; + } + else if (Status != STATUS_SXS_KEY_NOT_FOUND) + { + /* Unrecoverable SxS failure; */ + goto Quickie; + } + else + { + ASSERT(pRedirectName == &RedirectName); + } + + /* Set default failure code */ + Status = STATUS_DLL_NOT_FOUND; + + /* Use the cache if we can */ + if (LdrpGetModuleHandleCache) + { + /* Check if we were redirected */ + if (RedirectedDll) + { + /* Check the flag */ + if (!(LdrpGetModuleHandleCache->Flags & LDRP_REDIRECTED)) + { + goto DontCompare; + } + + /* Use the right name */ + CompareName = &LdrpGetModuleHandleCache->FullDllName; + } + else + { + /* Check the flag */ + if (LdrpGetModuleHandleCache->Flags & LDRP_REDIRECTED) + { + goto DontCompare; + } + + /* Use the right name */ + CompareName = &LdrpGetModuleHandleCache->BaseDllName; + } + + /* Check if the name matches */ + if (RtlEqualUnicodeString(pRedirectName, + CompareName, + TRUE)) + { + /* Skip the rest */ + LdrEntry = LdrpGetModuleHandleCache; + + /* Return success */ + Status = STATUS_SUCCESS; + goto Quickie; + } + } + +DontCompare: + /* Find the name without the extension */ + p1 = pRedirectName->Buffer; + p2 = NULL; + p3 = &p1[pRedirectName->Length / sizeof(WCHAR)]; + while (p1 != p3) + { + if (*p1++ == L'.') + { + p2 = p1; + } + else if (*p1 == L'\\') + { + p2 = NULL; + } + } + + /* Check if no extension was found or if we got a slash */ + if (!(p2) || (*p2 == L'\\') || (*p2 == L'/')) + { + /* Check that we have space to add one */ + Length = pRedirectName->Length + + LdrApiDefaultExtension.Length + sizeof(UNICODE_NULL); + if (Length >= UNICODE_STRING_MAX_BYTES) + { + /* No space to add the extension */ + Status = STATUS_NAME_TOO_LONG; + goto Quickie; + } + + /* Setup the string */ + RawDllName.MaximumLength = Length; + ASSERT(Length >= sizeof(UNICODE_NULL)); + RawDllName.Buffer = RtlAllocateHeap(RtlGetProcessHeap(), + 0, + RawDllName.MaximumLength); + if (!RawDllName.Buffer) + { + Status = STATUS_NO_MEMORY; + goto Quickie; + } + + /* Copy the string and add extension */ + RtlCopyUnicodeString(&RawDllName, pRedirectName); + RtlAppendUnicodeStringToString(&RawDllName, &LdrApiDefaultExtension); + } + else + { + /* Check if there's something in the name */ + Length = pRedirectName->Length; + if (Length) + { + /* Check and remove trailing period */ + if (pRedirectName->Buffer[Length / sizeof(WCHAR) - sizeof(ANSI_NULL)] == '.') + { + /* Decrease the size */ + pRedirectName->Length -= sizeof(WCHAR); + } + } + + /* Setup the string */ + RawDllName.MaximumLength = pRedirectName->Length + sizeof(WCHAR); + RawDllName.Buffer = RtlAllocateHeap(RtlGetProcessHeap(), + 0, + RawDllName.MaximumLength); + if (!RawDllName.Buffer) + { + Status = STATUS_NO_MEMORY; + goto Quickie; + } + + /* Copy the string */ + RtlCopyUnicodeString(&RawDllName, pRedirectName); + } + + /* Display debug string */ + if (ShowSnaps) + { + DPRINT1("LDR: LdrGetDllHandleEx, searching for %wZ from %ws\n", + &RawDllName, + DllPath ? ((ULONG_PTR)DllPath == 1 ? L"" : DllPath) : L""); + } + + /* Do the lookup */ + if (LdrpCheckForLoadedDll(DllPath, + &RawDllName, + ((ULONG_PTR)DllPath == 1) ? TRUE : FALSE, + RedirectedDll, + &LdrEntry)) + { + /* Update cached entry */ + LdrpGetModuleHandleCache = LdrEntry; + + /* Return success */ + Status = STATUS_SUCCESS; + } + else + { + /* Make sure to NULL this */ + LdrEntry = NULL; + } +Quickie: + /* The success path must have a valid loader entry */ + ASSERT((LdrEntry != NULL) == NT_SUCCESS(Status)); + + /* Check if we got an entry and success */ + DPRINT("Got LdrEntry->BaseDllName %wZ\n", LdrEntry ? &LdrEntry->BaseDllName : NULL); + if ((LdrEntry) && (NT_SUCCESS(Status))) + { + /* Check if the DLL is locked */ + if ((LdrEntry->LoadCount != 0xFFFF) && + !(Flags & LDR_GET_DLL_HANDLE_EX_UNCHANGED_REFCOUNT)) + { + /* Check what to do with the load count */ + if (Flags & LDR_GET_DLL_HANDLE_EX_PIN) + { + /* Pin it */ + LdrEntry->LoadCount = 0xFFFF; + LoadFlag = LDRP_UPDATE_PIN; + } + else + { + /* Increase the load count */ + LdrEntry->LoadCount++; + LoadFlag = LDRP_UPDATE_REFCOUNT; + } + + /* Update the load count now */ + LdrpUpdateLoadCount2(LdrEntry, LoadFlag); + LdrpClearLoadInProgress(); + } + + /* Check if the caller is requesting the handle */ + if (DllHandle) *DllHandle = LdrEntry->DllBase; + } + + /* Free string if needed */ + if (DllString1.Buffer) RtlFreeUnicodeString(&DllString1); + + /* Free the raw DLL Name if needed */ + if (RawDllName.Buffer) + { + /* Free the heap-allocated buffer */ + RtlFreeHeap(RtlGetProcessHeap(), 0, RawDllName.Buffer); + RawDllName.Buffer = NULL; + } + + /* Release lock */ + if (Locked) + { + LdrUnlockLoaderLock(LDR_LOCK_LOADER_LOCK_FLAG_RAISE_ON_ERRORS, + Cookie); + } + + /* Return */ + return Status; +} + +/* + * @implemented + */ +NTSTATUS +NTAPI +LdrGetDllHandle(IN PWSTR DllPath OPTIONAL, + IN PULONG DllCharacteristics OPTIONAL, + IN PUNICODE_STRING DllName, + OUT PVOID *DllHandle) +{ + /* Call the newer API */ + return LdrGetDllHandleEx(LDR_GET_DLL_HANDLE_EX_UNCHANGED_REFCOUNT, + DllPath, + DllCharacteristics, + DllName, + DllHandle); +} + +/* + * @implemented + */ +NTSTATUS +NTAPI +LdrGetProcedureAddress(IN PVOID BaseAddress, + IN PANSI_STRING Name, + IN ULONG Ordinal, + OUT PVOID *ProcedureAddress) +{ + /* Call the internal routine and tell it to execute DllInit */ + return LdrpGetProcedureAddress(BaseAddress, Name, Ordinal, ProcedureAddress, TRUE); +} + /* * @implemented */ @@ -258,15 +778,17 @@ LdrVerifyImageMatchesChecksum(IN HANDLE FileHandle, IO_STATUS_BLOCK IoStatusBlock; PIMAGE_NT_HEADERS NtHeader; HANDLE SectionHandle; - SIZE_T ViewSize = 0; - PVOID ViewBase = NULL; - BOOLEAN Result; + SIZE_T ViewSize; + PVOID ViewBase; + BOOLEAN Result, NoActualCheck; NTSTATUS Status; PVOID ImportName; ULONG Size; - DPRINT("LdrVerifyImageMatchesChecksum() called\n"); + /* If the handle has the magic KnownDll flag, skip actual checksums */ + NoActualCheck = ((ULONG_PTR)FileHandle & 1); + /* Create the section */ Status = NtCreateSection(&SectionHandle, SECTION_MAP_EXECUTE, @@ -282,6 +804,8 @@ LdrVerifyImageMatchesChecksum(IN HANDLE FileHandle, } /* Map the section */ + ViewSize = 0; + ViewBase = NULL; Status = NtMapViewOfSection(SectionHandle, NtCurrentProcess(), &ViewBase, @@ -316,13 +840,22 @@ LdrVerifyImageMatchesChecksum(IN HANDLE FileHandle, /* Protect with SEH */ _SEH2_TRY { - /* Verify the checksum */ - Result = LdrVerifyMappedImageMatchesChecksum(ViewBase, - ViewSize, - FileStandardInfo.EndOfFile.LowPart); + /* Check if this is the KnownDll hack */ + if (NoActualCheck) + { + /* Don't actually do it */ + Result = TRUE; + } + else + { + /* Verify the checksum */ + Result = LdrVerifyMappedImageMatchesChecksum(ViewBase, + FileStandardInfo.EndOfFile.LowPart, + FileStandardInfo.EndOfFile.LowPart); + } /* Check if a callback was supplied */ - if (Result && Callback) + if ((Result) && (Callback)) { /* Get the NT Header */ NtHeader = RtlImageNtHeader(ViewBase); @@ -371,24 +904,9 @@ LdrVerifyImageMatchesChecksum(IN HANDLE FileHandle, NtClose(SectionHandle); /* Return status */ - return !Result ? STATUS_IMAGE_CHECKSUM_MISMATCH : Status; + return Result ? Status : STATUS_IMAGE_CHECKSUM_MISMATCH; } -/* - * @implemented - */ -NTSTATUS -NTAPI -LdrGetProcedureAddress_(IN PVOID BaseAddress, - IN PANSI_STRING Name, - IN ULONG Ordinal, - OUT PVOID *ProcedureAddress) -{ - /* Call the internal routine and tell it to execute DllInit */ - return LdrpGetProcedureAddress(BaseAddress, Name, Ordinal, ProcedureAddress, TRUE); -} - - NTSTATUS NTAPI LdrQueryProcessModuleInformationEx(IN ULONG ProcessId, @@ -527,9 +1045,14 @@ LdrQueryProcessModuleInformation(IN PRTL_PROCESS_MODULES ModuleInformation, return LdrQueryProcessModuleInformationEx(0, 0, ModuleInformation, Size, ReturnedSize); } +/* + * @implemented + */ NTSTATUS NTAPI -LdrEnumerateLoadedModules(BOOLEAN ReservedFlag, PLDR_ENUM_CALLBACK EnumProc, PVOID Context) +LdrEnumerateLoadedModules(IN BOOLEAN ReservedFlag, + IN PLDR_ENUM_CALLBACK EnumProc, + IN PVOID Context) { PLIST_ENTRY ListHead, ListEntry; PLDR_DATA_TABLE_ENTRY LdrEntry; @@ -538,7 +1061,7 @@ LdrEnumerateLoadedModules(BOOLEAN ReservedFlag, PLDR_ENUM_CALLBACK EnumProc, PVO BOOLEAN Stop = FALSE; /* Check parameters */ - if (ReservedFlag || !EnumProc) return STATUS_INVALID_PARAMETER; + if ((ReservedFlag) || !(EnumProc)) return STATUS_INVALID_PARAMETER; /* Acquire the loader lock */ Status = LdrLockLoaderLock(0, NULL, &Cookie); @@ -589,4 +1112,439 @@ LdrEnumerateLoadedModules(BOOLEAN ReservedFlag, PLDR_ENUM_CALLBACK EnumProc, PVO return STATUS_SUCCESS; } +/* + * @implemented + */ +NTSTATUS +NTAPI +LdrDisableThreadCalloutsForDll(IN PVOID BaseAddress) +{ + PLDR_DATA_TABLE_ENTRY LdrEntry; + NTSTATUS Status; + BOOLEAN LockHeld; + ULONG_PTR Cookie; + DPRINT("LdrDisableThreadCalloutsForDll (BaseAddress %p)\n", BaseAddress); + + /* Don't do it during shutdown */ + if (LdrpShutdownInProgress) return STATUS_SUCCESS; + + /* Check if we should grab the lock */ + LockHeld = FALSE; + if (!LdrpInLdrInit) + { + /* Grab the lock */ + Status = LdrLockLoaderLock(0, NULL, &Cookie); + if (!NT_SUCCESS(Status)) return Status; + LockHeld = TRUE; + } + + /* Make sure the DLL is valid and get its entry */ + Status = STATUS_DLL_NOT_FOUND; + if (LdrpCheckForLoadedDllHandle(BaseAddress, &LdrEntry)) + { + /* Get if it has a TLS slot */ + if (!LdrEntry->TlsIndex) + { + /* It doesn't, so you're allowed to call this */ + LdrEntry->Flags |= LDRP_DONT_CALL_FOR_THREADS; + Status = STATUS_SUCCESS; + } + } + + /* Check if the lock was held */ + if (LockHeld) + { + /* Release it */ + LdrUnlockLoaderLock(LDR_UNLOCK_LOADER_LOCK_FLAG_RAISE_ON_ERRORS, Cookie); + } + + /* Return the status */ + return Status; +} + +/* + * @implemented + */ +NTSTATUS +NTAPI +LdrAddRefDll(IN ULONG Flags, + IN PVOID BaseAddress) +{ + PLDR_DATA_TABLE_ENTRY LdrEntry; + NTSTATUS Status = STATUS_SUCCESS; + ULONG Cookie; + BOOLEAN Locked = FALSE; + + /* Check for invalid flags */ + if (Flags & ~(LDR_ADDREF_DLL_PIN)) + { + /* Fail with invalid parameter status if so */ + Status = STATUS_INVALID_PARAMETER; + goto quickie; + } + + /* Acquire the loader lock if not in init phase */ + if (!LdrpInLdrInit) + { + /* Acquire the lock */ + Status = LdrLockLoaderLock(0, NULL, &Cookie); + if (!NT_SUCCESS(Status)) goto quickie; + Locked = TRUE; + } + + /* Get this module's data table entry */ + if (LdrpCheckForLoadedDllHandle(BaseAddress, &LdrEntry)) + { + if (!LdrEntry) + { + /* Shouldn't happen */ + Status = STATUS_INTERNAL_ERROR; + goto quickie; + } + + /* If this is not a pinned module */ + if (LdrEntry->LoadCount != 0xFFFF) + { + /* Update its load count */ + if (Flags & LDR_ADDREF_DLL_PIN) + { + /* Pin it by setting load count to -1 */ + LdrEntry->LoadCount = 0xFFFF; + LdrpUpdateLoadCount2(LdrEntry, LDRP_UPDATE_PIN); + } + else + { + /* Increase its load count by one */ + LdrEntry->LoadCount++; + LdrpUpdateLoadCount2(LdrEntry, LDRP_UPDATE_REFCOUNT); + } + + /* Clear load in progress */ + LdrpClearLoadInProgress(); + } + } + else + { + /* There was an error getting this module's handle, return invalid param status */ + Status = STATUS_INVALID_PARAMETER; + } + +quickie: + /* Check for error case */ + if (!NT_SUCCESS(Status)) + { + /* Print debug information */ + if ((ShowSnaps) || ((Status != STATUS_NO_SUCH_FILE) && + (Status != STATUS_DLL_NOT_FOUND) && + (Status != STATUS_OBJECT_NAME_NOT_FOUND))) + { + DPRINT1("LDR: LdrAddRefDll(%p) 0x%08lx\n", BaseAddress); + } + } + + /* Release the lock if needed */ + if (Locked) LdrUnlockLoaderLock(LDR_LOCK_LOADER_LOCK_FLAG_RAISE_ON_ERRORS, Cookie); + return Status; +} + +/* + * @implemented + */ +NTSTATUS +NTAPI +LdrUnloadDll(IN PVOID BaseAddress) +{ + NTSTATUS Status = STATUS_SUCCESS; + PPEB Peb = NtCurrentPeb(); + PLDR_DATA_TABLE_ENTRY LdrEntry, CurrentEntry; + PVOID EntryPoint; + PLIST_ENTRY NextEntry; + LIST_ENTRY UnloadList; + RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED ActCtx; + PVOID CorImageData; + ULONG ComSectionSize; + + /* Get the LDR Lock */ + if (!LdrpInLdrInit) RtlEnterCriticalSection(Peb->LoaderLock); + + /* Increase the unload count */ + LdrpActiveUnloadCount++; + + /* Skip unload */ + if (LdrpShutdownInProgress) goto Quickie; + + /* Make sure the DLL is valid and get its entry */ + if (!LdrpCheckForLoadedDllHandle(BaseAddress, &LdrEntry)) + { + Status = STATUS_DLL_NOT_FOUND; + goto Quickie; + } + + /* Check the current Load Count */ + if (LdrEntry->LoadCount != 0xFFFF) + { + /* Decrease it */ + LdrEntry->LoadCount--; + + /* If it's a dll */ + if (LdrEntry->Flags & LDRP_IMAGE_DLL) + { + /* Set up the Act Ctx */ + ActCtx.Size = sizeof(ActCtx); + ActCtx.Format = RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_FORMAT_WHISTLER; + RtlZeroMemory(&ActCtx.Frame, sizeof(RTL_ACTIVATION_CONTEXT_STACK_FRAME)); + + /* Activate the ActCtx */ + RtlActivateActivationContextUnsafeFast(&ActCtx, + LdrEntry->EntryPointActivationContext); + + /* Update the load count */ + LdrpUpdateLoadCount2(LdrEntry, LDRP_UPDATE_DEREFCOUNT); + + /* Release the context */ + RtlDeactivateActivationContextUnsafeFast(&ActCtx); + } + } + else + { + /* The DLL is locked */ + goto Quickie; + } + + /* Show debug message */ + if (ShowSnaps) DPRINT1("LDR: UNINIT LIST\n"); + + /* Check if this is our only unload and initialize the list if so */ + if (LdrpActiveUnloadCount == 1) InitializeListHead(&LdrpUnloadHead); + + /* Loop the modules to build the list */ + NextEntry = Peb->Ldr->InInitializationOrderModuleList.Blink; + while (NextEntry != &Peb->Ldr->InInitializationOrderModuleList) + { + /* Get the entry */ + LdrEntry = CONTAINING_RECORD(NextEntry, + LDR_DATA_TABLE_ENTRY, + InInitializationOrderModuleList); + NextEntry = NextEntry->Blink; + + /* Remove flag */ + LdrEntry->Flags &= ~LDRP_UNLOAD_IN_PROGRESS; + + /* If the load count is now 0 */ + if (!LdrEntry->LoadCount) + { + /* Show message */ + if (ShowSnaps) + { + DPRINT1("(%d) [%ws] %ws (%lx) deinit %lx\n", + LdrpActiveUnloadCount, + LdrEntry->BaseDllName.Buffer, + LdrEntry->FullDllName.Buffer, + (ULONG)LdrEntry->LoadCount, + LdrEntry->EntryPoint); + } + + /* FIXME: Call Shim Engine and notify */ + + /* Unlink it */ + CurrentEntry = LdrEntry; + RemoveEntryList(&CurrentEntry->InInitializationOrderModuleList); + RemoveEntryList(&CurrentEntry->InMemoryOrderModuleList); + RemoveEntryList(&CurrentEntry->HashLinks); + + /* If there's more then one active unload */ + if (LdrpActiveUnloadCount > 1) + { + /* Flush the cached DLL handle and clear the list */ + LdrpLoadedDllHandleCache = NULL; + CurrentEntry->InMemoryOrderModuleList.Flink = NULL; + } + + /* Add the entry on the unload list */ + InsertTailList(&LdrpUnloadHead, &CurrentEntry->HashLinks); + } + } + + /* Only call the entrypoints once */ + if (LdrpActiveUnloadCount > 1) goto Quickie; + + /* Now loop the unload list and create our own */ + InitializeListHead(&UnloadList); + CurrentEntry = NULL; + NextEntry = LdrpUnloadHead.Flink; + while (NextEntry != &LdrpUnloadHead) + { + /* If we have an active entry */ + if (CurrentEntry) + { + /* Remove it */ + RemoveEntryList(&CurrentEntry->InLoadOrderLinks); + CurrentEntry = NULL; + + /* Reset list pointers */ + NextEntry = LdrpUnloadHead.Flink; + if (NextEntry == &LdrpUnloadHead) break; + } + + /* Get the current entry */ + LdrEntry = CONTAINING_RECORD(NextEntry, LDR_DATA_TABLE_ENTRY, HashLinks); + + /* FIXME: Log the Unload Event */ + //LdrpRecordUnloadEvent(LdrEntry); + + /* Set the entry and clear it from the list */ + CurrentEntry = LdrEntry; + LdrpLoadedDllHandleCache = NULL; + CurrentEntry->InMemoryOrderModuleList.Flink = NULL; + + /* Move it from the global to the local list */ + RemoveEntryList(&CurrentEntry->HashLinks); + InsertTailList(&UnloadList, &CurrentEntry->HashLinks); + + /* Get the entrypoint */ + EntryPoint = LdrEntry->EntryPoint; + + /* Check if we should call it */ + if ((EntryPoint) && (LdrEntry->Flags & LDRP_PROCESS_ATTACH_CALLED)) + { + /* Show message */ + if (ShowSnaps) + { + DPRINT1("LDR: Calling deinit %lx\n", EntryPoint); + } + + /* Set up the Act Ctx */ + ActCtx.Size = sizeof(ActCtx); + ActCtx.Format = RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_FORMAT_WHISTLER; + RtlZeroMemory(&ActCtx.Frame, sizeof(RTL_ACTIVATION_CONTEXT_STACK_FRAME)); + + /* Activate the ActCtx */ + RtlActivateActivationContextUnsafeFast(&ActCtx, + LdrEntry->EntryPointActivationContext); + + /* Call the entrypoint */ + LdrpCallInitRoutine(LdrEntry->EntryPoint, + LdrEntry->DllBase, + DLL_PROCESS_DETACH, + NULL); + + /* Release the context */ + RtlDeactivateActivationContextUnsafeFast(&ActCtx); + } + + /* Remove it from the list */ + RemoveEntryList(&CurrentEntry->InLoadOrderLinks); + CurrentEntry = NULL; + NextEntry = LdrpUnloadHead.Flink; + } + + /* Now loop our local list */ + NextEntry = UnloadList.Flink; + while (NextEntry != &UnloadList) + { + /* Get the entry */ + LdrEntry = CONTAINING_RECORD(NextEntry, LDR_DATA_TABLE_ENTRY, HashLinks); + NextEntry = NextEntry->Flink; + CurrentEntry = LdrEntry; + + /* Notify Application Verifier */ + if (Peb->NtGlobalFlag & FLG_HEAP_ENABLE_TAIL_CHECK) + { + DPRINT1("We don't support Application Verifier yet\n"); + } + + /* Show message */ + if (ShowSnaps) + { + DPRINT1("LDR: Unmapping [%ws]\n", LdrEntry->BaseDllName.Buffer); + } + + /* Check if this is a .NET executable */ + CorImageData = RtlImageDirectoryEntryToData(LdrEntry->DllBase, + TRUE, + IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR, + &ComSectionSize); + if (CorImageData) + { + /* FIXME */ + DPRINT1(".NET Images are not supported yet\n"); + } + + /* Check if we should unmap*/ + if (!(CurrentEntry->Flags & LDR_COR_OWNS_UNMAP)) + { + /* Unmap the DLL */ + Status = NtUnmapViewOfSection(NtCurrentProcess(), + CurrentEntry->DllBase); + ASSERT(NT_SUCCESS(Status)); + } + + /* Unload the alternate resource module, if any */ + LdrUnloadAlternateResourceModule(CurrentEntry->DllBase); + + /* FIXME: Send shutdown notification */ + //LdrpSendDllNotifications(CurrentEntry, 2, LdrpShutdownInProgress); + + /* Check if a Hotpatch is active */ + if (LdrEntry->PatchInformation) + { + /* FIXME */ + DPRINT1("We don't support Hotpatching yet\n"); + } + + /* Deallocate the Entry */ + LdrpFinalizeAndDeallocateDataTableEntry(CurrentEntry); + + /* If this is the cached entry, invalidate it */ + if (LdrpGetModuleHandleCache == CurrentEntry) + { + LdrpGetModuleHandleCache = NULL; + } + } + +Quickie: + /* Decrease unload count */ + LdrpActiveUnloadCount--; + if (!LdrpInLdrInit) RtlLeaveCriticalSection(Peb->LoaderLock); + + /* Return to caller */ + return Status; +} + +/* + * @implemented + */ +BOOLEAN +NTAPI +RtlDllShutdownInProgress(VOID) +{ + /* Return the internal global */ + return LdrpShutdownInProgress; +} + +/* + * @implemented + */ +PIMAGE_BASE_RELOCATION +NTAPI +LdrProcessRelocationBlock(IN ULONG_PTR Address, + IN ULONG Count, + IN PUSHORT TypeOffset, + IN LONG_PTR Delta) +{ + return LdrProcessRelocationBlockLongLong(Address, Count, TypeOffset, Delta); +} + +/* + * @unimplemented + */ +BOOLEAN +NTAPI +LdrUnloadAlternateResourceModule(IN PVOID BaseAddress) +{ + static BOOLEAN WarnedOnce = FALSE; + if (WarnedOnce == FALSE) { UNIMPLEMENTED; WarnedOnce = TRUE; } + return FALSE; +} + /* EOF */ diff --git a/dll/ntdll/ldr/ldrinit.c b/dll/ntdll/ldr/ldrinit.c index 6b08bed65dd..30b6d93f62a 100644 --- a/dll/ntdll/ldr/ldrinit.c +++ b/dll/ntdll/ldr/ldrinit.c @@ -10,9 +10,12 @@ /* INCLUDES *****************************************************************/ #include +#include + #define NDEBUG #include + /* GLOBALS *******************************************************************/ HKEY ImageExecOptionsKey; @@ -25,11 +28,14 @@ BOOLEAN LdrpInLdrInit; LONG LdrpProcessInitialized; BOOLEAN LdrpLoaderLockInit; BOOLEAN LdrpLdrDatabaseIsSetup; +BOOLEAN LdrpShutdownInProgress; +HANDLE LdrpShutdownThreadId; BOOLEAN LdrpDllValidation; PLDR_DATA_TABLE_ENTRY LdrpImageEntry; PUNICODE_STRING LdrpTopLevelDllBeingLoaded; +WCHAR StringBuffer[156]; extern PTEB LdrpTopLevelDllBeingLoadedTeb; // defined in rtlsupp.c! PLDR_DATA_TABLE_ENTRY LdrpCurrentDllInitializer; PLDR_DATA_TABLE_ENTRY LdrpNtDllDataTableEntry; @@ -68,6 +74,7 @@ RTL_CRITICAL_SECTION FastPebLock; BOOLEAN ShowSnaps; ULONG LdrpFatalHardErrorCount; +ULONG LdrpActiveUnloadCount; //extern LIST_ENTRY RtlCriticalSectionList; @@ -77,11 +84,16 @@ VOID RtlInitializeHeapManager(VOID); extern BOOLEAN RtlpPageHeapEnabled; extern ULONG RtlpDphGlobalFlags; -NTSTATUS LdrPerformRelocations(PIMAGE_NT_HEADERS NTHeaders, PVOID ImageBase); -NTSTATUS NTAPI -LdrpInitializeProcess_(PCONTEXT Context, - PVOID SystemArgument1); +ULONG RtlpDisableHeapLookaside; // TODO: Move to heap.c +ULONG RtlpShutdownProcessFlags; // TODO: Use it +NTSTATUS LdrPerformRelocations(PIMAGE_NT_HEADERS NTHeaders, PVOID ImageBase); + +#ifdef _WIN64 +#define DEFAULT_SECURITY_COOKIE 0x00002B992DDFA232ll +#else +#define DEFAULT_SECURITY_COOKIE 0xBB40E64E +#endif /* FUNCTIONS *****************************************************************/ @@ -414,8 +426,7 @@ LdrpFetchAddressOfSecurityCookie(PVOID BaseAddress, ULONG SizeOfImage) Cookie = (PVOID)ConfigDir->SecurityCookie; /* Check this cookie */ - if (Cookie == NULL || - (PCHAR)Cookie <= (PCHAR)BaseAddress || + if ((PCHAR)Cookie <= (PCHAR)BaseAddress || (PCHAR)Cookie >= (PCHAR)BaseAddress + SizeOfImage) { Cookie = NULL; @@ -429,20 +440,178 @@ PVOID NTAPI LdrpInitSecurityCookie(PLDR_DATA_TABLE_ENTRY LdrEntry) { - PVOID Cookie; + PULONG_PTR Cookie; + LARGE_INTEGER Counter; + //ULONG NewCookie; /* Fetch address of the cookie */ Cookie = LdrpFetchAddressOfSecurityCookie(LdrEntry->DllBase, LdrEntry->SizeOfImage); if (Cookie) { - UNIMPLEMENTED; - Cookie = NULL; + /* Check if it's a default one */ + if (*Cookie == DEFAULT_SECURITY_COOKIE || + *Cookie == 0xBB40) + { + /* We need to initialize it */ + + NtQueryPerformanceCounter(&Counter, NULL); +#if 0 + GetSystemTimeAsFileTime (&systime.ft_struct); +#ifdef _WIN64 + cookie = systime.ft_scalar; +#else + cookie = systime.ft_struct.dwLowDateTime; + cookie ^= systime.ft_struct.dwHighDateTime; +#endif + + cookie ^= GetCurrentProcessId (); + cookie ^= GetCurrentThreadId (); + cookie ^= GetTickCount (); + + QueryPerformanceCounter (&perfctr); +#ifdef _WIN64 + cookie ^= perfctr.QuadPart; +#else + cookie ^= perfctr.LowPart; + cookie ^= perfctr.HighPart; +#endif + +#ifdef _WIN64 + cookie &= 0x0000ffffffffffffll; +#endif +#endif + *Cookie = Counter.LowPart; + + //Cookie = NULL; + } } return Cookie; } +VOID +NTAPI +LdrpInitializeThread(IN PCONTEXT Context) +{ + PPEB Peb = NtCurrentPeb(); + PLDR_DATA_TABLE_ENTRY LdrEntry; + PLIST_ENTRY NextEntry, ListHead; + RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED ActCtx; + NTSTATUS Status; + PVOID EntryPoint; + + DPRINT("LdrpInitializeThread() called for %wZ\n", + &LdrpImageEntry->BaseDllName); + + /* Allocate an Activation Context Stack */ + /* FIXME: This is a hack for Wine's actctx stuff */ + DPRINT("ActivationContextStack %p\n", NtCurrentTeb()->ActivationContextStackPointer); + if (!(NtCurrentTeb()->ActivationContextStackPointer)) + { + Status = RtlAllocateActivationContextStack((PVOID*)&NtCurrentTeb()->ActivationContextStackPointer); + if (NT_SUCCESS(Status)) + { + DPRINT("ActivationContextStack %p\n", NtCurrentTeb()->ActivationContextStackPointer); + DPRINT("ActiveFrame %p\n", ((PACTIVATION_CONTEXT_STACK)NtCurrentTeb()->ActivationContextStackPointer)->ActiveFrame); + NtCurrentTeb()->ActivationContextStackPointer->ActiveFrame = NULL; + } + else + DPRINT1("Warning: Unable to allocate ActivationContextStack\n"); + } + + /* Make sure we are not shutting down */ + if (LdrpShutdownInProgress) return; + + /* Allocate TLS */ + LdrpAllocateTls(); + + /* Start at the beginning */ + ListHead = &Peb->Ldr->InMemoryOrderModuleList; + NextEntry = ListHead->Flink; + while (NextEntry != ListHead) + { + /* Get the current entry */ + LdrEntry = CONTAINING_RECORD(NextEntry, LDR_DATA_TABLE_ENTRY, InMemoryOrderModuleList); + + /* Make sure it's not ourselves */ + if (Peb->ImageBaseAddress != LdrEntry->DllBase) + { + /* Check if we should call */ + if (!(LdrEntry->Flags & LDRP_DONT_CALL_FOR_THREADS)) + { + /* Get the entrypoint */ + EntryPoint = LdrEntry->EntryPoint; + + /* Check if we are ready to call it */ + if ((EntryPoint) && + (LdrEntry->Flags & LDRP_PROCESS_ATTACH_CALLED) && + (LdrEntry->Flags & LDRP_IMAGE_DLL)) + { + /* Set up the Act Ctx */ + ActCtx.Size = sizeof(ActCtx); + ActCtx.Format = 1; + RtlZeroMemory(&ActCtx.Frame, sizeof(RTL_ACTIVATION_CONTEXT_STACK_FRAME)); + + /* Activate the ActCtx */ + RtlActivateActivationContextUnsafeFast(&ActCtx, + LdrEntry->EntryPointActivationContext); + + /* Check if it has TLS */ + if (LdrEntry->TlsIndex) + { + /* Make sure we're not shutting down */ + if (!LdrpShutdownInProgress) + { + /* Call TLS */ + LdrpCallTlsInitializers(LdrEntry->DllBase, DLL_THREAD_ATTACH); + } + } + + /* Make sure we're not shutting down */ + if (!LdrpShutdownInProgress) + { + /* Call the Entrypoint */ + DPRINT("%wZ - Calling entry point at %x for thread attaching\n", + &LdrEntry->BaseDllName, LdrEntry->EntryPoint); + LdrpCallInitRoutine(LdrEntry->EntryPoint, + LdrEntry->DllBase, + DLL_THREAD_ATTACH, + NULL); + } + + /* Deactivate the ActCtx */ + RtlDeactivateActivationContextUnsafeFast(&ActCtx); + } + } + } + + /* Next entry */ + NextEntry = NextEntry->Flink; + } + + /* Check for TLS */ + if (LdrpImageHasTls && !LdrpShutdownInProgress) + { + /* Set up the Act Ctx */ + ActCtx.Size = sizeof(ActCtx); + ActCtx.Format = 1; + RtlZeroMemory(&ActCtx.Frame, sizeof(RTL_ACTIVATION_CONTEXT_STACK_FRAME)); + + /* Activate the ActCtx */ + RtlActivateActivationContextUnsafeFast(&ActCtx, + LdrpImageEntry->EntryPointActivationContext); + + /* Do TLS callbacks */ + LdrpCallTlsInitializers(Peb->ImageBaseAddress, DLL_THREAD_ATTACH); + + /* Deactivate the ActCtx */ + RtlDeactivateActivationContextUnsafeFast(&ActCtx); + } + + DPRINT("LdrpInitializeThread() done\n"); +} + NTSTATUS NTAPI LdrpRunInitializeRoutines(IN PCONTEXT Context OPTIONAL) @@ -630,7 +799,7 @@ LdrpRunInitializeRoutines(IN PCONTEXT Context OPTIONAL) if (LdrEntry->TlsIndex && Context) { /* Call TLS */ - LdrpTlsCallback(LdrEntry->DllBase, DLL_PROCESS_ATTACH); + LdrpCallTlsInitializers(LdrEntry->DllBase, DLL_PROCESS_ATTACH); } /* Call the Entrypoint */ @@ -639,7 +808,7 @@ LdrpRunInitializeRoutines(IN PCONTEXT Context OPTIONAL) DPRINT1("%wZ - Calling entry point at %p for DLL_PROCESS_ATTACH\n", &LdrEntry->BaseDllName, EntryPoint); } - DllStatus = LdrpCallDllEntry(EntryPoint, + DllStatus = LdrpCallInitRoutine(EntryPoint, LdrEntry->DllBase, DLL_PROCESS_ATTACH, Context); @@ -693,7 +862,7 @@ LdrpRunInitializeRoutines(IN PCONTEXT Context OPTIONAL) LdrpImageEntry->EntryPointActivationContext); /* Do TLS callbacks */ - LdrpTlsCallback(Peb->ImageBaseAddress, DLL_PROCESS_ATTACH); + LdrpCallTlsInitializers(Peb->ImageBaseAddress, DLL_PROCESS_ATTACH); /* Deactivate the ActCtx */ RtlDeactivateActivationContextUnsafeFast(&ActCtx); @@ -715,6 +884,267 @@ Quickie: return Status; } +/* + * @implemented + */ +NTSTATUS +NTAPI +LdrShutdownProcess(VOID) +{ + PPEB Peb = NtCurrentPeb(); + PLDR_DATA_TABLE_ENTRY LdrEntry; + PLIST_ENTRY NextEntry, ListHead; + RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED ActCtx; + PVOID EntryPoint; + + DPRINT("LdrShutdownProcess() called for %wZ\n", &LdrpImageEntry->BaseDllName); + if (LdrpShutdownInProgress) return STATUS_SUCCESS; + + /* Tell the Shim Engine */ + //if (ShimsEnabled) + //{ + /* FIXME */ + //} + + /* Tell the world */ + if (ShowSnaps) + { + DPRINT1("\n"); + } + + /* Set the shutdown variables */ + LdrpShutdownThreadId = NtCurrentTeb()->RealClientId.UniqueThread; + LdrpShutdownInProgress = TRUE; + + /* Enter the Loader Lock */ + RtlEnterCriticalSection(&LdrpLoaderLock); + + /* Cleanup trace logging data (Etw) */ + if (SharedUserData->TraceLogging) + { + /* FIXME */ + DPRINT1("We don't support Etw yet.\n"); + } + + /* Start at the end */ + ListHead = &Peb->Ldr->InInitializationOrderModuleList; + NextEntry = ListHead->Blink; + while (NextEntry != ListHead) + { + /* Get the current entry */ + LdrEntry = CONTAINING_RECORD(NextEntry, LDR_DATA_TABLE_ENTRY, InInitializationOrderModuleList); + NextEntry = NextEntry->Blink; + + /* Make sure it's not ourselves */ + if (Peb->ImageBaseAddress != LdrEntry->DllBase) + { + /* Get the entrypoint */ + EntryPoint = LdrEntry->EntryPoint; + + /* Check if we are ready to call it */ + if (EntryPoint && + (LdrEntry->Flags & LDRP_PROCESS_ATTACH_CALLED) && + LdrEntry->Flags) + { + /* Set up the Act Ctx */ + ActCtx.Size = sizeof(ActCtx); + ActCtx.Format = 1; + RtlZeroMemory(&ActCtx.Frame, sizeof(RTL_ACTIVATION_CONTEXT_STACK_FRAME)); + + /* Activate the ActCtx */ + RtlActivateActivationContextUnsafeFast(&ActCtx, + LdrEntry->EntryPointActivationContext); + + /* Check if it has TLS */ + if (LdrEntry->TlsIndex) + { + /* Call TLS */ + LdrpCallTlsInitializers(LdrEntry->DllBase, DLL_PROCESS_DETACH); + } + + /* Call the Entrypoint */ + DPRINT("%wZ - Calling entry point at %x for thread detaching\n", + &LdrEntry->BaseDllName, LdrEntry->EntryPoint); + LdrpCallInitRoutine(EntryPoint, + LdrEntry->DllBase, + DLL_PROCESS_DETACH, + (PVOID)1); + + /* Deactivate the ActCtx */ + RtlDeactivateActivationContextUnsafeFast(&ActCtx); + } + } + } + + /* Check for TLS */ + if (LdrpImageHasTls) + { + /* Set up the Act Ctx */ + ActCtx.Size = sizeof(ActCtx); + ActCtx.Format = 1; + RtlZeroMemory(&ActCtx.Frame, sizeof(RTL_ACTIVATION_CONTEXT_STACK_FRAME)); + + /* Activate the ActCtx */ + RtlActivateActivationContextUnsafeFast(&ActCtx, + LdrpImageEntry->EntryPointActivationContext); + + /* Do TLS callbacks */ + LdrpCallTlsInitializers(Peb->ImageBaseAddress, DLL_PROCESS_DETACH); + + /* Deactivate the ActCtx */ + RtlDeactivateActivationContextUnsafeFast(&ActCtx); + } + + /* FIXME: Do Heap detection and Etw final shutdown */ + + /* Release the lock */ + RtlLeaveCriticalSection(&LdrpLoaderLock); + DPRINT("LdrpShutdownProcess() done\n"); + + return STATUS_SUCCESS; +} + +/* + * @implemented + */ +NTSTATUS +NTAPI +LdrShutdownThread(VOID) +{ + PPEB Peb = NtCurrentPeb(); + PTEB Teb = NtCurrentTeb(); + PLDR_DATA_TABLE_ENTRY LdrEntry; + PLIST_ENTRY NextEntry, ListHead; + RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED ActCtx; + PVOID EntryPoint; + + DPRINT("LdrShutdownThread() called for %wZ\n", + &LdrpImageEntry->BaseDllName); + + /* Cleanup trace logging data (Etw) */ + if (SharedUserData->TraceLogging) + { + /* FIXME */ + DPRINT1("We don't support Etw yet.\n"); + } + + /* Get the Ldr Lock */ + RtlEnterCriticalSection(&LdrpLoaderLock); + + /* Start at the end */ + ListHead = &Peb->Ldr->InInitializationOrderModuleList; + NextEntry = ListHead->Blink; + while (NextEntry != ListHead) + { + /* Get the current entry */ + LdrEntry = CONTAINING_RECORD(NextEntry, LDR_DATA_TABLE_ENTRY, InInitializationOrderModuleList); + NextEntry = NextEntry->Blink; + + /* Make sure it's not ourselves */ + if (Peb->ImageBaseAddress != LdrEntry->DllBase) + { + /* Check if we should call */ + if (!(LdrEntry->Flags & LDRP_DONT_CALL_FOR_THREADS) && + (LdrEntry->Flags & LDRP_PROCESS_ATTACH_CALLED) && + (LdrEntry->Flags & LDRP_IMAGE_DLL)) + { + /* Get the entrypoint */ + EntryPoint = LdrEntry->EntryPoint; + + /* Check if we are ready to call it */ + if (EntryPoint) + { + /* Set up the Act Ctx */ + ActCtx.Size = sizeof(ActCtx); + ActCtx.Format = 1; + RtlZeroMemory(&ActCtx.Frame, sizeof(RTL_ACTIVATION_CONTEXT_STACK_FRAME)); + + /* Activate the ActCtx */ + RtlActivateActivationContextUnsafeFast(&ActCtx, + LdrEntry->EntryPointActivationContext); + + /* Check if it has TLS */ + if (LdrEntry->TlsIndex) + { + /* Make sure we're not shutting down */ + if (!LdrpShutdownInProgress) + { + /* Call TLS */ + LdrpCallTlsInitializers(LdrEntry->DllBase, DLL_THREAD_DETACH); + } + } + + /* Make sure we're not shutting down */ + if (!LdrpShutdownInProgress) + { + /* Call the Entrypoint */ + DPRINT("%wZ - Calling entry point at %x for thread detaching\n", + &LdrEntry->BaseDllName, LdrEntry->EntryPoint); + LdrpCallInitRoutine(EntryPoint, + LdrEntry->DllBase, + DLL_THREAD_DETACH, + NULL); + } + + /* Deactivate the ActCtx */ + RtlDeactivateActivationContextUnsafeFast(&ActCtx); + } + } + } + } + + /* Check for TLS */ + if (LdrpImageHasTls) + { + /* Set up the Act Ctx */ + ActCtx.Size = sizeof(ActCtx); + ActCtx.Format = 1; + RtlZeroMemory(&ActCtx.Frame, sizeof(RTL_ACTIVATION_CONTEXT_STACK_FRAME)); + + /* Activate the ActCtx */ + RtlActivateActivationContextUnsafeFast(&ActCtx, + LdrpImageEntry->EntryPointActivationContext); + + /* Do TLS callbacks */ + LdrpCallTlsInitializers(Peb->ImageBaseAddress, DLL_THREAD_DETACH); + + /* Deactivate the ActCtx */ + RtlDeactivateActivationContextUnsafeFast(&ActCtx); + } + + /* Free TLS */ + LdrpFreeTls(); + RtlLeaveCriticalSection(&LdrpLoaderLock); + + /* Check for expansion slots */ + if (Teb->TlsExpansionSlots) + { + /* Free expansion slots */ + RtlFreeHeap(RtlGetProcessHeap(), 0, Teb->TlsExpansionSlots); + } + + /* Check for FLS Data */ + if (Teb->FlsData) + { + /* FIXME */ + DPRINT1("We don't support FLS Data yet\n"); + } + + /* Check for Fiber data */ + if (Teb->HasFiberData) + { + /* Free Fiber data*/ + RtlFreeHeap(RtlGetProcessHeap(), 0, Teb->NtTib.FiberData); + Teb->NtTib.FiberData = NULL; + } + + /* Free the activation context stack */ + RtlFreeThreadActivationContextStack(); + DPRINT("LdrShutdownThread() done\n"); + + return STATUS_SUCCESS; +} + NTSTATUS NTAPI LdrpInitializeTls(VOID) @@ -879,10 +1309,107 @@ LdrpFreeTls(VOID) NTSTATUS NTAPI -LdrpInitializeExecutionOptions(PUNICODE_STRING ImagePathName, PPEB Peb, PULONG Options) +LdrpInitializeExecutionOptions(PUNICODE_STRING ImagePathName, PPEB Peb, PHKEY OptionsKey) { - UNIMPLEMENTED; - *Options = 0; + //NTSTATUS Status; + //HKEY KeyHandle; + //ULONG ExecuteOptions, MinimumStackCommit = 0, GlobalFlag; + + /* Return error if we were not provided a pointer where to save the options key handle */ + if (!OptionsKey) return STATUS_INVALID_HANDLE; + + /* Zero initialize the optinos key pointer */ + *OptionsKey = NULL; +#if 0 + + /* Open the options key */ + Status = LdrOpenImageFileOptionsKey(ImagePathName, 0, &KeyHandle); + + /* Save it if it was opened successfully */ + if (NT_SUCCESS(Status)) + *OptionsKey = KeyHandle; + + if (KeyHandle) + { + /* There are image specific options, read them starting with NXCOMPAT */ + Status = LdrQueryImageFileKeyOption(KeyHandle, + L"ExecuteOptions", + 4, + &ExecuteOptions, + sizeof(ExecuteOptions), + 0); + + if (NT_SUCCESS(Status)) + { + /* TODO: Set execution options for the process */ + /* + if (ExecuteOptions == 0) + ExecuteOptions = 1; + else + ExecuteOptions = 2; + ZwSetInformationProcess(NtCurrentProcess(), + ProcessExecuteFlags, + &ExecuteOptions, + sizeof(ULONG));*/ + + } + + /* Check if this image uses large pages */ + if (Peb->ImageUsesLargePages) + { + /* TODO: If it does, open large page key */ + UNIMPLEMENTED; + } + + /* Get various option values */ + LdrQueryImageFileKeyOption(KeyHandle, + L"DisableHeapLookaside", + REG_DWORD, + &RtlpDisableHeapLookaside, + sizeof(RtlpDisableHeapLookaside), + NULL); + + LdrQueryImageFileKeyOption(KeyHandle, + L"ShutdownFlags", + REG_DWORD, + &RtlpShutdownProcessFlags, + sizeof(RtlpShutdownProcessFlags), + NULL); + + LdrQueryImageFileKeyOption(KeyHandle, + L"MinimumStackCommitInBytes", + REG_DWORD, + &MinimumStackCommit, + sizeof(MinimumStackCommit), + NULL); + + /* Update PEB's minimum stack commit if it's lower */ + if (Peb->MinimumStackCommit < MinimumStackCommit) + Peb->MinimumStackCommit = MinimumStackCommit; + + /* Set the global flag */ + Status = LdrQueryImageFileKeyOption(KeyHandle, + L"GlobalFlag", + REG_DWORD, + &GlobalFlag, + sizeof(GlobalFlag), + NULL); + + if (NT_SUCCESS(Status)) + Peb->NtGlobalFlag = GlobalFlag; + else + GlobalFlag = 0; + } + else + { + /* There are no image-specific options, so perform global initialization */ + if (Peb->NtGlobalFlag & (FLG_POOL_ENABLE_TAIL_CHECK | FLG_HEAP_PAGE_ALLOCS)) + { + // TODO: Initialize app verifier package + // Status = LdrpInitializeApplicationVerifierPackage(ImagePathName, Peb, 1, FALSE); + } + } +#endif return STATUS_SUCCESS; } @@ -915,7 +1442,7 @@ LdrpInitializeProcess(IN PCONTEXT Context, //LPWSTR ImagePathBuffer; ULONG ConfigSize; UNICODE_STRING CurrentDirectory; - ULONG ExecuteOptions; + HKEY OptionsKey; ULONG HeapFlags; PIMAGE_NT_HEADERS NtHeader; LPWSTR NtDllName = NULL; @@ -928,9 +1455,10 @@ LdrpInitializeProcess(IN PCONTEXT Context, ULONG i; PWSTR ImagePath; ULONG DebugProcessHeapOnly = 0; - WCHAR FullNtDllPath[MAX_PATH]; PLDR_DATA_TABLE_ENTRY NtLdrEntry; PWCHAR Current; + ULONG ExecuteOptions = 0; + PVOID ViewBase; /* Set a NULL SEH Filter */ RtlSetUnhandledExceptionFilter(NULL); @@ -954,7 +1482,7 @@ LdrpInitializeProcess(IN PCONTEXT Context, NtHeader = RtlImageNtHeader(Peb->ImageBaseAddress); /* Get the execution options */ - Status = LdrpInitializeExecutionOptions(&ImagePathName, Peb, &ExecuteOptions); + Status = LdrpInitializeExecutionOptions(&ImagePathName, Peb, &OptionsKey); /* Check if this is a .NET executable */ if (RtlImageDirectoryEntryToData(Peb->ImageBaseAddress, @@ -1040,7 +1568,7 @@ LdrpInitializeProcess(IN PCONTEXT Context, } /* Check if verbose debugging (ShowSnaps) was requested */ - ShowSnaps = TRUE;//Peb->NtGlobalFlag & FLG_SHOW_LDR_SNAPS; + ShowSnaps = Peb->NtGlobalFlag & FLG_SHOW_LDR_SNAPS; /* Start verbose debugging messages right now if they were requested */ if (ShowSnaps) @@ -1091,9 +1619,11 @@ LdrpInitializeProcess(IN PCONTEXT Context, } /* Initialize the Loader Lock */ + // FIXME: What's the point of initing it manually, if two lines lower + // a call to RtlInitializeCriticalSection() is being made anyway? //InsertTailList(&RtlCriticalSectionList, &LdrpLoaderLock.DebugInfo->ProcessLocksList); //LdrpLoaderLock.DebugInfo->CriticalSection = &LdrpLoaderLock; - UNIMPLEMENTED; + RtlInitializeCriticalSection(&LdrpLoaderLock); LdrpLoaderLockInit = TRUE; /* Check if User Stack Trace Database support was requested */ @@ -1134,19 +1664,30 @@ LdrpInitializeProcess(IN PCONTEXT Context, return STATUS_NO_MEMORY; } + // FIXME: Is it located properly? + /* Initialize table of callbacks for the kernel. */ + Peb->KernelCallbackTable = RtlAllocateHeap(RtlGetProcessHeap(), + 0, + sizeof(PVOID) * + (USER32_CALLBACK_MAXIMUM + 1)); + if (!Peb->KernelCallbackTable) + { + DPRINT1("Failed to create callback table\n"); + ZwTerminateProcess(NtCurrentProcess(), STATUS_INSUFFICIENT_RESOURCES); + } + /* Allocate an Activation Context Stack */ Status = RtlAllocateActivationContextStack((PVOID *)&Teb->ActivationContextStackPointer); if (!NT_SUCCESS(Status)) return Status; // FIXME: Loader private heap is missing - DPRINT1("Loader private heap is missing\n"); + //DPRINT1("Loader private heap is missing\n"); /* Check for Debug Heap */ - DPRINT1("Check for a debug heap is missing\n"); - if (FALSE) + if (OptionsKey) { /* Query the setting */ - Status = LdrQueryImageFileKeyOption(NULL,//hKey + Status = LdrQueryImageFileKeyOption(OptionsKey, L"DebugProcessHeapOnly", REG_DWORD, &DebugProcessHeapOnly, @@ -1165,9 +1706,9 @@ LdrpInitializeProcess(IN PCONTEXT Context, } /* Build the NTDLL Path */ - FullPath.Buffer = FullNtDllPath; + FullPath.Buffer = StringBuffer; FullPath.Length = 0; - FullPath.MaximumLength = sizeof(FullNtDllPath); + FullPath.MaximumLength = sizeof(StringBuffer); RtlInitUnicodeString(&NtSystemRoot, SharedUserData->NtSystemRoot); RtlAppendUnicodeStringToString(&FullPath, &NtSystemRoot); RtlAppendUnicodeToString(&FullPath, L"\\System32\\"); @@ -1184,16 +1725,10 @@ LdrpInitializeProcess(IN PCONTEXT Context, &ObjectAttributes); /* Check if it exists */ - if (!NT_SUCCESS(Status)) - { - /* It doesn't, so assume System32 */ - LdrpKnownDllObjectDirectory = NULL; - RtlInitUnicodeString(&LdrpKnownDllPath, FullPath.Buffer); - LdrpKnownDllPath.Length -= sizeof(WCHAR); - } - else + if (NT_SUCCESS(Status)) { /* Open the Known DLLs Path */ + RtlInitUnicodeString(&KnownDllString, L"KnownDllPath"); InitializeObjectAttributes(&ObjectAttributes, &KnownDllString, OBJ_CASE_INSENSITIVE, @@ -1218,6 +1753,15 @@ LdrpInitializeProcess(IN PCONTEXT Context, } } + /* Check if we failed */ + if (!NT_SUCCESS(Status)) + { + /* Aassume System32 */ + LdrpKnownDllObjectDirectory = NULL; + RtlInitUnicodeString(&LdrpKnownDllPath, StringBuffer); + LdrpKnownDllPath.Length -= sizeof(WCHAR); + } + /* If we have process parameters, get the default path and current path */ if (ProcessParameters) { @@ -1230,6 +1774,7 @@ LdrpInitializeProcess(IN PCONTEXT Context, else { /* We need a valid path */ + DPRINT1("No valid DllPath was given!\n"); LdrpInitFailure(STATUS_INVALID_PARAMETER); } @@ -1246,6 +1791,11 @@ LdrpInitializeProcess(IN PCONTEXT Context, 0, 3 * sizeof(WCHAR) + sizeof(UNICODE_NULL)); + if (!CurrentDirectory.Buffer) + { + DPRINT1("LDR: LdrpInitializeProcess - unable to allocate current working directory buffer\n"); + // FIXME: And what? + } /* Copy the drive of the system root */ RtlMoveMemory(CurrentDirectory.Buffer, @@ -1256,12 +1806,12 @@ LdrpInitializeProcess(IN PCONTEXT Context, CurrentDirectory.MaximumLength = CurrentDirectory.Length + sizeof(WCHAR); FreeCurDir = TRUE; + DPRINT("Using dynamically allocd curdir\n"); } else { /* Use the local buffer */ - CurrentDirectory.Length = NtSystemRoot.Length; - CurrentDirectory.Buffer = NtSystemRoot.Buffer; + DPRINT("Using local system root\n"); } } @@ -1280,8 +1830,8 @@ LdrpInitializeProcess(IN PCONTEXT Context, NtLdrEntry->EntryPoint = LdrpFetchAddressOfEntryPoint(NtLdrEntry->DllBase); NtLdrEntry->LoadCount = -1; NtLdrEntry->EntryPointActivationContext = 0; - NtLdrEntry->FullDllName.Length = ImageFileName.Length; - NtLdrEntry->FullDllName.Buffer = ImageFileName.Buffer; + NtLdrEntry->FullDllName = ImageFileName; + if (IsDotNetImage) NtLdrEntry->Flags = LDRP_COR_IMAGE; else @@ -1291,7 +1841,7 @@ LdrpInitializeProcess(IN PCONTEXT Context, if (!ImageFileName.Buffer[0]) { /* Use the same Base name */ - NtLdrEntry->BaseDllName = NtLdrEntry->BaseDllName; + NtLdrEntry->BaseDllName = NtLdrEntry->FullDllName; } else { @@ -1332,14 +1882,16 @@ LdrpInitializeProcess(IN PCONTEXT Context, NtLdrEntry->EntryPoint = LdrpFetchAddressOfEntryPoint(NtLdrEntry->DllBase); NtLdrEntry->LoadCount = -1; NtLdrEntry->EntryPointActivationContext = 0; - //NtLdrEntry->BaseDllName.Length = NtSystemRoot.Length; - //RtlAppendUnicodeStringToString(&NtSystemRoot, &NtDllString); + + NtLdrEntry->FullDllName.Length = FullPath.Length; + NtLdrEntry->FullDllName.MaximumLength = FullPath.MaximumLength; + NtLdrEntry->FullDllName.Buffer = StringBuffer; + RtlAppendUnicodeStringToString(&NtLdrEntry->FullDllName, &NtDllString); + NtLdrEntry->BaseDllName.Length = NtDllString.Length; NtLdrEntry->BaseDllName.MaximumLength = NtDllString.MaximumLength; NtLdrEntry->BaseDllName.Buffer = NtDllString.Buffer; - // FIXME: Full DLL name?! - /* Processing done, insert it */ LdrpNtDllDataTableEntry = NtLdrEntry; LdrpInsertMemoryTableEntry(NtLdrEntry); @@ -1407,13 +1959,37 @@ LdrpInitializeProcess(IN PCONTEXT Context, /* Check if relocation is needed */ if (Peb->ImageBaseAddress != (PVOID)NtHeader->OptionalHeader.ImageBase) { - DPRINT("LDR: Performing relocations\n"); - Status = LdrPerformRelocations(NtHeader, Peb->ImageBaseAddress); + DPRINT1("LDR: Performing EXE relocation\n"); + + /* Change the protection to prepare for relocation */ + ViewBase = Peb->ImageBaseAddress; + Status = LdrpSetProtection(ViewBase, FALSE); + if (!NT_SUCCESS(Status)) return Status; + + /* Do the relocation */ + Status = LdrRelocateImageWithBias(ViewBase, + 0LL, + NULL, + STATUS_SUCCESS, + STATUS_CONFLICTING_ADDRESSES, + STATUS_INVALID_IMAGE_FORMAT); if (!NT_SUCCESS(Status)) { - DPRINT1("LdrPerformRelocations() failed\n"); + DPRINT1("LdrRelocateImageWithBias() failed\n"); + return Status; + } + + /* Check if a start context was provided */ + if (Context) + { + DPRINT1("WARNING: Relocated EXE Context"); + UNIMPLEMENTED; // We should support this return STATUS_INVALID_IMAGE_FORMAT; } + + /* Restore the protection */ + Status = LdrpSetProtection(ViewBase, TRUE); + if (!NT_SUCCESS(Status)) return Status; } /* Lock the DLLs */ @@ -1503,14 +2079,13 @@ LdrpInitializeProcess(IN PCONTEXT Context, /* Check if we have a user-defined Post Process Routine */ if (NT_SUCCESS(Status) && Peb->PostProcessInitRoutine) { - DPRINT1("CP\n"); /* Call it */ Peb->PostProcessInitRoutine(); } - ///* Close the key if we have one opened */ - //if (hKey) NtClose(hKey); -DbgBreakPoint(); + /* Close the key if we have one opened */ + if (OptionsKey) NtClose(OptionsKey); + /* Return status */ return Status; } @@ -1520,9 +2095,11 @@ NTAPI LdrpInitFailure(NTSTATUS Status) { ULONG Response; + PPEB Peb = NtCurrentPeb(); /* Print a debug message */ - DPRINT1("LDR: Process initialization failure; NTSTATUS = %08lx\n", Status); + DPRINT1("LDR: Process initialization failure for %wZ; NTSTATUS = %08lx\n", + &Peb->ProcessParameters->ImagePathName, Status); /* Raise a hard error */ if (!LdrpFatalHardErrorCount) @@ -1596,7 +2173,7 @@ LdrpInit(PCONTEXT Context, _SEH2_TRY { /* Initialize the Process */ - LoaderStatus = LdrpInitializeProcess_(Context, + LoaderStatus = LdrpInitializeProcess(Context, SystemArgument1); /* Check for success and if MinimumStackCommit was requested */ diff --git a/dll/ntdll/ldr/ldrpe.c b/dll/ntdll/ldr/ldrpe.c index 12e24fe547d..aa3ef415d4b 100644 --- a/dll/ntdll/ldr/ldrpe.c +++ b/dll/ntdll/ldr/ldrpe.c @@ -13,20 +13,9 @@ #include /* GLOBALS *******************************************************************/ -ULONG LdrpFatalHardErrorCount; + PVOID LdrpManifestProberRoutine; - -/* PROTOTYPES ****************************************************************/ - -#define IMAGE_REL_BASED_HIGH3ADJ 11 - -NTSTATUS -NTAPI -LdrpLoadImportModule(IN PWSTR DllPath OPTIONAL, - IN LPSTR ImportName, - IN PVOID DllBase, - OUT PLDR_DATA_TABLE_ENTRY *DataTableEntry, - OUT PBOOLEAN Existing); +ULONG LdrpNormalSnap; /* FUNCTIONS *****************************************************************/ @@ -37,21 +26,15 @@ LdrpSnapIAT(IN PLDR_DATA_TABLE_ENTRY ExportLdrEntry, IN PIMAGE_IMPORT_DESCRIPTOR IatEntry, IN BOOLEAN EntriesValid) { - PIMAGE_EXPORT_DIRECTORY ExportDirectory; - ULONG ExportSize; PVOID Iat; - SIZE_T ImportSize; - ULONG IatSize; - //PPEB Peb = NtCurrentPeb(); NTSTATUS Status; PIMAGE_THUNK_DATA OriginalThunk, FirstThunk; - LPSTR ImportName; - ULONG ForwarderChain; PIMAGE_NT_HEADERS NtHeader; PIMAGE_SECTION_HEADER SectionHeader; - ULONG i, Rva; - ULONG OldProtect; - + PIMAGE_EXPORT_DIRECTORY ExportDirectory; + LPSTR ImportName; + ULONG ForwarderChain, i, Rva, OldProtect, IatSize, ExportSize; + SIZE_T ImportSize; DPRINT("LdrpSnapIAT(%wZ %wZ %p %d)\n", &ExportLdrEntry->BaseDllName, &ImportLdrEntry->BaseDllName, IatEntry, EntriesValid); /* Get export directory */ @@ -61,7 +44,13 @@ LdrpSnapIAT(IN PLDR_DATA_TABLE_ENTRY ExportLdrEntry, &ExportSize); /* Make sure it has one */ - if (!ExportDirectory) return STATUS_INVALID_IMAGE_FORMAT; + if (!ExportDirectory) + { + /* Fail */ + DbgPrint("LDR: %wZ doesn't contain an EXPORT table\n", + &ExportLdrEntry->BaseDllName); + return STATUS_INVALID_IMAGE_FORMAT; + } /* Get the IAT */ Iat = RtlImageDirectoryEntryToData(ImportLdrEntry->DllBase, @@ -75,6 +64,7 @@ LdrpSnapIAT(IN PLDR_DATA_TABLE_ENTRY ExportLdrEntry, { /* Get the NT Header and the first section */ NtHeader = RtlImageNtHeader(ImportLdrEntry->DllBase); + if (!NtHeader) return STATUS_INVALID_IMAGE_FORMAT; SectionHeader = IMAGE_FIRST_SECTION(NtHeader); /* Get the RVA of the import directory */ @@ -99,10 +89,7 @@ LdrpSnapIAT(IN PLDR_DATA_TABLE_ENTRY ExportLdrEntry, IatSize = SectionHeader->Misc.VirtualSize; /* Deal with Watcom and other retarded compilers */ - if (!IatSize) - { - IatSize = SectionHeader->SizeOfRawData; - } + if (!IatSize) IatSize = SectionHeader->SizeOfRawData; /* Found it, get out */ break; @@ -114,7 +101,14 @@ LdrpSnapIAT(IN PLDR_DATA_TABLE_ENTRY ExportLdrEntry, } /* If we still don't have an IAT, that's bad */ - if (!Iat) return STATUS_INVALID_IMAGE_FORMAT; + if (!Iat) + { + /* Fail */ + DbgPrint("LDR: Unable to unprotect IAT for %wZ (Image Base %p)\n", + &ImportLdrEntry->BaseDllName, + ImportLdrEntry->DllBase); + return STATUS_INVALID_IMAGE_FORMAT; + } /* Set the right size */ ImportSize = IatSize; @@ -126,7 +120,14 @@ LdrpSnapIAT(IN PLDR_DATA_TABLE_ENTRY ExportLdrEntry, &ImportSize, PAGE_READWRITE, &OldProtect); - if (!NT_SUCCESS(Status)) return Status; + if (!NT_SUCCESS(Status)) + { + /* Fail */ + DbgPrint("LDR: Unable to unprotect IAT for %wZ (Status %x)\n", + &ImportLdrEntry->BaseDllName, + Status); + return Status; + } /* Check if the Thunks are already valid */ if (EntriesValid) @@ -255,7 +256,7 @@ NTSTATUS NTAPI LdrpHandleOneNewFormatImportDescriptor(IN LPWSTR DllPath OPTIONAL, IN PLDR_DATA_TABLE_ENTRY LdrEntry, - IN PIMAGE_BOUND_IMPORT_DESCRIPTOR BoundEntry, + IN PIMAGE_BOUND_IMPORT_DESCRIPTOR *BoundEntryPtr, IN PIMAGE_BOUND_IMPORT_DESCRIPTOR FirstEntry) { LPSTR ImportName = NULL, BoundImportName, ForwarderName; @@ -264,11 +265,15 @@ LdrpHandleOneNewFormatImportDescriptor(IN LPWSTR DllPath OPTIONAL, PIMAGE_IMPORT_DESCRIPTOR ImportEntry; PLDR_DATA_TABLE_ENTRY DllLdrEntry, ForwarderLdrEntry; PIMAGE_BOUND_FORWARDER_REF ForwarderEntry; + PIMAGE_BOUND_IMPORT_DESCRIPTOR BoundEntry; PPEB Peb = NtCurrentPeb(); ULONG i, IatSize; + /* Get the pointer to the bound entry */ + BoundEntry = *BoundEntryPtr; + /* Get the name's VA */ - BoundImportName = (LPSTR)(BoundEntry + BoundEntry->OffsetModuleName); + BoundImportName = (LPSTR)FirstEntry + BoundEntry->OffsetModuleName; /* Show debug mesage */ if (ShowSnaps) @@ -311,7 +316,7 @@ LdrpHandleOneNewFormatImportDescriptor(IN LPWSTR DllPath OPTIONAL, if (ShowSnaps) { DPRINT1("LDR: %wZ has stale binding to %s\n", - &DllLdrEntry->BaseDllName, + &LdrEntry->BaseDllName, BoundImportName); } @@ -324,7 +329,7 @@ LdrpHandleOneNewFormatImportDescriptor(IN LPWSTR DllPath OPTIONAL, if (ShowSnaps) { DPRINT1("LDR: %wZ has correct binding to %s\n", - &DllLdrEntry->BaseDllName, + &LdrEntry->BaseDllName, BoundImportName); } @@ -339,7 +344,7 @@ LdrpHandleOneNewFormatImportDescriptor(IN LPWSTR DllPath OPTIONAL, for (i = 0; i < BoundEntry->NumberOfModuleForwarderRefs; i++) { /* Get the name */ - ForwarderName = (LPSTR)(FirstEntry + ForwarderEntry->OffsetModuleName); + ForwarderName = (LPSTR)FirstEntry + ForwarderEntry->OffsetModuleName; /* Show debug message */ if (ShowSnaps) @@ -376,7 +381,7 @@ LdrpHandleOneNewFormatImportDescriptor(IN LPWSTR DllPath OPTIONAL, if (ShowSnaps) { DPRINT1("LDR: %wZ has stale binding to %s\n", - &ForwarderLdrEntry->BaseDllName, + &LdrEntry->BaseDllName, ForwarderName); } @@ -389,7 +394,7 @@ LdrpHandleOneNewFormatImportDescriptor(IN LPWSTR DllPath OPTIONAL, if (ShowSnaps) { DPRINT1("LDR: %wZ has correct binding to %s\n", - &ForwarderLdrEntry->BaseDllName, + &LdrEntry->BaseDllName, ForwarderName); } @@ -408,6 +413,7 @@ LdrpHandleOneNewFormatImportDescriptor(IN LPWSTR DllPath OPTIONAL, if (Stale) { /* It was, so find the IAT entry for it */ + ++LdrpNormalSnap; ImportEntry = RtlImageDirectoryEntryToData(LdrEntry->DllBase, TRUE, IMAGE_DIRECTORY_ENTRY_IMPORT, @@ -423,7 +429,7 @@ LdrpHandleOneNewFormatImportDescriptor(IN LPWSTR DllPath OPTIONAL, if (!_stricmp(ImportName, BoundImportName)) break; /* Move to next entry */ - ImportEntry += 1; + ImportEntry++; } /* If we didn't find a name, fail */ @@ -477,7 +483,7 @@ LdrpHandleOneNewFormatImportDescriptor(IN LPWSTR DllPath OPTIONAL, Quickie: /* Write where we are now and return */ - *BoundEntry = *FirstEntry; + *BoundEntryPtr = FirstEntry; return Status; } @@ -496,7 +502,7 @@ LdrpHandleNewFormatImportDescriptors(IN LPWSTR DllPath OPTIONAL, /* Parse this descriptor */ Status = LdrpHandleOneNewFormatImportDescriptor(DllPath, LdrEntry, - BoundEntry, + &BoundEntry, FirstEntry); if (!NT_SUCCESS(Status)) return Status; } @@ -509,22 +515,21 @@ NTSTATUS NTAPI LdrpHandleOneOldFormatImportDescriptor(IN LPWSTR DllPath OPTIONAL, IN PLDR_DATA_TABLE_ENTRY LdrEntry, - IN PIMAGE_IMPORT_DESCRIPTOR ImportEntry) + IN PIMAGE_IMPORT_DESCRIPTOR *ImportEntry) { - //ULONG IatSize, i; LPSTR ImportName; NTSTATUS Status; - BOOLEAN AlreadyLoaded = FALSE, StaticEntriesValid = FALSE, SkipSnap = FALSE; + BOOLEAN AlreadyLoaded = FALSE; PLDR_DATA_TABLE_ENTRY DllLdrEntry; PIMAGE_THUNK_DATA FirstThunk; PPEB Peb = NtCurrentPeb(); /* Get the import name's VA */ - ImportName = (LPSTR)((ULONG_PTR)LdrEntry->DllBase + ImportEntry->Name); + ImportName = (LPSTR)((ULONG_PTR)LdrEntry->DllBase + (*ImportEntry)->Name); /* Get the first thunk */ FirstThunk = (PIMAGE_THUNK_DATA)((ULONG_PTR)LdrEntry->DllBase + - ImportEntry->FirstThunk); + (*ImportEntry)->FirstThunk); /* Make sure it's valid */ if (!FirstThunk->u1.Function) goto SkipEntry; @@ -543,7 +548,20 @@ LdrpHandleOneOldFormatImportDescriptor(IN LPWSTR DllPath OPTIONAL, LdrEntry->DllBase, &DllLdrEntry, &AlreadyLoaded); - if (!NT_SUCCESS(Status)) return Status; + if (!NT_SUCCESS(Status)) + { + /* Fail */ + if (ShowSnaps) + { + DbgPrint("LDR: LdrpWalkImportTable - LdrpLoadImportModule failed " + "on import %s with status %x\n", + ImportName, + Status); + } + + /* Return */ + return Status; + } /* Show debug message */ if (ShowSnaps) @@ -553,41 +571,8 @@ LdrpHandleOneOldFormatImportDescriptor(IN LPWSTR DllPath OPTIONAL, ImportName); } - /* Check if the image was bound when compiled */ - if (ImportEntry->OriginalFirstThunk) - { - /* It was, so check if the static IAT entries are still valid */ - if ((ImportEntry->TimeDateStamp) && - (ImportEntry->TimeDateStamp == DllLdrEntry->TimeDateStamp) && - (!(DllLdrEntry->Flags & LDRP_IMAGE_NOT_AT_BASE))) - { - /* Show debug message */ - if (ShowSnaps) - { - DPRINT1("LDR: Snap bypass %s from %wZ\n", - ImportName, - &LdrEntry->BaseDllName); - } - - /* - * They are still valid, so we can skip snapping them. - * Additionally, if we have no forwarders, we are totally - * done. - */ - if (ImportEntry->ForwarderChain == -1) - { - /* Totally skip LdrpSnapIAT */ - SkipSnap = TRUE; - } - else - { - /* Set this so LdrpSnapIAT will only do forwarders */ - StaticEntriesValid = TRUE; - } - } - } - /* Check if it wasn't already loaded */ + ++LdrpNormalSnap; if (!AlreadyLoaded) { /* Add the DLL to our list */ @@ -595,18 +580,25 @@ LdrpHandleOneOldFormatImportDescriptor(IN LPWSTR DllPath OPTIONAL, &DllLdrEntry->InInitializationOrderModuleList); } - /* Check if we should snap at all */ - if (!SkipSnap) + /* Now snap the IAT Entry */ + Status = LdrpSnapIAT(DllLdrEntry, LdrEntry, *ImportEntry, FALSE); + if (!NT_SUCCESS(Status)) { - /* Now snap the IAT Entry */ - Status = LdrpSnapIAT(DllLdrEntry, - LdrEntry, - ImportEntry, - StaticEntriesValid); - if (!NT_SUCCESS(Status)) return Status; + /* Fail */ + if (ShowSnaps) + { + DbgPrint("LDR: LdrpWalkImportTable - LdrpSnapIAT #2 failed with " + "status %x\n", + Status); + } + + /* Return */ + return Status; } SkipEntry: + /* Move on */ + (*ImportEntry)++; return STATUS_SUCCESS; } @@ -619,31 +611,59 @@ LdrpHandleOldFormatImportDescriptors(IN LPWSTR DllPath OPTIONAL, NTSTATUS Status; /* Check for Name and Thunk */ - while (ImportEntry->Name && ImportEntry->FirstThunk) + while ((ImportEntry->Name) && (ImportEntry->FirstThunk)) { /* Parse this descriptor */ Status = LdrpHandleOneOldFormatImportDescriptor(DllPath, LdrEntry, - ImportEntry); + &ImportEntry); if (!NT_SUCCESS(Status)) return Status; - - /* Move to the next entry */ - ImportEntry++; } /* Done */ return STATUS_SUCCESS; } -USHORT NTAPI -LdrpNameToOrdinal(LPSTR ImportName, - ULONG NumberOfNames, - PVOID ExportBase, - PULONG NameTable, - PUSHORT OrdinalTable) +USHORT +NTAPI +LdrpNameToOrdinal(IN LPSTR ImportName, + IN ULONG NumberOfNames, + IN PVOID ExportBase, + IN PULONG NameTable, + IN PUSHORT OrdinalTable) { - UNIMPLEMENTED; - return 0; + LONG Start, End, Next, CmpResult; + + /* Use classical binary search to find the ordinal */ + Start = Next = 0; + End = NumberOfNames - 1; + while (End >= Start) + { + /* Next will be exactly between Start and End */ + Next = (Start + End) >> 1; + + /* Compare this name with the one we need to find */ + CmpResult = strcmp(ImportName, (PCHAR)((ULONG_PTR)ExportBase + NameTable[Next])); + + /* We found our entry if result is 0 */ + if (!CmpResult) break; + + /* We didn't find, update our range then */ + if (CmpResult < 0) + { + End = Next - 1; + } + else if (CmpResult > 0) + { + Start = Next + 1; + } + } + + /* If end is before start, then the search failed */ + if (End < Start) return -1; + + /* Return found name */ + return OrdinalTable[Next]; } NTSTATUS @@ -657,11 +677,12 @@ LdrpWalkImportDescriptor(IN LPWSTR DllPath OPTIONAL, PIMAGE_BOUND_IMPORT_DESCRIPTOR BoundEntry = NULL; PIMAGE_IMPORT_DESCRIPTOR ImportEntry; ULONG BoundSize, IatSize; -DPRINT1("LdrpWalkImportDescriptor('%S' %x)\n", DllPath, LdrEntry); + DPRINT("LdrpWalkImportDescriptor('%S' %x)\n", DllPath, LdrEntry); + /* Set up the Act Ctx */ + RtlZeroMemory(&ActCtx, sizeof(ActCtx)); ActCtx.Size = sizeof(ActCtx); - ActCtx.Frame.Flags = 1; - RtlZeroMemory(&ActCtx.Frame, sizeof(RTL_ACTIVATION_CONTEXT_STACK_FRAME)); + ActCtx.Format = RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_FORMAT_WHISTLER; /* Check if we have a manifest prober routine */ if (LdrpManifestProberRoutine) @@ -674,13 +695,22 @@ DPRINT1("LdrpWalkImportDescriptor('%S' %x)\n", DllPath, LdrEntry); /* Get the Active ActCtx */ Status = RtlGetActiveActivationContext(&LdrEntry->EntryPointActivationContext); - if (!NT_SUCCESS(Status)) return Status; + if (!NT_SUCCESS(Status)) + { + /* Exit */ + DbgPrintEx(51, // DPFLTR_SXS_ID + DPFLTR_WARNING_LEVEL, + "LDR: RtlGetActiveActivationContext() failed; ntstatus = " + "0x%08lx\n", + Status); + return Status; + } /* Activate the ActCtx */ RtlActivateActivationContextUnsafeFast(&ActCtx, LdrEntry->EntryPointActivationContext); - /* Check if we were directed */ + /* Check if we were redirected */ if (!(LdrEntry->Flags & LDRP_REDIRECTED)) { /* Get the Bound IAT */ @@ -697,7 +727,7 @@ DPRINT1("LdrpWalkImportDescriptor('%S' %x)\n", DllPath, LdrEntry); &IatSize); /* Check if we got at least one */ - if (BoundEntry || ImportEntry) + if ((BoundEntry) || (ImportEntry)) { /* Do we have a Bound IAT */ if (BoundEntry) @@ -751,6 +781,7 @@ DPRINT1("LdrpWalkImportDescriptor('%S' %x)\n", DllPath, LdrEntry); return Status; } +/* FIXME: This function is missing SxS support and has wrong prototype */ NTSTATUS NTAPI LdrpLoadImportModule(IN PWSTR DllPath OPTIONAL, @@ -764,7 +795,9 @@ LdrpLoadImportModule(IN PWSTR DllPath OPTIONAL, NTSTATUS Status; PPEB Peb = RtlGetCurrentPeb(); PTEB Teb = NtCurrentTeb(); -DPRINT1("LdrpLoadImportModule('%S' '%s' %p %p %p)\n", DllPath, ImportName, DllBase, DataTableEntry, Existing); + + DPRINT("LdrpLoadImportModule('%S' '%s' %p %p %p)\n", DllPath, ImportName, DllBase, DataTableEntry, Existing); + /* Convert import descriptor name to unicode string */ ImpDescName = &Teb->StaticUnicodeString; RtlInitAnsiString(&AnsiString, ImportName); @@ -788,8 +821,8 @@ DPRINT1("LdrpLoadImportModule('%S' '%s' %p %p %p)\n", DllPath, ImportName, DllBa /* Map it */ Status = LdrpMapDll(DllPath, - ImpDescName->Buffer, NULL, + ImpDescName->Buffer, NULL, TRUE, FALSE, @@ -893,6 +926,12 @@ FailurePath: /* Is this a static snap? */ if (Static) { + /* Inform the debug log */ + if (IsOrdinal) + DPRINT1("Failed to snap ordinal 0x%x\n", OriginalOrdinal); + else + DPRINT1("Failed to snap %s\n", ImportName); + /* These are critical errors. Setup a string for the DLL name */ RtlInitAnsiString(&TempString, DllName ? DllName : "Unknown"); RtlAnsiStringToUnicodeString(&HardErrorDllName, &TempString, TRUE); @@ -944,6 +983,14 @@ FailurePath: /* Return ordinal error */ RtlRaiseStatus(STATUS_ORDINAL_NOT_FOUND); } + else + { + /* Inform the debug log */ + if (IsOrdinal) + DPRINT("Non-fatal: Failed to snap ordinal 0x%x\n", OriginalOrdinal); + else + DPRINT("Non-fatal: Failed to snap %s\n", ImportName); + } /* Set this as a bad DLL */ Thunk->u1.Function = (ULONG_PTR)0xffbadd11; diff --git a/dll/ntdll/ldr/ldrutils.c b/dll/ntdll/ldr/ldrutils.c index 8c2783755ae..e3443125afa 100644 --- a/dll/ntdll/ldr/ldrutils.c +++ b/dll/ntdll/ldr/ldrutils.c @@ -15,26 +15,322 @@ /* GLOBALS *******************************************************************/ -PLDR_DATA_TABLE_ENTRY LdrpLoadedDllHandleCache; - -#define LDR_GET_HASH_ENTRY(x) (RtlUpcaseUnicodeChar((x)) & (LDR_HASH_TABLE_ENTRIES - 1)) +PLDR_DATA_TABLE_ENTRY LdrpLoadedDllHandleCache, LdrpGetModuleHandleCache; +BOOLEAN g_ShimsEnabled; /* FUNCTIONS *****************************************************************/ +NTSTATUS +NTAPI +LdrpAllocateUnicodeString(IN OUT PUNICODE_STRING StringOut, + IN ULONG Length) +{ + /* Sanity checks */ + ASSERT(StringOut); + ASSERT(Length <= UNICODE_STRING_MAX_BYTES); + + /* Assume failure */ + StringOut->Length = 0; + + /* Make sure it's not mis-aligned */ + if (Length & 1) + { + /* Fail */ + StringOut->Buffer = NULL; + StringOut->MaximumLength = 0; + return STATUS_INVALID_PARAMETER; + } + + /* Allocate the string*/ + StringOut->Buffer = RtlAllocateHeap(RtlGetProcessHeap(), + 0, + StringOut->Length + sizeof(WCHAR)); + if (!StringOut->Buffer) + { + /* Fail */ + StringOut->MaximumLength = 0; + return STATUS_NO_MEMORY; + } + + /* Null-terminate it */ + StringOut->Buffer[StringOut->Length / sizeof(WCHAR)] = UNICODE_NULL; + + /* Check if this is a maximum-sized string */ + if (StringOut->Length != UNICODE_STRING_MAX_BYTES) + { + /* It's not, so set the maximum length to be one char more */ + StringOut->MaximumLength = StringOut->Length + sizeof(UNICODE_NULL); + } + else + { + /* The length is already the maximum possible */ + StringOut->MaximumLength = UNICODE_STRING_MAX_BYTES; + } + + /* Return success */ + return STATUS_SUCCESS; +} + +VOID +NTAPI +LdrpFreeUnicodeString(IN PUNICODE_STRING StringIn) +{ + ASSERT(StringIn != NULL); + + /* If Buffer is not NULL - free it */ + if (StringIn->Buffer) + { + RtlFreeHeap(RtlGetProcessHeap(), 0, StringIn->Buffer); + } + + /* Zero it out */ + RtlInitEmptyUnicodeString(StringIn, NULL, 0); +} BOOLEAN NTAPI -LdrpCallDllEntry(PDLLMAIN_FUNC EntryPoint, - PVOID BaseAddress, - ULONG Reason, - PVOID Context) +LdrpCallInitRoutine(IN PDLL_INIT_ROUTINE EntryPoint, + IN PVOID BaseAddress, + IN ULONG Reason, + IN PVOID Context) { /* Call the entry */ return EntryPoint(BaseAddress, Reason, Context); } +/* NOTE: This function is broken */ VOID NTAPI -LdrpTlsCallback(PVOID BaseAddress, ULONG Reason) +LdrpUpdateLoadCount3(IN PLDR_DATA_TABLE_ENTRY LdrEntry, + IN ULONG Flags, + OUT PUNICODE_STRING UpdateString) +{ + PIMAGE_BOUND_FORWARDER_REF NewImportForwarder; + PIMAGE_BOUND_IMPORT_DESCRIPTOR BoundEntry; + PIMAGE_IMPORT_DESCRIPTOR ImportEntry; + PIMAGE_THUNK_DATA FirstThunk; + PLDR_DATA_TABLE_ENTRY Entry; + PUNICODE_STRING ImportNameUnic; + ANSI_STRING ImportNameAnsi; + LPSTR ImportName; + ULONG ImportSize; + NTSTATUS Status; + ULONG i; + + /* Check the action we need to perform */ + if (Flags == LDRP_UPDATE_REFCOUNT) + { + /* Make sure entry is not being loaded already */ + if (LdrEntry->Flags & LDRP_LOAD_IN_PROGRESS) + return; + + LdrEntry->Flags |= LDRP_LOAD_IN_PROGRESS; + } + else if (Flags == LDRP_UPDATE_DEREFCOUNT) + { + /* Make sure the entry is not being unloaded already */ + if (LdrEntry->Flags & LDRP_UNLOAD_IN_PROGRESS) + return; + + LdrEntry->Flags |= LDRP_UNLOAD_IN_PROGRESS; + } + + /* Go through all bound DLLs and dereference them */ + ImportNameUnic = &NtCurrentTeb()->StaticUnicodeString; + + /* Try to get the new import entry */ + BoundEntry = (PIMAGE_BOUND_IMPORT_DESCRIPTOR)RtlImageDirectoryEntryToData(LdrEntry->DllBase, + TRUE, + IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT, + &ImportSize); + + if (BoundEntry) + { + /* Set entry flags if refing/derefing */ + if (Flags == LDRP_UPDATE_REFCOUNT) + LdrEntry->Flags |= LDRP_LOAD_IN_PROGRESS; + else if (Flags == LDRP_UPDATE_DEREFCOUNT) + LdrEntry->Flags |= LDRP_UNLOAD_IN_PROGRESS; + + while (BoundEntry->OffsetModuleName) + { + /* Get pointer to the current import name */ + ImportName = (PCHAR)BoundEntry + BoundEntry->OffsetModuleName; + + RtlInitAnsiString(&ImportNameAnsi, ImportName); + Status = RtlAnsiStringToUnicodeString(ImportNameUnic, &ImportNameAnsi, FALSE); + + if (NT_SUCCESS(Status)) + { + if (LdrpCheckForLoadedDll(NULL, + ImportNameUnic, + TRUE, + FALSE, + &Entry)) + { + if (Entry->LoadCount != 0xFFFF) + { + /* Perform the required action */ + switch (Flags) + { + case LDRP_UPDATE_REFCOUNT: + Entry->LoadCount++; + break; + case LDRP_UPDATE_DEREFCOUNT: + Entry->LoadCount--; + break; + case LDRP_UPDATE_PIN: + Entry->LoadCount = 0xFFFF; + break; + } + + /* Show snaps */ + if (ShowSnaps) + { + DPRINT1("LDR: Flags %d %wZ (%lx)\n", Flags, ImportNameUnic, Entry->LoadCount); + } + } + + /* Recurse into this entry */ + LdrpUpdateLoadCount3(Entry, Flags, UpdateString); + } + } + + /* Go through forwarders */ + NewImportForwarder = (PIMAGE_BOUND_FORWARDER_REF)(BoundEntry + 1); + for (i=0; iNumberOfModuleForwarderRefs; i++) + { + ImportName = (PCHAR)BoundEntry + NewImportForwarder->OffsetModuleName; + + RtlInitAnsiString(&ImportNameAnsi, ImportName); + Status = RtlAnsiStringToUnicodeString(ImportNameUnic, &ImportNameAnsi, FALSE); + if (NT_SUCCESS(Status)) + { + if (LdrpCheckForLoadedDll(NULL, + ImportNameUnic, + TRUE, + FALSE, + &Entry)) + { + if (Entry->LoadCount != 0xFFFF) + { + /* Perform the required action */ + switch (Flags) + { + case LDRP_UPDATE_REFCOUNT: + Entry->LoadCount++; + break; + case LDRP_UPDATE_DEREFCOUNT: + Entry->LoadCount--; + break; + case LDRP_UPDATE_PIN: + Entry->LoadCount = 0xFFFF; + break; + } + + /* Show snaps */ + if (ShowSnaps) + { + DPRINT1("LDR: Flags %d %wZ (%lx)\n", Flags, ImportNameUnic, Entry->LoadCount); + } + } + + /* Recurse into this entry */ + LdrpUpdateLoadCount3(Entry, Flags, UpdateString); + } + } + + NewImportForwarder++; + } + + BoundEntry = (PIMAGE_BOUND_IMPORT_DESCRIPTOR)NewImportForwarder; + } + + /* We're done */ + return; + } + + /* Check oldstyle import descriptor */ + ImportEntry = (PIMAGE_IMPORT_DESCRIPTOR)RtlImageDirectoryEntryToData(LdrEntry->DllBase, + TRUE, + IMAGE_DIRECTORY_ENTRY_IMPORT, + &ImportSize); + if (ImportEntry) + { + /* There is old one, so go through its entries */ + while (ImportEntry->Name && ImportEntry->FirstThunk) + { + FirstThunk = (PIMAGE_THUNK_DATA)((ULONG_PTR)LdrEntry->DllBase + ImportEntry->FirstThunk); + + /* Skip this entry if needed */ + if (!FirstThunk->u1.Function) + { + ImportEntry++; + continue; + } + + ImportName = (PSZ)((ULONG_PTR)LdrEntry->DllBase + ImportEntry->Name); + + RtlInitAnsiString(&ImportNameAnsi, ImportName); + Status = RtlAnsiStringToUnicodeString(ImportNameUnic, &ImportNameAnsi, FALSE); + if (NT_SUCCESS(Status)) + { + if (LdrpCheckForLoadedDll(NULL, + ImportNameUnic, + TRUE, + FALSE, + &Entry)) + { + if (Entry->LoadCount != 0xFFFF) + { + /* Perform the required action */ + switch (Flags) + { + case LDRP_UPDATE_REFCOUNT: + Entry->LoadCount++; + break; + case LDRP_UPDATE_DEREFCOUNT: + Entry->LoadCount--; + break; + case LDRP_UPDATE_PIN: + Entry->LoadCount = 0xFFFF; + break; + } + + /* Show snaps */ + if (ShowSnaps) + { + DPRINT1("LDR: Flags %d %wZ (%lx)\n", Flags, ImportNameUnic, Entry->LoadCount); + } + } + + /* Recurse */ + LdrpUpdateLoadCount3(Entry, Flags, UpdateString); + } + } + + /* Go to the next entry */ + ImportEntry++; + } + } +} + +VOID +NTAPI +LdrpUpdateLoadCount2(IN PLDR_DATA_TABLE_ENTRY LdrEntry, + IN ULONG Flags) +{ + WCHAR Buffer[MAX_PATH]; + UNICODE_STRING UpdateString; + + /* Setup the string and call the extended API */ + RtlInitEmptyUnicodeString(&UpdateString, Buffer, sizeof(Buffer)); + LdrpUpdateLoadCount3(LdrEntry, Flags, &UpdateString); +} + +VOID +NTAPI +LdrpCallTlsInitializers(IN PVOID BaseAddress, + IN ULONG Reason) { PIMAGE_TLS_DIRECTORY TlsDirectory; PIMAGE_TLS_CALLBACK *Array, Callback; @@ -49,31 +345,39 @@ LdrpTlsCallback(PVOID BaseAddress, ULONG Reason) /* Protect against invalid pointers */ _SEH2_TRY { - /* Make sure it's valid and we have an array */ - if (TlsDirectory && (Array = (PIMAGE_TLS_CALLBACK *)TlsDirectory->AddressOfCallBacks)) + /* Make sure it's valid */ + if (TlsDirectory) { - /* Display debug */ - if (ShowSnaps) + /* Get the array */ + Array = (PIMAGE_TLS_CALLBACK *)TlsDirectory->AddressOfCallBacks; + if (Array) { - DPRINT1("LDR: Tls Callbacks Found. Imagebase %p Tls %p CallBacks %p\n", - BaseAddress, TlsDirectory, Array); - } - - /* Loop the array */ - while (*Array) - { - /* Get the TLS Entrypoint */ - Callback = *Array++; - /* Display debug */ if (ShowSnaps) { - DPRINT1("LDR: Calling Tls Callback Imagebase %p Function %p\n", - BaseAddress, Callback); + DPRINT1("LDR: Tls Callbacks Found. Imagebase %p Tls %p CallBacks %p\n", + BaseAddress, TlsDirectory, Array); } - /* Call it */ - LdrpCallDllEntry((PDLLMAIN_FUNC)Callback, BaseAddress, Reason, NULL); + /* Loop the array */ + while (*Array) + { + /* Get the TLS Entrypoint */ + Callback = *Array++; + + /* Display debug */ + if (ShowSnaps) + { + DPRINT1("LDR: Calling Tls Callback Imagebase %p Function %p\n", + BaseAddress, Callback); + } + + /* Call it */ + LdrpCallInitRoutine((PDLL_INIT_ROUTINE)Callback, + BaseAddress, + Reason, + NULL); + } } } } @@ -84,27 +388,450 @@ LdrpTlsCallback(PVOID BaseAddress, ULONG Reason) _SEH2_END; } +NTSTATUS +NTAPI +LdrpCodeAuthzCheckDllAllowed(IN PUNICODE_STRING FullName, + IN HANDLE DllHandle) +{ + /* Not implemented */ + return STATUS_SUCCESS; +} + +NTSTATUS +NTAPI +LdrpCreateDllSection(IN PUNICODE_STRING FullName, + IN HANDLE DllHandle, + IN PULONG DllCharacteristics OPTIONAL, + OUT PHANDLE SectionHandle) +{ + HANDLE FileHandle; + NTSTATUS Status; + OBJECT_ATTRIBUTES ObjectAttributes; + IO_STATUS_BLOCK IoStatusBlock; + ULONG_PTR HardErrorParameters[1]; + ULONG Response; + SECTION_IMAGE_INFORMATION SectionImageInfo; + + /* Check if we don't already have a handle */ + if (!DllHandle) + { + /* Create the object attributes */ + InitializeObjectAttributes(&ObjectAttributes, + FullName, + OBJ_CASE_INSENSITIVE, + NULL, + NULL); + + /* Open the DLL */ + Status = NtOpenFile(&FileHandle, + SYNCHRONIZE | FILE_EXECUTE | FILE_READ_DATA, + &ObjectAttributes, + &IoStatusBlock, + FILE_SHARE_READ | FILE_SHARE_DELETE, + FILE_NON_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT); + + /* Check if we failed */ + if (!NT_SUCCESS(Status)) + { + /* Attempt to open for execute only */ + Status = NtOpenFile(&FileHandle, + SYNCHRONIZE | FILE_EXECUTE, + &ObjectAttributes, + &IoStatusBlock, + FILE_SHARE_READ | FILE_SHARE_DELETE, + FILE_NON_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT); + + /* Check if this failed too */ + if (!NT_SUCCESS(Status)) + { + /* Show debug message */ + if (ShowSnaps) + { + DPRINT1("LDR: LdrpCreateDllSection - NtOpenFile failed; status = %x\n", + Status); + } + + /* Make sure to return an expected status code */ + if (Status == STATUS_OBJECT_NAME_NOT_FOUND) + { + /* Callers expect this instead */ + Status = STATUS_DLL_NOT_FOUND; + } + + /* Return an empty section handle */ + *SectionHandle = NULL; + return Status; + } + } + } + else + { + /* Use the handle we already have */ + FileHandle = DllHandle; + } + + /* Create a section for the DLL */ + Status = NtCreateSection(SectionHandle, + SECTION_MAP_READ | SECTION_MAP_EXECUTE | + SECTION_MAP_WRITE | SECTION_QUERY, + NULL, + NULL, + PAGE_EXECUTE, + SEC_IMAGE, + FileHandle); + + /* If mapping failed, raise a hard error */ + if (!NT_SUCCESS(Status)) + { + /* Forget the handle */ + *SectionHandle = NULL; + + /* Give the DLL name */ + HardErrorParameters[0] = (ULONG_PTR)FullName; + + /* Raise the error */ + ZwRaiseHardError(STATUS_INVALID_IMAGE_FORMAT, + 1, + 1, + HardErrorParameters, + OptionOk, + &Response); + + /* Increment the error count */ + if (LdrpInLdrInit) LdrpFatalHardErrorCount++; + } + + /* Check for Safer restrictions */ + if (DllCharacteristics && + !(*DllCharacteristics & IMAGE_FILE_SYSTEM)) + { + /* Make sure it's executable */ + Status = ZwQuerySection(*SectionHandle, + SectionImageInformation, + &SectionImageInfo, + sizeof(SECTION_IMAGE_INFORMATION), + NULL); + if (NT_SUCCESS(Status)) + { + /* Bypass the check for .NET images */ + if (!(SectionImageInfo.LoaderFlags & IMAGE_LOADER_FLAGS_COMPLUS)) + { + /* Check with Safer */ + Status = LdrpCodeAuthzCheckDllAllowed(FullName, DllHandle); + if (!NT_SUCCESS(Status) && (Status != STATUS_NOT_FOUND)) + { + /* Show debug message */ + if (ShowSnaps) + { + DPRINT1("LDR: Loading of (%wZ) blocked by Winsafer\n", + &FullName); + } + + /* Failure case, close section handle */ + NtClose(*SectionHandle); + *SectionHandle = NULL; + } + } + } + else + { + /* Failure case, close section handle */ + NtClose(*SectionHandle); + *SectionHandle = NULL; + } + } + + /* Close the file handle, we don't need it */ + NtClose(FileHandle); + + /* Return status */ + return Status; +} + +/* NOTE: This function is totally b0rked and doesn't handle the parameters/functionality it should */ +BOOLEAN +NTAPI +LdrpResolveDllName(PWSTR DllPath, + PWSTR DllName, + PUNICODE_STRING FullDllName, + PUNICODE_STRING BaseDllName) +{ + PWCHAR NameBuffer, p1, p2 = 0; + ULONG Length; + ULONG BufSize = 500; + + /* Allocate space for full DLL name */ + FullDllName->Buffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, BufSize + sizeof(UNICODE_NULL)); + if (!FullDllName->Buffer) return FALSE; + + Length = RtlDosSearchPath_U(DllPath ? DllPath : LdrpDefaultPath.Buffer, + DllName, + NULL, + BufSize, + FullDllName->Buffer, + &BaseDllName->Buffer); + + if (!Length || Length > BufSize) + { + if (ShowSnaps) + { + DPRINT1("LDR: LdrResolveDllName - Unable to find "); + DPRINT1("%ws from %ws\n", DllName, DllPath ? DllPath : LdrpDefaultPath.Buffer); + } + + RtlFreeUnicodeString(FullDllName); + return FALSE; + } + + /* Construct full DLL name */ + FullDllName->Length = Length; + FullDllName->MaximumLength = FullDllName->Length + sizeof(UNICODE_NULL); + + /* Allocate a new buffer */ + NameBuffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, FullDllName->MaximumLength); + if (!NameBuffer) + { + RtlFreeHeap(RtlGetProcessHeap(), 0, FullDllName->Buffer); + return FALSE; + } + + /* Copy over the contents from the previous one and free it */ + RtlCopyMemory(NameBuffer, FullDllName->Buffer, FullDllName->MaximumLength); + RtlFreeHeap(RtlGetProcessHeap(), 0, FullDllName->Buffer); + FullDllName->Buffer = NameBuffer; + + /* Find last backslash */ + p1 = FullDllName->Buffer; + while (*p1) + { + if (*p1++ == L'\\') + { + p2 = p1; + } + } + + /* If found, set p1 to it, otherwise p1 points to the beginning of DllName */ + if (p2) + p1 = p2; + else + p1 = DllName; + + p2 = p1; + + /* Calculate remaining length */ + while (*p1) ++p1; + + /* Construct base DLL name */ + BaseDllName->Length = (ULONG_PTR)p1 - (ULONG_PTR)p2; + BaseDllName->MaximumLength = BaseDllName->Length + sizeof(UNICODE_NULL); + BaseDllName->Buffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, BaseDllName->MaximumLength); + + if (!BaseDllName->Buffer) + { + RtlFreeHeap(RtlGetProcessHeap(), 0, NameBuffer); + return FALSE; + } + + /* Copy base dll name to the new buffer */ + RtlMoveMemory(BaseDllName->Buffer, + p2, + BaseDllName->Length); + + /* Null-terminate the string */ + BaseDllName->Buffer[BaseDllName->Length / sizeof(WCHAR)] = 0; + + return TRUE; +} + PVOID NTAPI -LdrpFetchAddressOfEntryPoint(PVOID ImageBase) +LdrpFetchAddressOfEntryPoint(IN PVOID ImageBase) { PIMAGE_NT_HEADERS NtHeaders; - ULONG_PTR EntryPoint; + ULONG_PTR EntryPoint = 0; /* Get entry point offset from NT headers */ NtHeaders = RtlImageNtHeader(ImageBase); - EntryPoint = NtHeaders->OptionalHeader.AddressOfEntryPoint; + if (NtHeaders) + { + /* Add image base */ + EntryPoint = NtHeaders->OptionalHeader.AddressOfEntryPoint; + if (EntryPoint) EntryPoint += (ULONG_PTR)ImageBase; + } - /* If it's 0 - return so */ - if (!EntryPoint) return NULL; - - /* Add image base */ - EntryPoint += (ULONG_PTR)ImageBase; - - /* Return calculated pointer */ + /* Return calculated pointer (or zero in case of failure) */ return (PVOID)EntryPoint; } +/* NOTE: This function is broken, wrong number of parameters, no SxS, etc */ +HANDLE +NTAPI +LdrpCheckForKnownDll(PWSTR DllName, + PUNICODE_STRING FullDllName, + PUNICODE_STRING BaseDllName) +{ + OBJECT_ATTRIBUTES ObjectAttributes; + HANDLE Section = NULL; + UNICODE_STRING DllNameUnic; + NTSTATUS Status; + PCHAR p1; + PWCHAR p2; + + /* Upgrade DllName to a unicode string */ + RtlInitUnicodeString(&DllNameUnic, DllName); + + /* Get the activation context */ + Status = RtlFindActivationContextSectionString(0, + NULL, + ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION, + &DllNameUnic, + NULL); + + /* Check if it's a SxS or not */ + if (Status == STATUS_SXS_SECTION_NOT_FOUND || + Status == STATUS_SXS_KEY_NOT_FOUND) + { + /* Set up BaseDllName */ + BaseDllName->Length = DllNameUnic.Length; + BaseDllName->MaximumLength = DllNameUnic.MaximumLength; + BaseDllName->Buffer = RtlAllocateHeap(RtlGetProcessHeap(), + 0, + DllNameUnic.MaximumLength); + if (!BaseDllName->Buffer) return NULL; + + /* Copy the contents there */ + RtlMoveMemory(BaseDllName->Buffer, DllNameUnic.Buffer, DllNameUnic.MaximumLength); + + /* Set up FullDllName */ + FullDllName->Length = LdrpKnownDllPath.Length + BaseDllName->Length + sizeof(WCHAR); + FullDllName->MaximumLength = FullDllName->Length + sizeof(UNICODE_NULL); + FullDllName->Buffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, FullDllName->MaximumLength); + if (!FullDllName->Buffer) + { + /* Free base name and fail */ + RtlFreeHeap(RtlGetProcessHeap(), 0, BaseDllName->Buffer); + return NULL; + } + + RtlMoveMemory(FullDllName->Buffer, LdrpKnownDllPath.Buffer, LdrpKnownDllPath.Length); + + /* Put a slash there */ + p1 = (PCHAR)FullDllName->Buffer + LdrpKnownDllPath.Length; + p2 = (PWCHAR)p1; + *p2++ = (WCHAR)'\\'; + p1 = (PCHAR)p2; + + /* Set up DllNameUnic for a relative path */ + DllNameUnic.Buffer = (PWSTR)p1; + DllNameUnic.Length = BaseDllName->Length; + DllNameUnic.MaximumLength = DllNameUnic.Length + sizeof(UNICODE_NULL); + + /* Copy the contents */ + RtlMoveMemory(p1, BaseDllName->Buffer, BaseDllName->MaximumLength); + + /* There are all names, init attributes and open the section */ + InitializeObjectAttributes(&ObjectAttributes, + &DllNameUnic, + OBJ_CASE_INSENSITIVE, + LdrpKnownDllObjectDirectory, + NULL); + + Status = NtOpenSection(&Section, + SECTION_MAP_READ | SECTION_MAP_EXECUTE | SECTION_MAP_WRITE, + &ObjectAttributes); + if (!NT_SUCCESS(Status)) + { + /* Opening failed, free resources */ + Section = NULL; + RtlFreeHeap(RtlGetProcessHeap(), 0, BaseDllName->Buffer); + RtlFreeHeap(RtlGetProcessHeap(), 0, FullDllName->Buffer); + } + } + else + { + if (!NT_SUCCESS(Status)) Section = NULL; + } + + /* Return section handle */ + return Section; +} + +NTSTATUS +NTAPI +LdrpSetProtection(PVOID ViewBase, + BOOLEAN Restore) +{ + PIMAGE_NT_HEADERS NtHeaders; + PIMAGE_SECTION_HEADER Section; + NTSTATUS Status; + PVOID SectionBase; + SIZE_T SectionSize; + ULONG NewProtection, OldProtection, i; + + /* Get the NT headers */ + NtHeaders = RtlImageNtHeader(ViewBase); + if (!NtHeaders) return STATUS_INVALID_IMAGE_FORMAT; + + /* Compute address of the first section header */ + Section = IMAGE_FIRST_SECTION(NtHeaders); + + /* Go through all sections */ + for (i = 0; i < NtHeaders->FileHeader.NumberOfSections; i++) + { + /* Check for read-only non-zero section */ + if ((Section->SizeOfRawData) && + !(Section->Characteristics & IMAGE_SCN_MEM_WRITE)) + { + /* Check if we are setting or restoring protection */ + if (Restore) + { + /* Set it to either EXECUTE or READONLY */ + if (Section->Characteristics & IMAGE_SCN_MEM_EXECUTE) + { + NewProtection = PAGE_EXECUTE; + } + else + { + NewProtection = PAGE_READONLY; + } + + /* Add PAGE_NOCACHE if needed */ + if (Section->Characteristics & IMAGE_SCN_MEM_NOT_CACHED) + { + NewProtection |= PAGE_NOCACHE; + } + } + else + { + /* Enable write access */ + NewProtection = PAGE_READWRITE; + } + + /* Get the section VA */ + SectionBase = (PVOID)((ULONG_PTR)ViewBase + Section->VirtualAddress); + SectionSize = Section->SizeOfRawData; + if (SectionSize) + { + /* Set protection */ + Status = ZwProtectVirtualMemory(NtCurrentProcess(), + &SectionBase, + &SectionSize, + NewProtection, + &OldProtection); + if (!NT_SUCCESS(Status)) return Status; + } + } + + /* Move to the next section */ + Section++; + } + + /* Flush instruction cache if necessary */ + if (Restore) ZwFlushInstructionCache(NtCurrentProcess(), NULL, 0); + return STATUS_SUCCESS; +} + +/* NOTE: Not yet reviewed */ NTSTATUS NTAPI LdrpMapDll(IN PWSTR SearchPath OPTIONAL, @@ -115,8 +842,504 @@ LdrpMapDll(IN PWSTR SearchPath OPTIONAL, IN BOOLEAN Redirect, OUT PLDR_DATA_TABLE_ENTRY *DataTableEntry) { - UNIMPLEMENTED; - return STATUS_SUCCESS; + PTEB Teb = NtCurrentTeb(); + PPEB Peb = NtCurrentPeb(); + PWCHAR p1 = DllName; + WCHAR TempChar; + BOOLEAN KnownDll = FALSE; + UNICODE_STRING FullDllName, BaseDllName; + HANDLE SectionHandle = NULL, DllHandle = 0; + UNICODE_STRING NtPathDllName; + ULONG_PTR HardErrorParameters[2]; + UNICODE_STRING HardErrorDllName, HardErrorDllPath; + ULONG Response; + SIZE_T ViewSize = 0; + PVOID ViewBase = NULL; + PVOID ArbitraryUserPointer; + PIMAGE_NT_HEADERS NtHeaders; + NTSTATUS HardErrorStatus, Status; + BOOLEAN OverlapDllFound = FALSE; + ULONG_PTR ImageBase, ImageEnd; + PLIST_ENTRY ListHead, NextEntry; + PLDR_DATA_TABLE_ENTRY CandidateEntry, LdrEntry; + ULONG_PTR CandidateBase, CandidateEnd; + UNICODE_STRING OverlapDll; + BOOLEAN RelocatableDll = TRUE; + UNICODE_STRING IllegalDll; + PVOID RelocData; + ULONG RelocDataSize = 0; + + // FIXME: AppCompat stuff is missing + + if (ShowSnaps) + { + DPRINT1("LDR: LdrpMapDll: Image Name %ws, Search Path %ws\n", + DllName, + SearchPath ? SearchPath : L""); + } + + /* Check if we have a known dll directory */ + if (LdrpKnownDllObjectDirectory) + { + /* Check if the path is full */ + while (*p1) + { + TempChar = *p1++; + if (TempChar == '\\' || TempChar == '/' ) + { + /* Complete path, don't do Known Dll lookup */ + goto SkipCheck; + } + } + + /* Try to find a Known DLL */ + SectionHandle = LdrpCheckForKnownDll(DllName, + &FullDllName, + &BaseDllName); + } + +SkipCheck: + + /* Check if the Known DLL Check returned something */ + if (!SectionHandle) + { + /* It didn't, so try to resolve the name now */ + if (LdrpResolveDllName(SearchPath, + DllName, + &FullDllName, + &BaseDllName)) + { + /* Got a name, display a message */ + if (ShowSnaps) + { + DPRINT1("LDR: Loading (%s) %wZ\n", + Static ? "STATIC" : "DYNAMIC", + &FullDllName); + } + + /* Convert to NT Name */ + if (!RtlDosPathNameToNtPathName_U(FullDllName.Buffer, + &NtPathDllName, + NULL, + NULL)) + { + /* Path was invalid */ + return STATUS_OBJECT_PATH_SYNTAX_BAD; + } + + /* Create a section for this dLL */ + Status = LdrpCreateDllSection(&NtPathDllName, + DllHandle, + DllCharacteristics, + &SectionHandle); + + /* Free the NT Name */ + RtlFreeHeap(RtlGetProcessHeap(), 0, NtPathDllName.Buffer); + + /* If we failed */ + if (!NT_SUCCESS(Status)) + { + /* Free the name strings and return */ + RtlFreeUnicodeString(&FullDllName); + RtlFreeUnicodeString(&BaseDllName); + return Status; + } + } + else + { + /* We couldn't resolve the name, is this a static load? */ + if (Static) + { + /* + * This is BAD! Static loads are CRITICAL. Bugcheck! + * Initialize the strings for the error + */ + RtlInitUnicodeString(&HardErrorDllName, DllName); + RtlInitUnicodeString(&HardErrorDllPath, + DllPath2 ? DllPath2 : LdrpDefaultPath.Buffer); + + /* Set them as error parameters */ + HardErrorParameters[0] = (ULONG_PTR)&HardErrorDllName; + HardErrorParameters[1] = (ULONG_PTR)&HardErrorDllPath; + + /* Raise the hard error */ + NtRaiseHardError(STATUS_DLL_NOT_FOUND, + 2, + 0x00000003, + HardErrorParameters, + OptionOk, + &Response); + + /* We're back, where we initializing? */ + if (LdrpInLdrInit) LdrpFatalHardErrorCount++; + } + + /* Return failure */ + return STATUS_DLL_NOT_FOUND; + } + } + else + { + /* We have a section handle, so this is a known dll */ + KnownDll = TRUE; + } + + /* Stuff the image name in the TIB, for the debugger */ + ArbitraryUserPointer = Teb->NtTib.ArbitraryUserPointer; + Teb->NtTib.ArbitraryUserPointer = FullDllName.Buffer; + + /* Map the DLL */ + ViewBase = NULL; + ViewSize = 0; + Status = NtMapViewOfSection(SectionHandle, + NtCurrentProcess(), + &ViewBase, + 0, + 0, + NULL, + &ViewSize, + ViewShare, + 0, + PAGE_READWRITE); + + /* Restore */ + Teb->NtTib.ArbitraryUserPointer = ArbitraryUserPointer; + + /* Fail if we couldn't map it */ + if (!NT_SUCCESS(Status)) + { + /* Close and return */ + NtClose(SectionHandle); + return Status; + } + + /* Get the NT Header */ + if (!(NtHeaders = RtlImageNtHeader(ViewBase))) + { + /* Invalid image, unmap, close handle and fail */ + NtUnmapViewOfSection(NtCurrentProcess(), ViewBase); + NtClose(SectionHandle); + return STATUS_INVALID_IMAGE_FORMAT; + } + + // FIXME: .NET support is missing + + /* Allocate an entry */ + if (!(LdrEntry = LdrpAllocateDataTableEntry(ViewBase))) + { + /* Invalid image, unmap, close handle and fail */ + NtUnmapViewOfSection(NtCurrentProcess(), ViewBase); + NtClose(SectionHandle); + return STATUS_NO_MEMORY; + } + + /* Setup the entry */ + LdrEntry->Flags = Static ? LDRP_STATIC_LINK : 0; + if (Redirect) LdrEntry->Flags |= LDRP_REDIRECTED; + LdrEntry->LoadCount = 0; + LdrEntry->FullDllName = FullDllName; + LdrEntry->BaseDllName = BaseDllName; + LdrEntry->EntryPoint = LdrpFetchAddressOfEntryPoint(LdrEntry->DllBase); + + /* Show debug message */ + if (ShowSnaps) + { + DPRINT1("LDR: LdrpMapDll: Full Name %wZ, Base Name %wZ\n", + &FullDllName, + &BaseDllName); + } + + /* Insert this entry */ + LdrpInsertMemoryTableEntry(LdrEntry); + + // LdrpSendDllNotifications(LdrEntry, TRUE, Status == STATUS_IMAGE_NOT_AT_BASE) + + /* Check for invalid CPU Image */ + if (Status == STATUS_IMAGE_MACHINE_TYPE_MISMATCH) + { + /* Load our header */ + PIMAGE_NT_HEADERS ImageNtHeader = RtlImageNtHeader(Peb->ImageBaseAddress); + + /* Assume defaults if we don't have to run the Hard Error path */ + HardErrorStatus = STATUS_SUCCESS; + Response = ResponseCancel; + + /* Are we an NT 3.0 image? [Do these still exist? LOL -- IAI] */ + if (ImageNtHeader->OptionalHeader.MajorSubsystemVersion <= 3) + { + /* Reset the entrypoint, save our Dll Name */ + LdrEntry->EntryPoint = 0; + HardErrorParameters[0] = (ULONG_PTR)&FullDllName; + + /* Raise the error */ + HardErrorStatus = ZwRaiseHardError(STATUS_IMAGE_MACHINE_TYPE_MISMATCH, + 1, + 1, + HardErrorParameters, + OptionOkCancel, + &Response); + } + + /* Check if the user pressed cancel */ + if (NT_SUCCESS(HardErrorStatus) && Response == ResponseCancel) + { + /* Remove the DLL from the lists */ + RemoveEntryList(&LdrEntry->InLoadOrderLinks); + RemoveEntryList(&LdrEntry->InMemoryOrderModuleList); + RemoveEntryList(&LdrEntry->HashLinks); + + /* Remove the LDR Entry */ + RtlFreeHeap(RtlGetProcessHeap(), 0, LdrEntry ); + + /* Unmap and close section */ + NtUnmapViewOfSection(NtCurrentProcess(), ViewBase); + NtClose(SectionHandle); + + /* Did we do a hard error? */ + if (ImageNtHeader->OptionalHeader.MajorSubsystemVersion <= 3) + { + /* Yup, so increase fatal error count if we are initializing */ + if (LdrpInLdrInit) LdrpFatalHardErrorCount++; + } + + /* Return failure */ + return STATUS_INVALID_IMAGE_FORMAT; + } + } + else + { + /* The image was valid. Is it a DLL? */ + if (NtHeaders->FileHeader.Characteristics & IMAGE_FILE_DLL) + { + /* Set the DLL Flag */ + LdrEntry->Flags |= LDRP_IMAGE_DLL; + } + + /* If we're not a DLL, clear the entrypoint */ + if (!(LdrEntry->Flags & LDRP_IMAGE_DLL)) + { + LdrEntry->EntryPoint = 0; + } + } + + /* Return it for the caller */ + *DataTableEntry = LdrEntry; + + /* Check if we loaded somewhere else */ + if (Status == STATUS_IMAGE_NOT_AT_BASE) + { + /* Write the flag */ + LdrEntry->Flags |= LDRP_IMAGE_NOT_AT_BASE; + + /* Find our region */ + ImageBase = (ULONG_PTR)NtHeaders->OptionalHeader.ImageBase; + ImageEnd = ImageBase + ViewSize; + + DPRINT1("LDR: LdrpMapDll Relocating Image Name %ws (%p -> %p)\n", DllName, ImageBase, ViewBase); + + /* Scan all the modules */ + ListHead = &Peb->Ldr->InLoadOrderModuleList; + NextEntry = ListHead->Flink; + while (NextEntry != ListHead) + { + /* Get the entry */ + CandidateEntry = CONTAINING_RECORD(NextEntry, + LDR_DATA_TABLE_ENTRY, + InLoadOrderLinks); + NextEntry = NextEntry->Flink; + + /* Get the entry's bounds */ + CandidateBase = (ULONG_PTR)CandidateEntry->DllBase; + CandidateEnd = CandidateBase + CandidateEntry->SizeOfImage; + + /* Make sure this entry isn't unloading */ + if (!CandidateEntry->InMemoryOrderModuleList.Flink) continue; + + /* Check if our regions are colliding */ + if ((ImageBase >= CandidateBase && ImageBase <= CandidateEnd) || + (ImageEnd >= CandidateBase && ImageEnd <= CandidateEnd) || + (CandidateBase >= ImageBase && CandidateBase <= ImageEnd)) + { + /* Found who is overlapping */ + OverlapDllFound = TRUE; + OverlapDll = CandidateEntry->FullDllName; + break; + } + } + + /* Check if we found the DLL overlapping with us */ + if (!OverlapDllFound) + { + /* It's not another DLL, it's memory already here */ + RtlInitUnicodeString(&OverlapDll, L"Dynamically Allocated Memory"); + } + + DPRINT1("Overlapping DLL: %wZ\n", &OverlapDll); + + /* Are we dealing with a DLL? */ + if (LdrEntry->Flags & LDRP_IMAGE_DLL) + { + /* Check if relocs were stripped */ + if (!(NtHeaders->FileHeader.Characteristics & IMAGE_FILE_RELOCS_STRIPPED)) + { + /* Get the relocation data */ + RelocData = RtlImageDirectoryEntryToData(ViewBase, + TRUE, + IMAGE_DIRECTORY_ENTRY_BASERELOC, + &RelocDataSize); + + /* Does the DLL not have any? */ + if (!RelocData && !RelocDataSize) + { + /* We'll allow this and simply continue */ + goto NoRelocNeeded; + } + } + + /* See if this is an Illegal DLL - IE: user32 and kernel32 */ + RtlInitUnicodeString(&IllegalDll,L"user32.dll"); + if (RtlEqualUnicodeString(&BaseDllName, &IllegalDll, TRUE)) + { + /* Can't relocate user32 */ + RelocatableDll = FALSE; + } + else + { + RtlInitUnicodeString(&IllegalDll, L"kernel32.dll"); + if (RtlEqualUnicodeString(&BaseDllName, &IllegalDll, TRUE)) + { + /* Can't relocate kernel32 */ + RelocatableDll = FALSE; + } + } + + /* Check if this was a non-relocatable DLL or a known dll */ + if (!RelocatableDll && KnownDll) + { + /* Setup for hard error */ + HardErrorParameters[0] = (ULONG_PTR)&IllegalDll; + HardErrorParameters[1] = (ULONG_PTR)&OverlapDll; + + /* Raise the error */ + ZwRaiseHardError(STATUS_ILLEGAL_DLL_RELOCATION, + 2, + 3, + HardErrorParameters, + OptionOk, + &Response); + + /* If initializing, increase the error count */ + if (LdrpInLdrInit) LdrpFatalHardErrorCount++; + + /* Don't do relocation */ + Status = STATUS_CONFLICTING_ADDRESSES; + goto NoRelocNeeded; + } + + /* Change the protection to prepare for relocation */ + Status = LdrpSetProtection(ViewBase, FALSE); + + /* Make sure we changed the protection */ + if (NT_SUCCESS(Status)) + { + /* Do the relocation */ + Status = LdrRelocateImageWithBias(ViewBase, 0LL, NULL, STATUS_SUCCESS, + STATUS_CONFLICTING_ADDRESSES, STATUS_INVALID_IMAGE_FORMAT); + + if (NT_SUCCESS(Status)) + { + /* Stuff the image name in the TIB, for the debugger */ + ArbitraryUserPointer = Teb->NtTib.ArbitraryUserPointer; + Teb->NtTib.ArbitraryUserPointer = FullDllName.Buffer; + + /* Map the DLL */ + Status = NtMapViewOfSection(SectionHandle, + NtCurrentProcess(), + &ViewBase, + 0, + 0, + NULL, + &ViewSize, + ViewShare, + 0, + PAGE_READWRITE); + + /* Restore */ + Teb->NtTib.ArbitraryUserPointer = ArbitraryUserPointer; + + /* Return the protection */ + Status = LdrpSetProtection(ViewBase, TRUE); + } + } +//FailRelocate: + /* Handle any kind of failure */ + if (!NT_SUCCESS(Status)) + { + /* Remove it from the lists */ + RemoveEntryList(&LdrEntry->InLoadOrderLinks); + RemoveEntryList(&LdrEntry->InMemoryOrderModuleList); + RemoveEntryList(&LdrEntry->HashLinks); + + /* Unmap it, clear the entry */ + NtUnmapViewOfSection(NtCurrentProcess(), ViewBase); + LdrEntry = NULL; + } + + /* Show debug message */ + if (ShowSnaps) + { + DPRINT1("LDR: Fixups %successfully re-applied @ %p\n", + NT_SUCCESS(Status) ? "s" : "uns", ViewBase); + } + } + else + { +NoRelocNeeded: + /* Not a DLL, or no relocation needed */ + Status = STATUS_SUCCESS; + + /* Stuff the image name in the TIB, for the debugger */ + ArbitraryUserPointer = Teb->NtTib.ArbitraryUserPointer; + Teb->NtTib.ArbitraryUserPointer = FullDllName.Buffer; + + /* Map the DLL */ + Status = NtMapViewOfSection(SectionHandle, + NtCurrentProcess(), + &ViewBase, + 0, + 0, + NULL, + &ViewSize, + ViewShare, + 0, + PAGE_READWRITE); + + /* Restore */ + Teb->NtTib.ArbitraryUserPointer = ArbitraryUserPointer; + + /* Show debug message */ + if (ShowSnaps) + { + DPRINT1("LDR: Fixups won't be re-applied to non-Dll @ %p\n", ViewBase); + } + } + } + + // FIXME: LdrpCheckCorImage() is missing + + /* Check if this is an SMP Machine and a DLL */ + if ((LdrpNumberOfProcessors > 1) && + (LdrEntry && (LdrEntry->Flags & LDRP_IMAGE_DLL))) + { + /* Validate the image for MP */ + LdrpValidateImageForMp(LdrEntry); + } + + // FIXME: LdrpCorUnloadImage() is missing + + /* Close section and return status */ + NtClose(SectionHandle); + return Status; } PLDR_DATA_TABLE_ENTRY @@ -124,9 +1347,12 @@ NTAPI LdrpAllocateDataTableEntry(IN PVOID BaseAddress) { PLDR_DATA_TABLE_ENTRY LdrEntry = NULL; - PIMAGE_NT_HEADERS NtHeader = RtlImageNtHeader(BaseAddress); + PIMAGE_NT_HEADERS NtHeader; /* Make sure the header is valid */ + NtHeader = RtlImageNtHeader(BaseAddress); + DPRINT("LdrpAllocateDataTableEntry(%p), NtHeader %p\n", BaseAddress, NtHeader); + if (NtHeader) { /* Allocate an entry */ @@ -141,6 +1367,7 @@ LdrpAllocateDataTableEntry(IN PVOID BaseAddress) LdrEntry->DllBase = BaseAddress; LdrEntry->SizeOfImage = NtHeader->OptionalHeader.SizeOfImage; LdrEntry->TimeDateStamp = NtHeader->FileHeader.TimeDateStamp; + LdrEntry->PatchInformation = NULL; } } @@ -155,14 +1382,38 @@ LdrpInsertMemoryTableEntry(IN PLDR_DATA_TABLE_ENTRY LdrEntry) PPEB_LDR_DATA PebData = NtCurrentPeb()->Ldr; ULONG i; - /* Get the Hash entry */ + /* Insert into hash table */ i = LDR_GET_HASH_ENTRY(LdrEntry->BaseDllName.Buffer[0]); - InsertTailList(&LdrpHashTable[i], &LdrEntry->HashLinks); + + /* Insert into other lists */ InsertTailList(&PebData->InLoadOrderModuleList, &LdrEntry->InLoadOrderLinks); InsertTailList(&PebData->InMemoryOrderModuleList, &LdrEntry->InMemoryOrderModuleList); } +VOID +NTAPI +LdrpFinalizeAndDeallocateDataTableEntry(IN PLDR_DATA_TABLE_ENTRY Entry) +{ + /* Sanity check */ + ASSERT(Entry != NULL); + + /* Release the activation context if it exists and wasn't already released */ + if ((Entry->EntryPointActivationContext) && + (Entry->EntryPointActivationContext != INVALID_HANDLE_VALUE)) + { + /* Mark it as invalid */ + RtlReleaseActivationContext(Entry->EntryPointActivationContext); + Entry->EntryPointActivationContext = INVALID_HANDLE_VALUE; + } + + /* Release the full dll name string */ + if (Entry->FullDllName.Buffer) LdrpFreeUnicodeString(&Entry->FullDllName); + + /* Finally free the entry's memory */ + RtlFreeHeap(RtlGetProcessHeap(), 0, Entry); +} + BOOLEAN NTAPI LdrpCheckForLoadedDllHandle(IN PVOID Base, @@ -172,7 +1423,8 @@ LdrpCheckForLoadedDllHandle(IN PVOID Base, PLIST_ENTRY ListHead, Next; /* Check the cache first */ - if (LdrpLoadedDllHandleCache && LdrpLoadedDllHandleCache->DllBase == Base) + if ((LdrpLoadedDllHandleCache) && + (LdrpLoadedDllHandleCache->DllBase == Base)) { /* We got lucky, return the cached entry */ *LdrEntry = LdrpLoadedDllHandleCache; @@ -182,12 +1434,12 @@ LdrpCheckForLoadedDllHandle(IN PVOID Base, /* Time for a lookup */ ListHead = &NtCurrentPeb()->Ldr->InLoadOrderModuleList; Next = ListHead->Flink; - while(Next != ListHead) + while (Next != ListHead) { /* Get the current entry */ - Current = CONTAINING_RECORD(Next, - LDR_DATA_TABLE_ENTRY, - InLoadOrderLinks); + Current = CONTAINING_RECORD(Next, + LDR_DATA_TABLE_ENTRY, + InLoadOrderLinks); /* Make sure it's not unloading and check for a match */ if ((Current->InMemoryOrderModuleList.Flink) && (Base == Current->DllBase)) @@ -208,6 +1460,315 @@ LdrpCheckForLoadedDllHandle(IN PVOID Base, return FALSE; } +NTSTATUS +NTAPI +LdrpResolveFullName(IN PUNICODE_STRING OriginalName, + IN PUNICODE_STRING PathName, + IN PUNICODE_STRING FullPathName, + IN PUNICODE_STRING *ExpandedName) +{ + NTSTATUS Status = STATUS_SUCCESS; +// RTL_PATH_TYPE PathType; +// BOOLEAN InvalidName; + ULONG Length; + + /* Display debug output if snaps are on */ + if (ShowSnaps) + { + DbgPrintEx(81, //DPFLTR_LDR_ID, + 0, + "LDR: %s - Expanding full name of %wZ\n", + __FUNCTION__, + OriginalName); + } + + /* FIXME: Lock the PEB */ + //RtlEnterCriticalSection(&FastPebLock); +#if 0 + /* Get the path name */ + Length = RtlGetFullPathName_Ustr(OriginalName, + PathName->Length, + PathName->Buffer, + NULL, + &InvalidName, + &PathType); +#else + Length = 0; +#endif + if (!(Length) || (Length > UNICODE_STRING_MAX_BYTES)) + { + /* Fail */ + Status = STATUS_NAME_TOO_LONG; + goto Quickie; + } + + /* Check if the length hasn't changed */ + if (Length <= PathName->Length) + { + /* Return the same thing */ + *ExpandedName = PathName; + PathName->Length = (USHORT)Length; + goto Quickie; + } + + /* Sanity check */ + ASSERT(Length >= sizeof(WCHAR)); + + /* Allocate a string */ + Status = LdrpAllocateUnicodeString(FullPathName, Length - sizeof(WCHAR)); + if (!NT_SUCCESS(Status)) goto Quickie; + + /* Now get the full path again */ +#if 0 + Length = RtlGetFullPathName_Ustr(OriginalName, + FullPathName->Length, + FullPathName->Buffer, + NULL, + &InvalidName, + &PathType); +#else + Length = 0; +#endif + if (!(Length) || (Length > FullPathName->Length)) + { + /* Fail */ + LdrpFreeUnicodeString(FullPathName); + Status = STATUS_NAME_TOO_LONG; + } + else + { + /* Return the expanded name */ + *ExpandedName = FullPathName; + FullPathName->Length = (USHORT)Length; + } + +Quickie: + /* FIXME: Unlock the PEB */ + //RtlLeaveCriticalSection(&FastPebLock); + + /* Display debug output if snaps are on */ + if (ShowSnaps) + { + /* Check which output to use -- failure or success */ + if (NT_SUCCESS(Status)) + { + DbgPrintEx(81, //DPFLTR_LDR_ID, + 0, + "LDR: %s - Expanded to %wZ\n", + __FUNCTION__, + *ExpandedName); + } + else + { + DbgPrintEx(81, //DPFLTR_LDR_ID, + 0, + "LDR: %s - Failed to expand %wZ; 0x%08x\n", + __FUNCTION__, + OriginalName, + Status); + } + } + + /* If we failed, return NULL */ + if (!NT_SUCCESS(Status)) *ExpandedName = NULL; + + /* Return status */ + return Status; +} + +NTSTATUS +NTAPI +LdrpSearchPath(IN PWCHAR *SearchPath, + IN PWCHAR DllName, + IN PUNICODE_STRING PathName, + IN PUNICODE_STRING FullPathName, + IN PUNICODE_STRING *ExpandedName) +{ + BOOLEAN TryAgain = FALSE; + PWCHAR ActualSearchPath = *SearchPath; + UNICODE_STRING TestName; + NTSTATUS Status; + PWCHAR Buffer, BufEnd = NULL; + ULONG Length = 0; + WCHAR p; + PWCHAR pp; + + /* Check if we don't have a search path */ + if (!ActualSearchPath) *SearchPath = LdrpDefaultPath.Buffer; + + /* Display debug output if snaps are on */ + if (ShowSnaps) + { + DbgPrintEx(81, //DPFLTR_LDR_ID, + 0, + "LDR: %s - Looking for %ws in %ws\n", + __FUNCTION__, + DllName, + *SearchPath); + } + + /* Check if we're dealing with a relative path */ + if (RtlDetermineDosPathNameType_U(DllName) != RtlPathTypeRelative) + { + /* Good, we're not. Create the name string */ + Status = RtlInitUnicodeStringEx(&TestName, DllName); + if (!NT_SUCCESS(Status)) goto Quickie; + + /* Make sure it exists */ + #if 0 + if (!RtlDoesFileExists_UstrEx(&TestName, TRUE)) + { + /* It doesn't, fail */ + Status = STATUS_DLL_NOT_FOUND; + goto Quickie; + } + #endif + + /* Resolve the full name */ + Status = LdrpResolveFullName(&TestName, + PathName, + FullPathName, + ExpandedName); + goto Quickie; + } + + /* FIXME: Handle relative case semicolon-lookup here */ + + /* Calculate length */ + Length += (ULONG)wcslen(DllName) + sizeof(UNICODE_NULL); + if (Length > UNICODE_STRING_MAX_CHARS) + { + /* Too long, fail */ + Status = STATUS_NAME_TOO_LONG; + goto Quickie; + } + + /* Allocate buffer */ + Buffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, Length * sizeof(WCHAR)); + if (!Buffer) + { + /* Fail */ + Status = STATUS_NO_MEMORY; + goto Quickie; + } + + /* FIXME: Setup TestName here */ + Status = STATUS_NOT_FOUND; + + /* Start loop */ + do + { + /* Get character */ + p = *ActualSearchPath; + if (!(p) && (p == ';')) + { + /* FIXME: We don't have a character, or is a semicolon.*/ + + /* Display debug output if snaps are on */ + if (ShowSnaps) + { + DbgPrintEx(81, //DPFLTR_LDR_ID, + 0, + "LDR: %s - Looking for %ws\n", + __FUNCTION__, + Buffer); + } + + /* Sanity check */ + TestName.Length = (USHORT)ALIGN_DOWN((BufEnd - Buffer), WCHAR); + ASSERT(TestName.Length < TestName.MaximumLength); + + /* Check if the file exists */ + #if 0 + if (RtlDoesFileExists_UstrEx(&TestName, FALSE)) + #endif + { + /* It does. Reallocate the buffer */ + TestName.MaximumLength = (USHORT)ALIGN_DOWN((BufEnd - Buffer), WCHAR) + sizeof(WCHAR); + TestName.Buffer = RtlReAllocateHeap(RtlGetProcessHeap(), + 0, + Buffer, + TestName.MaximumLength); + if (!TestName.Buffer) + { + /* Keep the old one */ + TestName.Buffer = Buffer; + } + else + { + /* Update buffer */ + Buffer = TestName.Buffer; + } + + /* Make sure we have a buffer at least */ + ASSERT(TestName.Buffer); + + /* Resolve the name */ + *SearchPath = ActualSearchPath++; + Status = LdrpResolveFullName(&TestName, + PathName, + FullPathName, + ExpandedName); + break; + } + + /* Update buffer end */ + BufEnd = Buffer; + + /* Update string position */ + pp = ActualSearchPath++; + } + else + { + /* Otherwise, write the character */ + *BufEnd = p; + BufEnd++; + } + + /* Check if the string is empty, meaning we're done */ + if (!(*ActualSearchPath)) TryAgain = TRUE; + + /* Advance in the string */ + ActualSearchPath++; + } while (!TryAgain); + + /* Check if we had a buffer and free it */ + if (Buffer) RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer); + +Quickie: + /* Check if we got here through failure */ + if (!NT_SUCCESS(Status)) *ExpandedName = NULL; + + /* Display debug output if snaps are on */ + if (ShowSnaps) + { + /* Check which output to use -- failure or success */ + if (NT_SUCCESS(Status)) + { + DbgPrintEx(81, //DPFLTR_LDR_ID, + 0, + "LDR: %s - Returning %wZ\n", + __FUNCTION__, + *ExpandedName); + } + else + { + DbgPrintEx(81, //DPFLTR_LDR_ID, + 0, + "LDR: %s - Unable to locate %ws in %ws: 0x%08x\n", + __FUNCTION__, + DllName, + ActualSearchPath, + Status); + } + } + + /* Return status */ + return Status; +} + + +/* NOTE: This function is b0rked and in the process of being slowly unf*cked */ BOOLEAN NTAPI LdrpCheckForLoadedDll(IN PWSTR DllPath, @@ -231,10 +1792,14 @@ LdrpCheckForLoadedDll(IN PWSTR DllPath, PVOID ViewBase = NULL; SIZE_T ViewSize = 0; PIMAGE_NT_HEADERS NtHeader, NtHeader2; -DPRINT1("LdrpCheckForLoadedDll('%S' '%wZ' %d %d %p)\n", DllPath, DllName, Flag, RedirectedDll, LdrEntry); - /* Check if a dll name was provided */ - if (!DllName->Buffer || !DllName->Buffer[0]) return FALSE; + DPRINT("LdrpCheckForLoadedDll('%S' '%wZ' %d %d %p)\n", DllPath, DllName, Flag, RedirectedDll, LdrEntry); + /* Check if a dll name was provided */ + if (!(DllName->Buffer) || !(DllName->Buffer[0])) return FALSE; + + /* FIXME: Warning, "Flag" is used as magic instead of "Static" */ + /* FIXME: Warning, code does not support redirection at all */ + /* Look in the hash table if flag was set */ lookinhash: if (Flag) @@ -271,7 +1836,7 @@ lookinhash: while (*wc) { /* Check for a slash in the current position*/ - if (*wc == L'\\' || *wc == L'/') + if ((*wc == L'\\') || (*wc == L'/')) { /* Found the slash, so dll name contains path */ FullPath = TRUE; @@ -279,6 +1844,7 @@ lookinhash: /* Setup full dll name string */ FullDllName.Buffer = NameBuf; + /* FIXME: This is from the Windows 2000 loader, not XP/2003, we should call LdrpSearchPath */ Length = RtlDosSearchPath_U(DllPath ? DllPath : LdrpDefaultPath.Buffer, DllName->Buffer, NULL, @@ -287,7 +1853,7 @@ lookinhash: NULL); /* Check if that was successful */ - if (!Length || Length > sizeof(NameBuf) - sizeof(UNICODE_NULL)) + if (!(Length) || (Length > (sizeof(NameBuf) - sizeof(UNICODE_NULL)))) { if (ShowSnaps) { @@ -314,18 +1880,22 @@ lookinhash: Flag = TRUE; goto lookinhash; } + + /* FIXME: Warning, activation context missing */ + /* NOTE: From here on down, everything looks good */ - /* Now go through the InLoadOrder module list */ + /* Loop the module list */ ListHead = &NtCurrentPeb()->Ldr->InLoadOrderModuleList; ListEntry = ListHead->Flink; - while (ListEntry != ListHead) { - /* Get the containing record of the current entry and advance to the next one */ - CurEntry = CONTAINING_RECORD(ListEntry, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks); + /* Get the current entry and advance to the next one */ + CurEntry = CONTAINING_RECORD(ListEntry, + LDR_DATA_TABLE_ENTRY, + InLoadOrderLinks); ListEntry = ListEntry->Flink; - /* Check if it's already being unloaded */ + /* Check if it's being unloaded */ if (!CurEntry->InMemoryOrderModuleList.Flink) continue; /* Check if name matches */ @@ -335,18 +1905,10 @@ lookinhash: { /* Found it */ *LdrEntry = CurEntry; - - /* Find activation context */ - Status = RtlFindActivationContextSectionString(0, NULL, ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION, DllName, NULL); - if (!NT_SUCCESS(Status)) - return FALSE; - else - return TRUE; + return TRUE; } } - /* The DLL was not found in the load order modules list. Perform a complex check */ - /* Convert given path to NT path */ if (!RtlDosPathNameToNtPathName_U(FullDllName.Buffer, &NtPathName, @@ -363,7 +1925,6 @@ lookinhash: OBJ_CASE_INSENSITIVE, NULL, NULL); - Status = NtOpenFile(&FileHandle, SYNCHRONIZE | FILE_EXECUTE, &ObjectAttributes, @@ -379,7 +1940,9 @@ lookinhash: /* Create a section for this file */ Status = NtCreateSection(&SectionHandle, - SECTION_MAP_READ | SECTION_MAP_EXECUTE | SECTION_MAP_WRITE, + SECTION_MAP_READ | + SECTION_MAP_EXECUTE | + SECTION_MAP_WRITE, NULL, NULL, PAGE_EXECUTE, @@ -403,6 +1966,7 @@ lookinhash: ViewShare, 0, PAGE_EXECUTE); + /* Close section handle */ NtClose(SectionHandle); @@ -410,52 +1974,51 @@ lookinhash: if (!NT_SUCCESS(Status)) return FALSE; /* Get pointer to the NT header of this section */ - NtHeader = RtlImageNtHeader(ViewBase); - if (!NtHeader) + Status = RtlImageNtHeaderEx(0, ViewBase, ViewSize, &NtHeader); + if (!(NT_SUCCESS(Status)) || !(NtHeader)) { /* Unmap the section and fail */ NtUnmapViewOfSection(NtCurrentProcess(), ViewBase); return FALSE; } - /* Go through the list of modules */ + /* Go through the list of modules again */ ListHead = &NtCurrentPeb()->Ldr->InLoadOrderModuleList; ListEntry = ListHead->Flink; - while (ListEntry != ListHead) { - CurEntry = CONTAINING_RECORD(ListEntry, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks); + /* Get the current entry and advance to the next one */ + CurEntry = CONTAINING_RECORD(ListEntry, + LDR_DATA_TABLE_ENTRY, + InLoadOrderLinks); ListEntry = ListEntry->Flink; - /* Check if it's already being unloaded */ + /* Check if it's in the process of being unloaded */ if (!CurEntry->InMemoryOrderModuleList.Flink) continue; - + + /* The header is untrusted, use SEH */ _SEH2_TRY { /* Check if timedate stamp and sizes match */ - if (CurEntry->TimeDateStamp == NtHeader->FileHeader.TimeDateStamp && - CurEntry->SizeOfImage == NtHeader->OptionalHeader.SizeOfImage) + if ((CurEntry->TimeDateStamp == NtHeader->FileHeader.TimeDateStamp) && + (CurEntry->SizeOfImage == NtHeader->OptionalHeader.SizeOfImage)) { /* Time, date and size match. Let's compare their headers */ NtHeader2 = RtlImageNtHeader(CurEntry->DllBase); - if (RtlCompareMemory(NtHeader2, NtHeader, sizeof(IMAGE_NT_HEADERS))) { /* Headers match too! Finally ask the kernel to compare mapped files */ Status = ZwAreMappedFilesTheSame(CurEntry->DllBase, ViewBase); - if (!NT_SUCCESS(Status)) { + /* Almost identical, but not quite, keep trying */ _SEH2_YIELD(continue;) } else { - /* This is our entry! */ + /* This is our entry!, unmap and return success */ *LdrEntry = CurEntry; - - /* Unmap the section */ NtUnmapViewOfSection(NtCurrentProcess(), ViewBase); - _SEH2_YIELD(return TRUE;) } } @@ -468,9 +2031,8 @@ lookinhash: _SEH2_END; } - /* Unmap the section */ + /* Unmap the section and fail */ NtUnmapViewOfSection(NtCurrentProcess(), ViewBase); - return FALSE; } @@ -489,7 +2051,7 @@ LdrpGetProcedureAddress(IN PVOID BaseAddress, PVOID ImageBase; PIMAGE_IMPORT_BY_NAME ImportName = NULL; PIMAGE_EXPORT_DIRECTORY ExportDir; - ULONG ExportDirSize; + ULONG ExportDirSize, Length; PLIST_ENTRY Entry; /* Show debug message */ @@ -499,23 +2061,25 @@ LdrpGetProcedureAddress(IN PVOID BaseAddress, if (Name) { /* Show debug message */ - if (ShowSnaps) DPRINT1("NAME - %s\n", Name->Buffer); + if (ShowSnaps) DbgPrint("NAME - %s\n", Name->Buffer); /* Make sure it's not too long */ - if ((Name->Length + sizeof(CHAR) + sizeof(USHORT)) > MAXLONG) + Length = Name->Length + + sizeof(CHAR) + + FIELD_OFFSET(IMAGE_IMPORT_BY_NAME, Name); + if (Length > UNICODE_STRING_MAX_BYTES) { /* Won't have enough space to add the hint */ return STATUS_NAME_TOO_LONG; } /* Check if our buffer is large enough */ - if (Name->Length >= (sizeof(ImportBuffer) - sizeof(CHAR))) + if (Name->Length > sizeof(ImportBuffer)) { /* Allocate from heap, plus 2 bytes for the Hint */ ImportName = RtlAllocateHeap(RtlGetProcessHeap(), - 0, - Name->Length + sizeof(CHAR) + - sizeof(USHORT)); + 0, + Length); } else { @@ -527,8 +2091,8 @@ LdrpGetProcedureAddress(IN PVOID BaseAddress, ImportName->Hint = 0; /* Copy the name and null-terminate it */ - RtlMoveMemory(&ImportName->Name, Name->Buffer, Name->Length); - ImportName->Name[Name->Length + 1] = 0; + RtlCopyMemory(ImportName->Name, Name->Buffer, Name->Length); + ImportName->Name[Name->Length] = ANSI_NULL; /* Clear the high bit */ ImageBase = ImportName; @@ -540,18 +2104,18 @@ LdrpGetProcedureAddress(IN PVOID BaseAddress, ImageBase = NULL; /* Show debug message */ - if (ShowSnaps) DPRINT1("ORDINAL - %lx\n", Ordinal); + if (ShowSnaps) DbgPrint("ORDINAL - %lx\n", Ordinal); - if (Ordinal) - { - Thunk.u1.Ordinal = Ordinal | IMAGE_ORDINAL_FLAG; - } - else + /* Make sure an ordinal was given */ + if (!Ordinal) { /* No ordinal */ DPRINT1("No ordinal and no name\n"); return STATUS_INVALID_PARAMETER; } + + /* Set the orginal flag in the thunk */ + Thunk.u1.Ordinal = Ordinal | IMAGE_ORDINAL_FLAG; } /* Acquire lock unless we are initting */ @@ -563,7 +2127,7 @@ LdrpGetProcedureAddress(IN PVOID BaseAddress, if (!LdrpCheckForLoadedDllHandle(BaseAddress, &LdrEntry)) { /* Invalid base */ - DPRINT1("Invalid base address\n"); + DPRINT1("Invalid base address %p\n", BaseAddress); Status = STATUS_DLL_NOT_FOUND; _SEH2_YIELD(goto Quickie;) } @@ -576,7 +2140,7 @@ LdrpGetProcedureAddress(IN PVOID BaseAddress, if (!ExportDir) { - DPRINT1("Image has no exports\n"); + DPRINT1("Image %wZ has no exports, but were trying to get procedure %s. BaseAddress asked %p, got entry BA %p\n", &LdrEntry->BaseDllName, Name ? Name->Buffer : NULL, BaseAddress, LdrEntry->DllBase); Status = STATUS_PROCEDURE_NOT_FOUND; _SEH2_YIELD(goto Quickie;) } @@ -592,7 +2156,7 @@ LdrpGetProcedureAddress(IN PVOID BaseAddress, NULL); /* Finally, see if we're supposed to run the init routines */ - if (ExecuteInit) + if ((NT_SUCCESS(Status)) && (ExecuteInit)) { /* * It's possible a forwarded entry had us load the DLL. In that case, @@ -657,38 +2221,278 @@ LdrpLoadDll(IN BOOLEAN Redirected, OUT PVOID *BaseAddress, IN BOOLEAN CallInit) { - UNIMPLEMENTED; - return STATUS_NOT_IMPLEMENTED; + PPEB Peb = NtCurrentPeb(); + NTSTATUS Status = STATUS_SUCCESS; + PWCHAR p1, p2; + WCHAR c; + WCHAR NameBuffer[266]; + LPWSTR RawDllName; + UNICODE_STRING RawDllNameString; + PLDR_DATA_TABLE_ENTRY LdrEntry; + BOOLEAN InInit = LdrpInLdrInit; + + /* Find the name without the extension */ + p1 = DllName->Buffer; + p2 = NULL; + while (*p1) + { + c = *p1++; + if (c == L'.') + { + p2 = p1; + } + else if (c == L'\\') + { + p2 = NULL; + } + } + + /* Save the Raw DLL Name */ + RawDllName = NameBuffer; + if (DllName->Length >= sizeof(NameBuffer)) return STATUS_NAME_TOO_LONG; + RtlMoveMemory(RawDllName, DllName->Buffer, DllName->Length); + + /* Check if no extension was found or if we got a slash */ + if (!(p2) || (*p2 == '\\')) + { + /* Check that we have space to add one */ + if ((DllName->Length + LdrApiDefaultExtension.Length + sizeof(UNICODE_NULL)) >= + sizeof(NameBuffer)) + { + /* No space to add the extension */ + DbgPrintEx(81, //DPFLTR_LDR_ID, + 0, + "LDR: %s - Dll name missing extension; with extension " + "added the name is too long\n" + " DllName: (@ %p) \"%wZ\"\n" + " DllName->Length: %u\n", + __FUNCTION__, + DllName, + DllName, + DllName->Length); + return STATUS_NAME_TOO_LONG; + } + + /* FIXME: CLEAN THIS UP WITH Rtl String Functions */ + /* Add it */ + RtlMoveMemory((PVOID)((ULONG_PTR)RawDllName + DllName->Length), + LdrApiDefaultExtension.Buffer, + LdrApiDefaultExtension.Length); + + /* Save the length to a unicode string */ + RawDllNameString.Length = DllName->Length + LdrApiDefaultExtension.Length; + + /* Null terminate it */ + RawDllName[RawDllNameString.Length / sizeof(WCHAR)] = 0; + } + else + { + /* Null terminate it */ + RawDllName[DllName->Length / sizeof(WCHAR)] = 0; + + /* Save the length to a unicode string */ + RawDllNameString.Length = DllName->Length; + } + + /* Now create a unicode string for the DLL's name */ + RawDllNameString.MaximumLength = sizeof(NameBuffer); + RawDllNameString.Buffer = NameBuffer; + + /* Check for init flag and acquire lock */ + if (!InInit) RtlEnterCriticalSection(&LdrpLoaderLock); + + /* Show debug message */ + if (ShowSnaps) + { + DPRINT1("LDR: LdrLoadDll, loading %ws from %ws\n", + RawDllName, + DllPath ? DllPath : L""); + } + + /* Check if the DLL is already loaded */ + if (!LdrpCheckForLoadedDll(DllPath, + &RawDllNameString, + FALSE, + Redirected, + &LdrEntry)) + { + /* Map it */ + Status = LdrpMapDll(DllPath, + DllPath, + NameBuffer, + DllCharacteristics, + FALSE, + Redirected, + &LdrEntry); + if (!NT_SUCCESS(Status)) goto Quickie; + + /* FIXME: Need to mark the DLL range for the stack DB */ + //RtlpStkMarkDllRange(LdrEntry); + + /* Check if IMAGE_FILE_EXECUTABLE_IMAGE was provided */ + if ((DllCharacteristics) && + (*DllCharacteristics & IMAGE_FILE_EXECUTABLE_IMAGE)) + { + /* This is not a DLL, so remove such data */ + LdrEntry->EntryPoint = NULL; + LdrEntry->Flags &= ~LDRP_IMAGE_DLL; + } + + /* Make sure it's a DLL */ + if (LdrEntry->Flags & LDRP_IMAGE_DLL) + { + /* Check if this is a .NET Image */ + if (!(LdrEntry->Flags & LDRP_COR_IMAGE)) + { + /* Walk the Import Descriptor */ + Status = LdrpWalkImportDescriptor(DllPath, LdrEntry); + } + + /* Update load count, unless it's locked */ + if (LdrEntry->LoadCount != 0xFFFF) LdrEntry->LoadCount++; + LdrpUpdateLoadCount2(LdrEntry, LDRP_UPDATE_REFCOUNT); + + /* Check if we failed */ + if (!NT_SUCCESS(Status)) + { + /* Clear entrypoint, and insert into list */ + LdrEntry->EntryPoint = NULL; + InsertTailList(&Peb->Ldr->InInitializationOrderModuleList, + &LdrEntry->InInitializationOrderModuleList); + + /* Cancel the load */ + LdrpClearLoadInProgress(); + + /* Unload the DLL */ + if (ShowSnaps) + { + DbgPrint("LDR: Unloading %wZ due to error %x walking " + "import descriptors", + DllName, + Status); + } + LdrUnloadDll(LdrEntry->DllBase); + + /* Return the error */ + goto Quickie; + } + } + else if (LdrEntry->LoadCount != 0xFFFF) + { + /* Increase load count */ + LdrEntry->LoadCount++; + } + + /* Insert it into the list */ + InsertTailList(&Peb->Ldr->InInitializationOrderModuleList, + &LdrEntry->InInitializationOrderModuleList); + + /* If we have to run the entrypoint, make sure the DB is ready */ + if (CallInit && LdrpLdrDatabaseIsSetup) + { + /* FIXME: Notify Shim Engine */ + if (g_ShimsEnabled) + { + /* Call it */ + //ShimLoadCallback = RtlDecodeSystemPointer(g_pfnSE_DllLoaded); + //ShimLoadCallback(LdrEntry); + } + + /* Run the init routine */ + Status = LdrpRunInitializeRoutines(NULL); + if (!NT_SUCCESS(Status)) + { + /* Failed, unload the DLL */ + if (ShowSnaps) + { + DbgPrint("LDR: Unloading %wZ because either its init " + "routine or one of its static imports failed; " + "status = 0x%08lx\n", + DllName, + Status); + } + LdrUnloadDll(LdrEntry->DllBase); + } + } + else + { + /* The DB isn't ready, which means we were loaded because of a forwarder */ + Status = STATUS_SUCCESS; + } + } + else + { + /* We were already loaded. Are we a DLL? */ + if ((LdrEntry->Flags & LDRP_IMAGE_DLL) && (LdrEntry->LoadCount != 0xFFFF)) + { + /* Increase load count */ + LdrEntry->LoadCount++; + LdrpUpdateLoadCount2(LdrEntry, LDRP_UPDATE_REFCOUNT); + + /* Clear the load in progress */ + LdrpClearLoadInProgress(); + } + else + { + /* Not a DLL, just increase the load count */ + if (LdrEntry->LoadCount != 0xFFFF) LdrEntry->LoadCount++; + } + } + +Quickie: + /* Release the lock */ + if (!InInit) RtlLeaveCriticalSection(Peb->LoaderLock); + + /* Check for success */ + if (NT_SUCCESS(Status)) + { + /* Return the base address */ + *BaseAddress = LdrEntry->DllBase; + } + else + { + /* Nothing found */ + *BaseAddress = NULL; + } + + /* Return status */ + return Status; } ULONG NTAPI -LdrpClearLoadInProgress() +LdrpClearLoadInProgress(VOID) { - PLIST_ENTRY ListHead; - PLIST_ENTRY Entry; - PLDR_DATA_TABLE_ENTRY Module; + PLIST_ENTRY ListHead, Entry; + PLDR_DATA_TABLE_ENTRY LdrEntry; ULONG ModulesCount = 0; /* Traverse the init list */ ListHead = &NtCurrentPeb()->Ldr->InInitializationOrderModuleList; Entry = ListHead->Flink; - while (Entry != ListHead) { - Module = CONTAINING_RECORD(Entry, LDR_DATA_TABLE_ENTRY, InInitializationOrderModuleList); + /* Get the loader entry */ + LdrEntry = CONTAINING_RECORD(Entry, + LDR_DATA_TABLE_ENTRY, + InInitializationOrderModuleList); /* Clear load in progress flag */ - Module->Flags &= ~LDRP_LOAD_IN_PROGRESS; + LdrEntry->Flags &= ~LDRP_LOAD_IN_PROGRESS; - /* Increase counter for modules with entry point count but not processed yet */ - if (Module->EntryPoint && - !(Module->Flags & LDRP_ENTRY_PROCESSED)) ModulesCount++; + /* Check for modules with entry point count but not processed yet */ + if ((LdrEntry->EntryPoint) && + !(LdrEntry->Flags & LDRP_ENTRY_PROCESSED)) + { + /* Increase counter */ + ModulesCount++; + } /* Advance to the next entry */ Entry = Entry->Flink; } + /* Return final count */ return ModulesCount; } diff --git a/dll/ntdll/ldr/startup.c b/dll/ntdll/ldr/startup.c deleted file mode 100644 index f063aefdc0d..00000000000 --- a/dll/ntdll/ldr/startup.c +++ /dev/null @@ -1,588 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: dll/ntdll/ldr/startup.c - * PURPOSE: Process startup for PE executables - * PROGRAMMERS: Jean Michault - * Rex Jolliff (rex@lvcablemodem.com) - */ - -/* INCLUDES *****************************************************************/ - -#include -#define NDEBUG -#include -#include - -VOID RtlInitializeHeapManager(VOID); -VOID LdrpInitLoader(VOID); -extern PTEB LdrpTopLevelDllBeingLoadedTeb; -VOID NTAPI RtlpInitDeferedCriticalSection(VOID); -VOID RtlpInitializeVectoredExceptionHandling(VOID); - -/* GLOBALS *******************************************************************/ - -extern PLDR_DATA_TABLE_ENTRY LdrpImageEntry; -extern RTL_CRITICAL_SECTION FastPebLock; -extern RTL_BITMAP TlsBitMap; -extern RTL_BITMAP TlsExpansionBitMap; - -#define VALUE_BUFFER_SIZE 256 - -/* FUNCTIONS *****************************************************************/ - -BOOLEAN -FASTCALL -ReadCompatibilitySetting(HANDLE Key, - LPWSTR Value, - PKEY_VALUE_PARTIAL_INFORMATION ValueInfo, - DWORD * Buffer) -{ - UNICODE_STRING ValueName; - NTSTATUS Status; - ULONG Length; - - RtlInitUnicodeString(&ValueName, Value); - Status = NtQueryValueKey(Key, - &ValueName, - KeyValuePartialInformation, - ValueInfo, - VALUE_BUFFER_SIZE, - &Length); - - if (!NT_SUCCESS(Status) || (ValueInfo->Type != REG_DWORD)) - { - RtlFreeUnicodeString(&ValueName); - return FALSE; - } - - RtlCopyMemory(Buffer, &ValueInfo->Data[0], sizeof(DWORD)); - RtlFreeUnicodeString(&ValueName); - return TRUE; -} - -VOID -FASTCALL -LoadImageFileExecutionOptions(PPEB Peb) -{ - NTSTATUS Status = STATUS_SUCCESS; - ULONG Value = 0; - UNICODE_STRING ImageName; - UNICODE_STRING ImagePathName; - ULONG ValueSize; - extern ULONG RtlpDphGlobalFlags, RtlpPageHeapSizeRangeStart, RtlpPageHeapSizeRangeEnd; - extern ULONG RtlpPageHeapDllRangeStart, RtlpPageHeapDllRangeEnd; - extern WCHAR RtlpDphTargetDlls[512]; - extern BOOLEAN RtlpPageHeapEnabled; - - if (Peb->ProcessParameters && - Peb->ProcessParameters->ImagePathName.Length > 0) - { - DPRINT("%wZ\n", &Peb->ProcessParameters->ImagePathName); - - ImagePathName = Peb->ProcessParameters->ImagePathName; - ImageName.Buffer = ImagePathName.Buffer + ImagePathName.Length / sizeof(WCHAR); - ImageName.Length = 0; - - while (ImagePathName.Buffer < ImageName.Buffer) - { - ImageName.Buffer--; - if (*ImageName.Buffer == L'\\') - { - ImageName.Buffer++; - break; - } - } - - ImageName.Length = ImagePathName.Length - - (ImageName.Buffer - ImagePathName.Buffer) * sizeof(WCHAR); - ImageName.MaximumLength = ImageName.Length + - ImagePathName.MaximumLength - ImagePathName.Length; - - DPRINT("%wZ\n", &ImageName); - - /* global flag */ - Status = LdrQueryImageFileExecutionOptions(&ImageName, - L"GlobalFlag", - REG_DWORD, - (PVOID)&Value, - sizeof(Value), - &ValueSize); - if (NT_SUCCESS(Status)) - { - Peb->NtGlobalFlag = Value; - DPRINT("GlobalFlag: Value=0x%lx\n", Value); - } - else - { - /* Add debugging flags if there is no GlobalFlags override */ - if (Peb->BeingDebugged) - { - Peb->NtGlobalFlag |= FLG_HEAP_VALIDATE_PARAMETERS | - FLG_HEAP_ENABLE_FREE_CHECK | - FLG_HEAP_ENABLE_TAIL_CHECK; - } - } - - /* Handle the case when page heap is enabled */ - if (Peb->NtGlobalFlag & FLG_HEAP_PAGE_ALLOCS) - { - /* Disable all heap debugging flags so that no heap call goes via page heap branch */ - Peb->NtGlobalFlag &= ~(FLG_HEAP_VALIDATE_PARAMETERS | - FLG_HEAP_VALIDATE_ALL | - FLG_HEAP_ENABLE_FREE_CHECK | - FLG_HEAP_ENABLE_TAIL_CHECK | - FLG_USER_STACK_TRACE_DB | - FLG_HEAP_ENABLE_TAGGING | - FLG_HEAP_ENABLE_TAG_BY_DLL); - - /* Get page heap flags without checking return value */ - LdrQueryImageFileExecutionOptions(&ImageName, - L"PageHeapFlags", - REG_DWORD, - (PVOID)&RtlpDphGlobalFlags, - sizeof(RtlpDphGlobalFlags), - &ValueSize); - - LdrQueryImageFileExecutionOptions(&ImageName, - L"PageHeapSizeRangeStart", - REG_DWORD, - (PVOID)&RtlpPageHeapSizeRangeStart, - sizeof(RtlpPageHeapSizeRangeStart), - &ValueSize); - - LdrQueryImageFileExecutionOptions(&ImageName, - L"PageHeapSizeRangeEnd", - REG_DWORD, - (PVOID)&RtlpPageHeapSizeRangeEnd, - sizeof(RtlpPageHeapSizeRangeEnd), - &ValueSize); - - LdrQueryImageFileExecutionOptions(&ImageName, - L"PageHeapDllRangeStart", - REG_DWORD, - (PVOID)&RtlpPageHeapDllRangeStart, - sizeof(RtlpPageHeapDllRangeStart), - &ValueSize); - - LdrQueryImageFileExecutionOptions(&ImageName, - L"PageHeapDllRangeEnd", - REG_DWORD, - (PVOID)&RtlpPageHeapDllRangeEnd, - sizeof(RtlpPageHeapDllRangeEnd), - &ValueSize); - - LdrQueryImageFileExecutionOptions(&ImageName, - L"PageHeapTargetDlls", - REG_SZ, - (PVOID)RtlpDphTargetDlls, - sizeof(RtlpDphTargetDlls), - &ValueSize); - - /* Now when all parameters are read, enable page heap */ - RtlpPageHeapEnabled = TRUE; - } - } -} - -BOOLEAN -FASTCALL -LoadCompatibilitySettings(PPEB Peb) -{ - NTSTATUS Status; - HANDLE UserKey = NULL; - HANDLE KeyHandle; - HANDLE SubKeyHandle; - OBJECT_ATTRIBUTES ObjectAttributes; - UNICODE_STRING KeyName = RTL_CONSTANT_STRING( - L"Software\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers"); - UNICODE_STRING ValueName; - UCHAR ValueBuffer[VALUE_BUFFER_SIZE]; - PKEY_VALUE_PARTIAL_INFORMATION ValueInfo; - ULONG Length; - DWORD MajorVersion, MinorVersion, BuildNumber, PlatformId, - SPMajorVersion, SPMinorVersion = 0; - - if (Peb->ProcessParameters && - (Peb->ProcessParameters->ImagePathName.Length > 0)) - { - Status = RtlOpenCurrentUser(KEY_READ, &UserKey); - if (!NT_SUCCESS(Status)) - { - return FALSE; - } - - InitializeObjectAttributes(&ObjectAttributes, - &KeyName, - OBJ_CASE_INSENSITIVE, - UserKey, - NULL); - - Status = NtOpenKey(&KeyHandle, KEY_QUERY_VALUE, &ObjectAttributes); - - if (!NT_SUCCESS(Status)) - { - if (UserKey) - NtClose(UserKey); - return FALSE; - } - - /* query version name for application */ - ValueInfo = (PKEY_VALUE_PARTIAL_INFORMATION) ValueBuffer; - Status = NtQueryValueKey(KeyHandle, - &Peb->ProcessParameters->ImagePathName, - KeyValuePartialInformation, - ValueBuffer, - VALUE_BUFFER_SIZE, - &Length); - - if (!NT_SUCCESS(Status) || (ValueInfo->Type != REG_SZ)) - { - NtClose(KeyHandle); - if (UserKey) - NtClose(UserKey); - return FALSE; - } - - ValueName.Length = ValueInfo->DataLength; - ValueName.MaximumLength = ValueInfo->DataLength; - ValueName.Buffer = (PWSTR) ValueInfo->Data; - - /* load version info */ - InitializeObjectAttributes(&ObjectAttributes, - &ValueName, - OBJ_CASE_INSENSITIVE, - KeyHandle, - NULL); - - Status = NtOpenKey(&SubKeyHandle, KEY_QUERY_VALUE, &ObjectAttributes); - - if (!NT_SUCCESS(Status)) - { - NtClose(KeyHandle); - if (UserKey) - NtClose(UserKey); - return FALSE; - } - - DPRINT("Loading version information for: %wZ\n", &ValueName); - - /* read settings from registry */ - if (!ReadCompatibilitySetting(SubKeyHandle, L"MajorVersion", ValueInfo, &MajorVersion)) - goto finish; - if (!ReadCompatibilitySetting(SubKeyHandle, L"MinorVersion", ValueInfo, &MinorVersion)) - goto finish; - if (!ReadCompatibilitySetting(SubKeyHandle, L"BuildNumber", ValueInfo, &BuildNumber)) - goto finish; - if (!ReadCompatibilitySetting(SubKeyHandle, L"PlatformId", ValueInfo, &PlatformId)) - goto finish; - - /* now assign the settings */ - Peb->OSMajorVersion = (ULONG) MajorVersion; - Peb->OSMinorVersion = (ULONG) MinorVersion; - Peb->OSBuildNumber = (USHORT) BuildNumber; - Peb->OSPlatformId = (ULONG) PlatformId; - - /* optional service pack version numbers */ - if (ReadCompatibilitySetting(SubKeyHandle, - L"SPMajorVersion", - ValueInfo, - &SPMajorVersion) && - ReadCompatibilitySetting(SubKeyHandle, - L"SPMinorVersion", - ValueInfo, - &SPMinorVersion)) - { - Peb->OSCSDVersion = ((SPMajorVersion & 0xFF) << 8) | - (SPMinorVersion & 0xFF); - } - -finish: - /* we're finished */ - NtClose(SubKeyHandle); - NtClose(KeyHandle); - if (UserKey) - NtClose(UserKey); - return TRUE; - } - - return FALSE; -} - -NTSTATUS -NTAPI -LdrpInitializeProcess_(PCONTEXT Context, - PVOID SystemArgument1) -{ - PIMAGE_NT_HEADERS NTHeaders; - PEPFUNC EntryPoint; - PIMAGE_DOS_HEADER PEDosHeader; - PVOID ImageBase; - PPEB Peb = NtCurrentPeb(); - PLDR_DATA_TABLE_ENTRY NtModule; // ntdll - NLSTABLEINFO NlsTable; - WCHAR FullNtDllPath[MAX_PATH]; - SYSTEM_BASIC_INFORMATION SystemInformation; - NTSTATUS Status; - PVOID BaseAddress = SystemArgument1; - - DPRINT("LdrpInit()\n"); - DPRINT("Peb %p\n", Peb); - ImageBase = Peb->ImageBaseAddress; - DPRINT("ImageBase %p\n", ImageBase); - - if (ImageBase <= (PVOID) 0x1000) - { - DPRINT("ImageBase is null\n"); - ZwTerminateProcess(NtCurrentProcess(), STATUS_INVALID_IMAGE_FORMAT); - } - - /* If MZ header exists */ - PEDosHeader = (PIMAGE_DOS_HEADER) ImageBase; - NTHeaders = (PIMAGE_NT_HEADERS)((ULONG_PTR)ImageBase + PEDosHeader->e_lfanew); - DPRINT("PEDosHeader %p\n", PEDosHeader); - - if (PEDosHeader->e_magic != IMAGE_DOS_SIGNATURE || - PEDosHeader->e_lfanew == 0L || - NTHeaders->Signature != IMAGE_NT_SIGNATURE) - { - DPRINT1("Image has bad header\n"); - ZwTerminateProcess(NtCurrentProcess(), STATUS_INVALID_IMAGE_FORMAT); - } - - /* normalize process parameters */ - RtlNormalizeProcessParams(Peb->ProcessParameters); - - /* Initialize NLS data */ - RtlInitNlsTables(Peb->AnsiCodePageData, - Peb->OemCodePageData, - Peb->UnicodeCaseTableData, - &NlsTable); - RtlResetRtlTranslations(&NlsTable); - - /* Get number of processors */ - DPRINT("Here\n"); - Status = ZwQuerySystemInformation(SystemBasicInformation, - &SystemInformation, - sizeof(SYSTEM_BASIC_INFORMATION), - NULL); - DPRINT("Here2\n"); - if (!NT_SUCCESS(Status)) - { - ZwTerminateProcess(NtCurrentProcess(), Status); - } - - Peb->NumberOfProcessors = SystemInformation.NumberOfProcessors; - - /* Initialize Critical Section Data */ - RtlpInitDeferedCriticalSection(); - - /* Load execution options */ - LoadImageFileExecutionOptions(Peb); - - /* create process heap */ - RtlInitializeHeapManager(); - Peb->ProcessHeap = RtlCreateHeap(HEAP_GROWABLE, - NULL, - NTHeaders->OptionalHeader.SizeOfHeapReserve, - NTHeaders->OptionalHeader.SizeOfHeapCommit, - NULL, - NULL); - if (Peb->ProcessHeap == 0) - { - DPRINT1("Failed to create process heap\n"); - ZwTerminateProcess(NtCurrentProcess(), STATUS_INSUFFICIENT_RESOURCES); - } - - /* Check for correct machine type */ - if (NTHeaders->FileHeader.Machine != IMAGE_FILE_MACHINE_NATIVE) - { - ULONG_PTR HardErrorParameters[1]; - UNICODE_STRING ImageNameU; - ANSI_STRING ImageNameA; - WCHAR *Ptr; - ULONG ErrorResponse; - - DPRINT1("Image %wZ is for a foreign architecture (0x%x).\n", - &Peb->ProcessParameters->ImagePathName, NTHeaders->FileHeader.Machine); - - /* Get the full image path name */ - ImageNameU = Peb->ProcessParameters->ImagePathName; - - /* Get the file name */ - Ptr = Peb->ProcessParameters->ImagePathName.Buffer + - (Peb->ProcessParameters->ImagePathName.Length / sizeof(WCHAR)) -1; - while ((Ptr >= Peb->ProcessParameters->ImagePathName.Buffer) && - (*Ptr != L'\\')) Ptr--; - ImageNameU.Buffer = Ptr + 1; - ImageNameU.Length = Peb->ProcessParameters->ImagePathName.Length - - (ImageNameU.Buffer - Peb->ProcessParameters->ImagePathName.Buffer) * sizeof(WCHAR); - ImageNameU.MaximumLength = ImageNameU.Length; - - /*`Convert to ANSI, harderror message needs that */ - RtlUnicodeStringToAnsiString(&ImageNameA, &ImageNameU, TRUE); - - /* Raise harderror */ - HardErrorParameters[0] = (ULONG_PTR)&ImageNameA; - NtRaiseHardError(STATUS_IMAGE_MACHINE_TYPE_MISMATCH_EXE, - 1, - 1, - HardErrorParameters, - OptionOk, - &ErrorResponse); - - RtlFreeAnsiString(&ImageNameA); - ZwTerminateProcess(NtCurrentProcess(), STATUS_IMAGE_MACHINE_TYPE_MISMATCH_EXE); - } - - /* initialized vectored exception handling */ - RtlpInitializeVectoredExceptionHandling(); - - /* initalize peb lock support */ - RtlInitializeCriticalSection(&FastPebLock); - Peb->FastPebLock = &FastPebLock; - - /* initialize tls bitmaps */ - RtlInitializeBitMap(&TlsBitMap, Peb->TlsBitmapBits, TLS_MINIMUM_AVAILABLE); - RtlInitializeBitMap(&TlsExpansionBitMap, Peb->TlsExpansionBitmapBits, TLS_EXPANSION_SLOTS); - - Peb->TlsBitmap = &TlsBitMap; - Peb->TlsExpansionBitmap = &TlsExpansionBitMap; - Peb->TlsExpansionCounter = TLS_MINIMUM_AVAILABLE; - - /* Initialize table of callbacks for the kernel. */ - Peb->KernelCallbackTable = RtlAllocateHeap(RtlGetProcessHeap(), - 0, - sizeof(PVOID) * - (USER32_CALLBACK_MAXIMUM + 1)); - if (Peb->KernelCallbackTable == NULL) - { - DPRINT1("Failed to create callback table\n"); - ZwTerminateProcess(NtCurrentProcess(), STATUS_INSUFFICIENT_RESOURCES); - } - - /* initalize loader lock */ - RtlInitializeCriticalSection(&LdrpLoaderLock); - Peb->LoaderLock = &LdrpLoaderLock; - - /* create loader information */ - Peb->Ldr = (PPEB_LDR_DATA) RtlAllocateHeap(Peb->ProcessHeap, - 0, - sizeof(PEB_LDR_DATA)); - if (Peb->Ldr == NULL) - { - DPRINT1("Failed to create loader data\n"); - ZwTerminateProcess(NtCurrentProcess(), STATUS_INSUFFICIENT_RESOURCES); - } - - Peb->Ldr->Length = sizeof(PEB_LDR_DATA); - Peb->Ldr->Initialized = FALSE; - Peb->Ldr->SsHandle = NULL; - InitializeListHead(&Peb->Ldr->InLoadOrderModuleList); - InitializeListHead(&Peb->Ldr->InMemoryOrderModuleList); - InitializeListHead(&Peb->Ldr->InInitializationOrderModuleList); - - /* Load compatibility settings */ - LoadCompatibilitySettings(Peb); - - /* build full ntdll path */ - wcscpy(FullNtDllPath, SharedUserData->NtSystemRoot); - wcscat(FullNtDllPath, L"\\system32\\ntdll.dll"); - - /* add entry for ntdll */ - NtModule = (PLDR_DATA_TABLE_ENTRY) - RtlAllocateHeap(Peb->ProcessHeap, - 0, - sizeof(LDR_DATA_TABLE_ENTRY)); - if (NtModule == NULL) - { - DPRINT1("Failed to create loader module entry (NTDLL)\n"); - ZwTerminateProcess(NtCurrentProcess(), STATUS_INSUFFICIENT_RESOURCES); - } - memset(NtModule, 0, sizeof(LDR_DATA_TABLE_ENTRY)); - - NtModule->DllBase = BaseAddress; - NtModule->EntryPoint = 0; /* no entry point */ - RtlCreateUnicodeString(&NtModule->FullDllName, FullNtDllPath); - RtlCreateUnicodeString(&NtModule->BaseDllName, L"ntdll.dll"); - NtModule->Flags = LDRP_IMAGE_DLL | LDRP_ENTRY_PROCESSED; - - NtModule->LoadCount = -1; /* don't unload */ - NtModule->TlsIndex = -1; - NtModule->SectionPointer = NULL; - NtModule->CheckSum = 0; - - NTHeaders = RtlImageNtHeader(NtModule->DllBase); - NtModule->SizeOfImage = LdrpGetResidentSize(NTHeaders); - NtModule->TimeDateStamp = NTHeaders->FileHeader.TimeDateStamp; - - InsertTailList(&Peb->Ldr->InLoadOrderModuleList, - &NtModule->InLoadOrderLinks); - InsertTailList(&Peb->Ldr->InInitializationOrderModuleList, - &NtModule->InInitializationOrderModuleList); - - /* add entry for executable (becomes first list entry) */ - LdrpImageEntry = (PLDR_DATA_TABLE_ENTRY) - RtlAllocateHeap(Peb->ProcessHeap, - HEAP_ZERO_MEMORY, - sizeof(LDR_DATA_TABLE_ENTRY)); - if (LdrpImageEntry == NULL) - { - DPRINT1("Failed to create loader module infomation\n"); - ZwTerminateProcess(NtCurrentProcess(), STATUS_INSUFFICIENT_RESOURCES); - } - - LdrpImageEntry->DllBase = Peb->ImageBaseAddress; - - if ((Peb->ProcessParameters == NULL) || - (Peb->ProcessParameters->ImagePathName.Length == 0)) - { - DPRINT1("Failed to access the process parameter block\n"); - ZwTerminateProcess(NtCurrentProcess(), STATUS_UNSUCCESSFUL); - } - - RtlCreateUnicodeString(&LdrpImageEntry->FullDllName, - Peb->ProcessParameters->ImagePathName.Buffer); - RtlCreateUnicodeString(&LdrpImageEntry->BaseDllName, - wcsrchr(LdrpImageEntry->FullDllName.Buffer, L'\\') + 1); - - DPRINT("BaseDllName '%wZ' FullDllName '%wZ'\n", &LdrpImageEntry->BaseDllName, &LdrpImageEntry->FullDllName); - - LdrpImageEntry->Flags = LDRP_ENTRY_PROCESSED; - LdrpImageEntry->LoadCount = -1; /* don't unload */ - LdrpImageEntry->TlsIndex = -1; - LdrpImageEntry->SectionPointer = NULL; - LdrpImageEntry->CheckSum = 0; - - NTHeaders = RtlImageNtHeader(LdrpImageEntry->DllBase); - LdrpImageEntry->SizeOfImage = LdrpGetResidentSize(NTHeaders); - LdrpImageEntry->TimeDateStamp = NTHeaders->FileHeader.TimeDateStamp; - - LdrpTopLevelDllBeingLoadedTeb = NtCurrentTeb(); - - InsertHeadList(&Peb->Ldr->InLoadOrderModuleList, - &LdrpImageEntry->InLoadOrderLinks); - - LdrpInitLoader(); - - EntryPoint = LdrPEStartup((PVOID)ImageBase, NULL, NULL, NULL); - LdrpImageEntry->EntryPoint = EntryPoint; - - /* all required dlls are loaded now */ - Peb->Ldr->Initialized = TRUE; - - /* Check before returning that we can run the image safely. */ - if (EntryPoint == NULL) - { - DPRINT1("Failed to initialize image\n"); - ZwTerminateProcess(NtCurrentProcess(), STATUS_INVALID_IMAGE_FORMAT); - } - - /* Break into debugger */ - if (Peb->BeingDebugged) - DbgBreakPoint(); - - return STATUS_SUCCESS; -} - -/* EOF */ diff --git a/dll/ntdll/ldr/utils.c b/dll/ntdll/ldr/utils.c deleted file mode 100644 index 9ce0cbb9feb..00000000000 --- a/dll/ntdll/ldr/utils.c +++ /dev/null @@ -1,2819 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: lib/ntdll/ldr/utils.c - * PURPOSE: Process startup for PE executables - * PROGRAMMERS: Jean Michault - * Rex Jolliff (rex@lvcablemodem.com) - * Michael Martin - */ - -/* - * TODO: - * - Handle loading flags correctly - * - Handle errors correctly (unload dll's) - * - Implement a faster way to find modules (hash table) - * - any more ?? - */ - -/* INCLUDES *****************************************************************/ - -#include -#define NDEBUG -#include - -#define LDRP_PROCESS_CREATION_TIME 0xffff -#define RVA(m, b) ((PVOID)((ULONG_PTR)(b) + (ULONG_PTR)(m))) - -/* GLOBALS *******************************************************************/ - -#ifdef NDEBUG -#define TRACE_LDR(...) if (RtlGetNtGlobalFlags() & FLG_SHOW_LDR_SNAPS) { DbgPrint("(LDR:%s:%d) ",__FILE__,__LINE__); DbgPrint(__VA_ARGS__); } -#endif - -static BOOLEAN LdrpDllShutdownInProgress = FALSE; -extern HANDLE LdrpKnownDllObjectDirectory; -extern UNICODE_STRING LdrpKnownDllPath; -static PLDR_DATA_TABLE_ENTRY LdrpLastModule = NULL; -extern PLDR_DATA_TABLE_ENTRY LdrpImageEntry; - -/* PROTOTYPES ****************************************************************/ - -static NTSTATUS LdrFindEntryForName(PUNICODE_STRING Name, PLDR_DATA_TABLE_ENTRY *Module, BOOLEAN Ref); -static PVOID LdrFixupForward(PCHAR ForwardName); -static PVOID LdrGetExportByName(PVOID BaseAddress, PUCHAR SymbolName, USHORT Hint); -static NTSTATUS LdrpLoadModule(IN PWSTR SearchPath OPTIONAL, - IN ULONG LoadFlags, - IN PUNICODE_STRING Name, - OUT PLDR_DATA_TABLE_ENTRY *Module, - OUT PVOID *BaseAddress OPTIONAL); -static VOID LdrpDetachProcess(BOOLEAN UnloadAll); -static NTSTATUS LdrpUnloadModule(PLDR_DATA_TABLE_ENTRY Module, BOOLEAN Unload); - -NTSTATUS find_actctx_dll( LPCWSTR libname, WCHAR *fulldosname ); -NTSTATUS create_module_activation_context( LDR_DATA_TABLE_ENTRY *module ); - -/* FUNCTIONS *****************************************************************/ - -BOOLEAN -LdrMappedAsDataFile(PVOID *BaseAddress) -{ - if (0 != ((DWORD_PTR) *BaseAddress & (PAGE_SIZE - 1))) - { - *BaseAddress = (PVOID)((DWORD_PTR)*BaseAddress & ~((DWORD_PTR) PAGE_SIZE - 1)); - return TRUE; - } - - return FALSE; -} - -static __inline LONG LdrpDecrementLoadCount(PLDR_DATA_TABLE_ENTRY Module, BOOLEAN Locked) -{ - LONG LoadCount; - if (!Locked) - { - RtlEnterCriticalSection (NtCurrentPeb()->LoaderLock); - } - LoadCount = Module->LoadCount; - if (Module->LoadCount > 0 && Module->LoadCount != LDRP_PROCESS_CREATION_TIME) - { - Module->LoadCount--; - } - if (!Locked) - { - RtlLeaveCriticalSection(NtCurrentPeb()->LoaderLock); - } - return LoadCount; -} - -static __inline LONG LdrpIncrementLoadCount(PLDR_DATA_TABLE_ENTRY Module, BOOLEAN Locked) -{ - LONG LoadCount; - if (!Locked) - { - RtlEnterCriticalSection (NtCurrentPeb()->LoaderLock); - } - LoadCount = Module->LoadCount; - if (Module->LoadCount != LDRP_PROCESS_CREATION_TIME) - { - Module->LoadCount++; - } - if (!Locked) - { - RtlLeaveCriticalSection(NtCurrentPeb()->LoaderLock); - } - return LoadCount; -} - -static PWSTR -LdrpQueryAppPaths(IN PCWSTR ImageName) -{ - PKEY_VALUE_PARTIAL_INFORMATION KeyInfo; - OBJECT_ATTRIBUTES ObjectAttributes; - WCHAR SearchPathBuffer[5*MAX_PATH]; - UNICODE_STRING ValueNameString; - UNICODE_STRING KeyName; - WCHAR NameBuffer[MAX_PATH]; - ULONG KeyInfoSize; - ULONG ResultSize; - PWCHAR Backslash; - HANDLE KeyHandle; - NTSTATUS Status; - PWSTR Path = NULL; - - _snwprintf(NameBuffer, - sizeof(NameBuffer) / sizeof(WCHAR), - L"\\Registry\\Machine\\Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\%s", - ImageName); - - RtlInitUnicodeString(&KeyName, NameBuffer); - - InitializeObjectAttributes(&ObjectAttributes, - &KeyName, - OBJ_CASE_INSENSITIVE, - NULL, - NULL); - - Status = NtOpenKey(&KeyHandle, - KEY_READ, - &ObjectAttributes); - if (!NT_SUCCESS(Status)) - { - DPRINT ("NtOpenKey() failed (Status %lx)\n", Status); - return NULL; - } - - KeyInfoSize = sizeof(KEY_VALUE_PARTIAL_INFORMATION) + 256 * sizeof(WCHAR); - - KeyInfo = RtlAllocateHeap(RtlGetProcessHeap(), 0, KeyInfoSize); - if (KeyInfo == NULL) - { - DPRINT("RtlAllocateHeap() failed\n"); - NtClose(KeyHandle); - return NULL; - } - - RtlInitUnicodeString(&ValueNameString, - L"Path"); - - Status = NtQueryValueKey(KeyHandle, - &ValueNameString, - KeyValuePartialInformation, - KeyInfo, - KeyInfoSize, - &ResultSize); - - if (!NT_SUCCESS(Status)) - { - NtClose(KeyHandle); - RtlFreeHeap(RtlGetProcessHeap(), 0, KeyInfo); - return NULL; - } - - RtlCopyMemory(SearchPathBuffer, - &KeyInfo->Data, - KeyInfo->DataLength); - - /* Free KeyInfo memory, we won't need it anymore */ - RtlFreeHeap(RtlGetProcessHeap(), 0, KeyInfo); - - /* Close the key handle */ - NtClose(KeyHandle); - - /* get application running path */ - wcscat(SearchPathBuffer, L";"); - wcscat(SearchPathBuffer, NtCurrentPeb()->ProcessParameters->ImagePathName.Buffer); // FIXME: Don't rely on it being NULL-terminated!!! - - /* Remove trailing backslash */ - Backslash = wcsrchr(SearchPathBuffer, L'\\'); - if (Backslash) Backslash = L'\0'; - - wcscat(SearchPathBuffer, L";"); - - wcscat(SearchPathBuffer, SharedUserData->NtSystemRoot); - wcscat(SearchPathBuffer, L"\\system32;"); - wcscat(SearchPathBuffer, SharedUserData->NtSystemRoot); - wcscat(SearchPathBuffer, L";."); - - /* Copy it to the heap allocd memory */ - Path = RtlAllocateHeap(RtlGetProcessHeap(), - 0, - (wcslen(SearchPathBuffer) + 1) * sizeof(WCHAR)); - - if (!Path) - { - DPRINT1("RtlAllocateHeap() failed\n"); - return NULL; - } - - wcscpy(Path, SearchPathBuffer); - - return Path; -} - -VOID -LdrpInitLoader(VOID) -{ - OBJECT_ATTRIBUTES ObjectAttributes; - UNICODE_STRING LinkTarget; - UNICODE_STRING Name; - HANDLE LinkHandle; - ULONG Length; - NTSTATUS Status; - - DPRINT("LdrpInitLoader() called for %wZ\n", &LdrpImageEntry->BaseDllName); - - /* Get handle to the 'KnownDlls' directory */ - RtlInitUnicodeString(&Name, - L"\\KnownDlls"); - InitializeObjectAttributes(&ObjectAttributes, - &Name, - OBJ_CASE_INSENSITIVE, - NULL, - NULL); - Status = NtOpenDirectoryObject(&LdrpKnownDllObjectDirectory, - DIRECTORY_QUERY | DIRECTORY_TRAVERSE, - &ObjectAttributes); - if (!NT_SUCCESS(Status)) - { - DPRINT("NtOpenDirectoryObject() failed (Status %lx)\n", Status); - LdrpKnownDllObjectDirectory = NULL; - return; - } - - /* Allocate target name string */ - LinkTarget.Length = 0; - LinkTarget.MaximumLength = MAX_PATH * sizeof(WCHAR); - LinkTarget.Buffer = RtlAllocateHeap(RtlGetProcessHeap(), - 0, - MAX_PATH * sizeof(WCHAR)); - if (LinkTarget.Buffer == NULL) - { - NtClose(LdrpKnownDllObjectDirectory); - LdrpKnownDllObjectDirectory = NULL; - return; - } - - RtlInitUnicodeString(&Name, - L"KnownDllPath"); - InitializeObjectAttributes(&ObjectAttributes, - &Name, - OBJ_CASE_INSENSITIVE, - LdrpKnownDllObjectDirectory, - NULL); - Status = NtOpenSymbolicLinkObject(&LinkHandle, - SYMBOLIC_LINK_ALL_ACCESS, - &ObjectAttributes); - if (!NT_SUCCESS(Status)) - { - RtlFreeUnicodeString(&LinkTarget); - NtClose(LdrpKnownDllObjectDirectory); - LdrpKnownDllObjectDirectory = NULL; - return; - } - - Status = NtQuerySymbolicLinkObject(LinkHandle, - &LinkTarget, - &Length); - NtClose(LinkHandle); - if (!NT_SUCCESS(Status)) - { - RtlFreeUnicodeString(&LinkTarget); - NtClose(LdrpKnownDllObjectDirectory); - LdrpKnownDllObjectDirectory = NULL; - } - - RtlCreateUnicodeString(&LdrpKnownDllPath, - LinkTarget.Buffer); - - RtlFreeUnicodeString(&LinkTarget); - - DPRINT("LdrpInitLoader() done\n"); -} - - -/*************************************************************************** - * NAME LOCAL - * LdrAdjustDllName - * - * DESCRIPTION - * Adjusts the name of a dll to a fully qualified name. - * - * ARGUMENTS - * FullDllName: Pointer to caller supplied storage for the fully - * qualified dll name. - * DllName: Pointer to the dll name. - * BaseName: TRUE: Only the file name is passed to FullDllName - * FALSE: The full path is preserved in FullDllName - * - * RETURN VALUE - * None - * - * REVISIONS - * - * NOTE - * A given path is not affected by the adjustment, but the file - * name only: - * ntdll --> ntdll.dll - * ntdll. --> ntdll - * ntdll.xyz --> ntdll.xyz - */ -static VOID -LdrAdjustDllName (PUNICODE_STRING FullDllName, - PUNICODE_STRING DllName, - BOOLEAN BaseName) -{ - WCHAR Buffer[MAX_PATH]; - ULONG Length; - PWCHAR Extension; - PWCHAR Pointer; - - Length = DllName->Length / sizeof(WCHAR); - - if (BaseName) - { - /* get the base dll name */ - Pointer = DllName->Buffer + Length; - Extension = Pointer; - - do - { - --Pointer; - } - while (Pointer >= DllName->Buffer && *Pointer != L'\\' && *Pointer != L'/'); - - Pointer++; - Length = Extension - Pointer; - memmove (Buffer, Pointer, Length * sizeof(WCHAR)); - Buffer[Length] = L'\0'; - } - else - { - /* get the full dll name */ - memmove (Buffer, DllName->Buffer, DllName->Length); - Buffer[DllName->Length / sizeof(WCHAR)] = L'\0'; - } - - /* Build the DLL's absolute name */ - Extension = wcsrchr (Buffer, L'.'); - if ((Extension != NULL) && (*Extension == L'.')) - { - /* with extension - remove dot if it's the last character */ - if (Buffer[Length - 1] == L'.') - Length--; - Buffer[Length] = 0; - } - else - { - /* name without extension - assume that it is .dll */ - memmove (Buffer + Length, L".dll", 10); - } - - RtlCreateUnicodeString(FullDllName, Buffer); -} - -PLDR_DATA_TABLE_ENTRY -LdrAddModuleEntry(PVOID ImageBase, - PIMAGE_NT_HEADERS NTHeaders, - PWSTR FullDosName) -{ - PLDR_DATA_TABLE_ENTRY Module; - - Module = RtlAllocateHeap(RtlGetProcessHeap(), 0, sizeof (LDR_DATA_TABLE_ENTRY)); - ASSERT(Module); - memset(Module, 0, sizeof(LDR_DATA_TABLE_ENTRY)); - Module->DllBase = (PVOID)ImageBase; - Module->EntryPoint = (PVOID)NTHeaders->OptionalHeader.AddressOfEntryPoint; - if (Module->EntryPoint != 0) - Module->EntryPoint = (PVOID)((ULONG_PTR)Module->EntryPoint + (ULONG_PTR)Module->DllBase); - Module->SizeOfImage = LdrpGetResidentSize(NTHeaders); - if (NtCurrentPeb()->Ldr->Initialized == TRUE) - { - /* loading while app is running */ - Module->LoadCount = 1; - } - else - { - /* - * loading while app is initializing - * dll must not be unloaded - */ - Module->LoadCount = LDRP_PROCESS_CREATION_TIME; - } - - Module->Flags = 0; - Module->TlsIndex = -1; - Module->CheckSum = NTHeaders->OptionalHeader.CheckSum; - Module->TimeDateStamp = NTHeaders->FileHeader.TimeDateStamp; - - RtlCreateUnicodeString (&Module->FullDllName, - FullDosName); - RtlCreateUnicodeString (&Module->BaseDllName, - wcsrchr(FullDosName, L'\\') + 1); - DPRINT ("BaseDllName %wZ\n", &Module->BaseDllName); - - RtlEnterCriticalSection (NtCurrentPeb()->LoaderLock); - InsertTailList(&NtCurrentPeb()->Ldr->InLoadOrderModuleList, - &Module->InLoadOrderLinks); - RtlLeaveCriticalSection(NtCurrentPeb()->LoaderLock); - - return(Module); -} - - -static NTSTATUS -LdrpMapKnownDll(IN PUNICODE_STRING DllName, - OUT PUNICODE_STRING FullDosName, - OUT PHANDLE SectionHandle) -{ - OBJECT_ATTRIBUTES ObjectAttributes; - NTSTATUS Status; - - DPRINT("LdrpMapKnownDll() called\n"); - - if (LdrpKnownDllObjectDirectory == NULL) - { - DPRINT("Invalid 'KnownDlls' directory\n"); - return STATUS_UNSUCCESSFUL; - } - - DPRINT("LdrpKnownDllPath '%wZ'\n", &LdrpKnownDllPath); - - InitializeObjectAttributes(&ObjectAttributes, - DllName, - OBJ_CASE_INSENSITIVE, - LdrpKnownDllObjectDirectory, - NULL); - Status = NtOpenSection(SectionHandle, - SECTION_MAP_READ | SECTION_MAP_WRITE | SECTION_MAP_EXECUTE, - &ObjectAttributes); - if (!NT_SUCCESS(Status)) - { - DPRINT("NtOpenSection() failed for '%wZ' (Status 0x%08lx)\n", DllName, Status); - return Status; - } - - FullDosName->Length = LdrpKnownDllPath.Length + DllName->Length + sizeof(WCHAR); - FullDosName->MaximumLength = FullDosName->Length + sizeof(WCHAR); - FullDosName->Buffer = RtlAllocateHeap(RtlGetProcessHeap(), - 0, - FullDosName->MaximumLength); - if (FullDosName->Buffer == NULL) - { - FullDosName->Length = 0; - FullDosName->MaximumLength = 0; - return STATUS_SUCCESS; - } - - wcscpy(FullDosName->Buffer, LdrpKnownDllPath.Buffer); - wcscat(FullDosName->Buffer, L"\\"); - wcscat(FullDosName->Buffer, DllName->Buffer); - - DPRINT("FullDosName '%wZ'\n", FullDosName); - - DPRINT("LdrpMapKnownDll() done\n"); - - return STATUS_SUCCESS; -} - - -static NTSTATUS -LdrpMapDllImageFile(IN PWSTR SearchPath OPTIONAL, - IN PUNICODE_STRING DllName, - OUT PUNICODE_STRING FullDosName, - IN BOOLEAN MapAsDataFile, - OUT PHANDLE SectionHandle) -{ - WCHAR *SearchPathBuffer = NULL; - WCHAR *ImagePathNameBufferPtr = NULL; - WCHAR DosName[MAX_PATH]; - UNICODE_STRING FullNtFileName; - UNICODE_STRING PathEnvironmentVar_U; - UNICODE_STRING PathName_U; - OBJECT_ATTRIBUTES FileObjectAttributes; - HANDLE FileHandle; - char BlockBuffer [1024]; - PIMAGE_DOS_HEADER DosHeader; - PIMAGE_NT_HEADERS NTHeaders; - IO_STATUS_BLOCK IoStatusBlock; - NTSTATUS Status; - ULONG len; - ULONG ImagePathLen; - - DPRINT("LdrpMapDllImageFile() called\n"); - - if (SearchPath == NULL) - { - /* get application running path */ - ImagePathNameBufferPtr = NtCurrentPeb()->ProcessParameters->ImagePathName.Buffer; - - /* Length of ImagePathName */ - ImagePathLen = wcslen(ImagePathNameBufferPtr); - - /* Subtract application name leaveing only the directory length */ - while (ImagePathLen && ImagePathNameBufferPtr[ImagePathLen - 1] != L'\\') - ImagePathLen--; - - /* Length of directory + semicolon */ - len = ImagePathLen + 1; - - /* Length of SystemRoot + "//system32" + semicolon*/ - len += wcslen(SharedUserData->NtSystemRoot) + 10; - /* Length of SystemRoot + semicolon */ - len += wcslen(SharedUserData->NtSystemRoot) + 1; - - RtlInitUnicodeString (&PathName_U, L"PATH"); - PathEnvironmentVar_U.Length = 0; - PathEnvironmentVar_U.MaximumLength = 0; - PathEnvironmentVar_U.Buffer = NULL; - - /* Get the path environment variable */ - Status = RtlQueryEnvironmentVariable_U(NULL, &PathName_U, &PathEnvironmentVar_U); - - /* Check that valid information was returned */ - if ((Status == STATUS_BUFFER_TOO_SMALL) && (PathEnvironmentVar_U.Length > 0)) - { - /* Allocate memory for the path env var */ - PathEnvironmentVar_U.Buffer = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, PathEnvironmentVar_U.Length + sizeof(WCHAR)); - if (!PathEnvironmentVar_U.Buffer) - { - DPRINT1("Fatal! Out of Memory!!\n"); - return STATUS_NO_MEMORY; - } - PathEnvironmentVar_U.MaximumLength = PathEnvironmentVar_U.Length + sizeof(WCHAR); - - /* Retry */ - Status = RtlQueryEnvironmentVariable_U(NULL, &PathName_U, &PathEnvironmentVar_U); - - if (!NT_SUCCESS(Status)) - { - DPRINT1("Unable to get path environment string!\n"); - ASSERT(FALSE); - } - /* Length of path evn var + semicolon */ - len += (PathEnvironmentVar_U.Length / sizeof(WCHAR)) + 1; - } - - /* Allocate the size needed to hold all the above paths + period */ - SearchPathBuffer = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, (len + 2) * sizeof(WCHAR)); - if (!SearchPathBuffer) - { - DPRINT1("Fatal! Out of Memory!!\n"); - return STATUS_NO_MEMORY; - } - - wcsncpy(SearchPathBuffer, ImagePathNameBufferPtr, ImagePathLen); - wcscat (SearchPathBuffer, L";"); - wcscat (SearchPathBuffer, SharedUserData->NtSystemRoot); - wcscat (SearchPathBuffer, L"\\system32;"); - wcscat (SearchPathBuffer, SharedUserData->NtSystemRoot); - wcscat (SearchPathBuffer, L";"); - - if (PathEnvironmentVar_U.Buffer) - { - wcscat (SearchPathBuffer, PathEnvironmentVar_U.Buffer); - wcscat (SearchPathBuffer, L";"); - RtlFreeHeap(RtlGetProcessHeap(), 0, PathEnvironmentVar_U.Buffer); - } - wcscat (SearchPathBuffer, L"."); - - SearchPath = SearchPathBuffer; - } - - if (RtlDosSearchPath_U (SearchPath, - DllName->Buffer, - NULL, - MAX_PATH, - DosName, - NULL) == 0) - { - /* try to find active context dll */ - Status = find_actctx_dll(DllName->Buffer, DosName); - if(Status == STATUS_SUCCESS) - DPRINT("found %S for %S\n", DosName,DllName->Buffer); - else - return STATUS_DLL_NOT_FOUND; - } - - if (!RtlDosPathNameToNtPathName_U (DosName, - &FullNtFileName, - NULL, - NULL)) - { - DPRINT("Dll %wZ not found!\n", DllName); - return STATUS_DLL_NOT_FOUND; - } - - DPRINT("FullNtFileName %wZ\n", &FullNtFileName); - - InitializeObjectAttributes(&FileObjectAttributes, - &FullNtFileName, - 0, - NULL, - NULL); - - DPRINT("Opening dll \"%wZ\"\n", &FullNtFileName); - - Status = NtOpenFile(&FileHandle, - GENERIC_READ|SYNCHRONIZE, - &FileObjectAttributes, - &IoStatusBlock, - FILE_SHARE_READ, - FILE_SYNCHRONOUS_IO_NONALERT); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Dll open of %wZ failed: Status = 0x%08lx\n", - &FullNtFileName, Status); - RtlFreeHeap (RtlGetProcessHeap (), - 0, - FullNtFileName.Buffer); - return Status; - } - RtlFreeHeap (RtlGetProcessHeap (), - 0, - FullNtFileName.Buffer); - - if (!MapAsDataFile) - { - - Status = NtReadFile(FileHandle, - NULL, - NULL, - NULL, - &IoStatusBlock, - BlockBuffer, - sizeof(BlockBuffer), - NULL, - NULL); - if (!NT_SUCCESS(Status)) - { - DPRINT("Dll header read failed: Status = 0x%08lx\n", Status); - NtClose(FileHandle); - return Status; - } - - /* - * Overlay DOS and NT headers structures to the - * buffer with DLL's header raw data. - */ - DosHeader = (PIMAGE_DOS_HEADER) BlockBuffer; - NTHeaders = (PIMAGE_NT_HEADERS) (BlockBuffer + DosHeader->e_lfanew); - /* - * Check it is a PE image file. - */ - if ((DosHeader->e_magic != IMAGE_DOS_SIGNATURE) - || (DosHeader->e_lfanew == 0L) - || (*(PULONG)(NTHeaders) != IMAGE_NT_SIGNATURE)) - { - DPRINT("NTDLL format invalid\n"); - NtClose(FileHandle); - - return STATUS_UNSUCCESSFUL; - } - } - - /* - * Create a section for dll. - */ - Status = NtCreateSection(SectionHandle, - SECTION_ALL_ACCESS, - NULL, - NULL, - PAGE_READONLY, - MapAsDataFile ? SEC_COMMIT : SEC_IMAGE, - FileHandle); - NtClose(FileHandle); - - if (!NT_SUCCESS(Status)) - { - DPRINT("NTDLL create section failed: Status = 0x%08lx\n", Status); - return Status; - } - - RtlCreateUnicodeString(FullDosName, - DosName); - - return Status; -} - - - -/*************************************************************************** - * NAME EXPORTED - * LdrLoadDll - * - * DESCRIPTION - * - * ARGUMENTS - * - * RETURN VALUE - * - * REVISIONS - * - * NOTE - * - * @implemented - */ -NTSTATUS NTAPI -LdrLoadDll (IN PWSTR SearchPath OPTIONAL, - IN PULONG LoadFlags OPTIONAL, - IN PUNICODE_STRING Name, - OUT PVOID *BaseAddress /* also known as HMODULE*, and PHANDLE 'DllHandle' */) -{ - NTSTATUS Status; - PLDR_DATA_TABLE_ENTRY Module; - ULONG_PTR cookie; - PPEB Peb = NtCurrentPeb(); - - TRACE_LDR("LdrLoadDll loading %wZ%S%S with flags %d\n", - Name, - SearchPath ? L" from " : L"", - SearchPath ? SearchPath : L"", - LoadFlags ? *LoadFlags : 0); - - Status = LdrpLoadModule(SearchPath, LoadFlags ? *LoadFlags : 0, Name, &Module, BaseAddress); - - if (NT_SUCCESS(Status) && - (!LoadFlags || 0 == (*LoadFlags & LOAD_LIBRARY_AS_DATAFILE))) - { - if (!create_module_activation_context( Module )) - { - RtlActivateActivationContext(0, Module->EntryPointActivationContext, &cookie); - } - - if (!(Module->Flags & LDRP_PROCESS_ATTACH_CALLED)) - { - RtlEnterCriticalSection(Peb->LoaderLock); - Status = LdrpRunInitializeRoutines(NULL); - RtlLeaveCriticalSection(Peb->LoaderLock); - } - if (Module->EntryPointActivationContext) RtlDeactivateActivationContext(0, cookie); - } - - if ((!Module) && (NT_SUCCESS(Status))) - return Status; - - *BaseAddress = NT_SUCCESS(Status) ? Module->DllBase : NULL; - - return Status; -} - - -/*************************************************************************** - * NAME EXPORTED - * LdrFindEntryForAddress - * - * DESCRIPTION - * - * ARGUMENTS - * - * RETURN VALUE - * - * REVISIONS - * - * NOTE - * - * @implemented - */ -NTSTATUS NTAPI -LdrFindEntryForAddress(PVOID Address, - PLDR_DATA_TABLE_ENTRY *Module) -{ - PLIST_ENTRY ModuleListHead; - PLIST_ENTRY Entry; - PLDR_DATA_TABLE_ENTRY ModulePtr; - - DPRINT("LdrFindEntryForAddress(Address %p)\n", Address); - - if (NtCurrentPeb()->Ldr == NULL) - return(STATUS_NO_MORE_ENTRIES); - - RtlEnterCriticalSection(NtCurrentPeb()->LoaderLock); - ModuleListHead = &NtCurrentPeb()->Ldr->InLoadOrderModuleList; - Entry = ModuleListHead->Flink; - if (Entry == ModuleListHead) - { - RtlLeaveCriticalSection(NtCurrentPeb()->LoaderLock); - return(STATUS_NO_MORE_ENTRIES); - } - - while (Entry != ModuleListHead) - { - ModulePtr = CONTAINING_RECORD(Entry, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks); - - DPRINT("Scanning %wZ at %p\n", &ModulePtr->BaseDllName, ModulePtr->DllBase); - - if ((Address >= ModulePtr->DllBase) && - ((ULONG_PTR)Address <= ((ULONG_PTR)ModulePtr->DllBase + ModulePtr->SizeOfImage))) - { - *Module = ModulePtr; - RtlLeaveCriticalSection(NtCurrentPeb()->LoaderLock); - return(STATUS_SUCCESS); - } - - Entry = Entry->Flink; - } - - DPRINT("Failed to find module entry.\n"); - - RtlLeaveCriticalSection(NtCurrentPeb()->LoaderLock); - return(STATUS_NO_MORE_ENTRIES); -} - - -/*************************************************************************** - * NAME LOCAL - * LdrFindEntryForName - * - * DESCRIPTION - * - * ARGUMENTS - * - * RETURN VALUE - * - * REVISIONS - * - * NOTE - * - */ -static NTSTATUS -LdrFindEntryForName(PUNICODE_STRING Name, - PLDR_DATA_TABLE_ENTRY *Module, - BOOLEAN Ref) -{ - PLIST_ENTRY ModuleListHead; - PLIST_ENTRY Entry; - PLDR_DATA_TABLE_ENTRY ModulePtr; - BOOLEAN ContainsPath; - UNICODE_STRING AdjustedName; - - DPRINT("LdrFindEntryForName(Name %wZ)\n", Name); - - if (NtCurrentPeb()->Ldr == NULL) - return(STATUS_NO_MORE_ENTRIES); - - RtlEnterCriticalSection(NtCurrentPeb()->LoaderLock); - ModuleListHead = &NtCurrentPeb()->Ldr->InLoadOrderModuleList; - Entry = ModuleListHead->Flink; - if (Entry == ModuleListHead) - { - RtlLeaveCriticalSection(NtCurrentPeb()->LoaderLock); - return(STATUS_NO_MORE_ENTRIES); - } - - // NULL is the current process - if (Name == NULL) - { - *Module = LdrpImageEntry; - RtlLeaveCriticalSection(NtCurrentPeb()->LoaderLock); - return(STATUS_SUCCESS); - } - - ContainsPath = (Name->Length >= 2 * sizeof(WCHAR) && L':' == Name->Buffer[1]); - LdrAdjustDllName (&AdjustedName, Name, !ContainsPath); - - if (LdrpLastModule) - { - if ((!ContainsPath && - 0 == RtlCompareUnicodeString(&LdrpLastModule->BaseDllName, &AdjustedName, TRUE)) || - (ContainsPath && - 0 == RtlCompareUnicodeString(&LdrpLastModule->FullDllName, &AdjustedName, TRUE))) - { - *Module = LdrpLastModule; - if (Ref && (*Module)->LoadCount != LDRP_PROCESS_CREATION_TIME) - { - (*Module)->LoadCount++; - } - RtlLeaveCriticalSection(NtCurrentPeb()->LoaderLock); - RtlFreeUnicodeString(&AdjustedName); - return(STATUS_SUCCESS); - } - } - while (Entry != ModuleListHead) - { - ModulePtr = CONTAINING_RECORD(Entry, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks); - - DPRINT("Scanning %wZ %wZ\n", &ModulePtr->BaseDllName, &AdjustedName); - - if ((!ContainsPath && - 0 == RtlCompareUnicodeString(&ModulePtr->BaseDllName, &AdjustedName, TRUE)) || - (ContainsPath && - 0 == RtlCompareUnicodeString(&ModulePtr->FullDllName, &AdjustedName, TRUE))) - { - *Module = LdrpLastModule = ModulePtr; - if (Ref && ModulePtr->LoadCount != LDRP_PROCESS_CREATION_TIME) - { - ModulePtr->LoadCount++; - } - RtlLeaveCriticalSection(NtCurrentPeb()->LoaderLock); - RtlFreeUnicodeString(&AdjustedName); - return(STATUS_SUCCESS); - } - - Entry = Entry->Flink; - } - - DPRINT("Failed to find dll %wZ\n", Name); - RtlLeaveCriticalSection(NtCurrentPeb()->LoaderLock); - RtlFreeUnicodeString(&AdjustedName); - return(STATUS_NO_MORE_ENTRIES); -} - -/********************************************************************** - * NAME LOCAL - * LdrFixupForward - * - * DESCRIPTION - * - * ARGUMENTS - * - * RETURN VALUE - * - * REVISIONS - * - * NOTE - * - */ -static PVOID -LdrFixupForward(PCHAR ForwardName) -{ - CHAR NameBuffer[128]; - UNICODE_STRING DllName; - NTSTATUS Status; - PCHAR p; - PLDR_DATA_TABLE_ENTRY Module; - PVOID BaseAddress; - - strcpy(NameBuffer, ForwardName); - p = strchr(NameBuffer, '.'); - if (p != NULL) - { - *p = 0; - - DPRINT("Dll: %s Function: %s\n", NameBuffer, p+1); - RtlCreateUnicodeStringFromAsciiz (&DllName, - NameBuffer); - - Status = LdrFindEntryForName (&DllName, &Module, FALSE); - /* FIXME: - * The caller (or the image) is responsible for loading of the dll, where the function is forwarded. - */ - if (!NT_SUCCESS(Status)) - { - Status = LdrLoadDll(NULL, NULL, &DllName, &BaseAddress); - if (NT_SUCCESS(Status)) - { - Status = LdrFindEntryForName (&DllName, &Module, FALSE); - } - } - RtlFreeUnicodeString (&DllName); - if (!NT_SUCCESS(Status)) - { - DPRINT1("LdrFixupForward: failed to load %s\n", NameBuffer); - return NULL; - } - - DPRINT("BaseAddress: %p\n", Module->DllBase); - - return LdrGetExportByName(Module->DllBase, (PUCHAR)(p+1), -1); - } - - return NULL; -} - - -/********************************************************************** - * NAME LOCAL - * LdrGetExportByOrdinal - * - * DESCRIPTION - * - * ARGUMENTS - * - * RETURN VALUE - * - * REVISIONS - * - * NOTE - * - */ -static PVOID -LdrGetExportByOrdinal ( - PVOID BaseAddress, - ULONG Ordinal -) -{ - PIMAGE_EXPORT_DIRECTORY ExportDir; - ULONG ExportDirSize; - PDWORD * ExFunctions; - PVOID Function; - - ExportDir = (PIMAGE_EXPORT_DIRECTORY) - RtlImageDirectoryEntryToData (BaseAddress, - TRUE, - IMAGE_DIRECTORY_ENTRY_EXPORT, - &ExportDirSize); - - - ExFunctions = (PDWORD*)RVA(BaseAddress, ExportDir->AddressOfFunctions); - DPRINT("LdrGetExportByOrdinal(Ordinal %lu) = %p\n", - Ordinal, RVA(BaseAddress, ExFunctions[Ordinal - ExportDir->Base])); - - Function = (0 != ExFunctions[Ordinal - ExportDir->Base] - ? RVA(BaseAddress, ExFunctions[Ordinal - ExportDir->Base] ) - : NULL); - - if (((ULONG)Function >= (ULONG)ExportDir) && - ((ULONG)Function < (ULONG)ExportDir + (ULONG)ExportDirSize)) - { - DPRINT("Forward: %s\n", (PCHAR)Function); - Function = LdrFixupForward((PCHAR)Function); - } - - return Function; -} - - -/********************************************************************** - * NAME LOCAL - * LdrGetExportByName - * - * DESCRIPTION - * - * ARGUMENTS - * - * RETURN VALUE - * - * REVISIONS - * - * NOTE - * AddressOfNames and AddressOfNameOrdinals are paralell tables, - * both with NumberOfNames entries. - * - */ -static PVOID -LdrGetExportByName(PVOID BaseAddress, - PUCHAR SymbolName, - WORD Hint) -{ - PIMAGE_EXPORT_DIRECTORY ExportDir; - PDWORD *ExFunctions; - PDWORD *ExNames; - USHORT *ExOrdinals; - PVOID ExName; - ULONG Ordinal; - PVOID Function; - LONG minn, maxn; - ULONG ExportDirSize; - - DPRINT("LdrGetExportByName %p %s %hu\n", BaseAddress, SymbolName, Hint); - - ExportDir = (PIMAGE_EXPORT_DIRECTORY) - RtlImageDirectoryEntryToData(BaseAddress, - TRUE, - IMAGE_DIRECTORY_ENTRY_EXPORT, - &ExportDirSize); - if (ExportDir == NULL) - { - DPRINT1("LdrGetExportByName(): no export directory, " - "can't lookup %s/%hu!\n", SymbolName, Hint); - return NULL; - } - - - //The symbol names may be missing entirely - if (ExportDir->AddressOfNames == 0) - { - DPRINT("LdrGetExportByName(): symbol names missing entirely\n"); - return NULL; - } - - /* - * Get header pointers - */ - ExNames = (PDWORD *)RVA(BaseAddress, ExportDir->AddressOfNames); - ExOrdinals = (USHORT *)RVA(BaseAddress, ExportDir->AddressOfNameOrdinals); - ExFunctions = (PDWORD *)RVA(BaseAddress, ExportDir->AddressOfFunctions); - - /* - * Check the hint first - */ - if (Hint < ExportDir->NumberOfNames) - { - ExName = RVA(BaseAddress, ExNames[Hint]); - if (strcmp(ExName, (PCHAR)SymbolName) == 0) - { - Ordinal = ExOrdinals[Hint]; - Function = RVA(BaseAddress, ExFunctions[Ordinal]); - if (((ULONG)Function >= (ULONG)ExportDir) && - ((ULONG)Function < (ULONG)ExportDir + (ULONG)ExportDirSize)) - { - DPRINT("Forward: %s\n", (PCHAR)Function); - Function = LdrFixupForward((PCHAR)Function); - if (Function == NULL) - { - DPRINT1("LdrGetExportByName(): failed to find %s\n",SymbolName); - } - return Function; - } - if (Function != NULL) - return Function; - } - } - - /* - * Binary search - */ - minn = 0; - maxn = ExportDir->NumberOfNames - 1; - while (minn <= maxn) - { - LONG mid; - LONG res; - - mid = (minn + maxn) / 2; - - ExName = RVA(BaseAddress, ExNames[mid]); - res = strcmp(ExName, (PCHAR)SymbolName); - if (res == 0) - { - Ordinal = ExOrdinals[mid]; - Function = RVA(BaseAddress, ExFunctions[Ordinal]); - if (((ULONG)Function >= (ULONG)ExportDir) && - ((ULONG)Function < (ULONG)ExportDir + (ULONG)ExportDirSize)) - { - DPRINT("Forward: %s\n", (PCHAR)Function); - Function = LdrFixupForward((PCHAR)Function); - if (Function == NULL) - { - DPRINT1("LdrGetExportByName(): failed to find %s\n",SymbolName); - } - return Function; - } - if (Function != NULL) - return Function; - } - else if (minn == maxn) - { - DPRINT("LdrGetExportByName(): binary search failed\n"); - break; - } - else if (res > 0) - { - maxn = mid - 1; - } - else - { - minn = mid + 1; - } - } - - DPRINT("LdrGetExportByName(): failed to find %s\n",SymbolName); - return (PVOID)NULL; -} - - -/********************************************************************** - * NAME LOCAL - * LdrPerformRelocations - * - * DESCRIPTION - * Relocate a DLL's memory image. - * - * ARGUMENTS - * - * RETURN VALUE - * - * REVISIONS - * - * NOTE - * - */ -NTSTATUS -LdrPerformRelocations(PIMAGE_NT_HEADERS NTHeaders, - PVOID ImageBase) -{ - PIMAGE_DATA_DIRECTORY RelocationDDir; - PIMAGE_BASE_RELOCATION RelocationDir, RelocationEnd; - ULONG Count, ProtectSize, OldProtect, OldProtect2; - PVOID Page, ProtectPage, ProtectPage2; - PUSHORT TypeOffset; - LONG_PTR Delta; - NTSTATUS Status; - - if (NTHeaders->FileHeader.Characteristics & IMAGE_FILE_RELOCS_STRIPPED) - { - return STATUS_SUCCESS; - } - - RelocationDDir = - &NTHeaders->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC]; - - if (RelocationDDir->VirtualAddress == 0 || RelocationDDir->Size == 0) - { - return STATUS_SUCCESS; - } - - ProtectSize = PAGE_SIZE; - Delta = (ULONG_PTR)ImageBase - NTHeaders->OptionalHeader.ImageBase; - RelocationDir = (PIMAGE_BASE_RELOCATION)((ULONG_PTR)ImageBase + - RelocationDDir->VirtualAddress); - RelocationEnd = (PIMAGE_BASE_RELOCATION)((ULONG_PTR)ImageBase + - RelocationDDir->VirtualAddress + RelocationDDir->Size); - - while (RelocationDir < RelocationEnd && - RelocationDir->SizeOfBlock > 0) - { - Count = (RelocationDir->SizeOfBlock - sizeof(IMAGE_BASE_RELOCATION)) / - sizeof(USHORT); - Page = (PVOID)((ULONG_PTR)ImageBase + (ULONG_PTR)RelocationDir->VirtualAddress); - TypeOffset = (PUSHORT)(RelocationDir + 1); - - /* Unprotect the page(s) we're about to relocate. */ - ProtectPage = Page; - Status = NtProtectVirtualMemory(NtCurrentProcess(), - &ProtectPage, - &ProtectSize, - PAGE_READWRITE, - &OldProtect); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Failed to unprotect relocation target.\n"); - return Status; - } - - if (RelocationDir->VirtualAddress + PAGE_SIZE < - NTHeaders->OptionalHeader.SizeOfImage) - { - ProtectPage2 = (PVOID)((ULONG_PTR)ProtectPage + PAGE_SIZE); - Status = NtProtectVirtualMemory(NtCurrentProcess(), - &ProtectPage2, - &ProtectSize, - PAGE_READWRITE, - &OldProtect2); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Failed to unprotect relocation target (2).\n"); - NtProtectVirtualMemory(NtCurrentProcess(), - &ProtectPage, - &ProtectSize, - OldProtect, - &OldProtect); - return Status; - } - } - else - { - ProtectPage2 = NULL; - } - - RelocationDir = LdrProcessRelocationBlock((ULONG_PTR)Page, - Count, - TypeOffset, - Delta); - if (RelocationDir == NULL) - return STATUS_UNSUCCESSFUL; - - /* Restore old page protection. */ - NtProtectVirtualMemory(NtCurrentProcess(), - &ProtectPage, - &ProtectSize, - OldProtect, - &OldProtect); - - if (ProtectPage2 != NULL) - { - NtProtectVirtualMemory(NtCurrentProcess(), - &ProtectPage2, - &ProtectSize, - OldProtect2, - &OldProtect2); - } - } - - return STATUS_SUCCESS; -} - -static NTSTATUS -LdrpGetOrLoadModule(PWCHAR SearchPath, - PCHAR Name, - PLDR_DATA_TABLE_ENTRY* Module, - BOOLEAN Load) -{ - ANSI_STRING AnsiDllName; - UNICODE_STRING DllName; - NTSTATUS Status; - - DPRINT("LdrpGetOrLoadModule() called for %s\n", Name); - - RtlInitAnsiString(&AnsiDllName, Name); - Status = RtlAnsiStringToUnicodeString(&DllName, &AnsiDllName, TRUE); - if (!NT_SUCCESS(Status)) - { - return Status; - } - - Status = LdrFindEntryForName (&DllName, Module, Load); - if (Load && !NT_SUCCESS(Status)) - { - Status = LdrpLoadModule(SearchPath, - 0, - &DllName, - Module, - NULL); - if (NT_SUCCESS(Status)) - { - Status = LdrFindEntryForName (&DllName, Module, FALSE); - } - if (!NT_SUCCESS(Status)) - { - ULONG ErrorResponse; - ULONG_PTR ErrorParameter = (ULONG_PTR)&AnsiDllName; - - DPRINT1("failed to load %wZ\n", &DllName); - - NtRaiseHardError(STATUS_DLL_NOT_FOUND, - 1, - 1, - &ErrorParameter, - OptionOk, - &ErrorResponse); - } - } - RtlFreeUnicodeString (&DllName); - return Status; -} - -void -RtlpRaiseImportNotFound(CHAR *FuncName, ULONG Ordinal, PUNICODE_STRING DllName) -{ - ULONG ErrorResponse; - ULONG_PTR ErrorParameters[2]; - ANSI_STRING ProcNameAnsi; - ANSI_STRING DllNameAnsi; - CHAR Buffer[8]; - - if (!FuncName) - { - _snprintf(Buffer, 8, "# %ld", Ordinal); - FuncName = Buffer; - } - - RtlInitAnsiString(&ProcNameAnsi, FuncName); - RtlUnicodeStringToAnsiString(&DllNameAnsi, DllName, TRUE); - ErrorParameters[0] = (ULONG_PTR)&ProcNameAnsi; - ErrorParameters[1] = (ULONG_PTR)&DllNameAnsi; - NtRaiseHardError(STATUS_ENTRYPOINT_NOT_FOUND, - 2, - 3, - ErrorParameters, - OptionOk, - &ErrorResponse); - RtlFreeAnsiString(&DllNameAnsi); -} - -static NTSTATUS -LdrpProcessImportDirectoryEntry(PLDR_DATA_TABLE_ENTRY Module, - PLDR_DATA_TABLE_ENTRY ImportedModule, - PIMAGE_IMPORT_DESCRIPTOR ImportModuleDirectory) -{ - NTSTATUS Status; - PVOID* ImportAddressList; - PULONG FunctionNameList; - PVOID IATBase; - ULONG OldProtect; - ULONG Ordinal; - ULONG IATSize; - - if (ImportModuleDirectory == NULL || ImportModuleDirectory->Name == 0) - { - return STATUS_UNSUCCESSFUL; - } - - /* Get the import address list. */ - ImportAddressList = (PVOID *)((ULONG_PTR)Module->DllBase + - (ULONG_PTR)ImportModuleDirectory->FirstThunk); - - /* Get the list of functions to import. */ - if (ImportModuleDirectory->OriginalFirstThunk != 0) - { - FunctionNameList = (PULONG)((ULONG_PTR)Module->DllBase + - (ULONG_PTR)ImportModuleDirectory->OriginalFirstThunk); - } - else - { - FunctionNameList = (PULONG)((ULONG_PTR)Module->DllBase + - (ULONG_PTR)ImportModuleDirectory->FirstThunk); - } - - /* Get the size of IAT. */ - IATSize = 0; - while (FunctionNameList[IATSize] != 0L) - { - IATSize++; - } - - /* No need to fixup anything if IAT is empty */ - if (IATSize == 0) return STATUS_SUCCESS; - - /* Unprotect the region we are about to write into. */ - IATBase = (PVOID)ImportAddressList; - IATSize *= sizeof(PVOID*); - Status = NtProtectVirtualMemory(NtCurrentProcess(), - &IATBase, - &IATSize, - PAGE_READWRITE, - &OldProtect); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Failed to unprotect IAT.\n"); - return(Status); - } - - /* Walk through function list and fixup addresses. */ - while (*FunctionNameList != 0L) - { - if ((*FunctionNameList) & 0x80000000) - { - Ordinal = (*FunctionNameList) & 0x7fffffff; - *ImportAddressList = LdrGetExportByOrdinal(ImportedModule->DllBase, - Ordinal); - if ((*ImportAddressList) == NULL) - { - DPRINT1("Failed to import #%ld from %wZ\n", - Ordinal, &ImportedModule->FullDllName); - RtlpRaiseImportNotFound(NULL, Ordinal, &ImportedModule->FullDllName); - return STATUS_ENTRYPOINT_NOT_FOUND; - } - } - else - { - IMAGE_IMPORT_BY_NAME *pe_name; - pe_name = RVA(Module->DllBase, *FunctionNameList); - *ImportAddressList = LdrGetExportByName(ImportedModule->DllBase, - pe_name->Name, - pe_name->Hint); - if ((*ImportAddressList) == NULL) - { - DPRINT1("Failed to import %s from %wZ\n", - pe_name->Name, &ImportedModule->FullDllName); - RtlpRaiseImportNotFound((CHAR*)pe_name->Name, - 0, - &ImportedModule->FullDllName); - return STATUS_ENTRYPOINT_NOT_FOUND; - } - } - ImportAddressList++; - FunctionNameList++; - } - - /* Protect the region we are about to write into. */ - Status = NtProtectVirtualMemory(NtCurrentProcess(), - &IATBase, - &IATSize, - OldProtect, - &OldProtect); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Failed to protect IAT.\n"); - return(Status); - } - - return STATUS_SUCCESS; -} - -static NTSTATUS -LdrpProcessImportDirectory( - PLDR_DATA_TABLE_ENTRY Module, - PLDR_DATA_TABLE_ENTRY ImportedModule, - PCHAR ImportedName) -{ - NTSTATUS Status; - PIMAGE_IMPORT_DESCRIPTOR ImportModuleDirectory; - PCHAR Name; - ULONG Size; - - DPRINT("LdrpProcessImportDirectory(%p '%wZ', '%s')\n", - Module, &Module->BaseDllName, ImportedName); - - - ImportModuleDirectory = (PIMAGE_IMPORT_DESCRIPTOR) - RtlImageDirectoryEntryToData(Module->DllBase, - TRUE, - IMAGE_DIRECTORY_ENTRY_IMPORT, - &Size); - if (ImportModuleDirectory == NULL) - { - return STATUS_UNSUCCESSFUL; - } - - while (ImportModuleDirectory->Name) - { - Name = (PCHAR)Module->DllBase + ImportModuleDirectory->Name; - if (0 == _stricmp(Name, ImportedName)) - { - Status = LdrpProcessImportDirectoryEntry(Module, - ImportedModule, - ImportModuleDirectory); - if (!NT_SUCCESS(Status)) - { - return Status; - } - } - ImportModuleDirectory++; - } - - - return STATUS_SUCCESS; -} - - -static NTSTATUS -LdrpAdjustImportDirectory(PLDR_DATA_TABLE_ENTRY Module, - PLDR_DATA_TABLE_ENTRY ImportedModule, - PCHAR ImportedName) -{ - PIMAGE_IMPORT_DESCRIPTOR ImportModuleDirectory; - NTSTATUS Status; - PVOID* ImportAddressList; - PVOID Start; - PVOID End; - PULONG FunctionNameList; - PVOID IATBase; - ULONG OldProtect; - ULONG Offset; - ULONG IATSize; - PIMAGE_NT_HEADERS NTHeaders; - PCHAR Name; - ULONG Size; - - DPRINT("LdrpAdjustImportDirectory(Module %p '%wZ', %p '%wZ', '%s')\n", - Module, &Module->BaseDllName, ImportedModule, &ImportedModule->BaseDllName, ImportedName); - - ImportModuleDirectory = (PIMAGE_IMPORT_DESCRIPTOR) - RtlImageDirectoryEntryToData(Module->DllBase, - TRUE, - IMAGE_DIRECTORY_ENTRY_IMPORT, - &Size); - if (ImportModuleDirectory == NULL) - { - return STATUS_UNSUCCESSFUL; - } - - while (ImportModuleDirectory->Name) - { - Name = (PCHAR)Module->DllBase + ImportModuleDirectory->Name; - if (0 == _stricmp(Name, (PCHAR)ImportedName)) - { - - /* Get the import address list. */ - ImportAddressList = (PVOID *)((ULONG_PTR)Module->DllBase + - (ULONG_PTR)ImportModuleDirectory->FirstThunk); - - /* Get the list of functions to import. */ - if (ImportModuleDirectory->OriginalFirstThunk != 0) - { - FunctionNameList = (PULONG)((ULONG_PTR)Module->DllBase + - (ULONG_PTR)ImportModuleDirectory->OriginalFirstThunk); - } - else - { - FunctionNameList = (PULONG)((ULONG_PTR)Module->DllBase + - (ULONG_PTR)ImportModuleDirectory->FirstThunk); - } - - /* Get the size of IAT. */ - IATSize = 0; - while (FunctionNameList[IATSize] != 0L) - { - IATSize++; - } - - /* Unprotect the region we are about to write into. */ - IATBase = (PVOID)ImportAddressList; - IATSize *= sizeof(PVOID*); - Status = NtProtectVirtualMemory(NtCurrentProcess(), - &IATBase, - &IATSize, - PAGE_READWRITE, - &OldProtect); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Failed to unprotect IAT.\n"); - return(Status); - } - - NTHeaders = RtlImageNtHeader (ImportedModule->DllBase); - Start = (PVOID)NTHeaders->OptionalHeader.ImageBase; - End = (PVOID)((ULONG_PTR)Start + ImportedModule->SizeOfImage); - Offset = (ULONG)((ULONG_PTR)ImportedModule->DllBase - (ULONG_PTR)Start); - - /* Walk through function list and fixup addresses. */ - while (*FunctionNameList != 0L) - { - if (*ImportAddressList >= Start && *ImportAddressList < End) - { - (*ImportAddressList) = (PVOID)((ULONG_PTR)(*ImportAddressList) + Offset); - } - ImportAddressList++; - FunctionNameList++; - } - - /* Protect the region we are about to write into. */ - Status = NtProtectVirtualMemory(NtCurrentProcess(), - &IATBase, - &IATSize, - OldProtect, - &OldProtect); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Failed to protect IAT.\n"); - return(Status); - } - } - ImportModuleDirectory++; - } - return STATUS_SUCCESS; -} - - -/********************************************************************** - * NAME LOCAL - * LdrFixupImports - * - * DESCRIPTION - * Compute the entry point for every symbol the DLL imports - * from other modules. - * - * ARGUMENTS - * - * RETURN VALUE - * - * REVISIONS - * - * NOTE - * - */ -static NTSTATUS -LdrFixupImports(IN PWSTR SearchPath OPTIONAL, - IN PLDR_DATA_TABLE_ENTRY Module) -{ - PIMAGE_IMPORT_DESCRIPTOR ImportModuleDirectory; - PIMAGE_IMPORT_DESCRIPTOR ImportModuleDirectoryCurrent; - PIMAGE_BOUND_IMPORT_DESCRIPTOR BoundImportDescriptor; - PIMAGE_BOUND_IMPORT_DESCRIPTOR BoundImportDescriptorCurrent; - PIMAGE_TLS_DIRECTORY TlsDirectory; - ULONG TlsSize = 0; - NTSTATUS Status = STATUS_SUCCESS; - PLDR_DATA_TABLE_ENTRY ImportedModule; - PCHAR ImportedName; - PWSTR ModulePath; - ULONG Size; - ULONG_PTR cookie; - - DPRINT("LdrFixupImports(SearchPath %S, Module %p)\n", SearchPath, Module); - - /* Check for tls data */ - TlsDirectory = (PIMAGE_TLS_DIRECTORY) - RtlImageDirectoryEntryToData(Module->DllBase, - TRUE, - IMAGE_DIRECTORY_ENTRY_TLS, - &Size); - if (TlsDirectory) - { - TlsSize = TlsDirectory->EndAddressOfRawData - - TlsDirectory->StartAddressOfRawData - + TlsDirectory->SizeOfZeroFill; - - if (TlsSize > 0 && NtCurrentPeb()->Ldr->Initialized) - { - TRACE_LDR("Trying to dynamically load %wZ which contains a TLS directory\n", - &Module->BaseDllName); - TlsDirectory = NULL; - } - } - - if (!create_module_activation_context( Module )) - { - if (Module->EntryPointActivationContext == NULL) - { - DPRINT("EntryPointActivationContext has not be allocated\n"); - DPRINT("Module->DllBaseName %wZ\n", Module->BaseDllName); - } - RtlActivateActivationContext( 0, Module->EntryPointActivationContext, &cookie ); - } - - /* - * Process each import module. - */ - ImportModuleDirectory = (PIMAGE_IMPORT_DESCRIPTOR) - RtlImageDirectoryEntryToData(Module->DllBase, - TRUE, - IMAGE_DIRECTORY_ENTRY_IMPORT, - &Size); - - BoundImportDescriptor = (PIMAGE_BOUND_IMPORT_DESCRIPTOR) - RtlImageDirectoryEntryToData(Module->DllBase, - TRUE, - IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT, - &Size); - - if (BoundImportDescriptor != NULL && ImportModuleDirectory == NULL) - { - DPRINT1("%wZ has only a bound import directory\n", &Module->BaseDllName); - return STATUS_UNSUCCESSFUL; - } - if (BoundImportDescriptor) - { - DPRINT("BoundImportDescriptor %p\n", BoundImportDescriptor); - - BoundImportDescriptorCurrent = BoundImportDescriptor; - while (BoundImportDescriptorCurrent->OffsetModuleName) - { - ImportedName = (PCHAR)BoundImportDescriptor + - BoundImportDescriptorCurrent->OffsetModuleName; - TRACE_LDR("%wZ bound to %s\n", &Module->BaseDllName, ImportedName); - Status = LdrpGetOrLoadModule(SearchPath, ImportedName, &ImportedModule, TRUE); - if (!NT_SUCCESS(Status)) - { - DPRINT1("failed to load %s\n", ImportedName); - return Status; - } - if (Module == ImportedModule) - { - LdrpDecrementLoadCount(Module, FALSE); - } - if (ImportedModule->TimeDateStamp != BoundImportDescriptorCurrent->TimeDateStamp) - { - TRACE_LDR("%wZ has stale binding to %wZ\n", - &Module->BaseDllName, &ImportedModule->BaseDllName); - Status = LdrpProcessImportDirectory(Module, ImportedModule, ImportedName); - if (!NT_SUCCESS(Status)) - { - DPRINT1("failed to import %s\n", ImportedName); - return Status; - } - } - else - { - BOOLEAN WrongForwarder; - WrongForwarder = FALSE; - if (ImportedModule->Flags & LDRP_IMAGE_NOT_AT_BASE) - { - TRACE_LDR("%wZ has stale binding to %s\n", - &Module->BaseDllName, ImportedName); - } - else - { - TRACE_LDR("%wZ has correct binding to %wZ\n", - &Module->BaseDllName, &ImportedModule->BaseDllName); - } - if (BoundImportDescriptorCurrent->NumberOfModuleForwarderRefs) - { - PIMAGE_BOUND_FORWARDER_REF BoundForwarderRef; - ULONG i; - PLDR_DATA_TABLE_ENTRY ForwarderModule; - PCHAR ForwarderName; - - BoundForwarderRef = (PIMAGE_BOUND_FORWARDER_REF)(BoundImportDescriptorCurrent + 1); - for (i = 0; - i < BoundImportDescriptorCurrent->NumberOfModuleForwarderRefs; - i++, BoundForwarderRef++) - { - ForwarderName = (PCHAR)BoundImportDescriptor + - BoundForwarderRef->OffsetModuleName; - TRACE_LDR("%wZ bound to %s via forwardes from %s\n", - &Module->BaseDllName, ForwarderName, ImportedName); - Status = LdrpGetOrLoadModule(SearchPath, ForwarderName, &ForwarderModule, TRUE); - if (!NT_SUCCESS(Status)) - { - DPRINT1("failed to load %s\n", ForwarderName); - return Status; - } - if (Module == ImportedModule) - { - LdrpDecrementLoadCount(Module, FALSE); - } - if (ForwarderModule->TimeDateStamp != BoundForwarderRef->TimeDateStamp || - ForwarderModule->Flags & LDRP_IMAGE_NOT_AT_BASE) - { - TRACE_LDR("%wZ has stale binding to %s\n", - &Module->BaseDllName, ForwarderName); - WrongForwarder = TRUE; - } - else - { - TRACE_LDR("%wZ has correct binding to %s\n", - &Module->BaseDllName, ForwarderName); - } - } - } - if (WrongForwarder || - ImportedModule->Flags & LDRP_IMAGE_NOT_AT_BASE) - { - Status = LdrpProcessImportDirectory(Module, ImportedModule, ImportedName); - if (!NT_SUCCESS(Status)) - { - DPRINT1("failed to import %s\n", ImportedName); - return Status; - } - } - else if (ImportedModule->Flags & LDRP_IMAGE_NOT_AT_BASE) - { - TRACE_LDR("Adjust imports for %s from %wZ\n", - ImportedName, &Module->BaseDllName); - Status = LdrpAdjustImportDirectory(Module, ImportedModule, ImportedName); - if (!NT_SUCCESS(Status)) - { - DPRINT1("failed to adjust import entries for %s\n", ImportedName); - return Status; - } - } - else if (WrongForwarder) - { - /* - * FIXME: - * Update only forwarders - */ - TRACE_LDR("Stale BIND %s from %wZ\n", - ImportedName, &Module->BaseDllName); - Status = LdrpProcessImportDirectory(Module, ImportedModule, ImportedName); - if (!NT_SUCCESS(Status)) - { - DPRINT1("faild to import %s\n", ImportedName); - return Status; - } - } - else - { - /* nothing to do */ - } - } - BoundImportDescriptorCurrent += BoundImportDescriptorCurrent->NumberOfModuleForwarderRefs + 1; - } - } - else if (ImportModuleDirectory) - { - DPRINT("ImportModuleDirectory %p\n", ImportModuleDirectory); - - ImportModuleDirectoryCurrent = ImportModuleDirectory; - while (ImportModuleDirectoryCurrent->Name) - { - ImportedName = (PCHAR)Module->DllBase + ImportModuleDirectoryCurrent->Name; - TRACE_LDR("%wZ imports functions from %s\n", &Module->BaseDllName, ImportedName); - - if (SearchPath == NULL) - { - ModulePath = LdrpQueryAppPaths(Module->BaseDllName.Buffer); - - Status = LdrpGetOrLoadModule(ModulePath, ImportedName, &ImportedModule, TRUE); - if (ModulePath != NULL) RtlFreeHeap(RtlGetProcessHeap(), 0, ModulePath); - if (NT_SUCCESS(Status)) goto Success; - } - - Status = LdrpGetOrLoadModule(SearchPath, ImportedName, &ImportedModule, TRUE); - if (!NT_SUCCESS(Status)) - { - DPRINT1("failed to load %s\n", ImportedName); - break; - } -Success: - if (Module == ImportedModule) - { - LdrpDecrementLoadCount(Module, FALSE); - } - - TRACE_LDR("Initializing imports for %wZ from %s\n", - &Module->BaseDllName, ImportedName); - Status = LdrpProcessImportDirectoryEntry(Module, ImportedModule, ImportModuleDirectoryCurrent); - if (!NT_SUCCESS(Status)) - { - DPRINT1("failed to import %s\n", ImportedName); - break; - } - ImportModuleDirectoryCurrent++; - } - - if (!NT_SUCCESS(Status)) - { - NTSTATUS errorStatus = Status; - - while (ImportModuleDirectoryCurrent >= ImportModuleDirectory) - { - ImportedName = (PCHAR)Module->DllBase + ImportModuleDirectoryCurrent->Name; - - Status = LdrpGetOrLoadModule(NULL, ImportedName, &ImportedModule, FALSE); - if (NT_SUCCESS(Status) && Module != ImportedModule) - { - Status = LdrpUnloadModule(ImportedModule, FALSE); - if (!NT_SUCCESS(Status)) DPRINT1("unable to unload %s\n", ImportedName); - } - ImportModuleDirectoryCurrent--; - } - return errorStatus; - } - } - - if (Module->EntryPointActivationContext) RtlDeactivateActivationContext( 0, cookie ); - - return STATUS_SUCCESS; -} - - -/********************************************************************** - * NAME - * LdrPEStartup - * - * DESCRIPTION - * 1. Relocate, if needed the EXE. - * 2. Fixup any imported symbol. - * 3. Compute the EXE's entry point. - * - * ARGUMENTS - * ImageBase - * Address at which the EXE's image - * is loaded. - * - * SectionHandle - * Handle of the section that contains - * the EXE's image. - * - * RETURN VALUE - * NULL on error; otherwise the entry point - * to call for initializing the DLL. - * - * REVISIONS - * - * NOTE - * 04.01.2004 hb Previous this function was used for all images (dll + exe). - * Currently the function is only used for the exe. - */ -PEPFUNC LdrPEStartup (PVOID ImageBase, - HANDLE SectionHandle, - PLDR_DATA_TABLE_ENTRY* Module, - PWSTR FullDosName) -{ - NTSTATUS Status; - PEPFUNC EntryPoint = NULL; - PIMAGE_DOS_HEADER DosHeader; - PIMAGE_NT_HEADERS NTHeaders; - PLDR_DATA_TABLE_ENTRY tmpModule; - PVOID ActivationContextStack; - - DPRINT("LdrPEStartup(ImageBase %p SectionHandle %p)\n", - ImageBase, SectionHandle); - - /* - * Overlay DOS and WNT headers structures - * to the DLL's image. - */ - DosHeader = (PIMAGE_DOS_HEADER) ImageBase; - NTHeaders = (PIMAGE_NT_HEADERS) ((ULONG_PTR)ImageBase + DosHeader->e_lfanew); - - /* - * If the base address is different from the - * one the DLL is actually loaded, perform any - * relocation. - */ - if (ImageBase != (PVOID)NTHeaders->OptionalHeader.ImageBase) - { - DPRINT("LDR: Performing relocations\n"); - Status = LdrPerformRelocations(NTHeaders, ImageBase); - if (!NT_SUCCESS(Status)) - { - DPRINT1("LdrPerformRelocations() failed\n"); - return NULL; - } - } - - if (Module != NULL) - { - *Module = LdrAddModuleEntry(ImageBase, NTHeaders, FullDosName); - (*Module)->SectionPointer = SectionHandle; - } - else - { - Module = &tmpModule; - Status = LdrFindEntryForAddress(ImageBase, Module); - if (!NT_SUCCESS(Status)) - { - return NULL; - } - } - - if (ImageBase != (PVOID) NTHeaders->OptionalHeader.ImageBase) - { - (*Module)->Flags |= LDRP_IMAGE_NOT_AT_BASE; - } - - /* Allocate memory for the ActivationContextStack */ - /* FIXME: Verify RtlAllocateActivationContextStack behavior */ - Status = RtlAllocateActivationContextStack(&ActivationContextStack); - if (NT_SUCCESS(Status)) - { - DPRINT("ActivationContextStack %x\n",ActivationContextStack); - DPRINT("ActiveFrame %x\n", ((PACTIVATION_CONTEXT_STACK)ActivationContextStack)->ActiveFrame); - NtCurrentTeb()->ActivationContextStackPointer = ActivationContextStack; - NtCurrentTeb()->ActivationContextStackPointer->ActiveFrame = NULL; - } - else - DPRINT1("Warning: Unable to allocate ActivationContextStack\n"); - - /* - * If the DLL's imports symbols from other - * modules, fixup the imported calls entry points. - */ - DPRINT("About to fixup imports\n"); - Status = LdrFixupImports(NULL, *Module); - if (!NT_SUCCESS(Status)) - { - DPRINT1("LdrFixupImports() failed for %wZ\n", &(*Module)->BaseDllName); - return NULL; - } - DPRINT("Fixup done\n"); - RtlEnterCriticalSection(NtCurrentPeb()->LoaderLock); - Status = LdrpInitializeTls(); - if (NT_SUCCESS(Status)) - { - Status = LdrpRunInitializeRoutines(NULL); - } - if (NT_SUCCESS(Status)) - { - LdrpTlsCallback((*Module)->DllBase, DLL_PROCESS_ATTACH); - } - - - RtlLeaveCriticalSection(NtCurrentPeb()->LoaderLock); - if (!NT_SUCCESS(Status)) - { - return NULL; - } - - /* - * Compute the DLL's entry point's address. - */ - DPRINT("ImageBase = %p\n", ImageBase); - DPRINT("AddressOfEntryPoint = 0x%lx\n",(ULONG)NTHeaders->OptionalHeader.AddressOfEntryPoint); - if (NTHeaders->OptionalHeader.AddressOfEntryPoint != 0) - { - EntryPoint = (PEPFUNC) ((ULONG_PTR)ImageBase - + NTHeaders->OptionalHeader.AddressOfEntryPoint); - } - DPRINT("LdrPEStartup() = %p\n",EntryPoint); - return EntryPoint; -} - -static NTSTATUS -LdrpLoadModule(IN PWSTR SearchPath OPTIONAL, - IN ULONG LoadFlags, - IN PUNICODE_STRING Name, - PLDR_DATA_TABLE_ENTRY *Module, - PVOID *BaseAddress OPTIONAL) -{ - UNICODE_STRING AdjustedName; - UNICODE_STRING FullDosName; - NTSTATUS Status; - PLDR_DATA_TABLE_ENTRY tmpModule; - HANDLE SectionHandle; - SIZE_T ViewSize; - PVOID ImageBase; - PIMAGE_NT_HEADERS NtHeaders; - BOOLEAN MappedAsDataFile; - PVOID ArbitraryUserPointer; - - if (Module == NULL) - { - Module = &tmpModule; - } - /* adjust the full dll name */ - LdrAdjustDllName(&AdjustedName, Name, FALSE); - - DPRINT("%wZ\n", &AdjustedName); - - MappedAsDataFile = FALSE; - /* Test if dll is already loaded */ - Status = LdrFindEntryForName(&AdjustedName, Module, TRUE); - if (NT_SUCCESS(Status)) - { - RtlFreeUnicodeString(&AdjustedName); - if (NULL != BaseAddress) - { - *BaseAddress = (*Module)->DllBase; - } - } - else - { - /* Open or create dll image section */ - Status = LdrpMapKnownDll(&AdjustedName, &FullDosName, &SectionHandle); - if (!NT_SUCCESS(Status)) - { - MappedAsDataFile = (0 != (LoadFlags & LOAD_LIBRARY_AS_DATAFILE)); - Status = LdrpMapDllImageFile(SearchPath, &AdjustedName, &FullDosName, - MappedAsDataFile, &SectionHandle); - } - if (!NT_SUCCESS(Status)) - { - DPRINT1("Failed to create or open dll section of '%wZ' (Status %lx)\n", - &AdjustedName, Status); - RtlFreeUnicodeString(&AdjustedName); - return Status; - } - RtlFreeUnicodeString(&AdjustedName); - /* Map the dll into the process */ - ViewSize = 0; - ImageBase = 0; - ArbitraryUserPointer = NtCurrentTeb()->NtTib.ArbitraryUserPointer; - NtCurrentTeb()->NtTib.ArbitraryUserPointer = FullDosName.Buffer; - Status = NtMapViewOfSection(SectionHandle, - NtCurrentProcess(), - &ImageBase, - 0, - 0, - NULL, - &ViewSize, - ViewShare, - 0, - PAGE_READONLY); - NtCurrentTeb()->NtTib.ArbitraryUserPointer = ArbitraryUserPointer; - if (!NT_SUCCESS(Status)) - { - DPRINT1("map view of section failed (Status 0x%08lx)\n", Status); - RtlFreeUnicodeString(&FullDosName); - NtClose(SectionHandle); - return(Status); - } - if (NULL != BaseAddress) - { - *BaseAddress = ImageBase; - } - if (!MappedAsDataFile) - { - /* Get and check the NT headers */ - NtHeaders = RtlImageNtHeader(ImageBase); - if (NtHeaders == NULL) - { - DPRINT1("RtlImageNtHeaders() failed\n"); - NtUnmapViewOfSection (NtCurrentProcess (), ImageBase); - NtClose (SectionHandle); - RtlFreeUnicodeString(&FullDosName); - return STATUS_UNSUCCESSFUL; - } - } - DPRINT("Mapped %wZ at %x\n", &FullDosName, ImageBase); - if (MappedAsDataFile) - { - ASSERT(NULL != BaseAddress); - if (NULL != BaseAddress) - { - *BaseAddress = (PVOID) ((char *) *BaseAddress + 1); - } - *Module = NULL; - RtlFreeUnicodeString(&FullDosName); - NtClose(SectionHandle); - return STATUS_SUCCESS; - } - /* If the base address is different from the - * one the DLL is actually loaded, perform any - * relocation. */ - if (ImageBase != (PVOID) NtHeaders->OptionalHeader.ImageBase) - { - DPRINT1("Relocating (%lx -> %p) %wZ\n", - NtHeaders->OptionalHeader.ImageBase, ImageBase, &FullDosName); - Status = LdrPerformRelocations(NtHeaders, ImageBase); - if (!NT_SUCCESS(Status)) - { - DPRINT1("LdrPerformRelocations() failed\n"); - NtUnmapViewOfSection (NtCurrentProcess (), ImageBase); - NtClose (SectionHandle); - RtlFreeUnicodeString(&FullDosName); - return STATUS_UNSUCCESSFUL; - } - } - *Module = LdrAddModuleEntry(ImageBase, NtHeaders, FullDosName.Buffer); - (*Module)->SectionPointer = SectionHandle; - if (ImageBase != (PVOID) NtHeaders->OptionalHeader.ImageBase) - { - (*Module)->Flags |= LDRP_IMAGE_NOT_AT_BASE; - } - if (NtHeaders->FileHeader.Characteristics & IMAGE_FILE_DLL) - { - (*Module)->Flags |= LDRP_IMAGE_DLL; - } - /* fixup the imported calls entry points */ - Status = LdrFixupImports(SearchPath, *Module); - if (!NT_SUCCESS(Status)) - { - DPRINT1("LdrFixupImports failed for %wZ, status=%x\n", &(*Module)->BaseDllName, Status); - NtUnmapViewOfSection (NtCurrentProcess (), ImageBase); - NtClose (SectionHandle); - RtlFreeUnicodeString (&FullDosName); - RtlFreeUnicodeString (&(*Module)->FullDllName); - RtlFreeUnicodeString (&(*Module)->BaseDllName); - RemoveEntryList (&(*Module)->InLoadOrderLinks); - return Status; - } - - RtlEnterCriticalSection(NtCurrentPeb()->LoaderLock); - InsertTailList(&NtCurrentPeb()->Ldr->InInitializationOrderModuleList, - &(*Module)->InInitializationOrderModuleList); - RtlLeaveCriticalSection (NtCurrentPeb()->LoaderLock); - } - return STATUS_SUCCESS; -} - -static NTSTATUS -LdrpUnloadModule(PLDR_DATA_TABLE_ENTRY Module, - BOOLEAN Unload) -{ - PIMAGE_IMPORT_DESCRIPTOR ImportModuleDirectory; - PIMAGE_BOUND_IMPORT_DESCRIPTOR BoundImportDescriptor; - PIMAGE_BOUND_IMPORT_DESCRIPTOR BoundImportDescriptorCurrent; - PCHAR ImportedName; - PLDR_DATA_TABLE_ENTRY ImportedModule; - NTSTATUS Status = 0; - LONG LoadCount; - ULONG Size; - - if (Unload) - { - RtlEnterCriticalSection(NtCurrentPeb()->LoaderLock); - } - - LoadCount = LdrpDecrementLoadCount(Module, Unload); - - TRACE_LDR("Unload %wZ, LoadCount %d\n", &Module->BaseDllName, LoadCount); - - if (LoadCount == 0) - { - /* ?????????????????? */ - } - else if (!(Module->Flags & LDRP_STATIC_LINK) && LoadCount == 1) - { - BoundImportDescriptor = (PIMAGE_BOUND_IMPORT_DESCRIPTOR) - RtlImageDirectoryEntryToData(Module->DllBase, - TRUE, - IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT, - &Size); - if (BoundImportDescriptor) - { - /* dereferencing all imported modules, use the bound import descriptor */ - BoundImportDescriptorCurrent = BoundImportDescriptor; - while (BoundImportDescriptorCurrent->OffsetModuleName) - { - ImportedName = (PCHAR)BoundImportDescriptor + BoundImportDescriptorCurrent->OffsetModuleName; - TRACE_LDR("%wZ trys to unload %s\n", &Module->BaseDllName, ImportedName); - Status = LdrpGetOrLoadModule(NULL, ImportedName, &ImportedModule, FALSE); - if (!NT_SUCCESS(Status)) - { - DPRINT1("unable to found imported modul %s\n", ImportedName); - } - else - { - if (Module != ImportedModule) - { - Status = LdrpUnloadModule(ImportedModule, FALSE); - if (!NT_SUCCESS(Status)) - { - DPRINT1("unable to unload %s\n", ImportedName); - } - } - } - BoundImportDescriptorCurrent++; - } - } - else - { - ImportModuleDirectory = (PIMAGE_IMPORT_DESCRIPTOR) - RtlImageDirectoryEntryToData(Module->DllBase, - TRUE, - IMAGE_DIRECTORY_ENTRY_IMPORT, - &Size); - if (ImportModuleDirectory) - { - /* dereferencing all imported modules, use the import descriptor */ - while (ImportModuleDirectory->Name) - { - ImportedName = (PCHAR)Module->DllBase + ImportModuleDirectory->Name; - TRACE_LDR("%wZ trys to unload %s\n", &Module->BaseDllName, ImportedName); - Status = LdrpGetOrLoadModule(NULL, ImportedName, &ImportedModule, FALSE); - if (!NT_SUCCESS(Status)) - { - DPRINT1("unable to found imported modul %s\n", ImportedName); - } - else - { - if (Module != ImportedModule) - { - Status = LdrpUnloadModule(ImportedModule, FALSE); - if (!NT_SUCCESS(Status)) - { - DPRINT1("unable to unload %s\n", ImportedName); - } - } - } - ImportModuleDirectory++; - } - } - } - } - - if (Unload) - { - if (!(Module->Flags & LDRP_STATIC_LINK)) - { - LdrpDetachProcess(FALSE); - } - - RtlLeaveCriticalSection (NtCurrentPeb()->LoaderLock); - } - return STATUS_SUCCESS; - -} - -/* - * @implemented - */ -NTSTATUS NTAPI -LdrUnloadDll (IN PVOID BaseAddress) -{ - PLDR_DATA_TABLE_ENTRY Module; - NTSTATUS Status; - - if (BaseAddress == NULL) - return STATUS_SUCCESS; - - if (LdrMappedAsDataFile(&BaseAddress)) - { - Status = NtUnmapViewOfSection(NtCurrentProcess(), BaseAddress); - } - else - { - Status = LdrFindEntryForAddress(BaseAddress, &Module); - if (NT_SUCCESS(Status)) - { - TRACE_LDR("LdrUnloadDll, , unloading %wZ\n", &Module->BaseDllName); - Status = LdrpUnloadModule(Module, TRUE); - } - } - - return Status; -} - -/* - * @implemented - */ -NTSTATUS NTAPI -LdrDisableThreadCalloutsForDll(IN PVOID BaseAddress) -{ - PLIST_ENTRY ModuleListHead; - PLIST_ENTRY Entry; - PLDR_DATA_TABLE_ENTRY Module; - NTSTATUS Status; - - DPRINT("LdrDisableThreadCalloutsForDll (BaseAddress %p)\n", BaseAddress); - - Status = STATUS_DLL_NOT_FOUND; - RtlEnterCriticalSection (NtCurrentPeb()->LoaderLock); - ModuleListHead = &NtCurrentPeb()->Ldr->InLoadOrderModuleList; - Entry = ModuleListHead->Flink; - while (Entry != ModuleListHead) - { - Module = CONTAINING_RECORD(Entry, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks); - - DPRINT("BaseDllName %wZ BaseAddress %p\n", &Module->BaseDllName, Module->DllBase); - - if (Module->DllBase == BaseAddress) - { - if (Module->TlsIndex == 0xFFFF) - { - Module->Flags |= LDRP_DONT_CALL_FOR_THREADS; - Status = STATUS_SUCCESS; - } - break; - } - Entry = Entry->Flink; - } - RtlLeaveCriticalSection (NtCurrentPeb()->LoaderLock); - return Status; -} - -/* - * @implemented - */ -NTSTATUS NTAPI -LdrGetDllHandle(IN PWSTR DllPath OPTIONAL, - IN PULONG DllCharacteristics, - IN PUNICODE_STRING DllName, - OUT PVOID *DllHandle) -{ - PLDR_DATA_TABLE_ENTRY Module; - NTSTATUS Status; - - TRACE_LDR("LdrGetDllHandle, searching for %wZ from %S\n", - DllName, DllPath ? DllPath : L""); - - /* NULL is the current executable */ - if (DllName == NULL) - { - *DllHandle = LdrpImageEntry->DllBase; - DPRINT("BaseAddress 0x%lx\n", *DllHandle); - return STATUS_SUCCESS; - } - - Status = LdrFindEntryForName(DllName, &Module, FALSE); - if (NT_SUCCESS(Status)) - { - *DllHandle = Module->DllBase; - return STATUS_SUCCESS; - } - - DPRINT("Failed to find dll %wZ\n", DllName); - *DllHandle = NULL; - return STATUS_DLL_NOT_FOUND; -} - -/* - * @implemented - */ -NTSTATUS NTAPI -LdrAddRefDll(IN ULONG Flags, - IN PVOID BaseAddress) -{ - PLIST_ENTRY ModuleListHead; - PLIST_ENTRY Entry; - PLDR_DATA_TABLE_ENTRY Module; - NTSTATUS Status; - - if (Flags & ~(LDR_PIN_MODULE)) - { - return STATUS_INVALID_PARAMETER; - } - - Status = STATUS_DLL_NOT_FOUND; - RtlEnterCriticalSection (NtCurrentPeb()->LoaderLock); - ModuleListHead = &NtCurrentPeb()->Ldr->InLoadOrderModuleList; - Entry = ModuleListHead->Flink; - while (Entry != ModuleListHead) - { - Module = CONTAINING_RECORD(Entry, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks); - - if (Module->DllBase == BaseAddress) - { - if (Flags & LDR_PIN_MODULE) - { - Module->Flags |= LDRP_STATIC_LINK; - } - else - { - LdrpIncrementLoadCount(Module, - FALSE); - } - Status = STATUS_SUCCESS; - break; - } - Entry = Entry->Flink; - } - RtlLeaveCriticalSection (NtCurrentPeb()->LoaderLock); - return Status; -} - -/* - * @implemented - */ -NTSTATUS NTAPI -LdrGetProcedureAddress (IN PVOID BaseAddress, - IN PANSI_STRING Name, - IN ULONG Ordinal, - OUT PVOID *ProcedureAddress) -{ - NTSTATUS Status = STATUS_PROCEDURE_NOT_FOUND; - if (Name && Name->Length) - { - TRACE_LDR("LdrGetProcedureAddress by NAME - %Z\n", Name); - } - else - { - TRACE_LDR("LdrGetProcedureAddress by ORDINAL - %d\n", Ordinal); - } - - DPRINT("LdrGetProcedureAddress (BaseAddress %p Name %Z Ordinal %lu ProcedureAddress %p)\n", - BaseAddress, Name, Ordinal, ProcedureAddress); - - _SEH2_TRY - { - if (Name && Name->Length) - { - /* by name */ - *ProcedureAddress = LdrGetExportByName(BaseAddress, (PUCHAR)Name->Buffer, 0xffff); - if (*ProcedureAddress != NULL) - { - Status = STATUS_SUCCESS; - } - DPRINT("LdrGetProcedureAddress: Can't resolve symbol '%Z'\n", Name); - } - else - { - /* by ordinal */ - Ordinal &= 0x0000FFFF; - *ProcedureAddress = LdrGetExportByOrdinal(BaseAddress, (WORD)Ordinal); - if (*ProcedureAddress) - { - Status = STATUS_SUCCESS; - } - DPRINT("LdrGetProcedureAddress: Can't resolve symbol @%lu\n", Ordinal); - } - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - Status = STATUS_DLL_NOT_FOUND; - } - _SEH2_END; - - return Status; -} - -/********************************************************************** - * NAME LOCAL - * LdrpDetachProcess - * - * DESCRIPTION - * Unload dll's which are no longer referenced from others dll's - * - * ARGUMENTS - * none - * - * RETURN VALUE - * none - * - * REVISIONS - * - * NOTE - * The loader lock must be held on enty. - */ -static VOID -LdrpDetachProcess(BOOLEAN UnloadAll) -{ - PLIST_ENTRY ModuleListHead; - PLIST_ENTRY Entry; - PLDR_DATA_TABLE_ENTRY Module; - static ULONG CallingCount = 0; - - DPRINT("LdrpDetachProcess() called for %wZ\n", - &LdrpImageEntry->BaseDllName); - - if (UnloadAll) - LdrpDllShutdownInProgress = TRUE; - - CallingCount++; - - ModuleListHead = &NtCurrentPeb()->Ldr->InInitializationOrderModuleList; - Entry = ModuleListHead->Blink; - while (Entry != ModuleListHead) - { - Module = CONTAINING_RECORD(Entry, LDR_DATA_TABLE_ENTRY, InInitializationOrderModuleList); - if (((UnloadAll && Module->LoadCount == LDRP_PROCESS_CREATION_TIME) || Module->LoadCount == 0) && - Module->Flags & LDRP_ENTRY_PROCESSED && - !(Module->Flags & LDRP_UNLOAD_IN_PROGRESS)) - { - Module->Flags |= LDRP_UNLOAD_IN_PROGRESS; - if (Module == LdrpLastModule) - { - LdrpLastModule = NULL; - } - if (Module->Flags & LDRP_PROCESS_ATTACH_CALLED) - { - TRACE_LDR("Unload %wZ - Calling entry point at %x\n", - &Module->BaseDllName, Module->EntryPoint); - - /* Check if it has TLS */ - if (Module->TlsIndex) - { - /* Call TLS */ - LdrpTlsCallback(Module->DllBase, DLL_PROCESS_ATTACH); - } - - if ((Module->Flags & LDRP_IMAGE_DLL) && Module->EntryPoint) - { - LdrpCallDllEntry(Module->EntryPoint, - Module->DllBase, - DLL_PROCESS_DETACH, - (PVOID)(Module->LoadCount == LDRP_PROCESS_CREATION_TIME ? 1 : 0)); - } - } - else - { - TRACE_LDR("Unload %wZ\n", &Module->BaseDllName); - } - Entry = ModuleListHead->Blink; - } - else - { - Entry = Entry->Blink; - } - } - - if (CallingCount == 1) - { - Entry = ModuleListHead->Blink; - while (Entry != ModuleListHead) - { - Module = CONTAINING_RECORD(Entry, LDR_DATA_TABLE_ENTRY, InInitializationOrderModuleList); - Entry = Entry->Blink; - if (Module->Flags & LDRP_UNLOAD_IN_PROGRESS && - ((UnloadAll && Module->LoadCount != LDRP_PROCESS_CREATION_TIME) || Module->LoadCount == 0)) - { - /* remove the module entry from the list */ - RemoveEntryList (&Module->InLoadOrderLinks); - RemoveEntryList (&Module->InInitializationOrderModuleList); - - NtUnmapViewOfSection (NtCurrentProcess (), Module->DllBase); - NtClose (Module->SectionPointer); - - TRACE_LDR("%wZ unloaded\n", &Module->BaseDllName); - - RtlFreeUnicodeString (&Module->FullDllName); - RtlFreeUnicodeString (&Module->BaseDllName); - - RtlFreeHeap (RtlGetProcessHeap (), 0, Module); - } - } - } - CallingCount--; - DPRINT("LdrpDetachProcess() done\n"); -} - -/* - * @implemented - */ -BOOLEAN NTAPI -RtlDllShutdownInProgress (VOID) -{ - return LdrpDllShutdownInProgress; -} - -/* - * @implemented - */ -NTSTATUS NTAPI -LdrShutdownProcess (VOID) -{ - LdrpDetachProcess(TRUE); - return STATUS_SUCCESS; -} - -/* - * @implemented - */ -NTSTATUS -NTAPI -LdrpInitializeThread(IN PCONTEXT Context) -{ - PLIST_ENTRY ModuleListHead; - PLIST_ENTRY Entry; - PLDR_DATA_TABLE_ENTRY Module; - NTSTATUS Status; - - DPRINT("LdrpAttachThread() called for %wZ\n", - &LdrpImageEntry->BaseDllName); - - RtlEnterCriticalSection (NtCurrentPeb()->LoaderLock); - - Status = LdrpAllocateTls(); - - if (NT_SUCCESS(Status)) - { - ModuleListHead = &NtCurrentPeb()->Ldr->InInitializationOrderModuleList; - Entry = ModuleListHead->Flink; - - while (Entry != ModuleListHead) - { - Module = CONTAINING_RECORD(Entry, LDR_DATA_TABLE_ENTRY, InInitializationOrderModuleList); - if (Module->Flags & LDRP_PROCESS_ATTACH_CALLED && - !(Module->Flags & LDRP_DONT_CALL_FOR_THREADS) && - !(Module->Flags & LDRP_UNLOAD_IN_PROGRESS)) - { - TRACE_LDR("%wZ - Calling entry point at %x for thread attaching\n", - &Module->BaseDllName, Module->EntryPoint); - - /* Check if it has TLS */ - if (Module->TlsIndex) - { - /* Call TLS */ - LdrpTlsCallback(Module->DllBase, DLL_THREAD_ATTACH); - } - - if ((Module->Flags & LDRP_IMAGE_DLL) && Module->EntryPoint) - LdrpCallDllEntry(Module->EntryPoint, Module->DllBase, DLL_THREAD_ATTACH, NULL); - } - Entry = Entry->Flink; - } - - Entry = NtCurrentPeb()->Ldr->InLoadOrderModuleList.Flink; - Module = CONTAINING_RECORD(Entry, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks); - LdrpTlsCallback(Module->DllBase, DLL_THREAD_ATTACH); - } - - RtlLeaveCriticalSection (NtCurrentPeb()->LoaderLock); - - DPRINT("LdrpAttachThread() done\n"); - - return Status; -} - - -/* - * @implemented - */ -NTSTATUS NTAPI -LdrShutdownThread (VOID) -{ - PLIST_ENTRY ModuleListHead; - PLIST_ENTRY Entry; - PLDR_DATA_TABLE_ENTRY Module; - - DPRINT("LdrShutdownThread() called for %wZ\n", - &LdrpImageEntry->BaseDllName); - - RtlEnterCriticalSection (NtCurrentPeb()->LoaderLock); - - ModuleListHead = &NtCurrentPeb()->Ldr->InInitializationOrderModuleList; - Entry = ModuleListHead->Blink; - while (Entry != ModuleListHead) - { - Module = CONTAINING_RECORD(Entry, LDR_DATA_TABLE_ENTRY, InInitializationOrderModuleList); - - if (Module->Flags & LDRP_PROCESS_ATTACH_CALLED && - !(Module->Flags & LDRP_DONT_CALL_FOR_THREADS) && - !(Module->Flags & LDRP_UNLOAD_IN_PROGRESS)) - { - TRACE_LDR("%wZ - Calling entry point at %x for thread detaching\n", - &Module->BaseDllName, Module->EntryPoint); - /* Check if it has TLS */ - if (Module->TlsIndex) - { - /* Call TLS */ - LdrpTlsCallback(Module->DllBase, DLL_THREAD_DETACH); - } - - if ((Module->Flags & LDRP_IMAGE_DLL) && Module->EntryPoint) - LdrpCallDllEntry(Module->EntryPoint, Module->DllBase, DLL_THREAD_DETACH, NULL); - } - Entry = Entry->Blink; - } - - /* Free TLS */ - LdrpFreeTls(); - RtlLeaveCriticalSection (NtCurrentPeb()->LoaderLock); - - DPRINT("LdrShutdownThread() done\n"); - - return STATUS_SUCCESS; -} - -/* - * Compute size of an image as it is actually present in virt memory - * (i.e. excluding NEVER_LOAD sections) - */ -ULONG -LdrpGetResidentSize(PIMAGE_NT_HEADERS NTHeaders) -{ - PIMAGE_SECTION_HEADER SectionHeader; - unsigned SectionIndex; - ULONG ResidentSize; - - SectionHeader = (PIMAGE_SECTION_HEADER)((char *) &NTHeaders->OptionalHeader - + NTHeaders->FileHeader.SizeOfOptionalHeader); - ResidentSize = 0; - for (SectionIndex = 0; - SectionIndex < NTHeaders->FileHeader.NumberOfSections; - SectionIndex++) - { - if (0 == (SectionHeader->Characteristics & IMAGE_SCN_LNK_REMOVE) - && ResidentSize < SectionHeader->VirtualAddress + SectionHeader->Misc.VirtualSize) - { - ResidentSize = SectionHeader->VirtualAddress + SectionHeader->Misc.VirtualSize; - } - SectionHeader++; - } - - return ResidentSize; -} - -PIMAGE_BASE_RELOCATION -NTAPI -LdrProcessRelocationBlock( - IN ULONG_PTR Address, - IN ULONG Count, - IN PUSHORT TypeOffset, - IN LONG_PTR Delta) -{ - return LdrProcessRelocationBlockLongLong(Address, Count, TypeOffset, Delta); -} - -BOOLEAN -NTAPI -LdrUnloadAlternateResourceModule(IN PVOID BaseAddress) -{ - UNIMPLEMENTED; - return FALSE; -} diff --git a/dll/ntdll/ntdll.rbuild b/dll/ntdll/ntdll.rbuild index 384a6c96ff6..2f219a81c98 100644 --- a/dll/ntdll/ntdll.rbuild +++ b/dll/ntdll/ntdll.rbuild @@ -51,9 +51,6 @@ ldrinit.c ldrpe.c ldrutils.c - startup.c - utils.c - actctx.c libsupp.c diff --git a/dll/shellext/deskadp/CMakeLists.txt b/dll/shellext/deskadp/CMakeLists.txt index 23306b9a197..05ec5af81bf 100644 --- a/dll/shellext/deskadp/CMakeLists.txt +++ b/dll/shellext/deskadp/CMakeLists.txt @@ -9,7 +9,7 @@ list(APPEND SOURCE deskadp.rc ${CMAKE_CURRENT_BINARY_DIR}/deskadp.def) -add_library(deskadp SHARED ${CMAKE_CURRENT_BINARY_DIR}/deskadp_precomp.h.gch ${SOURCE}) +add_library(deskadp SHARED ${SOURCE}) set_module_type(deskadp win32dll) @@ -24,6 +24,6 @@ add_importlibs(deskadp kernel32 ntdll) -add_pch(deskadp ${CMAKE_CURRENT_SOURCE_DIR}/precomp.h ${SOURCE}) +add_pch(deskadp precomp.h) add_cd_file(TARGET deskadp DESTINATION reactos/system32 FOR all) diff --git a/dll/shellext/deskadp/lang/pl-PL.rc b/dll/shellext/deskadp/lang/pl-PL.rc index 32f5bfc5efc..70cca9bf497 100644 --- a/dll/shellext/deskadp/lang/pl-PL.rc +++ b/dll/shellext/deskadp/lang/pl-PL.rc @@ -1,7 +1,9 @@ -/* translated by Caemyr - Olaf Siejka (Jan, 2008) - * Use ReactOS forum PM or IRC to contact me - * http://www.reactos.org - * IRC: irc.freenode.net #reactos-pl; +/* + * translated by Caemyr - Olaf Siejka (Jan, 2008) + * Use ReactOS forum PM or IRC to contact me + * http://www.reactos.org + * IRC: irc.freenode.net #reactos-pl; + * UTF-8 conversion by Caemyr (May, 2011) */ LANGUAGE LANG_POLISH, SUBLANG_DEFAULT @@ -13,42 +15,41 @@ FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN GROUPBOX "Typ karty", -1, 7, 3, 237, 50 LTEXT "", IDC_ADAPTERNAME, 40, 17, 190, 20, SS_NOPREFIX - PUSHBUTTON "&Waciwoci", IDC_ADAPTERPROPERTIES, 177, 33, 59, 14 + PUSHBUTTON "&Właściwości", IDC_ADAPTERPROPERTIES, 177, 33, 59, 14 GROUPBOX "Informacje o karcie", -1, 7, 56, 237, 75 LTEXT "Typ GPU:", -1, 13, 68, 58, 8 LTEXT "", IDC_CHIPTYPE, 71, 68, 160, 8, SS_NOPREFIX LTEXT "Typ DAC:", -1, 13, 80, 58, 8 LTEXT "", IDC_DACTYPE, 71, 80, 160, 8, SS_NOPREFIX - LTEXT "Rozmiar pamici:", -1, 13, 92, 58, 8 + LTEXT "Rozmiar pamięci:", -1, 13, 92, 58, 8 LTEXT "", IDC_MEMORYSIZE, 71, 92, 160, 8, SS_NOPREFIX - LTEXT "Cig nazwy:", -1, 13, 104, 58, 8 + LTEXT "Ciąg nazwy:", -1, 13, 104, 58, 8 LTEXT "", IDC_ADAPTERSTRING, 71, 104, 160, 8, SS_NOPREFIX LTEXT "Wersja BIOS:", -1, 13, 116, 58, 8 LTEXT "", IDC_BIOSINFORMATION, 71, 116, 160, 8, SS_NOPREFIX - PUSHBUTTON "&Wywietl wszystkie tryby...", IDC_LISTALLMODES, 7, 139, 75, 14 + PUSHBUTTON "&Wyświetl wszystkie tryby...", IDC_LISTALLMODES, 7, 139, 75, 14 END IDD_LISTALLMODES DIALOGEX 0, 0, 225, 135 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_DLGFRAME -CAPTION "Wywietlanie trybw" +CAPTION "Wyświetlanie trybów" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN DEFPUSHBUTTON "OK", IDOK, 112, 115, 50, 15 PUSHBUTTON "Anuluj", IDCANCEL, 167, 115, 50, 15 - GROUPBOX "Wywietl tylko obsugiwane tryby", -1, 6, 7, 212, 98 + GROUPBOX "Wyświetl tylko obsługiwane tryby", -1, 6, 7, 212, 98 LISTBOX IDC_ALLVALIDMODES, 10, 20, 204, 87, LBS_NOTIFY | WS_VSCROLL END STRINGTABLE BEGIN IDS_MODEFMT "%d by %d, %s, %s" - IDS_DEFREFRESHRATE "Odwieanie domylne" - IDES_REFRESHRATEFMT "%d Hercw" - IDS_4BPP "16 kolorw" - IDS_8BPP "256 kolorw" - IDS_15BPP "32k kolorw (15 bitw)" - IDS_16BPP "64k kolorw (16 bitw)" - IDS_24BPP "16m kolorw (24 bity)" - IDS_32BPP "16m +kana alfa (32 bity)" + IDS_DEFREFRESHRATE "Odświeżanie domyślne" + IDES_REFRESHRATEFMT "%d Herców" + IDS_4BPP "16 kolorów" + IDS_8BPP "256 kolorów" + IDS_15BPP "32k kolorów (15 bitów)" + IDS_16BPP "64k kolorów (16 bitów)" + IDS_24BPP "16m kolorów (24 bity)" + IDS_32BPP "16m +kanał alfa (32 bity)" END - diff --git a/dll/shellext/deskadp/lang/ru-RU.rc b/dll/shellext/deskadp/lang/ru-RU.rc index 7b4e9e1ba90..f74bf012a2b 100644 --- a/dll/shellext/deskadp/lang/ru-RU.rc +++ b/dll/shellext/deskadp/lang/ru-RU.rc @@ -2,47 +2,47 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT IDD_DISPLAYADAPTER DIALOGEX 0, 0, 252, 226 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Адаптер" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - GROUPBOX " ", -1, 7, 3, 237, 50 + GROUPBOX "Тип адаптера", -1, 7, 3, 237, 50 LTEXT "", IDC_ADAPTERNAME, 40, 17, 190, 20, SS_NOPREFIX - PUSHBUTTON "&", IDC_ADAPTERPROPERTIES, 177, 33, 59, 14 - GROUPBOX " ", -1, 7, 56, 237, 75 - LTEXT " :", -1, 13, 68, 58, 8 + PUSHBUTTON "&Свойства", IDC_ADAPTERPROPERTIES, 177, 33, 59, 14 + GROUPBOX "Сведения об адаптере", -1, 7, 56, 237, 75 + LTEXT "Тип микросхем:", -1, 13, 68, 58, 8 LTEXT "", IDC_CHIPTYPE, 90, 68, 150, 8, SS_NOPREFIX - LTEXT " DAC:", -1, 13, 80, 80, 8 + LTEXT "Тип конвертера DAC:", -1, 13, 80, 80, 8 LTEXT "", IDC_DACTYPE, 90, 80, 150, 8, SS_NOPREFIX - LTEXT " :", -1, 13, 92, 58, 8 + LTEXT "Объем памяти:", -1, 13, 92, 58, 8 LTEXT "", IDC_MEMORYSIZE, 90, 92, 150, 8, SS_NOPREFIX - LTEXT " :", -1, 13, 104, 80, 8 + LTEXT "Строка контроллера:", -1, 13, 104, 80, 8 LTEXT "", IDC_ADAPTERSTRING, 90, 104, 150, 8, SS_NOPREFIX - LTEXT " BIOS:", -1, 13, 116, 67, 8 + LTEXT "Сведения о BIOS:", -1, 13, 116, 67, 8 LTEXT "", IDC_BIOSINFORMATION, 90, 116, 150, 8, SS_NOPREFIX - PUSHBUTTON "& ...", IDC_LISTALLMODES, 7, 139, 95, 14 + PUSHBUTTON "&Список всех режимов...", IDC_LISTALLMODES, 7, 139, 95, 14 END IDD_LISTALLMODES DIALOGEX 0, 0, 225, 135 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_DLGFRAME -CAPTION " " +CAPTION "Список всех режимов" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN DEFPUSHBUTTON "OK", IDOK, 112, 115, 50, 15 - PUSHBUTTON "", IDCANCEL, 167, 115, 50, 15 - GROUPBOX " ", -1, 6, 7, 212, 98 + PUSHBUTTON "Отмена", IDCANCEL, 167, 115, 50, 15 + GROUPBOX "Список допустимых режимов", -1, 6, 7, 212, 98 LISTBOX IDC_ALLVALIDMODES, 10, 20, 204, 87, LBS_NOTIFY | WS_VSCROLL END STRINGTABLE BEGIN - IDS_MODEFMT "%d %d, %s, %s" - IDS_DEFREFRESHRATE " " - IDES_REFRESHRATEFMT "%d " - IDS_4BPP "16 " - IDS_8BPP "256 " - IDS_15BPP " (15 )" - IDS_16BPP " (16 )" - IDS_24BPP " (24 )" - IDS_32BPP " (32 )" + IDS_MODEFMT "%d от %d, %s, %s" + IDS_DEFREFRESHRATE "частота по умолчанию" + IDES_REFRESHRATEFMT "%d Гц" + IDS_4BPP "16 цветов" + IDS_8BPP "256 цветов" + IDS_15BPP "Высокое (15 бит)" + IDS_16BPP "Высокое (16 бит)" + IDS_24BPP "Самое высокое (24 бита)" + IDS_32BPP "Самое высокое (32 бита)" END diff --git a/dll/shellext/deskadp/lang/uk-UA.rc b/dll/shellext/deskadp/lang/uk-UA.rc index 20138f29dbb..d3bcbb4d983 100644 --- a/dll/shellext/deskadp/lang/uk-UA.rc +++ b/dll/shellext/deskadp/lang/uk-UA.rc @@ -10,47 +10,47 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT IDD_DISPLAYADAPTER DIALOGEX 0, 0, 252, 226 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Адаптер" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - GROUPBOX " ", -1, 7, 3, 237, 50 + GROUPBOX "Тип адаптера", -1, 7, 3, 237, 50 LTEXT "", IDC_ADAPTERNAME, 40, 17, 190, 20, SS_NOPREFIX - PUSHBUTTON "&", IDC_ADAPTERPROPERTIES, 177, 33, 59, 14 - GROUPBOX "³ ", -1, 7, 56, 237, 75 - LTEXT " :", -1, 13, 68, 58, 8 + PUSHBUTTON "В&ластивості", IDC_ADAPTERPROPERTIES, 177, 33, 59, 14 + GROUPBOX "Відомості про адаптер", -1, 7, 56, 237, 75 + LTEXT "Тип мікросхем:", -1, 13, 68, 58, 8 LTEXT "", IDC_CHIPTYPE, 78, 68, 160, 8, SS_NOPREFIX - LTEXT " :", -1, 13, 80, 58, 8 + LTEXT "Тип ЦАП:", -1, 13, 80, 58, 8 LTEXT "", IDC_DACTYPE, 78, 80, 160, 8, SS_NOPREFIX - LTEXT "' ':", -1, 13, 92, 58, 8 + LTEXT "Об'єм пам'яті:", -1, 13, 92, 58, 8 LTEXT "", IDC_MEMORYSIZE, 78, 92, 160, 8, SS_NOPREFIX - LTEXT " :", -1, 13, 104, 80, 8 + LTEXT "Рядок контролера:", -1, 13, 104, 80, 8 LTEXT "", IDC_ADAPTERSTRING, 78, 104, 160, 8, SS_NOPREFIX - LTEXT "³ BIOS:", -1, 13, 116, 80, 8 + LTEXT "Відомості про BIOS:", -1, 13, 116, 80, 8 LTEXT "", IDC_BIOSINFORMATION, 78, 116, 160, 8, SS_NOPREFIX - PUSHBUTTON "& ...", IDC_LISTALLMODES, 7, 139, 80, 14 + PUSHBUTTON "&Список усіх режимів...", IDC_LISTALLMODES, 7, 139, 80, 14 END IDD_LISTALLMODES DIALOGEX 0, 0, 225, 135 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_DLGFRAME -CAPTION " " +CAPTION "Список усіх режимів" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN DEFPUSHBUTTON "OK", IDOK, 112, 115, 50, 15 - PUSHBUTTON "", IDCANCEL, 167, 115, 50, 15 - GROUPBOX " ", -1, 6, 7, 212, 98 + PUSHBUTTON "Скасувати", IDCANCEL, 167, 115, 50, 15 + GROUPBOX "Список припустимих режимів", -1, 6, 7, 212, 98 LISTBOX IDC_ALLVALIDMODES, 10, 20, 204, 87, LBS_NOTIFY | WS_VSCROLL END STRINGTABLE BEGIN - IDS_MODEFMT "%d %d, %s, %s" - IDS_DEFREFRESHRATE " " - IDES_REFRESHRATEFMT "%d " - IDS_4BPP "16 " - IDS_8BPP "256 " - IDS_15BPP "High Color (15 )" - IDS_16BPP "High Color (16 )" - IDS_24BPP "True Color (24 )" - IDS_32BPP "True Color (32 )" + IDS_MODEFMT "%d на %d, %s, %s" + IDS_DEFREFRESHRATE "частота за замовчуванням" + IDES_REFRESHRATEFMT "%d Гц" + IDS_4BPP "16 кольорів" + IDS_8BPP "256 кольорів" + IDS_15BPP "High Color (15 біт)" + IDS_16BPP "High Color (16 біт)" + IDS_24BPP "True Color (24 біти)" + IDS_32BPP "True Color (32 біти)" END diff --git a/dll/shellext/deskadp/rsrc.rc b/dll/shellext/deskadp/rsrc.rc index 29c114efc6a..d3ba25bf515 100644 --- a/dll/shellext/deskadp/rsrc.rc +++ b/dll/shellext/deskadp/rsrc.rc @@ -11,7 +11,10 @@ #include "lang/fr-FR.rc" #include "lang/it-IT.rc" #include "lang/no-NO.rc" +#include "lang/sk-SK.rc" + +// UTF-8 +#pragma code_page(65001) #include "lang/pl-PL.rc" #include "lang/ru-RU.rc" -#include "lang/sk-SK.rc" #include "lang/uk-UA.rc" diff --git a/dll/shellext/deskmon/CMakeLists.txt b/dll/shellext/deskmon/CMakeLists.txt index c03afabbc07..9f358bc90f5 100644 --- a/dll/shellext/deskmon/CMakeLists.txt +++ b/dll/shellext/deskmon/CMakeLists.txt @@ -10,7 +10,7 @@ list(APPEND SOURCE deskmon.rc ${CMAKE_CURRENT_BINARY_DIR}/deskmon.def) -add_library(deskmon SHARED ${CMAKE_CURRENT_BINARY_DIR}/deskmon_precomp.h.gch ${SOURCE}) +add_library(deskmon SHARED ${SOURCE}) set_module_type(deskmon win32dll) @@ -25,6 +25,6 @@ add_importlibs(deskmon kernel32 ntdll) -add_pch(deskmon ${CMAKE_CURRENT_SOURCE_DIR}/precomp.h ${SOURCE}) +add_pch(deskmon precomp.h) add_cd_file(TARGET deskmon DESTINATION reactos/system32 FOR all) diff --git a/dll/shellext/deskmon/lang/pl-PL.rc b/dll/shellext/deskmon/lang/pl-PL.rc index e925622d4e1..8ddfc3a9f84 100644 --- a/dll/shellext/deskmon/lang/pl-PL.rc +++ b/dll/shellext/deskmon/lang/pl-PL.rc @@ -1,7 +1,9 @@ -/* translated by Caemyr - Olaf Siejka (Jan, 2008) - * Use ReactOS forum PM or IRC to contact me - * http://www.reactos.org - * IRC: irc.freenode.net #reactos-pl; +/* + * translated by Caemyr - Olaf Siejka (Jan, 2008) + * Use ReactOS forum PM or IRC to contact me + * http://www.reactos.org + * IRC: irc.freenode.net #reactos-pl; + * UTF-8 conversion by Caemyr (May, 2011) */ LANGUAGE LANG_POLISH, SUBLANG_DEFAULT @@ -14,15 +16,15 @@ BEGIN GROUPBOX "Typ monitora", -1, 7, 3, 237, 52 LTEXT "", IDC_MONITORNAME, 40, 17, 190, 20, SS_NOPREFIX LISTBOX IDC_MONITORLIST, 40, 13, 196, 30, WS_VSCROLL - PUSHBUTTON "&Waciwoci", IDC_MONITORPROPERTIES, 177, 35, 59, 14, WS_DISABLED + PUSHBUTTON "&Właściwości", IDC_MONITORPROPERTIES, 177, 35, 59, 14, WS_DISABLED GROUPBOX "Ustawienia monitora", IDS_MONITORSETTINGSGROUP, 7, 58, 237, 63 - LTEXT "&Czstotliwoi odwieania ekranu:", IDS_REFRESHRATELABEL, 13, 73, 225, 8 + LTEXT "&Częstotliwośći odświeżania ekranu:", IDS_REFRESHRATELABEL, 13, 73, 225, 8 COMBOBOX IDC_REFRESHRATE, 13, 85, 225, 200, WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT - AUTOCHECKBOX "&Ukryj tryby ktrych monitor n ie moe wywietli", IDC_PRUNINGCHECK, 13, 106, 225, 10 + AUTOCHECKBOX "&Ukryj tryby których monitor nie może wyświetlić", IDC_PRUNINGCHECK, 13, 106, 225, 10 END STRINGTABLE BEGIN - IDS_USEDEFFRQUENCY "Uyj domylnych ustawie sprztu" - IDS_FREQFMT "%u Hercw" + IDS_USEDEFFRQUENCY "Użyj domyślnych ustawień sprzętu" + IDS_FREQFMT "%u Herców" END diff --git a/dll/shellext/deskmon/lang/ru-RU.rc b/dll/shellext/deskmon/lang/ru-RU.rc index aaa0232c24c..2eaf18f63d4 100644 --- a/dll/shellext/deskmon/lang/ru-RU.rc +++ b/dll/shellext/deskmon/lang/ru-RU.rc @@ -2,21 +2,21 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT IDD_MONITOR DIALOGEX 0, 0, 252, 226 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Монитор" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - GROUPBOX " ", -1, 7, 3, 237, 52 + GROUPBOX "Тип монитора", -1, 7, 3, 237, 52 LTEXT "", IDC_MONITORNAME, 40, 17, 190, 20, SS_NOPREFIX LISTBOX IDC_MONITORLIST, 40, 13, 196, 30, WS_VSCROLL - PUSHBUTTON "&", IDC_MONITORPROPERTIES, 177, 35, 59, 14, WS_DISABLED - GROUPBOX " ", IDS_MONITORSETTINGSGROUP, 7, 58, 237, 63 - LTEXT "& :", IDS_REFRESHRATELABEL, 13, 73, 225, 8 + PUSHBUTTON "&Свойства", IDC_MONITORPROPERTIES, 177, 35, 59, 14, WS_DISABLED + GROUPBOX "Параметры монитора", IDS_MONITORSETTINGSGROUP, 7, 58, 237, 63 + LTEXT "&Частота обновления экрана:", IDS_REFRESHRATELABEL, 13, 73, 225, 8 COMBOBOX IDC_REFRESHRATE, 13, 85, 225, 200, WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT - AUTOCHECKBOX "& , ", IDC_PRUNINGCHECK, 13, 106, 225, 10 + AUTOCHECKBOX "&Скрыть режимы, которые монитор не может использовать", IDC_PRUNINGCHECK, 13, 106, 225, 10 END STRINGTABLE BEGIN - IDS_USEDEFFRQUENCY " " - IDS_FREQFMT "%u " + IDS_USEDEFFRQUENCY "Использовать параметры оборудования по умолчанию" + IDS_FREQFMT "%u Гц" END diff --git a/dll/shellext/deskmon/lang/uk-UA.rc b/dll/shellext/deskmon/lang/uk-UA.rc index 3d62771b8ff..868896c46db 100644 --- a/dll/shellext/deskmon/lang/uk-UA.rc +++ b/dll/shellext/deskmon/lang/uk-UA.rc @@ -10,21 +10,21 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT IDD_MONITOR DIALOGEX 0, 0, 252, 226 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Монітор" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - GROUPBOX " ", -1, 7, 3, 237, 52 + GROUPBOX "Тип монітора", -1, 7, 3, 237, 52 LTEXT "", IDC_MONITORNAME, 40, 17, 190, 20, SS_NOPREFIX LISTBOX IDC_MONITORLIST, 40, 13, 196, 30, WS_VSCROLL - PUSHBUTTON "&", IDC_MONITORPROPERTIES, 177, 35, 59, 14, WS_DISABLED - GROUPBOX " ", IDS_MONITORSETTINGSGROUP, 7, 58, 237, 63 - LTEXT "& :", IDS_REFRESHRATELABEL, 13, 73, 225, 8 + PUSHBUTTON "В&ластивості", IDC_MONITORPROPERTIES, 177, 35, 59, 14, WS_DISABLED + GROUPBOX "Параметри монітора", IDS_MONITORSETTINGSGROUP, 7, 58, 237, 63 + LTEXT "&Частота оновлення екрана:", IDS_REFRESHRATELABEL, 13, 73, 225, 8 COMBOBOX IDC_REFRESHRATE, 13, 85, 225, 200, WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT - AUTOCHECKBOX "& , ", IDC_PRUNINGCHECK, 13, 106, 225, 10 + AUTOCHECKBOX "&Приховати режими, які монітор не може використовувати", IDC_PRUNINGCHECK, 13, 106, 225, 10 END STRINGTABLE BEGIN - IDS_USEDEFFRQUENCY " " - IDS_FREQFMT "%u " + IDS_USEDEFFRQUENCY "Значення за замовчуванням" + IDS_FREQFMT "%u Гц" END diff --git a/dll/shellext/deskmon/rsrc.rc b/dll/shellext/deskmon/rsrc.rc index 55f9f572f39..d3ba25bf515 100644 --- a/dll/shellext/deskmon/rsrc.rc +++ b/dll/shellext/deskmon/rsrc.rc @@ -12,6 +12,9 @@ #include "lang/it-IT.rc" #include "lang/no-NO.rc" #include "lang/sk-SK.rc" + +// UTF-8 +#pragma code_page(65001) #include "lang/pl-PL.rc" #include "lang/ru-RU.rc" #include "lang/uk-UA.rc" diff --git a/dll/shellext/fontext/CMakeLists.txt b/dll/shellext/fontext/CMakeLists.txt index cd57d0ed73e..b4d7e43dae8 100644 --- a/dll/shellext/fontext/CMakeLists.txt +++ b/dll/shellext/fontext/CMakeLists.txt @@ -25,4 +25,5 @@ add_importlibs(fontext kernel32 ntdll) +add_pch(fontext fontext.h) add_cd_file(TARGET fontext DESTINATION reactos/system32 FOR all) diff --git a/dll/shellext/fontext/fontext.h b/dll/shellext/fontext/fontext.h index c62ce1c49a0..aa965a6125e 100644 --- a/dll/shellext/fontext/fontext.h +++ b/dll/shellext/fontext/fontext.h @@ -1,9 +1,7 @@ -#pragma once - #define COBJMACROS #include #include #include #include - +#include #include diff --git a/dll/shellext/fontext/fontext.rbuild b/dll/shellext/fontext/fontext.rbuild index c46abf4e8a9..5b2e36498b5 100644 --- a/dll/shellext/fontext/fontext.rbuild +++ b/dll/shellext/fontext/fontext.rbuild @@ -13,4 +13,5 @@ fontext.c regsvr.c fontext.rc + fontext.h diff --git a/dll/shellext/fontext/regsvr.c b/dll/shellext/fontext/regsvr.c index b3f21df297e..5cc6344bff3 100644 --- a/dll/shellext/fontext/regsvr.c +++ b/dll/shellext/fontext/regsvr.c @@ -8,10 +8,7 @@ * 10-06-2008 Created */ -#include -#include - -#include +#include "fontext.h" static HRESULT REGSVR_RegisterServer() diff --git a/dll/shellext/slayer/CMakeLists.txt b/dll/shellext/slayer/CMakeLists.txt index 5830f4649a0..8c7d92a9d16 100644 --- a/dll/shellext/slayer/CMakeLists.txt +++ b/dll/shellext/slayer/CMakeLists.txt @@ -9,7 +9,7 @@ list(APPEND SOURCE slayer.rc ${CMAKE_CURRENT_BINARY_DIR}/slayer.def) -add_library(slayer SHARED ${CMAKE_CURRENT_BINARY_DIR}/slayer_precomp.h.gch ${SOURCE}) +add_library(slayer SHARED ${SOURCE}) set_module_type(slayer win32dll) @@ -25,6 +25,6 @@ add_importlibs(slayer kernel32 ntdll) -add_pch(slayer ${CMAKE_CURRENT_SOURCE_DIR}/precomp.h ${SOURCE}) +add_pch(slayer precomp.h) add_cd_file(TARGET slayer DESTINATION reactos/system32 FOR all) diff --git a/dll/shellext/slayer/lang/pl-PL.rc b/dll/shellext/slayer/lang/pl-PL.rc index 981f1212da6..7f8cde2ac42 100644 --- a/dll/shellext/slayer/lang/pl-PL.rc +++ b/dll/shellext/slayer/lang/pl-PL.rc @@ -1,33 +1,36 @@ -// Polish resources by Sebastian Gasiorek (2005-07-10) +/* + * translated by Sebastian Gasiorek + * UTF-8 conversion by Caemyr (May, 2011) + */ LANGUAGE LANG_POLISH, SUBLANG_DEFAULT IDD_SLAYERSHEET DIALOGEX 0, 0, 224, 226 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Zgodno" +CAPTION "Zgodność" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT "Jeeli masz problemy z uruchamianiem tego programu w ReactOS, wybierz system operacyjny, ktry ReactOS powinien zgasza aplikacji.", -1, 7,7,210,31 - GROUPBOX "Tryb zgodnoci", IDC_COMPATGROUP, 7,41,210,49 - CHECKBOX "Uruchom ten program w trybie zgodnoci z:", IDC_CHKRUNCOMPATIBILITY, 18,57,188,10, BS_AUTOCHECKBOX | WS_TABSTOP + LTEXT "Jeżeli masz problemy z uruchamianiem tego programu w ReactOS, wybierz system operacyjny, który ReactOS powinien zgłaszać aplikacji.", -1, 7,7,210,31 + GROUPBOX "Tryb zgodności", IDC_COMPATGROUP, 7,41,210,49 + CHECKBOX "Uruchom ten program w trybie zgodności z:", IDC_CHKRUNCOMPATIBILITY, 18,57,188,10, BS_AUTOCHECKBOX | WS_TABSTOP COMBOBOX IDC_COMPATIBILITYMODE, 18,70,188,85, CBS_HASSTRINGS | CBS_DROPDOWNLIST | WS_TABSTOP | WS_DISABLED GROUPBOX "Ustawienia ekranu", -1, 7,99,210,61, BS_GROUPBOX | WS_DISABLED CHECKBOX "Uruchom w 256 kolorach", IDC_CHKRUNIN256COLORS, 18,114,188,10, BS_AUTOCHECKBOX | WS_TABSTOP | WS_DISABLED - CHECKBOX "Uruchom w rozdzielczoci ekranu 640x480", IDC_CHKRUNIN640480RES, 18,129,188,10, BS_AUTOCHECKBOX | WS_TABSTOP | WS_DISABLED - CHECKBOX "Wycz kompozycje wizualne", IDC_CHKDISABLEVISUALTHEMES, 18,144,188,10, BS_AUTOCHECKBOX | WS_TABSTOP | WS_DISABLED - PUSHBUTTON "E&dytuj tryby zgodnoci...", IDC_EDITCOMPATIBILITYMODES, 117,167,100,15 - /* CONTROL "Dowiedz si wicej o zgodnoci programw.", IDC_INFOLINK, "SysLink", WS_CHILD | WS_TABSTOP | WS_VISIBLE, 7,207,210,10, WS_EX_NOPARENTNOTIFY */ + CHECKBOX "Uruchom w rozdzielczości ekranu 640x480", IDC_CHKRUNIN640480RES, 18,129,188,10, BS_AUTOCHECKBOX | WS_TABSTOP | WS_DISABLED + CHECKBOX "Wyłącz kompozycje wizualne", IDC_CHKDISABLEVISUALTHEMES, 18,144,188,10, BS_AUTOCHECKBOX | WS_TABSTOP | WS_DISABLED + PUSHBUTTON "E&dytuj tryby zgodności...", IDC_EDITCOMPATIBILITYMODES, 117,167,100,15 + /* CONTROL "Dowiedz się więcej o zgodności programów.", IDC_INFOLINK, "SysLink", WS_CHILD | WS_TABSTOP | WS_VISIBLE, 7,207,210,10, WS_EX_NOPARENTNOTIFY */ END IDD_EDITCOMPATIBILITYMODES DIALOGEX 0, 0, 230, 139 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "Edycja trybw zgodnoci" +CAPTION "Edycja trybów zgodności" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN LISTBOX IDC_COMPATIBILITYMODE, 9,6,148,108, LBS_NOTIFY | LBS_WANTKEYBOARDINPUT | WS_BORDER PUSHBUTTON "&Dodaj...", IDC_ADD, 162,6,60,14, WS_DISABLED PUSHBUTTON "&Edytuj...", IDC_EDIT, 162,24,60,14, WS_DISABLED - PUSHBUTTON "&Usu", IDC_DELETE, 162,42,60,14, WS_DISABLED + PUSHBUTTON "&Usuń", IDC_DELETE, 162,42,60,14, WS_DISABLED PUSHBUTTON "&OK", IDOK, 95,116,60,14 PUSHBUTTON "&Anuluj", IDCANCEL, 162,116,60,14 END @@ -35,6 +38,6 @@ END STRINGTABLE BEGIN IDS_SLAYER "Slayer" - IDS_DESCRIPTION "Application Compatibility Layer Shell Extension" + IDS_DESCRIPTION "Warstwa kompatybilności programów w powłoce systemu ReactOS" END diff --git a/dll/shellext/slayer/lang/ru-RU.rc b/dll/shellext/slayer/lang/ru-RU.rc index a96818ffade..9218a96d3f9 100644 --- a/dll/shellext/slayer/lang/ru-RU.rc +++ b/dll/shellext/slayer/lang/ru-RU.rc @@ -9,32 +9,32 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT IDD_SLAYERSHEET DIALOGEX 0, 0, 224, 226 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Совместимость" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT " , ReactOS ", -1, 7,7,210,31 - GROUPBOX " ", IDC_COMPATGROUP, 7,41,210,49 - CHECKBOX " :", IDC_CHKRUNCOMPATIBILITY, 18,57,188,10, BS_AUTOCHECKBOX | WS_TABSTOP + LTEXT "При возникновении проблем выберите, какую операционную систему должна имитировать ReactOS для этой программы", -1, 7,7,210,31 + GROUPBOX "Режим совместимости", IDC_COMPATGROUP, 7,41,210,49 + CHECKBOX "Запускать в режиме совместимости для:", IDC_CHKRUNCOMPATIBILITY, 18,57,188,10, BS_AUTOCHECKBOX | WS_TABSTOP COMBOBOX IDC_COMPATIBILITYMODE, 18,70,188,85, CBS_HASSTRINGS | CBS_DROPDOWNLIST | WS_TABSTOP | WS_DISABLED - GROUPBOX " ", -1, 7,99,210,61, BS_GROUPBOX | WS_DISABLED - CHECKBOX "256 ", IDC_CHKRUNIN256COLORS, 18,114,188,10, BS_AUTOCHECKBOX | WS_TABSTOP | WS_DISABLED - CHECKBOX " 640x480", IDC_CHKRUNIN640480RES, 18,129,188,10, BS_AUTOCHECKBOX | WS_TABSTOP | WS_DISABLED - CHECKBOX " ", IDC_CHKDISABLEVISUALTHEMES, 18,144,188,10, BS_AUTOCHECKBOX | WS_TABSTOP | WS_DISABLED - PUSHBUTTON "& ...", IDC_EDITCOMPATIBILITYMODES, 117,167,100,15 + GROUPBOX "Настройки экрана", -1, 7,99,210,61, BS_GROUPBOX | WS_DISABLED + CHECKBOX "256 цветов", IDC_CHKRUNIN256COLORS, 18,114,188,10, BS_AUTOCHECKBOX | WS_TABSTOP | WS_DISABLED + CHECKBOX "Разрешение 640x480", IDC_CHKRUNIN640480RES, 18,129,188,10, BS_AUTOCHECKBOX | WS_TABSTOP | WS_DISABLED + CHECKBOX "Запрещать визуальные темы", IDC_CHKDISABLEVISUALTHEMES, 18,144,188,10, BS_AUTOCHECKBOX | WS_TABSTOP | WS_DISABLED + PUSHBUTTON "&Режимы совместимости...", IDC_EDITCOMPATIBILITYMODES, 117,167,100,15 /* CONTROL "Learn more about program compatibility.", IDC_INFOLINK, "SysLink", WS_CHILD | WS_TABSTOP | WS_VISIBLE, 7,207,210,10, WS_EX_NOPARENTNOTIFY */ END IDD_EDITCOMPATIBILITYMODES DIALOGEX 0, 0, 230, 139 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Правка режимов совместимости" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN LISTBOX IDC_COMPATIBILITYMODE, 9,6,148,108, LBS_NOTIFY | LBS_WANTKEYBOARDINPUT | WS_BORDER - PUSHBUTTON "&...", IDC_ADD, 162,6,60,14, WS_DISABLED - PUSHBUTTON "&...", IDC_EDIT, 162,24,60,14, WS_DISABLED - PUSHBUTTON "&", IDC_DELETE, 162,42,60,14, WS_DISABLED + PUSHBUTTON "&Добавить...", IDC_ADD, 162,6,60,14, WS_DISABLED + PUSHBUTTON "&Изменить...", IDC_EDIT, 162,24,60,14, WS_DISABLED + PUSHBUTTON "&Удалить", IDC_DELETE, 162,42,60,14, WS_DISABLED PUSHBUTTON "&OK", IDOK, 95,116,60,14 - PUSHBUTTON "&", IDCANCEL, 162,116,60,14 + PUSHBUTTON "&Отмена", IDCANCEL, 162,116,60,14 END STRINGTABLE diff --git a/dll/shellext/slayer/lang/uk-UA.rc b/dll/shellext/slayer/lang/uk-UA.rc index 69295b5da78..4dd2462ae59 100644 --- a/dll/shellext/slayer/lang/uk-UA.rc +++ b/dll/shellext/slayer/lang/uk-UA.rc @@ -10,37 +10,37 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT IDD_SLAYERSHEET DIALOGEX 0, 0, 224, 226 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Сумісність" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT " ReactOS, .", -1, 7,7,210,31 - GROUPBOX " ", IDC_COMPATGROUP, 7,41,210,49 - CHECKBOX " :", IDC_CHKRUNCOMPATIBILITY, 18,57,188,10, BS_AUTOCHECKBOX | WS_TABSTOP + LTEXT "Якщо у Вас виникли проблеми із запуском цієї програми у ReactOS, виберіть режим сумісності з потрібною версією ОС.", -1, 7,7,210,31 + GROUPBOX "Режим сумісності", IDC_COMPATGROUP, 7,41,210,49 + CHECKBOX "Запускати програму в режимі сумісності для:", IDC_CHKRUNCOMPATIBILITY, 18,57,188,10, BS_AUTOCHECKBOX | WS_TABSTOP COMBOBOX IDC_COMPATIBILITYMODE, 18,70,188,85, CBS_HASSTRINGS | CBS_DROPDOWNLIST | WS_TABSTOP | WS_DISABLED - GROUPBOX " ", -1, 7,99,210,61, BS_GROUPBOX | WS_DISABLED - CHECKBOX "256 ", IDC_CHKRUNIN256COLORS, 18,114,188,10, BS_AUTOCHECKBOX | WS_TABSTOP | WS_DISABLED - CHECKBOX " 640x480", IDC_CHKRUNIN640480RES, 18,129,188,10, BS_AUTOCHECKBOX | WS_TABSTOP | WS_DISABLED - CHECKBOX " ", IDC_CHKDISABLEVISUALTHEMES, 18,144,188,10, BS_AUTOCHECKBOX | WS_TABSTOP | WS_DISABLED - PUSHBUTTON "& ...", IDC_EDITCOMPATIBILITYMODES, 117,167,100,15 + GROUPBOX "Настройки екрану", -1, 7,99,210,61, BS_GROUPBOX | WS_DISABLED + CHECKBOX "256 кольорів", IDC_CHKRUNIN256COLORS, 18,114,188,10, BS_AUTOCHECKBOX | WS_TABSTOP | WS_DISABLED + CHECKBOX "Роздільна здатність 640x480", IDC_CHKRUNIN640480RES, 18,129,188,10, BS_AUTOCHECKBOX | WS_TABSTOP | WS_DISABLED + CHECKBOX "Вимикати візуальні теми", IDC_CHKDISABLEVISUALTHEMES, 18,144,188,10, BS_AUTOCHECKBOX | WS_TABSTOP | WS_DISABLED + PUSHBUTTON "&Режими сумісності...", IDC_EDITCOMPATIBILITYMODES, 117,167,100,15 /* CONTROL "Learn more about program compatibility.", IDC_INFOLINK, "SysLink", WS_CHILD | WS_TABSTOP | WS_VISIBLE, 7,207,210,10, WS_EX_NOPARENTNOTIFY */ END IDD_EDITCOMPATIBILITYMODES DIALOGEX 0, 0, 230, 139 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Редагування режимів сумісності" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN LISTBOX IDC_COMPATIBILITYMODE, 9,6,148,108, LBS_NOTIFY | LBS_WANTKEYBOARDINPUT | WS_BORDER - PUSHBUTTON "&...", IDC_ADD, 162,6,60,14, WS_DISABLED - PUSHBUTTON "&...", IDC_EDIT, 162,24,60,14, WS_DISABLED - PUSHBUTTON "&", IDC_DELETE, 162,42,60,14, WS_DISABLED + PUSHBUTTON "&Додати...", IDC_ADD, 162,6,60,14, WS_DISABLED + PUSHBUTTON "&Редагувати...", IDC_EDIT, 162,24,60,14, WS_DISABLED + PUSHBUTTON "В&идалити", IDC_DELETE, 162,42,60,14, WS_DISABLED PUSHBUTTON "&OK", IDOK, 95,116,60,14 - PUSHBUTTON "&", IDCANCEL, 162,116,60,14 + PUSHBUTTON "&Скасувати", IDCANCEL, 162,116,60,14 END STRINGTABLE BEGIN IDS_SLAYER "Slayer" - IDS_DESCRIPTION " " + IDS_DESCRIPTION "Розширеня оболонки для Прошарка сумісності програм" END diff --git a/dll/shellext/slayer/rsrc.rc b/dll/shellext/slayer/rsrc.rc index fb3c0393bdc..b46f9036867 100644 --- a/dll/shellext/slayer/rsrc.rc +++ b/dll/shellext/slayer/rsrc.rc @@ -13,8 +13,11 @@ #include "lang/it-IT.rc" #include "lang/nl-NL.rc" #include "lang/no-NO.rc" -#include "lang/pl-PL.rc" -#include "lang/ru-RU.rc" #include "lang/sk-SK.rc" #include "lang/sv-SE.rc" + +// UTF-8 +#pragma code_page(65001) +#include "lang/pl-PL.rc" +#include "lang/ru-RU.rc" #include "lang/uk-UA.rc" diff --git a/dll/win32/CMakeLists.txt b/dll/win32/CMakeLists.txt index 743abac2a49..4d4a4b8633e 100644 --- a/dll/win32/CMakeLists.txt +++ b/dll/win32/CMakeLists.txt @@ -43,7 +43,7 @@ add_subdirectory(getuname) add_subdirectory(glu32) add_subdirectory(hhctrl.ocx) add_subdirectory(hid) -add_subdirectory(hlink) +add_subdirectory(hlink) # FIXME: msvc build. add_subdirectory(hnetcfg) add_subdirectory(httpapi) add_subdirectory(iccvid) @@ -58,7 +58,9 @@ add_subdirectory(inseng) add_subdirectory(iphlpapi) #add_subdirectory(iprtprio) # not built in trunk add_subdirectory(itircl) -add_subdirectory(itss) +if(NOT MSVC) + add_subdirectory(itss) # FIXME: msvc build. +endif() add_subdirectory(jscript) add_subdirectory(kernel32) add_subdirectory(loadperf) @@ -90,10 +92,11 @@ add_subdirectory(msg711.acm) add_subdirectory(msgina) add_subdirectory(msgsm32.acm) if(NOT MSVC) -add_subdirectory(mshtml) -add_subdirectory(mshtml.tlb) + #FIXME: msvc build. + add_subdirectory(mshtml) endif() add_subdirectory(msi) +add_subdirectory(mshtml.tlb) add_subdirectory(msimg32) add_subdirectory(msimtf) add_subdirectory(msisip) @@ -105,12 +108,14 @@ add_subdirectory(mssign32) add_subdirectory(mssip32) add_subdirectory(mstask) add_subdirectory(msvcrt) -#add_subdirectory(msvcrt20) FIX spec2def -#add_subdirectory(msvcrt40) FIX spec2def +add_subdirectory(msvcrt20) +add_subdirectory(msvcrt40) add_subdirectory(msvfw32) add_subdirectory(msvidc32) add_subdirectory(mswsock) -add_subdirectory(msxml3) +if(NOT MSVC) + add_subdirectory(msxml3) # FIXME: msvc build. +endif() add_subdirectory(nddeapi) add_subdirectory(netapi32) add_subdirectory(netcfgx) @@ -140,7 +145,9 @@ add_subdirectory(powrprof) add_subdirectory(printui) add_subdirectory(psapi) add_subdirectory(pstorec) -add_subdirectory(qmgr) +if(NOT MSVC) + add_subdirectory(qmgr) # FIXME: msvc build. +endif() add_subdirectory(qmgrprxy) add_subdirectory(query) add_subdirectory(rasadhlp) @@ -178,7 +185,9 @@ add_subdirectory(softpub) add_subdirectory(spoolss) add_subdirectory(srclient) add_subdirectory(stdole2.tlb) -add_subdirectory(stdole32.tlb) +if(NOT MSVC) + add_subdirectory(stdole32.tlb) # FIXME: msvc build. +endif() add_subdirectory(sti) add_subdirectory(sxs) add_subdirectory(syssetup) diff --git a/dll/win32/acledit/CMakeLists.txt b/dll/win32/acledit/CMakeLists.txt index 5a923400e28..bf9a297d4a5 100644 --- a/dll/win32/acledit/CMakeLists.txt +++ b/dll/win32/acledit/CMakeLists.txt @@ -13,5 +13,6 @@ add_library(acledit SHARED ${SOURCE}) set_module_type(acledit win32dll) add_importlibs(acledit msvcrt kernel32 ntdll) +add_pch(acledit acleditint.h) add_cd_file(TARGET acledit DESTINATION reactos/system32 FOR all) add_importlib_target(acledit.spec) diff --git a/dll/win32/acledit/acledit.c b/dll/win32/acledit/acledit.c index 4b16cddb403..a7b98fc4d41 100644 --- a/dll/win32/acledit/acledit.c +++ b/dll/win32/acledit/acledit.c @@ -28,9 +28,8 @@ * UPDATE HISTORY: * 07/09/2004 Created */ -#include + #include "acleditint.h" -#include "resource.h" HINSTANCE hDllInstance; diff --git a/dll/win32/acledit/acledit.rbuild b/dll/win32/acledit/acledit.rbuild index e851138f276..741acb91b88 100644 --- a/dll/win32/acledit/acledit.rbuild +++ b/dll/win32/acledit/acledit.rbuild @@ -10,4 +10,5 @@ acledit.c stubs.c acledit.rc + acleditint.h diff --git a/dll/win32/acledit/acleditint.h b/dll/win32/acledit/acleditint.h index 1ebad0b6531..9cb292f55b3 100644 --- a/dll/win32/acledit/acleditint.h +++ b/dll/win32/acledit/acleditint.h @@ -1,4 +1,5 @@ -#pragma once +#include +#include "resource.h" extern HINSTANCE hDllInstance; diff --git a/dll/win32/acledit/stubs.c b/dll/win32/acledit/stubs.c index 45d23c78652..7fe47139d17 100644 --- a/dll/win32/acledit/stubs.c +++ b/dll/win32/acledit/stubs.c @@ -12,7 +12,7 @@ * UPDATE HISTORY: * 07/09/2004 Created */ -#include + #include "acleditint.h" ULONG DbgPrint(PCH Format,...); diff --git a/dll/win32/aclui/CMakeLists.txt b/dll/win32/aclui/CMakeLists.txt index c41fcc3d89c..41f8009a3bb 100644 --- a/dll/win32/aclui/CMakeLists.txt +++ b/dll/win32/aclui/CMakeLists.txt @@ -14,9 +14,7 @@ list(APPEND SOURCE aclui.rc ${CMAKE_CURRENT_BINARY_DIR}/aclui.def) -add_library(aclui SHARED - ${CMAKE_CURRENT_BINARY_DIR}/aclui_precomp.h.gch - ${SOURCE}) +add_library(aclui SHARED ${SOURCE}) set_module_type(aclui win32dll) @@ -24,6 +22,6 @@ add_importlib_target(aclui.spec) add_importlibs(aclui user32 gdi32 comctl32 ole32 oleaut32 advapi32 uxtheme msvcrt kernel32 ntdll) -add_pch(aclui ${CMAKE_CURRENT_SOURCE_DIR}/precomp.h ${SOURCE}) +add_pch(aclui precomp.h) add_cd_file(TARGET aclui DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/aclui/aclui.rc b/dll/win32/aclui/aclui.rc index fee7b625fe2..c197805cf5c 100644 --- a/dll/win32/aclui/aclui.rc +++ b/dll/win32/aclui/aclui.rc @@ -23,7 +23,10 @@ IDB_USRGRPIMAGES BITMAP "res/usrgrp.bmp" #include "aclui_Nl.rc" #include "aclui_No.rc" #include "aclui_Pl.rc" -#include "aclui_Ru.rc" #include "aclui_Sv.rc" #include "aclui_Th.rc" + +// UTF-8 +#pragma code_page(65001) +#include "aclui_Ru.rc" #include "aclui_Uk.rc" diff --git a/dll/win32/aclui/aclui_Ru.rc b/dll/win32/aclui/aclui_Ru.rc index 3cebdcfeca6..318b1d9d82b 100644 --- a/dll/win32/aclui/aclui_Ru.rc +++ b/dll/win32/aclui/aclui_Ru.rc @@ -2,28 +2,28 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT IDD_SECPAGE DIALOGEX 0, 0, 227, 215 STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE | WS_CAPTION -CAPTION "" +CAPTION "Безопасность" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT "& :", -1, 7, 7, 105, 8 + LTEXT "&Имя группы или пользователя:", -1, 7, 7, 105, 8 CONTROL "", IDC_PRINCIPALS, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 7, 17, 213, 66, WS_EX_NOPARENTNOTIFY | WS_EX_CLIENTEDGE - PUSHBUTTON "&...", IDC_ADD_PRINCIPAL, 116, 87, 50, 14 - PUSHBUTTON "&", IDC_REMOVE_PRINCIPAL, 170, 87, 50, 14 + PUSHBUTTON "До&бавить...", IDC_ADD_PRINCIPAL, 116, 87, 50, 14 + PUSHBUTTON "&Удалить", IDC_REMOVE_PRINCIPAL, 170, 87, 50, 14 LTEXT "", IDC_LABEL_PERMISSIONS_FOR, 7, 107, 105, 8, SS_LEFT | SS_NOPREFIX - LTEXT "", IDC_LABEL_ALLOW, 130, 107, 40, 8, SS_CENTER - LTEXT "", IDC_LABEL_DENY, 176, 107, 40, 8, SS_CENTER + LTEXT "Разрешить", IDC_LABEL_ALLOW, 130, 107, 40, 8, SS_CENTER + LTEXT "Запретить", IDC_LABEL_DENY, 176, 107, 40, 8, SS_CENTER CONTROL "", IDC_ACE_CHECKLIST, "CHECKLIST_ACLUI", WS_CHILD | WS_VISIBLE | WS_TABSTOP, 7, 117, 213, 72, WS_EX_CLIENTEDGE - LTEXT " , :", IDC_LABEL_ADVANCED, 7, 194, 153, 16, SS_LEFT - PUSHBUTTON "&", IDC_ADVANCED, 160, 194, 60, 14 + LTEXT "Чтобы задать особые разрешения или параметры, нажмите эту кнопку:", IDC_LABEL_ADVANCED, 7, 194, 153, 16, SS_LEFT + PUSHBUTTON "До&полнительно", IDC_ADVANCED, 160, 194, 60, 14 END STRINGTABLE DISCARDABLE { - IDS_PSP_TITLE " %1" - IDS_UNKNOWN "" - IDS_SPECIAL_PERMISSIONS " " - IDS_PERMISSIONS_FOR " %1" - IDS_PERMISSIONS "" + IDS_PSP_TITLE "Разрешения для %1" + IDS_UNKNOWN "Неизвестный" + IDS_SPECIAL_PERMISSIONS "Особые разрешения" + IDS_PERMISSIONS_FOR "Разрешения для %1" + IDS_PERMISSIONS "Разрешения" IDS_USERDOMAINFORMAT "%1 (%2\\%3)" IDS_USERFORMAT "%1" } diff --git a/dll/win32/aclui/aclui_Uk.rc b/dll/win32/aclui/aclui_Uk.rc index 9587545c7a8..7d94e81a7da 100644 --- a/dll/win32/aclui/aclui_Uk.rc +++ b/dll/win32/aclui/aclui_Uk.rc @@ -10,30 +10,30 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT IDD_SECPAGE DIALOGEX 0, 0, 227, 215 STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE | WS_CAPTION -CAPTION "" +CAPTION "Безпека" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT "& :", -1, 7, 21, 105, 8 + LTEXT "&Групи або користувачі:", -1, 7, 21, 105, 8 CONTROL "", IDC_PRINCIPALS, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 7, 31, 213, 52, WS_EX_NOPARENTNOTIFY | WS_EX_CLIENTEDGE - LTEXT "&:", -1, 7, 7, 49, 8 + LTEXT "&Власник:", -1, 7, 7, 49, 8 EDITTEXT IDC_OWNER, 63, 4, 156, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP | ES_READONLY - PUSHBUTTON "&...", IDC_ADD_PRINCIPAL, 116, 87, 50, 14 - PUSHBUTTON "&", IDC_REMOVE_PRINCIPAL, 170, 87, 50, 14 + PUSHBUTTON "&Додати...", IDC_ADD_PRINCIPAL, 116, 87, 50, 14 + PUSHBUTTON "В&идалити", IDC_REMOVE_PRINCIPAL, 170, 87, 50, 14 LTEXT "", IDC_LABEL_PERMISSIONS_FOR, 7, 107, 105, 8, SS_LEFT | SS_NOPREFIX - LTEXT "", IDC_LABEL_ALLOW, 133, 107, 36, 8, SS_CENTER - LTEXT "", IDC_LABEL_DENY, 172, 107, 40, 8, SS_CENTER + LTEXT "Дозволити", IDC_LABEL_ALLOW, 133, 107, 36, 8, SS_CENTER + LTEXT "Заборонити", IDC_LABEL_DENY, 172, 107, 40, 8, SS_CENTER CONTROL "", IDC_ACE_CHECKLIST, "CHECKLIST_ACLUI", WS_CHILD | WS_VISIBLE | WS_TABSTOP, 7, 117, 213, 72, WS_EX_CLIENTEDGE - LTEXT " , .", IDC_LABEL_ADVANCED, 7, 194, 153, 16, SS_LEFT - PUSHBUTTON "&", IDC_ADVANCED, 165, 194, 55, 14 + LTEXT "Для задання особливих дозволів або параметрів, натисніть Додатково.", IDC_LABEL_ADVANCED, 7, 194, 153, 16, SS_LEFT + PUSHBUTTON "Дод&атково", IDC_ADVANCED, 165, 194, 55, 14 END STRINGTABLE DISCARDABLE { - IDS_PSP_TITLE " %1" - IDS_UNKNOWN "" - IDS_SPECIAL_PERMISSIONS " " - IDS_PERMISSIONS_FOR " %1" - IDS_PERMISSIONS "" + IDS_PSP_TITLE "Дозволи для %1" + IDS_UNKNOWN "Невідомий" + IDS_SPECIAL_PERMISSIONS "Особливі дозволи" + IDS_PERMISSIONS_FOR "Дозволи для %1" + IDS_PERMISSIONS "Дозволи" IDS_USERDOMAINFORMAT "%1 (%2\\%3)" IDS_USERFORMAT "%1" } diff --git a/dll/win32/aclui/precomp.h b/dll/win32/aclui/precomp.h index d300be0953b..95706946af4 100644 --- a/dll/win32/aclui/precomp.h +++ b/dll/win32/aclui/precomp.h @@ -1,8 +1,8 @@ -#define WIN32_NO_STATUS -#define NTOS_MODE_USER #define _ACLUI_ +#define WIN32_NO_STATUS #include -#include +#define NTOS_MODE_USER +#include #include #include #include diff --git a/dll/win32/actxprxy/CMakeLists.txt b/dll/win32/actxprxy/CMakeLists.txt index 41b0eb8b69d..9faeaf72240 100644 --- a/dll/win32/actxprxy/CMakeLists.txt +++ b/dll/win32/actxprxy/CMakeLists.txt @@ -44,6 +44,7 @@ add_importlibs(actxprxy rpcrt4 ole32 oleaut32 + msvcrt kernel32 ntdll) diff --git a/dll/win32/advapi32/CMakeLists.txt b/dll/win32/advapi32/CMakeLists.txt index 114b75f0b2f..5b04aab223e 100644 --- a/dll/win32/advapi32/CMakeLists.txt +++ b/dll/win32/advapi32/CMakeLists.txt @@ -1,6 +1,4 @@ -set_unicode() - spec2def(advapi32.dll advapi32.spec) add_definitions(-D_ADVAPI32_) @@ -8,7 +6,16 @@ add_definitions(-D_ADVAPI32_) remove_definitions(-D_WIN32_WINNT=0x502) add_definitions(-D_WIN32_WINNT=0x600) -include_directories(${REACTOS_BINARY_DIR}/include/reactos/idl) +include_directories( + ${REACTOS_SOURCE_DIR}/include/reactos/idl + ${CMAKE_CURRENT_BINARY_DIR}) + +add_rpc_files(client + ${REACTOS_SOURCE_DIR}/include/reactos/idl/eventlogrpc.idl + ${REACTOS_SOURCE_DIR}/include/reactos/idl/lsa.idl + ${REACTOS_SOURCE_DIR}/include/reactos/idl/svcctl.idl) + +set_unicode() list(APPEND SOURCE crypt/crypt.c @@ -43,23 +50,23 @@ list(APPEND SOURCE token/token.c advapi32.rc ${CMAKE_CURRENT_BINARY_DIR}/advapi32_stubs.c - ${CMAKE_CURRENT_BINARY_DIR}/advapi32.def) + ${CMAKE_CURRENT_BINARY_DIR}/advapi32.def + ${CMAKE_CURRENT_BINARY_DIR}/eventlogrpc_c.c + ${CMAKE_CURRENT_BINARY_DIR}/lsa_c.c + ${CMAKE_CURRENT_BINARY_DIR}/svcctl_c.c) -add_library(advapi32 SHARED - ${CMAKE_CURRENT_BINARY_DIR}/advapi32_advapi32.h.gch - ${SOURCE}) +add_library(advapi32 SHARED ${SOURCE}) set_module_type(advapi32 win32dll) target_link_libraries(advapi32 - svcctlrpc - lsarpc - eventlogrpc wine ${PSEH_LIB}) -add_importlibs(advapi32 rpcrt4 kernel32 ntdll msvcrt) +add_importlibs(advapi32 rpcrt4 msvcrt kernel32 ntdll) -add_pch(advapi32 ${CMAKE_CURRENT_SOURCE_DIR}/advapi32.h ${SOURCE}) +add_pch(advapi32 advapi32.h + ${CMAKE_CURRENT_BINARY_DIR}/lsa_c.h + ${CMAKE_CURRENT_BINARY_DIR}/eventlogrpc_c.h) add_cd_file(TARGET advapi32 DESTINATION reactos/system32 FOR all) add_importlib_target(advapi32.spec) diff --git a/dll/win32/advapi32/advapi32.h b/dll/win32/advapi32/advapi32.h index cf370072669..eb113866582 100644 --- a/dll/win32/advapi32/advapi32.h +++ b/dll/win32/advapi32/advapi32.h @@ -25,7 +25,14 @@ #include #include #define NTOS_MODE_USER -#include +#include +#include +#include +#include +#include +#include +#include +#include /* this has to go after the NDK when being used with the NDK */ #include @@ -35,6 +42,13 @@ #include "lsa_c.h" #include "eventlogrpc_c.h" +#include + +#include "crypt/crypt.h" +#include +#include +#include + #ifndef HAS_FN_PROGRESSW #define FN_PROGRESSW FN_PROGRESS #endif diff --git a/dll/win32/advapi32/crypt/crypt.c b/dll/win32/advapi32/crypt/crypt.c index e7c04c5478c..59ff684d8bf 100644 --- a/dll/win32/advapi32/crypt/crypt.c +++ b/dll/win32/advapi32/crypt/crypt.c @@ -25,10 +25,6 @@ */ #include -#include "crypt.h" - -#include -#include WINE_DEFAULT_DEBUG_CHANNEL(crypt); diff --git a/dll/win32/advapi32/crypt/crypt_arc4.c b/dll/win32/advapi32/crypt/crypt_arc4.c index 32a68fe68fd..7d2381b4583 100644 --- a/dll/win32/advapi32/crypt/crypt_arc4.c +++ b/dll/win32/advapi32/crypt/crypt_arc4.c @@ -21,9 +21,6 @@ #include -#include "crypt.h" - - void arc4_init(arc4_info *a4i, const BYTE *key, unsigned int keyLen) { unsigned int keyIndex = 0, stateIndex = 0; diff --git a/dll/win32/advapi32/crypt/crypt_des.c b/dll/win32/advapi32/crypt/crypt_des.c index cf59d400073..f568082c1d3 100644 --- a/dll/win32/advapi32/crypt/crypt_des.c +++ b/dll/win32/advapi32/crypt/crypt_des.c @@ -22,7 +22,6 @@ */ #include -#include "crypt.h" static const unsigned char InitialPermuteMap[64] = { diff --git a/dll/win32/advapi32/crypt/crypt_lmhash.c b/dll/win32/advapi32/crypt/crypt_lmhash.c index 657505ef252..129c9842075 100644 --- a/dll/win32/advapi32/crypt/crypt_lmhash.c +++ b/dll/win32/advapi32/crypt/crypt_lmhash.c @@ -21,8 +21,6 @@ */ #include -#include "crypt.h" - static const unsigned char CRYPT_LMhash_Magic[8] = { 'K', 'G', 'S', '!', '@', '#', '$', '%' }; diff --git a/dll/win32/advapi32/crypt/crypt_md4.c b/dll/win32/advapi32/crypt/crypt_md4.c index bbf23a73432..b32eebd6184 100644 --- a/dll/win32/advapi32/crypt/crypt_md4.c +++ b/dll/win32/advapi32/crypt/crypt_md4.c @@ -34,8 +34,6 @@ */ #include -#include "crypt.h" - /* The three core functions */ diff --git a/dll/win32/advapi32/crypt/crypt_md5.c b/dll/win32/advapi32/crypt/crypt_md5.c index 1b6d4ef9100..1837eb023a8 100644 --- a/dll/win32/advapi32/crypt/crypt_md5.c +++ b/dll/win32/advapi32/crypt/crypt_md5.c @@ -34,8 +34,6 @@ */ #include -#include "crypt.h" - typedef struct { diff --git a/dll/win32/advapi32/crypt/crypt_sha.c b/dll/win32/advapi32/crypt/crypt_sha.c index 320c5c363df..b677c426ea8 100644 --- a/dll/win32/advapi32/crypt/crypt_sha.c +++ b/dll/win32/advapi32/crypt/crypt_sha.c @@ -18,7 +18,6 @@ */ #include -#include "crypt.h" /* SHA Context Structure Declaration */ diff --git a/dll/win32/advapi32/misc/dllmain.c b/dll/win32/advapi32/misc/dllmain.c index 39a2445e4aa..042e3bf9da1 100644 --- a/dll/win32/advapi32/misc/dllmain.c +++ b/dll/win32/advapi32/misc/dllmain.c @@ -10,8 +10,7 @@ */ #include -#define NDEBUG -#include +WINE_DEFAULT_DEBUG_CHANNEL(advapi); extern BOOL RegInitialize(VOID); extern BOOL RegCleanup(VOID); diff --git a/dll/win32/advapi32/misc/efs.c b/dll/win32/advapi32/misc/efs.c index 51f4111368a..9f66a810e69 100644 --- a/dll/win32/advapi32/misc/efs.c +++ b/dll/win32/advapi32/misc/efs.c @@ -7,8 +7,6 @@ */ #include -#include "wine/debug.h" - WINE_DEFAULT_DEBUG_CHANNEL(advapi); diff --git a/dll/win32/advapi32/misc/hwprofiles.c b/dll/win32/advapi32/misc/hwprofiles.c index 6bfc08b0df0..980001d999b 100644 --- a/dll/win32/advapi32/misc/hwprofiles.c +++ b/dll/win32/advapi32/misc/hwprofiles.c @@ -8,8 +8,6 @@ */ #include -#include -#include WINE_DEFAULT_DEBUG_CHANNEL(advapi); /****************************************************************************** diff --git a/dll/win32/advapi32/misc/logon.c b/dll/win32/advapi32/misc/logon.c index 8cd1954a188..0498f3db141 100644 --- a/dll/win32/advapi32/misc/logon.c +++ b/dll/win32/advapi32/misc/logon.c @@ -7,8 +7,6 @@ */ #include - -#include WINE_DEFAULT_DEBUG_CHANNEL(advapi); diff --git a/dll/win32/advapi32/misc/msi.c b/dll/win32/advapi32/misc/msi.c index dc1d1397f71..bae86b7db4c 100644 --- a/dll/win32/advapi32/misc/msi.c +++ b/dll/win32/advapi32/misc/msi.c @@ -9,7 +9,6 @@ #include -#include WINE_DEFAULT_DEBUG_CHANNEL(advapi); #ifndef _UNICODE #define debugstr_aw debugstr_a diff --git a/dll/win32/advapi32/misc/shutdown.c b/dll/win32/advapi32/misc/shutdown.c index 26582aaa095..6e8af4d7267 100644 --- a/dll/win32/advapi32/misc/shutdown.c +++ b/dll/win32/advapi32/misc/shutdown.c @@ -11,7 +11,7 @@ */ #include -#include +WINE_DEFAULT_DEBUG_CHANNEL(advapi); #define USZ {0,0,0} diff --git a/dll/win32/advapi32/misc/sysfunc.c b/dll/win32/advapi32/misc/sysfunc.c index c6295d5509e..1512d38dc29 100644 --- a/dll/win32/advapi32/misc/sysfunc.c +++ b/dll/win32/advapi32/misc/sysfunc.c @@ -12,7 +12,6 @@ */ #include -#include static const unsigned char CRYPT_LMhash_Magic[8] = { 'K', 'G', 'S', '!', '@', '#', '$', '%' }; diff --git a/dll/win32/advapi32/misc/trace.c b/dll/win32/advapi32/misc/trace.c index 9de75f93ce2..f09d9a72718 100644 --- a/dll/win32/advapi32/misc/trace.c +++ b/dll/win32/advapi32/misc/trace.c @@ -3,10 +3,6 @@ */ #include - -#include -#include - WINE_DEFAULT_DEBUG_CHANNEL(advapi); /* * @unimplemented diff --git a/dll/win32/advapi32/reg/reg.c b/dll/win32/advapi32/reg/reg.c index 6f79ea466fc..7add1b1ec9b 100644 --- a/dll/win32/advapi32/reg/reg.c +++ b/dll/win32/advapi32/reg/reg.c @@ -14,8 +14,6 @@ /* INCLUDES *****************************************************************/ #include -#include - WINE_DEFAULT_DEBUG_CHANNEL(reg); /* DEFINES ******************************************************************/ @@ -2545,7 +2543,7 @@ RegEnumKeyExA(HKEY hKey, if (KeyInfo->Node.NameLength > NameLength || KeyInfo->Node.ClassLength > ClassLength) { - ErrorCode = ERROR_BUFFER_OVERFLOW; + ErrorCode = ERROR_BUFFER_OVERFLOW; } else { @@ -4016,7 +4014,7 @@ RegQueryValueExA(HKEY hkeyorg, static const int info_size = offsetof( KEY_VALUE_PARTIAL_INFORMATION, Data ); TRACE("(%p,%s,%p,%p,%p,%p=%d)\n", - hkey, debugstr_a(name), reserved, type, data, count, count ? *count : 0 ); + hkeyorg, debugstr_a(name), reserved, type, data, count, count ? *count : 0 ); if ((data && !count) || reserved) return ERROR_INVALID_PARAMETER; status = MapDefaultKey(&hkey, hkeyorg); diff --git a/dll/win32/advapi32/sec/ac.c b/dll/win32/advapi32/sec/ac.c index 111402a6715..76355366b8e 100644 --- a/dll/win32/advapi32/sec/ac.c +++ b/dll/win32/advapi32/sec/ac.c @@ -7,8 +7,6 @@ */ #include -#include - WINE_DEFAULT_DEBUG_CHANNEL(advapi); /* --- ACL --- */ diff --git a/dll/win32/advapi32/sec/audit.c b/dll/win32/advapi32/sec/audit.c index 1fc0464a0d5..74ab74cc74b 100644 --- a/dll/win32/advapi32/sec/audit.c +++ b/dll/win32/advapi32/sec/audit.c @@ -12,8 +12,6 @@ /* INCLUDES *****************************************************************/ #include -#include - WINE_DEFAULT_DEBUG_CHANNEL(advapi); /* FUNCTIONS ****************************************************************/ diff --git a/dll/win32/advapi32/sec/cred.c b/dll/win32/advapi32/sec/cred.c index cd74a6a17d0..3c5b7821d85 100644 --- a/dll/win32/advapi32/sec/cred.c +++ b/dll/win32/advapi32/sec/cred.c @@ -18,19 +18,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include -#include - -#include "windef.h" -#include "winbase.h" -#include "winreg.h" -#include "wincred.h" -#include "winternl.h" -#include "../crypt/crypt.h" - -#include "wine/unicode.h" -#include "wine/debug.h" - +#include WINE_DEFAULT_DEBUG_CHANNEL(cred); /* the size of the ARC4 key used to encrypt the password data */ diff --git a/dll/win32/advapi32/sec/lsa.c b/dll/win32/advapi32/sec/lsa.c index ec76774bbfd..b02bd3bca2d 100644 --- a/dll/win32/advapi32/sec/lsa.c +++ b/dll/win32/advapi32/sec/lsa.c @@ -11,9 +11,6 @@ * */ #include -#include "wine/debug.h" -#include "wine/unicode.h" - WINE_DEFAULT_DEBUG_CHANNEL(advapi); diff --git a/dll/win32/advapi32/sec/misc.c b/dll/win32/advapi32/sec/misc.c index f03c1a0bb9c..7bd77d6f7cc 100644 --- a/dll/win32/advapi32/sec/misc.c +++ b/dll/win32/advapi32/sec/misc.c @@ -11,9 +11,6 @@ */ #include -#include "wine/unicode.h" -#include "wine/debug.h" - WINE_DEFAULT_DEBUG_CHANNEL(advapi); diff --git a/dll/win32/advapi32/sec/sec.c b/dll/win32/advapi32/sec/sec.c index 99222f3f315..780942d560c 100644 --- a/dll/win32/advapi32/sec/sec.c +++ b/dll/win32/advapi32/sec/sec.c @@ -12,8 +12,6 @@ */ #include -#include "wine/debug.h" - WINE_DEFAULT_DEBUG_CHANNEL(advapi); /* diff --git a/dll/win32/advapi32/sec/sid.c b/dll/win32/advapi32/sec/sid.c index a51dc45fca6..91b5db6fb21 100644 --- a/dll/win32/advapi32/sec/sid.c +++ b/dll/win32/advapi32/sec/sid.c @@ -12,10 +12,6 @@ */ #include -#include -#include -#include - WINE_DEFAULT_DEBUG_CHANNEL(advapi); #define MAX_GUID_STRING_LEN 39 diff --git a/dll/win32/advapi32/sec/trustee.c b/dll/win32/advapi32/sec/trustee.c index c8dad098768..9a2b533be26 100644 --- a/dll/win32/advapi32/sec/trustee.c +++ b/dll/win32/advapi32/sec/trustee.c @@ -7,9 +7,6 @@ */ #include - -#include "wine/debug.h" - WINE_DEFAULT_DEBUG_CHANNEL(advapi); diff --git a/dll/win32/advapi32/service/eventlog.c b/dll/win32/advapi32/service/eventlog.c index 6401b063ef8..18d09e11789 100644 --- a/dll/win32/advapi32/service/eventlog.c +++ b/dll/win32/advapi32/service/eventlog.c @@ -22,8 +22,6 @@ */ #include -#include "wine/debug.h" - WINE_DEFAULT_DEBUG_CHANNEL(advapi); static RPC_UNICODE_STRING EmptyStringU = { 0, 0, L"" }; diff --git a/dll/win32/advapi32/service/scm.c b/dll/win32/advapi32/service/scm.c index 69710625498..2f1b8455de3 100644 --- a/dll/win32/advapi32/service/scm.c +++ b/dll/win32/advapi32/service/scm.c @@ -13,9 +13,6 @@ /* INCLUDES ******************************************************************/ #include - -#include "wine/debug.h" - WINE_DEFAULT_DEBUG_CHANNEL(advapi); @@ -744,18 +741,31 @@ EnumDependentServicesA(SC_HANDLE hService, LPDWORD pcbBytesNeeded, LPDWORD lpServicesReturned) { + ENUM_SERVICE_STATUSA ServiceStatus; LPENUM_SERVICE_STATUSA lpStatusPtr; + DWORD dwBufferSize; DWORD dwError; DWORD dwCount; - TRACE("EnumServicesStatusA() called\n"); + TRACE("EnumDependentServicesA() called\n"); + + if (lpServices == NULL || cbBufSize < sizeof(ENUM_SERVICE_STATUSA)) + { + lpStatusPtr = &ServiceStatus; + dwBufferSize = sizeof(ENUM_SERVICE_STATUSA); + } + else + { + lpStatusPtr = lpServices; + dwBufferSize = cbBufSize; + } RpcTryExcept { dwError = REnumDependentServicesA((SC_RPC_HANDLE)hService, dwServiceState, - (LPBYTE)lpServices, - cbBufSize, + (LPBYTE)lpStatusPtr, + dwBufferSize, pcbBytesNeeded, lpServicesReturned); } @@ -767,18 +777,20 @@ EnumDependentServicesA(SC_HANDLE hService, if (dwError == ERROR_SUCCESS || dwError == ERROR_MORE_DATA) { - lpStatusPtr = (LPENUM_SERVICE_STATUSA)lpServices; - for (dwCount = 0; dwCount < *lpServicesReturned; dwCount++) + if (*lpServicesReturned > 0) { - if (lpStatusPtr->lpServiceName) - lpStatusPtr->lpServiceName = - (LPSTR)((ULONG_PTR)lpServices + (ULONG_PTR)lpStatusPtr->lpServiceName); + for (dwCount = 0; dwCount < *lpServicesReturned; dwCount++) + { + if (lpStatusPtr->lpServiceName) + lpStatusPtr->lpServiceName = + (LPSTR)((ULONG_PTR)lpServices + (ULONG_PTR)lpStatusPtr->lpServiceName); - if (lpStatusPtr->lpDisplayName) - lpStatusPtr->lpDisplayName = - (LPSTR)((ULONG_PTR)lpServices + (ULONG_PTR)lpStatusPtr->lpDisplayName); + if (lpStatusPtr->lpDisplayName) + lpStatusPtr->lpDisplayName = + (LPSTR)((ULONG_PTR)lpServices + (ULONG_PTR)lpStatusPtr->lpDisplayName); - lpStatusPtr++; + lpStatusPtr++; + } } } @@ -808,18 +820,31 @@ EnumDependentServicesW(SC_HANDLE hService, LPDWORD pcbBytesNeeded, LPDWORD lpServicesReturned) { + ENUM_SERVICE_STATUSW ServiceStatus; LPENUM_SERVICE_STATUSW lpStatusPtr; + DWORD dwBufferSize; DWORD dwError; DWORD dwCount; - TRACE("EnumServicesStatusW() called\n"); + TRACE("EnumDependentServicesW() called\n"); + + if (lpServices == NULL || cbBufSize < sizeof(ENUM_SERVICE_STATUSW)) + { + lpStatusPtr = &ServiceStatus; + dwBufferSize = sizeof(ENUM_SERVICE_STATUSW); + } + else + { + lpStatusPtr = lpServices; + dwBufferSize = cbBufSize; + } RpcTryExcept { dwError = REnumDependentServicesW((SC_RPC_HANDLE)hService, dwServiceState, - (LPBYTE)lpServices, - cbBufSize, + (LPBYTE)lpStatusPtr, + dwBufferSize, pcbBytesNeeded, lpServicesReturned); } @@ -831,18 +856,20 @@ EnumDependentServicesW(SC_HANDLE hService, if (dwError == ERROR_SUCCESS || dwError == ERROR_MORE_DATA) { - lpStatusPtr = (LPENUM_SERVICE_STATUSW)lpServices; - for (dwCount = 0; dwCount < *lpServicesReturned; dwCount++) + if (*lpServicesReturned > 0) { - if (lpStatusPtr->lpServiceName) - lpStatusPtr->lpServiceName = - (LPWSTR)((ULONG_PTR)lpServices + (ULONG_PTR)lpStatusPtr->lpServiceName); + for (dwCount = 0; dwCount < *lpServicesReturned; dwCount++) + { + if (lpStatusPtr->lpServiceName) + lpStatusPtr->lpServiceName = + (LPWSTR)((ULONG_PTR)lpServices + (ULONG_PTR)lpStatusPtr->lpServiceName); - if (lpStatusPtr->lpDisplayName) - lpStatusPtr->lpDisplayName = - (LPWSTR)((ULONG_PTR)lpServices + (ULONG_PTR)lpStatusPtr->lpDisplayName); + if (lpStatusPtr->lpDisplayName) + lpStatusPtr->lpDisplayName = + (LPWSTR)((ULONG_PTR)lpServices + (ULONG_PTR)lpStatusPtr->lpDisplayName); - lpStatusPtr++; + lpStatusPtr++; + } } } @@ -875,7 +902,9 @@ EnumServiceGroupW(SC_HANDLE hSCManager, LPDWORD lpResumeHandle, LPCWSTR lpGroup) { + ENUM_SERVICE_STATUSW ServiceStatus; LPENUM_SERVICE_STATUSW lpStatusPtr; + DWORD dwBufferSize; DWORD dwError; DWORD dwCount; @@ -887,6 +916,17 @@ EnumServiceGroupW(SC_HANDLE hSCManager, return FALSE; } + if (lpServices == NULL || cbBufSize < sizeof(ENUM_SERVICE_STATUSW)) + { + lpStatusPtr = &ServiceStatus; + dwBufferSize = sizeof(ENUM_SERVICE_STATUSW); + } + else + { + lpStatusPtr = lpServices; + dwBufferSize = cbBufSize; + } + RpcTryExcept { if (lpGroup == NULL) @@ -894,8 +934,8 @@ EnumServiceGroupW(SC_HANDLE hSCManager, dwError = REnumServicesStatusW((SC_RPC_HANDLE)hSCManager, dwServiceType, dwServiceState, - (LPBYTE)lpServices, - cbBufSize, + (LPBYTE)lpStatusPtr, + dwBufferSize, pcbBytesNeeded, lpServicesReturned, lpResumeHandle); @@ -905,8 +945,8 @@ EnumServiceGroupW(SC_HANDLE hSCManager, dwError = REnumServiceGroupW((SC_RPC_HANDLE)hSCManager, dwServiceType, dwServiceState, - (LPBYTE)lpServices, - cbBufSize, + (LPBYTE)lpStatusPtr, + dwBufferSize, pcbBytesNeeded, lpServicesReturned, lpResumeHandle, @@ -921,18 +961,20 @@ EnumServiceGroupW(SC_HANDLE hSCManager, if (dwError == ERROR_SUCCESS || dwError == ERROR_MORE_DATA) { - lpStatusPtr = (LPENUM_SERVICE_STATUSW)lpServices; - for (dwCount = 0; dwCount < *lpServicesReturned; dwCount++) + if (*lpServicesReturned > 0) { - if (lpStatusPtr->lpServiceName) - lpStatusPtr->lpServiceName = - (LPWSTR)((ULONG_PTR)lpServices + (ULONG_PTR)lpStatusPtr->lpServiceName); + for (dwCount = 0; dwCount < *lpServicesReturned; dwCount++) + { + if (lpStatusPtr->lpServiceName) + lpStatusPtr->lpServiceName = + (LPWSTR)((ULONG_PTR)lpServices + (ULONG_PTR)lpStatusPtr->lpServiceName); - if (lpStatusPtr->lpDisplayName) - lpStatusPtr->lpDisplayName = - (LPWSTR)((ULONG_PTR)lpServices + (ULONG_PTR)lpStatusPtr->lpDisplayName); + if (lpStatusPtr->lpDisplayName) + lpStatusPtr->lpDisplayName = + (LPWSTR)((ULONG_PTR)lpServices + (ULONG_PTR)lpStatusPtr->lpDisplayName); - lpStatusPtr++; + lpStatusPtr++; + } } } @@ -964,7 +1006,9 @@ EnumServicesStatusA(SC_HANDLE hSCManager, LPDWORD lpServicesReturned, LPDWORD lpResumeHandle) { + ENUM_SERVICE_STATUSA ServiceStatus; LPENUM_SERVICE_STATUSA lpStatusPtr; + DWORD dwBufferSize; DWORD dwError; DWORD dwCount; @@ -1012,13 +1056,24 @@ EnumServicesStatusA(SC_HANDLE hSCManager, return FALSE; } + if (lpServices == NULL || cbBufSize < sizeof(ENUM_SERVICE_STATUSW)) + { + lpStatusPtr = &ServiceStatus; + dwBufferSize = sizeof(ENUM_SERVICE_STATUSW); + } + else + { + lpStatusPtr = lpServices; + dwBufferSize = cbBufSize; + } + RpcTryExcept { dwError = REnumServicesStatusA((SC_RPC_HANDLE)hSCManager, dwServiceType, dwServiceState, - (LPBYTE)lpServices, - cbBufSize, + (LPBYTE)lpStatusPtr, + dwBufferSize, pcbBytesNeeded, lpServicesReturned, lpResumeHandle); @@ -1031,18 +1086,20 @@ EnumServicesStatusA(SC_HANDLE hSCManager, if (dwError == ERROR_SUCCESS || dwError == ERROR_MORE_DATA) { - lpStatusPtr = (LPENUM_SERVICE_STATUSA)lpServices; - for (dwCount = 0; dwCount < *lpServicesReturned; dwCount++) + if (*lpServicesReturned > 0) { - if (lpStatusPtr->lpServiceName) - lpStatusPtr->lpServiceName = - (LPSTR)((ULONG_PTR)lpServices + (ULONG_PTR)lpStatusPtr->lpServiceName); + for (dwCount = 0; dwCount < *lpServicesReturned; dwCount++) + { + if (lpStatusPtr->lpServiceName) + lpStatusPtr->lpServiceName = + (LPSTR)((ULONG_PTR)lpServices + (ULONG_PTR)lpStatusPtr->lpServiceName); - if (lpStatusPtr->lpDisplayName) - lpStatusPtr->lpDisplayName = - (LPSTR)((ULONG_PTR)lpServices + (ULONG_PTR)lpStatusPtr->lpDisplayName); + if (lpStatusPtr->lpDisplayName) + lpStatusPtr->lpDisplayName = + (LPSTR)((ULONG_PTR)lpServices + (ULONG_PTR)lpStatusPtr->lpDisplayName); - lpStatusPtr++; + lpStatusPtr++; + } } } @@ -1074,7 +1131,9 @@ EnumServicesStatusW(SC_HANDLE hSCManager, LPDWORD lpServicesReturned, LPDWORD lpResumeHandle) { + ENUM_SERVICE_STATUSW ServiceStatus; LPENUM_SERVICE_STATUSW lpStatusPtr; + DWORD dwBufferSize; DWORD dwError; DWORD dwCount; @@ -1086,13 +1145,24 @@ EnumServicesStatusW(SC_HANDLE hSCManager, return FALSE; } + if (lpServices == NULL || cbBufSize < sizeof(ENUM_SERVICE_STATUSW)) + { + lpStatusPtr = &ServiceStatus; + dwBufferSize = sizeof(ENUM_SERVICE_STATUSW); + } + else + { + lpStatusPtr = lpServices; + dwBufferSize = cbBufSize; + } + RpcTryExcept { dwError = REnumServicesStatusW((SC_RPC_HANDLE)hSCManager, dwServiceType, dwServiceState, - (LPBYTE)lpServices, - cbBufSize, + (LPBYTE)lpStatusPtr, + dwBufferSize, pcbBytesNeeded, lpServicesReturned, lpResumeHandle); @@ -1105,18 +1175,20 @@ EnumServicesStatusW(SC_HANDLE hSCManager, if (dwError == ERROR_SUCCESS || dwError == ERROR_MORE_DATA) { - lpStatusPtr = (LPENUM_SERVICE_STATUSW)lpServices; - for (dwCount = 0; dwCount < *lpServicesReturned; dwCount++) + if (*lpServicesReturned > 0) { - if (lpStatusPtr->lpServiceName) - lpStatusPtr->lpServiceName = - (LPWSTR)((ULONG_PTR)lpServices + (ULONG_PTR)lpStatusPtr->lpServiceName); + for (dwCount = 0; dwCount < *lpServicesReturned; dwCount++) + { + if (lpStatusPtr->lpServiceName) + lpStatusPtr->lpServiceName = + (LPWSTR)((ULONG_PTR)lpServices + (ULONG_PTR)lpStatusPtr->lpServiceName); - if (lpStatusPtr->lpDisplayName) - lpStatusPtr->lpDisplayName = - (LPWSTR)((ULONG_PTR)lpServices + (ULONG_PTR)lpStatusPtr->lpDisplayName); + if (lpStatusPtr->lpDisplayName) + lpStatusPtr->lpDisplayName = + (LPWSTR)((ULONG_PTR)lpServices + (ULONG_PTR)lpStatusPtr->lpDisplayName); - lpStatusPtr++; + lpStatusPtr++; + } } } @@ -1150,7 +1222,9 @@ EnumServicesStatusExA(SC_HANDLE hSCManager, LPDWORD lpResumeHandle, LPCSTR pszGroupName) { + ENUM_SERVICE_STATUS_PROCESSA ServiceStatus; LPENUM_SERVICE_STATUS_PROCESSA lpStatusPtr; + DWORD dwBufferSize; DWORD dwError; DWORD dwCount; @@ -1168,14 +1242,26 @@ EnumServicesStatusExA(SC_HANDLE hSCManager, return FALSE; } + if (lpServices == NULL || + cbBufSize < sizeof(ENUM_SERVICE_STATUS_PROCESSA)) + { + lpStatusPtr = &ServiceStatus; + dwBufferSize = sizeof(ENUM_SERVICE_STATUS_PROCESSA); + } + else + { + lpStatusPtr = (LPENUM_SERVICE_STATUS_PROCESSA)lpServices; + dwBufferSize = cbBufSize; + } + RpcTryExcept { dwError = REnumServicesStatusExA((SC_RPC_HANDLE)hSCManager, InfoLevel, dwServiceType, dwServiceState, - (LPBYTE)lpServices, - cbBufSize, + (LPBYTE)lpStatusPtr, + dwBufferSize, pcbBytesNeeded, lpServicesReturned, lpResumeHandle, @@ -1189,18 +1275,20 @@ EnumServicesStatusExA(SC_HANDLE hSCManager, if (dwError == ERROR_SUCCESS || dwError == ERROR_MORE_DATA) { - lpStatusPtr = (LPENUM_SERVICE_STATUS_PROCESSA)lpServices; - for (dwCount = 0; dwCount < *lpServicesReturned; dwCount++) + if (InfoLevel == SC_ENUM_PROCESS_INFO) { - if (lpStatusPtr->lpServiceName) - lpStatusPtr->lpServiceName = - (LPSTR)((ULONG_PTR)lpServices + (ULONG_PTR)lpStatusPtr->lpServiceName); + for (dwCount = 0; dwCount < *lpServicesReturned; dwCount++) + { + if (lpStatusPtr->lpServiceName) + lpStatusPtr->lpServiceName = + (LPSTR)((ULONG_PTR)lpServices + (ULONG_PTR)lpStatusPtr->lpServiceName); - if (lpStatusPtr->lpDisplayName) - lpStatusPtr->lpDisplayName = - (LPSTR)((ULONG_PTR)lpServices + (ULONG_PTR)lpStatusPtr->lpDisplayName); + if (lpStatusPtr->lpDisplayName) + lpStatusPtr->lpDisplayName = + (LPSTR)((ULONG_PTR)lpServices + (ULONG_PTR)lpStatusPtr->lpDisplayName); - lpStatusPtr++; + lpStatusPtr++; + } } } @@ -1234,20 +1322,40 @@ EnumServicesStatusExW(SC_HANDLE hSCManager, LPDWORD lpResumeHandle, LPCWSTR pszGroupName) { + ENUM_SERVICE_STATUS_PROCESSW ServiceStatus; LPENUM_SERVICE_STATUS_PROCESSW lpStatusPtr; + DWORD dwBufferSize; DWORD dwError; DWORD dwCount; TRACE("EnumServicesStatusExW() called\n"); + if (InfoLevel != SC_ENUM_PROCESS_INFO) + { + SetLastError(ERROR_INVALID_LEVEL); + return FALSE; + } + + if (lpServices == NULL || + cbBufSize < sizeof(ENUM_SERVICE_STATUS_PROCESSW)) + { + lpStatusPtr = &ServiceStatus; + dwBufferSize = sizeof(ENUM_SERVICE_STATUS_PROCESSW); + } + else + { + lpStatusPtr = (LPENUM_SERVICE_STATUS_PROCESSW)lpServices; + dwBufferSize = cbBufSize; + } + RpcTryExcept { dwError = REnumServicesStatusExW((SC_RPC_HANDLE)hSCManager, InfoLevel, dwServiceType, dwServiceState, - (LPBYTE)lpServices, - cbBufSize, + (LPBYTE)lpStatusPtr, + dwBufferSize, pcbBytesNeeded, lpServicesReturned, lpResumeHandle, @@ -1261,18 +1369,20 @@ EnumServicesStatusExW(SC_HANDLE hSCManager, if (dwError == ERROR_SUCCESS || dwError == ERROR_MORE_DATA) { - lpStatusPtr = (LPENUM_SERVICE_STATUS_PROCESSW)lpServices; - for (dwCount = 0; dwCount < *lpServicesReturned; dwCount++) + if (InfoLevel == SC_ENUM_PROCESS_INFO) { - if (lpStatusPtr->lpServiceName) - lpStatusPtr->lpServiceName = - (LPWSTR)((ULONG_PTR)lpServices + (ULONG_PTR)lpStatusPtr->lpServiceName); + for (dwCount = 0; dwCount < *lpServicesReturned; dwCount++) + { + if (lpStatusPtr->lpServiceName) + lpStatusPtr->lpServiceName = + (LPWSTR)((ULONG_PTR)lpServices + (ULONG_PTR)lpStatusPtr->lpServiceName); - if (lpStatusPtr->lpDisplayName) - lpStatusPtr->lpDisplayName = - (LPWSTR)((ULONG_PTR)lpServices + (ULONG_PTR)lpStatusPtr->lpDisplayName); + if (lpStatusPtr->lpDisplayName) + lpStatusPtr->lpDisplayName = + (LPWSTR)((ULONG_PTR)lpServices + (ULONG_PTR)lpStatusPtr->lpDisplayName); - lpStatusPtr++; + lpStatusPtr++; + } } } @@ -1797,17 +1907,32 @@ QueryServiceConfigA(SC_HANDLE hService, DWORD cbBufSize, LPDWORD pcbBytesNeeded) { + QUERY_SERVICE_CONFIGA ServiceConfig; + LPQUERY_SERVICE_CONFIGA lpConfigPtr; + DWORD dwBufferSize; DWORD dwError; TRACE("QueryServiceConfigA(%p, %p, %lu, %p)\n", hService, lpServiceConfig, cbBufSize, pcbBytesNeeded); + if (lpServiceConfig == NULL || + cbBufSize < sizeof(QUERY_SERVICE_CONFIGA)) + { + lpConfigPtr = &ServiceConfig; + dwBufferSize = sizeof(QUERY_SERVICE_CONFIGA); + } + else + { + lpConfigPtr = lpServiceConfig; + dwBufferSize = cbBufSize; + } + RpcTryExcept { /* Call to services.exe using RPC */ dwError = RQueryServiceConfigA((SC_RPC_HANDLE)hService, - (LPBYTE)lpServiceConfig, - cbBufSize, + (LPBYTE)lpConfigPtr, + dwBufferSize, pcbBytesNeeded); } RpcExcept(EXCEPTION_EXECUTE_HANDLER) @@ -1824,30 +1949,30 @@ QueryServiceConfigA(SC_HANDLE hService, } /* Adjust the pointers */ - if (lpServiceConfig->lpBinaryPathName) - lpServiceConfig->lpBinaryPathName = - (LPSTR)((ULONG_PTR)lpServiceConfig + - (ULONG_PTR)lpServiceConfig->lpBinaryPathName); + if (lpConfigPtr->lpBinaryPathName) + lpConfigPtr->lpBinaryPathName = + (LPSTR)((ULONG_PTR)lpConfigPtr + + (ULONG_PTR)lpConfigPtr->lpBinaryPathName); - if (lpServiceConfig->lpLoadOrderGroup) - lpServiceConfig->lpLoadOrderGroup = - (LPSTR)((ULONG_PTR)lpServiceConfig + - (ULONG_PTR)lpServiceConfig->lpLoadOrderGroup); + if (lpConfigPtr->lpLoadOrderGroup) + lpConfigPtr->lpLoadOrderGroup = + (LPSTR)((ULONG_PTR)lpConfigPtr + + (ULONG_PTR)lpConfigPtr->lpLoadOrderGroup); - if (lpServiceConfig->lpDependencies) - lpServiceConfig->lpDependencies = - (LPSTR)((ULONG_PTR)lpServiceConfig + - (ULONG_PTR)lpServiceConfig->lpDependencies); + if (lpConfigPtr->lpDependencies) + lpConfigPtr->lpDependencies = + (LPSTR)((ULONG_PTR)lpConfigPtr + + (ULONG_PTR)lpConfigPtr->lpDependencies); - if (lpServiceConfig->lpServiceStartName) - lpServiceConfig->lpServiceStartName = - (LPSTR)((ULONG_PTR)lpServiceConfig + - (ULONG_PTR)lpServiceConfig->lpServiceStartName); + if (lpConfigPtr->lpServiceStartName) + lpConfigPtr->lpServiceStartName = + (LPSTR)((ULONG_PTR)lpConfigPtr + + (ULONG_PTR)lpConfigPtr->lpServiceStartName); - if (lpServiceConfig->lpDisplayName) - lpServiceConfig->lpDisplayName = - (LPSTR)((ULONG_PTR)lpServiceConfig + - (ULONG_PTR)lpServiceConfig->lpDisplayName); + if (lpConfigPtr->lpDisplayName) + lpConfigPtr->lpDisplayName = + (LPSTR)((ULONG_PTR)lpConfigPtr + + (ULONG_PTR)lpConfigPtr->lpDisplayName); TRACE("QueryServiceConfigA() done\n"); @@ -1866,17 +1991,32 @@ QueryServiceConfigW(SC_HANDLE hService, DWORD cbBufSize, LPDWORD pcbBytesNeeded) { + QUERY_SERVICE_CONFIGW ServiceConfig; + LPQUERY_SERVICE_CONFIGW lpConfigPtr; + DWORD dwBufferSize; DWORD dwError; TRACE("QueryServiceConfigW(%p, %p, %lu, %p)\n", hService, lpServiceConfig, cbBufSize, pcbBytesNeeded); + if (lpServiceConfig == NULL || + cbBufSize < sizeof(QUERY_SERVICE_CONFIGW)) + { + lpConfigPtr = &ServiceConfig; + dwBufferSize = sizeof(QUERY_SERVICE_CONFIGW); + } + else + { + lpConfigPtr = lpServiceConfig; + dwBufferSize = cbBufSize; + } + RpcTryExcept { /* Call to services.exe using RPC */ dwError = RQueryServiceConfigW((SC_RPC_HANDLE)hService, - (LPBYTE)lpServiceConfig, - cbBufSize, + (LPBYTE)lpConfigPtr, + dwBufferSize, pcbBytesNeeded); } RpcExcept(EXCEPTION_EXECUTE_HANDLER) @@ -1893,30 +2033,30 @@ QueryServiceConfigW(SC_HANDLE hService, } /* Adjust the pointers */ - if (lpServiceConfig->lpBinaryPathName) - lpServiceConfig->lpBinaryPathName = - (LPWSTR)((ULONG_PTR)lpServiceConfig + - (ULONG_PTR)lpServiceConfig->lpBinaryPathName); + if (lpConfigPtr->lpBinaryPathName) + lpConfigPtr->lpBinaryPathName = + (LPWSTR)((ULONG_PTR)lpConfigPtr + + (ULONG_PTR)lpConfigPtr->lpBinaryPathName); - if (lpServiceConfig->lpLoadOrderGroup) - lpServiceConfig->lpLoadOrderGroup = - (LPWSTR)((ULONG_PTR)lpServiceConfig + - (ULONG_PTR)lpServiceConfig->lpLoadOrderGroup); + if (lpConfigPtr->lpLoadOrderGroup) + lpConfigPtr->lpLoadOrderGroup = + (LPWSTR)((ULONG_PTR)lpConfigPtr + + (ULONG_PTR)lpConfigPtr->lpLoadOrderGroup); - if (lpServiceConfig->lpDependencies) - lpServiceConfig->lpDependencies = - (LPWSTR)((ULONG_PTR)lpServiceConfig + - (ULONG_PTR)lpServiceConfig->lpDependencies); + if (lpConfigPtr->lpDependencies) + lpConfigPtr->lpDependencies = + (LPWSTR)((ULONG_PTR)lpConfigPtr + + (ULONG_PTR)lpConfigPtr->lpDependencies); - if (lpServiceConfig->lpServiceStartName) - lpServiceConfig->lpServiceStartName = - (LPWSTR)((ULONG_PTR)lpServiceConfig + - (ULONG_PTR)lpServiceConfig->lpServiceStartName); + if (lpConfigPtr->lpServiceStartName) + lpConfigPtr->lpServiceStartName = + (LPWSTR)((ULONG_PTR)lpConfigPtr + + (ULONG_PTR)lpConfigPtr->lpServiceStartName); - if (lpServiceConfig->lpDisplayName) - lpServiceConfig->lpDisplayName = - (LPWSTR)((ULONG_PTR)lpServiceConfig + - (ULONG_PTR)lpServiceConfig->lpDisplayName); + if (lpConfigPtr->lpDisplayName) + lpConfigPtr->lpDisplayName = + (LPWSTR)((ULONG_PTR)lpConfigPtr + + (ULONG_PTR)lpConfigPtr->lpDisplayName); TRACE("QueryServiceConfigW() done\n"); @@ -2386,6 +2526,13 @@ QueryServiceStatusEx(SC_HANDLE hService, return FALSE; } + if (cbBufSize < sizeof(SERVICE_STATUS_PROCESS)) + { + *pcbBytesNeeded = sizeof(SERVICE_STATUS_PROCESS); + SetLastError(ERROR_INSUFFICIENT_BUFFER); + return FALSE; + } + RpcTryExcept { /* Call to services.exe using RPC */ diff --git a/dll/win32/advapi32/service/sctrl.c b/dll/win32/advapi32/service/sctrl.c index 90810bcca3c..1a1b31e6966 100644 --- a/dll/win32/advapi32/service/sctrl.c +++ b/dll/win32/advapi32/service/sctrl.c @@ -13,8 +13,6 @@ /* INCLUDES ******************************************************************/ #include -#include "wine/debug.h" - WINE_DEFAULT_DEBUG_CHANNEL(advapi); diff --git a/dll/win32/advapi32/token/token.c b/dll/win32/advapi32/token/token.c index 3e0cfcf8701..2c2687b2834 100644 --- a/dll/win32/advapi32/token/token.c +++ b/dll/win32/advapi32/token/token.c @@ -9,8 +9,6 @@ */ #include -#include "wine/debug.h" - WINE_DEFAULT_DEBUG_CHANNEL(advapi); /* diff --git a/dll/win32/authz/CMakeLists.txt b/dll/win32/authz/CMakeLists.txt index bb652abec05..3e5f6573b82 100644 --- a/dll/win32/authz/CMakeLists.txt +++ b/dll/win32/authz/CMakeLists.txt @@ -11,13 +11,11 @@ list(APPEND SOURCE ${CMAKE_CURRENT_BINARY_DIR}/authz_stubs.c ${CMAKE_CURRENT_BINARY_DIR}/authz.def) -add_library(authz SHARED - ${CMAKE_CURRENT_BINARY_DIR}/authz_precomp.h.gch - ${SOURCE}) +add_library(authz SHARED ${SOURCE}) set_module_type(authz win32dll) -add_pch(authz ${CMAKE_CURRENT_SOURCE_DIR}/precomp.h ${SOURCE}) add_importlibs(authz advapi32 msvcrt kernel32 ntdll) +add_pch(authz precomp.h) add_cd_file(TARGET authz DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/avifil32/CMakeLists.txt b/dll/win32/avifil32/CMakeLists.txt index 6edb848c253..d1041cbc50b 100644 --- a/dll/win32/avifil32/CMakeLists.txt +++ b/dll/win32/avifil32/CMakeLists.txt @@ -1,7 +1,5 @@ -add_definitions( - -D__WINESRC__ - -D_DLL -D__USE_CRTIMP) +add_definitions(-D__WINESRC__) remove_definitions(-D_WIN32_WINNT=0x502) add_definitions(-D_WIN32_WINNT=0x600) diff --git a/dll/win32/avifil32/avifile_Bg.rc b/dll/win32/avifil32/avifile_Bg.rc index 91372aa41a0..7048bec7780 100644 --- a/dll/win32/avifil32/avifile_Bg.rc +++ b/dll/win32/avifil32/avifile_Bg.rc @@ -1,4 +1,4 @@ -/* +/* * Copyright 2002 Michael GГјnnewig * * This library is free software; you can redistribute it and/or diff --git a/dll/win32/avifil32/avifile_Uk.rc b/dll/win32/avifil32/avifile_Uk.rc index f70335e5a19..c66ead3a9ed 100644 --- a/dll/win32/avifil32/avifile_Uk.rc +++ b/dll/win32/avifil32/avifile_Uk.rc @@ -18,35 +18,38 @@ #include "avifile_private.h" +/* UTF-8 */ +#pragma code_page(65001) + LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT IDD_SAVEOPTIONS DIALOG 43, 37, 196, 82 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Параметри стиснення" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "& :",-1,2,5,114,10 + LTEXT "&Оберіть потік:",-1,2,5,114,10 COMBOBOX IDC_STREAM,2,18,134,61,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "&...",IDC_OPTIONS,145,17,45,14 - AUTOCHECKBOX "& ",IDC_INTERLEAVE,3,42,60,11,WS_TABSTOP + PUSHBUTTON "П&араметри...",IDC_OPTIONS,145,17,45,14 + AUTOCHECKBOX "&Інтервал чергування",IDC_INTERLEAVE,3,42,60,11,WS_TABSTOP EDITTEXT IDC_INTERLEAVEEVERY,66,41,32,12,ES_AUTOHSCROLL - LTEXT "",-1,104,43,36,9 - LTEXT " :",-1,3,56,53,9 - LTEXT " ",IDC_FORMATTEXT,55,56,90,26 + LTEXT "кадрів",-1,104,43,36,9 + LTEXT "Поточний формат:",-1,3,56,53,9 + LTEXT "Це місце здається в оренду",IDC_FORMATTEXT,55,56,90,26 DEFPUSHBUTTON "OK",IDOK,145,42,45,14 - PUSHBUTTON "",IDCANCEL,145,61,45,14 + PUSHBUTTON "Скасувати",IDCANCEL,145,61,45,14 END STRINGTABLE { - IDS_WAVESTREAMFORMAT " : %s" - IDS_WAVEFILETYPE " " - IDS_ALLMULTIMEDIA " " - IDS_ALLFILES " (*.*)@*.*" - IDS_VIDEO "" - IDS_AUDIO "" + IDS_WAVESTREAMFORMAT "Звуковий потік: %s" + IDS_WAVEFILETYPE "Звуковий потік" + IDS_ALLMULTIMEDIA "Усі мультимедійні файли" + IDS_ALLFILES "Усі файли (*.*)@*.*" + IDS_VIDEO "відео" + IDS_AUDIO "аудіо" IDS_AVISTREAMFORMAT "%s %s #%d" - IDS_AVIFILETYPE "Wine AVI- " - IDS_UNCOMPRESSED " " + IDS_AVIFILETYPE "Wine обробник AVI-файлів за замовчуванням" + IDS_UNCOMPRESSED "без стиснення" } diff --git a/dll/win32/avifil32/rsrc.rc b/dll/win32/avifil32/rsrc.rc index c768c84fa6e..09e3f8afa2f 100644 --- a/dll/win32/avifil32/rsrc.rc +++ b/dll/win32/avifil32/rsrc.rc @@ -45,7 +45,6 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL #include "avifile_Pl.rc" #include "avifile_Sv.rc" #include "avifile_Tr.rc" -#include "avifile_Uk.rc" /* UTF-8 */ #include "avifile_Da.rc" @@ -58,5 +57,6 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL #include "avifile_Ro.rc" #include "avifile_Ru.rc" #include "avifile_Si.rc" +#include "avifile_Uk.rc" #include "avifile_Zh.rc" #include "avifile_Bg.rc" diff --git a/dll/win32/batt/resource.h b/dll/win32/batt/resource.h index d506679737b..3f16329ea9a 100644 --- a/dll/win32/batt/resource.h +++ b/dll/win32/batt/resource.h @@ -1 +1 @@ -#define IDI_BATTERY 2 \ No newline at end of file +#define IDI_BATTERY 2 diff --git a/dll/win32/beepmidi/beepmidi.c b/dll/win32/beepmidi/beepmidi.c index 6365d05e65c..cc8cfa19a88 100644 --- a/dll/win32/beepmidi/beepmidi.c +++ b/dll/win32/beepmidi/beepmidi.c @@ -41,9 +41,11 @@ #define CONTINUOUS_NOTES #define WIN32_NO_STATUS -#define NTOS_MODE_USER #include -#include +#define NTOS_MODE_USER +#include +#include +#include #include #include #include diff --git a/dll/win32/browseui/CMakeLists.txt b/dll/win32/browseui/CMakeLists.txt index 7b146884c4d..12d9899635b 100644 --- a/dll/win32/browseui/CMakeLists.txt +++ b/dll/win32/browseui/CMakeLists.txt @@ -6,6 +6,10 @@ add_definitions( -D__WINESRC__ -DROS_Headers) +if (MSVC) + add_compiler_flags(/EHa-) +endif() + remove_definitions(-D_WIN32_WINNT=0x502) add_definitions(-D_WIN32_WINNT=0x600) @@ -62,4 +66,5 @@ add_importlibs(browseui kernel32 ntdll) +add_pch(browseui precomp.h) add_cd_file(TARGET browseui DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/browseui/aclmulti.cpp b/dll/win32/browseui/aclmulti.cpp index c34fe5bf4fc..69df206b1a8 100644 --- a/dll/win32/browseui/aclmulti.cpp +++ b/dll/win32/browseui/aclmulti.cpp @@ -19,18 +19,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "resource.h" -#include "wine/debug.h" -#include "aclmulti.h" +#include "precomp.h" WINE_DEFAULT_DEBUG_CHANNEL(browseui); diff --git a/dll/win32/browseui/addressband.cpp b/dll/win32/browseui/addressband.cpp index 0010f5f2daf..9b9e744618a 100644 --- a/dll/win32/browseui/addressband.cpp +++ b/dll/win32/browseui/addressband.cpp @@ -21,17 +21,7 @@ /* Implements the navigation band of the cabinet window */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "resource.h" -#include "addressband.h" +#include "precomp.h" /* TODO: diff --git a/dll/win32/browseui/addresseditbox.cpp b/dll/win32/browseui/addresseditbox.cpp index 7d36ff3dfd7..2b96d4148f3 100644 --- a/dll/win32/browseui/addresseditbox.cpp +++ b/dll/win32/browseui/addresseditbox.cpp @@ -21,17 +21,7 @@ /* This class handles the combo box of the address band. */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "resource.h" -#include "addresseditbox.h" +#include "precomp.h" /* TODO: Add auto completion support diff --git a/dll/win32/browseui/bandproxy.cpp b/dll/win32/browseui/bandproxy.cpp index 1d75e436af4..3d14b646c45 100644 --- a/dll/win32/browseui/bandproxy.cpp +++ b/dll/win32/browseui/bandproxy.cpp @@ -24,19 +24,7 @@ Used by the address band to dispatch navigation changes to the main browser obje TODO: */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "resource.h" -#include "bandproxy.h" +#include "precomp.h" CBandProxy::CBandProxy() { diff --git a/dll/win32/browseui/bandsite.cpp b/dll/win32/browseui/bandsite.cpp index c3e2e6ad1a0..a751281c8be 100644 --- a/dll/win32/browseui/bandsite.cpp +++ b/dll/win32/browseui/bandsite.cpp @@ -19,18 +19,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "resource.h" -#include "wine/debug.h" -#include "bandsite.h" +#include "precomp.h" WINE_DEFAULT_DEBUG_CHANNEL(browseui); diff --git a/dll/win32/browseui/bandsitemenu.cpp b/dll/win32/browseui/bandsitemenu.cpp index fee02afb225..6258b03e587 100644 --- a/dll/win32/browseui/bandsitemenu.cpp +++ b/dll/win32/browseui/bandsitemenu.cpp @@ -19,18 +19,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "resource.h" -#include "bandsitemenu.h" -#include "wine/debug.h" +#include "precomp.h" WINE_DEFAULT_DEBUG_CHANNEL(browseui); diff --git a/dll/win32/browseui/basebar.cpp b/dll/win32/browseui/basebar.cpp index 1e4caaaa594..db7bed557f3 100644 --- a/dll/win32/browseui/basebar.cpp +++ b/dll/win32/browseui/basebar.cpp @@ -21,15 +21,7 @@ /* This class knows how to contain base bar site in a cabinet window. */ -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "precomp.h" /* Base bar that contains a vertical or horizontal explorer band. It also diff --git a/dll/win32/browseui/basebarsite.cpp b/dll/win32/browseui/basebarsite.cpp index 730c26dbd3e..08498c09ed0 100644 --- a/dll/win32/browseui/basebarsite.cpp +++ b/dll/win32/browseui/basebarsite.cpp @@ -22,15 +22,7 @@ Base bar that contains a vertical or horizontal explorer band. It also provides resizing abilities. */ -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "precomp.h" /* TODO: diff --git a/dll/win32/browseui/brandband.cpp b/dll/win32/browseui/brandband.cpp index a33eb7ca563..892a8fe7ab8 100644 --- a/dll/win32/browseui/brandband.cpp +++ b/dll/win32/browseui/brandband.cpp @@ -22,19 +22,7 @@ Implements the logo band of a cabinet window. Most remarkable feature is the animation. */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "resource.h" -#include "brandband.h" +#include "precomp.h" /* TODO: diff --git a/dll/win32/browseui/browseui.cpp b/dll/win32/browseui/browseui.cpp index cea61760b90..752a5726889 100644 --- a/dll/win32/browseui/browseui.cpp +++ b/dll/win32/browseui/browseui.cpp @@ -18,26 +18,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "resource.h" -#include "aclmulti.h" -#include "addressband.h" -#include "addresseditbox.h" -#include "bandproxy.h" -#include "bandsite.h" -#include "bandsitemenu.h" -#include "brandband.h" -#include "internettoolbar.h" +#include "precomp.h" WINE_DEFAULT_DEBUG_CHANNEL(browseui); diff --git a/dll/win32/browseui/browseui.rbuild b/dll/win32/browseui/browseui.rbuild index 63415e6f93e..cafad1fb26e 100644 --- a/dll/win32/browseui/browseui.rbuild +++ b/dll/win32/browseui/browseui.rbuild @@ -45,4 +45,5 @@ utility.cpp dllinstall.c browseui.rc + precomp.h diff --git a/dll/win32/browseui/browseui.rc b/dll/win32/browseui/browseui.rc index 1dfde6d4c0d..d4223bec0c4 100644 --- a/dll/win32/browseui/browseui.rc +++ b/dll/win32/browseui/browseui.rc @@ -63,7 +63,6 @@ IDR_REGTREEOPTIONS REGISTRY "res/regtreeoptions.rgs" //#include "lang/ko-KR.rc" //#include "lang/nl-NL.rc" //#include "lang/no-NO.rc" -//#include "lang/pl-PL.rc" //#include "lang/pt-BR.rc" //#include "lang/pt-PT.rc" //#include "lang/ro-RO.rc" @@ -72,9 +71,10 @@ IDR_REGTREEOPTIONS REGISTRY "res/regtreeoptions.rgs" //#include "lang/sk-SK.rc" //#include "lang/sv-SE.rc" //#include "lang/tr-TR.rc" -#include "lang/uk-UA.rc" //#include "lang/zh-CN.rc" //#include "lang/zh-TW.rc" /* UTF-8 */ #include "lang/bg-BG.rc" +#include "lang/pl-PL.rc" +#include "lang/uk-UA.rc" diff --git a/dll/win32/browseui/browseuiord.cpp b/dll/win32/browseui/browseuiord.cpp index 7f3ac3b3c79..cbbe93547ae 100644 --- a/dll/win32/browseui/browseuiord.cpp +++ b/dll/win32/browseui/browseuiord.cpp @@ -18,12 +18,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include -#include -#include -#include -#include +#include "precomp.h" extern DWORD WINAPI BrowserThreadProc(LPVOID lpThreadParameter); diff --git a/dll/win32/browseui/commonbrowser.cpp b/dll/win32/browseui/commonbrowser.cpp index 87e4b7b8a04..5543e5924a2 100644 --- a/dll/win32/browseui/commonbrowser.cpp +++ b/dll/win32/browseui/commonbrowser.cpp @@ -18,19 +18,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "resource.h" -#include "commonbrowser.h" +#include "precomp.h" CCommonBrowser::CCommonBrowser() { diff --git a/dll/win32/browseui/globalfoldersettings.cpp b/dll/win32/browseui/globalfoldersettings.cpp index 73ef09345d6..e042aa2d2c1 100644 --- a/dll/win32/browseui/globalfoldersettings.cpp +++ b/dll/win32/browseui/globalfoldersettings.cpp @@ -18,19 +18,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "resource.h" -#include "globalfoldersettings.h" +#include "precomp.h" CGlobalFolderSettings::CGlobalFolderSettings() { diff --git a/dll/win32/browseui/internettoolbar.cpp b/dll/win32/browseui/internettoolbar.cpp index bfad8a5bd9c..d0e69944b6c 100644 --- a/dll/win32/browseui/internettoolbar.cpp +++ b/dll/win32/browseui/internettoolbar.cpp @@ -22,20 +22,7 @@ Implements a class that knows how to hold and manage the menu band, brand band, toolbar, and address band for an explorer window */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "resource.h" -#include "internettoolbar.h" +#include "precomp.h" // navigation controls and menubar just send a message to parent window /* diff --git a/dll/win32/browseui/lang/bg-BG.rc b/dll/win32/browseui/lang/bg-BG.rc index ba762f9a089..7cab11cfb5e 100644 --- a/dll/win32/browseui/lang/bg-BG.rc +++ b/dll/win32/browseui/lang/bg-BG.rc @@ -16,9 +16,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -/* UTF-8 */ -#pragma code_page(65001) - LANGUAGE LANG_BULGARIAN, SUBLANG_DEFAULT ///////////////////////////////////////////////////////////////////////////// @@ -26,14 +23,14 @@ LANGUAGE LANG_BULGARIAN, SUBLANG_DEFAULT // Menus // -IDM_CABINET_CONTEXTMENU MENUEX +IDM_CABINET_CONTEXTMENU MENUEX BEGIN POPUP "", 264,MFT_STRING,MFS_ENABLED BEGIN MENUITEM "&Обичайни бутони", IDM_TOOLBARS_STANDARDBUTTONS,MFT_STRING,MFS_ENABLED MENUITEM "&Адресна лента", IDM_TOOLBARS_ADDRESSBAR,MFT_STRING,MFS_ENABLED MENUITEM "&Връзки", IDM_TOOLBARS_LINKSBAR,MFT_STRING,MFS_ENABLED - MENUITEM SEPARATOR + MENUITEM "", -1, MFT_SEPARATOR MENUITEM "Заключване на лентите с &пособия", IDM_TOOLBARS_LOCKTOOLBARS,MFT_STRING,MFS_ENABLED MENUITEM "&Нагласяване...", IDM_TOOLBARS_CUSTOMIZE,MFT_STRING,MFS_ENABLED MENUITEM "&Текстови етикети", IDM_TOOLBARS_TEXTLABELS,MFT_STRING,MFS_ENABLED @@ -123,7 +120,7 @@ END // Accelerator // -IDR_ACCELERATORS ACCELERATORS +IDR_ACCELERATORS ACCELERATORS BEGIN VK_F5, IDM_VIEW_REFRESH, VIRTKEY, NOINVERT VK_F5, IDM_VIEW_REFRESH, VIRTKEY, CONTROL, NOINVERT @@ -145,50 +142,50 @@ END // Strings // -STRINGTABLE +STRINGTABLE BEGIN 800 "Съдържа заповеди за обработка на избраните предмети." END -STRINGTABLE +STRINGTABLE BEGIN 864 "Съдържа заповеди за обработка." END -STRINGTABLE +STRINGTABLE BEGIN 928 "Съдържа заповеди за обработка на изгледа." END -STRINGTABLE +STRINGTABLE BEGIN 992 "Съдържа заповеди за пособията." END -STRINGTABLE +STRINGTABLE BEGIN 1056 "Съсържа заповеди за показване на помощ." END -STRINGTABLE +STRINGTABLE BEGIN 9025 "Затваря прозореца." 9026 "Отива равнище нагоре." END -STRINGTABLE +STRINGTABLE BEGIN 9121 "Свърване към мрежово устройство." 9122 "Разкачане от мрежово устройство." END -STRINGTABLE +STRINGTABLE BEGIN 9250 "Показва сведения за програмата, версия и възпроизводствени права." 9252 "Показва сведения за проследяване на недъзи." END -STRINGTABLE +STRINGTABLE BEGIN 9281 "Отива на предходната страница." 9282 "Отива на следващата страница." @@ -196,13 +193,13 @@ BEGIN 9285 "Отива в началната ви страница." END -STRINGTABLE +STRINGTABLE BEGIN 9362 "Отваря папката с любимките." 9363 "Добавя текущата страница към списъка с любимките." END -STRINGTABLE +STRINGTABLE BEGIN 9505 "Скрива или показва лентите с пособия." 9506 "Скрива или показва лентата на състоянието." @@ -212,12 +209,12 @@ BEGIN 9516 "Заключване на размерите и разположението на лентите с пособия." END -STRINGTABLE +STRINGTABLE BEGIN 9533 "Нагласяване на лентата с пособия." END -STRINGTABLE +STRINGTABLE BEGIN 9552 "Показване или скриване на лентата на изследователя." 9553 "Показване на лентата за търсене." @@ -227,50 +224,48 @@ BEGIN 9559 "Показване на медийната лента." END -STRINGTABLE +STRINGTABLE BEGIN IDS_SMALLICONS "Малки значета" IDS_LARGEICONS "Големи значета" IDS_SHOWTEXTLABELS "Показване на текстови етикети" END -STRINGTABLE +STRINGTABLE BEGIN IDS_NOTEXTLABELS "Липсват текстови етикети" IDS_SELECTIVETEXTONRIGHT "Selective text on right" END -STRINGTABLE +STRINGTABLE BEGIN IDS_GOBUTTONLABEL "|Отиване||" IDS_GOBUTTONTIPTEMPLATE "Отиване в""%s""" END -STRINGTABLE +STRINGTABLE BEGIN IDS_SEARCHLABEL "Търсене" IDS_ADDRESSBANDLABEL "&Адрес" END -STRINGTABLE +STRINGTABLE BEGIN IDS_FOLDERSLABEL "Папки" END -STRINGTABLE +STRINGTABLE BEGIN IDS_HISTORYTEXT "&Дневник\tCtrl+H" END -STRINGTABLE +STRINGTABLE BEGIN IDS_UP "Нагоре" END -STRINGTABLE +STRINGTABLE BEGIN IDS_BACK "Назад" IDS_FORWARD "Напред" END - - diff --git a/dll/win32/browseui/lang/en-US.rc b/dll/win32/browseui/lang/en-US.rc index 03696ad3656..edf5ca42bd7 100644 --- a/dll/win32/browseui/lang/en-US.rc +++ b/dll/win32/browseui/lang/en-US.rc @@ -23,14 +23,14 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // Menus // -IDM_CABINET_CONTEXTMENU MENUEX +IDM_CABINET_CONTEXTMENU MENUEX BEGIN POPUP "", 264,MFT_STRING,MFS_ENABLED BEGIN MENUITEM "&Standard Buttons", IDM_TOOLBARS_STANDARDBUTTONS,MFT_STRING,MFS_ENABLED MENUITEM "&Address Bar", IDM_TOOLBARS_ADDRESSBAR,MFT_STRING,MFS_ENABLED MENUITEM "&Links", IDM_TOOLBARS_LINKSBAR,MFT_STRING,MFS_ENABLED - MENUITEM SEPARATOR + MENUITEM "", -1, MFT_SEPARATOR MENUITEM "Lock the Tool&bars", IDM_TOOLBARS_LOCKTOOLBARS,MFT_STRING,MFS_ENABLED MENUITEM "&Customize...", IDM_TOOLBARS_CUSTOMIZE,MFT_STRING,MFS_ENABLED MENUITEM "&Text Labels", IDM_TOOLBARS_TEXTLABELS,MFT_STRING,MFS_ENABLED @@ -120,7 +120,7 @@ END // Accelerator // -IDR_ACCELERATORS ACCELERATORS +IDR_ACCELERATORS ACCELERATORS BEGIN VK_F5, IDM_VIEW_REFRESH, VIRTKEY, NOINVERT VK_F5, IDM_VIEW_REFRESH, VIRTKEY, CONTROL, NOINVERT @@ -142,50 +142,50 @@ END // Strings // -STRINGTABLE +STRINGTABLE BEGIN 800 "Contains commands for manipulating the selected items." END -STRINGTABLE +STRINGTABLE BEGIN 864 "Contains edit commands." END -STRINGTABLE +STRINGTABLE BEGIN 928 "Contains commands for manipulating the view." END -STRINGTABLE +STRINGTABLE BEGIN 992 "Contains tools commands." END -STRINGTABLE +STRINGTABLE BEGIN 1056 "Contains commands for displaying Help." END -STRINGTABLE +STRINGTABLE BEGIN 9025 "Closes the window." 9026 "Goes up one level." END -STRINGTABLE +STRINGTABLE BEGIN 9121 "Connects to a network drive." 9122 "Disconnects from a network drive." END -STRINGTABLE +STRINGTABLE BEGIN 9250 "Displays program information, version number, and copyright." 9252 "Displays information for debugging." END -STRINGTABLE +STRINGTABLE BEGIN 9281 "Goes to the previous page." 9282 "Goes to the next page." @@ -193,13 +193,13 @@ BEGIN 9285 "Goes to your home page." END -STRINGTABLE +STRINGTABLE BEGIN 9362 "Opens the Favorites folder." 9363 "Adds the current page to your Favorites list." END -STRINGTABLE +STRINGTABLE BEGIN 9505 "Shows or hides toolbars." 9506 "Shows or hides the status bar." @@ -209,12 +209,12 @@ BEGIN 9516 "Locks the sizes and positions of the toolbars." END -STRINGTABLE +STRINGTABLE BEGIN 9533 "Customizes the toolbar." END -STRINGTABLE +STRINGTABLE BEGIN 9552 "Shows or hides an Explorer bar." 9553 "Shows the Search bar." @@ -224,47 +224,47 @@ BEGIN 9559 "Shows the Media Bar." END -STRINGTABLE +STRINGTABLE BEGIN IDS_SMALLICONS "Small icons" IDS_LARGEICONS "Large icons" IDS_SHOWTEXTLABELS "Show text labels" END -STRINGTABLE +STRINGTABLE BEGIN IDS_NOTEXTLABELS "No text labels" IDS_SELECTIVETEXTONRIGHT "Selective text on right" END -STRINGTABLE +STRINGTABLE BEGIN IDS_GOBUTTONLABEL "|Go||" IDS_GOBUTTONTIPTEMPLATE "Go to ""%s""" END -STRINGTABLE +STRINGTABLE BEGIN IDS_SEARCHLABEL "Search" IDS_ADDRESSBANDLABEL "A&ddress" END -STRINGTABLE +STRINGTABLE BEGIN IDS_FOLDERSLABEL "Folders" END -STRINGTABLE +STRINGTABLE BEGIN IDS_HISTORYTEXT "&History\tCtrl+H" END -STRINGTABLE +STRINGTABLE BEGIN IDS_UP "Up" END -STRINGTABLE +STRINGTABLE BEGIN IDS_BACK "Back" IDS_FORWARD "Forward" diff --git a/dll/win32/browseui/lang/es-ES.rc b/dll/win32/browseui/lang/es-ES.rc index 7071ef224d3..a989034ce61 100644 --- a/dll/win32/browseui/lang/es-ES.rc +++ b/dll/win32/browseui/lang/es-ES.rc @@ -23,14 +23,14 @@ LANGUAGE LANG_SPANISH, SUBLANG_NEUTRAL // Menus // -IDM_CABINET_CONTEXTMENU MENUEX +IDM_CABINET_CONTEXTMENU MENUEX BEGIN POPUP "", 264,MFT_STRING,MFS_ENABLED BEGIN MENUITEM "Botones e&stndar", IDM_TOOLBARS_STANDARDBUTTONS,MFT_STRING,MFS_ENABLED MENUITEM "&Barra de direcciones", IDM_TOOLBARS_ADDRESSBAR,MFT_STRING,MFS_ENABLED MENUITEM "&Vnculos", IDM_TOOLBARS_LINKSBAR,MFT_STRING,MFS_ENABLED - MENUITEM SEPARATOR + MENUITEM "", -1, MFT_SEPARATOR MENUITEM "Bloquear las barras de &herramientas", IDM_TOOLBARS_LOCKTOOLBARS,MFT_STRING,MFS_ENABLED MENUITEM "&Personalizar...", IDM_TOOLBARS_CUSTOMIZE,MFT_STRING,MFS_ENABLED MENUITEM "&Etiquetas", IDM_TOOLBARS_TEXTLABELS,MFT_STRING,MFS_ENABLED @@ -120,7 +120,7 @@ END // Accelerator // -IDR_ACCELERATORS ACCELERATORS +IDR_ACCELERATORS ACCELERATORS BEGIN VK_F5, IDM_VIEW_REFRESH, VIRTKEY, NOINVERT VK_F5, IDM_VIEW_REFRESH, VIRTKEY, CONTROL, NOINVERT @@ -142,50 +142,50 @@ END // Strings // -STRINGTABLE +STRINGTABLE BEGIN 800 "Contiene comandos para trabajar con los elementos seleccionados." END -STRINGTABLE +STRINGTABLE BEGIN 864 "Contiene comandos de edicin." END -STRINGTABLE +STRINGTABLE BEGIN 928 "Contiene comandos para manipular la vista." END -STRINGTABLE +STRINGTABLE BEGIN 992 "Contiene comandos de herramientas." END -STRINGTABLE +STRINGTABLE BEGIN 1056 "Contiene comandos para mostrar la Ayuda." END -STRINGTABLE +STRINGTABLE BEGIN 9025 "Cierra la ventana." 9026 "Sube un nivel." END -STRINGTABLE +STRINGTABLE BEGIN 9121 "Conecta a unidad de red." 9122 "Desconecta de unidad de red." END -STRINGTABLE +STRINGTABLE BEGIN 9250 "Muestra informacin sobre el programa, nmero de versin y copyright." 9252 "Muestra informacin para debugging." END -STRINGTABLE +STRINGTABLE BEGIN 9281 "Va a la pgina previa." 9282 "Va a la prxima pgina." @@ -193,13 +193,13 @@ BEGIN 9285 "Va a pgina de inicio." END -STRINGTABLE +STRINGTABLE BEGIN 9362 "Abre la carpeta Organizar Favoritos." 9363 "Aade la pgina actual a la lista de Favoritos." END -STRINGTABLE +STRINGTABLE BEGIN 9505 "Muestra u oculta las barras de herramientas." 9506 "Muestra u oculta la barra de estado." @@ -209,12 +209,12 @@ BEGIN 9516 "Bloquear el tamao y la posicin de las barras de herramientas." END -STRINGTABLE +STRINGTABLE BEGIN 9533 "Personalizar la barra de herramientas." END -STRINGTABLE +STRINGTABLE BEGIN 9552 "Muestra u oculta una de las barras del explorador." 9553 "Muestra la barra de bsqueda." @@ -224,47 +224,47 @@ BEGIN 9559 "Muestra la barra de media." END -STRINGTABLE +STRINGTABLE BEGIN IDS_SMALLICONS "Iconos pequeos" IDS_LARGEICONS "Iconos grandes" IDS_SHOWTEXTLABELS "Muestra etiquetas de texto" END -STRINGTABLE +STRINGTABLE BEGIN IDS_NOTEXTLABELS "Sin etiquetas de texto" IDS_SELECTIVETEXTONRIGHT "Selecciona el texto a la derecha" END -STRINGTABLE +STRINGTABLE BEGIN IDS_GOBUTTONLABEL "|Ir||" IDS_GOBUTTONTIPTEMPLATE "Ir a ""%s""" END -STRINGTABLE +STRINGTABLE BEGIN IDS_SEARCHLABEL "Bsqueda" IDS_ADDRESSBANDLABEL "Dire&ccin" END -STRINGTABLE +STRINGTABLE BEGIN IDS_FOLDERSLABEL "Carpetas" END -STRINGTABLE +STRINGTABLE BEGIN IDS_HISTORYTEXT "&Historial\tCtrl+H" END -STRINGTABLE +STRINGTABLE BEGIN IDS_UP "Arriba" END -STRINGTABLE +STRINGTABLE BEGIN IDS_BACK "Atrs" IDS_FORWARD "Adelante" diff --git a/dll/win32/browseui/lang/pl-PL.rc b/dll/win32/browseui/lang/pl-PL.rc new file mode 100644 index 00000000000..a732589e1a8 --- /dev/null +++ b/dll/win32/browseui/lang/pl-PL.rc @@ -0,0 +1,277 @@ +/* + * 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 + * + * translated by Caemyr - Olaf Siejka (May, 2011) + * Use ReactOS forum PM or IRC to contact me + * http://www.reactos.org + * IRC: irc.freenode.net #reactos-pl; + * UTF-8 conversion by Caemyr (May, 2011) + */ + +LANGUAGE LANG_POLISH, SUBLANG_DEFAULT + +///////////////////////////////////////////////////////////////////////////// +// +// Menus +// + +IDM_CABINET_CONTEXTMENU MENUEX +BEGIN + POPUP "", 264,MFT_STRING,MFS_ENABLED + BEGIN + MENUITEM "&Przyciski standardowe", IDM_TOOLBARS_STANDARDBUTTONS,MFT_STRING,MFS_ENABLED + MENUITEM "Pasek &Adresu", IDM_TOOLBARS_ADDRESSBAR,MFT_STRING,MFS_ENABLED + MENUITEM "&Odnośniki", IDM_TOOLBARS_LINKSBAR,MFT_STRING,MFS_ENABLED + MENUITEM "", -1, MFT_SEPARATOR + MENUITEM "&Zablokuj paski narzędzi", IDM_TOOLBARS_LOCKTOOLBARS,MFT_STRING,MFS_ENABLED + MENUITEM "&Dostosuj...", IDM_TOOLBARS_CUSTOMIZE,MFT_STRING,MFS_ENABLED + MENUITEM "&Etykiety", IDM_TOOLBARS_TEXTLABELS,MFT_STRING,MFS_ENABLED + MENUITEM "&Idź do", IDM_TOOLBARS_GOBUTTON,MFT_STRING,MFS_ENABLED + END +END + +IDM_CABINET_MAINMENU MENUEX +BEGIN + POPUP "&Plik", FCIDM_MENU_FILE + BEGIN + MENUITEM "", -1, MFT_SEPARATOR + MENUITEM "&Zamknij", IDM_FILE_CLOSE + END + POPUP "&Edytuj", FCIDM_MENU_EDIT + BEGIN + MENUITEM "", -1, MFT_SEPARATOR + END + POPUP "&Widok", FCIDM_MENU_VIEW + BEGIN + POPUP "Paski &Narzędzi", IDM_VIEW_TOOLBARS + BEGIN + MENUITEM "", -1, MFT_SEPARATOR + END + MENUITEM "Pasek &Stanu", IDM_VIEW_STATUSBAR + POPUP "Pasek &Exploratora", IDM_VIEW_EXPLORERBAR + BEGIN + MENUITEM "W&yszukaj\tCtrl+E", IDM_EXPLORERBAR_SEARCH + MENUITEM "&Ulubione\tCtrl+I", IDM_EXPLORERBAR_FAVORITES + MENUITEM "&Media", IDM_EXPLORERBAR_MEDIA + MENUITEM "&Historia\tCtrl+H", IDM_EXPLORERBAR_HISTORY + MENUITEM "&Katalogi", IDM_EXPLORERBAR_FOLDERS + MENUITEM "", IDM_EXPLORERBAR_SEPARATOR + END + MENUITEM "", FCIDM_MENU_VIEW_SEP_OPTIONS, MFT_SEPARATOR + POPUP "&Idź do", FCIDM_MENU_EXPLORE + BEGIN + MENUITEM "&Wstecz\tAlt+Left Arrow", IDM_GOTO_BACK + MENUITEM "&Naprzód\tAlt+Right Arrow", IDM_GOTO_FORWARD + MENUITEM "W &górę", IDM_GOTO_UPONELEVEL + MENUITEM "", -1, MFT_SEPARATOR + MENUITEM "&Strona Domowa\tAlt+Home", IDM_GOTO_HOMEPAGE + END + MENUITEM "&Odśwież", IDM_VIEW_REFRESH + END + POPUP "&Ulubione", FCIDM_MENU_FAVORITES + BEGIN + MENUITEM "&Dodaj do Ulubionych...", IDM_FAVORITES_ADDTOFAVORITES + MENUITEM "&Organizuj Ulubione...", IDM_FAVORITES_ORGANIZEFAVORITES + MENUITEM "", -1, MFT_SEPARATOR + MENUITEM "(Pusty)", IDM_FAVORITES_EMPTY + END + POPUP "&Narzędzia", FCIDM_MENU_TOOLS + BEGIN + MENUITEM "Mapuj &Dysk Sieciowy...", IDM_TOOLS_MAPNETWORKDRIVE + MENUITEM "&Odłącz Dysk Sieciowy...", IDM_TOOLS_DISCONNECTNETWORKDRIVE + MENUITEM "&Synchronizuj...", IDM_TOOLS_SYNCHRONIZE + MENUITEM "", -1, MFT_SEPARATOR + MENUITEM "&Opcje Katalogów...", IDM_TOOLS_FOLDEROPTIONS + END + POPUP "&Pomoc", FCIDM_MENU_HELP + BEGIN + MENUITEM "Czy ta kopia ReactOS jest &legalna?", IDM_HELP_ISTHISCOPYLEGAL + MENUITEM "&O 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 "Opcje Te&kstu:",-1,4,2,48,15 + COMBOBOX IDC_TEXTOPTIONS,52,0,123,57,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "Opcje Iko&n:",-1,4,20,48,15 + COMBOBOX IDC_ICONOPTIONS,52,18,123,57,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Accelerator +// + +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 "Zawiera polecenia do manipulowania wybranymi elementami." +END + +STRINGTABLE +BEGIN + 864 "Zawiera polecenia do edycji." +END + +STRINGTABLE +BEGIN + 928 "Zawiera polecenia do zmiany widoku." +END + +STRINGTABLE +BEGIN + 992 "Zawiera polecenia dla narzędzi." +END + +STRINGTABLE +BEGIN + 1056 "Zawiera polecenia do wyświetlania pomocy." +END + +STRINGTABLE +BEGIN + 9025 "Zamyka okno." + 9026 "Przechodzi o poziom wyżej." +END + +STRINGTABLE +BEGIN + 9121 "Podłącza dysk sieciowy." + 9122 "Odłącza dysk sieciowy." +END + +STRINGTABLE +BEGIN + 9250 "Wyświetla informacje o programie, jego wersję i licencję." + 9252 "Wyświetla informacje do debugowania." +END + +STRINGTABLE +BEGIN + 9281 "Przechodzi na poprzednią stronę." + 9282 "Przechodzi na następną stronę." + 9283 "Umożliwia zmianę ustawień." + 9285 "Przechodzi na stronę domową." +END + +STRINGTABLE +BEGIN + 9362 "Otwiera katalog Ulubionych." + 9363 "Dodaje bierzącą stronę do listy ulubionych." +END + +STRINGTABLE +BEGIN + 9505 "Pokazuje lub ukrywa paski narzędzi." + 9506 "Pokazuje lub ukrywa pasek stanu." + 9508 "Pokazuje pasek z Przyciskami Standardowymi." + 9509 "Pokazuje Pasek Adresu." + 9510 "Pokazuje pasek z Podręcznymi Odnośnikami." + 9516 "Blokuje położenie i rozmiar pasków." +END + +STRINGTABLE +BEGIN + 9533 "Dostosowuje wybrane paski." +END + +STRINGTABLE +BEGIN + 9552 "Pokazuje lub ukrywa Pasek Eksploratora." + 9553 "Pokazuje pasek Wyszukiwania." + 9554 "Pokazuje pasek Ulubionych." + 9555 "Pokazuje pasek Historii." + 9557 "Pokazuje pasek Katalogów." + 9559 "Pokazuje pasek Multimediów." +END + +STRINGTABLE +BEGIN + IDS_SMALLICONS "Małe ikony" + IDS_LARGEICONS "Duże ikony" + IDS_SHOWTEXTLABELS "Pokaż etykiety" +END + +STRINGTABLE +BEGIN + IDS_NOTEXTLABELS "Brak etykiet" + IDS_SELECTIVETEXTONRIGHT "Tekst do zaznaczenia po prawej" +END + +STRINGTABLE +BEGIN + IDS_GOBUTTONLABEL "|Idź||" + IDS_GOBUTTONTIPTEMPLATE "Idź do ""%s""" +END + +STRINGTABLE +BEGIN + IDS_SEARCHLABEL "Wyszukaj" + IDS_ADDRESSBANDLABEL "A&dres" +END + +STRINGTABLE +BEGIN + IDS_FOLDERSLABEL "Katalogi" +END + +STRINGTABLE +BEGIN + IDS_HISTORYTEXT "&Historia\tCtrl+H" +END + +STRINGTABLE +BEGIN + IDS_UP "W górę" +END + +STRINGTABLE +BEGIN + IDS_BACK "Wstecz" + IDS_FORWARD "Naprzód" +END diff --git a/dll/win32/browseui/lang/uk-UA.rc b/dll/win32/browseui/lang/uk-UA.rc index 42ad1d1cc9d..ba17373f80f 100644 --- a/dll/win32/browseui/lang/uk-UA.rc +++ b/dll/win32/browseui/lang/uk-UA.rc @@ -25,78 +25,78 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT // Menus // -IDM_CABINET_CONTEXTMENU MENUEX +IDM_CABINET_CONTEXTMENU MENUEX BEGIN POPUP "", 264,MFT_STRING,MFS_ENABLED BEGIN - MENUITEM "& ", IDM_TOOLBARS_STANDARDBUTTONS,MFT_STRING,MFS_ENABLED - MENUITEM "& ", IDM_TOOLBARS_ADDRESSBAR,MFT_STRING,MFS_ENABLED - MENUITEM "&", IDM_TOOLBARS_LINKSBAR,MFT_STRING,MFS_ENABLED - MENUITEM SEPARATOR - MENUITEM " ", IDM_TOOLBARS_LOCKTOOLBARS,MFT_STRING,MFS_ENABLED - MENUITEM "&...", IDM_TOOLBARS_CUSTOMIZE,MFT_STRING,MFS_ENABLED - MENUITEM "& ", IDM_TOOLBARS_TEXTLABELS,MFT_STRING,MFS_ENABLED - MENUITEM "& ", IDM_TOOLBARS_GOBUTTON,MFT_STRING,MFS_ENABLED + MENUITEM "&Стандартні Кнопки", IDM_TOOLBARS_STANDARDBUTTONS,MFT_STRING,MFS_ENABLED + MENUITEM "&Рядок Адреси", IDM_TOOLBARS_ADDRESSBAR,MFT_STRING,MFS_ENABLED + MENUITEM "&Посилання", IDM_TOOLBARS_LINKSBAR,MFT_STRING,MFS_ENABLED + MENUITEM "", -1, MFT_SEPARATOR + MENUITEM "Блокування панелей інструментів", IDM_TOOLBARS_LOCKTOOLBARS,MFT_STRING,MFS_ENABLED + MENUITEM "&Налаштувати...", IDM_TOOLBARS_CUSTOMIZE,MFT_STRING,MFS_ENABLED + MENUITEM "&Текстові мітки", IDM_TOOLBARS_TEXTLABELS,MFT_STRING,MFS_ENABLED + MENUITEM "&Кнопка Йти", IDM_TOOLBARS_GOBUTTON,MFT_STRING,MFS_ENABLED END END IDM_CABINET_MAINMENU MENUEX BEGIN - POPUP "&", FCIDM_MENU_FILE + POPUP "&Файл", FCIDM_MENU_FILE BEGIN MENUITEM "", -1, MFT_SEPARATOR - MENUITEM "&", IDM_FILE_CLOSE + MENUITEM "&Закрити", IDM_FILE_CLOSE END - POPUP "&", FCIDM_MENU_EDIT + POPUP "&Редагувати", FCIDM_MENU_EDIT BEGIN MENUITEM "", -1, MFT_SEPARATOR END - POPUP "&", FCIDM_MENU_VIEW + POPUP "&Вигляд", FCIDM_MENU_VIEW BEGIN - POPUP "& ", IDM_VIEW_TOOLBARS + POPUP "&Панелі інструментів", IDM_VIEW_TOOLBARS BEGIN MENUITEM "", -1, MFT_SEPARATOR END - MENUITEM " &", IDM_VIEW_STATUSBAR - POPUP "& ", IDM_VIEW_EXPLORERBAR + MENUITEM "Рядок &Стану", IDM_VIEW_STATUSBAR + POPUP "&Панель Провідника", IDM_VIEW_EXPLORERBAR BEGIN - MENUITEM "&\tCtrl+E", IDM_EXPLORERBAR_SEARCH - MENUITEM "&\tCtrl+I", IDM_EXPLORERBAR_FAVORITES - MENUITEM "&", IDM_EXPLORERBAR_MEDIA - MENUITEM "&\tCtrl+H", IDM_EXPLORERBAR_HISTORY - MENUITEM "&", IDM_EXPLORERBAR_FOLDERS + MENUITEM "&Пошук\tCtrl+E", IDM_EXPLORERBAR_SEARCH + MENUITEM "&Обране\tCtrl+I", IDM_EXPLORERBAR_FAVORITES + MENUITEM "&Медіа", IDM_EXPLORERBAR_MEDIA + MENUITEM "&Історія\tCtrl+H", IDM_EXPLORERBAR_HISTORY + MENUITEM "П&апки", IDM_EXPLORERBAR_FOLDERS MENUITEM "", IDM_EXPLORERBAR_SEPARATOR END MENUITEM "", FCIDM_MENU_VIEW_SEP_OPTIONS, MFT_SEPARATOR - POPUP "& ", FCIDM_MENU_EXPLORE + POPUP "Й&ти До", FCIDM_MENU_EXPLORE BEGIN - MENUITEM "&\tAlt+˳ ", IDM_GOTO_BACK - MENUITEM "&\tAlt+ ", IDM_GOTO_FORWARD - MENUITEM "& ", IDM_GOTO_UPONELEVEL + MENUITEM "&Назад\tAlt+Ліва Стрілка", IDM_GOTO_BACK + MENUITEM "&Вперед\tAlt+Права Стрілка", IDM_GOTO_FORWARD + MENUITEM "Вве&рх на один рівень", IDM_GOTO_UPONELEVEL MENUITEM "", -1, MFT_SEPARATOR - MENUITEM "& \tAlt+Home", IDM_GOTO_HOMEPAGE + MENUITEM "&Домашня Сторінка\tAlt+Home", IDM_GOTO_HOMEPAGE END - MENUITEM "&", IDM_VIEW_REFRESH + MENUITEM "&Оновити", IDM_VIEW_REFRESH END - POPUP "&", FCIDM_MENU_FAVORITES + POPUP "О&бране", FCIDM_MENU_FAVORITES BEGIN - MENUITEM "& ...", IDM_FAVORITES_ADDTOFAVORITES - MENUITEM "& ...", IDM_FAVORITES_ORGANIZEFAVORITES + MENUITEM "&Додати до Обраного...", IDM_FAVORITES_ADDTOFAVORITES + MENUITEM "&Організувати Обране...", IDM_FAVORITES_ORGANIZEFAVORITES MENUITEM "", -1, MFT_SEPARATOR MENUITEM "(Empty)", IDM_FAVORITES_EMPTY END - POPUP "&", FCIDM_MENU_TOOLS + POPUP "&Інструменти", FCIDM_MENU_TOOLS BEGIN - MENUITEM "ϳ' & ...", IDM_TOOLS_MAPNETWORKDRIVE - MENUITEM "&³' ...", IDM_TOOLS_DISCONNECTNETWORKDRIVE - MENUITEM "&...", IDM_TOOLS_SYNCHRONIZE + MENUITEM "Під'єднати &Мережевий Диск...", IDM_TOOLS_MAPNETWORKDRIVE + MENUITEM "&Від'єднати Мержевий Диск...", IDM_TOOLS_DISCONNECTNETWORKDRIVE + MENUITEM "&Синхронізувати...", IDM_TOOLS_SYNCHRONIZE MENUITEM "", -1, MFT_SEPARATOR - MENUITEM "& ...", IDM_TOOLS_FOLDEROPTIONS + MENUITEM "&Опції Папки...", IDM_TOOLS_FOLDEROPTIONS END - POPUP "&", FCIDM_MENU_HELP + POPUP "&Допомога", FCIDM_MENU_HELP BEGIN - MENUITEM " ReactOS &?", IDM_HELP_ISTHISCOPYLEGAL - MENUITEM "& ReactOS", IDM_HELP_ABOUT + MENUITEM "Ця копія ReactOS &законна?", IDM_HELP_ISTHISCOPYLEGAL + MENUITEM "&Про ReactOS", IDM_HELP_ABOUT END END @@ -110,9 +110,9 @@ 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 " &:",-1,4,2,48,15 + LTEXT "Опції &тексту:",-1,4,2,48,15 COMBOBOX IDC_TEXTOPTIONS,52,0,123,57,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT " &:",-1,4,20,48,15 + LTEXT "Опції &значків:",-1,4,20,48,15 COMBOBOX IDC_ICONOPTIONS,52,18,123,57,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP END @@ -122,7 +122,7 @@ END // Accelerator // -IDR_ACCELERATORS ACCELERATORS +IDR_ACCELERATORS ACCELERATORS BEGIN VK_F5, IDM_VIEW_REFRESH, VIRTKEY, NOINVERT VK_F5, IDM_VIEW_REFRESH, VIRTKEY, CONTROL, NOINVERT @@ -144,132 +144,132 @@ END // Strings // -STRINGTABLE +STRINGTABLE BEGIN - 800 "̳ '." + 800 "Містить команди маніпулювання вибраними об'єктами." END -STRINGTABLE +STRINGTABLE BEGIN - 864 "̳ ." + 864 "Містить команди правки." END -STRINGTABLE +STRINGTABLE BEGIN - 928 "̳ ." + 928 "Містить команди маніпулювання виглядом." END -STRINGTABLE +STRINGTABLE BEGIN - 992 "̳ ." + 992 "Містить команди інструментів." END -STRINGTABLE +STRINGTABLE BEGIN - 1056 "̳ ." + 1056 "Містить команди для відображення Допомоги." END -STRINGTABLE +STRINGTABLE BEGIN - 9025 " ." - 9026 " ." + 9025 "Закриває вікно." + 9026 "Йде вверх на один рівень." END -STRINGTABLE +STRINGTABLE BEGIN - 9121 "ϳ' ." - 9122 "³' ." + 9121 "Під'єднує до мережевого диску." + 9122 "Від'єднує від мережевого диску." END -STRINGTABLE +STRINGTABLE BEGIN - 9250 "³ , , copyright." - 9252 "³ ." + 9250 "Відображає дані про програму, номер версії, та copyright." + 9252 "Відображає дані для налагодження." END -STRINGTABLE +STRINGTABLE BEGIN - 9281 " ." - 9282 " ." - 9283 " ." - 9285 " ." + 9281 "Йде до попередньої сторінки." + 9282 "Йде до наступної сторінки." + 9283 "Дозволяє вам змінити налаштування." + 9285 "Йде до вашої домашньої сторінки." END -STRINGTABLE +STRINGTABLE BEGIN - 9362 "³ ." - 9363 " ." + 9362 "Відкриває папку Обране." + 9363 "Додає поточну сторінку до списку Обраного." END -STRINGTABLE +STRINGTABLE BEGIN - 9505 " ." - 9506 " ." - 9508 " ." - 9509 " ." - 9510 " ." - 9516 " ." + 9505 "Показує чи приховує панелі інструментів." + 9506 "Показує чи приховує рядок стану." + 9508 "Показує панель стандартних кнопок." + 9509 "Показує рядок адреси." + 9510 "Показує панель швидких посилань." + 9516 "Блокує розміри та розташування панелей інструментів." END -STRINGTABLE +STRINGTABLE BEGIN - 9533 " ." + 9533 "Персоналізує панель інструментів." END -STRINGTABLE +STRINGTABLE BEGIN - 9552 " ." - 9553 " ." - 9554 " ." - 9555 " ." - 9557 " ." - 9559 " ." + 9552 "Показує чи приховує панель Провідника." + 9553 "Показує панель Пошуку." + 9554 "Показує панель Обраного." + 9555 "Показує панель Історії." + 9557 "Показує панель Тек." + 9559 "Показує панель Медіа." END -STRINGTABLE +STRINGTABLE BEGIN - IDS_SMALLICONS " " - IDS_LARGEICONS " " - IDS_SHOWTEXTLABELS " " + IDS_SMALLICONS "Малі значки" + IDS_LARGEICONS "Великі значки" + IDS_SHOWTEXTLABELS "Показати текстові мітки" END -STRINGTABLE +STRINGTABLE BEGIN - IDS_NOTEXTLABELS " " - IDS_SELECTIVETEXTONRIGHT " " + IDS_NOTEXTLABELS "Без текстових міток" + IDS_SELECTIVETEXTONRIGHT "Частина тексту праворуч" END -STRINGTABLE +STRINGTABLE BEGIN - IDS_GOBUTTONLABEL "|||" - IDS_GOBUTTONTIPTEMPLATE " ""%s""" + IDS_GOBUTTONLABEL "|Йти||" + IDS_GOBUTTONTIPTEMPLATE "Йти до ""%s""" END -STRINGTABLE +STRINGTABLE BEGIN - IDS_SEARCHLABEL "" - IDS_ADDRESSBANDLABEL "&" + IDS_SEARCHLABEL "Пошук" + IDS_ADDRESSBANDLABEL "А&дреса" END -STRINGTABLE +STRINGTABLE BEGIN - IDS_FOLDERSLABEL "" + IDS_FOLDERSLABEL "Папки" END -STRINGTABLE +STRINGTABLE BEGIN - IDS_HISTORYTEXT "&\tCtrl+H" + IDS_HISTORYTEXT "&Історія\tCtrl+H" END -STRINGTABLE +STRINGTABLE BEGIN - IDS_UP "" + IDS_UP "Вверх" END -STRINGTABLE +STRINGTABLE BEGIN - IDS_BACK "" - IDS_FORWARD "" + IDS_BACK "Назад" + IDS_FORWARD "Вперед" END diff --git a/dll/win32/browseui/precomp.h b/dll/win32/browseui/precomp.h new file mode 100644 index 00000000000..263499d0325 --- /dev/null +++ b/dll/win32/browseui/precomp.h @@ -0,0 +1,32 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "resource.h" +#include "wine/debug.h" +#include "aclmulti.h" +#include "addressband.h" +#include "addresseditbox.h" +#include "bandproxy.h" +#include "bandsite.h" +#include "bandsitemenu.h" +#include "brandband.h" +#include "internettoolbar.h" +#include "commonbrowser.h" +#include "globalfoldersettings.h" +#include "regtreeoptions.h" +#include "newatlinterfaces.h" +#include "utility.h" diff --git a/dll/win32/browseui/regtreeoptions.cpp b/dll/win32/browseui/regtreeoptions.cpp index 11009327f73..a9ae73c6399 100644 --- a/dll/win32/browseui/regtreeoptions.cpp +++ b/dll/win32/browseui/regtreeoptions.cpp @@ -18,19 +18,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "resource.h" -#include "regtreeoptions.h" +#include "precomp.h" CRegTreeOptions::CRegTreeOptions() { diff --git a/dll/win32/browseui/shellbrowser.cpp b/dll/win32/browseui/shellbrowser.cpp index 16bbaf9830d..b050772af9f 100644 --- a/dll/win32/browseui/shellbrowser.cpp +++ b/dll/win32/browseui/shellbrowser.cpp @@ -18,23 +18,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "resource.h" -#include "newatlinterfaces.h" +#include "precomp.h" /* TODO: @@ -124,8 +108,6 @@ TODO: "language='*'\"") #endif // __GNUC__ -#define SHANDLE_PTR LONG - struct categoryCacheHeader { long dwSize; // size of header only @@ -156,7 +138,6 @@ SHSTDAPI_(void *) SHAlloc(SIZE_T cb); extern HRESULT CreateInternetToolbar(REFIID riid, void **ppv); - #ifdef SetWindowLongPtr #undef SetWindowLongPtr inline LONG_PTR SetWindowLongPtr(HWND hWnd, int nIndex, LONG_PTR dwNewLong) @@ -556,19 +537,29 @@ public: virtual HRESULT STDMETHODCALLTYPE get_Document(IDispatch **ppDisp); virtual HRESULT STDMETHODCALLTYPE get_TopLevelContainer(VARIANT_BOOL *pBool); virtual HRESULT STDMETHODCALLTYPE get_Type(BSTR *Type); - virtual HRESULT STDMETHODCALLTYPE get_Left(LONG *pl); - virtual HRESULT STDMETHODCALLTYPE put_Left(LONG Left); - virtual HRESULT STDMETHODCALLTYPE get_Top(LONG *pl); - virtual HRESULT STDMETHODCALLTYPE put_Top(LONG Top); - virtual HRESULT STDMETHODCALLTYPE get_Width(LONG *pl); - virtual HRESULT STDMETHODCALLTYPE put_Width(LONG Width); - virtual HRESULT STDMETHODCALLTYPE get_Height(LONG *pl); - virtual HRESULT STDMETHODCALLTYPE put_Height(LONG Height); + +// WIDL temp hack : when the interface contains 'long' WIDL writes it out as a 'LONG' +// Setting the prototype to LONG in this class breaks building with MSVC so we use +// the correct 'long' type here and temp hack it for WIDL generated prototypes. +#ifdef __WIDL_EXDISP_H +#define long LONG +#endif + virtual HRESULT STDMETHODCALLTYPE get_Left(long *pl); + virtual HRESULT STDMETHODCALLTYPE put_Left(long Left); + virtual HRESULT STDMETHODCALLTYPE get_Top(long *pl); + virtual HRESULT STDMETHODCALLTYPE put_Top(long Top); + virtual HRESULT STDMETHODCALLTYPE get_Width(long *pl); + virtual HRESULT STDMETHODCALLTYPE put_Width(long Width); + virtual HRESULT STDMETHODCALLTYPE get_Height(long *pl); + virtual HRESULT STDMETHODCALLTYPE put_Height(long Height); +#ifdef __WIDL_EXDISP_H +#undef long +#endif virtual HRESULT STDMETHODCALLTYPE get_LocationName(BSTR *LocationName); virtual HRESULT STDMETHODCALLTYPE get_LocationURL(BSTR *LocationURL); virtual HRESULT STDMETHODCALLTYPE get_Busy(VARIANT_BOOL *pBool); - // *** IWebBrowser2 methods *** + // *** IWebBrowserApp methods *** virtual HRESULT STDMETHODCALLTYPE Quit(); virtual HRESULT STDMETHODCALLTYPE ClientToWindow(int *pcx, int *pcy); virtual HRESULT STDMETHODCALLTYPE PutProperty(BSTR Property, VARIANT vtValue); @@ -2546,47 +2537,51 @@ HRESULT STDMETHODCALLTYPE CShellBrowser::get_Type(BSTR *Type) { return E_NOTIMPL; } - -HRESULT STDMETHODCALLTYPE CShellBrowser::get_Left(LONG *pl) +#ifdef __WIDL_EXDISP_H +#define long LONG +#endif +HRESULT STDMETHODCALLTYPE CShellBrowser::get_Left(long *pl) { return E_NOTIMPL; } -HRESULT STDMETHODCALLTYPE CShellBrowser::put_Left(LONG Left) +HRESULT STDMETHODCALLTYPE CShellBrowser::put_Left(long Left) { return E_NOTIMPL; } -HRESULT STDMETHODCALLTYPE CShellBrowser::get_Top(LONG *pl) +HRESULT STDMETHODCALLTYPE CShellBrowser::get_Top(long *pl) { return E_NOTIMPL; } -HRESULT STDMETHODCALLTYPE CShellBrowser::put_Top(LONG Top) +HRESULT STDMETHODCALLTYPE CShellBrowser::put_Top(long Top) { return E_NOTIMPL; } -HRESULT STDMETHODCALLTYPE CShellBrowser::get_Width(LONG *pl) +HRESULT STDMETHODCALLTYPE CShellBrowser::get_Width(long *pl) { return E_NOTIMPL; } -HRESULT STDMETHODCALLTYPE CShellBrowser::put_Width(LONG Width) +HRESULT STDMETHODCALLTYPE CShellBrowser::put_Width(long Width) { return E_NOTIMPL; } -HRESULT STDMETHODCALLTYPE CShellBrowser::get_Height(LONG *pl) +HRESULT STDMETHODCALLTYPE CShellBrowser::get_Height(long *pl) { return E_NOTIMPL; } -HRESULT STDMETHODCALLTYPE CShellBrowser::put_Height(LONG Height) +HRESULT STDMETHODCALLTYPE CShellBrowser::put_Height(long Height) { return E_NOTIMPL; } - +#ifdef __WIDL_EXDISP_H +#undef long +#endif HRESULT STDMETHODCALLTYPE CShellBrowser::get_LocationName(BSTR *LocationName) { return E_NOTIMPL; diff --git a/dll/win32/browseui/toolsband.cpp b/dll/win32/browseui/toolsband.cpp index dd7d0f76ce6..c472f6943ea 100644 --- a/dll/win32/browseui/toolsband.cpp +++ b/dll/win32/browseui/toolsband.cpp @@ -21,43 +21,12 @@ /* Implements the toolbar band of a cabinet window */ -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "precomp.h" /* TODO: **Fix GetBandInfo to calculate size correctly */ -static const int gBackCommandID = 0xa121; -static const int gForwardCommandID = 0xa122; -static const int gUpLevelCommandID = 0xa022; -static const int gSearchCommandID = 1003; -static const int gFoldersCommandID = 1004; -static const int gMoveToCommandID = 0x701f; -static const int gCopyToCommandID = 0x701e; -static const int gDeleteCommandID = 0x7011; -static const int gUndoCommandID = 0x701b; -static const int gViewsCommandID = 0x7031; -static const int gStopCommandID = 1010; -static const int gRefreshCommandID = 0xa220; -static const int gHomeCommandID = 1012; -static const int gMapDriveCommandID = 41089; -static const int gDisconnectCommandID = 41090; -static const int gFavoritesCommandID = 1015; -static const int gHistoryCommandID = 1016; -static const int gFullScreenCommandID = 1017; -static const int gPropertiesCommandID = 0x7013; -static const int gCutCommandID = 0x7018; -static const int gCopyCommandID = 0x7019; -static const int gPasteCommandID = 0x701a; -static const int gFolderOptionsCommandID = 41251; class CToolsBand : public CWindowImpl, diff --git a/dll/win32/browseui/travellog.cpp b/dll/win32/browseui/travellog.cpp index d05daa27175..83821b74760 100644 --- a/dll/win32/browseui/travellog.cpp +++ b/dll/win32/browseui/travellog.cpp @@ -40,16 +40,7 @@ TODO: Implement Revert */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "precomp.h" class CTravelEntry : public CComObjectRootEx, diff --git a/dll/win32/browseui/utility.cpp b/dll/win32/browseui/utility.cpp index dd1367367f7..9ade3fc36e5 100644 --- a/dll/win32/browseui/utility.cpp +++ b/dll/win32/browseui/utility.cpp @@ -1,6 +1,5 @@ -#include -#include "utility.h" +#include "precomp.h" void *operator new(size_t size) { diff --git a/dll/win32/cabinet/CMakeLists.txt b/dll/win32/cabinet/CMakeLists.txt index f85c5e0a4d5..f576efd211b 100644 --- a/dll/win32/cabinet/CMakeLists.txt +++ b/dll/win32/cabinet/CMakeLists.txt @@ -16,11 +16,9 @@ list(APPEND SOURCE add_library(cabinet SHARED ${SOURCE}) set_entrypoint(cabinet 0) - target_link_libraries(cabinet wine) - add_importlibs(cabinet kernel32 ntdll) add_importlib_target(cabinet.spec) - +add_pch(cabinet cabinet.h) add_dependencies(cabinet psdk) add_cd_file(TARGET cabinet DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/cabinet/cabinet.rbuild b/dll/win32/cabinet/cabinet.rbuild index 75c64fe1014..22b32681fab 100644 --- a/dll/win32/cabinet/cabinet.rbuild +++ b/dll/win32/cabinet/cabinet.rbuild @@ -11,6 +11,7 @@ fdi.c stubs.c cabinet.rc + cabinet.h wine ntdll diff --git a/dll/win32/comctl32/CMakeLists.txt b/dll/win32/comctl32/CMakeLists.txt index 2bf968616b8..29b93d7fc53 100644 --- a/dll/win32/comctl32/CMakeLists.txt +++ b/dll/win32/comctl32/CMakeLists.txt @@ -71,5 +71,6 @@ add_importlibs(comctl32 kernel32 ntdll) +add_pch(comctl32 comctl32.h) add_cd_file(TARGET comctl32 DESTINATION reactos/system32 FOR all) add_importlib_target(comctl32.spec) diff --git a/dll/win32/comctl32/comctl32.rbuild b/dll/win32/comctl32/comctl32.rbuild index 15ed84c0602..62f5c14f13b 100644 --- a/dll/win32/comctl32/comctl32.rbuild +++ b/dll/win32/comctl32/comctl32.rbuild @@ -48,6 +48,7 @@ updown.c stubs.c rsrc.rc + comctl32.h uuid wine user32 diff --git a/dll/win32/comctl32/comctl_Uk.rc b/dll/win32/comctl32/comctl_Uk.rc index dde83f41c8d..bd6eac29e39 100644 --- a/dll/win32/comctl32/comctl_Uk.rc +++ b/dll/win32/comctl32/comctl_Uk.rc @@ -22,31 +22,34 @@ #include "comctl32.h" +/* UTF-8 */ +#pragma code_page(65001) + LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT IDD_PROPSHEET DIALOG 0, 0, 220, 140 STYLE DS_CONTEXTHELP | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE -CAPTION " %s" +CAPTION "Властивості для %s" FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "OK", IDOK,4,122,50,14, WS_TABSTOP | WS_GROUP - PUSHBUTTON "&", IDCANCEL,58,122,50,14 - PUSHBUTTON "&", IDC_APPLY_BUTTON,112,122,50,14,WS_DISABLED - PUSHBUTTON "&", IDHELP,166,122,50,14,WS_TABSTOP|WS_GROUP + PUSHBUTTON "&Скасувати", IDCANCEL,58,122,50,14 + PUSHBUTTON "&Застосувати", IDC_APPLY_BUTTON,112,122,50,14,WS_DISABLED + PUSHBUTTON "&Довідка", IDHELP,166,122,50,14,WS_TABSTOP|WS_GROUP CONTROL "Tab", IDC_TABCONTROL,"SysTabControl32",WS_CLIPSIBLINGS|WS_GROUP|WS_TABSTOP|TCS_MULTILINE,4,4,212,114 END IDD_WIZARD DIALOG 0, 0, 290, 159 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE -CAPTION "" +CAPTION "Майстер" FONT 8, "MS Shell Dlg" BEGIN - PUSHBUTTON "< &", IDC_BACK_BUTTON,71,138,50,14 - DEFPUSHBUTTON "& >", IDC_NEXT_BUTTON,121,138,50,14 - DEFPUSHBUTTON "&", IDC_FINISH_BUTTON,121,138,50,14 - PUSHBUTTON "&", IDCANCEL,178,138,50,14 - PUSHBUTTON "&", IDHELP,235,138,50,14,WS_GROUP + PUSHBUTTON "< &Назад", IDC_BACK_BUTTON,71,138,50,14 + DEFPUSHBUTTON "&Далі >", IDC_NEXT_BUTTON,121,138,50,14 + DEFPUSHBUTTON "&Завершити", IDC_FINISH_BUTTON,121,138,50,14 + PUSHBUTTON "&Скасувати", IDCANCEL,178,138,50,14 + PUSHBUTTON "&Довідка", IDHELP,235,138,50,14,WS_GROUP LTEXT "", IDC_SUNKEN_LINE,7,129,278,1,SS_SUNKEN CONTROL "Tab", IDC_TABCONTROL,"SysTabControl32",WS_CLIPSIBLINGS | WS_DISABLED,7,7,258,5 LTEXT "", IDC_SUNKEN_LINEHEADER,0,35,290,1,SS_LEFT | SS_SUNKEN | WS_CHILD | WS_VISIBLE @@ -55,18 +58,18 @@ END IDD_TBCUSTOMIZE DIALOG 10, 20, 357, 125 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Настройка панелі інструментів" FONT 8, "MS Shell Dlg" BEGIN - DEFPUSHBUTTON "&", IDCANCEL,308,6,44,14 - PUSHBUTTON "&", IDC_RESET_BTN,308,23,44,14 - PUSHBUTTON "&", IDC_HELP_BTN,308,40,44,14 - PUSHBUTTON " &", IDC_MOVEUP_BTN,308,74,44,14 - PUSHBUTTON " &", IDC_MOVEDN_BTN,308,91,44,14 - LTEXT "& :", -1,4,5,84,10 + DEFPUSHBUTTON "&Закрити", IDCANCEL,308,6,44,14 + PUSHBUTTON "&Скинути", IDC_RESET_BTN,308,23,44,14 + PUSHBUTTON "&Довідка", IDC_HELP_BTN,308,40,44,14 + PUSHBUTTON "Пересунути в&гору", IDC_MOVEUP_BTN,308,74,44,14 + PUSHBUTTON "Пересунути до&низу", IDC_MOVEDN_BTN,308,91,44,14 + LTEXT "На&явні кнопки:", -1,4,5,84,10 LISTBOX IDC_AVAILBTN_LBOX,4,17,120,100, LBS_NOTIFY | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP - PUSHBUTTON "& ->", IDOK, 131, 42, 44, 14 - PUSHBUTTON "<- &", IDC_REMOVE_BTN,131,62,44,14 - LTEXT "& :", -1,182,5,78,10 + PUSHBUTTON "&Додати ->", IDOK, 131, 42, 44, 14 + PUSHBUTTON "<- &Прибрати", IDC_REMOVE_BTN,131,62,44,14 + LTEXT "&Кнопки панелі інструментів:", -1,182,5,78,10 LISTBOX IDC_TOOLBARBTN_LBOX, 182,17,120,100,LBS_NOTIFY | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP END diff --git a/dll/win32/comctl32/rsrc.rc b/dll/win32/comctl32/rsrc.rc index 903c147bf55..c454ed3e6ef 100644 --- a/dll/win32/comctl32/rsrc.rc +++ b/dll/win32/comctl32/rsrc.rc @@ -104,7 +104,6 @@ IDI_TT_ERROR_SM ICON idi_tt_error_sm.ico #include "comctl_Sv.rc" #include "comctl_Th.rc" #include "comctl_Tr.rc" -#include "comctl_Uk.rc" /* UTF-8 */ #include "comctl_Da.rc" @@ -120,4 +119,5 @@ IDI_TT_ERROR_SM ICON idi_tt_error_sm.ico #include "comctl_Ru.rc" #include "comctl_Si.rc" #include "comctl_Sr.rc" +#include "comctl_Uk.rc" #include "comctl_Zh.rc" diff --git a/dll/win32/comdlg32/CMakeLists.txt b/dll/win32/comdlg32/CMakeLists.txt index 83f46ae9056..90918029bb6 100644 --- a/dll/win32/comdlg32/CMakeLists.txt +++ b/dll/win32/comdlg32/CMakeLists.txt @@ -1,8 +1,7 @@ add_definitions( -D__WINESRC__ - -D_WINE - -D_DLL -D__USE_CRTIMP) + -D_WINE) include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine) diff --git a/dll/win32/comdlg32/cdlg_Uk.rc b/dll/win32/comdlg32/cdlg_Uk.rc index a4b4ff5dc55..02859e920a3 100644 --- a/dll/win32/comdlg32/cdlg_Uk.rc +++ b/dll/win32/comdlg32/cdlg_Uk.rc @@ -25,96 +25,99 @@ * WARNING: DO NOT CHANGE THE SIZE OF THE STANDARD DIALOG TEMPLATES. */ +/* UTF-8 */ +#pragma code_page(65001) + LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT OPEN_FILE DIALOG 36, 24, 275, 134 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "³" +CAPTION "Відкрити" FONT 8, "MS Shell Dlg" { - LTEXT "&' :", 1090, 6, 6, 76, 9 + LTEXT "&Ім'я файлу:", 1090, 6, 6, 76, 9 EDITTEXT 1152, 6, 16, 90, 12, ES_AUTOHSCROLL | ES_OEMCONVERT | WS_BORDER | WS_TABSTOP LISTBOX 1120, 6, 32, 90, 68, LBS_STANDARD | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_DISABLENOSCROLL | WS_TABSTOP - LTEXT "&:", -1, 110, 6, 92, 9 + LTEXT "&Теки:", -1, 110, 6, 92, 9 LTEXT "", 1088, 110, 18, 92, 9, SS_NOPREFIX | WS_GROUP LISTBOX 1121, 110, 32, 92, 68, LBS_STANDARD | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_DISABLENOSCROLL | WS_TABSTOP - LTEXT " &:", 1089, 6, 104, 90, 9 + LTEXT "Показувати файли &типу:", 1089, 6, 104, 90, 9 COMBOBOX 1136, 6, 114, 90, 36, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_BORDER | WS_VSCROLL | WS_TABSTOP - LTEXT "&:", 1091, 110, 104, 92, 9 + LTEXT "&Диски:", 1091, 110, 104, 92, 9 COMBOBOX 1137, 110, 114, 92, 68, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP - DEFPUSHBUTTON "³", IDOK, 208, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP - PUSHBUTTON "", IDCANCEL, 208, 24, 56, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON "&", 1038, 208, 46, 56, 14, WS_GROUP | WS_TABSTOP - CHECKBOX "& ", 1040, 208, 68, 54, 24, BS_AUTOCHECKBOX | BS_MULTILINE | WS_GROUP | WS_TABSTOP + DEFPUSHBUTTON "Відкрити", IDOK, 208, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP + PUSHBUTTON "Скасувати", IDCANCEL, 208, 24, 56, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&Довідка", 1038, 208, 46, 56, 14, WS_GROUP | WS_TABSTOP + CHECKBOX "&Лише для читання", 1040, 208, 68, 54, 24, BS_AUTOCHECKBOX | BS_MULTILINE | WS_GROUP | WS_TABSTOP } SAVE_FILE DIALOG 36, 24, 275, 134 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " ..." +CAPTION "Зберегти як..." FONT 8, "MS Shell Dlg" { - LTEXT "&' :", 1090, 6, 6, 76, 9 + LTEXT "&Ім'я файлу:", 1090, 6, 6, 76, 9 EDITTEXT 1152, 6, 16, 90, 12, ES_AUTOHSCROLL | ES_OEMCONVERT | WS_BORDER | WS_TABSTOP LISTBOX 1120, 6, 32, 90, 68, LBS_STANDARD | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_DISABLENOSCROLL | WS_TABSTOP - LTEXT "&:", -1, 110, 6, 92, 9 + LTEXT "&Теки:", -1, 110, 6, 92, 9 LTEXT "", 1088, 110, 18, 92, 9, SS_NOPREFIX | WS_GROUP LISTBOX 1121, 110, 32, 92, 68, LBS_STANDARD | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_DISABLENOSCROLL | WS_TABSTOP - LTEXT " &:", 1089, 6, 104, 90, 9 + LTEXT "Показувати файли &типу:", 1089, 6, 104, 90, 9 COMBOBOX 1136, 6, 114, 90, 36, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_BORDER | WS_VSCROLL | WS_TABSTOP - LTEXT "&:", 1091, 110, 104, 92, 9 + LTEXT "&Диски:", 1091, 110, 104, 92, 9 COMBOBOX 1137, 110, 114, 92, 68, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP - DEFPUSHBUTTON " ", IDOK, 208, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP - PUSHBUTTON "", IDCANCEL, 208, 24, 56, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON "&", 1038, 208, 46, 56, 14, WS_GROUP | WS_TABSTOP - CHECKBOX "& ", 1040, 208, 68, 54, 24, BS_AUTOCHECKBOX | BS_MULTILINE | WS_GROUP | WS_TABSTOP + DEFPUSHBUTTON "Зберегти як", IDOK, 208, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP + PUSHBUTTON "Скасувати", IDCANCEL, 208, 24, 56, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&Довідка", 1038, 208, 46, 56, 14, WS_GROUP | WS_TABSTOP + CHECKBOX "&Лише для читання", 1040, 208, 68, 54, 24, BS_AUTOCHECKBOX | BS_MULTILINE | WS_GROUP | WS_TABSTOP } PRINT DIALOG 36, 24, 264, 134 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "" +CAPTION "Друк" FONT 8, "MS Shell Dlg" { - LTEXT ":", 1088, 6, 6, 40, 9 + LTEXT "Принтер:", 1088, 6, 6, 40, 9 LTEXT "", 1089, 60, 6, 150, 9 - GROUPBOX "", 1072, 6, 30, 160, 65, BS_GROUPBOX - RADIOBUTTON "&", 1056, 16, 45, 60, 12 - RADIOBUTTON "& ", 1057, 16, 60, 60, 12 - RADIOBUTTON "&", 1058, 16, 75, 60, 12 - DEFPUSHBUTTON "", IDOK, 206, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP - PUSHBUTTON "", IDCANCEL, 206, 24, 56, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON "", 1024, 206, 46, 56, 14, WS_GROUP | WS_TABSTOP - LTEXT "&:", 1090, 60, 80, 30, 9 - LTEXT "&:", 1091, 120, 80, 30, 9 - LTEXT "& :", 1092, 6, 100, 76, 9 + GROUPBOX "Друкувати", 1072, 6, 30, 160, 65, BS_GROUPBOX + RADIOBUTTON "&Все", 1056, 16, 45, 60, 12 + RADIOBUTTON "В&иділенний фрагмент", 1057, 16, 60, 60, 12 + RADIOBUTTON "&Сторінки", 1058, 16, 75, 60, 12 + DEFPUSHBUTTON "Друк", IDOK, 206, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP + PUSHBUTTON "Скасувати", IDCANCEL, 206, 24, 56, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "Властивості", 1024, 206, 46, 56, 14, WS_GROUP | WS_TABSTOP + LTEXT "&з:", 1090, 60, 80, 30, 9 + LTEXT "&до:", 1091, 120, 80, 30, 9 + LTEXT "&Якість друку:", 1092, 6, 100, 76, 9 COMBOBOX 1136, 80, 100, 92, 68, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP - CHECKBOX " ", 1040, 20, 100, 50, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP - CHECKBOX "", 1041, 160, 100, 50, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP + CHECKBOX "Друк до файлу", 1040, 20, 100, 50, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP + CHECKBOX "Стисло", 1041, 160, 100, 50, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP } PRINT_SETUP DIALOG 36, 24, 264, 134 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Настройка принтера" FONT 8, "MS Shell Dlg" { - GROUPBOX "", 1072, 6, 10, 180, 65, BS_GROUPBOX - RADIOBUTTON " &", 1056, 16, 20, 80, 12 - LTEXT "[]", 1088, 35, 35, 120, 9 - RADIOBUTTON "& ", 1057, 16, 50, 80, 12 + GROUPBOX "Принтер", 1072, 6, 10, 180, 65, BS_GROUPBOX + RADIOBUTTON "Принтер за &обумовленням", 1056, 16, 20, 80, 12 + LTEXT "[Нема]", 1088, 35, 35, 120, 9 + RADIOBUTTON "&Інший принтер", 1057, 16, 50, 80, 12 COMBOBOX 1136, 35, 65, 149, 68, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP DEFPUSHBUTTON "OK", IDOK, 206, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP - PUSHBUTTON "", IDCANCEL, 206, 24, 56, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON "&", 1024, 206, 46, 56, 14, WS_GROUP | WS_TABSTOP - GROUPBOX "", 1073, 6, 85, 100, 50, BS_GROUPBOX - RADIOBUTTON "&", 1058, 50, 100, 40, 12 - RADIOBUTTON "&", 1059, 50, 115, 40, 12 + PUSHBUTTON "Скасувати", IDCANCEL, 206, 24, 56, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&Настройка", 1024, 206, 46, 56, 14, WS_GROUP | WS_TABSTOP + GROUPBOX "Орієнтація", 1073, 6, 85, 100, 50, BS_GROUPBOX + RADIOBUTTON "&Книжна", 1058, 50, 100, 40, 12 + RADIOBUTTON "&Альбомна", 1059, 50, 115, 40, 12 ICON "LANDSCAP", 1097, 10, 95, 32, 32 ICON "PORTRAIT", 1098, 10, 95, 32, 32 - GROUPBOX "", 1074, 120, 85, 180, 50, BS_GROUPBOX - LTEXT "&", 1089, 130, 95, 30, 9 - LTEXT "&", 1090, 130, 110, 30, 9 + GROUPBOX "Папір", 1074, 120, 85, 180, 50, BS_GROUPBOX + LTEXT "Ро&змір", 1089, 130, 95, 30, 9 + LTEXT "&Джерело", 1090, 130, 110, 30, 9 COMBOBOX 1137, 155, 95, 92, 68, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP COMBOBOX 1138, 155, 110, 92, 68, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP } @@ -122,31 +125,31 @@ FONT 8, "MS Shell Dlg" CHOOSE_FONT DIALOG 13, 54, 264, 147 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "" +CAPTION "Шрифт" FONT 8, "MS Shell Dlg" { - LTEXT "&:",1088 ,6,3,40,9 + LTEXT "&Шрифт:",1088 ,6,3,40,9 COMBOBOX 1136 ,6,13,94,54, CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | CBS_DISABLENOSCROLL | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP | CBS_SIMPLE - LTEXT "&:",1089 ,108,3,44,9 + LTEXT "&Стиль:",1089 ,108,3,44,9 COMBOBOX 1137,108,13,64,54, CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | CBS_DISABLENOSCROLL | WS_VSCROLL | WS_TABSTOP | CBS_SIMPLE - LTEXT "&:",1090,179,3,30,9 + LTEXT "&Розмір:",1090,179,3,30,9 COMBOBOX 1138,179,13,32,54, CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | CBS_DISABLENOSCROLL | WS_VSCROLL | WS_TABSTOP | CBS_SIMPLE | CBS_SORT DEFPUSHBUTTON "OK",IDOK,218,6,40,14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON - PUSHBUTTON "",IDCANCEL,218,23,40,14,WS_GROUP | WS_TABSTOP - PUSHBUTTON "&", 1026,218,40,40,14,WS_GROUP | WS_TABSTOP - PUSHBUTTON "&" , 1038,218,57,40,14,WS_GROUP | WS_TABSTOP - GROUPBOX "",1072,6,72,84,34,WS_GROUP - CHECKBOX "&", 1040, 10,82,75,10, BS_AUTOCHECKBOX | WS_TABSTOP - CHECKBOX "&ϳ", 1041, 10,94,75,10, BS_AUTOCHECKBOX - LTEXT "&:", 1091 ,6,110,30,9 + PUSHBUTTON "Скасувати",IDCANCEL,218,23,40,14,WS_GROUP | WS_TABSTOP + PUSHBUTTON "&Застосувати", 1026,218,40,40,14,WS_GROUP | WS_TABSTOP + PUSHBUTTON "&Довідка" , 1038,218,57,40,14,WS_GROUP | WS_TABSTOP + GROUPBOX "Атрибути",1072,6,72,84,34,WS_GROUP + CHECKBOX "&Закреслений", 1040, 10,82,75,10, BS_AUTOCHECKBOX | WS_TABSTOP + CHECKBOX "&Підкреслений", 1041, 10,94,75,10, BS_AUTOCHECKBOX + LTEXT "&Колір:", 1091 ,6,110,30,9 COMBOBOX 1139,6,120,84,100,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | CBS_AUTOHSCROLL | WS_BORDER | WS_VSCROLL | WS_TABSTOP - GROUPBOX "&",grp2,98,72,120,36,WS_GROUP - CTEXT "AaBb",stc5,103,80,109,24,SS_NOPREFIX | NOT WS_VISIBLE - LTEXT ":",stc7 ,98,114,80,9 + GROUPBOX "&Зразок",grp2,98,72,120,36,WS_GROUP + CTEXT "АаБбAaBb",stc5,103,80,109,24,SS_NOPREFIX | NOT WS_VISIBLE + LTEXT "Скрипт:",stc7 ,98,114,80,9 COMBOBOX cmb5,98,124,120,90,CBS_DROPDOWNLIST | CBS_HASSTRINGS | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP } @@ -154,23 +157,23 @@ FONT 8, "MS Shell Dlg" CHOOSE_COLOR DIALOG 36, 24, 310, 185 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Зміна палітри" FONT 8, "MS Shell Dlg" { - LTEXT "& :", 1088, 4, 4, 140, 10 - LTEXT "& :", 1089, 4, 106, 140, 10 - LTEXT "|&", 1090, 150, 151, 48, 10 - LTEXT "&:", 726 /*1094*/,254,126,32,10 + LTEXT "&Базова палітра:", 1088, 4, 4, 140, 10 + LTEXT "Д&одаткові кольори:", 1089, 4, 106, 140, 10 + LTEXT "Колір|За&ливка", 1090, 150, 151, 48, 10 + LTEXT "&Червоний:", 726 /*1094*/,254,126,32,10 EDITTEXT 706, 288,124,21,12, WS_BORDER | WS_GROUP | WS_TABSTOP - LTEXT "&:",727/*1095*/,254,140,32,10 + LTEXT "&Зелений:",727/*1095*/,254,140,32,10 EDITTEXT 707, 288,138,21,12, WS_BORDER | WS_GROUP | WS_TABSTOP - LTEXT "&:",728 /*1096*/,264,154,24,10 + LTEXT "С&иній:",728 /*1096*/,264,154,24,10 EDITTEXT 708, 288,152,21,12, WS_BORDER | WS_GROUP | WS_TABSTOP - LTEXT "³&:" ,723 /*1091*/,202,126,30,10 + LTEXT "Від&тінок:" ,723 /*1091*/,202,126,30,10 EDITTEXT 703, 234,124,21,12, WS_BORDER | WS_GROUP | WS_TABSTOP - LTEXT "&:" ,724 /*1092*/,199,140,34,10 + LTEXT "&Контраст:" ,724 /*1092*/,199,140,34,10 EDITTEXT 704, 234,138,21,12, WS_BORDER | WS_GROUP | WS_TABSTOP - LTEXT "&:" ,725 /*1093*/,202,154,30,10 + LTEXT "&Яскравість:" ,725 /*1093*/,202,154,30,10 EDITTEXT 705, 234,152,21,12, WS_BORDER | WS_GROUP | WS_TABSTOP CONTROL "" ,720,"STATIC",SS_SIMPLE|WS_TABSTOP|WS_GROUP,4,14,140,86 CONTROL "" ,721,"STATIC",SS_SIMPLE|WS_TABSTOP|WS_GROUP,4,116,140,28 @@ -178,308 +181,308 @@ FONT 8, "MS Shell Dlg" CONTROL "" ,702,"STATIC",SS_SIMPLE|WS_TABSTOP|WS_GROUP, 278,4,8,116 CONTROL "" ,709,"STATIC",SS_SIMPLE|WS_TABSTOP|WS_GROUP, 152,124,40,26 DEFPUSHBUTTON "OK", IDOK, 4, 166, 44, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP - PUSHBUTTON "", IDCANCEL, 52, 166, 44, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON "", 1038,100,166, 44, 14 - PUSHBUTTON "& ", 712/*1024*/, 152, 166, 142, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON "& >>", 719/*1025*/, 4, 150, 142, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "Скасувати", IDCANCEL, 52, 166, 44, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "Довідка", 1038,100,166, 44, 14 + PUSHBUTTON "&Додати до набору", 712/*1024*/, 152, 166, 142, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&Визначити колір >>", 719/*1025*/, 4, 150, 142, 14, WS_GROUP | WS_TABSTOP PUSHBUTTON "&i",713,300,200,4,14 /* just a dummy: 'i' is like &i in "sol&id" */ } FINDDLGORD DIALOG 36, 24, 245, 62 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "" +CAPTION "Пошук" FONT 8, "MS Shell Dlg" { - LTEXT "&:", -1, 4, 8, 42, 8 + LTEXT "&Зразок:", -1, 4, 8, 42, 8 EDITTEXT 1152, 47, 7, 138, 12, ES_AUTOHSCROLL | WS_BORDER | WS_GROUP | WS_TABSTOP - CHECKBOX "& ", 1040, 4, 26, 100, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP - CHECKBOX " &崳", 1041, 4, 42, 100, 12, BS_AUTOCHECKBOX | WS_TABSTOP - GROUPBOX "", 1072, 107, 26, 78, 28 - CONTROL "&", 1056, "BUTTON", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 111, 38, 40, 12 - CONTROL "&", 1057, "BUTTON", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 152, 38, 30, 12 + CHECKBOX "&Лише слово цілком", 1040, 4, 26, 100, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP + CHECKBOX "Залік &реґістру", 1041, 4, 42, 100, 12, BS_AUTOCHECKBOX | WS_TABSTOP + GROUPBOX "Напрям", 1072, 107, 26, 78, 28 + CONTROL "&Вгору", 1056, "BUTTON", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 111, 38, 40, 12 + CONTROL "В&низ", 1057, "BUTTON", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 152, 38, 30, 12 - DEFPUSHBUTTON "& ", IDOK, 190, 5, 50, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON - PUSHBUTTON "", IDCANCEL , 190, 23, 50, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON "&", pshHelp , 190, 45, 50, 14, WS_GROUP | WS_TABSTOP + DEFPUSHBUTTON "З&найти далі", IDOK, 190, 5, 50, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON + PUSHBUTTON "Скасувати", IDCANCEL , 190, 23, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&Довідка", pshHelp , 190, 45, 50, 14, WS_GROUP | WS_TABSTOP } REPLACEDLGORD DIALOG 36, 24, 230, 94 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "" +CAPTION "Заміна" FONT 8, "MS Shell Dlg" { - LTEXT "&:", -1, 4, 9, 48, 8 + LTEXT "&Зразок:", -1, 4, 9, 48, 8 EDITTEXT 1152, 54, 7, 114, 12, ES_AUTOHSCROLL | WS_BORDER | WS_GROUP | WS_TABSTOP - LTEXT "& :", -1, 4, 26, 48, 8 + LTEXT "З&амінити на:", -1, 4, 26, 48, 8 EDITTEXT 1153, 54, 24, 114, 12, ES_AUTOHSCROLL | WS_BORDER | WS_GROUP | WS_TABSTOP - CHECKBOX "& ", 1040, 5, 46, 104, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP - CHECKBOX " &崳", 1041, 5, 62, 104, 12, BS_AUTOCHECKBOX | WS_TABSTOP + CHECKBOX "&Лише слово цілком", 1040, 5, 46, 104, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP + CHECKBOX "Залік &реґістру", 1041, 5, 62, 104, 12, BS_AUTOCHECKBOX | WS_TABSTOP - DEFPUSHBUTTON "& ", IDOK, 174, 4, 50, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON - PUSHBUTTON "&", psh1 , 174, 21, 50, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON " &", psh2 , 174, 38, 50, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON "", IDCANCEL , 174, 55, 50, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON "&", pshHelp , 174, 75, 50, 14, WS_GROUP | WS_TABSTOP + DEFPUSHBUTTON "З&найти далі", IDOK, 174, 4, 50, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON + PUSHBUTTON "&Замінити", psh1 , 174, 21, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "Замінити &все", psh2 , 174, 38, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "Скасувати", IDCANCEL , 174, 55, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&Довідка", pshHelp , 174, 75, 50, 14, WS_GROUP | WS_TABSTOP } PRINT32 DIALOG 32, 32, 288, 186 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | DS_CONTEXTHELP | DS_3DLOOK -CAPTION "" +CAPTION "Друк" FONT 8, "MS Shell Dlg" { DEFPUSHBUTTON "OK", IDOK, 180,164, 48,14, WS_GROUP | BS_DEFPUSHBUTTON - PUSHBUTTON "", IDCANCEL, 232,164, 48,14, WS_GROUP - PUSHBUTTON "&", pshHelp, 50, 161, 48,14, WS_GROUP + PUSHBUTTON "Скасувати", IDCANCEL, 232,164, 48,14, WS_GROUP + PUSHBUTTON "&Довідка", pshHelp, 50, 161, 48,14, WS_GROUP - GROUPBOX "", grp4, 8, 4, 272,84, WS_GROUP - CONTROL " &", chx1, "Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,212,70,64,12 - PUSHBUTTON "&", psh2, 212, 17, 60,14, WS_GROUP - LTEXT "&':", stc6, 16, 20, 46,8 + GROUPBOX "Принтер", grp4, 8, 4, 272,84, WS_GROUP + CONTROL "Друк у фай&л", chx1, "Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,212,70,64,12 + PUSHBUTTON "&Властивості", psh2, 212, 17, 60,14, WS_GROUP + LTEXT "&Ім'я:", stc6, 16, 20, 46,8 COMBOBOX cmb4, 64, 18, 140,152,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_GROUP | WS_TABSTOP - LTEXT ":", stc8, 16, 36, 46,10, SS_NOPREFIX - LTEXT "", stc12, 64, 36, 100,10, SS_NOPREFIX | SS_LEFTNOWORDWRAP - LTEXT ":", stc7, 16, 48, 46,10, SS_NOPREFIX - LTEXT "", stc11, 64, 48, 100,10, SS_NOPREFIX | SS_LEFTNOWORDWRAP - LTEXT "̳:", stc10, 16, 60, 46,10, SS_NOPREFIX - LTEXT "", stc14, 64, 60, 100,10, SS_NOPREFIX | SS_LEFTNOWORDWRAP - LTEXT ":", stc9, 16, 72, 46,10, SS_NOPREFIX - LTEXT "", stc13, 64, 72, 100,10, SS_NOPREFIX | SS_LEFTNOWORDWRAP + LTEXT "Статус:", stc8, 16, 36, 46,10, SS_NOPREFIX + LTEXT "Емульовано", stc12, 64, 36, 100,10, SS_NOPREFIX | SS_LEFTNOWORDWRAP + LTEXT "Тип:", stc7, 16, 48, 46,10, SS_NOPREFIX + LTEXT "Емульовано", stc11, 64, 48, 100,10, SS_NOPREFIX | SS_LEFTNOWORDWRAP + LTEXT "Місце:", stc10, 16, 60, 46,10, SS_NOPREFIX + LTEXT "Емульовано", stc14, 64, 60, 100,10, SS_NOPREFIX | SS_LEFTNOWORDWRAP + LTEXT "Примітка:", stc9, 16, 72, 46,10, SS_NOPREFIX + LTEXT "Емульовано", stc13, 64, 72, 100,10, SS_NOPREFIX | SS_LEFTNOWORDWRAP - GROUPBOX "ﳿ", grp2, 160, 92, 120,64, WS_GROUP - LTEXT " &:",stc5,168,108,68,8 + GROUPBOX "Копії", grp2, 160, 92, 120,64, WS_GROUP + LTEXT "Число &копій:",stc5,168,108,68,8 ICON "", ico3, 162,124, 60,24, WS_GROUP | SS_CENTERIMAGE - CONTROL "&", chx2,"Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,230,130,42,12 + CONTROL "&Розбити", chx2,"Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,230,130,42,12 EDITTEXT edt3, 230,106, 42,12, WS_GROUP | ES_NUMBER - GROUPBOX "", grp1, 8,92, 144,64, WS_GROUP - CONTROL "&", rad1,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,16,106,64,12 - CONTROL "&", rad3,"Button",BS_AUTORADIOBUTTON,16,122,50,12 - CONTROL "&", rad2,"Button",BS_AUTORADIOBUTTON,16,138,64,12 + GROUPBOX "Друкувати", grp1, 8,92, 144,64, WS_GROUP + CONTROL "&Все", rad1,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,16,106,64,12 + CONTROL "&Сторінки", rad3,"Button",BS_AUTORADIOBUTTON,16,122,50,12 + CONTROL "&Виділення", rad2,"Button",BS_AUTORADIOBUTTON,16,138,64,12 EDITTEXT edt1, 85,122, 20,12, WS_GROUP | ES_NUMBER EDITTEXT edt2, 120,122, 20,12, WS_GROUP | ES_NUMBER - RTEXT "&:", stc2, 70,124, 12,8 - RTEXT "&:", stc3, 106,124, 10,8 + RTEXT "&від:", stc2, 70,124, 12,8 + RTEXT "&до:", stc3, 106,124, 10,8 } PRINT32_SETUP DIALOG 32, 32, 288, 178 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU | DS_CONTEXTHELP | DS_3DLOOK -CAPTION " " +CAPTION "Установки принтера" FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "OK",IDOK,180,156,48,14,WS_GROUP - PUSHBUTTON "",IDCANCEL,232,156,48,14 -/* PUSHBUTTON "ѳ...", psh5, 284,156,48,14 */ + PUSHBUTTON "Скасувати",IDCANCEL,232,156,48,14 +/* PUSHBUTTON "Сітка...", psh5, 284,156,48,14 */ - GROUPBOX "", grp4, 8, 4, 272,84, WS_GROUP - PUSHBUTTON "&", psh2, 212, 17, 60,14, WS_GROUP - LTEXT "&':", stc6, 16, 20, 36,8 + GROUPBOX "Принтер", grp4, 8, 4, 272,84, WS_GROUP + PUSHBUTTON "&Властивості", psh2, 212, 17, 60,14, WS_GROUP + LTEXT "&Ім'я:", stc6, 16, 20, 36,8 COMBOBOX cmb1, 52, 18, 152,152,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_GROUP | WS_TABSTOP - LTEXT ":", stc8, 16, 36, 36,10, SS_NOPREFIX - LTEXT "", stc12, 52, 36, 224,10, SS_NOPREFIX | SS_LEFTNOWORDWRAP - LTEXT ":", stc7, 16, 48, 36,10, SS_NOPREFIX - LTEXT "", stc11, 52, 48, 224,10, SS_NOPREFIX | SS_LEFTNOWORDWRAP - LTEXT "̳:", stc10, 16, 60, 36,10, SS_NOPREFIX - LTEXT "", stc14, 52, 60, 224,10, SS_NOPREFIX | SS_LEFTNOWORDWRAP - LTEXT ":", stc9, 16, 72, 36,10, SS_NOPREFIX - LTEXT "", stc13, 52, 72, 224,10, SS_NOPREFIX | SS_LEFTNOWORDWRAP + LTEXT "Статус:", stc8, 16, 36, 36,10, SS_NOPREFIX + LTEXT "Емульовано", stc12, 52, 36, 224,10, SS_NOPREFIX | SS_LEFTNOWORDWRAP + LTEXT "Тип:", stc7, 16, 48, 36,10, SS_NOPREFIX + LTEXT "Емульовано", stc11, 52, 48, 224,10, SS_NOPREFIX | SS_LEFTNOWORDWRAP + LTEXT "Місце:", stc10, 16, 60, 36,10, SS_NOPREFIX + LTEXT "Емульовано", stc14, 52, 60, 224,10, SS_NOPREFIX | SS_LEFTNOWORDWRAP + LTEXT "Примітки:", stc9, 16, 72, 36,10, SS_NOPREFIX + LTEXT "Емульовані", stc13, 52, 72, 224,10, SS_NOPREFIX | SS_LEFTNOWORDWRAP - GROUPBOX "", grp2, 8, 92, 164,56, WS_GROUP - LTEXT "&:", stc2, 16,108, 36, 8 + GROUPBOX "Папір", grp2, 8, 92, 164,56, WS_GROUP + LTEXT "Роз&мір:", stc2, 16,108, 36, 8 COMBOBOX cmb2, 52,106, 112,112,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_GROUP | WS_TABSTOP - LTEXT "&:", stc3, 16,128, 36, 8 + LTEXT "&Джерело:", stc3, 16,128, 36, 8 COMBOBOX cmb3, 52,126, 112,112,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_GROUP | WS_TABSTOP - GROUPBOX "", grp1, 180, 92, 100,56, WS_GROUP + GROUPBOX "Орієнтація", grp1, 180, 92, 100,56, WS_GROUP ICON "", ico1, 195,112, 18,20, WS_GROUP - CONTROL "&", rad1,"Button",BS_AUTORADIOBUTTON | WS_GROUP |WS_TABSTOP,224,106,52,12 - CONTROL "&", rad2,"Button",BS_AUTORADIOBUTTON,224,126,52,12 + CONTROL "&Портрет", rad1,"Button",BS_AUTORADIOBUTTON | WS_GROUP |WS_TABSTOP,224,106,52,12 + CONTROL "Л&андшафт", rad2,"Button",BS_AUTORADIOBUTTON,224,126,52,12 END PAGESETUPDLGORD DIALOG 32, 32, 240, 240 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Параметри сторінки" FONT 8, "MS Shell Dlg" BEGIN CONTROL "", rct1, "Static", SS_WHITERECT, 80, 8, 80, 80 CONTROL "", rct2, "Static", SS_GRAYRECT, 160, 12, 4, 80 CONTROL "", rct3, "Static", SS_GRAYRECT, 84, 88, 80, 4 - GROUPBOX "", grp2, 8, 96, 224, 56, BS_GROUPBOX - LTEXT "&:", stc2, 16, 112, 36, 8 + GROUPBOX "Папір", grp2, 8, 96, 224, 56, BS_GROUPBOX + LTEXT "&Розмір:", stc2, 16, 112, 36, 8 COMBOBOX cmb2, 64, 110, 160, 160, CBS_SIMPLE|CBS_DROPDOWN|CBS_SORT|WS_GROUP|WS_TABSTOP|WS_VSCROLL - LTEXT "&:", stc3, 16, 132, 36, 8 + LTEXT "Пода&ча:", stc3, 16, 132, 36, 8 COMBOBOX cmb3, 64, 130, 160, 160, CBS_SIMPLE|CBS_DROPDOWN|CBS_SORT|WS_GROUP|WS_TABSTOP|WS_VSCROLL - GROUPBOX "", grp1, 8, 156, 64, 56, BS_GROUPBOX - AUTORADIOBUTTON "&", rad1, 16, 170, 52, 12, BS_AUTORADIOBUTTON - AUTORADIOBUTTON "&", rad2, 16, 190, 52, 12, BS_AUTORADIOBUTTON - GROUPBOX "", grp4, 80, 156, 152, 56, BS_GROUPBOX - LTEXT "&:", stc15, 88, 172, 21, 8 + GROUPBOX "Орієнтація", grp1, 8, 156, 64, 56, BS_GROUPBOX + AUTORADIOBUTTON "К&нижкова", rad1, 16, 170, 52, 12, BS_AUTORADIOBUTTON + AUTORADIOBUTTON "Аль&бомна", rad2, 16, 190, 52, 12, BS_AUTORADIOBUTTON + GROUPBOX "Поля", grp4, 80, 156, 152, 56, BS_GROUPBOX + LTEXT "З&ліва:", stc15, 88, 172, 21, 8 EDITTEXT edt4, 111, 170, 39, 12, WS_TABSTOP|WS_GROUP|WS_BORDER - LTEXT "&:", stc16, 159, 172, 27, 8 + LTEXT "С&права:", stc16, 159, 172, 27, 8 EDITTEXT edt6, 187, 170, 39, 12, WS_TABSTOP|WS_GROUP|WS_BORDER - LTEXT "&:", stc17, 88, 192, 21, 8 + LTEXT "З&верху:", stc17, 88, 192, 21, 8 EDITTEXT edt5, 111, 190, 39, 12, WS_TABSTOP|WS_GROUP|WS_BORDER - LTEXT "&:", stc18, 159, 192, 23, 8 + LTEXT "З&низу:", stc18, 159, 192, 23, 8 EDITTEXT edt7, 187, 190, 39, 12, WS_TABSTOP|WS_GROUP|WS_BORDER DEFPUSHBUTTON "OK", IDOK, 71, 220, 50, 14, BS_PUSHBUTTON - PUSHBUTTON "", IDCANCEL, 126, 220, 50, 14 - PUSHBUTTON "&...", psh3, 184, 220, 48, 14 + PUSHBUTTON "Скасувати", IDCANCEL, 126, 220, 50, 14 + PUSHBUTTON "П&ринтер...", psh3, 184, 220, 48, 14 END NEWFILEOPENORD DIALOG 0, 0, 280, 164 STYLE DS_MODALFRAME | DS_CONTEXTHELP | WS_VISIBLE | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_CLIPCHILDREN -CAPTION "³" +CAPTION "Відкрити" FONT 8, "MS Shell Dlg" { - LTEXT " &",IDC_LOOKINSTATIC,4,6,43,8, SS_NOTIFY + LTEXT "Шукати &в",IDC_LOOKINSTATIC,4,6,43,8, SS_NOTIFY COMBOBOX IDC_LOOKIN,49,3,132,100,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | WS_VSCROLL | WS_TABSTOP LTEXT "" , IDC_TOOLBARSTATIC, 181, 2, 102, 17, NOT WS_GROUP | NOT WS_VISIBLE LISTBOX IDC_SHELLSTATIC,4,20,272,85, LBS_SORT | LBS_NOINTEGRALHEIGHT | LBS_MULTICOLUMN | WS_HSCROLL | NOT WS_VISIBLE - LTEXT "' &:",IDC_FILENAMESTATIC,5,112,46,8, SS_NOTIFY + LTEXT "Ім'я &файлу:",IDC_FILENAMESTATIC,5,112,46,8, SS_NOTIFY EDITTEXT IDC_FILENAME,54,110,155,12,ES_AUTOHSCROLL - LTEXT " &",IDC_FILETYPESTATIC,5,128,42,8, SS_NOTIFY + LTEXT "Файли &типу",IDC_FILETYPESTATIC,5,128,42,8, SS_NOTIFY COMBOBOX IDC_FILETYPE,54,126,155,53,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL " &",IDC_OPENREADONLY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,54,145,100,10 + CONTROL "Лише для &читання",IDC_OPENREADONLY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,54,145,100,10 - DEFPUSHBUTTON "&³", IDOK,222,110,50,14 - PUSHBUTTON "", IDCANCEL,222,128,50,14 - PUSHBUTTON "&", pshHelp,222,145,50,14 + DEFPUSHBUTTON "&Відкрити", IDOK,222,110,50,14 + PUSHBUTTON "Скасувати", IDCANCEL,222,128,50,14 + PUSHBUTTON "&Довідка", pshHelp,222,145,50,14 } STRINGTABLE { - IDS_ABOUTBOX "& " - IDS_DOCUMENTFOLDERS " " - IDS_PERSONAL " " - IDS_FAVORITES "" - IDS_PATH " " - IDS_DESKTOP "" - IDS_FONTS "" - IDS_MYCOMPUTER "̳ '" + IDS_ABOUTBOX "&Про тест ВибірТеки" + IDS_DOCUMENTFOLDERS "Теки документів" + IDS_PERSONAL "Мої документи" + IDS_FAVORITES "Закладки" + IDS_PATH "Системний шлях" + IDS_DESKTOP "Стільниця" + IDS_FONTS "Шрифти" + IDS_MYCOMPUTER "Мій комп'ютер" } STRINGTABLE { - IDS_SYSTEMFOLDERS " " - IDS_LOCALHARDRIVES " " - IDS_FILENOTFOUND " " - IDS_VERIFYFILE ", ' " - IDS_CREATEFILE " \n ?" - IDS_OVERWRITEFILE " .\n ?" - IDS_INVALID_FILENAME_TITLE " " - IDS_INVALID_FILENAME "' :\n / : < > |" - IDS_PATHNOTEXISTING " " - IDS_FILENOTEXISTING " " + IDS_SYSTEMFOLDERS "Системні теки" + IDS_LOCALHARDRIVES "Локальні жорсткі диски" + IDS_FILENOTFOUND "Файл не знайдено" + IDS_VERIFYFILE "Перевірте, чи правильно вказано ім'я файлу" + IDS_CREATEFILE "Файл не існує\nЧи хочете Ви його створити?" + IDS_OVERWRITEFILE "Файл уже існує.\nЗамінити його?" + IDS_INVALID_FILENAME_TITLE "Невірний символ в запису шляху" + IDS_INVALID_FILENAME "Ім'я файлу не може містити наступні символи:\n / : < > |" + IDS_PATHNOTEXISTING "Шлях не існує" + IDS_FILENOTEXISTING "Файл не існує" } STRINGTABLE { - IDS_UPFOLDER " " - IDS_NEWFOLDER " " - IDS_LISTVIEW "" - IDS_REPORTVIEW "" - IDS_TODESKTOP " " + IDS_UPFOLDER "Вгору на один рівень" + IDS_NEWFOLDER "Створити нову теку" + IDS_LISTVIEW "Список" + IDS_REPORTVIEW "Подробиці" + IDS_TODESKTOP "Перехід на стільницю" } STRINGTABLE { - PD32_PRINT_TITLE "" + PD32_PRINT_TITLE "Друк" - PD32_VALUE_UREADABLE " " - PD32_INVALID_PAGE_RANGE " \n\ - %d %d" - PD32_FROM_NOT_ABOVE_TO " ² :" - PD32_MARGINS_OVERLAP " \ - .\n " - PD32_NR_OF_COPIES_EMPTY " \ -" - PD32_TOO_LARGE_COPIES " \ - .\n 1 %d" - PD32_PRINT_ERROR " " - PD32_NO_DEFAULT_PRINTER " , " - PD32_CANT_FIND_PRINTER " " - PD32_OUT_OF_MEMORY " '" - PD32_GENERIC_ERROR "() ()" - PD32_DRIVER_UNKNOWN " " - PD32_NO_DEVICES " \ - . \ - ." + PD32_VALUE_UREADABLE "Нечитаємий елемент" + PD32_INVALID_PAGE_RANGE "Це значення не лежить у діапазоні сторінок\n\ +Введіть значенне між %d та %d" + PD32_FROM_NOT_ABOVE_TO "Значення ВІД не повинно перевищувати ДО:" + PD32_MARGINS_OVERLAP "Межі перекривають чи перевищують \ +розміри паперу.\nВведіть їх наново" + PD32_NR_OF_COPIES_EMPTY "Значення Числа Копій не може бути \ +пустим" + PD32_TOO_LARGE_COPIES "Така велика кількість копій не \ +може бути надрукована Вашим принтером.\nВведіть значення між 1 та %d" + PD32_PRINT_ERROR "Виникла помилка принтера" + PD32_NO_DEFAULT_PRINTER "Немає принтера, поставленого за обумовленням" + PD32_CANT_FIND_PRINTER "Не вдалось знайти принтер" + PD32_OUT_OF_MEMORY "Мало пам'яті" + PD32_GENERIC_ERROR "Виникла(и) помилка(и)" + PD32_DRIVER_UNKNOWN "Невідомий драйвер принтера" + PD32_NO_DEVICES "Перед запуском таких дій як налаштування \ +сторінки чи друкування вам треба встановити принтер. \ +Встановіть принтер та спробуйте знов." - PD32_DEFAULT_PRINTER " ; " - PD32_NR_OF_DOCUMENTS_IN_QUEUE "%d " - PD32_MARGINS_IN_INCHES " []" - PD32_MARGINS_IN_MILLIMETERS " []" - PD32_MILLIMETERS "" + PD32_DEFAULT_PRINTER "Принтер за обумовленням; " + PD32_NR_OF_DOCUMENTS_IN_QUEUE "%d документів у черзі" + PD32_MARGINS_IN_INCHES "Межі [дюйми]" + PD32_MARGINS_IN_MILLIMETERS "Межі [мм]" + PD32_MILLIMETERS "мм" - PD32_PRINTER_STATUS_READY "" - PD32_PRINTER_STATUS_PAUSED "; " - PD32_PRINTER_STATUS_ERROR "; " - PD32_PRINTER_STATUS_PENDING_DELETION " ; " - PD32_PRINTER_STATUS_PAPER_JAM " ; " - PD32_PRINTER_STATUS_PAPER_OUT " ; " - PD32_PRINTER_STATUS_MANUAL_FEED " ; " - PD32_PRINTER_STATUS_PAPER_PROBLEM " ; " - PD32_PRINTER_STATUS_OFFLINE " offline; " - PD32_PRINTER_STATUS_IO_ACTIVE "/ ; " - PD32_PRINTER_STATUS_BUSY "; " - PD32_PRINTER_STATUS_PRINTING " ; " - PD32_PRINTER_STATUS_OUTPUT_BIN_FULL " ; " - PD32_PRINTER_STATUS_NOT_AVAILABLE " ; " - PD32_PRINTER_STATUS_WAITING "; " - PD32_PRINTER_STATUS_PROCESSING "; " - PD32_PRINTER_STATUS_INITIALIZING "; " - PD32_PRINTER_STATUS_WARMING_UP "; " - PD32_PRINTER_STATUS_TONER_LOW " ; " - PD32_PRINTER_STATUS_NO_TONER " ; " + PD32_PRINTER_STATUS_READY "Готово" + PD32_PRINTER_STATUS_PAUSED "Призупинено; " + PD32_PRINTER_STATUS_ERROR "Помилка; " + PD32_PRINTER_STATUS_PENDING_DELETION "Чекання видалення; " + PD32_PRINTER_STATUS_PAPER_JAM "Папір застряг; " + PD32_PRINTER_STATUS_PAPER_OUT "Не вистачає паперу; " + PD32_PRINTER_STATUS_MANUAL_FEED "Поставте папір вручну; " + PD32_PRINTER_STATUS_PAPER_PROBLEM "Проблема с папером; " + PD32_PRINTER_STATUS_OFFLINE "Принтер в режимі offline; " + PD32_PRINTER_STATUS_IO_ACTIVE "Ввід/Вивід активний; " + PD32_PRINTER_STATUS_BUSY "Зайнятий; " + PD32_PRINTER_STATUS_PRINTING "Йде друк; " + PD32_PRINTER_STATUS_OUTPUT_BIN_FULL "Лоток переповнений папером; " + PD32_PRINTER_STATUS_NOT_AVAILABLE "Не доступний; " + PD32_PRINTER_STATUS_WAITING "Чекання; " + PD32_PRINTER_STATUS_PROCESSING "Обробка; " + PD32_PRINTER_STATUS_INITIALIZING "Готування; " + PD32_PRINTER_STATUS_WARMING_UP "Прогрів; " + PD32_PRINTER_STATUS_TONER_LOW "Тонер при кінці; " + PD32_PRINTER_STATUS_NO_TONER "Нема тонера; " PD32_PRINTER_STATUS_PAGE_PUNT "Page punt; " - PD32_PRINTER_STATUS_USER_INTERVENTION " ; " - PD32_PRINTER_STATUS_OUT_OF_MEMORY " '; " - PD32_PRINTER_STATUS_DOOR_OPEN " ; " - PD32_PRINTER_STATUS_SERVER_UNKNOWN " ; " - PD32_PRINTER_STATUS_POWER_SAVE " ; " + PD32_PRINTER_STATUS_USER_INTERVENTION "Перервано користувачем; " + PD32_PRINTER_STATUS_OUT_OF_MEMORY "Мало пам'яті; " + PD32_PRINTER_STATUS_DOOR_OPEN "Кришка принтера відкрита; " + PD32_PRINTER_STATUS_SERVER_UNKNOWN "Невідомий сервер принтера; " + PD32_PRINTER_STATUS_POWER_SAVE "Живлення в безпечному режимі; " } STRINGTABLE /* Font styles */ { - IDS_FONT_REGULAR "" - IDS_FONT_BOLD "" - IDS_FONT_ITALIC "" - IDS_FONT_BOLD_ITALIC " " + IDS_FONT_REGULAR "Нормальний" + IDS_FONT_BOLD "Жирний" + IDS_FONT_ITALIC "Курсив" + IDS_FONT_BOLD_ITALIC "Жирний курсив" } STRINGTABLE /* Color names */ { - IDS_COLOR_BLACK "" - IDS_COLOR_MAROON "" - IDS_COLOR_GREEN "" - IDS_COLOR_OLIVE "" - IDS_COLOR_NAVY "-" - IDS_COLOR_PURPLE "" - IDS_COLOR_TEAL "-" - IDS_COLOR_GRAY "ѳ" - IDS_COLOR_SILVER "" - IDS_COLOR_RED "" - IDS_COLOR_LIME "" - IDS_COLOR_YELLOW "" - IDS_COLOR_BLUE "" - IDS_COLOR_FUCHSIA "" - IDS_COLOR_AQUA "" - IDS_COLOR_WHITE "" + IDS_COLOR_BLACK "Чорний" + IDS_COLOR_MAROON "Коричневий" + IDS_COLOR_GREEN "Зелений" + IDS_COLOR_OLIVE "Оливковий" + IDS_COLOR_NAVY "Темно-синій" + IDS_COLOR_PURPLE "Пурпуровий" + IDS_COLOR_TEAL "Синьо-зелений" + IDS_COLOR_GRAY "Сірий" + IDS_COLOR_SILVER "Сріблястий" + IDS_COLOR_RED "Червоний" + IDS_COLOR_LIME "Салатовий" + IDS_COLOR_YELLOW "Жовтий" + IDS_COLOR_BLUE "Синій" + IDS_COLOR_FUCHSIA "Малиновий" + IDS_COLOR_AQUA "Блакитний" + IDS_COLOR_WHITE "Білий" } STRINGTABLE { - IDS_FONT_SIZE " %d - %d ." - IDS_SAVE_BUTTON "&" - IDS_SAVE_IN " &:" - IDS_SAVE "" - IDS_SAVE_AS " " - IDS_OPEN_FILE "³ " + IDS_FONT_SIZE "Биберіть шрифт розміром %d - %d пунктів." + IDS_SAVE_BUTTON "&Зберегти" + IDS_SAVE_IN "Зберегти &в:" + IDS_SAVE "Зберегти" + IDS_SAVE_AS "Зберегти як" + IDS_OPEN_FILE "Відкрити файл" } diff --git a/dll/win32/comdlg32/rsrc.rc b/dll/win32/comdlg32/rsrc.rc index 0389e7ddb97..0c204beba0e 100644 --- a/dll/win32/comdlg32/rsrc.rc +++ b/dll/win32/comdlg32/rsrc.rc @@ -55,7 +55,6 @@ #include "cdlg_Sv.rc" #include "cdlg_Th.rc" #include "cdlg_Tr.rc" -#include "cdlg_Uk.rc" /* UTF-8 */ #include "cdlg_Da.rc" @@ -71,4 +70,5 @@ #include "cdlg_Ru.rc" #include "cdlg_Si.rc" #include "cdlg_Sr.rc" +#include "cdlg_Uk.rc" #include "cdlg_Zh.rc" diff --git a/dll/win32/crtdll/CMakeLists.txt b/dll/win32/crtdll/CMakeLists.txt index f81cb48dc2f..3bc01d6a721 100644 --- a/dll/win32/crtdll/CMakeLists.txt +++ b/dll/win32/crtdll/CMakeLists.txt @@ -17,19 +17,20 @@ list(APPEND SOURCE crtdll.rc ${CMAKE_CURRENT_BINARY_DIR}/crtdll.def) -add_library(crtdll SHARED - ${CMAKE_CURRENT_BINARY_DIR}/crtdll_precomp.h.gch - ${SOURCE}) +add_library(crtdll SHARED ${SOURCE}) set_module_type(crtdll win32dll) set_entrypoint(crtdll DllMain@12) -target_link_libraries(crtdll - wine - crt) +target_link_libraries(crtdll wine crt) + +if(MSVC) + add_importlibs(crtdll msvcrt) + target_link_libraries(crtdll oldnames) +endif() add_importlibs(crtdll kernel32 ntdll) -add_pch(crtdll ${CMAKE_CURRENT_SOURCE_DIR}/precomp.h ${SOURCE}) +add_pch(crtdll precomp.h) add_cd_file(TARGET crtdll DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/crtdll/crtdll.def b/dll/win32/crtdll/crtdll.def deleted file mode 100644 index 73e6ad1f60e..00000000000 --- a/dll/win32/crtdll/crtdll.def +++ /dev/null @@ -1,530 +0,0 @@ - -LIBRARY crtdll.dll - -EXPORTS - ??2@YAPAXI@Z=msvcrt.??2@YAPAXI@Z @1 - ??3@YAXPAX@Z=msvcrt.??3@YAXPAX@Z @2 - ?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z=msvcrt.?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z @3 - _CIacos=msvcrt._CIacos @4 - _CIasin=msvcrt._CIasin @5 - _CIatan=msvcrt._CIatan @6 - _CIatan2=msvcrt._CIatan2 @7 - _CIcos=msvcrt._CIcos @8 - _CIcosh=msvcrt._CIcosh @9 - _CIexp=msvcrt._CIexp @10 - _CIfmod=msvcrt._CIfmod @11 - _CIlog=msvcrt._CIlog @12 - _CIlog10=msvcrt._CIlog10 @13 - _CIpow=msvcrt._CIpow @14 - _CIsin=msvcrt._CIsin @15 - _CIsinh=msvcrt._CIsinh @16 - _CIsqrt=msvcrt._CIsqrt @17 - _CItan=msvcrt._CItan @18 - _CItanh=msvcrt._CItanh @19 - _HUGE_dll=msvcrt._HUGE @20 DATA - _XcptFilter=msvcrt._XcptFilter @21 - __GetMainArgs @22 - __argc_dll=msvcrt.__argc @23 DATA - __argv_dll=msvcrt.__argv @24 DATA - __dllonexit=msvcrt.__dllonexit @25 - __doserrno=msvcrt.__doserrno @26 - __fpecode=msvcrt.__fpecode @27 - __isascii=msvcrt.__isascii @28 - __iscsym=msvcrt.__iscsym @29 - __iscsymf=msvcrt.__iscsymf @30 - __mb_cur_max_dll=msvcrt.__mb_cur_max @31 DATA - __pxcptinfoptrs=msvcrt.__pxcptinfoptrs @32 - __threadhandle=msvcrt.__threadhandle @33 - __threadid=msvcrt.__threadid @34 - __toascii=msvcrt.__toascii @35 - _abnormal_termination=msvcrt._abnormal_termination @36 - _access=msvcrt._access @37 - _acmdln_dll=msvcrt._acmdln @38 DATA - _aexit_rtn_dll=msvcrt._aexit_rtn @39 DATA - _amsg_exit=msvcrt._amsg_exit @40 - _assert=msvcrt._assert @41 - _basemajor_dll=CRTDLL__basemajor_dll @42 DATA - _baseminor_dll=CRTDLL__baseminor_dll @43 DATA - _baseversion_dll=CRTDLL__baseversion_dll @44 DATA - _beep=msvcrt._beep @45 - _beginthread=msvcrt._beginthread @46 - _c_exit=msvcrt._c_exit @47 - _cabs=msvcrt._cabs @48 - _cexit=msvcrt._cexit @49 - _cgets=msvcrt._cgets @50 - _chdir=msvcrt._chdir @51 - _chdrive=msvcrt._chdrive @52 - _chgsign=msvcrt._chgsign @53 - _chmod=msvcrt._chmod @54 - _chsize=msvcrt._chsize @55 - _clearfp=msvcrt._clearfp @56 - _close=msvcrt._close @57 - _commit=msvcrt._commit @58 - _commode_dll=msvcrt._commode @59 DATA - _control87=msvcrt._control87 @60 - _controlfp=msvcrt._controlfp @61 - _copysign=msvcrt._copysign @62 - _cprintf=msvcrt._cprintf @63 - _cpumode_dll=CRTDLL__cpumode_dll @64 DATA - _cputs=msvcrt._cputs @65 - _creat=msvcrt._creat @66 - _cscanf=msvcrt._cscanf @67 - _ctype=msvcrt._ctype @68 DATA - _cwait=msvcrt._cwait @69 - _daylight_dll=msvcrt._daylight @70 DATA - _dup=msvcrt._dup @71 - _dup2=msvcrt._dup2 @72 - _ecvt=msvcrt._ecvt @73 - _endthread=msvcrt._endthread @74 - _environ_dll=msvcrt._environ @75 DATA - _eof=msvcrt._eof @76 - _errno=msvcrt._errno @77 - _except_handler2=msvcrt._except_handler2 @78 - _execl=msvcrt._execl @79 - _execle=msvcrt._execle @80 - _execlp=msvcrt._execlp @81 - _execlpe=msvcrt._execlpe @82 - _execv=msvcrt._execv @83 - _execve=msvcrt._execve @84 - _execvp=msvcrt._execvp @85 - _execvpe=msvcrt._execvpe @86 - _exit=msvcrt._exit @87 - _expand=msvcrt._expand @88 - _fcloseall=msvcrt._fcloseall @89 - _fcvt=msvcrt._fcvt @90 - _fdopen=msvcrt._fdopen @91 - _fgetchar=msvcrt._fgetchar @92 - _fgetwchar=msvcrt._fgetwchar @93 - _filbuf=msvcrt._filbuf @94 - _fileinfo_dll=msvcrt._fileinfo @95 DATA - _filelength=msvcrt._filelength @96 - _fileno=msvcrt._fileno @97 - _findclose=msvcrt._findclose @98 - _findfirst=msvcrt._findfirst @99 - _findnext=msvcrt._findnext @100 - _finite=msvcrt._finite @101 - _flsbuf=msvcrt._flsbuf @102 - _flushall=msvcrt._flushall @103 - _fmode_dll=msvcrt._fmode @104 DATA - _fpclass=msvcrt._fpclass @105 - _fpieee_flt=msvcrt._fpieee_flt @106 - _fpreset=msvcrt._fpreset @107 - _fputchar=msvcrt._fputchar @108 - _fputwchar=msvcrt._fputwchar @109 - _fsopen=msvcrt._fsopen @110 - _fstat=CRTDLL__fstat @111 - _ftime=msvcrt._ftime @112 - _ftol=msvcrt._ftol @113 - _fullpath=msvcrt._fullpath @114 - _futime=msvcrt._futime @115 - _gcvt=msvcrt._gcvt @116 - _get_osfhandle=msvcrt._get_osfhandle @117 - _getch=msvcrt._getch @118 - _getche=msvcrt._getche @119 - _getcwd=msvcrt._getcwd @120 - _getdcwd=msvcrt._getdcwd @121 - _getdiskfree=msvcrt._getdiskfree @122 - _getdllprocaddr=msvcrt._getdllprocaddr @123 - _getdrive=msvcrt._getdrive @124 - _getdrives=msvcrt._getdrives @125 - _getpid=msvcrt._getpid @126 - _getsystime=msvcrt._getsystime @127 - _getw=msvcrt._getw @128 - _global_unwind2=msvcrt._global_unwind2 @129 - _heapchk=msvcrt._heapchk @130 - _heapmin=msvcrt._heapmin @131 - _heapset=msvcrt._heapset @132 - _heapwalk=msvcrt._heapwalk @133 - _hypot=msvcrt._hypot @134 - _initterm=msvcrt._initterm @135 - _iob=msvcrt._iob @136 DATA - _isatty=msvcrt._isatty @137 - _isctype=msvcrt._isctype @138 - _ismbbalnum=msvcrt._ismbbalnum @139 - _ismbbalpha=msvcrt._ismbbalpha @140 - _ismbbgraph=msvcrt._ismbbgraph @141 - _ismbbkalnum=msvcrt._ismbbkalnum @142 - _ismbbkana=msvcrt._ismbbkana @143 - _ismbbkpunct=msvcrt._ismbbkpunct @144 - _ismbblead=msvcrt._ismbblead @145 - _ismbbprint=msvcrt._ismbbprint @146 - _ismbbpunct=msvcrt._ismbbpunct @147 - _ismbbtrail=msvcrt._ismbbtrail @148 - _ismbcalpha=msvcrt._ismbcalpha @149 - _ismbcdigit=msvcrt._ismbcdigit @150 - _ismbchira=msvcrt._ismbchira @151 - _ismbckata=msvcrt._ismbckata @152 - _ismbcl0=msvcrt._ismbcl0 @153 - _ismbcl1=msvcrt._ismbcl1 @154 - _ismbcl2=msvcrt._ismbcl2 @155 - _ismbclegal=msvcrt._ismbclegal @156 - _ismbclower=msvcrt._ismbclower @157 - _ismbcprint=msvcrt._ismbcprint @158 - _ismbcspace=msvcrt._ismbcspace @159 - _ismbcsymbol=msvcrt._ismbcsymbol @160 - _ismbcupper=msvcrt._ismbcupper @161 - _ismbslead=msvcrt._ismbslead @162 - _ismbstrail=msvcrt._ismbstrail @163 - _isnan=msvcrt._isnan @164 - _itoa=msvcrt._itoa @165 - _itow=msvcrt._itow @166 - _j0=msvcrt._j0 @167 - _j1=msvcrt._j1 @168 - _jn=msvcrt._jn @169 - _kbhit=msvcrt._kbhit @170 - _lfind=msvcrt._lfind @171 - _loaddll=msvcrt._loaddll @172 - _local_unwind2=msvcrt._local_unwind2 @173 - _locking=msvcrt._locking @174 - _logb=msvcrt._logb @175 - _lrotl=msvcrt._lrotl @176 - _lrotr=msvcrt._lrotr @177 - _lsearch=msvcrt._lsearch @178 - _lseek=msvcrt._lseek @179 - _ltoa=msvcrt._ltoa @180 - _ltow=msvcrt._ltow @181 - _makepath=msvcrt._makepath @182 - _matherr=msvcrt._matherr @183 - _mbbtombc=msvcrt._mbbtombc @184 - _mbbtype=msvcrt._mbbtype @185 - _mbccpy=msvcrt._mbccpy @186 - _mbcjistojms=msvcrt._mbcjistojms @187 - _mbcjmstojis=msvcrt._mbcjmstojis @188 - _mbclen=msvcrt._mbclen @189 - _mbctohira=msvcrt._mbctohira @190 - _mbctokata=msvcrt._mbctokata @191 - _mbctolower=msvcrt._mbctolower @192 - _mbctombb=msvcrt._mbctombb @193 - _mbctoupper=msvcrt._mbctoupper @194 - _mbctype=msvcrt._mbctype @195 DATA - _mbsbtype=msvcrt._mbsbtype @196 - _mbscat=msvcrt._mbscat @197 - _mbschr=msvcrt._mbschr @198 - _mbscmp=msvcrt._mbscmp @199 - _mbscpy=msvcrt._mbscpy @200 - _mbscspn=msvcrt._mbscspn @201 - _mbsdec=msvcrt._mbsdec @202 - _mbsdup=msvcrt._mbsdup @203 - _mbsicmp=msvcrt._mbsicmp @204 - _mbsinc=msvcrt._mbsinc @205 - _mbslen=msvcrt._mbslen @206 - _mbslwr=msvcrt._mbslwr @207 - _mbsnbcat=msvcrt._mbsnbcat @208 - _mbsnbcmp=msvcrt._mbsnbcmp @209 - _mbsnbcnt=msvcrt._mbsnbcnt @210 - _mbsnbcpy=msvcrt._mbsnbcpy @211 - _mbsnbicmp=msvcrt._mbsnbicmp @212 - _mbsnbset=msvcrt._mbsnbset @213 - _mbsncat=msvcrt._mbsncat @214 - _mbsnccnt=msvcrt._mbsnccnt @215 - _mbsncmp=msvcrt._mbsncmp @216 - _mbsncpy=msvcrt._mbsncpy @217 - _mbsnextc=msvcrt._mbsnextc @218 - _mbsnicmp=msvcrt._mbsnicmp @219 - _mbsninc=msvcrt._mbsninc @220 - _mbsnset=msvcrt._mbsnset @221 - _mbspbrk=msvcrt._mbspbrk @222 - _mbsrchr=msvcrt._mbsrchr @223 - _mbsrev=msvcrt._mbsrev @224 - _mbsset=msvcrt._mbsset @225 - _mbsspn=msvcrt._mbsspn @226 - _mbsspnp=msvcrt._mbsspnp @227 - _mbsstr=msvcrt._mbsstr @228 - _mbstok=msvcrt._mbstok @229 - _mbstrlen=msvcrt._mbstrlen @230 - _mbsupr=msvcrt._mbsupr @231 - _memccpy=msvcrt._memccpy @232 - _memicmp=msvcrt._memicmp @233 - _mkdir=msvcrt._mkdir @234 - _mktemp=msvcrt._mktemp @235 - _msize=msvcrt._msize @236 - _nextafter=msvcrt._nextafter @237 - _onexit=msvcrt._onexit @238 - _open=msvcrt._open @239 - _open_osfhandle=msvcrt._open_osfhandle @240 - _osmajor_dll=CRTDLL__osmajor_dll @241 DATA - _osminor_dll=CRTDLL__osminor_dll @242 DATA - _osmode_dll=CRTDLL__osmode_dll @243 DATA - _osver_dll=msvcrt._osver @244 DATA - _osversion_dll=CRTDLL__osversion_dll @245 DATA - _pclose=msvcrt._pclose @246 - _pctype_dll=msvcrt._pctype @247 DATA - _pgmptr_dll=msvcrt._pgmptr @248 DATA - _pipe=msvcrt._pipe @249 - _popen=msvcrt._popen @250 - _purecall=msvcrt._purecall @251 - _putch=msvcrt._putch @252 - _putenv=msvcrt._putenv @253 - _putw=msvcrt._putw @254 - _pwctype_dll=msvcrt._pwctype @255 DATA - _read=msvcrt._read @256 - _rmdir=msvcrt._rmdir @257 - _rmtmp=msvcrt._rmtmp @258 - _rotl=msvcrt._rotl @259 - _rotr=msvcrt._rotr @260 - _scalb=msvcrt._scalb @261 - _searchenv=msvcrt._searchenv @262 - _seterrormode=msvcrt._seterrormode @263 - _setjmp=msvcrt._setjmp @264 - _setmode=msvcrt._setmode @265 - _setsystime=msvcrt._setsystime @266 - _sleep=msvcrt._sleep @267 - _snprintf=msvcrt._snprintf @268 - _snwprintf=msvcrt._snwprintf @269 - _sopen=msvcrt._sopen @270 - _spawnl=msvcrt._spawnl @271 - _spawnle=msvcrt._spawnle @272 - _spawnlp=msvcrt._spawnlp @273 - _spawnlpe=msvcrt._spawnlpe @274 - _spawnv=msvcrt._spawnv @275 - _spawnve=msvcrt._spawnve @276 - _spawnvp=msvcrt._spawnvp @277 - _spawnvpe=msvcrt._spawnvpe @278 - _splitpath=msvcrt._splitpath @279 - _stat=CRTDLL__stat @280 - _statusfp=msvcrt._statusfp @281 - _strcmpi=msvcrt._strcmpi @282 - _strdate=msvcrt._strdate @283 - _strdec @284 - _strdup=msvcrt._strdup @285 - _strerror=msvcrt._strerror @286 - _stricmp=msvcrt._stricmp @287 - _stricoll=msvcrt._stricoll @288 - _strinc @289 - _strlwr=msvcrt._strlwr @290 - _strncnt @291 - _strnextc @292 - _strnicmp=msvcrt._strnicmp @293 - _strninc @294 - _strnset=msvcrt._strnset @295 - _strrev=msvcrt._strrev @296 - _strset=msvcrt._strset @297 - _strspnp @298 - _strtime=msvcrt._strtime @299 - _strupr=msvcrt._strupr @300 - _swab=msvcrt._swab @301 - _sys_errlist=msvcrt._sys_errlist @302 DATA - _sys_nerr_dll=msvcrt._sys_nerr @303 DATA - _tell=msvcrt._tell @304 - _tempnam=msvcrt._tempnam @305 - _timezone_dll=msvcrt._timezone @306 DATA - _tolower=msvcrt._tolower @307 - _toupper=msvcrt._toupper @308 - _tzname=msvcrt._tzname @309 DATA - _tzset=msvcrt._tzset @310 - _ultoa=msvcrt._ultoa @311 - _ultow=msvcrt._ultow @312 - _umask=msvcrt._umask @313 - _ungetch=msvcrt._ungetch @314 - _unlink=msvcrt._unlink @315 - _unloaddll=msvcrt._unloaddll @316 - _utime=msvcrt._utime @317 - _vsnprintf=msvcrt._vsnprintf @318 - _vsnwprintf=msvcrt._vsnwprintf @319 - _wcsdup=msvcrt._wcsdup @320 - _wcsicmp=msvcrt._wcsicmp @321 - _wcsicoll=msvcrt._wcsicoll @322 - _wcslwr=msvcrt._wcslwr @323 - _wcsnicmp=msvcrt._wcsnicmp @324 - _wcsnset=msvcrt._wcsnset @325 - _wcsrev=msvcrt._wcsrev @326 - _wcsset=msvcrt._wcsset @327 - _wcsupr=msvcrt._wcsupr @328 - _winmajor_dll=msvcrt._winmajor @329 DATA - _winminor_dll=msvcrt._winminor @330 DATA - _winver_dll=msvcrt._winver @331 DATA - _write=msvcrt._write @332 - _wtoi=msvcrt._wtoi @333 - _wtol=msvcrt._wtol @334 - _y0=msvcrt._y0 @335 - _y1=msvcrt._y1 @336 - _yn=msvcrt._yn @337 - abort=msvcrt.abort @338 - abs=msvcrt.abs @339 - acos=msvcrt.acos @340 - asctime=msvcrt.asctime @341 - asin=msvcrt.asin @342 - atan=msvcrt.atan @343 - atan2=msvcrt.atan2 @344 - atexit=msvcrt.atexit @345 - atof=msvcrt.atof @346 - atoi=msvcrt.atoi @347 - atol=msvcrt.atol @348 - bsearch=msvcrt.bsearch @349 - calloc=msvcrt.calloc @350 - ceil=msvcrt.ceil @351 - clearerr=msvcrt.clearerr @352 - clock=msvcrt.clock @353 - cos=msvcrt.cos @354 - cosh=msvcrt.cosh @355 - ctime=msvcrt.ctime @356 - difftime=msvcrt.difftime @357 - div=msvcrt.div @358 - exit=msvcrt.exit @359 - exp=msvcrt.exp @360 - fabs=msvcrt.fabs @361 - fclose=msvcrt.fclose @362 - feof=msvcrt.feof @363 - ferror=msvcrt.ferror @364 - fflush=msvcrt.fflush @365 - fgetc=msvcrt.fgetc @366 - fgetpos=msvcrt.fgetpos @367 - fgets=msvcrt.fgets @368 - fgetwc=msvcrt.fgetwc @369 - floor=msvcrt.floor @370 - fmod=msvcrt.fmod @371 - fopen=msvcrt.fopen @372 - fprintf=msvcrt.fprintf @373 - fputc=msvcrt.fputc @374 - fputs=msvcrt.fputs @375 - fputwc=msvcrt.fputwc @376 - fread=msvcrt.fread @377 - free=msvcrt.free @378 - freopen=msvcrt.freopen @379 - frexp=msvcrt.frexp @380 - fscanf=msvcrt.fscanf @381 - fseek=msvcrt.fseek @382 - fsetpos=msvcrt.fsetpos @383 - ftell=msvcrt.ftell @384 - fwprintf=msvcrt.fwprintf @385 - fwrite=msvcrt.fwrite @386 - fwscanf=msvcrt.fwscanf @387 - getc=msvcrt.getc @388 - getchar=msvcrt.getchar @389 - getenv=msvcrt.getenv @390 - gets=msvcrt.gets @391 - gmtime=msvcrt.gmtime @392 - is_wctype=msvcrt.is_wctype @393 - isalnum=msvcrt.isalnum @394 - isalpha=msvcrt.isalpha @395 - iscntrl=msvcrt.iscntrl @396 - isdigit=msvcrt.isdigit @397 - isgraph=msvcrt.isgraph @398 - isleadbyte=msvcrt.isleadbyte @399 - islower=msvcrt.islower @400 - isprint=msvcrt.isprint @401 - ispunct=msvcrt.ispunct @402 - isspace=msvcrt.isspace @403 - isupper=msvcrt.isupper @404 - iswalnum=msvcrt.iswalnum @405 - iswalpha=msvcrt.iswalpha @406 - iswascii=msvcrt.iswascii @407 - iswcntrl=msvcrt.iswcntrl @408 - iswctype=msvcrt.iswctype @409 - iswdigit=msvcrt.iswdigit @410 - iswgraph=msvcrt.iswgraph @411 - iswlower=msvcrt.iswlower @412 - iswprint=msvcrt.iswprint @413 - iswpunct=msvcrt.iswpunct @414 - iswspace=msvcrt.iswspace @415 - iswupper=msvcrt.iswupper @416 - iswxdigit=msvcrt.iswxdigit @417 - isxdigit=msvcrt.isxdigit @418 - labs=msvcrt.labs @419 - ldexp=msvcrt.ldexp @420 - ldiv=msvcrt.ldiv @421 - localeconv=msvcrt.localeconv @422 - localtime=msvcrt.localtime @423 - log=msvcrt.log @424 - log10=msvcrt.log10 @425 - longjmp=msvcrt.longjmp @426 - malloc=msvcrt.malloc @427 - mblen=msvcrt.mblen @428 - mbstowcs=msvcrt.mbstowcs @429 - mbtowc=msvcrt.mbtowc @430 - memchr=msvcrt.memchr @431 - memcmp=msvcrt.memcmp @432 - memcpy=msvcrt.memcpy @433 - memmove=msvcrt.memmove @434 - memset=msvcrt.memset @435 - mktime=msvcrt.mktime @436 - modf=msvcrt.modf @437 - perror=msvcrt.perror @438 - pow=msvcrt.pow @439 - printf=msvcrt.printf @440 - putc=msvcrt.putc @441 - putchar=msvcrt.putchar @442 - puts=msvcrt.puts @443 - qsort=msvcrt.qsort @444 - raise=msvcrt.raise @445 - rand=msvcrt.rand @446 - realloc=msvcrt.realloc @447 - remove=msvcrt.remove @448 - rename=msvcrt.rename @449 - rewind=msvcrt.rewind @450 - scanf=msvcrt.scanf @451 - setbuf=msvcrt.setbuf @452 - setlocale=msvcrt.setlocale @453 - setvbuf=msvcrt.setvbuf @454 - signal=msvcrt.signal @455 - sin=msvcrt.sin @456 - sinh=msvcrt.sinh @457 - sprintf=msvcrt.sprintf @458 - sqrt=msvcrt.sqrt @459 - srand=msvcrt.srand @460 - sscanf=msvcrt.sscanf @461 - strcat=msvcrt.strcat @462 - strchr=msvcrt.strchr @463 - strcmp=msvcrt.strcmp @464 - strcoll=msvcrt.strcoll @465 - strcpy=msvcrt.strcpy @466 - strcspn=msvcrt.strcspn @467 - strerror=msvcrt.strerror @468 - strftime=msvcrt.strftime @469 - strlen=msvcrt.strlen @470 - strncat=msvcrt.strncat @471 - strncmp=msvcrt.strncmp @472 - strncpy=msvcrt.strncpy @473 - strpbrk=msvcrt.strpbrk @474 - strrchr=msvcrt.strrchr @475 - strspn=msvcrt.strspn @476 - strstr=msvcrt.strstr @477 - strtod=msvcrt.strtod @478 - strtok=msvcrt.strtok @479 - strtol=msvcrt.strtol @480 - strtoul=msvcrt.strtoul @481 - strxfrm=msvcrt.strxfrm @482 - swprintf=msvcrt.swprintf @483 - swscanf=msvcrt.swscanf @484 - system=msvcrt.system @485 - tan=msvcrt.tan @486 - tanh=msvcrt.tanh @487 - time=msvcrt.time @488 - tmpfile=msvcrt.tmpfile @489 - tmpnam=msvcrt.tmpnam @490 - tolower=msvcrt.tolower @491 - toupper=msvcrt.toupper @492 - towlower=msvcrt.towlower @493 - towupper=msvcrt.towupper @494 - ungetc=msvcrt.ungetc @495 - ungetwc=msvcrt.ungetwc @496 - vfprintf=msvcrt.vfprintf @497 - vfwprintf=msvcrt.vfwprintf @498 - vprintf=msvcrt.vprintf @499 - vsprintf=msvcrt.vsprintf @500 - vswprintf=msvcrt.vswprintf @501 - vwprintf=msvcrt.vwprintf @502 - wcscat=msvcrt.wcscat @503 - wcschr=msvcrt.wcschr @504 - wcscmp=msvcrt.wcscmp @505 - wcscoll=msvcrt.wcscoll @506 - wcscpy=msvcrt.wcscpy @507 - wcscspn=msvcrt.wcscspn @508 - wcsftime=msvcrt.wcsftime @509 - wcslen=msvcrt.wcslen @510 - wcsncat=msvcrt.wcsncat @511 - wcsncmp=msvcrt.wcsncmp @512 - wcsncpy=msvcrt.wcsncpy @513 - wcspbrk=msvcrt.wcspbrk @514 - wcsrchr=msvcrt.wcsrchr @515 - wcsspn=msvcrt.wcsspn @516 - wcsstr=msvcrt.wcsstr @517 - wcstod=msvcrt.wcstod @518 - wcstok=msvcrt.wcstok @519 - wcstol=msvcrt.wcstol @520 - wcstombs=msvcrt.wcstombs @521 - wcstoul=msvcrt.wcstoul @522 - wcsxfrm=msvcrt.wcsxfrm @523 - wctomb=msvcrt.wctomb @524 - wprintf=msvcrt.wprintf @525 - wscanf=msvcrt.wscanf @526 diff --git a/dll/win32/crtdll/crtdll.spec b/dll/win32/crtdll/crtdll.spec index 091a2c42562..38f2fb36b7b 100644 --- a/dll/win32/crtdll/crtdll.spec +++ b/dll/win32/crtdll/crtdll.spec @@ -1,5 +1,5 @@ # Old C runtime library. All functions provided by msvcrt - + @ cdecl ??2@YAPAXI@Z(long) msvcrt.??2@YAPAXI@Z @ cdecl ??3@YAXPAX@Z(ptr) msvcrt.??3@YAXPAX@Z @ cdecl ?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z(ptr) msvcrt.?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z @@ -94,7 +94,7 @@ @ cdecl _fgetchar() msvcrt._fgetchar @ cdecl _fgetwchar() msvcrt._fgetwchar @ cdecl _filbuf(ptr) msvcrt._filbuf - @ extern _fileinfo_dll msvcrt._fileinfo + @ extern _fileinfo_dll @ cdecl _filelength(long) msvcrt._filelength @ cdecl _fileno(ptr) msvcrt._fileno @ cdecl _findclose(long) msvcrt._findclose @@ -166,9 +166,9 @@ @ cdecl _isnan( double ) msvcrt._isnan @ cdecl _itoa(long ptr long) msvcrt._itoa @ cdecl _itow(long ptr long) msvcrt._itow - @ cdecl _j0(double) msvcrt._j0 - @ cdecl _j1(double) msvcrt._j1 - @ cdecl _jn(long double) msvcrt._jn +# @ cdecl _j0(double) msvcrt._j0 +# @ cdecl _j1(double) msvcrt._j1 +# @ cdecl _jn(long double) msvcrt._jn @ cdecl _kbhit() msvcrt._kbhit @ cdecl _lfind(ptr ptr ptr long ptr) msvcrt._lfind @ cdecl _loaddll(str) msvcrt._loaddll @@ -334,9 +334,9 @@ @ cdecl _write(long ptr long) msvcrt._write @ cdecl _wtoi(wstr) msvcrt._wtoi @ cdecl _wtol(wstr) msvcrt._wtol - @ cdecl _y0(double) msvcrt._y0 - @ cdecl _y1(double) msvcrt._y1 - @ cdecl _yn(long double ) msvcrt._yn +# @ cdecl _y0(double) msvcrt._y0 +# @ cdecl _y1(double) msvcrt._y1 +# @ cdecl _yn(long double ) msvcrt._yn @ cdecl abort() msvcrt.abort @ cdecl abs(long) msvcrt.abs @ cdecl acos(double) msvcrt.acos diff --git a/dll/win32/crtdll/dllmain.c b/dll/win32/crtdll/dllmain.c index 8af185b01c1..a1fc3629ebf 100644 --- a/dll/win32/crtdll/dllmain.c +++ b/dll/win32/crtdll/dllmain.c @@ -46,6 +46,7 @@ unsigned int CRTDLL__osmajor_dll; unsigned int CRTDLL__osminor_dll; unsigned int CRTDLL__osmode_dll; unsigned int CRTDLL__osversion_dll; +int _fileinfo_dll; extern char* _acmdln; /* pointer to ascii command line */ extern wchar_t* _wcmdln; /* pointer to wide character command line */ @@ -140,7 +141,7 @@ DllMain(PVOID hinstDll, ULONG dwReason, PVOID reserved) if (BlockEnvToEnvironW() < 0) { - FreeEnvironment((char**)_wenviron); + FreeEnvironment((char**)_environ); return FALSE; } diff --git a/dll/win32/crypt32/CMakeLists.txt b/dll/win32/crypt32/CMakeLists.txt index c4492e3019e..22e772dd876 100644 --- a/dll/win32/crypt32/CMakeLists.txt +++ b/dll/win32/crypt32/CMakeLists.txt @@ -1,8 +1,6 @@ add_definitions( -D__WINESRC__ - -D_DLL - -D__USE_CRTIMP -D_WINE) remove_definitions(-D_WIN32_WINNT=0x502) @@ -40,7 +38,6 @@ list(APPEND SOURCE store.c str.c crypt32.rc - version.rc ${CMAKE_CURRENT_BINARY_DIR}/crypt32_stubs.c ${CMAKE_CURRENT_BINARY_DIR}/crypt32.def) @@ -54,6 +51,5 @@ target_link_libraries(crypt32 oldnames) add_importlibs(crypt32 user32 advapi32 msvcrt kernel32 ntdll) - add_cd_file(TARGET crypt32 DESTINATION reactos/system32 FOR all) add_importlib_target(crypt32.spec) diff --git a/dll/win32/dbghelp/CMakeLists.txt b/dll/win32/dbghelp/CMakeLists.txt index 4b1c073b8a8..f7f682a5891 100644 --- a/dll/win32/dbghelp/CMakeLists.txt +++ b/dll/win32/dbghelp/CMakeLists.txt @@ -1,16 +1,14 @@ add_definitions( -D__WINESRC__ - -D_DLL - -D__USE_CRTIMP -D_WINE -DHAVE_REGEX_H -DHAVE_ALLOCA_H -D_IMAGEHLP_SOURCE_) if(ARCH MATCHES amd64) -add_definitions(-DUNW_FLAG_NHANDLER=0 -DUNW_FLAG_EHANDLER=1 -DUNW_FLAG_UHANDLER=2 -DUNW_FLAG_CHAININFO=3) -endif(ARCH MATCHES amd64) + add_definitions(-DUNW_FLAG_NHANDLER=0 -DUNW_FLAG_EHANDLER=1 -DUNW_FLAG_UHANDLER=2 -DUNW_FLAG_CHAININFO=3) +endif() include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine) @@ -49,12 +47,12 @@ list(APPEND SOURCE add_library(dbghelp SHARED ${SOURCE}) set_module_type(dbghelp win32dll) - target_link_libraries(dbghelp wine ${PSEH_LIB} oldnames) add_importlibs(dbghelp psapi version msvcrt kernel32 ntdll) +add_pch(dbghelp dbghelp_private.h) add_importlib_target(dbghelp.spec) add_cd_file(TARGET dbghelp DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/dbghelp/dbghelp.rbuild b/dll/win32/dbghelp/dbghelp.rbuild index 2504aefd5e1..af9740cff36 100644 --- a/dll/win32/dbghelp/dbghelp.rbuild +++ b/dll/win32/dbghelp/dbghelp.rbuild @@ -41,6 +41,7 @@ symbol.c type.c version.rc + dbghelp_private.h wine psapi version diff --git a/dll/win32/dbghelp/rosstubs.c b/dll/win32/dbghelp/rosstubs.c index f4917899f6d..76e02d23a4a 100644 --- a/dll/win32/dbghelp/rosstubs.c +++ b/dll/win32/dbghelp/rosstubs.c @@ -18,12 +18,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#define WIN32_NO_STATUS -#include -#include - #include "dbghelp_private.h" +ULONG __cdecl DbgPrint(IN PCCH Format, IN ...); #define UNIMPLEMENTED DbgPrint("DBGHELP: %s is unimplemented, please try again later.\n", __FUNCTION__); #define PDBGHELP_CREATE_USER_DUMP_CALLBACK PVOID diff --git a/dll/win32/devmgr/CMakeLists.txt b/dll/win32/devmgr/CMakeLists.txt index 024f8df3f2a..07959c66ad5 100644 --- a/dll/win32/devmgr/CMakeLists.txt +++ b/dll/win32/devmgr/CMakeLists.txt @@ -14,7 +14,7 @@ list(APPEND SOURCE ${CMAKE_CURRENT_BINARY_DIR}/devmgr_stubs.c ${CMAKE_CURRENT_BINARY_DIR}/devmgr.def) -add_library(devmgr SHARED ${CMAKE_CURRENT_BINARY_DIR}/devmgr_precomp.h.gch ${SOURCE}) +add_library(devmgr SHARED ${SOURCE}) set_module_type(devmgr win32dll) @@ -29,7 +29,7 @@ add_importlibs(devmgr kernel32 ntdll) -add_pch(devmgr ${CMAKE_CURRENT_SOURCE_DIR}/precomp.h ${SOURCE}) +add_pch(devmgr precomp.h) add_cd_file(TARGET devmgr DESTINATION reactos/system32 FOR all) add_importlib_target(devmgr.spec) diff --git a/dll/win32/devmgr/devmgr.rc b/dll/win32/devmgr/devmgr.rc index c5541488d6f..5843b121e96 100644 --- a/dll/win32/devmgr/devmgr.rc +++ b/dll/win32/devmgr/devmgr.rc @@ -24,9 +24,12 @@ IDI_DEVMGR ICON "resources/devmgr.ico" #include "lang/id-ID.rc" #include "lang/it-IT.rc" #include "lang/no-NO.rc" -#include "lang/pl-PL.rc" #include "lang/pt-BR.rc" +#include "lang/sk-SK.rc" + +// UTF-8 +#pragma code_page(65001) +#include "lang/pl-PL.rc" #include "lang/ro-RO.rc" #include "lang/ru-RU.rc" -#include "lang/sk-SK.rc" #include "lang/uk-UA.rc" diff --git a/dll/win32/devmgr/lang/pl-PL.rc b/dll/win32/devmgr/lang/pl-PL.rc index 3f71bb18ec4..da75f0e02e7 100644 --- a/dll/win32/devmgr/lang/pl-PL.rc +++ b/dll/win32/devmgr/lang/pl-PL.rc @@ -1,11 +1,12 @@ -// Polish language resource file (Sebastian Gasiorek,Wiktor Maryniowski, 2005-12-12) /* -* update by xrogers (13.04.2007) -* xxrogers@users.sourceforge.net -* https://sourceforge.net/projects/reactospl -* -* updates by Caemyr - Olaf Siejka (Jan 2008, Jan 2010) -*/ + * translated by (Sebastian Gasiorek,Wiktor Maryniowski, 2005-12-12) + * xxrogers@users.sourceforge.net + * https://sourceforge.net/projects/reactospl + * updated by xrogers (13.04.2007) + * updated by Caemyr - Olaf Siejka (Jan 2008, Jan 2010) + * UTF-8 conversion by Caemyr (May, 2011) + * updated by Saibamen - Adam Stachowicz (saibamenppl@gmail.com) (August, 2011) + */ LANGUAGE LANG_POLISH, SUBLANG_DEFAULT @@ -15,114 +16,114 @@ BEGIN IDS_TYPE "Typ" IDS_MANUFACTURER "Producent: %1" IDS_LOCATION "Lokalizacja: %1" - IDS_STATUS "Stan urzdzenia: %1" - IDS_UNKNOWN "Niedostpne" + IDS_STATUS "Stan urządzenia: %1" + IDS_UNKNOWN "Niedostępne" IDS_LOCATIONSTR "Lokalizacja %1!u! (%2)" IDS_DEVCODE " (Kod %1!u!)" IDS_DEVCODE2 " (Kod %2!u!)" - IDS_ENABLEDEVICE "Uywaj tego urzdzenia (wczone)" - IDS_DISABLEDEVICE "Nie uywaj tego urzdzenia (wyczone)" - IDS_UNKNOWNDEVICE "Nieznane urzdzenie" - IDS_NODRIVERLOADED "Nie zainstalowano sterownika dla tego urzdzenia." - IDS_DEVONPARENT "wczone %1" + IDS_ENABLEDEVICE "Używaj tego urządzenia (włączone)" + IDS_DISABLEDEVICE "Nie używaj tego urządzenia (wyłączone)" + IDS_UNKNOWNDEVICE "Nieznane urządzenie" + IDS_NODRIVERLOADED "Nie zainstalowano sterownika dla tego urządzenia." + IDS_DEVONPARENT "włączone %1" IDS_TROUBLESHOOTDEV "&Konflikty..." - IDS_ENABLEDEV "&Wcz urzdzenie" + IDS_ENABLEDEV "&Włącz urządzenie" IDS_REINSTALLDRV "&Zainstaluj sterownik ponownie" - IDS_PROPERTIES "Waciwoc&i" + IDS_PROPERTIES "Właściwośc&i" IDS_UPDATEDRV "&Aktualizuj sterownik..." IDS_REBOOT "&Uruchom komputer ponownie..." - IDS_NOTAVAILABLE "Niedostpne" + IDS_NOTAVAILABLE "Niedostępne" IDS_NOTDIGITALLYSIGNED "Niepodpisany cyfrowo" - IDS_NODRIVERS "adne pliki sterownika nie s potrzebne albo nie zostay zaadowane dla tego urzdzenia." + IDS_NODRIVERS "Żadne pliki sterownika nie są potrzebne albo nie zostały załadowane dla tego urządzenia." END /* error messages, source: http://www.z123.org/techsupport/medm.htm */ STRINGTABLE BEGIN - IDS_DEV_NO_PROBLEM "To urzdzenie dziaa prawidowo." - IDS_DEV_NOT_CONFIGURED "To urzdzenie nie jest poprawnie skonfigurowane." - IDS_DEV_DEVLOADER_FAILED "ReactOS nie moe zaadowa sterownika dla tego urzdzenia, poniewa system raportuje dwa rodzaje magistrali typu $1." - IDS_DEV_DEVLOADER_FAILED2 "System adowania sprztu $1 nie mg zaadowa sterownika dla tego urzdzenia." - IDS_DEV_OUT_OF_MEMORY "Sterownik dla tego urzdzenia moe nie by prawidowy lub system moe nie pracowa poprawnie." - IDS_DEV_ENTRY_IS_WRONG_TYPE "Urzdzenie nie dziaa poprawnie, poniewa jeden ze sterownikw nie jest prawidowy lub jest le zarejestrowany." - IDS_DEV_LACKED_ARBITRATOR "Sterownik urzdzenia wymaga zasobw, ktrych ReactOS nie potrafi przydzieli." - IDS_DEV_BOOT_CONFIG_CONFLICT "Inne urzdzenie uywa danych zasobw." - IDS_DEV_FAILED_FILTER "Sterownik dla tego urzdzenia powinien by zainstalowany ponownie." - IDS_DEV_DEVLOADER_NOT_FOUND "Urzdzenie nie dziaa prawidowo, poniewa ReactOS nie mg zaadowa pliku $1, ktry aduje sterownik dla tego urzdzenia." - IDS_DEV_DEVLOADER_NOT_FOUND2 "Urzdzenie nie dziaa prawidowo, poniewa plik $1, ktry aduje sterownik dla tego urzdzenia jest bdny." - IDS_DEV_DEVLOADER_NOT_FOUND3 "Bd urzdzenia: Sprbuj zmieni sterownik tego urzdzenia. Jeli to nie pomoe, poszukaj rozwizania w dokumentacji sprztowej." - IDS_DEV_INVALID_DATA "Urzdzenie nie dziaa prawidowo, poniewa BIOS Twojego komputera raportuje, e zasoby dla urzdzenia nie s prawidowe." - IDS_DEV_INVALID_DATA2 "Urzdzenie nie dziaa prawidowo, poniewa BIOS urzdzenia raportuje, e zasoby dla urzdzenia nie s prawidowe. " - IDS_DEV_FAILED_START "Urzdzenie nie jest obecne, nie dziaa poprawnie lub nie wszystkie sterowniki urzdzenia zostay zainstalowane." - IDS_DEV_LIAR "ReactOS zosta zatrzymany podczs prby uruchomienia urzdzenia, dlatego nie bdzie prbowa uruchamia tego urzdzenia w przyszoci." - IDS_DEV_NORMAL_CONFLICT "Urzdzenie nie mogo odnale adnych wolnych zasobw $1." - IDS_DEV_NOT_VERIFIED "Urzdzenie nie jest obecne, nie dziaa poprawnie lub nie wszystkie sterowniki urzdzenia zostay zainstalowane." - IDS_DEV_NEED_RESTART "Urzdzenie nie bdzie dziaa prawidowo dopki nie uruchomisz ponownie komputera." - IDS_DEV_REENUMERATION "To urzdzenie powoduje konflikt zasobw." - IDS_DEV_PARTIAL_LOG_CONF "ReactOS nie mg zidentyfikowa wszystkich zasobw, ktrych uywa urzdzenie." - IDS_DEV_UNKNOWN_RESOURCE "Plik informacji sterownika $1 informuje, e urzdzenie podrzdne uywa zasobw, ktrych nie rozpoznaje urzdzenie nadrzdne." - IDS_DEV_REINSTALL "Sterownik dla tego urzdzenia powinien by zainstalowany ponownie." - IDS_DEV_REGISTRY "Wpis moe nie by prawidowy." - IDS_DEV_WILL_BE_REMOVED "ReactOS usuwa to urzdzenie." - IDS_DEV_DISABLED "Urzdzenie nie zostao uruchomione." - IDS_DEV_DISABLED2 "Urzdzenie jest Wyczone." - IDS_DEV_DEVLOADER_NOT_READY "Systemy adowania sprztu nie mgy zaadowa wymaganego sterownika." - IDS_DEV_DEVLOADER_NOT_READY2 "Karta graficzna dziaa prawidowo." - IDS_DEV_DEVLOADER_NOT_READY3 "Systemy adowania sprztu nie mgy zaadowa wymaganego sterownika." - IDS_DEV_DEVICE_NOT_THERE "Urzdzenie nie jest obecne, nie dziaa poprawnie lub nie wszystkie sterowniki urzdzenia zostay zainstalowane." - IDS_DEV_MOVED "ReactOS prbuje skonfigurowa to urzdzenie." - IDS_DEV_TOO_EARLY "ReactOS prbuje skonfigurowa to urzdzenie." - IDS_DEV_NO_VALID_LOG_CONF "ReactOS nie potrafi odnale zasobw dla tego urzdzenia." - IDS_DEV_FAILED_INSTALL "Nie zainstalowano sterownika dla tego urzdzenia." - IDS_DEV_HARDWARE_DISABLED "Urzdzenie jest wyczone, poniewa BIOS nie przydzieli adnych zasobw dla tego urzdzenia." - IDS_DEV_CANT_SHARE_IRQ "Urzdzenie da przerwa (IRQ), ktrych uywa inne urzdzenie i ktrych nie mona rozdzieli. Musisz zmieni konfliktowe ustawienia lub usun sterownik powodujcy konflikt." - IDS_DEV_FAILED_ADD "Urzdzenie nie dziaa prawidowo, poniewa $1 rwnie nie dziaa poprawnie." - IDS_DEV_DISABLED_SERVICE "ReactOS nie mg zainstalowa sterownika dla urzdzenia, poniewa nie mg uzyska dostpu do lokacji zawartej w pliku instalacyjnym." - IDS_DEV_TRANSLATION_FAILED "Sterownik nie jest przeznaczony dla tego urzdzenia." - IDS_DEV_NO_SOFTCONFIG "ReactOS nie mg okreli ustawie dla tego urzdzenia. Poszukaj rozwizania w dokumentacji urzdzenia i uyj palety ustawie zasobw, aby skonfigurowa je rcznie." - IDS_DEV_BIOS_TABLE "Firmware Twojego komputera zawiera zbyt mao informacji, aby skonfigurowa i uywa tego urzdzenia. Aby uruchomi urzdzenie, skontaktuj si z producentem w celu uaktualnienia firmware-u lub BIOS-u." - IDS_DEV_IRQ_TRANSLATION_FAILED "Urzdzenie da przerwa PCI, chocia znajduje si w ISA (lub na odwrt). Zmie ustawienia przerwa dla tego urzdzenia korzystajc z konfiguratora systemu." - IDS_DEV_FAILED_DRIVER_ENTRY "ReactOS nie mg uruchomi sterownika dla tego urzdzenia." - IDS_DEV_DRIVER_FAILED_PRIOR_UNLOAD "ReactOS nie mg uruchomi sterownika dla tego urzdzenia, poniewa poprzedni sterownik jest nadal w pamici." - IDS_DEV_DRIVER_FAILED_LOAD "ReactOS nie mg uruchomi sterownika dla tego urzdzenia. Brak sterownika lub sterownik moe by uszkodzony." - IDS_DEV_DRIVER_SERVICE_KEY_INVALID "ReactOS nie mg uzyska dostpu do sprztu, poniewa brakuje klucza w rejestrze lub klucz nie jest zapisany prawidowo." - IDS_DEV_LEGACY_SERVICE_NO_DEVICES "ReactOS pomylnie uruchomi sterownik urzdzenia, ale nie odnalaz go fizycznie." - IDS_DEV_DUPLICATE_DEVICE "ReactOS nie mg uruchomi sterownika dla tego urzdzenia, poniewa identyczne urzdzenie pracuje obecnie w systemie." - IDS_DEV_FAILED_POST_START "ReactOS przerwa prac urzdzenia, poniewa zostay zgoszone problemy." - IDS_DEV_HALTED "Program lub usuga przerwaa dziaanie urzdzenia." - IDS_DEV_PHANTOM "Obecnie urzdzenie nie jest podczone do komputera." - IDS_DEV_SYSTEM_SHUTDOWN "ReactOS nie moe uzyska dostpu do urzdzenia, poniewa trwa zamykanie systemu." - IDS_DEV_HELD_FOR_EJECT "ReactOS nie moe uzyska dostpu do urzdzenia, poniewa urzdzenie to byo przygotowane do ""bezpiecznego usunicia"", ale nie zostao odczone." - IDS_DEV_DRIVER_BLOCKED "Oprogramowanie urzdzenia zostao zablokowane przy starcie, poniewa nie wsppracuje poprawnie z systemem ReactOS. Sprbuj zainstalowa nowszy sterownik." - IDS_DEV_REGISTRY_TOO_LARGE "ReactOS nie moe uruchomi nowego urzdzenia, poniewa jdro systemu jest zbyt wielkie (przekracza limit rozmiaru rejestru)." - IDS_DEV_SETPROPERTIES_FAILED "ReactOS nie by w stanie zmieni parametrw instalacyjnych tego urzdzenia." + IDS_DEV_NO_PROBLEM "To urządzenie działa prawidłowo." + IDS_DEV_NOT_CONFIGURED "To urządzenie nie jest poprawnie skonfigurowane." + IDS_DEV_DEVLOADER_FAILED "ReactOS nie może załadować sterownika dla tego urządzenia, ponieważ system raportuje dwa rodzaje magistrali typu $1." + IDS_DEV_DEVLOADER_FAILED2 "System ładowania sprzętu $1 nie mógł załadować sterownika dla tego urządzenia." + IDS_DEV_OUT_OF_MEMORY "Sterownik dla tego urządzenia może nie być prawidłowy lub system może nie pracować poprawnie." + IDS_DEV_ENTRY_IS_WRONG_TYPE "Urządzenie nie działa poprawnie, ponieważ jeden ze sterowników nie jest prawidłowy lub jest źle zarejestrowany." + IDS_DEV_LACKED_ARBITRATOR "Sterownik urządzenia wymaga zasobów, których ReactOS nie potrafi przydzielić." + IDS_DEV_BOOT_CONFIG_CONFLICT "Inne urządzenie używa żądanych zasobów." + IDS_DEV_FAILED_FILTER "Sterownik dla tego urządzenia powinien być zainstalowany ponownie." + IDS_DEV_DEVLOADER_NOT_FOUND "Urządzenie nie działa prawidłowo, ponieważ ReactOS nie mógł załadować pliku $1, który ładuje sterownik dla tego urządzenia." + IDS_DEV_DEVLOADER_NOT_FOUND2 "Urządzenie nie działa prawidłowo, ponieważ plik $1, który ładuje sterownik dla tego urządzenia jest błędny." + IDS_DEV_DEVLOADER_NOT_FOUND3 "Błąd urządzenia: Spróbuj zmienić sterownik tego urządzenia. Jeśli to nie pomoże, poszukaj rozwiązania w dokumentacji sprzętu." + IDS_DEV_INVALID_DATA "Urządzenie nie działa prawidłowo, ponieważ BIOS Twojego komputera raportuje, że zasoby dla urządzenia nie są prawidłowe." + IDS_DEV_INVALID_DATA2 "Urządzenie nie działa prawidłowo, ponieważ BIOS urządzenia raportuje, że zasoby dla urządzenia nie są prawidłowe. " + IDS_DEV_FAILED_START "Urządzenie nie jest obecne, nie działa poprawnie lub nie wszystkie sterowniki urządzenia zostały zainstalowane." + IDS_DEV_LIAR "ReactOS został zatrzymany podczs próby uruchomienia urządzenia, dlatego nie będzie próbował uruchamiać tego urządzenia w przyszłości." + IDS_DEV_NORMAL_CONFLICT "Urządzenie nie mogło odnaleźć żadnych wolnych zasobów $1." + IDS_DEV_NOT_VERIFIED "Urządzenie nie jest obecne, nie działa poprawnie lub nie wszystkie sterowniki urządzenia zostały zainstalowane." + IDS_DEV_NEED_RESTART "Urządzenie nie będzie działać prawidłowo dopóki nie uruchomisz ponownie komputera." + IDS_DEV_REENUMERATION "To urządzenie powoduje konflikt zasobów." + IDS_DEV_PARTIAL_LOG_CONF "ReactOS nie mógł zidentyfikować wszystkich zasobów, których używa urządzenie." + IDS_DEV_UNKNOWN_RESOURCE "Plik informacji sterownika $1 informuje, że urządzenie podrzędne używa zasobów, których nie rozpoznaje urządzenie nadrzędne." + IDS_DEV_REINSTALL "Sterownik dla tego urządzenia powinien być zainstalowany ponownie." + IDS_DEV_REGISTRY "Wpis może nie być prawidłowy." + IDS_DEV_WILL_BE_REMOVED "ReactOS usuwa to urządzenie." + IDS_DEV_DISABLED "Urządzenie nie zostało uruchomione." + IDS_DEV_DISABLED2 "Urządzenie jest wyłączone." + IDS_DEV_DEVLOADER_NOT_READY "Systemy ładowania sprzętu nie mógły załadować wymaganego sterownika." + IDS_DEV_DEVLOADER_NOT_READY2 "Karta graficzna działa prawidłowo." + IDS_DEV_DEVLOADER_NOT_READY3 "Systemy ładowania sprzętu nie mógły załadować wymaganego sterownika." + IDS_DEV_DEVICE_NOT_THERE "Urządzenie nie jest obecne, nie działa poprawnie lub nie wszystkie sterowniki urządzenia zostały zainstalowane." + IDS_DEV_MOVED "ReactOS jest w trakcie konfigurowania tego urządzenia." + IDS_DEV_TOO_EARLY "ReactOS jest w trakcie konfigurowania tego urządzenia." + IDS_DEV_NO_VALID_LOG_CONF "ReactOS nie potrafił odnaleźć zasobów dla tego urządzenia." + IDS_DEV_FAILED_INSTALL "Nie zainstalowano sterownika dla tego urządzenia." + IDS_DEV_HARDWARE_DISABLED "Urządzenie jest wyłączone, ponieważ BIOS nie przydzielił żadnych zasobów dla tego urządzenia." + IDS_DEV_CANT_SHARE_IRQ "Urządzenie żąda przerwania (IRQ), którego używa inne urządzenia i którego nie można współdzielić. Musisz zmienić ustawienia lub usunąć sterownik powodujący konflikt." + IDS_DEV_FAILED_ADD "Urządzenie nie działa prawidłowo, ponieważ $1 również nie działa poprawnie." + IDS_DEV_DISABLED_SERVICE "ReactOS nie mógł zainstalować sterownika dla urządzenia, ponieważ nie mógł uzyskać dostępu do lokacji zawartej w pliku instalacyjnym." + IDS_DEV_TRANSLATION_FAILED "Sterownik nie jest przeznaczony dla tego urządzenia." + IDS_DEV_NO_SOFTCONFIG "ReactOS nie mógł określić ustawień dla tego urządzenia. Poszukaj rozwiązania w dokumentacji urządzenia i użyj ustawień zasobów, aby skonfigurować je ręcznie." + IDS_DEV_BIOS_TABLE "Firmware Twojego komputera zawiera zbyt mało informacji, aby skonfigurować i używać tego urządzenia. Aby uruchomić urządzenie, skontaktuj się z producentem w celu uaktualnienia firmware-u lub BIOS-u." + IDS_DEV_IRQ_TRANSLATION_FAILED "Urządzenie żąda przerwań PCI, chociaż znajduje się w slocie ISA (lub na odwrót). Zmień ustawienia przerwań dla tego urządzenia korzystając z konfiguratora systemu." + IDS_DEV_FAILED_DRIVER_ENTRY "ReactOS nie mógł uruchomić sterownika dla tego urządzenia." + IDS_DEV_DRIVER_FAILED_PRIOR_UNLOAD "ReactOS nie mógł uruchomić sterownika dla tego urządzenia, ponieważ poprzedni sterownik jest nadal w pamięci." + IDS_DEV_DRIVER_FAILED_LOAD "ReactOS nie mógł uruchomić sterownika dla tego urządzenia. Brak sterownika lub sterownik może być uszkodzony." + IDS_DEV_DRIVER_SERVICE_KEY_INVALID "ReactOS nie mógł uzyskać dostępu do sprzętu, ponieważ brakuje klucza w rejestrze lub klucz nie jest zapisany prawidłowo." + IDS_DEV_LEGACY_SERVICE_NO_DEVICES "ReactOS pomyślnie uruchomił sterownik urządzenia, ale nie odnalazł go fizycznie." + IDS_DEV_DUPLICATE_DEVICE "ReactOS nie mógł uruchomić sterownika dla tego urządzenia, ponieważ identyczne urządzenie pracuje obecnie w systemie." + IDS_DEV_FAILED_POST_START "ReactOS przerwał pracę urządzenia, ponieważ zostały zgłoszone problemy." + IDS_DEV_HALTED "Program lub usługa przerwała działanie urządzenia." + IDS_DEV_PHANTOM "Obecnie urządzenie nie jest podłączone do komputera." + IDS_DEV_SYSTEM_SHUTDOWN "ReactOS nie może uzyskać dostępu do urządzenia, ponieważ trwa zamykanie systemu." + IDS_DEV_HELD_FOR_EJECT "ReactOS nie może uzyskać dostępu do urządzenia, ponieważ urządzenie to było przygotowane do ""bezpiecznego usunięcia"", ale nie zostało odłączone." + IDS_DEV_DRIVER_BLOCKED "Oprogramowanie urządzenia zostało zablokowane przy starcie, ponieważ nie współpracuje poprawnie z systemem ReactOS. Spróbuj zainstalować nowszy sterownik." + IDS_DEV_REGISTRY_TOO_LARGE "ReactOS nie może uruchomić nowego urządzenia, ponieważ jądro systemu jest zbyt wielkie (przekracza limit rozmiaru rejestru)." + IDS_DEV_SETPROPERTIES_FAILED "ReactOS nie był w stanie zmienić parametrów instalacyjnych tego urządzenia." END STRINGTABLE BEGIN - IDS_PROP_DEVICEID "cieka urzdzenia" - IDS_PROP_HARDWAREIDS "Identyfikator urzdzenia" + IDS_PROP_DEVICEID "Ścieżka urządzenia" + IDS_PROP_HARDWAREIDS "Identyfikator urządzenia" IDS_PROP_COMPATIBLEIDS "Zgodne identyfikatory" - IDS_PROP_MATCHINGDEVICEID "Uyty identyfikator" - IDS_PROP_SERVICE "Usuga" - IDS_PROP_ENUMERATOR "Modu lokalizujcy" - IDS_PROP_CAPABILITIES "Moliwoci" - IDS_PROP_DEVNODEFLAGS "Konfiguracja wza Devnode" - IDS_PROP_CONFIGFLAGS "Stan wza Config" - IDS_PROP_CSCONFIGFLAGS "Stan wza CSCONFIG" + IDS_PROP_MATCHINGDEVICEID "Użyty identyfikator" + IDS_PROP_SERVICE "Usługa" + IDS_PROP_ENUMERATOR "Moduł lokalizujący" + IDS_PROP_CAPABILITIES "Możliwości" + IDS_PROP_DEVNODEFLAGS "Konfiguracja węzła Devnode" + IDS_PROP_CONFIGFLAGS "Stan węzła Config" + IDS_PROP_CSCONFIGFLAGS "Stan węzła CSCONFIG" IDS_PROP_EJECTIONRELATIONS "Relacje wysuwania" IDS_PROP_REMOVALRELATIONS "Relacje usuwania" IDS_PROP_BUSRELATIONS "Relacje magistrali" - IDS_PROP_DEVUPPERFILTERS "Wysze filtry urzdzenia" - IDS_PROP_DEVLOWERFILTERS "Nisze filtry urzdzenia" - IDS_PROP_CLASSUPPERFILTERS "Wysze filtry klasy" - IDS_PROP_CLASSLOWERFILTERS "Nisze filtry klasy" + IDS_PROP_DEVUPPERFILTERS "Wyższe filtry urządzenia" + IDS_PROP_DEVLOWERFILTERS "Niższe filtry urządzenia" + IDS_PROP_CLASSUPPERFILTERS "Wyższe filtry klasy" + IDS_PROP_CLASSLOWERFILTERS "Niższe filtry klasy" IDS_PROP_CLASSINSTALLER "Instalator klasy" IDS_PROP_CLASSCOINSTALLER "Dodatkowy instalator klasy" - IDS_PROP_DEVICECOINSTALLER "Dodatkowy instalator urzdzenia" + IDS_PROP_DEVICECOINSTALLER "Dodatkowy instalator urządzenia" IDS_PROP_FIRMWAREREVISION "Wersja Firmware" - IDS_PROP_CURRENTPOWERSTATE "Biecy stan zasilania" - IDS_PROP_POWERCAPABILITIES "Zdolnoci trybu zasilania" + IDS_PROP_CURRENTPOWERSTATE "Bieżący stan zasilania" + IDS_PROP_POWERCAPABILITIES "Zdolności trybu zasilania" IDS_PROP_POWERSTATEMAPPINGS "Mapowania stanu zasilania" END @@ -130,36 +131,36 @@ IDD_HARDWARE DIALOGEX DISCARDABLE 0, 0, 300, 400 STYLE DS_CONTROL | WS_CHILD | WS_VISIBLE | WS_CAPTION | DS_SHELLFONT FONT 8, "MS Shell Dlg" BEGIN - LTEXT "&Urzdzenia:",IDC_DEVICES,7,6,196,10 + LTEXT "&Urządzenia:",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 "Waciwoci urzdzenia",IDC_PROPERTIESGROUP,7,76,196,105 + GROUPBOX "Właściwości urządzenia",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 "&Rozwizywanie problemw...",IDC_TROUBLESHOOT,85,140,54,14, + PUSHBUTTON "&Rozwiązywanie problemów...",IDC_TROUBLESHOOT,85,140,54,14, BS_PUSHBUTTON | WS_CHILD | WS_DISABLED | WS_TABSTOP - PUSHBUTTON "Waciwoci",IDC_PROPERTIES,146,140,50,14 + PUSHBUTTON "Właściwości",IDC_PROPERTIES,146,140,50,14 END IDD_DEVICEGENERAL DIALOGEX DISCARDABLE 0, 0, 252, 218 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Oglne" +CAPTION "Ogólne" FONT 8, "MS Shell Dlg" BEGIN ICON "", IDC_DEVICON, 7, 7, 20, 20 LTEXT "", IDC_DEVNAME, 37, 9, 174, 16, SS_NOPREFIX - LTEXT "Typ urzdzenia:", -1, 37, 39, 60, 8, SS_NOPREFIX + LTEXT "Typ urządzenia:", -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 "Producent:", -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 "Lokalizacja:", -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 "Stan urzdzenia", IDC_DEVSTATUSGROUP, 7, 83, 238, 100 + GROUPBOX "Stan urządzenia", 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 "&Rozwizywanie problemw...", IDC_DEVPROBLEM, 148, 163, 90, 15 - LTEXT "&Uycie urzdzenia:", IDC_DEVUSAGELABEL, 7, 188, 222, 8, WS_DISABLED + PUSHBUTTON "&Rozwiązywanie problemów...", IDC_DEVPROBLEM, 148, 163, 90, 15 + LTEXT "&Użycie urządzenia:", IDC_DEVUSAGELABEL, 7, 188, 222, 8, WS_DISABLED COMBOBOX IDC_DEVUSAGE, 7, 198, 239, 40, CBS_DROPDOWNLIST | WS_VSCROLL | WS_DISABLED END @@ -178,35 +179,35 @@ BEGIN EDITTEXT IDC_DRVVERSION, 100, 67, 145, 12, NOT WS_TABSTOP | NOT WS_BORDER | ES_AUTOHSCROLL | ES_READONLY LTEXT "Podpis cyfrowy:", -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 "&Szczegy sterownika...", IDC_DRIVERDETAILS, 7, 106, 70, 15 - LTEXT "Wywietla informacje szczegowe.", -1, 91, 110, 154, 17, SS_NOPREFIX + PUSHBUTTON "&Szczegóły sterownika...", IDC_DRIVERDETAILS, 7, 106, 70, 15 + LTEXT "Wyświetla informacje szczegółowe.", -1, 91, 110, 154, 17, SS_NOPREFIX END IDD_DRIVERDETAILS DIALOGEX DISCARDABLE 0, 0, 224, 230 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUPWINDOW | WS_VISIBLE | WS_DLGFRAME -CAPTION "Driver File Details" +CAPTION "Szczegóły pliku sterownika" FONT 8, "MS Shell Dlg" BEGIN ICON "", IDC_DEVICON, 7, 7, 20, 20 LTEXT "", IDC_DEVNAME, 37, 9, 174, 16, SS_NOPREFIX - LTEXT "&Driver files:", -1, 7, 36, 204, 8 + LTEXT "&Pliki sterownika:", -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 "Provider:", -1, 14, 134, 50, 8 + LTEXT "Dostawca:", -1, 14, 134, 50, 8 EDITTEXT IDC_FILEPROVIDER, 66, 134, 155, 8, NOT WS_TABSTOP | NOT WS_BORDER | ES_AUTOHSCROLL | ES_READONLY - LTEXT "File version:", -1, 14, 150, 50, 8 + LTEXT "Wersja pliku:", -1, 14, 150, 50, 8 EDITTEXT IDC_FILEVERSION, 66, 150, 155, 8, NOT WS_TABSTOP | NOT WS_BORDER | ES_AUTOHSCROLL | ES_READONLY - LTEXT "Copyright:", -1, 14, 166, 50, 8 + LTEXT "Prawa autorskie:", -1, 14, 166, 50, 8 EDITTEXT IDC_FILECOPYRIGHT, 66, 166, 155, 8, NOT WS_TABSTOP | NOT WS_BORDER | ES_AUTOHSCROLL | ES_READONLY - LTEXT "Digital Signer:", -1, 14, 182, 50, 8 + LTEXT "Podpis cyfrowy:", -1, 14, 182, 50, 8 EDITTEXT IDC_DIGITALSIGNER, 66, 182, 155, 8, NOT WS_TABSTOP | NOT WS_BORDER | ES_AUTOHSCROLL | ES_READONLY DEFPUSHBUTTON "OK", IDOK, 167, 208, 50, 14 END IDD_DEVICEDETAILS DIALOGEX DISCARDABLE 0, 0, 252, 218 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Szczegy" +CAPTION "Szczegóły" FONT 8, "MS Shell Dlg" BEGIN ICON "", IDC_DEVICON, 7, 7, 20, 20 @@ -234,5 +235,3 @@ BEGIN ICON "", IDC_DEVICON, 7, 7, 20, 20 LTEXT "", IDC_DEVNAME, 37, 9, 174, 16, SS_NOPREFIX END - - diff --git a/dll/win32/devmgr/lang/ro-RO.rc b/dll/win32/devmgr/lang/ro-RO.rc index 7722df63d70..810b524493d 100644 --- a/dll/win32/devmgr/lang/ro-RO.rc +++ b/dll/win32/devmgr/lang/ro-RO.rc @@ -2,8 +2,6 @@ LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL -#pragma code_page(65001) - STRINGTABLE BEGIN IDS_NAME "Nume" @@ -229,5 +227,3 @@ BEGIN ICON "", IDC_DEVICON, 7, 7, 20, 20 LTEXT "", IDC_DEVNAME, 37, 9, 174, 16, SS_NOPREFIX END - -#pragma code_page(default) diff --git a/dll/win32/devmgr/lang/ru-RU.rc b/dll/win32/devmgr/lang/ru-RU.rc index 66f6861a550..7a6a4628534 100644 --- a/dll/win32/devmgr/lang/ru-RU.rc +++ b/dll/win32/devmgr/lang/ru-RU.rc @@ -2,43 +2,43 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT STRINGTABLE BEGIN - IDS_NAME "" - IDS_TYPE "" - IDS_MANUFACTURER ": %1" - IDS_LOCATION ": %1" - IDS_STATUS " : %1" - IDS_UNKNOWN "" - IDS_LOCATIONSTR " %1!u! (%2)" - IDS_DEVCODE " ( %1!u!)" - IDS_DEVCODE2 " ( %2!u!)" - IDS_ENABLEDEVICE " ()" - IDS_DISABLEDEVICE " ()" - IDS_UNKNOWNDEVICE " " - IDS_NODRIVERLOADED " ." - IDS_DEVONPARENT " %1" - IDS_TROUBLESHOOTDEV "&..." - IDS_ENABLEDEV "& " - IDS_REINSTALLDRV "& " - IDS_PROPERTIES "&" - IDS_UPDATEDRV "& ..." - IDS_REBOOT "& ..." - IDS_NOTAVAILABLE "" - IDS_NOTDIGITALLYSIGNED " " - IDS_NODRIVERS " ." + IDS_NAME "Имя" + IDS_TYPE "Тип" + IDS_MANUFACTURER "Изготовитель: %1" + IDS_LOCATION "Размещение: %1" + IDS_STATUS "Состояние устройства: %1" + IDS_UNKNOWN "Неизвестно" + IDS_LOCATIONSTR "Размещение %1!u! (%2)" + IDS_DEVCODE " (код %1!u!)" + IDS_DEVCODE2 " (код %2!u!)" + IDS_ENABLEDEVICE "Это устройство используется (включено)" + IDS_DISABLEDEVICE "Это устройство не используется (выключено)" + IDS_UNKNOWNDEVICE "Неизвестное устройство" + IDS_NODRIVERLOADED "Не установлены драйверы для этого устройства." + IDS_DEVONPARENT "на %1" + IDS_TROUBLESHOOTDEV "&Диагностика..." + IDS_ENABLEDEV "В&ключить устройство" + IDS_REINSTALLDRV "&Переустановить драйвер" + IDS_PROPERTIES "С&войства" + IDS_UPDATEDRV "О&бновить драйвер..." + IDS_REBOOT "Пер&езагрузить компьютер..." + IDS_NOTAVAILABLE "Недоступно" + IDS_NOTDIGITALLYSIGNED "Нет цифровой подписи" + IDS_NODRIVERS "Файлы драйверов для этого устройства не установлены или не были загружены." END /* error messages, source: http://www.z123.org/techsupport/medm.htm */ STRINGTABLE BEGIN - IDS_DEV_NO_PROBLEM " ." - IDS_DEV_NOT_CONFIGURED " ." + IDS_DEV_NO_PROBLEM "Устройство работает нормально." + IDS_DEV_NOT_CONFIGURED "Это устройство еще не настроено." IDS_DEV_DEVLOADER_FAILED "ReactOS could not load the driver for this device because the computer is reporting two $1 bus types." IDS_DEV_DEVLOADER_FAILED2 "The $1 device loader(s) for this device could not load the device driver." IDS_DEV_OUT_OF_MEMORY "The driver for this device may be bad, or your system may be running low on memory or other resources." IDS_DEV_ENTRY_IS_WRONG_TYPE "This device is not working properly because one of its drivers may be bad, or your registry may be bad." IDS_DEV_LACKED_ARBITRATOR "The driver for this device requested a resource that ReactOS does not know how to handle." IDS_DEV_BOOT_CONFIG_CONFLICT "Another device is using the resources this device needs." - IDS_DEV_FAILED_FILTER " ." + IDS_DEV_FAILED_FILTER "Драйверы для этого устройства должны быть переустановлены." IDS_DEV_DEVLOADER_NOT_FOUND "This device is not working properly because ReactOS cannot load the file $1 that loads the drivers for the device." IDS_DEV_DEVLOADER_NOT_FOUND2 "This device is not working properly because the file $1 that loads the drivers for this device is bad." IDS_DEV_DEVLOADER_NOT_FOUND3 "Device failure: Try changing the driver for this device. If that doesn't work, see your hardware documentation." @@ -47,24 +47,24 @@ BEGIN IDS_DEV_FAILED_START "This device is either not present, not working properly, or does not have all the drivers installed." IDS_DEV_LIAR "ReactOS stopped responding while attempting to start this device, and therefore will never attempt to start this device again." IDS_DEV_NORMAL_CONFLICT "This device cannot find any free $1 resources to use." - IDS_DEV_NOT_VERIFIED " , ." - IDS_DEV_NEED_RESTART " ." - IDS_DEV_REENUMERATION " ." - IDS_DEV_PARTIAL_LOG_CONF "ReactOS , ." + IDS_DEV_NOT_VERIFIED "Данное устройство является неизвестным, работает некорректно или не имеет установленных драйверов." + IDS_DEV_NEED_RESTART "Данное устройство не сможет корректно работать до выполнения перезагрузки." + IDS_DEV_REENUMERATION "Данное устройство вызвало конфликт ресурсов." + IDS_DEV_PARTIAL_LOG_CONF "ReactOS не может идентифицировать ресурсы, используемые устройством." IDS_DEV_UNKNOWN_RESOURCE "The driver information file $1 is telling this child device to use a resource that the parent device does not have or recognize." - IDS_DEV_REINSTALL " ." - IDS_DEV_REGISTRY " ." - IDS_DEV_WILL_BE_REMOVED "ReactOS ." - IDS_DEV_DISABLED " ." - IDS_DEV_DISABLED2 " ." - IDS_DEV_DEVLOADER_NOT_READY " ." - IDS_DEV_DEVLOADER_NOT_READY2 " ." - IDS_DEV_DEVLOADER_NOT_READY3 " ." - IDS_DEV_DEVICE_NOT_THERE " , ." - IDS_DEV_MOVED "ReactOS ." - IDS_DEV_TOO_EARLY "ReactOS ." - IDS_DEV_NO_VALID_LOG_CONF "ReactOS ." - IDS_DEV_FAILED_INSTALL " ." + IDS_DEV_REINSTALL "Драйверы этого устройства должны быть переустановлены." + IDS_DEV_REGISTRY "Ваш системный реестр поврежден." + IDS_DEV_WILL_BE_REMOVED "ReactOS удалит это устройство." + IDS_DEV_DISABLED "Это устройство не запущено." + IDS_DEV_DISABLED2 "Это устройство отключено." + IDS_DEV_DEVLOADER_NOT_READY "Загрузчик этого устройства не может загрузить необходимые драйверы." + IDS_DEV_DEVLOADER_NOT_READY2 "Этот адаптер экрана функционирует корректно." + IDS_DEV_DEVLOADER_NOT_READY3 "Загрузчик этого устройства не может загрузить необходимые драйверы." + IDS_DEV_DEVICE_NOT_THERE "Устройство отсутствует, работает неправильно или для него установлены не все драйверы." + IDS_DEV_MOVED "ReactOS настраивает это устройство." + IDS_DEV_TOO_EARLY "ReactOS настраивает это устройство." + IDS_DEV_NO_VALID_LOG_CONF "ReactOS не может указать ресурсы для этого устройства." + IDS_DEV_FAILED_INSTALL "Драйверы для этого устройства не установлены." IDS_DEV_HARDWARE_DISABLED "This device is disabled because the BIOS for the device did not give it any resources." IDS_DEV_CANT_SHARE_IRQ "This device is using an Interrupt Request (IRQ) resource that is in use by another device and cannot be shared.\nYou must change the conflicting setting or remove the real-mode driver causing the conflict." IDS_DEV_FAILED_ADD "This device is not working properly because $1 is not working properly." @@ -73,15 +73,15 @@ BEGIN IDS_DEV_NO_SOFTCONFIG "ReactOS cannot determine the settings for this device. Consult the documentation that came with this device and use the Resource tab to set the configuration." IDS_DEV_BIOS_TABLE "Your computer's system firmware does not include enough information to properly configure and use this device. \nTo use this device, contact your computer manufacturer to obtain a firmware or BIOS update." IDS_DEV_IRQ_TRANSLATION_FAILED "This device is requesting a PCI interrupt but is configured for an ISA interrupt (or vice versa). \nPlease use the computer's system setup program to reconfigure the interrupt for this device." - IDS_DEV_FAILED_DRIVER_ENTRY "ReactOS ." + IDS_DEV_FAILED_DRIVER_ENTRY "ReactOS не может инициализировать драйвер устройства для данного оборудования." IDS_DEV_DRIVER_FAILED_PRIOR_UNLOAD "ReactOS cannot load the device driver for this hardware because a previous instance of the device driver is still in memory." IDS_DEV_DRIVER_FAILED_LOAD "ReactOS cannot load the device driver for this hardware. The driver may be corrupted or missing." IDS_DEV_DRIVER_SERVICE_KEY_INVALID "ReactOS cannot access this hardware because its service key information in the registry is missing or recorded incorrectly." IDS_DEV_LEGACY_SERVICE_NO_DEVICES "ReactOS successfully loaded the device driver for this hardware but cannot find the hardware device." IDS_DEV_DUPLICATE_DEVICE "ReactOS cannot load the device driver for this hardware because there is a duplicate device already running in the system." - IDS_DEV_FAILED_POST_START "ReactOS , ." - IDS_DEV_HALTED " ." - IDS_DEV_PHANTOM " ." + IDS_DEV_FAILED_POST_START "ReactOS остановил данное устройство, так как в его работе обнаружились проблемы." + IDS_DEV_HALTED "Приложение или служба отключили данное устройство." + IDS_DEV_PHANTOM "В настоящее время данное устройство не подключено к компьютеру." IDS_DEV_SYSTEM_SHUTDOWN "ReactOS cannot gain access to this hardware device because the operating system is in the process of shutting down." IDS_DEV_HELD_FOR_EJECT "ReactOS cannot use this hardware device because it has been prepared for safe removal, but it has not been removed from the computer" IDS_DEV_DRIVER_BLOCKED "The software for this device has been blocked from starting because it is known to have problems with ReactOS. Contact the hardware vendor for a new driver." @@ -91,113 +91,113 @@ END STRINGTABLE BEGIN - IDS_PROP_DEVICEID " " - IDS_PROP_HARDWAREIDS " (ID) " - IDS_PROP_COMPATIBLEIDS " (ID)" - IDS_PROP_MATCHINGDEVICEID " (ID) " - IDS_PROP_SERVICE "" - IDS_PROP_ENUMERATOR "" - IDS_PROP_CAPABILITIES "" - IDS_PROP_DEVNODEFLAGS " Devnode" - IDS_PROP_CONFIGFLAGS " Config" - IDS_PROP_CSCONFIGFLAGS " CSConfig" - IDS_PROP_EJECTIONRELATIONS " " - IDS_PROP_REMOVALRELATIONS " " - IDS_PROP_BUSRELATIONS " " - IDS_PROP_DEVUPPERFILTERS " " - IDS_PROP_DEVLOWERFILTERS " " - IDS_PROP_CLASSUPPERFILTERS " " - IDS_PROP_CLASSLOWERFILTERS " " - IDS_PROP_CLASSINSTALLER " " - IDS_PROP_CLASSCOINSTALLER " " - IDS_PROP_DEVICECOINSTALLER " " - IDS_PROP_FIRMWAREREVISION "" - IDS_PROP_CURRENTPOWERSTATE " " - IDS_PROP_POWERCAPABILITIES " " - IDS_PROP_POWERSTATEMAPPINGS " " + IDS_PROP_DEVICEID "Код экземпляра устройства" + IDS_PROP_HARDWAREIDS "Коды (ID) оборудования" + IDS_PROP_COMPATIBLEIDS "Совместимые коды (ID)" + IDS_PROP_MATCHINGDEVICEID "Соответствующий код (ID) устройства" + IDS_PROP_SERVICE "Служба" + IDS_PROP_ENUMERATOR "Перечислитель" + IDS_PROP_CAPABILITIES "Характеристики" + IDS_PROP_DEVNODEFLAGS "Флаги Devnode" + IDS_PROP_CONFIGFLAGS "Флаги Config" + IDS_PROP_CSCONFIGFLAGS "Флаги CSConfig" + IDS_PROP_EJECTIONRELATIONS "Зависимости извлечения" + IDS_PROP_REMOVALRELATIONS "Зависимости удаления" + IDS_PROP_BUSRELATIONS "Зависимости шины" + IDS_PROP_DEVUPPERFILTERS "Верхние фильтры устройства" + IDS_PROP_DEVLOWERFILTERS "Нижние фильтры устройства" + IDS_PROP_CLASSUPPERFILTERS "Верхние фильтры класса" + IDS_PROP_CLASSLOWERFILTERS "Нижние фильтры класса" + IDS_PROP_CLASSINSTALLER "Установщик классов" + IDS_PROP_CLASSCOINSTALLER "Соустановщики классов" + IDS_PROP_DEVICECOINSTALLER "Соустановщики устройств" + IDS_PROP_FIRMWAREREVISION "Микропрограмма" + IDS_PROP_CURRENTPOWERSTATE "Текушее состояние электропитания" + IDS_PROP_POWERCAPABILITIES "Возможности электропитания" + IDS_PROP_POWERSTATEMAPPINGS "Сопоставления энергосбережения" END IDD_HARDWARE DIALOGEX DISCARDABLE 0, 0, 300, 400 STYLE DS_CONTROL | WS_CHILD | WS_VISIBLE | WS_CAPTION | DS_SHELLFONT FONT 8, "MS Shell Dlg" BEGIN - LTEXT "&:",IDC_DEVICES,7,6,196,10 + LTEXT "&Устройства:",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 " ",IDC_PROPERTIESGROUP,7,76,196,105 + GROUPBOX "Свойства устройства",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 "&...",IDC_TROUBLESHOOT,85,140,54,14, + PUSHBUTTON "&Диагностика...",IDC_TROUBLESHOOT,85,140,54,14, BS_PUSHBUTTON | WS_CHILD | WS_DISABLED | WS_TABSTOP - PUSHBUTTON "&",IDC_PROPERTIES,146,140,50,14 + PUSHBUTTON "С&войства",IDC_PROPERTIES,146,140,50,14 END IDD_DEVICEGENERAL DIALOGEX DISCARDABLE 0, 0, 252, 218 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Общие" FONT 8, "MS Shell Dlg" BEGIN ICON "", IDC_DEVICON, 7, 7, 20, 20 LTEXT "", IDC_DEVNAME, 37, 9, 174, 16, SS_NOPREFIX - LTEXT " :", -1, 7, 39, 60, 8, SS_NOPREFIX + LTEXT "Тип устройства:", -1, 7, 39, 60, 8, SS_NOPREFIX EDITTEXT IDC_DEVTYPE, 100, 39, 146, 12, NOT WS_TABSTOP | NOT WS_BORDER | ES_AUTOHSCROLL | ES_READONLY - LTEXT ":", -1, 7, 53, 60, 8, SS_NOPREFIX + LTEXT "Изготовитель:", -1, 7, 53, 60, 8, SS_NOPREFIX EDITTEXT IDC_DEVMANUFACTURER, 100, 53, 145, 12, NOT WS_TABSTOP | NOT WS_BORDER | ES_AUTOHSCROLL | ES_READONLY - LTEXT ":", -1, 7, 67, 60, 8, SS_NOPREFIX + LTEXT "Размещение:", -1, 7, 67, 60, 8, SS_NOPREFIX EDITTEXT IDC_DEVLOCATION, 100, 67, 145, 12, NOT WS_TABSTOP | NOT WS_BORDER | ES_AUTOHSCROLL | ES_READONLY - GROUPBOX " ", IDC_DEVSTATUSGROUP, 7, 83, 238, 100 + GROUPBOX "Состояние устройства", 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 "&...", IDC_DEVPROBLEM, 148, 163, 90, 15 - LTEXT "& :", IDC_DEVUSAGELABEL, 7, 188, 222, 8, WS_DISABLED + PUSHBUTTON "&Диагностика...", IDC_DEVPROBLEM, 148, 163, 90, 15 + LTEXT "&Применение устройства:", 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 DISCARDABLE 0, 0, 252, 218 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Драйвер" FONT 8, "MS Shell Dlg" BEGIN ICON "", IDC_DEVICON, 7, 7, 20, 20 LTEXT "", IDC_DEVNAME, 37, 9, 174, 16, SS_NOPREFIX - LTEXT " :", -1, 7, 39, 80, 8, SS_NOPREFIX + LTEXT "Поставщик драйвера:", -1, 7, 39, 80, 8, SS_NOPREFIX EDITTEXT IDC_DRVPROVIDER, 100, 39, 146, 12, NOT WS_TABSTOP | NOT WS_BORDER | ES_AUTOHSCROLL | ES_READONLY - LTEXT " :", -1, 7, 53, 80, 8, SS_NOPREFIX + LTEXT "Дата разработки:", -1, 7, 53, 80, 8, SS_NOPREFIX EDITTEXT IDC_DRVDATE, 100, 53, 145, 12, NOT WS_TABSTOP | NOT WS_BORDER | ES_AUTOHSCROLL | ES_READONLY - LTEXT " :", -1, 7, 67, 80, 8, SS_NOPREFIX + LTEXT "Версия драйвера:", -1, 7, 67, 80, 8, SS_NOPREFIX EDITTEXT IDC_DRVVERSION, 100, 67, 145, 12, NOT WS_TABSTOP | NOT WS_BORDER | ES_AUTOHSCROLL | ES_READONLY - LTEXT " :", -1, 7, 81, 80, 8, SS_NOPREFIX + LTEXT "Цифровая подпись:", -1, 7, 81, 80, 8, SS_NOPREFIX EDITTEXT IDC_DIGITALSIGNER, 100, 81, 145, 12, NOT WS_TABSTOP | NOT WS_BORDER | ES_AUTOHSCROLL | ES_READONLY - PUSHBUTTON "&...", IDC_DRIVERDETAILS, 7, 106, 70, 15 - LTEXT " .", -1, 91, 110, 154, 17, SS_NOPREFIX + PUSHBUTTON "&Сведения...", IDC_DRIVERDETAILS, 7, 106, 70, 15 + LTEXT "Просмотр сведений о файлах драйверов.", -1, 91, 110, 154, 17, SS_NOPREFIX END IDD_DRIVERDETAILS DIALOGEX DISCARDABLE 0, 0, 224, 230 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUPWINDOW | WS_VISIBLE | WS_DLGFRAME -CAPTION " " +CAPTION "Сведения о файлах драйверов" FONT 8, "MS Shell Dlg" BEGIN ICON "", IDC_DEVICON, 7, 7, 20, 20 LTEXT "", IDC_DEVNAME, 37, 9, 174, 16, SS_NOPREFIX - LTEXT "& :", -1, 7, 36, 204, 8 + LTEXT "&Файлы драйверов:", -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 ":", -1, 7, 134, 50, 8 + LTEXT "Поставщик:", -1, 7, 134, 50, 8 EDITTEXT IDC_FILEPROVIDER, 137, 134, 155, 8, NOT WS_TABSTOP | NOT WS_BORDER | ES_AUTOHSCROLL | ES_READONLY - LTEXT " :", -1, 7, 150, 80, 8 + LTEXT "Версия файла:", -1, 7, 150, 80, 8 EDITTEXT IDC_FILEVERSION, 137, 150, 155, 8, NOT WS_TABSTOP | NOT WS_BORDER | ES_AUTOHSCROLL | ES_READONLY - LTEXT " :", -1, 7, 166, 112, 8 + LTEXT "Авторские права:", -1, 7, 166, 112, 8 EDITTEXT IDC_FILECOPYRIGHT, 137, 166, 155, 8, NOT WS_TABSTOP | NOT WS_BORDER | ES_AUTOHSCROLL | ES_READONLY - LTEXT " :", -1, 7, 182, 125, 8 + LTEXT "Цифровая подпись:", -1, 7, 182, 125, 8 EDITTEXT IDC_DIGITALSIGNER, 137, 182, 155, 8, NOT WS_TABSTOP | NOT WS_BORDER | ES_AUTOHSCROLL | ES_READONLY DEFPUSHBUTTON "OK", IDOK, 167, 208, 50, 14 END IDD_DEVICEDETAILS DIALOGEX DISCARDABLE 0, 0, 252, 218 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Сведения" FONT 8, "MS Shell Dlg" BEGIN ICON "", IDC_DEVICON, 7, 7, 20, 20 @@ -210,7 +210,7 @@ END IDD_DEVICERESOURCES DIALOGEX DISCARDABLE 0, 0, 252, 218 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Ресурсы" FONT 8, "MS Shell Dlg" BEGIN ICON "", IDC_DEVICON, 7, 7, 20, 20 @@ -219,7 +219,7 @@ END IDD_DEVICEPOWER DIALOGEX DISCARDABLE 0, 0, 252, 218 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Питание" FONT 8, "MS Shell Dlg" BEGIN ICON "", IDC_DEVICON, 7, 7, 20, 20 diff --git a/dll/win32/devmgr/lang/uk-UA.rc b/dll/win32/devmgr/lang/uk-UA.rc index 48ef0c80441..97a914dac5a 100644 --- a/dll/win32/devmgr/lang/uk-UA.rc +++ b/dll/win32/devmgr/lang/uk-UA.rc @@ -10,202 +10,202 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT STRINGTABLE BEGIN - IDS_NAME "'" - IDS_TYPE "" - IDS_MANUFACTURER ": %1" - IDS_LOCATION ": %1" - IDS_STATUS " : %1" - IDS_UNKNOWN "" - IDS_LOCATIONSTR " %1!u! (%2)" - IDS_DEVCODE " ( %1!u!)" - IDS_DEVCODE2 " ( %2!u!)" - IDS_ENABLEDEVICE " ()" - IDS_DISABLEDEVICE " ()" - IDS_UNKNOWNDEVICE " " - IDS_NODRIVERLOADED " ." - IDS_DEVONPARENT " %1" - IDS_TROUBLESHOOTDEV "& ..." - IDS_ENABLEDEV "& " - IDS_REINSTALLDRV "& " - IDS_PROPERTIES "&" - IDS_UPDATEDRV "& ..." - IDS_REBOOT " &'..." - IDS_NOTAVAILABLE "" - IDS_NOTDIGITALLYSIGNED " " - IDS_NODRIVERS " ." + IDS_NAME "Ім'я" + IDS_TYPE "Тип" + IDS_MANUFACTURER "Виробник: %1" + IDS_LOCATION "Розміщення: %1" + IDS_STATUS "Стан пристрою: %1" + IDS_UNKNOWN "Невідомий" + IDS_LOCATIONSTR "Розміщення %1!u! (%2)" + IDS_DEVCODE " (Код %1!u!)" + IDS_DEVCODE2 " (Код %2!u!)" + IDS_ENABLEDEVICE "Цей пристрій використовується (увімкнений)" + IDS_DISABLEDEVICE "Цей пристрій не використовується (вимкнений)" + IDS_UNKNOWNDEVICE "Невідомий пристрій" + IDS_NODRIVERLOADED "Для цього пристрою не встановлені драйвери." + IDS_DEVONPARENT "на %1" + IDS_TROUBLESHOOTDEV "&Усунення несправностей..." + IDS_ENABLEDEV "Вв&імкнути пристрій" + IDS_REINSTALLDRV "&Перевстановити драйвер" + IDS_PROPERTIES "&Властивості" + IDS_UPDATEDRV "&Оновити драйвер..." + IDS_REBOOT "Перезавантажити &комп'ютер..." + IDS_NOTAVAILABLE "Недоступно" + IDS_NOTDIGITALLYSIGNED "Немає цифрового підпису" + IDS_NODRIVERS "Файли драйверів для цього пристрою не потрібні або не були завантажені." END /* error messages, source: http://www.z123.org/techsupport/medm.htm */ STRINGTABLE BEGIN - IDS_DEV_NO_PROBLEM " ." - IDS_DEV_NOT_CONFIGURED " ." - IDS_DEV_DEVLOADER_FAILED "ReactOS , $1." - IDS_DEV_DEVLOADER_FAILED2 " $1 ." - IDS_DEV_OUT_OF_MEMORY " ' ." - IDS_DEV_ENTRY_IS_WRONG_TYPE " , ." - IDS_DEV_LACKED_ARBITRATOR " , ReactOS 쳺 ." - IDS_DEV_BOOT_CONFIG_CONFLICT " , ." - IDS_DEV_FAILED_FILTER " ." - IDS_DEV_DEVLOADER_NOT_FOUND " , ReactOS $1 , ." - IDS_DEV_DEVLOADER_NOT_FOUND2 " , $1 , , ." - IDS_DEV_DEVLOADER_NOT_FOUND3 " : . , ." - IDS_DEV_INVALID_DATA " , BIOS ' ." - IDS_DEV_INVALID_DATA2 " , BIOS . " - IDS_DEV_FAILED_START " , ." - IDS_DEV_LIAR "ReactOS , ." - IDS_DEV_NORMAL_CONFLICT " $1 ." - IDS_DEV_NOT_VERIFIED " , ." - IDS_DEV_NEED_RESTART " , '." - IDS_DEV_REENUMERATION " ." - IDS_DEV_PARTIAL_LOG_CONF "ReactOS , ." - IDS_DEV_UNKNOWN_RESOURCE " $1 , ." - IDS_DEV_REINSTALL " ." - IDS_DEV_REGISTRY " ." - IDS_DEV_WILL_BE_REMOVED "ReactOS ." - IDS_DEV_DISABLED " ." - IDS_DEV_DISABLED2 " ." - IDS_DEV_DEVLOADER_NOT_READY " ." - IDS_DEV_DEVLOADER_NOT_READY2 " ." - IDS_DEV_DEVLOADER_NOT_READY3 " ." - IDS_DEV_DEVICE_NOT_THERE " , ." - IDS_DEV_MOVED "ReactOS ." - IDS_DEV_TOO_EARLY "ReactOS ." - IDS_DEV_NO_VALID_LOG_CONF "ReactOS ." - IDS_DEV_FAILED_INSTALL " ." - IDS_DEV_HARDWARE_DISABLED " , BIOS ." - IDS_DEV_CANT_SHARE_IRQ " (IRQ), .\n , ." - IDS_DEV_FAILED_ADD " , $1 is not working properly." - IDS_DEV_DISABLED_SERVICE "ReactOS , , ." - IDS_DEV_TRANSLATION_FAILED " ." - IDS_DEV_NO_SOFTCONFIG "ReactOS . , ." - IDS_DEV_BIOS_TABLE "̳ ' . \n , ' BIOS." - IDS_DEV_IRQ_TRANSLATION_FAILED " PCI, ISA ( ). \n ' ." - IDS_DEV_FAILED_DRIVER_ENTRY "ReactOS ." - IDS_DEV_DRIVER_FAILED_PRIOR_UNLOAD "ReactOS , '." - IDS_DEV_DRIVER_FAILED_LOAD "ReactOS . ." - IDS_DEV_DRIVER_SERVICE_KEY_INVALID "ReactOS , ." - IDS_DEV_LEGACY_SERVICE_NO_DEVICES "ReactOS ." - IDS_DEV_DUPLICATE_DEVICE "ReactOS , ." - IDS_DEV_FAILED_POST_START "ReactOS , ." - IDS_DEV_HALTED " ." - IDS_DEV_PHANTOM " ' '." - IDS_DEV_SYSTEM_SHUTDOWN "ReactOS , ." - IDS_DEV_HELD_FOR_EJECT "ReactOS , , '" - IDS_DEV_DRIVER_BLOCKED " , ReactOS. ." - IDS_DEV_REGISTRY_TOO_LARGE "ReactOS , ( )." - IDS_DEV_SETPROPERTIES_FAILED "ReactOS ." + IDS_DEV_NO_PROBLEM "Цей пристрій працює нормально." + IDS_DEV_NOT_CONFIGURED "Цей пристрій не налаштований правильно." + IDS_DEV_DEVLOADER_FAILED "ReactOS не може завантажити драйвер для цього пристрою, тому що система повідомляє про два види шин типу $1." + IDS_DEV_DEVLOADER_FAILED2 "Система завантаження обладнання $1 не може завантажити драйвер цього пристрою." + IDS_DEV_OUT_OF_MEMORY "Драйвер для цього пристрою є несправним або системі бракує пам'яті чи інших ресурсів." + IDS_DEV_ENTRY_IS_WRONG_TYPE "Цей пристрій працює неправильно, оскільки один з його драйверів або реєстр є несправними." + IDS_DEV_LACKED_ARBITRATOR "Драйвер для цього пристрою вимагає ресурсів, з якими ReactOS не вміє працювати." + IDS_DEV_BOOT_CONFIG_CONFLICT "Інший пристрій використовує ресурси, потрібні цьому пристрою." + IDS_DEV_FAILED_FILTER "Драйвери цього пристрою треба переустановити." + IDS_DEV_DEVLOADER_NOT_FOUND "Цей пристрій працює неправильно, оскільки ReactOS не може завантажити файл $1 , який завантажує драйвери пристрою." + IDS_DEV_DEVLOADER_NOT_FOUND2 "Цей пристрій працює неправильно, оскільки файл $1 , який завантажує драйвери пристрою, є несправним." + IDS_DEV_DEVLOADER_NOT_FOUND3 "Помилка пристрою: Спробуйте змінити драйвер цього пристрою. Якщо це не допомагає, дивіться документацію пристрою." + IDS_DEV_INVALID_DATA "Цей пристрій працює неправильно, оскільки BIOS комп'ютера невірно передає ресурси для пристрою." + IDS_DEV_INVALID_DATA2 "Цей пристрій працює неправильно, оскільки BIOS пристрою невірно передає ресурси для пристрою. " + IDS_DEV_FAILED_START "Цей пристрій відсутній, працює некоректно або не має всіх встановлених драйверів." + IDS_DEV_LIAR "ReactOS не відповідає на запити при спробі запуску цього пристрою, і тому ніколи не буде намагатися запустити цей пристрій знов." + IDS_DEV_NORMAL_CONFLICT "Цей пристрій не може знайти вільних $1 ресурсів для їх використання." + IDS_DEV_NOT_VERIFIED "Цей пристрій відсутній, працює некоректно або не має всіх встановлених драйверів." + IDS_DEV_NEED_RESTART "Цей пристрій не зможе коректно працювати, поки ви не перезавантажите комп'ютер." + IDS_DEV_REENUMERATION "Цей пристрій спричинив конфлікт ресурсів." + IDS_DEV_PARTIAL_LOG_CONF "ReactOS не може розпізнати всі ресурси, які використовуються пристроєм." + IDS_DEV_UNKNOWN_RESOURCE "Інформаційний файл пристрою $1 каже цьому похідному пристрою використати ресурс, якого батьківський пристрій не має чи не розпізнає." + IDS_DEV_REINSTALL "Драйвери цього пристрою треба переустановити." + IDS_DEV_REGISTRY "Ваш системний реєстр може бути пошкоджений." + IDS_DEV_WILL_BE_REMOVED "ReactOS видалить цей пристрій." + IDS_DEV_DISABLED "Цей пристрій не запущений." + IDS_DEV_DISABLED2 "Цей пристрій відключений." + IDS_DEV_DEVLOADER_NOT_READY "Завантажувачі цього пристрою на можуть завантажити необхідні драйвери." + IDS_DEV_DEVLOADER_NOT_READY2 "Цей адапртер дисплея функціонує коректно." + IDS_DEV_DEVLOADER_NOT_READY3 "Завантажувачі цього пристрою на можуть завантажити необхідні драйвери." + IDS_DEV_DEVICE_NOT_THERE "Цей пристрій відсутній, працює некоректно або не має всіх встановлених драйверів." + IDS_DEV_MOVED "ReactOS налаштовує цей пристрій." + IDS_DEV_TOO_EARLY "ReactOS налаштовує цей пристрій." + IDS_DEV_NO_VALID_LOG_CONF "ReactOS не може вказати ресурси для цього пристрою." + IDS_DEV_FAILED_INSTALL "Драйвери для цього пристрою не встановлені." + IDS_DEV_HARDWARE_DISABLED "Цей пристрій вимкнено, оскільки BIOS не виділив для пристрою ресурсів." + IDS_DEV_CANT_SHARE_IRQ "Цей пристрій використувує ресурс Запиту Переривань (IRQ), який використовується іншим пристроєм та не може бути спільним.\nВи повинні змінити конфліктуючі налаштування або видалити драйвер реального режиму, що спричинює конфлікт." + IDS_DEV_FAILED_ADD "Цей пристрій працює неправильно, оскільки $1 is not working properly." + IDS_DEV_DISABLED_SERVICE "ReactOS не може встановити драйвери для цього пристрою, оскільки не має доступу до диску чи мережного ресурсу, які містять файли установки." + IDS_DEV_TRANSLATION_FAILED "Цей пристрій не відповідає його драйверу." + IDS_DEV_NO_SOFTCONFIG "ReactOS не може визначити налаштуванн для цього пристрою. Зверніться до документації пристрою, і використовуйте вкладку Ресурси для налаштування конфігурації." + IDS_DEV_BIOS_TABLE "Мікропрограма вашого комп'ютера не містить досить інформації для коректних налаштування та використання цього пристрою. \nЩоб використовувати цей пристрій, зверніться до виробника комп'ютера для отримання оновлених мікропрограми чи BIOS." + IDS_DEV_IRQ_TRANSLATION_FAILED "Цей пристрій запитує переривання PCI, а він налаштований на переривання ISA (або навпаки). \nВикористайте програму налаштування комп'ютера для зміни параметрів переривань цього пристрою." + IDS_DEV_FAILED_DRIVER_ENTRY "ReactOS не може ініціалізувати драйвер пристрою для даного обладнання." + IDS_DEV_DRIVER_FAILED_PRIOR_UNLOAD "ReactOS не може завантажити драйвер цого пристрою, оскільки попередня версія драйвера пристрою все ще знаходиться в пам'яті." + IDS_DEV_DRIVER_FAILED_LOAD "ReactOS не може завантажити драйвер для цого пристрою. Драйвер зіпсований або відсутній." + IDS_DEV_DRIVER_SERVICE_KEY_INVALID "ReactOS не може отримати доступ до цього пристрою, оскільки дані сервісного ключа реєстру відсутні чи записані невірно." + IDS_DEV_LEGACY_SERVICE_NO_DEVICES "ReactOS успішно завантажив драйвер цього пристрою але не може знайти сам пристрій." + IDS_DEV_DUPLICATE_DEVICE "ReactOS не може завантажити драйвер для цого пристрою, оскільки в системі вже працює такий же пристрій." + IDS_DEV_FAILED_POST_START "ReactOS зупинив цей пристрій, оскільки в його роботі виявилися проблеми." + IDS_DEV_HALTED "Додаток або служба відключили цей апаратний пристрій." + IDS_DEV_PHANTOM "В даний момент цей пристрій не під'єднаний до комп'ютера." + IDS_DEV_SYSTEM_SHUTDOWN "ReactOS не може отримати доступ до цього пристрою, оскільки операційна система завершує свою роботу." + IDS_DEV_HELD_FOR_EJECT "ReactOS не може використовувати цей пристрій, оскільки він був підготовлений для безпечнрго видалення, але ще не був видалений з комп'ютера" + IDS_DEV_DRIVER_BLOCKED "Запуск програмного забезпечення для цього пристрою був заблокований, оскільки воно має відомі проблеми з ReactOS. Зверніться до постачальника за новим драйвером." + IDS_DEV_REGISTRY_TOO_LARGE "ReactOS не може запустити нові пристрої, оскільки системний кущ занадто великий (перевищує допустимий розмір реєстру)." + IDS_DEV_SETPROPERTIES_FAILED "ReactOS не зміг змінити параметри цього пристрою." END STRINGTABLE BEGIN - IDS_PROP_DEVICEID " " - IDS_PROP_HARDWAREIDS " (ID) " - IDS_PROP_COMPATIBLEIDS " (ID)" - IDS_PROP_MATCHINGDEVICEID "³ (ID) " - IDS_PROP_SERVICE "" - IDS_PROP_ENUMERATOR "˳" - IDS_PROP_CAPABILITIES "" - IDS_PROP_DEVNODEFLAGS " Devnode" - IDS_PROP_CONFIGFLAGS " Config" - IDS_PROP_CSCONFIGFLAGS " CSConfig" - IDS_PROP_EJECTIONRELATIONS " " - IDS_PROP_REMOVALRELATIONS " " - IDS_PROP_BUSRELATIONS " " - IDS_PROP_DEVUPPERFILTERS " " - IDS_PROP_DEVLOWERFILTERS " " - IDS_PROP_CLASSUPPERFILTERS " " - IDS_PROP_CLASSLOWERFILTERS " " - IDS_PROP_CLASSINSTALLER " " - IDS_PROP_CLASSCOINSTALLER " " - IDS_PROP_DEVICECOINSTALLER " " - IDS_PROP_FIRMWAREREVISION "̳" - IDS_PROP_CURRENTPOWERSTATE " " - IDS_PROP_POWERCAPABILITIES " " - IDS_PROP_POWERSTATEMAPPINGS " " + IDS_PROP_DEVICEID "Код екземпляру пристрою" + IDS_PROP_HARDWAREIDS "Коди (ID) обладнання" + IDS_PROP_COMPATIBLEIDS "Сумісні коди (ID)" + IDS_PROP_MATCHINGDEVICEID "Відповідний код (ID) пристрою" + IDS_PROP_SERVICE "Служба" + IDS_PROP_ENUMERATOR "Лічильник" + IDS_PROP_CAPABILITIES "Можливості" + IDS_PROP_DEVNODEFLAGS "Прапорці Devnode" + IDS_PROP_CONFIGFLAGS "Прапорці Config" + IDS_PROP_CSCONFIGFLAGS "Прапорці CSConfig" + IDS_PROP_EJECTIONRELATIONS "Залежності виймання" + IDS_PROP_REMOVALRELATIONS "Залежності видалення" + IDS_PROP_BUSRELATIONS "Залежності шини" + IDS_PROP_DEVUPPERFILTERS "Верхні фільтри пристрою" + IDS_PROP_DEVLOWERFILTERS "Нижні фільтри пристрою" + IDS_PROP_CLASSUPPERFILTERS "Верхні фільтри класу" + IDS_PROP_CLASSLOWERFILTERS "Нижні фільтри класу" + IDS_PROP_CLASSINSTALLER "Встановлювачі класів" + IDS_PROP_CLASSCOINSTALLER "Співвстановлювачі класів" + IDS_PROP_DEVICECOINSTALLER "Співвстановлювачі пристроїв" + IDS_PROP_FIRMWAREREVISION "Мікропрограма" + IDS_PROP_CURRENTPOWERSTATE "Поточний стан електроживлення" + IDS_PROP_POWERCAPABILITIES "Можливості електроживлення" + IDS_PROP_POWERSTATEMAPPINGS "Співставлення енергозбереження" END IDD_HARDWARE DIALOGEX DISCARDABLE 0, 0, 300, 400 STYLE DS_CONTROL | WS_CHILD | WS_VISIBLE | WS_CAPTION | DS_SHELLFONT FONT 8, "MS Shell Dlg" BEGIN - LTEXT "&:",IDC_DEVICES,7,6,196,10 + LTEXT "&Пристрої:",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 " ",IDC_PROPERTIESGROUP,7,76,196,105 + GROUPBOX "Властивості пристрою",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 "& ...",IDC_TROUBLESHOOT,85,140,54,14, + PUSHBUTTON "&Усунення несправностей...",IDC_TROUBLESHOOT,85,140,54,14, BS_PUSHBUTTON | WS_CHILD | WS_DISABLED | WS_TABSTOP - PUSHBUTTON "&",IDC_PROPERTIES,146,140,50,14 + PUSHBUTTON "&Властивості",IDC_PROPERTIES,146,140,50,14 END IDD_DEVICEGENERAL DIALOGEX DISCARDABLE 0, 0, 252, 218 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Загальні" FONT 8, "MS Shell Dlg" BEGIN ICON "", IDC_DEVICON, 7, 7, 20, 20 LTEXT "", IDC_DEVNAME, 37, 9, 174, 16, SS_NOPREFIX - LTEXT " :", -1, 37, 39, 60, 8, SS_NOPREFIX + LTEXT "Тип пристрою:", -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 ":", -1, 37, 53, 60, 8, SS_NOPREFIX + LTEXT "Виробник:", -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 ":", -1, 37, 67, 60, 8, SS_NOPREFIX + LTEXT "Розміщення:", -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 " ", IDC_DEVSTATUSGROUP, 7, 83, 238, 100 + GROUPBOX "Стан пристрою", 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 "& ...", IDC_DEVPROBLEM, 146, 163, 94, 15 - LTEXT "& :", IDC_DEVUSAGELABEL, 7, 188, 222, 8, WS_DISABLED + PUSHBUTTON "&Усунення несправностей...", IDC_DEVPROBLEM, 146, 163, 94, 15 + LTEXT "&Використання пристрою:", 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 DISCARDABLE 0, 0, 252, 218 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Драйвер" FONT 8, "MS Shell Dlg" BEGIN ICON "", IDC_DEVICON, 7, 7, 20, 20 LTEXT "", IDC_DEVNAME, 37, 9, 174, 16, SS_NOPREFIX - LTEXT " :", -1, 4, 39, 85, 8, SS_NOPREFIX + LTEXT "Постачальник драйвера:", -1, 4, 39, 85, 8, SS_NOPREFIX EDITTEXT IDC_DRVPROVIDER, 100, 39, 146, 12, NOT WS_TABSTOP | NOT WS_BORDER | ES_AUTOHSCROLL | ES_READONLY - LTEXT " :", -1, 4, 53, 60, 8, SS_NOPREFIX + LTEXT "Дата драйвера:", -1, 4, 53, 60, 8, SS_NOPREFIX EDITTEXT IDC_DRVDATE, 100, 53, 145, 12, NOT WS_TABSTOP | NOT WS_BORDER | ES_AUTOHSCROLL | ES_READONLY - LTEXT " :", -1, 4, 67, 60, 8, SS_NOPREFIX + LTEXT "Версія драйвера:", -1, 4, 67, 60, 8, SS_NOPREFIX EDITTEXT IDC_DRVVERSION, 100, 67, 145, 12, NOT WS_TABSTOP | NOT WS_BORDER | ES_AUTOHSCROLL | ES_READONLY - LTEXT " :", -1, 4, 81, 65, 8, SS_NOPREFIX + LTEXT "Цифровий підпис:", -1, 4, 81, 65, 8, SS_NOPREFIX EDITTEXT IDC_DIGITALSIGNER, 100, 81, 145, 12, NOT WS_TABSTOP | NOT WS_BORDER | ES_AUTOHSCROLL | ES_READONLY - PUSHBUTTON "&³...", IDC_DRIVERDETAILS, 7, 106, 70, 15 - LTEXT " .", -1, 91, 110, 154, 17, SS_NOPREFIX + PUSHBUTTON "&Відомості...", IDC_DRIVERDETAILS, 7, 106, 70, 15 + LTEXT "Перегляд відомостей про файли драйвера.", -1, 91, 110, 154, 17, SS_NOPREFIX END IDD_DRIVERDETAILS DIALOGEX DISCARDABLE 0, 0, 224, 230 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUPWINDOW | WS_VISIBLE | WS_DLGFRAME -CAPTION "³ " +CAPTION "Відомості про файли драйвера" FONT 8, "MS Shell Dlg" BEGIN ICON "", IDC_DEVICON, 7, 7, 20, 20 LTEXT "", IDC_DEVNAME, 37, 9, 174, 16, SS_NOPREFIX - LTEXT "& :", -1, 7, 36, 204, 8 + LTEXT "&Файли драйвера:", -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 ":", -1, 4, 134, 50, 8 + LTEXT "Постачальник:", -1, 4, 134, 50, 8 EDITTEXT IDC_FILEPROVIDER, 66, 134, 155, 8, NOT WS_TABSTOP | NOT WS_BORDER | ES_AUTOHSCROLL | ES_READONLY - LTEXT " :", -1, 4, 150, 50, 8 + LTEXT "Версія файлу:", -1, 4, 150, 50, 8 EDITTEXT IDC_FILEVERSION, 66, 150, 155, 8, NOT WS_TABSTOP | NOT WS_BORDER | ES_AUTOHSCROLL | ES_READONLY - LTEXT " :", -1, 4, 166, 65, 8 + LTEXT "Авторські права:", -1, 4, 166, 65, 8 EDITTEXT IDC_FILECOPYRIGHT, 66, 166, 155, 8, NOT WS_TABSTOP | NOT WS_BORDER | ES_AUTOHSCROLL | ES_READONLY - LTEXT " :", -1, 4, 182, 65, 8 + LTEXT "Цифровий підпис:", -1, 4, 182, 65, 8 EDITTEXT IDC_DIGITALSIGNER, 66, 182, 155, 8, NOT WS_TABSTOP | NOT WS_BORDER | ES_AUTOHSCROLL | ES_READONLY DEFPUSHBUTTON "OK", IDOK, 167, 208, 50, 14 END IDD_DEVICEDETAILS DIALOGEX DISCARDABLE 0, 0, 252, 218 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "³" +CAPTION "Відомості" FONT 8, "MS Shell Dlg" BEGIN ICON "", IDC_DEVICON, 7, 7, 20, 20 @@ -218,7 +218,7 @@ END IDD_DEVICERESOURCES DIALOGEX DISCARDABLE 0, 0, 252, 218 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Ресурси" FONT 8, "MS Shell Dlg" BEGIN ICON "", IDC_DEVICON, 7, 7, 20, 20 @@ -227,7 +227,7 @@ END IDD_DEVICEPOWER DIALOGEX DISCARDABLE 0, 0, 252, 218 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Живлення" FONT 8, "MS Shell Dlg" BEGIN ICON "", IDC_DEVICON, 7, 7, 20, 20 diff --git a/dll/win32/dhcpcsvc/CMakeLists.txt b/dll/win32/dhcpcsvc/CMakeLists.txt index 1d2323ab522..f82c89cdfc8 100644 --- a/dll/win32/dhcpcsvc/CMakeLists.txt +++ b/dll/win32/dhcpcsvc/CMakeLists.txt @@ -23,15 +23,13 @@ list(APPEND SOURCE ${CMAKE_CURRENT_BINARY_DIR}/dhcpcsvc_stubs.c ${CMAKE_CURRENT_BINARY_DIR}/dhcpcsvc.def) -add_library(dhcpcsvc SHARED - ${CMAKE_CURRENT_BINARY_DIR}/dhcpcsvc_rosdhcp.h.gch - ${SOURCE}) +add_library(dhcpcsvc SHARED ${SOURCE}) set_module_type(dhcpcsvc win32dll) add_importlibs(dhcpcsvc ws2_32 iphlpapi advapi32 msvcrt kernel32 ntdll) add_importlib_target(dhcpcsvc.spec) -add_pch(dhcpcsvc ${CMAKE_CURRENT_SOURCE_DIR}/include/rosdhcp.h ${SOURCE}) +add_pch(dhcpcsvc include/rosdhcp.h) add_cd_file(TARGET dhcpcsvc DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/dhcpcsvc/dhcp/alloc.c b/dll/win32/dhcpcsvc/dhcp/alloc.c index 97027fa4445..afcd6469b98 100644 --- a/dll/win32/dhcpcsvc/dhcp/alloc.c +++ b/dll/win32/dhcpcsvc/dhcp/alloc.c @@ -41,7 +41,6 @@ */ #include "rosdhcp.h" -#include "dhcpd.h" struct string_list * new_string_list(size_t size) diff --git a/dll/win32/dhcpcsvc/dhcp/api.c b/dll/win32/dhcpcsvc/dhcp/api.c index efa07a80a54..7623be382ac 100644 --- a/dll/win32/dhcpcsvc/dhcp/api.c +++ b/dll/win32/dhcpcsvc/dhcp/api.c @@ -8,8 +8,6 @@ */ #include "rosdhcp.h" -#include -#include #define NDEBUG #include diff --git a/dll/win32/dhcpcsvc/dhcp/compat.c b/dll/win32/dhcpcsvc/dhcp/compat.c index 83c9c12ea8c..20db25cc13f 100644 --- a/dll/win32/dhcpcsvc/dhcp/compat.c +++ b/dll/win32/dhcpcsvc/dhcp/compat.c @@ -1,6 +1,4 @@ #include "rosdhcp.h" -#include "dhcpd.h" -#include "stdint.h" size_t strlcpy(char *d, const char *s, size_t bufsize) { diff --git a/dll/win32/dhcpcsvc/dhcp/dhclient.c b/dll/win32/dhcpcsvc/dhcp/dhclient.c index 3b60e1ad95d..cbdb4fef4c9 100644 --- a/dll/win32/dhcpcsvc/dhcp/dhclient.c +++ b/dll/win32/dhcpcsvc/dhcp/dhclient.c @@ -54,7 +54,6 @@ */ #include "rosdhcp.h" -#include "dhcpd.h" #define PERIOD 0x2e #define hyphenchar(c) ((c) == 0x2d) @@ -190,7 +189,7 @@ ServiceMain(DWORD argc, LPWSTR *argv) NULL); if (!ServiceStatusHandle) { - DbgPrint("DHCPCSVC: Unable to register service control handler (%x)\n", GetLastError); + DbgPrint("DHCPCSVC: Unable to register service control handler (%lx)\n", GetLastError()); return; } diff --git a/dll/win32/dhcpcsvc/dhcp/dispatch.c b/dll/win32/dhcpcsvc/dhcp/dispatch.c index a0ce1d0b0a1..d3872d0d02f 100644 --- a/dll/win32/dhcpcsvc/dhcp/dispatch.c +++ b/dll/win32/dhcpcsvc/dhcp/dispatch.c @@ -40,7 +40,7 @@ */ #include "rosdhcp.h" -#include "dhcpd.h" + //#include //#include diff --git a/dll/win32/dhcpcsvc/dhcp/options.c b/dll/win32/dhcpcsvc/dhcp/options.c index 27be626523a..03cdd477e9a 100644 --- a/dll/win32/dhcpcsvc/dhcp/options.c +++ b/dll/win32/dhcpcsvc/dhcp/options.c @@ -40,12 +40,8 @@ * Enterprises, see ``http://www.vix.com''. */ -#include -#include - #define DHCP_OPTION_DATA #include "rosdhcp.h" -#include "dhcpd.h" int bad_options = 0; int bad_options_max = 5; diff --git a/dll/win32/dhcpcsvc/dhcp/util.c b/dll/win32/dhcpcsvc/dhcp/util.c index 238a788e283..c9a1a3af1f6 100644 --- a/dll/win32/dhcpcsvc/dhcp/util.c +++ b/dll/win32/dhcpcsvc/dhcp/util.c @@ -1,4 +1,3 @@ -#include #include "rosdhcp.h" #define NDEBUG diff --git a/dll/win32/dhcpcsvc/include/rosdhcp.h b/dll/win32/dhcpcsvc/include/rosdhcp.h index 8265de33d0a..07d5bf13c07 100644 --- a/dll/win32/dhcpcsvc/include/rosdhcp.h +++ b/dll/win32/dhcpcsvc/include/rosdhcp.h @@ -4,7 +4,7 @@ #define WIN32_NO_STATUS #include #define NTOS_MODE_USER -#include +#include #include #include #include diff --git a/dll/win32/dnsapi/CMakeLists.txt b/dll/win32/dnsapi/CMakeLists.txt index 42141bdeee5..da10aab172c 100644 --- a/dll/win32/dnsapi/CMakeLists.txt +++ b/dll/win32/dnsapi/CMakeLists.txt @@ -4,9 +4,7 @@ include_directories( ${REACTOS_SOURCE_DIR}/lib/3rdparty/adns/src ${REACTOS_SOURCE_DIR}/lib/3rdparty/adns/adns_win32) -add_definitions( - -D_DLL -D__USE_CRTIMP - -DADNS_JGAA_WIN32) +add_definitions(-DADNS_JGAA_WIN32) spec2def(dnsapi.dll dnsapi.spec) @@ -21,15 +19,12 @@ list(APPEND SOURCE dnsapi.rc ${CMAKE_CURRENT_BINARY_DIR}/dnsapi.def) -add_library(dnsapi SHARED - ${CMAKE_CURRENT_BINARY_DIR}/dnsapi_precomp.h.gch - ${SOURCE}) +add_library(dnsapi SHARED ${SOURCE}) set_entrypoint(dnsapi 0) - target_link_libraries(dnsapi adns) add_importlibs(dnsapi user32 ws2_32 iphlpapi msvcrt kernel32 ntdll) -add_pch(dnsapi ${CMAKE_CURRENT_SOURCE_DIR}/dnsapi/precomp.h ${SOURCE}) +add_pch(dnsapi dnsapi/precomp.h) add_dependencies(dnsapi psdk) add_cd_file(TARGET dnsapi DESTINATION reactos/system32 FOR all) add_importlib_target(dnsapi.spec) diff --git a/dll/win32/dnsapi/dnsapi/precomp.h b/dll/win32/dnsapi/dnsapi/precomp.h index 19bee75948b..cf50fb6a353 100644 --- a/dll/win32/dnsapi/dnsapi/precomp.h +++ b/dll/win32/dnsapi/dnsapi/precomp.h @@ -15,7 +15,7 @@ #include #include #include -#include +#include /* Internal DNSAPI Headers */ #include diff --git a/dll/win32/dnsapi/dnsapi/stubs.c b/dll/win32/dnsapi/dnsapi/stubs.c index 36cd71731e4..be67929c2bc 100644 --- a/dll/win32/dnsapi/dnsapi/stubs.c +++ b/dll/win32/dnsapi/dnsapi/stubs.c @@ -1,10 +1,4 @@ -/* Can't use precomp.h because these weren't stubbed properly */ -#define WIN32_NO_STATUS -#define NTOS_MODE_USER -#include -#include -#include - +#include "precomp.h" #include DNS_STATUS WINAPI diff --git a/dll/win32/fmifs/CMakeLists.txt b/dll/win32/fmifs/CMakeLists.txt index 6595fcaf519..af7b7bfb87a 100644 --- a/dll/win32/fmifs/CMakeLists.txt +++ b/dll/win32/fmifs/CMakeLists.txt @@ -14,12 +14,10 @@ list(APPEND SOURCE ${CMAKE_CURRENT_BINARY_DIR}/fmifs_stubs.c ${CMAKE_CURRENT_BINARY_DIR}/fmifs.def) -add_pch(fmifs ${CMAKE_CURRENT_SOURCE_DIR}/precomp.h ${SOURCE}) -add_library(fmifs SHARED ${CMAKE_CURRENT_BINARY_DIR}/fmifs_precomp.h.gch ${SOURCE}) - +add_library(fmifs SHARED ${SOURCE}) set_entrypoint(fmifs InitializeFmIfs@12) - add_importlibs(fmifs kernel32 ntdll) +add_pch(fmifs precomp.h) add_dependencies(fmifs psdk) add_cd_file(TARGET fmifs DESTINATION reactos/system32 FOR all) add_importlib_target(fmifs.spec) diff --git a/dll/win32/fmifs/precomp.h b/dll/win32/fmifs/precomp.h index 647ce1c04f8..17b4a023435 100644 --- a/dll/win32/fmifs/precomp.h +++ b/dll/win32/fmifs/precomp.h @@ -15,9 +15,13 @@ #define UNICODE #define _UNICODE +#include + /* PSDK/NDK Headers */ #include -#include +#include +#include +#include /* FMIFS Public Header */ #include diff --git a/dll/win32/gdi32/CMakeLists.txt b/dll/win32/gdi32/CMakeLists.txt index 3f679a14dfa..a3aaeb13479 100644 --- a/dll/win32/gdi32/CMakeLists.txt +++ b/dll/win32/gdi32/CMakeLists.txt @@ -1,17 +1,15 @@ set_unicode() -add_definitions( - -D_DLL -D__USE_CRTIMP - -DLANGPACK) +add_definitions(-DLANGPACK) include_directories(include) spec2def(gdi32.dll gdi32.spec) if(ARCH MATCHES i386) -list(APPEND SOURCE - objects/efloat.c) + list(APPEND SOURCE + objects/efloat.c) endif() list(APPEND SOURCE @@ -47,9 +45,7 @@ list(APPEND SOURCE gdi32.rc ${CMAKE_CURRENT_BINARY_DIR}/gdi32.def) -add_library(gdi32 SHARED - ${CMAKE_CURRENT_BINARY_DIR}/gdi32_precomp.h.gch - ${SOURCE}) +add_library(gdi32 SHARED ${SOURCE}) set_module_type(gdi32 win32dll) @@ -59,6 +55,6 @@ target_link_libraries(gdi32 ${PSEH_LIB}) add_importlibs(gdi32 user32 advapi32 msvcrt kernel32 ntdll) -add_pch(gdi32 ${CMAKE_CURRENT_SOURCE_DIR}/include/precomp.h ${SOURCE}) +add_pch(gdi32 include/precomp.h) add_cd_file(TARGET gdi32 DESTINATION reactos/system32 FOR all) add_importlib_target(gdi32.spec) diff --git a/dll/win32/gdi32/include/precomp.h b/dll/win32/gdi32/include/precomp.h index d825612c082..9f1b62770f0 100644 --- a/dll/win32/gdi32/include/precomp.h +++ b/dll/win32/gdi32/include/precomp.h @@ -12,9 +12,11 @@ #define WIN32_NO_STATUS #define NTOS_MODE_USER +#include + /* SDK/DDK/NDK Headers. */ #include -#include +#include #include #include #include @@ -24,6 +26,12 @@ #include +#include +#include +#include +#include +#include + /* Public Win32K Headers */ #include #include diff --git a/dll/win32/gdi32/misc/gdientry.c b/dll/win32/gdi32/misc/gdientry.c index 6e51ea19d17..6203fa03461 100644 --- a/dll/win32/gdi32/misc/gdientry.c +++ b/dll/win32/gdi32/misc/gdientry.c @@ -10,12 +10,6 @@ /* INCLUDES ******************************************************************/ #include "precomp.h" -#include -#include -#include -#include -#include -#include /* DATA **********************************************************************/ diff --git a/dll/win32/gdi32/misc/historic.c b/dll/win32/gdi32/misc/historic.c index 4b5db776cfd..27bd7931a90 100644 --- a/dll/win32/gdi32/misc/historic.c +++ b/dll/win32/gdi32/misc/historic.c @@ -9,12 +9,6 @@ */ #include "precomp.h" -#include -#include -#include -#include -#include -#include /* * @implemented diff --git a/dll/win32/gdi32/objects/bitmap.c b/dll/win32/gdi32/objects/bitmap.c index 9e5aaeb6477..b135d3ac338 100644 --- a/dll/win32/gdi32/objects/bitmap.c +++ b/dll/win32/gdi32/objects/bitmap.c @@ -679,31 +679,27 @@ SetDIBitsToDevice( #endif cjBmpScanSize = DIB_BitmapMaxBitsSize((LPBITMAPINFO)lpbmi, ScanLines); - if ( Bits ) - { - pvSafeBits = RtlAllocateHeap(GetProcessHeap(), 0, cjBmpScanSize); - if (pvSafeBits) - { - _SEH2_TRY - { - RtlCopyMemory( pvSafeBits, Bits, cjBmpScanSize); - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - Hit = TRUE; - } - _SEH2_END + pvSafeBits = RtlAllocateHeap(GetProcessHeap(), 0, cjBmpScanSize); + if (pvSafeBits) + { + _SEH2_TRY + { + RtlCopyMemory( pvSafeBits, Bits, cjBmpScanSize); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + Hit = TRUE; + } + _SEH2_END - if (Hit) - { - // We don't die, we continue on with a allocated safe pointer to kernel - // space..... - DPRINT1("SetDIBitsToDevice fail to read BitMapInfo: %x or Bits: %x & Size: %d\n",pConvertedInfo,Bits,cjBmpScanSize); - } - DPRINT("SetDIBitsToDevice Allocate Bits %d!!!\n", cjBmpScanSize); - } - - } + if (Hit) + { + // We don't die, we continue on with a allocated safe pointer to kernel + // space..... + DPRINT1("SetDIBitsToDevice fail to read BitMapInfo: %x or Bits: %x & Size: %d\n",pConvertedInfo,Bits,cjBmpScanSize); + } + DPRINT("SetDIBitsToDevice Allocate Bits %d!!!\n", cjBmpScanSize); + } if (!GdiGetHandleUserData(hdc, GDI_OBJECT_TYPE_DC, (PVOID)&pDc_Attr)) { diff --git a/dll/win32/gdiplus/CMakeLists.txt b/dll/win32/gdiplus/CMakeLists.txt index 696628e6114..cf2e3742b0e 100644 --- a/dll/win32/gdiplus/CMakeLists.txt +++ b/dll/win32/gdiplus/CMakeLists.txt @@ -1,8 +1,7 @@ add_definitions( -D__WINESRC__ - -D_USE_MATH_DEFINES - -D_DLL -D__USE_CRTIMP) + -D_USE_MATH_DEFINES) include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine) @@ -24,14 +23,18 @@ list(APPEND SOURCE pen.c region.c stringformat.c - #${REACTOS_BINARY_DIR}/include/psdk/wincodec_i.c ${CMAKE_CURRENT_BINARY_DIR}/gdiplus_stubs.c ${CMAKE_CURRENT_BINARY_DIR}/gdiplus.def) +if(MSVC) + set_source_files_properties(${REACTOS_BINARY_DIR}/include/psdk/wincodec_i.c PROPERTIES GENERATED TRUE) + list(APPEND SOURCE + ${REACTOS_BINARY_DIR}/include/psdk/wincodec_i.c) +endif() + add_library(gdiplus SHARED ${SOURCE}) set_module_type(gdiplus win32dll) - target_link_libraries(gdiplus uuid wine) add_importlibs(gdiplus @@ -46,9 +49,9 @@ add_importlibs(gdiplus ntdll) add_importlib_target(gdiplus.spec) - + if(ARCH MATCHES amd64) -target_link_libraries(gdiplus crt) -endif(ARCH MATCHES amd64) + target_link_libraries(gdiplus crt) +endif() add_cd_file(TARGET gdiplus DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/glu32/CMakeLists.txt b/dll/win32/glu32/CMakeLists.txt index 0013b2d1af0..24f98502940 100644 --- a/dll/win32/glu32/CMakeLists.txt +++ b/dll/win32/glu32/CMakeLists.txt @@ -2,8 +2,7 @@ add_definitions( -DRESOLVE_3D_TEXTURE_SUPPORT -DBUILD_GL32 - -DLIBRARYBUILD - -D_DLL -D__USE_CRTIMP) + -DLIBRARYBUILD) include_directories( include @@ -111,7 +110,9 @@ add_library(glu32 SHARED ${SOURCE}) set_entrypoint(glu32 0) -target_link_libraries(glu32 stlport -lsupc++ -lgcc -lmingw32 -lcoldname) +if(NOT MSVC) + target_link_libraries(glu32 stlport -lsupc++ -lgcc -lmingw32 oldnames) +endif() add_importlibs(glu32 opengl32 diff --git a/dll/win32/glu32/include/gluos.h b/dll/win32/glu32/include/gluos.h index ad15a840316..bc88a534f2a 100644 --- a/dll/win32/glu32/include/gluos.h +++ b/dll/win32/glu32/include/gluos.h @@ -108,9 +108,11 @@ #pragma warning(disable : 4761) #endif +/* #if defined(_MSC_VER) && _MSC_VER >= 1200 #pragma comment(linker, "/OPT:NOWIN98") #endif +*/ #ifndef GLAPIENTRY #define GLAPIENTRY APIENTRY diff --git a/dll/win32/hhctrl.ocx/CMakeLists.txt b/dll/win32/hhctrl.ocx/CMakeLists.txt index 814b5c4fe05..88f1a764a62 100644 --- a/dll/win32/hhctrl.ocx/CMakeLists.txt +++ b/dll/win32/hhctrl.ocx/CMakeLists.txt @@ -38,4 +38,6 @@ add_importlibs(hhctrl kernel32 ntdll) +add_dependencies(hhctrl wineheaders) +add_pch(hhctrl hhctrl.h) add_cd_file(TARGET hhctrl DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/hhctrl.ocx/hhctrl.ocx.rbuild b/dll/win32/hhctrl.ocx/hhctrl.ocx.rbuild index 9cd7d4cfdfd..0f991efc284 100644 --- a/dll/win32/hhctrl.ocx/hhctrl.ocx.rbuild +++ b/dll/win32/hhctrl.ocx/hhctrl.ocx.rbuild @@ -20,6 +20,7 @@ stream.c webbrowser.c hhctrl.rc + hhctrl.h wine advapi32 comctl32 diff --git a/dll/win32/hid/CMakeLists.txt b/dll/win32/hid/CMakeLists.txt index 646fe86a22a..0a32561b58d 100644 --- a/dll/win32/hid/CMakeLists.txt +++ b/dll/win32/hid/CMakeLists.txt @@ -9,12 +9,10 @@ list(APPEND SOURCE spec2def(hid.dll hid.spec) -add_library(hid SHARED - ${CMAKE_CURRENT_BINARY_DIR}/hid_precomp.h.gch - ${SOURCE}) +add_library(hid SHARED ${SOURCE}) set_module_type(hid win32dll) add_importlibs(hid msvcrt kernel32 ntdll) -add_pch(hid ${CMAKE_CURRENT_SOURCE_DIR}/precomp.h ${SOURCE}) +add_pch(hid precomp.h) add_cd_file(TARGET hid DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/hid/hid.def b/dll/win32/hid/hid.def deleted file mode 100644 index 7fe843f0237..00000000000 --- a/dll/win32/hid/hid.def +++ /dev/null @@ -1,50 +0,0 @@ -LIBRARY hid.dll - -EXPORTS -HidD_FlushQueue@4 -HidD_FreePreparsedData@4 -HidD_GetAttributes@8 -HidD_GetConfiguration@12 -HidD_GetFeature@12 -HidD_GetHidGuid@4 -HidD_GetIndexedString@16 -HidD_GetInputReport@12 -HidD_GetManufacturerString@12 -HidD_GetMsGenreDescriptor@12 -HidD_GetNumInputBuffers@8 -HidD_GetPhysicalDescriptor@12 -HidD_GetPreparsedData@8 -HidD_GetProductString@12 -HidD_GetSerialNumberString@12 -HidD_Hello@8 -HidD_SetConfiguration@12 -HidD_SetFeature@12 -HidD_SetNumInputBuffers@8 -HidD_SetOutputReport@12 -HidP_GetButtonCaps@16 -HidP_GetCaps@8 -HidP_GetData@24 -HidP_GetExtendedAttributes@20 -HidP_GetLinkCollectionNodes@12 -HidP_GetScaledUsageValue@32 -HidP_GetSpecificButtonCaps@28 -HidP_GetSpecificValueCaps@28 -HidP_GetUsageValue@32 -HidP_GetUsageValueArray@36 -HidP_GetUsages@32 -HidP_GetUsagesEx@28 -HidP_GetValueCaps@16 -HidP_InitializeReportForID@20 -HidP_MaxDataListLength@8 -HidP_MaxUsageListLength@12 -HidP_SetData@24 -HidP_SetScaledUsageValue@32 -HidP_SetUsageValue@32 -HidP_SetUsageValueArray@36 -HidP_SetUsages@32 -HidP_TranslateUsagesToI8042ScanCodes@24 -HidP_UnsetUsages@32 -HidP_UsageListDifference@20 -;HidservInstaller@0 - -; EOF diff --git a/dll/win32/hid/precomp.h b/dll/win32/hid/precomp.h index 9ae79cae666..7f544a3b707 100644 --- a/dll/win32/hid/precomp.h +++ b/dll/win32/hid/precomp.h @@ -1,6 +1,8 @@ #define WIN32_NO_STATUS #include #include +#define NTOS_MODE_USER +#include #define _HIDPI_ #define _HIDPI_NO_FUNCTION_MACROS_ @@ -10,7 +12,7 @@ typedef VOID typedef VOID (WINAPI *PINTERFACE_DEREFERENCE)( PVOID Context); -#include + #include #include #include diff --git a/dll/win32/hlink/CMakeLists.txt b/dll/win32/hlink/CMakeLists.txt index 4229f6dccb6..f054ab8c877 100644 --- a/dll/win32/hlink/CMakeLists.txt +++ b/dll/win32/hlink/CMakeLists.txt @@ -27,5 +27,6 @@ add_importlibs(hlink kernel32 ntdll) +add_pch(hlink hlink_private.h) add_importlib_target(hlink.spec) add_cd_file(TARGET hlink DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/hlink/hlink.rbuild b/dll/win32/hlink/hlink.rbuild index f5753ca15a0..1a64f365fb3 100644 --- a/dll/win32/hlink/hlink.rbuild +++ b/dll/win32/hlink/hlink.rbuild @@ -11,6 +11,7 @@ extserv.c hlink_main.c link.c + hlink_private.h wine shell32 ole32 diff --git a/dll/win32/imaadp32.acm/CMakeLists.txt b/dll/win32/imaadp32.acm/CMakeLists.txt index 3693cd025ad..772071b846b 100644 --- a/dll/win32/imaadp32.acm/CMakeLists.txt +++ b/dll/win32/imaadp32.acm/CMakeLists.txt @@ -1,8 +1,5 @@ -add_definitions( - -D_DLL -D__USE_CRTIMP - -D__WINESRC__) - +add_definitions(-D__WINESRC__) include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine) spec2def(imaadp32.acm imaadp32.acm.spec) @@ -15,9 +12,7 @@ add_library(imaadp32.acm SHARED ${SOURCE}) set_entrypoint(imaadp32.acm 0) set_target_properties(imaadp32.acm PROPERTIES SUFFIX "") - target_link_libraries(imaadp32.acm wine) - add_importlibs(imaadp32.acm winmm user32 msvcrt kernel32 ntdll) add_dependencies(imaadp32.acm psdk) add_cd_file(TARGET imaadp32.acm DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/imagehlp/CMakeLists.txt b/dll/win32/imagehlp/CMakeLists.txt index d14eed603e5..573098c670e 100644 --- a/dll/win32/imagehlp/CMakeLists.txt +++ b/dll/win32/imagehlp/CMakeLists.txt @@ -1,8 +1,5 @@ -add_definitions( - -D_DLL -D__USE_CRTIMP - -D_IMAGEHLP_SOURCE_) - +add_definitions(-D_IMAGEHLP_SOURCE_) include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine) spec2def(imagehlp.dll imagehlp.spec) @@ -16,17 +13,11 @@ list(APPEND SOURCE ${CMAKE_CURRENT_BINARY_DIR}/imagehlp_stubs.c ${CMAKE_CURRENT_BINARY_DIR}/imagehlp.def) -add_library(imagehlp SHARED - ${CMAKE_CURRENT_BINARY_DIR}/imagehlp_precomp.h.gch - ${SOURCE}) +add_library(imagehlp SHARED ${SOURCE}) set_module_type(imagehlp win32dll) - target_link_libraries(imagehlp wine) - add_importlibs(imagehlp dbghelp msvcrt kernel32 ntdll) add_importlib_target(imagehlp.spec) - -add_pch(imagehlp ${CMAKE_CURRENT_SOURCE_DIR}/precomp.h ${SOURCE}) - +add_pch(imagehlp precomp.h) add_cd_file(TARGET imagehlp DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/inetmib1/CMakeLists.txt b/dll/win32/inetmib1/CMakeLists.txt index ac98360c7ea..84b92fc5424 100644 --- a/dll/win32/inetmib1/CMakeLists.txt +++ b/dll/win32/inetmib1/CMakeLists.txt @@ -1,8 +1,5 @@ -add_definitions( - -D__WINESRC__ - -D_DLL -D__USE_CRTIMP) - +add_definitions(-D__WINESRC__) include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine) spec2def(inetmib1.dll inetmib1.spec) @@ -15,7 +12,6 @@ list(APPEND SOURCE add_library(inetmib1 SHARED ${SOURCE}) set_module_type(inetmib1 win32dll) - target_link_libraries(inetmib1 wine) add_importlibs(inetmib1 diff --git a/dll/win32/iphlpapi/CMakeLists.txt b/dll/win32/iphlpapi/CMakeLists.txt index 8bc6ca2132e..308e6b778c5 100644 --- a/dll/win32/iphlpapi/CMakeLists.txt +++ b/dll/win32/iphlpapi/CMakeLists.txt @@ -1,8 +1,6 @@ set_unicode() -add_definitions(-D_DLL -D__USE_CRTIMP) - include_directories( ${REACTOS_SOURCE_DIR}/include/reactos/wine ${REACTOS_SOURCE_DIR}/dll/win32/dhcpcsvc/include @@ -26,8 +24,8 @@ list(APPEND SOURCE add_library(iphlpapi SHARED ${SOURCE}) set_module_type(iphlpapi win32dll) - target_link_libraries(iphlpapi wine tdilib) add_importlibs(iphlpapi dhcpcsvc advapi32 ws2_32 msvcrt kernel32 ntdll) +add_pch(iphlpapi iphlpapi_private.h) add_cd_file(TARGET iphlpapi DESTINATION reactos/system32 FOR all) add_importlib_target(iphlpapi.spec) diff --git a/dll/win32/iphlpapi/dhcp_reactos.c b/dll/win32/iphlpapi/dhcp_reactos.c index b72c945f2d5..ecfedda9e97 100644 --- a/dll/win32/iphlpapi/dhcp_reactos.c +++ b/dll/win32/iphlpapi/dhcp_reactos.c @@ -7,10 +7,6 @@ */ #include "iphlpapi_private.h" -#include "dhcp.h" -#include "dhcpcsdk.h" -#include "dhcpcapi.h" -#include DWORD APIENTRY DhcpRosGetAdapterInfo(DWORD AdapterIndex, PBOOL DhcpEnabled, diff --git a/dll/win32/iphlpapi/ifenum_reactos.c b/dll/win32/iphlpapi/ifenum_reactos.c index 0ffe129ebd0..fd6c787304d 100644 --- a/dll/win32/iphlpapi/ifenum_reactos.c +++ b/dll/win32/iphlpapi/ifenum_reactos.c @@ -37,8 +37,6 @@ * functions into iphlpv6.c (arty) */ #include "iphlpapi_private.h" -#include "ifenum.h" -#include WINE_DEFAULT_DEBUG_CHANNEL(iphlpapi); @@ -204,6 +202,8 @@ static NTSTATUS getInterfaceInfoSet( HANDLE tcpFile, } } + tdiFreeThingSet(entIDSet); + if (NT_SUCCESS(status)) { *infoSet = infoSetInt; *numInterfaces = curInterf; @@ -287,12 +287,12 @@ DWORD getNthInterfaceEntity( HANDLE tcpFile, DWORD index, TDIEntityID *ent ) { TRACE("Index %d is entity #%d - %04x:%08x\n", index, i, entitySet[i].tei_entity, entitySet[i].tei_instance ); + tdiFreeThingSet( entitySet ); + if( numInterfaces == index && i < numEntities ) { memcpy( ent, &entitySet[i], sizeof(*ent) ); - tdiFreeThingSet( entitySet ); return STATUS_SUCCESS; } else { - tdiFreeThingSet( entitySet ); return STATUS_UNSUCCESSFUL; } } @@ -304,6 +304,7 @@ NTSTATUS getInterfaceInfoByIndex( HANDLE tcpFile, DWORD index, IFInfo *info ) { int i; if( NT_SUCCESS(status) ) + { for( i = 0; i < numInterfaces; i++ ) { if( ifInfo[i].if_info.ent.if_index == index ) { memcpy( info, &ifInfo[i], sizeof(*info) ); @@ -311,10 +312,12 @@ NTSTATUS getInterfaceInfoByIndex( HANDLE tcpFile, DWORD index, IFInfo *info ) { } } - if( NT_SUCCESS(status) ) + HeapFree(GetProcessHeap(), 0, ifInfo); + return i < numInterfaces ? STATUS_SUCCESS : STATUS_UNSUCCESSFUL; - else - return status; + } + + return status; } NTSTATUS getInterfaceInfoByName( HANDLE tcpFile, char *name, IFInfo *info ) { @@ -324,6 +327,7 @@ NTSTATUS getInterfaceInfoByName( HANDLE tcpFile, char *name, IFInfo *info ) { NTSTATUS status = getInterfaceInfoSet( tcpFile, &ifInfo, &numInterfaces ); if( NT_SUCCESS(status) ) + { for( i = 0; i < numInterfaces; i++ ) { if( !strcmp((PCHAR)ifInfo[i].if_info.ent.if_descr, name) ) { memcpy( info, &ifInfo[i], sizeof(*info) ); @@ -331,10 +335,12 @@ NTSTATUS getInterfaceInfoByName( HANDLE tcpFile, char *name, IFInfo *info ) { } } - if( NT_SUCCESS(status) ) + HeapFree(GetProcessHeap(), 0,ifInfo); + return i < numInterfaces ? STATUS_SUCCESS : STATUS_UNSUCCESSFUL; - else - return status; + } + + return status; } /* Note that the result of this operation must be freed later */ diff --git a/dll/win32/iphlpapi/iphlpapi.rbuild b/dll/win32/iphlpapi/iphlpapi.rbuild index ed1fe25218e..ac85f54437c 100644 --- a/dll/win32/iphlpapi/iphlpapi.rbuild +++ b/dll/win32/iphlpapi/iphlpapi.rbuild @@ -19,4 +19,5 @@ resinfo_reactos.c route_reactos.c iphlpapi.rc + iphlpapi_private.h diff --git a/dll/win32/iphlpapi/iphlpapi_main.c b/dll/win32/iphlpapi/iphlpapi_main.c index 50f8d614e40..6b4791efd8f 100644 --- a/dll/win32/iphlpapi/iphlpapi_main.c +++ b/dll/win32/iphlpapi/iphlpapi_main.c @@ -18,39 +18,11 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#define DEBUG + #include "config.h" #include "iphlpapi_private.h" -#include -#include -#include -#ifdef HAVE_NETINET_IN_H -# include -#endif -#ifdef HAVE_ARPA_INET_H -# include -#endif -#ifdef HAVE_ARPA_NAMESER_H -# include -#endif -#ifdef HAVE_RESOLV_H -# include -#endif - -#define DEBUG -#include "windef.h" -#include "winbase.h" -#include "winreg.h" -#include "iphlpapi.h" -#include "dhcp.h" -#include "ifenum.h" -#include "ipstats.h" -#include "resinfo.h" -#include "route.h" -#include "wine/debug.h" -#include "dhcpcsdk.h" -#include "dhcpcapi.h" - WINE_DEFAULT_DEBUG_CHANNEL(iphlpapi); typedef struct _NAME_SERVER_LIST_CONTEXT { diff --git a/dll/win32/iphlpapi/iphlpapi_private.h b/dll/win32/iphlpapi/iphlpapi_private.h index 767b97c9ed8..b721c0eca55 100644 --- a/dll/win32/iphlpapi/iphlpapi_private.h +++ b/dll/win32/iphlpapi/iphlpapi_private.h @@ -4,6 +4,7 @@ #define NtCurrentTeb NtXCurrentTeb #include +#include #include #include #ifdef HAVE_NETINET_IN_H @@ -24,19 +25,31 @@ #include #include #define NTOS_MODE_USER -#include +#include +#include +#include #include #include #include "iphlpapi.h" #include "resinfo.h" #include "wine/debug.h" +#include "dhcp.h" +#include "dhcpcsdk.h" +#include "dhcpcapi.h" +#include + //#include "ntddndis.h" #include "tdiinfo.h" #include "tcpioctl.h" #include "tdilib.h" +#include "ifenum.h" + +#include "ipstats.h" +#include "route.h" + #ifndef ETH_ALEN #define ETH_ALEN 6 #endif diff --git a/dll/win32/iphlpapi/ipstats_reactos.c b/dll/win32/iphlpapi/ipstats_reactos.c index e05b9e67767..4f732f5cfc4 100644 --- a/dll/win32/iphlpapi/ipstats_reactos.c +++ b/dll/win32/iphlpapi/ipstats_reactos.c @@ -19,11 +19,7 @@ * tcpip.sys */ -#include - #include "iphlpapi_private.h" -#include "ipstats.h" -#include "ifenum.h" WINE_DEFAULT_DEBUG_CHANNEL(iphlpapi); diff --git a/dll/win32/iphlpapi/resinfo_reactos.c b/dll/win32/iphlpapi/resinfo_reactos.c index 6ee496a4b75..d2f6fe3b385 100644 --- a/dll/win32/iphlpapi/resinfo_reactos.c +++ b/dll/win32/iphlpapi/resinfo_reactos.c @@ -24,29 +24,6 @@ #include "config.h" #include "iphlpapi_private.h" -#include -#include -#include -#ifdef HAVE_NETINET_IN_H -# include -#endif -#ifdef HAVE_ARPA_INET_H -# include -#endif -#ifdef HAVE_ARPA_NAMESER_H -# include -#endif -#ifdef HAVE_RESOLV_H -# include -#endif - -#include "windef.h" -#include "winbase.h" -#include "winreg.h" -#include "resinfo.h" -#include "iphlpapi.h" -#include "wine/debug.h" - WINE_DEFAULT_DEBUG_CHANNEL(iphlpapi); typedef struct _NAME_SERVER_LIST_PRIVATE { diff --git a/dll/win32/iphlpapi/route_reactos.c b/dll/win32/iphlpapi/route_reactos.c index 5af1c8ff21d..453ddab43f7 100644 --- a/dll/win32/iphlpapi/route_reactos.c +++ b/dll/win32/iphlpapi/route_reactos.c @@ -24,29 +24,6 @@ #include "config.h" #include "iphlpapi_private.h" -#include -#include -#include -#ifdef HAVE_NETINET_IN_H -# include -#endif -#ifdef HAVE_ARPA_INET_H -# include -#endif -#ifdef HAVE_ARPA_NAMESER_H -# include -#endif -#ifdef HAVE_RESOLV_H -# include -#endif - -#include "windef.h" -#include "winbase.h" -#include "winreg.h" -#include "resinfo.h" -#include "iphlpapi.h" -#include "wine/debug.h" - #define IP_FORWARD_ADD 3 #define IP_FORWARD_DEL 2 diff --git a/dll/win32/itss/CMakeLists.txt b/dll/win32/itss/CMakeLists.txt index fd53de89a2b..188c2c37784 100644 --- a/dll/win32/itss/CMakeLists.txt +++ b/dll/win32/itss/CMakeLists.txt @@ -1,8 +1,5 @@ -add_definitions( - -D__WINESRC__ - -D_DLL -D__USE_CRTIMP) - +add_definitions(-D__WINESRC__) include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine) set_rc_compiler() @@ -24,8 +21,10 @@ list(APPEND SOURCE add_library(itss SHARED ${SOURCE}) set_module_type(itss win32dll) - target_link_libraries(itss uuid wine) +if(MSVC) + target_link_libraries(itss itss_guid) +endif() add_importlibs(itss urlmon diff --git a/dll/win32/jscript/CMakeLists.txt b/dll/win32/jscript/CMakeLists.txt index 08d53fc21e4..d346e64a206 100644 --- a/dll/win32/jscript/CMakeLists.txt +++ b/dll/win32/jscript/CMakeLists.txt @@ -1,5 +1,6 @@ add_typelib(jsglobal jsglobal.idl) + add_dependencies(jsglobal stdole2) remove_definitions(-D_WIN32_WINNT=0x502) @@ -8,8 +9,6 @@ add_definitions(-D_WIN32_WINNT=0x600) add_definitions( -D__WINESRC__ -D_USE_MATH_DEFINES - -D_DLL - -D__USE_CRTIMP -Disinf=!_finite -Disnan=_isnan) @@ -60,5 +59,6 @@ add_importlibs(jscript kernel32 ntdll) +add_pch(jscript jscript.h) add_dependencies(jscript jsglobal) add_cd_file(TARGET jscript DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/jscript/jscript.rbuild b/dll/win32/jscript/jscript.rbuild index 4d31ff6f513..d4c1b5faeab 100644 --- a/dll/win32/jscript/jscript.rbuild +++ b/dll/win32/jscript/jscript.rbuild @@ -36,6 +36,7 @@ function.c global.c rsrc.rc + jscript.h stdole2 diff --git a/dll/win32/kernel32/CMakeLists.txt b/dll/win32/kernel32/CMakeLists.txt index e94f5134b7d..6fbb71e4649 100644 --- a/dll/win32/kernel32/CMakeLists.txt +++ b/dll/win32/kernel32/CMakeLists.txt @@ -1,9 +1,6 @@ add_definitions(-D_KERNEL32_) -remove_definitions(-D_WIN32_WINNT=0x502) -add_definitions(-D_WIN32_WINNT=0x600) - include_directories(${REACTOS_SOURCE_DIR}/include/reactos/subsys) set_rc_compiler() @@ -11,115 +8,98 @@ set_rc_compiler() spec2def(kernel32.dll kernel32.spec) list(APPEND SOURCE - debug/debugger.c - debug/output.c - except/except.c - file/backup.c - file/bintype.c - file/cnotify.c - file/copy.c - file/create.c - file/curdir.c - file/delete.c - file/deviceio.c - file/dir.c - file/dosdev.c - file/file.c - file/find.c - file/hardlink.c - file/iocompl.c - file/lfile.c - file/lock.c - file/mailslot.c - file/move.c - file/npipe.c - file/pipe.c - file/rw.c - file/tape.c - file/volume.c - mem/global.c - mem/heap.c - mem/isbad.c - mem/local.c - mem/procmem.c - mem/resnotify.c - mem/section.c - mem/virtual.c - misc/actctx.c - misc/atom.c - misc/casemap.c - misc/chartype.c - misc/collation.c - misc/comm.c - misc/commdcb.c - misc/computername.c - misc/console.c - misc/dllmain.c - misc/env.c - misc/error.c - misc/fold.c - misc/format_msg.c - misc/handle.c - misc/lang.c - misc/lcformat.c - misc/ldr.c - misc/lzexpand.c - misc/muldiv.c - misc/nls.c - misc/perfcnt.c - misc/power.c - misc/profile.c - misc/recovery.c - misc/res.c - misc/sortkey.c - misc/stubs.c - misc/sysinfo.c - misc/time.c - misc/timerqueue.c - misc/toolhelp.c - misc/utils.c - misc/version.c - process/cmdline.c - process/procsup.c - process/job.c - process/proc.c - process/session.c - string/lstring.c - synch/condvar.c - synch/critical.c - synch/event.c - synch/mutex.c - synch/sem.c - synch/timer.c - synch/wait.c - thread/fiber.c - thread/fls.c - thread/thread.c - thread/tls.c + client/appcache.c + client/atom.c + client/compname.c + client/debugger.c + client/dllmain.c + client/environ.c + client/except.c + client/fiber.c + client/handle.c + client/heapmem.c + client/job.c + client/loader.c + client/perfcnt.c + client/power.c + client/proc.c + client/resntfy.c + client/session.c + client/synch.c + client/sysinfo.c + client/time.c + client/timerqueue.c + client/toolhelp.c + client/utils.c + client/thread.c + client/vdm.c + client/version.c + client/virtmem.c + client/vista.c + client/file/backup.c + client/file/bintype.c + client/file/cnotify.c + client/file/copy.c + client/file/console.c + client/file/create.c + client/file/curdir.c + client/file/delete.c + client/file/deviceio.c + client/file/dir.c + client/file/dosdev.c + client/file/file.c + client/file/filemap.c + client/file/find.c + client/file/hardlink.c + client/file/iocompl.c + client/file/lfile.c + client/file/lock.c + client/file/mailslot.c + client/file/move.c + client/file/npipe.c + client/file/pipe.c + client/file/rw.c + client/file/tape.c + client/file/volume.c + wine/actctx.c + wine/comm.c + wine/lzexpand.c + wine/muldiv.c + wine/profile.c + wine/res.c + wine/timezone.c + winnls/string/casemap.c + winnls/string/chartype.c + winnls/string/collation.c + winnls/string/fold.c + winnls/string/format_msg.c + winnls/string/lang.c + winnls/string/lcformat.c + winnls/string/lstring.c + winnls/string/nls.c + winnls/string/sortkey.c kernel32.rc ${CMAKE_CURRENT_BINARY_DIR}/kernel32.def) if(ARCH MATCHES i386) list(APPEND SOURCE - thread/i386/fiber.S - thread/i386/thread.S) + client/i386/fiber.S + client/i386/thread.S) elseif(ARCH MATCHES amd64) list(APPEND SOURCE - thread/amd64/fiber.S - thread/amd64/thread.S) + client/amd64/fiber.S + client/amd64/thread.S) endif(ARCH MATCHES i386) -add_library(kernel32 SHARED - ${CMAKE_CURRENT_BINARY_DIR}/kernel32_k32.h.gch - ${SOURCE}) +add_library(kernel32 SHARED ${SOURCE}) set_entrypoint(kernel32 DllMain@12) set_image_base(kernel32 ${baseaddress_kernel32}) -target_link_libraries(kernel32 ${PSEH_LIB}) +target_link_libraries(kernel32 wine chkstk ${PSEH_LIB}) add_importlibs(kernel32 ntdll) -add_pch(kernel32 ${CMAKE_CURRENT_SOURCE_DIR}/k32.h ${SOURCE}) +add_pch(kernel32 k32.h) add_dependencies(kernel32 psdk errcodes asm) add_cd_file(TARGET kernel32 DESTINATION reactos/system32 FOR all) add_importlib_target(kernel32.spec) diff --git a/dll/win32/kernel32/client/amd64/fiber.S b/dll/win32/kernel32/client/amd64/fiber.S new file mode 100644 index 00000000000..14fdfa5f713 --- /dev/null +++ b/dll/win32/kernel32/client/amd64/fiber.S @@ -0,0 +1,27 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * FILE: dll/win32//kernel32/client/amd64/fiber.S + * PURPOSE: Fiber context switch code for the amd64 architecture + * PROGRAMMER: + */ + +#include + +PUBLIC BaseFiberStartup +.PROC BaseFiberStartup + UNIMPLEMENTED BaseFiberStartup + /* FIXME: TODO */ + ret + +.ENDP BaseFiberStartup + + +PUBLIC SwitchToFiber + +SwitchToFiber: + UNIMPLEMENTED BaseFiberStartup + /* FIXME: TODO */ + ret + +END diff --git a/dll/win32/kernel32/thread/amd64/thread.S b/dll/win32/kernel32/client/amd64/thread.S similarity index 100% rename from dll/win32/kernel32/thread/amd64/thread.S rename to dll/win32/kernel32/client/amd64/thread.S diff --git a/dll/win32/kernel32/client/appcache.c b/dll/win32/kernel32/client/appcache.c new file mode 100644 index 00000000000..abe500fdab1 --- /dev/null +++ b/dll/win32/kernel32/client/appcache.c @@ -0,0 +1,166 @@ +/* + * PROJECT: ReactOS Win32 Base API + * LICENSE: GPL - See COPYING in the top level directory + * FILE: dll/win32/kernel32/client/appcache.c + * PURPOSE: Application Compatibility Cache + * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org) + */ + +/* INCLUDES *******************************************************************/ + +#include + +#define NDEBUG +#include + +/* TYPES **********************************************************************/ + +/* FUNCTIONS ******************************************************************/ + +/* + * @unimplemented + */ +NTSTATUS +WINAPI +BasepCheckBadapp(int a, wchar_t *Str, int b, int c, int d, int e, int f, int g, int h) +{ + STUB; + return STATUS_NOT_IMPLEMENTED; +} + +/* + * @unimplemented + */ +VOID +WINAPI +BaseDumpAppcompatCache(VOID) +{ + STUB; +} + +/* + * @unimplemented + */ +VOID +WINAPI +BaseFlushAppcompatCache(VOID) +{ + STUB; +} + +/* + * @unimplemented + */ +VOID +WINAPI +BasepFreeAppCompatData(PVOID A, PVOID B) +{ + STUB; +} + +/* + * @unimplemented + */ +BOOL +WINAPI +BaseIsAppcompatInfrastructureDisabled(VOID) +{ + STUB; + return TRUE; +} + +/* + * @unimplemented + */ +BOOL +WINAPI +BaseCheckAppcompatCache(ULONG Unknown1, + ULONG Unknown2, + ULONG Unknown3, + PULONG Unknown4) +{ + STUB; + if (Unknown4) *Unknown4 = 0; + return TRUE; +} + +/* + * @unimplemented + */ +VOID +WINAPI +BaseUpdateAppcompatCache(ULONG Unknown1, + ULONG Unknown2, + ULONG Unknown3) +{ + STUB; +} + +NTSTATUS +WINAPI +BaseCleanupAppcompatCache(VOID) +{ + STUB; + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +WINAPI +BaseCleanupAppcompatCacheSupport(PVOID pUnknown) +{ + STUB; + return STATUS_NOT_IMPLEMENTED; +} + +BOOL +WINAPI +BaseInitAppcompatCache(VOID) +{ + STUB; + return FALSE; +} + +BOOL +WINAPI +BaseInitAppcompatCacheSupport(VOID) +{ + STUB; + return FALSE; +} + +PVOID +WINAPI +GetComPlusPackageInstallStatus(VOID) +{ + STUB; + return NULL; +} + +BOOL +WINAPI +SetComPlusPackageInstallStatus(LPVOID lpInfo) +{ + STUB; + return FALSE; +} + + /* + * @unimplemented + */ +VOID +WINAPI +SetTermsrvAppInstallMode(IN BOOL bInstallMode) +{ + STUB; +} + +/* + * @unimplemented + */ +BOOL +WINAPI +TermsrvAppInstallMode(VOID) +{ + STUB; + return FALSE; +} diff --git a/dll/win32/kernel32/misc/atom.c b/dll/win32/kernel32/client/atom.c similarity index 96% rename from dll/win32/kernel32/misc/atom.c rename to dll/win32/kernel32/client/atom.c index c3ce75d4da0..420bab81908 100644 --- a/dll/win32/kernel32/misc/atom.c +++ b/dll/win32/kernel32/client/atom.c @@ -47,7 +47,7 @@ InternalAddAtom(BOOLEAN Local, if (Atom >= MAXINTATOM) { /* Fail, atom number too large */ - SetLastErrorByStatus(STATUS_INVALID_PARAMETER); + BaseSetLastNTError(STATUS_INVALID_PARAMETER); return INVALID_ATOM; } @@ -93,7 +93,7 @@ InternalAddAtom(BOOLEAN Local, /* Check for failure */ if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return Atom; } } @@ -115,7 +115,7 @@ InternalAddAtom(BOOLEAN Local, } /* Check for failure */ - if (!NT_SUCCESS(Status)) SetLastErrorByStatus(Status); + if (!NT_SUCCESS(Status)) BaseSetLastNTError(Status); /* Check if we were non-static ANSI */ if (!(Unicode) && (AtomNameString == &UnicodeString)) @@ -148,7 +148,7 @@ InternalFindAtom(BOOLEAN Local, if (Atom >= MAXINTATOM) { /* Fail, atom number too large */ - SetLastErrorByStatus(STATUS_INVALID_PARAMETER); + BaseSetLastNTError(STATUS_INVALID_PARAMETER); DPRINT1("Invalid atom\n"); } @@ -195,7 +195,7 @@ InternalFindAtom(BOOLEAN Local, if (!NT_SUCCESS(Status)) { DPRINT1("Failed\n"); - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return Atom; } } @@ -227,7 +227,7 @@ InternalFindAtom(BOOLEAN Local, } /* Check for failure */ - if (!NT_SUCCESS(Status)) SetLastErrorByStatus(Status); + if (!NT_SUCCESS(Status)) BaseSetLastNTError(Status); /* Check if we were non-static ANSI */ if (!(Unicode) && (AtomNameString == &UnicodeString)) @@ -266,7 +266,7 @@ InternalDeleteAtom(BOOLEAN Local, if (!NT_SUCCESS(Status)) { /* Fail */ - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return INVALID_ATOM; } } @@ -299,12 +299,12 @@ InternalGetAtomName(BOOLEAN Local, /* Make sure it's valid too */ if (!Size) { - SetLastErrorByStatus(STATUS_BUFFER_OVERFLOW); + BaseSetLastNTError(STATUS_BUFFER_OVERFLOW); return 0; } if (!Atom) { - SetLastErrorByStatus(STATUS_INVALID_PARAMETER); + BaseSetLastNTError(STATUS_INVALID_PARAMETER); return 0; } @@ -347,7 +347,7 @@ InternalGetAtomName(BOOLEAN Local, if (!AtomInfo) { - SetLastErrorByStatus(STATUS_NO_MEMORY); + BaseSetLastNTError(STATUS_NO_MEMORY); return 0; } @@ -417,7 +417,7 @@ InternalGetAtomName(BOOLEAN Local, { /* Fail */ DPRINT("Failed: %lx\n", Status); - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); } /* Return length */ diff --git a/dll/win32/kernel32/misc/computername.c b/dll/win32/kernel32/client/compname.c similarity index 92% rename from dll/win32/kernel32/misc/computername.c rename to dll/win32/kernel32/client/compname.c index d04172d6a6a..4b404e1f501 100644 --- a/dll/win32/kernel32/misc/computername.c +++ b/dll/win32/kernel32/client/compname.c @@ -62,7 +62,7 @@ GetComputerNameFromRegistry(LPWSTR RegistryKey, &ObjectAttributes); if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus (Status); + BaseSetLastNTError (Status); return FALSE; } @@ -115,7 +115,7 @@ GetComputerNameFromRegistry(LPWSTR RegistryKey, failed: RtlFreeHeap(RtlGetProcessHeap(), 0, KeyInfo); - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -382,7 +382,7 @@ SetComputerNameToRegistry(LPCWSTR RegistryKey, &ObjectAttributes); if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -397,7 +397,7 @@ SetComputerNameToRegistry(LPCWSTR RegistryKey, if (!NT_SUCCESS(Status)) { ZwClose(KeyHandle); - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -558,4 +558,77 @@ DnsHostnameToComputerNameW(LPCWSTR hostname, return TRUE; } +DWORD +WINAPI +AddLocalAlternateComputerNameA(LPSTR lpName, PNTSTATUS Status) +{ + STUB; + return 0; +} + +DWORD +WINAPI +AddLocalAlternateComputerNameW(LPWSTR lpName, PNTSTATUS Status) +{ + STUB; + return 0; +} + +DWORD +WINAPI +EnumerateLocalComputerNamesA(PVOID pUnknown, DWORD Size, LPSTR lpBuffer, LPDWORD lpnSize) +{ + STUB; + return ERROR_CALL_NOT_IMPLEMENTED; +} + +DWORD +WINAPI +EnumerateLocalComputerNamesW(PVOID pUnknown, DWORD Size, LPWSTR lpBuffer, LPDWORD lpnSize) +{ + STUB; + return ERROR_CALL_NOT_IMPLEMENTED; +} + +DWORD +WINAPI +RemoveLocalAlternateComputerNameA(LPSTR lpName, DWORD Unknown) +{ + STUB; + return ERROR_CALL_NOT_IMPLEMENTED; +} + +DWORD +WINAPI +RemoveLocalAlternateComputerNameW(LPWSTR lpName, DWORD Unknown) +{ + STUB; + return ERROR_CALL_NOT_IMPLEMENTED; +} + +/* + * @unimplemented + */ +BOOL +WINAPI +SetLocalPrimaryComputerNameA(IN DWORD Unknown1, + IN DWORD Unknown2) +{ + STUB; + return FALSE; +} + +/* + * @unimplemented + */ +BOOL +WINAPI +SetLocalPrimaryComputerNameW(IN DWORD Unknown1, + IN DWORD Unknown2) +{ + STUB; + return FALSE; +} + + /* EOF */ diff --git a/dll/win32/kernel32/client/debugger.c b/dll/win32/kernel32/client/debugger.c new file mode 100644 index 00000000000..e4e695ef46f --- /dev/null +++ b/dll/win32/kernel32/client/debugger.c @@ -0,0 +1,956 @@ +/* + * PROJECT: ReactOS Win32 Base API + * LICENSE: GPL - See COPYING in the top level directory + * FILE: dll/win32/kernel32/debug/debugger.c + * PURPOSE: Wrappers for the NT Debug Implementation + * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org) + */ + +/* INCLUDES *****************************************************************/ + +#include +#define NDEBUG +#include + +typedef struct _DBGSS_THREAD_DATA +{ + struct _DBGSS_THREAD_DATA *Next; + HANDLE ThreadHandle; + HANDLE ProcessHandle; + DWORD ProcessId; + DWORD ThreadId; + BOOLEAN HandleMarked; +} DBGSS_THREAD_DATA, *PDBGSS_THREAD_DATA; + +#define DbgSsSetThreadData(d) \ + NtCurrentTeb()->DbgSsReserved[0] = d + +#define DbgSsGetThreadData() \ + ((PDBGSS_THREAD_DATA)NtCurrentTeb()->DbgSsReserved[0]) + +/* PRIVATE FUNCTIONS *********************************************************/ + +static +HANDLE +K32CreateDBMonMutex(void) +{ + static SID_IDENTIFIER_AUTHORITY siaNTAuth = {SECURITY_NT_AUTHORITY}; + static SID_IDENTIFIER_AUTHORITY siaWorldAuth = {SECURITY_WORLD_SID_AUTHORITY}; + HANDLE hMutex; + + /* SIDs to be used in the DACL */ + PSID psidSystem = NULL; + PSID psidAdministrators = NULL; + PSID psidEveryone = NULL; + + /* buffer for the DACL */ + PVOID pDaclBuf = NULL; + + /* minimum size of the DACL: an ACL descriptor and three ACCESS_ALLOWED_ACE + headers. We'll add the size of SIDs when we'll know it + */ + SIZE_T nDaclBufSize = + sizeof(ACL) + (sizeof(ACCESS_ALLOWED_ACE) - + sizeof(((ACCESS_ALLOWED_ACE*)0)->SidStart)) * 3; + + /* security descriptor of the mutex */ + SECURITY_DESCRIPTOR sdMutexSecurity; + + /* attributes of the mutex object we'll create */ + SECURITY_ATTRIBUTES saMutexAttribs = {sizeof(saMutexAttribs), + &sdMutexSecurity, + TRUE}; + + NTSTATUS nErrCode; + + /* first, try to open the mutex */ + hMutex = OpenMutexW (SYNCHRONIZE | READ_CONTROL | MUTANT_QUERY_STATE, + TRUE, + L"DBWinMutex"); + + if(hMutex != NULL) + { + /* success */ + return hMutex; + } + /* error other than the mutex not being found */ + else if(GetLastError() != ERROR_FILE_NOT_FOUND) + { + /* failure */ + return NULL; + } + + /* if the mutex doesn't exist, create it */ + + /* first, set up the mutex security */ + /* allocate the NT AUTHORITY\SYSTEM SID */ + nErrCode = RtlAllocateAndInitializeSid(&siaNTAuth, + 1, + SECURITY_LOCAL_SYSTEM_RID, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + &psidSystem); + + /* failure */ + if(!NT_SUCCESS(nErrCode)) goto l_Cleanup; + + /* allocate the BUILTIN\Administrators SID */ + nErrCode = RtlAllocateAndInitializeSid(&siaNTAuth, + 2, + SECURITY_BUILTIN_DOMAIN_RID, + DOMAIN_ALIAS_RID_ADMINS, + 0, + 0, + 0, + 0, + 0, + 0, + &psidAdministrators); + + /* failure */ + if(!NT_SUCCESS(nErrCode)) goto l_Cleanup; + + /* allocate the Everyone SID */ + nErrCode = RtlAllocateAndInitializeSid(&siaWorldAuth, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + &psidEveryone); + + /* failure */ + if(!NT_SUCCESS(nErrCode)) goto l_Cleanup; + + /* allocate space for the SIDs too */ + nDaclBufSize += RtlLengthSid(psidSystem); + nDaclBufSize += RtlLengthSid(psidAdministrators); + nDaclBufSize += RtlLengthSid(psidEveryone); + + /* allocate the buffer for the DACL */ + pDaclBuf = GlobalAlloc(GMEM_FIXED, nDaclBufSize); + + /* failure */ + if(pDaclBuf == NULL) goto l_Cleanup; + + /* create the DACL */ + nErrCode = RtlCreateAcl(pDaclBuf, nDaclBufSize, ACL_REVISION); + + /* failure */ + if(!NT_SUCCESS(nErrCode)) goto l_Cleanup; + + /* grant the minimum required access to Everyone */ + nErrCode = RtlAddAccessAllowedAce(pDaclBuf, + ACL_REVISION, + SYNCHRONIZE | + READ_CONTROL | + MUTANT_QUERY_STATE, + psidEveryone); + + /* failure */ + if(!NT_SUCCESS(nErrCode)) goto l_Cleanup; + + /* grant full access to BUILTIN\Administrators */ + nErrCode = RtlAddAccessAllowedAce(pDaclBuf, + ACL_REVISION, + MUTANT_ALL_ACCESS, + psidAdministrators); + + /* failure */ + if(!NT_SUCCESS(nErrCode)) goto l_Cleanup; + + /* grant full access to NT AUTHORITY\SYSTEM */ + nErrCode = RtlAddAccessAllowedAce(pDaclBuf, + ACL_REVISION, + MUTANT_ALL_ACCESS, + psidSystem); + + /* failure */ + if(!NT_SUCCESS(nErrCode)) goto l_Cleanup; + + /* create the security descriptor */ + nErrCode = RtlCreateSecurityDescriptor(&sdMutexSecurity, + SECURITY_DESCRIPTOR_REVISION); + + /* failure */ + if(!NT_SUCCESS(nErrCode)) goto l_Cleanup; + + /* set the descriptor's DACL to the ACL we created */ + nErrCode = RtlSetDaclSecurityDescriptor(&sdMutexSecurity, + TRUE, + pDaclBuf, + FALSE); + + /* failure */ + if(!NT_SUCCESS(nErrCode)) goto l_Cleanup; + + /* create the mutex */ + hMutex = CreateMutexW(&saMutexAttribs, FALSE, L"DBWinMutex"); + +l_Cleanup: + /* free the buffers */ + if(pDaclBuf) GlobalFree(pDaclBuf); + if(psidEveryone) RtlFreeSid(psidEveryone); + if(psidAdministrators) RtlFreeSid(psidAdministrators); + if(psidSystem) RtlFreeSid(psidSystem); + + return hMutex; +} + +VOID +WINAPI +SaveThreadHandle(IN DWORD dwProcessId, + IN DWORD dwThreadId, + IN HANDLE hThread) +{ + PDBGSS_THREAD_DATA ThreadData; + + /* Allocate a thread structure */ + ThreadData = RtlAllocateHeap(RtlGetProcessHeap(), + 0, + sizeof(DBGSS_THREAD_DATA)); + if (!ThreadData) return; + + /* Fill it out */ + ThreadData->ThreadHandle = hThread; + ThreadData->ProcessId = dwProcessId; + ThreadData->ThreadId = dwThreadId; + ThreadData->ProcessHandle = NULL; + ThreadData->HandleMarked = FALSE; + + /* Link it */ + ThreadData->Next = DbgSsGetThreadData(); + DbgSsSetThreadData(ThreadData); +} + +VOID +WINAPI +SaveProcessHandle(IN DWORD dwProcessId, + IN HANDLE hProcess) +{ + PDBGSS_THREAD_DATA ThreadData; + + /* Allocate a thread structure */ + ThreadData = RtlAllocateHeap(RtlGetProcessHeap(), + 0, + sizeof(DBGSS_THREAD_DATA)); + if (!ThreadData) return; + + /* Fill it out */ + ThreadData->ProcessHandle = hProcess; + ThreadData->ProcessId = dwProcessId; + ThreadData->ThreadId = 0; + ThreadData->ThreadHandle = NULL; + ThreadData->HandleMarked = FALSE; + + /* Link it */ + ThreadData->Next = DbgSsGetThreadData(); + DbgSsSetThreadData(ThreadData); +} + +VOID +WINAPI +MarkThreadHandle(IN DWORD dwThreadId) +{ + PDBGSS_THREAD_DATA ThreadData; + + /* Loop all thread data events */ + for (ThreadData = DbgSsGetThreadData(); ThreadData; ThreadData = ThreadData->Next) + { + /* Check if this one matches */ + if (ThreadData->ThreadId == dwThreadId) + { + /* Mark the structure and break out */ + ThreadData->HandleMarked = TRUE; + break; + } + } +} + +VOID +WINAPI +MarkProcessHandle(IN DWORD dwProcessId) +{ + PDBGSS_THREAD_DATA ThreadData; + + /* Loop all thread data events */ + for (ThreadData = DbgSsGetThreadData(); ThreadData; ThreadData = ThreadData->Next) + { + /* Check if this one matches */ + if ((ThreadData->ProcessId == dwProcessId) && !(ThreadData->ThreadId)) + { + /* Mark the structure and break out */ + ThreadData->HandleMarked = TRUE; + break; + } + } +} + +VOID +WINAPI +RemoveHandles(IN DWORD dwProcessId, + IN DWORD dwThreadId) +{ + PDBGSS_THREAD_DATA *ThreadData; + PDBGSS_THREAD_DATA ThisData; + + /* Loop all thread data events */ + ThreadData = (PDBGSS_THREAD_DATA*)NtCurrentTeb()->DbgSsReserved; + for (ThisData = *ThreadData; ThisData; ThisData = ThisData->Next) + { + /* Check if this one matches */ + if ((ThisData->HandleMarked) && + ((ThisData->ProcessId == dwProcessId) || (ThisData->ThreadId == dwThreadId))) + { + /* Close open handles */ + if (ThisData->ThreadHandle) CloseHandle(ThisData->ThreadHandle); + if (ThisData->ProcessHandle) CloseHandle(ThisData->ProcessHandle); + + /* Unlink the thread data */ + *ThreadData = ThisData->Next; + + /* Free it*/ + RtlFreeHeap(RtlGetProcessHeap(), 0, ThisData); + } + else + { + /* Move to the next one */ + ThreadData = &ThisData->Next; + } + } +} + +VOID +WINAPI +CloseAllProcessHandles(IN DWORD dwProcessId) +{ + PDBGSS_THREAD_DATA *ThreadData; + PDBGSS_THREAD_DATA ThisData; + + /* Loop all thread data events */ + ThreadData = (PDBGSS_THREAD_DATA*)NtCurrentTeb()->DbgSsReserved; + for (ThisData = *ThreadData; ThisData; ThisData = ThisData->Next) + { + /* Check if this one matches */ + if (ThisData->ProcessId == dwProcessId) + { + /* Close open handles */ + if (ThisData->ThreadHandle) CloseHandle(ThisData->ThreadHandle); + if (ThisData->ProcessHandle) CloseHandle(ThisData->ProcessHandle); + + /* Unlink the thread data */ + *ThreadData = ThisData->Next; + + /* Free it*/ + RtlFreeHeap(RtlGetProcessHeap(), 0, ThisData); + } + else + { + /* Move to the next one */ + ThreadData = &ThisData->Next; + } + } +} + +HANDLE +WINAPI +ProcessIdToHandle(IN DWORD dwProcessId) +{ + NTSTATUS Status; + OBJECT_ATTRIBUTES ObjectAttributes; + HANDLE Handle; + CLIENT_ID ClientId; + + /* If we don't have a PID, look it up */ + if (dwProcessId == MAXDWORD) dwProcessId = (DWORD_PTR)CsrGetProcessId(); + + /* Open a handle to the process */ + ClientId.UniqueThread = NULL; + ClientId.UniqueProcess = UlongToHandle(dwProcessId); + InitializeObjectAttributes(&ObjectAttributes, NULL, 0, NULL, NULL); + Status = NtOpenProcess(&Handle, + PROCESS_CREATE_THREAD | PROCESS_VM_OPERATION | + PROCESS_VM_WRITE | PROCESS_VM_READ | + PROCESS_SUSPEND_RESUME | PROCESS_QUERY_INFORMATION, + &ObjectAttributes, + &ClientId); + if (!NT_SUCCESS(Status)) + { + /* Fail */ + BaseSetLastNTError(Status); + return 0; + } + + /* Return the handle */ + return Handle; +} + +/* PUBLIC FUNCTIONS **********************************************************/ + +/* + * @implemented + */ +BOOL +WINAPI +CheckRemoteDebuggerPresent(IN HANDLE hProcess, + OUT PBOOL pbDebuggerPresent) +{ + HANDLE DebugPort; + NTSTATUS Status; + + /* Make sure we have an output and process*/ + if (!(pbDebuggerPresent) || !(hProcess)) + { + /* Fail */ + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + /* Check if the process has a debug object/port */ + Status = NtQueryInformationProcess(hProcess, + ProcessDebugPort, + (PVOID)&DebugPort, + sizeof(HANDLE), + NULL); + if (NT_SUCCESS(Status)) + { + /* Return the current state */ + *pbDebuggerPresent = DebugPort != NULL; + return TRUE; + } + + /* Otherwise, fail */ + BaseSetLastNTError(Status); + return FALSE; +} + +/* + * @implemented + */ +BOOL +WINAPI +ContinueDebugEvent(IN DWORD dwProcessId, + IN DWORD dwThreadId, + IN DWORD dwContinueStatus) +{ + CLIENT_ID ClientId; + NTSTATUS Status; + + /* Set the Client ID */ + ClientId.UniqueProcess = (HANDLE)dwProcessId; + ClientId.UniqueThread = (HANDLE)dwThreadId; + + /* Continue debugging */ + Status = DbgUiContinue(&ClientId, dwContinueStatus); + if (!NT_SUCCESS(Status)) + { + /* Fail */ + BaseSetLastNTError(Status); + return FALSE; + } + + /* Remove the process/thread handles */ + RemoveHandles(dwProcessId, dwThreadId); + + /* Success */ + return TRUE; +} + +/* + * @implemented + */ +BOOL +WINAPI +DebugActiveProcess(IN DWORD dwProcessId) +{ + NTSTATUS Status, Status1; + HANDLE Handle; + + /* Connect to the debugger */ + Status = DbgUiConnectToDbg(); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + /* Get the process handle */ + Handle = ProcessIdToHandle(dwProcessId); + if (!Handle) return FALSE; + + /* Now debug the process */ + Status = DbgUiDebugActiveProcess(Handle); + + /* Close the handle since we're done */ + Status1 = NtClose(Handle); + ASSERT(NT_SUCCESS(Status1)); + + /* Check if debugging worked */ + if (!NT_SUCCESS(Status)) + { + /* Fail */ + BaseSetLastNTError(Status); + return FALSE; + } + + /* Success */ + return TRUE; +} + +/* + * @implemented + */ +BOOL +WINAPI +DebugActiveProcessStop(IN DWORD dwProcessId) +{ + NTSTATUS Status, Status1; + HANDLE Handle; + + /* Get the process handle */ + Handle = ProcessIdToHandle(dwProcessId); + if (!Handle) return FALSE; + + /* Close all the process handles */ + CloseAllProcessHandles(dwProcessId); + + /* Now stop debgging the process */ + Status = DbgUiStopDebugging(Handle); + Status1 = NtClose(Handle); + ASSERT(NT_SUCCESS(Status1)); + + /* Check for failure */ + if (!NT_SUCCESS(Status)) + { + /* Fail */ + SetLastError(ERROR_ACCESS_DENIED); + return FALSE; + } + + /* Success */ + return TRUE; +} + +/* + * @implemented + */ +BOOL +WINAPI +DebugBreakProcess(IN HANDLE Process) +{ + NTSTATUS Status; + + /* Send the breakin request */ + Status = DbgUiIssueRemoteBreakin(Process); + if(!NT_SUCCESS(Status)) + { + /* Failure */ + BaseSetLastNTError(Status); + return FALSE; + } + + /* Success */ + return TRUE; +} + +/* + * @implemented + */ +BOOL +WINAPI +DebugSetProcessKillOnExit(IN BOOL KillOnExit) +{ + HANDLE Handle; + NTSTATUS Status; + ULONG State; + + /* Get the debug object */ + Handle = DbgUiGetThreadDebugObject(); + if (!Handle) + { + /* Fail */ + BaseSetLastNTError(STATUS_INVALID_HANDLE); + return FALSE; + } + + /* Now set the kill-on-exit state */ + State = KillOnExit != 0; + Status = NtSetInformationDebugObject(Handle, + DebugObjectKillProcessOnExitInformation, + &State, + sizeof(State), + NULL); + if (!NT_SUCCESS(Status)) + { + /* Fail */ + BaseSetLastNTError(Status); + return FALSE; + } + + /* Success */ + return TRUE; +} + +/* + * @implemented + */ +BOOL +WINAPI +IsDebuggerPresent(VOID) +{ + return (BOOL)NtCurrentPeb()->BeingDebugged; +} + +/* + * @implemented + */ +BOOL +WINAPI +WaitForDebugEvent(IN LPDEBUG_EVENT lpDebugEvent, + IN DWORD dwMilliseconds) +{ + LARGE_INTEGER WaitTime; + PLARGE_INTEGER Timeout; + DBGUI_WAIT_STATE_CHANGE WaitStateChange; + NTSTATUS Status; + + /* Convert to NT Timeout */ + Timeout = BaseFormatTimeOut(&WaitTime, dwMilliseconds); + + /* Loop while we keep getting interrupted */ + do + { + /* Call the native API */ + Status = DbgUiWaitStateChange(&WaitStateChange, Timeout); + } while ((Status == STATUS_ALERTED) || (Status == STATUS_USER_APC)); + + /* Check if the wait failed */ + if (!(NT_SUCCESS(Status)) || (Status == DBG_UNABLE_TO_PROVIDE_HANDLE)) + { + /* Set the error code and quit */ + BaseSetLastNTError(Status); + return FALSE; + } + + /* Check if we timed out */ + if (Status == STATUS_TIMEOUT) + { + /* Fail with a timeout error */ + SetLastError(ERROR_SEM_TIMEOUT); + return FALSE; + } + + /* Convert the structure */ + Status = DbgUiConvertStateChangeStructure(&WaitStateChange, lpDebugEvent); + if (!NT_SUCCESS(Status)) + { + /* Set the error code and quit */ + BaseSetLastNTError(Status); + return FALSE; + } + + /* Check what kind of event this was */ + switch (lpDebugEvent->dwDebugEventCode) + { + /* New thread was created */ + case CREATE_THREAD_DEBUG_EVENT: + + /* Setup the thread data */ + SaveThreadHandle(lpDebugEvent->dwProcessId, + lpDebugEvent->dwThreadId, + lpDebugEvent->u.CreateThread.hThread); + break; + + /* New process was created */ + case CREATE_PROCESS_DEBUG_EVENT: + + /* Setup the process data */ + SaveProcessHandle(lpDebugEvent->dwProcessId, + lpDebugEvent->u.CreateProcessInfo.hProcess); + + /* Setup the thread data */ + SaveThreadHandle(lpDebugEvent->dwProcessId, + lpDebugEvent->dwThreadId, + lpDebugEvent->u.CreateProcessInfo.hThread); + break; + + /* Process was exited */ + case EXIT_PROCESS_DEBUG_EVENT: + + /* Mark the thread data as such and fall through */ + MarkProcessHandle(lpDebugEvent->dwProcessId); + + /* Thread was exited */ + case EXIT_THREAD_DEBUG_EVENT: + + /* Mark the thread data */ + MarkThreadHandle(lpDebugEvent->dwThreadId); + break; + + /* Nothing to do */ + case EXCEPTION_DEBUG_EVENT: + case LOAD_DLL_DEBUG_EVENT: + case UNLOAD_DLL_DEBUG_EVENT: + case OUTPUT_DEBUG_STRING_EVENT: + case RIP_EVENT: + break; + + /* Fail anything else */ + default: + return FALSE; + } + + /* Return success */ + return TRUE; +} + +/* + * @implemented + */ +VOID +WINAPI +OutputDebugStringA(IN LPCSTR _OutputString) +{ + _SEH2_TRY + { + ULONG_PTR a_nArgs[2]; + + a_nArgs[0] = (ULONG_PTR)(strlen(_OutputString) + 1); + a_nArgs[1] = (ULONG_PTR)_OutputString; + + /* send the string to the user-mode debugger */ + RaiseException(DBG_PRINTEXCEPTION_C, 0, 2, a_nArgs); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + /* no user-mode debugger: try the systemwide debug message monitor, or the + kernel debugger as a last resort */ + + /* mutex used to synchronize invocations of OutputDebugString */ + static HANDLE s_hDBMonMutex = NULL; + /* true if we already attempted to open/create the mutex */ + static BOOL s_bDBMonMutexTriedOpen = FALSE; + + /* local copy of the mutex handle */ + volatile HANDLE hDBMonMutex = s_hDBMonMutex; + /* handle to the Section of the shared buffer */ + volatile HANDLE hDBMonBuffer = NULL; + + /* pointer to the mapped view of the shared buffer. It consist of the current + process id followed by the message string */ + struct { DWORD ProcessId; CHAR Buffer[1]; } * pDBMonBuffer = NULL; + + /* event: signaled by the debug message monitor when OutputDebugString can write + to the shared buffer */ + volatile HANDLE hDBMonBufferReady = NULL; + + /* event: to be signaled by OutputDebugString when it's done writing to the + shared buffer */ + volatile HANDLE hDBMonDataReady = NULL; + + /* mutex not opened, and no previous attempts to open/create it */ + if(hDBMonMutex == NULL && !s_bDBMonMutexTriedOpen) + { + /* open/create the mutex */ + hDBMonMutex = K32CreateDBMonMutex(); + /* store the handle */ + s_hDBMonMutex = hDBMonMutex; + } + + _SEH2_TRY + { + volatile PCHAR a_cBuffer = NULL; + + /* opening the mutex failed */ + if(hDBMonMutex == NULL) + { + /* remember next time */ + s_bDBMonMutexTriedOpen = TRUE; + } + /* opening the mutex succeeded */ + else + { + do + { + /* synchronize with other invocations of OutputDebugString */ + WaitForSingleObject(hDBMonMutex, INFINITE); + + /* buffer of the system-wide debug message monitor */ + hDBMonBuffer = OpenFileMappingW(SECTION_MAP_WRITE, FALSE, L"DBWIN_BUFFER"); + + /* couldn't open the buffer: send the string to the kernel debugger */ + if(hDBMonBuffer == NULL) break; + + /* map the buffer */ + pDBMonBuffer = MapViewOfFile(hDBMonBuffer, + SECTION_MAP_READ | SECTION_MAP_WRITE, + 0, + 0, + 0); + + /* couldn't map the buffer: send the string to the kernel debugger */ + if(pDBMonBuffer == NULL) break; + + /* open the event signaling that the buffer can be accessed */ + hDBMonBufferReady = OpenEventW(SYNCHRONIZE, FALSE, L"DBWIN_BUFFER_READY"); + + /* couldn't open the event: send the string to the kernel debugger */ + if(hDBMonBufferReady == NULL) break; + + /* open the event to be signaled when the buffer has been filled */ + hDBMonDataReady = OpenEventW(EVENT_MODIFY_STATE, FALSE, L"DBWIN_DATA_READY"); + } + while(0); + + /* we couldn't connect to the system-wide debug message monitor: send the + string to the kernel debugger */ + if(hDBMonDataReady == NULL) ReleaseMutex(hDBMonMutex); + } + + _SEH2_TRY + { + /* size of the current output block */ + volatile SIZE_T nRoundLen; + + /* size of the remainder of the string */ + volatile SIZE_T nOutputStringLen; + + /* output the whole string */ + nOutputStringLen = strlen(_OutputString); + + do + { + /* we're connected to the debug monitor: + write the current block to the shared buffer */ + if(hDBMonDataReady) + { + /* wait a maximum of 10 seconds for the debug monitor + to finish processing the shared buffer */ + if(WaitForSingleObject(hDBMonBufferReady, 10000) != WAIT_OBJECT_0) + { + /* timeout or failure: give up */ + break; + } + + /* write the process id into the buffer */ + pDBMonBuffer->ProcessId = GetCurrentProcessId(); + + /* write only as many bytes as they fit in the buffer */ + if(nOutputStringLen > (PAGE_SIZE - sizeof(DWORD) - 1)) + nRoundLen = PAGE_SIZE - sizeof(DWORD) - 1; + else + nRoundLen = nOutputStringLen; + + /* copy the current block into the buffer */ + memcpy(pDBMonBuffer->Buffer, _OutputString, nRoundLen); + + /* null-terminate the current block */ + pDBMonBuffer->Buffer[nRoundLen] = 0; + + /* signal that the data contains meaningful data and can be read */ + SetEvent(hDBMonDataReady); + } + /* else, send the current block to the kernel debugger */ + else + { + /* output in blocks of 512 characters */ + a_cBuffer = (CHAR*)HeapAlloc(GetProcessHeap(), 0, 512); + + if (!a_cBuffer) + { + DbgPrint("OutputDebugStringA: Failed\n"); + break; + } + + /* write a maximum of 511 bytes */ + if(nOutputStringLen > 510) + nRoundLen = 510; + else + nRoundLen = nOutputStringLen; + + /* copy the current block */ + memcpy(a_cBuffer, _OutputString, nRoundLen); + + /* null-terminate the current block */ + a_cBuffer[nRoundLen] = 0; + + /* send the current block to the kernel debugger */ + DbgPrint("%s", a_cBuffer); + + if (a_cBuffer) + { + HeapFree(GetProcessHeap(), 0, a_cBuffer); + a_cBuffer = NULL; + } + } + + /* move to the next block */ + _OutputString += nRoundLen; + nOutputStringLen -= nRoundLen; + } + /* repeat until the string has been fully output */ + while (nOutputStringLen > 0); + } + /* ignore access violations and let other exceptions fall through */ + _SEH2_EXCEPT((_SEH2_GetExceptionCode() == STATUS_ACCESS_VIOLATION) ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) + { + if (a_cBuffer) + HeapFree(GetProcessHeap(), 0, a_cBuffer); + + /* string copied verbatim from Microsoft's kernel32.dll */ + DbgPrint("\nOutputDebugString faulted during output\n"); + } + _SEH2_END; + } + _SEH2_FINALLY + { + /* close all the still open resources */ + if(hDBMonBufferReady) CloseHandle(hDBMonBufferReady); + if(pDBMonBuffer) UnmapViewOfFile(pDBMonBuffer); + if(hDBMonBuffer) CloseHandle(hDBMonBuffer); + if(hDBMonDataReady) CloseHandle(hDBMonDataReady); + + /* leave the critical section */ + if(hDBMonDataReady != NULL) + ReleaseMutex(hDBMonMutex); + } + _SEH2_END; + } + _SEH2_END; +} + +/* + * @implemented + */ +VOID +WINAPI +OutputDebugStringW(IN LPCWSTR OutputString) +{ + UNICODE_STRING UnicodeString; + ANSI_STRING AnsiString; + NTSTATUS Status; + + /* convert the string in ANSI */ + RtlInitUnicodeString(&UnicodeString, OutputString); + Status = RtlUnicodeStringToAnsiString(&AnsiString, &UnicodeString, TRUE); + + /* OutputDebugStringW always prints something, even if conversion fails */ + if (!NT_SUCCESS(Status)) AnsiString.Buffer = ""; + + /* Output the converted string */ + OutputDebugStringA(AnsiString.Buffer); + + /* free the converted string */ + if (NT_SUCCESS(Status)) RtlFreeAnsiString(&AnsiString); +} + +/* EOF */ diff --git a/dll/win32/kernel32/misc/dllmain.c b/dll/win32/kernel32/client/dllmain.c similarity index 83% rename from dll/win32/kernel32/misc/dllmain.c rename to dll/win32/kernel32/client/dllmain.c index c29a1828481..cc4c07360cb 100644 --- a/dll/win32/kernel32/misc/dllmain.c +++ b/dll/win32/kernel32/client/dllmain.c @@ -22,15 +22,20 @@ extern UNICODE_STRING SystemDirectory; extern UNICODE_STRING WindowsDirectory; +PBASE_STATIC_SERVER_DATA BaseStaticServerData; + +BOOLEAN BaseRunningInServerProcess; + WCHAR BaseDefaultPathBuffer[6140]; -HANDLE hProcessHeap = NULL; +HANDLE BaseNamedObjectDirectory; HMODULE hCurrentModule = NULL; +HMODULE kernel32_handle = NULL; HANDLE hBaseDir = NULL; PPEB Peb; ULONG SessionId; BOOL ConsoleInitialized = FALSE; - +UNICODE_STRING BaseWindowsDirectory, BaseWindowsSystemDirectory; static BOOL DllInitialized = FALSE; BOOL WINAPI @@ -52,44 +57,31 @@ extern BOOL FASTCALL NlsInit(VOID); extern VOID FASTCALL NlsUninit(VOID); BOOLEAN InWindows = FALSE; -HANDLE -WINAPI -DuplicateConsoleHandle(HANDLE hConsole, - DWORD dwDesiredAccess, - BOOL bInheritHandle, - DWORD dwOptions); - #define WIN_OBJ_DIR L"\\Windows" #define SESSION_DIR L"\\Sessions" -SYSTEM_BASIC_INFORMATION BaseCachedSysInfo; - /* FUNCTIONS *****************************************************************/ NTSTATUS WINAPI -OpenBaseDirectory(PHANDLE DirHandle) +BaseGetNamedObjectDirectory(VOID) { OBJECT_ATTRIBUTES ObjectAttributes; - UNICODE_STRING Name = RTL_CONSTANT_STRING(L"\\BaseNamedObjects"); NTSTATUS Status; InitializeObjectAttributes(&ObjectAttributes, - &Name, + &BaseStaticServerData->NamedObjectDirectory, OBJ_CASE_INSENSITIVE, NULL, NULL); - Status = NtOpenDirectoryObject(DirHandle, + Status = NtOpenDirectoryObject(&BaseNamedObjectDirectory, DIRECTORY_ALL_ACCESS & ~(DELETE | WRITE_DAC | WRITE_OWNER), &ObjectAttributes); - if (!NT_SUCCESS(Status)) - { - return Status; - } + if (!NT_SUCCESS(Status)) return Status; - DPRINT("Opened BNO: %lx\n", *DirHandle); + DPRINT("Opened BNO: %lx\n", BaseNamedObjectDirectory); return Status; } @@ -138,8 +130,8 @@ BasepInitConsole(VOID) WCHAR lpTest[MAX_PATH]; GetModuleFileNameW(NULL, lpTest, MAX_PATH); DPRINT("BasepInitConsole for : %S\n", lpTest); - DPRINT("Our current console handles are: %lx, %lx, %lx %lx\n", - Parameters->ConsoleHandle, Parameters->StandardInput, + DPRINT("Our current console handles are: %lx, %lx, %lx %lx\n", + Parameters->ConsoleHandle, Parameters->StandardInput, Parameters->StandardOutput, Parameters->StandardError); /* We have nothing to do if this isn't a console app... */ @@ -198,7 +190,7 @@ BasepInitConsole(VOID) ExeName = wcsrchr(Parameters->ImagePathName.Buffer, L'\\'); if (ExeName) SetConsoleInputExeNameW(ExeName + 1); - + /* Now use the proper console handle */ Request.Data.AllocConsoleRequest.Console = Parameters->ConsoleHandle; @@ -210,7 +202,7 @@ BasepInitConsole(VOID) */ CsrRequest = MAKE_CSR_API(ALLOC_CONSOLE, CSR_CONSOLE); Request.Data.AllocConsoleRequest.CtrlDispatcher = ConsoleControlDispatcher; - Status = CsrClientCallServer(&Request, + Status = CsrClientCallServer(&Request, NULL, CsrRequest, sizeof(CSR_API_MESSAGE)); @@ -220,7 +212,7 @@ BasepInitConsole(VOID) /* We're lying here, so at least the process can load... */ return TRUE; } - + if (NotConsole) return TRUE; /* We got the handles, let's set them */ @@ -241,7 +233,7 @@ BasepInitConsole(VOID) } } - DPRINT("Console setup: %lx, %lx, %lx, %lx\n", + DPRINT("Console setup: %lx, %lx, %lx, %lx\n", Parameters->ConsoleHandle, Parameters->StandardInput, Parameters->StandardOutput, @@ -249,7 +241,6 @@ BasepInitConsole(VOID) return TRUE; } - BOOL WINAPI DllMain(HANDLE hDll, @@ -257,7 +248,6 @@ DllMain(HANDLE hDll, LPVOID lpReserved) { NTSTATUS Status; - BOOLEAN IsServer; ULONG Dummy; ULONG DummySize = sizeof(Dummy); WCHAR SessionDir[256]; @@ -303,7 +293,7 @@ DllMain(HANDLE hDll, InWindows ? 1 : 0, &Dummy, &DummySize, - &IsServer); + &BaseRunningInServerProcess); if (!NT_SUCCESS(Status)) { DPRINT1("Failed to connect to CSR (Status %lx)\n", Status); @@ -311,38 +301,30 @@ DllMain(HANDLE hDll, return FALSE; } + /* Get the server data */ + ASSERT(Peb->ReadOnlyStaticServerData); + BaseStaticServerData = Peb->ReadOnlyStaticServerData[CSR_CONSOLE]; + ASSERT(BaseStaticServerData); + /* Check if we are running a CSR Server */ - if (!IsServer) + if (!BaseRunningInServerProcess) { /* Set the termination port for the thread */ DPRINT("Creating new thread for CSR\n"); CsrNewThread(); } - hProcessHeap = RtlGetProcessHeap(); - RtlInitializeHandleTable(0xFFFF, - sizeof(BASE_HEAP_HANDLE_ENTRY), - &BaseHeapHandleTable); - hCurrentModule = hDll; - DPRINT("Heap: %p\n", hProcessHeap); + /* Initialize heap handle table */ + BaseDllInitializeMemoryManager(); - /* - * Initialize WindowsDirectory and SystemDirectory - */ - DPRINT("NtSystemRoot: %S\n", SharedUserData->NtSystemRoot); - RtlCreateUnicodeString (&WindowsDirectory, SharedUserData->NtSystemRoot); - SystemDirectory.MaximumLength = WindowsDirectory.MaximumLength + 18; - SystemDirectory.Length = WindowsDirectory.Length + 18; - SystemDirectory.Buffer = RtlAllocateHeap(hProcessHeap, - 0, - SystemDirectory.MaximumLength); - if(SystemDirectory.Buffer == NULL) - { - DPRINT1("Failure allocating SystemDirectory buffer\n"); - return FALSE; - } - wcscpy(SystemDirectory.Buffer, WindowsDirectory.Buffer); - wcscat(SystemDirectory.Buffer, L"\\System32"); + /* Set HMODULE for our DLL */ + kernel32_handle = hCurrentModule = hDll; + + /* Set the directories */ + BaseWindowsDirectory = BaseStaticServerData->WindowsDirectory; + BaseWindowsSystemDirectory = BaseStaticServerData->WindowsSystemDirectory; + SystemDirectory = BaseWindowsSystemDirectory; + WindowsDirectory = BaseWindowsDirectory; /* Construct the default path (using the static buffer) */ _snwprintf(BaseDefaultPathBuffer, sizeof(BaseDefaultPathBuffer) / sizeof(WCHAR), @@ -361,7 +343,8 @@ DllMain(HANDLE hDll, InitCommandLines(); /* Open object base directory */ - Status = OpenBaseDirectory(&hBaseDir); + Status = BaseGetNamedObjectDirectory(); + hBaseDir = BaseNamedObjectDirectory; if (!NT_SUCCESS(Status)) { DPRINT1("Failed to open object base directory (Status %lx)\n", Status); @@ -385,17 +368,6 @@ DllMain(HANDLE hDll, return FALSE; } - /* Cache static system information */ - Status = ZwQuerySystemInformation(SystemBasicInformation, - &BaseCachedSysInfo, - sizeof(BaseCachedSysInfo), - NULL); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Failure to get system information\n"); - return FALSE; - } - /* Insert more dll attach stuff here! */ DllInitialized = TRUE; DPRINT("Initialization complete\n"); @@ -419,9 +391,6 @@ DllMain(HANDLE hDll, /* Close object base directory */ NtClose(hBaseDir); - - RtlFreeUnicodeString (&SystemDirectory); - RtlFreeUnicodeString (&WindowsDirectory); } break; diff --git a/dll/win32/kernel32/misc/env.c b/dll/win32/kernel32/client/environ.c similarity index 80% rename from dll/win32/kernel32/misc/env.c rename to dll/win32/kernel32/client/environ.c index 3ff452b583e..7564f7f9eef 100644 --- a/dll/win32/kernel32/misc/env.c +++ b/dll/win32/kernel32/client/environ.c @@ -19,85 +19,6 @@ /* FUNCTIONS ******************************************************************/ -/* - * @implemented - */ -BOOL -WINAPI -Beep (DWORD dwFreq, DWORD dwDuration) -{ - HANDLE hBeep; - UNICODE_STRING BeepDevice; - OBJECT_ATTRIBUTES ObjectAttributes; - IO_STATUS_BLOCK IoStatusBlock; - BEEP_SET_PARAMETERS BeepSetParameters; - NTSTATUS Status; - - /* check the parameters */ - if ((dwFreq >= 0x25 && dwFreq <= 0x7FFF) || - (dwFreq == 0x0 && dwDuration == 0x0)) - { - /* open the device */ - RtlInitUnicodeString(&BeepDevice, - L"\\Device\\Beep"); - - InitializeObjectAttributes(&ObjectAttributes, - &BeepDevice, - 0, - NULL, - NULL); - - Status = NtCreateFile(&hBeep, - FILE_READ_DATA | FILE_WRITE_DATA, - &ObjectAttributes, - &IoStatusBlock, - NULL, - 0, - FILE_SHARE_READ | FILE_SHARE_WRITE, - FILE_OPEN_IF, - 0, - NULL, - 0); - if (NT_SUCCESS(Status)) - { - /* Set beep data */ - BeepSetParameters.Frequency = dwFreq; - BeepSetParameters.Duration = dwDuration; - - Status = NtDeviceIoControlFile(hBeep, - NULL, - NULL, - NULL, - &IoStatusBlock, - IOCTL_BEEP_SET, - &BeepSetParameters, - sizeof(BEEP_SET_PARAMETERS), - NULL, - 0); - - /* do an alertable wait if necessary */ - if (NT_SUCCESS(Status) && - (dwFreq != 0x0 || dwDuration != 0x0) && dwDuration != MAXDWORD) - { - SleepEx(dwDuration, - TRUE); - } - - NtClose(hBeep); - } - } - else - Status = STATUS_INVALID_PARAMETER; - - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus (Status); - return FALSE; - } - - return TRUE; -} - /* * @implemented */ @@ -164,7 +85,7 @@ GetEnvironmentVariableA ( /* free unicode variable name string */ RtlFreeUnicodeString (&VarNameU); - SetLastErrorByStatus (Status); + BaseSetLastNTError (Status); if (Status == STATUS_BUFFER_TOO_SMALL) { return (VarValueU.Length / sizeof(WCHAR)) + 1; @@ -234,7 +155,7 @@ GetEnvironmentVariableW ( } else { - SetLastErrorByStatus (Status); + BaseSetLastNTError (Status); return 0; } } @@ -298,7 +219,7 @@ SetEnvironmentVariableA ( if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus (Status); + BaseSetLastNTError (Status); return FALSE; } @@ -334,7 +255,7 @@ SetEnvironmentVariableW ( if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus (Status); + BaseSetLastNTError (Status); return FALSE; } @@ -492,7 +413,7 @@ ExpandEnvironmentStringsA ( TRUE); if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus (Status); + BaseSetLastNTError (Status); return 0; } @@ -525,7 +446,7 @@ ExpandEnvironmentStringsA ( if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus (Status); + BaseSetLastNTError (Status); if (Status != STATUS_BUFFER_TOO_SMALL) { RtlFreeHeap (RtlGetProcessHeap (), @@ -580,7 +501,7 @@ ExpandEnvironmentStringsW ( &Length); if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus (Status); + BaseSetLastNTError (Status); if (Status != STATUS_BUFFER_TOO_SMALL) return 0; } @@ -588,4 +509,26 @@ ExpandEnvironmentStringsW ( return (Length / sizeof(WCHAR)); } +/* + * @implemented + */ +BOOL +WINAPI +SetEnvironmentStringsA(IN LPCH NewEnvironment) +{ + STUB; + return FALSE; +} + +/* + * @implemented + */ +BOOL +WINAPI +SetEnvironmentStringsW(IN LPWCH NewEnvironment) +{ + STUB; + return FALSE; +} + /* EOF */ diff --git a/dll/win32/kernel32/except/except.c b/dll/win32/kernel32/client/except.c similarity index 72% rename from dll/win32/kernel32/except/except.c rename to dll/win32/kernel32/client/except.c index d57bd7a2e14..25fe140fbe7 100644 --- a/dll/win32/kernel32/except/except.c +++ b/dll/win32/kernel32/client/except.c @@ -16,91 +16,7 @@ #include LPTOP_LEVEL_EXCEPTION_FILTER GlobalTopLevelExceptionFilter = NULL; - -UINT -WINAPI -GetErrorMode(VOID) -{ - NTSTATUS Status; - UINT ErrMode; - - /* Query the current setting */ - Status = NtQueryInformationProcess(NtCurrentProcess(), - ProcessDefaultHardErrorMode, - (PVOID)&ErrMode, - sizeof(ErrMode), - NULL); - if (!NT_SUCCESS(Status)) - { - /* Fail if we couldn't query */ - SetLastErrorByStatus(Status); - return 0; - } - - /* Check if NOT failing critical errors was requested */ - if (ErrMode & SEM_FAILCRITICALERRORS) - { - /* Mask it out, since the native API works differently */ - ErrMode &= ~SEM_FAILCRITICALERRORS; - } - else - { - /* OR it if the caller didn't, due to different native semantics */ - ErrMode |= SEM_FAILCRITICALERRORS; - } - - /* Return the mode */ - return ErrMode; -} - -/* - * @implemented - */ -UINT -WINAPI -SetErrorMode(IN UINT uMode) -{ - UINT PrevErrMode, NewMode; - NTSTATUS Status; - - /* Get the previous mode */ - PrevErrMode = GetErrorMode(); - NewMode = uMode; - - /* Check if failing critical errors was requested */ - if (NewMode & SEM_FAILCRITICALERRORS) - { - /* Mask it out, since the native API works differently */ - NewMode &= ~SEM_FAILCRITICALERRORS; - } - else - { - /* OR it if the caller didn't, due to different native semantics */ - NewMode |= SEM_FAILCRITICALERRORS; - } - - /* Set the new mode */ - Status = NtSetInformationProcess(NtCurrentProcess(), - ProcessDefaultHardErrorMode, - (PVOID)&NewMode, - sizeof(NewMode)); - if(!NT_SUCCESS(Status)) SetLastErrorByStatus(Status); - - /* Return the previous mode */ - return PrevErrMode; -} - -/* - * @implemented - */ -LPTOP_LEVEL_EXCEPTION_FILTER -WINAPI -SetUnhandledExceptionFilter( - IN LPTOP_LEVEL_EXCEPTION_FILTER lpTopLevelExceptionFilter) -{ - return InterlockedExchangePointer(&GlobalTopLevelExceptionFilter, - lpTopLevelExceptionFilter); -} +DWORD g_dwLastErrorToBreakOn; /* * Private helper function to lookup the module name from a given address. @@ -272,6 +188,42 @@ PrintStackTrace(struct _EXCEPTION_POINTERS *ExceptionInfo) #endif } +UINT +WINAPI +GetErrorMode(VOID) +{ + NTSTATUS Status; + UINT ErrMode; + + /* Query the current setting */ + Status = NtQueryInformationProcess(NtCurrentProcess(), + ProcessDefaultHardErrorMode, + (PVOID)&ErrMode, + sizeof(ErrMode), + NULL); + if (!NT_SUCCESS(Status)) + { + /* Fail if we couldn't query */ + BaseSetLastNTError(Status); + return 0; + } + + /* Check if NOT failing critical errors was requested */ + if (ErrMode & SEM_FAILCRITICALERRORS) + { + /* Mask it out, since the native API works differently */ + ErrMode &= ~SEM_FAILCRITICALERRORS; + } + else + { + /* OR it if the caller didn't, due to different native semantics */ + ErrMode |= SEM_FAILCRITICALERRORS; + } + + /* Return the mode */ + return ErrMode; +} + /* * @implemented */ @@ -309,7 +261,7 @@ UnhandledExceptionFilter(struct _EXCEPTION_POINTERS *ExceptionInfo) &DebugPort, sizeof(HANDLE), NULL); if (!NT_SUCCESS(ErrCode) && ErrCode != STATUS_NOT_IMPLEMENTED) { - SetLastErrorByStatus(ErrCode); + BaseSetLastNTError(ErrCode); return EXCEPTION_EXECUTE_HANDLER; } @@ -435,4 +387,308 @@ RaiseException(IN DWORD dwExceptionCode, RtlRaiseException(&ExceptionRecord); } +/* + * @implemented + */ +UINT +WINAPI +SetErrorMode(IN UINT uMode) +{ + UINT PrevErrMode, NewMode; + NTSTATUS Status; + + /* Get the previous mode */ + PrevErrMode = GetErrorMode(); + NewMode = uMode; + + /* Check if failing critical errors was requested */ + if (NewMode & SEM_FAILCRITICALERRORS) + { + /* Mask it out, since the native API works differently */ + NewMode &= ~SEM_FAILCRITICALERRORS; + } + else + { + /* OR it if the caller didn't, due to different native semantics */ + NewMode |= SEM_FAILCRITICALERRORS; + } + + /* Set the new mode */ + Status = NtSetInformationProcess(NtCurrentProcess(), + ProcessDefaultHardErrorMode, + (PVOID)&NewMode, + sizeof(NewMode)); + if(!NT_SUCCESS(Status)) BaseSetLastNTError(Status); + + /* Return the previous mode */ + return PrevErrMode; +} + +/* + * @implemented + */ +LPTOP_LEVEL_EXCEPTION_FILTER +WINAPI +SetUnhandledExceptionFilter( + IN LPTOP_LEVEL_EXCEPTION_FILTER lpTopLevelExceptionFilter) +{ + return InterlockedExchangePointer(&GlobalTopLevelExceptionFilter, + lpTopLevelExceptionFilter); +} + +/* + * @implemented + */ +BOOL +WINAPI +IsBadReadPtr(IN LPCVOID lp, + IN UINT_PTR ucb) +{ + ULONG PageSize; + BOOLEAN Result = FALSE; + volatile CHAR *Current; + PCHAR Last; + + /* Quick cases */ + if (!ucb) return FALSE; + if (!lp) return TRUE; + + /* Get the page size */ + PageSize = BaseStaticServerData->SysInfo.PageSize; + + /* Calculate the last page */ + Last = (PCHAR)((ULONG_PTR)lp + ucb - 1); + + /* Another quick failure case */ + if ((ULONG_PTR)Last < (ULONG_PTR)lp) return TRUE; + + /* Enter SEH */ + _SEH2_TRY + { + /* Probe the entire range */ + Current = (volatile CHAR*)lp; + Last = (PCHAR)(PAGE_ROUND_DOWN(Last)); + do + { + *Current; + Current = (volatile CHAR*)(PAGE_ROUND_DOWN(Current) + PAGE_SIZE); + } while (Current <= Last); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + /* We hit an exception, so return true */ + Result = TRUE; + } + _SEH2_END + + /* Return exception status */ + return Result; +} + +/* + * @implemented + */ +BOOL +NTAPI +IsBadHugeReadPtr(LPCVOID lp, + UINT_PTR ucb) +{ + /* Implementation is the same on 32-bit */ + return IsBadReadPtr(lp, ucb); +} + +/* + * @implemented + */ +BOOL +NTAPI +IsBadCodePtr(FARPROC lpfn) +{ + /* Executing has the same privileges as reading */ + return IsBadReadPtr((LPVOID)lpfn, 1); +} + +/* + * @implemented + */ +BOOL +NTAPI +IsBadWritePtr(LPVOID lp, + UINT_PTR ucb) +{ + ULONG PageSize; + BOOLEAN Result = FALSE; + volatile CHAR *Current; + PCHAR Last; + + /* Quick cases */ + if (!ucb) return FALSE; + if (!lp) return TRUE; + + /* Get the page size */ + PageSize = BaseStaticServerData->SysInfo.PageSize; + + /* Calculate the last page */ + Last = (PCHAR)((ULONG_PTR)lp + ucb - 1); + + /* Another quick failure case */ + if ((ULONG_PTR)Last < (ULONG_PTR)lp) return TRUE; + + /* Enter SEH */ + _SEH2_TRY + { + /* Probe the entire range */ + Current = (volatile CHAR*)lp; + Last = (PCHAR)(PAGE_ROUND_DOWN(Last)); + do + { + *Current = *Current; + Current = (volatile CHAR*)(PAGE_ROUND_DOWN(Current) + PAGE_SIZE); + } while (Current <= Last); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + /* We hit an exception, so return true */ + Result = TRUE; + } + _SEH2_END + + /* Return exception status */ + return Result; +} + +/* + * @implemented + */ +BOOL +NTAPI +IsBadHugeWritePtr(LPVOID lp, + UINT_PTR ucb) +{ + /* Implementation is the same on 32-bit */ + return IsBadWritePtr(lp, ucb); +} + +/* + * @implemented + */ +BOOL +NTAPI +IsBadStringPtrW(IN LPCWSTR lpsz, + UINT_PTR ucchMax) +{ + BOOLEAN Result = FALSE; + volatile WCHAR *Current; + PWCHAR Last; + WCHAR Char; + + /* Quick cases */ + if (!ucchMax) return FALSE; + if (!lpsz) return TRUE; + + /* Calculate the last page */ + Last = (PWCHAR)((ULONG_PTR)lpsz + (ucchMax * 2) - 2); + + /* Enter SEH */ + _SEH2_TRY + { + /* Probe the entire range */ + Current = (volatile WCHAR*)lpsz; + Last = (PWCHAR)(PAGE_ROUND_DOWN(Last)); + do + { + Char = *Current; + Current++; + } while (Char && (Current != Last + 1)); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + /* We hit an exception, so return true */ + Result = TRUE; + } + _SEH2_END + + /* Return exception status */ + return Result; +} + +/* + * @implemented + */ +BOOL +NTAPI +IsBadStringPtrA(IN LPCSTR lpsz, + UINT_PTR ucchMax) +{ + BOOLEAN Result = FALSE; + volatile CHAR *Current; + PCHAR Last; + CHAR Char; + + /* Quick cases */ + if (!ucchMax) return FALSE; + if (!lpsz) return TRUE; + + /* Calculate the last page */ + Last = (PCHAR)((ULONG_PTR)lpsz + ucchMax - 1); + + /* Enter SEH */ + _SEH2_TRY + { + /* Probe the entire range */ + Current = (volatile CHAR*)lpsz; + Last = (PCHAR)(PAGE_ROUND_DOWN(Last)); + do + { + Char = *Current; + Current++; + } while (Char && (Current != Last + 1)); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + /* We hit an exception, so return true */ + Result = TRUE; + } + _SEH2_END + + /* Return exception status */ + return Result; +} + +/* + * @implemented + */ +VOID +WINAPI +SetLastError(IN DWORD dwErrCode) +{ + /* Break if a debugger requested checking for this error code */ + if ((g_dwLastErrorToBreakOn) && (g_dwLastErrorToBreakOn == dwErrCode)) DbgBreakPoint(); + + /* Set last error if it's a new error */ + if (NtCurrentTeb()->LastErrorValue != dwErrCode) NtCurrentTeb()->LastErrorValue = dwErrCode; +} + +/* + * @implemented + */ +VOID +WINAPI +BaseSetLastNTError(IN NTSTATUS Status) +{ + /* Convert from NT to Win32, then set */ + SetLastError(RtlNtStatusToDosError(Status)); +} + +/* + * @implemented + */ +DWORD +WINAPI +GetLastError(VOID) +{ + /* Return the current value */ + return NtCurrentTeb()->LastErrorValue; +} + /* EOF */ diff --git a/dll/win32/kernel32/thread/fiber.c b/dll/win32/kernel32/client/fiber.c similarity index 50% rename from dll/win32/kernel32/thread/fiber.c rename to dll/win32/kernel32/client/fiber.c index e815d0b7b90..101ca1621f8 100644 --- a/dll/win32/kernel32/thread/fiber.c +++ b/dll/win32/kernel32/client/fiber.c @@ -26,6 +26,18 @@ typedef struct _FIBER /* Field offsets: */ PVOID ActivationContextStack; /* 0x2E8 */ } FIBER, *PFIBER; +/* PRIVATE FUNCTIONS **********************************************************/ + +VOID +WINAPI +BaseRundownFls(IN PVOID FlsData) +{ + /* No FLS support yet */ + +} + +/* PUBLIC FUNCTIONS ***********************************************************/ + /* * @implemented */ @@ -33,24 +45,27 @@ BOOL WINAPI ConvertFiberToThread(VOID) { - PTEB pTeb = NtCurrentTeb(); + PTEB Teb; + PFIBER FiberData; DPRINT1("Converting Fiber to Thread\n"); - /* the current thread isn't running a fiber: failure */ - if (!pTeb->HasFiberData) + /* Check if the thread is already not a fiber */ + Teb = NtCurrentTeb(); + if (!Teb->HasFiberData) { - SetLastError(ERROR_INVALID_PARAMETER); + /* Fail */ + SetLastError(ERROR_ALREADY_THREAD); return FALSE; } /* this thread won't run a fiber anymore */ - pTeb->HasFiberData = FALSE; + Teb->HasFiberData = FALSE; + FiberData = Teb->NtTib.FiberData; + Teb->NtTib.FiberData = NULL; - /* free the fiber */ - if(pTeb->NtTib.FiberData != NULL) - { - RtlFreeHeap(GetProcessHeap(), 0, pTeb->NtTib.FiberData); - } + /* Free the fiber */ + ASSERT(FiberData != NULL); + RtlFreeHeap(GetProcessHeap(), 0, FiberData); /* success */ return TRUE; @@ -143,73 +158,83 @@ CreateFiberEx(SIZE_T dwStackCommitSize, LPFIBER_START_ROUTINE lpStartAddress, LPVOID lpParameter) { - PFIBER pfCurFiber; - NTSTATUS nErrCode; - INITIAL_TEB usFiberInitialTeb; + PFIBER Fiber; + NTSTATUS Status; + INITIAL_TEB InitialTeb; PVOID ActivationContextStack = NULL; DPRINT("Creating Fiber\n"); -#ifdef SXS_SUPPORT_ENABLED + /* Check for invalid flags */ + if (dwFlags &~ FIBER_FLAG_FLOAT_SWITCH) + { + /* Fail */ + SetLastError(ERROR_INVALID_PARAMETER); + return NULL; + } + /* Allocate the Activation Context Stack */ - nErrCode = RtlAllocateActivationContextStack(&ActivationContextStack); -#endif + Status = RtlAllocateActivationContextStack(&ActivationContextStack); + if (!NT_SUCCESS(Status)) + { + /* Fail */ + BaseSetLastNTError(Status); + return NULL; + } /* Allocate the fiber */ - pfCurFiber = (PFIBER)RtlAllocateHeap(GetProcessHeap(), - 0, - sizeof(FIBER)); - /* Failure */ - if (pfCurFiber == NULL) + Fiber = RtlAllocateHeap(RtlGetProcessHeap(), 0, sizeof(FIBER)); + if (!Fiber) { + /* Fail */ SetLastError(ERROR_NOT_ENOUGH_MEMORY); return NULL; } /* Create the stack for the fiber */ - nErrCode = BasepCreateStack(NtCurrentProcess(), - dwStackCommitSize, - dwStackReserveSize, - &usFiberInitialTeb); - /* Failure */ - if(!NT_SUCCESS(nErrCode)) + Status = BasepCreateStack(NtCurrentProcess(), + dwStackCommitSize, + dwStackReserveSize, + &InitialTeb); + if (!NT_SUCCESS(Status)) { /* Free the fiber */ - RtlFreeHeap(GetProcessHeap(), 0, pfCurFiber); + RtlFreeHeap(GetProcessHeap(), 0, Fiber); + + /* Free the activation context */ + DPRINT1("Leaking activation stack because nobody implemented free"); + //RtlFreeActivationContextStack(&ActivationContextStack); /* Failure */ - SetLastErrorByStatus(nErrCode); + BaseSetLastNTError(Status); return NULL; } /* Clear the context */ - RtlZeroMemory(&pfCurFiber->Context, sizeof(CONTEXT)); + RtlZeroMemory(&Fiber->Context, sizeof(CONTEXT)); - /* copy the data into the fiber */ - pfCurFiber->StackBase = usFiberInitialTeb.StackBase; - pfCurFiber->StackLimit = usFiberInitialTeb.StackLimit; - pfCurFiber->DeallocationStack = usFiberInitialTeb.AllocatedStackBase; - pfCurFiber->Parameter = lpParameter; - pfCurFiber->ExceptionList = (struct _EXCEPTION_REGISTRATION_RECORD *)-1; - pfCurFiber->GuaranteedStackBytes = 0; - pfCurFiber->FlsData = NULL; - pfCurFiber->ActivationContextStack = ActivationContextStack; - pfCurFiber->Context.ContextFlags = CONTEXT_FULL; + /* Copy the data into the fiber */ + Fiber->StackBase = InitialTeb.StackBase; + Fiber->StackLimit = InitialTeb.StackLimit; + Fiber->DeallocationStack = InitialTeb.AllocatedStackBase; + Fiber->Parameter = lpParameter; + Fiber->ExceptionList = EXCEPTION_CHAIN_END; + Fiber->GuaranteedStackBytes = 0; + Fiber->FlsData = NULL; + Fiber->ActivationContextStack = ActivationContextStack; + Fiber->Context.ContextFlags = CONTEXT_FULL; - /* Save FPU State if requsted */ - if (dwFlags & FIBER_FLAG_FLOAT_SWITCH) - { - pfCurFiber->Context.ContextFlags |= CONTEXT_FLOATING_POINT; - } + /* Save FPU State if requested */ + Fiber->Context.ContextFlags = (dwFlags & FIBER_FLAG_FLOAT_SWITCH) ? CONTEXT_FLOATING_POINT : 0; /* initialize the context for the fiber */ - BasepInitializeContext(&pfCurFiber->Context, + BasepInitializeContext(&Fiber->Context, lpParameter, lpStartAddress, - usFiberInitialTeb.StackBase, + InitialTeb.StackBase, 2); - /* Return the Fiber */ - return pfCurFiber; + /* Return the Fiber */ + return Fiber; } /* @@ -219,20 +244,29 @@ VOID WINAPI DeleteFiber(LPVOID lpFiber) { - SIZE_T nSize = 0; - PVOID pStackAllocBase = ((PFIBER)lpFiber)->DeallocationStack; + SIZE_T Size = 0; + PFIBER Fiber = (PFIBER)lpFiber; + PTEB Teb; - /* free the fiber */ - RtlFreeHeap(GetProcessHeap(), 0, lpFiber); + /* First, exit the thread */ + Teb = NtCurrentTeb(); + if ((Teb->HasFiberData) && (Teb->NtTib.FiberData == Fiber)) ExitThread(1); - /* the fiber is deleting itself: let the system deallocate the stack */ - if(NtCurrentTeb()->NtTib.FiberData == lpFiber) ExitThread(1); - - /* deallocate the stack */ + /* Now de-allocate the stack */ NtFreeVirtualMemory(NtCurrentProcess(), - &pStackAllocBase, - &nSize, + &Fiber->DeallocationStack, + &Size, MEM_RELEASE); + + /* Get rid of FLS */ + if (Fiber->FlsData) BaseRundownFls(Fiber->FlsData); + + /* Get rid of the activation stack */ + DPRINT1("Leaking activation stack because nobody implemented free"); + //RtlFreeActivationContextStack(Fiber->ActivationContextStack); + + /* Free the fiber data */ + RtlFreeHeap(GetProcessHeap(), 0, lpFiber); } /* @@ -245,31 +279,108 @@ IsThreadAFiber(VOID) return NtCurrentTeb()->HasFiberData; } - -__declspec(noreturn) -VOID +/* + * @unimplemented + */ +DWORD WINAPI -BaseFiberStartup(VOID) +FlsAlloc(PFLS_CALLBACK_FUNCTION lpCallback) { -#ifdef _M_IX86 - PFIBER Fiber = GetCurrentFiber(); + (void)lpCallback; - /* Call the Thread Startup Routine */ - DPRINT("Starting Fiber\n"); - BaseThreadStartup((LPTHREAD_START_ROUTINE)Fiber->Context.Eax, - (LPVOID)Fiber->Context.Ebx); -#elif defined(_M_AMD64) - PFIBER Fiber = GetFiberData(); + UNIMPLEMENTED; + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FLS_OUT_OF_INDEXES; +} + + +/* + * @unimplemented + */ +BOOL +WINAPI +FlsFree(DWORD dwFlsIndex) +{ + (void)dwFlsIndex; - /* Call the Thread Startup Routine */ - DPRINT1("Starting Fiber\n"); - BaseThreadStartup((LPTHREAD_START_ROUTINE)Fiber->Context.Rax, - (LPVOID)Fiber->Context.Rbx); -#else -#warning Unknown architecture UNIMPLEMENTED; - DbgBreakPoint(); -#endif + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + + +/* + * @implemented + */ +PVOID +WINAPI +FlsGetValue(DWORD dwFlsIndex) +{ + PVOID *ppFlsSlots; + PVOID pRetVal; + + if(dwFlsIndex >= 128) goto l_InvalidParam; + + ppFlsSlots = NtCurrentTeb()->FlsData; + + if(ppFlsSlots == NULL) goto l_InvalidParam; + + SetLastError(0); + pRetVal = ppFlsSlots[dwFlsIndex + 2]; + + return pRetVal; + +l_InvalidParam: + SetLastError(ERROR_INVALID_PARAMETER); + return NULL; +} + + +/* + * @implemented + */ +BOOL +WINAPI +FlsSetValue(DWORD dwFlsIndex, PVOID lpFlsData) +{ + PVOID *ppFlsSlots; + TEB *pTeb = NtCurrentTeb(); + + if(dwFlsIndex >= 128) goto l_InvalidParam; + + ppFlsSlots = pTeb->FlsData; + + if (ppFlsSlots == NULL) + { + PEB *pPeb = pTeb->ProcessEnvironmentBlock; + + ppFlsSlots = RtlAllocateHeap(pPeb->ProcessHeap, + HEAP_ZERO_MEMORY, + (128 + 2) * sizeof(PVOID)); + if(ppFlsSlots == NULL) goto l_OutOfMemory; + + pTeb->FlsData = ppFlsSlots; + + RtlAcquirePebLock(); + + /* TODO: initialization */ + + RtlReleasePebLock(); + } + + ppFlsSlots[dwFlsIndex + 2] = lpFlsData; + + return TRUE; + +l_OutOfMemory: + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + goto l_Fail; + +l_InvalidParam: + SetLastError(ERROR_INVALID_PARAMETER); + +l_Fail: + return FALSE; } /* EOF */ diff --git a/dll/win32/kernel32/file/backup.c b/dll/win32/kernel32/client/file/backup.c similarity index 100% rename from dll/win32/kernel32/file/backup.c rename to dll/win32/kernel32/client/file/backup.c diff --git a/dll/win32/kernel32/file/bintype.c b/dll/win32/kernel32/client/file/bintype.c similarity index 100% rename from dll/win32/kernel32/file/bintype.c rename to dll/win32/kernel32/client/file/bintype.c diff --git a/dll/win32/kernel32/file/cnotify.c b/dll/win32/kernel32/client/file/cnotify.c similarity index 85% rename from dll/win32/kernel32/file/cnotify.c rename to dll/win32/kernel32/client/file/cnotify.c index 37814a13384..120be594435 100644 --- a/dll/win32/kernel32/file/cnotify.c +++ b/dll/win32/kernel32/client/file/cnotify.c @@ -26,7 +26,7 @@ FindCloseChangeNotification (HANDLE hChangeHandle) NTSTATUS Status = NtClose(hChangeHandle); if(!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -43,26 +43,11 @@ FindFirstChangeNotificationA(IN LPCSTR lpPathName, IN BOOL bWatchSubtree, IN DWORD dwNotifyFilter) { - NTSTATUS Status; - ANSI_STRING PathNameString; - - RtlInitAnsiString(&PathNameString, lpPathName); - Status = RtlAnsiStringToUnicodeString(&(NtCurrentTeb()->StaticUnicodeString), &PathNameString, FALSE); - if (!NT_SUCCESS(Status)) - { - if (Status != STATUS_BUFFER_OVERFLOW) - { - SetLastError(ERROR_FILENAME_EXCED_RANGE); - } - else - { - BaseSetLastNTError(Status); - } - return INVALID_HANDLE_VALUE; - } - - return FindFirstChangeNotificationW(NtCurrentTeb()->StaticUnicodeString.Buffer, - bWatchSubtree, dwNotifyFilter); + /* Call the W(ide) function */ + ConvertWin32AnsiChangeApiToUnicodeApi(FindFirstChangeNotification, + lpPathName, + bWatchSubtree, + dwNotifyFilter); } @@ -88,7 +73,7 @@ FindFirstChangeNotificationW ( NULL, NULL)) { - SetLastErrorByStatus(STATUS_OBJECT_PATH_SYNTAX_BAD); + BaseSetLastNTError(STATUS_OBJECT_PATH_SYNTAX_BAD); return INVALID_HANDLE_VALUE; } @@ -115,7 +100,7 @@ FindFirstChangeNotificationW ( if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return INVALID_HANDLE_VALUE; } @@ -131,7 +116,7 @@ FindFirstChangeNotificationW ( if (!NT_SUCCESS(Status)) { NtClose(hDir); - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return INVALID_HANDLE_VALUE; } @@ -164,7 +149,7 @@ FindNextChangeNotification ( if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -252,7 +237,7 @@ ReadDirectoryChangesW( if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } diff --git a/dll/win32/kernel32/misc/console.c b/dll/win32/kernel32/client/file/console.c similarity index 94% rename from dll/win32/kernel32/misc/console.c rename to dll/win32/kernel32/client/file/console.c index 2fc95b58d5f..52333f6731e 100644 --- a/dll/win32/kernel32/misc/console.c +++ b/dll/win32/kernel32/client/file/console.c @@ -300,7 +300,7 @@ AddConsoleAliasW(LPCWSTR lpSource, if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request->Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); RtlFreeHeap(GetProcessHeap(), 0, Request); return FALSE; } @@ -359,7 +359,7 @@ DuplicateConsoleHandle(HANDLE hConsole, sizeof(CSR_API_MESSAGE)); if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status=Request.Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return INVALID_HANDLE_VALUE; } @@ -394,7 +394,7 @@ IntExpungeConsoleCommandHistory(LPCVOID lpExeName, BOOL bUnicode) CsrFreeCaptureBuffer(CaptureBuffer); if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } return TRUE; @@ -499,7 +499,7 @@ GetConsoleAliasW(LPWSTR lpSource, { RtlFreeHeap(GetProcessHeap(), 0, Request); CsrFreeCaptureBuffer(CaptureBuffer); - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return 0; } @@ -614,7 +614,7 @@ GetConsoleAliasExesW(LPWSTR lpExeNameBuffer, if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); CsrFreeCaptureBuffer(CaptureBuffer); return 0; } @@ -676,7 +676,7 @@ GetConsoleAliasExesLengthW(VOID) if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return 0; } @@ -735,7 +735,7 @@ GetConsoleAliasesW(LPWSTR AliasBuffer, if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return 0; } @@ -800,7 +800,7 @@ GetConsoleAliasesLengthW(LPWSTR lpExeName) if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return 0; } @@ -866,7 +866,7 @@ IntGetConsoleCommandHistory(LPVOID lpHistory, DWORD cbHistory, LPCVOID lpExeName if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status)) { CsrFreeCaptureBuffer(CaptureBuffer); - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return 0; } @@ -941,7 +941,7 @@ IntGetConsoleCommandHistoryLength(LPCVOID lpExeName, BOOL bUnicode) CsrFreeCaptureBuffer(CaptureBuffer); if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return 0; } return Request.Data.GetCommandHistoryLength.Length; @@ -1042,7 +1042,7 @@ GetConsoleHardwareState(HANDLE hConsole, sizeof(CSR_API_MESSAGE)); if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -1070,7 +1070,7 @@ GetConsoleInputWaitHandle(VOID) sizeof(CSR_API_MESSAGE)); if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return 0; } @@ -1171,7 +1171,7 @@ OpenConsoleW(LPCWSTR wsName, sizeof(CSR_API_MESSAGE)); if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return INVALID_HANDLE_VALUE; } @@ -1253,7 +1253,7 @@ SetConsoleHardwareState(HANDLE hConsole, sizeof(CSR_API_MESSAGE)); if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -1334,7 +1334,7 @@ IntSetConsoleNumberOfCommands(DWORD dwNumCommands, CsrFreeCaptureBuffer(CaptureBuffer); if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } return TRUE; @@ -1419,7 +1419,7 @@ VerifyConsoleIoHandle(HANDLE Handle) sizeof(CSR_API_MESSAGE)); if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -1479,7 +1479,7 @@ CloseConsoleHandle(HANDLE Handle) sizeof(CSR_API_MESSAGE)); if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -1621,7 +1621,7 @@ IntWriteConsole(HANDLE hConsoleOutput, if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request->Status)) { RtlFreeHeap(RtlGetProcessHeap(), 0, Request); - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -1744,7 +1744,7 @@ IntReadConsole(HANDLE hConsoleInput, { DPRINT1("CSR returned error in ReadConsole\n"); CsrFreeCaptureBuffer(CaptureBuffer); - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } } @@ -1827,7 +1827,7 @@ AllocConsole(VOID) if (NtCurrentPeb()->ProcessParameters->ConsoleHandle) { DPRINT("AllocConsole: Allocate duplicate console to the same Process\n"); - SetLastErrorByStatus (STATUS_OBJECT_NAME_EXISTS); + BaseSetLastNTError (STATUS_OBJECT_NAME_EXISTS); return FALSE; } @@ -1840,7 +1840,7 @@ AllocConsole(VOID) Status = CsrClientCallServer(&Request, NULL, CsrRequest, sizeof(CSR_API_MESSAGE)); if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -1880,7 +1880,7 @@ FreeConsole(VOID) Status = CsrClientCallServer(&Request, NULL, CsrRequest, sizeof(CSR_API_MESSAGE)); if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -1909,7 +1909,7 @@ GetConsoleScreenBufferInfo(HANDLE hConsoleOutput, Status = CsrClientCallServer(&Request, NULL, CsrRequest, sizeof(CSR_API_MESSAGE)); if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } *lpConsoleScreenBufferInfo = Request.Data.ScreenBufferInfoRequest.Info; @@ -1938,7 +1938,7 @@ SetConsoleCursorPosition(HANDLE hConsoleOutput, Status = CsrClientCallServer(&Request, NULL, CsrRequest, sizeof(CSR_API_MESSAGE)); if(!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -1978,7 +1978,7 @@ IntFillConsoleOutputCharacter(HANDLE hConsoleOutput, if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -2102,7 +2102,7 @@ IntPeekConsoleInput(HANDLE hConsoleInput, { /* Error out */ *lpNumberOfEventsRead = 0; - SetLastErrorByStatus(Request.Status); + BaseSetLastNTError(Request.Status); } /* Release the capture buffer */ @@ -2181,7 +2181,7 @@ IntReadConsoleInput(HANDLE hConsoleInput, if (Read == 0) { /* we couldn't read a single record, fail */ - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } else @@ -2197,7 +2197,7 @@ IntReadConsoleInput(HANDLE hConsoleInput, Status = NtWaitForSingleObject(Request.Data.ReadInputRequest.Event, FALSE, 0); if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); break; } } @@ -2331,7 +2331,7 @@ IntWriteConsoleInput(HANDLE hConsoleInput, { /* Error out */ *lpNumberOfEventsWritten = 0; - SetLastErrorByStatus(Request.Status); + BaseSetLastNTError(Request.Status); } /* Release the capture buffer */ @@ -2452,7 +2452,7 @@ IntReadConsoleOutput(HANDLE hConsoleOutput, else { /* Error out */ - SetLastErrorByStatus(Request.Status); + BaseSetLastNTError(Request.Status); } /* Return the read region */ @@ -2565,7 +2565,7 @@ IntWriteConsoleOutput(HANDLE hConsoleOutput, if (!NT_SUCCESS(Request.Status)) { /* Error out */ - SetLastErrorByStatus(Request.Status); + BaseSetLastNTError(Request.Status); } /* Return the read region */ @@ -2673,7 +2673,7 @@ IntReadConsoleOutputCharacter(HANDLE hConsoleOutput, if (!NT_SUCCESS(Status) || !NT_SUCCESS(Request->Status)) { RtlFreeHeap(RtlGetProcessHeap(), 0, Request); - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); break; } @@ -2795,7 +2795,7 @@ ReadConsoleOutputAttribute(HANDLE hConsoleOutput, if (!NT_SUCCESS(Status) || !NT_SUCCESS(Request->Status)) { RtlFreeHeap(RtlGetProcessHeap(), 0, Request); - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -2864,7 +2864,7 @@ IntWriteConsoleOutputCharacter(HANDLE hConsoleOutput, if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request->Status)) { RtlFreeHeap(RtlGetProcessHeap(), 0, Request); - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -2980,7 +2980,7 @@ WriteConsoleOutputAttribute(HANDLE hConsoleOutput, if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request->Status)) { RtlFreeHeap(RtlGetProcessHeap(), 0, Request); - SetLastErrorByStatus (Status); + BaseSetLastNTError (Status); return FALSE; } nLength -= Size; @@ -3020,7 +3020,7 @@ FillConsoleOutputAttribute(HANDLE hConsoleOutput, Status = CsrClientCallServer(&Request, NULL, CsrRequest, sizeof(CSR_API_MESSAGE)); if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status)) { - SetLastErrorByStatus ( Status ); + BaseSetLastNTError ( Status ); return FALSE; } @@ -3051,7 +3051,7 @@ GetConsoleMode(HANDLE hConsoleHandle, Status = CsrClientCallServer( &Request, NULL, CsrRequest, sizeof( CSR_API_MESSAGE ) ); if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status)) { - SetLastErrorByStatus ( Status ); + BaseSetLastNTError ( Status ); return FALSE; } *lpMode = Request.Data.GetConsoleModeRequest.ConsoleMode; @@ -3086,7 +3086,7 @@ GetNumberOfConsoleInputEvents(HANDLE hConsoleInput, Status = CsrClientCallServer(&Request, NULL, CsrRequest, sizeof(CSR_API_MESSAGE)); if(!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -3143,7 +3143,7 @@ GetConsoleCursorInfo(HANDLE hConsoleOutput, if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } *lpConsoleCursorInfo = Request.Data.GetCursorInfoRequest.Info; @@ -3188,7 +3188,7 @@ SetConsoleMode(HANDLE hConsoleHandle, Status = CsrClientCallServer(&Request, NULL, CsrRequest, sizeof(CSR_API_MESSAGE)); if(!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status)) { - SetLastErrorByStatus ( Status ); + BaseSetLastNTError ( Status ); return FALSE; } @@ -3215,7 +3215,7 @@ SetConsoleActiveScreenBuffer(HANDLE hConsoleOutput) Status = CsrClientCallServer(&Request, NULL, CsrRequest, sizeof(CSR_API_MESSAGE)); if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -3242,7 +3242,7 @@ FlushConsoleInputBuffer(HANDLE hConsoleInput) Status = CsrClientCallServer(&Request, NULL, CsrRequest, sizeof(CSR_API_MESSAGE)); if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -3271,7 +3271,7 @@ SetConsoleScreenBufferSize(HANDLE hConsoleOutput, Status = CsrClientCallServer(&Request, NULL, CsrRequest, sizeof(CSR_API_MESSAGE)); if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -3299,7 +3299,7 @@ SetConsoleCursorInfo(HANDLE hConsoleOutput, Status = CsrClientCallServer(&Request, NULL, CsrRequest, sizeof(CSR_API_MESSAGE)); if(!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -3345,7 +3345,7 @@ IntScrollConsoleScreenBuffer(HANDLE hConsoleOutput, if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -3435,7 +3435,7 @@ SetConsoleTextAttribute(HANDLE hConsoleOutput, Status = CsrClientCallServer(&Request, NULL, CsrRequest, sizeof(CSR_API_MESSAGE)); if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -3569,7 +3569,7 @@ GenerateConsoleCtrlEvent(DWORD dwCtrlEvent, sizeof(CSR_API_MESSAGE)); if(!NT_SUCCESS(Status) || !(NT_SUCCESS(Status = Request.Status))) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -3605,7 +3605,7 @@ IntGetConsoleTitle(LPVOID lpConsoleTitle, DWORD nSize, BOOL bUnicode) if (!NT_SUCCESS(Status) || !(NT_SUCCESS(Status = Request.Status))) { CsrFreeCaptureBuffer(CaptureBuffer); - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return 0; } @@ -3698,7 +3698,7 @@ SetConsoleTitleW(LPCWSTR lpConsoleTitle) CsrFreeCaptureBuffer(CaptureBuffer); if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -3766,7 +3766,7 @@ CreateConsoleScreenBuffer(DWORD dwDesiredAccess, Status = CsrClientCallServer(&Request, NULL, CsrRequest, sizeof(CSR_API_MESSAGE)); if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return INVALID_HANDLE_VALUE; } return Request.Data.CreateScreenBufferRequest.OutputHandle; @@ -3790,7 +3790,7 @@ GetConsoleCP(VOID) Status = CsrClientCallServer(&Request, NULL, CsrRequest, sizeof(CSR_API_MESSAGE)); if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status)) { - SetLastErrorByStatus (Status); + BaseSetLastNTError (Status); return 0; } @@ -3817,7 +3817,7 @@ SetConsoleCP(UINT wCodePageID) Status = CsrClientCallServer(&Request, NULL, CsrRequest, sizeof(CSR_API_MESSAGE)); if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); } return NT_SUCCESS(Status); @@ -3841,7 +3841,7 @@ GetConsoleOutputCP(VOID) Status = CsrClientCallServer(&Request, NULL, CsrRequest, sizeof(CSR_API_MESSAGE)); if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status)) { - SetLastErrorByStatus (Status); + BaseSetLastNTError (Status); return 0; } @@ -3867,7 +3867,7 @@ SetConsoleOutputCP(UINT wCodePageID) Status = CsrClientCallServer(&Request, NULL, CsrRequest, sizeof(CSR_API_MESSAGE)); if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); } return NT_SUCCESS(Status); @@ -3916,7 +3916,7 @@ GetConsoleProcessList(LPDWORD lpdwProcessList, sizeof(CSR_API_MESSAGE)); if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status)) { - SetLastErrorByStatus (Status); + BaseSetLastNTError (Status); nProcesses = 0; } else @@ -3948,7 +3948,7 @@ GetConsoleSelectionInfo(PCONSOLE_SELECTION_INFO lpConsoleSelectionInfo) NTSTATUS Status = CsrClientCallServer(&Request, NULL, CsrRequest, sizeof(CSR_API_MESSAGE)); if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -3988,7 +3988,7 @@ GetConsoleWindow(VOID) Status = CsrClientCallServer(&Request, NULL, CsrRequest, sizeof(CSR_API_MESSAGE)); if (!NT_SUCCESS(Status ) || !NT_SUCCESS(Status = Request.Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return (HWND) NULL; } @@ -4015,7 +4015,7 @@ SetConsoleIcon(HICON hicon) Status = CsrClientCallServer(&Request, NULL, CsrRequest, sizeof(CSR_API_MESSAGE)); if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -4100,7 +4100,7 @@ SetConsoleInputExeNameA(LPCSTR lpInputExeName) } else { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); Ret = FALSE; } @@ -4195,145 +4195,143 @@ GetConsoleInputExeNameA(DWORD nBufferLength, LPSTR lpBuffer) return Ret; } - -/*-------------------------------------------------------------- - * GetConsoleHistoryInfo - * - * @implemented - */ BOOL WINAPI -GetConsoleHistoryInfo(PCONSOLE_HISTORY_INFO lpConsoleHistoryInfo) +GetConsoleCharType(HANDLE hConsole, COORD Coord, PDWORD Type) { - CSR_API_MESSAGE Request; - ULONG CsrRequest = MAKE_CSR_API(GET_HISTORY_INFO, CSR_CONSOLE); - NTSTATUS Status; - if (lpConsoleHistoryInfo->cbSize != sizeof(CONSOLE_HISTORY_INFO)) - { - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } - Status = CsrClientCallServer(&Request, NULL, CsrRequest, sizeof(CSR_API_MESSAGE)); - if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status)) - { - SetLastErrorByStatus(Status); - return FALSE; - } - lpConsoleHistoryInfo->HistoryBufferSize = Request.Data.GetHistoryInfo.HistoryBufferSize; - lpConsoleHistoryInfo->NumberOfHistoryBuffers = Request.Data.GetHistoryInfo.NumberOfHistoryBuffers; - lpConsoleHistoryInfo->dwFlags = Request.Data.GetHistoryInfo.dwFlags; - return TRUE; + STUB; + return FALSE; +} + +BOOL +WINAPI +GetConsoleCursorMode(HANDLE hConsole, PBOOL pUnknown1, PBOOL pUnknown2) +{ + STUB; + return FALSE; +} + +BOOL +WINAPI +GetConsoleNlsMode(HANDLE hConsole, LPDWORD lpMode) +{ + STUB; + return FALSE; } -/*-------------------------------------------------------------- - * SetConsoleHistoryInfo - * - * @implemented - */ BOOL WINAPI -SetConsoleHistoryInfo(IN PCONSOLE_HISTORY_INFO lpConsoleHistoryInfo) +ReadConsoleInputExA(HANDLE hConsole, LPVOID lpBuffer, DWORD dwLen, LPDWORD Unknown1, DWORD Unknown2) { - CSR_API_MESSAGE Request; - ULONG CsrRequest = MAKE_CSR_API(GET_HISTORY_INFO, CSR_CONSOLE); - NTSTATUS Status; - if (lpConsoleHistoryInfo->cbSize != sizeof(CONSOLE_HISTORY_INFO)) - { - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } - Request.Data.SetHistoryInfo.HistoryBufferSize = lpConsoleHistoryInfo->HistoryBufferSize; - Request.Data.SetHistoryInfo.NumberOfHistoryBuffers = lpConsoleHistoryInfo->NumberOfHistoryBuffers; - Request.Data.SetHistoryInfo.dwFlags = lpConsoleHistoryInfo->dwFlags; - Status = CsrClientCallServer(&Request, NULL, CsrRequest, sizeof(CSR_API_MESSAGE)); - if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status)) - { - SetLastErrorByStatus(Status); - return FALSE; - } - return TRUE; + STUB; + return FALSE; +} + +BOOL +WINAPI +ReadConsoleInputExW(HANDLE hConsole, LPVOID lpBuffer, DWORD dwLen, LPDWORD Unknown1, DWORD Unknown2) +{ + STUB; + return FALSE; +} + +BOOL +WINAPI +RegisterConsoleIME(HWND hWnd, LPDWORD ThreadId) +{ + STUB; + return FALSE; +} + +BOOL +WINAPI +RegisterConsoleOS2(BOOL bUnknown) +{ + STUB; + return FALSE; +} + +BOOL +WINAPI +SetConsoleCursorMode(HANDLE hConsole, BOOL Unknown1, BOOL Unknown2) +{ + STUB; + return FALSE; +} + +BOOL +WINAPI +SetConsoleLocalEUDC(DWORD Unknown1, DWORD Unknown2, DWORD Unknown3, DWORD Unknown4) +{ + STUB; + return FALSE; +} + +BOOL +WINAPI +SetConsoleNlsMode(HANDLE hConsole, DWORD dwMode) +{ + STUB; + return FALSE; +} + +BOOL +WINAPI +SetConsoleOS2OemFormat(BOOL bUnknown) +{ + STUB; + return FALSE; +} + +BOOL +WINAPI +UnregisterConsoleIME(VOID) +{ + STUB; + return FALSE; } -/*-------------------------------------------------------------- - * GetConsoleOriginalTitleW - * +/* * @unimplemented */ -DWORD -WINAPI -GetConsoleOriginalTitleW(OUT LPWSTR lpConsoleTitle, - IN DWORD nSize) +BOOL WINAPI GetConsoleKeyboardLayoutNameA(LPSTR name) { - DPRINT1("GetConsoleOriginalTitleW(0x%p, 0x%x) UNIMPLEMENTED!\n", lpConsoleTitle, nSize); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + STUB; return 0; } - -/*-------------------------------------------------------------- - * GetConsoleOriginalTitleA - * +/* * @unimplemented */ -DWORD -WINAPI -GetConsoleOriginalTitleA(OUT LPSTR lpConsoleTitle, - IN DWORD nSize) +BOOL WINAPI GetConsoleKeyboardLayoutNameW(LPWSTR name) { - DPRINT1("GetConsoleOriginalTitleA(0x%p, 0x%x) UNIMPLEMENTED!\n", lpConsoleTitle, nSize); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + STUB; return 0; } - -/*-------------------------------------------------------------- - * GetConsoleScreenBufferInfoEx - * +/* * @unimplemented */ BOOL WINAPI -GetConsoleScreenBufferInfoEx(IN HANDLE hConsoleOutput, - OUT PCONSOLE_SCREEN_BUFFER_INFOEX lpConsoleScreenBufferInfoEx) +SetLastConsoleEventActive(VOID) { - DPRINT1("GetConsoleScreenBufferInfoEx(0x%p, 0x%p) UNIMPLEMENTED!\n", hConsoleOutput, lpConsoleScreenBufferInfoEx); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + STUB; return FALSE; } - -/*-------------------------------------------------------------- - * SetConsoleScreenBufferInfoEx - * +/* * @unimplemented */ BOOL WINAPI -SetConsoleScreenBufferInfoEx(IN HANDLE hConsoleOutput, - IN PCONSOLE_SCREEN_BUFFER_INFOEX lpConsoleScreenBufferInfoEx) +SetConsoleCommandHistoryMode(IN DWORD dwMode) { - DPRINT1("SetConsoleScreenBufferInfoEx(0x%p, 0x%p) UNIMPLEMENTED!\n", hConsoleOutput, lpConsoleScreenBufferInfoEx); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + STUB; return FALSE; } -/*-------------------------------------------------------------- - * GetCurrentConsoleFontEx - * - * @unimplemented - */ -BOOL -WINAPI -GetCurrentConsoleFontEx(IN HANDLE hConsoleOutput, - IN BOOL bMaximumWindow, - OUT PCONSOLE_FONT_INFOEX lpConsoleCurrentFontEx) -{ - DPRINT1("GetCurrentConsoleFontEx(0x%p, 0x%x, 0x%p) UNIMPLEMENTED!\n", hConsoleOutput, bMaximumWindow, lpConsoleCurrentFontEx); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; -} - /* EOF */ diff --git a/dll/win32/kernel32/file/copy.c b/dll/win32/kernel32/client/file/copy.c similarity index 98% rename from dll/win32/kernel32/file/copy.c rename to dll/win32/kernel32/client/file/copy.c index 30c847bacf1..2af2cdfcbbe 100644 --- a/dll/win32/kernel32/file/copy.c +++ b/dll/win32/kernel32/client/file/copy.c @@ -233,7 +233,7 @@ CopyFileExW ( if (!NT_SUCCESS(errCode)) { TRACE("Status 0x%08x obtaining FileStandardInformation for source\n", errCode); - SetLastErrorByStatus(errCode); + BaseSetLastNTError(errCode); } else { @@ -244,7 +244,7 @@ CopyFileExW ( if (!NT_SUCCESS(errCode)) { TRACE("Status 0x%08x obtaining FileBasicInformation for source\n", errCode); - SetLastErrorByStatus(errCode); + BaseSetLastNTError(errCode); } else { @@ -266,7 +266,7 @@ CopyFileExW ( &KeepDestOnError); if (!NT_SUCCESS(errCode)) { - SetLastErrorByStatus(errCode); + BaseSetLastNTError(errCode); } else { @@ -276,7 +276,7 @@ CopyFileExW ( errCode = SetLastWriteTime(FileHandleDest, t); if (!NT_SUCCESS(errCode)) { - SetLastErrorByStatus(errCode); + BaseSetLastNTError(errCode); } else { diff --git a/dll/win32/kernel32/file/create.c b/dll/win32/kernel32/client/file/create.c similarity index 62% rename from dll/win32/kernel32/file/create.c rename to dll/win32/kernel32/client/file/create.c index 8da66358bd6..a9d6c054760 100644 --- a/dll/win32/kernel32/file/create.c +++ b/dll/win32/kernel32/client/file/create.c @@ -349,7 +349,7 @@ HANDLE WINAPI CreateFileW (LPCWSTR lpFileName, } else { - SetLastErrorByStatus (Status); + BaseSetLastNTError (Status); } return INVALID_HANDLE_VALUE; @@ -371,243 +371,4 @@ HANDLE WINAPI CreateFileW (LPCWSTR lpFileName, return FileHandle; } - -/* - * @implemented - */ -BOOLEAN -WINAPI -CreateSymbolicLinkW(IN LPCWSTR lpSymlinkFileName, - IN LPCWSTR lpTargetFileName, - IN DWORD dwFlags) -{ - IO_STATUS_BLOCK IoStatusBlock; - OBJECT_ATTRIBUTES ObjectAttributes; - HANDLE hSymlink = NULL; - UNICODE_STRING SymlinkFileName = { 0, 0, NULL }; - UNICODE_STRING TargetFileName = { 0, 0, NULL }; - BOOLEAN bAllocatedTarget = FALSE, bRelativePath = FALSE; - LPWSTR lpTargetFullFileName = NULL; - SIZE_T cbPrintName; - SIZE_T cbReparseData; - PREPARSE_DATA_BUFFER pReparseData = NULL; - PBYTE pBufTail; - NTSTATUS Status; - ULONG dwCreateOptions; - DWORD dwErr; - - if(!lpSymlinkFileName || !lpTargetFileName || (dwFlags | SYMBOLIC_LINK_FLAG_DIRECTORY) != SYMBOLIC_LINK_FLAG_DIRECTORY) - { - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } - - if(dwFlags & SYMBOLIC_LINK_FLAG_DIRECTORY) - dwCreateOptions = FILE_DIRECTORY_FILE; - else - dwCreateOptions = FILE_NON_DIRECTORY_FILE; - - switch(RtlDetermineDosPathNameType_U(lpTargetFileName)) - { - case RtlPathTypeUnknown: - case RtlPathTypeRooted: - case RtlPathTypeRelative: - bRelativePath = TRUE; - RtlInitUnicodeString(&TargetFileName, lpTargetFileName); - break; - - case RtlPathTypeDriveRelative: - { - LPWSTR FilePart; - SIZE_T cchTargetFullFileName; - - cchTargetFullFileName = GetFullPathNameW(lpTargetFileName, 0, NULL, &FilePart); - - if(cchTargetFullFileName == 0) - { - dwErr = GetLastError(); - goto Cleanup; - } - - lpTargetFullFileName = RtlAllocateHeap(RtlGetProcessHeap(), 0, cchTargetFullFileName * sizeof(WCHAR)); - - if(lpTargetFullFileName == NULL) - { - dwErr = ERROR_NOT_ENOUGH_MEMORY; - goto Cleanup; - } - - if(GetFullPathNameW(lpTargetFileName, cchTargetFullFileName, lpTargetFullFileName, &FilePart) == 0) - { - dwErr = GetLastError(); - goto Cleanup; - } - } - - lpTargetFileName = lpTargetFullFileName; - - // fallthrough - - case RtlPathTypeUncAbsolute: - case RtlPathTypeDriveAbsolute: - case RtlPathTypeLocalDevice: - case RtlPathTypeRootLocalDevice: - default: - if(!RtlDosPathNameToNtPathName_U(lpTargetFileName, &TargetFileName, NULL, NULL)) - { - bAllocatedTarget = TRUE; - dwErr = ERROR_INVALID_PARAMETER; - goto Cleanup; - } - } - - cbPrintName = wcslen(lpTargetFileName) * sizeof(WCHAR); - cbReparseData = FIELD_OFFSET(REPARSE_DATA_BUFFER, SymbolicLinkReparseBuffer.PathBuffer) + TargetFileName.Length + cbPrintName; - pReparseData = RtlAllocateHeap(RtlGetProcessHeap(), 0, cbReparseData); - - if(pReparseData == NULL) - { - dwErr = ERROR_NOT_ENOUGH_MEMORY; - goto Cleanup; - } - - pBufTail = (PBYTE)(pReparseData->SymbolicLinkReparseBuffer.PathBuffer); - - pReparseData->ReparseTag = (ULONG)IO_REPARSE_TAG_SYMLINK; - pReparseData->ReparseDataLength = (USHORT)cbReparseData - REPARSE_DATA_BUFFER_HEADER_SIZE; - pReparseData->Reserved = 0; - - pReparseData->SymbolicLinkReparseBuffer.SubstituteNameOffset = 0; - pReparseData->SymbolicLinkReparseBuffer.SubstituteNameLength = TargetFileName.Length; - pBufTail += pReparseData->SymbolicLinkReparseBuffer.SubstituteNameOffset; - RtlCopyMemory(pBufTail, TargetFileName.Buffer, TargetFileName.Length); - - pReparseData->SymbolicLinkReparseBuffer.PrintNameOffset = pReparseData->SymbolicLinkReparseBuffer.SubstituteNameLength; - pReparseData->SymbolicLinkReparseBuffer.PrintNameLength = (USHORT)cbPrintName; - pBufTail += pReparseData->SymbolicLinkReparseBuffer.PrintNameOffset; - RtlCopyMemory(pBufTail, lpTargetFileName, cbPrintName); - - pReparseData->SymbolicLinkReparseBuffer.Flags = 0; - - if(bRelativePath) - pReparseData->SymbolicLinkReparseBuffer.Flags |= 1; // TODO! give this lone flag a name - - if(!RtlDosPathNameToNtPathName_U(lpSymlinkFileName, &SymlinkFileName, NULL, NULL)) - { - dwErr = ERROR_PATH_NOT_FOUND; - goto Cleanup; - } - - InitializeObjectAttributes(&ObjectAttributes, &SymlinkFileName, OBJ_CASE_INSENSITIVE, NULL, NULL); - - Status = NtCreateFile - ( - &hSymlink, - FILE_WRITE_ATTRIBUTES | DELETE | SYNCHRONIZE, - &ObjectAttributes, - &IoStatusBlock, - NULL, - FILE_ATTRIBUTE_NORMAL, - 0, - FILE_CREATE, - FILE_SYNCHRONOUS_IO_NONALERT | FILE_OPEN_REPARSE_POINT | dwCreateOptions, - NULL, - 0 - ); - - if(!NT_SUCCESS(Status)) - { - dwErr = RtlNtStatusToDosError(Status); - goto Cleanup; - } - - Status = NtFsControlFile - ( - hSymlink, - NULL, - NULL, - NULL, - &IoStatusBlock, - FSCTL_SET_REPARSE_POINT, - pReparseData, - cbReparseData, - NULL, - 0 - ); - - if(!NT_SUCCESS(Status)) - { - FILE_DISPOSITION_INFORMATION DispInfo; - DispInfo.DeleteFile = TRUE; - NtSetInformationFile(hSymlink, &IoStatusBlock, &DispInfo, sizeof(DispInfo), FileDispositionInformation); - - dwErr = RtlNtStatusToDosError(Status); - goto Cleanup; - } - - dwErr = NO_ERROR; - -Cleanup: - if(hSymlink) - NtClose(hSymlink); - - RtlFreeUnicodeString(&SymlinkFileName); - if (bAllocatedTarget) - { - RtlFreeHeap(RtlGetProcessHeap(), - 0, - TargetFileName.Buffer); - } - - if(lpTargetFullFileName) - RtlFreeHeap(RtlGetProcessHeap(), 0, lpTargetFullFileName); - - if(pReparseData) - RtlFreeHeap(RtlGetProcessHeap(), 0, pReparseData); - - if(dwErr) - { - SetLastError(dwErr); - return FALSE; - } - - return TRUE; -} - - -/* - * @implemented - */ -BOOLEAN -NTAPI -CreateSymbolicLinkA(IN LPCSTR lpSymlinkFileName, - IN LPCSTR lpTargetFileName, - IN DWORD dwFlags) -{ - PWCHAR SymlinkW, TargetW; - BOOLEAN Ret; - - if(!lpSymlinkFileName || !lpTargetFileName) - { - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } - - if (!(SymlinkW = FilenameA2W(lpSymlinkFileName, FALSE))) - return FALSE; - - if (!(TargetW = FilenameA2W(lpTargetFileName, TRUE))) - return FALSE; - - Ret = CreateSymbolicLinkW(SymlinkW, - TargetW, - dwFlags); - - RtlFreeHeap(RtlGetProcessHeap(), 0, SymlinkW); - RtlFreeHeap(RtlGetProcessHeap(), 0, TargetW); - - return Ret; -} - - /* EOF */ diff --git a/dll/win32/kernel32/file/curdir.c b/dll/win32/kernel32/client/file/curdir.c similarity index 99% rename from dll/win32/kernel32/file/curdir.c rename to dll/win32/kernel32/client/file/curdir.c index 42ae057f054..9d4d2e344fc 100644 --- a/dll/win32/kernel32/file/curdir.c +++ b/dll/win32/kernel32/client/file/curdir.c @@ -121,7 +121,7 @@ SetCurrentDirectoryW ( Status = RtlSetCurrentDirectory_U (&UnicodeString); if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus (Status); + BaseSetLastNTError (Status); return FALSE; } diff --git a/dll/win32/kernel32/file/delete.c b/dll/win32/kernel32/client/file/delete.c similarity index 96% rename from dll/win32/kernel32/file/delete.c rename to dll/win32/kernel32/client/file/delete.c index 78f62c11622..d2170673fbc 100644 --- a/dll/win32/kernel32/file/delete.c +++ b/dll/win32/kernel32/client/file/delete.c @@ -90,7 +90,7 @@ DeleteFileW ( if (!NT_SUCCESS(Status)) { WARN("Status 0x%08x\n", Status); - SetLastErrorByStatus (Status); + BaseSetLastNTError (Status); return FALSE; } @@ -105,7 +105,7 @@ DeleteFileW ( { WARN("Status 0x%08x\n", Status); NtClose (FileHandle); - SetLastErrorByStatus (Status); + BaseSetLastNTError (Status); return FALSE; } @@ -113,7 +113,7 @@ DeleteFileW ( if (!NT_SUCCESS (Status)) { WARN("Status 0x%08x\n", Status); - SetLastErrorByStatus (Status); + BaseSetLastNTError (Status); return FALSE; } diff --git a/dll/win32/kernel32/file/deviceio.c b/dll/win32/kernel32/client/file/deviceio.c similarity index 72% rename from dll/win32/kernel32/file/deviceio.c rename to dll/win32/kernel32/client/file/deviceio.c index a3016ed75b9..a00ee9b3d64 100644 --- a/dll/win32/kernel32/file/deviceio.c +++ b/dll/win32/kernel32/client/file/deviceio.c @@ -14,6 +14,85 @@ /* FUNCTIONS ******************************************************************/ +/* + * @implemented + */ +BOOL +WINAPI +Beep (DWORD dwFreq, DWORD dwDuration) +{ + HANDLE hBeep; + UNICODE_STRING BeepDevice; + OBJECT_ATTRIBUTES ObjectAttributes; + IO_STATUS_BLOCK IoStatusBlock; + BEEP_SET_PARAMETERS BeepSetParameters; + NTSTATUS Status; + + /* check the parameters */ + if ((dwFreq >= 0x25 && dwFreq <= 0x7FFF) || + (dwFreq == 0x0 && dwDuration == 0x0)) + { + /* open the device */ + RtlInitUnicodeString(&BeepDevice, + L"\\Device\\Beep"); + + InitializeObjectAttributes(&ObjectAttributes, + &BeepDevice, + 0, + NULL, + NULL); + + Status = NtCreateFile(&hBeep, + FILE_READ_DATA | FILE_WRITE_DATA, + &ObjectAttributes, + &IoStatusBlock, + NULL, + 0, + FILE_SHARE_READ | FILE_SHARE_WRITE, + FILE_OPEN_IF, + 0, + NULL, + 0); + if (NT_SUCCESS(Status)) + { + /* Set beep data */ + BeepSetParameters.Frequency = dwFreq; + BeepSetParameters.Duration = dwDuration; + + Status = NtDeviceIoControlFile(hBeep, + NULL, + NULL, + NULL, + &IoStatusBlock, + IOCTL_BEEP_SET, + &BeepSetParameters, + sizeof(BEEP_SET_PARAMETERS), + NULL, + 0); + + /* do an alertable wait if necessary */ + if (NT_SUCCESS(Status) && + (dwFreq != 0x0 || dwDuration != 0x0) && dwDuration != MAXDWORD) + { + SleepEx(dwDuration, + TRUE); + } + + NtClose(hBeep); + } + } + else + Status = STATUS_INVALID_PARAMETER; + + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError (Status); + return FALSE; + } + + return TRUE; +} + /* * @implemented */ @@ -98,7 +177,7 @@ DeviceIoControl(IN HANDLE hDevice, if (!(NT_SUCCESS(Status)) || (Status == STATUS_PENDING)) { /* Fail */ - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } } @@ -154,7 +233,7 @@ DeviceIoControl(IN HANDLE hDevice, if (!NT_ERROR(Status)) *lpBytesReturned = Iosb.Information; /* Return a failure */ - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } } @@ -217,7 +296,7 @@ GetOverlappedResult(IN HANDLE hFile, if (!NT_SUCCESS(lpOverlapped->Internal)) { /* Set the error and fail */ - SetLastErrorByStatus(lpOverlapped->Internal); + BaseSetLastNTError(lpOverlapped->Internal); return FALSE; } diff --git a/dll/win32/kernel32/file/dir.c b/dll/win32/kernel32/client/file/dir.c similarity index 99% rename from dll/win32/kernel32/file/dir.c rename to dll/win32/kernel32/client/file/dir.c index 184403912f3..6ba996c345a 100644 --- a/dll/win32/kernel32/file/dir.c +++ b/dll/win32/kernel32/client/file/dir.c @@ -134,7 +134,7 @@ CreateDirectoryW ( if (!NT_SUCCESS(Status)) { WARN("NtCreateFile failed with Status %lx\n", Status); - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -481,7 +481,7 @@ CleanupNoNtPath: if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -556,7 +556,7 @@ RemoveDirectoryW ( if (!NT_SUCCESS(Status)) { WARN("Status 0x%08x\n", Status); - SetLastErrorByStatus (Status); + BaseSetLastNTError (Status); return FALSE; } @@ -571,7 +571,7 @@ RemoveDirectoryW ( if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus (Status); + BaseSetLastNTError (Status); return FALSE; } @@ -954,7 +954,7 @@ Cleanup: if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return 0; } diff --git a/dll/win32/kernel32/file/dosdev.c b/dll/win32/kernel32/client/file/dosdev.c similarity index 97% rename from dll/win32/kernel32/file/dosdev.c rename to dll/win32/kernel32/client/file/dosdev.c index c94adbcfc12..33ea76b6807 100644 --- a/dll/win32/kernel32/file/dosdev.c +++ b/dll/win32/kernel32/client/file/dosdev.c @@ -192,7 +192,7 @@ DefineDosDeviceW( { WARN("CsrClientCallServer() failed (Status %lx)\n", Status); - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); Result = FALSE; } else @@ -359,7 +359,7 @@ QueryDosDeviceW( if (!NT_SUCCESS (Status)) { WARN ("NtOpenDirectoryObject() failed (Status %lx)\n", Status); - SetLastErrorByStatus (Status); + BaseSetLastNTError (Status); return 0; } @@ -382,7 +382,7 @@ QueryDosDeviceW( { WARN ("NtOpenSymbolicLinkObject() failed (Status %lx)\n", Status); NtClose (DirectoryHandle); - SetLastErrorByStatus (Status); + BaseSetLastNTError (Status); return 0; } @@ -400,7 +400,7 @@ QueryDosDeviceW( if (!NT_SUCCESS (Status)) { WARN ("NtQuerySymbolicLinkObject() failed (Status %lx)\n", Status); - SetLastErrorByStatus (Status); + BaseSetLastNTError (Status); return 0; } @@ -418,7 +418,7 @@ QueryDosDeviceW( else { TRACE ("Buffer is too small\n"); - SetLastErrorByStatus (STATUS_BUFFER_TOO_SMALL); + BaseSetLastNTError (STATUS_BUFFER_TOO_SMALL); return 0; } } @@ -452,7 +452,7 @@ QueryDosDeviceW( { Length = 0; } - SetLastErrorByStatus (Status); + BaseSetLastNTError (Status); break; } @@ -464,7 +464,7 @@ QueryDosDeviceW( if (Length + NameLength + 1 >= ucchMax) { Length = 0; - SetLastErrorByStatus (STATUS_BUFFER_TOO_SMALL); + BaseSetLastNTError (STATUS_BUFFER_TOO_SMALL); break; } diff --git a/dll/win32/kernel32/file/file.c b/dll/win32/kernel32/client/file/file.c similarity index 91% rename from dll/win32/kernel32/file/file.c rename to dll/win32/kernel32/client/file/file.c index 7f0c0446441..2aa0dc134fb 100644 --- a/dll/win32/kernel32/file/file.c +++ b/dll/win32/kernel32/client/file/file.c @@ -50,7 +50,7 @@ FilenameA2W(LPCSTR NameA, BOOL alloc) if (Status== STATUS_BUFFER_OVERFLOW) SetLastError( ERROR_FILENAME_EXCED_RANGE ); else - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return NULL; } @@ -388,7 +388,7 @@ OpenFile(LPCSTR lpFileName, if (!NT_SUCCESS(errCode)) { - SetLastErrorByStatus (errCode); + BaseSetLastNTError (errCode); return (HFILE)INVALID_HANDLE_VALUE; } @@ -476,7 +476,7 @@ SetFilePointer(HANDLE hFile, { if (lpDistanceToMoveHigh != NULL) *lpDistanceToMoveHigh = -1; - SetLastErrorByStatus(errCode); + BaseSetLastNTError(errCode); return INVALID_SET_FILE_POINTER; } break; @@ -492,7 +492,7 @@ SetFilePointer(HANDLE hFile, { if (lpDistanceToMoveHigh != NULL) *lpDistanceToMoveHigh = -1; - SetLastErrorByStatus(errCode); + BaseSetLastNTError(errCode); return INVALID_SET_FILE_POINTER; } break; @@ -528,7 +528,7 @@ SetFilePointer(HANDLE hFile, if (lpDistanceToMoveHigh != NULL) *lpDistanceToMoveHigh = -1; - SetLastErrorByStatus(errCode); + BaseSetLastNTError(errCode); return INVALID_SET_FILE_POINTER; } @@ -612,7 +612,7 @@ SetFilePointerEx(HANDLE hFile, FilePositionInformation); if (!NT_SUCCESS(errCode)) { - SetLastErrorByStatus(errCode); + BaseSetLastNTError(errCode); return FALSE; } @@ -651,7 +651,7 @@ GetFileType(HANDLE hFile) FileFsDeviceInformation); if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FILE_TYPE_UNKNOWN; } @@ -704,7 +704,7 @@ GetFileSize(HANDLE hFile, FileStandardInformation); if (!NT_SUCCESS(errCode)) { - SetLastErrorByStatus(errCode); + BaseSetLastNTError(errCode); if ( lpFileSizeHigh == NULL ) { return -1; @@ -742,7 +742,7 @@ GetFileSizeEx( FileStandardInformation); if (!NT_SUCCESS(errCode)) { - SetLastErrorByStatus(errCode); + BaseSetLastNTError(errCode); return FALSE; } if (lpFileSize) @@ -801,7 +801,7 @@ GetCompressedFileSizeW(LPCWSTR lpFileName, if (!NT_SUCCESS(errCode)) { - SetLastErrorByStatus(errCode); + BaseSetLastNTError(errCode); return INVALID_FILE_SIZE; } @@ -846,7 +846,7 @@ GetFileInformationByHandle(HANDLE hFile, FileBasicInformation); if (!NT_SUCCESS(errCode)) { - SetLastErrorByStatus(errCode); + BaseSetLastNTError(errCode); return FALSE; } @@ -868,7 +868,7 @@ GetFileInformationByHandle(HANDLE hFile, FileInternalInformation); if (!NT_SUCCESS(errCode)) { - SetLastErrorByStatus(errCode); + BaseSetLastNTError(errCode); return FALSE; } @@ -882,7 +882,7 @@ GetFileInformationByHandle(HANDLE hFile, FileFsVolumeInformation); if (!NT_SUCCESS(errCode)) { - SetLastErrorByStatus(errCode); + BaseSetLastNTError(errCode); return FALSE; } @@ -895,7 +895,7 @@ GetFileInformationByHandle(HANDLE hFile, FileStandardInformation); if (!NT_SUCCESS(errCode)) { - SetLastErrorByStatus(errCode); + BaseSetLastNTError(errCode); return FALSE; } @@ -956,7 +956,7 @@ GetFileAttributesExW(LPCWSTR lpFileName, if (!NT_SUCCESS (Status)) { WARN ("NtQueryFullAttributesFile() failed (Status %lx)\n", Status); - SetLastErrorByStatus (Status); + BaseSetLastNTError (Status); return FALSE; } @@ -1058,7 +1058,7 @@ GetFileAttributesByHandle(IN HANDLE hFile, return TRUE; } - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -1101,7 +1101,7 @@ SetFileAttributesByHandle(IN HANDLE hFile, if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -1172,7 +1172,7 @@ SetFileAttributesW(LPCWSTR lpFileName, if (!NT_SUCCESS (Status)) { WARN ("NtOpenFile() failed (Status %lx)\n", Status); - SetLastErrorByStatus (Status); + BaseSetLastNTError (Status); return FALSE; } @@ -1185,7 +1185,7 @@ SetFileAttributesW(LPCWSTR lpFileName, { WARN ("SetFileAttributes NtQueryInformationFile failed with status 0x%08x\n", Status); NtClose (FileHandle); - SetLastErrorByStatus (Status); + BaseSetLastNTError (Status); return FALSE; } @@ -1199,7 +1199,7 @@ SetFileAttributesW(LPCWSTR lpFileName, if (!NT_SUCCESS(Status)) { WARN ("SetFileAttributes NtSetInformationFile failed with status 0x%08x\n", Status); - SetLastErrorByStatus (Status); + BaseSetLastNTError (Status); return FALSE; } @@ -1553,7 +1553,7 @@ SetEndOfFile(HANDLE hFile) ); if (!NT_SUCCESS(Status)){ - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -1576,7 +1576,7 @@ SetEndOfFile(HANDLE hFile) ); if (!NT_SUCCESS(Status)){ - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -1592,7 +1592,7 @@ SetEndOfFile(HANDLE hFile) ); if (!NT_SUCCESS(Status)){ - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -1626,7 +1626,7 @@ SetFileValidData( ); if (!NT_SUCCESS(Status)){ - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -1683,7 +1683,7 @@ SetFileShortNameW( RtlFreeHeap(RtlGetProcessHeap(), 0, FileNameInfo); if(!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -1803,7 +1803,7 @@ CheckNameLegalDOS8Dot3A( if(!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -1816,166 +1816,6 @@ CheckNameLegalDOS8Dot3A( return TRUE; } - -/* - * @implemented - */ -DWORD -WINAPI -GetFinalPathNameByHandleA(IN HANDLE hFile, - OUT LPSTR lpszFilePath, - IN DWORD cchFilePath, - IN DWORD dwFlags) -{ - WCHAR FilePathW[MAX_PATH]; - UNICODE_STRING FilePathU; - DWORD PrevLastError; - DWORD Ret = 0; - - if (cchFilePath != 0 && - cchFilePath > sizeof(FilePathW) / sizeof(FilePathW[0])) - { - FilePathU.Length = 0; - FilePathU.MaximumLength = (USHORT)cchFilePath * sizeof(WCHAR); - FilePathU.Buffer = RtlAllocateHeap(RtlGetProcessHeap(), - 0, - FilePathU.MaximumLength); - if (FilePathU.Buffer == NULL) - { - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - return 0; - } - } - else - { - FilePathU.Length = 0; - FilePathU.MaximumLength = sizeof(FilePathW); - FilePathU.Buffer = FilePathW; - } - - /* save the last error code */ - PrevLastError = GetLastError(); - SetLastError(ERROR_SUCCESS); - - /* call the unicode version that does all the work */ - Ret = GetFinalPathNameByHandleW(hFile, - FilePathU.Buffer, - cchFilePath, - dwFlags); - - if (GetLastError() == ERROR_SUCCESS) - { - /* no error, restore the last error code and convert the string */ - SetLastError(PrevLastError); - - Ret = FilenameU2A_FitOrFail(lpszFilePath, - cchFilePath, - &FilePathU); - } - - /* free allocated memory if necessary */ - if (FilePathU.Buffer != FilePathW) - { - RtlFreeHeap(RtlGetProcessHeap(), - 0, - FilePathU.Buffer); - } - - return Ret; -} - - -/* - * @unimplemented - */ -DWORD -WINAPI -GetFinalPathNameByHandleW(IN HANDLE hFile, - OUT LPWSTR lpszFilePath, - IN DWORD cchFilePath, - IN DWORD dwFlags) -{ - if (dwFlags & ~(VOLUME_NAME_DOS | VOLUME_NAME_GUID | VOLUME_NAME_NT | - VOLUME_NAME_NONE | FILE_NAME_NORMALIZED | FILE_NAME_OPENED)) - { - SetLastError(ERROR_INVALID_PARAMETER); - return 0; - } - - UNIMPLEMENTED; - return 0; -} - - -/* - * @unimplemented - */ -BOOL -WINAPI -SetFileBandwidthReservation(IN HANDLE hFile, - IN DWORD nPeriodMilliseconds, - IN DWORD nBytesPerPeriod, - IN BOOL bDiscardable, - OUT LPDWORD lpTransferSize, - OUT LPDWORD lpNumOutstandingRequests) -{ - UNIMPLEMENTED; - return FALSE; -} - - -/* - * @unimplemented - */ -BOOL -WINAPI -GetFileBandwidthReservation(IN HANDLE hFile, - OUT LPDWORD lpPeriodMilliseconds, - OUT LPDWORD lpBytesPerPeriod, - OUT LPBOOL pDiscardable, - OUT LPDWORD lpTransferSize, - OUT LPDWORD lpNumOutstandingRequests) -{ - UNIMPLEMENTED; - return FALSE; -} - - -/* - * @unimplemented - */ -BOOL -WINAPI -SetFileCompletionNotificationModes(IN HANDLE FileHandle, - IN UCHAR Flags) -{ - if (Flags & ~(FILE_SKIP_COMPLETION_PORT_ON_SUCCESS | FILE_SKIP_SET_EVENT_ON_HANDLE)) - { - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } - - UNIMPLEMENTED; - return FALSE; -} - - -/* - * @unimplemented - */ -HANDLE -WINAPI -OpenFileById(IN HANDLE hFile, - IN LPFILE_ID_DESCRIPTOR lpFileID, - IN DWORD dwDesiredAccess, - IN DWORD dwShareMode, - IN LPSECURITY_ATTRIBUTES lpSecurityAttributes OPTIONAL, - IN DWORD dwFlags) -{ - UNIMPLEMENTED; - return INVALID_HANDLE_VALUE; -} - /* * @implemented */ @@ -2180,4 +2020,143 @@ Cleanup: return Ret; } +/* + * @implemented + */ +BOOL +WINAPI +ReadFileScatter(HANDLE hFile, + FILE_SEGMENT_ELEMENT aSegmentArray[], + DWORD nNumberOfBytesToRead, + LPDWORD lpReserved, + LPOVERLAPPED lpOverlapped) +{ + PIO_STATUS_BLOCK pIOStatus; + LARGE_INTEGER Offset; + NTSTATUS Status; + + DPRINT("(%p %p %u %p)\n", hFile, aSegmentArray, nNumberOfBytesToRead, lpOverlapped); + + Offset.LowPart = lpOverlapped->Offset; + Offset.HighPart = lpOverlapped->OffsetHigh; + pIOStatus = (PIO_STATUS_BLOCK) lpOverlapped; + pIOStatus->Status = STATUS_PENDING; + pIOStatus->Information = 0; + + Status = NtReadFileScatter(hFile, + NULL, + NULL, + NULL, + pIOStatus, + aSegmentArray, + nNumberOfBytesToRead, + &Offset, + NULL); + + if (!NT_SUCCESS(Status)) + { + SetLastError(RtlNtStatusToDosError(Status)); + return FALSE; + } + + return TRUE; +} + +/* + * @implemented + */ +BOOL +WINAPI +WriteFileGather(HANDLE hFile, + FILE_SEGMENT_ELEMENT aSegmentArray[], + DWORD nNumberOfBytesToWrite, + LPDWORD lpReserved, + LPOVERLAPPED lpOverlapped) +{ + PIO_STATUS_BLOCK IOStatus; + LARGE_INTEGER Offset; + NTSTATUS Status; + + DPRINT("%p %p %u %p\n", hFile, aSegmentArray, nNumberOfBytesToWrite, lpOverlapped); + + Offset.LowPart = lpOverlapped->Offset; + Offset.HighPart = lpOverlapped->OffsetHigh; + IOStatus = (PIO_STATUS_BLOCK) lpOverlapped; + IOStatus->Status = STATUS_PENDING; + IOStatus->Information = 0; + + Status = NtWriteFileGather(hFile, + NULL, + NULL, + NULL, + IOStatus, + aSegmentArray, + nNumberOfBytesToWrite, + &Offset, + NULL); + + if (!NT_SUCCESS(Status)) + { + SetLastError(RtlNtStatusToDosError(Status)); + return FALSE; + } + + return TRUE; +} + +BOOL +WINAPI +OpenDataFile(HANDLE hFile, DWORD dwUnused) +{ + STUB; + return FALSE; +} + +BOOL +WINAPI +PrivMoveFileIdentityW(DWORD Unknown1, DWORD Unknown2, DWORD Unknown3) +{ + STUB; + return FALSE; +} + +/* + * @unimplemented + */ +HANDLE +WINAPI +ReOpenFile(IN HANDLE hOriginalFile, + IN DWORD dwDesiredAccess, + IN DWORD dwShareMode, + IN DWORD dwFlags) +{ + STUB; + return INVALID_HANDLE_VALUE; +} + +BOOLEAN +WINAPI +Wow64EnableWow64FsRedirection (BOOLEAN Wow64EnableWow64FsRedirection) +{ + STUB; + return FALSE; +} + +BOOL +WINAPI +Wow64DisableWow64FsRedirection (VOID ** pv) +{ + STUB; + return FALSE; +} + +BOOL +WINAPI +Wow64RevertWow64FsRedirection (VOID * pv) +{ + STUB; + return FALSE; +} + + /* EOF */ diff --git a/dll/win32/kernel32/mem/section.c b/dll/win32/kernel32/client/file/filemap.c similarity index 88% rename from dll/win32/kernel32/mem/section.c rename to dll/win32/kernel32/client/file/filemap.c index 705a8c360de..46882e0ca72 100644 --- a/dll/win32/kernel32/mem/section.c +++ b/dll/win32/kernel32/client/file/filemap.c @@ -27,38 +27,14 @@ CreateFileMappingA(IN HANDLE hFile, IN DWORD dwMaximumSizeLow, IN LPCSTR lpName) { - NTSTATUS Status; - ANSI_STRING AnsiName; - PUNICODE_STRING UnicodeCache; - LPCWSTR UnicodeName = NULL; - - /* Check for a name */ - if (lpName) - { - /* Use TEB Cache */ - UnicodeCache = &NtCurrentTeb()->StaticUnicodeString; - - /* Convert to unicode */ - RtlInitAnsiString(&AnsiName, lpName); - Status = RtlAnsiStringToUnicodeString(UnicodeCache, &AnsiName, FALSE); - if (!NT_SUCCESS(Status)) - { - /* Conversion failed */ - SetLastErrorByStatus(Status); - return NULL; - } - - /* Otherwise, save the buffer */ - UnicodeName = (LPCWSTR)UnicodeCache->Buffer; - } - - /* Call the Unicode version */ - return CreateFileMappingW(hFile, - lpFileMappingAttributes, - flProtect, - dwMaximumSizeHigh, - dwMaximumSizeLow, - UnicodeName); + /* Call the W(ide) function */ + ConvertWin32AnsiObjectApiToUnicodeApi(FileMapping, + lpName, + hFile, + lpFileMappingAttributes, + flProtect, + dwMaximumSizeHigh, + dwMaximumSizeLow); } /* @@ -148,7 +124,7 @@ CreateFileMappingW(HANDLE hFile, if (!NT_SUCCESS(Status)) { /* We failed */ - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return NULL; } @@ -215,7 +191,7 @@ MapViewOfFileEx(HANDLE hFileMappingObject, if (!NT_SUCCESS(Status)) { /* We failed */ - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return NULL; } @@ -257,7 +233,7 @@ UnmapViewOfFile(LPCVOID lpBaseAddress) if (!NT_SUCCESS(Status)) { /* We failed */ - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -290,7 +266,7 @@ OpenFileMappingA(DWORD dwDesiredAccess, if (!NT_SUCCESS(Status)) { /* Conversion failed */ - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return NULL; } } @@ -347,7 +323,7 @@ OpenFileMappingW(DWORD dwDesiredAccess, if (!NT_SUCCESS(Status)) { /* We failed */ - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return NULL; } @@ -379,7 +355,7 @@ FlushViewOfFile(LPCVOID lpBaseAddress, if (!NT_SUCCESS(Status)) { /* We failed */ - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } diff --git a/dll/win32/kernel32/file/find.c b/dll/win32/kernel32/client/file/find.c similarity index 95% rename from dll/win32/kernel32/file/find.c rename to dll/win32/kernel32/client/file/find.c index 0060e662889..e726ecaa30f 100644 --- a/dll/win32/kernel32/file/find.c +++ b/dll/win32/kernel32/client/file/find.c @@ -226,7 +226,7 @@ NeedMoreData: if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus (Status); + BaseSetLastNTError (Status); return FALSE; } else if (FoundFile == NULL) @@ -259,7 +259,7 @@ InternalFindFirstFile ( PWSTR NtPathBuffer; BOOLEAN RemovedLastChar = FALSE; BOOL bResult; - CURDIR DirInfo; + RTL_RELATIVE_NAME_U DirInfo; ULONG DeviceNameInfo; HANDLE hDirectory = NULL; @@ -292,20 +292,20 @@ InternalFindFirstFile ( } PathFileName.MaximumLength = PathFileName.Length; - if (DirInfo.DosPath.Length != 0 && DirInfo.DosPath.Buffer != PathFileName.Buffer) + if (DirInfo.RelativeName.Length != 0 && DirInfo.RelativeName.Buffer != PathFileName.Buffer) { if (PathFileName.Buffer != NULL) { - /* This is a relative path to DirInfo.Handle, adjust NtPathU! */ + /* This is a relative path to DirInfo.ContainingDirectory, adjust NtPathU! */ NtPathU.Length = NtPathU.MaximumLength = - (USHORT)((ULONG_PTR)PathFileName.Buffer - (ULONG_PTR)DirInfo.DosPath.Buffer); - NtPathU.Buffer = DirInfo.DosPath.Buffer; + (USHORT)((ULONG_PTR)PathFileName.Buffer - (ULONG_PTR)DirInfo.RelativeName.Buffer); + NtPathU.Buffer = DirInfo.RelativeName.Buffer; } } else { /* This is an absolute path, NtPathU receives the full path */ - DirInfo.Handle = NULL; + DirInfo.ContainingDirectory = NULL; if (PathFileName.Buffer != NULL) { NtPathU.Length = NtPathU.MaximumLength = @@ -332,12 +332,12 @@ InternalFindFirstFile ( TRACE("lpFileName: \"%ws\"\n", lpFileName); TRACE("NtPathU: \"%wZ\"\n", &NtPathU); TRACE("PathFileName: \"%wZ\"\n", &PathFileName); - TRACE("RelativeTo: 0x%p\n", DirInfo.Handle); + TRACE("RelativeTo: 0x%p\n", DirInfo.ContainingDirectory); InitializeObjectAttributes (&ObjectAttributes, &NtPathU, OBJ_CASE_INSENSITIVE, - DirInfo.Handle, + DirInfo.ContainingDirectory, NULL); Status = NtOpenFile (&hDirectory, @@ -364,7 +364,7 @@ InternalFindFirstFile ( if (!NT_SUCCESS(Status)) { - RtlFreeHeap (hProcessHeap, + RtlFreeHeap (RtlGetProcessHeap(), 0, NtPathBuffer); @@ -379,7 +379,7 @@ InternalFindFirstFile ( return FIND_DEVICE_HANDLE; } - SetLastErrorByStatus (Status); + BaseSetLastNTError (Status); return INVALID_HANDLE_VALUE; } @@ -387,20 +387,20 @@ InternalFindFirstFile ( { /* No file part?! */ NtClose(hDirectory); - RtlFreeHeap (hProcessHeap, + RtlFreeHeap (RtlGetProcessHeap(), 0, NtPathBuffer); SetLastError(ERROR_FILE_NOT_FOUND); return INVALID_HANDLE_VALUE; } - IHeader = RtlAllocateHeap (hProcessHeap, + IHeader = RtlAllocateHeap (RtlGetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(KERNEL32_FIND_DATA_HEADER) + sizeof(KERNEL32_FIND_FILE_DATA) + FIND_DATA_SIZE); if (NULL == IHeader) { - RtlFreeHeap (hProcessHeap, + RtlFreeHeap (RtlGetProcessHeap(), 0, NtPathBuffer); NtClose(hDirectory); @@ -431,7 +431,7 @@ InternalFindFirstFile ( &PathFileName, lpFindFileData); - RtlFreeHeap (hProcessHeap, + RtlFreeHeap (RtlGetProcessHeap(), 0, NtPathBuffer); @@ -596,7 +596,7 @@ FindClose ( PKERNEL32_FIND_STREAM_DATA IData = (PKERNEL32_FIND_STREAM_DATA)(IHeader + 1); if (IData->pFileStreamInfo != NULL) { - RtlFreeHeap (hProcessHeap, 0, IData->pFileStreamInfo); + RtlFreeHeap (RtlGetProcessHeap(), 0, IData->pFileStreamInfo); } break; } @@ -606,7 +606,7 @@ FindClose ( return FALSE; } - RtlFreeHeap (hProcessHeap, 0, IHeader); + RtlFreeHeap (RtlGetProcessHeap(), 0, IHeader); return TRUE; } @@ -835,7 +835,7 @@ FindFirstStreamW(IN LPCWSTR lpFileName, } /* create the search context */ - IHeader = RtlAllocateHeap(hProcessHeap, + IHeader = RtlAllocateHeap(RtlGetProcessHeap(), 0, sizeof(KERNEL32_FIND_DATA_HEADER) + sizeof(KERNEL32_FIND_STREAM_DATA)); @@ -859,7 +859,7 @@ FindFirstStreamW(IN LPCWSTR lpFileName, if (IData->pFileStreamInfo == NULL) { - IData->pFileStreamInfo = RtlAllocateHeap(hProcessHeap, + IData->pFileStreamInfo = RtlAllocateHeap(RtlGetProcessHeap(), 0, BufferSize); if (IData->pFileStreamInfo == NULL) @@ -872,7 +872,7 @@ FindFirstStreamW(IN LPCWSTR lpFileName, { PFILE_STREAM_INFORMATION pfsi; - pfsi = RtlReAllocateHeap(hProcessHeap, + pfsi = RtlReAllocateHeap(RtlGetProcessHeap(), 0, IData->pFileStreamInfo, BufferSize); @@ -923,17 +923,17 @@ Cleanup: { if (IData->pFileStreamInfo != NULL) { - RtlFreeHeap(hProcessHeap, + RtlFreeHeap(RtlGetProcessHeap(), 0, IData->pFileStreamInfo); } - RtlFreeHeap(hProcessHeap, + RtlFreeHeap(RtlGetProcessHeap(), 0, IHeader); } - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return INVALID_HANDLE_VALUE; } diff --git a/dll/win32/kernel32/file/hardlink.c b/dll/win32/kernel32/client/file/hardlink.c similarity index 97% rename from dll/win32/kernel32/file/hardlink.c rename to dll/win32/kernel32/client/file/hardlink.c index 004d5b8735b..91e2a6ac674 100644 --- a/dll/win32/kernel32/file/hardlink.c +++ b/dll/win32/kernel32/client/file/hardlink.c @@ -125,7 +125,7 @@ CreateHardLinkW(LPCWSTR lpFileName, } else { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); } RtlFreeHeap(RtlGetProcessHeap(), 0, LinkInformation); @@ -144,7 +144,7 @@ CreateHardLinkW(LPCWSTR lpFileName, else { WARN("Unable to open link destination \"%wZ\"!\n", &LinkTarget); - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); } } else @@ -157,7 +157,7 @@ CreateHardLinkW(LPCWSTR lpFileName, } else { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); } } else diff --git a/dll/win32/kernel32/file/iocompl.c b/dll/win32/kernel32/client/file/iocompl.c similarity index 81% rename from dll/win32/kernel32/file/iocompl.c rename to dll/win32/kernel32/client/file/iocompl.c index 56eef2c0ad8..462d2a26cbb 100644 --- a/dll/win32/kernel32/file/iocompl.c +++ b/dll/win32/kernel32/client/file/iocompl.c @@ -54,7 +54,7 @@ CreateIoCompletionPort( if (!NT_SUCCESS(errCode) ) { - SetLastErrorByStatus (errCode); + BaseSetLastNTError (errCode); return FALSE; } @@ -78,7 +78,7 @@ CreateIoCompletionPort( NtClose(CompletionPort); } - SetLastErrorByStatus (errCode); + BaseSetLastNTError (errCode); return FALSE; } } @@ -103,28 +103,27 @@ GetQueuedCompletionStatus( NTSTATUS errCode; IO_STATUS_BLOCK IoStatus; ULONG_PTR CompletionKey; - LARGE_INTEGER Interval; + LARGE_INTEGER Time; + PLARGE_INTEGER TimePtr; if (!lpNumberOfBytesTransferred || !lpCompletionKey || !lpOverlapped) { SetLastError(ERROR_INVALID_PARAMETER); return FALSE; } - - if (dwMilliseconds != INFINITE) - { - Interval.QuadPart = (-(MILLIS_TO_100NS(dwMilliseconds))); - } + + /* Convert the timeout */ + TimePtr = BaseFormatTimeOut(&Time, dwMilliseconds); errCode = NtRemoveIoCompletion(CompletionHandle, (PVOID*)&CompletionKey, (PVOID*)lpOverlapped, &IoStatus, - dwMilliseconds == INFINITE ? NULL : &Interval); + TimePtr); if (!NT_SUCCESS(errCode) || errCode == STATUS_TIMEOUT) { *lpOverlapped = NULL; - SetLastErrorByStatus(errCode); + BaseSetLastNTError(errCode); return FALSE; } @@ -133,7 +132,7 @@ GetQueuedCompletionStatus( if (!NT_SUCCESS(IoStatus.Status)){ //failed io operation - SetLastErrorByStatus(IoStatus.Status); + BaseSetLastNTError(IoStatus.Status); return FALSE; } @@ -163,7 +162,7 @@ PostQueuedCompletionStatus( if ( !NT_SUCCESS(errCode) ) { - SetLastErrorByStatus (errCode); + BaseSetLastNTError (errCode); return FALSE; } return TRUE; @@ -183,7 +182,7 @@ CancelIo(HANDLE hFile) &IoStatusBlock); if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return(FALSE); } @@ -192,27 +191,29 @@ CancelIo(HANDLE hFile) /* - * @unimplemented + * @implemented */ BOOL WINAPI -CancelIoEx(IN HANDLE hFile, - IN LPOVERLAPPED lpOverlapped) +BindIoCompletionCallback(HANDLE FileHandle, + LPOVERLAPPED_COMPLETION_ROUTINE Function, + ULONG Flags) { - UNIMPLEMENTED; - return FALSE; -} + NTSTATUS Status = 0; + DPRINT("(%p, %p, %d)\n", FileHandle, Function, Flags); -/* - * @unimplemented - */ -BOOL -WINAPI -CancelSynchronousIo(IN HANDLE hThread) -{ - UNIMPLEMENTED; - return FALSE; + Status = RtlSetIoCompletionCallback(FileHandle, + (PIO_APC_ROUTINE)Function, + Flags); + + if (!NT_SUCCESS(Status)) + { + SetLastError(RtlNtStatusToDosError(Status)); + return FALSE; + } + + return TRUE; } /* EOF */ diff --git a/dll/win32/kernel32/file/lfile.c b/dll/win32/kernel32/client/file/lfile.c similarity index 100% rename from dll/win32/kernel32/file/lfile.c rename to dll/win32/kernel32/client/file/lfile.c diff --git a/dll/win32/kernel32/file/lock.c b/dll/win32/kernel32/client/file/lock.c similarity index 98% rename from dll/win32/kernel32/file/lock.c rename to dll/win32/kernel32/client/file/lock.c index a18425ad174..df3a6f2c125 100644 --- a/dll/win32/kernel32/file/lock.c +++ b/dll/win32/kernel32/client/file/lock.c @@ -108,7 +108,7 @@ LockFileEx(HANDLE hFile, if ( !NT_SUCCESS(errCode) ) { - SetLastErrorByStatus(errCode); + BaseSetLastNTError(errCode); return FALSE; } @@ -180,7 +180,7 @@ UnlockFileEx(HANDLE hFile, if ( !NT_SUCCESS(errCode) ) { - SetLastErrorByStatus(errCode); + BaseSetLastNTError(errCode); return FALSE; } diff --git a/dll/win32/kernel32/file/mailslot.c b/dll/win32/kernel32/client/file/mailslot.c similarity index 98% rename from dll/win32/kernel32/file/mailslot.c rename to dll/win32/kernel32/client/file/mailslot.c index 6dceaf9e2a0..d0895e5dfbe 100644 --- a/dll/win32/kernel32/file/mailslot.c +++ b/dll/win32/kernel32/client/file/mailslot.c @@ -121,7 +121,7 @@ CreateMailslotW(LPCWSTR lpName, if (!NT_SUCCESS(Status)) { WARN("NtCreateMailslot failed (Status %x)!\n", Status); - SetLastErrorByStatus (Status); + BaseSetLastNTError (Status); return(INVALID_HANDLE_VALUE); } @@ -151,7 +151,7 @@ GetMailslotInfo(HANDLE hMailslot, if (!NT_SUCCESS(Status)) { WARN("NtQueryInformationFile failed (Status %x)!\n", Status); - SetLastErrorByStatus (Status); + BaseSetLastNTError (Status); return(FALSE); } @@ -213,7 +213,7 @@ SetMailslotInfo(HANDLE hMailslot, if (!NT_SUCCESS(Status)) { WARN("NtSetInformationFile failed (Status %x)!\n", Status); - SetLastErrorByStatus (Status); + BaseSetLastNTError (Status); return(FALSE); } diff --git a/dll/win32/kernel32/file/move.c b/dll/win32/kernel32/client/file/move.c similarity index 100% rename from dll/win32/kernel32/file/move.c rename to dll/win32/kernel32/client/file/move.c diff --git a/dll/win32/kernel32/file/npipe.c b/dll/win32/kernel32/client/file/npipe.c similarity index 95% rename from dll/win32/kernel32/file/npipe.c rename to dll/win32/kernel32/client/file/npipe.c index 8915fb18052..35410a19972 100644 --- a/dll/win32/kernel32/file/npipe.c +++ b/dll/win32/kernel32/client/file/npipe.c @@ -32,22 +32,16 @@ CreateNamedPipeA(LPCSTR lpName, DWORD nDefaultTimeOut, LPSECURITY_ATTRIBUTES lpSecurityAttributes) { - PUNICODE_STRING NameU = &NtCurrentTeb()->StaticUnicodeString; - ANSI_STRING NameA; - - /* Initialize the string as ANSI_STRING and convert to Unicode */ - RtlInitAnsiString(&NameA, (LPSTR)lpName); - RtlAnsiStringToUnicodeString(NameU, &NameA, FALSE); - - /* Call the Unicode API */ - return CreateNamedPipeW(NameU->Buffer, - dwOpenMode, - dwPipeMode, - nMaxInstances, - nOutBufferSize, - nInBufferSize, - nDefaultTimeOut, - lpSecurityAttributes); + /* Call the W(ide) function */ + ConvertWin32AnsiChangeApiToUnicodeApi(CreateNamedPipe, + lpName, + dwOpenMode, + dwPipeMode, + nMaxInstances, + nOutBufferSize, + nInBufferSize, + nDefaultTimeOut, + lpSecurityAttributes); } @@ -230,7 +224,7 @@ CreateNamedPipeW(LPCWSTR lpName, { /* Failed to create it */ WARN("NtCreateNamedPipe failed (Status %x)!\n", Status); - SetLastErrorByStatus (Status); + BaseSetLastNTError (Status); return INVALID_HANDLE_VALUE; } @@ -350,7 +344,7 @@ WaitNamedPipeW(LPCWSTR lpNamedPipeName, { /* The name is invalid */ WARN("Invalid name!\n"); - SetLastErrorByStatus(STATUS_OBJECT_PATH_SYNTAX_BAD); + BaseSetLastNTError(STATUS_OBJECT_PATH_SYNTAX_BAD); return FALSE; } @@ -359,7 +353,7 @@ WaitNamedPipeW(LPCWSTR lpNamedPipeName, else { WARN("Invalid path type\n"); - SetLastErrorByStatus(STATUS_OBJECT_PATH_SYNTAX_BAD); + BaseSetLastNTError(STATUS_OBJECT_PATH_SYNTAX_BAD); return FALSE; } @@ -392,7 +386,7 @@ WaitNamedPipeW(LPCWSTR lpNamedPipeName, { /* Fail; couldn't open */ WARN("Status: %lx\n", Status); - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); RtlFreeUnicodeString(&NamedPipeName); RtlFreeHeap(RtlGetProcessHeap(), 0, WaitPipeInfo); return FALSE; @@ -451,7 +445,7 @@ WaitNamedPipeW(LPCWSTR lpNamedPipeName, { /* Failure to wait on the pipe */ WARN("Status: %lx\n", Status); - SetLastErrorByStatus (Status); + BaseSetLastNTError (Status); return FALSE; } @@ -495,7 +489,7 @@ WaitNamedPipeW(LPCWSTR lpNamedPipeName, FILE_SYNCHRONOUS_IO_NONALERT); if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); RtlFreeUnicodeString(&NamedPipeName); return FALSE; } @@ -538,7 +532,7 @@ WaitNamedPipeW(LPCWSTR lpNamedPipeName, NtClose(FileHandle); if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); RtlFreeUnicodeString(&NamedPipeName); return FALSE; } @@ -580,7 +574,7 @@ ConnectNamedPipe(IN HANDLE hNamedPipe, /* return FALSE in case of failure and pending operations! */ if (!NT_SUCCESS(Status) || Status == STATUS_PENDING) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } } @@ -613,7 +607,7 @@ ConnectNamedPipe(IN HANDLE hNamedPipe, if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } } @@ -656,7 +650,7 @@ SetNamedPipeHandleState(HANDLE hNamedPipe, FilePipeInformation); if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } } @@ -676,7 +670,7 @@ SetNamedPipeHandleState(HANDLE hNamedPipe, FilePipeRemoteInformation); if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } } @@ -700,7 +694,7 @@ SetNamedPipeHandleState(HANDLE hNamedPipe, FilePipeRemoteInformation); if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } } @@ -843,7 +837,7 @@ DisconnectNamedPipe(HANDLE hNamedPipe) if (!NT_SUCCESS(Status)) { /* Fail */ - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -878,7 +872,7 @@ GetNamedPipeHandleStateW(HANDLE hNamedPipe, FilePipeInformation); if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -897,7 +891,7 @@ GetNamedPipeHandleStateW(HANDLE hNamedPipe, FilePipeLocalInformation); if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -915,7 +909,7 @@ GetNamedPipeHandleStateW(HANDLE hNamedPipe, FilePipeRemoteInformation); if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -989,7 +983,7 @@ GetNamedPipeHandleStateA(HANDLE hNamedPipe, Status = RtlUnicodeStringToAnsiString(&UserNameA, &UserNameW, FALSE); if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); Ret = FALSE; } } @@ -1025,7 +1019,7 @@ GetNamedPipeInfo(HANDLE hNamedPipe, FilePipeLocalInformation); if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -1108,7 +1102,7 @@ PeekNamedPipe(HANDLE hNamedPipe, { /* Free the buffer and return failure */ RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer); - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -1189,7 +1183,7 @@ TransactNamedPipe(IN HANDLE hNamedPipe, nOutBufferSize); if (!NT_SUCCESS(Status) || Status == STATUS_PENDING) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -1231,7 +1225,7 @@ TransactNamedPipe(IN HANDLE hNamedPipe, } else { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } #else /* Workaround while FSCTL_PIPE_TRANSCEIVE not available */ diff --git a/dll/win32/kernel32/file/pipe.c b/dll/win32/kernel32/client/file/pipe.c similarity index 98% rename from dll/win32/kernel32/file/pipe.c rename to dll/win32/kernel32/client/file/pipe.c index 21f709d08b5..c4539f70573 100644 --- a/dll/win32/kernel32/file/pipe.c +++ b/dll/win32/kernel32/client/file/pipe.c @@ -98,7 +98,7 @@ CreatePipe(PHANDLE hReadPipe, { /* Convert error and fail */ WARN("Status: %lx\n", Status); - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -114,7 +114,7 @@ CreatePipe(PHANDLE hReadPipe, /* Convert error and fail */ WARN("Status: %lx\n", Status); NtClose(ReadPipeHandle); - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } diff --git a/dll/win32/kernel32/file/rw.c b/dll/win32/kernel32/client/file/rw.c similarity index 97% rename from dll/win32/kernel32/file/rw.c rename to dll/win32/kernel32/client/file/rw.c index 13e15da3463..b5da581edf2 100644 --- a/dll/win32/kernel32/file/rw.c +++ b/dll/win32/kernel32/client/file/rw.c @@ -71,7 +71,7 @@ WriteFile(IN HANDLE hFile, /* return FALSE in case of failure and pending operations! */ if (!NT_SUCCESS(Status) || Status == STATUS_PENDING) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -115,7 +115,7 @@ WriteFile(IN HANDLE hFile, } else { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } } @@ -200,7 +200,7 @@ ReadFile(IN HANDLE hFile, *lpNumberOfBytesRead = 0; } - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -253,7 +253,7 @@ ReadFile(IN HANDLE hFile, } else { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } } @@ -307,7 +307,7 @@ WriteFileEx(IN HANDLE hFile, if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -344,7 +344,7 @@ ReadFileEx(IN HANDLE hFile, if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } diff --git a/dll/win32/kernel32/file/tape.c b/dll/win32/kernel32/client/file/tape.c similarity index 100% rename from dll/win32/kernel32/file/tape.c rename to dll/win32/kernel32/client/file/tape.c diff --git a/dll/win32/kernel32/file/volume.c b/dll/win32/kernel32/client/file/volume.c similarity index 89% rename from dll/win32/kernel32/file/volume.c rename to dll/win32/kernel32/client/file/volume.c index 0e336661a6b..5323b1cef8e 100644 --- a/dll/win32/kernel32/file/volume.c +++ b/dll/win32/kernel32/client/file/volume.c @@ -71,7 +71,7 @@ InternalOpenDirW(LPCWSTR DirName, if (!NT_SUCCESS(errCode)) { - SetLastErrorByStatus (errCode); + BaseSetLastNTError (errCode); return INVALID_HANDLE_VALUE; } return hFile; @@ -174,7 +174,7 @@ GetLogicalDrives(VOID) /* Return the Drive Map */ if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return 0; } @@ -253,7 +253,7 @@ GetDiskFreeSpaceW( if (!NT_SUCCESS(errCode)) { CloseHandle(hFile); - SetLastErrorByStatus (errCode); + BaseSetLastNTError (errCode); return FALSE; } @@ -382,7 +382,7 @@ GetDiskFreeSpaceExW( if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus (Status); + BaseSetLastNTError (Status); return FALSE; } @@ -452,7 +452,7 @@ GetDriveTypeW(LPCWSTR lpRootPathName) if (!NT_SUCCESS(errCode)) { CloseHandle(hFile); - SetLastErrorByStatus (errCode); + BaseSetLastNTError (errCode); return 0; } CloseHandle(hFile); @@ -676,7 +676,7 @@ GetVolumeInformationW( { WARN("Status: %x\n", errCode); CloseHandle(hFile); - SetLastErrorByStatus (errCode); + BaseSetLastNTError (errCode); return FALSE; } @@ -709,7 +709,7 @@ GetVolumeInformationW( if (!NT_SUCCESS(errCode)) { WARN("Status: %x\n", errCode); - SetLastErrorByStatus (errCode); + BaseSetLastNTError (errCode); return FALSE; } @@ -827,7 +827,7 @@ SetVolumeLabelW( { WARN("Status: %x\n", Status); CloseHandle(hFile); - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -910,7 +910,7 @@ GetVolumeNameForVolumeMountPointW( RtlFreeUnicodeString(&NtFileName); if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -939,7 +939,7 @@ GetVolumeNameForVolumeMountPointW( else { NtClose(FileHandle); - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } } @@ -973,7 +973,7 @@ GetVolumeNameForVolumeMountPointW( FILE_SYNCHRONOUS_IO_NONALERT); if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); RtlFreeHeap(RtlGetProcessHeap(), 0, MountPoint); return FALSE; } @@ -1007,7 +1007,7 @@ GetVolumeNameForVolumeMountPointW( RtlFreeHeap(RtlGetProcessHeap(), 0, MountPoint); RtlFreeHeap(RtlGetProcessHeap(), 0, MountPoints); NtClose(FileHandle); - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } } @@ -1330,4 +1330,229 @@ Cleanup2: return Result; } + +/* + * @unimplemented + */ +BOOL +WINAPI +SetVolumeMountPointW( + LPCWSTR lpszVolumeMountPoint, + LPCWSTR lpszVolumeName + ) +{ + STUB; + return 0; +} + +/* + * @unimplemented + */ +BOOL +WINAPI +DeleteVolumeMountPointA( + LPCSTR lpszVolumeMountPoint + ) +{ + STUB; + return 0; +} + +/* + * @unimplemented + */ +HANDLE +WINAPI +FindFirstVolumeMountPointA( + LPCSTR lpszRootPathName, + LPSTR lpszVolumeMountPoint, + DWORD cchBufferLength + ) +{ + STUB; + return 0; +} + +/* + * @implemented + */ +BOOL +WINAPI +FindNextVolumeA(HANDLE handle, + LPSTR volume, + DWORD len) +{ + WCHAR *buffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, len * sizeof(WCHAR)); + BOOL ret; + + if (!buffer) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } + + if ((ret = FindNextVolumeW( handle, buffer, len ))) + { + if (!WideCharToMultiByte( CP_ACP, 0, buffer, -1, volume, len, NULL, NULL )) ret = FALSE; + } + + HeapFree( GetProcessHeap(), 0, buffer ); + return ret; +} + +/* + * @unimplemented + */ +BOOL +WINAPI +FindNextVolumeMountPointA( + HANDLE hFindVolumeMountPoint, + LPSTR lpszVolumeMountPoint, + DWORD cchBufferLength + ) +{ + STUB; + return 0; +} + +/* + * @unimplemented + */ +BOOL +WINAPI +GetVolumePathNamesForVolumeNameA( + LPCSTR lpszVolumeName, + LPSTR lpszVolumePathNames, + DWORD cchBufferLength, + PDWORD lpcchReturnLength + ) +{ + STUB; + return 0; +} + +/* + * @unimplemented + */ +BOOL +WINAPI +SetVolumeMountPointA( + LPCSTR lpszVolumeMountPoint, + LPCSTR lpszVolumeName + ) +{ + STUB; + return 0; +} + +/* + * @unimplemented + */ +BOOL +WINAPI +FindVolumeMountPointClose( + HANDLE hFindVolumeMountPoint + ) +{ + STUB; + return 0; +} + +/* + * @unimplemented + */ +BOOL +WINAPI +DeleteVolumeMountPointW( + LPCWSTR lpszVolumeMountPoint + ) +{ + STUB; + return 0; +} + +/* + * @unimplemented + */ +HANDLE +WINAPI +FindFirstVolumeMountPointW( + LPCWSTR lpszRootPathName, + LPWSTR lpszVolumeMountPoint, + DWORD cchBufferLength + ) +{ + STUB; + return 0; +} + +/* + * @implemented + */ +BOOL +WINAPI +FindNextVolumeW( + HANDLE handle, + LPWSTR volume, + DWORD len + ) +{ + MOUNTMGR_MOUNT_POINTS *data = handle; + + while (data->Size < data->NumberOfMountPoints) + { + static const WCHAR volumeW[] = {'\\','?','?','\\','V','o','l','u','m','e','{',}; + WCHAR *link = (WCHAR *)((char *)data + data->MountPoints[data->Size].SymbolicLinkNameOffset); + DWORD size = data->MountPoints[data->Size].SymbolicLinkNameLength; + data->Size++; + /* skip non-volumes */ + if (size < sizeof(volumeW) || memcmp( link, volumeW, sizeof(volumeW) )) continue; + if (size + sizeof(WCHAR) >= len * sizeof(WCHAR)) + { + SetLastError( ERROR_FILENAME_EXCED_RANGE ); + return FALSE; + } + memcpy( volume, link, size ); + volume[1] = '\\'; /* map \??\ to \\?\ */ + volume[size / sizeof(WCHAR)] = '\\'; /* Windows appends a backslash */ + volume[size / sizeof(WCHAR) + 1] = 0; + DPRINT( "returning entry %u %s\n", data->Size - 1, volume ); + return TRUE; + } + SetLastError( ERROR_NO_MORE_FILES ); + return FALSE; +} + +/* + * @unimplemented + */ +BOOL +WINAPI +FindNextVolumeMountPointW( + HANDLE hFindVolumeMountPoint, + LPWSTR lpszVolumeMountPoint, + DWORD cchBufferLength + ) +{ + STUB; + return 0; +} + +/* + * @unimplemented + */ +BOOL +WINAPI +GetVolumePathNamesForVolumeNameW( + LPCWSTR lpszVolumeName, + LPWSTR lpszVolumePathNames, + DWORD cchBufferLength, + PDWORD lpcchReturnLength + ) +{ + STUB; + return 0; +} + + /* EOF */ diff --git a/dll/win32/kernel32/client/handle.c b/dll/win32/kernel32/client/handle.c new file mode 100644 index 00000000000..8c18a87be31 --- /dev/null +++ b/dll/win32/kernel32/client/handle.c @@ -0,0 +1,256 @@ +/* + * PROJECT: ReactOS Win32 Base API + * LICENSE: See COPYING in the top level directory + * FILE: dll/win32/kernel32/client/handle.c + * PURPOSE: Object Handle Functions + * PROGRAMMERS: Ariadne ( ariadne@xs4all.nl) + */ + +/* INCLUDES *******************************************************************/ + +#include + +#define NDEBUG +#include + +/* PRIVATE FUNCTIONS **********************************************************/ + +HANDLE +FASTCALL +TranslateStdHandle(IN HANDLE hHandle) +{ + PRTL_USER_PROCESS_PARAMETERS Ppb = NtCurrentPeb()->ProcessParameters; + + switch ((ULONG)hHandle) + { + case STD_INPUT_HANDLE: return Ppb->StandardInput; + case STD_OUTPUT_HANDLE: return Ppb->StandardOutput; + case STD_ERROR_HANDLE: return Ppb->StandardError; + } + + return hHandle; +} + +/* PUBLIC FUNCTIONS ***********************************************************/ + +/* + * @implemented + */ +BOOL +WINAPI +GetHandleInformation(IN HANDLE hObject, + OUT LPDWORD lpdwFlags) +{ + OBJECT_HANDLE_ATTRIBUTE_INFORMATION HandleInfo; + ULONG BytesWritten; + NTSTATUS Status; + DWORD Flags; + + hObject = TranslateStdHandle(hObject); + + if (IsConsoleHandle(hObject)) + { + /* FIXME: GetConsoleHandleInformation required */ + UNIMPLEMENTED; + BaseSetLastNTError(STATUS_NOT_IMPLEMENTED); + return FALSE; + } + + Status = NtQueryObject(hObject, + ObjectHandleFlagInformation, + &HandleInfo, + sizeof(OBJECT_HANDLE_ATTRIBUTE_INFORMATION), + &BytesWritten); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + Flags = 0; + if (HandleInfo.Inherit) Flags |= HANDLE_FLAG_INHERIT; + if (HandleInfo.ProtectFromClose) Flags |= HANDLE_FLAG_PROTECT_FROM_CLOSE; + *lpdwFlags = Flags; + return TRUE; +} + +/* + * @implemented + */ +BOOL +WINAPI +SetHandleInformation(IN HANDLE hObject, + IN DWORD dwMask, + IN DWORD dwFlags) +{ + OBJECT_HANDLE_ATTRIBUTE_INFORMATION HandleInfo; + ULONG BytesWritten; + NTSTATUS Status; + + hObject = TranslateStdHandle(hObject); + + if (IsConsoleHandle(hObject)) + { + /* FIXME: SetConsoleHandleInformation required */ + UNIMPLEMENTED; + BaseSetLastNTError(STATUS_NOT_IMPLEMENTED); + return FALSE; + } + + Status = NtQueryObject(hObject, + ObjectHandleFlagInformation, + &HandleInfo, + sizeof(OBJECT_HANDLE_ATTRIBUTE_INFORMATION), + &BytesWritten); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + if (dwMask & HANDLE_FLAG_INHERIT) + { + HandleInfo.Inherit = (dwFlags & HANDLE_FLAG_INHERIT) != 0; + } + + if (dwMask & HANDLE_FLAG_PROTECT_FROM_CLOSE) + { + HandleInfo.ProtectFromClose = (dwFlags & HANDLE_FLAG_PROTECT_FROM_CLOSE) != 0; + } + + Status = NtSetInformationObject(hObject, + ObjectHandleFlagInformation, + &HandleInfo, + sizeof(HandleInfo)); + if (NT_SUCCESS(Status)) return TRUE; + + BaseSetLastNTError(Status); + return FALSE; +} + +/* + * @implemented + */ +BOOL +WINAPI +CloseHandle(IN HANDLE hObject) +{ + NTSTATUS Status; + + hObject = TranslateStdHandle(hObject); + + if (IsConsoleHandle(hObject)) return CloseConsoleHandle(hObject); + + Status = NtClose(hObject); + if (NT_SUCCESS(Status)) return TRUE; + + BaseSetLastNTError(Status); + return FALSE; +} + +/* + * @implemented + */ +BOOL +WINAPI +DuplicateHandle(IN HANDLE hSourceProcessHandle, + IN HANDLE hSourceHandle, + IN HANDLE hTargetProcessHandle, + OUT LPHANDLE lpTargetHandle, + IN DWORD dwDesiredAccess, + IN BOOL bInheritHandle, + IN DWORD dwOptions) +{ + NTSTATUS Status; + HANDLE hTargetHandle; + + hSourceHandle = TranslateStdHandle(hSourceHandle); + + if ((IsConsoleHandle(hSourceHandle)) && + ((hSourceHandle != NtCurrentProcess()) && + (hSourceHandle != NtCurrentThread()))) + { + if ((hSourceProcessHandle != NtCurrentProcess()) && + (hTargetProcessHandle != NtCurrentProcess())) + { + BaseSetLastNTError(STATUS_INVALID_PARAMETER); + return FALSE; + } + + hTargetHandle = DuplicateConsoleHandle(hSourceHandle, + dwDesiredAccess, + bInheritHandle, + dwOptions); + if (hTargetHandle != INVALID_HANDLE_VALUE) + { + if (lpTargetHandle) *lpTargetHandle = hTargetHandle; + return TRUE; + } + + return FALSE; + } + + Status = NtDuplicateObject(hSourceProcessHandle, + hSourceHandle, + hTargetProcessHandle, + lpTargetHandle, + dwDesiredAccess, + bInheritHandle ? OBJ_INHERIT : 0, + dwOptions); + if (NT_SUCCESS(Status)) return TRUE; + + BaseSetLastNTError(Status); + return FALSE; +} + +/* + * @implemented + */ +UINT +WINAPI +SetHandleCount(IN UINT nCount) +{ + return nCount; +} + +/* + * @implemented + */ +DWORD +WINAPI +GetHandleContext(IN HANDLE Handle) +{ + /* This is Windows behavior, not a ReactOS Stub */ + DbgPrintEx(0, 0, "Unsupported API - kernel32!GetHandleContext() called\n"); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +/* + * @implemented + */ +HANDLE +WINAPI +CreateSocketHandle(VOID) +{ + /* This is Windows behavior, not a ReactOS Stub */ + DbgPrintEx(0, 0, "Unsupported API - kernel32!CreateSocketHandle() called\n"); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +/* + * @implemented + */ +BOOL +WINAPI +SetHandleContext(IN HANDLE Handle, + IN DWORD Context) +{ + /* This is Windows behavior, not a ReactOS Stub */ + DbgPrintEx(0, 0, "Unsupported API - kernel32!SetHandleContext() called\n"); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +/* EOF */ diff --git a/dll/win32/kernel32/client/heapmem.c b/dll/win32/kernel32/client/heapmem.c new file mode 100644 index 00000000000..58aa0599d1a --- /dev/null +++ b/dll/win32/kernel32/client/heapmem.c @@ -0,0 +1,1840 @@ +/* + * PROJECT: ReactOS Win32 Base API + * LICENSE: GPL - See COPYING in the top level directory + * FILE: dll/win32/kernel32/mem/heap.c + * PURPOSE: Heap Memory APIs (wrappers for RtlHeap*) + * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org) + */ + +/* INCLUDES *******************************************************************/ + +#include + +#define NDEBUG +#include + +/* GLOBALS ********************************************************************/ + +RTL_HANDLE_TABLE BaseHeapHandleTable; +HANDLE BaseHeap; +ULONG_PTR SystemRangeStart; + +/* PRIVATE FUNCTIONS **********************************************************/ + +VOID +NTAPI +BaseDllInitializeMemoryManager(VOID) +{ + BaseHeap = RtlGetProcessHeap(); + RtlInitializeHandleTable(0xFFFF, + sizeof(BASE_HEAP_HANDLE_ENTRY), + &BaseHeapHandleTable); + NtQuerySystemInformation(SystemRangeStartInformation, + &SystemRangeStart, + sizeof(SystemRangeStart), + NULL); +} + +/* PUBLIC FUNCTIONS ***********************************************************/ + +/* + * @implemented + */ +HANDLE +WINAPI +HeapCreate(DWORD flOptions, + DWORD dwInitialSize, + DWORD dwMaximumSize) +{ + HANDLE hRet; + ULONG Flags; + + /* Remove non-Win32 flags and tag this allocation */ + Flags = (flOptions & (HEAP_GENERATE_EXCEPTIONS | HEAP_NO_SERIALIZE)) | + HEAP_CLASS_1; + + /* Check if heap is growable and ensure max size is correct */ + if (dwMaximumSize == 0) + Flags |= HEAP_GROWABLE; + else if (dwMaximumSize < BaseStaticServerData->SysInfo.PageSize && + dwInitialSize > dwMaximumSize) + { + /* Max size is non-zero but less than page size which can't be correct. + Fix it up by bumping it to the initial size whatever it is. */ + dwMaximumSize = dwInitialSize; + } + + /* Call RTL Heap */ + hRet = RtlCreateHeap(Flags, + NULL, + dwMaximumSize, + dwInitialSize, + NULL, + NULL); + + /* Set the last error if we failed, and return the pointer */ + if (!hRet) SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return hRet; +} + +/* + * @implemented + */ +BOOL +WINAPI +HeapDestroy(HANDLE hHeap) +{ + /* Return TRUE if the heap was destroyed */ + if (!RtlDestroyHeap(hHeap)) return TRUE; + + /* Otherwise, we got the handle back, so fail */ + SetLastError(ERROR_INVALID_HANDLE); + return FALSE; +} + +/* + * @implemented + */ +HANDLE +WINAPI +GetProcessHeap(VOID) +{ + /* Call the RTL API */ + return RtlGetProcessHeap(); +} + +/* + * @implemented + */ +DWORD +WINAPI +GetProcessHeaps(DWORD NumberOfHeaps, + PHANDLE ProcessHeaps) +{ + /* Call the RTL API */ + return RtlGetProcessHeaps(NumberOfHeaps, ProcessHeaps); +} + +/* + * @implemented + */ +BOOL +WINAPI +HeapLock(HANDLE hHeap) +{ + /* Call the RTL API */ + return RtlLockHeap(hHeap); +} + +/* + * @implemented + */ +BOOL +WINAPI +HeapUnlock(HANDLE hHeap) +{ + /* Call the RTL API */ + return RtlUnlockHeap(hHeap); +} + +/* + * @implemented + */ +SIZE_T +WINAPI +HeapCompact(HANDLE hHeap, DWORD dwFlags) +{ + /* Call the RTL API */ + return RtlCompactHeap(hHeap, dwFlags); +} + +/* + * @implemented + */ +BOOL +WINAPI +HeapValidate(HANDLE hHeap, + DWORD dwFlags, + LPCVOID lpMem) +{ + /* Call the RTL API */ + return RtlValidateHeap(hHeap, dwFlags, (PVOID)lpMem); +} + +/* + * @implemented + */ +DWORD +WINAPI +HeapCreateTagsW(HANDLE hHeap, + DWORD dwFlags, + PWSTR lpTagName, + PWSTR lpTagSubName) +{ + /* Call the RTL API */ + return RtlCreateTagHeap(hHeap, + dwFlags, + lpTagName, + lpTagSubName); +} + +/* + * @implemented + */ +DWORD +WINAPI +HeapExtend(HANDLE hHeap, + DWORD dwFlags, + PVOID BaseAddress, + DWORD dwBytes) +{ + NTSTATUS Status; + + /* Call the RTL API. Gone in Vista, so commented out. */ + Status = STATUS_NOT_IMPLEMENTED; //RtlExtendHeap(hHeap, dwFlags, BaseAddress, dwBytes); + if (!NT_SUCCESS(Status)) + { + /* We failed */ + BaseSetLastNTError(Status); + return FALSE; + } + + /* Return success */ + return TRUE; +} + +/* + * @implemented + */ +PWSTR +WINAPI +HeapQueryTagW(HANDLE hHeap, + DWORD dwFlags, + WORD wTagIndex, + BOOL bResetCounters, + PVOID lpTagInfo) +{ + /* Call the RTL API */ + return RtlQueryTagHeap(hHeap, + dwFlags, + wTagIndex, + (BOOLEAN)bResetCounters, + lpTagInfo); +} + +/* + * @implemented + */ +BOOL +WINAPI +HeapSummary(HANDLE hHeap, + DWORD dwFlags, + PVOID Summary) +{ + NTSTATUS Status; + RTL_HEAP_USAGE Usage; + + /* Fill in the length information */ + Usage.Length = sizeof(Usage); + + /* Call RTL. Gone in Vista, so commented out */ + Status = STATUS_NOT_IMPLEMENTED; //RtlUsageHeap(hHeap, dwFlags, &Usage); + if (!NT_SUCCESS(Status)) + { + /* We failed */ + BaseSetLastNTError(Status); + return FALSE; + } + + /* FIXME: Summary == Usage?! */ + RtlCopyMemory(Summary, &Usage, sizeof(Usage)); + return TRUE; +} + +/* + * @implemented + */ +BOOL +WINAPI +HeapUsage(HANDLE hHeap, + DWORD dwFlags, + DWORD Unknown, + DWORD Unknown2, + IN PVOID Usage) +{ + NTSTATUS Status; + + /* Call RTL. Gone in Vista, so commented out */ + Status = STATUS_NOT_IMPLEMENTED; //RtlUsageHeap(hHeap, dwFlags, &Usage); + if (!NT_SUCCESS(Status)) + { + /* We failed */ + BaseSetLastNTError(Status); + return FALSE; + } + else if (Status == STATUS_MORE_ENTRIES) + { + /* There are still more entries to parse */ + return TRUE; + } + + /* Otherwise, we're completely done, so we return FALSE, but NO_ERROR */ + SetLastError(NO_ERROR); + return FALSE; +} + +/* + * @implemented + */ +BOOL +WINAPI +HeapWalk(HANDLE hHeap, + LPPROCESS_HEAP_ENTRY lpEntry) +{ + NTSTATUS Status; + + DPRINT1("Warning, HeapWalk is calling RtlWalkHeap with Win32 parameters\n"); + + Status = RtlWalkHeap(hHeap, lpEntry); + + if (!NT_SUCCESS(Status)) + { + SetLastError(RtlNtStatusToDosError(Status)); + return FALSE; + } + + return TRUE; +} + +/* + * @implemented + */ +BOOL +WINAPI +HeapQueryInformation(HANDLE HeapHandle, + HEAP_INFORMATION_CLASS HeapInformationClass, + PVOID HeapInformation OPTIONAL, + SIZE_T HeapInformationLength OPTIONAL, + PSIZE_T ReturnLength OPTIONAL) +{ + NTSTATUS Status; + + Status = RtlQueryHeapInformation(HeapHandle, + HeapInformationClass, + HeapInformation, + HeapInformationLength, + ReturnLength); + + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + return TRUE; +} + +/* + * @implemented + */ +BOOL +WINAPI +HeapSetInformation(HANDLE HeapHandle, + HEAP_INFORMATION_CLASS HeapInformationClass, + PVOID HeapInformation OPTIONAL, + SIZE_T HeapInformationLength OPTIONAL) +{ + NTSTATUS Status; + + Status = RtlSetHeapInformation(HeapHandle, + HeapInformationClass, + HeapInformation, + HeapInformationLength); + + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + return TRUE; +} + +/* + * @implemented + */ +HGLOBAL +NTAPI +GlobalAlloc(UINT uFlags, + DWORD dwBytes) +{ + ULONG Flags = 0; + PVOID Ptr = NULL; + HANDLE hMemory; + PBASE_HEAP_HANDLE_ENTRY HandleEntry; + BASE_TRACE_ALLOC(dwBytes, uFlags); + ASSERT(BaseHeap); + + /* Make sure the flags are valid */ + if (uFlags & ~GMEM_VALID_FLAGS) + { + /* They aren't, fail */ + BASE_TRACE_FAILURE(); + SetLastError(ERROR_INVALID_PARAMETER); + return NULL; + } + + /* Convert ZEROINIT */ + if (uFlags & GMEM_ZEROINIT) Flags |= HEAP_ZERO_MEMORY; + + /* Check if we're not movable, which means pointer-based heap */ + if (!(uFlags & GMEM_MOVEABLE)) + { + /* Check if this is DDESHARE (deprecated) */ + if (uFlags & GMEM_DDESHARE) Flags |= BASE_HEAP_ENTRY_FLAG_DDESHARE; + + /* Allocate heap for it */ + Ptr = RtlAllocateHeap(BaseHeap, Flags, dwBytes ? dwBytes : 1); + if (!Ptr) SetLastError(ERROR_NOT_ENOUGH_MEMORY); + BASE_TRACE_ALLOC2(Ptr); + return Ptr; + } + + /* This is heap based, so lock it in first */ + RtlLockHeap(BaseHeap); + + /* + * Disable locking, enable custom flags, and write the + * movable flag (deprecated) + */ + Flags |= HEAP_NO_SERIALIZE | + HEAP_SETTABLE_USER_VALUE | + BASE_HEAP_FLAG_MOVABLE; + + /* Allocate the handle */ + HandleEntry = BaseHeapAllocEntry(); + if (!HandleEntry) + { + /* Fail */ + hMemory = NULL; + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + BASE_TRACE_FAILURE(); + } + else + { + /* Get the object and make sure we have size */ + hMemory = &HandleEntry->Object; + if (dwBytes) + { + /* Allocate the actual memory for it */ + Ptr = RtlAllocateHeap(BaseHeap, Flags, dwBytes); + BASE_TRACE_PTR(HandleEntry, Ptr); + if (!Ptr) + { + /* We failed, manually set the allocate flag and free the handle */ + HandleEntry->Flags = RTL_HANDLE_VALID; + BaseHeapFreeEntry(HandleEntry); + + /* For the cleanup case */ + HandleEntry = NULL; + } + else + { + /* All worked well, save our heap entry */ + RtlSetUserValueHeap(BaseHeap, HEAP_NO_SERIALIZE, Ptr, hMemory); + } + } + } + + /* Cleanup! First unlock the heap */ + RtlUnlockHeap(BaseHeap); + + /* Check if a handle was allocated */ + if (HandleEntry) + { + /* Set the pointer and allocated flag */ + HandleEntry->Object = Ptr; + HandleEntry->Flags = RTL_HANDLE_VALID; + if (!Ptr) + { + /* We don't have a valid pointer, but so reuse this handle */ + HandleEntry->Flags |= BASE_HEAP_ENTRY_FLAG_REUSE; + } + + /* Check if the handle is discardable */ + if (uFlags & GMEM_DISCARDABLE) + { + /* Save it in the handle entry */ + HandleEntry->Flags |= BASE_HEAP_ENTRY_FLAG_REUSABLE; + } + + /* Check if the handle is moveable */ + if (uFlags & GMEM_MOVEABLE) + { + /* Save it in the handle entry */ + HandleEntry->Flags |= BASE_HEAP_ENTRY_FLAG_MOVABLE; + } + + /* Check if the handle is DDE Shared */ + if (uFlags & GMEM_DDESHARE) + { + /* Save it in the handle entry */ + HandleEntry->Flags |= BASE_HEAP_ENTRY_FLAG_DDESHARE; + } + + /* Set the pointer */ + Ptr = hMemory; + } + + /* Return the pointer */ + return Ptr; +} + +/* + * @implemented + */ +SIZE_T +NTAPI +GlobalCompact(DWORD dwMinFree) +{ + /* Call the RTL Heap Manager */ + return RtlCompactHeap(BaseHeap, 0); +} + +/* + * @implemented + */ +VOID +NTAPI +GlobalFix(HGLOBAL hMem) +{ + /* Lock the memory if it the handle is valid */ + if (INVALID_HANDLE_VALUE != hMem) GlobalLock(hMem); +} + +/* + * @implemented + */ +UINT +NTAPI +GlobalFlags(HGLOBAL hMem) +{ + PBASE_HEAP_HANDLE_ENTRY HandleEntry; + HANDLE Handle = NULL; + ULONG Flags = 0; + UINT uFlags = GMEM_INVALID_HANDLE; + + /* Start by locking the heap */ + RtlLockHeap(BaseHeap); + _SEH2_TRY + { + /* Check if this is a simple RTL Heap Managed block */ + if (!((ULONG_PTR)hMem & BASE_HEAP_IS_HANDLE_ENTRY)) + { + /* Then we'll query RTL Heap */ + RtlGetUserInfoHeap(BaseHeap, Flags, hMem, &Handle, &Flags); + BASE_TRACE_PTR(Handle, hMem); + + /* + * Check if RTL Heap didn't find a handle associated with us or + * said that this heap isn't movable, which means something we're + * really not a handle-based heap. + */ + if (!(Handle) || !(Flags & BASE_HEAP_FLAG_MOVABLE)) + { + /* Then set the flags to 0 */ + uFlags = 0; + } + else + { + /* Otherwise we're handle-based, so get the internal handle */ + hMem = Handle; + } + } + + /* Check if the handle is actually an entry in our table */ + if ((ULONG_PTR)hMem & BASE_HEAP_IS_HANDLE_ENTRY) + { + /* Then get the entry */ + HandleEntry = BaseHeapGetEntry(hMem); + BASE_TRACE_HANDLE(HandleEntry, hMem); + + /* Make sure it's a valid handle */ + if (BaseHeapValidateEntry(HandleEntry)) + { + /* Get the lock count first */ + uFlags = HandleEntry->LockCount & GMEM_LOCKCOUNT; + + /* Now check if it's discardable */ + if (HandleEntry->Flags & BASE_HEAP_ENTRY_FLAG_REUSABLE) + { + /* Set the Win32 Flag */ + uFlags |= GMEM_DISCARDABLE; + } + + /* Check if it's DDE Shared */ + if (HandleEntry->Flags & BASE_HEAP_ENTRY_FLAG_DDESHARE) + { + /* Set the Win32 Flag */ + uFlags |= GMEM_DDESHARE; + } + + /* Now check if it's discarded */ + if (HandleEntry->Flags & BASE_HEAP_ENTRY_FLAG_REUSE) + { + /* Set the Win32 Flag */ + uFlags |= GMEM_DISCARDED; + } + } + } + + /* Check if by now, we still haven't gotten any useful flags */ + if (uFlags == GMEM_INVALID_HANDLE) SetLastError(ERROR_INVALID_HANDLE); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + /* Set the exception code */ + BaseSetLastNTError(_SEH2_GetExceptionCode()); + } + _SEH2_END; + + /* All done! Unlock heap and return Win32 Flags */ + RtlUnlockHeap(BaseHeap); + return uFlags; +} + +/* + * @implemented + */ +HGLOBAL +NTAPI +GlobalFree(HGLOBAL hMem) +{ + PBASE_HEAP_HANDLE_ENTRY HandleEntry; + LPVOID Ptr; + BASE_TRACE_DEALLOC(hMem); + + /* Check if this was a simple allocated heap entry */ + if (!((ULONG_PTR)hMem & BASE_HEAP_IS_HANDLE_ENTRY)) + { + /* Free it with the RTL Heap Manager */ + if (RtlFreeHeap(BaseHeap, 0, hMem)) + { + /* Return NULL since there's no handle */ + return NULL; + } + else + { + /* Otherwise fail */ + BASE_TRACE_FAILURE(); + SetLastError(ERROR_INVALID_HANDLE); + return hMem; + } + } + + /* It's a handle probably, so lock the heap */ + RtlLockHeap(BaseHeap); + _SEH2_TRY + { + /* Make sure that this is an entry in our handle database */ + if ((ULONG_PTR)hMem & BASE_HEAP_IS_HANDLE_ENTRY) + { + /* Get the entry */ + HandleEntry = BaseHeapGetEntry(hMem); + BASE_TRACE_HANDLE(HandleEntry, hMem); + + /* Make sure the handle is valid */ + if (!BaseHeapValidateEntry(HandleEntry)) + { + /* It's not, fail */ + SetLastError(ERROR_INVALID_HANDLE); + Ptr = NULL; + } + else + { + /* It's valid, so get the pointer */ + Ptr = HandleEntry->Object; + + /* Free this handle */ + BaseHeapFreeEntry(HandleEntry); + + /* If the pointer is 0, then we don't have a handle either */ + if (!Ptr) hMem = NULL; + } + } + else + { + /* Otherwise, reuse the handle as a pointer */ + BASE_TRACE_FAILURE(); + Ptr = hMem; + } + + /* Check if we got here with a valid heap pointer */ + if (Ptr) + { + /* Free it with the RTL Heap Manager */ + if (RtlFreeHeap(BaseHeap, HEAP_NO_SERIALIZE, Ptr)) + { + /* Everything worked */ + hMem = NULL; + } + else + { + /* This wasn't a real heap handle */ + SetLastError(ERROR_INVALID_HANDLE); + } + } + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + /* Set the exception code */ + BaseSetLastNTError(_SEH2_GetExceptionCode()); + } + _SEH2_END; + + /* We're done, so unlock the heap and return the handle */ + RtlUnlockHeap(BaseHeap); + return hMem; +} + +/* + * @implemented + */ +HGLOBAL +NTAPI +GlobalHandle(LPCVOID pMem) +{ + HANDLE Handle = NULL; + ULONG Flags; + + /* Lock the heap */ + RtlLockHeap(BaseHeap); + _SEH2_TRY + { + /* Query RTL Heap */ + if (!RtlGetUserInfoHeap(BaseHeap, + HEAP_NO_SERIALIZE, + (PVOID)pMem, + &Handle, + &Flags)) + { + /* RTL Heap Manager does not know about this heap */ + SetLastError(ERROR_INVALID_HANDLE); + } + else + { + /* + * Check if RTL Heap didn't find a handle for us or said that + * this heap isn't movable. + */ + BASE_TRACE_PTR(Handle, pMem); + if (!(Handle) || !(Flags & BASE_HEAP_FLAG_MOVABLE)) + { + /* We're actually handle-based, so the pointer is a handle */ + Handle = (HANDLE)pMem; + } + } + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + /* Set the exception code */ + BaseSetLastNTError(_SEH2_GetExceptionCode()); + } + _SEH2_END; + + /* All done, unlock the heap and return the handle */ + RtlUnlockHeap(BaseHeap); + return Handle; +} + +/* + * @implemented + */ +LPVOID +NTAPI +GlobalLock(HGLOBAL hMem) +{ + PBASE_HEAP_HANDLE_ENTRY HandleEntry; + LPVOID Ptr; + + /* Check if this was a simple allocated heap entry */ + if (!((ULONG_PTR)hMem & BASE_HEAP_IS_HANDLE_ENTRY)) + { + /* Make sure it's not a kernel or invalid address */ + if ((hMem >= (HGLOBAL)SystemRangeStart) || (IsBadReadPtr(hMem, 1))) + { + /* Signal an error */ + SetLastError(ERROR_INVALID_HANDLE); + return NULL; + } + + /* It's all good */ + return hMem; + } + + /* Otherwise, lock the heap */ + RtlLockHeap(BaseHeap); + _SEH2_TRY + { + /* Get the handle entry */ + HandleEntry = BaseHeapGetEntry(hMem); + BASE_TRACE_HANDLE(HandleEntry, hMem); + + /* Make sure it's valid */ + if (!BaseHeapValidateEntry(HandleEntry)) + { + /* It's not, fail */ + BASE_TRACE_FAILURE(); + SetLastError(ERROR_INVALID_HANDLE); + Ptr = NULL; + } + else + { + /* Otherwise, get the pointer */ + Ptr = HandleEntry->Object; + if (Ptr) + { + /* Increase the lock count, unless we've went too far */ + if (HandleEntry->LockCount++ == GMEM_LOCKCOUNT) + { + /* In which case we simply unlock once */ + HandleEntry->LockCount--; + } + } + else + { + /* The handle is still there but the memory was already freed */ + SetLastError(ERROR_DISCARDED); + } + } + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + SetLastError(ERROR_INVALID_HANDLE); + Ptr = NULL; + } + _SEH2_END; + + /* All done. Unlock the heap and return the pointer */ + RtlUnlockHeap(BaseHeap); + return Ptr; +} + +HGLOBAL +NTAPI +GlobalReAlloc(HGLOBAL hMem, + DWORD dwBytes, + UINT uFlags) +{ + PBASE_HEAP_HANDLE_ENTRY HandleEntry; + HANDLE Handle; + LPVOID Ptr; + ULONG Flags = 0; + + /* Throw out invalid flags */ + if (uFlags & ~(GMEM_VALID_FLAGS | GMEM_MODIFY)) + { + SetLastError(ERROR_INVALID_PARAMETER); + return NULL; + } + + /* Throw out invalid combo */ + if ((uFlags & GMEM_DISCARDABLE) && !(uFlags & GMEM_MODIFY)) + { + SetLastError(ERROR_INVALID_PARAMETER); + return NULL; + } + + /* Convert ZEROINIT */ + if (uFlags & GMEM_ZEROINIT) Flags |= HEAP_ZERO_MEMORY; + + /* If this wasn't a movable heap, then we MUST re-alloc in place */ + if (!(uFlags & GMEM_MOVEABLE)) Flags |= HEAP_REALLOC_IN_PLACE_ONLY; + + /* Lock the heap and disable built-in locking in the RTL Heap funcitons */ + RtlLockHeap(BaseHeap); + Flags |= HEAP_NO_SERIALIZE; + + /* Check if this is a simple handle-based block */ + if (((ULONG_PTR)hMem & BASE_HEAP_IS_HANDLE_ENTRY)) + { + /* Get the entry */ + HandleEntry = BaseHeapGetEntry(hMem); + BASE_TRACE_HANDLE(HandleEntry, hMem); + + /* Make sure the handle is valid */ + if (!BaseHeapValidateEntry(HandleEntry)) + { + /* Fail */ + BASE_TRACE_FAILURE(); + SetLastError(ERROR_INVALID_HANDLE); + hMem = NULL; + } + else if (uFlags & GMEM_MODIFY) + { + /* User is changing flags... check if the memory was discardable */ + if (uFlags & GMEM_DISCARDABLE) + { + /* Then set the flag */ + HandleEntry->Flags |= BASE_HEAP_ENTRY_FLAG_REUSABLE; + } + else + { + /* Otherwise, remove the flag */ + HandleEntry->Flags &= BASE_HEAP_ENTRY_FLAG_REUSABLE; + } + } + else + { + /* Otherwise, get the object and check if we have no size */ + Ptr = HandleEntry->Object; + if (!dwBytes) + { + /* Clear the handle and check for a pointer */ + hMem = NULL; + if (Ptr) + { + /* Make sure the handle isn't locked */ + if ((uFlags & GMEM_MOVEABLE) && !(HandleEntry->LockCount)) + { + /* Free the current heap */ + if (RtlFreeHeap(BaseHeap, Flags, Ptr)) + { + /* Free the handle */ + HandleEntry->Object = NULL; + HandleEntry->Flags |= BASE_HEAP_ENTRY_FLAG_REUSE; + + /* Get the object pointer */ + hMem = &HandleEntry->Object; + } + } + } + else + { + /* Otherwise just return the object pointer */ + hMem = &HandleEntry->Object; + } + } + else + { + /* Otherwise, we're allocating, so set the new flags needed */ + Flags |= HEAP_SETTABLE_USER_VALUE | BASE_HEAP_FLAG_MOVABLE; + if (!Ptr) + { + /* We don't have a base, so allocate one */ + Ptr = RtlAllocateHeap(BaseHeap, Flags, dwBytes); + BASE_TRACE_ALLOC2(Ptr); + if (Ptr) + { + /* Allocation succeeded, so save our entry */ + RtlSetUserValueHeap(BaseHeap, + HEAP_NO_SERIALIZE, + Ptr, + hMem); + } + } + else + { + /* + * If it's not movable or currently locked, we MUST allocate + * in-place! + */ + if (!(uFlags & GMEM_MOVEABLE) && (HandleEntry->LockCount)) + { + /* Set the flag */ + Flags |= HEAP_REALLOC_IN_PLACE_ONLY; + } + else + { + /* Otherwise clear the flag if we set it previously */ + Flags &= ~HEAP_REALLOC_IN_PLACE_ONLY; + } + + /* Do the re-allocation. No need to save the entry again */ + Ptr = RtlReAllocateHeap(BaseHeap, Flags, Ptr, dwBytes); + } + + /* Make sure we have a pointer by now */ + if (Ptr) + { + /* Write it in the handle entry and mark it in use */ + HandleEntry->Object = Ptr; + HandleEntry->Flags &= ~BASE_HEAP_ENTRY_FLAG_REUSE; + } + else + { + /* Otherwise we failed */ + hMem = NULL; + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + } + } + } + } + else if (uFlags & GMEM_MODIFY) + { + /* This is not a handle-based heap and the caller wants it to be one */ + if (uFlags & GMEM_MOVEABLE) + { + /* Get information on its current state */ + Handle = hMem; + if (RtlGetUserInfoHeap(BaseHeap, + HEAP_NO_SERIALIZE, + hMem, + &Handle, + NULL)) + { + /* + * Check if the handle matches the pointer or the moveable flag + * isn't there, which is what we expect since it currenly isn't. + */ + if ((Handle == hMem) || !(Flags & BASE_HEAP_FLAG_MOVABLE)) + { + /* Allocate a handle for it */ + HandleEntry = BaseHeapAllocEntry(); + if (!HandleEntry) + { + /* No entry could be allocated */ + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + RtlUnlockHeap(BaseHeap); + return NULL; + } + + /* Calculate the size of the current heap */ + dwBytes = RtlSizeHeap(BaseHeap, HEAP_NO_SERIALIZE, hMem); + + /* Set the movable flag */ + Flags |= HEAP_SETTABLE_USER_VALUE | BASE_HEAP_FLAG_MOVABLE; + + /* Now allocate the actual heap for it */ + HandleEntry->Object = RtlAllocateHeap(BaseHeap, + Flags, + dwBytes); + BASE_TRACE_PTR(HandleEntry->Object, HandleEntry); + if (!HandleEntry->Object) + { + /* + * We failed, manually set the allocate flag and + * free the handle + */ + HandleEntry->Flags = RTL_HANDLE_VALID; + BaseHeapFreeEntry(HandleEntry); + + /* For the cleanup case */ + BASE_TRACE_FAILURE(); + HandleEntry = NULL; + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + } + else + { + /* Otherwise, copy the new heap and free the old one */ + RtlMoveMemory(HandleEntry->Object, hMem, dwBytes); + RtlFreeHeap(BaseHeap, HEAP_NO_SERIALIZE, hMem); + + /* Select the heap pointer */ + hMem = (HANDLE)&HandleEntry->Object; + + /* Initialize the count and default flags */ + HandleEntry->LockCount = 0; + HandleEntry->Flags = RTL_HANDLE_VALID | + BASE_HEAP_ENTRY_FLAG_MOVABLE; + + /* Check if it's also discardable */ + if (uFlags & GMEM_DISCARDABLE) + { + /* Set the internal flag */ + HandleEntry->Flags |= BASE_HEAP_ENTRY_FLAG_REUSABLE; + } + + /* Check if it's also DDE Shared */ + if (uFlags & GMEM_DDESHARE) + { + /* Set the internal flag */ + HandleEntry->Flags |= BASE_HEAP_ENTRY_FLAG_DDESHARE; + } + + /* Allocation succeeded, so save our entry */ + RtlSetUserValueHeap(BaseHeap, + HEAP_NO_SERIALIZE, + HandleEntry->Object, + hMem); + } + } + } + } + } + else + { + /* Otherwise, this is a simple RTL Managed Heap, so just call it */ + hMem = RtlReAllocateHeap(BaseHeap, + Flags | HEAP_NO_SERIALIZE, + hMem, + dwBytes); + if (!hMem) + { + /* Fail */ + BASE_TRACE_FAILURE(); + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + } + } + + /* All done, unlock the heap and return the pointer */ + RtlUnlockHeap(BaseHeap); + return hMem; +} + +/* + * @implemented + */ +DWORD +NTAPI +GlobalSize(HGLOBAL hMem) +{ + PBASE_HEAP_HANDLE_ENTRY HandleEntry; + PVOID Handle = NULL; + ULONG Flags = 0; + SIZE_T dwSize = MAXULONG_PTR; + + /* Lock the heap */ + RtlLockHeap(BaseHeap); + _SEH2_TRY + { + /* Check if this is a simple RTL Heap Managed block */ + if (!((ULONG_PTR)hMem & BASE_HEAP_IS_HANDLE_ENTRY)) + { + /* Then we'll query RTL Heap */ + if (RtlGetUserInfoHeap(BaseHeap, Flags, hMem, &Handle, &Flags)) + { + BASE_TRACE_PTR(Handle, hMem); + /* + * Check if RTL Heap didn't give us a handle or said that this + * heap isn't movable. + */ + if (!(Handle) || !(Flags & BASE_HEAP_FLAG_MOVABLE)) + { + /* We're not a handle heap, so use the generic call */ + dwSize = RtlSizeHeap(BaseHeap, HEAP_NO_SERIALIZE, hMem); + } + else + { + /* We're a handle heap so get the internal handle */ + hMem = Handle; + } + } + } + + /* Make sure that this is an entry in our handle database */ + if ((ULONG_PTR)hMem & BASE_HEAP_IS_HANDLE_ENTRY) + { + /* Get the entry */ + HandleEntry = BaseHeapGetEntry(hMem); + BASE_TRACE_HANDLE(HandleEntry, hMem); + + /* Make sure the handle is valid */ + if (!BaseHeapValidateEntry(HandleEntry)) + { + /* Fail */ + BASE_TRACE_FAILURE(); + SetLastError(ERROR_INVALID_HANDLE); + } + else if (HandleEntry->Flags & BASE_HEAP_ENTRY_FLAG_REUSE) + { + /* We've reused this block, but we've saved the size for you */ + dwSize = HandleEntry->OldSize; + } + else + { + /* Otherwise, query RTL about it */ + dwSize = RtlSizeHeap(BaseHeap, + HEAP_NO_SERIALIZE, + HandleEntry->Object); + } + } + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + /* Set failure for later */ + dwSize = MAXULONG_PTR; + } + _SEH2_END; + + /* Check if by now, we still haven't gotten any useful size */ + if (dwSize == MAXULONG_PTR) + { + /* Fail */ + BASE_TRACE_FAILURE(); + SetLastError(ERROR_INVALID_HANDLE); + dwSize = 0; + } + + /* All done! Unlock heap and return the size */ + RtlUnlockHeap(BaseHeap); + return dwSize; +} + +/* + * @implemented + */ +VOID +NTAPI +GlobalUnfix(HGLOBAL hMem) +{ + /* If the handle is valid, unlock it */ + if (hMem != INVALID_HANDLE_VALUE) GlobalUnlock(hMem); +} + +/* + * @implemented + */ +BOOL +NTAPI +GlobalUnlock(HGLOBAL hMem) +{ + PBASE_HEAP_HANDLE_ENTRY HandleEntry; + BOOL RetVal = TRUE; + + /* Check if this was a simple allocated heap entry */ + if (!((ULONG_PTR)hMem & BASE_HEAP_IS_HANDLE_ENTRY)) return RetVal; + + /* Otherwise, lock the heap */ + RtlLockHeap(BaseHeap); + + /* Get the handle entry */ + HandleEntry = BaseHeapGetEntry(hMem); + BASE_TRACE_HANDLE(HandleEntry, hMem); + + _SEH2_TRY + { + /* Make sure it's valid */ + if (!BaseHeapValidateEntry(HandleEntry)) + { + /* It's not, fail */ + BASE_TRACE_FAILURE(); + SetLastError(ERROR_INVALID_HANDLE); + RetVal = FALSE; + } + else + { + /* Otherwise, decrement lock count, unless we're already at 0*/ + if (!HandleEntry->LockCount--) + { + /* In which case we simply lock it back and fail */ + HandleEntry->LockCount++; + SetLastError(ERROR_NOT_LOCKED); + RetVal = FALSE; + } + else if (!HandleEntry->LockCount) + { + /* Nothing to unlock */ + SetLastError(NO_ERROR); + RetVal = FALSE; + } + } + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + SetLastError(ERROR_INVALID_PARAMETER); + RetVal = FALSE; + } + _SEH2_END; + + /* All done. Unlock the heap and return the pointer */ + RtlUnlockHeap(BaseHeap); + return RetVal; +} + +/* + * @implemented + */ +BOOL +NTAPI +GlobalUnWire(HGLOBAL hMem) +{ + /* This is simply an unlock */ + return GlobalUnlock(hMem); +} + +/* + * @implemented + */ +LPVOID +NTAPI +GlobalWire(HGLOBAL hMem) +{ + /* This is just a lock */ + return GlobalLock(hMem); +} + +/* + * @implemented + */ +BOOL +NTAPI +GlobalMemoryStatusEx(LPMEMORYSTATUSEX lpBuffer) +{ + SYSTEM_PERFORMANCE_INFORMATION PerformanceInfo; + VM_COUNTERS VmCounters; + QUOTA_LIMITS QuotaLimits; + ULONGLONG PageFile, PhysicalMemory; + + /* Query performance information */ + NtQuerySystemInformation(SystemPerformanceInformation, + &PerformanceInfo, + sizeof(PerformanceInfo), + NULL); + + /* Calculate memory load */ + lpBuffer->dwMemoryLoad = ((DWORD)(BaseStaticServerData->SysInfo.NumberOfPhysicalPages - + PerformanceInfo.AvailablePages) * 100) / + BaseStaticServerData->SysInfo.NumberOfPhysicalPages; + + /* Save physical memory */ + PhysicalMemory = BaseStaticServerData->SysInfo.NumberOfPhysicalPages * + BaseStaticServerData->SysInfo.PageSize; + lpBuffer->ullTotalPhys = PhysicalMemory; + + /* Now save available physical memory */ + PhysicalMemory = PerformanceInfo.AvailablePages * + BaseStaticServerData->SysInfo.PageSize; + lpBuffer->ullAvailPhys = PhysicalMemory; + + /* Query VM and Quota Limits */ + NtQueryInformationProcess(NtCurrentProcess(), + ProcessQuotaLimits, + &QuotaLimits, + sizeof(QUOTA_LIMITS), + NULL); + NtQueryInformationProcess(NtCurrentProcess(), + ProcessVmCounters, + &VmCounters, + sizeof(VM_COUNTERS), + NULL); + + /* Save the commit limit */ + lpBuffer->ullTotalPageFile = min(QuotaLimits.PagefileLimit, + PerformanceInfo.CommitLimit); + + /* Calculate how many pages are left */ + PageFile = PerformanceInfo.CommitLimit - PerformanceInfo.CommittedPages; + + /* Save the total */ + lpBuffer->ullAvailPageFile = min(PageFile, + QuotaLimits.PagefileLimit - + VmCounters.PagefileUsage); + lpBuffer->ullAvailPageFile *= BaseStaticServerData->SysInfo.PageSize; + + /* Now calculate the total virtual space */ + lpBuffer->ullTotalVirtual = (BaseStaticServerData->SysInfo.MaximumUserModeAddress - + BaseStaticServerData->SysInfo.MinimumUserModeAddress) + 1; + + /* And finally the avilable virtual space */ + lpBuffer->ullAvailVirtual = lpBuffer->ullTotalVirtual - + VmCounters.VirtualSize; + lpBuffer->ullAvailExtendedVirtual = 0; + return TRUE; +} + +/* + * @implemented + */ +VOID +NTAPI +GlobalMemoryStatus(LPMEMORYSTATUS lpBuffer) +{ + MEMORYSTATUSEX lpBufferEx; + + /* Call the extended function */ + lpBufferEx.dwLength = sizeof(MEMORYSTATUSEX); + if (GlobalMemoryStatusEx(&lpBufferEx)) + { + /* Reset the right size and fill out the information */ + lpBuffer->dwLength = sizeof(MEMORYSTATUS); + lpBuffer->dwMemoryLoad = lpBufferEx.dwMemoryLoad; + lpBuffer->dwTotalPhys = (SIZE_T)lpBufferEx.ullTotalPhys; + lpBuffer->dwAvailPhys = (SIZE_T)lpBufferEx.ullAvailPhys; + lpBuffer->dwTotalPageFile = (SIZE_T)lpBufferEx.ullTotalPageFile; + lpBuffer->dwAvailPageFile = (SIZE_T)lpBufferEx.ullAvailPageFile; + lpBuffer->dwTotalVirtual = (SIZE_T)lpBufferEx.ullTotalVirtual; + lpBuffer->dwAvailVirtual = (SIZE_T)lpBufferEx.ullAvailVirtual; + } +} + +/* + * @implemented + */ +HLOCAL +NTAPI +LocalAlloc(UINT uFlags, + SIZE_T dwBytes) +{ + ULONG Flags = 0; + PVOID Ptr = NULL; + HANDLE hMemory; + PBASE_HEAP_HANDLE_ENTRY HandleEntry; + BASE_TRACE_ALLOC(dwBytes, uFlags); + ASSERT(BaseHeap); + + /* Make sure the flags are valid */ + if (uFlags & ~LMEM_VALID_FLAGS) + { + /* They aren't, fail */ + BASE_TRACE_FAILURE(); + SetLastError(ERROR_INVALID_PARAMETER); + return NULL; + } + + /* Convert ZEROINIT */ + if (uFlags & LMEM_ZEROINIT) Flags |= HEAP_ZERO_MEMORY; + + /* Check if we're not movable, which means pointer-based heap */ + if (!(uFlags & LMEM_MOVEABLE)) + { + /* Allocate heap for it */ + Ptr = RtlAllocateHeap(BaseHeap, Flags, dwBytes); + BASE_TRACE_ALLOC2(Ptr); + return Ptr; + } + + /* This is heap based, so lock it in first */ + RtlLockHeap(BaseHeap); + + /* + * Disable locking, enable custom flags, and write the + * movable flag (deprecated) + */ + Flags |= HEAP_NO_SERIALIZE | + HEAP_SETTABLE_USER_VALUE | + BASE_HEAP_FLAG_MOVABLE; + + /* Allocate the handle */ + HandleEntry = BaseHeapAllocEntry(); + if (!HandleEntry) + { + /* Fail */ + hMemory = NULL; + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + BASE_TRACE_FAILURE(); + goto Quickie; + } + + /* Get the object and make sure we have size */ + hMemory = &HandleEntry->Object; + if (dwBytes) + { + /* Allocate the actual memory for it */ + Ptr = RtlAllocateHeap(BaseHeap, Flags, dwBytes); + BASE_TRACE_PTR(HandleEntry, Ptr); + if (!Ptr) + { + /* We failed, manually set the allocate flag and free the handle */ + HandleEntry->Flags = RTL_HANDLE_VALID; + BaseHeapFreeEntry(HandleEntry); + + /* For the cleanup case */ + HandleEntry = NULL; + } + else + { + /* All worked well, save our heap entry */ + RtlSetUserValueHeap(BaseHeap, HEAP_NO_SERIALIZE, Ptr, hMemory); + } + } + +Quickie: + /* Cleanup! First unlock the heap */ + RtlUnlockHeap(BaseHeap); + + /* Check if a handle was allocated */ + if (HandleEntry) + { + /* Set the pointer and allocated flag */ + HandleEntry->Object = Ptr; + HandleEntry->Flags = RTL_HANDLE_VALID; + if (!Ptr) + { + /* We don't have a valid pointer, but so reuse this handle */ + HandleEntry->Flags |= BASE_HEAP_ENTRY_FLAG_REUSE; + } + + /* Check if the handle is discardable */ + if (uFlags & GMEM_DISCARDABLE) + { + /* Save it in the handle entry */ + HandleEntry->Flags |= BASE_HEAP_ENTRY_FLAG_REUSABLE; + } + + /* Check if the handle is moveable */ + if (uFlags & GMEM_MOVEABLE) + { + /* Save it in the handle entry */ + HandleEntry->Flags |= BASE_HEAP_ENTRY_FLAG_MOVABLE; + } + + /* Set the pointer */ + Ptr = hMemory; + } + + /* Return the pointer */ + return Ptr; +} + +/* + * @implemented + */ +SIZE_T +NTAPI +LocalCompact(UINT dwMinFree) +{ + /* Call the RTL Heap Manager */ + return RtlCompactHeap(BaseHeap, 0); +} + +/* + * @implemented + */ +UINT +NTAPI +LocalFlags(HLOCAL hMem) +{ + PBASE_HEAP_HANDLE_ENTRY HandleEntry; + HANDLE Handle = NULL; + ULONG Flags = 0; + UINT uFlags = LMEM_INVALID_HANDLE; + + /* Start by locking the heap */ + RtlLockHeap(BaseHeap); + + /* Check if this is a simple RTL Heap Managed block */ + if (!((ULONG_PTR)hMem & BASE_HEAP_IS_HANDLE_ENTRY)) + { + /* Then we'll query RTL Heap */ + RtlGetUserInfoHeap(BaseHeap, Flags, hMem, &Handle, &Flags); + BASE_TRACE_PTR(Handle, hMem); + + /* + * Check if RTL Heap didn't find a handle associated with us or + * said that this heap isn't movable, which means something we're + * really not a handle-based heap. + */ + if (!(Handle) || !(Flags & BASE_HEAP_FLAG_MOVABLE)) + { + /* Then set the flags to 0 */ + uFlags = 0; + } + else + { + /* Otherwise we're handle-based, so get the internal handle */ + hMem = Handle; + } + } + + /* Check if the handle is actually an entry in our table */ + if ((ULONG_PTR)hMem & BASE_HEAP_IS_HANDLE_ENTRY) + { + /* Then get the entry */ + HandleEntry = BaseHeapGetEntry(hMem); + BASE_TRACE_HANDLE(HandleEntry, hMem); + + /* Make sure it's a valid handle */ + if (BaseHeapValidateEntry(HandleEntry)) + { + /* Get the lock count first */ + uFlags = HandleEntry->LockCount & LMEM_LOCKCOUNT; + + /* Now check if it's discardable */ + if (HandleEntry->Flags & BASE_HEAP_ENTRY_FLAG_REUSABLE) + { + /* Set the Win32 Flag */ + uFlags |= LMEM_DISCARDABLE; + } + + /* Now check if it's discarded */ + if (HandleEntry->Flags & BASE_HEAP_ENTRY_FLAG_REUSE) + /* Set the Win32 Flag */ + uFlags |= LMEM_DISCARDED; + } + } + + /* Check if by now, we still haven't gotten any useful flags */ + if (uFlags == LMEM_INVALID_HANDLE) SetLastError(ERROR_INVALID_HANDLE); + + /* All done! Unlock heap and return Win32 Flags */ + RtlUnlockHeap(BaseHeap); + return uFlags; +} + +/* + * @implemented + */ +HLOCAL +NTAPI +LocalFree(HLOCAL hMem) +{ + /* This is identical to a Global Free */ + return GlobalFree(hMem); +} + +/* + * @implemented + */ +HLOCAL +NTAPI +LocalHandle(LPCVOID pMem) +{ + /* This is identical to a Global Handle */ + return GlobalHandle(pMem); +} + +/* + * @implemented + */ +LPVOID +NTAPI +LocalLock(HLOCAL hMem) +{ + /* This is the same as a GlobalLock, assuming these never change */ + C_ASSERT(LMEM_LOCKCOUNT == GMEM_LOCKCOUNT); + return GlobalLock(hMem); +} + +HLOCAL +NTAPI +LocalReAlloc(HLOCAL hMem, + SIZE_T dwBytes, + UINT uFlags) +{ + PBASE_HEAP_HANDLE_ENTRY HandleEntry; + LPVOID Ptr; + ULONG Flags = 0; + + /* Convert ZEROINIT */ + if (uFlags & LMEM_ZEROINIT) Flags |= HEAP_ZERO_MEMORY; + + /* If this wasn't a movable heap, then we MUST re-alloc in place */ + if (!(uFlags & LMEM_MOVEABLE)) Flags |= HEAP_REALLOC_IN_PLACE_ONLY; + + /* Lock the heap and disable built-in locking in the RTL Heap funcitons */ + RtlLockHeap(BaseHeap); + Flags |= HEAP_NO_SERIALIZE; + + /* Check if this is a simple handle-based block */ + if (((ULONG_PTR)hMem & BASE_HEAP_IS_HANDLE_ENTRY)) + { + /* Get the entry */ + HandleEntry = BaseHeapGetEntry(hMem); + BASE_TRACE_HANDLE(HandleEntry, hMem); + + /* Make sure the handle is valid */ + if (!BaseHeapValidateEntry(HandleEntry)) + { + /* Fail */ + BASE_TRACE_FAILURE(); + SetLastError(ERROR_INVALID_HANDLE); + hMem = NULL; + } + else if (uFlags & LMEM_MODIFY) + { + /* User is changing flags... check if the memory was discardable */ + if (uFlags & LMEM_DISCARDABLE) + { + /* Then set the flag */ + HandleEntry->Flags |= BASE_HEAP_ENTRY_FLAG_REUSABLE; + } + else + { + /* Otherwise, remove the flag */ + HandleEntry->Flags &= BASE_HEAP_ENTRY_FLAG_REUSABLE; + } + } + else + { + /* Otherwise, get the object and check if we have no size */ + Ptr = HandleEntry->Object; + if (!dwBytes) + { + /* Clear the handle and check for a pointer */ + hMem = NULL; + if (Ptr) + { + /* Make sure the handle isn't locked */ + if ((uFlags & LMEM_MOVEABLE) && !(HandleEntry->LockCount)) + { + /* Free the current heap */ + RtlFreeHeap(BaseHeap, Flags, Ptr); + + /* Free the handle */ + HandleEntry->Object = NULL; + HandleEntry->Flags |= BASE_HEAP_ENTRY_FLAG_REUSE; + + /* Get the object pointer */ + hMem = &HandleEntry->Object; + } + } + else + { + /* Otherwise just return the object pointer */ + hMem = &HandleEntry->Object; + } + } + else + { + /* Otherwise, we're allocating, so set the new flags needed */ + Flags |= HEAP_SETTABLE_USER_VALUE | BASE_HEAP_FLAG_MOVABLE; + if (!Ptr) + { + /* We don't have a base, so allocate one */ + Ptr = RtlAllocateHeap(BaseHeap, Flags, dwBytes); + BASE_TRACE_ALLOC2(Ptr); + if (Ptr) + { + /* Allocation succeeded, so save our entry */ + RtlSetUserValueHeap(BaseHeap, + HEAP_NO_SERIALIZE, + Ptr, + hMem); + } + } + else + { + /* + * If it's not movable or currently locked, we MUST allocate + * in-place! + */ + if (!(uFlags & LMEM_MOVEABLE) && (HandleEntry->LockCount)) + { + /* Set the flag */ + Flags |= HEAP_REALLOC_IN_PLACE_ONLY; + } + else + { + /* Otherwise clear the flag if we set it previously */ + Flags &= ~HEAP_REALLOC_IN_PLACE_ONLY; + } + + /* And do the re-allocation */ + Ptr = RtlReAllocateHeap(BaseHeap, Flags, Ptr, dwBytes); + } + + /* Make sure we have a pointer by now */ + if (Ptr) + { + /* Write it in the handle entry and mark it in use */ + HandleEntry->Object = Ptr; + HandleEntry->Flags &= ~BASE_HEAP_ENTRY_FLAG_REUSE; + } + else + { + /* Otherwise we failed */ + hMem = NULL; + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + } + } + } + } + else if (!(uFlags & LMEM_MODIFY)) + { + /* Otherwise, this is a simple RTL Managed Heap, so just call it */ + hMem = RtlReAllocateHeap(BaseHeap, + Flags | HEAP_NO_SERIALIZE, + hMem, + dwBytes); + if (!hMem) + { + /* Fail */ + BASE_TRACE_FAILURE(); + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + } + } + + /* All done, unlock the heap and return the pointer */ + RtlUnlockHeap(BaseHeap); + return hMem; +} + +/* + * @implemented + */ +SIZE_T +WINAPI +LocalShrink(HLOCAL hMem, + UINT cbNewSize) +{ + /* Call RTL */ + return RtlCompactHeap(BaseHeap, 0); +} + +/* + * @implemented + */ +SIZE_T +NTAPI +LocalSize(HLOCAL hMem) +{ + /* This is the same as a Global Size */ + return GlobalSize(hMem); +} + +/* + * @implemented + */ +BOOL +NTAPI +LocalUnlock(HLOCAL hMem) +{ + PBASE_HEAP_HANDLE_ENTRY HandleEntry; + BOOL RetVal = TRUE; + + /* Check if this was a simple allocated heap entry */ + if (!((ULONG_PTR)hMem & BASE_HEAP_IS_HANDLE_ENTRY)) + { + /* Fail, because LocalUnlock is not supported on LMEM_FIXED allocations */ + SetLastError(ERROR_NOT_LOCKED); + return FALSE; + } + + /* Otherwise, lock the heap */ + RtlLockHeap(BaseHeap); + + /* Get the handle entry */ + HandleEntry = BaseHeapGetEntry(hMem); + BASE_TRACE_HANDLE(HandleEntry, hMem); + _SEH2_TRY + { + /* Make sure it's valid */ + if (!BaseHeapValidateEntry(HandleEntry)) + { + /* It's not, fail */ + BASE_TRACE_FAILURE(); + SetLastError(ERROR_INVALID_HANDLE); + RetVal = FALSE; + } + else + { + /* Otherwise, decrement lock count, unless we're already at 0*/ + if (!HandleEntry->LockCount--) + { + /* In which case we simply lock it back and fail */ + HandleEntry->LockCount++; + SetLastError(ERROR_NOT_LOCKED); + RetVal = FALSE; + } + else if (!HandleEntry->LockCount) + { + /* Nothing to unlock */ + SetLastError(NO_ERROR); + RetVal = FALSE; + } + } + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + SetLastError(ERROR_INVALID_PARAMETER); + RetVal = FALSE; + } + _SEH2_END; + + /* All done. Unlock the heap and return the pointer */ + RtlUnlockHeap(BaseHeap); + return RetVal; +} + +/* EOF */ diff --git a/dll/win32/kernel32/thread/i386/fiber.S b/dll/win32/kernel32/client/i386/fiber.S similarity index 84% rename from dll/win32/kernel32/thread/i386/fiber.S rename to dll/win32/kernel32/client/i386/fiber.S index bf88c468487..d8bc8f28a3b 100644 --- a/dll/win32/kernel32/thread/i386/fiber.S +++ b/dll/win32/kernel32/client/i386/fiber.S @@ -10,50 +10,62 @@ #include #include +EXTERN _BaseThreadStartup@8:PROC + .code +PUBLIC _BaseFiberStartup@0 +.PROC BaseFiberStartup@0 + /* Frame pointer is zeroed */ + FPO 0, 0, 0, 0, 0, FRAME_FPO + + /* Get the fiber data */ + mov eax, fs:[TEB_FIBER_DATA] + + push dword ptr [eax+FIBER_CONTEXT_EBX] /* Parameter */ + push dword ptr [eax+FIBER_CONTEXT_EAX] /* Start Address */ + call _BaseThreadStartup@8 +.ENDP BaseFiberStartup@0 + + PUBLIC _SwitchToFiber@4 _SwitchToFiber@4: /* Get the TEB */ mov edx, fs:[TEB_SELF] - + /* Get the Fiber */ mov eax, [edx+TEB_FIBER_DATA] - + /* Save the non-volatile registers */ mov [eax+FIBER_CONTEXT_EBX], ebx mov [eax+FIBER_CONTEXT_ESI], esi mov [eax+FIBER_CONTEXT_EDI], edi mov [eax+FIBER_CONTEXT_EBP], ebp - /* Save the return address */ - mov ebx, [esp] - mov [eax+FIBER_CONTEXT_EIP], ebx - /* Check if we're to save FPU State */ cmp dword ptr [eax+FIBER_CONTEXT_FLAGS], CONTEXT_FULL OR CONTEXT_FLOATING_POINT jnz NoFpuStateSave - + /* Save the FPU State (Status and Control)*/ fstsw [eax+FIBER_CONTEXT_FLOAT_SAVE_STATUS_WORD] - fstcw [eax+FIBER_CONTEXT_FLOAT_SAVE_CONTROL_WORD] - + fnstcw [eax+FIBER_CONTEXT_FLOAT_SAVE_CONTROL_WORD] + /* Check if the CPU supports SIMD MXCSR State Save */ - cmp byte ptr ds:[PROCESSOR_FEATURE_FXSR], 0 + cmp byte ptr ds:[PF_XMMI_INSTRUCTIONS_AVAILABLE], 1 jnz NoFpuStateSave stmxcsr [eax+FIBER_CONTEXT_DR6] - + NoFpuStateSave: /* Save stack since we're not touching it anymore */ mov [eax+FIBER_CONTEXT_ESP], esp - + /* Transfer some data from the TEB */ mov ecx, [edx+TEB_FLS_DATA] mov [eax+FIBER_FLS_DATA], ecx mov ecx, [edx+TEB_ACTIVATION_CONTEXT_STACK_POINTER] mov [eax+FIBER_ACTIVATION_CONTEXT_STACK], ecx - + /* Transfer some data related to the Stack */ mov ecx, [edx+TEB_EXCEPTION_LIST] mov [eax+FIBER_EXCEPTION_LIST], ecx @@ -61,11 +73,11 @@ NoFpuStateSave: mov [eax+FIBER_STACK_LIMIT], ecx mov ecx, [edx+TEB_GUARANTEED_STACK_BYTES] mov [eax+FIBER_GUARANTEED_STACK_BYTES], ecx - + /* Switch to the new fiber */ mov ecx, [esp+4] mov [edx+TEB_FIBER_DATA], ecx - + /* Switch Fiber Data */ mov esi, [ecx+FIBER_EXCEPTION_LIST] mov [edx+TEB_EXCEPTION_LIST], esi @@ -79,34 +91,34 @@ NoFpuStateSave: mov [edx+TEB_GUARANTEED_STACK_BYTES], esi mov esi, [ecx+FIBER_ACTIVATION_CONTEXT_STACK] mov [edx+TEB_ACTIVATION_CONTEXT_STACK_POINTER], esi - + /* Restore FPU State */ cmp dword ptr [eax+FIBER_CONTEXT_FLAGS], CONTEXT_FULL OR CONTEXT_FLOATING_POINT jnz NoFpuStateRestore - + /* Check if the Status Word Changed */ mov esi, [eax+FIBER_CONTEXT_FLOAT_SAVE_STATUS_WORD] cmp si, word ptr [ecx+FIBER_CONTEXT_FLOAT_SAVE_STATUS_WORD] jnz StatusWordChanged - + /* Check if the Control Word Changed */ mov esi, [eax+FIBER_CONTEXT_FLOAT_SAVE_CONTROL_WORD] cmp si, word ptr [ecx+FIBER_CONTEXT_FLOAT_SAVE_CONTROL_WORD] jz ControlWordEqual - + StatusWordChanged: /* Load the new one */ mov word ptr [ecx+FIBER_CONTEXT_FLOAT_SAVE_TAG_WORD], HEX(0FFFF) fldenv [ecx+FIBER_CONTEXT_FLOAT_SAVE_CONTROL_WORD] - + ControlWordEqual: /* Load the new one */ - cmp byte ptr ds:[PROCESSOR_FEATURE_FXSR], 0 + cmp byte ptr ds:[PF_XMMI_INSTRUCTIONS_AVAILABLE], 1 jnz NoFpuStateRestore ldmxcsr [ecx+FIBER_CONTEXT_DR6] - + NoFpuStateRestore: /* Restore non-volatile registers */ @@ -115,13 +127,14 @@ NoFpuStateRestore: mov ebx, [ecx+FIBER_CONTEXT_EBX] mov ebp, [ecx+FIBER_CONTEXT_EBP] mov esp, [ecx+FIBER_CONTEXT_ESP] - + /* Restore FLS Data */ mov eax, [ecx+FIBER_FLS_DATA] mov [edx+TEB_FLS_DATA], eax /* Jump to new fiber */ - jmp dword ptr [ecx+FIBER_CONTEXT_EIP] - + mov esp, [ecx+FIBER_CONTEXT_ESP] + ret 4 END + /* EOF */ diff --git a/dll/win32/kernel32/thread/i386/thread.S b/dll/win32/kernel32/client/i386/thread.S similarity index 97% rename from dll/win32/kernel32/thread/i386/thread.S rename to dll/win32/kernel32/client/i386/thread.S index a07bcb2e60e..f6964572246 100644 --- a/dll/win32/kernel32/thread/i386/thread.S +++ b/dll/win32/kernel32/client/i386/thread.S @@ -7,6 +7,7 @@ */ #include +#include .code @@ -14,8 +15,6 @@ EXTERN _BaseThreadStartup@8:PROC EXTERN _BaseProcessStartup@4:PROC PUBLIC _BaseThreadStartupThunk@0 -PUBLIC _BaseProcessStartThunk@0 - _BaseThreadStartupThunk@0: /* Start out fresh */ @@ -26,8 +25,9 @@ _BaseThreadStartupThunk@0: push 0 /* Return EIP */ jmp _BaseThreadStartup@8 -_BaseProcessStartThunk@0: +PUBLIC _BaseProcessStartThunk@0 +_BaseProcessStartThunk@0: /* Start out fresh */ xor ebp, ebp @@ -35,5 +35,7 @@ _BaseProcessStartThunk@0: push 0 /* Return EIP */ jmp _BaseProcessStartup@4 + END + /* EOF */ diff --git a/dll/win32/kernel32/process/job.c b/dll/win32/kernel32/client/job.c similarity index 69% rename from dll/win32/kernel32/process/job.c rename to dll/win32/kernel32/client/job.c index 43a77c905f9..da5ee9b08bd 100644 --- a/dll/win32/kernel32/process/job.c +++ b/dll/win32/kernel32/client/job.c @@ -18,97 +18,30 @@ /* FUNCTIONS ****************************************************************/ +/* + * @implemented + */ +HANDLE +WINAPI +CreateJobObjectA(IN LPSECURITY_ATTRIBUTES lpJobAttributes, + IN LPCSTR lpName) +{ + /* Call the W(ide) function */ + ConvertWin32AnsiObjectApiToUnicodeApi(JobObject, lpName, lpJobAttributes); +} /* * @implemented */ HANDLE WINAPI -CreateJobObjectA(LPSECURITY_ATTRIBUTES lpJobAttributes, - LPCSTR lpName) +CreateJobObjectW(IN LPSECURITY_ATTRIBUTES lpJobAttributes, + IN LPCWSTR lpName) { - HANDLE hJob; - ANSI_STRING AnsiName; - UNICODE_STRING UnicodeName; - - if (lpName != NULL) - { - NTSTATUS Status; - - RtlInitAnsiString(&AnsiName, lpName); - Status = RtlAnsiStringToUnicodeString(&UnicodeName, &AnsiName, TRUE); - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return FALSE; - } - } - - hJob = CreateJobObjectW(lpJobAttributes, - ((lpName != NULL) ? UnicodeName.Buffer : NULL)); - - if (lpName != NULL) - { - RtlFreeUnicodeString(&UnicodeName); - } - - return hJob; + /* Create the NT object */ + CreateNtObjectFromWin32Api(JobObject, JobObject, JOB, lpJobAttributes, lpName); } - -/* - * @implemented - */ -HANDLE -WINAPI -CreateJobObjectW(LPSECURITY_ATTRIBUTES lpJobAttributes, - LPCWSTR lpName) -{ - UNICODE_STRING JobName; - OBJECT_ATTRIBUTES ObjectAttributes; - ULONG Attributes = 0; - PVOID SecurityDescriptor; - HANDLE hJob; - NTSTATUS Status; - - if (lpName != NULL) - { - RtlInitUnicodeString(&JobName, lpName); - } - - if (lpJobAttributes != NULL) - { - if (lpJobAttributes->bInheritHandle) - { - Attributes |= OBJ_INHERIT; - } - - SecurityDescriptor = lpJobAttributes->lpSecurityDescriptor; - } - else - { - SecurityDescriptor = NULL; - } - - InitializeObjectAttributes(&ObjectAttributes, - ((lpName != NULL) ? &JobName : NULL), - Attributes, - NULL, - SecurityDescriptor); - - Status = NtCreateJobObject(&hJob, - JOB_OBJECT_ALL_ACCESS, - &ObjectAttributes); - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return NULL; - } - - return hJob; -} - - /* * @implemented */ @@ -118,35 +51,8 @@ OpenJobObjectW(DWORD dwDesiredAccess, BOOL bInheritHandle, LPCWSTR lpName) { - OBJECT_ATTRIBUTES ObjectAttributes; - UNICODE_STRING JobName; - HANDLE hJob; - NTSTATUS Status; - - if (lpName == NULL) - { - SetLastError(ERROR_INVALID_PARAMETER); - return NULL; - } - - RtlInitUnicodeString(&JobName, lpName); - - InitializeObjectAttributes(&ObjectAttributes, - &JobName, - (bInheritHandle ? OBJ_INHERIT : 0), - NULL, - NULL); - - Status = NtOpenJobObject(&hJob, - dwDesiredAccess, - &ObjectAttributes); - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return NULL; - } - - return hJob; + /* Open the NT object */ + OpenNtObjectFromWin32Api(JobObject, dwDesiredAccess, bInheritHandle, lpName); } @@ -159,31 +65,8 @@ OpenJobObjectA(DWORD dwDesiredAccess, BOOL bInheritHandle, LPCSTR lpName) { - ANSI_STRING AnsiName; - UNICODE_STRING UnicodeName; - HANDLE hJob; - NTSTATUS Status; - - if (lpName == NULL) - { - SetLastError(ERROR_INVALID_PARAMETER); - return NULL; - } - - RtlInitAnsiString(&AnsiName, lpName); - Status = RtlAnsiStringToUnicodeString(&UnicodeName, &AnsiName, TRUE); - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return FALSE; - } - - hJob = OpenJobObjectW(dwDesiredAccess, - bInheritHandle, - UnicodeName.Buffer); - - RtlFreeUnicodeString(&UnicodeName); - return hJob; + /* Call the W(ide) function */ + ConvertOpenWin32AnsiObjectApiToUnicodeApi(JobObject, dwDesiredAccess, bInheritHandle, lpName); } @@ -205,7 +88,7 @@ IsProcessInJob(HANDLE ProcessHandle, return TRUE; } - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -223,7 +106,7 @@ AssignProcessToJobObject(HANDLE hJob, Status = NtAssignProcessToJobObject(hJob, hProcess); if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -308,7 +191,7 @@ QueryInformationJobObject(HANDLE hJob, return TRUE; } - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -403,7 +286,7 @@ SetInformationJobObject(HANDLE hJob, cbJobObjectInformationLength); if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -424,11 +307,25 @@ TerminateJobObject(HANDLE hJob, Status = NtTerminateJobObject(hJob, uExitCode); if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } return TRUE; } +/* + * @unimplemented + */ +BOOL +WINAPI +CreateJobSet ( + ULONG NumJob, + PJOB_SET_ARRAY UserJobSet, + ULONG Flags) +{ + STUB; + return 0; +} + /* EOF */ diff --git a/dll/win32/kernel32/misc/ldr.c b/dll/win32/kernel32/client/loader.c similarity index 97% rename from dll/win32/kernel32/misc/ldr.c rename to dll/win32/kernel32/client/loader.c index b383f1dd6a1..b600b8c2fc3 100644 --- a/dll/win32/kernel32/misc/ldr.c +++ b/dll/win32/kernel32/client/loader.c @@ -443,20 +443,11 @@ LoadLibraryExW(LPCWSTR lpLibFileName, } } - /* HACK!!! FIXME */ - if (InWindows) - { - /* Call the API Properly */ - Status = LdrLoadDll(SearchPath, - &DllCharacteristics, - &DllName, - (PVOID*)&hInst); - } - else - { - /* Call the ROS API. NOTE: Don't fix this, I have a patch to merge later. */ - Status = LdrLoadDll(SearchPath, &dwFlags, &DllName, (PVOID*)&hInst); - } + /* Call the API Properly */ + Status = LdrLoadDll(SearchPath, + &DllCharacteristics, + &DllName, + (PVOID*)&hInst); } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { @@ -795,7 +786,7 @@ GetModuleHandleForUnicodeString(PUNICODE_STRING ModuleName) if (!NT_SUCCESS(Status)) { DPRINT("Failure acquiring DLL module '%wZ' handle, Status 0x%08X\n", ModuleName, Status); - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); Module = 0; } @@ -825,7 +816,7 @@ BasepGetModuleHandleExW(BOOLEAN NoLock, DWORD dwPublicFlags, LPCWSTR lpwModuleNa if (!NT_SUCCESS(Status)) { /* Fail */ - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); if (phModule) *phModule = 0; return Status; } @@ -872,13 +863,13 @@ BasepGetModuleHandleExW(BOOLEAN NoLock, DWORD dwPublicFlags, LPCWSTR lpwModuleNa if (!(dwPublicFlags & GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT)) { /* Add reference to this DLL */ - Status = LdrAddRefDll((dwPublicFlags & GET_MODULE_HANDLE_EX_FLAG_PIN) ? LDR_PIN_MODULE : 0, + Status = LdrAddRefDll((dwPublicFlags & GET_MODULE_HANDLE_EX_FLAG_PIN) ? LDR_ADDREF_DLL_PIN : 0, hModule); } /* Set last error in case of failure */ if (!NT_SUCCESS(Status)) - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); quickie: /* Unlock loader lock if it was acquired */ @@ -1177,4 +1168,33 @@ LoadModule(LPCSTR lpModuleName, return GetLastError(); } +/* + * @unimplemented + */ +FARPROC WINAPI DelayLoadFailureHook(LPCSTR pszDllName, LPCSTR pszProcName) +{ + STUB; + return NULL; +} + +/* + * @unimplemented + */ +BOOL WINAPI UTRegister( HMODULE hModule, LPSTR lpsz16BITDLL, + LPSTR lpszInitName, LPSTR lpszProcName, + FARPROC *ppfn32Thunk, FARPROC pfnUT32CallBack, + LPVOID lpBuff ) +{ + STUB; + return 0; +} + +/* + * @unimplemented + */ +VOID WINAPI UTUnRegister( HMODULE hModule ) +{ + STUB; +} + /* EOF */ diff --git a/dll/win32/kernel32/client/perfcnt.c b/dll/win32/kernel32/client/perfcnt.c new file mode 100644 index 00000000000..e25bb9d6a9d --- /dev/null +++ b/dll/win32/kernel32/client/perfcnt.c @@ -0,0 +1,62 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Win32 Base API + * FILE: dll/win32/kernel32/client/perfcnt.c + * PURPOSE: Performance Counter + * PROGRAMMER: Eric Kohl + */ + +/* INCLUDES *******************************************************************/ + +#include + +#define NDEBUG +#include + +/* FUNCTIONS ******************************************************************/ + +/* + * @implemented + */ +BOOL +WINAPI +QueryPerformanceCounter(OUT PLARGE_INTEGER lpPerformanceCount) +{ + LARGE_INTEGER Frequency; + NTSTATUS Status; + + Status = NtQueryPerformanceCounter(lpPerformanceCount, &Frequency); + if (!Frequency.QuadPart) Status = STATUS_NOT_IMPLEMENTED; + + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + return TRUE; +} + +/* + * @implemented + */ +BOOL +WINAPI +QueryPerformanceFrequency(OUT PLARGE_INTEGER lpFrequency) +{ + LARGE_INTEGER Count; + NTSTATUS Status; + + Status = NtQueryPerformanceCounter(&Count, lpFrequency); + if (!Count.QuadPart) Status = STATUS_NOT_IMPLEMENTED; + + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + return TRUE; +} + +/* EOF */ diff --git a/dll/win32/kernel32/client/power.c b/dll/win32/kernel32/client/power.c new file mode 100644 index 00000000000..85c74e40715 --- /dev/null +++ b/dll/win32/kernel32/client/power.c @@ -0,0 +1,222 @@ +/* + * + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * FILE: dll/win32/kernel32/misc/power.c + * PURPOSE: Power Management Functions + * PROGRAMMER: Dmitry Chapyshev + * + * UPDATE HISTORY: + * 01/15/2009 Created + */ + +#include + +#define NDEBUG +#include + +/* PUBLIC FUNCTIONS ***********************************************************/ + +/* + * @implemented + */ +BOOL +WINAPI +GetSystemPowerStatus(IN LPSYSTEM_POWER_STATUS PowerStatus) +{ + NTSTATUS Status; + SYSTEM_BATTERY_STATE BattState; + ULONG Max, Current; + + Status = NtPowerInformation(SystemBatteryState, + NULL, + 0, + &BattState, + sizeof(SYSTEM_BATTERY_STATE)); + + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + RtlZeroMemory(PowerStatus, sizeof(LPSYSTEM_POWER_STATUS)); + + PowerStatus->BatteryLifeTime = BATTERY_LIFE_UNKNOWN; + PowerStatus->BatteryFullLifeTime = BATTERY_LIFE_UNKNOWN; + PowerStatus->BatteryLifePercent = BATTERY_PERCENTAGE_UNKNOWN; + PowerStatus->ACLineStatus = AC_LINE_ONLINE; + + Max = BattState.MaxCapacity; + Current = BattState.RemainingCapacity; + if (Max) + { + if (Current <= Max) + { + PowerStatus->BatteryLifePercent = (100 * Current + Max / 2) / Max; + } + else + { + PowerStatus->BatteryLifePercent = 100; + } + + if (PowerStatus->BatteryLifePercent <= 32) PowerStatus->BatteryFlag |= BATTERY_FLAG_LOW; + if (PowerStatus->BatteryLifePercent >= 67) PowerStatus->BatteryFlag |= BATTERY_FLAG_HIGH; + } + + if (!BattState.BatteryPresent) PowerStatus->BatteryFlag |= BATTERY_FLAG_NO_BATTERY; + + if (BattState.Charging) PowerStatus->BatteryFlag |= BATTERY_FLAG_CHARGING; + + if (!(BattState.AcOnLine) && (BattState.BatteryPresent)) PowerStatus->ACLineStatus = AC_LINE_OFFLINE; + + if (BattState.EstimatedTime) PowerStatus->BatteryLifeTime = BattState.EstimatedTime; + + return TRUE; +} + +/* + * @implemented + */ +BOOL +WINAPI +SetSystemPowerState(IN BOOL fSuspend, + IN BOOL fForce) +{ + NTSTATUS Status; + + Status = NtInitiatePowerAction(PowerActionSleep, + (fSuspend != FALSE) ? + PowerSystemSleeping1 : PowerSystemHibernate, + fForce != TRUE, + FALSE); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + return TRUE; +} + +/* + * @implemented + */ +BOOL +WINAPI +GetDevicePowerState(IN HANDLE hDevice, + OUT BOOL *pfOn) +{ + DEVICE_POWER_STATE DevicePowerState; + NTSTATUS Status; + + Status = NtGetDevicePowerState(hDevice, &DevicePowerState); + if (NT_SUCCESS(Status)) + { + *pfOn = (DevicePowerState == PowerDeviceUnspecified) || + (DevicePowerState == PowerDeviceD0); + return TRUE; + } + + BaseSetLastNTError(Status); + return FALSE; +} + +/* + * @implemented + */ +BOOL +WINAPI +RequestDeviceWakeup(IN HANDLE hDevice) +{ + NTSTATUS Status; + + Status = NtRequestDeviceWakeup(hDevice); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + return TRUE; +} + +/* + * @implemented + */ +BOOL +WINAPI +RequestWakeupLatency(IN LATENCY_TIME latency) +{ + NTSTATUS Status; + + Status = NtRequestWakeupLatency(latency); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + return TRUE; +} + +/* + * @implemented + */ +BOOL +WINAPI +CancelDeviceWakeupRequest(IN HANDLE hDevice) +{ + NTSTATUS Status; + + Status = NtCancelDeviceWakeupRequest(hDevice); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + return TRUE; +} + +/* + * @implemented + */ +BOOL +WINAPI +IsSystemResumeAutomatic(VOID) +{ + return (BOOL)NtIsSystemResumeAutomatic(); +} + +/* + * @implemented + */ +BOOL +WINAPI +SetMessageWaitingIndicator(IN HANDLE hMsgIndicator, + IN ULONG ulMsgCount) +{ + /* This is the correct Windows implementation */ + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return 0; +} + +/* + * @implemented + */ +EXECUTION_STATE +WINAPI +SetThreadExecutionState(EXECUTION_STATE esFlags) +{ + NTSTATUS Status; + + Status = NtSetThreadExecutionState(esFlags, &esFlags); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return 0; + } + + return esFlags; +} diff --git a/dll/win32/kernel32/process/procsup.c b/dll/win32/kernel32/client/proc.c similarity index 64% rename from dll/win32/kernel32/process/procsup.c rename to dll/win32/kernel32/client/proc.c index 39f700714d3..1ba10577cec 100644 --- a/dll/win32/kernel32/process/procsup.c +++ b/dll/win32/kernel32/client/proc.c @@ -1,10 +1,12 @@ -/* +/* $Id$ + * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS system libraries - * FILE: lib/kernel32/process/create.c + * FILE: lib/kernel32/proc/proc.c * PURPOSE: Process functions - * PROGRAMMER: Alex Ionescu (alex@relsoft.net) - * Ariadne ( ariadne@xs4all.nl) + * PROGRAMMER: Ariadne ( ariadne@xs4all.nl) + * UPDATE HISTORY: + * Created 01/11/98 */ /* INCLUDES ****************************************************************/ @@ -14,8 +16,24 @@ #define NDEBUG #include + +typedef INT (WINAPI *MessageBoxW_Proc) (HWND, LPCWSTR, LPCWSTR, UINT); + +/* GLOBALS *******************************************************************/ + +static UNICODE_STRING CommandLineStringW; +static ANSI_STRING CommandLineStringA; + +static BOOL bCommandLineInitialized = FALSE; + +WaitForInputIdleType lpfnGlobalRegisterWaitForInputIdle; + +LPSTARTUPINFOA lpLocalStartupInfo = NULL; + +VOID WINAPI +RegisterWaitForInputIdle(WaitForInputIdleType lpfnRegisterWaitForInputIdle); + UNICODE_STRING BasePathVariableName = RTL_CONSTANT_STRING(L"PATH"); -UNICODE_STRING BaseDefaultPath; PLDR_DATA_TABLE_ENTRY BasepExeLdrEntry; #define CMD_STRING L"cmd /c " @@ -25,7 +43,7 @@ VOID CALLBACK ConsoleControlDispatcher(DWORD CodeAndFlag); -/* INTERNAL FUNCTIONS *******************************************************/ +/* FUNCTIONS ****************************************************************/ static LONG BaseExceptionFilter(EXCEPTION_POINTERS *ExceptionInfo) @@ -872,7 +890,1281 @@ BasepInitializeEnvironment(HANDLE ProcessHandle, return STATUS_SUCCESS; } -/* FUNCTIONS ****************************************************************/ +VOID +WINAPI +InitCommandLines(VOID) +{ + PRTL_USER_PROCESS_PARAMETERS Params; + + /* get command line */ + Params = NtCurrentPeb()->ProcessParameters; + RtlNormalizeProcessParams (Params); + + /* initialize command line buffers */ + CommandLineStringW.Length = Params->CommandLine.Length; + CommandLineStringW.MaximumLength = CommandLineStringW.Length + sizeof(WCHAR); + CommandLineStringW.Buffer = RtlAllocateHeap(GetProcessHeap(), + HEAP_GENERATE_EXCEPTIONS | HEAP_ZERO_MEMORY, + CommandLineStringW.MaximumLength); + if (CommandLineStringW.Buffer == NULL) + { + return; + } + + RtlInitAnsiString(&CommandLineStringA, NULL); + + /* Copy command line */ + RtlCopyUnicodeString(&CommandLineStringW, + &(Params->CommandLine)); + CommandLineStringW.Buffer[CommandLineStringW.Length / sizeof(WCHAR)] = 0; + + /* convert unicode string to ansi (or oem) */ + if (bIsFileApiAnsi) + RtlUnicodeStringToAnsiString(&CommandLineStringA, + &CommandLineStringW, + TRUE); + else + RtlUnicodeStringToOemString(&CommandLineStringA, + &CommandLineStringW, + TRUE); + + CommandLineStringA.Buffer[CommandLineStringA.Length] = 0; + + bCommandLineInitialized = TRUE; +} + +/* + * @implemented + */ +BOOL +WINAPI +GetProcessAffinityMask(HANDLE hProcess, + PDWORD_PTR lpProcessAffinityMask, + PDWORD_PTR lpSystemAffinityMask) +{ + PROCESS_BASIC_INFORMATION ProcessInfo; + SYSTEM_BASIC_INFORMATION SystemInfo; + NTSTATUS Status; + + Status = NtQuerySystemInformation(SystemBasicInformation, + &SystemInfo, + sizeof(SystemInfo), + NULL); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + Status = NtQueryInformationProcess(hProcess, + ProcessBasicInformation, + (PVOID)&ProcessInfo, + sizeof(PROCESS_BASIC_INFORMATION), + NULL); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + *lpProcessAffinityMask = (DWORD)ProcessInfo.AffinityMask; + *lpSystemAffinityMask = (DWORD)SystemInfo.ActiveProcessorsAffinityMask; + + return TRUE; +} + + +/* + * @implemented + */ +BOOL +WINAPI +SetProcessAffinityMask(HANDLE hProcess, + DWORD_PTR dwProcessAffinityMask) +{ + NTSTATUS Status; + + Status = NtSetInformationProcess(hProcess, + ProcessAffinityMask, + (PVOID)&dwProcessAffinityMask, + sizeof(DWORD)); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + return TRUE; +} + + +/* + * @implemented + */ +BOOL +WINAPI +GetProcessShutdownParameters(LPDWORD lpdwLevel, + LPDWORD lpdwFlags) +{ + CSR_API_MESSAGE CsrRequest; + ULONG Request; + NTSTATUS Status; + + Request = GET_SHUTDOWN_PARAMETERS; + Status = CsrClientCallServer(&CsrRequest, + NULL, + MAKE_CSR_API(Request, CSR_NATIVE), + sizeof(CSR_API_MESSAGE)); + if (!NT_SUCCESS(Status) || !NT_SUCCESS(CsrRequest.Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + *lpdwLevel = CsrRequest.Data.GetShutdownParametersRequest.Level; + *lpdwFlags = CsrRequest.Data.GetShutdownParametersRequest.Flags; + + return TRUE; +} + + +/* + * @implemented + */ +BOOL +WINAPI +SetProcessShutdownParameters(DWORD dwLevel, + DWORD dwFlags) +{ + CSR_API_MESSAGE CsrRequest; + ULONG Request; + NTSTATUS Status; + + CsrRequest.Data.SetShutdownParametersRequest.Level = dwLevel; + CsrRequest.Data.SetShutdownParametersRequest.Flags = dwFlags; + + Request = SET_SHUTDOWN_PARAMETERS; + Status = CsrClientCallServer(&CsrRequest, + NULL, + MAKE_CSR_API(Request, CSR_NATIVE), + sizeof(CSR_API_MESSAGE)); + if (!NT_SUCCESS(Status) || !NT_SUCCESS(CsrRequest.Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + return TRUE; +} + + +/* + * @implemented + */ +BOOL +WINAPI +GetProcessWorkingSetSize(HANDLE hProcess, + PSIZE_T lpMinimumWorkingSetSize, + PSIZE_T lpMaximumWorkingSetSize) +{ + QUOTA_LIMITS QuotaLimits; + NTSTATUS Status; + + Status = NtQueryInformationProcess(hProcess, + ProcessQuotaLimits, + &QuotaLimits, + sizeof(QUOTA_LIMITS), + NULL); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + *lpMinimumWorkingSetSize = QuotaLimits.MinimumWorkingSetSize; + *lpMaximumWorkingSetSize = QuotaLimits.MaximumWorkingSetSize; + + return TRUE; +} + + +/* + * @implemented + */ +BOOL +WINAPI +SetProcessWorkingSetSize(HANDLE hProcess, + SIZE_T dwMinimumWorkingSetSize, + SIZE_T dwMaximumWorkingSetSize) +{ + QUOTA_LIMITS QuotaLimits; + NTSTATUS Status; + + QuotaLimits.MinimumWorkingSetSize = dwMinimumWorkingSetSize; + QuotaLimits.MaximumWorkingSetSize = dwMaximumWorkingSetSize; + + Status = NtSetInformationProcess(hProcess, + ProcessQuotaLimits, + &QuotaLimits, + sizeof(QUOTA_LIMITS)); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + return TRUE; +} + + +/* + * @implemented + */ +BOOL +WINAPI +GetProcessTimes(HANDLE hProcess, + LPFILETIME lpCreationTime, + LPFILETIME lpExitTime, + LPFILETIME lpKernelTime, + LPFILETIME lpUserTime) +{ + KERNEL_USER_TIMES Kut; + NTSTATUS Status; + + Status = NtQueryInformationProcess(hProcess, + ProcessTimes, + &Kut, + sizeof(Kut), + NULL); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + lpCreationTime->dwLowDateTime = Kut.CreateTime.u.LowPart; + lpCreationTime->dwHighDateTime = Kut.CreateTime.u.HighPart; + + lpExitTime->dwLowDateTime = Kut.ExitTime.u.LowPart; + lpExitTime->dwHighDateTime = Kut.ExitTime.u.HighPart; + + lpKernelTime->dwLowDateTime = Kut.KernelTime.u.LowPart; + lpKernelTime->dwHighDateTime = Kut.KernelTime.u.HighPart; + + lpUserTime->dwLowDateTime = Kut.UserTime.u.LowPart; + lpUserTime->dwHighDateTime = Kut.UserTime.u.HighPart; + + return TRUE; +} + + +/* + * @implemented + */ +HANDLE +WINAPI +GetCurrentProcess(VOID) +{ + return (HANDLE)NtCurrentProcess(); +} + + +/* + * @implemented + */ +HANDLE +WINAPI +GetCurrentThread(VOID) +{ + return (HANDLE)NtCurrentThread(); +} + + +/* + * @implemented + */ +DWORD +WINAPI +GetCurrentProcessId(VOID) +{ + return HandleToUlong(GetTeb()->ClientId.UniqueProcess); +} + + +/* + * @implemented + */ +BOOL +WINAPI +GetExitCodeProcess(HANDLE hProcess, + LPDWORD lpExitCode) +{ + PROCESS_BASIC_INFORMATION ProcessBasic; + NTSTATUS Status; + + Status = NtQueryInformationProcess(hProcess, + ProcessBasicInformation, + &ProcessBasic, + sizeof(PROCESS_BASIC_INFORMATION), + NULL); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + *lpExitCode = (DWORD)ProcessBasic.ExitStatus; + + return TRUE; +} + + +/* + * @implemented + */ +DWORD +WINAPI +GetProcessId(HANDLE Process) +{ + PROCESS_BASIC_INFORMATION ProcessBasic; + NTSTATUS Status; + + Status = NtQueryInformationProcess(Process, + ProcessBasicInformation, + &ProcessBasic, + sizeof(PROCESS_BASIC_INFORMATION), + NULL); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return 0; + } + + return (DWORD)ProcessBasic.UniqueProcessId; +} + + +/* + * @implemented + */ +HANDLE +WINAPI +OpenProcess(DWORD dwDesiredAccess, + BOOL bInheritHandle, + DWORD dwProcessId) +{ + NTSTATUS errCode; + HANDLE ProcessHandle; + OBJECT_ATTRIBUTES ObjectAttributes; + CLIENT_ID ClientId; + + ClientId.UniqueProcess = UlongToHandle(dwProcessId); + ClientId.UniqueThread = 0; + + InitializeObjectAttributes(&ObjectAttributes, + NULL, + (bInheritHandle ? OBJ_INHERIT : 0), + NULL, + NULL); + + errCode = NtOpenProcess(&ProcessHandle, + dwDesiredAccess, + &ObjectAttributes, + &ClientId); + if (!NT_SUCCESS(errCode)) + { + BaseSetLastNTError(errCode); + return NULL; + } + + return ProcessHandle; +} + + +/* + * @implemented + */ +UINT +WINAPI +WinExec(LPCSTR lpCmdLine, + UINT uCmdShow) +{ + STARTUPINFOA StartupInfo; + PROCESS_INFORMATION ProcessInformation; + DWORD dosErr; + + RtlZeroMemory(&StartupInfo, sizeof(StartupInfo)); + StartupInfo.cb = sizeof(STARTUPINFOA); + StartupInfo.wShowWindow = (WORD)uCmdShow; + StartupInfo.dwFlags = 0; + + if (!CreateProcessA(NULL, + (PVOID)lpCmdLine, + NULL, + NULL, + FALSE, + 0, + NULL, + NULL, + &StartupInfo, + &ProcessInformation)) + { + dosErr = GetLastError(); + return dosErr < 32 ? dosErr : ERROR_BAD_FORMAT; + } + + if (NULL != lpfnGlobalRegisterWaitForInputIdle) + { + lpfnGlobalRegisterWaitForInputIdle(ProcessInformation.hProcess, + 10000); + } + + NtClose(ProcessInformation.hProcess); + NtClose(ProcessInformation.hThread); + + return 33; /* Something bigger than 31 means success. */ +} + + +/* + * @implemented + */ +VOID +WINAPI +RegisterWaitForInputIdle(WaitForInputIdleType lpfnRegisterWaitForInputIdle) +{ + lpfnGlobalRegisterWaitForInputIdle = lpfnRegisterWaitForInputIdle; + return; +} + +/* + * @implemented + */ +VOID +WINAPI +GetStartupInfoW(LPSTARTUPINFOW lpStartupInfo) +{ + PRTL_USER_PROCESS_PARAMETERS Params; + + if (lpStartupInfo == NULL) + { + SetLastError(ERROR_INVALID_PARAMETER); + return; + } + + Params = NtCurrentPeb()->ProcessParameters; + + lpStartupInfo->cb = sizeof(STARTUPINFOW); + lpStartupInfo->lpDesktop = Params->DesktopInfo.Buffer; + lpStartupInfo->lpTitle = Params->WindowTitle.Buffer; + lpStartupInfo->dwX = Params->StartingX; + lpStartupInfo->dwY = Params->StartingY; + lpStartupInfo->dwXSize = Params->CountX; + lpStartupInfo->dwYSize = Params->CountY; + lpStartupInfo->dwXCountChars = Params->CountCharsX; + lpStartupInfo->dwYCountChars = Params->CountCharsY; + lpStartupInfo->dwFillAttribute = Params->FillAttribute; + lpStartupInfo->dwFlags = Params->WindowFlags; + lpStartupInfo->wShowWindow = (WORD)Params->ShowWindowFlags; + lpStartupInfo->cbReserved2 = Params->RuntimeData.Length; + lpStartupInfo->lpReserved2 = (LPBYTE)Params->RuntimeData.Buffer; + + lpStartupInfo->hStdInput = Params->StandardInput; + lpStartupInfo->hStdOutput = Params->StandardOutput; + lpStartupInfo->hStdError = Params->StandardError; +} + + +/* + * @implemented + */ +VOID +WINAPI +GetStartupInfoA(LPSTARTUPINFOA lpStartupInfo) +{ + PRTL_USER_PROCESS_PARAMETERS Params; + ANSI_STRING AnsiString; + + if (lpStartupInfo == NULL) + { + SetLastError(ERROR_INVALID_PARAMETER); + return; + } + + Params = NtCurrentPeb ()->ProcessParameters; + + RtlAcquirePebLock (); + + /* FIXME - not thread-safe */ + if (lpLocalStartupInfo == NULL) + { + /* create new local startup info (ansi) */ + lpLocalStartupInfo = RtlAllocateHeap(RtlGetProcessHeap(), + 0, + sizeof(STARTUPINFOA)); + if (lpLocalStartupInfo == NULL) + { + RtlReleasePebLock(); + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return; + } + + lpLocalStartupInfo->cb = sizeof(STARTUPINFOA); + + /* copy window title string */ + RtlUnicodeStringToAnsiString(&AnsiString, + &Params->WindowTitle, + TRUE); + lpLocalStartupInfo->lpTitle = AnsiString.Buffer; + + /* copy desktop info string */ + RtlUnicodeStringToAnsiString(&AnsiString, + &Params->DesktopInfo, + TRUE); + lpLocalStartupInfo->lpDesktop = AnsiString.Buffer; + + /* copy shell info string */ + RtlUnicodeStringToAnsiString(&AnsiString, + &Params->ShellInfo, + TRUE); + lpLocalStartupInfo->lpReserved = AnsiString.Buffer; + + lpLocalStartupInfo->dwX = Params->StartingX; + lpLocalStartupInfo->dwY = Params->StartingY; + lpLocalStartupInfo->dwXSize = Params->CountX; + lpLocalStartupInfo->dwYSize = Params->CountY; + lpLocalStartupInfo->dwXCountChars = Params->CountCharsX; + lpLocalStartupInfo->dwYCountChars = Params->CountCharsY; + lpLocalStartupInfo->dwFillAttribute = Params->FillAttribute; + lpLocalStartupInfo->dwFlags = Params->WindowFlags; + lpLocalStartupInfo->wShowWindow = (WORD)Params->ShowWindowFlags; + lpLocalStartupInfo->cbReserved2 = Params->RuntimeData.Length; + lpLocalStartupInfo->lpReserved2 = (LPBYTE)Params->RuntimeData.Buffer; + + lpLocalStartupInfo->hStdInput = Params->StandardInput; + lpLocalStartupInfo->hStdOutput = Params->StandardOutput; + lpLocalStartupInfo->hStdError = Params->StandardError; + } + + RtlReleasePebLock(); + + /* copy local startup info data to external startup info */ + memcpy(lpStartupInfo, + lpLocalStartupInfo, + sizeof(STARTUPINFOA)); +} + + +/* + * @implemented + */ +BOOL +WINAPI +FlushInstructionCache(HANDLE hProcess, + LPCVOID lpBaseAddress, + SIZE_T dwSize) +{ + NTSTATUS Status; + + Status = NtFlushInstructionCache(hProcess, + (PVOID)lpBaseAddress, + dwSize); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + return TRUE; +} + + +/* + * @implemented + */ +VOID +WINAPI +ExitProcess(UINT uExitCode) +{ + CSR_API_MESSAGE CsrRequest; + ULONG Request; + NTSTATUS Status; + + /* kill sibling threads ... we want to be alone at this point */ + NtTerminateProcess(NULL, 0); + + /* unload all dll's */ + LdrShutdownProcess(); + + /* notify csrss of process termination */ + Request = TERMINATE_PROCESS; + Status = CsrClientCallServer(&CsrRequest, + NULL, + MAKE_CSR_API(Request, CSR_NATIVE), + sizeof(CSR_API_MESSAGE)); + if (!NT_SUCCESS(Status) || !NT_SUCCESS(CsrRequest.Status)) + { + DPRINT("Failed to tell csrss about terminating process\n"); + } + + NtTerminateProcess(NtCurrentProcess (), + uExitCode); + + /* should never get here */ + ASSERT(0); + while(1); +} + + +/* + * @implemented + */ +BOOL +WINAPI +TerminateProcess(HANDLE hProcess, + UINT uExitCode) +{ + NTSTATUS Status; + + if (hProcess == NULL) + { + return FALSE; + } + + Status = NtTerminateProcess(hProcess, uExitCode); + if (NT_SUCCESS(Status)) + { + return TRUE; + } + + BaseSetLastNTError(Status); + return FALSE; +} + + +/* + * @unimplemented + */ +VOID +WINAPI +FatalAppExitA(UINT uAction, + LPCSTR lpMessageText) +{ + UNICODE_STRING MessageTextU; + ANSI_STRING MessageText; + + RtlInitAnsiString(&MessageText, (LPSTR)lpMessageText); + + RtlAnsiStringToUnicodeString(&MessageTextU, + &MessageText, + TRUE); + + FatalAppExitW(uAction, MessageTextU.Buffer); + + RtlFreeUnicodeString(&MessageTextU); +} + + +/* + * @unimplemented + */ +VOID +WINAPI +FatalAppExitW(UINT uAction, + LPCWSTR lpMessageText) +{ + static const WCHAR szUser32[] = L"user32.dll\0"; + + HMODULE hModule = GetModuleHandleW(szUser32); + MessageBoxW_Proc pMessageBoxW = NULL; + + DPRINT1("AppExit\n"); + + if (hModule) + pMessageBoxW = (MessageBoxW_Proc)GetProcAddress(hModule, "MessageBoxW"); + + if (pMessageBoxW) + pMessageBoxW(0, lpMessageText, NULL, MB_SYSTEMMODAL | MB_OK); + else + DPRINT1("%s\n", lpMessageText); + + ExitProcess(0); +} + + +/* + * @implemented + */ +VOID +WINAPI +FatalExit(int ExitCode) +{ + ExitProcess(ExitCode); +} + + +/* + * @implemented + */ +DWORD +WINAPI +GetPriorityClass(HANDLE hProcess) +{ + NTSTATUS Status; + PROCESS_PRIORITY_CLASS PriorityClass; + + Status = NtQueryInformationProcess(hProcess, + ProcessPriorityClass, + &PriorityClass, + sizeof(PROCESS_PRIORITY_CLASS), + NULL); + if(NT_SUCCESS(Status)) + { + switch(PriorityClass.PriorityClass) + { + case PROCESS_PRIORITY_CLASS_IDLE: + return IDLE_PRIORITY_CLASS; + + case PROCESS_PRIORITY_CLASS_BELOW_NORMAL: + return BELOW_NORMAL_PRIORITY_CLASS; + + case PROCESS_PRIORITY_CLASS_NORMAL: + return NORMAL_PRIORITY_CLASS; + + case PROCESS_PRIORITY_CLASS_ABOVE_NORMAL: + return ABOVE_NORMAL_PRIORITY_CLASS; + + case PROCESS_PRIORITY_CLASS_HIGH: + return HIGH_PRIORITY_CLASS; + + case PROCESS_PRIORITY_CLASS_REALTIME: + return REALTIME_PRIORITY_CLASS; + + default: + return NORMAL_PRIORITY_CLASS; + } + } + + BaseSetLastNTError(Status); + return FALSE; +} + + +/* + * @implemented + */ +BOOL +WINAPI +SetPriorityClass(HANDLE hProcess, + DWORD dwPriorityClass) +{ + NTSTATUS Status; + PROCESS_PRIORITY_CLASS PriorityClass; + + switch (dwPriorityClass) + { + case IDLE_PRIORITY_CLASS: + PriorityClass.PriorityClass = PROCESS_PRIORITY_CLASS_IDLE; + break; + + case BELOW_NORMAL_PRIORITY_CLASS: + PriorityClass.PriorityClass = PROCESS_PRIORITY_CLASS_BELOW_NORMAL; + break; + + case NORMAL_PRIORITY_CLASS: + PriorityClass.PriorityClass = PROCESS_PRIORITY_CLASS_NORMAL; + break; + + case ABOVE_NORMAL_PRIORITY_CLASS: + PriorityClass.PriorityClass = PROCESS_PRIORITY_CLASS_ABOVE_NORMAL; + break; + + case HIGH_PRIORITY_CLASS: + PriorityClass.PriorityClass = PROCESS_PRIORITY_CLASS_HIGH; + break; + + case REALTIME_PRIORITY_CLASS: + PriorityClass.PriorityClass = PROCESS_PRIORITY_CLASS_REALTIME; + break; + + default: + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + PriorityClass.Foreground = FALSE; + + Status = NtSetInformationProcess(hProcess, + ProcessPriorityClass, + &PriorityClass, + sizeof(PROCESS_PRIORITY_CLASS)); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + return TRUE; +} + + +/* + * @implemented + */ +DWORD +WINAPI +GetProcessVersion(DWORD ProcessId) +{ + DWORD Version = 0; + PIMAGE_NT_HEADERS NtHeader = NULL; + IMAGE_NT_HEADERS NtHeaders; + IMAGE_DOS_HEADER DosHeader; + PROCESS_BASIC_INFORMATION ProcessBasicInfo; + PVOID BaseAddress = NULL; + HANDLE ProcessHandle = NULL; + NTSTATUS Status; + SIZE_T Count; + PEB Peb; + + _SEH2_TRY + { + if (0 == ProcessId || GetCurrentProcessId() == ProcessId) + { + /* Caller's */ + BaseAddress = (PVOID) NtCurrentPeb()->ImageBaseAddress; + NtHeader = RtlImageNtHeader(BaseAddress); + + Version = (NtHeader->OptionalHeader.MajorOperatingSystemVersion << 16) | + (NtHeader->OptionalHeader.MinorOperatingSystemVersion); + } + else + { + /* Other process */ + ProcessHandle = OpenProcess(PROCESS_VM_READ | PROCESS_QUERY_INFORMATION, + FALSE, + ProcessId); + + if (!ProcessHandle) return 0; + + Status = NtQueryInformationProcess(ProcessHandle, + ProcessBasicInformation, + &ProcessBasicInfo, + sizeof(ProcessBasicInfo), + NULL); + + if (!NT_SUCCESS(Status)) goto Error; + + Status = NtReadVirtualMemory(ProcessHandle, + ProcessBasicInfo.PebBaseAddress, + &Peb, + sizeof(Peb), + &Count); + + if (!NT_SUCCESS(Status) || Count != sizeof(Peb)) goto Error; + + memset(&DosHeader, 0, sizeof(DosHeader)); + Status = NtReadVirtualMemory(ProcessHandle, + Peb.ImageBaseAddress, + &DosHeader, + sizeof(DosHeader), + &Count); + + if (!NT_SUCCESS(Status) || Count != sizeof(DosHeader)) goto Error; + if (DosHeader.e_magic != IMAGE_DOS_SIGNATURE) goto Error; + + memset(&NtHeaders, 0, sizeof(NtHeaders)); + Status = NtReadVirtualMemory(ProcessHandle, + (char *)Peb.ImageBaseAddress + DosHeader.e_lfanew, + &NtHeaders, + sizeof(NtHeaders), + &Count); + + if (!NT_SUCCESS(Status) || Count != sizeof(NtHeaders)) goto Error; + if (NtHeaders.Signature != IMAGE_NT_SIGNATURE) goto Error; + + Version = MAKELONG(NtHeaders.OptionalHeader.MinorSubsystemVersion, + NtHeaders.OptionalHeader.MajorSubsystemVersion); + +Error: + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + } + } + } + _SEH2_FINALLY + { + if (ProcessHandle) CloseHandle(ProcessHandle); + } + _SEH2_END; + + return Version; +} + + +/* + * @implemented + */ +BOOL +WINAPI +GetProcessIoCounters(HANDLE hProcess, + PIO_COUNTERS lpIoCounters) +{ + NTSTATUS Status; + + Status = NtQueryInformationProcess(hProcess, + ProcessIoCounters, + lpIoCounters, + sizeof(IO_COUNTERS), + NULL); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + return TRUE; +} + + +/* + * @implemented + */ +BOOL +WINAPI +GetProcessPriorityBoost(HANDLE hProcess, + PBOOL pDisablePriorityBoost) +{ + NTSTATUS Status; + ULONG PriorityBoost; + + Status = NtQueryInformationProcess(hProcess, + ProcessPriorityBoost, + &PriorityBoost, + sizeof(ULONG), + NULL); + if (NT_SUCCESS(Status)) + { + *pDisablePriorityBoost = PriorityBoost; + return TRUE; + } + + BaseSetLastNTError(Status); + return FALSE; +} + + +/* + * @implemented + */ +BOOL +WINAPI +SetProcessPriorityBoost(HANDLE hProcess, + BOOL bDisablePriorityBoost) +{ + NTSTATUS Status; + ULONG PriorityBoost = (bDisablePriorityBoost ? TRUE : FALSE); /* prevent setting values other than 1 and 0 */ + + Status = NtSetInformationProcess(hProcess, + ProcessPriorityBoost, + &PriorityBoost, + sizeof(ULONG)); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + return TRUE; +} + + +/* + * @implemented + */ +BOOL +WINAPI +GetProcessHandleCount(HANDLE hProcess, + PDWORD pdwHandleCount) +{ + ULONG phc; + NTSTATUS Status; + + Status = NtQueryInformationProcess(hProcess, + ProcessHandleCount, + &phc, + sizeof(ULONG), + NULL); + if(NT_SUCCESS(Status)) + { + *pdwHandleCount = phc; + return TRUE; + } + + BaseSetLastNTError(Status); + return FALSE; +} + + +/* + * @implemented + */ +BOOL +WINAPI +IsWow64Process(HANDLE hProcess, + PBOOL Wow64Process) +{ + ULONG_PTR pbi; + NTSTATUS Status; + + Status = NtQueryInformationProcess(hProcess, + ProcessWow64Information, + &pbi, + sizeof(pbi), + NULL); + if (!NT_SUCCESS(Status)) + { + SetLastError(RtlNtStatusToDosError(Status)); + return FALSE; + } + + *Wow64Process = (pbi != 0); + + return TRUE; +} + +/* + * @implemented + */ +LPSTR +WINAPI +GetCommandLineA(VOID) +{ + DPRINT("CommandLine \'%s\'\n", CommandLineStringA.Buffer); + return CommandLineStringA.Buffer; +} + + +/* + * @implemented + */ +LPWSTR +WINAPI +GetCommandLineW(VOID) +{ + DPRINT("CommandLine \'%S\'\n", CommandLineStringW.Buffer); + return CommandLineStringW.Buffer; +} + +/* + * @implemented + */ +BOOL +NTAPI +ReadProcessMemory(IN HANDLE hProcess, + IN LPCVOID lpBaseAddress, + IN LPVOID lpBuffer, + IN SIZE_T nSize, + OUT SIZE_T* lpNumberOfBytesRead) +{ + NTSTATUS Status; + + /* Do the read */ + Status = NtReadVirtualMemory(hProcess, + (PVOID)lpBaseAddress, + lpBuffer, + nSize, + lpNumberOfBytesRead); + if (!NT_SUCCESS(Status)) + { + /* We failed */ + BaseSetLastNTError (Status); + return FALSE; + } + + /* Return success */ + return TRUE; +} + +/* + * @implemented + */ +BOOL +NTAPI +WriteProcessMemory(IN HANDLE hProcess, + IN LPVOID lpBaseAddress, + IN LPCVOID lpBuffer, + IN SIZE_T nSize, + OUT SIZE_T *lpNumberOfBytesWritten) +{ + NTSTATUS Status; + ULONG OldValue; + SIZE_T RegionSize; + PVOID Base; + BOOLEAN UnProtect; + + /* Set parameters for protect call */ + RegionSize = nSize; + Base = lpBaseAddress; + + /* Check the current status */ + Status = NtProtectVirtualMemory(hProcess, + &Base, + &RegionSize, + PAGE_EXECUTE_READWRITE, + &OldValue); + if (NT_SUCCESS(Status)) + { + /* Check if we are unprotecting */ + UnProtect = OldValue & (PAGE_READWRITE | + PAGE_WRITECOPY | + PAGE_EXECUTE_READWRITE | + PAGE_EXECUTE_WRITECOPY) ? FALSE : TRUE; + if (!UnProtect) + { + /* Set the new protection */ + Status = NtProtectVirtualMemory(hProcess, + &Base, + &RegionSize, + OldValue, + &OldValue); + + /* Write the memory */ + Status = NtWriteVirtualMemory(hProcess, + lpBaseAddress, + (LPVOID)lpBuffer, + nSize, + lpNumberOfBytesWritten); + if (!NT_SUCCESS(Status)) + { + /* We failed */ + BaseSetLastNTError(Status); + return FALSE; + } + + /* Flush the ITLB */ + NtFlushInstructionCache(hProcess, lpBaseAddress, nSize); + return TRUE; + } + else + { + /* Check if we were read only */ + if ((OldValue & PAGE_NOACCESS) || (OldValue & PAGE_READONLY)) + { + /* Restore protection and fail */ + NtProtectVirtualMemory(hProcess, + &Base, + &RegionSize, + OldValue, + &OldValue); + BaseSetLastNTError(STATUS_ACCESS_VIOLATION); + return FALSE; + } + + /* Otherwise, do the write */ + Status = NtWriteVirtualMemory(hProcess, + lpBaseAddress, + (LPVOID)lpBuffer, + nSize, + lpNumberOfBytesWritten); + + /* And restore the protection */ + NtProtectVirtualMemory(hProcess, + &Base, + &RegionSize, + OldValue, + &OldValue); + if (!NT_SUCCESS(Status)) + { + /* We failed */ + BaseSetLastNTError(STATUS_ACCESS_VIOLATION); + return FALSE; + } + + /* Flush the ITLB */ + NtFlushInstructionCache(hProcess, lpBaseAddress, nSize); + return TRUE; + } + } + else + { + /* We failed */ + BaseSetLastNTError(Status); + return FALSE; + } +} + +/* + * @implemented + */ +BOOL +WINAPI +ProcessIdToSessionId(IN DWORD dwProcessId, + OUT DWORD *pSessionId) +{ + PROCESS_SESSION_INFORMATION SessionInformation; + OBJECT_ATTRIBUTES ObjectAttributes; + CLIENT_ID ClientId; + HANDLE ProcessHandle; + NTSTATUS Status; + + if (IsBadWritePtr(pSessionId, sizeof(DWORD))) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + ClientId.UniqueProcess = UlongToHandle(dwProcessId); + ClientId.UniqueThread = 0; + + InitializeObjectAttributes(&ObjectAttributes, NULL, 0, NULL, NULL); + + Status = NtOpenProcess(&ProcessHandle, + PROCESS_QUERY_INFORMATION, + &ObjectAttributes, + &ClientId); + if (NT_SUCCESS(Status)) + { + Status = NtQueryInformationProcess(ProcessHandle, + ProcessSessionInformation, + &SessionInformation, + sizeof(SessionInformation), + NULL); + NtClose(ProcessHandle); + + if (NT_SUCCESS(Status)) + { + *pSessionId = SessionInformation.SessionId; + return TRUE; + } + } + + BaseSetLastNTError(Status); + return FALSE; +} + +BOOL +WINAPI +SetProcessWorkingSetSizeEx(IN HANDLE hProcess, + IN SIZE_T dwMinimumWorkingSetSize, + IN SIZE_T dwMaximumWorkingSetSize, + IN DWORD Flags) +{ + STUB; + return FALSE; +} + + +BOOL +WINAPI +GetProcessWorkingSetSizeEx(IN HANDLE hProcess, + OUT PSIZE_T lpMinimumWorkingSetSize, + OUT PSIZE_T lpMaximumWorkingSetSize, + OUT PDWORD Flags) +{ + STUB; + return FALSE; +} /* * @implemented @@ -1167,13 +2459,13 @@ GetAppName: { /* Fake the error */ CloseHandle(hFile); - SetLastErrorByStatus(STATUS_OBJECT_NAME_NOT_FOUND); + BaseSetLastNTError(STATUS_OBJECT_NAME_NOT_FOUND); } } else { /* Immediately set the error */ - SetLastErrorByStatus(STATUS_OBJECT_NAME_NOT_FOUND); + BaseSetLastNTError(STATUS_OBJECT_NAME_NOT_FOUND); } /* Did we already fail once? */ @@ -1332,7 +2624,7 @@ GetAppName: case STATUS_OBJECT_NAME_NOT_FOUND: case STATUS_OBJECT_PATH_NOT_FOUND: - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); goto Cleanup; default: @@ -1361,7 +2653,7 @@ GetAppName: if(!NT_SUCCESS(Status)) { DPRINT1("Unable to get SectionImageInformation, status 0x%x\n", Status); - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); goto Cleanup; } @@ -1412,7 +2704,7 @@ GetAppName: if (!NT_SUCCESS(Status)) { DPRINT1("Failed to connect to DbgUI!\n"); - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); goto Cleanup; } @@ -1438,7 +2730,7 @@ GetAppName: if (!NT_SUCCESS(Status)) { DPRINT1("Unable to create process, status 0x%x\n", Status); - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); goto Cleanup; } @@ -1452,7 +2744,7 @@ GetAppName: if(!NT_SUCCESS(Status)) { DPRINT1("Unable to set new process priority, status 0x%x\n", Status); - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); goto Cleanup; } } @@ -1595,7 +2887,7 @@ GetAppName: if (!NT_SUCCESS(Status)) { DPRINT1("Could not initialize Process Environment\n"); - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); goto Cleanup; } @@ -1641,7 +2933,7 @@ GetAppName: if (!NT_SUCCESS(Status)) { DPRINT1("CSR Notification Failed"); - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); goto Cleanup; } diff --git a/dll/win32/kernel32/client/resntfy.c b/dll/win32/kernel32/client/resntfy.c new file mode 100644 index 00000000000..ac78a1ec0ca --- /dev/null +++ b/dll/win32/kernel32/client/resntfy.c @@ -0,0 +1,95 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS Win32 Base API + * FILE: dll/win32/kernel32/client/resnotify.c + * PURPOSE: Memory Resource Notifications + * PROGRAMMER: Thomas Weidenmueller + */ + +/* INCLUDES *******************************************************************/ + +#include + +#define NDEBUG +#include + +/* FUNCTIONS ******************************************************************/ + +/* + * @implemented + */ +HANDLE +WINAPI +CreateMemoryResourceNotification(IN MEMORY_RESOURCE_NOTIFICATION_TYPE NotificationType) +{ + UNICODE_STRING EventName; + OBJECT_ATTRIBUTES ObjectAttributes; + HANDLE hEvent; + NTSTATUS Status; + + if (NotificationType > HighMemoryResourceNotification) + { + SetLastError(ERROR_INVALID_PARAMETER); + return NULL; + } + + RtlInitUnicodeString(&EventName, + NotificationType ? + L"\\KernelObjects\\HighMemoryCondition" : + L"\\KernelObjects\\LowMemoryCondition"); + + InitializeObjectAttributes(&ObjectAttributes, + &EventName, + 0, + hBaseDir, + NULL); + + Status = NtOpenEvent(&hEvent, + EVENT_QUERY_STATE | SYNCHRONIZE, + &ObjectAttributes); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return NULL; + } + + return hEvent; +} + +/* + * @implemented + */ +BOOL +WINAPI +QueryMemoryResourceNotification(IN HANDLE ResourceNotificationHandle, + OUT PBOOL ResourceState) +{ + EVENT_BASIC_INFORMATION EventInfo; + NTSTATUS Status; + + if ((ResourceNotificationHandle) && + (ResourceNotificationHandle != INVALID_HANDLE_VALUE) && + (ResourceState)) + { + Status = NtQueryEvent(ResourceNotificationHandle, + EventBasicInformation, + &EventInfo, + sizeof(EventInfo), + NULL); + if (NT_SUCCESS(Status)) + { + *ResourceState = (EventInfo.EventState == 1); + return TRUE; + } + + BaseSetLastNTError(Status); + } + else + { + SetLastError(ERROR_INVALID_PARAMETER); + } + + return FALSE; +} + +/* EOF */ diff --git a/dll/win32/kernel32/client/session.c b/dll/win32/kernel32/client/session.c new file mode 100644 index 00000000000..496c05e3a1d --- /dev/null +++ b/dll/win32/kernel32/client/session.c @@ -0,0 +1,54 @@ +/* + * PROJECT: ReactOS Win32 Base API + * LICENSE: GPL - See COPYING in the top level directory + * FILE: dll/win32/kernel32/client/session.c + * PURPOSE: Session Support APIs + * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org) + */ + +/* INCLUDES *******************************************************************/ + +#include + +#define NDEBUG +#include + +/* FUNCTIONS ******************************************************************/ + +/* + * @unimplemented + */ +DWORD +WINAPI +DosPathToSessionPathW(IN DWORD SessionID, + IN LPWSTR InPath, + OUT LPWSTR *OutPath) +{ + UNIMPLEMENTED; + return 0; +} + +/* + * @unimplemented + */ +DWORD +WINAPI +DosPathToSessionPathA(IN DWORD SessionId, + IN LPSTR InPath, + OUT LPSTR *OutPath) +{ + UNIMPLEMENTED; + return 0; +} + +/* + * @implemented + */ +DWORD +WINAPI +WTSGetActiveConsoleSessionId(VOID) +{ + return SharedUserData->ActiveConsoleId; +} + +/* EOF */ diff --git a/dll/win32/kernel32/client/synch.c b/dll/win32/kernel32/client/synch.c new file mode 100644 index 00000000000..83e82a448b1 --- /dev/null +++ b/dll/win32/kernel32/client/synch.c @@ -0,0 +1,859 @@ +/* + * PROJECT: ReactOS Win32 Base API + * LICENSE: GPL - See COPYING in the top level directory + * FILE: dll/win32/kernel32/synch/wait.c + * PURPOSE: Wrappers for the NT Wait Implementation + * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org) + */ + +/* INCLUDES *****************************************************************/ +#include + +#define NDEBUG +#include + +/* FUNCTIONS *****************************************************************/ + +/* + * @implemented + */ +DWORD +WINAPI +WaitForSingleObject(IN HANDLE hHandle, + IN DWORD dwMilliseconds) +{ + /* Call the extended API */ + return WaitForSingleObjectEx(hHandle, dwMilliseconds, FALSE); +} + +/* + * @implemented + */ +DWORD +WINAPI +WaitForSingleObjectEx(IN HANDLE hHandle, + IN DWORD dwMilliseconds, + IN BOOL bAlertable) +{ + PLARGE_INTEGER TimePtr; + LARGE_INTEGER Time; + NTSTATUS Status; + RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME ActCtx; + + /* APCs must execute with the default activation context */ + if (bAlertable) + { + /* Setup the frame */ + RtlZeroMemory(&ActCtx, sizeof(ActCtx)); + ActCtx.Size = sizeof(ActCtx); + ActCtx.Format = RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_FORMAT_WHISTLER; + RtlActivateActivationContextUnsafeFast(&ActCtx, NULL); + } + + /* Get real handle */ + hHandle = TranslateStdHandle(hHandle); + + /* Check for console handle */ + if ((IsConsoleHandle(hHandle)) && (VerifyConsoleIoHandle(hHandle))) + { + /* Get the real wait handle */ + hHandle = GetConsoleInputWaitHandle(); + } + + /* Convert the timeout */ + TimePtr = BaseFormatTimeOut(&Time, dwMilliseconds); + + /* Start wait loop */ + do + { + /* Do the wait */ + Status = NtWaitForSingleObject(hHandle, (BOOLEAN)bAlertable, TimePtr); + if (!NT_SUCCESS(Status)) + { + /* The wait failed */ + BaseSetLastNTError(Status); + Status = WAIT_FAILED; + } + } while ((Status == STATUS_ALERTED) && (bAlertable)); + + /* Cleanup the activation context */ + if (bAlertable) RtlDeactivateActivationContextUnsafeFast(&ActCtx); + + /* Return wait status */ + return Status; +} + +/* + * @implemented + */ +DWORD +WINAPI +WaitForMultipleObjects(IN DWORD nCount, + IN CONST HANDLE *lpHandles, + IN BOOL bWaitAll, + IN DWORD dwMilliseconds) +{ + /* Call the extended API */ + return WaitForMultipleObjectsEx(nCount, + lpHandles, + bWaitAll, + dwMilliseconds, + FALSE); +} + +/* + * @implemented + */ +DWORD +WINAPI +WaitForMultipleObjectsEx(IN DWORD nCount, + IN CONST HANDLE *lpHandles, + IN BOOL bWaitAll, + IN DWORD dwMilliseconds, + IN BOOL bAlertable) +{ + PLARGE_INTEGER TimePtr; + LARGE_INTEGER Time; + PHANDLE HandleBuffer; + HANDLE Handle[8]; + DWORD i; + NTSTATUS Status; + RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME ActCtx; + + /* APCs must execute with the default activation context */ + if (bAlertable) + { + /* Setup the frame */ + RtlZeroMemory(&ActCtx, sizeof(ActCtx)); + ActCtx.Size = sizeof(ActCtx); + ActCtx.Format = RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_FORMAT_WHISTLER; + RtlActivateActivationContextUnsafeFast(&ActCtx, NULL); + } + + /* Check if we have more handles then we locally optimize */ + if (nCount > 8) + { + /* Allocate a buffer for them */ + HandleBuffer = RtlAllocateHeap(RtlGetProcessHeap(), + 0, + nCount * sizeof(HANDLE)); + if (!HandleBuffer) + { + /* No buffer, fail the wait */ + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + if (bAlertable) RtlDeactivateActivationContextUnsafeFast(&ActCtx); + return WAIT_FAILED; + } + } + else + { + /* Otherwise, use our local buffer */ + HandleBuffer = Handle; + } + + /* Copy the handles into our buffer and loop them all */ + RtlCopyMemory(HandleBuffer, (LPVOID)lpHandles, nCount * sizeof(HANDLE)); + for (i = 0; i < nCount; i++) + { + /* Check what kind of handle this is */ + HandleBuffer[i] = TranslateStdHandle(HandleBuffer[i]); + + /* Check for console handle */ + if ((IsConsoleHandle(HandleBuffer[i])) && + (VerifyConsoleIoHandle(HandleBuffer[i]))) + { + /* Get the real wait handle */ + HandleBuffer[i] = GetConsoleInputWaitHandle(); + } + } + + /* Convert the timeout */ + TimePtr = BaseFormatTimeOut(&Time, dwMilliseconds); + + /* Start wait loop */ + do + { + /* Do the wait */ + Status = NtWaitForMultipleObjects(nCount, + HandleBuffer, + bWaitAll ? WaitAll : WaitAny, + (BOOLEAN)bAlertable, + TimePtr); + if (!NT_SUCCESS(Status)) + { + /* Wait failed */ + BaseSetLastNTError(Status); + Status = WAIT_FAILED; + } + } while ((Status == STATUS_ALERTED) && (bAlertable)); + + /* Check if we didn't use our local buffer */ + if (HandleBuffer != Handle) + { + /* Free the allocated one */ + RtlFreeHeap(RtlGetProcessHeap(), 0, HandleBuffer); + } + + /* Cleanup the activation context */ + if (bAlertable) RtlDeactivateActivationContextUnsafeFast(&ActCtx); + + /* Return wait status */ + return Status; +} + +/* + * @implemented + */ +DWORD +WINAPI +SignalObjectAndWait(IN HANDLE hObjectToSignal, + IN HANDLE hObjectToWaitOn, + IN DWORD dwMilliseconds, + IN BOOL bAlertable) +{ + PLARGE_INTEGER TimePtr; + LARGE_INTEGER Time; + NTSTATUS Status; + RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME ActCtx; + + /* APCs must execute with the default activation context */ + if (bAlertable) + { + /* Setup the frame */ + RtlZeroMemory(&ActCtx, sizeof(ActCtx)); + ActCtx.Size = sizeof(ActCtx); + ActCtx.Format = RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_FORMAT_WHISTLER; + RtlActivateActivationContextUnsafeFast(&ActCtx, NULL); + } + + /* Get real handle */ + hObjectToWaitOn = TranslateStdHandle(hObjectToWaitOn); + + /* Check for console handle */ + if ((IsConsoleHandle(hObjectToWaitOn)) && + (VerifyConsoleIoHandle(hObjectToWaitOn))) + { + /* Get the real wait handle */ + hObjectToWaitOn = GetConsoleInputWaitHandle(); + } + + /* Convert the timeout */ + TimePtr = BaseFormatTimeOut(&Time, dwMilliseconds); + + /* Start wait loop */ + do + { + /* Do the wait */ + Status = NtSignalAndWaitForSingleObject(hObjectToSignal, + hObjectToWaitOn, + (BOOLEAN)bAlertable, + TimePtr); + if (!NT_SUCCESS(Status)) + { + /* The wait failed */ + BaseSetLastNTError(Status); + Status = WAIT_FAILED; + } + } while ((Status == STATUS_ALERTED) && (bAlertable)); + + /* Cleanup the activation context */ + if (bAlertable) RtlDeactivateActivationContextUnsafeFast(&ActCtx); + + /* Return wait status */ + return Status; +} + +/* + * @implemented + */ +HANDLE +WINAPI +CreateWaitableTimerW(IN LPSECURITY_ATTRIBUTES lpTimerAttributes OPTIONAL, + IN BOOL bManualReset, + IN LPCWSTR lpTimerName OPTIONAL) +{ + CreateNtObjectFromWin32Api(WaitableTimer, Timer, TIMER, + lpTimerAttributes, + lpTimerName, + bManualReset ? NotificationTimer : SynchronizationTimer); +} + +/* + * @implemented + */ +HANDLE +WINAPI +CreateWaitableTimerA(IN LPSECURITY_ATTRIBUTES lpTimerAttributes OPTIONAL, + IN BOOL bManualReset, + IN LPCSTR lpTimerName OPTIONAL) +{ + ConvertWin32AnsiObjectApiToUnicodeApi(WaitableTimer, lpTimerName, lpTimerAttributes, bManualReset); +} + +/* + * @implemented + */ +HANDLE +WINAPI +OpenWaitableTimerW(IN DWORD dwDesiredAccess, + IN BOOL bInheritHandle, + IN LPCWSTR lpTimerName) +{ + OpenNtObjectFromWin32Api(Timer, dwDesiredAccess, bInheritHandle, lpTimerName); +} + +/* + * @implemented + */ +HANDLE +WINAPI +OpenWaitableTimerA(IN DWORD dwDesiredAccess, + IN BOOL bInheritHandle, + IN LPCSTR lpTimerName) +{ + ConvertOpenWin32AnsiObjectApiToUnicodeApi(WaitableTimer, dwDesiredAccess, bInheritHandle, lpTimerName); +} + +/* + * @implemented + */ +BOOL +WINAPI +SetWaitableTimer(IN HANDLE hTimer, + IN const LARGE_INTEGER *pDueTime, + IN LONG lPeriod, + IN PTIMERAPCROUTINE pfnCompletionRoutine OPTIONAL, + IN OPTIONAL LPVOID lpArgToCompletionRoutine, + IN BOOL fResume) +{ + NTSTATUS Status; + + /* Set the timer */ + Status = NtSetTimer(hTimer, + (PLARGE_INTEGER)pDueTime, + (PTIMER_APC_ROUTINE)pfnCompletionRoutine, + lpArgToCompletionRoutine, + (BOOLEAN)fResume, + lPeriod, + NULL); + if (NT_SUCCESS(Status)) return TRUE; + + /* If we got here, then we failed */ + BaseSetLastNTError(Status); + return FALSE; +} + +/* + * @implemented + */ +BOOL +WINAPI +CancelWaitableTimer(IN HANDLE hTimer) +{ + NTSTATUS Status; + + /* Cancel the timer */ + Status = NtCancelTimer(hTimer, NULL); + if (NT_SUCCESS(Status)) return TRUE; + + /* If we got here, then we failed */ + BaseSetLastNTError(Status); + return FALSE; +} + +/* + * @implemented + */ +HANDLE +WINAPI +CreateSemaphoreA(IN LPSECURITY_ATTRIBUTES lpSemaphoreAttributes OPTIONAL, + IN LONG lInitialCount, + IN LONG lMaximumCount, + IN LPCSTR lpName OPTIONAL) +{ + ConvertWin32AnsiObjectApiToUnicodeApi(Semaphore, lpName, lpSemaphoreAttributes, lInitialCount, lMaximumCount); +} + +/* + * @implemented + */ +HANDLE +WINAPI +CreateSemaphoreW(IN LPSECURITY_ATTRIBUTES lpSemaphoreAttributes OPTIONAL, + IN LONG lInitialCount, + IN LONG lMaximumCount, + IN LPCWSTR lpName OPTIONAL) +{ + CreateNtObjectFromWin32Api(Semaphore, Semaphore, SEMAPHORE, + lpSemaphoreAttributes, + lpName, + lInitialCount, + lMaximumCount); +} + +/* + * @implemented + */ +HANDLE +WINAPI +OpenSemaphoreA(IN DWORD dwDesiredAccess, + IN BOOL bInheritHandle, + IN LPCSTR lpName) +{ + ConvertOpenWin32AnsiObjectApiToUnicodeApi(Semaphore, dwDesiredAccess, bInheritHandle, lpName); +} + +/* + * @implemented + */ +HANDLE +WINAPI +OpenSemaphoreW(IN DWORD dwDesiredAccess, + IN BOOL bInheritHandle, + IN LPCWSTR lpName) +{ + OpenNtObjectFromWin32Api(Semaphore, dwDesiredAccess, bInheritHandle, lpName); +} + +/* + * @implemented + */ +BOOL +WINAPI +ReleaseSemaphore(IN HANDLE hSemaphore, + IN LONG lReleaseCount, + IN LPLONG lpPreviousCount) +{ + NTSTATUS Status; + + /* Release the semaphore */ + Status = NtReleaseSemaphore(hSemaphore, lReleaseCount, lpPreviousCount); + if (NT_SUCCESS(Status)) return TRUE; + + /* If we got here, then we failed */ + BaseSetLastNTError(Status); + return FALSE; +} + +/* + * @implemented + */ +HANDLE +WINAPI +CreateMutexA(IN LPSECURITY_ATTRIBUTES lpMutexAttributes OPTIONAL, + IN BOOL bInitialOwner, + IN LPCSTR lpName OPTIONAL) +{ + ConvertWin32AnsiObjectApiToUnicodeApi(Mutex, lpName, lpMutexAttributes, bInitialOwner); +} + +/* + * @implemented + */ +HANDLE +WINAPI +CreateMutexW(IN LPSECURITY_ATTRIBUTES lpMutexAttributes OPTIONAL, + IN BOOL bInitialOwner, + IN LPCWSTR lpName OPTIONAL) +{ + CreateNtObjectFromWin32Api(Mutex, Mutant, MUTEX, + lpMutexAttributes, + lpName, + bInitialOwner); +} + +/* + * @implemented + */ +HANDLE +WINAPI +OpenMutexA(IN DWORD dwDesiredAccess, + IN BOOL bInheritHandle, + IN LPCSTR lpName) +{ + ConvertOpenWin32AnsiObjectApiToUnicodeApi(Mutex, dwDesiredAccess, bInheritHandle, lpName); +} + +/* + * @implemented + */ +HANDLE +WINAPI +OpenMutexW(IN DWORD dwDesiredAccess, + IN BOOL bInheritHandle, + IN LPCWSTR lpName) +{ + OpenNtObjectFromWin32Api(Mutant, dwDesiredAccess, bInheritHandle, lpName); +} + +/* + * @implemented + */ +BOOL +WINAPI +ReleaseMutex(IN HANDLE hMutex) +{ + NTSTATUS Status; + + /* Release the mutant */ + Status = NtReleaseMutant(hMutex, NULL); + if (NT_SUCCESS(Status)) return TRUE; + + /* If we got here, then we failed */ + BaseSetLastNTError(Status); + return FALSE; +} + +/* + * @implemented + */ +HANDLE +WINAPI +CreateEventA(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, + IN BOOL bManualReset, + IN BOOL bInitialState, + IN LPCSTR lpName OPTIONAL) +{ + ConvertWin32AnsiObjectApiToUnicodeApi(Event, lpName, lpEventAttributes, bManualReset, bInitialState); +} + +/* + * @implemented + */ +HANDLE +WINAPI +CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, + IN BOOL bManualReset, + IN BOOL bInitialState, + IN LPCWSTR lpName OPTIONAL) +{ + CreateNtObjectFromWin32Api(Event, Event, EVENT, + lpEventAttributes, + lpName, + bManualReset ? NotificationTimer : SynchronizationTimer, + bInitialState); +} + +/* + * @implemented + */ +HANDLE +WINAPI +OpenEventA(IN DWORD dwDesiredAccess, + IN BOOL bInheritHandle, + IN LPCSTR lpName) +{ + ConvertOpenWin32AnsiObjectApiToUnicodeApi(Event, dwDesiredAccess, bInheritHandle, lpName); +} + +/* + * @implemented + */ +HANDLE +WINAPI +OpenEventW(IN DWORD dwDesiredAccess, + IN BOOL bInheritHandle, + IN LPCWSTR lpName) +{ + OpenNtObjectFromWin32Api(Event, dwDesiredAccess, bInheritHandle, lpName); +} + +/* + * @implemented + */ +BOOL +WINAPI +PulseEvent(IN HANDLE hEvent) +{ + NTSTATUS Status; + + /* Pulse the event */ + Status = NtPulseEvent(hEvent, NULL); + if (NT_SUCCESS(Status)) return TRUE; + + /* If we got here, then we failed */ + BaseSetLastNTError(Status); + return FALSE; +} + +/* + * @implemented + */ +BOOL +WINAPI +ResetEvent(IN HANDLE hEvent) +{ + NTSTATUS Status; + + /* Clear the event */ + Status = NtResetEvent(hEvent, NULL); + if (NT_SUCCESS(Status)) return TRUE; + + /* If we got here, then we failed */ + BaseSetLastNTError(Status); + return FALSE; +} + +/* + * @implemented + */ +BOOL +WINAPI +SetEvent(IN HANDLE hEvent) +{ + NTSTATUS Status; + + /* Set the event */ + Status = NtSetEvent(hEvent, NULL); + if (NT_SUCCESS(Status)) return TRUE; + + /* If we got here, then we failed */ + BaseSetLastNTError(Status); + return FALSE; +} + +/* + * @implemented + */ +VOID +WINAPI +InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection) +{ + NTSTATUS Status; + + /* Initialize the critical section and raise an exception if we failed */ + Status = RtlInitializeCriticalSection((PVOID)lpCriticalSection); + if (!NT_SUCCESS(Status)) RtlRaiseStatus(Status); +} + +/* + * @implemented + */ +BOOL +WINAPI +InitializeCriticalSectionAndSpinCount(OUT LPCRITICAL_SECTION lpCriticalSection, + IN DWORD dwSpinCount) +{ + NTSTATUS Status; + + /* Initialize the critical section */ + Status = RtlInitializeCriticalSectionAndSpinCount((PVOID)lpCriticalSection, + dwSpinCount); + if (!NT_SUCCESS(Status)) + { + /* Set failure code */ + BaseSetLastNTError(Status); + return FALSE; + } + + /* Success */ + return TRUE; +} + +/* + * @implemented + */ +VOID +WINAPI +Sleep(IN DWORD dwMilliseconds) +{ + /* Call the new API */ + SleepEx(dwMilliseconds, FALSE); +} + + +/* + * @implemented + */ +DWORD +WINAPI +SleepEx(IN DWORD dwMilliseconds, + IN BOOL bAlertable) +{ + LARGE_INTEGER Time; + PLARGE_INTEGER TimePtr; + NTSTATUS errCode; + RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME ActCtx; + + /* APCs must execute with the default activation context */ + if (bAlertable) + { + /* Setup the frame */ + RtlZeroMemory(&ActCtx, sizeof(ActCtx)); + ActCtx.Size = sizeof(ActCtx); + ActCtx.Format = RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_FORMAT_WHISTLER; + RtlActivateActivationContextUnsafeFast(&ActCtx, NULL); + } + + /* Convert the timeout */ + TimePtr = BaseFormatTimeOut(&Time, dwMilliseconds); + if (!TimePtr) + { + /* Turn an infinite wait into a really long wait */ + Time.LowPart = 0; + Time.HighPart = 0x80000000; + TimePtr = &Time; + } + + /* Loop the delay while APCs are alerting us */ + do + { + /* Do the delay */ + errCode = NtDelayExecution((BOOLEAN)bAlertable, TimePtr); + } + while ((bAlertable) && (errCode == STATUS_ALERTED)); + + /* Cleanup the activation context */ + if (bAlertable) RtlDeactivateActivationContextUnsafeFast(&ActCtx); + + /* Return the correct code */ + return (errCode == STATUS_USER_APC) ? WAIT_IO_COMPLETION : 0; +} + +/* + * @implemented + */ +BOOL +WINAPI +RegisterWaitForSingleObject(OUT PHANDLE phNewWaitObject, + IN HANDLE hObject, + IN WAITORTIMERCALLBACK Callback, + IN PVOID Context, + IN ULONG dwMilliseconds, + IN ULONG dwFlags) +{ + NTSTATUS Status; + + /* Get real handle */ + hObject = TranslateStdHandle(hObject); + + /* Check for console handle */ + if ((IsConsoleHandle(hObject)) && (VerifyConsoleIoHandle(hObject))) + { + /* Get the real wait handle */ + hObject = GetConsoleInputWaitHandle(); + } + + /* Register the wait now */ + Status = RtlRegisterWait(phNewWaitObject, + hObject, + Callback, + Context, + dwMilliseconds, + dwFlags); + if (!NT_SUCCESS(Status)) + { + /* Return failure */ + BaseSetLastNTError(Status); + return FALSE; + } + + /* All good */ + return TRUE; +} + +/* + * @implemented + */ +HANDLE +WINAPI +RegisterWaitForSingleObjectEx(IN HANDLE hObject, + IN WAITORTIMERCALLBACK Callback, + IN PVOID Context, + IN ULONG dwMilliseconds, + IN ULONG dwFlags) +{ + NTSTATUS Status; + HANDLE hNewWaitObject; + + /* Get real handle */ + hObject = TranslateStdHandle(hObject); + + /* Check for console handle */ + if ((IsConsoleHandle(hObject)) && (VerifyConsoleIoHandle(hObject))) + { + /* Get the real wait handle */ + hObject = GetConsoleInputWaitHandle(); + } + + /* Register the wait */ + Status = RtlRegisterWait(&hNewWaitObject, + hObject, + Callback, + Context, + dwMilliseconds, + dwFlags); + if (!NT_SUCCESS(Status)) + { + /* Return failure */ + BaseSetLastNTError(Status); + return NULL; + } + + /* Return the object */ + return hNewWaitObject; +} + +/* + * @implemented + */ +BOOL +WINAPI +UnregisterWait(IN HANDLE WaitHandle) +{ + NTSTATUS Status; + + /* Check for invalid handle */ + if (!WaitHandle) + { + /* Fail */ + SetLastError(ERROR_INVALID_HANDLE); + return FALSE; + } + + /* Deregister the wait and check status */ + Status = RtlDeregisterWaitEx(WaitHandle, NULL); + if (!(NT_SUCCESS(Status)) || (Status == STATUS_PENDING)) + { + /* Failure or non-blocking call */ + BaseSetLastNTError(Status); + return FALSE; + } + + /* All good */ + return TRUE; +} + +/* + * @implemented + */ +BOOL +WINAPI +UnregisterWaitEx(IN HANDLE WaitHandle, + IN HANDLE CompletionEvent) +{ + NTSTATUS Status; + + /* Check for invalid handle */ + if (!WaitHandle) + { + /* Fail */ + SetLastError(ERROR_INVALID_HANDLE); + return FALSE; + } + + /* Deregister the wait and check status */ + Status = RtlDeregisterWaitEx(WaitHandle, CompletionEvent); + if (!(NT_SUCCESS(Status)) || + ((CompletionEvent != INVALID_HANDLE_VALUE) && (Status == STATUS_PENDING))) + { + /* Failure or non-blocking call */ + BaseSetLastNTError(Status); + return FALSE; + } + + /* All good */ + return TRUE; +} + +/* EOF */ diff --git a/dll/win32/kernel32/client/sysinfo.c b/dll/win32/kernel32/client/sysinfo.c new file mode 100644 index 00000000000..580f63b10c7 --- /dev/null +++ b/dll/win32/kernel32/client/sysinfo.c @@ -0,0 +1,367 @@ +/* + * PROJECT: ReactOS Win32 Base API + * LICENSE: See COPYING in the top level directory + * FILE: dll/win32/kernel32/client/sysinfo.c + * PURPOSE: System Information Functions + * PROGRAMMERS: Emanuele Aliberti + * Christoph von Wittich + * Thomas Weidenmueller + * Gunnar Andre Dalsnes + */ + +/* INCLUDES *******************************************************************/ + +#include + +#define NDEBUG +#include + +#define PV_NT351 0x00030033 + +/* PRIVATE FUNCTIONS **********************************************************/ + +VOID +WINAPI +GetSystemInfoInternal(IN PSYSTEM_BASIC_INFORMATION BasicInfo, + IN PSYSTEM_PROCESSOR_INFORMATION ProcInfo, + OUT LPSYSTEM_INFO SystemInfo) +{ + RtlZeroMemory(SystemInfo, sizeof (SYSTEM_INFO)); + SystemInfo->wProcessorArchitecture = ProcInfo->ProcessorArchitecture; + SystemInfo->wReserved = 0; + SystemInfo->dwPageSize = BasicInfo->PageSize; + SystemInfo->lpMinimumApplicationAddress = (PVOID)BasicInfo->MinimumUserModeAddress; + SystemInfo->lpMaximumApplicationAddress = (PVOID)BasicInfo->MaximumUserModeAddress; + SystemInfo->dwActiveProcessorMask = BasicInfo->ActiveProcessorsAffinityMask; + SystemInfo->dwNumberOfProcessors = BasicInfo->NumberOfProcessors; + SystemInfo->wProcessorLevel = ProcInfo->ProcessorLevel; + SystemInfo->wProcessorRevision = ProcInfo->ProcessorRevision; + SystemInfo->dwAllocationGranularity = BasicInfo->AllocationGranularity; + + switch (ProcInfo->ProcessorArchitecture) + { + case PROCESSOR_ARCHITECTURE_INTEL: + switch (ProcInfo->ProcessorLevel) + { + case 3: + SystemInfo->dwProcessorType = PROCESSOR_INTEL_386; + break; + case 4: + SystemInfo->dwProcessorType = PROCESSOR_INTEL_486; + break; + default: + SystemInfo->dwProcessorType = PROCESSOR_INTEL_PENTIUM; + } + break; + + case PROCESSOR_ARCHITECTURE_AMD64: + SystemInfo->dwProcessorType = PROCESSOR_AMD_X8664; + break; + + case PROCESSOR_ARCHITECTURE_IA64: + SystemInfo->dwProcessorType = PROCESSOR_INTEL_IA64; + break; + + default: + SystemInfo->dwProcessorType = 0; + break; + } + + if (PV_NT351 > GetProcessVersion(0)) + { + SystemInfo->wProcessorLevel = 0; + SystemInfo->wProcessorRevision = 0; + } +} + +/* PUBLIC FUNCTIONS ***********************************************************/ + +/* + * @implemented + */ +SIZE_T +WINAPI +GetLargePageMinimum(VOID) +{ + return SharedUserData->LargePageMinimum; +} + +/* + * @implemented + */ +VOID +WINAPI +GetSystemInfo(IN LPSYSTEM_INFO lpSystemInfo) +{ + SYSTEM_BASIC_INFORMATION BasicInfo; + SYSTEM_PROCESSOR_INFORMATION ProcInfo; + NTSTATUS Status; + + Status = NtQuerySystemInformation(SystemBasicInformation, + &BasicInfo, + sizeof(BasicInfo), + 0); + if (!NT_SUCCESS(Status)) return; + + Status = NtQuerySystemInformation(SystemProcessorInformation, + &ProcInfo, + sizeof(ProcInfo), + 0); + if (!NT_SUCCESS(Status)) return; + + GetSystemInfoInternal(&BasicInfo, &ProcInfo, lpSystemInfo); +} + +/* + * @implemented + */ +BOOL +WINAPI +IsProcessorFeaturePresent(IN DWORD ProcessorFeature) +{ + if (ProcessorFeature >= PROCESSOR_FEATURE_MAX) return FALSE; + return ((BOOL)SharedUserData->ProcessorFeatures[ProcessorFeature]); +} + +/* + * @implemented + */ +BOOL +WINAPI +GetSystemRegistryQuota(OUT PDWORD pdwQuotaAllowed, + OUT PDWORD pdwQuotaUsed) +{ + SYSTEM_REGISTRY_QUOTA_INFORMATION QuotaInfo; + ULONG BytesWritten; + NTSTATUS Status; + + Status = NtQuerySystemInformation(SystemRegistryQuotaInformation, + &QuotaInfo, + sizeof(QuotaInfo), + &BytesWritten); + if (NT_SUCCESS(Status)) + { + if (pdwQuotaAllowed) *pdwQuotaAllowed = QuotaInfo.RegistryQuotaAllowed; + if (pdwQuotaUsed) *pdwQuotaUsed = QuotaInfo.RegistryQuotaUsed; + return TRUE; + } + + BaseSetLastNTError(Status); + return FALSE; +} + +/* + * @implemented + */ +VOID +WINAPI +GetNativeSystemInfo(IN LPSYSTEM_INFO lpSystemInfo) +{ + SYSTEM_BASIC_INFORMATION BasicInfo; + SYSTEM_PROCESSOR_INFORMATION ProcInfo; + NTSTATUS Status; + + /* FIXME: Should be SystemNativeBasicInformation */ + Status = NtQuerySystemInformation(SystemBasicInformation, + &BasicInfo, + sizeof(BasicInfo), + 0); + if (!NT_SUCCESS(Status)) return; + + /* FIXME: Should be SystemNativeProcessorInformation */ + Status = NtQuerySystemInformation(SystemProcessorInformation, + &ProcInfo, + sizeof(ProcInfo), + 0); + if (!NT_SUCCESS(Status)) return; + + GetSystemInfoInternal(&BasicInfo, &ProcInfo, lpSystemInfo); +} + +/* + * @implemented + */ +BOOL +WINAPI +GetLogicalProcessorInformation(OUT PSYSTEM_LOGICAL_PROCESSOR_INFORMATION Buffer, + IN OUT PDWORD ReturnLength) +{ + NTSTATUS Status; + + if (!ReturnLength) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + Status = NtQuerySystemInformation(SystemLogicalProcessorInformation, + Buffer, + *ReturnLength, + ReturnLength); + + /* Normalize the error to what Win32 expects */ + if (Status == STATUS_INFO_LENGTH_MISMATCH) Status = STATUS_BUFFER_TOO_SMALL; + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + return TRUE; +} + +/* + * @unimplemented + */ +BOOL +WINAPI +GetNumaHighestNodeNumber(OUT PULONG HighestNodeNumber) +{ + STUB; + return 0; +} + +/* + * @unimplemented + */ +BOOL +WINAPI +GetNumaNodeProcessorMask(IN UCHAR Node, + OUT PULONGLONG ProcessorMask) +{ + STUB; + return 0; +} + +/* + * @unimplemented + */ +BOOL +WINAPI +GetNumaProcessorNode(IN UCHAR Processor, + OUT PUCHAR NodeNumber) +{ + STUB; + return 0; +} + +/* + * @unimplemented + */ +BOOL +WINAPI +GetNumaAvailableMemoryNode(IN UCHAR Node, + OUT PULONGLONG AvailableBytes) +{ + STUB; + return FALSE; +} + +/* + * @unimplemented + */ +DWORD +WINAPI +GetFirmwareEnvironmentVariableW(IN LPCWSTR lpName, + IN LPCWSTR lpGuid, + IN PVOID pValue, + IN DWORD nSize) +{ + STUB; + return 0; +} + +/* + * @unimplemented + */ +BOOL +WINAPI +SetFirmwareEnvironmentVariableW(IN LPCWSTR lpName, + IN LPCWSTR lpGuid, + IN PVOID pValue, + IN DWORD nSize) +{ + STUB; + return 0; +} + +/* + * @unimplemented + */ +DWORD +WINAPI +GetFirmwareEnvironmentVariableA(IN LPCSTR lpName, + IN LPCSTR lpGuid, + IN PVOID pValue, + IN DWORD nSize) +{ + STUB; + return 0; +} + +/* + * @unimplemented + */ +BOOL +WINAPI +SetFirmwareEnvironmentVariableA(IN LPCSTR lpName, + IN LPCSTR lpGuid, + IN PVOID pValue, + IN DWORD nSize) +{ + STUB; + return 0; +} + +/* + * @unimplemented + */ +UINT +WINAPI +EnumSystemFirmwareTables(IN DWORD FirmwareTableProviderSignature, + OUT PVOID pFirmwareTableBuffer, + IN DWORD BufferSize) +{ + STUB; + return 0; +} + +/* + * @unimplemented + */ +UINT +WINAPI +GetSystemFirmwareTable(IN DWORD FirmwareTableProviderSignature, + IN DWORD FirmwareTableID, + OUT PVOID pFirmwareTableBuffer, + IN DWORD BufferSize) +{ + STUB; + return 0; +} + +/* + * @unimplemented + */ +BOOL +WINAPI +GetSystemFileCacheSize(OUT PSIZE_T lpMinimumFileCacheSize, + OUT PSIZE_T lpMaximumFileCacheSize, + OUT PDWORD lpFlags) +{ + STUB; + return FALSE; +} + +/* + * @unimplemented + */ +BOOL +WINAPI +SetSystemFileCacheSize(IN SIZE_T MinimumFileCacheSize, + IN SIZE_T MaximumFileCacheSize, + IN DWORD Flags) +{ + STUB; + return FALSE; +} diff --git a/dll/win32/kernel32/thread/thread.c b/dll/win32/kernel32/client/thread.c similarity index 75% rename from dll/win32/kernel32/thread/thread.c rename to dll/win32/kernel32/client/thread.c index 055342a0d39..13975dfaad1 100644 --- a/dll/win32/kernel32/thread/thread.c +++ b/dll/win32/kernel32/client/thread.c @@ -52,22 +52,34 @@ WINAPI BaseThreadStartup(LPTHREAD_START_ROUTINE lpStartAddress, LPVOID lpParameter) { - volatile UINT uExitCode = 0; - /* Attempt to call the Thread Start Address */ _SEH2_TRY { + /* Legacy check which is still used today for Win32 threads */ + if (NtCurrentTeb()->NtTib.Version == (30 << 8)) // OS/2 V3.0 ("Cruiser") + { + /* This registers the termination port with CSRSS */ + if (!BaseRunningInServerProcess) CsrNewThread(); + } + /* Get the exit code from the Thread Start */ - uExitCode = (lpStartAddress)((PVOID)lpParameter); + ExitThread((lpStartAddress)((PVOID)lpParameter)); } _SEH2_EXCEPT(BaseThreadExceptionFilter(_SEH2_GetExceptionInformation())) { /* Get the Exit code from the SEH Handler */ - uExitCode = _SEH2_GetExceptionCode(); - } _SEH2_END; - - /* Exit the Thread */ - ExitThread(uExitCode); + if (!BaseRunningInServerProcess) + { + /* Kill the whole process, usually */ + ExitProcess(_SEH2_GetExceptionCode()); + } + else + { + /* If running inside CSRSS, kill just this thread */ + ExitThread(_SEH2_GetExceptionCode()); + } + } + _SEH2_END; } /* @@ -132,7 +144,7 @@ CreateRemoteThread(HANDLE hProcess, &InitialTeb); if(!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return NULL; } @@ -160,7 +172,7 @@ CreateRemoteThread(HANDLE hProcess, if(!NT_SUCCESS(Status)) { BasepFreeStack(hProcess, &InitialTeb); - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return NULL; } @@ -230,7 +242,7 @@ CreateRemoteThread(HANDLE hProcess, { ASSERT(FALSE); } - + /* Success */ if(lpThreadId) *lpThreadId = HandleToUlong(ClientId.UniqueThread); @@ -310,7 +322,7 @@ OpenThread(DWORD dwDesiredAccess, &ClientId); if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return NULL; } @@ -368,7 +380,7 @@ GetThreadTimes(HANDLE hThread, NULL); if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return(FALSE); } @@ -392,7 +404,7 @@ GetThreadContext(HANDLE hThread, Status = NtGetContextThread(hThread, lpContext); if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -412,7 +424,7 @@ SetThreadContext(HANDLE hThread, Status = NtSetContextThread(hThread, (PCONTEXT)lpContext); if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -437,7 +449,7 @@ GetExitCodeThread(HANDLE hThread, NULL); if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return(FALSE); } @@ -458,7 +470,7 @@ ResumeThread(HANDLE hThread) Status = NtResumeThread(hThread, &PreviousResumeCount); if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return -1; } @@ -484,7 +496,7 @@ TerminateThread(HANDLE hThread, Status = NtTerminateThread(hThread, dwExitCode); if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -504,7 +516,7 @@ SuspendThread(HANDLE hThread) Status = NtSuspendThread(hThread, &PreviousSuspendCount); if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return -1; } @@ -532,7 +544,7 @@ SetThreadAffinityMask(HANDLE hThread, NULL); if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return 0; } @@ -542,7 +554,7 @@ SetThreadAffinityMask(HANDLE hThread, sizeof(KAFFINITY)); if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); ThreadBasic.AffinityMask = 0; } @@ -578,7 +590,7 @@ SetThreadPriority(HANDLE hThread, if (!NT_SUCCESS(Status)) { /* Failure */ - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -605,17 +617,19 @@ GetThreadPriority(HANDLE hThread) if (!NT_SUCCESS(Status)) { /* Failure */ - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return THREAD_PRIORITY_ERROR_RETURN; } - /* Do some conversions for out of boundary values */ - if (ThreadBasic.BasePriority > THREAD_BASE_PRIORITY_MAX) + /* Do some conversions for saturation values */ + if (ThreadBasic.BasePriority == ((HIGH_PRIORITY + 1) / 2)) { + /* Win32 calls this "time critical" */ ThreadBasic.BasePriority = THREAD_PRIORITY_TIME_CRITICAL; } - else if (ThreadBasic.BasePriority < THREAD_BASE_PRIORITY_MIN) + else if (ThreadBasic.BasePriority == -((HIGH_PRIORITY + 1) / 2)) { + /* Win32 calls this "idle" */ ThreadBasic.BasePriority = THREAD_PRIORITY_IDLE; } @@ -641,7 +655,7 @@ GetThreadPriorityBoost(IN HANDLE hThread, NULL); if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -668,7 +682,7 @@ SetThreadPriorityBoost(IN HANDLE hThread, sizeof(ULONG)); if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -698,7 +712,7 @@ GetThreadSelectorEntry(IN HANDLE hThread, if (!NT_SUCCESS(Status)) { /* Fail */ - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -727,7 +741,7 @@ SetThreadIdealProcessor(HANDLE hThread, sizeof(ULONG)); if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return -1; } @@ -750,7 +764,7 @@ GetProcessIdOfThread(HANDLE Thread) NULL); if(!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return 0; } @@ -773,7 +787,7 @@ GetThreadId(HANDLE Thread) NULL); if(!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return 0; } @@ -809,13 +823,22 @@ QueueUserAPC(PAPCFUNC pfnAPC, HANDLE hThread, ULONG_PTR dwData) (PVOID)dwData, NULL); if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return 0; } return 1; } +BOOL +WINAPI +SetThreadStackGuarantee(IN OUT PULONG StackSizeInBytes) +{ + STUB; + return FALSE; +} + + /* * @implemented */ @@ -843,53 +866,11 @@ GetThreadIOPendingFlag(HANDLE hThread, return TRUE; } - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } -/* - * @implemented - */ -VOID WINAPI -Sleep(DWORD dwMilliseconds) -{ - SleepEx(dwMilliseconds, FALSE); - return; -} - - -/* - * @implemented - */ -DWORD WINAPI -SleepEx(DWORD dwMilliseconds, - BOOL bAlertable) -{ - LARGE_INTEGER Interval; - NTSTATUS errCode; - - if (dwMilliseconds != INFINITE) - { - /* - * System time units are 100 nanoseconds (a nanosecond is a billionth of - * a second). - */ - Interval.QuadPart = -((LONGLONG)dwMilliseconds * 10000); - } - else - { - /* Approximately 292000 years hence */ - Interval.QuadPart = -0x7FFFFFFFFFFFFFFFLL; - } - -dowait: - errCode = NtDelayExecution ((BOOLEAN)bAlertable, &Interval); - if ((bAlertable) && (errCode == STATUS_ALERTED)) goto dowait; - return (errCode == STATUS_USER_APC) ? WAIT_IO_COMPLETION : 0; -} - - typedef struct _QUEUE_USER_WORKITEM_CONTEXT { LPTHREAD_START_ROUTINE Function; @@ -957,117 +938,248 @@ QueueUserWorkItem( 0, WorkItemContext); - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } return TRUE; } +/* + * @implemented + */ +DWORD +WINAPI +TlsAlloc(VOID) +{ + ULONG Index; + PTEB Teb; + PPEB Peb; + + /* Get the PEB and TEB, lock the PEB */ + Teb = NtCurrentTeb(); + Peb = Teb->ProcessEnvironmentBlock; + RtlAcquirePebLock(); + + /* Try to get regular TEB slot */ + Index = RtlFindClearBitsAndSet(Peb->TlsBitmap, 1, 0); + if (Index != 0xFFFFFFFF) + { + /* Clear the value. */ + Teb->TlsSlots[Index] = 0; + RtlReleasePebLock(); + return Index; + } + + /* If it fails, try to find expansion TEB slot. */ + Index = RtlFindClearBitsAndSet(Peb->TlsExpansionBitmap, 1, 0); + if (Index != 0xFFFFFFFF) + { + /* Is there no expansion slot yet? */ + if (!Teb->TlsExpansionSlots) + { + /* Allocate an array */ + Teb->TlsExpansionSlots = RtlAllocateHeap(RtlGetProcessHeap(), + HEAP_ZERO_MEMORY, + TLS_EXPANSION_SLOTS * + sizeof(PVOID)); + } + + /* Did we get an array? */ + if (!Teb->TlsExpansionSlots) + { + /* Fail */ + RtlClearBits(Peb->TlsExpansionBitmap, Index, 1); + Index = 0xFFFFFFFF; + BaseSetLastNTError(STATUS_NO_MEMORY); + } + else + { + /* Clear the value. */ + Teb->TlsExpansionSlots[Index] = 0; + Index += TLS_MINIMUM_AVAILABLE; + } + } + else + { + /* Fail */ + BaseSetLastNTError(STATUS_NO_MEMORY); + } + + /* Release the lock and return */ + RtlReleasePebLock(); + return Index; +} /* * @implemented */ BOOL WINAPI -RegisterWaitForSingleObject( - PHANDLE phNewWaitObject, - HANDLE hObject, - WAITORTIMERCALLBACK Callback, - PVOID Context, - ULONG dwMilliseconds, - ULONG dwFlags - ) +TlsFree(IN DWORD Index) { - NTSTATUS Status = RtlRegisterWait(phNewWaitObject, - hObject, - Callback, - Context, - dwMilliseconds, - dwFlags); + BOOL BitSet; + PPEB Peb; + ULONG TlsIndex; + PVOID TlsBitmap; + NTSTATUS Status; - if (!NT_SUCCESS(Status)) + /* Acquire the PEB lock and grab the PEB */ + Peb = NtCurrentPeb(); + RtlAcquirePebLock(); + + /* Check if the index is too high */ + if (Index >= TLS_MINIMUM_AVAILABLE) { - SetLastErrorByStatus(Status); + /* Check if it can fit in the expansion slots */ + TlsIndex = Index - TLS_MINIMUM_AVAILABLE; + if (TlsIndex >= TLS_EXPANSION_SLOTS) + { + /* It's invalid */ + BaseSetLastNTError(STATUS_INVALID_PARAMETER); + RtlReleasePebLock(); + return FALSE; + } + else + { + /* Use the expansion bitmap */ + TlsBitmap = Peb->TlsExpansionBitmap; + Index = TlsIndex; + } + } + else + { + /* Use the normal bitmap */ + TlsBitmap = Peb->TlsBitmap; + } + + /* Check if the index was set */ + BitSet = RtlAreBitsSet(TlsBitmap, Index, 1); + if (BitSet) + { + /* Tell the kernel to free the TLS cells */ + Status = NtSetInformationThread(NtCurrentThread(), + ThreadZeroTlsCell, + &Index, + sizeof(DWORD)); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(STATUS_INVALID_PARAMETER); + RtlReleasePebLock(); + return FALSE; + } + + /* Clear the bit */ + RtlClearBits(TlsBitmap, Index, 1); + } + else + { + /* Fail */ + BaseSetLastNTError(STATUS_INVALID_PARAMETER); + RtlReleasePebLock(); return FALSE; } + + /* Done! */ + RtlReleasePebLock(); return TRUE; } - /* * @implemented */ -HANDLE +LPVOID WINAPI -RegisterWaitForSingleObjectEx( - HANDLE hObject, - WAITORTIMERCALLBACK Callback, - PVOID Context, - ULONG dwMilliseconds, - ULONG dwFlags - ) +TlsGetValue(IN DWORD Index) { - NTSTATUS Status; - HANDLE hNewWaitObject; + PTEB Teb; - Status = RtlRegisterWait(&hNewWaitObject, - hObject, - Callback, - Context, - dwMilliseconds, - dwFlags); + /* Get the TEB and clear the last error */ + Teb = NtCurrentTeb(); + Teb->LastErrorValue = 0; - if (!NT_SUCCESS(Status)) + /* Check for simple TLS index */ + if (Index < TLS_MINIMUM_AVAILABLE) { - SetLastErrorByStatus(Status); + /* Return it */ + return Teb->TlsSlots[Index]; + } + + /* Check for valid index */ + if (Index >= TLS_EXPANSION_SLOTS + TLS_MINIMUM_AVAILABLE) + { + /* Fail */ + BaseSetLastNTError(STATUS_INVALID_PARAMETER); return NULL; } - return hNewWaitObject; -} + /* The expansion slots are allocated on demand, so check for it. */ + Teb->LastErrorValue = 0; + if (!Teb->TlsExpansionSlots) return NULL; + /* Return the value from the expansion slots */ + return Teb->TlsExpansionSlots[Index - TLS_MINIMUM_AVAILABLE]; +} /* * @implemented */ BOOL WINAPI -UnregisterWait( - HANDLE WaitHandle - ) +TlsSetValue(IN DWORD Index, + IN LPVOID Value) { - NTSTATUS Status = RtlDeregisterWaitEx(WaitHandle, NULL); + DWORD TlsIndex; + PTEB Teb = NtCurrentTeb(); - if (!NT_SUCCESS(Status)) + /* Check for simple TLS index */ + if (Index < TLS_MINIMUM_AVAILABLE) { - SetLastErrorByStatus(Status); + /* Return it */ + Teb->TlsSlots[Index] = Value; + return TRUE; + } + + /* Check if this is an expansion slot */ + TlsIndex = Index - TLS_MINIMUM_AVAILABLE; + if (TlsIndex >= TLS_EXPANSION_SLOTS) + { + /* Fail */ + BaseSetLastNTError(STATUS_INVALID_PARAMETER); return FALSE; } - return TRUE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -UnregisterWaitEx( - HANDLE WaitHandle, - HANDLE CompletionEvent - ) -{ - NTSTATUS Status = RtlDeregisterWaitEx(WaitHandle, CompletionEvent); - - if (!NT_SUCCESS(Status)) + /* Do we not have expansion slots? */ + if (!Teb->TlsExpansionSlots) { - SetLastErrorByStatus(Status); - return FALSE; + /* Get the PEB lock to see if we still need them */ + RtlAcquirePebLock(); + if (!Teb->TlsExpansionSlots) + { + /* Allocate them */ + Teb->TlsExpansionSlots = RtlAllocateHeap(RtlGetProcessHeap(), + HEAP_ZERO_MEMORY, + TLS_EXPANSION_SLOTS * + sizeof(PVOID)); + if (!Teb->TlsExpansionSlots) + { + /* Fail */ + RtlReleasePebLock(); + BaseSetLastNTError(STATUS_NO_MEMORY); + return FALSE; + } + } + + /* Release the lock */ + RtlReleasePebLock(); } + /* Write the value */ + Teb->TlsExpansionSlots[TlsIndex] = Value; + + /* Success */ return TRUE; } + /* EOF */ diff --git a/dll/win32/kernel32/client/time.c b/dll/win32/kernel32/client/time.c new file mode 100644 index 00000000000..992f063b124 --- /dev/null +++ b/dll/win32/kernel32/client/time.c @@ -0,0 +1,617 @@ +/* $Id: time.c 52770 2011-07-22 02:13:57Z ion $ + * + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * FILE: lib/kernel32/misc/time.c + * PURPOSE: Time conversion functions + * PROGRAMMER: Ariadne + * DOSDATE and DOSTIME structures from Onno Hovers + * UPDATE HISTORY: + * Created 19/01/99 + */ + +/* INCLUDES *******************************************************************/ + +#include + +#define NDEBUG +#include + +/* FUNCTIONS ******************************************************************/ + +/* + * @implemented + */ +BOOL +WINAPI +IsTimeZoneRedirectionEnabled(VOID) +{ + /* Return if a TS Timezone ID is active */ + return (BaseStaticServerData->TermsrvClientTimeZoneId != TIME_ZONE_ID_INVALID); +} + +/* + * @implemented + */ +BOOL +WINAPI +FileTimeToDosDateTime(IN CONST FILETIME *lpFileTime, + OUT LPWORD lpFatDate, + OUT LPWORD lpFatTime) +{ + LARGE_INTEGER FileTime; + TIME_FIELDS TimeFields; + + FileTime.HighPart = lpFileTime->dwHighDateTime; + FileTime.LowPart = lpFileTime->dwLowDateTime; + + if (FileTime.QuadPart < 0) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + RtlTimeToTimeFields(&FileTime, &TimeFields); + if ((TimeFields.Year < 1980) || (TimeFields.Year > 2107)) + { + BaseSetLastNTError(STATUS_INVALID_PARAMETER); + return FALSE; + } + + *lpFatDate = (TimeFields.Day) | + (TimeFields.Month << 5) | + ((TimeFields.Year - 1980) << 9); + *lpFatTime = (TimeFields.Second >> 1) | + (TimeFields.Minute << 5) | + (TimeFields.Hour << 16); + + return TRUE; +} + +/* + * @implemented + */ +BOOL +WINAPI +DosDateTimeToFileTime(IN WORD wFatDate, + IN WORD wFatTime, + OUT LPFILETIME lpFileTime) +{ + TIME_FIELDS TimeFields; + LARGE_INTEGER SystemTime; + + TimeFields.Year = (wFatDate >> 9) + 1980; + TimeFields.Month = (wFatDate >> 5) & 0xF; + TimeFields.Day = (wFatDate & 0x1F); + TimeFields.Hour = (wFatTime >> 11); + TimeFields.Minute = (wFatTime >> 5) & 0x3F; + TimeFields.Second = (wFatTime & 0x1F) << 1; + TimeFields.Milliseconds = 0; + + if (RtlTimeFieldsToTime(&TimeFields, &SystemTime)) + { + lpFileTime->dwLowDateTime = SystemTime.LowPart; + lpFileTime->dwHighDateTime = SystemTime.HighPart; + return TRUE; + } + + BaseSetLastNTError(STATUS_INVALID_PARAMETER); + return FALSE; +} + +/* + * @implemented + */ +LONG +WINAPI +CompareFileTime(IN CONST FILETIME *lpFileTime1, + IN CONST FILETIME *lpFileTime2) +{ + LARGE_INTEGER Time1, Time2, Diff; + + Time1.LowPart = lpFileTime1->dwLowDateTime; + Time2.LowPart = lpFileTime2->dwLowDateTime; + Time1.HighPart = lpFileTime1->dwHighDateTime; + Time2.HighPart = lpFileTime2->dwHighDateTime; + + Diff.QuadPart = Time1.QuadPart - Time2.QuadPart; + + if (Diff.HighPart < 0) return -1; + if (Diff.QuadPart == 0) return 0; + return 1; +} + +/* + * @implemented + */ +VOID +WINAPI +GetSystemTimeAsFileTime(OUT PFILETIME lpFileTime) +{ + LARGE_INTEGER SystemTime; + + do + { + SystemTime.HighPart = SharedUserData->SystemTime.High1Time; + SystemTime.LowPart = SharedUserData->SystemTime.LowPart; + } + while (SystemTime.HighPart != SharedUserData->SystemTime.High2Time); + + lpFileTime->dwLowDateTime = SystemTime.LowPart; + lpFileTime->dwHighDateTime = SystemTime.HighPart; +} + +/* + * @implemented + */ +BOOL +WINAPI +SystemTimeToFileTime(IN CONST SYSTEMTIME *lpSystemTime, + OUT LPFILETIME lpFileTime) +{ + TIME_FIELDS TimeFields; + LARGE_INTEGER liTime; + + TimeFields.Year = lpSystemTime->wYear; + TimeFields.Month = lpSystemTime->wMonth; + TimeFields.Day = lpSystemTime->wDay; + TimeFields.Hour = lpSystemTime->wHour; + TimeFields.Minute = lpSystemTime->wMinute; + TimeFields.Second = lpSystemTime->wSecond; + TimeFields.Milliseconds = lpSystemTime->wMilliseconds; + + if (RtlTimeFieldsToTime(&TimeFields, &liTime)) + { + lpFileTime->dwLowDateTime = liTime.u.LowPart; + lpFileTime->dwHighDateTime = liTime.u.HighPart; + return TRUE; + } + + BaseSetLastNTError(STATUS_INVALID_PARAMETER); + return FALSE; +} + +/* + * @implemented + */ +BOOL +WINAPI +FileTimeToSystemTime(IN CONST FILETIME *lpFileTime, + OUT LPSYSTEMTIME lpSystemTime) +{ + TIME_FIELDS TimeFields; + LARGE_INTEGER liTime; + + liTime.u.LowPart = lpFileTime->dwLowDateTime; + liTime.u.HighPart = lpFileTime->dwHighDateTime; + if (liTime.QuadPart < 0) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + RtlTimeToTimeFields(&liTime, &TimeFields); + + lpSystemTime->wYear = TimeFields.Year; + lpSystemTime->wMonth = TimeFields.Month; + lpSystemTime->wDay = TimeFields.Day; + lpSystemTime->wHour = TimeFields.Hour; + lpSystemTime->wMinute = TimeFields.Minute; + lpSystemTime->wSecond = TimeFields.Second; + lpSystemTime->wMilliseconds = TimeFields.Milliseconds; + lpSystemTime->wDayOfWeek = TimeFields.Weekday; + + return TRUE; +} + +/* + * @implemented + */ +BOOL +WINAPI +FileTimeToLocalFileTime(IN CONST FILETIME *lpFileTime, + OUT LPFILETIME lpLocalFileTime) +{ + LARGE_INTEGER TimeZoneBias, FileTime; + volatile KSYSTEM_TIME *TimePtr; + + TimePtr = IsTimeZoneRedirectionEnabled() ? + &BaseStaticServerData->ktTermsrvClientBias : + &SharedUserData->TimeZoneBias; + do + { + TimeZoneBias.HighPart = TimePtr->High1Time; + TimeZoneBias.LowPart = TimePtr->LowPart; + } + while (TimeZoneBias.HighPart != TimePtr->High2Time); + + FileTime.LowPart = lpFileTime->dwLowDateTime; + FileTime.HighPart = lpFileTime->dwHighDateTime; + + FileTime.QuadPart -= TimeZoneBias.QuadPart; + + lpLocalFileTime->dwLowDateTime = FileTime.LowPart; + lpLocalFileTime->dwHighDateTime = FileTime.HighPart; + + return TRUE; +} + +/* + * @implemented + */ +BOOL +WINAPI +LocalFileTimeToFileTime(IN CONST FILETIME *lpLocalFileTime, + OUT LPFILETIME lpFileTime) +{ + LARGE_INTEGER TimeZoneBias, FileTime; + volatile KSYSTEM_TIME *TimePtr; + + TimePtr = IsTimeZoneRedirectionEnabled() ? + &BaseStaticServerData->ktTermsrvClientBias : + &SharedUserData->TimeZoneBias; + + do + { + TimeZoneBias.HighPart = TimePtr->High1Time; + TimeZoneBias.LowPart = TimePtr->LowPart; + } + while (TimeZoneBias.HighPart != TimePtr->High2Time); + + FileTime.LowPart = lpLocalFileTime->dwLowDateTime; + FileTime.HighPart = lpLocalFileTime->dwHighDateTime; + + FileTime.QuadPart += TimeZoneBias.QuadPart; + + lpFileTime->dwLowDateTime = FileTime.LowPart; + lpFileTime->dwHighDateTime = FileTime.HighPart; + + return TRUE; +} + +/* + * @implemented + */ +VOID +WINAPI +GetLocalTime(OUT LPSYSTEMTIME lpSystemTime) +{ + LARGE_INTEGER SystemTime, TimeZoneBias; + TIME_FIELDS TimeFields; + volatile KSYSTEM_TIME *TimePtr; + + do + { + SystemTime.HighPart = SharedUserData->SystemTime.High1Time; + SystemTime.LowPart = SharedUserData->SystemTime.LowPart; + } + while (SystemTime.HighPart != SharedUserData->SystemTime.High2Time); + + TimePtr = IsTimeZoneRedirectionEnabled() ? + &BaseStaticServerData->ktTermsrvClientBias : + &SharedUserData->TimeZoneBias; + do + { + TimeZoneBias.HighPart = TimePtr->High1Time; + TimeZoneBias.LowPart = TimePtr->LowPart; + } + while (TimeZoneBias.HighPart != TimePtr->High2Time); + + SystemTime.QuadPart -= TimeZoneBias.QuadPart; + RtlTimeToTimeFields(&SystemTime, &TimeFields); + + lpSystemTime->wYear = TimeFields.Year; + lpSystemTime->wMonth = TimeFields.Month; + lpSystemTime->wDay = TimeFields.Day; + lpSystemTime->wHour = TimeFields.Hour; + lpSystemTime->wMinute = TimeFields.Minute; + lpSystemTime->wSecond = TimeFields.Second; + lpSystemTime->wMilliseconds = TimeFields.Milliseconds; + lpSystemTime->wDayOfWeek = TimeFields.Weekday; +} + +/* + * @implemented + */ +VOID +WINAPI +GetSystemTime(OUT LPSYSTEMTIME lpSystemTime) +{ + LARGE_INTEGER SystemTime; + TIME_FIELDS TimeFields; + + do + { + SystemTime.HighPart = SharedUserData->SystemTime.High1Time; + SystemTime.LowPart = SharedUserData->SystemTime.LowPart; + } + while (SystemTime.HighPart != SharedUserData->SystemTime.High2Time); + + RtlTimeToTimeFields(&SystemTime, &TimeFields); + + lpSystemTime->wYear = TimeFields.Year; + lpSystemTime->wMonth = TimeFields.Month; + lpSystemTime->wDay = TimeFields.Day; + lpSystemTime->wHour = TimeFields.Hour; + lpSystemTime->wMinute = TimeFields.Minute; + lpSystemTime->wSecond = TimeFields.Second; + lpSystemTime->wMilliseconds = TimeFields.Milliseconds; + lpSystemTime->wDayOfWeek = TimeFields.Weekday; +} + +/* + * @implemented + */ +BOOL +WINAPI +SetLocalTime(IN CONST SYSTEMTIME *lpSystemTime) +{ + LARGE_INTEGER NewSystemTime, TimeZoneBias; + NTSTATUS Status; + ULONG Privilege = SE_SYSTEMTIME_PRIVILEGE; + TIME_FIELDS TimeFields; + PVOID State; + volatile KSYSTEM_TIME *TimePtr; + + TimePtr = IsTimeZoneRedirectionEnabled() ? + &BaseStaticServerData->ktTermsrvClientBias : + &SharedUserData->TimeZoneBias; + do + { + TimeZoneBias.HighPart = TimePtr->High1Time; + TimeZoneBias.LowPart = TimePtr->LowPart; + } + while (TimeZoneBias.HighPart != TimePtr->High2Time); + + TimeFields.Year = lpSystemTime->wYear; + TimeFields.Month = lpSystemTime->wMonth; + TimeFields.Day = lpSystemTime->wDay; + TimeFields.Hour = lpSystemTime->wHour; + TimeFields.Minute = lpSystemTime->wMinute; + TimeFields.Second = lpSystemTime->wSecond; + TimeFields.Milliseconds = lpSystemTime->wMilliseconds; + + if (!RtlTimeFieldsToTime(&TimeFields, &NewSystemTime)) + { + BaseSetLastNTError(STATUS_INVALID_PARAMETER); + return FALSE; + } + + NewSystemTime.QuadPart += TimeZoneBias.QuadPart; + + Status = RtlAcquirePrivilege(&Privilege, 1, 0, &State); + Status = STATUS_SUCCESS; + if (NT_SUCCESS(Status)) + { + Status = NtSetSystemTime(&NewSystemTime, NULL); + RtlReleasePrivilege(State); + } + + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + return TRUE; +} + +/* + * @implemented + */ +BOOL +WINAPI +SetSystemTime(IN CONST SYSTEMTIME *lpSystemTime) +{ + LARGE_INTEGER NewSystemTime; + NTSTATUS Status; + ULONG Privilege = SE_SYSTEMTIME_PRIVILEGE; + TIME_FIELDS TimeFields; + PVOID State; + + TimeFields.Year = lpSystemTime->wYear; + TimeFields.Month = lpSystemTime->wMonth; + TimeFields.Day = lpSystemTime->wDay; + TimeFields.Hour = lpSystemTime->wHour; + TimeFields.Minute = lpSystemTime->wMinute; + TimeFields.Second = lpSystemTime->wSecond; + TimeFields.Milliseconds = lpSystemTime->wMilliseconds; + + if (!RtlTimeFieldsToTime(&TimeFields, &NewSystemTime)) + { + BaseSetLastNTError(STATUS_INVALID_PARAMETER); + return FALSE; + } + + Status = RtlAcquirePrivilege(&Privilege, 1, 0, &State); + Status = STATUS_SUCCESS; + if (NT_SUCCESS(Status)) + { + Status = NtSetSystemTime(&NewSystemTime, NULL); + RtlReleasePrivilege(State); + } + + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + return TRUE; +} + +/* + * @implemented + */ +DWORD +WINAPI +GetTickCount(VOID) +{ + ULARGE_INTEGER TickCount; + + while (TRUE) + { + TickCount.HighPart = (ULONG)SharedUserData->TickCount.High1Time; + TickCount.LowPart = SharedUserData->TickCount.LowPart; + + if (TickCount.HighPart == (ULONG)SharedUserData->TickCount.High2Time) + break; + + YieldProcessor(); + } + + return (ULONG)((UInt32x32To64(TickCount.LowPart, + SharedUserData->TickCountMultiplier) >> 24) + + UInt32x32To64((TickCount.HighPart << 8) & 0xFFFFFFFF, + SharedUserData->TickCountMultiplier)); + +} + +/* + * @implemented + */ +BOOL +WINAPI +GetSystemTimeAdjustment(OUT PDWORD lpTimeAdjustment, + OUT PDWORD lpTimeIncrement, + OUT PBOOL lpTimeAdjustmentDisabled) +{ + SYSTEM_QUERY_TIME_ADJUST_INFORMATION TimeInfo; + NTSTATUS Status; + + Status = NtQuerySystemInformation(SystemTimeAdjustmentInformation, + &TimeInfo, + sizeof(TimeInfo), + NULL); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + *lpTimeAdjustment = (DWORD)TimeInfo.TimeAdjustment; + *lpTimeIncrement = (DWORD)TimeInfo.TimeIncrement; + *lpTimeAdjustmentDisabled = (BOOL)TimeInfo.Enable; + + return TRUE; +} + +/* + * @implemented + */ +BOOL +WINAPI +SetSystemTimeAdjustment(IN DWORD dwTimeAdjustment, + IN BOOL bTimeAdjustmentDisabled) +{ + NTSTATUS Status; + SYSTEM_SET_TIME_ADJUST_INFORMATION TimeInfo; + + TimeInfo.TimeAdjustment = (ULONG)dwTimeAdjustment; + TimeInfo.Enable = (BOOLEAN)bTimeAdjustmentDisabled; + + Status = NtSetSystemInformation(SystemTimeAdjustmentInformation, + &TimeInfo, + sizeof(TimeInfo)); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + return TRUE; +} + +/* + * @implemented + */ +BOOL +WINAPI +GetSystemTimes(OUT LPFILETIME lpIdleTime OPTIONAL, + OUT LPFILETIME lpKernelTime OPTIONAL, + OUT LPFILETIME lpUserTime OPTIONAL) +{ + PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION ProcPerfInfo; + LARGE_INTEGER TotalUserTime, TotalKernTime, TotalIdleTime; + SIZE_T BufferSize, ReturnLength; + ULONG i; + NTSTATUS Status; + + TotalUserTime.QuadPart = TotalKernTime.QuadPart = TotalIdleTime.QuadPart = 0; + + BufferSize = sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION) * + BaseStaticServerData->SysInfo.NumberOfProcessors; + + ProcPerfInfo = RtlAllocateHeap(RtlGetProcessHeap(), 0, BufferSize); + if (!ProcPerfInfo) + { + BaseSetLastNTError(STATUS_NO_MEMORY); + return FALSE; + } + + Status = ZwQuerySystemInformation(SystemProcessorPerformanceInformation, + ProcPerfInfo, + BufferSize, + &ReturnLength); + if ((NT_SUCCESS(Status)) && (ReturnLength == BufferSize)) + { + if (lpIdleTime) + { + for (i = 0; i < BaseStaticServerData->SysInfo.NumberOfProcessors; i++) + { + TotalIdleTime.QuadPart += ProcPerfInfo[i].IdleTime.QuadPart; + } + + lpIdleTime->dwLowDateTime = TotalIdleTime.LowPart; + lpIdleTime->dwHighDateTime = TotalIdleTime.HighPart; + } + + if (lpKernelTime) + { + for (i = 0; i < BaseStaticServerData->SysInfo.NumberOfProcessors; i++) + { + TotalKernTime.QuadPart += ProcPerfInfo[i].KernelTime.QuadPart; + } + + lpKernelTime->dwLowDateTime = TotalKernTime.LowPart; + lpKernelTime->dwHighDateTime = TotalKernTime.HighPart; + } + + if (lpUserTime) + { + for (i = 0; i < BaseStaticServerData->SysInfo.NumberOfProcessors; i++) + { + TotalUserTime.QuadPart += ProcPerfInfo[i].UserTime.QuadPart; + } + + lpUserTime->dwLowDateTime = TotalUserTime.LowPart; + lpUserTime->dwHighDateTime = TotalUserTime.HighPart; + } + } + else if (NT_SUCCESS(Status)) + { + Status = STATUS_INTERNAL_ERROR; + } + + RtlFreeHeap(RtlGetProcessHeap(), 0, ProcPerfInfo); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + return TRUE; +} + +/* + * @unimplemented + */ +BOOL +WINAPI +SetClientTimeZoneInformation(IN CONST TIME_ZONE_INFORMATION *lpTimeZoneInformation) +{ + STUB; + return 0; +} + +/* EOF */ diff --git a/dll/win32/kernel32/client/timerqueue.c b/dll/win32/kernel32/client/timerqueue.c new file mode 100644 index 00000000000..5a24a258b9f --- /dev/null +++ b/dll/win32/kernel32/client/timerqueue.c @@ -0,0 +1,321 @@ +/* + * PROJECT: ReactOS Win32 Base API + * LICENSE: See COPYING in the top level directory + * FILE: dll/win32/kernel32/client/timerqueue.c + * PURPOSE: Timer Queue Functions + * PROGRAMMERS: Thomas Weidenmueller + */ + +/* INCLUDES *******************************************************************/ + +#include + +#define NDEBUG +#include + +/* GLOBALS ********************************************************************/ + +HANDLE BasepDefaultTimerQueue = NULL; + +/* PRIVATE FUNCTIONS **********************************************************/ + +/* FIXME - make this thread safe */ +BOOL +WINAPI +BasepCreateDefaultTimerQueue(VOID) +{ + NTSTATUS Status; + + /* Create the timer queue */ + Status = RtlCreateTimerQueue(&BasepDefaultTimerQueue); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + DPRINT1("Unable to create the default timer queue!\n"); + return FALSE; + } + + return TRUE; +} + +/* PUBLIC FUNCTIONS ***********************************************************/ + + +/* + * @implemented + */ +BOOL +WINAPI +CancelTimerQueueTimer(IN HANDLE TimerQueue, + IN HANDLE Timer) +{ + NTSTATUS Status; + + if (!TimerQueue) + { + /* Use the default timer queue */ + TimerQueue = BasepDefaultTimerQueue; + if (!TimerQueue) + { + /* A timer is being cancelled before one was created... fail */ + SetLastError(ERROR_INVALID_HANDLE); + return FALSE; + } + } + + /* Delete the timer */ + Status = RtlDeleteTimer(TimerQueue, Timer, NULL); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + return TRUE; +} + +/* + * @implemented + */ +BOOL +WINAPI +ChangeTimerQueueTimer(IN HANDLE TimerQueue, + IN HANDLE Timer, + IN ULONG DueTime, + IN ULONG Period) +{ + NTSTATUS Status; + + if (!TimerQueue) + { + /* Use the default timer queue */ + TimerQueue = BasepDefaultTimerQueue; + if (!TimerQueue) + { + /* A timer is being cancelled before one was created... fail */ + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + } + + /* Delete the timer */ + Status = RtlUpdateTimer(TimerQueue, Timer, DueTime, Period); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + return TRUE; +} + +/* + * @implemented + */ +HANDLE +WINAPI +CreateTimerQueue(VOID) +{ + HANDLE Handle; + NTSTATUS Status; + + /* Create the timer queue */ + Status = RtlCreateTimerQueue(&Handle); + if(!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return NULL; + } + + return Handle; +} + +/* + * @implemented + */ +BOOL +WINAPI +CreateTimerQueueTimer(OUT PHANDLE phNewTimer, + IN HANDLE TimerQueue, + IN WAITORTIMERCALLBACK Callback, + IN PVOID Parameter, + IN DWORD DueTime, + IN DWORD Period, + IN ULONG Flags) +{ + NTSTATUS Status; + + /* Parameter is not optional -- clear it now */ + *phNewTimer = NULL; + + /* Check if no queue was given */ + if (!TimerQueue) + { + /* Create the queue if it didn't already exist */ + if (!(BasepDefaultTimerQueue) && !(BasepCreateDefaultTimerQueue())) + { + return FALSE; + } + + /* Use the default queue */ + TimerQueue = BasepDefaultTimerQueue; + } + + /* Create the timer. Note that no parameter checking is done here */ + Status = RtlCreateTimer(TimerQueue, + phNewTimer, + Callback, + Parameter, + DueTime, + Period, + Flags); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + return TRUE; +} + +/* + * @implemented + */ +BOOL +WINAPI +DeleteTimerQueue(IN HANDLE TimerQueue) +{ + /* We don't allow the user to delete the default timer queue */ + if (!TimerQueue) + { + SetLastError(ERROR_INVALID_HANDLE); + return FALSE; + } + + /* Delete the timer queue */ + RtlDeleteTimerQueueEx(TimerQueue, 0); + return TRUE; +} + +/* + * @implemented + */ +BOOL +WINAPI +DeleteTimerQueueEx(IN HANDLE TimerQueue, + IN HANDLE CompletionEvent) +{ + NTSTATUS Status; + + /* We don't allow the user to delete the default timer queue */ + if (!TimerQueue) + { + SetLastError(ERROR_INVALID_HANDLE); + return FALSE; + } + + /* Delete the timer queue */ + Status = RtlDeleteTimerQueueEx(TimerQueue, CompletionEvent); + if (((CompletionEvent != INVALID_HANDLE_VALUE) && (Status == STATUS_PENDING)) || + !(NT_SUCCESS(Status))) + { + /* In case CompletionEvent == NULL, RtlDeleteTimerQueueEx() returns before + all callback routines returned. We set the last error code to STATUS_PENDING + and return FALSE. In case CompletionEvent == INVALID_HANDLE_VALUE we only + can get here if another error occured. In case CompletionEvent is something + else, we get here and fail, even though it isn't really an error (if Status == STATUS_PENDING). + We also handle all other failures the same way. */ + BaseSetLastNTError(Status); + return FALSE; + } + + return TRUE; +} + +/* + * @implemented + */ +BOOL +WINAPI +DeleteTimerQueueTimer(IN HANDLE TimerQueue, + IN HANDLE Timer, + IN HANDLE CompletionEvent) +{ + NTSTATUS Status; + + if (!TimerQueue) + { + /* Use the default timer queue */ + TimerQueue = BasepDefaultTimerQueue; + if (!TimerQueue) + { + /* A timer is being cancelled before one was created... fail */ + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + } + + /* Delete the timer */ + Status = RtlDeleteTimer(TimerQueue, Timer, CompletionEvent); + if (((CompletionEvent != INVALID_HANDLE_VALUE) && (Status == STATUS_PENDING)) || + !(NT_SUCCESS(Status))) + { + /* In case CompletionEvent == NULL, RtlDeleteTimerQueueEx() returns before + all callback routines returned. We set the last error code to STATUS_PENDING + and return FALSE. In case CompletionEvent == INVALID_HANDLE_VALUE we only + can get here if another error occured. In case CompletionEvent is something + else, we get here and fail, even though it isn't really an error (if Status == STATUS_PENDING). + We also handle all other failures the same way. */ + BaseSetLastNTError(Status); + return FALSE; + } + + return TRUE; +} + +/* + * @implemented + */ +HANDLE +WINAPI +SetTimerQueueTimer(IN HANDLE TimerQueue, + IN WAITORTIMERCALLBACK Callback, + IN PVOID Parameter, + IN DWORD DueTime, + IN DWORD Period, + IN BOOL PreferIo) +{ + HANDLE Timer; + NTSTATUS Status; + + /* Check if no queue was given */ + if (!TimerQueue) + { + /* Create the queue if it didn't already exist */ + if (!(BasepDefaultTimerQueue) && !(BasepCreateDefaultTimerQueue())) + { + return FALSE; + } + + /* Use the default queue */ + TimerQueue = BasepDefaultTimerQueue; + } + + /* Create the timer */ + Status = RtlCreateTimer(TimerQueue, + &Timer, + Callback, + Parameter, + DueTime, + Period, + PreferIo ? WT_EXECUTEINIOTHREAD : WT_EXECUTEDEFAULT); + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return NULL; + } + + return Timer; +} + +/* EOF */ diff --git a/dll/win32/kernel32/misc/toolhelp.c b/dll/win32/kernel32/client/toolhelp.c similarity index 98% rename from dll/win32/kernel32/misc/toolhelp.c rename to dll/win32/kernel32/client/toolhelp.c index aafd9e89911..ca2f558bd27 100644 --- a/dll/win32/kernel32/misc/toolhelp.c +++ b/dll/win32/kernel32/client/toolhelp.c @@ -562,7 +562,7 @@ Heap32First(LPHEAPENTRY32 lphe, DWORD th32ProcessID, DWORD th32HeapID) if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -652,7 +652,7 @@ Heap32Next(LPHEAPENTRY32 lphe) if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -710,7 +710,7 @@ Heap32ListFirst(HANDLE hSnapshot, LPHEAPLIST32 lphl) return Ret; } - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -764,7 +764,7 @@ Heap32ListNext(HANDLE hSnapshot, LPHEAPLIST32 lphl) return Ret; } - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -851,7 +851,7 @@ Module32FirstW(HANDLE hSnapshot, LPMODULEENTRY32W lpme) return Ret; } - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -938,7 +938,7 @@ Module32NextW(HANDLE hSnapshot, LPMODULEENTRY32W lpme) return Ret; } - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -1027,7 +1027,7 @@ Process32FirstW(HANDLE hSnapshot, LPPROCESSENTRY32W lppe) return Ret; } - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -1114,7 +1114,7 @@ Process32NextW(HANDLE hSnapshot, LPPROCESSENTRY32W lppe) return Ret; } - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -1168,7 +1168,7 @@ Thread32First(HANDLE hSnapshot, LPTHREADENTRY32 lpte) return Ret; } - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -1222,7 +1222,7 @@ Thread32Next(HANDLE hSnapshot, LPTHREADENTRY32 lpte) return Ret; } - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -1276,7 +1276,7 @@ CreateToolhelp32Snapshot(DWORD dwFlags, DWORD th32ProcessID) &ProcThrdInfoSize); if(!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return NULL; } @@ -1300,7 +1300,7 @@ CreateToolhelp32Snapshot(DWORD dwFlags, DWORD th32ProcessID) if(!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return NULL; } diff --git a/dll/win32/kernel32/misc/utils.c b/dll/win32/kernel32/client/utils.c similarity index 84% rename from dll/win32/kernel32/misc/utils.c rename to dll/win32/kernel32/client/utils.c index a011ff5e6e3..db200fb635a 100644 --- a/dll/win32/kernel32/misc/utils.c +++ b/dll/win32/kernel32/client/utils.c @@ -81,7 +81,7 @@ Basep8BitStringToDynamicUnicodeString(OUT PUNICODE_STRING UnicodeString, /* Handle failure */ if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -117,6 +117,19 @@ BasepAnsiStringToHeapUnicodeString(IN LPCSTR AnsiString, } } +PLARGE_INTEGER +WINAPI +BaseFormatTimeOut(OUT PLARGE_INTEGER Timeout, + IN DWORD dwMilliseconds) +{ + /* Check if this is an infinite wait, which means no timeout argument */ + if (dwMilliseconds == INFINITE) return NULL; + + /* Otherwise, convert the time to NT Format */ + Timeout->QuadPart = UInt32x32To64(dwMilliseconds, -10000); + return Timeout; +} + /* * Converts lpSecurityAttributes + Object Name into ObjectAttributes. */ @@ -323,8 +336,9 @@ BasepInitializeContext(IN PCONTEXT Context, IN ULONG ContextType) { #ifdef _M_IX86 + ULONG ContextFlags; DPRINT("BasepInitializeContext: %p\n", Context); - + /* Setup the Initial Win32 Thread Context */ Context->Eax = (ULONG)StartAddress; Context->Ebx = (ULONG)Parameter; @@ -339,30 +353,53 @@ BasepInitializeContext(IN PCONTEXT Context, Context->SegSs = KGDT_R3_DATA | RPL_MASK; Context->SegGs = 0; + /* Set the Context Flags */ + ContextFlags = Context->ContextFlags; + Context->ContextFlags = CONTEXT_FULL; + + /* Give it some room for the Parameter */ + Context->Esp -= sizeof(PVOID); + /* Set the EFLAGS */ Context->EFlags = 0x3000; /* IOPL 3 */ - if (ContextType == 1) /* For Threads */ + /* What kind of context is being created? */ + if (ContextType == 1) { + /* For Threads */ Context->Eip = (ULONG)BaseThreadStartupThunk; } - else if (ContextType == 2) /* For Fibers */ + else if (ContextType == 2) { - Context->Eip = (ULONG)BaseFiberStartup; + /* This is a fiber: make space for the return address */ + Context->Esp -= sizeof(PVOID); + *((PVOID*)Context->Esp) = BaseFiberStartup; + + /* Is FPU state required? */ + Context->ContextFlags |= ContextFlags; + if (ContextFlags == CONTEXT_FLOATING_POINT) + { + /* Set an initial state */ + Context->FloatSave.ControlWord = 0x27F; + Context->FloatSave.StatusWord = 0; + Context->FloatSave.TagWord = 0xFFFF; + Context->FloatSave.ErrorOffset = 0; + Context->FloatSave.ErrorSelector = 0; + Context->FloatSave.DataOffset = 0; + Context->FloatSave.DataSelector = 0; + if (SharedUserData->ProcessorFeatures[PF_XMMI_INSTRUCTIONS_AVAILABLE]) + Context->Dr6 = 0x1F80; + } } - else /* For first thread in a Process */ + else { + /* For first thread in a Process */ Context->Eip = (ULONG)BaseProcessStartThunk; } - - /* Set the Context Flags */ - Context->ContextFlags = CONTEXT_FULL; - - /* Give it some room for the Parameter */ - Context->Esp -= sizeof(PVOID); + #elif defined(_M_AMD64) DPRINT("BasepInitializeContext: %p\n", Context); - + /* Setup the Initial Win32 Thread Context */ Context->Rax = (ULONG_PTR)StartAddress; Context->Rbx = (ULONG_PTR)Parameter; @@ -392,10 +429,10 @@ BasepInitializeContext(IN PCONTEXT Context, { Context->Rip = (ULONG_PTR)BaseProcessStartThunk; } - + /* Set the Context Flags */ Context->ContextFlags = CONTEXT_FULL; - + /* Give it some room for the Parameter */ Context->Rsp -= sizeof(PVOID); #else @@ -424,7 +461,7 @@ BasepMapFile(IN LPCWSTR lpApplicationName, OUT PHANDLE hSection, IN PUNICODE_STRING ApplicationName) { - CURDIR RelativeName; + RTL_RELATIVE_NAME_U RelativeName; OBJECT_ATTRIBUTES ObjectAttributes; NTSTATUS Status; HANDLE hFile = NULL; @@ -433,7 +470,7 @@ BasepMapFile(IN LPCWSTR lpApplicationName, DPRINT("BasepMapFile\n"); /* Zero out the Relative Directory */ - RelativeName.Handle = NULL; + RelativeName.ContainingDirectory = NULL; /* Find the application name */ if (!RtlDosPathNameToNtPathName_U(lpApplicationName, @@ -445,19 +482,19 @@ BasepMapFile(IN LPCWSTR lpApplicationName, } DPRINT("ApplicationName %wZ\n", ApplicationName); - DPRINT("RelativeName %wZ\n", &RelativeName.DosPath); + DPRINT("RelativeName %wZ\n", &RelativeName.RelativeName); /* Did we get a relative name? */ - if (RelativeName.DosPath.Length) + if (RelativeName.RelativeName.Length) { - ApplicationName = &RelativeName.DosPath; + ApplicationName = &RelativeName.RelativeName; } /* Initialize the Object Attributes */ InitializeObjectAttributes(&ObjectAttributes, ApplicationName, OBJ_CASE_INSENSITIVE, - RelativeName.Handle, + RelativeName.ContainingDirectory, NULL); /* Try to open the executable */ @@ -470,7 +507,7 @@ BasepMapFile(IN LPCWSTR lpApplicationName, if (!NT_SUCCESS(Status)) { DPRINT1("Failed to open file\n"); - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return Status; } @@ -488,3 +525,39 @@ BasepMapFile(IN LPCWSTR lpApplicationName, DPRINT("Section: %lx for file: %lx\n", *hSection, hFile); return Status; } + +/* + * @unimplemented + */ +BOOL +WINAPI +BaseCheckRunApp(IN DWORD Unknown1, + IN DWORD Unknown2, + IN DWORD Unknown3, + IN DWORD Unknown4, + IN DWORD Unknown5, + IN DWORD Unknown6, + IN DWORD Unknown7, + IN DWORD Unknown8, + IN DWORD Unknown9, + IN DWORD Unknown10) +{ + STUB; + return FALSE; +} + +/* + * @unimplemented + */ +BOOL +WINAPI +BasepCheckWinSaferRestrictions(IN DWORD Unknown1, + IN DWORD Unknown2, + IN DWORD Unknown3, + IN DWORD Unknown4, + IN DWORD Unknown5, + IN DWORD Unknown6) +{ + STUB; + return FALSE; +} diff --git a/dll/win32/kernel32/client/vdm.c b/dll/win32/kernel32/client/vdm.c new file mode 100644 index 00000000000..7ed8780fd09 --- /dev/null +++ b/dll/win32/kernel32/client/vdm.c @@ -0,0 +1,169 @@ +/* + * PROJECT: ReactOS Win32 Base API + * LICENSE: GPL - See COPYING in the top level directory + * FILE: dll/win32/kernel32/client/vdm.c + * PURPOSE: Virtual Dos Machine (VDM) Support + * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org) + */ + +/* INCLUDES *******************************************************************/ + +#include + +#define NDEBUG +#include + +/* TYPES **********************************************************************/ + +/* FUNCTIONS ******************************************************************/ + +/* + * @unimplemented + */ +BOOL +WINAPI +CmdBatNotification ( + DWORD Unknown + ) +{ + STUB; + return FALSE; +} + +/* + * @unimplemented + */ +DWORD +WINAPI +ExitVDM ( + DWORD Unknown0, + DWORD Unknown1 + ) +{ + STUB; + return 0; +} + + +/* + * @unimplemented + */ +DWORD +WINAPI +GetNextVDMCommand ( + DWORD Unknown0 + ) +{ + STUB; + return 0; +} + + +/* + * @unimplemented + */ +DWORD +WINAPI +GetVDMCurrentDirectories ( + DWORD Unknown0, + DWORD Unknown1 + ) +{ + STUB; + return 0; +} + + +/* + * @unimplemented + */ +BOOL +WINAPI +RegisterConsoleVDM ( + DWORD Unknown0, + DWORD Unknown1, + DWORD Unknown2, + DWORD Unknown3, + DWORD Unknown4, + DWORD Unknown5, + DWORD Unknown6, + DWORD Unknown7, + DWORD Unknown8, + DWORD Unknown9, + DWORD Unknown10 + ) +{ + STUB; + return FALSE; +} + + +/* + * @unimplemented + */ +BOOL +WINAPI +RegisterWowBaseHandlers ( + DWORD Unknown0 + ) +{ + STUB; + return FALSE; +} + + +/* + * @unimplemented + */ +BOOL +WINAPI +RegisterWowExec ( + DWORD Unknown0 + ) +{ + STUB; + return FALSE; +} + + +/* + * @unimplemented + */ +BOOL +WINAPI +SetVDMCurrentDirectories ( + DWORD Unknown0, + DWORD Unknown1 + ) +{ + STUB; + return FALSE; +} + +/* + * @unimplemented + */ +DWORD +WINAPI +VDMConsoleOperation ( + DWORD Unknown0, + DWORD Unknown1 + ) +{ + STUB; + return 0; +} + + +/* + * @unimplemented + */ +DWORD +WINAPI +VDMOperationStarted ( + DWORD Unknown0 + ) +{ + STUB; + return 0; +} diff --git a/dll/win32/kernel32/client/version.c b/dll/win32/kernel32/client/version.c new file mode 100644 index 00000000000..f1757af64eb --- /dev/null +++ b/dll/win32/kernel32/client/version.c @@ -0,0 +1,223 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * FILE: dll/win32/kernel32/misc/version.c + * PURPOSE: Version functions + * PROGRAMMER: Ariadne (ariadne@xs4all.nl) + Ged Murphy (gedmurphy@reactos.org) + */ + +#include + +#define NDEBUG +#include + +/* FUNCTIONS ******************************************************************/ + +VOID +NTAPI +SetRosSpecificInfo(IN LPOSVERSIONINFOEXW VersionInformation) +{ + CHAR Buffer[sizeof(KEY_VALUE_PARTIAL_INFORMATION) + sizeof(DWORD)]; + PKEY_VALUE_PARTIAL_INFORMATION kvpInfo = (PVOID)Buffer; + OBJECT_ATTRIBUTES ObjectAttributes; + DWORD ReportAsWorkstation = 0; + HANDLE hKey; + DWORD dwSize; + NTSTATUS Status; + UNICODE_STRING KeyName = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\ReactOS\\Settings\\Version"); + UNICODE_STRING ValName = RTL_CONSTANT_STRING(L"ReportAsWorkstation"); + + InitializeObjectAttributes(&ObjectAttributes, + &KeyName, + OBJ_OPENIF | OBJ_CASE_INSENSITIVE, + NULL, + NULL); + + /* Don't change anything if the key doesn't exist */ + Status = NtOpenKey(&hKey, KEY_READ, &ObjectAttributes); + if (NT_SUCCESS(Status)) + { + /* Get the value from the registry and make sure it's a 32-bit value */ + Status = NtQueryValueKey(hKey, + &ValName, + KeyValuePartialInformation, + kvpInfo, + sizeof(Buffer), + &dwSize); + if ((NT_SUCCESS(Status)) && + (kvpInfo->Type == REG_DWORD) && + (kvpInfo->DataLength == sizeof(DWORD))) + { + /* Is the value set? */ + ReportAsWorkstation = *(PULONG)kvpInfo->Data; + if ((VersionInformation->wProductType == VER_NT_SERVER) && + (ReportAsWorkstation)) + { + /* It is, modify the product type to report a workstation */ + VersionInformation->wProductType = VER_NT_WORKSTATION; + DPRINT1("We modified the reported OS from NtProductServer to NtProductWinNt\n"); + } + } + + /* Close the handle */ + NtClose(hKey); + } +} + +/* + * @implemented + */ +DWORD +WINAPI +GetVersion(VOID) +{ + PPEB Peb = NtCurrentPeb(); + DWORD Result; + + Result = MAKELONG(MAKEWORD(Peb->OSMajorVersion, Peb->OSMinorVersion), + (Peb->OSPlatformId ^ 2) << 14); + Result |= LOWORD(Peb->OSBuildNumber) << 16; + return Result; +} + +/* + * @implemented + */ +BOOL +WINAPI +GetVersionExW(IN LPOSVERSIONINFOW lpVersionInformation) +{ + NTSTATUS Status; + LPOSVERSIONINFOEXW lpVersionInformationEx; + + if ((lpVersionInformation->dwOSVersionInfoSize != sizeof(OSVERSIONINFOW)) && + (lpVersionInformation->dwOSVersionInfoSize != sizeof(OSVERSIONINFOEXW))) + { + SetLastError(ERROR_INSUFFICIENT_BUFFER); + return FALSE; + } + + Status = RtlGetVersion((PRTL_OSVERSIONINFOW)lpVersionInformation); + if (Status == STATUS_SUCCESS) + { + if (lpVersionInformation->dwOSVersionInfoSize == sizeof(OSVERSIONINFOEXW)) + { + lpVersionInformationEx = (PVOID)lpVersionInformation; + lpVersionInformationEx->wReserved = 0; + + /* ReactOS specific changes */ + SetRosSpecificInfo(lpVersionInformationEx); + } + + return TRUE; + } + + return FALSE; +} + +/* + * @implemented + */ +BOOL +WINAPI +GetVersionExA(IN LPOSVERSIONINFOA lpVersionInformation) +{ + OSVERSIONINFOEXW VersionInformation; + LPOSVERSIONINFOEXA lpVersionInformationEx; + UNICODE_STRING CsdVersionW; + NTSTATUS Status; + ANSI_STRING CsdVersionA; + + if ((lpVersionInformation->dwOSVersionInfoSize != sizeof(OSVERSIONINFOA)) && + (lpVersionInformation->dwOSVersionInfoSize != sizeof(OSVERSIONINFOEXA))) + { + SetLastError(ERROR_INSUFFICIENT_BUFFER); + return FALSE; + } + + VersionInformation.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXW); + + if (!GetVersionExW((LPOSVERSIONINFOW)&VersionInformation)) return FALSE; + + /* Copy back fields that match both supported structures */ + lpVersionInformation->dwMajorVersion = VersionInformation.dwMajorVersion; + lpVersionInformation->dwMinorVersion = VersionInformation.dwMinorVersion; + lpVersionInformation->dwBuildNumber = VersionInformation.dwBuildNumber; + lpVersionInformation->dwPlatformId = VersionInformation.dwPlatformId; + + if (lpVersionInformation->dwOSVersionInfoSize == sizeof(OSVERSIONINFOEXA)) + { + lpVersionInformationEx = (PVOID)lpVersionInformation; + lpVersionInformationEx->wServicePackMajor = VersionInformation.wServicePackMajor; + lpVersionInformationEx->wServicePackMinor = VersionInformation.wServicePackMinor; + lpVersionInformationEx->wSuiteMask = VersionInformation.wSuiteMask; + lpVersionInformationEx->wProductType = VersionInformation.wProductType; + lpVersionInformationEx->wReserved = VersionInformation.wReserved; + } + + /* Convert the CSD string */ + RtlInitEmptyAnsiString(&CsdVersionA, + lpVersionInformation->szCSDVersion, + sizeof(lpVersionInformation->szCSDVersion)); + RtlInitUnicodeString(&CsdVersionW, VersionInformation.szCSDVersion); + Status = RtlUnicodeStringToAnsiString(&CsdVersionA, &CsdVersionW, FALSE); + return (NT_SUCCESS(Status)); +} + +/* + * @implemented + */ +BOOL +WINAPI +VerifyVersionInfoW(IN LPOSVERSIONINFOEXW lpVersionInformation, + IN DWORD dwTypeMask, + IN DWORDLONG dwlConditionMask) +{ + NTSTATUS Status; + + Status = RtlVerifyVersionInfo((PRTL_OSVERSIONINFOEXW)lpVersionInformation, + dwTypeMask, + dwlConditionMask); + switch (Status) + { + case STATUS_INVALID_PARAMETER: + SetLastError(ERROR_BAD_ARGUMENTS); + return FALSE; + + case STATUS_REVISION_MISMATCH: + DPRINT1("ReactOS returning version mismatch. Investigate!\n"); + SetLastError(ERROR_OLD_WIN_VERSION); + return FALSE; + + default: + /* RtlVerifyVersionInfo shouldn't report any other failure code! */ + ASSERT(NT_SUCCESS(Status)); + return TRUE; + } +} + +/* + * @implemented + */ +BOOL +WINAPI +VerifyVersionInfoA(IN LPOSVERSIONINFOEXA lpVersionInformation, + IN DWORD dwTypeMask, + IN DWORDLONG dwlConditionMask) +{ + OSVERSIONINFOEXW viex; + + /* NOTE: szCSDVersion is ignored, we don't need to convert it to Unicode */ + viex.dwOSVersionInfoSize = sizeof(viex); + viex.dwMajorVersion = lpVersionInformation->dwMajorVersion; + viex.dwMinorVersion = lpVersionInformation->dwMinorVersion; + viex.dwBuildNumber = lpVersionInformation->dwBuildNumber; + viex.dwPlatformId = lpVersionInformation->dwPlatformId; + viex.wServicePackMajor = lpVersionInformation->wServicePackMajor; + viex.wServicePackMinor = lpVersionInformation->wServicePackMinor; + viex.wSuiteMask = lpVersionInformation->wSuiteMask; + viex.wProductType = lpVersionInformation->wProductType; + viex.wReserved = lpVersionInformation->wReserved; + return VerifyVersionInfoW(&viex, dwTypeMask, dwlConditionMask); +} diff --git a/dll/win32/kernel32/mem/virtual.c b/dll/win32/kernel32/client/virtmem.c similarity index 71% rename from dll/win32/kernel32/mem/virtual.c rename to dll/win32/kernel32/client/virtmem.c index 5ccc3dff170..73ce2755d45 100644 --- a/dll/win32/kernel32/mem/virtual.c +++ b/dll/win32/kernel32/client/virtmem.c @@ -1,19 +1,19 @@ /* * PROJECT: ReactOS Win32 Base API * LICENSE: GPL - See COPYING in the top level directory - * FILE: dll/win32/kernel32/mem/virtual.c + * FILE: dll/win32/kernel32/client/virtmem.c * PURPOSE: Handles virtual memory APIs * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org) */ -/* INCLUDES ******************************************************************/ +/* INCLUDES *******************************************************************/ #include #define NDEBUG #include -/* FUNCTIONS *****************************************************************/ +/* FUNCTIONS ******************************************************************/ /* * @implemented @@ -27,18 +27,38 @@ VirtualAllocEx(IN HANDLE hProcess, IN DWORD flProtect) { NTSTATUS Status; - - /* Allocate the memory */ - Status = NtAllocateVirtualMemory(hProcess, - (PVOID *)&lpAddress, - 0, - &dwSize, - flAllocationType, - flProtect); + + /* Make sure the address is within the granularity of the system (64K) */ + if ((lpAddress) && + (lpAddress < (PVOID)BaseStaticServerData->SysInfo.AllocationGranularity)) + { + /* Fail the call */ + SetLastError(ERROR_INVALID_PARAMETER); + return NULL; + } + + /* Handle any possible exceptions */ + _SEH2_TRY + { + /* Allocate the memory */ + Status = NtAllocateVirtualMemory(hProcess, + &lpAddress, + 0, + &dwSize, + flAllocationType, + flProtect); + } + _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) + { + Status = _SEH2_GetExceptionCode(); + } + _SEH2_END; + + /* Check for status */ if (!NT_SUCCESS(Status)) { /* We failed */ - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return NULL; } @@ -76,17 +96,18 @@ VirtualFreeEx(IN HANDLE hProcess, { NTSTATUS Status; - if (dwSize == 0 || !(dwFreeType & MEM_RELEASE)) + /* Validate size and flags */ + if (!(dwSize) || !(dwFreeType & MEM_RELEASE)) { /* Free the memory */ Status = NtFreeVirtualMemory(hProcess, - (PVOID *)&lpAddress, - (PULONG)&dwSize, + &lpAddress, + &dwSize, dwFreeType); if (!NT_SUCCESS(Status)) { /* We failed */ - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -94,7 +115,8 @@ VirtualFreeEx(IN HANDLE hProcess, return TRUE; } - SetLastErrorByStatus(STATUS_INVALID_PARAMETER); + /* Invalid combo */ + BaseSetLastNTError(STATUS_INVALID_PARAMETER); return FALSE; } @@ -154,7 +176,7 @@ VirtualProtectEx(IN HANDLE hProcess, if (!NT_SUCCESS(Status)) { /* We failed */ - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -182,7 +204,7 @@ VirtualLock(IN LPVOID lpAddress, if (!NT_SUCCESS(Status)) { /* We failed */ - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -229,7 +251,7 @@ VirtualQueryEx(IN HANDLE hProcess, if (!NT_SUCCESS(Status)) { /* We failed */ - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return 0; } @@ -257,7 +279,7 @@ VirtualUnlock(IN LPVOID lpAddress, if (!NT_SUCCESS(Status)) { /* We failed */ - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -270,14 +292,12 @@ VirtualUnlock(IN LPVOID lpAddress, */ UINT WINAPI -GetWriteWatch( - DWORD dwFlags, - PVOID lpBaseAddress, - SIZE_T dwRegionSize, - PVOID *lpAddresses, - PULONG_PTR lpdwCount, - PULONG lpdwGranularity - ) +GetWriteWatch(IN DWORD dwFlags, + IN PVOID lpBaseAddress, + IN SIZE_T dwRegionSize, + IN PVOID *lpAddresses, + OUT PULONG_PTR lpdwCount, + OUT PULONG lpdwGranularity) { NTSTATUS Status; @@ -288,10 +308,9 @@ GetWriteWatch( lpAddresses, lpdwCount, lpdwGranularity); - if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return -1; } @@ -303,20 +322,17 @@ GetWriteWatch( */ UINT WINAPI -ResetWriteWatch( - LPVOID lpBaseAddress, - SIZE_T dwRegionSize - ) +ResetWriteWatch(IN LPVOID lpBaseAddress, + IN SIZE_T dwRegionSize) { NTSTATUS Status; Status = NtResetWriteWatch(NtCurrentProcess(), lpBaseAddress, dwRegionSize); - if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return -1; } @@ -328,21 +344,16 @@ ResetWriteWatch( */ BOOL WINAPI -AllocateUserPhysicalPages( - HANDLE hProcess, - PULONG_PTR NumberOfPages, - PULONG_PTR UserPfnArray - ) +AllocateUserPhysicalPages(IN HANDLE hProcess, + IN PULONG_PTR NumberOfPages, + OUT PULONG_PTR UserPfnArray) { NTSTATUS Status; - Status = NtAllocateUserPhysicalPages(hProcess, - NumberOfPages, - UserPfnArray); - + Status = NtAllocateUserPhysicalPages(hProcess, NumberOfPages, UserPfnArray); if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -354,21 +365,16 @@ AllocateUserPhysicalPages( */ BOOL WINAPI -FreeUserPhysicalPages( - HANDLE hProcess, - PULONG_PTR NumberOfPages, - PULONG_PTR PageArray - ) +FreeUserPhysicalPages(IN HANDLE hProcess, + IN PULONG_PTR NumberOfPages, + IN PULONG_PTR PageArray) { NTSTATUS Status; - Status = NtFreeUserPhysicalPages(hProcess, - NumberOfPages, - PageArray); - + Status = NtFreeUserPhysicalPages(hProcess, NumberOfPages, PageArray); if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -380,21 +386,16 @@ FreeUserPhysicalPages( */ BOOL WINAPI -MapUserPhysicalPages( - PVOID VirtualAddress, - ULONG_PTR NumberOfPages, - PULONG_PTR PageArray OPTIONAL - ) +MapUserPhysicalPages(IN PVOID VirtualAddress, + IN ULONG_PTR NumberOfPages, + OUT PULONG_PTR PageArray OPTIONAL) { NTSTATUS Status; - Status = NtMapUserPhysicalPages(VirtualAddress, - NumberOfPages, - PageArray); - + Status = NtMapUserPhysicalPages(VirtualAddress, NumberOfPages, PageArray); if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -406,21 +407,18 @@ MapUserPhysicalPages( */ BOOL WINAPI -MapUserPhysicalPagesScatter( - PVOID *VirtualAddresses, - ULONG_PTR NumberOfPages, - PULONG_PTR PageArray OPTIONAL - ) +MapUserPhysicalPagesScatter(IN PVOID *VirtualAddresses, + IN ULONG_PTR NumberOfPages, + OUT PULONG_PTR PageArray OPTIONAL) { NTSTATUS Status; Status = NtMapUserPhysicalPagesScatter(VirtualAddresses, NumberOfPages, PageArray); - if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } diff --git a/dll/win32/kernel32/client/vista.c b/dll/win32/kernel32/client/vista.c new file mode 100644 index 00000000000..aff5208f1a3 --- /dev/null +++ b/dll/win32/kernel32/client/vista.c @@ -0,0 +1,870 @@ +/* COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS system libraries + * PURPOSE: Vista functions + * PROGRAMMER: Thomas Weidenmueller + */ + +#include + +#define NDEBUG +#include + +#if _WIN32_WINNT >= 0x600 + +/* FIXME: Move these RTL declarations to the NDK */ +NTSTATUS +NTAPI +RtlSleepConditionVariableCS(IN OUT PRTL_CONDITION_VARIABLE ConditionVariable, + IN OUT PRTL_CRITICAL_SECTION CriticalSection, + IN PLARGE_INTEGER TimeOut OPTIONAL); + +NTSTATUS +NTAPI +RtlSleepConditionVariableSRW(IN OUT PRTL_CONDITION_VARIABLE ConditionVariable, + IN OUT PRTL_SRWLOCK SRWLock, + IN PLARGE_INTEGER TimeOut OPTIONAL, + IN ULONG Flags); + +/* PUBLIC FUNCTIONS ***********************************************************/ + +/* + * @implemented + */ +BOOL +WINAPI +SleepConditionVariableCS(IN OUT PCONDITION_VARIABLE ConditionVariable, + IN OUT PCRITICAL_SECTION CriticalSection, + IN DWORD dwMilliseconds) +{ + NTSTATUS Status = 0; + LARGE_INTEGER TimeOut; + PLARGE_INTEGER TimeOutPtr = NULL; + + if (dwMilliseconds != INFINITE) + { + TimeOut.QuadPart = UInt32x32To64(-10000, dwMilliseconds); + TimeOutPtr = &TimeOut; + } + +#if 0 + Status = RtlSleepConditionVariableCS((PRTL_CONDITION_VARIABLE)ConditionVariable, + (PRTL_CRITICAL_SECTION)CriticalSection, + TimeOutPtr); +#endif + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + return TRUE; +} + + +/* + * @implemented + */ +BOOL +WINAPI +SleepConditionVariableSRW(IN OUT PCONDITION_VARIABLE ConditionVariable, + IN OUT PSRWLOCK SRWLock, + IN DWORD dwMilliseconds, + IN ULONG Flags) +{ + NTSTATUS Status = 0; + LARGE_INTEGER TimeOut; + PLARGE_INTEGER TimeOutPtr = NULL; + + if (dwMilliseconds != INFINITE) + { + TimeOut.QuadPart = UInt32x32To64(-10000, dwMilliseconds); + TimeOutPtr = &TimeOut; + } + +#if 0 + Status = RtlSleepConditionVariableSRW((PRTL_CONDITION_VARIABLE)ConditionVariable, + (PRTL_SRWLOCK)SRWLock, + TimeOutPtr, + Flags); +#endif + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + + return TRUE; +} + + +/* + * @implemented + */ +BOOL WINAPI InitializeCriticalSectionEx(OUT LPCRITICAL_SECTION lpCriticalSection, + IN DWORD dwSpinCount, + IN DWORD flags ) +{ + NTSTATUS Status; + + /* FIXME: Flags ignored */ + + /* Initialize the critical section */ + Status = RtlInitializeCriticalSectionAndSpinCount( + (PRTL_CRITICAL_SECTION)lpCriticalSection, + dwSpinCount); + if (!NT_SUCCESS(Status)) + { + /* Set failure code */ + BaseSetLastNTError(Status); + return FALSE; + } + + /* Success */ + return TRUE; +} + + + +/* + * @implemented + */ +BOOL +WINAPI +QueryFullProcessImageNameW(HANDLE hProcess, + DWORD dwFlags, + LPWSTR lpExeName, + PDWORD pdwSize) +{ + BYTE Buffer[sizeof(UNICODE_STRING) + MAX_PATH * sizeof(WCHAR)]; + UNICODE_STRING *DynamicBuffer = NULL; + UNICODE_STRING *Result = NULL; + NTSTATUS Status; + DWORD Needed; + + Status = NtQueryInformationProcess(hProcess, + ProcessImageFileName, + Buffer, + sizeof(Buffer) - sizeof(WCHAR), + &Needed); + if (Status == STATUS_INFO_LENGTH_MISMATCH) + { + DynamicBuffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, Needed + sizeof(WCHAR)); + if (!DynamicBuffer) + { + BaseSetLastNTError(STATUS_NO_MEMORY); + return FALSE; + } + + Status = NtQueryInformationProcess(hProcess, + ProcessImageFileName, + (LPBYTE)DynamicBuffer, + Needed, + &Needed); + Result = DynamicBuffer; + } + else Result = (PUNICODE_STRING)Buffer; + + if (!NT_SUCCESS(Status)) goto Cleanup; + + if (Result->Length / sizeof(WCHAR) + 1 > *pdwSize) + { + Status = STATUS_BUFFER_TOO_SMALL; + goto Cleanup; + } + + *pdwSize = Result->Length / sizeof(WCHAR); + memcpy(lpExeName, Result->Buffer, Result->Length); + lpExeName[*pdwSize] = 0; + +Cleanup: + RtlFreeHeap(RtlGetProcessHeap(), 0, DynamicBuffer); + + if (!NT_SUCCESS(Status)) + { + BaseSetLastNTError(Status); + } + + return !Status; +} + + +/* + * @implemented + */ +BOOL +WINAPI +QueryFullProcessImageNameA(HANDLE hProcess, + DWORD dwFlags, + LPSTR lpExeName, + PDWORD pdwSize) +{ + DWORD pdwSizeW = *pdwSize; + BOOL Result; + LPWSTR lpExeNameW; + + lpExeNameW = RtlAllocateHeap(RtlGetProcessHeap(), + HEAP_ZERO_MEMORY, + *pdwSize * sizeof(WCHAR)); + if (!lpExeNameW) + { + BaseSetLastNTError(STATUS_NO_MEMORY); + return FALSE; + } + + Result = QueryFullProcessImageNameW(hProcess, dwFlags, lpExeNameW, &pdwSizeW); + + if (Result) + Result = (0 != WideCharToMultiByte(CP_ACP, 0, + lpExeNameW, + -1, + lpExeName, + *pdwSize, + NULL, NULL)); + + if (Result) + *pdwSize = strlen(lpExeName); + + RtlFreeHeap(RtlGetProcessHeap(), 0, lpExeNameW); + return Result; +} + +/* + * @unimplemented + */ +HRESULT +WINAPI +GetApplicationRecoveryCallback(IN HANDLE hProcess, + OUT APPLICATION_RECOVERY_CALLBACK* pRecoveryCallback, + OUT PVOID* ppvParameter, + PDWORD dwPingInterval, + PDWORD dwFlags) +{ + UNIMPLEMENTED; + return E_FAIL; +} + + +/* + * @unimplemented + */ +HRESULT +WINAPI +GetApplicationRestart(IN HANDLE hProcess, + OUT PWSTR pwzCommandline OPTIONAL, + IN OUT PDWORD pcchSize, + OUT PDWORD pdwFlags OPTIONAL) +{ + UNIMPLEMENTED; + return E_FAIL; +} + + +/* + * @unimplemented + */ +VOID +WINAPI +RecoveryFinished(IN BOOL bSuccess) +{ + UNIMPLEMENTED; +} + + +/* + * @unimplemented + */ +HRESULT +WINAPI +RecoveryInProgress(OUT PBOOL pbCancelled) +{ + UNIMPLEMENTED; + return E_FAIL; +} + + +/* + * @unimplemented + */ +HRESULT +WINAPI +RegisterApplicationRecoveryCallback(IN APPLICATION_RECOVERY_CALLBACK pRecoveyCallback, + IN PVOID pvParameter OPTIONAL, + DWORD dwPingInterval, + DWORD dwFlags) +{ + UNIMPLEMENTED; + return E_FAIL; +} + + +/* + * @unimplemented + */ +HRESULT +WINAPI +RegisterApplicationRestart(IN PCWSTR pwzCommandline OPTIONAL, + IN DWORD dwFlags) +{ + UNIMPLEMENTED; + return E_FAIL; +} + +/*-------------------------------------------------------------- + * GetConsoleHistoryInfo + * + * @implemented + */ +BOOL +WINAPI +GetConsoleHistoryInfo(PCONSOLE_HISTORY_INFO lpConsoleHistoryInfo) +{ + CSR_API_MESSAGE Request; + ULONG CsrRequest = MAKE_CSR_API(GET_HISTORY_INFO, CSR_CONSOLE); + NTSTATUS Status; + if (lpConsoleHistoryInfo->cbSize != sizeof(CONSOLE_HISTORY_INFO)) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + Status = CsrClientCallServer(&Request, NULL, CsrRequest, sizeof(CSR_API_MESSAGE)); + if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + lpConsoleHistoryInfo->HistoryBufferSize = Request.Data.GetHistoryInfo.HistoryBufferSize; + lpConsoleHistoryInfo->NumberOfHistoryBuffers = Request.Data.GetHistoryInfo.NumberOfHistoryBuffers; + lpConsoleHistoryInfo->dwFlags = Request.Data.GetHistoryInfo.dwFlags; + return TRUE; +} + + +/*-------------------------------------------------------------- + * SetConsoleHistoryInfo + * + * @implemented + */ +BOOL +WINAPI +SetConsoleHistoryInfo(IN PCONSOLE_HISTORY_INFO lpConsoleHistoryInfo) +{ + CSR_API_MESSAGE Request; + ULONG CsrRequest = MAKE_CSR_API(GET_HISTORY_INFO, CSR_CONSOLE); + NTSTATUS Status; + if (lpConsoleHistoryInfo->cbSize != sizeof(CONSOLE_HISTORY_INFO)) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + Request.Data.SetHistoryInfo.HistoryBufferSize = lpConsoleHistoryInfo->HistoryBufferSize; + Request.Data.SetHistoryInfo.NumberOfHistoryBuffers = lpConsoleHistoryInfo->NumberOfHistoryBuffers; + Request.Data.SetHistoryInfo.dwFlags = lpConsoleHistoryInfo->dwFlags; + Status = CsrClientCallServer(&Request, NULL, CsrRequest, sizeof(CSR_API_MESSAGE)); + if (!NT_SUCCESS(Status) || !NT_SUCCESS(Status = Request.Status)) + { + BaseSetLastNTError(Status); + return FALSE; + } + return TRUE; +} + + +/*-------------------------------------------------------------- + * GetConsoleOriginalTitleW + * + * @unimplemented + */ +DWORD +WINAPI +GetConsoleOriginalTitleW(OUT LPWSTR lpConsoleTitle, + IN DWORD nSize) +{ + DPRINT1("GetConsoleOriginalTitleW(0x%p, 0x%x) UNIMPLEMENTED!\n", lpConsoleTitle, nSize); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return 0; +} + + +/*-------------------------------------------------------------- + * GetConsoleOriginalTitleA + * + * @unimplemented + */ +DWORD +WINAPI +GetConsoleOriginalTitleA(OUT LPSTR lpConsoleTitle, + IN DWORD nSize) +{ + DPRINT1("GetConsoleOriginalTitleA(0x%p, 0x%x) UNIMPLEMENTED!\n", lpConsoleTitle, nSize); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return 0; +} + + +/*-------------------------------------------------------------- + * GetConsoleScreenBufferInfoEx + * + * @unimplemented + */ +BOOL +WINAPI +GetConsoleScreenBufferInfoEx(IN HANDLE hConsoleOutput, + OUT PCONSOLE_SCREEN_BUFFER_INFOEX lpConsoleScreenBufferInfoEx) +{ + DPRINT1("GetConsoleScreenBufferInfoEx(0x%p, 0x%p) UNIMPLEMENTED!\n", hConsoleOutput, lpConsoleScreenBufferInfoEx); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + + +/*-------------------------------------------------------------- + * SetConsoleScreenBufferInfoEx + * + * @unimplemented + */ +BOOL +WINAPI +SetConsoleScreenBufferInfoEx(IN HANDLE hConsoleOutput, + IN PCONSOLE_SCREEN_BUFFER_INFOEX lpConsoleScreenBufferInfoEx) +{ + DPRINT1("SetConsoleScreenBufferInfoEx(0x%p, 0x%p) UNIMPLEMENTED!\n", hConsoleOutput, lpConsoleScreenBufferInfoEx); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + + +/*-------------------------------------------------------------- + * GetCurrentConsoleFontEx + * + * @unimplemented + */ +BOOL +WINAPI +GetCurrentConsoleFontEx(IN HANDLE hConsoleOutput, + IN BOOL bMaximumWindow, + OUT PCONSOLE_FONT_INFOEX lpConsoleCurrentFontEx) +{ + DPRINT1("GetCurrentConsoleFontEx(0x%p, 0x%x, 0x%p) UNIMPLEMENTED!\n", hConsoleOutput, bMaximumWindow, lpConsoleCurrentFontEx); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + + +/* + * @implemented + */ +BOOLEAN +WINAPI +CreateSymbolicLinkW(IN LPCWSTR lpSymlinkFileName, + IN LPCWSTR lpTargetFileName, + IN DWORD dwFlags) +{ + IO_STATUS_BLOCK IoStatusBlock; + OBJECT_ATTRIBUTES ObjectAttributes; + HANDLE hSymlink = NULL; + UNICODE_STRING SymlinkFileName = { 0, 0, NULL }; + UNICODE_STRING TargetFileName = { 0, 0, NULL }; + BOOLEAN bAllocatedTarget = FALSE, bRelativePath = FALSE; + LPWSTR lpTargetFullFileName = NULL; + SIZE_T cbPrintName; + SIZE_T cbReparseData; + PREPARSE_DATA_BUFFER pReparseData = NULL; + PBYTE pBufTail; + NTSTATUS Status; + ULONG dwCreateOptions; + DWORD dwErr; + + if(!lpSymlinkFileName || !lpTargetFileName || (dwFlags | SYMBOLIC_LINK_FLAG_DIRECTORY) != SYMBOLIC_LINK_FLAG_DIRECTORY) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + if(dwFlags & SYMBOLIC_LINK_FLAG_DIRECTORY) + dwCreateOptions = FILE_DIRECTORY_FILE; + else + dwCreateOptions = FILE_NON_DIRECTORY_FILE; + + switch(RtlDetermineDosPathNameType_U(lpTargetFileName)) + { + case RtlPathTypeUnknown: + case RtlPathTypeRooted: + case RtlPathTypeRelative: + bRelativePath = TRUE; + RtlInitUnicodeString(&TargetFileName, lpTargetFileName); + break; + + case RtlPathTypeDriveRelative: + { + LPWSTR FilePart; + SIZE_T cchTargetFullFileName; + + cchTargetFullFileName = GetFullPathNameW(lpTargetFileName, 0, NULL, &FilePart); + + if(cchTargetFullFileName == 0) + { + dwErr = GetLastError(); + goto Cleanup; + } + + lpTargetFullFileName = RtlAllocateHeap(RtlGetProcessHeap(), 0, cchTargetFullFileName * sizeof(WCHAR)); + + if(lpTargetFullFileName == NULL) + { + dwErr = ERROR_NOT_ENOUGH_MEMORY; + goto Cleanup; + } + + if(GetFullPathNameW(lpTargetFileName, cchTargetFullFileName, lpTargetFullFileName, &FilePart) == 0) + { + dwErr = GetLastError(); + goto Cleanup; + } + } + + lpTargetFileName = lpTargetFullFileName; + + // fallthrough + + case RtlPathTypeUncAbsolute: + case RtlPathTypeDriveAbsolute: + case RtlPathTypeLocalDevice: + case RtlPathTypeRootLocalDevice: + default: + if(!RtlDosPathNameToNtPathName_U(lpTargetFileName, &TargetFileName, NULL, NULL)) + { + bAllocatedTarget = TRUE; + dwErr = ERROR_INVALID_PARAMETER; + goto Cleanup; + } + } + + cbPrintName = wcslen(lpTargetFileName) * sizeof(WCHAR); + cbReparseData = FIELD_OFFSET(REPARSE_DATA_BUFFER, SymbolicLinkReparseBuffer.PathBuffer) + TargetFileName.Length + cbPrintName; + pReparseData = RtlAllocateHeap(RtlGetProcessHeap(), 0, cbReparseData); + + if(pReparseData == NULL) + { + dwErr = ERROR_NOT_ENOUGH_MEMORY; + goto Cleanup; + } + + pBufTail = (PBYTE)(pReparseData->SymbolicLinkReparseBuffer.PathBuffer); + + pReparseData->ReparseTag = (ULONG)IO_REPARSE_TAG_SYMLINK; + pReparseData->ReparseDataLength = (USHORT)cbReparseData - REPARSE_DATA_BUFFER_HEADER_SIZE; + pReparseData->Reserved = 0; + + pReparseData->SymbolicLinkReparseBuffer.SubstituteNameOffset = 0; + pReparseData->SymbolicLinkReparseBuffer.SubstituteNameLength = TargetFileName.Length; + pBufTail += pReparseData->SymbolicLinkReparseBuffer.SubstituteNameOffset; + RtlCopyMemory(pBufTail, TargetFileName.Buffer, TargetFileName.Length); + + pReparseData->SymbolicLinkReparseBuffer.PrintNameOffset = pReparseData->SymbolicLinkReparseBuffer.SubstituteNameLength; + pReparseData->SymbolicLinkReparseBuffer.PrintNameLength = (USHORT)cbPrintName; + pBufTail += pReparseData->SymbolicLinkReparseBuffer.PrintNameOffset; + RtlCopyMemory(pBufTail, lpTargetFileName, cbPrintName); + + pReparseData->SymbolicLinkReparseBuffer.Flags = 0; + + if(bRelativePath) + pReparseData->SymbolicLinkReparseBuffer.Flags |= 1; // TODO! give this lone flag a name + + if(!RtlDosPathNameToNtPathName_U(lpSymlinkFileName, &SymlinkFileName, NULL, NULL)) + { + dwErr = ERROR_PATH_NOT_FOUND; + goto Cleanup; + } + + InitializeObjectAttributes(&ObjectAttributes, &SymlinkFileName, OBJ_CASE_INSENSITIVE, NULL, NULL); + + Status = NtCreateFile + ( + &hSymlink, + FILE_WRITE_ATTRIBUTES | DELETE | SYNCHRONIZE, + &ObjectAttributes, + &IoStatusBlock, + NULL, + FILE_ATTRIBUTE_NORMAL, + 0, + FILE_CREATE, + FILE_SYNCHRONOUS_IO_NONALERT | FILE_OPEN_REPARSE_POINT | dwCreateOptions, + NULL, + 0 + ); + + if(!NT_SUCCESS(Status)) + { + dwErr = RtlNtStatusToDosError(Status); + goto Cleanup; + } + + Status = NtFsControlFile + ( + hSymlink, + NULL, + NULL, + NULL, + &IoStatusBlock, + FSCTL_SET_REPARSE_POINT, + pReparseData, + cbReparseData, + NULL, + 0 + ); + + if(!NT_SUCCESS(Status)) + { + FILE_DISPOSITION_INFORMATION DispInfo; + DispInfo.DeleteFile = TRUE; + NtSetInformationFile(hSymlink, &IoStatusBlock, &DispInfo, sizeof(DispInfo), FileDispositionInformation); + + dwErr = RtlNtStatusToDosError(Status); + goto Cleanup; + } + + dwErr = NO_ERROR; + +Cleanup: + if(hSymlink) + NtClose(hSymlink); + + RtlFreeUnicodeString(&SymlinkFileName); + if (bAllocatedTarget) + { + RtlFreeHeap(RtlGetProcessHeap(), + 0, + TargetFileName.Buffer); + } + + if(lpTargetFullFileName) + RtlFreeHeap(RtlGetProcessHeap(), 0, lpTargetFullFileName); + + if(pReparseData) + RtlFreeHeap(RtlGetProcessHeap(), 0, pReparseData); + + if(dwErr) + { + SetLastError(dwErr); + return FALSE; + } + + return TRUE; +} + + +/* + * @implemented + */ +BOOLEAN +NTAPI +CreateSymbolicLinkA(IN LPCSTR lpSymlinkFileName, + IN LPCSTR lpTargetFileName, + IN DWORD dwFlags) +{ + PWCHAR SymlinkW, TargetW; + BOOLEAN Ret; + + if(!lpSymlinkFileName || !lpTargetFileName) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + if (!(SymlinkW = FilenameA2W(lpSymlinkFileName, FALSE))) + return FALSE; + + if (!(TargetW = FilenameA2W(lpTargetFileName, TRUE))) + return FALSE; + + Ret = CreateSymbolicLinkW(SymlinkW, + TargetW, + dwFlags); + + RtlFreeHeap(RtlGetProcessHeap(), 0, SymlinkW); + RtlFreeHeap(RtlGetProcessHeap(), 0, TargetW); + + return Ret; +} + +/* + * @unimplemented + */ +DWORD +WINAPI +GetFinalPathNameByHandleW(IN HANDLE hFile, + OUT LPWSTR lpszFilePath, + IN DWORD cchFilePath, + IN DWORD dwFlags) +{ + if (dwFlags & ~(VOLUME_NAME_DOS | VOLUME_NAME_GUID | VOLUME_NAME_NT | + VOLUME_NAME_NONE | FILE_NAME_NORMALIZED | FILE_NAME_OPENED)) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + + UNIMPLEMENTED; + return 0; +} + +/* + * @implemented + */ +DWORD +WINAPI +GetFinalPathNameByHandleA(IN HANDLE hFile, + OUT LPSTR lpszFilePath, + IN DWORD cchFilePath, + IN DWORD dwFlags) +{ + WCHAR FilePathW[MAX_PATH]; + UNICODE_STRING FilePathU; + DWORD PrevLastError; + DWORD Ret = 0; + + if (cchFilePath != 0 && + cchFilePath > sizeof(FilePathW) / sizeof(FilePathW[0])) + { + FilePathU.Length = 0; + FilePathU.MaximumLength = (USHORT)cchFilePath * sizeof(WCHAR); + FilePathU.Buffer = RtlAllocateHeap(RtlGetProcessHeap(), + 0, + FilePathU.MaximumLength); + if (FilePathU.Buffer == NULL) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return 0; + } + } + else + { + FilePathU.Length = 0; + FilePathU.MaximumLength = sizeof(FilePathW); + FilePathU.Buffer = FilePathW; + } + + /* save the last error code */ + PrevLastError = GetLastError(); + SetLastError(ERROR_SUCCESS); + + /* call the unicode version that does all the work */ + Ret = GetFinalPathNameByHandleW(hFile, + FilePathU.Buffer, + cchFilePath, + dwFlags); + + if (GetLastError() == ERROR_SUCCESS) + { + /* no error, restore the last error code and convert the string */ + SetLastError(PrevLastError); + + Ret = FilenameU2A_FitOrFail(lpszFilePath, + cchFilePath, + &FilePathU); + } + + /* free allocated memory if necessary */ + if (FilePathU.Buffer != FilePathW) + { + RtlFreeHeap(RtlGetProcessHeap(), + 0, + FilePathU.Buffer); + } + + return Ret; +} + +/* + * @unimplemented + */ +BOOL +WINAPI +SetFileBandwidthReservation(IN HANDLE hFile, + IN DWORD nPeriodMilliseconds, + IN DWORD nBytesPerPeriod, + IN BOOL bDiscardable, + OUT LPDWORD lpTransferSize, + OUT LPDWORD lpNumOutstandingRequests) +{ + UNIMPLEMENTED; + return FALSE; +} + + +/* + * @unimplemented + */ +BOOL +WINAPI +GetFileBandwidthReservation(IN HANDLE hFile, + OUT LPDWORD lpPeriodMilliseconds, + OUT LPDWORD lpBytesPerPeriod, + OUT LPBOOL pDiscardable, + OUT LPDWORD lpTransferSize, + OUT LPDWORD lpNumOutstandingRequests) +{ + UNIMPLEMENTED; + return FALSE; +} + + +/* + * @unimplemented + */ +BOOL +WINAPI +SetFileCompletionNotificationModes(IN HANDLE FileHandle, + IN UCHAR Flags) +{ + if (Flags & ~(FILE_SKIP_COMPLETION_PORT_ON_SUCCESS | FILE_SKIP_SET_EVENT_ON_HANDLE)) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + UNIMPLEMENTED; + return FALSE; +} + + +/* + * @unimplemented + */ +HANDLE +WINAPI +OpenFileById(IN HANDLE hFile, + IN LPFILE_ID_DESCRIPTOR lpFileID, + IN DWORD dwDesiredAccess, + IN DWORD dwShareMode, + IN LPSECURITY_ATTRIBUTES lpSecurityAttributes OPTIONAL, + IN DWORD dwFlags) +{ + UNIMPLEMENTED; + return INVALID_HANDLE_VALUE; +} + +#endif + +/* + * @implemented + */ +ULONGLONG +WINAPI +GetTickCount64(VOID) +{ + ULARGE_INTEGER TickCount; + + while (TRUE) + { + TickCount.HighPart = (ULONG)SharedUserData->TickCount.High1Time; + TickCount.LowPart = SharedUserData->TickCount.LowPart; + + if (TickCount.HighPart == (ULONG)SharedUserData->TickCount.High2Time) break; + + YieldProcessor(); + } + + return (UInt32x32To64(TickCount.LowPart, SharedUserData->TickCountMultiplier) >> 24) + + (UInt32x32To64(TickCount.HighPart, SharedUserData->TickCountMultiplier) << 8); +} diff --git a/dll/win32/kernel32/debug/debugger.c b/dll/win32/kernel32/debug/debugger.c deleted file mode 100644 index 2604a4c92a2..00000000000 --- a/dll/win32/kernel32/debug/debugger.c +++ /dev/null @@ -1,574 +0,0 @@ -/* - * PROJECT: ReactOS Win32 Base API - * LICENSE: GPL - See COPYING in the top level directory - * FILE: dll/win32/kernel32/debug/debugger.c - * PURPOSE: Wrappers for the NT Debug Implementation - * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org) - */ - -/* INCLUDES *****************************************************************/ - -#include -#define NDEBUG -#include - -typedef struct _DBGSS_THREAD_DATA -{ - struct _DBGSS_THREAD_DATA *Next; - HANDLE ThreadHandle; - HANDLE ProcessHandle; - DWORD ProcessId; - DWORD ThreadId; - BOOLEAN HandleMarked; -} DBGSS_THREAD_DATA, *PDBGSS_THREAD_DATA; - -#define DbgSsSetThreadData(d) \ - NtCurrentTeb()->DbgSsReserved[0] = d - -#define DbgSsGetThreadData() \ - ((PDBGSS_THREAD_DATA)NtCurrentTeb()->DbgSsReserved[0]) - -/* PRIVATE FUNCTIONS *********************************************************/ - -VOID -WINAPI -SaveThreadHandle(IN DWORD dwProcessId, - IN DWORD dwThreadId, - IN HANDLE hThread) -{ - PDBGSS_THREAD_DATA ThreadData; - - /* Allocate a thread structure */ - ThreadData = RtlAllocateHeap(RtlGetProcessHeap(), - 0, - sizeof(DBGSS_THREAD_DATA)); - if (!ThreadData) return; - - /* Fill it out */ - ThreadData->ThreadHandle = hThread; - ThreadData->ProcessId = dwProcessId; - ThreadData->ThreadId = dwThreadId; - ThreadData->ProcessHandle = NULL; - ThreadData->HandleMarked = FALSE; - - /* Link it */ - ThreadData->Next = DbgSsGetThreadData(); - DbgSsSetThreadData(ThreadData); -} - -VOID -WINAPI -SaveProcessHandle(IN DWORD dwProcessId, - IN HANDLE hProcess) -{ - PDBGSS_THREAD_DATA ThreadData; - - /* Allocate a thread structure */ - ThreadData = RtlAllocateHeap(RtlGetProcessHeap(), - 0, - sizeof(DBGSS_THREAD_DATA)); - if (!ThreadData) return; - - /* Fill it out */ - ThreadData->ProcessHandle = hProcess; - ThreadData->ProcessId = dwProcessId; - ThreadData->ThreadId = 0; - ThreadData->ThreadHandle = NULL; - ThreadData->HandleMarked = FALSE; - - /* Link it */ - ThreadData->Next = DbgSsGetThreadData(); - DbgSsSetThreadData(ThreadData); -} - -VOID -WINAPI -MarkThreadHandle(IN DWORD dwThreadId) -{ - PDBGSS_THREAD_DATA ThreadData; - - /* Loop all thread data events */ - ThreadData = DbgSsGetThreadData(); - while (ThreadData) - { - /* Check if this one matches */ - if (ThreadData->ThreadId == dwThreadId) - { - /* Mark the structure and break out */ - ThreadData->HandleMarked = TRUE; - break; - } - - /* Move to the next one */ - ThreadData = ThreadData->Next; - } -} - -VOID -WINAPI -MarkProcessHandle(IN DWORD dwProcessId) -{ - PDBGSS_THREAD_DATA ThreadData; - - /* Loop all thread data events */ - ThreadData = DbgSsGetThreadData(); - while (ThreadData) - { - /* Check if this one matches */ - if (ThreadData->ProcessId == dwProcessId) - { - /* Make sure the thread ID is empty */ - if (!ThreadData->ThreadId) - { - /* Mark the structure and break out */ - ThreadData->HandleMarked = TRUE; - break; - } - } - - /* Move to the next one */ - ThreadData = ThreadData->Next; - } -} - -VOID -WINAPI -RemoveHandles(IN DWORD dwProcessId, - IN DWORD dwThreadId) -{ - PDBGSS_THREAD_DATA ThreadData; - - /* Loop all thread data events */ - ThreadData = DbgSsGetThreadData(); - while (ThreadData) - { - /* Check if this one matches */ - if (ThreadData->ProcessId == dwProcessId) - { - /* Make sure the thread ID matches too */ - if (ThreadData->ThreadId == dwThreadId) - { - /* Check if we have a thread handle */ - if (ThreadData->ThreadHandle) - { - /* Close it */ - CloseHandle(ThreadData->ThreadHandle); - } - - /* Check if we have a process handle */ - if (ThreadData->ProcessHandle) - { - /* Close it */ - CloseHandle(ThreadData->ProcessHandle); - } - - /* Unlink the thread data */ - DbgSsSetThreadData(ThreadData->Next); - - /* Free it*/ - RtlFreeHeap(RtlGetProcessHeap(), 0, ThreadData); - - /* Move to the next structure */ - ThreadData = DbgSsGetThreadData(); - continue; - } - } - - /* Move to the next one */ - ThreadData = ThreadData->Next; - } -} - -VOID -WINAPI -CloseAllProcessHandles(IN DWORD dwProcessId) -{ - PDBGSS_THREAD_DATA ThreadData; - - /* Loop all thread data events */ - ThreadData = DbgSsGetThreadData(); - while (ThreadData) - { - /* Check if this one matches */ - if (ThreadData->ProcessId == dwProcessId) - { - /* Check if we have a thread handle */ - if (ThreadData->ThreadHandle) - { - /* Close it */ - CloseHandle(ThreadData->ThreadHandle); - } - - /* Check if we have a process handle */ - if (ThreadData->ProcessHandle) - { - /* Close it */ - CloseHandle(ThreadData->ProcessHandle); - } - - /* Unlink the thread data */ - DbgSsSetThreadData(ThreadData->Next); - - /* Free it*/ - RtlFreeHeap(RtlGetProcessHeap(), 0, ThreadData); - - /* Move to the next structure */ - ThreadData = DbgSsGetThreadData(); - continue; - } - - /* Move to the next one */ - ThreadData = ThreadData->Next; - } -} - -HANDLE -WINAPI -ProcessIdToHandle(IN DWORD dwProcessId) -{ - NTSTATUS Status; - OBJECT_ATTRIBUTES ObjectAttributes; - HANDLE Handle; - CLIENT_ID ClientId; - - /* If we don't have a PID, look it up */ - if (dwProcessId == MAXDWORD) dwProcessId = (DWORD_PTR)CsrGetProcessId(); - - /* Open a handle to the process */ - ClientId.UniqueThread = NULL; - ClientId.UniqueProcess = UlongToHandle(dwProcessId); - InitializeObjectAttributes(&ObjectAttributes, NULL, 0, NULL, NULL); - Status = NtOpenProcess(&Handle, - PROCESS_ALL_ACCESS, - &ObjectAttributes, - &ClientId); - if (!NT_SUCCESS(Status)) - { - /* Fail */ - SetLastErrorByStatus(Status); - return 0; - } - - /* Return the handle */ - return Handle; -} - -/* PUBLIC FUNCTIONS **********************************************************/ - -/* - * @implemented - */ -BOOL -WINAPI -CheckRemoteDebuggerPresent(IN HANDLE hProcess, - OUT PBOOL pbDebuggerPresent) -{ - HANDLE DebugPort; - NTSTATUS Status; - - /* Make sure we have an output and process*/ - if (!(pbDebuggerPresent) || !(hProcess)) - { - /* Fail */ - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } - - /* Check if the process has a debug object/port */ - Status = NtQueryInformationProcess(hProcess, - ProcessDebugPort, - (PVOID)&DebugPort, - sizeof(HANDLE), - NULL); - if (NT_SUCCESS(Status)) - { - /* Return the current state */ - *pbDebuggerPresent = (DebugPort) ? TRUE : FALSE; - return TRUE; - } - - /* Otherwise, fail */ - SetLastErrorByStatus(Status); - return FALSE; -} - -/* - * @implemented - */ -BOOL -WINAPI -ContinueDebugEvent(IN DWORD dwProcessId, - IN DWORD dwThreadId, - IN DWORD dwContinueStatus) -{ - CLIENT_ID ClientId; - NTSTATUS Status; - - /* Set the Client ID */ - ClientId.UniqueProcess = (HANDLE)dwProcessId; - ClientId.UniqueThread = (HANDLE)dwThreadId; - - /* Continue debugging */ - Status = DbgUiContinue(&ClientId, dwContinueStatus); - if (!NT_SUCCESS(Status)) - { - /* Fail */ - SetLastErrorByStatus(Status); - return FALSE; - } - - /* Remove the process/thread handles */ - RemoveHandles(dwProcessId, dwThreadId); - - /* Success */ - return TRUE; -} - -/* - * @implemented - */ -BOOL -WINAPI -DebugActiveProcess(IN DWORD dwProcessId) -{ - NTSTATUS Status; - HANDLE Handle; - - /* Connect to the debugger */ - Status = DbgUiConnectToDbg(); - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return FALSE; - } - - /* Get the process handle */ - Handle = ProcessIdToHandle(dwProcessId); - if (!Handle) return FALSE; - - /* Now debug the process */ - Status = DbgUiDebugActiveProcess(Handle); - NtClose(Handle); - - /* Check if debugging worked */ - if (!NT_SUCCESS(Status)) - { - /* Fail */ - SetLastErrorByStatus(Status); - return FALSE; - } - - /* Success */ - return TRUE; -} - -/* - * @implemented - */ -BOOL -WINAPI -DebugActiveProcessStop(IN DWORD dwProcessId) -{ - NTSTATUS Status; - HANDLE Handle; - - /* Get the process handle */ - Handle = ProcessIdToHandle(dwProcessId); - if (!Handle) return FALSE; - - /* Close all the process handles */ - CloseAllProcessHandles(dwProcessId); - - /* Now stop debgging the process */ - Status = DbgUiStopDebugging(Handle); - NtClose(Handle); - - /* Check for failure */ - if (!NT_SUCCESS(Status)) - { - /* Fail */ - SetLastError(ERROR_ACCESS_DENIED); - return FALSE; - } - - /* Success */ - return TRUE; -} - -/* - * @implemented - */ -BOOL -WINAPI -DebugBreakProcess(IN HANDLE Process) -{ - NTSTATUS Status; - - /* Send the breakin request */ - Status = DbgUiIssueRemoteBreakin(Process); - if(!NT_SUCCESS(Status)) - { - /* Failure */ - SetLastErrorByStatus(Status); - return FALSE; - } - - /* Success */ - return TRUE; -} - -/* - * @implemented - */ -BOOL -WINAPI -DebugSetProcessKillOnExit(IN BOOL KillOnExit) -{ - HANDLE Handle; - NTSTATUS Status; - ULONG State; - - /* Get the debug object */ - Handle = DbgUiGetThreadDebugObject(); - if (!Handle) - { - /* Fail */ - SetLastErrorByStatus(STATUS_INVALID_HANDLE); - return FALSE; - } - - /* Now set the kill-on-exit state */ - State = KillOnExit; - Status = NtSetInformationDebugObject(Handle, - DebugObjectKillProcessOnExitInformation, - &State, - sizeof(State), - NULL); - if (!NT_SUCCESS(Status)) - { - /* Fail */ - SetLastErrorByStatus(Status); - return FALSE; - } - - /* Success */ - return TRUE; -} - -/* - * @implemented - */ -BOOL -WINAPI -IsDebuggerPresent(VOID) -{ - return (BOOL)NtCurrentPeb()->BeingDebugged; -} - -/* - * @implemented - */ -BOOL -WINAPI -WaitForDebugEvent(IN LPDEBUG_EVENT lpDebugEvent, - IN DWORD dwMilliseconds) -{ - LARGE_INTEGER WaitTime; - PLARGE_INTEGER Timeout; - DBGUI_WAIT_STATE_CHANGE WaitStateChange; - NTSTATUS Status; - - /* Check if this is an infinite wait */ - if (dwMilliseconds == INFINITE) - { - /* Under NT, this means no timer argument */ - Timeout = NULL; - } - else - { - /* Otherwise, convert the time to NT Format */ - WaitTime.QuadPart = UInt32x32To64(-10000, dwMilliseconds); - Timeout = &WaitTime; - } - - /* Loop while we keep getting interrupted */ - do - { - /* Call the native API */ - Status = DbgUiWaitStateChange(&WaitStateChange, Timeout); - } while ((Status == STATUS_ALERTED) || (Status == STATUS_USER_APC)); - - /* Check if the wait failed */ - if (!(NT_SUCCESS(Status)) || (Status == DBG_UNABLE_TO_PROVIDE_HANDLE)) - { - /* Set the error code and quit */ - SetLastErrorByStatus(Status); - return FALSE; - } - - /* Check if we timed out */ - if (Status == STATUS_TIMEOUT) - { - /* Fail with a timeout error */ - SetLastError(ERROR_SEM_TIMEOUT); - return FALSE; - } - - /* Convert the structure */ - Status = DbgUiConvertStateChangeStructure(&WaitStateChange, lpDebugEvent); - if (!NT_SUCCESS(Status)) - { - /* Set the error code and quit */ - SetLastErrorByStatus(Status); - return FALSE; - } - - /* Check what kind of event this was */ - switch (lpDebugEvent->dwDebugEventCode) - { - /* New thread was created */ - case CREATE_THREAD_DEBUG_EVENT: - - /* Setup the thread data */ - SaveThreadHandle(lpDebugEvent->dwProcessId, - lpDebugEvent->dwThreadId, - lpDebugEvent->u.CreateThread.hThread); - break; - - /* New process was created */ - case CREATE_PROCESS_DEBUG_EVENT: - - /* Setup the process data */ - SaveProcessHandle(lpDebugEvent->dwProcessId, - lpDebugEvent->u.CreateProcessInfo.hProcess); - - /* Setup the thread data */ - SaveThreadHandle(lpDebugEvent->dwProcessId, - lpDebugEvent->dwThreadId, - lpDebugEvent->u.CreateThread.hThread); - break; - - /* Process was exited */ - case EXIT_PROCESS_DEBUG_EVENT: - - /* Mark the thread data as such */ - MarkProcessHandle(lpDebugEvent->dwProcessId); - break; - - /* Thread was exited */ - case EXIT_THREAD_DEBUG_EVENT: - - /* Mark the thread data */ - MarkThreadHandle(lpDebugEvent->dwThreadId); - break; - - /* Nothing to do for anything else */ - default: - break; - } - - /* Return success */ - return TRUE; -} - -/* EOF */ diff --git a/dll/win32/kernel32/debug/output.c b/dll/win32/kernel32/debug/output.c deleted file mode 100644 index 30abec99a5d..00000000000 --- a/dll/win32/kernel32/debug/output.c +++ /dev/null @@ -1,438 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * FILE: lib/kernel32/debug/debugger.c - * PURPOSE: OutputDebugString() - * PROGRAMMER: KJK::Hyperion - */ - -/* INCLUDES ******************************************************************/ - -#include - -/* FUNCTIONS *****************************************************************/ - -/* Open or create the mutex used to communicate with the debug monitor */ -static -HANDLE -K32CreateDBMonMutex(void) -{ - static SID_IDENTIFIER_AUTHORITY siaNTAuth = {SECURITY_NT_AUTHORITY}; - static SID_IDENTIFIER_AUTHORITY siaWorldAuth = {SECURITY_WORLD_SID_AUTHORITY}; - HANDLE hMutex; - - /* SIDs to be used in the DACL */ - PSID psidSystem = NULL; - PSID psidAdministrators = NULL; - PSID psidEveryone = NULL; - - /* buffer for the DACL */ - PVOID pDaclBuf = NULL; - - /* minimum size of the DACL: an ACL descriptor and three ACCESS_ALLOWED_ACE - headers. We'll add the size of SIDs when we'll know it - */ - SIZE_T nDaclBufSize = - sizeof(ACL) + (sizeof(ACCESS_ALLOWED_ACE) - - sizeof(((ACCESS_ALLOWED_ACE*)0)->SidStart)) * 3; - - /* security descriptor of the mutex */ - SECURITY_DESCRIPTOR sdMutexSecurity; - - /* attributes of the mutex object we'll create */ - SECURITY_ATTRIBUTES saMutexAttribs = {sizeof(saMutexAttribs), - &sdMutexSecurity, - TRUE}; - - NTSTATUS nErrCode; - - /* first, try to open the mutex */ - hMutex = OpenMutexW (SYNCHRONIZE | READ_CONTROL | MUTANT_QUERY_STATE, - TRUE, - L"DBWinMutex"); - - if(hMutex != NULL) - { - /* success */ - return hMutex; - } - /* error other than the mutex not being found */ - else if(GetLastError() != ERROR_FILE_NOT_FOUND) - { - /* failure */ - return NULL; - } - - /* if the mutex doesn't exist, create it */ - - /* first, set up the mutex security */ - /* allocate the NT AUTHORITY\SYSTEM SID */ - nErrCode = RtlAllocateAndInitializeSid(&siaNTAuth, - 1, - SECURITY_LOCAL_SYSTEM_RID, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - &psidSystem); - - /* failure */ - if(!NT_SUCCESS(nErrCode)) goto l_Cleanup; - - /* allocate the BUILTIN\Administrators SID */ - nErrCode = RtlAllocateAndInitializeSid(&siaNTAuth, - 2, - SECURITY_BUILTIN_DOMAIN_RID, - DOMAIN_ALIAS_RID_ADMINS, - 0, - 0, - 0, - 0, - 0, - 0, - &psidAdministrators); - - /* failure */ - if(!NT_SUCCESS(nErrCode)) goto l_Cleanup; - - /* allocate the Everyone SID */ - nErrCode = RtlAllocateAndInitializeSid(&siaWorldAuth, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - &psidEveryone); - - /* failure */ - if(!NT_SUCCESS(nErrCode)) goto l_Cleanup; - - /* allocate space for the SIDs too */ - nDaclBufSize += RtlLengthSid(psidSystem); - nDaclBufSize += RtlLengthSid(psidAdministrators); - nDaclBufSize += RtlLengthSid(psidEveryone); - - /* allocate the buffer for the DACL */ - pDaclBuf = GlobalAlloc(GMEM_FIXED, nDaclBufSize); - - /* failure */ - if(pDaclBuf == NULL) goto l_Cleanup; - - /* create the DACL */ - nErrCode = RtlCreateAcl(pDaclBuf, nDaclBufSize, ACL_REVISION); - - /* failure */ - if(!NT_SUCCESS(nErrCode)) goto l_Cleanup; - - /* grant the minimum required access to Everyone */ - nErrCode = RtlAddAccessAllowedAce(pDaclBuf, - ACL_REVISION, - SYNCHRONIZE | - READ_CONTROL | - MUTANT_QUERY_STATE, - psidEveryone); - - /* failure */ - if(!NT_SUCCESS(nErrCode)) goto l_Cleanup; - - /* grant full access to BUILTIN\Administrators */ - nErrCode = RtlAddAccessAllowedAce(pDaclBuf, - ACL_REVISION, - MUTANT_ALL_ACCESS, - psidAdministrators); - - /* failure */ - if(!NT_SUCCESS(nErrCode)) goto l_Cleanup; - - /* grant full access to NT AUTHORITY\SYSTEM */ - nErrCode = RtlAddAccessAllowedAce(pDaclBuf, - ACL_REVISION, - MUTANT_ALL_ACCESS, - psidSystem); - - /* failure */ - if(!NT_SUCCESS(nErrCode)) goto l_Cleanup; - - /* create the security descriptor */ - nErrCode = RtlCreateSecurityDescriptor(&sdMutexSecurity, - SECURITY_DESCRIPTOR_REVISION); - - /* failure */ - if(!NT_SUCCESS(nErrCode)) goto l_Cleanup; - - /* set the descriptor's DACL to the ACL we created */ - nErrCode = RtlSetDaclSecurityDescriptor(&sdMutexSecurity, - TRUE, - pDaclBuf, - FALSE); - - /* failure */ - if(!NT_SUCCESS(nErrCode)) goto l_Cleanup; - - /* create the mutex */ - hMutex = CreateMutexW(&saMutexAttribs, FALSE, L"DBWinMutex"); - -l_Cleanup: - /* free the buffers */ - if(pDaclBuf) GlobalFree(pDaclBuf); - if(psidEveryone) RtlFreeSid(psidEveryone); - if(psidAdministrators) RtlFreeSid(psidAdministrators); - if(psidSystem) RtlFreeSid(psidSystem); - - return hMutex; -} - - -/* - * @implemented - */ -VOID -WINAPI -OutputDebugStringA(LPCSTR _OutputString) -{ - _SEH2_TRY - { - ULONG_PTR a_nArgs[2]; - - a_nArgs[0] = (ULONG_PTR)(strlen(_OutputString) + 1); - a_nArgs[1] = (ULONG_PTR)_OutputString; - - /* send the string to the user-mode debugger */ - RaiseException(DBG_PRINTEXCEPTION_C, 0, 2, a_nArgs); - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - /* no user-mode debugger: try the systemwide debug message monitor, or the - kernel debugger as a last resort */ - - /* mutex used to synchronize invocations of OutputDebugString */ - static HANDLE s_hDBMonMutex = NULL; - /* true if we already attempted to open/create the mutex */ - static BOOL s_bDBMonMutexTriedOpen = FALSE; - - /* local copy of the mutex handle */ - volatile HANDLE hDBMonMutex = s_hDBMonMutex; - /* handle to the Section of the shared buffer */ - volatile HANDLE hDBMonBuffer = NULL; - - /* pointer to the mapped view of the shared buffer. It consist of the current - process id followed by the message string */ - struct { DWORD ProcessId; CHAR Buffer[1]; } * pDBMonBuffer = NULL; - - /* event: signaled by the debug message monitor when OutputDebugString can write - to the shared buffer */ - volatile HANDLE hDBMonBufferReady = NULL; - - /* event: to be signaled by OutputDebugString when it's done writing to the - shared buffer */ - volatile HANDLE hDBMonDataReady = NULL; - - /* mutex not opened, and no previous attempts to open/create it */ - if(hDBMonMutex == NULL && !s_bDBMonMutexTriedOpen) - { - /* open/create the mutex */ - hDBMonMutex = K32CreateDBMonMutex(); - /* store the handle */ - s_hDBMonMutex = hDBMonMutex; - } - - _SEH2_TRY - { - volatile PCHAR a_cBuffer = NULL; - - /* opening the mutex failed */ - if(hDBMonMutex == NULL) - { - /* remember next time */ - s_bDBMonMutexTriedOpen = TRUE; - } - /* opening the mutex succeeded */ - else - { - do - { - /* synchronize with other invocations of OutputDebugString */ - WaitForSingleObject(hDBMonMutex, INFINITE); - - /* buffer of the system-wide debug message monitor */ - hDBMonBuffer = OpenFileMappingW(SECTION_MAP_WRITE, FALSE, L"DBWIN_BUFFER"); - - /* couldn't open the buffer: send the string to the kernel debugger */ - if(hDBMonBuffer == NULL) break; - - /* map the buffer */ - pDBMonBuffer = MapViewOfFile(hDBMonBuffer, - SECTION_MAP_READ | SECTION_MAP_WRITE, - 0, - 0, - 0); - - /* couldn't map the buffer: send the string to the kernel debugger */ - if(pDBMonBuffer == NULL) break; - - /* open the event signaling that the buffer can be accessed */ - hDBMonBufferReady = OpenEventW(SYNCHRONIZE, FALSE, L"DBWIN_BUFFER_READY"); - - /* couldn't open the event: send the string to the kernel debugger */ - if(hDBMonBufferReady == NULL) break; - - /* open the event to be signaled when the buffer has been filled */ - hDBMonDataReady = OpenEventW(EVENT_MODIFY_STATE, FALSE, L"DBWIN_DATA_READY"); - } - while(0); - - /* we couldn't connect to the system-wide debug message monitor: send the - string to the kernel debugger */ - if(hDBMonDataReady == NULL) ReleaseMutex(hDBMonMutex); - } - - _SEH2_TRY - { - /* size of the current output block */ - volatile SIZE_T nRoundLen; - - /* size of the remainder of the string */ - volatile SIZE_T nOutputStringLen; - - /* output the whole string */ - nOutputStringLen = strlen(_OutputString); - - do - { - /* we're connected to the debug monitor: - write the current block to the shared buffer */ - if(hDBMonDataReady) - { - /* wait a maximum of 10 seconds for the debug monitor - to finish processing the shared buffer */ - if(WaitForSingleObject(hDBMonBufferReady, 10000) != WAIT_OBJECT_0) - { - /* timeout or failure: give up */ - break; - } - - /* write the process id into the buffer */ - pDBMonBuffer->ProcessId = GetCurrentProcessId(); - - /* write only as many bytes as they fit in the buffer */ - if(nOutputStringLen > (PAGE_SIZE - sizeof(DWORD) - 1)) - nRoundLen = PAGE_SIZE - sizeof(DWORD) - 1; - else - nRoundLen = nOutputStringLen; - - /* copy the current block into the buffer */ - memcpy(pDBMonBuffer->Buffer, _OutputString, nRoundLen); - - /* null-terminate the current block */ - pDBMonBuffer->Buffer[nRoundLen] = 0; - - /* signal that the data contains meaningful data and can be read */ - SetEvent(hDBMonDataReady); - } - /* else, send the current block to the kernel debugger */ - else - { - /* output in blocks of 512 characters */ - a_cBuffer = (CHAR*)HeapAlloc(GetProcessHeap(), 0, 512); - - if (!a_cBuffer) - { - DbgPrint("OutputDebugStringA: Failed\n"); - break; - } - - /* write a maximum of 511 bytes */ - if(nOutputStringLen > 510) - nRoundLen = 510; - else - nRoundLen = nOutputStringLen; - - /* copy the current block */ - memcpy(a_cBuffer, _OutputString, nRoundLen); - - /* null-terminate the current block */ - a_cBuffer[nRoundLen] = 0; - - /* send the current block to the kernel debugger */ - DbgPrint("%s", a_cBuffer); - - if (a_cBuffer) - { - HeapFree(GetProcessHeap(), 0, a_cBuffer); - a_cBuffer = NULL; - } - } - - /* move to the next block */ - _OutputString += nRoundLen; - nOutputStringLen -= nRoundLen; - } - /* repeat until the string has been fully output */ - while (nOutputStringLen > 0); - } - /* ignore access violations and let other exceptions fall through */ - _SEH2_EXCEPT((_SEH2_GetExceptionCode() == STATUS_ACCESS_VIOLATION) ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) - { - if (a_cBuffer) - HeapFree(GetProcessHeap(), 0, a_cBuffer); - - /* string copied verbatim from Microsoft's kernel32.dll */ - DbgPrint("\nOutputDebugString faulted during output\n"); - } - _SEH2_END; - } - _SEH2_FINALLY - { - /* close all the still open resources */ - if(hDBMonBufferReady) CloseHandle(hDBMonBufferReady); - if(pDBMonBuffer) UnmapViewOfFile(pDBMonBuffer); - if(hDBMonBuffer) CloseHandle(hDBMonBuffer); - if(hDBMonDataReady) CloseHandle(hDBMonDataReady); - - /* leave the critical section */ - if(hDBMonDataReady != NULL) - ReleaseMutex(hDBMonMutex); - } - _SEH2_END; - } - _SEH2_END; -} - - -/* - * @implemented - */ -VOID -WINAPI -OutputDebugStringW(LPCWSTR _OutputString) -{ - UNICODE_STRING wstrOut; - ANSI_STRING strOut; - NTSTATUS nErrCode; - - /* convert the string in ANSI */ - RtlInitUnicodeString(&wstrOut, _OutputString); - nErrCode = RtlUnicodeStringToAnsiString(&strOut, &wstrOut, TRUE); - - if(!NT_SUCCESS(nErrCode)) - { - /* Microsoft's kernel32.dll always prints something, even in case the conversion fails */ - OutputDebugStringA(""); - } - else - { - /* output the converted string */ - OutputDebugStringA(strOut.Buffer); - - /* free the converted string */ - RtlFreeAnsiString(&strOut); - } -} diff --git a/dll/win32/kernel32/include/base_x.h b/dll/win32/kernel32/include/base_x.h new file mode 100644 index 00000000000..a7457190cfc --- /dev/null +++ b/dll/win32/kernel32/include/base_x.h @@ -0,0 +1,158 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS System Libraries + * FILE: dll/win32/kernel32/include/base_x.h + * PURPOSE: Base API Client Macros + * PROGRAMMER: Alex Ionescu (alex@relsoft.net) + */ + +#pragma once + +/* INCLUDES *******************************************************************/ + +// +// This macro (split it up in 3 pieces to allow for intermediary code in between) +// converts a NULL-terminated ASCII string, usually associated with an object +// name, into its NT-native UNICODE_STRING structure, by using the TEB's Static +// Unicode String. +// +// It should only be used when the name is supposed to be less than MAX_PATH +// (260 characters). +// +// It returns the correct ERROR_FILENAME_EXCED_RANGE Win32 error when the path +// is too long. +// +// Note that Basep8BitStringToStaticUnicodeString looks deceptively similar. +// However, that function was designed for File APIs, which can be switched into +// a special "OEM" mode, that uses different NLS files/encoding, and thus calls +// RtlOemStringToAnsiString (see SetFileApisToOEM). Thererefore, this macro and +// that function are not interchangeable. As a separate note, that function uses +// the *Ex version of the Rtl conversion APIs, which does stricter checking that +// is not done when this macro is used. +// +#define ConvertAnsiToUnicodePrologue \ +{ \ + NTSTATUS Status; \ + PUNICODE_STRING UnicodeCache; \ + ANSI_STRING AnsiName; +#define ConvertAnsiToUnicodeBody(name) \ + UnicodeCache = &NtCurrentTeb()->StaticUnicodeString; \ + RtlInitAnsiString(&AnsiName, name); \ + Status = RtlAnsiStringToUnicodeString(UnicodeCache, &AnsiName, FALSE); +#define ConvertAnsiToUnicodeEpilogue \ + if (Status == STATUS_BUFFER_OVERFLOW) \ + SetLastError(ERROR_FILENAME_EXCED_RANGE); \ + else \ + BaseSetLastNTError(Status); \ + return FALSE; \ +} + +// +// This macro uses the ConvertAnsiToUnicode macros above to convert a CreateXxxA +// Win32 API into its equivalent CreateXxxW API. +// +#define ConvertWin32AnsiObjectApiToUnicodeApi(obj, name, ...) \ + ConvertAnsiToUnicodePrologue \ + if (!name) return Create##obj##W(__VA_ARGS__, NULL); \ + ConvertAnsiToUnicodeBody(name) \ + if (NT_SUCCESS(Status)) return Create##obj##W(__VA_ARGS__, UnicodeCache->Buffer); \ + ConvertAnsiToUnicodeEpilogue + +// +// This macro uses the ConvertAnsiToUnicode macros above to convert a FindFirst*A +// Win32 API into its equivalent FindFirst*W API. +// +#define ConvertWin32AnsiChangeApiToUnicodeApi(obj, name, ...) \ + ConvertAnsiToUnicodePrologue \ + ConvertAnsiToUnicodeBody(name) \ + if (NT_SUCCESS(Status)) return obj##W(UnicodeCache->Buffer, ##__VA_ARGS__); \ + ConvertAnsiToUnicodeEpilogue + +// +// This macro uses the ConvertAnsiToUnicode macros above to convert a OpenXxxA +// Win32 API into its equivalent OpenXxxW API. +// +#define ConvertOpenWin32AnsiObjectApiToUnicodeApi(obj, acc, inh, name) \ + ConvertAnsiToUnicodePrologue \ + if (!name) \ + { \ + SetLastError(ERROR_INVALID_PARAMETER); \ + return NULL; \ + } \ + ConvertAnsiToUnicodeBody(name) \ + if (NT_SUCCESS(Status)) return Open##obj##W(acc, inh, UnicodeCache->Buffer);\ + ConvertAnsiToUnicodeEpilogue + +// +// This macro (split it up in 3 pieces to allow for intermediary code in between) +// wraps the usual code path required to create an NT object based on a Unicode +// (Wide) Win32 object creation API. +// +// It makes use of BasepConvertObjectAttributes and allows for a custom access +// mode to be used, and also sets the correct error codes in case of a collision +// +#define CreateNtObjectFromWin32ApiPrologue \ +{ \ + NTSTATUS Status; \ + HANDLE Handle; \ + UNICODE_STRING ObjectName; \ + OBJECT_ATTRIBUTES LocalAttributes; \ + POBJECT_ATTRIBUTES ObjectAttributes = &LocalAttributes; +#define CreateNtObjectFromWin32ApiBody(ntobj, sec, name, access, ...) \ + if (name) RtlInitUnicodeString(&ObjectName, name); \ + ObjectAttributes = BasepConvertObjectAttributes(&LocalAttributes, \ + sec, \ + name ? &ObjectName : NULL); \ + Status = NtCreate##ntobj(&Handle, access, ObjectAttributes, ##__VA_ARGS__); +#define CreateNtObjectFromWin32ApiEpilogue \ + if (NT_SUCCESS(Status)) \ + { \ + if (Status == STATUS_OBJECT_NAME_EXISTS) \ + SetLastError(ERROR_ALREADY_EXISTS); \ + else \ + SetLastError(ERROR_SUCCESS); \ + return Handle; \ + } \ + BaseSetLastNTError(Status); \ + return NULL; \ +} + +// +// This macro uses the CreateNtObjectFromWin32Api macros from above to create an +// NT object based on the Win32 API settings. +// +// Note that it is hardcoded to always use XXX_ALL_ACCESS permissions, which is +// the behavior up until Vista. When/if the target moves to Vista, the macro can +// be improved to support caller-specified access masks, as the underlying macro +// above does support this. +// +#define CreateNtObjectFromWin32Api(obj, ntobj, capsobj, sec, name, ...) \ + CreateNtObjectFromWin32ApiPrologue \ + CreateNtObjectFromWin32ApiBody(ntobj, sec, name, capsobj##_ALL_ACCESS, ##__VA_ARGS__); \ + CreateNtObjectFromWin32ApiEpilogue + +// +// This macro opens an NT object based on the Win32 API settings. +// +#define OpenNtObjectFromWin32Api(ntobj, acc, inh, name) \ + CreateNtObjectFromWin32ApiPrologue \ + if (!name) \ + { \ + BaseSetLastNTError(STATUS_INVALID_PARAMETER); \ + return NULL; \ + } \ + RtlInitUnicodeString(&ObjectName, name); \ + InitializeObjectAttributes(ObjectAttributes, \ + &ObjectName, \ + inh ? OBJ_INHERIT : 0, \ + hBaseDir, \ + NULL); \ + Status = NtOpen##ntobj(&Handle, acc, ObjectAttributes); \ + if (!NT_SUCCESS(Status)) \ + { \ + BaseSetLastNTError(Status); \ + return NULL; \ + } \ + return Handle; \ +} + diff --git a/dll/win32/kernel32/include/baseheap.h b/dll/win32/kernel32/include/baseheap.h index c2a05e323bf..8cb2a7391e4 100644 --- a/dll/win32/kernel32/include/baseheap.h +++ b/dll/win32/kernel32/include/baseheap.h @@ -33,12 +33,6 @@ // API for it (such as GlobalLock). // -// -// The Handle Table -// -extern RTL_HANDLE_TABLE BaseHeapHandleTable; - -// // Tracing Support // Define _BASE_HANDLE_TRACE for Traces // diff --git a/dll/win32/kernel32/include/kernel32.h b/dll/win32/kernel32/include/kernel32.h index b315c2ed69f..008d77d40e0 100644 --- a/dll/win32/kernel32/include/kernel32.h +++ b/dll/win32/kernel32/include/kernel32.h @@ -21,6 +21,10 @@ #define FIXME(fmt, ...) WARN__(gDebugChannel, fmt,## __VA_ARGS__) #define ERR(fmt, ...) ERR__(gDebugChannel, fmt, ##__VA_ARGS__) +#define STUB \ + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); \ + DPRINT1("%s() is UNIMPLEMENTED!\n", __FUNCTION__) + #define debugstr_a #define debugstr_w #define wine_dbgstr_w @@ -67,8 +71,6 @@ /* Undocumented CreateProcess flag */ #define STARTF_SHELLPRIVATE 0x400 -#define SetLastErrorByStatus(x) RtlSetLastWin32ErrorAndNtStatusFromNtStatus((x)) - typedef struct _CODEPAGE_ENTRY { LIST_ENTRY Entry; @@ -78,6 +80,8 @@ typedef struct _CODEPAGE_ENTRY CPTABLEINFO CodePageTable; } CODEPAGE_ENTRY, *PCODEPAGE_ENTRY; +extern PBASE_STATIC_SERVER_DATA BaseStaticServerData; + typedef DWORD (*WaitForInputIdleType)( @@ -87,7 +91,6 @@ DWORD /* GLOBAL VARIABLES **********************************************************/ extern BOOL bIsFileApiAnsi; -extern HANDLE hProcessHeap; extern HANDLE hBaseDir; extern HMODULE hCurrentModule; @@ -100,8 +103,16 @@ extern PLDR_DATA_TABLE_ENTRY BasepExeLdrEntry; extern LPTOP_LEVEL_EXCEPTION_FILTER GlobalTopLevelExceptionFilter; +extern SYSTEM_BASIC_INFORMATION BaseCachedSysInfo; + +extern BOOLEAN BaseRunningInServerProcess; + /* FUNCTION PROTOTYPES *******************************************************/ +VOID +NTAPI +BaseDllInitializeMemoryManager(VOID); + BOOL WINAPI VerifyConsoleIoHandle(HANDLE Handle); BOOL WINAPI CloseConsoleHandle(HANDLE Handle); @@ -131,6 +142,11 @@ DWORD FilenameU2A_FitOrFail(LPSTR DestA, INT destLen, PUNICODE_STRING SourceU); #define HeapFree RtlFreeHeap #define _lread (_readfun)_hread +PLARGE_INTEGER +WINAPI +BaseFormatTimeOut(OUT PLARGE_INTEGER Timeout, + IN DWORD dwMilliseconds); + POBJECT_ATTRIBUTES WINAPI BasepConvertObjectAttributes(OUT POBJECT_ATTRIBUTES ObjectAttributes, @@ -236,3 +252,11 @@ BaseSetLastNTError(IN NTSTATUS Status); /* FIXME */ WCHAR WINAPI RtlAnsiCharToUnicodeChar(LPSTR *); + +HANDLE +WINAPI +DuplicateConsoleHandle(HANDLE hConsole, + DWORD dwDesiredAccess, + BOOL bInheritHandle, + DWORD dwOptions); + diff --git a/dll/win32/kernel32/k32.h b/dll/win32/kernel32/k32.h index f59172c8566..d791465e56f 100644 --- a/dll/win32/kernel32/k32.h +++ b/dll/win32/kernel32/k32.h @@ -20,7 +20,20 @@ #undef NTDDI_VERSION #define NTDDI_VERSION NTDDI_WS03SP1 -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include /* CSRSS Header */ #include @@ -42,4 +55,7 @@ /* PSEH for SEH Support */ #include +/* Base Macros */ +#include "include/base_x.h" + #endif diff --git a/dll/win32/kernel32/kernel32.pspec b/dll/win32/kernel32/kernel32.pspec index 48eb29a0763..f43460966e7 100644 --- a/dll/win32/kernel32/kernel32.pspec +++ b/dll/win32/kernel32/kernel32.pspec @@ -1,64 +1,35 @@ #undef i386 - -@ stdcall AcquireSRWLockExclusive(ptr) ntdll.RtlAcquireSRWLockExclusive -@ stdcall AcquireSRWLockShared(ptr) ntdll.RtlAcquireSRWLockShared @ stdcall ActivateActCtx(ptr ptr) @ stdcall AddAtomA(str) @ stdcall AddAtomW(wstr) @ stdcall AddConsoleAliasA(str str str) ;check @ stdcall AddConsoleAliasW(wstr wstr wstr) ;check -;@ stdcall -arch=x86_64 AddIntegrityLabelToBoundaryDescriptor ; Win 7 @ stdcall AddLocalAlternateComputerNameA(str ptr) @ stdcall AddLocalAlternateComputerNameW(wstr ptr) @ stdcall AddRefActCtx(ptr) -;@ stdcall AddSIDToBoundaryDescriptor ; Win 7 -;@ stdcall AddSecureMemoryCacheCallback ; Win 7 @ stdcall AddVectoredContinueHandler(long ptr) ntdll.RtlAddVectoredContinueHandler @ stdcall AddVectoredExceptionHandler(long ptr) ntdll.RtlAddVectoredExceptionHandler -;@ stdcall AdjustCalendarDate ; Win 7 @ stdcall AllocConsole() -@ stub AllocLSCallback ; missing in XP SP3 and 2003 R2 and Win 7 @ stdcall AllocateUserPhysicalPages(long ptr ptr) -;@ stdcall AllocateUserPhysicalPagesNuma ; Win 7 -;@ stdcall ApplicationRecoveryFinished ; Win 7 -;@ stdcall ApplicationRecoveryInProgress ; Win 7 @ stdcall AreFileApisANSI() @ stdcall AssignProcessToJobObject(ptr ptr) @ stdcall AttachConsole(long) @ stdcall BackupRead(ptr ptr long ptr long long ptr) @ stdcall BackupSeek(ptr long long ptr ptr ptr) @ stdcall BackupWrite(ptr ptr long ptr long long ptr) -@ stdcall BaseCheckAppcompatCache(long long long ptr) ;check -;@ stdcall BaseCheckAppcompatCacheEx ; Win7 -@ stub BaseCheckRunApp -@ stdcall BaseCleanupAppcompatCache() ; missing in Win 7 +@ stdcall BaseCheckAppcompatCache(long long long ptr) +@ stdcall BaseCheckRunApp(long ptr long long long long long long long long) @ stdcall BaseCleanupAppcompatCacheSupport(ptr) -;@ stdcall BaseDllReadWriteIniFile ; Win 7 @ stdcall BaseDumpAppcompatCache() @ stdcall BaseFlushAppcompatCache() -;@ stdcall BaseFormatObjectAttributes ; Win 7 -;@ stdcall BaseFormatTimeOut ; Win 7 -;@ stdcall BaseGenerateAppCompatData ; Win 7 -;@ stdcall BaseGetNamedObjectDirectory ; Win 7 -@ stdcall BaseInitAppcompatCache() ; missing in Win 7 @ stdcall BaseInitAppcompatCacheSupport() -;@ stdcall BaseIsAppcompatInfrastructureDisabled ; Win 7 +@ stdcall BaseIsAppcompatInfrastructureDisabled() @ stdcall BaseProcessInitPostImport() ; missing in Win 7 @ stdcall BaseQueryModuleData(str str ptr ptr ptr) ;check -;@ stdcall BaseThreadInitThunk ; Win 7 -;@ stdcall BaseSetLastNTError ; Win 7, not 64 bit (present on w2k3 but not exported) @ stdcall BaseUpdateAppcompatCache(long long long) -;@ stdcall BaseVerifyUnicodeString ; Win 7 -;@ stdcall Basep8BitStringToDynamicUnicodeString ; Win 7 -;@ stdcall BasepAllocateActivationContextActivationBlock ; Win 7 -;@ stdcall BasepAnsiStringToDynamicUnicodeString ; Win 7 -;@ stdcall BasepCheckAppCompat ; Win 7 -;@ stdcall BasepCheckBadapp ; Win 7 -@ stub BasepCheckWinSaferRestrictions -@ stub BasepDebugDump ; missing in XP SP3 and Win 7 -;@ stdcall BasepFreeActivationContextActivationBlock ; Win 7 -;@ stdcall BasepFreeAppCompatData ; Win 7 -;@ stdcall BasepMapModuleHandle ; Win 7 +@ stdcall BasepCheckBadapp(long ptr long long long long long long long) +@ stdcall BasepCheckWinSaferRestrictions(long long long long long long) +@ stdcall BasepFreeAppCompatData(ptr ptr) @ stdcall Beep(long long) @ stdcall BeginUpdateResourceA(str long) @ stdcall BeginUpdateResourceW(wstr long) @@ -69,18 +40,11 @@ @ stdcall BuildCommDCBW(wstr ptr) @ stdcall CallNamedPipeA(str ptr long ptr long ptr long) @ stdcall CallNamedPipeW(wstr ptr long ptr long ptr long) -;@ stdcall CallbackMayRunLong ; Win 7 @ stdcall CancelDeviceWakeupRequest(long) @ stdcall CancelIo(long) -@ stdcall CancelIoEx(long ptr) -@ stdcall CancelSynchronousIo(long) -;@ stdcall CancelThreadpoolIo(ptr) ntdll.TpCancelAsyncIoOperation; Win 7 @ stdcall CancelTimerQueueTimer(long long) @ stdcall CancelWaitableTimer(long) @ stdcall ChangeTimerQueueTimer(ptr ptr long long) -;@ stdcall CheckElevation ; Win 7 -;@ stdcall CheckElevationEnabled ; Win 7 -;@ stdcall CheckForReadOnlyResource ; Win 7 @ stdcall CheckNameLegalDOS8Dot3A(str str long long long) @ stdcall CheckNameLegalDOS8Dot3W(wstr str long long long) @ stdcall CheckRemoteDebuggerPresent(long ptr) @@ -88,125 +52,69 @@ @ stdcall ClearCommError(long ptr ptr) @ stdcall CloseConsoleHandle(long) @ stdcall CloseHandle(long) -;@ stdcall ClosePrivateNamespace ; Win 7 @ stdcall CloseProfileUserMapping() -@ stub CloseSystemHandle ; missing in XP SP3 and Win 7 -;@ stdcall CloseThreadpool(ptr) ntdll.TpReleasePool ; Win 7 -;@ stdcall CloseThreadpoolCleanupGroup(ptr) ntdll.TpReleaseCleanupGroup ; Win 7 -;@ stdcall CloseThreadpoolCleanupGroupMembers(ptr long ptr) ntdll.TpReleaseCleanupGroupMembers ; Win 7 -;@ stdcall CloseThreadpoolIo ntdll.TpReleaseIoCompletion ; Win 7 -;@ stdcall CloseThreadpoolTimer ntdll.TpReleaseTimer ; Win 7 -;@ stdcall CloseThreadpoolWait ntdll.TpReleaseWait ; Win 7 -;@ stdcall CloseThreadpoolWork ntdll.TpReleaseWork ; Win 7 @ stdcall CmdBatNotification(long) @ stdcall CommConfigDialogA(str long ptr) @ stdcall CommConfigDialogW(wstr long ptr) -;@ stdcall CompareCalendarDates ; Win 7 @ stdcall CompareFileTime(ptr ptr) @ stdcall CompareStringA(long long str long str long) -;@ stdcall CompareStringEx ; Win 7 -;@ stdcall CompareStringOrdinal ; Win 7 @ stdcall CompareStringW(long long wstr long wstr long) @ stdcall ConnectNamedPipe(long ptr) @ stdcall ConsoleMenuControl(long long long) -@ stub ConsoleSubst ; missing in XP SP3 and Win 7 @ stdcall ContinueDebugEvent(long long long) -;@ stdcall ConvertCalDateTimeToSystemTime ; Win 7 @ stdcall ConvertDefaultLocale (long) @ stdcall ConvertFiberToThread() -;@ stdcall ConvertNLSDayOfWeekToWin32DayOfWeek ; Win 7 -;@ stdcall ConvertSystemTimeToCalDateTime ; Win 7 @ stdcall ConvertThreadToFiber(ptr) @ stdcall ConvertThreadToFiberEx(ptr long) -;@ stdcall CopyExtendedContext ; Win 7 @ stdcall CopyFileA(str str long) @ stdcall CopyFileExA (str str ptr ptr ptr long) @ stdcall CopyFileExW (wstr wstr ptr ptr ptr long) -;@ stdcall CopyFileTransactedA ; Win 7 -;@ stdcall CopyFileTransactedW ; Win 7 @ stdcall CopyFileW(wstr wstr long) @ stdcall CopyLZFile(long long) LZCopy @ stdcall CreateActCtxA(ptr) @ stdcall CreateActCtxW(ptr) -;@ stdcall CreateBoundaryDescriptorA ; Win 7 -;@ stdcall CreateBoundaryDescriptorW ; Win 7 @ stdcall CreateConsoleScreenBuffer(long long ptr long ptr) @ stdcall CreateDirectoryA(str ptr) @ stdcall CreateDirectoryExA(str str ptr) @ stdcall CreateDirectoryExW(wstr wstr ptr) -;@ stdcall CreateDirectoryTransactedA ; Win 7 -;@ stdcall CreateDirectoryTransactedW ; Win 7 @ stdcall CreateDirectoryW(wstr ptr) @ stdcall CreateEventA(ptr long long str) -@ stdcall CreateEventExA(ptr str long long) -@ stdcall CreateEventExW(ptr wstr long long) @ stdcall CreateEventW(ptr long long wstr) @ stdcall CreateFiber(long ptr ptr) @ stdcall CreateFiberEx(long long long ptr ptr) @ stdcall CreateFileA(str long long ptr long long long) @ stdcall CreateFileMappingA(long ptr long long long str) -;@ stdcall CreateFileMappingNumaA ; Win 7 -;@ stdcall CreateFileMappingNumaW ; Win 7 @ stdcall CreateFileMappingW(long ptr long long long wstr) -;@ stdcall CreateFileTransactedA ; Win 7 -;@ stdcall CreateFileTransactedW ; Win 7 @ stdcall CreateFileW(wstr long long ptr long long long) @ stdcall CreateHardLinkA(str str ptr) -;@ stdcall CreateHardLinkTransactedA ; Win 7 -;@ stdcall CreateHardLinkTransactedW ; Win 7 @ stdcall CreateHardLinkW(wstr wstr ptr) @ stdcall CreateIoCompletionPort(long long long long) @ stdcall CreateJobObjectA(ptr str) @ stdcall CreateJobObjectW(ptr wstr) @ stdcall CreateJobSet(long ptr long) -@ stub CreateKernelThread ; missing in XP SP3 and Win 7 @ stdcall CreateMailslotA(ptr long long ptr) @ stdcall CreateMailslotW(ptr long long ptr) @ stdcall CreateMemoryResourceNotification(long) @ stdcall CreateMutexA(ptr long str) -@ stdcall CreateMutexExA(ptr str long long) -@ stdcall CreateMutexExW(ptr wstr long long) @ stdcall CreateMutexW(ptr long wstr) @ stdcall CreateNamedPipeA(str long long long long long long ptr) @ stdcall CreateNamedPipeW(wstr long long long long long long ptr) @ stdcall CreateNlsSecurityDescriptor(ptr long long) ; missing in Win 7 @ stdcall CreatePipe(ptr ptr ptr long) -;@ stdcall CreatePrivateNamespaceA ; Win 7 -;@ stdcall CreatePrivateNamespaceW ; Win 7 @ stdcall CreateProcessA(str str ptr ptr long long ptr str ptr ptr) -;@ stdcall CreateProcessAsUserW ; Win 7 @ stdcall CreateProcessInternalA(ptr str str ptr ptr long long ptr str ptr ptr long) @ stdcall CreateProcessInternalW(ptr wstr wstr ptr ptr long long ptr wstr ptr ptr long) -@ stdcall CreateProcessInternalWSecure() ; missing in Win 7 @ stdcall CreateProcessW(wstr wstr ptr ptr long long ptr wstr ptr ptr) @ stdcall CreateRemoteThread(long ptr long ptr long long ptr) -;@ stdcall CreateRemoteThreadEx api-ms-win-core-processthreads-l1-1-0.CreateRemoteThreadEx ; Win 7 @ stdcall CreateSemaphoreA(ptr long long str) -@ stdcall CreateSemaphoreExA(ptr long long str long long) -@ stdcall CreateSemaphoreExW(ptr long long wstr long long) @ stdcall CreateSemaphoreW(ptr long long wstr) @ stdcall CreateSocketHandle() -@ stdcall CreateSymbolicLinkA(str str long) -;@ stdcall CreateSymbolicLinkTransactedA ; Win 7 -;@ stdcall CreateSymbolicLinkTransactedW ; Win 7 -@ stdcall CreateSymbolicLinkW(wstr wstr long) @ stdcall CreateTapePartition(long long long long) @ stdcall CreateThread(ptr long ptr long long ptr) -;@ stdcall CreateThreadpool ; Win 7 -;@ stdcall CreateThreadpoolCleanupGroup ; Win 7 -;@ stdcall CreateThreadpoolIo ; Win 7 -;@ stdcall CreateThreadpoolTimer ; Win 7 -;@ stdcall CreateThreadpoolWait ; Win 7 -;@ stdcall CreateThreadpoolWork ; Win 7 @ stdcall CreateTimerQueue () @ stdcall CreateTimerQueueTimer(ptr long ptr ptr long long long) @ stdcall CreateToolhelp32Snapshot(long long) -;@ stdcall arch=x86_64 CreateUmsCompletionList -;@ stdcall arch=x86_64 CreateUmsThreadContext -@ stdcall CreateVirtualBuffer(long long long) ; missing in Win 7 @ stdcall CreateWaitableTimerA(ptr long str) -@ stdcall CreateWaitableTimerExA(ptr str long long) -@ stdcall CreateWaitableTimerExW(ptr wstr long long) @ stdcall CreateWaitableTimerW(ptr long wstr) @ stdcall DeactivateActCtx(long ptr) @ stdcall DebugActiveProcess(long) @@ -220,26 +128,17 @@ @ stdcall DefineDosDeviceW(long wstr wstr) @ stdcall DelayLoadFailureHook(str str) @ stdcall DeleteAtom(long) -;@ stdcall DeleteBoundaryDescriptor ntdll.RtlDeleteBoundaryDescriptor ; Win 7 @ stdcall DeleteCriticalSection(ptr) ntdll.RtlDeleteCriticalSection @ stdcall DeleteFiber(ptr) @ stdcall DeleteFileA(str) -;@ stdcall DeleteFileTransactedA ; Win 7 -;@ stdcall DeleteFileTransactedW ; Win 7 @ stdcall DeleteFileW(wstr) -;@ stdcall DeleteProcThreadAttributeList api-ms-win-core-processthreads-l1-1-0.DeleteProcThreadAttributeList ; Win 7 @ stdcall DeleteTimerQueue(long) @ stdcall DeleteTimerQueueEx (long long) @ stdcall DeleteTimerQueueTimer(long long long) -;@ stdcall -arch=x86_64 DeleteUmsCompletionList -;@ stdcall -arch=x86_64 DeleteUmsThreadContext @ stdcall DeleteVolumeMountPointA(str) ;check @ stdcall DeleteVolumeMountPointW(wstr) ;check -;@ stdcall -arch=x86_64 DequeueUmsCompletionListItems @ stdcall DeviceIoControl(long long ptr long ptr long ptr ptr) @ stdcall DisableThreadLibraryCalls(long) -;@ stdcall DisableThreadProfiling ; Win 7 -;@ stdcall DisassociateCurrentThreadFromCallback ntdll.TpDisassociateCallback ; Win 7 @ stdcall DisconnectNamedPipe(long) @ stdcall DnsHostnameToComputerNameA (str ptr ptr) @ stdcall DnsHostnameToComputerNameW (wstr ptr ptr) @@ -248,48 +147,36 @@ @ stdcall DosPathToSessionPathW(long wstr wstr) @ stdcall DuplicateConsoleHandle(long long long long) @ stdcall DuplicateHandle(long long long ptr long long long) -;@ stdcall EnableThreadProfiling ; Win 7 @ stdcall EncodePointer(ptr) ntdll.RtlEncodePointer @ stdcall EncodeSystemPointer(ptr) ntdll.RtlEncodeSystemPointer @ stdcall EndUpdateResourceA(long long) @ stdcall EndUpdateResourceW(long long) @ stdcall EnterCriticalSection(ptr) ntdll.RtlEnterCriticalSection -;@ stdcall -arch=x86_64 EnterUmsSchedulingMode @ stdcall EnumCalendarInfoA(ptr long long long) @ stdcall EnumCalendarInfoExA(ptr long long long) -;@ stdcall EnumCalendarInfoExEx ; Win 7 @ stdcall EnumCalendarInfoExW(ptr long long long) @ stdcall EnumCalendarInfoW(ptr long long long) @ stdcall EnumDateFormatsA(ptr long long) @ stdcall EnumDateFormatsExA(ptr long long) -;@ stdcall EnumDateFormatsExEx ; Win 7 @ stdcall EnumDateFormatsExW(ptr long long) @ stdcall EnumDateFormatsW(ptr long long) @ stdcall EnumLanguageGroupLocalesA(ptr long long ptr) @ stdcall EnumLanguageGroupLocalesW(ptr long long ptr) @ stdcall EnumResourceLanguagesA(long str str ptr long) -;@ stdcall EnumResourceLanguagesExA ; Win 7 -;@ stdcall EnumResourceLanguagesExW ; Win 7 @ stdcall EnumResourceLanguagesW(long wstr wstr ptr long) @ stdcall EnumResourceNamesA(long str ptr long) -;@ stdcall EnumResourceNamesExA ; Win 7 -;@ stdcall EnumResourceNamesExW ; Win 7 @ stdcall EnumResourceNamesW(long wstr ptr long) @ stdcall EnumResourceTypesA(long ptr long) -;@ stdcall EnumResourceTypesExA ; Win 7 -;@ stdcall EnumResourceTypesExW ; Win 7 @ stdcall EnumResourceTypesW(long ptr long) @ stdcall EnumSystemCodePagesA(ptr long) @ stdcall EnumSystemCodePagesW(ptr long) -;@ stdcall EnumSystemFirmwareTables ; Win 7 +@ stdcall EnumSystemFirmwareTables(long ptr long) @ stdcall EnumSystemGeoID(long long ptr) @ stdcall EnumSystemLanguageGroupsA(ptr long ptr) @ stdcall EnumSystemLanguageGroupsW(ptr long ptr) @ stdcall EnumSystemLocalesA(ptr long) -;@ stdcall EnumSystemLocalesEx ; Win 7 @ stdcall EnumSystemLocalesW(ptr long) @ stdcall EnumTimeFormatsA(ptr long long) -;@ stdcall EnumTimeFormatsEx ; Win 7 @ stdcall EnumTimeFormatsW(ptr long long) @ stdcall EnumUILanguagesA(ptr long long) @ stdcall EnumUILanguagesW(ptr long long) @@ -304,7 +191,6 @@ @ stdcall ExpandEnvironmentStringsW(wstr ptr long) @ stdcall ExpungeConsoleCommandHistoryA(long) @ stdcall ExpungeConsoleCommandHistoryW(long) -@ stdcall ExtendVirtualBuffer(long long) ; missing in Win 7 @ stdcall FatalAppExitA(long str) @ stdcall FatalAppExitW(long wstr) @ stdcall FatalExit(long) @@ -326,24 +212,16 @@ @ stdcall FindFirstFileA(str ptr) @ stdcall FindFirstFileExA(str long ptr long ptr long) @ stdcall FindFirstFileExW(wstr long ptr long ptr long) -;@ stdcall FindFirstFileNameTransactedW ; Win 7 -;@ stdcall FindFirstFileNameW ; Win 7 -;@ stdcall FindFirstFileTransactedA ; Win 7 -;@ stdcall FindFirstFileTransactedW ; Win 7 @ stdcall FindFirstFileW(wstr ptr) -;@ stdcall FindFirstStreamTransactedW ; Win 7 @ stdcall FindFirstStreamW(wstr ptr ptr long) @ stdcall FindFirstVolumeA(ptr long) @ stdcall FindFirstVolumeMountPointA(str ptr long) @ stdcall FindFirstVolumeMountPointW(wstr ptr long) @ stdcall FindFirstVolumeW(ptr long) -;@ stdcall FindNLSString ; Win 7 -;@ stdcall FindNLSStringEx ; Win 7 @ stdcall FindNextChangeNotification(long) @ stdcall FindNextFileA(long ptr) -;@ stdcall FindNextFileNameW ; Win 7 @ stdcall FindNextFileW(long ptr) -;@ stdcall FindNextStreamW ; Win 7 +@ stdcall FindNextStreamW(ptr ptr) @ stdcall FindNextVolumeA(long ptr long) @ stdcall FindNextVolumeMountPointA(long str long) @ stdcall FindNextVolumeMountPointW(long wstr long) @@ -352,17 +230,15 @@ @ stdcall FindResourceExA(long str str long) @ stdcall FindResourceExW(long wstr wstr long) @ stdcall FindResourceW(long wstr wstr) -;@ stdcall FindStringOrdinal ; Win 7 @ stdcall FindVolumeClose(ptr) @ stdcall FindVolumeMountPointClose(ptr) -;@ stdcall FlsAlloc(ptr) ; missing in XP SP3 -;@ stdcall FlsFree(long) ; missing in XP SP3 -;@ stdcall FlsGetValue(long) ; missing in XP SP3 -;@ stdcall FlsSetValue(long ptr) ; missing in XP SP3 +;@ stdcall FlsAlloc(ptr) +;@ stdcall FlsFree(long) +;@ stdcall FlsGetValue(long) +;@ stdcall FlsSetValue(long ptr) @ stdcall FlushConsoleInputBuffer(long) @ stdcall FlushFileBuffers(long) @ stdcall FlushInstructionCache(long long long) -;@ stdcall FlushProcessWriteBuffers ntdll.NtFlushProcessWriteBuffers ; Win 7 @ stdcall FlushViewOfFile(ptr long) @ stdcall FoldStringA(long str long ptr long) @ stdcall FoldStringW(long wstr long ptr long) @@ -373,16 +249,10 @@ @ stdcall FreeEnvironmentStringsW(ptr) @ stdcall FreeLibrary(long) @ stdcall FreeLibraryAndExitThread(long long) -;@ stdcall FreeLibraryWhenCallbackReturns ntdll.TpCallbackUnloadDllOnCompletion ; Win 7 @ stdcall FreeResource(long) @ stdcall FreeUserPhysicalPages(long long long) -@ stdcall FreeVirtualBuffer(ptr) ; missing in Win 7 @ stdcall GenerateConsoleCtrlEvent(long long) @ stdcall GetACP() -;@ stdcall GetActiveProcessorCount ; Win 7 -;@ stdcall GetActiveProcessorGroupCount ; Win 7 -;@ stdcall GetApplicationRecoveryCallback ; Win 7 -;@ stdcall GetApplicationRestartSettings ; Win 7 @ stdcall GetAtomNameA(long ptr long) @ stdcall GetAtomNameW(long ptr long) @ stdcall GetBinaryType(str ptr) GetBinaryTypeA @@ -392,16 +262,8 @@ @ stdcall GetCPInfo(long ptr) @ stdcall GetCPInfoExA(long long ptr) @ stdcall GetCPInfoExW(long long ptr) -;@ stdcall GetCalendarDateFormat ; Win 7 -;@ stdcall GetCalendarDateFormatEx ; Win 7 -;@ stdcall GetCalendarDaysInMonth ; Win 7 -;@ stdcall GetCalendarDifferenceInDays ; Win 7 @ stdcall GetCalendarInfoA(long long long ptr long ptr) -;@ stdcall GetCalendarInfoEx ; Win 7 @ stdcall GetCalendarInfoW(long long long ptr long ptr) -;@ stdcall GetCalendarMonthsInYear ; Win 7 -;@ stdcall GetCalendarSupportedDateRange ; Win 7 -;@ stdcall GetCalendarWeekNumber ; Win 7 @ stdcall GetComPlusPackageInstallStatus() @ stdcall GetCommConfig(long ptr long) @ stdcall GetCommMask(long ptr) @@ -412,8 +274,6 @@ @ stdcall GetCommandLineA() @ stdcall GetCommandLineW() @ stdcall GetCompressedFileSizeA(long ptr) -;@ stdcall GetCompressedFileSizeTransactedA ; Win 7 -;@ stdcall GetCompressedFileSizeTransactedW ; Win 7 @ stdcall GetCompressedFileSizeW(long ptr) @ stdcall GetComputerNameA(ptr ptr) @ stdcall GetComputerNameExA(long ptr ptr) @@ -441,7 +301,6 @@ @ stdcall GetConsoleFontInfo(long long long ptr) @ stdcall GetConsoleFontSize(long long) @ stdcall GetConsoleHardwareState(long long ptr) -@ stdcall GetConsoleHistoryInfo(ptr) @ stdcall GetConsoleInputExeNameA(long ptr) @ stdcall GetConsoleInputExeNameW(long ptr) @ stdcall GetConsoleInputWaitHandle() @@ -449,35 +308,26 @@ @ stdcall GetConsoleKeyboardLayoutNameW(ptr) @ stdcall GetConsoleMode(long ptr) @ stdcall GetConsoleNlsMode(long ptr) -;@ stdcall GetConsoleOriginalTitleA ; Win 7 -;@ stdcall GetConsoleOriginalTitleW ; Win 7 @ stdcall GetConsoleOutputCP() @ stdcall GetConsoleProcessList(ptr long) ; missing in XP SP3 @ stdcall GetConsoleScreenBufferInfo(long ptr) -;@ stdcall GetConsoleScreenBufferInfoEx ; Win 7 @ stdcall GetConsoleSelectionInfo(ptr) @ stdcall GetConsoleTitleA(ptr long) @ stdcall GetConsoleTitleW(ptr long) @ stdcall GetConsoleWindow() @ stdcall GetCurrencyFormatA(long long str ptr str long) -;@ stdcall GetCurrencyFormatEx ; Win 7 @ stdcall GetCurrencyFormatW(long long str ptr str long) @ stdcall GetCurrentActCtx(ptr) @ stdcall GetCurrentConsoleFont(long long ptr) -;@ stdcall GetCurrentConsoleFontEx ; Win 7 @ stdcall GetCurrentDirectoryA(long ptr) @ stdcall GetCurrentDirectoryW(long ptr) @ stdcall GetCurrentProcess() @ stdcall GetCurrentProcessId() @ stdcall GetCurrentProcessorNumber() ntdll.RtlGetCurrentProcessorNumber -;@ stdcall GetCurrentProcessorNumberEx ntdll.RtlGetCurrentProcessorNumberEx ; Win 7 @ stdcall GetCurrentThread() @ stdcall GetCurrentThreadId() -;@ stdcall GetCurrentUmsThread @ stdcall GetDateFormatA(long long ptr str ptr long) -;@ stdcall GetDateFormatEx ; Win 7 @ stdcall GetDateFormatW(long long ptr wstr ptr long) -@ stub GetDaylightFlag ; missing in XP SP3 and Win 7 @ stdcall GetDefaultCommConfigA(str ptr long) @ stdcall GetDefaultCommConfigW(wstr ptr long) @ stdcall GetDefaultSortkeySize(ptr) ; missing in Win 7 @@ -490,116 +340,70 @@ @ stdcall GetDllDirectoryW(long ptr) @ stdcall GetDriveTypeA(str) @ stdcall GetDriveTypeW(wstr) -;@ stdcall GetDurationFormat ; Win 7 -;@ stdcall GetDurationFormatEx ; Win 7 -;@ stdcall GetDynamicTimeZoneInformation ; Win 7 -;@ stdcall GetEnabledExtendedFeatures api-ms-win-core-xstate-l1-1-0.RtlGetEnabledExtendedFeatures ; Win 7 @ stdcall GetEnvironmentStrings() @ stdcall GetEnvironmentStringsA() GetEnvironmentStrings @ stdcall GetEnvironmentStringsW() @ stdcall GetEnvironmentVariableA(str ptr long) @ stdcall GetEnvironmentVariableW(wstr ptr long) -;@ stdcall GetEraNameCountedString ; Win 7 -@ stdcall GetErrorMode() @ stdcall GetExitCodeProcess(long ptr) @ stdcall GetExitCodeThread(long ptr) @ stdcall GetExpandedNameA(str ptr) @ stdcall GetExpandedNameW(wstr ptr) -;@ stdcall GetExtendedContextLength ; Win 7 -;@ stdcall GetExtendedFeaturesMask api-ms-win-core-xstate-l1-1-0.RtlGetExtendedFeaturesMask ; Win 7 @ stdcall GetFileAttributesA(str) -@ stdcall GetFileAttributesByHandle(long ptr long) ; missing in Win 7 @ stdcall GetFileAttributesExA(str long ptr) @ stdcall GetFileAttributesExW(wstr long ptr) -;@ stdcall GetFileAttributesTransactedA ; Win 7 -;@ stdcall GetFileAttributesTransactedW ; Win 7 @ stdcall GetFileAttributesW(wstr) -@ stdcall GetFileBandwidthReservation(long ptr ptr ptr ptr ptr) @ stdcall GetFileInformationByHandle(long ptr) -;@ stdcall GetFileInformationByHandleEx ; Win 7 -;@ stdcall GetFileMUIInfo ; Win 7 -;@ stdcall GetFileMUIPath ; Win 7 @ stdcall GetFileSize(long ptr) @ stdcall GetFileSizeEx(long ptr) @ stdcall GetFileTime(long ptr ptr ptr) @ stdcall GetFileType(long) -@ stdcall GetFinalPathNameByHandleA(long str long long) -@ stdcall GetFinalPathNameByHandleW(long wstr long long) @ stdcall GetFirmwareEnvironmentVariableA(str str ptr long) @ stdcall GetFirmwareEnvironmentVariableW(wstr wstr ptr long) @ stdcall GetFullPathNameA(str long ptr ptr) -;@ stdcall GetFullPathNameTransactedA ; Win 7 -;@ stdcall GetFullPathNameTransactedW ; Win 7 @ stdcall GetFullPathNameW(wstr long ptr ptr) @ stdcall GetGeoInfoA(long long ptr long long) @ stdcall GetGeoInfoW(long long ptr long long) @ stdcall GetHandleContext(long) ; missing on x64 @ stdcall GetHandleInformation(long ptr) -@ stub GetSCallbackTarget ; missing in XP SP3 and Win 7 -@ stub GetSCallbackTemplate ; missing in XP SP3 and Win 7 @ stdcall GetLargePageMinimum() @ stdcall GetLargestConsoleWindowSize(long) -@ stdcall GetLastError() +@ stdcall GetLastError() ntdll.RtlGetLastWin32Error @ stdcall GetLinguistLangSize(ptr) ; missing in Win 7 @ stdcall GetLocalTime(ptr) @ stdcall GetLocaleInfoA(long long ptr long) -@ stdcall GetLocaleInfoEx(wstr long wstr long) ; Vista+ @ stdcall GetLocaleInfoW(long long ptr long) @ stdcall GetLogicalDriveStringsA(long ptr) @ stdcall GetLogicalDriveStringsW(long ptr) @ stdcall GetLogicalDrives() @ stdcall GetLogicalProcessorInformation(ptr ptr) -;@ stdcall GetLogicalProcessorInformationEx api-ms-win-core-sysinfo-l1-1-0.GetLogicalProcessorInformationEx ; Win 7 @ stdcall GetLongPathNameA (str long long) -;@ stdcall GetLongPathNameTransactedA ; Win 7 -;@ stdcall GetLongPathNameTransactedW ; Win 7 @ stdcall GetLongPathNameW (wstr long long) @ stdcall GetMailslotInfo(long ptr ptr ptr ptr) -;@ stdcall GetMaximumProcessorCount ; Win 7 -;@ stdcall GetMaximumProcessorGroupCount ; Win 7 @ stdcall GetModuleFileNameA(long ptr long) @ stdcall GetModuleFileNameW(long ptr long) @ stdcall GetModuleHandleA(str) @ stdcall GetModuleHandleExA(long ptr ptr) @ stdcall GetModuleHandleExW(long ptr ptr) @ stdcall GetModuleHandleW(wstr) -;@ stdcall GetNLSVersion ; Win 7 -;@ stdcall GetNLSVersionEx ; Win 7 -;@ stdcall GetNamedPipeAttribute ; Win 7 -;@ stdcall GetNamedPipeClientComputerNameA ; Win 7 -;@ stdcall GetNamedPipeClientComputerNameW ; Win 7 -;@ stdcall GetNamedPipeClientProcessId ; Win 7 -;@ stdcall GetNamedPipeClientSessionId ; Win 7 +@ stdcall GetNLSVersion(long long ptr) @ stdcall GetNamedPipeHandleStateA(long ptr ptr ptr ptr str long) @ stdcall GetNamedPipeHandleStateW(long ptr ptr ptr ptr wstr long) @ stdcall GetNamedPipeInfo(long ptr ptr ptr ptr) -;@ stdcall GetNamedPipeServerProcessId ; Win 7 -;@ stdcall GetNamedPipeServerSessionId ; Win 7 @ stdcall GetNativeSystemInfo(ptr) -;@ stdcall -arch=x86_64 GetNextUmsListItem @ stdcall GetNextVDMCommand(long) @ stdcall GetNlsSectionName(long long long str str long) ; missing in Win 7 -@ stdcall GetNumaAvailableMemory(ptr long ptr) ; missing in Win 7 @ stdcall GetNumaAvailableMemoryNode(long ptr) -;@ stdcall GetNumaAvailableMemoryNodeEx ; Win 7 @ stdcall GetNumaHighestNodeNumber(ptr) -;@ stdcall GetNumaNodeNumberFromHandle ; Win 7 @ stdcall GetNumaNodeProcessorMask(long ptr) -;@ stdcall GetNumaNodeProcessorMaskEx ; Win 7 -@ stdcall GetNumaProcessorMap(ptr long ptr) ; missing in Win 7 @ stdcall GetNumaProcessorNode(long ptr) -;@ stdcall GetNumaProcessorNodeEx ; Win 7 -;@ stdcall GetNumaProximityNode ; Win 7 -;@ stdcall GetNumaProximityNodeEx ; Win 7 @ stdcall GetNumberFormatA(long long str ptr ptr long) -;@ stdcall GetNumberFormatEx ; Win 7 @ stdcall GetNumberFormatW(long long wstr ptr ptr long) @ stdcall GetNumberOfConsoleFonts() @ stdcall GetNumberOfConsoleInputEvents(long ptr) @ stdcall GetNumberOfConsoleMouseButtons(ptr) @ stdcall GetOEMCP() @ stdcall GetOverlappedResult(long ptr ptr long) -;@ stdcall GetPhysicallyInstalledSystemMemory ; Win 7 @ stdcall GetPriorityClass(long) @ stdcall GetPrivateProfileIntA(str str long str) @ stdcall GetPrivateProfileIntW(wstr wstr long wstr) @@ -613,25 +417,18 @@ @ stdcall GetPrivateProfileStructW(wstr wstr ptr long wstr) @ stdcall GetProcAddress(long str) @ stdcall GetProcessAffinityMask(long ptr ptr) -//@ stdcall GetProcessFlags(long) -;@ stdcall GetProcessDEPPolicy ; Win 7 -;@ stdcall GetProcessGroupAffinity ; Win 7 @ stdcall GetProcessHandleCount(long ptr) @ stdcall GetProcessHeap() @ stdcall GetProcessHeaps(long ptr) @ stdcall GetProcessId(long) -;@ stdcall GetProcessIdOfThread ; Win 7 +@ stdcall GetProcessIdOfThread(ptr) @ stdcall GetProcessIoCounters(long ptr) -;@ stdcall GetProcessPreferredUILanguages ; Win 7 @ stdcall GetProcessPriorityBoost(long ptr) @ stdcall GetProcessShutdownParameters(ptr ptr) @ stdcall GetProcessTimes(long ptr ptr ptr ptr) @ stdcall GetProcessVersion(long) @ stdcall GetProcessWorkingSetSize(long ptr ptr) -;@ stdcall GetProcessWorkingSetSizeEx ; Win 7 -;@ stdcall GetProcessorSystemCycleTime ; Win 7 -;@ stdcall GetProductInfo(long long long long ptr) ; Win 7 -@ stub GetProductName +@ stdcall GetProcessWorkingSetSizeEx(long ptr ptr long) @ stdcall GetProfileIntA(str str long) @ stdcall GetProfileIntW(wstr wstr long) @ stdcall GetProfileSectionA(str ptr long) @@ -639,31 +436,24 @@ @ stdcall GetProfileStringA(str str str ptr long) @ stdcall GetProfileStringW(wstr wstr wstr ptr long) @ stdcall GetQueuedCompletionStatus(long ptr ptr ptr long) -;@ stdcall GetQueuedCompletionStatusEx ; Win 7 -@ stub GetLSCallbackTarget ; missing in XP SP3 and Win 7 -@ stub GetLSCallbackTemplate ; missing in XP SP3 and Win 7 @ stdcall GetShortPathNameA(str ptr long) @ stdcall GetShortPathNameW(wstr ptr long) @ stdcall GetStartupInfoA(ptr) @ stdcall GetStartupInfoW(ptr) @ stdcall GetStdHandle(long) -;@ stdcall GetStringScripts ; Win 7 @ stdcall GetStringTypeA(long long str long ptr) @ stdcall GetStringTypeExA(long long str long ptr) @ stdcall GetStringTypeExW(long long wstr long ptr) @ stdcall GetStringTypeW(long wstr long ptr) -;@ stdcall GetSystemDEPPolicy ; Win 7 @ stdcall GetSystemDefaultLCID() @ stdcall GetSystemDefaultLangID() -;@ stdcall GetSystemDefaultLocaleName ; Win 7 @ stdcall GetSystemDefaultUILanguage() @ stdcall GetSystemDirectoryA(ptr long) @ stdcall GetSystemDirectoryW(ptr long) -;@ stdcall GetSystemFileCacheSize ; Win 7 -;@ stdcall GetSystemFirmwareTable ; Win 7 +@ stdcall GetSystemFileCacheSize(ptr ptr ptr) +@ stdcall GetSystemFirmwareTable(long long ptr long) @ stdcall GetSystemInfo(ptr) @ stdcall GetSystemPowerStatus(ptr) -;@ stdcall GetSystemPreferredUILanguages ; Win 7 @ stdcall GetSystemRegistryQuota(ptr ptr) @ stdcall GetSystemTime(ptr) @ stdcall GetSystemTimeAdjustment(ptr ptr ptr) @@ -681,39 +471,26 @@ @ stdcall GetTempPathA(long ptr) @ stdcall GetTempPathW(long ptr) @ stdcall GetThreadContext(long ptr) -;@ stdcall GetThreadErrorMode() ; Win 7 -;@ stdcall GetThreadGroupAffinity ; Win 7 @ stdcall GetThreadIOPendingFlag(long ptr) @ stdcall GetThreadId(ptr) -;@ stdcall GetThreadIdealProcessorEx ; Win 7 @ stdcall GetThreadLocale() -;@ stdcall GetThreadPreferredUILanguages ; Win 7 @ stdcall GetThreadPriority(long) @ stdcall GetThreadPriorityBoost(long ptr) @ stdcall GetThreadSelectorEntry(long long ptr) @ stdcall GetThreadTimes(long ptr ptr ptr ptr) -;@ stdcall GetThreadUILanguage ; Win 7 @ stdcall GetTickCount() -@ stdcall -ret64 GetTickCount64() @ stdcall GetTimeFormatA(long long ptr str ptr long) -;@ stdcall GetTimeFormatEx ; Win 7 @ stdcall GetTimeFormatW(long long ptr wstr ptr long) @ stdcall GetTimeZoneInformation(ptr) -;@ stdcall GetTimeZoneInformationForYear ; Win 7 -;@ stdcall GetUILanguageInfo ; Win 7 -;@ stdcall -arch=x86_64 GetUmsCompletionListEvent @ stdcall GetUserDefaultLCID() @ stdcall GetUserDefaultLangID() -;@ stdcall GetUserDefaultLocaleName ; Win 7 @ stdcall GetUserDefaultUILanguage() @ stdcall GetUserGeoID(long) -;@ stdcall GetUserPreferredUILanguages ; Win 7 @ stdcall GetVDMCurrentDirectories(long long) @ stdcall GetVersion() @ stdcall GetVersionExA(ptr) @ stdcall GetVersionExW(ptr) @ stdcall GetVolumeInformationA(str ptr long ptr ptr ptr ptr long) -;@ stdcall GetVolumeInformationByHandleW ; Win 7 @ stdcall GetVolumeInformationW(wstr ptr long ptr ptr ptr ptr long) @ stdcall GetVolumeNameForVolumeMountPointA(str ptr long) @ stdcall GetVolumeNameForVolumeMountPointW(wstr ptr long) @@ -761,7 +538,6 @@ @ stdcall HeapQueryInformation(long long ptr long ptr) @ stdcall HeapQueryTagW(long long long long ptr) ; missing in Win 7 @ stdcall HeapReAlloc(long long ptr long) ntdll.RtlReAllocateHeap -@ stub HeapSetFlags ; missing in XP SP3 and Win 7 @ stdcall HeapSetInformation(ptr long ptr long) @ stdcall HeapSize(long long ptr) ntdll.RtlSizeHeap @ stdcall HeapSummary(long long ptr) @@ -769,34 +545,20 @@ @ stdcall HeapUsage(long long long long ptr) ; missing in Win 7 @ stdcall HeapValidate(long long ptr) @ stdcall HeapWalk(long ptr) -;@ stdcall IdnToAscii ; Win 7 -;@ stdcall IdnToNameprepUnicode ; Win 7 -;@ stdcall IdnToUnicode ; Win 7 @ stdcall InitAtomTable(long) -;@ stdcall InitOnceBeginInitialize ; Win 7 -;@ stdcall InitOnceComplete ; Win 7 -;@ stdcall InitOnceExecuteOnce ; Win 7 -;@ stdcall InitOnceInitialize ntdll.RtlRunOnceInitialize ; Win 7 -;@ stdcall InitializeConditionVariable ntdll.RtlInitializeConditionVariable ; Win 7 -@ stdcall InitializeCriticalSection(ptr) ; FIXME: ntdll.RtlInitializeCriticalSection +@ stdcall InitializeCriticalSection(ptr) @ stdcall InitializeCriticalSectionAndSpinCount(ptr long) -@ stdcall InitializeCriticalSectionEx(ptr long long) -;@ stdcall InitializeExtendedContext ; Win 7 -;@ stdcall InitializeProcThreadAttributeList api-ms-win-core-processthreads-l1-1-0.InitializeProcThreadAttributeList ; Win 7 @ stdcall InitializeSListHead(ptr) ntdll.RtlInitializeSListHead -@ stdcall InitializeSRWLock(ptr) ntdll.RtlInitializeSRWLock -@ stdcall -arch=i386 InterlockedCompareExchange (ptr long long) @ stdcall -arch=i386 -ret64 InterlockedCompareExchange64(ptr double double) ntdll.RtlInterlockedCompareExchange64 +@ stdcall -arch=i386 InterlockedCompareExchange (ptr long long) @ stdcall -arch=i386 InterlockedDecrement(ptr) @ stdcall -arch=i386 InterlockedExchange(ptr long) -@ stdcall -arch=i386 InterlockedExchangeAdd (ptr long ) +@ stdcall -arch=i386 InterlockedExchangeAdd(ptr long) @ stdcall InterlockedFlushSList(ptr) ntdll.RtlInterlockedFlushSList @ stdcall -arch=i386 InterlockedIncrement(ptr) @ stdcall InterlockedPopEntrySList(ptr) ntdll.RtlInterlockedPopEntrySList @ stdcall InterlockedPushEntrySList(ptr ptr) ntdll.RtlInterlockedPushEntrySList -;@ stdcall InterlockedPushListSList ntdll.RtlInterlockedPushListSList ; Win 7 @ stdcall InvalidateConsoleDIBits(long long) -@ stub InvalidateNSCache ; missing in XP SP3 and Win 7 @ stdcall IsBadCodePtr(ptr) @ stdcall IsBadHugeReadPtr(ptr long) @ stdcall IsBadHugeWritePtr(ptr long) @@ -804,63 +566,25 @@ @ stdcall IsBadStringPtrA(ptr long) @ stdcall IsBadStringPtrW(ptr long) @ stdcall IsBadWritePtr(ptr long) -;@ stdcall IsCalendarLeapDay ; Win 7 -;@ stdcall IsCalendarLeapMonth ; Win 7 -;@ stdcall IsCalendarLeapYear ; Win 7 @ stdcall IsDBCSLeadByte(long) @ stdcall IsDBCSLeadByteEx(long long) @ stdcall IsDebuggerPresent() -;@ stdcall IsNLSDefinedString ; Win 7 -;@ stdcall IsNormalizedString ; Win 7 +@ stdcall IsNLSDefinedString(long long ptr long long) @ stdcall IsProcessInJob(long long ptr) @ stdcall IsProcessorFeaturePresent(long) @ stdcall IsSystemResumeAutomatic() -@ stdcall IsThreadAFiber() -;@ stdcall IsThreadAFiber ; Win 7 -;@ stdcall IsThreadpoolTimerSet ntdll.TpIsTimerSet ; Win 7 -;@ stdcall IsTimeZoneRedirectionEnabled ; Win 7 -;@ stdcall IsValidCalDateTime ; Win 7 +@ stdcall IsTimeZoneRedirectionEnabled() @ stdcall IsValidCodePage(long) @ stdcall IsValidLanguageGroup(long long) @ stdcall IsValidLocale(long long) -;@ stdcall IsValidLocaleName ; Win 7 @ stdcall IsValidUILanguage(long) ; missing in Win 7 @ stdcall IsWow64Process(ptr ptr) -;@ stdcall K32EmptyWorkingSet ; Win 7 -;@ stdcall K32EnumDeviceDrivers ; Win 7 -;@ stdcall K32EnumPageFilesA ; Win 7 -;@ stdcall K32EnumPageFilesW ; Win 7 -;@ stdcall K32EnumProcessModules ; Win 7 -;@ stdcall K32EnumProcessModulesEx ; Win 7 -;@ stdcall K32EnumProcesses ; Win 7 -;@ stdcall K32GetDeviceDriverBaseNameA ; Win 7 -;@ stdcall K32GetDeviceDriverBaseNameW ; Win 7 -;@ stdcall K32GetDeviceDriverFileNameA ; Win 7 -;@ stdcall K32GetDeviceDriverFileNameW ; Win 7 -;@ stdcall K32GetMappedFileNameA ; Win 7 -;@ stdcall K32GetMappedFileNameW ; Win 7 -;@ stdcall K32GetModuleBaseNameA ; Win 7 -;@ stdcall K32GetModuleBaseNameW ; Win 7 -;@ stdcall K32GetModuleFileNameExA ; Win 7 -;@ stdcall K32GetModuleFileNameExW ; Win 7 -;@ stdcall K32GetModuleInformation ; Win 7 -;@ stdcall K32GetPerformanceInfo ; Win 7 -;@ stdcall K32GetProcessImageFileNameA ; Win 7 -;@ stdcall K32GetProcessImageFileNameW ; Win 7 -;@ stdcall K32GetProcessMemoryInfo ; Win 7 -;@ stdcall K32GetWsChanges ; Win 7 -;@ stdcall K32GetWsChangesEx ; Win 7 -;@ stdcall K32InitializeProcessForWsWatch ; Win 7 -;@ stdcall K32QueryWorkingSet ; Win 7 -;@ stdcall K32QueryWorkingSetEx ; Win 7 -@ stdcall LCIDToLocaleName(long wstr long long) ; needed for wine gecko; missing in XP SP3 @ stdcall LCMapStringA(long long str long ptr long) -;@ stdcall LCMapStringEx ; Win 7 @ stdcall LCMapStringW(long long wstr long ptr long) @ stdcall LZClose(long) -;@ stdcall LZCloseFile ; Win 7 +@ stdcall LZCloseFile(long) @ stdcall LZCopy(long long) -;@ stdcall LZCreateFileW ; Win 7 +@ stdcall LZCreateFileW(ptr long long long ptr) @ stdcall LZDone() @ stdcall LZInit(long) @ stdcall LZOpenFileA(str ptr long) @@ -869,16 +593,12 @@ @ stdcall LZSeek(long long long) @ stdcall LZStart() @ stdcall LeaveCriticalSection(ptr) ntdll.RtlLeaveCriticalSection -;@ stdcall LeaveCriticalSectionWhenCallbackReturns ntdll.TpCallbackLeaveCriticalSectionOnCompletion ; Win 7 -;@ stdcall LoadAppInitDlls ; Win 7 @ stdcall LoadLibraryA(str) @ stdcall LoadLibraryExA( str long long) @ stdcall LoadLibraryExW(wstr long long) @ stdcall LoadLibraryW(wstr) @ stdcall LoadModule(str ptr) @ stdcall LoadResource(long long) -;@ stdcall LoadStringBaseExW ; Win 7 -;@ stdcall LoadStringBaseW ; Win 7 @ stdcall LocalAlloc(long long) @ stdcall LocalCompact(long) @ stdcall LocalFileTimeToFileTime(ptr ptr) @@ -890,18 +610,13 @@ @ stdcall LocalShrink(long long) @ stdcall LocalSize(long) @ stdcall LocalUnlock(long) -;@ stub LocaleNameToLCID ; missing in XP SP3 -;@ stdcall LocateExtendedFeature api-ms-win-core-xstate-l1-1-0.RtlLocateExtendedFeature ; Win 7 -;@ stdcall LocateLegacyContext api-ms-win-core-xstate-l1-1-0.RtlLocateLegacyContext ; Win 7 @ stdcall LockFile(long long long long long) @ stdcall LockFileEx(long long long long long ptr) @ stdcall LockResource(long) -;@ stdcall MakeCriticalSectionGlobal(ptr) // ??? @ stdcall MapUserPhysicalPages(ptr long ptr) @ stdcall MapUserPhysicalPagesScatter(ptr long ptr) @ stdcall MapViewOfFile(long long long long long) @ stdcall MapViewOfFileEx(long long long long long ptr) -;@ stdcall MapViewOfFileExNuma ; Win 7 @ stdcall Module32First(long ptr) @ stdcall Module32FirstW(long ptr) @ stdcall Module32Next(long ptr) @@ -909,8 +624,6 @@ @ stdcall MoveFileA(str str) @ stdcall MoveFileExA(str str long) @ stdcall MoveFileExW(wstr wstr long) -;@ stdcall MoveFileTransactedA ; Win 7 -;@ stdcall MoveFileTransactedW ; Win 7 @ stdcall MoveFileW(wstr wstr) @ stdcall MoveFileWithProgressA(str str ptr ptr long) @ stdcall MoveFileWithProgressW(wstr wstr ptr ptr long) @@ -918,40 +631,25 @@ @ stdcall MultiByteToWideChar(long long str long ptr long) @ stdcall NeedCurrentDirectoryForExePathA(str) @ stdcall NeedCurrentDirectoryForExePathW(wstr) -;@ stdcall NlsCheckPolicy ; Win 7 @ stdcall NlsConvertIntegerToString(long long long wstr long) ; missing in Win 7 -;@ stdcall NlsEventDataDescCreate ; Win 7 @ stdcall NlsGetCacheUpdateCount() -@ stub NlsResetProcessLocale ; missing in XP SP3 and Win 7 -;@ stdcall NlsUpdateLocale ; Win 7 -;@ stdcall NlsUpdateSystemLocale ; Win 7 -;@ stdcall NlsWriteEtwEvent ; Win 7 -;@ stdcall NormalizeString ; Win 7 -;@ stdcall NotifyMountMgr ; Win 7 -@ stub NotifyNLSUserCache ; missing in XP SP3 and win 7 -;@ stdcall NotifyUILanguageChange ; Win 7 -@ stdcall NumaVirtualQueryNode(long long long long) ; missing in win 7 +@ stdcall NlsResetProcessLocale() @ stdcall OpenConsoleW(wstr long long long) @ stdcall OpenDataFile(long long) ; missing in Win 7 @ stdcall OpenEventA(long long str) @ stdcall OpenEventW(long long wstr) @ stdcall OpenFile(str ptr long) -;@ stdcall OpenFileById ; Win 7 @ stdcall OpenFileMappingA(long long str) @ stdcall OpenFileMappingW(long long wstr) @ stdcall OpenJobObjectA(long long str) @ stdcall OpenJobObjectW(long long wstr) @ stdcall OpenMutexA(long long str) @ stdcall OpenMutexW(long long wstr) -;@ stdcall OpenPrivateNamespaceA ; Win 7 -;@ stdcall OpenPrivateNamespaceW ; Win 7 @ stdcall OpenProcess(long long long) -;@ stdcall OpenProcessToken api-ms-win-core-processthreads-l1-1-0.OpenProcessToken ; Win 7 @ stdcall OpenProfileUserMapping() @ stdcall OpenSemaphoreA(long long str) @ stdcall OpenSemaphoreW(long long wstr) @ stdcall OpenThread(long long long) -;@ stdcall OpenThreadToken api-ms-win-core-processthreads-l1-1-0.OpenThreadToken ; win 7 @ stdcall OpenWaitableTimerA(long long str) @ stdcall OpenWaitableTimerW(long long wstr) @ stdcall OutputDebugStringA(str) @@ -960,9 +658,6 @@ @ stdcall PeekConsoleInputW(ptr ptr long ptr) @ stdcall PeekNamedPipe(long ptr long ptr ptr ptr) @ stdcall PostQueuedCompletionStatus(long long ptr ptr) -;@ stdcall PowerClearRequest ; Win 7 -;@ stdcall PowerCreateRequest ; Win 7 -;@ stdcall PowerSetRequest ; Win 7 @ stdcall PrepareTape(ptr long long) @ stdcall PrivCopyFileExW(wstr wstr ptr ptr long long) @ stdcall PrivMoveFileIdentityW(long long long) @@ -973,35 +668,18 @@ @ stdcall ProcessIdToSessionId(long ptr) @ stdcall PulseEvent(long) @ stdcall PurgeComm(long long) -;@ stdcall QueryActCtxSettingsW ; Win 7 -;@ stdcall QueryActCtxW(long ptr ptr long ptr long ptr) @ stdcall QueryActCtxW(long ptr ptr long ptr long ptr) @ stdcall QueryDepthSList(ptr) ntdll.RtlQueryDepthSList @ stdcall QueryDosDeviceA(str ptr long) @ stdcall QueryDosDeviceW(wstr ptr long) -@ stdcall QueryFullProcessImageNameA(ptr long str ptr) ; Vista and later -@ stdcall QueryFullProcessImageNameW(ptr long wstr ptr) ; Vista and later -;@ stdcall QueryIdleProcessorCycleTime ; Win 7 -;@ stdcall QueryIdleProcessorCycleTimeEx ; Win 7 @ stdcall QueryInformationJobObject(long long ptr long ptr) @ stdcall QueryMemoryResourceNotification(ptr ptr) -@ stub QueryNumberOfEventLogRecords ; missing in XP SP3 and Win 7 -@ stub QueryOldestEventLogRecord ; missing in XP SP3 and Win 7 @ stdcall QueryPerformanceCounter(ptr) @ stdcall QueryPerformanceFrequency(ptr) -;@ stdcall QueryProcessAffinityUpdateMode ; Win 7 -;@ stdcall QueryProcessCycleTime ; Win 7 -;@ stdcall QueryThreadCycleTime ; Win 7 -;@ stdcall QueryThreadProfiling ; Win 7 -;@ stdcall QueryThreadpoolStackInformation ; Win 7 -;@ stdcall -arch=x86_64 QueryUmsThreadInformation -;@ stdcall QueryUnbiasedInterruptTime ; Win 7 -@ stdcall QueryWin31IniFilesMappedToRegistry(long long long long) ; missing in Win 7 @ stdcall QueueUserAPC(ptr long long) @ stdcall QueueUserWorkItem(ptr ptr long) @ stdcall RaiseException(long long long ptr) -;@ stdcall RaiseFailFastException ; Win 7 -@ stub ReOpenFile ;@ stdcall ReOpenFile(ptr long long long) +@ stdcall ReOpenFile(ptr long long long) @ stdcall ReadConsoleA(long ptr long ptr ptr) @ stdcall ReadConsoleInputA(long ptr long ptr) @ stdcall ReadConsoleInputExA(long ptr long ptr long) @@ -1018,105 +696,37 @@ @ stdcall ReadFileEx(long ptr long ptr ptr) @ stdcall ReadFileScatter(long ptr long ptr ptr) @ stdcall ReadProcessMemory(long ptr ptr long ptr) -;@ stdcall ReadThreadProfilingData ; Win 7 -;@ stdcall RegCloseKey ; Win 7 -;@ stdcall RegCreateKeyExA ; Win 7 -;@ stdcall RegCreateKeyExW ; Win 7 -;@ stdcall RegDeleteKeyExA ; Win 7 -;@ stdcall RegDeleteKeyExW ; Win 7 -;@ stdcall RegDeleteTreeA ; Win 7 -;@ stdcall RegDeleteTreeW ; Win 7 -;@ stdcall RegDeleteValueA ; Win 7 -;@ stdcall RegDeleteValueW ; Win 7 -;@ stdcall RegDisablePredefinedCacheEx ; Win 7 -;@ stdcall RegEnumKeyExA ; Win 7 -;@ stdcall RegEnumKeyExW ; Win 7 -;@ stdcall RegEnumValueA ; Win 7 -;@ stdcall RegEnumValueW ; Win 7 -;@ stdcall RegFlushKey ; Win 7 -;@ stdcall RegGetKeySecurity ; Win 7 -;@ stdcall RegGetValueA ; Win 7 -;@ stdcall RegGetValueW ; Win 7 -;@ stdcall RegKrnGetGlobalState ; Win 7 -;@ stdcall RegKrnInitialize ; Win 7 -;@ stdcall RegLoadKeyA ; Win 7 -;@ stdcall RegLoadKeyW ; Win 7 -;@ stdcall RegLoadMUIStringA ; Win 7 -;@ stdcall RegLoadMUIStringW ; Win 7 -;@ stdcall RegNotifyChangeKeyValue ; Win 7 -;@ stdcall RegOpenCurrentUser ; Win 7 -;@ stdcall RegOpenKeyExA ; Win 7 -;@ stdcall RegOpenKeyExW ; Win 7 -;@ stdcall RegOpenUserClassesRoot ; Win 7 -;@ stdcall RegQueryInfoKeyA ; Win 7 -;@ stdcall RegQueryInfoKeyW ; Win 7 -;@ stdcall RegQueryValueExA ; Win 7 -;@ stdcall RegQueryValueExW ; Win 7 -;@ stdcall RegRestoreKeyA ; Win 7 -;@ stdcall RegRestoreKeyW ; Win 7 -;@ stdcall RegSaveKeyExA ; Win 7 -;@ stdcall RegSaveKeyExW ; Win 7 -;@ stdcall RegSetKeySecurity ; Win 7 -;@ stdcall RegSetValueExA ; Win 7 -;@ stdcall RegSetValueExW ; Win 7 -;@ stdcall RegUnLoadKeyA ; Win 7 -;@ stdcall RegUnLoadKeyW ; Win 7 -;@ stdcall RegisterApplicationRecoveryCallback ; Win 7 -@ stdcall RegisterApplicationRestart(wstr long) @ stdcall RegisterConsoleIME(ptr ptr) @ stdcall RegisterConsoleOS2(long) @ stdcall RegisterConsoleVDM(long long long long long long long long long long long) -;@ stub RegisterServiceProcess ; missing in XP SP3 and Win 7 -@ stub RegisterSysMsgHandler ; missing in XP SP3 and win 7 @ stdcall RegisterWaitForInputIdle(ptr) @ stdcall RegisterWaitForSingleObject(ptr long ptr ptr long long) @ stdcall RegisterWaitForSingleObjectEx(long ptr ptr long long) @ stdcall RegisterWowBaseHandlers(long) @ stdcall RegisterWowExec(long) -;@ stdcall ReinitializeCriticalSection(ptr) ; ??? @ stdcall ReleaseActCtx(ptr) @ stdcall ReleaseMutex(long) -;@ stdcall ReleaseMutexWhenCallbackReturns ntdll.TpCallbackReleaseMutexOnCompletion ; Win 7 -@ stdcall ReleaseSRWLockExclusive(ptr) ntdll.RtlReleaseSRWLockExclusive -@ stdcall ReleaseSRWLockShared(ptr) ntdll.RtlReleaseSRWLockShared @ stdcall ReleaseSemaphore(long long ptr) -;@ stdcall ReleaseSemaphoreWhenCallbackReturns ntdll.TpCallbackReleaseSemaphoreOnCompletion ; Win 7 @ stdcall RemoveDirectoryA(str) -;@ stdcall RemoveDirectoryTransactedA ; Win 7 -;@ stdcall RemoveDirectoryTransactedW ; Win 7 @ stdcall RemoveDirectoryW(wstr) @ stdcall RemoveLocalAlternateComputerNameA(str long) @ stdcall RemoveLocalAlternateComputerNameW(wstr long) -;@ stdcall RemoveSecureMemoryCacheCallback ; Win 7 @ stdcall RemoveVectoredContinueHandler(ptr) ntdll.RtlRemoveVectoredContinueHandler @ stdcall RemoveVectoredExceptionHandler(ptr) ntdll.RtlRemoveVectoredExceptionHandler @ stdcall ReplaceFile(wstr wstr wstr long ptr ptr) ReplaceFileW @ stdcall ReplaceFileA(str str str long ptr ptr) @ stdcall ReplaceFileW(wstr wstr wstr long ptr ptr) -;@ stdcall ReplacePartitionUnit ; Win 7 @ stdcall RequestDeviceWakeup(long) @ stdcall RequestWakeupLatency(long) @ stdcall ResetEvent(long) @ stdcall ResetWriteWatch(ptr long) -;@ stdcall ResolveLocaleName ; Win 7 @ stdcall RestoreLastError(long) ntdll.RtlRestoreLastWin32Error @ stdcall ResumeThread(long) -@ cdecl -arch=x86_64 RtlAddFunctionTable(ptr long long) ntdll.RtlAddFunctionTable @ stdcall -register RtlCaptureContext(ptr) ntdll.RtlCaptureContext @ stdcall RtlCaptureStackBackTrace(long long ptr ptr) ntdll.RtlCaptureStackBackTrace -@ stdcall -arch=x86_64 RtlCompareMemory(ptr ptr ptr) -@ stdcall -arch=x86_64 RtlCopyMemory(ptr ptr ptr) -@ stdcall -arch=x86_64 RtlDeleteFunctionTable(ptr) @ stdcall RtlFillMemory(ptr long long) ntdll.RtlFillMemory -@ stdcall -arch=x86_64 RtlInstallFunctionTableCallback(double double long ptr ptr ptr) -@ stdcall -arch=x86_64 RtlLookupFunctionEntry(ptr ptr ptr) ntdll.RtlLookupFunctionEntry @ stdcall RtlMoveMemory(ptr ptr long) ntdll.RtlMoveMemory -@ stdcall -arch=x86_64 RtlPcToFileHeader(ptr ptr) ntdll.RtlPcToFileHeader -@ stdcall -arch=x86_64 RtlRaiseException(ptr) ntdll.RtlRaiseException -@ stdcall -arch=x86_64 RtlRestoreContext(ptr ptr) ntdll.RtlRestoreContext @ stdcall RtlUnwind(ptr ptr ptr long) ntdll.RtlUnwind -@ stdcall -arch=x86_64 RtlUnwindEx(ptr ptr ptr ptr ptr ptr) ntdll.RtlUnwindEx -@ stdcall -arch=x86_64 RtlVirtualUnwind(ptr ptr ptr long) ntdll.RtlVirtualUnwind @ stdcall RtlZeroMemory(ptr long) ntdll.RtlZeroMemory @ stdcall ScrollConsoleScreenBufferA(long ptr ptr ptr ptr) @ stdcall ScrollConsoleScreenBufferW(long ptr ptr ptr ptr) @@ -1147,7 +757,6 @@ @ stdcall SetConsoleDisplayMode(long long ptr) @ stdcall SetConsoleFont(long long) @ stdcall SetConsoleHardwareState(long long long) -@ stdcall SetConsoleHistoryInfo(ptr) @ stdcall SetConsoleIcon(ptr) @ stdcall SetConsoleInputExeNameA(ptr) @ stdcall SetConsoleInputExeNameW(ptr) @@ -1162,41 +771,29 @@ @ stdcall SetConsoleOS2OemFormat(long) @ stdcall SetConsoleOutputCP(long) @ stdcall SetConsolePalette(long long long) -;@ stdcall SetConsoleScreenBufferInfoEx ; Win 7 @ stdcall SetConsoleScreenBufferSize(long long) @ stdcall SetConsoleTextAttribute(long long) @ stdcall SetConsoleTitleA(str) @ stdcall SetConsoleTitleW(wstr) @ stdcall SetConsoleWindowInfo(long long ptr) @ stdcall SetCriticalSectionSpinCount(ptr long) ntdll.RtlSetCriticalSectionSpinCount -;@ stdcall SetCurrentConsoleFontEx ; Win 7 @ stdcall SetCurrentDirectoryA(str) @ stdcall SetCurrentDirectoryW(wstr) -@ stub SetDaylightFlag ; missing in XP SP3 and Win 7 @ stdcall SetDefaultCommConfigA(str ptr long) @ stdcall SetDefaultCommConfigW(wstr ptr long) @ stdcall SetDllDirectoryA(str) @ stdcall SetDllDirectoryW(wstr) -;@ stdcall SetDynamicTimeZoneInformation ; Win 7 @ stdcall SetEndOfFile(long) -;@ stdcall SetEnvironmentStringsA ; Win 7 -;@ stdcall SetEnvironmentStringsW ; Win 7 +@ stdcall SetEnvironmentStringsA(ptr) +@ stdcall SetEnvironmentStringsW(ptr) @ stdcall SetEnvironmentVariableA(str str) @ stdcall SetEnvironmentVariableW(wstr wstr) @ stdcall SetErrorMode(long) @ stdcall SetEvent(long) -;@ stdcall SetEventWhenCallbackReturns ntdll.TpCallbackSetEventOnCompletion ; Win 7 -;@ stdcall SetExtendedFeaturesMask api-ms-win-core-xstate-l1-1-0.RtlSetExtendedFeaturesMask ; Win 7 @ stdcall SetFileApisToANSI() @ stdcall SetFileApisToOEM() @ stdcall SetFileAttributesA(str long) -;@ stdcall SetFileAttributesTransactedA ; Win 7 -;@ stdcall SetFileAttributesTransactedW ; Win 7 @ stdcall SetFileAttributesW(wstr long) -;@ stdcall SetFileBandwidthReservation ; Win 7 -;@ stdcall SetFileCompletionNotificationModes ; Win 7 -;@ stdcall SetFileInformationByHandle ; Win 7 -;@ stdcall SetFileIoOverlappedRange ; Win 7 @ stdcall SetFilePointer(long long ptr long) @ stdcall SetFilePointerEx(long double ptr long) @ stdcall SetFileShortNameA(long str) @@ -1209,30 +806,24 @@ @ stdcall SetHandleCount(long) @ stdcall SetHandleInformation(long long long) @ stdcall SetInformationJobObject(long long ptr long) -@ stub SetLastConsoleEventActive ; missing in XP SP3 -@ stdcall SetLastError(long) -@ stub SetLocalPrimaryComputerNameA ; missing in XP SP3 -@ stub SetLocalPrimaryComputerNameW ; missing in XP SP3 +@ stdcall SetLastConsoleEventActive() ; missing in XP SP3 +@ stdcall SetLastError(long) ntdll.RtlSetLastWin32Error +@ stdcall SetLocalPrimaryComputerNameA(long long) ; missing in XP SP3 +@ stdcall SetLocalPrimaryComputerNameW(long long) ; missing in XP SP3 @ stdcall SetLocalTime(ptr) @ stdcall SetLocaleInfoA(long long str) @ stdcall SetLocaleInfoW(long long wstr) @ stdcall SetMailslotInfo(long long) @ stdcall SetMessageWaitingIndicator(ptr long) -;@ stdcall SetNamedPipeAttribute ; Win 7 @ stdcall SetNamedPipeHandleState(long ptr ptr ptr) @ stdcall SetPriorityClass(long long) @ stdcall SetProcessAffinityMask(long long) -;@ stdcall SetProcessAffinityUpdateMode ; Win 7 -;@ stdcall SetProcessDEPPolicy ; Win 7 -;@ stdcall SetProcessPreferredUILanguages ; Win 7 @ stdcall SetProcessPriorityBoost(long long) @ stdcall SetProcessShutdownParameters(long long) @ stdcall SetProcessWorkingSetSize(long long long) -;@ stdcall SetProcessWorkingSetSizeEx ; Win 7 -;@ stdcall SetSearchPathMode ; Win 7 +@ stdcall SetProcessWorkingSetSizeEx(long long long long) @ stdcall SetStdHandle(long long) -;@ stdcall SetStdHandleEx ; Win 7 -;@ stdcall SetSystemFileCacheSize ; Win 7 +@ stdcall SetSystemFileCacheSize(long long long) @ stdcall SetSystemPowerState(long long) @ stdcall SetSystemTime(ptr) @ stdcall SetSystemTimeAdjustment(long long) @@ -1241,26 +832,15 @@ @ stdcall SetTermsrvAppInstallMode(long) @ stdcall SetThreadAffinityMask(long long) @ stdcall SetThreadContext(long ptr) -;@ stdcall SetThreadErrorMode(long ptr) ; Win 7 @ stdcall SetThreadExecutionState(long) -;@ stdcall SetThreadGroupAffinity ; Win 7 @ stdcall SetThreadIdealProcessor(long long) -;@ stdcall SetThreadIdealProcessorEx ; Win 7 @ stdcall SetThreadLocale(long) -;@ stdcall SetThreadPreferredUILanguages ; Win 7 @ stdcall SetThreadPriority(long long) @ stdcall SetThreadPriorityBoost(long long) -;@ stdcall SetThreadStackGuarantee ; Win 7 -;@ stdcall SetThreadToken api-ms-win-core-processthreads-l1-1-0.SetThreadToken ; Win 7 +@ stdcall SetThreadStackGuarantee(ptr) @ stdcall SetThreadUILanguage(long) -;@ stdcall SetThreadpoolStackInformation ; Win 7 -;@ stdcall SetThreadpoolThreadMaximum ntdll.TpSetPoolMaxThreads ; Win 7 -;@ stdcall SetThreadpoolThreadMinimum ; Win 7 -;@ stdcall SetThreadpoolTimer ntdll.TpSetTimer ; Win 7 -;@ stdcall SetThreadpoolWait ntdll.TpSetWait ; Win 7 @ stdcall SetTimeZoneInformation(ptr) @ stdcall SetTimerQueueTimer(long ptr ptr long long long) -;@ stdcall -arch?x86_64 SetUmsThreadInformation @ stdcall SetUnhandledExceptionFilter(ptr) @ stdcall SetUserGeoID(long) @ stdcall SetVDMCurrentDirectories(long long) @@ -1269,19 +849,12 @@ @ stdcall SetVolumeMountPointA(str str) @ stdcall SetVolumeMountPointW(wstr wstr) @ stdcall SetWaitableTimer(long ptr long ptr ptr long) -;@ stdcall SetWaitableTimerEx api-ms-win-core-threadpool-l1-1-0.SetWaitableTimerEx ; Win 7 @ stdcall SetupComm(long long long) @ stdcall ShowConsoleCursor(long long) @ stdcall SignalObjectAndWait(long long long long) @ stdcall SizeofResource(long long) @ stdcall Sleep(long) -;@ stdcall SleepConditionVariableCS ; Win 7 -;@ stdcall SleepConditionVariableSRW ; Win 7 @ stdcall SleepEx(long long) -;@ stdcall SortCloseHandle ; Win 7 -;@ stdcall SortGetHandle ; Win 7 -;@ stdcall StartThreadpoolIo ntdll.TpStartAsyncIoOperation ; Win 7 -;@ stdcall SubmitThreadpoolWork ntdll.TpPostWork ; Win 7 @ stdcall SuspendThread(long) @ stdcall SwitchToFiber(ptr) @ stdcall SwitchToThread() @@ -1294,52 +867,37 @@ @ stdcall Thread32First(long ptr) @ stdcall Thread32Next(long ptr) @ stdcall TlsAlloc() -@ stub TlsAllocInternal ; missing in XP SP3 and Win 7 @ stdcall TlsFree(long) -@ stub TlsFreeInternal ; missing in XP SP3 and Win 7 @ stdcall TlsGetValue(long) @ stdcall TlsSetValue(long ptr) @ stdcall Toolhelp32ReadProcessMemory(long ptr ptr long ptr) @ stdcall TransactNamedPipe(long ptr long ptr long ptr ptr) @ stdcall TransmitCommChar(long long) -@ stdcall TrimVirtualBuffer(ptr) ; missing in Win 7 -;@ stdcall TryAcquireSRWLockExclusive ntdll.RtlTryAcquireSRWLockExclusive ; Win 7 -;@ stdcall TryAcquireSRWLockShared ntdll.RtlTryAcquireSRWLockShared ; Win 7 @ stdcall TryEnterCriticalSection(ptr) ntdll.RtlTryEnterCriticalSection -;@ stdcall TrySubmitThreadpoolCallback ; Win 7 @ stdcall TzSpecificLocalTimeToSystemTime(ptr ptr ptr) @ stdcall UTRegister(long str str str ptr ptr ptr) @ stdcall UTUnRegister(long) -;@ stdcall -arch=x86_64 UmsThreadYield @ stdcall UnhandledExceptionFilter(ptr) -;@ stdcall UninitializeCriticalSection(ptr) ; ??? @ stdcall UnlockFile(long long long long long) @ stdcall UnlockFileEx(long long long long ptr) @ stdcall UnmapViewOfFile(ptr) -;@ stdcall UnregisterApplicationRecoveryCallback ; Win 7 -;@ stdcall UnregisterApplicationRestart ; Win 7 @ stdcall UnregisterConsoleIME() @ stdcall UnregisterWait(long) @ stdcall UnregisterWaitEx(long long) -;@ stdcall UpdateCalendarDayOfWeek ; Win 7 -;@ stdcall UpdateProcThreadAttribute api-ms-win-core-processthreads-l1-1-0.UpdateProcThreadAttribute ; Win 7 @ stdcall UpdateResourceA(long str str long ptr long) @ stdcall UpdateResourceW(long wstr wstr long ptr long) @ stdcall VDMConsoleOperation(long long) @ stdcall VDMOperationStarted(long) -@ stub ValidateCType ; missing in XP SP3 and Win 7 -@ stub ValidateLocale ; missing in XP SP3 and Win 7 +@ stdcall ValidateLCType(long long ptr ptr) +@ stdcall ValidateLocale(long) @ stdcall VerLanguageNameA(long str long) @ stdcall VerLanguageNameW(long wstr long) @ stdcall -ret64 VerSetConditionMask(long long long long) ntdll.VerSetConditionMask @ stdcall VerifyConsoleIoHandle(long) -;@ stdcall VerifyScripts ; Win 7 @ stdcall VerifyVersionInfoA(long long double) @ stdcall VerifyVersionInfoW(long long double) @ stdcall VirtualAlloc(ptr long long long) @ stdcall VirtualAllocEx(long ptr long long long) -;@ stdcall VirtualAllocExNuma ; Win 7 -@ stdcall VirtualBufferExceptionHandler(long long long) ; missing in Win 7 @ stdcall VirtualFree(ptr long long) @ stdcall VirtualFreeEx(long ptr long long) @ stdcall VirtualLock(ptr long) @@ -1348,44 +906,20 @@ @ stdcall VirtualQuery(ptr ptr long) @ stdcall VirtualQueryEx(long ptr ptr long) @ stdcall VirtualUnlock(ptr long) -;@ stdcall WTSGetActiveConsoleSessionId ; Win 7 +@ stdcall WTSGetActiveConsoleSessionId() @ stdcall WaitCommEvent(long ptr ptr) @ stdcall WaitForDebugEvent(ptr long) @ stdcall WaitForMultipleObjects(long ptr long long) @ stdcall WaitForMultipleObjectsEx(long ptr long long long) @ stdcall WaitForSingleObject(long long) @ stdcall WaitForSingleObjectEx(long long long) -;@ stdcall WaitForThreadpoolIoCallbacks ntdll.TpWaitForIoCompletion ; Win 7 -;@ stdcall WaitForThreadpoolTimerCallbacks ntdll.TpWaitForTimer ; Win 7 -;@ stdcall WaitForThreadpoolWaitCallbacks ntdll.TpWaitForWait ; Win 7 -;@ stdcall WaitForThreadpoolWorkCallbacks ntdll.TpWaitForWork ; Win 7 @ stdcall WaitNamedPipeA (str long) @ stdcall WaitNamedPipeW (wstr long) -@ stdcall WakeAllConditionVariable(ptr) ntdll.RtlWakeAllConditionVariable -@ stdcall WakeConditionVariable(ptr) ntdll.RtlWakeConditionVariable -;@ stdcall WerGetFlags ; Win 7 -;@ stdcall WerRegisterFile ; Win 7 -;@ stdcall WerRegisterMemoryBlock ; Win 7 -;@ stdcall WerRegisterRuntimeExceptionModule ; Win 7 -;@ stdcall WerSetFlags ; Win 7 -;@ stdcall WerUnregisterFile ; Win 7 -;@ stdcall WerUnregisterMemoryBlock ; Win 7 -;@ stdcall WerUnregisterRuntimeExceptionModule ; Win 7 -;@ stdcall WerpCleanupMessageMapping ; Win 7 -;@ stdcall WerpInitiateRemoteRecovery ; Win 7 -;@ stdcall WerpNotifyLoadStringResource ; Win 7 -;@ stdcall WerpNotifyLoadStringResourceEx ; Win 7 -;@ stdcall WerpNotifyUseStringResource ; Win 7 -;@ stdcall WerpStringLookup ; Win 7 @ stdcall WideCharToMultiByte(long long wstr long ptr long ptr ptr) @ stdcall WinExec(str long) @ stdcall Wow64DisableWow64FsRedirection(ptr) @ stdcall Wow64EnableWow64FsRedirection(long) -;@ stdcall Wow64GetThreadContext ; Win 7 -;@ stdcall Wow64GetThreadSelectorEntry ; Win 7 @ stdcall Wow64RevertWow64FsRedirection(ptr) -;@ stdcall Wow64SetThreadContext ; Win 7 -;@ stdcall Wow64SuspendThread ; Win 7 @ stdcall WriteConsoleA(long ptr long ptr ptr) @ stdcall WriteConsoleInputA(long ptr long ptr) @ stdcall WriteConsoleInputVDMA(long long long long) @@ -1412,23 +946,15 @@ @ stdcall WriteProfileStringA(str str str) @ stdcall WriteProfileStringW(wstr wstr wstr) @ stdcall WriteTapemark(ptr long long long) -@ stdcall WTSGetActiveConsoleSessionId() ; missing in win 7 @ stdcall ZombifyActCtx(ptr) -;@ stdcall -arch=x86_64 __C_specific_handler ntdll.__C_specific_handler -;@ stdcall -arch=x86_64 __chkstk ntdll.__chkstk -;@ stdcall -arch=x86_64 __misaligned_access ntdll.__misaligned_access -@ stub _DebugOut ; missing in XP SP3 and Win 7 -@ stub _DebugPrintf ; missing in XP SP3 and Win 7 @ stdcall _hread(long ptr long) @ stdcall _hwrite(long ptr long) @ stdcall _lclose(long) @ stdcall _lcreat(str long) @ stdcall _llseek(long long long) -;@ stdcall -arch=x86_64 _local_unwind ntdll._local_unwind; Win 7 @ stdcall _lopen(str long) @ stdcall _lread(long ptr long) _hread @ stdcall _lwrite(long ptr long) _hwrite -@ stub dprintf ; missing in XP SP3 and Win 7 @ stdcall lstrcat(str str) lstrcatA @ stdcall lstrcatA(str str) @ stdcall lstrcatW(wstr wstr) @@ -1447,12 +973,17 @@ @ stdcall lstrlen(str) lstrlenA @ stdcall lstrlenA(str) @ stdcall lstrlenW(wstr) -;@ stdcall -arch=x86_64 uaw_lstrcmpW ; Win 7 -;@ stdcall -arch=x86_64 uaw_lstrcmpiW ; Win 7 -;@ stdcall -arch=x86_64 uaw_lstrlenW ; Win 7 -;@ stdcall -arch=x86_64 uaw_wcschr ; Win 7 -;@ stdcall -arch=x86_64 uaw_wcscpy ; Win 7 -;@ stdcall -arch=x86_64 uaw_wcsicmp ; Win 7 -;@ stdcall -arch=x86_64 uaw_wcslen ; Win 7 -;@ stdcall -arch=x86_64 uaw_wcsrchr ; Win 7 +@ cdecl -arch=x86_64 RtlAddFunctionTable(ptr long long) ntdll.RtlAddFunctionTable +@ stdcall -arch=x86_64 RtlCompareMemory(ptr ptr ptr) +@ stdcall -arch=x86_64 RtlCopyMemory(ptr ptr ptr) +@ stdcall -arch=x86_64 RtlDeleteFunctionTable(ptr) +@ stdcall -arch=x86_64 RtlInstallFunctionTableCallback(double double long ptr ptr ptr) +@ stdcall -arch=x86_64 RtlLookupFunctionEntry(ptr ptr ptr) ntdll.RtlLookupFunctionEntry +@ stdcall -arch=x86_64 RtlPcToFileHeader(ptr ptr) ntdll.RtlPcToFileHeader +@ stdcall -arch=x86_64 RtlRaiseException(ptr) ntdll.RtlRaiseException +@ stdcall -arch=x86_64 RtlRestoreContext(ptr ptr) ntdll.RtlRestoreContext +@ stdcall -arch=x86_64 RtlUnwindEx(ptr ptr ptr ptr ptr ptr) ntdll.RtlUnwindEx +@ stdcall -arch=x86_64 RtlVirtualUnwind(ptr ptr ptr long) ntdll.RtlVirtualUnwind + +@ stdcall GetTickCount64() ; FOR WINE diff --git a/dll/win32/kernel32/kernel32.rbuild b/dll/win32/kernel32/kernel32.rbuild index 47a79fc91b5..1aad71c33fc 100644 --- a/dll/win32/kernel32/kernel32.rbuild +++ b/dll/win32/kernel32/kernel32.rbuild @@ -7,122 +7,12 @@ include include/reactos/subsys pseh - normalize + wine ntdll - 0x0600 errcodes k32.h - - -fno-exceptions - -fno-rtti - - - debugger.c - output.c - - - except.c - - - backup.c - bintype.c - cnotify.c - copy.c - create.c - curdir.c - delete.c - deviceio.c - dir.c - dosdev.c - file.c - find.c - hardlink.c - iocompl.c - lfile.c - lock.c - mailslot.c - move.c - npipe.c - pipe.c - rw.c - tape.c - volume.c - - - global.c - heap.c - isbad.c - local.c - procmem.c - resnotify.c - section.c - virtual.c - - - actctx.c - atom.c - chartype.c - collation.c - casemap.c - comm.c - commdcb.c - computername.c - console.c - dllmain.c - env.c - error.c - fold.c - format_msg.c - handle.c - lang.c - ldr.c - lzexpand.c - muldiv.c - nls.c - perfcnt.c - power.c - recovery.c - res.c - sortkey.c - stubs.c - sysinfo.c - time.c - timerqueue.c - toolhelp.c - version.c - - - cmdline.c - procsup.c - job.c - proc.c - session.c - - - lstring.c - - - condvar.c - critical.c - event.c - mutex.c - sem.c - timer.c - wait.c - - - fiber.c - fls.c - thread.c - tls.c - - - lcformat.c - profile.c - utils.c - - + fiber.S @@ -135,9 +25,84 @@ thread.S + appcache.c + atom.c + compname.c + debugger.c + dllmain.c + environ.c + except.c + fiber.c + handle.c + heapmem.c + job.c + loader.c + perfcnt.c + power.c + proc.c + resntfy.c + session.c + synch.c + sysinfo.c + time.c + timerqueue.c + thread.c + toolhelp.c + utils.c + vdm.c + version.c + virtmem.c + vista.c + + backup.c + bintype.c + cnotify.c + copy.c + console.c + create.c + curdir.c + delete.c + deviceio.c + dir.c + dosdev.c + file.c + filemap.c + find.c + hardlink.c + iocompl.c + lfile.c + lock.c + mailslot.c + move.c + npipe.c + pipe.c + rw.c + tape.c + volume.c + - - icustubs.cpp + + actctx.c + comm.c + lzexpand.c + muldiv.c + profile.c + res.c + timezone.c + + + + chartype.c + collation.c + casemap.c + fold.c + format_msg.c + lang.c + lstring.c + lcformat.c + nls.c + sortkey.c + kernel32.rc diff --git a/dll/win32/kernel32/kernel32.rc b/dll/win32/kernel32/kernel32.rc index 39092b2d47a..b8aae5cd9f2 100644 --- a/dll/win32/kernel32/kernel32.rc +++ b/dll/win32/kernel32/kernel32.rc @@ -7,10 +7,13 @@ #include "windows.h" #include "errcodes.rc" -#include "locale_rc.rc" +#include "winnls/locale_rc.rc" -#include "lang/de-DE.rc" -#include "lang/en-US.rc" -#include "lang/es-ES.rc" -#include "lang/ru-RU.rc" -#include "lang/uk-UA.rc" +#include "winnls/lang/en-US.rc" +#include "winnls/lang/de-DE.rc" +#include "winnls/lang/es-ES.rc" + +// UTF-8 +#pragma code_page(65001) +#include "winnls/lang/ru-RU.rc" +#include "winnls/lang/uk-UA.rc" diff --git a/dll/win32/kernel32/kernel32.spec b/dll/win32/kernel32/kernel32.spec index c0a8bf54022..f43460966e7 100644 --- a/dll/win32/kernel32/kernel32.spec +++ b/dll/win32/kernel32/kernel32.spec @@ -1,62 +1,35 @@ -@ stdcall AcquireSRWLockExclusive(ptr) ntdll.RtlAcquireSRWLockExclusive -@ stdcall AcquireSRWLockShared(ptr) ntdll.RtlAcquireSRWLockShared +#undef i386 @ stdcall ActivateActCtx(ptr ptr) @ stdcall AddAtomA(str) @ stdcall AddAtomW(wstr) @ stdcall AddConsoleAliasA(str str str) ;check @ stdcall AddConsoleAliasW(wstr wstr wstr) ;check -;@ stdcall -arch=x86_64 AddIntegrityLabelToBoundaryDescriptor ; Win 7 @ stdcall AddLocalAlternateComputerNameA(str ptr) @ stdcall AddLocalAlternateComputerNameW(wstr ptr) @ stdcall AddRefActCtx(ptr) -;@ stdcall AddSIDToBoundaryDescriptor ; Win 7 -;@ stdcall AddSecureMemoryCacheCallback ; Win 7 @ stdcall AddVectoredContinueHandler(long ptr) ntdll.RtlAddVectoredContinueHandler @ stdcall AddVectoredExceptionHandler(long ptr) ntdll.RtlAddVectoredExceptionHandler -;@ stdcall AdjustCalendarDate ; Win 7 @ stdcall AllocConsole() -;@ stub AllocLSCallback ; missing in XP SP3 and 2003 R2 and Win 7 @ stdcall AllocateUserPhysicalPages(long ptr ptr) -;@ stdcall AllocateUserPhysicalPagesNuma ; Win 7 -;@ stdcall ApplicationRecoveryFinished ; Win 7 -;@ stdcall ApplicationRecoveryInProgress ; Win 7 @ stdcall AreFileApisANSI() @ stdcall AssignProcessToJobObject(ptr ptr) @ stdcall AttachConsole(long) @ stdcall BackupRead(ptr ptr long ptr long long ptr) @ stdcall BackupSeek(ptr long long ptr ptr ptr) @ stdcall BackupWrite(ptr ptr long ptr long long ptr) -@ stdcall BaseCheckAppcompatCache(long long long ptr) ;check -;@ stdcall BaseCheckAppcompatCacheEx ; Win7 -;@ stub BaseCheckRunApp ; Win7 -@ stdcall BaseCleanupAppcompatCache() ; missing in Win 7 +@ stdcall BaseCheckAppcompatCache(long long long ptr) +@ stdcall BaseCheckRunApp(long ptr long long long long long long long long) @ stdcall BaseCleanupAppcompatCacheSupport(ptr) -;@ stdcall BaseDllReadWriteIniFile ; Win 7 @ stdcall BaseDumpAppcompatCache() @ stdcall BaseFlushAppcompatCache() -;@ stdcall BaseFormatObjectAttributes ; Win 7 -;@ stdcall BaseFormatTimeOut ; Win 7 -;@ stdcall BaseGenerateAppCompatData ; Win 7 -;@ stdcall BaseGetNamedObjectDirectory ; Win 7 -@ stdcall BaseInitAppcompatCache() ; missing in Win 7 @ stdcall BaseInitAppcompatCacheSupport() -;@ stdcall BaseIsAppcompatInfrastructureDisabled ; Win 7 +@ stdcall BaseIsAppcompatInfrastructureDisabled() @ stdcall BaseProcessInitPostImport() ; missing in Win 7 @ stdcall BaseQueryModuleData(str str ptr ptr ptr) ;check -;@ stdcall BaseThreadInitThunk ; Win 7 -;@ stdcall BaseSetLastNTError ; Win 7, not 64 bit (present on w2k3 but not exported) @ stdcall BaseUpdateAppcompatCache(long long long) -;@ stdcall BaseVerifyUnicodeString ; Win 7 -;@ stdcall Basep8BitStringToDynamicUnicodeString ; Win 7 -;@ stdcall BasepAllocateActivationContextActivationBlock ; Win 7 -;@ stdcall BasepAnsiStringToDynamicUnicodeString ; Win 7 -;@ stdcall BasepCheckAppCompat ; Win 7 -;@ stdcall BasepCheckBadapp ; Win 7 +@ stdcall BasepCheckBadapp(long ptr long long long long long long long) @ stdcall BasepCheckWinSaferRestrictions(long long long long long long) -;@ stub BasepDebugDump ; missing in XP SP3 and Win 7 -;@ stdcall BasepFreeActivationContextActivationBlock ; Win 7 -;@ stdcall BasepFreeAppCompatData ; Win 7 -;@ stdcall BasepMapModuleHandle ; Win 7 +@ stdcall BasepFreeAppCompatData(ptr ptr) @ stdcall Beep(long long) @ stdcall BeginUpdateResourceA(str long) @ stdcall BeginUpdateResourceW(wstr long) @@ -67,18 +40,11 @@ @ stdcall BuildCommDCBW(wstr ptr) @ stdcall CallNamedPipeA(str ptr long ptr long ptr long) @ stdcall CallNamedPipeW(wstr ptr long ptr long ptr long) -;@ stdcall CallbackMayRunLong ; Win 7 @ stdcall CancelDeviceWakeupRequest(long) @ stdcall CancelIo(long) -@ stdcall CancelIoEx(long ptr) -@ stdcall CancelSynchronousIo(long) -;@ stdcall CancelThreadpoolIo(ptr) ntdll.TpCancelAsyncIoOperation; Win 7 @ stdcall CancelTimerQueueTimer(long long) @ stdcall CancelWaitableTimer(long) @ stdcall ChangeTimerQueueTimer(ptr ptr long long) -;@ stdcall CheckElevation ; Win 7 -;@ stdcall CheckElevationEnabled ; Win 7 -;@ stdcall CheckForReadOnlyResource ; Win 7 @ stdcall CheckNameLegalDOS8Dot3A(str str long long long) @ stdcall CheckNameLegalDOS8Dot3W(wstr str long long long) @ stdcall CheckRemoteDebuggerPresent(long ptr) @@ -86,125 +52,69 @@ @ stdcall ClearCommError(long ptr ptr) @ stdcall CloseConsoleHandle(long) @ stdcall CloseHandle(long) -;@ stdcall ClosePrivateNamespace ; Win 7 @ stdcall CloseProfileUserMapping() -; @ stub CloseSystemHandle ; missing in XP SP3 and Win 7 -;@ stdcall CloseThreadpool(ptr) ntdll.TpReleasePool ; Win 7 -;@ stdcall CloseThreadpoolCleanupGroup(ptr) ntdll.TpReleaseCleanupGroup ; Win 7 -;@ stdcall CloseThreadpoolCleanupGroupMembers(ptr long ptr) ntdll.TpReleaseCleanupGroupMembers ; Win 7 -;@ stdcall CloseThreadpoolIo ntdll.TpReleaseIoCompletion ; Win 7 -;@ stdcall CloseThreadpoolTimer ntdll.TpReleaseTimer ; Win 7 -;@ stdcall CloseThreadpoolWait ntdll.TpReleaseWait ; Win 7 -;@ stdcall CloseThreadpoolWork ntdll.TpReleaseWork ; Win 7 @ stdcall CmdBatNotification(long) @ stdcall CommConfigDialogA(str long ptr) @ stdcall CommConfigDialogW(wstr long ptr) -;@ stdcall CompareCalendarDates ; Win 7 @ stdcall CompareFileTime(ptr ptr) @ stdcall CompareStringA(long long str long str long) -;@ stdcall CompareStringEx ; Win 7 -;@ stdcall CompareStringOrdinal ; Win 7 @ stdcall CompareStringW(long long wstr long wstr long) @ stdcall ConnectNamedPipe(long ptr) @ stdcall ConsoleMenuControl(long long long) -; @ stub ConsoleSubst ; missing in XP SP3 and Win 7 @ stdcall ContinueDebugEvent(long long long) -;@ stdcall ConvertCalDateTimeToSystemTime ; Win 7 @ stdcall ConvertDefaultLocale (long) @ stdcall ConvertFiberToThread() -;@ stdcall ConvertNLSDayOfWeekToWin32DayOfWeek ; Win 7 -;@ stdcall ConvertSystemTimeToCalDateTime ; Win 7 @ stdcall ConvertThreadToFiber(ptr) @ stdcall ConvertThreadToFiberEx(ptr long) -;@ stdcall CopyExtendedContext ; Win 7 @ stdcall CopyFileA(str str long) @ stdcall CopyFileExA (str str ptr ptr ptr long) @ stdcall CopyFileExW (wstr wstr ptr ptr ptr long) -;@ stdcall CopyFileTransactedA ; Win 7 -;@ stdcall CopyFileTransactedW ; Win 7 @ stdcall CopyFileW(wstr wstr long) @ stdcall CopyLZFile(long long) LZCopy @ stdcall CreateActCtxA(ptr) @ stdcall CreateActCtxW(ptr) -;@ stdcall CreateBoundaryDescriptorA ; Win 7 -;@ stdcall CreateBoundaryDescriptorW ; Win 7 @ stdcall CreateConsoleScreenBuffer(long long ptr long ptr) @ stdcall CreateDirectoryA(str ptr) @ stdcall CreateDirectoryExA(str str ptr) @ stdcall CreateDirectoryExW(wstr wstr ptr) -;@ stdcall CreateDirectoryTransactedA ; Win 7 -;@ stdcall CreateDirectoryTransactedW ; Win 7 @ stdcall CreateDirectoryW(wstr ptr) @ stdcall CreateEventA(ptr long long str) -@ stdcall CreateEventExA(ptr str long long) -@ stdcall CreateEventExW(ptr wstr long long) @ stdcall CreateEventW(ptr long long wstr) @ stdcall CreateFiber(long ptr ptr) @ stdcall CreateFiberEx(long long long ptr ptr) @ stdcall CreateFileA(str long long ptr long long long) @ stdcall CreateFileMappingA(long ptr long long long str) -;@ stdcall CreateFileMappingNumaA ; Win 7 -;@ stdcall CreateFileMappingNumaW ; Win 7 @ stdcall CreateFileMappingW(long ptr long long long wstr) -;@ stdcall CreateFileTransactedA ; Win 7 -;@ stdcall CreateFileTransactedW ; Win 7 @ stdcall CreateFileW(wstr long long ptr long long long) @ stdcall CreateHardLinkA(str str ptr) -;@ stdcall CreateHardLinkTransactedA ; Win 7 -;@ stdcall CreateHardLinkTransactedW ; Win 7 @ stdcall CreateHardLinkW(wstr wstr ptr) @ stdcall CreateIoCompletionPort(long long long long) @ stdcall CreateJobObjectA(ptr str) @ stdcall CreateJobObjectW(ptr wstr) @ stdcall CreateJobSet(long ptr long) -;@ stub CreateKernelThread ; missing in XP SP3 and Win 7 @ stdcall CreateMailslotA(ptr long long ptr) @ stdcall CreateMailslotW(ptr long long ptr) @ stdcall CreateMemoryResourceNotification(long) @ stdcall CreateMutexA(ptr long str) -@ stdcall CreateMutexExA(ptr str long long) -@ stdcall CreateMutexExW(ptr wstr long long) @ stdcall CreateMutexW(ptr long wstr) @ stdcall CreateNamedPipeA(str long long long long long long ptr) @ stdcall CreateNamedPipeW(wstr long long long long long long ptr) @ stdcall CreateNlsSecurityDescriptor(ptr long long) ; missing in Win 7 @ stdcall CreatePipe(ptr ptr ptr long) -;@ stdcall CreatePrivateNamespaceA ; Win 7 -;@ stdcall CreatePrivateNamespaceW ; Win 7 @ stdcall CreateProcessA(str str ptr ptr long long ptr str ptr ptr) -;@ stdcall CreateProcessAsUserW ; Win 7 @ stdcall CreateProcessInternalA(ptr str str ptr ptr long long ptr str ptr ptr long) @ stdcall CreateProcessInternalW(ptr wstr wstr ptr ptr long long ptr wstr ptr ptr long) -@ stdcall CreateProcessInternalWSecure() ; missing in Win 7 @ stdcall CreateProcessW(wstr wstr ptr ptr long long ptr wstr ptr ptr) @ stdcall CreateRemoteThread(long ptr long ptr long long ptr) -;@ stdcall CreateRemoteThreadEx api-ms-win-core-processthreads-l1-1-0.CreateRemoteThreadEx ; Win 7 @ stdcall CreateSemaphoreA(ptr long long str) -@ stdcall CreateSemaphoreExA(ptr long long str long long) -@ stdcall CreateSemaphoreExW(ptr long long wstr long long) @ stdcall CreateSemaphoreW(ptr long long wstr) @ stdcall CreateSocketHandle() -@ stdcall CreateSymbolicLinkA(str str long) -;@ stdcall CreateSymbolicLinkTransactedA ; Win 7 -;@ stdcall CreateSymbolicLinkTransactedW ; Win 7 -@ stdcall CreateSymbolicLinkW(wstr wstr long) @ stdcall CreateTapePartition(long long long long) @ stdcall CreateThread(ptr long ptr long long ptr) -;@ stdcall CreateThreadpool ; Win 7 -;@ stdcall CreateThreadpoolCleanupGroup ; Win 7 -;@ stdcall CreateThreadpoolIo ; Win 7 -;@ stdcall CreateThreadpoolTimer ; Win 7 -;@ stdcall CreateThreadpoolWait ; Win 7 -;@ stdcall CreateThreadpoolWork ; Win 7 @ stdcall CreateTimerQueue () @ stdcall CreateTimerQueueTimer(ptr long ptr ptr long long long) @ stdcall CreateToolhelp32Snapshot(long long) -;@ stdcall arch=x86_64 CreateUmsCompletionList -;@ stdcall arch=x86_64 CreateUmsThreadContext -@ stdcall CreateVirtualBuffer(long long long) ; missing in Win 7 @ stdcall CreateWaitableTimerA(ptr long str) -@ stdcall CreateWaitableTimerExA(ptr str long long) -@ stdcall CreateWaitableTimerExW(ptr wstr long long) @ stdcall CreateWaitableTimerW(ptr long wstr) @ stdcall DeactivateActCtx(long ptr) @ stdcall DebugActiveProcess(long) @@ -218,26 +128,17 @@ @ stdcall DefineDosDeviceW(long wstr wstr) @ stdcall DelayLoadFailureHook(str str) @ stdcall DeleteAtom(long) -;@ stdcall DeleteBoundaryDescriptor ntdll.RtlDeleteBoundaryDescriptor ; Win 7 @ stdcall DeleteCriticalSection(ptr) ntdll.RtlDeleteCriticalSection @ stdcall DeleteFiber(ptr) @ stdcall DeleteFileA(str) -;@ stdcall DeleteFileTransactedA ; Win 7 -;@ stdcall DeleteFileTransactedW ; Win 7 @ stdcall DeleteFileW(wstr) -;@ stdcall DeleteProcThreadAttributeList api-ms-win-core-processthreads-l1-1-0.DeleteProcThreadAttributeList ; Win 7 @ stdcall DeleteTimerQueue(long) @ stdcall DeleteTimerQueueEx (long long) @ stdcall DeleteTimerQueueTimer(long long long) -;@ stdcall -arch=x86_64 DeleteUmsCompletionList -;@ stdcall -arch=x86_64 DeleteUmsThreadContext @ stdcall DeleteVolumeMountPointA(str) ;check @ stdcall DeleteVolumeMountPointW(wstr) ;check -;@ stdcall -arch=x86_64 DequeueUmsCompletionListItems @ stdcall DeviceIoControl(long long ptr long ptr long ptr ptr) @ stdcall DisableThreadLibraryCalls(long) -;@ stdcall DisableThreadProfiling ; Win 7 -;@ stdcall DisassociateCurrentThreadFromCallback ntdll.TpDisassociateCallback ; Win 7 @ stdcall DisconnectNamedPipe(long) @ stdcall DnsHostnameToComputerNameA (str ptr ptr) @ stdcall DnsHostnameToComputerNameW (wstr ptr ptr) @@ -246,48 +147,36 @@ @ stdcall DosPathToSessionPathW(long wstr wstr) @ stdcall DuplicateConsoleHandle(long long long long) @ stdcall DuplicateHandle(long long long ptr long long long) -;@ stdcall EnableThreadProfiling ; Win 7 @ stdcall EncodePointer(ptr) ntdll.RtlEncodePointer @ stdcall EncodeSystemPointer(ptr) ntdll.RtlEncodeSystemPointer @ stdcall EndUpdateResourceA(long long) @ stdcall EndUpdateResourceW(long long) @ stdcall EnterCriticalSection(ptr) ntdll.RtlEnterCriticalSection -;@ stdcall -arch=x86_64 EnterUmsSchedulingMode @ stdcall EnumCalendarInfoA(ptr long long long) @ stdcall EnumCalendarInfoExA(ptr long long long) -;@ stdcall EnumCalendarInfoExEx ; Win 7 @ stdcall EnumCalendarInfoExW(ptr long long long) @ stdcall EnumCalendarInfoW(ptr long long long) @ stdcall EnumDateFormatsA(ptr long long) @ stdcall EnumDateFormatsExA(ptr long long) -;@ stdcall EnumDateFormatsExEx ; Win 7 @ stdcall EnumDateFormatsExW(ptr long long) @ stdcall EnumDateFormatsW(ptr long long) @ stdcall EnumLanguageGroupLocalesA(ptr long long ptr) @ stdcall EnumLanguageGroupLocalesW(ptr long long ptr) @ stdcall EnumResourceLanguagesA(long str str ptr long) -;@ stdcall EnumResourceLanguagesExA ; Win 7 -;@ stdcall EnumResourceLanguagesExW ; Win 7 @ stdcall EnumResourceLanguagesW(long wstr wstr ptr long) @ stdcall EnumResourceNamesA(long str ptr long) -;@ stdcall EnumResourceNamesExA ; Win 7 -;@ stdcall EnumResourceNamesExW ; Win 7 @ stdcall EnumResourceNamesW(long wstr ptr long) @ stdcall EnumResourceTypesA(long ptr long) -;@ stdcall EnumResourceTypesExA ; Win 7 -;@ stdcall EnumResourceTypesExW ; Win 7 @ stdcall EnumResourceTypesW(long ptr long) @ stdcall EnumSystemCodePagesA(ptr long) @ stdcall EnumSystemCodePagesW(ptr long) -;@ stdcall EnumSystemFirmwareTables ; Win 7 +@ stdcall EnumSystemFirmwareTables(long ptr long) @ stdcall EnumSystemGeoID(long long ptr) @ stdcall EnumSystemLanguageGroupsA(ptr long ptr) @ stdcall EnumSystemLanguageGroupsW(ptr long ptr) @ stdcall EnumSystemLocalesA(ptr long) -;@ stdcall EnumSystemLocalesEx ; Win 7 @ stdcall EnumSystemLocalesW(ptr long) @ stdcall EnumTimeFormatsA(ptr long long) -;@ stdcall EnumTimeFormatsEx ; Win 7 @ stdcall EnumTimeFormatsW(ptr long long) @ stdcall EnumUILanguagesA(ptr long long) @ stdcall EnumUILanguagesW(ptr long long) @@ -302,7 +191,6 @@ @ stdcall ExpandEnvironmentStringsW(wstr ptr long) @ stdcall ExpungeConsoleCommandHistoryA(long) @ stdcall ExpungeConsoleCommandHistoryW(long) -@ stdcall ExtendVirtualBuffer(long long) ; missing in Win 7 @ stdcall FatalAppExitA(long str) @ stdcall FatalAppExitW(long wstr) @ stdcall FatalExit(long) @@ -324,24 +212,16 @@ @ stdcall FindFirstFileA(str ptr) @ stdcall FindFirstFileExA(str long ptr long ptr long) @ stdcall FindFirstFileExW(wstr long ptr long ptr long) -;@ stdcall FindFirstFileNameTransactedW ; Win 7 -;@ stdcall FindFirstFileNameW ; Win 7 -;@ stdcall FindFirstFileTransactedA ; Win 7 -;@ stdcall FindFirstFileTransactedW ; Win 7 @ stdcall FindFirstFileW(wstr ptr) -;@ stdcall FindFirstStreamTransactedW ; Win 7 @ stdcall FindFirstStreamW(wstr ptr ptr long) @ stdcall FindFirstVolumeA(ptr long) @ stdcall FindFirstVolumeMountPointA(str ptr long) @ stdcall FindFirstVolumeMountPointW(wstr ptr long) @ stdcall FindFirstVolumeW(ptr long) -;@ stdcall FindNLSString ; Win 7 -;@ stdcall FindNLSStringEx ; Win 7 @ stdcall FindNextChangeNotification(long) @ stdcall FindNextFileA(long ptr) -;@ stdcall FindNextFileNameW ; Win 7 @ stdcall FindNextFileW(long ptr) -;@ stdcall FindNextStreamW ; Win 7 +@ stdcall FindNextStreamW(ptr ptr) @ stdcall FindNextVolumeA(long ptr long) @ stdcall FindNextVolumeMountPointA(long str long) @ stdcall FindNextVolumeMountPointW(long wstr long) @@ -350,17 +230,15 @@ @ stdcall FindResourceExA(long str str long) @ stdcall FindResourceExW(long wstr wstr long) @ stdcall FindResourceW(long wstr wstr) -;@ stdcall FindStringOrdinal ; Win 7 @ stdcall FindVolumeClose(ptr) @ stdcall FindVolumeMountPointClose(ptr) -;@ stdcall FlsAlloc(ptr) ; missing in XP SP3 -;@ stdcall FlsFree(long) ; missing in XP SP3 -;@ stdcall FlsGetValue(long) ; missing in XP SP3 -;@ stdcall FlsSetValue(long ptr) ; missing in XP SP3 +;@ stdcall FlsAlloc(ptr) +;@ stdcall FlsFree(long) +;@ stdcall FlsGetValue(long) +;@ stdcall FlsSetValue(long ptr) @ stdcall FlushConsoleInputBuffer(long) @ stdcall FlushFileBuffers(long) @ stdcall FlushInstructionCache(long long long) -;@ stdcall FlushProcessWriteBuffers ntdll.NtFlushProcessWriteBuffers ; Win 7 @ stdcall FlushViewOfFile(ptr long) @ stdcall FoldStringA(long str long ptr long) @ stdcall FoldStringW(long wstr long ptr long) @@ -371,16 +249,10 @@ @ stdcall FreeEnvironmentStringsW(ptr) @ stdcall FreeLibrary(long) @ stdcall FreeLibraryAndExitThread(long long) -;@ stdcall FreeLibraryWhenCallbackReturns ntdll.TpCallbackUnloadDllOnCompletion ; Win 7 @ stdcall FreeResource(long) @ stdcall FreeUserPhysicalPages(long long long) -@ stdcall FreeVirtualBuffer(ptr) ; missing in Win 7 @ stdcall GenerateConsoleCtrlEvent(long long) @ stdcall GetACP() -;@ stdcall GetActiveProcessorCount ; Win 7 -;@ stdcall GetActiveProcessorGroupCount ; Win 7 -;@ stdcall GetApplicationRecoveryCallback ; Win 7 -;@ stdcall GetApplicationRestartSettings ; Win 7 @ stdcall GetAtomNameA(long ptr long) @ stdcall GetAtomNameW(long ptr long) @ stdcall GetBinaryType(str ptr) GetBinaryTypeA @@ -390,16 +262,8 @@ @ stdcall GetCPInfo(long ptr) @ stdcall GetCPInfoExA(long long ptr) @ stdcall GetCPInfoExW(long long ptr) -;@ stdcall GetCalendarDateFormat ; Win 7 -;@ stdcall GetCalendarDateFormatEx ; Win 7 -;@ stdcall GetCalendarDaysInMonth ; Win 7 -;@ stdcall GetCalendarDifferenceInDays ; Win 7 @ stdcall GetCalendarInfoA(long long long ptr long ptr) -;@ stdcall GetCalendarInfoEx ; Win 7 @ stdcall GetCalendarInfoW(long long long ptr long ptr) -;@ stdcall GetCalendarMonthsInYear ; Win 7 -;@ stdcall GetCalendarSupportedDateRange ; Win 7 -;@ stdcall GetCalendarWeekNumber ; Win 7 @ stdcall GetComPlusPackageInstallStatus() @ stdcall GetCommConfig(long ptr long) @ stdcall GetCommMask(long ptr) @@ -410,8 +274,6 @@ @ stdcall GetCommandLineA() @ stdcall GetCommandLineW() @ stdcall GetCompressedFileSizeA(long ptr) -;@ stdcall GetCompressedFileSizeTransactedA ; Win 7 -;@ stdcall GetCompressedFileSizeTransactedW ; Win 7 @ stdcall GetCompressedFileSizeW(long ptr) @ stdcall GetComputerNameA(ptr ptr) @ stdcall GetComputerNameExA(long ptr ptr) @@ -439,7 +301,6 @@ @ stdcall GetConsoleFontInfo(long long long ptr) @ stdcall GetConsoleFontSize(long long) @ stdcall GetConsoleHardwareState(long long ptr) -@ stdcall GetConsoleHistoryInfo(ptr) @ stdcall GetConsoleInputExeNameA(long ptr) @ stdcall GetConsoleInputExeNameW(long ptr) @ stdcall GetConsoleInputWaitHandle() @@ -447,35 +308,26 @@ @ stdcall GetConsoleKeyboardLayoutNameW(ptr) @ stdcall GetConsoleMode(long ptr) @ stdcall GetConsoleNlsMode(long ptr) -;@ stdcall GetConsoleOriginalTitleA ; Win 7 -;@ stdcall GetConsoleOriginalTitleW ; Win 7 @ stdcall GetConsoleOutputCP() @ stdcall GetConsoleProcessList(ptr long) ; missing in XP SP3 @ stdcall GetConsoleScreenBufferInfo(long ptr) -;@ stdcall GetConsoleScreenBufferInfoEx ; Win 7 @ stdcall GetConsoleSelectionInfo(ptr) @ stdcall GetConsoleTitleA(ptr long) @ stdcall GetConsoleTitleW(ptr long) @ stdcall GetConsoleWindow() @ stdcall GetCurrencyFormatA(long long str ptr str long) -;@ stdcall GetCurrencyFormatEx ; Win 7 @ stdcall GetCurrencyFormatW(long long str ptr str long) @ stdcall GetCurrentActCtx(ptr) @ stdcall GetCurrentConsoleFont(long long ptr) -;@ stdcall GetCurrentConsoleFontEx ; Win 7 @ stdcall GetCurrentDirectoryA(long ptr) @ stdcall GetCurrentDirectoryW(long ptr) @ stdcall GetCurrentProcess() @ stdcall GetCurrentProcessId() @ stdcall GetCurrentProcessorNumber() ntdll.RtlGetCurrentProcessorNumber -;@ stdcall GetCurrentProcessorNumberEx ntdll.RtlGetCurrentProcessorNumberEx ; Win 7 @ stdcall GetCurrentThread() @ stdcall GetCurrentThreadId() -;@ stdcall GetCurrentUmsThread @ stdcall GetDateFormatA(long long ptr str ptr long) -;@ stdcall GetDateFormatEx ; Win 7 @ stdcall GetDateFormatW(long long ptr wstr ptr long) -;@ stub GetDaylightFlag ; missing in XP SP3 and Win 7 @ stdcall GetDefaultCommConfigA(str ptr long) @ stdcall GetDefaultCommConfigW(wstr ptr long) @ stdcall GetDefaultSortkeySize(ptr) ; missing in Win 7 @@ -488,116 +340,70 @@ @ stdcall GetDllDirectoryW(long ptr) @ stdcall GetDriveTypeA(str) @ stdcall GetDriveTypeW(wstr) -;@ stdcall GetDurationFormat ; Win 7 -;@ stdcall GetDurationFormatEx ; Win 7 -;@ stdcall GetDynamicTimeZoneInformation ; Win 7 -;@ stdcall GetEnabledExtendedFeatures api-ms-win-core-xstate-l1-1-0.RtlGetEnabledExtendedFeatures ; Win 7 @ stdcall GetEnvironmentStrings() @ stdcall GetEnvironmentStringsA() GetEnvironmentStrings @ stdcall GetEnvironmentStringsW() @ stdcall GetEnvironmentVariableA(str ptr long) @ stdcall GetEnvironmentVariableW(wstr ptr long) -;@ stdcall GetEraNameCountedString ; Win 7 -@ stdcall GetErrorMode() @ stdcall GetExitCodeProcess(long ptr) @ stdcall GetExitCodeThread(long ptr) @ stdcall GetExpandedNameA(str ptr) @ stdcall GetExpandedNameW(wstr ptr) -;@ stdcall GetExtendedContextLength ; Win 7 -;@ stdcall GetExtendedFeaturesMask api-ms-win-core-xstate-l1-1-0.RtlGetExtendedFeaturesMask ; Win 7 @ stdcall GetFileAttributesA(str) -@ stdcall GetFileAttributesByHandle(long ptr long) ; missing in Win 7 @ stdcall GetFileAttributesExA(str long ptr) @ stdcall GetFileAttributesExW(wstr long ptr) -;@ stdcall GetFileAttributesTransactedA ; Win 7 -;@ stdcall GetFileAttributesTransactedW ; Win 7 @ stdcall GetFileAttributesW(wstr) -@ stdcall GetFileBandwidthReservation(long ptr ptr ptr ptr ptr) @ stdcall GetFileInformationByHandle(long ptr) -;@ stdcall GetFileInformationByHandleEx ; Win 7 -;@ stdcall GetFileMUIInfo ; Win 7 -;@ stdcall GetFileMUIPath ; Win 7 @ stdcall GetFileSize(long ptr) @ stdcall GetFileSizeEx(long ptr) @ stdcall GetFileTime(long ptr ptr ptr) @ stdcall GetFileType(long) -@ stdcall GetFinalPathNameByHandleA(long str long long) -@ stdcall GetFinalPathNameByHandleW(long wstr long long) @ stdcall GetFirmwareEnvironmentVariableA(str str ptr long) @ stdcall GetFirmwareEnvironmentVariableW(wstr wstr ptr long) @ stdcall GetFullPathNameA(str long ptr ptr) -;@ stdcall GetFullPathNameTransactedA ; Win 7 -;@ stdcall GetFullPathNameTransactedW ; Win 7 @ stdcall GetFullPathNameW(wstr long ptr ptr) @ stdcall GetGeoInfoA(long long ptr long long) @ stdcall GetGeoInfoW(long long ptr long long) @ stdcall GetHandleContext(long) ; missing on x64 @ stdcall GetHandleInformation(long ptr) -;@ stub GetSCallbackTarget ; missing in XP SP3 and Win 7 -;@ stub GetSCallbackTemplate ; missing in XP SP3 and Win 7 @ stdcall GetLargePageMinimum() @ stdcall GetLargestConsoleWindowSize(long) @ stdcall GetLastError() ntdll.RtlGetLastWin32Error @ stdcall GetLinguistLangSize(ptr) ; missing in Win 7 @ stdcall GetLocalTime(ptr) @ stdcall GetLocaleInfoA(long long ptr long) -@ stdcall GetLocaleInfoEx(wstr long wstr long) ; Vista+ @ stdcall GetLocaleInfoW(long long ptr long) @ stdcall GetLogicalDriveStringsA(long ptr) @ stdcall GetLogicalDriveStringsW(long ptr) @ stdcall GetLogicalDrives() @ stdcall GetLogicalProcessorInformation(ptr ptr) -;@ stdcall GetLogicalProcessorInformationEx api-ms-win-core-sysinfo-l1-1-0.GetLogicalProcessorInformationEx ; Win 7 @ stdcall GetLongPathNameA (str long long) -;@ stdcall GetLongPathNameTransactedA ; Win 7 -;@ stdcall GetLongPathNameTransactedW ; Win 7 @ stdcall GetLongPathNameW (wstr long long) @ stdcall GetMailslotInfo(long ptr ptr ptr ptr) -;@ stdcall GetMaximumProcessorCount ; Win 7 -;@ stdcall GetMaximumProcessorGroupCount ; Win 7 @ stdcall GetModuleFileNameA(long ptr long) @ stdcall GetModuleFileNameW(long ptr long) @ stdcall GetModuleHandleA(str) @ stdcall GetModuleHandleExA(long ptr ptr) @ stdcall GetModuleHandleExW(long ptr ptr) @ stdcall GetModuleHandleW(wstr) -;@ stdcall GetNLSVersion ; Win 7 -;@ stdcall GetNLSVersionEx ; Win 7 -;@ stdcall GetNamedPipeAttribute ; Win 7 -;@ stdcall GetNamedPipeClientComputerNameA ; Win 7 -;@ stdcall GetNamedPipeClientComputerNameW ; Win 7 -;@ stdcall GetNamedPipeClientProcessId ; Win 7 -;@ stdcall GetNamedPipeClientSessionId ; Win 7 +@ stdcall GetNLSVersion(long long ptr) @ stdcall GetNamedPipeHandleStateA(long ptr ptr ptr ptr str long) @ stdcall GetNamedPipeHandleStateW(long ptr ptr ptr ptr wstr long) @ stdcall GetNamedPipeInfo(long ptr ptr ptr ptr) -;@ stdcall GetNamedPipeServerProcessId ; Win 7 -;@ stdcall GetNamedPipeServerSessionId ; Win 7 @ stdcall GetNativeSystemInfo(ptr) -;@ stdcall -arch=x86_64 GetNextUmsListItem @ stdcall GetNextVDMCommand(long) @ stdcall GetNlsSectionName(long long long str str long) ; missing in Win 7 -@ stdcall GetNumaAvailableMemory(ptr long ptr) ; missing in Win 7 @ stdcall GetNumaAvailableMemoryNode(long ptr) -;@ stdcall GetNumaAvailableMemoryNodeEx ; Win 7 @ stdcall GetNumaHighestNodeNumber(ptr) -;@ stdcall GetNumaNodeNumberFromHandle ; Win 7 @ stdcall GetNumaNodeProcessorMask(long ptr) -;@ stdcall GetNumaNodeProcessorMaskEx ; Win 7 -@ stdcall GetNumaProcessorMap(ptr long ptr) ; missing in Win 7 @ stdcall GetNumaProcessorNode(long ptr) -;@ stdcall GetNumaProcessorNodeEx ; Win 7 -;@ stdcall GetNumaProximityNode ; Win 7 -;@ stdcall GetNumaProximityNodeEx ; Win 7 @ stdcall GetNumberFormatA(long long str ptr ptr long) -;@ stdcall GetNumberFormatEx ; Win 7 @ stdcall GetNumberFormatW(long long wstr ptr ptr long) @ stdcall GetNumberOfConsoleFonts() @ stdcall GetNumberOfConsoleInputEvents(long ptr) @ stdcall GetNumberOfConsoleMouseButtons(ptr) @ stdcall GetOEMCP() @ stdcall GetOverlappedResult(long ptr ptr long) -;@ stdcall GetPhysicallyInstalledSystemMemory ; Win 7 @ stdcall GetPriorityClass(long) @ stdcall GetPrivateProfileIntA(str str long str) @ stdcall GetPrivateProfileIntW(wstr wstr long wstr) @@ -611,25 +417,18 @@ @ stdcall GetPrivateProfileStructW(wstr wstr ptr long wstr) @ stdcall GetProcAddress(long str) @ stdcall GetProcessAffinityMask(long ptr ptr) -;@ stdcall GetProcessFlags(long) -;@ stdcall GetProcessDEPPolicy ; Win 7 -;@ stdcall GetProcessGroupAffinity ; Win 7 @ stdcall GetProcessHandleCount(long ptr) @ stdcall GetProcessHeap() @ stdcall GetProcessHeaps(long ptr) @ stdcall GetProcessId(long) -;@ stdcall GetProcessIdOfThread ; Win 7 +@ stdcall GetProcessIdOfThread(ptr) @ stdcall GetProcessIoCounters(long ptr) -;@ stdcall GetProcessPreferredUILanguages ; Win 7 @ stdcall GetProcessPriorityBoost(long ptr) @ stdcall GetProcessShutdownParameters(ptr ptr) @ stdcall GetProcessTimes(long ptr ptr ptr ptr) @ stdcall GetProcessVersion(long) @ stdcall GetProcessWorkingSetSize(long ptr ptr) -;@ stdcall GetProcessWorkingSetSizeEx ; Win 7 -;@ stdcall GetProcessorSystemCycleTime ; Win 7 -;@ stdcall GetProductInfo(long long long long ptr) ; Win 7 -;@ stub GetProductName +@ stdcall GetProcessWorkingSetSizeEx(long ptr ptr long) @ stdcall GetProfileIntA(str str long) @ stdcall GetProfileIntW(wstr wstr long) @ stdcall GetProfileSectionA(str ptr long) @@ -637,31 +436,24 @@ @ stdcall GetProfileStringA(str str str ptr long) @ stdcall GetProfileStringW(wstr wstr wstr ptr long) @ stdcall GetQueuedCompletionStatus(long ptr ptr ptr long) -;@ stdcall GetQueuedCompletionStatusEx ; Win 7 -;@ stub GetLSCallbackTarget ; missing in XP SP3 and Win 7 -;@ stub GetLSCallbackTemplate ; missing in XP SP3 and Win 7 @ stdcall GetShortPathNameA(str ptr long) @ stdcall GetShortPathNameW(wstr ptr long) @ stdcall GetStartupInfoA(ptr) @ stdcall GetStartupInfoW(ptr) @ stdcall GetStdHandle(long) -;@ stdcall GetStringScripts ; Win 7 @ stdcall GetStringTypeA(long long str long ptr) @ stdcall GetStringTypeExA(long long str long ptr) @ stdcall GetStringTypeExW(long long wstr long ptr) @ stdcall GetStringTypeW(long wstr long ptr) -;@ stdcall GetSystemDEPPolicy ; Win 7 @ stdcall GetSystemDefaultLCID() @ stdcall GetSystemDefaultLangID() -;@ stdcall GetSystemDefaultLocaleName ; Win 7 @ stdcall GetSystemDefaultUILanguage() @ stdcall GetSystemDirectoryA(ptr long) @ stdcall GetSystemDirectoryW(ptr long) -;@ stdcall GetSystemFileCacheSize ; Win 7 -;@ stdcall GetSystemFirmwareTable ; Win 7 +@ stdcall GetSystemFileCacheSize(ptr ptr ptr) +@ stdcall GetSystemFirmwareTable(long long ptr long) @ stdcall GetSystemInfo(ptr) @ stdcall GetSystemPowerStatus(ptr) -;@ stdcall GetSystemPreferredUILanguages ; Win 7 @ stdcall GetSystemRegistryQuota(ptr ptr) @ stdcall GetSystemTime(ptr) @ stdcall GetSystemTimeAdjustment(ptr ptr ptr) @@ -679,39 +471,26 @@ @ stdcall GetTempPathA(long ptr) @ stdcall GetTempPathW(long ptr) @ stdcall GetThreadContext(long ptr) -;@ stdcall GetThreadErrorMode() ; Win 7 -;@ stdcall GetThreadGroupAffinity ; Win 7 @ stdcall GetThreadIOPendingFlag(long ptr) @ stdcall GetThreadId(ptr) -;@ stdcall GetThreadIdealProcessorEx ; Win 7 @ stdcall GetThreadLocale() -;@ stdcall GetThreadPreferredUILanguages ; Win 7 @ stdcall GetThreadPriority(long) @ stdcall GetThreadPriorityBoost(long ptr) @ stdcall GetThreadSelectorEntry(long long ptr) @ stdcall GetThreadTimes(long ptr ptr ptr ptr) -;@ stdcall GetThreadUILanguage ; Win 7 @ stdcall GetTickCount() -@ stdcall -ret64 GetTickCount64() @ stdcall GetTimeFormatA(long long ptr str ptr long) -;@ stdcall GetTimeFormatEx ; Win 7 @ stdcall GetTimeFormatW(long long ptr wstr ptr long) @ stdcall GetTimeZoneInformation(ptr) -;@ stdcall GetTimeZoneInformationForYear ; Win 7 -;@ stdcall GetUILanguageInfo ; Win 7 -;@ stdcall -arch=x86_64 GetUmsCompletionListEvent @ stdcall GetUserDefaultLCID() @ stdcall GetUserDefaultLangID() -;@ stdcall GetUserDefaultLocaleName ; Win 7 @ stdcall GetUserDefaultUILanguage() @ stdcall GetUserGeoID(long) -;@ stdcall GetUserPreferredUILanguages ; Win 7 @ stdcall GetVDMCurrentDirectories(long long) @ stdcall GetVersion() @ stdcall GetVersionExA(ptr) @ stdcall GetVersionExW(ptr) @ stdcall GetVolumeInformationA(str ptr long ptr ptr ptr ptr long) -;@ stdcall GetVolumeInformationByHandleW ; Win 7 @ stdcall GetVolumeInformationW(wstr ptr long ptr ptr ptr ptr long) @ stdcall GetVolumeNameForVolumeMountPointA(str ptr long) @ stdcall GetVolumeNameForVolumeMountPointW(wstr ptr long) @@ -759,7 +538,6 @@ @ stdcall HeapQueryInformation(long long ptr long ptr) @ stdcall HeapQueryTagW(long long long long ptr) ; missing in Win 7 @ stdcall HeapReAlloc(long long ptr long) ntdll.RtlReAllocateHeap -;@ stub HeapSetFlags ; missing in XP SP3 and Win 7 @ stdcall HeapSetInformation(ptr long ptr long) @ stdcall HeapSize(long long ptr) ntdll.RtlSizeHeap @ stdcall HeapSummary(long long ptr) @@ -767,34 +545,20 @@ @ stdcall HeapUsage(long long long long ptr) ; missing in Win 7 @ stdcall HeapValidate(long long ptr) @ stdcall HeapWalk(long ptr) -;@ stdcall IdnToAscii ; Win 7 -;@ stdcall IdnToNameprepUnicode ; Win 7 -;@ stdcall IdnToUnicode ; Win 7 @ stdcall InitAtomTable(long) -;@ stdcall InitOnceBeginInitialize ; Win 7 -;@ stdcall InitOnceComplete ; Win 7 -;@ stdcall InitOnceExecuteOnce ; Win 7 -;@ stdcall InitOnceInitialize ntdll.RtlRunOnceInitialize ; Win 7 -;@ stdcall InitializeConditionVariable ntdll.RtlInitializeConditionVariable ; Win 7 -@ stdcall InitializeCriticalSection(ptr) ; FIXME: ntdll.RtlInitializeCriticalSection +@ stdcall InitializeCriticalSection(ptr) @ stdcall InitializeCriticalSectionAndSpinCount(ptr long) -@ stdcall InitializeCriticalSectionEx(ptr long long) -;@ stdcall InitializeExtendedContext ; Win 7 -;@ stdcall InitializeProcThreadAttributeList api-ms-win-core-processthreads-l1-1-0.InitializeProcThreadAttributeList ; Win 7 @ stdcall InitializeSListHead(ptr) ntdll.RtlInitializeSListHead -@ stdcall InitializeSRWLock(ptr) ntdll.RtlInitializeSRWLock +@ stdcall -arch=i386 -ret64 InterlockedCompareExchange64(ptr double double) ntdll.RtlInterlockedCompareExchange64 @ stdcall -arch=i386 InterlockedCompareExchange (ptr long long) -;@ stdcall -arch=i386 -ret64 InterlockedCompareExchange64(ptr double double) ntdll.RtlInterlockedCompareExchange64 @ stdcall -arch=i386 InterlockedDecrement(ptr) @ stdcall -arch=i386 InterlockedExchange(ptr long) -@ stdcall -arch=i386 InterlockedExchangeAdd (ptr long ) +@ stdcall -arch=i386 InterlockedExchangeAdd(ptr long) @ stdcall InterlockedFlushSList(ptr) ntdll.RtlInterlockedFlushSList @ stdcall -arch=i386 InterlockedIncrement(ptr) @ stdcall InterlockedPopEntrySList(ptr) ntdll.RtlInterlockedPopEntrySList @ stdcall InterlockedPushEntrySList(ptr ptr) ntdll.RtlInterlockedPushEntrySList -;@ stdcall InterlockedPushListSList ntdll.RtlInterlockedPushListSList ; Win 7 @ stdcall InvalidateConsoleDIBits(long long) -;@ stub InvalidateNSCache ; missing in XP SP3 and Win 7 @ stdcall IsBadCodePtr(ptr) @ stdcall IsBadHugeReadPtr(ptr long) @ stdcall IsBadHugeWritePtr(ptr long) @@ -802,63 +566,25 @@ @ stdcall IsBadStringPtrA(ptr long) @ stdcall IsBadStringPtrW(ptr long) @ stdcall IsBadWritePtr(ptr long) -;@ stdcall IsCalendarLeapDay ; Win 7 -;@ stdcall IsCalendarLeapMonth ; Win 7 -;@ stdcall IsCalendarLeapYear ; Win 7 @ stdcall IsDBCSLeadByte(long) @ stdcall IsDBCSLeadByteEx(long long) @ stdcall IsDebuggerPresent() -;@ stdcall IsNLSDefinedString ; Win 7 -;@ stdcall IsNormalizedString ; Win 7 +@ stdcall IsNLSDefinedString(long long ptr long long) @ stdcall IsProcessInJob(long long ptr) @ stdcall IsProcessorFeaturePresent(long) @ stdcall IsSystemResumeAutomatic() -@ stdcall IsThreadAFiber() -;@ stdcall IsThreadAFiber ; Win 7 -;@ stdcall IsThreadpoolTimerSet ntdll.TpIsTimerSet ; Win 7 -;@ stdcall IsTimeZoneRedirectionEnabled ; Win 7 -;@ stdcall IsValidCalDateTime ; Win 7 +@ stdcall IsTimeZoneRedirectionEnabled() @ stdcall IsValidCodePage(long) @ stdcall IsValidLanguageGroup(long long) @ stdcall IsValidLocale(long long) -;@ stdcall IsValidLocaleName ; Win 7 @ stdcall IsValidUILanguage(long) ; missing in Win 7 @ stdcall IsWow64Process(ptr ptr) -;@ stdcall K32EmptyWorkingSet ; Win 7 -;@ stdcall K32EnumDeviceDrivers ; Win 7 -;@ stdcall K32EnumPageFilesA ; Win 7 -;@ stdcall K32EnumPageFilesW ; Win 7 -;@ stdcall K32EnumProcessModules ; Win 7 -;@ stdcall K32EnumProcessModulesEx ; Win 7 -;@ stdcall K32EnumProcesses ; Win 7 -;@ stdcall K32GetDeviceDriverBaseNameA ; Win 7 -;@ stdcall K32GetDeviceDriverBaseNameW ; Win 7 -;@ stdcall K32GetDeviceDriverFileNameA ; Win 7 -;@ stdcall K32GetDeviceDriverFileNameW ; Win 7 -;@ stdcall K32GetMappedFileNameA ; Win 7 -;@ stdcall K32GetMappedFileNameW ; Win 7 -;@ stdcall K32GetModuleBaseNameA ; Win 7 -;@ stdcall K32GetModuleBaseNameW ; Win 7 -;@ stdcall K32GetModuleFileNameExA ; Win 7 -;@ stdcall K32GetModuleFileNameExW ; Win 7 -;@ stdcall K32GetModuleInformation ; Win 7 -;@ stdcall K32GetPerformanceInfo ; Win 7 -;@ stdcall K32GetProcessImageFileNameA ; Win 7 -;@ stdcall K32GetProcessImageFileNameW ; Win 7 -;@ stdcall K32GetProcessMemoryInfo ; Win 7 -;@ stdcall K32GetWsChanges ; Win 7 -;@ stdcall K32GetWsChangesEx ; Win 7 -;@ stdcall K32InitializeProcessForWsWatch ; Win 7 -;@ stdcall K32QueryWorkingSet ; Win 7 -;@ stdcall K32QueryWorkingSetEx ; Win 7 -@ stdcall LCIDToLocaleName(long wstr long long) ; needed for wine gecko; missing in XP SP3 @ stdcall LCMapStringA(long long str long ptr long) -;@ stdcall LCMapStringEx ; Win 7 @ stdcall LCMapStringW(long long wstr long ptr long) @ stdcall LZClose(long) -;@ stdcall LZCloseFile ; Win 7 +@ stdcall LZCloseFile(long) @ stdcall LZCopy(long long) -;@ stdcall LZCreateFileW ; Win 7 +@ stdcall LZCreateFileW(ptr long long long ptr) @ stdcall LZDone() @ stdcall LZInit(long) @ stdcall LZOpenFileA(str ptr long) @@ -867,16 +593,12 @@ @ stdcall LZSeek(long long long) @ stdcall LZStart() @ stdcall LeaveCriticalSection(ptr) ntdll.RtlLeaveCriticalSection -;@ stdcall LeaveCriticalSectionWhenCallbackReturns ntdll.TpCallbackLeaveCriticalSectionOnCompletion ; Win 7 -;@ stdcall LoadAppInitDlls ; Win 7 @ stdcall LoadLibraryA(str) @ stdcall LoadLibraryExA( str long long) @ stdcall LoadLibraryExW(wstr long long) @ stdcall LoadLibraryW(wstr) @ stdcall LoadModule(str ptr) @ stdcall LoadResource(long long) -;@ stdcall LoadStringBaseExW ; Win 7 -;@ stdcall LoadStringBaseW ; Win 7 @ stdcall LocalAlloc(long long) @ stdcall LocalCompact(long) @ stdcall LocalFileTimeToFileTime(ptr ptr) @@ -888,18 +610,13 @@ @ stdcall LocalShrink(long long) @ stdcall LocalSize(long) @ stdcall LocalUnlock(long) -;@ stub LocaleNameToLCID ; missing in XP SP3 -;@ stdcall LocateExtendedFeature api-ms-win-core-xstate-l1-1-0.RtlLocateExtendedFeature ; Win 7 -;@ stdcall LocateLegacyContext api-ms-win-core-xstate-l1-1-0.RtlLocateLegacyContext ; Win 7 @ stdcall LockFile(long long long long long) @ stdcall LockFileEx(long long long long long ptr) @ stdcall LockResource(long) -;@ stdcall MakeCriticalSectionGlobal(ptr) // ??? @ stdcall MapUserPhysicalPages(ptr long ptr) @ stdcall MapUserPhysicalPagesScatter(ptr long ptr) @ stdcall MapViewOfFile(long long long long long) @ stdcall MapViewOfFileEx(long long long long long ptr) -;@ stdcall MapViewOfFileExNuma ; Win 7 @ stdcall Module32First(long ptr) @ stdcall Module32FirstW(long ptr) @ stdcall Module32Next(long ptr) @@ -907,8 +624,6 @@ @ stdcall MoveFileA(str str) @ stdcall MoveFileExA(str str long) @ stdcall MoveFileExW(wstr wstr long) -;@ stdcall MoveFileTransactedA ; Win 7 -;@ stdcall MoveFileTransactedW ; Win 7 @ stdcall MoveFileW(wstr wstr) @ stdcall MoveFileWithProgressA(str str ptr ptr long) @ stdcall MoveFileWithProgressW(wstr wstr ptr ptr long) @@ -916,40 +631,25 @@ @ stdcall MultiByteToWideChar(long long str long ptr long) @ stdcall NeedCurrentDirectoryForExePathA(str) @ stdcall NeedCurrentDirectoryForExePathW(wstr) -;@ stdcall NlsCheckPolicy ; Win 7 @ stdcall NlsConvertIntegerToString(long long long wstr long) ; missing in Win 7 -;@ stdcall NlsEventDataDescCreate ; Win 7 @ stdcall NlsGetCacheUpdateCount() -;@ stub NlsResetProcessLocale ; missing in XP SP3 and Win 7 -;@ stdcall NlsUpdateLocale ; Win 7 -;@ stdcall NlsUpdateSystemLocale ; Win 7 -;@ stdcall NlsWriteEtwEvent ; Win 7 -;@ stdcall NormalizeString ; Win 7 -;@ stdcall NotifyMountMgr ; Win 7 -;@ stub NotifyNLSUserCache ; missing in XP SP3 and win 7 -;@ stdcall NotifyUILanguageChange ; Win 7 -@ stdcall NumaVirtualQueryNode(long long long long) ; missing in win 7 +@ stdcall NlsResetProcessLocale() @ stdcall OpenConsoleW(wstr long long long) @ stdcall OpenDataFile(long long) ; missing in Win 7 @ stdcall OpenEventA(long long str) @ stdcall OpenEventW(long long wstr) @ stdcall OpenFile(str ptr long) -;@ stdcall OpenFileById ; Win 7 @ stdcall OpenFileMappingA(long long str) @ stdcall OpenFileMappingW(long long wstr) @ stdcall OpenJobObjectA(long long str) @ stdcall OpenJobObjectW(long long wstr) @ stdcall OpenMutexA(long long str) @ stdcall OpenMutexW(long long wstr) -;@ stdcall OpenPrivateNamespaceA ; Win 7 -;@ stdcall OpenPrivateNamespaceW ; Win 7 @ stdcall OpenProcess(long long long) -;@ stdcall OpenProcessToken api-ms-win-core-processthreads-l1-1-0.OpenProcessToken ; Win 7 @ stdcall OpenProfileUserMapping() @ stdcall OpenSemaphoreA(long long str) @ stdcall OpenSemaphoreW(long long wstr) @ stdcall OpenThread(long long long) -;@ stdcall OpenThreadToken api-ms-win-core-processthreads-l1-1-0.OpenThreadToken ; win 7 @ stdcall OpenWaitableTimerA(long long str) @ stdcall OpenWaitableTimerW(long long wstr) @ stdcall OutputDebugStringA(str) @@ -958,9 +658,6 @@ @ stdcall PeekConsoleInputW(ptr ptr long ptr) @ stdcall PeekNamedPipe(long ptr long ptr ptr ptr) @ stdcall PostQueuedCompletionStatus(long long ptr ptr) -;@ stdcall PowerClearRequest ; Win 7 -;@ stdcall PowerCreateRequest ; Win 7 -;@ stdcall PowerSetRequest ; Win 7 @ stdcall PrepareTape(ptr long long) @ stdcall PrivCopyFileExW(wstr wstr ptr ptr long long) @ stdcall PrivMoveFileIdentityW(long long long) @@ -971,34 +668,17 @@ @ stdcall ProcessIdToSessionId(long ptr) @ stdcall PulseEvent(long) @ stdcall PurgeComm(long long) -;@ stdcall QueryActCtxSettingsW ; Win 7 -;@ stdcall QueryActCtxW(long ptr ptr long ptr long ptr) @ stdcall QueryActCtxW(long ptr ptr long ptr long ptr) @ stdcall QueryDepthSList(ptr) ntdll.RtlQueryDepthSList @ stdcall QueryDosDeviceA(str ptr long) @ stdcall QueryDosDeviceW(wstr ptr long) -@ stdcall QueryFullProcessImageNameA(ptr long str ptr) ; Vista and later -@ stdcall QueryFullProcessImageNameW(ptr long wstr ptr) ; Vista and later -;@ stdcall QueryIdleProcessorCycleTime ; Win 7 -;@ stdcall QueryIdleProcessorCycleTimeEx ; Win 7 @ stdcall QueryInformationJobObject(long long ptr long ptr) @ stdcall QueryMemoryResourceNotification(ptr ptr) -;@ stub QueryNumberOfEventLogRecords ; missing in XP SP3 and Win 7 -;@ stub QueryOldestEventLogRecord ; missing in XP SP3 and Win 7 @ stdcall QueryPerformanceCounter(ptr) @ stdcall QueryPerformanceFrequency(ptr) -;@ stdcall QueryProcessAffinityUpdateMode ; Win 7 -;@ stdcall QueryProcessCycleTime ; Win 7 -;@ stdcall QueryThreadCycleTime ; Win 7 -;@ stdcall QueryThreadProfiling ; Win 7 -;@ stdcall QueryThreadpoolStackInformation ; Win 7 -;@ stdcall -arch=x86_64 QueryUmsThreadInformation -;@ stdcall QueryUnbiasedInterruptTime ; Win 7 -@ stdcall QueryWin31IniFilesMappedToRegistry(long long long long) ; missing in Win 7 @ stdcall QueueUserAPC(ptr long long) @ stdcall QueueUserWorkItem(ptr ptr long) @ stdcall RaiseException(long long long ptr) -;@ stdcall RaiseFailFastException ; Win 7 @ stdcall ReOpenFile(ptr long long long) @ stdcall ReadConsoleA(long ptr long ptr ptr) @ stdcall ReadConsoleInputA(long ptr long ptr) @@ -1016,105 +696,37 @@ @ stdcall ReadFileEx(long ptr long ptr ptr) @ stdcall ReadFileScatter(long ptr long ptr ptr) @ stdcall ReadProcessMemory(long ptr ptr long ptr) -;@ stdcall ReadThreadProfilingData ; Win 7 -;@ stdcall RegCloseKey ; Win 7 -;@ stdcall RegCreateKeyExA ; Win 7 -;@ stdcall RegCreateKeyExW ; Win 7 -;@ stdcall RegDeleteKeyExA ; Win 7 -;@ stdcall RegDeleteKeyExW ; Win 7 -;@ stdcall RegDeleteTreeA ; Win 7 -;@ stdcall RegDeleteTreeW ; Win 7 -;@ stdcall RegDeleteValueA ; Win 7 -;@ stdcall RegDeleteValueW ; Win 7 -;@ stdcall RegDisablePredefinedCacheEx ; Win 7 -;@ stdcall RegEnumKeyExA ; Win 7 -;@ stdcall RegEnumKeyExW ; Win 7 -;@ stdcall RegEnumValueA ; Win 7 -;@ stdcall RegEnumValueW ; Win 7 -;@ stdcall RegFlushKey ; Win 7 -;@ stdcall RegGetKeySecurity ; Win 7 -;@ stdcall RegGetValueA ; Win 7 -;@ stdcall RegGetValueW ; Win 7 -;@ stdcall RegKrnGetGlobalState ; Win 7 -;@ stdcall RegKrnInitialize ; Win 7 -;@ stdcall RegLoadKeyA ; Win 7 -;@ stdcall RegLoadKeyW ; Win 7 -;@ stdcall RegLoadMUIStringA ; Win 7 -;@ stdcall RegLoadMUIStringW ; Win 7 -;@ stdcall RegNotifyChangeKeyValue ; Win 7 -;@ stdcall RegOpenCurrentUser ; Win 7 -;@ stdcall RegOpenKeyExA ; Win 7 -;@ stdcall RegOpenKeyExW ; Win 7 -;@ stdcall RegOpenUserClassesRoot ; Win 7 -;@ stdcall RegQueryInfoKeyA ; Win 7 -;@ stdcall RegQueryInfoKeyW ; Win 7 -;@ stdcall RegQueryValueExA ; Win 7 -;@ stdcall RegQueryValueExW ; Win 7 -;@ stdcall RegRestoreKeyA ; Win 7 -;@ stdcall RegRestoreKeyW ; Win 7 -;@ stdcall RegSaveKeyExA ; Win 7 -;@ stdcall RegSaveKeyExW ; Win 7 -;@ stdcall RegSetKeySecurity ; Win 7 -;@ stdcall RegSetValueExA ; Win 7 -;@ stdcall RegSetValueExW ; Win 7 -;@ stdcall RegUnLoadKeyA ; Win 7 -;@ stdcall RegUnLoadKeyW ; Win 7 -;@ stdcall RegisterApplicationRecoveryCallback ; Win 7 -@ stdcall RegisterApplicationRestart(wstr long) @ stdcall RegisterConsoleIME(ptr ptr) @ stdcall RegisterConsoleOS2(long) @ stdcall RegisterConsoleVDM(long long long long long long long long long long long) -;@ stub RegisterServiceProcess ; missing in XP SP3 and Win 7 -;@ stub RegisterSysMsgHandler ; missing in XP SP3 and win 7 @ stdcall RegisterWaitForInputIdle(ptr) @ stdcall RegisterWaitForSingleObject(ptr long ptr ptr long long) @ stdcall RegisterWaitForSingleObjectEx(long ptr ptr long long) @ stdcall RegisterWowBaseHandlers(long) @ stdcall RegisterWowExec(long) -;@ stdcall ReinitializeCriticalSection(ptr) ; ??? @ stdcall ReleaseActCtx(ptr) @ stdcall ReleaseMutex(long) -;@ stdcall ReleaseMutexWhenCallbackReturns ntdll.TpCallbackReleaseMutexOnCompletion ; Win 7 -@ stdcall ReleaseSRWLockExclusive(ptr) ntdll.RtlReleaseSRWLockExclusive -@ stdcall ReleaseSRWLockShared(ptr) ntdll.RtlReleaseSRWLockShared @ stdcall ReleaseSemaphore(long long ptr) -;@ stdcall ReleaseSemaphoreWhenCallbackReturns ntdll.TpCallbackReleaseSemaphoreOnCompletion ; Win 7 @ stdcall RemoveDirectoryA(str) -;@ stdcall RemoveDirectoryTransactedA ; Win 7 -;@ stdcall RemoveDirectoryTransactedW ; Win 7 @ stdcall RemoveDirectoryW(wstr) @ stdcall RemoveLocalAlternateComputerNameA(str long) @ stdcall RemoveLocalAlternateComputerNameW(wstr long) -;@ stdcall RemoveSecureMemoryCacheCallback ; Win 7 @ stdcall RemoveVectoredContinueHandler(ptr) ntdll.RtlRemoveVectoredContinueHandler @ stdcall RemoveVectoredExceptionHandler(ptr) ntdll.RtlRemoveVectoredExceptionHandler @ stdcall ReplaceFile(wstr wstr wstr long ptr ptr) ReplaceFileW @ stdcall ReplaceFileA(str str str long ptr ptr) @ stdcall ReplaceFileW(wstr wstr wstr long ptr ptr) -;@ stdcall ReplacePartitionUnit ; Win 7 @ stdcall RequestDeviceWakeup(long) @ stdcall RequestWakeupLatency(long) @ stdcall ResetEvent(long) @ stdcall ResetWriteWatch(ptr long) -;@ stdcall ResolveLocaleName ; Win 7 @ stdcall RestoreLastError(long) ntdll.RtlRestoreLastWin32Error @ stdcall ResumeThread(long) -@ cdecl -arch=x86_64 RtlAddFunctionTable(ptr long long) ntdll.RtlAddFunctionTable @ stdcall -register RtlCaptureContext(ptr) ntdll.RtlCaptureContext @ stdcall RtlCaptureStackBackTrace(long long ptr ptr) ntdll.RtlCaptureStackBackTrace -@ stdcall -arch=x86_64 RtlCompareMemory(ptr ptr ptr) -@ stdcall -arch=x86_64 RtlCopyMemory(ptr ptr ptr) -@ stdcall -arch=x86_64 RtlDeleteFunctionTable(ptr) @ stdcall RtlFillMemory(ptr long long) ntdll.RtlFillMemory -@ stdcall -arch=x86_64 RtlInstallFunctionTableCallback(double double long ptr ptr ptr) -@ stdcall -arch=x86_64 RtlLookupFunctionEntry(ptr ptr ptr) ntdll.RtlLookupFunctionEntry @ stdcall RtlMoveMemory(ptr ptr long) ntdll.RtlMoveMemory -@ stdcall -arch=x86_64 RtlPcToFileHeader(ptr ptr) ntdll.RtlPcToFileHeader -@ stdcall -arch=x86_64 RtlRaiseException(ptr) ntdll.RtlRaiseException -@ stdcall -arch=x86_64 RtlRestoreContext(ptr ptr) ntdll.RtlRestoreContext @ stdcall RtlUnwind(ptr ptr ptr long) ntdll.RtlUnwind -@ stdcall -arch=x86_64 RtlUnwindEx(ptr ptr ptr ptr ptr ptr) ntdll.RtlUnwindEx -@ stdcall -arch=x86_64 RtlVirtualUnwind(ptr ptr ptr long) ntdll.RtlVirtualUnwind @ stdcall RtlZeroMemory(ptr long) ntdll.RtlZeroMemory @ stdcall ScrollConsoleScreenBufferA(long ptr ptr ptr ptr) @ stdcall ScrollConsoleScreenBufferW(long ptr ptr ptr ptr) @@ -1145,7 +757,6 @@ @ stdcall SetConsoleDisplayMode(long long ptr) @ stdcall SetConsoleFont(long long) @ stdcall SetConsoleHardwareState(long long long) -@ stdcall SetConsoleHistoryInfo(ptr) @ stdcall SetConsoleIcon(ptr) @ stdcall SetConsoleInputExeNameA(ptr) @ stdcall SetConsoleInputExeNameW(ptr) @@ -1160,41 +771,29 @@ @ stdcall SetConsoleOS2OemFormat(long) @ stdcall SetConsoleOutputCP(long) @ stdcall SetConsolePalette(long long long) -;@ stdcall SetConsoleScreenBufferInfoEx ; Win 7 @ stdcall SetConsoleScreenBufferSize(long long) @ stdcall SetConsoleTextAttribute(long long) @ stdcall SetConsoleTitleA(str) @ stdcall SetConsoleTitleW(wstr) @ stdcall SetConsoleWindowInfo(long long ptr) @ stdcall SetCriticalSectionSpinCount(ptr long) ntdll.RtlSetCriticalSectionSpinCount -;@ stdcall SetCurrentConsoleFontEx ; Win 7 @ stdcall SetCurrentDirectoryA(str) @ stdcall SetCurrentDirectoryW(wstr) -;@ stub SetDaylightFlag ; missing in XP SP3 and Win 7 @ stdcall SetDefaultCommConfigA(str ptr long) @ stdcall SetDefaultCommConfigW(wstr ptr long) @ stdcall SetDllDirectoryA(str) @ stdcall SetDllDirectoryW(wstr) -;@ stdcall SetDynamicTimeZoneInformation ; Win 7 @ stdcall SetEndOfFile(long) -;@ stdcall SetEnvironmentStringsA ; Win 7 -;@ stdcall SetEnvironmentStringsW ; Win 7 +@ stdcall SetEnvironmentStringsA(ptr) +@ stdcall SetEnvironmentStringsW(ptr) @ stdcall SetEnvironmentVariableA(str str) @ stdcall SetEnvironmentVariableW(wstr wstr) @ stdcall SetErrorMode(long) @ stdcall SetEvent(long) -;@ stdcall SetEventWhenCallbackReturns ntdll.TpCallbackSetEventOnCompletion ; Win 7 -;@ stdcall SetExtendedFeaturesMask api-ms-win-core-xstate-l1-1-0.RtlSetExtendedFeaturesMask ; Win 7 @ stdcall SetFileApisToANSI() @ stdcall SetFileApisToOEM() @ stdcall SetFileAttributesA(str long) -;@ stdcall SetFileAttributesTransactedA ; Win 7 -;@ stdcall SetFileAttributesTransactedW ; Win 7 @ stdcall SetFileAttributesW(wstr long) -;@ stdcall SetFileBandwidthReservation ; Win 7 -;@ stdcall SetFileCompletionNotificationModes ; Win 7 -;@ stdcall SetFileInformationByHandle ; Win 7 -;@ stdcall SetFileIoOverlappedRange ; Win 7 @ stdcall SetFilePointer(long long ptr long) @ stdcall SetFilePointerEx(long double ptr long) @ stdcall SetFileShortNameA(long str) @@ -1216,21 +815,15 @@ @ stdcall SetLocaleInfoW(long long wstr) @ stdcall SetMailslotInfo(long long) @ stdcall SetMessageWaitingIndicator(ptr long) -;@ stdcall SetNamedPipeAttribute ; Win 7 @ stdcall SetNamedPipeHandleState(long ptr ptr ptr) @ stdcall SetPriorityClass(long long) @ stdcall SetProcessAffinityMask(long long) -;@ stdcall SetProcessAffinityUpdateMode ; Win 7 -;@ stdcall SetProcessDEPPolicy ; Win 7 -;@ stdcall SetProcessPreferredUILanguages ; Win 7 @ stdcall SetProcessPriorityBoost(long long) @ stdcall SetProcessShutdownParameters(long long) @ stdcall SetProcessWorkingSetSize(long long long) -;@ stdcall SetProcessWorkingSetSizeEx ; Win 7 -;@ stdcall SetSearchPathMode ; Win 7 +@ stdcall SetProcessWorkingSetSizeEx(long long long long) @ stdcall SetStdHandle(long long) -;@ stdcall SetStdHandleEx ; Win 7 -;@ stdcall SetSystemFileCacheSize ; Win 7 +@ stdcall SetSystemFileCacheSize(long long long) @ stdcall SetSystemPowerState(long long) @ stdcall SetSystemTime(ptr) @ stdcall SetSystemTimeAdjustment(long long) @@ -1239,26 +832,15 @@ @ stdcall SetTermsrvAppInstallMode(long) @ stdcall SetThreadAffinityMask(long long) @ stdcall SetThreadContext(long ptr) -;@ stdcall SetThreadErrorMode(long ptr) ; Win 7 @ stdcall SetThreadExecutionState(long) -;@ stdcall SetThreadGroupAffinity ; Win 7 @ stdcall SetThreadIdealProcessor(long long) -;@ stdcall SetThreadIdealProcessorEx ; Win 7 @ stdcall SetThreadLocale(long) -;@ stdcall SetThreadPreferredUILanguages ; Win 7 @ stdcall SetThreadPriority(long long) @ stdcall SetThreadPriorityBoost(long long) -;@ stdcall SetThreadStackGuarantee ; Win 7 -;@ stdcall SetThreadToken api-ms-win-core-processthreads-l1-1-0.SetThreadToken ; Win 7 +@ stdcall SetThreadStackGuarantee(ptr) @ stdcall SetThreadUILanguage(long) -;@ stdcall SetThreadpoolStackInformation ; Win 7 -;@ stdcall SetThreadpoolThreadMaximum ntdll.TpSetPoolMaxThreads ; Win 7 -;@ stdcall SetThreadpoolThreadMinimum ; Win 7 -;@ stdcall SetThreadpoolTimer ntdll.TpSetTimer ; Win 7 -;@ stdcall SetThreadpoolWait ntdll.TpSetWait ; Win 7 @ stdcall SetTimeZoneInformation(ptr) @ stdcall SetTimerQueueTimer(long ptr ptr long long long) -;@ stdcall -arch?x86_64 SetUmsThreadInformation @ stdcall SetUnhandledExceptionFilter(ptr) @ stdcall SetUserGeoID(long) @ stdcall SetVDMCurrentDirectories(long long) @@ -1267,19 +849,12 @@ @ stdcall SetVolumeMountPointA(str str) @ stdcall SetVolumeMountPointW(wstr wstr) @ stdcall SetWaitableTimer(long ptr long ptr ptr long) -;@ stdcall SetWaitableTimerEx api-ms-win-core-threadpool-l1-1-0.SetWaitableTimerEx ; Win 7 @ stdcall SetupComm(long long long) @ stdcall ShowConsoleCursor(long long) @ stdcall SignalObjectAndWait(long long long long) @ stdcall SizeofResource(long long) @ stdcall Sleep(long) -;@ stdcall SleepConditionVariableCS ; Win 7 -;@ stdcall SleepConditionVariableSRW ; Win 7 @ stdcall SleepEx(long long) -;@ stdcall SortCloseHandle ; Win 7 -;@ stdcall SortGetHandle ; Win 7 -;@ stdcall StartThreadpoolIo ntdll.TpStartAsyncIoOperation ; Win 7 -;@ stdcall SubmitThreadpoolWork ntdll.TpPostWork ; Win 7 @ stdcall SuspendThread(long) @ stdcall SwitchToFiber(ptr) @ stdcall SwitchToThread() @@ -1292,52 +867,37 @@ @ stdcall Thread32First(long ptr) @ stdcall Thread32Next(long ptr) @ stdcall TlsAlloc() -;@ stub TlsAllocInternal ; missing in XP SP3 and Win 7 @ stdcall TlsFree(long) -;@ stub TlsFreeInternal ; missing in XP SP3 and Win 7 @ stdcall TlsGetValue(long) @ stdcall TlsSetValue(long ptr) @ stdcall Toolhelp32ReadProcessMemory(long ptr ptr long ptr) @ stdcall TransactNamedPipe(long ptr long ptr long ptr ptr) @ stdcall TransmitCommChar(long long) -@ stdcall TrimVirtualBuffer(ptr) ; missing in Win 7 -;@ stdcall TryAcquireSRWLockExclusive ntdll.RtlTryAcquireSRWLockExclusive ; Win 7 -;@ stdcall TryAcquireSRWLockShared ntdll.RtlTryAcquireSRWLockShared ; Win 7 @ stdcall TryEnterCriticalSection(ptr) ntdll.RtlTryEnterCriticalSection -;@ stdcall TrySubmitThreadpoolCallback ; Win 7 @ stdcall TzSpecificLocalTimeToSystemTime(ptr ptr ptr) @ stdcall UTRegister(long str str str ptr ptr ptr) @ stdcall UTUnRegister(long) -;@ stdcall -arch=x86_64 UmsThreadYield @ stdcall UnhandledExceptionFilter(ptr) -;@ stdcall UninitializeCriticalSection(ptr) ; ??? @ stdcall UnlockFile(long long long long long) @ stdcall UnlockFileEx(long long long long ptr) @ stdcall UnmapViewOfFile(ptr) -;@ stdcall UnregisterApplicationRecoveryCallback ; Win 7 -;@ stdcall UnregisterApplicationRestart ; Win 7 @ stdcall UnregisterConsoleIME() @ stdcall UnregisterWait(long) @ stdcall UnregisterWaitEx(long long) -;@ stdcall UpdateCalendarDayOfWeek ; Win 7 -;@ stdcall UpdateProcThreadAttribute api-ms-win-core-processthreads-l1-1-0.UpdateProcThreadAttribute ; Win 7 @ stdcall UpdateResourceA(long str str long ptr long) @ stdcall UpdateResourceW(long wstr wstr long ptr long) @ stdcall VDMConsoleOperation(long long) @ stdcall VDMOperationStarted(long) -;@ stub ValidateCType ; missing in XP SP3 and Win 7 -;@ stub ValidateLocale ; missing in XP SP3 and Win 7 +@ stdcall ValidateLCType(long long ptr ptr) +@ stdcall ValidateLocale(long) @ stdcall VerLanguageNameA(long str long) @ stdcall VerLanguageNameW(long wstr long) @ stdcall -ret64 VerSetConditionMask(long long long long) ntdll.VerSetConditionMask @ stdcall VerifyConsoleIoHandle(long) -;@ stdcall VerifyScripts ; Win 7 @ stdcall VerifyVersionInfoA(long long double) @ stdcall VerifyVersionInfoW(long long double) @ stdcall VirtualAlloc(ptr long long long) @ stdcall VirtualAllocEx(long ptr long long long) -;@ stdcall VirtualAllocExNuma ; Win 7 -@ stdcall VirtualBufferExceptionHandler(long long long) ; missing in Win 7 @ stdcall VirtualFree(ptr long long) @ stdcall VirtualFreeEx(long ptr long long) @ stdcall VirtualLock(ptr long) @@ -1346,44 +906,20 @@ @ stdcall VirtualQuery(ptr ptr long) @ stdcall VirtualQueryEx(long ptr ptr long) @ stdcall VirtualUnlock(ptr long) -;@ stdcall WTSGetActiveConsoleSessionId ; Win 7 +@ stdcall WTSGetActiveConsoleSessionId() @ stdcall WaitCommEvent(long ptr ptr) @ stdcall WaitForDebugEvent(ptr long) @ stdcall WaitForMultipleObjects(long ptr long long) @ stdcall WaitForMultipleObjectsEx(long ptr long long long) @ stdcall WaitForSingleObject(long long) @ stdcall WaitForSingleObjectEx(long long long) -;@ stdcall WaitForThreadpoolIoCallbacks ntdll.TpWaitForIoCompletion ; Win 7 -;@ stdcall WaitForThreadpoolTimerCallbacks ntdll.TpWaitForTimer ; Win 7 -;@ stdcall WaitForThreadpoolWaitCallbacks ntdll.TpWaitForWait ; Win 7 -;@ stdcall WaitForThreadpoolWorkCallbacks ntdll.TpWaitForWork ; Win 7 @ stdcall WaitNamedPipeA (str long) @ stdcall WaitNamedPipeW (wstr long) -@ stdcall WakeAllConditionVariable(ptr) ntdll.RtlWakeAllConditionVariable -@ stdcall WakeConditionVariable(ptr) ntdll.RtlWakeConditionVariable -;@ stdcall WerGetFlags ; Win 7 -;@ stdcall WerRegisterFile ; Win 7 -;@ stdcall WerRegisterMemoryBlock ; Win 7 -;@ stdcall WerRegisterRuntimeExceptionModule ; Win 7 -;@ stdcall WerSetFlags ; Win 7 -;@ stdcall WerUnregisterFile ; Win 7 -;@ stdcall WerUnregisterMemoryBlock ; Win 7 -;@ stdcall WerUnregisterRuntimeExceptionModule ; Win 7 -;@ stdcall WerpCleanupMessageMapping ; Win 7 -;@ stdcall WerpInitiateRemoteRecovery ; Win 7 -;@ stdcall WerpNotifyLoadStringResource ; Win 7 -;@ stdcall WerpNotifyLoadStringResourceEx ; Win 7 -;@ stdcall WerpNotifyUseStringResource ; Win 7 -;@ stdcall WerpStringLookup ; Win 7 @ stdcall WideCharToMultiByte(long long wstr long ptr long ptr ptr) @ stdcall WinExec(str long) @ stdcall Wow64DisableWow64FsRedirection(ptr) @ stdcall Wow64EnableWow64FsRedirection(long) -;@ stdcall Wow64GetThreadContext ; Win 7 -;@ stdcall Wow64GetThreadSelectorEntry ; Win 7 @ stdcall Wow64RevertWow64FsRedirection(ptr) -;@ stdcall Wow64SetThreadContext ; Win 7 -;@ stdcall Wow64SuspendThread ; Win 7 @ stdcall WriteConsoleA(long ptr long ptr ptr) @ stdcall WriteConsoleInputA(long ptr long ptr) @ stdcall WriteConsoleInputVDMA(long long long long) @@ -1410,23 +946,15 @@ @ stdcall WriteProfileStringA(str str str) @ stdcall WriteProfileStringW(wstr wstr wstr) @ stdcall WriteTapemark(ptr long long long) -@ stdcall WTSGetActiveConsoleSessionId() ; missing in win 7 @ stdcall ZombifyActCtx(ptr) -;@ stdcall -arch=x86_64 __C_specific_handler ntdll.__C_specific_handler -;@ stdcall -arch=x86_64 __chkstk ntdll.__chkstk -;@ stdcall -arch=x86_64 __misaligned_access ntdll.__misaligned_access -;@ stub _DebugOut ; missing in XP SP3 and Win 7 -;@ stub _DebugPrintf ; missing in XP SP3 and Win 7 @ stdcall _hread(long ptr long) @ stdcall _hwrite(long ptr long) @ stdcall _lclose(long) @ stdcall _lcreat(str long) @ stdcall _llseek(long long long) -;@ stdcall -arch=x86_64 _local_unwind ntdll._local_unwind; Win 7 @ stdcall _lopen(str long) @ stdcall _lread(long ptr long) _hread @ stdcall _lwrite(long ptr long) _hwrite -;@ stub dprintf ; missing in XP SP3 and Win 7 @ stdcall lstrcat(str str) lstrcatA @ stdcall lstrcatA(str str) @ stdcall lstrcatW(wstr wstr) @@ -1445,12 +973,17 @@ @ stdcall lstrlen(str) lstrlenA @ stdcall lstrlenA(str) @ stdcall lstrlenW(wstr) -;@ stdcall -arch=x86_64 uaw_lstrcmpW ; Win 7 -;@ stdcall -arch=x86_64 uaw_lstrcmpiW ; Win 7 -;@ stdcall -arch=x86_64 uaw_lstrlenW ; Win 7 -;@ stdcall -arch=x86_64 uaw_wcschr ; Win 7 -;@ stdcall -arch=x86_64 uaw_wcscpy ; Win 7 -;@ stdcall -arch=x86_64 uaw_wcsicmp ; Win 7 -;@ stdcall -arch=x86_64 uaw_wcslen ; Win 7 -;@ stdcall -arch=x86_64 uaw_wcsrchr ; Win 7 +@ cdecl -arch=x86_64 RtlAddFunctionTable(ptr long long) ntdll.RtlAddFunctionTable +@ stdcall -arch=x86_64 RtlCompareMemory(ptr ptr ptr) +@ stdcall -arch=x86_64 RtlCopyMemory(ptr ptr ptr) +@ stdcall -arch=x86_64 RtlDeleteFunctionTable(ptr) +@ stdcall -arch=x86_64 RtlInstallFunctionTableCallback(double double long ptr ptr ptr) +@ stdcall -arch=x86_64 RtlLookupFunctionEntry(ptr ptr ptr) ntdll.RtlLookupFunctionEntry +@ stdcall -arch=x86_64 RtlPcToFileHeader(ptr ptr) ntdll.RtlPcToFileHeader +@ stdcall -arch=x86_64 RtlRaiseException(ptr) ntdll.RtlRaiseException +@ stdcall -arch=x86_64 RtlRestoreContext(ptr ptr) ntdll.RtlRestoreContext +@ stdcall -arch=x86_64 RtlUnwindEx(ptr ptr ptr ptr ptr ptr) ntdll.RtlUnwindEx +@ stdcall -arch=x86_64 RtlVirtualUnwind(ptr ptr ptr long) ntdll.RtlVirtualUnwind + +@ stdcall GetTickCount64() ; FOR WINE diff --git a/dll/win32/kernel32/lang/ru-RU.rc b/dll/win32/kernel32/lang/ru-RU.rc deleted file mode 100644 index 5fb005a12b7..00000000000 --- a/dll/win32/kernel32/lang/ru-RU.rc +++ /dev/null @@ -1,163 +0,0 @@ -#pragma code_page(1251) - -LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT - -STRINGTABLE DISCARDABLE -BEGIN - /* Names of code pages */ - 1250 "1250 (ANSI - -)" - 1251 "1251 (ANSI - )" - 1252 "1252 (ANSI - 1)" - 1253 "1253 (ANSI - )" - 1254 "1254 (ANSI - )" - 1255 "1255 (ANSI - )" - 1256 "1256 (ANSI - )" - 1257 "1257 (ANSI - )" - 1258 "1258 (ANSI/OEM - )" - 874 "874 (ANSI/OEM - )" - 932 "932 (ANSI/OEM - Shift-JIS)" - 936 "936 (ANSI/OEM - GBK)" - 949 "949 (ANSI/OEM - )" - 950 "950 (ANSI/OEM - Big5)" - - 437 "437 (OEM - )" - 737 "737 (OEM - 437G)" - 775 "775 (OEM - )" - 850 "850 (OEM - 1)" - 852 "852 (OEM - 2)" - 855 "855 (OEM - )" - 857 "857 (OEM - )" - 858 "858 (OEM - 1 + )" - 860 "860 (OEM - )" - 861 "861 (OEM - )" - 862 "862 (OEM - )" - 863 "863 (OEM - -)" - 864 "864 (OEM - )" - 865 "865 (OEM - )" - 866 "866 (OEM - )" - 869 "869 (OEM - )" - - 10000 "10000 (MAC - )" - 10001 "10001 (MAC - )" - 10002 "10002 (MAC - Big5)" - 10003 "10003 (MAC - )" - 10004 "10004 (MAC - )" - 10005 "10005 (MAC - )" - 10006 "10006 (MAC - 1)" - 10007 "10007 (MAC - )" - 10008 "10008 (MAC - GB 2312)" - 10010 "10010 (MAC - )" - 10017 "10017 (MAC - )" - 10021 "10021 (MAC - )" - 10029 "10029 (MAC - 2)" - 10079 "10079 (MAC - )" - 10081 "10081 (MAC - )" - 10082 "10082 (MAC - )" - - 65000 "65000 (UTF-7)" - 65001 "65001 (UTF-8)" - - 3700 "37 (IBM EBCDIC - /)" /* FIXME */ - 1026 "1026 (IBM EBCDIC - (-5))" - 1047 "1047 (IBM EBCDIC - 1/Open System)" - 1140 "1140 (IBM EBCDIC - / (37 + ))" - 1141 "1141 (IBM EBCDIC - (20273 + ))" - 1142 "1142 (IBM EBCDIC - / (20277 + ))" - 1143 "1143 (IBM EBCDIC - / (20278 + ))" - 1144 "1144 (IBM EBCDIC - (20280 + ))" - 1145 "1145 (IBM EBCDIC - / (20284 + ))" - 1146 "1146 (IBM EBCDIC - (20285 + ))" - 1147 "1147 (IBM EBCDIC - (20297 + ))" - 1148 "1148 (IBM EBCDIC - (500 + ))" - 1149 "1149 (IBM EBCDIC - (20871 + ))" - 20273 "20273 (IBM EBCDIC - )" - 20277 "20277 (IBM EBCDIC - /)" - 20278 "20278 (IBM EBCDIC - /)" - 20280 "20280 (IBM EBCDIC - )" - 20284 "20284 (IBM EBCDIC - /)" - 20285 "20285 (IBM EBCDIC - )" - 20290 "20290 (IBM EBCDIC - )" - 20297 "20297 (IBM EBCDIC - )" - 20420 "20420 (IBM EBCDIC - )" - 20423 "20423 (IBM EBCDIC - )" - 20424 "20424 (IBM EBCDIC - )" - 20833 "20833 (IBM EBCDIC - )" - 20838 "20838 (IBM EBCDIC - )" - 20871 "20871 (IBM EBCDIC - )" - 20880 "20880 (IBM EBCDIC - ())" - 20905 "20905 (IBM EBCDIC - )" - 20924 "20924 (IBM EBCDIC - 1/Open System (1047 + ))" - 21025 "21025 (IBM EBCDIC - (, ))" - 500 "500 (IBM EBCDIC - )" - 870 "870 (IBM EBCDIC - /ROECE (-2))" - 875 "875 (IBM EBCDIC - )" - - 20269 "20269 (ISO 6937 )" - 28591 "28591 (ISO 8859-1 1)" - 28592 "28592 (ISO 8859-2 )" - 28593 "28593 (ISO 8859-3 3)" - 28594 "28594 (ISO 8859-4 )" - 28595 "28595 (ISO 8859-5 )" - 28596 "28596 (ISO 8859-6 )" - 28597 "28597 (ISO 8859-7 )" - 28598 "28598 (ISO 8859-8 : )" - 28599 "28599 (ISO 8859-9 5)" - 28605 "28605 (ISO 8859-15 9)" - 38598 "38598 (ISO 8859-8 : )" - - 20105 "20105 (IA5 IRV 5)" - 20106 "20106 (IA5 )" - 20107 "20107 (IA5 )" - 20108 "20108 (IA5 )" - - 1361 "1361 ( - Johab)" - 20000 "20000 (CNS - )" - 20001 "20001 (TCA - )" - 20002 "20002 (Eten - )" - 20003 "20003 (IBM5550 - )" - 20004 "20004 (TeleText - )" - 20005 "20005 (Wang - )" - 20127 "20127 (-ASCII)" - 20261 "20261 (T.61)" - 20866 "20866 ( - 8)" - 21027 "21027 (. . )" - 21866 "21866 ( - 8-U)" - 708 "708 ( - ASMO)" - 720 "720 ( - ASMO)" - 20932 "20932 (JIS X 0208-1990 & 0212-1990)" - 20936 "20936 (GB2312 )" - 20949 "20949 (Korean Wansung)" - - 57002 "57002 (ISCII )" - 57003 "57003 (ISCII )" - 57004 "57004 (ISCII )" - 57005 "57005 (ISCII )" - 57006 "57006 (ISCII )" - 57007 "57007 (ISCII )" - 57008 "57008 (ISCII )" - 57009 "57009 (ISCII )" - 57010 "57010 (ISCII )" - 57011 "57011 (ISCII )" - - 50930 "50930 (IBM EBCDIC - ( ))" - 50931 "50931 (IBM EBCDIC - / )" - 50933 "50933 (IBM EBCDIC - )" - 50935 "50935 (IBM EBCDIC - )" - 50937 "50937 (IBM EBCDIC - / )" - 50939 "50939 (IBM EBCDIC - () )" - - 50220 "50220 (ISO-2022 )" - 50221 "50221 (ISO-2022 )" - 50222 "50222 (ISO-2022 JIS X 0201-1989)" - 50225 "50225 (ISO-2022 )" - 50227 "50227 (ISO-2022 )" - 50229 "50229 (ISO-2022 )" - - 51932 "51932 (EUC-)" - 51936 "51936 (EUC- )" - 51949 "51949 (EUC-)" - 51950 "51950 (EUC- )" - - 52936 "52936 (HZ-GB2312 )" - 54936 "54936 (GB18030 )" -END diff --git a/dll/win32/kernel32/lang/uk-UA.rc b/dll/win32/kernel32/lang/uk-UA.rc deleted file mode 100644 index 2a1b984c511..00000000000 --- a/dll/win32/kernel32/lang/uk-UA.rc +++ /dev/null @@ -1,163 +0,0 @@ -#pragma code_page(1251) - -LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT - -STRINGTABLE DISCARDABLE -BEGIN - /* Names of code pages */ - 1250 "1250 (ANSI - )" - 1251 "1251 (ANSI - )" - 1252 "1252 (ANSI - I)" - 1253 "1253 (ANSI - )" - 1254 "1254 (ANSI - )" - 1255 "1255 (ANSI - )" - 1256 "1256 (ANSI - )" - 1257 "1257 (ANSI - )" - 1258 "1258 (ANSI/OEM - ')" - 874 "874 (ANSI/OEM - )" - 932 "932 (ANSI/OEM - Shift-JIS)" - 936 "936 (ANSI/OEM - GBK)" - 949 "949 (ANSI/OEM - )" - 950 "950 (ANSI/OEM - Big5)" - - 437 "437 (OEM - )" - 737 "737 (OEM - 437G)" - 775 "775 (OEM - )" - 850 "850 (OEM - I)" - 852 "852 (OEM - II)" - 855 "855 (OEM - )" - 857 "857 (OEM - )" - 858 "858 (OEM - I + )" - 860 "860 (OEM - )" - 861 "861 (OEM - )" - 862 "862 (OEM - )" - 863 "863 (OEM - )" - 864 "864 (OEM - )" - 865 "865 (OEM - )" - 866 "866 (OEM - )" - 869 "869 (OEM - )" - - 10000 "10000 (MAC - )" - 10001 "10001 (MAC - )" - 10002 "10002 (MAC - Big5)" - 10003 "10003 (MAC - )" - 10004 "10004 (MAC - )" - 10005 "10005 (MAC - )" - 10006 "10006 (MAC - I)" - 10007 "10007 (MAC - )" - 10008 "10008 (MAC - GB 2312)" - 10010 "10010 (MAC - )" - 10017 "10017 (MAC - )" - 10021 "10021 (MAC - )" - 10029 "10029 (MAC - II)" - 10079 "10079 (MAC - )" - 10081 "10081 (MAC - )" - 10082 "10082 (MAC - )" - - 65000 "65000 (UTF-7)" - 65001 "65001 (UTF-8)" - - 3700 "37 (IBM EBCDIC - /)" /* FIXME */ - 1026 "1026 (IBM EBCDIC - (-5))" - 1047 "1047 (IBM EBCDIC - -1/Open System)" - 1140 "1140 (IBM EBCDIC - / (37 + ))" - 1141 "1141 (IBM EBCDIC - ͳ (20273 + ))" - 1142 "1142 (IBM EBCDIC - / (20277 + ))" - 1143 "1143 (IBM EBCDIC - Գ/ (20278 + ))" - 1144 "1144 (IBM EBCDIC - (20280 + ))" - 1145 "1145 (IBM EBCDIC - ./ (20284 + ))" - 1146 "1146 (IBM EBCDIC - (20285 + ))" - 1147 "1147 (IBM EBCDIC - (20297 + ))" - 1148 "1148 (IBM EBCDIC - ̳ (500 + ))" - 1149 "1149 (IBM EBCDIC - (20871 + ))" - 20273 "20273 (IBM EBCDIC - ͳ)" - 20277 "20277 (IBM EBCDIC - /)" - 20278 "20278 (IBM EBCDIC - Գ/)" - 20280 "20280 (IBM EBCDIC - )" - 20284 "20284 (IBM EBCDIC - ./)" - 20285 "20285 (IBM EBCDIC - )" - 20290 "20290 (IBM EBCDIC - )" - 20297 "20297 (IBM EBCDIC - )" - 20420 "20420 (IBM EBCDIC - )" - 20423 "20423 (IBM EBCDIC - )" - 20424 "20424 (IBM EBCDIC - )" - 20833 "20833 (IBM EBCDIC - )" - 20838 "20838 (IBM EBCDIC - )" - 20871 "20871 (IBM EBCDIC - )" - 20880 "20880 (IBM EBCDIC - ())" - 20905 "20905 (IBM EBCDIC - )" - 20924 "20924 (IBM EBCDIC - -1/Open System (1047 + ))" - 21025 "21025 (IBM EBCDIC - (, ))" - 500 "500 (IBM EBCDIC - ̳)" - 870 "870 (IBM EBCDIC - /ROECE (-2))" - 875 "875 (IBM EBCDIC - )" - - 20269 "20269 (ISO 6937 ij )" - 28591 "28591 (ISO 8859-1 I)" - 28592 "28592 (ISO 8859-2 )" - 28593 "28593 (ISO 8859-3 3)" - 28594 "28594 (ISO 8859-4 )" - 28595 "28595 (ISO 8859-5 )" - 28596 "28596 (ISO 8859-6 )" - 28597 "28597 (ISO 8859-7 )" - 28598 "28598 (ISO 8859-8 : ³ )" - 28599 "28599 (ISO 8859-9 5)" - 28605 "28605 (ISO 8859-15 9)" - 38598 "38598 (ISO 8859-8 : )" - - 20105 "20105 (IA5 IRV ̳ No.5)" - 20106 "20106 (IA5 ͳ)" - 20107 "20107 (IA5 )" - 20108 "20108 (IA5 )" - - 1361 "1361 ( - Johab)" - 20000 "20000 (CNS - )" - 20001 "20001 (TCA - )" - 20002 "20002 (Eten - )" - 20003 "20003 (IBM5550 - )" - 20004 "20004 (TeleText - )" - 20005 "20005 (Wang - )" - 20127 "20127 (-ASCII)" - 20261 "20261 (T.61)" - 20866 "20866 ( - KOI8)" - 21027 "21027 (. . )" - 21866 "21866 ( - KOI8-U)" - 708 "708 ( - ASMO)" - 720 "720 ( - ASMO)" - 20932 "20932 (JIS X 0208-1990 & 0212-1990)" - 20936 "20936 ( GB2312)" - 20949 "20949 ( Wansung)" - - 57002 "57002 (ISCII )" - 57003 "57003 (ISCII )" - 57004 "57004 (ISCII )" - 57005 "57005 (ISCII )" - 57006 "57006 (ISCII )" - 57007 "57007 (ISCII )" - 57008 "57008 (ISCII )" - 57009 "57009 (ISCII )" - 57010 "57010 (ISCII )" - 57011 "57011 (ISCII )" - - 50930 "50930 (IBM EBCDIC - () )" - 50931 "50931 (IBM EBCDIC - / )" - 50933 "50933 (IBM EBCDIC - )" - 50935 "50935 (IBM EBCDIC - )" - 50937 "50937 (IBM EBCDIC - / )" - 50939 "50939 (IBM EBCDIC - () )" - - 50220 "50220 (ISO-2022 )" - 50221 "50221 (ISO-2022 )" - 50222 "50222 (ISO-2022 JIS X 0201-1989)" - 50225 "50225 (ISO-2022 )" - 50227 "50227 (ISO-2022 )" - 50229 "50229 (ISO-2022 )" - - 51932 "51932 (EUC-)" - 51936 "51936 (EUC- )" - 51949 "51949 (EUC-)" - 51950 "51950 (EUC- )" - - 52936 "52936 (HZ-GB2312 )" - 54936 "54936 (GB18030 )" -END diff --git a/dll/win32/kernel32/mem/global.c b/dll/win32/kernel32/mem/global.c deleted file mode 100644 index a0449e36fca..00000000000 --- a/dll/win32/kernel32/mem/global.c +++ /dev/null @@ -1,962 +0,0 @@ -/* - * PROJECT: ReactOS Win32 Base API - * LICENSE: GPL - See COPYING in the top level directory - * FILE: dll/win32/kernel32/mem/global.c - * PURPOSE: Global Memory APIs (sits on top of Heap*) - * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org) - */ - -/* INCLUDES ******************************************************************/ - -#include - -#define NDEBUG -#include - -/* TYPES *********************************************************************/ - -extern SYSTEM_BASIC_INFORMATION BaseCachedSysInfo; -RTL_HANDLE_TABLE BaseHeapHandleTable; - -/* FUNCTIONS ***************************************************************/ - -/* - * @implemented - */ -HGLOBAL -NTAPI -GlobalAlloc(UINT uFlags, - DWORD dwBytes) -{ - ULONG Flags = 0; - PVOID Ptr = NULL; - HANDLE hMemory; - PBASE_HEAP_HANDLE_ENTRY HandleEntry; - BASE_TRACE_ALLOC(dwBytes, uFlags); - ASSERT(hProcessHeap); - - /* Make sure the flags are valid */ - if (uFlags & ~GMEM_VALID_FLAGS) - { - /* They aren't, fail */ - BASE_TRACE_FAILURE(); - SetLastError(ERROR_INVALID_PARAMETER); - return NULL; - } - - /* Convert ZEROINIT */ - if (uFlags & GMEM_ZEROINIT) Flags |= HEAP_ZERO_MEMORY; - - /* Check if we're not movable, which means pointer-based heap */ - if (!(uFlags & GMEM_MOVEABLE)) - { - /* Check if this is DDESHARE (deprecated) */ - if (uFlags & GMEM_DDESHARE) Flags |= BASE_HEAP_ENTRY_FLAG_DDESHARE; - - /* Allocate heap for it */ - Ptr = RtlAllocateHeap(hProcessHeap, Flags, dwBytes); - BASE_TRACE_ALLOC2(Ptr); - return Ptr; - } - - /* This is heap based, so lock it in first */ - RtlLockHeap(hProcessHeap); - - /* - * Disable locking, enable custom flags, and write the - * movable flag (deprecated) - */ - Flags |= HEAP_NO_SERIALIZE | - HEAP_SETTABLE_USER_VALUE | - BASE_HEAP_FLAG_MOVABLE; - - /* Allocate the handle */ - HandleEntry = BaseHeapAllocEntry(); - if (!HandleEntry) - { - /* Fail */ - hMemory = NULL; - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - BASE_TRACE_FAILURE(); - goto Quickie; - } - - /* Get the object and make sure we have size */ - hMemory = &HandleEntry->Object; - if (dwBytes) - { - /* Allocate the actual memory for it */ - Ptr = RtlAllocateHeap(hProcessHeap, Flags, dwBytes); - BASE_TRACE_PTR(HandleEntry, Ptr); - if (!Ptr) - { - /* We failed, manually set the allocate flag and free the handle */ - HandleEntry->Flags = RTL_HANDLE_VALID; - BaseHeapFreeEntry(HandleEntry); - - /* For the cleanup case */ - HandleEntry = NULL; - } - else - { - /* All worked well, save our heap entry */ - RtlSetUserValueHeap(hProcessHeap, HEAP_NO_SERIALIZE, Ptr, hMemory); - } - } - -Quickie: - /* Cleanup! First unlock the heap */ - RtlUnlockHeap(hProcessHeap); - - /* Check if a handle was allocated */ - if (HandleEntry) - { - /* Set the pointer and allocated flag */ - HandleEntry->Object = Ptr; - HandleEntry->Flags = RTL_HANDLE_VALID; - if (!Ptr) - { - /* We don't have a valid pointer, but so reuse this handle */ - HandleEntry->Flags |= BASE_HEAP_ENTRY_FLAG_REUSE; - } - - /* Check if the handle is discardable */ - if (uFlags & GMEM_DISCARDABLE) - { - /* Save it in the handle entry */ - HandleEntry->Flags |= BASE_HEAP_ENTRY_FLAG_REUSABLE; - } - - /* Check if the handle is moveable */ - if (uFlags & GMEM_MOVEABLE) - { - /* Save it in the handle entry */ - HandleEntry->Flags |= BASE_HEAP_ENTRY_FLAG_MOVABLE; - } - - /* Check if the handle is DDE Shared */ - if (uFlags & GMEM_DDESHARE) - { - /* Save it in the handle entry */ - HandleEntry->Flags |= BASE_HEAP_ENTRY_FLAG_DDESHARE; - } - - /* Set the pointer */ - Ptr = hMemory; - } - - /* Return the pointer */ - return Ptr; -} - -/* - * @implemented - */ -SIZE_T -NTAPI -GlobalCompact(DWORD dwMinFree) -{ - /* Call the RTL Heap Manager */ - return RtlCompactHeap(hProcessHeap, 0); -} - -/* - * @implemented - */ -VOID -NTAPI -GlobalFix(HGLOBAL hMem) -{ - /* Lock the memory if it the handle is valid */ - if (INVALID_HANDLE_VALUE != hMem) GlobalLock(hMem); -} - -/* - * @implemented - */ -UINT -NTAPI -GlobalFlags(HGLOBAL hMem) -{ - PBASE_HEAP_HANDLE_ENTRY HandleEntry; - HANDLE Handle = NULL; - ULONG Flags = 0; - UINT uFlags = GMEM_INVALID_HANDLE; - - /* Start by locking the heap */ - RtlLockHeap(hProcessHeap); - - /* Check if this is a simple RTL Heap Managed block */ - if (!((ULONG_PTR)hMem & BASE_HEAP_IS_HANDLE_ENTRY)) - { - /* Then we'll query RTL Heap */ - RtlGetUserInfoHeap(hProcessHeap, Flags, hMem, &Handle, &Flags); - BASE_TRACE_PTR(Handle, hMem); - - /* - * Check if RTL Heap didn't find a handle associated with us or - * said that this heap isn't movable, which means something we're - * really not a handle-based heap. - */ - if (!(Handle) || !(Flags & BASE_HEAP_FLAG_MOVABLE)) - { - /* Then set the flags to 0 */ - uFlags = 0; - } - else - { - /* Otherwise we're handle-based, so get the internal handle */ - hMem = Handle; - } - } - - /* Check if the handle is actually an entry in our table */ - if ((ULONG_PTR)hMem & BASE_HEAP_IS_HANDLE_ENTRY) - { - /* Then get the entry */ - HandleEntry = BaseHeapGetEntry(hMem); - BASE_TRACE_HANDLE(HandleEntry, hMem); - - /* Make sure it's a valid handle */ - if (BaseHeapValidateEntry(HandleEntry)) - { - /* Get the lock count first */ - uFlags = HandleEntry->LockCount & GMEM_LOCKCOUNT; - - /* Now check if it's discardable */ - if (HandleEntry->Flags & BASE_HEAP_ENTRY_FLAG_REUSABLE) - { - /* Set the Win32 Flag */ - uFlags |= GMEM_DISCARDABLE; - } - - /* Check if it's DDE Shared */ - if (HandleEntry->Flags & BASE_HEAP_ENTRY_FLAG_DDESHARE) - { - /* Set the Win32 Flag */ - uFlags |= GMEM_DDESHARE; - } - - /* Now check if it's discarded */ - if (HandleEntry->Flags & BASE_HEAP_ENTRY_FLAG_REUSE) - /* Set the Win32 Flag */ - uFlags |= GMEM_DISCARDED; - } - } - - /* Check if by now, we still haven't gotten any useful flags */ - if (uFlags == GMEM_INVALID_HANDLE) SetLastError(ERROR_INVALID_HANDLE); - - /* All done! Unlock heap and return Win32 Flags */ - RtlUnlockHeap(hProcessHeap); - return uFlags; -} - -/* - * @implemented - */ -HGLOBAL -NTAPI -GlobalFree(HGLOBAL hMem) -{ - PBASE_HEAP_HANDLE_ENTRY HandleEntry; - LPVOID Ptr; - BASE_TRACE_DEALLOC(hMem); - - /* Check if this was a simple allocated heap entry */ - if (!((ULONG_PTR)hMem & BASE_HEAP_IS_HANDLE_ENTRY)) - { - /* Free it with the RTL Heap Manager */ - if (RtlFreeHeap(hProcessHeap, 0, hMem)) - { - /* Return NULL since there's no handle */ - return NULL; - } - else - { - /* Otherwise fail */ - BASE_TRACE_FAILURE(); - SetLastError(ERROR_INVALID_HANDLE); - return hMem; - } - } - - /* It's a handle probably, so lock the heap */ - RtlLockHeap(hProcessHeap); - - /* Make sure that this is an entry in our handle database */ - if ((ULONG_PTR)hMem & BASE_HEAP_IS_HANDLE_ENTRY) - { - /* Get the entry */ - HandleEntry = BaseHeapGetEntry(hMem); - BASE_TRACE_HANDLE(HandleEntry, hMem); - - /* Make sure the handle is valid */ - if (!BaseHeapValidateEntry(HandleEntry)) - { - /* It's not, fail */ - SetLastError(ERROR_INVALID_HANDLE); - Ptr = NULL; - } - else - { - /* It's valid, so get the pointer */ - Ptr = HandleEntry->Object; - - /* Free this handle */ - BaseHeapFreeEntry(HandleEntry); - - /* If the pointer is 0, then we don't have a handle either */ - if (!Ptr) hMem = NULL; - } - } - else - { - /* Otherwise, reuse the handle as a pointer */ - BASE_TRACE_FAILURE(); - Ptr = hMem; - } - - /* Check if we got here with a valid heap pointer */ - if (Ptr) - { - /* Free it */ - RtlFreeHeap(hProcessHeap, HEAP_NO_SERIALIZE, Ptr); - hMem = NULL; - } - - /* We're done, so unlock the heap and return the handle */ - RtlUnlockHeap(hProcessHeap); - return hMem; -} - -/* - * @implemented - */ -HGLOBAL -NTAPI -GlobalHandle(LPCVOID pMem) -{ - HANDLE Handle = NULL; - ULONG Flags; - - /* Lock the heap */ - RtlLockHeap(hProcessHeap); - - /* Query RTL Heap */ - RtlGetUserInfoHeap(hProcessHeap, - HEAP_NO_SERIALIZE, - (PVOID)pMem, - &Handle, - &Flags); - BASE_TRACE_PTR(Handle, pMem); - - /* - * Check if RTL Heap didn't find a handle for us or said that - * this heap isn't movable. - */ - if (!(Handle) || !(Flags & BASE_HEAP_FLAG_MOVABLE)) - { - /* We're actually handle-based, so the pointer is a handle */ - Handle = (HANDLE)pMem; - } - - /* All done, unlock the heap and return the handle */ - RtlUnlockHeap(hProcessHeap); - return Handle; -} - -/* - * @implemented - */ -LPVOID -NTAPI -GlobalLock(HGLOBAL hMem) -{ - PBASE_HEAP_HANDLE_ENTRY HandleEntry; - LPVOID Ptr; - - /* Check if this was a simple allocated heap entry */ - if (!((ULONG_PTR)hMem & BASE_HEAP_IS_HANDLE_ENTRY)) - { - /* Verify and return the pointer */ - return IsBadReadPtr(hMem, 1) ? NULL : hMem; - } - - /* Otherwise, lock the heap */ - RtlLockHeap(hProcessHeap); - - _SEH2_TRY - { - /* Get the handle entry */ - HandleEntry = BaseHeapGetEntry(hMem); - BASE_TRACE_HANDLE(HandleEntry, hMem); - - /* Make sure it's valid */ - if (!BaseHeapValidateEntry(HandleEntry)) - { - /* It's not, fail */ - BASE_TRACE_FAILURE(); - SetLastError(ERROR_INVALID_HANDLE); - Ptr = NULL; - } - else - { - /* Otherwise, get the pointer */ - Ptr = HandleEntry->Object; - if (Ptr) - { - /* Increase the lock count, unless we've went too far */ - if (HandleEntry->LockCount++ == GMEM_LOCKCOUNT) - { - /* In which case we simply unlock once */ - HandleEntry->LockCount--; - } - } - else - { - /* The handle is still there but the memory was already freed */ - SetLastError(ERROR_DISCARDED); - } - } - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - SetLastError(ERROR_INVALID_HANDLE); - Ptr = NULL; - } - _SEH2_END - - /* All done. Unlock the heap and return the pointer */ - RtlUnlockHeap(hProcessHeap); - return Ptr; -} - -HGLOBAL -NTAPI -GlobalReAlloc(HGLOBAL hMem, - DWORD dwBytes, - UINT uFlags) -{ - PBASE_HEAP_HANDLE_ENTRY HandleEntry; - HANDLE Handle; - LPVOID Ptr; - ULONG Flags = 0; - - /* Convert ZEROINIT */ - if (uFlags & GMEM_ZEROINIT) Flags |= HEAP_ZERO_MEMORY; - - /* If this wasn't a movable heap, then we MUST re-alloc in place */ - if (!(uFlags & GMEM_MOVEABLE)) Flags |= HEAP_REALLOC_IN_PLACE_ONLY; - - /* Lock the heap and disable built-in locking in the RTL Heap funcitons */ - RtlLockHeap(hProcessHeap); - Flags |= HEAP_NO_SERIALIZE; - - /* Check if this is a simple handle-based block */ - if (((ULONG_PTR)hMem & BASE_HEAP_IS_HANDLE_ENTRY)) - { - /* Get the entry */ - HandleEntry = BaseHeapGetEntry(hMem); - BASE_TRACE_HANDLE(HandleEntry, hMem); - - /* Make sure the handle is valid */ - if (!BaseHeapValidateEntry(HandleEntry)) - { - /* Fail */ - BASE_TRACE_FAILURE(); - SetLastError(ERROR_INVALID_HANDLE); - hMem = NULL; - } - else if (uFlags & GMEM_MODIFY) - { - /* User is changing flags... check if the memory was discardable */ - if (uFlags & GMEM_DISCARDABLE) - { - /* Then set the flag */ - HandleEntry->Flags |= BASE_HEAP_ENTRY_FLAG_REUSABLE; - } - else - { - /* Otherwise, remove the flag */ - HandleEntry->Flags &= BASE_HEAP_ENTRY_FLAG_REUSABLE; - } - } - else - { - /* Otherwise, get the object and check if we have no size */ - Ptr = HandleEntry->Object; - if (!dwBytes) - { - /* Clear the handle and check for a pointer */ - hMem = NULL; - if (Ptr) - { - /* Make sure the handle isn't locked */ - if ((uFlags & GMEM_MOVEABLE) && !(HandleEntry->LockCount)) - { - /* Free the current heap */ - RtlFreeHeap(hProcessHeap, Flags, Ptr); - - /* Free the handle */ - HandleEntry->Object = NULL; - HandleEntry->Flags |= BASE_HEAP_ENTRY_FLAG_REUSE; - - /* Get the object pointer */ - hMem = &HandleEntry->Object; - } - } - else - { - /* Otherwise just return the object pointer */ - hMem = &HandleEntry->Object; - } - } - else - { - /* Otherwise, we're allocating, so set the new flags needed */ - Flags |= HEAP_SETTABLE_USER_VALUE | BASE_HEAP_FLAG_MOVABLE; - if (!Ptr) - { - /* We don't have a base, so allocate one */ - Ptr = RtlAllocateHeap(hProcessHeap, Flags, dwBytes); - BASE_TRACE_ALLOC2(Ptr); - if (Ptr) - { - /* Allocation succeeded, so save our entry */ - RtlSetUserValueHeap(hProcessHeap, - HEAP_NO_SERIALIZE, - Ptr, - hMem); - } - } - else - { - /* - * If it's not movable or currently locked, we MUST allocate - * in-place! - */ - if (!(uFlags & GMEM_MOVEABLE) && (HandleEntry->LockCount)) - { - /* Set the flag */ - Flags |= HEAP_REALLOC_IN_PLACE_ONLY; - } - else - { - /* Otherwise clear the flag if we set it previously */ - Flags &= ~HEAP_REALLOC_IN_PLACE_ONLY; - } - - /* And do the re-allocation */ - Ptr = RtlReAllocateHeap(hProcessHeap, Flags, Ptr, dwBytes); - - if (Ptr) - { - /* Allocation succeeded, so save our entry */ - RtlSetUserValueHeap(hProcessHeap, - HEAP_NO_SERIALIZE, - Ptr, - hMem); - } - - } - - /* Make sure we have a pointer by now */ - if (Ptr) - { - /* Write it in the handle entry and mark it in use */ - HandleEntry->Object = Ptr; - HandleEntry->Flags &= ~BASE_HEAP_ENTRY_FLAG_REUSE; - } - else - { - /* Otherwise we failed */ - hMem = NULL; - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - } - } - } - } - else if (uFlags & GMEM_MODIFY) - { - /* This is not a handle-based heap and the caller wants it to be one */ - if (uFlags & GMEM_MOVEABLE) - { - /* Get information on its current state */ - Handle = hMem; - DPRINT1("h h %lx %lx\n", Handle, hMem); - RtlGetUserInfoHeap(hProcessHeap, - HEAP_NO_SERIALIZE, - hMem, - &Handle, - &Flags); - DPRINT1("h h %lx %lx\n", Handle, hMem); - - /* - * Check if the handle matches the pointer or if the moveable flag - * isn't there, which is what we expect since it currenly isn't. - */ - if (Handle == hMem || !(Flags & BASE_HEAP_FLAG_MOVABLE)) - { - /* Allocate a handle for it */ - HandleEntry = BaseHeapAllocEntry(); - - /* Calculate the size of the current heap */ - dwBytes = RtlSizeHeap(hProcessHeap, HEAP_NO_SERIALIZE, hMem); - - /* Set the movable flag */ - Flags |= HEAP_SETTABLE_USER_VALUE | BASE_HEAP_FLAG_MOVABLE; - - /* Now allocate the actual heap for it */ - HandleEntry->Object = RtlAllocateHeap(hProcessHeap, - Flags, - dwBytes); - BASE_TRACE_PTR(HandleEntry->Object, HandleEntry); - if (!HandleEntry->Object) - { - /* - * We failed, manually set the allocate flag and - * free the handle - */ - HandleEntry->Flags = RTL_HANDLE_VALID; - BaseHeapFreeEntry(HandleEntry); - - /* For the cleanup case */ - BASE_TRACE_FAILURE(); - HandleEntry = NULL; - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - } - else - { - /* Otherwise, copy the current heap and free the old one */ - RtlMoveMemory(HandleEntry->Object, hMem, dwBytes); - RtlFreeHeap(hProcessHeap, HEAP_NO_SERIALIZE, hMem); - - /* Select the heap pointer */ - hMem = (HANDLE)&HandleEntry->Object; - - /* Initialize the count and default flags */ - HandleEntry->LockCount = 0; - HandleEntry->Flags = RTL_HANDLE_VALID | - BASE_HEAP_ENTRY_FLAG_MOVABLE; - - /* Check if it's also discardable */ - if (uFlags & GMEM_DISCARDABLE) - { - /* Set the internal flag */ - HandleEntry->Flags |= BASE_HEAP_ENTRY_FLAG_REUSABLE; - } - - /* Check if it's also DDE Shared */ - if (uFlags & GMEM_DDESHARE) - { - /* Set the internal flag */ - HandleEntry->Flags |= BASE_HEAP_ENTRY_FLAG_DDESHARE; - } - - /* Allocation succeeded, so save our entry */ - RtlSetUserValueHeap(hProcessHeap, - HEAP_NO_SERIALIZE, - HandleEntry->Object, - hMem); - } - } - } - } - else - { - /* Otherwise, this is a simple RTL Managed Heap, so just call it */ - hMem = RtlReAllocateHeap(hProcessHeap, - Flags | HEAP_NO_SERIALIZE, - hMem, - dwBytes); - if (!hMem) - { - /* Fail */ - BASE_TRACE_FAILURE(); - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - } - } - - /* All done, unlock the heap and return the pointer */ - RtlUnlockHeap(hProcessHeap); - return hMem; -} - -/* - * @implemented - */ -DWORD -NTAPI -GlobalSize(HGLOBAL hMem) -{ - PBASE_HEAP_HANDLE_ENTRY HandleEntry; - PVOID Handle = NULL; - ULONG Flags = 0; - SIZE_T dwSize = MAXULONG_PTR; - - /* Lock the heap */ - RtlLockHeap(hProcessHeap); - - _SEH2_TRY - { - /* Check if this is a simple RTL Heap Managed block */ - if (!((ULONG_PTR)hMem & BASE_HEAP_IS_HANDLE_ENTRY)) - { - /* Then we'll query RTL Heap */ - RtlGetUserInfoHeap(hProcessHeap, Flags, hMem, &Handle, &Flags); - BASE_TRACE_PTR(Handle, hMem); - - /* - * Check if RTL Heap didn't give us a handle or said that this heap - * isn't movable. - */ - if (!(Handle) || !(Flags & BASE_HEAP_FLAG_MOVABLE)) - { - /* This implies we're not a handle heap, so use the generic call */ - dwSize = RtlSizeHeap(hProcessHeap, HEAP_NO_SERIALIZE, hMem); - } - else - { - /* Otherwise we're a handle heap, so get the internal handle */ - hMem = Handle; - } - } - - /* Make sure that this is an entry in our handle database */ - if ((ULONG_PTR)hMem & BASE_HEAP_IS_HANDLE_ENTRY) - { - /* Get the entry */ - HandleEntry = BaseHeapGetEntry(hMem); - BASE_TRACE_HANDLE(HandleEntry, hMem); - - /* Make sure the handle is valid */ - if (!BaseHeapValidateEntry(HandleEntry)) - { - /* Fail */ - BASE_TRACE_FAILURE(); - SetLastError(ERROR_INVALID_HANDLE); - } - else if (HandleEntry->Flags & BASE_HEAP_ENTRY_FLAG_REUSE) - { - /* We've reused this block, but we've saved the size for you */ - dwSize = HandleEntry->OldSize; - } - else - { - /* Otherwise, query RTL about it */ - dwSize = RtlSizeHeap(hProcessHeap, - HEAP_NO_SERIALIZE, - HandleEntry->Object); - } - } - - /* Check if by now, we still haven't gotten any useful size */ - if (dwSize == MAXULONG_PTR) - { - /* Fail */ - BASE_TRACE_FAILURE(); - SetLastError(ERROR_INVALID_HANDLE); - dwSize = 0; - } - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - SetLastError(ERROR_INVALID_HANDLE); - dwSize = 0; - } - _SEH2_END - - /* All done! Unlock heap and return the size */ - RtlUnlockHeap(hProcessHeap); - return dwSize; -} - -/* - * @implemented - */ -VOID -NTAPI -GlobalUnfix(HGLOBAL hMem) -{ - /* If the handle is valid, unlock it */ - if (hMem != INVALID_HANDLE_VALUE) GlobalUnlock(hMem); -} - -/* - * @implemented - */ -BOOL -NTAPI -GlobalUnlock(HGLOBAL hMem) -{ - PBASE_HEAP_HANDLE_ENTRY HandleEntry; - BOOL RetVal = TRUE; - - /* Check if this was a simple allocated heap entry */ - if (!((ULONG_PTR)hMem & BASE_HEAP_IS_HANDLE_ENTRY)) return RetVal; - - /* Otherwise, lock the heap */ - RtlLockHeap(hProcessHeap); - - /* Get the handle entry */ - HandleEntry = BaseHeapGetEntry(hMem); - BASE_TRACE_HANDLE(HandleEntry, hMem); - - _SEH2_TRY - { - /* Make sure it's valid */ - if (!BaseHeapValidateEntry(HandleEntry)) - { - /* It's not, fail */ - BASE_TRACE_FAILURE(); - SetLastError(ERROR_INVALID_HANDLE); - RetVal = FALSE; - } - else - { - /* Otherwise, decrement lock count, unless we're already at 0*/ - if (!HandleEntry->LockCount--) - { - /* In which case we simply lock it back and fail */ - HandleEntry->LockCount++; - SetLastError(ERROR_NOT_LOCKED); - RetVal = FALSE; - } - else if (!HandleEntry->LockCount) - { - /* Nothing to unlock */ - SetLastError(NO_ERROR); - RetVal = FALSE; - } - } - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - SetLastError(ERROR_INVALID_PARAMETER); - RetVal = FALSE; - } - _SEH2_END - - /* All done. Unlock the heap and return the pointer */ - RtlUnlockHeap(hProcessHeap); - return RetVal; -} - -/* - * @implemented - */ -BOOL -NTAPI -GlobalUnWire(HGLOBAL hMem) -{ - /* This is simply an unlock */ - return GlobalUnlock(hMem); -} - -/* - * @implemented - */ -LPVOID -NTAPI -GlobalWire(HGLOBAL hMem) -{ - /* This is just a lock */ - return GlobalLock(hMem); -} - -/* - * @implemented - */ -BOOL -NTAPI -GlobalMemoryStatusEx(LPMEMORYSTATUSEX lpBuffer) -{ - SYSTEM_PERFORMANCE_INFORMATION PerformanceInfo; - VM_COUNTERS VmCounters; - QUOTA_LIMITS QuotaLimits; - ULONGLONG PageFile, PhysicalMemory; - - /* Query performance information */ - NtQuerySystemInformation(SystemPerformanceInformation, - &PerformanceInfo, - sizeof(PerformanceInfo), - NULL); - - /* Calculate memory load */ - lpBuffer->dwMemoryLoad = ((DWORD)(BaseCachedSysInfo.NumberOfPhysicalPages - - PerformanceInfo.AvailablePages) * 100) / - BaseCachedSysInfo.NumberOfPhysicalPages; - - /* Save physical memory */ - PhysicalMemory = BaseCachedSysInfo.NumberOfPhysicalPages * - BaseCachedSysInfo.PageSize; - lpBuffer->ullTotalPhys = PhysicalMemory; - - /* Now save available physical memory */ - PhysicalMemory = PerformanceInfo.AvailablePages * - BaseCachedSysInfo.PageSize; - lpBuffer->ullAvailPhys = PhysicalMemory; - - /* Query VM and Quota Limits */ - NtQueryInformationProcess(NtCurrentProcess(), - ProcessQuotaLimits, - &QuotaLimits, - sizeof(QUOTA_LIMITS), - NULL); - NtQueryInformationProcess(NtCurrentProcess(), - ProcessVmCounters, - &VmCounters, - sizeof(VM_COUNTERS), - NULL); - - /* Save the commit limit */ - lpBuffer->ullTotalPageFile = min(QuotaLimits.PagefileLimit, - PerformanceInfo.CommitLimit); - - /* Calculate how many pages are left */ - PageFile = PerformanceInfo.CommitLimit - PerformanceInfo.CommittedPages; - - /* Save the total */ - lpBuffer->ullAvailPageFile = min(PageFile, - QuotaLimits.PagefileLimit - - VmCounters.PagefileUsage); - lpBuffer->ullAvailPageFile *= BaseCachedSysInfo.PageSize; - - /* Now calculate the total virtual space */ - lpBuffer->ullTotalVirtual = (BaseCachedSysInfo.MaximumUserModeAddress - - BaseCachedSysInfo.MinimumUserModeAddress) + 1; - - /* And finally the avilable virtual space */ - lpBuffer->ullAvailVirtual = lpBuffer->ullTotalVirtual - - VmCounters.VirtualSize; - lpBuffer->ullAvailExtendedVirtual = 0; - return TRUE; -} - -/* - * @implemented - */ -VOID -NTAPI -GlobalMemoryStatus(LPMEMORYSTATUS lpBuffer) -{ - MEMORYSTATUSEX lpBufferEx; - - /* Call the extended function */ - lpBufferEx.dwLength = sizeof(MEMORYSTATUSEX); - if (GlobalMemoryStatusEx(&lpBufferEx)) - { - /* Reset the right size and fill out the information */ - lpBuffer->dwLength = sizeof(MEMORYSTATUS); - lpBuffer->dwMemoryLoad = lpBufferEx.dwMemoryLoad; - lpBuffer->dwTotalPhys = (SIZE_T)lpBufferEx.ullTotalPhys; - lpBuffer->dwAvailPhys = (SIZE_T)lpBufferEx.ullAvailPhys; - lpBuffer->dwTotalPageFile = (SIZE_T)lpBufferEx.ullTotalPageFile; - lpBuffer->dwAvailPageFile = (SIZE_T)lpBufferEx.ullAvailPageFile; - lpBuffer->dwTotalVirtual = (SIZE_T)lpBufferEx.ullTotalVirtual; - lpBuffer->dwAvailVirtual = (SIZE_T)lpBufferEx.ullAvailVirtual; - } -} - -/* EOF */ diff --git a/dll/win32/kernel32/mem/heap.c b/dll/win32/kernel32/mem/heap.c deleted file mode 100644 index 80aefa15cbe..00000000000 --- a/dll/win32/kernel32/mem/heap.c +++ /dev/null @@ -1,343 +0,0 @@ -/* - * PROJECT: ReactOS Win32 Base API - * LICENSE: GPL - See COPYING in the top level directory - * FILE: dll/win32/kernel32/mem/heap.c - * PURPOSE: Heap Memory APIs (wrappers for RtlHeap*) - * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org) - */ - -/* INCLUDES ******************************************************************/ - -#include - -#define NDEBUG -#include - -/* TYPES *********************************************************************/ - -extern SYSTEM_BASIC_INFORMATION BaseCachedSysInfo; - -/* FUNCTIONS ***************************************************************/ - -/* - * @implemented - */ -HANDLE -WINAPI -HeapCreate(DWORD flOptions, - DWORD dwInitialSize, - DWORD dwMaximumSize) -{ - HANDLE hRet; - ULONG Flags; - - /* Remove non-Win32 flags and tag this allocation */ - Flags = (flOptions & (HEAP_GENERATE_EXCEPTIONS | HEAP_NO_SERIALIZE)) | - HEAP_CLASS_1; - - /* Check if heap is growable and ensure max size is correct */ - if (dwMaximumSize == 0) - Flags |= HEAP_GROWABLE; - else if (dwMaximumSize < BaseCachedSysInfo.PageSize && - dwInitialSize > dwMaximumSize) - { - /* Max size is non-zero but less than page size which can't be correct. - Fix it up by bumping it to the initial size whatever it is. */ - dwMaximumSize = dwInitialSize; - } - - /* Call RTL Heap */ - hRet = RtlCreateHeap(Flags, - NULL, - dwMaximumSize, - dwInitialSize, - NULL, - NULL); - - /* Set the last error if we failed, and return the pointer */ - if (!hRet) SetLastError(ERROR_NOT_ENOUGH_MEMORY); - return hRet; -} - -/* - * @implemented - */ -BOOL -WINAPI -HeapDestroy(HANDLE hHeap) -{ - /* Return TRUE if the heap was destroyed */ - if (!RtlDestroyHeap(hHeap)) return TRUE; - - /* Otherwise, we got the handle back, so fail */ - SetLastError(ERROR_INVALID_HANDLE); - return FALSE; -} - -/* - * @implemented - */ -HANDLE -WINAPI -GetProcessHeap(VOID) -{ - /* Call the RTL API */ - return RtlGetProcessHeap(); -} - -/* - * @implemented - */ -DWORD -WINAPI -GetProcessHeaps(DWORD NumberOfHeaps, - PHANDLE ProcessHeaps) -{ - /* Call the RTL API */ - return RtlGetProcessHeaps(NumberOfHeaps, ProcessHeaps); -} - -/* - * @implemented - */ -BOOL -WINAPI -HeapLock(HANDLE hHeap) -{ - /* Call the RTL API */ - return RtlLockHeap(hHeap); -} - -/* - * @implemented - */ -BOOL -WINAPI -HeapUnlock(HANDLE hHeap) -{ - /* Call the RTL API */ - return RtlUnlockHeap(hHeap); -} - -/* - * @implemented - */ -SIZE_T -WINAPI -HeapCompact(HANDLE hHeap, DWORD dwFlags) -{ - /* Call the RTL API */ - return RtlCompactHeap(hHeap, dwFlags); -} - -/* - * @implemented - */ -BOOL -WINAPI -HeapValidate(HANDLE hHeap, - DWORD dwFlags, - LPCVOID lpMem) -{ - /* Call the RTL API */ - return RtlValidateHeap(hHeap, dwFlags, (PVOID)lpMem); -} - -/* - * @implemented - */ -DWORD -WINAPI -HeapCreateTagsW(HANDLE hHeap, - DWORD dwFlags, - PWSTR lpTagName, - PWSTR lpTagSubName) -{ - /* Call the RTL API */ - return RtlCreateTagHeap(hHeap, - dwFlags, - lpTagName, - lpTagSubName); -} - -/* - * @implemented - */ -DWORD -WINAPI -HeapExtend(HANDLE hHeap, - DWORD dwFlags, - PVOID BaseAddress, - DWORD dwBytes) -{ - NTSTATUS Status; - - /* Call the RTL API. Gone in Vista, so commented out. */ - Status = STATUS_NOT_IMPLEMENTED; //RtlExtendHeap(hHeap, dwFlags, BaseAddress, dwBytes); - if (!NT_SUCCESS(Status)) - { - /* We failed */ - SetLastErrorByStatus(Status); - return FALSE; - } - - /* Return success */ - return TRUE; -} - -/* - * @implemented - */ -PWSTR -WINAPI -HeapQueryTagW(HANDLE hHeap, - DWORD dwFlags, - WORD wTagIndex, - BOOL bResetCounters, - PVOID lpTagInfo) -{ - /* Call the RTL API */ - return RtlQueryTagHeap(hHeap, - dwFlags, - wTagIndex, - (BOOLEAN)bResetCounters, - lpTagInfo); -} - -/* - * @implemented - */ -BOOL -WINAPI -HeapSummary(HANDLE hHeap, - DWORD dwFlags, - PVOID Summary) -{ - NTSTATUS Status; - RTL_HEAP_USAGE Usage; - - /* Fill in the length information */ - Usage.Length = sizeof(Usage); - - /* Call RTL. Gone in Vista, so commented out */ - Status = STATUS_NOT_IMPLEMENTED; //RtlUsageHeap(hHeap, dwFlags, &Usage); - if (!NT_SUCCESS(Status)) - { - /* We failed */ - SetLastErrorByStatus(Status); - return FALSE; - } - - /* FIXME: Summary == Usage?! */ - RtlCopyMemory(Summary, &Usage, sizeof(Usage)); - return TRUE; -} - -/* - * @implemented - */ -BOOL -WINAPI -HeapUsage(HANDLE hHeap, - DWORD dwFlags, - DWORD Unknown, - DWORD Unknown2, - IN PVOID Usage) -{ - NTSTATUS Status; - - /* Call RTL. Gone in Vista, so commented out */ - Status = STATUS_NOT_IMPLEMENTED; //RtlUsageHeap(hHeap, dwFlags, &Usage); - if (!NT_SUCCESS(Status)) - { - /* We failed */ - SetLastErrorByStatus(Status); - return FALSE; - } - else if (Status == STATUS_MORE_ENTRIES) - { - /* There are still more entries to parse */ - return TRUE; - } - - /* Otherwise, we're completely done, so we return FALSE, but NO_ERROR */ - SetLastError(NO_ERROR); - return FALSE; -} - -/* - * @implemented - */ -BOOL -WINAPI -HeapWalk(HANDLE hHeap, - LPPROCESS_HEAP_ENTRY lpEntry) -{ - NTSTATUS Status; - - Status = RtlWalkHeap(hHeap, lpEntry); - - if (!NT_SUCCESS(Status)) - { - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - return TRUE; -} - -/* - * @implemented - */ -BOOL -WINAPI -HeapQueryInformation(HANDLE HeapHandle, - HEAP_INFORMATION_CLASS HeapInformationClass, - PVOID HeapInformation OPTIONAL, - SIZE_T HeapInformationLength OPTIONAL, - PSIZE_T ReturnLength OPTIONAL) -{ - NTSTATUS Status; - - Status = RtlQueryHeapInformation(HeapHandle, - HeapInformationClass, - HeapInformation, - HeapInformationLength, - ReturnLength); - - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return FALSE; - } - - return TRUE; -} - -/* - * @implemented - */ -BOOL -WINAPI -HeapSetInformation(HANDLE HeapHandle, - HEAP_INFORMATION_CLASS HeapInformationClass, - PVOID HeapInformation OPTIONAL, - SIZE_T HeapInformationLength OPTIONAL) -{ - NTSTATUS Status; - - Status = RtlSetHeapInformation(HeapHandle, - HeapInformationClass, - HeapInformation, - HeapInformationLength); - - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return FALSE; - } - - return TRUE; -} - -/* EOF */ diff --git a/dll/win32/kernel32/mem/isbad.c b/dll/win32/kernel32/mem/isbad.c deleted file mode 100644 index 1b186f10530..00000000000 --- a/dll/win32/kernel32/mem/isbad.c +++ /dev/null @@ -1,240 +0,0 @@ -/* - * PROJECT: ReactOS Win32 Base API - * LICENSE: GPL - See COPYING in the top level directory - * FILE: dll/win32/kernel32/mem/isbad.c - * PURPOSE: Handles probing of memory addresses - * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org) - * Thomas Weidenmueller (w3seek@reactos.org) - */ - -/* INCLUDES ******************************************************************/ - -#include - -#define NDEBUG -#include - -extern SYSTEM_BASIC_INFORMATION BaseCachedSysInfo; - -/* FUNCTIONS *****************************************************************/ - -/* - * @implemented - */ -BOOL -WINAPI -IsBadReadPtr(IN LPCVOID lp, - IN UINT_PTR ucb) -{ - ULONG PageSize; - BOOLEAN Result = FALSE; - volatile CHAR *Current; - PCHAR Last; - - /* Quick cases */ - if (!ucb) return FALSE; - if (!lp) return TRUE; - - /* Get the page size */ - PageSize = BaseCachedSysInfo.PageSize; - - /* Calculate the last page */ - Last = (PCHAR)((ULONG_PTR)lp + ucb - 1); - - /* Another quick failure case */ - if ((ULONG_PTR)Last < (ULONG_PTR)lp) return TRUE; - - /* Enter SEH */ - _SEH2_TRY - { - /* Probe the entire range */ - Current = (volatile CHAR*)lp; - Last = (PCHAR)(PAGE_ROUND_DOWN(Last)); - do - { - *Current; - Current = (volatile CHAR*)(PAGE_ROUND_DOWN(Current) + PAGE_SIZE); - } while (Current <= Last); - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - /* We hit an exception, so return true */ - Result = TRUE; - } - _SEH2_END - - /* Return exception status */ - return Result; -} - -/* - * @implemented - */ -BOOL -NTAPI -IsBadHugeReadPtr(LPCVOID lp, - UINT_PTR ucb) -{ - /* Implementation is the same on 32-bit */ - return IsBadReadPtr(lp, ucb); -} - -/* - * @implemented - */ -BOOL -NTAPI -IsBadCodePtr(FARPROC lpfn) -{ - /* Executing has the same privileges as reading */ - return IsBadReadPtr((LPVOID)lpfn, 1); -} - -/* - * @implemented - */ -BOOL -NTAPI -IsBadWritePtr(LPVOID lp, - UINT_PTR ucb) -{ - ULONG PageSize; - BOOLEAN Result = FALSE; - volatile CHAR *Current; - PCHAR Last; - - /* Quick cases */ - if (!ucb) return FALSE; - if (!lp) return TRUE; - - /* Get the page size */ - PageSize = BaseCachedSysInfo.PageSize; - - /* Calculate the last page */ - Last = (PCHAR)((ULONG_PTR)lp + ucb - 1); - - /* Another quick failure case */ - if ((ULONG_PTR)Last < (ULONG_PTR)lp) return TRUE; - - /* Enter SEH */ - _SEH2_TRY - { - /* Probe the entire range */ - Current = (volatile CHAR*)lp; - Last = (PCHAR)(PAGE_ROUND_DOWN(Last)); - do - { - *Current = *Current; - Current = (volatile CHAR*)(PAGE_ROUND_DOWN(Current) + PAGE_SIZE); - } while (Current <= Last); - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - /* We hit an exception, so return true */ - Result = TRUE; - } - _SEH2_END - - /* Return exception status */ - return Result; -} - -/* - * @implemented - */ -BOOL -NTAPI -IsBadHugeWritePtr(LPVOID lp, - UINT_PTR ucb) -{ - /* Implementation is the same on 32-bit */ - return IsBadWritePtr(lp, ucb); -} - -/* - * @implemented - */ -BOOL -NTAPI -IsBadStringPtrW(IN LPCWSTR lpsz, - UINT_PTR ucchMax) -{ - BOOLEAN Result = FALSE; - volatile WCHAR *Current; - PWCHAR Last; - WCHAR Char; - - /* Quick cases */ - if (!ucchMax) return FALSE; - if (!lpsz) return TRUE; - - /* Calculate the last page */ - Last = (PWCHAR)((ULONG_PTR)lpsz + (ucchMax * 2) - 2); - - /* Enter SEH */ - _SEH2_TRY - { - /* Probe the entire range */ - Current = (volatile WCHAR*)lpsz; - Last = (PWCHAR)(PAGE_ROUND_DOWN(Last)); - do - { - Char = *Current; - Current++; - } while (Char && (Current != Last + 1)); - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - /* We hit an exception, so return true */ - Result = TRUE; - } - _SEH2_END - - /* Return exception status */ - return Result; -} - -/* - * @implemented - */ -BOOL -NTAPI -IsBadStringPtrA(IN LPCSTR lpsz, - UINT_PTR ucchMax) -{ - BOOLEAN Result = FALSE; - volatile CHAR *Current; - PCHAR Last; - CHAR Char; - - /* Quick cases */ - if (!ucchMax) return FALSE; - if (!lpsz) return TRUE; - - /* Calculate the last page */ - Last = (PCHAR)((ULONG_PTR)lpsz + ucchMax - 1); - - /* Enter SEH */ - _SEH2_TRY - { - /* Probe the entire range */ - Current = (volatile CHAR*)lpsz; - Last = (PCHAR)(PAGE_ROUND_DOWN(Last)); - do - { - Char = *Current; - Current++; - } while (Char && (Current != Last + 1)); - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - /* We hit an exception, so return true */ - Result = TRUE; - } - _SEH2_END - - /* Return exception status */ - return Result; -} - -/* EOF */ diff --git a/dll/win32/kernel32/mem/local.c b/dll/win32/kernel32/mem/local.c deleted file mode 100644 index 875ae4bce8a..00000000000 --- a/dll/win32/kernel32/mem/local.c +++ /dev/null @@ -1,502 +0,0 @@ -/* - * PROJECT: ReactOS Win32 Base API - * LICENSE: GPL - See COPYING in the top level directory - * FILE: dll/win32/kernel32/mem/local.c - * PURPOSE: Local Memory APIs (sits on top of Heap*) - * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org) - */ - -/* INCLUDES ******************************************************************/ - -#include - -#define NDEBUG -#include - -/* TYPES *********************************************************************/ - -extern SYSTEM_BASIC_INFORMATION BaseCachedSysInfo; - -/* FUNCTIONS ***************************************************************/ - -/* - * @implemented - */ -HLOCAL -NTAPI -LocalAlloc(UINT uFlags, - SIZE_T dwBytes) -{ - ULONG Flags = 0; - PVOID Ptr = NULL; - HANDLE hMemory; - PBASE_HEAP_HANDLE_ENTRY HandleEntry; - BASE_TRACE_ALLOC(dwBytes, uFlags); - ASSERT(hProcessHeap); - - /* Make sure the flags are valid */ - if (uFlags & ~LMEM_VALID_FLAGS) - { - /* They aren't, fail */ - BASE_TRACE_FAILURE(); - SetLastError(ERROR_INVALID_PARAMETER); - return NULL; - } - - /* Convert ZEROINIT */ - if (uFlags & LMEM_ZEROINIT) Flags |= HEAP_ZERO_MEMORY; - - /* Check if we're not movable, which means pointer-based heap */ - if (!(uFlags & LMEM_MOVEABLE)) - { - /* Allocate heap for it */ - Ptr = RtlAllocateHeap(hProcessHeap, Flags, dwBytes); - BASE_TRACE_ALLOC2(Ptr); - return Ptr; - } - - /* This is heap based, so lock it in first */ - RtlLockHeap(hProcessHeap); - - /* - * Disable locking, enable custom flags, and write the - * movable flag (deprecated) - */ - Flags |= HEAP_NO_SERIALIZE | - HEAP_SETTABLE_USER_VALUE | - BASE_HEAP_FLAG_MOVABLE; - - /* Allocate the handle */ - HandleEntry = BaseHeapAllocEntry(); - if (!HandleEntry) - { - /* Fail */ - hMemory = NULL; - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - BASE_TRACE_FAILURE(); - goto Quickie; - } - - /* Get the object and make sure we have size */ - hMemory = &HandleEntry->Object; - if (dwBytes) - { - /* Allocate the actual memory for it */ - Ptr = RtlAllocateHeap(hProcessHeap, Flags, dwBytes); - BASE_TRACE_PTR(HandleEntry, Ptr); - if (!Ptr) - { - /* We failed, manually set the allocate flag and free the handle */ - HandleEntry->Flags = RTL_HANDLE_VALID; - BaseHeapFreeEntry(HandleEntry); - - /* For the cleanup case */ - HandleEntry = NULL; - } - else - { - /* All worked well, save our heap entry */ - RtlSetUserValueHeap(hProcessHeap, HEAP_NO_SERIALIZE, Ptr, hMemory); - } - } - -Quickie: - /* Cleanup! First unlock the heap */ - RtlUnlockHeap(hProcessHeap); - - /* Check if a handle was allocated */ - if (HandleEntry) - { - /* Set the pointer and allocated flag */ - HandleEntry->Object = Ptr; - HandleEntry->Flags = RTL_HANDLE_VALID; - if (!Ptr) - { - /* We don't have a valid pointer, but so reuse this handle */ - HandleEntry->Flags |= BASE_HEAP_ENTRY_FLAG_REUSE; - } - - /* Check if the handle is discardable */ - if (uFlags & GMEM_DISCARDABLE) - { - /* Save it in the handle entry */ - HandleEntry->Flags |= BASE_HEAP_ENTRY_FLAG_REUSABLE; - } - - /* Check if the handle is moveable */ - if (uFlags & GMEM_MOVEABLE) - { - /* Save it in the handle entry */ - HandleEntry->Flags |= BASE_HEAP_ENTRY_FLAG_MOVABLE; - } - - /* Set the pointer */ - Ptr = hMemory; - } - - /* Return the pointer */ - return Ptr; -} - -/* - * @implemented - */ -SIZE_T -NTAPI -LocalCompact(UINT dwMinFree) -{ - /* Call the RTL Heap Manager */ - return RtlCompactHeap(hProcessHeap, 0); -} - -/* - * @implemented - */ -UINT -NTAPI -LocalFlags(HLOCAL hMem) -{ - PBASE_HEAP_HANDLE_ENTRY HandleEntry; - HANDLE Handle = NULL; - ULONG Flags = 0; - UINT uFlags = LMEM_INVALID_HANDLE; - - /* Start by locking the heap */ - RtlLockHeap(hProcessHeap); - - /* Check if this is a simple RTL Heap Managed block */ - if (!((ULONG_PTR)hMem & BASE_HEAP_IS_HANDLE_ENTRY)) - { - /* Then we'll query RTL Heap */ - RtlGetUserInfoHeap(hProcessHeap, Flags, hMem, &Handle, &Flags); - BASE_TRACE_PTR(Handle, hMem); - - /* - * Check if RTL Heap didn't find a handle associated with us or - * said that this heap isn't movable, which means something we're - * really not a handle-based heap. - */ - if (!(Handle) || !(Flags & BASE_HEAP_FLAG_MOVABLE)) - { - /* Then set the flags to 0 */ - uFlags = 0; - } - else - { - /* Otherwise we're handle-based, so get the internal handle */ - hMem = Handle; - } - } - - /* Check if the handle is actually an entry in our table */ - if ((ULONG_PTR)hMem & BASE_HEAP_IS_HANDLE_ENTRY) - { - /* Then get the entry */ - HandleEntry = BaseHeapGetEntry(hMem); - BASE_TRACE_HANDLE(HandleEntry, hMem); - - /* Make sure it's a valid handle */ - if (BaseHeapValidateEntry(HandleEntry)) - { - /* Get the lock count first */ - uFlags = HandleEntry->LockCount & LMEM_LOCKCOUNT; - - /* Now check if it's discardable */ - if (HandleEntry->Flags & BASE_HEAP_ENTRY_FLAG_REUSABLE) - { - /* Set the Win32 Flag */ - uFlags |= LMEM_DISCARDABLE; - } - - /* Now check if it's discarded */ - if (HandleEntry->Flags & BASE_HEAP_ENTRY_FLAG_REUSE) - /* Set the Win32 Flag */ - uFlags |= LMEM_DISCARDED; - } - } - - /* Check if by now, we still haven't gotten any useful flags */ - if (uFlags == LMEM_INVALID_HANDLE) SetLastError(ERROR_INVALID_HANDLE); - - /* All done! Unlock heap and return Win32 Flags */ - RtlUnlockHeap(hProcessHeap); - return uFlags; -} - -/* - * @implemented - */ -HLOCAL -NTAPI -LocalFree(HLOCAL hMem) -{ - /* This is identical to a Global Free */ - return GlobalFree(hMem); -} - -/* - * @implemented - */ -HLOCAL -NTAPI -LocalHandle(LPCVOID pMem) -{ - /* This is identical to a Global Handle */ - return GlobalHandle(pMem); -} - -/* - * @implemented - */ -LPVOID -NTAPI -LocalLock(HLOCAL hMem) -{ - /* This is the same as a GlobalLock, assuming these never change */ - C_ASSERT(LMEM_LOCKCOUNT == GMEM_LOCKCOUNT); - return GlobalLock(hMem); -} - -HLOCAL -NTAPI -LocalReAlloc(HLOCAL hMem, - SIZE_T dwBytes, - UINT uFlags) -{ - PBASE_HEAP_HANDLE_ENTRY HandleEntry; - LPVOID Ptr; - ULONG Flags = 0; - - /* Convert ZEROINIT */ - if (uFlags & LMEM_ZEROINIT) Flags |= HEAP_ZERO_MEMORY; - - /* If this wasn't a movable heap, then we MUST re-alloc in place */ - if (!(uFlags & LMEM_MOVEABLE)) Flags |= HEAP_REALLOC_IN_PLACE_ONLY; - - /* Lock the heap and disable built-in locking in the RTL Heap funcitons */ - RtlLockHeap(hProcessHeap); - Flags |= HEAP_NO_SERIALIZE; - - /* Check if this is a simple handle-based block */ - if (((ULONG_PTR)hMem & BASE_HEAP_IS_HANDLE_ENTRY)) - { - /* Get the entry */ - HandleEntry = BaseHeapGetEntry(hMem); - BASE_TRACE_HANDLE(HandleEntry, hMem); - - /* Make sure the handle is valid */ - if (!BaseHeapValidateEntry(HandleEntry)) - { - /* Fail */ - BASE_TRACE_FAILURE(); - SetLastError(ERROR_INVALID_HANDLE); - hMem = NULL; - } - else if (uFlags & LMEM_MODIFY) - { - /* User is changing flags... check if the memory was discardable */ - if (uFlags & LMEM_DISCARDABLE) - { - /* Then set the flag */ - HandleEntry->Flags |= BASE_HEAP_ENTRY_FLAG_REUSABLE; - } - else - { - /* Otherwise, remove the flag */ - HandleEntry->Flags &= BASE_HEAP_ENTRY_FLAG_REUSABLE; - } - } - else - { - /* Otherwise, get the object and check if we have no size */ - Ptr = HandleEntry->Object; - if (!dwBytes) - { - /* Clear the handle and check for a pointer */ - hMem = NULL; - if (Ptr) - { - /* Make sure the handle isn't locked */ - if ((uFlags & LMEM_MOVEABLE) && !(HandleEntry->LockCount)) - { - /* Free the current heap */ - RtlFreeHeap(hProcessHeap, Flags, Ptr); - - /* Free the handle */ - HandleEntry->Object = NULL; - HandleEntry->Flags |= BASE_HEAP_ENTRY_FLAG_REUSE; - - /* Get the object pointer */ - hMem = &HandleEntry->Object; - } - } - else - { - /* Otherwise just return the object pointer */ - hMem = &HandleEntry->Object; - } - } - else - { - /* Otherwise, we're allocating, so set the new flags needed */ - Flags |= HEAP_SETTABLE_USER_VALUE | BASE_HEAP_FLAG_MOVABLE; - if (!Ptr) - { - /* We don't have a base, so allocate one */ - Ptr = RtlAllocateHeap(hProcessHeap, Flags, dwBytes); - BASE_TRACE_ALLOC2(Ptr); - if (Ptr) - { - /* Allocation succeeded, so save our entry */ - RtlSetUserValueHeap(hProcessHeap, - HEAP_NO_SERIALIZE, - Ptr, - hMem); - } - } - else - { - /* - * If it's not movable or currently locked, we MUST allocate - * in-place! - */ - if (!(uFlags & LMEM_MOVEABLE) && (HandleEntry->LockCount)) - { - /* Set the flag */ - Flags |= HEAP_REALLOC_IN_PLACE_ONLY; - } - else - { - /* Otherwise clear the flag if we set it previously */ - Flags &= ~HEAP_REALLOC_IN_PLACE_ONLY; - } - - /* And do the re-allocation */ - Ptr = RtlReAllocateHeap(hProcessHeap, Flags, Ptr, dwBytes); - } - - /* Make sure we have a pointer by now */ - if (Ptr) - { - /* Write it in the handle entry and mark it in use */ - HandleEntry->Object = Ptr; - HandleEntry->Flags &= ~BASE_HEAP_ENTRY_FLAG_REUSE; - } - else - { - /* Otherwise we failed */ - hMem = NULL; - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - } - } - } - } - else if (!(uFlags & LMEM_MODIFY)) - { - /* Otherwise, this is a simple RTL Managed Heap, so just call it */ - hMem = RtlReAllocateHeap(hProcessHeap, - Flags | HEAP_NO_SERIALIZE, - hMem, - dwBytes); - if (!hMem) - { - /* Fail */ - BASE_TRACE_FAILURE(); - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - } - } - - /* All done, unlock the heap and return the pointer */ - RtlUnlockHeap(hProcessHeap); - return hMem; -} - -/* - * @implemented - */ -SIZE_T -WINAPI -LocalShrink(HLOCAL hMem, - UINT cbNewSize) -{ - /* Call RTL */ - return RtlCompactHeap(hProcessHeap, 0); -} - -/* - * @implemented - */ -SIZE_T -NTAPI -LocalSize(HLOCAL hMem) -{ - /* This is the same as a Global Size */ - return GlobalSize(hMem); -} - -/* - * @implemented - */ -BOOL -NTAPI -LocalUnlock(HLOCAL hMem) -{ - PBASE_HEAP_HANDLE_ENTRY HandleEntry; - BOOL RetVal = TRUE; - - /* Check if this was a simple allocated heap entry */ - if (!((ULONG_PTR)hMem & BASE_HEAP_IS_HANDLE_ENTRY)) - { - /* Fail, because LocalUnlock is not supported on LMEM_FIXED allocations */ - SetLastError(ERROR_NOT_LOCKED); - return FALSE; - } - - /* Otherwise, lock the heap */ - RtlLockHeap(hProcessHeap); - - /* Get the handle entry */ - HandleEntry = BaseHeapGetEntry(hMem); - BASE_TRACE_HANDLE(HandleEntry, hMem); - - _SEH2_TRY - { - /* Make sure it's valid */ - if (!BaseHeapValidateEntry(HandleEntry)) - { - /* It's not, fail */ - BASE_TRACE_FAILURE(); - SetLastError(ERROR_INVALID_HANDLE); - RetVal = FALSE; - } - else - { - /* Otherwise, decrement lock count, unless we're already at 0*/ - if (!HandleEntry->LockCount--) - { - /* In which case we simply lock it back and fail */ - HandleEntry->LockCount++; - SetLastError(ERROR_NOT_LOCKED); - RetVal = FALSE; - } - else if (!HandleEntry->LockCount) - { - /* Nothing to unlock */ - SetLastError(NO_ERROR); - RetVal = FALSE; - } - } - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - SetLastError(ERROR_INVALID_PARAMETER); - RetVal = FALSE; - } - _SEH2_END - - /* All done. Unlock the heap and return the pointer */ - RtlUnlockHeap(hProcessHeap); - return RetVal; -} - -/* EOF */ diff --git a/dll/win32/kernel32/mem/procmem.c b/dll/win32/kernel32/mem/procmem.c deleted file mode 100644 index 354804e75c6..00000000000 --- a/dll/win32/kernel32/mem/procmem.c +++ /dev/null @@ -1,156 +0,0 @@ -/* - * PROJECT: ReactOS Win32 Base API - * LICENSE: GPL - See COPYING in the top level directory - * FILE: dll/win32/kernel32/mem/procmem.c - * PURPOSE: Handles virtual memory APIs - * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org) - */ - -/* INCLUDES ******************************************************************/ - -#include - -#define NDEBUG -#include - -/* FUNCTIONS *****************************************************************/ - -/* - * @implemented - */ -BOOL -NTAPI -ReadProcessMemory(IN HANDLE hProcess, - IN LPCVOID lpBaseAddress, - IN LPVOID lpBuffer, - IN SIZE_T nSize, - OUT SIZE_T* lpNumberOfBytesRead) -{ - NTSTATUS Status; - - /* Do the read */ - Status = NtReadVirtualMemory(hProcess, - (PVOID)lpBaseAddress, - lpBuffer, - nSize, - lpNumberOfBytesRead); - if (!NT_SUCCESS(Status)) - { - /* We failed */ - SetLastErrorByStatus (Status); - return FALSE; - } - - /* Return success */ - return TRUE; -} - -/* - * @implemented - */ -BOOL -NTAPI -WriteProcessMemory(IN HANDLE hProcess, - IN LPVOID lpBaseAddress, - IN LPCVOID lpBuffer, - IN SIZE_T nSize, - OUT SIZE_T *lpNumberOfBytesWritten) -{ - NTSTATUS Status; - ULONG OldValue; - SIZE_T RegionSize; - PVOID Base; - BOOLEAN UnProtect; - - /* Set parameters for protect call */ - RegionSize = nSize; - Base = lpBaseAddress; - - /* Check the current status */ - Status = NtProtectVirtualMemory(hProcess, - &Base, - &RegionSize, - PAGE_EXECUTE_READWRITE, - &OldValue); - if (NT_SUCCESS(Status)) - { - /* Check if we are unprotecting */ - UnProtect = OldValue & (PAGE_READWRITE | - PAGE_WRITECOPY | - PAGE_EXECUTE_READWRITE | - PAGE_EXECUTE_WRITECOPY) ? FALSE : TRUE; - if (!UnProtect) - { - /* Set the new protection */ - Status = NtProtectVirtualMemory(hProcess, - &Base, - &RegionSize, - OldValue, - &OldValue); - - /* Write the memory */ - Status = NtWriteVirtualMemory(hProcess, - lpBaseAddress, - (LPVOID)lpBuffer, - nSize, - lpNumberOfBytesWritten); - if (!NT_SUCCESS(Status)) - { - /* We failed */ - SetLastErrorByStatus(Status); - return FALSE; - } - - /* Flush the ITLB */ - NtFlushInstructionCache(hProcess, lpBaseAddress, nSize); - return TRUE; - } - else - { - /* Check if we were read only */ - if ((OldValue & PAGE_NOACCESS) || (OldValue & PAGE_READONLY)) - { - /* Restore protection and fail */ - NtProtectVirtualMemory(hProcess, - &Base, - &RegionSize, - OldValue, - &OldValue); - SetLastErrorByStatus(STATUS_ACCESS_VIOLATION); - return FALSE; - } - - /* Otherwise, do the write */ - Status = NtWriteVirtualMemory(hProcess, - lpBaseAddress, - (LPVOID)lpBuffer, - nSize, - lpNumberOfBytesWritten); - - /* And restore the protection */ - NtProtectVirtualMemory(hProcess, - &Base, - &RegionSize, - OldValue, - &OldValue); - if (!NT_SUCCESS(Status)) - { - /* We failed */ - SetLastErrorByStatus(STATUS_ACCESS_VIOLATION); - return FALSE; - } - - /* Flush the ITLB */ - NtFlushInstructionCache(hProcess, lpBaseAddress, nSize); - return TRUE; - } - } - else - { - /* We failed */ - SetLastErrorByStatus(Status); - return FALSE; - } -} - -/* EOF */ diff --git a/dll/win32/kernel32/mem/resnotify.c b/dll/win32/kernel32/mem/resnotify.c deleted file mode 100644 index 2251702f519..00000000000 --- a/dll/win32/kernel32/mem/resnotify.c +++ /dev/null @@ -1,103 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: lib/kernel32/mem/resnotify.c - * PURPOSE: Memory Resource Notification - * PROGRAMMER: Thomas Weidenmueller - */ - -/* INCLUDES ******************************************************************/ - -#include - -#define NDEBUG -#include - -/* FUNCTIONS *****************************************************************/ - -/* - * @implemented - */ -HANDLE -WINAPI -CreateMemoryResourceNotification( - MEMORY_RESOURCE_NOTIFICATION_TYPE NotificationType - ) -{ - UNICODE_STRING EventName; - OBJECT_ATTRIBUTES ObjectAttributes; - HANDLE hEvent; - NTSTATUS Status; - - switch(NotificationType) - { - case LowMemoryResourceNotification: - RtlInitUnicodeString(&EventName, L"\\KernelObjects\\LowMemoryCondition"); - break; - - case HighMemoryResourceNotification: - RtlInitUnicodeString(&EventName, L"\\KernelObjects\\HighMemoryCondition"); - break; - - default: - SetLastError(ERROR_INVALID_PARAMETER); - return NULL; - } - - InitializeObjectAttributes(&ObjectAttributes, - &EventName, - 0, - hBaseDir, - NULL); - - Status = NtOpenEvent(&hEvent, - EVENT_QUERY_STATE | SYNCHRONIZE, - &ObjectAttributes); - if(!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return NULL; - } - - return hEvent; -} - - -/* - * @implemented - */ -BOOL -WINAPI -QueryMemoryResourceNotification( - HANDLE ResourceNotificationHandle, - PBOOL ResourceState - ) -{ - EVENT_BASIC_INFORMATION ebi; - NTSTATUS Status; - - if(ResourceState != NULL) - { - Status = NtQueryEvent(ResourceNotificationHandle, - EventBasicInformation, - &ebi, - sizeof(ebi), - NULL); - if(NT_SUCCESS(Status)) - { - *ResourceState = ebi.EventState; - return TRUE; - } - - SetLastErrorByStatus(Status); - } - else /* ResourceState == NULL */ - { - SetLastError(ERROR_INVALID_PARAMETER); - } - - return FALSE; -} - -/* EOF */ diff --git a/dll/win32/kernel32/misc/chartype.c b/dll/win32/kernel32/misc/chartype.c deleted file mode 100644 index d9ba86b4f17..00000000000 --- a/dll/win32/kernel32/misc/chartype.c +++ /dev/null @@ -1,2009 +0,0 @@ -/* $Id$ - * - * KERNEL32.DLL locale functions - * - * Ported from Wine - * Copyright 1995 Martin von Loewis - * Copyright 1998 David Lee Lambert - * Copyright 2000 Julio Csar Gzquez - * Copyright 2002 Alexandre Julliard for CodeWeavers - * - */ - -#include - -#define NDEBUG -#include - -/* the character type contains the C1_* flags in the low 12 bits */ -/* and the C2_* type in the high 4 bits */ -#define GetCharType(Ch) (CharTypeTable[CharTypeTable[(Ch) >> 8] + ((Ch) & 0xff)]) - -static const unsigned short CharTypeTable[] = -{ - /* offsets */ - 0x0100, 0x0200, 0x0300, 0x0400, 0x0500, 0x0600, 0x0700, 0x0800, - 0x0900, 0x0a00, 0x0b00, 0x0c00, 0x0d00, 0x0e00, 0x0f00, 0x1000, - 0x1100, 0x1200, 0x1300, 0x1400, 0x1500, 0x1600, 0x1700, 0x1800, - 0x1900, 0x1a00, 0x0900, 0x0900, 0x0900, 0x1b00, 0x1c00, 0x1d00, - 0x1e00, 0x1f00, 0x2000, 0x2100, 0x2200, 0x2300, 0x2400, 0x2500, - 0x2300, 0x2300, 0x2300, 0x2600, 0x0900, 0x0900, 0x2700, 0x2800, - 0x2900, 0x2a00, 0x2b00, 0x2c00, 0x1600, 0x1600, 0x1600, 0x1600, - 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, - 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, - 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, 0x2d00, 0x1600, 0x1600, - 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, - 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, - 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, - 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, - 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, - 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, - 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, - 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, - 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, - 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, 0x2e00, - 0x1600, 0x1600, 0x1600, 0x1600, 0x2f00, 0x0900, 0x0900, 0x0900, - 0x0900, 0x0900, 0x0900, 0x0900, 0x1600, 0x1600, 0x1600, 0x1600, - 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, - 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, - 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, - 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, - 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, 0x1600, 0x3000, - 0x3100, 0x3100, 0x3100, 0x3100, 0x3100, 0x3100, 0x3100, 0x3100, - 0x3100, 0x3100, 0x3100, 0x3100, 0x3100, 0x3100, 0x3100, 0x3100, - 0x3100, 0x3100, 0x3100, 0x3100, 0x3100, 0x3100, 0x3100, 0x3100, - 0x3100, 0x3100, 0x3100, 0x3100, 0x3100, 0x3100, 0x3100, 0x3100, - 0x3100, 0x1600, 0x3200, 0x3300, 0x3400, 0x3500, 0x3600, 0x3700, - /* values */ - 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, - 0x0020, 0x9068, 0x8028, 0x9028, 0xa028, 0x8028, 0x0020, 0x0020, - 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, - 0x0020, 0x0020, 0x0020, 0x0020, 0x8020, 0x8020, 0x8020, 0x9020, - 0xa048, 0xb010, 0xb010, 0x5010, 0x5010, 0x5010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0x5010, 0x7010, 0x5010, 0x7010, 0x4010, - 0x3084, 0x3084, 0x3084, 0x3084, 0x3084, 0x3084, 0x3084, 0x3084, - 0x3084, 0x3084, 0x7010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0x1181, 0x1181, 0x1181, 0x1181, 0x1181, 0x1181, 0x1101, - 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, - 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, - 0x1101, 0x1101, 0x1101, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0x1182, 0x1182, 0x1182, 0x1182, 0x1182, 0x1182, 0x1102, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, - 0x1102, 0x1102, 0x1102, 0xb010, 0xb010, 0xb010, 0xb010, 0x0020, - 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x8020, 0x0020, 0x0020, - 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, - 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, - 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, - 0x7048, 0xb010, 0x5010, 0x5010, 0x5010, 0x5010, 0xb010, 0xb010, - 0xb010, 0xb010, 0x1102, 0xb010, 0xb010, 0xb000, 0xb010, 0xb010, - 0x5010, 0x5010, 0x3010, 0x3010, 0xb010, 0x1102, 0xb010, 0xb010, - 0xb010, 0x3010, 0x1102, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, - 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, - 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0xb010, - 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1102, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0xb010, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, - 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, - 0x1102, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1102, - 0x1102, 0x1101, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1101, - 0x1102, 0x1101, 0x1101, 0x1101, 0x1102, 0x1102, 0x1101, 0x1101, - 0x1101, 0x1101, 0x1102, 0x1101, 0x1101, 0x1102, 0x1101, 0x1101, - 0x1101, 0x1102, 0x1102, 0x1102, 0x1101, 0x1101, 0x1102, 0x1101, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1101, - 0x1102, 0x1101, 0x1102, 0x1102, 0x1101, 0x1102, 0x1101, 0x1101, - 0x1102, 0x1101, 0x1101, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, - 0x1101, 0x1102, 0x1102, 0x1100, 0x1101, 0x1102, 0x1102, 0x1102, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1101, 0x1103, 0x1102, 0x1101, - 0x1103, 0x1102, 0x1101, 0x1103, 0x1102, 0x1101, 0x1102, 0x1101, - 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, - 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1102, 0x1101, 0x1103, 0x1102, 0x1101, 0x1102, 0x1101, 0x1101, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1102, 0x1102, 0x1102, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0xb010, 0xb010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0x1010, 0x1010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0x1010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, - 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, - 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, - 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, - 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, - 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, - 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, - 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, - 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0112, 0x0010, 0x0010, - 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, - 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0010, 0x0010, 0x0010, - 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, - 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, - 0x0000, 0x0000, 0x0000, 0x0000, 0xb010, 0xb010, 0x0000, 0x0000, - 0x0000, 0x0000, 0x1010, 0x0000, 0x0000, 0x0000, 0xb010, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0xb010, 0xb010, 0x1101, 0xb010, - 0x1101, 0x1101, 0x1101, 0x0000, 0x1101, 0x0000, 0x1101, 0x1101, - 0x1102, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, - 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, - 0x1101, 0x1101, 0x0000, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, - 0x1101, 0x1101, 0x1101, 0x1101, 0x1102, 0x1102, 0x1102, 0x1102, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x0000, - 0x1102, 0x1102, 0x1101, 0x1101, 0x1101, 0x1102, 0x1102, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1101, 0x1102, 0xb010, 0x1101, - 0x1102, 0x1101, 0x1101, 0x1102, 0x0000, 0x0000, 0x0000, 0x0000, - 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, - 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, - 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, - 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, - 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, - 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0000, - 0x0010, 0x0010, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, - 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x0000, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x0000, 0x0000, - 0x1101, 0x1102, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, - 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, - 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, - 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, - 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x0000, - 0x0000, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x0000, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, - 0x0000, 0x1010, 0xb010, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, - 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, - 0x0010, 0x0010, 0x0000, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, - 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, - 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, - 0x0010, 0x0010, 0x0000, 0x0010, 0x0010, 0x0010, 0x2010, 0x0010, - 0x2010, 0x0010, 0x0010, 0x2010, 0x0010, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x2100, 0x2100, 0x2100, 0x2010, 0x2010, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x2000, 0x2000, 0x2000, 0x2000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x7010, 0x2010, 0xb010, 0xb010, - 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x2010, 0x0000, 0x0000, 0x0000, 0x2010, - 0x0000, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x2010, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, - 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, - 0x0010, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x6004, 0x6004, 0x6004, 0x6004, 0x6004, 0x6004, 0x6004, 0x6004, - 0x6004, 0x6004, 0x5010, 0x6010, 0x6010, 0x2010, 0x2100, 0x2100, - 0x0010, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2010, 0x2100, 0x0010, 0x0010, - 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x2000, 0x0010, 0x0010, - 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x2010, 0x2010, 0x0010, - 0x0010, 0xb010, 0x0010, 0x0010, 0x0010, 0x0010, 0x2100, 0x2100, - 0x3004, 0x3004, 0x3004, 0x3004, 0x3004, 0x3004, 0x3004, 0x3004, - 0x3004, 0x3004, 0x2100, 0x2100, 0x2100, 0x2010, 0x2010, 0x2100, - 0x2010, 0x2010, 0x2010, 0x2010, 0x2010, 0x2010, 0x2010, 0x2010, - 0x2010, 0x2010, 0x2010, 0x2010, 0x2010, 0x2010, 0x0000, 0x0000, - 0x2100, 0x0010, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, - 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, - 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, - 0x0010, 0x0010, 0x0010, 0x0000, 0x0000, 0x2100, 0x2100, 0x2100, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x0010, 0x0010, - 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, - 0x0010, 0x2100, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0010, 0x0010, 0x1010, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x0000, 0x0000, 0x0010, 0x1100, 0x1010, 0x1010, - 0x1010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, - 0x0010, 0x1010, 0x1010, 0x1010, 0x1010, 0x0010, 0x0000, 0x0000, - 0x1100, 0x0010, 0x0010, 0x0010, 0x0010, 0x0000, 0x0000, 0x0000, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x0010, 0x0010, 0x1010, 0x1010, 0x1004, 0x1004, - 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, - 0x1010, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0010, 0x1010, 0x1010, 0x0000, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x0000, 0x0000, 0x1100, - 0x1100, 0x0000, 0x0000, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x0000, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x0000, 0x1100, 0x0000, 0x0000, 0x0000, 0x1100, 0x1100, - 0x1100, 0x1100, 0x0000, 0x0000, 0x0010, 0x1100, 0x1010, 0x1010, - 0x1010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0000, 0x0000, 0x1010, - 0x1010, 0x0000, 0x0000, 0x1010, 0x1010, 0x0010, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1010, - 0x0000, 0x0000, 0x0000, 0x0000, 0x1100, 0x1100, 0x0000, 0x1100, - 0x1100, 0x1100, 0x0010, 0x0010, 0x0000, 0x0000, 0x1004, 0x1004, - 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, - 0x1100, 0x1100, 0x5010, 0x5010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0010, 0x0010, 0x1010, 0x0000, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x0000, 0x0000, 0x0000, 0x0000, 0x1100, - 0x1100, 0x0000, 0x0000, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x0000, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x0000, 0x1100, 0x1100, 0x0000, 0x1100, 0x1100, 0x0000, - 0x1100, 0x1100, 0x0000, 0x0000, 0x0010, 0x0000, 0x1010, 0x1010, - 0x1010, 0x0010, 0x0010, 0x0000, 0x0000, 0x0000, 0x0000, 0x0010, - 0x0010, 0x0000, 0x0000, 0x0010, 0x0010, 0x0010, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x1100, 0x1100, 0x1100, 0x1100, 0x0000, 0x1100, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1004, 0x1004, - 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, - 0x0010, 0x0010, 0x1100, 0x1100, 0x1100, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0010, 0x0010, 0x1010, 0x0000, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x0000, 0x1100, - 0x1100, 0x1100, 0x0000, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x0000, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x0000, 0x1100, 0x1100, 0x0000, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x0000, 0x0000, 0x0010, 0x1100, 0x1010, 0x1010, - 0x1010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0000, 0x0010, - 0x0010, 0x1010, 0x0000, 0x1010, 0x1010, 0x0010, 0x0000, 0x0000, - 0x1100, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x1100, 0x1100, 0x0010, 0x0010, 0x0000, 0x0000, 0x1004, 0x1004, - 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, - 0x0000, 0x5010, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0010, 0x1010, 0x1010, 0x0000, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x0000, 0x0000, 0x1100, - 0x1100, 0x0000, 0x0000, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x0000, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x0000, 0x1100, 0x1100, 0x0000, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x0000, 0x0000, 0x0010, 0x1100, 0x1010, 0x0010, - 0x1010, 0x0010, 0x0010, 0x0010, 0x0000, 0x0000, 0x0000, 0x1010, - 0x1010, 0x0000, 0x0000, 0x1010, 0x1010, 0x0010, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0010, 0x1010, - 0x0000, 0x0000, 0x0000, 0x0000, 0x1100, 0x1100, 0x0000, 0x1100, - 0x1100, 0x1100, 0x0000, 0x0000, 0x0000, 0x0000, 0x1004, 0x1004, - 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, - 0x1010, 0x1100, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0010, 0x1100, 0x0000, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x0000, 0x0000, 0x0000, 0x1100, 0x1100, - 0x1100, 0x0000, 0x1100, 0x1100, 0x1100, 0x1100, 0x0000, 0x0000, - 0x0000, 0x1100, 0x1100, 0x0000, 0x1100, 0x0000, 0x1100, 0x1100, - 0x0000, 0x0000, 0x0000, 0x1100, 0x1100, 0x0000, 0x0000, 0x0000, - 0x1100, 0x1100, 0x1100, 0x0000, 0x0000, 0x0000, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x0000, 0x1100, - 0x1100, 0x1100, 0x0000, 0x0000, 0x0000, 0x0000, 0x1010, 0x1010, - 0x0010, 0x1010, 0x1010, 0x0000, 0x0000, 0x0000, 0x1010, 0x1010, - 0x1010, 0x0000, 0x1010, 0x1010, 0x1010, 0x0010, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1010, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1004, - 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, - 0x1010, 0x1010, 0x1010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0x5010, 0xb010, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x1010, 0x1010, 0x1010, 0x0000, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x0000, 0x1100, 0x1100, - 0x1100, 0x0000, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x0000, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x0000, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x0000, 0x0000, 0x0000, 0x0000, 0x0010, 0x0010, - 0x0010, 0x1010, 0x1010, 0x1010, 0x1010, 0x0000, 0x0010, 0x0010, - 0x0010, 0x0000, 0x0010, 0x0010, 0x0010, 0x0010, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0010, 0x0010, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x1100, 0x1100, 0x0000, 0x0000, 0x0000, 0x0000, 0x1004, 0x1004, - 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x1010, 0x1010, 0x0000, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x0000, 0x1100, 0x1100, - 0x1100, 0x0000, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x0000, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x0000, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x0000, 0x0000, 0x0010, 0x1100, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x0000, 0x1010, 0x1010, - 0x1010, 0x0000, 0x1010, 0x1010, 0x0010, 0x0010, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1010, 0x1010, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1100, 0x0000, - 0x1100, 0x1100, 0x0000, 0x0000, 0x0000, 0x0000, 0x1004, 0x1004, - 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x1010, 0x1010, 0x0000, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x0000, 0x1100, 0x1100, - 0x1100, 0x0000, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x0000, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x0000, 0x0000, 0x0000, 0x0000, 0x1010, 0x1010, - 0x1010, 0x0010, 0x0010, 0x0010, 0x0000, 0x0000, 0x1010, 0x1010, - 0x1010, 0x0000, 0x1010, 0x1010, 0x1010, 0x0010, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1010, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x1100, 0x1100, 0x0000, 0x0000, 0x0000, 0x0000, 0x1004, 0x1004, - 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x1010, 0x1010, 0x0000, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x0000, - 0x0000, 0x0000, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x0000, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x0000, 0x1100, 0x0000, 0x0000, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x0000, - 0x0000, 0x0000, 0x0010, 0x0000, 0x0000, 0x0000, 0x0000, 0x1010, - 0x1010, 0x1010, 0x0010, 0x0010, 0x0010, 0x0000, 0x0010, 0x0000, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x1010, 0x1010, 0x1010, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x0010, 0x1100, 0x1100, 0x0010, 0x0010, 0x0010, 0x0010, - 0x0010, 0x0010, 0x0010, 0x0000, 0x0000, 0x0000, 0x0000, 0x5010, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1010, 0x0010, - 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x1010, - 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, - 0x1004, 0x1004, 0x1010, 0x1010, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x1100, 0x1100, 0x0000, 0x1100, 0x0000, 0x0000, 0x1100, - 0x1100, 0x0000, 0x1100, 0x0000, 0x0000, 0x1100, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x1100, 0x1100, 0x1100, 0x1100, - 0x0000, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x0000, 0x1100, 0x1100, 0x1100, 0x0000, 0x1100, 0x0000, 0x1100, - 0x0000, 0x0000, 0x1100, 0x1100, 0x0000, 0x1100, 0x1100, 0x1100, - 0x1100, 0x0010, 0x1100, 0x1100, 0x0010, 0x0010, 0x0010, 0x0010, - 0x0010, 0x0010, 0x0000, 0x0010, 0x0010, 0x1100, 0x0000, 0x0000, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x0000, 0x1010, 0x0000, - 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0000, 0x0000, - 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, - 0x1004, 0x1004, 0x0000, 0x0000, 0x1100, 0x1100, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x1100, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x0010, 0x0010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, - 0x1004, 0x1004, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x0010, 0x1010, 0x0010, - 0x1010, 0x0010, 0xb010, 0xb010, 0xb010, 0xb010, 0x1010, 0x1010, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x0000, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, - 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x1010, - 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x1010, 0x0010, 0x0010, - 0x1100, 0x1100, 0x1100, 0x1100, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, - 0x0000, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, - 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, - 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, - 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, - 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0000, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x0010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x0000, 0x0000, 0x1010, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x0000, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x0000, 0x1100, 0x1100, 0x0000, 0x1010, 0x0010, 0x0010, 0x0010, - 0x0010, 0x1010, 0x0010, 0x0000, 0x0000, 0x0000, 0x0010, 0x0010, - 0x1010, 0x0010, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, - 0x1004, 0x1004, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1010, 0x1010, - 0x0010, 0x0010, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, - 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, - 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, - 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, - 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x0000, 0x0000, 0x1010, 0x0000, 0x0000, 0x0000, 0x0000, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x0000, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x0000, - 0x1100, 0x0000, 0x1100, 0x1100, 0x1100, 0x1100, 0x0000, 0x0000, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x0000, - 0x1100, 0x0000, 0x1100, 0x1100, 0x1100, 0x1100, 0x0000, 0x0000, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x0000, - 0x1100, 0x0000, 0x1100, 0x1100, 0x1100, 0x1100, 0x0000, 0x0000, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x0000, - 0x1100, 0x0000, 0x1100, 0x1100, 0x1100, 0x1100, 0x0000, 0x0000, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x0000, - 0x1100, 0x0000, 0x1100, 0x1100, 0x1100, 0x1100, 0x0000, 0x0000, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x0000, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x0000, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x0000, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x0000, - 0x1100, 0x0000, 0x1100, 0x1100, 0x1100, 0x1100, 0x0000, 0x0000, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x0000, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x0000, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, - 0x1004, 0x1004, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1010, 0x1010, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0xa008, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0xb010, 0xb010, 0x0000, 0x0000, 0x0000, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x0000, 0x1100, 0x1100, - 0x1100, 0x1100, 0x0010, 0x0010, 0x0010, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x0010, 0x0010, 0x0010, 0x1010, 0x1010, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x0010, 0x0010, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x0000, 0x1100, 0x1100, - 0x1100, 0x0000, 0x0010, 0x0010, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1000, 0x1000, 0x1010, 0x0010, - 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x0010, 0x1010, - 0x1010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, - 0x0010, 0x0010, 0x0010, 0x0010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x5010, 0x1100, 0x0010, 0x0000, 0x0000, - 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, - 0x1004, 0x1004, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0x0010, 0x0010, 0x0010, 0xa008, 0x0000, - 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, - 0x1004, 0x1004, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1010, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x0010, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x0000, 0x0000, 0x0000, - 0x0010, 0x0010, 0x0010, 0x1010, 0x1010, 0x1010, 0x1010, 0x0010, - 0x0010, 0x0010, 0x0010, 0x0010, 0x0000, 0x0000, 0x0000, 0x0000, - 0x1010, 0x1010, 0x0010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x0010, 0x0010, 0x0010, 0x0000, 0x0000, 0x0000, 0x0000, - 0xb010, 0x0000, 0x0000, 0x0000, 0xb010, 0xb010, 0x1004, 0x1004, - 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, 0x1004, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x0000, 0x0000, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, - 0x1102, 0x1102, 0x1102, 0x1102, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1102, 0x1102, - 0x1102, 0x1102, 0x1102, 0x1102, 0x0000, 0x0000, 0x0000, 0x0000, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, 0x1101, 0x1102, - 0x1101, 0x1102, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, - 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x0000, 0x0000, - 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x0000, 0x0000, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, - 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, - 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x0000, 0x0000, - 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x0000, 0x0000, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, - 0x0000, 0x1101, 0x0000, 0x1101, 0x0000, 0x1101, 0x0000, 0x1101, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, - 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x0000, 0x0000, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, - 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, - 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, - 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x0000, 0x1102, 0x1102, - 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0xb010, 0x1102, 0xb010, - 0xb010, 0xb010, 0x1102, 0x1102, 0x1102, 0x0000, 0x1102, 0x1102, - 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0xb010, 0xb010, 0xb010, - 0x1102, 0x1102, 0x1102, 0x1102, 0x0000, 0x0000, 0x1102, 0x1102, - 0x1101, 0x1101, 0x1101, 0x1101, 0x0000, 0xb010, 0xb010, 0xb010, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, - 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0xb010, 0xb010, 0xb010, - 0x0000, 0x0000, 0x1102, 0x1102, 0x1102, 0x0000, 0x1102, 0x1102, - 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0xb010, 0xb010, 0x0000, - 0xa008, 0xa008, 0xa008, 0xa008, 0xa008, 0xa008, 0xa008, 0xa008, - 0xa008, 0xa008, 0xa008, 0x0008, 0x0000, 0x0000, 0x1000, 0x2000, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xa000, 0x8000, 0xb000, 0xb000, 0xb000, 0xb000, 0xb000, 0xa008, - 0x5010, 0x5010, 0x5010, 0x5010, 0x5010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0x0000, 0x0000, 0xb010, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa008, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x3010, 0x1102, 0x0000, 0x0000, 0x3010, 0x3010, 0x3010, 0x3010, - 0x3010, 0x3010, 0x5010, 0x5010, 0xb010, 0xb010, 0xb010, 0x1102, - 0x3010, 0x3010, 0x3010, 0x3010, 0x3010, 0x3010, 0x3010, 0x3010, - 0x3010, 0x3010, 0x5010, 0x5010, 0xb010, 0xb010, 0xb010, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x5010, 0x5010, 0x5010, 0x5010, 0x5010, 0x5010, 0x5010, 0x5010, - 0x5010, 0x5010, 0x5010, 0x5010, 0x5010, 0x5010, 0x5010, 0x5010, - 0x5010, 0x5010, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, - 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, - 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, - 0x0010, 0x0010, 0x0010, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0xb010, 0xb010, 0x1101, 0xb010, 0xb010, 0xb010, 0xb010, 0x1101, - 0xb010, 0xb010, 0x1102, 0x1101, 0x1101, 0x1101, 0x1102, 0x1102, - 0x1101, 0x1101, 0x1101, 0x1102, 0xb010, 0x1101, 0xb010, 0xb010, - 0xb010, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0x1101, 0xb010, 0x1101, 0xb010, - 0x1101, 0xb010, 0x1101, 0x1101, 0x1101, 0x1101, 0x5010, 0x1102, - 0x1101, 0x1101, 0xb010, 0x1101, 0x1102, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1102, 0xb010, 0xb010, 0x0000, 0x1102, 0x1101, 0x1101, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0x1101, 0x1102, 0x1102, - 0x1102, 0x1102, 0xb010, 0xb010, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0x1111, 0x1111, 0x1111, 0x1111, 0x1111, 0x1111, 0x1111, 0x1111, - 0x1111, 0x1111, 0x1111, 0x1111, 0x1111, 0x1111, 0x1111, 0x1111, - 0x1112, 0x1112, 0x1112, 0x1112, 0x1112, 0x1112, 0x1112, 0x1112, - 0x1112, 0x1112, 0x1112, 0x1112, 0x1112, 0x1112, 0x1112, 0x1112, - 0x1010, 0x1010, 0x1010, 0x1010, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0x5010, 0x5010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0x1010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x3010, 0x3010, 0x3010, 0x3010, 0x3010, 0x3010, 0x3010, 0x3010, - 0x3010, 0x3010, 0x3010, 0x3010, 0x3010, 0x3010, 0x3010, 0x3010, - 0x3010, 0x3010, 0x3010, 0x3010, 0x3010, 0x3010, 0x3010, 0x3010, - 0x3010, 0x3010, 0x3010, 0x3010, 0x3010, 0x3010, 0x3010, 0x3010, - 0x3010, 0x3010, 0x3010, 0x3010, 0x3010, 0x3010, 0x3010, 0x3010, - 0x3010, 0x3010, 0x3010, 0x3010, 0x3010, 0x3010, 0x3010, 0x3010, - 0x3010, 0x3010, 0x3010, 0x3010, 0x3010, 0x3010, 0x3010, 0x3010, - 0x3010, 0x3010, 0x3010, 0x3010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1111, 0x1111, - 0x1111, 0x1111, 0x1111, 0x1111, 0x1111, 0x1111, 0x1111, 0x1111, - 0x1111, 0x1111, 0x1111, 0x1111, 0x1111, 0x1111, 0x1111, 0x1111, - 0x1111, 0x1111, 0x1111, 0x1111, 0x1111, 0x1111, 0x1111, 0x1111, - 0x1112, 0x1112, 0x1112, 0x1112, 0x1112, 0x1112, 0x1112, 0x1112, - 0x1112, 0x1112, 0x1112, 0x1112, 0x1112, 0x1112, 0x1112, 0x1112, - 0x1112, 0x1112, 0x1112, 0x1112, 0x1112, 0x1112, 0x1112, 0x1112, - 0x1112, 0x1112, 0x3010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0x0000, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0x0000, 0x0000, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0xb010, 0xb010, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0xb010, 0xb010, 0xb010, 0xb010, 0x0000, 0xb010, 0xb010, - 0xb010, 0xb010, 0x0000, 0x0000, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0x0000, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0x0000, 0xb010, 0x0000, 0xb010, - 0xb010, 0xb010, 0xb010, 0x0000, 0x0000, 0x0000, 0xb010, 0x0000, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0x0000, - 0x0000, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0x0000, 0x0000, 0x0000, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0x0000, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0x0000, 0x0000, 0x0000, 0x0000, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0x0000, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0x0000, 0x0000, 0x0000, 0x0000, - 0xa008, 0xb010, 0xb010, 0xb010, 0xb010, 0x1010, 0x1100, 0x1010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, - 0xb010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0xb010, 0xb010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1100, 0xb010, 0xb010, 0xb010, - 0x0000, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x0000, - 0x0000, 0x0010, 0x0010, 0xb010, 0xb010, 0x1010, 0x1010, 0x1100, - 0xb010, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0xb010, 0x1010, 0x1010, 0x1010, 0x1100, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x0000, 0x0000, 0x0000, - 0x0000, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x0000, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0xb010, 0xb010, 0x0000, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0xb010, 0xb010, 0x0000, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0xb010, 0xb010, 0xb010, 0xb010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x0000, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0xb010, - 0xb010, 0xb010, 0xb010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0xb010, 0xb010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, - 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0x1010, 0xb010, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x0000, 0x0000, 0x0000, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x0000, 0x0000, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2100, 0x0010, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x5010, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x0000, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x0000, 0x2100, 0x0000, - 0x2100, 0x2100, 0x0000, 0x2100, 0x2100, 0x0000, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0xb010, 0xb010, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x0000, 0x0000, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2010, 0xb010, 0x0000, 0x0000, - 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, - 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, 0x0010, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0010, 0x0010, 0x0010, 0x0010, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0x7010, 0xb010, 0x7010, 0x0000, 0xb010, 0x7010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0x5010, - 0xb010, 0xb010, 0x5010, 0x5010, 0xb010, 0xb010, 0xb010, 0x0000, - 0xb010, 0x5010, 0x5010, 0xb010, 0x0000, 0x0000, 0x0000, 0x0000, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x0000, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, - 0x2100, 0x2100, 0x2100, 0x2100, 0x2100, 0x0000, 0x0000, 0x0048, - 0x0000, 0xb010, 0xb010, 0x5010, 0x5010, 0x5010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0x5010, 0x7010, 0x5010, 0x7010, 0x4010, - 0x3084, 0x3084, 0x3084, 0x3084, 0x3084, 0x3084, 0x3084, 0x3084, - 0x3084, 0x3084, 0x7010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0x1181, 0x1181, 0x1181, 0x1181, 0x1181, 0x1181, 0x1101, - 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, - 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, 0x1101, - 0x1101, 0x1101, 0x1101, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0x1182, 0x1182, 0x1182, 0x1182, 0x1182, 0x1182, 0x1102, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, - 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, 0x1102, - 0x1102, 0x1102, 0x1102, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1010, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1010, 0x1010, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x0000, - 0x0000, 0x0000, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x0000, 0x0000, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x0000, 0x0000, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, 0x1100, - 0x0000, 0x0000, 0x1100, 0x1100, 0x1100, 0x0000, 0x0000, 0x0000, - 0x5010, 0x5010, 0xb010, 0xb010, 0xb010, 0x5010, 0x5010, 0x0000, - 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0xb010, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0xb010, 0xb010, 0x0000, 0x0000 -}; - -/* - * @implemented - */ -BOOL -WINAPI -GetStringTypeExW ( - LCID Locale, - DWORD InfoType, - LPCWSTR Src, - int Count, - LPWORD CharType - ) -{ - /* locale is ignored for Unicode */ - return GetStringTypeW(InfoType, Src, Count, CharType); -} - - -/* - * @implemented - */ -BOOL -WINAPI -GetStringTypeExA ( - LCID Locale, - DWORD InfoType, - LPCSTR Src, - int Count, - LPWORD CharType - ) -{ - return GetStringTypeA(Locale, InfoType, Src, Count, CharType); -} - - -/* - * @implemented - */ -BOOL -WINAPI -GetStringTypeW ( - DWORD InfoType, - LPCWSTR Src, - int Count, - LPWORD CharType - ) -{ - static struct - { - int RangeStart; - int RangeEnd; - WORD Type3; - } - Type3Construct[] = - { - { 0x0600, 0x06FF, C3_KASHIDA }, - { 0x3000, 0x303F, C3_SYMBOL }, - { 0x3040, 0x309F, C3_HIRAGANA }, - { 0x30A0, 0x30FF, C3_KATAKANA }, - { 0x4E00, 0x9FAF, C3_IDEOGRAPH }, - { 0xFF00, 0xFF60, C3_FULLWIDTH }, - { 0xFF00, 0xFF20, C3_SYMBOL }, - { 0xFF21, 0xFF3A, C3_ALPHA }, - { 0xFF41, 0xFF5A, C3_ALPHA }, - { 0xFF3B, 0xFF40, C3_SYMBOL }, - { 0xFF5B, 0xFF60, C3_SYMBOL }, - { 0xFF61, 0xFFDC, C3_HALFWIDTH }, - { 0xFF61, 0xFF64, C3_SYMBOL }, - { 0xFF65, 0xFF9F, C3_KATAKANA }, - { 0xFF65, 0xFF9F, C3_ALPHA }, - { 0xFFE0, 0xFFE6, C3_FULLWIDTH }, - { 0xFFE0, 0xFFE6, C3_SYMBOL }, - { 0xFFE8, 0xFFEE, C3_HALFWIDTH }, - { 0xFFE8, 0xFFEE, C3_SYMBOL } - }; - - if (-1 == Count) - { - Count = wcslen(Src) + 1; - } - switch(InfoType) - { - case CT_CTYPE1: - while (0 != Count--) - { - *CharType++ = GetCharType(*Src) & 0xfff; - Src++; - } - break; - case CT_CTYPE2: - while (0 != Count--) - { - *CharType++ = GetCharType(*Src) >> 12; - Src++; - } - break; - case CT_CTYPE3: - DPRINT("CT_CTYPE3: semi-stub.\n"); - while (0 != Count--) - { - int c = *Src; - WORD Type1, Type3 = 0; /* C3_NOTAPPLICABLE */ - unsigned Construct; - - Type1 = GetCharType(*Src) & 0xfff; - Src++; - - /* try to construct type3 from type1 */ - if (0 != (Type1 & C1_SPACE)) - { - Type3 |= C3_SYMBOL; - } - if (0 != (Type1 & C1_ALPHA)) - { - Type3 |= C3_ALPHA; - } - - for (Construct = 0; - Construct < sizeof(Type3Construct) / sizeof(Type3Construct[0]) - && Type3Construct[Construct].RangeStart <= c; - Construct++) - { - if (c <= Type3Construct[Construct].RangeEnd) - { - Type3 |= Type3Construct[Construct].Type3; - } - } - *CharType++ = Type3; - } - break; - default: - DPRINT1("Invalid InfoType %d\n", InfoType); - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } - - return TRUE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -GetStringTypeA ( - LCID Locale, - DWORD InfoType, - LPCSTR Src, - int Count, - LPWORD CharType - ) -{ - UINT Cp; - INT CountW; - LPWSTR SrcW; - BOOL Ret = FALSE; - - if (-1 == Count) - { - Count = strlen(Src) + 1; - } - - if (! GetLocaleInfoW(Locale, LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER, - (WCHAR *) &Cp, sizeof(Cp) / sizeof(WCHAR))) - { - Cp = 0; - } - if (0 == Cp) - { - DPRINT1("For locale %04lx using current ANSI code page\n", Locale); - Cp = GetACP(); - } - - CountW = MultiByteToWideChar(Cp, 0, Src, Count, NULL, 0); - SrcW = HeapAlloc(GetProcessHeap(), 0, CountW * sizeof(WCHAR)); - if (NULL != SrcW) - { - MultiByteToWideChar(Cp, 0, Src, Count, SrcW, CountW); - /* - * NOTE: the target buffer has 1 word for each CHARACTER in the source - * string, with multibyte characters there maybe be more bytes in count - * than character space in the buffer! - */ - Ret = GetStringTypeW(InfoType, SrcW, CountW, CharType); - HeapFree(GetProcessHeap(), 0, SrcW); - } - - return Ret; -} diff --git a/dll/win32/kernel32/misc/comm.c b/dll/win32/kernel32/misc/comm.c deleted file mode 100644 index f4dbd7e92a4..00000000000 --- a/dll/win32/kernel32/misc/comm.c +++ /dev/null @@ -1,834 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * FILE: lib/kernel32/misc/comm.c - * PURPOSE: Comm functions - * PROGRAMMER: Ariadne ( ariadne@xs4all.nl) - * modified from WINE [ Onno Hovers, (onno@stack.urc.tue.nl) ] - * Robert Dickenson (robd@mok.lvcom.com) - * Saveliy Tretiakov (saveliyt@mail.ru) - * Dmitry Philippov (shedon@mail.ru) - * UPDATE HISTORY: - * Created 01/11/98 - * RDD (30/09/2002) implemented many function bodies to call serial driver. - * KJK (11/02/2003) implemented BuildCommDCB & BuildCommDCBAndTimeouts - * ST (21/03/2005) implemented GetCommProperties - * ST (24/03/2005) implemented ClearCommError. Corrected many functions. - * ST (05/04/2005) implemented CommConfigDialog - * DP (11/06/2005) implemented GetCommConfig - * DP (12/06/2005) implemented SetCommConfig - * KJK (26/12/2008) reimplemented BuildCommDCB & BuildCommDCBAndTimeouts elsewhere - * - */ - -#include -#undef SERIAL_LSRMST_ESCAPE -#undef SERIAL_LSRMST_LSR_DATA -#undef SERIAL_LSRMST_LSR_NODATA -#undef SERIAL_LSRMST_MST -#undef SERIAL_IOC_FCR_FIFO_ENABLE -#undef SERIAL_IOC_FCR_RCVR_RESET -#undef SERIAL_IOC_FCR_XMIT_RESET -#undef SERIAL_IOC_FCR_DMA_MODE -#undef SERIAL_IOC_FCR_RES1 -#undef SERIAL_IOC_FCR_RES2 -#undef SERIAL_IOC_FCR_RCVR_TRIGGER_LSB -#undef SERIAL_IOC_FCR_RCVR_TRIGGER_MSB -#undef SERIAL_IOC_MCR_DTR -#undef SERIAL_IOC_MCR_RTS -#undef SERIAL_IOC_MCR_OUT1 -#undef SERIAL_IOC_MCR_OUT2 -#undef SERIAL_IOC_MCR_LOOP -#undef IOCTL_SERIAL_LSRMST_INSERT -#include - -#define NDEBUG -#include - -static const WCHAR lpszSerialUI[] = { - 's','e','r','i','a','l','u','i','.','d','l','l',0 }; - -/* - * @implemented - */ -BOOL -WINAPI -ClearCommBreak(HANDLE hFile) -{ - DWORD dwBytesReturned; - return DeviceIoControl(hFile, IOCTL_SERIAL_SET_BREAK_OFF, - NULL, 0, NULL, 0, &dwBytesReturned, NULL); -} - - -/* - * @implemented - */ -BOOL -WINAPI -ClearCommError(HANDLE hFile, LPDWORD lpErrors, LPCOMSTAT lpComStat) -{ - BOOL status = FALSE; - DWORD dwBytesReturned; - SERIAL_STATUS SerialStatus; - - status = DeviceIoControl(hFile, IOCTL_SERIAL_GET_COMMSTATUS, NULL, 0, - &SerialStatus, sizeof(SERIAL_STATUS), &dwBytesReturned, NULL); - - if(!NT_SUCCESS(status)) - { - return status; - } - - if(lpErrors) - { - *lpErrors = 0; - if(SerialStatus.Errors & SERIAL_ERROR_BREAK) - *lpErrors |= CE_BREAK; - if(SerialStatus.Errors & SERIAL_ERROR_FRAMING) - *lpErrors |= CE_FRAME; - if(SerialStatus.Errors & SERIAL_ERROR_OVERRUN) - *lpErrors |= CE_OVERRUN; - if(SerialStatus.Errors & SERIAL_ERROR_QUEUEOVERRUN ) - *lpErrors |= CE_RXOVER; - if(SerialStatus.Errors & SERIAL_ERROR_PARITY) - *lpErrors |= CE_RXPARITY; - } - - if (lpComStat) - { - ZeroMemory(lpComStat, sizeof(COMSTAT)); - - if(SerialStatus.HoldReasons & SERIAL_TX_WAITING_FOR_CTS) - lpComStat->fCtsHold = TRUE; - if(SerialStatus.HoldReasons & SERIAL_TX_WAITING_FOR_DSR) - lpComStat->fDsrHold = TRUE; - if(SerialStatus.HoldReasons & SERIAL_TX_WAITING_FOR_DCD) - lpComStat->fRlsdHold = TRUE; - if(SerialStatus.HoldReasons & SERIAL_TX_WAITING_FOR_XON) - lpComStat->fXoffHold = TRUE; - if(SerialStatus.HoldReasons & SERIAL_TX_WAITING_XOFF_SENT) - lpComStat->fXoffSent = TRUE; - - if(SerialStatus.EofReceived) - lpComStat->fEof = TRUE; - - if(SerialStatus.WaitForImmediate) - lpComStat->fTxim = TRUE; - - lpComStat->cbInQue = SerialStatus.AmountInInQueue; - lpComStat->cbOutQue = SerialStatus.AmountInOutQueue; - } - return TRUE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -CommConfigDialogA(LPCSTR lpszName, HWND hWnd, LPCOMMCONFIG lpCC) -{ - PWCHAR NameW; - DWORD result; - - /* don't use the static thread buffer so operations in serialui - don't overwrite the string */ - if(!(NameW = FilenameA2W(lpszName, TRUE))) - { - return FALSE; - } - - result = CommConfigDialogW(NameW, hWnd, lpCC); - - RtlFreeHeap(RtlGetProcessHeap(), 0, NameW); - - return result; -} - - -/* - * @implemented - */ -BOOL -WINAPI -CommConfigDialogW(LPCWSTR lpszName, HWND hWnd, LPCOMMCONFIG lpCC) -{ - DWORD (WINAPI *drvCommDlgW)(LPCWSTR, HWND, LPCOMMCONFIG); - HMODULE hSerialuiDll; - DWORD result; - - //FIXME: Get dll name from registry. (setupapi needed) - if(!(hSerialuiDll = LoadLibraryW(L"serialui.dll"))) - { - DPRINT("CommConfigDialogW: serialui.dll not found.\n"); - return FALSE; - } - - drvCommDlgW = (DWORD (WINAPI *)(LPCWSTR, HWND, LPCOMMCONFIG)) - GetProcAddress(hSerialuiDll, "drvCommConfigDialogW"); - - if(!drvCommDlgW) - { - DPRINT("CommConfigDialogW: serialui does not export drvCommConfigDialogW\n"); - FreeLibrary(hSerialuiDll); - return FALSE; - } - - result = drvCommDlgW(lpszName, hWnd, lpCC); - SetLastError(result); - FreeLibrary(hSerialuiDll); - - return (result == ERROR_SUCCESS ? TRUE : FALSE); -} - - -/* - * @implemented - */ -BOOL -WINAPI -EscapeCommFunction(HANDLE hFile, DWORD dwFunc) -{ - BOOL result = FALSE; - DWORD dwBytesReturned; - - switch (dwFunc) { - case CLRDTR: // Clears the DTR (data-terminal-ready) signal. - result = DeviceIoControl(hFile, IOCTL_SERIAL_CLR_DTR, NULL, 0, NULL, 0, &dwBytesReturned, NULL); - break; - case CLRRTS: // Clears the RTS (request-to-send) signal. - result = DeviceIoControl(hFile, IOCTL_SERIAL_CLR_RTS, NULL, 0, NULL, 0, &dwBytesReturned, NULL); - break; - case SETDTR: // Sends the DTR (data-terminal-ready) signal. - result = DeviceIoControl(hFile, IOCTL_SERIAL_SET_DTR, NULL, 0, NULL, 0, &dwBytesReturned, NULL); - break; - case SETRTS: // Sends the RTS (request-to-send) signal. - result = DeviceIoControl(hFile, IOCTL_SERIAL_SET_RTS, NULL, 0, NULL, 0, &dwBytesReturned, NULL); - break; - case SETXOFF: // Causes transmission to act as if an XOFF character has been received. - result = DeviceIoControl(hFile, IOCTL_SERIAL_SET_XOFF, NULL, 0, NULL, 0, &dwBytesReturned, NULL); - break; - case SETXON: // Causes transmission to act as if an XON character has been received. - result = DeviceIoControl(hFile, IOCTL_SERIAL_SET_XON, NULL, 0, NULL, 0, &dwBytesReturned, NULL); - break; - case SETBREAK: // Suspends character transmission and places the transmission line in a break state until the ClearCommBreak function is called (or EscapeCommFunction is called with the CLRBREAK extended function code). The SETBREAK extended function code is identical to the SetCommBreak function. Note that this extended function does not flush data that has not been transmitted. - result = DeviceIoControl(hFile, IOCTL_SERIAL_SET_BREAK_ON, NULL, 0, NULL, 0, &dwBytesReturned, NULL); - break; - case CLRBREAK: // Restores character transmission and places the transmission line in a nonbreak state. The CLRBREAK extended function code is identical to the ClearCommBreak function. - result = DeviceIoControl(hFile, IOCTL_SERIAL_SET_BREAK_OFF, NULL, 0, NULL, 0, &dwBytesReturned, NULL); - break; - default: - DPRINT("EscapeCommFunction() WARNING: unknown function code\n"); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - break; - } - return result; -} - - -/* - * @implemented - */ -BOOL -WINAPI -GetCommConfig(HANDLE hCommDev, LPCOMMCONFIG lpCC, LPDWORD lpdwSize) -{ - BOOL ReturnValue = FALSE; - LPCOMMPROP lpComPort; - - DPRINT("GetCommConfig(%d, %p, %p)\n", hCommDev, lpCC, lpdwSize); - - lpComPort = RtlAllocateHeap( hProcessHeap, - HEAP_ZERO_MEMORY, - sizeof(COMMPROP) + 0x100 ); - - if(NULL == lpComPort) { - DPRINT("GetCommConfig() - ERROR_NOT_ENOUGH_MEMORY\n"); - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - return FALSE; - } - - if( (NULL == lpdwSize) - || (NULL == lpCC) ) { - DPRINT("GetCommConfig() - invalid parameter\n"); - SetLastError(ERROR_INVALID_PARAMETER); - ReturnValue = FALSE; - } - else - { - lpComPort->wPacketLength = sizeof(COMMPROP) + 0x100; - lpComPort->dwProvSpec1 = COMMPROP_INITIALIZED; - ReturnValue = GetCommProperties(hCommDev, lpComPort); - if( ReturnValue ) - { - lpCC->dwSize = sizeof(COMMCONFIG); - lpCC->wVersion = 1; - lpCC->wReserved = 0; - lpCC->dwProviderSubType = lpComPort->dwProvSubType; - lpCC->dwProviderSize = lpComPort->dwProvSpec2; - if( 0 == lpComPort->dwProvSpec2 ) { - lpCC->dwProviderOffset = 0; - } else { - lpCC->dwProviderOffset = (ULONG_PTR)&lpCC->wcProviderData[0] - (ULONG_PTR)lpCC; - } - if( (lpCC->dwProviderSize+lpCC->dwSize) > *lpdwSize ) { - DPRINT("GetCommConfig() - ERROR_INSUFFICIENT_BUFFER\n"); - SetLastError(ERROR_INSUFFICIENT_BUFFER); - ReturnValue = FALSE; - } else { - RtlCopyMemory(lpCC->wcProviderData, lpComPort->wcProvChar, lpCC->dwProviderSize); - ReturnValue = GetCommState(hCommDev, &lpCC->dcb); - } - *lpdwSize = lpCC->dwSize+lpCC->dwProviderSize; - } - } - - RtlFreeHeap(hProcessHeap, 0, lpComPort); - return (ReturnValue); -} - - -/* - * @implemented - */ -BOOL -WINAPI -GetCommMask(HANDLE hFile, LPDWORD lpEvtMask) -{ - DWORD dwBytesReturned; - return DeviceIoControl(hFile, IOCTL_SERIAL_GET_WAIT_MASK, - NULL, 0, lpEvtMask, sizeof(DWORD), &dwBytesReturned, NULL); -} - - -/* - * @implemented - */ -BOOL -WINAPI -GetCommModemStatus(HANDLE hFile, LPDWORD lpModemStat) -{ - DWORD dwBytesReturned; - - return DeviceIoControl(hFile, IOCTL_SERIAL_GET_MODEMSTATUS, - NULL, 0, lpModemStat, sizeof(DWORD), &dwBytesReturned, NULL); -} - - -/* - * @implemented - */ -BOOL -WINAPI -GetCommProperties(HANDLE hFile, LPCOMMPROP lpCommProp) -{ - DWORD dwBytesReturned; - return DeviceIoControl(hFile, IOCTL_SERIAL_GET_PROPERTIES, 0, 0, - lpCommProp, sizeof(COMMPROP), &dwBytesReturned, 0); -} - - -/* - * @implemented - */ -BOOL -WINAPI -GetCommState(HANDLE hFile, LPDCB lpDCB) -{ - BOOL result = FALSE; - DWORD dwBytesReturned; - - SERIAL_BAUD_RATE BaudRate; - SERIAL_HANDFLOW HandFlow; - SERIAL_CHARS SpecialChars; - SERIAL_LINE_CONTROL LineControl; - - DPRINT("GetCommState(%d, %p)\n", hFile, lpDCB); - - if (lpDCB == NULL) { - SetLastError(ERROR_INVALID_PARAMETER); - DPRINT("ERROR: GetCommState() - NULL DCB pointer\n"); - return FALSE; - } - - if (!DeviceIoControl(hFile, IOCTL_SERIAL_GET_BAUD_RATE, - NULL, 0, &BaudRate, sizeof(BaudRate), &dwBytesReturned, NULL) || - !DeviceIoControl(hFile, IOCTL_SERIAL_GET_LINE_CONTROL, - NULL, 0, &LineControl, sizeof(LineControl), &dwBytesReturned, NULL) || - !DeviceIoControl(hFile, IOCTL_SERIAL_GET_HANDFLOW, - NULL, 0, &HandFlow, sizeof(HandFlow), &dwBytesReturned, NULL) || - !DeviceIoControl(hFile, IOCTL_SERIAL_GET_CHARS, - NULL, 0, &SpecialChars, sizeof(SpecialChars), &dwBytesReturned, NULL)) - return FALSE; - - memset(lpDCB, 0, sizeof(*lpDCB)); - lpDCB->DCBlength = sizeof(*lpDCB); - - lpDCB->fBinary = 1; - lpDCB->fParity = 0; - lpDCB->BaudRate = BaudRate.BaudRate; - - lpDCB->StopBits = LineControl.StopBits; - lpDCB->Parity = LineControl.Parity; - lpDCB->ByteSize = LineControl.WordLength; - - if (HandFlow.ControlHandShake & SERIAL_CTS_HANDSHAKE) { - lpDCB->fOutxCtsFlow = 1; - } - if (HandFlow.ControlHandShake & SERIAL_DSR_HANDSHAKE) { - lpDCB->fOutxDsrFlow = 1; - } - if (HandFlow.ControlHandShake & SERIAL_DTR_CONTROL) { - lpDCB->fDtrControl = 1; - } - if (HandFlow.ControlHandShake & SERIAL_DTR_HANDSHAKE) { - lpDCB->fDtrControl = 2; - } - if (HandFlow.ControlHandShake & SERIAL_RTS_CONTROL) { - lpDCB->fRtsControl = 1; - } - if (HandFlow.ControlHandShake & SERIAL_RTS_HANDSHAKE) { - lpDCB->fRtsControl = 2; - } - if (HandFlow.ControlHandShake & SERIAL_DSR_SENSITIVITY) { - lpDCB->fDsrSensitivity = 1; - } - if (HandFlow.ControlHandShake & SERIAL_ERROR_ABORT) { - lpDCB->fAbortOnError = 1; - } - - if (HandFlow.FlowReplace & SERIAL_ERROR_CHAR) { - lpDCB->fErrorChar = 1; - } - if (HandFlow.FlowReplace & SERIAL_NULL_STRIPPING) { - lpDCB->fNull = 1; - } - if (HandFlow.FlowReplace & SERIAL_XOFF_CONTINUE) { - lpDCB->fTXContinueOnXoff = 1; - } - lpDCB->XonLim = (WORD)HandFlow.XonLimit; - lpDCB->XoffLim = (WORD)HandFlow.XoffLimit; - - result = DeviceIoControl(hFile, IOCTL_SERIAL_GET_CHARS, - NULL, 0, &SpecialChars, sizeof(SpecialChars), &dwBytesReturned, NULL); - if (!NT_SUCCESS(result)) { - DPRINT("ERROR: GetCommState() - DeviceIoControl(IOCTL_SERIAL_GET_CHARS) Failed.\n"); - return FALSE; - } - - lpDCB->EofChar = SpecialChars.EofChar; - lpDCB->ErrorChar = SpecialChars.ErrorChar; - // = SpecialChars.BreakChar; - lpDCB->EvtChar = SpecialChars.EventChar; - lpDCB->XonChar = SpecialChars.XonChar; - lpDCB->XoffChar = SpecialChars.XoffChar; - - result = DeviceIoControl(hFile, IOCTL_SERIAL_GET_LINE_CONTROL, - NULL, 0, &LineControl, sizeof(LineControl), &dwBytesReturned, NULL); - if (!NT_SUCCESS(result)) { - DPRINT("ERROR: GetCommState() - DeviceIoControl(IOCTL_SERIAL_GET_LINE_CONTROL) Failed.\n"); - return FALSE; - } - lpDCB->StopBits = LineControl.StopBits; - lpDCB->Parity = LineControl.Parity; - lpDCB->ByteSize = LineControl.WordLength; - DPRINT("GetCommState() - COMPLETED SUCCESSFULLY\n"); - return TRUE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -GetCommTimeouts(HANDLE hFile, LPCOMMTIMEOUTS lpCommTimeouts) -{ - DWORD dwBytesReturned; - - if (lpCommTimeouts == NULL) { - return FALSE; - } - - return DeviceIoControl(hFile, IOCTL_SERIAL_GET_TIMEOUTS, - NULL, 0, - lpCommTimeouts, sizeof(COMMTIMEOUTS), - &dwBytesReturned, NULL); -} - - -/* - * @implemented - */ -BOOL -WINAPI -GetDefaultCommConfigW(LPCWSTR lpszName, LPCOMMCONFIG lpCC, LPDWORD lpdwSize) -{ - FARPROC pGetDefaultCommConfig; - HMODULE hConfigModule; - DWORD res = ERROR_INVALID_PARAMETER; - - DPRINT("(%s, %p, %p) *lpdwSize: %u\n", lpszName, lpCC, lpdwSize, lpdwSize ? *lpdwSize : 0 ); - hConfigModule = LoadLibraryW(lpszSerialUI); - - if (hConfigModule) { - pGetDefaultCommConfig = GetProcAddress(hConfigModule, "drvGetDefaultCommConfigW"); - if (pGetDefaultCommConfig) { - res = pGetDefaultCommConfig(lpszName, lpCC, lpdwSize); - } - FreeLibrary(hConfigModule); - } - - if (res) SetLastError(res); - return (res == ERROR_SUCCESS); -} - - -/* - * @implemented - */ -BOOL -WINAPI -GetDefaultCommConfigA(LPCSTR lpszName, LPCOMMCONFIG lpCC, LPDWORD lpdwSize) -{ - BOOL ret = FALSE; - UNICODE_STRING lpszNameW; - - DPRINT("(%s, %p, %p) *lpdwSize: %u\n", lpszName, lpCC, lpdwSize, lpdwSize ? *lpdwSize : 0 ); - if(lpszName) RtlCreateUnicodeStringFromAsciiz(&lpszNameW,lpszName); - else lpszNameW.Buffer = NULL; - - ret = GetDefaultCommConfigW(lpszNameW.Buffer,lpCC,lpdwSize); - - RtlFreeUnicodeString(&lpszNameW); - return ret; -} - - -/* - * @implemented - */ -BOOL -WINAPI -PurgeComm(HANDLE hFile, DWORD dwFlags) -{ - DWORD dwBytesReturned; - - return DeviceIoControl(hFile, IOCTL_SERIAL_PURGE, - &dwFlags, sizeof(DWORD), NULL, 0, &dwBytesReturned, NULL); -} - - -/* - * @implemented - */ -BOOL -WINAPI -SetCommBreak(HANDLE hFile) -{ - DWORD dwBytesReturned; - - return DeviceIoControl(hFile, IOCTL_SERIAL_SET_BREAK_ON, NULL, 0, NULL, 0, &dwBytesReturned, NULL); -} - - -/* - * @implemented - */ -BOOL -WINAPI -SetCommConfig(HANDLE hCommDev, LPCOMMCONFIG lpCC, DWORD dwSize) -{ - BOOL ReturnValue = FALSE; - - DPRINT("SetCommConfig(%d, %p, %d)\n", hCommDev, lpCC, dwSize); - - if(NULL == lpCC) - { - DPRINT("SetCommConfig() - invalid parameter\n"); - SetLastError(ERROR_INVALID_PARAMETER); - ReturnValue = FALSE; - } - else - { - ReturnValue = SetCommState(hCommDev, &lpCC->dcb); - } - - return ReturnValue; -} - - -/* - * @implemented - */ -BOOL -WINAPI -SetCommMask(HANDLE hFile, DWORD dwEvtMask) -{ - DWORD dwBytesReturned; - - return DeviceIoControl(hFile, IOCTL_SERIAL_SET_WAIT_MASK, - &dwEvtMask, sizeof(DWORD), NULL, 0, &dwBytesReturned, NULL); -} - - -/* - * @implemented - */ -BOOL -WINAPI -SetCommState(HANDLE hFile, LPDCB lpDCB) -{ - BOOL result = FALSE; - DWORD dwBytesReturned; - - SERIAL_BAUD_RATE BaudRate; - SERIAL_HANDFLOW HandFlow; - SERIAL_CHARS SpecialChars; - SERIAL_LINE_CONTROL LineControl; - - DPRINT("SetCommState(%d, %p) - ENTERED\n", hFile, lpDCB); - - if (lpDCB == NULL) { - DPRINT("SetCommState() - ERROR: NULL DCB pointer passed\n"); - return FALSE; - } - - BaudRate.BaudRate = lpDCB->BaudRate; - result = DeviceIoControl(hFile, IOCTL_SERIAL_SET_BAUD_RATE, - &BaudRate, sizeof(BaudRate), NULL, 0, &dwBytesReturned, NULL); - if (!NT_SUCCESS(result)) { - DPRINT("ERROR: SetCommState() - DeviceIoControl(IOCTL_SERIAL_SET_BAUD_RATE) Failed.\n"); - return FALSE; - } -/* -#define SERIAL_DTR_MASK ((ULONG)0x03) -#define SERIAL_DTR_CONTROL ((ULONG)0x01) -#define SERIAL_DTR_HANDSHAKE ((ULONG)0x02) -#define SERIAL_CTS_HANDSHAKE ((ULONG)0x08) -#define SERIAL_DSR_HANDSHAKE ((ULONG)0x10) -#define SERIAL_DCD_HANDSHAKE ((ULONG)0x20) -#define SERIAL_OUT_HANDSHAKEMASK ((ULONG)0x38) -#define SERIAL_DSR_SENSITIVITY ((ULONG)0x40) -#define SERIAL_ERROR_ABORT ((ULONG)0x80000000) -#define SERIAL_CONTROL_INVALID ((ULONG)0x7fffff84) - */ - HandFlow.ControlHandShake = 0; - - if (lpDCB->fOutxCtsFlow) { - HandFlow.ControlHandShake |= SERIAL_CTS_HANDSHAKE; - } - if (lpDCB->fOutxDsrFlow) { - HandFlow.ControlHandShake |= SERIAL_DSR_HANDSHAKE; - } - if (lpDCB->fDtrControl) { - HandFlow.ControlHandShake |= SERIAL_DTR_CONTROL; - } - if (lpDCB->fDtrControl) { - HandFlow.ControlHandShake |= SERIAL_DTR_HANDSHAKE; - } - if (lpDCB->fRtsControl) { - HandFlow.ControlHandShake |= SERIAL_RTS_CONTROL; - } - if (lpDCB->fRtsControl) { - HandFlow.ControlHandShake |= SERIAL_RTS_HANDSHAKE; - } - if (lpDCB->fDsrSensitivity) { - HandFlow.ControlHandShake |= SERIAL_DSR_SENSITIVITY; - } - if (lpDCB->fAbortOnError) { - HandFlow.ControlHandShake |= SERIAL_ERROR_ABORT; - } -/* -#define SERIAL_AUTO_TRANSMIT ((ULONG)0x01) -#define SERIAL_AUTO_RECEIVE ((ULONG)0x02) -#define SERIAL_ERROR_CHAR ((ULONG)0x04) -#define SERIAL_NULL_STRIPPING ((ULONG)0x08) -#define SERIAL_BREAK_CHAR ((ULONG)0x10) -#define SERIAL_RTS_MASK ((ULONG)0xc0) -#define SERIAL_RTS_CONTROL ((ULONG)0x40) -#define SERIAL_RTS_HANDSHAKE ((ULONG)0x80) -#define SERIAL_TRANSMIT_TOGGLE ((ULONG)0xc0) -#define SERIAL_XOFF_CONTINUE ((ULONG)0x80000000) -#define SERIAL_FLOW_INVALID ((ULONG)0x7fffff20) - */ - HandFlow.FlowReplace = 0; - if (lpDCB->fErrorChar) { - HandFlow.FlowReplace |= SERIAL_ERROR_CHAR; - } - if (lpDCB->fNull) { - HandFlow.FlowReplace |= SERIAL_NULL_STRIPPING; - } - if (lpDCB->fTXContinueOnXoff) { - HandFlow.FlowReplace |= SERIAL_XOFF_CONTINUE; - } - HandFlow.XonLimit = lpDCB->XonLim; - HandFlow.XoffLimit = lpDCB->XoffLim; - result = DeviceIoControl(hFile, IOCTL_SERIAL_SET_HANDFLOW, - &HandFlow, sizeof(HandFlow), NULL, 0, &dwBytesReturned, NULL); - if (!NT_SUCCESS(result)) { - DPRINT("ERROR: SetCommState() - DeviceIoControl(IOCTL_SERIAL_SET_HANDFLOW) Failed.\n"); - return FALSE; - } - - SpecialChars.EofChar = lpDCB->EofChar; - SpecialChars.ErrorChar = lpDCB->ErrorChar; - SpecialChars.BreakChar = 0; - SpecialChars.EventChar = lpDCB->EvtChar; - SpecialChars.XonChar = lpDCB->XonChar; - SpecialChars.XoffChar = lpDCB->XoffChar; - result = DeviceIoControl(hFile, IOCTL_SERIAL_SET_CHARS, - &SpecialChars, sizeof(SpecialChars), NULL, 0, &dwBytesReturned, NULL); - if (!NT_SUCCESS(result)) { - DPRINT("ERROR: SetCommState() - DeviceIoControl(IOCTL_SERIAL_SET_CHARS) Failed.\n"); - return FALSE; - } - - LineControl.StopBits = lpDCB->StopBits; - LineControl.Parity = lpDCB->Parity; - LineControl.WordLength = lpDCB->ByteSize; - result = DeviceIoControl(hFile, IOCTL_SERIAL_SET_LINE_CONTROL, - &LineControl, sizeof(LineControl), NULL, 0, &dwBytesReturned, NULL); - if (!NT_SUCCESS(result)) { - DPRINT("ERROR: SetCommState() - DeviceIoControl(IOCTL_SERIAL_SET_LINE_CONTROL) Failed.\n"); - return FALSE; - } - - DPRINT("SetCommState() - COMPLETED SUCCESSFULLY\n"); - return TRUE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -SetCommTimeouts(HANDLE hFile, LPCOMMTIMEOUTS lpCommTimeouts) -{ - DWORD dwBytesReturned; - SERIAL_TIMEOUTS Timeouts; - - if (lpCommTimeouts == NULL) { - return FALSE; - } - Timeouts.ReadIntervalTimeout = lpCommTimeouts->ReadIntervalTimeout; - Timeouts.ReadTotalTimeoutMultiplier = lpCommTimeouts->ReadTotalTimeoutMultiplier; - Timeouts.ReadTotalTimeoutConstant = lpCommTimeouts->ReadTotalTimeoutConstant; - Timeouts.WriteTotalTimeoutMultiplier = lpCommTimeouts->WriteTotalTimeoutMultiplier; - Timeouts.WriteTotalTimeoutConstant = lpCommTimeouts->WriteTotalTimeoutConstant; - - return DeviceIoControl(hFile, IOCTL_SERIAL_SET_TIMEOUTS, - &Timeouts, sizeof(Timeouts), NULL, 0, &dwBytesReturned, NULL); -} - - -/* - * @implemented - */ -BOOL -WINAPI -SetDefaultCommConfigA(LPCSTR lpszName, LPCOMMCONFIG lpCC, DWORD dwSize) -{ - BOOL r; - LPWSTR lpDeviceW = NULL; - DWORD len; - - DPRINT("(%s, %p, %u)\n", lpszName, lpCC, dwSize); - - if (lpszName) - { - len = MultiByteToWideChar( CP_ACP, 0, lpszName, -1, NULL, 0 ); - - lpDeviceW = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) ); - if (!lpDeviceW) - { - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - return FALSE; - } - - MultiByteToWideChar( CP_ACP, 0, lpszName, -1, lpDeviceW, len ); - } - r = SetDefaultCommConfigW(lpDeviceW,lpCC,dwSize); - HeapFree( GetProcessHeap(), 0, lpDeviceW ); - return r; -} - - -/* - * @implemented - */ -BOOL -WINAPI -SetDefaultCommConfigW(LPCWSTR lpszName, LPCOMMCONFIG lpCC, DWORD dwSize) -{ - FARPROC pGetDefaultCommConfig; - HMODULE hConfigModule; - DWORD res = ERROR_INVALID_PARAMETER; - - DPRINT("(%s, %p, %p) *dwSize: %u\n", lpszName, lpCC, dwSize, dwSize ? dwSize : 0 ); - hConfigModule = LoadLibraryW(lpszSerialUI); - - if (hConfigModule) { - pGetDefaultCommConfig = GetProcAddress(hConfigModule, "drvGetDefaultCommConfigW"); - if (pGetDefaultCommConfig) { - res = pGetDefaultCommConfig(lpszName, lpCC, &dwSize); - } - FreeLibrary(hConfigModule); - } - - if (res) SetLastError(res); - return (res == ERROR_SUCCESS); -} - - -/* - * @implemented - */ -BOOL -WINAPI -SetupComm(HANDLE hFile, DWORD dwInQueue, DWORD dwOutQueue) -{ - DWORD dwBytesReturned; - SERIAL_QUEUE_SIZE QueueSize; - - QueueSize.InSize = dwInQueue; - QueueSize.OutSize = dwOutQueue; - return DeviceIoControl(hFile, IOCTL_SERIAL_SET_QUEUE_SIZE, - &QueueSize, sizeof(QueueSize), NULL, 0, &dwBytesReturned, NULL); -} - - -/* - * @implemented - */ -BOOL -WINAPI -TransmitCommChar(HANDLE hFile, char cChar) -{ - DWORD dwBytesReturned; - return DeviceIoControl(hFile, IOCTL_SERIAL_IMMEDIATE_CHAR, - &cChar, sizeof(cChar), NULL, 0, &dwBytesReturned, NULL); -} - - -/* - * @implemented - */ -BOOL -WINAPI -WaitCommEvent(HANDLE hFile, LPDWORD lpEvtMask, LPOVERLAPPED lpOverlapped) -{ - DWORD dwBytesReturned; - - if (lpEvtMask == NULL) { - return FALSE; - } - - return DeviceIoControl(hFile, IOCTL_SERIAL_WAIT_ON_MASK, - NULL, 0, lpEvtMask, sizeof(DWORD), &dwBytesReturned, lpOverlapped); -} - -/* EOF */ diff --git a/dll/win32/kernel32/misc/commdcb.c b/dll/win32/kernel32/misc/commdcb.c deleted file mode 100644 index 8ddb9eda3a6..00000000000 --- a/dll/win32/kernel32/misc/commdcb.c +++ /dev/null @@ -1,673 +0,0 @@ -/* - Copyright (c) 2008 KJK::Hyperion - - Permission is hereby granted, free of charge, to any person obtaining a - copy of this software and associated documentation files (the "Software"), - to deal in the Software without restriction, including without limitation - the rights to use, copy, modify, merge, publish, distribute, sublicense, - and/or sell copies of the Software, and to permit persons to whom the - Software is furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - DEALINGS IN THE SOFTWARE. -*/ - -/* Parses a mode string for a serial port, in the same syntax as the mode.com command */ - -#if defined(__REACTOS__) && defined(_KERNEL32_) -#include - -#define DCB_BuildCommDCBA BuildCommDCBA -#define DCB_BuildCommDCBAndTimeoutsA BuildCommDCBAndTimeoutsA -#define DCB_BuildCommDCBW BuildCommDCBW -#define DCB_BuildCommDCBAndTimeoutsW BuildCommDCBAndTimeoutsW -#else -#include -#include -#include - -#define WIN32_LEAN_AND_MEAN -#include -#endif - -static -void DCB_SkipSpace(const char ** ppTail) -{ - while(**ppTail && isspace(**ppTail)) - ++ *ppTail; -} - -static -size_t DCB_SkipNonSpace(const char ** ppTail) -{ - const char * pOriginal = *ppTail; - - while(**ppTail && !isspace(**ppTail)) - ++ *ppTail; - - return *ppTail - pOriginal; -} - -static -BOOL DCB_SetBaudRate(unsigned long baudRate, LPDCB lpDCB) -{ - switch(baudRate) - { - case 11: lpDCB->BaudRate = 110; break; - case 15: lpDCB->BaudRate = 150; break; - case 30: lpDCB->BaudRate = 300; break; - case 60: lpDCB->BaudRate = 600; break; - case 12: lpDCB->BaudRate = 1200; break; - case 24: lpDCB->BaudRate = 2400; break; - case 48: lpDCB->BaudRate = 4800; break; - case 96: lpDCB->BaudRate = 9600; break; - case 19: lpDCB->BaudRate = 19200; break; - default: lpDCB->BaudRate = baudRate; break; - } - - return TRUE; -} - -static -BYTE DCB_SetParity(char parity, LPDCB lpDCB) -{ - switch(parity) - { - case 'N': - case 'n': - lpDCB->Parity = 0; - break; - - case 'O': - case 'o': - lpDCB->Parity = 1; - break; - - case 'E': - case 'e': - lpDCB->Parity = 2; - break; - - case 'M': - case 'm': - lpDCB->Parity = 3; - break; - - case 'S': - case 's': - lpDCB->Parity = 4; - break; - - default: - return FALSE; - } - - return TRUE; -} - -static -BYTE DCB_SetDataBits(unsigned long dataBits, LPDCB lpDCB) -{ - BOOL bRet; - - bRet = dataBits >= 5 && dataBits <= 8; - - if(!bRet) - return bRet; - - lpDCB->ByteSize = (BYTE)dataBits; - return bRet; -} - -static -BOOL DCB_ParseOldSeparator(const char ** ppTail) -{ - BOOL bRet; - - bRet = **ppTail == 0; - - if(bRet) - return bRet; - - bRet = **ppTail == ','; - - if(bRet) - { - ++ *ppTail; - return bRet; - } - - return bRet; -} - -static -unsigned long DCB_ParseOldNumber(const char ** ppTail, unsigned long nDefault) -{ - char * pNumTail; - unsigned long number; - - DCB_SkipSpace(ppTail); - - if(!isdigit(**ppTail)) - return nDefault; - - number = strtoul(*ppTail, &pNumTail, 10); - *ppTail = pNumTail; - - DCB_SkipSpace(ppTail); - return number; -} - -static -char DCB_ParseOldCharacter(const char ** ppTail, char cDefault) -{ - char character; - - DCB_SkipSpace(ppTail); - - if(**ppTail == 0 || **ppTail == ',') - return cDefault; - - character = **ppTail; - ++ *ppTail; - - DCB_SkipSpace(ppTail); - return character; -} - -static -const char * DCB_ParseOldString(const char ** ppTail, const char * pDefault, size_t * pLength) -{ - const char * string; - - DCB_SkipSpace(ppTail); - - if(**ppTail == 0 || **ppTail == ',') - return pDefault; - - string = *ppTail; - - *pLength = 0; - - while(**ppTail != 0 && **ppTail != ',' && !isspace(**ppTail)) - { - ++ *ppTail; - ++ *pLength; - } - - DCB_SkipSpace(ppTail); - return string; -} - -static -BOOL -DCB_ParseOldMode(const char * pTail, LPDCB lpDCB, LPCOMMTIMEOUTS lpCommTimeouts) -{ - BOOL bRet; - - unsigned long baudRate; - char parity; - unsigned long dataBits; - size_t stopBitsLength; - const char * stopBits; - char retry; - - /* Baud rate */ - baudRate = DCB_ParseOldNumber(&pTail, 0); - bRet = DCB_ParseOldSeparator(&pTail); - bRet = bRet && DCB_SetBaudRate(baudRate, lpDCB); - - if(!bRet) - return bRet; - - /* Parity */ - parity = DCB_ParseOldCharacter(&pTail, 'E'); - bRet = DCB_ParseOldSeparator(&pTail); - bRet = bRet && DCB_SetParity(parity, lpDCB); - - if(!bRet) - return bRet; - - /* Data bits */ - dataBits = DCB_ParseOldNumber(&pTail, 7); - bRet = DCB_ParseOldSeparator(&pTail); - bRet = bRet && DCB_SetDataBits(dataBits, lpDCB); - - if(!bRet) - return bRet; - - /* Stop bits */ - stopBitsLength = 1; - stopBits = DCB_ParseOldString(&pTail, baudRate == 110 ? "2" : "1", &stopBitsLength); - bRet = DCB_ParseOldSeparator(&pTail); - - if(!bRet) - return bRet; - - if(strncmp(stopBits, "1", stopBitsLength) == 0) - lpDCB->StopBits = 0; - else if(strncmp(stopBits, "1.5", stopBitsLength) == 0) - lpDCB->StopBits = 1; - else if(strncmp(stopBits, "2", stopBitsLength) == 0) - lpDCB->StopBits = 2; - else - return FALSE; - - /* Retry */ - retry = DCB_ParseOldCharacter(&pTail, 0); - bRet = *pTail == 0; - - if(!bRet) - return bRet; - - switch(retry) - { - case 0: - lpDCB->fInX = FALSE; - lpDCB->fOutX = FALSE; - lpDCB->fOutxCtsFlow = FALSE; - lpDCB->fOutxDsrFlow = FALSE; - lpDCB->fDtrControl = DTR_CONTROL_ENABLE; - lpDCB->fRtsControl = RTS_CONTROL_ENABLE; - break; - - case 'p': - case 'P': - lpDCB->fInX = FALSE; - lpDCB->fOutX = FALSE; - lpDCB->fOutxCtsFlow = TRUE; - lpDCB->fOutxDsrFlow = TRUE; - lpDCB->fDtrControl = DTR_CONTROL_HANDSHAKE; - lpDCB->fRtsControl = RTS_CONTROL_HANDSHAKE; - break; - - case 'x': - case 'X': - lpDCB->fInX = TRUE; - lpDCB->fOutX = TRUE; - lpDCB->fOutxCtsFlow = FALSE; - lpDCB->fOutxDsrFlow = FALSE; - lpDCB->fDtrControl = DTR_CONTROL_ENABLE; - lpDCB->fRtsControl = RTS_CONTROL_ENABLE; - break; - - default: - return FALSE; - } - - return bRet; -} - -static -BOOL DCB_ParseNewNumber(const char * pString, size_t cchString, unsigned long * pNumber) -{ - BOOL bRet; - char * pStringEnd; - unsigned long number; - - bRet = cchString > 0; - - if(!bRet) - return bRet; - - number = strtoul(pString, &pStringEnd, 10); - - bRet = pStringEnd - pString == cchString; - - if(!bRet) - return bRet; - - *pNumber = number; - return bRet; -} - -static -BOOL DCB_ParseNewBoolean(const char * pString, size_t cchString, BOOL * pBoolean) -{ - BOOL bRet; - - bRet = _strnicmp(pString, "on", cchString) == 0; - - if(bRet) - { - *pBoolean = bRet; - return bRet; - } - - bRet = _strnicmp(pString, "off", cchString) == 0; - - if(bRet) - { - *pBoolean = !bRet; - return bRet; - } - - return bRet; -} - -static -BOOL -DCB_ParseNewMode(const char * pTail, LPDCB lpDCB, LPCOMMTIMEOUTS lpCommTimeouts) -{ - BOOL bRet; - BOOL stopBitsSet = FALSE; - - lpDCB->StopBits = 0; - - while(*pTail) - { - const char * pArg; - size_t cchArg; - size_t cchArgName; - size_t cchArgValue; - const char * pArgName; - const char * pArgValue; - unsigned long nArgValue; - BOOL fArgValue; - - pArg = pTail; - cchArg = DCB_SkipNonSpace(&pTail); - DCB_SkipSpace(&pTail); - - for(cchArgName = 0; cchArgName < cchArg; ++ cchArgName) - { - if(pArg[cchArgName] == '=') - break; - } - - bRet = cchArgName < cchArg; - - if(!bRet) - return bRet; - - cchArgValue = cchArg - cchArgName - 1; - pArgName = pArg; - pArgValue = pArg + cchArgName + 1; - - if(_strnicmp(pArgName, "baud", cchArgName) == 0) - { - bRet = DCB_ParseNewNumber(pArgValue, cchArgValue, &nArgValue); - bRet = bRet && DCB_SetBaudRate(nArgValue, lpDCB); - - if(bRet) - { - if(lpDCB->BaudRate == 110 && !stopBitsSet) - lpDCB->StopBits = 2; - else - lpDCB->StopBits = 0; - } - } - else if(_strnicmp(pArgName, "parity", cchArgName) == 0) - { - bRet = cchArgValue == 1; - bRet = bRet && DCB_SetParity(pArgValue[0], lpDCB); - } - else if(_strnicmp(pArgName, "data", cchArgName) == 0) - { - bRet = DCB_ParseNewNumber(pArgValue, cchArgValue, &nArgValue); - bRet = bRet && DCB_SetDataBits(nArgValue, lpDCB); - } - else if(_strnicmp(pArgName, "stop", cchArgName) == 0) - { - stopBitsSet = TRUE; - - if(strncmp(pArgValue, "1", cchArgValue) == 0) - lpDCB->StopBits = 0; - else if(strncmp(pArgValue, "1.5", cchArgValue) == 0) - lpDCB->StopBits = 1; - else if(strncmp(pArgValue, "2", cchArgValue) == 0) - lpDCB->StopBits = 2; - else - bRet = FALSE; - } - else if(_strnicmp(pArgName, "to", cchArgName) == 0) - { - bRet = DCB_ParseNewBoolean(pArgValue, cchArgValue, &fArgValue); - - if(bRet) - { - if(lpCommTimeouts) - { - memset(lpCommTimeouts, 0, sizeof(*lpCommTimeouts)); - - if(fArgValue) - lpCommTimeouts->WriteTotalTimeoutConstant = 60000; - } - } - } - else if(_strnicmp(pArgName, "xon", cchArgName) == 0) - { - bRet = DCB_ParseNewBoolean(pArgValue, cchArgValue, &fArgValue); - - if(bRet) - { - lpDCB->fInX = !!fArgValue; - lpDCB->fOutX = !!fArgValue; - } - } - else if(_strnicmp(pArgName, "odsr", cchArgName) == 0) - { - bRet = DCB_ParseNewBoolean(pArgValue, cchArgValue, &fArgValue); - - if(bRet) - lpDCB->fOutxDsrFlow = !!fArgValue; - } - else if(_strnicmp(pArgName, "octs", cchArgName) == 0) - { - bRet = DCB_ParseNewBoolean(pArgValue, cchArgValue, &fArgValue); - - if(bRet) - lpDCB->fOutxCtsFlow = !!fArgValue; - } - else if(_strnicmp(pArgName, "dtr", cchArgName) == 0) - { - bRet = DCB_ParseNewBoolean(pArgValue, cchArgValue, &fArgValue); - - if(bRet) - { - if(fArgValue) - lpDCB->fDtrControl = DTR_CONTROL_ENABLE; - else - lpDCB->fDtrControl = DTR_CONTROL_DISABLE; - } - else - { - bRet = _strnicmp(pArgValue, "hs", cchArgValue) == 0; - - if(bRet) - lpDCB->fDtrControl = DTR_CONTROL_HANDSHAKE; - } - } - else if(_strnicmp(pArgName, "rts", cchArgName) == 0) - { - bRet = DCB_ParseNewBoolean(pArgValue, cchArgValue, &fArgValue); - - if(bRet) - { - if(fArgValue) - lpDCB->fRtsControl = RTS_CONTROL_ENABLE; - else - lpDCB->fRtsControl = RTS_CONTROL_DISABLE; - } - else - { - bRet = _strnicmp(pArgValue, "hs", cchArgValue) == 0; - - if(bRet) - lpDCB->fRtsControl = RTS_CONTROL_HANDSHAKE; - else - { - bRet = _strnicmp(pArgValue, "tg", cchArgValue) == 0; - - if(bRet) - lpDCB->fRtsControl = RTS_CONTROL_TOGGLE; - } - } - } - else if(_strnicmp(pArgName, "idsr", cchArgName) == 0) - { - bRet = DCB_ParseNewBoolean(pArgValue, cchArgValue, &fArgValue); - - if(bRet) - lpDCB->fDsrSensitivity = !!fArgValue; - } - else - bRet = FALSE; - - if(!bRet) - return bRet; - } - - return TRUE; -} - -static -BOOL -DCB_ValidPort(unsigned long nPort) -{ - BOOL bRet; - DWORD dwErr; - WCHAR szPort[3 + 10 + 1]; - - dwErr = GetLastError(); - - _snwprintf(szPort, sizeof(szPort) / sizeof(szPort[0]), L"COM%lu", nPort); - - bRet = QueryDosDeviceW(szPort, NULL, 0) == 0 && GetLastError() == ERROR_INSUFFICIENT_BUFFER; - - if(!bRet) - dwErr = ERROR_INVALID_PARAMETER; - - SetLastError(dwErr); - return bRet; -} - -/* - * @implemented - */ -BOOL -WINAPI -DCB_BuildCommDCBAndTimeoutsA(LPCSTR lpDef, LPDCB lpDCB, LPCOMMTIMEOUTS lpCommTimeouts) -{ - BOOL bRet; - LPCSTR pTail = lpDef; - DCB DCBCopy; - - if(_strnicmp(pTail, "COM", 3) == 0) - { - char * pNumTail; - unsigned long nPort; - - pTail += 3; - - if(!isdigit(*pTail)) - return FALSE; - - nPort = strtoul(pTail, &pNumTail, 10); - pTail = pNumTail; - - bRet = DCB_ValidPort(nPort); - - if(!bRet) - return bRet; - - DCB_SkipSpace(&pTail); - - if(*pTail == ':') - ++ pTail; - - DCB_SkipSpace(&pTail); - } - - DCBCopy = *lpDCB; - - if(isdigit(*pTail)) - bRet = DCB_ParseOldMode(pTail, &DCBCopy, lpCommTimeouts); - else - bRet = DCB_ParseNewMode(pTail, &DCBCopy, lpCommTimeouts); - - if(!bRet) - SetLastError(ERROR_INVALID_PARAMETER); - else - *lpDCB = DCBCopy; - - return bRet; -} - -/* - * @implemented - */ -BOOL -WINAPI -DCB_BuildCommDCBA(LPCSTR lpDef, LPDCB lpDCB) -{ - return DCB_BuildCommDCBAndTimeoutsA(lpDef, lpDCB, NULL); -} - -/* - * @implemented - */ -BOOL -WINAPI -DCB_BuildCommDCBAndTimeoutsW(LPCWSTR lpDef, LPDCB lpDCB, LPCOMMTIMEOUTS lpCommTimeouts) -{ - BOOL bRet; - HANDLE hHeap; - BOOL bInvalidChars; - LPSTR pszAscii; - int cchAscii; - DWORD dwErr; - - dwErr = ERROR_INVALID_PARAMETER; - cchAscii = WideCharToMultiByte(CP_ACP, 0, lpDef, -1, NULL, 0, NULL, NULL); - - bRet = cchAscii > 0; - - if(bRet) - { - hHeap = GetProcessHeap(); - pszAscii = HeapAlloc(hHeap, 0, cchAscii); - - bRet = pszAscii != NULL; - - if(bRet) - { - bInvalidChars = FALSE; - cchAscii = WideCharToMultiByte(CP_ACP, 0, lpDef, -1, pszAscii, cchAscii, NULL, &bInvalidChars); - - bRet = cchAscii > 0 && !bInvalidChars; - - if(bRet) - bRet = DCB_BuildCommDCBAndTimeoutsA(pszAscii, lpDCB, lpCommTimeouts); - - HeapFree(hHeap, 0, pszAscii); - } - else - dwErr = ERROR_OUTOFMEMORY; - } - - if(!bRet) - SetLastError(dwErr); - - return bRet; -} - -/* - * @implemented - */ -BOOL -WINAPI -DCB_BuildCommDCBW(LPCWSTR lpDef, LPDCB lpDCB) -{ - return DCB_BuildCommDCBAndTimeoutsW(lpDef, lpDCB, NULL); -} - -/* EOF */ diff --git a/dll/win32/kernel32/misc/error.c b/dll/win32/kernel32/misc/error.c deleted file mode 100644 index 1430a3a9a7b..00000000000 --- a/dll/win32/kernel32/misc/error.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * FILE: dll/win32/kernel32/misc/error.c - * PURPOSE: Error functions - * PROGRAMMER: Pierre Schweitzer (pierre.schweitzer@reactos.org) - */ - -#include - -#define NDEBUG -#include - - -DWORD g_dwLastErrorToBreakOn; - -/* FUNCTIONS ******************************************************************/ - -/* - * @implemented - */ -VOID -WINAPI -SetLastError( - IN DWORD dwErrCode) -{ - if (g_dwLastErrorToBreakOn) - { - /* If we have error to break on and if current matches, break */ - if (g_dwLastErrorToBreakOn == dwErrCode) - { - DbgBreakPoint(); - } - } - - /* Set last error */ - NtCurrentTeb()->LastErrorValue = dwErrCode; -} - -/* - * @implemented - */ -VOID -WINAPI -BaseSetLastNTError( - IN NTSTATUS Status) -{ - SetLastError(RtlNtStatusToDosError(Status)); -} - -/* - * @implemented - */ -DWORD -WINAPI -GetLastError() -{ - return NtCurrentTeb()->LastErrorValue; -} - -/* EOF */ diff --git a/dll/win32/kernel32/misc/handle.c b/dll/win32/kernel32/misc/handle.c deleted file mode 100644 index 7f02e2aa4fa..00000000000 --- a/dll/win32/kernel32/misc/handle.c +++ /dev/null @@ -1,218 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * FILE: lib/kernel32/misc/handle.c - * PURPOSE: Object functions - * PROGRAMMER: Ariadne ( ariadne@xs4all.nl) - * UPDATE HISTORY: - * Created 01/11/98 - */ - -/* INCLUDES ******************************************************************/ - -#include - -#define NDEBUG -#include - -/* GLOBALS *******************************************************************/ - -HANDLE WINAPI -DuplicateConsoleHandle (HANDLE hConsole, - DWORD dwDesiredAccess, - BOOL bInheritHandle, - DWORD dwOptions); - -/* FUNCTIONS *****************************************************************/ - -HANDLE FASTCALL -TranslateStdHandle(HANDLE hHandle) -{ - PRTL_USER_PROCESS_PARAMETERS Ppb = NtCurrentPeb()->ProcessParameters; - - switch ((ULONG)hHandle) - { - case STD_INPUT_HANDLE: return Ppb->StandardInput; - case STD_OUTPUT_HANDLE: return Ppb->StandardOutput; - case STD_ERROR_HANDLE: return Ppb->StandardError; - } - - return hHandle; -} - -/* - * @implemented - */ -BOOL WINAPI -GetHandleInformation (HANDLE hObject, - LPDWORD lpdwFlags) -{ - OBJECT_HANDLE_ATTRIBUTE_INFORMATION HandleInfo; - ULONG BytesWritten; - NTSTATUS Status; - DWORD Flags; - - hObject = TranslateStdHandle(hObject); - - Status = NtQueryObject (hObject, - ObjectHandleFlagInformation, - &HandleInfo, - sizeof(OBJECT_HANDLE_ATTRIBUTE_INFORMATION), - &BytesWritten); - if (NT_SUCCESS(Status)) - { - Flags = 0; - if (HandleInfo.Inherit) - Flags |= HANDLE_FLAG_INHERIT; - if (HandleInfo.ProtectFromClose) - Flags |= HANDLE_FLAG_PROTECT_FROM_CLOSE; - - *lpdwFlags = Flags; - - return TRUE; - } - else - { - SetLastErrorByStatus (Status); - return FALSE; - } -} - - -/* - * @implemented - */ -BOOL WINAPI -SetHandleInformation (HANDLE hObject, - DWORD dwMask, - DWORD dwFlags) -{ - OBJECT_HANDLE_ATTRIBUTE_INFORMATION HandleInfo; - ULONG BytesWritten; - NTSTATUS Status; - - hObject = TranslateStdHandle(hObject); - - Status = NtQueryObject (hObject, - ObjectHandleFlagInformation, - &HandleInfo, - sizeof(OBJECT_HANDLE_ATTRIBUTE_INFORMATION), - &BytesWritten); - if (NT_SUCCESS(Status)) - { - if (dwMask & HANDLE_FLAG_INHERIT) - HandleInfo.Inherit = (dwFlags & HANDLE_FLAG_INHERIT) != 0; - if (dwMask & HANDLE_FLAG_PROTECT_FROM_CLOSE) - HandleInfo.ProtectFromClose = (dwFlags & HANDLE_FLAG_PROTECT_FROM_CLOSE) != 0; - - Status = NtSetInformationObject (hObject, - ObjectHandleFlagInformation, - &HandleInfo, - sizeof(OBJECT_HANDLE_ATTRIBUTE_INFORMATION)); - if(!NT_SUCCESS(Status)) - { - SetLastErrorByStatus (Status); - return FALSE; - } - - return TRUE; - } - else - { - SetLastErrorByStatus (Status); - return FALSE; - } -} - - -/* - * @implemented - */ -BOOL WINAPI CloseHandle(HANDLE hObject) -/* - * FUNCTION: Closes an open object handle - * PARAMETERS: - * hObject = Identifies an open object handle - * RETURNS: If the function succeeds, the return value is nonzero - * If the function fails, the return value is zero - */ -{ - NTSTATUS Status; - - hObject = TranslateStdHandle(hObject); - - if (IsConsoleHandle(hObject)) - { - return(CloseConsoleHandle(hObject)); - } - - Status = NtClose(hObject); - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus (Status); - return FALSE; - } - - return TRUE; -} - - -/* - * @implemented - */ -BOOL WINAPI DuplicateHandle(HANDLE hSourceProcessHandle, - HANDLE hSourceHandle, - HANDLE hTargetProcessHandle, - LPHANDLE lpTargetHandle, - DWORD dwDesiredAccess, - BOOL bInheritHandle, - DWORD dwOptions) -{ - DWORD SourceProcessId, TargetProcessId; - NTSTATUS Status; - - hSourceHandle = TranslateStdHandle(hSourceHandle); - - if (IsConsoleHandle(hSourceHandle)) - { - SourceProcessId = GetProcessId(hSourceProcessHandle); - TargetProcessId = GetProcessId(hTargetProcessHandle); - if (!SourceProcessId || !TargetProcessId || - SourceProcessId != TargetProcessId || - SourceProcessId != GetCurrentProcessId()) - { - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } - - *lpTargetHandle = DuplicateConsoleHandle(hSourceHandle, dwDesiredAccess, bInheritHandle, dwOptions); - return *lpTargetHandle != INVALID_HANDLE_VALUE; - } - - Status = NtDuplicateObject(hSourceProcessHandle, - hSourceHandle, - hTargetProcessHandle, - lpTargetHandle, - dwDesiredAccess, - bInheritHandle ? OBJ_INHERIT : 0, - dwOptions); - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus (Status); - return FALSE; - } - - return TRUE; -} - - -/* - * @implemented - */ -UINT WINAPI SetHandleCount(UINT nCount) -{ - return(nCount); -} - -/* EOF */ diff --git a/dll/win32/kernel32/misc/icustubs.cpp b/dll/win32/kernel32/misc/icustubs.cpp deleted file mode 100644 index edc887005e1..00000000000 --- a/dll/win32/kernel32/misc/icustubs.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2008, KJK::Hyperion - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * - Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * - Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * - Neither the name of the ReactOS Foundation nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - */ - -// FIXME: move stubs elsewhere - -#include -#include - -#include - -extern "C" -{ -void WINAPI EnterCriticalSection(PCRITICAL_SECTION p) { RtlEnterCriticalSection((PRTL_CRITICAL_SECTION)p); } -void WINAPI LeaveCriticalSection(PCRITICAL_SECTION p) { RtlLeaveCriticalSection((PRTL_CRITICAL_SECTION)p); } -void WINAPI DeleteCriticalSection(PCRITICAL_SECTION p) { RtlDeleteCriticalSection((PRTL_CRITICAL_SECTION)p); } - -void free(void * memory) -{ - RtlFreeHeap(RtlGetProcessHeap(), 0, memory); -} - -void * malloc(size_t size) -{ - return RtlAllocateHeap(RtlGetProcessHeap(), 0, size); -} - -void * realloc(void * memory, size_t size) -{ - return RtlReAllocateHeap(RtlGetProcessHeap(), 0, memory, size); -} - -int __cdecl _purecall() -{ - FatalAppExitW(0, L"pure virtual call"); - FatalExit(0); - return 0; -} - -#if defined(__GNUC__) -__attribute__((alias("_purecall"))) void __cxa_pure_virtual(void); -#endif - -void _assert() -{ - FatalAppExitW(0, L"assertion failed"); - FatalExit(0); -} -} - -void operator delete(void * memory) -{ - free(memory); -} - -// EOF diff --git a/dll/win32/kernel32/misc/lang.c b/dll/win32/kernel32/misc/lang.c deleted file mode 100644 index ac9868e21a1..00000000000 --- a/dll/win32/kernel32/misc/lang.c +++ /dev/null @@ -1,2995 +0,0 @@ -/* - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * FILE: dll/win32/kernel32/file/lang.c - * PURPOSE: National Laguage Support related funcs - * PROGRAMMER: Thomas Weidenmueller - * Gunnar Andre Dalsnes - * Aleksey Bragin - * Eric Kohl - * Alex Ionescu - * Richard Campbell - * James Tabor - * Dmitry Chapyshev - * UPDATE HISTORY: - * Created 21/09/2003 - */ - -#include -#include - -#define NDEBUG -#include - -#include "lcformat_private.h" - -#define LOCALE_LOCALEINFOFLAGSMASK (LOCALE_NOUSEROVERRIDE|LOCALE_USE_CP_ACP|\ - LOCALE_RETURN_NUMBER|LOCALE_RETURN_GENITIVE_NAMES) -#define CALINFO_MAX_YEAR 2029 - -//static LCID SystemLocale = MAKELCID(LANG_ENGLISH, SORT_DEFAULT); - -//static RTL_CRITICAL_SECTION LocalesListLock; - -extern int wine_fold_string(int flags, const WCHAR *src, int srclen, WCHAR *dst, int dstlen); -extern int wine_get_sortkey(int flags, const WCHAR *src, int srclen, char *dst, int dstlen); -extern int wine_compare_string(int flags, const WCHAR *str1, int len1, const WCHAR *str2, int len2); - -typedef struct -{ - union - { - UILANGUAGE_ENUMPROCA procA; - UILANGUAGE_ENUMPROCW procW; - } u; - DWORD flags; - LONG_PTR param; -} ENUM_UILANG_CALLBACK; - -static const WCHAR szLocaleKeyName[] = L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\NLS\\Locale"; -static const WCHAR szLangGroupsKeyName[] = L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\NLS\\Language Groups"; - -/*********************************************************************** - * is_genitive_name_supported - * - * Determine could LCTYPE basically support genitive name form or not. - */ -static BOOL is_genitive_name_supported( LCTYPE lctype ) -{ - switch(lctype & 0xffff) - { - case LOCALE_SMONTHNAME1: - case LOCALE_SMONTHNAME2: - case LOCALE_SMONTHNAME3: - case LOCALE_SMONTHNAME4: - case LOCALE_SMONTHNAME5: - case LOCALE_SMONTHNAME6: - case LOCALE_SMONTHNAME7: - case LOCALE_SMONTHNAME8: - case LOCALE_SMONTHNAME9: - case LOCALE_SMONTHNAME10: - case LOCALE_SMONTHNAME11: - case LOCALE_SMONTHNAME12: - case LOCALE_SMONTHNAME13: - return TRUE; - default: - return FALSE; - } -} - -/*********************************************************************** - * create_registry_key - * - * Create the Control Panel\\International registry key. - */ -static inline HANDLE create_registry_key(void) -{ - static const WCHAR intlW[] = {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\', - 'I','n','t','e','r','n','a','t','i','o','n','a','l',0}; - OBJECT_ATTRIBUTES attr; - UNICODE_STRING nameW; - HANDLE hkey; - - if (RtlOpenCurrentUser( KEY_ALL_ACCESS, &hkey ) != STATUS_SUCCESS) return 0; - - attr.Length = sizeof(attr); - attr.RootDirectory = hkey; - attr.ObjectName = &nameW; - attr.Attributes = 0; - attr.SecurityDescriptor = NULL; - attr.SecurityQualityOfService = NULL; - RtlInitUnicodeString( &nameW, intlW ); - - if (NtCreateKey( &hkey, KEY_ALL_ACCESS, &attr, 0, NULL, 0, NULL ) != STATUS_SUCCESS) hkey = 0; - NtClose( attr.RootDirectory ); - return hkey; -} - -/****************************************************************************** - * @implemented - * RIPPED FROM WINE's dlls\kernel\locale.c rev 1.42 - * - * ConvertDefaultLocale (KERNEL32.@) - * - * Convert a default locale identifier into a real identifier. - * - * PARAMS - * lcid [I] LCID identifier of the locale to convert - * - * RETURNS - * lcid unchanged, if not a default locale or its sublanguage is - * not SUBLANG_NEUTRAL. - * GetSystemDefaultLCID(), if lcid == LOCALE_SYSTEM_DEFAULT. - * GetUserDefaultLCID(), if lcid == LOCALE_USER_DEFAULT or LOCALE_NEUTRAL. - * Otherwise, lcid with sublanguage changed to SUBLANG_DEFAULT. - */ -LCID WINAPI -ConvertDefaultLocale(LCID lcid) -{ - LANGID langid; - - switch (lcid) - { - case LOCALE_SYSTEM_DEFAULT: - lcid = GetSystemDefaultLCID(); - break; - - case LOCALE_USER_DEFAULT: - case LOCALE_NEUTRAL: - lcid = GetUserDefaultLCID(); - break; - - default: - /* Replace SUBLANG_NEUTRAL with SUBLANG_DEFAULT */ - langid = LANGIDFROMLCID(lcid); - if (SUBLANGID(langid) == SUBLANG_NEUTRAL) - { - langid = MAKELANGID(PRIMARYLANGID(langid), SUBLANG_DEFAULT); - lcid = MAKELCID(langid, SORTIDFROMLCID(lcid)); - } - } - - return lcid; -} - - -static BOOL NLS_RegEnumValue(HANDLE hKey, UINT ulIndex, - LPWSTR szValueName, ULONG valueNameSize, - LPWSTR szValueData, ULONG valueDataSize) -{ - BYTE buffer[80]; - KEY_VALUE_FULL_INFORMATION *info = (KEY_VALUE_FULL_INFORMATION *)buffer; - DWORD dwLen; - - if (NtEnumerateValueKey( hKey, ulIndex, KeyValueFullInformation, - buffer, sizeof(buffer), &dwLen ) != STATUS_SUCCESS || - info->NameLength > valueNameSize || - info->DataLength > valueDataSize) - { - return FALSE; - } - - DPRINT("info->Name %s info->DataLength %d\n", info->Name, info->DataLength); - - memcpy( szValueName, info->Name, info->NameLength); - szValueName[info->NameLength / sizeof(WCHAR)] = '\0'; - memcpy( szValueData, buffer + info->DataOffset, info->DataLength ); - szValueData[info->DataLength / sizeof(WCHAR)] = '\0'; - - DPRINT("returning %s %s\n", szValueName, szValueData); - return TRUE; -} - - -static HANDLE NLS_RegOpenKey(HANDLE hRootKey, LPCWSTR szKeyName) -{ - UNICODE_STRING keyName; - OBJECT_ATTRIBUTES attr; - HANDLE hkey; - - RtlInitUnicodeString( &keyName, szKeyName ); - InitializeObjectAttributes(&attr, &keyName, OBJ_CASE_INSENSITIVE, hRootKey, NULL); - - if (NtOpenKey( &hkey, KEY_ALL_ACCESS, &attr ) != STATUS_SUCCESS) - { - SetLastError( ERROR_BADDB ); - hkey = 0; - } - - return hkey; -} - -static BOOL NLS_RegEnumSubKey(HANDLE hKey, UINT ulIndex, LPWSTR szKeyName, - ULONG keyNameSize) -{ - BYTE buffer[80]; - KEY_BASIC_INFORMATION *info = (KEY_BASIC_INFORMATION *)buffer; - DWORD dwLen; - - if (NtEnumerateKey( hKey, ulIndex, KeyBasicInformation, buffer, - sizeof(buffer), &dwLen) != STATUS_SUCCESS || - info->NameLength > keyNameSize) - { - return FALSE; - } - - DPRINT("info->Name %s info->NameLength %d\n", info->Name, info->NameLength); - - memcpy( szKeyName, info->Name, info->NameLength); - szKeyName[info->NameLength / sizeof(WCHAR)] = '\0'; - - DPRINT("returning %s\n", szKeyName); - return TRUE; -} - -static BOOL NLS_RegGetDword(HANDLE hKey, LPCWSTR szValueName, DWORD *lpVal) -{ - BYTE buffer[128]; - const KEY_VALUE_PARTIAL_INFORMATION *info = (KEY_VALUE_PARTIAL_INFORMATION *)buffer; - DWORD dwSize = sizeof(buffer); - UNICODE_STRING valueName; - - RtlInitUnicodeString( &valueName, szValueName ); - - DPRINT("%p, %s\n", hKey, szValueName); - if (NtQueryValueKey( hKey, &valueName, KeyValuePartialInformation, - buffer, dwSize, &dwSize ) == STATUS_SUCCESS && - info->DataLength == sizeof(DWORD)) - { - memcpy(lpVal, info->Data, sizeof(DWORD)); - return TRUE; - } - - return FALSE; -} - -static BOOL NLS_GetLanguageGroupName(LGRPID lgrpid, LPWSTR szName, ULONG nameSize) -{ - LANGID langId; - LPCWSTR szResourceName = MAKEINTRESOURCEW(((lgrpid + 0x2000) >> 4) + 1); - HRSRC hResource; - BOOL bRet = FALSE; - - /* FIXME: Is it correct to use the system default langid? */ - langId = GetSystemDefaultLangID(); - - if (SUBLANGID(langId) == SUBLANG_NEUTRAL) - langId = MAKELANGID( PRIMARYLANGID(langId), SUBLANG_DEFAULT ); - - hResource = FindResourceExW( hCurrentModule, (LPWSTR)RT_STRING, szResourceName, langId ); - - if (hResource) - { - HGLOBAL hResDir = LoadResource( hCurrentModule, hResource ); - - if (hResDir) - { - ULONG iResourceIndex = lgrpid & 0xf; - LPCWSTR lpResEntry = LockResource( hResDir ); - ULONG i; - - for (i = 0; i < iResourceIndex; i++) - lpResEntry += *lpResEntry + 1; - - if (*lpResEntry < nameSize) - { - memcpy( szName, lpResEntry + 1, *lpResEntry * sizeof(WCHAR) ); - szName[*lpResEntry] = '\0'; - bRet = TRUE; - } - - } - FreeResource( hResource ); - } - else DPRINT1("FindResourceExW() failed\n"); - - return bRet; -} - - -/* Callback function ptrs for EnumLanguageGrouplocalesA/W */ -typedef struct -{ - LANGGROUPLOCALE_ENUMPROCA procA; - LANGGROUPLOCALE_ENUMPROCW procW; - DWORD dwFlags; - LGRPID lgrpid; - LONG_PTR lParam; -} ENUMLANGUAGEGROUPLOCALE_CALLBACKS; - -/* Internal implementation of EnumLanguageGrouplocalesA/W */ -static BOOL NLS_EnumLanguageGroupLocales(ENUMLANGUAGEGROUPLOCALE_CALLBACKS *lpProcs) -{ - static const WCHAR szAlternateSortsKeyName[] = { - 'A','l','t','e','r','n','a','t','e',' ','S','o','r','t','s','\0' - }; - WCHAR szNumber[10], szValue[4]; - HANDLE hKey; - BOOL bContinue = TRUE, bAlternate = FALSE; - LGRPID lgrpid; - ULONG ulIndex = 1; /* Ignore default entry of 1st key */ - - if (!lpProcs || !lpProcs->lgrpid || lpProcs->lgrpid > LGRPID_ARMENIAN) - { - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } - - if (lpProcs->dwFlags) - { - SetLastError(ERROR_INVALID_FLAGS); - return FALSE; - } - - hKey = NLS_RegOpenKey( 0, szLocaleKeyName ); - - if (!hKey) - { - DPRINT1("NLS_RegOpenKey() failed\n"); - return FALSE; - } - - while (bContinue) - { - if (NLS_RegEnumValue( hKey, ulIndex, szNumber, sizeof(szNumber), - szValue, sizeof(szValue) )) - { - lgrpid = wcstoul( szValue, NULL, 16 ); - - DPRINT("lcid %s, grpid %d (%smatched)\n", szNumber, - lgrpid, lgrpid == lpProcs->lgrpid ? "" : "not "); - - if (lgrpid == lpProcs->lgrpid) - { - LCID lcid; - - lcid = wcstoul( szNumber, NULL, 16 ); - - /* FIXME: native returns extra text for a few (17/150) locales, e.g: - * '00000437 ;Georgian' - * At present we only pass the LCID string. - */ - - if (lpProcs->procW) - bContinue = lpProcs->procW( lgrpid, lcid, szNumber, lpProcs->lParam ); - else - { - char szNumberA[sizeof(szNumber)/sizeof(WCHAR)]; - - WideCharToMultiByte(CP_ACP, 0, szNumber, -1, szNumberA, sizeof(szNumberA), 0, 0); - - bContinue = lpProcs->procA( lgrpid, lcid, szNumberA, lpProcs->lParam ); - } - } - - ulIndex++; - } - else - { - /* Finished enumerating this key */ - if (!bAlternate) - { - /* Enumerate alternate sorts also */ - hKey = NLS_RegOpenKey( hKey, szAlternateSortsKeyName ); - bAlternate = TRUE; - ulIndex = 0; - } - else - bContinue = FALSE; /* Finished both keys */ - } - - if (!bContinue) - break; - } - - if (hKey) - NtClose( hKey ); - - return TRUE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -EnumLanguageGroupLocalesA( - LANGGROUPLOCALE_ENUMPROCA lpLangGroupLocaleEnumProc, - LGRPID LanguageGroup, - DWORD dwFlags, - LONG_PTR lParam) -{ - ENUMLANGUAGEGROUPLOCALE_CALLBACKS callbacks; - - DPRINT("(%p,0x%08X,0x%08X,0x%08lX)\n", lpLangGroupLocaleEnumProc, LanguageGroup, dwFlags, lParam); - - callbacks.procA = lpLangGroupLocaleEnumProc; - callbacks.procW = NULL; - callbacks.dwFlags = dwFlags; - callbacks.lgrpid = LanguageGroup; - callbacks.lParam = lParam; - - return NLS_EnumLanguageGroupLocales( lpLangGroupLocaleEnumProc ? &callbacks : NULL ); -} - - -/* - * @implemented - */ -BOOL -WINAPI -EnumLanguageGroupLocalesW( - LANGGROUPLOCALE_ENUMPROCW lpLangGroupLocaleEnumProc, - LGRPID LanguageGroup, - DWORD dwFlags, - LONG_PTR lParam) -{ - ENUMLANGUAGEGROUPLOCALE_CALLBACKS callbacks; - - DPRINT("(%p,0x%08X,0x%08X,0x%08lX)\n", lpLangGroupLocaleEnumProc, LanguageGroup, dwFlags, lParam); - - callbacks.procA = NULL; - callbacks.procW = lpLangGroupLocaleEnumProc; - callbacks.dwFlags = dwFlags; - callbacks.lgrpid = LanguageGroup; - callbacks.lParam = lParam; - - return NLS_EnumLanguageGroupLocales( lpLangGroupLocaleEnumProc ? &callbacks : NULL ); -} - - -/* Callback function ptrs for EnumSystemCodePagesA/W */ -typedef struct -{ - CODEPAGE_ENUMPROCA procA; - CODEPAGE_ENUMPROCW procW; - DWORD dwFlags; -} ENUMSYSTEMCODEPAGES_CALLBACKS; - -/* Internal implementation of EnumSystemCodePagesA/W */ -static BOOL NLS_EnumSystemCodePages(ENUMSYSTEMCODEPAGES_CALLBACKS *lpProcs) -{ - WCHAR szNumber[5 + 1], szValue[MAX_PATH]; - HANDLE hKey; - BOOL bContinue = TRUE; - ULONG ulIndex = 0; - - if (!lpProcs) - { - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } - - switch (lpProcs->dwFlags) - { - case CP_INSTALLED: - case CP_SUPPORTED: - break; - default: - SetLastError(ERROR_INVALID_FLAGS); - return FALSE; - } - - hKey = NLS_RegOpenKey(0, L"\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\NLS\\CodePage"); - if (!hKey) - { - DPRINT1("NLS_RegOpenKey() failed\n"); - return FALSE; - } - - while (bContinue) - { - if (NLS_RegEnumValue(hKey, ulIndex, szNumber, sizeof(szNumber), - szValue, sizeof(szValue))) - { - if ((lpProcs->dwFlags == CP_SUPPORTED)|| - ((lpProcs->dwFlags == CP_INSTALLED)&&(wcslen(szValue) > 2))) - { - if (lpProcs->procW) - { - bContinue = lpProcs->procW(szNumber); - } - else - { - char szNumberA[sizeof(szNumber)/sizeof(WCHAR)]; - - WideCharToMultiByte(CP_ACP, 0, szNumber, -1, szNumberA, sizeof(szNumberA), 0, 0); - bContinue = lpProcs->procA(szNumberA); - } - } - - ulIndex++; - - } else bContinue = FALSE; - - if (!bContinue) - break; - } - - if (hKey) - NtClose(hKey); - - return TRUE; -} - -/* - * @implemented - */ -BOOL -WINAPI -EnumSystemCodePagesW ( - CODEPAGE_ENUMPROCW lpCodePageEnumProc, - DWORD dwFlags - ) -{ - ENUMSYSTEMCODEPAGES_CALLBACKS procs; - - DPRINT("(%p,0x%08X,0x%08lX)\n", lpCodePageEnumProc, dwFlags); - - procs.procA = NULL; - procs.procW = lpCodePageEnumProc; - procs.dwFlags = dwFlags; - - return NLS_EnumSystemCodePages(lpCodePageEnumProc ? &procs : NULL); -} - - -/* - * @implemented - */ -BOOL -WINAPI -EnumSystemCodePagesA ( - CODEPAGE_ENUMPROCA lpCodePageEnumProc, - DWORD dwFlags - ) -{ - ENUMSYSTEMCODEPAGES_CALLBACKS procs; - - DPRINT("(%p,0x%08X,0x%08lX)\n", lpCodePageEnumProc, dwFlags); - - procs.procA = lpCodePageEnumProc; - procs.procW = NULL; - procs.dwFlags = dwFlags; - - return NLS_EnumSystemCodePages(lpCodePageEnumProc ? &procs : NULL); -} - - -/* - * @implemented - */ -BOOL -WINAPI -EnumSystemGeoID( - GEOCLASS GeoClass, - GEOID ParentGeoId, // reserved - GEO_ENUMPROC lpGeoEnumProc) -{ - WCHAR szNumber[5 + 1]; - ULONG ulIndex = 0; - HANDLE hKey; - - DPRINT("(0x%08X,0x%08X,%p)\n", GeoClass, ParentGeoId, lpGeoEnumProc); - - if(!lpGeoEnumProc || GeoClass != GEOCLASS_NATION) - { - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } - - hKey = NLS_RegOpenKey(0, L"\\REGISTRY\\Machine\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Telephony\\Country List"); - if (!hKey) - { - DPRINT1("NLS_RegOpenKey() failed\n"); - return FALSE; - } - - while (NLS_RegEnumSubKey(hKey, ulIndex, szNumber, sizeof(szNumber))) - { - BOOL bContinue = TRUE; - DWORD dwGeoId; - HANDLE hSubKey = NLS_RegOpenKey(hKey, szNumber); - - if (hSubKey) - { - if (NLS_RegGetDword(hSubKey, L"CountryCode", &dwGeoId)) - { - if (!lpGeoEnumProc(dwGeoId)) - bContinue = FALSE; - } - - NtClose(hSubKey); - } - - if (!bContinue) - break; - - ulIndex++; - } - - if (hKey) - NtClose(hKey); - - return TRUE; -} - - -/* Callback function ptrs for EnumSystemLanguageGroupsA/W */ -typedef struct -{ - LANGUAGEGROUP_ENUMPROCA procA; - LANGUAGEGROUP_ENUMPROCW procW; - DWORD dwFlags; - LONG_PTR lParam; -} ENUMLANGUAGEGROUP_CALLBACKS; - - -/* Internal implementation of EnumSystemLanguageGroupsA/W */ -static BOOL NLS_EnumSystemLanguageGroups(ENUMLANGUAGEGROUP_CALLBACKS *lpProcs) -{ - WCHAR szNumber[10], szValue[4]; - HANDLE hKey; - BOOL bContinue = TRUE; - ULONG ulIndex = 0; - - if (!lpProcs) - { - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } - - switch (lpProcs->dwFlags) - { - case 0: - /* Default to LGRPID_INSTALLED */ - lpProcs->dwFlags = LGRPID_INSTALLED; - /* Fall through... */ - case LGRPID_INSTALLED: - case LGRPID_SUPPORTED: - break; - default: - SetLastError(ERROR_INVALID_FLAGS); - return FALSE; - } - - hKey = NLS_RegOpenKey( 0, szLangGroupsKeyName ); - - if (!hKey) - { - DPRINT1("NLS_RegOpenKey() failed, KeyName='%S'\n", szLangGroupsKeyName); - return FALSE; - } - - while (bContinue) - { - if (NLS_RegEnumValue( hKey, ulIndex, szNumber, sizeof(szNumber), - szValue, sizeof(szValue) )) - { - BOOL bInstalled = szValue[0] == '1' ? TRUE : FALSE; - LGRPID lgrpid = wcstoul( szNumber, NULL, 16 ); - - DPRINT("grpid %s (%sinstalled)\n", szNumber, - bInstalled ? "" : "not "); - - if (lpProcs->dwFlags == LGRPID_SUPPORTED || bInstalled) - { - WCHAR szGrpName[48]; - - if (!NLS_GetLanguageGroupName( lgrpid, szGrpName, sizeof(szGrpName) / sizeof(WCHAR) )) - szGrpName[0] = '\0'; - - if (lpProcs->procW) - bContinue = lpProcs->procW( lgrpid, szNumber, szGrpName, lpProcs->dwFlags, - lpProcs->lParam ); - else - { - char szNumberA[sizeof(szNumber)/sizeof(WCHAR)]; - char szGrpNameA[48]; - - /* FIXME: MSDN doesn't say which code page the W->A translation uses, - * or whether the language names are ever localised. Assume CP_ACP. - */ - - WideCharToMultiByte(CP_ACP, 0, szNumber, -1, szNumberA, sizeof(szNumberA), 0, 0); - WideCharToMultiByte(CP_ACP, 0, szGrpName, -1, szGrpNameA, sizeof(szGrpNameA), 0, 0); - - bContinue = lpProcs->procA( lgrpid, szNumberA, szGrpNameA, lpProcs->dwFlags, - lpProcs->lParam ); - } - } - - ulIndex++; - } - else - bContinue = FALSE; - - if (!bContinue) - break; - } - - if (hKey) - NtClose( hKey ); - - return TRUE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -EnumSystemLanguageGroupsA( - LANGUAGEGROUP_ENUMPROCA pLangGroupEnumProc, - DWORD dwFlags, - LONG_PTR lParam) -{ - ENUMLANGUAGEGROUP_CALLBACKS procs; - - DPRINT("(%p,0x%08X,0x%08lX)\n", pLangGroupEnumProc, dwFlags, lParam); - - procs.procA = pLangGroupEnumProc; - procs.procW = NULL; - procs.dwFlags = dwFlags; - procs.lParam = lParam; - - return NLS_EnumSystemLanguageGroups( pLangGroupEnumProc ? &procs : NULL); -} - - -/* - * @implemented - */ -BOOL -WINAPI -EnumSystemLanguageGroupsW( - LANGUAGEGROUP_ENUMPROCW pLangGroupEnumProc, - DWORD dwFlags, - LONG_PTR lParam) -{ - ENUMLANGUAGEGROUP_CALLBACKS procs; - - DPRINT("(%p,0x%08X,0x%08lX)\n", pLangGroupEnumProc, dwFlags, lParam); - - procs.procA = NULL; - procs.procW = pLangGroupEnumProc; - procs.dwFlags = dwFlags; - procs.lParam = lParam; - - return NLS_EnumSystemLanguageGroups( pLangGroupEnumProc ? &procs : NULL); -} - - -/* Callback function ptrs for EnumSystemLocalesA/W */ -typedef struct -{ - LOCALE_ENUMPROCA procA; - LOCALE_ENUMPROCW procW; - DWORD dwFlags; -} ENUMSYSTEMLOCALES_CALLBACKS; - - -/* Internal implementation of EnumSystemLocalesA/W */ -static BOOL NLS_EnumSystemLocales(ENUMSYSTEMLOCALES_CALLBACKS *lpProcs) -{ - WCHAR szNumber[10], szValue[4]; - HANDLE hKey; - BOOL bContinue = TRUE; - ULONG ulIndex = 0; - - if (!lpProcs) - { - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } - - /* Passing 0 flags behaves like LCID_SUPPORTED */ - if (lpProcs->dwFlags == 0) - { - lpProcs->dwFlags = LCID_SUPPORTED; - } - - switch (lpProcs->dwFlags) - { - case LCID_ALTERNATE_SORTS: - case LCID_INSTALLED: - case LCID_SUPPORTED: - break; - default: - SetLastError(ERROR_INVALID_FLAGS); - return FALSE; - } - - hKey = NLS_RegOpenKey(0, L"\\Registry\\Machine\\System\\CurrentControlSet\\Control\\Nls\\Locale"); - - if (!hKey) - { - DPRINT1("NLS_RegOpenKey() failed\n"); - return FALSE; - } - - while (bContinue) - { - if (NLS_RegEnumValue( hKey, ulIndex, szNumber, sizeof(szNumber), - szValue, sizeof(szValue))) - { - if ((lpProcs->dwFlags == LCID_SUPPORTED)|| - ((lpProcs->dwFlags == LCID_INSTALLED)&&(wcslen(szValue) > 0))) - { - if (lpProcs->procW) - { - bContinue = lpProcs->procW(szNumber); - } - else - { - char szNumberA[sizeof(szNumber)/sizeof(WCHAR)]; - - WideCharToMultiByte(CP_ACP, 0, szNumber, -1, szNumberA, sizeof(szNumberA), 0, 0); - bContinue = lpProcs->procA(szNumberA); - } - } - - ulIndex++; - } - else - bContinue = FALSE; - - if (!bContinue) - break; - } - - if (hKey) - NtClose(hKey); - - return TRUE; -} - -/* - * @implemented - */ -BOOL -WINAPI -EnumSystemLocalesA ( - LOCALE_ENUMPROCA lpLocaleEnumProc, - DWORD dwFlags - ) -{ - ENUMSYSTEMLOCALES_CALLBACKS procs; - - DPRINT("(%p,0x%08X)\n", lpLocaleEnumProc, dwFlags); - - procs.procA = lpLocaleEnumProc; - procs.procW = NULL; - procs.dwFlags = dwFlags; - - return NLS_EnumSystemLocales(lpLocaleEnumProc ? &procs : NULL); -} - - -/* - * @implemented - */ -BOOL -WINAPI -EnumSystemLocalesW ( - LOCALE_ENUMPROCW lpLocaleEnumProc, - DWORD dwFlags - ) -{ - ENUMSYSTEMLOCALES_CALLBACKS procs; - - DPRINT("(%p,0x%08X)\n", lpLocaleEnumProc, dwFlags); - - procs.procA = NULL; - procs.procW = lpLocaleEnumProc; - procs.dwFlags = dwFlags; - - return NLS_EnumSystemLocales(lpLocaleEnumProc ? &procs : NULL); -} - - -static BOOL CALLBACK enum_uilang_proc_a( HMODULE hModule, LPCSTR type, - LPCSTR name, WORD LangID, LONG_PTR lParam ) -{ - ENUM_UILANG_CALLBACK *enum_uilang = (ENUM_UILANG_CALLBACK *)lParam; - char buf[20]; - - sprintf(buf, "%08x", (UINT)LangID); - return enum_uilang->u.procA( buf, enum_uilang->param ); -} - - -/* - * @implemented - */ -BOOL -WINAPI -EnumUILanguagesA( - UILANGUAGE_ENUMPROCA lpUILanguageEnumProc, - DWORD dwFlags, - LONG_PTR lParam) -{ - ENUM_UILANG_CALLBACK enum_uilang; - - DPRINT("%p, %x, %lx\n", lpUILanguageEnumProc, dwFlags, lParam); - - if(!lpUILanguageEnumProc) { - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } - if(dwFlags) { - SetLastError(ERROR_INVALID_FLAGS); - return FALSE; - } - - enum_uilang.u.procA = lpUILanguageEnumProc; - enum_uilang.flags = dwFlags; - enum_uilang.param = lParam; - - EnumResourceLanguagesA( hCurrentModule, (LPCSTR)RT_STRING, - (LPCSTR)LOCALE_ILANGUAGE, enum_uilang_proc_a, - (LONG_PTR)&enum_uilang); - return TRUE; -} - -static BOOL CALLBACK enum_uilang_proc_w( HMODULE hModule, LPCWSTR type, - LPCWSTR name, WORD LangID, LONG_PTR lParam ) -{ - static const WCHAR formatW[] = {'%','0','8','x',0}; - ENUM_UILANG_CALLBACK *enum_uilang = (ENUM_UILANG_CALLBACK *)lParam; - WCHAR buf[20]; - - swprintf( buf, formatW, (UINT)LangID ); - return enum_uilang->u.procW( buf, enum_uilang->param ); -} - -/* - * @implemented - */ -BOOL -WINAPI -EnumUILanguagesW( - UILANGUAGE_ENUMPROCW lpUILanguageEnumProc, - DWORD dwFlags, - LONG_PTR lParam) -{ - ENUM_UILANG_CALLBACK enum_uilang; - - DPRINT("%p, %x, %lx\n", lpUILanguageEnumProc, dwFlags, lParam); - - - if(!lpUILanguageEnumProc) { - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } - if(dwFlags) { - SetLastError(ERROR_INVALID_FLAGS); - return FALSE; - } - - enum_uilang.u.procW = lpUILanguageEnumProc; - enum_uilang.flags = dwFlags; - enum_uilang.param = lParam; - - EnumResourceLanguagesW( hCurrentModule, (LPCWSTR)RT_STRING, - (LPCWSTR)LOCALE_ILANGUAGE, enum_uilang_proc_w, - (LONG_PTR)&enum_uilang); - return TRUE; -} - -/* - * @implemented - */ -int -WINAPI -GetCalendarInfoA( - LCID lcid, - CALID Calendar, - CALTYPE CalType, - LPSTR lpCalData, - int cchData, - LPDWORD lpValue - ) -{ - int ret; - LPWSTR lpCalDataW = NULL; - - if (NLS_IsUnicodeOnlyLcid(lcid)) - { - SetLastError(ERROR_INVALID_PARAMETER); - return 0; - } - - if (cchData && - !(lpCalDataW = HeapAlloc(GetProcessHeap(), 0, cchData*sizeof(WCHAR)))) - return 0; - - ret = GetCalendarInfoW(lcid, Calendar, CalType, lpCalDataW, cchData, lpValue); - if(ret && lpCalDataW && lpCalData) - WideCharToMultiByte(CP_ACP, 0, lpCalDataW, cchData, lpCalData, cchData, NULL, NULL); - HeapFree(GetProcessHeap(), 0, lpCalDataW); - - return ret; -} - - -/* - * @unimplemented - */ -int -WINAPI -GetCalendarInfoW( - LCID Locale, - CALID Calendar, - CALTYPE CalType, - LPWSTR lpCalData, - int cchData, - LPDWORD lpValue) -{ - if (CalType & CAL_NOUSEROVERRIDE) - DPRINT("FIXME: flag CAL_NOUSEROVERRIDE used, not fully implemented\n"); - if (CalType & CAL_USE_CP_ACP) - DPRINT("FIXME: flag CAL_USE_CP_ACP used, not fully implemented\n"); - - if (CalType & CAL_RETURN_NUMBER) { - if (lpCalData != NULL) - DPRINT("WARNING: lpCalData not NULL (%p) when it should!\n", lpCalData); - if (cchData != 0) - DPRINT("WARNING: cchData not 0 (%d) when it should!\n", cchData); - } else { - if (lpValue != NULL) - DPRINT("WARNING: lpValue not NULL (%p) when it should!\n", lpValue); - } - - /* FIXME: No verification is made yet wrt Locale - * for the CALTYPES not requiring GetLocaleInfoA */ - switch (CalType & ~(CAL_NOUSEROVERRIDE|CAL_RETURN_NUMBER|CAL_USE_CP_ACP)) { - case CAL_ICALINTVALUE: - DPRINT("FIXME: Unimplemented caltype %d\n", CalType & 0xffff); - return E_FAIL; - case CAL_SCALNAME: - DPRINT("FIXME: Unimplemented caltype %d\n", CalType & 0xffff); - return E_FAIL; - case CAL_IYEAROFFSETRANGE: - DPRINT("FIXME: Unimplemented caltype %d\n", CalType & 0xffff); - return E_FAIL; - case CAL_SERASTRING: - DPRINT("FIXME: Unimplemented caltype %d\n", CalType & 0xffff); - return E_FAIL; - case CAL_SSHORTDATE: - return GetLocaleInfoW(Locale, LOCALE_SSHORTDATE, lpCalData, cchData); - case CAL_SLONGDATE: - return GetLocaleInfoW(Locale, LOCALE_SLONGDATE, lpCalData, cchData); - case CAL_SDAYNAME1: - return GetLocaleInfoW(Locale, LOCALE_SDAYNAME1, lpCalData, cchData); - case CAL_SDAYNAME2: - return GetLocaleInfoW(Locale, LOCALE_SDAYNAME2, lpCalData, cchData); - case CAL_SDAYNAME3: - return GetLocaleInfoW(Locale, LOCALE_SDAYNAME3, lpCalData, cchData); - case CAL_SDAYNAME4: - return GetLocaleInfoW(Locale, LOCALE_SDAYNAME4, lpCalData, cchData); - case CAL_SDAYNAME5: - return GetLocaleInfoW(Locale, LOCALE_SDAYNAME5, lpCalData, cchData); - case CAL_SDAYNAME6: - return GetLocaleInfoW(Locale, LOCALE_SDAYNAME6, lpCalData, cchData); - case CAL_SDAYNAME7: - return GetLocaleInfoW(Locale, LOCALE_SDAYNAME7, lpCalData, cchData); - case CAL_SABBREVDAYNAME1: - return GetLocaleInfoW(Locale, LOCALE_SABBREVDAYNAME1, lpCalData, cchData); - case CAL_SABBREVDAYNAME2: - return GetLocaleInfoW(Locale, LOCALE_SABBREVDAYNAME2, lpCalData, cchData); - case CAL_SABBREVDAYNAME3: - return GetLocaleInfoW(Locale, LOCALE_SABBREVDAYNAME3, lpCalData, cchData); - case CAL_SABBREVDAYNAME4: - return GetLocaleInfoW(Locale, LOCALE_SABBREVDAYNAME4, lpCalData, cchData); - case CAL_SABBREVDAYNAME5: - return GetLocaleInfoW(Locale, LOCALE_SABBREVDAYNAME5, lpCalData, cchData); - case CAL_SABBREVDAYNAME6: - return GetLocaleInfoW(Locale, LOCALE_SABBREVDAYNAME6, lpCalData, cchData); - case CAL_SABBREVDAYNAME7: - return GetLocaleInfoW(Locale, LOCALE_SABBREVDAYNAME7, lpCalData, cchData); - case CAL_SMONTHNAME1: - return GetLocaleInfoW(Locale, LOCALE_SMONTHNAME1, lpCalData, cchData); - case CAL_SMONTHNAME2: - return GetLocaleInfoW(Locale, LOCALE_SMONTHNAME2, lpCalData, cchData); - case CAL_SMONTHNAME3: - return GetLocaleInfoW(Locale, LOCALE_SMONTHNAME3, lpCalData, cchData); - case CAL_SMONTHNAME4: - return GetLocaleInfoW(Locale, LOCALE_SMONTHNAME4, lpCalData, cchData); - case CAL_SMONTHNAME5: - return GetLocaleInfoW(Locale, LOCALE_SMONTHNAME5, lpCalData, cchData); - case CAL_SMONTHNAME6: - return GetLocaleInfoW(Locale, LOCALE_SMONTHNAME6, lpCalData, cchData); - case CAL_SMONTHNAME7: - return GetLocaleInfoW(Locale, LOCALE_SMONTHNAME7, lpCalData, cchData); - case CAL_SMONTHNAME8: - return GetLocaleInfoW(Locale, LOCALE_SMONTHNAME8, lpCalData, cchData); - case CAL_SMONTHNAME9: - return GetLocaleInfoW(Locale, LOCALE_SMONTHNAME9, lpCalData, cchData); - case CAL_SMONTHNAME10: - return GetLocaleInfoW(Locale, LOCALE_SMONTHNAME10, lpCalData, cchData); - case CAL_SMONTHNAME11: - return GetLocaleInfoW(Locale, LOCALE_SMONTHNAME11, lpCalData, cchData); - case CAL_SMONTHNAME12: - return GetLocaleInfoW(Locale, LOCALE_SMONTHNAME12, lpCalData, cchData); - case CAL_SMONTHNAME13: - return GetLocaleInfoW(Locale, LOCALE_SMONTHNAME13, lpCalData, cchData); - case CAL_SABBREVMONTHNAME1: - return GetLocaleInfoW(Locale, LOCALE_SABBREVMONTHNAME1, lpCalData, cchData); - case CAL_SABBREVMONTHNAME2: - return GetLocaleInfoW(Locale, LOCALE_SABBREVMONTHNAME2, lpCalData, cchData); - case CAL_SABBREVMONTHNAME3: - return GetLocaleInfoW(Locale, LOCALE_SABBREVMONTHNAME3, lpCalData, cchData); - case CAL_SABBREVMONTHNAME4: - return GetLocaleInfoW(Locale, LOCALE_SABBREVMONTHNAME4, lpCalData, cchData); - case CAL_SABBREVMONTHNAME5: - return GetLocaleInfoW(Locale, LOCALE_SABBREVMONTHNAME5, lpCalData, cchData); - case CAL_SABBREVMONTHNAME6: - return GetLocaleInfoW(Locale, LOCALE_SABBREVMONTHNAME6, lpCalData, cchData); - case CAL_SABBREVMONTHNAME7: - return GetLocaleInfoW(Locale, LOCALE_SABBREVMONTHNAME7, lpCalData, cchData); - case CAL_SABBREVMONTHNAME8: - return GetLocaleInfoW(Locale, LOCALE_SABBREVMONTHNAME8, lpCalData, cchData); - case CAL_SABBREVMONTHNAME9: - return GetLocaleInfoW(Locale, LOCALE_SABBREVMONTHNAME9, lpCalData, cchData); - case CAL_SABBREVMONTHNAME10: - return GetLocaleInfoW(Locale, LOCALE_SABBREVMONTHNAME10, lpCalData, cchData); - case CAL_SABBREVMONTHNAME11: - return GetLocaleInfoW(Locale, LOCALE_SABBREVMONTHNAME11, lpCalData, cchData); - case CAL_SABBREVMONTHNAME12: - return GetLocaleInfoW(Locale, LOCALE_SABBREVMONTHNAME12, lpCalData, cchData); - case CAL_SABBREVMONTHNAME13: - return GetLocaleInfoW(Locale, LOCALE_SABBREVMONTHNAME13, lpCalData, cchData); - case CAL_SYEARMONTH: - return GetLocaleInfoW(Locale, LOCALE_SYEARMONTH, lpCalData, cchData); - case CAL_ITWODIGITYEARMAX: - if (lpValue) *lpValue = CALINFO_MAX_YEAR; - break; - default: DPRINT("Unknown caltype %d\n",CalType & 0xffff); - return E_FAIL; - } - return 0; -} - - -/* - * @implemented - */ -BOOL -WINAPI -GetCPInfo(UINT CodePage, - LPCPINFO CodePageInfo) -{ - PCODEPAGE_ENTRY CodePageEntry; - - if (!CodePageInfo) - { - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } - - CodePageEntry = IntGetCodePageEntry(CodePage); - if (CodePageEntry == NULL) - { - switch(CodePage) - { - case CP_UTF7: - case CP_UTF8: - CodePageInfo->DefaultChar[0] = 0x3f; - CodePageInfo->DefaultChar[1] = 0; - CodePageInfo->LeadByte[0] = CodePageInfo->LeadByte[1] = 0; - CodePageInfo->MaxCharSize = (CodePage == CP_UTF7) ? 5 : 4; - return TRUE; - } - - SetLastError( ERROR_INVALID_PARAMETER ); - return FALSE; - } - - if (CodePageEntry->CodePageTable.DefaultChar & 0xff00) - { - CodePageInfo->DefaultChar[0] = (CodePageEntry->CodePageTable.DefaultChar & 0xff00) >> 8; - CodePageInfo->DefaultChar[1] = CodePageEntry->CodePageTable.DefaultChar & 0x00ff; - } - else - { - CodePageInfo->DefaultChar[0] = CodePageEntry->CodePageTable.DefaultChar & 0xff; - CodePageInfo->DefaultChar[1] = 0; - } - - if ((CodePageInfo->MaxCharSize = CodePageEntry->CodePageTable.MaximumCharacterSize) == 2) - memcpy(CodePageInfo->LeadByte, CodePageEntry->CodePageTable.LeadByte, sizeof(CodePageInfo->LeadByte)); - else - CodePageInfo->LeadByte[0] = CodePageInfo->LeadByte[1] = 0; - - return TRUE; -} - -static BOOL -GetLocalisedText(DWORD dwResId, WCHAR *lpszDest) -{ - HRSRC hrsrc; - LCID lcid; - LANGID langId; - DWORD dwId; - - if (dwResId == 37) - dwId = dwResId * 100; - else - dwId = dwResId; - - lcid = GetUserDefaultLCID(); - lcid = ConvertDefaultLocale(lcid); - - langId = LANGIDFROMLCID(lcid); - - if (PRIMARYLANGID(langId) == LANG_NEUTRAL) - langId = MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US); - - hrsrc = FindResourceExW(hCurrentModule, - (LPWSTR)RT_STRING, - MAKEINTRESOURCEW((dwId >> 4) + 1), - langId); - if (hrsrc) - { - HGLOBAL hmem = LoadResource(hCurrentModule, hrsrc); - - if (hmem) - { - const WCHAR *p; - unsigned int i; - - p = LockResource(hmem); - for (i = 0; i < (dwId & 0x0f); i++) p += *p + 1; - - memcpy(lpszDest, p + 1, *p * sizeof(WCHAR)); - lpszDest[*p] = '\0'; - - return TRUE; - } - } - - DPRINT1("Could not get codepage name. dwResId = %ld\n", dwResId); - return FALSE; -} - -/* - * @implemented - */ -BOOL -WINAPI -GetCPInfoExW(UINT CodePage, - DWORD dwFlags, - LPCPINFOEXW lpCPInfoEx) -{ - if (!GetCPInfo(CodePage, (LPCPINFO) lpCPInfoEx)) - return FALSE; - - switch(CodePage) - { - case CP_UTF7: - { - lpCPInfoEx->CodePage = CP_UTF7; - lpCPInfoEx->UnicodeDefaultChar = 0x3f; - return GetLocalisedText((DWORD)CodePage, lpCPInfoEx->CodePageName); - } - break; - - case CP_UTF8: - { - lpCPInfoEx->CodePage = CP_UTF8; - lpCPInfoEx->UnicodeDefaultChar = 0x3f; - return GetLocalisedText((DWORD)CodePage, lpCPInfoEx->CodePageName); - } - - default: - { - PCODEPAGE_ENTRY CodePageEntry; - - CodePageEntry = IntGetCodePageEntry(CodePage); - if (CodePageEntry == NULL) - { - DPRINT1("Could not get CodePage Entry! CodePageEntry = 0\n"); - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } - - lpCPInfoEx->CodePage = CodePageEntry->CodePageTable.CodePage; - lpCPInfoEx->UnicodeDefaultChar = CodePageEntry->CodePageTable.UniDefaultChar; - return GetLocalisedText((DWORD)CodePage, lpCPInfoEx->CodePageName); - } - break; - } -} - - -/* - * @implemented - */ -BOOL -WINAPI -GetCPInfoExA(UINT CodePage, - DWORD dwFlags, - LPCPINFOEXA lpCPInfoEx) -{ - CPINFOEXW CPInfo; - - if (!GetCPInfoExW(CodePage, dwFlags, &CPInfo)) - return FALSE; - - /* the layout is the same except for CodePageName */ - memcpy(lpCPInfoEx, &CPInfo, sizeof(CPINFOEXA)); - - WideCharToMultiByte(CP_ACP, - 0, - CPInfo.CodePageName, - -1, - lpCPInfoEx->CodePageName, - sizeof(lpCPInfoEx->CodePageName), - NULL, - NULL); - return TRUE; -} - -static int -NLS_GetGeoFriendlyName(GEOID Location, LPWSTR szFriendlyName, int cchData) -{ - HANDLE hKey; - WCHAR szPath[MAX_PATH]; - UNICODE_STRING ValueName; - KEY_VALUE_PARTIAL_INFORMATION *info; - static const int info_size = FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION, Data); - DWORD dwSize; - NTSTATUS Status; - int Ret; - - swprintf(szPath, L"\\REGISTRY\\Machine\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Telephony\\Country List\\%d", Location); - - hKey = NLS_RegOpenKey(0, szPath); - if (!hKey) - { - DPRINT1("NLS_RegOpenKey() failed\n"); - return 0; - } - - dwSize = info_size + cchData * sizeof(WCHAR); - - if (!(info = HeapAlloc(GetProcessHeap(), 0, dwSize))) - { - NtClose(hKey); - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - return 0; - } - - RtlInitUnicodeString(&ValueName, L"Name"); - - Status = NtQueryValueKey(hKey, &ValueName, KeyValuePartialInformation, - (LPBYTE)info, dwSize, &dwSize); - - if (!Status) - { - Ret = (dwSize - info_size) / sizeof(WCHAR); - - if (!Ret || ((WCHAR *)info->Data)[Ret-1]) - { - if (Ret < cchData || !szFriendlyName) Ret++; - else - { - SetLastError(ERROR_INSUFFICIENT_BUFFER); - Ret = 0; - } - } - - if (Ret && szFriendlyName) - { - memcpy(szFriendlyName, info->Data, (Ret-1) * sizeof(WCHAR)); - szFriendlyName[Ret-1] = 0; - } - } - else if (Status == STATUS_BUFFER_OVERFLOW && !szFriendlyName) - { - Ret = (dwSize - info_size) / sizeof(WCHAR) + 1; - } - else if (Status == STATUS_OBJECT_NAME_NOT_FOUND) - { - Ret = -1; - } - else - { - SetLastError(RtlNtStatusToDosError(Status)); - Ret = 0; - } - - NtClose(hKey); - HeapFree(GetProcessHeap(), 0, info); - - return Ret; -} - -/* - * @unimplemented - */ -int -WINAPI -GetGeoInfoW( - GEOID Location, - GEOTYPE GeoType, - LPWSTR lpGeoData, - int cchData, - LANGID LangId) -{ - DPRINT("%d %d %p %d %d\n", Location, GeoType, lpGeoData, cchData, LangId); - - if ((GeoType == GEO_TIMEZONES)||(GeoType == GEO_OFFICIALLANGUAGES)) - { - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - } - - switch (GeoType) - { - case GEO_FRIENDLYNAME: - { - return NLS_GetGeoFriendlyName(Location, lpGeoData, cchData); - } - case GEO_NATION: - case GEO_LATITUDE: - case GEO_LONGITUDE: - case GEO_ISO2: - case GEO_ISO3: - case GEO_RFC1766: - case GEO_LCID: - case GEO_OFFICIALNAME: - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - break; - } - - return 0; -} - - -/* - * @unimplemented - */ -int -WINAPI -GetGeoInfoA( - GEOID Location, - GEOTYPE GeoType, - LPSTR lpGeoData, - int cchData, - LANGID LangId) -{ - DPRINT("%d %d %p %d %d\n", Location, GeoType, lpGeoData, cchData, LangId); - - if ((GeoType == GEO_TIMEZONES)||(GeoType == GEO_OFFICIALLANGUAGES)) - { - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - } - - switch (GeoType) - { - case GEO_FRIENDLYNAME: - { - WCHAR szBuffer[MAX_PATH]; - char szBufferA[sizeof(szBuffer)/sizeof(WCHAR)]; - int Ret; - - Ret = NLS_GetGeoFriendlyName(Location, szBuffer, cchData); - - WideCharToMultiByte(CP_ACP, 0, szBuffer, -1, szBufferA, sizeof(szBufferA), 0, 0); - strcpy(lpGeoData, szBufferA); - - return Ret; - } - case GEO_NATION: - case GEO_LATITUDE: - case GEO_LONGITUDE: - case GEO_ISO2: - case GEO_ISO3: - case GEO_RFC1766: - case GEO_LCID: - case GEO_OFFICIALNAME: - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - break; - } - - return 0; -} - -const WCHAR *RosGetLocaleValueName( DWORD lctype ) -{ - switch (lctype & ~LOCALE_LOCALEINFOFLAGSMASK) - { - /* These values are used by SetLocaleInfo and GetLocaleInfo, and - * the values are stored in the registry, confirmed under Windows. - */ - case LOCALE_ICALENDARTYPE: return L"iCalendarType"; - case LOCALE_ICURRDIGITS: return L"iCurrDigits"; - case LOCALE_ICURRENCY: return L"iCurrency"; - case LOCALE_IDIGITS: return L"iDigits"; - case LOCALE_IFIRSTDAYOFWEEK: return L"iFirstDayOfWeek"; - case LOCALE_IFIRSTWEEKOFYEAR: return L"iFirstWeekOfYear"; - case LOCALE_ILZERO: return L"iLZero"; - case LOCALE_IMEASURE: return L"iMeasure"; - case LOCALE_INEGCURR: return L"iNegCurr"; - case LOCALE_INEGNUMBER: return L"iNegNumber"; - case LOCALE_IPAPERSIZE: return L"iPaperSize"; - case LOCALE_ITIME: return L"iTime"; - case LOCALE_S1159: return L"s1159"; - case LOCALE_S2359: return L"s2359"; - case LOCALE_SCURRENCY: return L"sCurrency"; - case LOCALE_SDATE: return L"sDate"; - case LOCALE_SDECIMAL: return L"sDecimal"; - case LOCALE_SGROUPING: return L"sGrouping"; - case LOCALE_SLIST: return L"sList"; - case LOCALE_SLONGDATE: return L"sLongDate"; - case LOCALE_SMONDECIMALSEP: return L"sMonDecimalSep"; - case LOCALE_SMONGROUPING: return L"sMonGrouping"; - case LOCALE_SMONTHOUSANDSEP: return L"sMonThousandSep"; - case LOCALE_SNEGATIVESIGN: return L"sNegativeSign"; - case LOCALE_SPOSITIVESIGN: return L"sPositiveSign"; - case LOCALE_SSHORTDATE: return L"sShortDate"; - case LOCALE_STHOUSAND: return L"sThousand"; - case LOCALE_STIME: return L"sTime"; - case LOCALE_STIMEFORMAT: return L"sTimeFormat"; - case LOCALE_SYEARMONTH: return L"sYearMonth"; - - /* The following are not listed under MSDN as supported, - * but seem to be used and also stored in the registry. - */ - case LOCALE_ICOUNTRY: return L"iCountry"; - case LOCALE_IDATE: return L"iDate"; - case LOCALE_ILDATE: return L"iLDate"; - case LOCALE_ITLZERO: return L"iTLZero"; - case LOCALE_SCOUNTRY: return L"sCountry"; - case LOCALE_SLANGUAGE: return L"sLanguage"; - - /* The following are used in XP and later */ - case LOCALE_IDIGITSUBSTITUTION: return L"NumShape"; - case LOCALE_SNATIVEDIGITS: return L"sNativeDigits"; - case LOCALE_ITIMEMARKPOSN: return L"iTimePrefix"; - } - return NULL; -} - -HKEY RosCreateRegistryKey(void) -{ - OBJECT_ATTRIBUTES objAttr; - UNICODE_STRING nameW; - HANDLE hKey; - - if (RtlOpenCurrentUser( KEY_ALL_ACCESS, &hKey ) != STATUS_SUCCESS) return 0; - - objAttr.Length = sizeof(objAttr); - objAttr.RootDirectory = hKey; - objAttr.ObjectName = &nameW; - objAttr.Attributes = 0; - objAttr.SecurityDescriptor = NULL; - objAttr.SecurityQualityOfService = NULL; - RtlInitUnicodeString( &nameW, L"Control Panel\\International"); - - if (NtCreateKey( &hKey, KEY_ALL_ACCESS, &objAttr, 0, NULL, 0, NULL ) != STATUS_SUCCESS) hKey = 0; - NtClose( objAttr.RootDirectory ); - return hKey; -} - -INT RosGetRegistryLocaleInfo( LPCWSTR lpValue, LPWSTR lpBuffer, INT nLen ) -{ - DWORD dwSize; - HKEY hKey; - INT nRet; - NTSTATUS ntStatus; - UNICODE_STRING usNameW; - KEY_VALUE_PARTIAL_INFORMATION *kvpiInfo; - const int nInfoSize = FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION, Data); - - if (!(hKey = RosCreateRegistryKey())) return -1; - - RtlInitUnicodeString( &usNameW, lpValue ); - dwSize = nInfoSize + nLen * sizeof(WCHAR); - - if (!(kvpiInfo = HeapAlloc( GetProcessHeap(), 0, dwSize ))) - { - NtClose( hKey ); - SetLastError( ERROR_NOT_ENOUGH_MEMORY ); - return 0; - } - - ntStatus = NtQueryValueKey( hKey, &usNameW, KeyValuePartialInformation, kvpiInfo, dwSize, &dwSize ); - - if (!ntStatus) - { - nRet = (dwSize - nInfoSize) / sizeof(WCHAR); - - if (!nRet || ((WCHAR *)kvpiInfo->Data)[nRet - 1]) - { - if (nRet < nLen || !lpBuffer) nRet++; - else - { - SetLastError( ERROR_INSUFFICIENT_BUFFER ); - nRet = 0; - } - } - if (nRet && lpBuffer) - { - memcpy( lpBuffer, kvpiInfo->Data, (nRet - 1) * sizeof(WCHAR) ); - lpBuffer[nRet - 1] = 0; - } - } - else if (ntStatus == STATUS_BUFFER_OVERFLOW && !lpBuffer) - { - nRet = (dwSize - nInfoSize) / sizeof(WCHAR) + 1; - } - else if (ntStatus == STATUS_OBJECT_NAME_NOT_FOUND) - { - nRet = -1; - } - else - { - SetLastError( RtlNtStatusToDosError(ntStatus) ); - nRet = 0; - } - NtClose( hKey ); - HeapFree( GetProcessHeap(), 0, kvpiInfo ); - return nRet; -} - -int -WINAPI -GetLocaleInfoEx ( - LPCWSTR lpLocaleName, - LCTYPE LCType, - LPWSTR lpLCData, - int cchData - ) -{ - return -1; -} - -/* - * @implemented - */ -int -WINAPI -GetLocaleInfoW ( - LCID Locale, - LCTYPE LCType, - LPWSTR lpLCData, - int cchData - ) -{ - LANGID liLangID; - HRSRC hRsrc; - HGLOBAL hMem; - HMODULE hModule; - INT nRet; - UINT uiFlags; - const WCHAR *ch; - int i; - - if (cchData < 0 || (cchData && !lpLCData)) - { - SetLastError( ERROR_INVALID_PARAMETER ); - return 0; - } - if (LCType & LOCALE_RETURN_GENITIVE_NAMES && - !is_genitive_name_supported( LCType )) - { - SetLastError( ERROR_INVALID_FLAGS ); - return 0; - } - - if (!cchData) lpLCData = NULL; - - if (Locale == LOCALE_NEUTRAL || Locale == LOCALE_SYSTEM_DEFAULT) Locale = GetSystemDefaultLCID(); - else if (Locale == LOCALE_USER_DEFAULT) Locale = GetUserDefaultLCID(); - - uiFlags = LCType & LOCALE_LOCALEINFOFLAGSMASK; - LCType &= ~LOCALE_LOCALEINFOFLAGSMASK; - - if (!(uiFlags & LOCALE_NOUSEROVERRIDE) && Locale == GetUserDefaultLCID()) - { - const WCHAR *value = RosGetLocaleValueName(LCType); - - if (value && ((nRet = RosGetRegistryLocaleInfo( value, lpLCData, cchData )) != -1)) return nRet; - } - - liLangID = LANGIDFROMLCID( Locale ); - - if (SUBLANGID(liLangID) == SUBLANG_NEUTRAL) - liLangID = MAKELANGID(PRIMARYLANGID(liLangID), SUBLANG_DEFAULT); - - hModule = GetModuleHandleW( L"kernel32.dll" ); - if (!(hRsrc = FindResourceExW( hModule, (LPWSTR)RT_STRING, (LPCWSTR)((LCType >> 4) + 1), liLangID ))) - { - SetLastError( ERROR_INVALID_FLAGS ); - return 0; - } - if (!(hMem = LoadResource( hModule, hRsrc ))) - return 0; - - ch = LockResource( hMem ); - for (i = 0; i < (LCType & 0x0f); i++) ch += *ch + 1; - - if (uiFlags & LOCALE_RETURN_NUMBER) nRet = sizeof(UINT) / sizeof(WCHAR); - else if (is_genitive_name_supported( LCType ) && *ch) - { - /* genitive form's stored after a null separator from a nominative */ - for (i = 1; i <= *ch; i++) if (!ch[i]) break; - - if (i <= *ch && (uiFlags & LOCALE_RETURN_GENITIVE_NAMES)) - { - nRet = *ch - i + 1; - ch += i; - } - else nRet = i; - } - else - nRet = (LCType == LOCALE_FONTSIGNATURE) ? *ch : *ch + 1; - - if (!lpLCData) return nRet; - - if (nRet > cchData) - { - SetLastError( ERROR_INSUFFICIENT_BUFFER ); - return 0; - } - - if (uiFlags & LOCALE_RETURN_NUMBER) - { - UINT uiNum; - WCHAR *chEnd, *chTmp = HeapAlloc( GetProcessHeap(), 0, (*ch + 1) * sizeof(WCHAR) ); - - if (!chTmp) - return 0; - - memcpy( chTmp, ch + 1, *ch * sizeof(WCHAR) ); - chTmp[*ch] = L'\0'; - uiNum = wcstol( chTmp, &chEnd, 10 ); - - if (!*chEnd) - memcpy( lpLCData, &uiNum, sizeof(uiNum) ); - else - { - SetLastError( ERROR_INVALID_FLAGS ); - nRet = 0; - } - HeapFree( GetProcessHeap(), 0, chTmp ); - } - else - { - memcpy( lpLCData, ch + 1, nRet * sizeof(WCHAR) ); - if (LCType != LOCALE_FONTSIGNATURE) lpLCData[nRet-1] = 0; - } - return nRet; -} - - - -/*********************************************************************** - * get_lcid_codepage - * - * Retrieve the ANSI codepage for a given locale. - */ -__inline static UINT get_lcid_codepage( LCID lcid ) -{ - UINT ret; - if (!GetLocaleInfoW( lcid, LOCALE_IDEFAULTANSICODEPAGE|LOCALE_RETURN_NUMBER, (WCHAR *)&ret, - sizeof(ret)/sizeof(WCHAR) )) ret = 0; - return ret; -} - - -/************************************************************************* - * FoldStringA (KERNEL32.@) - * - * Map characters in a string. - * - * PARAMS - * dwFlags [I] Flags controlling chars to map (MAP_ constants from "winnls.h") - * src [I] String to map - * srclen [I] Length of src, or -1 if src is NUL terminated - * dst [O] Destination for mapped string - * dstlen [I] Length of dst, or 0 to find the required length for the mapped string - * - * RETURNS - * Success: The length of the string written to dst, including the terminating NUL. If - * dstlen is 0, the value returned is the same, but nothing is written to dst, - * and dst may be NULL. - * Failure: 0. Use GetLastError() to determine the cause. - */ -INT WINAPI FoldStringA(DWORD dwFlags, LPCSTR src, INT srclen, - LPSTR dst, INT dstlen) -{ - INT ret = 0, srclenW = 0; - WCHAR *srcW = NULL, *dstW = NULL; - - if (!src || !srclen || dstlen < 0 || (dstlen && !dst) || src == dst) - { - SetLastError(ERROR_INVALID_PARAMETER); - return 0; - } - - srclenW = MultiByteToWideChar(CP_ACP, dwFlags & MAP_COMPOSITE ? MB_COMPOSITE : 0, - src, srclen, NULL, 0); - srcW = HeapAlloc(GetProcessHeap(), 0, srclenW * sizeof(WCHAR)); - - if (!srcW) - { - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - goto FoldStringA_exit; - } - - MultiByteToWideChar(CP_ACP, dwFlags & MAP_COMPOSITE ? MB_COMPOSITE : 0, - src, srclen, srcW, srclenW); - - dwFlags = (dwFlags & ~MAP_PRECOMPOSED) | MAP_FOLDCZONE; - - ret = FoldStringW(dwFlags, srcW, srclenW, NULL, 0); - if (ret && dstlen) - { - dstW = HeapAlloc(GetProcessHeap(), 0, ret * sizeof(WCHAR)); - - if (!dstW) - { - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - goto FoldStringA_exit; - } - - ret = FoldStringW(dwFlags, srcW, srclenW, dstW, ret); - if (!WideCharToMultiByte(CP_ACP, 0, dstW, ret, dst, dstlen, NULL, NULL)) - { - ret = 0; - SetLastError(ERROR_INSUFFICIENT_BUFFER); - } - } - - HeapFree(GetProcessHeap(), 0, dstW); - -FoldStringA_exit: - HeapFree(GetProcessHeap(), 0, srcW); - return ret; -} - -/************************************************************************* - * FoldStringW (KERNEL32.@) - * - * See FoldStringA. - */ -INT WINAPI FoldStringW(DWORD dwFlags, LPCWSTR src, INT srclen, - LPWSTR dst, INT dstlen) -{ - int ret; - - switch (dwFlags & (MAP_COMPOSITE|MAP_PRECOMPOSED|MAP_EXPAND_LIGATURES)) - { - case 0: - if (dwFlags) - break; - /* Fall through for dwFlags == 0 */ - case MAP_PRECOMPOSED|MAP_COMPOSITE: - case MAP_PRECOMPOSED|MAP_EXPAND_LIGATURES: - case MAP_COMPOSITE|MAP_EXPAND_LIGATURES: - SetLastError(ERROR_INVALID_FLAGS); - return 0; - } - - if (!src || !srclen || dstlen < 0 || (dstlen && !dst) || src == dst) - { - SetLastError(ERROR_INVALID_PARAMETER); - return 0; - } - - ret = wine_fold_string(dwFlags, src, srclen, dst, dstlen); - if (!ret) - SetLastError(ERROR_INSUFFICIENT_BUFFER); - return ret; -} - - -/* - * @implemented (Synced to Wine-22112008) - */ -int -WINAPI -CompareStringA ( - LCID Locale, - DWORD dwCmpFlags, - LPCSTR lpString1, - int cchCount1, - LPCSTR lpString2, - int cchCount2 - ) -{ - WCHAR *buf1W = NtCurrentTeb()->StaticUnicodeBuffer; - WCHAR *buf2W = buf1W + 130; - LPWSTR str1W, str2W; - INT len1W, len2W, ret; - UINT locale_cp = CP_ACP; - - if (!lpString1 || !lpString2) - { - SetLastError(ERROR_INVALID_PARAMETER); - return 0; - } - if (cchCount1 < 0) cchCount1 = strlen(lpString1); - if (cchCount2 < 0) cchCount2 = strlen(lpString2); - - if (!(dwCmpFlags & LOCALE_USE_CP_ACP)) locale_cp = get_lcid_codepage(Locale); - - len1W = MultiByteToWideChar(locale_cp, 0, lpString1, cchCount1, buf1W, 130); - if (len1W) - str1W = buf1W; - else - { - len1W = MultiByteToWideChar(locale_cp, 0, lpString1, cchCount1, NULL, 0); - str1W = HeapAlloc(GetProcessHeap(), 0, len1W * sizeof(WCHAR)); - if (!str1W) - { - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - return 0; - } - MultiByteToWideChar(locale_cp, 0, lpString1, cchCount1, str1W, len1W); - } - len2W = MultiByteToWideChar(locale_cp, 0, lpString2, cchCount2, buf2W, 130); - if (len2W) - str2W = buf2W; - else - { - len2W = MultiByteToWideChar(locale_cp, 0, lpString2, cchCount2, NULL, 0); - str2W = HeapAlloc(GetProcessHeap(), 0, len2W * sizeof(WCHAR)); - if (!str2W) - { - if (str1W != buf1W) HeapFree(GetProcessHeap(), 0, str1W); - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - return 0; - } - MultiByteToWideChar(locale_cp, 0, lpString2, cchCount2, str2W, len2W); - } - - ret = CompareStringW(Locale, dwCmpFlags, str1W, len1W, str2W, len2W); - - if (str1W != buf1W) HeapFree(GetProcessHeap(), 0, str1W); - if (str2W != buf2W) HeapFree(GetProcessHeap(), 0, str2W); - return ret; -} - -/* - * @implemented (Synced to Wine-22/11/2008) - */ -int -WINAPI -CompareStringW ( - LCID Locale, - DWORD dwCmpFlags, - LPCWSTR lpString1, - int cchCount1, - LPCWSTR lpString2, - int cchCount2 - ) -{ - INT Result; - - if (!lpString1 || !lpString2) - { - SetLastError(ERROR_INVALID_PARAMETER); - return 0; - } - - if (dwCmpFlags & ~(NORM_IGNORECASE | NORM_IGNORENONSPACE | - NORM_IGNORESYMBOLS | SORT_STRINGSORT | NORM_IGNOREKANATYPE | - NORM_IGNOREWIDTH | LOCALE_USE_CP_ACP | 0x10000000)) - { - SetLastError(ERROR_INVALID_FLAGS); - return 0; - } - - /* this style is related to diacritics in Arabic, Japanese, and Hebrew */ - if (dwCmpFlags & 0x10000000) - DPRINT1("Ignoring unknown style 0x10000000\n"); - - if (cchCount1 < 0) cchCount1 = wcslen(lpString1); - if (cchCount2 < 0) cchCount2 = wcslen(lpString2); - - Result = wine_compare_string(dwCmpFlags, lpString1, cchCount1, lpString2, cchCount2); - - if (Result) /* need to translate result */ - return (Result < 0) ? CSTR_LESS_THAN : CSTR_GREATER_THAN; - - return CSTR_EQUAL; -} - - - - -/* - * @implemented - * - * Get information about an aspect of a locale. - * - * PARAMS - * lcid [I] LCID of the locale - * lctype [I] LCTYPE_ flags from "winnls.h" - * buffer [O] Destination for the information - * len [I] Length of buffer in characters - * - * RETURNS - * Success: The size of the data requested. If buffer is non-NULL, it is filled - * with the information. - * Failure: 0. Use GetLastError() to determine the cause. - * - * NOTES - * - LOCALE_NEUTRAL is equal to LOCALE_SYSTEM_DEFAULT - * - The string returned is NUL terminated, except for LOCALE_FONTSIGNATURE, - * which is a bit string. - */ -INT WINAPI GetLocaleInfoA( LCID lcid, LCTYPE lctype, LPSTR buffer, INT len ) -{ - WCHAR *bufferW; - INT lenW, ret; - - if (len < 0 || (len && !buffer)) - { - SetLastError( ERROR_INVALID_PARAMETER ); - return 0; - } - if (lctype & LOCALE_RETURN_GENITIVE_NAMES ) - { - SetLastError( ERROR_INVALID_FLAGS ); - return 0; - } - - if (!len) buffer = NULL; - - if (!(lenW = GetLocaleInfoW( lcid, lctype, NULL, 0 ))) return 0; - - if (!(bufferW = HeapAlloc( GetProcessHeap(), 0, lenW * sizeof(WCHAR) ))) - { - SetLastError( ERROR_NOT_ENOUGH_MEMORY ); - return 0; - } - if ((ret = GetLocaleInfoW( lcid, lctype, bufferW, lenW ))) - { - if ((lctype & LOCALE_RETURN_NUMBER) || - ((lctype & ~LOCALE_LOCALEINFOFLAGSMASK) == LOCALE_FONTSIGNATURE)) - { - /* it's not an ASCII string, just bytes */ - ret *= sizeof(WCHAR); - if (buffer) - { - if (ret <= len) memcpy( buffer, bufferW, ret ); - else - { - SetLastError( ERROR_INSUFFICIENT_BUFFER ); - ret = 0; - } - } - } - else - { - UINT codepage = CP_ACP; - if (!(lctype & LOCALE_USE_CP_ACP)) codepage = get_lcid_codepage( lcid ); - ret = WideCharToMultiByte( codepage, 0, bufferW, ret, buffer, len, NULL, NULL ); - } - } - HeapFree( GetProcessHeap(), 0, bufferW ); - return ret; -} - - -/* - * @implemented - */ -LANGID WINAPI -GetSystemDefaultLangID(VOID) -{ - return LANGIDFROMLCID(GetSystemDefaultLCID()); -} - - -/* - * @implemented - */ -LCID WINAPI -GetSystemDefaultLCID(VOID) -{ - LCID lcid; - - NtQueryDefaultLocale(FALSE, &lcid); - - return lcid; -} - - -/* - * @implemented - */ -LANGID WINAPI -GetSystemDefaultUILanguage(VOID) -{ - LANGID LanguageId; - NTSTATUS Status; - - Status = NtQueryInstallUILanguage(&LanguageId); - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return 0; - } - - return LanguageId; -} - - -/* - * @implemented - */ -LCID WINAPI -GetThreadLocale(VOID) -{ - return NtCurrentTeb()->CurrentLocale; -} - - -/* - * @implemented - */ -LANGID WINAPI -GetUserDefaultLangID(VOID) -{ - return LANGIDFROMLCID(GetUserDefaultLCID()); -} - - -/* - * @implemented - */ -LCID WINAPI -GetUserDefaultLCID(VOID) -{ - LCID lcid; - NTSTATUS Status; - - Status = NtQueryDefaultLocale(TRUE, &lcid); - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return 0; - } - - return lcid; -} - - -/* - * @implemented - */ -LANGID WINAPI -GetUserDefaultUILanguage(VOID) -{ - LANGID LangId; - NTSTATUS Status; - - Status = NtQueryDefaultUILanguage(&LangId); - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return 0; - } - - return LangId; -} - - -/* - * @unimplemented - */ -GEOID -WINAPI -GetUserGeoID( - GEOCLASS GeoClass) -{ - GEOID ret = GEOID_NOT_AVAILABLE; - static const WCHAR geoW[] = {'G','e','o',0}; - static const WCHAR nationW[] = {'N','a','t','i','o','n',0}; - WCHAR bufferW[40], *end; - DWORD count; - HANDLE hkey, hSubkey = 0; - UNICODE_STRING keyW; - const KEY_VALUE_PARTIAL_INFORMATION *info = (KEY_VALUE_PARTIAL_INFORMATION *)bufferW; - RtlInitUnicodeString( &keyW, nationW ); - count = sizeof(bufferW); - - if(!(hkey = create_registry_key())) return ret; - - switch( GeoClass ){ - case GEOCLASS_NATION: - if ((hSubkey = NLS_RegOpenKey(hkey, geoW))) - { - if((NtQueryValueKey(hSubkey, &keyW, KeyValuePartialInformation, - (LPBYTE)bufferW, count, &count) == STATUS_SUCCESS ) && info->DataLength) - ret = wcstol((LPCWSTR)info->Data, &end, 10); - } - break; - case GEOCLASS_REGION: - DPRINT("GEOCLASS_REGION not handled yet\n"); - break; - } - - NtClose(hkey); - if (hSubkey) NtClose(hSubkey); - return ret; -} - - -/****************************************************************************** - * IsValidLanguageGroup - * - * Determine if a language group is supported and/or installed. - * - * PARAMS - * LanguageGroup [I] Language Group Id (LGRPID_ values from "winnls.h") - * dwFlags [I] LGRPID_SUPPORTED=Supported, LGRPID_INSTALLED=Installed - * - * RETURNS - * TRUE, if lgrpid is supported and/or installed, according to dwFlags. - * FALSE otherwise. - * - * @implemented - */ -BOOL -WINAPI -IsValidLanguageGroup( - LGRPID LanguageGroup, - DWORD dwFlags) -{ - static const WCHAR szFormat[] = { '%','x','\0' }; - WCHAR szValueName[16], szValue[2]; - BOOL bSupported = FALSE, bInstalled = FALSE; - HANDLE hKey; - - - switch (dwFlags) - { - case LGRPID_INSTALLED: - case LGRPID_SUPPORTED: - - hKey = NLS_RegOpenKey( 0, szLangGroupsKeyName ); - if (!hKey) - break; - - swprintf( szValueName, szFormat, LanguageGroup ); - - if (NLS_RegGetDword( hKey, szValueName, (LPDWORD)szValue )) - { - bSupported = TRUE; - - if (szValue[0] == '1') - bInstalled = TRUE; - } - - NtClose( hKey ); - - break; - - default: - DPRINT("Invalid flags: %lx\n", dwFlags); - return FALSE; - } - - if ((dwFlags == LGRPID_SUPPORTED && bSupported) || - (dwFlags == LGRPID_INSTALLED && bInstalled)) - return TRUE; - - return FALSE; -} - - -/****************************************************************************** - * IsValidLocale - * - * Determine if a locale is valid. - * - * PARAMS - * Locale [I] LCID of the locale to check - * dwFlags [I] LCID_SUPPORTED = Valid - * LCID_INSTALLED = Valid and installed on the system - * - * RETURN - * TRUE, if Locale is valid, - * FALSE, otherwise. - * - * @implemented - */ -BOOL WINAPI -IsValidLocale(LCID Locale, - DWORD dwFlags) -{ - OBJECT_ATTRIBUTES ObjectAttributes; - PKEY_VALUE_PARTIAL_INFORMATION KeyInfo; - WCHAR ValueNameBuffer[9]; - UNICODE_STRING KeyName; - UNICODE_STRING ValueName; - ULONG KeyInfoSize; - ULONG ReturnedSize; - HANDLE KeyHandle; - PWSTR ValueData; - NTSTATUS Status; - BOOL Installed = FALSE; - - DPRINT("IsValidLocale() called\n"); - - if ((dwFlags & ~(LCID_SUPPORTED | LCID_INSTALLED)) || - (dwFlags == (LCID_SUPPORTED | LCID_INSTALLED))) - { - DPRINT("Invalid flags: %lx\n", dwFlags); - return FALSE; - } - - if (Locale & 0xFFFF0000) - { - RtlInitUnicodeString(&KeyName, - L"\\REGISTRY\\Machine\\SYSTEM\\CurrentControlSet\\Control\\Nls\\Locale\\Alternate Sorts"); - } - else - { - RtlInitUnicodeString(&KeyName, - L"\\REGISTRY\\Machine\\SYSTEM\\CurrentControlSet\\Control\\Nls\\Locale"); - } - - InitializeObjectAttributes(&ObjectAttributes, - &KeyName, - OBJ_CASE_INSENSITIVE, - NULL, - NULL); - - Status = NtOpenKey(&KeyHandle, - KEY_QUERY_VALUE, - &ObjectAttributes); - if (!NT_SUCCESS(Status)) - { - DPRINT("NtOpenKey() failed (Status %lx)\n", Status); - SetLastError(ERROR_BADDB); - return FALSE; - } - - swprintf(ValueNameBuffer, L"%08lx", (ULONG)Locale); - RtlInitUnicodeString(&ValueName, ValueNameBuffer); - - KeyInfoSize = sizeof(KEY_VALUE_PARTIAL_INFORMATION) + 4 * sizeof(WCHAR); - KeyInfo = RtlAllocateHeap(RtlGetProcessHeap(), - HEAP_ZERO_MEMORY, - KeyInfoSize); - if (KeyInfo == NULL) - { - DPRINT("RtlAllocateHeap() failed (Status %lx)\n", Status); - NtClose(KeyHandle); - return FALSE; - } - - Status = NtQueryValueKey(KeyHandle, - &ValueName, - KeyValuePartialInformation, - KeyInfo, - KeyInfoSize, - &ReturnedSize); - NtClose(KeyHandle); - - if (!NT_SUCCESS(Status)) - { - DPRINT("NtQueryValueKey() failed (Status %lx)\n", Status); - RtlFreeHeap(RtlGetProcessHeap(), 0, KeyInfo); - return FALSE; - } - - if (dwFlags & LCID_SUPPORTED) - { - DPRINT("Locale is supported\n"); - RtlFreeHeap(RtlGetProcessHeap(), 0, KeyInfo); - return TRUE; - } - - ValueData = (PWSTR)&KeyInfo->Data[0]; - if ((KeyInfo->Type == REG_SZ) && - (KeyInfo->DataLength == 2 * sizeof(WCHAR))) - { - /* Find out if there is support for the language group - * installed, to which this language belongs */ - KeyHandle = NLS_RegOpenKey(0, szLangGroupsKeyName); - if (KeyHandle) - { - WCHAR Value[2]; - if (NLS_RegGetDword(KeyHandle, ValueData, (LPDWORD) Value) && - Value[0] == L'1') - { - Installed = TRUE; - DPRINT("Locale is supported and installed\n"); - } - - NtClose(KeyHandle); - } - } - - RtlFreeHeap(RtlGetProcessHeap(), 0, KeyInfo); - - DPRINT("IsValidLocale() called\n"); - - return Installed; -} - -/* - * @implemented - */ -int -WINAPI -LCMapStringA ( - LCID Locale, - DWORD dwMapFlags, - LPCSTR lpSrcStr, - int cchSrc, - LPSTR lpDestStr, - int cchDest - ) -{ - WCHAR *bufW = NtCurrentTeb()->StaticUnicodeBuffer; - LPWSTR srcW, dstW; - INT ret = 0, srclenW, dstlenW; - UINT locale_cp = CP_ACP; - - if (!lpSrcStr || !cchSrc || cchDest < 0) - { - SetLastError(ERROR_INVALID_PARAMETER); - return 0; - } - - if (!(dwMapFlags & LOCALE_USE_CP_ACP)) locale_cp = get_lcid_codepage(Locale); - - srclenW = MultiByteToWideChar(locale_cp, 0, lpSrcStr, cchSrc, bufW, 260); - if (srclenW) - srcW = bufW; - else - { - srclenW = MultiByteToWideChar(locale_cp, 0, lpSrcStr, cchSrc, NULL, 0); - srcW = HeapAlloc(GetProcessHeap(), 0, srclenW * sizeof(WCHAR)); - if (!srcW) - { - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - return 0; - } - MultiByteToWideChar(locale_cp, 0, lpSrcStr, cchSrc, srcW, srclenW); - } - - if (dwMapFlags & LCMAP_SORTKEY) - { - if (lpSrcStr == lpDestStr) - { - SetLastError(ERROR_INVALID_FLAGS); - goto map_string_exit; - } - ret = wine_get_sortkey(dwMapFlags, srcW, srclenW, lpDestStr, cchDest); - if (ret == 0) - SetLastError(ERROR_INSUFFICIENT_BUFFER); - else - ret++; - goto map_string_exit; - } - - if (dwMapFlags & SORT_STRINGSORT) - { - SetLastError(ERROR_INVALID_FLAGS); - goto map_string_exit; - } - - dstlenW = LCMapStringW(Locale, dwMapFlags, srcW, srclenW, NULL, 0); - if (!dstlenW) - goto map_string_exit; - - dstW = HeapAlloc(GetProcessHeap(), 0, dstlenW * sizeof(WCHAR)); - if (!dstW) - { - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - goto map_string_exit; - } - - LCMapStringW(Locale, dwMapFlags, srcW, srclenW, dstW, dstlenW); - ret = WideCharToMultiByte(locale_cp, 0, dstW, dstlenW, lpDestStr, cchDest, NULL, NULL); - HeapFree(GetProcessHeap(), 0, dstW); - -map_string_exit: - if (srcW != bufW) HeapFree(GetProcessHeap(), 0, srcW); - return ret; -} - - -/* - * @implemented - */ -int -WINAPI -LCMapStringW ( - LCID Locale, - DWORD dwMapFlags, - LPCWSTR lpSrcStr, - int cchSrc, - LPWSTR lpDestStr, - int cchDest - ) -{ - LPWSTR dst_ptr; - - if (!lpSrcStr || !cchSrc || cchDest < 0) - { - SetLastError(ERROR_INVALID_PARAMETER); - return 0; - } - - /* mutually exclusive flags */ - if ((dwMapFlags & (LCMAP_LOWERCASE | LCMAP_UPPERCASE)) == (LCMAP_LOWERCASE | LCMAP_UPPERCASE) || - (dwMapFlags & (LCMAP_HIRAGANA | LCMAP_KATAKANA)) == (LCMAP_HIRAGANA | LCMAP_KATAKANA) || - (dwMapFlags & (LCMAP_HALFWIDTH | LCMAP_FULLWIDTH)) == (LCMAP_HALFWIDTH | LCMAP_FULLWIDTH) || - (dwMapFlags & (LCMAP_TRADITIONAL_CHINESE | LCMAP_SIMPLIFIED_CHINESE)) == (LCMAP_TRADITIONAL_CHINESE | LCMAP_SIMPLIFIED_CHINESE)) - { - SetLastError(ERROR_INVALID_FLAGS); - return 0; - } - - if (!cchDest) lpDestStr = NULL; - - Locale = ConvertDefaultLocale(Locale); - - if (dwMapFlags & LCMAP_SORTKEY) - { - INT ret; - if (lpSrcStr == lpDestStr) - { - SetLastError(ERROR_INVALID_FLAGS); - return 0; - } - - if (cchSrc < 0) cchSrc = wcslen(lpSrcStr); - - ret = wine_get_sortkey(dwMapFlags, lpSrcStr, cchSrc, (char *)lpDestStr, cchDest); - if (ret == 0) - SetLastError(ERROR_INSUFFICIENT_BUFFER); - return ret; - } - - /* SORT_STRINGSORT must be used exclusively with LCMAP_SORTKEY */ - if (dwMapFlags & SORT_STRINGSORT) - { - SetLastError(ERROR_INVALID_FLAGS); - return 0; - } - - if (cchSrc < 0) cchSrc = wcslen(lpSrcStr) + 1; - - if (!lpDestStr) /* return required string length */ - { - INT len; - - for (len = 0; cchSrc; lpSrcStr++, cchSrc--) - { - WCHAR wch = *lpSrcStr; - /* tests show that win2k just ignores NORM_IGNORENONSPACE, - * and skips white space and punctuation characters for - * NORM_IGNORESYMBOLS. - */ - if ((dwMapFlags & NORM_IGNORESYMBOLS) && (iswctype(wch, _SPACE | _PUNCT))) - continue; - len++; - } - return len; - } - - if (dwMapFlags & LCMAP_UPPERCASE) - { - for (dst_ptr = lpDestStr; cchSrc && cchDest; lpSrcStr++, cchSrc--) - { - WCHAR wch = *lpSrcStr; - if ((dwMapFlags & NORM_IGNORESYMBOLS) && (iswctype(wch, _SPACE | _PUNCT))) - continue; - *dst_ptr++ = towupper(wch); - cchDest--; - } - } - else if (dwMapFlags & LCMAP_LOWERCASE) - { - for (dst_ptr = lpDestStr; cchSrc && cchDest; lpSrcStr++, cchSrc--) - { - WCHAR wch = *lpSrcStr; - if ((dwMapFlags & NORM_IGNORESYMBOLS) && (iswctype(wch, _SPACE | _PUNCT))) - continue; - *dst_ptr++ = towlower(wch); - cchDest--; - } - } - else - { - if (lpSrcStr == lpDestStr) - { - SetLastError(ERROR_INVALID_FLAGS); - return 0; - } - for (dst_ptr = lpDestStr; cchSrc && cchDest; lpSrcStr++, cchSrc--) - { - WCHAR wch = *lpSrcStr; - if ((dwMapFlags & NORM_IGNORESYMBOLS) && (iswctype(wch, _SPACE | _PUNCT))) - continue; - *dst_ptr++ = wch; - cchDest--; - } - } - - if (cchSrc) - { - SetLastError(ERROR_INSUFFICIENT_BUFFER); - return 0; - } - - return dst_ptr - lpDestStr; -} - - -/* - * @unimplemented - */ -BOOL -WINAPI -SetCalendarInfoA( - LCID Locale, - CALID Calendar, - CALTYPE CalType, - LPCSTR lpCalData) -{ - if (!Locale || !lpCalData) - { - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } - - switch (CalType) - { - case CAL_NOUSEROVERRIDE: - case CAL_RETURN_NUMBER: - case CAL_USE_CP_ACP: - break; - default: - SetLastError(ERROR_INVALID_FLAGS); - return FALSE; - } - - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -SetCalendarInfoW( - LCID Locale, - CALID Calendar, - CALTYPE CalType, - LPCWSTR lpCalData) -{ - if (!Locale || !lpCalData) - { - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } - - switch (CalType) - { - case CAL_NOUSEROVERRIDE: - case CAL_RETURN_NUMBER: - case CAL_USE_CP_ACP: - break; - default: - SetLastError(ERROR_INVALID_FLAGS); - return FALSE; - } - - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; -} - - -/********************************************************************** - * @implemented - * RIPPED FROM WINE's dlls\kernel\locale.c ver 0.9.29 - * - * SetLocaleInfoA (KERNEL32.@) - * - * Set the current locale info. - * - * PARAMS - * Locale [I] LCID of the locale - * LCType [I] LCTYPE_ flags from "winnls.h" - * lpLCData [I] Information to set - * - * RETURNS - * Success: TRUE. The information given will be returned by GetLocaleInfoA() - * whenever it is called without LOCALE_NOUSEROVERRIDE. - * Failure: FALSE. Use GetLastError() to determine the cause. - */ -BOOL -WINAPI -SetLocaleInfoA ( - LCID Locale, - LCTYPE LCType, - LPCSTR lpLCData - ) -{ - UINT codepage = CP_ACP; - WCHAR *strW; - DWORD len; - BOOL ret; - - if (!(LCType & LOCALE_USE_CP_ACP)) codepage = get_lcid_codepage( Locale ); - - if (!lpLCData) - { - SetLastError( ERROR_INVALID_PARAMETER ); - return FALSE; - } - len = MultiByteToWideChar( codepage, 0, lpLCData, -1, NULL, 0 ); - if (!(strW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) - { - SetLastError( ERROR_NOT_ENOUGH_MEMORY ); - return FALSE; - } - MultiByteToWideChar( codepage, 0, lpLCData, -1, strW, len ); - ret = SetLocaleInfoW( Locale, LCType, strW ); - HeapFree( GetProcessHeap(), 0, strW ); - return ret; -} - - -/********************************************************************** - * @implemented - * RIPPED FROM WINE's dlls\kernel\locale.c ver 0.9.29 - * - * SetLocaleInfoW (KERNEL32.@) - * - * See SetLocaleInfoA. - * - */ -BOOL -WINAPI -SetLocaleInfoW ( - LCID Locale, - LCTYPE LCType, - LPCWSTR lpLCData - ) -{ - const WCHAR *value; - UNICODE_STRING valueW; - NTSTATUS status; - HANDLE hkey; - - LCType &= 0xffff; - value = RosGetLocaleValueName( LCType ); - - if (!lpLCData || !value) - { - SetLastError( ERROR_INVALID_PARAMETER ); - return FALSE; - } - - if (LCType == LOCALE_IDATE || LCType == LOCALE_ILDATE) - { - SetLastError( ERROR_INVALID_FLAGS ); - return FALSE; - } - - if (!(hkey = RosCreateRegistryKey())) return FALSE; - RtlInitUnicodeString( &valueW, value ); - status = NtSetValueKey( hkey, &valueW, 0, REG_SZ, (PVOID)lpLCData, (lstrlenW(lpLCData)+1)*sizeof(WCHAR) ); - - if (LCType == LOCALE_SSHORTDATE || LCType == LOCALE_SLONGDATE) - { - /* Set I-value from S value */ - WCHAR *lpD, *lpM, *lpY; - WCHAR szBuff[2]; - - lpD = wcschr(lpLCData, 'd'); - lpM = wcschr(lpLCData, 'M'); - lpY = wcschr(lpLCData, 'y'); - - if (lpD <= lpM) - { - szBuff[0] = '1'; /* D-M-Y */ - } - else - { - if (lpY <= lpM) - szBuff[0] = '2'; /* Y-M-D */ - else - szBuff[0] = '0'; /* M-D-Y */ - } - - szBuff[1] = '\0'; - - if (LCType == LOCALE_SSHORTDATE) - LCType = LOCALE_IDATE; - else - LCType = LOCALE_ILDATE; - - value = RosGetLocaleValueName( LCType ); - - RtlInitUnicodeString( &valueW, value ); - status = NtSetValueKey( hkey, &valueW, 0, REG_SZ, szBuff, sizeof(szBuff) ); - } - - NtClose( hkey ); - - if (status) SetLastError( RtlNtStatusToDosError(status) ); - return !status; -} - - -/********************************************************************** - * @implemented - * RIPPED FROM WINE's dlls\kernel\locale.c rev 1.42 - * - * SetThreadLocale (KERNEL32.@) - * - * Set the current threads locale. - * - * PARAMS - * lcid [I] LCID of the locale to set - * - * RETURNS - * Success: TRUE. The threads locale is set to lcid. - * Failure: FALSE. Use GetLastError() to determine the cause. - * - */ -BOOL WINAPI SetThreadLocale( LCID lcid ) -{ - DPRINT("SetThreadLocale(0x%04lX)\n", lcid); - - lcid = ConvertDefaultLocale(lcid); - - if (lcid != GetThreadLocale()) - { - if (!IsValidLocale(lcid, LCID_SUPPORTED)) - { - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } - - NtCurrentTeb()->CurrentLocale = lcid; - /* FIXME: NtCurrentTeb()->code_page = get_lcid_codepage( lcid ); - * Wine save the acp for easy/fast access, but ROS has no such Teb member. - * Maybe add this member to ros as well? - */ - - /* - Lag test app for se om locale etc, endres i en app. etter at prosessen er - startet, eller om bare nye prosesser blir berrt. - */ - } - return TRUE; -} - - -/* - * @implemented - */ -BOOL WINAPI -SetUserDefaultLCID(LCID lcid) -{ - NTSTATUS Status; - - Status = NtSetDefaultLocale(TRUE, lcid); - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return 0; - } - return 1; -} - - -/* - * @implemented - */ -BOOL WINAPI -SetUserDefaultUILanguage(LANGID LangId) -{ - NTSTATUS Status; - - Status = NtSetDefaultUILanguage(LangId); - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return 0; - } - return 1; -} - - -/* - * @implemented - */ -BOOL -WINAPI -SetUserGeoID( - GEOID GeoId) -{ - static const WCHAR geoW[] = {'G','e','o',0}; - static const WCHAR nationW[] = {'N','a','t','i','o','n',0}; - static const WCHAR formatW[] = {'%','i',0}; - UNICODE_STRING nameW,keyW; - WCHAR bufferW[10]; - OBJECT_ATTRIBUTES attr; - HANDLE hkey; - - if(!(hkey = create_registry_key())) return FALSE; - - attr.Length = sizeof(attr); - attr.RootDirectory = hkey; - attr.ObjectName = &nameW; - attr.Attributes = 0; - attr.SecurityDescriptor = NULL; - attr.SecurityQualityOfService = NULL; - RtlInitUnicodeString( &nameW, geoW ); - RtlInitUnicodeString( &keyW, nationW ); - - if (NtCreateKey( &hkey, KEY_ALL_ACCESS, &attr, 0, NULL, 0, NULL ) != STATUS_SUCCESS) - - { - NtClose(attr.RootDirectory); - return FALSE; - } - - swprintf(bufferW, formatW, GeoId); - NtSetValueKey(hkey, &keyW, 0, REG_SZ, bufferW, (wcslen(bufferW) + 1) * sizeof(WCHAR)); - NtClose(attr.RootDirectory); - NtClose(hkey); - return TRUE; -} - - -/* - * @implemented - */ -DWORD -WINAPI -VerLanguageNameA ( - DWORD wLang, - LPSTR szLang, - DWORD nSize - ) -{ - return GetLocaleInfoA( MAKELCID(wLang, SORT_DEFAULT), LOCALE_SENGLANGUAGE, szLang, nSize ); -} - - -/* - * @implemented - */ -DWORD -WINAPI -VerLanguageNameW ( - DWORD wLang, - LPWSTR szLang, - DWORD nSize - ) -{ - return GetLocaleInfoW( MAKELCID(wLang, SORT_DEFAULT), LOCALE_SENGLANGUAGE, szLang, nSize ); -} - -/*********************************************************************** - * LCIDToLocaleName (KERNEL32.@) Wine 13.02.2009 - */ -INT WINAPI LCIDToLocaleName( LCID lcid, LPWSTR name, INT count, DWORD flags ) -{ - if (flags) DPRINT1( "unsupported flags %x\n", flags ); - - return GetLocaleInfoW( lcid, LOCALE_SNAME | LOCALE_NOUSEROVERRIDE, name, count ); -} diff --git a/dll/win32/kernel32/misc/perfcnt.c b/dll/win32/kernel32/misc/perfcnt.c deleted file mode 100644 index aef2a8e31f0..00000000000 --- a/dll/win32/kernel32/misc/perfcnt.c +++ /dev/null @@ -1,73 +0,0 @@ -/* $Id$ */ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * FILE: lib/kernel32/misc/perfcnt.c - * PURPOSE: Performance counter - * PROGRAMMER: Eric Kohl - */ - -/* INCLUDES *****************************************************************/ - -#include - -#define NDEBUG -#include - - -/* FUNCTIONS ****************************************************************/ - -/* - * @implemented - */ -BOOL WINAPI -QueryPerformanceCounter(LARGE_INTEGER *lpPerformanceCount) -{ - LARGE_INTEGER Frequency; - NTSTATUS Status; - - Status = NtQueryPerformanceCounter(lpPerformanceCount, - &Frequency); - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return(FALSE); - } - - if (Frequency.QuadPart == 0ULL) - { - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return(FALSE); - } - - return(TRUE); -} - - -/* - * @implemented - */ -BOOL WINAPI -QueryPerformanceFrequency(LARGE_INTEGER *lpFrequency) -{ - LARGE_INTEGER Count; - NTSTATUS Status; - - Status = NtQueryPerformanceCounter(&Count, - lpFrequency); - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return(FALSE); - } - - if (lpFrequency->QuadPart == 0ULL) - { - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return(FALSE); - } - - return(TRUE); -} - -/* EOF */ diff --git a/dll/win32/kernel32/misc/power.c b/dll/win32/kernel32/misc/power.c deleted file mode 100644 index 5543546271d..00000000000 --- a/dll/win32/kernel32/misc/power.c +++ /dev/null @@ -1,285 +0,0 @@ -/* - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * FILE: dll/win32/kernel32/misc/power.c - * PURPOSE: Power Management Functions - * PROGRAMMER: Dmitry Chapyshev - * - * UPDATE HISTORY: - * 01/15/2009 Created - */ - -#include - -#define NDEBUG -#include - - -NTSYSAPI -NTSTATUS -NTAPI -NtGetDevicePowerState( - IN HANDLE Device, - IN PDEVICE_POWER_STATE PowerState -); - -NTSYSAPI -NTSTATUS -NTAPI -NtRequestWakeupLatency( - IN LATENCY_TIME latency -); - -NTSYSAPI -BOOLEAN -NTAPI -NtIsSystemResumeAutomatic(VOID); - -NTSYSAPI -NTSTATUS -NTAPI -NtSetThreadExecutionState( - IN EXECUTION_STATE esFlags, - OUT EXECUTION_STATE *PreviousFlags -); - -NTSYSAPI -NTSTATUS -NTAPI -NtInitiatePowerAction( - IN POWER_ACTION SystemAction, - IN SYSTEM_POWER_STATE MinSystemState, - IN ULONG Flags, - IN BOOLEAN Asynchronous -); - -NTSYSAPI -NTSTATUS -NTAPI -NtRequestDeviceWakeup( - IN HANDLE Device -); - -NTSYSAPI -NTSTATUS -NTAPI -NtCancelDeviceWakeupRequest( - IN HANDLE Device -); - -/* PUBLIC FUNCTIONS ***********************************************************/ - -/* - * @implemented - */ -BOOL -WINAPI -GetSystemPowerStatus(LPSYSTEM_POWER_STATUS PowerStatus) -{ - NTSTATUS Status; - SYSTEM_BATTERY_STATE SysBatState; - - Status = NtPowerInformation(SystemBatteryState, - NULL, - 0, - &SysBatState, - sizeof(SYSTEM_BATTERY_STATE)); - - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return FALSE; - } - - RtlZeroMemory(PowerStatus, sizeof(LPSYSTEM_POWER_STATUS)); - - PowerStatus->BatteryLifeTime = BATTERY_LIFE_UNKNOWN; - PowerStatus->BatteryFullLifeTime = BATTERY_LIFE_UNKNOWN; - - PowerStatus->BatteryLifePercent = BATTERY_PERCENTAGE_UNKNOWN; - if (SysBatState.MaxCapacity) - { - if (SysBatState.MaxCapacity >= SysBatState.RemainingCapacity) - PowerStatus->BatteryLifePercent = (SysBatState.RemainingCapacity / SysBatState.MaxCapacity) * 100; - else - PowerStatus->BatteryLifePercent = 100; /* 100% */ - - if (PowerStatus->BatteryLifePercent <= 32) - PowerStatus->BatteryFlag |= BATTERY_FLAG_LOW; - - if (PowerStatus->BatteryLifePercent >= 67) - PowerStatus->BatteryFlag |= BATTERY_FLAG_HIGH; - } - - if (!SysBatState.BatteryPresent) - PowerStatus->BatteryFlag |= BATTERY_FLAG_NO_BATTERY; - - if (SysBatState.Charging) - PowerStatus->BatteryFlag |= BATTERY_FLAG_CHARGING; - - if (!SysBatState.AcOnLine && SysBatState.BatteryPresent) - PowerStatus->ACLineStatus = AC_LINE_OFFLINE; - else - PowerStatus->ACLineStatus = AC_LINE_ONLINE; - - if (SysBatState.EstimatedTime) - PowerStatus->BatteryLifeTime = SysBatState.EstimatedTime; - - return TRUE; -} - -/* - * @implemented - */ -BOOL WINAPI -SetSystemPowerState(BOOL fSuspend, BOOL fForce) -{ - SYSTEM_POWER_STATE MinSystemState = (!fSuspend ? PowerSystemHibernate : PowerSystemSleeping1); - ULONG Flags = (!fForce ? POWER_ACTION_QUERY_ALLOWED : 0); - NTSTATUS Status; - - Status = NtInitiatePowerAction(PowerActionSleep, - MinSystemState, - Flags, - FALSE); - - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return FALSE; - } - - return TRUE; -} - -/* - * @implemented - */ -BOOL -WINAPI -GetDevicePowerState(HANDLE hDevice, BOOL *pfOn) -{ - DEVICE_POWER_STATE DevicePowerState; - NTSTATUS Status; - - Status = NtGetDevicePowerState(hDevice, &DevicePowerState); - - if (NT_SUCCESS(Status)) - { - if ((DevicePowerState != PowerDeviceUnspecified) && - (DevicePowerState != PowerDeviceD0)) - *pfOn = FALSE; - else - *pfOn = TRUE; - - return TRUE; - } - - SetLastErrorByStatus(Status); - return FALSE; -} - -/* - * @implemented - */ -BOOL -WINAPI -RequestDeviceWakeup(HANDLE hDevice) -{ - NTSTATUS Status; - - Status = NtRequestDeviceWakeup(hDevice); - - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return FALSE; - } - - return TRUE; -} - -/* - * @implemented - */ -BOOL -WINAPI -RequestWakeupLatency(LATENCY_TIME latency) -{ - NTSTATUS Status; - - Status = NtRequestWakeupLatency(latency); - - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return FALSE; - } - - return TRUE; -} - -/* - * @implemented - */ -BOOL -WINAPI -CancelDeviceWakeupRequest(HANDLE hDevice) -{ - NTSTATUS Status; - - Status = NtCancelDeviceWakeupRequest(hDevice); - - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return FALSE; - } - - return TRUE; -} - -/* - * @implemented - */ -BOOL -WINAPI -IsSystemResumeAutomatic(VOID) -{ - return NtIsSystemResumeAutomatic(); -} - -/* - * @unimplemented - */ -BOOL -WINAPI -SetMessageWaitingIndicator(HANDLE hMsgIndicator, - ULONG ulMsgCount) -{ - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - DPRINT1("SetMessageWaitingIndicator is UNIMPLEMENTED!\n"); - return 0; -} - -/* - * @implemented - */ -EXECUTION_STATE -WINAPI -SetThreadExecutionState(EXECUTION_STATE esFlags) -{ - EXECUTION_STATE OldFlags; - NTSTATUS Status; - - Status = NtSetThreadExecutionState(esFlags, &OldFlags); - - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return 0; - } - - return OldFlags; -} diff --git a/dll/win32/kernel32/misc/recovery.c b/dll/win32/kernel32/misc/recovery.c deleted file mode 100644 index 723a0d240d0..00000000000 --- a/dll/win32/kernel32/misc/recovery.c +++ /dev/null @@ -1,101 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * FILE: lib/kernel32/misc/recovery.c - * PURPOSE: Application Recovery functions - * PROGRAMMER: Thomas Weidenmueller - * - * UPDATE HISTORY: - * 10/28/2005 Created stubs (w3) - */ - -#include - -#define NDEBUG -#include - -/* PUBLIC FUNCTIONS ***********************************************************/ - -/* - * @unimplemented - */ -HRESULT -WINAPI -GetApplicationRecoveryCallback(IN HANDLE hProcess, - OUT APPLICATION_RECOVERY_CALLBACK* pRecoveryCallback, - OUT PVOID* ppvParameter, - PDWORD dwPingInterval, - PDWORD dwFlags) -{ - UNIMPLEMENTED; - return E_FAIL; -} - - -/* - * @unimplemented - */ -HRESULT -WINAPI -GetApplicationRestart(IN HANDLE hProcess, - OUT PWSTR pwzCommandline OPTIONAL, - IN OUT PDWORD pcchSize, - OUT PDWORD pdwFlags OPTIONAL) -{ - UNIMPLEMENTED; - return E_FAIL; -} - - -/* - * @unimplemented - */ -VOID -WINAPI -RecoveryFinished(IN BOOL bSuccess) -{ - UNIMPLEMENTED; -} - - -/* - * @unimplemented - */ -HRESULT -WINAPI -RecoveryInProgress(OUT PBOOL pbCancelled) -{ - UNIMPLEMENTED; - return E_FAIL; -} - - -/* - * @unimplemented - */ -HRESULT -WINAPI -RegisterApplicationRecoveryCallback(IN APPLICATION_RECOVERY_CALLBACK pRecoveyCallback, - IN PVOID pvParameter OPTIONAL, - DWORD dwPingInterval, - DWORD dwFlags) -{ - UNIMPLEMENTED; - return E_FAIL; -} - - -/* - * @unimplemented - */ -HRESULT -WINAPI -RegisterApplicationRestart(IN PCWSTR pwzCommandline OPTIONAL, - IN DWORD dwFlags) -{ - UNIMPLEMENTED; - return E_FAIL; -} - -/* EOF */ diff --git a/dll/win32/kernel32/misc/stubs.c b/dll/win32/kernel32/misc/stubs.c deleted file mode 100644 index 030f07c30d6..00000000000 --- a/dll/win32/kernel32/misc/stubs.c +++ /dev/null @@ -1,1381 +0,0 @@ -/* - * KERNEL32.DLL stubs (STUB functions) - * Remove from this file, if you implement them. - */ - -#include - -#define NDEBUG -#include - -#define STUB \ - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); \ - DPRINT1("%s() is UNIMPLEMENTED!\n", __FUNCTION__) - -/* - * @unimplemented - */ -BOOL -WINAPI -BaseAttachCompleteThunk (VOID) -{ - STUB; - return FALSE; -} - -/* - * @unimplemented - */ -VOID WINAPI -BaseDumpAppcompatCache(VOID) -{ - STUB; -} - -/* - * @unimplemented - */ -VOID WINAPI -BaseFlushAppcompatCache(VOID) -{ - STUB; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -BaseCheckAppcompatCache(ULONG Unknown1, - ULONG Unknown2, - ULONG Unknown3, - PULONG Unknown4) -{ - STUB; - if (Unknown4) *Unknown4 = 0; - return TRUE; -} - -/* - * @unimplemented - */ -VOID WINAPI -BaseUpdateAppcompatCache(ULONG Unknown1, ULONG Unknown2, ULONG Unknown3) -{ - STUB; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -CmdBatNotification ( - DWORD Unknown - ) -{ - STUB; - return FALSE; -} - - -/* - * @unimplemented - */ -DWORD -WINAPI -CreateVirtualBuffer ( - DWORD Unknown0, - DWORD Unknown1, - DWORD Unknown2 - ) -{ - STUB; - return 0; -} - - -/* - * @unimplemented - */ -DWORD -WINAPI -ExitVDM ( - DWORD Unknown0, - DWORD Unknown1 - ) -{ - STUB; - return 0; -} - - -/* - * @unimplemented - */ -BOOL -WINAPI -ExtendVirtualBuffer ( - DWORD Unknown0, - DWORD Unknown1 - ) -{ - STUB; - return FALSE; -} - - -/* - * @unimplemented - */ -BOOL -WINAPI -FreeVirtualBuffer ( - HANDLE hVirtualBuffer - ) -{ - STUB; - return FALSE; -} - - -/* - * @unimplemented - */ -DWORD -WINAPI -GetNextVDMCommand ( - DWORD Unknown0 - ) -{ - STUB; - return 0; -} - - -/* - * @unimplemented - */ -DWORD -WINAPI -GetVDMCurrentDirectories ( - DWORD Unknown0, - DWORD Unknown1 - ) -{ - STUB; - return 0; -} - - -/* - * @unimplemented - */ -BOOL -WINAPI -RegisterConsoleVDM ( - DWORD Unknown0, - DWORD Unknown1, - DWORD Unknown2, - DWORD Unknown3, - DWORD Unknown4, - DWORD Unknown5, - DWORD Unknown6, - DWORD Unknown7, - DWORD Unknown8, - DWORD Unknown9, - DWORD Unknown10 - ) -{ - STUB; - return FALSE; -} - - -/* - * @unimplemented - */ -BOOL -WINAPI -RegisterWowBaseHandlers ( - DWORD Unknown0 - ) -{ - STUB; - return FALSE; -} - - -/* - * @unimplemented - */ -BOOL -WINAPI -RegisterWowExec ( - DWORD Unknown0 - ) -{ - STUB; - return FALSE; -} - - -/* - * @unimplemented - */ -BOOL -WINAPI -SetVDMCurrentDirectories ( - DWORD Unknown0, - DWORD Unknown1 - ) -{ - STUB; - return FALSE; -} - - -/* - * @unimplemented - */ -DWORD -WINAPI -TrimVirtualBuffer ( - DWORD Unknown0 - ) -{ - STUB; - return 0; -} - - -/* - * @unimplemented - */ -DWORD -WINAPI -VDMConsoleOperation ( - DWORD Unknown0, - DWORD Unknown1 - ) -{ - STUB; - return 0; -} - - -/* - * @unimplemented - */ -DWORD -WINAPI -VDMOperationStarted ( - DWORD Unknown0 - ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -DWORD -WINAPI -VirtualBufferExceptionHandler ( - DWORD Unknown0, - DWORD Unknown1, - DWORD Unknown2 - ) -{ - STUB; - return 0; -} - -/* - * @implemented - */ -BOOL -WINAPI -BindIoCompletionCallback(HANDLE FileHandle, - LPOVERLAPPED_COMPLETION_ROUTINE Function, - ULONG Flags) -{ - NTSTATUS Status = 0; - - DPRINT("(%p, %p, %d)\n", FileHandle, Function, Flags); - - Status = RtlSetIoCompletionCallback(FileHandle, - (PIO_APC_ROUTINE)Function, - Flags); - - if (!NT_SUCCESS(Status)) - { - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - return TRUE; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -CreateJobSet ( - ULONG NumJob, - PJOB_SET_ARRAY UserJobSet, - ULONG Flags) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -FindVolumeMountPointClose( - HANDLE hFindVolumeMountPoint - ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -GetNumaHighestNodeNumber( - PULONG HighestNodeNumber - ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -GetNumaNodeProcessorMask( - UCHAR Node, - PULONGLONG ProcessorMask - ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -GetNumaProcessorNode( - UCHAR Processor, - PUCHAR NodeNumber - ) -{ - STUB; - return 0; -} - -/* - * @implemented - */ -BOOL -WINAPI -ReadFileScatter(HANDLE hFile, - FILE_SEGMENT_ELEMENT aSegmentArray[], - DWORD nNumberOfBytesToRead, - LPDWORD lpReserved, - LPOVERLAPPED lpOverlapped) -{ - PIO_STATUS_BLOCK pIOStatus; - LARGE_INTEGER Offset; - NTSTATUS Status; - - DPRINT("(%p %p %u %p)\n", hFile, aSegmentArray, nNumberOfBytesToRead, lpOverlapped); - - Offset.LowPart = lpOverlapped->Offset; - Offset.HighPart = lpOverlapped->OffsetHigh; - pIOStatus = (PIO_STATUS_BLOCK) lpOverlapped; - pIOStatus->Status = STATUS_PENDING; - pIOStatus->Information = 0; - - Status = NtReadFileScatter(hFile, - NULL, - NULL, - NULL, - pIOStatus, - aSegmentArray, - nNumberOfBytesToRead, - &Offset, - NULL); - - if (!NT_SUCCESS(Status)) - { - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - return TRUE; -} - -/* - * @unimplemented - */ -VOID -WINAPI -RestoreLastError( - DWORD dwErrCode - ) -{ - STUB; -} - -/* - * @implemented - */ -BOOL -WINAPI -WriteFileGather(HANDLE hFile, - FILE_SEGMENT_ELEMENT aSegmentArray[], - DWORD nNumberOfBytesToWrite, - LPDWORD lpReserved, - LPOVERLAPPED lpOverlapped) -{ - PIO_STATUS_BLOCK IOStatus; - LARGE_INTEGER Offset; - NTSTATUS Status; - - DPRINT("%p %p %u %p\n", hFile, aSegmentArray, nNumberOfBytesToWrite, lpOverlapped); - - Offset.LowPart = lpOverlapped->Offset; - Offset.HighPart = lpOverlapped->OffsetHigh; - IOStatus = (PIO_STATUS_BLOCK) lpOverlapped; - IOStatus->Status = STATUS_PENDING; - IOStatus->Information = 0; - - Status = NtWriteFileGather(hFile, - NULL, - NULL, - NULL, - IOStatus, - aSegmentArray, - nNumberOfBytesToWrite, - &Offset, - NULL); - - if (!NT_SUCCESS(Status)) - { - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - return TRUE; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -DeleteVolumeMountPointW( - LPCWSTR lpszVolumeMountPoint - ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -HANDLE -WINAPI -FindFirstVolumeMountPointW( - LPCWSTR lpszRootPathName, - LPWSTR lpszVolumeMountPoint, - DWORD cchBufferLength - ) -{ - STUB; - return 0; -} - -/* - * @implemented - */ -BOOL -WINAPI -FindNextVolumeW( - HANDLE handle, - LPWSTR volume, - DWORD len - ) -{ - MOUNTMGR_MOUNT_POINTS *data = handle; - - while (data->Size < data->NumberOfMountPoints) - { - static const WCHAR volumeW[] = {'\\','?','?','\\','V','o','l','u','m','e','{',}; - WCHAR *link = (WCHAR *)((char *)data + data->MountPoints[data->Size].SymbolicLinkNameOffset); - DWORD size = data->MountPoints[data->Size].SymbolicLinkNameLength; - data->Size++; - /* skip non-volumes */ - if (size < sizeof(volumeW) || memcmp( link, volumeW, sizeof(volumeW) )) continue; - if (size + sizeof(WCHAR) >= len * sizeof(WCHAR)) - { - SetLastError( ERROR_FILENAME_EXCED_RANGE ); - return FALSE; - } - memcpy( volume, link, size ); - volume[1] = '\\'; /* map \??\ to \\?\ */ - volume[size / sizeof(WCHAR)] = '\\'; /* Windows appends a backslash */ - volume[size / sizeof(WCHAR) + 1] = 0; - DPRINT( "returning entry %u %s\n", data->Size - 1, volume ); - return TRUE; - } - SetLastError( ERROR_NO_MORE_FILES ); - return FALSE; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -FindNextVolumeMountPointW( - HANDLE hFindVolumeMountPoint, - LPWSTR lpszVolumeMountPoint, - DWORD cchBufferLength - ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -DWORD -WINAPI -GetFirmwareEnvironmentVariableW( - LPCWSTR lpName, - LPCWSTR lpGuid, - PVOID pBuffer, - DWORD nSize - ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -GetVolumePathNamesForVolumeNameW( - LPCWSTR lpszVolumeName, - LPWSTR lpszVolumePathNames, - DWORD cchBufferLength, - PDWORD lpcchReturnLength - ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -SetFirmwareEnvironmentVariableW( - LPCWSTR lpName, - LPCWSTR lpGuid, - PVOID pValue, - DWORD nSize - ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -SetVolumeMountPointW( - LPCWSTR lpszVolumeMountPoint, - LPCWSTR lpszVolumeName - ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -DeleteVolumeMountPointA( - LPCSTR lpszVolumeMountPoint - ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -HANDLE -WINAPI -FindFirstVolumeMountPointA( - LPCSTR lpszRootPathName, - LPSTR lpszVolumeMountPoint, - DWORD cchBufferLength - ) -{ - STUB; - return 0; -} - -/* - * @implemented - */ -BOOL -WINAPI -FindNextVolumeA(HANDLE handle, - LPSTR volume, - DWORD len) -{ - WCHAR *buffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, len * sizeof(WCHAR)); - BOOL ret; - - if (!buffer) - { - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - return FALSE; - } - - if ((ret = FindNextVolumeW( handle, buffer, len ))) - { - if (!WideCharToMultiByte( CP_ACP, 0, buffer, -1, volume, len, NULL, NULL )) ret = FALSE; - } - - HeapFree( GetProcessHeap(), 0, buffer ); - return ret; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -FindNextVolumeMountPointA( - HANDLE hFindVolumeMountPoint, - LPSTR lpszVolumeMountPoint, - DWORD cchBufferLength - ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -DWORD -WINAPI -GetFirmwareEnvironmentVariableA( - LPCSTR lpName, - LPCSTR lpGuid, - PVOID pBuffer, - DWORD nSize - ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -GetVolumePathNamesForVolumeNameA( - LPCSTR lpszVolumeName, - LPSTR lpszVolumePathNames, - DWORD cchBufferLength, - PDWORD lpcchReturnLength - ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -SetFirmwareEnvironmentVariableA( - LPCSTR lpName, - LPCSTR lpGuid, - PVOID pValue, - DWORD nSize - ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -SetVolumeMountPointA( - LPCSTR lpszVolumeMountPoint, - LPCSTR lpszVolumeName - ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -BOOL WINAPI GetConsoleKeyboardLayoutNameA(LPSTR name) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -BOOL WINAPI GetConsoleKeyboardLayoutNameW(LPWSTR name) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -DWORD WINAPI GetHandleContext(HANDLE hnd) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -HANDLE WINAPI CreateSocketHandle(VOID) -{ - STUB; - return INVALID_HANDLE_VALUE; -} - -/* - * @unimplemented - */ -BOOL WINAPI SetHandleContext(HANDLE hnd,DWORD context) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -BOOL WINAPI UTRegister( HMODULE hModule, LPSTR lpsz16BITDLL, - LPSTR lpszInitName, LPSTR lpszProcName, - FARPROC *ppfn32Thunk, FARPROC pfnUT32CallBack, - LPVOID lpBuff ) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -VOID WINAPI UTUnRegister( HMODULE hModule ) -{ - STUB; -} - -/* - * @unimplemented - */ -FARPROC WINAPI DelayLoadFailureHook(LPCSTR pszDllName, LPCSTR pszProcName) -{ - STUB; - return NULL; -} - -/* - * @unimplemented - */ -NTSTATUS WINAPI CreateNlsSecurityDescriptor(PSECURITY_DESCRIPTOR SecurityDescriptor,ULONG Size,ULONG AccessMask) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -BOOL WINAPI IsValidUILanguage(LANGID langid) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -VOID WINAPI NlsConvertIntegerToString(ULONG Value,ULONG Base,ULONG strsize, LPWSTR str, ULONG strsize2) -{ - STUB; -} - -/* - * @unimplemented - */ -UINT WINAPI SetCPGlobal(UINT CodePage) -{ - STUB; - return 0; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -SetClientTimeZoneInformation( - CONST TIME_ZONE_INFORMATION *lpTimeZoneInformation) -{ - STUB; - return 0; -} - -ULONG -WINAPI -NlsGetCacheUpdateCount(VOID) -{ - STUB; - return 0; -} - -BOOLEAN -WINAPI -Wow64EnableWow64FsRedirection (BOOLEAN Wow64EnableWow64FsRedirection) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -Wow64DisableWow64FsRedirection (VOID ** pv) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -Wow64RevertWow64FsRedirection (VOID * pv) -{ - STUB; - return FALSE; -} - -UINT -WINAPI -EnumSystemFirmwareTables(IN DWORD FirmwareTableProviderSignature, - OUT PVOID pFirmwareTableBuffer, - IN DWORD BufferSize) -{ - STUB; - return 0; -} - -BOOL -WINAPI -GetSystemFileCacheSize(OUT PSIZE_T lpMinimumFileCacheSize, - OUT PSIZE_T lpMaximumFileCacheSize, - OUT PDWORD lpFlags) -{ - STUB; - return FALSE; -} - -UINT -WINAPI -GetSystemFirmwareTable(IN DWORD FirmwareTableProviderSignature, - IN DWORD FirmwareTableID, - OUT PVOID pFirmwareTableBuffer, - IN DWORD BufferSize) -{ - STUB; - return 0; -} - -BOOL -WINAPI -SetSystemFileCacheSize(IN SIZE_T MinimumFileCacheSize, - IN SIZE_T MaximumFileCacheSize, - IN DWORD Flags) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -SetThreadStackGuarantee(IN OUT PULONG StackSizeInBytes) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -SetProcessWorkingSetSizeEx(IN HANDLE hProcess, - IN SIZE_T dwMinimumWorkingSetSize, - IN SIZE_T dwMaximumWorkingSetSize, - IN DWORD Flags) -{ - STUB; - return FALSE; -} - - -BOOL -WINAPI -GetProcessWorkingSetSizeEx(IN HANDLE hProcess, - OUT PSIZE_T lpMinimumWorkingSetSize, - OUT PSIZE_T lpMaximumWorkingSetSize, - OUT PDWORD Flags) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -GetNumaAvailableMemoryNode(IN UCHAR Node, - OUT PULONGLONG AvailableBytes) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -GetNumaAvailableMemory(PVOID lpInfo, - ULONG Length, - PULONG ReturnLength) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -GetNumaProcessorMap(PVOID lpInfo, - ULONG Length, - PULONG ReturnLength) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -NlsResetProcessLocale(VOID) -{ - STUB; - return TRUE; -} - -DWORD -WINAPI -AddLocalAlternateComputerNameA(LPSTR lpName, PNTSTATUS Status) -{ - STUB; - return 0; -} - -DWORD -WINAPI -AddLocalAlternateComputerNameW(LPWSTR lpName, PNTSTATUS Status) -{ - STUB; - return 0; -} - -NTSTATUS -WINAPI -BaseCleanupAppcompatCache(VOID) -{ - STUB; - return STATUS_NOT_IMPLEMENTED; -} - -NTSTATUS -WINAPI -BaseCleanupAppcompatCacheSupport(PVOID pUnknown) -{ - STUB; - return STATUS_NOT_IMPLEMENTED; -} - -BOOL -WINAPI -BaseInitAppcompatCache(VOID) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -BaseInitAppcompatCacheSupport(VOID) -{ - STUB; - return FALSE; -} - -VOID -WINAPI -CreateProcessInternalWSecure(VOID) -{ - STUB; -} - -DWORD -WINAPI -EnumerateLocalComputerNamesA(PVOID pUnknown, DWORD Size, LPSTR lpBuffer, LPDWORD lpnSize) -{ - STUB; - return ERROR_CALL_NOT_IMPLEMENTED; -} - -DWORD -WINAPI -EnumerateLocalComputerNamesW(PVOID pUnknown, DWORD Size, LPWSTR lpBuffer, LPDWORD lpnSize) -{ - STUB; - return ERROR_CALL_NOT_IMPLEMENTED; -} - -PVOID -WINAPI -GetComPlusPackageInstallStatus(VOID) -{ - STUB; - return NULL; -} - -BOOL -WINAPI -GetConsoleCharType(HANDLE hConsole, COORD Coord, PDWORD Type) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -GetConsoleCursorMode(HANDLE hConsole, PBOOL pUnknown1, PBOOL pUnknown2) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -GetConsoleNlsMode(HANDLE hConsole, LPDWORD lpMode) -{ - STUB; - return FALSE; -} - -VOID -WINAPI -GetDefaultSortkeySize(LPVOID lpUnknown) -{ - STUB; - lpUnknown = NULL; -} - -VOID -WINAPI -GetLinguistLangSize(LPVOID lpUnknown) -{ - STUB; - lpUnknown = NULL; -} - -BOOL -WINAPI -OpenDataFile(HANDLE hFile, DWORD dwUnused) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -PrivMoveFileIdentityW(DWORD Unknown1, DWORD Unknown2, DWORD Unknown3) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -ReadConsoleInputExA(HANDLE hConsole, LPVOID lpBuffer, DWORD dwLen, LPDWORD Unknown1, DWORD Unknown2) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -ReadConsoleInputExW(HANDLE hConsole, LPVOID lpBuffer, DWORD dwLen, LPDWORD Unknown1, DWORD Unknown2) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -RegisterConsoleIME(HWND hWnd, LPDWORD ThreadId) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -RegisterConsoleOS2(BOOL bUnknown) -{ - STUB; - return FALSE; -} - -DWORD -WINAPI -RemoveLocalAlternateComputerNameA(LPSTR lpName, DWORD Unknown) -{ - STUB; - return ERROR_CALL_NOT_IMPLEMENTED; -} - -DWORD -WINAPI -RemoveLocalAlternateComputerNameW(LPWSTR lpName, DWORD Unknown) -{ - STUB; - return ERROR_CALL_NOT_IMPLEMENTED; -} - -BOOL -WINAPI -SetComPlusPackageInstallStatus(LPVOID lpInfo) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -SetConsoleCursorMode(HANDLE hConsole, BOOL Unknown1, BOOL Unknown2) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -SetConsoleLocalEUDC(DWORD Unknown1, DWORD Unknown2, DWORD Unknown3, DWORD Unknown4) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -SetConsoleNlsMode(HANDLE hConsole, DWORD dwMode) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -SetConsoleOS2OemFormat(BOOL bUnknown) -{ - STUB; - return FALSE; -} - -BOOL -WINAPI -UnregisterConsoleIME(VOID) -{ - STUB; - return FALSE; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -BaseCheckRunApp(IN DWORD Unknown1, - IN DWORD Unknown2, - IN DWORD Unknown3, - IN DWORD Unknown4, - IN DWORD Unknown5, - IN DWORD Unknown6, - IN DWORD Unknown7, - IN DWORD Unknown8, - IN DWORD Unknown9, - IN DWORD Unknown10) -{ - STUB; - return FALSE; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -BasepCheckWinSaferRestrictions(IN DWORD Unknown1, - IN DWORD Unknown2, - IN DWORD Unknown3, - IN DWORD Unknown4, - IN DWORD Unknown5, - IN DWORD Unknown6) -{ - STUB; - return FALSE; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -NumaVirtualQueryNode(IN DWORD Unknown1, - IN DWORD Unknown2, - IN DWORD Unknown3, - IN DWORD Unknown4) -{ - STUB; - return FALSE; -} - -/* - * @unimplemented - */ -HANDLE -WINAPI -ReOpenFile(IN HANDLE hOriginalFile, - IN DWORD dwDesiredAccess, - IN DWORD dwShareMode, - IN DWORD dwFlags) -{ - STUB; - return INVALID_HANDLE_VALUE; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -SetLastConsoleEventActive(VOID) -{ - STUB; - return FALSE; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -SetConsoleCommandHistoryMode(IN DWORD dwMode) -{ - STUB; - return FALSE; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -SetLocalPrimaryComputerNameA(IN DWORD Unknown1, - IN DWORD Unknown2) -{ - STUB; - return FALSE; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -SetLocalPrimaryComputerNameW(IN DWORD Unknown1, - IN DWORD Unknown2) -{ - STUB; - return FALSE; -} - -/* - * @unimplemented - */ -VOID -WINAPI -SetTermsrvAppInstallMode(IN BOOL bInstallMode) -{ - STUB; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -TermsrvAppInstallMode(VOID) -{ - STUB; - return FALSE; -} diff --git a/dll/win32/kernel32/misc/sysinfo.c b/dll/win32/kernel32/misc/sysinfo.c deleted file mode 100644 index 612b7eddc15..00000000000 --- a/dll/win32/kernel32/misc/sysinfo.c +++ /dev/null @@ -1,270 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * FILE: dll/win32/kernel32/misc/sysinfo.c - * PURPOSE: SystemInfo functions - * PROGRAMMER: Emanuele Aliberti - * Christoph von Wittich - * Thomas Weidenmueller - * Gunnar Andre Dalsnes - * UPDATE HISTORY: - * 2000-04-26 created - */ - -#include - -#define NDEBUG -#include - - -#define PV_NT351 0x00030033 - -/* - * @implemented - */ -SIZE_T -WINAPI -GetLargePageMinimum(VOID) -{ - return SharedUserData->LargePageMinimum; -} - -/* - * @unimplemented - */ -VOID -WINAPI -GetSystemInfo ( - LPSYSTEM_INFO Si - ) -{ - SYSTEM_BASIC_INFORMATION Sbi; - SYSTEM_PROCESSOR_INFORMATION Spi; - DWORD ProcessVersion; - NTSTATUS Status; - - RtlZeroMemory (Si, sizeof (SYSTEM_INFO)); - Status = NtQuerySystemInformation ( - SystemBasicInformation, /* 0 */ - & Sbi, - sizeof Sbi, /* 44 */ - 0 - ); - if (STATUS_SUCCESS != Status) - { - SetLastErrorByStatus (Status); - return; - } - Status = NtQuerySystemInformation ( - SystemProcessorInformation, /* 1 */ - & Spi, - sizeof Spi, /* 12 */ - 0 - ); - if (STATUS_SUCCESS != Status) - { - SetLastErrorByStatus (Status); - return; - } - /* - * PROCESSOR_ARCHITECTURE_INTEL 0 - * PROCESSOR_ARCHITECTURE_MIPS 1 - * PROCESSOR_ARCHITECTURE_ALPHA 2 - * PROCESSOR_ARCHITECTURE_PPC 3 - * PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF - */ - Si->wProcessorArchitecture = Spi.ProcessorArchitecture; - /* For future use: always zero */ - Si->wReserved = 0; - Si->dwPageSize = Sbi.PageSize; - Si->lpMinimumApplicationAddress = (PVOID)Sbi.MinimumUserModeAddress; - Si->lpMaximumApplicationAddress = (PVOID)Sbi.MaximumUserModeAddress; - Si->dwActiveProcessorMask = Sbi.ActiveProcessorsAffinityMask; - Si->dwNumberOfProcessors = Sbi.NumberOfProcessors; - /* - * Compatibility (no longer relevant): - * PROCESSOR_INTEL_386 386 - * PROCESSOR_INTEL_486 486 - * PROCESSOR_INTEL_PENTIUM 586 - * PROCESSOR_MIPS_R4000 4000 - * PROCESSOR_ALPHA_21064 21064 - */ - switch (Spi.ProcessorArchitecture) - { - case PROCESSOR_ARCHITECTURE_INTEL: - switch (Spi.ProcessorLevel) - { - case 3: - Si->dwProcessorType = PROCESSOR_INTEL_386; - break; - case 4: - Si->dwProcessorType = PROCESSOR_INTEL_486; - break; - case 5: - Si->dwProcessorType = PROCESSOR_INTEL_PENTIUM; - break; - default: - /* FIXME: P2, P3, P4...? */ - Si->dwProcessorType = PROCESSOR_INTEL_PENTIUM; - } - break; - - case PROCESSOR_ARCHITECTURE_MIPS: - Si->dwProcessorType = PROCESSOR_MIPS_R4000; - break; - - case PROCESSOR_ARCHITECTURE_ALPHA: - Si->dwProcessorType = PROCESSOR_ALPHA_21064; - break; - - case PROCESSOR_ARCHITECTURE_IA64: - Si->dwProcessorType = PROCESSOR_INTEL_IA64; - break; - - case PROCESSOR_ARCHITECTURE_PPC: - switch (Spi.ProcessorLevel) - { - case 1: - Si->dwProcessorType = PROCESSOR_PPC_601; - break; - case 3: - Si->dwProcessorType = PROCESSOR_PPC_603; - break; - case 4: - Si->dwProcessorType = PROCESSOR_PPC_604; - break; - case 6: - /* PPC 603+ */ - Si->dwProcessorType = PROCESSOR_PPC_603; - break; - case 9: - /* PPC 604+ */ - Si->dwProcessorType = PROCESSOR_PPC_604; - break; - case 20: - Si->dwProcessorType = PROCESSOR_PPC_620; - break; - default: - Si->dwProcessorType = 0; - } - break; - - } - /* Once hardcoded to 64kb */ - Si->dwAllocationGranularity = Sbi.AllocationGranularity; - /* */ - Si->wProcessorLevel = Spi.ProcessorLevel; - Si->wProcessorRevision = Spi.ProcessorRevision; - /* - * Get the version of Windows on which - * the process expects to run. - */ - ProcessVersion = GetProcessVersion (0); /* current process */ - /* In NT 3.1 and 3.5 these fields were always zero. */ - if (PV_NT351 > ProcessVersion) - { - Si->wProcessorLevel = 0; - Si->wProcessorRevision = 0; - } -} - - -/* - * @implemented - */ -BOOL WINAPI -IsProcessorFeaturePresent(DWORD ProcessorFeature) -{ - if (ProcessorFeature >= PROCESSOR_FEATURE_MAX) - return(FALSE); - - return((BOOL)SharedUserData->ProcessorFeatures[ProcessorFeature]); -} - - -/* - * @implemented - */ -BOOL -WINAPI -GetSystemRegistryQuota(PDWORD pdwQuotaAllowed, - PDWORD pdwQuotaUsed) -{ - SYSTEM_REGISTRY_QUOTA_INFORMATION srqi; - ULONG BytesWritten; - NTSTATUS Status; - - Status = NtQuerySystemInformation(SystemRegistryQuotaInformation, - &srqi, - sizeof(srqi), - &BytesWritten); - if(NT_SUCCESS(Status)) - { - if(pdwQuotaAllowed != NULL) - { - *pdwQuotaAllowed = srqi.RegistryQuotaAllowed; - } - if(pdwQuotaUsed != NULL) - { - *pdwQuotaUsed = srqi.RegistryQuotaUsed; - } - - return TRUE; - } - - SetLastErrorByStatus(Status); - return FALSE; -} - -/* - * @implemented - */ -VOID -WINAPI -GetNativeSystemInfo( - LPSYSTEM_INFO lpSystemInfo - ) -{ - //FIXME: GetNativeSystemInfo should return always the real Hardware Processorarchitecture - // in case a Program is running in 32bit Mode on AMD64 - // GetSystemInfo should return PROCESSOR_ARCHITECTURE_INTEL and - // GetNativeSystemInfo should return PROCESSOR_ARCHITECTURE_AMD64 - GetSystemInfo(lpSystemInfo); -} - -/* - * @implemented - */ -BOOL -WINAPI -GetLogicalProcessorInformation(OUT PSYSTEM_LOGICAL_PROCESSOR_INFORMATION Buffer, - IN OUT PDWORD ReturnLength) -{ - NTSTATUS Status; - - if (!ReturnLength) - { - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } - - Status = NtQuerySystemInformation(SystemLogicalProcessorInformation, - Buffer, - *ReturnLength, - ReturnLength); - - if (!NT_SUCCESS(Status)) - { - /* - * When NtQuerySystemInformation says STATUS_INFO_LENGTH_MISMATCH, - * return ERROR_INSUFFICIENT_BUFFER instead of ERROR_BAD_LENGTH. - */ - SetLastErrorByStatus(Status == STATUS_INFO_LENGTH_MISMATCH - ? STATUS_BUFFER_TOO_SMALL - : Status); - return FALSE; - } - - return TRUE; -} diff --git a/dll/win32/kernel32/misc/timerqueue.c b/dll/win32/kernel32/misc/timerqueue.c deleted file mode 100644 index 5bd76e9c9b2..00000000000 --- a/dll/win32/kernel32/misc/timerqueue.c +++ /dev/null @@ -1,359 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * PURPOSE: Timer Queue functions - * FILE: dll/win32/kernel32/misc/timerqueue.c - * PROGRAMER: Thomas Weidenmueller - */ - -/* INCLUDES ******************************************************************/ - -#include - -#define NDEBUG -#include - - -/* FUNCTIONS *****************************************************************/ - -HANDLE DefaultTimerQueue = NULL; - -/* - * Create the default timer queue for the current process. This function is only - * called if CreateTimerQueueTimer() or SetTimerQueueTimer() is called. - * However, ChangeTimerQueueTimer() fails with ERROR_INVALID_PARAMETER if the - * default timer queue has not been created, because it assumes there has to be - * a timer queue with a timer if it want's to be changed. - */ -static BOOL -IntCreateDefaultTimerQueue(VOID) -{ - NTSTATUS Status; - - /* FIXME - make this thread safe */ - - /* create the timer queue */ - Status = RtlCreateTimerQueue(&DefaultTimerQueue); - if(!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - DPRINT1("Unable to create the default timer queue!\n"); - return FALSE; - } - - return TRUE; -} - -/* - * @implemented - */ -BOOL -WINAPI -CancelTimerQueueTimer(HANDLE TimerQueue, - HANDLE Timer) -{ - /* Since this function is not documented in PSDK and apparently does nothing - but delete the timer, we just do the same as DeleteTimerQueueTimer(), without - passing a completion event. */ - NTSTATUS Status; - - if(TimerQueue == NULL) - { - /* let's use the process' default timer queue. We assume the default timer - queue has been created with a previous call to CreateTimerQueueTimer() or - SetTimerQueueTimer(), otherwise this call wouldn't make much sense. */ - if(!(TimerQueue = DefaultTimerQueue)) - { - SetLastError(ERROR_INVALID_HANDLE); - return FALSE; - } - } - - if(Timer == NULL) - { - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } - - /* delete the timer */ - Status = RtlDeleteTimer(TimerQueue, Timer, NULL); - - if(!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return FALSE; - } - - return TRUE; -} - -/* - * @implemented - */ -BOOL -WINAPI -ChangeTimerQueueTimer(HANDLE TimerQueue, - HANDLE Timer, - ULONG DueTime, - ULONG Period) -{ - NTSTATUS Status; - - if(TimerQueue == NULL) - { - /* let's use the process' default timer queue. We assume the default timer - queue has been created with a previous call to CreateTimerQueueTimer() or - SetTimerQueueTimer(), otherwise this call wouldn't make much sense. */ - if(!(TimerQueue = DefaultTimerQueue)) - { - SetLastError(ERROR_INVALID_HANDLE); - return FALSE; - } - } - - if(Timer == NULL) - { - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } - - /* update the timer */ - Status = RtlUpdateTimer(TimerQueue, Timer, DueTime, Period); - if(!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return FALSE; - } - - return TRUE; -} - -/* - * @implemented - */ -HANDLE -WINAPI -CreateTimerQueue(VOID) -{ - HANDLE Handle; - NTSTATUS Status; - - /* create the timer queue */ - Status = RtlCreateTimerQueue(&Handle); - if(!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return NULL; - } - - return Handle; -} - -/* - * @implemented - */ -BOOL -WINAPI -CreateTimerQueueTimer(PHANDLE phNewTimer, - HANDLE TimerQueue, - WAITORTIMERCALLBACK Callback, - PVOID Parameter, - DWORD DueTime, - DWORD Period, - ULONG Flags) -{ - NTSTATUS Status; - - /* windows seems not to test this parameter at all, so we'll try to clear it here - so we don't crash somewhere inside ntdll */ - *phNewTimer = NULL; - - if(TimerQueue == NULL) - { - /* the default timer queue is requested, try to create it if it hasn't been already */ - if(!(TimerQueue = DefaultTimerQueue)) - { - if(!IntCreateDefaultTimerQueue()) - { - /* IntCreateDefaultTimerQueue() set the last error code already, just fail */ - return FALSE; - } - TimerQueue = DefaultTimerQueue; - } - } - - /* !!! Win doesn't even check if Callback == NULL, so we don't, too! That'll - raise a nice exception later... */ - - /* create the timer */ - Status = RtlCreateTimer(TimerQueue, phNewTimer, Callback, Parameter, DueTime, - Period, Flags); - if(!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return FALSE; - } - - return TRUE; -} - -/* - * @implemented - */ -BOOL -WINAPI -DeleteTimerQueue(HANDLE TimerQueue) -{ - NTSTATUS Status; - - /* We don't allow the user to delete the default timer queue */ - if(TimerQueue == NULL) - { - SetLastError(ERROR_INVALID_HANDLE); - return FALSE; - } - - /* delete the timer queue */ - Status = RtlDeleteTimerQueue(TimerQueue); - return NT_SUCCESS(Status); -} - -/* - * @implemented - */ -BOOL -WINAPI -DeleteTimerQueueEx(HANDLE TimerQueue, - HANDLE CompletionEvent) -{ - NTSTATUS Status; - - /* We don't allow the user to delete the default timer queue */ - if(TimerQueue == NULL) - { - SetLastError(ERROR_INVALID_HANDLE); - return FALSE; - } - - /* delete the queue */ - Status = RtlDeleteTimerQueueEx(TimerQueue, CompletionEvent); - - if((CompletionEvent != INVALID_HANDLE_VALUE && Status == STATUS_PENDING) || - !NT_SUCCESS(Status)) - { - /* In case CompletionEvent == NULL, RtlDeleteTimerQueueEx() returns before - all callback routines returned. We set the last error code to STATUS_PENDING - and return FALSE. In case CompletionEvent == INVALID_HANDLE_VALUE we only - can get here if another error occured. In case CompletionEvent is something - else, we get here and fail, even though it isn't really an error (if Status == STATUS_PENDING). - We also handle all other failures the same way. */ - - SetLastErrorByStatus(Status); - return FALSE; - } - - return TRUE; -} - -/* - * @implemented - */ -BOOL -WINAPI -DeleteTimerQueueTimer(HANDLE TimerQueue, - HANDLE Timer, - HANDLE CompletionEvent) -{ - NTSTATUS Status; - - if(TimerQueue == NULL) - { - /* let's use the process' default timer queue. We assume the default timer - queue has been created with a previous call to CreateTimerQueueTimer() or - SetTimerQueueTimer(), otherwise this call wouldn't make much sense. */ - if(!(TimerQueue = DefaultTimerQueue)) - { - SetLastError(ERROR_INVALID_HANDLE); - return FALSE; - } - } - - if(Timer == NULL) - { - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } - - /* delete the timer */ - Status = RtlDeleteTimer(TimerQueue, Timer, CompletionEvent); - - if((CompletionEvent != INVALID_HANDLE_VALUE && Status == STATUS_PENDING) || - !NT_SUCCESS(Status)) - { - /* In case CompletionEvent == NULL, RtlDeleteTimer() returns before - the callback routine returned. We set the last error code to STATUS_PENDING - and return FALSE. In case CompletionEvent == INVALID_HANDLE_VALUE we only - can get here if another error occured. In case CompletionEvent is something - else, we get here and fail, even though it isn't really an error (if Status == STATUS_PENDING). - We also handle all other failures the same way. */ - - SetLastErrorByStatus(Status); - return FALSE; - } - - return TRUE; -} - -/* - * @implemented - */ -HANDLE -WINAPI -SetTimerQueueTimer(HANDLE TimerQueue, - WAITORTIMERCALLBACK Callback, - PVOID Parameter, - DWORD DueTime, - DWORD Period, - BOOL PreferIo) -{ - /* Since this function is not documented in PSDK and apparently does nothing - but create a timer, we just do the same as CreateTimerQueueTimer(). Unfortunately - I don't really know what PreferIo is supposed to be, it propably just affects the - Flags parameter of CreateTimerQueueTimer(). Looking at the PSDK documentation of - CreateTimerQueueTimer() there's only one flag (WT_EXECUTEINIOTHREAD) that causes - the callback function queued to an I/O worker thread. I guess it uses this flag - if PreferIo == TRUE, otherwise let's just use WT_EXECUTEDEFAULT. We should - test this though, this is only guess work and I'm too lazy to do further - investigation. */ - - HANDLE Timer; - NTSTATUS Status; - - if(TimerQueue == NULL) - { - /* the default timer queue is requested, try to create it if it hasn't been already */ - if(!(TimerQueue = DefaultTimerQueue)) - { - if(!IntCreateDefaultTimerQueue()) - { - /* IntCreateDefaultTimerQueue() set the last error code already, just fail */ - return FALSE; - } - TimerQueue = DefaultTimerQueue; - } - } - - /* create the timer */ - Status = RtlCreateTimer(TimerQueue, &Timer, Callback, Parameter, DueTime, - Period, (PreferIo ? WT_EXECUTEINIOTHREAD : WT_EXECUTEDEFAULT)); - if(!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return NULL; - } - - return Timer; -} - -/* EOF */ diff --git a/dll/win32/kernel32/misc/version.c b/dll/win32/kernel32/misc/version.c deleted file mode 100644 index 86eb50d5052..00000000000 --- a/dll/win32/kernel32/misc/version.c +++ /dev/null @@ -1,303 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * FILE: dll/win32/kernel32/misc/version.c - * PURPOSE: Version functions - * PROGRAMMER: Ariadne (ariadne@xs4all.nl) - Ged Murphy (gedmurphy@reactos.org) - */ - -#include -#include -#define NDEBUG -#include -DEBUG_CHANNEL(kernel32ver); - -#define UNICODIZE1(x) L##x -#define UNICODIZE(x) UNICODIZE1(x) - -static UNICODE_STRING KeyName = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\ReactOS\\Settings\\Version"); -static UNICODE_STRING ValName = RTL_CONSTANT_STRING(L"ReportAsWorkstation"); - -/* FUNCTIONS ******************************************************************/ - - -static VOID -SetRosSpecificInfo(LPOSVERSIONINFOW lpVersionInformation) -{ - PKEY_VALUE_PARTIAL_INFORMATION kvpInfo = NULL; - OBJECT_ATTRIBUTES ObjectAttributes; - DWORD ReportAsWorkstation = 0; - HANDLE hKey; - DWORD dwSize; - INT ln, maxlen; - NTSTATUS Status; - - TRACE("Setting Ros Specific version info\n"); - - if (!lpVersionInformation) - return; - - /* Only the EX version has a product type */ - if (lpVersionInformation->dwOSVersionInfoSize == sizeof(OSVERSIONINFOEXW)) - { - /* Allocate memory for our reg query */ - dwSize = sizeof(KEY_VALUE_PARTIAL_INFORMATION) + sizeof(DWORD); - kvpInfo = (PKEY_VALUE_PARTIAL_INFORMATION)HeapAlloc(GetProcessHeap(), 0, dwSize); - if (!kvpInfo) - return; - - InitializeObjectAttributes(&ObjectAttributes, - &KeyName, - OBJ_OPENIF | OBJ_CASE_INSENSITIVE, - NULL, - NULL); - - /* Don't change anything if the key doesn't exist */ - Status = NtOpenKey(&hKey, - KEY_READ, - &ObjectAttributes); - if (NT_SUCCESS(Status)) - { - /* Get the value from the registry */ - Status = NtQueryValueKey(hKey, - &ValName, - KeyValuePartialInformation, - kvpInfo, - dwSize, - &dwSize); - if (NT_SUCCESS(Status)) - { - /* It should be a DWORD */ - if (kvpInfo->Type == REG_DWORD) - { - /* Copy the value for ease of use */ - RtlMoveMemory(&ReportAsWorkstation, - kvpInfo->Data, - kvpInfo->DataLength); - - /* Is the value set? */ - if (((LPOSVERSIONINFOEXW)lpVersionInformation)->wProductType == VER_NT_SERVER && - ReportAsWorkstation) - { - /* It is, modify the product type to report a workstation */ - ((LPOSVERSIONINFOEXW)lpVersionInformation)->wProductType = VER_NT_WORKSTATION; - TRACE("We modified the reported OS from NtProductServer to NtProductWinNt\n"); - } - } - } - - NtClose(hKey); - } - - HeapFree(GetProcessHeap(), 0, kvpInfo); - } - - - /* Append a reactos specific string to the szCSDVersion string ... very hackish ... */ - /* FIXME: Does anything even use this??? I think not.... - Ged */ - ln = wcslen(lpVersionInformation->szCSDVersion) + 1; - maxlen = (sizeof(lpVersionInformation->szCSDVersion) / sizeof(lpVersionInformation->szCSDVersion[0]) - 1); - if(maxlen > ln) - { - PWCHAR szVer = lpVersionInformation->szCSDVersion + ln; - RtlZeroMemory(szVer, (maxlen - ln + 1) * sizeof(WCHAR)); - wcsncpy(szVer, - L"ReactOS " UNICODIZE(KERNEL_VERSION_STR) L" (Build " UNICODIZE(KERNEL_VERSION_BUILD_STR) L")", - maxlen - ln); - } -} - - -/* - * @implemented - */ -DWORD -WINAPI -GetVersion(VOID) -{ - PPEB pPeb = NtCurrentPeb(); - DWORD nVersion; - - nVersion = MAKEWORD(pPeb->OSMajorVersion, pPeb->OSMinorVersion); - - /* behave consistently when posing as another operating system build number */ - if(pPeb->OSPlatformId != VER_PLATFORM_WIN32_WINDOWS) - nVersion |= ((DWORD)(pPeb->OSBuildNumber)) << 16; - - /* non-NT platform flag */ - if(pPeb->OSPlatformId != VER_PLATFORM_WIN32_NT) - nVersion |= 0x80000000; - - return nVersion; -} - -/* - * @implemented - */ -BOOL -WINAPI -GetVersionExW(LPOSVERSIONINFOW lpVersionInformation) -{ - NTSTATUS Status; - - if(lpVersionInformation->dwOSVersionInfoSize != sizeof(OSVERSIONINFOW) && - lpVersionInformation->dwOSVersionInfoSize != sizeof(OSVERSIONINFOEXW)) - { - /* for some reason win sets ERROR_INSUFFICIENT_BUFFER even if it is large - enough but doesn't match the exact sizes supported, ERROR_INVALID_PARAMETER - would've been much more appropriate... */ - SetLastError(ERROR_INSUFFICIENT_BUFFER); - return FALSE; - } - - Status = RtlGetVersion((PRTL_OSVERSIONINFOW)lpVersionInformation); - if(NT_SUCCESS(Status)) - { - /* ReactOS specific changes */ - SetRosSpecificInfo(lpVersionInformation); - - return TRUE; - } - - return FALSE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -GetVersionExA(LPOSVERSIONINFOA lpVersionInformation) -{ - OSVERSIONINFOEXW viw; - - RtlZeroMemory(&viw, sizeof(viw)); - - switch(lpVersionInformation->dwOSVersionInfoSize) - { - case sizeof(OSVERSIONINFOA): - viw.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW); - break; - - case sizeof(OSVERSIONINFOEXA): - viw.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXW); - break; - - default: - /* for some reason win sets ERROR_INSUFFICIENT_BUFFER even if it is large - enough but doesn't match the exact sizes supported, ERROR_INVALID_PARAMETER - would've been much more appropriate... */ - SetLastError(ERROR_INSUFFICIENT_BUFFER); - return FALSE; - } - - if(GetVersionExW((LPOSVERSIONINFOW)&viw)) - { - ANSI_STRING CSDVersionA; - UNICODE_STRING CSDVersionW; - - /* copy back fields that match both supported structures */ - lpVersionInformation->dwMajorVersion = viw.dwMajorVersion; - lpVersionInformation->dwMinorVersion = viw.dwMinorVersion; - lpVersionInformation->dwBuildNumber = viw.dwBuildNumber; - lpVersionInformation->dwPlatformId = viw.dwPlatformId; - - /* convert the win version string */ - RtlInitUnicodeString(&CSDVersionW, viw.szCSDVersion); - - CSDVersionA.Length = 0; - CSDVersionA.MaximumLength = sizeof(lpVersionInformation->szCSDVersion); - CSDVersionA.Buffer = lpVersionInformation->szCSDVersion; - - RtlUnicodeStringToAnsiString(&CSDVersionA, &CSDVersionW, FALSE); - - /* convert the ReactOS version string */ - CSDVersionW.Buffer = viw.szCSDVersion + CSDVersionW.Length / sizeof(WCHAR) + 1; - CSDVersionW.MaximumLength = sizeof(viw.szCSDVersion) - (CSDVersionW.Length + sizeof(WCHAR)); - CSDVersionW.Length = wcslen(CSDVersionW.Buffer) * sizeof(WCHAR); - CSDVersionA.Buffer = lpVersionInformation->szCSDVersion + CSDVersionA.Length + 1; - CSDVersionA.MaximumLength = sizeof(lpVersionInformation->szCSDVersion) - (CSDVersionA.Length + 1); - CSDVersionA.Length = 0; - - RtlUnicodeStringToAnsiString(&CSDVersionA, &CSDVersionW, FALSE); - - /* copy back the extended fields */ - if(viw.dwOSVersionInfoSize == sizeof(OSVERSIONINFOEXW)) - { - ((LPOSVERSIONINFOEXA)lpVersionInformation)->wServicePackMajor = viw.wServicePackMajor; - ((LPOSVERSIONINFOEXA)lpVersionInformation)->wServicePackMinor = viw.wServicePackMinor; - ((LPOSVERSIONINFOEXA)lpVersionInformation)->wSuiteMask = viw.wSuiteMask; - ((LPOSVERSIONINFOEXA)lpVersionInformation)->wProductType = viw.wProductType; - ((LPOSVERSIONINFOEXA)lpVersionInformation)->wReserved = viw.wReserved; - } - - return TRUE; - } - - return FALSE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -VerifyVersionInfoW(LPOSVERSIONINFOEXW lpVersionInformation, - DWORD dwTypeMask, - DWORDLONG dwlConditionMask) -{ - NTSTATUS Status; - - Status = RtlVerifyVersionInfo((PRTL_OSVERSIONINFOEXW)lpVersionInformation, - dwTypeMask, - dwlConditionMask); - switch(Status) - { - case STATUS_INVALID_PARAMETER: - SetLastError(ERROR_BAD_ARGUMENTS); - return FALSE; - - case STATUS_REVISION_MISMATCH: - SetLastError(ERROR_OLD_WIN_VERSION); - return FALSE; - - default: - /* RtlVerifyVersionInfo shouldn't report any other failure code! */ - ASSERT(NT_SUCCESS(Status)); - - /* ReactOS specific changes */ - SetRosSpecificInfo((LPOSVERSIONINFOW)lpVersionInformation); - - return TRUE; - } -} - - -/* - * @implemented - */ -BOOL -WINAPI -VerifyVersionInfoA(LPOSVERSIONINFOEXA lpVersionInformation, - DWORD dwTypeMask, - DWORDLONG dwlConditionMask) -{ - OSVERSIONINFOEXW viex; - - viex.dwOSVersionInfoSize = sizeof(viex); - viex.dwMajorVersion = lpVersionInformation->dwMajorVersion; - viex.dwMinorVersion = lpVersionInformation->dwMinorVersion; - viex.dwBuildNumber = lpVersionInformation->dwBuildNumber; - viex.dwPlatformId = lpVersionInformation->dwPlatformId; - /* NOTE: szCSDVersion is ignored, we don't need to convert it to unicode */ - viex.wServicePackMajor = lpVersionInformation->wServicePackMajor; - viex.wServicePackMinor = lpVersionInformation->wServicePackMinor; - viex.wSuiteMask = lpVersionInformation->wSuiteMask; - viex.wProductType = lpVersionInformation->wProductType; - viex.wReserved = lpVersionInformation->wReserved; - - return VerifyVersionInfoW(&viex, dwTypeMask, dwlConditionMask); -} diff --git a/dll/win32/kernel32/process/cmdline.c b/dll/win32/kernel32/process/cmdline.c deleted file mode 100644 index 2c2b2421966..00000000000 --- a/dll/win32/kernel32/process/cmdline.c +++ /dev/null @@ -1,97 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * FILE: lib/kernel32/proc/proc.c - * PURPOSE: Process functions - * PROGRAMMER: Ariadne ( ariadne@xs4all.nl) - * UPDATE HISTORY: - * Created 01/11/98 - */ - -/* INCLUDES ****************************************************************/ - -#include - -#define NDEBUG -#include - - -/* GLOBALS ******************************************************************/ - -static UNICODE_STRING CommandLineStringW; -static ANSI_STRING CommandLineStringA; - -static BOOL bCommandLineInitialized = FALSE; - - -/* FUNCTIONS ****************************************************************/ - -VOID -WINAPI -InitCommandLines(VOID) -{ - PRTL_USER_PROCESS_PARAMETERS Params; - - /* get command line */ - Params = NtCurrentPeb()->ProcessParameters; - RtlNormalizeProcessParams (Params); - - /* initialize command line buffers */ - CommandLineStringW.Length = Params->CommandLine.Length; - CommandLineStringW.MaximumLength = CommandLineStringW.Length + sizeof(WCHAR); - CommandLineStringW.Buffer = RtlAllocateHeap(GetProcessHeap(), - HEAP_GENERATE_EXCEPTIONS | HEAP_ZERO_MEMORY, - CommandLineStringW.MaximumLength); - if (CommandLineStringW.Buffer == NULL) - { - return; - } - - RtlInitAnsiString(&CommandLineStringA, NULL); - - /* Copy command line */ - RtlCopyUnicodeString(&CommandLineStringW, - &(Params->CommandLine)); - CommandLineStringW.Buffer[CommandLineStringW.Length / sizeof(WCHAR)] = 0; - - /* convert unicode string to ansi (or oem) */ - if (bIsFileApiAnsi) - RtlUnicodeStringToAnsiString(&CommandLineStringA, - &CommandLineStringW, - TRUE); - else - RtlUnicodeStringToOemString(&CommandLineStringA, - &CommandLineStringW, - TRUE); - - CommandLineStringA.Buffer[CommandLineStringA.Length] = 0; - - bCommandLineInitialized = TRUE; -} - - -/* - * @implemented - */ -LPSTR -WINAPI -GetCommandLineA(VOID) -{ - DPRINT("CommandLine \'%s\'\n", CommandLineStringA.Buffer); - return CommandLineStringA.Buffer; -} - - -/* - * @implemented - */ -LPWSTR -WINAPI -GetCommandLineW(VOID) -{ - DPRINT("CommandLine \'%S\'\n", CommandLineStringW.Buffer); - return CommandLineStringW.Buffer; -} - -/* EOF */ diff --git a/dll/win32/kernel32/process/proc.c b/dll/win32/kernel32/process/proc.c deleted file mode 100644 index 41889ec8b4a..00000000000 --- a/dll/win32/kernel32/process/proc.c +++ /dev/null @@ -1,1137 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * FILE: lib/kernel32/proc/proc.c - * PURPOSE: Process functions - * PROGRAMMER: Ariadne ( ariadne@xs4all.nl) - * UPDATE HISTORY: - * Created 01/11/98 - */ - -/* INCLUDES ****************************************************************/ - -#include - -#define NDEBUG -#include - - -typedef INT (WINAPI *MessageBoxW_Proc) (HWND, LPCWSTR, LPCWSTR, UINT); - -/* GLOBALS *******************************************************************/ - -WaitForInputIdleType lpfnGlobalRegisterWaitForInputIdle; - -LPSTARTUPINFOA lpLocalStartupInfo = NULL; - -VOID WINAPI -RegisterWaitForInputIdle(WaitForInputIdleType lpfnRegisterWaitForInputIdle); - -/* FUNCTIONS ****************************************************************/ - -/* - * @implemented - */ -BOOL -WINAPI -GetProcessAffinityMask(HANDLE hProcess, - PDWORD_PTR lpProcessAffinityMask, - PDWORD_PTR lpSystemAffinityMask) -{ - PROCESS_BASIC_INFORMATION ProcessInfo; - SYSTEM_BASIC_INFORMATION SystemInfo; - NTSTATUS Status; - - Status = NtQuerySystemInformation(SystemBasicInformation, - &SystemInfo, - sizeof(SystemInfo), - NULL); - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return FALSE; - } - - Status = NtQueryInformationProcess(hProcess, - ProcessBasicInformation, - (PVOID)&ProcessInfo, - sizeof(PROCESS_BASIC_INFORMATION), - NULL); - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return FALSE; - } - - *lpProcessAffinityMask = (DWORD)ProcessInfo.AffinityMask; - *lpSystemAffinityMask = (DWORD)SystemInfo.ActiveProcessorsAffinityMask; - - return TRUE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -SetProcessAffinityMask(HANDLE hProcess, - DWORD_PTR dwProcessAffinityMask) -{ - NTSTATUS Status; - - Status = NtSetInformationProcess(hProcess, - ProcessAffinityMask, - (PVOID)&dwProcessAffinityMask, - sizeof(DWORD)); - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return FALSE; - } - - return TRUE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -GetProcessShutdownParameters(LPDWORD lpdwLevel, - LPDWORD lpdwFlags) -{ - CSR_API_MESSAGE CsrRequest; - ULONG Request; - NTSTATUS Status; - - Request = GET_SHUTDOWN_PARAMETERS; - Status = CsrClientCallServer(&CsrRequest, - NULL, - MAKE_CSR_API(Request, CSR_NATIVE), - sizeof(CSR_API_MESSAGE)); - if (!NT_SUCCESS(Status) || !NT_SUCCESS(CsrRequest.Status)) - { - SetLastErrorByStatus(Status); - return FALSE; - } - - *lpdwLevel = CsrRequest.Data.GetShutdownParametersRequest.Level; - *lpdwFlags = CsrRequest.Data.GetShutdownParametersRequest.Flags; - - return TRUE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -SetProcessShutdownParameters(DWORD dwLevel, - DWORD dwFlags) -{ - CSR_API_MESSAGE CsrRequest; - ULONG Request; - NTSTATUS Status; - - CsrRequest.Data.SetShutdownParametersRequest.Level = dwLevel; - CsrRequest.Data.SetShutdownParametersRequest.Flags = dwFlags; - - Request = SET_SHUTDOWN_PARAMETERS; - Status = CsrClientCallServer(&CsrRequest, - NULL, - MAKE_CSR_API(Request, CSR_NATIVE), - sizeof(CSR_API_MESSAGE)); - if (!NT_SUCCESS(Status) || !NT_SUCCESS(CsrRequest.Status)) - { - SetLastErrorByStatus(Status); - return FALSE; - } - - return TRUE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -GetProcessWorkingSetSize(HANDLE hProcess, - PSIZE_T lpMinimumWorkingSetSize, - PSIZE_T lpMaximumWorkingSetSize) -{ - QUOTA_LIMITS QuotaLimits; - NTSTATUS Status; - - Status = NtQueryInformationProcess(hProcess, - ProcessQuotaLimits, - &QuotaLimits, - sizeof(QUOTA_LIMITS), - NULL); - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return FALSE; - } - - *lpMinimumWorkingSetSize = QuotaLimits.MinimumWorkingSetSize; - *lpMaximumWorkingSetSize = QuotaLimits.MaximumWorkingSetSize; - - return TRUE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -SetProcessWorkingSetSize(HANDLE hProcess, - SIZE_T dwMinimumWorkingSetSize, - SIZE_T dwMaximumWorkingSetSize) -{ - QUOTA_LIMITS QuotaLimits; - NTSTATUS Status; - - QuotaLimits.MinimumWorkingSetSize = dwMinimumWorkingSetSize; - QuotaLimits.MaximumWorkingSetSize = dwMaximumWorkingSetSize; - - Status = NtSetInformationProcess(hProcess, - ProcessQuotaLimits, - &QuotaLimits, - sizeof(QUOTA_LIMITS)); - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return FALSE; - } - - return TRUE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -GetProcessTimes(HANDLE hProcess, - LPFILETIME lpCreationTime, - LPFILETIME lpExitTime, - LPFILETIME lpKernelTime, - LPFILETIME lpUserTime) -{ - KERNEL_USER_TIMES Kut; - NTSTATUS Status; - - Status = NtQueryInformationProcess(hProcess, - ProcessTimes, - &Kut, - sizeof(Kut), - NULL); - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return FALSE; - } - - lpCreationTime->dwLowDateTime = Kut.CreateTime.u.LowPart; - lpCreationTime->dwHighDateTime = Kut.CreateTime.u.HighPart; - - lpExitTime->dwLowDateTime = Kut.ExitTime.u.LowPart; - lpExitTime->dwHighDateTime = Kut.ExitTime.u.HighPart; - - lpKernelTime->dwLowDateTime = Kut.KernelTime.u.LowPart; - lpKernelTime->dwHighDateTime = Kut.KernelTime.u.HighPart; - - lpUserTime->dwLowDateTime = Kut.UserTime.u.LowPart; - lpUserTime->dwHighDateTime = Kut.UserTime.u.HighPart; - - return TRUE; -} - - -/* - * @implemented - */ -HANDLE -WINAPI -GetCurrentProcess(VOID) -{ - return (HANDLE)NtCurrentProcess(); -} - - -/* - * @implemented - */ -HANDLE -WINAPI -GetCurrentThread(VOID) -{ - return (HANDLE)NtCurrentThread(); -} - - -/* - * @implemented - */ -DWORD -WINAPI -GetCurrentProcessId(VOID) -{ - return HandleToUlong(GetTeb()->ClientId.UniqueProcess); -} - - -/* - * @implemented - */ -BOOL -WINAPI -GetExitCodeProcess(HANDLE hProcess, - LPDWORD lpExitCode) -{ - PROCESS_BASIC_INFORMATION ProcessBasic; - NTSTATUS Status; - - Status = NtQueryInformationProcess(hProcess, - ProcessBasicInformation, - &ProcessBasic, - sizeof(PROCESS_BASIC_INFORMATION), - NULL); - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return FALSE; - } - - *lpExitCode = (DWORD)ProcessBasic.ExitStatus; - - return TRUE; -} - - -/* - * @implemented - */ -DWORD -WINAPI -GetProcessId(HANDLE Process) -{ - PROCESS_BASIC_INFORMATION ProcessBasic; - NTSTATUS Status; - - Status = NtQueryInformationProcess(Process, - ProcessBasicInformation, - &ProcessBasic, - sizeof(PROCESS_BASIC_INFORMATION), - NULL); - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return 0; - } - - return (DWORD)ProcessBasic.UniqueProcessId; -} - - -/* - * @implemented - */ -HANDLE -WINAPI -OpenProcess(DWORD dwDesiredAccess, - BOOL bInheritHandle, - DWORD dwProcessId) -{ - NTSTATUS errCode; - HANDLE ProcessHandle; - OBJECT_ATTRIBUTES ObjectAttributes; - CLIENT_ID ClientId; - - ClientId.UniqueProcess = UlongToHandle(dwProcessId); - ClientId.UniqueThread = 0; - - InitializeObjectAttributes(&ObjectAttributes, - NULL, - (bInheritHandle ? OBJ_INHERIT : 0), - NULL, - NULL); - - errCode = NtOpenProcess(&ProcessHandle, - dwDesiredAccess, - &ObjectAttributes, - &ClientId); - if (!NT_SUCCESS(errCode)) - { - SetLastErrorByStatus(errCode); - return NULL; - } - - return ProcessHandle; -} - - -/* - * @implemented - */ -UINT -WINAPI -WinExec(LPCSTR lpCmdLine, - UINT uCmdShow) -{ - STARTUPINFOA StartupInfo; - PROCESS_INFORMATION ProcessInformation; - DWORD dosErr; - - RtlZeroMemory(&StartupInfo, sizeof(StartupInfo)); - StartupInfo.cb = sizeof(STARTUPINFOA); - StartupInfo.wShowWindow = (WORD)uCmdShow; - StartupInfo.dwFlags = 0; - - if (!CreateProcessA(NULL, - (PVOID)lpCmdLine, - NULL, - NULL, - FALSE, - 0, - NULL, - NULL, - &StartupInfo, - &ProcessInformation)) - { - dosErr = GetLastError(); - return dosErr < 32 ? dosErr : ERROR_BAD_FORMAT; - } - - if (NULL != lpfnGlobalRegisterWaitForInputIdle) - { - lpfnGlobalRegisterWaitForInputIdle(ProcessInformation.hProcess, - 10000); - } - - NtClose(ProcessInformation.hProcess); - NtClose(ProcessInformation.hThread); - - return 33; /* Something bigger than 31 means success. */ -} - - -/* - * @implemented - */ -VOID -WINAPI -RegisterWaitForInputIdle(WaitForInputIdleType lpfnRegisterWaitForInputIdle) -{ - lpfnGlobalRegisterWaitForInputIdle = lpfnRegisterWaitForInputIdle; - return; -} - -/* - * @implemented - */ -VOID -WINAPI -GetStartupInfoW(LPSTARTUPINFOW lpStartupInfo) -{ - PRTL_USER_PROCESS_PARAMETERS Params; - - if (lpStartupInfo == NULL) - { - SetLastError(ERROR_INVALID_PARAMETER); - return; - } - - Params = NtCurrentPeb()->ProcessParameters; - - lpStartupInfo->cb = sizeof(STARTUPINFOW); - lpStartupInfo->lpDesktop = Params->DesktopInfo.Buffer; - lpStartupInfo->lpTitle = Params->WindowTitle.Buffer; - lpStartupInfo->dwX = Params->StartingX; - lpStartupInfo->dwY = Params->StartingY; - lpStartupInfo->dwXSize = Params->CountX; - lpStartupInfo->dwYSize = Params->CountY; - lpStartupInfo->dwXCountChars = Params->CountCharsX; - lpStartupInfo->dwYCountChars = Params->CountCharsY; - lpStartupInfo->dwFillAttribute = Params->FillAttribute; - lpStartupInfo->dwFlags = Params->WindowFlags; - lpStartupInfo->wShowWindow = (WORD)Params->ShowWindowFlags; - lpStartupInfo->cbReserved2 = Params->RuntimeData.Length; - lpStartupInfo->lpReserved2 = (LPBYTE)Params->RuntimeData.Buffer; - - lpStartupInfo->hStdInput = Params->StandardInput; - lpStartupInfo->hStdOutput = Params->StandardOutput; - lpStartupInfo->hStdError = Params->StandardError; -} - - -/* - * @implemented - */ -VOID -WINAPI -GetStartupInfoA(LPSTARTUPINFOA lpStartupInfo) -{ - PRTL_USER_PROCESS_PARAMETERS Params; - ANSI_STRING AnsiString; - - if (lpStartupInfo == NULL) - { - SetLastError(ERROR_INVALID_PARAMETER); - return; - } - - Params = NtCurrentPeb ()->ProcessParameters; - - RtlAcquirePebLock (); - - /* FIXME - not thread-safe */ - if (lpLocalStartupInfo == NULL) - { - /* create new local startup info (ansi) */ - lpLocalStartupInfo = RtlAllocateHeap(RtlGetProcessHeap(), - 0, - sizeof(STARTUPINFOA)); - if (lpLocalStartupInfo == NULL) - { - RtlReleasePebLock(); - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - return; - } - - lpLocalStartupInfo->cb = sizeof(STARTUPINFOA); - - /* copy window title string */ - RtlUnicodeStringToAnsiString(&AnsiString, - &Params->WindowTitle, - TRUE); - lpLocalStartupInfo->lpTitle = AnsiString.Buffer; - - /* copy desktop info string */ - RtlUnicodeStringToAnsiString(&AnsiString, - &Params->DesktopInfo, - TRUE); - lpLocalStartupInfo->lpDesktop = AnsiString.Buffer; - - /* copy shell info string */ - RtlUnicodeStringToAnsiString(&AnsiString, - &Params->ShellInfo, - TRUE); - lpLocalStartupInfo->lpReserved = AnsiString.Buffer; - - lpLocalStartupInfo->dwX = Params->StartingX; - lpLocalStartupInfo->dwY = Params->StartingY; - lpLocalStartupInfo->dwXSize = Params->CountX; - lpLocalStartupInfo->dwYSize = Params->CountY; - lpLocalStartupInfo->dwXCountChars = Params->CountCharsX; - lpLocalStartupInfo->dwYCountChars = Params->CountCharsY; - lpLocalStartupInfo->dwFillAttribute = Params->FillAttribute; - lpLocalStartupInfo->dwFlags = Params->WindowFlags; - lpLocalStartupInfo->wShowWindow = (WORD)Params->ShowWindowFlags; - lpLocalStartupInfo->cbReserved2 = Params->RuntimeData.Length; - lpLocalStartupInfo->lpReserved2 = (LPBYTE)Params->RuntimeData.Buffer; - - lpLocalStartupInfo->hStdInput = Params->StandardInput; - lpLocalStartupInfo->hStdOutput = Params->StandardOutput; - lpLocalStartupInfo->hStdError = Params->StandardError; - } - - RtlReleasePebLock(); - - /* copy local startup info data to external startup info */ - memcpy(lpStartupInfo, - lpLocalStartupInfo, - sizeof(STARTUPINFOA)); -} - - -/* - * @implemented - */ -BOOL -WINAPI -FlushInstructionCache(HANDLE hProcess, - LPCVOID lpBaseAddress, - SIZE_T dwSize) -{ - NTSTATUS Status; - - Status = NtFlushInstructionCache(hProcess, - (PVOID)lpBaseAddress, - dwSize); - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return FALSE; - } - - return TRUE; -} - - -/* - * @implemented - */ -VOID -WINAPI -ExitProcess(UINT uExitCode) -{ - CSR_API_MESSAGE CsrRequest; - ULONG Request; - NTSTATUS Status; - - /* kill sibling threads ... we want to be alone at this point */ - NtTerminateProcess(NULL, 0); - - /* unload all dll's */ - LdrShutdownProcess(); - - /* notify csrss of process termination */ - Request = TERMINATE_PROCESS; - Status = CsrClientCallServer(&CsrRequest, - NULL, - MAKE_CSR_API(Request, CSR_NATIVE), - sizeof(CSR_API_MESSAGE)); - if (!NT_SUCCESS(Status) || !NT_SUCCESS(CsrRequest.Status)) - { - DPRINT("Failed to tell csrss about terminating process\n"); - } - - NtTerminateProcess(NtCurrentProcess (), - uExitCode); - - /* should never get here */ - ASSERT(0); - while(1); -} - - -/* - * @implemented - */ -BOOL -WINAPI -TerminateProcess(HANDLE hProcess, - UINT uExitCode) -{ - NTSTATUS Status; - - if (hProcess == NULL) - { - return FALSE; - } - - Status = NtTerminateProcess(hProcess, uExitCode); - if (NT_SUCCESS(Status)) - { - return TRUE; - } - - SetLastErrorByStatus(Status); - return FALSE; -} - - -/* - * @unimplemented - */ -VOID -WINAPI -FatalAppExitA(UINT uAction, - LPCSTR lpMessageText) -{ - UNICODE_STRING MessageTextU; - ANSI_STRING MessageText; - - RtlInitAnsiString(&MessageText, (LPSTR)lpMessageText); - - RtlAnsiStringToUnicodeString(&MessageTextU, - &MessageText, - TRUE); - - FatalAppExitW(uAction, MessageTextU.Buffer); - - RtlFreeUnicodeString(&MessageTextU); -} - - -/* - * @unimplemented - */ -VOID -WINAPI -FatalAppExitW(UINT uAction, - LPCWSTR lpMessageText) -{ - static const WCHAR szUser32[] = L"user32.dll\0"; - - HMODULE hModule = GetModuleHandleW(szUser32); - MessageBoxW_Proc pMessageBoxW = NULL; - - DPRINT1("AppExit\n"); - - if (hModule) - pMessageBoxW = (MessageBoxW_Proc)GetProcAddress(hModule, "MessageBoxW"); - - if (pMessageBoxW) - pMessageBoxW(0, lpMessageText, NULL, MB_SYSTEMMODAL | MB_OK); - else - DPRINT1("%s\n", lpMessageText); - - ExitProcess(0); -} - - -/* - * @implemented - */ -VOID -WINAPI -FatalExit(int ExitCode) -{ - ExitProcess(ExitCode); -} - - -/* - * @implemented - */ -DWORD -WINAPI -GetPriorityClass(HANDLE hProcess) -{ - NTSTATUS Status; - PROCESS_PRIORITY_CLASS PriorityClass; - - Status = NtQueryInformationProcess(hProcess, - ProcessPriorityClass, - &PriorityClass, - sizeof(PROCESS_PRIORITY_CLASS), - NULL); - if(NT_SUCCESS(Status)) - { - switch(PriorityClass.PriorityClass) - { - case PROCESS_PRIORITY_CLASS_IDLE: - return IDLE_PRIORITY_CLASS; - - case PROCESS_PRIORITY_CLASS_BELOW_NORMAL: - return BELOW_NORMAL_PRIORITY_CLASS; - - case PROCESS_PRIORITY_CLASS_NORMAL: - return NORMAL_PRIORITY_CLASS; - - case PROCESS_PRIORITY_CLASS_ABOVE_NORMAL: - return ABOVE_NORMAL_PRIORITY_CLASS; - - case PROCESS_PRIORITY_CLASS_HIGH: - return HIGH_PRIORITY_CLASS; - - case PROCESS_PRIORITY_CLASS_REALTIME: - return REALTIME_PRIORITY_CLASS; - - default: - return NORMAL_PRIORITY_CLASS; - } - } - - SetLastErrorByStatus(Status); - return FALSE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -SetPriorityClass(HANDLE hProcess, - DWORD dwPriorityClass) -{ - NTSTATUS Status; - PROCESS_PRIORITY_CLASS PriorityClass; - - switch (dwPriorityClass) - { - case IDLE_PRIORITY_CLASS: - PriorityClass.PriorityClass = PROCESS_PRIORITY_CLASS_IDLE; - break; - - case BELOW_NORMAL_PRIORITY_CLASS: - PriorityClass.PriorityClass = PROCESS_PRIORITY_CLASS_BELOW_NORMAL; - break; - - case NORMAL_PRIORITY_CLASS: - PriorityClass.PriorityClass = PROCESS_PRIORITY_CLASS_NORMAL; - break; - - case ABOVE_NORMAL_PRIORITY_CLASS: - PriorityClass.PriorityClass = PROCESS_PRIORITY_CLASS_ABOVE_NORMAL; - break; - - case HIGH_PRIORITY_CLASS: - PriorityClass.PriorityClass = PROCESS_PRIORITY_CLASS_HIGH; - break; - - case REALTIME_PRIORITY_CLASS: - PriorityClass.PriorityClass = PROCESS_PRIORITY_CLASS_REALTIME; - break; - - default: - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } - - PriorityClass.Foreground = FALSE; - - Status = NtSetInformationProcess(hProcess, - ProcessPriorityClass, - &PriorityClass, - sizeof(PROCESS_PRIORITY_CLASS)); - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return FALSE; - } - - return TRUE; -} - - -/* - * @implemented - */ -DWORD -WINAPI -GetProcessVersion(DWORD ProcessId) -{ - DWORD Version = 0; - PIMAGE_NT_HEADERS NtHeader = NULL; - IMAGE_NT_HEADERS NtHeaders; - IMAGE_DOS_HEADER DosHeader; - PROCESS_BASIC_INFORMATION ProcessBasicInfo; - PVOID BaseAddress = NULL; - HANDLE ProcessHandle = NULL; - NTSTATUS Status; - SIZE_T Count; - PEB Peb; - - _SEH2_TRY - { - if (0 == ProcessId || GetCurrentProcessId() == ProcessId) - { - /* Caller's */ - BaseAddress = (PVOID) NtCurrentPeb()->ImageBaseAddress; - NtHeader = RtlImageNtHeader(BaseAddress); - - Version = (NtHeader->OptionalHeader.MajorOperatingSystemVersion << 16) | - (NtHeader->OptionalHeader.MinorOperatingSystemVersion); - } - else - { - /* Other process */ - ProcessHandle = OpenProcess(PROCESS_VM_READ | PROCESS_QUERY_INFORMATION, - FALSE, - ProcessId); - - if (!ProcessHandle) return 0; - - Status = NtQueryInformationProcess(ProcessHandle, - ProcessBasicInformation, - &ProcessBasicInfo, - sizeof(ProcessBasicInfo), - NULL); - - if (!NT_SUCCESS(Status)) goto Error; - - Status = NtReadVirtualMemory(ProcessHandle, - ProcessBasicInfo.PebBaseAddress, - &Peb, - sizeof(Peb), - &Count); - - if (!NT_SUCCESS(Status) || Count != sizeof(Peb)) goto Error; - - memset(&DosHeader, 0, sizeof(DosHeader)); - Status = NtReadVirtualMemory(ProcessHandle, - Peb.ImageBaseAddress, - &DosHeader, - sizeof(DosHeader), - &Count); - - if (!NT_SUCCESS(Status) || Count != sizeof(DosHeader)) goto Error; - if (DosHeader.e_magic != IMAGE_DOS_SIGNATURE) goto Error; - - memset(&NtHeaders, 0, sizeof(NtHeaders)); - Status = NtReadVirtualMemory(ProcessHandle, - (char *)Peb.ImageBaseAddress + DosHeader.e_lfanew, - &NtHeaders, - sizeof(NtHeaders), - &Count); - - if (!NT_SUCCESS(Status) || Count != sizeof(NtHeaders)) goto Error; - if (NtHeaders.Signature != IMAGE_NT_SIGNATURE) goto Error; - - Version = MAKELONG(NtHeaders.OptionalHeader.MinorSubsystemVersion, - NtHeaders.OptionalHeader.MajorSubsystemVersion); - -Error: - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - } - } - } - _SEH2_FINALLY - { - if (ProcessHandle) CloseHandle(ProcessHandle); - } - _SEH2_END; - - return Version; -} - - -/* - * @implemented - */ -BOOL -WINAPI -GetProcessIoCounters(HANDLE hProcess, - PIO_COUNTERS lpIoCounters) -{ - NTSTATUS Status; - - Status = NtQueryInformationProcess(hProcess, - ProcessIoCounters, - lpIoCounters, - sizeof(IO_COUNTERS), - NULL); - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return FALSE; - } - - return TRUE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -GetProcessPriorityBoost(HANDLE hProcess, - PBOOL pDisablePriorityBoost) -{ - NTSTATUS Status; - ULONG PriorityBoost; - - Status = NtQueryInformationProcess(hProcess, - ProcessPriorityBoost, - &PriorityBoost, - sizeof(ULONG), - NULL); - if (NT_SUCCESS(Status)) - { - *pDisablePriorityBoost = PriorityBoost; - return TRUE; - } - - SetLastErrorByStatus(Status); - return FALSE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -SetProcessPriorityBoost(HANDLE hProcess, - BOOL bDisablePriorityBoost) -{ - NTSTATUS Status; - ULONG PriorityBoost = (bDisablePriorityBoost ? TRUE : FALSE); /* prevent setting values other than 1 and 0 */ - - Status = NtSetInformationProcess(hProcess, - ProcessPriorityBoost, - &PriorityBoost, - sizeof(ULONG)); - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return FALSE; - } - - return TRUE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -GetProcessHandleCount(HANDLE hProcess, - PDWORD pdwHandleCount) -{ - ULONG phc; - NTSTATUS Status; - - Status = NtQueryInformationProcess(hProcess, - ProcessHandleCount, - &phc, - sizeof(ULONG), - NULL); - if(NT_SUCCESS(Status)) - { - *pdwHandleCount = phc; - return TRUE; - } - - SetLastErrorByStatus(Status); - return FALSE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -IsWow64Process(HANDLE hProcess, - PBOOL Wow64Process) -{ - ULONG_PTR pbi; - NTSTATUS Status; - - Status = NtQueryInformationProcess(hProcess, - ProcessWow64Information, - &pbi, - sizeof(pbi), - NULL); - if (!NT_SUCCESS(Status)) - { - SetLastError(RtlNtStatusToDosError(Status)); - return FALSE; - } - - *Wow64Process = (pbi != 0); - - return TRUE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -QueryFullProcessImageNameW(HANDLE hProcess, - DWORD dwFlags, - LPWSTR lpExeName, - PDWORD pdwSize) -{ - BYTE Buffer[sizeof(UNICODE_STRING) + MAX_PATH * sizeof(WCHAR)]; - UNICODE_STRING *DynamicBuffer = NULL; - UNICODE_STRING *Result = NULL; - NTSTATUS Status; - DWORD Needed; - - Status = NtQueryInformationProcess(hProcess, - ProcessImageFileName, - Buffer, - sizeof(Buffer) - sizeof(WCHAR), - &Needed); - if (Status == STATUS_INFO_LENGTH_MISMATCH) - { - DynamicBuffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, Needed + sizeof(WCHAR)); - if (!DynamicBuffer) - { - SetLastErrorByStatus(STATUS_NO_MEMORY); - return FALSE; - } - - Status = NtQueryInformationProcess(hProcess, - ProcessImageFileName, - (LPBYTE)DynamicBuffer, - Needed, - &Needed); - Result = DynamicBuffer; - } - else Result = (PUNICODE_STRING)Buffer; - - if (!NT_SUCCESS(Status)) goto Cleanup; - - if (Result->Length / sizeof(WCHAR) + 1 > *pdwSize) - { - Status = STATUS_BUFFER_TOO_SMALL; - goto Cleanup; - } - - *pdwSize = Result->Length / sizeof(WCHAR); - memcpy(lpExeName, Result->Buffer, Result->Length); - lpExeName[*pdwSize] = 0; - -Cleanup: - RtlFreeHeap(RtlGetProcessHeap(), 0, DynamicBuffer); - - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - } - - return !Status; -} - - -/* - * @implemented - */ -BOOL -WINAPI -QueryFullProcessImageNameA(HANDLE hProcess, - DWORD dwFlags, - LPSTR lpExeName, - PDWORD pdwSize) -{ - DWORD pdwSizeW = *pdwSize; - BOOL Result; - LPWSTR lpExeNameW; - - lpExeNameW = RtlAllocateHeap(RtlGetProcessHeap(), - HEAP_ZERO_MEMORY, - *pdwSize * sizeof(WCHAR)); - if (!lpExeNameW) - { - SetLastErrorByStatus(STATUS_NO_MEMORY); - return FALSE; - } - - Result = QueryFullProcessImageNameW(hProcess, dwFlags, lpExeNameW, &pdwSizeW); - - if (Result) - Result = (0 != WideCharToMultiByte(CP_ACP, 0, - lpExeNameW, - -1, - lpExeName, - *pdwSize, - NULL, NULL)); - - if (Result) - *pdwSize = strlen(lpExeName); - - RtlFreeHeap(RtlGetProcessHeap(), 0, lpExeNameW); - return Result; -} - -/* EOF */ diff --git a/dll/win32/kernel32/process/session.c b/dll/win32/kernel32/process/session.c deleted file mode 100644 index 7e9dcd148d7..00000000000 --- a/dll/win32/kernel32/process/session.c +++ /dev/null @@ -1,115 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * FILE: lib/kernel32/proc/session.c - * PURPOSE: Win32 session (TS) functions - * PROGRAMMER: Emanuele Aliberti - * UPDATE HISTORY: - * 2001-12-07 created - */ -#include -#define NDEBUG -#include -//DEBUG_CHANNEL(kernel32session); not actually used - -DWORD ActiveConsoleSessionId = 0; - - -/* - * @unimplemented - */ -DWORD -WINAPI -DosPathToSessionPathW(DWORD SessionID, - LPWSTR InPath, - LPWSTR *OutPath) -{ - UNIMPLEMENTED; - return 0; -} - -/* - * From: ActiveVB.DE - * - * Declare Function DosPathToSessionPath _ - * Lib "kernel32.dll" _ - * Alias "DosPathToSessionPathA" ( _ - * ByVal SessionId As Long, _ - * ByVal pInPath As String, _ - * ByVal ppOutPath As String ) _ - * As Long - * - * @unimplemented - */ -DWORD -WINAPI -DosPathToSessionPathA(DWORD SessionId, - LPSTR InPath, - LPSTR *OutPath) -{ - //DosPathToSessionPathW (SessionId,InPathW,OutPathW); - UNIMPLEMENTED; - return 0; -} - -/* - * @implemented - */ -BOOL -WINAPI -ProcessIdToSessionId(IN DWORD dwProcessId, - OUT DWORD *pSessionId) -{ - PROCESS_SESSION_INFORMATION SessionInformation; - OBJECT_ATTRIBUTES ObjectAttributes; - CLIENT_ID ClientId; - HANDLE ProcessHandle; - NTSTATUS Status; - - if (IsBadWritePtr(pSessionId, sizeof(DWORD))) - { - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } - - ClientId.UniqueProcess = UlongToHandle(dwProcessId); - ClientId.UniqueThread = 0; - - InitializeObjectAttributes(&ObjectAttributes, NULL, 0, NULL, NULL); - - Status = NtOpenProcess(&ProcessHandle, - PROCESS_QUERY_INFORMATION, - &ObjectAttributes, - &ClientId); - if (NT_SUCCESS(Status)) - { - Status = NtQueryInformationProcess(ProcessHandle, - ProcessSessionInformation, - &SessionInformation, - sizeof(SessionInformation), - NULL); - NtClose(ProcessHandle); - - if (NT_SUCCESS(Status)) - { - *pSessionId = SessionInformation.SessionId; - return TRUE; - } - } - - SetLastErrorByStatus(Status); - return FALSE; -} - -/* - * @implemented - */ -DWORD -WINAPI -WTSGetActiveConsoleSessionId(VOID) -{ - return ActiveConsoleSessionId; -} - -/* EOF */ diff --git a/dll/win32/kernel32/synch/condvar.c b/dll/win32/kernel32/synch/condvar.c deleted file mode 100644 index 6eebbccff90..00000000000 --- a/dll/win32/kernel32/synch/condvar.c +++ /dev/null @@ -1,95 +0,0 @@ -/* COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * PURPOSE: Condition Variable functions - * PROGRAMMER: Thomas Weidenmueller - */ - -#include - -#define NDEBUG -#include - -/* FIXME: Move these RTL declarations to the NDK */ -NTSTATUS -NTAPI -RtlSleepConditionVariableCS(IN OUT PRTL_CONDITION_VARIABLE ConditionVariable, - IN OUT PRTL_CRITICAL_SECTION CriticalSection, - IN PLARGE_INTEGER TimeOut OPTIONAL); - -NTSTATUS -NTAPI -RtlSleepConditionVariableSRW(IN OUT PRTL_CONDITION_VARIABLE ConditionVariable, - IN OUT PRTL_SRWLOCK SRWLock, - IN PLARGE_INTEGER TimeOut OPTIONAL, - IN ULONG Flags); - -/* PUBLIC FUNCTIONS ***********************************************************/ - -/* - * @implemented - */ -BOOL -WINAPI -SleepConditionVariableCS(IN OUT PCONDITION_VARIABLE ConditionVariable, - IN OUT PCRITICAL_SECTION CriticalSection, - IN DWORD dwMilliseconds) -{ - NTSTATUS Status = 0; - LARGE_INTEGER TimeOut; - PLARGE_INTEGER TimeOutPtr = NULL; - - if (dwMilliseconds != INFINITE) - { - TimeOut.QuadPart = UInt32x32To64(-10000, dwMilliseconds); - TimeOutPtr = &TimeOut; - } - -#if 0 - Status = RtlSleepConditionVariableCS((PRTL_CONDITION_VARIABLE)ConditionVariable, - (PRTL_CRITICAL_SECTION)CriticalSection, - TimeOutPtr); -#endif - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return FALSE; - } - - return TRUE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -SleepConditionVariableSRW(IN OUT PCONDITION_VARIABLE ConditionVariable, - IN OUT PSRWLOCK SRWLock, - IN DWORD dwMilliseconds, - IN ULONG Flags) -{ - NTSTATUS Status = 0; - LARGE_INTEGER TimeOut; - PLARGE_INTEGER TimeOutPtr = NULL; - - if (dwMilliseconds != INFINITE) - { - TimeOut.QuadPart = UInt32x32To64(-10000, dwMilliseconds); - TimeOutPtr = &TimeOut; - } - -#if 0 - Status = RtlSleepConditionVariableSRW((PRTL_CONDITION_VARIABLE)ConditionVariable, - (PRTL_SRWLOCK)SRWLock, - TimeOutPtr, - Flags); -#endif - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return FALSE; - } - - return TRUE; -} diff --git a/dll/win32/kernel32/synch/critical.c b/dll/win32/kernel32/synch/critical.c deleted file mode 100644 index ac5280a60bd..00000000000 --- a/dll/win32/kernel32/synch/critical.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * PROJECT: ReactOS Win32 Base API - * LICENSE: GPL - See COPYING in the top level directory - * FILE: dll/win32/kernel32/synch/critical.c - * PURPOSE: Wrappers for the RTL Critical Section Implementation - * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org) - */ - -/* INCLUDES *****************************************************************/ - -#include - -#define NDEBUG -#include - -/* FUNCTIONS *****************************************************************/ - -/* - * @implemented - */ -VOID -WINAPI -InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection) -{ - NTSTATUS Status; - - /* Initialize the critical section and raise an exception if we failed */ - Status = RtlInitializeCriticalSection( - (PRTL_CRITICAL_SECTION)lpCriticalSection); - if (!NT_SUCCESS(Status)) RtlRaiseStatus(Status); -} - -/* - * @implemented - */ -BOOL -WINAPI -InitializeCriticalSectionAndSpinCount(OUT LPCRITICAL_SECTION lpCriticalSection, - IN DWORD dwSpinCount) -{ - NTSTATUS Status; - - /* Initialize the critical section */ - Status = RtlInitializeCriticalSectionAndSpinCount( - (PRTL_CRITICAL_SECTION)lpCriticalSection, - dwSpinCount); - if (!NT_SUCCESS(Status)) - { - /* Set failure code */ - SetLastErrorByStatus(Status); - return FALSE; - } - - /* Success */ - return TRUE; -} - -/* - * @implemented - */ -BOOL WINAPI InitializeCriticalSectionEx(OUT LPCRITICAL_SECTION lpCriticalSection, - IN DWORD dwSpinCount, - IN DWORD flags ) -{ - NTSTATUS Status; - - /* FIXME: Flags ignored */ - - /* Initialize the critical section */ - Status = RtlInitializeCriticalSectionAndSpinCount( - (PRTL_CRITICAL_SECTION)lpCriticalSection, - dwSpinCount); - if (!NT_SUCCESS(Status)) - { - /* Set failure code */ - SetLastErrorByStatus(Status); - return FALSE; - } - - /* Success */ - return TRUE; -} - -/* EOF */ diff --git a/dll/win32/kernel32/synch/event.c b/dll/win32/kernel32/synch/event.c deleted file mode 100644 index 3f1d7951350..00000000000 --- a/dll/win32/kernel32/synch/event.c +++ /dev/null @@ -1,297 +0,0 @@ -/* - * PROJECT: ReactOS Win32 Base API - * LICENSE: GPL - See COPYING in the top level directory - * FILE: dll/win32/kernel32/synch/event.c - * PURPOSE: Wrappers for the NT Event Implementation - * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org) - */ - -/* INCLUDES *****************************************************************/ - -#include -#define NDEBUG -#include - -/* FUNCTIONS ****************************************************************/ - -HANDLE -WINAPI -CreateEventExA(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, - IN LPCSTR lpName OPTIONAL, - IN DWORD dwFlags, - IN DWORD dwDesiredAccess) -{ - NTSTATUS Status; - ANSI_STRING AnsiName; - PUNICODE_STRING UnicodeCache; - LPCWSTR UnicodeName = NULL; - - /* Check for a name */ - if (lpName) - { - /* Use TEB Cache */ - UnicodeCache = &NtCurrentTeb()->StaticUnicodeString; - - /* Convert to unicode */ - RtlInitAnsiString(&AnsiName, lpName); - Status = RtlAnsiStringToUnicodeString(UnicodeCache, &AnsiName, FALSE); - if (!NT_SUCCESS(Status)) - { - /* Conversion failed */ - SetLastErrorByStatus(Status); - return NULL; - } - - /* Otherwise, save the buffer */ - UnicodeName = (LPCWSTR)UnicodeCache->Buffer; - } - - /* Call the Unicode API */ - return CreateEventExW(lpEventAttributes, - UnicodeName, - dwFlags, - dwDesiredAccess); - -} - -HANDLE -WINAPI -CreateEventExW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, - IN LPCWSTR lpName OPTIONAL, - IN DWORD dwFlags, - IN DWORD dwDesiredAccess) -{ - NTSTATUS Status; - OBJECT_ATTRIBUTES LocalAttributes; - POBJECT_ATTRIBUTES ObjectAttributes; - HANDLE Handle; - UNICODE_STRING ObjectName; - BOOLEAN InitialState; - EVENT_TYPE EventType; - - /* Now check if we got a name */ - if (lpName) RtlInitUnicodeString(&ObjectName, lpName); - - /* Check for invalid flags */ - if (dwFlags & ~(CREATE_EVENT_INITIAL_SET | CREATE_EVENT_MANUAL_RESET)) - { - /* Fail */ - SetLastError(ERROR_INVALID_PARAMETER); - return NULL; - } - - /* Set initial state and event type */ - InitialState = (dwFlags & CREATE_EVENT_INITIAL_SET) ? TRUE : FALSE; - EventType = (dwFlags & CREATE_EVENT_MANUAL_RESET) ? NotificationEvent : SynchronizationEvent; - - /* Now convert the object attributes */ - ObjectAttributes = BasepConvertObjectAttributes(&LocalAttributes, - lpEventAttributes, - lpName ? &ObjectName : NULL); - - /* Create the event */ - Status = NtCreateEvent(&Handle, - (ACCESS_MASK)dwDesiredAccess, - ObjectAttributes, - EventType, - InitialState); - if (NT_SUCCESS(Status)) - { - /* Check if the object already existed */ - if (Status == STATUS_OBJECT_NAME_EXISTS) - { - /* Set distinguished Win32 error code */ - SetLastError(ERROR_ALREADY_EXISTS); - } - else - { - /* Otherwise, set success */ - SetLastError(ERROR_SUCCESS); - } - - /* Return the handle */ - return Handle; - } - else - { - /* Convert the NT Status and fail */ - SetLastErrorByStatus(Status); - return NULL; - } - -} - -HANDLE -WINAPI -CreateEventA(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, - IN BOOL bManualReset, - IN BOOL bInitialState, - IN LPCSTR lpName OPTIONAL) -{ - DWORD dwFlags = 0; - - /* Set new flags */ - if (bManualReset) dwFlags |= CREATE_EVENT_MANUAL_RESET; - if (bInitialState) dwFlags |= CREATE_EVENT_INITIAL_SET; - - /* Call the newer API */ - return CreateEventExA(lpEventAttributes, - lpName, - dwFlags, - EVENT_ALL_ACCESS); -} - -HANDLE -WINAPI -CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, - IN BOOL bManualReset, - IN BOOL bInitialState, - IN LPCWSTR lpName OPTIONAL) -{ - DWORD dwFlags = 0; - - /* Set new flags */ - if (bManualReset) dwFlags |= CREATE_EVENT_MANUAL_RESET; - if (bInitialState) dwFlags |= CREATE_EVENT_INITIAL_SET; - - /* Call the newer API */ - return CreateEventExW(lpEventAttributes, - lpName, - dwFlags, - EVENT_ALL_ACCESS); -} - -HANDLE -WINAPI -OpenEventA(IN DWORD dwDesiredAccess, - IN BOOL bInheritHandle, - IN LPCSTR lpName) -{ - NTSTATUS Status; - ANSI_STRING AnsiName; - PUNICODE_STRING UnicodeCache; - - /* Check for a name */ - if (lpName) - { - /* Use TEB Cache */ - UnicodeCache = &NtCurrentTeb()->StaticUnicodeString; - - /* Convert to unicode */ - RtlInitAnsiString(&AnsiName, lpName); - Status = RtlAnsiStringToUnicodeString(UnicodeCache, &AnsiName, FALSE); - if (!NT_SUCCESS(Status)) - { - /* Conversion failed */ - SetLastErrorByStatus(Status); - return NULL; - } - } - else - { - /* We need a name */ - SetLastError(ERROR_INVALID_PARAMETER); - return NULL; - } - - /* Call the Unicode API */ - return OpenEventW(dwDesiredAccess, - bInheritHandle, - (LPCWSTR)UnicodeCache->Buffer); -} - -HANDLE -WINAPI -OpenEventW(IN DWORD dwDesiredAccess, - IN BOOL bInheritHandle, - IN LPCWSTR lpName) -{ - OBJECT_ATTRIBUTES ObjectAttributes; - UNICODE_STRING ObjectName; - NTSTATUS Status; - HANDLE Handle; - - /* Make sure we got a name */ - if (!lpName) - { - /* Fail without one */ - SetLastErrorByStatus(STATUS_INVALID_PARAMETER); - return NULL; - } - - /* Initialize the object name and attributes */ - RtlInitUnicodeString(&ObjectName, lpName); - InitializeObjectAttributes(&ObjectAttributes, - &ObjectName, - bInheritHandle ? OBJ_INHERIT : 0, - hBaseDir, - NULL); - - /* Open the event */ - Status = NtOpenEvent(&Handle, dwDesiredAccess, &ObjectAttributes); - if (!NT_SUCCESS(Status)) - { - /* Convert the status and fail */ - SetLastErrorByStatus(Status); - return NULL; - } - - /* Return the handle */ - return Handle; -} - -/* - * @implemented - */ -BOOL -WINAPI -PulseEvent(IN HANDLE hEvent) -{ - NTSTATUS Status; - - /* Pulse the event */ - Status = NtPulseEvent(hEvent, NULL); - if (NT_SUCCESS(Status)) return TRUE; - - /* If we got here, then we failed */ - SetLastErrorByStatus(Status); - return FALSE; -} - -/* - * @implemented - */ -BOOL -WINAPI -ResetEvent(IN HANDLE hEvent) -{ - NTSTATUS Status; - - /* Clear the event */ - Status = NtResetEvent(hEvent, NULL); - if (NT_SUCCESS(Status)) return TRUE; - - /* If we got here, then we failed */ - SetLastErrorByStatus(Status); - return FALSE; -} - -/* - * @implemented - */ -BOOL -WINAPI -SetEvent(IN HANDLE hEvent) -{ - NTSTATUS Status; - - /* Set the event */ - Status = NtSetEvent(hEvent, NULL); - if (NT_SUCCESS(Status)) return TRUE; - - /* If we got here, then we failed */ - SetLastErrorByStatus(Status); - return FALSE; -} - -/* EOF */ diff --git a/dll/win32/kernel32/synch/mutex.c b/dll/win32/kernel32/synch/mutex.c deleted file mode 100644 index 69dca56555c..00000000000 --- a/dll/win32/kernel32/synch/mutex.c +++ /dev/null @@ -1,268 +0,0 @@ -/* - * PROJECT: ReactOS Win32 Base API - * LICENSE: GPL - See COPYING in the top level directory - * FILE: dll/win32/kernel32/synch/mutex.c - * PURPOSE: Wrappers for the NT Mutant Implementation - * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org) - */ - -/* INCLUDES *****************************************************************/ - -#include - -#define NDEBUG -#include - -/* FUNCTIONS *****************************************************************/ - -/* - * @implemented - */ -HANDLE -WINAPI -CreateMutexExA(IN LPSECURITY_ATTRIBUTES lpMutexAttributes OPTIONAL, - IN LPCSTR lpName OPTIONAL, - IN DWORD dwFlags, - IN DWORD dwDesiredAccess) -{ - NTSTATUS Status; - ANSI_STRING AnsiName; - PUNICODE_STRING UnicodeCache; - LPCWSTR UnicodeName = NULL; - - /* Check for a name */ - if (lpName) - { - /* Use TEB Cache */ - UnicodeCache = &NtCurrentTeb()->StaticUnicodeString; - - /* Convert to unicode */ - RtlInitAnsiString(&AnsiName, lpName); - Status = RtlAnsiStringToUnicodeString(UnicodeCache, &AnsiName, FALSE); - if (!NT_SUCCESS(Status)) - { - /* Conversion failed */ - SetLastErrorByStatus(Status); - return NULL; - } - - /* Otherwise, save the buffer */ - UnicodeName = (LPCWSTR)UnicodeCache->Buffer; - } - - /* Call the Unicode API */ - return CreateMutexExW(lpMutexAttributes, - UnicodeName, - dwFlags, - dwDesiredAccess); -} - -/* - * @implemented - */ -HANDLE -WINAPI -CreateMutexExW(IN LPSECURITY_ATTRIBUTES lpMutexAttributes OPTIONAL, - IN LPCWSTR lpName OPTIONAL, - IN DWORD dwFlags, - IN DWORD dwDesiredAccess) -{ - NTSTATUS Status; - OBJECT_ATTRIBUTES LocalAttributes; - POBJECT_ATTRIBUTES ObjectAttributes; - HANDLE Handle; - UNICODE_STRING ObjectName; - BOOLEAN InitialOwner; - - /* Now check if we got a name */ - if (lpName) RtlInitUnicodeString(&ObjectName, lpName); - - if (dwFlags & ~(CREATE_MUTEX_INITIAL_OWNER)) - { - SetLastError(ERROR_INVALID_PARAMETER); - return NULL; - } - - InitialOwner = (dwFlags & CREATE_MUTEX_INITIAL_OWNER) != 0; - - /* Now convert the object attributes */ - ObjectAttributes = BasepConvertObjectAttributes(&LocalAttributes, - lpMutexAttributes, - lpName ? &ObjectName : NULL); - - /* Create the mutant */ - Status = NtCreateMutant(&Handle, - (ACCESS_MASK)dwDesiredAccess, - ObjectAttributes, - InitialOwner); - if (NT_SUCCESS(Status)) - { - /* Check if the object already existed */ - if (Status == STATUS_OBJECT_NAME_EXISTS) - { - /* Set distinguished Win32 error code */ - SetLastError(ERROR_ALREADY_EXISTS); - } - else - { - /* Otherwise, set success */ - SetLastError(ERROR_SUCCESS); - } - - /* Return the handle */ - return Handle; - } - else - { - /* Convert the NT Status and fail */ - SetLastErrorByStatus(Status); - return NULL; - } - -} - -/* - * @implemented - */ -HANDLE -WINAPI -CreateMutexA(IN LPSECURITY_ATTRIBUTES lpMutexAttributes OPTIONAL, - IN BOOL bInitialOwner, - IN LPCSTR lpName OPTIONAL) -{ - DWORD dwFlags = 0; - - if (bInitialOwner) - dwFlags |= CREATE_MUTEX_INITIAL_OWNER; - - return CreateMutexExA(lpMutexAttributes, - lpName, - dwFlags, - MUTANT_ALL_ACCESS); -} - -/* - * @implemented - */ -HANDLE -WINAPI -CreateMutexW(IN LPSECURITY_ATTRIBUTES lpMutexAttributes OPTIONAL, - IN BOOL bInitialOwner, - IN LPCWSTR lpName OPTIONAL) -{ - DWORD dwFlags = 0; - - if (bInitialOwner) - dwFlags |= CREATE_MUTEX_INITIAL_OWNER; - - return CreateMutexExW(lpMutexAttributes, - lpName, - dwFlags, - MUTANT_ALL_ACCESS); -} - -/* - * @implemented - */ -HANDLE -WINAPI -OpenMutexA(IN DWORD dwDesiredAccess, - IN BOOL bInheritHandle, - IN LPCSTR lpName) -{ - NTSTATUS Status; - ANSI_STRING AnsiName; - PUNICODE_STRING UnicodeCache; - - /* Check for a name */ - if (lpName) - { - /* Use TEB Cache */ - UnicodeCache = &NtCurrentTeb()->StaticUnicodeString; - - /* Convert to unicode */ - RtlInitAnsiString(&AnsiName, lpName); - Status = RtlAnsiStringToUnicodeString(UnicodeCache, &AnsiName, FALSE); - if (!NT_SUCCESS(Status)) - { - /* Conversion failed */ - SetLastErrorByStatus(Status); - return NULL; - } - } - else - { - /* We need a name */ - SetLastError(ERROR_INVALID_PARAMETER); - return NULL; - } - - /* Call the Unicode API */ - return OpenMutexW(dwDesiredAccess, - bInheritHandle, - (LPCWSTR)UnicodeCache->Buffer); -} - -/* - * @implemented - */ -HANDLE -WINAPI -OpenMutexW(IN DWORD dwDesiredAccess, - IN BOOL bInheritHandle, - IN LPCWSTR lpName) -{ - OBJECT_ATTRIBUTES ObjectAttributes; - UNICODE_STRING ObjectName; - NTSTATUS Status; - HANDLE Handle; - - /* Make sure we got a name */ - if (!lpName) - { - /* Fail without one */ - SetLastErrorByStatus(STATUS_INVALID_PARAMETER); - return NULL; - } - - /* Initialize the object name and attributes */ - RtlInitUnicodeString(&ObjectName, lpName); - InitializeObjectAttributes(&ObjectAttributes, - &ObjectName, - bInheritHandle ? OBJ_INHERIT : 0, - hBaseDir, - NULL); - - /* Open the mutant */ - Status = NtOpenMutant(&Handle, dwDesiredAccess, &ObjectAttributes); - if (!NT_SUCCESS(Status)) - { - /* Convert the status and fail */ - SetLastErrorByStatus(Status); - return NULL; - } - - /* Return the handle */ - return Handle; -} - -/* - * @implemented - */ -BOOL -WINAPI -ReleaseMutex(IN HANDLE hMutex) -{ - NTSTATUS Status; - - /* Release the mutant */ - Status = NtReleaseMutant(hMutex, NULL); - if (NT_SUCCESS(Status)) return TRUE; - - /* If we got here, then we failed */ - SetLastErrorByStatus(Status); - return FALSE; -} - - -/* EOF */ diff --git a/dll/win32/kernel32/synch/sem.c b/dll/win32/kernel32/synch/sem.c deleted file mode 100644 index 6b859311f4f..00000000000 --- a/dll/win32/kernel32/synch/sem.c +++ /dev/null @@ -1,270 +0,0 @@ -/* - * PROJECT: ReactOS Win32 Base API - * LICENSE: GPL - See COPYING in the top level directory - * FILE: dll/win32/kernel32/synch/sem.c - * PURPOSE: Wrappers for the NT Semaphore Implementation - * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org) - */ - -/* INCLUDES *****************************************************************/ - -#include - -#define NDEBUG -#include - -/* FUNCTIONS ****************************************************************/ - -/* - * @implemented - */ -HANDLE -WINAPI -CreateSemaphoreExA(IN LPSECURITY_ATTRIBUTES lpSemaphoreAttributes OPTIONAL, - IN LONG lInitialCount, - IN LONG lMaximumCount, - IN LPCSTR lpName OPTIONAL, - IN DWORD dwFlags, - IN DWORD dwDesiredAccess) -{ - NTSTATUS Status; - ANSI_STRING AnsiName; - PUNICODE_STRING UnicodeCache; - LPCWSTR UnicodeName = NULL; - - /* Check for a name */ - if (lpName) - { - /* Use TEB Cache */ - UnicodeCache = &NtCurrentTeb()->StaticUnicodeString; - - /* Convert to unicode */ - RtlInitAnsiString(&AnsiName, lpName); - Status = RtlAnsiStringToUnicodeString(UnicodeCache, &AnsiName, FALSE); - if (!NT_SUCCESS(Status)) - { - /* Conversion failed */ - SetLastErrorByStatus(Status); - return NULL; - } - - /* Otherwise, save the buffer */ - UnicodeName = (LPCWSTR)UnicodeCache->Buffer; - } - - /* Call the Unicode API */ - return CreateSemaphoreExW(lpSemaphoreAttributes, - lInitialCount, - lMaximumCount, - UnicodeName, - dwFlags, - dwDesiredAccess); -} - -/* - * @implemented - */ -HANDLE -WINAPI -CreateSemaphoreExW(IN LPSECURITY_ATTRIBUTES lpSemaphoreAttributes OPTIONAL, - IN LONG lInitialCount, - IN LONG lMaximumCount, - IN LPCWSTR lpName OPTIONAL, - IN DWORD dwFlags, - IN DWORD dwDesiredAccess) -{ - NTSTATUS Status; - OBJECT_ATTRIBUTES LocalAttributes; - POBJECT_ATTRIBUTES ObjectAttributes; - HANDLE Handle; - UNICODE_STRING ObjectName; - - /* Now check if we got a name */ - if (lpName) RtlInitUnicodeString(&ObjectName, lpName); - - if (dwFlags != 0) - { - SetLastError(ERROR_INVALID_PARAMETER); - return NULL; - } - - /* Now convert the object attributes */ - ObjectAttributes = BasepConvertObjectAttributes(&LocalAttributes, - lpSemaphoreAttributes, - lpName ? &ObjectName : NULL); - - /* Create the semaphore */ - Status = NtCreateSemaphore(&Handle, - (ACCESS_MASK)dwDesiredAccess, - ObjectAttributes, - lInitialCount, - lMaximumCount); - if (NT_SUCCESS(Status)) - { - /* Check if the object already existed */ - if (Status == STATUS_OBJECT_NAME_EXISTS) - { - /* Set distinguished Win32 error code */ - SetLastError(ERROR_ALREADY_EXISTS); - } - else - { - /* Otherwise, set success */ - SetLastError(ERROR_SUCCESS); - } - - /* Return the handle */ - return Handle; - } - else - { - /* Convert the NT Status and fail */ - SetLastErrorByStatus(Status); - return NULL; - } - -} - - -/* - * @implemented - */ -HANDLE -WINAPI -CreateSemaphoreA(IN LPSECURITY_ATTRIBUTES lpSemaphoreAttributes OPTIONAL, - IN LONG lInitialCount, - IN LONG lMaximumCount, - IN LPCSTR lpName OPTIONAL) -{ - return CreateSemaphoreExA(lpSemaphoreAttributes, - lInitialCount, - lMaximumCount, - lpName, - 0, - SEMAPHORE_ALL_ACCESS); -} - -/* - * @implemented - */ -HANDLE -WINAPI -CreateSemaphoreW(IN LPSECURITY_ATTRIBUTES lpSemaphoreAttributes OPTIONAL, - IN LONG lInitialCount, - IN LONG lMaximumCount, - IN LPCWSTR lpName OPTIONAL) -{ - return CreateSemaphoreExW(lpSemaphoreAttributes, - lInitialCount, - lMaximumCount, - lpName, - 0, - SEMAPHORE_ALL_ACCESS); -} - -/* - * @implemented - */ -HANDLE -WINAPI -OpenSemaphoreA(IN DWORD dwDesiredAccess, - IN BOOL bInheritHandle, - IN LPCSTR lpName) -{ - NTSTATUS Status; - ANSI_STRING AnsiName; - PUNICODE_STRING UnicodeCache; - - /* Check for a name */ - if (lpName) - { - /* Use TEB Cache */ - UnicodeCache = &NtCurrentTeb()->StaticUnicodeString; - - /* Convert to unicode */ - RtlInitAnsiString(&AnsiName, lpName); - Status = RtlAnsiStringToUnicodeString(UnicodeCache, &AnsiName, FALSE); - if (!NT_SUCCESS(Status)) - { - /* Conversion failed */ - SetLastErrorByStatus(Status); - return NULL; - } - } - else - { - /* We need a name */ - SetLastError(ERROR_INVALID_PARAMETER); - return NULL; - } - - /* Call the Unicode API */ - return OpenSemaphoreW(dwDesiredAccess, - bInheritHandle, - (LPCWSTR)UnicodeCache->Buffer); -} - -/* - * @implemented - */ -HANDLE -WINAPI -OpenSemaphoreW(IN DWORD dwDesiredAccess, - IN BOOL bInheritHandle, - IN LPCWSTR lpName) -{ - OBJECT_ATTRIBUTES ObjectAttributes; - UNICODE_STRING ObjectName; - NTSTATUS Status; - HANDLE Handle; - - /* Make sure we got a name */ - if (!lpName) - { - /* Fail without one */ - SetLastErrorByStatus(STATUS_INVALID_PARAMETER); - return NULL; - } - - /* Initialize the object name and attributes */ - RtlInitUnicodeString(&ObjectName, lpName); - InitializeObjectAttributes(&ObjectAttributes, - &ObjectName, - bInheritHandle ? OBJ_INHERIT : 0, - hBaseDir, - NULL); - - /* Open the semaphore */ - Status = NtOpenSemaphore(&Handle, dwDesiredAccess, &ObjectAttributes); - if (!NT_SUCCESS(Status)) - { - /* Convert the status and fail */ - SetLastErrorByStatus(Status); - return NULL; - } - - /* Return the handle */ - return Handle; -} - -/* - * @implemented - */ -BOOL -WINAPI -ReleaseSemaphore(IN HANDLE hSemaphore, - IN LONG lReleaseCount, - IN LPLONG lpPreviousCount) -{ - NTSTATUS Status; - - /* Release the semaphore */ - Status = NtReleaseSemaphore(hSemaphore, lReleaseCount, lpPreviousCount); - if (NT_SUCCESS(Status)) return TRUE; - - /* If we got here, then we failed */ - SetLastErrorByStatus(Status); - return FALSE; -} - -/* EOF */ diff --git a/dll/win32/kernel32/synch/timer.c b/dll/win32/kernel32/synch/timer.c deleted file mode 100644 index fd21a1be57f..00000000000 --- a/dll/win32/kernel32/synch/timer.c +++ /dev/null @@ -1,296 +0,0 @@ -/* - * PROJECT: ReactOS Win32 Base API - * LICENSE: GPL - See COPYING in the top level directory - * FILE: dll/win32/kernel32/synch/timer.c - * PURPOSE: Wrappers for the NT Timer Implementation - * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org) - */ - -/* INCLUDES *****************************************************************/ - -#include - -#define NDEBUG -#include - -/* FUNCTIONS ****************************************************************/ - -/* - * @implemented - */ -HANDLE -WINAPI -CreateWaitableTimerExA(IN LPSECURITY_ATTRIBUTES lpTimerAttributes OPTIONAL, - IN LPCSTR lpTimerName OPTIONAL, - IN DWORD dwFlags, - IN DWORD dwDesiredAccess) -{ - NTSTATUS Status; - ANSI_STRING AnsiName; - PUNICODE_STRING UnicodeCache; - LPCWSTR UnicodeName = NULL; - - /* Check for a name */ - if (lpTimerName) - { - /* Use TEB Cache */ - UnicodeCache = &NtCurrentTeb()->StaticUnicodeString; - - /* Convert to unicode */ - RtlInitAnsiString(&AnsiName, lpTimerName); - Status = RtlAnsiStringToUnicodeString(UnicodeCache, &AnsiName, FALSE); - if (!NT_SUCCESS(Status)) - { - /* Conversion failed */ - SetLastErrorByStatus(Status); - return NULL; - } - - /* Otherwise, save the buffer */ - UnicodeName = (LPCWSTR)UnicodeCache->Buffer; - } - - /* Call the Unicode API */ - return CreateWaitableTimerExW(lpTimerAttributes, - UnicodeName, - dwFlags, - dwDesiredAccess); -} - -/* - * @implemented - */ -HANDLE -WINAPI -CreateWaitableTimerExW(IN LPSECURITY_ATTRIBUTES lpTimerAttributes OPTIONAL, - IN LPCWSTR lpTimerName OPTIONAL, - IN DWORD dwFlags, - IN DWORD dwDesiredAccess) -{ - NTSTATUS Status; - OBJECT_ATTRIBUTES LocalAttributes; - POBJECT_ATTRIBUTES ObjectAttributes; - HANDLE Handle; - UNICODE_STRING ObjectName; - TIMER_TYPE TimerType; - - /* Now check if we got a name */ - if (lpTimerName) RtlInitUnicodeString(&ObjectName, lpTimerName); - - if (dwFlags & ~(CREATE_WAITABLE_TIMER_MANUAL_RESET)) - { - SetLastError(ERROR_INVALID_PARAMETER); - return NULL; - } - - TimerType = (dwFlags & CREATE_WAITABLE_TIMER_MANUAL_RESET) ? NotificationTimer : SynchronizationTimer; - - /* Now convert the object attributes */ - ObjectAttributes = BasepConvertObjectAttributes(&LocalAttributes, - lpTimerAttributes, - lpTimerName ? &ObjectName : NULL); - - /* Create the timer */ - Status = NtCreateTimer(&Handle, - (ACCESS_MASK)dwDesiredAccess, - ObjectAttributes, - TimerType); - if (NT_SUCCESS(Status)) - { - /* Check if the object already existed */ - if (Status == STATUS_OBJECT_NAME_EXISTS) - { - /* Set distinguished Win32 error code */ - SetLastError(ERROR_ALREADY_EXISTS); - } - else - { - /* Otherwise, set success */ - SetLastError(ERROR_SUCCESS); - } - - /* Return the handle */ - return Handle; - } - else - { - /* Convert the NT Status and fail */ - SetLastErrorByStatus(Status); - return NULL; - } - -} - -/* - * @implemented - */ -HANDLE -WINAPI -CreateWaitableTimerW(IN LPSECURITY_ATTRIBUTES lpTimerAttributes OPTIONAL, - IN BOOL bManualReset, - IN LPCWSTR lpTimerName OPTIONAL) -{ - DWORD dwFlags = 0; - - if (bManualReset) - dwFlags |= CREATE_WAITABLE_TIMER_MANUAL_RESET; - - return CreateWaitableTimerExW(lpTimerAttributes, - lpTimerName, - dwFlags, - TIMER_ALL_ACCESS); -} - -/* - * @implemented - */ -HANDLE -WINAPI -CreateWaitableTimerA(IN LPSECURITY_ATTRIBUTES lpTimerAttributes OPTIONAL, - IN BOOL bManualReset, - IN LPCSTR lpTimerName OPTIONAL) -{ - DWORD dwFlags = 0; - - if (bManualReset) - dwFlags |= CREATE_WAITABLE_TIMER_MANUAL_RESET; - - return CreateWaitableTimerExA(lpTimerAttributes, - lpTimerName, - dwFlags, - TIMER_ALL_ACCESS); -} - -/* - * @implemented - */ -HANDLE -WINAPI -OpenWaitableTimerW(IN DWORD dwDesiredAccess, - IN BOOL bInheritHandle, - IN LPCWSTR lpTimerName) -{ - OBJECT_ATTRIBUTES ObjectAttributes; - UNICODE_STRING ObjectName; - NTSTATUS Status; - HANDLE Handle; - - /* Make sure we got a name */ - if (!lpTimerName) - { - /* Fail without one */ - SetLastErrorByStatus(STATUS_INVALID_PARAMETER); - return NULL; - } - - /* Initialize the object name and attributes */ - RtlInitUnicodeString(&ObjectName, lpTimerName); - InitializeObjectAttributes(&ObjectAttributes, - &ObjectName, - bInheritHandle ? OBJ_INHERIT : 0, - hBaseDir, - NULL); - - /* Open the timer */ - Status = NtOpenTimer(&Handle, dwDesiredAccess, &ObjectAttributes); - if (!NT_SUCCESS(Status)) - { - /* Convert the status and fail */ - SetLastErrorByStatus(Status); - return NULL; - } - - /* Return the handle */ - return Handle; -} - -/* - * @implemented - */ -HANDLE -WINAPI -OpenWaitableTimerA(IN DWORD dwDesiredAccess, - IN BOOL bInheritHandle, - IN LPCSTR lpTimerName) -{ - NTSTATUS Status; - ANSI_STRING AnsiName; - PUNICODE_STRING UnicodeCache; - - /* Check for a name */ - if (lpTimerName) - { - /* Use TEB Cache */ - UnicodeCache = &NtCurrentTeb()->StaticUnicodeString; - - /* Convert to unicode */ - RtlInitAnsiString(&AnsiName, lpTimerName); - Status = RtlAnsiStringToUnicodeString(UnicodeCache, &AnsiName, FALSE); - if (!NT_SUCCESS(Status)) - { - /* Conversion failed */ - SetLastErrorByStatus(Status); - return NULL; - } - } - else - { - /* We need a name */ - SetLastError(ERROR_INVALID_PARAMETER); - return NULL; - } - - /* Call the Unicode API */ - return OpenWaitableTimerW(dwDesiredAccess, - bInheritHandle, - (LPCWSTR)UnicodeCache->Buffer); -} - -/* - * @implemented - */ -BOOL -WINAPI -SetWaitableTimer(IN HANDLE hTimer, - IN const LARGE_INTEGER *pDueTime, - IN LONG lPeriod, - IN PTIMERAPCROUTINE pfnCompletionRoutine OPTIONAL, - IN OPTIONAL LPVOID lpArgToCompletionRoutine, - IN BOOL fResume) -{ - NTSTATUS Status; - - /* Set the timer */ - Status = NtSetTimer(hTimer, - (PLARGE_INTEGER)pDueTime, - (PTIMER_APC_ROUTINE)pfnCompletionRoutine, - lpArgToCompletionRoutine, - (BOOLEAN)fResume, - lPeriod, - NULL); - if (NT_SUCCESS(Status)) return TRUE; - - /* If we got here, then we failed */ - SetLastErrorByStatus(Status); - return FALSE; -} - -/* - * @implemented - */ -BOOL -WINAPI -CancelWaitableTimer(IN HANDLE hTimer) -{ - NTSTATUS Status; - - /* Cancel the timer */ - Status = NtCancelTimer(hTimer, NULL); - if (NT_SUCCESS(Status)) return TRUE; - - /* If we got here, then we failed */ - SetLastErrorByStatus(Status); - return FALSE; -} - -/* EOF */ diff --git a/dll/win32/kernel32/synch/wait.c b/dll/win32/kernel32/synch/wait.c deleted file mode 100644 index a471b83ce51..00000000000 --- a/dll/win32/kernel32/synch/wait.c +++ /dev/null @@ -1,254 +0,0 @@ -/* - * PROJECT: ReactOS Win32 Base API - * LICENSE: GPL - See COPYING in the top level directory - * FILE: dll/win32/kernel32/synch/wait.c - * PURPOSE: Wrappers for the NT Wait Implementation - * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org) - */ - -/* INCLUDES *****************************************************************/ - -#include - -#define NDEBUG -#include - -/* FUNCTIONS *****************************************************************/ - -/* - * @implemented - */ -DWORD -WINAPI -WaitForSingleObject(IN HANDLE hHandle, - IN DWORD dwMilliseconds) -{ - /* Call the extended API */ - return WaitForSingleObjectEx(hHandle, dwMilliseconds, FALSE); -} - -/* - * @implemented - */ -DWORD -WINAPI -WaitForSingleObjectEx(IN HANDLE hHandle, - IN DWORD dwMilliseconds, - IN BOOL bAlertable) -{ - PLARGE_INTEGER TimePtr; - LARGE_INTEGER Time; - NTSTATUS Status; - - /* Get real handle */ - hHandle = TranslateStdHandle(hHandle); - - /* Check for console handle */ - if ((IsConsoleHandle(hHandle)) && (VerifyConsoleIoHandle(hHandle))) - { - /* Get the real wait handle */ - hHandle = GetConsoleInputWaitHandle(); - } - - /* Check if this is an infinite wait */ - if (dwMilliseconds == INFINITE) - { - /* Under NT, this means no timer argument */ - TimePtr = NULL; - } - else - { - /* Otherwise, convert the time to NT Format */ - Time.QuadPart = UInt32x32To64(-10000, dwMilliseconds); - TimePtr = &Time; - } - - /* Start wait loop */ - do - { - /* Do the wait */ - Status = NtWaitForSingleObject(hHandle, (BOOLEAN)bAlertable, TimePtr); - if (!NT_SUCCESS(Status)) - { - /* The wait failed */ - SetLastErrorByStatus (Status); - return WAIT_FAILED; - } - } while ((Status == STATUS_ALERTED) && (bAlertable)); - - /* Return wait status */ - return Status; -} - -/* - * @implemented - */ -DWORD -WINAPI -WaitForMultipleObjects(IN DWORD nCount, - IN CONST HANDLE *lpHandles, - IN BOOL bWaitAll, - IN DWORD dwMilliseconds) -{ - /* Call the extended API */ - return WaitForMultipleObjectsEx(nCount, - lpHandles, - bWaitAll, - dwMilliseconds, - FALSE); -} - -/* - * @implemented - */ -DWORD -WINAPI -WaitForMultipleObjectsEx(IN DWORD nCount, - IN CONST HANDLE *lpHandles, - IN BOOL bWaitAll, - IN DWORD dwMilliseconds, - IN BOOL bAlertable) -{ - PLARGE_INTEGER TimePtr; - LARGE_INTEGER Time; - PHANDLE HandleBuffer; - HANDLE Handle[8]; - DWORD i; - NTSTATUS Status; - - /* Check if we have more handles then we locally optimize */ - if (nCount > 8) - { - /* Allocate a buffer for them */ - HandleBuffer = RtlAllocateHeap(RtlGetProcessHeap(), - 0, - nCount * sizeof(HANDLE)); - if (!HandleBuffer) - { - /* No buffer, fail the wait */ - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - return WAIT_FAILED; - } - } - else - { - /* Otherwise, use our local buffer */ - HandleBuffer = Handle; - } - - /* Copy the handles into our buffer and loop them all */ - RtlCopyMemory(HandleBuffer, (LPVOID)lpHandles, nCount * sizeof(HANDLE)); - for (i = 0; i < nCount; i++) - { - /* Check what kind of handle this is */ - HandleBuffer[i] = TranslateStdHandle(HandleBuffer[i]); - - /* Check for console handle */ - if ((IsConsoleHandle(HandleBuffer[i])) && - (VerifyConsoleIoHandle(HandleBuffer[i]))) - { - /* Get the real wait handle */ - HandleBuffer[i] = GetConsoleInputWaitHandle(); - } - } - - /* Check if this is an infinite wait */ - if (dwMilliseconds == INFINITE) - { - /* Under NT, this means no timer argument */ - TimePtr = NULL; - } - else - { - /* Otherwise, convert the time to NT Format */ - Time.QuadPart = UInt32x32To64(-10000, dwMilliseconds); - TimePtr = &Time; - } - - /* Start wait loop */ - do - { - /* Do the wait */ - Status = NtWaitForMultipleObjects(nCount, - HandleBuffer, - bWaitAll ? WaitAll : WaitAny, - (BOOLEAN)bAlertable, - TimePtr); - if (!NT_SUCCESS(Status)) - { - /* Wait failed */ - SetLastErrorByStatus (Status); - return WAIT_FAILED; - } - } while ((Status == STATUS_ALERTED) && (bAlertable)); - - /* Check if we didn't use our local buffer */ - if (HandleBuffer != Handle) - { - /* Free the allocated one */ - RtlFreeHeap(RtlGetProcessHeap(), 0, HandleBuffer); - } - - /* Return wait status */ - return Status; -} - -/* - * @implemented - */ -DWORD -WINAPI -SignalObjectAndWait(IN HANDLE hObjectToSignal, - IN HANDLE hObjectToWaitOn, - IN DWORD dwMilliseconds, - IN BOOL bAlertable) -{ - PLARGE_INTEGER TimePtr; - LARGE_INTEGER Time; - NTSTATUS Status; - - /* Get real handle */ - hObjectToWaitOn = TranslateStdHandle(hObjectToWaitOn); - - /* Check for console handle */ - if ((IsConsoleHandle(hObjectToWaitOn)) && - (VerifyConsoleIoHandle(hObjectToWaitOn))) - { - /* Get the real wait handle */ - hObjectToWaitOn = GetConsoleInputWaitHandle(); - } - - /* Check if this is an infinite wait */ - if (dwMilliseconds == INFINITE) - { - /* Under NT, this means no timer argument */ - TimePtr = NULL; - } - else - { - /* Otherwise, convert the time to NT Format */ - Time.QuadPart = UInt32x32To64(-10000, dwMilliseconds); - TimePtr = &Time; - } - - /* Start wait loop */ - do - { - /* Do the wait */ - Status = NtSignalAndWaitForSingleObject(hObjectToSignal, - hObjectToWaitOn, - (BOOLEAN)bAlertable, - TimePtr); - if (!NT_SUCCESS(Status)) - { - /* The wait failed */ - SetLastErrorByStatus (Status); - return WAIT_FAILED; - } - } while ((Status == STATUS_ALERTED) && (bAlertable)); - - /* Return wait status */ - return Status; -} - -/* EOF */ diff --git a/dll/win32/kernel32/thread/amd64/fiber.S b/dll/win32/kernel32/thread/amd64/fiber.S deleted file mode 100644 index 09ea635d23c..00000000000 --- a/dll/win32/kernel32/thread/amd64/fiber.S +++ /dev/null @@ -1,19 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * FILE: lib/kernel32/thread/i386/fiber.S - * PURPOSE: Fiber context switch code for the x86 architecture - * PROGRAMMERS: Alex Ionescu (alex@relsoft.net) - * KJK::Hyperion - */ - -#include - - -PUBLIC SwitchToFiber - -SwitchToFiber: - /* FIXME: TODO */ - ret 4 - -END diff --git a/dll/win32/kernel32/thread/fls.c b/dll/win32/kernel32/thread/fls.c deleted file mode 100644 index d5e4e612779..00000000000 --- a/dll/win32/kernel32/thread/fls.c +++ /dev/null @@ -1,122 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * FILE: lib/kernel32/thread/fls.c - * PURPOSE: Fiber local storage functions - * PROGRAMMER: KJK::Hyperion - * - * UPDATE HISTORY: - * 28/05/2003 - created. Stubs only - * - */ - -#include - -#include - -/* - * @unimplemented - */ -DWORD -WINAPI -FlsAlloc(PFLS_CALLBACK_FUNCTION lpCallback) -{ - (void)lpCallback; - - UNIMPLEMENTED; - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FLS_OUT_OF_INDEXES; -} - - -/* - * @unimplemented - */ -BOOL -WINAPI -FlsFree(DWORD dwFlsIndex) -{ - (void)dwFlsIndex; - - UNIMPLEMENTED; - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; -} - - -/* - * @implemented - */ -PVOID -WINAPI -FlsGetValue(DWORD dwFlsIndex) -{ - PVOID *ppFlsSlots; - PVOID pRetVal; - - if(dwFlsIndex >= 128) goto l_InvalidParam; - - ppFlsSlots = NtCurrentTeb()->FlsData; - - if(ppFlsSlots == NULL) goto l_InvalidParam; - - SetLastError(0); - pRetVal = ppFlsSlots[dwFlsIndex + 2]; - - return pRetVal; - -l_InvalidParam: - SetLastError(ERROR_INVALID_PARAMETER); - return NULL; -} - - -/* - * @implemented - */ -BOOL -WINAPI -FlsSetValue(DWORD dwFlsIndex, PVOID lpFlsData) -{ - PVOID *ppFlsSlots; - TEB *pTeb = NtCurrentTeb(); - - if(dwFlsIndex >= 128) goto l_InvalidParam; - - ppFlsSlots = pTeb->FlsData; - - if (ppFlsSlots == NULL) - { - PEB *pPeb = pTeb->ProcessEnvironmentBlock; - - ppFlsSlots = RtlAllocateHeap(pPeb->ProcessHeap, - HEAP_ZERO_MEMORY, - (128 + 2) * sizeof(PVOID)); - if(ppFlsSlots == NULL) goto l_OutOfMemory; - - pTeb->FlsData = ppFlsSlots; - - RtlAcquirePebLock(); - - /* TODO: initialization */ - - RtlReleasePebLock(); - } - - ppFlsSlots[dwFlsIndex + 2] = lpFlsData; - - return TRUE; - -l_OutOfMemory: - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - goto l_Fail; - -l_InvalidParam: - SetLastError(ERROR_INVALID_PARAMETER); - -l_Fail: - return FALSE; -} - -/* EOF */ diff --git a/dll/win32/kernel32/thread/tls.c b/dll/win32/kernel32/thread/tls.c deleted file mode 100644 index be7fa0217b7..00000000000 --- a/dll/win32/kernel32/thread/tls.c +++ /dev/null @@ -1,196 +0,0 @@ -/* $Id$ - * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS system libraries - * FILE: lib/kernel32/thread/tls.c - * PURPOSE: Thread functions - * PROGRAMMER: Ariadne ( ariadne@xs4all.nl) - * Tls functions are modified from WINE - * UPDATE HISTORY: - * Created 01/11/98 - */ - -/* INCLUDES ******************************************************************/ - -#include -#define NDEBUG -#include - -/* FUNCTIONS *****************************************************************/ - -/* - * @implemented - */ -DWORD -WINAPI -TlsAlloc(VOID) -{ - ULONG Index; - - RtlAcquirePebLock(); - - /* Try to get regular TEB slot. */ - Index = RtlFindClearBitsAndSet(NtCurrentPeb()->TlsBitmap, 1, 0); - if (Index == ~0U) - { - /* If it fails, try to find expansion TEB slot. */ - Index = RtlFindClearBitsAndSet(NtCurrentPeb()->TlsExpansionBitmap, 1, 0); - if (Index != ~0U) - { - if (NtCurrentTeb()->TlsExpansionSlots == NULL) - { - NtCurrentTeb()->TlsExpansionSlots = HeapAlloc(GetProcessHeap(), - HEAP_ZERO_MEMORY, - TLS_EXPANSION_SLOTS * - sizeof(PVOID)); - } - - if (NtCurrentTeb()->TlsExpansionSlots == NULL) - { - RtlClearBits(NtCurrentPeb()->TlsExpansionBitmap, Index, 1); - Index = ~0; - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - } - else - { - /* Clear the value. */ - NtCurrentTeb()->TlsExpansionSlots[Index] = 0; - Index += TLS_MINIMUM_AVAILABLE; - } - } - else - { - SetLastError(ERROR_NO_MORE_ITEMS); - } - } - else - { - /* Clear the value. */ - NtCurrentTeb()->TlsSlots[Index] = 0; - } - - RtlReleasePebLock(); - - return Index; -} - -/* - * @implemented - */ -BOOL -WINAPI -TlsFree(DWORD Index) -{ - BOOL BitSet; - - if (Index >= TLS_EXPANSION_SLOTS + TLS_MINIMUM_AVAILABLE) - { - SetLastErrorByStatus(STATUS_INVALID_PARAMETER); - return FALSE; - } - - RtlAcquirePebLock(); - - if (Index >= TLS_MINIMUM_AVAILABLE) - { - BitSet = RtlAreBitsSet(NtCurrentPeb()->TlsExpansionBitmap, - Index - TLS_MINIMUM_AVAILABLE, - 1); - - if (BitSet) - RtlClearBits(NtCurrentPeb()->TlsExpansionBitmap, - Index - TLS_MINIMUM_AVAILABLE, - 1); - } - else - { - BitSet = RtlAreBitsSet(NtCurrentPeb()->TlsBitmap, Index, 1); - if (BitSet) - RtlClearBits(NtCurrentPeb()->TlsBitmap, Index, 1); - } - - if (BitSet) - { - /* Clear the TLS cells (slots) in all threads of the current process. */ - NtSetInformationThread(NtCurrentThread(), - ThreadZeroTlsCell, - &Index, - sizeof(DWORD)); - } - else - { - SetLastError(ERROR_INVALID_PARAMETER); - } - - RtlReleasePebLock(); - - return BitSet; -} - -/* - * @implemented - */ -LPVOID -WINAPI -TlsGetValue(DWORD Index) -{ - if (Index >= TLS_EXPANSION_SLOTS + TLS_MINIMUM_AVAILABLE) - { - SetLastErrorByStatus(STATUS_INVALID_PARAMETER); - return NULL; - } - - SetLastError(NO_ERROR); - - if (Index >= TLS_MINIMUM_AVAILABLE) - { - /* The expansion slots are allocated on demand, so check for it. */ - if (NtCurrentTeb()->TlsExpansionSlots == NULL) - return NULL; - return NtCurrentTeb()->TlsExpansionSlots[Index - TLS_MINIMUM_AVAILABLE]; - } - else - { - return NtCurrentTeb()->TlsSlots[Index]; - } -} - -/* - * @implemented - */ -BOOL -WINAPI -TlsSetValue(DWORD Index, - LPVOID Value) -{ - if (Index >= TLS_EXPANSION_SLOTS + TLS_MINIMUM_AVAILABLE) - { - SetLastErrorByStatus(STATUS_INVALID_PARAMETER); - return FALSE; - } - - if (Index >= TLS_MINIMUM_AVAILABLE) - { - if (NtCurrentTeb()->TlsExpansionSlots == NULL) - { - NtCurrentTeb()->TlsExpansionSlots = HeapAlloc(GetProcessHeap(), - HEAP_ZERO_MEMORY, - TLS_EXPANSION_SLOTS * - sizeof(PVOID)); - - if (NtCurrentTeb()->TlsExpansionSlots == NULL) - { - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - return FALSE; - } - } - - NtCurrentTeb()->TlsExpansionSlots[Index - TLS_MINIMUM_AVAILABLE] = Value; - } - else - { - NtCurrentTeb()->TlsSlots[Index] = Value; - } - - return TRUE; -} diff --git a/dll/win32/kernel32/misc/actctx.c b/dll/win32/kernel32/wine/actctx.c similarity index 100% rename from dll/win32/kernel32/misc/actctx.c rename to dll/win32/kernel32/wine/actctx.c diff --git a/dll/win32/kernel32/wine/comm.c b/dll/win32/kernel32/wine/comm.c new file mode 100644 index 00000000000..5fb76ac948d --- /dev/null +++ b/dll/win32/kernel32/wine/comm.c @@ -0,0 +1,1471 @@ +/* + * DEC 93 Erik Bos + * + * Copyright 1996 Marcus Meissner + * + * 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 "config.h" +//#include "wine/port.h" + +#include +#include +#include + +#define NONAMELESSUNION +#define NONAMELESSSTRUCT +#include "windef.h" +#include "winbase.h" +#include "winerror.h" +#include "winioctl.h" +#include "winternl.h" +//#include "ddk/ntddser.h" + +typedef LARGE_INTEGER PHYSICAL_ADDRESS, *PPHYSICAL_ADDRESS; +#undef SERIAL_LSRMST_ESCAPE +#undef SERIAL_LSRMST_LSR_DATA +#undef SERIAL_LSRMST_LSR_NODATA +#undef SERIAL_LSRMST_MST +#undef SERIAL_IOC_FCR_FIFO_ENABLE +#undef SERIAL_IOC_FCR_RCVR_RESET +#undef SERIAL_IOC_FCR_XMIT_RESET +#undef SERIAL_IOC_FCR_DMA_MODE +#undef SERIAL_IOC_FCR_RES1 +#undef SERIAL_IOC_FCR_RES2 +#undef SERIAL_IOC_FCR_RCVR_TRIGGER_LSB +#undef SERIAL_IOC_FCR_RCVR_TRIGGER_MSB +#undef SERIAL_IOC_MCR_DTR +#undef SERIAL_IOC_MCR_RTS +#undef SERIAL_IOC_MCR_OUT1 +#undef SERIAL_IOC_MCR_OUT2 +#undef SERIAL_IOC_MCR_LOOP +#undef IOCTL_SERIAL_LSRMST_INSERT +#include + +#include "wine/unicode.h" + +#include "wine/debug.h" + +#define HeapAlloc RtlAllocateHeap +#define HeapReAlloc RtlReAllocateHeap +#define HeapFree RtlFreeHeap +WINE_DEFAULT_DEBUG_CHANNEL(comm); + +/*********************************************************************** + * COMM_Parse* (Internal) + * + * The following COMM_Parse* functions are used by the BuildCommDCB + * functions to help parse the various parts of the device control string. + */ +static LPCWSTR COMM_ParseStart(LPCWSTR ptr) +{ + static const WCHAR comW[] = {'C','O','M',0}; + + /* The device control string may optionally start with "COMx" followed + by an optional ':' and spaces. */ + if(!strncmpiW(ptr, comW, 3)) + { + ptr += 3; + + /* Allow any com port above 0 as Win 9x does (NT only allows + values for com ports which are actually present) */ + if(*ptr < '1' || *ptr > '9') + return NULL; + + /* Advance pointer past port number */ + while(*ptr >= '0' && *ptr <= '9') ptr++; + + /* The com port number must be followed by a ':' or ' ' */ + if(*ptr != ':' && *ptr != ' ') + return NULL; + + /* Advance pointer to beginning of next parameter */ + while(*ptr == ' ') ptr++; + if(*ptr == ':') + { + ptr++; + while(*ptr == ' ') ptr++; + } + } + /* The device control string must not start with a space. */ + else if(*ptr == ' ') + return NULL; + + return ptr; +} + +static LPCWSTR COMM_ParseNumber(LPCWSTR ptr, LPDWORD lpnumber) +{ + if(*ptr < '0' || *ptr > '9') return NULL; + *lpnumber = strtoulW(ptr, NULL, 10); + while(*ptr >= '0' && *ptr <= '9') ptr++; + return ptr; +} + +static LPCWSTR COMM_ParseParity(LPCWSTR ptr, LPBYTE lpparity) +{ + /* Contrary to what you might expect, Windows only sets the Parity + member of DCB and not fParity even when parity is specified in the + device control string */ + + switch(toupperW(*ptr++)) + { + case 'E': + *lpparity = EVENPARITY; + break; + case 'M': + *lpparity = MARKPARITY; + break; + case 'N': + *lpparity = NOPARITY; + break; + case 'O': + *lpparity = ODDPARITY; + break; + case 'S': + *lpparity = SPACEPARITY; + break; + default: + return NULL; + } + + return ptr; +} + +static LPCWSTR COMM_ParseByteSize(LPCWSTR ptr, LPBYTE lpbytesize) +{ + DWORD temp; + + if(!(ptr = COMM_ParseNumber(ptr, &temp))) + return NULL; + + if(temp >= 5 && temp <= 8) + { + *lpbytesize = temp; + return ptr; + } + else + return NULL; +} + +static LPCWSTR COMM_ParseStopBits(LPCWSTR ptr, LPBYTE lpstopbits) +{ + DWORD temp; + static const WCHAR stopbits15W[] = {'1','.','5',0}; + + if(!strncmpW(stopbits15W, ptr, 3)) + { + ptr += 3; + *lpstopbits = ONE5STOPBITS; + } + else + { + if(!(ptr = COMM_ParseNumber(ptr, &temp))) + return NULL; + + if(temp == 1) + *lpstopbits = ONESTOPBIT; + else if(temp == 2) + *lpstopbits = TWOSTOPBITS; + else + return NULL; + } + + return ptr; +} + +static LPCWSTR COMM_ParseOnOff(LPCWSTR ptr, LPDWORD lponoff) +{ + static const WCHAR onW[] = {'o','n',0}; + static const WCHAR offW[] = {'o','f','f',0}; + + if(!strncmpiW(onW, ptr, 2)) + { + ptr += 2; + *lponoff = 1; + } + else if(!strncmpiW(offW, ptr, 3)) + { + ptr += 3; + *lponoff = 0; + } + else + return NULL; + + return ptr; +} + +/*********************************************************************** + * COMM_BuildOldCommDCB (Internal) + * + * Build a DCB using the old style settings string eg: "96,n,8,1" + */ +static BOOL COMM_BuildOldCommDCB(LPCWSTR device, LPDCB lpdcb) +{ + WCHAR last = 0; + + if(!(device = COMM_ParseNumber(device, &lpdcb->BaudRate))) + return FALSE; + + switch(lpdcb->BaudRate) + { + case 11: + case 30: + case 60: + lpdcb->BaudRate *= 10; + break; + case 12: + case 24: + case 48: + case 96: + lpdcb->BaudRate *= 100; + break; + case 19: + lpdcb->BaudRate = 19200; + break; + } + + while(*device == ' ') device++; + if(*device++ != ',') return FALSE; + while(*device == ' ') device++; + + if(!(device = COMM_ParseParity(device, &lpdcb->Parity))) + return FALSE; + + while(*device == ' ') device++; + if(*device++ != ',') return FALSE; + while(*device == ' ') device++; + + if(!(device = COMM_ParseByteSize(device, &lpdcb->ByteSize))) + return FALSE; + + while(*device == ' ') device++; + if(*device++ != ',') return FALSE; + while(*device == ' ') device++; + + if(!(device = COMM_ParseStopBits(device, &lpdcb->StopBits))) + return FALSE; + + /* The last parameter for flow control is optional. */ + while(*device == ' ') device++; + if(*device == ',') + { + device++; + while(*device == ' ') device++; + if(*device) last = toupperW(*device++); + while(*device == ' ') device++; + } + + /* Win NT sets the flow control members based on (or lack of) the last + parameter. Win 9x does not set these members. */ + switch(last) + { + case 0: + lpdcb->fInX = FALSE; + lpdcb->fOutX = FALSE; + lpdcb->fOutxCtsFlow = FALSE; + lpdcb->fOutxDsrFlow = FALSE; + lpdcb->fDtrControl = DTR_CONTROL_ENABLE; + lpdcb->fRtsControl = RTS_CONTROL_ENABLE; + break; + case 'X': + lpdcb->fInX = TRUE; + lpdcb->fOutX = TRUE; + lpdcb->fOutxCtsFlow = FALSE; + lpdcb->fOutxDsrFlow = FALSE; + lpdcb->fDtrControl = DTR_CONTROL_ENABLE; + lpdcb->fRtsControl = RTS_CONTROL_ENABLE; + break; + case 'P': + lpdcb->fInX = FALSE; + lpdcb->fOutX = FALSE; + lpdcb->fOutxCtsFlow = TRUE; + lpdcb->fOutxDsrFlow = TRUE; + lpdcb->fDtrControl = DTR_CONTROL_HANDSHAKE; + lpdcb->fRtsControl = RTS_CONTROL_HANDSHAKE; + break; + default: + return FALSE; + } + + /* This should be the end of the string. */ + if(*device) return FALSE; + + return TRUE; +} + +/*********************************************************************** + * COMM_BuildNewCommDCB (Internal) + * + * Build a DCB using the new style settings string. + * eg: "baud=9600 parity=n data=8 stop=1 xon=on to=on" + */ +static BOOL COMM_BuildNewCommDCB(LPCWSTR device, LPDCB lpdcb, LPCOMMTIMEOUTS lptimeouts) +{ + DWORD temp; + BOOL baud = FALSE, stop = FALSE; + static const WCHAR baudW[] = {'b','a','u','d','=',0}; + static const WCHAR parityW[] = {'p','a','r','i','t','y','=',0}; + static const WCHAR dataW[] = {'d','a','t','a','=',0}; + static const WCHAR stopW[] = {'s','t','o','p','=',0}; + static const WCHAR toW[] = {'t','o','=',0}; + static const WCHAR xonW[] = {'x','o','n','=',0}; + static const WCHAR odsrW[] = {'o','d','s','r','=',0}; + static const WCHAR octsW[] = {'o','c','t','s','=',0}; + static const WCHAR dtrW[] = {'d','t','r','=',0}; + static const WCHAR rtsW[] = {'r','t','s','=',0}; + static const WCHAR idsrW[] = {'i','d','s','r','=',0}; + + while(*device) + { + while(*device == ' ') device++; + + if(!strncmpiW(baudW, device, 5)) + { + baud = TRUE; + + if(!(device = COMM_ParseNumber(device + 5, &lpdcb->BaudRate))) + return FALSE; + } + else if(!strncmpiW(parityW, device, 7)) + { + if(!(device = COMM_ParseParity(device + 7, &lpdcb->Parity))) + return FALSE; + } + else if(!strncmpiW(dataW, device, 5)) + { + if(!(device = COMM_ParseByteSize(device + 5, &lpdcb->ByteSize))) + return FALSE; + } + else if(!strncmpiW(stopW, device, 5)) + { + stop = TRUE; + + if(!(device = COMM_ParseStopBits(device + 5, &lpdcb->StopBits))) + return FALSE; + } + else if(!strncmpiW(toW, device, 3)) + { + if(!(device = COMM_ParseOnOff(device + 3, &temp))) + return FALSE; + + lptimeouts->ReadIntervalTimeout = 0; + lptimeouts->ReadTotalTimeoutMultiplier = 0; + lptimeouts->ReadTotalTimeoutConstant = 0; + lptimeouts->WriteTotalTimeoutMultiplier = 0; + lptimeouts->WriteTotalTimeoutConstant = temp ? 60000 : 0; + } + else if(!strncmpiW(xonW, device, 4)) + { + if(!(device = COMM_ParseOnOff(device + 4, &temp))) + return FALSE; + + lpdcb->fOutX = temp; + lpdcb->fInX = temp; + } + else if(!strncmpiW(odsrW, device, 5)) + { + if(!(device = COMM_ParseOnOff(device + 5, &temp))) + return FALSE; + + lpdcb->fOutxDsrFlow = temp; + } + else if(!strncmpiW(octsW, device, 5)) + { + if(!(device = COMM_ParseOnOff(device + 5, &temp))) + return FALSE; + + lpdcb->fOutxCtsFlow = temp; + } + else if(!strncmpiW(dtrW, device, 4)) + { + if(!(device = COMM_ParseOnOff(device + 4, &temp))) + return FALSE; + + lpdcb->fDtrControl = temp; + } + else if(!strncmpiW(rtsW, device, 4)) + { + if(!(device = COMM_ParseOnOff(device + 4, &temp))) + return FALSE; + + lpdcb->fRtsControl = temp; + } + else if(!strncmpiW(idsrW, device, 5)) + { + if(!(device = COMM_ParseOnOff(device + 5, &temp))) + return FALSE; + + /* Win NT sets the fDsrSensitivity member based on the + idsr parameter. Win 9x sets fOutxDsrFlow instead. */ + lpdcb->fDsrSensitivity = temp; + } + else + return FALSE; + + /* After the above parsing, the next character (if not the end of + the string) should be a space */ + if(*device && *device != ' ') + return FALSE; + } + + /* If stop bits were not specified, a default is always supplied. */ + if(!stop) + { + if(baud && lpdcb->BaudRate == 110) + lpdcb->StopBits = TWOSTOPBITS; + else + lpdcb->StopBits = ONESTOPBIT; + } + + return TRUE; +} + +/************************************************************************** + * BuildCommDCBA (KERNEL32.@) + * + * Updates a device control block data structure with values from an + * ascii device control string. The device control string has two forms + * normal and extended, it must be exclusively in one or the other form. + * + * RETURNS + * + * True on success, false on a malformed control string. + */ +BOOL WINAPI BuildCommDCBA( + LPCSTR device, /* [in] The ascii device control string used to update the DCB. */ + LPDCB lpdcb) /* [out] The device control block to be updated. */ +{ + return BuildCommDCBAndTimeoutsA(device,lpdcb,NULL); +} + +/************************************************************************** + * BuildCommDCBAndTimeoutsA (KERNEL32.@) + * + * Updates a device control block data structure with values from an + * ascii device control string. Taking timeout values from a timeouts + * struct if desired by the control string. + * + * RETURNS + * + * True on success, false bad handles etc. + */ +BOOL WINAPI BuildCommDCBAndTimeoutsA( + LPCSTR device, /* [in] The ascii device control string. */ + LPDCB lpdcb, /* [out] The device control block to be updated. */ + LPCOMMTIMEOUTS lptimeouts) /* [in] The COMMTIMEOUTS structure to be updated. */ +{ + BOOL ret = FALSE; + UNICODE_STRING deviceW; + + TRACE("(%s,%p,%p)\n",device,lpdcb,lptimeouts); + if(device) RtlCreateUnicodeStringFromAsciiz(&deviceW,device); + else deviceW.Buffer = NULL; + + if(deviceW.Buffer) ret = BuildCommDCBAndTimeoutsW(deviceW.Buffer,lpdcb,lptimeouts); + + RtlFreeUnicodeString(&deviceW); + return ret; +} + +/************************************************************************** + * BuildCommDCBAndTimeoutsW (KERNEL32.@) + * + * Updates a device control block data structure with values from a + * unicode device control string. Taking timeout values from a timeouts + * struct if desired by the control string. + * + * RETURNS + * + * True on success, false bad handles etc + */ +BOOL WINAPI BuildCommDCBAndTimeoutsW( + LPCWSTR devid, /* [in] The unicode device control string. */ + LPDCB lpdcb, /* [out] The device control block to be updated. */ + LPCOMMTIMEOUTS lptimeouts) /* [in] The COMMTIMEOUTS structure to be updated. */ +{ + DCB dcb; + COMMTIMEOUTS timeouts; + BOOL result; + LPCWSTR ptr = devid; + + TRACE("(%s,%p,%p)\n",debugstr_w(devid),lpdcb,lptimeouts); + + memset(&timeouts, 0, sizeof timeouts); + + /* Set DCBlength. (Windows NT does not do this, but 9x does) */ + lpdcb->DCBlength = sizeof(DCB); + + /* Make a copy of the original data structures to work with since if + if there is an error in the device control string the originals + should not be modified (except possibly DCBlength) */ + dcb = *lpdcb; + if(lptimeouts) timeouts = *lptimeouts; + + ptr = COMM_ParseStart(ptr); + + if(ptr == NULL) + result = FALSE; + else if(strchrW(ptr, ',')) + result = COMM_BuildOldCommDCB(ptr, &dcb); + else + result = COMM_BuildNewCommDCB(ptr, &dcb, &timeouts); + + if(result) + { + *lpdcb = dcb; + if(lptimeouts) *lptimeouts = timeouts; + return TRUE; + } + else + { + WARN("Invalid device control string: %s\n", debugstr_w(devid)); + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } +} + +/************************************************************************** + * BuildCommDCBW (KERNEL32.@) + * + * Updates a device control block structure with values from an + * unicode device control string. The device control string has two forms + * normal and extended, it must be exclusively in one or the other form. + * + * RETURNS + * + * True on success, false on a malformed control string. + */ +BOOL WINAPI BuildCommDCBW( + LPCWSTR devid, /* [in] The unicode device control string. */ + LPDCB lpdcb) /* [out] The device control block to be updated. */ +{ + return BuildCommDCBAndTimeoutsW(devid,lpdcb,NULL); +} + +/***************************************************************************** + * SetCommBreak (KERNEL32.@) + * + * Halts the transmission of characters to a communications device. + * + * PARAMS + * handle [in] The communications device to suspend + * + * RETURNS + * + * True on success, and false if the communications device could not be found, + * the control is not supported. + * + * BUGS + * + * Only TIOCSBRK and TIOCCBRK are supported. + */ +BOOL WINAPI SetCommBreak(HANDLE handle) +{ + DWORD dwBytesReturned; + return DeviceIoControl(handle, IOCTL_SERIAL_SET_BREAK_ON, NULL, 0, NULL, 0, &dwBytesReturned, NULL); +} + +/***************************************************************************** + * ClearCommBreak (KERNEL32.@) + * + * Resumes character transmission from a communication device. + * + * PARAMS + * + * handle [in] The halted communication device whose character transmission is to be resumed + * + * RETURNS + * + * True on success and false if the communications device could not be found. + * + * BUGS + * + * Only TIOCSBRK and TIOCCBRK are supported. + */ +BOOL WINAPI ClearCommBreak(HANDLE handle) +{ + DWORD dwBytesReturned; + return DeviceIoControl(handle, IOCTL_SERIAL_SET_BREAK_OFF, NULL, 0, NULL, 0, &dwBytesReturned, NULL); +} + +/***************************************************************************** + * EscapeCommFunction (KERNEL32.@) + * + * Directs a communication device to perform an extended function. + * + * PARAMS + * + * handle [in] The communication device to perform the extended function + * nFunction [in] The extended function to be performed + * + * RETURNS + * + * True or requested data on successful completion of the command, + * false if the device is not present cannot execute the command + * or the command failed. + */ +BOOL WINAPI EscapeCommFunction(HANDLE handle, DWORD func) +{ + DWORD ioc; + DWORD dwBytesReturned; + + switch (func) + { + case CLRDTR: ioc = IOCTL_SERIAL_CLR_DTR; break; + case CLRRTS: ioc = IOCTL_SERIAL_CLR_RTS; break; + case SETDTR: ioc = IOCTL_SERIAL_SET_DTR; break; + case SETRTS: ioc = IOCTL_SERIAL_SET_RTS; break; + case SETXOFF: ioc = IOCTL_SERIAL_SET_XOFF; break; + case SETXON: ioc = IOCTL_SERIAL_SET_XON; break; + case SETBREAK: ioc = IOCTL_SERIAL_SET_BREAK_ON; break; + case CLRBREAK: ioc = IOCTL_SERIAL_SET_BREAK_OFF; break; + case RESETDEV: ioc = IOCTL_SERIAL_RESET_DEVICE; break; + default: + ERR("Unknown function code (%u)\n", func); + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + return DeviceIoControl(handle, ioc, NULL, 0, NULL, 0, &dwBytesReturned, NULL); +} + +/******************************************************************** + * PurgeComm (KERNEL32.@) + * + * Terminates pending operations and/or discards buffers on a + * communication resource. + * + * PARAMS + * + * handle [in] The communication resource to be purged + * flags [in] Flags for clear pending/buffer on input/output + * + * RETURNS + * + * True on success and false if the communications handle is bad. + */ +BOOL WINAPI PurgeComm(HANDLE handle, DWORD flags) +{ + DWORD dwBytesReturned; + return DeviceIoControl(handle, IOCTL_SERIAL_PURGE, &flags, sizeof(flags), + NULL, 0, &dwBytesReturned, NULL); +} + +/***************************************************************************** + * ClearCommError (KERNEL32.@) + * + * Enables further I/O operations on a communications resource after + * supplying error and current status information. + * + * PARAMS + * + * handle [in] The communication resource with the error + * errors [out] Flags indicating error the resource experienced + * lpStat [out] The status of the communication resource + * RETURNS + * + * True on success, false if the communication resource handle is bad. + */ +BOOL WINAPI ClearCommError(HANDLE handle, LPDWORD errors, LPCOMSTAT lpStat) +{ + SERIAL_STATUS ss; + DWORD dwBytesReturned; + + if (!DeviceIoControl(handle, IOCTL_SERIAL_GET_COMMSTATUS, NULL, 0, + &ss, sizeof(ss), &dwBytesReturned, NULL)) + return FALSE; + + if (errors) + { + *errors = 0; + if (ss.Errors & SERIAL_ERROR_BREAK) *errors |= CE_BREAK; + if (ss.Errors & SERIAL_ERROR_FRAMING) *errors |= CE_FRAME; + if (ss.Errors & SERIAL_ERROR_OVERRUN) *errors |= CE_OVERRUN; + if (ss.Errors & SERIAL_ERROR_QUEUEOVERRUN) *errors |= CE_RXOVER; + if (ss.Errors & SERIAL_ERROR_PARITY) *errors |= CE_RXPARITY; + } + + if (lpStat) + { + memset(lpStat, 0, sizeof(*lpStat)); + + if (ss.HoldReasons & SERIAL_TX_WAITING_FOR_CTS) lpStat->fCtsHold = TRUE; + if (ss.HoldReasons & SERIAL_TX_WAITING_FOR_DSR) lpStat->fDsrHold = TRUE; + if (ss.HoldReasons & SERIAL_TX_WAITING_FOR_DCD) lpStat->fRlsdHold = TRUE; + if (ss.HoldReasons & SERIAL_TX_WAITING_FOR_XON) lpStat->fXoffHold = TRUE; + if (ss.HoldReasons & SERIAL_TX_WAITING_XOFF_SENT) lpStat->fXoffSent = TRUE; + if (ss.EofReceived) lpStat->fEof = TRUE; + if (ss.WaitForImmediate) lpStat->fTxim = TRUE; + lpStat->cbInQue = ss.AmountInInQueue; + lpStat->cbOutQue = ss.AmountInOutQueue; + } + return TRUE; +} + +/***************************************************************************** + * SetupComm (KERNEL32.@) + * + * Called after CreateFile to hint to the communication resource to use + * specified sizes for input and output buffers rather than the default values. + * + * PARAMS + * handle [in] The just created communication resource handle + * insize [in] The suggested size of the communication resources input buffer in bytes + * outsize [in] The suggested size of the communication resources output buffer in bytes + * + * RETURNS + * + * True if successful, false if the communications resource handle is bad. + * + * BUGS + * + * Stub. + */ +BOOL WINAPI SetupComm(HANDLE handle, DWORD insize, DWORD outsize) +{ + SERIAL_QUEUE_SIZE sqs; + DWORD dwBytesReturned; + + sqs.InSize = insize; + sqs.OutSize = outsize; + return DeviceIoControl(handle, IOCTL_SERIAL_SET_QUEUE_SIZE, + &sqs, sizeof(sqs), NULL, 0, &dwBytesReturned, NULL); +} + +/***************************************************************************** + * GetCommMask (KERNEL32.@) + * + * Obtain the events associated with a communication device that will cause + * a call WaitCommEvent to return. + * + * PARAMS + * + * handle [in] The communications device + * evtmask [out] The events which cause WaitCommEvent to return + * + * RETURNS + * + * True on success, fail on bad device handle etc. + */ +BOOL WINAPI GetCommMask(HANDLE handle, LPDWORD evtmask) +{ + DWORD dwBytesReturned; + TRACE("handle %p, mask %p\n", handle, evtmask); + return DeviceIoControl(handle, IOCTL_SERIAL_GET_WAIT_MASK, + NULL, 0, evtmask, sizeof(*evtmask), &dwBytesReturned, NULL); +} + +/***************************************************************************** + * SetCommMask (KERNEL32.@) + * + * There be some things we need to hear about yon there communications device. + * (Set which events associated with a communication device should cause + * a call WaitCommEvent to return.) + * + * PARAMS + * + * handle [in] The communications device + * evtmask [in] The events that are to be monitored + * + * RETURNS + * + * True on success, false on bad handle etc. + */ +BOOL WINAPI SetCommMask(HANDLE handle, DWORD evtmask) +{ + DWORD dwBytesReturned; + TRACE("handle %p, mask %x\n", handle, evtmask); + return DeviceIoControl(handle, IOCTL_SERIAL_SET_WAIT_MASK, + &evtmask, sizeof(evtmask), NULL, 0, &dwBytesReturned, NULL); +} + +static void dump_dcb(const DCB* lpdcb) +{ + TRACE("bytesize=%d baudrate=%d fParity=%d Parity=%d stopbits=%d\n", + lpdcb->ByteSize, lpdcb->BaudRate, lpdcb->fParity, lpdcb->Parity, + (lpdcb->StopBits == ONESTOPBIT) ? 1 : + (lpdcb->StopBits == TWOSTOPBITS) ? 2 : 0); + TRACE("%sIXON %sIXOFF\n", (lpdcb->fOutX) ? "" : "~", (lpdcb->fInX) ? "" : "~"); + TRACE("fOutxCtsFlow=%d fRtsControl=%d\n", lpdcb->fOutxCtsFlow, lpdcb->fRtsControl); + TRACE("fOutxDsrFlow=%d fDtrControl=%d\n", lpdcb->fOutxDsrFlow, lpdcb->fDtrControl); + if (lpdcb->fOutxCtsFlow || lpdcb->fRtsControl == RTS_CONTROL_HANDSHAKE) + TRACE("CRTSCTS\n"); + else + TRACE("~CRTSCTS\n"); +} + +/***************************************************************************** + * SetCommState (KERNEL32.@) + * + * Re-initializes all hardware and control settings of a communications device, + * with values from a device control block without affecting the input and output + * queues. + * + * PARAMS + * + * handle [in] The communications device + * lpdcb [out] The device control block + * + * RETURNS + * + * True on success, false on failure, e.g., if the XonChar is equal to the XoffChar. + */ +BOOL WINAPI SetCommState( HANDLE handle, LPDCB lpdcb) +{ + SERIAL_BAUD_RATE sbr; + SERIAL_LINE_CONTROL slc; + SERIAL_HANDFLOW shf; + SERIAL_CHARS sc; + DWORD dwBytesReturned; + + if (lpdcb == NULL) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + dump_dcb(lpdcb); + + sbr.BaudRate = lpdcb->BaudRate; + + slc.StopBits = lpdcb->StopBits; + slc.Parity = lpdcb->Parity; + slc.WordLength = lpdcb->ByteSize; + + shf.ControlHandShake = 0; + shf.FlowReplace = 0; + if (lpdcb->fOutxCtsFlow) shf.ControlHandShake |= SERIAL_CTS_HANDSHAKE; + if (lpdcb->fOutxDsrFlow) shf.ControlHandShake |= SERIAL_DSR_HANDSHAKE; + switch (lpdcb->fDtrControl) + { + case DTR_CONTROL_DISABLE: break; + case DTR_CONTROL_ENABLE: shf.ControlHandShake |= SERIAL_DTR_CONTROL; break; + case DTR_CONTROL_HANDSHAKE: shf.ControlHandShake |= SERIAL_DTR_HANDSHAKE;break; + default: + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + switch (lpdcb->fRtsControl) + { + case RTS_CONTROL_DISABLE: break; + case RTS_CONTROL_ENABLE: shf.FlowReplace |= SERIAL_RTS_CONTROL; break; + case RTS_CONTROL_HANDSHAKE: shf.FlowReplace |= SERIAL_RTS_HANDSHAKE; break; + case RTS_CONTROL_TOGGLE: shf.FlowReplace |= SERIAL_RTS_CONTROL | + SERIAL_RTS_HANDSHAKE; break; + default: + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + if (lpdcb->fDsrSensitivity) shf.ControlHandShake |= SERIAL_DSR_SENSITIVITY; + if (lpdcb->fAbortOnError) shf.ControlHandShake |= SERIAL_ERROR_ABORT; + + if (lpdcb->fErrorChar) shf.FlowReplace |= SERIAL_ERROR_CHAR; + if (lpdcb->fNull) shf.FlowReplace |= SERIAL_NULL_STRIPPING; + if (lpdcb->fTXContinueOnXoff) shf.FlowReplace |= SERIAL_XOFF_CONTINUE; + if (lpdcb->fOutX) shf.FlowReplace |= SERIAL_AUTO_TRANSMIT; + if (lpdcb->fInX) shf.FlowReplace |= SERIAL_AUTO_RECEIVE; + + shf.XonLimit = lpdcb->XonLim; + shf.XoffLimit = lpdcb->XoffLim; + + sc.EofChar = lpdcb->EofChar; + sc.ErrorChar = lpdcb->ErrorChar; + sc.BreakChar = 0; + sc.EventChar = lpdcb->EvtChar; + sc.XonChar = lpdcb->XonChar; + sc.XoffChar = lpdcb->XoffChar; + + /* note: change DTR/RTS lines after setting the comm attributes, + * so flow control does not interfere. + */ + return (DeviceIoControl(handle, IOCTL_SERIAL_SET_BAUD_RATE, + &sbr, sizeof(sbr), NULL, 0, &dwBytesReturned, NULL) && + DeviceIoControl(handle, IOCTL_SERIAL_SET_LINE_CONTROL, + &slc, sizeof(slc), NULL, 0, &dwBytesReturned, NULL) && + DeviceIoControl(handle, IOCTL_SERIAL_SET_HANDFLOW, + &shf, sizeof(shf), NULL, 0, &dwBytesReturned, NULL) && + DeviceIoControl(handle, IOCTL_SERIAL_SET_CHARS, + &sc, sizeof(sc), NULL, 0, &dwBytesReturned, NULL)); +} + + +/***************************************************************************** + * GetCommState (KERNEL32.@) + * + * Fills in a device control block with information from a communications device. + * + * PARAMS + * handle [in] The communications device + * lpdcb [out] The device control block + * + * RETURNS + * + * True on success, false if the communication device handle is bad etc + * + * BUGS + * + * XonChar and XoffChar are not set. + */ +BOOL WINAPI GetCommState(HANDLE handle, LPDCB lpdcb) +{ + SERIAL_BAUD_RATE sbr; + SERIAL_LINE_CONTROL slc; + SERIAL_HANDFLOW shf; + SERIAL_CHARS sc; + DWORD dwBytesReturned; + + TRACE("handle %p, ptr %p\n", handle, lpdcb); + + if (!lpdcb) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + if (!DeviceIoControl(handle, IOCTL_SERIAL_GET_BAUD_RATE, + NULL, 0, &sbr, sizeof(sbr), &dwBytesReturned, NULL) || + !DeviceIoControl(handle, IOCTL_SERIAL_GET_LINE_CONTROL, + NULL, 0, &slc, sizeof(slc), &dwBytesReturned, NULL) || + !DeviceIoControl(handle, IOCTL_SERIAL_GET_HANDFLOW, + NULL, 0, &shf, sizeof(shf), &dwBytesReturned, NULL) || + !DeviceIoControl(handle, IOCTL_SERIAL_GET_CHARS, + NULL, 0, &sc, sizeof(sc), &dwBytesReturned, NULL)) + return FALSE; + + memset(lpdcb, 0, sizeof(*lpdcb)); + lpdcb->DCBlength = sizeof(*lpdcb); + + /* yes, they seem no never be (re)set on NT */ + lpdcb->fBinary = 1; + lpdcb->fParity = 0; + + lpdcb->BaudRate = sbr.BaudRate; + + lpdcb->StopBits = slc.StopBits; + lpdcb->Parity = slc.Parity; + lpdcb->ByteSize = slc.WordLength; + + if (shf.ControlHandShake & SERIAL_CTS_HANDSHAKE) lpdcb->fOutxCtsFlow = 1; + if (shf.ControlHandShake & SERIAL_DSR_HANDSHAKE) lpdcb->fOutxDsrFlow = 1; + switch (shf.ControlHandShake & (SERIAL_DTR_CONTROL | SERIAL_DTR_HANDSHAKE)) + { + case 0: lpdcb->fDtrControl = DTR_CONTROL_DISABLE; break; + case SERIAL_DTR_CONTROL: lpdcb->fDtrControl = DTR_CONTROL_ENABLE; break; + case SERIAL_DTR_HANDSHAKE: lpdcb->fDtrControl = DTR_CONTROL_HANDSHAKE; break; + } + switch (shf.FlowReplace & (SERIAL_RTS_CONTROL | SERIAL_RTS_HANDSHAKE)) + { + case 0: lpdcb->fRtsControl = RTS_CONTROL_DISABLE; break; + case SERIAL_RTS_CONTROL: lpdcb->fRtsControl = RTS_CONTROL_ENABLE; break; + case SERIAL_RTS_HANDSHAKE: lpdcb->fRtsControl = RTS_CONTROL_HANDSHAKE; break; + case SERIAL_RTS_CONTROL | SERIAL_RTS_HANDSHAKE: + lpdcb->fRtsControl = RTS_CONTROL_TOGGLE; break; + } + if (shf.ControlHandShake & SERIAL_DSR_SENSITIVITY) lpdcb->fDsrSensitivity = 1; + if (shf.ControlHandShake & SERIAL_ERROR_ABORT) lpdcb->fAbortOnError = 1; + if (shf.FlowReplace & SERIAL_ERROR_CHAR) lpdcb->fErrorChar = 1; + if (shf.FlowReplace & SERIAL_NULL_STRIPPING) lpdcb->fNull = 1; + if (shf.FlowReplace & SERIAL_XOFF_CONTINUE) lpdcb->fTXContinueOnXoff = 1; + lpdcb->XonLim = shf.XonLimit; + lpdcb->XoffLim = shf.XoffLimit; + + if (shf.FlowReplace & SERIAL_AUTO_TRANSMIT) lpdcb->fOutX = 1; + if (shf.FlowReplace & SERIAL_AUTO_RECEIVE) lpdcb->fInX = 1; + + lpdcb->EofChar = sc.EofChar; + lpdcb->ErrorChar = sc.ErrorChar; + lpdcb->EvtChar = sc.EventChar; + lpdcb->XonChar = sc.XonChar; + lpdcb->XoffChar = sc.XoffChar; + + TRACE("OK\n"); + dump_dcb(lpdcb); + + return TRUE; +} + +/***************************************************************************** + * TransmitCommChar (KERNEL32.@) + * + * Transmits a single character in front of any pending characters in the + * output buffer. Usually used to send an interrupt character to a host. + * + * PARAMS + * hComm [in] The communication device in need of a command character + * chTransmit [in] The character to transmit + * + * RETURNS + * + * True if the call succeeded, false if the previous command character to the + * same device has not been sent yet the handle is bad etc. + * + */ +BOOL WINAPI TransmitCommChar(HANDLE hComm, CHAR chTransmit) +{ + DWORD dwBytesReturned; + return DeviceIoControl(hComm, IOCTL_SERIAL_IMMEDIATE_CHAR, + &chTransmit, sizeof(chTransmit), NULL, 0, &dwBytesReturned, NULL); +} + + +/***************************************************************************** + * GetCommTimeouts (KERNEL32.@) + * + * Obtains the request timeout values for the communications device. + * + * PARAMS + * hComm [in] The communications device + * lptimeouts [out] The struct of request timeouts + * + * RETURNS + * + * True on success, false if communications device handle is bad + * or the target structure is null. + */ +BOOL WINAPI GetCommTimeouts(HANDLE hComm, LPCOMMTIMEOUTS lptimeouts) +{ + SERIAL_TIMEOUTS st; + DWORD dwBytesReturned; + + TRACE("(%p, %p)\n", hComm, lptimeouts); + if (!lptimeouts) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + if (!DeviceIoControl(hComm, IOCTL_SERIAL_GET_TIMEOUTS, + NULL, 0, &st, sizeof(st), &dwBytesReturned, NULL)) + return FALSE; + lptimeouts->ReadIntervalTimeout = st.ReadIntervalTimeout; + lptimeouts->ReadTotalTimeoutMultiplier = st.ReadTotalTimeoutMultiplier; + lptimeouts->ReadTotalTimeoutConstant = st.ReadTotalTimeoutConstant; + lptimeouts->WriteTotalTimeoutMultiplier = st.WriteTotalTimeoutMultiplier; + lptimeouts->WriteTotalTimeoutConstant = st.WriteTotalTimeoutConstant; + return TRUE; +} + +/***************************************************************************** + * SetCommTimeouts (KERNEL32.@) + * + * Sets the timeouts used when reading and writing data to/from COMM ports. + * + * PARAMS + * hComm [in] handle of COMM device + * lptimeouts [in] pointer to COMMTIMEOUTS structure + * + * ReadIntervalTimeout + * - converted and passes to linux kernel as c_cc[VTIME] + * ReadTotalTimeoutMultiplier, ReadTotalTimeoutConstant + * - used in ReadFile to calculate GetOverlappedResult's timeout + * WriteTotalTimeoutMultiplier, WriteTotalTimeoutConstant + * - used in WriteFile to calculate GetOverlappedResult's timeout + * + * RETURNS + * + * True if the timeouts were set, false otherwise. + */ +BOOL WINAPI SetCommTimeouts(HANDLE hComm, LPCOMMTIMEOUTS lptimeouts) +{ + SERIAL_TIMEOUTS st; + DWORD dwBytesReturned; + + TRACE("(%p, %p)\n", hComm, lptimeouts); + + if (lptimeouts == NULL) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + st.ReadIntervalTimeout = lptimeouts->ReadIntervalTimeout; + st.ReadTotalTimeoutMultiplier = lptimeouts->ReadTotalTimeoutMultiplier; + st.ReadTotalTimeoutConstant = lptimeouts->ReadTotalTimeoutConstant; + st.WriteTotalTimeoutMultiplier = lptimeouts->WriteTotalTimeoutMultiplier; + st.WriteTotalTimeoutConstant = lptimeouts->WriteTotalTimeoutConstant; + + return DeviceIoControl(hComm, IOCTL_SERIAL_SET_TIMEOUTS, + &st, sizeof(st), NULL, 0, &dwBytesReturned, NULL); +} + +/*********************************************************************** + * GetCommModemStatus (KERNEL32.@) + * + * Obtains the four control register bits if supported by the hardware. + * + * PARAMS + * + * hFile [in] The communications device + * lpModemStat [out] The control register bits + * + * RETURNS + * + * True if the communications handle was good and for hardware that + * control register access, false otherwise. + */ +BOOL WINAPI GetCommModemStatus(HANDLE hFile, LPDWORD lpModemStat) +{ + DWORD dwBytesReturned; + return DeviceIoControl(hFile, IOCTL_SERIAL_GET_MODEMSTATUS, + NULL, 0, lpModemStat, sizeof(DWORD), &dwBytesReturned, NULL); +} + +/*********************************************************************** + * WaitCommEvent (KERNEL32.@) + * + * Wait until something interesting happens on a COMM port. + * Interesting things (events) are set by calling SetCommMask before + * this function is called. + * + * RETURNS + * TRUE if successful + * FALSE if failure + * + * The set of detected events will be written to *lpdwEventMask + * ERROR_IO_PENDING will be returned the overlapped structure was passed + * + * BUGS: + * Only supports EV_RXCHAR and EV_TXEMPTY + */ +BOOL WINAPI WaitCommEvent( + HANDLE hFile, /* [in] handle of comm port to wait for */ + LPDWORD lpdwEvents, /* [out] event(s) that were detected */ + LPOVERLAPPED lpOverlapped) /* [in/out] for Asynchronous waiting */ +{ + return DeviceIoControl(hFile, IOCTL_SERIAL_WAIT_ON_MASK, NULL, 0, + lpdwEvents, sizeof(DWORD), NULL, lpOverlapped); +} + +/*********************************************************************** + * GetCommProperties (KERNEL32.@) + * + * This function fills in a structure with the capabilities of the + * communications port driver. + * + * RETURNS + * + * TRUE on success, FALSE on failure + * If successful, the lpCommProp structure be filled in with + * properties of the comm port. + */ +BOOL WINAPI GetCommProperties( + HANDLE hFile, /* [in] handle of the comm port */ + LPCOMMPROP lpCommProp) /* [out] pointer to struct to be filled */ +{ + TRACE("(%p %p)\n",hFile,lpCommProp); + if(!lpCommProp) + return FALSE; + + /* + * These values should be valid for LINUX's serial driver + * FIXME: Perhaps they deserve an #ifdef LINUX + */ + memset(lpCommProp,0,sizeof(COMMPROP)); + lpCommProp->wPacketLength = 1; + lpCommProp->wPacketVersion = 1; + lpCommProp->dwServiceMask = SP_SERIALCOMM; + lpCommProp->dwMaxTxQueue = 4096; + lpCommProp->dwMaxRxQueue = 4096; + lpCommProp->dwMaxBaud = BAUD_115200; + lpCommProp->dwProvSubType = PST_RS232; + lpCommProp->dwProvCapabilities = PCF_DTRDSR | PCF_PARITY_CHECK | PCF_RTSCTS | PCF_TOTALTIMEOUTS; + lpCommProp->dwSettableParams = SP_BAUD | SP_DATABITS | SP_HANDSHAKING | + SP_PARITY | SP_PARITY_CHECK | SP_STOPBITS ; + lpCommProp->dwSettableBaud = BAUD_075 | BAUD_110 | BAUD_134_5 | BAUD_150 | + BAUD_300 | BAUD_600 | BAUD_1200 | BAUD_1800 | BAUD_2400 | BAUD_4800 | + BAUD_9600 | BAUD_19200 | BAUD_38400 | BAUD_57600 | BAUD_115200 ; + lpCommProp->wSettableData = DATABITS_5 | DATABITS_6 | DATABITS_7 | DATABITS_8 ; + lpCommProp->wSettableStopParity = STOPBITS_10 | STOPBITS_15 | STOPBITS_20 | + PARITY_NONE | PARITY_ODD |PARITY_EVEN | PARITY_MARK | PARITY_SPACE; + lpCommProp->dwCurrentTxQueue = lpCommProp->dwMaxTxQueue; + lpCommProp->dwCurrentRxQueue = lpCommProp->dwMaxRxQueue; + + return TRUE; +} + +/*********************************************************************** + * FIXME: + * The functionality of CommConfigDialogA, GetDefaultCommConfig and + * SetDefaultCommConfig is implemented in a DLL (usually SERIALUI.DLL). + * This is dependent on the type of COMM port, but since it is doubtful + * anybody will get around to implementing support for fancy serial + * ports in WINE, this is hardcoded for the time being. The name of + * this DLL should be stored in and read from the system registry in + * the hive HKEY_LOCAL_MACHINE, key + * System\\CurrentControlSet\\Services\\Class\\Ports\\???? + * where ???? is the port number... that is determined by PNP + * The DLL should be loaded when the COMM port is opened, and closed + * when the COMM port is closed. - MJM 20 June 2000 + ***********************************************************************/ +static const WCHAR lpszSerialUI[] = { + 's','e','r','i','a','l','u','i','.','d','l','l',0 }; + + +/*********************************************************************** + * CommConfigDialogA (KERNEL32.@) + * + * Raises a dialog that allows the user to configure a comm port. + * Fills the COMMCONFIG struct with information specified by the user. + * This function should call a similar routine in the COMM driver... + * + * RETURNS + * + * TRUE on success, FALSE on failure + * If successful, the lpCommConfig structure will contain a new + * configuration for the comm port, as specified by the user. + * + * BUGS + * The library with the CommConfigDialog code is never unloaded. + * Perhaps this should be done when the comm port is closed? + */ +BOOL WINAPI CommConfigDialogA( + LPCSTR lpszDevice, /* [in] name of communications device */ + HWND hWnd, /* [in] parent window for the dialog */ + LPCOMMCONFIG lpCommConfig) /* [out] pointer to struct to fill */ +{ + LPWSTR lpDeviceW = NULL; + DWORD len; + BOOL r; + + TRACE("(%s, %p, %p)\n", debugstr_a(lpszDevice), hWnd, lpCommConfig); + + if (lpszDevice) + { + len = MultiByteToWideChar( CP_ACP, 0, lpszDevice, -1, NULL, 0 ); + lpDeviceW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ); + MultiByteToWideChar( CP_ACP, 0, lpszDevice, -1, lpDeviceW, len ); + } + r = CommConfigDialogW(lpDeviceW, hWnd, lpCommConfig); + HeapFree( GetProcessHeap(), 0, lpDeviceW ); + return r; +} + +/*********************************************************************** + * CommConfigDialogW (KERNEL32.@) + * + * See CommConfigDialogA. + */ +BOOL WINAPI CommConfigDialogW( + LPCWSTR lpszDevice, /* [in] name of communications device */ + HWND hWnd, /* [in] parent window for the dialog */ + LPCOMMCONFIG lpCommConfig) /* [out] pointer to struct to fill */ +{ + DWORD (WINAPI *pCommConfigDialog)(LPCWSTR, HWND, LPCOMMCONFIG); + HMODULE hConfigModule; + DWORD res = ERROR_INVALID_PARAMETER; + + TRACE("(%s, %p, %p)\n", debugstr_w(lpszDevice), hWnd, lpCommConfig); + hConfigModule = LoadLibraryW(lpszSerialUI); + + if (hConfigModule) { + pCommConfigDialog = (void *)GetProcAddress(hConfigModule, "drvCommConfigDialogW"); + if (pCommConfigDialog) { + res = pCommConfigDialog(lpszDevice, hWnd, lpCommConfig); + } + FreeLibrary(hConfigModule); + } + + if (res) SetLastError(res); + return (res == ERROR_SUCCESS); +} + +/*********************************************************************** + * GetCommConfig (KERNEL32.@) + * + * Fill in the COMMCONFIG structure for the comm port hFile + * + * RETURNS + * + * TRUE on success, FALSE on failure + * If successful, lpCommConfig contains the comm port configuration. + * + * BUGS + * + */ +BOOL WINAPI GetCommConfig( + HANDLE hFile, /* [in] The communications device. */ + LPCOMMCONFIG lpCommConfig, /* [out] The communications configuration of the device (if it fits). */ + LPDWORD lpdwSize) /* [in/out] Initially the size of the configuration buffer/structure, + afterwards the number of bytes copied to the buffer or + the needed size of the buffer. */ +{ + BOOL r; + + TRACE("(%p, %p, %p) *lpdwSize: %u\n", hFile, lpCommConfig, lpdwSize, lpdwSize ? *lpdwSize : 0 ); + + if(lpCommConfig == NULL) + return FALSE; + r = *lpdwSize < sizeof(COMMCONFIG); /* TRUE if not enough space */ + *lpdwSize = sizeof(COMMCONFIG); + if(r) + return FALSE; + + lpCommConfig->dwSize = sizeof(COMMCONFIG); + lpCommConfig->wVersion = 1; + lpCommConfig->wReserved = 0; + r = GetCommState(hFile,&lpCommConfig->dcb); + lpCommConfig->dwProviderSubType = PST_RS232; + lpCommConfig->dwProviderOffset = 0; + lpCommConfig->dwProviderSize = 0; + + return r; +} + +/*********************************************************************** + * SetCommConfig (KERNEL32.@) + * + * Sets the configuration of the communications device. + * + * RETURNS + * + * True on success, false if the handle was bad is not a communications device. + */ +BOOL WINAPI SetCommConfig( + HANDLE hFile, /* [in] The communications device. */ + LPCOMMCONFIG lpCommConfig, /* [in] The desired configuration. */ + DWORD dwSize) /* [in] size of the lpCommConfig struct */ +{ + TRACE("(%p, %p, %u)\n", hFile, lpCommConfig, dwSize); + return SetCommState(hFile,&lpCommConfig->dcb); +} + +/*********************************************************************** + * SetDefaultCommConfigW (KERNEL32.@) + * + * Initializes the default configuration for a communication device. + * + * PARAMS + * lpszDevice [I] Name of the device targeted for configuration + * lpCommConfig [I] PTR to a buffer with the configuration for the device + * dwSize [I] Number of bytes in the buffer + * + * RETURNS + * Failure: FALSE + * Success: TRUE, and default configuration saved + * + */ +BOOL WINAPI SetDefaultCommConfigW(LPCWSTR lpszDevice, LPCOMMCONFIG lpCommConfig, DWORD dwSize) +{ + BOOL (WINAPI *lpfnSetDefaultCommConfig)(LPCWSTR, LPCOMMCONFIG, DWORD); + HMODULE hConfigModule; + BOOL r = FALSE; + + TRACE("(%s, %p, %u)\n", debugstr_w(lpszDevice), lpCommConfig, dwSize); + + hConfigModule = LoadLibraryW(lpszSerialUI); + if(!hConfigModule) + return r; + + lpfnSetDefaultCommConfig = (void *)GetProcAddress(hConfigModule, "drvSetDefaultCommConfigW"); + if (lpfnSetDefaultCommConfig) + r = lpfnSetDefaultCommConfig(lpszDevice, lpCommConfig, dwSize); + + FreeLibrary(hConfigModule); + + return r; +} + + +/*********************************************************************** + * SetDefaultCommConfigA (KERNEL32.@) + * + * Initializes the default configuration for a communication device. + * + * See SetDefaultCommConfigW. + * + */ +BOOL WINAPI SetDefaultCommConfigA(LPCSTR lpszDevice, LPCOMMCONFIG lpCommConfig, DWORD dwSize) +{ + BOOL r; + LPWSTR lpDeviceW = NULL; + DWORD len; + + TRACE("(%s, %p, %u)\n", debugstr_a(lpszDevice), lpCommConfig, dwSize); + + if (lpszDevice) + { + len = MultiByteToWideChar( CP_ACP, 0, lpszDevice, -1, NULL, 0 ); + lpDeviceW = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) ); + MultiByteToWideChar( CP_ACP, 0, lpszDevice, -1, lpDeviceW, len ); + } + r = SetDefaultCommConfigW(lpDeviceW,lpCommConfig,dwSize); + HeapFree( GetProcessHeap(), 0, lpDeviceW ); + return r; +} + + +/*********************************************************************** + * GetDefaultCommConfigW (KERNEL32.@) + * + * Acquires the default configuration of the specified communication device. (unicode) + * + * RETURNS + * + * True on successful reading of the default configuration, + * if the device is not found or the buffer is too small. + */ +BOOL WINAPI GetDefaultCommConfigW( + LPCWSTR lpszName, /* [in] The unicode name of the device targeted for configuration. */ + LPCOMMCONFIG lpCC, /* [out] The default configuration for the device. */ + LPDWORD lpdwSize) /* [in/out] Initially the size of the default configuration buffer, + afterwards the number of bytes copied to the buffer or + the needed size of the buffer. */ +{ + DWORD (WINAPI *pGetDefaultCommConfig)(LPCWSTR, LPCOMMCONFIG, LPDWORD); + HMODULE hConfigModule; + DWORD res = ERROR_INVALID_PARAMETER; + + TRACE("(%s, %p, %p) *lpdwSize: %u\n", debugstr_w(lpszName), lpCC, lpdwSize, lpdwSize ? *lpdwSize : 0 ); + hConfigModule = LoadLibraryW(lpszSerialUI); + + if (hConfigModule) { + pGetDefaultCommConfig = (void *)GetProcAddress(hConfigModule, "drvGetDefaultCommConfigW"); + if (pGetDefaultCommConfig) { + res = pGetDefaultCommConfig(lpszName, lpCC, lpdwSize); + } + FreeLibrary(hConfigModule); + } + + if (res) SetLastError(res); + return (res == ERROR_SUCCESS); +} + +/************************************************************************** + * GetDefaultCommConfigA (KERNEL32.@) + * + * Acquires the default configuration of the specified communication device. (ascii) + * + * RETURNS + * + * True on successful reading of the default configuration, + * if the device is not found or the buffer is too small. + */ +BOOL WINAPI GetDefaultCommConfigA( + LPCSTR lpszName, /* [in] The ascii name of the device targeted for configuration. */ + LPCOMMCONFIG lpCC, /* [out] The default configuration for the device. */ + LPDWORD lpdwSize) /* [in/out] Initially the size of the default configuration buffer, + afterwards the number of bytes copied to the buffer or + the needed size of the buffer. */ +{ + BOOL ret = FALSE; + UNICODE_STRING lpszNameW; + + TRACE("(%s, %p, %p) *lpdwSize: %u\n", debugstr_a(lpszName), lpCC, lpdwSize, lpdwSize ? *lpdwSize : 0 ); + if(lpszName) RtlCreateUnicodeStringFromAsciiz(&lpszNameW,lpszName); + else lpszNameW.Buffer = NULL; + + ret = GetDefaultCommConfigW(lpszNameW.Buffer,lpCC,lpdwSize); + + RtlFreeUnicodeString(&lpszNameW); + return ret; +} diff --git a/dll/win32/kernel32/misc/lzexpand.c b/dll/win32/kernel32/wine/lzexpand.c similarity index 82% rename from dll/win32/kernel32/misc/lzexpand.c rename to dll/win32/kernel32/wine/lzexpand.c index 863988be92f..3936bd4a814 100644 --- a/dll/win32/kernel32/misc/lzexpand.c +++ b/dll/win32/kernel32/wine/lzexpand.c @@ -33,18 +33,35 @@ * o Check whether the return values are correct * */ - -//#include "config.h" - -#include -#define NDEBUG -#include -#include "lzexpand.h" - +//#include #define HFILE_ERROR ((HFILE)-1) +//#include "config.h" +#include +#include +#include +#include +#include +#ifdef HAVE_UNISTD_H +#include +#endif + +#include "windef.h" +#include "winbase.h" +#include "lzexpand.h" + +#include "wine/unicode.h" +#include "wine/debug.h" +#include "winternl.h" +#define HeapAlloc RtlAllocateHeap +#define HeapReAlloc RtlReAllocateHeap +#define HeapFree RtlFreeHeap +#define _lread(a, b, c) (long)(_hread(a, b, (long)c)) +#define _lwrite(a, b, c) (long)(_hwrite(a, b, (long)c)) +WINE_DEFAULT_DEBUG_CHANNEL(file); + /* The readahead length of the decompressor. Reading single bytes - * using _hread() would be SLOW. + * using _lread() would be SLOW. */ #define GETLEN 2048 @@ -101,7 +118,7 @@ _lzget(struct lzstate *lzs,BYTE *b) { *b = lzs->get[lzs->getcur++]; return 1; } else { - int ret = _hread(lzs->realfd,lzs->get,GETLEN); + int ret = _lread(lzs->realfd,lzs->get,GETLEN); if (ret==HFILE_ERROR) return HFILE_ERROR; if (ret==0) @@ -128,7 +145,7 @@ static INT read_header(HFILE fd,struct lzfileheader *head) /* We can't directly read the lzfileheader struct due to * structure element alignment */ - if (_hread(fd,buf,LZ_HEADER_LEN)magic,buf,LZ_MAGIC_LEN); memcpy(&(head->compressiontype),buf+LZ_MAGIC_LEN,1); @@ -150,7 +167,7 @@ static INT read_header(HFILE fd,struct lzfileheader *head) */ INT WINAPI LZStart(void) { - DPRINT("(void)\n"); + TRACE("(void)\n"); return 1; } @@ -171,9 +188,9 @@ HFILE WINAPI LZInit( HFILE hfSrc ) struct lzfileheader head; struct lzstate *lzs; - int i, ret; + int i, ret; - DPRINT("(%d)\n",hfSrc); + TRACE("(%d)\n",hfSrc); ret=read_header(hfSrc,&head); if (ret<=0) { _llseek(hfSrc,0,SEEK_SET); @@ -181,19 +198,19 @@ HFILE WINAPI LZInit( HFILE hfSrc ) } for (i = 0; i < MAX_LZSTATES; i++) if (!lzstates[i]) break; if (i == MAX_LZSTATES) return LZERROR_GLOBALLOC; - lzstates[i] = lzs = RtlAllocateHeap( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct lzstate) ); + lzstates[i] = lzs = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*lzs) ); if(lzs == NULL) return LZERROR_GLOBALLOC; lzs->realfd = hfSrc; lzs->lastchar = head.lastchar; lzs->reallength = head.reallength; - lzs->get = RtlAllocateHeap( GetProcessHeap(), 0, GETLEN ); + lzs->get = HeapAlloc( GetProcessHeap(), 0, GETLEN ); lzs->getlen = 0; lzs->getcur = 0; if(lzs->get == NULL) { - RtlFreeHeap(GetProcessHeap(), 0, lzs); + HeapFree(GetProcessHeap(), 0, lzs); lzstates[i] = NULL; return LZERROR_GLOBALLOC; } @@ -211,7 +228,7 @@ HFILE WINAPI LZInit( HFILE hfSrc ) */ void WINAPI LZDone(void) { - DPRINT("(void)\n"); + TRACE("(void)\n"); } @@ -234,7 +251,7 @@ INT WINAPI GetExpandedNameA( LPSTR in, LPSTR out ) INT fnislowercased,ret,len; LPSTR s,t; - DPRINT("(%s)\n",in); + TRACE("(%s)\n",in); fd=OpenFile(in,&ofs,OF_READ); if (fd==HFILE_ERROR) return (INT)(INT16)LZERROR_BADINHANDLE; @@ -256,7 +273,7 @@ INT WINAPI GetExpandedNameA( LPSTR in, LPSTR out ) /* now mangle the basename */ if (!*s) { /* FIXME: hmm. shouldn't happen? */ - DPRINT("Specified a directory or what? (%s)\n",in); + WARN("Specified a directory or what? (%s)\n",in); _lclose(fd); return 1; } @@ -299,23 +316,14 @@ INT WINAPI GetExpandedNameA( LPSTR in, LPSTR out ) INT WINAPI GetExpandedNameW( LPWSTR in, LPWSTR out ) { INT ret; - DWORD len; - char *xin, *xout; - len = WideCharToMultiByte( CP_ACP, 0, in, -1, NULL, 0, NULL, NULL ); - xin = RtlAllocateHeap( RtlGetProcessHeap(), 0, len ); - if (xin == NULL) - return LZERROR_BADVALUE; - xout = RtlAllocateHeap( RtlGetProcessHeap(), 0, len+3 ); - if (xout == NULL) - { - RtlFreeHeap( RtlGetProcessHeap(), 0, xin ); - return LZERROR_BADVALUE; - } + DWORD len = WideCharToMultiByte( CP_ACP, 0, in, -1, NULL, 0, NULL, NULL ); + char *xin = HeapAlloc( GetProcessHeap(), 0, len ); + char *xout = HeapAlloc( GetProcessHeap(), 0, len+3 ); WideCharToMultiByte( CP_ACP, 0, in, -1, xin, len, NULL, NULL ); if ((ret = GetExpandedNameA( xin, xout )) > 0) - MultiByteToWideChar( CP_ACP, 0, xout, -1, out, wcslen(in)+4 ); - RtlFreeHeap( RtlGetProcessHeap(), 0, xin ); - RtlFreeHeap( RtlGetProcessHeap(), 0, xout ); + MultiByteToWideChar( CP_ACP, 0, xout, -1, out, strlenW(in)+4 ); + HeapFree( GetProcessHeap(), 0, xin ); + HeapFree( GetProcessHeap(), 0, xout ); return ret; } @@ -330,9 +338,9 @@ INT WINAPI LZRead( HFILE fd, LPSTR vbuf, INT toread ) struct lzstate *lzs; buf=(LPBYTE)vbuf; - DPRINT("(%d,%p,%d)\n",fd,buf,toread); + TRACE("(%d,%p,%d)\n",fd,buf,toread); howmuch=toread; - if (!(lzs = GET_LZ_STATE(fd))) return _hread(fd,buf,toread); + if (!(lzs = GET_LZ_STATE(fd))) return _lread(fd,buf,toread); /* The decompressor itself is in a define, cause we need it twice * in this function. (the decompressed byte will be in b) @@ -419,7 +427,7 @@ LONG WINAPI LZSeek( HFILE fd, LONG off, INT type ) struct lzstate *lzs; LONG newwanted; - DPRINT("(%d,%ld,%d)\n",fd,off,type); + TRACE("(%d,%d,%d)\n",fd,off,type); /* not compressed? just use normal _llseek() */ if (!(lzs = GET_LZ_STATE(fd))) return _llseek(fd,off,type); newwanted = lzs->realwanted; @@ -454,9 +462,9 @@ LONG WINAPI LZCopy( HFILE src, HFILE dest ) { int usedlzinit = 0, ret, wret; LONG len; - HFILE oldsrc = src, srcfd; - FILETIME filetime; - struct lzstate *lzs; + HFILE oldsrc = src, srcfd; + FILETIME filetime; + struct lzstate *lzs; #define BUFLEN 1000 CHAR buf[BUFLEN]; /* we need that weird typedef, for i can't seem to get function pointer @@ -466,7 +474,7 @@ LONG WINAPI LZCopy( HFILE src, HFILE dest ) _readfun xread; - DPRINT("(%d,%d)\n",src,dest); + TRACE("(%d,%d)\n",src,dest); if (!IS_LZ_HANDLE(src)) { src = LZInit(src); if ((INT)src <= 0) return 0; @@ -475,7 +483,7 @@ LONG WINAPI LZCopy( HFILE src, HFILE dest ) /* not compressed? just copy */ if (!IS_LZ_HANDLE(src)) - xread=_lread; + xread=(_readfun)_hread; // ROSHACK else xread=(_readfun)LZRead; len=0; @@ -489,17 +497,17 @@ LONG WINAPI LZCopy( HFILE src, HFILE dest ) return ret; } len += ret; - wret = _hwrite(dest,buf,ret); + wret = _lwrite(dest,buf,ret); if (wret!=ret) return LZERROR_WRITE; } - /* Maintain the timestamp of source file to destination file */ - srcfd = (!(lzs = GET_LZ_STATE(src))) ? src : lzs->realfd; - GetFileTime( LongToHandle(srcfd), NULL, NULL, &filetime ); - SetFileTime( LongToHandle(dest), NULL, NULL, &filetime ); + /* Maintain the timestamp of source file to destination file */ + srcfd = (!(lzs = GET_LZ_STATE(src))) ? src : lzs->realfd; + GetFileTime( LongToHandle(srcfd), NULL, NULL, &filetime ); + SetFileTime( LongToHandle(dest), NULL, NULL, &filetime ); - /* close handle */ + /* close handle */ if (usedlzinit) LZClose(src); return len; @@ -510,7 +518,7 @@ LONG WINAPI LZCopy( HFILE src, HFILE dest ) static LPSTR LZEXPAND_MangleName( LPCSTR fn ) { char *p; - char *mfn = RtlAllocateHeap( GetProcessHeap(), 0, strlen(fn) + 3 ); /* "._" and \0 */ + char *mfn = HeapAlloc( GetProcessHeap(), 0, strlen(fn) + 3 ); /* "._" and \0 */ if(mfn == NULL) return NULL; strcpy( mfn, fn ); if (!(p = strrchr( mfn, '\\' ))) p = mfn; @@ -534,14 +542,14 @@ HFILE WINAPI LZOpenFileA( LPSTR fn, LPOFSTRUCT ofs, WORD mode ) { HFILE fd,cfd; - DPRINT("(%s,%p,%d)\n",fn,ofs,mode); + TRACE("(%s,%p,%d)\n",fn,ofs,mode); /* 0x70 represents all OF_SHARE_* flags, ignore them for the check */ fd=OpenFile(fn,ofs,mode); if (fd==HFILE_ERROR) { LPSTR mfn = LZEXPAND_MangleName(fn); fd = OpenFile(mfn,ofs,mode); - RtlFreeHeap( GetProcessHeap(), 0, mfn ); + HeapFree( GetProcessHeap(), 0, mfn ); } if ((mode&~0x70)!=OF_READ) return fd; @@ -560,10 +568,10 @@ HFILE WINAPI LZOpenFileW( LPWSTR fn, LPOFSTRUCT ofs, WORD mode ) { HFILE ret; DWORD len = WideCharToMultiByte( CP_ACP, 0, fn, -1, NULL, 0, NULL, NULL ); - LPSTR xfn = RtlAllocateHeap( GetProcessHeap(), 0, len ); + LPSTR xfn = HeapAlloc( GetProcessHeap(), 0, len ); WideCharToMultiByte( CP_ACP, 0, fn, -1, xfn, len, NULL, NULL ); ret = LZOpenFileA(xfn,ofs,mode); - RtlFreeHeap( GetProcessHeap(), 0, xfn ); + HeapFree( GetProcessHeap(), 0, xfn ); return ret; } @@ -575,14 +583,41 @@ void WINAPI LZClose( HFILE fd ) { struct lzstate *lzs; - DPRINT("(%d)\n",fd); + TRACE("(%d)\n",fd); if (!(lzs = GET_LZ_STATE(fd))) _lclose(fd); else { - if (lzs->get) RtlFreeHeap( GetProcessHeap(), 0, lzs->get ); + HeapFree( GetProcessHeap(), 0, lzs->get ); CloseHandle( LongToHandle(lzs->realfd) ); lzstates[fd - LZ_MIN_HANDLE] = NULL; - RtlFreeHeap( GetProcessHeap(), 0, lzs ); + HeapFree( GetProcessHeap(), 0, lzs ); } } +/* + * @implemented + */ +VOID +WINAPI +LZCloseFile(IN HFILE FileHandle) +{ + /* One function uses _lclose, the other CloseHandle -- same thing */ + LZClose(FileHandle); +} + +/* + * @unimplemented + */ +ULONG +WINAPI +LZCreateFileW(IN LPCWSTR FileName, + IN DWORD dwDesiredAccess, + IN DWORD dwShareMode, + IN DWORD dwCreationDisposition, + IN LPWSTR lpString1) +{ + WARN(" LZCreateFileW Not implemented!\n"); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return ERROR_CALL_NOT_IMPLEMENTED; +} + diff --git a/dll/win32/kernel32/misc/muldiv.c b/dll/win32/kernel32/wine/muldiv.c similarity index 100% rename from dll/win32/kernel32/misc/muldiv.c rename to dll/win32/kernel32/wine/muldiv.c diff --git a/dll/win32/kernel32/misc/profile.c b/dll/win32/kernel32/wine/profile.c similarity index 77% rename from dll/win32/kernel32/misc/profile.c rename to dll/win32/kernel32/wine/profile.c index 57805aa11dd..7e2981b18d2 100644 --- a/dll/win32/kernel32/misc/profile.c +++ b/dll/win32/kernel32/wine/profile.c @@ -19,10 +19,25 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include +//#include "config.h" +//#include "wine/port.h" -#define NDEBUG -#include +#include +#include + +#include "windef.h" +#include "winbase.h" +#include "winnls.h" +#include "winerror.h" +#include "winternl.h" +#include "wine/unicode.h" +#include "wine/library.h" +#include "wine/debug.h" + +#define HeapAlloc RtlAllocateHeap +#define HeapReAlloc RtlReAllocateHeap +#define HeapFree RtlFreeHeap +WINE_DEFAULT_DEBUG_CHANNEL(profile); static const char bom_utf8[] = {0xEF,0xBB,0xBF}; @@ -77,13 +92,12 @@ static RTL_CRITICAL_SECTION_DEBUG critsect_debug = { 0, 0, &PROFILE_CritSect, { &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList }, - 0, 0, 0, 0, 0 + 0, 0, 0 }; static RTL_CRITICAL_SECTION PROFILE_CritSect = { &critsect_debug, -1, 0, 0, 0, 0 }; static const char hex[16] = "0123456789ABCDEF"; - /*********************************************************************** * PROFILE_CopyEntry * @@ -95,20 +109,19 @@ static void PROFILE_CopyEntry( LPWSTR buffer, LPCWSTR value, int len, { WCHAR quote = '\0'; - if (!buffer) return; + if(!buffer) return; if (strip_quote && ((*value == '\'') || (*value == '\"'))) { - if (value[1] && (value[wcslen(value)-1] == *value)) - quote = *value++; + if (value[1] && (value[strlenW(value)-1] == *value)) quote = *value++; } lstrcpynW( buffer, value, len ); - if (quote && (len >= (int)wcslen(value))) buffer[wcslen(buffer)-1] = '\0'; + if (quote && (len >= lstrlenW(value))) buffer[strlenW(buffer)-1] = '\0'; } /* byte-swaps shorts in-place in a buffer. len is in WCHARs */ -static __inline void PROFILE_ByteSwapShortBuffer(WCHAR * buffer, int len) +static inline void PROFILE_ByteSwapShortBuffer(WCHAR * buffer, int len) { int i; USHORT * shortbuffer = buffer; @@ -117,7 +130,7 @@ static __inline void PROFILE_ByteSwapShortBuffer(WCHAR * buffer, int len) } /* writes any necessary encoding marker to the file */ -static __inline void PROFILE_WriteMarker(HANDLE hFile, ENCODING encoding) +static inline void PROFILE_WriteMarker(HANDLE hFile, ENCODING encoding) { DWORD dwBytesWritten; WCHAR bom; @@ -145,7 +158,7 @@ static void PROFILE_WriteLine( HANDLE hFile, WCHAR * szLine, int len, ENCODING e int write_buffer_len; DWORD dwBytesWritten; - DPRINT("writing: %.*S\n", len, szLine); + TRACE("writing: %s\n", debugstr_wn(szLine, len)); switch (encoding) { @@ -173,7 +186,7 @@ static void PROFILE_WriteLine( HANDLE hFile, WCHAR * szLine, int len, ENCODING e WriteFile(hFile, szLine, len * sizeof(WCHAR), &dwBytesWritten, NULL); break; default: - DPRINT1("encoding type %d not implemented\n", encoding); + FIXME("encoding type %d not implemented\n", encoding); } } @@ -193,12 +206,12 @@ static void PROFILE_Save( HANDLE hFile, const PROFILESECTION *section, ENCODING { int len = 0; - if (section->name[0]) len += wcslen(section->name) + 4; + if (section->name[0]) len += strlenW(section->name) + 4; for (key = section->key; key; key = key->next) { - len += wcslen(key->name) + 2; - if (key->value) len += wcslen(key->value) + 1; + len += strlenW(key->name) + 2; + if (key->value) len += strlenW(key->value) + 1; } buffer = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); @@ -208,8 +221,8 @@ static void PROFILE_Save( HANDLE hFile, const PROFILESECTION *section, ENCODING if (section->name[0]) { *p++ = '['; - wcscpy( p, section->name ); - p += wcslen(p); + strcpyW( p, section->name ); + p += strlenW(p); *p++ = ']'; *p++ = '\r'; *p++ = '\n'; @@ -217,13 +230,13 @@ static void PROFILE_Save( HANDLE hFile, const PROFILESECTION *section, ENCODING for (key = section->key; key; key = key->next) { - wcscpy( p, key->name ); - p += wcslen(p); + strcpyW( p, key->name ); + p += strlenW(p); if (key->value) { *p++ = '='; - wcscpy( p, key->value ); - p += wcslen(p); + strcpyW( p, key->value ); + p += strlenW(p); } *p++ = '\r'; *p++ = '\n'; @@ -258,23 +271,23 @@ static void PROFILE_Free( PROFILESECTION *section ) } /* returns 1 if a character white space else 0 */ -static __inline int PROFILE_isspaceW(WCHAR c) +static inline int PROFILE_isspaceW(WCHAR c) { - /* ^Z (DOS EOF) is a space too (found on CD-ROMs) */ - return isspace(c) || c == 0x1a; + /* ^Z (DOS EOF) is a space too (found on CD-ROMs) */ + return isspaceW(c) || c == 0x1a; } -static __inline ENCODING PROFILE_DetectTextEncoding(const void * buffer, int * len) +static inline ENCODING PROFILE_DetectTextEncoding(const void * buffer, int * len) { - INT flags = IS_TEXT_UNICODE_SIGNATURE | - IS_TEXT_UNICODE_REVERSE_SIGNATURE | - IS_TEXT_UNICODE_ODD_LENGTH; + int flags = IS_TEXT_UNICODE_SIGNATURE | + IS_TEXT_UNICODE_REVERSE_SIGNATURE | + IS_TEXT_UNICODE_ODD_LENGTH; if (*len >= sizeof(bom_utf8) && !memcmp(buffer, bom_utf8, sizeof(bom_utf8))) { *len = sizeof(bom_utf8); return ENCODING_UTF8; } - RtlIsTextUnicode((void *)buffer, *len, &flags); + RtlIsTextUnicode(buffer, *len, &flags); if (flags & IS_TEXT_UNICODE_SIGNATURE) { *len = sizeof(WCHAR); @@ -306,9 +319,9 @@ static PROFILESECTION *PROFILE_Load(HANDLE hFile, ENCODING * pEncoding) PROFILESECTION **next_section; PROFILEKEY *key, *prev_key, **next_key; DWORD dwFileSize; - - DPRINT("%p\n", hFile); - + + TRACE("%p\n", hFile); + dwFileSize = GetFileSize(hFile, NULL); if (dwFileSize == INVALID_FILE_SIZE || dwFileSize == 0) return NULL; @@ -319,7 +332,7 @@ static PROFILESECTION *PROFILE_Load(HANDLE hFile, ENCODING * pEncoding) if (!ReadFile(hFile, buffer_base, dwFileSize, &dwFileSize, NULL)) { HeapFree(GetProcessHeap(), 0, buffer_base); - DPRINT("Error %ld reading file\n", GetLastError()); + WARN("Error %d reading file\n", GetLastError()); return NULL; } len = dwFileSize; @@ -331,7 +344,7 @@ static PROFILESECTION *PROFILE_Load(HANDLE hFile, ENCODING * pEncoding) switch (*pEncoding) { case ENCODING_ANSI: - DPRINT("ANSI encoding\n"); + TRACE("ANSI encoding\n"); len = MultiByteToWideChar(CP_ACP, 0, pBuffer, dwFileSize, NULL, 0); szFile = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); @@ -344,7 +357,7 @@ static PROFILESECTION *PROFILE_Load(HANDLE hFile, ENCODING * pEncoding) szEnd = szFile + len; break; case ENCODING_UTF8: - DPRINT("UTF8 encoding\n"); + TRACE("UTF8 encoding\n"); len = MultiByteToWideChar(CP_UTF8, 0, pBuffer, dwFileSize, NULL, 0); szFile = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); @@ -357,18 +370,18 @@ static PROFILESECTION *PROFILE_Load(HANDLE hFile, ENCODING * pEncoding) szEnd = szFile + len; break; case ENCODING_UTF16LE: - DPRINT("UTF16 Little Endian encoding\n"); + TRACE("UTF16 Little Endian encoding\n"); szFile = pBuffer; szEnd = (WCHAR *)((char *)pBuffer + dwFileSize); break; case ENCODING_UTF16BE: - DPRINT("UTF16 Big Endian encoding\n"); + TRACE("UTF16 Big Endian encoding\n"); szFile = pBuffer; szEnd = (WCHAR *)((char *)pBuffer + dwFileSize); PROFILE_ByteSwapShortBuffer(szFile, dwFileSize / sizeof(WCHAR)); break; default: - DPRINT("encoding type %d not implemented\n", *pEncoding); + FIXME("encoding type %d not implemented\n", *pEncoding); HeapFree(GetProcessHeap(), 0, buffer_base); return NULL; } @@ -411,8 +424,8 @@ static PROFILESECTION *PROFILE_Load(HANDLE hFile, ENCODING * pEncoding) const WCHAR * szSectionEnd; if (!(szSectionEnd = memrchrW( szLineStart, ']', szLineEnd - szLineStart ))) { - DPRINT("Invalid section header at line %d: %.*S\n", - line, (int)(szLineEnd - szLineStart), szLineStart); + WARN("Invalid section header at line %d: %s\n", + line, debugstr_wn(szLineStart, (int)(szLineEnd - szLineStart)) ); } else { @@ -431,7 +444,7 @@ static PROFILESECTION *PROFILE_Load(HANDLE hFile, ENCODING * pEncoding) next_key = §ion->key; prev_key = NULL; - DPRINT("New section: %S\n", section->name); + TRACE("New section: %s\n", debugstr_w(section->name)); continue; } @@ -460,7 +473,6 @@ static PROFILESECTION *PROFILE_Load(HANDLE hFile, ENCODING * pEncoding) { len = (int)(szLineEnd - szValueStart); key->value = HeapAlloc( GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR) ); - if (!key->value) break; memcpy(key->value, szValueStart, len * sizeof(WCHAR)); key->value[len] = '\0'; } @@ -471,8 +483,8 @@ static PROFILESECTION *PROFILE_Load(HANDLE hFile, ENCODING * pEncoding) next_key = &key->next; prev_key = key; - DPRINT("New key: name=%S, value=%S\n", - key->name, key->value ?key->value : L"(none)"); + TRACE("New key: name=%s, value=%s\n", + debugstr_w(key->name), key->value ? debugstr_w(key->value) : "(none)"); } } if (szFile != pBuffer) @@ -491,7 +503,7 @@ static BOOL PROFILE_DeleteSection( PROFILESECTION **section, LPCWSTR name ) { while (*section) { - if ((*section)->name[0] && !_wcsicmp( (*section)->name, name )) + if ((*section)->name[0] && !strcmpiW( (*section)->name, name )) { PROFILESECTION *to_del = *section; *section = to_del->next; @@ -511,16 +523,16 @@ static BOOL PROFILE_DeleteSection( PROFILESECTION **section, LPCWSTR name ) * Delete a key from a profile tree. */ static BOOL PROFILE_DeleteKey( PROFILESECTION **section, - LPCWSTR section_name, LPCWSTR key_name ) + LPCWSTR section_name, LPCWSTR key_name ) { while (*section) { - if ((*section)->name[0] && !_wcsicmp( (*section)->name, section_name )) + if ((*section)->name[0] && !strcmpiW( (*section)->name, section_name )) { PROFILEKEY **key = &(*section)->key; while (*key) { - if (!_wcsicmp( (*key)->name, key_name )) + if (!strcmpiW( (*key)->name, key_name )) { PROFILEKEY *to_del = *key; *key = to_del->next; @@ -547,16 +559,16 @@ static void PROFILE_DeleteAllKeys( LPCWSTR section_name) PROFILESECTION **section= &CurProfile->section; while (*section) { - if ((*section)->name[0] && !_wcsicmp( (*section)->name, section_name )) + if ((*section)->name[0] && !strcmpiW( (*section)->name, section_name )) { PROFILEKEY **key = &(*section)->key; while (*key) { PROFILEKEY *to_del = *key; - *key = to_del->next; + *key = to_del->next; HeapFree( GetProcessHeap(), 0, to_del->value); - HeapFree( GetProcessHeap(), 0, to_del ); - CurProfile->changed =TRUE; + HeapFree( GetProcessHeap(), 0, to_del ); + CurProfile->changed =TRUE; } } section = &(*section)->next; @@ -577,7 +589,7 @@ static PROFILEKEY *PROFILE_Find( PROFILESECTION **section, LPCWSTR section_name, while (PROFILE_isspaceW(*section_name)) section_name++; if (*section_name) - p = section_name + wcslen(section_name) - 1; + p = section_name + strlenW(section_name) - 1; else p = section_name; @@ -586,7 +598,7 @@ static PROFILEKEY *PROFILE_Find( PROFILESECTION **section, LPCWSTR section_name, while (PROFILE_isspaceW(*key_name)) key_name++; if (*key_name) - p = key_name + wcslen(key_name) - 1; + p = key_name + strlenW(key_name) - 1; else p = key_name; @@ -596,7 +608,7 @@ static PROFILEKEY *PROFILE_Find( PROFILESECTION **section, LPCWSTR section_name, while (*section) { if ( ((*section)->name[0]) - && (!(_wcsnicmp( (*section)->name, section_name, seclen ))) + && (!(strncmpiW( (*section)->name, section_name, seclen ))) && (((*section)->name)[seclen] == '\0') ) { PROFILEKEY **key = &(*section)->key; @@ -610,17 +622,16 @@ static PROFILEKEY *PROFILE_Find( PROFILESECTION **section, LPCWSTR section_name, */ if(!create_always) { - if ( (!(_wcsnicmp( (*key)->name, key_name, keylen ))) + if ( (!(strncmpiW( (*key)->name, key_name, keylen ))) && (((*key)->name)[keylen] == '\0') ) return *key; } key = &(*key)->next; } - if (!create) + if (!create) return NULL; + if (!(*key = HeapAlloc( GetProcessHeap(), 0, sizeof(PROFILEKEY) + strlenW(key_name) * sizeof(WCHAR) ))) return NULL; - if (!(*key = HeapAlloc( GetProcessHeap(), 0, sizeof(PROFILEKEY) + wcslen(key_name) * sizeof(WCHAR) ))) - return NULL; - wcscpy( (*key)->name, key_name ); + strcpyW( (*key)->name, key_name ); (*key)->value = NULL; (*key)->next = NULL; return *key; @@ -628,17 +639,17 @@ static PROFILEKEY *PROFILE_Find( PROFILESECTION **section, LPCWSTR section_name, section = &(*section)->next; } if (!create) return NULL; - *section = HeapAlloc( GetProcessHeap(), 0, sizeof(PROFILESECTION) + wcslen(section_name) * sizeof(WCHAR) ); + *section = HeapAlloc( GetProcessHeap(), 0, sizeof(PROFILESECTION) + strlenW(section_name) * sizeof(WCHAR) ); if(*section == NULL) return NULL; - wcscpy( (*section)->name, section_name ); + strcpyW( (*section)->name, section_name ); (*section)->next = NULL; if (!((*section)->key = HeapAlloc( GetProcessHeap(), 0, - sizeof(PROFILEKEY) + wcslen(key_name) * sizeof(WCHAR) ))) + sizeof(PROFILEKEY) + strlenW(key_name) * sizeof(WCHAR) ))) { HeapFree(GetProcessHeap(), 0, *section); return NULL; } - wcscpy( (*section)->key->name, key_name ); + strcpyW( (*section)->key->name, key_name ); (*section)->key->value = NULL; (*section)->key->next = NULL; return (*section)->key; @@ -657,7 +668,7 @@ static BOOL PROFILE_FlushFile(void) if(!CurProfile) { - DPRINT("No current profile!\n"); + WARN("No current profile!\n"); return FALSE; } @@ -668,11 +679,11 @@ static BOOL PROFILE_FlushFile(void) if (hFile == INVALID_HANDLE_VALUE) { - DPRINT("could not save profile file %S (error was %ld)\n", CurProfile->filename, GetLastError()); + WARN("could not save profile file %s (error was %d)\n", debugstr_w(CurProfile->filename), GetLastError()); return FALSE; } - DPRINT("Saving %S\n", CurProfile->filename); + TRACE("Saving %s\n", debugstr_w(CurProfile->filename)); PROFILE_Save( hFile, CurProfile->section, CurProfile->encoding ); if(GetFileTime(hFile, NULL, NULL, &LastWriteTime)) CurProfile->LastWriteTime=LastWriteTime; @@ -715,7 +726,7 @@ static BOOL is_not_current(FILETIME * ft) GetSystemTimeAsFileTime(&Now); ftll = ((LONGLONG)ft->dwHighDateTime << 32) + ft->dwLowDateTime; nowll = ((LONGLONG)Now.dwHighDateTime << 32) + Now.dwLowDateTime; - DPRINT("%08x;%08x\n",(unsigned)ftll+21000000,(unsigned)nowll); + TRACE("%08x;%08x\n",(unsigned)ftll+21000000,(unsigned)nowll); return ftll + 21000000 < nowll; } @@ -726,13 +737,12 @@ static BOOL is_not_current(FILETIME * ft) */ static BOOL PROFILE_Open( LPCWSTR filename, BOOL write_access ) { - WCHAR windirW[MAX_PATH]; WCHAR buffer[MAX_PATH]; HANDLE hFile = INVALID_HANDLE_VALUE; FILETIME LastWriteTime; int i,j; PROFILE *tempProfile; - + ZeroMemory(&LastWriteTime, sizeof(LastWriteTime)); /* First time around */ @@ -749,26 +759,26 @@ static BOOL PROFILE_Open( LPCWSTR filename, BOOL write_access ) ZeroMemory(&MRUProfile[i]->LastWriteTime, sizeof(FILETIME)); } - GetWindowsDirectoryW( windirW, MAX_PATH ); - if (!filename) - filename = wininiW; + filename = wininiW; - if ((RtlDetermineDosPathNameType_U(filename) == RtlPathTypeRelative) && - !wcschr(filename, '\\') && !wcschr(filename, '/')) + if ((RtlDetermineDosPathNameType_U(filename) == RELATIVE_PATH) && + !strchrW(filename, '\\') && !strchrW(filename, '/')) { static const WCHAR wszSeparator[] = {'\\', 0}; - wcscpy(buffer, windirW); - wcscat(buffer, wszSeparator); - wcscat(buffer, filename); + WCHAR windirW[MAX_PATH]; + GetWindowsDirectoryW( windirW, MAX_PATH ); + strcpyW(buffer, windirW); + strcatW(buffer, wszSeparator); + strcatW(buffer, filename); } else { LPWSTR dummy; GetFullPathNameW(filename, sizeof(buffer)/sizeof(buffer[0]), buffer, &dummy); } - - DPRINT("path: %S\n", buffer); + + TRACE("path: %s\n", debugstr_w(buffer)); hFile = CreateFileW(buffer, GENERIC_READ | (write_access ? GENERIC_WRITE : 0), FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL, @@ -776,65 +786,63 @@ static BOOL PROFILE_Open( LPCWSTR filename, BOOL write_access ) if ((hFile == INVALID_HANDLE_VALUE) && (GetLastError() != ERROR_FILE_NOT_FOUND)) { - DPRINT("Error %ld opening file %S\n", GetLastError(), buffer); + WARN("Error %d opening file %s\n", GetLastError(), debugstr_w(buffer)); return FALSE; } - for(i = 0; i < N_CACHED_PROFILES; i++) + for(i=0;ifilename && !wcscmp( buffer, MRUProfile[i]->filename ))) - { - DPRINT("MRU Filename: %S, new filename: %S\n", MRUProfile[i]->filename, buffer); - if(i) - { - PROFILE_FlushFile(); - tempProfile=MRUProfile[i]; - for (j = i; j > 0; j--) - MRUProfile[j] = MRUProfile[j-1]; - CurProfile=tempProfile; - } - if (hFile != INVALID_HANDLE_VALUE) - { - GetFileTime(hFile, NULL, NULL, &LastWriteTime); - if (!memcmp( &CurProfile->LastWriteTime, &LastWriteTime, sizeof(FILETIME) ) && - is_not_current(&LastWriteTime)) - DPRINT("(%S): already opened (mru=%d)\n", buffer, i); - else - { - DPRINT("(%S): already opened, needs refreshing (mru=%d)\n", buffer, i); - PROFILE_Free(CurProfile->section); - CurProfile->section = PROFILE_Load(hFile, &CurProfile->encoding); - CurProfile->LastWriteTime = LastWriteTime; - } - CloseHandle(hFile); - } - else DPRINT("(%S): already opened (mru = %d)\n", buffer, i ); + if ((MRUProfile[i]->filename && !strcmpiW( buffer, MRUProfile[i]->filename ))) + { + TRACE("MRU Filename: %s, new filename: %s\n", debugstr_w(MRUProfile[i]->filename), debugstr_w(buffer)); + if(i) + { + PROFILE_FlushFile(); + tempProfile=MRUProfile[i]; + for(j=i;j>0;j--) + MRUProfile[j]=MRUProfile[j-1]; + CurProfile=tempProfile; + } - return TRUE; - } + if (hFile != INVALID_HANDLE_VALUE) + { + GetFileTime(hFile, NULL, NULL, &LastWriteTime); + if (!memcmp( &CurProfile->LastWriteTime, &LastWriteTime, sizeof(FILETIME) ) && + is_not_current(&LastWriteTime)) + TRACE("(%s): already opened (mru=%d)\n", + debugstr_w(buffer), i); + else + { + TRACE("(%s): already opened, needs refreshing (mru=%d)\n", + debugstr_w(buffer), i); + PROFILE_Free(CurProfile->section); + CurProfile->section = PROFILE_Load(hFile, &CurProfile->encoding); + CurProfile->LastWriteTime = LastWriteTime; + } + CloseHandle(hFile); + } + else TRACE("(%s): already opened, not yet created (mru=%d)\n", + debugstr_w(buffer), i); + return TRUE; + } } /* Flush the old current profile */ PROFILE_FlushFile(); /* Make the oldest profile the current one only in order to get rid of it */ - if(i == N_CACHED_PROFILES) + if(i==N_CACHED_PROFILES) { - tempProfile = MRUProfile[N_CACHED_PROFILES-1]; - for (i = N_CACHED_PROFILES - 1; i > 0; i--) - MRUProfile[i] = MRUProfile[i-1]; + tempProfile=MRUProfile[N_CACHED_PROFILES-1]; + for(i=N_CACHED_PROFILES-1;i>0;i--) + MRUProfile[i]=MRUProfile[i-1]; CurProfile=tempProfile; } if(CurProfile->filename) PROFILE_ReleaseFile(); /* OK, now that CurProfile is definitely free we assign it our new file */ - CurProfile->filename = HeapAlloc( GetProcessHeap(), 0, (wcslen(buffer)+1) * sizeof(WCHAR) ); - if(CurProfile->filename == NULL) - { - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - return FALSE; - } - wcscpy( CurProfile->filename, buffer ); + CurProfile->filename = HeapAlloc( GetProcessHeap(), 0, (strlenW(buffer)+1) * sizeof(WCHAR) ); + strcpyW( CurProfile->filename, buffer ); if (hFile != INVALID_HANDLE_VALUE) { @@ -845,7 +853,7 @@ static BOOL PROFILE_Open( LPCWSTR filename, BOOL write_access ) else { /* Does not exist yet, we will create it in PROFILE_FlushFile */ - DPRINT("profile file %S not found\n", buffer); + WARN("profile file %s not found\n", debugstr_w(buffer) ); } return TRUE; } @@ -858,17 +866,17 @@ static BOOL PROFILE_Open( LPCWSTR filename, BOOL write_access ) * If return_values is TRUE, also include the corresponding values. */ static INT PROFILE_GetSection( PROFILESECTION *section, LPCWSTR section_name, - LPWSTR buffer, UINT len, BOOL return_values ) + LPWSTR buffer, DWORD len, BOOL return_values ) { PROFILEKEY *key; if(!buffer) return 0; - DPRINT("%S,%p,%u\n", section_name, buffer, len); + TRACE("%s,%p,%u\n", debugstr_w(section_name), buffer, len); while (section) { - if (section->name[0] && !_wcsicmp( section->name, section_name )) + if (section->name[0] && !strcmpiW( section->name, section_name )) { UINT oldlen = len; for (key = section->key; key; key = key->next) @@ -878,27 +886,26 @@ static INT PROFILE_GetSection( PROFILESECTION *section, LPCWSTR section_name, if (IS_ENTRY_COMMENT(key->name)) continue; /* Skip comments */ if (!return_values && !key->value) continue; /* Skip lines w.o. '=' */ PROFILE_CopyEntry( buffer, key->name, len - 1, 0 ); - len -= wcslen(buffer) + 1; - buffer += wcslen(buffer) + 1; - if (len < 2) - break; - if (return_values && key->value) - { - buffer[-1] = '='; - PROFILE_CopyEntry ( buffer, key->value, len - 1, 0 ); - len -= wcslen(buffer) + 1; - buffer += wcslen(buffer) + 1; + len -= strlenW(buffer) + 1; + buffer += strlenW(buffer) + 1; + if (len < 2) + break; + if (return_values && key->value) { + buffer[-1] = '='; + PROFILE_CopyEntry ( buffer, key->value, len - 1, 0 ); + len -= strlenW(buffer) + 1; + buffer += strlenW(buffer) + 1; } } *buffer = '\0'; if (len <= 1) - { /*If either lpszSection or lpszKey is NULL and the supplied destination buffer is too small to hold all the strings, the last string is truncated and followed by two null characters. In this case, the return value is equal to cchReturnBuffer minus two. */ - buffer[-1] = '\0'; + { + buffer[-1] = '\0'; return oldlen - 2; } return oldlen - len; @@ -910,35 +917,35 @@ static INT PROFILE_GetSection( PROFILESECTION *section, LPCWSTR section_name, } /* See GetPrivateProfileSectionNamesA for documentation */ -static INT PROFILE_GetSectionNames( LPWSTR buffer, UINT len ) +static INT PROFILE_GetSectionNames( LPWSTR buffer, DWORD len ) { LPWSTR buf; UINT buflen,tmplen; PROFILESECTION *section; - DPRINT("(%p, %d)\n", buffer, len); + TRACE("(%p, %d)\n", buffer, len); if (!buffer || !len) return 0; - if (len == 1) { - *buffer = '\0'; + if (len==1) { + *buffer='\0'; return 0; } buflen=len-1; - buf = buffer; + buf=buffer; section = CurProfile->section; while ((section!=NULL)) { if (section->name[0]) { - tmplen = wcslen(section->name)+1; + tmplen = strlenW(section->name)+1; if (tmplen >= buflen) { if (buflen > 0) { - memcpy(buf, section->name, (buflen - 1) * sizeof(WCHAR)); - buf += buflen - 1; - *buf++ = '\0'; + memcpy(buf, section->name, (buflen-1) * sizeof(WCHAR)); + buf += buflen-1; + *buf++='\0'; } *buf='\0'; - return len - 2; + return len-2; } memcpy(buf, section->name, tmplen * sizeof(WCHAR)); buf += tmplen; @@ -946,8 +953,8 @@ static INT PROFILE_GetSectionNames( LPWSTR buffer, UINT len ) } section = section->next; } - *buf = '\0'; - return buf - buffer; + *buf='\0'; + return buf-buffer; } @@ -958,46 +965,45 @@ static INT PROFILE_GetSectionNames( LPWSTR buffer, UINT len ) * * Tests with GetPrivateProfileString16, W95a, * with filled buffer ("****...") and section "set1" and key_name "1" valid: - * section key_name def_val res buffer - * "set1" "1" "x" 43 [data] - * "set1" "1 " "x" 43 [data] (!) - * "set1" " 1 "' "x" 43 [data] (!) - * "set1" "" "x" 1 "x" - * "set1" "" "x " 1 "x" (!) - * "set1" "" " x " 3 " x" (!) - * "set1" NULL "x" 6 "1\02\03\0\0" - * "set1" "" "x" 1 "x" - * NULL "1" "x" 0 "" (!) - * "" "1" "x" 1 "x" - * NULL NULL "" 0 "" + * section key_name def_val res buffer + * "set1" "1" "x" 43 [data] + * "set1" "1 " "x" 43 [data] (!) + * "set1" " 1 "' "x" 43 [data] (!) + * "set1" "" "x" 1 "x" + * "set1" "" "x " 1 "x" (!) + * "set1" "" " x " 3 " x" (!) + * "set1" NULL "x" 6 "1\02\03\0\0" + * "set1" "" "x" 1 "x" + * NULL "1" "x" 0 "" (!) + * "" "1" "x" 1 "x" + * NULL NULL "" 0 "" * * */ static INT PROFILE_GetString( LPCWSTR section, LPCWSTR key_name, - LPCWSTR def_val, LPWSTR buffer, UINT len ) + LPCWSTR def_val, LPWSTR buffer, DWORD len ) { PROFILEKEY *key = NULL; static const WCHAR empty_strW[] = { 0 }; - if (!buffer || !len) return 0; + if(!buffer || !len) return 0; if (!def_val) def_val = empty_strW; if (key_name) { - if (!key_name[0]) + if (!key_name[0]) { PROFILE_CopyEntry(buffer, def_val, len, TRUE); - return wcslen(buffer); + return strlenW(buffer); } key = PROFILE_Find( &CurProfile->section, section, key_name, FALSE, FALSE); PROFILE_CopyEntry( buffer, (key && key->value) ? key->value : def_val, len, TRUE ); - DPRINT("(%S, %S, %S): returning %S\n", - section, key_name, - def_val, buffer); - return wcslen(buffer); + TRACE("(%s,%s,%s): returning %s\n", + debugstr_w(section), debugstr_w(key_name), + debugstr_w(def_val), debugstr_w(buffer) ); + return strlenW( buffer ); } - /* no "else" here ! */ if (section && section[0]) { @@ -1005,7 +1011,7 @@ static INT PROFILE_GetString( LPCWSTR section, LPCWSTR key_name, if (!buffer[0]) /* no luck -> def_val */ { PROFILE_CopyEntry(buffer, def_val, len, TRUE); - ret = wcslen(buffer); + ret = strlenW(buffer); } return ret; } @@ -1024,7 +1030,7 @@ static BOOL PROFILE_SetString( LPCWSTR section_name, LPCWSTR key_name, { if (!key_name) /* Delete a whole section */ { - DPRINT("(%S)\n", section_name); + TRACE("(%s)\n", debugstr_w(section_name)); CurProfile->changed |= PROFILE_DeleteSection( &CurProfile->section, section_name ); return TRUE; /* Even if PROFILE_DeleteSection() has failed, @@ -1032,7 +1038,7 @@ static BOOL PROFILE_SetString( LPCWSTR section_name, LPCWSTR key_name, } else if (!value) /* Delete a key */ { - DPRINT("(%S, %S)\n", section_name, key_name); + TRACE("(%s,%s)\n", debugstr_w(section_name), debugstr_w(key_name) ); CurProfile->changed |= PROFILE_DeleteKey( &CurProfile->section, section_name, key_name ); return TRUE; /* same error handling as above */ @@ -1041,35 +1047,27 @@ static BOOL PROFILE_SetString( LPCWSTR section_name, LPCWSTR key_name, { PROFILEKEY *key = PROFILE_Find(&CurProfile->section, section_name, key_name, TRUE, create_always ); - DPRINT("(%S, %S, %S):\n", - section_name, key_name, value); + TRACE("(%s,%s,%s):\n", + debugstr_w(section_name), debugstr_w(key_name), debugstr_w(value) ); if (!key) return FALSE; /* strip the leading spaces. We can safely strip \n\r and * friends too, they should not happen here anyway. */ - while (PROFILE_isspaceW(*value)) value++; + while (PROFILE_isspaceW(*value)) value++; if (key->value) { - if (!wcscmp( key->value, value )) + if (!strcmpW( key->value, value )) { - DPRINT(" no change needed\n" ); + TRACE(" no change needed\n" ); return TRUE; /* No change needed */ } - DPRINT(" replacing %S\n", key->value); + TRACE(" replacing %s\n", debugstr_w(key->value) ); HeapFree( GetProcessHeap(), 0, key->value ); } - else - { - DPRINT(" creating key\n"); - } - key->value = HeapAlloc( GetProcessHeap(), 0, (wcslen(value) + 1) * sizeof(WCHAR) ); - if(key->value == NULL) - { - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - return FALSE; - } - wcscpy( key->value, value ); + else TRACE(" creating key\n" ); + key->value = HeapAlloc( GetProcessHeap(), 0, (strlenW(value)+1) * sizeof(WCHAR) ); + strcpyW( key->value, value ); CurProfile->changed = TRUE; } return TRUE; @@ -1092,26 +1090,26 @@ UINT WINAPI GetProfileIntA( LPCSTR section, LPCSTR entry, INT def_val ) */ UINT WINAPI GetProfileIntW( LPCWSTR section, LPCWSTR entry, INT def_val ) { - return GetPrivateProfileIntW( section, entry, def_val, L"win.ini" ); + return GetPrivateProfileIntW( section, entry, def_val, wininiW ); } /*********************************************************************** * GetPrivateProfileStringW (KERNEL32.@) */ DWORD WINAPI GetPrivateProfileStringW( LPCWSTR section, LPCWSTR entry, - LPCWSTR def_val, LPWSTR buffer, - DWORD len, LPCWSTR filename ) + LPCWSTR def_val, LPWSTR buffer, + DWORD len, LPCWSTR filename ) { - int ret; - LPWSTR defval_tmp = NULL; + int ret; + LPWSTR defval_tmp = NULL; - DPRINT("%S, %S, %S, %p, %u, %S\n", - section, entry, def_val, buffer, len, filename); + TRACE("%s,%s,%s,%p,%u,%s\n", debugstr_w(section), debugstr_w(entry), + debugstr_w(def_val), buffer, len, debugstr_w(filename)); /* strip any trailing ' ' of def_val. */ if (def_val) { - LPCWSTR p = def_val + wcslen(def_val) - 1; + LPCWSTR p = def_val + strlenW(def_val) - 1; while (p > def_val && *p == ' ') p--; @@ -1121,7 +1119,6 @@ DWORD WINAPI GetPrivateProfileStringW( LPCWSTR section, LPCWSTR entry, int len = (int)(p - def_val) + 1; defval_tmp = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR)); - if (!defval_tmp) return 0; memcpy(defval_tmp, def_val, len * sizeof(WCHAR)); defval_tmp[len] = '\0'; def_val = defval_tmp; @@ -1131,14 +1128,14 @@ DWORD WINAPI GetPrivateProfileStringW( LPCWSTR section, LPCWSTR entry, RtlEnterCriticalSection( &PROFILE_CritSect ); if (PROFILE_Open( filename, FALSE )) { - if (section == NULL) + if (section == NULL) ret = PROFILE_GetSectionNames(buffer, len); - else - /* PROFILE_GetString can handle the 'entry == NULL' case */ + else + /* PROFILE_GetString can handle the 'entry == NULL' case */ ret = PROFILE_GetString( section, entry, def_val, buffer, len ); } else if (buffer && def_val) { lstrcpynW( buffer, def_val, len ); - ret = wcslen( buffer ); + ret = strlenW( buffer ); } else ret = 0; @@ -1147,7 +1144,7 @@ DWORD WINAPI GetPrivateProfileStringW( LPCWSTR section, LPCWSTR entry, HeapFree(GetProcessHeap(), 0, defval_tmp); - DPRINT("returning %S, %d\n", buffer, ret); + TRACE("returning %s, %d\n", debugstr_w(buffer), ret); return ret; } @@ -1156,8 +1153,8 @@ DWORD WINAPI GetPrivateProfileStringW( LPCWSTR section, LPCWSTR entry, * GetPrivateProfileStringA (KERNEL32.@) */ DWORD WINAPI GetPrivateProfileStringA( LPCSTR section, LPCSTR entry, - LPCSTR def_val, LPSTR buffer, - DWORD len, LPCSTR filename ) + LPCSTR def_val, LPSTR buffer, + DWORD len, LPCSTR filename ) { UNICODE_STRING sectionW, entryW, def_valW, filenameW; LPWSTR bufferW; @@ -1176,7 +1173,7 @@ DWORD WINAPI GetPrivateProfileStringA( LPCSTR section, LPCSTR entry, retW = GetPrivateProfileStringW( sectionW.Buffer, entryW.Buffer, def_valW.Buffer, bufferW, len, filenameW.Buffer); - if (len) + if (len && buffer) { if (retW) { @@ -1199,7 +1196,7 @@ DWORD WINAPI GetPrivateProfileStringA( LPCSTR section, LPCSTR entry, * GetProfileStringA (KERNEL32.@) */ DWORD WINAPI GetProfileStringA( LPCSTR section, LPCSTR entry, LPCSTR def_val, - LPSTR buffer, DWORD len ) + LPSTR buffer, DWORD len ) { return GetPrivateProfileStringA( section, entry, def_val, buffer, len, "win.ini" ); @@ -1209,17 +1206,17 @@ DWORD WINAPI GetProfileStringA( LPCSTR section, LPCSTR entry, LPCSTR def_val, * GetProfileStringW (KERNEL32.@) */ DWORD WINAPI GetProfileStringW( LPCWSTR section, LPCWSTR entry, - LPCWSTR def_val, LPWSTR buffer, DWORD len ) + LPCWSTR def_val, LPWSTR buffer, DWORD len ) { return GetPrivateProfileStringW( section, entry, def_val, - buffer, len, L"win.ini" ); + buffer, len, wininiW ); } /*********************************************************************** * WriteProfileStringA (KERNEL32.@) */ BOOL WINAPI WriteProfileStringA( LPCSTR section, LPCSTR entry, - LPCSTR string ) + LPCSTR string ) { return WritePrivateProfileStringA( section, entry, string, "win.ini" ); } @@ -1230,7 +1227,7 @@ BOOL WINAPI WriteProfileStringA( LPCSTR section, LPCSTR entry, BOOL WINAPI WriteProfileStringW( LPCWSTR section, LPCWSTR entry, LPCWSTR string ) { - return WritePrivateProfileStringW( section, entry, string, L"win.ini" ); + return WritePrivateProfileStringW( section, entry, string, wininiW ); } @@ -1268,7 +1265,7 @@ UINT WINAPI GetPrivateProfileIntW( LPCWSTR section, LPCWSTR entry, * FIXME: rewrite using unicode */ UINT WINAPI GetPrivateProfileIntA( LPCSTR section, LPCSTR entry, - INT def_val, LPCSTR filename ) + INT def_val, LPCSTR filename ) { UNICODE_STRING entryW, filenameW, sectionW; UINT res; @@ -1290,7 +1287,7 @@ UINT WINAPI GetPrivateProfileIntA( LPCSTR section, LPCSTR entry, * GetPrivateProfileSectionW (KERNEL32.@) */ DWORD WINAPI GetPrivateProfileSectionW( LPCWSTR section, LPWSTR buffer, - DWORD len, LPCWSTR filename ) + DWORD len, LPCWSTR filename ) { int ret = 0; @@ -1300,7 +1297,7 @@ DWORD WINAPI GetPrivateProfileSectionW( LPCWSTR section, LPWSTR buffer, return 0; } - DPRINT("(%S, %p, %ld, %S)\n", section, buffer, len, filename); + TRACE("(%s, %p, %d, %s)\n", debugstr_w(section), buffer, len, debugstr_w(filename)); RtlEnterCriticalSection( &PROFILE_CritSect ); @@ -1329,12 +1326,6 @@ DWORD WINAPI GetPrivateProfileSectionA( LPCSTR section, LPSTR buffer, } bufferW = HeapAlloc(GetProcessHeap(), 0, len * 2 * sizeof(WCHAR)); - if (!bufferW) - { - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - return 0; - } - RtlCreateUnicodeStringFromAsciiz(§ionW, section); if (filename) RtlCreateUnicodeStringFromAsciiz(&filenameW, filename); else filenameW.Buffer = NULL; @@ -1377,7 +1368,7 @@ DWORD WINAPI GetProfileSectionA( LPCSTR section, LPSTR buffer, DWORD len ) */ DWORD WINAPI GetProfileSectionW( LPCWSTR section, LPWSTR buffer, DWORD len ) { - return GetPrivateProfileSectionW( section, buffer, len, L"win.ini" ); + return GetPrivateProfileSectionW( section, buffer, len, wininiW ); } @@ -1385,7 +1376,7 @@ DWORD WINAPI GetProfileSectionW( LPCWSTR section, LPWSTR buffer, DWORD len ) * WritePrivateProfileStringW (KERNEL32.@) */ BOOL WINAPI WritePrivateProfileStringW( LPCWSTR section, LPCWSTR entry, - LPCWSTR string, LPCWSTR filename ) + LPCWSTR string, LPCWSTR filename ) { BOOL ret = FALSE; @@ -1416,7 +1407,7 @@ BOOL WINAPI WritePrivateProfileStringW( LPCWSTR section, LPCWSTR entry, * WritePrivateProfileStringA (KERNEL32.@) */ BOOL WINAPI WritePrivateProfileStringA( LPCSTR section, LPCSTR entry, - LPCSTR string, LPCSTR filename ) + LPCSTR string, LPCSTR filename ) { UNICODE_STRING sectionW, entryW, stringW, filenameW; BOOL ret; @@ -1459,26 +1450,20 @@ BOOL WINAPI WritePrivateProfileSectionW( LPCWSTR section, } else if (PROFILE_Open( filename, TRUE )) { if (!string) {/* delete the named section*/ - ret = PROFILE_SetString(section,NULL,NULL, FALSE); - PROFILE_FlushFile(); + ret = PROFILE_SetString(section,NULL,NULL, FALSE); + PROFILE_FlushFile(); } else { - PROFILE_DeleteAllKeys(section); - ret = TRUE; + PROFILE_DeleteAllKeys(section); + ret = TRUE; while(*string) { - LPWSTR buf = HeapAlloc( GetProcessHeap(), 0, (wcslen(string)+1) * sizeof(WCHAR) ); - if(buf == NULL) - { - RtlLeaveCriticalSection( &PROFILE_CritSect ); - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - return FALSE; - } - wcscpy( buf, string ); - if((p = wcschr( buf, '='))) { - *p = '\0'; - ret = PROFILE_SetString( section, buf, p + 1, TRUE); + LPWSTR buf = HeapAlloc( GetProcessHeap(), 0, (strlenW(string)+1) * sizeof(WCHAR) ); + strcpyW( buf, string ); + if((p = strchrW( buf, '='))) { + *p='\0'; + ret = PROFILE_SetString( section, buf, p+1, TRUE); } HeapFree( GetProcessHeap(), 0, buf ); - string += wcslen(string) + 1; + string += strlenW(string)+1; } PROFILE_FlushFile(); } @@ -1530,7 +1515,7 @@ BOOL WINAPI WritePrivateProfileSectionA( LPCSTR section, BOOL WINAPI WriteProfileSectionA( LPCSTR section, LPCSTR keys_n_values) { - return WritePrivateProfileSectionA(section, keys_n_values, "win.ini"); + return WritePrivateProfileSectionA( section, keys_n_values, "win.ini"); } /*********************************************************************** @@ -1580,7 +1565,7 @@ BOOL WINAPI WriteProfileSectionW( LPCWSTR section, LPCWSTR keys_n_values) * value between 1 and len-1 (or len in Win95), including len-2. */ DWORD WINAPI GetPrivateProfileSectionNamesW( LPWSTR buffer, DWORD size, - LPCWSTR filename) + LPCWSTR filename) { DWORD ret = 0; @@ -1599,7 +1584,7 @@ DWORD WINAPI GetPrivateProfileSectionNamesW( LPWSTR buffer, DWORD size, * GetPrivateProfileSectionNamesA (KERNEL32.@) */ DWORD WINAPI GetPrivateProfileSectionNamesA( LPSTR buffer, DWORD size, - LPCSTR filename) + LPCSTR filename) { UNICODE_STRING filenameW; LPWSTR bufferW; @@ -1637,71 +1622,67 @@ DWORD WINAPI GetPrivateProfileSectionNamesA( LPSTR buffer, DWORD size, BOOL WINAPI GetPrivateProfileStructW (LPCWSTR section, LPCWSTR key, LPVOID buf, UINT len, LPCWSTR filename) { - BOOL ret = FALSE; + BOOL ret = FALSE; RtlEnterCriticalSection( &PROFILE_CritSect ); - if (PROFILE_Open( filename, FALSE )) - { + if (PROFILE_Open( filename, FALSE )) { PROFILEKEY *k = PROFILE_Find ( &CurProfile->section, section, key, FALSE, FALSE); - if (k) - { - DPRINT("value (at %p): %S\n", k->value, k->value); - if (((wcslen(k->value) - 2) / 2) == len) - { - LPWSTR end, p; - BOOL valid = TRUE; - WCHAR c; - DWORD chksum = 0; + if (k) { + TRACE("value (at %p): %s\n", k->value, debugstr_w(k->value)); + if (((strlenW(k->value) - 2) / 2) == len) + { + LPWSTR end, p; + BOOL valid = TRUE; + WCHAR c; + DWORD chksum = 0; - end = k->value + wcslen(k->value); /* -> '\0' */ - - /* check for invalid chars in ASCII coded hex string */ - for (p = k->value; p < end; p++) - { - if (!isxdigit(*p)) - { - DPRINT("invalid char '%x' in file %S->[%S]->%S !\n", - *p, filename, section, key); - valid = FALSE; - break; - } - } - - if (valid) - { - BOOL highnibble = TRUE; - BYTE b = 0, val; + end = k->value + strlenW(k->value); /* -> '\0' */ + /* check for invalid chars in ASCII coded hex string */ + for (p=k->value; p < end; p++) + { + if (!isxdigitW(*p)) + { + WARN("invalid char '%x' in file %s->[%s]->%s !\n", + *p, debugstr_w(filename), debugstr_w(section), debugstr_w(key)); + valid = FALSE; + break; + } + } + if (valid) + { + BOOL highnibble = TRUE; + BYTE b = 0, val; LPBYTE binbuf = buf; - end -= 2; /* don't include checksum in output data */ - /* translate ASCII hex format into binary data */ - for (p = k->value; p < end; p++) - { - c = towupper(*p); - val = (c > '9') ? (c - 'A' + 10) : (c - '0'); + end -= 2; /* don't include checksum in output data */ + /* translate ASCII hex format into binary data */ + for (p=k->value; p < end; p++) + { + c = toupperW(*p); + val = (c > '9') ? + (c - 'A' + 10) : (c - '0'); - if (highnibble) - b = val << 4; - else - { - b += val; - *binbuf++ = b; /* feed binary data into output */ - chksum += b; /* calculate checksum */ - } - highnibble ^= 1; /* toggle */ - } - - /* retrieve stored checksum value */ - c = towupper(*p++); - b = ( (c > '9') ? (c - 'A' + 10) : (c - '0') ) << 4; - c = towupper(*p); - b += (c > '9') ? (c - 'A' + 10) : (c - '0'); - if (b == (chksum & 0xff)) /* checksums match ? */ + if (highnibble) + b = val << 4; + else + { + b += val; + *binbuf++ = b; /* feed binary data into output */ + chksum += b; /* calculate checksum */ + } + highnibble ^= 1; /* toggle */ + } + /* retrieve stored checksum value */ + c = toupperW(*p++); + b = ( (c > '9') ? (c - 'A' + 10) : (c - '0') ) << 4; + c = toupperW(*p); + b += (c > '9') ? (c - 'A' + 10) : (c - '0'); + if (b == (chksum & 0xff)) /* checksums match ? */ ret = TRUE; } } - } + } } RtlLeaveCriticalSection( &PROFILE_CritSect ); @@ -1712,7 +1693,7 @@ BOOL WINAPI GetPrivateProfileStructW (LPCWSTR section, LPCWSTR key, * GetPrivateProfileStructA (KERNEL32.@) */ BOOL WINAPI GetPrivateProfileStructA (LPCSTR section, LPCSTR key, - LPVOID buffer, UINT len, LPCSTR filename) + LPVOID buffer, UINT len, LPCSTR filename) { UNICODE_STRING sectionW, keyW, filenameW; INT ret; @@ -1752,17 +1733,11 @@ BOOL WINAPI WritePrivateProfileStructW (LPCWSTR section, LPCWSTR key, /* allocate string buffer for hex chars + checksum hex char + '\0' */ outstring = HeapAlloc( GetProcessHeap(), 0, (bufsize*2 + 2 + 1) * sizeof(WCHAR) ); - if(outstring == NULL) - { - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - return FALSE; - } p = outstring; - for (binbuf = (LPBYTE)buf; binbuf < (LPBYTE)buf+bufsize; binbuf++) - { - *p++ = hex[*binbuf >> 4]; - *p++ = hex[*binbuf & 0xf]; - sum += *binbuf; + for (binbuf = (LPBYTE)buf; binbuf < (LPBYTE)buf+bufsize; binbuf++) { + *p++ = hex[*binbuf >> 4]; + *p++ = hex[*binbuf & 0xf]; + sum += *binbuf; } /* checksum is sum & 0xff */ *p++ = hex[(sum & 0xf0) >> 4]; @@ -1771,8 +1746,7 @@ BOOL WINAPI WritePrivateProfileStructW (LPCWSTR section, LPCWSTR key, RtlEnterCriticalSection( &PROFILE_CritSect ); - if (PROFILE_Open( filename, TRUE )) - { + if (PROFILE_Open( filename, TRUE )) { ret = PROFILE_SetString( section, key, outstring, FALSE); PROFILE_FlushFile(); } @@ -1787,9 +1761,8 @@ BOOL WINAPI WritePrivateProfileStructW (LPCWSTR section, LPCWSTR key, /*********************************************************************** * WritePrivateProfileStructA (KERNEL32.@) */ -BOOL WINAPI -WritePrivateProfileStructA (LPCSTR section, LPCSTR key, - LPVOID buf, UINT bufsize, LPCSTR filename) +BOOL WINAPI WritePrivateProfileStructA (LPCSTR section, LPCSTR key, + LPVOID buf, UINT bufsize, LPCSTR filename) { UNICODE_STRING sectionW, keyW, filenameW; INT ret; @@ -1815,9 +1788,8 @@ WritePrivateProfileStructA (LPCSTR section, LPCSTR key, /*********************************************************************** * OpenProfileUserMapping (KERNEL32.@) */ -BOOL WINAPI OpenProfileUserMapping(VOID) -{ - DPRINT1("(), stub!\n"); +BOOL WINAPI OpenProfileUserMapping(void) { + FIXME("(), stub!\n"); SetLastError(ERROR_CALL_NOT_IMPLEMENTED); return FALSE; } @@ -1825,24 +1797,8 @@ BOOL WINAPI OpenProfileUserMapping(VOID) /*********************************************************************** * CloseProfileUserMapping (KERNEL32.@) */ -BOOL WINAPI CloseProfileUserMapping(VOID) -{ - DPRINT1("(), stub!\n"); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; -} - -/* - * @unimplemented - */ -BOOL -WINAPI -QueryWin31IniFilesMappedToRegistry(DWORD Unknown0, - DWORD Unknown1, - DWORD Unknown2, - DWORD Unknown3) -{ - DPRINT1("QueryWin31IniFilesMappedToRegistry not implemented\n"); +BOOL WINAPI CloseProfileUserMapping(void) { + FIXME("(), stub!\n"); SetLastError(ERROR_CALL_NOT_IMPLEMENTED); return FALSE; } diff --git a/dll/win32/kernel32/misc/res.c b/dll/win32/kernel32/wine/res.c similarity index 60% rename from dll/win32/kernel32/misc/res.c rename to dll/win32/kernel32/wine/res.c index 4844488a0b5..82ed63ac9b6 100644 --- a/dll/win32/kernel32/misc/res.c +++ b/dll/win32/kernel32/wine/res.c @@ -1,26 +1,592 @@ -/* $Id$ +/* + * Resources * - * COPYRIGHT: See COPYING in the top level directory - * PROJECT : ReactOS user mode libraries - * MODULE : kernel32.dll - * FILE : reactos/lib/kernel32/misc/res.c - * AUTHOR : Ariadne - * Eric Kohl - * Ge van Geldorp - * Gunnar Dalsnes - * David Welch - * Dmitry Chapyshev + * Copyright 1993 Robert J. Amstadt + * Copyright 1995, 2003 Alexandre Julliard + * Copyright 2006 Mike McCormack + * + * 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 -#include +//#include "config.h" +//#include "wine/port.h" -#define NDEBUG -#include +#include -#define STUB \ - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); \ - DPRINT1("%s() is UNIMPLEMENTED!\n", __FUNCTION__) +#define NONAMELESSUNION +#define NONAMELESSSTRUCT +#include "ntstatus.h" +#define WIN32_NO_STATUS +#include "windef.h" +#include "winbase.h" +#include "winternl.h" +#include "wine/debug.h" +#include "wine/exception.h" +#include "wine/unicode.h" +#include "wine/list.h" + +#define HeapAlloc RtlAllocateHeap +#define HeapReAlloc RtlReAllocateHeap +#define HeapFree RtlFreeHeap +WINE_DEFAULT_DEBUG_CHANNEL(resource); + +/* we don't want to include winuser.h just for this */ +#define IS_INTRESOURCE(x) (((ULONG_PTR)(x) >> 16) == 0) + +/* retrieve the resource name to pass to the ntdll functions */ +static NTSTATUS get_res_nameA( LPCSTR name, UNICODE_STRING *str ) +{ + if (IS_INTRESOURCE(name)) + { + str->Buffer = ULongToPtr(LOWORD(name)); + return STATUS_SUCCESS; + } + if (name[0] == '#') + { + ULONG value; + if (RtlCharToInteger( name + 1, 10, &value ) != STATUS_SUCCESS || HIWORD(value)) + return STATUS_INVALID_PARAMETER; + str->Buffer = ULongToPtr(value); + return STATUS_SUCCESS; + } + RtlCreateUnicodeStringFromAsciiz( str, name ); + RtlUpcaseUnicodeString( str, str, FALSE ); + return STATUS_SUCCESS; +} + +/* retrieve the resource name to pass to the ntdll functions */ +static NTSTATUS get_res_nameW( LPCWSTR name, UNICODE_STRING *str ) +{ + if (IS_INTRESOURCE(name)) + { + str->Buffer = ULongToPtr(LOWORD(name)); + return STATUS_SUCCESS; + } + if (name[0] == '#') + { + ULONG value; + RtlInitUnicodeString( str, name + 1 ); + if (RtlUnicodeStringToInteger( str, 10, &value ) != STATUS_SUCCESS || HIWORD(value)) + return STATUS_INVALID_PARAMETER; + str->Buffer = ULongToPtr(value); + return STATUS_SUCCESS; + } + RtlCreateUnicodeString( str, name ); + RtlUpcaseUnicodeString( str, str, FALSE ); + return STATUS_SUCCESS; +} + +/* implementation of FindResourceExA */ +static HRSRC find_resourceA( HMODULE hModule, LPCSTR type, LPCSTR name, WORD lang ) +{ + NTSTATUS status; + UNICODE_STRING nameW, typeW; + LDR_RESOURCE_INFO info; + const IMAGE_RESOURCE_DATA_ENTRY *entry = NULL; + + nameW.Buffer = NULL; + typeW.Buffer = NULL; + + __TRY + { + if ((status = get_res_nameA( name, &nameW )) != STATUS_SUCCESS) goto done; + if ((status = get_res_nameA( type, &typeW )) != STATUS_SUCCESS) goto done; + info.Type = (ULONG_PTR)typeW.Buffer; + info.Name = (ULONG_PTR)nameW.Buffer; + info.Language = lang; + status = LdrFindResource_U( hModule, &info, 3, &entry ); + done: + if (status != STATUS_SUCCESS) SetLastError( RtlNtStatusToDosError(status) ); + } + __EXCEPT_PAGE_FAULT + { + SetLastError( ERROR_INVALID_PARAMETER ); + } + __ENDTRY + + if (!IS_INTRESOURCE(nameW.Buffer)) HeapFree( GetProcessHeap(), 0, nameW.Buffer ); + if (!IS_INTRESOURCE(typeW.Buffer)) HeapFree( GetProcessHeap(), 0, typeW.Buffer ); + return (HRSRC)entry; +} + + +/* implementation of FindResourceExW */ +static HRSRC find_resourceW( HMODULE hModule, LPCWSTR type, LPCWSTR name, WORD lang ) +{ + NTSTATUS status; + UNICODE_STRING nameW, typeW; + LDR_RESOURCE_INFO info; + const IMAGE_RESOURCE_DATA_ENTRY *entry = NULL; + + nameW.Buffer = typeW.Buffer = NULL; + + __TRY + { + if ((status = get_res_nameW( name, &nameW )) != STATUS_SUCCESS) goto done; + if ((status = get_res_nameW( type, &typeW )) != STATUS_SUCCESS) goto done; + info.Type = (ULONG_PTR)typeW.Buffer; + info.Name = (ULONG_PTR)nameW.Buffer; + info.Language = lang; + status = LdrFindResource_U( hModule, &info, 3, &entry ); + done: + if (status != STATUS_SUCCESS) SetLastError( RtlNtStatusToDosError(status) ); + } + __EXCEPT_PAGE_FAULT + { + SetLastError( ERROR_INVALID_PARAMETER ); + } + __ENDTRY + + if (!IS_INTRESOURCE(nameW.Buffer)) HeapFree( GetProcessHeap(), 0, nameW.Buffer ); + if (!IS_INTRESOURCE(typeW.Buffer)) HeapFree( GetProcessHeap(), 0, typeW.Buffer ); + return (HRSRC)entry; +} + +/********************************************************************** + * FindResourceExA (KERNEL32.@) + */ +HRSRC WINAPI FindResourceExA( HMODULE hModule, LPCSTR type, LPCSTR name, WORD lang ) +{ + TRACE( "%p %s %s %04x\n", hModule, debugstr_a(type), debugstr_a(name), lang ); + + if (!hModule) hModule = GetModuleHandleW(0); + return find_resourceA( hModule, type, name, lang ); +} + + +/********************************************************************** + * FindResourceA (KERNEL32.@) + */ +HRSRC WINAPI FindResourceA( HMODULE hModule, LPCSTR name, LPCSTR type ) +{ + return FindResourceExA( hModule, type, name, MAKELANGID( LANG_NEUTRAL, SUBLANG_NEUTRAL ) ); +} + + +/********************************************************************** + * FindResourceExW (KERNEL32.@) + */ +HRSRC WINAPI FindResourceExW( HMODULE hModule, LPCWSTR type, LPCWSTR name, WORD lang ) +{ + TRACE( "%p %s %s %04x\n", hModule, debugstr_w(type), debugstr_w(name), lang ); + + if (!hModule) hModule = GetModuleHandleW(0); + return find_resourceW( hModule, type, name, lang ); +} + + +/********************************************************************** + * FindResourceW (KERNEL32.@) + */ +HRSRC WINAPI FindResourceW( HINSTANCE hModule, LPCWSTR name, LPCWSTR type ) +{ + return FindResourceExW( hModule, type, name, MAKELANGID( LANG_NEUTRAL, SUBLANG_NEUTRAL ) ); +} + + +/********************************************************************** + * EnumResourceTypesA (KERNEL32.@) + */ +BOOL WINAPI EnumResourceTypesA( HMODULE hmod, ENUMRESTYPEPROCA lpfun, LONG_PTR lparam ) +{ + int i; + BOOL ret = FALSE; + LPSTR type = NULL; + DWORD len = 0, newlen; + NTSTATUS status; + const IMAGE_RESOURCE_DIRECTORY *resdir; + const IMAGE_RESOURCE_DIRECTORY_ENTRY *et; + const IMAGE_RESOURCE_DIR_STRING_U *str; + + TRACE( "%p %p %lx\n", hmod, lpfun, lparam ); + + if (!hmod) hmod = GetModuleHandleA( NULL ); + + if ((status = LdrFindResourceDirectory_U( hmod, NULL, 0, &resdir )) != STATUS_SUCCESS) + { + SetLastError( RtlNtStatusToDosError(status) ); + return FALSE; + } + et = (const IMAGE_RESOURCE_DIRECTORY_ENTRY *)(resdir + 1); + for (i = 0; i < resdir->NumberOfNamedEntries+resdir->NumberOfIdEntries; i++) + { + if (et[i].u1.s1.NameIsString) + { + str = (const IMAGE_RESOURCE_DIR_STRING_U *)((const BYTE *)resdir + et[i].u1.s1.NameOffset); + newlen = WideCharToMultiByte( CP_ACP, 0, str->NameString, str->Length, NULL, 0, NULL, NULL); + if (newlen + 1 > len) + { + len = newlen + 1; + HeapFree( GetProcessHeap(), 0, type ); + if (!(type = HeapAlloc( GetProcessHeap(), 0, len ))) return FALSE; + } + WideCharToMultiByte( CP_ACP, 0, str->NameString, str->Length, type, len, NULL, NULL); + type[newlen] = 0; + ret = lpfun(hmod,type,lparam); + } + else + { + ret = lpfun( hmod, UIntToPtr(et[i].u1.Id), lparam ); + } + if (!ret) break; + } + HeapFree( GetProcessHeap(), 0, type ); + return ret; +} + + +/********************************************************************** + * EnumResourceTypesW (KERNEL32.@) + */ +BOOL WINAPI EnumResourceTypesW( HMODULE hmod, ENUMRESTYPEPROCW lpfun, LONG_PTR lparam ) +{ + int i, len = 0; + BOOL ret = FALSE; + LPWSTR type = NULL; + NTSTATUS status; + const IMAGE_RESOURCE_DIRECTORY *resdir; + const IMAGE_RESOURCE_DIRECTORY_ENTRY *et; + const IMAGE_RESOURCE_DIR_STRING_U *str; + + TRACE( "%p %p %lx\n", hmod, lpfun, lparam ); + + if (!hmod) hmod = GetModuleHandleW( NULL ); + + if ((status = LdrFindResourceDirectory_U( hmod, NULL, 0, &resdir )) != STATUS_SUCCESS) + { + SetLastError( RtlNtStatusToDosError(status) ); + return FALSE; + } + et = (const IMAGE_RESOURCE_DIRECTORY_ENTRY *)(resdir + 1); + for (i = 0; i < resdir->NumberOfNamedEntries + resdir->NumberOfIdEntries; i++) + { + if (et[i].u1.s1.NameIsString) + { + str = (const IMAGE_RESOURCE_DIR_STRING_U *)((const BYTE *)resdir + et[i].u1.s1.NameOffset); + if (str->Length + 1 > len) + { + len = str->Length + 1; + HeapFree( GetProcessHeap(), 0, type ); + if (!(type = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return FALSE; + } + memcpy(type, str->NameString, str->Length * sizeof (WCHAR)); + type[str->Length] = 0; + ret = lpfun(hmod,type,lparam); + } + else + { + ret = lpfun( hmod, UIntToPtr(et[i].u1.Id), lparam ); + } + if (!ret) break; + } + HeapFree( GetProcessHeap(), 0, type ); + return ret; +} + + +/********************************************************************** + * EnumResourceNamesA (KERNEL32.@) + */ +BOOL WINAPI EnumResourceNamesA( HMODULE hmod, LPCSTR type, ENUMRESNAMEPROCA lpfun, LONG_PTR lparam ) +{ + int i; + BOOL ret = FALSE; + DWORD len = 0, newlen; + LPSTR name = NULL; + NTSTATUS status; + UNICODE_STRING typeW; + LDR_RESOURCE_INFO info; + const IMAGE_RESOURCE_DIRECTORY *basedir, *resdir; + const IMAGE_RESOURCE_DIRECTORY_ENTRY *et; + const IMAGE_RESOURCE_DIR_STRING_U *str; + + TRACE( "%p %s %p %lx\n", hmod, debugstr_a(type), lpfun, lparam ); + + if (!hmod) hmod = GetModuleHandleA( NULL ); + typeW.Buffer = NULL; + if ((status = LdrFindResourceDirectory_U( hmod, NULL, 0, &basedir )) != STATUS_SUCCESS) + goto done; + if ((status = get_res_nameA( type, &typeW )) != STATUS_SUCCESS) + goto done; + info.Type = (ULONG_PTR)typeW.Buffer; + if ((status = LdrFindResourceDirectory_U( hmod, &info, 1, &resdir )) != STATUS_SUCCESS) + goto done; + + et = (const IMAGE_RESOURCE_DIRECTORY_ENTRY *)(resdir + 1); + __TRY + { + for (i = 0; i < resdir->NumberOfNamedEntries+resdir->NumberOfIdEntries; i++) + { + if (et[i].u1.s1.NameIsString) + { + str = (const IMAGE_RESOURCE_DIR_STRING_U *)((const BYTE *)basedir + et[i].u1.s1.NameOffset); + newlen = WideCharToMultiByte(CP_ACP, 0, str->NameString, str->Length, NULL, 0, NULL, NULL); + if (newlen + 1 > len) + { + len = newlen + 1; + HeapFree( GetProcessHeap(), 0, name ); + if (!(name = HeapAlloc(GetProcessHeap(), 0, len + 1 ))) + { + ret = FALSE; + break; + } + } + WideCharToMultiByte( CP_ACP, 0, str->NameString, str->Length, name, len, NULL, NULL ); + name[newlen] = 0; + ret = lpfun(hmod,type,name,lparam); + } + else + { + ret = lpfun( hmod, type, UIntToPtr(et[i].u1.Id), lparam ); + } + if (!ret) break; + } + } + __EXCEPT_PAGE_FAULT + { + ret = FALSE; + status = STATUS_ACCESS_VIOLATION; + } + __ENDTRY + +done: + HeapFree( GetProcessHeap(), 0, name ); + if (!IS_INTRESOURCE(typeW.Buffer)) HeapFree( GetProcessHeap(), 0, typeW.Buffer ); + if (status != STATUS_SUCCESS) SetLastError( RtlNtStatusToDosError(status) ); + return ret; +} + + +/********************************************************************** + * EnumResourceNamesW (KERNEL32.@) + */ +BOOL WINAPI EnumResourceNamesW( HMODULE hmod, LPCWSTR type, ENUMRESNAMEPROCW lpfun, LONG_PTR lparam ) +{ + int i, len = 0; + BOOL ret = FALSE; + LPWSTR name = NULL; + NTSTATUS status; + UNICODE_STRING typeW; + LDR_RESOURCE_INFO info; + const IMAGE_RESOURCE_DIRECTORY *basedir, *resdir; + const IMAGE_RESOURCE_DIRECTORY_ENTRY *et; + const IMAGE_RESOURCE_DIR_STRING_U *str; + + TRACE( "%p %s %p %lx\n", hmod, debugstr_w(type), lpfun, lparam ); + + if (!hmod) hmod = GetModuleHandleW( NULL ); + typeW.Buffer = NULL; + if ((status = LdrFindResourceDirectory_U( hmod, NULL, 0, &basedir )) != STATUS_SUCCESS) + goto done; + if ((status = get_res_nameW( type, &typeW )) != STATUS_SUCCESS) + goto done; + info.Type = (ULONG_PTR)typeW.Buffer; + if ((status = LdrFindResourceDirectory_U( hmod, &info, 1, &resdir )) != STATUS_SUCCESS) + goto done; + + et = (const IMAGE_RESOURCE_DIRECTORY_ENTRY *)(resdir + 1); + __TRY + { + for (i = 0; i < resdir->NumberOfNamedEntries+resdir->NumberOfIdEntries; i++) + { + if (et[i].u1.s1.NameIsString) + { + str = (const IMAGE_RESOURCE_DIR_STRING_U *)((const BYTE *)basedir + et[i].u1.s1.NameOffset); + if (str->Length + 1 > len) + { + len = str->Length + 1; + HeapFree( GetProcessHeap(), 0, name ); + if (!(name = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) + { + ret = FALSE; + break; + } + } + memcpy(name, str->NameString, str->Length * sizeof (WCHAR)); + name[str->Length] = 0; + ret = lpfun(hmod,type,name,lparam); + } + else + { + ret = lpfun( hmod, type, UIntToPtr(et[i].u1.Id), lparam ); + } + if (!ret) break; + } + } + __EXCEPT_PAGE_FAULT + { + ret = FALSE; + status = STATUS_ACCESS_VIOLATION; + } + __ENDTRY +done: + HeapFree( GetProcessHeap(), 0, name ); + if (!IS_INTRESOURCE(typeW.Buffer)) HeapFree( GetProcessHeap(), 0, typeW.Buffer ); + if (status != STATUS_SUCCESS) SetLastError( RtlNtStatusToDosError(status) ); + return ret; +} + + +/********************************************************************** + * EnumResourceLanguagesA (KERNEL32.@) + */ +BOOL WINAPI EnumResourceLanguagesA( HMODULE hmod, LPCSTR type, LPCSTR name, + ENUMRESLANGPROCA lpfun, LONG_PTR lparam ) +{ + int i; + BOOL ret = FALSE; + NTSTATUS status; + UNICODE_STRING typeW, nameW; + LDR_RESOURCE_INFO info; + const IMAGE_RESOURCE_DIRECTORY *basedir, *resdir; + const IMAGE_RESOURCE_DIRECTORY_ENTRY *et; + + TRACE( "%p %s %s %p %lx\n", hmod, debugstr_a(type), debugstr_a(name), lpfun, lparam ); + + if (!hmod) hmod = GetModuleHandleA( NULL ); + typeW.Buffer = nameW.Buffer = NULL; + if ((status = LdrFindResourceDirectory_U( hmod, NULL, 0, &basedir )) != STATUS_SUCCESS) + goto done; + if ((status = get_res_nameA( type, &typeW )) != STATUS_SUCCESS) + goto done; + if ((status = get_res_nameA( name, &nameW )) != STATUS_SUCCESS) + goto done; + info.Type = (ULONG_PTR)typeW.Buffer; + info.Name = (ULONG_PTR)nameW.Buffer; + if ((status = LdrFindResourceDirectory_U( hmod, &info, 2, &resdir )) != STATUS_SUCCESS) + goto done; + + et = (const IMAGE_RESOURCE_DIRECTORY_ENTRY *)(resdir + 1); + __TRY + { + for (i = 0; i < resdir->NumberOfNamedEntries + resdir->NumberOfIdEntries; i++) + { + ret = lpfun( hmod, type, name, et[i].u1.Id, lparam ); + if (!ret) break; + } + } + __EXCEPT_PAGE_FAULT + { + ret = FALSE; + status = STATUS_ACCESS_VIOLATION; + } + __ENDTRY +done: + if (!IS_INTRESOURCE(typeW.Buffer)) HeapFree( GetProcessHeap(), 0, typeW.Buffer ); + if (!IS_INTRESOURCE(nameW.Buffer)) HeapFree( GetProcessHeap(), 0, nameW.Buffer ); + if (status != STATUS_SUCCESS) SetLastError( RtlNtStatusToDosError(status) ); + return ret; +} + + +/********************************************************************** + * EnumResourceLanguagesW (KERNEL32.@) + */ +BOOL WINAPI EnumResourceLanguagesW( HMODULE hmod, LPCWSTR type, LPCWSTR name, + ENUMRESLANGPROCW lpfun, LONG_PTR lparam ) +{ + int i; + BOOL ret = FALSE; + NTSTATUS status; + UNICODE_STRING typeW, nameW; + LDR_RESOURCE_INFO info; + const IMAGE_RESOURCE_DIRECTORY *basedir, *resdir; + const IMAGE_RESOURCE_DIRECTORY_ENTRY *et; + + TRACE( "%p %s %s %p %lx\n", hmod, debugstr_w(type), debugstr_w(name), lpfun, lparam ); + + if (!hmod) hmod = GetModuleHandleW( NULL ); + typeW.Buffer = nameW.Buffer = NULL; + if ((status = LdrFindResourceDirectory_U( hmod, NULL, 0, &basedir )) != STATUS_SUCCESS) + goto done; + if ((status = get_res_nameW( type, &typeW )) != STATUS_SUCCESS) + goto done; + if ((status = get_res_nameW( name, &nameW )) != STATUS_SUCCESS) + goto done; + info.Type = (ULONG_PTR)typeW.Buffer; + info.Name = (ULONG_PTR)nameW.Buffer; + if ((status = LdrFindResourceDirectory_U( hmod, &info, 2, &resdir )) != STATUS_SUCCESS) + goto done; + + et = (const IMAGE_RESOURCE_DIRECTORY_ENTRY *)(resdir + 1); + __TRY + { + for (i = 0; i < resdir->NumberOfNamedEntries + resdir->NumberOfIdEntries; i++) + { + ret = lpfun( hmod, type, name, et[i].u1.Id, lparam ); + if (!ret) break; + } + } + __EXCEPT_PAGE_FAULT + { + ret = FALSE; + status = STATUS_ACCESS_VIOLATION; + } + __ENDTRY +done: + if (!IS_INTRESOURCE(typeW.Buffer)) HeapFree( GetProcessHeap(), 0, typeW.Buffer ); + if (!IS_INTRESOURCE(nameW.Buffer)) HeapFree( GetProcessHeap(), 0, nameW.Buffer ); + if (status != STATUS_SUCCESS) SetLastError( RtlNtStatusToDosError(status) ); + return ret; +} + + +/********************************************************************** + * LoadResource (KERNEL32.@) + */ +HGLOBAL WINAPI LoadResource( HINSTANCE hModule, HRSRC hRsrc ) +{ + NTSTATUS status; + void *ret = NULL; + + TRACE( "%p %p\n", hModule, hRsrc ); + + if (!hRsrc) return 0; + if (!hModule) hModule = GetModuleHandleA( NULL ); + status = LdrAccessResource( hModule, (IMAGE_RESOURCE_DATA_ENTRY *)hRsrc, &ret, NULL ); + if (status != STATUS_SUCCESS) SetLastError( RtlNtStatusToDosError(status) ); + return ret; +} + + +/********************************************************************** + * LockResource (KERNEL32.@) + */ +LPVOID WINAPI LockResource( HGLOBAL handle ) +{ + return handle; +} + + +/********************************************************************** + * FreeResource (KERNEL32.@) + */ +BOOL WINAPI FreeResource( HGLOBAL handle ) +{ + return 0; +} + + +/********************************************************************** + * SizeofResource (KERNEL32.@) + */ +DWORD WINAPI SizeofResource( HINSTANCE hModule, HRSRC hRsrc ) +{ + if (!hRsrc) return 0; + return ((PIMAGE_RESOURCE_DATA_ENTRY)hRsrc)->Size; +} /* * Data structure for updating resources. @@ -39,6 +605,13 @@ typedef struct struct list root; } QUEUEDUPDATES; +/* this structure is shared for types and names */ +struct resource_dir_entry { + struct list entry; + LPWSTR id; + struct list children; +}; + /* this structure is the leaf */ struct resource_data { struct list entry; @@ -48,60 +621,191 @@ struct resource_data { void *lpData; }; -struct resource_size_info { - DWORD types_ofs; - DWORD names_ofs; - DWORD langs_ofs; - DWORD data_entry_ofs; - DWORD strings_ofs; - DWORD data_ofs; - DWORD total_size; -}; - -/* this structure is shared for types and names */ -struct resource_dir_entry { - struct list entry; - LPWSTR id; - struct list children; -}; - -struct mapping_info { - HANDLE file; - HANDLE mapping; - void *base; - DWORD size; - BOOL read_write; -}; - static int resource_strcmp( LPCWSTR a, LPCWSTR b ) { if ( a == b ) return 0; - if (HIWORD( a ) && HIWORD( b ) ) + if (!IS_INTRESOURCE( a ) && !IS_INTRESOURCE( b ) ) return lstrcmpW( a, b ); /* strings come before ids */ - if (HIWORD( a ) && !HIWORD( b )) + if (!IS_INTRESOURCE( a ) && IS_INTRESOURCE( b )) return -1; - if (HIWORD( b ) && !HIWORD( a )) + if (!IS_INTRESOURCE( b ) && IS_INTRESOURCE( a )) return 1; return ( a < b ) ? -1 : 1; } +static struct resource_dir_entry *find_resource_dir_entry( struct list *dir, LPCWSTR id ) +{ + struct resource_dir_entry *ent; + + /* match either IDs or strings */ + LIST_FOR_EACH_ENTRY( ent, dir, struct resource_dir_entry, entry ) + if (!resource_strcmp( id, ent->id )) + return ent; + + return NULL; +} + +static struct resource_data *find_resource_data( struct list *dir, LANGID lang ) +{ + struct resource_data *res_data; + + /* match only languages here */ + LIST_FOR_EACH_ENTRY( res_data, dir, struct resource_data, entry ) + if ( lang == res_data->lang ) + return res_data; + + return NULL; +} + +static void add_resource_dir_entry( struct list *dir, struct resource_dir_entry *resdir ) +{ + struct resource_dir_entry *ent; + + LIST_FOR_EACH_ENTRY( ent, dir, struct resource_dir_entry, entry ) + { + if (0>resource_strcmp( ent->id, resdir->id )) + continue; + + list_add_before( &ent->entry, &resdir->entry ); + return; + } + list_add_tail( dir, &resdir->entry ); +} + +static void add_resource_data_entry( struct list *dir, struct resource_data *resdata ) +{ + struct resource_data *ent; + + LIST_FOR_EACH_ENTRY( ent, dir, struct resource_data, entry ) + { + if (ent->lang < resdata->lang) + continue; + + list_add_before( &ent->entry, &resdata->entry ); + return; + } + list_add_tail( dir, &resdata->entry ); +} static LPWSTR res_strdupW( LPCWSTR str ) { LPWSTR ret; UINT len; - if (HIWORD(str) == 0) + if (IS_INTRESOURCE(str)) return (LPWSTR) (UINT_PTR) LOWORD(str); len = (lstrlenW( str ) + 1) * sizeof (WCHAR); ret = HeapAlloc( GetProcessHeap(), 0, len ); - if (!ret) return NULL; memcpy( ret, str, len ); return ret; } +static void res_free_str( LPWSTR str ) +{ + if (!IS_INTRESOURCE(str)) + HeapFree( GetProcessHeap(), 0, str ); +} + +static BOOL update_add_resource( QUEUEDUPDATES *updates, LPCWSTR Type, LPCWSTR Name, + LANGID Lang, struct resource_data *resdata, + BOOL overwrite_existing ) +{ + struct resource_dir_entry *restype, *resname; + struct resource_data *existing; + + TRACE("%p %s %s %p %d\n", updates, + debugstr_w(Type), debugstr_w(Name), resdata, overwrite_existing ); + + restype = find_resource_dir_entry( &updates->root, Type ); + if (!restype) + { + restype = HeapAlloc( GetProcessHeap(), 0, sizeof *restype ); + restype->id = res_strdupW( Type ); + list_init( &restype->children ); + add_resource_dir_entry( &updates->root, restype ); + } + + resname = find_resource_dir_entry( &restype->children, Name ); + if (!resname) + { + resname = HeapAlloc( GetProcessHeap(), 0, sizeof *resname ); + resname->id = res_strdupW( Name ); + list_init( &resname->children ); + add_resource_dir_entry( &restype->children, resname ); + } + + /* + * If there's an existing resource entry with matching (Type,Name,Language) + * it needs to be removed before adding the new data. + */ + existing = find_resource_data( &resname->children, Lang ); + if (existing) + { + if (!overwrite_existing) + return FALSE; + list_remove( &existing->entry ); + HeapFree( GetProcessHeap(), 0, existing ); + } + + if (resdata) + add_resource_data_entry( &resname->children, resdata ); + + return TRUE; +} + +static struct resource_data *allocate_resource_data( WORD Language, DWORD codepage, + LPVOID lpData, DWORD cbData, BOOL copy_data ) +{ + struct resource_data *resdata; + + if (!lpData || !cbData) + return NULL; + + resdata = HeapAlloc( GetProcessHeap(), 0, sizeof *resdata + (copy_data ? cbData : 0) ); + if (resdata) + { + resdata->lang = Language; + resdata->codepage = codepage; + resdata->cbData = cbData; + if (copy_data) + { + resdata->lpData = &resdata[1]; + memcpy( resdata->lpData, lpData, cbData ); + } + else + resdata->lpData = lpData; + } + + return resdata; +} + +static void free_resource_directory( struct list *head, int level ) +{ + struct list *ptr = NULL; + + while ((ptr = list_head( head ))) + { + list_remove( ptr ); + if (level) + { + struct resource_dir_entry *ent; + + ent = LIST_ENTRY( ptr, struct resource_dir_entry, entry ); + res_free_str( ent->id ); + free_resource_directory( &ent->children, level - 1 ); + HeapFree(GetProcessHeap(), 0, ent); + } + else + { + struct resource_data *data; + + data = LIST_ENTRY( ptr, struct resource_data, entry ); + HeapFree( GetProcessHeap(), 0, data ); + } + } +} static IMAGE_NT_HEADERS *get_nt_header( void *base, DWORD mapping_size ) { @@ -171,9 +875,9 @@ static BOOL check_pe_exe( HANDLE file, QUEUEDUPDATES *updates ) if (!nt) goto done; - DPRINT("resources: %08x %08x\n", - nt->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_RESOURCE].VirtualAddress, - nt->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_RESOURCE].Size); + TRACE("resources: %08x %08x\n", + nt->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_RESOURCE].VirtualAddress, + nt->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_RESOURCE].Size); sec = get_section_header( base, mapping_size, &num_sections ); if (!sec) @@ -190,180 +894,445 @@ done: return ret; } +struct resource_size_info { + DWORD types_ofs; + DWORD names_ofs; + DWORD langs_ofs; + DWORD data_entry_ofs; + DWORD strings_ofs; + DWORD data_ofs; + DWORD total_size; +}; -static struct resource_data *allocate_resource_data( WORD Language, DWORD codepage, - LPVOID lpData, DWORD cbData, BOOL copy_data ) +struct mapping_info { + HANDLE file; + void *base; + DWORD size; + BOOL read_write; +}; + +static const IMAGE_SECTION_HEADER *section_from_rva( void *base, DWORD mapping_size, DWORD rva ) { - struct resource_data *resdata; + const IMAGE_SECTION_HEADER *sec; + DWORD num_sections = 0; + int i; - if (!lpData || !cbData) + sec = get_section_header( base, mapping_size, &num_sections ); + if (!sec) return NULL; - resdata = HeapAlloc( GetProcessHeap(), 0, sizeof *resdata + (copy_data ? cbData : 0) ); - if (resdata) + for (i=num_sections-1; i>=0; i--) { - resdata->lang = Language; - resdata->codepage = codepage; - resdata->cbData = cbData; - if (copy_data) + if (sec[i].VirtualAddress <= rva && + rva <= (DWORD)sec[i].VirtualAddress + sec[i].SizeOfRawData) { - resdata->lpData = &resdata[1]; - memcpy( resdata->lpData, lpData, cbData ); + return &sec[i]; } - else - resdata->lpData = lpData; } - return resdata; -} - -static void add_resource_dir_entry( struct list *dir, struct resource_dir_entry *resdir ) -{ - struct resource_dir_entry *ent; - - LIST_FOR_EACH_ENTRY( ent, dir, struct resource_dir_entry, entry ) - { - if (0>resource_strcmp( ent->id, resdir->id )) - continue; - - list_add_before( &ent->entry, &resdir->entry ); - return; - } - list_add_tail( dir, &resdir->entry ); -} - -static void add_resource_data_entry( struct list *dir, struct resource_data *resdata ) -{ - struct resource_data *ent; - - LIST_FOR_EACH_ENTRY( ent, dir, struct resource_data, entry ) - { - if (ent->lang < resdata->lang) - continue; - - list_add_before( &ent->entry, &resdata->entry ); - return; - } - list_add_tail( dir, &resdata->entry ); -} - -static struct resource_dir_entry *find_resource_dir_entry( struct list *dir, LPCWSTR id ) -{ - struct resource_dir_entry *ent; - - /* match either IDs or strings */ - LIST_FOR_EACH_ENTRY( ent, dir, struct resource_dir_entry, entry ) - if (!resource_strcmp( id, ent->id )) - return ent; - return NULL; } - -static struct resource_data *find_resource_data( struct list *dir, LANGID lang ) +static void *address_from_rva( void *base, DWORD mapping_size, DWORD rva, DWORD len ) { - struct resource_data *res_data; + const IMAGE_SECTION_HEADER *sec; - /* match only languages here */ - LIST_FOR_EACH_ENTRY( res_data, dir, struct resource_data, entry ) - if ( lang == res_data->lang ) - return res_data; + sec = section_from_rva( base, mapping_size, rva ); + if (!sec) + return NULL; + + if (rva + len <= (DWORD)sec->VirtualAddress + sec->SizeOfRawData) + return (void*)((LPBYTE) base + (sec->PointerToRawData + rva - sec->VirtualAddress)); return NULL; } - -static BOOL update_add_resource( QUEUEDUPDATES *updates, LPCWSTR Type, LPCWSTR Name, - struct resource_data *resdata, BOOL overwrite_existing ) +static LPWSTR resource_dup_string( const IMAGE_RESOURCE_DIRECTORY *root, const IMAGE_RESOURCE_DIRECTORY_ENTRY *entry ) { - struct resource_dir_entry *restype, *resname; - struct resource_data *existing; + const IMAGE_RESOURCE_DIR_STRING_U* string; + LPWSTR s; - DPRINT("%p %s %s %p %d\n", updates, - Type, Name, resdata, overwrite_existing ); + if (!entry->u1.s1.NameIsString) + return UIntToPtr(entry->u1.Id); - restype = find_resource_dir_entry( &updates->root, Type ); - if (!restype) + string = (const IMAGE_RESOURCE_DIR_STRING_U*) (((const char *)root) + entry->u1.s1.NameOffset); + s = HeapAlloc(GetProcessHeap(), 0, (string->Length + 1)*sizeof (WCHAR) ); + memcpy( s, string->NameString, (string->Length + 1)*sizeof (WCHAR) ); + s[string->Length] = 0; + + return s; +} + +/* this function is based on the code in winedump's pe.c */ +static BOOL enumerate_mapped_resources( QUEUEDUPDATES *updates, + void *base, DWORD mapping_size, + const IMAGE_RESOURCE_DIRECTORY *root ) +{ + const IMAGE_RESOURCE_DIRECTORY *namedir, *langdir; + const IMAGE_RESOURCE_DIRECTORY_ENTRY *e1, *e2, *e3; + const IMAGE_RESOURCE_DATA_ENTRY *data; + DWORD i, j, k; + + TRACE("version (%d.%d) %d named %d id entries\n", + root->MajorVersion, root->MinorVersion, root->NumberOfNamedEntries, root->NumberOfIdEntries); + + for (i = 0; i< root->NumberOfNamedEntries + root->NumberOfIdEntries; i++) { - restype = HeapAlloc( GetProcessHeap(), 0, sizeof *restype ); - if (!restype) return FALSE; - restype->id = res_strdupW( Type ); - list_init( &restype->children ); - add_resource_dir_entry( &updates->root, restype ); - } + LPWSTR Type; - resname = find_resource_dir_entry( &restype->children, Name ); - if (!resname) - { - resname = HeapAlloc( GetProcessHeap(), 0, sizeof *resname ); - if (!resname) return FALSE; - resname->id = res_strdupW( Name ); - list_init( &resname->children ); - add_resource_dir_entry( &restype->children, resname ); - } + e1 = (const IMAGE_RESOURCE_DIRECTORY_ENTRY*)(root + 1) + i; - /* - * If there's an existing resource entry with matching (Type,Name,Language) - * it needs to be removed before adding the new data. - */ - existing = find_resource_data( &resname->children, resdata->lang ); - if (existing) - { - if (!overwrite_existing) - return FALSE; - list_remove( &existing->entry ); - HeapFree( GetProcessHeap(), 0, existing ); - } + Type = resource_dup_string( root, e1 ); - add_resource_data_entry( &resname->children, resdata ); + namedir = (const IMAGE_RESOURCE_DIRECTORY *)((const char *)root + e1->u2.s3.OffsetToDirectory); + for (j = 0; j < namedir->NumberOfNamedEntries + namedir->NumberOfIdEntries; j++) + { + LPWSTR Name; + + e2 = (const IMAGE_RESOURCE_DIRECTORY_ENTRY*)(namedir + 1) + j; + + Name = resource_dup_string( root, e2 ); + + langdir = (const IMAGE_RESOURCE_DIRECTORY *)((const char *)root + e2->u2.s3.OffsetToDirectory); + for (k = 0; k < langdir->NumberOfNamedEntries + langdir->NumberOfIdEntries; k++) + { + LANGID Lang; + void *p; + struct resource_data *resdata; + + e3 = (const IMAGE_RESOURCE_DIRECTORY_ENTRY*)(langdir + 1) + k; + + Lang = e3->u1.Id; + + data = (const IMAGE_RESOURCE_DATA_ENTRY *)((const char *)root + e3->u2.OffsetToData); + + p = address_from_rva( base, mapping_size, data->OffsetToData, data->Size ); + + resdata = allocate_resource_data( Lang, data->CodePage, p, data->Size, FALSE ); + if (resdata) + { + if (!update_add_resource( updates, Type, Name, Lang, resdata, FALSE )) + HeapFree( GetProcessHeap(), 0, resdata ); + } + } + res_free_str( Name ); + } + res_free_str( Type ); + } return TRUE; } - -/* retrieve the resource name to pass to the ntdll functions */ -static NTSTATUS get_res_nameA( LPCSTR name, UNICODE_STRING *str ) +static BOOL read_mapped_resources( QUEUEDUPDATES *updates, void *base, DWORD mapping_size ) { - if (!HIWORD(name)) - { - str->Buffer = (LPWSTR)name; - return STATUS_SUCCESS; - } - if (name[0] == '#') - { - ULONG value; - if (RtlCharToInteger( name + 1, 10, &value ) != STATUS_SUCCESS || HIWORD(value)) - return STATUS_INVALID_PARAMETER; - str->Buffer = (LPWSTR)value; - return STATUS_SUCCESS; - } - RtlCreateUnicodeStringFromAsciiz( str, name ); - RtlUpcaseUnicodeString( str, str, FALSE ); - return STATUS_SUCCESS; + const IMAGE_RESOURCE_DIRECTORY *root; + const IMAGE_NT_HEADERS *nt; + const IMAGE_SECTION_HEADER *sec; + DWORD num_sections = 0, i; + + nt = get_nt_header( base, mapping_size ); + if (!nt) + return FALSE; + + sec = get_section_header( base, mapping_size, &num_sections ); + if (!sec) + return FALSE; + + for (i=0; i mapping_size || + (sec[i].PointerToRawData + sec[i].SizeOfRawData) > mapping_size) + return TRUE; + + TRACE("found .rsrc at %08x, size %08x\n", sec[i].PointerToRawData, sec[i].SizeOfRawData); + + if (!sec[i].PointerToRawData || sec[i].SizeOfRawData < sizeof(IMAGE_RESOURCE_DIRECTORY)) + return TRUE; + + root = (void*) ((BYTE*)base + sec[i].PointerToRawData); + enumerate_mapped_resources( updates, base, mapping_size, root ); + + return TRUE; } -/* retrieve the resource name to pass to the ntdll functions */ -static NTSTATUS get_res_nameW( LPCWSTR name, UNICODE_STRING *str ) +static BOOL map_file_into_memory( struct mapping_info *mi ) { - if (!HIWORD(name)) + DWORD page_attr, perm; + HANDLE mapping; + + if (mi->read_write) { - str->Buffer = (LPWSTR)name; - return STATUS_SUCCESS; + page_attr = PAGE_READWRITE; + perm = FILE_MAP_WRITE | FILE_MAP_READ; } - if (name[0] == '#') + else { - ULONG value; - RtlInitUnicodeString( str, name + 1 ); - if (RtlUnicodeStringToInteger( str, 10, &value ) != STATUS_SUCCESS || HIWORD(value)) - return STATUS_INVALID_PARAMETER; - str->Buffer = (LPWSTR)value; - return STATUS_SUCCESS; + page_attr = PAGE_READONLY; + perm = FILE_MAP_READ; } - RtlCreateUnicodeString( str, name ); - RtlUpcaseUnicodeString( str, str, FALSE ); - return STATUS_SUCCESS; + + mapping = CreateFileMappingW( mi->file, NULL, page_attr, 0, 0, NULL ); + if (!mapping) return FALSE; + + mi->base = MapViewOfFile( mapping, perm, 0, 0, mi->size ); + CloseHandle( mapping ); + + return mi->base != NULL; } +static BOOL unmap_file_from_memory( struct mapping_info *mi ) +{ + if (mi->base) + UnmapViewOfFile( mi->base ); + mi->base = NULL; + return TRUE; +} + +static void destroy_mapping( struct mapping_info *mi ) +{ + if (!mi) + return; + unmap_file_from_memory( mi ); + if (mi->file) + CloseHandle( mi->file ); + HeapFree( GetProcessHeap(), 0, mi ); +} + +static struct mapping_info *create_mapping( LPCWSTR name, BOOL rw ) +{ + struct mapping_info *mi; + + mi = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof *mi ); + if (!mi) + return NULL; + + mi->read_write = rw; + + mi->file = CreateFileW( name, GENERIC_READ | (rw ? GENERIC_WRITE : 0), + 0, NULL, OPEN_EXISTING, 0, 0 ); + + if (mi->file != INVALID_HANDLE_VALUE) + { + mi->size = GetFileSize( mi->file, NULL ); + + if (map_file_into_memory( mi )) + return mi; + } + destroy_mapping( mi ); + return NULL; +} + +static BOOL resize_mapping( struct mapping_info *mi, DWORD new_size ) +{ + if (!unmap_file_from_memory( mi )) + return FALSE; + + /* change the file size */ + SetFilePointer( mi->file, new_size, NULL, FILE_BEGIN ); + if (!SetEndOfFile( mi->file )) + { + ERR("failed to set file size to %08x\n", new_size ); + return FALSE; + } + + mi->size = new_size; + + return map_file_into_memory( mi ); +} + +static void get_resource_sizes( QUEUEDUPDATES *updates, struct resource_size_info *si ) +{ + struct resource_dir_entry *types, *names; + struct resource_data *data; + DWORD num_types = 0, num_names = 0, num_langs = 0, strings_size = 0, data_size = 0; + + memset( si, 0, sizeof *si ); + + LIST_FOR_EACH_ENTRY( types, &updates->root, struct resource_dir_entry, entry ) + { + num_types++; + if (!IS_INTRESOURCE( types->id )) + strings_size += sizeof (WORD) + lstrlenW( types->id )*sizeof (WCHAR); + + LIST_FOR_EACH_ENTRY( names, &types->children, struct resource_dir_entry, entry ) + { + num_names++; + + if (!IS_INTRESOURCE( names->id )) + strings_size += sizeof (WORD) + lstrlenW( names->id )*sizeof (WCHAR); + + LIST_FOR_EACH_ENTRY( data, &names->children, struct resource_data, entry ) + { + num_langs++; + data_size += (data->cbData + 3) & ~3; + } + } + } + + /* names are at the end of the types */ + si->names_ofs = sizeof (IMAGE_RESOURCE_DIRECTORY) + + num_types * sizeof (IMAGE_RESOURCE_DIRECTORY_ENTRY); + + /* language directories are at the end of the names */ + si->langs_ofs = si->names_ofs + + num_types * sizeof (IMAGE_RESOURCE_DIRECTORY) + + num_names * sizeof (IMAGE_RESOURCE_DIRECTORY_ENTRY); + + si->data_entry_ofs = si->langs_ofs + + num_names * sizeof (IMAGE_RESOURCE_DIRECTORY) + + num_langs * sizeof (IMAGE_RESOURCE_DIRECTORY_ENTRY); + + si->strings_ofs = si->data_entry_ofs + + num_langs * sizeof (IMAGE_RESOURCE_DATA_ENTRY); + + si->data_ofs = si->strings_ofs + ((strings_size + 3) & ~3); + + si->total_size = si->data_ofs + data_size; + + TRACE("names %08x langs %08x data entries %08x strings %08x data %08x total %08x\n", + si->names_ofs, si->langs_ofs, si->data_entry_ofs, + si->strings_ofs, si->data_ofs, si->total_size); +} + +static void res_write_padding( BYTE *res_base, DWORD size ) +{ + static const BYTE pad[] = { + 'P','A','D','D','I','N','G','X','X','P','A','D','D','I','N','G' }; + DWORD i; + + for ( i = 0; i < size / sizeof pad; i++ ) + memcpy( &res_base[i*sizeof pad], pad, sizeof pad ); + memcpy( &res_base[i*sizeof pad], pad, size%sizeof pad ); +} + +static BOOL write_resources( QUEUEDUPDATES *updates, LPBYTE base, struct resource_size_info *si, DWORD rva ) +{ + struct resource_dir_entry *types, *names; + struct resource_data *data; + IMAGE_RESOURCE_DIRECTORY *root; + + TRACE("%p %p %p %08x\n", updates, base, si, rva ); + + memset( base, 0, si->total_size ); + + /* the root entry always exists */ + root = (IMAGE_RESOURCE_DIRECTORY*) base; + memset( root, 0, sizeof *root ); + root->MajorVersion = 4; + si->types_ofs = sizeof *root; + LIST_FOR_EACH_ENTRY( types, &updates->root, struct resource_dir_entry, entry ) + { + IMAGE_RESOURCE_DIRECTORY_ENTRY *e1; + IMAGE_RESOURCE_DIRECTORY *namedir; + + e1 = (IMAGE_RESOURCE_DIRECTORY_ENTRY*) &base[si->types_ofs]; + memset( e1, 0, sizeof *e1 ); + if (!IS_INTRESOURCE( types->id )) + { + WCHAR *strings; + DWORD len; + + root->NumberOfNamedEntries++; + e1->u1.s1.NameIsString = 1; + e1->u1.s1.NameOffset = si->strings_ofs; + + strings = (WCHAR*) &base[si->strings_ofs]; + len = lstrlenW( types->id ); + strings[0] = len; + memcpy( &strings[1], types->id, len * sizeof (WCHAR) ); + si->strings_ofs += (len + 1) * sizeof (WCHAR); + } + else + { + root->NumberOfIdEntries++; + e1->u1.Id = LOWORD( types->id ); + } + e1->u2.s3.OffsetToDirectory = si->names_ofs; + e1->u2.s3.DataIsDirectory = TRUE; + si->types_ofs += sizeof (IMAGE_RESOURCE_DIRECTORY_ENTRY); + + namedir = (IMAGE_RESOURCE_DIRECTORY*) &base[si->names_ofs]; + memset( namedir, 0, sizeof *namedir ); + namedir->MajorVersion = 4; + si->names_ofs += sizeof (IMAGE_RESOURCE_DIRECTORY); + + LIST_FOR_EACH_ENTRY( names, &types->children, struct resource_dir_entry, entry ) + { + IMAGE_RESOURCE_DIRECTORY_ENTRY *e2; + IMAGE_RESOURCE_DIRECTORY *langdir; + + e2 = (IMAGE_RESOURCE_DIRECTORY_ENTRY*) &base[si->names_ofs]; + memset( e2, 0, sizeof *e2 ); + if (!IS_INTRESOURCE( names->id )) + { + WCHAR *strings; + DWORD len; + + namedir->NumberOfNamedEntries++; + e2->u1.s1.NameIsString = 1; + e2->u1.s1.NameOffset = si->strings_ofs; + + strings = (WCHAR*) &base[si->strings_ofs]; + len = lstrlenW( names->id ); + strings[0] = len; + memcpy( &strings[1], names->id, len * sizeof (WCHAR) ); + si->strings_ofs += (len + 1) * sizeof (WCHAR); + } + else + { + namedir->NumberOfIdEntries++; + e2->u1.Id = LOWORD( names->id ); + } + e2->u2.s3.OffsetToDirectory = si->langs_ofs; + e2->u2.s3.DataIsDirectory = TRUE; + si->names_ofs += sizeof (IMAGE_RESOURCE_DIRECTORY_ENTRY); + + langdir = (IMAGE_RESOURCE_DIRECTORY*) &base[si->langs_ofs]; + memset( langdir, 0, sizeof *langdir ); + langdir->MajorVersion = 4; + si->langs_ofs += sizeof (IMAGE_RESOURCE_DIRECTORY); + + LIST_FOR_EACH_ENTRY( data, &names->children, struct resource_data, entry ) + { + IMAGE_RESOURCE_DIRECTORY_ENTRY *e3; + IMAGE_RESOURCE_DATA_ENTRY *de; + int pad_size; + + e3 = (IMAGE_RESOURCE_DIRECTORY_ENTRY*) &base[si->langs_ofs]; + memset( e3, 0, sizeof *e3 ); + langdir->NumberOfIdEntries++; + e3->u1.Id = LOWORD( data->lang ); + e3->u2.OffsetToData = si->data_entry_ofs; + + si->langs_ofs += sizeof (IMAGE_RESOURCE_DIRECTORY_ENTRY); + + /* write out all the data entries */ + de = (IMAGE_RESOURCE_DATA_ENTRY*) &base[si->data_entry_ofs]; + memset( de, 0, sizeof *de ); + de->OffsetToData = si->data_ofs + rva; + de->Size = data->cbData; + de->CodePage = data->codepage; + si->data_entry_ofs += sizeof (IMAGE_RESOURCE_DATA_ENTRY); + + /* write out the resource data */ + memcpy( &base[si->data_ofs], data->lpData, data->cbData ); + si->data_ofs += data->cbData; + + pad_size = (-si->data_ofs)&3; + res_write_padding( &base[si->data_ofs], pad_size ); + si->data_ofs += pad_size; + } + } + } + + return TRUE; +} /* * FIXME: @@ -400,319 +1369,11 @@ static IMAGE_SECTION_HEADER *get_resource_section( void *base, DWORD mapping_siz break; if (i == num_sections) - { - DPRINT("FIXME: .rsrc doesn't exist\n"); return NULL; - } return &sec[i]; } - -static const IMAGE_SECTION_HEADER *section_from_rva( void *base, DWORD mapping_size, DWORD rva ) -{ - const IMAGE_SECTION_HEADER *sec; - DWORD num_sections = 0; - int i; - - sec = get_section_header( base, mapping_size, &num_sections ); - if (!sec) - return NULL; - - for (i=num_sections-1; i>=0; i--) - { - if (sec[i].VirtualAddress <= rva && - rva <= (DWORD)sec[i].VirtualAddress + sec[i].SizeOfRawData) - { - return &sec[i]; - } - } - - return NULL; -} - - -static void *address_from_rva( void *base, DWORD mapping_size, DWORD rva, DWORD len ) -{ - const IMAGE_SECTION_HEADER *sec; - - sec = section_from_rva( base, mapping_size, rva ); - if (!sec) - return NULL; - - if (rva + len <= (DWORD)sec->VirtualAddress + sec->SizeOfRawData) - return (void*)((LPBYTE) base + (sec->PointerToRawData + rva - sec->VirtualAddress)); - - return NULL; -} - - -static void res_free_str( LPWSTR str ) -{ - if (HIWORD(str)) - HeapFree( GetProcessHeap(), 0, str ); -} - - -static LPWSTR resource_dup_string( const IMAGE_RESOURCE_DIRECTORY *root, const IMAGE_RESOURCE_DIRECTORY_ENTRY *entry ) -{ - const IMAGE_RESOURCE_DIR_STRING_U* string; - LPWSTR s; - - if (!entry->NameIsString) - return UIntToPtr(entry->Id); - - string = (const IMAGE_RESOURCE_DIR_STRING_U*) (((const char *)root) + entry->NameOffset); - s = HeapAlloc(GetProcessHeap(), 0, (string->Length + 1)*sizeof (WCHAR) ); - if (!s) return NULL; - memcpy( s, string->NameString, (string->Length + 1)*sizeof (WCHAR) ); - s[string->Length] = 0; - - return s; -} - - -/* this function is based on the code in winedump's pe.c */ -static BOOL enumerate_mapped_resources( QUEUEDUPDATES *updates, - void *base, DWORD mapping_size, - const IMAGE_RESOURCE_DIRECTORY *root ) -{ - const IMAGE_RESOURCE_DIRECTORY *namedir, *langdir; - const IMAGE_RESOURCE_DIRECTORY_ENTRY *e1, *e2, *e3; - const IMAGE_RESOURCE_DATA_ENTRY *data; - DWORD i, j, k; - - DPRINT("version (%d.%d) %d named %d id entries\n", - root->MajorVersion, root->MinorVersion, root->NumberOfNamedEntries, root->NumberOfIdEntries); - - for (i = 0; i< root->NumberOfNamedEntries + root->NumberOfIdEntries; i++) - { - LPWSTR Type; - - e1 = (const IMAGE_RESOURCE_DIRECTORY_ENTRY*)(root + 1) + i; - - Type = resource_dup_string( root, e1 ); - - namedir = (const IMAGE_RESOURCE_DIRECTORY *)((const char *)root + e1->OffsetToDirectory); - for (j = 0; j < namedir->NumberOfNamedEntries + namedir->NumberOfIdEntries; j++) - { - LPWSTR Name; - - e2 = (const IMAGE_RESOURCE_DIRECTORY_ENTRY*)(namedir + 1) + j; - - Name = resource_dup_string( root, e2 ); - - langdir = (const IMAGE_RESOURCE_DIRECTORY *)((const char *)root + e2->OffsetToDirectory); - for (k = 0; k < langdir->NumberOfNamedEntries + langdir->NumberOfIdEntries; k++) - { - LANGID Lang; - void *p; - struct resource_data *resdata; - - e3 = (const IMAGE_RESOURCE_DIRECTORY_ENTRY*)(langdir + 1) + k; - - Lang = e3->Id; - - data = (const IMAGE_RESOURCE_DATA_ENTRY *)((const char *)root + e3->OffsetToData); - - p = address_from_rva( base, mapping_size, data->OffsetToData, data->Size ); - - resdata = allocate_resource_data( Lang, data->CodePage, p, data->Size, FALSE ); - if (resdata) - { - if (!update_add_resource( updates, Type, Name, resdata, FALSE )) - HeapFree( GetProcessHeap(), 0, resdata ); - } - } - res_free_str( Name ); - } - res_free_str( Type ); - } - - return TRUE; -} - - -static BOOL read_mapped_resources( QUEUEDUPDATES *updates, void *base, DWORD mapping_size ) -{ - const IMAGE_RESOURCE_DIRECTORY *root; - const IMAGE_NT_HEADERS *nt; - const IMAGE_SECTION_HEADER *sec; - DWORD num_sections = 0, i; - - nt = get_nt_header( base, mapping_size ); - if (!nt) - return FALSE; - - sec = get_section_header( base, mapping_size, &num_sections ); - if (!sec) - return FALSE; - - for (i=0; i mapping_size || - (sec[i].PointerToRawData + sec[i].SizeOfRawData) > mapping_size) - return TRUE; - - DPRINT("found .rsrc at %08x, size %08x\n", sec[i].PointerToRawData, sec[i].SizeOfRawData); - - if (!sec[i].PointerToRawData || sec[i].SizeOfRawData < sizeof(IMAGE_RESOURCE_DIRECTORY)) - return TRUE; - - root = (void*) ((BYTE*)base + sec[i].PointerToRawData); - enumerate_mapped_resources( updates, base, mapping_size, root ); - - return TRUE; -} - - -static BOOL unmap_file_from_memory( struct mapping_info *mi ) -{ - if (mi->base) - UnmapViewOfFile( mi->base ); - mi->base = NULL; - if (mi->mapping) - CloseHandle( mi->mapping ); - mi->mapping = NULL; - return TRUE; -} - - -static BOOL map_file_into_memory( struct mapping_info *mi ) -{ - DWORD page_attr, perm; - - if (mi->read_write) - { - page_attr = PAGE_READWRITE; - perm = FILE_MAP_WRITE | FILE_MAP_READ; - } - else - { - page_attr = PAGE_READONLY; - perm = FILE_MAP_READ; - } - - mi->mapping = CreateFileMappingW( mi->file, NULL, page_attr, 0, 0, NULL ); - if (!mi->mapping) - return FALSE; - - mi->base = MapViewOfFile( mi->mapping, perm, 0, 0, mi->size ); - if (!mi->base) - return FALSE; - - return TRUE; -} - - -static struct mapping_info *create_mapping( LPCWSTR name, BOOL rw ) -{ - struct mapping_info *mi; - - mi = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof *mi ); - if (!mi) - return NULL; - - mi->read_write = rw; - - mi->file = CreateFileW( name, GENERIC_READ | (rw ? GENERIC_WRITE : 0), - 0, NULL, OPEN_EXISTING, 0, 0 ); - - if (mi->file != INVALID_HANDLE_VALUE) - { - mi->size = GetFileSize( mi->file, NULL ); - - if (map_file_into_memory( mi )) - return mi; - } - - unmap_file_from_memory( mi ); - HeapFree( GetProcessHeap(), 0, mi ); - - return NULL; -} - - -static void get_resource_sizes( QUEUEDUPDATES *updates, struct resource_size_info *si ) -{ - struct resource_dir_entry *types, *names; - struct resource_data *data; - DWORD num_types = 0, num_names = 0, num_langs = 0, strings_size = 0, data_size = 0; - - memset( si, 0, sizeof *si ); - - LIST_FOR_EACH_ENTRY( types, &updates->root, struct resource_dir_entry, entry ) - { - num_types++; - if (HIWORD( types->id )) - strings_size += sizeof (WORD) + lstrlenW( types->id )*sizeof (WCHAR); - - LIST_FOR_EACH_ENTRY( names, &types->children, struct resource_dir_entry, entry ) - { - num_names++; - - if (HIWORD( names->id )) - strings_size += sizeof (WORD) + lstrlenW( names->id )*sizeof (WCHAR); - - LIST_FOR_EACH_ENTRY( data, &names->children, struct resource_data, entry ) - { - num_langs++; - data_size += (data->cbData + 3) & ~3; - } - } - } - - /* names are at the end of the types */ - si->names_ofs = sizeof (IMAGE_RESOURCE_DIRECTORY) + - num_types * sizeof (IMAGE_RESOURCE_DIRECTORY_ENTRY); - - /* language directories are at the end of the names */ - si->langs_ofs = si->names_ofs + - num_types * sizeof (IMAGE_RESOURCE_DIRECTORY) + - num_names * sizeof (IMAGE_RESOURCE_DIRECTORY_ENTRY); - - si->data_entry_ofs = si->langs_ofs + - num_names * sizeof (IMAGE_RESOURCE_DIRECTORY) + - num_langs * sizeof (IMAGE_RESOURCE_DIRECTORY_ENTRY); - - si->strings_ofs = si->data_entry_ofs + - num_langs * sizeof (IMAGE_RESOURCE_DATA_ENTRY); - - si->data_ofs = si->strings_ofs + ((strings_size + 3) & ~3); - - si->total_size = si->data_ofs + data_size; - - DPRINT("names %08x langs %08x data entries %08x strings %08x data %08x total %08x\n", - si->names_ofs, si->langs_ofs, si->data_entry_ofs, - si->strings_ofs, si->data_ofs, si->total_size); -} - - -static BOOL resize_mapping( struct mapping_info *mi, DWORD new_size ) -{ - if (!unmap_file_from_memory( mi )) - return FALSE; - - /* change the file size */ - SetFilePointer( mi->file, new_size, NULL, FILE_BEGIN ); - if (!SetEndOfFile( mi->file )) - { - DPRINT("failed to set file size to %08x\n", new_size ); - return FALSE; - } - - mi->size = new_size; - - return map_file_into_memory( mi ); -} - - static DWORD get_init_data_size( void *base, DWORD mapping_size ) { DWORD i, sz = 0, num_sections = 0; @@ -724,191 +1385,16 @@ static DWORD get_init_data_size( void *base, DWORD mapping_size ) if (s[i].Characteristics & IMAGE_SCN_CNT_INITIALIZED_DATA) sz += s[i].SizeOfRawData; - DPRINT("size = %08x\n", sz); + TRACE("size = %08x\n", sz); return sz; } - -static void res_write_padding( BYTE *res_base, DWORD size ) -{ - static const BYTE pad[] = { - 'P','A','D','D','I','N','G','X','X','P','A','D','D','I','N','G' }; - DWORD i; - - for ( i = 0; i < size / sizeof pad; i++ ) - memcpy( &res_base[i*sizeof pad], pad, sizeof pad ); - memcpy( &res_base[i*sizeof pad], pad, size%sizeof pad ); -} - - -static void destroy_mapping( struct mapping_info *mi ) -{ - if (!mi) - return; - unmap_file_from_memory( mi ); - if (mi->file) - CloseHandle( mi->file ); - HeapFree( GetProcessHeap(), 0, mi ); -} - - -static void free_resource_directory( struct list *head, int level ) -{ - struct list *ptr = NULL; - - while ((ptr = list_head( head ))) - { - list_remove( ptr ); - if (level) - { - struct resource_dir_entry *ent; - - ent = LIST_ENTRY( ptr, struct resource_dir_entry, entry ); - res_free_str( ent->id ); - free_resource_directory( &ent->children, level - 1 ); - HeapFree(GetProcessHeap(), 0, ent); - } - else - { - struct resource_data *data; - - data = LIST_ENTRY( ptr, struct resource_data, entry ); - HeapFree( GetProcessHeap(), 0, data ); - } - } -} - - -static BOOL write_resources( QUEUEDUPDATES *updates, LPBYTE base, struct resource_size_info *si, DWORD rva ) -{ - struct resource_dir_entry *types, *names; - struct resource_data *data; - IMAGE_RESOURCE_DIRECTORY *root; - - DPRINT("%p %p %p %08x\n", updates, base, si, rva ); - - memset( base, 0, si->total_size ); - - /* the root entry always exists */ - root = (IMAGE_RESOURCE_DIRECTORY*) base; - memset( root, 0, sizeof *root ); - root->MajorVersion = 4; - si->types_ofs = sizeof *root; - LIST_FOR_EACH_ENTRY( types, &updates->root, struct resource_dir_entry, entry ) - { - IMAGE_RESOURCE_DIRECTORY_ENTRY *e1; - IMAGE_RESOURCE_DIRECTORY *namedir; - - e1 = (IMAGE_RESOURCE_DIRECTORY_ENTRY*) &base[si->types_ofs]; - memset( e1, 0, sizeof *e1 ); - if (HIWORD( types->id )) - { - WCHAR *strings; - DWORD len; - - root->NumberOfNamedEntries++; - e1->NameIsString = 1; - e1->NameOffset = si->strings_ofs; - - strings = (WCHAR*) &base[si->strings_ofs]; - len = lstrlenW( types->id ); - strings[0] = len; - memcpy( &strings[1], types->id, len * sizeof (WCHAR) ); - si->strings_ofs += (len + 1) * sizeof (WCHAR); - } - else - { - root->NumberOfIdEntries++; - e1->Id = LOWORD( types->id ); - } - e1->OffsetToDirectory = si->names_ofs; - e1->DataIsDirectory = TRUE; - si->types_ofs += sizeof (IMAGE_RESOURCE_DIRECTORY_ENTRY); - - namedir = (IMAGE_RESOURCE_DIRECTORY*) &base[si->names_ofs]; - memset( namedir, 0, sizeof *namedir ); - namedir->MajorVersion = 4; - si->names_ofs += sizeof (IMAGE_RESOURCE_DIRECTORY); - - LIST_FOR_EACH_ENTRY( names, &types->children, struct resource_dir_entry, entry ) - { - IMAGE_RESOURCE_DIRECTORY_ENTRY *e2; - IMAGE_RESOURCE_DIRECTORY *langdir; - - e2 = (IMAGE_RESOURCE_DIRECTORY_ENTRY*) &base[si->names_ofs]; - memset( e2, 0, sizeof *e2 ); - if (HIWORD( names->id )) - { - WCHAR *strings; - DWORD len; - - namedir->NumberOfNamedEntries++; - e2->NameIsString = 1; - e2->NameOffset = si->strings_ofs; - - strings = (WCHAR*) &base[si->strings_ofs]; - len = lstrlenW( names->id ); - strings[0] = len; - memcpy( &strings[1], names->id, len * sizeof (WCHAR) ); - si->strings_ofs += (len + 1) * sizeof (WCHAR); - } - else - { - namedir->NumberOfIdEntries++; - e2->Id = LOWORD( names->id ); - } - e2->OffsetToDirectory = si->langs_ofs; - e2->DataIsDirectory = TRUE; - si->names_ofs += sizeof (IMAGE_RESOURCE_DIRECTORY_ENTRY); - - langdir = (IMAGE_RESOURCE_DIRECTORY*) &base[si->langs_ofs]; - memset( langdir, 0, sizeof *langdir ); - langdir->MajorVersion = 4; - si->langs_ofs += sizeof (IMAGE_RESOURCE_DIRECTORY); - - LIST_FOR_EACH_ENTRY( data, &names->children, struct resource_data, entry ) - { - IMAGE_RESOURCE_DIRECTORY_ENTRY *e3; - IMAGE_RESOURCE_DATA_ENTRY *de; - int pad_size; - - e3 = (IMAGE_RESOURCE_DIRECTORY_ENTRY*) &base[si->langs_ofs]; - memset( e3, 0, sizeof *e3 ); - langdir->NumberOfIdEntries++; - e3->Id = LOWORD( data->lang ); - e3->OffsetToData = si->data_entry_ofs; - - si->langs_ofs += sizeof (IMAGE_RESOURCE_DIRECTORY_ENTRY); - - /* write out all the data entries */ - de = (IMAGE_RESOURCE_DATA_ENTRY*) &base[si->data_entry_ofs]; - memset( de, 0, sizeof *de ); - de->OffsetToData = si->data_ofs + rva; - de->Size = data->cbData; - de->CodePage = data->codepage; - si->data_entry_ofs += sizeof (IMAGE_RESOURCE_DATA_ENTRY); - - /* write out the resource data */ - memcpy( &base[si->data_ofs], data->lpData, data->cbData ); - si->data_ofs += data->cbData; - - pad_size = (-si->data_ofs)&3; - res_write_padding( &base[si->data_ofs], pad_size ); - si->data_ofs += pad_size; - } - } - } - - return TRUE; -} - - static BOOL write_raw_resources( QUEUEDUPDATES *updates ) { static const WCHAR prefix[] = { 'r','e','s','u',0 }; WCHAR tempdir[MAX_PATH], tempfile[MAX_PATH]; - DWORD mapping_size, section_size, old_size; + DWORD section_size; BOOL ret = FALSE; IMAGE_SECTION_HEADER *sec; IMAGE_NT_HEADERS *nt; @@ -927,7 +1413,7 @@ static BOOL write_raw_resources( QUEUEDUPDATES *updates ) if (!CopyFileW( updates->pFileName, tempfile, FALSE )) goto done; - DPRINT("tempfile %s\n", tempfile); + TRACE("tempfile %s\n", debugstr_w(tempfile)); if (!updates->bDeleteExistingResources) { @@ -938,7 +1424,7 @@ static BOOL write_raw_resources( QUEUEDUPDATES *updates ) ret = read_mapped_resources( updates, read_map->base, read_map->size ); if (!ret) { - DPRINT("failed to read existing resources\n"); + ERR("failed to read existing resources\n"); goto done; } } @@ -953,77 +1439,138 @@ static BOOL write_raw_resources( QUEUEDUPDATES *updates ) if (nt->OptionalHeader.SectionAlignment <= 0) { - DPRINT("invalid section alignment %04x\n", nt->OptionalHeader.SectionAlignment); + ERR("invalid section alignment %04x\n", nt->OptionalHeader.SectionAlignment); + goto done; + } + + if (nt->OptionalHeader.FileAlignment <= 0) + { + ERR("invalid file alignment %04x\n", nt->OptionalHeader.FileAlignment); goto done; } sec = get_resource_section( write_map->base, write_map->size ); - if (!sec) - goto done; + if (!sec) /* no section, add one */ + { + DWORD num_sections; + + sec = get_section_header( write_map->base, write_map->size, &num_sections ); + if (!sec) + goto done; + + sec += num_sections; + nt->FileHeader.NumberOfSections++; + + memset( sec, 0, sizeof *sec ); + memcpy( sec->Name, ".rsrc", 5 ); + sec->Characteristics = IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_READ; + sec->VirtualAddress = nt->OptionalHeader.SizeOfImage; + } if (!sec->PointerToRawData) /* empty section */ { - sec->PointerToRawData = write_map->size; + sec->PointerToRawData = write_map->size + (-write_map->size) % nt->OptionalHeader.FileAlignment; sec->SizeOfRawData = 0; } - else if ((sec->SizeOfRawData + sec->PointerToRawData) != write_map->size) - { - DPRINT(".rsrc isn't at the end of the image %08x + %08x != %08x for %s\n", - sec->SizeOfRawData, sec->PointerToRawData, write_map->size, updates->pFileName); - goto done; - } - DPRINT("before .rsrc at %08x, size %08x\n", sec->PointerToRawData, sec->SizeOfRawData); + TRACE("before .rsrc at %08x, size %08x\n", sec->PointerToRawData, sec->SizeOfRawData); get_resource_sizes( updates, &res_size ); /* round up the section size */ section_size = res_size.total_size; - section_size += (-section_size) % nt->OptionalHeader.SectionAlignment; + section_size += (-section_size) % nt->OptionalHeader.FileAlignment; - mapping_size = sec->PointerToRawData + section_size; - - DPRINT("requires %08x (%08x) bytes\n", res_size.total_size, section_size ); + TRACE("requires %08x (%08x) bytes\n", res_size.total_size, section_size ); /* check if the file size needs to be changed */ if (section_size != sec->SizeOfRawData) { - old_size = write_map->size; + DWORD old_size = write_map->size; + DWORD virtual_section_size = res_size.total_size + (-res_size.total_size) % nt->OptionalHeader.SectionAlignment; + int delta = section_size - (sec->SizeOfRawData + (-sec->SizeOfRawData) % nt->OptionalHeader.FileAlignment); + int rva_delta = virtual_section_size - + (sec->Misc.VirtualSize + (-sec->Misc.VirtualSize) % nt->OptionalHeader.SectionAlignment); + BOOL rsrc_is_last = sec->PointerToRawData + sec->SizeOfRawData == old_size; + /* align .rsrc size when possible */ + DWORD mapping_size = rsrc_is_last ? sec->PointerToRawData + section_size : old_size + delta; - DPRINT("file size %08x -> %08x\n", old_size, mapping_size); + /* postpone file truncation if there are some data to be moved down from file end */ + BOOL resize_after = mapping_size < old_size && !rsrc_is_last; - /* unmap the file before changing the file size */ - ret = resize_mapping( write_map, mapping_size ); + TRACE("file size %08x -> %08x\n", old_size, mapping_size); - /* get the pointers again - they might be different after remapping */ - nt = get_nt_header( write_map->base, mapping_size ); - if (!nt) + if (!resize_after) { - DPRINT("couldn't get NT header\n"); - goto done; + /* unmap the file before changing the file size */ + ret = resize_mapping( write_map, mapping_size ); + + /* get the pointers again - they might be different after remapping */ + nt = get_nt_header( write_map->base, mapping_size ); + if (!nt) + { + ERR("couldn't get NT header\n"); + goto done; + } + + sec = get_resource_section( write_map->base, mapping_size ); + if (!sec) + goto done; } - sec = get_resource_section( write_map->base, mapping_size ); - if (!sec) - goto done; + if (!rsrc_is_last) /* not last section, relocate trailing sections */ + { + IMAGE_SECTION_HEADER *s; + DWORD tail_start = sec->PointerToRawData + sec->SizeOfRawData; + DWORD i, num_sections = 0; + + memmove( (char*)write_map->base + tail_start + delta, (char*)write_map->base + tail_start, old_size - tail_start ); + + s = get_section_header( write_map->base, mapping_size, &num_sections ); + + for (i=0; i sec->PointerToRawData) + { + s[i].PointerToRawData += delta; + s[i].VirtualAddress += rva_delta; + } + } + } + + if (resize_after) + { + ret = resize_mapping( write_map, mapping_size ); + + nt = get_nt_header( write_map->base, mapping_size ); + if (!nt) + { + ERR("couldn't get NT header\n"); + goto done; + } + + sec = get_resource_section( write_map->base, mapping_size ); + if (!sec) + goto done; + } /* adjust the PE header information */ - nt->OptionalHeader.SizeOfImage += (mapping_size - old_size); sec->SizeOfRawData = section_size; - sec->Misc.VirtualSize = section_size; + sec->Misc.VirtualSize = virtual_section_size; + nt->OptionalHeader.SizeOfImage += rva_delta; nt->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_RESOURCE].Size = res_size.total_size; nt->OptionalHeader.SizeOfInitializedData = get_init_data_size( write_map->base, mapping_size ); } res_base = (LPBYTE) write_map->base + sec->PointerToRawData; - DPRINT("base = %p offset = %08x\n", write_map->base, sec->PointerToRawData); + TRACE("base = %p offset = %08x\n", write_map->base, sec->PointerToRawData); ret = write_resources( updates, res_base, &res_size, sec->VirtualAddress ); res_write_padding( res_base + res_size.total_size, section_size - res_size.total_size ); - DPRINT("after .rsrc at %08x, size %08x\n", sec->PointerToRawData, sec->SizeOfRawData); + TRACE("after .rsrc at %08x, size %08x\n", sec->PointerToRawData, sec->SizeOfRawData); done: destroy_mapping( read_map ); @@ -1037,234 +1584,15 @@ done: return ret; } - -/* - * @implemented +/*********************************************************************** + * BeginUpdateResourceW (KERNEL32.@) */ -HRSRC -WINAPI -FindResourceA ( - HINSTANCE hModule, - LPCSTR lpName, - LPCSTR lpType - ) -{ - return FindResourceExA (hModule, lpType, lpName, 0); -} - - -/* - * @implemented - */ -HRSRC -WINAPI -FindResourceExA( - HINSTANCE hModule, - LPCSTR lpType, - LPCSTR lpName, - WORD wLanguage - ) -{ - UNICODE_STRING TypeU; - UNICODE_STRING NameU; - ANSI_STRING Type; - ANSI_STRING Name; - HRSRC Res; - - RtlInitUnicodeString (&NameU, - NULL); - RtlInitUnicodeString (&TypeU, - NULL); - - if (HIWORD(lpName) != 0) - { - RtlInitAnsiString (&Name, - (LPSTR)lpName); - RtlAnsiStringToUnicodeString (&NameU, - &Name, - TRUE); - } - else - NameU.Buffer = (PWSTR)lpName; - - if (HIWORD(lpType) != 0) - { - RtlInitAnsiString (&Type, - (LPSTR)lpType); - RtlAnsiStringToUnicodeString (&TypeU, - &Type, - TRUE); - } - else - TypeU.Buffer = (PWSTR)lpType; - - Res = FindResourceExW (hModule, - TypeU.Buffer, - NameU.Buffer, - wLanguage); - - if (HIWORD(lpName) != 0) - RtlFreeUnicodeString (&NameU); - - if (HIWORD(lpType) != 0) - RtlFreeUnicodeString (&TypeU); - - return Res; -} - - -/* - * @implemented - */ -HRSRC -WINAPI -FindResourceW ( - HINSTANCE hModule, - LPCWSTR lpName, - LPCWSTR lpType - ) -{ - return FindResourceExW (hModule, lpType, lpName, 0); -} - - -/* - * @implemented - */ -HRSRC -WINAPI -FindResourceExW ( - HINSTANCE hModule, - LPCWSTR lpType, - LPCWSTR lpName, - WORD wLanguage - ) -{ - PIMAGE_RESOURCE_DATA_ENTRY ResourceDataEntry = NULL; - LDR_RESOURCE_INFO ResourceInfo; - NTSTATUS Status; - - if ( hModule == NULL ) - hModule = (HINSTANCE)GetModuleHandleW(NULL); - - _SEH2_TRY - { - if ( !IS_INTRESOURCE(lpName) && lpName[0] == L'#' ) { - lpName = MAKEINTRESOURCEW(wcstoul(lpName + 1, NULL, 10)); - } - if ( !IS_INTRESOURCE(lpType) && lpType[0] == L'#' ) { - lpType = MAKEINTRESOURCEW(wcstoul(lpType + 1, NULL, 10)); - } - - ResourceInfo.Type = (ULONG)lpType; - ResourceInfo.Name = (ULONG)lpName; - ResourceInfo.Language = (ULONG)wLanguage; - - Status = LdrFindResource_U (hModule, - &ResourceInfo, - RESOURCE_DATA_LEVEL, - &ResourceDataEntry); - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - Status = _SEH2_GetExceptionCode(); - } - _SEH2_END; - - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus (Status); - return NULL; - } - - return (HRSRC)ResourceDataEntry; -} - - -/* - * @implemented - */ -HGLOBAL -WINAPI -LoadResource ( - HINSTANCE hModule, - HRSRC hResInfo - ) -{ - NTSTATUS Status; - PVOID Data; - PIMAGE_RESOURCE_DATA_ENTRY ResInfo = (PIMAGE_RESOURCE_DATA_ENTRY)hResInfo; - - if (hModule == NULL) - { - hModule = (HINSTANCE)GetModuleHandleW(NULL); - } - - Status = LdrAccessResource (hModule, ResInfo, &Data, NULL); - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus (Status); - return NULL; - } - - return Data; -} - - -/* - * @implemented - */ -DWORD -WINAPI -SizeofResource ( - HINSTANCE hModule, - HRSRC hResInfo - ) -{ - return ((PIMAGE_RESOURCE_DATA_ENTRY)hResInfo)->Size; -} - - -/* - * @unimplemented - */ -BOOL -WINAPI -FreeResource ( - HGLOBAL hResData - ) -{ - return TRUE; -} - - -/* - * @implemented - */ -LPVOID -WINAPI -LockResource ( - HGLOBAL hResData - ) -{ - return (LPVOID)hResData; -} - - -/* - * @implemented - */ -HANDLE -WINAPI -BeginUpdateResourceW ( - LPCWSTR pFileName, - BOOL bDeleteExistingResources - ) +HANDLE WINAPI BeginUpdateResourceW( LPCWSTR pFileName, BOOL bDeleteExistingResources ) { QUEUEDUPDATES *updates = NULL; HANDLE hUpdate, file, ret = NULL; - DPRINT("%s, %d\n", pFileName, bDeleteExistingResources); + TRACE("%s, %d\n", debugstr_w(pFileName), bDeleteExistingResources); hUpdate = GlobalAlloc(GHND, sizeof(QUEUEDUPDATES)); if (!hUpdate) @@ -1302,15 +1630,10 @@ BeginUpdateResourceW ( } -/* - * @implemented +/*********************************************************************** + * BeginUpdateResourceA (KERNEL32.@) */ -HANDLE -WINAPI -BeginUpdateResourceA ( - LPCSTR pFileName, - BOOL bDeleteExistingResources - ) +HANDLE WINAPI BeginUpdateResourceA( LPCSTR pFileName, BOOL bDeleteExistingResources ) { UNICODE_STRING FileNameW; HANDLE ret; @@ -1321,20 +1644,15 @@ BeginUpdateResourceA ( } -/* - * @implemented +/*********************************************************************** + * EndUpdateResourceW (KERNEL32.@) */ -BOOL -WINAPI -EndUpdateResourceW ( - HANDLE hUpdate, - BOOL fDiscard - ) +BOOL WINAPI EndUpdateResourceW( HANDLE hUpdate, BOOL fDiscard ) { QUEUEDUPDATES *updates; BOOL ret; - DPRINT("%p %d\n", hUpdate, fDiscard); + TRACE("%p %d\n", hUpdate, fDiscard); updates = GlobalLock(hUpdate); if (!updates) @@ -1352,419 +1670,66 @@ EndUpdateResourceW ( } -/* - * @implemented +/*********************************************************************** + * EndUpdateResourceA (KERNEL32.@) */ -BOOL -WINAPI -EndUpdateResourceA ( - HANDLE hUpdate, - BOOL fDiscard - ) +BOOL WINAPI EndUpdateResourceA( HANDLE hUpdate, BOOL fDiscard ) { - return EndUpdateResourceW( - hUpdate, - fDiscard - ); + return EndUpdateResourceW(hUpdate, fDiscard); } -/* - * @implemented +/*********************************************************************** + * UpdateResourceW (KERNEL32.@) */ -BOOL -WINAPI -EnumResourceLanguagesW( - HMODULE hmod, - LPCWSTR type, - LPCWSTR name, - ENUMRESLANGPROCW lpfun, - LONG_PTR lparam - ) -{ - int i; - BOOL ret = FALSE; - NTSTATUS status; - UNICODE_STRING typeW, nameW; - LDR_RESOURCE_INFO info; - PIMAGE_RESOURCE_DIRECTORY basedir, resdir; - PIMAGE_RESOURCE_DIRECTORY_ENTRY et; - - DPRINT( "%p %s %s %p %lx\n", hmod, type, name, lpfun, lparam ); - - if (!hmod) hmod = GetModuleHandleW( NULL ); - typeW.Buffer = nameW.Buffer = NULL; - if ((status = LdrFindResourceDirectory_U( hmod, NULL, 0, &basedir )) != STATUS_SUCCESS) - goto done; - if ((status = get_res_nameW( type, &typeW )) != STATUS_SUCCESS) - goto done; - if ((status = get_res_nameW( name, &nameW )) != STATUS_SUCCESS) - goto done; - info.Type = (ULONG_PTR)typeW.Buffer; - info.Name = (ULONG_PTR)nameW.Buffer; - if ((status = LdrFindResourceDirectory_U( hmod, &info, 2, &resdir )) != STATUS_SUCCESS) - goto done; - - et = (PIMAGE_RESOURCE_DIRECTORY_ENTRY)(resdir + 1); - for (i = 0; i < resdir->NumberOfNamedEntries + resdir->NumberOfIdEntries; i++) - { - ret = lpfun( hmod, type, name, et[i].Id, lparam ); - if (!ret) break; - } -done: - if (HIWORD(typeW.Buffer)) HeapFree( GetProcessHeap(), 0, typeW.Buffer ); - if (HIWORD(nameW.Buffer)) HeapFree( GetProcessHeap(), 0, nameW.Buffer ); - if (status != STATUS_SUCCESS) SetLastError( RtlNtStatusToDosError(status) ); - return ret; -} - - -/* - * @implemented - */ -BOOL WINAPI -EnumResourceLanguagesA( - HMODULE hmod, - LPCSTR type, - LPCSTR name, - ENUMRESLANGPROCA lpfun, - LONG_PTR lparam - ) -{ - int i; - BOOL ret = FALSE; - NTSTATUS status; - UNICODE_STRING typeW, nameW; - LDR_RESOURCE_INFO info; - PIMAGE_RESOURCE_DIRECTORY basedir, resdir; - PIMAGE_RESOURCE_DIRECTORY_ENTRY et; - - DPRINT( "%p %s %s %p %lx\n", hmod, type, name, lpfun, lparam ); - - if (!hmod) hmod = GetModuleHandleA( NULL ); - typeW.Buffer = nameW.Buffer = NULL; - if ((status = LdrFindResourceDirectory_U( hmod, NULL, 0, &basedir )) != STATUS_SUCCESS) - goto done; - if ((status = get_res_nameA( type, &typeW )) != STATUS_SUCCESS) - goto done; - if ((status = get_res_nameA( name, &nameW )) != STATUS_SUCCESS) - goto done; - info.Type = (ULONG_PTR)typeW.Buffer; - info.Name = (ULONG_PTR)nameW.Buffer; - if ((status = LdrFindResourceDirectory_U( hmod, &info, 2, &resdir )) != STATUS_SUCCESS) - goto done; - - et = (PIMAGE_RESOURCE_DIRECTORY_ENTRY)(resdir + 1); - for (i = 0; i < resdir->NumberOfNamedEntries + resdir->NumberOfIdEntries; i++) - { - ret = lpfun( hmod, type, name, et[i].Id, lparam ); - if (!ret) break; - } -done: - if (HIWORD(typeW.Buffer)) HeapFree( GetProcessHeap(), 0, typeW.Buffer ); - if (HIWORD(nameW.Buffer)) HeapFree( GetProcessHeap(), 0, nameW.Buffer ); - if (status != STATUS_SUCCESS) SetLastError( RtlNtStatusToDosError(status) ); - return ret; -} - - -/********************************************************************** - * EnumResourceNamesA (KERNEL32.@) - */ -BOOL WINAPI EnumResourceNamesA( HMODULE hmod, LPCSTR type, ENUMRESNAMEPROCA lpfun, LONG_PTR lparam ) -{ - int i; - BOOL ret = FALSE; - DWORD len = 0, newlen; - LPSTR name = NULL; - NTSTATUS status; - UNICODE_STRING typeW; - LDR_RESOURCE_INFO info; - PIMAGE_RESOURCE_DIRECTORY basedir, resdir; - const IMAGE_RESOURCE_DIRECTORY_ENTRY *et; - const IMAGE_RESOURCE_DIR_STRING_U *str; - - DPRINT( "%p %s %p %lx\n", hmod, type, lpfun, lparam ); - - if (!hmod) hmod = GetModuleHandleA( NULL ); - typeW.Buffer = NULL; - if ((status = LdrFindResourceDirectory_U( hmod, NULL, 0, &basedir )) != STATUS_SUCCESS) - goto done; - if ((status = get_res_nameA( type, &typeW )) != STATUS_SUCCESS) - goto done; - info.Type = (ULONG)typeW.Buffer; - if ((status = LdrFindResourceDirectory_U( hmod, &info, 1, &resdir )) != STATUS_SUCCESS) - goto done; - - et = (IMAGE_RESOURCE_DIRECTORY_ENTRY *)(resdir + 1); - for (i = 0; i < resdir->NumberOfNamedEntries+resdir->NumberOfIdEntries; i++) - { - if (et[i].NameIsString) - { - str = (IMAGE_RESOURCE_DIR_STRING_U *) ((LPBYTE) basedir + et[i].NameOffset); - newlen = WideCharToMultiByte(CP_ACP, 0, str->NameString, str->Length, NULL, 0, NULL, NULL); - if (newlen + 1 > len) - { - len = newlen + 1; - HeapFree( GetProcessHeap(), 0, name ); - if (!(name = HeapAlloc(GetProcessHeap(), 0, len + 1 ))) - { - ret = FALSE; - break; - } - } - WideCharToMultiByte( CP_ACP, 0, str->NameString, str->Length, name, len, NULL, NULL ); - name[newlen] = 0; - ret = lpfun(hmod,type,name,lparam); - } - else - { - ret = lpfun( hmod, type, (LPSTR)(int)et[i].Id, lparam ); - } - if (!ret) break; - } -done: - HeapFree( GetProcessHeap(), 0, name ); - if (HIWORD(typeW.Buffer)) HeapFree( GetProcessHeap(), 0, typeW.Buffer ); - if (status != STATUS_SUCCESS) SetLastError( RtlNtStatusToDosError(status) ); - return ret; -} - - -/********************************************************************** - * EnumResourceNamesW (KERNEL32.@) - */ -BOOL WINAPI EnumResourceNamesW( HMODULE hmod, LPCWSTR type, ENUMRESNAMEPROCW lpfun, LONG_PTR lparam ) -{ - int i, len = 0; - BOOL ret = FALSE; - LPWSTR name = NULL; - NTSTATUS status; - UNICODE_STRING typeW; - LDR_RESOURCE_INFO info; - PIMAGE_RESOURCE_DIRECTORY basedir, resdir; - const IMAGE_RESOURCE_DIRECTORY_ENTRY *et; - const IMAGE_RESOURCE_DIR_STRING_U *str; - - DPRINT( "%p %s %p %lx\n", hmod, type, lpfun, lparam ); - - if (!hmod) hmod = GetModuleHandleW( NULL ); - typeW.Buffer = NULL; - if ((status = LdrFindResourceDirectory_U( hmod, NULL, 0, &basedir )) != STATUS_SUCCESS) - goto done; - if ((status = get_res_nameW( type, &typeW )) != STATUS_SUCCESS) - goto done; - info.Type = (ULONG)typeW.Buffer; - if ((status = LdrFindResourceDirectory_U( hmod, &info, 1, &resdir )) != STATUS_SUCCESS) - goto done; - - et = (PIMAGE_RESOURCE_DIRECTORY_ENTRY)(resdir + 1); - for (i = 0; i < resdir->NumberOfNamedEntries+resdir->NumberOfIdEntries; i++) - { - if (et[i].NameIsString) - { - str = (IMAGE_RESOURCE_DIR_STRING_U *) ((LPBYTE) basedir + et[i].NameOffset); - if (str->Length + 1 > len) - { - len = str->Length + 1; - HeapFree( GetProcessHeap(), 0, name ); - if (!(name = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) - { - ret = FALSE; - break; - } - } - memcpy(name, str->NameString, str->Length * sizeof (WCHAR)); - name[str->Length] = 0; - ret = lpfun(hmod,type,name,lparam); - } - else - { - ret = lpfun( hmod, type, (LPWSTR)(int)et[i].Id, lparam ); - } - if (!ret) break; - } -done: - HeapFree( GetProcessHeap(), 0, name ); - if (HIWORD(typeW.Buffer)) HeapFree( GetProcessHeap(), 0, typeW.Buffer ); - if (status != STATUS_SUCCESS) SetLastError( RtlNtStatusToDosError(status) ); - return ret; -} - -/* - * @implemented - */ -BOOL -WINAPI -EnumResourceTypesW ( - HMODULE hmod, - ENUMRESTYPEPROCW lpfun, - LONG_PTR lparam - ) -{ - int i, len = 0; - BOOL ret = FALSE; - LPWSTR type = NULL; - NTSTATUS status; - PIMAGE_RESOURCE_DIRECTORY resdir; - PIMAGE_RESOURCE_DIRECTORY_ENTRY et; - PIMAGE_RESOURCE_DIR_STRING_U str; - - DPRINT( "%p %p %lx\n", hmod, lpfun, lparam ); - - if (!hmod) hmod = GetModuleHandleW( NULL ); - - if ((status = LdrFindResourceDirectory_U( hmod, NULL, 0, &resdir )) != STATUS_SUCCESS) - { - SetLastError( RtlNtStatusToDosError(status) ); - return FALSE; - } - et = (PIMAGE_RESOURCE_DIRECTORY_ENTRY)(resdir + 1); - for (i = 0; i < resdir->NumberOfNamedEntries + resdir->NumberOfIdEntries; i++) - { - if (et[i].NameIsString) - { - str = (PIMAGE_RESOURCE_DIR_STRING_U)((const BYTE *)resdir + et[i].NameOffset); - if (str->Length + 1 > len) - { - len = str->Length + 1; - HeapFree( GetProcessHeap(), 0, type ); - if (!(type = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return FALSE; - } - memcpy(type, str->NameString, str->Length * sizeof (WCHAR)); - type[str->Length] = 0; - ret = lpfun(hmod,type,lparam); - } - else - { - ret = lpfun( hmod, UIntToPtr(et[i].Id), lparam ); - } - if (!ret) break; - } - HeapFree( GetProcessHeap(), 0, type ); - return ret; -} - - -/* - * @implemented - */ -BOOL -WINAPI -EnumResourceTypesA ( - HMODULE hmod, - ENUMRESTYPEPROCA lpfun, - LONG_PTR lparam - ) -{ - int i; - BOOL ret = FALSE; - LPSTR type = NULL; - DWORD len = 0, newlen; - NTSTATUS status; - PIMAGE_RESOURCE_DIRECTORY resdir; - PIMAGE_RESOURCE_DIRECTORY_ENTRY et; - PIMAGE_RESOURCE_DIR_STRING_U str; - - DPRINT( "%p %p %lx\n", hmod, lpfun, lparam ); - - if (!hmod) hmod = GetModuleHandleA( NULL ); - - if ((status = LdrFindResourceDirectory_U( hmod, NULL, 0, &resdir )) != STATUS_SUCCESS) - { - SetLastError( RtlNtStatusToDosError(status) ); - return FALSE; - } - et = (PIMAGE_RESOURCE_DIRECTORY_ENTRY)(resdir + 1); - for (i = 0; i < resdir->NumberOfNamedEntries+resdir->NumberOfIdEntries; i++) - { - if (et[i].NameIsString) - { - str = (PIMAGE_RESOURCE_DIR_STRING_U)((const BYTE *)resdir + et[i].NameOffset); - newlen = WideCharToMultiByte( CP_ACP, 0, str->NameString, str->Length, NULL, 0, NULL, NULL); - if (newlen + 1 > len) - { - len = newlen + 1; - HeapFree( GetProcessHeap(), 0, type ); - if (!(type = HeapAlloc( GetProcessHeap(), 0, len ))) return FALSE; - } - WideCharToMultiByte( CP_ACP, 0, str->NameString, str->Length, type, len, NULL, NULL); - type[newlen] = 0; - ret = lpfun(hmod,type,lparam); - } - else - { - ret = lpfun( hmod, UIntToPtr(et[i].Id), lparam ); - } - if (!ret) break; - } - HeapFree( GetProcessHeap(), 0, type ); - return ret; -} - - -/* - * @implemented - */ -BOOL -WINAPI -UpdateResourceA ( - HANDLE hUpdate, - LPCSTR lpType, - LPCSTR lpName, - WORD wLanguage, - LPVOID lpData, - DWORD cbData - ) -{ - BOOL ret; - UNICODE_STRING TypeW; - UNICODE_STRING NameW; - if(!HIWORD(lpType)) - TypeW.Buffer = ULongToPtr(LOWORD(lpType)); - else - RtlCreateUnicodeStringFromAsciiz(&TypeW, lpType); - if(!HIWORD(lpName)) - NameW.Buffer = ULongToPtr(LOWORD(lpName)); - else - RtlCreateUnicodeStringFromAsciiz(&NameW, lpName); - ret = UpdateResourceW(hUpdate, TypeW.Buffer, NameW.Buffer, wLanguage, lpData, cbData); - if(HIWORD(lpType)) RtlFreeUnicodeString(&TypeW); - if(HIWORD(lpName)) RtlFreeUnicodeString(&NameW); - return ret; -} - - -/* - * @implemented - */ -BOOL -WINAPI -UpdateResourceW ( - HANDLE hUpdate, - LPCWSTR lpType, - LPCWSTR lpName, - WORD wLanguage, - LPVOID lpData, - DWORD cbData - ) +BOOL WINAPI UpdateResourceW( HANDLE hUpdate, LPCWSTR lpType, LPCWSTR lpName, + WORD wLanguage, LPVOID lpData, DWORD cbData) { QUEUEDUPDATES *updates; BOOL ret = FALSE; - DPRINT("%p %s %s %08x %p %d\n", hUpdate, - lpType, lpName, wLanguage, lpData, cbData); + TRACE("%p %s %s %08x %p %d\n", hUpdate, + debugstr_w(lpType), debugstr_w(lpName), wLanguage, lpData, cbData); updates = GlobalLock(hUpdate); if (updates) { - struct resource_data *data; - data = allocate_resource_data( wLanguage, 0, lpData, cbData, TRUE ); - if (data) - ret = update_add_resource( updates, lpType, lpName, data, TRUE ); + if (lpData == NULL && cbData == 0) /* remove resource */ + { + ret = update_add_resource( updates, lpType, lpName, wLanguage, NULL, TRUE ); + } + else + { + struct resource_data *data; + data = allocate_resource_data( wLanguage, 0, lpData, cbData, TRUE ); + if (data) + ret = update_add_resource( updates, lpType, lpName, wLanguage, data, TRUE ); + } GlobalUnlock(hUpdate); } return ret; } -/* EOF */ + +/*********************************************************************** + * UpdateResourceA (KERNEL32.@) + */ +BOOL WINAPI UpdateResourceA( HANDLE hUpdate, LPCSTR lpType, LPCSTR lpName, + WORD wLanguage, LPVOID lpData, DWORD cbData) +{ + BOOL ret; + UNICODE_STRING TypeW; + UNICODE_STRING NameW; + if(IS_INTRESOURCE(lpType)) + TypeW.Buffer = ULongToPtr(LOWORD(lpType)); + else + RtlCreateUnicodeStringFromAsciiz(&TypeW, lpType); + if(IS_INTRESOURCE(lpName)) + NameW.Buffer = ULongToPtr(LOWORD(lpName)); + else + RtlCreateUnicodeStringFromAsciiz(&NameW, lpName); + ret = UpdateResourceW(hUpdate, TypeW.Buffer, NameW.Buffer, wLanguage, lpData, cbData); + if(!IS_INTRESOURCE(lpType)) RtlFreeUnicodeString(&TypeW); + if(!IS_INTRESOURCE(lpName)) RtlFreeUnicodeString(&NameW); + return ret; +} diff --git a/dll/win32/kernel32/misc/time.c b/dll/win32/kernel32/wine/timezone.c similarity index 53% rename from dll/win32/kernel32/misc/time.c rename to dll/win32/kernel32/wine/timezone.c index 5912cfc823b..44ee45bb5ab 100644 --- a/dll/win32/kernel32/misc/time.c +++ b/dll/win32/kernel32/wine/timezone.c @@ -19,20 +19,6 @@ /* TYPES *********************************************************************/ -typedef struct __DOSTIME -{ - WORD Second:5; - WORD Minute:6; - WORD Hour:5; -} DOSTIME, *PDOSTIME; - -typedef struct __DOSDATE -{ - WORD Day:5; - WORD Month:4; - WORD Year:5; -} DOSDATE, *PDOSDATE; - #define TICKSPERMIN 600000000 #define LL2FILETIME( ll, pft )\ @@ -257,286 +243,6 @@ TIME_GetTimezoneBias(const TIME_ZONE_INFORMATION *pTZinfo, FILETIME *lpFileTime, /* FUNCTIONS ****************************************************************/ -/* - * @implemented - */ -BOOL -WINAPI -FileTimeToDosDateTime(CONST FILETIME *lpFileTime, - LPWORD lpFatDate, - LPWORD lpFatTime) -{ - PDOSTIME pdtime=(PDOSTIME) lpFatTime; - PDOSDATE pddate=(PDOSDATE) lpFatDate; - SYSTEMTIME SystemTime = { 0, 0, 0, 0, 0, 0, 0, 0 }; - - if (lpFileTime == NULL) - return FALSE; - - if (lpFatDate == NULL) - return FALSE; - - if (lpFatTime == NULL) - return FALSE; - - FileTimeToSystemTime(lpFileTime, &SystemTime); - - pdtime->Second = SystemTime.wSecond / 2; - pdtime->Minute = SystemTime.wMinute; - pdtime->Hour = SystemTime.wHour; - - pddate->Day = SystemTime.wDay; - pddate->Month = SystemTime.wMonth; - pddate->Year = SystemTime.wYear - 1980; - - return TRUE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -DosDateTimeToFileTime(WORD wFatDate, - WORD wFatTime, - LPFILETIME lpFileTime) -{ - PDOSTIME pdtime = (PDOSTIME) &wFatTime; - PDOSDATE pddate = (PDOSDATE) &wFatDate; - SYSTEMTIME SystemTime; - - if (lpFileTime == NULL) - return FALSE; - - SystemTime.wMilliseconds = 0; - SystemTime.wSecond = pdtime->Second * 2; - SystemTime.wMinute = pdtime->Minute; - SystemTime.wHour = pdtime->Hour; - - SystemTime.wDay = pddate->Day; - SystemTime.wMonth = pddate->Month; - SystemTime.wYear = 1980 + pddate->Year; - - if (SystemTimeToFileTime(&SystemTime, lpFileTime) == FALSE) - { - return FALSE; - } - - return TRUE; -} - - -/* - * @implemented - */ -LONG -WINAPI -CompareFileTime(CONST FILETIME *lpFileTime1, CONST FILETIME *lpFileTime2) -{ - if (lpFileTime1 == NULL) - return 0; - if (lpFileTime2 == NULL) - return 0; - - if (*((PLONGLONG)lpFileTime1) > *((PLONGLONG)lpFileTime2)) - return 1; - else if (*((PLONGLONG)lpFileTime1) < *((PLONGLONG)lpFileTime2)) - return -1; - - return 0; -} - - -/* - * @implemented - */ -VOID -WINAPI -GetSystemTimeAsFileTime(PFILETIME lpFileTime) -{ - do - { - lpFileTime->dwHighDateTime = SharedUserData->SystemTime.High1Time; - lpFileTime->dwLowDateTime = SharedUserData->SystemTime.LowPart; - } - while (lpFileTime->dwHighDateTime != (DWORD)SharedUserData->SystemTime.High2Time); -} - - -/* - * @implemented - */ -BOOL -WINAPI -SystemTimeToFileTime(CONST SYSTEMTIME *lpSystemTime, LPFILETIME lpFileTime) -{ - TIME_FIELDS TimeFields; - LARGE_INTEGER liTime; - - TimeFields.Year = lpSystemTime->wYear; - TimeFields.Month = lpSystemTime->wMonth; - TimeFields.Day = lpSystemTime->wDay; - TimeFields.Hour = lpSystemTime->wHour; - TimeFields.Minute = lpSystemTime->wMinute; - TimeFields.Second = lpSystemTime->wSecond; - TimeFields.Milliseconds = lpSystemTime->wMilliseconds; - - if (RtlTimeFieldsToTime (&TimeFields, &liTime)) - { - lpFileTime->dwLowDateTime = liTime.u.LowPart; - lpFileTime->dwHighDateTime = liTime.u.HighPart; - return TRUE; - } - - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -FileTimeToSystemTime(CONST FILETIME *lpFileTime, LPSYSTEMTIME lpSystemTime) -{ - TIME_FIELDS TimeFields; - LARGE_INTEGER liTime; - - if (lpFileTime->dwHighDateTime & 0x80000000) - return FALSE; - - liTime.u.LowPart = lpFileTime->dwLowDateTime; - liTime.u.HighPart = lpFileTime->dwHighDateTime; - - RtlTimeToTimeFields(&liTime, &TimeFields); - - lpSystemTime->wYear = TimeFields.Year; - lpSystemTime->wMonth = TimeFields.Month; - lpSystemTime->wDay = TimeFields.Day; - lpSystemTime->wHour = TimeFields.Hour; - lpSystemTime->wMinute = TimeFields.Minute; - lpSystemTime->wSecond = TimeFields.Second; - lpSystemTime->wMilliseconds = TimeFields.Milliseconds; - lpSystemTime->wDayOfWeek = TimeFields.Weekday; - - return TRUE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -FileTimeToLocalFileTime(CONST FILETIME *lpFileTime, LPFILETIME lpLocalFileTime) -{ - LARGE_INTEGER TimeZoneBias; - - do - { - TimeZoneBias.HighPart = SharedUserData->TimeZoneBias.High1Time; - TimeZoneBias.LowPart = SharedUserData->TimeZoneBias.LowPart; - } - while (TimeZoneBias.HighPart != SharedUserData->TimeZoneBias.High2Time); - - *((PLONGLONG)lpLocalFileTime) = *((PLONGLONG)lpFileTime) - TimeZoneBias.QuadPart; - - return TRUE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -LocalFileTimeToFileTime(CONST FILETIME *lpLocalFileTime, LPFILETIME lpFileTime) -{ - LARGE_INTEGER TimeZoneBias; - - do - { - TimeZoneBias.HighPart = SharedUserData->TimeZoneBias.High1Time; - TimeZoneBias.LowPart = SharedUserData->TimeZoneBias.LowPart; - } - while (TimeZoneBias.HighPart != SharedUserData->TimeZoneBias.High2Time); - - *((PLONGLONG)lpFileTime) = *((PLONGLONG)lpLocalFileTime) + TimeZoneBias.QuadPart; - - return TRUE; -} - - -/* - * @implemented - */ -VOID -WINAPI -GetLocalTime(LPSYSTEMTIME lpSystemTime) -{ - FILETIME FileTime; - FILETIME LocalFileTime; - - GetSystemTimeAsFileTime(&FileTime); - FileTimeToLocalFileTime(&FileTime, &LocalFileTime); - FileTimeToSystemTime(&LocalFileTime, lpSystemTime); -} - - -/* - * @implemented - */ -VOID -WINAPI -GetSystemTime(LPSYSTEMTIME lpSystemTime) -{ - FILETIME FileTime; - - GetSystemTimeAsFileTime(&FileTime); - FileTimeToSystemTime(&FileTime, lpSystemTime); -} - - -/* - * @implemented - */ -BOOL -WINAPI -SetLocalTime(CONST SYSTEMTIME *lpSystemTime) -{ - FILETIME LocalFileTime; - LARGE_INTEGER FileTime; - NTSTATUS Status; - - SystemTimeToFileTime(lpSystemTime, &LocalFileTime); - LocalFileTimeToFileTime(&LocalFileTime, (FILETIME *)&FileTime); - Status = NtSetSystemTime(&FileTime, &FileTime); - if (!NT_SUCCESS(Status)) - return FALSE; - return TRUE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -SetSystemTime(CONST SYSTEMTIME *lpSystemTime) -{ - LARGE_INTEGER NewSystemTime; - NTSTATUS Status; - - SystemTimeToFileTime(lpSystemTime, (PFILETIME)&NewSystemTime); - Status = NtSetSystemTime(&NewSystemTime, &NewSystemTime); - if (!NT_SUCCESS(Status)) - return FALSE; - return TRUE; -} - - /* * @implemented */ @@ -554,7 +260,7 @@ GetTimeZoneInformation(LPTIME_ZONE_INFORMATION lpTimeZoneInformation) NULL); if (!NT_SUCCESS(Status)) { - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return TIME_ZONE_ID_INVALID; } @@ -577,7 +283,7 @@ SetTimeZoneInformation(CONST TIME_ZONE_INFORMATION *lpTimeZoneInformation) if (!NT_SUCCESS(Status)) { DPRINT1("RtlSetTimeZoneInformation() failed (Status %lx)\n", Status); - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } @@ -587,55 +293,13 @@ SetTimeZoneInformation(CONST TIME_ZONE_INFORMATION *lpTimeZoneInformation) if (!NT_SUCCESS(Status)) { DPRINT1("NtSetSystemInformation() failed (Status %lx)\n", Status); - SetLastErrorByStatus(Status); + BaseSetLastNTError(Status); return FALSE; } return TRUE; } - -/* - * @implemented - */ -DWORD -WINAPI -GetTickCount(VOID) -{ - /* Call the 64-bit version */ - return (DWORD)GetTickCount64(); -} - - -/* - * @implemented - */ -ULONGLONG -WINAPI -GetTickCount64(VOID) -{ - ULONG Multiplier; - LARGE_INTEGER TickCount; - - /* Loop until we get a perfect match */ - for (;;) - { - /* Read the tick count value */ - TickCount.HighPart = SharedUserData->TickCount.High1Time; - TickCount.LowPart = SharedUserData->TickCount.LowPart; - if (TickCount.HighPart == SharedUserData->TickCount.High2Time) break; - YieldProcessor(); - } - - /* Get the multiplier */ - Multiplier = SharedUserData->TickCountMultiplier; - - /* Convert to milliseconds and return */ - return (Int64ShrlMod32(UInt32x32To64(Multiplier, TickCount.LowPart), 24) + - (Multiplier * (TickCount.HighPart << 8))); -} - - /* * @implemented */ @@ -715,100 +379,4 @@ TzSpecificLocalTimeToSystemTime(LPTIME_ZONE_INFORMATION lpTimeZoneInformation, return FileTimeToSystemTime(&ft, lpUniversalTime); } - -/* - * @implemented - */ -BOOL -WINAPI -GetSystemTimeAdjustment(PDWORD lpTimeAdjustment, - PDWORD lpTimeIncrement, - PBOOL lpTimeAdjustmentDisabled) -{ - SYSTEM_QUERY_TIME_ADJUST_INFORMATION Buffer; - NTSTATUS Status; - - Status = NtQuerySystemInformation(SystemTimeAdjustmentInformation, - &Buffer, - sizeof(SYSTEM_QUERY_TIME_ADJUST_INFORMATION), - NULL); - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return FALSE; - } - - *lpTimeAdjustment = (DWORD)Buffer.TimeAdjustment; - *lpTimeIncrement = (DWORD)Buffer.TimeIncrement; - *lpTimeAdjustmentDisabled = (BOOL)Buffer.Enable; - - return TRUE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -SetSystemTimeAdjustment(DWORD dwTimeAdjustment, - BOOL bTimeAdjustmentDisabled) -{ - NTSTATUS Status; - SYSTEM_SET_TIME_ADJUST_INFORMATION Buffer; - - Buffer.TimeAdjustment = (ULONG)dwTimeAdjustment; - Buffer.Enable = (BOOLEAN)bTimeAdjustmentDisabled; - - Status = NtSetSystemInformation(SystemTimeAdjustmentInformation, - &Buffer, - sizeof(SYSTEM_SET_TIME_ADJUST_INFORMATION)); - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return FALSE; - } - - return TRUE; -} - - -/* - * @implemented - */ -BOOL -WINAPI -GetSystemTimes(LPFILETIME lpIdleTime, - LPFILETIME lpKernelTime, - LPFILETIME lpUserTime) -{ - SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION SysProcPerfInfo; - NTSTATUS Status; - - Status = ZwQuerySystemInformation(SystemProcessorPerformanceInformation, - &SysProcPerfInfo, - sizeof(SysProcPerfInfo), - NULL); - - if (!NT_SUCCESS(Status)) - { - SetLastErrorByStatus(Status); - return FALSE; - } -/* - Good only for one processor system. - */ - - lpIdleTime->dwLowDateTime = SysProcPerfInfo.IdleTime.LowPart; - lpIdleTime->dwHighDateTime = SysProcPerfInfo.IdleTime.HighPart; - - lpKernelTime->dwLowDateTime = SysProcPerfInfo.KernelTime.LowPart; - lpKernelTime->dwHighDateTime = SysProcPerfInfo.KernelTime.HighPart; - - lpUserTime->dwLowDateTime = SysProcPerfInfo.UserTime.LowPart; - lpUserTime->dwHighDateTime = SysProcPerfInfo.UserTime.HighPart; - - return TRUE; -} - /* EOF */ diff --git a/dll/win32/kernel32/lang/bg-BG.mc b/dll/win32/kernel32/winnls/lang/bg-BG.mc similarity index 100% rename from dll/win32/kernel32/lang/bg-BG.mc rename to dll/win32/kernel32/winnls/lang/bg-BG.mc diff --git a/dll/win32/kernel32/lang/de-DE.mc b/dll/win32/kernel32/winnls/lang/de-DE.mc similarity index 100% rename from dll/win32/kernel32/lang/de-DE.mc rename to dll/win32/kernel32/winnls/lang/de-DE.mc diff --git a/dll/win32/kernel32/lang/de-DE.rc b/dll/win32/kernel32/winnls/lang/de-DE.rc similarity index 100% rename from dll/win32/kernel32/lang/de-DE.rc rename to dll/win32/kernel32/winnls/lang/de-DE.rc diff --git a/dll/win32/kernel32/lang/en-US.rc b/dll/win32/kernel32/winnls/lang/en-US.rc similarity index 100% rename from dll/win32/kernel32/lang/en-US.rc rename to dll/win32/kernel32/winnls/lang/en-US.rc diff --git a/dll/win32/kernel32/lang/es-ES.rc b/dll/win32/kernel32/winnls/lang/es-ES.rc similarity index 100% rename from dll/win32/kernel32/lang/es-ES.rc rename to dll/win32/kernel32/winnls/lang/es-ES.rc diff --git a/dll/win32/kernel32/lang/pl-PL.mc b/dll/win32/kernel32/winnls/lang/pl-PL.mc similarity index 100% rename from dll/win32/kernel32/lang/pl-PL.mc rename to dll/win32/kernel32/winnls/lang/pl-PL.mc diff --git a/dll/win32/kernel32/lang/ru-RU.mc b/dll/win32/kernel32/winnls/lang/ru-RU.mc similarity index 100% rename from dll/win32/kernel32/lang/ru-RU.mc rename to dll/win32/kernel32/winnls/lang/ru-RU.mc diff --git a/dll/win32/kernel32/winnls/lang/ru-RU.rc b/dll/win32/kernel32/winnls/lang/ru-RU.rc new file mode 100644 index 00000000000..bc7ca864ce4 --- /dev/null +++ b/dll/win32/kernel32/winnls/lang/ru-RU.rc @@ -0,0 +1,161 @@ +LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT + +STRINGTABLE DISCARDABLE +BEGIN + /* Names of code pages */ + 1250 "1250 (ANSI - центрально-европейская)" + 1251 "1251 (ANSI - кириллица)" + 1252 "1252 (ANSI - латиница 1)" + 1253 "1253 (ANSI - греческая)" + 1254 "1254 (ANSI - турецкая)" + 1255 "1255 (ANSI - иврит)" + 1256 "1256 (ANSI - арабская)" + 1257 "1257 (ANSI - балтийская)" + 1258 "1258 (ANSI/OEM - вьетнамская)" + 874 "874 (ANSI/OEM - тайская)" + 932 "932 (ANSI/OEM - японская Shift-JIS)" + 936 "936 (ANSI/OEM - китайская упрощенная GBK)" + 949 "949 (ANSI/OEM - корейская)" + 950 "950 (ANSI/OEM - китайская традиционная Big5)" + + 437 "437 (OEM - США)" + 737 "737 (OEM - греческая 437G)" + 775 "775 (OEM - балтийская)" + 850 "850 (OEM - многоязычная латиница 1)" + 852 "852 (OEM - латиница 2)" + 855 "855 (OEM - кириллица традиционная)" + 857 "857 (OEM - турецкая)" + 858 "858 (OEM - многоязычная латиница 1 + Евро)" + 860 "860 (OEM - португальская)" + 861 "861 (OEM - исландская)" + 862 "862 (OEM - иврит)" + 863 "863 (OEM - франко-канадская)" + 864 "864 (OEM - арабская)" + 865 "865 (OEM - скандинавская)" + 866 "866 (OEM - русская)" + 869 "869 (OEM - греческая современная)" + + 10000 "10000 (MAC - латиница)" + 10001 "10001 (MAC - японская)" + 10002 "10002 (MAC - китайская традиционная Big5)" + 10003 "10003 (MAC - корейская)" + 10004 "10004 (MAC - арабская)" + 10005 "10005 (MAC - иврит)" + 10006 "10006 (MAC - греческая 1)" + 10007 "10007 (MAC - кириллица)" + 10008 "10008 (MAC - китайская упрощенная GB 2312)" + 10010 "10010 (MAC - румынская)" + 10017 "10017 (MAC - украинская)" + 10021 "10021 (MAC - тайская)" + 10029 "10029 (MAC - латиница 2)" + 10079 "10079 (MAC - исландская)" + 10081 "10081 (MAC - турецкая)" + 10082 "10082 (MAC - хорватская)" + + 65000 "65000 (UTF-7)" + 65001 "65001 (UTF-8)" + + 3700 "37 (IBM EBCDIC - США/Канада)" /* FIXME */ + 1026 "1026 (IBM EBCDIC - турецкая (латиница-5))" + 1047 "1047 (IBM EBCDIC - латиница 1/Open System)" + 1140 "1140 (IBM EBCDIC - США/Канада (37 + евро))" + 1141 "1141 (IBM EBCDIC - немецкая (20273 + евро))" + 1142 "1142 (IBM EBCDIC - датская/норвежская (20277 + евро))" + 1143 "1143 (IBM EBCDIC - финская/шведская (20278 + евро))" + 1144 "1144 (IBM EBCDIC - итальянская (20280 + евро))" + 1145 "1145 (IBM EBCDIC - латиноамер/испанская (20284 + евро))" + 1146 "1146 (IBM EBCDIC - британская (20285 + евро))" + 1147 "1147 (IBM EBCDIC - французская (20297 + евро))" + 1148 "1148 (IBM EBCDIC - международная (500 + евро))" + 1149 "1149 (IBM EBCDIC - исландская (20871 + евро))" + 20273 "20273 (IBM EBCDIC - немецкая)" + 20277 "20277 (IBM EBCDIC - датская/норвежская)" + 20278 "20278 (IBM EBCDIC - финская/шведская)" + 20280 "20280 (IBM EBCDIC - итальянская)" + 20284 "20284 (IBM EBCDIC - латиноамериканская/испанская)" + 20285 "20285 (IBM EBCDIC - британская)" + 20290 "20290 (IBM EBCDIC - японская расширенная катакана)" + 20297 "20297 (IBM EBCDIC - французская)" + 20420 "20420 (IBM EBCDIC - арабская)" + 20423 "20423 (IBM EBCDIC - греческая)" + 20424 "20424 (IBM EBCDIC - иврит)" + 20833 "20833 (IBM EBCDIC - корейская расширенная)" + 20838 "20838 (IBM EBCDIC - тайская)" + 20871 "20871 (IBM EBCDIC - исландская)" + 20880 "20880 (IBM EBCDIC - кириллица (русская))" + 20905 "20905 (IBM EBCDIC - турецкая)" + 20924 "20924 (IBM EBCDIC - латиница 1/Open System (1047 + евро))" + 21025 "21025 (IBM EBCDIC - кириллица (сербская, болгарская))" + 500 "500 (IBM EBCDIC - международная)" + 870 "870 (IBM EBCDIC - многоязычная/ROECE (латиница-2))" + 875 "875 (IBM EBCDIC - современная греческая)" + + 20269 "20269 (ISO 6937 диакритические знаки)" + 28591 "28591 (ISO 8859-1 латиница 1)" + 28592 "28592 (ISO 8859-2 центральноевропейская)" + 28593 "28593 (ISO 8859-3 латиница 3)" + 28594 "28594 (ISO 8859-4 балтийская)" + 28595 "28595 (ISO 8859-5 кириллица)" + 28596 "28596 (ISO 8859-6 арабская)" + 28597 "28597 (ISO 8859-7 греческая)" + 28598 "28598 (ISO 8859-8 иврит: визуальная сортировка)" + 28599 "28599 (ISO 8859-9 латиница 5)" + 28605 "28605 (ISO 8859-15 латиница 9)" + 38598 "38598 (ISO 8859-8 иврит: логическая сортировка)" + + 20105 "20105 (IA5 IRV международный алфавит №5)" + 20106 "20106 (IA5 немецкая)" + 20107 "20107 (IA5 шведская)" + 20108 "20108 (IA5 норвежская)" + + 1361 "1361 (корейская - Johab)" + 20000 "20000 (CNS - тайваньская)" + 20001 "20001 (TCA - тайваньская)" + 20002 "20002 (Eten - тайваньская)" + 20003 "20003 (IBM5550 - тайваньская)" + 20004 "20004 (TeleText - тайваньская)" + 20005 "20005 (Wang - тайваньская)" + 20127 "20127 (США-ASCII)" + 20261 "20261 (T.61)" + 20866 "20866 (русская - КОИ8)" + 21027 "21027 (расш. алф. нижний регистр)" + 21866 "21866 (украинская - КОИ8-U)" + 708 "708 (арабская - ASMO)" + 720 "720 (арабская - прозрачная ASMO)" + 20932 "20932 (JIS X 0208-1990 & 0212-1990)" + 20936 "20936 (GB2312 китайская упрощенная)" + 20949 "20949 (Korean Wansung)" + + 57002 "57002 (ISCII деванагари)" + 57003 "57003 (ISCII бенгальская)" + 57004 "57004 (ISCII тамильская)" + 57005 "57005 (ISCII телугу)" + 57006 "57006 (ISCII ассамская)" + 57007 "57007 (ISCII ория)" + 57008 "57008 (ISCII каннада)" + 57009 "57009 (ISCII малаялам)" + 57010 "57010 (ISCII гуджарати)" + 57011 "57011 (ISCII гурмухи)" + + 50930 "50930 (IBM EBCDIC - японская (с катаканой))" + 50931 "50931 (IBM EBCDIC - США/Канада и японская)" + 50933 "50933 (IBM EBCDIC - корейская и расширенная корейская)" + 50935 "50935 (IBM EBCDIC - китайская упрощенная)" + 50937 "50937 (IBM EBCDIC - США/Канада и китайская традиционная)" + 50939 "50939 (IBM EBCDIC - японская (латиница) расширенная и японская)" + + 50220 "50220 (ISO-2022 японская без полуширинной катаканы)" + 50221 "50221 (ISO-2022 японская с полуширинной катаканой)" + 50222 "50222 (ISO-2022 японская JIS X 0201-1989)" + 50225 "50225 (ISO-2022 корейская)" + 50227 "50227 (ISO-2022 китайская упрощенная)" + 50229 "50229 (ISO-2022 китайская традиционная)" + + 51932 "51932 (EUC-японская)" + 51936 "51936 (EUC-китайская упрощенная)" + 51949 "51949 (EUC-корейская)" + 51950 "51950 (EUC-китайская традиционная)" + + 52936 "52936 (HZ-GB2312 китайская упрощенная)" + 54936 "54936 (GB18030 китайская упрощенная)" +END diff --git a/dll/win32/kernel32/winnls/lang/uk-UA.rc b/dll/win32/kernel32/winnls/lang/uk-UA.rc new file mode 100644 index 00000000000..40638ae35a1 --- /dev/null +++ b/dll/win32/kernel32/winnls/lang/uk-UA.rc @@ -0,0 +1,161 @@ +LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT + +STRINGTABLE DISCARDABLE +BEGIN + /* Names of code pages */ + 1250 "1250 (ANSI - Центральна Європа)" + 1251 "1251 (ANSI - Кирилиця)" + 1252 "1252 (ANSI - Латиниця I)" + 1253 "1253 (ANSI - Грецька)" + 1254 "1254 (ANSI - Турецька)" + 1255 "1255 (ANSI - Іврит)" + 1256 "1256 (ANSI - Арабська)" + 1257 "1257 (ANSI - Балтійська)" + 1258 "1258 (ANSI/OEM - В'єтнамська)" + 874 "874 (ANSI/OEM - Тайська)" + 932 "932 (ANSI/OEM - Японська Shift-JIS)" + 936 "936 (ANSI/OEM - Китайська спрощена GBK)" + 949 "949 (ANSI/OEM - Корейська)" + 950 "950 (ANSI/OEM - Китайська традиційна Big5)" + + 437 "437 (OEM - США)" + 737 "737 (OEM - Грецька 437G)" + 775 "775 (OEM - Балтійська)" + 850 "850 (OEM - Багатомовна Латиниця I)" + 852 "852 (OEM - Латиниця II)" + 855 "855 (OEM - Кирилиця)" + 857 "857 (OEM - Турецька)" + 858 "858 (OEM - Багатомовна Латиниця I + Євро)" + 860 "860 (OEM - Португальська)" + 861 "861 (OEM - Ісландська)" + 862 "862 (OEM - Іврит)" + 863 "863 (OEM - Канадська французька)" + 864 "864 (OEM - Арабська)" + 865 "865 (OEM - Скандинавська)" + 866 "866 (OEM - Російська)" + 869 "869 (OEM - Грецька сучасна)" + + 10000 "10000 (MAC - Латиниця)" + 10001 "10001 (MAC - Японська)" + 10002 "10002 (MAC - Китайська традиційна Big5)" + 10003 "10003 (MAC - Корейська)" + 10004 "10004 (MAC - Арабська)" + 10005 "10005 (MAC - Іврит)" + 10006 "10006 (MAC - Грецька I)" + 10007 "10007 (MAC - Кирилиця)" + 10008 "10008 (MAC - Китайська спрощена GB 2312)" + 10010 "10010 (MAC - Румунська)" + 10017 "10017 (MAC - Українська)" + 10021 "10021 (MAC - Тайська)" + 10029 "10029 (MAC - Латиниця II)" + 10079 "10079 (MAC - Ісландська)" + 10081 "10081 (MAC - Турецька)" + 10082 "10082 (MAC - Хорватська)" + + 65000 "65000 (UTF-7)" + 65001 "65001 (UTF-8)" + + 3700 "37 (IBM EBCDIC - США/Канада)" /* FIXME */ + 1026 "1026 (IBM EBCDIC - Турецька (Латиниця-5))" + 1047 "1047 (IBM EBCDIC - Латиниця-1/Open System)" + 1140 "1140 (IBM EBCDIC - США/Канада (37 + Євро))" + 1141 "1141 (IBM EBCDIC - Німецька (20273 + Євро))" + 1142 "1142 (IBM EBCDIC - Датська/Норвезька (20277 + Євро))" + 1143 "1143 (IBM EBCDIC - Фінська/Шведська (20278 + Євро))" + 1144 "1144 (IBM EBCDIC - Італійська (20280 + Євро))" + 1145 "1145 (IBM EBCDIC - Латиноамер./Іспанська (20284 + Євро))" + 1146 "1146 (IBM EBCDIC - Британська (20285 + Євро))" + 1147 "1147 (IBM EBCDIC - Французька (20297 + Євро))" + 1148 "1148 (IBM EBCDIC - Міжнародна (500 + Євро))" + 1149 "1149 (IBM EBCDIC - Ісландська (20871 + Євро))" + 20273 "20273 (IBM EBCDIC - Німецька)" + 20277 "20277 (IBM EBCDIC - Датська/Норвезька)" + 20278 "20278 (IBM EBCDIC - Фінська/Шведська)" + 20280 "20280 (IBM EBCDIC - Італійська)" + 20284 "20284 (IBM EBCDIC - Латиноамер./Іспанська)" + 20285 "20285 (IBM EBCDIC - Британська)" + 20290 "20290 (IBM EBCDIC - Японська Катакана Розширена)" + 20297 "20297 (IBM EBCDIC - Французька)" + 20420 "20420 (IBM EBCDIC - Арабська)" + 20423 "20423 (IBM EBCDIC - Грецька)" + 20424 "20424 (IBM EBCDIC - Іврит)" + 20833 "20833 (IBM EBCDIC - Корейська Розширена)" + 20838 "20838 (IBM EBCDIC - Тайська)" + 20871 "20871 (IBM EBCDIC - Ісландська)" + 20880 "20880 (IBM EBCDIC - Кирилиця (Російська))" + 20905 "20905 (IBM EBCDIC - Турецька)" + 20924 "20924 (IBM EBCDIC - Латиниця-1/Open System (1047 + Євро))" + 21025 "21025 (IBM EBCDIC - Кирилиця (Сербська, Болгарська))" + 500 "500 (IBM EBCDIC - Міжнародна)" + 870 "870 (IBM EBCDIC - Багатомовна/ROECE (Латиниця-2))" + 875 "875 (IBM EBCDIC - Сучасна Грецька)" + + 20269 "20269 (ISO 6937 Діакритичні Знаки)" + 28591 "28591 (ISO 8859-1 Латиниця I)" + 28592 "28592 (ISO 8859-2 Центральноєвропейська)" + 28593 "28593 (ISO 8859-3 Латиниця 3)" + 28594 "28594 (ISO 8859-4 Балтійська)" + 28595 "28595 (ISO 8859-5 Кирилиця)" + 28596 "28596 (ISO 8859-6 Арабська)" + 28597 "28597 (ISO 8859-7 Грецька)" + 28598 "28598 (ISO 8859-8 Іврит: Візуальний Порядок)" + 28599 "28599 (ISO 8859-9 Латиниця 5)" + 28605 "28605 (ISO 8859-15 Латиниця 9)" + 38598 "38598 (ISO 8859-8 Іврит: Логічний Порядок)" + + 20105 "20105 (IA5 IRV Міжнародний Алфавіт No.5)" + 20106 "20106 (IA5 Німецька)" + 20107 "20107 (IA5 Шведська)" + 20108 "20108 (IA5 Норвезька)" + + 1361 "1361 (Корейська - Johab)" + 20000 "20000 (CNS - Тайванська)" + 20001 "20001 (TCA - Тайванська)" + 20002 "20002 (Eten - Тайванська)" + 20003 "20003 (IBM5550 - Тайванська)" + 20004 "20004 (TeleText - Тайванська)" + 20005 "20005 (Wang - Тайванська)" + 20127 "20127 (США-ASCII)" + 20261 "20261 (T.61)" + 20866 "20866 (Російська - KOI8)" + 21027 "21027 (Розш. Алф. Нижній регістр)" + 21866 "21866 (Українська - KOI8-U)" + 708 "708 (Арабська - ASMO)" + 720 "720 (Арабська - Прозора ASMO)" + 20932 "20932 (JIS X 0208-1990 & 0212-1990)" + 20936 "20936 (Китайська спрощена GB2312)" + 20949 "20949 (Корейська Wansung)" + + 57002 "57002 (ISCII Деванагарі)" + 57003 "57003 (ISCII Бенгальська)" + 57004 "57004 (ISCII Тамільська)" + 57005 "57005 (ISCII Телугу)" + 57006 "57006 (ISCII Ассамська)" + 57007 "57007 (ISCII Орія)" + 57008 "57008 (ISCII Канада)" + 57009 "57009 (ISCII Малаялам)" + 57010 "57010 (ISCII Гуджараті)" + 57011 "57011 (ISCII Гурмукхі)" + + 50930 "50930 (IBM EBCDIC - Японська (Катакана) Розширена та Японська)" + 50931 "50931 (IBM EBCDIC - США/Канада та Японська)" + 50933 "50933 (IBM EBCDIC - Корейська та Розширена Корейська)" + 50935 "50935 (IBM EBCDIC - Китайська спрощена)" + 50937 "50937 (IBM EBCDIC - США/Канада та Китайська традиційна)" + 50939 "50939 (IBM EBCDIC - Японська (Латиниця) Розширена та Японська)" + + 50220 "50220 (ISO-2022 Японська без півширинної Катакани)" + 50221 "50221 (ISO-2022 Японська з півширинною Катаканою)" + 50222 "50222 (ISO-2022 Японська JIS X 0201-1989)" + 50225 "50225 (ISO-2022 Корейська)" + 50227 "50227 (ISO-2022 Китайська спрощена)" + 50229 "50229 (ISO-2022 Китайська традиційна)" + + 51932 "51932 (EUC-Японська)" + 51936 "51936 (EUC-Китайська спрощена)" + 51949 "51949 (EUC-Корейська)" + 51950 "51950 (EUC-Китайська традиційна)" + + 52936 "52936 (HZ-GB2312 Китайська спрощена)" + 54936 "54936 (GB18030 Китайська спрощена)" +END diff --git a/dll/win32/kernel32/locale_rc.rc b/dll/win32/kernel32/winnls/locale_rc.rc similarity index 100% rename from dll/win32/kernel32/locale_rc.rc rename to dll/win32/kernel32/winnls/locale_rc.rc diff --git a/dll/win32/kernel32/nls/afk.nls b/dll/win32/kernel32/winnls/nls/afk.nls similarity index 100% rename from dll/win32/kernel32/nls/afk.nls rename to dll/win32/kernel32/winnls/nls/afk.nls diff --git a/dll/win32/kernel32/nls/ara.nls b/dll/win32/kernel32/winnls/nls/ara.nls similarity index 100% rename from dll/win32/kernel32/nls/ara.nls rename to dll/win32/kernel32/winnls/nls/ara.nls diff --git a/dll/win32/kernel32/nls/arb.nls b/dll/win32/kernel32/winnls/nls/arb.nls similarity index 100% rename from dll/win32/kernel32/nls/arb.nls rename to dll/win32/kernel32/winnls/nls/arb.nls diff --git a/dll/win32/kernel32/nls/are.nls b/dll/win32/kernel32/winnls/nls/are.nls similarity index 100% rename from dll/win32/kernel32/nls/are.nls rename to dll/win32/kernel32/winnls/nls/are.nls diff --git a/dll/win32/kernel32/nls/arg.nls b/dll/win32/kernel32/winnls/nls/arg.nls similarity index 100% rename from dll/win32/kernel32/nls/arg.nls rename to dll/win32/kernel32/winnls/nls/arg.nls diff --git a/dll/win32/kernel32/nls/arh.nls b/dll/win32/kernel32/winnls/nls/arh.nls similarity index 100% rename from dll/win32/kernel32/nls/arh.nls rename to dll/win32/kernel32/winnls/nls/arh.nls diff --git a/dll/win32/kernel32/nls/ari.nls b/dll/win32/kernel32/winnls/nls/ari.nls similarity index 100% rename from dll/win32/kernel32/nls/ari.nls rename to dll/win32/kernel32/winnls/nls/ari.nls diff --git a/dll/win32/kernel32/nls/arj.nls b/dll/win32/kernel32/winnls/nls/arj.nls similarity index 100% rename from dll/win32/kernel32/nls/arj.nls rename to dll/win32/kernel32/winnls/nls/arj.nls diff --git a/dll/win32/kernel32/nls/ark.nls b/dll/win32/kernel32/winnls/nls/ark.nls similarity index 100% rename from dll/win32/kernel32/nls/ark.nls rename to dll/win32/kernel32/winnls/nls/ark.nls diff --git a/dll/win32/kernel32/nls/arl.nls b/dll/win32/kernel32/winnls/nls/arl.nls similarity index 100% rename from dll/win32/kernel32/nls/arl.nls rename to dll/win32/kernel32/winnls/nls/arl.nls diff --git a/dll/win32/kernel32/nls/arm.nls b/dll/win32/kernel32/winnls/nls/arm.nls similarity index 100% rename from dll/win32/kernel32/nls/arm.nls rename to dll/win32/kernel32/winnls/nls/arm.nls diff --git a/dll/win32/kernel32/nls/aro.nls b/dll/win32/kernel32/winnls/nls/aro.nls similarity index 100% rename from dll/win32/kernel32/nls/aro.nls rename to dll/win32/kernel32/winnls/nls/aro.nls diff --git a/dll/win32/kernel32/nls/arq.nls b/dll/win32/kernel32/winnls/nls/arq.nls similarity index 100% rename from dll/win32/kernel32/nls/arq.nls rename to dll/win32/kernel32/winnls/nls/arq.nls diff --git a/dll/win32/kernel32/nls/ars.nls b/dll/win32/kernel32/winnls/nls/ars.nls similarity index 100% rename from dll/win32/kernel32/nls/ars.nls rename to dll/win32/kernel32/winnls/nls/ars.nls diff --git a/dll/win32/kernel32/nls/art.nls b/dll/win32/kernel32/winnls/nls/art.nls similarity index 100% rename from dll/win32/kernel32/nls/art.nls rename to dll/win32/kernel32/winnls/nls/art.nls diff --git a/dll/win32/kernel32/nls/aru.nls b/dll/win32/kernel32/winnls/nls/aru.nls similarity index 100% rename from dll/win32/kernel32/nls/aru.nls rename to dll/win32/kernel32/winnls/nls/aru.nls diff --git a/dll/win32/kernel32/nls/ary.nls b/dll/win32/kernel32/winnls/nls/ary.nls similarity index 100% rename from dll/win32/kernel32/nls/ary.nls rename to dll/win32/kernel32/winnls/nls/ary.nls diff --git a/dll/win32/kernel32/nls/aze.nls b/dll/win32/kernel32/winnls/nls/aze.nls similarity index 100% rename from dll/win32/kernel32/nls/aze.nls rename to dll/win32/kernel32/winnls/nls/aze.nls diff --git a/dll/win32/kernel32/nls/azl.nls b/dll/win32/kernel32/winnls/nls/azl.nls similarity index 100% rename from dll/win32/kernel32/nls/azl.nls rename to dll/win32/kernel32/winnls/nls/azl.nls diff --git a/dll/win32/kernel32/nls/bel.nls b/dll/win32/kernel32/winnls/nls/bel.nls similarity index 100% rename from dll/win32/kernel32/nls/bel.nls rename to dll/win32/kernel32/winnls/nls/bel.nls diff --git a/dll/win32/kernel32/nls/bgr.nls b/dll/win32/kernel32/winnls/nls/bgr.nls similarity index 100% rename from dll/win32/kernel32/nls/bgr.nls rename to dll/win32/kernel32/winnls/nls/bgr.nls diff --git a/dll/win32/kernel32/nls/brf.nls b/dll/win32/kernel32/winnls/nls/brf.nls similarity index 100% rename from dll/win32/kernel32/nls/brf.nls rename to dll/win32/kernel32/winnls/nls/brf.nls diff --git a/dll/win32/kernel32/nls/cat.nls b/dll/win32/kernel32/winnls/nls/cat.nls similarity index 100% rename from dll/win32/kernel32/nls/cat.nls rename to dll/win32/kernel32/winnls/nls/cat.nls diff --git a/dll/win32/kernel32/nls/chs.nls b/dll/win32/kernel32/winnls/nls/chs.nls similarity index 100% rename from dll/win32/kernel32/nls/chs.nls rename to dll/win32/kernel32/winnls/nls/chs.nls diff --git a/dll/win32/kernel32/nls/cht.nls b/dll/win32/kernel32/winnls/nls/cht.nls similarity index 100% rename from dll/win32/kernel32/nls/cht.nls rename to dll/win32/kernel32/winnls/nls/cht.nls diff --git a/dll/win32/kernel32/nls/csy.nls b/dll/win32/kernel32/winnls/nls/csy.nls similarity index 100% rename from dll/win32/kernel32/nls/csy.nls rename to dll/win32/kernel32/winnls/nls/csy.nls diff --git a/dll/win32/kernel32/nls/cym.nls b/dll/win32/kernel32/winnls/nls/cym.nls similarity index 100% rename from dll/win32/kernel32/nls/cym.nls rename to dll/win32/kernel32/winnls/nls/cym.nls diff --git a/dll/win32/kernel32/nls/dan.nls b/dll/win32/kernel32/winnls/nls/dan.nls similarity index 100% rename from dll/win32/kernel32/nls/dan.nls rename to dll/win32/kernel32/winnls/nls/dan.nls diff --git a/dll/win32/kernel32/nls/dea.nls b/dll/win32/kernel32/winnls/nls/dea.nls similarity index 100% rename from dll/win32/kernel32/nls/dea.nls rename to dll/win32/kernel32/winnls/nls/dea.nls diff --git a/dll/win32/kernel32/nls/dec.nls b/dll/win32/kernel32/winnls/nls/dec.nls similarity index 100% rename from dll/win32/kernel32/nls/dec.nls rename to dll/win32/kernel32/winnls/nls/dec.nls diff --git a/dll/win32/kernel32/nls/del.nls b/dll/win32/kernel32/winnls/nls/del.nls similarity index 100% rename from dll/win32/kernel32/nls/del.nls rename to dll/win32/kernel32/winnls/nls/del.nls diff --git a/dll/win32/kernel32/nls/des.nls b/dll/win32/kernel32/winnls/nls/des.nls similarity index 100% rename from dll/win32/kernel32/nls/des.nls rename to dll/win32/kernel32/winnls/nls/des.nls diff --git a/dll/win32/kernel32/nls/deu.nls b/dll/win32/kernel32/winnls/nls/deu.nls similarity index 100% rename from dll/win32/kernel32/nls/deu.nls rename to dll/win32/kernel32/winnls/nls/deu.nls diff --git a/dll/win32/kernel32/nls/div.nls b/dll/win32/kernel32/winnls/nls/div.nls similarity index 100% rename from dll/win32/kernel32/nls/div.nls rename to dll/win32/kernel32/winnls/nls/div.nls diff --git a/dll/win32/kernel32/nls/ell.nls b/dll/win32/kernel32/winnls/nls/ell.nls similarity index 100% rename from dll/win32/kernel32/nls/ell.nls rename to dll/win32/kernel32/winnls/nls/ell.nls diff --git a/dll/win32/kernel32/nls/ena.nls b/dll/win32/kernel32/winnls/nls/ena.nls similarity index 100% rename from dll/win32/kernel32/nls/ena.nls rename to dll/win32/kernel32/winnls/nls/ena.nls diff --git a/dll/win32/kernel32/nls/enb.nls b/dll/win32/kernel32/winnls/nls/enb.nls similarity index 100% rename from dll/win32/kernel32/nls/enb.nls rename to dll/win32/kernel32/winnls/nls/enb.nls diff --git a/dll/win32/kernel32/nls/enc.nls b/dll/win32/kernel32/winnls/nls/enc.nls similarity index 100% rename from dll/win32/kernel32/nls/enc.nls rename to dll/win32/kernel32/winnls/nls/enc.nls diff --git a/dll/win32/kernel32/nls/eng.nls b/dll/win32/kernel32/winnls/nls/eng.nls similarity index 100% rename from dll/win32/kernel32/nls/eng.nls rename to dll/win32/kernel32/winnls/nls/eng.nls diff --git a/dll/win32/kernel32/nls/eni.nls b/dll/win32/kernel32/winnls/nls/eni.nls similarity index 100% rename from dll/win32/kernel32/nls/eni.nls rename to dll/win32/kernel32/winnls/nls/eni.nls diff --git a/dll/win32/kernel32/nls/enj.nls b/dll/win32/kernel32/winnls/nls/enj.nls similarity index 100% rename from dll/win32/kernel32/nls/enj.nls rename to dll/win32/kernel32/winnls/nls/enj.nls diff --git a/dll/win32/kernel32/nls/enl.nls b/dll/win32/kernel32/winnls/nls/enl.nls similarity index 100% rename from dll/win32/kernel32/nls/enl.nls rename to dll/win32/kernel32/winnls/nls/enl.nls diff --git a/dll/win32/kernel32/nls/enp.nls b/dll/win32/kernel32/winnls/nls/enp.nls similarity index 100% rename from dll/win32/kernel32/nls/enp.nls rename to dll/win32/kernel32/winnls/nls/enp.nls diff --git a/dll/win32/kernel32/nls/ens.nls b/dll/win32/kernel32/winnls/nls/ens.nls similarity index 100% rename from dll/win32/kernel32/nls/ens.nls rename to dll/win32/kernel32/winnls/nls/ens.nls diff --git a/dll/win32/kernel32/nls/ent.nls b/dll/win32/kernel32/winnls/nls/ent.nls similarity index 100% rename from dll/win32/kernel32/nls/ent.nls rename to dll/win32/kernel32/winnls/nls/ent.nls diff --git a/dll/win32/kernel32/nls/enu.nls b/dll/win32/kernel32/winnls/nls/enu.nls similarity index 100% rename from dll/win32/kernel32/nls/enu.nls rename to dll/win32/kernel32/winnls/nls/enu.nls diff --git a/dll/win32/kernel32/nls/enw.nls b/dll/win32/kernel32/winnls/nls/enw.nls similarity index 100% rename from dll/win32/kernel32/nls/enw.nls rename to dll/win32/kernel32/winnls/nls/enw.nls diff --git a/dll/win32/kernel32/nls/enz.nls b/dll/win32/kernel32/winnls/nls/enz.nls similarity index 100% rename from dll/win32/kernel32/nls/enz.nls rename to dll/win32/kernel32/winnls/nls/enz.nls diff --git a/dll/win32/kernel32/nls/esa.nls b/dll/win32/kernel32/winnls/nls/esa.nls similarity index 100% rename from dll/win32/kernel32/nls/esa.nls rename to dll/win32/kernel32/winnls/nls/esa.nls diff --git a/dll/win32/kernel32/nls/esb.nls b/dll/win32/kernel32/winnls/nls/esb.nls similarity index 100% rename from dll/win32/kernel32/nls/esb.nls rename to dll/win32/kernel32/winnls/nls/esb.nls diff --git a/dll/win32/kernel32/nls/esc.nls b/dll/win32/kernel32/winnls/nls/esc.nls similarity index 100% rename from dll/win32/kernel32/nls/esc.nls rename to dll/win32/kernel32/winnls/nls/esc.nls diff --git a/dll/win32/kernel32/nls/esd.nls b/dll/win32/kernel32/winnls/nls/esd.nls similarity index 100% rename from dll/win32/kernel32/nls/esd.nls rename to dll/win32/kernel32/winnls/nls/esd.nls diff --git a/dll/win32/kernel32/nls/ese.nls b/dll/win32/kernel32/winnls/nls/ese.nls similarity index 100% rename from dll/win32/kernel32/nls/ese.nls rename to dll/win32/kernel32/winnls/nls/ese.nls diff --git a/dll/win32/kernel32/nls/esf.nls b/dll/win32/kernel32/winnls/nls/esf.nls similarity index 100% rename from dll/win32/kernel32/nls/esf.nls rename to dll/win32/kernel32/winnls/nls/esf.nls diff --git a/dll/win32/kernel32/nls/esg.nls b/dll/win32/kernel32/winnls/nls/esg.nls similarity index 100% rename from dll/win32/kernel32/nls/esg.nls rename to dll/win32/kernel32/winnls/nls/esg.nls diff --git a/dll/win32/kernel32/nls/esh.nls b/dll/win32/kernel32/winnls/nls/esh.nls similarity index 100% rename from dll/win32/kernel32/nls/esh.nls rename to dll/win32/kernel32/winnls/nls/esh.nls diff --git a/dll/win32/kernel32/nls/esi.nls b/dll/win32/kernel32/winnls/nls/esi.nls similarity index 100% rename from dll/win32/kernel32/nls/esi.nls rename to dll/win32/kernel32/winnls/nls/esi.nls diff --git a/dll/win32/kernel32/nls/esl.nls b/dll/win32/kernel32/winnls/nls/esl.nls similarity index 100% rename from dll/win32/kernel32/nls/esl.nls rename to dll/win32/kernel32/winnls/nls/esl.nls diff --git a/dll/win32/kernel32/nls/esm.nls b/dll/win32/kernel32/winnls/nls/esm.nls similarity index 100% rename from dll/win32/kernel32/nls/esm.nls rename to dll/win32/kernel32/winnls/nls/esm.nls diff --git a/dll/win32/kernel32/nls/esn.nls b/dll/win32/kernel32/winnls/nls/esn.nls similarity index 100% rename from dll/win32/kernel32/nls/esn.nls rename to dll/win32/kernel32/winnls/nls/esn.nls diff --git a/dll/win32/kernel32/nls/eso.nls b/dll/win32/kernel32/winnls/nls/eso.nls similarity index 100% rename from dll/win32/kernel32/nls/eso.nls rename to dll/win32/kernel32/winnls/nls/eso.nls diff --git a/dll/win32/kernel32/nls/esp.nls b/dll/win32/kernel32/winnls/nls/esp.nls similarity index 100% rename from dll/win32/kernel32/nls/esp.nls rename to dll/win32/kernel32/winnls/nls/esp.nls diff --git a/dll/win32/kernel32/nls/esr.nls b/dll/win32/kernel32/winnls/nls/esr.nls similarity index 100% rename from dll/win32/kernel32/nls/esr.nls rename to dll/win32/kernel32/winnls/nls/esr.nls diff --git a/dll/win32/kernel32/nls/ess.nls b/dll/win32/kernel32/winnls/nls/ess.nls similarity index 100% rename from dll/win32/kernel32/nls/ess.nls rename to dll/win32/kernel32/winnls/nls/ess.nls diff --git a/dll/win32/kernel32/nls/esu.nls b/dll/win32/kernel32/winnls/nls/esu.nls similarity index 100% rename from dll/win32/kernel32/nls/esu.nls rename to dll/win32/kernel32/winnls/nls/esu.nls diff --git a/dll/win32/kernel32/nls/esv.nls b/dll/win32/kernel32/winnls/nls/esv.nls similarity index 100% rename from dll/win32/kernel32/nls/esv.nls rename to dll/win32/kernel32/winnls/nls/esv.nls diff --git a/dll/win32/kernel32/nls/esy.nls b/dll/win32/kernel32/winnls/nls/esy.nls similarity index 100% rename from dll/win32/kernel32/nls/esy.nls rename to dll/win32/kernel32/winnls/nls/esy.nls diff --git a/dll/win32/kernel32/nls/esz.nls b/dll/win32/kernel32/winnls/nls/esz.nls similarity index 100% rename from dll/win32/kernel32/nls/esz.nls rename to dll/win32/kernel32/winnls/nls/esz.nls diff --git a/dll/win32/kernel32/nls/eti.nls b/dll/win32/kernel32/winnls/nls/eti.nls similarity index 100% rename from dll/win32/kernel32/nls/eti.nls rename to dll/win32/kernel32/winnls/nls/eti.nls diff --git a/dll/win32/kernel32/nls/euq.nls b/dll/win32/kernel32/winnls/nls/euq.nls similarity index 100% rename from dll/win32/kernel32/nls/euq.nls rename to dll/win32/kernel32/winnls/nls/euq.nls diff --git a/dll/win32/kernel32/nls/far.nls b/dll/win32/kernel32/winnls/nls/far.nls similarity index 100% rename from dll/win32/kernel32/nls/far.nls rename to dll/win32/kernel32/winnls/nls/far.nls diff --git a/dll/win32/kernel32/nls/fin.nls b/dll/win32/kernel32/winnls/nls/fin.nls similarity index 100% rename from dll/win32/kernel32/nls/fin.nls rename to dll/win32/kernel32/winnls/nls/fin.nls diff --git a/dll/win32/kernel32/nls/fos.nls b/dll/win32/kernel32/winnls/nls/fos.nls similarity index 100% rename from dll/win32/kernel32/nls/fos.nls rename to dll/win32/kernel32/winnls/nls/fos.nls diff --git a/dll/win32/kernel32/nls/fra.nls b/dll/win32/kernel32/winnls/nls/fra.nls similarity index 100% rename from dll/win32/kernel32/nls/fra.nls rename to dll/win32/kernel32/winnls/nls/fra.nls diff --git a/dll/win32/kernel32/nls/frb.nls b/dll/win32/kernel32/winnls/nls/frb.nls similarity index 100% rename from dll/win32/kernel32/nls/frb.nls rename to dll/win32/kernel32/winnls/nls/frb.nls diff --git a/dll/win32/kernel32/nls/frc.nls b/dll/win32/kernel32/winnls/nls/frc.nls similarity index 100% rename from dll/win32/kernel32/nls/frc.nls rename to dll/win32/kernel32/winnls/nls/frc.nls diff --git a/dll/win32/kernel32/nls/frl.nls b/dll/win32/kernel32/winnls/nls/frl.nls similarity index 100% rename from dll/win32/kernel32/nls/frl.nls rename to dll/win32/kernel32/winnls/nls/frl.nls diff --git a/dll/win32/kernel32/nls/frm.nls b/dll/win32/kernel32/winnls/nls/frm.nls similarity index 100% rename from dll/win32/kernel32/nls/frm.nls rename to dll/win32/kernel32/winnls/nls/frm.nls diff --git a/dll/win32/kernel32/nls/frs.nls b/dll/win32/kernel32/winnls/nls/frs.nls similarity index 100% rename from dll/win32/kernel32/nls/frs.nls rename to dll/win32/kernel32/winnls/nls/frs.nls diff --git a/dll/win32/kernel32/nls/glc.nls b/dll/win32/kernel32/winnls/nls/glc.nls similarity index 100% rename from dll/win32/kernel32/nls/glc.nls rename to dll/win32/kernel32/winnls/nls/glc.nls diff --git a/dll/win32/kernel32/nls/guj.nls b/dll/win32/kernel32/winnls/nls/guj.nls similarity index 100% rename from dll/win32/kernel32/nls/guj.nls rename to dll/win32/kernel32/winnls/nls/guj.nls diff --git a/dll/win32/kernel32/nls/heb.nls b/dll/win32/kernel32/winnls/nls/heb.nls similarity index 100% rename from dll/win32/kernel32/nls/heb.nls rename to dll/win32/kernel32/winnls/nls/heb.nls diff --git a/dll/win32/kernel32/nls/hin.nls b/dll/win32/kernel32/winnls/nls/hin.nls similarity index 100% rename from dll/win32/kernel32/nls/hin.nls rename to dll/win32/kernel32/winnls/nls/hin.nls diff --git a/dll/win32/kernel32/nls/hrv.nls b/dll/win32/kernel32/winnls/nls/hrv.nls similarity index 100% rename from dll/win32/kernel32/nls/hrv.nls rename to dll/win32/kernel32/winnls/nls/hrv.nls diff --git a/dll/win32/kernel32/nls/hun.nls b/dll/win32/kernel32/winnls/nls/hun.nls similarity index 100% rename from dll/win32/kernel32/nls/hun.nls rename to dll/win32/kernel32/winnls/nls/hun.nls diff --git a/dll/win32/kernel32/nls/hye.nls b/dll/win32/kernel32/winnls/nls/hye.nls similarity index 100% rename from dll/win32/kernel32/nls/hye.nls rename to dll/win32/kernel32/winnls/nls/hye.nls diff --git a/dll/win32/kernel32/nls/ind.nls b/dll/win32/kernel32/winnls/nls/ind.nls similarity index 100% rename from dll/win32/kernel32/nls/ind.nls rename to dll/win32/kernel32/winnls/nls/ind.nls diff --git a/dll/win32/kernel32/nls/isl.nls b/dll/win32/kernel32/winnls/nls/isl.nls similarity index 100% rename from dll/win32/kernel32/nls/isl.nls rename to dll/win32/kernel32/winnls/nls/isl.nls diff --git a/dll/win32/kernel32/nls/ita.nls b/dll/win32/kernel32/winnls/nls/ita.nls similarity index 100% rename from dll/win32/kernel32/nls/ita.nls rename to dll/win32/kernel32/winnls/nls/ita.nls diff --git a/dll/win32/kernel32/nls/its.nls b/dll/win32/kernel32/winnls/nls/its.nls similarity index 100% rename from dll/win32/kernel32/nls/its.nls rename to dll/win32/kernel32/winnls/nls/its.nls diff --git a/dll/win32/kernel32/nls/jpn.nls b/dll/win32/kernel32/winnls/nls/jpn.nls similarity index 100% rename from dll/win32/kernel32/nls/jpn.nls rename to dll/win32/kernel32/winnls/nls/jpn.nls diff --git a/dll/win32/kernel32/nls/kan.nls b/dll/win32/kernel32/winnls/nls/kan.nls similarity index 100% rename from dll/win32/kernel32/nls/kan.nls rename to dll/win32/kernel32/winnls/nls/kan.nls diff --git a/dll/win32/kernel32/nls/kat.nls b/dll/win32/kernel32/winnls/nls/kat.nls similarity index 100% rename from dll/win32/kernel32/nls/kat.nls rename to dll/win32/kernel32/winnls/nls/kat.nls diff --git a/dll/win32/kernel32/nls/kkz.nls b/dll/win32/kernel32/winnls/nls/kkz.nls similarity index 100% rename from dll/win32/kernel32/nls/kkz.nls rename to dll/win32/kernel32/winnls/nls/kkz.nls diff --git a/dll/win32/kernel32/nls/knk.nls b/dll/win32/kernel32/winnls/nls/knk.nls similarity index 100% rename from dll/win32/kernel32/nls/knk.nls rename to dll/win32/kernel32/winnls/nls/knk.nls diff --git a/dll/win32/kernel32/nls/kor.nls b/dll/win32/kernel32/winnls/nls/kor.nls similarity index 100% rename from dll/win32/kernel32/nls/kor.nls rename to dll/win32/kernel32/winnls/nls/kor.nls diff --git a/dll/win32/kernel32/nls/kyr.nls b/dll/win32/kernel32/winnls/nls/kyr.nls similarity index 100% rename from dll/win32/kernel32/nls/kyr.nls rename to dll/win32/kernel32/winnls/nls/kyr.nls diff --git a/dll/win32/kernel32/nls/lth.nls b/dll/win32/kernel32/winnls/nls/lth.nls similarity index 100% rename from dll/win32/kernel32/nls/lth.nls rename to dll/win32/kernel32/winnls/nls/lth.nls diff --git a/dll/win32/kernel32/nls/lvi.nls b/dll/win32/kernel32/winnls/nls/lvi.nls similarity index 100% rename from dll/win32/kernel32/nls/lvi.nls rename to dll/win32/kernel32/winnls/nls/lvi.nls diff --git a/dll/win32/kernel32/nls/mar.nls b/dll/win32/kernel32/winnls/nls/mar.nls similarity index 100% rename from dll/win32/kernel32/nls/mar.nls rename to dll/win32/kernel32/winnls/nls/mar.nls diff --git a/dll/win32/kernel32/nls/mki.nls b/dll/win32/kernel32/winnls/nls/mki.nls similarity index 100% rename from dll/win32/kernel32/nls/mki.nls rename to dll/win32/kernel32/winnls/nls/mki.nls diff --git a/dll/win32/kernel32/nls/mon.nls b/dll/win32/kernel32/winnls/nls/mon.nls similarity index 100% rename from dll/win32/kernel32/nls/mon.nls rename to dll/win32/kernel32/winnls/nls/mon.nls diff --git a/dll/win32/kernel32/nls/msb.nls b/dll/win32/kernel32/winnls/nls/msb.nls similarity index 100% rename from dll/win32/kernel32/nls/msb.nls rename to dll/win32/kernel32/winnls/nls/msb.nls diff --git a/dll/win32/kernel32/nls/msl.nls b/dll/win32/kernel32/winnls/nls/msl.nls similarity index 100% rename from dll/win32/kernel32/nls/msl.nls rename to dll/win32/kernel32/winnls/nls/msl.nls diff --git a/dll/win32/kernel32/nls/nlb.nls b/dll/win32/kernel32/winnls/nls/nlb.nls similarity index 100% rename from dll/win32/kernel32/nls/nlb.nls rename to dll/win32/kernel32/winnls/nls/nlb.nls diff --git a/dll/win32/kernel32/nls/nld.nls b/dll/win32/kernel32/winnls/nls/nld.nls similarity index 100% rename from dll/win32/kernel32/nls/nld.nls rename to dll/win32/kernel32/winnls/nls/nld.nls diff --git a/dll/win32/kernel32/nls/non.nls b/dll/win32/kernel32/winnls/nls/non.nls similarity index 100% rename from dll/win32/kernel32/nls/non.nls rename to dll/win32/kernel32/winnls/nls/non.nls diff --git a/dll/win32/kernel32/nls/nor.nls b/dll/win32/kernel32/winnls/nls/nor.nls similarity index 100% rename from dll/win32/kernel32/nls/nor.nls rename to dll/win32/kernel32/winnls/nls/nor.nls diff --git a/dll/win32/kernel32/nls/pan.nls b/dll/win32/kernel32/winnls/nls/pan.nls similarity index 100% rename from dll/win32/kernel32/nls/pan.nls rename to dll/win32/kernel32/winnls/nls/pan.nls diff --git a/dll/win32/kernel32/nls/plk.nls b/dll/win32/kernel32/winnls/nls/plk.nls similarity index 100% rename from dll/win32/kernel32/nls/plk.nls rename to dll/win32/kernel32/winnls/nls/plk.nls diff --git a/dll/win32/kernel32/nls/ptb.nls b/dll/win32/kernel32/winnls/nls/ptb.nls similarity index 100% rename from dll/win32/kernel32/nls/ptb.nls rename to dll/win32/kernel32/winnls/nls/ptb.nls diff --git a/dll/win32/kernel32/nls/ptg.nls b/dll/win32/kernel32/winnls/nls/ptg.nls similarity index 100% rename from dll/win32/kernel32/nls/ptg.nls rename to dll/win32/kernel32/winnls/nls/ptg.nls diff --git a/dll/win32/kernel32/nls/rmc.nls b/dll/win32/kernel32/winnls/nls/rmc.nls similarity index 100% rename from dll/win32/kernel32/nls/rmc.nls rename to dll/win32/kernel32/winnls/nls/rmc.nls diff --git a/dll/win32/kernel32/nls/rom.nls b/dll/win32/kernel32/winnls/nls/rom.nls similarity index 100% rename from dll/win32/kernel32/nls/rom.nls rename to dll/win32/kernel32/winnls/nls/rom.nls diff --git a/dll/win32/kernel32/nls/rus.nls b/dll/win32/kernel32/winnls/nls/rus.nls similarity index 100% rename from dll/win32/kernel32/nls/rus.nls rename to dll/win32/kernel32/winnls/nls/rus.nls diff --git a/dll/win32/kernel32/nls/san.nls b/dll/win32/kernel32/winnls/nls/san.nls similarity index 100% rename from dll/win32/kernel32/nls/san.nls rename to dll/win32/kernel32/winnls/nls/san.nls diff --git a/dll/win32/kernel32/nls/sky.nls b/dll/win32/kernel32/winnls/nls/sky.nls similarity index 100% rename from dll/win32/kernel32/nls/sky.nls rename to dll/win32/kernel32/winnls/nls/sky.nls diff --git a/dll/win32/kernel32/nls/slv.nls b/dll/win32/kernel32/winnls/nls/slv.nls similarity index 100% rename from dll/win32/kernel32/nls/slv.nls rename to dll/win32/kernel32/winnls/nls/slv.nls diff --git a/dll/win32/kernel32/nls/sqi.nls b/dll/win32/kernel32/winnls/nls/sqi.nls similarity index 100% rename from dll/win32/kernel32/nls/sqi.nls rename to dll/win32/kernel32/winnls/nls/sqi.nls diff --git a/dll/win32/kernel32/nls/srb.nls b/dll/win32/kernel32/winnls/nls/srb.nls similarity index 100% rename from dll/win32/kernel32/nls/srb.nls rename to dll/win32/kernel32/winnls/nls/srb.nls diff --git a/dll/win32/kernel32/nls/srl.nls b/dll/win32/kernel32/winnls/nls/srl.nls similarity index 100% rename from dll/win32/kernel32/nls/srl.nls rename to dll/win32/kernel32/winnls/nls/srl.nls diff --git a/dll/win32/kernel32/nls/sve.nls b/dll/win32/kernel32/winnls/nls/sve.nls similarity index 100% rename from dll/win32/kernel32/nls/sve.nls rename to dll/win32/kernel32/winnls/nls/sve.nls diff --git a/dll/win32/kernel32/nls/svf.nls b/dll/win32/kernel32/winnls/nls/svf.nls similarity index 100% rename from dll/win32/kernel32/nls/svf.nls rename to dll/win32/kernel32/winnls/nls/svf.nls diff --git a/dll/win32/kernel32/nls/swk.nls b/dll/win32/kernel32/winnls/nls/swk.nls similarity index 100% rename from dll/win32/kernel32/nls/swk.nls rename to dll/win32/kernel32/winnls/nls/swk.nls diff --git a/dll/win32/kernel32/nls/syr.nls b/dll/win32/kernel32/winnls/nls/syr.nls similarity index 100% rename from dll/win32/kernel32/nls/syr.nls rename to dll/win32/kernel32/winnls/nls/syr.nls diff --git a/dll/win32/kernel32/nls/tam.nls b/dll/win32/kernel32/winnls/nls/tam.nls similarity index 100% rename from dll/win32/kernel32/nls/tam.nls rename to dll/win32/kernel32/winnls/nls/tam.nls diff --git a/dll/win32/kernel32/nls/tel.nls b/dll/win32/kernel32/winnls/nls/tel.nls similarity index 100% rename from dll/win32/kernel32/nls/tel.nls rename to dll/win32/kernel32/winnls/nls/tel.nls diff --git a/dll/win32/kernel32/nls/tha.nls b/dll/win32/kernel32/winnls/nls/tha.nls similarity index 100% rename from dll/win32/kernel32/nls/tha.nls rename to dll/win32/kernel32/winnls/nls/tha.nls diff --git a/dll/win32/kernel32/nls/trk.nls b/dll/win32/kernel32/winnls/nls/trk.nls similarity index 100% rename from dll/win32/kernel32/nls/trk.nls rename to dll/win32/kernel32/winnls/nls/trk.nls diff --git a/dll/win32/kernel32/nls/ttt.nls b/dll/win32/kernel32/winnls/nls/ttt.nls similarity index 100% rename from dll/win32/kernel32/nls/ttt.nls rename to dll/win32/kernel32/winnls/nls/ttt.nls diff --git a/dll/win32/kernel32/nls/ukr.nls b/dll/win32/kernel32/winnls/nls/ukr.nls similarity index 100% rename from dll/win32/kernel32/nls/ukr.nls rename to dll/win32/kernel32/winnls/nls/ukr.nls diff --git a/dll/win32/kernel32/nls/urd.nls b/dll/win32/kernel32/winnls/nls/urd.nls similarity index 100% rename from dll/win32/kernel32/nls/urd.nls rename to dll/win32/kernel32/winnls/nls/urd.nls diff --git a/dll/win32/kernel32/nls/uzb.nls b/dll/win32/kernel32/winnls/nls/uzb.nls similarity index 100% rename from dll/win32/kernel32/nls/uzb.nls rename to dll/win32/kernel32/winnls/nls/uzb.nls diff --git a/dll/win32/kernel32/nls/uzl.nls b/dll/win32/kernel32/winnls/nls/uzl.nls similarity index 100% rename from dll/win32/kernel32/nls/uzl.nls rename to dll/win32/kernel32/winnls/nls/uzl.nls diff --git a/dll/win32/kernel32/nls/vit.nls b/dll/win32/kernel32/winnls/nls/vit.nls similarity index 100% rename from dll/win32/kernel32/nls/vit.nls rename to dll/win32/kernel32/winnls/nls/vit.nls diff --git a/dll/win32/kernel32/nls/zhh.nls b/dll/win32/kernel32/winnls/nls/zhh.nls similarity index 100% rename from dll/win32/kernel32/nls/zhh.nls rename to dll/win32/kernel32/winnls/nls/zhh.nls diff --git a/dll/win32/kernel32/nls/zhi.nls b/dll/win32/kernel32/winnls/nls/zhi.nls similarity index 100% rename from dll/win32/kernel32/nls/zhi.nls rename to dll/win32/kernel32/winnls/nls/zhi.nls diff --git a/dll/win32/kernel32/nls/zhm.nls b/dll/win32/kernel32/winnls/nls/zhm.nls similarity index 100% rename from dll/win32/kernel32/nls/zhm.nls rename to dll/win32/kernel32/winnls/nls/zhm.nls diff --git a/dll/win32/kernel32/misc/casemap.c b/dll/win32/kernel32/winnls/string/casemap.c similarity index 82% rename from dll/win32/kernel32/misc/casemap.c rename to dll/win32/kernel32/winnls/string/casemap.c index d038b895ab5..141a4172675 100644 --- a/dll/win32/kernel32/misc/casemap.c +++ b/dll/win32/kernel32/winnls/string/casemap.c @@ -3,15 +3,15 @@ #include "wine/unicode.h" -const WCHAR wine_casemap_lower[3318] = +const WCHAR wine_casemap_lower[3802] = { /* index */ - 0x01bf, 0x02bf, 0x03bf, 0x0439, 0x0539, 0x0639, 0x0100, 0x0100, + 0x01bf, 0x02bf, 0x03bf, 0x044f, 0x054f, 0x064f, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, - 0x0699, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, - 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0799, 0x0892, - 0x0100, 0x098f, 0x0100, 0x0100, 0x0a13, 0x0100, 0x0100, 0x0100, - 0x0100, 0x0100, 0x0100, 0x0100, 0x0b13, 0x0100, 0x0100, 0x0100, + 0x06af, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, + 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x07af, 0x08ae, + 0x0100, 0x09ab, 0x0100, 0x0100, 0x0a2f, 0x0100, 0x0100, 0x0100, + 0x0100, 0x0100, 0x0100, 0x0100, 0x0b2f, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, @@ -26,6 +26,7 @@ const WCHAR wine_casemap_lower[3318] = 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, + 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0c1d, 0x0cfb, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, @@ -36,8 +37,7 @@ const WCHAR wine_casemap_lower[3318] = 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, - 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, - 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0bf6, + 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0dda, /* defaults */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, @@ -162,23 +162,25 @@ const WCHAR wine_casemap_lower[3318] = 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - /* 0x0386 .. 0x03ff */ - 0x0026, 0x0000, 0x0025, 0x0025, 0x0025, 0x0000, 0x0040, 0x0000, - 0x003f, 0x003f, 0x0000, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, + /* 0x0370 .. 0x03ff */ + 0x0001, 0x0000, 0x0001, 0x0000, 0x0000, 0x0000, 0x0001, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0026, 0x0000, + 0x0025, 0x0025, 0x0025, 0x0000, 0x0040, 0x0000, 0x003f, 0x003f, + 0x0000, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, - 0x0020, 0x0020, 0x0020, 0x0020, 0x0000, 0x0020, 0x0020, 0x0020, - 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0000, 0x0000, + 0x0020, 0x0020, 0x0000, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, + 0x0020, 0x0020, 0x0020, 0x0020, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0008, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, - 0x0001, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffc4, 0x0000, - 0x0000, 0x0001, 0x0000, 0xfff9, 0x0001, 0x0000, 0x0000, 0xff7e, - 0xff7e, 0xff7e, + 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0xffc4, 0x0000, 0x0000, 0x0001, + 0x0000, 0xfff9, 0x0001, 0x0000, 0x0000, 0xff7e, 0xff7e, 0xff7e, /* 0x0400 .. 0x04ff */ 0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050, 0x0050, @@ -215,9 +217,9 @@ const WCHAR wine_casemap_lower[3318] = /* 0x0500 .. 0x05ff */ 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, - 0x0001, 0x0000, 0x0001, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, + 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, + 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, 0x0030, @@ -278,52 +280,52 @@ const WCHAR wine_casemap_lower[3318] = 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xe241, 0x0000, + 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, + 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, + 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, + 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, + 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, + 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, + 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, + 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, + 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, + 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, + 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, + 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, + /* 0x1f01 .. 0x1fff */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xfff8, + 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xfff8, + 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xfff8, + 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xfff8, + 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xfff8, + 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, - 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, - 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, - 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, - 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, - 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, - 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, - 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, - 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, - 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, - 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, - 0x0001, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - /* 0x1f07 .. 0x1fff */ - 0x0000, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, - 0xfff8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, - 0xfff8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, - 0xfff8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0xfff8, 0x0000, 0xfff8, 0x0000, 0xfff8, 0x0000, - 0xfff8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, - 0xfff8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xfff8, 0x0000, 0xfff8, 0x0000, 0xfff8, 0x0000, 0xfff8, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xfff8, + 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, - 0xfff8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, - 0xfff8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, - 0xfff8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0xfff8, 0xfff8, 0xffb6, 0xffb6, 0xfff7, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0xffaa, 0xffaa, 0xffaa, 0xffaa, 0xfff7, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0xfff8, 0xfff8, 0xff9c, 0xff9c, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0xfff8, 0xfff8, 0xff90, 0xff90, 0xfff9, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0xff80, 0xff80, 0xff82, 0xff82, 0xfff7, 0x0000, 0x0000, - 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xfff8, + 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xfff8, + 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xfff8, + 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0xfff8, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xfff8, + 0xfff8, 0xffb6, 0xffb6, 0xfff7, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffaa, + 0xffaa, 0xffaa, 0xffaa, 0xfff7, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xfff8, + 0xfff8, 0xff9c, 0xff9c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xfff8, + 0xfff8, 0xff90, 0xff90, 0xfff9, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xff80, + 0xff80, 0xff82, 0xff82, 0xfff7, 0x0000, 0x0000, 0x0000, /* 0x2103 .. 0x21ff */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, @@ -389,9 +391,9 @@ const WCHAR wine_casemap_lower[3318] = 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0001, 0x0000, 0xd609, 0xf11a, 0xd619, 0x0000, 0x0000, 0x0001, - 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0001, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0xd5e4, 0xd603, 0xd5e1, + 0xd5e2, 0x0000, 0x0001, 0x0000, 0x0000, 0x0001, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xd5c1, 0xd5c1, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, @@ -405,14 +407,74 @@ const WCHAR wine_casemap_lower[3318] = 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + /* 0xa612 .. 0xa6ff */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - /* 0xff1d .. 0xffff */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0020, 0x0020, 0x0020, 0x0020, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0001, 0x0000, + 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, + 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, + 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, + 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0000, 0x0000, + 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, + 0x0001, 0x0000, 0x0001, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0001, 0x0000, + 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, + 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, + 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + /* 0xa722 .. 0xa7ff */ + 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, + 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0000, 0x0000, + 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, + 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, + 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, + 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, + 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, + 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, + 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, + 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0001, + 0x0000, 0x0001, 0x0000, 0x75fc, 0x0001, 0x0000, 0x0001, 0x0000, + 0x0001, 0x0000, 0x0001, 0x0000, 0x0001, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0001, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + /* 0xff21 .. 0xffff */ 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, - 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0000, 0x0000, + 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, 0x0020, + 0x0020, 0x0020, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, @@ -436,10 +498,9 @@ const WCHAR wine_casemap_lower[3318] = 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000 + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }; -const WCHAR wine_casemap_upper[3582] = +const WCHAR wine_casemap_upper[3994] = { /* index */ 0x019f, 0x029f, 0x039f, 0x045a, 0x0556, 0x0656, 0x0100, 0x0100, @@ -462,6 +523,7 @@ const WCHAR wine_casemap_upper[3582] = 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, + 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0cfe, 0x0ddb, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, @@ -472,8 +534,7 @@ const WCHAR wine_casemap_upper[3582] = 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, - 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, - 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0cfe, + 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0e9a, /* defaults */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, @@ -569,14 +630,14 @@ const WCHAR wine_casemap_upper[3582] = 0x0000, 0x0000, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, + 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0x0000, 0x0000, 0x2a3f, + 0x2a3f, 0x0000, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, - 0x0000, 0x0000, 0x0000, 0xff2e, 0xff32, 0x0000, 0xff33, 0xff33, + 0x2a1f, 0x2a1c, 0x2a1e, 0xff2e, 0xff32, 0x0000, 0xff33, 0xff33, 0x0000, 0xff36, 0x0000, 0xff35, 0x0000, 0x0000, 0x0000, 0x0000, 0xff33, 0x0000, 0x0000, 0xff31, 0x0000, 0x0000, 0x0000, 0x0000, 0xff2f, 0xff2d, 0x0000, 0x29f7, 0x0000, 0x0000, 0x0000, 0xff2d, - 0x0000, 0x0000, 0xff2b, 0x0000, 0x0000, 0xff2a, 0x0000, 0x0000, + 0x0000, 0x29fd, 0xff2b, 0x0000, 0x0000, 0xff2a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x29e7, 0x0000, 0x0000, 0xff26, 0x0000, 0x0000, 0xff26, 0x0000, 0x0000, 0x0000, 0x0000, 0xff26, 0xffbb, 0xff27, 0xff27, 0xffb9, 0x0000, 0x0000, 0x0000, @@ -600,8 +661,8 @@ const WCHAR wine_casemap_upper[3582] = 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0082, 0x0082, + 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, + 0x0000, 0x0000, 0xffff, 0x0000, 0x0000, 0x0000, 0x0082, 0x0082, 0x0082, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, @@ -613,7 +674,7 @@ const WCHAR wine_casemap_upper[3582] = 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe1, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffc0, 0xffc1, 0xffc1, 0x0000, 0xffc2, 0xffc7, 0x0000, 0x0000, 0x0000, - 0xffd1, 0xffca, 0x0000, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, + 0xffd1, 0xffca, 0xfff8, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0xffaa, 0xffb0, 0x0007, 0x0000, 0x0000, @@ -655,9 +716,9 @@ const WCHAR wine_casemap_upper[3582] = /* 0x0500 .. 0x05ff */ 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, - 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, + 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, + 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, @@ -686,7 +747,7 @@ const WCHAR wine_casemap_upper[3582] = 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x1d79 .. 0x1dff */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0ee6, 0x0000, 0x0000, 0x0000, + 0x8a04, 0x0000, 0x0000, 0x0000, 0x0ee6, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, @@ -735,7 +796,7 @@ const WCHAR wine_casemap_upper[3582] = 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, - 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, /* 0x1f00 .. 0x1fff */ 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, @@ -831,7 +892,7 @@ const WCHAR wine_casemap_upper[3582] = 0xffd0, 0xffd0, 0xffd0, 0xffd0, 0xffd0, 0xffd0, 0xffd0, 0xffd0, 0xffd0, 0x0000, 0x0000, 0xffff, 0x0000, 0x0000, 0x0000, 0xd5d5, 0xd5d8, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0x0000, 0x0000, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, @@ -846,8 +907,8 @@ const WCHAR wine_casemap_upper[3582] = 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, 0x0000, + 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x2d00 .. 0x2dff */ @@ -883,6 +944,60 @@ const WCHAR wine_casemap_upper[3582] = 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + /* 0xa641 .. 0xa6ff */ + 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, + 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, + 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, + 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, + 0x0000, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, + 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, + 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, + 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + /* 0xa723 .. 0xa7ff */ + 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, + 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0x0000, 0x0000, + 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, + 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, + 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, + 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, + 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, + 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, + 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, + 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xffff, + 0x0000, 0xffff, 0x0000, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, + 0xffff, 0x0000, 0xffff, 0x0000, 0xffff, 0x0000, 0x0000, 0x0000, + 0x0000, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0xff41 .. 0xffff */ 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, 0xffe0, @@ -909,14 +1024,14 @@ const WCHAR wine_casemap_upper[3582] = 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }; -const WCHAR wine_digitmap[4619] = +const WCHAR wine_digitmap[5837] = { /* index */ 0x01d0, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x028a, 0x0384, 0x0100, 0x044e, 0x053e, 0x062e, 0x071e, 0x080e, 0x08be, 0x099e, - 0x0a5e, 0x0100, 0x0100, 0x0af5, 0x0100, 0x0100, 0x0100, 0x0b67, - 0x0c57, 0x0d11, 0x0100, 0x0deb, 0x0100, 0x0100, 0x0100, 0x0100, - 0x0e7b, 0x0100, 0x0100, 0x0100, 0x0f1b, 0x0100, 0x0100, 0x101b, + 0x0a5e, 0x0100, 0x0100, 0x0af8, 0x0100, 0x0100, 0x0100, 0x0b6a, + 0x0c5a, 0x0d14, 0x0def, 0x0e9f, 0x0f5f, 0x0100, 0x0100, 0x0100, + 0x0fef, 0x0100, 0x0100, 0x0100, 0x108f, 0x0100, 0x0100, 0x118f, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, @@ -932,6 +1047,8 @@ const WCHAR wine_digitmap[4619] = 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, + 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x126f, 0x0100, + 0x129f, 0x139f, 0x1479, 0x14d3, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, @@ -941,9 +1058,7 @@ const WCHAR wine_digitmap[4619] = 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, - 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, - 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, - 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x110b, + 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x15cd, /* defaults */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, @@ -1276,6 +1391,8 @@ const WCHAR wine_digitmap[4619] = 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xefa0, 0xefa0, 0xefa0, 0xefa0, 0xefa0, 0xefa0, 0xefa0, 0xefa0, + 0xefa0, 0xefa0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, @@ -1288,11 +1405,9 @@ const WCHAR wine_digitmap[4619] = 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - /* 0x1369 .. 0x13ff */ - 0xecc8, 0xecc8, 0xecc8, 0xecc8, 0xecc8, 0xecc8, 0xecc8, 0xecc8, - 0xecc8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + /* 0x1366 .. 0x13ff */ + 0x0000, 0x0000, 0x0000, 0xecc8, 0xecc8, 0xecc8, 0xecc8, 0xecc8, + 0xecc8, 0xecc8, 0xecc8, 0xecc8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, @@ -1309,7 +1424,8 @@ const WCHAR wine_digitmap[4619] = 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, /* 0x178e .. 0x17ff */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, @@ -1376,20 +1492,69 @@ const WCHAR wine_digitmap[4619] = 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xe660, 0xe660, 0xe660, 0xe660, 0xe660, 0xe660, - 0xe660, 0xe660, 0xe660, 0xe660, 0x0000, 0x0000, 0x0000, 0x0000, + 0xe660, 0xe660, 0xe660, 0xe660, 0xe657, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - /* 0x1b26 .. 0x1bff */ + /* 0x1a25 .. 0x1aff */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0xe4e0, 0xe4e0, 0xe4e0, 0xe4e0, 0xe4e0, 0xe4e0, - 0xe4e0, 0xe4e0, 0xe4e0, 0xe4e0, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xe5b0, 0xe5b0, 0xe5b0, 0xe5b0, 0xe5b0, + 0xe5b0, 0xe5b0, 0xe5b0, 0xe5b0, 0xe5b0, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xe5a0, 0xe5a0, 0xe5a0, 0xe5a0, 0xe5a0, + 0xe5a0, 0xe5a0, 0xe5a0, 0xe5a0, 0xe5a0, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, + /* 0x1b50 .. 0x1bff */ + 0xe4e0, 0xe4e0, 0xe4e0, 0xe4e0, 0xe4e0, 0xe4e0, 0xe4e0, 0xe4e0, + 0xe4e0, 0xe4e0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xe480, 0xe480, 0xe480, 0xe480, 0xe480, 0xe480, 0xe480, 0xe480, + 0xe480, 0xe480, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + /* 0x1c40 .. 0x1cff */ + 0xe3f0, 0xe3f0, 0xe3f0, 0xe3f0, 0xe3f0, 0xe3f0, 0xe3f0, 0xe3f0, + 0xe3f0, 0xe3f0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xe3e0, 0xe3e0, 0xe3e0, 0xe3e0, 0xe3e0, 0xe3e0, 0xe3e0, 0xe3e0, + 0xe3e0, 0xe3e0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, @@ -1410,7 +1575,6 @@ const WCHAR wine_digitmap[4619] = 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, /* 0x2070 .. 0x20ff */ 0xdfc0, 0x0000, 0x0000, 0x0000, 0xdfc0, 0xdfc0, 0xdfc0, 0xdfc0, 0xdfc0, 0xdfc0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, @@ -1484,9 +1648,121 @@ const WCHAR wine_digitmap[4619] = 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - /* 0xff10 .. 0xffff */ - 0x0120, 0x0120, 0x0120, 0x0120, 0x0120, 0x0120, 0x0120, 0x0120, - 0x0120, 0x0120, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + /* 0xa620 .. 0xa6ff */ + 0x5a10, 0x5a10, 0x5a10, 0x5a10, 0x5a10, 0x5a10, 0x5a10, 0x5a10, + 0x5a10, 0x5a10, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + /* 0xa8d0 .. 0xa8ff */ + 0x5760, 0x5760, 0x5760, 0x5760, 0x5760, 0x5760, 0x5760, 0x5760, + 0x5760, 0x5760, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + /* 0xa900 .. 0xa9ff */ + 0x5730, 0x5730, 0x5730, 0x5730, 0x5730, 0x5730, 0x5730, 0x5730, + 0x5730, 0x5730, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x5660, 0x5660, 0x5660, 0x5660, 0x5660, 0x5660, 0x5660, 0x5660, + 0x5660, 0x5660, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + /* 0xaa26 .. 0xaaff */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x55e0, 0x55e0, 0x55e0, 0x55e0, 0x55e0, 0x55e0, + 0x55e0, 0x55e0, 0x55e0, 0x55e0, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, + /* 0xaba6 .. 0xabff */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x5440, 0x5440, 0x5440, 0x5440, 0x5440, 0x5440, + 0x5440, 0x5440, 0x5440, 0x5440, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, + /* 0xff06 .. 0xffff */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0120, 0x0120, 0x0120, 0x0120, 0x0120, 0x0120, + 0x0120, 0x0120, 0x0120, 0x0120, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, @@ -1514,7 +1790,8 @@ const WCHAR wine_digitmap[4619] = 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000 }; const WCHAR wine_compatmap[1497] = { @@ -1631,7 +1908,7 @@ const WCHAR wine_compatmap[1497] = 0x7f06, 0x7f0c, 0x7f3b, 0x7f3b, 0x7fec, 0x802c, 0x816a, 0x839d, 0x83b1, 0x83e8, 0x8518, 0x85aa, 0x8791, 0x881c, 0x881b, 0x89f8, 0x8eb0, 0x8f35, 0x909f, 0x90d6, 0x926f, 0x92a3, 0x9550, 0x95d1, - 0x9c7b, 0x9d96, 0x9dd1, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x9c7b, 0x9d96, 0x9dd1, 0x660a, 0x4882, 0x87ab, 0x0000, 0x0000, 0x53b6, 0x5744, 0x56f6, 0x550d, 0x56d1, 0x570b, 0x5851, 0x5883, 0x5b25, 0x5adc, 0x5b1f, 0x5b67, 0x5dde, 0x5e36, 0x5ec6, 0x5ed5, 0x5fe2, 0x60a7, 0x6450, 0x6456, 0x64e5, 0x6528, 0x6652, 0x66c7, diff --git a/dll/win32/kernel32/winnls/string/chartype.c b/dll/win32/kernel32/winnls/string/chartype.c new file mode 100644 index 00000000000..12ce9c85fb0 --- /dev/null +++ b/dll/win32/kernel32/winnls/string/chartype.c @@ -0,0 +1,2154 @@ +/* Unicode ctype tables */ +/* Automatically generated; DO NOT EDIT!! */ + +#include "wine/unicode.h" + +const unsigned short wine_wctype_table[17152] = +{ + /* offsets */ + 0x0100, 0x0200, 0x0300, 0x0400, 0x0500, 0x0600, 0x0700, 0x0800, + 0x0900, 0x0a00, 0x0b00, 0x0c00, 0x0d00, 0x0e00, 0x0f00, 0x1000, + 0x1100, 0x1200, 0x1300, 0x1400, 0x1500, 0x1200, 0x1600, 0x1700, + 0x1800, 0x1900, 0x1a00, 0x1b00, 0x1c00, 0x1d00, 0x1e00, 0x1f00, + 0x2000, 0x2100, 0x2200, 0x2300, 0x2400, 0x2500, 0x2600, 0x2700, + 0x2800, 0x2900, 0x2500, 0x2a00, 0x2b00, 0x2c00, 0x2d00, 0x2e00, + 0x2f00, 0x3000, 0x3100, 0x3200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x3300, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x3400, + 0x1200, 0x1200, 0x1200, 0x1200, 0x3500, 0x1200, 0x3600, 0x3700, + 0x3800, 0x3900, 0x3a00, 0x3b00, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x3c00, + 0x2800, 0x2800, 0x2800, 0x2800, 0x2800, 0x2800, 0x2800, 0x2800, + 0x2800, 0x2800, 0x2800, 0x2800, 0x2800, 0x2800, 0x2800, 0x2800, + 0x2800, 0x2800, 0x2800, 0x2800, 0x2800, 0x2800, 0x2800, 0x2800, + 0x2800, 0x2800, 0x2800, 0x2800, 0x2800, 0x2800, 0x2800, 0x2800, + 0x2800, 0x1200, 0x3d00, 0x3e00, 0x3f00, 0x4000, 0x4100, 0x4200, + /* values */ + 0xe220, 0xe220, 0xe220, 0xe220, 0xe220, 0xe220, 0xe220, 0xe220, + 0xe220, 0x9268, 0x8228, 0x9228, 0xa228, 0x8228, 0xe220, 0xe220, + 0xe220, 0xe220, 0xe220, 0xe220, 0xe220, 0xe220, 0xe220, 0xe220, + 0xe220, 0xe220, 0xe220, 0xe220, 0x8220, 0x8220, 0x8220, 0x9220, + 0xa248, 0xb210, 0xb210, 0x5210, 0x5210, 0x5210, 0xb210, 0xb210, + 0xb210, 0xb210, 0xb210, 0x4210, 0x7210, 0x4210, 0x7210, 0x7210, + 0x3284, 0x3284, 0x3284, 0x3284, 0x3284, 0x3284, 0x3284, 0x3284, + 0x3284, 0x3284, 0x7210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, + 0xb210, 0x1381, 0x1381, 0x1381, 0x1381, 0x1381, 0x1381, 0x1301, + 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, + 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, + 0x1301, 0x1301, 0x1301, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, + 0xb210, 0x1382, 0x1382, 0x1382, 0x1382, 0x1382, 0x1382, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1302, 0x1302, 0x1302, 0xb210, 0xb210, 0xb210, 0xb210, 0xe220, + 0xe220, 0xe220, 0xe220, 0xe220, 0xe220, 0x8228, 0xe220, 0xe220, + 0xe220, 0xe220, 0xe220, 0xe220, 0xe220, 0xe220, 0xe220, 0xe220, + 0xe220, 0xe220, 0xe220, 0xe220, 0xe220, 0xe220, 0xe220, 0xe220, + 0xe220, 0xe220, 0xe220, 0xe220, 0xe220, 0xe220, 0xe220, 0xe220, + 0x7248, 0xb210, 0x5210, 0x5210, 0x5210, 0x5210, 0xb210, 0xb210, + 0xb210, 0xb210, 0x1312, 0xb210, 0xb210, 0xe230, 0xb210, 0xb210, + 0x5210, 0x5210, 0x3214, 0x3214, 0xb210, 0x1312, 0xb210, 0xb210, + 0xb210, 0x3214, 0x1312, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, + 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, + 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, + 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0xb210, + 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0xb210, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, + 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, + 0x1302, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1302, + 0x1302, 0x1301, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1301, + 0x1302, 0x1301, 0x1301, 0x1301, 0x1302, 0x1302, 0x1301, 0x1301, + 0x1301, 0x1301, 0x1302, 0x1301, 0x1301, 0x1302, 0x1301, 0x1301, + 0x1301, 0x1302, 0x1302, 0x1302, 0x1301, 0x1301, 0x1302, 0x1301, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1301, + 0x1302, 0x1301, 0x1302, 0x1302, 0x1301, 0x1302, 0x1301, 0x1301, + 0x1302, 0x1301, 0x1301, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, + 0x1301, 0x1302, 0x1302, 0x1300, 0x1301, 0x1302, 0x1302, 0x1302, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1301, 0x1303, 0x1302, 0x1301, + 0x1303, 0x1302, 0x1301, 0x1303, 0x1302, 0x1301, 0x1302, 0x1301, + 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, + 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1302, 0x1301, 0x1303, 0x1302, 0x1301, 0x1302, 0x1301, 0x1301, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1302, 0x1302, 0x1301, 0x1301, 0x1302, 0x1301, 0x1301, 0x1302, + 0x1302, 0x1301, 0x1302, 0x1301, 0x1301, 0x1301, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1300, 0x1302, 0x1302, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0xb300, 0xb300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0xb200, 0xb200, 0xb200, 0xb200, 0xb300, 0xb300, + 0xb300, 0xb300, 0xb300, 0xb300, 0xb300, 0xb300, 0xb300, 0xb300, + 0x1300, 0x1300, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb300, 0xb200, 0x1300, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0x1301, 0x1302, 0x1301, 0x1302, 0xb300, 0xb200, 0x1301, 0x1302, + 0x0000, 0x0000, 0x1300, 0x1302, 0x1302, 0x1302, 0xb210, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0xb200, 0xb200, 0x1301, 0xb210, + 0x1301, 0x1301, 0x1301, 0x0000, 0x1301, 0x0000, 0x1301, 0x1301, + 0x1302, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, + 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, + 0x1301, 0x1301, 0x0000, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, + 0x1301, 0x1301, 0x1301, 0x1301, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1301, + 0x1302, 0x1302, 0x1301, 0x1301, 0x1301, 0x1302, 0x1302, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1301, 0x1302, 0xb200, 0x1301, + 0x1302, 0x1301, 0x1301, 0x1302, 0x1302, 0x1301, 0x1301, 0x1301, + 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, + 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, + 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, + 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, + 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, + 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, + 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, + 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, + 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, + 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, + 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x0000, + 0x0000, 0x1300, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, + 0x0000, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x0000, 0x1210, 0xb210, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0x2210, 0xd200, + 0x2210, 0xd200, 0xd200, 0x2210, 0xd200, 0xd200, 0x2210, 0xd200, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, + 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, + 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, + 0x2300, 0x2300, 0x2300, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x2300, 0x2300, 0x2300, 0x2210, 0x2210, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x6220, 0x6220, 0x6220, 0x6220, 0x0000, 0x0000, 0xb200, 0xb200, + 0xc200, 0x5210, 0x5210, 0xc200, 0x7210, 0xc210, 0xb200, 0xb200, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0xc210, 0x0000, 0x0000, 0xc210, 0xc210, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0x6204, 0x6204, 0x6204, 0x6204, 0x6204, 0x6204, 0x6204, 0x6204, + 0x6204, 0x6204, 0x5210, 0x6210, 0x6210, 0xc210, 0xc300, 0xc300, + 0xd200, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc210, 0xc300, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0x6220, 0xb200, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xc300, 0xc300, 0xd200, + 0xd200, 0xb200, 0xd200, 0xd200, 0xd200, 0xd200, 0xc300, 0xc300, + 0x3204, 0x3204, 0x3204, 0x3204, 0x3204, 0x3204, 0x3204, 0x3204, + 0x3204, 0x3204, 0xc300, 0xc300, 0xc300, 0xc200, 0xc200, 0xc300, + 0xc210, 0xc210, 0xc210, 0xc210, 0xc210, 0xc210, 0xc210, 0xc210, + 0xc210, 0xc210, 0xc210, 0xc210, 0xc210, 0xc210, 0x0000, 0x6220, + 0xc300, 0xd200, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0x0000, 0x0000, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xc300, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x2204, 0x2204, 0x2204, 0x2204, 0x2204, 0x2204, 0x2204, 0x2204, + 0x2204, 0x2204, 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, + 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, + 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, + 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, + 0x2300, 0x2300, 0x2300, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0x2300, 0x2300, 0xb200, 0xb210, + 0xb210, 0xb210, 0x2300, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, + 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, + 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, 0xd200, 0xd200, + 0xd200, 0xd200, 0x2300, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0x2300, 0xd200, 0xd200, 0xd200, + 0x2300, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0x0000, 0x0000, + 0x2210, 0x2210, 0x2210, 0x2210, 0x2210, 0x2210, 0x2210, 0x2210, + 0x2210, 0x2210, 0x2210, 0x2210, 0x2210, 0x2210, 0x2210, 0x0000, + 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, + 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, + 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, + 0x2300, 0xd200, 0xd200, 0xd200, 0x0000, 0x0000, 0x2210, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xd200, 0xd200, 0xd200, 0x1200, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0xd200, 0x1200, 0xd200, 0x1300, 0x1200, 0x1200, + 0x1200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0x1200, 0x1200, 0x1200, 0x1200, 0xd200, 0x1200, 0x1200, + 0x1300, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0xd200, 0xd200, 0x1210, 0x1210, 0x1204, 0x1204, + 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, + 0x1210, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x0000, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x0000, 0xd200, 0x1200, 0x1200, 0x0000, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, 0x0000, 0x1300, + 0x1300, 0x0000, 0x0000, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x0000, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x0000, 0x1300, 0x0000, 0x0000, 0x0000, 0x1300, 0x1300, + 0x1300, 0x1300, 0x0000, 0x0000, 0xd200, 0x1300, 0x1200, 0x1200, + 0x1200, 0xd200, 0xd200, 0xd200, 0xd200, 0x0000, 0x0000, 0x1200, + 0x1200, 0x0000, 0x0000, 0x1200, 0x1200, 0xd200, 0x1300, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1200, + 0x0000, 0x0000, 0x0000, 0x0000, 0x1300, 0x1300, 0x0000, 0x1300, + 0x1300, 0x1300, 0xd200, 0xd200, 0x0000, 0x0000, 0x1204, 0x1204, + 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, + 0x1300, 0x1300, 0x5200, 0x5200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x5200, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0xd200, 0xd200, 0x1200, 0x0000, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x0000, 0x0000, 0x0000, 0x0000, 0x1300, + 0x1300, 0x0000, 0x0000, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x0000, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x0000, 0x1300, 0x1300, 0x0000, 0x1300, 0x1300, 0x0000, + 0x1300, 0x1300, 0x0000, 0x0000, 0xd200, 0x0000, 0x1200, 0x1200, + 0x1200, 0xd200, 0xd200, 0x0000, 0x0000, 0x0000, 0x0000, 0xd200, + 0xd200, 0x0000, 0x0000, 0xd200, 0xd200, 0xd200, 0x0000, 0x0000, + 0x0000, 0xd200, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, 0x1300, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1204, 0x1204, + 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, + 0xd200, 0xd200, 0x1300, 0x1300, 0x1300, 0xd200, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0xd200, 0xd200, 0x1200, 0x0000, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, 0x1300, + 0x1300, 0x1300, 0x0000, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x0000, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x0000, 0x1300, 0x1300, 0x0000, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x0000, 0x0000, 0xd200, 0x1300, 0x1200, 0x1200, + 0x1200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0x0000, 0xd200, + 0xd200, 0x1200, 0x0000, 0x1200, 0x1200, 0xd200, 0x0000, 0x0000, + 0x1300, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x1300, 0x1300, 0xd200, 0xd200, 0x0000, 0x0000, 0x1204, 0x1204, + 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, + 0x0000, 0x5200, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0xd200, 0x1200, 0x1200, 0x0000, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, 0x0000, 0x1300, + 0x1300, 0x0000, 0x0000, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x0000, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x0000, 0x1300, 0x1300, 0x0000, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x0000, 0x0000, 0xd200, 0x1300, 0x1200, 0xd200, + 0x1200, 0xd200, 0xd200, 0xd200, 0xd200, 0x0000, 0x0000, 0x1200, + 0x1200, 0x0000, 0x0000, 0x1200, 0x1200, 0xd200, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xd200, 0x1200, + 0x0000, 0x0000, 0x0000, 0x0000, 0x1300, 0x1300, 0x0000, 0x1300, + 0x1300, 0x1300, 0xd200, 0xd200, 0x0000, 0x0000, 0x1204, 0x1204, + 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, + 0x1200, 0x1300, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0xd200, 0x1300, 0x0000, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x0000, 0x0000, 0x0000, 0x1300, 0x1300, + 0x1300, 0x0000, 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, 0x0000, + 0x0000, 0x1300, 0x1300, 0x0000, 0x1300, 0x0000, 0x1300, 0x1300, + 0x0000, 0x0000, 0x0000, 0x1300, 0x1300, 0x0000, 0x0000, 0x0000, + 0x1300, 0x1300, 0x1300, 0x0000, 0x0000, 0x0000, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x0000, 0x0000, 0x0000, 0x0000, 0x1200, 0x1200, + 0xd200, 0x1200, 0x1200, 0x0000, 0x0000, 0x0000, 0x1200, 0x1200, + 0x1200, 0x0000, 0x1200, 0x1200, 0x1200, 0xd200, 0x0000, 0x0000, + 0x1300, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1200, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1204, 0x1204, + 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, + 0x1200, 0x1200, 0x1200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0x5200, 0xb200, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x1200, 0x1200, 0x1200, 0x0000, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, 0x1300, 0x1300, + 0x1300, 0x0000, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x0000, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x0000, 0x0000, 0x0000, 0x1300, 0xd200, 0xd200, + 0xd200, 0x1200, 0x1200, 0x1200, 0x1200, 0x0000, 0xd200, 0xd200, + 0xd200, 0x0000, 0xd200, 0xd200, 0xd200, 0xd200, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xd200, 0xd200, 0x0000, + 0x1300, 0x1300, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x1300, 0x1300, 0xd200, 0xd200, 0x0000, 0x0000, 0x1204, 0x1204, + 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0x1200, + 0x0000, 0x0000, 0x1200, 0x1200, 0x0000, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, 0x1300, 0x1300, + 0x1300, 0x0000, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x0000, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x0000, 0x0000, 0xd200, 0x1300, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x0000, 0x1200, 0x1200, + 0x1200, 0x0000, 0x1200, 0x1200, 0xd200, 0xd200, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1200, 0x1200, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1300, 0x0000, + 0x1300, 0x1300, 0xd200, 0xd200, 0x0000, 0x0000, 0x1204, 0x1204, + 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, + 0x0000, 0x1300, 0x1300, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x1200, 0x1200, 0x0000, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, 0x1300, 0x1300, + 0x1300, 0x0000, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x0000, 0x0000, 0x1300, 0x1200, 0x1200, + 0x1200, 0xd200, 0xd200, 0xd200, 0xd200, 0x0000, 0x1200, 0x1200, + 0x1200, 0x0000, 0x1200, 0x1200, 0x1200, 0xd200, 0x1300, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1200, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x1300, 0x1300, 0xd200, 0xd200, 0x0000, 0x0000, 0x1204, 0x1204, + 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x0000, 0x0000, + 0x0000, 0x1200, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x0000, 0x0000, 0x1200, 0x1200, 0x0000, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, + 0x0000, 0x0000, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x0000, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, 0x1300, 0x0000, 0x0000, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, + 0x0000, 0x0000, 0xd200, 0x0000, 0x0000, 0x0000, 0x0000, 0x1200, + 0x1200, 0x1200, 0xd200, 0xd200, 0xd200, 0x0000, 0xd200, 0x0000, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x1200, 0x1200, 0x1210, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0xd200, 0x1300, 0x1300, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0x0000, 0x0000, 0x0000, 0x0000, 0x5200, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0x1210, + 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, + 0x1204, 0x1204, 0x1210, 0x1210, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x1300, 0x1300, 0x0000, 0x1300, 0x0000, 0x0000, 0x1300, + 0x1300, 0x0000, 0x1300, 0x0000, 0x0000, 0x1300, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x1300, 0x1300, 0x1300, 0x1300, + 0x0000, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x0000, 0x1300, 0x1300, 0x1300, 0x0000, 0x1300, 0x0000, 0x1300, + 0x0000, 0x0000, 0x1300, 0x1300, 0x0000, 0x1300, 0x1300, 0x1300, + 0x1300, 0xd200, 0x1300, 0x1300, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0x0000, 0xd200, 0xd200, 0x1300, 0x0000, 0x0000, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, 0x1300, 0x0000, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0x0000, 0x0000, + 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, + 0x1204, 0x1204, 0x0000, 0x0000, 0x1300, 0x1300, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x1300, 0x1200, 0x1200, 0x1200, 0x1210, 0x1210, 0x1210, 0x1210, + 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, + 0x1210, 0x1210, 0x1210, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0xd200, 0xd200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, + 0x1204, 0x1204, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0xd200, 0x1200, 0xd200, + 0x1200, 0xd200, 0xb210, 0xb210, 0xb210, 0xb210, 0x1200, 0x1200, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x0000, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, 0x0000, 0x0000, + 0x0000, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0x1200, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0x1210, 0xd200, 0xd200, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0x0000, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0x0000, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0xd200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x0000, 0x1200, 0x1200, + 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1210, 0x1210, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1200, 0x1200, 0xd200, 0xd200, 0xd200, + 0xd200, 0x1200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0x1200, 0xd200, 0xd200, 0x1200, 0x1200, 0xd200, 0xd200, 0x1300, + 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, + 0x1204, 0x1204, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1200, 0x1200, + 0xd200, 0xd200, 0x1300, 0x1300, 0x1300, 0x1300, 0xd200, 0xd200, + 0xd200, 0x1300, 0x1200, 0x1200, 0x1200, 0x1300, 0x1300, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1300, 0x1300, + 0x1300, 0xd200, 0xd200, 0xd200, 0xd200, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0xd200, 0x1200, 0x1200, 0xd200, 0xd200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0xd200, 0x1300, 0x1200, + 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, + 0x1204, 0x1204, 0x1200, 0x1200, 0x1200, 0xd200, 0x1200, 0x1200, + 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, + 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, + 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, + 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, + 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1210, 0x1300, 0x0000, 0x0000, 0x0000, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x0000, 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, 0x0000, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, + 0x1300, 0x0000, 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, 0x0000, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x0000, 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, 0x0000, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x0000, 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, 0x0000, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, + 0x1300, 0x0000, 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, 0x0000, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x0000, 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, 0x0000, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x0000, 0x0000, 0xd200, 0xd200, 0xd200, + 0x1200, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, + 0x1210, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x0000, 0x0000, 0x0000, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xb210, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1210, 0x1210, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0xa208, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0xb210, 0xb210, 0x0000, 0x0000, 0x0000, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1210, 0x1210, 0x1210, 0x1300, 0x1300, + 0x1300, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, 0x1300, 0x1300, + 0x1300, 0x1300, 0xd200, 0xd200, 0xd200, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0xd200, 0xd200, 0xd200, 0x1210, 0x1210, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0xd200, 0xd200, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, 0x1300, 0x1300, + 0x1300, 0x0000, 0xd200, 0xd200, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1220, 0x1220, 0x1200, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0xd200, 0x1200, + 0x1200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0x1210, 0x1210, 0x1210, 0x1300, + 0x1210, 0x1210, 0x1210, 0x5200, 0x1300, 0xd200, 0x0000, 0x0000, + 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, + 0x1204, 0x1204, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, + 0xb210, 0xb210, 0xb210, 0xd200, 0xd200, 0xd200, 0xa208, 0x0000, + 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, + 0x1204, 0x1204, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0xd200, 0x1300, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, 0x0000, 0x0000, + 0xd200, 0xd200, 0xd200, 0x1200, 0x1200, 0x1200, 0x1200, 0xd200, + 0xd200, 0x1200, 0x1200, 0x1200, 0x0000, 0x0000, 0x0000, 0x0000, + 0x1200, 0x1200, 0xd200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0xd200, 0xd200, 0xd200, 0x0000, 0x0000, 0x0000, 0x0000, + 0xb200, 0x0000, 0x0000, 0x0000, 0xb210, 0xb210, 0x1204, 0x1204, + 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, 0x0000, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, 0x0000, 0x0000, 0x0000, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1200, 0x1200, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, + 0x1204, 0x1204, 0x1200, 0x0000, 0x0000, 0x0000, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0xd200, + 0xd200, 0x1200, 0x1200, 0x1200, 0x0000, 0x0000, 0x1210, 0x1210, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1200, 0xd200, 0x1200, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0x0000, + 0xd200, 0x1200, 0xd200, 0x1200, 0x1200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0x0000, 0x0000, 0xd200, + 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, + 0x1204, 0x1204, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, + 0x1204, 0x1204, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1300, + 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xd200, 0xd200, 0xd200, 0xd200, 0x1200, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0xd200, 0x1200, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0x1200, 0xd200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0xd200, 0x1200, 0x1200, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, 0x0000, 0x0000, 0x0000, + 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, + 0x1204, 0x1204, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, + 0x1210, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x0000, 0x0000, 0x0000, + 0xd200, 0xd200, 0x1200, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1200, 0xd200, 0xd200, 0xd200, 0xd200, 0x1200, 0x1200, + 0xd200, 0xd200, 0x1200, 0x0000, 0x0000, 0x0000, 0x1300, 0x1300, + 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, + 0x1204, 0x1204, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0xd200, 0x1200, + 0xd200, 0xd200, 0x1200, 0x1200, 0x1200, 0xd200, 0x1200, 0xd200, + 0xd200, 0xd200, 0x1200, 0x1200, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x1210, 0x1210, 0x1210, 0x1210, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0x1200, 0x1200, 0xd200, 0xd200, + 0x0000, 0x0000, 0x0000, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, + 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, + 0x1204, 0x1204, 0x0000, 0x0000, 0x0000, 0x1300, 0x1300, 0x1300, + 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, + 0x1204, 0x1204, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1210, 0x1210, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xd200, 0xd200, 0xd200, 0x1210, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0x1200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0x1300, 0x1300, 0x1300, 0x1300, 0xd200, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1200, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1300, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0xd200, 0xd200, 0xd200, 0xd200, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1302, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x0000, 0x0000, + 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x0000, 0x0000, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x0000, 0x0000, + 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x0000, 0x0000, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x0000, 0x1301, 0x0000, 0x1301, 0x0000, 0x1301, 0x0000, 0x1301, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x0000, 0x0000, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1303, 0x1303, 0x1303, 0x1303, 0x1303, 0x1303, 0x1303, 0x1303, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1303, 0x1303, 0x1303, 0x1303, 0x1303, 0x1303, 0x1303, 0x1303, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1303, 0x1303, 0x1303, 0x1303, 0x1303, 0x1303, 0x1303, 0x1303, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x0000, 0x1302, 0x1302, + 0x1301, 0x1301, 0x1301, 0x1301, 0x1303, 0xb200, 0x1302, 0xb200, + 0xb200, 0xb200, 0x1302, 0x1302, 0x1302, 0x0000, 0x1302, 0x1302, + 0x1301, 0x1301, 0x1301, 0x1301, 0x1303, 0xb200, 0xb200, 0xb200, + 0x1302, 0x1302, 0x1302, 0x1302, 0x0000, 0x0000, 0x1302, 0x1302, + 0x1301, 0x1301, 0x1301, 0x1301, 0x0000, 0xb200, 0xb200, 0xb200, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0xb200, 0xb200, 0xb200, + 0x0000, 0x0000, 0x1302, 0x1302, 0x1302, 0x0000, 0x1302, 0x1302, + 0x1301, 0x1301, 0x1301, 0x1301, 0x1303, 0xb200, 0xb200, 0x0000, + 0xa208, 0xa208, 0xa208, 0xa208, 0xa208, 0xa208, 0xa208, 0xa208, + 0xa208, 0xa208, 0xa208, 0xe220, 0xe220, 0xe220, 0x1220, 0x2220, + 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, + 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, + 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, + 0xa208, 0x8208, 0xf220, 0xf220, 0xf220, 0xf220, 0xf220, 0x7208, + 0x5210, 0x5210, 0x5210, 0x5210, 0x5210, 0xb210, 0xb210, 0xb210, + 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, + 0xb210, 0xb210, 0xb210, 0xb210, 0x7200, 0xb210, 0xb210, 0xb210, + 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, + 0xb210, 0xb210, 0xb200, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, + 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xa208, + 0xe220, 0xe220, 0xe220, 0xe220, 0xe220, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0xe220, 0xe220, 0xe220, 0xe220, 0xe220, 0xe220, + 0x3200, 0x1302, 0x0000, 0x0000, 0x3200, 0x3200, 0x3200, 0x3200, + 0x3200, 0x3200, 0x4200, 0x4200, 0xb200, 0xb210, 0xb210, 0x1302, + 0x3200, 0x3200, 0x3200, 0x3200, 0x3200, 0x3200, 0x3200, 0x3200, + 0x3200, 0x3200, 0x4200, 0x4200, 0xb200, 0xb210, 0xb210, 0x0000, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, 0x0000, 0x0000, + 0x5200, 0x5200, 0x5200, 0x5200, 0x5200, 0x5200, 0x5200, 0x5200, + 0x5200, 0x5200, 0x5200, 0x5200, 0x5200, 0x5200, 0x5200, 0x5200, + 0x5200, 0x5200, 0x5200, 0x5200, 0x5200, 0x5200, 0x5200, 0x5200, + 0x5200, 0x5200, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xb200, 0xb200, 0x1301, 0xb200, 0xb200, 0xb200, 0xb200, 0x1301, + 0xb200, 0xb200, 0x1302, 0x1301, 0x1301, 0x1301, 0x1302, 0x1302, + 0x1301, 0x1301, 0x1301, 0x1302, 0xb200, 0x1301, 0xb200, 0xb200, + 0xb200, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0x1301, 0xb200, 0x1301, 0xb200, + 0x1301, 0xb200, 0x1301, 0x1301, 0x1301, 0x1301, 0x5200, 0x1302, + 0x1301, 0x1301, 0x1301, 0x1301, 0x1302, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1302, 0xb200, 0xb200, 0x1302, 0x1302, 0x1301, 0x1301, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0x1301, 0x1302, 0x1302, + 0x1302, 0x1302, 0xb200, 0xb200, 0xb200, 0xb200, 0x1302, 0x1200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1301, 0x1302, 0x1300, 0x1300, 0x1300, + 0x1300, 0xb200, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0x4200, 0x5200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb210, 0xb210, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0x1200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0x3200, 0x3200, 0x3200, 0x3200, 0x3200, 0x3200, 0x3200, 0x3200, + 0x3200, 0x3200, 0x3200, 0x3200, 0x3200, 0x3200, 0x3200, 0x3200, + 0x3200, 0x3200, 0x3200, 0x3200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0x1200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0x0000, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, + 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb210, 0xb210, 0xb200, + 0xb200, 0xb200, 0xb200, 0x0000, 0xb200, 0x0000, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb210, 0xb210, + 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, + 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, + 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, + 0xb210, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb210, 0xb210, 0xb210, 0xb210, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb210, 0xb210, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0x0000, 0x0000, 0x0000, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, + 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, + 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, + 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, + 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, + 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x0000, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x0000, + 0x1301, 0x1302, 0x1301, 0x1301, 0x1301, 0x1302, 0x1302, 0x1301, + 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1301, 0x1301, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1302, 0x1301, 0x1302, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1300, 0x1301, 0x1301, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1302, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0x1301, 0x1302, 0x1301, 0x1302, 0xd200, + 0xd200, 0xd200, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0xb210, 0xb210, 0xb210, 0xb210, 0xb200, 0xb210, 0xb210, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1300, + 0x1210, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xd200, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, + 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, + 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, + 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, + 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, + 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb300, + 0xb210, 0xb210, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0x0000, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0x0000, 0x0000, 0x0000, 0x0000, + 0xa248, 0xb210, 0xb210, 0xb210, 0xb200, 0x1300, 0x1300, 0x1300, + 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, + 0xb210, 0xb210, 0xb200, 0xb200, 0xb210, 0xb210, 0xb210, 0xb210, + 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, + 0xb200, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xb210, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0xb200, 0xb200, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0xb210, 0xb200, 0xb200, + 0x0000, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, + 0x0000, 0xd200, 0xd200, 0xb200, 0xb200, 0x1300, 0x1300, 0x1300, + 0xb210, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0xb210, 0x1300, 0x1300, 0x1300, 0x1300, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, 0x0000, + 0x0000, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0xb200, 0xb200, 0x0000, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0xb200, 0xb200, 0xb200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0xb200, 0xb200, 0xb200, 0xb200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x0000, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0xb200, + 0xb200, 0xb200, 0xb200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0xb200, 0xb200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0xb200, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, 0x0000, 0x0000, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1210, 0x1210, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0xb210, 0xb210, 0xb210, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, + 0x1204, 0x1204, 0x1300, 0x1300, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1300, 0xd200, + 0xd200, 0xd200, 0xd200, 0xb210, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0xd200, 0xd200, 0xb210, 0xb300, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0xd200, 0xd200, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb300, + 0xb300, 0xb300, 0xb300, 0xb300, 0xb300, 0xb300, 0xb300, 0xb300, + 0xb200, 0xb200, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1302, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1300, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1301, 0x1302, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0xb300, 0x1200, 0x1200, 0x1301, 0x1302, 0x1301, 0x1302, 0x0000, + 0x1301, 0x1302, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, 0x1301, 0x1302, + 0x1301, 0x1302, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x1302, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0xd200, 0x1300, 0x1300, 0x1300, 0xd200, 0x1300, + 0x1300, 0x1300, 0x1300, 0xd200, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1200, 0x1200, 0xd200, 0xd200, 0x1200, + 0xb200, 0xb200, 0xb200, 0xb200, 0x0000, 0x0000, 0x0000, 0x0000, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x5200, 0x5200, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0xb210, 0xb210, 0xb210, 0xb210, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x1200, 0x1200, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1200, 0x1200, 0x1200, 0xd200, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1210, 0x1210, + 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, + 0x1204, 0x1204, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1210, 0x1210, 0x1210, 0x1300, 0x0000, 0x0000, 0x0000, 0x0000, + 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, + 0x1204, 0x1204, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0x1210, 0x1210, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0x1200, 0x1200, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1210, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, 0x0000, 0x0000, + 0xd200, 0xd200, 0xd200, 0x1200, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0xd200, 0x1200, 0x1200, 0xd200, 0xd200, + 0xd200, 0xd200, 0x1200, 0x1200, 0xd200, 0x1200, 0x1200, 0x1200, + 0x1200, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, + 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x1210, 0x0000, 0x1300, + 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, + 0x1204, 0x1204, 0x0000, 0x0000, 0x0000, 0x0000, 0x1210, 0x1210, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0x1200, + 0x1200, 0xd200, 0xd200, 0x1200, 0x1200, 0xd200, 0xd200, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x1300, 0x1300, 0x1300, 0xd200, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0xd200, 0x1200, 0x0000, 0x0000, + 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, + 0x1204, 0x1204, 0x0000, 0x0000, 0x1210, 0x1210, 0x1210, 0x1210, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1200, + 0x1200, 0x1200, 0x1300, 0x1200, 0x0000, 0x0000, 0x0000, 0x0000, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0xd200, 0x1300, 0xd200, 0xd200, 0xd200, 0x1300, 0x1300, 0xd200, + 0xd200, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0xd200, 0xd200, + 0x1300, 0xd200, 0x1300, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x1300, 0x1300, 0x1300, 0x1210, 0x1210, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, + 0x0000, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, + 0x0000, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1200, 0x1200, 0xd200, 0x1200, 0x1200, + 0xd200, 0x1200, 0x1200, 0x1210, 0x1200, 0xd200, 0x0000, 0x0000, + 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, 0x1204, + 0x1204, 0x1204, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, + 0x0000, 0x0000, 0x0000, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, 0x0000, 0x0000, 0x0000, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, 0x0000, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, 0x0000, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2300, 0xd200, 0x2300, + 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, + 0x2300, 0x4200, 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, + 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, 0x0000, + 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, 0x0000, 0x2300, 0x0000, + 0x2300, 0x2300, 0x0000, 0x2300, 0x2300, 0x0000, 0x2300, 0x2300, + 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, 0x2300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc200, 0xc200, 0xc200, 0xc200, 0xc200, 0xc200, + 0xc200, 0xc200, 0xc200, 0xc200, 0xc200, 0xc200, 0xc200, 0xc200, + 0xc200, 0xc200, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xb210, 0xb210, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0x0000, 0x0000, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc200, 0xb200, 0x0000, 0x0000, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, + 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, + 0xb210, 0xb210, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0xd200, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, + 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, + 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, + 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, + 0x7210, 0xb210, 0x7210, 0x0000, 0xb210, 0x7210, 0xb210, 0xb210, + 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0x5210, + 0xb210, 0xb210, 0x4200, 0x4210, 0xb200, 0xb200, 0xb200, 0x0000, + 0xb210, 0x5200, 0x5210, 0xb210, 0x0000, 0x0000, 0x0000, 0x0000, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0x0000, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, + 0xc300, 0xc300, 0xc300, 0xc300, 0xc300, 0x0000, 0x0000, 0xe260, + 0x0000, 0xb210, 0xb210, 0x5210, 0x5200, 0x5210, 0xb210, 0xb210, + 0xb210, 0xb210, 0xb210, 0x4200, 0x7210, 0x4210, 0x7210, 0x7210, + 0x3284, 0x3284, 0x3284, 0x3284, 0x3284, 0x3284, 0x3284, 0x3284, + 0x3284, 0x3284, 0x7210, 0xb210, 0xb200, 0xb200, 0xb200, 0xb210, + 0xb210, 0x1381, 0x1381, 0x1381, 0x1381, 0x1381, 0x1381, 0x1301, + 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, + 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, 0x1301, + 0x1301, 0x1301, 0x1301, 0xb210, 0xb210, 0xb210, 0xb200, 0xb210, + 0xb200, 0x1382, 0x1382, 0x1382, 0x1382, 0x1382, 0x1382, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, 0x1302, + 0x1302, 0x1302, 0x1302, 0xb210, 0xb200, 0xb210, 0xb200, 0xb210, + 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0xb210, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x0000, + 0x0000, 0x0000, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x0000, 0x0000, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x0000, 0x0000, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, 0x1300, + 0x0000, 0x0000, 0x1300, 0x1300, 0x1300, 0x0000, 0x0000, 0x0000, + 0x5200, 0x5200, 0xb200, 0xb200, 0xb200, 0x5200, 0x5200, 0x0000, + 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0xb200, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0xb220, 0xb220, 0xb220, 0xb200, 0xb200, 0x0000, 0x0000 +}; diff --git a/dll/win32/kernel32/misc/collation.c b/dll/win32/kernel32/winnls/string/collation.c similarity index 99% rename from dll/win32/kernel32/misc/collation.c rename to dll/win32/kernel32/winnls/string/collation.c index 446b03dc4e2..465d740001b 100644 --- a/dll/win32/kernel32/misc/collation.c +++ b/dll/win32/kernel32/winnls/string/collation.c @@ -1,5 +1,5 @@ /* Unicode collation element table */ -/* generated from www.unicode.org/reports/tr10/allkeys.txt */ +/* generated from http://www.unicode.org/reports/tr10/allkeys.txt */ /* DO NOT EDIT!! */ const unsigned int collation_table[12800] = diff --git a/dll/win32/kernel32/misc/fold.c b/dll/win32/kernel32/winnls/string/fold.c similarity index 100% rename from dll/win32/kernel32/misc/fold.c rename to dll/win32/kernel32/winnls/string/fold.c diff --git a/dll/win32/kernel32/misc/format_msg.c b/dll/win32/kernel32/winnls/string/format_msg.c similarity index 97% rename from dll/win32/kernel32/misc/format_msg.c rename to dll/win32/kernel32/winnls/string/format_msg.c index 35b3c017274..a79dd5ce744 100644 --- a/dll/win32/kernel32/misc/format_msg.c +++ b/dll/win32/kernel32/winnls/string/format_msg.c @@ -19,10 +19,27 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include -#define NDEBUG -#include -DEBUG_CHANNEL(resource); +#include +#include +#include + +#include "ntstatus.h" +#define WIN32_NO_STATUS +#include "windef.h" +#include "winbase.h" +#include "winerror.h" +#include "winternl.h" +#include "winuser.h" +#include "winnls.h" +#include "wine/unicode.h" +#include "wine/debug.h" + +extern HMODULE kernel32_handle; + +#define HeapAlloc RtlAllocateHeap +#define HeapReAlloc RtlReAllocateHeap +#define HeapFree RtlFreeHeap +WINE_DEFAULT_DEBUG_CHANNEL(resource); struct format_args { @@ -31,8 +48,6 @@ struct format_args int last; }; -static const WCHAR kernel32W[] = {'k','e','r','n','e','l','3','2',0}; - /* Messages used by FormatMessage * * They can be specified either directly or using a message ID and @@ -63,7 +78,7 @@ static const WCHAR FMTWSTR[] = { '%','s',0 }; */ static LPWSTR load_message( HMODULE module, UINT id, WORD lang ) { - PMESSAGE_RESOURCE_ENTRY mre; + const MESSAGE_RESOURCE_ENTRY *mre; WCHAR *buffer; NTSTATUS status; @@ -389,7 +404,6 @@ DWORD WINAPI FormatMessageA( DWORD destlength; LPWSTR from; DWORD width = dwFlags & FORMAT_MESSAGE_MAX_WIDTH_MASK; - HMODULE kernel32_handle = GetModuleHandleW(kernel32W); TRACE("(0x%x,%p,%d,0x%x,%p,%d,%p)\n", dwFlags,lpSource,dwMessageId,dwLanguageId,lpBuffer,nSize,args); @@ -496,7 +510,6 @@ DWORD WINAPI FormatMessageW( DWORD talloced; LPWSTR from; DWORD width = dwFlags & FORMAT_MESSAGE_MAX_WIDTH_MASK; - HMODULE kernel32_handle = GetModuleHandleW(kernel32W); TRACE("(0x%x,%p,%d,0x%x,%p,%d,%p)\n", dwFlags,lpSource,dwMessageId,dwLanguageId,lpBuffer,nSize,args); diff --git a/dll/win32/kernel32/winnls/string/lang.c b/dll/win32/kernel32/winnls/string/lang.c new file mode 100644 index 00000000000..198a4067e5a --- /dev/null +++ b/dll/win32/kernel32/winnls/string/lang.c @@ -0,0 +1,2709 @@ +/* + * Locale support + * + * Copyright 1995 Martin von Loewis + * Copyright 1998 David Lee Lambert + * Copyright 2000 Julio C√©sar G√°zquez + * Copyright 2002 Alexandre Julliard for CodeWeavers + * + * 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 "config.h" +//#include "wine/port.h" + +#include +#include +#include +#include +#include +#include +#include + +#include "ntstatus.h" +#define WIN32_NO_STATUS +#include "windef.h" +#include "winbase.h" +#include "winuser.h" /* for RT_STRINGW */ +#include "winternl.h" +#include "wine/unicode.h" +#include "winnls.h" +#include "winerror.h" +#include "winver.h" +#include "wine/debug.h" + +#include "lcformat_private.h" +#define REG_SZ 1 +extern int wine_fold_string(int flags, const WCHAR *src, int srclen, WCHAR *dst, int dstlen); +extern int wine_get_sortkey(int flags, const WCHAR *src, int srclen, char *dst, int dstlen); +extern int wine_compare_string(int flags, const WCHAR *str1, int len1, const WCHAR *str2, int len2); +static inline unsigned short get_char_typeW( WCHAR ch ) +{ + extern const unsigned short wine_wctype_table[]; + return wine_wctype_table[wine_wctype_table[ch >> 8] + (ch & 0xff)]; +} + +#define HeapAlloc RtlAllocateHeap +#define HeapReAlloc RtlReAllocateHeap +#define HeapFree RtlFreeHeap +WINE_DEFAULT_DEBUG_CHANNEL(nls); + +extern HMODULE kernel32_handle; + +#define LOCALE_LOCALEINFOFLAGSMASK (LOCALE_NOUSEROVERRIDE|LOCALE_USE_CP_ACP|\ + LOCALE_RETURN_NUMBER|LOCALE_RETURN_GENITIVE_NAMES) + +static const WCHAR szNlsKeyName[] = { + 'M','a','c','h','i','n','e','\\','S','y','s','t','e','m','\\', + 'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\', + 'C','o','n','t','r','o','l','\\','N','l','s','\0' +}; + +static const WCHAR szLocaleKeyName[] = { + 'M','a','c','h','i','n','e','\\','S','y','s','t','e','m','\\', + 'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\', + 'C','o','n','t','r','o','l','\\','N','l','s','\\','L','o','c','a','l','e',0 +}; + +static const WCHAR szLangGroupsKeyName[] = { + 'M','a','c','h','i','n','e','\\','S','y','s','t','e','m','\\', + 'C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\', + 'C','o','n','t','r','o','l','\\','N','l','s','\\', + 'L','a','n','g','u','a','g','e',' ','G','r','o','u','p','s',0 +}; + +/* Charset to codepage map, sorted by name. */ +static const struct charset_entry +{ + const char *charset_name; + UINT codepage; +} charset_names[] = +{ + { "BIG5", 950 }, + { "CP1250", 1250 }, + { "CP1251", 1251 }, + { "CP1252", 1252 }, + { "CP1253", 1253 }, + { "CP1254", 1254 }, + { "CP1255", 1255 }, + { "CP1256", 1256 }, + { "CP1257", 1257 }, + { "CP1258", 1258 }, + { "CP932", 932 }, + { "CP936", 936 }, + { "CP949", 949 }, + { "CP950", 950 }, + { "EUCJP", 20932 }, + { "GB2312", 936 }, + { "IBM037", 37 }, + { "IBM1026", 1026 }, + { "IBM424", 424 }, + { "IBM437", 437 }, + { "IBM500", 500 }, + { "IBM850", 850 }, + { "IBM852", 852 }, + { "IBM855", 855 }, + { "IBM857", 857 }, + { "IBM860", 860 }, + { "IBM861", 861 }, + { "IBM862", 862 }, + { "IBM863", 863 }, + { "IBM864", 864 }, + { "IBM865", 865 }, + { "IBM866", 866 }, + { "IBM869", 869 }, + { "IBM874", 874 }, + { "IBM875", 875 }, + { "ISO88591", 28591 }, + { "ISO885910", 28600 }, + { "ISO885913", 28603 }, + { "ISO885914", 28604 }, + { "ISO885915", 28605 }, + { "ISO885916", 28606 }, + { "ISO88592", 28592 }, + { "ISO88593", 28593 }, + { "ISO88594", 28594 }, + { "ISO88595", 28595 }, + { "ISO88596", 28596 }, + { "ISO88597", 28597 }, + { "ISO88598", 28598 }, + { "ISO88599", 28599 }, + { "KOI8R", 20866 }, + { "KOI8U", 21866 }, + { "UTF8", CP_UTF8 } +}; + + +struct locale_name +{ + WCHAR win_name[128]; /* Windows name ("en-US") */ + WCHAR lang[128]; /* language ("en") (note: buffer contains the other strings too) */ + WCHAR *country; /* country ("US") */ + WCHAR *charset; /* charset ("UTF-8") for Unix format only */ + WCHAR *script; /* script ("Latn") for Windows format only */ + WCHAR *modifier; /* modifier or sort order */ + LCID lcid; /* corresponding LCID */ + int matches; /* number of elements matching LCID (0..4) */ + UINT codepage; /* codepage corresponding to charset */ +}; + +/* locale ids corresponding to the various Unix locale parameters */ +static LCID lcid_LC_COLLATE; +static LCID lcid_LC_CTYPE; +static LCID lcid_LC_MONETARY; +static LCID lcid_LC_NUMERIC; +static LCID lcid_LC_TIME; +static LCID lcid_LC_PAPER; +static LCID lcid_LC_MEASUREMENT; +static LCID lcid_LC_TELEPHONE; + +/* Copy Ascii string to Unicode without using codepages */ +static inline void strcpynAtoW( WCHAR *dst, const char *src, size_t n ) +{ + while (n > 1 && *src) + { + *dst++ = (unsigned char)*src++; + n--; + } + if (n) *dst = 0; +} + + +/*********************************************************************** + * get_lcid_codepage + * + * Retrieve the ANSI codepage for a given locale. + */ +static inline UINT get_lcid_codepage( LCID lcid ) +{ + UINT ret; + if (!GetLocaleInfoW( lcid, LOCALE_IDEFAULTANSICODEPAGE|LOCALE_RETURN_NUMBER, (WCHAR *)&ret, + sizeof(ret)/sizeof(WCHAR) )) ret = 0; + return ret; +} + +/*********************************************************************** + * convert_default_lcid + * + * Get the default LCID to use for a given lctype in GetLocaleInfo. + */ +static LCID convert_default_lcid( LCID lcid, LCTYPE lctype ) +{ + if (lcid == LOCALE_SYSTEM_DEFAULT || + lcid == LOCALE_USER_DEFAULT || + lcid == LOCALE_NEUTRAL) + { + LCID default_id = 0; + + switch(lctype & 0xffff) + { + case LOCALE_SSORTNAME: + default_id = lcid_LC_COLLATE; + break; + + case LOCALE_FONTSIGNATURE: + case LOCALE_IDEFAULTANSICODEPAGE: + case LOCALE_IDEFAULTCODEPAGE: + case LOCALE_IDEFAULTEBCDICCODEPAGE: + case LOCALE_IDEFAULTMACCODEPAGE: + case LOCALE_IDEFAULTUNIXCODEPAGE: + default_id = lcid_LC_CTYPE; + break; + + case LOCALE_ICURRDIGITS: + case LOCALE_ICURRENCY: + case LOCALE_IINTLCURRDIGITS: + case LOCALE_INEGCURR: + case LOCALE_INEGSEPBYSPACE: + case LOCALE_INEGSIGNPOSN: + case LOCALE_INEGSYMPRECEDES: + case LOCALE_IPOSSEPBYSPACE: + case LOCALE_IPOSSIGNPOSN: + case LOCALE_IPOSSYMPRECEDES: + case LOCALE_SCURRENCY: + case LOCALE_SINTLSYMBOL: + case LOCALE_SMONDECIMALSEP: + case LOCALE_SMONGROUPING: + case LOCALE_SMONTHOUSANDSEP: + case LOCALE_SNATIVECURRNAME: + default_id = lcid_LC_MONETARY; + break; + + case LOCALE_IDIGITS: + case LOCALE_IDIGITSUBSTITUTION: + case LOCALE_ILZERO: + case LOCALE_INEGNUMBER: + case LOCALE_SDECIMAL: + case LOCALE_SGROUPING: + //case LOCALE_SNAN: + case LOCALE_SNATIVEDIGITS: + case LOCALE_SNEGATIVESIGN: + //case LOCALE_SNEGINFINITY: + //case LOCALE_SPOSINFINITY: + case LOCALE_SPOSITIVESIGN: + case LOCALE_STHOUSAND: + default_id = lcid_LC_NUMERIC; + break; + + case LOCALE_ICALENDARTYPE: + case LOCALE_ICENTURY: + case LOCALE_IDATE: + case LOCALE_IDAYLZERO: + case LOCALE_IFIRSTDAYOFWEEK: + case LOCALE_IFIRSTWEEKOFYEAR: + case LOCALE_ILDATE: + case LOCALE_IMONLZERO: + case LOCALE_IOPTIONALCALENDAR: + case LOCALE_ITIME: + case LOCALE_ITIMEMARKPOSN: + case LOCALE_ITLZERO: + case LOCALE_S1159: + case LOCALE_S2359: + case LOCALE_SABBREVDAYNAME1: + case LOCALE_SABBREVDAYNAME2: + case LOCALE_SABBREVDAYNAME3: + case LOCALE_SABBREVDAYNAME4: + case LOCALE_SABBREVDAYNAME5: + case LOCALE_SABBREVDAYNAME6: + case LOCALE_SABBREVDAYNAME7: + case LOCALE_SABBREVMONTHNAME1: + case LOCALE_SABBREVMONTHNAME2: + case LOCALE_SABBREVMONTHNAME3: + case LOCALE_SABBREVMONTHNAME4: + case LOCALE_SABBREVMONTHNAME5: + case LOCALE_SABBREVMONTHNAME6: + case LOCALE_SABBREVMONTHNAME7: + case LOCALE_SABBREVMONTHNAME8: + case LOCALE_SABBREVMONTHNAME9: + case LOCALE_SABBREVMONTHNAME10: + case LOCALE_SABBREVMONTHNAME11: + case LOCALE_SABBREVMONTHNAME12: + case LOCALE_SABBREVMONTHNAME13: + case LOCALE_SDATE: + case LOCALE_SDAYNAME1: + case LOCALE_SDAYNAME2: + case LOCALE_SDAYNAME3: + case LOCALE_SDAYNAME4: + case LOCALE_SDAYNAME5: + case LOCALE_SDAYNAME6: + case LOCALE_SDAYNAME7: + //case LOCALE_SDURATION: + case LOCALE_SLONGDATE: + case LOCALE_SMONTHNAME1: + case LOCALE_SMONTHNAME2: + case LOCALE_SMONTHNAME3: + case LOCALE_SMONTHNAME4: + case LOCALE_SMONTHNAME5: + case LOCALE_SMONTHNAME6: + case LOCALE_SMONTHNAME7: + case LOCALE_SMONTHNAME8: + case LOCALE_SMONTHNAME9: + case LOCALE_SMONTHNAME10: + case LOCALE_SMONTHNAME11: + case LOCALE_SMONTHNAME12: + case LOCALE_SMONTHNAME13: + case LOCALE_SSHORTDATE: + //case LOCALE_SSHORTESTDAYNAME1: + //case LOCALE_SSHORTESTDAYNAME2: + //case LOCALE_SSHORTESTDAYNAME3: + //case LOCALE_SSHORTESTDAYNAME4: + //case LOCALE_SSHORTESTDAYNAME5: + //case LOCALE_SSHORTESTDAYNAME6: + //case LOCALE_SSHORTESTDAYNAME7: + case LOCALE_STIME: + case LOCALE_STIMEFORMAT: + case LOCALE_SYEARMONTH: + default_id = lcid_LC_TIME; + break; + + case LOCALE_IPAPERSIZE: + default_id = lcid_LC_PAPER; + break; + + case LOCALE_IMEASURE: + default_id = lcid_LC_MEASUREMENT; + break; + + case LOCALE_ICOUNTRY: + default_id = lcid_LC_TELEPHONE; + break; + } + if (default_id) lcid = default_id; + } + return ConvertDefaultLocale( lcid ); +} + +/*********************************************************************** + * is_genitive_name_supported + * + * Determine could LCTYPE basically support genitive name form or not. + */ +static BOOL is_genitive_name_supported( LCTYPE lctype ) +{ + switch(lctype & 0xffff) + { + case LOCALE_SMONTHNAME1: + case LOCALE_SMONTHNAME2: + case LOCALE_SMONTHNAME3: + case LOCALE_SMONTHNAME4: + case LOCALE_SMONTHNAME5: + case LOCALE_SMONTHNAME6: + case LOCALE_SMONTHNAME7: + case LOCALE_SMONTHNAME8: + case LOCALE_SMONTHNAME9: + case LOCALE_SMONTHNAME10: + case LOCALE_SMONTHNAME11: + case LOCALE_SMONTHNAME12: + case LOCALE_SMONTHNAME13: + return TRUE; + default: + return FALSE; + } +} + +/*********************************************************************** + * create_registry_key + * + * Create the Control Panel\\International registry key. + */ +static inline HANDLE create_registry_key(void) +{ + static const WCHAR cplW[] = {'C','o','n','t','r','o','l',' ','P','a','n','e','l',0}; + static const WCHAR intlW[] = {'I','n','t','e','r','n','a','t','i','o','n','a','l',0}; + OBJECT_ATTRIBUTES attr; + UNICODE_STRING nameW; + HANDLE cpl_key, hkey = 0; + + if (RtlOpenCurrentUser( KEY_ALL_ACCESS, &hkey ) != STATUS_SUCCESS) return 0; + + attr.Length = sizeof(attr); + attr.RootDirectory = hkey; + attr.ObjectName = &nameW; + attr.Attributes = 0; + attr.SecurityDescriptor = NULL; + attr.SecurityQualityOfService = NULL; + RtlInitUnicodeString( &nameW, cplW ); + + if (!NtCreateKey( &cpl_key, KEY_ALL_ACCESS, &attr, 0, NULL, 0, NULL )) + { + NtClose( attr.RootDirectory ); + attr.RootDirectory = cpl_key; + RtlInitUnicodeString( &nameW, intlW ); + if (NtCreateKey( &hkey, KEY_ALL_ACCESS, &attr, 0, NULL, 0, NULL )) hkey = 0; + } + NtClose( attr.RootDirectory ); + return hkey; +} + +/*********************************************************************** + * GetUserDefaultLangID (KERNEL32.@) + * + * Get the default language Id for the current user. + * + * PARAMS + * None. + * + * RETURNS + * The current LANGID of the default language for the current user. + */ +LANGID WINAPI GetUserDefaultLangID(void) +{ + return LANGIDFROMLCID(GetUserDefaultLCID()); +} + + +/*********************************************************************** + * GetSystemDefaultLangID (KERNEL32.@) + * + * Get the default language Id for the system. + * + * PARAMS + * None. + * + * RETURNS + * The current LANGID of the default language for the system. + */ +LANGID WINAPI GetSystemDefaultLangID(void) +{ + return LANGIDFROMLCID(GetSystemDefaultLCID()); +} + + +/*********************************************************************** + * GetUserDefaultLCID (KERNEL32.@) + * + * Get the default locale Id for the current user. + * + * PARAMS + * None. + * + * RETURNS + * The current LCID of the default locale for the current user. + */ +LCID WINAPI GetUserDefaultLCID(void) +{ + LCID lcid; + NtQueryDefaultLocale( TRUE, &lcid ); + return lcid; +} + + +/*********************************************************************** + * GetSystemDefaultLCID (KERNEL32.@) + * + * Get the default locale Id for the system. + * + * PARAMS + * None. + * + * RETURNS + * The current LCID of the default locale for the system. + */ +LCID WINAPI GetSystemDefaultLCID(void) +{ + LCID lcid; + NtQueryDefaultLocale( FALSE, &lcid ); + return lcid; +} + + +/*********************************************************************** + * GetUserDefaultUILanguage (KERNEL32.@) + * + * Get the default user interface language Id for the current user. + * + * PARAMS + * None. + * + * RETURNS + * The current LANGID of the default UI language for the current user. + */ +LANGID WINAPI GetUserDefaultUILanguage(void) +{ + LANGID lang; + NtQueryDefaultUILanguage( &lang ); + return lang; +} + + +/*********************************************************************** + * GetSystemDefaultUILanguage (KERNEL32.@) + * + * Get the default user interface language Id for the system. + * + * PARAMS + * None. + * + * RETURNS + * The current LANGID of the default UI language for the system. This is + * typically the same language used during the installation process. + */ +LANGID WINAPI GetSystemDefaultUILanguage(void) +{ + LANGID lang; + NtQueryInstallUILanguage( &lang ); + return lang; +} + +/****************************************************************************** + * get_locale_value_name + * + * Gets the registry value name for a given lctype. + */ +static const WCHAR *get_locale_value_name( DWORD lctype ) +{ + static const WCHAR iCalendarTypeW[] = {'i','C','a','l','e','n','d','a','r','T','y','p','e',0}; + static const WCHAR iCountryW[] = {'i','C','o','u','n','t','r','y',0}; + static const WCHAR iCurrDigitsW[] = {'i','C','u','r','r','D','i','g','i','t','s',0}; + static const WCHAR iCurrencyW[] = {'i','C','u','r','r','e','n','c','y',0}; + static const WCHAR iDateW[] = {'i','D','a','t','e',0}; + static const WCHAR iDigitsW[] = {'i','D','i','g','i','t','s',0}; + static const WCHAR iFirstDayOfWeekW[] = {'i','F','i','r','s','t','D','a','y','O','f','W','e','e','k',0}; + static const WCHAR iFirstWeekOfYearW[] = {'i','F','i','r','s','t','W','e','e','k','O','f','Y','e','a','r',0}; + static const WCHAR iLDateW[] = {'i','L','D','a','t','e',0}; + static const WCHAR iLZeroW[] = {'i','L','Z','e','r','o',0}; + static const WCHAR iMeasureW[] = {'i','M','e','a','s','u','r','e',0}; + static const WCHAR iNegCurrW[] = {'i','N','e','g','C','u','r','r',0}; + static const WCHAR iNegNumberW[] = {'i','N','e','g','N','u','m','b','e','r',0}; + static const WCHAR iPaperSizeW[] = {'i','P','a','p','e','r','S','i','z','e',0}; + static const WCHAR iTLZeroW[] = {'i','T','L','Z','e','r','o',0}; + static const WCHAR iTimePrefixW[] = {'i','T','i','m','e','P','r','e','f','i','x',0}; + static const WCHAR iTimeW[] = {'i','T','i','m','e',0}; + static const WCHAR s1159W[] = {'s','1','1','5','9',0}; + static const WCHAR s2359W[] = {'s','2','3','5','9',0}; + static const WCHAR sCountryW[] = {'s','C','o','u','n','t','r','y',0}; + static const WCHAR sCurrencyW[] = {'s','C','u','r','r','e','n','c','y',0}; + static const WCHAR sDateW[] = {'s','D','a','t','e',0}; + static const WCHAR sDecimalW[] = {'s','D','e','c','i','m','a','l',0}; + static const WCHAR sGroupingW[] = {'s','G','r','o','u','p','i','n','g',0}; + static const WCHAR sLanguageW[] = {'s','L','a','n','g','u','a','g','e',0}; + static const WCHAR sListW[] = {'s','L','i','s','t',0}; + static const WCHAR sLongDateW[] = {'s','L','o','n','g','D','a','t','e',0}; + static const WCHAR sMonDecimalSepW[] = {'s','M','o','n','D','e','c','i','m','a','l','S','e','p',0}; + static const WCHAR sMonGroupingW[] = {'s','M','o','n','G','r','o','u','p','i','n','g',0}; + static const WCHAR sMonThousandSepW[] = {'s','M','o','n','T','h','o','u','s','a','n','d','S','e','p',0}; + static const WCHAR sNativeDigitsW[] = {'s','N','a','t','i','v','e','D','i','g','i','t','s',0}; + static const WCHAR sNegativeSignW[] = {'s','N','e','g','a','t','i','v','e','S','i','g','n',0}; + static const WCHAR sPositiveSignW[] = {'s','P','o','s','i','t','i','v','e','S','i','g','n',0}; + static const WCHAR sShortDateW[] = {'s','S','h','o','r','t','D','a','t','e',0}; + static const WCHAR sThousandW[] = {'s','T','h','o','u','s','a','n','d',0}; + static const WCHAR sTimeFormatW[] = {'s','T','i','m','e','F','o','r','m','a','t',0}; + static const WCHAR sTimeW[] = {'s','T','i','m','e',0}; + static const WCHAR sYearMonthW[] = {'s','Y','e','a','r','M','o','n','t','h',0}; + static const WCHAR NumShapeW[] = {'N','u','m','s','h','a','p','e',0}; + + switch (lctype) + { + /* These values are used by SetLocaleInfo and GetLocaleInfo, and + * the values are stored in the registry, confirmed under Windows. + */ + case LOCALE_ICALENDARTYPE: return iCalendarTypeW; + case LOCALE_ICURRDIGITS: return iCurrDigitsW; + case LOCALE_ICURRENCY: return iCurrencyW; + case LOCALE_IDIGITS: return iDigitsW; + case LOCALE_IFIRSTDAYOFWEEK: return iFirstDayOfWeekW; + case LOCALE_IFIRSTWEEKOFYEAR: return iFirstWeekOfYearW; + case LOCALE_ILZERO: return iLZeroW; + case LOCALE_IMEASURE: return iMeasureW; + case LOCALE_INEGCURR: return iNegCurrW; + case LOCALE_INEGNUMBER: return iNegNumberW; + case LOCALE_IPAPERSIZE: return iPaperSizeW; + case LOCALE_ITIME: return iTimeW; + case LOCALE_S1159: return s1159W; + case LOCALE_S2359: return s2359W; + case LOCALE_SCURRENCY: return sCurrencyW; + case LOCALE_SDATE: return sDateW; + case LOCALE_SDECIMAL: return sDecimalW; + case LOCALE_SGROUPING: return sGroupingW; + case LOCALE_SLIST: return sListW; + case LOCALE_SLONGDATE: return sLongDateW; + case LOCALE_SMONDECIMALSEP: return sMonDecimalSepW; + case LOCALE_SMONGROUPING: return sMonGroupingW; + case LOCALE_SMONTHOUSANDSEP: return sMonThousandSepW; + case LOCALE_SNEGATIVESIGN: return sNegativeSignW; + case LOCALE_SPOSITIVESIGN: return sPositiveSignW; + case LOCALE_SSHORTDATE: return sShortDateW; + case LOCALE_STHOUSAND: return sThousandW; + case LOCALE_STIME: return sTimeW; + case LOCALE_STIMEFORMAT: return sTimeFormatW; + case LOCALE_SYEARMONTH: return sYearMonthW; + + /* The following are not listed under MSDN as supported, + * but seem to be used and also stored in the registry. + */ + case LOCALE_ICOUNTRY: return iCountryW; + case LOCALE_IDATE: return iDateW; + case LOCALE_ILDATE: return iLDateW; + case LOCALE_ITLZERO: return iTLZeroW; + case LOCALE_SCOUNTRY: return sCountryW; + case LOCALE_SABBREVLANGNAME: return sLanguageW; + + /* The following are used in XP and later */ + case LOCALE_IDIGITSUBSTITUTION: return NumShapeW; + case LOCALE_SNATIVEDIGITS: return sNativeDigitsW; + case LOCALE_ITIMEMARKPOSN: return iTimePrefixW; + } + return NULL; +} + + +/****************************************************************************** + * get_registry_locale_info + * + * Retrieve user-modified locale info from the registry. + * Return length, 0 on error, -1 if not found. + */ +static INT get_registry_locale_info( LPCWSTR value, LPWSTR buffer, INT len ) +{ + DWORD size; + INT ret; + HANDLE hkey; + NTSTATUS status; + UNICODE_STRING nameW; + KEY_VALUE_PARTIAL_INFORMATION *info; + static const int info_size = FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION, Data); + + if (!(hkey = create_registry_key())) return -1; + + RtlInitUnicodeString( &nameW, value ); + size = info_size + len * sizeof(WCHAR); + + if (!(info = HeapAlloc( GetProcessHeap(), 0, size ))) + { + NtClose( hkey ); + SetLastError( ERROR_NOT_ENOUGH_MEMORY ); + return 0; + } + + status = NtQueryValueKey( hkey, &nameW, KeyValuePartialInformation, info, size, &size ); + + if (!status) + { + ret = (size - info_size) / sizeof(WCHAR); + /* append terminating null if needed */ + if (!ret || ((WCHAR *)info->Data)[ret-1]) + { + if (ret < len || !buffer) ret++; + else + { + SetLastError( ERROR_INSUFFICIENT_BUFFER ); + ret = 0; + } + } + if (ret && buffer) + { + memcpy( buffer, info->Data, (ret-1) * sizeof(WCHAR) ); + buffer[ret-1] = 0; + } + } + else if (status == STATUS_BUFFER_OVERFLOW && !buffer) + { + ret = (size - info_size) / sizeof(WCHAR) + 1; + } + else if (status == STATUS_OBJECT_NAME_NOT_FOUND) + { + ret = -1; + } + else + { + SetLastError( RtlNtStatusToDosError(status) ); + ret = 0; + } + NtClose( hkey ); + HeapFree( GetProcessHeap(), 0, info ); + return ret; +} + + +/****************************************************************************** + * GetLocaleInfoA (KERNEL32.@) + * + * Get information about an aspect of a locale. + * + * PARAMS + * lcid [I] LCID of the locale + * lctype [I] LCTYPE_ flags from "winnls.h" + * buffer [O] Destination for the information + * len [I] Length of buffer in characters + * + * RETURNS + * Success: The size of the data requested. If buffer is non-NULL, it is filled + * with the information. + * Failure: 0. Use GetLastError() to determine the cause. + * + * NOTES + * - LOCALE_NEUTRAL is equal to LOCALE_SYSTEM_DEFAULT + * - The string returned is NUL terminated, except for LOCALE_FONTSIGNATURE, + * which is a bit string. + */ +INT WINAPI GetLocaleInfoA( LCID lcid, LCTYPE lctype, LPSTR buffer, INT len ) +{ + WCHAR *bufferW; + INT lenW, ret; + + TRACE( "(lcid=0x%x,lctype=0x%x,%p,%d)\n", lcid, lctype, buffer, len ); + + if (len < 0 || (len && !buffer)) + { + SetLastError( ERROR_INVALID_PARAMETER ); + return 0; + } + if (lctype & LOCALE_RETURN_GENITIVE_NAMES ) + { + SetLastError( ERROR_INVALID_FLAGS ); + return 0; + } + + if (!len) buffer = NULL; + + if (!(lenW = GetLocaleInfoW( lcid, lctype, NULL, 0 ))) return 0; + + if (!(bufferW = HeapAlloc( GetProcessHeap(), 0, lenW * sizeof(WCHAR) ))) + { + SetLastError( ERROR_NOT_ENOUGH_MEMORY ); + return 0; + } + if ((ret = GetLocaleInfoW( lcid, lctype, bufferW, lenW ))) + { + if ((lctype & LOCALE_RETURN_NUMBER) || + ((lctype & ~LOCALE_LOCALEINFOFLAGSMASK) == LOCALE_FONTSIGNATURE)) + { + /* it's not an ASCII string, just bytes */ + ret *= sizeof(WCHAR); + if (buffer) + { + if (ret <= len) memcpy( buffer, bufferW, ret ); + else + { + SetLastError( ERROR_INSUFFICIENT_BUFFER ); + ret = 0; + } + } + } + else + { + UINT codepage = CP_ACP; + if (!(lctype & LOCALE_USE_CP_ACP)) codepage = get_lcid_codepage( lcid ); + ret = WideCharToMultiByte( codepage, 0, bufferW, ret, buffer, len, NULL, NULL ); + } + } + HeapFree( GetProcessHeap(), 0, bufferW ); + return ret; +} + + +/****************************************************************************** + * GetLocaleInfoW (KERNEL32.@) + * + * See GetLocaleInfoA. + */ +INT WINAPI GetLocaleInfoW( LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len ) +{ + LANGID lang_id; + HRSRC hrsrc; + HGLOBAL hmem; + INT ret; + UINT lcflags; + const WCHAR *p; + unsigned int i; + + if (len < 0 || (len && !buffer)) + { + SetLastError( ERROR_INVALID_PARAMETER ); + return 0; + } + if (lctype & LOCALE_RETURN_GENITIVE_NAMES && + !is_genitive_name_supported( lctype )) + { + SetLastError( ERROR_INVALID_FLAGS ); + return 0; + } + + if (!len) buffer = NULL; + + lcid = convert_default_lcid( lcid, lctype ); + + lcflags = lctype & LOCALE_LOCALEINFOFLAGSMASK; + lctype &= 0xffff; + + TRACE( "(lcid=0x%x,lctype=0x%x,%p,%d)\n", lcid, lctype, buffer, len ); + + /* first check for overrides in the registry */ + + if (!(lcflags & LOCALE_NOUSEROVERRIDE) && + lcid == convert_default_lcid( LOCALE_USER_DEFAULT, lctype )) + { + const WCHAR *value = get_locale_value_name(lctype); + + if (value) + { + if (lcflags & LOCALE_RETURN_NUMBER) + { + WCHAR tmp[16]; + ret = get_registry_locale_info( value, tmp, sizeof(tmp)/sizeof(WCHAR) ); + if (ret > 0) + { + WCHAR *end; + UINT number = strtolW( tmp, &end, 10 ); + if (*end) /* invalid number */ + { + SetLastError( ERROR_INVALID_FLAGS ); + return 0; + } + ret = sizeof(UINT)/sizeof(WCHAR); + if (!buffer) return ret; + if (ret > len) + { + SetLastError( ERROR_INSUFFICIENT_BUFFER ); + return 0; + } + memcpy( buffer, &number, sizeof(number) ); + } + } + else ret = get_registry_locale_info( value, buffer, len ); + + if (ret != -1) return ret; + } + } + + /* now load it from kernel resources */ + + lang_id = LANGIDFROMLCID( lcid ); + + /* replace SUBLANG_NEUTRAL by SUBLANG_DEFAULT */ + if (SUBLANGID(lang_id) == SUBLANG_NEUTRAL) + lang_id = MAKELANGID(PRIMARYLANGID(lang_id), SUBLANG_DEFAULT); + + if (!(hrsrc = FindResourceExW( kernel32_handle, (LPWSTR)RT_STRING, + ULongToPtr((lctype >> 4) + 1), lang_id ))) + { + SetLastError( ERROR_INVALID_FLAGS ); /* no such lctype */ + return 0; + } + if (!(hmem = LoadResource( kernel32_handle, hrsrc ))) + return 0; + + p = LockResource( hmem ); + for (i = 0; i < (lctype & 0x0f); i++) p += *p + 1; + + if (lcflags & LOCALE_RETURN_NUMBER) ret = sizeof(UINT)/sizeof(WCHAR); + else if (is_genitive_name_supported( lctype ) && *p) + { + /* genitive form's stored after a null separator from a nominative */ + for (i = 1; i <= *p; i++) if (!p[i]) break; + + if (i <= *p && (lcflags & LOCALE_RETURN_GENITIVE_NAMES)) + { + ret = *p - i + 1; + p += i; + } + else ret = i; + } + else + ret = (lctype == LOCALE_FONTSIGNATURE) ? *p : *p + 1; + + if (!buffer) return ret; + + if (ret > len) + { + SetLastError( ERROR_INSUFFICIENT_BUFFER ); + return 0; + } + + if (lcflags & LOCALE_RETURN_NUMBER) + { + UINT number; + WCHAR *end, *tmp = HeapAlloc( GetProcessHeap(), 0, (*p + 1) * sizeof(WCHAR) ); + if (!tmp) return 0; + memcpy( tmp, p + 1, *p * sizeof(WCHAR) ); + tmp[*p] = 0; + number = strtolW( tmp, &end, 10 ); + if (!*end) + memcpy( buffer, &number, sizeof(number) ); + else /* invalid number */ + { + SetLastError( ERROR_INVALID_FLAGS ); + ret = 0; + } + HeapFree( GetProcessHeap(), 0, tmp ); + + TRACE( "(lcid=0x%x,lctype=0x%x,%p,%d) returning number %d\n", + lcid, lctype, buffer, len, number ); + } + else + { + memcpy( buffer, p + 1, ret * sizeof(WCHAR) ); + if (lctype != LOCALE_FONTSIGNATURE) buffer[ret-1] = 0; + + TRACE( "(lcid=0x%x,lctype=0x%x,%p,%d) returning %d %s\n", + lcid, lctype, buffer, len, ret, debugstr_w(buffer) ); + } + return ret; +} + + +/****************************************************************************** + * SetLocaleInfoA [KERNEL32.@] + * + * Set information about an aspect of a locale. + * + * PARAMS + * lcid [I] LCID of the locale + * lctype [I] LCTYPE_ flags from "winnls.h" + * data [I] Information to set + * + * RETURNS + * Success: TRUE. The information given will be returned by GetLocaleInfoA() + * whenever it is called without LOCALE_NOUSEROVERRIDE. + * Failure: FALSE. Use GetLastError() to determine the cause. + * + * NOTES + * - Values are only be set for the current user locale; the system locale + * settings cannot be changed. + * - Any settings changed by this call are lost when the locale is changed by + * the control panel (in Wine, this happens every time you change LANG). + * - The native implementation of this function does not check that lcid matches + * the current user locale, and simply sets the new values. Wine warns you in + * this case, but behaves the same. + */ +BOOL WINAPI SetLocaleInfoA(LCID lcid, LCTYPE lctype, LPCSTR data) +{ + UINT codepage = CP_ACP; + WCHAR *strW; + DWORD len; + BOOL ret; + + if (!(lctype & LOCALE_USE_CP_ACP)) codepage = get_lcid_codepage( lcid ); + + if (!data) + { + SetLastError( ERROR_INVALID_PARAMETER ); + return FALSE; + } + len = MultiByteToWideChar( codepage, 0, data, -1, NULL, 0 ); + if (!(strW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) + { + SetLastError( ERROR_NOT_ENOUGH_MEMORY ); + return FALSE; + } + MultiByteToWideChar( codepage, 0, data, -1, strW, len ); + ret = SetLocaleInfoW( lcid, lctype, strW ); + HeapFree( GetProcessHeap(), 0, strW ); + return ret; +} + + +/****************************************************************************** + * SetLocaleInfoW (KERNEL32.@) + * + * See SetLocaleInfoA. + */ +BOOL WINAPI SetLocaleInfoW( LCID lcid, LCTYPE lctype, LPCWSTR data ) +{ + const WCHAR *value; + static const WCHAR intlW[] = {'i','n','t','l',0 }; + UNICODE_STRING valueW; + NTSTATUS status; + HANDLE hkey; + + lctype &= 0xffff; + value = get_locale_value_name( lctype ); + + if (!data || !value) + { + SetLastError( ERROR_INVALID_PARAMETER ); + return FALSE; + } + + if (lctype == LOCALE_IDATE || lctype == LOCALE_ILDATE) + { + SetLastError( ERROR_INVALID_FLAGS ); + return FALSE; + } + + TRACE("setting %x (%s) to %s\n", lctype, debugstr_w(value), debugstr_w(data) ); + + /* FIXME: should check that data to set is sane */ + + /* FIXME: profile functions should map to registry */ + WriteProfileStringW( intlW, value, data ); + + if (!(hkey = create_registry_key())) return FALSE; + RtlInitUnicodeString( &valueW, value ); + status = NtSetValueKey( hkey, &valueW, 0, REG_SZ, data, (strlenW(data)+1)*sizeof(WCHAR) ); + + if (lctype == LOCALE_SSHORTDATE || lctype == LOCALE_SLONGDATE) + { + /* Set I-value from S value */ + WCHAR *lpD, *lpM, *lpY; + WCHAR szBuff[2]; + + lpD = strrchrW(data, 'd'); + lpM = strrchrW(data, 'M'); + lpY = strrchrW(data, 'y'); + + if (lpD <= lpM) + { + szBuff[0] = '1'; /* D-M-Y */ + } + else + { + if (lpY <= lpM) + szBuff[0] = '2'; /* Y-M-D */ + else + szBuff[0] = '0'; /* M-D-Y */ + } + + szBuff[1] = '\0'; + + if (lctype == LOCALE_SSHORTDATE) + lctype = LOCALE_IDATE; + else + lctype = LOCALE_ILDATE; + + value = get_locale_value_name( lctype ); + + WriteProfileStringW( intlW, value, szBuff ); + + RtlInitUnicodeString( &valueW, value ); + status = NtSetValueKey( hkey, &valueW, 0, REG_SZ, szBuff, sizeof(szBuff) ); + } + + NtClose( hkey ); + + if (status) SetLastError( RtlNtStatusToDosError(status) ); + return !status; +} + +/*********************************************************************** + * GetThreadLocale (KERNEL32.@) + * + * Get the current threads locale. + * + * PARAMS + * None. + * + * RETURNS + * The LCID currently associated with the calling thread. + */ +LCID WINAPI GetThreadLocale(void) +{ + LCID ret = NtCurrentTeb()->CurrentLocale; + if (!ret) NtCurrentTeb()->CurrentLocale = ret = GetUserDefaultLCID(); + return ret; +} + +/********************************************************************** + * SetThreadLocale (KERNEL32.@) + * + * Set the current threads locale. + * + * PARAMS + * lcid [I] LCID of the locale to set + * + * RETURNS + * Success: TRUE. The threads locale is set to lcid. + * Failure: FALSE. Use GetLastError() to determine the cause. + */ +BOOL WINAPI SetThreadLocale( LCID lcid ) +{ + TRACE("(0x%04X)\n", lcid); + + lcid = ConvertDefaultLocale(lcid); + + if (lcid != GetThreadLocale()) + { + if (!IsValidLocale(lcid, LCID_SUPPORTED)) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + NtCurrentTeb()->CurrentLocale = lcid; + } + return TRUE; +} + +/****************************************************************************** + * ConvertDefaultLocale (KERNEL32.@) + * + * Convert a default locale identifier into a real identifier. + * + * PARAMS + * lcid [I] LCID identifier of the locale to convert + * + * RETURNS + * lcid unchanged, if not a default locale or its sublanguage is + * not SUBLANG_NEUTRAL. + * GetSystemDefaultLCID(), if lcid == LOCALE_SYSTEM_DEFAULT. + * GetUserDefaultLCID(), if lcid == LOCALE_USER_DEFAULT or LOCALE_NEUTRAL. + * Otherwise, lcid with sublanguage changed to SUBLANG_DEFAULT. + */ +LCID WINAPI ConvertDefaultLocale( LCID lcid ) +{ + LANGID langid; + + switch (lcid) + { + case LOCALE_SYSTEM_DEFAULT: + lcid = GetSystemDefaultLCID(); + break; + case LOCALE_USER_DEFAULT: + case LOCALE_NEUTRAL: + lcid = GetUserDefaultLCID(); + break; + default: + /* Replace SUBLANG_NEUTRAL with SUBLANG_DEFAULT */ + langid = LANGIDFROMLCID(lcid); + if (SUBLANGID(langid) == SUBLANG_NEUTRAL) + { + langid = MAKELANGID(PRIMARYLANGID(langid), SUBLANG_DEFAULT); + lcid = MAKELCID(langid, SORTIDFROMLCID(lcid)); + } + } + return lcid; +} + + +/****************************************************************************** + * IsValidLocale (KERNEL32.@) + * + * Determine if a locale is valid. + * + * PARAMS + * lcid [I] LCID of the locale to check + * flags [I] LCID_SUPPORTED = Valid, LCID_INSTALLED = Valid and installed on the system + * + * RETURNS + * TRUE, if lcid is valid, + * FALSE, otherwise. + * + * NOTES + * Wine does not currently make the distinction between supported and installed. All + * languages supported are installed by default. + */ +BOOL WINAPI IsValidLocale( LCID lcid, DWORD flags ) +{ + /* check if language is registered in the kernel32 resources */ + return FindResourceExW( kernel32_handle, (LPWSTR)RT_STRING, + (LPCWSTR)LOCALE_ILANGUAGE, LANGIDFROMLCID(lcid)) != 0; +} + + +static BOOL CALLBACK enum_lang_proc_a( HMODULE hModule, LPCSTR type, + LPCSTR name, WORD LangID, LONG_PTR lParam ) +{ + LOCALE_ENUMPROCA lpfnLocaleEnum = (LOCALE_ENUMPROCA)lParam; + char buf[20]; + + sprintf(buf, "%08x", (UINT)LangID); + return lpfnLocaleEnum( buf ); +} + +static BOOL CALLBACK enum_lang_proc_w( HMODULE hModule, LPCWSTR type, + LPCWSTR name, WORD LangID, LONG_PTR lParam ) +{ + static const WCHAR formatW[] = {'%','0','8','x',0}; + LOCALE_ENUMPROCW lpfnLocaleEnum = (LOCALE_ENUMPROCW)lParam; + WCHAR buf[20]; + sprintfW( buf, formatW, (UINT)LangID ); + return lpfnLocaleEnum( buf ); +} + +/****************************************************************************** + * EnumSystemLocalesA (KERNEL32.@) + * + * Call a users function for each locale available on the system. + * + * PARAMS + * lpfnLocaleEnum [I] Callback function to call for each locale + * dwFlags [I] LOCALE_SUPPORTED=All supported, LOCALE_INSTALLED=Installed only + * + * RETURNS + * Success: TRUE. + * Failure: FALSE. Use GetLastError() to determine the cause. + */ +BOOL WINAPI EnumSystemLocalesA( LOCALE_ENUMPROCA lpfnLocaleEnum, DWORD dwFlags ) +{ + TRACE("(%p,%08x)\n", lpfnLocaleEnum, dwFlags); + EnumResourceLanguagesA( kernel32_handle, (LPSTR)RT_STRING, + (LPCSTR)LOCALE_ILANGUAGE, enum_lang_proc_a, + (LONG_PTR)lpfnLocaleEnum); + return TRUE; +} + + +/****************************************************************************** + * EnumSystemLocalesW (KERNEL32.@) + * + * See EnumSystemLocalesA. + */ +BOOL WINAPI EnumSystemLocalesW( LOCALE_ENUMPROCW lpfnLocaleEnum, DWORD dwFlags ) +{ + TRACE("(%p,%08x)\n", lpfnLocaleEnum, dwFlags); + EnumResourceLanguagesW( kernel32_handle, (LPWSTR)RT_STRING, + (LPCWSTR)LOCALE_ILANGUAGE, enum_lang_proc_w, + (LONG_PTR)lpfnLocaleEnum); + return TRUE; +} + +/*********************************************************************** + * VerLanguageNameA (KERNEL32.@) + * + * Get the name of a language. + * + * PARAMS + * wLang [I] LANGID of the language + * szLang [O] Destination for the language name + * + * RETURNS + * Success: The size of the language name. If szLang is non-NULL, it is filled + * with the name. + * Failure: 0. Use GetLastError() to determine the cause. + * + */ +DWORD WINAPI VerLanguageNameA( DWORD wLang, LPSTR szLang, DWORD nSize ) +{ + return GetLocaleInfoA( MAKELCID(wLang, SORT_DEFAULT), LOCALE_SENGLANGUAGE, szLang, nSize ); +} + + +/*********************************************************************** + * VerLanguageNameW (KERNEL32.@) + * + * See VerLanguageNameA. + */ +DWORD WINAPI VerLanguageNameW( DWORD wLang, LPWSTR szLang, DWORD nSize ) +{ + return GetLocaleInfoW( MAKELCID(wLang, SORT_DEFAULT), LOCALE_SENGLANGUAGE, szLang, nSize ); +} + +/****************************************************************************** + * GetStringTypeW (KERNEL32.@) + * + * See GetStringTypeA. + */ +BOOL WINAPI GetStringTypeW( DWORD type, LPCWSTR src, INT count, LPWORD chartype ) +{ + static const unsigned char type2_map[16] = + { + C2_NOTAPPLICABLE, /* unassigned */ + C2_LEFTTORIGHT, /* L */ + C2_RIGHTTOLEFT, /* R */ + C2_EUROPENUMBER, /* EN */ + C2_EUROPESEPARATOR, /* ES */ + C2_EUROPETERMINATOR, /* ET */ + C2_ARABICNUMBER, /* AN */ + C2_COMMONSEPARATOR, /* CS */ + C2_BLOCKSEPARATOR, /* B */ + C2_SEGMENTSEPARATOR, /* S */ + C2_WHITESPACE, /* WS */ + C2_OTHERNEUTRAL, /* ON */ + C2_RIGHTTOLEFT, /* AL */ + C2_NOTAPPLICABLE, /* NSM */ + C2_NOTAPPLICABLE, /* BN */ + C2_OTHERNEUTRAL /* LRE, LRO, RLE, RLO, PDF */ + }; + + if (count == -1) count = strlenW(src) + 1; + switch(type) + { + case CT_CTYPE1: + while (count--) *chartype++ = get_char_typeW( *src++ ) & 0xfff; + break; + case CT_CTYPE2: + while (count--) *chartype++ = type2_map[get_char_typeW( *src++ ) >> 12]; + break; + case CT_CTYPE3: + { + WARN("CT_CTYPE3: semi-stub.\n"); + while (count--) + { + int c = *src; + WORD type1, type3 = 0; /* C3_NOTAPPLICABLE */ + + type1 = get_char_typeW( *src++ ) & 0xfff; + /* try to construct type3 from type1 */ + if(type1 & C1_SPACE) type3 |= C3_SYMBOL; + if(type1 & C1_ALPHA) type3 |= C3_ALPHA; + if ((c>=0x30A0)&&(c<=0x30FF)) type3 |= C3_KATAKANA; + if ((c>=0x3040)&&(c<=0x309F)) type3 |= C3_HIRAGANA; + if ((c>=0x4E00)&&(c<=0x9FAF)) type3 |= C3_IDEOGRAPH; + if ((c>=0x0600)&&(c<=0x06FF)) type3 |= C3_KASHIDA; + if ((c>=0x3000)&&(c<=0x303F)) type3 |= C3_SYMBOL; + + if ((c>=0xFF00)&&(c<=0xFF60)) type3 |= C3_FULLWIDTH; + if ((c>=0xFF00)&&(c<=0xFF20)) type3 |= C3_SYMBOL; + if ((c>=0xFF3B)&&(c<=0xFF40)) type3 |= C3_SYMBOL; + if ((c>=0xFF5B)&&(c<=0xFF60)) type3 |= C3_SYMBOL; + if ((c>=0xFF21)&&(c<=0xFF3A)) type3 |= C3_ALPHA; + if ((c>=0xFF41)&&(c<=0xFF5A)) type3 |= C3_ALPHA; + if ((c>=0xFFE0)&&(c<=0xFFE6)) type3 |= C3_FULLWIDTH; + if ((c>=0xFFE0)&&(c<=0xFFE6)) type3 |= C3_SYMBOL; + + if ((c>=0xFF61)&&(c<=0xFFDC)) type3 |= C3_HALFWIDTH; + if ((c>=0xFF61)&&(c<=0xFF64)) type3 |= C3_SYMBOL; + if ((c>=0xFF65)&&(c<=0xFF9F)) type3 |= C3_KATAKANA; + if ((c>=0xFF65)&&(c<=0xFF9F)) type3 |= C3_ALPHA; + if ((c>=0xFFE8)&&(c<=0xFFEE)) type3 |= C3_HALFWIDTH; + if ((c>=0xFFE8)&&(c<=0xFFEE)) type3 |= C3_SYMBOL; + *chartype++ = type3; + } + break; + } + default: + SetLastError( ERROR_INVALID_PARAMETER ); + return FALSE; + } + return TRUE; +} + + +/****************************************************************************** + * GetStringTypeExW (KERNEL32.@) + * + * See GetStringTypeExA. + */ +BOOL WINAPI GetStringTypeExW( LCID locale, DWORD type, LPCWSTR src, INT count, LPWORD chartype ) +{ + /* locale is ignored for Unicode */ + return GetStringTypeW( type, src, count, chartype ); +} + + +/****************************************************************************** + * GetStringTypeA (KERNEL32.@) + * + * Get characteristics of the characters making up a string. + * + * PARAMS + * locale [I] Locale Id for the string + * type [I] CT_CTYPE1 = classification, CT_CTYPE2 = directionality, CT_CTYPE3 = typographic info + * src [I] String to analyse + * count [I] Length of src in chars, or -1 if src is NUL terminated + * chartype [O] Destination for the calculated characteristics + * + * RETURNS + * Success: TRUE. chartype is filled with the requested characteristics of each char + * in src. + * Failure: FALSE. Use GetLastError() to determine the cause. + */ +BOOL WINAPI GetStringTypeA( LCID locale, DWORD type, LPCSTR src, INT count, LPWORD chartype ) +{ + UINT cp; + INT countW; + LPWSTR srcW; + BOOL ret = FALSE; + + if(count == -1) count = strlen(src) + 1; + + if (!(cp = get_lcid_codepage( locale ))) + { + FIXME("For locale %04x using current ANSI code page\n", locale); + cp = GetACP(); + } + + countW = MultiByteToWideChar(cp, 0, src, count, NULL, 0); + if((srcW = HeapAlloc(GetProcessHeap(), 0, countW * sizeof(WCHAR)))) + { + MultiByteToWideChar(cp, 0, src, count, srcW, countW); + /* + * NOTE: the target buffer has 1 word for each CHARACTER in the source + * string, with multibyte characters there maybe be more bytes in count + * than character space in the buffer! + */ + ret = GetStringTypeW(type, srcW, countW, chartype); + HeapFree(GetProcessHeap(), 0, srcW); + } + return ret; +} + +/****************************************************************************** + * GetStringTypeExA (KERNEL32.@) + * + * Get characteristics of the characters making up a string. + * + * PARAMS + * locale [I] Locale Id for the string + * type [I] CT_CTYPE1 = classification, CT_CTYPE2 = directionality, CT_CTYPE3 = typographic info + * src [I] String to analyse + * count [I] Length of src in chars, or -1 if src is NUL terminated + * chartype [O] Destination for the calculated characteristics + * + * RETURNS + * Success: TRUE. chartype is filled with the requested characteristics of each char + * in src. + * Failure: FALSE. Use GetLastError() to determine the cause. + */ +BOOL WINAPI GetStringTypeExA( LCID locale, DWORD type, LPCSTR src, INT count, LPWORD chartype ) +{ + return GetStringTypeA(locale, type, src, count, chartype); +} + + +/************************************************************************* + * LCMapStringW (KERNEL32.@) + * + * See LCMapStringA. + */ +INT WINAPI LCMapStringW(LCID lcid, DWORD flags, LPCWSTR src, INT srclen, + LPWSTR dst, INT dstlen) +{ + LPWSTR dst_ptr; + + if (!src || !srclen || dstlen < 0) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + + /* mutually exclusive flags */ + if ((flags & (LCMAP_LOWERCASE | LCMAP_UPPERCASE)) == (LCMAP_LOWERCASE | LCMAP_UPPERCASE) || + (flags & (LCMAP_HIRAGANA | LCMAP_KATAKANA)) == (LCMAP_HIRAGANA | LCMAP_KATAKANA) || + (flags & (LCMAP_HALFWIDTH | LCMAP_FULLWIDTH)) == (LCMAP_HALFWIDTH | LCMAP_FULLWIDTH) || + (flags & (LCMAP_TRADITIONAL_CHINESE | LCMAP_SIMPLIFIED_CHINESE)) == (LCMAP_TRADITIONAL_CHINESE | LCMAP_SIMPLIFIED_CHINESE)) + { + SetLastError(ERROR_INVALID_FLAGS); + return 0; + } + + if (!dstlen) dst = NULL; + + lcid = ConvertDefaultLocale(lcid); + + if (flags & LCMAP_SORTKEY) + { + INT ret; + if (src == dst) + { + SetLastError(ERROR_INVALID_FLAGS); + return 0; + } + + if (srclen < 0) srclen = strlenW(src); + + TRACE("(0x%04x,0x%08x,%s,%d,%p,%d)\n", + lcid, flags, debugstr_wn(src, srclen), srclen, dst, dstlen); + + ret = wine_get_sortkey(flags, src, srclen, (char *)dst, dstlen); + if (ret == 0) + SetLastError(ERROR_INSUFFICIENT_BUFFER); + else + ret++; + return ret; + } + + /* SORT_STRINGSORT must be used exclusively with LCMAP_SORTKEY */ + if (flags & SORT_STRINGSORT) + { + SetLastError(ERROR_INVALID_FLAGS); + return 0; + } + + if (srclen < 0) srclen = strlenW(src) + 1; + + TRACE("(0x%04x,0x%08x,%s,%d,%p,%d)\n", + lcid, flags, debugstr_wn(src, srclen), srclen, dst, dstlen); + + if (!dst) /* return required string length */ + { + INT len; + + for (len = 0; srclen; src++, srclen--) + { + WCHAR wch = *src; + /* tests show that win2k just ignores NORM_IGNORENONSPACE, + * and skips white space and punctuation characters for + * NORM_IGNORESYMBOLS. + */ + if ((flags & NORM_IGNORESYMBOLS) && (get_char_typeW(wch) & (C1_PUNCT | C1_SPACE))) + continue; + len++; + } + return len; + } + + if (flags & LCMAP_UPPERCASE) + { + for (dst_ptr = dst; srclen && dstlen; src++, srclen--) + { + WCHAR wch = *src; + if ((flags & NORM_IGNORESYMBOLS) && (get_char_typeW(wch) & (C1_PUNCT | C1_SPACE))) + continue; + *dst_ptr++ = toupperW(wch); + dstlen--; + } + } + else if (flags & LCMAP_LOWERCASE) + { + for (dst_ptr = dst; srclen && dstlen; src++, srclen--) + { + WCHAR wch = *src; + if ((flags & NORM_IGNORESYMBOLS) && (get_char_typeW(wch) & (C1_PUNCT | C1_SPACE))) + continue; + *dst_ptr++ = tolowerW(wch); + dstlen--; + } + } + else + { + if (src == dst) + { + SetLastError(ERROR_INVALID_FLAGS); + return 0; + } + for (dst_ptr = dst; srclen && dstlen; src++, srclen--) + { + WCHAR wch = *src; + if ((flags & NORM_IGNORESYMBOLS) && (get_char_typeW(wch) & (C1_PUNCT | C1_SPACE))) + continue; + *dst_ptr++ = wch; + dstlen--; + } + } + + if (srclen) + { + SetLastError(ERROR_INSUFFICIENT_BUFFER); + return 0; + } + + return dst_ptr - dst; +} + +/************************************************************************* + * LCMapStringA (KERNEL32.@) + * + * Map characters in a locale sensitive string. + * + * PARAMS + * lcid [I] LCID for the conversion. + * flags [I] Flags controlling the mapping (LCMAP_ constants from "winnls.h"). + * src [I] String to map + * srclen [I] Length of src in chars, or -1 if src is NUL terminated + * dst [O] Destination for mapped string + * dstlen [I] Length of dst in characters + * + * RETURNS + * Success: The length of the mapped string in dst, including the NUL terminator. + * Failure: 0. Use GetLastError() to determine the cause. + */ +INT WINAPI LCMapStringA(LCID lcid, DWORD flags, LPCSTR src, INT srclen, + LPSTR dst, INT dstlen) +{ + WCHAR *bufW = NtCurrentTeb()->StaticUnicodeBuffer; + LPWSTR srcW, dstW; + INT ret = 0, srclenW, dstlenW; + UINT locale_cp = CP_ACP; + + if (!src || !srclen || dstlen < 0) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + + if (!(flags & LOCALE_USE_CP_ACP)) locale_cp = get_lcid_codepage( lcid ); + + srclenW = MultiByteToWideChar(locale_cp, 0, src, srclen, bufW, 260); + if (srclenW) + srcW = bufW; + else + { + srclenW = MultiByteToWideChar(locale_cp, 0, src, srclen, NULL, 0); + srcW = HeapAlloc(GetProcessHeap(), 0, srclenW * sizeof(WCHAR)); + if (!srcW) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return 0; + } + MultiByteToWideChar(locale_cp, 0, src, srclen, srcW, srclenW); + } + + if (flags & LCMAP_SORTKEY) + { + if (src == dst) + { + SetLastError(ERROR_INVALID_FLAGS); + goto map_string_exit; + } + ret = wine_get_sortkey(flags, srcW, srclenW, dst, dstlen); + if (ret == 0) + SetLastError(ERROR_INSUFFICIENT_BUFFER); + else + ret++; + goto map_string_exit; + } + + if (flags & SORT_STRINGSORT) + { + SetLastError(ERROR_INVALID_FLAGS); + goto map_string_exit; + } + + dstlenW = LCMapStringW(lcid, flags, srcW, srclenW, NULL, 0); + if (!dstlenW) + goto map_string_exit; + + dstW = HeapAlloc(GetProcessHeap(), 0, dstlenW * sizeof(WCHAR)); + if (!dstW) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + goto map_string_exit; + } + + LCMapStringW(lcid, flags, srcW, srclenW, dstW, dstlenW); + ret = WideCharToMultiByte(locale_cp, 0, dstW, dstlenW, dst, dstlen, NULL, NULL); + HeapFree(GetProcessHeap(), 0, dstW); + +map_string_exit: + if (srcW != bufW) HeapFree(GetProcessHeap(), 0, srcW); + return ret; +} + +/************************************************************************* + * FoldStringA (KERNEL32.@) + * + * Map characters in a string. + * + * PARAMS + * dwFlags [I] Flags controlling chars to map (MAP_ constants from "winnls.h") + * src [I] String to map + * srclen [I] Length of src, or -1 if src is NUL terminated + * dst [O] Destination for mapped string + * dstlen [I] Length of dst, or 0 to find the required length for the mapped string + * + * RETURNS + * Success: The length of the string written to dst, including the terminating NUL. If + * dstlen is 0, the value returned is the same, but nothing is written to dst, + * and dst may be NULL. + * Failure: 0. Use GetLastError() to determine the cause. + */ +INT WINAPI FoldStringA(DWORD dwFlags, LPCSTR src, INT srclen, + LPSTR dst, INT dstlen) +{ + INT ret = 0, srclenW = 0; + WCHAR *srcW = NULL, *dstW = NULL; + + if (!src || !srclen || dstlen < 0 || (dstlen && !dst) || src == dst) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + + srclenW = MultiByteToWideChar(CP_ACP, dwFlags & MAP_COMPOSITE ? MB_COMPOSITE : 0, + src, srclen, NULL, 0); + srcW = HeapAlloc(GetProcessHeap(), 0, srclenW * sizeof(WCHAR)); + + if (!srcW) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + goto FoldStringA_exit; + } + + MultiByteToWideChar(CP_ACP, dwFlags & MAP_COMPOSITE ? MB_COMPOSITE : 0, + src, srclen, srcW, srclenW); + + dwFlags = (dwFlags & ~MAP_PRECOMPOSED) | MAP_FOLDCZONE; + + ret = FoldStringW(dwFlags, srcW, srclenW, NULL, 0); + if (ret && dstlen) + { + dstW = HeapAlloc(GetProcessHeap(), 0, ret * sizeof(WCHAR)); + + if (!dstW) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + goto FoldStringA_exit; + } + + ret = FoldStringW(dwFlags, srcW, srclenW, dstW, ret); + if (!WideCharToMultiByte(CP_ACP, 0, dstW, ret, dst, dstlen, NULL, NULL)) + { + ret = 0; + SetLastError(ERROR_INSUFFICIENT_BUFFER); + } + } + + HeapFree(GetProcessHeap(), 0, dstW); + +FoldStringA_exit: + HeapFree(GetProcessHeap(), 0, srcW); + return ret; +} + +/************************************************************************* + * FoldStringW (KERNEL32.@) + * + * See FoldStringA. + */ +INT WINAPI FoldStringW(DWORD dwFlags, LPCWSTR src, INT srclen, + LPWSTR dst, INT dstlen) +{ + int ret; + + switch (dwFlags & (MAP_COMPOSITE|MAP_PRECOMPOSED|MAP_EXPAND_LIGATURES)) + { + case 0: + if (dwFlags) + break; + /* Fall through for dwFlags == 0 */ + case MAP_PRECOMPOSED|MAP_COMPOSITE: + case MAP_PRECOMPOSED|MAP_EXPAND_LIGATURES: + case MAP_COMPOSITE|MAP_EXPAND_LIGATURES: + SetLastError(ERROR_INVALID_FLAGS); + return 0; + } + + if (!src || !srclen || dstlen < 0 || (dstlen && !dst) || src == dst) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + + ret = wine_fold_string(dwFlags, src, srclen, dst, dstlen); + if (!ret) + SetLastError(ERROR_INSUFFICIENT_BUFFER); + return ret; +} + +/****************************************************************************** + * CompareStringW (KERNEL32.@) + * + * See CompareStringA. + */ +INT WINAPI CompareStringW(LCID lcid, DWORD style, + LPCWSTR str1, INT len1, LPCWSTR str2, INT len2) +{ + INT ret; + + if (!str1 || !str2) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + + if( style & ~(NORM_IGNORECASE|NORM_IGNORENONSPACE|NORM_IGNORESYMBOLS| + SORT_STRINGSORT|NORM_IGNOREKANATYPE|NORM_IGNOREWIDTH|LOCALE_USE_CP_ACP|0x10000000) ) + { + SetLastError(ERROR_INVALID_FLAGS); + return 0; + } + + /* this style is related to diacritics in Arabic, Japanese, and Hebrew */ + if (style & 0x10000000) + WARN("Ignoring unknown style 0x10000000\n"); + + if (len1 < 0) len1 = strlenW(str1); + if (len2 < 0) len2 = strlenW(str2); + + ret = wine_compare_string(style, str1, len1, str2, len2); + + if (ret) /* need to translate result */ + return (ret < 0) ? CSTR_LESS_THAN : CSTR_GREATER_THAN; + return CSTR_EQUAL; +} + +/****************************************************************************** + * CompareStringA (KERNEL32.@) + * + * Compare two locale sensitive strings. + * + * PARAMS + * lcid [I] LCID for the comparison + * style [I] Flags for the comparison (NORM_ constants from "winnls.h"). + * str1 [I] First string to compare + * len1 [I] Length of str1, or -1 if str1 is NUL terminated + * str2 [I] Second string to compare + * len2 [I] Length of str2, or -1 if str2 is NUL terminated + * + * RETURNS + * Success: CSTR_LESS_THAN, CSTR_EQUAL or CSTR_GREATER_THAN depending on whether + * str1 is less than, equal to or greater than str2 respectively. + * Failure: FALSE. Use GetLastError() to determine the cause. + */ +INT WINAPI CompareStringA(LCID lcid, DWORD style, + LPCSTR str1, INT len1, LPCSTR str2, INT len2) +{ + WCHAR *buf1W = NtCurrentTeb()->StaticUnicodeBuffer; + WCHAR *buf2W = buf1W + 130; + LPWSTR str1W, str2W; + INT len1W, len2W, ret; + UINT locale_cp = CP_ACP; + + if (!str1 || !str2) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + if (len1 < 0) len1 = strlen(str1); + if (len2 < 0) len2 = strlen(str2); + + if (!(style & LOCALE_USE_CP_ACP)) locale_cp = get_lcid_codepage( lcid ); + + len1W = MultiByteToWideChar(locale_cp, 0, str1, len1, buf1W, 130); + if (len1W) + str1W = buf1W; + else + { + len1W = MultiByteToWideChar(locale_cp, 0, str1, len1, NULL, 0); + str1W = HeapAlloc(GetProcessHeap(), 0, len1W * sizeof(WCHAR)); + if (!str1W) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return 0; + } + MultiByteToWideChar(locale_cp, 0, str1, len1, str1W, len1W); + } + len2W = MultiByteToWideChar(locale_cp, 0, str2, len2, buf2W, 130); + if (len2W) + str2W = buf2W; + else + { + len2W = MultiByteToWideChar(locale_cp, 0, str2, len2, NULL, 0); + str2W = HeapAlloc(GetProcessHeap(), 0, len2W * sizeof(WCHAR)); + if (!str2W) + { + if (str1W != buf1W) HeapFree(GetProcessHeap(), 0, str1W); + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return 0; + } + MultiByteToWideChar(locale_cp, 0, str2, len2, str2W, len2W); + } + + ret = CompareStringW(lcid, style, str1W, len1W, str2W, len2W); + + if (str1W != buf1W) HeapFree(GetProcessHeap(), 0, str1W); + if (str2W != buf2W) HeapFree(GetProcessHeap(), 0, str2W); + return ret; +} + +static HANDLE NLS_RegOpenKey(HANDLE hRootKey, LPCWSTR szKeyName) +{ + UNICODE_STRING keyName; + OBJECT_ATTRIBUTES attr; + HANDLE hkey; + + RtlInitUnicodeString( &keyName, szKeyName ); + InitializeObjectAttributes(&attr, &keyName, 0, hRootKey, NULL); + + if (NtOpenKey( &hkey, KEY_READ, &attr ) != STATUS_SUCCESS) + hkey = 0; + + return hkey; +} + +static BOOL NLS_RegEnumSubKey(HANDLE hKey, UINT ulIndex, LPWSTR szKeyName, + ULONG keyNameSize) +{ + BYTE buffer[80]; + KEY_BASIC_INFORMATION *info = (KEY_BASIC_INFORMATION *)buffer; + DWORD dwLen; + + if (NtEnumerateKey( hKey, ulIndex, KeyBasicInformation, buffer, + sizeof(buffer), &dwLen) != STATUS_SUCCESS || + info->NameLength > keyNameSize) + { + return FALSE; + } + + TRACE("info->Name %s info->NameLength %d\n", debugstr_w(info->Name), info->NameLength); + + memcpy( szKeyName, info->Name, info->NameLength); + szKeyName[info->NameLength / sizeof(WCHAR)] = '\0'; + + TRACE("returning %s\n", debugstr_w(szKeyName)); + return TRUE; +} + +static BOOL NLS_RegEnumValue(HANDLE hKey, UINT ulIndex, + LPWSTR szValueName, ULONG valueNameSize, + LPWSTR szValueData, ULONG valueDataSize) +{ + BYTE buffer[80]; + KEY_VALUE_FULL_INFORMATION *info = (KEY_VALUE_FULL_INFORMATION *)buffer; + DWORD dwLen; + + if (NtEnumerateValueKey( hKey, ulIndex, KeyValueFullInformation, + buffer, sizeof(buffer), &dwLen ) != STATUS_SUCCESS || + info->NameLength > valueNameSize || + info->DataLength > valueDataSize) + { + return FALSE; + } + + TRACE("info->Name %s info->DataLength %d\n", debugstr_w(info->Name), info->DataLength); + + memcpy( szValueName, info->Name, info->NameLength); + szValueName[info->NameLength / sizeof(WCHAR)] = '\0'; + memcpy( szValueData, buffer + info->DataOffset, info->DataLength ); + szValueData[info->DataLength / sizeof(WCHAR)] = '\0'; + + TRACE("returning %s %s\n", debugstr_w(szValueName), debugstr_w(szValueData)); + return TRUE; +} + +static BOOL NLS_RegGetDword(HANDLE hKey, LPCWSTR szValueName, DWORD *lpVal) +{ + BYTE buffer[128]; + const KEY_VALUE_PARTIAL_INFORMATION *info = (KEY_VALUE_PARTIAL_INFORMATION *)buffer; + DWORD dwSize = sizeof(buffer); + UNICODE_STRING valueName; + + RtlInitUnicodeString( &valueName, szValueName ); + + TRACE("%p, %s\n", hKey, debugstr_w(szValueName)); + if (NtQueryValueKey( hKey, &valueName, KeyValuePartialInformation, + buffer, dwSize, &dwSize ) == STATUS_SUCCESS && + info->DataLength == sizeof(DWORD)) + { + memcpy(lpVal, info->Data, sizeof(DWORD)); + return TRUE; + } + + return FALSE; +} + +static BOOL NLS_GetLanguageGroupName(LGRPID lgrpid, LPWSTR szName, ULONG nameSize) +{ + LANGID langId; + LPCWSTR szResourceName = MAKEINTRESOURCEW(((lgrpid + 0x2000) >> 4) + 1); + HRSRC hResource; + BOOL bRet = FALSE; + + /* FIXME: Is it correct to use the system default langid? */ + langId = GetSystemDefaultLangID(); + + if (SUBLANGID(langId) == SUBLANG_NEUTRAL) + langId = MAKELANGID( PRIMARYLANGID(langId), SUBLANG_DEFAULT ); + + hResource = FindResourceExW( kernel32_handle, (LPWSTR)RT_STRING, szResourceName, langId ); + + if (hResource) + { + HGLOBAL hResDir = LoadResource( kernel32_handle, hResource ); + + if (hResDir) + { + ULONG iResourceIndex = lgrpid & 0xf; + LPCWSTR lpResEntry = LockResource( hResDir ); + ULONG i; + + for (i = 0; i < iResourceIndex; i++) + lpResEntry += *lpResEntry + 1; + + if (*lpResEntry < nameSize) + { + memcpy( szName, lpResEntry + 1, *lpResEntry * sizeof(WCHAR) ); + szName[*lpResEntry] = '\0'; + bRet = TRUE; + } + + } + FreeResource( hResource ); + } + return bRet; +} + +/* Registry keys for NLS related information */ + +static const WCHAR szCountryListName[] = { + 'M','a','c','h','i','n','e','\\','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','\\', + 'T','e','l','e','p','h','o','n','y','\\', + 'C','o','u','n','t','r','y',' ','L','i','s','t','\0' +}; + + +/* Callback function ptrs for EnumSystemLanguageGroupsA/W */ +typedef struct +{ + LANGUAGEGROUP_ENUMPROCA procA; + LANGUAGEGROUP_ENUMPROCW procW; + DWORD dwFlags; + LONG_PTR lParam; +} ENUMLANGUAGEGROUP_CALLBACKS; + +/* Internal implementation of EnumSystemLanguageGroupsA/W */ +static BOOL NLS_EnumSystemLanguageGroups(ENUMLANGUAGEGROUP_CALLBACKS *lpProcs) +{ + WCHAR szNumber[10], szValue[4]; + HANDLE hKey; + BOOL bContinue = TRUE; + ULONG ulIndex = 0; + + if (!lpProcs) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + switch (lpProcs->dwFlags) + { + case 0: + /* Default to LGRPID_INSTALLED */ + lpProcs->dwFlags = LGRPID_INSTALLED; + /* Fall through... */ + case LGRPID_INSTALLED: + case LGRPID_SUPPORTED: + break; + default: + SetLastError(ERROR_INVALID_FLAGS); + return FALSE; + } + + hKey = NLS_RegOpenKey( 0, szLangGroupsKeyName ); + + if (!hKey) + FIXME("NLS registry key not found. Please apply the default registry file 'wine.inf'\n"); + + while (bContinue) + { + if (NLS_RegEnumValue( hKey, ulIndex, szNumber, sizeof(szNumber), + szValue, sizeof(szValue) )) + { + BOOL bInstalled = szValue[0] == '1' ? TRUE : FALSE; + LGRPID lgrpid = strtoulW( szNumber, NULL, 16 ); + + TRACE("grpid %s (%sinstalled)\n", debugstr_w(szNumber), + bInstalled ? "" : "not "); + + if (lpProcs->dwFlags == LGRPID_SUPPORTED || bInstalled) + { + WCHAR szGrpName[48]; + + if (!NLS_GetLanguageGroupName( lgrpid, szGrpName, sizeof(szGrpName) / sizeof(WCHAR) )) + szGrpName[0] = '\0'; + + if (lpProcs->procW) + bContinue = lpProcs->procW( lgrpid, szNumber, szGrpName, lpProcs->dwFlags, + lpProcs->lParam ); + else + { + char szNumberA[sizeof(szNumber)/sizeof(WCHAR)]; + char szGrpNameA[48]; + + /* FIXME: MSDN doesn't say which code page the W->A translation uses, + * or whether the language names are ever localised. Assume CP_ACP. + */ + + WideCharToMultiByte(CP_ACP, 0, szNumber, -1, szNumberA, sizeof(szNumberA), 0, 0); + WideCharToMultiByte(CP_ACP, 0, szGrpName, -1, szGrpNameA, sizeof(szGrpNameA), 0, 0); + + bContinue = lpProcs->procA( lgrpid, szNumberA, szGrpNameA, lpProcs->dwFlags, + lpProcs->lParam ); + } + } + + ulIndex++; + } + else + bContinue = FALSE; + + if (!bContinue) + break; + } + + if (hKey) + NtClose( hKey ); + + return TRUE; +} + +/****************************************************************************** + * EnumSystemLanguageGroupsA (KERNEL32.@) + * + * Call a users function for each language group available on the system. + * + * PARAMS + * pLangGrpEnumProc [I] Callback function to call for each language group + * dwFlags [I] LGRPID_SUPPORTED=All Supported, LGRPID_INSTALLED=Installed only + * lParam [I] User parameter to pass to pLangGrpEnumProc + * + * RETURNS + * Success: TRUE. + * Failure: FALSE. Use GetLastError() to determine the cause. + */ +BOOL WINAPI EnumSystemLanguageGroupsA(LANGUAGEGROUP_ENUMPROCA pLangGrpEnumProc, + DWORD dwFlags, LONG_PTR lParam) +{ + ENUMLANGUAGEGROUP_CALLBACKS procs; + + TRACE("(%p,0x%08X,0x%08lX)\n", pLangGrpEnumProc, dwFlags, lParam); + + procs.procA = pLangGrpEnumProc; + procs.procW = NULL; + procs.dwFlags = dwFlags; + procs.lParam = lParam; + + return NLS_EnumSystemLanguageGroups( pLangGrpEnumProc ? &procs : NULL); +} + +/****************************************************************************** + * EnumSystemLanguageGroupsW (KERNEL32.@) + * + * See EnumSystemLanguageGroupsA. + */ +BOOL WINAPI EnumSystemLanguageGroupsW(LANGUAGEGROUP_ENUMPROCW pLangGrpEnumProc, + DWORD dwFlags, LONG_PTR lParam) +{ + ENUMLANGUAGEGROUP_CALLBACKS procs; + + TRACE("(%p,0x%08X,0x%08lX)\n", pLangGrpEnumProc, dwFlags, lParam); + + procs.procA = NULL; + procs.procW = pLangGrpEnumProc; + procs.dwFlags = dwFlags; + procs.lParam = lParam; + + return NLS_EnumSystemLanguageGroups( pLangGrpEnumProc ? &procs : NULL); +} + +/****************************************************************************** + * IsValidLanguageGroup (KERNEL32.@) + * + * Determine if a language group is supported and/or installed. + * + * PARAMS + * lgrpid [I] Language Group Id (LGRPID_ values from "winnls.h") + * dwFlags [I] LGRPID_SUPPORTED=Supported, LGRPID_INSTALLED=Installed + * + * RETURNS + * TRUE, if lgrpid is supported and/or installed, according to dwFlags. + * FALSE otherwise. + */ +BOOL WINAPI IsValidLanguageGroup(LGRPID lgrpid, DWORD dwFlags) +{ + static const WCHAR szFormat[] = { '%','x','\0' }; + WCHAR szValueName[16], szValue[2]; + BOOL bSupported = FALSE, bInstalled = FALSE; + HANDLE hKey; + + + switch (dwFlags) + { + case LGRPID_INSTALLED: + case LGRPID_SUPPORTED: + + hKey = NLS_RegOpenKey( 0, szLangGroupsKeyName ); + + sprintfW( szValueName, szFormat, lgrpid ); + + if (NLS_RegGetDword( hKey, szValueName, (LPDWORD)szValue )) + { + bSupported = TRUE; + + if (szValue[0] == '1') + bInstalled = TRUE; + } + + if (hKey) + NtClose( hKey ); + + break; + } + + if ((dwFlags == LGRPID_SUPPORTED && bSupported) || + (dwFlags == LGRPID_INSTALLED && bInstalled)) + return TRUE; + + return FALSE; +} + +/* Callback function ptrs for EnumLanguageGrouplocalesA/W */ +typedef struct +{ + LANGGROUPLOCALE_ENUMPROCA procA; + LANGGROUPLOCALE_ENUMPROCW procW; + DWORD dwFlags; + LGRPID lgrpid; + LONG_PTR lParam; +} ENUMLANGUAGEGROUPLOCALE_CALLBACKS; + +/* Internal implementation of EnumLanguageGrouplocalesA/W */ +static BOOL NLS_EnumLanguageGroupLocales(ENUMLANGUAGEGROUPLOCALE_CALLBACKS *lpProcs) +{ + static const WCHAR szAlternateSortsKeyName[] = { + 'A','l','t','e','r','n','a','t','e',' ','S','o','r','t','s','\0' + }; + WCHAR szNumber[10], szValue[4]; + HANDLE hKey; + BOOL bContinue = TRUE, bAlternate = FALSE; + LGRPID lgrpid; + ULONG ulIndex = 1; /* Ignore default entry of 1st key */ + + if (!lpProcs || !lpProcs->lgrpid || lpProcs->lgrpid > LGRPID_ARMENIAN) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + if (lpProcs->dwFlags) + { + SetLastError(ERROR_INVALID_FLAGS); + return FALSE; + } + + hKey = NLS_RegOpenKey( 0, szLocaleKeyName ); + + if (!hKey) + WARN("NLS registry key not found. Please apply the default registry file 'wine.inf'\n"); + + while (bContinue) + { + if (NLS_RegEnumValue( hKey, ulIndex, szNumber, sizeof(szNumber), + szValue, sizeof(szValue) )) + { + lgrpid = strtoulW( szValue, NULL, 16 ); + + TRACE("lcid %s, grpid %d (%smatched)\n", debugstr_w(szNumber), + lgrpid, lgrpid == lpProcs->lgrpid ? "" : "not "); + + if (lgrpid == lpProcs->lgrpid) + { + LCID lcid; + + lcid = strtoulW( szNumber, NULL, 16 ); + + /* FIXME: native returns extra text for a few (17/150) locales, e.g: + * '00000437 ;Georgian' + * At present we only pass the LCID string. + */ + + if (lpProcs->procW) + bContinue = lpProcs->procW( lgrpid, lcid, szNumber, lpProcs->lParam ); + else + { + char szNumberA[sizeof(szNumber)/sizeof(WCHAR)]; + + WideCharToMultiByte(CP_ACP, 0, szNumber, -1, szNumberA, sizeof(szNumberA), 0, 0); + + bContinue = lpProcs->procA( lgrpid, lcid, szNumberA, lpProcs->lParam ); + } + } + + ulIndex++; + } + else + { + /* Finished enumerating this key */ + if (!bAlternate) + { + /* Enumerate alternate sorts also */ + hKey = NLS_RegOpenKey( hKey, szAlternateSortsKeyName ); + bAlternate = TRUE; + ulIndex = 0; + } + else + bContinue = FALSE; /* Finished both keys */ + } + + if (!bContinue) + break; + } + + if (hKey) + NtClose( hKey ); + + return TRUE; +} + +/****************************************************************************** + * EnumLanguageGroupLocalesA (KERNEL32.@) + * + * Call a users function for every locale in a language group available on the system. + * + * PARAMS + * pLangGrpLcEnumProc [I] Callback function to call for each locale + * lgrpid [I] Language group (LGRPID_ values from "winnls.h") + * dwFlags [I] Reserved, set to 0 + * lParam [I] User parameter to pass to pLangGrpLcEnumProc + * + * RETURNS + * Success: TRUE. + * Failure: FALSE. Use GetLastError() to determine the cause. + */ +BOOL WINAPI EnumLanguageGroupLocalesA(LANGGROUPLOCALE_ENUMPROCA pLangGrpLcEnumProc, + LGRPID lgrpid, DWORD dwFlags, LONG_PTR lParam) +{ + ENUMLANGUAGEGROUPLOCALE_CALLBACKS callbacks; + + TRACE("(%p,0x%08X,0x%08X,0x%08lX)\n", pLangGrpLcEnumProc, lgrpid, dwFlags, lParam); + + callbacks.procA = pLangGrpLcEnumProc; + callbacks.procW = NULL; + callbacks.dwFlags = dwFlags; + callbacks.lgrpid = lgrpid; + callbacks.lParam = lParam; + + return NLS_EnumLanguageGroupLocales( pLangGrpLcEnumProc ? &callbacks : NULL ); +} + +/****************************************************************************** + * EnumLanguageGroupLocalesW (KERNEL32.@) + * + * See EnumLanguageGroupLocalesA. + */ +BOOL WINAPI EnumLanguageGroupLocalesW(LANGGROUPLOCALE_ENUMPROCW pLangGrpLcEnumProc, + LGRPID lgrpid, DWORD dwFlags, LONG_PTR lParam) +{ + ENUMLANGUAGEGROUPLOCALE_CALLBACKS callbacks; + + TRACE("(%p,0x%08X,0x%08X,0x%08lX)\n", pLangGrpLcEnumProc, lgrpid, dwFlags, lParam); + + callbacks.procA = NULL; + callbacks.procW = pLangGrpLcEnumProc; + callbacks.dwFlags = dwFlags; + callbacks.lgrpid = lgrpid; + callbacks.lParam = lParam; + + return NLS_EnumLanguageGroupLocales( pLangGrpLcEnumProc ? &callbacks : NULL ); +} + +/* Callback function ptrs for EnumSystemCodePagesA/W */ +typedef struct +{ + CODEPAGE_ENUMPROCA procA; + CODEPAGE_ENUMPROCW procW; + DWORD dwFlags; +} ENUMSYSTEMCODEPAGES_CALLBACKS; + +/* Internal implementation of EnumSystemCodePagesA/W */ +static BOOL NLS_EnumSystemCodePages(ENUMSYSTEMCODEPAGES_CALLBACKS *lpProcs) +{ + WCHAR szNumber[5 + 1], szValue[MAX_PATH]; + HANDLE hKey; + BOOL bContinue = TRUE; + ULONG ulIndex = 0; + + if (!lpProcs) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + switch (lpProcs->dwFlags) + { + case CP_INSTALLED: + case CP_SUPPORTED: + break; + default: + SetLastError(ERROR_INVALID_FLAGS); + return FALSE; + } + + hKey = NLS_RegOpenKey(0, L"\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\NLS\\CodePage"); + if (!hKey) + { + WARN("NLS_RegOpenKey() failed\n"); + return FALSE; + } + + while (bContinue) + { + if (NLS_RegEnumValue(hKey, ulIndex, szNumber, sizeof(szNumber), + szValue, sizeof(szValue))) + { + if ((lpProcs->dwFlags == CP_SUPPORTED)|| + ((lpProcs->dwFlags == CP_INSTALLED)&&(wcslen(szValue) > 2))) + { + if (lpProcs->procW) + { + bContinue = lpProcs->procW(szNumber); + } + else + { + char szNumberA[sizeof(szNumber)/sizeof(WCHAR)]; + + WideCharToMultiByte(CP_ACP, 0, szNumber, -1, szNumberA, sizeof(szNumberA), 0, 0); + bContinue = lpProcs->procA(szNumberA); + } + } + + ulIndex++; + + } else bContinue = FALSE; + + if (!bContinue) + break; + } + + if (hKey) + NtClose(hKey); + + return TRUE; +} + +/* + * @implemented + */ +BOOL +WINAPI +EnumSystemCodePagesW ( + CODEPAGE_ENUMPROCW lpCodePageEnumProc, + DWORD dwFlags + ) +{ + ENUMSYSTEMCODEPAGES_CALLBACKS procs; + + TRACE("(%p,0x%08X,0x%08lX)\n", lpCodePageEnumProc, dwFlags); + + procs.procA = NULL; + procs.procW = lpCodePageEnumProc; + procs.dwFlags = dwFlags; + + return NLS_EnumSystemCodePages(lpCodePageEnumProc ? &procs : NULL); +} + + +/* + * @implemented + */ +BOOL +WINAPI +EnumSystemCodePagesA ( + CODEPAGE_ENUMPROCA lpCodePageEnumProc, + DWORD dwFlags + ) +{ + ENUMSYSTEMCODEPAGES_CALLBACKS procs; + + TRACE("(%p,0x%08X,0x%08lX)\n", lpCodePageEnumProc, dwFlags); + + procs.procA = lpCodePageEnumProc; + procs.procW = NULL; + procs.dwFlags = dwFlags; + + return NLS_EnumSystemCodePages(lpCodePageEnumProc ? &procs : NULL); +} +/****************************************************************************** + * EnumSystemGeoID (KERNEL32.@) + * + * Call a users function for every location available on the system. + * + * PARAMS + * geoclass [I] Type of information desired (SYSGEOTYPE enum from "winnls.h") + * reserved [I] Reserved, set to 0 + * pGeoEnumProc [I] Callback function to call for each location + * + * RETURNS + * Success: TRUE. + * Failure: FALSE. Use GetLastError() to determine the cause. + */ +BOOL WINAPI EnumSystemGeoID(GEOCLASS geoclass, GEOID reserved, GEO_ENUMPROC pGeoEnumProc) +{ + static const WCHAR szCountryCodeValueName[] = { + 'C','o','u','n','t','r','y','C','o','d','e','\0' + }; + WCHAR szNumber[10]; + HANDLE hKey; + ULONG ulIndex = 0; + + TRACE("(0x%08X,0x%08X,%p)\n", geoclass, reserved, pGeoEnumProc); + + if (geoclass != GEOCLASS_NATION || reserved || !pGeoEnumProc) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + hKey = NLS_RegOpenKey( 0, szCountryListName ); + + while (NLS_RegEnumSubKey( hKey, ulIndex, szNumber, sizeof(szNumber) )) + { + BOOL bContinue = TRUE; + DWORD dwGeoId; + HANDLE hSubKey = NLS_RegOpenKey( hKey, szNumber ); + + if (hSubKey) + { + if (NLS_RegGetDword( hSubKey, szCountryCodeValueName, &dwGeoId )) + { + TRACE("Got geoid %d\n", dwGeoId); + + if (!pGeoEnumProc( dwGeoId )) + bContinue = FALSE; + } + + NtClose( hSubKey ); + } + + if (!bContinue) + break; + + ulIndex++; + } + + if (hKey) + NtClose( hKey ); + + return TRUE; +} + +/****************************************************************************** + * InvalidateNLSCache (KERNEL32.@) + * + * Invalidate the cache of NLS values. + * + * PARAMS + * None. + * + * RETURNS + * Success: TRUE. + * Failure: FALSE. + */ +BOOL WINAPI InvalidateNLSCache(void) +{ + FIXME("() stub\n"); + return FALSE; +} + +/****************************************************************************** + * GetUserGeoID (KERNEL32.@) + */ +GEOID WINAPI GetUserGeoID( GEOCLASS GeoClass ) +{ + GEOID ret = GEOID_NOT_AVAILABLE; + static const WCHAR geoW[] = {'G','e','o',0}; + static const WCHAR nationW[] = {'N','a','t','i','o','n',0}; + WCHAR bufferW[40], *end; + DWORD count; + HANDLE hkey, hSubkey = 0; + UNICODE_STRING keyW; + const KEY_VALUE_PARTIAL_INFORMATION *info = (KEY_VALUE_PARTIAL_INFORMATION *)bufferW; + RtlInitUnicodeString( &keyW, nationW ); + count = sizeof(bufferW); + + if(!(hkey = create_registry_key())) return ret; + + switch( GeoClass ){ + case GEOCLASS_NATION: + if ((hSubkey = NLS_RegOpenKey(hkey, geoW))) + { + if((NtQueryValueKey(hSubkey, &keyW, KeyValuePartialInformation, + bufferW, count, &count) == STATUS_SUCCESS ) && info->DataLength) + ret = strtolW((LPCWSTR)info->Data, &end, 10); + } + break; + case GEOCLASS_REGION: + FIXME("GEOCLASS_REGION not handled yet\n"); + break; + } + + NtClose(hkey); + if (hSubkey) NtClose(hSubkey); + return ret; +} + +/****************************************************************************** + * SetUserGeoID (KERNEL32.@) + */ +BOOL WINAPI SetUserGeoID( GEOID GeoID ) +{ + static const WCHAR geoW[] = {'G','e','o',0}; + static const WCHAR nationW[] = {'N','a','t','i','o','n',0}; + static const WCHAR formatW[] = {'%','i',0}; + UNICODE_STRING nameW,keyW; + WCHAR bufferW[10]; + OBJECT_ATTRIBUTES attr; + HANDLE hkey; + + if(!(hkey = create_registry_key())) return FALSE; + + attr.Length = sizeof(attr); + attr.RootDirectory = hkey; + attr.ObjectName = &nameW; + attr.Attributes = 0; + attr.SecurityDescriptor = NULL; + attr.SecurityQualityOfService = NULL; + RtlInitUnicodeString( &nameW, geoW ); + RtlInitUnicodeString( &keyW, nationW ); + + if (NtCreateKey( &hkey, KEY_ALL_ACCESS, &attr, 0, NULL, 0, NULL ) != STATUS_SUCCESS) + + { + NtClose(attr.RootDirectory); + return FALSE; + } + + sprintfW(bufferW, formatW, GeoID); + NtSetValueKey(hkey, &keyW, 0, REG_SZ, bufferW, (strlenW(bufferW) + 1) * sizeof(WCHAR)); + NtClose(attr.RootDirectory); + NtClose(hkey); + return TRUE; +} + +typedef struct +{ + union + { + UILANGUAGE_ENUMPROCA procA; + UILANGUAGE_ENUMPROCW procW; + } u; + DWORD flags; + LONG_PTR param; +} ENUM_UILANG_CALLBACK; + +static BOOL CALLBACK enum_uilang_proc_a( HMODULE hModule, LPCSTR type, + LPCSTR name, WORD LangID, LONG_PTR lParam ) +{ + ENUM_UILANG_CALLBACK *enum_uilang = (ENUM_UILANG_CALLBACK *)lParam; + char buf[20]; + + sprintf(buf, "%08x", (UINT)LangID); + return enum_uilang->u.procA( buf, enum_uilang->param ); +} + +static BOOL CALLBACK enum_uilang_proc_w( HMODULE hModule, LPCWSTR type, + LPCWSTR name, WORD LangID, LONG_PTR lParam ) +{ + static const WCHAR formatW[] = {'%','0','8','x',0}; + ENUM_UILANG_CALLBACK *enum_uilang = (ENUM_UILANG_CALLBACK *)lParam; + WCHAR buf[20]; + + sprintfW( buf, formatW, (UINT)LangID ); + return enum_uilang->u.procW( buf, enum_uilang->param ); +} + +/****************************************************************************** + * EnumUILanguagesA (KERNEL32.@) + */ +BOOL WINAPI EnumUILanguagesA(UILANGUAGE_ENUMPROCA pUILangEnumProc, DWORD dwFlags, LONG_PTR lParam) +{ + ENUM_UILANG_CALLBACK enum_uilang; + + TRACE("%p, %x, %lx\n", pUILangEnumProc, dwFlags, lParam); + + if(!pUILangEnumProc) { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + if(dwFlags) { + SetLastError(ERROR_INVALID_FLAGS); + return FALSE; + } + + enum_uilang.u.procA = pUILangEnumProc; + enum_uilang.flags = dwFlags; + enum_uilang.param = lParam; + + EnumResourceLanguagesA( kernel32_handle, (LPCSTR)RT_STRING, + (LPCSTR)LOCALE_ILANGUAGE, enum_uilang_proc_a, + (LONG_PTR)&enum_uilang); + return TRUE; +} + +/****************************************************************************** + * EnumUILanguagesW (KERNEL32.@) + */ +BOOL WINAPI EnumUILanguagesW(UILANGUAGE_ENUMPROCW pUILangEnumProc, DWORD dwFlags, LONG_PTR lParam) +{ + ENUM_UILANG_CALLBACK enum_uilang; + + TRACE("%p, %x, %lx\n", pUILangEnumProc, dwFlags, lParam); + + + if(!pUILangEnumProc) { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + if(dwFlags) { + SetLastError(ERROR_INVALID_FLAGS); + return FALSE; + } + + enum_uilang.u.procW = pUILangEnumProc; + enum_uilang.flags = dwFlags; + enum_uilang.param = lParam; + + EnumResourceLanguagesW( kernel32_handle, (LPCWSTR)RT_STRING, + (LPCWSTR)LOCALE_ILANGUAGE, enum_uilang_proc_w, + (LONG_PTR)&enum_uilang); + return TRUE; +} + +INT WINAPI GetGeoInfoW(GEOID GeoId, GEOTYPE GeoType, LPWSTR lpGeoData, + int cchData, LANGID language) +{ + FIXME("%d %d %p %d %d\n", GeoId, GeoType, lpGeoData, cchData, language); + return 0; +} + +INT WINAPI GetGeoInfoA(GEOID GeoId, GEOTYPE GeoType, LPSTR lpGeoData, + int cchData, LANGID language) +{ + FIXME("%d %d %p %d %d\n", GeoId, GeoType, lpGeoData, cchData, language); + return 0; +} diff --git a/dll/win32/kernel32/misc/lcformat.c b/dll/win32/kernel32/winnls/string/lcformat.c similarity index 87% rename from dll/win32/kernel32/misc/lcformat.c rename to dll/win32/kernel32/winnls/string/lcformat.c index 663dec62819..bf8b7ae93c4 100644 --- a/dll/win32/kernel32/misc/lcformat.c +++ b/dll/win32/kernel32/winnls/string/lcformat.c @@ -3,7 +3,7 @@ * * Copyright 1995 Martin von Loewis * Copyright 1998 David Lee Lambert - * Copyright 2000 Julio Csar Gzquez + * Copyright 2000 Julio C√©sar G√°zquez * Copyright 2003 Jon Griffiths * Copyright 2005 Dmitry Timoshkov * @@ -22,17 +22,29 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -/* - * Whole file ripped from Wine's dlls\kernel\lcformat.c, rev 1.7 and is - * unchanged except that includes are different. I thought about adding - * @implemeted to each exported function, but this might make merging harder? - * -Gunnar - */ +//#include "config.h" +//#include "wine/port.h" -#include -#define NDEBUG -#include -DEBUG_CHANNEL(resource); +#include +#include +#include +#include + +#include "windef.h" +#include "winbase.h" +#include "wine/unicode.h" +#include "wine/debug.h" +#include "winternl.h" + +#define CRITICAL_SECTION RTL_CRITICAL_SECTION +#define CRITICAL_SECTION_DEBUG RTL_CRITICAL_SECTION_DEBUG +#define CALINFO_MAX_YEAR 2029 + +#define HeapAlloc RtlAllocateHeap +#define HeapReAlloc RtlReAllocateHeap +#define HeapFree RtlFreeHeap + +WINE_DEFAULT_DEBUG_CHANNEL(nls); #define DATE_DATEVARSONLY 0x0100 /* only date stuff: yMdg */ #define TIME_TIMEVARSONLY 0x0200 /* only time stuff: hHmst */ @@ -77,15 +89,15 @@ typedef struct _NLS_FORMAT_NODE #define GetShortMonth(fmt,mth) fmt->lppszStrings[42 + mth] /* Write access to the cache is protected by this critical section */ -static RTL_CRITICAL_SECTION NLS_FormatsCS; -static RTL_CRITICAL_SECTION_DEBUG NLS_FormatsCS_debug = +static CRITICAL_SECTION NLS_FormatsCS; +static CRITICAL_SECTION_DEBUG NLS_FormatsCS_debug = { 0, 0, &NLS_FormatsCS, { &NLS_FormatsCS_debug.ProcessLocksList, &NLS_FormatsCS_debug.ProcessLocksList }, - 0, 0, 0, 0, 0 + 0, 0, 0 }; -static RTL_CRITICAL_SECTION NLS_FormatsCS = { &NLS_FormatsCS_debug, -1, 0, 0, 0, 0 }; +static CRITICAL_SECTION NLS_FormatsCS = { &NLS_FormatsCS_debug, -1, 0, 0, 0, 0 }; /************************************************************************** * NLS_GetLocaleNumber @@ -1044,10 +1056,8 @@ INT WINAPI GetNumberFormatW(LCID lcid, DWORD dwFlags, TRACE("(0x%04x,0x%08x,%s,%p,%p,%d)\n", lcid, dwFlags, debugstr_w(lpszValue), lpFormat, lpNumberStr, cchOut); - lcid = ConvertDefaultLocale(lcid); - if (!lpszValue || cchOut < 0 || (cchOut > 0 && !lpNumberStr) || - !IsValidLocale(lcid, LCID_INSTALLED) || + !IsValidLocale(lcid, 0) || (lpFormat && (dwFlags || !lpFormat->lpDecimalSep || !lpFormat->lpThousandSep))) { goto error; @@ -1417,10 +1427,8 @@ INT WINAPI GetCurrencyFormatW(LCID lcid, DWORD dwFlags, TRACE("(0x%04x,0x%08x,%s,%p,%p,%d)\n", lcid, dwFlags, debugstr_w(lpszValue), lpFormat, lpCurrencyStr, cchOut); - lcid = ConvertDefaultLocale(lcid); - if (!lpszValue || cchOut < 0 || (cchOut > 0 && !lpCurrencyStr) || - !IsValidLocale(lcid, LCID_INSTALLED) || + !IsValidLocale(lcid, 0) || (lpFormat && (dwFlags || !lpFormat->lpDecimalSep || !lpFormat->lpThousandSep || !lpFormat->lpCurrencySymbol || lpFormat->NegativeOrder > 15 || lpFormat->PositiveOrder > 3))) @@ -2082,3 +2090,213 @@ BOOL WINAPI EnumCalendarInfoExW( CALINFO_ENUMPROCEXW calinfoproc,LCID locale, TRACE("(%p,0x%08x,0x%08x,0x%08x)\n", calinfoproc, locale, calendar, caltype); return NLS_EnumCalendarInfoAW(calinfoproc, locale, calendar, caltype, TRUE, TRUE); } + +/********************************************************************* + * GetCalendarInfoA (KERNEL32.@) + * + */ +int WINAPI GetCalendarInfoA(LCID lcid, CALID Calendar, CALTYPE CalType, + LPSTR lpCalData, int cchData, LPDWORD lpValue) +{ + int ret; + LPWSTR lpCalDataW = NULL; + + if (NLS_IsUnicodeOnlyLcid(lcid)) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + + if (cchData && + !(lpCalDataW = HeapAlloc(GetProcessHeap(), 0, cchData*sizeof(WCHAR)))) + return 0; + + ret = GetCalendarInfoW(lcid, Calendar, CalType, lpCalDataW, cchData, lpValue); + if(ret && lpCalDataW && lpCalData) + WideCharToMultiByte(CP_ACP, 0, lpCalDataW, cchData, lpCalData, cchData, NULL, NULL); + else if (CalType & CAL_RETURN_NUMBER) + ret *= sizeof(WCHAR); + HeapFree(GetProcessHeap(), 0, lpCalDataW); + + return ret; +} + +/********************************************************************* + * GetCalendarInfoW (KERNEL32.@) + * + */ +int WINAPI GetCalendarInfoW(LCID Locale, CALID Calendar, CALTYPE CalType, + LPWSTR lpCalData, int cchData, LPDWORD lpValue) +{ + if (CalType & CAL_NOUSEROVERRIDE) + FIXME("flag CAL_NOUSEROVERRIDE used, not fully implemented\n"); + if (CalType & CAL_USE_CP_ACP) + FIXME("flag CAL_USE_CP_ACP used, not fully implemented\n"); + + if (CalType & CAL_RETURN_NUMBER) { + if (!lpValue) + { + SetLastError( ERROR_INVALID_PARAMETER ); + return 0; + } + if (lpCalData != NULL) + WARN("lpCalData not NULL (%p) when it should!\n", lpCalData); + if (cchData != 0) + WARN("cchData not 0 (%d) when it should!\n", cchData); + } else { + if (lpValue != NULL) + WARN("lpValue not NULL (%p) when it should!\n", lpValue); + } + + /* FIXME: No verification is made yet wrt Locale + * for the CALTYPES not requiring GetLocaleInfoA */ + switch (CalType & ~(CAL_NOUSEROVERRIDE|CAL_RETURN_NUMBER|CAL_USE_CP_ACP)) { + case CAL_ICALINTVALUE: + FIXME("Unimplemented caltype %d\n", CalType & 0xffff); + return 0; + case CAL_SCALNAME: + FIXME("Unimplemented caltype %d\n", CalType & 0xffff); + return 0; + case CAL_IYEAROFFSETRANGE: + FIXME("Unimplemented caltype %d\n", CalType & 0xffff); + return 0; + case CAL_SERASTRING: + FIXME("Unimplemented caltype %d\n", CalType & 0xffff); + return 0; + case CAL_SSHORTDATE: + return GetLocaleInfoW(Locale, LOCALE_SSHORTDATE, lpCalData, cchData); + case CAL_SLONGDATE: + return GetLocaleInfoW(Locale, LOCALE_SLONGDATE, lpCalData, cchData); + case CAL_SDAYNAME1: + return GetLocaleInfoW(Locale, LOCALE_SDAYNAME1, lpCalData, cchData); + case CAL_SDAYNAME2: + return GetLocaleInfoW(Locale, LOCALE_SDAYNAME2, lpCalData, cchData); + case CAL_SDAYNAME3: + return GetLocaleInfoW(Locale, LOCALE_SDAYNAME3, lpCalData, cchData); + case CAL_SDAYNAME4: + return GetLocaleInfoW(Locale, LOCALE_SDAYNAME4, lpCalData, cchData); + case CAL_SDAYNAME5: + return GetLocaleInfoW(Locale, LOCALE_SDAYNAME5, lpCalData, cchData); + case CAL_SDAYNAME6: + return GetLocaleInfoW(Locale, LOCALE_SDAYNAME6, lpCalData, cchData); + case CAL_SDAYNAME7: + return GetLocaleInfoW(Locale, LOCALE_SDAYNAME7, lpCalData, cchData); + case CAL_SABBREVDAYNAME1: + return GetLocaleInfoW(Locale, LOCALE_SABBREVDAYNAME1, lpCalData, cchData); + case CAL_SABBREVDAYNAME2: + return GetLocaleInfoW(Locale, LOCALE_SABBREVDAYNAME2, lpCalData, cchData); + case CAL_SABBREVDAYNAME3: + return GetLocaleInfoW(Locale, LOCALE_SABBREVDAYNAME3, lpCalData, cchData); + case CAL_SABBREVDAYNAME4: + return GetLocaleInfoW(Locale, LOCALE_SABBREVDAYNAME4, lpCalData, cchData); + case CAL_SABBREVDAYNAME5: + return GetLocaleInfoW(Locale, LOCALE_SABBREVDAYNAME5, lpCalData, cchData); + case CAL_SABBREVDAYNAME6: + return GetLocaleInfoW(Locale, LOCALE_SABBREVDAYNAME6, lpCalData, cchData); + case CAL_SABBREVDAYNAME7: + return GetLocaleInfoW(Locale, LOCALE_SABBREVDAYNAME7, lpCalData, cchData); + case CAL_SMONTHNAME1: + return GetLocaleInfoW(Locale, LOCALE_SMONTHNAME1, lpCalData, cchData); + case CAL_SMONTHNAME2: + return GetLocaleInfoW(Locale, LOCALE_SMONTHNAME2, lpCalData, cchData); + case CAL_SMONTHNAME3: + return GetLocaleInfoW(Locale, LOCALE_SMONTHNAME3, lpCalData, cchData); + case CAL_SMONTHNAME4: + return GetLocaleInfoW(Locale, LOCALE_SMONTHNAME4, lpCalData, cchData); + case CAL_SMONTHNAME5: + return GetLocaleInfoW(Locale, LOCALE_SMONTHNAME5, lpCalData, cchData); + case CAL_SMONTHNAME6: + return GetLocaleInfoW(Locale, LOCALE_SMONTHNAME6, lpCalData, cchData); + case CAL_SMONTHNAME7: + return GetLocaleInfoW(Locale, LOCALE_SMONTHNAME7, lpCalData, cchData); + case CAL_SMONTHNAME8: + return GetLocaleInfoW(Locale, LOCALE_SMONTHNAME8, lpCalData, cchData); + case CAL_SMONTHNAME9: + return GetLocaleInfoW(Locale, LOCALE_SMONTHNAME9, lpCalData, cchData); + case CAL_SMONTHNAME10: + return GetLocaleInfoW(Locale, LOCALE_SMONTHNAME10, lpCalData, cchData); + case CAL_SMONTHNAME11: + return GetLocaleInfoW(Locale, LOCALE_SMONTHNAME11, lpCalData, cchData); + case CAL_SMONTHNAME12: + return GetLocaleInfoW(Locale, LOCALE_SMONTHNAME12, lpCalData, cchData); + case CAL_SMONTHNAME13: + return GetLocaleInfoW(Locale, LOCALE_SMONTHNAME13, lpCalData, cchData); + case CAL_SABBREVMONTHNAME1: + return GetLocaleInfoW(Locale, LOCALE_SABBREVMONTHNAME1, lpCalData, cchData); + case CAL_SABBREVMONTHNAME2: + return GetLocaleInfoW(Locale, LOCALE_SABBREVMONTHNAME2, lpCalData, cchData); + case CAL_SABBREVMONTHNAME3: + return GetLocaleInfoW(Locale, LOCALE_SABBREVMONTHNAME3, lpCalData, cchData); + case CAL_SABBREVMONTHNAME4: + return GetLocaleInfoW(Locale, LOCALE_SABBREVMONTHNAME4, lpCalData, cchData); + case CAL_SABBREVMONTHNAME5: + return GetLocaleInfoW(Locale, LOCALE_SABBREVMONTHNAME5, lpCalData, cchData); + case CAL_SABBREVMONTHNAME6: + return GetLocaleInfoW(Locale, LOCALE_SABBREVMONTHNAME6, lpCalData, cchData); + case CAL_SABBREVMONTHNAME7: + return GetLocaleInfoW(Locale, LOCALE_SABBREVMONTHNAME7, lpCalData, cchData); + case CAL_SABBREVMONTHNAME8: + return GetLocaleInfoW(Locale, LOCALE_SABBREVMONTHNAME8, lpCalData, cchData); + case CAL_SABBREVMONTHNAME9: + return GetLocaleInfoW(Locale, LOCALE_SABBREVMONTHNAME9, lpCalData, cchData); + case CAL_SABBREVMONTHNAME10: + return GetLocaleInfoW(Locale, LOCALE_SABBREVMONTHNAME10, lpCalData, cchData); + case CAL_SABBREVMONTHNAME11: + return GetLocaleInfoW(Locale, LOCALE_SABBREVMONTHNAME11, lpCalData, cchData); + case CAL_SABBREVMONTHNAME12: + return GetLocaleInfoW(Locale, LOCALE_SABBREVMONTHNAME12, lpCalData, cchData); + case CAL_SABBREVMONTHNAME13: + return GetLocaleInfoW(Locale, LOCALE_SABBREVMONTHNAME13, lpCalData, cchData); + case CAL_SYEARMONTH: + return GetLocaleInfoW(Locale, LOCALE_SYEARMONTH, lpCalData, cchData); + case CAL_ITWODIGITYEARMAX: + if (CalType & CAL_RETURN_NUMBER) + { + *lpValue = CALINFO_MAX_YEAR; + return sizeof(DWORD) / sizeof(WCHAR); + } + else + { + static const WCHAR fmtW[] = {'%','u',0}; + WCHAR buffer[10]; + int ret = snprintfW( buffer, 10, fmtW, CALINFO_MAX_YEAR ) + 1; + if (!lpCalData) return ret; + if (ret <= cchData) + { + strcpyW( lpCalData, buffer ); + return ret; + } + SetLastError( ERROR_INSUFFICIENT_BUFFER ); + return 0; + } + break; + default: + FIXME("Unknown caltype %d\n",CalType & 0xffff); + SetLastError(ERROR_INVALID_FLAGS); + return 0; + } + return 0; +} + +/********************************************************************* + * SetCalendarInfoA (KERNEL32.@) + * + */ +int WINAPI SetCalendarInfoA(LCID Locale, CALID Calendar, CALTYPE CalType, LPCSTR lpCalData) +{ + FIXME("(%08x,%08x,%08x,%s): stub\n", + Locale, Calendar, CalType, debugstr_a(lpCalData)); + return 0; +} + +/********************************************************************* + * SetCalendarInfoW (KERNEL32.@) + * + * + */ +int WINAPI SetCalendarInfoW(LCID Locale, CALID Calendar, CALTYPE CalType, LPCWSTR lpCalData) +{ + FIXME("(%08x,%08x,%08x,%s): stub\n", + Locale, Calendar, CalType, debugstr_w(lpCalData)); + return 0; +} diff --git a/dll/win32/kernel32/misc/lcformat_private.h b/dll/win32/kernel32/winnls/string/lcformat_private.h similarity index 100% rename from dll/win32/kernel32/misc/lcformat_private.h rename to dll/win32/kernel32/winnls/string/lcformat_private.h diff --git a/dll/win32/kernel32/string/lstring.c b/dll/win32/kernel32/winnls/string/lstring.c similarity index 100% rename from dll/win32/kernel32/string/lstring.c rename to dll/win32/kernel32/winnls/string/lstring.c diff --git a/dll/win32/kernel32/misc/nls.c b/dll/win32/kernel32/winnls/string/nls.c similarity index 89% rename from dll/win32/kernel32/misc/nls.c rename to dll/win32/kernel32/winnls/string/nls.c index 340ce2cfe30..e3f6d244ef1 100644 --- a/dll/win32/kernel32/misc/nls.c +++ b/dll/win32/kernel32/winnls/string/nls.c @@ -1669,6 +1669,185 @@ static INT WideCharToUtf7(LPCWSTR pszWide, INT cchWide, LPSTR pszUtf7, INT cchUt return c; } +static BOOL +GetLocalisedText(DWORD dwResId, WCHAR *lpszDest) +{ + HRSRC hrsrc; + LCID lcid; + LANGID langId; + DWORD dwId; + + if (dwResId == 37) + dwId = dwResId * 100; + else + dwId = dwResId; + + lcid = GetUserDefaultLCID(); + lcid = ConvertDefaultLocale(lcid); + + langId = LANGIDFROMLCID(lcid); + + if (PRIMARYLANGID(langId) == LANG_NEUTRAL) + langId = MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US); + + hrsrc = FindResourceExW(hCurrentModule, + (LPWSTR)RT_STRING, + MAKEINTRESOURCEW((dwId >> 4) + 1), + langId); + if (hrsrc) + { + HGLOBAL hmem = LoadResource(hCurrentModule, hrsrc); + + if (hmem) + { + const WCHAR *p; + unsigned int i; + + p = LockResource(hmem); + for (i = 0; i < (dwId & 0x0f); i++) p += *p + 1; + + memcpy(lpszDest, p + 1, *p * sizeof(WCHAR)); + lpszDest[*p] = '\0'; + + return TRUE; + } + } + + DPRINT1("Could not get codepage name. dwResId = %ld\n", dwResId); + return FALSE; +} + +/* + * @implemented + */ +BOOL +WINAPI +GetCPInfo(UINT CodePage, + LPCPINFO CodePageInfo) +{ + PCODEPAGE_ENTRY CodePageEntry; + + if (!CodePageInfo) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + CodePageEntry = IntGetCodePageEntry(CodePage); + if (CodePageEntry == NULL) + { + switch(CodePage) + { + case CP_UTF7: + case CP_UTF8: + CodePageInfo->DefaultChar[0] = 0x3f; + CodePageInfo->DefaultChar[1] = 0; + CodePageInfo->LeadByte[0] = CodePageInfo->LeadByte[1] = 0; + CodePageInfo->MaxCharSize = (CodePage == CP_UTF7) ? 5 : 4; + return TRUE; + } + + SetLastError( ERROR_INVALID_PARAMETER ); + return FALSE; + } + + if (CodePageEntry->CodePageTable.DefaultChar & 0xff00) + { + CodePageInfo->DefaultChar[0] = (CodePageEntry->CodePageTable.DefaultChar & 0xff00) >> 8; + CodePageInfo->DefaultChar[1] = CodePageEntry->CodePageTable.DefaultChar & 0x00ff; + } + else + { + CodePageInfo->DefaultChar[0] = CodePageEntry->CodePageTable.DefaultChar & 0xff; + CodePageInfo->DefaultChar[1] = 0; + } + + if ((CodePageInfo->MaxCharSize = CodePageEntry->CodePageTable.MaximumCharacterSize) == 2) + memcpy(CodePageInfo->LeadByte, CodePageEntry->CodePageTable.LeadByte, sizeof(CodePageInfo->LeadByte)); + else + CodePageInfo->LeadByte[0] = CodePageInfo->LeadByte[1] = 0; + + return TRUE; +} + +/* + * @implemented + */ +BOOL +WINAPI +GetCPInfoExW(UINT CodePage, + DWORD dwFlags, + LPCPINFOEXW lpCPInfoEx) +{ + if (!GetCPInfo(CodePage, (LPCPINFO) lpCPInfoEx)) + return FALSE; + + switch(CodePage) + { + case CP_UTF7: + { + lpCPInfoEx->CodePage = CP_UTF7; + lpCPInfoEx->UnicodeDefaultChar = 0x3f; + return GetLocalisedText((DWORD)CodePage, lpCPInfoEx->CodePageName); + } + break; + + case CP_UTF8: + { + lpCPInfoEx->CodePage = CP_UTF8; + lpCPInfoEx->UnicodeDefaultChar = 0x3f; + return GetLocalisedText((DWORD)CodePage, lpCPInfoEx->CodePageName); + } + + default: + { + PCODEPAGE_ENTRY CodePageEntry; + + CodePageEntry = IntGetCodePageEntry(CodePage); + if (CodePageEntry == NULL) + { + DPRINT1("Could not get CodePage Entry! CodePageEntry = 0\n"); + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + lpCPInfoEx->CodePage = CodePageEntry->CodePageTable.CodePage; + lpCPInfoEx->UnicodeDefaultChar = CodePageEntry->CodePageTable.UniDefaultChar; + return GetLocalisedText((DWORD)CodePage, lpCPInfoEx->CodePageName); + } + break; + } +} + + +/* + * @implemented + */ +BOOL +WINAPI +GetCPInfoExA(UINT CodePage, + DWORD dwFlags, + LPCPINFOEXA lpCPInfoEx) +{ + CPINFOEXW CPInfo; + + if (!GetCPInfoExW(CodePage, dwFlags, &CPInfo)) + return FALSE; + + /* the layout is the same except for CodePageName */ + memcpy(lpCPInfoEx, &CPInfo, sizeof(CPINFOEXA)); + + WideCharToMultiByte(CP_ACP, + 0, + CPInfo.CodePageName, + -1, + lpCPInfoEx->CodePageName, + sizeof(lpCPInfoEx->CodePageName), + NULL, + NULL); + return TRUE; +} + /** * @name WideCharToMultiByte * @@ -1852,4 +2031,133 @@ IsDBCSLeadByte(BYTE TestByte) return IntIsLeadByte(&AnsiCodePage.CodePageTable, TestByte); } +/* + * @unimplemented + */ +NTSTATUS WINAPI CreateNlsSecurityDescriptor(PSECURITY_DESCRIPTOR SecurityDescriptor,ULONG Size,ULONG AccessMask) +{ + STUB; + return 0; +} + +/* + * @unimplemented + */ +BOOL WINAPI IsValidUILanguage(LANGID langid) +{ + STUB; + return 0; +} + +/* + * @unimplemented + */ +VOID WINAPI NlsConvertIntegerToString(ULONG Value,ULONG Base,ULONG strsize, LPWSTR str, ULONG strsize2) +{ + STUB; +} + +/* + * @unimplemented + */ +UINT WINAPI SetCPGlobal(UINT CodePage) +{ + STUB; + return 0; +} + +/* + * @unimplemented + */ +BOOL +WINAPI +ValidateLCType(int a1, unsigned int a2, int a3, int a4) +{ + STUB; + return FALSE; +} + +/* + * @unimplemented + */ +BOOL +WINAPI +NlsResetProcessLocale(VOID) +{ + STUB; + return TRUE; +} + +/* + * @unimplemented + */ +VOID +WINAPI +GetDefaultSortkeySize(LPVOID lpUnknown) +{ + STUB; + lpUnknown = NULL; +} + +/* + * @unimplemented + */ +VOID +WINAPI +GetLinguistLangSize(LPVOID lpUnknown) +{ + STUB; + lpUnknown = NULL; +} + +/* + * @unimplemented + */ +BOOL +WINAPI +ValidateLocale(IN ULONG LocaleId) +{ + STUB; + return TRUE; +} + +/* + * @unimplemented + */ +ULONG +WINAPI +NlsGetCacheUpdateCount(VOID) +{ + STUB; + return 0; +} + +/* + * @unimplemented + */ +BOOL +WINAPI +IsNLSDefinedString(IN NLS_FUNCTION Function, + IN DWORD dwFlags, + IN LPNLSVERSIONINFO lpVersionInformation, + IN LPCWSTR lpString, + IN INT cchStr) +{ + STUB; + return TRUE; +} + +/* + * @unimplemented + */ +BOOL +WINAPI +GetNLSVersion(IN NLS_FUNCTION Function, + IN LCID Locale, + IN OUT LPNLSVERSIONINFO lpVersionInformation) +{ + STUB; + return TRUE; +} + /* EOF */ diff --git a/dll/win32/kernel32/misc/sortkey.c b/dll/win32/kernel32/winnls/string/sortkey.c similarity index 94% rename from dll/win32/kernel32/misc/sortkey.c rename to dll/win32/kernel32/winnls/string/sortkey.c index 59a7bfad416..8f9bba5cd28 100644 --- a/dll/win32/kernel32/misc/sortkey.c +++ b/dll/win32/kernel32/winnls/string/sortkey.c @@ -19,6 +19,7 @@ */ #include "wine/unicode.h" +#define get_char_typeW(x) iswctype((x) >> 8, (x) & 0xFF) extern int get_decomposition(WCHAR src, WCHAR *dst, unsigned int dstlen); extern const unsigned int collation_table[]; @@ -52,7 +53,7 @@ int wine_get_sortkey(int flags, const WCHAR *src, int srclen, char *dst, int dst * and skips white space and punctuation characters for * NORM_IGNORESYMBOLS. */ - if ((flags & NORM_IGNORESYMBOLS) && (iswctype(wch, _SPACE | _PUNCT))) + if ((flags & NORM_IGNORESYMBOLS) && (get_char_typeW(wch) & (C1_PUNCT | C1_SPACE))) continue; if (flags & NORM_IGNORECASE) wch = tolowerW(wch); @@ -110,7 +111,7 @@ int wine_get_sortkey(int flags, const WCHAR *src, int srclen, char *dst, int dst * and skips white space and punctuation characters for * NORM_IGNORESYMBOLS. */ - if ((flags & NORM_IGNORESYMBOLS) && (iswctype(wch, _SPACE | _PUNCT))) + if ((flags & NORM_IGNORESYMBOLS) && (get_char_typeW(wch) & (C1_PUNCT | C1_SPACE))) continue; if (flags & NORM_IGNORECASE) wch = tolowerW(wch); @@ -171,13 +172,13 @@ static inline int compare_unicode_weights(int flags, const WCHAR *str1, int len1 { int skip = 0; /* FIXME: not tested */ - if (iswctype(*str1, _SPACE | _PUNCT)) + if (get_char_typeW(*str1) & (C1_PUNCT | C1_SPACE)) { str1++; len1--; skip = 1; } - if (iswctype(*str2, _SPACE | _PUNCT)) + if (get_char_typeW(*str2) & (C1_PUNCT | C1_SPACE)) { str2++; len2--; @@ -242,13 +243,13 @@ static inline int compare_diacritic_weights(int flags, const WCHAR *str1, int le { int skip = 0; /* FIXME: not tested */ - if (iswctype(*str1, _SPACE | _PUNCT)) + if (get_char_typeW(*str1) & (C1_PUNCT | C1_SPACE)) { str1++; len1--; skip = 1; } - if (iswctype(*str2, _SPACE | _PUNCT)) + if (get_char_typeW(*str2) & (C1_PUNCT | C1_SPACE)) { str2++; len2--; @@ -291,13 +292,13 @@ static inline int compare_case_weights(int flags, const WCHAR *str1, int len1, { int skip = 0; /* FIXME: not tested */ - if (iswctype(*str1, _SPACE | _PUNCT)) + if (get_char_typeW(*str1) & (C1_PUNCT | C1_SPACE)) { str1++; len1--; skip = 1; } - if (iswctype(*str2, _SPACE | _PUNCT)) + if (get_char_typeW(*str2) & (C1_PUNCT | C1_SPACE)) { str2++; len2--; diff --git a/dll/win32/lpk/CMakeLists.txt b/dll/win32/lpk/CMakeLists.txt index 3e5d6275d11..293d5544883 100644 --- a/dll/win32/lpk/CMakeLists.txt +++ b/dll/win32/lpk/CMakeLists.txt @@ -18,4 +18,5 @@ set_module_type(lpk win32dll) add_importlib_target(lpk.spec) add_importlibs(lpk user32 usp10 msvcrt kernel32 ntdll) +add_pch(lpk ros_lpk.h) add_cd_file(TARGET lpk DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/lpk/lpk.rbuild b/dll/win32/lpk/lpk.rbuild index 5656efc4efe..700e9c71e40 100644 --- a/dll/win32/lpk/lpk.rbuild +++ b/dll/win32/lpk/lpk.rbuild @@ -8,6 +8,6 @@ dllmain.c stub.c - lpk.rc + ros_lpk.h diff --git a/dll/win32/lpk/ros_lpk.h b/dll/win32/lpk/ros_lpk.h index 06eeb0d24da..1c11e06e813 100644 --- a/dll/win32/lpk/ros_lpk.h +++ b/dll/win32/lpk/ros_lpk.h @@ -9,7 +9,7 @@ #define NTOS_MODE_USER #include -#include +#include /* FIXME USP10 api that does not have prototype in any include file */ VOID WINAPI LpkPresent(VOID); diff --git a/dll/win32/lsasrv/CMakeLists.txt b/dll/win32/lsasrv/CMakeLists.txt index e5165d4f653..f0411f05013 100644 --- a/dll/win32/lsasrv/CMakeLists.txt +++ b/dll/win32/lsasrv/CMakeLists.txt @@ -1,10 +1,12 @@ -set_unicode() - include_directories( - ${REACTOS_BINARY_DIR}/include/reactos/idl + ${CMAKE_CURRENT_BINARY_DIR} + ${REACTOS_SOURCE_DIR}/include/reactos/idl ${REACTOS_SOURCE_DIR}/include/reactos/subsys/lsass) +add_rpc_files(server ${REACTOS_SOURCE_DIR}/include/reactos/idl/lsa.idl) + +set_unicode() set_rc_compiler() spec2def(lsasrv.dll lsasrv.spec) @@ -17,18 +19,15 @@ list(APPEND SOURCE sids.c lsasrv.rc ${CMAKE_CURRENT_BINARY_DIR}/lsasrv_stubs.c - ${CMAKE_CURRENT_BINARY_DIR}/lsasrv.def) + ${CMAKE_CURRENT_BINARY_DIR}/lsasrv.def + ${CMAKE_CURRENT_BINARY_DIR}/lsa_s.c) add_library(lsasrv SHARED ${SOURCE}) set_entrypoint(lsasrv 0) - -target_link_libraries(lsasrv - lsarpc - wine - ${PSEH_LIB}) - -add_importlibs(lsasrv rpcrt4 kernel32 ntdll) +target_link_libraries(lsasrv wine ${PSEH_LIB}) +add_importlibs(lsasrv rpcrt4 msvcrt kernel32 ntdll) +add_pch(lsasrv lsasrv.h) add_dependencies(lsasrv psdk) add_cd_file(TARGET lsasrv DESTINATION reactos/system32 FOR all) add_importlib_target(lsasrv.spec) diff --git a/dll/win32/lsasrv/lsasrv.h b/dll/win32/lsasrv/lsasrv.h index 45fc4f96409..bf5febba6af 100644 --- a/dll/win32/lsasrv/lsasrv.h +++ b/dll/win32/lsasrv/lsasrv.h @@ -11,7 +11,10 @@ #include #include #define NTOS_MODE_USER -#include +#include +#include +#include +#include #include diff --git a/dll/win32/lsasrv/lsasrv.rbuild b/dll/win32/lsasrv/lsasrv.rbuild index 1102aa4e1be..f2d9494cdcb 100644 --- a/dll/win32/lsasrv/lsasrv.rbuild +++ b/dll/win32/lsasrv/lsasrv.rbuild @@ -14,4 +14,5 @@ privileges.c sids.c lsasrv.rc + lsasrv.h diff --git a/dll/win32/mciavi32/CMakeLists.txt b/dll/win32/mciavi32/CMakeLists.txt index 1bb93315c1d..adc7a9b14ea 100644 --- a/dll/win32/mciavi32/CMakeLists.txt +++ b/dll/win32/mciavi32/CMakeLists.txt @@ -13,8 +13,8 @@ list(APPEND SOURCE ${CMAKE_CURRENT_BINARY_DIR}/mciavi32.def) add_library(mciavi32 SHARED ${SOURCE}) - set_module_type(mciavi32 win32dll) target_link_libraries(mciavi32 wine) add_importlibs(mciavi32 msvfw32 winmm user32 gdi32 msvcrt kernel32 ntdll) +add_pch(mciavi32 private_mciavi.h) add_cd_file(TARGET mciavi32 DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/mciavi32/mciavi32.rbuild b/dll/win32/mciavi32/mciavi32.rbuild index dad219a3227..92c508eba84 100644 --- a/dll/win32/mciavi32/mciavi32.rbuild +++ b/dll/win32/mciavi32/mciavi32.rbuild @@ -8,6 +8,7 @@ mmoutput.c wnd.c mciavi_res.rc + private_mciavi.h wine msvfw32 winmm diff --git a/dll/win32/mciwave/CMakeLists.txt b/dll/win32/mciwave/CMakeLists.txt index d425aa422ab..48e6d5af48a 100644 --- a/dll/win32/mciwave/CMakeLists.txt +++ b/dll/win32/mciwave/CMakeLists.txt @@ -1,7 +1,6 @@ add_definitions( -D__WINESRC__ - -D_DLL -D__USE_CRTIMP -D_WINE) include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine) diff --git a/dll/win32/mlang/CMakeLists.txt b/dll/win32/mlang/CMakeLists.txt index 4808863868f..d30cbcc24de 100644 --- a/dll/win32/mlang/CMakeLists.txt +++ b/dll/win32/mlang/CMakeLists.txt @@ -1,7 +1,5 @@ -add_definitions( - -D__WINESRC__ - -D_DLL -D__USE_CRTIMP) +add_definitions(-D__WINESRC__) remove_definitions(-D_WIN32_WINNT=0x502) add_definitions(-D_WIN32_WINNT=0x600) @@ -19,7 +17,6 @@ list(APPEND SOURCE add_library(mlang SHARED ${SOURCE}) set_entrypoint(mlang 0) - target_link_libraries(mlang uuid wine) add_importlibs(mlang diff --git a/dll/win32/modemui/lang/pl-PL.rc b/dll/win32/modemui/lang/pl-PL.rc index b78e23f2ee7..633477f5bca 100644 --- a/dll/win32/modemui/lang/pl-PL.rc +++ b/dll/win32/modemui/lang/pl-PL.rc @@ -1,8 +1,9 @@ /* - * translated by Caemyr - Olaf Siejka (Jan, 2008) - * Use ReactOS forum PM or IRC to contact me - * http://www.reactos.org - * IRC: irc.freenode.net #reactos-pl; + * translated by Caemyr - Olaf Siejka (Jan, 2008) + * Use ReactOS forum PM or IRC to contact me + * http://www.reactos.org + * IRC: irc.freenode.net #reactos-pl; + * UTF-8 conversion by Caemyr (May, 2011) */ LANGUAGE LANG_POLISH, SUBLANG_DEFAULT @@ -12,12 +13,12 @@ BEGIN POPUP "" BEGIN MENUITEM "&Kopiuj..", 0 - MENUITEM "&Usu", 1 + MENUITEM "&Usuń", 1 MENUITEM "&Zobacz logi", 2 MENUITEM SEPARATOR - MENUITEM "&Waciwoci", 3 - MENUITEM "K&opiuj waciwoci", 4 - MENUITEM "Za&stosuj waciwoci", 5 + MENUITEM "&Właściwości", 3 + MENUITEM "K&opiuj właściwości", 4 + MENUITEM "Za&stosuj właściwości", 5 END END @@ -29,31 +30,31 @@ BEGIN GROUPBOX "Ustawienia dodatkowe", 1018, 6, 6, 225, 70 LTEXT "&Dodatkowe komendy inicjalizacji:", 1011, 16, 20, 143, 8 EDITTEXT 1016, 16, 31, 205, 13, ES_AUTOHSCROLL - LTEXT "&Czekaj na sygna karty kredytowej:", 1007, 16, 55, 109, 8, NOT WS_VISIBLE + LTEXT "&Czekaj na sygnał karty kredytowej:", 1007, 16, 55, 109, 8, NOT WS_VISIBLE EDITTEXT 1008, 133, 52, 26, 12, ES_RIGHT | NOT WS_VISIBLE | WS_GROUP CONTROL "", 1009, "MSCTLS_UPDOWN32", NOT WS_VISIBLE | WS_BORDER | WS_GROUP | 0x00000036, 159, 52, 12, 12 LTEXT "sekund", 1010, 173, 54, 40, 8, NOT WS_VISIBLE - GROUPBOX "&Wybr Kraju/Regionu", 1012, 6, 80, 225, 75 + GROUPBOX "&Wybór Kraju/Regionu", 1012, 6, 80, 225, 75 COMBOBOX 1013, 18, 99, 203, 50, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | NOT WS_TABSTOP PUSHBUTTON "&Zaaw. ustawienia portu", 1100, 107, 170, 125, 14 - DEFPUSHBUTTON "Zmie &ustawienia domylne", 3, 107, 188, 125, 14 + DEFPUSHBUTTON "Zmień &ustawienia domyślne", 3, 107, 188, 125, 14 END IDD_GENERAL DIALOGEX 0, 0, 238, 210 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION "Oglne" +CAPTION "Ogólne" FONT 8, "MS Shell Dlg" BEGIN LTEXT "Port:", 1018, 9, 8, 32, 10 LTEXT "Port szeregowy", 1095, 48, 8, 181, 10 - GROUPBOX "&Gonoc", 1029, 10, 21, 218, 48 + GROUPBOX "&Głośnośc", 1029, 10, 21, 218, 48 CONTROL "", 1032, "MSCTLS_TRACKBAR32", WS_GROUP | WS_TABSTOP | 0x00000001, 84, 40, 66, 20 - RTEXT "Wyczona", 1045, 56, 40, 22, 8 + RTEXT "Wyłączona", 1045, 56, 40, 22, 8 LTEXT "Wysoka", 1001, 155, 40, 25, 11 - GROUPBOX "&Maksymalna prdko portu", 1031, 10, 78, 218, 46 + GROUPBOX "&Maksymalna prędkość portu", 1031, 10, 78, 218, 46 COMBOBOX 1036, 18, 100, 202, 69, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP GROUPBOX "Kontrola wybierania", 1060, 10, 133, 218, 51 - AUTOCHECKBOX "&Czekaj na sygna przed rozpoczciem poczenia", 1003, 27, 157, 174, 10 + AUTOCHECKBOX "&Czekaj na sygnał przed rozpoczęciem połączenia", 1003, 27, 157, 174, 10 END IDD_DISTINCTIVE_RING DIALOGEX 0, 0, 238, 210 @@ -62,10 +63,10 @@ CAPTION "Linia wielonumerowa" FONT 8, "MS Shell Dlg" BEGIN GROUPBOX "", 1068, 10, 7, 218, 145 - AUTOCHECKBOX "&Ta linia posiada usug wielu numerw", 1069, 20, 7, 184, 10 - CTEXT "Wzorzec sygnau", -1, 84, 21, 70, 8 - CTEXT "Typ poczenia", -1, 159, 21, 63, 8 - LTEXT "&Numer gwny:", 1070, 20, 41, 62, 8 + AUTOCHECKBOX "&Ta linia posiada usługę wielu numerów", 1069, 20, 7, 184, 10 + CTEXT "Wzorzec sygnału", -1, 84, 21, 70, 8 + CTEXT "Typ połączenia", -1, 159, 21, 63, 8 + LTEXT "&Numer główny:", 1070, 20, 41, 62, 8 COMBOBOX 1073, 84, 37, 71, 61, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | WS_VSCROLL | NOT WS_TABSTOP COMBOBOX 1082, 160, 37, 62, 61, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP LTEXT "Numer &1:", 1071, 20, 59, 62, 8 @@ -91,14 +92,14 @@ CAPTION "Linia wielonumerowa" FONT 8, "MS Shell Dlg" BEGIN GROUPBOX "", 1068, 10, 7, 218, 87 - AUTOCHECKBOX "&Ta linia posiada usug wielu numerw", 1069, 19, 7, 177, 10 - CTEXT "Wzorzec sygnau", -1, 20, 21, 74, 8 - CTEXT "Rodzaj poczenia", -1, 96, 21, 65, 8 + AUTOCHECKBOX "&Ta linia posiada usługę wielu numerów", 1069, 19, 7, 177, 10 + CTEXT "Wzorzec sygnału", -1, 20, 21, 74, 8 + CTEXT "Rodzaj połączenia", -1, 96, 21, 65, 8 LTEXT "&Pojedynczy:", 1088, 20, 37, 53, 8 COMBOBOX 1091, 96, 37, 65, 61, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - LTEXT "P&odwjny:", 1089, 20, 57, 53, 8 + LTEXT "P&odwójny:", 1089, 20, 57, 53, 8 COMBOBOX 1092, 96, 55, 65, 61, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - LTEXT "Po&trjny:", 1090, 20, 76, 53, 8 + LTEXT "Po&trójny:", 1090, 20, 76, 53, 8 COMBOBOX 1093, 96, 73, 65, 61, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP END @@ -118,36 +119,36 @@ END IDD_PLEASE_WAIT DIALOGEX 0, 0, 195, 72 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION -CAPTION "Prosz czeka..." +CAPTION "Proszę czekać..." FONT 8, "MS Shell Dlg" BEGIN ICON 5100, -1, 9, 7, 20, 20 - LTEXT "Prba komunikacji z modemem. To moe zaj wiele sekund.", -1, 42, 7, 146, 28 + LTEXT "Próba komunikacji z modemem. To może zająć wiele sekund.", -1, 42, 7, 146, 28 DEFPUSHBUTTON "Cancel", 2, 72, 52, 50, 14 END IDD_GENERAL_2 DIALOGEX 0, 0, 238, 210 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION "Oglne" +CAPTION "Ogólne" FONT 8, "MS Shell Dlg" BEGIN - AUTOCHECKBOX "&Wybieranie rczne", 1002, 19, 22, 150, 10 - AUTOCHECKBOX "&Rozcz jeli poczenie jest bezczynne powyej:", 1042, 19, 38, 143, 10 + AUTOCHECKBOX "&Wybieranie ręczne", 1002, 19, 22, 150, 10 + AUTOCHECKBOX "&Rozłącz jeśli połączenie jest bezczynne powyżej:", 1042, 19, 38, 143, 10 EDITTEXT 1043, 168, 35, 25, 13, ES_AUTOHSCROLL | ES_NUMBER - LTEXT "&Anuluj poczenie jeli nie udao si poczy w cigu", -1, 19, 56, 147, 10 + LTEXT "&Anuluj połączenie jeśli nie udało się połączyć w ciągu", -1, 19, 56, 147, 10 EDITTEXT 1040, 168, 54, 25, 13, ES_AUTOHSCROLL | ES_NUMBER - RTEXT "&Szybko portu:", 1034, 16, 102, 93, 8 + RTEXT "&Szybkość portu:", 1034, 16, 102, 93, 8 COMBOBOX 1036, 114, 100, 84, 69, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - RTEXT "&Protok danych:", 1032, 16, 122, 93, 8 + RTEXT "&Protokół danych:", 1032, 16, 122, 93, 8 COMBOBOX 1037, 114, 119, 84, 69, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP RTEXT "&Kompresja:", 1035, 16, 139, 93, 8 COMBOBOX 1099, 114, 137, 84, 69, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - RTEXT "K&ontrola przepywu:", 1027, 16, 157, 93, 8 + RTEXT "K&ontrola przepływu:", 1027, 16, 157, 93, 8 COMBOBOX 1031, 114, 155, 84, 61, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - GROUPBOX "Opcje poczenia", 1060, 11, 7, 217, 66 + GROUPBOX "Opcje połączenia", 1060, 11, 7, 217, 66 LTEXT "minut", 1044, 195, 38, 22, 8 LTEXT "sekund", 1041, 194, 56, 22, 8 - GROUPBOX "Opcje poczenia", -1, 11, 82, 217, 94 + GROUPBOX "Opcje połączenia", -1, 11, 82, 217, 94 END IDD_ADVANCED_2 DIALOGEX 17, 12, 238, 210 @@ -155,18 +156,18 @@ STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION CAPTION "Zaawansowane" FONT 8, "MS Shell Dlg" BEGIN - AUTOCHECKBOX "Przywoaj okno &terminala przed poczeniem", 1000, 20, 21, 200, 10 - AUTOCHECKBOX "Przywoaj okno t&erminala po poczeniu", 1001, 20, 38, 200, 10 + AUTOCHECKBOX "Przywołaj okno &terminala przed połączeniem", 1000, 20, 21, 200, 10 + AUTOCHECKBOX "Przywołaj okno t&erminala po połączeniu", 1001, 20, 38, 200, 10 RTEXT "&Bity danych:", 1024, 18, 79, 93, 8 COMBOBOX 1025, 114, 77, 106, 61, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - RTEXT "&Parzysto:", 1026, 18, 97, 93, 8 + RTEXT "&Parzystość:", 1026, 18, 97, 93, 8 COMBOBOX 1028, 114, 95, 106, 60, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP RTEXT "B&ity stopu:", 1029, 18, 115, 93, 8 COMBOBOX 1030, 114, 113, 106, 45, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP RTEXT "&Modulacja:", 1045, 18, 133, 93, 8 COMBOBOX 1038, 114, 131, 106, 69, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP GROUPBOX "Okno terminala", 1004, 10, 7, 217, 49 - GROUPBOX "Ustawienia sprztowe", 1005, 10, 64, 217, 89 + GROUPBOX "Ustawienia sprzętowe", 1005, 10, 64, 217, 89 END IDD_ISDN DIALOGEX 0, 0, 238, 210 @@ -188,24 +189,24 @@ END IDD_PLEASE_WAIT_2 DIALOGEX 0, 0, 195, 72 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION -CAPTION "Prosz czeka" +CAPTION "Proszę czekać" FONT 8, "MS Shell Dlg" BEGIN ICON 5100, -1, 9, 7, 20, 20 - LTEXT "Wysyanie informacji o kraju/regionie do Modemu.", -1, 42, 7, 146, 28 + LTEXT "Wysyłanie informacji o kraju/regionie do Modemu.", -1, 42, 7, 146, 28 END IDD_WARNING DIALOGEX 0, 0, 360, 105 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION -CAPTION "Ostrzeenie" +CAPTION "Ostrzeżenie" FONT 8, "MS Shell Dlg" BEGIN - AUTOCHECKBOX "Nie pokazuj wicej tej wiadomoci", 1109, 17, 73, 118, 10 + AUTOCHECKBOX "Nie pokazuj więcej tej wiadomości", 1109, 17, 73, 118, 10 DEFPUSHBUTTON "OK", 1, 302, 84, 50, 14 - LTEXT "Niektre modemy nie obsuguj waciwie komendy inicjalizacji o tej wielkoci.", -1, 50, 27, 304, 8 - LTEXT "Informacje o tym ograniczeniu mog zosta uzyskane od producenta Modemu.", -1, 50, 41, 304, 8 + LTEXT "Niektóre modemy nie obsługują właściwie komendy inicjalizacji o tej wielkości.", -1, 50, 27, 304, 8 + LTEXT "Informacji o tym ograniczeniu można uzyskać od producenta Modemu.", -1, 50, 41, 304, 8 ICON 5100, -1, 15, 14, 20, 20 - LTEXT "Wprowadzie komend inicjalizacji dusz ni 57 znakw.", -1, 50, 14, 304, 8 + LTEXT "Wprowadziona komenda inicjalizacji jest dłuższa niż 57 znaków.", -1, 50, 14, 304, 8 END IDD_MODEMS DIALOGEX 0, 0, 252, 218 @@ -217,13 +218,13 @@ BEGIN LTEXT "Zainstalowane &modemy:", -1, 44, 12, 203, 9 CONTROL "", 113, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x00000849, 7, 32, 238, 158, WS_EX_CLIENTEDGE PUSHBUTTON "&Dodaj...", 110, 56, 198, 60, 14 - PUSHBUTTON "&Usu....", 112, 121, 198, 60, 14 - PUSHBUTTON "&Waciwoci", 109, 185, 198, 60, 14 + PUSHBUTTON "&Usuń....", 112, 121, 198, 60, 14 + PUSHBUTTON "&Właściwości", 109, 185, 198, 60, 14 END IDD_PLEASE_WAIT_3 DIALOGEX 0, 0, 195, 72 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION -CAPTION "Prosz czeka..." +CAPTION "Proszę czekać..." FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "&Stop", 2, 74, 53, 50, 14 @@ -235,11 +236,11 @@ END STRINGTABLE BEGIN 180 "Port szeregowy RS-232" - 181 "Modem Zewntrzny" - 182 "Modem Wewntrzny" + 181 "Modem Zewnętrzny" + 182 "Modem Wewnętrzny" 183 "Modem PCMCIA" - 184 "Modem Rwnolegy" - 185 "Port Rwnolegy" + 184 "Modem Równoległy" + 185 "Port Równoległy" 200 "110" 201 "1200" 202 "2400" @@ -267,35 +268,35 @@ BEGIN 256 "1.5" 257 "2" 260 "Xon / Xoff" - 261 "Sprztowa" + 261 "Sprzętowa" 262 "Brak" - 263 "Wczona" + 263 "Włączona" 264 "Niska" 265 "V.23 (Minitel)" 266 "Standardowy" 267 "Niestandardowy (Bell, HST)" - 270 "Docz do &logw" + 270 "Dołącz do &logów" 300 "Niesprecyzowana" 301 "Dane" 302 "Faks" - 303 "Gos" + 303 "Głos" 304 "Brak" 320 "Ustawienia kraju/regionu zaktualizowane" 340 "Modem" 341 "Ustawienia Modemu" 342 "Numer modemu" 400 "Ustawienia kraju/regionu niezaktualizowane" - 401 "Niektre modemy nie obsuguj waciwie komendy inicjalizacji duszej ni 57 znakw.\n\nInformacje o tym ograniczeniu mog zosta uzyskane od producenta Modemu." - 402 "Ostrzeenie" - 460 "Nie ma do pamici by otworzy okno Modem - Oglne.\nZamknij pliki bd programy i sprbuj ponownie." - 461 "Nie ma do pamici by otworzy okno ustawie Modemu.\nZamknij pliki bd programy i sprbuj ponownie." - 463 "Kady numer musi by ustawione na 'Automatycznie' albo na unikalny.\n\nZmie powtrzony wzorzec sygnau na nieuywany." + 401 "Niektóre modemy nie obsługują właściwie komendy inicjalizacji dłuższej niż 57 znaków.\n\nInformacje o tym ograniczeniu mogą zostaż uzyskane od producenta Modemu." + 402 "Ostrzeżenie" + 460 "Brak wystarczającej pamięci by otworzyć okno Modem - Ogólne.\nZamknij pliki bądź programy i spróbuj ponownie." + 461 "Brak wystarczającej pamięci by otworzyć okno ustawień Modemu.\nZamknij pliki bądź programy i spróbuj ponownie." + 463 "Każdy numer musi być ustawione na 'Automatycznie' albo na unikalny.\n\nZmień powtórzony wzorzec sygnału na nieużywany." 465 "Standardowy EC" 466 "Wymuszony EC" - 467 "Komrkowy" - 468 "Wyczony" - 469 "Wczony" - 470 "Wyczony" + 467 "Komórkowy" + 468 "Wyłączony" + 469 "Włączony" + 470 "Wyłączony" 480 "AUTO (1 Ch.)" 481 "AUTO (2 Ch.)" 482 "PPP (56K)" @@ -338,7 +339,7 @@ BEGIN 558 "Belgijski Krajowy" 559 "Australijski Krajowy" 560 "Nieznany switch" - 570 "Konfiguracja ISDN dla tego Modemu\\NIS nie zostaa ukoczona.\n\nProsz wypeni wszystkie pola w\nzakadce ISDN przed prb uycia modemu." + 570 "Konfiguracja ISDN dla tego Modemu\\NIS nie została ukończona.\n\nProszę wypełnić wszystkie pola w\nzakładce ISDN przed próbą użycia modemu." 600 "PPP (56K,GSM)" 601 "PPP (64K,GSM)" 602 "V.120 (64K,GSM)" @@ -355,61 +356,61 @@ BEGIN 614 "Analogowy RLP" 615 "Analogowy NRLP" 616 "GPRS" - 617 "PIAFS - przychodzce" - 618 "PIAFS - wychodzce" - 700 "Uyj obecnej lokalizacji TAPI" - 2006 "Doczony do" + 617 "PIAFS - przychodzące" + 618 "PIAFS - wychodzące" + 700 "Użyj obecnej lokalizacji TAPI" + 2006 "Dołączony do" 2007 "Nieobecny" 2008 "Nie funkcjonuje" 2009 "Wymaga restartu" - 2010 "#Aby zakoczy konfiguracj modemu, musisz zrestartowa komputer.\n\nCzy chcesz zrestartowa komputer w tej chwili?" - 2011 "Modem nie zosta zainstalowany poprawnie" + 2010 "#Aby zakończyć konfigurację modemu, musisz zrestartować komputer.\n\nCzy chcesz zrestartować komputer w tej chwili?" + 2011 "Modem nie został zainstalowany poprawnie" 2012 "Port nieznany" 3000 "Konfiguracja Modemu" 3018 "Modemy" - 3019 "Instalacja nowego Modemu albo zmiana jego waciwoci." - 3053 "Nie mona wywietli waciwoci Modemu, bo sam Modem nie jest dostpny.\n\nZrestartuj system i sprbuj ponownie." - 3054 "Waciwoci Modemw" - 3060 "Czy na pewno chcesz usun wybrany Modem z twojego systemu??" - 3061 "ReactOS nie mg usun Modemu '%1' z %2." + 3019 "Instalacja nowego Modemu albo zmiana jego właściwości." + 3053 "Nie można wyświetlić właściwości Modemu, bo sam Modem nie jest dostępny.\n\nZrestartuj system i spróbuj ponownie." + 3054 "Właściwości Modemów" + 3060 "Czy na pewno chcesz usunąć wybrany Modem z twojego systemu??" + 3061 "ReactOS nie mógł usunąć Modemu '%1' z %2." 3062 "Modem" - 3069 "Nie ma do pamici by otworzy panel kontrolny Modemu.\n\nZamknij kilka plikw lub programw i sprbuj ponownie." - 3073 "Musisz by Administratorem Systemu by zainstalowa Modem." - 3074 "Brak zainstalowanych Modemw. Musisz by Administratorem Systemu by zainstalowa Modem." - 3076 "Musisz zestartowa swj komputer zanim nowe zmiany zostan wprowadzone.\n\nCzy chcesz zrestartowa komputer w tej chwili?" - 3077 "Zmiana ustawie sieci." - 3200 "300 Baudw" - 3201 "1200 Baudw" - 3202 "2400 Baudw" - 3203 "9600 Baudw" - 3204 "19.2K Baudw" - 3205 "38.4K Baudw" - 3206 "57.6K Baudw" + 3069 "Brak wystarczającej ilości pamięci by otworzyć panel kontrolny Modemu.\n\nZamknij kilka plików lub programów i spróbuj ponownie." + 3073 "Musisz być Administratorem systemu by zainstalować Modem." + 3074 "Brak zainstalowanych Modemów. Musisz być Administratorem systemu by zainstalować Modem." + 3076 "Musisz zestartować swój komputer zanim nowe zmiany zostaną wprowadzone.\n\nCzy chcesz zrestartować komputer w tej chwili?" + 3077 "Zmiana ustawień sieci." + 3200 "300 Baudów" + 3201 "1200 Baudów" + 3202 "2400 Baudów" + 3203 "9600 Baudów" + 3204 "19.2K Baudów" + 3205 "38.4K Baudów" + 3206 "57.6K Baudów" 3207 "Brak odpowiedzi" 3212 "Komenda" - 3213 "Odpowied" - 3214 "Nie udao si otworzy portu, do ktrego podczony jest modem. To moe by efekt konfliktu sprztowego. Sprawd w menederze urzdze czy modem pracuje poprawnie." - 3215 "Port do ktrego podczony jest modem wykorzytuje w tej chwili inna aplikacja. Zamknij j by kontynuowa." + 3213 "Odpowiedź" + 3214 "Nie udało się otworzyć portu, do którego podłączony jest modem. To może być efekt konfliktu sprzętowego. Sprawdź w menedżerze urządzeń czy modem pracuje poprawnie." + 3215 "Port do którego podłączony jest modem wykorzytuje w tej chwili inna aplikacja. Zamknij ją, by kontynuować." 3218 "OpenComm" - 3221 "115K Baudw" + 3221 "115K Baudów" 3222 "Uaktualnianie" - 3223 "Bd" + 3223 "Błąd" 3233 "Powodzenie" - 3236 "Modem nie odpowiedzia. Upewnij si e jest poprawnie podczony i uruchomiony. Jeeli jest poprawnie podczony, albo to modem wewntrzny, sprawd czy dobrze ustawione jest przerwanie." - 3237 "KOMENDA NIEOBSUGIWANA" + 3236 "Modem nie odpowiedział. Upewnij się że jest poprawnie podłączony i uruchomiony. Jeżeli jest poprawnie podłączony, albo to modem wewnętrzny, sprawdź czy dobrze ustawione jest przerwanie." + 3237 "KOMENDA NIEOBSŁUGIWANA" 3238 "Pole" - 3239 "Warto" - 3240 " Ustawienia Domylne" - 3241 " Ustawienia Poczenia" + 3239 "Wartość" + 3240 " Ustawienia Domyślne" + 3241 " Ustawienia Połączenia" 6144 "Japonia" 6145 "Albania" 6146 "Algieria" - 6147 "Amerykaska Samoa" + 6147 "Amerykańska Samoa" 6148 "Niemcy (kod 04)" 6149 "Anguilla" 6150 "Antigua i Barbuda" 6151 "Argentyna" - 6152 "Wyspy Wniebowstpienia" + 6152 "Wyspy Wniebowstąpienia" 6153 "Australia" 6154 "Austria" 6155 "Bahamy" @@ -428,15 +429,15 @@ BEGIN 6168 "Brytyjskie terytorium oceanu Indyjskiego" 6169 "Brytyjskie Wyspy Dziewicze" 6170 "Brunei" - 6171 "Bugaria" + 6171 "Bułgaria" 6172 "Birma" 6173 "Burundi" - 6174 "Biaoru" + 6174 "Białoruś" 6175 "Kamerun" 6176 "Kanada" 6177 "Cape Verde" 6178 "Kajmany" - 6179 "Republika Afryki rodkowej" + 6179 "Republika Afryki Środkowej" 6180 "Czad" 6181 "Chile" 6182 "Chiny" @@ -448,16 +449,16 @@ BEGIN 6188 "Kuba" 6189 "Cypr" 6190 "Czechy" - 6191 "Kamboda" - 6192 "Korea Pnocna" + 6191 "Kambodża" + 6192 "Korea Północna" 6193 "Dania" - 6194 "Dibuti" + 6194 "Dżibuti" 6195 "Republika Domikinany" 6196 "Dominikana" 6197 "Ekwador" 6198 "Egipt" 6199 "San Salwador" - 6200 "Gwinea Rwnikowa" + 6200 "Gwinea Równikowa" 6201 "Etiopia" 6202 "Falklandy" 6203 "Wyspy Fiji" @@ -482,7 +483,7 @@ BEGIN 6222 "Haiti" 6223 "Honduras" 6224 "Hong Kong" - 6225 "Wgry" + 6225 "Węgry" 6226 "Islandia" 6227 "Indie" 6228 "Indonezja" @@ -490,8 +491,8 @@ BEGIN 6230 "Irak" 6231 "Irlandia" 6232 "Izrael" - 6233 "Wochy" - 6234 "Wybrzee Koci Soniowej" + 6233 "Włochy" + 6234 "Wybrzeże Kości Słoniowej" 6235 "Jamajka" 6236 "Afganistan" 6237 "Wyspa Jersey" @@ -547,12 +548,12 @@ BEGIN 6287 "Rwanda" 6288 "Wyspy St. Kitts i Nevis" 6289 "Kod kraju/regionu (145)" - 6290 "Wyspy w. Heleny" + 6290 "Wyspy Św. Heleny" 6291 "Wyspy St. Lucia" 6292 "San Marino" 6293 "Kod kraju/regionu (148)" 6294 "Sao Tome" - 6295 "Wyspy w. Wincenta" + 6295 "Wyspy Św. Wincenta" 6296 "Arabia Saudyjska" 6297 "Senegal" 6298 "Seszele" @@ -598,23 +599,23 @@ BEGIN 6338 "Kongo (DRk)" 6339 "Zambia" 6340 "Zimbabwe" - 6501 "Modawia" + 6501 "Mołdawia" 6502 "Estonia" 6503 "Litwa" 6504 "Armenia" 6505 "Gruzja" - 6506 "Azerbejdan" + 6506 "Azerbejdżan" 6507 "Turkmenistan" 6508 "Uzbekistan" 6509 "Kazachstan" - 6510 "Tadykistan" + 6510 "Tadżykistan" 6511 "Kirgyzstan" - 6512 "otwa" + 6512 "Łotwa" 6513 "Rosja" 6600 "Chorwacja" - 6601 "Sowenia" + 6601 "Słowenia" 6602 "Macedonia" 6603 "Bosnia and Hercegovina" - 6604 "Jugosawia" - 20013 "ID Sprztu" + 6604 "Jugosławia" + 20013 "ID Sprzętu" END diff --git a/dll/win32/modemui/lang/ro-RO.rc b/dll/win32/modemui/lang/ro-RO.rc index 8860e4c7f02..9dbbc243b1d 100644 --- a/dll/win32/modemui/lang/ro-RO.rc +++ b/dll/win32/modemui/lang/ro-RO.rc @@ -1,7 +1,5 @@ LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL -#pragma code_page(65001) - IDM_MENU MENU BEGIN POPUP "" @@ -613,5 +611,3 @@ BEGIN 6604 "Iugoslavia" 20013 "ID dispozitiv" END - -#pragma code_page(default) diff --git a/dll/win32/modemui/lang/ru-RU.rc b/dll/win32/modemui/lang/ru-RU.rc index 7f10ed9de9c..2e2f37fe794 100644 --- a/dll/win32/modemui/lang/ru-RU.rc +++ b/dll/win32/modemui/lang/ru-RU.rc @@ -4,162 +4,162 @@ IDM_MENU MENU BEGIN POPUP "" BEGIN - MENUITEM "&...", 0 - MENUITEM "&", 1 - MENUITEM "& ", 2 + MENUITEM "&Дублировать...", 0 + MENUITEM "&Удалить", 1 + MENUITEM "&Просмотр журнала", 2 MENUITEM SEPARATOR - MENUITEM "&", 3 - MENUITEM "& ", 4 - MENUITEM "& ", 5 + MENUITEM "Сво&йства", 3 + MENUITEM "&Копировать свойства", 4 + MENUITEM "При&менить свойства", 5 END END IDD_ADVANCED DIALOGEX 17, 12, 238, 210 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION "" +CAPTION "Дополнительно" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ", 1018, 6, 6, 225, 70 - LTEXT "& :", 1011, 16, 20, 143, 8 + GROUPBOX "Дополнительные параметры", 1018, 6, 6, 225, 70 + LTEXT "Д&ополнительные команды инициализации:", 1011, 16, 20, 143, 8 EDITTEXT 1016, 16, 31, 205, 13, ES_AUTOHSCROLL - LTEXT "& :", 1007, 16, 55, 109, 8, NOT WS_VISIBLE + LTEXT "&Ждать сигнала для телефонной карточки:", 1007, 16, 55, 109, 8, NOT WS_VISIBLE EDITTEXT 1008, 133, 52, 26, 12, ES_RIGHT | NOT WS_VISIBLE | WS_GROUP CONTROL "", 1009, "MSCTLS_UPDOWN32", NOT WS_VISIBLE | WS_BORDER | WS_GROUP | 0x00000036, 159, 52, 12, 12 - LTEXT ".", 1010, 173, 54, 40, 8, NOT WS_VISIBLE - GROUPBOX "& ", 1012, 6, 80, 225, 75 + LTEXT "сек.", 1010, 173, 54, 40, 8, NOT WS_VISIBLE + GROUPBOX "&Выбор страны или региона", 1012, 6, 80, 225, 75 COMBOBOX 1013, 18, 99, 203, 50, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | NOT WS_TABSTOP - PUSHBUTTON "& ...", 1100, 107, 170, 125, 14 - DEFPUSHBUTTON "& ...", 3, 107, 188, 125, 14 + PUSHBUTTON "&Дополнительные параметры...", 1100, 107, 170, 125, 14 + DEFPUSHBUTTON "&Изменить умолчания...", 3, 107, 188, 125, 14 END IDD_GENERAL DIALOGEX 0, 0, 238, 210 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION "" +CAPTION "Общие" FONT 8, "MS Shell Dlg" BEGIN - LTEXT ":", 1018, 9, 8, 32, 10 - LTEXT " ", 1095, 48, 8, 181, 10 - GROUPBOX "& ", 1029, 10, 21, 218, 48 + LTEXT "Порт:", 1018, 9, 8, 32, 10 + LTEXT "Последовательный порт", 1095, 48, 8, 181, 10 + GROUPBOX "&Громкость динамика", 1029, 10, 21, 218, 48 CONTROL "", 1032, "MSCTLS_TRACKBAR32", WS_GROUP | WS_TABSTOP | 0x00000001, 84, 40, 66, 20 - RTEXT ".", 1045, 56, 40, 22, 8 - LTEXT "", 1001, 155, 40, 25, 11 - GROUPBOX "& ", 1031, 10, 78, 218, 46 + RTEXT "Выкл.", 1045, 56, 40, 22, 8 + LTEXT "Выше", 1001, 155, 40, 25, 11 + GROUPBOX "&Скорость порта для модема", 1031, 10, 78, 218, 46 COMBOBOX 1036, 18, 100, 202, 69, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - GROUPBOX " ", 1060, 10, 133, 218, 51 - AUTOCHECKBOX "& "" """, 1003, 27, 157, 174, 10 + GROUPBOX "Управление набором номера", 1060, 10, 133, 218, 51 + AUTOCHECKBOX "&Дождаться сигнала ""Линия свободна""", 1003, 27, 157, 174, 10 END IDD_DISTINCTIVE_RING DIALOGEX 0, 0, 238, 210 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION " " +CAPTION "Различение звонков" FONT 8, "MS Shell Dlg" BEGIN GROUPBOX "", 1068, 10, 7, 218, 145 - AUTOCHECKBOX "& ", 1069, 20, 7, 184, 10 - CTEXT " ", -1, 84, 21, 70, 8 - CTEXT " ", -1, 159, 21, 63, 8 - LTEXT "& :", 1070, 20, 41, 62, 8 + AUTOCHECKBOX "&Использовать службы различения звонков", 1069, 20, 7, 184, 10 + CTEXT "Вид звонка", -1, 84, 21, 70, 8 + CTEXT "Тип вызова", -1, 159, 21, 63, 8 + LTEXT "&Основной адрес:", 1070, 20, 41, 62, 8 COMBOBOX 1073, 84, 37, 71, 61, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | WS_VSCROLL | NOT WS_TABSTOP COMBOBOX 1082, 160, 37, 62, 61, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - LTEXT " &1:", 1071, 20, 59, 62, 8 + LTEXT "Адрес &1:", 1071, 20, 59, 62, 8 COMBOBOX 1074, 84, 55, 71, 61, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | WS_VSCROLL | NOT WS_TABSTOP COMBOBOX 1083, 160, 55, 62, 61, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - LTEXT " &2:", 1072, 20, 77, 62, 8 + LTEXT "Адрес &2:", 1072, 20, 77, 62, 8 COMBOBOX 1075, 84, 73, 71, 61, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | WS_VSCROLL | NOT WS_TABSTOP COMBOBOX 1084, 160, 73, 62, 61, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - LTEXT " &3:", 1076, 20, 95, 62, 8 + LTEXT "Адрес &3:", 1076, 20, 95, 62, 8 COMBOBOX 1077, 84, 91, 71, 61, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | WS_VSCROLL | NOT WS_TABSTOP COMBOBOX 1085, 160, 91, 62, 61, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - LTEXT "& :", 1078, 20, 112, 62, 8 + LTEXT "&Приоритетные вызовы:", 1078, 20, 112, 62, 8 COMBOBOX 1079, 84, 109, 71, 61, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | WS_VSCROLL | NOT WS_TABSTOP COMBOBOX 1086, 160, 109, 62, 61, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - LTEXT "& :", 1080, 20, 131, 62, 8 + LTEXT "О&тветный вызов:", 1080, 20, 131, 62, 8 COMBOBOX 1081, 84, 127, 71, 61, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | WS_VSCROLL | NOT WS_TABSTOP COMBOBOX 1087, 160, 127, 62, 61, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP END IDD_DISTINCTIVE_RING_2 DIALOGEX 0, 0, 238, 210 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION " " +CAPTION "Различение звонков" FONT 8, "MS Shell Dlg" BEGIN GROUPBOX "", 1068, 10, 7, 218, 87 - AUTOCHECKBOX "& ", 1069, 19, 7, 177, 10 - CTEXT " ", -1, 20, 21, 74, 8 - CTEXT " ", -1, 96, 21, 65, 8 - LTEXT "& :", 1088, 20, 37, 53, 8 + AUTOCHECKBOX "&Использовать службы различения звонков", 1069, 19, 7, 177, 10 + CTEXT "Вид звонка", -1, 20, 21, 74, 8 + CTEXT "Тип вызова", -1, 96, 21, 65, 8 + LTEXT "&Одиночный звонок:", 1088, 20, 37, 53, 8 COMBOBOX 1091, 96, 37, 65, 61, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - LTEXT "& :", 1089, 20, 57, 53, 8 + LTEXT "&Двойной звонок:", 1089, 20, 57, 53, 8 COMBOBOX 1092, 96, 55, 65, 61, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - LTEXT "& :", 1090, 20, 76, 53, 8 + LTEXT "&Тройной звонок:", 1090, 20, 76, 53, 8 COMBOBOX 1093, 96, 73, 65, 61, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP END IDD_DIAGNOSTICS DIALOGEX 0, 0, 238, 215 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION "" +CAPTION "Диагностика" FONT 8, "MS Shell Dlg" BEGIN CONTROL "", 1042, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x0000084D, 19, 18, 200, 58 CONTROL "", 1041, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x0000084D, 19, 84, 200, 58 - PUSHBUTTON "& ", 1096, 138, 149, 75, 14 - AUTOCHECKBOX " &", 1020, 18, 187, 98, 10 - PUSHBUTTON "& ", 1094, 138, 184, 75, 14, WS_DISABLED - GROUPBOX " ", 1047, 10, 6, 217, 164 - GROUPBOX " ", -1, 10, 173, 217, 32 + PUSHBUTTON "Опро&сить модем", 1096, 138, 149, 75, 14 + AUTOCHECKBOX "Вести &журнал", 1020, 18, 187, 98, 10 + PUSHBUTTON "&Просмотр журнала", 1094, 138, 184, 75, 14, WS_DISABLED + GROUPBOX "Сведения о модеме", 1047, 10, 6, 217, 164 + GROUPBOX "Ведение журнала", -1, 10, 173, 217, 32 END IDD_PLEASE_WAIT DIALOGEX 0, 0, 195, 72 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION -CAPTION ", ..." +CAPTION "Пожалуйста, подождите..." FONT 8, "MS Shell Dlg" BEGIN ICON 5100, -1, 9, 7, 20, 20 - LTEXT " . .", -1, 42, 7, 146, 28 - DEFPUSHBUTTON "", 2, 72, 52, 50, 14 + LTEXT "Идет обмен данными с модемом. Это может занять несколько секунд.", -1, 42, 7, 146, 28 + DEFPUSHBUTTON "Отмена", 2, 72, 52, 50, 14 END IDD_GENERAL_2 DIALOGEX 0, 0, 238, 210 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION "" +CAPTION "Общие" FONT 8, "MS Shell Dlg" BEGIN - AUTOCHECKBOX "& ", 1002, 19, 22, 180, 10 - AUTOCHECKBOX "& ", 1042, 19, 38, 143, 10 + AUTOCHECKBOX "&Ручной или полуавтоматический набор номера", 1002, 19, 22, 180, 10 + AUTOCHECKBOX "Откл&ючение при простое более", 1042, 19, 38, 143, 10 EDITTEXT 1043, 168, 35, 25, 13, ES_AUTOHSCROLL | ES_NUMBER - LTEXT "& ", -1, 19, 56, 147, 10 + LTEXT "О&тмена вызова при отсутствии связи", -1, 19, 56, 147, 10 EDITTEXT 1040, 168, 54, 25, 13, ES_AUTOHSCROLL | ES_NUMBER - RTEXT "& :", 1034, 16, 102, 93, 8 + RTEXT "&Скорость порта:", 1034, 16, 102, 93, 8 COMBOBOX 1036, 114, 100, 84, 69, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - RTEXT "&:", 1032, 16, 122, 93, 8 + RTEXT "&Протокол:", 1032, 16, 122, 93, 8 COMBOBOX 1037, 114, 119, 84, 69, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - RTEXT "&:", 1035, 16, 139, 93, 8 + RTEXT "С&жатие:", 1035, 16, 139, 93, 8 COMBOBOX 1099, 114, 137, 84, 69, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - RTEXT "& :", 1027, 16, 157, 93, 8 + RTEXT "&Управление потоком:", 1027, 16, 157, 93, 8 COMBOBOX 1031, 114, 155, 84, 61, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - GROUPBOX " ", 1060, 11, 7, 217, 66 - LTEXT ".", 1044, 195, 38, 22, 8 - LTEXT ".", 1041, 195, 56, 22, 8 - GROUPBOX " ", -1, 11, 82, 217, 94 + GROUPBOX "Параметры вызова", 1060, 11, 7, 217, 66 + LTEXT "мин.", 1044, 195, 38, 22, 8 + LTEXT "сек.", 1041, 195, 56, 22, 8 + GROUPBOX "Параметры подключения линии данных", -1, 11, 82, 217, 94 END IDD_ADVANCED_2 DIALOGEX 17, 12, 238, 210 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION "" +CAPTION "Дополнительно" FONT 8, "MS Shell Dlg" BEGIN - AUTOCHECKBOX " & ", 1000, 20, 21, 200, 10 - AUTOCHECKBOX " & ", 1001, 20, 38, 200, 10 - RTEXT "& :", 1024, 18, 79, 93, 8 + AUTOCHECKBOX "Открыть окно терминала &до набора номера", 1000, 20, 21, 200, 10 + AUTOCHECKBOX "Открыть окно терминала &после набора номера", 1001, 20, 38, 200, 10 + RTEXT "&Биты данных:", 1024, 18, 79, 93, 8 COMBOBOX 1025, 114, 77, 106, 61, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - RTEXT "&:", 1026, 18, 97, 93, 8 + RTEXT "&Четность:", 1026, 18, 97, 93, 8 COMBOBOX 1028, 114, 95, 106, 60, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - RTEXT "& :", 1029, 18, 115, 93, 8 + RTEXT "С&топовые биты:", 1029, 18, 115, 93, 8 COMBOBOX 1030, 114, 113, 106, 45, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - RTEXT "&:", 1045, 18, 133, 93, 8 + RTEXT "&Модуляция:", 1045, 18, 133, 93, 8 COMBOBOX 1038, 114, 131, 106, 69, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - GROUPBOX " ", 1004, 10, 7, 217, 49 - GROUPBOX " ", 1005, 10, 64, 217, 89 + GROUPBOX "Окно терминала", 1004, 10, 7, 217, 49 + GROUPBOX "Параметры настройки оборудования", 1005, 10, 64, 217, 89 END IDD_ISDN DIALOGEX 0, 0, 238, 210 @@ -167,13 +167,13 @@ STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION CAPTION "ISDN" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "& ", -1, 11, 6, 217, 39 + GROUPBOX "&Тип коммутатора", -1, 11, 6, 217, 39 COMBOBOX 1104, 17, 20, 204, 69, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - GROUPBOX "& ", -1, 11, 50, 217, 50 + GROUPBOX "&Первый номер", -1, 11, 50, 217, 50 EDITTEXT 1017, 33, 62, 188, 13, ES_AUTOHSCROLL | ES_NUMBER LTEXT "S&PID/EAZ:", 1027, 34, 83, 67, 8 EDITTEXT 1107, 104, 79, 117, 13, ES_AUTOHSCROLL | ES_NUMBER - GROUPBOX "& ", -1, 11, 105, 217, 49 + GROUPBOX "&Второй номер", -1, 11, 105, 217, 49 EDITTEXT 1018, 33, 114, 189, 13, ES_AUTOHSCROLL | ES_NUMBER LTEXT "SPI&D/EAZ:", 1028, 35, 135, 68, 8 EDITTEXT 1108, 105, 132, 117, 13, ES_AUTOHSCROLL | ES_NUMBER @@ -181,58 +181,58 @@ END IDD_PLEASE_WAIT_2 DIALOGEX 0, 0, 195, 72 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION -CAPTION ", " +CAPTION "Пожалуйста, подождите" FONT 8, "MS Shell Dlg" BEGIN ICON 5100, -1, 9, 7, 20, 20 - LTEXT " .", -1, 42, 7, 146, 28 + LTEXT "Отправка на модем сведений о стране или регионе.", -1, 42, 7, 146, 28 END IDD_WARNING DIALOGEX 0, 0, 360, 105 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION -CAPTION "" +CAPTION "Предупреждение" FONT 8, "MS Shell Dlg" BEGIN - AUTOCHECKBOX " ", 1109, 17, 73, 175, 10 + AUTOCHECKBOX "Не выводить это сообщение в дальнейшем", 1109, 17, 73, 175, 10 DEFPUSHBUTTON "OK", 1, 302, 84, 50, 14 - LTEXT " .", -1, 50, 27, 304, 8 - LTEXT " .", -1, 50, 41, 304, 8 + LTEXT "Некоторые модемы не умеют обрабатывать столь длинные строки инициализации.", -1, 50, 27, 304, 8 + LTEXT "Сведения об ограничениях вашего модема можно получить у изготовителя.", -1, 50, 41, 304, 8 ICON 5100, -1, 15, 14, 20, 20 - LTEXT " 57 .", -1, 50, 14, 304, 8 + LTEXT "Введенная строка инициализации модема длиннее 57 знаков.", -1, 50, 14, 304, 8 END IDD_MODEMS DIALOGEX 0, 0, 252, 218 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION "" +CAPTION "Модемы" FONT 8, "MS Shell Dlg" BEGIN ICON 5100, 1057, 6, 7, 20, 20 - LTEXT " &:", -1, 44, 12, 203, 9 + LTEXT "На компьютере установлены следующие мод&емы:", -1, 44, 12, 203, 9 CONTROL "", 113, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x00000849, 7, 32, 238, 158, WS_EX_CLIENTEDGE - PUSHBUTTON "&...", 110, 56, 198, 60, 14 - PUSHBUTTON "&", 112, 121, 198, 60, 14 - PUSHBUTTON "&", 109, 185, 198, 60, 14 + PUSHBUTTON "&Добавить...", 110, 56, 198, 60, 14 + PUSHBUTTON "&Удалить", 112, 121, 198, 60, 14 + PUSHBUTTON "Сво&йства", 109, 185, 198, 60, 14 END IDD_PLEASE_WAIT_3 DIALOGEX 0, 0, 195, 72 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION -CAPTION ", ..." +CAPTION "Пожалуйста, подождите..." FONT 8, "MS Shell Dlg" BEGIN - DEFPUSHBUTTON "&", 2, 74, 53, 50, 14 + DEFPUSHBUTTON "О&становить", 2, 74, 53, 50, 14 ICON 5100, -1, 9, 7, 20, 20 - LTEXT "", -1, 40, 8, 151, 8 - LTEXT "", 1005, 40, 16, 151, 25 + LTEXT "Удаление", -1, 40, 8, 151, 8 + LTEXT "Модем", 1005, 40, 16, 151, 25 END STRINGTABLE BEGIN - 180 " RS-232" - 181 " " - 182 " " - 183 " PCMCIA" - 184 " " - 185 " " + 180 "Последовательный порт RS-232" + 181 "Внешний модем" + 182 "Внутренний модем" + 183 "Модем PCMCIA" + 184 "Параллельный модем" + 185 "Параллельный порт" 200 "110" 201 "1200" 202 "2400" @@ -251,46 +251,46 @@ BEGIN 242 "6" 243 "7" 244 "8" - 250 "" - 251 "" - 252 " " - 253 " (1)" - 254 " (0)" + 250 "Чет" + 251 "Нечет" + 252 "Не проверяется" + 253 "Маркер (1)" + 254 "Пробел (0)" 255 "1" 256 "1,5" 257 "2" 260 "Xon/Xoff" - 261 "" - 262 "" - 263 "." - 264 "" + 261 "Аппаратное" + 262 "Отсутствует" + 263 "Вкл." + 264 "Ниже" 265 "V.23 (Minitel)" - 266 "" - 267 " (Bell, HST)" - 270 "& " - 300 " " - 301 "" - 302 "" - 303 "" - 304 "" - 320 " " - 340 "" - 341 " " - 342 " " - 400 " " - 401 " , 57 .\n\n ." - 402 "" - 460 " .\n ." - 461 " .\n ." - 463 " '' .\n\n ." - 465 " EC" - 466 " EC" - 467 "" - 468 "" - 469 "" - 470 "" - 480 " (1 .)" - 481 " (2 .)" + 266 "Стандартная" + 267 "Нестандартная (Bell, HST)" + 270 "Д&обавить в журнал" + 300 "Не определен" + 301 "Данные" + 302 "Факс" + 303 "Речь" + 304 "Нет" + 320 "Параметры страны или региона обновлены" + 340 "Модем" + 341 "Параметры модема" + 342 "Адрес модема" + 400 "Параметры страны или региона не обновлены" + 401 "Некоторые модемы не принимают команды инициализации, если строка команды длиннее 57 символов.\n\nСведения об ограничениях для вашего модема можно получить у изготовителя." + 402 "Предупреждение" + 460 "Недостаточно памяти для просмотра общих свойств.\nЗакройте часть программ и файлов и повторите попытку." + 461 "Недостаточно памяти для просмотра параметров модема.\nЗакройте часть программ и файлов и повторите попытку." + 463 "Каждый адрес вызова должен быть 'Автоматическим' или иметь уникальный вид звонка.\n\nИзмените повторяющийся вид звонка на другое значение." + 465 "Стандартный EC" + 466 "Форсированный EC" + 467 "Сотовый" + 468 "Отключен" + 469 "Включено" + 470 "Отключено" + 480 "АВТО (1 кан.)" + 481 "АВТО (2 кан.)" 482 "PPP (56K)" 483 "PPP (64K)" 484 "PPP (112K)" @@ -319,19 +319,19 @@ BEGIN 515 "V.110 (28.8K)" 516 "V.110 (38.4K)" 517 "V.110 (57.6K)" - 518 " (V.34/V.90)" - 550 "ESS5 (AT&T) ( )" - 551 " & - " + 518 "Аналоговый (V.34/V.90)" + 550 "ESS5 (AT&T) (Северная Америка)" + 551 "АТТ т&очка - многие точки" 552 "National ISDN 1 (NI-1)" 553 "Northern Telecom DMS 100 (NT1)" - 554 "NTT INS64 ()" - 555 "European ISDN (DSS1) ()" - 556 "German National (1TR6) ( )" - 557 "French National (VN3) ( )" - 558 "Belgium National ( )" - 559 "Australian National ( )" - 560 " " - 570 " ISDN \n .\n\n \nISDN ." + 554 "NTT INS64 (Япония)" + 555 "European ISDN (DSS1) (Европа)" + 556 "German National (1TR6) (редко используемый)" + 557 "French National (VN3) (редко используемый)" + 558 "Belgium National (редко используемый)" + 559 "Australian National (редко используемый)" + 560 "Неизвестный коммутатор" + 570 "Настройка ISDN для этого модема\n не завершена.\n\nЗаполните сведения на вкладке\nISDN перед использованием модема." 600 "PPP (56K,GSM)" 601 "PPP (64K,GSM)" 602 "V.120 (64K,GSM)" @@ -345,269 +345,269 @@ BEGIN 611 "V.110 (28.8K,GSM)" 612 "V.110 (38.4K,GSM)" 613 "V.110 (57.6K,GSM)" - 614 " RLP" - 615 " NRLP" + 614 "Аналоговый RLP" + 615 "Аналоговый NRLP" 616 "GPRS" - 617 "PIAFS - " - 618 "PIAFS - " - 700 " TAPI" - 2006 " " - 2007 "" - 2008 " " - 2009 " " - 2010 "# .\n\n ?" - 2011 " " - 2012 " " - 3000 " " - 3018 "" - 3019 " ." - 3053 " , .\n\n ." - 3054 ": " - 3060 " ?" - 3061 " '%1' ( %2)." - 3062 "" - 3069 " .\n\n ." - 3073 " ." - 3074 " . ." - 3076 " .\n\n ?" - 3077 " " - 3200 "300 " - 3201 "1200 " - 3202 "2400 " - 3203 "9600 " - 3204 "19,2K " - 3205 "38,4K " - 3206 "57,6K " - 3207 " " - 3212 "" - 3213 "" - 3214 " , . . , ." - 3215 ", . , ." + 617 "PIAFS - входящий" + 618 "PIAFS - исходящий" + 700 "Использовать текущее местоположения из TAPI" + 2006 "Подключен к" + 2007 "Отсутствует" + 2008 "Не работает" + 2009 "Требуется перезагрузка" + 2010 "#Для завершения установки модема требуется перезагрузить компьютер.\n\nПерезагрузить компьютер прямо сейчас?" + 2011 "Модем установлен неправильно" + 2012 "Неизвестный порт" + 3000 "Установка модема" + 3018 "Модемы" + 3019 "Установка нового модема и изменение его параметров." + 3053 "Отображение свойств модема невозможно, так как модем недоступен.\n\nПерезагрузите систему и повторите попытку." + 3054 "Свойства: Модемы" + 3060 "Удалить выбранные модемы из системы?" + 3061 "Не удалось удалить модем '%1' из системы (порт %2)." + 3062 "Модем" + 3069 "Недостаточно памяти для открытия программы настройки модемов панели управления.\n\nЗакройте ненужные программы и повторите попытку." + 3073 "Установка модемов разрешена только системным администраторам." + 3074 "Ни одного модема не установлено. Установка модемов разрешена только системным администраторам." + 3076 "Внесенные изменения вступят в силу только после перезагрузки компьютера.\n\nВыполнить перезагрузку сейчас?" + 3077 "Изменение параметров сети" + 3200 "300 бод" + 3201 "1200 бод" + 3202 "2400 бод" + 3203 "9600 бод" + 3204 "19,2K бод" + 3205 "38,4K бод" + 3206 "57,6K бод" + 3207 "Нет ответа" + 3212 "Команда" + 3213 "Ответ" + 3214 "Не удалось открыть порт, к которому подключен модем. Это может быть результатом конфликта оборудования. Проверьте с помощью диспетчера устройств, что все устройства работают нормально." + 3215 "Порт, используемый модемом в данный момент открыт другим приложением. Закройте все приложения, которые могут использовать этот порт." 3218 "OpenComm" - 3221 "115K " - 3222 "" - 3223 "" - 3233 "" - 3236 " . , . , , , ." - 3237 " " - 3238 "" - 3239 "" - 3240 " " - 3241 " " - 6144 "" - 6145 "" - 6146 "" - 6147 " " - 6148 " ( 04)" - 6149 "" - 6150 " " - 6151 "" - 6152 ". " - 6153 "" - 6154 "" - 6155 "" - 6156 "" - 6157 "" - 6158 "" - 6159 "" - 6160 "" - 6161 "" - 6162 " -" - 6163 "" - 6164 "" - 6165 "" - 6166 "" - 6167 " (23)" - 6168 " " - 6169 " -" - 6170 "" - 6171 "" - 6172 "" - 6173 "" - 6174 "" - 6175 "" - 6176 "" - 6177 "- " - 6178 " -" - 6179 "- " - 6180 "" - 6181 "" - 6182 "" - 6183 "" - 6184 " -" - 6185 "" - 6186 "- " - 6187 "-" - 6188 "" - 6189 "" - 6190 " " - 6191 "" - 6192 " - " - 6193 "" - 6194 "" - 6195 " " - 6196 "" - 6197 "" - 6198 "" - 6199 "" - 6200 " " - 6201 "" - 6202 " () -" - 6203 "- " - 6204 "" - 6205 "" - 6206 " " - 6207 " (63)" - 6208 "" - 6209 "" - 6210 " ( 66)" - 6211 "" - 6212 "" - 6213 "" - 6214 "" - 6215 "" - 6216 ". " - 6217 "" - 6218 "" - 6219 "" - 6220 "-" - 6221 "" - 6222 "" - 6223 "" - 6224 " (SAR) " - 6225 "" - 6226 "" - 6227 "" - 6228 "" - 6229 "" - 6230 "" - 6231 "" - 6232 "" - 6233 "" - 6234 " ' ( )" - 6235 "" - 6236 "" - 6237 "" - 6238 "" - 6239 "" - 6240 "" - 6241 " " - 6242 "" - 6243 "" - 6244 "" - 6245 "" - 6246 "" - 6247 "" - 6248 "" - 6249 "" - 6250 "" - 6251 "" - 6252 "" - 6253 "" - 6254 " -" - 6255 "" - 6256 "" - 6257 "" - 6258 "" - 6259 "" - 6260 "" - 6261 "" - 6262 "" - 6263 "" - 6264 "" - 6265 "" - 6266 "" - 6267 "" - 6268 " -" - 6269 " " - 6270 " " - 6271 "" - 6272 "" - 6273 "" - 6274 "" - 6275 "" - 6276 "" - 6277 "" - 6278 " - " - 6279 "" - 6280 "" - 6281 "" - 6282 "" - 6283 "" - 6284 "-" - 6285 "" - 6286 "" - 6287 "" - 6288 "- " - 6289 " (145)" - 6290 ". " - 6291 "-" - 6292 "-" - 6293 " (148)" - 6294 "- " - 6295 "- " - 6296 " " - 6297 "" - 6298 " -" - 6299 "-" - 6300 "" - 6301 " -" - 6302 "" - 6303 " " - 6304 "" - 6305 "-" - 6306 "" - 6307 "" - 6308 "" - 6309 "" - 6310 "" - 6311 "" - 6312 "" - 6313 "" - 6314 "" - 6315 "" - 6316 " " - 6317 "" - 6318 "" - 6319 "- " - 6320 "" - 6321 "" - 6322 "" - 6323 " " - 6324 "" - 6325 "" - 6326 "-" - 6327 "" - 6328 " (184)" - 6329 "" - 6330 "" - 6331 "" - 6332 "" - 6333 " " - 6334 "" - 6335 "" - 6336 "" - 6337 " (193)" - 6338 " " - 6339 "" - 6340 "" - 6501 "" - 6502 "" - 6503 "" - 6504 "" - 6505 "" - 6506 "" - 6507 "" - 6508 "" - 6509 "" - 6510 "" - 6511 "" - 6512 "" - 6513 "" - 6600 "" - 6601 "" - 6602 "" - 6603 " " - 6604 "" - 20013 "ID " + 3221 "115K бод" + 3222 "Обновление" + 3223 "Ошибка" + 3233 "Успешно" + 3236 "Этот модем не отвечает. Проверьте, что он правильно подключен и питание включено. Если это внутренний модем, или если он подключен правильно, проверьте, что для порта выбрано правильное прерывание." + 3237 "КОМАНДА НЕ ПОДДЕРЖИВАЕТСЯ" + 3238 "Поле" + 3239 "Значение" + 3240 " Предпочтения по умолчанию" + 3241 " Предпочтения подключения" + 6144 "Япония" + 6145 "Албания" + 6146 "Алжир" + 6147 "Американские Самоа" + 6148 "Германия (код страны или региона 04)" + 6149 "Ангилья" + 6150 "Антигуа и Барбуда" + 6151 "Аргентина" + 6152 "о. Вознесения" + 6153 "Австралия" + 6154 "Австрия" + 6155 "Багамы" + 6156 "Бахрейн" + 6157 "Бангладеш" + 6158 "Барбадос" + 6159 "Бельгия" + 6160 "Белиз" + 6161 "Бенин" + 6162 "Бермудские о-ва" + 6163 "Бутан" + 6164 "Боливия" + 6165 "Ботсвана" + 6166 "Бразилия" + 6167 "Код страны или региона (23)" + 6168 "Британская территория Индийского океана" + 6169 "Британские Виргинские о-ва" + 6170 "Бруней" + 6171 "Болгария" + 6172 "Мьянма" + 6173 "Бурунди" + 6174 "Беларусь" + 6175 "Камерун" + 6176 "Канада" + 6177 "о-ва Зеленого Мыса" + 6178 "Каймановы о-ва" + 6179 "Центрально-Африканская Республика" + 6180 "Чад" + 6181 "Чили" + 6182 "Китай" + 6183 "Колумбия" + 6184 "Коморские о-ва" + 6185 "Конго" + 6186 "о-ва Кука" + 6187 "Коста-Рика" + 6188 "Куба" + 6189 "Кипр" + 6190 "Чешская республика" + 6191 "Камбоджа" + 6192 "Корейская народно-демократическая республика" + 6193 "Дания" + 6194 "Джибути" + 6195 "Доминиканская Республика" + 6196 "Доминика" + 6197 "Эквадор" + 6198 "Египет" + 6199 "Сальвадор" + 6200 "Экваториальная Гвинея" + 6201 "Эфиопия" + 6202 "Фолклендские (Мальвинские) о-ва" + 6203 "о-ва Фиджи" + 6204 "Финляндия" + 6205 "Франция" + 6206 "Французская Полинезия" + 6207 "Код страны или региона (63)" + 6208 "Габон" + 6209 "Гамбия" + 6210 "Германия или региона (код страны 66)" + 6211 "Ангола" + 6212 "Гана" + 6213 "Гибралтар" + 6214 "Греция" + 6215 "Гренада" + 6216 "о. Гуам" + 6217 "Гватемала" + 6218 "Гернси" + 6219 "Гвинея" + 6220 "Гвинея-Бисау" + 6221 "Гайана" + 6222 "Гаити" + 6223 "Гондурас" + 6224 "Гонконг (SAR) " + 6225 "Венгрия" + 6226 "Исландия" + 6227 "Индия" + 6228 "Индонезия" + 6229 "Иран" + 6230 "Ирак" + 6231 "Ирландия" + 6232 "Израиль" + 6233 "Италия" + 6234 "Кот д'Ивуар (Берег Слоновой Кости)" + 6235 "Ямайка" + 6236 "Афганистан" + 6237 "Джерси" + 6238 "Иордания" + 6239 "Кения" + 6240 "Кирибати" + 6241 "Южная Корея" + 6242 "Кувейт" + 6243 "Лаос" + 6244 "Ливан" + 6245 "Лесото" + 6246 "Либерия" + 6247 "Ливия" + 6248 "Лихтенштейн" + 6249 "Люксембург" + 6250 "Макао" + 6251 "Мадагаскар" + 6252 "Малайзия" + 6253 "Малави" + 6254 "Мальдивские о-ва" + 6255 "Мали" + 6256 "Мальта" + 6257 "Мавритания" + 6258 "Маврикий" + 6259 "Мексика" + 6260 "Монако" + 6261 "Монголия" + 6262 "Монсеррат" + 6263 "Марокко" + 6264 "Мозамбик" + 6265 "Науру" + 6266 "Непал" + 6267 "Нидерланды" + 6268 "Нидерландские Антильские о-ва" + 6269 "Новая Каледония" + 6270 "Новая Зеландия" + 6271 "Никарагуа" + 6272 "Нигер" + 6273 "Нигерия" + 6274 "Норвегия" + 6275 "Оман" + 6276 "Пакистан" + 6277 "Панама" + 6278 "Папуа - Новая Гвинея" + 6279 "Парагвай" + 6280 "Перу" + 6281 "Филиппины" + 6282 "Польша" + 6283 "Португалия" + 6284 "Пуэрто-Рико" + 6285 "Катар" + 6286 "Румыния" + 6287 "Руанда" + 6288 "Сент-Китс и Невис" + 6289 "Код страны или региона (145)" + 6290 "о. Святой Елены" + 6291 "Санта-Лусия" + 6292 "Сан-Марино" + 6293 "Код страны или региона (148)" + 6294 "Сан-Томе и Принсипи" + 6295 "Сен-Винсент и Гренадины" + 6296 "Саудовская Аравия" + 6297 "Сенегал" + 6298 "Сейшельские о-ва" + 6299 "Сьерра-Леоне" + 6300 "Сингапур" + 6301 "Соломоновы о-ва" + 6302 "Сомали" + 6303 "Южная Африка" + 6304 "Испания" + 6305 "Шри-Ланка" + 6306 "Судан" + 6307 "Суринам" + 6308 "Свазиленд" + 6309 "Швеция" + 6310 "Швейцария" + 6311 "Сирия" + 6312 "Танзания" + 6313 "Таиланд" + 6314 "Того" + 6315 "Тонга" + 6316 "Тринидад и Тобаго" + 6317 "Тунис" + 6318 "Турция" + 6319 "о-ва Туркс и Кайкос" + 6320 "Тувалу" + 6321 "Уганда" + 6322 "Украина" + 6323 "Объединенные Арабские Эмираты" + 6324 "Великобритания" + 6325 "США" + 6326 "Буркина-Фасо" + 6327 "Уругвай" + 6328 "Код страны или региона (184)" + 6329 "Вануату" + 6330 "Ватикан" + 6331 "Венесуэла" + 6332 "Вьетнам" + 6333 "Уоллис и Футуна" + 6334 "Самоа" + 6335 "Йемен" + 6336 "Йемен" + 6337 "Код страны или региона (193)" + 6338 "Демократическая Республика Конго" + 6339 "Замбия" + 6340 "Зимбабве" + 6501 "Молдова" + 6502 "Эстония" + 6503 "Литва" + 6504 "Армения" + 6505 "Грузия" + 6506 "Азербайджан" + 6507 "Туркменистан" + 6508 "Узбекистан" + 6509 "Казахстан" + 6510 "Таджикистан" + 6511 "Киргизстан" + 6512 "Латвия" + 6513 "Россия" + 6600 "Хорватия" + 6601 "Словения" + 6602 "Македония" + 6603 "Босния и Герцеговина" + 6604 "Югославия" + 20013 "ID оборудования" END diff --git a/dll/win32/modemui/lang/uk-UA.rc b/dll/win32/modemui/lang/uk-UA.rc index 0308df73a40..efb6ae84505 100644 --- a/dll/win32/modemui/lang/uk-UA.rc +++ b/dll/win32/modemui/lang/uk-UA.rc @@ -12,162 +12,162 @@ IDM_MENU MENU BEGIN POPUP "" BEGIN - MENUITEM "&...", 0 - MENUITEM "&", 1 - MENUITEM " &", 2 + MENUITEM "Дубл&ювати...", 0 + MENUITEM "В&идалити", 1 + MENUITEM "Перегляд &журналу", 2 MENUITEM SEPARATOR - MENUITEM "&", 3 - MENUITEM "& ", 4 - MENUITEM "& ", 5 + MENUITEM "В&ластивості", 3 + MENUITEM "&Копіювати властивості", 4 + MENUITEM "&Застосувати властивості", 5 END END IDD_ADVANCED DIALOGEX 17, 12, 238, 210 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION "" +CAPTION "Додатково" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ", 1018, 6, 6, 225, 70 - LTEXT "& :", 1011, 16, 20, 143, 8 + GROUPBOX "Додаткові параметри", 1018, 6, 6, 225, 70 + LTEXT "Додат&кові команди ініціалізації:", 1011, 16, 20, 143, 8 EDITTEXT 1016, 16, 31, 205, 13, ES_AUTOHSCROLL - LTEXT "& :", 1007, 16, 55, 109, 8, NOT WS_VISIBLE + LTEXT "&Чекати на сигнал для телефонної картки:", 1007, 16, 55, 109, 8, NOT WS_VISIBLE EDITTEXT 1008, 133, 52, 26, 12, ES_RIGHT | NOT WS_VISIBLE | WS_GROUP CONTROL "", 1009, "MSCTLS_UPDOWN32", NOT WS_VISIBLE | WS_BORDER | WS_GROUP | 0x00000036, 159, 52, 12, 12 - LTEXT "", 1010, 173, 54, 40, 8, NOT WS_VISIBLE - GROUPBOX "& ", 1012, 6, 80, 225, 75 + LTEXT "сек", 1010, 173, 54, 40, 8, NOT WS_VISIBLE + GROUPBOX "&Вибір країни або регіону", 1012, 6, 80, 225, 75 COMBOBOX 1013, 18, 99, 203, 50, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | NOT WS_TABSTOP - PUSHBUTTON "& ...", 1100, 107, 170, 125, 14 - DEFPUSHBUTTON "& ...", 3, 107, 188, 125, 14 + PUSHBUTTON "&Додаткові параметри...", 1100, 107, 170, 125, 14 + DEFPUSHBUTTON "&Змінити замовчування...", 3, 107, 188, 125, 14 END IDD_GENERAL DIALOGEX 0, 0, 238, 210 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION "" +CAPTION "Загальні" FONT 8, "MS Shell Dlg" BEGIN - LTEXT ":", 1018, 9, 8, 32, 10 - LTEXT " ", 1095, 48, 8, 181, 10 - GROUPBOX "& ", 1029, 10, 21, 218, 48 + LTEXT "Порт:", 1018, 9, 8, 32, 10 + LTEXT "Послідовний порт", 1095, 48, 8, 181, 10 + GROUPBOX "&Гучність динаміка", 1029, 10, 21, 218, 48 CONTROL "", 1032, "MSCTLS_TRACKBAR32", WS_GROUP | WS_TABSTOP | 0x00000001, 84, 40, 66, 20 - RTEXT ".", 1045, 56, 40, 22, 8 - LTEXT "", 1001, 155, 40, 25, 11 - GROUPBOX "& ", 1031, 10, 78, 218, 46 + RTEXT "Вимк.", 1045, 56, 40, 22, 8 + LTEXT "Вище", 1001, 155, 40, 25, 11 + GROUPBOX "&Швидкість порту для модема", 1031, 10, 78, 218, 46 COMBOBOX 1036, 18, 100, 202, 69, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - GROUPBOX " ", 1060, 10, 133, 218, 51 - AUTOCHECKBOX "& ", 1003, 27, 157, 174, 10 + GROUPBOX "Керування набором номера", 1060, 10, 133, 218, 51 + AUTOCHECKBOX "&Чекати на гудок", 1003, 27, 157, 174, 10 END IDD_DISTINCTIVE_RING DIALOGEX 0, 0, 238, 210 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION " " +CAPTION "Розрізнення дзвінків" FONT 8, "MS Shell Dlg" BEGIN GROUPBOX "", 1068, 10, 7, 218, 145 - AUTOCHECKBOX "& ", 1069, 20, 7, 184, 10 - CTEXT " ", -1, 84, 21, 70, 8 - CTEXT " ", -1, 159, 21, 63, 8 - LTEXT " &:", 1070, 20, 41, 62, 8 + AUTOCHECKBOX "В&икористовувати служби розрізнення дзвінків", 1069, 20, 7, 184, 10 + CTEXT "Вид дзвінка", -1, 84, 21, 70, 8 + CTEXT "Тип виклику", -1, 159, 21, 63, 8 + LTEXT "Основна адр&еса:", 1070, 20, 41, 62, 8 COMBOBOX 1073, 84, 37, 71, 61, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | WS_VSCROLL | NOT WS_TABSTOP COMBOBOX 1082, 160, 37, 62, 61, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - LTEXT " &1:", 1071, 20, 59, 62, 8 + LTEXT "Адреса &1:", 1071, 20, 59, 62, 8 COMBOBOX 1074, 84, 55, 71, 61, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | WS_VSCROLL | NOT WS_TABSTOP COMBOBOX 1083, 160, 55, 62, 61, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - LTEXT " &2:", 1072, 20, 77, 62, 8 + LTEXT "Адреса &2:", 1072, 20, 77, 62, 8 COMBOBOX 1075, 84, 73, 71, 61, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | WS_VSCROLL | NOT WS_TABSTOP COMBOBOX 1084, 160, 73, 62, 61, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - LTEXT " &3:", 1076, 20, 95, 62, 8 + LTEXT "Адреса &3:", 1076, 20, 95, 62, 8 COMBOBOX 1077, 84, 91, 71, 61, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | WS_VSCROLL | NOT WS_TABSTOP COMBOBOX 1085, 160, 91, 62, 61, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - LTEXT "& :", 1078, 20, 112, 62, 8 + LTEXT "&Пріоритетні виклики:", 1078, 20, 112, 62, 8 COMBOBOX 1079, 84, 109, 71, 61, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | WS_VSCROLL | NOT WS_TABSTOP COMBOBOX 1086, 160, 109, 62, 61, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - LTEXT "&³ :", 1080, 20, 131, 62, 8 + LTEXT "&Відповідний виклик:", 1080, 20, 131, 62, 8 COMBOBOX 1081, 84, 127, 71, 61, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | WS_VSCROLL | NOT WS_TABSTOP COMBOBOX 1087, 160, 127, 62, 61, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP END IDD_DISTINCTIVE_RING_2 DIALOGEX 0, 0, 238, 210 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION " " +CAPTION "Розрізнення дзвінків" FONT 8, "MS Shell Dlg" BEGIN GROUPBOX "", 1068, 10, 7, 218, 87 - AUTOCHECKBOX "& ", 1069, 19, 7, 177, 10 - CTEXT " ", -1, 20, 21, 74, 8 - CTEXT " ", -1, 96, 21, 65, 8 - LTEXT " &:", 1088, 20, 37, 53, 8 + AUTOCHECKBOX "В&икористовувати служби розрізнення дзвінків", 1069, 19, 7, 177, 10 + CTEXT "Вид дзвінка", -1, 20, 21, 74, 8 + CTEXT "Тип виклику", -1, 96, 21, 65, 8 + LTEXT "Один дзвіно&к:", 1088, 20, 37, 53, 8 COMBOBOX 1091, 96, 37, 65, 61, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - LTEXT "& :", 1089, 20, 57, 53, 8 + LTEXT "По&двійний дзвінок:", 1089, 20, 57, 53, 8 COMBOBOX 1092, 96, 55, 65, 61, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - LTEXT "& :", 1090, 20, 76, 53, 8 + LTEXT "По&трійний дзвінок:", 1090, 20, 76, 53, 8 COMBOBOX 1093, 96, 73, 65, 61, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP END IDD_DIAGNOSTICS DIALOGEX 0, 0, 238, 215 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION "ij" +CAPTION "Діагностика" FONT 8, "MS Shell Dlg" BEGIN CONTROL "", 1042, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x0000084D, 19, 18, 200, 58 CONTROL "", 1041, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x0000084D, 19, 84, 200, 58 - PUSHBUTTON " &", 1096, 138, 149, 75, 14 - AUTOCHECKBOX "& ", 1020, 18, 187, 98, 10 - PUSHBUTTON " &", 1094, 138, 184, 75, 14, WS_DISABLED - GROUPBOX "³ ", 1047, 10, 6, 217, 164 - GROUPBOX " ", -1, 10, 173, 217, 32 + PUSHBUTTON "Опитати &модем", 1096, 138, 149, 75, 14 + AUTOCHECKBOX "&Вести журнал", 1020, 18, 187, 98, 10 + PUSHBUTTON "Перегляд &журналу", 1094, 138, 184, 75, 14, WS_DISABLED + GROUPBOX "Відомості про модем", 1047, 10, 6, 217, 164 + GROUPBOX "Ведення журналу", -1, 10, 173, 217, 32 END IDD_PLEASE_WAIT DIALOGEX 0, 0, 195, 72 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION -CAPTION "..." +CAPTION "Зачекайте..." FONT 8, "MS Shell Dlg" BEGIN ICON 5100, -1, 9, 7, 20, 20 - LTEXT " ' . .", -1, 42, 7, 146, 28 - DEFPUSHBUTTON "", 2, 72, 52, 50, 14 + LTEXT "Триває зв'язок із модемом. Це може забрати декілька секунд.", -1, 42, 7, 146, 28 + DEFPUSHBUTTON "Скасувати", 2, 72, 52, 50, 14 END IDD_GENERAL_2 DIALOGEX 0, 0, 238, 210 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION "" +CAPTION "Загальні" FONT 8, "MS Shell Dlg" BEGIN - AUTOCHECKBOX "& ", 1002, 19, 22, 150, 10 - AUTOCHECKBOX "³& ", 1042, 19, 38, 143, 10 + AUTOCHECKBOX "&Ручний або полуавтоматичний набір номера", 1002, 19, 22, 150, 10 + AUTOCHECKBOX "Відкл&ючення при простої більше", 1042, 19, 38, 143, 10 EDITTEXT 1043, 168, 35, 25, 13, ES_AUTOHSCROLL | ES_NUMBER - LTEXT "& ", -1, 19, 56, 147, 10 + LTEXT "Скасува&ти виклик за відсутності відповіді протягом", -1, 19, 56, 147, 10 EDITTEXT 1040, 168, 54, 25, 13, ES_AUTOHSCROLL | ES_NUMBER - RTEXT "& :", 1034, 16, 102, 93, 8 + RTEXT "&Швидкість порту:", 1034, 16, 102, 93, 8 COMBOBOX 1036, 114, 100, 84, 69, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - RTEXT "&:", 1032, 16, 122, 93, 8 + RTEXT "&Протокол:", 1032, 16, 122, 93, 8 COMBOBOX 1037, 114, 119, 84, 69, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - RTEXT "&:", 1035, 16, 139, 93, 8 + RTEXT "&Стискання:", 1035, 16, 139, 93, 8 COMBOBOX 1099, 114, 137, 84, 69, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - RTEXT "& :", 1027, 16, 157, 93, 8 + RTEXT "&Керування потоком:", 1027, 16, 157, 93, 8 COMBOBOX 1031, 114, 155, 84, 61, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - GROUPBOX " ", 1060, 11, 7, 217, 66 - LTEXT "", 1044, 195, 38, 22, 8 - LTEXT "", 1041, 194, 56, 22, 8 - GROUPBOX " ", -1, 11, 82, 217, 94 + GROUPBOX "Параметри виклику", 1060, 11, 7, 217, 66 + LTEXT "хв", 1044, 195, 38, 22, 8 + LTEXT "сек", 1041, 194, 56, 22, 8 + GROUPBOX "Параметри підключення лінії даних", -1, 11, 82, 217, 94 END IDD_ADVANCED_2 DIALOGEX 17, 12, 238, 210 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION "" +CAPTION "Додатково" FONT 8, "MS Shell Dlg" BEGIN - AUTOCHECKBOX "&³ ", 1000, 20, 21, 200, 10 - AUTOCHECKBOX "& ", 1001, 20, 38, 200, 10 - RTEXT "& :", 1024, 18, 79, 93, 8 + AUTOCHECKBOX "&Відкрити вікно термінала до набору номера", 1000, 20, 21, 200, 10 + AUTOCHECKBOX "В&ідкрити вікно термінала після набору номера", 1001, 20, 38, 200, 10 + RTEXT "&Біти даних:", 1024, 18, 79, 93, 8 COMBOBOX 1025, 114, 77, 106, 61, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - RTEXT "&:", 1026, 18, 97, 93, 8 + RTEXT "&Парність:", 1026, 18, 97, 93, 8 COMBOBOX 1028, 114, 95, 106, 60, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - RTEXT "& :", 1029, 18, 115, 93, 8 + RTEXT "С&топові біти:", 1029, 18, 115, 93, 8 COMBOBOX 1030, 114, 113, 106, 45, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - RTEXT "&:", 1045, 18, 133, 93, 8 + RTEXT "&Модулювання:", 1045, 18, 133, 93, 8 COMBOBOX 1038, 114, 131, 106, 69, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - GROUPBOX "³ ", 1004, 10, 7, 217, 49 - GROUPBOX " ", 1005, 10, 64, 217, 89 + GROUPBOX "Вікно термінала", 1004, 10, 7, 217, 49 + GROUPBOX "Параметри настройки устаткування", 1005, 10, 64, 217, 89 END IDD_ISDN DIALOGEX 0, 0, 238, 210 @@ -175,13 +175,13 @@ STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION CAPTION "ISDN" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "& ", -1, 11, 6, 217, 39 + GROUPBOX "&Тип комутатора", -1, 11, 6, 217, 39 COMBOBOX 1104, 17, 20, 204, 69, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - GROUPBOX "& ", -1, 11, 50, 217, 50 + GROUPBOX "&Перший номер", -1, 11, 50, 217, 50 EDITTEXT 1017, 33, 62, 188, 13, ES_AUTOHSCROLL | ES_NUMBER LTEXT "S&PID/EAZ:", 1027, 34, 83, 67, 8 EDITTEXT 1107, 104, 79, 117, 13, ES_AUTOHSCROLL | ES_NUMBER - GROUPBOX "& ", -1, 11, 105, 217, 49 + GROUPBOX "&Другий номер", -1, 11, 105, 217, 49 EDITTEXT 1018, 33, 114, 189, 13, ES_AUTOHSCROLL | ES_NUMBER LTEXT "SPI&D/EAZ:", 1028, 35, 135, 68, 8 EDITTEXT 1108, 105, 132, 117, 13, ES_AUTOHSCROLL | ES_NUMBER @@ -189,58 +189,58 @@ END IDD_PLEASE_WAIT_2 DIALOGEX 0, 0, 195, 72 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION -CAPTION "" +CAPTION "Зачекайте" FONT 8, "MS Shell Dlg" BEGIN ICON 5100, -1, 9, 7, 20, 20 - LTEXT " / .", -1, 42, 7, 146, 28 + LTEXT "Надсилання відомостей про країну/регіон на модем.", -1, 42, 7, 146, 28 END IDD_WARNING DIALOGEX 0, 0, 360, 105 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION -CAPTION "" +CAPTION "Попередження" FONT 8, "MS Shell Dlg" BEGIN - AUTOCHECKBOX " ", 1109, 17, 73, 118, 10 + AUTOCHECKBOX "Більше не показувати це повідомлення", 1109, 17, 73, 118, 10 DEFPUSHBUTTON "OK", 1, 302, 84, 50, 14 - LTEXT " .", -1, 50, 27, 304, 8 - LTEXT "³ .", -1, 50, 41, 304, 8 + LTEXT "Деякі модеми неправильно обробляють такі довгі рядки ініціалізації.", -1, 50, 27, 304, 8 + LTEXT "Відомості про це обмеження можна отримати від виробника вашого модема.", -1, 50, 41, 304, 8 ICON 5100, -1, 15, 14, 20, 20 - LTEXT " , 57 .", -1, 50, 14, 304, 8 + LTEXT "Введено рядок ініціалізації модема, довший за 57 знаків.", -1, 50, 14, 304, 8 END IDD_MODEMS DIALOGEX 0, 0, 252, 218 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION "" +CAPTION "Модеми" FONT 8, "MS Shell Dlg" BEGIN ICON 5100, 1057, 6, 7, 20, 20 - LTEXT "& ' :", -1, 44, 12, 203, 9 + LTEXT "&На комп'ютері установлено такі модеми:", -1, 44, 12, 203, 9 CONTROL "", 113, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x00000849, 7, 32, 238, 158, WS_EX_CLIENTEDGE - PUSHBUTTON "&...", 110, 56, 198, 60, 14 - PUSHBUTTON "&", 112, 121, 198, 60, 14 - PUSHBUTTON "&", 109, 185, 198, 60, 14 + PUSHBUTTON "&Додати...", 110, 56, 198, 60, 14 + PUSHBUTTON "В&идалити", 112, 121, 198, 60, 14 + PUSHBUTTON "Влас&тивості", 109, 185, 198, 60, 14 END IDD_PLEASE_WAIT_3 DIALOGEX 0, 0, 195, 72 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION -CAPTION "..." +CAPTION "Зачекайте..." FONT 8, "MS Shell Dlg" BEGIN - DEFPUSHBUTTON "&", 2, 74, 53, 50, 14 + DEFPUSHBUTTON "&Зупинити", 2, 74, 53, 50, 14 ICON 5100, -1, 9, 7, 20, 20 - LTEXT "", -1, 40, 8, 151, 8 - LTEXT "", 1005, 40, 16, 151, 25 + LTEXT "Видалення", -1, 40, 8, 151, 8 + LTEXT "Модем", 1005, 40, 16, 151, 25 END STRINGTABLE BEGIN - 180 " RS-232" - 181 " " - 182 " " - 183 " PCMCIA" - 184 " " - 185 " " + 180 "Послідовний порт RS-232" + 181 "Зовнішній модем" + 182 "Внутрішній модем" + 183 "Модем PCMCIA" + 184 "Паралельний модем" + 185 "Паралельний порт" 200 "110" 201 "1200" 202 "2400" @@ -259,46 +259,46 @@ BEGIN 242 "6" 243 "7" 244 "8" - 250 "" - 251 "" - 252 " " - 253 " (1)" - 254 " (0)" + 250 "Парна" + 251 "Непарна" + 252 "Без перевірки" + 253 "Маркер (1)" + 254 "Пробіл (0)" 255 "1" 256 "1,5" 257 "2" 260 "Xon/Xoff" - 261 "" - 262 "" - 263 "." - 264 "" + 261 "Апаратне" + 262 "Немає" + 263 "Увімк." + 264 "Нижче" 265 "V.23 (Minitel)" - 266 "" - 267 " (Bell, HST)" - 270 "& " - 300 " " - 301 "" - 302 "" - 303 "" - 304 "" - 320 " " - 340 "" - 341 " " - 342 " " - 400 " " - 401 " , 57 .\n\n³ " - 402 "" - 460 " ' .\n ." - 461 " ' .\n ." - 463 " """" .\n\n ." - 465 " EC" - 466 " EC" - 467 "" - 468 "" - 469 "" - 470 "" - 480 " (1 .)" - 481 " (2 .)" + 266 "Стандартна" + 267 "Нестандартна (Bell, HST)" + 270 "Д&одати до журналу" + 300 "Немає даних" + 301 "Дані" + 302 "Факс" + 303 "Голос" + 304 "Немає" + 320 "Параметри країни або регіону оновлено" + 340 "Модем" + 341 "Параметри модема" + 342 "Адреса модема" + 400 "Параметри країни або регіону не оновлено" + 401 "Деякі модеми не сприймають команд ініціалізації, якщо рядок команди довший за 57 знаків.\n\nВідомості про такі обмеження можна отримати від виробника вашого модема" + 402 "Попередження" + 460 "Недостатньо пам'яті для показу діалогового вікна загальних властивостей.\nЗакрийте декілька файлів або програм і повторіть спробу." + 461 "Недостатньо пам'яті для показу діалогового вікна параметрів модема.\nЗакрийте декілька файлів або програм і повторіть спробу." + 463 "Кожна адреса виклику має бути ""Автоматичною"" або мати унікальний вид дзвінка.\n\nЗмініть повторюваний вид дзвінка на інший." + 465 "Стандартний EC" + 466 "Форсований EC" + 467 "Мобільний" + 468 "Вимкнено" + 469 "Увімкнуто" + 470 "Вимкнено" + 480 "АВТО (1 кан.)" + 481 "АВТО (2 кан.)" 482 "PPP (56K)" 483 "PPP (64K)" 484 "PPP (112K)" @@ -327,19 +327,19 @@ BEGIN 515 "V.110 (28.8K)" 516 "V.110 (38.4K)" 517 "V.110 (57.6K)" - 518 " (V.34/V.90)" - 550 "ESS5 (AT&T) (ϳ )" - 551 " & - " + 518 "Аналоговий (V.34/V.90)" + 550 "ESS5 (AT&T) (Північна Америка)" + 551 "АТТ т&очка - декілька точок" 552 "National ISDN 1 (NI-1)" 553 "Northern Telecom DMS 100 (NT1)" - 554 "NTT INS64 ()" - 555 "European ISDN (DSS1) ()" - 556 "German National (1TR6) ( )" - 557 "French National (VN3) ( )" - 558 "Belgium National ( )" - 559 "Australian National ( )" - 560 " " - 570 " ISDN \n .\n\n \nISDN ." + 554 "NTT INS64 (Японія)" + 555 "European ISDN (DSS1) (Европа)" + 556 "German National (1TR6) (рідко використовується)" + 557 "French National (VN3) (рідко використовується)" + 558 "Belgium National (рідко використовується)" + 559 "Australian National (рідко використовується)" + 560 "Невідомий комутатор" + 570 "Настройку ISDN для цього модема\nне закінчено.\n\nЗаповніть відомості на вкладці\nISDN перед використанням цього модема." 600 "PPP (56K,GSM)" 601 "PPP (64K,GSM)" 602 "V.120 (64K,GSM)" @@ -353,269 +353,269 @@ BEGIN 611 "V.110 (28.8K,GSM)" 612 "V.110 (38.4K,GSM)" 613 "V.110 (57.6K,GSM)" - 614 " RLP" - 615 " NRLP" + 614 "Аналоговий RLP" + 615 "Аналоговий NRLP" 616 "GPRS" - 617 "PIAFS - " - 618 "PIAFS - " - 700 " TAPI" - 2006 "ϳ " - 2007 "" - 2008 " " - 2009 " " - 2010 "# , '.\n\n ' ?" - 2011 " " - 2012 " " - 3000 " " - 3018 "" - 3019 " ." - 3053 " , .\n\n ." - 3054 ": " - 3060 " ?" - 3061 " ""%1"" %2." - 3062 "" - 3069 " ', .\n\n ." - 3073 " ." - 3074 " . ." - 3076 " , '.\n\n ' ?" - 3077 " " - 3200 "300 " - 3201 "1200 " - 3202 "2400 " - 3203 "9600 " - 3204 "19,2K " - 3205 "38,4K " - 3206 "57,6K " - 3207 " " - 3212 "" - 3213 "³" - 3214 " , . . ." - 3215 ", , . , ." + 617 "PIAFS - вхідний" + 618 "PIAFS - вихідний" + 700 "Використовувати поточне розташування з TAPI" + 2006 "Підключений до" + 2007 "Немає" + 2008 "Не працює" + 2009 "Потрібне перезавантаження" + 2010 "#Щоб закінчити установку модема, слід перезапустити комп'ютер.\n\nПерезапустити комп'ютер зараз?" + 2011 "Модем установлено неправильно" + 2012 "Невідомий порт" + 3000 "Установка модема" + 3018 "Модеми" + 3019 "Установка нового модема та зміна його параметрів." + 3053 "Властивості модема неможливо показати, оскільки модем недоступний.\n\nПерезавантажте систему та повторіть спробу." + 3054 "Властивості: Модеми" + 3060 "Ви дійсно бажаєте видалити вибрані модеми із системи?" + 3061 "Не вдалося видалити модем ""%1"" із порту %2." + 3062 "Модем" + 3069 "Недостатньо пам'яті, щоб відкрити панель керування модемів.\n\nЗакрийте декілька програм і повторіть спробу." + 3073 "Установлювати модеми дозволено лише системним адміністраторам." + 3074 "Не установлено жодного модема. Установлювати модеми дозволено лише системним адміністраторам." + 3076 "Щоб нові параметри набрали сили, слід перезапустити комп'ютер.\n\nПерезапустити комп'ютер зараз?" + 3077 "Зміна параметрів мережі" + 3200 "300 бод" + 3201 "1200 бод" + 3202 "2400 бод" + 3203 "9600 бод" + 3204 "19,2K бод" + 3205 "38,4K бод" + 3206 "57,6K бод" + 3207 "Немає відповіді" + 3212 "Команда" + 3213 "Відповідь" + 3214 "Неможливо відкрити порт, до якого підключено модем. Це може бути викликано конфліктом устаткування. За допомогою диспетчера пристроїв перевірте роботоздатність всіх пристроїв." + 3215 "Порт, який використовується модемом, зараз відкритий іншим додатком. Закрийте всі програми, які можуть використовувати цей порт." 3218 "OpenComm" - 3221 "115K " - 3222 "" - 3223 "" - 3233 "" - 3236 " . , . , , ." - 3237 " ϲӪ" - 3238 "" - 3239 "" - 3240 " " - 3241 " " - 6144 "" - 6145 "" - 6146 "" - 6147 " " - 6148 "ͳ ( 04)" - 6149 "" - 6150 " " - 6151 "" - 6152 ". " - 6153 "" - 6154 "" - 6155 " -" - 6156 "" - 6157 "" - 6158 "" - 6159 "" - 6160 "" - 6161 "" - 6162 " -" - 6163 "" - 6164 "" - 6165 "" - 6166 "" - 6167 " (23)" - 6168 " " - 6169 "³ - ()" - 6170 "" - 6171 "" - 6172 "'" - 6173 "" - 6174 "" - 6175 "" - 6176 "" - 6177 "-" - 6178 " -" - 6179 " " - 6180 "" - 6181 "" - 6182 "" - 6183 "" - 6184 " -" - 6185 "" - 6186 "- " - 6187 "-г" - 6188 "" - 6189 "ʳ" - 6190 "" - 6191 "" - 6192 "ϳ " - 6193 "" - 6194 "" - 6195 " " - 6196 "" - 6197 "" - 6198 "" - 6199 "" - 6200 " " - 6201 "" - 6202 " () -" - 6203 "- Գ" - 6204 "Գ" - 6205 "" - 6206 " ()" - 6207 " (63)" - 6208 "" - 6209 "" - 6210 "ͳ ( 66)" - 6211 "" - 6212 "" - 6213 "ó" - 6214 "" - 6215 "" - 6216 "" - 6217 "" - 6218 "" - 6219 "" - 6220 "-" - 6221 "" - 6222 "" - 6223 "" - 6224 " ()" - 6225 "" - 6226 "" - 6227 "" - 6228 "" - 6229 "" - 6230 "" - 6231 "" - 6232 "" - 6233 "" - 6234 "-'" - 6235 "" - 6236 "" - 6237 "" - 6238 "" - 6239 "" - 6240 "ʳ" - 6241 "" - 6242 "" - 6243 "" - 6244 "˳" - 6245 "" - 6246 "˳" - 6247 "˳" - 6248 "˳" - 6249 "" - 6250 " ()" - 6251 "" - 6252 "" - 6253 "" - 6254 "" - 6255 "" - 6256 "" - 6257 "" - 6258 "" - 6259 "" - 6260 "" - 6261 "" - 6262 "" - 6263 "" - 6264 "" - 6265 "" - 6266 "" - 6267 "ͳ" - 6268 " - (ͳ)" - 6269 " " - 6270 " " - 6271 "ͳ" - 6272 "ͳ" - 6273 "ͳ" - 6274 "" - 6275 "" - 6276 "" - 6277 "" - 6278 "- " - 6279 "" - 6280 "" - 6281 "Գ" - 6282 "" - 6283 "" - 6284 "-" - 6285 "" - 6286 "" - 6287 "" - 6288 "-ʳ " - 6289 " (145)" - 6290 ". " - 6291 "-" - 6292 "-" - 6293 " (148)" - 6294 "- " - 6295 "-³ " - 6296 " " - 6297 "" - 6298 " -" - 6299 "-" - 6300 "ѳ" - 6301 " -" - 6302 "" - 6303 "ϳ- " - 6304 "" - 6305 "-" - 6306 "" - 6307 "" - 6308 "" - 6309 "" - 6310 "" - 6311 "" - 6312 "" - 6313 "" - 6314 "" - 6315 "" - 6316 " " - 6317 "" - 6318 "" - 6319 "- " - 6320 "" - 6321 "" - 6322 "" - 6323 "' " - 6324 "" - 6325 " " - 6326 "-" - 6327 "" - 6328 " (184)" - 6329 "" - 6330 "" - 6331 "" - 6332 "'" - 6333 "- " - 6334 "" - 6335 "" - 6336 "" - 6337 " (193)" - 6338 " ()" - 6339 "" - 6340 "dz" - 6501 "" - 6502 "" - 6503 "" - 6504 "³" - 6505 "" - 6506 "" - 6507 "" - 6508 "" - 6509 "" - 6510 "" - 6511 "" - 6512 "" - 6513 "" - 6600 "" - 6601 "" - 6602 ", " - 6603 " " - 6604 "" - 20013 " " + 3221 "115K бод" + 3222 "Оновлення" + 3223 "Помилка" + 3233 "Успішно" + 3236 "Модем не відповідає. Переконайтеся, що його належним чином підключено та ввімкнуто. Якщо це вбудований модем або він підключений правильно, перевірте, чи правильно переривання для порту." + 3237 "КОМАНДА НЕ ПІДТРИМУЄТЬСЯ" + 3238 "Поле" + 3239 "Значення" + 3240 " Переваги за замовчуванням" + 3241 " Переваги підключення" + 6144 "Японія" + 6145 "Албанія" + 6146 "Алжир" + 6147 "Східне Самоа" + 6148 "Німеччина (код країни або регіону 04)" + 6149 "Ангілья" + 6150 "Антигуа і Барбуда" + 6151 "Аргентина" + 6152 "о. Вознесіння" + 6153 "Австралія" + 6154 "Австрія" + 6155 "Багамські о-ви" + 6156 "Бахрейн" + 6157 "Бангладеш" + 6158 "Барбадос" + 6159 "Бельгія" + 6160 "Беліз" + 6161 "Бенін" + 6162 "Бермудські о-ви" + 6163 "Бутан" + 6164 "Болівія" + 6165 "Ботсвана" + 6166 "Бразилія" + 6167 "Код країни або регіону (23)" + 6168 "Британські території в Індійському океані" + 6169 "Віргінські о-ви (Британські)" + 6170 "Бруней" + 6171 "Болгарія" + 6172 "М'янма" + 6173 "Бурунді" + 6174 "Білорусь" + 6175 "Камерун" + 6176 "Канада" + 6177 "Кабо-Верде" + 6178 "Кайманові о-ви" + 6179 "Центральноафриканська Республіка" + 6180 "Чад" + 6181 "Чилі" + 6182 "Китай" + 6183 "Колумбія" + 6184 "Коморські о-ви" + 6185 "Конго" + 6186 "о-ви Кука" + 6187 "Коста-Ріка" + 6188 "Куба" + 6189 "Кіпр" + 6190 "Чехія" + 6191 "Камбоджа" + 6192 "Північна Корея" + 6193 "Данія" + 6194 "Джибуті" + 6195 "Домініканська Республіка" + 6196 "Домініка" + 6197 "Еквадор" + 6198 "Єгипет" + 6199 "Сальвадор" + 6200 "Екваторіальна Гвінея" + 6201 "Ефіопія" + 6202 "Фолклендські (Мальвінські) о-ви" + 6203 "о-ви Фіджі" + 6204 "Фінляндія" + 6205 "Франція" + 6206 "Полінезія (Французька)" + 6207 "Код країни або регіону (63)" + 6208 "Габон" + 6209 "Гамбія" + 6210 "Німеччина (код країни або регіону 66)" + 6211 "Ангола" + 6212 "Гана" + 6213 "Гібралтар" + 6214 "Греція" + 6215 "Гренада" + 6216 "Гуам" + 6217 "Гватемала" + 6218 "Гернсі" + 6219 "Гвінея" + 6220 "Гвінея-Бісау" + 6221 "Гайана" + 6222 "Гаїті" + 6223 "Гондурас" + 6224 "Гонконг (ОАР)" + 6225 "Угорщина" + 6226 "Ісландія" + 6227 "Індія" + 6228 "Індонезія" + 6229 "Іран" + 6230 "Ірак" + 6231 "Ірландія" + 6232 "Ізраїль" + 6233 "Італія" + 6234 "Кот-д'Івуар" + 6235 "Ямайка" + 6236 "Афганістан" + 6237 "Джерсі" + 6238 "Йорданія" + 6239 "Кенія" + 6240 "Кірібаті" + 6241 "Корея" + 6242 "Кувейт" + 6243 "Лаос" + 6244 "Ліван" + 6245 "Лесото" + 6246 "Ліберія" + 6247 "Лівія" + 6248 "Ліхтенштейн" + 6249 "Люксембург" + 6250 "Аоминь (ОАР)" + 6251 "Мадагаскар" + 6252 "Малайзія" + 6253 "Малаві" + 6254 "Мальдиви" + 6255 "Малі" + 6256 "Мальта" + 6257 "Мавританія" + 6258 "Маврикій" + 6259 "Мексика" + 6260 "Монако" + 6261 "Монголія" + 6262 "Монтсеррат" + 6263 "Марокко" + 6264 "Мозамбік" + 6265 "Науру" + 6266 "Непал" + 6267 "Нідерланди" + 6268 "Антильські о-ви (Нідерландські)" + 6269 "Нова Каледонія" + 6270 "Нова Зеландія" + 6271 "Нікарагуа" + 6272 "Нігер" + 6273 "Нігерія" + 6274 "Норвегія" + 6275 "Оман" + 6276 "Пакистан" + 6277 "Панама" + 6278 "Папуа-Нова Гвінея" + 6279 "Парагвай" + 6280 "Перу" + 6281 "Філіппіни" + 6282 "Польща" + 6283 "Португалія" + 6284 "Пуерто-Рико" + 6285 "Катар" + 6286 "Румунія" + 6287 "Руанда" + 6288 "Сент-Кітс і Невіс" + 6289 "Код країни або регіону (145)" + 6290 "о. Святої Єлени" + 6291 "Сент-Люсія" + 6292 "Сан-Марино" + 6293 "Код країни або регіону (148)" + 6294 "Сан-Томе і Прінсіпі" + 6295 "Сент-Вінсент і Гренадини" + 6296 "Саудівська Аравія" + 6297 "Сенегал" + 6298 "Сейшельські о-ви" + 6299 "Сьєрра-Леоне" + 6300 "Сінгапур" + 6301 "Соломонові о-ви" + 6302 "Сомалі" + 6303 "Південно-Африканська Республіка" + 6304 "Іспанія" + 6305 "Шрі-Ланка" + 6306 "Судан" + 6307 "Суринам" + 6308 "Свазіленд" + 6309 "Швеція" + 6310 "Швейцарія" + 6311 "Сирія" + 6312 "Танзанія" + 6313 "Таїланд" + 6314 "Того" + 6315 "Тонга" + 6316 "Тринідад і Тобаго" + 6317 "Туніс" + 6318 "Туреччина" + 6319 "о-ви Теркс і Кайкос" + 6320 "Тувалу" + 6321 "Уганда" + 6322 "Україна" + 6323 "Об'єднані Арабські Емірати" + 6324 "Великобританія" + 6325 "Сполучені Штати Америки" + 6326 "Буркіна-Фасо" + 6327 "Уругвай" + 6328 "Код країни або регіону (184)" + 6329 "Вануату" + 6330 "Ватикан" + 6331 "Венесуела" + 6332 "В'єтнам" + 6333 "о-ви Волліс і Футуна" + 6334 "Самоа" + 6335 "Ємен" + 6336 "Ємен" + 6337 "Код країни або регіону (193)" + 6338 "Конго (ДРК)" + 6339 "Замбія" + 6340 "Зімбабве" + 6501 "Молдавія" + 6502 "Естонія" + 6503 "Литва" + 6504 "Вірменія" + 6505 "Грузія" + 6506 "Азербайджан" + 6507 "Туркменістан" + 6508 "Узбекистан" + 6509 "Казахстан" + 6510 "Таджикистан" + 6511 "Киргизія" + 6512 "Латвія" + 6513 "Росія" + 6600 "Хорватія" + 6601 "Словенія" + 6602 "Македонія, Колишня Югославська Республіка" + 6603 "Боснія і Герцеговина" + 6604 "Югославія" + 20013 "Код устаткування" END diff --git a/dll/win32/modemui/modemui.rc b/dll/win32/modemui/modemui.rc index c9b2b34e3d0..7128220084c 100644 --- a/dll/win32/modemui/modemui.rc +++ b/dll/win32/modemui/modemui.rc @@ -17,6 +17,9 @@ IDI_703 ICON "res/703.ico" #include "lang/en-US.rc" #include "lang/es-ES.rc" #include "lang/no-NO.rc" + +// UTF-8 +#pragma code_page(65001) #include "lang/pl-PL.rc" #include "lang/ro-RO.rc" #include "lang/ru-RU.rc" diff --git a/dll/win32/msacm32/CMakeLists.txt b/dll/win32/msacm32/CMakeLists.txt index c163adb51a2..8eb85ac3eb1 100644 --- a/dll/win32/msacm32/CMakeLists.txt +++ b/dll/win32/msacm32/CMakeLists.txt @@ -1,7 +1,6 @@ set_unicode() -add_definitions(-D_DLL -D__USE_CRTIMP) include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine) set_rc_compiler() diff --git a/dll/win32/msadp32.acm/CMakeLists.txt b/dll/win32/msadp32.acm/CMakeLists.txt index 1c73fd654b1..6a2f55874c3 100644 --- a/dll/win32/msadp32.acm/CMakeLists.txt +++ b/dll/win32/msadp32.acm/CMakeLists.txt @@ -1,8 +1,5 @@ -add_definitions( - -D_DLL -D__USE_CRTIMP - -D__WINESRC__) - +add_definitions(-D__WINESRC__) include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine) spec2def(msadp32.acm msadp32.acm.spec) diff --git a/dll/win32/msafd/CMakeLists.txt b/dll/win32/msafd/CMakeLists.txt index 7b87ac897a2..30b0544dc5b 100644 --- a/dll/win32/msafd/CMakeLists.txt +++ b/dll/win32/msafd/CMakeLists.txt @@ -16,13 +16,10 @@ list(APPEND SOURCE misc/stubs.c ${CMAKE_CURRENT_BINARY_DIR}/msafd.def) -add_library(msafd SHARED - ${CMAKE_CURRENT_BINARY_DIR}/msafd_msafd.h.gch - ${SOURCE}) +add_library(msafd SHARED ${SOURCE}) set_module_type(msafd win32dll) -add_pch(msafd ${CMAKE_CURRENT_SOURCE_DIR}/msafd.h ${SOURCE}) - add_importlibs(msafd advapi32 msvcrt kernel32 ntdll) +add_pch(msafd msafd.h) add_cd_file(TARGET msafd DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/msafd/misc/dllmain.c b/dll/win32/msafd/misc/dllmain.c index b2680e0bf28..9cd2d384c78 100644 --- a/dll/win32/msafd/misc/dllmain.c +++ b/dll/win32/msafd/misc/dllmain.c @@ -12,8 +12,6 @@ #include -#include - #if DBG //DWORD DebugTraceLevel = DEBUG_ULTRA; DWORD DebugTraceLevel = 0; @@ -264,7 +262,7 @@ WSPSocket(int AddressFamily, /* Save Group Info */ if (g != 0) { - GetSocketInformation(Socket, AFD_INFO_GROUP_ID_TYPE, 0, &GroupData); + GetSocketInformation(Socket, AFD_INFO_GROUP_ID_TYPE, NULL, NULL, &GroupData); Socket->SharedData.GroupID = GroupData.u.LowPart; Socket->SharedData.GroupType = GroupData.u.HighPart; } @@ -272,11 +270,13 @@ WSPSocket(int AddressFamily, /* Get Window Sizes and Save them */ GetSocketInformation (Socket, AFD_INFO_SEND_WINDOW_SIZE, + NULL, &Socket->SharedData.SizeOfSendBuffer, NULL); GetSocketInformation (Socket, AFD_INFO_RECEIVE_WINDOW_SIZE, + NULL, &Socket->SharedData.SizeOfRecvBuffer, NULL); @@ -401,6 +401,7 @@ WSPCloseSocket(IN SOCKET Handle, HANDLE SockEvent; AFD_DISCONNECT_INFO DisconnectInfo; SOCKET_STATE OldState; + LONG LingerWait = -1; /* Create the Wait Event */ Status = NtCreateEvent(&SockEvent, @@ -453,7 +454,6 @@ WSPCloseSocket(IN SOCKET Handle, /* FIXME: Should we do this on Datagram Sockets too? */ if ((OldState == SocketConnected) && (Socket->SharedData.LingerData.l_onoff)) { - ULONG LingerWait; ULONG SendsInProgress; ULONG SleepWait; @@ -467,6 +467,7 @@ WSPCloseSocket(IN SOCKET Handle, /* Find out how many Sends are in Progress */ if (GetSocketInformation(Socket, AFD_INFO_SENDS_IN_PROGRESS, + NULL, &SendsInProgress, NULL)) { @@ -477,7 +478,11 @@ WSPCloseSocket(IN SOCKET Handle, /* Bail out if no more sends are pending */ if (!SendsInProgress) + { + LingerWait = -1; break; + } + /* * We have to execute a sleep, so it's kind of like * a block. If the socket is Nonblock, we cannot @@ -502,33 +507,36 @@ WSPCloseSocket(IN SOCKET Handle, Sleep(SleepWait); LingerWait -= SleepWait; } + } - /* - * We have reached the timeout or sends are over. - * Disconnect if the timeout has been reached. - */ + if (OldState == SocketConnected) + { if (LingerWait <= 0) { DisconnectInfo.Timeout = RtlConvertLongToLargeInteger(0); - DisconnectInfo.DisconnectType = AFD_DISCONNECT_ABORT; - - /* Send IOCTL */ - Status = NtDeviceIoControlFile((HANDLE)Handle, - SockEvent, - NULL, - NULL, - &IoStatusBlock, - IOCTL_AFD_DISCONNECT, - &DisconnectInfo, - sizeof(DisconnectInfo), - NULL, - 0); - - /* Wait for return */ - if (Status == STATUS_PENDING) + DisconnectInfo.DisconnectType = LingerWait < 0 ? AFD_DISCONNECT_SEND : AFD_DISCONNECT_ABORT; + + if (((DisconnectInfo.DisconnectType & AFD_DISCONNECT_SEND) && (!Socket->SharedData.SendShutdown)) || + ((DisconnectInfo.DisconnectType & AFD_DISCONNECT_ABORT) && (!Socket->SharedData.ReceiveShutdown))) { - WaitForSingleObject(SockEvent, INFINITE); - Status = IoStatusBlock.Status; + /* Send IOCTL */ + Status = NtDeviceIoControlFile((HANDLE)Handle, + SockEvent, + NULL, + NULL, + &IoStatusBlock, + IOCTL_AFD_DISCONNECT, + &DisconnectInfo, + sizeof(DisconnectInfo), + NULL, + 0); + + /* Wait for return */ + if (Status == STATUS_PENDING) + { + WaitForSingleObject(SockEvent, INFINITE); + Status = IoStatusBlock.Status; + } } } } @@ -796,7 +804,8 @@ WSPSelect(IN int nfds, IO_STATUS_BLOCK IOSB; PAFD_POLL_INFO PollInfo; NTSTATUS Status; - LONG HandleCount, OutCount = 0; + ULONG HandleCount; + LONG OutCount = 0; ULONG PollBufferSize; PVOID PollBuffer; ULONG i, j = 0, x; @@ -813,7 +822,7 @@ WSPSelect(IN int nfds, if ( HandleCount == 0 ) { - AFD_DbgPrint(MAX_TRACE,("HandleCount: %d. Return SOCKET_ERROR\n", + AFD_DbgPrint(MAX_TRACE,("HandleCount: %u. Return SOCKET_ERROR\n", HandleCount)); if (lpErrno) *lpErrno = WSAEINVAL; return SOCKET_ERROR; @@ -821,7 +830,7 @@ WSPSelect(IN int nfds, PollBufferSize = sizeof(*PollInfo) + ((HandleCount - 1) * sizeof(AFD_HANDLE)); - AFD_DbgPrint(MID_TRACE,("HandleCount: %d BufferSize: %d\n", + AFD_DbgPrint(MID_TRACE,("HandleCount: %u BufferSize: %u\n", HandleCount, PollBufferSize)); /* Convert Timeout to NT Format */ @@ -1044,6 +1053,7 @@ WSPAccept(SOCKET Handle, ULONG CallBack; WSAPROTOCOL_INFOW ProtocolInfo; SOCKET AcceptSocket; + PSOCKET_INFORMATION AcceptSocketInfo; UCHAR ReceiveBuffer[0x1A]; HANDLE SockEvent; @@ -1359,6 +1369,17 @@ WSPAccept(SOCKET Handle, MsafdReturnWithErrno( Status, lpErrno, 0, NULL ); return INVALID_SOCKET; } + + AcceptSocketInfo = GetSocketStructure(AcceptSocket); + if (!AcceptSocketInfo) + { + NtClose(SockEvent); + WSPCloseSocket( AcceptSocket, lpErrno ); + MsafdReturnWithErrno( STATUS_INVALID_CONNECTION, lpErrno, 0, NULL ); + return INVALID_SOCKET; + } + + AcceptSocketInfo->SharedData.State = SocketConnected; /* Return Address in SOCKADDR FORMAT */ if( SocketAddress ) @@ -1564,6 +1585,7 @@ WSPConnect(SOCKET Handle, if (Status != STATUS_SUCCESS) goto notify; + Socket->SharedData.State = SocketConnected; Socket->TdiConnectionHandle = (HANDLE)IOSB.Information; /* Get any pending connect data */ @@ -1680,7 +1702,7 @@ WSPShutdown(SOCKET Handle, break; } - DisconnectInfo.Timeout = RtlConvertLongToLargeInteger(-1); + DisconnectInfo.Timeout = RtlConvertLongToLargeInteger(-1000000); /* Send IOCTL */ Status = NtDeviceIoControlFile((HANDLE)Handle, @@ -1742,6 +1764,13 @@ WSPGetSockName(IN SOCKET Handle, return SOCKET_ERROR; } + if (!Name || !NameLength) + { + NtClose(SockEvent); + *lpErrno = WSAEFAULT; + return SOCKET_ERROR; + } + /* Allocate a buffer for the address */ TdiAddressSize = sizeof(TRANSPORT_ADDRESS) + Socket->SharedData.SizeOfLocalAddress; @@ -1779,13 +1808,13 @@ WSPGetSockName(IN SOCKET Handle, if (NT_SUCCESS(Status)) { - if (*NameLength >= SocketAddress->Address[0].AddressLength) + if (*NameLength >= Socket->SharedData.SizeOfLocalAddress) { Name->sa_family = SocketAddress->Address[0].AddressType; RtlCopyMemory (Name->sa_data, SocketAddress->Address[0].Address, SocketAddress->Address[0].AddressLength); - *NameLength = 2 + SocketAddress->Address[0].AddressLength; + *NameLength = Socket->SharedData.SizeOfLocalAddress; AFD_DbgPrint (MID_TRACE, ("NameLength %d Address: %x Port %x\n", *NameLength, ((struct sockaddr_in *)Name)->sin_addr.s_addr, ((struct sockaddr_in *)Name)->sin_port)); @@ -1836,8 +1865,22 @@ WSPGetPeerName(IN SOCKET s, return SOCKET_ERROR; } + if (Socket->SharedData.State != SocketConnected) + { + NtClose(SockEvent); + *lpErrno = WSAENOTCONN; + return SOCKET_ERROR; + } + + if (!Name || !NameLength) + { + NtClose(SockEvent); + *lpErrno = WSAEFAULT; + return SOCKET_ERROR; + } + /* Allocate a buffer for the address */ - TdiAddressSize = sizeof(TRANSPORT_ADDRESS) + *NameLength; + TdiAddressSize = sizeof(TRANSPORT_ADDRESS) + Socket->SharedData.SizeOfRemoteAddress; SocketAddress = HeapAlloc(GlobalHeap, 0, TdiAddressSize); if ( SocketAddress == NULL ) @@ -1870,13 +1913,13 @@ WSPGetPeerName(IN SOCKET s, if (NT_SUCCESS(Status)) { - if (*NameLength >= SocketAddress->Address[0].AddressLength) + if (*NameLength >= Socket->SharedData.SizeOfRemoteAddress) { Name->sa_family = SocketAddress->Address[0].AddressType; RtlCopyMemory (Name->sa_data, SocketAddress->Address[0].Address, SocketAddress->Address[0].AddressLength); - *NameLength = 2 + SocketAddress->Address[0].AddressLength; + *NameLength = Socket->SharedData.SizeOfRemoteAddress; AFD_DbgPrint (MID_TRACE, ("NameLength %d Address: %s Port %x\n", *NameLength, ((struct sockaddr_in *)Name)->sin_addr.s_addr, ((struct sockaddr_in *)Name)->sin_port)); @@ -1910,6 +1953,7 @@ WSPIoctl(IN SOCKET Handle, { PSOCKET_INFORMATION Socket = NULL; BOOLEAN NeedsCompletion; + BOOLEAN NonBlocking; /* Get the Socket Structure associate to this Socket*/ Socket = GetSocketStructure(Handle); @@ -1929,8 +1973,9 @@ WSPIoctl(IN SOCKET Handle, *lpErrno = WSAEFAULT; return SOCKET_ERROR; } - Socket->SharedData.NonBlocking = *((PULONG)lpvInBuffer) ? 1 : 0; - *lpErrno = SetSocketInformation(Socket, AFD_INFO_BLOCKING_MODE, (PULONG)lpvInBuffer, NULL); + NonBlocking = *((PULONG)lpvInBuffer) ? TRUE : FALSE; + Socket->SharedData.NonBlocking = NonBlocking ? 1 : 0; + *lpErrno = SetSocketInformation(Socket, AFD_INFO_BLOCKING_MODE, &NonBlocking, NULL, NULL); if (*lpErrno != NO_ERROR) return SOCKET_ERROR; else @@ -1941,7 +1986,7 @@ WSPIoctl(IN SOCKET Handle, *lpErrno = WSAEFAULT; return SOCKET_ERROR; } - *lpErrno = GetSocketInformation(Socket, AFD_INFO_RECEIVE_CONTENT_SIZE, (PULONG)lpvOutBuffer, NULL); + *lpErrno = GetSocketInformation(Socket, AFD_INFO_RECEIVE_CONTENT_SIZE, NULL, (PULONG)lpvOutBuffer, NULL); if (*lpErrno != NO_ERROR) return SOCKET_ERROR; else @@ -1949,6 +1994,9 @@ WSPIoctl(IN SOCKET Handle, *lpcbBytesReturned = sizeof(ULONG); return NO_ERROR; } + case SIO_GET_EXTENSION_FUNCTION_POINTER: + *lpErrno = WSAEINVAL; + return SOCKET_ERROR; default: *lpErrno = Socket->HelperData->WSHIoctl(Socket->HelperContext, Handle, @@ -1984,7 +2032,7 @@ WSPGetSockOpt(IN SOCKET Handle, PSOCKET_INFORMATION Socket = NULL; PVOID Buffer; INT BufferSize; - BOOLEAN BoolBuffer; + BOOL BoolBuffer; /* Get the Socket Structure associate to this Socket*/ Socket = GetSocketStructure(Handle); @@ -2019,29 +2067,38 @@ WSPGetSockOpt(IN SOCKET Handle, case SO_ACCEPTCONN: BoolBuffer = Socket->SharedData.Listening; Buffer = &BoolBuffer; - BufferSize = sizeof(BOOLEAN); + BufferSize = sizeof(BOOL); break; case SO_BROADCAST: BoolBuffer = Socket->SharedData.Broadcast; Buffer = &BoolBuffer; - BufferSize = sizeof(BOOLEAN); + BufferSize = sizeof(BOOL); break; case SO_DEBUG: BoolBuffer = Socket->SharedData.Debug; Buffer = &BoolBuffer; - BufferSize = sizeof(BOOLEAN); + BufferSize = sizeof(BOOL); + break; + + case SO_DONTLINGER: + BoolBuffer = (Socket->SharedData.LingerData.l_onoff == 0); + Buffer = &BoolBuffer; + BufferSize = sizeof(BOOL); + break; + + case SO_LINGER: + Buffer = &Socket->SharedData.LingerData; + BufferSize = sizeof(struct linger); break; /* case SO_CONDITIONAL_ACCEPT: */ - case SO_DONTLINGER: case SO_DONTROUTE: case SO_ERROR: case SO_GROUP_ID: case SO_GROUP_PRIORITY: case SO_KEEPALIVE: - case SO_LINGER: case SO_MAX_MSG_SIZE: case SO_OOBINLINE: case SO_PROTOCOL_INFO: @@ -2105,8 +2162,36 @@ WSPSetSockOpt( switch (optname) { case SO_BROADCAST: + if (optlen < sizeof(BOOL)) + { + *lpErrno = WSAEFAULT; + return SOCKET_ERROR; + } Socket->SharedData.Broadcast = (*optval != 0) ? 1 : 0; return 0; + + case SO_DONTLINGER: + if (optlen < sizeof(BOOL)) + { + *lpErrno = WSAEFAULT; + return SOCKET_ERROR; + } + Socket->SharedData.LingerData.l_onoff = (*optval != 0) ? 0 : 1; + return 0; + + case SO_LINGER: + if (optlen < sizeof(struct linger)) + { + *lpErrno = WSAEFAULT; + return SOCKET_ERROR; + } + RtlCopyMemory(&Socket->SharedData.LingerData, + optval, + sizeof(struct linger)); + return 0; + + default: + break; } } @@ -2214,6 +2299,7 @@ WSPCleanup(OUT LPINT lpErrno) int GetSocketInformation(PSOCKET_INFORMATION Socket, ULONG AfdInformationClass, + PBOOLEAN Boolean OPTIONAL, PULONG Ulong OPTIONAL, PLARGE_INTEGER LargeInteger OPTIONAL) { @@ -2265,6 +2351,10 @@ GetSocketInformation(PSOCKET_INFORMATION Socket, { *LargeInteger = InfoData.Information.LargeInteger; } + if (Boolean != NULL) + { + *Boolean = InfoData.Information.Boolean; + } NtClose( SockEvent ); @@ -2275,7 +2365,8 @@ GetSocketInformation(PSOCKET_INFORMATION Socket, int SetSocketInformation(PSOCKET_INFORMATION Socket, - ULONG AfdInformationClass, + ULONG AfdInformationClass, + PBOOLEAN Boolean OPTIONAL, PULONG Ulong OPTIONAL, PLARGE_INTEGER LargeInteger OPTIONAL) { @@ -2305,9 +2396,10 @@ SetSocketInformation(PSOCKET_INFORMATION Socket, { InfoData.Information.LargeInteger = *LargeInteger; } - - AFD_DbgPrint(MID_TRACE,("XXX Info %x (Data %x)\n", - AfdInformationClass, *Ulong)); + if (Boolean != NULL) + { + InfoData.Information.Boolean = *Boolean; + } /* Send IOCTL */ Status = NtDeviceIoControlFile((HANDLE)Socket->Handle, diff --git a/dll/win32/msafd/misc/event.c b/dll/win32/msafd/misc/event.c index a1dc8766148..a69ee2e3a3c 100644 --- a/dll/win32/msafd/misc/event.c +++ b/dll/win32/msafd/misc/event.c @@ -12,8 +12,6 @@ #include -#include - int WSPAPI WSPEventSelect( @@ -26,7 +24,7 @@ WSPEventSelect( AFD_EVENT_SELECT_INFO EventSelectInfo; PSOCKET_INFORMATION Socket = NULL; NTSTATUS Status; - ULONG BlockMode; + BOOLEAN BlockMode; HANDLE SockEvent; Status = NtCreateEvent( &SockEvent, GENERIC_READ | GENERIC_WRITE, @@ -44,8 +42,8 @@ WSPEventSelect( } /* Set Socket to Non-Blocking */ - BlockMode = 1; - SetSocketInformation(Socket, AFD_INFO_BLOCKING_MODE, &BlockMode, NULL); + BlockMode = TRUE; + SetSocketInformation(Socket, AFD_INFO_BLOCKING_MODE, &BlockMode, NULL, NULL); Socket->SharedData.NonBlocking = TRUE; /* Deactivate Async Select if there is one */ diff --git a/dll/win32/msafd/misc/helpers.c b/dll/win32/msafd/misc/helpers.c index 89b1d6ac869..3ec0f97b3dd 100644 --- a/dll/win32/msafd/misc/helpers.c +++ b/dll/win32/msafd/misc/helpers.c @@ -11,8 +11,6 @@ */ #include -#include - CRITICAL_SECTION HelperDLLDatabaseLock; LIST_ENTRY HelperDLLDatabaseListHead; diff --git a/dll/win32/msafd/misc/sndrcv.c b/dll/win32/msafd/misc/sndrcv.c index 557fdae910e..efea9afedf4 100644 --- a/dll/win32/msafd/misc/sndrcv.c +++ b/dll/win32/msafd/misc/sndrcv.c @@ -12,8 +12,6 @@ #include -#include - INT WSPAPI WSPAsyncSelect(IN SOCKET Handle, @@ -25,7 +23,7 @@ WSPAsyncSelect(IN SOCKET Handle, PSOCKET_INFORMATION Socket = NULL; PASYNC_DATA AsyncData; NTSTATUS Status; - ULONG BlockMode; + BOOLEAN BlockMode; /* Get the Socket Structure associated to this Socket */ Socket = GetSocketStructure(Handle); @@ -44,8 +42,8 @@ WSPAsyncSelect(IN SOCKET Handle, } /* Change the Socket to Non Blocking */ - BlockMode = 1; - SetSocketInformation(Socket, AFD_INFO_BLOCKING_MODE, &BlockMode, NULL); + BlockMode = TRUE; + SetSocketInformation(Socket, AFD_INFO_BLOCKING_MODE, &BlockMode, NULL, NULL); Socket->SharedData.NonBlocking = TRUE; /* Deactive WSPEventSelect */ @@ -280,6 +278,20 @@ WSPRecvFrom(SOCKET Handle, *lpErrno = WSAENOTSOCK; return SOCKET_ERROR; } + + if (!(Socket->SharedData.ServiceFlags1 & XP1_CONNECTIONLESS)) + { + /* Call WSPRecv for a non-datagram socket */ + return WSPRecv(Handle, + lpBuffers, + dwBufferCount, + lpNumberOfBytesRead, + ReceiveFlags, + lpOverlapped, + lpCompletionRoutine, + lpThreadId, + lpErrno); + } Status = NtCreateEvent( &SockEvent, GENERIC_READ | GENERIC_WRITE, NULL, 1, FALSE ); @@ -388,7 +400,14 @@ WSPRecvFrom(SOCKET Handle, } /* Re-enable Async Event */ - SockReenableAsyncSelectEvent(Socket, FD_READ); + if (*ReceiveFlags & MSG_OOB) + { + SockReenableAsyncSelectEvent(Socket, FD_OOB); + } + else + { + SockReenableAsyncSelectEvent(Socket, FD_READ); + } return MsafdReturnWithErrno ( Status, lpErrno, IOSB->Information, lpNumberOfBytesRead ); } @@ -552,6 +571,20 @@ WSPSendTo(SOCKET Handle, *lpErrno = WSAENOTSOCK; return SOCKET_ERROR; } + + if (!(Socket->SharedData.ServiceFlags1 & XP1_CONNECTIONLESS)) + { + /* Use WSPSend for connection-oriented sockets */ + return WSPSend(Handle, + lpBuffers, + dwBufferCount, + lpNumberOfBytesSent, + iFlags, + lpOverlapped, + lpCompletionRoutine, + lpThreadId, + lpErrno); + } /* Bind us First */ if (Socket->SharedData.State == SocketOpen) @@ -667,8 +700,7 @@ WSPSendTo(SOCKET Handle, HeapFree(GlobalHeap, 0, BindAddress); } - if (Status != STATUS_PENDING) - SockReenableAsyncSelectEvent(Socket, FD_WRITE); + SockReenableAsyncSelectEvent(Socket, FD_WRITE); return MsafdReturnWithErrno(Status, lpErrno, IOSB->Information, lpNumberOfBytesSent); } diff --git a/dll/win32/msafd/misc/stubs.c b/dll/win32/msafd/misc/stubs.c index 5a9da712616..c1cfc4df08e 100644 --- a/dll/win32/msafd/misc/stubs.c +++ b/dll/win32/msafd/misc/stubs.c @@ -9,8 +9,6 @@ */ #include -#include - INT WSPAPI WSPAddressToString( diff --git a/dll/win32/msafd/msafd.h b/dll/win32/msafd/msafd.h index 52027581d0b..d26cca9d351 100644 --- a/dll/win32/msafd/msafd.h +++ b/dll/win32/msafd/msafd.h @@ -15,7 +15,10 @@ #include #include #define NTOS_MODE_USER -#include +#include +#include +#include +#include /* This includes ntsecapi.h so it needs to come after the NDK */ #include @@ -23,6 +26,8 @@ #include #include +#include + extern HANDLE GlobalHeap; extern WSPUPCALLTABLE Upcalls; extern LPWPUCOMPLETEOVERLAPPEDREQUEST lpWPUCompleteOverlappedRequest; @@ -417,14 +422,16 @@ VOID DeleteSocketStructure( SOCKET Handle ); int GetSocketInformation( PSOCKET_INFORMATION Socket, ULONG AfdInformationClass, - PULONG Ulong OPTIONAL, + PBOOLEAN Boolean OPTIONAL, + PULONG Ulong OPTIONAL, PLARGE_INTEGER LargeInteger OPTIONAL ); int SetSocketInformation( PSOCKET_INFORMATION Socket, ULONG AfdInformationClass, - PULONG Ulong OPTIONAL, + PBOOLEAN Boolean OPTIONAL, + PULONG Ulong OPTIONAL, PLARGE_INTEGER LargeInteger OPTIONAL ); diff --git a/dll/win32/mscms/CMakeLists.txt b/dll/win32/mscms/CMakeLists.txt index 8b3f6d9e74c..0be83686493 100644 --- a/dll/win32/mscms/CMakeLists.txt +++ b/dll/win32/mscms/CMakeLists.txt @@ -18,8 +18,8 @@ list(APPEND SOURCE ${CMAKE_CURRENT_BINARY_DIR}/mscms.def) add_library(mscms SHARED ${SOURCE}) - set_module_type(mscms win32dll) target_link_libraries(mscms wine) add_importlibs(mscms msvcrt advapi32 kernel32 ntdll) +add_pch(mscms mscms_priv.h) add_cd_file(TARGET mscms DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/mscms/mscms.rbuild b/dll/win32/mscms/mscms.rbuild index 5afe2342938..838302033ac 100644 --- a/dll/win32/mscms/mscms.rbuild +++ b/dll/win32/mscms/mscms.rbuild @@ -10,6 +10,7 @@ stub.c transform.c version.rc + mscms_priv.h wine advapi32 ntdll diff --git a/dll/win32/msctf/CMakeLists.txt b/dll/win32/msctf/CMakeLists.txt index 634e00dde1c..b4ec9dfdc3b 100644 --- a/dll/win32/msctf/CMakeLists.txt +++ b/dll/win32/msctf/CMakeLists.txt @@ -1,7 +1,5 @@ -add_definitions( - -D__WINESRC__ - -D_DLL -D__USE_CRTIMP) +add_definitions(-D__WINESRC__) remove_definitions(-D_WIN32_WINNT=0x502) add_definitions(-D_WIN32_WINNT=0x600) @@ -31,7 +29,6 @@ list(APPEND SOURCE add_library(msctf SHARED ${SOURCE}) set_module_type(msctf win32dll) - target_link_libraries(msctf uuid wine) add_importlibs(msctf ole32 oleaut32 user32 advapi32 msvcrt kernel32 ntdll) add_cd_file(TARGET msctf DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/msg711.acm/CMakeLists.txt b/dll/win32/msg711.acm/CMakeLists.txt index 6f6deeb3192..4ffcd516a7c 100644 --- a/dll/win32/msg711.acm/CMakeLists.txt +++ b/dll/win32/msg711.acm/CMakeLists.txt @@ -1,8 +1,5 @@ -add_definitions( - -D_DLL -D__USE_CRTIMP - -D__WINESRC__) - +add_definitions(-D__WINESRC__) include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine) spec2def(msg711.acm msg711.acm.spec) @@ -15,7 +12,6 @@ add_library(msg711.acm SHARED ${SOURCE}) set_entrypoint(msg711.acm 0) set_target_properties(msg711.acm PROPERTIES SUFFIX "") - target_link_libraries(msg711.acm wine) add_importlibs(msg711.acm winmm user32 msvcrt kernel32 ntdll) add_dependencies(msg711.acm psdk) diff --git a/dll/win32/msgina/CMakeLists.txt b/dll/win32/msgina/CMakeLists.txt index 61071b9a646..17a98b30540 100644 --- a/dll/win32/msgina/CMakeLists.txt +++ b/dll/win32/msgina/CMakeLists.txt @@ -17,8 +17,8 @@ list(APPEND SOURCE ${CMAKE_CURRENT_BINARY_DIR}/msgina.def) add_library(msgina SHARED ${SOURCE}) - set_module_type(msgina win32dll) target_link_libraries(msgina wine) add_importlibs(msgina advapi32 user32 gdi32 userenv msvcrt kernel32 ntdll) +add_pch(msgina msgina.h) add_cd_file(TARGET msgina DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/msgina/gui.c b/dll/win32/msgina/gui.c index 6677a29bf68..06e40aa0f26 100644 --- a/dll/win32/msgina/gui.c +++ b/dll/win32/msgina/gui.c @@ -7,8 +7,6 @@ #include "msgina.h" -#include - WINE_DEFAULT_DEBUG_CHANNEL(msgina); typedef struct _DISPLAYSTATUSMSG diff --git a/dll/win32/msgina/lang/pl-PL.rc b/dll/win32/msgina/lang/pl-PL.rc index 8c33319d571..e84685e5ce8 100644 --- a/dll/win32/msgina/lang/pl-PL.rc +++ b/dll/win32/msgina/lang/pl-PL.rc @@ -1,15 +1,16 @@ /* * translated by TestamenT - * testament@users.sourceforge.net - * https://sourceforge.net/projects/reactospl - * + * testament@users.sourceforge.net + * https://sourceforge.net/projects/reactospl + * UTF-8 conversion by Caemyr (May, 2011) */ + LANGUAGE LANG_POLISH, SUBLANG_DEFAULT IDD_STATUSWINDOW_DLG DIALOGEX 0,0,274,26 STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP -CAPTION "Prosz czeka..." +CAPTION "Proszę czekać..." FONT 8,"MS Shell Dlg",400,0,1 BEGIN LTEXT "",IDC_STATUSLABEL,7,8,234,12,SS_WORDELLIPSIS @@ -21,7 +22,7 @@ CAPTION "Witamy w ReactOS" FONT 8,"MS Shell Dlg",400,0,1 BEGIN ICON IDI_LOCKICON, -1, 7, 5, 32, 32 - LTEXT "Prosz wcisn kombinacj klawiszy Ctrl-Alt-Del",IDC_STATIC, 37, 6, 144, 18 + LTEXT "Proszę wcisnąć kombinację klawiszy Ctrl-Alt-Del",IDC_STATIC, 37, 6, 144, 18 END IDD_LOGGEDOUT_DLG DIALOGEX 0,0,275,147 @@ -30,26 +31,26 @@ CAPTION "Logon" FONT 8,"MS Shell Dlg",400,0,1 BEGIN CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,275,59 - LTEXT "Nazwa uytkownika:",IDC_STATIC, 11, 75, 70, 8 + LTEXT "Nazwa użytkownika:",IDC_STATIC, 11, 75, 70, 8 EDITTEXT IDC_USERNAME,84,72,119,14,ES_AUTOHSCROLL - LTEXT "Haso:",IDC_STATIC, 56, 93, 27, 8 + LTEXT "Hasło:",IDC_STATIC, 56, 93, 27, 8 EDITTEXT IDC_PASSWORD,84,91,119,14,ES_AUTOHSCROLL | ES_PASSWORD PUSHBUTTON "OK",IDOK,51,122,50,14,BS_DEFPUSHBUTTON PUSHBUTTON "Anuluj",IDCANCEL,115,122,50,14 - PUSHBUTTON "Wycz",IDC_SHUTDOWN,179,122,50,14 + PUSHBUTTON "Wyłącz",IDC_SHUTDOWN,179,122,50,14 END IDD_LOGGEDON_DLG DIALOGEX 0,0,247,116 STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP | WS_SYSMENU -CAPTION "Bezpieczestwo" +CAPTION "Bezpieczeństwo" FONT 8,"MS Shell Dlg",400,0,1 BEGIN CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,247,53 - LTEXT "Co chcesz teraz zrobi?",IDC_STATIC,86,60,87,8 + LTEXT "Co chcesz teraz zrobić?",IDC_STATIC,86,60,87,8 PUSHBUTTON "Blokada komputera",IDC_LOCK,10,76,70,14 PUSHBUTTON "Wyloguj",IDC_LOGOFF,90,76,70,14 - PUSHBUTTON "Wycz",IDC_SHUTDOWN,170,76,70,14 - PUSHBUTTON "Meneder zada",IDC_TASKMGR,90,95,70,14 + PUSHBUTTON "Wyłącz",IDC_SHUTDOWN,170,76,70,14 + PUSHBUTTON "Menedżer zadań",IDC_TASKMGR,90,95,70,14 PUSHBUTTON "Anuluj",IDCANCEL,170,95,70,14 END @@ -57,8 +58,8 @@ STRINGTABLE BEGIN IDS_LOGGEDOUTSAS "Witaj!" IDS_LOCKEDSAS "Aktualnie komputer jest zablokowany." - IDS_PRESSCTRLALTDELETE "Wcinij Control-Alt-Delete aby si zalogowa." - IDS_ASKFORUSER "Nazwa uytkownika: " - IDS_ASKFORPASSWORD "Haso: " - IDS_FORCELOGOFF "To wyloguje aktualnego uytkownika i straci on wszystkie niezapisane dane. Kontynuowa?" + IDS_PRESSCTRLALTDELETE "Wciśnij Control-Alt-Delete aby się zalogować." + IDS_ASKFORUSER "Nazwa użytkownika: " + IDS_ASKFORPASSWORD "Hasło: " + IDS_FORCELOGOFF "To wyloguje aktualnego użytkownika i straci on wszystkie niezapisane dane. Kontynuować?" END diff --git a/dll/win32/msgina/lang/ro-RO.rc b/dll/win32/msgina/lang/ro-RO.rc index 6eae821cfe9..78410fa4595 100644 --- a/dll/win32/msgina/lang/ro-RO.rc +++ b/dll/win32/msgina/lang/ro-RO.rc @@ -1,7 +1,5 @@ LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL -#pragma code_page(65001) - IDD_STATUSWINDOW_DLG DIALOGEX 0,0,274,26 STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP CAPTION "Va rugam a?tepta?i..." @@ -57,5 +55,3 @@ BEGIN IDS_ASKFORPASSWORD "Parola: " IDS_FORCELOGOFF "Aceasta ac?iune va închide sesiunea utilizatorului curent ?i va pierde datele nesalvate de acesta. Sigur continua?i?" END - -#pragma code_page(default) diff --git a/dll/win32/msgina/lang/ru-RU.rc b/dll/win32/msgina/lang/ru-RU.rc index d795535b54b..9c25b94d9fc 100644 --- a/dll/win32/msgina/lang/ru-RU.rc +++ b/dll/win32/msgina/lang/ru-RU.rc @@ -4,7 +4,7 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT IDD_STATUSWINDOW_DLG DIALOGEX 0,0,274,26 STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP -CAPTION " ..." +CAPTION "Пожалуйста подождите..." FONT 8,"MS Shell Dlg",400,0,1 BEGIN LTEXT "",IDC_STATUSLABEL,7,8,234,12,SS_WORDELLIPSIS @@ -12,48 +12,48 @@ END IDD_NOTICE_DLG DIALOGEX 0, 0, 186, 32 STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP -CAPTION " ReactOS" +CAPTION "Добро пожаловать в ReactOS" FONT 8,"MS Shell Dlg",400,0,1 BEGIN ICON IDI_LOCKICON, -1, 7, 5, 32, 32 - LTEXT " Ctrl-Alt-Del.",IDC_STATIC, 38, 10, 144, 14 + LTEXT "Нажмите клавиши Ctrl-Alt-Del.",IDC_STATIC, 38, 10, 144, 14 END IDD_LOGGEDOUT_DLG DIALOGEX 0,0,275,147 STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP -CAPTION "" +CAPTION "Вход" FONT 8,"MS Shell Dlg",400,0,1 BEGIN CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,275,59 - RTEXT " :", IDC_STATIC, 6, 75, 70, 8 + RTEXT "Имя пользователя:", IDC_STATIC, 6, 75, 70, 8 EDITTEXT IDC_USERNAME,84,72,119,14,ES_AUTOHSCROLL - RTEXT ":", IDC_STATIC, 6, 93, 70, 8 + RTEXT "Пароль:", IDC_STATIC, 6, 93, 70, 8 EDITTEXT IDC_PASSWORD,84,91,119,14,ES_AUTOHSCROLL | ES_PASSWORD PUSHBUTTON "OK", IDOK, 47, 122, 50, 14, BS_DEFPUSHBUTTON - PUSHBUTTON "", IDCANCEL, 109, 122, 50, 14 - PUSHBUTTON "", IDC_SHUTDOWN, 171, 122, 58, 14 + PUSHBUTTON "Отмена", IDCANCEL, 109, 122, 50, 14 + PUSHBUTTON "Выключение", IDC_SHUTDOWN, 171, 122, 58, 14 END IDD_LOGGEDON_DLG DIALOGEX 0, 0, 275, 116 STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP | WS_SYSMENU -CAPTION "" +CAPTION "Безопасность" FONT 8,"MS Shell Dlg",400,0,1 BEGIN CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,247,53 - LTEXT " :", IDC_STATIC, 7, 60, 123, 8 - PUSHBUTTON "", IDC_LOCK, 7, 76, 86, 14 - PUSHBUTTON " ", IDC_LOGOFF, 102, 76, 86, 14 - PUSHBUTTON "",IDC_SHUTDOWN, 198, 76, 70, 14 - PUSHBUTTON " ",IDC_TASKMGR, 102, 95, 86, 14 - PUSHBUTTON "", IDCANCEL, 198, 95, 70, 14 + LTEXT "Выберите необходимое действие:", IDC_STATIC, 7, 60, 123, 8 + PUSHBUTTON "Заблокировать", IDC_LOCK, 7, 76, 86, 14 + PUSHBUTTON "Завершение сеанса", IDC_LOGOFF, 102, 76, 86, 14 + PUSHBUTTON "Выключение",IDC_SHUTDOWN, 198, 76, 70, 14 + PUSHBUTTON "Диспетчер задач",IDC_TASKMGR, 102, 95, 86, 14 + PUSHBUTTON "Отмена", IDCANCEL, 198, 95, 70, 14 END STRINGTABLE BEGIN - IDS_LOGGEDOUTSAS " !" - IDS_LOCKEDSAS " ." - IDS_PRESSCTRLALTDELETE " Control+Alt+Delete ." - IDS_ASKFORUSER " : " - IDS_ASKFORPASSWORD ": " - IDS_FORCELOGOFF " . ?" + IDS_LOGGEDOUTSAS "Добро пожаловать!" + IDS_LOCKEDSAS "Этот компьютер сейчас заблокирован." + IDS_PRESSCTRLALTDELETE "Нажмите клавиши Control+Alt+Delete для входа." + IDS_ASKFORUSER "Имя пользователя: " + IDS_ASKFORPASSWORD "Пароль: " + IDS_FORCELOGOFF "При регистрации нового пользователя все несохраненные данные будут утеряны. Продолжить?" END diff --git a/dll/win32/msgina/lang/uk-UA.rc b/dll/win32/msgina/lang/uk-UA.rc index 0fa79c3b624..ffffcb84511 100644 --- a/dll/win32/msgina/lang/uk-UA.rc +++ b/dll/win32/msgina/lang/uk-UA.rc @@ -10,7 +10,7 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT IDD_STATUSWINDOW_DLG DIALOGEX 0,0,274,26 STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP -CAPTION "..." +CAPTION "Зачекайте..." FONT 8,"MS Shell Dlg",400,0,1 BEGIN LTEXT "",IDC_STATUSLABEL,7,8,234,12,SS_WORDELLIPSIS @@ -18,48 +18,48 @@ END IDD_NOTICE_DLG DIALOGEX 0, 0, 186, 32 STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP -CAPTION " ReactOS" +CAPTION "Ласкаво просимо до ReactOS" FONT 8,"MS Shell Dlg",400,0,1 BEGIN ICON IDI_LOCKICON, -1, 7, 5, 32, 32 - LTEXT " Ctrl+Alt+Del",IDC_STATIC, 38, 10, 144, 14 + LTEXT "Натисніть клавіші Ctrl+Alt+Del",IDC_STATIC, 38, 10, 144, 14 END IDD_LOGGEDOUT_DLG DIALOGEX 0,0,275,147 STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP -CAPTION "" +CAPTION "Вхід" FONT 8,"MS Shell Dlg",400,0,1 BEGIN CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,275,59 - LTEXT ":",IDC_STATIC,33, 75, 48, 8 + LTEXT "Користувач:",IDC_STATIC,33, 75, 48, 8 EDITTEXT IDC_USERNAME,84,72,119,14,ES_AUTOHSCROLL - LTEXT ":",IDC_STATIC,48, 93, 34, 8 + LTEXT "Пароль:",IDC_STATIC,48, 93, 34, 8 EDITTEXT IDC_PASSWORD,84,91,119,14,ES_AUTOHSCROLL | ES_PASSWORD PUSHBUTTON "OK",IDOK,37, 122, 50, 14,BS_DEFPUSHBUTTON - PUSHBUTTON "",IDCANCEL,93, 122, 50, 14 - PUSHBUTTON " ...",IDC_SHUTDOWN,148, 122, 86, 14 + PUSHBUTTON "Скасувати",IDCANCEL,93, 122, 50, 14 + PUSHBUTTON "Завершення роботи...",IDC_SHUTDOWN,148, 122, 86, 14 END IDD_LOGGEDON_DLG DIALOGEX 0, 0, 257, 116 STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP | WS_SYSMENU -CAPTION "" +CAPTION "Безпека" FONT 8,"MS Shell Dlg",400,0,1 BEGIN CONTROL IDI_ROSLOGO,IDC_ROSLOGO,"Static",SS_BITMAP,0,0,247,53 - LTEXT " ?",IDC_STATIC, 86, 60, 87, 8 - PUSHBUTTON "",IDC_LOCK, 6, 76, 70, 14 - PUSHBUTTON " ...",IDC_LOGOFF, 80, 76, 80, 14 - PUSHBUTTON " ...",IDC_SHUTDOWN, 165, 76, 86, 14 - PUSHBUTTON " ",IDC_TASKMGR, 80, 95, 80, 14 - PUSHBUTTON "",IDCANCEL, 165, 95, 86, 14 + LTEXT "Що Ви хочете зробити?",IDC_STATIC, 86, 60, 87, 8 + PUSHBUTTON "Блокування",IDC_LOCK, 6, 76, 70, 14 + PUSHBUTTON "Вихід із системи...",IDC_LOGOFF, 80, 76, 80, 14 + PUSHBUTTON "Завершення роботи...",IDC_SHUTDOWN, 165, 76, 86, 14 + PUSHBUTTON "Диспетчер завдань",IDC_TASKMGR, 80, 95, 80, 14 + PUSHBUTTON "Скасувати",IDCANCEL, 165, 95, 86, 14 END STRINGTABLE BEGIN - IDS_LOGGEDOUTSAS " !" - IDS_LOCKEDSAS " ' ." - IDS_PRESSCTRLALTDELETE " Press Control+Alt+Delete ." - IDS_ASKFORUSER ": " - IDS_ASKFORPASSWORD ": " - IDS_FORCELOGOFF " . ?" + IDS_LOGGEDOUTSAS "Ласкаво просимо!" + IDS_LOCKEDSAS "Цей комп'ютер зараз заблокований." + IDS_PRESSCTRLALTDELETE "Натисніть клавіші Press Control+Alt+Delete для входу." + IDS_ASKFORUSER "Користувач: " + IDS_ASKFORPASSWORD "Пароль: " + IDS_FORCELOGOFF "Це завершить сеанс поточного користувача і всі незбережені дані будуть загублені. Продовжити?" END diff --git a/dll/win32/msgina/msgina.c b/dll/win32/msgina/msgina.c index 02c619d3e32..d2620475112 100644 --- a/dll/win32/msgina/msgina.c +++ b/dll/win32/msgina/msgina.c @@ -26,8 +26,6 @@ #include "msgina.h" -#include - WINE_DEFAULT_DEBUG_CHANNEL(msgina); HINSTANCE hDllInstance; diff --git a/dll/win32/msgina/msgina.h b/dll/win32/msgina/msgina.h index 906681542dc..e221b3b8e3d 100644 --- a/dll/win32/msgina/msgina.h +++ b/dll/win32/msgina/msgina.h @@ -1,8 +1,9 @@ -#pragma once - #include #include #include + +#include + #include "resource.h" /* Values for GINA_CONTEXT.AutoLogonState */ diff --git a/dll/win32/msgina/msgina.rbuild b/dll/win32/msgina/msgina.rbuild index 1f21595c6e5..ea5077ab3a1 100644 --- a/dll/win32/msgina/msgina.rbuild +++ b/dll/win32/msgina/msgina.rbuild @@ -14,4 +14,5 @@ stubs.c tui.c msgina.rc + msgina.h diff --git a/dll/win32/msgina/msgina.rc b/dll/win32/msgina/msgina.rc index 373041828ee..4e3a9510d8f 100644 --- a/dll/win32/msgina/msgina.rc +++ b/dll/win32/msgina/msgina.rc @@ -13,15 +13,18 @@ IDI_LOCKICON ICON "resources/21.ico" #include "lang/bg-BG.rc" #include "lang/cs-CZ.rc" #include "lang/en-US.rc" +#include "lang/es-ES.rc" #include "lang/de-DE.rc" #include "lang/fr-FR.rc" #include "lang/id-ID.rc" #include "lang/it-IT.rc" #include "lang/ja-JP.rc" #include "lang/no-NO.rc" +#include "lang/sk-SK.rc" + +// UTF-8 +#pragma code_page(65001) #include "lang/pl-PL.rc" #include "lang/ro-RO.rc" #include "lang/ru-RU.rc" -#include "lang/sk-SK.rc" #include "lang/uk-UA.rc" -#include "lang/es-ES.rc" diff --git a/dll/win32/msgina/stubs.c b/dll/win32/msgina/stubs.c index 436c6d7b670..951380c6764 100644 --- a/dll/win32/msgina/stubs.c +++ b/dll/win32/msgina/stubs.c @@ -9,10 +9,8 @@ * UPDATE HISTORY: * 24-11-2003 Created */ -#include -#include -#include +#include "msgina.h" WINE_DEFAULT_DEBUG_CHANNEL(msgina); diff --git a/dll/win32/msgina/tui.c b/dll/win32/msgina/tui.c index 2a88388cf52..a94393a97a9 100644 --- a/dll/win32/msgina/tui.c +++ b/dll/win32/msgina/tui.c @@ -7,8 +7,6 @@ #include "msgina.h" -#include - WINE_DEFAULT_DEBUG_CHANNEL(msgina); static BOOL diff --git a/dll/win32/msgsm32.acm/CMakeLists.txt b/dll/win32/msgsm32.acm/CMakeLists.txt index 1de7b02958c..d5fadf4b1c2 100644 --- a/dll/win32/msgsm32.acm/CMakeLists.txt +++ b/dll/win32/msgsm32.acm/CMakeLists.txt @@ -1,8 +1,5 @@ -add_definitions( - -D_DLL -D__USE_CRTIMP - -D__WINESRC__) - +add_definitions(-D__WINESRC__) include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine) spec2def(msgsm32.acm msgsm32.acm.spec) @@ -15,9 +12,7 @@ add_library(msgsm32.acm SHARED ${SOURCE}) set_entrypoint(msgsm32.acm 0) set_target_properties(msgsm32.acm PROPERTIES SUFFIX "") - target_link_libraries(msgsm32.acm wine) - add_importlibs(msgsm32.acm winmm user32 msvcrt kernel32 ntdll) add_dependencies(msgsm32.acm psdk) add_cd_file(TARGET msgsm32.acm DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/mshtml.tlb/CMakeLists.txt b/dll/win32/mshtml.tlb/CMakeLists.txt index 9645d148f3c..01e7364085c 100644 --- a/dll/win32/mshtml.tlb/CMakeLists.txt +++ b/dll/win32/mshtml.tlb/CMakeLists.txt @@ -1,6 +1,6 @@ -add_typelib(mshtml_tlb mshtml_tlb.idl) -add_dependencies(mshtml_tlb stdole2) +add_typelib(mshtml__tlb mshtml_tlb.idl) +add_dependencies(mshtml__tlb stdole2) add_definitions(-D__WINESRC__) @@ -10,5 +10,5 @@ add_library(mshtml.tlb SHARED rsrc.rc) set_entrypoint(mshtml.tlb 0) set_target_properties(mshtml.tlb PROPERTIES SUFFIX "") -add_dependencies(mshtml.tlb mshtml_tlb) +add_dependencies(mshtml.tlb mshtml__tlb) add_cd_file(TARGET mshtml.tlb DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/mshtml/CMakeLists.txt b/dll/win32/mshtml/CMakeLists.txt index 4f174ee0bca..d91ec8a769f 100644 --- a/dll/win32/mshtml/CMakeLists.txt +++ b/dll/win32/mshtml/CMakeLists.txt @@ -2,11 +2,7 @@ remove_definitions(-D_WIN32_WINNT=0x502) add_definitions(-D_WIN32_WINNT=0x600) -add_definitions( - -D__WINESRC__ - -D_DLL - -D__USE_CRTIMP) - +add_definitions(-D__WINESRC__) include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine) add_idl_Headers(mshtml_nsiface_header nsiface.idl) diff --git a/dll/win32/msi/CMakeLists.txt b/dll/win32/msi/CMakeLists.txt index c7d217c2906..a639493311e 100644 --- a/dll/win32/msi/CMakeLists.txt +++ b/dll/win32/msi/CMakeLists.txt @@ -1,4 +1,6 @@ +if(NOT MSVC) + include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine) add_definitions(-D__WINESRC__ -DMSIRUNMODE=MSIRUNMODE_T) @@ -14,7 +16,7 @@ list(APPEND SOURCE action.c alter.c appsearch.c - assembly.c + assembly.c automation.c classes.c cond.tab.c @@ -68,13 +70,9 @@ endif() add_library(msi SHARED ${SOURCE}) add_idl_Headers(msi_idlheader msiserver.idl) - add_typelib(msi_tlb msiserver.idl) - set_module_type(msi win32dll) - target_link_libraries(msi uuid ${PSEH_LIB} wine) - add_dependencies(msi msi_idlheader msi_tlb) add_importlibs(msi @@ -95,5 +93,9 @@ add_importlibs(msi kernel32 ntdll) +add_pch(msi msipriv.h) add_cd_file(TARGET msi DESTINATION reactos/system32 FOR all) + +endif(NOT MSVC) + add_importlib_target(msi.spec) diff --git a/dll/win32/msi/msi.rbuild b/dll/win32/msi/msi.rbuild index 4dd17cc0655..d71529f2f0e 100644 --- a/dll/win32/msi/msi.rbuild +++ b/dll/win32/msi/msi.rbuild @@ -54,6 +54,7 @@ upgrade.c where.c msi.rc + msipriv.h . wine uuid diff --git a/dll/win32/msi/msiserver.idl b/dll/win32/msi/msiserver.idl index 58c5b3cf99f..262be4919bb 100644 --- a/dll/win32/msi/msiserver.idl +++ b/dll/win32/msi/msiserver.idl @@ -23,6 +23,12 @@ import "wtypes.idl"; import "objidl.idl"; import "oaidl.idl"; +#ifndef __WIDL__ +#define threading(model) +#define progid(str) +#define vi_progid(str) +#endif + cpp_quote("#if 0") typedef unsigned long MSIHANDLE; typedef int INSTALLMESSAGE; diff --git a/dll/win32/msports/CMakeLists.txt b/dll/win32/msports/CMakeLists.txt index 8dfbd65f268..e9469bbddcd 100644 --- a/dll/win32/msports/CMakeLists.txt +++ b/dll/win32/msports/CMakeLists.txt @@ -7,17 +7,15 @@ list(APPEND SOURCE classinst.c comdb.c msports.c + serial.c msports.rc ${CMAKE_CURRENT_BINARY_DIR}/msports_stubs.c ${CMAKE_CURRENT_BINARY_DIR}/msports.def) add_library(msports SHARED ${SOURCE}) - set_module_type(msports win32dll) - target_link_libraries(msports wine) - -add_importlibs(msports setupapi advapi32 kernel32 ntdll) - +add_importlibs(msports setupapi comctl32 user32 advapi32 msvcrt kernel32 ntdll) +add_pch(msports precomp.h) add_cd_file(TARGET msports DESTINATION reactos/system32 FOR all) add_importlib_target(msports.spec) diff --git a/dll/win32/msports/classinst.c b/dll/win32/msports/classinst.c index 4502d5f2ca8..1d8933c369e 100644 --- a/dll/win32/msports/classinst.c +++ b/dll/win32/msports/classinst.c @@ -6,13 +6,7 @@ * PROGRAMMERS: Copyright 2011 Eric Kohl */ -#define WIN32_NO_STATUS -#include -#include -#include -#include -#include -#include +#include "precomp.h" WINE_DEFAULT_DEBUG_CHANNEL(msports); @@ -24,6 +18,9 @@ typedef enum _PORT_TYPE SerialPort } PORT_TYPE; +LPWSTR pszCom = L"COM"; +LPWSTR pszLpt = L"LPT"; + BOOL GetBootResourceList(HDEVINFO DeviceInfoSet, @@ -243,9 +240,12 @@ InstallSerialPort(IN HDEVINFO DeviceInfoSet, { WCHAR szDeviceDescription[256]; WCHAR szFriendlyName[256]; - WCHAR szPortName[5]; - DWORD dwPortNumber; + WCHAR szPortName[8]; + DWORD dwPortNumber = 0; + DWORD dwSize; HCOMDB hComDB = HCOMDB_INVALID_HANDLE_VALUE; + HKEY hKey; + LONG lError; TRACE("InstallSerialPort(%p, %p)\n", DeviceInfoSet, DeviceInfoData); @@ -253,12 +253,43 @@ InstallSerialPort(IN HDEVINFO DeviceInfoSet, /* Open the com port database */ ComDBOpen(&hComDB); - dwPortNumber = GetSerialPortNumber(DeviceInfoSet, - DeviceInfoData); + /* Try to read the 'PortName' value and determine the port number */ + hKey = SetupDiCreateDevRegKeyW(DeviceInfoSet, + DeviceInfoData, + DICS_FLAG_GLOBAL, + 0, + DIREG_DEV, + NULL, + NULL); + if (hKey != INVALID_HANDLE_VALUE) + { + dwSize = sizeof(szPortName); + lError = RegQueryValueEx(hKey, + L"PortName", + NULL, + NULL, + (PBYTE)szPortName, + &dwSize); + if (lError == ERROR_SUCCESS) + { + if (_wcsnicmp(szPortName, pszCom, wcslen(pszCom)) == 0) + { + dwPortNumber = _wtoi(szPortName + wcslen(pszCom)); + TRACE("COM port number found: %lu\n", dwPortNumber); + } + } + + RegCloseKey(hKey); + } + + /* Determine the port number from its resources ... */ + if (dwPortNumber == 0) + dwPortNumber = GetSerialPortNumber(DeviceInfoSet, + DeviceInfoData); + if (dwPortNumber != 0) { - swprintf(szPortName, L"COM%u", dwPortNumber); - + /* ... and claim the port number in the database */ ComDBClaimPort(hComDB, dwPortNumber, FALSE, @@ -266,13 +297,38 @@ InstallSerialPort(IN HDEVINFO DeviceInfoSet, } else { - wcscpy(szPortName, L"COMx"); + /* ... or claim the next free port number */ + ComDBClaimNextFreePort(hComDB, + &dwPortNumber); } + /* Build the name of the port device */ + swprintf(szPortName, L"%s%u", pszCom, dwPortNumber); + /* Close the com port database */ if (hComDB != HCOMDB_INVALID_HANDLE_VALUE) ComDBClose(hComDB); + /* Set the 'PortName' value */ + hKey = SetupDiCreateDevRegKeyW(DeviceInfoSet, + DeviceInfoData, + DICS_FLAG_GLOBAL, + 0, + DIREG_DEV, + NULL, + NULL); + if (hKey != INVALID_HANDLE_VALUE) + { + RegSetValueExW(hKey, + L"PortName", + 0, + REG_SZ, + (LPBYTE)szPortName, + (wcslen(szPortName) + 1) * sizeof(WCHAR)); + + RegCloseKey(hKey); + } + /* Install the device */ if (!SetupDiInstallDevice(DeviceInfoSet, DeviceInfoData)) @@ -280,6 +336,7 @@ InstallSerialPort(IN HDEVINFO DeviceInfoSet, return GetLastError(); } + /* Get the device description... */ if (SetupDiGetDeviceRegistryPropertyW(DeviceInfoSet, DeviceInfoData, SPDRP_DEVICEDESC, @@ -288,6 +345,7 @@ InstallSerialPort(IN HDEVINFO DeviceInfoSet, 256 * sizeof(WCHAR), NULL)) { + /* ... and use it to build a new friendly name */ swprintf(szFriendlyName, L"%s (%s)", szDeviceDescription, @@ -295,6 +353,7 @@ InstallSerialPort(IN HDEVINFO DeviceInfoSet, } else { + /* ... or build a generic friendly name */ swprintf(szFriendlyName, L"Serial Port (%s)", szPortName); @@ -317,23 +376,85 @@ InstallParallelPort(IN HDEVINFO DeviceInfoSet, { WCHAR szDeviceDescription[256]; WCHAR szFriendlyName[256]; - WCHAR szPortName[5]; - DWORD dwPortNumber; + WCHAR szPortName[8]; + DWORD dwPortNumber = 0; + DWORD dwSize; + LONG lError; + HKEY hKey; TRACE("InstallParallelPort(%p, %p)\n", DeviceInfoSet, DeviceInfoData); - dwPortNumber = GetParallelPortNumber(DeviceInfoSet, - DeviceInfoData); + /* Try to read the 'PortName' value and determine the port number */ + hKey = SetupDiCreateDevRegKeyW(DeviceInfoSet, + DeviceInfoData, + DICS_FLAG_GLOBAL, + 0, + DIREG_DEV, + NULL, + NULL); + if (hKey != INVALID_HANDLE_VALUE) + { + dwSize = sizeof(szPortName); + lError = RegQueryValueEx(hKey, + L"PortName", + NULL, + NULL, + (PBYTE)szPortName, + &dwSize); + if (lError == ERROR_SUCCESS) + { + if (_wcsnicmp(szPortName, pszLpt, wcslen(pszLpt)) == 0) + { + dwPortNumber = _wtoi(szPortName + wcslen(pszLpt)); + TRACE("LPT port number found: %lu\n", dwPortNumber); + } + } + + RegCloseKey(hKey); + } + + /* ... try to determine the port number from its resources */ + if (dwPortNumber == 0) + dwPortNumber = GetParallelPortNumber(DeviceInfoSet, + DeviceInfoData); + + if (dwPortNumber == 0) + { + /* FIXME */ + } + if (dwPortNumber != 0) { - swprintf(szPortName, L"LPT%u", dwPortNumber); + swprintf(szPortName, L"%s%u", pszLpt, dwPortNumber); } else { wcscpy(szPortName, L"LPTx"); } + if (dwPortNumber != 0) + { + /* Set the 'PortName' value */ + hKey = SetupDiCreateDevRegKeyW(DeviceInfoSet, + DeviceInfoData, + DICS_FLAG_GLOBAL, + 0, + DIREG_DEV, + NULL, + NULL); + if (hKey != INVALID_HANDLE_VALUE) + { + RegSetValueExW(hKey, + L"PortName", + 0, + REG_SZ, + (LPBYTE)szPortName, + (wcslen(szPortName) + 1) * sizeof(WCHAR)); + + RegCloseKey(hKey); + } + } /* Install the device */ if (!SetupDiInstallDevice(DeviceInfoSet, @@ -342,6 +463,7 @@ InstallParallelPort(IN HDEVINFO DeviceInfoSet, return GetLastError(); } + /* Get the device description... */ if (SetupDiGetDeviceRegistryPropertyW(DeviceInfoSet, DeviceInfoData, SPDRP_DEVICEDESC, @@ -350,6 +472,7 @@ InstallParallelPort(IN HDEVINFO DeviceInfoSet, 256 * sizeof(WCHAR), NULL)) { + /* ... and use it to build a new friendly name */ swprintf(szFriendlyName, L"%s (%s)", szDeviceDescription, @@ -357,8 +480,9 @@ InstallParallelPort(IN HDEVINFO DeviceInfoSet, } else { + /* ... or build a generic friendly name */ swprintf(szFriendlyName, - L"Serial Port (%s)", + L"Parallel Port (%s)", szPortName); } diff --git a/dll/win32/msports/comdb.c b/dll/win32/msports/comdb.c index efd927408f4..2db51d02b79 100644 --- a/dll/win32/msports/comdb.c +++ b/dll/win32/msports/comdb.c @@ -6,10 +6,7 @@ * COPYRIGHT: Copyright 2011 Eric Kohl */ -#include -#include - -#include +#include "precomp.h" WINE_DEFAULT_DEBUG_CHANNEL(msports); @@ -17,12 +14,110 @@ WINE_DEFAULT_DEBUG_CHANNEL(msports); typedef struct _COMDB { + HANDLE hMutex; HKEY hKey; - DWORD dwSize; - PBYTE pBitmap; } COMDB, *PCOMDB; +LONG +WINAPI +ComDBClaimNextFreePort(IN HCOMDB hComDB, + OUT LPDWORD ComNumber) +{ + PCOMDB pComDB; + DWORD dwBitIndex; + DWORD dwByteIndex; + DWORD dwSize; + DWORD dwType; + PBYTE pBitmap = NULL; + BYTE cMask; + LONG lError; + + TRACE("ComDBClaimNextFreePort(%p %p)\n", hComDB, ComNumber); + + if (hComDB == INVALID_HANDLE_VALUE || + hComDB == NULL || + ComNumber == NULL) + return ERROR_INVALID_PARAMETER; + + pComDB = (PCOMDB)hComDB; + + /* Wait for the mutex */ + WaitForSingleObject(pComDB->hMutex, INFINITE); + + /* Get the required bitmap size */ + lError = RegQueryValueExW(pComDB->hKey, + L"ComDB", + NULL, + &dwType, + NULL, + &dwSize); + if (lError != ERROR_SUCCESS) + { + ERR("Failed to query the bitmap size!\n"); + goto done; + } + + /* Allocate the bitmap */ + pBitmap = HeapAlloc(GetProcessHeap(), + HEAP_ZERO_MEMORY, + dwSize); + if (pBitmap == NULL) + { + ERR("Failed to allocate the bitmap!\n"); + lError = ERROR_NOT_ENOUGH_MEMORY; + goto done; + } + + /* Read the bitmap */ + lError = RegQueryValueExW(pComDB->hKey, + L"ComDB", + NULL, + &dwType, + pBitmap, + &dwSize); + if (lError != ERROR_SUCCESS) + goto done; + + lError = ERROR_INVALID_PARAMETER; + for (dwBitIndex = 0; dwBitIndex < (dwSize * BITS_PER_BYTE); dwBitIndex++) + { + /* Calculate the byte index and a mask for the affected bit */ + dwByteIndex = dwBitIndex / BITS_PER_BYTE; + cMask = 1 << (dwBitIndex % BITS_PER_BYTE); + + if ((pBitmap[dwByteIndex] & cMask) == 0) + { + pBitmap[dwByteIndex] |= cMask; + *ComNumber = dwBitIndex + 1; + lError = ERROR_SUCCESS; + break; + } + } + + /* Save the bitmap if it was modified */ + if (lError == ERROR_SUCCESS) + { + lError = RegSetValueExW(pComDB->hKey, + L"ComDB", + 0, + REG_BINARY, + pBitmap, + dwSize); + } + +done:; + /* Release the mutex */ + ReleaseMutex(pComDB->hMutex); + + /* Release the bitmap */ + if (pBitmap != NULL) + HeapFree(GetProcessHeap(), 0, pBitmap); + + return lError; +} + + LONG WINAPI ComDBClaimPort(IN HCOMDB hComDB, @@ -31,13 +126,16 @@ ComDBClaimPort(IN HCOMDB hComDB, OUT PBOOL Forced) { PCOMDB pComDB; - PBYTE pByte; - BYTE cMask; DWORD dwBitIndex; + DWORD dwByteIndex; DWORD dwType; DWORD dwSize; + PBYTE pBitmap = NULL; + BYTE cMask; LONG lError; + TRACE("ComDBClaimPort(%p %lu)\n", hComDB, ComNumber); + if (hComDB == INVALID_HANDLE_VALUE || hComDB == NULL || ComNumber == 0 || @@ -46,43 +144,68 @@ ComDBClaimPort(IN HCOMDB hComDB, pComDB = (PCOMDB)hComDB; - /* Update the bitmap */ - dwSize = pComDB->dwSize; + /* Wait for the mutex */ + WaitForSingleObject(pComDB->hMutex, INFINITE); + + /* Get the required bitmap size */ lError = RegQueryValueExW(pComDB->hKey, L"ComDB", NULL, &dwType, - pComDB->pBitmap, + NULL, &dwSize); if (lError != ERROR_SUCCESS) - return lError; + { + ERR("Failed to query the bitmap size!\n"); + goto done; + } + + /* Allocate the bitmap */ + pBitmap = HeapAlloc(GetProcessHeap(), + HEAP_ZERO_MEMORY, + dwSize); + if (pBitmap == NULL) + { + ERR("Failed to allocate the bitmap!\n"); + lError = ERROR_NOT_ENOUGH_MEMORY; + goto done; + } + + /* Read the bitmap */ + lError = RegQueryValueExW(pComDB->hKey, + L"ComDB", + NULL, + &dwType, + pBitmap, + &dwSize); + if (lError != ERROR_SUCCESS) + goto done; /* Get the bit index */ dwBitIndex = ComNumber - 1; /* Check if the bit to set fits into the bitmap */ - if (dwBitIndex >= (pComDB->dwSize * BITS_PER_BYTE)) + if (dwBitIndex >= (dwSize * BITS_PER_BYTE)) { - /* FIXME: Resize the bitmap */ - return ERROR_INVALID_PARAMETER; + FIXME("Resize the bitmap\n"); + + lError = ERROR_INVALID_PARAMETER; + goto done; } - /* Get a pointer to the affected byte and calculate a mask for the affected bit */ - pByte = &(pComDB->pBitmap[dwBitIndex / BITS_PER_BYTE]); + /* Calculate the byte index and a mask for the affected bit */ + dwByteIndex = dwBitIndex / BITS_PER_BYTE; cMask = 1 << (dwBitIndex % BITS_PER_BYTE); + lError = ERROR_SHARING_VIOLATION; + /* Check if the bit is not set */ - if ((*pByte & cMask) == 0) + if ((pBitmap[dwByteIndex] & cMask) == 0) { /* Set the bit */ - *pByte |= cMask; + pBitmap[dwByteIndex] |= cMask; lError = ERROR_SUCCESS; } - else - { - /* The bit is already set */ - lError = ERROR_SHARING_VIOLATION; - } /* Save the bitmap if it was modified */ if (lError == ERROR_SUCCESS) @@ -91,10 +214,18 @@ ComDBClaimPort(IN HCOMDB hComDB, L"ComDB", 0, REG_BINARY, - pComDB->pBitmap, - pComDB->dwSize); + pBitmap, + dwSize); } +done: + /* Release the mutex */ + ReleaseMutex(pComDB->hMutex); + + /* Release the bitmap */ + if (pBitmap != NULL) + HeapFree(GetProcessHeap(), 0, pBitmap); + return lError; } @@ -105,7 +236,10 @@ ComDBClose(IN HCOMDB hComDB) { PCOMDB pComDB; - if (hComDB == HCOMDB_INVALID_HANDLE_VALUE || hComDB == NULL) + TRACE("ComDBClose(%p)\n", hComDB); + + if (hComDB == HCOMDB_INVALID_HANDLE_VALUE || + hComDB == NULL) return ERROR_INVALID_PARAMETER; pComDB = (PCOMDB)hComDB; @@ -114,9 +248,9 @@ ComDBClose(IN HCOMDB hComDB) if (pComDB->hKey != NULL) RegCloseKey(pComDB->hKey); - /* Release the bitmap */ - if (pComDB->pBitmap != NULL) - HeapFree(GetProcessHeap(), 0, pComDB->pBitmap); + /* Close the mutex */ + if (pComDB->hMutex != NULL) + CloseHandle(pComDB->hMutex); /* Release the database */ HeapFree(GetProcessHeap(), 0, pComDB); @@ -125,6 +259,114 @@ ComDBClose(IN HCOMDB hComDB) } +LONG +WINAPI +ComDBGetCurrentPortUsage(IN HCOMDB hComDB, + OUT PBYTE Buffer, + IN DWORD BufferSize, + IN DWORD ReportType, + OUT LPDWORD MaxPortsReported) +{ + PCOMDB pComDB; + DWORD dwBitIndex; + DWORD dwByteIndex; + DWORD dwType; + DWORD dwSize; + PBYTE pBitmap = NULL; + BYTE cMask; + LONG lError = ERROR_SUCCESS; + + if (hComDB == INVALID_HANDLE_VALUE || + hComDB == NULL || + (Buffer == NULL && MaxPortsReported == NULL) || + (ReportType != CDB_REPORT_BITS && ReportType != CDB_REPORT_BYTES)) + return ERROR_INVALID_PARAMETER; + + pComDB = (PCOMDB)hComDB; + + /* Wait for the mutex */ + WaitForSingleObject(pComDB->hMutex, INFINITE); + + /* Get the required bitmap size */ + lError = RegQueryValueExW(pComDB->hKey, + L"ComDB", + NULL, + &dwType, + NULL, + &dwSize); + if (lError != ERROR_SUCCESS) + { + ERR("Failed to query the bitmap size!\n"); + goto done; + } + + /* Allocate the bitmap */ + pBitmap = HeapAlloc(GetProcessHeap(), + HEAP_ZERO_MEMORY, + dwSize); + if (pBitmap == NULL) + { + ERR("Failed to allocate the bitmap!\n"); + lError = ERROR_NOT_ENOUGH_MEMORY; + goto done; + } + + /* Read the bitmap */ + lError = RegQueryValueExW(pComDB->hKey, + L"ComDB", + NULL, + &dwType, + pBitmap, + &dwSize); + if (lError != ERROR_SUCCESS) + goto done; + + if (Buffer == NULL) + { + *MaxPortsReported = dwSize * BITS_PER_BYTE; + } + else + { + if (ReportType == CDB_REPORT_BITS) + { + /* Clear the buffer */ + memset(Buffer, 0, BufferSize); + + memcpy(Buffer, + pBitmap, + min(dwSize, BufferSize)); + + if (MaxPortsReported != NULL) + *MaxPortsReported = min(dwSize, BufferSize) * BITS_PER_BYTE; + } + else if (ReportType == CDB_REPORT_BYTES) + { + /* Clear the buffer */ + memset(Buffer, 0, BufferSize); + + for (dwBitIndex = 0; dwBitIndex < min(dwSize * BITS_PER_BYTE, BufferSize); dwBitIndex++) + { + /* Calculate the byte index and a mask for the affected bit */ + dwByteIndex = dwBitIndex / BITS_PER_BYTE; + cMask = 1 << (dwBitIndex % BITS_PER_BYTE); + + if ((pBitmap[dwByteIndex] & cMask) != 0) + Buffer[dwBitIndex] = 1; + } + } + } + +done:; + /* Release the mutex */ + ReleaseMutex(pComDB->hMutex); + + /* Release the bitmap */ + HeapFree(GetProcessHeap(), 0, pBitmap); + + return lError; +} + + LONG WINAPI ComDBOpen(OUT HCOMDB *phComDB) @@ -132,6 +374,8 @@ ComDBOpen(OUT HCOMDB *phComDB) PCOMDB pComDB; DWORD dwDisposition; DWORD dwType; + DWORD dwSize; + PBYTE pBitmap; LONG lError; TRACE("ComDBOpen(%p)\n", phComDB); @@ -142,10 +386,26 @@ ComDBOpen(OUT HCOMDB *phComDB) sizeof(COMDB)); if (pComDB == NULL) { - ERR("Failed to allocaete the database!\n"); + ERR("Failed to allocate the database!\n"); + *phComDB = HCOMDB_INVALID_HANDLE_VALUE; return ERROR_ACCESS_DENIED; } + /* Create a mutex to protect the database */ + pComDB->hMutex = CreateMutexW(NULL, + FALSE, + L"ComDBMutex"); + if (pComDB->hMutex == NULL) + { + ERR("Failed to create the mutex!\n"); + HeapFree(GetProcessHeap(), 0, pComDB); + *phComDB = HCOMDB_INVALID_HANDLE_VALUE; + return ERROR_ACCESS_DENIED; + } + + /* Wait for the mutex */ + WaitForSingleObject(pComDB->hMutex, INFINITE); + /* Create or open the database key */ lError = RegCreateKeyExW(HKEY_LOCAL_MACHINE, L"System\\CurrentControlSet\\Control\\COM Name Arbiter", @@ -165,39 +425,44 @@ ComDBOpen(OUT HCOMDB *phComDB) NULL, &dwType, NULL, - &pComDB->dwSize); + &dwSize); if (lError == ERROR_FILE_NOT_FOUND) { /* Allocate a new bitmap */ - pComDB->dwSize = COMDB_MIN_PORTS_ARBITRATED / BITS_PER_BYTE; - pComDB->pBitmap = HeapAlloc(GetProcessHeap(), - HEAP_ZERO_MEMORY, - pComDB->dwSize); - if (pComDB->pBitmap == NULL) + dwSize = COMDB_MIN_PORTS_ARBITRATED / BITS_PER_BYTE; + pBitmap = HeapAlloc(GetProcessHeap(), + HEAP_ZERO_MEMORY, + dwSize); + if (pBitmap == NULL) { - ERR("Failed to allocaete the bitmap!\n"); + ERR("Failed to allocate the bitmap!\n"); lError = ERROR_ACCESS_DENIED; goto done; } - /* Read the bitmap from the registry */ + /* Write the bitmap to the registry */ lError = RegSetValueExW(pComDB->hKey, L"ComDB", 0, REG_BINARY, - pComDB->pBitmap, - pComDB->dwSize); + pBitmap, + dwSize); + + HeapFree(GetProcessHeap(), 0, pBitmap); } done:; + /* Release the mutex */ + ReleaseMutex(pComDB->hMutex); + if (lError != ERROR_SUCCESS) { /* Clean up in case of failure */ if (pComDB->hKey != NULL) RegCloseKey(pComDB->hKey); - if (pComDB->pBitmap != NULL) - HeapFree(GetProcessHeap(), 0, pComDB->pBitmap); + if (pComDB->hMutex != NULL) + CloseHandle(pComDB->hMutex); HeapFree(GetProcessHeap(), 0, pComDB); @@ -214,4 +479,110 @@ done:; return lError; } + +LONG +WINAPI +ComDBReleasePort(IN HCOMDB hComDB, + IN DWORD ComNumber) +{ + PCOMDB pComDB; + DWORD dwByteIndex; + DWORD dwBitIndex; + DWORD dwType; + DWORD dwSize; + PBYTE pBitmap = NULL; + BYTE cMask; + LONG lError; + + TRACE("ComDBReleasePort(%p %lu)\n", hComDB, ComNumber); + + if (hComDB == INVALID_HANDLE_VALUE || + ComNumber == 0 || + ComNumber > COMDB_MAX_PORTS_ARBITRATED) + return ERROR_INVALID_PARAMETER; + + pComDB = (PCOMDB)hComDB; + + /* Wait for the mutex */ + WaitForSingleObject(pComDB->hMutex, INFINITE); + + /* Get the required bitmap size */ + lError = RegQueryValueExW(pComDB->hKey, + L"ComDB", + NULL, + &dwType, + NULL, + &dwSize); + if (lError != ERROR_SUCCESS) + { + ERR("Failed to query the bitmap size!\n"); + goto done; + } + + /* Allocate the bitmap */ + pBitmap = HeapAlloc(GetProcessHeap(), + HEAP_ZERO_MEMORY, + dwSize); + if (pBitmap == NULL) + { + ERR("Failed to allocate the bitmap!\n"); + lError = ERROR_NOT_ENOUGH_MEMORY; + goto done; + } + + /* Read the bitmap */ + lError = RegQueryValueExW(pComDB->hKey, + L"ComDB", + NULL, + &dwType, + pBitmap, + &dwSize); + if (lError != ERROR_SUCCESS) + goto done; + + /* Get the bit index */ + dwBitIndex = ComNumber - 1; + + /* Check if the bit to set fits into the bitmap */ + if (dwBitIndex >= (dwSize * BITS_PER_BYTE)) + { + lError = ERROR_INVALID_PARAMETER; + goto done; + } + + /* Calculate the byte index and a mask for the affected bit */ + dwByteIndex = dwBitIndex / BITS_PER_BYTE; + cMask = 1 << (dwBitIndex % BITS_PER_BYTE); + + /* Release the port */ + pBitmap[dwByteIndex] &= ~cMask; + + lError = RegSetValueExW(pComDB->hKey, + L"ComDB", + 0, + REG_BINARY, + pBitmap, + dwSize); + +done:; + /* Release the mutex */ + ReleaseMutex(pComDB->hMutex); + + /* Release the bitmap */ + if (pBitmap != NULL) + HeapFree(GetProcessHeap(), 0, pBitmap); + + return lError; +} + + +LONG +WINAPI +ComDBResizeDatabase(IN HCOMDB hComDB, + IN DWORD NewSize) +{ + FIXME("ComDBResizeDatabase(%p %lu)\n", hComDB, NewSize); + return ERROR_CALL_NOT_IMPLEMENTED; +} + /* EOF */ diff --git a/dll/win32/msports/internal.h b/dll/win32/msports/internal.h new file mode 100644 index 00000000000..8f67052f938 --- /dev/null +++ b/dll/win32/msports/internal.h @@ -0,0 +1,9 @@ +/* + * PROJECT: Ports installer library + * LICENSE: GPL - See COPYING in the top level directory + * FILE: dll\win32\msports\internal.h + * PURPOSE: Global declarations + * COPYRIGHT: Copyright 2011 Eric Kohl + */ + +extern HINSTANCE hInstance; \ No newline at end of file diff --git a/dll/win32/msports/lang/de-DE.rc b/dll/win32/msports/lang/de-DE.rc new file mode 100644 index 00000000000..6450c6b627b --- /dev/null +++ b/dll/win32/msports/lang/de-DE.rc @@ -0,0 +1,21 @@ + +LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL + +IDD_SERIALSETTINGS DIALOGEX DISCARDABLE 0, 0, 252, 218 +STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Port Einstellungen" +FONT 8, "MS Shell Dlg" +BEGIN + RTEXT "B&its pro Sekunde:", -1, 74, 19, 62, 8, WS_GROUP + COMBOBOX IDC_SERIAL_BITSPERSECOND, 139, 17, 106, 90, WS_TABSTOP | CBS_DROPDOWNLIST + RTEXT "&Datenbits:", -1, 74, 40, 62, 8 + COMBOBOX IDC_SERIAL_DATABITS, 139, 38, 106, 54, WS_TABSTOP | CBS_DROPDOWNLIST + RTEXT "&Paritt:", -1, 74, 61, 62, 8 + COMBOBOX IDC_SERIAL_PARITY, 139, 59, 106, 62, WS_TABSTOP | CBS_DROPDOWNLIST + RTEXT "&Stoppbits:", -1, 74, 82, 62, 8 + COMBOBOX IDC_SERIAL_STOPBITS, 139, 80, 106, 54, WS_TABSTOP | CBS_DROPDOWNLIST + RTEXT "&Flusssteuerung:", - 1, 74, 102, 62, 8 + COMBOBOX IDC_SERIAL_FLOWCONTROL, 139, 100, 106, 54, WS_TABSTOP | CBS_DROPDOWNLIST + PUSHBUTTON "&Erweitert...",IDC_SERIAL_ADVANCED, 111, 130, 65, 14,WS_GROUP + PUSHBUTTON "Wieder&herstellen",IDC_SERIAL_RESTORE, 180, 130, 65, 14, WS_GROUP +END diff --git a/dll/win32/msports/lang/en-US.rc b/dll/win32/msports/lang/en-US.rc new file mode 100644 index 00000000000..5ea9aa24d5a --- /dev/null +++ b/dll/win32/msports/lang/en-US.rc @@ -0,0 +1,21 @@ + +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +IDD_SERIALSETTINGS DIALOGEX DISCARDABLE 0, 0, 252, 218 +STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Port Settings" +FONT 8, "MS Shell Dlg" +BEGIN + RTEXT "B&its per second:", -1, 74, 19, 62, 8, WS_GROUP + COMBOBOX IDC_SERIAL_BITSPERSECOND, 139, 17, 106, 90, WS_TABSTOP | CBS_DROPDOWNLIST + RTEXT "&Data bits:", -1, 74, 40, 62, 8 + COMBOBOX IDC_SERIAL_DATABITS, 139, 38, 106, 54, WS_TABSTOP | CBS_DROPDOWNLIST + RTEXT "&Parity:", -1, 74, 61, 62, 8 + COMBOBOX IDC_SERIAL_PARITY, 139, 59, 106, 62, WS_TABSTOP | CBS_DROPDOWNLIST + RTEXT "&Stop bits:", -1, 74, 82, 62, 8 + COMBOBOX IDC_SERIAL_STOPBITS, 139, 80, 106, 54, WS_TABSTOP | CBS_DROPDOWNLIST + RTEXT "&Flow control:", - 1, 74, 102, 62, 8 + COMBOBOX IDC_SERIAL_FLOWCONTROL, 139, 100, 106, 54, WS_TABSTOP | CBS_DROPDOWNLIST + PUSHBUTTON "&Advanced...",IDC_SERIAL_ADVANCED, 111, 130, 65, 14,WS_GROUP + PUSHBUTTON "&Restore Defaults",IDC_SERIAL_RESTORE, 180, 130, 65, 14, WS_GROUP +END diff --git a/dll/win32/msports/lang/pl-PL.rc b/dll/win32/msports/lang/pl-PL.rc new file mode 100644 index 00000000000..ff9e22c25c4 --- /dev/null +++ b/dll/win32/msports/lang/pl-PL.rc @@ -0,0 +1,28 @@ +/* + * translated by Caemyr - Olaf Siejka (May 2011) + * Use ReactOS forum PM or IRC to contact me + * http://www.reactos.org + * IRC: irc.freenode.net #reactos-pl; + * UTF-8 conversion by Caemyr (May, 2011) + */ + +LANGUAGE LANG_POLISH, SUBLANG_DEFAULT + +IDD_SERIALSETTINGS DIALOGEX DISCARDABLE 0, 0, 252, 218 +STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Ustawienia portu" +FONT 8, "MS Shell Dlg" +BEGIN + RTEXT "B&itów na sekundę:", -1, 74, 19, 62, 8, WS_GROUP + COMBOBOX IDC_SERIAL_BITSPERSECOND, 139, 17, 106, 90, WS_TABSTOP | CBS_DROPDOWNLIST + RTEXT "&Bity danych:", -1, 74, 40, 62, 8 + COMBOBOX IDC_SERIAL_DATABITS, 139, 38, 106, 54, WS_TABSTOP | CBS_DROPDOWNLIST + RTEXT "&Parzystość:", -1, 74, 61, 62, 8 + COMBOBOX IDC_SERIAL_PARITY, 139, 59, 106, 62, WS_TABSTOP | CBS_DROPDOWNLIST + RTEXT "Bi&ty stopu:", -1, 74, 82, 62, 8 + COMBOBOX IDC_SERIAL_STOPBITS, 139, 80, 106, 54, WS_TABSTOP | CBS_DROPDOWNLIST + RTEXT "&Kontrola przepływu:", - 1, 74, 102, 62, 8 + COMBOBOX IDC_SERIAL_FLOWCONTROL, 139, 100, 106, 54, WS_TABSTOP | CBS_DROPDOWNLIST + PUSHBUTTON "&Zaawansowane...",IDC_SERIAL_ADVANCED, 111, 130, 65, 14,WS_GROUP + PUSHBUTTON "P&rzywróć domyślne",IDC_SERIAL_RESTORE, 180, 130, 65, 14, WS_GROUP +END diff --git a/dll/win32/msports/lang/uk-UA.rc b/dll/win32/msports/lang/uk-UA.rc new file mode 100644 index 00000000000..a5ac1f08739 --- /dev/null +++ b/dll/win32/msports/lang/uk-UA.rc @@ -0,0 +1,28 @@ +/* + * PROJECT: ReactOS msports + * LICENSE: GPL - See COPYING in the top level directory + * FILE: dll/win32/msports/lang/uk-UA.rc + * PURPOSE: Ukraianian Language File for msports + * TRANSLATOR: Igor Paliychuk + */ + +LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT + +IDD_SERIALSETTINGS DIALOGEX DISCARDABLE 0, 0, 252, 218 +STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION +CAPTION "Параметри порту" +FONT 8, "MS Shell Dlg" +BEGIN + RTEXT "Бі&тів на секунду:", -1, 74, 19, 62, 8, WS_GROUP + COMBOBOX IDC_SERIAL_BITSPERSECOND, 139, 17, 106, 90, WS_TABSTOP | CBS_DROPDOWNLIST + RTEXT "&Біти даних:", -1, 74, 40, 62, 8 + COMBOBOX IDC_SERIAL_DATABITS, 139, 38, 106, 54, WS_TABSTOP | CBS_DROPDOWNLIST + RTEXT "&Паритет:", -1, 74, 61, 62, 8 + COMBOBOX IDC_SERIAL_PARITY, 139, 59, 106, 62, WS_TABSTOP | CBS_DROPDOWNLIST + RTEXT "&Стопові біти:", -1, 74, 82, 62, 8 + COMBOBOX IDC_SERIAL_STOPBITS, 139, 80, 106, 54, WS_TABSTOP | CBS_DROPDOWNLIST + RTEXT "&Керування потоком:", - 1, 74, 102, 62, 8 + COMBOBOX IDC_SERIAL_FLOWCONTROL, 139, 100, 106, 54, WS_TABSTOP | CBS_DROPDOWNLIST + PUSHBUTTON "&Розширені...",IDC_SERIAL_ADVANCED, 111, 130, 65, 14,WS_GROUP + PUSHBUTTON "&За замовчуванням",IDC_SERIAL_RESTORE, 180, 130, 65, 14, WS_GROUP +END diff --git a/dll/win32/msports/msports.c b/dll/win32/msports/msports.c index 2d0bcc5c6ab..1260e0cfc1b 100644 --- a/dll/win32/msports/msports.c +++ b/dll/win32/msports/msports.c @@ -1,17 +1,16 @@ /* * PROJECT: Ports installer library * LICENSE: GPL - See COPYING in the top level directory - * FILE: dll/win32/msports/msports.c + * FILE: dll\win32\msports\msports.c * PURPOSE: Library main function * COPYRIGHT: Copyright 2011 Eric Kohl */ -#include -#include - +#include "precomp.h" WINE_DEFAULT_DEBUG_CHANNEL(msports); +HINSTANCE hInstance; BOOL WINAPI @@ -23,6 +22,7 @@ DllMain(HINSTANCE hinstDll, { case DLL_PROCESS_ATTACH: TRACE("DLL_PROCESS_ATTACH\n"); + hInstance = hinstDll; DisableThreadLibraryCalls(hinstDll); break; } diff --git a/dll/win32/msports/msports.rbuild b/dll/win32/msports/msports.rbuild index cd4a3de1098..d8d10e1ac68 100644 --- a/dll/win32/msports/msports.rbuild +++ b/dll/win32/msports/msports.rbuild @@ -4,9 +4,13 @@ wine kernel32 advapi32 + comctl32 + user32 setupapi classinst.c comdb.c msports.c + serial.c msports.rc + precomp.h diff --git a/dll/win32/msports/msports.rc b/dll/win32/msports/msports.rc index 33ab2b44f4f..7b6ec241d2c 100644 --- a/dll/win32/msports/msports.rc +++ b/dll/win32/msports/msports.rc @@ -1,7 +1,16 @@ #include +#include "resource.h" #define REACTOS_VERSION_DLL #define REACTOS_STR_FILE_DESCRIPTION "Ports Class Installer\0" #define REACTOS_STR_INTERNAL_NAME "msports\0" #define REACTOS_STR_ORIGINAL_FILENAME "msports.dll\0" #include + +#include "lang/de-DE.rc" +#include "lang/en-US.rc" + +// UTF-8 +#pragma code_page(65001) +#include "lang/pl-PL.rc" +#include "lang/uk-UA.rc" diff --git a/dll/win32/msports/msports.spec b/dll/win32/msports/msports.spec index f5672c8ba2b..3be8a92914e 100644 --- a/dll/win32/msports/msports.spec +++ b/dll/win32/msports/msports.spec @@ -1,12 +1,12 @@ -@ stub ComDBClaimNextFreePort +@ stdcall ComDBClaimNextFreePort(ptr ptr) @ stdcall ComDBClaimPort(ptr long long ptr) @ stdcall ComDBClose(ptr) -@ stub ComDBGetCurrentPortUsage +@ stdcall ComDBGetCurrentPortUsage(ptr ptr long long ptr) @ stdcall ComDBOpen(ptr) -@ stub ComDBReleasePort -@ stub ComDBResizeDatabase +@ stdcall ComDBReleasePort(ptr long) +@ stdcall ComDBResizeDatabase(ptr long) @ stdcall LibMain(ptr long ptr) DllMain @ stub ParallelPortPropPageProvider @ stdcall PortsClassInstaller(long ptr ptr) @ stub SerialDisplayAdvancedSettings -@ stub SerialPortPropPageProvider +@ stdcall SerialPortPropPageProvider(ptr ptr long) diff --git a/dll/win32/msports/precomp.h b/dll/win32/msports/precomp.h new file mode 100644 index 00000000000..b51ed797152 --- /dev/null +++ b/dll/win32/msports/precomp.h @@ -0,0 +1,15 @@ +#define WIN32_NO_STATUS +#include +#include +#include +#include +#include +#include +#include + +#include + +//#include + +#include "internal.h" +#include "resource.h" diff --git a/dll/win32/msports/resource.h b/dll/win32/msports/resource.h new file mode 100644 index 00000000000..de46f09ff7f --- /dev/null +++ b/dll/win32/msports/resource.h @@ -0,0 +1,9 @@ + +#define IDD_SERIALSETTINGS 200 +#define IDC_SERIAL_BITSPERSECOND 201 +#define IDC_SERIAL_DATABITS 202 +#define IDC_SERIAL_PARITY 203 +#define IDC_SERIAL_STOPBITS 204 +#define IDC_SERIAL_FLOWCONTROL 205 +#define IDC_SERIAL_ADVANCED 206 +#define IDC_SERIAL_RESTORE 207 diff --git a/dll/win32/msports/serial.c b/dll/win32/msports/serial.c new file mode 100644 index 00000000000..68792a10df3 --- /dev/null +++ b/dll/win32/msports/serial.c @@ -0,0 +1,89 @@ +/* + * PROJECT: Ports installer library + * LICENSE: GPL - See COPYING in the top level directory + * FILE: dll\win32\msports\serial.c + * PURPOSE: Serial Port property functions + * COPYRIGHT: Copyright 2011 Eric Kohl + */ + +#include "precomp.h" + +WINE_DEFAULT_DEBUG_CHANNEL(msports); + + +static +BOOL +OnInitDialog(HWND hwnd, + WPARAM wParam, + LPARAM lParam) +{ + FIXME("Port_OnInit()\n"); + return TRUE; +} + + +static +INT_PTR +CALLBACK +SerialSettingsDlgProc(HWND hwnd, + UINT uMsg, + WPARAM wParam, + LPARAM lParam) +{ + FIXME("SerialSettingsDlgProc()\n"); + + switch (uMsg) + { + case WM_INITDIALOG: + return OnInitDialog(hwnd, wParam, lParam); + } + + return FALSE; +} + + +BOOL +WINAPI +SerialPortPropPageProvider(PSP_PROPSHEETPAGE_REQUEST lpPropSheetPageRequest, + LPFNADDPROPSHEETPAGE lpfnAddPropSheetPageProc, + LPARAM lParam) +{ + PROPSHEETPAGEW PropSheetPage; + HPROPSHEETPAGE hPropSheetPage; + + FIXME("SerialPortPropPageProvider(%p %p %lx)\n", + lpPropSheetPageRequest, lpfnAddPropSheetPageProc, lParam); + + if (lpPropSheetPageRequest->PageRequested == SPPSR_ENUM_ADV_DEVICE_PROPERTIES) + { + FIXME("SPPSR_ENUM_ADV_DEVICE_PROPERTIES\n"); + + PropSheetPage.dwSize = sizeof(PROPSHEETPAGEW); + PropSheetPage.dwFlags = 0; + PropSheetPage.hInstance = hInstance; + PropSheetPage.pszTemplate = MAKEINTRESOURCE(IDD_SERIALSETTINGS); + PropSheetPage.pfnDlgProc = SerialSettingsDlgProc; + PropSheetPage.lParam = 0; + PropSheetPage.pfnCallback = NULL; + + hPropSheetPage = CreatePropertySheetPageW(&PropSheetPage); + if (hPropSheetPage == NULL) + { + FIXME("CreatePropertySheetPageW() failed!\n"); + return FALSE; + } + + if (!(*lpfnAddPropSheetPageProc)(hPropSheetPage, lParam)) + { + FIXME("lpfnAddPropSheetPageProc() failed!\n"); + DestroyPropertySheetPage(hPropSheetPage); + return FALSE; + } + } + + FIXME("Done!\n"); + + return TRUE; +} + +/* EOF */ \ No newline at end of file diff --git a/dll/win32/msrle32/CMakeLists.txt b/dll/win32/msrle32/CMakeLists.txt index 9aedf677b8f..b79aa8bd5f8 100644 --- a/dll/win32/msrle32/CMakeLists.txt +++ b/dll/win32/msrle32/CMakeLists.txt @@ -1,8 +1,5 @@ -add_definitions( - -D__WINESRC__ - -D_DLL -D__USE_CRTIMP) - +add_definitions(-D__WINESRC__) include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine) set_rc_compiler() diff --git a/dll/win32/msrle32/msrle_Cs.rc b/dll/win32/msrle32/msrle_Cs.rc index 4d96bea4eff..0cf1b7777df 100644 --- a/dll/win32/msrle32/msrle_Cs.rc +++ b/dll/win32/msrle32/msrle_Cs.rc @@ -30,5 +30,5 @@ STRINGTABLE { IDS_NAME "WINE-MS-RLE" IDS_DESCRIPTION "Wine MS-RLE video kodek" - IDS_ABOUT L"Wine MS-RLE video kodek\nCopyright 2002 Michael Gnnewig" + IDS_ABOUT "Wine MS-RLE video kodek\nCopyright 2002 Michael Gnnewig" } diff --git a/dll/win32/mstask/CMakeLists.txt b/dll/win32/mstask/CMakeLists.txt index cf5b7571024..b0880679f4e 100644 --- a/dll/win32/mstask/CMakeLists.txt +++ b/dll/win32/mstask/CMakeLists.txt @@ -27,11 +27,8 @@ list(APPEND SOURCE ${CMAKE_CURRENT_BINARY_DIR}/mstask.def) add_library(mstask SHARED ${SOURCE}) - set_module_type(mstask win32dll) - target_link_libraries(mstask uuid wine) - add_importlibs(mstask ole32 msvcrt kernel32 ntdll) - +add_pch(mstask mstask_private.h) add_cd_file(TARGET mstask DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/mstask/mstask.rbuild b/dll/win32/mstask/mstask.rbuild index f766f72f640..095642eaaba 100644 --- a/dll/win32/mstask/mstask.rbuild +++ b/dll/win32/mstask/mstask.rbuild @@ -15,6 +15,7 @@ task_scheduler.c task_trigger.c rsrc.rc + mstask_private.h mstask_local_interface wine uuid diff --git a/dll/win32/msvcrt/CMakeLists.txt b/dll/win32/msvcrt/CMakeLists.txt index 3cf63aa2234..a6ac9c8e372 100644 --- a/dll/win32/msvcrt/CMakeLists.txt +++ b/dll/win32/msvcrt/CMakeLists.txt @@ -21,25 +21,23 @@ list(APPEND SOURCE msvcrt.rc ${CMAKE_CURRENT_BINARY_DIR}/msvcrt.def) -add_library(msvcrt SHARED - ${CMAKE_CURRENT_BINARY_DIR}/msvcrt_precomp.h.gch - ${SOURCE}) +add_library(msvcrt SHARED ${SOURCE}) -if (NOT MSVC) -set_target_properties(msvcrt PROPERTIES LINK_FLAGS "-u __seh_longjmp_unwind@4") +if(NOT MSVC) + set_target_properties(msvcrt PROPERTIES LINK_FLAGS "-u __seh_longjmp_unwind@4") endif() add_dependencies(msvcrt psdk) set_entrypoint(msvcrt DllMain@12) set_image_base(msvcrt ${baseaddress_msvcrt}) -target_link_libraries(msvcrt - crt - wine - ${PSEH_LIB}) +target_link_libraries(msvcrt crt wine) + +if(NOT MSVC) + target_link_libraries(msvcrt pseh) +endif() -add_pch(msvcrt ${CMAKE_CURRENT_SOURCE_DIR}/precomp.h ${SOURCE}) add_importlibs(msvcrt kernel32 ntdll) +add_pch(msvcrt precomp.h) add_cd_file(TARGET msvcrt DESTINATION reactos/system32 FOR all) add_importlib_target(msvcrt.spec) - diff --git a/dll/win32/msvcrt/dllmain.c b/dll/win32/msvcrt/dllmain.c index 95efb2bbb96..ec7b2987963 100644 --- a/dll/win32/msvcrt/dllmain.c +++ b/dll/win32/msvcrt/dllmain.c @@ -21,11 +21,7 @@ */ #include -#include -#include -#include -#include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(msvcrt); /* EXTERNAL PROTOTYPES ********************************************************/ diff --git a/dll/win32/msvcrt/msvcrt.spec b/dll/win32/msvcrt/msvcrt.spec index b55f7aac52f..02d506e9699 100644 --- a/dll/win32/msvcrt/msvcrt.spec +++ b/dll/win32/msvcrt/msvcrt.spec @@ -104,7 +104,7 @@ @ cdecl _Getdays() @ cdecl _Getmonths() @ cdecl _Gettnames() -@ extern _HUGE _HUGE +@ extern _HUGE @ cdecl _Strftime(str long str ptr ptr) @ cdecl _XcptFilter(long ptr) @ cdecl __CppXcptFilter(long ptr) @@ -132,8 +132,8 @@ # @ cdecl ___mb_cur_max_func() MSVCRT___mb_cur_max_func @ cdecl ___setlc_active_func() @ cdecl ___unguarded_readlc_active_add_func() -@ extern __argc __argc -@ extern __argv __argv +@ extern __argc +@ extern __argv @ extern __badioinfo __badioinfo @ cdecl __crtCompareStringA(long long str long str long) kernel32.CompareStringA @ cdecl __crtCompareStringW(long long wstr long wstr long) kernel32.CompareStringW @@ -142,15 +142,15 @@ @ cdecl __crtLCMapStringA(long long str long ptr long long long) # stub __crtLCMapStringW @ cdecl __dllonexit(ptr ptr ptr) -@ cdecl __doserrno() __doserrno +@ cdecl __doserrno() @ cdecl __fpecode() @ cdecl __get_app_type() @ cdecl __getmainargs(ptr ptr ptr long ptr) -@ extern __initenv __initenv +@ extern __initenv @ cdecl __iob_func() __p__iob -@ cdecl __isascii(long) __isascii -@ cdecl __iscsym(long) __iscsym -@ cdecl __iscsymf(long) __iscsymf +@ cdecl __isascii(long) +@ cdecl __iscsym(long) +@ cdecl __iscsymf(long) @ extern __lc_codepage MSVCRT___lc_codepage # @ stub __lc_collate # not in XP / 7 @ extern __lc_collate_cp MSVCRT___lc_collate_cp @@ -177,7 +177,7 @@ # stub __libm_sse2_sinf # stub __libm_sse2_tan # stub __libm_sse2_tanf -@ extern __mb_cur_max __mb_cur_max +@ extern __mb_cur_max @ cdecl -arch=i386 __p___argc() @ cdecl -arch=i386 __p___argv() @ cdecl -arch=i386 __p___initenv() @@ -196,10 +196,10 @@ @ cdecl -arch=i386 __p__mbcasemap() @ cdecl -arch=i386 __p__mbctype() @ cdecl -arch=i386 __p__osver() -@ cdecl -arch=i386 __p__pctype() __pctype_func +@ cdecl -arch=i386 __p__pctype() @ cdecl -arch=i386 __p__pgmptr() @ cdecl -arch=i386 __p__pwctype() -@ cdecl -arch=i386 __p__timezone() __p__timezone +@ cdecl -arch=i386 __p__timezone() @ cdecl -arch=i386 __p__tzname() @ cdecl -arch=i386 __p__wcmdln() @ cdecl -arch=i386 __p__wenviron() @@ -207,9 +207,9 @@ @ cdecl -arch=i386 __p__winminor() @ cdecl -arch=i386 __p__winver() @ cdecl -arch=i386 __p__wpgmptr() -@ cdecl __pctype_func() __pctype_func -@ extern __pioinfo __pioinfo -# stub __pwctype_func +@ cdecl __pctype_func() +@ extern __pioinfo +@ cdecl __pwctype_func() @ cdecl __pxcptinfoptrs() @ cdecl __set_app_type(long) @ extern __setlc_active @@ -232,7 +232,7 @@ # stub _abs64 @ cdecl _access(str long) # stub _access_s -@ extern _acmdln _acmdln +@ extern _acmdln @ stdcall -arch=i386 _adj_fdiv_m16i(long) @ stdcall -arch=i386 _adj_fdiv_m32(long) @ stdcall -arch=i386 _adj_fdiv_m32i(long) @@ -247,7 +247,7 @@ @ cdecl -arch=i386 _adj_fprem1() @ cdecl -arch=i386 _adj_fptan() @ extern -arch=i386 _adjust_fdiv -# extern _aexit_rtn +@ extern _aexit_rtn @ cdecl _aligned_free(ptr) # stub _aligned_free_dbg @ cdecl _aligned_malloc(long long) @@ -271,8 +271,8 @@ @ cdecl _atoldbl(ptr str) # stub _atoldbl_l @ cdecl _beep(long long) -@ cdecl _beginthread (ptr long ptr) -@ cdecl _beginthreadex (ptr long ptr ptr long ptr) +@ cdecl _beginthread(ptr long ptr) +@ cdecl _beginthreadex(ptr long ptr ptr long ptr) @ cdecl _c_exit() @ cdecl _cabs(long) @ cdecl _callnewh(long) @@ -335,11 +335,11 @@ @ cdecl _difftime32(long long) @ cdecl _difftime64(long long) @ extern _dstbias -@ cdecl _dup (long) -@ cdecl _dup2 (long long) +@ cdecl _dup(long) +@ cdecl _dup2(long long) @ cdecl _ecvt(double long ptr ptr) # stub _ecvt_s -@ cdecl _endthread () +@ cdecl _endthread() @ cdecl _endthreadex(long) @ extern _environ @ cdecl _eof(long) @@ -355,7 +355,7 @@ @ cdecl _execve(str ptr ptr) @ cdecl _execvp(str ptr) @ cdecl _execvpe(str ptr ptr) -@ cdecl _exit(long) _exit +@ cdecl _exit(long) @ cdecl _expand(ptr long) # stub _expand_dbg @ cdecl _fcloseall() @@ -462,11 +462,11 @@ # stub _gmtime32_s @ cdecl _gmtime64(ptr) # stub _gmtime64_s -@ cdecl _heapadd (ptr long) +@ cdecl _heapadd(ptr long) @ cdecl _heapchk() @ cdecl _heapmin() @ cdecl _heapset(long) -# @ stub _heapused #(ptr ptr) # not in XP / 7 +@ cdecl _heapused(ptr ptr) @ cdecl _heapwalk(ptr) @ cdecl _hypot(double double) @ cdecl _i64toa(long long ptr long) @@ -492,7 +492,7 @@ # stub _islower_l @ cdecl _ismbbalnum(long) # stub _ismbbalnum_l -@ stub _ismbbalpha #(long) +@ cdecl _ismbbalpha(long) # stub _ismbbalpha_l @ cdecl _ismbbgraph(long) # stub _ismbbgraph_l @@ -506,7 +506,7 @@ # stub _ismbbkpunct_l @ cdecl _ismbblead(long) # stub _ismbblead_l -@ stub _ismbbprint #(long) +@ cdecl _ismbbprint(long) # stub _ismbbprint_l @ cdecl _ismbbpunct(long) # stub _ismbbpunct_l @@ -569,9 +569,9 @@ # stub _itoa_s @ cdecl _itow(long ptr long) # stub _itow_s -#@ cdecl _j0(double) -#@ cdecl _j1(double) -#@ cdecl _jn(long double) +@ cdecl _j0(double) +@ cdecl _j1(double) +@ cdecl _jn(long double) @ cdecl _kbhit() @ cdecl _lfind(ptr ptr ptr long ptr) # stub _lfind_s @@ -584,7 +584,7 @@ # stub _localtime64_s @ cdecl _lock(long) @ cdecl _locking(long long long) -@ cdecl _logb( double ) +@ cdecl _logb(double) @ cdecl -i386 _longjmpex(ptr long) longjmp @ cdecl _lrotl(long long) @ cdecl _lrotr(long long) @@ -607,7 +607,7 @@ # stub _mbccpy_l # stub _mbccpy_s # stub _mbccpy_s_l -@ cdecl _mbcjistojms (long) +@ cdecl _mbcjistojms(long) # stub _mbcjistojms_l @ cdecl _mbcjmstojis(long) # stub _mbcjmstojis_l @@ -639,11 +639,11 @@ @ cdecl _mbscpy(ptr str) # stub _mbscpy_s # stub _mbscpy_s_l -@ cdecl _mbscspn (str str) +@ cdecl _mbscspn(str str) # stub _mbscspn_l @ cdecl _mbsdec(ptr ptr) # stub _mbsdec_l -@ cdecl _mbsdup(str) _strdup +@ cdecl _mbsdup(str) # stub _strdup_dbg @ cdecl _mbsicmp(str str) # stub _mbsicmp_l @@ -657,7 +657,7 @@ # stub _mbslwr_l # stub _mbslwr_s # stub _mbslwr_s_l -@ cdecl _mbsnbcat (str str long) +@ cdecl _mbsnbcat(str str long) # stub _mbsnbcat_l # stub _mbsnbcat_s # stub _mbsnbcat_s_l @@ -755,16 +755,16 @@ @ cdecl _onexit(ptr) @ varargs _open(str long) @ cdecl _open_osfhandle(long long) -@ extern _osplatform _osplatform -@ extern _osver _osver +@ extern _osplatform +@ extern _osver @ cdecl _outp(long long) MSVCRT__outp @ cdecl _outpd(long long) MSVCRT__outpd @ cdecl _outpw(long long) MSVCRT__outpw -@ cdecl _pclose (ptr) -@ extern _pctype _pctype -@ extern _pgmptr _pgmptr -@ cdecl _pipe (ptr long long) -@ cdecl _popen (str str) +@ cdecl _pclose(ptr) +@ extern _pctype +@ extern _pgmptr +@ cdecl _pipe(ptr long long) +@ cdecl _popen(str str) # stub _printf_l # stub _printf_p # stub _printf_p_l @@ -813,7 +813,7 @@ # stub _set_output_format @ cdecl _set_sbh_threshold(long) @ cdecl _seterrormode(long) -@ cdecl -arch=i386,x86_64 -norelay _setjmp(ptr ptr) +@ cdecl -arch=i386,x86_64 -norelay _setjmp(ptr) @ cdecl -arch=i386 -norelay _setjmp3(ptr long) @ cdecl -arch=x86_64 -norelay _setjmpex(ptr ptr) @ cdecl _setmaxstdio(long) @@ -1005,7 +1005,7 @@ # stub _wassert @ cdecl _wchdir(wstr) @ cdecl _wchmod(wstr long) -@ extern _wcmdln _wcmdln +@ extern _wcmdln @ cdecl _wcreat(wstr long) # stub _wcscoll_l @ cdecl _wcsdup(wstr) @@ -1084,7 +1084,7 @@ @ extern _winminor # stub _winput_s @ extern _winver -@ cdecl _wmakepath(wstr wstr wstr wstr wstr) +@ cdecl _wmakepath(ptr wstr wstr wstr wstr) @ cdecl _wmakepath_s(ptr long wstr wstr wstr wstr) @ cdecl _wmkdir(wstr) @ cdecl _wmktemp(wstr) @@ -1093,7 +1093,7 @@ # stub _woutput_s @ cdecl _wperror(wstr) @ extern _wpgmptr -@ cdecl _wpopen (wstr wstr) +@ cdecl _wpopen(wstr wstr) # stub _wprintf_l # stub _wprintf_p # stub _wprintf_p_l @@ -1109,7 +1109,7 @@ @ cdecl _wsearchenv(wstr wstr ptr) # stub _wsearchenv_s @ cdecl _wsetlocale(long wstr) -@ varargs _wsopen (wstr long long) +@ varargs _wsopen(wstr long long) # stub _wsopen_s @ varargs _wspawnl(long wstr wstr) @ varargs _wspawnle(long wstr wstr) @@ -1145,9 +1145,9 @@ @ cdecl _wutime(wstr ptr) @ cdecl _wutime32(wstr ptr) @ cdecl _wutime64(wstr ptr) -#@ cdecl _y0(double) -#@ cdecl _y1(double) -#@ cdecl _yn(long double ) +@ cdecl _y0(double) +@ cdecl _y1(double) +@ cdecl _yn(long double ) @ cdecl abort() @ cdecl abs(long) @ cdecl acos(double) @@ -1156,7 +1156,7 @@ @ cdecl asin(double) @ cdecl atan(double) @ cdecl atan2(double double) -@ extern atexit # mingw hack +@ extern atexit # <-- keep this as an extern, thank you @ cdecl atof(str) @ cdecl atoi(str) @ cdecl atol(str) @@ -1220,7 +1220,7 @@ @ cdecl getwc(ptr) @ cdecl getwchar() @ cdecl gmtime(ptr) -@ cdecl is_wctype(long long)iswctype +@ cdecl is_wctype(long long) @ cdecl isalnum(long) @ cdecl isalpha(long) @ cdecl iscntrl(long) diff --git a/dll/win32/msvcrt/precomp.h b/dll/win32/msvcrt/precomp.h index acfc877e21c..564bd90cce4 100644 --- a/dll/win32/msvcrt/precomp.h +++ b/dll/win32/msvcrt/precomp.h @@ -6,4 +6,10 @@ #include #include +#include +#include +#include + +#include "wine/debug.h" + #endif /* _CRT_PRECOMP_H */ diff --git a/dll/win32/msvcrt/stubs.c b/dll/win32/msvcrt/stubs.c index 539a31652ce..e6b26752ef4 100644 --- a/dll/win32/msvcrt/stubs.c +++ b/dll/win32/msvcrt/stubs.c @@ -10,7 +10,7 @@ int __get_app_type() return 0; } -int _fileinfo; +int _fileinfo = 0; void * __p__fileinfo() @@ -41,6 +41,11 @@ int _ismbbkprint( return 0; } +size_t _heapused( size_t *pUsed, size_t *pCommit ) +{ + UNIMPLEMENTED; + return( 0 ); +} int MSVCRT__inp( unsigned short port) diff --git a/dll/win32/msvcrt20/CMakeLists.txt b/dll/win32/msvcrt20/CMakeLists.txt index fb3bc51dd93..db4d235d7df 100644 --- a/dll/win32/msvcrt20/CMakeLists.txt +++ b/dll/win32/msvcrt20/CMakeLists.txt @@ -1,20 +1,34 @@ -include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine) +add_definitions( + -DUSE_MSVCRT_PREFIX + -D_MSVCRT_ + -D_MSVCRT_LIB_ + -D_MT + -D_CTYPE_DISABLE_MACROS + -D_NO_INLINING + -DCRTDLL + -D__MINGW_IMPORT="") -add_definitions(-D__WINESRC__) -add_definitions(-DCRTDLL) +include_directories(${REACTOS_SOURCE_DIR}/lib/sdk/crt/include) spec2def(msvcrt20.dll msvcrt20.spec) list(APPEND SOURCE msvcrt20.c + stubs.c + ${CMAKE_CURRENT_BINARY_DIR}/msvcrt20_stubs.c ${CMAKE_CURRENT_BINARY_DIR}/msvcrt20.def) add_library(msvcrt20 SHARED ${SOURCE}) -set_entrypoint(msvcrt20 0) +set_entrypoint(msvcrt20 DllMain@12) +set_image_base(msvcrt20 ${baseaddress_msvcrt20}) -target_link_libraries(msvcrt20 wine) +target_link_libraries(msvcrt20 crt wine) -add_importlibs(msvcrt20 msvcrt kernel32 ntdll) +if(NOT MSVC) + target_link_libraries(msvcrt20 pseh) +endif() + +add_importlibs(msvcrt20 kernel32 ntdll) add_dependencies(msvcrt20 psdk) add_cd_file(TARGET msvcrt20 DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/msvcrt20/msvcrt20.c b/dll/win32/msvcrt20/msvcrt20.c index e8d2b3cd378..23875143e09 100644 --- a/dll/win32/msvcrt20/msvcrt20.c +++ b/dll/win32/msvcrt20/msvcrt20.c @@ -18,15 +18,143 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include +#include +#define _CRT_PRECOMP_H +#include +#include +#include +#include +#include +#include -#include "windef.h" +#include "wine/debug.h" +WINE_DEFAULT_DEBUG_CHANNEL(msvcrt); + +/* EXTERNAL PROTOTYPES ********************************************************/ + +extern int BlockEnvToEnvironA(void); +extern int BlockEnvToEnvironW(void); +extern void FreeEnvironment(char **environment); +extern void _atexit_cleanup(void); + +extern unsigned int _osplatform; +extern unsigned int _osver; +extern unsigned int _winminor; +extern unsigned int _winmajor; +extern unsigned int _winver; + +extern char* _acmdln; /* pointer to ascii command line */ +extern wchar_t* _wcmdln; /* pointer to wide character command line */ +#undef _environ +extern char** _environ; /* pointer to environment block */ +extern char** __initenv; /* pointer to initial environment block */ +extern wchar_t** _wenviron; /* pointer to environment block */ +extern wchar_t** __winitenv; /* pointer to initial environment block */ extern void CDECL __getmainargs(int *argc, char** *argv, char** *envp, int expand_wildcards, int *new_mode); extern void CDECL __wgetmainargs(int *argc, WCHAR** *wargv, WCHAR** *wenvp, int expand_wildcards, int *new_mode); +/* LIBRARY GLOBAL VARIABLES ***************************************************/ + +HANDLE hHeap = NULL; /* handle for heap */ + + +/* LIBRARY ENTRY POINT ********************************************************/ + +BOOL +WINAPI +DllMain(PVOID hinstDll, ULONG dwReason, PVOID reserved) +{ + OSVERSIONINFOW osvi; + switch (dwReason) + { + case DLL_PROCESS_ATTACH://1 + /* initialize version info */ + //DPRINT1("Process Attach %d\n", nAttachCount); + //DPRINT1("Process Attach\n"); + osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW); + GetVersionExW( &osvi ); + _winver = (osvi.dwMajorVersion << 8) | osvi.dwMinorVersion; + _winmajor = osvi.dwMajorVersion; + _winminor = osvi.dwMinorVersion; + _osplatform = osvi.dwPlatformId; + _osver = osvi.dwBuildNumber; + hHeap = HeapCreate(0, 100000, 0); + if (hHeap == NULL) + return FALSE; + + /* create tls stuff */ + if (!CreateThreadData()) + return FALSE; + + if (BlockEnvToEnvironA() < 0) + return FALSE; + + if (BlockEnvToEnvironW() < 0) + { + FreeEnvironment(_environ); + return FALSE; + } + + _acmdln = _strdup(GetCommandLineA()); + _wcmdln = _wcsdup(GetCommandLineW()); + + /* FIXME: more initializations... */ + + /* Initialization of the WINE code */ + msvcrt_init_mt_locks(); + msvcrt_init_io(); + setlocale(0, "C"); + //_setmbcp(_MB_CP_LOCALE); + + TRACE("Attach done\n"); + break; + + case DLL_THREAD_ATTACH: + break; + + case DLL_THREAD_DETACH: + FreeThreadData(NULL); + break; + + case DLL_PROCESS_DETACH: + //DPRINT1("Detach %d\n", nAttachCount); + //DPRINT("Detach\n"); + /* FIXME: more cleanup... */ + /* Deinit of the WINE code */ + msvcrt_free_io(); + msvcrt_free_mt_locks(); + + _atexit_cleanup(); + + + /* destroy tls stuff */ + DestroyThreadData(); + + if (__winitenv && __winitenv != _wenviron) + FreeEnvironment((char**)__winitenv); + if (_wenviron) + FreeEnvironment((char**)_wenviron); + + if (__initenv && __initenv != _environ) + FreeEnvironment(__initenv); + if (_environ) + FreeEnvironment(_environ); + + /* destroy heap */ + HeapDestroy(hHeap); + + TRACE("Detach done\n"); + break; + } + + return TRUE; +} + +/* LIBRARY EXPORTS ************************************************************/ + /********************************************************************* * __getmainargs (MSVCRT20.@) * @@ -48,3 +176,5 @@ void CDECL MSVCRT20__wgetmainargs( int *argc, WCHAR** *wargv, WCHAR** *wenvp, { __wgetmainargs( argc, wargv, wenvp, expand_wildcards, &new_mode ); } + +/* EOF */ \ No newline at end of file diff --git a/dll/win32/msvcrt20/msvcrt20.rbuild b/dll/win32/msvcrt20/msvcrt20.rbuild index 7ed802295ad..519c7b956d2 100644 --- a/dll/win32/msvcrt20/msvcrt20.rbuild +++ b/dll/win32/msvcrt20/msvcrt20.rbuild @@ -1,15 +1,24 @@ - - - . - include/reactos/wine - + + + . + include + + + + + + - msvcrt20.c - wine - msvcrt - ntdll - + msvcrt20.c + stubs.c + wine + crt + pseh + diff --git a/dll/win32/msvcrt20/msvcrt20.spec b/dll/win32/msvcrt20/msvcrt20.spec index dffade1ec24..3a6a103a065 100644 --- a/dll/win32/msvcrt20/msvcrt20.spec +++ b/dll/win32/msvcrt20/msvcrt20.spec @@ -77,8 +77,8 @@ @ stub ??1streambuf@@UAE@XZ # @ stub ??1strstream@@UAE@XZ # @ stub ??1strstreambuf@@UAE@XZ # -@ cdecl ??2@YAPAXI@Z(long) msvcrt.??2@YAPAXI@Z -@ cdecl ??3@YAXPAX@Z(ptr) msvcrt.??3@YAXPAX@Z +@ cdecl ??2@YAPAXI@Z(long) MSVCRT_operator_new +@ cdecl ??3@YAXPAX@Z(ptr) MSVCRT_operator_delete @ stub ??4Iostream_init@@QAEAAV0@ABV0@@Z # @ stub ??4filebuf@@QAEAAV0@ABV0@@Z # @ stub ??4fstream@@QAEAAV0@AAV0@@Z # @@ -224,11 +224,11 @@ @ stub ??_Gstreambuf@@UAEPAXI@Z # @ stub ??_Gstrstream@@UAEPAXI@Z # @ stub ??_Gstrstreambuf@@UAEPAXI@Z # -@ cdecl ?_query_new_handler@@YAP6AHI@ZXZ() msvcrt.?_query_new_handler@@YAP6AHI@ZXZ -@ cdecl ?_query_new_mode@@YAHXZ() msvcrt.?_query_new_mode@@YAHXZ -@ cdecl ?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z(ptr) msvcrt.?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z -@ cdecl ?_set_new_mode@@YAHH@Z(long) msvcrt.?_set_new_mode@@YAHH@Z -@ cdecl ?_set_se_translator@@YAP6AXIPAU_EXCEPTION_POINTERS@@@ZP6AXI0@Z@Z(ptr) msvcrt.?_set_se_translator@@YAP6AXIPAU_EXCEPTION_POINTERS@@@ZP6AXI0@Z@Z +@ cdecl ?_query_new_handler@@YAP6AHI@ZXZ() MSVCRT__query_new_handler +@ cdecl ?_query_new_mode@@YAHXZ() MSVCRT__query_new_mode +@ cdecl ?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z(ptr) MSVCRT__set_new_handler +@ cdecl ?_set_new_mode@@YAHH@Z(long) MSVCRT__set_new_mode +@ cdecl ?_set_se_translator@@YAP6AXIPAU_EXCEPTION_POINTERS@@@ZP6AXI0@Z@Z(ptr) MSVCRT__set_se_translator @ stub ?adjustfield@ios@@2JB # @ stub ?allocate@streambuf@@IAEHXZ # @ stub ?attach@filebuf@@QAEPAV1@H@Z # @@ -363,8 +363,8 @@ @ stub ?seekp@ostream@@QAEAAV1@J@Z # @ stub ?seekp@ostream@@QAEAAV1@JW4seek_dir@ios@@@Z # @ stub ?seekpos@streambuf@@UAEJJH@Z # -@ cdecl ?set_terminate@@YAP6AXXZP6AXXZ@Z(ptr) msvcrt.?set_terminate@@YAP6AXXZP6AXXZ@Z -@ cdecl ?set_unexpected@@YAP6AXXZP6AXXZ@Z(ptr) msvcrt.?set_unexpected@@YAP6AXXZP6AXXZ@Z +@ cdecl ?set_terminate@@YAP6AXXZP6AXXZ@Z(ptr) MSVCRT_set_terminate +@ cdecl ?set_unexpected@@YAP6AXXZP6AXXZ@Z(ptr) MSVCRT_set_unexpected @ stub ?setb@streambuf@@IAEXPAD0H@Z # @ stub ?setbuf@filebuf@@UAEPAVstreambuf@@PADH@Z # @ stub ?setbuf@fstream@@QAEPAVstreambuf@@PADH@Z # @@ -407,7 +407,7 @@ @ stub ?sync_with_stdio@ios@@SAXXZ # @ stub ?tellg@istream@@QAEJXZ # @ stub ?tellp@ostream@@QAEJXZ # -@ cdecl ?terminate@@YAXXZ() msvcrt.?terminate@@YAXXZ +@ cdecl ?terminate@@YAXXZ() MSVCRT_terminate @ stub ?text@filebuf@@2HB # @ stub ?tie@ios@@QAEPAVostream@@PAV2@@Z # @ stub ?tie@ios@@QBEPAVostream@@XZ # @@ -416,7 +416,7 @@ @ stub ?underflow@filebuf@@UAEHXZ # @ stub ?underflow@stdiobuf@@UAEHXZ # @ stub ?underflow@strstreambuf@@UAEHXZ # -@ cdecl ?unexpected@@YAXXZ() msvcrt.?unexpected@@YAXXZ +@ cdecl ?unexpected@@YAXXZ() MSVCRT_unexpected @ stub ?unlock@ios@@QAAXXZ # @ stub ?unlock@streambuf@@QAEXXZ # @ stub ?unlockbuf@ios@@QAAXXZ # @@ -436,692 +436,692 @@ @ stub ?xalloc@ios@@SAHXZ # @ stub ?xsgetn@streambuf@@UAEHPADH@Z # @ stub ?xsputn@streambuf@@UAEHPBDH@Z # -@ cdecl $I10_OUTPUT() msvcrt.$I10_OUTPUT -@ cdecl -arch=i386 _CIacos() msvcrt._CIacos -@ cdecl -arch=i386 _CIasin() msvcrt._CIasin -@ cdecl -arch=i386 _CIatan() msvcrt._CIatan -@ cdecl -arch=i386 _CIatan2() msvcrt._CIatan2 -@ cdecl -arch=i386 _CIcos() msvcrt._CIcos -@ cdecl -arch=i386 _CIcosh() msvcrt._CIcosh -@ cdecl -arch=i386 _CIexp() msvcrt._CIexp -@ cdecl -arch=i386 _CIfmod() msvcrt._CIfmod -@ cdecl -arch=i386 _CIlog() msvcrt._CIlog -@ cdecl -arch=i386 _CIlog10() msvcrt._CIlog10 -@ cdecl -arch=i386 _CIpow() msvcrt._CIpow -@ cdecl -arch=i386 _CIsin() msvcrt._CIsin -@ cdecl -arch=i386 _CIsinh() msvcrt._CIsinh -@ cdecl -arch=i386 _CIsqrt() msvcrt._CIsqrt -@ cdecl -arch=i386 _CItan() msvcrt._CItan -@ cdecl -arch=i386 _CItanh() msvcrt._CItanh -@ stdcall _CxxThrowException(long long) msvcrt._CxxThrowException -@ extern _HUGE msvcrt._HUGE -@ cdecl _XcptFilter(long ptr) msvcrt._XcptFilter -@ cdecl -i386 __CxxFrameHandler(ptr ptr ptr ptr) msvcrt.__CxxFrameHandler -@ stdcall __CxxLongjmpUnwind(ptr) msvcrt.__CxxLongjmpUnwind -@ cdecl __STRINGTOLD(ptr ptr str long) msvcrt.__STRINGTOLD -@ extern __argc msvcrt.__argc -@ extern __argv msvcrt.__argv -@ cdecl __dllonexit(ptr ptr ptr) msvcrt.__dllonexit -@ cdecl __doserrno() msvcrt.__doserrno -@ cdecl __fpecode() msvcrt.__fpecode +@ cdecl $I10_OUTPUT() MSVCRT_I10_OUTPUT +@ cdecl -arch=i386 _CIacos() +@ cdecl -arch=i386 _CIasin() +@ cdecl -arch=i386 _CIatan() +@ cdecl -arch=i386 _CIatan2() +@ cdecl -arch=i386 _CIcos() +@ cdecl -arch=i386 _CIcosh() +@ cdecl -arch=i386 _CIexp() +@ cdecl -arch=i386 _CIfmod() +@ cdecl -arch=i386 _CIlog() +@ cdecl -arch=i386 _CIlog10() +@ cdecl -arch=i386 _CIpow() +@ cdecl -arch=i386 _CIsin() +@ cdecl -arch=i386 _CIsinh() +@ cdecl -arch=i386 _CIsqrt() +@ cdecl -arch=i386 _CItan() +@ cdecl -arch=i386 _CItanh() +@ stdcall _CxxThrowException(long long) +@ extern _HUGE +@ cdecl _XcptFilter(long ptr) +@ cdecl -i386 __CxxFrameHandler(ptr ptr ptr ptr) +@ stdcall __CxxLongjmpUnwind(ptr) +@ cdecl __STRINGTOLD(ptr ptr str long) +@ extern __argc +@ extern __argv +@ cdecl __dllonexit(ptr ptr ptr) +@ cdecl __doserrno() +@ cdecl __fpecode() @ cdecl __getmainargs(ptr ptr ptr long long) MSVCRT20__getmainargs -@ extern __initenv msvcrt.__initenv -@ cdecl __isascii(long) msvcrt.__isascii -@ cdecl __iscsym(long) msvcrt.__iscsym -@ cdecl __iscsymf(long) msvcrt.__iscsymf -@ cdecl __lconv_init() msvcrt.__lconv_init -@ extern __mb_cur_max msvcrt.__mb_cur_max -@ cdecl -arch=i386 __p___argc() msvcrt.__p___argc -@ cdecl -arch=i386 __p___argv() msvcrt.__p___argv -@ cdecl -arch=i386 __p___initenv() msvcrt.__p___initenv -@ cdecl -arch=i386 __p___mb_cur_max() msvcrt.__p___mb_cur_max -@ cdecl -arch=i386 __p___wargv() msvcrt.__p___wargv -@ cdecl -arch=i386 __p___winitenv() msvcrt.__p___winitenv -@ cdecl -arch=i386 __p__acmdln() msvcrt.__p__acmdln -@ cdecl -arch=i386 __p__amblksiz() msvcrt.__p__amblksiz -@ cdecl -arch=i386 __p__commode() msvcrt.__p__commode -@ cdecl -arch=i386 __p__daylight() msvcrt.__p__daylight -@ cdecl -arch=i386 __p__environ() msvcrt.__p__environ -@ cdecl -arch=i386 __p__fmode() msvcrt.__p__fmode -@ cdecl -arch=i386 __p__iob() msvcrt.__p__iob -@ cdecl -arch=i386 __p__mbctype() msvcrt.__p__mbctype -@ cdecl -arch=i386 __p__osver() msvcrt.__p__osver -@ cdecl -arch=i386 __p__pctype() msvcrt.__p__pctype -@ cdecl -arch=i386 __p__pgmptr() msvcrt.__p__pgmptr -@ cdecl -arch=i386 __p__pwctype() msvcrt.__p__pwctype -@ cdecl -arch=i386 __p__timezone() msvcrt.__p__timezone -@ cdecl -arch=i386 __p__tzname() msvcrt.__p__tzname -@ cdecl -arch=i386 __p__wcmdln() msvcrt.__p__wcmdln -@ cdecl -arch=i386 __p__wenviron() msvcrt.__p__wenviron -@ cdecl -arch=i386 __p__winmajor() msvcrt.__p__winmajor -@ cdecl -arch=i386 __p__winminor() msvcrt.__p__winminor -@ cdecl -arch=i386 __p__winver() msvcrt.__p__winver -@ cdecl -arch=i386 __p__wpgmptr() msvcrt.__p__wpgmptr -@ cdecl __pxcptinfoptrs() msvcrt.__pxcptinfoptrs -@ cdecl __threadhandle() msvcrt.__threadhandle -@ cdecl __threadid() msvcrt.__threadid -@ cdecl __toascii(long) msvcrt.__toascii -@ extern __wargv msvcrt.__wargv +@ extern __initenv +@ cdecl __isascii(long) +@ cdecl __iscsym(long) +@ cdecl __iscsymf(long) +@ cdecl __lconv_init() +@ extern __mb_cur_max +@ cdecl -arch=i386 __p___argc() +@ cdecl -arch=i386 __p___argv() +@ cdecl -arch=i386 __p___initenv() +@ cdecl -arch=i386 __p___mb_cur_max() +@ cdecl -arch=i386 __p___wargv() +@ cdecl -arch=i386 __p___winitenv() +@ cdecl -arch=i386 __p__acmdln() +@ cdecl -arch=i386 __p__amblksiz() +@ cdecl -arch=i386 __p__commode() +@ cdecl -arch=i386 __p__daylight() +@ cdecl -arch=i386 __p__environ() +@ cdecl -arch=i386 __p__fmode() +@ cdecl -arch=i386 __p__iob() +@ cdecl -arch=i386 __p__mbctype() +@ cdecl -arch=i386 __p__osver() +@ cdecl -arch=i386 __p__pctype() +@ cdecl -arch=i386 __p__pgmptr() +@ cdecl -arch=i386 __p__pwctype() +@ cdecl -arch=i386 __p__timezone() +@ cdecl -arch=i386 __p__tzname() +@ cdecl -arch=i386 __p__wcmdln() +@ cdecl -arch=i386 __p__wenviron() +@ cdecl -arch=i386 __p__winmajor() +@ cdecl -arch=i386 __p__winminor() +@ cdecl -arch=i386 __p__winver() +@ cdecl -arch=i386 __p__wpgmptr() +@ cdecl __pxcptinfoptrs() +@ cdecl __threadhandle() kernel32.GetCurrentThread +@ cdecl __threadid() kernel32.GetCurrentThreadId +@ cdecl __toascii(long) +@ extern __wargv @ cdecl __wgetmainargs(ptr ptr ptr long long) MSVCRT20__wgetmainargs -@ extern __winitenv msvcrt.__winitenv -@ cdecl _abnormal_termination() msvcrt._abnormal_termination -@ cdecl _access(str long) msvcrt._access -@ extern _acmdln msvcrt._acmdln -@ stdcall _adj_fdiv_m16i(long) msvcrt._adj_fdiv_m16i -@ stdcall _adj_fdiv_m32(long) msvcrt._adj_fdiv_m32 -@ stdcall _adj_fdiv_m32i(long) msvcrt._adj_fdiv_m32i -@ stdcall _adj_fdiv_m64(long long) msvcrt._adj_fdiv_m64 -@ cdecl _adj_fdiv_r() msvcrt._adj_fdiv_r -@ stdcall _adj_fdivr_m16i(long) msvcrt._adj_fdivr_m16i -@ stdcall _adj_fdivr_m32(long) msvcrt._adj_fdivr_m32 -@ stdcall _adj_fdivr_m32i(long) msvcrt._adj_fdivr_m32i -@ stdcall _adj_fdivr_m64(long long) msvcrt._adj_fdivr_m64 -@ cdecl _adj_fpatan() msvcrt._adj_fpatan -@ cdecl _adj_fprem() msvcrt._adj_fprem -@ cdecl _adj_fprem1() msvcrt._adj_fprem1 -@ cdecl _adj_fptan() msvcrt._adj_fptan -@ cdecl _adjust_fdiv() msvcrt._adjust_fdiv -@ extern _aexit_rtn msvcrt._aexit_rtn -@ cdecl _amsg_exit(long) msvcrt._amsg_exit -@ cdecl _assert(str str long) msvcrt._assert -@ cdecl _atodbl(ptr str) msvcrt._atodbl -@ cdecl _atoldbl(ptr str) msvcrt._atoldbl -@ cdecl _beep(long long) msvcrt._beep -@ cdecl _beginthread(ptr long ptr) msvcrt._beginthread -@ cdecl _beginthreadex(ptr long ptr ptr long ptr) msvcrt._beginthreadex -@ cdecl _c_exit() msvcrt._c_exit -@ cdecl _cabs(long) msvcrt._cabs -@ cdecl _cexit() msvcrt._cexit -@ cdecl _cgets(str) msvcrt._cgets -@ cdecl _chdir(str) msvcrt._chdir -@ cdecl _chdrive(long) msvcrt._chdrive -@ cdecl _chgsign( double ) msvcrt._chgsign -@ cdecl _chmod(str long) msvcrt._chmod -@ cdecl _chsize(long long) msvcrt._chsize -@ cdecl _clearfp() msvcrt._clearfp -@ cdecl _close(long) msvcrt._close -@ cdecl _commit(long) msvcrt._commit -@ extern _commode msvcrt._commode -@ cdecl _control87(long long) msvcrt._control87 -@ cdecl _controlfp(long long) msvcrt._controlfp -@ cdecl _copysign( double double ) msvcrt._copysign -@ varargs _cprintf(str) msvcrt._cprintf -@ cdecl _cputs(str) msvcrt._cputs -@ cdecl _creat(str long) msvcrt._creat -@ varargs _cscanf(str) msvcrt._cscanf -@ extern _ctype msvcrt._ctype -@ cdecl _cwait(ptr long long) msvcrt._cwait -@ extern _daylight msvcrt._daylight -@ cdecl _dup(long) msvcrt._dup -@ cdecl _dup2(long long) msvcrt._dup2 -@ cdecl _ecvt( double long ptr ptr) msvcrt._ecvt -@ cdecl _endthread() msvcrt._endthread -@ cdecl _endthreadex(long) msvcrt._endthreadex -@ extern _environ msvcrt._environ -@ cdecl _eof(long) msvcrt._eof -@ cdecl _errno() msvcrt._errno -@ cdecl _except_handler2(ptr ptr ptr ptr) msvcrt._except_handler2 -@ cdecl _except_handler3(ptr ptr ptr ptr) msvcrt._except_handler3 -@ varargs _execl(str str) msvcrt._execl -@ varargs _execle(str str) msvcrt._execle -@ varargs _execlp(str str) msvcrt._execlp -@ varargs _execlpe(str str) msvcrt._execlpe -@ cdecl _execv(str ptr) msvcrt._execv -@ cdecl _execve(str ptr ptr) msvcrt._execve -@ cdecl _execvp(str ptr) msvcrt._execvp -@ cdecl _execvpe(str ptr ptr) msvcrt._execvpe -@ cdecl _exit(long) msvcrt._exit -@ cdecl _expand(ptr long) msvcrt._expand -@ cdecl _fcloseall() msvcrt._fcloseall -@ cdecl _fcvt( double long ptr ptr) msvcrt._fcvt -@ cdecl _fdopen(long str) msvcrt._fdopen -@ cdecl _fgetchar() msvcrt._fgetchar -@ cdecl _fgetwchar() msvcrt._fgetwchar -@ cdecl _filbuf(ptr) msvcrt._filbuf -@ extern _fileinfo msvcrt._fileinfo -@ cdecl _filelength(long) msvcrt._filelength -@ cdecl _fileno(ptr) msvcrt._fileno -@ cdecl _findclose(long) msvcrt._findclose -@ cdecl _findfirst(str ptr) msvcrt._findfirst -@ cdecl _findnext(long ptr) msvcrt._findnext -@ cdecl _finite( double ) msvcrt._finite -@ cdecl _flsbuf(long ptr) msvcrt._flsbuf -@ cdecl _flushall() msvcrt._flushall -@ extern _fmode msvcrt._fmode -@ cdecl _fpclass(double) msvcrt._fpclass -@ cdecl _fpieee_flt(long ptr ptr) msvcrt._fpieee_flt -@ cdecl _fpreset() msvcrt._fpreset -@ cdecl _fputchar(long) msvcrt._fputchar -@ cdecl _fputwchar(long) msvcrt._fputwchar -@ cdecl _fsopen(str str long) msvcrt._fsopen -@ cdecl _fstat(long ptr) msvcrt._fstat -@ cdecl _ftime(ptr) msvcrt._ftime -@ cdecl -ret64 _ftol() msvcrt._ftol -@ cdecl _fullpath(ptr str long) msvcrt._fullpath -@ cdecl _futime(long ptr) msvcrt._futime -@ cdecl _gcvt( double long str) msvcrt._gcvt -@ cdecl _get_osfhandle(long) msvcrt._get_osfhandle -@ cdecl _getch() msvcrt._getch -@ cdecl _getche() msvcrt._getche -@ cdecl _getcwd(str long) msvcrt._getcwd -@ cdecl _getdcwd(long str long) msvcrt._getdcwd -@ cdecl _getdiskfree(long ptr) msvcrt._getdiskfree -@ cdecl _getdllprocaddr(long str long) msvcrt._getdllprocaddr -@ cdecl _getdrive() msvcrt._getdrive -@ cdecl _getdrives() msvcrt._getdrives -@ cdecl _getmbcp() msvcrt._getmbcp -@ cdecl _getpid() msvcrt._getpid -@ cdecl _getsystime(ptr) msvcrt._getsystime -@ cdecl _getw(ptr) msvcrt._getw -@ cdecl _getws(ptr) msvcrt._getws -@ cdecl _global_unwind2(ptr) msvcrt._global_unwind2 -@ cdecl _heapadd(ptr long) msvcrt._heapadd -@ cdecl _heapchk() msvcrt._heapchk -@ cdecl _heapmin() msvcrt._heapmin -@ cdecl _heapset(long) msvcrt._heapset -@ cdecl _heapused(ptr ptr) msvcrt._heapused -@ cdecl _heapwalk(ptr) msvcrt._heapwalk -@ cdecl _hypot(double double) msvcrt._hypot -@ cdecl _initterm(ptr ptr) msvcrt._initterm -@ extern _iob msvcrt._iob -@ cdecl _isatty(long) msvcrt._isatty -@ cdecl _isctype(long long) msvcrt._isctype -@ cdecl _ismbbalnum(long) msvcrt._ismbbalnum -@ cdecl _ismbbalpha(long) msvcrt._ismbbalpha -@ cdecl _ismbbgraph(long) msvcrt._ismbbgraph -@ cdecl _ismbbkalnum(long) msvcrt._ismbbkalnum -@ cdecl _ismbbkana(long) msvcrt._ismbbkana -@ cdecl _ismbbkprint(long) msvcrt._ismbbkprint -@ cdecl _ismbbkpunct(long) msvcrt._ismbbkpunct -@ cdecl _ismbblead(long) msvcrt._ismbblead -@ cdecl _ismbbprint(long) msvcrt._ismbbprint -@ cdecl _ismbbpunct(long) msvcrt._ismbbpunct -@ cdecl _ismbbtrail(long) msvcrt._ismbbtrail -@ cdecl _ismbcalnum(long) msvcrt._ismbcalnum -@ cdecl _ismbcalpha(long) msvcrt._ismbcalpha -@ cdecl _ismbcdigit(long) msvcrt._ismbcdigit -@ cdecl _ismbcgraph(long) msvcrt._ismbcgraph -@ cdecl _ismbchira(long) msvcrt._ismbchira -@ cdecl _ismbckata(long) msvcrt._ismbckata -@ cdecl _ismbcl0(long) msvcrt._ismbcl0 -@ cdecl _ismbcl1(long) msvcrt._ismbcl1 -@ cdecl _ismbcl2(long) msvcrt._ismbcl2 -@ cdecl _ismbclegal(long) msvcrt._ismbclegal -@ cdecl _ismbclower(long) msvcrt._ismbclower -@ cdecl _ismbcprint(long) msvcrt._ismbcprint -@ cdecl _ismbcpunct(long) msvcrt._ismbcpunct -@ cdecl _ismbcspace(long) msvcrt._ismbcspace -@ cdecl _ismbcsymbol(long) msvcrt._ismbcsymbol -@ cdecl _ismbcupper(long) msvcrt._ismbcupper -@ cdecl _ismbslead(ptr ptr) msvcrt._ismbslead -@ cdecl _ismbstrail(ptr ptr) msvcrt._ismbstrail -@ cdecl _isnan( double ) msvcrt._isnan -@ cdecl _itoa(long ptr long) msvcrt._itoa -@ cdecl _itow(long ptr long) msvcrt._itow -@ cdecl _j0(double) msvcrt._j0 -@ cdecl _j1(double) msvcrt._j1 -@ cdecl _jn(long double) msvcrt._jn -@ cdecl _kbhit() msvcrt._kbhit -@ cdecl _lfind(ptr ptr ptr long ptr) msvcrt._lfind -@ cdecl _loaddll(str) msvcrt._loaddll -@ cdecl _local_unwind2(ptr long) msvcrt._local_unwind2 -@ cdecl _locking(long long long) msvcrt._locking -@ cdecl _logb(double) msvcrt._logb -@ cdecl _longjmpex(ptr long) msvcrt._longjmpex -@ cdecl _lrotl(long long) msvcrt._lrotl -@ cdecl _lrotr(long long) msvcrt._lrotr -@ cdecl _lsearch(ptr ptr long long ptr) msvcrt._lsearch -@ cdecl _lseek(long long long) msvcrt._lseek -@ cdecl _ltoa(long ptr long) msvcrt._ltoa -@ cdecl _ltow(long ptr long) msvcrt._ltow -@ cdecl _makepath(str str str str str) msvcrt._makepath -@ cdecl _matherr(ptr) msvcrt._matherr -@ cdecl _mbbtombc(long) msvcrt._mbbtombc -@ cdecl _mbbtype(long long) msvcrt._mbbtype -@ cdecl _mbccpy(str str) msvcrt._mbccpy -@ cdecl _mbcjistojms(long) msvcrt._mbcjistojms -@ cdecl _mbcjmstojis(long) msvcrt._mbcjmstojis -@ cdecl _mbclen(ptr) msvcrt._mbclen -@ cdecl _mbctohira(long) msvcrt._mbctohira -@ cdecl _mbctokata(long) msvcrt._mbctokata -@ cdecl _mbctolower(long) msvcrt._mbctolower -@ cdecl _mbctombb(long) msvcrt._mbctombb -@ cdecl _mbctoupper(long) msvcrt._mbctoupper -@ extern _mbctype msvcrt._mbctype -@ cdecl _mbsbtype(str long) msvcrt._mbsbtype -@ cdecl _mbscat(str str) msvcrt._mbscat -@ cdecl _mbschr(str long) msvcrt._mbschr -@ cdecl _mbscmp(str str) msvcrt._mbscmp -@ cdecl _mbscoll(str str) msvcrt._mbscoll -@ cdecl _mbscpy(ptr str) msvcrt._mbscpy -@ cdecl _mbscspn(str str) msvcrt._mbscspn -@ cdecl _mbsdec(ptr ptr) msvcrt._mbsdec -@ cdecl _mbsdup(str) msvcrt._mbsdup -@ cdecl _mbsicmp(str str) msvcrt._mbsicmp -@ cdecl _mbsicoll(str str) msvcrt._mbsicoll -@ cdecl _mbsinc(str) msvcrt._mbsinc -@ cdecl _mbslen(str) msvcrt._mbslen -@ cdecl _mbslwr(str) msvcrt._mbslwr -@ cdecl _mbsnbcat(str str long) msvcrt._mbsnbcat -@ cdecl _mbsnbcmp(str str long) msvcrt._mbsnbcmp -@ cdecl _mbsnbcnt(ptr long) msvcrt._mbsnbcnt -@ cdecl _mbsnbcoll(str str long) msvcrt._mbsnbcoll -@ cdecl _mbsnbcpy(ptr str long) msvcrt._mbsnbcpy -@ cdecl _mbsnbicmp(str str long) msvcrt._mbsnbicmp -@ cdecl _mbsnbicoll(str str long) msvcrt._mbsnbicoll -@ cdecl _mbsnbset(str long long) msvcrt._mbsnbset -@ cdecl _mbsncat(str str long) msvcrt._mbsncat -@ cdecl _mbsnccnt(str long) msvcrt._mbsnccnt -@ cdecl _mbsncmp(str str long) msvcrt._mbsncmp -@ cdecl _mbsncoll(str str long) msvcrt._mbsncoll -@ cdecl _mbsncpy(str str long) msvcrt._mbsncpy -@ cdecl _mbsnextc(str) msvcrt._mbsnextc -@ cdecl _mbsnicmp(str str long) msvcrt._mbsnicmp -@ cdecl _mbsnicoll(str str long) msvcrt._mbsnicoll -@ cdecl _mbsninc(str long) msvcrt._mbsninc -@ cdecl _mbsnset(str long long) msvcrt._mbsnset -@ cdecl _mbspbrk(str str) msvcrt._mbspbrk -@ cdecl _mbsrchr(str long) msvcrt._mbsrchr -@ cdecl _mbsrev(str) msvcrt._mbsrev -@ cdecl _mbsset(str long) msvcrt._mbsset -@ cdecl _mbsspn(str str) msvcrt._mbsspn -@ cdecl _mbsspnp(str str) msvcrt._mbsspnp -@ cdecl _mbsstr(str str) msvcrt._mbsstr -@ cdecl _mbstok(str str) msvcrt._mbstok -@ cdecl _mbstrlen(str) msvcrt._mbstrlen -@ cdecl _mbsupr(str) msvcrt._mbsupr -@ cdecl _memccpy(ptr ptr long long) msvcrt._memccpy -@ cdecl _memicmp(str str long) msvcrt._memicmp -@ cdecl _mkdir(str) msvcrt._mkdir -@ cdecl _mktemp(str) msvcrt._mktemp -@ cdecl _msize(ptr) msvcrt._msize +@ extern __winitenv +@ cdecl _abnormal_termination() +@ cdecl _access(str long) +@ extern _acmdln +@ stdcall _adj_fdiv_m16i(long) +@ stdcall _adj_fdiv_m32(long) +@ stdcall _adj_fdiv_m32i(long) +@ stdcall _adj_fdiv_m64(double) +@ cdecl _adj_fdiv_r() +@ stdcall _adj_fdivr_m16i(long) +@ stdcall _adj_fdivr_m32(long) +@ stdcall _adj_fdivr_m32i(long) +@ stdcall _adj_fdivr_m64(double) +@ cdecl _adj_fpatan() +@ cdecl _adj_fprem() +@ cdecl _adj_fprem1() +@ cdecl _adj_fptan() +@ extern _adjust_fdiv +@ extern _aexit_rtn +@ cdecl _amsg_exit(long) +@ cdecl _assert(str str long) +@ cdecl _atodbl(ptr str) +@ cdecl _atoldbl(ptr str) +@ cdecl _beep(long long) +@ cdecl _beginthread(ptr long ptr) +@ cdecl _beginthreadex(ptr long ptr ptr long ptr) +@ cdecl _c_exit() +@ cdecl _cabs(long) +@ cdecl _cexit() +@ cdecl _cgets(str) +@ cdecl _chdir(str) +@ cdecl _chdrive(long) +@ cdecl _chgsign(double) +@ cdecl _chmod(str long) +@ cdecl _chsize(long long) +@ cdecl _clearfp() +@ cdecl _close(long) +@ cdecl _commit(long) +@ extern _commode +@ cdecl _control87(long long) +@ cdecl _controlfp(long long) +@ cdecl _copysign( double double ) +@ varargs _cprintf(str) +@ cdecl _cputs(str) +@ cdecl _creat(str long) +@ varargs _cscanf(str) +@ extern _ctype +@ cdecl _cwait(ptr long long) +@ extern _daylight +@ cdecl _dup(long) +@ cdecl _dup2(long long) +@ cdecl _ecvt(double long ptr ptr) +@ cdecl _endthread() +@ cdecl _endthreadex(long) +@ extern _environ +@ cdecl _eof(long) +@ cdecl _errno() +@ cdecl _except_handler2(ptr ptr ptr ptr) +@ cdecl _except_handler3(ptr ptr ptr ptr) +@ varargs _execl(str str) +@ varargs _execle(str str) +@ varargs _execlp(str str) +@ varargs _execlpe(str str) +@ cdecl _execv(str ptr) +@ cdecl _execve(str ptr ptr) +@ cdecl _execvp(str ptr) +@ cdecl _execvpe(str ptr ptr) +@ cdecl _exit(long) +@ cdecl _expand(ptr long) +@ cdecl _fcloseall() +@ cdecl _fcvt(double long ptr ptr) +@ cdecl _fdopen(long str) +@ cdecl _fgetchar() +@ cdecl _fgetwchar() +@ cdecl _filbuf(ptr) +@ extern _fileinfo +@ cdecl _filelength(long) +@ cdecl _fileno(ptr) +@ cdecl _findclose(long) +@ cdecl _findfirst(str ptr) +@ cdecl _findnext(long ptr) +@ cdecl _finite( double ) +@ cdecl _flsbuf(long ptr) +@ cdecl _flushall() +@ extern _fmode +@ cdecl _fpclass(double) +@ cdecl _fpieee_flt(long ptr ptr) +@ cdecl _fpreset() +@ cdecl _fputchar(long) +@ cdecl _fputwchar(long) +@ cdecl _fsopen(str str long) +@ cdecl _fstat(long ptr) +@ cdecl _ftime(ptr) +@ cdecl -ret64 _ftol() +@ cdecl _fullpath(ptr str long) +@ cdecl _futime(long ptr) +@ cdecl _gcvt(double long str) +@ cdecl _get_osfhandle(long) +@ cdecl _getch() +@ cdecl _getche() +@ cdecl _getcwd(str long) +@ cdecl _getdcwd(long str long) +@ cdecl _getdiskfree(long ptr) +@ cdecl _getdllprocaddr(long str long) +@ cdecl _getdrive() +@ cdecl _getdrives() kernel32.GetLogicalDrives +@ cdecl _getmbcp() +@ cdecl _getpid() kernel32.GetCurrentProcessId +@ cdecl _getsystime(ptr) +@ cdecl _getw(ptr) +@ cdecl _getws(ptr) +@ cdecl _global_unwind2(ptr) +@ cdecl _heapadd(ptr long) +@ cdecl _heapchk() +@ cdecl _heapmin() +@ cdecl _heapset(long) +@ cdecl _heapused(ptr ptr) +@ cdecl _heapwalk(ptr) +@ cdecl _hypot(double double) +@ cdecl _initterm(ptr ptr) +@ extern _iob +@ cdecl _isatty(long) +@ cdecl _isctype(long long) +@ cdecl _ismbbalnum(long) +@ cdecl _ismbbalpha(long) +@ cdecl _ismbbgraph(long) +@ cdecl _ismbbkalnum(long) +@ cdecl _ismbbkana(long) +@ cdecl _ismbbkprint(long) +@ cdecl _ismbbkpunct(long) +@ cdecl _ismbblead(long) +@ cdecl _ismbbprint(long) +@ cdecl _ismbbpunct(long) +@ cdecl _ismbbtrail(long) +@ cdecl _ismbcalnum(long) +@ cdecl _ismbcalpha(long) +@ cdecl _ismbcdigit(long) +@ cdecl _ismbcgraph(long) +@ cdecl _ismbchira(long) +@ cdecl _ismbckata(long) +@ cdecl _ismbcl0(long) +@ cdecl _ismbcl1(long) +@ cdecl _ismbcl2(long) +@ cdecl _ismbclegal(long) +@ cdecl _ismbclower(long) +@ cdecl _ismbcprint(long) +@ cdecl _ismbcpunct(long) +@ cdecl _ismbcspace(long) +@ cdecl _ismbcsymbol(long) +@ cdecl _ismbcupper(long) +@ cdecl _ismbslead(ptr ptr) +@ cdecl _ismbstrail(ptr ptr) +@ cdecl _isnan(double) +@ cdecl _itoa(long ptr long) +@ cdecl _itow(long ptr long) +@ cdecl _j0(double) +@ cdecl _j1(double) +@ cdecl _jn(long double) +@ cdecl _kbhit() +@ cdecl _lfind(ptr ptr ptr long ptr) +@ cdecl _loaddll(str) +@ cdecl _local_unwind2(ptr long) +@ cdecl _locking(long long long) +@ cdecl _logb(double) +@ cdecl _longjmpex(ptr long) longjmp +@ cdecl _lrotl(long long) +@ cdecl _lrotr(long long) +@ cdecl _lsearch(ptr ptr long long ptr) +@ cdecl _lseek(long long long) +@ cdecl _ltoa(long ptr long) +@ cdecl _ltow(long ptr long) +@ cdecl _makepath(ptr str str str str) +@ cdecl _matherr(ptr) +@ cdecl _mbbtombc(long) +@ cdecl _mbbtype(long long) +@ cdecl _mbccpy(str str) +@ cdecl _mbcjistojms(long) +@ cdecl _mbcjmstojis(long) +@ cdecl _mbclen(ptr) +@ cdecl _mbctohira(long) +@ cdecl _mbctokata(long) +@ cdecl _mbctolower(long) +@ cdecl _mbctombb(long) +@ cdecl _mbctoupper(long) +@ extern _mbctype +@ cdecl _mbsbtype(str long) +@ cdecl _mbscat(str str) +@ cdecl _mbschr(str long) +@ cdecl _mbscmp(str str) +@ cdecl _mbscoll(str str) +@ cdecl _mbscpy(ptr str) +@ cdecl _mbscspn(str str) +@ cdecl _mbsdec(ptr ptr) +@ cdecl _mbsdup(str) +@ cdecl _mbsicmp(str str) +@ cdecl _mbsicoll(str str) +@ cdecl _mbsinc(str) +@ cdecl _mbslen(str) +@ cdecl _mbslwr(str) +@ cdecl _mbsnbcat(str str long) +@ cdecl _mbsnbcmp(str str long) +@ cdecl _mbsnbcnt(ptr long) +@ cdecl _mbsnbcoll(str str long) +@ cdecl _mbsnbcpy(ptr str long) +@ cdecl _mbsnbicmp(str str long) +@ cdecl _mbsnbicoll(str str long) +@ cdecl _mbsnbset(str long long) +@ cdecl _mbsncat(str str long) +@ cdecl _mbsnccnt(str long) +@ cdecl _mbsncmp(str str long) +@ cdecl _mbsncoll(str str long) +@ cdecl _mbsncpy(str str long) +@ cdecl _mbsnextc(str) +@ cdecl _mbsnicmp(str str long) +@ cdecl _mbsnicoll(str str long) +@ cdecl _mbsninc(str long) +@ cdecl _mbsnset(str long long) +@ cdecl _mbspbrk(str str) +@ cdecl _mbsrchr(str long) +@ cdecl _mbsrev(str) +@ cdecl _mbsset(str long) +@ cdecl _mbsspn(str str) +@ cdecl _mbsspnp(str str) +@ cdecl _mbsstr(str str) +@ cdecl _mbstok(str str) +@ cdecl _mbstrlen(str) +@ cdecl _mbsupr(str) +@ cdecl _memccpy(ptr ptr long long) +@ cdecl _memicmp(str str long) +@ cdecl _mkdir(str) +@ cdecl _mktemp(str) +@ cdecl _msize(ptr) @ stub _mtlock @ stub _mtunlock -@ cdecl _nextafter(double double) msvcrt._nextafter -@ cdecl _onexit(ptr) msvcrt._onexit -@ varargs _open(str long) msvcrt._open -@ cdecl _open_osfhandle(long long) msvcrt._open_osfhandle -@ extern _osver msvcrt._osver -@ cdecl _pclose(ptr) msvcrt._pclose -@ extern _pctype msvcrt._pctype -@ extern _pgmptr msvcrt._pgmptr -@ cdecl _pipe(ptr long long) msvcrt._pipe -@ cdecl _popen(str str) msvcrt._popen -@ cdecl _purecall() msvcrt._purecall -@ cdecl _putch(long) msvcrt._putch -@ cdecl _putenv(str) msvcrt._putenv -@ cdecl _putw(long ptr) msvcrt._putw -@ cdecl _putws(wstr) msvcrt._putws -@ extern _pwctype msvcrt._pwctype -@ cdecl _read(long ptr long) msvcrt._read -@ cdecl _rmdir(str) msvcrt._rmdir -@ cdecl _rmtmp() msvcrt._rmtmp -@ cdecl _rotl(long long) msvcrt._rotl -@ cdecl _rotr(long long) msvcrt._rotr -@ cdecl _safe_fdiv() msvcrt._safe_fdiv -@ cdecl _safe_fdivr() msvcrt._safe_fdivr -@ cdecl _safe_fprem() msvcrt._safe_fprem -@ cdecl _safe_fprem1() msvcrt._safe_fprem1 -@ cdecl _scalb( double long) msvcrt._scalb -@ cdecl _searchenv(str str ptr) msvcrt._searchenv -@ stdcall -i386 __seh_longjmp_unwind@4(ptr) msvcrt._seh_longjmp_unwind -@ cdecl _seterrormode(long) msvcrt._seterrormode -@ cdecl -i386 _setjmp(ptr) msvcrt._setjmp -@ cdecl -i386 _setjmp3(ptr long) msvcrt._setjmp3 -@ cdecl _setmbcp(long) msvcrt._setmbcp -@ cdecl _setmode(long long) msvcrt._setmode -@ cdecl _setsystime(ptr long) msvcrt._setsystime -@ cdecl _sleep(long) msvcrt._sleep -@ varargs _snprintf(str long str) msvcrt._snprintf -@ varargs _snwprintf(wstr long wstr) msvcrt._snwprintf -@ varargs _sopen(str long long) msvcrt._sopen -@ varargs _spawnl(long str str) msvcrt._spawnl -@ varargs _spawnle(long str str) msvcrt._spawnle -@ varargs _spawnlp(long str str) msvcrt._spawnlp -@ varargs _spawnlpe(long str str) msvcrt._spawnlpe -@ cdecl _spawnv(long str ptr) msvcrt._spawnv -@ cdecl _spawnve(long str ptr ptr) msvcrt._spawnve -@ cdecl _spawnvp(long str ptr) msvcrt._spawnvp -@ cdecl _spawnvpe(long str ptr ptr) msvcrt._spawnvpe -@ cdecl _splitpath(str ptr ptr ptr ptr) msvcrt._splitpath -@ cdecl _stat(str ptr) msvcrt._stat -@ cdecl _statusfp() msvcrt._statusfp -@ cdecl _strcmpi(str str) msvcrt._strcmpi -@ cdecl _strdate(ptr) msvcrt._strdate -@ cdecl _strdup(str) msvcrt._strdup -@ cdecl _strerror(long) msvcrt._strerror -@ cdecl _stricmp(str str) msvcrt._stricmp -@ cdecl _stricoll(str str) msvcrt._stricoll -@ cdecl _strlwr(str) msvcrt._strlwr -@ cdecl _strncoll(str str long) msvcrt._strncoll -@ cdecl _strnicmp(str str long) msvcrt._strnicmp -@ cdecl _strnicoll(str str long) msvcrt._strnicoll -@ cdecl _strnset(str long long) msvcrt._strnset -@ cdecl _strrev(str) msvcrt._strrev -@ cdecl _strset(str long) msvcrt._strset -@ cdecl _strtime(ptr) msvcrt._strtime -@ cdecl _strupr(str) msvcrt._strupr -@ cdecl _swab(str str long) msvcrt._swab -@ extern _sys_errlist msvcrt._sys_errlist -@ extern _sys_nerr msvcrt._sys_nerr -@ cdecl _tccpy(str str) msvcrt._mbccpy -@ cdecl _tclen(ptr) msvcrt._mbclen -@ cdecl _tcschr(str long) msvcrt._mbschr -@ cdecl _tcsclen(str) msvcrt._mbslen -@ cdecl _tcscmp(str str) msvcrt._mbscmp -@ cdecl _tcscspn(str str) msvcrt._mbscspn -@ cdecl _tcsdec(ptr ptr) msvcrt._mbsdec -@ cdecl _tcsicmp(str str) msvcrt._mbsicmp -@ cdecl _tcsinc(str) msvcrt._mbsinc -@ cdecl _tcslwr(str) msvcrt._mbslwr -@ cdecl _tcsnbcnt(ptr long) msvcrt._mbsnbcnt -@ cdecl _tcsncat(str str long) msvcrt._mbsnbcat -@ cdecl _tcsnccat(str str long) msvcrt._mbsncat -@ cdecl _tcsnccmp(str str long) msvcrt._mbsncmp -@ cdecl _tcsnccnt(str long) msvcrt._mbsnccnt -@ cdecl _tcsnccpy(str str long) msvcrt._mbsncpy -@ cdecl _tcsncicmp(str str long) msvcrt._mbsnicmp -@ cdecl _tcsncmp(str str long) msvcrt._mbsnbcmp -@ cdecl _tcsncpy(ptr str long) msvcrt._mbsnbcpy -@ cdecl _tcsncset(str long long) msvcrt._mbsnset -@ cdecl _tcsnextc(str) msvcrt._mbsnextc -@ cdecl _tcsnicmp(str str long) msvcrt._mbsnbicmp -@ cdecl _tcsninc(str long) msvcrt._mbsninc -@ cdecl _tcsnset(str long long) msvcrt._mbsnbset -@ cdecl _tcspbrk(str str) msvcrt._mbspbrk -@ cdecl _tcsrchr(str long) msvcrt._mbsrchr -@ cdecl _tcsrev(str) msvcrt._mbsrev -@ cdecl _tcsset(str long) msvcrt._mbsset -@ cdecl _tcsspn(str str) msvcrt._mbsspn -@ cdecl _tcsspnp(str str) msvcrt._mbsspnp -@ cdecl _tcsstr(str str) msvcrt._mbsstr -@ cdecl _tcstok(str str) msvcrt._mbstok -@ cdecl _tcsupr(str) msvcrt._mbsupr -@ cdecl _tell(long) msvcrt._tell -@ cdecl _tempnam(str str) msvcrt._tempnam -@ extern _timezone msvcrt._timezone -@ cdecl _tolower(long) msvcrt._tolower -@ cdecl _toupper(long) msvcrt._toupper -@ extern _tzname msvcrt._tzname -@ cdecl _tzset() msvcrt._tzset -@ cdecl _ultoa(long ptr long) msvcrt._ultoa -@ cdecl _ultow(long ptr long) msvcrt._ultow -@ cdecl _umask(long) msvcrt._umask -@ cdecl _ungetch(long) msvcrt._ungetch -@ cdecl _unlink(str) msvcrt._unlink -@ cdecl _unloaddll(long) msvcrt._unloaddll -@ cdecl _utime(str ptr) msvcrt._utime -@ cdecl _vsnprintf(ptr long ptr ptr) msvcrt._vsnprintf -@ cdecl _vsnwprintf(ptr long wstr long) msvcrt._vsnwprintf -@ cdecl _waccess(wstr long) msvcrt._waccess -@ cdecl _wasctime(ptr) msvcrt._wasctime -@ cdecl _wchdir(wstr) msvcrt._wchdir -@ cdecl _wchmod(wstr long) msvcrt._wchmod -@ extern _wcmdln msvcrt._wcmdln -@ cdecl _wcreat(wstr long) msvcrt._wcreat -@ cdecl _wcsdup(wstr) msvcrt._wcsdup -@ cdecl _wcsicmp(wstr wstr) msvcrt._wcsicmp -@ cdecl _wcsicoll(wstr wstr) msvcrt._wcsicoll -@ cdecl _wcslwr(wstr) msvcrt._wcslwr -@ cdecl _wcsncoll(wstr wstr long) msvcrt._wcsncoll -@ cdecl _wcsnicmp(wstr wstr long) msvcrt._wcsnicmp -@ cdecl _wcsnicoll(wstr wstr long) msvcrt._wcsnicoll -@ cdecl _wcsnset(wstr long long) msvcrt._wcsnset -@ cdecl _wcsrev(wstr) msvcrt._wcsrev -@ cdecl _wcsset(wstr long) msvcrt._wcsset -@ cdecl _wcsupr(wstr) msvcrt._wcsupr -@ cdecl _wctime(ptr) msvcrt._wctime -@ extern _wenviron msvcrt._wenviron -@ varargs _wexecl(wstr wstr) msvcrt._wexecl -@ varargs _wexecle(wstr wstr) msvcrt._wexecle -@ varargs _wexeclp(wstr wstr) msvcrt._wexeclp -@ varargs _wexeclpe(wstr wstr) msvcrt._wexeclpe -@ varargs _wexecv(wstr ptr) msvcrt._wexecv -@ varargs _wexecve(wstr ptr ptr) msvcrt._wexecve -@ varargs _wexecvp(wstr ptr) msvcrt._wexecvp -@ varargs _wexecvpe(wstr ptr ptr) msvcrt._wexecvpe -@ cdecl _wfdopen(long wstr) msvcrt._wfdopen -@ cdecl _wfindfirst(wstr ptr) msvcrt._wfindfirst -@ cdecl _wfindnext(long ptr) msvcrt._wfindnext -@ cdecl _wfopen(wstr wstr) msvcrt._wfopen -@ cdecl _wfreopen(wstr wstr ptr) msvcrt._wfreopen -@ cdecl _wfsopen(wstr wstr long) msvcrt._wfsopen -@ cdecl _wfullpath(ptr wstr long) msvcrt._wfullpath -@ cdecl _wgetcwd(wstr long) msvcrt._wgetcwd -@ cdecl _wgetdcwd(long wstr long) msvcrt._wgetdcwd -@ cdecl _wgetenv(wstr) msvcrt._wgetenv -@ extern _winmajor msvcrt._winmajor -@ extern _winminor msvcrt._winminor -@ extern _winver msvcrt._winver -@ cdecl _wmakepath(wstr wstr wstr wstr wstr) msvcrt._wmakepath -@ cdecl _wmkdir(wstr) msvcrt._wmkdir -@ cdecl _wmktemp(wstr) msvcrt._wmktemp -@ varargs _wopen(wstr long) msvcrt._wopen -@ cdecl _wperror(wstr) msvcrt._wperror -@ extern _wpgmptr msvcrt._wpgmptr -@ cdecl _wpopen(wstr wstr) msvcrt._wpopen -@ cdecl _wputenv(wstr) msvcrt._wputenv -@ cdecl _wremove(wstr) msvcrt._wremove -@ cdecl _wrename(wstr wstr) msvcrt._wrename -@ cdecl _write(long ptr long) msvcrt._write -@ cdecl _wrmdir(wstr) msvcrt._wrmdir -@ cdecl _wsearchenv(wstr wstr ptr) msvcrt._wsearchenv -@ cdecl _wsetlocale(long wstr) msvcrt._wsetlocale -@ varargs _wsopen(wstr long long) msvcrt._wsopen -@ varargs _wspawnl(long wstr wstr) msvcrt._wspawnl -@ varargs _wspawnle(long wstr wstr) msvcrt._wspawnle -@ varargs _wspawnlp(long wstr wstr) msvcrt._wspawnlp -@ varargs _wspawnlpe(long wstr wstr) msvcrt._wspawnlpe -@ cdecl _wspawnv(long wstr ptr) msvcrt._wspawnv -@ cdecl _wspawnve(long wstr ptr ptr) msvcrt._wspawnve -@ cdecl _wspawnvp(long wstr ptr) msvcrt._wspawnvp -@ cdecl _wspawnvpe(long wstr ptr ptr) msvcrt._wspawnvpe -@ cdecl _wsplitpath(wstr wstr wstr wstr wstr) msvcrt._wsplitpath -@ cdecl _wstat(wstr ptr) msvcrt._wstat -@ cdecl _wstrdate(ptr) msvcrt._wstrdate -@ cdecl _wstrtime(ptr) msvcrt._wstrtime -@ cdecl _wsystem(wstr) msvcrt._wsystem -@ cdecl _wtempnam(wstr wstr) msvcrt._wtempnam -@ cdecl _wtmpnam(ptr) msvcrt._wtmpnam -@ cdecl _wtoi(wstr) msvcrt._wtoi -@ cdecl _wtol(wstr) msvcrt._wtol -@ cdecl _wunlink(wstr) msvcrt._wunlink -@ cdecl _wutime(wstr ptr) msvcrt._wutime -@ cdecl _y0(double) msvcrt._y0 -@ cdecl _y1(double) msvcrt._y1 -@ cdecl _yn(long double ) msvcrt._yn -@ cdecl abort() msvcrt.abort -@ cdecl abs(long) msvcrt.abs -@ cdecl acos(double) msvcrt.acos -@ cdecl asctime(ptr) msvcrt.asctime -@ cdecl asin(double) msvcrt.asin -@ cdecl atan(double) msvcrt.atan -@ cdecl atan2(double double) msvcrt.atan2 -@ cdecl atexit(ptr) msvcrt.atexit -@ cdecl atof(str) msvcrt.atof -@ cdecl atoi(str) msvcrt.atoi -@ cdecl atol(str) msvcrt.atol -@ cdecl bsearch(ptr ptr long long ptr) msvcrt.bsearch -@ cdecl calloc(long long) msvcrt.calloc -@ cdecl ceil(double) msvcrt.ceil -@ cdecl clearerr(ptr) msvcrt.clearerr -@ cdecl clock() msvcrt.clock -@ cdecl cos(double) msvcrt.cos -@ cdecl cosh(double) msvcrt.cosh -@ cdecl ctime(ptr) msvcrt.ctime -@ cdecl difftime(long long) msvcrt.difftime -@ cdecl div(long long) msvcrt.div -@ cdecl exit(long) msvcrt.exit -@ cdecl exp(double) msvcrt.exp -@ cdecl fabs(double) msvcrt.fabs -@ cdecl fclose(ptr) msvcrt.fclose -@ cdecl feof(ptr) msvcrt.feof -@ cdecl ferror(ptr) msvcrt.ferror -@ cdecl fflush(ptr) msvcrt.fflush -@ cdecl fgetc(ptr) msvcrt.fgetc -@ cdecl fgetpos(ptr ptr) msvcrt.fgetpos -@ cdecl fgets(ptr long ptr) msvcrt.fgets -@ cdecl fgetwc(ptr) msvcrt.fgetwc -@ cdecl fgetws(ptr long ptr) msvcrt.fgetws -@ cdecl floor(double) msvcrt.floor -@ cdecl fmod(double double) msvcrt.fmod -@ cdecl fopen(str str) msvcrt.fopen -@ varargs fprintf(ptr str) msvcrt.fprintf -@ cdecl fputc(long ptr) msvcrt.fputc -@ cdecl fputs(str ptr) msvcrt.fputs -@ cdecl fputwc(long ptr) msvcrt.fputwc -@ cdecl fputws(wstr ptr) msvcrt.fputws -@ cdecl fread(ptr long long ptr) msvcrt.fread -@ cdecl free(ptr) msvcrt.free -@ cdecl freopen(str str ptr) msvcrt.freopen -@ cdecl frexp(double ptr) msvcrt.frexp -@ varargs fscanf(ptr str) msvcrt.fscanf -@ cdecl fseek(ptr long long) msvcrt.fseek -@ cdecl fsetpos(ptr ptr) msvcrt.fsetpos -@ cdecl ftell(ptr) msvcrt.ftell -@ varargs fwprintf(ptr wstr) msvcrt.fwprintf -@ cdecl fwrite(ptr long long ptr) msvcrt.fwrite -@ varargs fwscanf(ptr wstr) msvcrt.fwscanf -@ cdecl getc(ptr) msvcrt.getc -@ cdecl getchar() msvcrt.getchar -@ cdecl getenv(str) msvcrt.getenv -@ cdecl gets(str) msvcrt.gets -@ cdecl getwc(ptr) msvcrt.getwc -@ cdecl getwchar() msvcrt.getwchar -@ cdecl gmtime(ptr) msvcrt.gmtime -@ cdecl is_wctype(long long) msvcrt.is_wctype -@ cdecl isalnum(long) msvcrt.isalnum -@ cdecl isalpha(long) msvcrt.isalpha -@ cdecl iscntrl(long) msvcrt.iscntrl -@ cdecl isdigit(long) msvcrt.isdigit -@ cdecl isgraph(long) msvcrt.isgraph -@ cdecl isleadbyte(long) msvcrt.isleadbyte -@ cdecl islower(long) msvcrt.islower -@ cdecl isprint(long) msvcrt.isprint -@ cdecl ispunct(long) msvcrt.ispunct -@ cdecl isspace(long) msvcrt.isspace -@ cdecl isupper(long) msvcrt.isupper -@ cdecl iswalnum(long) msvcrt.iswalnum -@ cdecl iswalpha(long) msvcrt.iswalpha -@ cdecl iswascii(long) msvcrt.iswascii -@ cdecl iswcntrl(long) msvcrt.iswcntrl -@ cdecl iswctype(long long) msvcrt.iswctype -@ cdecl iswdigit(long) msvcrt.iswdigit -@ cdecl iswgraph(long) msvcrt.iswgraph -@ cdecl iswlower(long) msvcrt.iswlower -@ cdecl iswprint(long) msvcrt.iswprint -@ cdecl iswpunct(long) msvcrt.iswpunct -@ cdecl iswspace(long) msvcrt.iswspace -@ cdecl iswupper(long) msvcrt.iswupper -@ cdecl iswxdigit(long) msvcrt.iswxdigit -@ cdecl isxdigit(long) msvcrt.isxdigit -@ cdecl labs(long) msvcrt.labs -@ cdecl ldexp( double long) msvcrt.ldexp -@ cdecl ldiv(long long) msvcrt.ldiv -@ cdecl localeconv() msvcrt.localeconv -@ cdecl localtime(ptr) msvcrt.localtime -@ cdecl log(double) msvcrt.log -@ cdecl log10(double) msvcrt.log10 -@ cdecl -i386 longjmp(ptr long) msvcrt.longjmp -@ cdecl malloc(long) msvcrt.malloc -@ cdecl mblen(ptr long) msvcrt.mblen -@ cdecl mbstowcs(ptr str long) msvcrt.mbstowcs -@ cdecl mbtowc(wstr str long) msvcrt.mbtowc -@ cdecl memchr(ptr long long) msvcrt.memchr -@ cdecl memcmp(ptr ptr long) msvcrt.memcmp -@ cdecl memcpy(ptr ptr long) msvcrt.memcpy -@ cdecl memmove(ptr ptr long) msvcrt.memmove -@ cdecl memset(ptr long long) msvcrt.memset -@ cdecl mktime(ptr) msvcrt.mktime -@ cdecl modf(double ptr) msvcrt.modf -@ cdecl perror(str) msvcrt.perror -@ cdecl pow(double double) msvcrt.pow -@ varargs printf(str) msvcrt.printf -@ cdecl putc(long ptr) msvcrt.putc -@ cdecl putchar(long) msvcrt.putchar -@ cdecl puts(str) msvcrt.puts -@ cdecl putwc(long ptr) msvcrt.putwc -@ cdecl putwchar(long) msvcrt.putwchar -@ cdecl qsort(ptr long long ptr) msvcrt.qsort -@ cdecl raise(long) msvcrt.raise -@ cdecl rand() msvcrt.rand -@ cdecl realloc(ptr long) msvcrt.realloc -@ cdecl remove(str) msvcrt.remove -@ cdecl rename(str str) msvcrt.rename -@ cdecl rewind(ptr) msvcrt.rewind -@ varargs scanf(str) msvcrt.scanf -@ cdecl setbuf(ptr ptr) msvcrt.setbuf -@ cdecl setlocale(long str) msvcrt.setlocale -@ cdecl setvbuf(ptr str long long) msvcrt.setvbuf -@ cdecl signal(long long) msvcrt.signal -@ cdecl sin(double) msvcrt.sin -@ cdecl sinh(double) msvcrt.sinh -@ varargs sprintf(ptr str) msvcrt.sprintf -@ cdecl sqrt(double) msvcrt.sqrt -@ cdecl srand(long) msvcrt.srand -@ varargs sscanf(str str) msvcrt.sscanf -@ cdecl strcat(str str) msvcrt.strcat -@ cdecl strchr(str long) msvcrt.strchr -@ cdecl strcmp(str str) msvcrt.strcmp -@ cdecl strcoll(str str) msvcrt.strcoll -@ cdecl strcpy(ptr str) msvcrt.strcpy -@ cdecl strcspn(str str) msvcrt.strcspn -@ cdecl strerror(long) msvcrt.strerror -@ cdecl strftime(str long str ptr) msvcrt.strftime -@ cdecl strlen(str) msvcrt.strlen -@ cdecl strncat(str str long) msvcrt.strncat -@ cdecl strncmp(str str long) msvcrt.strncmp -@ cdecl strncpy(ptr str long) msvcrt.strncpy -@ cdecl strpbrk(str str) msvcrt.strpbrk -@ cdecl strrchr(str long) msvcrt.strrchr -@ cdecl strspn(str str) msvcrt.strspn -@ cdecl strstr(str str) msvcrt.strstr -@ cdecl strtod(str ptr) msvcrt.strtod -@ cdecl strtok(str str) msvcrt.strtok -@ cdecl strtol(str ptr long) msvcrt.strtol -@ cdecl strtoul(str ptr long) msvcrt.strtoul -@ cdecl strxfrm(ptr str long) msvcrt.strxfrm -@ varargs swprintf(wstr wstr) msvcrt.swprintf -@ varargs swscanf(wstr wstr) msvcrt.swscanf -@ cdecl system(str) msvcrt.system -@ cdecl tan(double) msvcrt.tan -@ cdecl tanh(double) msvcrt.tanh -@ cdecl time(ptr) msvcrt.time -@ cdecl tmpfile() msvcrt.tmpfile -@ cdecl tmpnam(ptr) msvcrt.tmpnam -@ cdecl tolower(long) msvcrt.tolower -@ cdecl toupper(long) msvcrt.toupper -@ cdecl towlower(long) msvcrt.towlower -@ cdecl towupper(long) msvcrt.towupper -@ cdecl ungetc(long ptr) msvcrt.ungetc -@ cdecl ungetwc(long ptr) msvcrt.ungetwc -@ cdecl vfprintf(ptr str long) msvcrt.vfprintf -@ cdecl vfwprintf(ptr wstr long) msvcrt.vfwprintf -@ cdecl vprintf(str long) msvcrt.vprintf -@ cdecl vsprintf(ptr str ptr) msvcrt.vsprintf -@ cdecl vswprintf(ptr wstr long) msvcrt.vswprintf -@ cdecl vwprintf(wstr long) msvcrt.vwprintf -@ cdecl wcscat(wstr wstr) msvcrt.wcscat -@ cdecl wcschr(wstr long) msvcrt.wcschr -@ cdecl wcscmp(wstr wstr) msvcrt.wcscmp -@ cdecl wcscoll(wstr wstr) msvcrt.wcscoll -@ cdecl wcscpy(ptr wstr) msvcrt.wcscpy -@ cdecl wcscspn(wstr wstr) msvcrt.wcscspn -@ cdecl wcsftime(ptr long wstr ptr) msvcrt.wcsftime -@ cdecl wcslen(wstr) msvcrt.wcslen -@ cdecl wcsncat(wstr wstr long) msvcrt.wcsncat -@ cdecl wcsncmp(wstr wstr long) msvcrt.wcsncmp -@ cdecl wcsncpy(ptr wstr long) msvcrt.wcsncpy -@ cdecl wcspbrk(wstr wstr) msvcrt.wcspbrk -@ cdecl wcsrchr(wstr long) msvcrt.wcsrchr -@ cdecl wcsspn(wstr wstr) msvcrt.wcsspn -@ cdecl wcsstr(wstr wstr) msvcrt.wcsstr -@ cdecl wcstod(wstr ptr) msvcrt.wcstod -@ cdecl wcstok(wstr wstr) msvcrt.wcstok -@ cdecl wcstol(wstr ptr long) msvcrt.wcstol -@ cdecl wcstombs(ptr ptr long) msvcrt.wcstombs -@ cdecl wcstoul(wstr ptr long) msvcrt.wcstoul -@ cdecl wcsxfrm(ptr wstr long) msvcrt.wcsxfrm -@ cdecl wctomb(ptr long) msvcrt.wctomb -@ varargs wprintf(wstr) msvcrt.wprintf -@ varargs wscanf(wstr) msvcrt.wscanf +@ cdecl _nextafter(double double) +@ cdecl _onexit(ptr) +@ varargs _open(str long) +@ cdecl _open_osfhandle(long long) +@ extern _osver +@ cdecl _pclose(ptr) +@ extern _pctype +@ extern _pgmptr +@ cdecl _pipe(ptr long long) +@ cdecl _popen(str str) +@ cdecl _purecall() +@ cdecl _putch(long) +@ cdecl _putenv(str) +@ cdecl _putw(long ptr) +@ cdecl _putws(wstr) +@ extern _pwctype +@ cdecl _read(long ptr long) +@ cdecl _rmdir(str) +@ cdecl _rmtmp() +@ cdecl _rotl(long long) +@ cdecl _rotr(long long) +@ cdecl _safe_fdiv() +@ cdecl _safe_fdivr() +@ cdecl _safe_fprem() +@ cdecl _safe_fprem1() +@ cdecl _scalb(double long) +@ cdecl _searchenv(str str ptr) +@ stdcall -i386 __seh_longjmp_unwind@4(ptr) _seh_longjmp_unwind +@ cdecl _seterrormode(long) +@ cdecl -i386 _setjmp(ptr) +@ cdecl -i386 _setjmp3(ptr long) +@ cdecl _setmbcp(long) +@ cdecl _setmode(long long) +@ cdecl _setsystime(ptr long) +@ cdecl _sleep(long) +@ varargs _snprintf(ptr long str) +@ varargs _snwprintf(ptr long wstr) +@ varargs _sopen(str long long) +@ varargs _spawnl(long str str) +@ varargs _spawnle(long str str) +@ varargs _spawnlp(long str str) +@ varargs _spawnlpe(long str str) +@ cdecl _spawnv(long str ptr) +@ cdecl _spawnve(long str ptr ptr) +@ cdecl _spawnvp(long str ptr) +@ cdecl _spawnvpe(long str ptr ptr) +@ cdecl _splitpath(str ptr ptr ptr ptr) +@ cdecl _stat(str ptr) +@ cdecl _statusfp() +@ cdecl _strcmpi(str str) +@ cdecl _strdate(ptr) +@ cdecl _strdup(str) +@ cdecl _strerror(long) +@ cdecl _stricmp(str str) +@ cdecl _stricoll(str str) +@ cdecl _strlwr(str) +@ cdecl _strncoll(str str long) +@ cdecl _strnicmp(str str long) +@ cdecl _strnicoll(str str long) +@ cdecl _strnset(str long long) +@ cdecl _strrev(str) +@ cdecl _strset(str long) +@ cdecl _strtime(ptr) +@ cdecl _strupr(str) +@ cdecl _swab(str str long) +@ extern _sys_errlist +@ extern _sys_nerr +@ cdecl _tccpy(str str) _mbccpy +@ cdecl _tclen(ptr) _mbclen +@ cdecl _tcschr(str long) _mbschr +@ cdecl _tcsclen(str) _mbslen +@ cdecl _tcscmp(str str) _mbscmp +@ cdecl _tcscspn(str str) _mbscspn +@ cdecl _tcsdec(ptr ptr) _mbsdec +@ cdecl _tcsicmp(str str) _mbsicmp +@ cdecl _tcsinc(str) _mbsinc +@ cdecl _tcslwr(str) _mbslwr +@ cdecl _tcsnbcnt(ptr long) _mbsnbcnt +@ cdecl _tcsncat(str str long) _mbsnbcat +@ cdecl _tcsnccat(str str long) _mbsncat +@ cdecl _tcsnccmp(str str long) _mbsncmp +@ cdecl _tcsnccnt(str long) _mbsnccnt +@ cdecl _tcsnccpy(str str long) _mbsncpy +@ cdecl _tcsncicmp(str str long) _mbsnicmp +@ cdecl _tcsncmp(str str long) _mbsnbcmp +@ cdecl _tcsncpy(ptr str long) _mbsnbcpy +@ cdecl _tcsncset(str long long) _mbsnset +@ cdecl _tcsnextc(str) _mbsnextc +@ cdecl _tcsnicmp(str str long) _mbsnbicmp +@ cdecl _tcsninc(str long) _mbsninc +@ cdecl _tcsnset(str long long) _mbsnbset +@ cdecl _tcspbrk(str str) _mbspbrk +@ cdecl _tcsrchr(str long) _mbsrchr +@ cdecl _tcsrev(str) _mbsrev +@ cdecl _tcsset(str long) _mbsset +@ cdecl _tcsspn(str str) _mbsspn +@ cdecl _tcsspnp(str str) _mbsspnp +@ cdecl _tcsstr(str str) _mbsstr +@ cdecl _tcstok(str str) _mbstok +@ cdecl _tcsupr(str) _mbsupr +@ cdecl _tell(long) +@ cdecl _tempnam(str str) +@ extern _timezone +@ cdecl _tolower(long) +@ cdecl _toupper(long) +@ extern _tzname +@ cdecl _tzset() +@ cdecl _ultoa(long ptr long) +@ cdecl _ultow(long ptr long) +@ cdecl _umask(long) +@ cdecl _ungetch(long) +@ cdecl _unlink(str) +@ cdecl _unloaddll(long) +@ cdecl _utime(str ptr) +@ cdecl _vsnprintf(ptr long ptr ptr) +@ cdecl _vsnwprintf(ptr long wstr long) +@ cdecl _waccess(wstr long) +@ cdecl _wasctime(ptr) +@ cdecl _wchdir(wstr) +@ cdecl _wchmod(wstr long) +@ extern _wcmdln +@ cdecl _wcreat(wstr long) +@ cdecl _wcsdup(wstr) +@ cdecl _wcsicmp(wstr wstr) +@ cdecl _wcsicoll(wstr wstr) +@ cdecl _wcslwr(wstr) +@ cdecl _wcsncoll(wstr wstr long) +@ cdecl _wcsnicmp(wstr wstr long) +@ cdecl _wcsnicoll(wstr wstr long) +@ cdecl _wcsnset(wstr long long) +@ cdecl _wcsrev(wstr) +@ cdecl _wcsset(wstr long) +@ cdecl _wcsupr(wstr) +@ cdecl _wctime(ptr) +@ extern _wenviron +@ varargs _wexecl(wstr wstr) +@ varargs _wexecle(wstr wstr) +@ varargs _wexeclp(wstr wstr) +@ varargs _wexeclpe(wstr wstr) +@ varargs _wexecv(wstr ptr) +@ varargs _wexecve(wstr ptr ptr) +@ varargs _wexecvp(wstr ptr) +@ varargs _wexecvpe(wstr ptr ptr) +@ cdecl _wfdopen(long wstr) +@ cdecl _wfindfirst(wstr ptr) +@ cdecl _wfindnext(long ptr) +@ cdecl _wfopen(wstr wstr) +@ cdecl _wfreopen(wstr wstr ptr) +@ cdecl _wfsopen(wstr wstr long) +@ cdecl _wfullpath(ptr wstr long) +@ cdecl _wgetcwd(wstr long) +@ cdecl _wgetdcwd(long wstr long) +@ cdecl _wgetenv(wstr) +@ extern _winmajor +@ extern _winminor +@ extern _winver +@ cdecl _wmakepath(ptr wstr wstr wstr wstr) +@ cdecl _wmkdir(wstr) +@ cdecl _wmktemp(wstr) +@ varargs _wopen(wstr long) +@ cdecl _wperror(wstr) +@ extern _wpgmptr +@ cdecl _wpopen(wstr wstr) +@ cdecl _wputenv(wstr) +@ cdecl _wremove(wstr) +@ cdecl _wrename(wstr wstr) +@ cdecl _write(long ptr long) +@ cdecl _wrmdir(wstr) +@ cdecl _wsearchenv(wstr wstr ptr) +@ cdecl _wsetlocale(long wstr) +@ varargs _wsopen(wstr long long) +@ varargs _wspawnl(long wstr wstr) +@ varargs _wspawnle(long wstr wstr) +@ varargs _wspawnlp(long wstr wstr) +@ varargs _wspawnlpe(long wstr wstr) +@ cdecl _wspawnv(long wstr ptr) +@ cdecl _wspawnve(long wstr ptr ptr) +@ cdecl _wspawnvp(long wstr ptr) +@ cdecl _wspawnvpe(long wstr ptr ptr) +@ cdecl _wsplitpath(wstr ptr ptr ptr ptr) +@ cdecl _wstat(wstr ptr) +@ cdecl _wstrdate(ptr) +@ cdecl _wstrtime(ptr) +@ cdecl _wsystem(wstr) +@ cdecl _wtempnam(wstr wstr) +@ cdecl _wtmpnam(ptr) +@ cdecl _wtoi(wstr) +@ cdecl _wtol(wstr) +@ cdecl _wunlink(wstr) +@ cdecl _wutime(wstr ptr) +@ cdecl _y0(double) +@ cdecl _y1(double) +@ cdecl _yn(long double ) +@ cdecl abort() +@ cdecl abs(long) +@ cdecl acos(double) +@ cdecl asctime(ptr) +@ cdecl asin(double) +@ cdecl atan(double) +@ cdecl atan2(double double) +@ extern atexit # <-- do not touch this! +@ cdecl atof(str) +@ cdecl atoi(str) +@ cdecl atol(str) +@ cdecl bsearch(ptr ptr long long ptr) +@ cdecl calloc(long long) +@ cdecl ceil(double) +@ cdecl clearerr(ptr) +@ cdecl clock() +@ cdecl cos(double) +@ cdecl cosh(double) +@ cdecl ctime(ptr) +@ cdecl difftime(long long) +@ cdecl div(long long) +@ cdecl exit(long) +@ cdecl exp(double) +@ cdecl fabs(double) +@ cdecl fclose(ptr) +@ cdecl feof(ptr) +@ cdecl ferror(ptr) +@ cdecl fflush(ptr) +@ cdecl fgetc(ptr) +@ cdecl fgetpos(ptr ptr) +@ cdecl fgets(ptr long ptr) +@ cdecl fgetwc(ptr) +@ cdecl fgetws(ptr long ptr) +@ cdecl floor(double) +@ cdecl fmod(double double) +@ cdecl fopen(str str) +@ varargs fprintf(ptr str) +@ cdecl fputc(long ptr) +@ cdecl fputs(str ptr) +@ cdecl fputwc(long ptr) +@ cdecl fputws(wstr ptr) +@ cdecl fread(ptr long long ptr) +@ cdecl free(ptr) +@ cdecl freopen(str str ptr) +@ cdecl frexp(double ptr) +@ varargs fscanf(ptr str) +@ cdecl fseek(ptr long long) +@ cdecl fsetpos(ptr ptr) +@ cdecl ftell(ptr) +@ varargs fwprintf(ptr wstr) +@ cdecl fwrite(ptr long long ptr) +@ varargs fwscanf(ptr wstr) +@ cdecl getc(ptr) +@ cdecl getchar() +@ cdecl getenv(str) +@ cdecl gets(str) +@ cdecl getwc(ptr) +@ cdecl getwchar() +@ cdecl gmtime(ptr) +@ cdecl is_wctype(long long) +@ cdecl isalnum(long) +@ cdecl isalpha(long) +@ cdecl iscntrl(long) +@ cdecl isdigit(long) +@ cdecl isgraph(long) +@ cdecl isleadbyte(long) +@ cdecl islower(long) +@ cdecl isprint(long) +@ cdecl ispunct(long) +@ cdecl isspace(long) +@ cdecl isupper(long) +@ cdecl iswalnum(long) +@ cdecl iswalpha(long) +@ cdecl iswascii(long) +@ cdecl iswcntrl(long) +@ cdecl iswctype(long long) +@ cdecl iswdigit(long) +@ cdecl iswgraph(long) +@ cdecl iswlower(long) +@ cdecl iswprint(long) +@ cdecl iswpunct(long) +@ cdecl iswspace(long) +@ cdecl iswupper(long) +@ cdecl iswxdigit(long) +@ cdecl isxdigit(long) +@ cdecl labs(long) +@ cdecl ldexp(double long) +@ cdecl ldiv(long long) +@ cdecl localeconv() +@ cdecl localtime(ptr) +@ cdecl log(double) +@ cdecl log10(double) +@ cdecl -i386 longjmp(ptr long) +@ cdecl malloc(long) +@ cdecl mblen(ptr long) +@ cdecl mbstowcs(ptr str long) +@ cdecl mbtowc(wstr str long) +@ cdecl memchr(ptr long long) +@ cdecl memcmp(ptr ptr long) +@ cdecl memcpy(ptr ptr long) +@ cdecl memmove(ptr ptr long) +@ cdecl memset(ptr long long) +@ cdecl mktime(ptr) +@ cdecl modf(double ptr) +@ cdecl perror(str) +@ cdecl pow(double double) +@ varargs printf(str) +@ cdecl putc(long ptr) +@ cdecl putchar(long) +@ cdecl puts(str) +@ cdecl putwc(long ptr) fputwc +@ cdecl putwchar(long) _fputwchar +@ cdecl qsort(ptr long long ptr) +@ cdecl raise(long) +@ cdecl rand() +@ cdecl realloc(ptr long) +@ cdecl remove(str) +@ cdecl rename(str str) +@ cdecl rewind(ptr) +@ varargs scanf(str) +@ cdecl setbuf(ptr ptr) +@ cdecl setlocale(long str) +@ cdecl setvbuf(ptr str long long) +@ cdecl signal(long long) +@ cdecl sin(double) +@ cdecl sinh(double) +@ varargs sprintf(ptr str) +@ cdecl sqrt(double) +@ cdecl srand(long) +@ varargs sscanf(str str) +@ cdecl strcat(str str) +@ cdecl strchr(str long) +@ cdecl strcmp(str str) +@ cdecl strcoll(str str) +@ cdecl strcpy(ptr str) +@ cdecl strcspn(str str) +@ cdecl strerror(long) +@ cdecl strftime(str long str ptr) +@ cdecl strlen(str) +@ cdecl strncat(str str long) +@ cdecl strncmp(str str long) +@ cdecl strncpy(ptr str long) +@ cdecl strpbrk(str str) +@ cdecl strrchr(str long) +@ cdecl strspn(str str) +@ cdecl strstr(str str) +@ cdecl strtod(str ptr) +@ cdecl strtok(str str) +@ cdecl strtol(str ptr long) +@ cdecl strtoul(str ptr long) +@ cdecl strxfrm(ptr str long) +@ varargs swprintf(ptr wstr) +@ varargs swscanf(wstr wstr) +@ cdecl system(str) +@ cdecl tan(double) +@ cdecl tanh(double) +@ cdecl time(ptr) +@ cdecl tmpfile() +@ cdecl tmpnam(ptr) +@ cdecl tolower(long) +@ cdecl toupper(long) +@ cdecl towlower(long) +@ cdecl towupper(long) +@ cdecl ungetc(long ptr) +@ cdecl ungetwc(long ptr) +@ cdecl vfprintf(ptr str ptr) +@ cdecl vfwprintf(ptr wstr ptr) +@ cdecl vprintf(str ptr) +@ cdecl vsprintf(ptr str ptr) +@ cdecl vswprintf(ptr wstr long) +@ cdecl vwprintf(wstr long) +@ cdecl wcscat(wstr wstr) +@ cdecl wcschr(wstr long) +@ cdecl wcscmp(wstr wstr) +@ cdecl wcscoll(wstr wstr) +@ cdecl wcscpy(ptr wstr) +@ cdecl wcscspn(wstr wstr) +@ cdecl wcsftime(ptr long wstr ptr) +@ cdecl wcslen(wstr) +@ cdecl wcsncat(wstr wstr long) +@ cdecl wcsncmp(wstr wstr long) +@ cdecl wcsncpy(ptr wstr long) +@ cdecl wcspbrk(wstr wstr) +@ cdecl wcsrchr(wstr long) +@ cdecl wcsspn(wstr wstr) +@ cdecl wcsstr(wstr wstr) +@ cdecl wcstod(wstr ptr) +@ cdecl wcstok(wstr wstr) +@ cdecl wcstol(wstr ptr long) +@ cdecl wcstombs(ptr ptr long) +@ cdecl wcstoul(wstr ptr long) +@ cdecl wcsxfrm(ptr wstr long) +@ cdecl wctomb(ptr long) +@ varargs wprintf(wstr) +@ varargs wscanf(wstr) diff --git a/dll/win32/msvcrt20/stubs.c b/dll/win32/msvcrt20/stubs.c new file mode 100644 index 00000000000..489e122ef4f --- /dev/null +++ b/dll/win32/msvcrt20/stubs.c @@ -0,0 +1,27 @@ +#include + +#undef UNIMPLEMENTED +#define UNIMPLEMENTED __wine_spec_unimplemented_stub("msvcrt.dll", __FUNCTION__) + +int _atodbl( + void * value, + char * str) +{ + UNIMPLEMENTED; + return 0; +} + +int _ismbbkprint( + unsigned int c) +{ + UNIMPLEMENTED; + return 0; +} + +size_t _heapused( size_t *pUsed, size_t *pCommit ) +{ + UNIMPLEMENTED; + return( 0 ); +} + +int _fileinfo = 0; \ No newline at end of file diff --git a/dll/win32/msvcrt40/CMakeLists.txt b/dll/win32/msvcrt40/CMakeLists.txt index ac69cb56d38..747351d74f0 100644 --- a/dll/win32/msvcrt40/CMakeLists.txt +++ b/dll/win32/msvcrt40/CMakeLists.txt @@ -1,21 +1,34 @@ -include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine) +add_definitions( + -DUSE_MSVCRT_PREFIX + -D_MSVCRT_ + -D_MSVCRT_LIB_ + -D_MT + -D_CTYPE_DISABLE_MACROS + -D_NO_INLINING + -DCRTDLL + -D__MINGW_IMPORT="") -add_definitions(-D__WINESRC__) -add_definitions(-DCRTDLL) +include_directories(${REACTOS_SOURCE_DIR}/lib/sdk/crt/include) spec2def(msvcrt40.dll msvcrt40.spec) list(APPEND SOURCE msvcrt40.c + stubs.c + ${CMAKE_CURRENT_BINARY_DIR}/msvcrt40_stubs.c ${CMAKE_CURRENT_BINARY_DIR}/msvcrt40.def) add_library(msvcrt40 SHARED ${SOURCE}) +set_image_base(msvcrt40 ${baseaddress_msvcrt40}) +set_entrypoint(msvcrt40 DllMain@12) -set_module_type(msvcrt40 win32dll) +target_link_libraries(msvcrt40 crt wine) -target_link_libraries(msvcrt40 wine) +if(NOT MSVC) + target_link_libraries(msvcrt40 pseh) +endif() -add_importlibs(msvcrt40 msvcrt kernel32 ntdll) +add_importlibs(msvcrt40 kernel32 ntdll) add_cd_file(TARGET msvcrt40 DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/msvcrt40/msvcrt40.c b/dll/win32/msvcrt40/msvcrt40.c index f178ea0bafa..fdd7457d087 100644 --- a/dll/win32/msvcrt40/msvcrt40.c +++ b/dll/win32/msvcrt40/msvcrt40.c @@ -17,23 +17,136 @@ * 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 +#define _CRT_PRECOMP_H +#include +#include +#include +#include +#include +#include -#include +#include "wine/debug.h" +WINE_DEFAULT_DEBUG_CHANNEL(msvcrt); -#include "windef.h" -#include "winbase.h" +/* EXTERNAL PROTOTYPES ********************************************************/ -BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved ) +extern int BlockEnvToEnvironA(void); +extern int BlockEnvToEnvironW(void); +extern void FreeEnvironment(char **environment); +extern void _atexit_cleanup(void); + +extern unsigned int _osplatform; +extern unsigned int _osver; +extern unsigned int _winminor; +extern unsigned int _winmajor; +extern unsigned int _winver; + +extern char* _acmdln; /* pointer to ascii command line */ +extern wchar_t* _wcmdln; /* pointer to wide character command line */ +#undef _environ +extern char** _environ; /* pointer to environment block */ +extern char** __initenv; /* pointer to initial environment block */ +extern wchar_t** _wenviron; /* pointer to environment block */ +extern wchar_t** __winitenv; /* pointer to initial environment block */ + + +/* LIBRARY GLOBAL VARIABLES ***************************************************/ + +HANDLE hHeap = NULL; /* handle for heap */ + + +/* LIBRARY ENTRY POINT ********************************************************/ + +BOOL +WINAPI +DllMain(PVOID hinstDll, ULONG dwReason, PVOID reserved) { - switch (reason) - { - case DLL_WINE_PREATTACH: - return FALSE; /* prefer native version */ - case DLL_PROCESS_ATTACH: - DisableThreadLibraryCalls( inst ); - break; - case DLL_PROCESS_DETACH: + OSVERSIONINFOW osvi; + switch (dwReason) + { + case DLL_PROCESS_ATTACH://1 + /* initialize version info */ + //DPRINT1("Process Attach %d\n", nAttachCount); + //DPRINT1("Process Attach\n"); + osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW); + GetVersionExW( &osvi ); + _winver = (osvi.dwMajorVersion << 8) | osvi.dwMinorVersion; + _winmajor = osvi.dwMajorVersion; + _winminor = osvi.dwMinorVersion; + _osplatform = osvi.dwPlatformId; + _osver = osvi.dwBuildNumber; + hHeap = HeapCreate(0, 100000, 0); + if (hHeap == NULL) + return FALSE; + + /* create tls stuff */ + if (!CreateThreadData()) + return FALSE; + + if (BlockEnvToEnvironA() < 0) + return FALSE; + + if (BlockEnvToEnvironW() < 0) + { + FreeEnvironment(_environ); + return FALSE; + } + + _acmdln = _strdup(GetCommandLineA()); + _wcmdln = _wcsdup(GetCommandLineW()); + + /* FIXME: more initializations... */ + + /* Initialization of the WINE code */ + msvcrt_init_mt_locks(); + msvcrt_init_io(); + setlocale(0, "C"); + //_setmbcp(_MB_CP_LOCALE); + + TRACE("Attach done\n"); break; - } - return TRUE; + + case DLL_THREAD_ATTACH: + break; + + case DLL_THREAD_DETACH: + FreeThreadData(NULL); + break; + + case DLL_PROCESS_DETACH: + //DPRINT1("Detach %d\n", nAttachCount); + //DPRINT("Detach\n"); + /* FIXME: more cleanup... */ + /* Deinit of the WINE code */ + msvcrt_free_io(); + msvcrt_free_mt_locks(); + + _atexit_cleanup(); + + + /* destroy tls stuff */ + DestroyThreadData(); + + if (__winitenv && __winitenv != _wenviron) + FreeEnvironment((char**)__winitenv); + if (_wenviron) + FreeEnvironment((char**)_wenviron); + + if (__initenv && __initenv != _environ) + FreeEnvironment(__initenv); + if (_environ) + FreeEnvironment(_environ); + + /* destroy heap */ + HeapDestroy(hHeap); + + TRACE("Detach done\n"); + break; + } + + return TRUE; } + +/* EOF */ \ No newline at end of file diff --git a/dll/win32/msvcrt40/msvcrt40.rbuild b/dll/win32/msvcrt40/msvcrt40.rbuild index 23b8af87bd4..83cb9e38261 100644 --- a/dll/win32/msvcrt40/msvcrt40.rbuild +++ b/dll/win32/msvcrt40/msvcrt40.rbuild @@ -4,10 +4,18 @@ . - include/reactos/wine - + include + + + + + + msvcrt40.c + stubs.c wine + crt + pseh diff --git a/dll/win32/msvcrt40/msvcrt40.spec b/dll/win32/msvcrt40/msvcrt40.spec index 3e43afa908b..5383a360f80 100644 --- a/dll/win32/msvcrt40/msvcrt40.spec +++ b/dll/win32/msvcrt40/msvcrt40.spec @@ -1,14 +1,14 @@ @ stub ??0Iostream_init@@QAE@AAVios@@H@Z @ stub ??0Iostream_init@@QAE@XZ -@ cdecl -i386 ??0__non_rtti_object@@QAE@ABV0@@Z(ptr) msvcrt.??0__non_rtti_object@@QAE@ABV0@@Z -@ cdecl -i386 ??0__non_rtti_object@@QAE@PBD@Z(ptr) msvcrt.??0__non_rtti_object@@QAE@PBD@Z -@ cdecl -i386 ??0bad_cast@@QAE@ABQBD@Z(ptr) msvcrt.??0bad_cast@@QAE@ABQBD@Z -@ cdecl -i386 ??0bad_cast@@QAE@ABV0@@Z(ptr) msvcrt.??0bad_cast@@QAE@ABV0@@Z -@ cdecl -i386 ??0bad_typeid@@QAE@ABV0@@Z(ptr) msvcrt.??0bad_typeid@@QAE@ABV0@@Z -@ cdecl -i386 ??0bad_typeid@@QAE@PBD@Z(ptr) msvcrt.??0bad_typeid@@QAE@PBD@Z -@ cdecl -i386 ??0exception@@QAE@ABQBD@Z(ptr) msvcrt.??0exception@@QAE@ABQBD@Z -@ cdecl -i386 ??0exception@@QAE@ABV0@@Z(ptr) msvcrt.??0exception@@QAE@ABV0@@Z -@ cdecl -i386 ??0exception@@QAE@XZ() msvcrt.??0exception@@QAE@XZ +@ cdecl -i386 ??0__non_rtti_object@@QAE@ABV0@@Z(ptr) __thiscall_MSVCRT___non_rtti_object_copy_ctor +@ cdecl -i386 ??0__non_rtti_object@@QAE@PBD@Z(ptr) __thiscall_MSVCRT___non_rtti_object_ctor +@ cdecl -i386 ??0bad_cast@@QAE@ABQBD@Z(ptr) __thiscall_MSVCRT_bad_cast_ctor +@ cdecl -i386 ??0bad_cast@@QAE@ABV0@@Z(ptr) __thiscall_MSVCRT_bad_cast_copy_ctor +@ cdecl -i386 ??0bad_typeid@@QAE@ABV0@@Z(ptr) __thiscall_MSVCRT_bad_typeid_copy_ctor +@ cdecl -i386 ??0bad_typeid@@QAE@PBD@Z(ptr) __thiscall_MSVCRT_bad_typeid_ctor +@ cdecl -i386 ??0exception@@QAE@ABQBD@Z(ptr) __thiscall_MSVCRT_exception_ctor +@ cdecl -i386 ??0exception@@QAE@ABV0@@Z(ptr) __thiscall_MSVCRT_exception_copy_ctor +@ cdecl -i386 ??0exception@@QAE@XZ() __thiscall_MSVCRT_exception_default_ctor @ stub ??0filebuf@@QAE@ABV0@@Z @ stub ??0filebuf@@QAE@H@Z @ stub ??0filebuf@@QAE@HPADH@Z @@ -70,10 +70,10 @@ @ stub ??0strstreambuf@@QAE@PADH0@Z @ stub ??0strstreambuf@@QAE@XZ @ stub ??1Iostream_init@@QAE@XZ -@ cdecl -i386 ??1__non_rtti_object@@UAE@XZ() msvcrt.??1__non_rtti_object@@UAE@XZ -@ cdecl -i386 ??1bad_cast@@UAE@XZ() msvcrt.??1bad_cast@@UAE@XZ -@ cdecl -i386 ??1bad_typeid@@UAE@XZ() msvcrt.??1bad_typeid@@UAE@XZ -@ cdecl -i386 ??1exception@@UAE@XZ() msvcrt.??1exception@@UAE@XZ +@ cdecl -i386 ??1__non_rtti_object@@UAE@XZ() __thiscall_MSVCRT___non_rtti_object_dtor +@ cdecl -i386 ??1bad_cast@@UAE@XZ() __thiscall_MSVCRT_bad_cast_dtor +@ cdecl -i386 ??1bad_typeid@@UAE@XZ() __thiscall_MSVCRT_bad_typeid_dtor +@ cdecl -i386 ??1exception@@UAE@XZ() __thiscall_MSVCRT_exception_dtor @ stub ??1filebuf@@UAE@XZ @ stub ??1fstream@@UAE@XZ @ stub ??1ifstream@@UAE@XZ @@ -92,14 +92,14 @@ @ stub ??1streambuf@@UAE@XZ @ stub ??1strstream@@UAE@XZ @ stub ??1strstreambuf@@UAE@XZ -@ cdecl -i386 ??1type_info@@UAE@XZ() msvcrt.??1type_info@@UAE@XZ -@ cdecl ??2@YAPAXI@Z(long) msvcrt.??2@YAPAXI@Z -@ cdecl ??3@YAXPAX@Z(ptr) msvcrt.??3@YAXPAX@Z +@ cdecl -i386 ??1type_info@@UAE@XZ() __thiscall_MSVCRT_type_info_dtor +@ cdecl ??2@YAPAXI@Z(long) MSVCRT_operator_new +@ cdecl ??3@YAXPAX@Z(ptr) MSVCRT_operator_delete @ stub ??4Iostream_init@@QAEAAV0@ABV0@@Z -@ cdecl -i386 ??4__non_rtti_object@@QAEAAV0@ABV0@@Z(ptr) msvcrt.??4__non_rtti_object@@QAEAAV0@ABV0@@Z -@ cdecl -i386 ??4bad_cast@@QAEAAV0@ABV0@@Z(ptr) msvcrt.??4bad_cast@@QAEAAV0@ABV0@@Z -@ cdecl -i386 ??4bad_typeid@@QAEAAV0@ABV0@@Z(ptr) msvcrt.??4bad_typeid@@QAEAAV0@ABV0@@Z -@ cdecl -i386 ??4exception@@QAEAAV0@ABV0@@Z(ptr) msvcrt.??4exception@@QAEAAV0@ABV0@@Z +@ cdecl -i386 ??4__non_rtti_object@@QAEAAV0@ABV0@@Z(ptr) __thiscall_MSVCRT___non_rtti_object_opequals +@ cdecl -i386 ??4bad_cast@@QAEAAV0@ABV0@@Z(ptr) __thiscall_MSVCRT_bad_cast_opequals +@ cdecl -i386 ??4bad_typeid@@QAEAAV0@ABV0@@Z(ptr) __thiscall_MSVCRT_bad_typeid_opequals +@ cdecl -i386 ??4exception@@QAEAAV0@ABV0@@Z(ptr) __thiscall_MSVCRT_exception_opequals @ stub ??4filebuf@@QAEAAV0@ABV0@@Z @ stub ??4fstream@@QAEAAV0@AAV0@@Z @ stub ??4ifstream@@QAEAAV0@ABV0@@Z @@ -163,13 +163,13 @@ @ stub ??6ostream@@QAEAAV0@PBE@Z @ stub ??6ostream@@QAEAAV0@PBX@Z @ stub ??7ios@@QBEHXZ -@ cdecl -i386 ??8type_info@@QBEHABV0@@Z(ptr) msvcrt.??8type_info@@QBEHABV0@@Z -@ cdecl -i386 ??9type_info@@QBEHABV0@@Z(ptr) msvcrt.??9type_info@@QBEHABV0@@Z +@ cdecl -i386 ??8type_info@@QBEHABV0@@Z(ptr) __thiscall_MSVCRT_type_info_opequals_equals +@ cdecl -i386 ??9type_info@@QBEHABV0@@Z(ptr) __thiscall_MSVCRT_type_info_opnot_equals @ stub ??Bios@@QBEPAXXZ -@ extern -i386 ??_7__non_rtti_object@@6B@ msvcrt.??_7__non_rtti_object@@6B@ -@ extern -i386 ??_7bad_cast@@6B@ msvcrt.??_7bad_cast@@6B@ -@ extern -i386 ??_7bad_typeid@@6B@ msvcrt.??_7bad_typeid@@6B@ -@ extern -i386 ??_7exception@@6B@ msvcrt.??_7exception@@6B@ +@ extern -i386 ??_7__non_rtti_object@@6B@ MSVCRT___non_rtti_object_vtable +@ extern -i386 ??_7bad_cast@@6B@ MSVCRT_bad_cast_vtable +@ extern -i386 ??_7bad_typeid@@6B@ MSVCRT_bad_typeid_vtable +@ extern -i386 ??_7exception@@6B@ MSVCRT_exception_vtable @ stub ??_7filebuf@@6B@ @ stub ??_7fstream@@6B@ @ stub ??_7ifstream@@6B@ @@ -217,10 +217,10 @@ @ stub ??_Dstdiostream@@QAEXXZ @ stub ??_Dstrstream@@QAEXXZ @ stub ??_EIostream_init@@QAEPAXI@Z -@ cdecl -i386 ??_E__non_rtti_object@@UAEPAXI@Z(long) msvcrt.??_E__non_rtti_object@@UAEPAXI@Z -@ cdecl -i386 ??_Ebad_cast@@UAEPAXI@Z(long) msvcrt.??_Ebad_cast@@UAEPAXI@Z -@ cdecl -i386 ??_Ebad_typeid@@UAEPAXI@Z(long) msvcrt.??_Ebad_typeid@@UAEPAXI@Z -@ cdecl -i386 ??_Eexception@@UAEPAXI@Z(long) msvcrt.??_Eexception@@UAEPAXI@Z +@ cdecl -i386 ??_E__non_rtti_object@@UAEPAXI@Z(long) __thiscall_MSVCRT___non_rtti_object_vector_dtor +@ cdecl -i386 ??_Ebad_cast@@UAEPAXI@Z(long) __thiscall_MSVCRT_bad_cast_vector_dtor +@ cdecl -i386 ??_Ebad_typeid@@UAEPAXI@Z(long) __thiscall_MSVCRT_bad_typeid_vector_dtor +@ cdecl -i386 ??_Eexception@@UAEPAXI@Z(long) __thiscall_MSVCRT_exception_vector_dtor @ stub ??_Efilebuf@@UAEPAXI@Z @ stub ??_Efstream@@UAEPAXI@Z @ stub ??_Eifstream@@UAEPAXI@Z @@ -240,10 +240,10 @@ @ stub ??_Estrstream@@UAEPAXI@Z @ stub ??_Estrstreambuf@@UAEPAXI@Z @ stub ??_GIostream_init@@QAEPAXI@Z -@ cdecl -i386 ??_G__non_rtti_object@@UAEPAXI@Z(long) msvcrt.??_G__non_rtti_object@@UAEPAXI@Z -@ cdecl -i386 ??_Gbad_cast@@UAEPAXI@Z(long) msvcrt.??_Gbad_cast@@UAEPAXI@Z -@ cdecl -i386 ??_Gbad_typeid@@UAEPAXI@Z(long) msvcrt.??_Gbad_typeid@@UAEPAXI@Z -@ cdecl -i386 ??_Gexception@@UAEPAXI@Z(long) msvcrt.??_Gexception@@UAEPAXI@Z +@ cdecl -i386 ??_G__non_rtti_object@@UAEPAXI@Z(long) __thiscall_MSVCRT___non_rtti_object_scalar_dtor +@ cdecl -i386 ??_Gbad_cast@@UAEPAXI@Z(long) __thiscall_MSVCRT_bad_cast_scalar_dtor +@ cdecl -i386 ??_Gbad_typeid@@UAEPAXI@Z(long) __thiscall_MSVCRT_bad_typeid_scalar_dtor +@ cdecl -i386 ??_Gexception@@UAEPAXI@Z(long) __thiscall_MSVCRT_exception_scalar_dtor @ stub ??_Gfilebuf@@UAEPAXI@Z @ stub ??_Gfstream@@UAEPAXI@Z @ stub ??_Gifstream@@UAEPAXI@Z @@ -262,11 +262,11 @@ @ stub ??_Gstreambuf@@UAEPAXI@Z @ stub ??_Gstrstream@@UAEPAXI@Z @ stub ??_Gstrstreambuf@@UAEPAXI@Z -@ cdecl ?_query_new_handler@@YAP6AHI@ZXZ() msvcrt.?_query_new_handler@@YAP6AHI@ZXZ -@ cdecl ?_query_new_mode@@YAHXZ() msvcrt.?_query_new_mode@@YAHXZ -@ cdecl ?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z(ptr) msvcrt.?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z -@ cdecl ?_set_new_mode@@YAHH@Z(long) msvcrt.?_set_new_mode@@YAHH@Z -@ cdecl ?_set_se_translator@@YAP6AXIPAU_EXCEPTION_POINTERS@@@ZP6AXI0@Z@Z(ptr) msvcrt.?_set_se_translator@@YAP6AXIPAU_EXCEPTION_POINTERS@@@ZP6AXI0@Z@Z +@ cdecl ?_query_new_handler@@YAP6AHI@ZXZ() MSVCRT__query_new_handler +@ cdecl ?_query_new_mode@@YAHXZ() MSVCRT__query_new_mode +@ cdecl ?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z(ptr) MSVCRT__set_new_handler +@ cdecl ?_set_new_mode@@YAHH@Z(long) MSVCRT__set_new_mode +@ cdecl ?_set_se_translator@@YAP6AXIPAU_EXCEPTION_POINTERS@@@ZP6AXI0@Z@Z(ptr) MSVCRT__set_se_translator @ stub ?adjustfield@ios@@2JB @ stub ?allocate@streambuf@@IAEHXZ @ stub ?attach@filebuf@@QAEPAV1@H@Z @@ -276,7 +276,7 @@ @ stub ?bad@ios@@QBEHXZ @ stub ?base@streambuf@@IBEPADXZ @ stub ?basefield@ios@@2JB -@ cdecl -i386 ?before@type_info@@QBEHABV1@@Z(ptr) msvcrt.?before@type_info@@QBEHABV1@@Z +@ cdecl -i386 ?before@type_info@@QBEHABV1@@Z(ptr) __thiscall_MSVCRT_type_info_before @ stub ?binary@filebuf@@2HB @ stub ?bitalloc@ios@@SAJXZ @ stub ?blen@streambuf@@IBEHXZ @@ -354,7 +354,7 @@ @ stub ?lockc@ios@@KAXXZ @ stub ?lockptr@ios@@IAEPAU_CRT_CRITICAL_SECTION@@XZ @ stub ?lockptr@streambuf@@IAEPAU_CRT_CRITICAL_SECTION@@XZ -@ cdecl -i386 ?name@type_info@@QBEPBDXZ() msvcrt.?name@type_info@@QBEPBDXZ +@ cdecl -i386 ?name@type_info@@QBEPBDXZ() __thiscall_MSVCRT_type_info_name @ stub ?oct@@YAAAVios@@AAV1@@Z @ stub ?open@filebuf@@QAEPAV1@PBDHH@Z @ stub ?open@fstream@@QAEXPBDHH@Z @@ -382,7 +382,7 @@ @ stub ?put@ostream@@QAEAAV1@E@Z @ stub ?putback@istream@@QAEAAV1@D@Z @ stub ?pword@ios@@QBEAAPAXH@Z -@ cdecl -i386 ?raw_name@type_info@@QBEPBDXZ() msvcrt.?raw_name@type_info@@QBEPBDXZ +@ cdecl -i386 ?raw_name@type_info@@QBEPBDXZ() __thiscall_MSVCRT_type_info_raw_name @ stub ?rdbuf@fstream@@QBEPAVfilebuf@@XZ @ stub ?rdbuf@ifstream@@QBEPAVfilebuf@@XZ @ stub ?rdbuf@ios@@QBEPAVstreambuf@@XZ @@ -405,9 +405,9 @@ @ stub ?seekp@ostream@@QAEAAV1@J@Z @ stub ?seekp@ostream@@QAEAAV1@JW4seek_dir@ios@@@Z @ stub ?seekpos@streambuf@@UAEJJH@Z -@ cdecl ?set_new_handler@@YAP6AXXZP6AXXZ@Z(ptr) msvcrt.?set_new_handler@@YAP6AXXZP6AXXZ@Z -@ cdecl ?set_terminate@@YAP6AXXZP6AXXZ@Z(ptr) msvcrt.?set_terminate@@YAP6AXXZP6AXXZ@Z -@ cdecl ?set_unexpected@@YAP6AXXZP6AXXZ@Z(ptr) msvcrt.?set_unexpected@@YAP6AXXZP6AXXZ@Z +@ cdecl ?set_new_handler@@YAP6AXXZP6AXXZ@Z(ptr) MSVCRT_set_new_handler +@ cdecl ?set_terminate@@YAP6AXXZP6AXXZ@Z(ptr) MSVCRT_set_terminate +@ cdecl ?set_unexpected@@YAP6AXXZP6AXXZ@Z(ptr) MSVCRT_set_unexpected @ stub ?setb@streambuf@@IAEXPAD0H@Z @ stub ?setbuf@filebuf@@UAEPAVstreambuf@@PADH@Z @ stub ?setbuf@fstream@@QAEPAVstreambuf@@PADH@Z @@ -450,7 +450,7 @@ @ stub ?sync_with_stdio@ios@@SAXXZ @ stub ?tellg@istream@@QAEJXZ @ stub ?tellp@ostream@@QAEJXZ -@ cdecl ?terminate@@YAXXZ() msvcrt.?terminate@@YAXXZ +@ cdecl ?terminate@@YAXXZ() MSVCRT_terminate @ stub ?text@filebuf@@2HB @ stub ?tie@ios@@QAEPAVostream@@PAV2@@Z @ stub ?tie@ios@@QBEPAVostream@@XZ @@ -459,13 +459,13 @@ @ stub ?underflow@filebuf@@UAEHXZ @ stub ?underflow@stdiobuf@@UAEHXZ @ stub ?underflow@strstreambuf@@UAEHXZ -@ cdecl ?unexpected@@YAXXZ() msvcrt.?unexpected@@YAXXZ +@ cdecl ?unexpected@@YAXXZ() MSVCRT_unexpected @ stub ?unlock@ios@@QAAXXZ @ stub ?unlock@streambuf@@QAEXXZ @ stub ?unlockbuf@ios@@QAAXXZ @ stub ?unlockc@ios@@KAXXZ @ stub ?unsetf@ios@@QAEJJ@Z -@ cdecl -i386 ?what@exception@@UBEPBDXZ() msvcrt.?what@exception@@UBEPBDXZ +@ cdecl -i386 ?what@exception@@UBEPBDXZ() __thiscall_MSVCRT_what_exception @ stub ?width@ios@@QAEHH@Z @ stub ?width@ios@@QBEHXZ @ stub ?write@ostream@@QAEAAV1@PBCH@Z @@ -480,686 +480,686 @@ @ stub ?xalloc@ios@@SAHXZ @ stub ?xsgetn@streambuf@@UAEHPADH@Z @ stub ?xsputn@streambuf@@UAEHPBDH@Z -@ cdecl $I10_OUTPUT() msvcrt.$I10_OUTPUT -@ cdecl -arch=i386 _CIacos() msvcrt._CIacos -@ cdecl -arch=i386 _CIasin() msvcrt._CIasin -@ cdecl -arch=i386 _CIatan() msvcrt._CIatan -@ cdecl -arch=i386 _CIatan2() msvcrt._CIatan2 -@ cdecl -arch=i386 _CIcos() msvcrt._CIcos -@ cdecl -arch=i386 _CIcosh() msvcrt._CIcosh -@ cdecl -arch=i386 _CIexp() msvcrt._CIexp -@ cdecl -arch=i386 _CIfmod() msvcrt._CIfmod -@ cdecl -arch=i386 _CIlog() msvcrt._CIlog -@ cdecl -arch=i386 _CIlog10() msvcrt._CIlog10 -@ cdecl -arch=i386 _CIpow() msvcrt._CIpow -@ cdecl -arch=i386 _CIsin() msvcrt._CIsin -@ cdecl -arch=i386 _CIsinh() msvcrt._CIsinh -@ cdecl -arch=i386 _CIsqrt() msvcrt._CIsqrt -@ cdecl -arch=i386 _CItan() msvcrt._CItan -@ cdecl -arch=i386 _CItanh() msvcrt._CItanh -@ stdcall _CxxThrowException(long long) msvcrt._CxxThrowException -@ cdecl -i386 _EH_prolog() msvcrt._EH_prolog -@ extern _HUGE msvcrt._HUGE -@ cdecl _XcptFilter(long ptr) msvcrt._XcptFilter -@ cdecl -i386 __CxxFrameHandler(ptr ptr ptr ptr) msvcrt.__CxxFrameHandler -@ stdcall __CxxLongjmpUnwind(ptr) msvcrt.__CxxLongjmpUnwind -@ cdecl __RTCastToVoid(ptr) msvcrt.__RTCastToVoid -@ cdecl __RTDynamicCast(ptr long ptr ptr long) msvcrt.__RTDynamicCast -@ cdecl __RTtypeid(ptr) msvcrt.__RTtypeid -@ cdecl __STRINGTOLD(ptr ptr str long) msvcrt.__STRINGTOLD -@ extern __argc msvcrt.__argc -@ extern __argv msvcrt.__argv -@ cdecl __dllonexit(ptr ptr ptr) msvcrt.__dllonexit -@ cdecl __doserrno() msvcrt.__doserrno -@ cdecl __fpecode() msvcrt.__fpecode -@ cdecl __getmainargs(ptr ptr ptr long ptr) msvcrt.__getmainargs -@ extern __initenv msvcrt.__initenv -@ cdecl __isascii(long) msvcrt.__isascii -@ cdecl __iscsym(long) msvcrt.__iscsym -@ cdecl __iscsymf(long) msvcrt.__iscsymf -@ cdecl __lconv_init() msvcrt.__lconv_init -@ extern __mb_cur_max msvcrt.__mb_cur_max -@ cdecl -arch=i386 __p___argc() msvcrt.__p___argc -@ cdecl -arch=i386 __p___argv() msvcrt.__p___argv -@ cdecl -arch=i386 __p___initenv() msvcrt.__p___initenv -@ cdecl -arch=i386 __p___mb_cur_max() msvcrt.__p___mb_cur_max -@ cdecl -arch=i386 __p___wargv() msvcrt.__p___wargv -@ cdecl -arch=i386 __p___winitenv() msvcrt.__p___winitenv -@ cdecl -arch=i386 __p__acmdln() msvcrt.__p__acmdln -@ cdecl -arch=i386 __p__amblksiz() msvcrt.__p__amblksiz -@ cdecl -arch=i386 __p__commode() msvcrt.__p__commode -@ cdecl -arch=i386 __p__daylight() msvcrt.__p__daylight -@ cdecl -arch=i386 __p__dstbias() msvcrt.__p__dstbias -@ cdecl -arch=i386 __p__environ() msvcrt.__p__environ -@ cdecl -arch=i386 __p__fmode() msvcrt.__p__fmode -@ cdecl -arch=i386 __p__iob() msvcrt.__p__iob -@ cdecl -arch=i386 __p__mbctype() msvcrt.__p__mbctype -@ cdecl -arch=i386 __p__osver() msvcrt.__p__osver -@ cdecl -arch=i386 __p__pctype() msvcrt.__p__pctype -@ cdecl -arch=i386 __p__pgmptr() msvcrt.__p__pgmptr -@ cdecl -arch=i386 __p__pwctype() msvcrt.__p__pwctype -@ cdecl -arch=i386 __p__timezone() msvcrt.__p__timezone -@ cdecl -arch=i386 __p__tzname() msvcrt.__p__tzname -@ cdecl -arch=i386 __p__wcmdln() msvcrt.__p__wcmdln -@ cdecl -arch=i386 __p__wenviron() msvcrt.__p__wenviron -@ cdecl -arch=i386 __p__winmajor() msvcrt.__p__winmajor -@ cdecl -arch=i386 __p__winminor() msvcrt.__p__winminor -@ cdecl -arch=i386 __p__winver() msvcrt.__p__winver -@ cdecl -arch=i386 __p__wpgmptr() msvcrt.__p__wpgmptr -@ cdecl __pxcptinfoptrs() msvcrt.__pxcptinfoptrs -@ cdecl __set_app_type(long) msvcrt.__set_app_type -@ cdecl __setusermatherr(ptr) msvcrt.__setusermatherr -@ cdecl __threadhandle() msvcrt.__threadhandle -@ cdecl __threadid() msvcrt.__threadid -@ cdecl __toascii(long) msvcrt.__toascii -@ cdecl __unDName(long str ptr ptr long) msvcrt.__unDName -@ extern __wargv msvcrt.__wargv -@ cdecl __wgetmainargs(ptr ptr ptr long ptr) msvcrt.__wgetmainargs -@ extern __winitenv msvcrt.__winitenv -@ cdecl _abnormal_termination() msvcrt._abnormal_termination -@ cdecl _access(str long) msvcrt._access -@ extern _acmdln msvcrt._acmdln -@ stdcall _adj_fdiv_m16i(long) msvcrt._adj_fdiv_m16i -@ stdcall _adj_fdiv_m32(long) msvcrt._adj_fdiv_m32 -@ stdcall _adj_fdiv_m32i(long) msvcrt._adj_fdiv_m32i -@ stdcall _adj_fdiv_m64(long long) msvcrt._adj_fdiv_m64 -@ cdecl _adj_fdiv_r() msvcrt._adj_fdiv_r -@ stdcall _adj_fdivr_m16i(long) msvcrt._adj_fdivr_m16i -@ stdcall _adj_fdivr_m32(long) msvcrt._adj_fdivr_m32 -@ stdcall _adj_fdivr_m32i(long) msvcrt._adj_fdivr_m32i -@ stdcall _adj_fdivr_m64(long long) msvcrt._adj_fdivr_m64 -@ cdecl _adj_fpatan() msvcrt._adj_fpatan -@ cdecl _adj_fprem() msvcrt._adj_fprem -@ cdecl _adj_fprem1() msvcrt._adj_fprem1 -@ cdecl _adj_fptan() msvcrt._adj_fptan -@ extern _adjust_fdiv msvcrt._adjust_fdiv -@ extern _aexit_rtn msvcrt._aexit_rtn -@ cdecl _amsg_exit(long) msvcrt._amsg_exit -@ cdecl _assert(str str long) msvcrt._assert -@ cdecl _atodbl(ptr str) msvcrt._atodbl -@ cdecl _atoldbl(ptr str) msvcrt._atoldbl -@ cdecl _beep(long long) msvcrt._beep -@ cdecl _beginthread(ptr long ptr) msvcrt._beginthread -@ cdecl _beginthreadex(ptr long ptr ptr long ptr) msvcrt._beginthreadex -@ cdecl _c_exit() msvcrt._c_exit -@ cdecl _cabs(long) msvcrt._cabs -@ cdecl _cexit() msvcrt._cexit -@ cdecl _cgets(str) msvcrt._cgets -@ cdecl _chdir(str) msvcrt._chdir -@ cdecl _chdrive(long) msvcrt._chdrive -@ cdecl _chgsign( double ) msvcrt._chgsign -@ cdecl _chmod(str long) msvcrt._chmod -@ cdecl _chsize(long long) msvcrt._chsize -@ cdecl _clearfp() msvcrt._clearfp -@ cdecl _close(long) msvcrt._close -@ cdecl _commit(long) msvcrt._commit -@ extern _commode msvcrt._commode -@ cdecl _control87(long long) msvcrt._control87 -@ cdecl _controlfp(long long) msvcrt._controlfp -@ cdecl _copysign( double double ) msvcrt._copysign -@ varargs _cprintf(str) msvcrt._cprintf -@ cdecl _cputs(str) msvcrt._cputs -@ cdecl _creat(str long) msvcrt._creat -@ varargs _cscanf(str) msvcrt._cscanf -@ extern _ctype msvcrt._ctype -@ cdecl _cwait(ptr long long) msvcrt._cwait -@ extern _daylight msvcrt._daylight -@ extern _dstbias msvcrt._dstbias -@ cdecl _dup(long) msvcrt._dup -@ cdecl _dup2(long long) msvcrt._dup2 -@ cdecl _ecvt( double long ptr ptr) msvcrt._ecvt -@ cdecl _endthread() msvcrt._endthread -@ cdecl _endthreadex(long) msvcrt._endthreadex -@ extern _environ msvcrt._environ -@ cdecl _eof(long) msvcrt._eof -@ cdecl _errno() msvcrt._errno -@ cdecl _except_handler2(ptr ptr ptr ptr) msvcrt._except_handler2 -@ cdecl _except_handler3(ptr ptr ptr ptr) msvcrt._except_handler3 -@ varargs _execl(str str) msvcrt._execl -@ varargs _execle(str str) msvcrt._execle -@ varargs _execlp(str str) msvcrt._execlp -@ varargs _execlpe(str str) msvcrt._execlpe -@ cdecl _execv(str ptr) msvcrt._execv -@ cdecl _execve(str ptr ptr) msvcrt._execve -@ cdecl _execvp(str ptr) msvcrt._execvp -@ cdecl _execvpe(str ptr ptr) msvcrt._execvpe -@ cdecl _exit(long) msvcrt._exit -@ cdecl _expand(ptr long) msvcrt._expand -@ cdecl _fcloseall() msvcrt._fcloseall -@ cdecl _fcvt( double long ptr ptr) msvcrt._fcvt -@ cdecl _fdopen(long str) msvcrt._fdopen -@ cdecl _fgetchar() msvcrt._fgetchar -@ cdecl _fgetwchar() msvcrt._fgetwchar -@ cdecl _filbuf(ptr) msvcrt._filbuf -@ extern _fileinfo msvcrt._fileinfo -@ cdecl _filelength(long) msvcrt._filelength -@ cdecl -ret64 _filelengthi64(long) msvcrt._filelengthi64 -@ cdecl _fileno(ptr) msvcrt._fileno -@ cdecl _findclose(long) msvcrt._findclose -@ cdecl _findfirst(str ptr) msvcrt._findfirst -@ cdecl _findfirsti64(str ptr) msvcrt._findfirsti64 -@ cdecl _findnext(long ptr) msvcrt._findnext -@ cdecl _findnexti64(long ptr) msvcrt._findnexti64 -@ cdecl _finite( double ) msvcrt._finite -@ cdecl _flsbuf(long ptr) msvcrt._flsbuf -@ cdecl _flushall() msvcrt._flushall -@ extern _fmode msvcrt._fmode -@ cdecl _fpclass(double) msvcrt._fpclass -@ cdecl _fpieee_flt(long ptr ptr) msvcrt._fpieee_flt -@ cdecl _fpreset() msvcrt._fpreset -@ cdecl _fputchar(long) msvcrt._fputchar -@ cdecl _fputwchar(long) msvcrt._fputwchar -@ cdecl _fsopen(str str long) msvcrt._fsopen -@ cdecl _fstat(long ptr) msvcrt._fstat -@ cdecl _fstati64(long ptr) msvcrt._fstati64 -@ cdecl _ftime(ptr) msvcrt._ftime -@ cdecl -ret64 _ftol() msvcrt._ftol -@ cdecl _fullpath(ptr str long) msvcrt._fullpath -@ cdecl _futime(long ptr) msvcrt._futime -@ cdecl _gcvt( double long str) msvcrt._gcvt -@ cdecl _get_osfhandle(long) msvcrt._get_osfhandle -@ cdecl _getch() msvcrt._getch -@ cdecl _getche() msvcrt._getche -@ cdecl _getcwd(str long) msvcrt._getcwd -@ cdecl _getdcwd(long str long) msvcrt._getdcwd -@ cdecl _getdiskfree(long ptr) msvcrt._getdiskfree -@ cdecl _getdllprocaddr(long str long) msvcrt._getdllprocaddr -@ cdecl _getdrive() msvcrt._getdrive -@ cdecl _getdrives() msvcrt._getdrives -@ cdecl _getmaxstdio() msvcrt._getmaxstdio -@ cdecl _getmbcp() msvcrt._getmbcp -@ cdecl _getpid() msvcrt._getpid -@ cdecl _getsystime(ptr) msvcrt._getsystime -@ cdecl _getw(ptr) msvcrt._getw -@ cdecl _getws(ptr) msvcrt._getws -@ cdecl _global_unwind2(ptr) msvcrt._global_unwind2 -@ cdecl _heapadd(ptr long) msvcrt._heapadd -@ cdecl _heapchk() msvcrt._heapchk -@ cdecl _heapmin() msvcrt._heapmin -@ cdecl _heapset(long) msvcrt._heapset -@ cdecl _heapused(ptr ptr) msvcrt._heapused -@ cdecl _heapwalk(ptr) msvcrt._heapwalk -@ cdecl _hypot(double double) msvcrt._hypot -@ cdecl _initterm(ptr ptr) msvcrt._initterm -@ cdecl -i386 _inp(long) msvcrt._inp -@ cdecl -i386 _inpd(long) msvcrt._inpd -@ cdecl -i386 _inpw(long) msvcrt._inpw -@ extern _iob msvcrt._iob -@ cdecl _isatty(long) msvcrt._isatty -@ cdecl _isctype(long long) msvcrt._isctype -@ cdecl _ismbbalnum(long) msvcrt._ismbbalnum -@ cdecl _ismbbalpha(long) msvcrt._ismbbalpha -@ cdecl _ismbbgraph(long) msvcrt._ismbbgraph -@ cdecl _ismbbkalnum(long) msvcrt._ismbbkalnum -@ cdecl _ismbbkana(long) msvcrt._ismbbkana -@ cdecl _ismbbkprint(long) msvcrt._ismbbkprint -@ cdecl _ismbbkpunct(long) msvcrt._ismbbkpunct -@ cdecl _ismbblead(long) msvcrt._ismbblead -@ cdecl _ismbbprint(long) msvcrt._ismbbprint -@ cdecl _ismbbpunct(long) msvcrt._ismbbpunct -@ cdecl _ismbbtrail(long) msvcrt._ismbbtrail -@ cdecl _ismbcalnum(long) msvcrt._ismbcalnum -@ cdecl _ismbcalpha(long) msvcrt._ismbcalpha -@ cdecl _ismbcdigit(long) msvcrt._ismbcdigit -@ cdecl _ismbcgraph(long) msvcrt._ismbcgraph -@ cdecl _ismbchira(long) msvcrt._ismbchira -@ cdecl _ismbckata(long) msvcrt._ismbckata -@ cdecl _ismbcl0(long) msvcrt._ismbcl0 -@ cdecl _ismbcl1(long) msvcrt._ismbcl1 -@ cdecl _ismbcl2(long) msvcrt._ismbcl2 -@ cdecl _ismbclegal(long) msvcrt._ismbclegal -@ cdecl _ismbclower(long) msvcrt._ismbclower -@ cdecl _ismbcprint(long) msvcrt._ismbcprint -@ cdecl _ismbcpunct(long) msvcrt._ismbcpunct -@ cdecl _ismbcspace(long) msvcrt._ismbcspace -@ cdecl _ismbcsymbol(long) msvcrt._ismbcsymbol -@ cdecl _ismbcupper(long) msvcrt._ismbcupper -@ cdecl _ismbslead(ptr ptr) msvcrt._ismbslead -@ cdecl _ismbstrail(ptr ptr) msvcrt._ismbstrail -@ cdecl _isnan( double ) msvcrt._isnan -@ cdecl _itoa(long ptr long) msvcrt._itoa -@ cdecl _itow(long ptr long) msvcrt._itow -@ cdecl _j0(double) msvcrt._j0 -@ cdecl _j1(double) msvcrt._j1 -@ cdecl _jn(long double) msvcrt._jn -@ cdecl _kbhit() msvcrt._kbhit -@ cdecl _lfind(ptr ptr ptr long ptr) msvcrt._lfind -@ cdecl _loaddll(str) msvcrt._loaddll -@ cdecl _local_unwind2(ptr long) msvcrt._local_unwind2 -@ cdecl _locking(long long long) msvcrt._locking -@ cdecl _logb(double) msvcrt._logb -@ cdecl _longjmpex(ptr long) msvcrt._longjmpex -@ cdecl _lrotl(long long) msvcrt._lrotl -@ cdecl _lrotr(long long) msvcrt._lrotr -@ cdecl _lsearch(ptr ptr long long ptr) msvcrt._lsearch -@ cdecl _lseek(long long long) msvcrt._lseek -@ cdecl -ret64 _lseeki64(long long long long) msvcrt._lseeki64 -@ cdecl _ltoa(long ptr long) msvcrt._ltoa -@ cdecl _ltow(long ptr long) msvcrt._ltow -@ cdecl _makepath(str str str str str) msvcrt._makepath -@ cdecl _mbbtombc(long) msvcrt._mbbtombc -@ cdecl _mbbtype(long long) msvcrt._mbbtype -@ cdecl _mbccpy(str str) msvcrt._mbccpy -@ cdecl _mbcjistojms(long) msvcrt._mbcjistojms -@ cdecl _mbcjmstojis(long) msvcrt._mbcjmstojis -@ cdecl _mbclen(ptr) msvcrt._mbclen -@ cdecl _mbctohira(long) msvcrt._mbctohira -@ cdecl _mbctokata(long) msvcrt._mbctokata -@ cdecl _mbctolower(long) msvcrt._mbctolower -@ cdecl _mbctombb(long) msvcrt._mbctombb -@ cdecl _mbctoupper(long) msvcrt._mbctoupper -@ extern _mbctype msvcrt._mbctype -@ cdecl _mbsbtype(str long) msvcrt._mbsbtype -@ cdecl _mbscat(str str) msvcrt._mbscat -@ cdecl _mbschr(str long) msvcrt._mbschr -@ cdecl _mbscmp(str str) msvcrt._mbscmp -@ cdecl _mbscoll(str str) msvcrt._mbscoll -@ cdecl _mbscpy(ptr str) msvcrt._mbscpy -@ cdecl _mbscspn(str str) msvcrt._mbscspn -@ cdecl _mbsdec(ptr ptr) msvcrt._mbsdec -@ cdecl _mbsdup(str) msvcrt._mbsdup -@ cdecl _mbsicmp(str str) msvcrt._mbsicmp -@ cdecl _mbsicoll(str str) msvcrt._mbsicoll -@ cdecl _mbsinc(str) msvcrt._mbsinc -@ cdecl _mbslen(str) msvcrt._mbslen -@ cdecl _mbslwr(str) msvcrt._mbslwr -@ cdecl _mbsnbcat(str str long) msvcrt._mbsnbcat -@ cdecl _mbsnbcmp(str str long) msvcrt._mbsnbcmp -@ cdecl _mbsnbcnt(ptr long) msvcrt._mbsnbcnt -@ cdecl _mbsnbcoll(str str long) msvcrt._mbsnbcoll -@ cdecl _mbsnbcpy(ptr str long) msvcrt._mbsnbcpy -@ cdecl _mbsnbicmp(str str long) msvcrt._mbsnbicmp -@ cdecl _mbsnbicoll(str str long) msvcrt._mbsnbicoll -@ cdecl _mbsnbset(str long long) msvcrt._mbsnbset -@ cdecl _mbsncat(str str long) msvcrt._mbsncat -@ cdecl _mbsnccnt(str long) msvcrt._mbsnccnt -@ cdecl _mbsncmp(str str long) msvcrt._mbsncmp -@ cdecl _mbsncoll(str str long) msvcrt._mbsncoll -@ cdecl _mbsncpy(str str long) msvcrt._mbsncpy -@ cdecl _mbsnextc(str) msvcrt._mbsnextc -@ cdecl _mbsnicmp(str str long) msvcrt._mbsnicmp -@ cdecl _mbsnicoll(str str long) msvcrt._mbsnicoll -@ cdecl _mbsninc(str long) msvcrt._mbsninc -@ cdecl _mbsnset(str long long) msvcrt._mbsnset -@ cdecl _mbspbrk(str str) msvcrt._mbspbrk -@ cdecl _mbsrchr(str long) msvcrt._mbsrchr -@ cdecl _mbsrev(str) msvcrt._mbsrev -@ cdecl _mbsset(str long) msvcrt._mbsset -@ cdecl _mbsspn(str str) msvcrt._mbsspn -@ cdecl _mbsspnp(str str) msvcrt._mbsspnp -@ cdecl _mbsstr(str str) msvcrt._mbsstr -@ cdecl _mbstok(str str) msvcrt._mbstok -@ cdecl _mbstrlen(str) msvcrt._mbstrlen -@ cdecl _mbsupr(str) msvcrt._mbsupr -@ cdecl _memccpy(ptr ptr long long) msvcrt._memccpy -@ cdecl _memicmp(str str long) msvcrt._memicmp -@ cdecl _mkdir(str) msvcrt._mkdir -@ cdecl _mktemp(str) msvcrt._mktemp -@ cdecl _msize(ptr) msvcrt._msize +@ cdecl $I10_OUTPUT() MSVCRT_I10_OUTPUT +@ cdecl -arch=i386 _CIacos() +@ cdecl -arch=i386 _CIasin() +@ cdecl -arch=i386 _CIatan() +@ cdecl -arch=i386 _CIatan2() +@ cdecl -arch=i386 _CIcos() +@ cdecl -arch=i386 _CIcosh() +@ cdecl -arch=i386 _CIexp() +@ cdecl -arch=i386 _CIfmod() +@ cdecl -arch=i386 _CIlog() +@ cdecl -arch=i386 _CIlog10() +@ cdecl -arch=i386 _CIpow() +@ cdecl -arch=i386 _CIsin() +@ cdecl -arch=i386 _CIsinh() +@ cdecl -arch=i386 _CIsqrt() +@ cdecl -arch=i386 _CItan() +@ cdecl -arch=i386 _CItanh() +@ stdcall _CxxThrowException(long long) +@ cdecl -i386 _EH_prolog() +@ extern _HUGE +@ cdecl _XcptFilter(long ptr) +@ cdecl -i386 __CxxFrameHandler(ptr ptr ptr ptr) +@ stdcall __CxxLongjmpUnwind(ptr) +@ cdecl __RTCastToVoid(ptr) MSVCRT___RTCastToVoid +@ cdecl __RTDynamicCast(ptr long ptr ptr long) MSVCRT___RTDynamicCast +@ cdecl __RTtypeid(ptr) MSVCRT___RTtypeid +@ cdecl __STRINGTOLD(ptr ptr str long) +@ extern __argc +@ extern __argv +@ cdecl __dllonexit(ptr ptr ptr) +@ cdecl __doserrno() +@ cdecl __fpecode() +@ cdecl __getmainargs(ptr ptr ptr long ptr) +@ extern __initenv +@ cdecl __isascii(long) +@ cdecl __iscsym(long) +@ cdecl __iscsymf(long) +@ cdecl __lconv_init() +@ extern __mb_cur_max +@ cdecl -arch=i386 __p___argc() +@ cdecl -arch=i386 __p___argv() +@ cdecl -arch=i386 __p___initenv() +@ cdecl -arch=i386 __p___mb_cur_max() +@ cdecl -arch=i386 __p___wargv() +@ cdecl -arch=i386 __p___winitenv() +@ cdecl -arch=i386 __p__acmdln() +@ cdecl -arch=i386 __p__amblksiz() +@ cdecl -arch=i386 __p__commode() +@ cdecl -arch=i386 __p__daylight() +@ cdecl -arch=i386 __p__dstbias() +@ cdecl -arch=i386 __p__environ() +@ cdecl -arch=i386 __p__fmode() +@ cdecl -arch=i386 __p__iob() +@ cdecl -arch=i386 __p__mbctype() +@ cdecl -arch=i386 __p__osver() +@ cdecl -arch=i386 __p__pctype() +@ cdecl -arch=i386 __p__pgmptr() +@ cdecl -arch=i386 __p__pwctype() +@ cdecl -arch=i386 __p__timezone() +@ cdecl -arch=i386 __p__tzname() +@ cdecl -arch=i386 __p__wcmdln() +@ cdecl -arch=i386 __p__wenviron() +@ cdecl -arch=i386 __p__winmajor() +@ cdecl -arch=i386 __p__winminor() +@ cdecl -arch=i386 __p__winver() +@ cdecl -arch=i386 __p__wpgmptr() +@ cdecl __pxcptinfoptrs() +@ cdecl __set_app_type(long) +@ cdecl __setusermatherr(ptr) +@ cdecl __threadhandle() +@ cdecl __threadid() +@ cdecl __toascii(long) +@ cdecl __unDName(long str ptr ptr long) +@ extern __wargv +@ cdecl __wgetmainargs(ptr ptr ptr long ptr) +@ extern __winitenv +@ cdecl _abnormal_termination() +@ cdecl _access(str long) +@ extern _acmdln +@ stdcall _adj_fdiv_m16i(long) +@ stdcall _adj_fdiv_m32(long) +@ stdcall _adj_fdiv_m32i(long) +@ stdcall _adj_fdiv_m64(long long) +@ cdecl _adj_fdiv_r() +@ stdcall _adj_fdivr_m16i(long) +@ stdcall _adj_fdivr_m32(long) +@ stdcall _adj_fdivr_m32i(long) +@ stdcall _adj_fdivr_m64(long long) +@ cdecl _adj_fpatan() +@ cdecl _adj_fprem() +@ cdecl _adj_fprem1() +@ cdecl _adj_fptan() +@ extern _adjust_fdiv +@ extern _aexit_rtn +@ cdecl _amsg_exit(long) +@ cdecl _assert(str str long) +@ cdecl _atodbl(ptr str) +@ cdecl _atoldbl(ptr str) +@ cdecl _beep(long long) +@ cdecl _beginthread(ptr long ptr) +@ cdecl _beginthreadex(ptr long ptr ptr long ptr) +@ cdecl _c_exit() +@ cdecl _cabs(long) +@ cdecl _cexit() +@ cdecl _cgets(str) +@ cdecl _chdir(str) +@ cdecl _chdrive(long) +@ cdecl _chgsign( double ) +@ cdecl _chmod(str long) +@ cdecl _chsize(long long) +@ cdecl _clearfp() +@ cdecl _close(long) +@ cdecl _commit(long) +@ extern _commode +@ cdecl _control87(long long) +@ cdecl _controlfp(long long) +@ cdecl _copysign( double double ) +@ varargs _cprintf(str) +@ cdecl _cputs(str) +@ cdecl _creat(str long) +@ varargs _cscanf(str) +@ extern _ctype +@ cdecl _cwait(ptr long long) +@ extern _daylight +@ extern _dstbias +@ cdecl _dup(long) +@ cdecl _dup2(long long) +@ cdecl _ecvt( double long ptr ptr) +@ cdecl _endthread() +@ cdecl _endthreadex(long) +@ extern _environ +@ cdecl _eof(long) +@ cdecl _errno() +@ cdecl _except_handler2(ptr ptr ptr ptr) +@ cdecl _except_handler3(ptr ptr ptr ptr) +@ varargs _execl(str str) +@ varargs _execle(str str) +@ varargs _execlp(str str) +@ varargs _execlpe(str str) +@ cdecl _execv(str ptr) +@ cdecl _execve(str ptr ptr) +@ cdecl _execvp(str ptr) +@ cdecl _execvpe(str ptr ptr) +@ cdecl _exit(long) +@ cdecl _expand(ptr long) +@ cdecl _fcloseall() +@ cdecl _fcvt( double long ptr ptr) +@ cdecl _fdopen(long str) +@ cdecl _fgetchar() +@ cdecl _fgetwchar() +@ cdecl _filbuf(ptr) +@ extern _fileinfo +@ cdecl _filelength(long) +@ cdecl -ret64 _filelengthi64(long) +@ cdecl _fileno(ptr) +@ cdecl _findclose(long) +@ cdecl _findfirst(str ptr) +@ cdecl _findfirsti64(str ptr) +@ cdecl _findnext(long ptr) +@ cdecl _findnexti64(long ptr) +@ cdecl _finite( double ) +@ cdecl _flsbuf(long ptr) +@ cdecl _flushall() +@ extern _fmode +@ cdecl _fpclass(double) +@ cdecl _fpieee_flt(long ptr ptr) +@ cdecl _fpreset() +@ cdecl _fputchar(long) +@ cdecl _fputwchar(long) +@ cdecl _fsopen(str str long) +@ cdecl _fstat(long ptr) +@ cdecl _fstati64(long ptr) +@ cdecl _ftime(ptr) +@ cdecl -ret64 _ftol() +@ cdecl _fullpath(ptr str long) +@ cdecl _futime(long ptr) +@ cdecl _gcvt( double long str) +@ cdecl _get_osfhandle(long) +@ cdecl _getch() +@ cdecl _getche() +@ cdecl _getcwd(str long) +@ cdecl _getdcwd(long str long) +@ cdecl _getdiskfree(long ptr) +@ cdecl _getdllprocaddr(long str long) +@ cdecl _getdrive() +@ cdecl _getdrives() +@ cdecl _getmaxstdio() +@ cdecl _getmbcp() +@ cdecl _getpid() +@ cdecl _getsystime(ptr) +@ cdecl _getw(ptr) +@ cdecl _getws(ptr) +@ cdecl _global_unwind2(ptr) +@ cdecl _heapadd(ptr long) +@ cdecl _heapchk() +@ cdecl _heapmin() +@ cdecl _heapset(long) +@ cdecl _heapused(ptr ptr) +@ cdecl _heapwalk(ptr) +@ cdecl _hypot(double double) +@ cdecl _initterm(ptr ptr) +@ cdecl -i386 _inp(long) MSVCRT__inp +@ cdecl -i386 _inpd(long) MSVCRT__inpd +@ cdecl -i386 _inpw(long) MSVCRT__inpw +@ extern _iob +@ cdecl _isatty(long) +@ cdecl _isctype(long long) +@ cdecl _ismbbalnum(long) +@ cdecl _ismbbalpha(long) +@ cdecl _ismbbgraph(long) +@ cdecl _ismbbkalnum(long) +@ cdecl _ismbbkana(long) +@ cdecl _ismbbkprint(long) +@ cdecl _ismbbkpunct(long) +@ cdecl _ismbblead(long) +@ cdecl _ismbbprint(long) +@ cdecl _ismbbpunct(long) +@ cdecl _ismbbtrail(long) +@ cdecl _ismbcalnum(long) +@ cdecl _ismbcalpha(long) +@ cdecl _ismbcdigit(long) +@ cdecl _ismbcgraph(long) +@ cdecl _ismbchira(long) +@ cdecl _ismbckata(long) +@ cdecl _ismbcl0(long) +@ cdecl _ismbcl1(long) +@ cdecl _ismbcl2(long) +@ cdecl _ismbclegal(long) +@ cdecl _ismbclower(long) +@ cdecl _ismbcprint(long) +@ cdecl _ismbcpunct(long) +@ cdecl _ismbcspace(long) +@ cdecl _ismbcsymbol(long) +@ cdecl _ismbcupper(long) +@ cdecl _ismbslead(ptr ptr) +@ cdecl _ismbstrail(ptr ptr) +@ cdecl _isnan( double ) +@ cdecl _itoa(long ptr long) +@ cdecl _itow(long ptr long) +@ cdecl _j0(double) +@ cdecl _j1(double) +@ cdecl _jn(long double) +@ cdecl _kbhit() +@ cdecl _lfind(ptr ptr ptr long ptr) +@ cdecl _loaddll(str) +@ cdecl _local_unwind2(ptr long) +@ cdecl _locking(long long long) +@ cdecl _logb(double) +@ cdecl _longjmpex(ptr long) longjmp +@ cdecl _lrotl(long long) +@ cdecl _lrotr(long long) +@ cdecl _lsearch(ptr ptr long long ptr) +@ cdecl _lseek(long long long) +@ cdecl -ret64 _lseeki64(long long long long) +@ cdecl _ltoa(long ptr long) +@ cdecl _ltow(long ptr long) +@ cdecl _makepath(str str str str str) +@ cdecl _mbbtombc(long) +@ cdecl _mbbtype(long long) +@ cdecl _mbccpy(str str) +@ cdecl _mbcjistojms(long) +@ cdecl _mbcjmstojis(long) +@ cdecl _mbclen(ptr) +@ cdecl _mbctohira(long) +@ cdecl _mbctokata(long) +@ cdecl _mbctolower(long) +@ cdecl _mbctombb(long) +@ cdecl _mbctoupper(long) +@ extern _mbctype +@ cdecl _mbsbtype(str long) +@ cdecl _mbscat(str str) +@ cdecl _mbschr(str long) +@ cdecl _mbscmp(str str) +@ cdecl _mbscoll(str str) +@ cdecl _mbscpy(ptr str) +@ cdecl _mbscspn(str str) +@ cdecl _mbsdec(ptr ptr) +@ cdecl _mbsdup(str) +@ cdecl _mbsicmp(str str) +@ cdecl _mbsicoll(str str) +@ cdecl _mbsinc(str) +@ cdecl _mbslen(str) +@ cdecl _mbslwr(str) +@ cdecl _mbsnbcat(str str long) +@ cdecl _mbsnbcmp(str str long) +@ cdecl _mbsnbcnt(ptr long) +@ cdecl _mbsnbcoll(str str long) +@ cdecl _mbsnbcpy(ptr str long) +@ cdecl _mbsnbicmp(str str long) +@ cdecl _mbsnbicoll(str str long) +@ cdecl _mbsnbset(str long long) +@ cdecl _mbsncat(str str long) +@ cdecl _mbsnccnt(str long) +@ cdecl _mbsncmp(str str long) +@ cdecl _mbsncoll(str str long) +@ cdecl _mbsncpy(str str long) +@ cdecl _mbsnextc(str) +@ cdecl _mbsnicmp(str str long) +@ cdecl _mbsnicoll(str str long) +@ cdecl _mbsninc(str long) +@ cdecl _mbsnset(str long long) +@ cdecl _mbspbrk(str str) +@ cdecl _mbsrchr(str long) +@ cdecl _mbsrev(str) +@ cdecl _mbsset(str long) +@ cdecl _mbsspn(str str) +@ cdecl _mbsspnp(str str) +@ cdecl _mbsstr(str str) +@ cdecl _mbstok(str str) +@ cdecl _mbstrlen(str) +@ cdecl _mbsupr(str) +@ cdecl _memccpy(ptr ptr long long) +@ cdecl _memicmp(str str long) +@ cdecl _mkdir(str) +@ cdecl _mktemp(str) +@ cdecl _msize(ptr) @ stub _mtlock @ stub _mtunlock -@ cdecl _nextafter(double double) msvcrt._nextafter -@ cdecl _onexit(ptr) msvcrt._onexit -@ varargs _open(str long) msvcrt._open -@ cdecl _open_osfhandle(long long) msvcrt._open_osfhandle -@ extern _osver msvcrt._osver -@ cdecl -i386 _outp(long long) msvcrt._outp -@ cdecl -i386 _outpd(long long) msvcrt._outpd -@ cdecl -i386 _outpw(long long) msvcrt._outpw -@ cdecl _pclose(ptr) msvcrt._pclose -@ extern _pctype msvcrt._pctype -@ extern _pgmptr msvcrt._pgmptr -@ cdecl _pipe(ptr long long) msvcrt._pipe -@ cdecl _popen(str str) msvcrt._popen -@ cdecl _purecall() msvcrt._purecall -@ cdecl _putch(long) msvcrt._putch -@ cdecl _putenv(str) msvcrt._putenv -@ cdecl _putw(long ptr) msvcrt._putw -@ cdecl _putws(wstr) msvcrt._putws -@ extern _pwctype msvcrt._pwctype -@ cdecl _read(long ptr long) msvcrt._read -@ cdecl _rmdir(str) msvcrt._rmdir -@ cdecl _rmtmp() msvcrt._rmtmp -@ cdecl _rotl(long long) msvcrt._rotl -@ cdecl _rotr(long long) msvcrt._rotr -@ cdecl _safe_fdiv() msvcrt._safe_fdiv -@ cdecl _safe_fdivr() msvcrt._safe_fdivr -@ cdecl _safe_fprem() msvcrt._safe_fprem -@ cdecl _safe_fprem1() msvcrt._safe_fprem1 -@ cdecl _scalb( double long) msvcrt._scalb -@ cdecl _searchenv(str str ptr) msvcrt._searchenv -@ stdcall -i386 _seh_longjmp_unwind(ptr) msvcrt._seh_longjmp_unwind -@ cdecl _set_error_mode(long) msvcrt._set_error_mode -@ cdecl _seterrormode(long) msvcrt._seterrormode -@ cdecl -i386 _setjmp(ptr) msvcrt._setjmp -@ cdecl -i386 _setjmp3(ptr long) msvcrt._setjmp3 -@ cdecl _setmaxstdio(long) msvcrt._setmaxstdio -@ cdecl _setmbcp(long) msvcrt._setmbcp -@ cdecl _setmode(long long) msvcrt._setmode -@ cdecl _setsystime(ptr long) msvcrt._setsystime -@ cdecl _sleep(long) msvcrt._sleep -@ varargs _snprintf(str long str) msvcrt._snprintf -@ varargs _snwprintf(wstr long wstr) msvcrt._snwprintf -@ varargs _sopen(str long long) msvcrt._sopen -@ varargs _spawnl(long str str) msvcrt._spawnl -@ varargs _spawnle(long str str) msvcrt._spawnle -@ varargs _spawnlp(long str str) msvcrt._spawnlp -@ varargs _spawnlpe(long str str) msvcrt._spawnlpe -@ cdecl _spawnv(long str ptr) msvcrt._spawnv -@ cdecl _spawnve(long str ptr ptr) msvcrt._spawnve -@ cdecl _spawnvp(long str ptr) msvcrt._spawnvp -@ cdecl _spawnvpe(long str ptr ptr) msvcrt._spawnvpe -@ cdecl _splitpath(str ptr ptr ptr ptr) msvcrt._splitpath -@ cdecl _stat(str ptr) msvcrt._stat -@ cdecl _stati64(str ptr) msvcrt._stati64 -@ cdecl _statusfp() msvcrt._statusfp -@ cdecl _strcmpi(str str) msvcrt._strcmpi -@ cdecl _strdate(ptr) msvcrt._strdate -@ cdecl _strdup(str) msvcrt._strdup -@ cdecl _strerror(long) msvcrt._strerror -@ cdecl _stricmp(str str) msvcrt._stricmp -@ cdecl _stricoll(str str) msvcrt._stricoll -@ cdecl _strlwr(str) msvcrt._strlwr -@ cdecl _strncoll(str str long) msvcrt._strncoll -@ cdecl _strnicmp(str str long) msvcrt._strnicmp -@ cdecl _strnicoll(str str long) msvcrt._strnicoll -@ cdecl _strnset(str long long) msvcrt._strnset -@ cdecl _strrev(str) msvcrt._strrev -@ cdecl _strset(str long) msvcrt._strset -@ cdecl _strtime(ptr) msvcrt._strtime -@ cdecl _strupr(str) msvcrt._strupr -@ cdecl _swab(str str long) msvcrt._swab -@ extern _sys_errlist msvcrt._sys_errlist -@ extern _sys_nerr msvcrt._sys_nerr -@ cdecl _tell(long) msvcrt._tell -@ cdecl -ret64 _telli64(long) msvcrt._telli64 -@ cdecl _tempnam(str str) msvcrt._tempnam -@ extern _timezone msvcrt._timezone -@ cdecl _tolower(long) msvcrt._tolower -@ cdecl _toupper(long) msvcrt._toupper -@ extern _tzname msvcrt._tzname -@ cdecl _tzset() msvcrt._tzset -@ cdecl _ultoa(long ptr long) msvcrt._ultoa -@ cdecl _ultow(long ptr long) msvcrt._ultow -@ cdecl _umask(long) msvcrt._umask -@ cdecl _ungetch(long) msvcrt._ungetch -@ cdecl _unlink(str) msvcrt._unlink -@ cdecl _unloaddll(long) msvcrt._unloaddll -@ cdecl _utime(str ptr) msvcrt._utime -@ cdecl _vsnprintf(ptr long ptr ptr) msvcrt._vsnprintf -@ cdecl _vsnwprintf(ptr long wstr long) msvcrt._vsnwprintf -@ cdecl _waccess(wstr long) msvcrt._waccess -@ cdecl _wasctime(ptr) msvcrt._wasctime -@ cdecl _wchdir(wstr) msvcrt._wchdir -@ cdecl _wchmod(wstr long) msvcrt._wchmod -@ extern _wcmdln msvcrt._wcmdln -@ cdecl _wcreat(wstr long) msvcrt._wcreat -@ cdecl _wcsdup(wstr) msvcrt._wcsdup -@ cdecl _wcsicmp(wstr wstr) msvcrt._wcsicmp -@ cdecl _wcsicoll(wstr wstr) msvcrt._wcsicoll -@ cdecl _wcslwr(wstr) msvcrt._wcslwr -@ cdecl _wcsncoll(wstr wstr long) msvcrt._wcsncoll -@ cdecl _wcsnicmp(wstr wstr long) msvcrt._wcsnicmp -@ cdecl _wcsnicoll(wstr wstr long) msvcrt._wcsnicoll -@ cdecl _wcsnset(wstr long long) msvcrt._wcsnset -@ cdecl _wcsrev(wstr) msvcrt._wcsrev -@ cdecl _wcsset(wstr long) msvcrt._wcsset -@ cdecl _wcsupr(wstr) msvcrt._wcsupr -@ cdecl _wctime(ptr) msvcrt._wctime -@ extern _wenviron msvcrt._wenviron -@ varargs _wexecl(wstr wstr) msvcrt._wexecl -@ varargs _wexecle(wstr wstr) msvcrt._wexecle -@ varargs _wexeclp(wstr wstr) msvcrt._wexeclp -@ varargs _wexeclpe(wstr wstr) msvcrt._wexeclpe -@ varargs _wexecv(wstr ptr) msvcrt._wexecv -@ varargs _wexecve(wstr ptr ptr) msvcrt._wexecve -@ varargs _wexecvp(wstr ptr) msvcrt._wexecvp -@ varargs _wexecvpe(wstr ptr ptr) msvcrt._wexecvpe -@ cdecl _wfdopen(long wstr) msvcrt._wfdopen -@ cdecl _wfindfirst(wstr ptr) msvcrt._wfindfirst -@ cdecl _wfindfirsti64(wstr ptr) msvcrt._wfindfirsti64 -@ cdecl _wfindnext(long ptr) msvcrt._wfindnext -@ cdecl _wfindnexti64(long ptr) msvcrt._wfindnexti64 -@ cdecl _wfopen(wstr wstr) msvcrt._wfopen -@ cdecl _wfreopen(wstr wstr ptr) msvcrt._wfreopen -@ cdecl _wfsopen(wstr wstr long) msvcrt._wfsopen -@ cdecl _wfullpath(ptr wstr long) msvcrt._wfullpath -@ cdecl _wgetcwd(wstr long) msvcrt._wgetcwd -@ cdecl _wgetdcwd(long wstr long) msvcrt._wgetdcwd -@ cdecl _wgetenv(wstr) msvcrt._wgetenv -@ extern _winmajor msvcrt._winmajor -@ extern _winminor msvcrt._winminor -@ extern _winver msvcrt._winver -@ cdecl _wmakepath(wstr wstr wstr wstr wstr) msvcrt._wmakepath -@ cdecl _wmkdir(wstr) msvcrt._wmkdir -@ cdecl _wmktemp(wstr) msvcrt._wmktemp -@ varargs _wopen(wstr long) msvcrt._wopen -@ cdecl _wperror(wstr) msvcrt._wperror -@ extern _wpgmptr msvcrt._wpgmptr -@ cdecl _wpopen(wstr wstr) msvcrt._wpopen -@ cdecl _wputenv(wstr) msvcrt._wputenv -@ cdecl _wremove(wstr) msvcrt._wremove -@ cdecl _wrename(wstr wstr) msvcrt._wrename -@ cdecl _write(long ptr long) msvcrt._write -@ cdecl _wrmdir(wstr) msvcrt._wrmdir -@ cdecl _wsearchenv(wstr wstr ptr) msvcrt._wsearchenv -@ cdecl _wsetlocale(long wstr) msvcrt._wsetlocale -@ varargs _wsopen(wstr long long) msvcrt._wsopen -@ varargs _wspawnl(long wstr wstr) msvcrt._wspawnl -@ varargs _wspawnle(long wstr wstr) msvcrt._wspawnle -@ varargs _wspawnlp(long wstr wstr) msvcrt._wspawnlp -@ varargs _wspawnlpe(long wstr wstr) msvcrt._wspawnlpe -@ cdecl _wspawnv(long wstr ptr) msvcrt._wspawnv -@ cdecl _wspawnve(long wstr ptr ptr) msvcrt._wspawnve -@ cdecl _wspawnvp(long wstr ptr) msvcrt._wspawnvp -@ cdecl _wspawnvpe(long wstr ptr ptr) msvcrt._wspawnvpe -@ cdecl _wsplitpath(wstr wstr wstr wstr wstr) msvcrt._wsplitpath -@ cdecl _wstat(wstr ptr) msvcrt._wstat -@ cdecl _wstati64(wstr ptr) msvcrt._wstati64 -@ cdecl _wstrdate(ptr) msvcrt._wstrdate -@ cdecl _wstrtime(ptr) msvcrt._wstrtime -@ cdecl _wsystem(wstr) msvcrt._wsystem -@ cdecl _wtempnam(wstr wstr) msvcrt._wtempnam -@ cdecl _wtmpnam(ptr) msvcrt._wtmpnam -@ cdecl _wtoi(wstr) msvcrt._wtoi -@ cdecl _wtol(wstr) msvcrt._wtol -@ cdecl _wunlink(wstr) msvcrt._wunlink -@ cdecl _wutime(wstr ptr) msvcrt._wutime -@ cdecl _y0(double) msvcrt._y0 -@ cdecl _y1(double) msvcrt._y1 -@ cdecl _yn(long double ) msvcrt._yn -@ cdecl abort() msvcrt.abort -@ cdecl abs(long) msvcrt.abs -@ cdecl acos(double) msvcrt.acos -@ cdecl asctime(ptr) msvcrt.asctime -@ cdecl asin(double) msvcrt.asin -@ cdecl atan(double) msvcrt.atan -@ cdecl atan2(double double) msvcrt.atan2 -@ cdecl atexit(ptr) msvcrt.atexit -@ cdecl atof(str) msvcrt.atof -@ cdecl atoi(str) msvcrt.atoi -@ cdecl atol(str) msvcrt.atol -@ cdecl bsearch(ptr ptr long long ptr) msvcrt.bsearch -@ cdecl calloc(long long) msvcrt.calloc -@ cdecl ceil(double) msvcrt.ceil -@ cdecl clearerr(ptr) msvcrt.clearerr -@ cdecl clock() msvcrt.clock -@ cdecl cos(double) msvcrt.cos -@ cdecl cosh(double) msvcrt.cosh -@ cdecl ctime(ptr) msvcrt.ctime -@ cdecl difftime(long long) msvcrt.difftime -@ cdecl div(long long) msvcrt.div -@ cdecl exit(long) msvcrt.exit -@ cdecl exp(double) msvcrt.exp -@ cdecl fabs(double) msvcrt.fabs -@ cdecl fclose(ptr) msvcrt.fclose -@ cdecl feof(ptr) msvcrt.feof -@ cdecl ferror(ptr) msvcrt.ferror -@ cdecl fflush(ptr) msvcrt.fflush -@ cdecl fgetc(ptr) msvcrt.fgetc -@ cdecl fgetpos(ptr ptr) msvcrt.fgetpos -@ cdecl fgets(ptr long ptr) msvcrt.fgets -@ cdecl fgetwc(ptr) msvcrt.fgetwc -@ cdecl fgetws(ptr long ptr) msvcrt.fgetws -@ cdecl floor(double) msvcrt.floor -@ cdecl fmod(double double) msvcrt.fmod -@ cdecl fopen(str str) msvcrt.fopen -@ varargs fprintf(ptr str) msvcrt.fprintf -@ cdecl fputc(long ptr) msvcrt.fputc -@ cdecl fputs(str ptr) msvcrt.fputs -@ cdecl fputwc(long ptr) msvcrt.fputwc -@ cdecl fputws(wstr ptr) msvcrt.fputws -@ cdecl fread(ptr long long ptr) msvcrt.fread -@ cdecl free(ptr) msvcrt.free -@ cdecl freopen(str str ptr) msvcrt.freopen -@ cdecl frexp(double ptr) msvcrt.frexp -@ varargs fscanf(ptr str) msvcrt.fscanf -@ cdecl fseek(ptr long long) msvcrt.fseek -@ cdecl fsetpos(ptr ptr) msvcrt.fsetpos -@ cdecl ftell(ptr) msvcrt.ftell -@ varargs fwprintf(ptr wstr) msvcrt.fwprintf -@ cdecl fwrite(ptr long long ptr) msvcrt.fwrite -@ varargs fwscanf(ptr wstr) msvcrt.fwscanf -@ cdecl getc(ptr) msvcrt.getc -@ cdecl getchar() msvcrt.getchar -@ cdecl getenv(str) msvcrt.getenv -@ cdecl gets(str) msvcrt.gets -@ cdecl getwc(ptr) msvcrt.getwc -@ cdecl getwchar() msvcrt.getwchar -@ cdecl gmtime(ptr) msvcrt.gmtime -@ cdecl is_wctype(long long) msvcrt.is_wctype -@ cdecl isalnum(long) msvcrt.isalnum -@ cdecl isalpha(long) msvcrt.isalpha -@ cdecl iscntrl(long) msvcrt.iscntrl -@ cdecl isdigit(long) msvcrt.isdigit -@ cdecl isgraph(long) msvcrt.isgraph -@ cdecl isleadbyte(long) msvcrt.isleadbyte -@ cdecl islower(long) msvcrt.islower -@ cdecl isprint(long) msvcrt.isprint -@ cdecl ispunct(long) msvcrt.ispunct -@ cdecl isspace(long) msvcrt.isspace -@ cdecl isupper(long) msvcrt.isupper -@ cdecl iswalnum(long) msvcrt.iswalnum -@ cdecl iswalpha(long) msvcrt.iswalpha -@ cdecl iswascii(long) msvcrt.iswascii -@ cdecl iswcntrl(long) msvcrt.iswcntrl -@ cdecl iswctype(long long) msvcrt.iswctype -@ cdecl iswdigit(long) msvcrt.iswdigit -@ cdecl iswgraph(long) msvcrt.iswgraph -@ cdecl iswlower(long) msvcrt.iswlower -@ cdecl iswprint(long) msvcrt.iswprint -@ cdecl iswpunct(long) msvcrt.iswpunct -@ cdecl iswspace(long) msvcrt.iswspace -@ cdecl iswupper(long) msvcrt.iswupper -@ cdecl iswxdigit(long) msvcrt.iswxdigit -@ cdecl isxdigit(long) msvcrt.isxdigit -@ cdecl labs(long) msvcrt.labs -@ cdecl ldexp( double long) msvcrt.ldexp -@ cdecl ldiv(long long) msvcrt.ldiv -@ cdecl localeconv() msvcrt.localeconv -@ cdecl localtime(ptr) msvcrt.localtime -@ cdecl log(double) msvcrt.log -@ cdecl log10(double) msvcrt.log10 -@ cdecl -i386 longjmp(ptr long) msvcrt.longjmp -@ cdecl malloc(long) msvcrt.malloc -@ cdecl mblen(ptr long) msvcrt.mblen -@ cdecl mbstowcs(ptr str long) msvcrt.mbstowcs -@ cdecl mbtowc(wstr str long) msvcrt.mbtowc -@ cdecl memchr(ptr long long) msvcrt.memchr -@ cdecl memcmp(ptr ptr long) msvcrt.memcmp -@ cdecl memcpy(ptr ptr long) msvcrt.memcpy -@ cdecl memmove(ptr ptr long) msvcrt.memmove -@ cdecl memset(ptr long long) msvcrt.memset -@ cdecl mktime(ptr) msvcrt.mktime -@ cdecl modf(double ptr) msvcrt.modf -@ cdecl perror(str) msvcrt.perror -@ cdecl pow(double double) msvcrt.pow -@ varargs printf(str) msvcrt.printf -@ cdecl putc(long ptr) msvcrt.putc -@ cdecl putchar(long) msvcrt.putchar -@ cdecl puts(str) msvcrt.puts -@ cdecl putwc(long ptr) msvcrt.putwc -@ cdecl putwchar(long) msvcrt.putwchar -@ cdecl qsort(ptr long long ptr) msvcrt.qsort -@ cdecl raise(long) msvcrt.raise -@ cdecl rand() msvcrt.rand -@ cdecl realloc(ptr long) msvcrt.realloc -@ cdecl remove(str) msvcrt.remove -@ cdecl rename(str str) msvcrt.rename -@ cdecl rewind(ptr) msvcrt.rewind -@ varargs scanf(str) msvcrt.scanf -@ cdecl setbuf(ptr ptr) msvcrt.setbuf -@ cdecl setlocale(long str) msvcrt.setlocale -@ cdecl setvbuf(ptr str long long) msvcrt.setvbuf -@ cdecl signal(long long) msvcrt.signal -@ cdecl sin(double) msvcrt.sin -@ cdecl sinh(double) msvcrt.sinh -@ varargs sprintf(ptr str) msvcrt.sprintf -@ cdecl sqrt(double) msvcrt.sqrt -@ cdecl srand(long) msvcrt.srand -@ varargs sscanf(str str) msvcrt.sscanf -@ cdecl strcat(str str) msvcrt.strcat -@ cdecl strchr(str long) msvcrt.strchr -@ cdecl strcmp(str str) msvcrt.strcmp -@ cdecl strcoll(str str) msvcrt.strcoll -@ cdecl strcpy(ptr str) msvcrt.strcpy -@ cdecl strcspn(str str) msvcrt.strcspn -@ cdecl strerror(long) msvcrt.strerror -@ cdecl strftime(str long str ptr) msvcrt.strftime -@ cdecl strlen(str) msvcrt.strlen -@ cdecl strncat(str str long) msvcrt.strncat -@ cdecl strncmp(str str long) msvcrt.strncmp -@ cdecl strncpy(ptr str long) msvcrt.strncpy -@ cdecl strpbrk(str str) msvcrt.strpbrk -@ cdecl strrchr(str long) msvcrt.strrchr -@ cdecl strspn(str str) msvcrt.strspn -@ cdecl strstr(str str) msvcrt.strstr -@ cdecl strtod(str ptr) msvcrt.strtod -@ cdecl strtok(str str) msvcrt.strtok -@ cdecl strtol(str ptr long) msvcrt.strtol -@ cdecl strtoul(str ptr long) msvcrt.strtoul -@ cdecl strxfrm(ptr str long) msvcrt.strxfrm -@ varargs swprintf(wstr wstr) msvcrt.swprintf -@ varargs swscanf(wstr wstr) msvcrt.swscanf -@ cdecl system(str) msvcrt.system -@ cdecl tan(double) msvcrt.tan -@ cdecl tanh(double) msvcrt.tanh -@ cdecl time(ptr) msvcrt.time -@ cdecl tmpfile() msvcrt.tmpfile -@ cdecl tmpnam(ptr) msvcrt.tmpnam -@ cdecl tolower(long) msvcrt.tolower -@ cdecl toupper(long) msvcrt.toupper -@ cdecl towlower(long) msvcrt.towlower -@ cdecl towupper(long) msvcrt.towupper -@ cdecl ungetc(long ptr) msvcrt.ungetc -@ cdecl ungetwc(long ptr) msvcrt.ungetwc -@ cdecl vfprintf(ptr str long) msvcrt.vfprintf -@ cdecl vfwprintf(ptr wstr long) msvcrt.vfwprintf -@ cdecl vprintf(str long) msvcrt.vprintf -@ cdecl vsprintf(ptr str ptr) msvcrt.vsprintf -@ cdecl vswprintf(ptr wstr long) msvcrt.vswprintf -@ cdecl vwprintf(wstr long) msvcrt.vwprintf -@ cdecl wcscat(wstr wstr) msvcrt.wcscat -@ cdecl wcschr(wstr long) msvcrt.wcschr -@ cdecl wcscmp(wstr wstr) msvcrt.wcscmp -@ cdecl wcscoll(wstr wstr) msvcrt.wcscoll -@ cdecl wcscpy(ptr wstr) msvcrt.wcscpy -@ cdecl wcscspn(wstr wstr) msvcrt.wcscspn -@ cdecl wcsftime(ptr long wstr ptr) msvcrt.wcsftime -@ cdecl wcslen(wstr) msvcrt.wcslen -@ cdecl wcsncat(wstr wstr long) msvcrt.wcsncat -@ cdecl wcsncmp(wstr wstr long) msvcrt.wcsncmp -@ cdecl wcsncpy(ptr wstr long) msvcrt.wcsncpy -@ cdecl wcspbrk(wstr wstr) msvcrt.wcspbrk -@ cdecl wcsrchr(wstr long) msvcrt.wcsrchr -@ cdecl wcsspn(wstr wstr) msvcrt.wcsspn -@ cdecl wcsstr(wstr wstr) msvcrt.wcsstr -@ cdecl wcstod(wstr ptr) msvcrt.wcstod -@ cdecl wcstok(wstr wstr) msvcrt.wcstok -@ cdecl wcstol(wstr ptr long) msvcrt.wcstol -@ cdecl wcstombs(ptr ptr long) msvcrt.wcstombs -@ cdecl wcstoul(wstr ptr long) msvcrt.wcstoul -@ cdecl wcsxfrm(ptr wstr long) msvcrt.wcsxfrm -@ cdecl wctomb(ptr long) msvcrt.wctomb -@ varargs wprintf(wstr) msvcrt.wprintf -@ varargs wscanf(wstr) msvcrt.wscanf +@ cdecl _nextafter(double double) +@ cdecl _onexit(ptr) +@ varargs _open(str long) +@ cdecl _open_osfhandle(long long) +@ extern _osver +@ cdecl -i386 _outp(long long) MSVCRT__outp +@ cdecl -i386 _outpd(long long) MSVCRT__outpd +@ cdecl -i386 _outpw(long long) MSVCRT__outpw +@ cdecl _pclose(ptr) +@ extern _pctype +@ extern _pgmptr +@ cdecl _pipe(ptr long long) +@ cdecl _popen(str str) +@ cdecl _purecall() +@ cdecl _putch(long) +@ cdecl _putenv(str) +@ cdecl _putw(long ptr) +@ cdecl _putws(wstr) +@ extern _pwctype +@ cdecl _read(long ptr long) +@ cdecl _rmdir(str) +@ cdecl _rmtmp() +@ cdecl _rotl(long long) +@ cdecl _rotr(long long) +@ cdecl _safe_fdiv() +@ cdecl _safe_fdivr() +@ cdecl _safe_fprem() +@ cdecl _safe_fprem1() +@ cdecl _scalb( double long) +@ cdecl _searchenv(str str ptr) +@ stdcall -i386 _seh_longjmp_unwind(ptr) +@ cdecl _set_error_mode(long) +@ cdecl _seterrormode(long) +@ cdecl -i386 _setjmp(ptr) +@ cdecl -i386 _setjmp3(ptr long) +@ cdecl _setmaxstdio(long) +@ cdecl _setmbcp(long) +@ cdecl _setmode(long long) +@ cdecl _setsystime(ptr long) +@ cdecl _sleep(long) +@ varargs _snprintf(str long str) +@ varargs _snwprintf(wstr long wstr) +@ varargs _sopen(str long long) +@ varargs _spawnl(long str str) +@ varargs _spawnle(long str str) +@ varargs _spawnlp(long str str) +@ varargs _spawnlpe(long str str) +@ cdecl _spawnv(long str ptr) +@ cdecl _spawnve(long str ptr ptr) +@ cdecl _spawnvp(long str ptr) +@ cdecl _spawnvpe(long str ptr ptr) +@ cdecl _splitpath(str ptr ptr ptr ptr) +@ cdecl _stat(str ptr) +@ cdecl _stati64(str ptr) +@ cdecl _statusfp() +@ cdecl _strcmpi(str str) +@ cdecl _strdate(ptr) +@ cdecl _strdup(str) +@ cdecl _strerror(long) +@ cdecl _stricmp(str str) +@ cdecl _stricoll(str str) +@ cdecl _strlwr(str) +@ cdecl _strncoll(str str long) +@ cdecl _strnicmp(str str long) +@ cdecl _strnicoll(str str long) +@ cdecl _strnset(str long long) +@ cdecl _strrev(str) +@ cdecl _strset(str long) +@ cdecl _strtime(ptr) +@ cdecl _strupr(str) +@ cdecl _swab(str str long) +@ extern _sys_errlist +@ extern _sys_nerr +@ cdecl _tell(long) +@ cdecl -ret64 _telli64(long) +@ cdecl _tempnam(str str) +@ extern _timezone +@ cdecl _tolower(long) +@ cdecl _toupper(long) +@ extern _tzname +@ cdecl _tzset() +@ cdecl _ultoa(long ptr long) +@ cdecl _ultow(long ptr long) +@ cdecl _umask(long) +@ cdecl _ungetch(long) +@ cdecl _unlink(str) +@ cdecl _unloaddll(long) +@ cdecl _utime(str ptr) +@ cdecl _vsnprintf(ptr long ptr ptr) +@ cdecl _vsnwprintf(ptr long wstr long) +@ cdecl _waccess(wstr long) +@ cdecl _wasctime(ptr) +@ cdecl _wchdir(wstr) +@ cdecl _wchmod(wstr long) +@ extern _wcmdln +@ cdecl _wcreat(wstr long) +@ cdecl _wcsdup(wstr) +@ cdecl _wcsicmp(wstr wstr) +@ cdecl _wcsicoll(wstr wstr) +@ cdecl _wcslwr(wstr) +@ cdecl _wcsncoll(wstr wstr long) +@ cdecl _wcsnicmp(wstr wstr long) +@ cdecl _wcsnicoll(wstr wstr long) +@ cdecl _wcsnset(wstr long long) +@ cdecl _wcsrev(wstr) +@ cdecl _wcsset(wstr long) +@ cdecl _wcsupr(wstr) +@ cdecl _wctime(ptr) +@ extern _wenviron +@ varargs _wexecl(wstr wstr) +@ varargs _wexecle(wstr wstr) +@ varargs _wexeclp(wstr wstr) +@ varargs _wexeclpe(wstr wstr) +@ varargs _wexecv(wstr ptr) +@ varargs _wexecve(wstr ptr ptr) +@ varargs _wexecvp(wstr ptr) +@ varargs _wexecvpe(wstr ptr ptr) +@ cdecl _wfdopen(long wstr) +@ cdecl _wfindfirst(wstr ptr) +@ cdecl _wfindfirsti64(wstr ptr) +@ cdecl _wfindnext(long ptr) +@ cdecl _wfindnexti64(long ptr) +@ cdecl _wfopen(wstr wstr) +@ cdecl _wfreopen(wstr wstr ptr) +@ cdecl _wfsopen(wstr wstr long) +@ cdecl _wfullpath(ptr wstr long) +@ cdecl _wgetcwd(wstr long) +@ cdecl _wgetdcwd(long wstr long) +@ cdecl _wgetenv(wstr) +@ extern _winmajor +@ extern _winminor +@ extern _winver +@ cdecl _wmakepath(wstr wstr wstr wstr wstr) +@ cdecl _wmkdir(wstr) +@ cdecl _wmktemp(wstr) +@ varargs _wopen(wstr long) +@ cdecl _wperror(wstr) +@ extern _wpgmptr +@ cdecl _wpopen(wstr wstr) +@ cdecl _wputenv(wstr) +@ cdecl _wremove(wstr) +@ cdecl _wrename(wstr wstr) +@ cdecl _write(long ptr long) +@ cdecl _wrmdir(wstr) +@ cdecl _wsearchenv(wstr wstr ptr) +@ cdecl _wsetlocale(long wstr) +@ varargs _wsopen(wstr long long) +@ varargs _wspawnl(long wstr wstr) +@ varargs _wspawnle(long wstr wstr) +@ varargs _wspawnlp(long wstr wstr) +@ varargs _wspawnlpe(long wstr wstr) +@ cdecl _wspawnv(long wstr ptr) +@ cdecl _wspawnve(long wstr ptr ptr) +@ cdecl _wspawnvp(long wstr ptr) +@ cdecl _wspawnvpe(long wstr ptr ptr) +@ cdecl _wsplitpath(wstr wstr wstr wstr wstr) +@ cdecl _wstat(wstr ptr) +@ cdecl _wstati64(wstr ptr) +@ cdecl _wstrdate(ptr) +@ cdecl _wstrtime(ptr) +@ cdecl _wsystem(wstr) +@ cdecl _wtempnam(wstr wstr) +@ cdecl _wtmpnam(ptr) +@ cdecl _wtoi(wstr) +@ cdecl _wtol(wstr) +@ cdecl _wunlink(wstr) +@ cdecl _wutime(wstr ptr) +@ cdecl _y0(double) +@ cdecl _y1(double) +@ cdecl _yn(long double ) +@ cdecl abort() +@ cdecl abs(long) +@ cdecl acos(double) +@ cdecl asctime(ptr) +@ cdecl asin(double) +@ cdecl atan(double) +@ cdecl atan2(double double) +@ extern atexit # <-- changing this will kill your cat, understand? +@ cdecl atof(str) +@ cdecl atoi(str) +@ cdecl atol(str) +@ cdecl bsearch(ptr ptr long long ptr) +@ cdecl calloc(long long) +@ cdecl ceil(double) +@ cdecl clearerr(ptr) +@ cdecl clock() +@ cdecl cos(double) +@ cdecl cosh(double) +@ cdecl ctime(ptr) +@ cdecl difftime(long long) +@ cdecl div(long long) +@ cdecl exit(long) +@ cdecl exp(double) +@ cdecl fabs(double) +@ cdecl fclose(ptr) +@ cdecl feof(ptr) +@ cdecl ferror(ptr) +@ cdecl fflush(ptr) +@ cdecl fgetc(ptr) +@ cdecl fgetpos(ptr ptr) +@ cdecl fgets(ptr long ptr) +@ cdecl fgetwc(ptr) +@ cdecl fgetws(ptr long ptr) +@ cdecl floor(double) +@ cdecl fmod(double double) +@ cdecl fopen(str str) +@ varargs fprintf(ptr str) +@ cdecl fputc(long ptr) +@ cdecl fputs(str ptr) +@ cdecl fputwc(long ptr) +@ cdecl fputws(wstr ptr) +@ cdecl fread(ptr long long ptr) +@ cdecl free(ptr) +@ cdecl freopen(str str ptr) +@ cdecl frexp(double ptr) +@ varargs fscanf(ptr str) +@ cdecl fseek(ptr long long) +@ cdecl fsetpos(ptr ptr) +@ cdecl ftell(ptr) +@ varargs fwprintf(ptr wstr) +@ cdecl fwrite(ptr long long ptr) +@ varargs fwscanf(ptr wstr) +@ cdecl getc(ptr) +@ cdecl getchar() +@ cdecl getenv(str) +@ cdecl gets(str) +@ cdecl getwc(ptr) +@ cdecl getwchar() +@ cdecl gmtime(ptr) +@ cdecl is_wctype(long long) +@ cdecl isalnum(long) +@ cdecl isalpha(long) +@ cdecl iscntrl(long) +@ cdecl isdigit(long) +@ cdecl isgraph(long) +@ cdecl isleadbyte(long) +@ cdecl islower(long) +@ cdecl isprint(long) +@ cdecl ispunct(long) +@ cdecl isspace(long) +@ cdecl isupper(long) +@ cdecl iswalnum(long) +@ cdecl iswalpha(long) +@ cdecl iswascii(long) +@ cdecl iswcntrl(long) +@ cdecl iswctype(long long) +@ cdecl iswdigit(long) +@ cdecl iswgraph(long) +@ cdecl iswlower(long) +@ cdecl iswprint(long) +@ cdecl iswpunct(long) +@ cdecl iswspace(long) +@ cdecl iswupper(long) +@ cdecl iswxdigit(long) +@ cdecl isxdigit(long) +@ cdecl labs(long) +@ cdecl ldexp( double long) +@ cdecl ldiv(long long) +@ cdecl localeconv() +@ cdecl localtime(ptr) +@ cdecl log(double) +@ cdecl log10(double) +@ cdecl -i386 longjmp(ptr long) +@ cdecl malloc(long) +@ cdecl mblen(ptr long) +@ cdecl mbstowcs(ptr str long) +@ cdecl mbtowc(wstr str long) +@ cdecl memchr(ptr long long) +@ cdecl memcmp(ptr ptr long) +@ cdecl memcpy(ptr ptr long) +@ cdecl memmove(ptr ptr long) +@ cdecl memset(ptr long long) +@ cdecl mktime(ptr) +@ cdecl modf(double ptr) +@ cdecl perror(str) +@ cdecl pow(double double) +@ varargs printf(str) +@ cdecl putc(long ptr) +@ cdecl putchar(long) +@ cdecl puts(str) +@ cdecl putwc(long ptr) fputwc +@ cdecl putwchar(long) _fputwchar +@ cdecl qsort(ptr long long ptr) +@ cdecl raise(long) +@ cdecl rand() +@ cdecl realloc(ptr long) +@ cdecl remove(str) +@ cdecl rename(str str) +@ cdecl rewind(ptr) +@ varargs scanf(str) +@ cdecl setbuf(ptr ptr) +@ cdecl setlocale(long str) +@ cdecl setvbuf(ptr str long long) +@ cdecl signal(long long) +@ cdecl sin(double) +@ cdecl sinh(double) +@ varargs sprintf(ptr str) +@ cdecl sqrt(double) +@ cdecl srand(long) +@ varargs sscanf(str str) +@ cdecl strcat(str str) +@ cdecl strchr(str long) +@ cdecl strcmp(str str) +@ cdecl strcoll(str str) +@ cdecl strcpy(ptr str) +@ cdecl strcspn(str str) +@ cdecl strerror(long) +@ cdecl strftime(str long str ptr) +@ cdecl strlen(str) +@ cdecl strncat(str str long) +@ cdecl strncmp(str str long) +@ cdecl strncpy(ptr str long) +@ cdecl strpbrk(str str) +@ cdecl strrchr(str long) +@ cdecl strspn(str str) +@ cdecl strstr(str str) +@ cdecl strtod(str ptr) +@ cdecl strtok(str str) +@ cdecl strtol(str ptr long) +@ cdecl strtoul(str ptr long) +@ cdecl strxfrm(ptr str long) +@ varargs swprintf(wstr wstr) +@ varargs swscanf(wstr wstr) +@ cdecl system(str) +@ cdecl tan(double) +@ cdecl tanh(double) +@ cdecl time(ptr) +@ cdecl tmpfile() +@ cdecl tmpnam(ptr) +@ cdecl tolower(long) +@ cdecl toupper(long) +@ cdecl towlower(long) +@ cdecl towupper(long) +@ cdecl ungetc(long ptr) +@ cdecl ungetwc(long ptr) +@ cdecl vfprintf(ptr str long) +@ cdecl vfwprintf(ptr wstr long) +@ cdecl vprintf(str long) +@ cdecl vsprintf(ptr str ptr) +@ cdecl vswprintf(ptr wstr long) +@ cdecl vwprintf(wstr long) +@ cdecl wcscat(wstr wstr) +@ cdecl wcschr(wstr long) +@ cdecl wcscmp(wstr wstr) +@ cdecl wcscoll(wstr wstr) +@ cdecl wcscpy(ptr wstr) +@ cdecl wcscspn(wstr wstr) +@ cdecl wcsftime(ptr long wstr ptr) +@ cdecl wcslen(wstr) +@ cdecl wcsncat(wstr wstr long) +@ cdecl wcsncmp(wstr wstr long) +@ cdecl wcsncpy(ptr wstr long) +@ cdecl wcspbrk(wstr wstr) +@ cdecl wcsrchr(wstr long) +@ cdecl wcsspn(wstr wstr) +@ cdecl wcsstr(wstr wstr) +@ cdecl wcstod(wstr ptr) +@ cdecl wcstok(wstr wstr) +@ cdecl wcstol(wstr ptr long) +@ cdecl wcstombs(ptr ptr long) +@ cdecl wcstoul(wstr ptr long) +@ cdecl wcsxfrm(ptr wstr long) +@ cdecl wctomb(ptr long) +@ varargs wprintf(wstr) +@ varargs wscanf(wstr) diff --git a/dll/win32/msvcrt40/stubs.c b/dll/win32/msvcrt40/stubs.c new file mode 100644 index 00000000000..d7cb577aee1 --- /dev/null +++ b/dll/win32/msvcrt40/stubs.c @@ -0,0 +1,67 @@ +#include + +#undef UNIMPLEMENTED +#define UNIMPLEMENTED __wine_spec_unimplemented_stub("msvcrt.dll", __FUNCTION__) + +int MSVCRT__inp( + unsigned short port) +{ + return _inp(port); +} + +unsigned short MSVCRT__inpw( + unsigned short port) +{ + return _inpw(port); +} + +unsigned long MSVCRT__inpd( + unsigned short port) +{ + return _inpd(port); +} + + +int MSVCRT__outp( + unsigned short port, + int databyte) +{ + return _outp(port, databyte); +} + +unsigned short MSVCRT__outpw( + unsigned short port, + unsigned short dataword) +{ + return _outpw(port, dataword); +} + +unsigned long MSVCRT__outpd( + unsigned short port, + unsigned long dataword) +{ + return _outpd(port, dataword); +} + +size_t _heapused( size_t *pUsed, size_t *pCommit ) +{ + UNIMPLEMENTED; + return( 0 ); +} + +int _fileinfo = 0; + +int _atodbl( + void * value, + char * str) +{ + UNIMPLEMENTED; + return 0; +} + +int _ismbbkprint( + unsigned int c) +{ + UNIMPLEMENTED; + return 0; +} diff --git a/dll/win32/mswsock/CMakeLists.txt b/dll/win32/mswsock/CMakeLists.txt index 8d501879f33..768483a26a1 100644 --- a/dll/win32/mswsock/CMakeLists.txt +++ b/dll/win32/mswsock/CMakeLists.txt @@ -16,5 +16,6 @@ add_library(mswsock SHARED ${SOURCE}) set_module_type(mswsock win32dll) add_importlibs(mswsock ws2_32 msvcrt kernel32) +add_pch(mswsock precomp.h) add_cd_file(TARGET mswsock DESTINATION reactos/system32 FOR all) add_importlib_target(mswsock.spec) diff --git a/dll/win32/mswsock/extensions.c b/dll/win32/mswsock/extensions.c index 8271656bdda..acb7ba07794 100644 --- a/dll/win32/mswsock/extensions.c +++ b/dll/win32/mswsock/extensions.c @@ -8,9 +8,7 @@ * REVISIONS: */ -#include -#include -#include +#include "precomp.h" /* * @implemented diff --git a/dll/win32/mswsock/mswsock.rbuild b/dll/win32/mswsock/mswsock.rbuild index 3ff00a96f21..7b6c4e46443 100644 --- a/dll/win32/mswsock/mswsock.rbuild +++ b/dll/win32/mswsock/mswsock.rbuild @@ -5,4 +5,5 @@ extensions.c stubs.c mswsock.rc + precomp.h diff --git a/dll/win32/mswsock/precomp.h b/dll/win32/mswsock/precomp.h new file mode 100644 index 00000000000..681dec5f5b1 --- /dev/null +++ b/dll/win32/mswsock/precomp.h @@ -0,0 +1,6 @@ +#include +#include +#include +#include +#include +#include diff --git a/dll/win32/mswsock/stubs.c b/dll/win32/mswsock/stubs.c index fd449c695d2..fe74b00b187 100644 --- a/dll/win32/mswsock/stubs.c +++ b/dll/win32/mswsock/stubs.c @@ -8,12 +8,7 @@ * REVISIONS: */ -#include -#include -#include -#include -#include -#include +#include "precomp.h" typedef DWORD (* LPFN_NSPAPI)(VOID); typedef struct _NS_ROUTINE { diff --git a/dll/win32/msxml3/CMakeLists.txt b/dll/win32/msxml3/CMakeLists.txt index 40052a11d9e..bfa9239cd82 100644 --- a/dll/win32/msxml3/CMakeLists.txt +++ b/dll/win32/msxml3/CMakeLists.txt @@ -8,17 +8,16 @@ add_definitions(-D_WIN32_WINNT=0x601) add_definitions( -D__WINESRC__ -D_WINE - -DLIBXML_STATIC - -D_DLL - -D__USE_CRTIMP) + -DLIBXML_STATIC) if(MSVC) -add_definitions(/FIwine/typeof.h) + add_compiler_flags(/FIwine/typeof.h /FImsvc.h) endif(MSVC) include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine) set_rc_compiler() + spec2def(msxml3.dll msxml3.spec) list(APPEND SOURCE @@ -52,6 +51,10 @@ list(APPEND SOURCE ${CMAKE_CURRENT_BINARY_DIR}/msxml3_stubs.c ${CMAKE_CURRENT_BINARY_DIR}/msxml3.def) +if(MSVC) + list(APPEND SOURCE msvc_uuid.c) +endif() + add_library(msxml3 SHARED ${SOURCE}) set_module_type(msxml3 win32dll) @@ -62,6 +65,10 @@ target_link_libraries(msxml3 wine wineldr) +if(MSVC) + target_link_libraries(msxml3 xml_uuids) +endif() + add_importlibs(msxml3 msvcrt urlmon diff --git a/dll/win32/msxml3/msvc.h b/dll/win32/msxml3/msvc.h new file mode 100644 index 00000000000..275df16088a --- /dev/null +++ b/dll/win32/msxml3/msvc.h @@ -0,0 +1,6 @@ + +extern const struct _GUID CLSID_DOMDocument; +extern const struct _GUID CLSID_XMLDocument; +extern const struct _GUID CLSID_DOMFreeThreadedDocument; +extern const struct _GUID CLSID_XMLHTTPRequest; +extern const struct _GUID CLSID_XMLDSOControl; diff --git a/dll/win32/msxml3/msvc_uuid.c b/dll/win32/msxml3/msvc_uuid.c new file mode 100644 index 00000000000..b2c502719b7 --- /dev/null +++ b/dll/win32/msxml3/msvc_uuid.c @@ -0,0 +1,7 @@ + +#define INITGUID +#include + +// This is actually CLSID_DOMDocument, but on gcc builds its defined to be like this +DEFINE_GUID(CLSID_DOMDocument2, 0x2933bf90, 0x7b36, 0x11d2, 0xb2,0x0e, 0x00,0xc0,0x4f,0x98,0x3e,0x60); + diff --git a/dll/win32/netcfgx/CMakeLists.txt b/dll/win32/netcfgx/CMakeLists.txt index fb2e955a563..835c3c36734 100644 --- a/dll/win32/netcfgx/CMakeLists.txt +++ b/dll/win32/netcfgx/CMakeLists.txt @@ -23,5 +23,5 @@ target_link_libraries(netcfgx wine) add_importlibs(netcfgx rpcrt4 setupapi advapi32 iphlpapi ole32 user32 comctl32 ws2_32 msvcrt kernel32 ntdll) - +add_pch(netcfgx precomp.h) add_cd_file(TARGET netcfgx DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/netcfgx/inetcfgcomp_iface.c b/dll/win32/netcfgx/inetcfgcomp_iface.c index b4a3ad5bcf3..7d08afe7fcf 100644 --- a/dll/win32/netcfgx/inetcfgcomp_iface.c +++ b/dll/win32/netcfgx/inetcfgcomp_iface.c @@ -1,5 +1,4 @@ #include "precomp.h" -#include typedef struct { diff --git a/dll/win32/netcfgx/lang/pl-PL.rc b/dll/win32/netcfgx/lang/pl-PL.rc index c01995ac2af..88a1c6b8526 100644 --- a/dll/win32/netcfgx/lang/pl-PL.rc +++ b/dll/win32/netcfgx/lang/pl-PL.rc @@ -1,23 +1,30 @@ +/* + * translated by Polish Translation Team (Apr, 2007) + * Updated by Caemyr and Maciej Biaas (2008) + * https://sourceforge.net/projects/reactospl + * UTF-8 conversion by Caemyr (May, 2011) + */ + LANGUAGE LANG_POLISH, SUBLANG_DEFAULT IDD_TCPIP_BASIC_DLG DIALOGEX DISCARDABLE 0, 0, 246, 228 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Oglne" +CAPTION "Ogólne" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Moesz automatycznie pobra ustawienia sieciowe protokou IP, jeeli Twoja sie obsuguje te funkcje. W innym przypadku musisz skontaktowa si z administratorem w celu zdobycia odpowiednich ustawie.", -1, 9, 9, 228, 27 + LTEXT "Możesz automatycznie pobrać ustawienia sieciowe protokołu IP, jeżeli Twoja sieć obsługuje te funkcje. W innym przypadku musisz skontaktować się z administratorem sieci w celu zdobycia odpowiednich ustawień.", -1, 9, 9, 228, 27 CONTROL "Pobierz adres IP automatycznie", IDC_USEDHCP, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 14, 43, 210, 12 GROUPBOX "", -1, 9, 61, 228, 70, BS_GROUPBOX - CONTROL "&Uyj nastpujcego adresu IP:", IDC_NODHCP, "BUTTON", BS_AUTORADIOBUTTON, 14, 59, 105, 12 + CONTROL "&Użyj następującego adresu IP:", IDC_NODHCP, "BUTTON", BS_AUTORADIOBUTTON, 14, 59, 105, 12 LTEXT "Adres IP:", -1, 14, 75, 135, 8 CONTROL "",IDC_IPADDR,"SysIPAddress32",WS_TABSTOP,150,75-2,80,12 LTEXT "Maska podsieci:", -1, 14, 90, 135, 8 CONTROL "",IDC_SUBNETMASK,"SysIPAddress32",WS_TABSTOP,150,90-2,80,12 - LTEXT "Domylna brama:", -1, 14, 105, 135, 8 + LTEXT "Brama domyślna:", -1, 14, 105, 135, 8 CONTROL "",IDC_DEFGATEWAY,"SysIPAddress32",WS_TABSTOP,150,105-2,80,12 - CONTROL "Pobierz adresy serwerw DNS automatycznie", IDC_AUTODNS, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 14, 139, 210, 12 + CONTROL "Pobierz adresy serwerów DNS automatycznie", IDC_AUTODNS, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 14, 139, 210, 12 GROUPBOX "", -1, 9, 157, 228, 47, BS_GROUPBOX - CONTROL "&Uyj poniszych adresw serwerw DNS", IDC_FIXEDDNS, "BUTTON", BS_AUTORADIOBUTTON, 14, 155, 142, 12 + CONTROL "&Użyj poniższych adresów serwera DNS", IDC_FIXEDDNS, "BUTTON", BS_AUTORADIOBUTTON, 14, 155, 142, 12 LTEXT "Pierwszy serwer DNS:", -1, 14, 171, 135, 8 CONTROL "",IDC_DNS1,"SysIPAddress32",WS_TABSTOP,150,171-2,80,12 LTEXT "Alternatywny serwer DNS:", -1, 14, 186, 135, 8 @@ -30,15 +37,15 @@ STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION CAPTION "Konfiguracja alternatywna" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Jeli ten komputer jest uywany w wicej ni jednej sieci, wprowad poniej alternatywne ustawienia protokou IP", -1, 9, 9, 220, 20 + LTEXT "Jeśli ten komputer jest używany w więcej niż jednej sieci, wprowadź poniżej alternatywne ustawienia protokołu IP", -1, 9, 9, 220, 20 CONTROL "Au&tomatyczny prywatny adres IP", IDC_USEDHCP, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 14, 40, 210, 12 GROUPBOX "", -1, 9, 55, 228, 80, BS_GROUPBOX - CONTROL "&Ustawienia konfigurowane przez uytkownika", IDC_NODHCP, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 14, 55, 70, 12 + CONTROL "&Ustawienia konfigurowane przez użytkownika", IDC_NODHCP, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 14, 55, 70, 12 LTEXT "Adres &IP:", -1, 14, 75, 135, 8 CONTROL "",IDC_IPADDR,"SysIPAddress32",WS_TABSTOP, 150, 75, 80, 12 LTEXT "&Maska podsieci:", -1, 14, 95, 135, 8 CONTROL "",IDC_SUBNETMASK,"SysIPAddress32",WS_TABSTOP, 150, 95, 80, 12 - LTEXT "&Brama domylna:", -1, 14, 115, 135, 8 + LTEXT "&Brama domyślna:", -1, 14, 115, 135, 8 CONTROL "",IDC_DEFGATEWAY,"SysIPAddress32",WS_TABSTOP, 150, 115, 80, 12 LTEXT "&Preferowany serwer DNS:", -1, 14, 150, 135, 8 CONTROL "",IDC_DNS1,"SysIPAddress32",WS_TABSTOP, 150, 150, 80, 12 @@ -48,19 +55,19 @@ END IDD_TCPIP_ADVIP_DLG DIALOGEX DISCARDABLE 0, 0, 247, 247 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION "Ustawienia protokou IP" +CAPTION "Ustawienia protokołu IP" FONT 8, "MS Shell Dlg" BEGIN GROUPBOX "Adresy IP", -1, 5, 5, 240, 90 CONTROL "", IDC_IPLIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP, 15, 15, 210, 55 PUSHBUTTON "Dodaj...", IDC_IPADD, 60, 75, 50, 14, WS_TABSTOP PUSHBUTTON "Edytuj...", IDC_IPMOD, 120, 75, 50, 14, WS_TABSTOP - PUSHBUTTON "Usu", IDC_IPDEL, 180, 75, 50, 14, WS_TABSTOP - GROUPBOX "Domylne bramy:", -1, 5, 100, 240, 90 + PUSHBUTTON "Usuń", IDC_IPDEL, 180, 75, 50, 14, WS_TABSTOP + GROUPBOX "Bramy domyślne:", -1, 5, 100, 240, 90 CONTROL "", IDC_GWLIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP, 15, 110, 210, 55 PUSHBUTTON "Dodaj...", IDC_GWADD, 60, 170, 50, 14, WS_TABSTOP PUSHBUTTON "Edytuj...", IDC_GWMOD, 120, 170, 50, 14, WS_TABSTOP - PUSHBUTTON "Usu", IDC_GWDEL, 180, 170, 50, 14, WS_TABSTOP + PUSHBUTTON "Usuń", IDC_GWDEL, 180, 170, 50, 14, WS_TABSTOP GROUPBOX "", -1, 5, 200, 240, 30 CHECKBOX "Metryka automatyczna", IDC_AUTOMETRIC, 9, 200, 90, 12, BS_AUTOCHECKBOX | WS_TABSTOP LTEXT "Metryka interfejsu:", -1, 15, 215, 90, 12 @@ -73,26 +80,26 @@ CAPTION "DNS" FONT 8, "MS Shell Dlg" BEGIN LISTBOX IDC_DNSADDRLIST, 5, 15, 180, 60, LBS_NOTIFY - LTEXT "Adresy serwerw D&NS wedug kolejnoci uywania:", -1, 5, 5, 180, 12 - PUSHBUTTON "W gr", IDC_DNSADDRUP, 190, 30, 50, 14, WS_TABSTOP - PUSHBUTTON "W d", IDC_DNSADDRDOWN, 190, 50, 50, 14, WS_TABSTOP + LTEXT "Adresy serwerów D&NS według kolejności używania:", -1, 5, 5, 180, 12 + PUSHBUTTON "W górę", IDC_DNSADDRUP, 190, 30, 50, 14, WS_TABSTOP + PUSHBUTTON "W dół", IDC_DNSADDRDOWN, 190, 50, 50, 14, WS_TABSTOP PUSHBUTTON "&Dodaj...", IDC_DNSADDRADD, 30, 70, 50, 14, WS_TABSTOP PUSHBUTTON "&Edytuj...", IDC_DNSADDRMOD, 100, 70, 50, 14, WS_TABSTOP - PUSHBUTTON "&Usu", IDC_DNSADDRDEL, 170, 70, 50, 14, WS_TABSTOP - LTEXT "Trzy ponisze ustawienia dotycz wszystkich pocze o wczonym protokole TCP/IP. W celu rozpoznawania nazw niekwalifikowanych:", -1, 5, 90, 220, 24 - CONTROL "D&ocz sufiksy DNS: podstawowy i konkretnego poczenia", IDC_PRIMSUFFIX, "BUTTON", BS_AUTORADIOBUTTON, 5, 110, 160, 12 - CHECKBOX "Docz su&fiksy nadrzdne podstawowego sufiksu DNS", IDC_TOPPRIMSUFFIX, 15, 125, 190, 12, BS_AUTOCHECKBOX | WS_TABSTOP - CONTROL "Do&cz ponisze sufiksy DNS (w podanej kolejnoci):", IDC_SELSUFFIX, "BUTTON", BS_AUTORADIOBUTTON, 5, 140, 190, 12 + PUSHBUTTON "&Usuń", IDC_DNSADDRDEL, 170, 70, 50, 14, WS_TABSTOP + LTEXT "Trzy poniższe ustawienia dotyczą wszystkich połączeń o włączonym protokole TCP/IP. W celu rozpoznawania nazw niekwalifikowanych:", -1, 5, 90, 220, 24 + CONTROL "D&ołącz sufiksy DNS: podstawowy i konkretnego połączenia", IDC_PRIMSUFFIX, "BUTTON", BS_AUTORADIOBUTTON, 5, 110, 160, 12 + CHECKBOX "Dołącz su&fiksy nadrzędne podstawowego sufiksu DNS", IDC_TOPPRIMSUFFIX, 15, 125, 190, 12, BS_AUTOCHECKBOX | WS_TABSTOP + CONTROL "Dołą&cz poniższe sufiksy DNS (w podanej kolejności):", IDC_SELSUFFIX, "BUTTON", BS_AUTORADIOBUTTON, 5, 140, 190, 12 LISTBOX IDC_DNSSUFFIXLIST, 5, 155, 180, 60, LBS_NOTIFY - PUSHBUTTON "W gr", IDC_DNSSUFFIXUP, 190, 170, 50, 14, WS_TABSTOP - PUSHBUTTON "W d", IDC_DNSSUFFIXDOWN, 190, 190, 50, 14, WS_TABSTOP + PUSHBUTTON "W górę", IDC_DNSSUFFIXUP, 190, 170, 50, 14, WS_TABSTOP + PUSHBUTTON "W dół", IDC_DNSSUFFIXDOWN, 190, 190, 50, 14, WS_TABSTOP PUSHBUTTON "Dod&aj...", IDC_DNSSUFFIXADD, 30, 210, 50, 14, WS_TABSTOP PUSHBUTTON "Ed&ytuj...", IDC_DNSSUFFIXMOD, 100, 210, 50, 14, WS_TABSTOP - PUSHBUTTON "U&su", IDC_DNSSUFFIXDEL, 170, 210, 50, 14, WS_TABSTOP - LTEXT "Sufiks DNS dla &tego poczenia:", -1, 5, 225, 110, 14 + PUSHBUTTON "U&suń", IDC_DNSSUFFIXDEL, 170, 210, 50, 14, WS_TABSTOP + LTEXT "Sufiks DNS dla &tego połączenia:", -1, 5, 225, 110, 14 EDITTEXT IDC_SUFFIX, 120, 225, 100, 12, WS_TABSTOP - CHECKBOX "&Zarejestruj adresy tego poczenia w DNS", IDC_REGSUFFIX, 15, 240, 190, 12, BS_AUTOCHECKBOX | WS_TABSTOP - CHECKBOX "Uy&j sufiksu DNS tego poczenia do rejestracji w DNS", IDC_USESUFFIX, 15, 255, 190, 12, BS_AUTOCHECKBOX | WS_TABSTOP + CHECKBOX "&Zarejestruj adresy tego połączenia w DNS", IDC_REGSUFFIX, 15, 240, 190, 12, BS_AUTOCHECKBOX | WS_TABSTOP + CHECKBOX "Uży&j sufiksu DNS tego połączenia do rejestracji w DNS", IDC_USESUFFIX, 15, 255, 190, 12, BS_AUTOCHECKBOX | WS_TABSTOP END @@ -103,7 +110,7 @@ FONT 8, "MS Shell Dlg" BEGIN LISTBOX IDC_OPTLIST, 5, 30, 230, 70 LTEXT "&Ustawienia opcjonalne", -1, 5, 15, 130, 12 - PUSHBUTTON "&Waciwoci", IDC_OPTPROP, 160, 100, 70, 14, WS_TABSTOP + PUSHBUTTON "&Właściwości", IDC_OPTPROP, 160, 100, 70, 14, WS_TABSTOP GROUPBOX "Opis:", -1, 5, 120, 240, 70 LTEXT "", IDC_OPTDESC, 15, 130, 220, 33 END @@ -162,25 +169,25 @@ STYLE DS_SHELLFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Filtrowanie TCP/IP" FONT 8, "MS Shell Dlg" BEGIN - CHECKBOX "Wcz filtrowanie TCP/IP (wszystkie karty)", IDC_USE_FILTER, 15, 5, 190, 12, BS_AUTOCHECKBOX | WS_TABSTOP + CHECKBOX "Włącz filtrowanie TCP/IP (wszystkie karty)", IDC_USE_FILTER, 15, 5, 190, 12, BS_AUTOCHECKBOX | WS_TABSTOP GROUPBOX "", -1, 5, 30, 90, 150 CONTROL "Pozwalaj wszystkim", IDC_TCP_ALLOW_ALL, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 15, 30, 70, 12 CONTROL "Pozwalaj tylko", IDC_TCP_RESTRICT, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 15, 44, 70, 12 CONTROL "", IDC_TCP_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP, 11, 62, 72, 75 PUSHBUTTON "Dodaj", IDC_TCP_ADD, 15, 141, 50, 14, WS_TABSTOP - PUSHBUTTON "Usu", IDC_TCP_DEL, 15, 161, 50, 14, WS_TABSTOP + PUSHBUTTON "Usuń", IDC_TCP_DEL, 15, 161, 50, 14, WS_TABSTOP GROUPBOX "", -1, 105, 30, 90, 150 CONTROL "Pozwalaj wszystkim", IDC_UDP_ALLOW_ALL, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 115, 30, 70, 12 CONTROL "Pozwalaj tylko", IDC_UDP_RESTRICT, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 115, 44, 70, 12 CONTROL "", IDC_UDP_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP, 111, 62, 72, 75 PUSHBUTTON "Dodaj", IDC_UDP_ADD, 115, 141, 50, 14, WS_TABSTOP - PUSHBUTTON "Usu", IDC_UDP_DEL, 115, 161, 50, 14, WS_TABSTOP + PUSHBUTTON "Usuń", IDC_UDP_DEL, 115, 161, 50, 14, WS_TABSTOP GROUPBOX "", -1, 205, 30, 90, 150 CONTROL "Pozwalaj wszystkim", IDC_IP_ALLOW_ALL, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 215, 30, 70, 12 CONTROL "Pozwalaj tylko", IDC_IP_RESTRICT, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 215, 44, 70, 12 CONTROL "", IDC_IP_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP, 211, 62, 72, 75 PUSHBUTTON "Dodaj", IDC_IP_ADD, 215, 141, 50, 14, WS_TABSTOP - PUSHBUTTON "Usu", IDC_IP_DEL, 215, 161, 50, 14, WS_TABSTOP + PUSHBUTTON "Usuń", IDC_IP_DEL, 215, 161, 50, 14, WS_TABSTOP PUSHBUTTON "OK", IDC_OK, 150, 190, 50, 14, WS_TABSTOP PUSHBUTTON "Anuluj", IDCANCEL, 210, 190, 50, 14, WS_TABSTOP END @@ -198,32 +205,32 @@ END STRINGTABLE BEGIN - IDS_NET_CONNECT "Poczenie sieciowe" - IDS_NO_IPADDR_SET "Ta karta wymaga co najmniej jednego adresu IP. Wprowad adres IP." - IDS_NO_SUBMASK_SET "Wprowadzono adres, w ktrym brakuje maski podsieci. Wprowad mask podsieci." - IDS_TCPFILTERDESC "Filtrowanie pakietw TCP/IP pozwala na kontrolowanie w sieci tego typu ruchu TCP/IP, ktry dociera do danego komputera." - IDS_TCPFILTER "Filtrowanie protokou TCP/IP" + IDS_NET_CONNECT "Połączenie sieciowe" + IDS_NO_IPADDR_SET "Ta karta wymaga co najmniej jednego adresu IP. Wprowadź adres IP." + IDS_NO_SUBMASK_SET "Wprowadzono adres, w którym brakuje maski podsieci. Wprowadź maskę podsieci." + IDS_TCPFILTERDESC "Filtrowanie pakietów TCP/IP pozwala na kontrolowanie w sieci tego typu ruchu TCP/IP, który dociera do danego komputera." + IDS_TCPFILTER "Filtrowanie protokołu TCP/IP" IDS_IPADDR "Adres IP" IDS_SUBMASK "Maska podsieci" IDS_GATEWAY "Brama" IDS_METRIC "Metryka" - IDS_DHCPACTIVE "DHCP wczone" + IDS_DHCPACTIVE "DHCP włączone" IDS_AUTOMATIC "Automatyczna" - IDS_NOITEMSEL "Nie wybrano adnego elementu. Najpierw wybierz element." + IDS_NOITEMSEL "Nie wybrano żadnego elementu. Najpierw wybierz element." IDS_TCPIP "ReactOS-TCP/IP" IDS_ADD "Dodaj" IDS_MOD "OK" IDS_TCP_PORTS "Porty TCP" IDS_UDP_PORTS "Porty UDP" - IDS_IP_PROTO "Protokoy IP" - IDS_PORT_RANGE "Numery portw musz by wiksze od 0 i mniejsze od 65536. Wprowad liczb z tego zakresu." - IDS_PROT_RANGE "Numery protokow musz by wiksze od 0 i mniejsze od 256. Wprowad liczb z tego zakresu." - IDS_DUP_NUMBER "Podana liczba znajduje si ju na licie. Wprowad inn liczb." - IDS_DISABLE_FILTER "Wyczenie tego globalnego ustawienia protokou TCP/IP bdzie miao wpyw na wszystkie karty." - IDS_NO_SUFFIX "Aktualne ustawienie przeszukiwania wymaga podania przynajmniej jednego sufiksu DNS. Wprowad sufiks DNS lub zmie ustawienia." - IDS_DOMAIN_SUFFIX "Podany sufiks domeny jest nieprawidowy." - IDS_DNS_SUFFIX "Nazwa domeny DNS ""%s"" jest nieprawidowa." - IDS_DUP_SUFFIX "Sufiks DNS znajduje si ju na licie." - IDS_DUP_IPADDR "Adres IP znajduje si ju na licie." - IDS_DUP_GW "Domylna brama znajduje si ju na licie." + IDS_IP_PROTO "Protokoły IP" + IDS_PORT_RANGE "Numery portów muszą być większe od 0 i mniejsze od 65536. Wprowadź liczbę z tego zakresu." + IDS_PROT_RANGE "Numery protokołów muszą być większe od 0 i mniejsze od 256. Wprowadź liczbę z tego zakresu." + IDS_DUP_NUMBER "Podana liczba znajduje się już na liście. Wprowadź inną liczbę." + IDS_DISABLE_FILTER "Wyłączenie tego globalnego ustawienia protokołu TCP/IP będzie miało wpływ na wszystkie karty." + IDS_NO_SUFFIX "Aktualne ustawienie przeszukiwania wymaga podania przynajmniej jednego sufiksu DNS. Wprowadź sufiks DNS lub zmień ustawienia." + IDS_DOMAIN_SUFFIX "Podany sufiks domeny jest nieprawidłowy." + IDS_DNS_SUFFIX "Nazwa domeny DNS ""%s"" jest nieprawidłowa." + IDS_DUP_SUFFIX "Sufiks DNS znajduje się już na liście." + IDS_DUP_IPADDR "Adres IP znajduje się już na liście." + IDS_DUP_GW "Domyślna brama znajduje się już na liście." END diff --git a/dll/win32/netcfgx/lang/ru-RU.rc b/dll/win32/netcfgx/lang/ru-RU.rc index fb2eba038f3..f4ad74e3069 100644 --- a/dll/win32/netcfgx/lang/ru-RU.rc +++ b/dll/win32/netcfgx/lang/ru-RU.rc @@ -2,68 +2,68 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT IDD_TCPIP_BASIC_DLG DIALOGEX DISCARDABLE 0, 0, 246, 228 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Основные" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " IP , . .", -1, 9, 9, 228, 27 - CONTROL " IP- ", IDC_USEDHCP, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 14, 43, 210, 12 + LTEXT "Параметры протокола IP могут назначаться автоматически, если сеть поддерживает такую возможность. В противном случае эти параметры можно получить у сетевого администратора.", -1, 9, 9, 228, 27 + CONTROL "Получать IP-адрес автоматически", IDC_USEDHCP, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 14, 43, 210, 12 GROUPBOX "", -1, 9, 61, 228, 70, BS_GROUPBOX - CONTROL "& IP-:", IDC_NODHCP, "BUTTON", BS_AUTORADIOBUTTON, 14, 59, 140, 12 - LTEXT "IP-:", -1, 14, 75, 135, 8 + CONTROL "&Использовать указанный IP-адрес:", IDC_NODHCP, "BUTTON", BS_AUTORADIOBUTTON, 14, 59, 140, 12 + LTEXT "IP-адрес:", -1, 14, 75, 135, 8 CONTROL "",IDC_IPADDR,"SysIPAddress32",WS_TABSTOP,150,75-2,80,12 - LTEXT " :", -1, 14, 90, 135, 8 + LTEXT "Маска подсети:", -1, 14, 90, 135, 8 CONTROL "",IDC_SUBNETMASK,"SysIPAddress32",WS_TABSTOP,150,90-2,80,12 - LTEXT " :", -1, 14, 105, 135, 8 + LTEXT "Шлюз по умолчанию:", -1, 14, 105, 135, 8 CONTROL "",IDC_DEFGATEWAY,"SysIPAddress32",WS_TABSTOP,150,105-2,80,12 - CONTROL " DNS- ", IDC_AUTODNS, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 14, 139, 210, 12 + CONTROL "Получать адрес DNS-сервера автоматически", IDC_AUTODNS, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 14, 139, 210, 12 GROUPBOX "", -1, 9, 157, 228, 47, BS_GROUPBOX - CONTROL "& DNS-", IDC_FIXEDDNS, "BUTTON", BS_AUTORADIOBUTTON, 14, 155, 185, 12 - LTEXT " DNS-:", -1, 14, 171, 135, 8 + CONTROL "&Использовать следующие адреса DNS-серверов", IDC_FIXEDDNS, "BUTTON", BS_AUTORADIOBUTTON, 14, 155, 185, 12 + LTEXT "Предпочитаемый DNS-сервер:", -1, 14, 171, 135, 8 CONTROL "",IDC_DNS1,"SysIPAddress32",WS_TABSTOP,150,171-2,80,12 - LTEXT " DNS-:", -1, 14, 186, 135, 8 + LTEXT "Альтернативный DNS-сервер:", -1, 14, 186, 135, 8 CONTROL "",IDC_DNS2,"SysIPAddress32",WS_TABSTOP,150,186-2,80,12 - PUSHBUTTON "&", IDC_ADVANCED, 162, 209, 74, 14, WS_TABSTOP + PUSHBUTTON "&Дополнительно", IDC_ADVANCED, 162, 209, 74, 14, WS_TABSTOP END IDD_TCPIP_ALTCF_DLG DIALOGEX DISCARDABLE 0, 0, 246, 228 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION " " +CAPTION "Альтернативная конфигурация" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " , IP:", -1, 9, 9, 230, 20 - CONTROL "& IP-", IDC_USEDHCP, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 14, 40, 210, 12 + LTEXT "Если этот компьютер используется в нескольких сетях, введите параметры альтернативной конфигурации протокола IP:", -1, 9, 9, 230, 20 + CONTROL "А&втоматический частный IP-адрес", IDC_USEDHCP, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 14, 40, 210, 12 GROUPBOX "", -1, 9, 55, 228, 80, BS_GROUPBOX - CONTROL "& ", IDC_NODHCP, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 14, 55, 130, 12 - LTEXT "IP-&:", -1, 14, 75, 135, 8 + CONTROL "Настраиваем&ый пользователем", IDC_NODHCP, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 14, 55, 130, 12 + LTEXT "IP-&адрес:", -1, 14, 75, 135, 8 CONTROL "",IDC_IPADDR,"SysIPAddress32",WS_TABSTOP, 150, 75, 80, 12 - LTEXT "& :", -1, 14, 95, 135, 8 + LTEXT "Ма&ска подсети:", -1, 14, 95, 135, 8 CONTROL "",IDC_SUBNETMASK,"SysIPAddress32",WS_TABSTOP, 150, 95, 80, 12 - LTEXT "& :", -1, 14, 115, 135, 8 + LTEXT "&Основной шлюз:", -1, 14, 115, 135, 8 CONTROL "",IDC_DEFGATEWAY,"SysIPAddress32",WS_TABSTOP, 150, 115, 80, 12 - LTEXT "& DNS-:", -1, 14, 150, 135, 8 + LTEXT "Пр&едпочитаемый DNS-сервер:", -1, 14, 150, 135, 8 CONTROL "",IDC_DNS1,"SysIPAddress32",WS_TABSTOP, 150, 150, 80, 12 - LTEXT "& DNS-:", -1, 14, 165, 180, 8 + LTEXT "Ал&ьтернативный DNS-сервер:", -1, 14, 165, 180, 8 CONTROL "",IDC_DNS2,"SysIPAddress32",WS_TABSTOP, 150, 165, 80, 12 END IDD_TCPIP_ADVIP_DLG DIALOGEX DISCARDABLE 0, 0, 247, 247 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION " IP" +CAPTION "Параметры IP" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "IP-&", -1, 5, 5, 240, 90 + GROUPBOX "IP-&адреса", -1, 5, 5, 240, 90 CONTROL "", IDC_IPLIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP, 15, 15, 210, 55 - PUSHBUTTON "&...", IDC_IPADD, 60, 75, 50, 14, WS_TABSTOP - PUSHBUTTON "&...", IDC_IPMOD, 120, 75, 50, 14, WS_TABSTOP - PUSHBUTTON "&", IDC_IPDEL, 180, 75, 50, 14, WS_TABSTOP - GROUPBOX "& :", -1, 5, 100, 240, 90 + PUSHBUTTON "&Добавить...", IDC_IPADD, 60, 75, 50, 14, WS_TABSTOP + PUSHBUTTON "&Изменить...", IDC_IPMOD, 120, 75, 50, 14, WS_TABSTOP + PUSHBUTTON "&Удалить", IDC_IPDEL, 180, 75, 50, 14, WS_TABSTOP + GROUPBOX "&Основные шлюзы:", -1, 5, 100, 240, 90 CONTROL "", IDC_GWLIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP, 15, 110, 210, 55 - PUSHBUTTON "&...", IDC_GWADD, 60, 170, 50, 14, WS_TABSTOP - PUSHBUTTON "&...", IDC_GWMOD, 120, 170, 50, 14, WS_TABSTOP - PUSHBUTTON "&", IDC_GWDEL, 180, 170, 50, 14, WS_TABSTOP + PUSHBUTTON "До&бавить...", IDC_GWADD, 60, 170, 50, 14, WS_TABSTOP + PUSHBUTTON "И&зменить...", IDC_GWMOD, 120, 170, 50, 14, WS_TABSTOP + PUSHBUTTON "Уда&лить", IDC_GWDEL, 180, 170, 50, 14, WS_TABSTOP GROUPBOX "", -1, 5, 200, 240, 30 - CHECKBOX "& ", IDC_AUTOMETRIC, 9, 200, 146, 12, BS_AUTOCHECKBOX | WS_TABSTOP - LTEXT " &:", -1, 15, 215, 90, 12 + CHECKBOX "А&втоматическое назначение метрики", IDC_AUTOMETRIC, 9, 200, 146, 12, BS_AUTOCHECKBOX | WS_TABSTOP + LTEXT "Метрика ин&терфейса:", -1, 15, 215, 90, 12 EDITTEXT IDC_METRIC, 110, 212, 50, 12, WS_TABSTOP | ES_NUMBER END @@ -73,157 +73,157 @@ CAPTION "DNS" FONT 8, "MS Shell Dlg" BEGIN LISTBOX IDC_DNSADDRLIST, 5, 15, 180, 60, LBS_NOTIFY - LTEXT "& DNS-, :", -1, 5, 5, 180, 10 - PUSHBUTTON "", IDC_DNSADDRUP, 190, 30, 50, 14, WS_TABSTOP - PUSHBUTTON "", IDC_DNSADDRDOWN, 190, 50, 50, 14, WS_TABSTOP - PUSHBUTTON "&...", IDC_DNSADDRADD, 30, 70, 50, 14, WS_TABSTOP - PUSHBUTTON "&...", IDC_DNSADDRMOD, 100, 70, 50, 14, WS_TABSTOP - PUSHBUTTON "&", IDC_DNSADDRDEL, 170, 70, 50, 14, WS_TABSTOP - LTEXT " , TCP/IP. :", -1, 5, 90, 238, 20 - CONTROL " & DNS- ", IDC_PRIMSUFFIX, "BUTTON", BS_AUTORADIOBUTTON, 5, 110, 234, 12 - CHECKBOX " & . DNS-", IDC_TOPPRIMSUFFIX, 15, 125, 220, 12, BS_AUTOCHECKBOX | WS_TABSTOP - CONTROL " & DNS- ( ):", IDC_SELSUFFIX, "BUTTON", BS_AUTORADIOBUTTON, 5, 140, 206, 12 + LTEXT "&Адреса DNS-серверов, в порядке использования:", -1, 5, 5, 180, 10 + PUSHBUTTON "Вверх", IDC_DNSADDRUP, 190, 30, 50, 14, WS_TABSTOP + PUSHBUTTON "Вниз", IDC_DNSADDRDOWN, 190, 50, 50, 14, WS_TABSTOP + PUSHBUTTON "&Добавить...", IDC_DNSADDRADD, 30, 70, 50, 14, WS_TABSTOP + PUSHBUTTON "И&зменить...", IDC_DNSADDRMOD, 100, 70, 50, 14, WS_TABSTOP + PUSHBUTTON "&Удалить", IDC_DNSADDRDEL, 170, 70, 50, 14, WS_TABSTOP + LTEXT "Следующие три параметра применяются для всех подключений, использующих TCP/IP. Для разрешения неизвестных имен:", -1, 5, 90, 238, 20 + CONTROL "Дописывать &основной DNS-суффикс и суффикс подключения", IDC_PRIMSUFFIX, "BUTTON", BS_AUTORADIOBUTTON, 5, 110, 234, 12 + CHECKBOX "Дописывать роди&тельские суффиксы осн. DNS-суффикса", IDC_TOPPRIMSUFFIX, 15, 125, 220, 12, BS_AUTOCHECKBOX | WS_TABSTOP + CONTROL "Дописывать сл&едующие DNS-суффиксы (по порядку):", IDC_SELSUFFIX, "BUTTON", BS_AUTORADIOBUTTON, 5, 140, 206, 12 LISTBOX IDC_DNSSUFFIXLIST, 5, 155, 180, 60, LBS_NOTIFY - PUSHBUTTON "", IDC_DNSSUFFIXUP, 190, 170, 50, 14, WS_TABSTOP - PUSHBUTTON "", IDC_DNSSUFFIXDOWN, 190, 190, 50, 14, WS_TABSTOP - PUSHBUTTON "&...", IDC_DNSSUFFIXADD, 30, 210, 50, 14, WS_TABSTOP - PUSHBUTTON "&...", IDC_DNSSUFFIXMOD, 100, 210, 50, 14, WS_TABSTOP - PUSHBUTTON "&", IDC_DNSSUFFIXDEL, 170, 210, 50, 14, WS_TABSTOP - LTEXT "DNS-& :", -1, 5, 225, 110, 14 + PUSHBUTTON "Вверх", IDC_DNSSUFFIXUP, 190, 170, 50, 14, WS_TABSTOP + PUSHBUTTON "Вниз", IDC_DNSSUFFIXDOWN, 190, 190, 50, 14, WS_TABSTOP + PUSHBUTTON "До&бавить...", IDC_DNSSUFFIXADD, 30, 210, 50, 14, WS_TABSTOP + PUSHBUTTON "Из&менить...", IDC_DNSSUFFIXMOD, 100, 210, 50, 14, WS_TABSTOP + PUSHBUTTON "Уда&лить", IDC_DNSSUFFIXDEL, 170, 210, 50, 14, WS_TABSTOP + LTEXT "DNS-&суффикс подключения:", -1, 5, 225, 110, 14 EDITTEXT IDC_SUFFIX, 120, 225, 100, 12, WS_TABSTOP - CHECKBOX "& DNS", IDC_REGSUFFIX, 8, 240, 204, 12, BS_AUTOCHECKBOX | WS_TABSTOP - CHECKBOX "& DNS- DNS", IDC_USESUFFIX, 8, 255, 270, 12, BS_AUTOCHECKBOX | WS_TABSTOP + CHECKBOX "Заре&гистрировать адреса этого подключения в DNS", IDC_REGSUFFIX, 8, 240, 204, 12, BS_AUTOCHECKBOX | WS_TABSTOP + CHECKBOX "&Использовать DNS-суффикс подключения при регистрации в DNS", IDC_USESUFFIX, 8, 255, 270, 12, BS_AUTOCHECKBOX | WS_TABSTOP END IDD_TCPIP_ADVOPT_DLG DIALOGEX DISCARDABLE 0, 0, 247, 247 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION "" +CAPTION "Параметры" FONT 8, "MS Shell Dlg" BEGIN LISTBOX IDC_OPTLIST, 5, 30, 230, 70 - LTEXT "& ", -1, 5, 15, 130, 12 - PUSHBUTTON "&", IDC_OPTPROP, 160, 100, 70, 14, WS_TABSTOP - GROUPBOX ":", -1, 5, 120, 240, 70 + LTEXT "&Дополнительные параметры", -1, 5, 15, 130, 12 + PUSHBUTTON "&Свойства", IDC_OPTPROP, 160, 100, 70, 14, WS_TABSTOP + GROUPBOX "Описание:", -1, 5, 120, 240, 70 LTEXT "", IDC_OPTDESC, 15, 130, 220, 33 END IDD_TCPIPADDIP_DLG DIALOGEX DISCARDABLE 0, 0, 200, 70 STYLE DS_SHELLFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "TCP/IP " +CAPTION "TCP/IP адрес" FONT 8, "MS Shell Dlg" BEGIN CONTROL "",IDC_IPADDR,"SysIPAddress32",WS_TABSTOP, 100, 15, 80, 12 - LTEXT "IP :", -1, 5, 15, 70, 12 - LTEXT " :", -1, 5, 30, 70, 12 + LTEXT "IP адрес:", -1, 5, 15, 70, 12 + LTEXT "Маска подсети:", -1, 5, 30, 70, 12 CONTROL "",IDC_SUBNETMASK,"SysIPAddress32", WS_TABSTOP, 100, 30, 80, 12 PUSHBUTTON "", IDC_OK, 50, 50, 50, 14, WS_TABSTOP - PUSHBUTTON "", IDCANCEL, 110, 50, 50, 14, WS_TABSTOP + PUSHBUTTON "Отмена", IDCANCEL, 110, 50, 50, 14, WS_TABSTOP END IDD_TCPIPGW_DLG DIALOGEX DISCARDABLE 0, 0, 200, 80 STYLE DS_SHELLFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " TCP/IP " +CAPTION "Адрес TCP/IP шлюза" FONT 8, "MS Shell Dlg" BEGIN CONTROL "",IDC_IPADDR,"SysIPAddress32",WS_TABSTOP, 100, 15, 80, 12 - LTEXT ":", -1, 5, 15, 70, 12 - CHECKBOX " ", IDC_USEMETRIC, 15, 30, 190, 12, BS_AUTOCHECKBOX | WS_TABSTOP - LTEXT "&:", IDC_METRICTXT, 5, 45, 45, 12, WS_DISABLED + LTEXT "Шлюз:", -1, 5, 15, 70, 12 + CHECKBOX "Автоматическая метрика", IDC_USEMETRIC, 15, 30, 190, 12, BS_AUTOCHECKBOX | WS_TABSTOP + LTEXT "&Метрика:", IDC_METRICTXT, 5, 45, 45, 12, WS_DISABLED EDITTEXT IDC_METRIC, 100, 45, 50, 12, WS_TABSTOP | ES_NUMBER | WS_DISABLED PUSHBUTTON "", IDC_OK, 50, 60, 50, 14, WS_TABSTOP - PUSHBUTTON "", IDCANCEL, 110, 60, 50, 14, WS_TABSTOP + PUSHBUTTON "Отмена", IDCANCEL, 110, 60, 50, 14, WS_TABSTOP END IDD_TCPIPDNS_DLG DIALOGEX DISCARDABLE 0, 0, 200, 80 STYLE DS_SHELLFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "TCP/IP DNS " +CAPTION "TCP/IP DNS сервер" FONT 8, "MS Shell Dlg" BEGIN CONTROL "",IDC_IPADDR,"SysIPAddress32",WS_TABSTOP, 5, 25, 80, 12 - LTEXT "DNS :", -1, 5, 10, 120, 12 + LTEXT "DNS сервер:", -1, 5, 10, 120, 12 PUSHBUTTON "", IDC_OK, 50, 50, 50, 14, WS_TABSTOP - PUSHBUTTON "", IDCANCEL, 110, 50, 50, 14, WS_TABSTOP + PUSHBUTTON "Отмена", IDCANCEL, 110, 50, 50, 14, WS_TABSTOP END IDD_TCPIPSUFFIX_DLG DIALOGEX DISCARDABLE 0, 0, 200, 80 STYLE DS_SHELLFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " TCP/IP" +CAPTION "Доменный суффикс TCP/IP" FONT 8, "MS Shell Dlg" BEGIN EDITTEXT IDC_SUFFIX, 5, 25, 190, 12, WS_TABSTOP - LTEXT "& :", -1, 5, 10, 120, 12 + LTEXT "&Доменный суффикс:", -1, 5, 10, 120, 12 PUSHBUTTON "", IDC_OK, 50, 50, 50, 14, WS_TABSTOP - PUSHBUTTON "", IDCANCEL, 110, 50, 50, 14, WS_TABSTOP + PUSHBUTTON "Отмена", IDCANCEL, 110, 50, 50, 14, WS_TABSTOP END IDD_TCPIP_FILTER_DLG DIALOGEX DISCARDABLE 0, 0, 305, 220 STYLE DS_SHELLFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " TCP/IP" +CAPTION "Фильтрация TCP/IP" FONT 8, "MS Shell Dlg" BEGIN - CHECKBOX "& TCP/IP ( )", IDC_USE_FILTER, 15, 5, 190, 12, BS_AUTOCHECKBOX | WS_TABSTOP + CHECKBOX "&Задействовать фильтрацию TCP/IP (все адаптеры)", IDC_USE_FILTER, 15, 5, 190, 12, BS_AUTOCHECKBOX | WS_TABSTOP GROUPBOX "", -1, 5, 30, 90, 150 - CONTROL "& ", IDC_TCP_ALLOW_ALL, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 15, 30, 70, 12 - CONTROL "&", IDC_TCP_RESTRICT, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 15, 44, 70, 12 + CONTROL "&Можно все", IDC_TCP_ALLOW_ALL, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 15, 30, 70, 12 + CONTROL "&Только", IDC_TCP_RESTRICT, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 15, 44, 70, 12 CONTROL "", IDC_TCP_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP, 11, 62, 72, 75 - PUSHBUTTON "...", IDC_TCP_ADD, 15, 141, 50, 14, WS_TABSTOP - PUSHBUTTON "&", IDC_TCP_DEL, 15, 161, 50, 14, WS_TABSTOP + PUSHBUTTON "Добавить...", IDC_TCP_ADD, 15, 141, 50, 14, WS_TABSTOP + PUSHBUTTON "&Удалить", IDC_TCP_DEL, 15, 161, 50, 14, WS_TABSTOP GROUPBOX "", -1, 105, 30, 90, 150 - CONTROL "& ", IDC_UDP_ALLOW_ALL, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 115, 30, 70, 12 - CONTROL "&", IDC_UDP_RESTRICT, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 115, 44, 70, 12 + CONTROL "Мо&жно все", IDC_UDP_ALLOW_ALL, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 115, 30, 70, 12 + CONTROL "То&лько", IDC_UDP_RESTRICT, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 115, 44, 70, 12 CONTROL "", IDC_UDP_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP, 111, 62, 72, 75 - PUSHBUTTON "...", IDC_UDP_ADD, 115, 141, 50, 14, WS_TABSTOP - PUSHBUTTON "&", IDC_UDP_DEL, 115, 161, 50, 14, WS_TABSTOP + PUSHBUTTON "Добавить...", IDC_UDP_ADD, 115, 141, 50, 14, WS_TABSTOP + PUSHBUTTON "Уд&алить", IDC_UDP_DEL, 115, 161, 50, 14, WS_TABSTOP GROUPBOX "", -1, 205, 30, 90, 150 - CONTROL " &", IDC_IP_ALLOW_ALL, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 215, 30, 70, 12 - CONTROL "&", IDC_IP_RESTRICT, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 215, 44, 70, 12 + CONTROL "Можно &все", IDC_IP_ALLOW_ALL, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 215, 30, 70, 12 + CONTROL "Тол&ько", IDC_IP_RESTRICT, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 215, 44, 70, 12 CONTROL "", IDC_IP_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP, 211, 62, 72, 75 - PUSHBUTTON "...", IDC_IP_ADD, 215, 141, 50, 14, WS_TABSTOP - PUSHBUTTON "&", IDC_IP_DEL, 215, 161, 50, 14, WS_TABSTOP + PUSHBUTTON "Добавить...", IDC_IP_ADD, 215, 141, 50, 14, WS_TABSTOP + PUSHBUTTON "Удал&ить", IDC_IP_DEL, 215, 161, 50, 14, WS_TABSTOP PUSHBUTTON "OK", IDC_OK, 150, 190, 50, 14, WS_TABSTOP - PUSHBUTTON "", IDCANCEL, 210, 190, 50, 14, WS_TABSTOP + PUSHBUTTON "Отмена", IDCANCEL, 210, 190, 50, 14, WS_TABSTOP END IDD_TCPIP_PORT_DLG DIALOGEX DISCARDABLE 0, 0, 200, 60 STYLE DS_SHELLFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Добавление фильтра" FONT 8, "MS Shell Dlg" BEGIN EDITTEXT IDC_PORT_VAL, 5, 30, 70, 12, WS_TABSTOP | ES_NUMBER LTEXT "", IDC_PORT_DESC, 5, 15, 40, 12 PUSHBUTTON "OK", IDC_OK, 120, 15, 50, 14, WS_TABSTOP - PUSHBUTTON "", IDCANCEL, 120, 30, 50, 14, WS_TABSTOP + PUSHBUTTON "Отмена", IDCANCEL, 120, 30, 50, 14, WS_TABSTOP END STRINGTABLE BEGIN - IDS_NET_CONNECT " " - IDS_NO_IPADDR_SET " IP-. ." - IDS_NO_SUBMASK_SET " . ." - IDS_TCPFILTERDESC " TCP/IP TCP/IP, ." - IDS_TCPFILTER " TCP/IP" - IDS_IPADDR "IP-" - IDS_SUBMASK " " - IDS_GATEWAY "" - IDS_METRIC "" - IDS_DHCPACTIVE "DHCP " - IDS_AUTOMATIC "" - IDS_NOITEMSEL " . ." + IDS_NET_CONNECT "Сетевые подключения" + IDS_NO_IPADDR_SET "Этот адаптер требует ввода хотя бы одного IP-адреса. Введите адрес." + IDS_NO_SUBMASK_SET "Введен адрес без указания маски подсети. Введите маску подсети." + IDS_TCPFILTERDESC "Фильтрация TCP/IP позволяет контролировать сетевой трафик TCP/IP, поступающий на данный компьютер." + IDS_TCPFILTER "Фильтрация TCP/IP" + IDS_IPADDR "IP-адрес" + IDS_SUBMASK "Маска подсети" + IDS_GATEWAY "Шлюз" + IDS_METRIC "Метрика" + IDS_DHCPACTIVE "DHCP включен" + IDS_AUTOMATIC "Автоматически" + IDS_NOITEMSEL "Не выбрано ни одного элемента. Следует выбрать хоты бы один элемент." IDS_TCPIP "ReactOS-TCP/IP" - IDS_ADD "" + IDS_ADD "Добавить" IDS_MOD "OK" - IDS_TCP_PORTS "TCP-" - IDS_UDP_PORTS "UDP-" - IDS_IP_PROTO "IP-" - IDS_PORT_RANGE " 0 65536. ." - IDS_PROT_RANGE " 0 256. ." - IDS_DUP_NUMBER ", , . ." - IDS_DISABLE_FILTER " TCP/IP ." - IDS_NO_SUFFIX " DNS. ." - IDS_DOMAIN_SUFFIX " ." - IDS_DNS_SUFFIX "DNS- ""%s"" DNS-." - IDS_DUP_SUFFIX "DNS- ." - IDS_DUP_IPADDR "IP- ." - IDS_DUP_GW " ." + IDS_TCP_PORTS "TCP-проты" + IDS_UDP_PORTS "UDP-проты" + IDS_IP_PROTO "IP-протоколы" + IDS_PORT_RANGE "Номера портов должны быть больше 0 и меньше 65536. Введите номер в этом диапазоне." + IDS_PROT_RANGE "Номера протоколов должны быть больше 0 и меньше 256. Введите номер в этом диапазоне." + IDS_DUP_NUMBER "Номер, который вы хотите добавить, уже имеется в списке. Введите другой номер." + IDS_DISABLE_FILTER "Запрещение этого глобального параметра TCP/IP повлияет на все адаптеры." + IDS_NO_SUFFIX "Текущие установки метода поиска требуют указания по меньшей мере одного суффикса DNS. Введите суффикс или измените установки." + IDS_DOMAIN_SUFFIX "Неправильный суффикс домена." + IDS_DNS_SUFFIX "DNS-имя домена ""%s"" не является допустимым DNS-именем." + IDS_DUP_SUFFIX "DNS-суфикс уже имеется в списке." + IDS_DUP_IPADDR "IP-адрес уже имеется в списке." + IDS_DUP_GW "Шлюз по умолчанию уже в списке." END diff --git a/dll/win32/netcfgx/lang/uk-UA.rc b/dll/win32/netcfgx/lang/uk-UA.rc index 7a3622cf843..b4cb469537d 100644 --- a/dll/win32/netcfgx/lang/uk-UA.rc +++ b/dll/win32/netcfgx/lang/uk-UA.rc @@ -2,68 +2,68 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT IDD_TCPIP_BASIC_DLG DIALOGEX DISCARDABLE 0, 0, 246, 228 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Загальні" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " IP , . .", -1, 9, 9, 228, 27 - CONTROL " IP- ", IDC_USEDHCP, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 14, 43, 210, 12 + LTEXT "Параметри протоколу IP можуть призначатися автоматично, якщо мережа підтримує таку можливість. Інакше вам потрібно отримати ці параметри у адміністратора мережі.", -1, 9, 9, 228, 27 + CONTROL "Отримувати IP-адресу автоматично", IDC_USEDHCP, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 14, 43, 210, 12 GROUPBOX "", -1, 9, 61, 228, 70, BS_GROUPBOX - CONTROL "& IP-:", IDC_NODHCP, "BUTTON", BS_AUTORADIOBUTTON, 14, 59, 105, 12 - LTEXT "IP-:", -1, 14, 75, 135, 8 + CONTROL "&Використовувати наступну IP-адресу:", IDC_NODHCP, "BUTTON", BS_AUTORADIOBUTTON, 14, 59, 105, 12 + LTEXT "IP-адреса:", -1, 14, 75, 135, 8 CONTROL "",IDC_IPADDR,"SysIPAddress32",WS_TABSTOP,150,75-2,80,12 - LTEXT " :", -1, 14, 90, 135, 8 + LTEXT "Маска підмережі:", -1, 14, 90, 135, 8 CONTROL "",IDC_SUBNETMASK,"SysIPAddress32",WS_TABSTOP,150,90-2,80,12 - LTEXT " :", -1, 14, 105, 135, 8 + LTEXT "Шлюз за замовчуванням:", -1, 14, 105, 135, 8 CONTROL "",IDC_DEFGATEWAY,"SysIPAddress32",WS_TABSTOP,150,105-2,80,12 - CONTROL " DNS- ", IDC_AUTODNS, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 14, 139, 210, 12 + CONTROL "Отримувати адресу DNS-сервера автоматично", IDC_AUTODNS, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 14, 139, 210, 12 GROUPBOX "", -1, 9, 157, 228, 47, BS_GROUPBOX - CONTROL "& DNS-", IDC_FIXEDDNS, "BUTTON", BS_AUTORADIOBUTTON, 14, 155, 142, 12 - LTEXT " DNS-:", -1, 14, 171, 135, 8 + CONTROL "В&икористовувати наступні адреси DNS-серверів", IDC_FIXEDDNS, "BUTTON", BS_AUTORADIOBUTTON, 14, 155, 142, 12 + LTEXT "Основний DNS-сервер:", -1, 14, 171, 135, 8 CONTROL "",IDC_DNS1,"SysIPAddress32",WS_TABSTOP,150,171-2,80,12 - LTEXT " DNS-:", -1, 14, 186, 135, 8 + LTEXT "Альтернативний DNS-сервер:", -1, 14, 186, 135, 8 CONTROL "",IDC_DNS2,"SysIPAddress32",WS_TABSTOP,150,186-2,80,12 - PUSHBUTTON "&", IDC_ADVANCED, 186, 209, 50, 14, WS_TABSTOP + PUSHBUTTON "&Додатково", IDC_ADVANCED, 186, 209, 50, 14, WS_TABSTOP END IDD_TCPIP_ALTCF_DLG DIALOGEX DISCARDABLE 0, 0, 246, 228 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION " " +CAPTION "Альтернативна конфігурація" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ' , IP", -1, 9, 9, 220, 20 - CONTROL "& IP-", IDC_USEDHCP, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 14, 40, 210, 12 + LTEXT "Якщо цей комп'ютер використовується в декількох мережах, введіть параметри альтернативної конфігурації IP", -1, 9, 9, 220, 20 + CONTROL "А&втоматична приватна IP-адреса", IDC_USEDHCP, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 14, 40, 210, 12 GROUPBOX "", -1, 9, 55, 228, 80, BS_GROUPBOX - CONTROL "& ", IDC_NODHCP, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 14, 55, 120, 12 - LTEXT "&IP-:", -1, 14, 75, 135, 8 + CONTROL "Н&алаштована користувачем", IDC_NODHCP, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 14, 55, 120, 12 + LTEXT "&IP-адреса:", -1, 14, 75, 135, 8 CONTROL "",IDC_IPADDR,"SysIPAddress32",WS_TABSTOP, 150, 75, 80, 12 - LTEXT "& :", -1, 14, 95, 135, 8 + LTEXT "Ма&ска підмережі:", -1, 14, 95, 135, 8 CONTROL "",IDC_SUBNETMASK,"SysIPAddress32",WS_TABSTOP, 150, 95, 80, 12 - LTEXT "& :", -1, 14, 115, 135, 8 + LTEXT "&Шлюз за замовчуванням:", -1, 14, 115, 135, 8 CONTROL "",IDC_DEFGATEWAY,"SysIPAddress32",WS_TABSTOP, 150, 115, 80, 12 - LTEXT "& DNS-:", -1, 14, 150, 135, 8 + LTEXT "&Основний DNS-сервер:", -1, 14, 150, 135, 8 CONTROL "",IDC_DNS1,"SysIPAddress32",WS_TABSTOP, 150, 150, 80, 12 - LTEXT "& DNS-:", -1, 14, 165, 180, 8 + LTEXT "&Альтернативний DNS-сервер:", -1, 14, 165, 180, 8 CONTROL "",IDC_DNS2,"SysIPAddress32",WS_TABSTOP, 150, 165, 80, 12 END IDD_TCPIP_ADVIP_DLG DIALOGEX DISCARDABLE 0, 0, 247, 247 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION " IP" +CAPTION "Параметри IP" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "IP-", -1, 5, 5, 240, 90 + GROUPBOX "IP-адреси", -1, 5, 5, 240, 90 CONTROL "", IDC_IPLIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP, 15, 15, 210, 55 - PUSHBUTTON "...", IDC_IPADD, 60, 75, 50, 14, WS_TABSTOP - PUSHBUTTON "...", IDC_IPMOD, 120, 75, 50, 14, WS_TABSTOP - PUSHBUTTON "", IDC_IPDEL, 180, 75, 50, 14, WS_TABSTOP - GROUPBOX " :", -1, 5, 100, 240, 90 + PUSHBUTTON "Додати...", IDC_IPADD, 60, 75, 50, 14, WS_TABSTOP + PUSHBUTTON "Редагувати...", IDC_IPMOD, 120, 75, 50, 14, WS_TABSTOP + PUSHBUTTON "Видалити", IDC_IPDEL, 180, 75, 50, 14, WS_TABSTOP + GROUPBOX "Основні шлюзи:", -1, 5, 100, 240, 90 CONTROL "", IDC_GWLIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP, 15, 110, 210, 55 - PUSHBUTTON "...", IDC_GWADD, 60, 170, 50, 14, WS_TABSTOP - PUSHBUTTON "...", IDC_GWMOD, 120, 170, 50, 14, WS_TABSTOP - PUSHBUTTON "", IDC_GWDEL, 180, 170, 50, 14, WS_TABSTOP + PUSHBUTTON "Додати...", IDC_GWADD, 60, 170, 50, 14, WS_TABSTOP + PUSHBUTTON "Редагувати...", IDC_GWMOD, 120, 170, 50, 14, WS_TABSTOP + PUSHBUTTON "Видалити", IDC_GWDEL, 180, 170, 50, 14, WS_TABSTOP GROUPBOX "", -1, 5, 200, 240, 30 - CHECKBOX " ", IDC_AUTOMETRIC, 9, 200, 90, 12, BS_AUTOCHECKBOX | WS_TABSTOP - LTEXT " :", -1, 15, 215, 90, 12 + CHECKBOX "Автоматична метрика", IDC_AUTOMETRIC, 9, 200, 90, 12, BS_AUTOCHECKBOX | WS_TABSTOP + LTEXT "Метрика інтерфейсу:", -1, 15, 215, 90, 12 EDITTEXT IDC_METRIC, 110, 212, 50, 12, WS_TABSTOP | ES_NUMBER END @@ -73,157 +73,157 @@ CAPTION "DNS" FONT 8, "MS Shell Dlg" BEGIN LISTBOX IDC_DNSADDRLIST, 5, 15, 180, 60, LBS_NOTIFY - LTEXT " D&NS :", -1, 5, 5, 180, 12 - PUSHBUTTON "", IDC_DNSADDRUP, 190, 30, 50, 14, WS_TABSTOP - PUSHBUTTON "", IDC_DNSADDRDOWN, 190, 50, 50, 14, WS_TABSTOP - PUSHBUTTON "&...", IDC_DNSADDRADD, 30, 70, 50, 14, WS_TABSTOP - PUSHBUTTON "&...", IDC_DNSADDRMOD, 100, 70, 50, 14, WS_TABSTOP - PUSHBUTTON "&", IDC_DNSADDRDEL, 170, 70, 50, 14, WS_TABSTOP - LTEXT " , TCP/IP. :", -1, 5, 90, 220, 24 - CONTROL " & DNS- ", IDC_PRIMSUFFIX, "BUTTON", BS_AUTORADIOBUTTON, 5, 110, 190, 12 - CHECKBOX " & DNS-", IDC_TOPPRIMSUFFIX, 15, 125, 194, 12, BS_AUTOCHECKBOX | WS_TABSTOP - CONTROL " & DNS- ( ):", IDC_SELSUFFIX, "BUTTON", BS_AUTORADIOBUTTON, 5, 140, 190, 12 + LTEXT "Адреси D&NS серверів в порядку використання:", -1, 5, 5, 180, 12 + PUSHBUTTON "Вверх", IDC_DNSADDRUP, 190, 30, 50, 14, WS_TABSTOP + PUSHBUTTON "Вниз", IDC_DNSADDRDOWN, 190, 50, 50, 14, WS_TABSTOP + PUSHBUTTON "&Додати...", IDC_DNSADDRADD, 30, 70, 50, 14, WS_TABSTOP + PUSHBUTTON "&Редагувати...", IDC_DNSADDRMOD, 100, 70, 50, 14, WS_TABSTOP + PUSHBUTTON "&Видалити", IDC_DNSADDRDEL, 170, 70, 50, 14, WS_TABSTOP + LTEXT "Наступні три параметри застосовуються для всіх підключень, що використовують TCP/IP. Для дозволу невідомих імен:", -1, 5, 90, 220, 24 + CONTROL "Додавати &основний DNS-суфікс і суфікс підключення", IDC_PRIMSUFFIX, "BUTTON", BS_AUTORADIOBUTTON, 5, 110, 190, 12 + CHECKBOX "Додавати &батьківські суфікси основного DNS-суфікса", IDC_TOPPRIMSUFFIX, 15, 125, 194, 12, BS_AUTOCHECKBOX | WS_TABSTOP + CONTROL "Додавати &наступні DNS-суфікси (по порядку):", IDC_SELSUFFIX, "BUTTON", BS_AUTORADIOBUTTON, 5, 140, 190, 12 LISTBOX IDC_DNSSUFFIXLIST, 5, 155, 180, 60, LBS_NOTIFY - PUSHBUTTON "", IDC_DNSSUFFIXUP, 190, 170, 50, 14, WS_TABSTOP - PUSHBUTTON "", IDC_DNSSUFFIXDOWN, 190, 190, 50, 14, WS_TABSTOP - PUSHBUTTON "&...", IDC_DNSSUFFIXADD, 30, 210, 50, 14, WS_TABSTOP - PUSHBUTTON "&...", IDC_DNSSUFFIXMOD, 100, 210, 50, 14, WS_TABSTOP - PUSHBUTTON "&", IDC_DNSSUFFIXDEL, 170, 210, 50, 14, WS_TABSTOP - LTEXT "DNS-& :", -1, 5, 228, 110, 14 + PUSHBUTTON "Вверх", IDC_DNSSUFFIXUP, 190, 170, 50, 14, WS_TABSTOP + PUSHBUTTON "Вниз", IDC_DNSSUFFIXDOWN, 190, 190, 50, 14, WS_TABSTOP + PUSHBUTTON "&Додати...", IDC_DNSSUFFIXADD, 30, 210, 50, 14, WS_TABSTOP + PUSHBUTTON "&Редагувати...", IDC_DNSSUFFIXMOD, 100, 210, 50, 14, WS_TABSTOP + PUSHBUTTON "&Видалити", IDC_DNSSUFFIXDEL, 170, 210, 50, 14, WS_TABSTOP + LTEXT "DNS-&суфікс цього підключення:", -1, 5, 228, 110, 14 EDITTEXT IDC_SUFFIX, 120, 225, 100, 12, WS_TABSTOP - CHECKBOX "& DNS", IDC_REGSUFFIX, 15, 240, 190, 12, BS_AUTOCHECKBOX | WS_TABSTOP - CHECKBOX "& DNS- DNS", IDC_USESUFFIX, 15, 255, 227, 12, BS_AUTOCHECKBOX | WS_TABSTOP + CHECKBOX "&Зареєструвати адреси цього підключення в DNS", IDC_REGSUFFIX, 15, 240, 190, 12, BS_AUTOCHECKBOX | WS_TABSTOP + CHECKBOX "Вик&ористовувати DNS-суфікс підключення при реєстрації в DNS", IDC_USESUFFIX, 15, 255, 227, 12, BS_AUTOCHECKBOX | WS_TABSTOP END IDD_TCPIP_ADVOPT_DLG DIALOGEX DISCARDABLE 0, 0, 247, 247 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION "" +CAPTION "Параметри" FONT 8, "MS Shell Dlg" BEGIN LISTBOX IDC_OPTLIST, 5, 30, 230, 70 - LTEXT "& ", -1, 5, 15, 130, 12 - PUSHBUTTON "&", IDC_OPTPROP, 160, 100, 70, 14, WS_TABSTOP - GROUPBOX ":", -1, 5, 120, 240, 70 + LTEXT "&Додаткові параметри", -1, 5, 15, 130, 12 + PUSHBUTTON "&Властивості", IDC_OPTPROP, 160, 100, 70, 14, WS_TABSTOP + GROUPBOX "Опис:", -1, 5, 120, 240, 70 LTEXT "", IDC_OPTDESC, 15, 130, 220, 33 END IDD_TCPIPADDIP_DLG DIALOGEX DISCARDABLE 0, 0, 200, 70 STYLE DS_SHELLFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "TCP/IP " +CAPTION "TCP/IP Адреса" FONT 8, "MS Shell Dlg" BEGIN CONTROL "",IDC_IPADDR,"SysIPAddress32",WS_TABSTOP, 100, 15, 80, 12 - LTEXT "IP-:", -1, 5, 15, 70, 12 - LTEXT " :", -1, 5, 30, 70, 12 + LTEXT "IP-адреса:", -1, 5, 15, 70, 12 + LTEXT "Маска підмережі:", -1, 5, 30, 70, 12 CONTROL "",IDC_SUBNETMASK,"SysIPAddress32", WS_TABSTOP, 100, 30, 80, 12 PUSHBUTTON "", IDC_OK, 50, 50, 50, 14, WS_TABSTOP - PUSHBUTTON "", IDCANCEL, 110, 50, 50, 14, WS_TABSTOP + PUSHBUTTON "Скасувати", IDCANCEL, 110, 50, 50, 14, WS_TABSTOP END IDD_TCPIPGW_DLG DIALOGEX DISCARDABLE 0, 0, 200, 80 STYLE DS_SHELLFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " TCP/IP " +CAPTION "Адреса TCP/IP шлюза" FONT 8, "MS Shell Dlg" BEGIN CONTROL "",IDC_IPADDR,"SysIPAddress32",WS_TABSTOP, 100, 15, 80, 12 - LTEXT ":", -1, 5, 15, 70, 12 - CHECKBOX " ", IDC_USEMETRIC, 15, 30, 190, 12, BS_AUTOCHECKBOX | WS_TABSTOP - LTEXT "&:", IDC_METRICTXT, 5, 45, 45, 12, WS_DISABLED + LTEXT "Шлюз:", -1, 5, 15, 70, 12 + CHECKBOX "Автоматична метрика", IDC_USEMETRIC, 15, 30, 190, 12, BS_AUTOCHECKBOX | WS_TABSTOP + LTEXT "&Метрика:", IDC_METRICTXT, 5, 45, 45, 12, WS_DISABLED EDITTEXT IDC_METRIC, 100, 45, 50, 12, WS_TABSTOP | ES_NUMBER | WS_DISABLED PUSHBUTTON "", IDC_OK, 50, 60, 50, 14, WS_TABSTOP - PUSHBUTTON "", IDCANCEL, 110, 60, 50, 14, WS_TABSTOP + PUSHBUTTON "Скасувати", IDCANCEL, 110, 60, 50, 14, WS_TABSTOP END IDD_TCPIPDNS_DLG DIALOGEX DISCARDABLE 0, 0, 200, 80 STYLE DS_SHELLFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "TCP/IP DNS " +CAPTION "TCP/IP DNS Сервер" FONT 8, "MS Shell Dlg" BEGIN CONTROL "",IDC_IPADDR,"SysIPAddress32",WS_TABSTOP, 5, 25, 80, 12 - LTEXT "DNS :", -1, 5, 10, 120, 12 + LTEXT "DNS сервер:", -1, 5, 10, 120, 12 PUSHBUTTON "", IDC_OK, 50, 50, 50, 14, WS_TABSTOP - PUSHBUTTON "", IDCANCEL, 110, 50, 50, 14, WS_TABSTOP + PUSHBUTTON "Скасувати", IDCANCEL, 110, 50, 50, 14, WS_TABSTOP END IDD_TCPIPSUFFIX_DLG DIALOGEX DISCARDABLE 0, 0, 200, 80 STYLE DS_SHELLFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " TCP/IP" +CAPTION "Доменний суфікс TCP/IP" FONT 8, "MS Shell Dlg" BEGIN EDITTEXT IDC_SUFFIX, 5, 25, 190, 12, WS_TABSTOP - LTEXT " :", -1, 5, 10, 120, 12 + LTEXT "Доменний суфікс:", -1, 5, 10, 120, 12 PUSHBUTTON "", IDC_OK, 50, 50, 50, 14, WS_TABSTOP - PUSHBUTTON "", IDCANCEL, 110, 50, 50, 14, WS_TABSTOP + PUSHBUTTON "Скасувати", IDCANCEL, 110, 50, 50, 14, WS_TABSTOP END IDD_TCPIP_FILTER_DLG DIALOGEX DISCARDABLE 0, 0, 305, 220 STYLE DS_SHELLFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Գ TCP/IP" +CAPTION "Фільтрування TCP/IP" FONT 8, "MS Shell Dlg" BEGIN - CHECKBOX " TCP/IP ( )", IDC_USE_FILTER, 15, 5, 190, 12, BS_AUTOCHECKBOX | WS_TABSTOP + CHECKBOX "Ввімкнути фільтрування TCP/IP (всі адаптери)", IDC_USE_FILTER, 15, 5, 190, 12, BS_AUTOCHECKBOX | WS_TABSTOP GROUPBOX "", -1, 5, 30, 90, 150 - CONTROL " ", IDC_TCP_ALLOW_ALL, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 15, 30, 70, 12 - CONTROL " ", IDC_TCP_RESTRICT, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 15, 44, 70, 12 + CONTROL "Можна все", IDC_TCP_ALLOW_ALL, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 15, 30, 70, 12 + CONTROL "Можна лише", IDC_TCP_RESTRICT, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 15, 44, 70, 12 CONTROL "", IDC_TCP_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP, 11, 62, 72, 75 - PUSHBUTTON "", IDC_TCP_ADD, 15, 141, 50, 14, WS_TABSTOP - PUSHBUTTON "", IDC_TCP_DEL, 15, 161, 50, 14, WS_TABSTOP + PUSHBUTTON "Додати", IDC_TCP_ADD, 15, 141, 50, 14, WS_TABSTOP + PUSHBUTTON "Видалити", IDC_TCP_DEL, 15, 161, 50, 14, WS_TABSTOP GROUPBOX "", -1, 105, 30, 90, 150 - CONTROL " ", IDC_UDP_ALLOW_ALL, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 115, 30, 70, 12 - CONTROL " ", IDC_UDP_RESTRICT, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 115, 44, 70, 12 + CONTROL "Можна все", IDC_UDP_ALLOW_ALL, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 115, 30, 70, 12 + CONTROL "Можна лише", IDC_UDP_RESTRICT, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 115, 44, 70, 12 CONTROL "", IDC_UDP_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP, 111, 62, 72, 75 - PUSHBUTTON "", IDC_UDP_ADD, 115, 141, 50, 14, WS_TABSTOP - PUSHBUTTON "", IDC_UDP_DEL, 115, 161, 50, 14, WS_TABSTOP + PUSHBUTTON "Додати", IDC_UDP_ADD, 115, 141, 50, 14, WS_TABSTOP + PUSHBUTTON "Видалити", IDC_UDP_DEL, 115, 161, 50, 14, WS_TABSTOP GROUPBOX "", -1, 205, 30, 90, 150 - CONTROL " ", IDC_IP_ALLOW_ALL, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 215, 30, 70, 12 - CONTROL " ", IDC_IP_RESTRICT, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 215, 44, 70, 12 + CONTROL "Можна все", IDC_IP_ALLOW_ALL, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 215, 30, 70, 12 + CONTROL "Можна лише", IDC_IP_RESTRICT, "BUTTON", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP, 215, 44, 70, 12 CONTROL "", IDC_IP_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP, 211, 62, 72, 75 - PUSHBUTTON "", IDC_IP_ADD, 215, 141, 50, 14, WS_TABSTOP - PUSHBUTTON "", IDC_IP_DEL, 215, 161, 50, 14, WS_TABSTOP + PUSHBUTTON "Додати", IDC_IP_ADD, 215, 141, 50, 14, WS_TABSTOP + PUSHBUTTON "Видалити", IDC_IP_DEL, 215, 161, 50, 14, WS_TABSTOP PUSHBUTTON "OK", IDC_OK, 150, 190, 50, 14, WS_TABSTOP - PUSHBUTTON "", IDCANCEL, 210, 190, 50, 14, WS_TABSTOP + PUSHBUTTON "Скасувати", IDCANCEL, 210, 190, 50, 14, WS_TABSTOP END IDD_TCPIP_PORT_DLG DIALOGEX DISCARDABLE 0, 0, 200, 60 STYLE DS_SHELLFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Додати фільтр" FONT 8, "MS Shell Dlg" BEGIN EDITTEXT IDC_PORT_VAL, 5, 30, 70, 12, WS_TABSTOP | ES_NUMBER LTEXT "", IDC_PORT_DESC, 5, 15, 40, 12 PUSHBUTTON "OK", IDC_OK, 120, 15, 50, 14, WS_TABSTOP - PUSHBUTTON "", IDCANCEL, 120, 30, 50, 14, WS_TABSTOP + PUSHBUTTON "Скасувати", IDCANCEL, 120, 30, 50, 14, WS_TABSTOP END STRINGTABLE BEGIN - IDS_NET_CONNECT " " - IDS_NO_IPADDR_SET " IP-. -, ." - IDS_NO_SUBMASK_SET " . ." - IDS_TCPFILTERDESC "Գ TCP/IP TCP/IP, '." - IDS_TCPFILTER "Գ TCP/IP" - IDS_IPADDR "IP-" - IDS_SUBMASK " " - IDS_GATEWAY "" - IDS_METRIC "" - IDS_DHCPACTIVE "DHCP " - IDS_AUTOMATIC "" - IDS_NOITEMSEL " . ." + IDS_NET_CONNECT "Мережне підключення" + IDS_NO_IPADDR_SET "Адаптеру потрібна хоча б одна IP-адреса. Будь-ласка, введіть її." + IDS_NO_SUBMASK_SET "Введено адресу без вказання маски підмережі. Додайте маску підмережі." + IDS_TCPFILTERDESC "Фільтрування TCP/IP дозволяє контролювати мережний трафік TCP/IP, що надходить на ваш комп'ютер." + IDS_TCPFILTER "Фільтрування TCP/IP" + IDS_IPADDR "IP-адреса" + IDS_SUBMASK "Маска підмережі" + IDS_GATEWAY "Шлюз" + IDS_METRIC "Метрика" + IDS_DHCPACTIVE "DHCP включено" + IDS_AUTOMATIC "Автоматично" + IDS_NOITEMSEL "Не вибрано ні одного елементу. Виберіть хоча б один." IDS_TCPIP "ReactOS-TCP/IP" - IDS_ADD "" + IDS_ADD "Додати" IDS_MOD "OK" - IDS_TCP_PORTS "TCP-" - IDS_UDP_PORTS "UDP-" - IDS_IP_PROTO "IP-" - IDS_PORT_RANGE " 0 65536. ." - IDS_PROT_RANGE " 0 256. ." - IDS_DUP_NUMBER ", , . ." - IDS_DISABLE_FILTER " TCP/IP ." - IDS_NO_SUFFIX " DNS. ." - IDS_DOMAIN_SUFFIX " ." - IDS_DNS_SUFFIX "DNS-' ""%s"" DNS-." - IDS_DUP_SUFFIX "DNS- ." - IDS_DUP_IPADDR "IP- ." - IDS_DUP_GW " ." + IDS_TCP_PORTS "TCP-порти" + IDS_UDP_PORTS "UDP-порти" + IDS_IP_PROTO "IP-протоколи" + IDS_PORT_RANGE "Номери портів повинні бути більші від 0 та менші від 65536. Введіть номер з цього діапазону." + IDS_PROT_RANGE "Номери протоколу повинні бути більші від 0 та менші від 256. Введіть номер з цього діапазону." + IDS_DUP_NUMBER "Номер, який ви хочете додати, вже є в списку. Введіть інший номер." + IDS_DISABLE_FILTER "Заборона цього глобального параметра TCP/IP вплине на всі адаптери." + IDS_NO_SUFFIX "Поточні параметри методу пошуку вимагають вказання хоча б одного суфіксу DNS. Введіть суфікс або змініть налаштування." + IDS_DOMAIN_SUFFIX "Невірний суфікс домена." + IDS_DNS_SUFFIX "DNS-ім'я домену ""%s"" не є допустимим DNS-іменем." + IDS_DUP_SUFFIX "DNS-суфікс вже присутній в списку." + IDS_DUP_IPADDR "IP-адреса вже є всписку." + IDS_DUP_GW "Шлюз по замовчуванню вже є в списку." END diff --git a/dll/win32/netcfgx/netcfg_iface.c b/dll/win32/netcfgx/netcfg_iface.c index 5dc52ec2d5c..7f566e458bd 100644 --- a/dll/win32/netcfgx/netcfg_iface.c +++ b/dll/win32/netcfgx/netcfg_iface.c @@ -1,5 +1,4 @@ #include "precomp.h" -#include typedef struct { diff --git a/dll/win32/netcfgx/netcfgx.c b/dll/win32/netcfgx/netcfgx.c index eb59418ba88..f04f6ef690c 100644 --- a/dll/win32/netcfgx/netcfgx.c +++ b/dll/win32/netcfgx/netcfgx.c @@ -7,19 +7,14 @@ * PROGRAMMERS: Herv Poussineau (hpoussin@reactos.org) */ - #include "precomp.h" -#include -#include + #define NDEBUG #include HINSTANCE netcfgx_hInstance; const GUID CLSID_TcpipConfigNotifyObject = {0xA907657F, 0x6FDF, 0x11D0, {0x8E, 0xFB, 0x00, 0xC0, 0x4F, 0xD9, 0x12, 0xB2}}; - - - static INTERFACE_TABLE InterfaceTable[] = { { diff --git a/dll/win32/netcfgx/netcfgx.rbuild b/dll/win32/netcfgx/netcfgx.rbuild index 1ff2adb7838..2d220ae2e62 100644 --- a/dll/win32/netcfgx/netcfgx.rbuild +++ b/dll/win32/netcfgx/netcfgx.rbuild @@ -20,4 +20,5 @@ inetcfgcomp_iface.c tcpipconf_notify.c netcfgx.rc + precomp.h diff --git a/dll/win32/netcfgx/netcfgx.rc b/dll/win32/netcfgx/netcfgx.rc index 3f0747836ae..de8b5014a92 100644 --- a/dll/win32/netcfgx/netcfgx.rc +++ b/dll/win32/netcfgx/netcfgx.rc @@ -28,9 +28,12 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL #include "lang/ja-JP.rc" #include "lang/no-NO.rc" #include "lang/nl-NL.rc" -#include "lang/pl-PL.rc" -#include "lang/ru-RU.rc" #include "lang/sk-SK.rc" #include "lang/sv-SE.rc" -#include "lang/uk-UA.rc" #include "lang/zh-CN.rc" + +// UTF-8 +#pragma code_page(65001) +#include "lang/pl-PL.rc" +#include "lang/ru-RU.rc" +#include "lang/uk-UA.rc" diff --git a/dll/win32/netcfgx/precomp.h b/dll/win32/netcfgx/precomp.h index 6215e39f4a8..a6a6021b0a6 100644 --- a/dll/win32/netcfgx/precomp.h +++ b/dll/win32/netcfgx/precomp.h @@ -8,7 +8,8 @@ #define WIN32_NO_STATUS #include #define NTOS_MODE_USER -#include +#include +#include #include #include #include @@ -18,6 +19,9 @@ #include "resource.h" #include +#include +#include + typedef HRESULT (CALLBACK *LPFNCREATEINSTANCE)(IUnknown* pUnkOuter, REFIID riid, LPVOID* ppvObject); typedef struct { REFIID riid; diff --git a/dll/win32/netevent/CMakeLists.txt b/dll/win32/netevent/CMakeLists.txt index f0f4e5c8dff..3a38213bc25 100644 --- a/dll/win32/netevent/CMakeLists.txt +++ b/dll/win32/netevent/CMakeLists.txt @@ -1,13 +1,8 @@ set_unicode() - include_directories(${REACTOS_BINARY_DIR}/include/reactos) - add_library(netevent SHARED netevt.rc) - -set_module_type(netevent win32dll) - -add_importlibs(netevent msvcrt kernel32) - +set_entrypoint(netevent 0) +set_image_base(netevent ${baseaddress_netevent}) add_dependencies(netevent neteventmsg) add_cd_file(TARGET netevent DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/netid/CMakeLists.txt b/dll/win32/netid/CMakeLists.txt index 57bd8f59f2e..3b099277ec1 100644 --- a/dll/win32/netid/CMakeLists.txt +++ b/dll/win32/netid/CMakeLists.txt @@ -1,4 +1,5 @@ +set_unicode() spec2def(netid.dll netid.spec) set_rc_compiler() diff --git a/dll/win32/netid/lang/pl-PL.rc b/dll/win32/netid/lang/pl-PL.rc index 30bf2adc226..12691f61999 100644 --- a/dll/win32/netid/lang/pl-PL.rc +++ b/dll/win32/netid/lang/pl-PL.rc @@ -1,11 +1,11 @@ /* -* translation by xrogers -* xxrogers@users.sourceforge.net -* https://sourceforge.net/projects/reactospl -* -* translation update by Caemyr (Olaf Siejka) -* April, 2008 -*/ + * translation by xrogers + * xxrogers@users.sourceforge.net + * https://sourceforge.net/projects/reactospl + * translation update by Caemyr - Olaf Siejka (Apr, 2008) + * UTF-8 conversion by Caemyr (May, 2011) + */ + LANGUAGE LANG_POLISH, SUBLANG_DEFAULT IDD_PROPPAGECOMPUTER DIALOGEX 0, 0, 256, 218 @@ -14,18 +14,18 @@ CAPTION "Nazwa komputera" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN ICON IDI_COMPNAME, IDC_STATIC, 4, 3, 26, 24, SS_ICON - LTEXT "ReactOS uywa nastpujcych informacji doidentyfikacji komputera w sieci", IDC_STATIC, 40, 5, 204, 20 + LTEXT "ReactOS używa następujących informacji do identyfikacji komputera w sieci", IDC_STATIC, 40, 5, 204, 20 LTEXT "Opis komputera:", IDC_STATIC, 6, 40, 70, 9 EDITTEXT IDC_COMPDESC, 98, 38, 146, 13, WS_CHILD | WS_VISIBLE | WS_TABSTOP - LTEXT "Pena nazwa komputera:", IDC_STATIC, 6, 68, 64, 9 + LTEXT "Pełna nazwa komputera:", IDC_STATIC, 6, 68, 64, 9 EDITTEXT IDC_COMPUTERNAME, 98, 68, 144, 12, ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP LTEXT "Grupa robocza:", IDC_WORKGROUPDOMAIN, 6, 84, 64, 9 EDITTEXT IDC_WORKGROUPDOMAIN_NAME, 98, 84, 144, 12, ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP - LTEXT "Aby uy Kreatora identyfikacji sieciowej do doczenia do domeny i stworzy lokalnego uytkownika, wcinij ID sieciowe.", IDC_STATIC, 6, 108, 172, 24 + LTEXT "Aby użyć Kreatora identyfikacji sieciowej do dołączenia do domeny i stworzyć lokalnego użytkownika, wciśnij ID sieciowe.", IDC_STATIC, 6, 108, 172, 24 PUSHBUTTON "&ID sieciowe...", IDC_NETWORK_ID, 190, 114, 58, 15 - LTEXT "Aby zmieni nazw tego komputera lub przyczy si do grupy roboczej, kliknij przycisk Zmie.", IDC_STATIC, 6, 149, 170, 17 - PUSHBUTTON "Z&mie...",IDC_NETWORK_PROPERTY, 190, 149, 58, 15 - LTEXT "Uwaga: Tylko administratorzy mog zmieni identyfikator tego komputera.", IDC_STATIC, 6, 179, 300, 9 + LTEXT "Aby zmienić nazwę tego komputera lub przyłączyć się do grupy roboczej, kliknij przycisk Zmień.", IDC_STATIC, 6, 149, 170, 17 + PUSHBUTTON "Z&mień...",IDC_NETWORK_PROPERTY, 190, 149, 58, 15 + LTEXT "Uwaga: Tylko administratorzy mogą zmienić identyfikator tego komputera.", IDC_STATIC, 6, 179, 300, 9 END IDD_PROPPAGECOMPNAMECHENGE DIALOGEX 0, 0, 232, 222 @@ -36,14 +36,14 @@ BEGIN LTEXT "(message goes here)", 1017, 7, 5, 218, 30 LTEXT "&Nazwa komputera:", -1, 7, 41, 219, 8 EDITTEXT 1002, 7, 53, 218, 14, ES_AUTOHSCROLL | ES_OEMCONVERT - LTEXT "Pena nazwa komputera:", 1016, 7, 72, 218, 10 + LTEXT "Pełna nazwa komputera:", 1016, 7, 72, 218, 10 EDITTEXT 1001, 7, 82, 219, 14, ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP - PUSHBUTTON "&Wicej...", 1003, 150, 102, 75, 14 - GROUPBOX "Naley do", 1018, 7, 119, 219, 73 + PUSHBUTTON "&Więcej...", 1003, 150, 102, 75, 14 + GROUPBOX "Należy do", 1018, 7, 119, 219, 73 AUTORADIOBUTTON "&Domeny:", 1008, 17, 132, 192, 10, WS_GROUP AUTORADIOBUTTON "&Grupy roboczej:", 1004, 17, 161, 191, 10 EDITTEXT 116, 28, 144, 181, 14, ES_AUTOHSCROLL | WS_GROUP - PUSHBUTTON "Wy&szukaj moj domen", 1010, 7, 203, 109, 14, NOT WS_VISIBLE | WS_DISABLED + PUSHBUTTON "Wy&szukaj moją domenę", 1010, 7, 203, 109, 14, NOT WS_VISIBLE | WS_DISABLED EDITTEXT 1007, 28, 172, 181, 14, ES_UPPERCASE | ES_AUTOHSCROLL | ES_OEMCONVERT DEFPUSHBUTTON "OK", 1, 121, 203, 50, 14, WS_GROUP PUSHBUTTON "Anuluj", 2, 176, 203, 50, 14 @@ -56,31 +56,31 @@ FONT 8, "MS Shell Dlg" BEGIN LTEXT "&Podstawowy sufiks DNS tego komputera:", -1, 7, 5, 253, 8 EDITTEXT 1011, 7, 17, 252, 14, ES_AUTOHSCROLL - AUTOCHECKBOX "&Zmie podstawowy sufiks DNS przy zmianie czonkostwa domeny", 115, 11, 39, 250, 10 + AUTOCHECKBOX "&Zmień podstawowy sufiks DNS przy zmianie członkostwa domeny", 115, 11, 39, 250, 10 LTEXT "&Nazwa komputera NetBIOS:", -1, 7, 57, 148, 8 EDITTEXT 1013, 7, 69, 150, 14, ES_UPPERCASE | ES_AUTOHSCROLL | ES_READONLY DEFPUSHBUTTON "OK", 1, 153, 104, 50, 14 PUSHBUTTON "Anuluj", 2, 209, 104, 50, 14 - LTEXT "Nazwa ta jest niezbdna przy pracy ze starszymi serwerami i usugami.", 13, 7, 88, 253, 8 + LTEXT "Nazwa ta jest niezbędna przy pracy ze starszymi serwerami i usługami.", 13, 7, 88, 253, 8 END STRINGTABLE BEGIN 1 "* Nieznane *" 2 "GRUPA ROBOCZA" - 3 "Podczas odczytywania informacji o czonkowstwie w domenie, wystpi bd:" + 3 "Podczas odczytywania informacji o członkowstwie w domenie, wystąpił błąd:" 4 "Zmiana nazwy komputera" 5 "Grupa Robocza:" 6 "Domena:" 22 "Witamy w grupie roboczej %1." 23 "Witamy w domenie %1." - 24 "Musisz zrestartowa komputer aby zmiany odniosy skutek." - 25 "Moesz zmieni nazw i czonkostwo tego komputera. Zmiany mog mie wpyw na dostp do zasobw sieciowych." - 1021 "Uwaga: Tylko Administratorzy mog zmienia identyfikator tego komputera." - 1022 "Uwaga: Identyfikator tego komputera nie zosta zmieniony, powd:" - 1030 "Nowa nazwa komputera ""%s"" zawiera niedozwolone znaki. Do niedozwolonych znakw nale ` ~ ! @ # $ %% ^ & * ( ) = + _ [ ] { } \\ | ; : ' "" , . < > / oraz ?" - 3210 "&Szczegy >>" - 3220 "<< &Szczegy" + 24 "Musisz zrestartować komputer aby zmiany odniosły skutek." + 25 "Możesz zmienić nazwę i członkostwo tego komputera. Zmiany mogą mieć wpływ na dostęp do zasobów sieciowych." + 1021 "Uwaga: Tylko Administratorzy mogą zmieniać identyfikator tego komputera." + 1022 "Uwaga: Identyfikator tego komputera nie został zmieniony, powód:" + 1030 "Nowa nazwa komputera ""%s"" zawiera niedozwolone znaki. Do niedozwolonych znaków należą ` ~ ! @ # $ %% ^ & * ( ) = + _ [ ] { } \\ | ; : ' "" , . < > / oraz ?" + 3210 "&Szczegóły >>" + 3220 "<< &Szczegóły" 4000 "Informacja" - 4001 "Nie mona zmieni nazwy komputera!" + 4001 "Nie można zmienić nazwy komputera!" END diff --git a/dll/win32/netid/lang/ru-RU.rc b/dll/win32/netid/lang/ru-RU.rc index df4d340d2b4..9dbb387ff72 100644 --- a/dll/win32/netid/lang/ru-RU.rc +++ b/dll/win32/netid/lang/ru-RU.rc @@ -2,77 +2,77 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT IDD_PROPPAGECOMPUTER DIALOGEX 0, 0, 256, 218 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Имя компьютера" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN ICON IDI_COMPNAME, IDC_STATIC, 4, 3, 26, 24, SS_ICON - LTEXT "ReactOS .", IDC_STATIC, 40, 5, 204, 20 - LTEXT ":", IDC_STATIC, 6, 40, 70, 9 + LTEXT "ReactOS использует указанные ниже сведения для идентификации компьютера в сети.", IDC_STATIC, 40, 5, 204, 20 + LTEXT "Описание:", IDC_STATIC, 6, 40, 70, 9 EDITTEXT IDC_COMPDESC, 98, 38, 146, 13, WS_CHILD | WS_VISIBLE | WS_TABSTOP - LTEXT " :", IDC_STATIC, 6, 68, 64, 9 + LTEXT "Полное имя:", IDC_STATIC, 6, 68, 64, 9 EDITTEXT IDC_COMPUTERNAME, 98, 68, 144, 12, ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP - LTEXT " :", IDC_WORKGROUPDOMAIN, 6, 84, 64, 9 + LTEXT "Рабочая группа:", IDC_WORKGROUPDOMAIN, 6, 84, 64, 9 EDITTEXT IDC_WORKGROUPDOMAIN_NAME, 98, 84, 144, 12, ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP - LTEXT " , """".", IDC_STATIC, 6, 113, 172, 24 - PUSHBUTTON "&...", IDC_NETWORK_ID, 180, 114, 72, 15 - LTEXT " """".", IDC_STATIC, 6, 149, 170, 17 - PUSHBUTTON "&...",IDC_NETWORK_PROPERTY, 180, 149, 72, 15 - LTEXT ": .", IDC_STATIC, 6, 179, 245, 9 + LTEXT "Чтобы вызвать мастер сетевой идентификации для присоединения компьютера к домену, нажмите кнопку ""Идентификация"".", IDC_STATIC, 6, 113, 172, 24 + PUSHBUTTON "&Идентификация...", IDC_NETWORK_ID, 180, 114, 72, 15 + LTEXT "Чтобы изменить имя компьютера или домена нажмите ""Изменить"".", IDC_STATIC, 6, 149, 170, 17 + PUSHBUTTON "И&зменить...",IDC_NETWORK_PROPERTY, 180, 149, 72, 15 + LTEXT "Примечание: Только администраторы могут изменять эти параметры.", IDC_STATIC, 6, 179, 245, 9 END IDD_PROPPAGECOMPNAMECHENGE DIALOGEX 0, 0, 232, 222 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUPWINDOW | WS_CAPTION -CAPTION " " +CAPTION "Изменение имени компьютера" FONT 8, "MS Shell Dlg" BEGIN LTEXT "(message goes here)", 1017, 7, 5, 218, 30 - LTEXT "& :", -1, 7, 41, 219, 8 + LTEXT "&Имя компьютера:", -1, 7, 41, 219, 8 EDITTEXT 1002, 7, 53, 218, 14, ES_AUTOHSCROLL | ES_OEMCONVERT - LTEXT " :", 1016, 7, 72, 218, 10 + LTEXT "Полное имя компьютера:", 1016, 7, 72, 218, 10 EDITTEXT 1001, 7, 82, 219, 14, ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP - PUSHBUTTON "&...", 1003, 150, 102, 75, 14 - GROUPBOX " ", 1018, 7, 119, 219, 73 - AUTORADIOBUTTON "&:", 1008, 17, 132, 192, 10, WS_GROUP - AUTORADIOBUTTON " &:", 1004, 17, 161, 191, 10 + PUSHBUTTON "&Дополнительно...", 1003, 150, 102, 75, 14 + GROUPBOX "Является членом", 1018, 7, 119, 219, 73 + AUTORADIOBUTTON "до&мена:", 1008, 17, 132, 192, 10, WS_GROUP + AUTORADIOBUTTON "рабочей &группы:", 1004, 17, 161, 191, 10 EDITTEXT 116, 28, 144, 181, 14, ES_AUTOHSCROLL | WS_GROUP - PUSHBUTTON "& ", 1010, 7, 203, 109, 14, NOT WS_VISIBLE | WS_DISABLED + PUSHBUTTON "&Поиск домена", 1010, 7, 203, 109, 14, NOT WS_VISIBLE | WS_DISABLED EDITTEXT 1007, 28, 172, 181, 14, ES_UPPERCASE | ES_AUTOHSCROLL | ES_OEMCONVERT DEFPUSHBUTTON "OK", 1, 121, 203, 50, 14, WS_GROUP - PUSHBUTTON "", 2, 176, 203, 50, 14 + PUSHBUTTON "Отмена", 2, 176, 203, 50, 14 END IDD_PROPPAGEDNSANDNETBIOS DIALOGEX 0, 0, 266, 125 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUPWINDOW | WS_CAPTION -CAPTION "DNS- NetBIOS- " +CAPTION "DNS-суффикс и NetBIOS-имя компьютера" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "& DNS- :", -1, 7, 5, 253, 8 + LTEXT "&Основной DNS-суффикс этого компьютера:", -1, 7, 5, 253, 8 EDITTEXT 1011, 7, 17, 252, 14, ES_AUTOHSCROLL - AUTOCHECKBOX "& DNS- ", 115, 11, 39, 250, 10 - LTEXT "NetBIOS- &:", -1, 7, 57, 148, 8 + AUTOCHECKBOX "&Сменить основной DNS-суффикс при смене членства в домене", 115, 11, 39, 250, 10 + LTEXT "NetBIOS-имя &компьютера:", -1, 7, 57, 148, 8 EDITTEXT 1013, 7, 69, 150, 14, ES_UPPERCASE | ES_AUTOHSCROLL | ES_READONLY DEFPUSHBUTTON "OK", 1, 153, 104, 50, 14 - PUSHBUTTON "", 2, 209, 104, 50, 14 - LTEXT " .", 13, 7, 86, 253, 17 + PUSHBUTTON "Отмена", 2, 209, 104, 50, 14 + LTEXT "Это имя используется для взаимодействия со старыми компьютерами и службами.", 13, 7, 86, 253, 17 END STRINGTABLE BEGIN - 1 "* *" + 1 "* нет данных *" 2 "WORKGROUP" - 3 " :" - 4 " " - 5 " :" - 6 ":" - 22 " %1." - 23 " %1." - 24 " , ." - 25 " . ." - 1021 ": ." - 1022 ": , :" + 3 "При попытке чтения данных о членстве в домене произошла следующая ошибка:" + 4 "Изменение имени компьютера" + 5 "Рабочая группа:" + 6 "Домен:" + 22 "Добро пожаловать в рабочую группу %1." + 23 "Добро пожаловать в домен %1." + 24 "Необходимо перезапустить компьютер для того, чтобы эти изменения вступили в силу." + 25 "Можно изменить имя и принадлежность этого компьютера. Изменения могут повлиять на доступ к сетевым ресурсам." + 1021 "Примечание: только администраторы могут изменить идентификацию этого компьютера." + 1022 "Примечание: идентификация этого компьютера не может быть изменена, потому что:" 1030 "The new computer name ""%s"" contains characters which are not allowed. Characters which are not allowed include ` ~ ! @ # $ %% ^ & * ( ) = + _ [ ] { } \\ | ; : ' "" , . < > / and ?" - 3210 "& >>" - 3220 "<< &" - 4000 "" - 4001 " !" + 3210 "&Подробно >>" + 3220 "<< &Подробно" + 4000 "Информация" + 4001 "Не удалось установить новое имя компьютера!" END diff --git a/dll/win32/netid/lang/uk-UA.rc b/dll/win32/netid/lang/uk-UA.rc index 72dbe3a7465..349ac311397 100644 --- a/dll/win32/netid/lang/uk-UA.rc +++ b/dll/win32/netid/lang/uk-UA.rc @@ -10,77 +10,77 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT IDD_PROPPAGECOMPUTER DIALOGEX 0, 0, 256, 218 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "' '" +CAPTION "Ім'я комп'ютера" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN ICON IDI_COMPNAME, IDC_STATIC, 4, 3, 26, 24, SS_ICON - LTEXT "ReactOS ' .", IDC_STATIC, 40, 5, 204, 20 - LTEXT ":", IDC_STATIC, 6, 40, 70, 9 + LTEXT "ReactOS використовує наступну інформацію для ідентифікації комп'ютера в мережі.", IDC_STATIC, 40, 5, 204, 20 + LTEXT "Опис:", IDC_STATIC, 6, 40, 70, 9 EDITTEXT IDC_COMPDESC, 98, 38, 146, 13, WS_CHILD | WS_VISIBLE | WS_TABSTOP - LTEXT " ':", IDC_STATIC, 6, 68, 64, 9 + LTEXT "Повне ім'я:", IDC_STATIC, 6, 68, 64, 9 EDITTEXT IDC_COMPUTERNAME, 98, 68, 144, 12, ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP - LTEXT " :", IDC_WORKGROUPDOMAIN, 6, 84, 64, 9 + LTEXT "Робоча група:", IDC_WORKGROUPDOMAIN, 6, 84, 64, 9 EDITTEXT IDC_WORKGROUPDOMAIN_NAME, 98, 84, 144, 12, ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP - LTEXT " , """".", IDC_STATIC, 6, 108, 172, 32 - PUSHBUTTON "&...", IDC_NETWORK_ID, 190, 114, 60, 15 - LTEXT " ' , """".", IDC_STATIC, 6, 149, 170, 17 - PUSHBUTTON "&...",IDC_NETWORK_PROPERTY, 190, 149, 60, 15 - LTEXT ": ' .", IDC_STATIC, 6, 179, 230, 18 + LTEXT "Щоб запустити майстер мережної ідентифікації для приєднання до домену та створення облікового запису локального користувача, натисніть кнопку ""Ідентифікація"".", IDC_STATIC, 6, 108, 172, 32 + PUSHBUTTON "Іденти&фікація...", IDC_NETWORK_ID, 190, 114, 60, 15 + LTEXT "Щоб перейменувати цей комп'ютер або приєднати його до домену, натисніть кнопку ""Змінити"".", IDC_STATIC, 6, 149, 170, 17 + PUSHBUTTON "&Змінити...",IDC_NETWORK_PROPERTY, 190, 149, 60, 15 + LTEXT "Примітка: змінити ідентифікацію цього комп'ютера можуть лише адміністратори.", IDC_STATIC, 6, 179, 230, 18 END IDD_PROPPAGECOMPNAMECHENGE DIALOGEX 0, 0, 232, 222 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUPWINDOW | WS_CAPTION -CAPTION " '" +CAPTION "Зміна імені комп'ютера" FONT 8, "MS Shell Dlg" BEGIN LTEXT "(message goes here)", 1017, 7, 5, 218, 30 - LTEXT "&' ':", -1, 7, 41, 219, 8 + LTEXT "&Ім'я комп'ютера:", -1, 7, 41, 219, 8 EDITTEXT 1002, 7, 53, 218, 14, ES_AUTOHSCROLL | ES_OEMCONVERT - LTEXT " ' ':", 1016, 7, 72, 218, 10 + LTEXT "Повне ім'я комп'ютера:", 1016, 7, 72, 218, 10 EDITTEXT 1001, 7, 82, 219, 14, ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP - PUSHBUTTON "&...", 1003, 150, 102, 75, 14 - GROUPBOX " ", 1018, 7, 119, 219, 73 - AUTORADIOBUTTON "&:", 1008, 17, 132, 192, 10, WS_GROUP - AUTORADIOBUTTON " &:", 1004, 17, 161, 191, 10 + PUSHBUTTON "&Додатково...", 1003, 150, 102, 75, 14 + GROUPBOX "Є членом", 1018, 7, 119, 219, 73 + AUTORADIOBUTTON "до&мену:", 1008, 17, 132, 192, 10, WS_GROUP + AUTORADIOBUTTON "робочої &групи:", 1004, 17, 161, 191, 10 EDITTEXT 116, 28, 144, 181, 14, ES_AUTOHSCROLL | WS_GROUP - PUSHBUTTON "& ", 1010, 7, 203, 109, 14, NOT WS_VISIBLE | WS_DISABLED + PUSHBUTTON "&Пошук домену", 1010, 7, 203, 109, 14, NOT WS_VISIBLE | WS_DISABLED EDITTEXT 1007, 28, 172, 181, 14, ES_UPPERCASE | ES_AUTOHSCROLL | ES_OEMCONVERT DEFPUSHBUTTON "OK", 1, 121, 203, 50, 14, WS_GROUP - PUSHBUTTON "", 2, 176, 203, 50, 14 + PUSHBUTTON "Скасувати", 2, 176, 203, 50, 14 END IDD_PROPPAGEDNSANDNETBIOS DIALOGEX 0, 0, 266, 125 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUPWINDOW | WS_CAPTION -CAPTION "DNS- NetBIOS-' '" +CAPTION "DNS-суфікс і NetBIOS-ім'я комп'ютера" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "& DNS- ':", -1, 7, 5, 253, 8 + LTEXT "&Основний DNS-суфікс цього комп'ютера:", -1, 7, 5, 253, 8 EDITTEXT 1011, 7, 17, 252, 14, ES_AUTOHSCROLL - AUTOCHECKBOX " & DNS-, ", 115, 11, 39, 250, 10 - LTEXT "NetBIOS-' &':", -1, 7, 57, 148, 8 + AUTOCHECKBOX "Змінювати о&сновний DNS-суфікс, коли змінюється членство в домені", 115, 11, 39, 250, 10 + LTEXT "NetBIOS-ім'я &комп'ютера:", -1, 7, 57, 148, 8 EDITTEXT 1013, 7, 69, 150, 14, ES_UPPERCASE | ES_AUTOHSCROLL | ES_READONLY DEFPUSHBUTTON "OK", 1, 153, 104, 50, 14 - PUSHBUTTON "", 2, 209, 104, 50, 14 - LTEXT " ' 䳿 ' .", 13, 7, 88, 253, 16 + PUSHBUTTON "Скасувати", 2, 209, 104, 50, 14 + LTEXT "Це ім'я використовується для можливості взаємодії зі старими комп'ютерами та службами.", 13, 7, 88, 253, 16 END STRINGTABLE BEGIN - 1 "* *" + 1 "* немає даних *" 2 "WORKGROUP" - 3 " :" - 4 " '" - 5 " :" - 6 ":" - 22 " %1." - 23 " %1." - 24 " ', ." - 25 " ' '. ." - 1021 ": ' ." - 1022 ": ' , :" - 1030 " ' ' ""%s"" . ` ~ ! @ # $ %% ^ & * ( ) = + _ [ ] { } \\ | ; : ' "" , . < > / ?" - 3210 "& >>" - 3220 "<< &" - 4000 "" - 4001 " ' '!" + 3 "При спробі прочитати дані про членство в домені сталася така помилка:" + 4 "Зміна імені комп'ютера" + 5 "Робоча група:" + 6 "Домен:" + 22 "Вас вітає робоча група %1." + 23 "Вас вітає домен %1." + 24 "Слід перезапустити комп'ютер, щоб ці зміни набрали сили." + 25 "Можна знінити ім'я і членство цього комп'ютера. Зміни можуть вплинути на доступ до мережних ресурсів." + 1021 "Примітка: змінити ідентифікацію цього комп'ютера можуть лише адміністратори." + 1022 "Примітка: змінити ідентифікацію цього комп'ютера неможливо, оскільки:" + 1030 "Нове ім'я комп'ютера ""%s"" містить недопустимі символи. До недопустимих символів належать ` ~ ! @ # $ %% ^ & * ( ) = + _ [ ] { } \\ | ; : ' "" , . < > / та ?" + 3210 "&Подробиці >>" + 3220 "<< &Подробиці" + 4000 "Інформація" + 4001 "Не вдалось встановити нове ім'я комп'ютера!" END diff --git a/dll/win32/netid/rsrc.rc b/dll/win32/netid/rsrc.rc index 0d8989e0327..dfd11fa8955 100644 --- a/dll/win32/netid/rsrc.rc +++ b/dll/win32/netid/rsrc.rc @@ -13,7 +13,10 @@ #include "lang/it-IT.rc" #include "lang/nl-NL.rc" #include "lang/no-NO.rc" +#include "lang/sk-SK.rc" + +// UTF-8 +#pragma code_page(65001) #include "lang/pl-PL.rc" #include "lang/ru-RU.rc" -#include "lang/sk-SK.rc" #include "lang/uk-UA.rc" diff --git a/dll/win32/netshell/CMakeLists.txt b/dll/win32/netshell/CMakeLists.txt index 5e2890505bd..9dc74cc503f 100644 --- a/dll/win32/netshell/CMakeLists.txt +++ b/dll/win32/netshell/CMakeLists.txt @@ -17,9 +17,7 @@ list(APPEND SOURCE ${CMAKE_CURRENT_BINARY_DIR}/netshell_stubs.c ${CMAKE_CURRENT_BINARY_DIR}/netshell.def) -add_library(netshell SHARED - ${CMAKE_CURRENT_BINARY_DIR}/netshell_precomp.h.gch - ${SOURCE}) +add_library(netshell SHARED ${SOURCE}) set_module_type(netshell win32dll) @@ -42,6 +40,6 @@ add_importlibs(netshell kernel32 ntdll) -add_pch(netshell ${CMAKE_CURRENT_SOURCE_DIR}/precomp.h ${SOURCE}) +add_pch(netshell precomp.h) add_cd_file(TARGET netshell DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/netshell/lang/pl-PL.rc b/dll/win32/netshell/lang/pl-PL.rc index 38ff75b21b2..23559d43c1e 100644 --- a/dll/win32/netshell/lang/pl-PL.rc +++ b/dll/win32/netshell/lang/pl-PL.rc @@ -1,49 +1,54 @@ +/* + * translated by Maciej Białas(Aug, 2008) + * UTF-8 conversion by Caemyr (May, 2011) + */ + LANGUAGE LANG_POLISH, SUBLANG_DEFAULT IDD_NETPROPERTIES DIALOGEX DISCARDABLE 0, 0, 246, 246 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION "Oglne" +CAPTION "Ogólne" FONT 8, "MS Shell Dlg" BEGIN CONTROL "", IDC_COMPONENTSLIST, "SysListView32", LVS_LIST | LVS_SHAREIMAGELISTS | WS_BORDER | WS_TABSTOP, 9, 71, 230, 55 - LTEXT "Pocz uywajc:", -1, 9,9,217,8 + LTEXT "Połącz używając:", -1, 9,9,217,8 EDITTEXT IDC_NETCARDNAME, 9, 21, 230, 12, WS_BORDER | WS_DISABLED | WS_TABSTOP PUSHBUTTON "&Konfiguruj", IDC_CONFIGURE, 189, 38, 50, 14 - LTEXT "To poczenie wykorzystuje nastpujce skadniki:", -1, 9, 59, 217, 8 + LTEXT "To połączenie wykorzystuje następujące składniki:", -1, 9, 59, 217, 8 PUSHBUTTON "&Zainstaluj", IDC_INSTALL, 9, 130, 65, 14, WS_DISABLED | WS_TABSTOP PUSHBUTTON "&Odinstaluj", IDC_UNINSTALL, 90, 130, 65, 14, WS_DISABLED | WS_TABSTOP - PUSHBUTTON "&Waciwoci", IDC_PROPERTIES, 174, 130, 65, 14 + PUSHBUTTON "&Właściwości", IDC_PROPERTIES, 174, 130, 65, 14 GROUPBOX "Opis", -1, 9, 153, 230, 46, BS_GROUPBOX - LTEXT "Tutaj pojawi si opis skadnika...", IDC_DESCRIPTION, 15, 165, 217, 28, WS_GROUP - CHECKBOX "Pokazuj ikon w obszarze powiadomie podczas poczenia", IDC_SHOWTASKBAR, 9, 206, 230, 12, BS_AUTOCHECKBOX | WS_TABSTOP - CHECKBOX "Powiadom mnie, gdy to poczenie ma ograniczon czno lub brak cznoci", IDC_NOTIFYNOCONNECTION, 9, 220, 230, 12, BS_AUTOCHECKBOX | WS_TABSTOP + LTEXT "Tutaj pojawi się opis składnika...", IDC_DESCRIPTION, 15, 165, 217, 28, WS_GROUP + CHECKBOX "Pokazuj ikonę w obszarze powiadomień podczas połączenia", IDC_SHOWTASKBAR, 9, 206, 230, 12, BS_AUTOCHECKBOX | WS_TABSTOP + CHECKBOX "Powiadom mnie, gdy to połączenie ma ograniczoną łączność lub brak łączności", IDC_NOTIFYNOCONNECTION, 9, 220, 230, 12, BS_AUTOCHECKBOX | WS_TABSTOP END IDD_STATUS DIALOGEX DISCARDABLE 0, 0, 200, 280 STYLE DS_SHELLFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Waciwoci" +CAPTION "Właściwości" FONT 8, "MS Shell Dlg" BEGIN END IDD_LAN_NETSTATUS DIALOGEX DISCARDABLE 0, 0, 200,180 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION "Oglne" +CAPTION "Ogólne" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "Poczenie", -1, 9, 8, 182, 58, BS_GROUPBOX + GROUPBOX "Połączenie", -1, 9, 8, 182, 58, BS_GROUPBOX LTEXT "Status:", -1, 19, 20, 60, 8 LTEXT "Czas trwania:", -1, 19, 34, 60, 8 - LTEXT "Szybko:", -1, 19, 48, 60, 8 - GROUPBOX "Aktywno", -1, 9, 74, 182, 70, BS_GROUPBOX - RTEXT "Wysano", -1, 26, 90, 60, 8 + LTEXT "Szybkość:", -1, 19, 48, 60, 8 + GROUPBOX "Aktywność", -1, 9, 74, 182, 70, BS_GROUPBOX + RTEXT "Wysłano", -1, 26, 90, 60, 8 ICON "", IDC_NETSTAT, 110, 85, 32, 32 LTEXT "Odebrano", -1, 149, 90, 37, 8 - LTEXT "bajtw:", -1, 17, 115, 32, 8 + LTEXT "bajtów:", -1, 17, 115, 32, 8 RTEXT "000.000.000", IDC_SEND, 63, 115, 44, 8 RTEXT "000.000.000", IDC_RECEIVED, 139, 115, 44, 8 - PUSHBUTTON "&Waciwoci", IDC_STATUS_PROPERTIES, 10, 150, 50, 14 - PUSHBUTTON "W&ycz", IDC_ENDISABLE, 66, 150, 50, 14 + PUSHBUTTON "&Właściwości", IDC_STATUS_PROPERTIES, 10, 150, 50, 14 + PUSHBUTTON "W&yłącz", IDC_ENDISABLE, 66, 150, 50, 14 RTEXT "",IDC_STATUS,83,20,98,8 RTEXT "",IDC_DURATION,83,34,98,8 RTEXT "",IDC_SPEED,83,48,98,8 @@ -51,29 +56,29 @@ END IDD_LAN_NETSTATUSADVANCED DIALOGEX DISCARDABLE 0, 0, 200,180 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Szczegy" +CAPTION "Szczegóły" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "Status poczenia", -1, 9, 8, 200, 88, BS_GROUPBOX + GROUPBOX "Status połączenia", -1, 9, 8, 200, 88, BS_GROUPBOX LTEXT "Typ adresu:", -1, 22, 20, 80, 8 LTEXT "Adres IP:", -1, 22, 34, 80, 8 LTEXT "Maska podsieci:", -1, 22, 48, 80, 8 - LTEXT "Domylna brama:", -1, 22, 62, 80, 8 + LTEXT "Brama domyślna:", -1, 22, 62, 80, 8 RTEXT "n/d", IDC_DETAILSTYPE, 122, 20, 80, 8 RTEXT "000.000.000.000", IDC_DETAILSIP, 122, 34, 80, 8 RTEXT "000.000.000.000", IDC_DETAILSSUBNET, 122, 48, 80, 8 RTEXT "", IDC_DETAILSGATEWAY, 122, 62, 80, 8 - PUSHBUTTON "&Szczegy...", IDC_DETAILS, 22, 76, 62, 14 + PUSHBUTTON "&Szczegóły...", IDC_DETAILS, 22, 76, 62, 14 END IDD_LAN_NETSTATUSDETAILS DIALOGEX DISCARDABLE 0, 0, 200,200 STYLE DS_SHELLFONT | WS_POPUP | WS_CAPTION -CAPTION "Szczegy poczenia sieciowego" +CAPTION "Szczegóły połączenia sieciowego" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "&Szczegy poczenia sieciowego:", -1, 15, 9, 170, 12 + LTEXT "&Szczegóły połączenia sieciowego:", -1, 15, 9, 170, 12 CONTROL "", IDC_DETAILS, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP, 15, 25, 170, 130 PUSHBUTTON "&Zamknij", IDC_CLOSE, 125, 165, 62, 14 END @@ -83,44 +88,44 @@ BEGIN IDS_PHYSICAL_ADDRESS "Adres fizyczny" IDS_IP_ADDRESS "Adres IP" IDS_SUBNET_MASK "Maska podsieci" - IDS_DEF_GATEWAY "Brama domylna" + IDS_DEF_GATEWAY "Brama domyślna" IDS_DHCP_SERVER "Serwer DHCP" - IDS_LEASE_OBTAINED "Dzierawa uzyskana" - IDS_LEASE_EXPIRES "Dzierawa wygasa" + IDS_LEASE_OBTAINED "Dzierżawa uzyskana" + IDS_LEASE_EXPIRES "Dzierżawa wygasa" IDS_DNS_SERVERS "Serwery DNS" IDS_WINS_SERVERS "Serwery WINS" - IDS_PROPERTY "Waciwoci" - IDS_VALUE "Warto" - IDS_NETWORKCONNECTION "Poczenie sieciowe" + IDS_PROPERTY "Właściwości" + IDS_VALUE "Wartość" + IDS_NETWORKCONNECTION "Połączenie sieciowe" IDS_SHV_COLUMN_NAME "Nazwa" IDS_SHV_COLUMN_TYPE "Typ" IDS_SHV_COLUMN_STATE "Status" - IDS_SHV_COLUMN_DEVNAME "Nazwa urzdzenia" + IDS_SHV_COLUMN_DEVNAME "Nazwa urządzenia" IDS_SHV_COLUMN_PHONE "Numer telefonu lub adres hosta" - IDS_SHV_COLUMN_OWNER "Waciciel" - IDS_TYPE_ETHERNET "Sie LAN lub szerokopasmowy Internet" - IDS_STATUS_NON_OPERATIONAL "Wyczony" - IDS_STATUS_UNREACHABLE "Niepoczony" - IDS_STATUS_DISCONNECTED "Kabel sieciowy odczony" + IDS_SHV_COLUMN_OWNER "Właściciel" + IDS_TYPE_ETHERNET "Sieć LAN lub szerokopasmowy Internet" + IDS_STATUS_NON_OPERATIONAL "Wyłączony" + IDS_STATUS_UNREACHABLE "Niepołączony" + IDS_STATUS_DISCONNECTED "Kabel sieciowy odłączony" IDS_STATUS_CONNECTING "Pobieranie adresu sieciowego" - IDS_STATUS_CONNECTED "Poczony" - IDS_STATUS_OPERATIONAL "Poczony" + IDS_STATUS_CONNECTED "Połączony" + IDS_STATUS_OPERATIONAL "Połączony" - IDS_NET_ACTIVATE "Wcz" - IDS_NET_DEACTIVATE "Wycz" + IDS_NET_ACTIVATE "Włącz" + IDS_NET_DEACTIVATE "Wyłącz" IDS_NET_STATUS "Status" IDS_NET_REPAIR "Napraw" - IDS_NET_CREATELINK "Utwrz skrt" - IDS_NET_DELETE "Usu" - IDS_NET_PROPERTIES "Waciwoci" + IDS_NET_CREATELINK "Utwórz skrót" + IDS_NET_DELETE "Usuń" + IDS_NET_PROPERTIES "Właściwości" IDS_FORMAT_BIT "%u Bit/s" IDS_FORMAT_KBIT "%u KBit/s" IDS_FORMAT_MBIT "%u MBit/s" IDS_FORMAT_GBIT "%u GBit/s" - IDS_DURATION_DAY "%d Dzie %s" + IDS_DURATION_DAY "%d Dzień %s" IDS_DURATION_DAYS "%d Dni %s" IDS_ASSIGNED_DHCP "Przydzielony przez DHCP" - IDS_ASSIGNED_MANUAL "Ustawiony rcznie" + IDS_ASSIGNED_MANUAL "Ustawiony ręcznie" END diff --git a/dll/win32/netshell/lang/ru-RU.rc b/dll/win32/netshell/lang/ru-RU.rc index 91daab64e12..f07d2d4581e 100644 --- a/dll/win32/netshell/lang/ru-RU.rc +++ b/dll/win32/netshell/lang/ru-RU.rc @@ -2,48 +2,48 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT IDD_NETPROPERTIES DIALOGEX DISCARDABLE 0, 0, 246, 246 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION "" +CAPTION "Общие" FONT 8, "MS Shell Dlg" BEGIN CONTROL "", IDC_COMPONENTSLIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP, 9, 71, 230, 55 - LTEXT " :", -1, 9, 9, 217, 8 + LTEXT "Подключение через:", -1, 9, 9, 217, 8 EDITTEXT IDC_NETCARDNAME, 9, 21, 230, 12, WS_BORDER | WS_DISABLED | WS_TABSTOP - PUSHBUTTON "&...", IDC_CONFIGURE, 174, 38, 65, 14 - LTEXT " :", -1, 9, 59, 217, 8 - PUSHBUTTON "&...", IDC_INSTALL, 9, 130, 65, 14, WS_DISABLED | WS_TABSTOP - PUSHBUTTON "&", IDC_UNINSTALL, 90, 130, 65, 14, WS_DISABLED | WS_TABSTOP - PUSHBUTTON "&", IDC_PROPERTIES, 174, 130, 65, 14 - GROUPBOX "", -1, 9, 153, 230, 46, BS_GROUPBOX - LTEXT " ...", IDC_DESCRIPTION, 15, 165, 217, 28, WS_GROUP - CHECKBOX " ", IDC_SHOWTASKBAR, 9, 206, 230, 12, BS_AUTOCHECKBOX | WS_TABSTOP - CHECKBOX " ", IDC_NOTIFYNOCONNECTION, 9, 220, 230, 12, BS_AUTOCHECKBOX | WS_TABSTOP + PUSHBUTTON "&Настроить...", IDC_CONFIGURE, 174, 38, 65, 14 + LTEXT "Отмеченые компоненты используются этим подключением:", -1, 9, 59, 217, 8 + PUSHBUTTON "&Установить...", IDC_INSTALL, 9, 130, 65, 14, WS_DISABLED | WS_TABSTOP + PUSHBUTTON "&Удалить", IDC_UNINSTALL, 90, 130, 65, 14, WS_DISABLED | WS_TABSTOP + PUSHBUTTON "&Свойства", IDC_PROPERTIES, 174, 130, 65, 14 + GROUPBOX "Описание", -1, 9, 153, 230, 46, BS_GROUPBOX + LTEXT "Свойства компонента перечислены ниже...", IDC_DESCRIPTION, 15, 165, 217, 28, WS_GROUP + CHECKBOX "Отображать значек в трее при установленом соединении", IDC_SHOWTASKBAR, 9, 206, 230, 12, BS_AUTOCHECKBOX | WS_TABSTOP + CHECKBOX "Оповещать в случае разрыва соединения", IDC_NOTIFYNOCONNECTION, 9, 220, 230, 12, BS_AUTOCHECKBOX | WS_TABSTOP END IDD_STATUS DIALOGEX DISCARDABLE 0, 0, 200, 280 STYLE DS_SHELLFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "" +CAPTION "Свойства" FONT 8, "MS Shell Dlg" BEGIN END IDD_LAN_NETSTATUS DIALOGEX DISCARDABLE 0, 0, 216, 180 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION "" +CAPTION "Общие" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "", -1, 9, 8, 198, 58, BS_GROUPBOX - LTEXT ":", -1, 19, 20, 60, 8 - LTEXT ":", -1, 19, 34, 60, 8 - LTEXT ":", -1, 19, 48, 60, 8 - GROUPBOX "", -1, 9, 74, 198, 70, BS_GROUPBOX - RTEXT "", -1, 20, 90, 60, 8 + GROUPBOX "Подключение", -1, 9, 8, 198, 58, BS_GROUPBOX + LTEXT "Состояние:", -1, 19, 20, 60, 8 + LTEXT "Длительность:", -1, 19, 34, 60, 8 + LTEXT "Скорость:", -1, 19, 48, 60, 8 + GROUPBOX "Активность", -1, 9, 74, 198, 70, BS_GROUPBOX + RTEXT "Отправлено", -1, 20, 90, 60, 8 ICON "", IDC_NETSTAT, 110, 85, 32, 32 - LTEXT "", -1, 158, 90, 37, 8 - LTEXT ":", -1, 17, 115, 32, 8 + LTEXT "Принято", -1, 158, 90, 37, 8 + LTEXT "Байт:", -1, 17, 115, 32, 8 RTEXT "000.000.000", IDC_SEND, 54, 115, 44, 8 RTEXT "000.000.000", IDC_RECEIVED, 139, 115, 46, 8 - PUSHBUTTON "&", IDC_STATUS_PROPERTIES, 10, 150, 50, 14 - PUSHBUTTON "&", IDC_ENDISABLE, 66, 150, 50, 14 + PUSHBUTTON "&Свойства", IDC_STATUS_PROPERTIES, 10, 150, 50, 14 + PUSHBUTTON "&Отключить", IDC_ENDISABLE, 66, 150, 50, 14 RTEXT "", IDC_STATUS, 100, 20, 98, 8 RTEXT "", IDC_DURATION, 100, 34, 98, 8 RTEXT "", IDC_SPEED, 100, 48, 98, 8 @@ -51,75 +51,75 @@ END IDD_LAN_NETSTATUSADVANCED DIALOGEX DISCARDABLE 0, 0, 200,180 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Поддежка" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ", -1, 9, 8, 200, 88, BS_GROUPBOX - LTEXT " :", -1, 22, 20, 80, 8 - LTEXT "IP :", -1, 22, 34, 80, 8 - LTEXT " :", -1, 22, 48, 80, 8 - LTEXT " :", -1, 22, 62, 80, 8 + GROUPBOX "Статус подключения", -1, 9, 8, 200, 88, BS_GROUPBOX + LTEXT "Тип адреса:", -1, 22, 20, 80, 8 + LTEXT "IP адрес:", -1, 22, 34, 80, 8 + LTEXT "Маска подсети:", -1, 22, 48, 80, 8 + LTEXT "Шлюз по умолчанию:", -1, 22, 62, 80, 8 - RTEXT "/", IDC_DETAILSTYPE, 122, 20, 80, 8 + RTEXT "н/а", IDC_DETAILSTYPE, 122, 20, 80, 8 RTEXT "000.000.000.000", IDC_DETAILSIP, 122, 34, 80, 8 RTEXT "000.000.000.000", IDC_DETAILSSUBNET, 122, 48, 80, 8 RTEXT "", IDC_DETAILSGATEWAY, 122, 62, 80, 8 - PUSHBUTTON "&...", IDC_DETAILS, 22, 76, 62, 14 + PUSHBUTTON "&Подробности...", IDC_DETAILS, 22, 76, 62, 14 END IDD_LAN_NETSTATUSDETAILS DIALOGEX DISCARDABLE 0, 0, 200, 172 STYLE DS_SHELLFONT | WS_POPUP | WS_CAPTION -CAPTION " " +CAPTION "Детали сетевого подключения" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "& :", -1, 5, 4, 170, 12 + LTEXT "&Дополнительные сведения о сети:", -1, 5, 4, 170, 12 CONTROL "", IDC_DETAILS, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP, 5, 17, 190, 130 - PUSHBUTTON "&", IDC_CLOSE, 132, 153, 62, 14 + PUSHBUTTON "&Закрыть", IDC_CLOSE, 132, 153, 62, 14 END STRINGTABLE DISCARDABLE BEGIN - IDS_PHYSICAL_ADDRESS " " - IDS_IP_ADDRESS "IP-" - IDS_SUBNET_MASK " " - IDS_DEF_GATEWAY " " - IDS_DHCP_SERVER "DHCP-" - IDS_LEASE_OBTAINED " " - IDS_LEASE_EXPIRES " " - IDS_DNS_SERVERS "DNS-" - IDS_WINS_SERVERS "WINS-" - IDS_PROPERTY "" - IDS_VALUE "" - IDS_NETWORKCONNECTION " " - IDS_SHV_COLUMN_NAME "" - IDS_SHV_COLUMN_TYPE "" - IDS_SHV_COLUMN_STATE "" - IDS_SHV_COLUMN_DEVNAME " " - IDS_SHV_COLUMN_PHONE " " - IDS_SHV_COLUMN_OWNER "" - IDS_TYPE_ETHERNET " " - IDS_STATUS_NON_OPERATIONAL "" - IDS_STATUS_UNREACHABLE "" - IDS_STATUS_DISCONNECTED " " - IDS_STATUS_CONNECTING " " - IDS_STATUS_CONNECTED "" - IDS_STATUS_OPERATIONAL "" + IDS_PHYSICAL_ADDRESS "Физический адрес" + IDS_IP_ADDRESS "IP-адрес" + IDS_SUBNET_MASK "Маска подсети" + IDS_DEF_GATEWAY "Основной шлюз" + IDS_DHCP_SERVER "DHCP-сервер" + IDS_LEASE_OBTAINED "Аренда получена" + IDS_LEASE_EXPIRES "Аренда истекает" + IDS_DNS_SERVERS "DNS-серверы" + IDS_WINS_SERVERS "WINS-сервер" + IDS_PROPERTY "Свойство" + IDS_VALUE "Значение" + IDS_NETWORKCONNECTION "Сетевые подключения" + IDS_SHV_COLUMN_NAME "Имя" + IDS_SHV_COLUMN_TYPE "Тип" + IDS_SHV_COLUMN_STATE "Состояние" + IDS_SHV_COLUMN_DEVNAME "Имя устройства" + IDS_SHV_COLUMN_PHONE "Номер телефона или адрес узла" + IDS_SHV_COLUMN_OWNER "Владелец" + IDS_TYPE_ETHERNET "ЛВС или высокоскоростной Интернет" + IDS_STATUS_NON_OPERATIONAL "Отключено" + IDS_STATUS_UNREACHABLE "Отключено" + IDS_STATUS_DISCONNECTED "Сетевой кабель не подключен" + IDS_STATUS_CONNECTING "Получение сетевого адреса" + IDS_STATUS_CONNECTED "Подключено" + IDS_STATUS_OPERATIONAL "Подключено" - IDS_NET_ACTIVATE "" - IDS_NET_DEACTIVATE "" - IDS_NET_STATUS "" - IDS_NET_REPAIR "" - IDS_NET_CREATELINK " " - IDS_NET_DELETE "" - IDS_NET_PROPERTIES "" + IDS_NET_ACTIVATE "Включить" + IDS_NET_DEACTIVATE "Отключить" + IDS_NET_STATUS "Состояние" + IDS_NET_REPAIR "Исправить" + IDS_NET_CREATELINK "Создать ярлык" + IDS_NET_DELETE "Удалить" + IDS_NET_PROPERTIES "Свойства" - IDS_FORMAT_BIT "%u /" - IDS_FORMAT_KBIT "%u /" - IDS_FORMAT_MBIT "%u /" - IDS_FORMAT_GBIT "%u /" - IDS_DURATION_DAY "%d %s" - IDS_DURATION_DAYS "%d %s" - IDS_ASSIGNED_DHCP " DHCP" - IDS_ASSIGNED_MANUAL " " + IDS_FORMAT_BIT "%u бит/с" + IDS_FORMAT_KBIT "%u Кбит/с" + IDS_FORMAT_MBIT "%u Мбит/с" + IDS_FORMAT_GBIT "%u Гбит/с" + IDS_DURATION_DAY "%d день %s" + IDS_DURATION_DAYS "%d дней %s" + IDS_ASSIGNED_DHCP "Присвоен DHCP" + IDS_ASSIGNED_MANUAL "Настроен вручную" END diff --git a/dll/win32/netshell/lang/uk-UA.rc b/dll/win32/netshell/lang/uk-UA.rc index b47da206b09..4e6148fca9f 100644 --- a/dll/win32/netshell/lang/uk-UA.rc +++ b/dll/win32/netshell/lang/uk-UA.rc @@ -10,48 +10,48 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT IDD_NETPROPERTIES DIALOGEX DISCARDABLE 0, 0, 246, 246 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION "" +CAPTION "Загальні" FONT 8, "MS Shell Dlg" BEGIN CONTROL "", IDC_COMPONENTSLIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP, 9, 71, 230, 55 - LTEXT "ϳ :", -1, 9,9,217,8 + LTEXT "Підключення через:", -1, 9,9,217,8 EDITTEXT IDC_NETCARDNAME, 9, 21, 230, 12, WS_BORDER | WS_DISABLED | WS_TABSTOP - PUSHBUTTON "&", IDC_CONFIGURE, 189, 38, 50, 14 - LTEXT "³ :", -1, 9, 59, 217, 8 - PUSHBUTTON "&", IDC_INSTALL, 9, 130, 65, 14, WS_DISABLED | WS_TABSTOP - PUSHBUTTON "&", IDC_UNINSTALL, 90, 130, 65, 14, WS_DISABLED | WS_TABSTOP - PUSHBUTTON "&", IDC_PROPERTIES, 174, 130, 65, 14 - GROUPBOX "", -1, 9, 153, 230, 46, BS_GROUPBOX - LTEXT " ...", IDC_DESCRIPTION, 15, 165, 217, 28, WS_GROUP - CHECKBOX " ", IDC_SHOWTASKBAR, 9, 206, 230, 12, BS_AUTOCHECKBOX | WS_TABSTOP - CHECKBOX " , ", IDC_NOTIFYNOCONNECTION, 9, 220, 230, 12, BS_AUTOCHECKBOX | WS_TABSTOP + PUSHBUTTON "&Налаштувати", IDC_CONFIGURE, 189, 38, 50, 14 + LTEXT "Відмічені компоненти використовуються цим підключенням:", -1, 9, 59, 217, 8 + PUSHBUTTON "Вст&ановити", IDC_INSTALL, 9, 130, 65, 14, WS_DISABLED | WS_TABSTOP + PUSHBUTTON "В&идалити", IDC_UNINSTALL, 90, 130, 65, 14, WS_DISABLED | WS_TABSTOP + PUSHBUTTON "&Властивості", IDC_PROPERTIES, 174, 130, 65, 14 + GROUPBOX "Опис", -1, 9, 153, 230, 46, BS_GROUPBOX + LTEXT "Опис компонентів...", IDC_DESCRIPTION, 15, 165, 217, 28, WS_GROUP + CHECKBOX "Вивести значок підключення на панель завдань", IDC_SHOWTASKBAR, 9, 206, 230, 12, BS_AUTOCHECKBOX | WS_TABSTOP + CHECKBOX "Сповіщати мене, якщо це підключення обмежене чи відсутнє", IDC_NOTIFYNOCONNECTION, 9, 220, 230, 12, BS_AUTOCHECKBOX | WS_TABSTOP END IDD_STATUS DIALOGEX DISCARDABLE 0, 0, 200, 280 STYLE DS_SHELLFONT | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "" +CAPTION "Загальні" FONT 8, "MS Shell Dlg" BEGIN END IDD_LAN_NETSTATUS DIALOGEX DISCARDABLE 0, 0, 200,180 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION "" +CAPTION "Загальні" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "ϳ", -1, 9, 8, 182, 58, BS_GROUPBOX - LTEXT ":", -1, 19, 20, 60, 8 - LTEXT ":", -1, 19, 34, 60, 8 - LTEXT ":", -1, 19, 48, 60, 8 - GROUPBOX "", -1, 9, 74, 182, 70, BS_GROUPBOX - RTEXT "", -1, 26, 90, 60, 8 + GROUPBOX "Підключення", -1, 9, 8, 182, 58, BS_GROUPBOX + LTEXT "Стан:", -1, 19, 20, 60, 8 + LTEXT "Тривалість:", -1, 19, 34, 60, 8 + LTEXT "Швидкість:", -1, 19, 48, 60, 8 + GROUPBOX "Активність", -1, 9, 74, 182, 70, BS_GROUPBOX + RTEXT "Надіслано", -1, 26, 90, 60, 8 ICON "", IDC_NETSTAT, 110, 85, 32, 32 - LTEXT "", -1, 149, 90, 37, 8 - LTEXT ":", -1, 17, 115, 32, 8 + LTEXT "Отримано", -1, 149, 90, 37, 8 + LTEXT "Байтів:", -1, 17, 115, 32, 8 RTEXT "000.000.000", IDC_SEND, 63, 115, 44, 8 RTEXT "000.000.000", IDC_RECEIVED, 139, 115, 44, 8 - PUSHBUTTON "&", IDC_STATUS_PROPERTIES, 10, 150, 50, 14 - PUSHBUTTON "&", IDC_ENDISABLE, 66, 150, 50, 14 + PUSHBUTTON "Влас&тивості", IDC_STATUS_PROPERTIES, 10, 150, 50, 14 + PUSHBUTTON "Ви&мкнути", IDC_ENDISABLE, 66, 150, 50, 14 RTEXT "",IDC_STATUS,83,20,98,8 RTEXT "",IDC_DURATION,83,34,98,8 RTEXT "",IDC_SPEED,83,48,98,8 @@ -59,76 +59,76 @@ END IDD_LAN_NETSTATUSADVANCED DIALOGEX DISCARDABLE 0, 0, 200,180 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "ϳ" +CAPTION "Підтримка" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ", -1, 9, 8, 189, 88, BS_GROUPBOX - LTEXT " :", -1, 22, 20, 80, 8 - LTEXT "IP-:", -1, 22, 34, 80, 8 - LTEXT " :", -1, 22, 48, 80, 8 - LTEXT " :", -1, 22, 62, 80, 8 + GROUPBOX "Стан підключення", -1, 9, 8, 189, 88, BS_GROUPBOX + LTEXT "Тип адреси:", -1, 22, 20, 80, 8 + LTEXT "IP-адреса:", -1, 22, 34, 80, 8 + LTEXT "Маска підмережі:", -1, 22, 48, 80, 8 + LTEXT "Основний шлюз:", -1, 22, 62, 80, 8 RTEXT "N/A", IDC_DETAILSTYPE, 115, 20, 80, 8 RTEXT "000.000.000.000", IDC_DETAILSIP, 115, 34, 80, 8 RTEXT "000.000.000.000", IDC_DETAILSSUBNET, 115, 48, 80, 8 RTEXT "", IDC_DETAILSGATEWAY, 115, 62, 80, 8 - PUSHBUTTON "&...", IDC_DETAILS, 22, 76, 62, 14 + PUSHBUTTON "&Склад...", IDC_DETAILS, 22, 76, 62, 14 END IDD_LAN_NETSTATUSDETAILS DIALOGEX DISCARDABLE 0, 0, 200,200 STYLE DS_SHELLFONT | WS_POPUP | WS_CAPTION -CAPTION "³ " +CAPTION "Відомості про мережне підключення" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "&³ :", -1, 15, 9, 170, 12 + LTEXT "&Відомості про мережне підключення:", -1, 15, 9, 170, 12 CONTROL "", IDC_DETAILS, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP, 15, 25, 170, 130 - PUSHBUTTON "&", IDC_CLOSE, 125, 165, 62, 14 + PUSHBUTTON "&Закрити", IDC_CLOSE, 125, 165, 62, 14 END STRINGTABLE DISCARDABLE BEGIN - IDS_PHYSICAL_ADDRESS "Գ " - IDS_IP_ADDRESS "IP-" - IDS_SUBNET_MASK " " - IDS_DEF_GATEWAY " " - IDS_DHCP_SERVER "DHCP-" - IDS_LEASE_OBTAINED " " - IDS_LEASE_EXPIRES " " - IDS_DNS_SERVERS "DNS-" - IDS_WINS_SERVERS "WINS-" - IDS_PROPERTY "" - IDS_VALUE "" - IDS_NETWORKCONNECTION " " - IDS_SHV_COLUMN_NAME "'" - IDS_SHV_COLUMN_TYPE "" - IDS_SHV_COLUMN_STATE "" - IDS_SHV_COLUMN_DEVNAME "' " - IDS_SHV_COLUMN_PHONE " " - IDS_SHV_COLUMN_OWNER "" - IDS_TYPE_ETHERNET " " - IDS_STATUS_NON_OPERATIONAL "" - IDS_STATUS_UNREACHABLE " " - IDS_STATUS_DISCONNECTED " " - IDS_STATUS_CONNECTING " " - IDS_STATUS_CONNECTED "ϳ" - IDS_STATUS_OPERATIONAL "ϳ" + IDS_PHYSICAL_ADDRESS "Фізична адреса" + IDS_IP_ADDRESS "IP-адреса" + IDS_SUBNET_MASK "Маска підмережі" + IDS_DEF_GATEWAY "Основний шлюз" + IDS_DHCP_SERVER "DHCP-сервер" + IDS_LEASE_OBTAINED "Оренду отримано" + IDS_LEASE_EXPIRES "Оренда закінчується" + IDS_DNS_SERVERS "DNS-сервери" + IDS_WINS_SERVERS "WINS-сервери" + IDS_PROPERTY "Властивість" + IDS_VALUE "Значення" + IDS_NETWORKCONNECTION "Мережне підключення" + IDS_SHV_COLUMN_NAME "Ім'я" + IDS_SHV_COLUMN_TYPE "Тип" + IDS_SHV_COLUMN_STATE "Стан" + IDS_SHV_COLUMN_DEVNAME "Ім'я пристрою" + IDS_SHV_COLUMN_PHONE "Номер телефону або адреса вузла" + IDS_SHV_COLUMN_OWNER "Власник" + IDS_TYPE_ETHERNET "ЛОМ або високошвидкісний Інтернет" + IDS_STATUS_NON_OPERATIONAL "Вимкнуто" + IDS_STATUS_UNREACHABLE "Не підключено" + IDS_STATUS_DISCONNECTED "Мережний кабель не підключено" + IDS_STATUS_CONNECTING "Отримання мережної адреси" + IDS_STATUS_CONNECTED "Підключено" + IDS_STATUS_OPERATIONAL "Підключено" - IDS_NET_ACTIVATE "" - IDS_NET_DEACTIVATE "" - IDS_NET_STATUS "" - IDS_NET_REPAIR "" - IDS_NET_CREATELINK " " - IDS_NET_DELETE "" - IDS_NET_PROPERTIES "" + IDS_NET_ACTIVATE "Увімкнути" + IDS_NET_DEACTIVATE "Вимкнути" + IDS_NET_STATUS "Стан" + IDS_NET_REPAIR "Виправити" + IDS_NET_CREATELINK "Створити ярлик" + IDS_NET_DELETE "Видалити" + IDS_NET_PROPERTIES "Властивості" - IDS_FORMAT_BIT "%u /" - IDS_FORMAT_KBIT "%u /" - IDS_FORMAT_MBIT "%u /" - IDS_FORMAT_GBIT "%u /" - IDS_DURATION_DAY "%d %s" - IDS_DURATION_DAYS "%d %s" - IDS_ASSIGNED_DHCP " DHCP" - IDS_ASSIGNED_MANUAL " " + IDS_FORMAT_BIT "%u біт/с" + IDS_FORMAT_KBIT "%u Кбіт/с" + IDS_FORMAT_MBIT "%u Мбіт/с" + IDS_FORMAT_GBIT "%u Гбіт/с" + IDS_DURATION_DAY "%d День %s" + IDS_DURATION_DAYS "%d Днів %s" + IDS_ASSIGNED_DHCP "Надано DHCP" + IDS_ASSIGNED_MANUAL "Налаштовано вручну" END diff --git a/dll/win32/netshell/lanstatusui.c b/dll/win32/netshell/lanstatusui.c index 1292ef1a843..2a5dd9bb089 100644 --- a/dll/win32/netshell/lanstatusui.c +++ b/dll/win32/netshell/lanstatusui.c @@ -252,6 +252,9 @@ UpdateLanStatus(HWND hwndDlg, LANSTATUSUI_CONTEXT * pContext) Shell_NotifyIconW(NIM_MODIFY, &nid); + if (nid.uFlags & NIF_ICON) + DestroyIcon(nid.hIcon); + pContext->dwInOctets = IfEntry.dwInOctets; pContext->dwOutOctets = IfEntry.dwOutOctets; @@ -1002,7 +1005,7 @@ InitializeNetTaskbarNotifications( ZeroMemory(&nid, sizeof(nid)); nid.cbSize = sizeof(nid); nid.uID = Index++; - nid.uFlags = NIF_ICON | NIF_MESSAGE; + nid.uFlags = NIF_MESSAGE; nid.u.uVersion = 3; nid.uCallbackMessage = WM_SHOWSTATUSDLG; nid.hWnd = hwndDlg; @@ -1022,6 +1025,8 @@ InitializeNetTaskbarNotifications( else if (pProps->Status == NCS_CONNECTED) nid.hIcon = LoadIcon(netshell_hInstance, MAKEINTRESOURCE(IDI_NET_IDLE)); + if (nid.hIcon) + nid.uFlags |= NIF_ICON; wcscpy(nid.szTip, pProps->pszwName); nid.uFlags |= NIF_TIP; @@ -1043,6 +1048,9 @@ InitializeNetTaskbarNotifications( { CoTaskMemFree(pItem); } + + if (nid.uFlags & NIF_ICON) + DestroyIcon(nid.hIcon); } } }while(hr == S_OK); diff --git a/dll/win32/netshell/netshell.c b/dll/win32/netshell/netshell.c index 119e618ab72..92d68eda6f0 100644 --- a/dll/win32/netshell/netshell.c +++ b/dll/win32/netshell/netshell.c @@ -1,6 +1,4 @@ #include "precomp.h" -#include -#include HINSTANCE netshell_hInstance; const GUID CLSID_LANConnectUI = {0x7007ACC5, 0x3202, 0x11D1, {0xAA, 0xD2, 0x00, 0x80, 0x5F, 0xC1, 0x27, 0x0E}}; diff --git a/dll/win32/netshell/netshell.rc b/dll/win32/netshell/netshell.rc index 47f67ab2301..c7baccaead4 100644 --- a/dll/win32/netshell/netshell.rc +++ b/dll/win32/netshell/netshell.rc @@ -36,10 +36,13 @@ IDI_NET_TRANSREC ICON "res/nettrrec.ico" #include "lang/ja-JP.rc" #include "lang/nl-NL.rc" #include "lang/no-NO.rc" -#include "lang/pl-PL.rc" #include "lang/ro-RO.rc" -#include "lang/ru-RU.rc" #include "lang/sk-SK.rc" #include "lang/sv-SE.rc" -#include "lang/uk-UA.rc" #include "lang/zh-CN.rc" + +// UTF-8 +#pragma code_page(65001) +#include "lang/pl-PL.rc" +#include "lang/ru-RU.rc" +#include "lang/uk-UA.rc" diff --git a/dll/win32/netshell/precomp.h b/dll/win32/netshell/precomp.h index 73a1d58ed30..d92c4479fbe 100644 --- a/dll/win32/netshell/precomp.h +++ b/dll/win32/netshell/precomp.h @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -36,7 +37,6 @@ #include #include - #include "wine/debug.h" #include "wine/unicode.h" #include "resource.h" diff --git a/dll/win32/newdev/CMakeLists.txt b/dll/win32/newdev/CMakeLists.txt index d8c112f149d..921daa462fb 100644 --- a/dll/win32/newdev/CMakeLists.txt +++ b/dll/win32/newdev/CMakeLists.txt @@ -12,12 +12,9 @@ list(APPEND SOURCE ${CMAKE_CURRENT_BINARY_DIR}/newdev.def) add_library(newdev SHARED ${SOURCE}) - set_module_type(newdev win32dll) - target_link_libraries(newdev wine) - add_importlibs(newdev gdi32 comctl32 setupapi advapi32 user32 shell32 msvcrt kernel32 ntdll) - +add_pch(newdev newdev_private.h) add_cd_file(TARGET newdev DESTINATION reactos/system32 FOR all) add_importlib_target(newdev.spec) diff --git a/dll/win32/newdev/lang/pl-PL.rc b/dll/win32/newdev/lang/pl-PL.rc index 6a56e9928c2..7fe93169cef 100644 --- a/dll/win32/newdev/lang/pl-PL.rc +++ b/dll/win32/newdev/lang/pl-PL.rc @@ -1,8 +1,9 @@ /* - * translated by TestamenT - * testament@users.sourceforge.net - * https://sourceforge.net/projects/reactospl - * corrected by Caemyr - Olaf Siejka + * translated by TestamenT + * testament@users.sourceforge.net + * https://sourceforge.net/projects/reactospl + * corrected by Caemyr - Olaf Siejka (May, 2007; Jan, 2008) + * UTF-8 conversion by Caemyr (May, 2011) */ LANGUAGE LANG_POLISH, SUBLANG_DEFAULT @@ -10,107 +11,106 @@ LANGUAGE LANG_POLISH, SUBLANG_DEFAULT IDD_WELCOMEPAGE DIALOGEX DISCARDABLE 0, 0, 317, 193 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "Instalacja urzdzenia" +CAPTION "Instalacja urządzenia" FONT 8, "MS Shell Dlg" BEGIN LTEXT "Witamy",IDC_WELCOMETITLE,120,8,195,24 - LTEXT "Ten kreator zainstaluje nowe sterowniki dla urzdzenia:", + LTEXT "Ten kreator zainstaluje nowe sterowniki dla urządzenia:", IDC_STATIC,120,21,195,16 - LTEXT "Nacinij Dalej, aby kontynuowa.",IDC_STATIC,120,169,195,17 - LTEXT "NIEZNANE URZDZENIE",IDC_DEVICE,134,36,164,11 - LTEXT "UWAGA! NIEODPOWIEDNI STEROWNIK MOE ZDESTABILIZOWA LUB NAWET ZAWIESI SYSTEM!",IDC_STATIC,120,59,195,16 + LTEXT "Naciśnij Dalej, aby kontynuować.",IDC_STATIC,120,169,195,17 + LTEXT "NIEZNANE URZĄDZENIE",IDC_DEVICE,134,36,164,11 + LTEXT "UWAGA! NIEODPOWIEDNI STEROWNIK MOŻE ZDESTABILIZOWAĆ LUB NAWET ZAWIESIĆ SYSTEM!",IDC_STATIC,120,59,195,16 CONTROL "Zainstaluj sterownik automatycznie",IDC_RADIO_AUTO,"Button", BS_AUTORADIOBUTTON,120,112,178,13 - CONTROL "Zainstaluj sterownik z okrelonej lokalizacji",IDC_RADIO_MANUAL, + CONTROL "Zainstaluj sterownik z określonej lokalizacji",IDC_RADIO_MANUAL, "Button",BS_AUTORADIOBUTTON,120,133,164,14 END IDD_NODRIVER DIALOGEX DISCARDABLE 0, 0, 317, 193 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "Instalacja urzdzenia" +CAPTION "Instalacja urządzenia" FONT 8, "MS Shell Dlg" BEGIN LTEXT "Instalacja nieudana",IDC_FINISHTITLE,120,8,195,24 - LTEXT "Instalacja zakoczona niepowodzeniem, sterownik dla tego urzdzenia nie zosta znaleziony.", + LTEXT "Instalacja zakończona niepowodzeniem, sterownik dla tego urządzenia nie został znaleziony.", IDC_STATIC,120,40,195,19 - LTEXT "Nacinij Wstecz, jeeli chcesz poda ciek do sterownika.", + LTEXT "Naciśnij Wstecz, jeżeli chcesz podać ścieżkę do sterownika.", IDC_STATIC,120,98,181,24 - CONTROL "Nie pokazuj wicej tej wiadomoci",IDC_DONOTSHOWDLG,"Button", + CONTROL "Nie pokazuj więcej tej wiadomości",IDC_DONOTSHOWDLG,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,120,170,180,11 END IDD_INSTALLFAILED DIALOGEX DISCARDABLE 0, 0, 317, 193 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "Instalacja urzdzenia" +CAPTION "Instalacja urządzenia" FONT 8, "MS Shell Dlg" BEGIN LTEXT "Instalacja nieudana",IDC_FINISHTITLE,120,8,195,24 - LTEXT "Instalacja zakoczona niepowodzeniem, z powodu wystpienia nieoczekiwanego bdu.", + LTEXT "Instalacja zakończona niepowodzeniem, z powodu wystąpienia nieoczekiwanego błędu.", IDC_STATIC,120,40,195,19 - LTEXT "NIEZNANE URZDZENIE",IDC_DEVICE,134,55,164,11 + LTEXT "NIEZNANE URZĄDZENIE",IDC_DEVICE,134,55,164,11 END IDD_CHSOURCE DIALOGEX DISCARDABLE 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "Instalacja urzdzenia" +CAPTION "Instalacja urządzenia" FONT 8, "MS Shell Dlg" BEGIN CONTROL "Szukanie w wybranej lokalizacji",IDC_RADIO_SEARCHHERE,"Button", BS_AUTORADIOBUTTON,27,11,239,13 - CONTROL "Wybierz sterownik rcznie",IDC_RADIO_CHOOSE,"Button", + CONTROL "Wybierz sterownik ręcznie",IDC_RADIO_CHOOSE,"Button", BS_AUTORADIOBUTTON,27,98,171,12 - CONTROL "Szukaj w nonikach wymiennych",IDC_CHECK_MEDIA,"Button", + CONTROL "Szukaj w nośnikach wymiennych",IDC_CHECK_MEDIA,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,47,33,163,9 - CONTROL "Uwzgldnij podan ciek",IDC_CHECK_PATH,"Button",BS_AUTOCHECKBOX | + CONTROL "Uwzględnij podaną ścieżkę",IDC_CHECK_PATH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,47,54,162,10 - PUSHBUTTON "Przegldaj",IDC_BROWSE,248,69,50,14 + PUSHBUTTON "Przeglądaj",IDC_BROWSE,248,69,50,14 COMBOBOX IDC_COMBO_PATH,61,71,176,12,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP | CBS_AUTOHSCROLL END IDD_SEARCHDRV DIALOGEX DISCARDABLE 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "Instalacja urzdzenia" +CAPTION "Instalacja urządzenia" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "NIEZNANE URZDZENIE",IDC_DEVICE,51,20,169,16 + LTEXT "NIEZNANE URZĄDZENIE",IDC_DEVICE,51,20,169,16 END IDD_INSTALLDRV DIALOGEX DISCARDABLE 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "Instalacja urzdzenia" +CAPTION "Instalacja urządzenia" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "NIEZNANE URZDZENIE",IDC_DEVICE,51,20,169,16 + LTEXT "NIEZNANE URZĄDZENIE",IDC_DEVICE,51,20,169,16 END IDD_NEEDREBOOT DIALOGEX DISCARDABLE 0, 0, 317, 193 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "Instalacja urzdzenia" +CAPTION "Instalacja urządzenia" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Instalacja zakoczona",IDC_FINISHTITLE,120,8,195,11 - LTEXT "Naley zrestartowa komputer, zakaczanie instalacji:", + LTEXT "Instalacja zakończona",IDC_FINISHTITLE,120,8,195,11 + LTEXT "Należy zrestartować komputer, zakańczanie instalacji:", IDC_STATIC,120,32,195,19 - LTEXT "Nacinij Zakocz, aby zamkn kreator.",IDC_STATIC,120,174, + LTEXT "Naciśnij Zakończ, aby zamknąć kreator.",IDC_STATIC,120,174, 179,11 - LTEXT "NIEZNANE URZDZENIE",IDC_DEVICE,148,53,147,12 + LTEXT "NIEZNANE URZĄDZENIE",IDC_DEVICE,148,53,147,12 END IDD_FINISHPAGE DIALOGEX DISCARDABLE 0, 0, 317, 193 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "Instalacja urzdzenia" +CAPTION "Instalacja urządzenia" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Instalacja zakoczona",IDC_FINISHTITLE,120,8,195,11 - LTEXT "Kreator zakoczy instalacj sterownika dla:", + LTEXT "Instalacja zakończona",IDC_FINISHTITLE,120,8,195,11 + LTEXT "Kreator zakończył instalację sterownika dla:", IDC_STATIC,120,32,195,19 - LTEXT "Nacinij Zakocz, aby zamkn kreator.",IDC_STATIC,120,174, + LTEXT "Naciśnij Zakończ, aby zamknąć kreator.",IDC_STATIC,120,174, 179,11 - LTEXT "NIEZNANE URZDZENIE",IDC_DEVICE,148,53,147,12 + LTEXT "NIEZNANE URZĄDZENIE",IDC_DEVICE,148,53,147,12 END - diff --git a/dll/win32/newdev/lang/ro-RO.rc b/dll/win32/newdev/lang/ro-RO.rc index 0489abfdce5..754701b55d6 100644 --- a/dll/win32/newdev/lang/ro-RO.rc +++ b/dll/win32/newdev/lang/ro-RO.rc @@ -1,7 +1,5 @@ LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL -#pragma code_page(65001) - IDD_WELCOMEPAGE DIALOGEX DISCARDABLE 0, 0, 317, 193 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU @@ -108,5 +106,3 @@ BEGIN 179,11 LTEXT "DISPOZITIV NECUNOSCUT",IDC_DEVICE,148,53,147,12 END - -#pragma code_page(default) diff --git a/dll/win32/newdev/lang/ru-RU.rc b/dll/win32/newdev/lang/ru-RU.rc index 6fe3ba96f4f..8ff6798c4a2 100644 --- a/dll/win32/newdev/lang/ru-RU.rc +++ b/dll/win32/newdev/lang/ru-RU.rc @@ -3,106 +3,106 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT IDD_WELCOMEPAGE DIALOGEX DISCARDABLE 0, 0, 317, 193 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Мастер нового оборудования" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ",IDC_WELCOMETITLE,120,8,210,24 - LTEXT " :", + LTEXT "Установка нового оборудования",IDC_WELCOMETITLE,120,8,210,24 + LTEXT "Этот мастер устанавливает драйвер для:", IDC_STATIC,120,21,195,16 - LTEXT " """".",IDC_STATIC,120,169,195,17 - LTEXT " ",IDC_DEVICE,134,36,164,11 - LTEXT "! !",IDC_STATIC,120,59,195,25 - CONTROL " ",IDC_RADIO_AUTO,"Button", + LTEXT "Для продолжения нажмите кнопку ""Далее"".",IDC_STATIC,120,169,195,17 + LTEXT "Неизвестное устройство",IDC_DEVICE,134,36,164,11 + LTEXT "ВНИМАНИЕ! Установка нового оборудования может закончиться зависанием компьютера или невозможностью загрузить его!",IDC_STATIC,120,59,195,25 + CONTROL "Установить драйвер автоматически",IDC_RADIO_AUTO,"Button", BS_AUTORADIOBUTTON,120,112,178,13 - CONTROL " ",IDC_RADIO_MANUAL, + CONTROL "Установить драйвер из указанного места",IDC_RADIO_MANUAL, "Button",BS_AUTORADIOBUTTON,120,133,164,14 END IDD_NODRIVER DIALOGEX DISCARDABLE 0, 0, 317, 193 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Мастер нового оборудования" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ",IDC_FINISHTITLE,120,8,195,24 - LTEXT " , .", + LTEXT "Это оборудование установить не удалось",IDC_FINISHTITLE,120,8,195,24 + LTEXT "Оборудование не установлено, поскольку мастер не смог найти нужного программного обеспечения.", IDC_STATIC,120,40,195,19 - LTEXT " , """".", + LTEXT "Если имеются установочные диски или известно расположение нужного программного обеспечения, нажмите кнопку ""Назад"".", IDC_STATIC,120,125,181,24 - CONTROL " .",IDC_DONOTSHOWDLG,"Button", + CONTROL "Больше не напоминать об установке этого драйвера.",IDC_DONOTSHOWDLG,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,120,170,190,11 END IDD_INSTALLFAILED DIALOGEX DISCARDABLE 0, 0, 317, 193 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Мастер нового оборудования" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ",IDC_FINISHTITLE,120,8,195,24 - LTEXT " . .", + LTEXT "Это оборудование установить не удалось",IDC_FINISHTITLE,120,8,195,24 + LTEXT "Неизвестная ошибка. Не удалось установить устройство.", IDC_STATIC,120,40,195,19 - LTEXT " ",IDC_DEVICE,134,55,164,11 + LTEXT "Неизвестное устройство",IDC_DEVICE,134,55,164,11 END IDD_CHSOURCE DIALOGEX DISCARDABLE 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Мастер нового оборудования" FONT 8, "MS Shell Dlg" BEGIN - CONTROL " ",IDC_RADIO_SEARCHHERE,"Button", + CONTROL "Искать по этим путям",IDC_RADIO_SEARCHHERE,"Button", BS_AUTORADIOBUTTON,27,11,239,13 - CONTROL " ",IDC_RADIO_CHOOSE,"Button", + CONTROL "Выбор драйвера вручную",IDC_RADIO_CHOOSE,"Button", BS_AUTORADIOBUTTON,27,98,171,12 - CONTROL " ",IDC_CHECK_MEDIA,"Button", + CONTROL "Поиск на сменных носителях",IDC_CHECK_MEDIA,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,47,33,163,9 - CONTROL " ",IDC_CHECK_PATH,"Button",BS_AUTOCHECKBOX | + CONTROL "Включить это место поиска",IDC_CHECK_PATH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,47,54,162,10 - PUSHBUTTON "",IDC_BROWSE,248,69,50,14 + PUSHBUTTON "Обзор",IDC_BROWSE,248,69,50,14 COMBOBOX IDC_COMBO_PATH,61,71,176,12,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP | CBS_AUTOHSCROLL END IDD_SEARCHDRV DIALOGEX DISCARDABLE 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Мастер нового оборудования" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ",IDC_DEVICE,51,20,169,16 + LTEXT "Неизвестное устройство",IDC_DEVICE,51,20,169,16 END IDD_INSTALLDRV DIALOGEX DISCARDABLE 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Мастер нового оборудования" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ",IDC_DEVICE,51,20,169,16 + LTEXT "Неизвестное устройство",IDC_DEVICE,51,20,169,16 END IDD_NEEDREBOOT DIALOGEX DISCARDABLE 0, 0, 317, 193 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Мастер нового оборудования" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ",IDC_FINISHTITLE,120,8,195,11 - LTEXT " , :", + LTEXT "Установка оборудования завершена",IDC_FINISHTITLE,120,8,195,11 + LTEXT "Вы должны выполнить перезагрузку, чтобы закончить установку:", IDC_STATIC,120,32,195,19 - LTEXT " """" .",IDC_STATIC,120,174,179,11 - LTEXT " ",IDC_DEVICE,148,53,147,12 + LTEXT "Нажмите ""Готово"" для завершения мастера.",IDC_STATIC,120,174,179,11 + LTEXT "Неизвестное устройство",IDC_DEVICE,148,53,147,12 END IDD_FINISHPAGE DIALOGEX DISCARDABLE 0, 0, 317, 193 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Мастер нового оборудования" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ",IDC_FINISHTITLE,120,8,195,11 - LTEXT " :", + LTEXT "Установка завершена",IDC_FINISHTITLE,120,8,195,11 + LTEXT "Мастер закончил установку драйвера для:", IDC_STATIC,120,32,195,19 - LTEXT " """" .",IDC_STATIC,120,174, + LTEXT "Нажмите ""Готово"" для завершения мастера.",IDC_STATIC,120,174, 179,11 - LTEXT " ",IDC_DEVICE,148,53,147,12 + LTEXT "Неизвестное устройство",IDC_DEVICE,148,53,147,12 END diff --git a/dll/win32/newdev/lang/uk-UA.rc b/dll/win32/newdev/lang/uk-UA.rc index 707dcca0896..fb9872b83d5 100644 --- a/dll/win32/newdev/lang/uk-UA.rc +++ b/dll/win32/newdev/lang/uk-UA.rc @@ -11,108 +11,108 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT IDD_WELCOMEPAGE DIALOGEX DISCARDABLE 0, 0, 317, 193 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Встановлення пристрою" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ",IDC_WELCOMETITLE,120,8,195,24 - LTEXT " :", + LTEXT "Ласкаво просимо",IDC_WELCOMETITLE,120,8,195,24 + LTEXT "Цей майстер встановлює новий драйвер пристрою для:", IDC_STATIC,120,21,195,16 - LTEXT " """" .",IDC_STATIC,120,169,195,17 - LTEXT "² в",IDC_DEVICE,134,36,164,11 - LTEXT "! ' !",IDC_STATIC,120,59,195,24 - CONTROL " ",IDC_RADIO_AUTO,"Button", + LTEXT "Натисніть ""Далі"" для продовження.",IDC_STATIC,120,169,195,17 + LTEXT "НЕВІДОМИЙ ПРИСТРІЙ",IDC_DEVICE,134,36,164,11 + LTEXT "ПОПЕРЕДЖЕННЯ! ВСТАНОВЛЕННЯ ПРИСТРОЮ МОЖЕ ЗАМОРОЗИТИ ВАШ КОМП'ЮТЕР АБО ЗРОБИТИ ЙОГО НЕЗДАТНИМ ДО ЗАВАНТАЖЕННЯ!",IDC_STATIC,120,59,195,24 + CONTROL "Встановити драйвер автоматично",IDC_RADIO_AUTO,"Button", BS_AUTORADIOBUTTON,120,112,178,13 - CONTROL " ",IDC_RADIO_MANUAL, + CONTROL "Встановити драйвер з вказаного місця",IDC_RADIO_MANUAL, "Button",BS_AUTORADIOBUTTON,120,133,164,14 END IDD_NODRIVER DIALOGEX DISCARDABLE 0, 0, 317, 193 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Встановлення пристрою" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ",IDC_FINISHTITLE,120,8,195,24 - LTEXT " , .", + LTEXT "Встановлення не вдалося",IDC_FINISHTITLE,120,8,195,24 + LTEXT "Пристрій не встановлено, тому що драйвер не знайдено.", IDC_STATIC,120,40,195,19 - LTEXT " """", .", + LTEXT "Натисніть ""Назад"", якщо у Вас є диск з драйвером або Ви знаєте шлях до драйвера.", IDC_STATIC,120,98,181,24 - CONTROL " ",IDC_DONOTSHOWDLG,"Button", + CONTROL "Більше не показувати цей діалог",IDC_DONOTSHOWDLG,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,120,170,180,11 END IDD_INSTALLFAILED DIALOGEX DISCARDABLE 0, 0, 317, 193 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Встановлення пристрою" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ",IDC_FINISHTITLE,120,8,195,24 - LTEXT " .", + LTEXT "Встановлення не вдалося",IDC_FINISHTITLE,120,8,195,24 + LTEXT "Пристрій не встановлено тому що сталася несподівана помилка.", IDC_STATIC,120,40,195,19 - LTEXT "² в",IDC_DEVICE,134,55,164,11 + LTEXT "НЕВІДОМИЙ ПРИСТРІЙ",IDC_DEVICE,134,55,164,11 END IDD_CHSOURCE DIALOGEX DISCARDABLE 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Встановлення пристрою" FONT 8, "MS Shell Dlg" BEGIN - CONTROL " ",IDC_RADIO_SEARCHHERE,"Button", + CONTROL "Пошук по цих шляхах",IDC_RADIO_SEARCHHERE,"Button", BS_AUTORADIOBUTTON,27,11,239,13 - CONTROL " ",IDC_RADIO_CHOOSE,"Button", + CONTROL "Вибрати драйвер вручну",IDC_RADIO_CHOOSE,"Button", BS_AUTORADIOBUTTON,27,98,171,12 - CONTROL " ",IDC_CHECK_MEDIA,"Button", + CONTROL "Шукати на змінних носіях",IDC_CHECK_MEDIA,"Button", BS_AUTOCHECKBOX | WS_TABSTOP,47,33,163,9 - CONTROL " ",IDC_CHECK_PATH,"Button",BS_AUTOCHECKBOX | + CONTROL "Включити цей шлях",IDC_CHECK_PATH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,47,54,162,10 - PUSHBUTTON "",IDC_BROWSE,248,69,50,14 + PUSHBUTTON "Огляд",IDC_BROWSE,248,69,50,14 COMBOBOX IDC_COMBO_PATH,61,71,176,12,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP | CBS_AUTOHSCROLL END IDD_SEARCHDRV DIALOGEX DISCARDABLE 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Встановлення пристрою" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "² в",IDC_DEVICE,51,20,169,16 + LTEXT "НЕВІДОМИЙ ПРИСТРІЙ",IDC_DEVICE,51,20,169,16 END IDD_INSTALLDRV DIALOGEX DISCARDABLE 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Встановлення пристрою" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "² в",IDC_DEVICE,51,20,169,16 + LTEXT "НЕВІДОМИЙ ПРИСТРІЙ",IDC_DEVICE,51,20,169,16 END IDD_NEEDREBOOT DIALOGEX DISCARDABLE 0, 0, 317, 193 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Встановлення пристрою" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ",IDC_FINISHTITLE,120,8,195,11 - LTEXT " , :", + LTEXT "Встановлення завершене",IDC_FINISHTITLE,120,8,195,11 + LTEXT "Ви маєте перезапустити комп’ютер, щоб закінчити встановлення:", IDC_STATIC,120,32,195,19 - LTEXT " """" .",IDC_STATIC,120,174, + LTEXT "Натисніть ""Завершити"" для виходу з майстра.",IDC_STATIC,120,174, 179,11 - LTEXT "² в",IDC_DEVICE,148,53,147,12 + LTEXT "НЕВІДОМИЙ ПРИСТРІЙ",IDC_DEVICE,148,53,147,12 END IDD_FINISHPAGE DIALOGEX DISCARDABLE 0, 0, 317, 193 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Встановлення пристрою" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ",IDC_FINISHTITLE,120,8,195,11 - LTEXT " :", + LTEXT "Встановлення завершене",IDC_FINISHTITLE,120,8,195,11 + LTEXT "Майстер закінчив встановлення драйвера для:", IDC_STATIC,120,32,195,19 - LTEXT " """" .",IDC_STATIC,120,174, + LTEXT "Натисніть ""Завершити"" для виходу з майстра.",IDC_STATIC,120,174, 179,11 - LTEXT "² в",IDC_DEVICE,148,53,147,12 + LTEXT "НЕВІДОМИЙ ПРИСТРІЙ",IDC_DEVICE,148,53,147,12 END diff --git a/dll/win32/newdev/newdev.rbuild b/dll/win32/newdev/newdev.rbuild index 9d8cb9e4616..86636e12d21 100644 --- a/dll/win32/newdev/newdev.rbuild +++ b/dll/win32/newdev/newdev.rbuild @@ -5,6 +5,7 @@ stubs.c wizard.c newdev.rc + newdev_private.h wine gdi32 comctl32 diff --git a/dll/win32/newdev/rsrc.rc b/dll/win32/newdev/rsrc.rc index 8e7d4e205f6..1e2449c77c4 100644 --- a/dll/win32/newdev/rsrc.rc +++ b/dll/win32/newdev/rsrc.rc @@ -19,9 +19,12 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL #include "lang/ja-JP.rc" #include "lang/no-NO.rc" #include "lang/nl-NL.rc" +#include "lang/sk-SK.rc" +#include "lang/th-TH.rc" + +// UTF-8 +#pragma code_page(65001) #include "lang/pl-PL.rc" #include "lang/ro-RO.rc" #include "lang/ru-RU.rc" -#include "lang/sk-SK.rc" -#include "lang/th-TH.rc" #include "lang/uk-UA.rc" diff --git a/dll/win32/ntmarta/ntmarta.h b/dll/win32/ntmarta/ntmarta.h index 79a2fe755c5..cf7202eea37 100644 --- a/dll/win32/ntmarta/ntmarta.h +++ b/dll/win32/ntmarta/ntmarta.h @@ -1,7 +1,9 @@ #define WIN32_NO_STATUS #define NTOS_MODE_USER #include -#include +#include +#include +#include #include #include #include diff --git a/dll/win32/objsel/CMakeLists.txt b/dll/win32/objsel/CMakeLists.txt index d71651b29b9..413a0dc47e3 100644 --- a/dll/win32/objsel/CMakeLists.txt +++ b/dll/win32/objsel/CMakeLists.txt @@ -29,4 +29,5 @@ add_importlibs(objsel kernel32 ntdll) +add_pch(objsel objsel_private.h) add_cd_file(TARGET objsel DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/objsel/objsel.rbuild b/dll/win32/objsel/objsel.rbuild index f3409b38ea3..bec0a5b3260 100644 --- a/dll/win32/objsel/objsel.rbuild +++ b/dll/win32/objsel/objsel.rbuild @@ -18,5 +18,6 @@ objsel.c regsvr.c objsel.rc + objsel_private.h diff --git a/dll/win32/odbc32/CMakeLists.txt b/dll/win32/odbc32/CMakeLists.txt index 84aeb39ce6d..da84e343c27 100644 --- a/dll/win32/odbc32/CMakeLists.txt +++ b/dll/win32/odbc32/CMakeLists.txt @@ -1,6 +1,5 @@ add_definitions(-D__WINESRC__) -add_definitions(-D_DLL -D__USE_CRTIMP) include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine) @@ -23,5 +22,4 @@ add_importlibs(odbc32 kernel32 ntdll) - add_cd_file(TARGET odbc32 DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/odbccp32/CMakeLists.txt b/dll/win32/odbccp32/CMakeLists.txt index 3eb259b7afe..16e60613f59 100644 --- a/dll/win32/odbccp32/CMakeLists.txt +++ b/dll/win32/odbccp32/CMakeLists.txt @@ -1,8 +1,5 @@ -add_definitions( - -D__WINESRC__ - -D_DLL -D__USE_CRTIMP) - +add_definitions(-D__WINESRC__) include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine) spec2def(odbccp32.dll odbccp32.spec) @@ -13,8 +10,8 @@ list(APPEND SOURCE ${CMAKE_CURRENT_BINARY_DIR}/odbccp32.def) add_library(odbccp32 SHARED ${SOURCE}) -set_entrypoint(odbccp32 0) +set_entrypoint(odbccp32 0) target_link_libraries(odbccp32 uuid wine) add_importlibs(odbccp32 diff --git a/dll/win32/ole32/CMakeLists.txt b/dll/win32/ole32/CMakeLists.txt index bb8ccfd6b56..caaba25f7fa 100644 --- a/dll/win32/ole32/CMakeLists.txt +++ b/dll/win32/ole32/CMakeLists.txt @@ -16,9 +16,9 @@ add_definitions( -DREGISTER_PROXY_DLL -DCOM_NO_WINDOWS_H) -include_directories( - ${CMAKE_CURRENT_BINARY_DIR} - ${REACTOS_SOURCE_DIR}/include/reactos/wine) +include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine) + +add_rpc_files(client irot.idl) add_rpcproxy_files( dcom.idl @@ -66,6 +66,7 @@ list(APPEND SOURCE ole32res.rc ${CMAKE_CURRENT_BINARY_DIR}/dcom_i.c ${CMAKE_CURRENT_BINARY_DIR}/dcom_p.c + ${CMAKE_CURRENT_BINARY_DIR}/irot_c.c ${CMAKE_CURRENT_BINARY_DIR}/ole32_unknwn_p.c ${CMAKE_CURRENT_BINARY_DIR}/ole32_objidl_p.c ${CMAKE_CURRENT_BINARY_DIR}/ole32_oleidl_p.c @@ -79,7 +80,6 @@ set_module_type(ole32 win32dll) target_link_libraries(ole32 wine - irotrpc uuid ${PSEH_LIB}) diff --git a/dll/win32/oleaut32/CMakeLists.txt b/dll/win32/oleaut32/CMakeLists.txt index 1a27084c2cb..bc1c63005ef 100644 --- a/dll/win32/oleaut32/CMakeLists.txt +++ b/dll/win32/oleaut32/CMakeLists.txt @@ -1,4 +1,25 @@ +remove_definitions(-D_WIN32_WINNT=0x502) +add_definitions(-D_WIN32_WINNT=0x600) + +add_definitions(-DPROXY_CLSID_IS="{0xb196b286,0xbab4,0x101a,{0xb6,0x9c,0x00,0xaa,0x00,0x34,0x1d,0x07}}") + +add_definitions( + -D__WINESRC__ + -DCOM_NO_WINDOWS_H + -D_OLEAUT32_ + -DPROXY_DELEGATION + -DREGISTER_PROXY_DLL + -DENTRY_PREFIX=OLEAUTPS_) + +include_directories( + ${REACTOS_SOURCE_DIR}/include/reactos/libs/libjpeg + ${REACTOS_SOURCE_DIR}/include/reactos/wine) + +spec2def(oleaut32.dll oleaut32.spec) + +add_rpcproxy_files(oleaut32_oaidl.idl oleaut32_ocidl.idl) + list(APPEND SOURCE connpt.c dispatch.c @@ -25,32 +46,12 @@ list(APPEND SOURCE ${CMAKE_CURRENT_BINARY_DIR}/oleaut32_ocidl_p.c ${CMAKE_CURRENT_BINARY_DIR}/oleaut32.def) -remove_definitions(-D_WIN32_WINNT=0x502) -add_definitions(-D_WIN32_WINNT=0x600) - -add_definitions(-DPROXY_CLSID_IS="{0xb196b286,0xbab4,0x101a,{0xb6,0x9c,0x00,0xaa,0x00,0x34,0x1d,0x07}}") - -add_definitions( - -D__WINESRC__ - -DCOM_NO_WINDOWS_H - -D_OLEAUT32_ - -DPROXY_DELEGATION - -DREGISTER_PROXY_DLL - -DENTRY_PREFIX=OLEAUTPS_) - -if(MSC) -# seems to work, but is this correct ? -# /FIwine/typeof.h -add_definitions(/FIwine/typeof.h) -endif(MSC) - -include_directories( - ${REACTOS_SOURCE_DIR}/include/reactos/libs/libjpeg - ${REACTOS_SOURCE_DIR}/include/reactos/wine) - -spec2def(oleaut32.dll oleaut32.spec) - -add_rpcproxy_files(oleaut32_oaidl.idl oleaut32_ocidl.idl) +if(MSVC) + set_source_files_properties(${REACTOS_BINARY_DIR}/include/psdk/wincodec_i.c PROPERTIES GENERATED TRUE) + list(APPEND SOURCE + ${REACTOS_BINARY_DIR}/include/psdk/wincodec_i.c + msvc.S) +endif() add_library(oleaut32 SHARED ${SOURCE}) diff --git a/dll/win32/oleaut32/msvc.S b/dll/win32/oleaut32/msvc.S new file mode 100644 index 00000000000..df7f68ea00c --- /dev/null +++ b/dll/win32/oleaut32/msvc.S @@ -0,0 +1,30 @@ + +#include + +.code32 + +PUBLIC _call_method +_call_method: + push ebp + mov ebp, esp + push esi + push edi + mov edx, dword ptr ds:[ebp + 12] + shl edx, 2 + jz cm1 + sub esp, edx + and esp, HEX(0FFFFFFF0) + mov ecx, dword ptr ds:[ebp + 12] + mov esi, dword ptr ds:[ebp + 16] + mov edi, esp + cld + rep movsd +cm1: + call dword ptr ds:[ebp + 8] + lea esp, [ebp - 8] + pop edi + pop esi + pop ebp + ret + +END diff --git a/dll/win32/oleaut32/typelib2.c b/dll/win32/oleaut32/typelib2.c index 92d4ab036d6..1333b68eaad 100644 --- a/dll/win32/oleaut32/typelib2.c +++ b/dll/win32/oleaut32/typelib2.c @@ -1780,7 +1780,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddFuncDesc( insert = HeapAlloc(GetProcessHeap(), 0, sizeof(CyclicList)); if(!insert) return E_OUTOFMEMORY; - insert->u.data = HeapAlloc(GetProcessHeap(), 0, sizeof(int[6])+sizeof(int[(num_defaults?4:3)])*pFuncDesc->cParams); + insert->u.data = HeapAlloc(GetProcessHeap(), 0, sizeof(int)*6+sizeof(int)*(num_defaults?4:3)*pFuncDesc->cParams); if(!insert->u.data) { HeapFree(GetProcessHeap(), 0, insert); return E_OUTOFMEMORY; diff --git a/dll/win32/opengl32/CMakeLists.txt b/dll/win32/opengl32/CMakeLists.txt index a395c5afd7d..bdf1e4f1ec2 100644 --- a/dll/win32/opengl32/CMakeLists.txt +++ b/dll/win32/opengl32/CMakeLists.txt @@ -1,8 +1,6 @@ set_unicode() -add_definitions(-D_DLL -D__USE_CRTIMP) - spec2def(opengl32.dll opengl32.spec) list(APPEND SOURCE @@ -13,9 +11,7 @@ list(APPEND SOURCE ${CMAKE_CURRENT_BINARY_DIR}/opengl32_stubs.c ${CMAKE_CURRENT_BINARY_DIR}/opengl32.def) -add_library(opengl32 SHARED - ${CMAKE_CURRENT_BINARY_DIR}/opengl32_opengl32.h.gch - ${SOURCE}) +add_library(opengl32 SHARED ${SOURCE}) set_module_type(opengl32 win32dll) @@ -28,7 +24,7 @@ add_importlibs(opengl32 kernel32 ntdll) -add_pch(opengl32 ${CMAKE_CURRENT_SOURCE_DIR}/opengl32.h ${SOURCE}) +add_pch(opengl32 opengl32.h) add_cd_file(TARGET opengl32 DESTINATION reactos/system32 FOR all) add_importlib_target(opengl32.spec) diff --git a/dll/win32/opengl32/opengl32.h b/dll/win32/opengl32/opengl32.h index e22386c6cd1..037419ef6bc 100644 --- a/dll/win32/opengl32/opengl32.h +++ b/dll/win32/opengl32/opengl32.h @@ -37,7 +37,7 @@ extern "C" { #define NTOS_MODE_USER #include -#include +#include #include #include diff --git a/dll/win32/powrprof/powrprof.c b/dll/win32/powrprof/powrprof.c index 9905175c52e..51a3d8406a0 100644 --- a/dll/win32/powrprof/powrprof.c +++ b/dll/win32/powrprof/powrprof.c @@ -20,10 +20,12 @@ #include -#include #define WIN32_NO_STATUS #include -#include +#define NTOS_MODE_USER +#include +#include +#include #include #include #include diff --git a/dll/win32/psapi/CMakeLists.txt b/dll/win32/psapi/CMakeLists.txt index f0666f0210f..dda730acbd0 100644 --- a/dll/win32/psapi/CMakeLists.txt +++ b/dll/win32/psapi/CMakeLists.txt @@ -7,13 +7,11 @@ list(APPEND SOURCE psapi.rc ${CMAKE_CURRENT_BINARY_DIR}/psapi.def) -add_library(psapi SHARED - ${CMAKE_CURRENT_BINARY_DIR}/psapi_precomp.h.gch - ${SOURCE}) +add_library(psapi SHARED ${SOURCE}) set_module_type(psapi win32dll) target_link_libraries(psapi epsapi ${PSEH_LIB}) add_importlibs(psapi msvcrt kernel32 ntdll) add_importlib_target(psapi.spec) -add_pch(psapi ${CMAKE_CURRENT_SOURCE_DIR}/precomp.h ${SOURCE}) +add_pch(psapi precomp.h) add_cd_file(TARGET psapi DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/psapi/precomp.h b/dll/win32/psapi/precomp.h index c53971f982e..c07d6a28d7e 100644 --- a/dll/win32/psapi/precomp.h +++ b/dll/win32/psapi/precomp.h @@ -1,7 +1,11 @@ #define WIN32_NO_STATUS #include #define NTOS_MODE_USER -#include +#include +#include +#include +#include +#include #include #include diff --git a/dll/win32/qmgr/CMakeLists.txt b/dll/win32/qmgr/CMakeLists.txt index 0cc4ba961e7..b8d2d508d53 100644 --- a/dll/win32/qmgr/CMakeLists.txt +++ b/dll/win32/qmgr/CMakeLists.txt @@ -28,5 +28,6 @@ add_idl_headers(qmgr_idlheader qmgr_local.idl) set_module_type(qmgr win32dll) target_link_libraries(qmgr uuid wine) add_importlibs(qmgr ole32 wininet urlmon advapi32 msvcrt kernel32 ntdll) +add_pch(qmgr qmgr.h) add_cd_file(TARGET qmgr DESTINATION reactos/system32 FOR all) add_dependencies(qmgr qmgr_idlheader) diff --git a/dll/win32/qmgr/qmgr.rbuild b/dll/win32/qmgr/qmgr.rbuild index 38ac841058b..790313ee9d5 100644 --- a/dll/win32/qmgr/qmgr.rbuild +++ b/dll/win32/qmgr/qmgr.rbuild @@ -24,6 +24,7 @@ qmgr_main.c service.c rsrc.rc + qmgr.h qmgr_local.idl diff --git a/dll/win32/qmgrprxy/CMakeLists.txt b/dll/win32/qmgrprxy/CMakeLists.txt index c43b631744a..cb6732ce418 100644 --- a/dll/win32/qmgrprxy/CMakeLists.txt +++ b/dll/win32/qmgrprxy/CMakeLists.txt @@ -9,6 +9,8 @@ generate_idl_iids(qmgrprxy.idl) spec2def(qmgrprxy.dll qmgrprxy.spec) +add_rpcproxy_files(qmgrprxy.idl) + list(APPEND SOURCE version.rc ${CMAKE_CURRENT_BINARY_DIR}/qmgrprxy_i.c @@ -16,8 +18,6 @@ list(APPEND SOURCE ${CMAKE_CURRENT_BINARY_DIR}/proxy.dlldata.c ${CMAKE_CURRENT_BINARY_DIR}/qmgrprxy.def) -add_rpcproxy_files(qmgrprxy.idl) - add_library(qmgrprxy SHARED ${SOURCE}) set_module_type(qmgrprxy win32dll) diff --git a/dll/win32/rasadhlp/CMakeLists.txt b/dll/win32/rasadhlp/CMakeLists.txt index 05b95a07f0a..33786a1a408 100644 --- a/dll/win32/rasadhlp/CMakeLists.txt +++ b/dll/win32/rasadhlp/CMakeLists.txt @@ -11,9 +11,7 @@ list(APPEND SOURCE ${CMAKE_CURRENT_BINARY_DIR}/rasadhlp.def) add_library(rasadhlp SHARED ${SOURCE}) - set_module_type(rasadhlp win32dll) - add_importlibs(rasadhlp ws2_32 msvcrt kernel32 ntdll) - +add_pch(rasadhlp precomp.h) add_cd_file(TARGET rasadhlp DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/rasadhlp/rasadhlp.rbuild b/dll/win32/rasadhlp/rasadhlp.rbuild index e12c60d7c02..b98b8fe9327 100644 --- a/dll/win32/rasadhlp/rasadhlp.rbuild +++ b/dll/win32/rasadhlp/rasadhlp.rbuild @@ -9,4 +9,5 @@ autodial.c init.c winsock.c + precomp.h diff --git a/dll/win32/rasdlg/lang/pl-PL.rc b/dll/win32/rasdlg/lang/pl-PL.rc index 988944f35ee..97ea93aab19 100644 --- a/dll/win32/rasdlg/lang/pl-PL.rc +++ b/dll/win32/rasdlg/lang/pl-PL.rc @@ -3,6 +3,7 @@ * Use ReactOS forum PM or IRC to contact me * http://www.reactos.org * IRC: irc.freenode.net #reactos-pl; + * UTF-8 conversion by Caemyr (May, 2011) */ LANGUAGE LANG_POLISH, SUBLANG_DEFAULT @@ -12,69 +13,69 @@ STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION CAPTION "Dodatkowe Numery Telefoniczne" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Podaj dodatkowe numery telefoniczne, ktrych chcesz uywa w tym poczeniu.", 1018, 7, 5, 243, 16 + LTEXT "Podaj dodatkowe numery telefoniczne, których chcesz używać w tym połączeniu.", 1018, 7, 5, 243, 16 LTEXT "&Numery telefoniczne:", 1019, 7, 27, 238, 8 CONTROL "", 1012, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x0000848D, 7, 38, 217, 144 - PUSHBUTTON "W &gr", 1017, 230, 40, 18, 16, BS_ICON - PUSHBUTTON "W &d", 1015, 230, 61, 18, 16, BS_ICON + PUSHBUTTON "W &górę", 1017, 230, 40, 18, 16, BS_ICON + PUSHBUTTON "W &dół", 1015, 230, 61, 18, 16, BS_ICON PUSHBUTTON "D&odaj", 1013, 7, 187, 70, 14 PUSHBUTTON "&Edytuj", 1016, 81, 187, 70, 14 - PUSHBUTTON "&Usu", 1014, 154, 187, 70, 14 - AUTOCHECKBOX "&Jeeli numer nie dziaa, uyj kolejego", 1011, 8, 210, 243, 10, BS_TOP | BS_MULTILINE - AUTOCHECKBOX "&Move successful number to top of list", 1010, 8, 228, 243, 10, BS_TOP | BS_MULTILINE + PUSHBUTTON "&Usuń", 1014, 154, 187, 70, 14 + AUTOCHECKBOX "&Jeżeli numer nie działa, użyj kolejego", 1011, 8, 210, 243, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Przenieś sprawdzony numer na początek listy", 1010, 8, 228, 243, 10, BS_TOP | BS_MULTILINE DEFPUSHBUTTON "OK", 1, 122, 245, 60, 14 PUSHBUTTON "Anuluj", 2, 188, 245, 60, 14 END 103 DIALOGEX 6, 18, 250, 170 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION -CAPTION "Poczenia Sieciowe" +CAPTION "Połączenia Sieciowe" FONT 8, "MS Shell Dlg" BEGIN LTEXT "", 1029, 5, 5, 241, 35, NOT WS_GROUP - LTEXT "&Poczenia:", -1, 5, 46, 238, 10 + LTEXT "&Połączenia:", -1, 5, 46, 238, 10 CONTROL "List1", 1677, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x0000440D, 5, 57, 240, 57 AUTOCHECKBOX "&Nie pytaj mnie ponownie, do czasu kolejnego logowania", 1022, 8, 125, 235, 10 PUSHBUTTON "&Ustawienia", 1026, 7, 149, 60, 14 - DEFPUSHBUTTON "P&ocz...", 1024, 117, 149, 60, 14 + DEFPUSHBUTTON "P&ołącz...", 1024, 117, 149, 60, 14 PUSHBUTTON "Anuluj", 1025, 183, 149, 60, 14 END 104 DIALOGEX 6, 18, 269, 263 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION "Bdy grupowania linii" +CAPTION "Błędy grupowania linii" FONT 8, "MS Shell Dlg" BEGIN ICON 32516, 1031, 7, 7, 20, 20 - LTEXT "Jedna lub wicej dodatkowych linii nie zostaa poczona. ", 1033, 37, 8, 216, 20 + LTEXT "Jedna lub więcej dodatkowych linii nie została połączona. ", 1033, 37, 8, 216, 20 CONTROL "", 1032, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x00008401, 37, 83, 224, 136 - AUTOCHECKBOX "&Nie uywaj tej/tych linii w przyszoci", 1030, 38, 226, 222, 10 + AUTOCHECKBOX "&Nie używaj tej/tych linii w przyszłości", 1030, 38, 226, 222, 10 DEFPUSHBUTTON "&Akceptuj", 1, 135, 242, 60, 14 - PUSHBUTTON "&Rozcz", 2, 201, 242, 60, 14 - LTEXT "Jeli czy si tylko jedna linia, serwer moe nie by skonfigurowany do obsugi poczenia wieloliniowego. Zaznacz opcj 'Nie uywaj tej/tych linii' by unikn niepotrzebnych opad za poczenie.", -1, 37, 36, 224, 44 + PUSHBUTTON "&Rozłącz", 2, 201, 242, 60, 14 + LTEXT "Jeśli łączy się tylko jedna linia, serwer może nie być skonfigurowany do obsługi połączenia wieloliniowego. Zaznacz opcję 'Nie używaj tej/tych linii' by uniknąć niepotrzebnych opład za połączenie.", -1, 37, 36, 224, 44 END 105 DIALOGEX 0, 0, 261, 253 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "Zaawansowane ustawienia bezpieczestwa" +CAPTION "Zaawansowane ustawienia bezpieczeństwa" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "Bezpieczestwo logowania", 1547, 7, 33, 246, 191 + GROUPBOX "Bezpieczeństwo logowania", 1547, 7, 33, 246, 191 LTEXT "&Szyfrowanie danych:", 1546, 7, 5, 247, 10 COMBOBOX 1495, 7, 17, 247, 76, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - AUTORADIOBUTTON "Uyj protokou &EAP", 1544, 17, 47, 226, 8, WS_GROUP - LTEXT "Rodzaj protokou EAP", -1, 18, 64, 35, 8, NOT WS_VISIBLE | NOT WS_GROUP + AUTORADIOBUTTON "Użyj protokołu &EAP", 1544, 17, 47, 226, 8, WS_GROUP + LTEXT "Rodzaj protokołu EAP", -1, 18, 64, 35, 8, NOT WS_VISIBLE | NOT WS_GROUP COMBOBOX 1034, 53, 62, 191, 42, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | NOT WS_TABSTOP - PUSHBUTTON "W&aciwoci", 1035, 184, 77, 60, 14 - AUTORADIOBUTTON "Zezwl na ponisze &protokoy", 1545, 17, 92, 224, 10 - AUTOCHECKBOX "&Nieszyfrowane haso (PAP)", 1491, 28, 105, 215, 10, BS_TOP | BS_MULTILINE | WS_GROUP + PUSHBUTTON "Wł&aściwości", 1035, 184, 77, 60, 14 + AUTORADIOBUTTON "Zezwól na poniższe &protokoły", 1545, 17, 92, 224, 10 + AUTOCHECKBOX "&Nieszyfrowane hasło (PAP)", 1491, 28, 105, 215, 10, BS_TOP | BS_MULTILINE | WS_GROUP AUTOCHECKBOX "Shiva &PAP (SPAP)", 1496, 28, 119, 214, 10, BS_TOP | BS_MULTILINE AUTOCHECKBOX "&Challenge Handshake Authentication Protocol (CHAP)", 1494, 28, 133, 215, 10, BS_TOP | BS_MULTILINE AUTOCHECKBOX "&MS CHAP (MS-CHAP)", 1493, 28, 148, 212, 10, BS_TOP | BS_MULTILINE - AUTOCHECKBOX "Zezwl na starsz wersj MS-CHAP dla serwerw &Win 95", 200, 46, 162, 198, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Zezwól na starszą wersję MS-CHAP dla serwerów &Win 95", 200, 46, 162, 198, 10, BS_TOP | BS_MULTILINE AUTOCHECKBOX "M&icrosoft CHAP Wersja 2 (MS-CHAP v2)", 1492, 28, 176, 200, 10, BS_TOP | BS_MULTILINE CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 28, 189, 208, 1 - AUTOCHECKBOX "&Dla protokow z rodziny MS-CHAP, automatycznie uyj mojej nazwy uytkownika i hasa z systemu ReactOS (take domeny jeli wystpuje)", 1549, 28, 195, 213, 24, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Dla protokołów z rodziny MS-CHAP, automatycznie użyj mojej nazwy użytkownika i hasła z systemu ReactOS (także domeny jeśli występuje)", 1549, 28, 195, 213, 24, BS_TOP | BS_MULTILINE DEFPUSHBUTTON "OK", 1, 127, 232, 60, 14 PUSHBUTTON "Anuluj", 2, 192, 232, 60, 14 END @@ -86,9 +87,9 @@ FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "OK", 1, 97, 91, 60, 14 ICON 563, 1046, 7, 7, 20, 20 - LTEXT "Poczenie aktywne.", 1047, 40, 7, 212, 16 - LTEXT "Aby sprawdzi stan tego poczenia, albo je odczy, kliknij prawym przyciskiem myszki na jego ikon w katalogu Poczenia Sieciowe, or albo kliknij na ikon w zasobniku systemowym.", -1, 40, 30, 212, 34 - AUTOCHECKBOX "&Nie wywietlaj wicej tej wiadomoci", 1045, 40, 69, 212, 10, BS_TOP | BS_MULTILINE + LTEXT "Połączenie aktywne.", 1047, 40, 7, 212, 16 + LTEXT "Aby sprawdzić stan tego połączenia, albo je odłączyć, kliknij prawym przyciskiem myszki na jego ikonę w katalogu Połączenia Sieciowe, or albo kliknij na ikonę w zasobniku systemowym.", -1, 40, 30, 212, 34 + AUTOCHECKBOX "&Nie wyświetlaj więcej tej wiadomości", 1045, 40, 69, 212, 10, BS_TOP | BS_MULTILINE END 107 DIALOGEX 0, 0, 258, 167 @@ -102,7 +103,7 @@ BEGIN EDITTEXT 1051, 77, 30, 163, 14, ES_AUTOHSCROLL LTEXT "K&od krajowy:", 1056, 18, 48, 221, 8, NOT WS_GROUP COMBOBOX 1054, 17, 61, 224, 93, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | NOT WS_TABSTOP - AUTOCHECKBOX "&Uyj regu wybierania", 1048, 20, 81, 219, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Użyj reguł wybierania", 1048, 20, 81, 219, 10, BS_TOP | BS_MULTILINE GROUPBOX "Ko&mentarz", 1052, 7, 102, 243, 36 EDITTEXT 1050, 17, 115, 224, 14, ES_AUTOHSCROLL DEFPUSHBUTTON "OK", 1, 127, 147, 60, 14 @@ -111,13 +112,13 @@ END 108 DIALOGEX 6, 18, 222, 104 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION "Zmiana hasa" +CAPTION "Zmiana hasła" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Wano twojego hasa w zdalnej sieci wygasa. Wprowad nowe haso i nacinij OK.", 1062, 7, 5, 210, 24 - LTEXT "&Nowe haso:", 1064, 8, 43, 108, 8 + LTEXT "Ważność twojego hasła w zdalnej sieci wygasła. Wprowadź nowe hasło i naciśnij OK.", 1062, 7, 5, 210, 24 + LTEXT "&Nowe hasło:", 1064, 8, 43, 108, 8 EDITTEXT 1060, 118, 38, 98, 14, ES_PASSWORD | ES_AUTOHSCROLL - LTEXT "&Potwierd nowe haso:", 1061, 8, 61, 102, 8 + LTEXT "&Potwierdź nowe hasło:", 1061, 8, 61, 102, 8 EDITTEXT 1058, 118, 57, 98, 14, ES_PASSWORD | ES_AUTOHSCROLL DEFPUSHBUTTON "OK", 1, 90, 84, 60, 14, WS_GROUP PUSHBUTTON "Anuluj", 2, 154, 84, 60, 14 @@ -125,15 +126,15 @@ END 109 DIALOGEX 6, 18, 223, 122 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION "Zmiana hasa" +CAPTION "Zmiana hasła" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Wano twojego hasa w zdalnej sieci wygasa. Wprowad nowe haso i nacinij OK.", 1062, 7, 5, 212, 29 - LTEXT "&Stare haso:", 1063, 7, 42, 108, 8 + LTEXT "Ważność twojego hasła w zdalnej sieci wygasła. Wprowadź nowe hasło i naciśnij OK.", 1062, 7, 5, 212, 29 + LTEXT "&Stare hasło:", 1063, 7, 42, 108, 8 EDITTEXT 1059, 116, 38, 100, 14, ES_PASSWORD | ES_AUTOHSCROLL - LTEXT "&Nowe haso:", 1064, 7, 60, 108, 8 + LTEXT "&Nowe hasło:", 1064, 7, 60, 108, 8 EDITTEXT 1060, 116, 56, 100, 14, ES_PASSWORD | ES_AUTOHSCROLL - LTEXT "&Potwierd nowe haso:", 1061, 7, 78, 108, 8 + LTEXT "&Potwierdź nowe hasło:", 1061, 7, 78, 108, 8 EDITTEXT 1058, 116, 74, 100, 14, ES_PASSWORD | ES_AUTOHSCROLL DEFPUSHBUTTON "OK", 1, 92, 101, 60, 14, WS_GROUP PUSHBUTTON "Anuluj", 2, 156, 101, 60, 14 @@ -144,8 +145,8 @@ STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION CAPTION "Oddzwanianie" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Masz ustawiony przywilej oddzwaniania na serwerze. Nacinij OK by serwer oddzwoni na twj, podany poniej numer. Nacinij Anuluj by pomin oddzwanianie.", 1066, 5, 5, 221, 39, SS_NOPREFIX - LTEXT "&Wprowad numer telefoniczny modemu:", 1067, 5, 46, 222, 8, NOT WS_GROUP + LTEXT "Masz ustawiony przywilej oddzwaniania na serwerze. Naciśnij OK by serwer oddzwonił na twój, podany poniżej numer. Naciśnij Anuluj by pominąć oddzwanianie.", 1066, 5, 5, 221, 39, SS_NOPREFIX + LTEXT "&Wprowadź numer telefoniczny modemu:", 1067, 5, 46, 222, 8, NOT WS_GROUP EDITTEXT 1065, 5, 57, 221, 14, ES_AUTOHSCROLL DEFPUSHBUTTON "OK", 1, 100, 85, 60, 14, WS_GROUP PUSHBUTTON "Anuluj", 2, 164, 85, 60, 14 @@ -153,31 +154,31 @@ END 111 DIALOGEX 6, 19, 265, 135 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION "Bd poczenia z %1" +CAPTION "Błąd połączenia z %1" FONT 8, "MS Shell Dlg" BEGIN ICON 32515, 1068, 7, 7, 20, 20, WS_GROUP LTEXT "", 1070, 34, 7, 226, 105 DEFPUSHBUTTON "Nie wybieraj=88", 1, 4, 117, 128, 14, WS_GROUP PUSHBUTTON "Anuluj", 2, 136, 117, 60, 14 - PUSHBUTTON "&Wicej informacji", 1069, 200, 117, 60, 14 + PUSHBUTTON "&Więcej informacji", 1069, 200, 117, 60, 14 END 112 DIALOGEX 6, 18, 263, 219 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION "Automatyczne wybieranie i zawieszanie pocze" +CAPTION "Automatyczne wybieranie i zawieszanie połączeń" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "ReactOS moe automatycznie wybiera i zawiesza poczenie, w zalenoci od tego ile danych jest wysyane i odbierane.", 1085, 9, 7, 253, 30 + LTEXT "ReactOS może automatycznie wybierać i zawieszać połączenie, w zależności od tego ile danych jest wysyłane i odbierane.", 1085, 9, 7, 253, 30 GROUPBOX "Wybieranie automatyczne", -1, 6, 38, 249, 71 - LTEXT "Uyj dodatkowej linii, kiedy to poczenie spenia oba ponisze kryteria:", 1083, 16, 51, 237, 16, NOT WS_GROUP - LTEXT "Aktywno co &najmniej:", -1, 16, 73, 100, 8 + LTEXT "Użyj dodatkowej linii, kiedy to połączenie spełnia oba poniższe kryteria:", 1083, 16, 51, 237, 16, NOT WS_GROUP + LTEXT "Aktywność co &najmniej:", -1, 16, 73, 100, 8 COMBOBOX 1079, 117, 70, 60, 100, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP LTEXT "&Czas trwania co najmniej:", 1084, 16, 92, 99, 8, NOT WS_GROUP COMBOBOX 1080, 117, 89, 90, 162, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP GROUPBOX "Automatyczne zawieszanie", -1, 6, 113, 248, 81 - LTEXT "Zawie poczenie z tym urzdzeniem:", 1086, 16, 127, 230, 18, NOT WS_GROUP - LTEXT "Aktywno nie wicej &ni:", -1, 16, 150, 92, 8 + LTEXT "Zawieś połączenie z tym urządzeniem:", 1086, 16, 127, 230, 18, NOT WS_GROUP + LTEXT "Aktywność nie więcej &niż:", -1, 16, 150, 92, 8 COMBOBOX 1081, 115, 146, 60, 100, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP LTEXT "Czas &trwania co najmniej:", 1087, 16, 168, 92, 8, NOT WS_GROUP COMBOBOX 1082, 115, 166, 90, 151, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP @@ -187,7 +188,7 @@ END 113 DIALOGEX 21, 46, 225, 65 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION -CAPTION "Poczenie z %1..." +CAPTION "Połączenie z %1..." FONT 8, "MS Shell Dlg" BEGIN ICON 563, 1417, 7, 7, 20, 20 @@ -197,18 +198,18 @@ END 114 DIALOGEX 6, 18, 225, 60 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "Poczenie Dial-Up" +CAPTION "Połączenie Dial-Up" FONT 8, "MS Shell Dlg" BEGIN ICON 563, 1098, 7, 6, 20, 20, WS_GROUP - LTEXT "Prba poczenia automatycznego zakoczona niepowodzeniem. Czy chcesz wyczy automatyczne poczenia z tej lokalizacji?", 1099, 40, 6, 181, 34, NOT WS_GROUP + LTEXT "Próba połączenia automatycznego zakończona niepowodzeniem. Czy chcesz wyłączyć automatyczne połączenia z tej lokalizacji?", 1099, 40, 6, 181, 34, NOT WS_GROUP PUSHBUTTON "&Tak", 1, 60, 42, 50, 14 DEFPUSHBUTTON "&Nie", 2, 115, 42, 50, 14 END 115 DIALOGEX 0, 0, 263, 124 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "Poczenie z %1" +CAPTION "Połączenie z %1" FONT 8, "MS Shell Dlg" BEGIN CONTROL 1678, 1100, "STATIC", SS_BITMAP, 0, 0, 263, 50 @@ -216,105 +217,105 @@ BEGIN COMBOBOX 1416, 88, 56, 165, 112, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | NOT WS_TABSTOP LTEXT "Wy&bieranie z:", 1415, 9, 77, 71, 8 COMBOBOX 1414, 88, 75, 89, 112, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | NOT WS_TABSTOP - PUSHBUTTON "&Reguy wybierania", 1108, 181, 75, 72, 14 + PUSHBUTTON "&Reguły wybierania", 1108, 181, 75, 72, 14 CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 8, 96, 245, 1 - DEFPUSHBUTTON "&Dzwo", 1590, 8, 103, 61, 14 + DEFPUSHBUTTON "&Dzwoń", 1590, 8, 103, 61, 14 PUSHBUTTON "Anuluj", 1591, 70, 103, 60, 14 - PUSHBUTTON "W&aciwoci", 1107, 132, 103, 60, 14 + PUSHBUTTON "Wł&aściwości", 1107, 132, 103, 60, 14 PUSHBUTTON "&Pomoc", 1592, 194, 103, 60, 14 END 116 DIALOGEX 0, 0, 265, 176 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "Poczenie z %1" +CAPTION "Połączenie z %1" FONT 8, "MS Shell Dlg" BEGIN CONTROL 1678, 1100, "STATIC", SS_BITMAP, 0, 0, 265, 50 - LTEXT "&Nazwa uytkownika:", 1413, 8, 60, 88, 8 + LTEXT "&Nazwa użytkownika:", 1413, 8, 60, 88, 8 EDITTEXT 1104, 103, 57, 154, 14, ES_AUTOHSCROLL - LTEXT "&Haso:", 1112, 8, 79, 88, 8 + LTEXT "&Hasło:", 1112, 8, 79, 88, 8 EDITTEXT 1103, 103, 76, 154, 14, ES_PASSWORD | ES_AUTOHSCROLL CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN, 8, 97, 248, 1 - AUTOCHECKBOX "&Zapisz t nazw uytkownika i haso dla nastpujcych uytkownikw:", 1101, 14, 105, 239, 13, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP + AUTOCHECKBOX "&Zapisz tą nazwę użytkownika i hasło dla następujących użytkowników:", 1101, 14, 105, 239, 13, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP AUTORADIOBUTTON "Tylko &ja", 1622, 26, 120, 226, 11, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP - AUTORADIOBUTTON "&Kady kto uywa tego komputera", 1623, 26, 134, 229, 11, BS_LEFT | BS_TOP | BS_MULTILINE + AUTORADIOBUTTON "&Każdy kto używa tego komputera", 1623, 26, 134, 229, 11, BS_LEFT | BS_TOP | BS_MULTILINE CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 8, 149, 248, 1 - DEFPUSHBUTTON "&Dzwo", 1590, 8, 156, 60, 14, WS_GROUP + DEFPUSHBUTTON "&Dzwoń", 1590, 8, 156, 60, 14, WS_GROUP PUSHBUTTON "Anuluj", 1591, 71, 156, 60, 14 - PUSHBUTTON "W&aciwoci", 1107, 133, 156, 60, 14 + PUSHBUTTON "Wł&aściwości", 1107, 133, 156, 60, 14 PUSHBUTTON "&Pomoc", 1592, 195, 156, 60, 14 END 117 DIALOGEX 0, 0, 263, 192 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "Poczenie z %1" +CAPTION "Połączenie z %1" FONT 8, "MS Shell Dlg" BEGIN CONTROL 1678, 1100, "STATIC", SS_BITMAP, 0, 0, 265, 50 - LTEXT "&Nazwa uytkownika:", 1413, 9, 61, 92, 8 + LTEXT "&Nazwa użytkownika:", 1413, 9, 61, 92, 8 EDITTEXT 1104, 102, 57, 154, 14, ES_AUTOHSCROLL - LTEXT "&Haso:", 1112, 9, 80, 92, 8 + LTEXT "&Hasło:", 1112, 9, 80, 92, 8 EDITTEXT 1103, 102, 76, 154, 14, ES_PASSWORD | ES_AUTOHSCROLL LTEXT "&Domena:", 1110, 9, 99, 91, 8 EDITTEXT 1102, 102, 95, 154, 14, ES_UPPERCASE | ES_AUTOHSCROLL CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN, 9, 116, 247, 1 - AUTOCHECKBOX "&Zapisz t nazw uytkownika i haso dla nastpujcych uytkownikw:", 1101, 12, 123, 243, 13, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP + AUTOCHECKBOX "&Zapisz tą nazwę użytkownika i hasło dla następujących użytkowników:", 1101, 12, 123, 243, 13, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP AUTORADIOBUTTON "Tylko &ja", 1622, 25, 137, 229, 11, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP - AUTORADIOBUTTON "&Kady kto uywa tego komputera", 1623, 25, 151, 230, 11, BS_LEFT | BS_TOP | BS_MULTILINE + AUTORADIOBUTTON "&Każdy kto używa tego komputera", 1623, 25, 151, 230, 11, BS_LEFT | BS_TOP | BS_MULTILINE CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 9, 167, 247, 1 - DEFPUSHBUTTON "Dz&wo", 1590, 8, 173, 60, 14, WS_GROUP + DEFPUSHBUTTON "Dz&woń", 1590, 8, 173, 60, 14, WS_GROUP PUSHBUTTON "Anuluj", 1591, 71, 173, 60, 14 - PUSHBUTTON "W&aciwoci", 1107, 133, 173, 60, 14 + PUSHBUTTON "Wł&aściwości", 1107, 133, 173, 60, 14 PUSHBUTTON "&Pomoc", 1592, 195, 173, 60, 14 END 118 DIALOGEX 0, 0, 265, 220 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "Poczenie z %1" +CAPTION "Połączenie z %1" FONT 8, "MS Shell Dlg" BEGIN CONTROL 1678, 1100, "STATIC", SS_BITMAP, 0, 0, 265, 50 - LTEXT "&Nazwa uytkownika:", 1413, 10, 61, 92, 8 + LTEXT "&Nazwa użytkownika:", 1413, 10, 61, 92, 8 EDITTEXT 1104, 104, 57, 154, 14, ES_AUTOHSCROLL - LTEXT "&Haso:", 1112, 10, 80, 92, 8 + LTEXT "&Hasło:", 1112, 10, 80, 92, 8 EDITTEXT 1103, 104, 76, 154, 14, ES_PASSWORD | ES_AUTOHSCROLL LTEXT "&Domena:", 1110, 10, 100, 92, 8 EDITTEXT 1102, 104, 95, 154, 14, ES_UPPERCASE | ES_AUTOHSCROLL CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN, 11, 116, 247, 1 - AUTOCHECKBOX "&Zapisz t nazw uytkownika i haso dla nastpujcych uytkownikw:", 1101, 16, 124, 239, 13, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP + AUTOCHECKBOX "&Zapisz tą nazwę użytkownika i hasło dla następujących użytkowników:", 1101, 16, 124, 239, 13, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP AUTORADIOBUTTON "Tylko &ja", 1622, 29, 139, 225, 11, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP - AUTORADIOBUTTON "&Kady kto uywa tego komputera", 1623, 29, 152, 225, 11, BS_LEFT | BS_TOP | BS_MULTILINE + AUTORADIOBUTTON "&Każdy kto używa tego komputera", 1623, 29, 152, 225, 11, BS_LEFT | BS_TOP | BS_MULTILINE CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 10, 167, 247, 1 - LTEXT "P&oczenie:", 1412, 10, 177, 90, 8 + LTEXT "P&ołączenie:", 1412, 10, 177, 90, 8 COMBOBOX 1416, 102, 173, 154, 112, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | NOT WS_TABSTOP CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 10, 192, 247, 1 - DEFPUSHBUTTON "Dz&wo", 1590, 10, 199, 60, 14, WS_GROUP + DEFPUSHBUTTON "Dz&woń", 1590, 10, 199, 60, 14, WS_GROUP PUSHBUTTON "Anuluj", 1591, 72, 199, 60, 14 - PUSHBUTTON "W&aciwoci", 1107, 134, 199, 60, 14 + PUSHBUTTON "Wł&aściwości", 1107, 134, 199, 60, 14 PUSHBUTTON "&Pomoc", 1592, 196, 199, 60, 14 END 119 DIALOGEX 0, 0, 265, 200 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "Poczenie z %1" +CAPTION "Połączenie z %1" FONT 8, "MS Shell Dlg" BEGIN CONTROL 1678, 1100, "STATIC", SS_BITMAP, 0, 0, 265, 50 - LTEXT "&Nazwa uytkownika:", 1413, 10, 62, 91, 8 + LTEXT "&Nazwa użytkownika:", 1413, 10, 62, 91, 8 EDITTEXT 1104, 104, 58, 154, 14, ES_AUTOHSCROLL - LTEXT "&Haso:", 1112, 10, 81, 92, 8 + LTEXT "&Hasło:", 1112, 10, 81, 92, 8 EDITTEXT 1103, 104, 77, 154, 14, ES_PASSWORD | ES_AUTOHSCROLL CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN, 10, 97, 247, 1 - AUTOCHECKBOX "&Zapisz t nazw uytkownika i haso dla nastpujcych uytkownikw:", 1101, 12, 103, 243, 13, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP + AUTOCHECKBOX "&Zapisz tą nazwę użytkownika i hasło dla następujących użytkowników:", 1101, 12, 103, 243, 13, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP AUTORADIOBUTTON "Tylko &ja", 1622, 24, 117, 229, 11, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP - AUTORADIOBUTTON "&Kady kto uywa tego komputera", 1623, 24, 132, 229, 11, BS_LEFT | BS_TOP | BS_MULTILINE + AUTORADIOBUTTON "&Każdy kto używa tego komputera", 1623, 24, 132, 229, 11, BS_LEFT | BS_TOP | BS_MULTILINE CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 10, 147, 247, 1 - LTEXT "P&oczenie:", 1412, 13, 157, 88, 8 + LTEXT "P&ołączenie:", 1412, 13, 157, 88, 8 COMBOBOX 1416, 103, 154, 154, 112, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | NOT WS_TABSTOP CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 10, 173, 247, 1 - DEFPUSHBUTTON "&Dzwo", 1590, 10, 180, 60, 14, WS_GROUP + DEFPUSHBUTTON "&Dzwoń", 1590, 10, 180, 60, 14, WS_GROUP PUSHBUTTON "Anuluj", 1591, 72, 180, 60, 14 - PUSHBUTTON "W&aciwoci", 1107, 134, 180, 60, 14 + PUSHBUTTON "Wł&aściwości", 1107, 134, 180, 60, 14 PUSHBUTTON "&Help", 1592, 197, 180, 60, 14 END @@ -327,10 +328,10 @@ BEGIN COMBOBOX 1153, 76, 7, 148, 42, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP AUTOCHECKBOX "&Negocjacja typu linii", 1150, 23, 26, 199, 10, BS_TOP | BS_MULTILINE | WS_GROUP GROUPBOX " ", 1152, 8, 48, 214, 51, WS_GROUP - AUTOCHECKBOX "&Uyj starego, zastrzeonego protokou", 1149, 17, 48, 102, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Użyj starego, zastrzeżonego protokołu", 1149, 17, 48, 102, 10, BS_TOP | BS_MULTILINE LTEXT "&Channels to use:", 1154, 16, 65, 100, 8, NOT WS_GROUP EDITTEXT 1151, 119, 61, 94, 14, ES_AUTOHSCROLL - AUTOCHECKBOX "&Wcz kompresj sprztow", 1148, 16, 82, 198, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Włącz kompresję sprzętową", 1148, 16, 82, 198, 10, BS_TOP | BS_MULTILINE PUSHBUTTON "OK", 1, 99, 109, 60, 14, WS_GROUP PUSHBUTTON "Anuluj", 2, 163, 109, 60, 14 END @@ -377,26 +378,26 @@ BEGIN ICON 15102, 1238, 7, 7, 20, 20 LTEXT "Modem", -1, 25, 27, 24, 8, NOT WS_VISIBLE | NOT WS_GROUP EDITTEXT 1235, 40, 7, 214, 16, ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER - LTEXT "&Prdkoc transmisji (bps):", 1243, 7, 36, 110, 8 + LTEXT "&Prędkośc transmisji (bps):", 1243, 7, 36, 110, 8 COMBOBOX 1239, 119, 34, 136, 186, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | NOT WS_TABSTOP - LTEXT "Protok &Modemu", 1244, 7, 52, 111, 8 + LTEXT "Protokół &Modemu", 1244, 7, 52, 111, 8 COMBOBOX 1245, 119, 50, 136, 186, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | NOT WS_TABSTOP - GROUPBOX "Waciwoci sprztu", 1237, 6, 70, 248, 61, WS_GROUP - AUTOCHECKBOX "W&cz sprztow kontrol przepywu", 1232, 19, 82, 217, 10, BS_TOP | BS_MULTILINE - AUTOCHECKBOX "Wc&z sprztow kontrol bdw", 1231, 19, 98, 217, 10, BS_TOP | BS_MULTILINE - AUTOCHECKBOX "Wcz komp&resj sprztow", 1229, 19, 115, 217, 10, BS_TOP | BS_MULTILINE - AUTOCHECKBOX "Po&ka okno terminala", 1234, 8, 136, 246, 10, BS_TOP | BS_MULTILINE - AUTOCHECKBOX "Wcz &gonik modemu", 1230, 8, 151, 247, 10, BS_TOP | BS_MULTILINE | WS_GROUP + GROUPBOX "Właściwości sprzętu", 1237, 6, 70, 248, 61, WS_GROUP + AUTOCHECKBOX "Włą&cz sprzętową kontrolę przepływu", 1232, 19, 82, 217, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Włąc&z sprzętową kontrolę błędów", 1231, 19, 98, 217, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Włącz komp&resję sprzętową", 1229, 19, 115, 217, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Po&każ okno terminala", 1234, 8, 136, 246, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Włącz &głośnik modemu", 1230, 8, 151, 247, 10, BS_TOP | BS_MULTILINE | WS_GROUP DEFPUSHBUTTON "OK", 1, 129, 171, 60, 14, WS_GROUP PUSHBUTTON "Anuluj", 2, 194, 171, 60, 14 END 126 DIALOGEX 0, 0, 270, 117 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "Wybr skadnikw sieci" +CAPTION "Wybór składników sieci" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Kliknij na rodzaj skadnika sieci, ktry chcesz zainstalowa:", -1, 8, 7, 258, 8 + LTEXT "Kliknij na rodzaj składnika sieci, który chcesz zainstalować:", -1, 8, 7, 258, 8 CONTROL "", 1251, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x0000C04D, 8, 20, 188, 58 GROUPBOX "", -1, 8, 81, 188, 30 LTEXT "", 1250, 12, 90, 177, 17 @@ -406,23 +407,23 @@ END 127 DIALOGEX 16, 20, 260, 135 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION "Poczenia z NetWare albo kompatybilne" +CAPTION "Połączenia z NetWare albo kompatybilne" FONT 8, "MS Shell Dlg" BEGIN ICON 32515, 1278, 7, 7, 21, 20, WS_GROUP - LTEXT "Masz aktywne poczenie z sieci kompatybiln z NetWare. Te poczenia zostan zamknite, przy ustanawianiu poczenia PPP IPX.", 1279, 42, 7, 215, 37 - LTEXT "Przed poczeniem, aby unikn utraty danch, albo zamknij wszystkie pliki, ktre korzystaj z tych pocze albo odznacz IPX z listy Protokow Sieciowych tego poczenia.", 1280, 42, 46, 215, 38, NOT WS_GROUP - AUTOCHECKBOX "&Nie wywietlaj wicej tej wiadomoci", 1277, 42, 86, 215, 10, BS_TOP | BS_MULTILINE | WS_GROUP + LTEXT "Masz aktywne połączenie z siecią kompatybilną z NetWare. Te połączenia zostaną zamknięte, przy ustanawianiu połączenia PPP IPX.", 1279, 42, 7, 215, 37 + LTEXT "Przed połączeniem, aby uniknąć utraty danch, albo zamknij wszystkie pliki, które korzystają z tych połączeń albo odznacz IPX z listy Protokołów Sieciowych tego połączenia.", 1280, 42, 46, 215, 38, NOT WS_GROUP + AUTOCHECKBOX "&Nie wyświetlaj więcej tej wiadomości", 1277, 42, 86, 215, 10, BS_TOP | BS_MULTILINE | WS_GROUP DEFPUSHBUTTON "OK", 1, 65, 112, 60, 14, WS_GROUP PUSHBUTTON "Anuluj", 2, 134, 112, 60, 14 END 128 DIALOGEX 7, 22, 236, 90 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "Rczne wybieranie" +CAPTION "Ręczne wybieranie" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Podnie suchawk i wybierz numer (albo popro operatora o wybranie). Po zakoczeniu wybierania, nacinij OK. Poczekaj, a suchawka ucichnie i wtedy si rozcz.", 1281, 8, 8, 219, 32 + LTEXT "Podnieś słuchawkę i wybierz numer (albo poproś operatora o wybranie). Po zakończeniu wybierania, naciśnij OK. Poczekaj, aż słuchawka ucichnie i wtedy się rozłącz.", 1281, 8, 8, 219, 32 LTEXT "Numer:", 1282, 8, 46, 91, 8 LTEXT "", 1283, 103, 46, 126, 8, NOT WS_GROUP DEFPUSHBUTTON "OK", 1, 104, 70, 60, 14, WS_GROUP @@ -431,14 +432,14 @@ END 129 DIALOGEX 6, 20, 260, 85 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "Efekt poczenia Protokou Sieciowego" +CAPTION "Efekt połączenia Protokołu Sieciowego" FONT 8, "MS Shell Dlg" BEGIN ICON 32516, 1328, 7, 7, 21, 20, WS_GROUP LTEXT "", 1329, 38, 7, 216, 24, NOT WS_GROUP - AUTOCHECKBOX "&Nie korzystaj nastpnym razem z niedziaajcych protokow", 1327, 40, 44, 215, 10, BS_TOP | BS_MULTILINE | WS_GROUP + AUTOCHECKBOX "&Nie korzystaj następnym razem z niedziałających protokołów", 1327, 40, 44, 215, 10, BS_TOP | BS_MULTILINE | WS_GROUP PUSHBUTTON "&Akceptuj", 1, 129, 64, 60, 14 - PUSHBUTTON "&Rozcz si", 2, 193, 64, 60, 14 + PUSHBUTTON "&Rozłącz się", 2, 193, 64, 60, 14 END 133 DIALOGEX 6, 18, 231, 211 @@ -446,13 +447,13 @@ STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION CAPTION "Ustawienia logowania X.25" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Wybierz swojego providera sieci X.25 i wprowad adres serwera zdalnego X.121:", 1408, 7, 4, 220, 27 - LTEXT "&Sie:", 1410, 9, 35, 213, 8, NOT WS_GROUP + LTEXT "Wybierz swojego providera sieci X.25 i wprowadź adres serwera zdalnego X.121:", 1408, 7, 4, 220, 27 + LTEXT "&Sieć:", 1410, 9, 35, 213, 8, NOT WS_GROUP COMBOBOX 1406, 9, 46, 215, 125, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | NOT WS_TABSTOP LTEXT "&Adres X.121:", 1407, 9, 66, 213, 8, NOT WS_GROUP EDITTEXT 1402, 8, 77, 215, 14, ES_AUTOHSCROLL GROUPBOX "Opcjonalne", 1405, 8, 95, 215, 79 - LTEXT "&Dane uytkownika:", 1411, 19, 109, 182, 8, NOT WS_GROUP + LTEXT "&Dane użytkownika:", 1411, 19, 109, 182, 8, NOT WS_GROUP EDITTEXT 1404, 19, 120, 193, 14, ES_AUTOHSCROLL LTEXT "&Udogodnienia:", 1409, 19, 138, 182, 8, NOT WS_GROUP EDITTEXT 1403, 19, 149, 193, 14, ES_AUTOHSCROLL @@ -465,11 +466,11 @@ STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE | WS_CAPTION CAPTION "Autowybieranie" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Jeeli zostaniesz rozczony z sieci, Autowybieranie sprbuje podczy si ponownie, w chwili gdy bdziesz potrzebowa dostpu do danej sieci.", -1, 7, 4, 219, 32 - LTEXT "&Wcz Autowybieranie:", 1006, 8, 42, 213, 8 + LTEXT "Jeżeli zostaniesz rozłączony z sieci, Autowybieranie spróbuje podłączyć się ponownie, w chwili gdy będziesz potrzebować dostępu do danej sieci.", -1, 7, 4, 219, 32 + LTEXT "&Włącz Autowybieranie:", 1006, 8, 42, 213, 8 CONTROL "", 1004, "SYSLISTVIEW32", WS_BORDER | WS_GROUP | WS_TABSTOP | 0x0000C401, 7, 53, 216, 109 - AUTOCHECKBOX "&Zawsze pytaj mnie przed prb Autowybierania", 1496, 8, 170, 218, 9, BS_TOP | BS_MULTILINE - AUTOCHECKBOX "&Wycz Autowybieranie, gdy jestem zalogowany", 1550, 8, 185, 217, 9, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Zawsze pytaj mnie przed próbą Autowybierania", 1496, 8, 170, 218, 9, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Wyłącz Autowybieranie, gdy jestem zalogowany", 1550, 8, 185, 217, 9, BS_TOP | BS_MULTILINE END 147 DIALOGEX 6, 18, 230, 215 @@ -477,12 +478,12 @@ STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE | WS_CAPTION CAPTION "Wybieranie" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Te ustawienia odnosz si do 'Zaloguj przy pomocy sieci Dial-Up' po nacisniciu Ctrl-Alt-Del podczas logowania. Tylko Administratorzy maj dostp do tych ustawie.", 1007, 7, 4, 221, 40, NOT WS_GROUP - LTEXT "&Ilo prb poczenia:", 1005, 7, 55, 154, 8 + LTEXT "Te ustawienia odnoszą się do 'Zaloguj przy pomocy sieci Dial-Up' po nacisnięciu Ctrl-Alt-Del podczas logowania. Tylko Administratorzy mają dostęp do tych ustawień.", 1007, 7, 4, 221, 40, NOT WS_GROUP + LTEXT "&Ilość prób połączenia:", 1005, 7, 55, 154, 8 EDITTEXT 1001, 164, 52, 60, 14, ES_AUTOHSCROLL - LTEXT "&Sekund przerwy pomidzy prbami poczenia:", 1009, 7, 73, 156, 8, NOT WS_GROUP + LTEXT "&Sekund przerwy pomiędzy próbami połączenia:", 1009, 7, 73, 156, 8, NOT WS_GROUP EDITTEXT 1003, 164, 70, 60, 14, ES_AUTOHSCROLL - LTEXT "Sekund &bezczynnoci przed rozczeniem:", 1008, 7, 91, 154, 8, NOT WS_GROUP + LTEXT "Sekund &bezczynności przed rozłączeniem:", 1008, 7, 91, 154, 8, NOT WS_GROUP EDITTEXT 1002, 164, 88, 60, 14, ES_AUTOHSCROLL END @@ -491,25 +492,25 @@ STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE | WS_CAPTION CAPTION "Oddzwanianie" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Niektre serwery oferuj moliwo oddzwonienia do ciebie, w celu redukcji twoich opat za poczenie. Okrel czy chcesz skorzysta z Oddzwaniania. (Oddzwanianie nie dziaa w przypadku pocze z Wirtualnymi Sieciami Prywatnymi (VPN).)", 1043, 8, 4, 219, 43 + LTEXT "Niektóre serwery oferują możliwość oddzwonienia do ciebie, w celu redukcji twoich opłat za połączenie. Określ czy chcesz skorzystać z Oddzwaniania. (Oddzwanianie nie działa w przypadku połączeń z Wirtualnymi Sieciami Prywatnymi (VPN).)", 1043, 8, 4, 219, 43 AUTORADIOBUTTON "&Bez Oddzwaniania", 1041, 7, 48, 219, 10, BS_TOP | BS_MULTILINE | WS_GROUP - AUTORADIOBUTTON "&Pytaj mnie podczas prby poczenia, gdy serwer oferuje odddzwanianie", 1040, 7, 61, 219, 10, BS_TOP | BS_MULTILINE - AUTORADIOBUTTON "&Oddzwanianie zawsze wczone, w przypadku pocze z numerami z listy:", 1042, 7, 74, 219, 10, BS_TOP | BS_MULTILINE + AUTORADIOBUTTON "&Pytaj mnie podczas próby połączenia, gdy serwer oferuje odddzwanianie", 1040, 7, 61, 219, 10, BS_TOP | BS_MULTILINE + AUTORADIOBUTTON "&Oddzwanianie zawsze włączone, w przypadku połączeń z numerami z listy:", 1042, 7, 74, 219, 10, BS_TOP | BS_MULTILINE CONTROL "", 1037, "SYSLISTVIEW32", WS_BORDER | WS_GROUP | WS_TABSTOP | 0x00008401, 16, 88, 204, 94 PUSHBUTTON "&Edytuj", 1039, 96, 190, 60, 14 - PUSHBUTTON "&Usu..", 1038, 159, 190, 60, 14 + PUSHBUTTON "&Usuń..", 1038, 159, 190, 60, 14 END 149 DIALOGEX 6, 18, 317, 142 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Musisz ustawi dane uytkownika, ktrych bd uywa routery zdalne, podczas czenia si z tym interface. Konto uytkownika zostanie utworzone na routerze zdalnym, z informacj o twoim poczeniu.", 1094, 8, 5, 307, 35 - LTEXT "&Nazwa uytkownika:", 1078, 8, 47, 124, 8, NOT WS_GROUP + LTEXT "Musisz ustawić dane użytkownika, których będą używaź routery zdalne, podczas łączenia się z tym interface. Konto użytkownika zostanie utworzone na routerze zdalnym, z informacją o twoim połączeniu.", 1094, 8, 5, 307, 35 + LTEXT "&Nazwa użytkownika:", 1078, 8, 47, 124, 8, NOT WS_GROUP EDITTEXT 1074, 135, 45, 175, 12, ES_AUTOHSCROLL | WS_DISABLED - LTEXT "&Haso:", 1077, 8, 68, 124, 8, NOT WS_GROUP + LTEXT "&Hasło:", 1077, 8, 68, 124, 8, NOT WS_GROUP EDITTEXT 1073, 135, 66, 175, 12, ES_PASSWORD | ES_AUTOHSCROLL - LTEXT "&Potwierdzenie hasa:", 1075, 8, 90, 124, 8, NOT WS_GROUP + LTEXT "&Potwierdzenie hasła:", 1075, 8, 90, 124, 8, NOT WS_GROUP EDITTEXT 1071, 135, 87, 175, 12, ES_PASSWORD | ES_AUTOHSCROLL END @@ -517,14 +518,14 @@ END STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Musisz ustawi dane uytkownika, ktrych bd uywa routery zdalne, podczas czenia si z tym interface. Konto uytkownika zostanie utworzone na routerze zdalnym, z informacj o twoim poczeniu.", 1094, 8, 5, 308, 33 - LTEXT "&Nazwa uytkownika:", 1096, 8, 43, 130, 8, NOT WS_GROUP + LTEXT "Musisz ustawić dane użytkownika, których będą używaź routery zdalne, podczas łączenia się z tym interface. Konto użytkownika zostanie utworzone na routerze zdalnym, z informacją o twoim połączeniu.", 1094, 8, 5, 308, 33 + LTEXT "&Nazwa użytkownika:", 1096, 8, 43, 130, 8, NOT WS_GROUP EDITTEXT 1091, 140, 40, 175, 12, ES_AUTOHSCROLL LTEXT "&Domena:", 1093, 8, 63, 130, 8, NOT WS_GROUP EDITTEXT 1089, 140, 60, 175, 12, ES_UPPERCASE | ES_AUTOHSCROLL - LTEXT "&Haso:", 1095, 8, 81, 130, 8, NOT WS_GROUP + LTEXT "&Hasło:", 1095, 8, 81, 130, 8, NOT WS_GROUP EDITTEXT 1090, 140, 78, 175, 12, ES_PASSWORD | ES_AUTOHSCROLL - LTEXT "&Potwierdzenie hasa:", 1092, 8, 99, 130, 8, NOT WS_GROUP + LTEXT "&Potwierdzenie hasła:", 1092, 8, 99, 130, 8, NOT WS_GROUP EDITTEXT 1088, 140, 96, 175, 12, ES_PASSWORD | ES_AUTOHSCROLL END @@ -532,54 +533,54 @@ END STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Wprowad nazw dla tego poczenia:", -1, 8, 4, 190, 8 + LTEXT "Wprowadź nazwę dla tego połączenia:", -1, 8, 4, 190, 8 EDITTEXT 1114, 8, 17, 190, 12, ES_AUTOHSCROLL - LTEXT "Nacinij Zakocz by zapisa je w katalogu Poczenia Sieciowe.", -1, 8, 38, 193, 8 - LTEXT "Aby wyedytowa pniej to poczenie, zaznacz je, kliknij na menu Plik, a nastpnie na Waciwoci.", -1, 8, 58, 193, 16 + LTEXT "Naciśnij Zakończ by zapisać je w katalogu Połączenia Sieciowe.", -1, 8, 38, 193, 8 + LTEXT "Aby wyedytować później to połączenie, zaznacz je, kliknij na menu Plik, a następnie na Właściwości.", -1, 8, 58, 193, 16 END 155 DIALOGEX 0, 0, 231, 215 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION -CAPTION "Oglne" +CAPTION "Ogólne" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "P&ocz za pomoc:", 1124, 7, 5, 219, 8 + LTEXT "P&ołącz za pomocą:", 1124, 7, 5, 219, 8 CONTROL "", 1128, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x00004C0D, 7, 17, 198, 44, WS_EX_CLIENTEDGE - PUSHBUTTON "&Gra", 1132, 210, 18, 16, 14, BS_ICON - PUSHBUTTON "&D", 1131, 210, 36, 16, 14, BS_ICON - AUTOCHECKBOX "&Wszystkie urzdzenia wybieraj te same numery", 1119, 9, 66, 133, 14, BS_TOP | BS_MULTILINE + PUSHBUTTON "&Góra", 1132, 210, 18, 16, 14, BS_ICON + PUSHBUTTON "&Dół", 1131, 210, 36, 16, 14, BS_ICON + AUTOCHECKBOX "&Wszystkie urządzenia wybierają te same numery", 1119, 9, 66, 133, 14, BS_TOP | BS_MULTILINE PUSHBUTTON "&Konfiguruj", 1130, 144, 66, 60, 14 - GROUPBOX "Przykad", 1125, 8, 84, 215, 100, WS_GROUP + GROUPBOX "Przykład", 1125, 8, 84, 215, 100, WS_GROUP LTEXT "&Numer kierunkowy:", 1133, 17, 102, 52, 8 COMBOBOX 1122, 17, 112, 52, 110, CBS_DROPDOWN | WS_VSCROLL | NOT WS_TABSTOP LTEXT "Nu&mer telefoniczny:", 1135, 71, 102, 139, 8 EDITTEXT 1123, 73, 112, 79, 14, ES_AUTOHSCROLL PUSHBUTTON "&Inne", 1129, 154, 112, 60, 14 - LTEXT "Num&er midzynarodowy:", 1134, 17, 132, 197, 8 + LTEXT "Num&er międzynarodowy:", 1134, 17, 132, 197, 8 COMBOBOX 1126, 17, 143, 193, 130, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | NOT WS_TABSTOP - AUTOCHECKBOX "&Uyj regu wybierania", 1121, 17, 163, 132, 14, BS_TOP | BS_MULTILINE - PUSHBUTTON "&Reguy wybierania", 1136, 151, 161, 60, 14 - AUTOCHECKBOX "P&oka ikon w zasobniku systemowym podczas trwania poczenia", 1120, 10, 192, 214, 19, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Użyj reguł wybierania", 1121, 17, 163, 132, 14, BS_TOP | BS_MULTILINE + PUSHBUTTON "&Reguły wybierania", 1136, 151, 161, 60, 14 + AUTOCHECKBOX "P&okaż ikonę w zasobniku systemowym podczas trwania połączenia", 1120, 10, 192, 214, 19, BS_TOP | BS_MULTILINE END 156 DIALOGEX 0, 0, 231, 215 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION -CAPTION "Oglne" +CAPTION "Ogólne" FONT 8, "MS Shell Dlg" BEGIN PUSHBUTTON "K&onfiguruj", 1130, 164, 38, 60, 14 - GROUPBOX "Przykad", 1125, 8, 55, 217, 100, WS_GROUP + GROUPBOX "Przykład", 1125, 8, 55, 217, 100, WS_GROUP LTEXT "&Numer kierunkowy:", 1133, 17, 72, 48, 8 COMBOBOX 1122, 17, 83, 48, 119, CBS_DROPDOWN | WS_VSCROLL | NOT WS_TABSTOP LTEXT "Nu&mer telefoniczny:", 1135, 71, 72, 146, 8 EDITTEXT 1123, 71, 83, 81, 14, ES_AUTOHSCROLL PUSHBUTTON "&Inne", 1129, 155, 83, 63, 14 - LTEXT "Num&er midzynarodowy:", 1134, 17, 103, 193, 8 + LTEXT "Num&er międzynarodowy:", 1134, 17, 103, 193, 8 COMBOBOX 1126, 17, 114, 201, 130, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | NOT WS_TABSTOP - AUTOCHECKBOX "&Uyj regu wybierania", 1121, 19, 134, 136, 12, BS_TOP | BS_MULTILINE - PUSHBUTTON "&Reguy wybierania", 1136, 157, 132, 60, 14 - AUTOCHECKBOX "P&oka ikon w zasobniku systemowym podczas trwania poczenia", 1120, 12, 164, 209, 18, BS_TOP | BS_MULTILINE - LTEXT "Pocz za pomoc:", 1124, 8, 5, 217, 8 + AUTOCHECKBOX "&Użyj reguł wybierania", 1121, 19, 134, 136, 12, BS_TOP | BS_MULTILINE + PUSHBUTTON "&Reguły wybierania", 1136, 157, 132, 60, 14 + AUTOCHECKBOX "P&okaż ikonę w zasobniku systemowym podczas trwania połączenia", 1120, 12, 164, 209, 18, BS_TOP | BS_MULTILINE + LTEXT "Połącz za pomocą:", 1124, 8, 5, 217, 8 CONTROL "", 1127, "SYSLISTVIEW32", WS_DISABLED | WS_BORDER | 0x0000EC0D, 7, 18, 217, 15 END @@ -588,13 +589,13 @@ STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION CAPTION "Widok" FONT 8, "MS Shell Dlg" BEGIN - AUTOCHECKBOX "&Poka numer telefoniczny przed wybieraniem", 1142, 8, 10, 224, 10, WS_GROUP - AUTOCHECKBOX "Poka ustawienia &lokalizacji przed wybieraniem", 1139, 8, 27, 224, 10 - AUTOCHECKBOX "&Zezwl na edycj lokalizacji podczas logowania", 1140, 21, 43, 212, 10 - AUTOCHECKBOX "Poka p&ostp poczenia podczas wybierania", 1143, 8, 59, 224, 10 + AUTOCHECKBOX "&Pokaż numer telefoniczny przed wybieraniem", 1142, 8, 10, 224, 10, WS_GROUP + AUTOCHECKBOX "Pokaż ustawienia &lokalizacji przed wybieraniem", 1139, 8, 27, 224, 10 + AUTOCHECKBOX "&Zezwól na edycję lokalizacji podczas logowania", 1140, 21, 43, 212, 10 + AUTOCHECKBOX "Pokaż p&ostęp połączenia podczas wybierania", 1143, 8, 59, 224, 10 AUTOCHECKBOX "Z&amknij po wybraniu numeru", 1137, 8, 76, 224, 10 - AUTOCHECKBOX "Zez&wl na edycj ksiki telefonicznej podczas logowania", 1141, 8, 94, 224, 10 - AUTOCHECKBOX "&Uyj kreatora konfiguracji do tworzenia nowych wpisw do ksiki telefonicznej", 1144, 22, 111, 210, 10 + AUTOCHECKBOX "Zez&wól na edycję książki telefonicznej podczas logowania", 1141, 8, 94, 224, 10 + AUTOCHECKBOX "&Użyj kreatora konfiguracji do tworzenia nowych wpisów do książki telefonicznej", 1144, 22, 111, 210, 10 END 158 DIALOGEX 6, 18, 235, 160 @@ -602,12 +603,12 @@ STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION CAPTION "Widok" FONT 8, "MS Shell Dlg" BEGIN - AUTOCHECKBOX "&Poka numer telefoniczny przed wybieraniem", 1142, 8, 10, 223, 10, WS_GROUP - AUTOCHECKBOX "Poka ustawienia &lokalizacji przed wybieraniem", 1139, 8, 27, 206, 10 - AUTOCHECKBOX "Uruchom &monitor pocze dial-up przed wybieraniem", 1138, 8, 44, 226, 10 - AUTOCHECKBOX "Poka p&ostp poczenia podczas wybierania", 1143, 8, 61, 224, 10 + AUTOCHECKBOX "&Pokaż numer telefoniczny przed wybieraniem", 1142, 8, 10, 223, 10, WS_GROUP + AUTOCHECKBOX "Pokaż ustawienia &lokalizacji przed wybieraniem", 1139, 8, 27, 206, 10 + AUTOCHECKBOX "Uruchom &monitor połączeń dial-up przed wybieraniem", 1138, 8, 44, 226, 10 + AUTOCHECKBOX "Pokaż p&ostęp połączenia podczas wybierania", 1143, 8, 61, 224, 10 AUTOCHECKBOX "Z&amknij po wybraniu numeru", 1137, 8, 79, 220, 10 - AUTOCHECKBOX "&Uyj kreatora konfiguracji do tworzenia nowych wpisw do ksiki telefonicznej", 1144, 8, 97, 220, 10 + AUTOCHECKBOX "&Użyj kreatora konfiguracji do tworzenia nowych wpisów do książki telefonicznej", 1144, 8, 97, 220, 10 AUTOCHECKBOX "Always prompt &before auto-dialing", 1136, 8, 114, 220, 10 END @@ -615,40 +616,40 @@ END STYLE DS_SHELLFONT | DS_MODALFRAME | WS_CHILD | WS_VISIBLE | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Wybierz nazw dla tego interface pocze typu dial-up. Zwykle wybiera si nazw sieci lub routera z ktrymi bdzie si czy.", 1158, 7, 5, 309, 29 + LTEXT "Wybierz nazwę dla tego interface połączeń typu dial-up. Zwykle wybiera się nazwę sieci lub routera z którymi będzie się łączyć.", 1158, 7, 5, 309, 29 LTEXT "&Nazwa Interface:", 1159, 17, 41, 285, 8, NOT WS_GROUP EDITTEXT 1157, 17, 53, 284, 12, ES_AUTOHSCROLL - AUTOCHECKBOX "Znam si na interface pocze typu dial-up i chc samodzielnie ustawi waciwoci", 1156, 24, 100, 258, 31, BS_TOP | BS_MULTILINE | NOT WS_VISIBLE | WS_DISABLED + AUTOCHECKBOX "Znam się na interface połączeń typu dial-up i chcę samodzielnie ustawić właściwości", 1156, 24, 100, 258, 31, BS_TOP | BS_MULTILINE | NOT WS_VISIBLE | WS_DISABLED END 162 DIALOGEX 0, 0, 230, 215 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION "Bezpieczestwo" +CAPTION "Bezpieczeństwo" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "Ustawienia bezpieczestwa", 1580, 8, 3, 215, 139 + GROUPBOX "Ustawienia bezpieczeństwa", 1580, 8, 3, 215, 139 AUTORADIOBUTTON "&Typowe (ustawienia zalecane)", 1540, 14, 16, 201, 9, BS_NOTIFY | WS_GROUP - AUTORADIOBUTTON "&Zaawansowane (ustawienia wasne)", 1541, 14, 102, 198, 8, BS_NOTIFY - LTEXT "&Uwiarygodnij moj tosamo za pomoc:", 1537, 26, 29, 187, 8, NOT WS_GROUP + AUTORADIOBUTTON "&Zaawansowane (ustawienia własne)", 1541, 14, 102, 198, 8, BS_NOTIFY + LTEXT "&Uwiarygodnij moją tożsamość za pomocą:", 1537, 26, 29, 187, 8, NOT WS_GROUP COMBOBOX 1178, 26, 40, 184, 78, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | NOT WS_TABSTOP - AUTOCHECKBOX "&Automagicznie uyj mojej nazwy uytkownika i hasa z ReactOS (domeny te o ile istniej)", 1174, 26, 58, 184, 20, BS_TOP | BS_MULTILINE - AUTOCHECKBOX "&Wymagaj szyfrowania danych (rozcz si w razie braku)", 1169, 26, 82, 183, 10, BS_TOP | BS_MULTILINE - LTEXT "Zmiana tych ustawie wymaga wiedzy o protokoach bezpieczestwa.", 1539, 15, 114, 134, 20 + AUTOCHECKBOX "&Automagicznie użyj mojej nazwy użytkownika i hasła z ReactOS (domeny też o ile istniej)", 1174, 26, 58, 184, 20, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Wymagaj szyfrowania danych (rozłącz się w razie braku)", 1169, 26, 82, 183, 10, BS_TOP | BS_MULTILINE + LTEXT "Zmiana tych ustawień wymaga wiedzy o protokołach bezpieczeństwa.", 1539, 15, 114, 134, 20 PUSHBUTTON "&Ustawienia", 1180, 151, 115, 60, 14 GROUPBOX "Skrypty i logowanie interaktywne", 1177, 8, 146, 215, 62, WS_GROUP - AUTOCHECKBOX "&Poka okno terminala", 1173, 14, 159, 198, 11, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Pokaż okno terminala", 1173, 14, 159, 198, 11, BS_TOP | BS_MULTILINE AUTOCHECKBOX "Uruchom &skrypt:", 1172, 14, 172, 57, 10, BS_TOP | BS_MULTILINE COMBOBOX 1179, 72, 171, 140, 104, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | NOT WS_TABSTOP PUSHBUTTON "&Edytuj....", 1182, 87, 187, 60, 14 - PUSHBUTTON "&Przegldaj", 1181, 151, 187, 60, 14 + PUSHBUTTON "&Przeglądaj", 1181, 151, 187, 60, 14 END 163 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Masz wicej ni jedno urzdzenie dial-up na tym komputerze.", -1, 6, 3, 307, 13 - LTEXT "&Wybierz urzdzenie ktrym chcesz si poczy:", -1, 6, 15, 307, 11 + LTEXT "Masz więcej niż jedno urządzenie dial-up na tym komputerze.", -1, 6, 3, 307, 13 + LTEXT "&Wybierz urządzenie którym chcesz się połączyć:", -1, 6, 15, 307, 11 CONTROL "", 1228, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x0000C415, 7, 28, 304, 77 END @@ -657,14 +658,14 @@ STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION CAPTION "Sieci" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "&Rodzaj serwera dial-up do ktrego si cz:", 1583, 7, 4, 219, 8 + LTEXT "&Rodzaj serwera dial-up do którego się łączę:", 1583, 7, 4, 219, 8 COMBOBOX 1418, 7, 17, 215, 46, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP PUSHBUTTON "&Ustawienia", 1419, 160, 35, 60, 14 - LTEXT "To &poczenie korzysta z nastpujcych skadnikw:", 1684, 8, 64, 219, 10 + LTEXT "To &połączenie korzysta z następujących składników:", 1684, 8, 64, 219, 10 CONTROL "", 1251, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x0000C40D, 7, 75, 216, 53 PUSHBUTTON "&Instaluj..", 1252, 7, 133, 67, 14 PUSHBUTTON "&Odinstaluj", 1254, 80, 133, 67, 14 - PUSHBUTTON "&Waciwoci", 1253, 153, 133, 67, 14 + PUSHBUTTON "&Właściwości", 1253, 153, 133, 67, 14 GROUPBOX "Opis", 1585, 9, 158, 213, 43 LTEXT "", 1250, 18, 167, 195, 25 END @@ -673,7 +674,7 @@ END STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Wprowad adres IP serwera DNS lub WINS w sieci zdalnej, albo pozostaw 0.0.0.0 jeli oczekujesz, e router ustawi go za ciebie, bd jeli nie go znasz.", 1275, 7, 2, 311, 25 + LTEXT "Wprowadź adres IP serwera DNS lub WINS w sieci zdalnej, albo pozostaw 0.0.0.0 jeśli oczekujesz, że router ustawi go za ciebie, bądź jeśli nie go znasz.", 1275, 7, 2, 311, 25 LTEXT "Serwer &DNS:", 1274, 7, 29, 160, 8, NOT WS_GROUP CONTROL "", 1272, "RASIPADDRESS", WS_TABSTOP, 21, 41, 85, 12 LTEXT "Serwer &WINS:", 1276, 7, 65, 166, 8, NOT WS_GROUP @@ -686,81 +687,81 @@ CAPTION "Opcje" FONT 8, "MS Shell Dlg" BEGIN GROUPBOX "Opcje wybierania", 1289, 7, 2, 213, 64 - AUTOCHECKBOX "&Wywietlaj przebieg poczenia", 1284, 16, 14, 201, 10 - AUTOCHECKBOX "&Zapytaj o nazw uytkownika, haso, certyfikat itd.", 1554, 16, 27, 201, 10 - AUTOCHECKBOX "Docz domen logowania z &ReactOS", 1555, 16, 39, 201, 10 + AUTOCHECKBOX "&Wyświetlaj przebieg połączenia", 1284, 16, 14, 201, 10 + AUTOCHECKBOX "&Zapytaj o nazwę użytkownika, hasło, certyfikat itd.", 1554, 16, 27, 201, 10 + AUTOCHECKBOX "Dołącz domenę logowania z &ReactOS", 1555, 16, 39, 201, 10 AUTOCHECKBOX "Zapytaj o &numer telefoniczny", 1285, 16, 52, 200, 10, BS_TOP | BS_MULTILINE GROUPBOX "Wybieranie ponowne", 1290, 6, 72, 213, 79 - LTEXT "&Ilo prb wybierania:", 1300, 16, 87, 123, 8 + LTEXT "&Ilość prób wybierania:", 1300, 16, 87, 123, 8 EDITTEXT 1287, 141, 84, 69, 14, ES_AUTOHSCROLL | ES_NUMBER - LTEXT "&Sekund pomidzy prbami wybierania:", 1301, 16, 103, 123, 8 + LTEXT "&Sekund pomiędzy próbami wybierania:", 1301, 16, 103, 123, 8 COMBOBOX 1292, 141, 101, 70, 123, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - LTEXT "Sekund &bezczynnoci przed zawieszeniem poczenia:", 1299, 16, 120, 123, 8 + LTEXT "Sekund &bezczynności przed zawieszeniem połączenia:", 1299, 16, 120, 123, 8 COMBOBOX 1291, 141, 116, 70, 108, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - AUTOCHECKBOX "Wybieraj &ponownie przy zerwaniu poczenia", 1286, 16, 136, 199, 10, BS_TOP | BS_MULTILINE - GROUPBOX "Wiele urzdze", 1288, 7, 156, 213, 32 + AUTOCHECKBOX "Wybieraj &ponownie przy zerwaniu połączenia", 1286, 16, 136, 199, 10, BS_TOP | BS_MULTILINE + GROUPBOX "Wiele urządzeń", 1288, 7, 156, 213, 32 COMBOBOX 1551, 16, 169, 128, 45, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP PUSHBUTTON "&Konfiguruj", 1293, 150, 168, 60, 14 PUSHBUTTON "&X.25", 1295, 7, 194, 50, 14 - PUSHBUTTON "P&oczenie ""tunel"" wirtualne", 1294, 62, 194, 120, 14, NOT WS_VISIBLE | WS_DISABLED + PUSHBUTTON "P&ołączenie wirtualne ""tunel""", 1294, 62, 194, 120, 14, NOT WS_VISIBLE | WS_DISABLED END 168 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Kreator konfiguracji poaczenia" +CAPTION "Kreator konfiguracji połaczenia" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Wpisz numer telefoniczny poniej. ", -1, 7, 4, 306, 14 + LTEXT "Wpisz numer telefoniczny poniżej. ", -1, 7, 4, 306, 14 LTEXT "&Numer telefoniczny:", 1308, 7, 19, 130, 8 EDITTEXT 1304, 7, 30, 304, 14, ES_AUTOHSCROLL - LTEXT "Prawdopodobnie bdzie trzeba uy cyfry ""1"", numeru kierunkowego, albo obydwu. Jeli nie jeste pewien, wyprbuj dany numer na swoim telefonie. Jeli usyszysz sygna modemu, numer jest poprawny.", -1, 20, 50, 291, 53 + LTEXT "Prawdopodobnie będzie trzeba użyć cyfry ""1"", numeru kierunkowego, albo obydwu. Jeśli nie jesteś pewien, wypróbuj żądany numer na swoim telefonie. Jeśli usłyszysz sygnał modemu, numer jest poprawny.", -1, 20, 50, 291, 53 END 169 DIALOGEX 6, 18, 235, 135 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION "Ksika telefoniczna" +CAPTION "Książka telefoniczna" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Uyj poniszej ksizki telefonicznej:", 1326, 8, 8, 222, 8 - AUTORADIOBUTTON "&Systemowa ksika telefoniczna", 1325, 14, 22, 216, 10, WS_GROUP - AUTORADIOBUTTON "&Osobista ksizka telefoniczna", 1324, 14, 34, 216, 10 - AUTORADIOBUTTON "&Wybrana ksika telefoniczna:", 1323, 14, 46, 217, 10 + LTEXT "Użyj poniższej ksiązki telefonicznej:", 1326, 8, 8, 222, 8 + AUTORADIOBUTTON "&Systemowa książka telefoniczna", 1325, 14, 22, 216, 10, WS_GROUP + AUTORADIOBUTTON "&Osobista ksiązka telefoniczna", 1324, 14, 34, 216, 10 + AUTORADIOBUTTON "&Wybrana książka telefoniczna:", 1323, 14, 46, 217, 10 COMBOBOX 1321, 26, 61, 201, 77, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_GROUP | NOT WS_TABSTOP - PUSHBUTTON "&Przegldaj", 1322, 167, 81, 60, 14 + PUSHBUTTON "&Przeglądaj", 1322, 167, 81, 60, 14 END 170 DIALOGEX 6, 18, 235, 135 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION "Ksika telefoniczna" +CAPTION "Książka telefoniczna" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Uyj poniszej ksizki telefonicznej:", 1326, 8, 8, 223, 8 - AUTORADIOBUTTON "&Systemowa ksika telefoniczna", 1325, 14, 22, 217, 10, WS_GROUP - AUTORADIOBUTTON "&Wybrana ksika telefoniczna:", 1323, 14, 36, 216, 10 + LTEXT "Użyj poniższej ksiązki telefonicznej:", 1326, 8, 8, 223, 8 + AUTORADIOBUTTON "&Systemowa książka telefoniczna", 1325, 14, 22, 217, 10, WS_GROUP + AUTORADIOBUTTON "&Wybrana książka telefoniczna:", 1323, 14, 36, 216, 10 COMBOBOX 1321, 26, 51, 203, 77, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_GROUP | NOT WS_TABSTOP - PUSHBUTTON "&Przegldaj", 1322, 169, 69, 60, 14 + PUSHBUTTON "&Przeglądaj", 1322, 169, 69, 60, 14 END 171 DIALOGEX 6, 18, 317, 144 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Wprowad swj adres IP w sieci zdalnej, albo zostaw 0.0.0.0 jeli oczekujesz, e router zdalny ustawi to automagicznie. Zwykle routery operatora ustawiaj ten adres automagicznie.", 1331, 5, 4, 308, 35 - LTEXT "Mj adres &IP:", 1332, 4, 51, 100, 8, NOT WS_GROUP + LTEXT "Wprowadź swój adres IP w sieci zdalnej, albo zostaw 0.0.0.0 jeśli oczekujesz, że router zdalny ustawi to automagicznie. Zwykle routery operatora ustawiają ten adres automagicznie.", 1331, 5, 4, 308, 35 + LTEXT "Mój adres &IP:", 1332, 4, 51, 100, 8, NOT WS_GROUP CONTROL "", 1330, "RASIPADDRESS", WS_TABSTOP, 21, 62, 104, 12 - LTEXT "Uwaga: Jeli masz zainstalowany take adapter sieciowy, musisz wybra inny adres IP ni adres adaptera.", 1333, 5, 94, 306, 36, NOT WS_GROUP + LTEXT "Uwaga: Jeśli masz zainstalowany także adapter sieciowy, musisz wybrać inny adres IP niż adres adaptera.", 1333, 5, 94, 306, 36, NOT WS_GROUP END 172 DIALOGEX 6, 18, 317, 144 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Niektre serwery i routery dial-up wymagaj logowania interaktywnego po poczeniu. Moesz uy skryptu by odpowiada za ciebie automagicznie.", 1339, 5, 3, 309, 27 - AUTOCHECKBOX "Poka okno &terminala", 1462, 15, 31, 162, 10 + LTEXT "Niektóre serwery i routery dial-up wymagają logowania interaktywnego po połączeniu. Możesz użyć skryptu by odpowiadał za ciebie automagicznie.", 1339, 5, 3, 309, 27 + AUTOCHECKBOX "Pokaż okno &terminala", 1462, 15, 31, 162, 10 AUTOCHECKBOX "Uruchom &skrypt:", 1463, 15, 45, 58, 10 COMBOBOX 1334, 30, 60, 275, 88, CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | NOT WS_TABSTOP PUSHBUTTON "&Edytuj....", 1335, 180, 77, 60, 14 - PUSHBUTTON "&Przegldaj", 1465, 244, 77, 60, 14 + PUSHBUTTON "&Przeglądaj", 1465, 244, 77, 60, 14 END 173 DIALOGEX 6, 18, 230, 215 @@ -769,14 +770,14 @@ CAPTION "Wybieranie" FONT 8, "MS Shell Dlg" BEGIN GROUPBOX "Ustawienia wybierania", 1344, 9, 4, 213, 53, WS_GROUP - LTEXT "&Ilo prb wybierania:", 1349, 16, 22, 140, 8, NOT WS_GROUP + LTEXT "&Ilość prób wybierania:", 1349, 16, 22, 140, 8, NOT WS_GROUP EDITTEXT 1340, 158, 19, 56, 14, ES_AUTOHSCROLL - LTEXT "&Sekund pomidzy prbami wybierania:", 1351, 16, 38, 140, 8, NOT WS_GROUP + LTEXT "&Sekund pomiędzy próbami wybierania:", 1351, 16, 38, 140, 8, NOT WS_GROUP EDITTEXT 1342, 158, 36, 56, 14, ES_AUTOHSCROLL - GROUPBOX "Rodzaj poczenia", 1343, 9, 63, 213, 56, WS_GROUP - LTEXT "Sekund &bezczynnoci przed zawieszeniem poczenia:", 1350, 28, 88, 124, 8, NOT WS_GROUP - AUTORADIOBUTTON "&Poczenie Demand Dial", 1347, 16, 78, 135, 10, WS_GROUP - AUTORADIOBUTTON "Poczenie tr&wae", 1348, 16, 103, 199, 10, NOT WS_TABSTOP, WS_EX_TRANSPARENT + GROUPBOX "Rodzaj połączenia", 1343, 9, 63, 213, 56, WS_GROUP + LTEXT "Sekund &bezczynności przed zawieszeniem połączenia:", 1350, 28, 88, 124, 8, NOT WS_GROUP + AUTORADIOBUTTON "&Połączenie Demand Dial", 1347, 16, 78, 135, 10, WS_GROUP + AUTORADIOBUTTON "Połączenie tr&wałe", 1348, 16, 103, 199, 10, NOT WS_TABSTOP, WS_EX_TRANSPARENT EDITTEXT 1341, 159, 85, 56, 14, ES_AUTOHSCROLL PUSHBUTTON "&Oddzwanianie...", 1345, 150, 125, 70, 14, WS_GROUP PUSHBUTTON "Wie&le linii...", 1346, 74, 125, 70, 14 @@ -794,25 +795,25 @@ END STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Zakaczanie kreatora konfiguracji interface dial-up.", 1352, 122, 5, 192, 32 - LTEXT "Aby utworzy ten interface i uruchomi go, nacinij Finish.", 1354, 122, 41, 192, 26, NOT WS_GROUP - LTEXT "Aby zmieni ten interface, w Menederze Routingu i Dostpu Zdalnego, wybierz go w Interface'y Routingu i nacinij Waciwoci .", 1355, 122, 68, 190, 39, NOT WS_GROUP + LTEXT "Zakańczanie kreatora konfiguracji interface dial-up.", 1352, 122, 5, 192, 32 + LTEXT "Aby utworzyć ten interface i uruchomić go, naciśnij Finish.", 1354, 122, 41, 192, 26, NOT WS_GROUP + LTEXT "Aby zmienić ten interface, w Menedżerze Routingu i Dostępu Zdalnego, wybierz go w Interface'y Routingu i naciśnij Właściwości .", 1355, 122, 68, 190, 39, NOT WS_GROUP END 179 DIALOGEX 6, 18, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Wybierz &modem lub adapter, jaki ma ten interface uywa.", 1356, 7, 4, 306, 11 + LTEXT "Wybierz &modem lub adapter, jaki ma ten interface używać.", 1356, 7, 4, 306, 11 CONTROL "", 1355, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x0000C415, 6, 15, 305, 80 - LTEXT "Lista pokazuje urzdzenia ustawione do routingu.", 1357, 15, 98, 288, 37, NOT WS_GROUP + LTEXT "Lista pokazuje urządzenia ustawione do routingu.", 1357, 15, 98, 288, 37, NOT WS_GROUP END 180 DIALOGEX 6, 18, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Wprowad numer telefoniczny serwera dial-up albo routera z ktrym si czysz. Inne numery telefocznicze, jeli istniej, s wybierane automagicznie, kiedy podstawowy numer jest zajty.", 1360, 7, 4, 305, 42 + LTEXT "Wprowadź numer telefoniczny serwera dial-up albo routera z którym się łączysz. Inne numery telefocznicze, jeśli istnieją, są wybierane automagicznie, kiedy podstawowy numer jest zajęty.", 1360, 7, 4, 305, 42 LTEXT "&Numer telefoniczny lub adres:", 1361, 7, 50, 275, 8, NOT WS_GROUP EDITTEXT 1358, 7, 62, 304, 14, ES_AUTOHSCROLL PUSHBUTTON "Inne...", 1359, 250, 80, 60, 14 @@ -820,36 +821,36 @@ END 181 DIALOGEX 6, 18, 230, 215 STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE | WS_CAPTION -CAPTION "Bezpieczestwo" +CAPTION "Bezpieczeństwo" FONT 8, "MS Shell Dlg" BEGIN GROUPBOX "Ustawienia uwierzytelniania i szyfrowania", 1367, 6, 8, 216, 103, WS_GROUP - AUTORADIOBUTTON "&Akceptuj kad metod uwierzytelniania (take otwartym tekstem)", 1370, 16, 20, 195, 10, BS_TOP | BS_MULTILINE + AUTORADIOBUTTON "&Akceptuj każdą metodę uwierzytelniania (także otwartym tekstem)", 1370, 16, 20, 195, 10, BS_TOP | BS_MULTILINE AUTORADIOBUTTON "A&kceptuj tylko uwierzytelnianie szyfrowane", 1373, 16, 36, 195, 10, BS_TOP | BS_MULTILINE AUTORADIOBUTTON "Ak&ceptuj tylko uwierzytelnianie szyfrowane Microsoftu", 1374, 16, 52, 195, 10, BS_TOP | BS_MULTILINE AUTOCHECKBOX "&Wymagaj szyfrowania danych", 1363, 27, 65, 184, 10, BS_TOP | BS_MULTILINE | WS_GROUP AUTOCHECKBOX "Wymagaj &mocnego szyfrowania danych", 1364, 41, 80, 172, 10, BS_TOP | BS_MULTILINE - AUTOCHECKBOX "&Uywaj uwierzytelniania dwustronnego", 1362, 17, 95, 194, 10, BS_TOP | BS_MULTILINE - PUSHBUTTON "&Nie zapisuj hasa", 1369, 59, 117, 80, 14, WS_GROUP + AUTOCHECKBOX "&Używaj uwierzytelniania dwustronnego", 1362, 17, 95, 194, 10, BS_TOP | BS_MULTILINE + PUSHBUTTON "&Nie zapisuj hasła", 1369, 59, 117, 80, 14, WS_GROUP PUSHBUTTON "&Zaawansowane", 1368, 142, 117, 80, 14, NOT WS_VISIBLE | WS_DISABLED - AUTOCHECKBOX "Wyk&ryj udostpnianie plikw i drukarek przed wybieraniem", 1365, 7, 198, 218, 10, BS_TOP | BS_MULTILINE | NOT WS_VISIBLE | WS_DISABLED + AUTOCHECKBOX "Wyk&ryj udostępnianie plików i drukarek przed wybieraniem", 1365, 7, 198, 218, 10, BS_TOP | BS_MULTILINE | NOT WS_VISIBLE | WS_DISABLED END 182 DIALOGEX 6, 18, 248, 148 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION "Bezpieczestwo" +CAPTION "Bezpieczeństwo" FONT 8, "MS Shell Dlg" BEGIN GROUPBOX "Ustawienia uwierzytelniania i szyfrowania", 1367, 7, 8, 200, 98, WS_GROUP - AUTORADIOBUTTON "&Akceptuj kad metod uwierzytelniania (take otwartym tekstem)", 1370, 14, 24, 183, 10 + AUTORADIOBUTTON "&Akceptuj każdą metodę uwierzytelniania (także otwartym tekstem)", 1370, 14, 24, 183, 10 AUTORADIOBUTTON "A&kceptuj tylko uwierzytelnianie szyfrowane", 1373, 14, 39, 183, 10 AUTORADIOBUTTON "Ak&ceptuj tylko uwierzytelnianie szyfrowane Microsoftu", 1374, 14, 53, 184, 10 AUTOCHECKBOX "&Wymagaj szyfrowania danych", 1363, 33, 67, 165, 10, WS_GROUP AUTOCHECKBOX "Wymagaj &mocnego szyfrowania danych", 1364, 48, 79, 152, 10 - AUTOCHECKBOX "&Uyj obecnej nazwy uytkownika i hasa ", 1366, 31, 91, 165, 10 - PUSHBUTTON "Nie zapisuj hasa", 1369, 6, 114, 100, 14, WS_GROUP + AUTOCHECKBOX "&Użyj obecnej nazwy użytkownika i hasła ", 1366, 31, 91, 165, 10 + PUSHBUTTON "Nie zapisuj hasła", 1369, 6, 114, 100, 14, WS_GROUP PUSHBUTTON "&Zaawansowane", 1368, 109, 114, 60, 14, NOT WS_VISIBLE | WS_DISABLED - AUTOCHECKBOX "Wyk&ryj udostpnianie plikw i drukarek przed wybieraniem", 1365, 14, 134, 193, 10, NOT WS_VISIBLE | WS_DISABLED + AUTOCHECKBOX "Wyk&ryj udostępnianie plików i drukarek przed wybieraniem", 1365, 14, 134, 193, 10, NOT WS_VISIBLE | WS_DISABLED END 183 DIALOGEX 6, 18, 317, 144 @@ -859,9 +860,9 @@ BEGIN LTEXT "Zaznacz odpowiednie opcje:", 1388, 7, 4, 296, 9 AUTOCHECKBOX "Routuj pakiety &IP na tym interface.", 1386, 20, 19, 285, 11, BS_LEFT | BS_TOP | BS_MULTILINE AUTOCHECKBOX "Routuj pakiety IP&X na tym interface.", 1387, 20, 35, 287, 11, BS_LEFT | BS_TOP | BS_MULTILINE - AUTOCHECKBOX "&Dodaj konto uytkownika by umoliwi dostp zdalny.", 1382, 20, 52, 287, 11, BS_LEFT | BS_TOP | BS_MULTILINE - AUTOCHECKBOX "Wysyaj haso &otwartym tekstem jeli nie ma innej metody.", 1385, 20, 70, 287, 11, BS_LEFT | BS_TOP | BS_MULTILINE - AUTOCHECKBOX "&Uyj skryptw do poczenia si z routerem zdalnym.", 1384, 20, 87, 289, 22, BS_LEFT | BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Dodaj konto użytkownika by umożliwić dostęp zdalny.", 1382, 20, 52, 287, 11, BS_LEFT | BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Wysyłaj hasło &otwartym tekstem jeśli nie ma innej metody.", 1385, 20, 70, 287, 11, BS_LEFT | BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Użyj skryptów do połączenia się z routerem zdalnym.", 1384, 20, 87, 289, 22, BS_LEFT | BS_TOP | BS_MULTILINE END 184 DIALOGEX 0, 0, 317, 143 @@ -872,26 +873,26 @@ END 186 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Kreator konfiguracji poczenia" +CAPTION "Kreator konfiguracji połączenia" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Poczenie, stworzone tylko dla ciebie, jest zapisane w twoim osobistym katalogu i jest dostpne wycznie dla twojego konta.", -1, 7, 4, 306, 23 - LTEXT "Utwrz to poczenie dla:", -1, 14, 27, 288, 12 - AUTORADIOBUTTON "&Kadego uytkownika", 1400, 26, 40, 265, 10, BS_TOP | BS_MULTILINE | NOT WS_TABSTOP + LTEXT "Połączenie, stworzone tylko dla ciebie, jest zapisane w twoim osobistym katalogu i jest dostępne wyłącznie dla twojego konta.", -1, 7, 4, 306, 23 + LTEXT "Utwórz to połączenie dla:", -1, 14, 27, 288, 12 + AUTORADIOBUTTON "&Każdego użytkownika", 1400, 26, 40, 265, 10, BS_TOP | BS_MULTILINE | NOT WS_TABSTOP AUTORADIOBUTTON "&Tylko dla mnie", 1401, 26, 55, 265, 10, BS_TOP | BS_MULTILINE | NOT WS_TABSTOP END 498 DIALOGEX 12, 16, 215, 126 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "Pocz z %1" +CAPTION "Połącz z %1" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "ReactOS nie mg poczy si z sieci za pomoc podanej nazwy uytkownika i hasa. Prosz ponownie wprowadzi nazw uytkownika i haso.", 1396, 7, 6, 206, 36 - LTEXT "&Nazwa uytkownika:", 1399, 8, 51, 49, 8 + LTEXT "ReactOS nie mógł połączyć się z siecią za pomocą podanej nazwy użytkownika i hasła. Proszę ponownie wprowadziź nazwę użytkownika i hasło.", 1396, 7, 6, 206, 36 + LTEXT "&Nazwa użytkownika:", 1399, 8, 51, 49, 8 EDITTEXT 1394, 66, 46, 143, 14, ES_AUTOHSCROLL - LTEXT "&Haso:", 1397, 8, 70, 49, 8, NOT WS_GROUP + LTEXT "&Hasło:", 1397, 8, 70, 49, 8, NOT WS_GROUP EDITTEXT 1393, 66, 64, 143, 14, ES_PASSWORD | ES_AUTOHSCROLL - AUTOCHECKBOX "&Zapisz haso", 1391, 66, 84, 143, 10 + AUTOCHECKBOX "&Zapisz hasło", 1391, 66, 84, 143, 10 CONTROL "", 1398, "STATIC", SS_ETCHEDHORZ | WS_GROUP, 7, 98, 200, 1 DEFPUSHBUTTON "OK", 1, 81, 104, 60, 14, WS_GROUP PUSHBUTTON "Anuluj", 2, 145, 104, 60, 14 @@ -899,21 +900,21 @@ END 500 DIALOGEX 12, 16, 215, 173 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "Pocz z %1" +CAPTION "Połącz z %1" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "ReactOS nie mg poczy si z sieci za pomoc podanej nazwy uytkownika i hasa. Prosz ponownie wprowadzi nazw uytkownika i haso.", 1396, 7, 6, 209, 26 - LTEXT "&Nazwa uytkownika:", 1399, 7, 72, 44, 8 + LTEXT "ReactOS nie mógł połączyć się z siecią za pomocą podanej nazwy użytkownika i hasła. Proszę ponownie wprowadziź nazwę użytkownika i hasło.", 1396, 7, 6, 209, 26 + LTEXT "&Nazwa użytkownika:", 1399, 7, 72, 44, 8 EDITTEXT 1394, 97, 69, 115, 14, ES_AUTOHSCROLL - LTEXT "&Haso:", 1397, 7, 90, 45, 8, NOT WS_GROUP + LTEXT "&Hasło:", 1397, 7, 90, 45, 8, NOT WS_GROUP EDITTEXT 1393, 97, 87, 115, 14, ES_PASSWORD | ES_AUTOHSCROLL LTEXT "&Domena:", 1395, 7, 108, 53, 8, NOT WS_GROUP EDITTEXT 1392, 97, 105, 115, 14, ES_UPPERCASE | ES_AUTOHSCROLL - AUTOCHECKBOX "&&Zapisz nazw uytkownika i haso", 1391, 85, 125, 123, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&&Zapisz nazwę użytkownika i hasło", 1391, 85, 125, 123, 10, BS_TOP | BS_MULTILINE DEFPUSHBUTTON "OK", 1, 87, 146, 60, 14, WS_GROUP PUSHBUTTON "Anuluj", 2, 151, 146, 60, 14 CONTROL "", 1398, "STATIC", SS_ETCHEDHORZ | WS_GROUP, 7, 140, 205, 1 - LTEXT "Moesz wprowadzi nazw domeny albo pozostawi to pole puste.\n(Nazwa domeny nie jest konieczna w przypadku czenia z Internetem)", -1, 8, 38, 209, 26 + LTEXT "Możesz wprowadzić nazwę domeny albo pozostawić to pole puste.\n(Nazwa domeny nie jest konieczna w przypadku łączenia z Internetem)", -1, 8, 38, 209, 26 END 502 DIALOGEX 20, 60, 215, 73 @@ -921,41 +922,41 @@ STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION CAPTION "Ustawienia PPP" FONT 8, "MS Shell Dlg" BEGIN - AUTOCHECKBOX "&Wcz rozszerzenia LCP", 1423, 9, 7, 200, 10, BS_TOP | BS_MULTILINE - AUTOCHECKBOX "W&cz kompresj programow", 1424, 9, 22, 201, 10, BS_TOP | BS_MULTILINE - AUTOCHECKBOX "Ustalaj poczenie &multi-link dla pocze pojedynczych", 1557, 9, 37, 202, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Włącz rozszerzenia LCP", 1423, 9, 7, 200, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Włą&cz kompresję programową", 1424, 9, 22, 201, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Ustalaj połączenie &multi-link dla połączeń pojedynczych", 1557, 9, 37, 202, 10, BS_TOP | BS_MULTILINE DEFPUSHBUTTON "OK", 1, 82, 53, 60, 14 PUSHBUTTON "Anuluj", 2, 148, 53, 60, 14 END 509 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION -CAPTION "Kreator konfiguracji poczenia" +CAPTION "Kreator konfiguracji połączenia" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Wybierz rol dla tego komputera:", -1, 10, 5, 275, 9 + LTEXT "Wybierz rolę dla tego komputera:", -1, 10, 5, 275, 9 AUTORADIOBUTTON "&Host", 1483, 31, 20, 265, 10, BS_TOP | BS_MULTILINE | WS_GROUP - AUTORADIOBUTTON "&Go", 1484, 31, 44, 265, 10, BS_TOP | BS_MULTILINE - LTEXT "Ten komputer zawiera informacje po ktre inne komputery si cz.", -1, 45, 31, 253, 13, NOT WS_GROUP | WS_TABSTOP - LTEXT "Ten komputer jest uywany do pobierania informacji z komputera hosta.", -1, 43, 56, 253, 23, NOT WS_GROUP + AUTORADIOBUTTON "&Gość", 1484, 31, 44, 265, 10, BS_TOP | BS_MULTILINE + LTEXT "Ten komputer zawiera informacje po które inne komputery się łączą.", -1, 45, 31, 253, 13, NOT WS_GROUP | WS_TABSTOP + LTEXT "Ten komputer jest używany do pobierania informacji z komputera hosta.", -1, 43, 56, 253, 23, NOT WS_GROUP END 511 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT "&Wybierz urzdzenie:", -1, 8, 5, 261, 8 + LTEXT "&Wybierz urządzenie:", -1, 8, 5, 261, 8 COMBOBOX 1485, 9, 18, 302, 62, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | NOT WS_TABSTOP END 528 DIALOGEX 0, 0, 227, 215 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION "Poczenia" +CAPTION "Połączenia" FONT 8, "MS Shell Dlg" BEGIN GROUPBOX "Przywileje logowania", 1582, 8, 10, 213, 63 - LTEXT "Nie-Administratorzy mog uzyska pozwolenie na tworzenie i modyfikowanie pocze przed logowaniem .", 1581, 16, 21, 194, 30 - AUTOCHECKBOX "&Zezwl na tworzenie i modyfikacj pocze przed logowaniem", 1497, 16, 56, 195, 10, BS_TOP | BS_MULTILINE + LTEXT "Nie-Administratorzy mogą uzyskać pozwolenie na tworzenie i modyfikowanie połączeń przed logowaniem .", 1581, 16, 21, 194, 30 + AUTOCHECKBOX "&Zezwól na tworzenie i modyfikację połączeń przed logowaniem", 1497, 16, 56, 195, 10, BS_TOP | BS_MULTILINE END 532 DIALOGEX 0, 0, 263, 263 @@ -963,9 +964,9 @@ STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION CAPTION "Oddzwanianie z routera" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Niektre routery oferuj opcj oddzwaniania, co moe zmniejszy twj rachunek telefoniczny a take zwikszy bezpieczestwo. Zadecyduj czy chcesz korzysta z tej opcji.", 1043, 7, 5, 253, 24 + LTEXT "Niektóre routery oferują opcję oddzwaniania, co może zmniejszyć twój rachunek telefoniczny a także zwiększyć bezpieczeństwo. Zadecyduj czy chcesz korzystać z tej opcji.", 1043, 7, 5, 253, 24 AUTORADIOBUTTON "&Bez oddzwaniania", 1501, 9, 36, 252, 10, BS_TOP | BS_MULTILINE | WS_GROUP - AUTORADIOBUTTON "&Zawsze oddzwaniaj na numery z listy poniej:", 1502, 9, 48, 252, 10, BS_TOP | BS_MULTILINE, WS_EX_TRANSPARENT + AUTORADIOBUTTON "&Zawsze oddzwaniaj na numery z listy poniżej:", 1502, 9, 48, 252, 10, BS_TOP | BS_MULTILINE, WS_EX_TRANSPARENT CONTROL "", 1503, "SYSLISTVIEW32", WS_BORDER | WS_GROUP | WS_TABSTOP | 0x00008401, 15, 63, 240, 143 PUSHBUTTON "&Edytuj", 1504, 131, 213, 60, 14 PUSHBUTTON "&Skasuj", 1505, 194, 213, 60, 14 @@ -979,17 +980,17 @@ STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION CAPTION "Opcje" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "Rodzaj poczenia", 1289, 7, 7, 215, 55 - AUTORADIOBUTTON "&czenie automatyczne", 1506, 16, 20, 199, 9, BS_TOP | BS_MULTILINE | WS_GROUP | NOT WS_TABSTOP - LTEXT "&Czas bezczynnoci przed rozczeniem:", 1299, 27, 33, 99, 8, NOT WS_GROUP + GROUPBOX "Rodzaj połączenia", 1289, 7, 7, 215, 55 + AUTORADIOBUTTON "&Łączenie automatyczne", 1506, 16, 20, 199, 9, BS_TOP | BS_MULTILINE | WS_GROUP | NOT WS_TABSTOP + LTEXT "&Czas bezczynności przed rozłączeniem:", 1299, 27, 33, 99, 8, NOT WS_GROUP COMBOBOX 1291, 144, 30, 70, 108, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - AUTORADIOBUTTON "&Poczenie trwae", 1507, 16, 47, 197, 9, BS_TOP | BS_MULTILINE | NOT WS_TABSTOP - GROUPBOX "Ustawienia pocze", 1290, 7, 66, 215, 48 - LTEXT "P&rb czenia:", 1300, 14, 79, 123, 8 + AUTORADIOBUTTON "&Połączenie trwałe", 1507, 16, 47, 197, 9, BS_TOP | BS_MULTILINE | NOT WS_TABSTOP + GROUPBOX "Ustawienia połączeń", 1290, 7, 66, 215, 48 + LTEXT "P&rób łączenia:", 1300, 14, 79, 123, 8 EDITTEXT 1287, 143, 76, 70, 14, ES_AUTOHSCROLL | ES_NUMBER - LTEXT "rednie przer&wy pomidzy poczeniami:", 1301, 14, 96, 123, 8 + LTEXT "Średnie przer&wy pomiędzy połączeniami:", 1301, 14, 96, 123, 8 COMBOBOX 1292, 143, 94, 70, 123, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - GROUPBOX "Kilka modemw", 1288, 7, 116, 215, 35 + GROUPBOX "Kilka modemów", 1288, 7, 116, 215, 35 COMBOBOX 1551, 16, 130, 128, 41, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP PUSHBUTTON "&Konfiguruj...", 1293, 150, 129, 65, 14 PUSHBUTTON "&Oddzwanianie", 1302, 8, 195, 60, 14 @@ -998,76 +999,76 @@ END 539 DIALOGEX 0, 0, 265, 110 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "Pocz z %1" +CAPTION "Połącz z %1" FONT 8, "MS Shell Dlg" BEGIN CONTROL 1678, 1100, "STATIC", SS_BITMAP, 0, 0, 265, 50 - LTEXT "&Nazwa uytkownika:", 1413, 14, 64, 84, 8 + LTEXT "&Nazwa użytkownika:", 1413, 14, 64, 84, 8 EDITTEXT 1104, 102, 62, 154, 14, ES_AUTOHSCROLL CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 9, 82, 247, 1 - DEFPUSHBUTTON "&Dzwo", 1590, 8, 89, 60, 14 + DEFPUSHBUTTON "&Dzwoń", 1590, 8, 89, 60, 14 PUSHBUTTON "Anuluj", 1591, 71, 89, 60, 14 - PUSHBUTTON "&Waciwoci", 1107, 133, 89, 60, 14 + PUSHBUTTON "&Właściwości", 1107, 133, 89, 60, 14 PUSHBUTTON "&Pomoc", 1592, 195, 89, 60, 14 END 540 DIALOGEX 0, 0, 265, 133 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "Pocz z %1" +CAPTION "Połącz z %1" FONT 8, "MS Shell Dlg" BEGIN CONTROL 1678, 1100, "STATIC", SS_BITMAP, 0, 0, 265, 50 - LTEXT "&Nazwa uytkownika:", 1413, 10, 64, 90, 8 + LTEXT "&Nazwa użytkownika:", 1413, 10, 64, 90, 8 EDITTEXT 1104, 105, 60, 154, 14, ES_AUTOHSCROLL CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 7, 80, 252, 1 - LTEXT "&czenie:", 1412, 10, 91, 92, 10 + LTEXT "Łą&czenie:", 1412, 10, 91, 92, 10 COMBOBOX 1416, 105, 88, 154, 112, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | NOT WS_TABSTOP CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 7, 107, 251, 1 - DEFPUSHBUTTON "&Dzwo", 1590, 8, 113, 60, 14 + DEFPUSHBUTTON "&Dzwoń", 1590, 8, 113, 60, 14 PUSHBUTTON "Anuluj", 1591, 71, 113, 60, 14 - PUSHBUTTON "&Waciwoci", 1107, 134, 113, 60, 14 + PUSHBUTTON "&Właściwości", 1107, 134, 113, 60, 14 PUSHBUTTON "&Pomoc", 1592, 197, 113, 60, 14 END 541 DIALOGEX 0, 0, 265, 157 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "Pocz z %1" +CAPTION "Połącz z %1" FONT 8, "MS Shell Dlg" BEGIN CONTROL 1678, 1100, "STATIC", SS_BITMAP, 0, 0, 265, 50 - LTEXT "N&azwa uytkownika:", 1413, 12, 67, 87, 8 + LTEXT "N&azwa użytkownika:", 1413, 12, 67, 87, 8 EDITTEXT 1104, 103, 63, 154, 14, ES_AUTOHSCROLL CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 9, 84, 248, 1 - LTEXT "&czenie:", 1412, 11, 96, 48, 8 + LTEXT "Łą&czenie:", 1412, 11, 96, 48, 8 COMBOBOX 1416, 103, 92, 154, 112, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | NOT WS_TABSTOP - LTEXT "cze&nie za pomoc:", 1415, 10, 114, 46, 8 + LTEXT "Łącze&nie za pomocą:", 1415, 10, 114, 46, 8 COMBOBOX 1414, 102, 110, 87, 112, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | NOT WS_TABSTOP - PUSHBUTTON "&Ustawienia pocze", 1108, 193, 110, 64, 14 + PUSHBUTTON "&Ustawienia połączeń", 1108, 193, 110, 64, 14 CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 7, 130, 250, 1 - DEFPUSHBUTTON "c&z", 1590, 6, 136, 60, 14 + DEFPUSHBUTTON "Łąc&z", 1590, 6, 136, 60, 14 PUSHBUTTON "Anuluj", 1591, 69, 136, 60, 14 - PUSHBUTTON "&Waciwoci", 1107, 132, 136, 60, 14 + PUSHBUTTON "&Właściwości", 1107, 132, 136, 60, 14 PUSHBUTTON "&Pomoc", 1592, 196, 136, 60, 14 END 544 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Kreator konfiguracji poczenia" +CAPTION "Kreator konfiguracji połączenia" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Wspdzielenie cza Internetowego umoliwia innym komputerom w twojej sieci lokalnej na korzystanie z zasobw zdalnych za pomoc tego poczenia.", -1, 10, 5, 300, 22 - AUTOCHECKBOX "&Wcz Wspdzielenie cza Internetowego dla tego poczenia", 1512, 21, 31, 272, 10 - LTEXT "Aby automatycznie nawiza poczenie, gdy komputer w twojej sieci lokalnej sprbuje uzyska dostp do zasobw zdalnych, zaznacz opcj Poczenia Automatyczne.", 1514, 10, 56, 294, 22 - AUTOCHECKBOX "W&cz Poczenia Automatyczne", 1513, 21, 86, 260, 10 + LTEXT "Współdzielenie Łącza Internetowego umożliwia innym komputerom w twojej sieci lokalnej na korzystanie z zasobów zdalnych za pomocą tego połączenia.", -1, 10, 5, 300, 22 + AUTOCHECKBOX "&Włącz Współdzielenie Łącza Internetowego dla tego połączenia", 1512, 21, 31, 272, 10 + LTEXT "Aby automatycznie nawiązać połączenie, gdy komputer w twojej sieci lokalnej spróbuje uzyskać dostęp do zasobów zdalnych, zaznacz opcję Połączenia Automatyczne.", 1514, 10, 56, 294, 22 + AUTOCHECKBOX "Włą&cz Połączenia Automatyczne", 1513, 21, 86, 260, 10 END 545 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Kreator konfiguracji poczenia" +CAPTION "Kreator konfiguracji połączenia" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Dostp Wspdzielony umoliwia komputerom w twojej sieci lokalnej na korzystanie z zasobw zdalnych za pomoc tego poczenia dial-up. Moesz wczy Dostp Wspdzielony dla jednego poczenia i jednej sieci w tym samym czasie.", -1, 10, 5, 300, 25 - LTEXT "&Wybierz sie lokaln, ktra uzyska dostp do zasobw zdalnych za pomoc tego poczenia:", -1, 21, 35, 285, 8 + LTEXT "Dostęp Współdzielony umożliwia komputerom w twojej sieci lokalnej na korzystanie z zasobów zdalnych za pomocą tego połączenia dial-up. Możesz włączyć Dostęp Współdzielony dla jednego połączenia i jednej sieci w tym samym czasie.", -1, 10, 5, 300, 25 + LTEXT "&Wybierz sieć lokalną, która uzyska dostęp do zasobów zdalnych za pomocą tego połączenia:", -1, 21, 35, 285, 8 COMBOBOX 1522, 21, 48, 231, 56, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | NOT WS_TABSTOP END @@ -1075,128 +1076,128 @@ END STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Moesz skonfigurowa to poczenie tak, by korzystao ze smart card przy logowaniu do sieci zdalnej. Wybierz czy chcesz korzysta ze smart card z tym poczeniem.", -1, 10, 5, 303, 22 - AUTORADIOBUTTON "&Uyj smart card ", 1524, 26, 29, 264, 12, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP | NOT WS_TABSTOP - AUTORADIOBUTTON "&Nie uywaj smart card ", 1525, 26, 44, 261, 16, BS_LEFT | BS_TOP | BS_MULTILINE | NOT WS_TABSTOP + LTEXT "Możesz skonfigurować to połączenie tak, by korzystało ze smart card przy logowaniu do sieci zdalnej. Wybierz czy chcesz korzystać ze smart card z tym połączeniem.", -1, 10, 5, 303, 22 + AUTORADIOBUTTON "&Użyj smart card ", 1524, 26, 29, 264, 12, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP | NOT WS_TABSTOP + AUTORADIOBUTTON "&Nie używaj smart card ", 1525, 26, 44, 261, 16, BS_LEFT | BS_TOP | BS_MULTILINE | NOT WS_TABSTOP END 547 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION -CAPTION "Kreator Pocze Automatycznych" +CAPTION "Kreator Połączeń Automatycznych" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Witamy w Kreatorze Pocze Automatycznych.", 1530, 122, 8, 192, 32 - LTEXT "Za pomoc tego Kreatora moesz stworzy interface Pocze Automatycznych, w celu poczenia tego routera z innymi.", 1531, 122, 43, 192, 37 - LTEXT "Nacinij Dalej aby kontynuowa.", 1532, 122, 85, 191, 29 + LTEXT "Witamy w Kreatorze Połączeń Automatycznych.", 1530, 122, 8, 192, 32 + LTEXT "Za pomocą tego Kreatora możesz stworzyć interface Połączeń Automatycznych, w celu połączenia tego routera z innymi.", 1531, 122, 43, 192, 37 + LTEXT "Naciśnij Dalej aby kontynuować.", 1532, 122, 85, 191, 29 END 548 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - AUTORADIOBUTTON "Pocz za pomoc &modemu, adaptera ISDN, lub innego urzdzenia.", 1531, 21, 17, 290, 15, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP | NOT WS_TABSTOP - AUTORADIOBUTTON "Pocz za pomoc &Wirtualnych Sieci Prywatnych (VPN)", 1532, 21, 38, 291, 15, BS_LEFT | BS_TOP | BS_MULTILINE | NOT WS_TABSTOP - AUTORADIOBUTTON "Pocz za pomoc PPP over Ethernet (PPPoE)", 1688, 21, 58, 290, 12, NOT WS_TABSTOP + AUTORADIOBUTTON "Połącz za pomocą &modemu, adaptera ISDN, lub innego urządzenia.", 1531, 21, 17, 290, 15, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP | NOT WS_TABSTOP + AUTORADIOBUTTON "Połącz za pomocą &Wirtualnych Sieci Prywatnych (VPN)", 1532, 21, 38, 291, 15, BS_LEFT | BS_TOP | BS_MULTILINE | NOT WS_TABSTOP + AUTORADIOBUTTON "Połącz za pomocą PPP over Ethernet (PPPoE)", 1688, 21, 58, 290, 12, NOT WS_TABSTOP END 550 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_CHILD | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Wprowad nazw albo adres IP routera, z ktrym si chcesz poczy.", 1535, 10, 8, 289, 18 - LTEXT "&Nazwa hosta albo adres IP (na przykad: reactos.org albo 145.52.0.1):", 1537, 21, 35, 285, 8 + LTEXT "Wprowadź nazwę albo adres IP routera, z którym się chcesz połączyć.", 1535, 10, 8, 289, 18 + LTEXT "&Nazwa hosta albo adres IP (na przykład: reactos.org albo 145.52.0.1):", 1537, 21, 35, 285, 8 EDITTEXT 1536, 21, 47, 285, 14, ES_AUTOHSCROLL END 551 DIALOGEX 0, 0, 265, 127 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "Pocz z %1" +CAPTION "Połącz z %1" FONT 8, "MS Shell Dlg" BEGIN CONTROL 1678, 1100, "STATIC", SS_BITMAP, 0, 0, 265, 50 - LTEXT "&Nazwa uytkownika:", 1413, 12, 62, 89, 8 + LTEXT "&Nazwa użytkownika:", 1413, 12, 62, 89, 8 EDITTEXT 1104, 104, 58, 154, 14, ES_AUTOHSCROLL LTEXT "&Domena:", 1110, 12, 82, 90, 8 EDITTEXT 1102, 104, 79, 154, 14, ES_UPPERCASE | ES_AUTOHSCROLL CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 10, 99, 248, 1 - DEFPUSHBUTTON "D&zwo", 1590, 9, 106, 61, 14 + DEFPUSHBUTTON "D&zwoń", 1590, 9, 106, 61, 14 PUSHBUTTON "Anuluj", 1591, 72, 106, 60, 14 - PUSHBUTTON "&Waciwoci", 1107, 135, 106, 60, 14 + PUSHBUTTON "&Właściwości", 1107, 135, 106, 60, 14 PUSHBUTTON "&Pomoc", 1592, 198, 106, 60, 14 END 552 DIALOGEX 0, 0, 265, 159 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "Pocz z %1" +CAPTION "Połącz z %1" FONT 8, "MS Shell Dlg" BEGIN CONTROL 1678, 1100, "STATIC", SS_BITMAP, 0, 0, 265, 50 - LTEXT "&Nazwa uytkownika:", 1413, 10, 67, 91, 10 + LTEXT "&Nazwa użytkownika:", 1413, 10, 67, 91, 10 EDITTEXT 1104, 104, 64, 154, 14, ES_AUTOHSCROLL LTEXT "&Domena:", 1110, 11, 86, 91, 8 EDITTEXT 1102, 104, 83, 154, 14, ES_UPPERCASE | ES_AUTOHSCROLL CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 10, 103, 248, 1 - LTEXT "P&oczenie", 1412, 10, 115, 91, 8 + LTEXT "P&ołączenie", 1412, 10, 115, 91, 8 COMBOBOX 1416, 104, 111, 154, 112, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | NOT WS_TABSTOP CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 10, 132, 248, 1 - DEFPUSHBUTTON "D&zwo", 1590, 8, 139, 60, 14 + DEFPUSHBUTTON "D&zwoń", 1590, 8, 139, 60, 14 PUSHBUTTON "Anuluj", 1591, 71, 139, 60, 14 - PUSHBUTTON "&Waciwoci", 1107, 134, 139, 60, 14 + PUSHBUTTON "&Właściwości", 1107, 134, 139, 60, 14 PUSHBUTTON "&Pomoc", 1592, 198, 139, 60, 14 END 553 DIALOGEX 0, 0, 265, 183 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "Pocz z %1" +CAPTION "Połącz z %1" FONT 8, "MS Shell Dlg" BEGIN CONTROL 1678, 1100, "STATIC", SS_BITMAP, 0, 0, 265, 50 - LTEXT "N&azwa uytkownika:", 1413, 10, 68, 92, 10 + LTEXT "N&azwa użytkownika:", 1413, 10, 68, 92, 10 EDITTEXT 1104, 104, 65, 154, 14, ES_AUTOHSCROLL LTEXT "&Domena:", 1110, 10, 90, 91, 8 EDITTEXT 1102, 104, 86, 154, 14, ES_UPPERCASE | ES_AUTOHSCROLL CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 10, 106, 248, 1 - LTEXT "P&oczenie:", 1412, 10, 118, 92, 8 + LTEXT "P&ołączenie:", 1412, 10, 118, 92, 8 COMBOBOX 1416, 104, 114, 154, 112, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | NOT WS_TABSTOP - LTEXT "cze&nie za pomoc:", 1415, 10, 137, 91, 8 + LTEXT "Łącze&nie za pomocą:", 1415, 10, 137, 91, 8 COMBOBOX 1414, 104, 134, 87, 112, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | NOT WS_TABSTOP - PUSHBUTTON "&Ustawienia pocze", 1108, 194, 134, 65, 14 + PUSHBUTTON "&Ustawienia połączeń", 1108, 194, 134, 65, 14 CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 10, 154, 248, 1 - DEFPUSHBUTTON "&cz", 1590, 8, 162, 60, 14 + DEFPUSHBUTTON "Łą&cz", 1590, 8, 162, 60, 14 PUSHBUTTON "Anuluj", 1591, 71, 162, 60, 14 - PUSHBUTTON "&Waciwoci", 1107, 134, 162, 60, 14 + PUSHBUTTON "&Właściwości", 1107, 134, 162, 60, 14 PUSHBUTTON "&Pomoc", 1592, 198, 162, 60, 14 END 554 DIALOGEX 0, 0, 230, 215 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION -CAPTION "Oglne" +CAPTION "Ogólne" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "&Pocz za pomoc:", 1124, 7, 4, 193, 8 + LTEXT "&Połącz za pomocą:", 1124, 7, 4, 193, 8 CONTROL "", 1128, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x00004C0D, 7, 17, 195, 44, WS_EX_CLIENTEDGE - PUSHBUTTON "&Gra", 1132, 208, 18, 16, 14, BS_ICON - PUSHBUTTON "&D", 1131, 208, 36, 16, 14, BS_ICON - AUTOCHECKBOX "&Wszystkie urzdzenia wybieraj te same numery", 1119, 7, 65, 131, 21, BS_TOP | BS_MULTILINE + PUSHBUTTON "&Góra", 1132, 208, 18, 16, 14, BS_ICON + PUSHBUTTON "&Dół", 1131, 208, 36, 16, 14, BS_ICON + AUTOCHECKBOX "&Wszystkie urządzenia wybierają te same numery", 1119, 7, 65, 131, 21, BS_TOP | BS_MULTILINE PUSHBUTTON "&Konfiguruj", 1130, 140, 66, 60, 14 - GROUPBOX "Przykad", 1125, 7, 87, 213, 56, WS_GROUP + GROUPBOX "Przykład", 1125, 7, 87, 213, 56, WS_GROUP LTEXT "&Numer telefonu:", 1135, 19, 102, 191, 8 EDITTEXT 1123, 17, 112, 138, 14, ES_AUTOHSCROLL - PUSHBUTTON "P&ozostae", 1129, 161, 112, 50, 14 - AUTOCHECKBOX "Po&ka ikon w zasobniku systemowym podczas trwania poczenia", 1120, 11, 194, 212, 20, BS_TOP | BS_MULTILINE + PUSHBUTTON "P&ozostałe", 1129, 161, 112, 50, 14 + AUTOCHECKBOX "Po&każ ikonę w zasobniku systemowym podczas trwania połączenia", 1120, 11, 194, 212, 20, BS_TOP | BS_MULTILINE END 555 DIALOGEX 0, 0, 230, 215 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION -CAPTION "Oglne" +CAPTION "Ogólne" FONT 8, "MS Shell Dlg" BEGIN PUSHBUTTON "&Konfiguruj", 1130, 160, 38, 60, 14 LTEXT "&Numer telefonu:", 1135, 8, 72, 194, 8 EDITTEXT 1123, 8, 83, 148, 14, ES_AUTOHSCROLL - PUSHBUTTON "P&ozostae", 1129, 160, 83, 60, 14 - AUTOCHECKBOX "Po&ka ikon w zasobniku systemowym podczas trwania poczenia", 1120, 11, 194, 213, 10, BS_TOP | BS_MULTILINE - LTEXT "&Pocz za pomoc:", 1124, 8, 5, 214, 8 + PUSHBUTTON "P&ozostałe", 1129, 160, 83, 60, 14 + AUTOCHECKBOX "Po&każ ikonę w zasobniku systemowym podczas trwania połączenia", 1120, 11, 194, 213, 10, BS_TOP | BS_MULTILINE + LTEXT "&Połącz za pomocą:", 1124, 8, 5, 214, 8 CONTROL "", 1127, "SYSLISTVIEW32", WS_DISABLED | WS_BORDER | 0x0000EC0D, 7, 18, 214, 15 END @@ -1205,13 +1206,13 @@ STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION CAPTION "Ustawienia Aplikacji" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "&Opis aplikacji dziaajcej w twojej sieci lokalnej:", -1, 7, 5, 203, 8 + LTEXT "&Opis aplikacji działającej w twojej sieci lokalnej:", -1, 7, 5, 203, 8 EDITTEXT 1565, 7, 17, 206, 14, ES_AUTOHSCROLL LTEXT "&Numer portu serwera:", -1, 7, 35, 202, 8 EDITTEXT 1566, 7, 47, 113, 14, ES_AUTOHSCROLL | ES_NUMBER AUTORADIOBUTTON "&TCP", 1548, 128, 49, 30, 10, NOT WS_TABSTOP AUTORADIOBUTTON "&UDP", 1567, 166, 49, 31, 10, NOT WS_TABSTOP - LTEXT "&Nasuchuj na odpowiedzi serwera na porcie lub przedziale portw:\n(na przykad: 1024-1209, 1300-1310, 1450)", -1, 7, 70, 207, 22 + LTEXT "&Nasłuchuj na odpowiedzi serwera na porcie lub przedziale portów:\n(na przykład: 1024-1209, 1300-1310, 1450)", -1, 7, 70, 207, 22 LTEXT "T&CP:", -1, 7, 100, 28, 8 EDITTEXT 1569, 50, 97, 162, 14, ES_AUTOHSCROLL LTEXT "UD&P:", -1, 7, 121, 30, 8 @@ -1222,14 +1223,14 @@ END 557 DIALOGEX 0, 0, 217, 164 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "Ustawienia Usug" +CAPTION "Ustawienia Usług" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "&Opis usugi:", -1, 7, 5, 203, 8 + LTEXT "&Opis usługi:", -1, 7, 5, 203, 8 EDITTEXT 1552, 7, 18, 205, 14, ES_AUTOHSCROLL - LTEXT "&Nazwa hosta albo adres IP (na przykad 192.168.0.12) komputera, na ktrym usuga jest uruchomiona:", -1, 7, 37, 208, 16 + LTEXT "&Nazwa hosta albo adres IP (na przykład 192.168.0.12) komputera, na którym usługa jest uruchomiona:", -1, 7, 37, 208, 16 EDITTEXT 1556, 7, 57, 203, 14, ES_AUTOHSCROLL - LTEXT "&Numer portu przydzielony tej usudze:", -1, 7, 85, 203, 8 + LTEXT "&Numer portu przydzielony tej usłudze:", -1, 7, 85, 203, 8 EDITTEXT 1553, 7, 97, 113, 14, ES_AUTOHSCROLL | ES_NUMBER AUTORADIOBUTTON "&TCP", 1554, 128, 99, 30, 10, NOT WS_TABSTOP AUTORADIOBUTTON "&UDP", 1555, 166, 99, 31, 10, NOT WS_TABSTOP @@ -1242,7 +1243,7 @@ STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION CAPTION "Programy" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Poczenie internetowe na tym komputerze zostao ustawione tak, by umoliwi nastpujcym programom dostp do sieci:", -1, 7, 7, 218, 28 + LTEXT "Połączenie internetowe na tym komputerze zostało ustawione tak, by umożliwić następującym programom dostęp do sieci:", -1, 7, 7, 218, 28 CONTROL "List1", 1558, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x0000441D, 7, 37, 215, 155, WS_EX_CLIENTEDGE PUSHBUTTON "&Dodaj", 1538, 7, 197, 67, 14 PUSHBUTTON "&Edytuj", 1559, 80, 197, 67, 14 @@ -1251,11 +1252,11 @@ END 559 DIALOGEX 0, 0, 230, 215 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "Usugi" +CAPTION "Usługi" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "&Wybierz usugi, dziaajce w twojej sieci, ktre chcesz udostpni uytkownikom przez Internet.", -1, 7, 5, 216, 22 - LTEXT "Usugi:", -1, 7, 27, 143, 8 + LTEXT "&Wybierz usługi, działające w twojej sieci, które chcesz udostępnić użytkownikom przez Internet.", -1, 7, 5, 216, 22 + LTEXT "Usługi:", -1, 7, 27, 143, 8 CONTROL "List1", 1560, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x0000441D, 7, 37, 215, 155, WS_EX_CLIENTEDGE PUSHBUTTON "&Dodaj", 1561, 7, 197, 67, 14 PUSHBUTTON "&Edytuj", 1563, 80, 197, 67, 14 @@ -1264,49 +1265,49 @@ END 560 DIALOGEX 6, 18, 240, 88 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION "Poczenie Wstpne" +CAPTION "Połączenie Wstępne" FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "&Tak", 6, 68, 68, 50, 14 PUSHBUTTON "&Nie", 7, 125, 68, 50, 14 ICON 32516, 1575, 7, 7, 20, 20 LTEXT "", 1576, 40, 7, 190, 33 - AUTOCHECKBOX "&Nie wywietlaj wicej tego komunikatu", 1579, 40, 48, 192, 11, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Nie wyświetlaj więcej tego komunikatu", 1579, 40, 48, 192, 11, BS_TOP | BS_MULTILINE END 567 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Kreator konfiguracji poczenia" +CAPTION "Kreator konfiguracji połączenia" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Wprowad nazw usugi w pole poniej. Jeli zostawisz je puste, ReactOS automagicznie wykryje i skonfiguruje t usug podczas czenia.", -1, 10, 7, 301, 25 - LTEXT "&Nazwa Usugi (opcjonalnie):", -1, 22, 32, 229, 8 + LTEXT "Wprowadź nazwę usługi w pole poniżej. Jeśli zostawisz je puste, ReactOS automagicznie wykryje i skonfiguruje tą usługę podczas łączenia.", -1, 10, 7, 301, 25 + LTEXT "&Nazwa Usługi (opcjonalnie):", -1, 22, 32, 229, 8 EDITTEXT 1593, 22, 44, 275, 14, ES_AUTOHSCROLL END 568 DIALOGEX 0, 0, 230, 215 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION -CAPTION "General" +CAPTION "Ogólne" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "&Service name:", 1686, 7, 5, 217, 10 + LTEXT "Nazwa &Usługi:", 1686, 7, 5, 217, 10 EDITTEXT 1594, 7, 17, 217, 14, ES_AUTOHSCROLL - AUTOCHECKBOX "Sho&w icon in notification area when connected", 1120, 9, 196, 215, 8 + AUTOCHECKBOX "Pok&aż ikonę w obszarze powiadamiania podczas połączenia", 1120, 9, 196, 215, 8 END 569 DIALOGEX 0, 0, 230, 215 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION "Bezpieczestwo" +CAPTION "Bezpieczeństwo" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "Ustawienia bezpieczestwa", 1580, 8, 4, 213, 151 + GROUPBOX "Ustawienia bezpieczeństwa", 1580, 8, 4, 213, 151 AUTORADIOBUTTON "&Typowe (ustawienia zalecane)", 1540, 14, 16, 197, 9, BS_NOTIFY | WS_GROUP - AUTORADIOBUTTON "&Zaawansowane (ustawienia wasne)", 1541, 14, 100, 197, 8, BS_NOTIFY - LTEXT "&Uwiarygodnij moj tosamo za pomoc:", 1537, 26, 29, 183, 8, NOT WS_GROUP + AUTORADIOBUTTON "&Zaawansowane (ustawienia własne)", 1541, 14, 100, 197, 8, BS_NOTIFY + LTEXT "&Uwiarygodnij moją tożsamość za pomocą:", 1537, 26, 29, 183, 8, NOT WS_GROUP COMBOBOX 1178, 26, 40, 184, 78, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | NOT WS_TABSTOP - AUTOCHECKBOX "&Automagicznie uyj mojej nazwy uytkownika i hasa z ReactOS (domeny te o ile istniej)", 1174, 26, 59, 182, 20, BS_TOP | BS_MULTILINE - AUTOCHECKBOX "&Wymagaj szyfrowania danych (rozcz si w razie braku)", 1169, 26, 83, 182, 10, BS_TOP | BS_MULTILINE - LTEXT "Zmiana tych ustawie wymaga wiedzy o protokoach bezpieczestwa.", 1539, 26, 111, 136, 20 + AUTOCHECKBOX "&Automagicznie użyj mojej nazwy użytkownika i hasła z ReactOS (domeny też o ile istniej)", 1174, 26, 59, 182, 20, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Wymagaj szyfrowania danych (rozłącz się w razie braku)", 1169, 26, 83, 182, 10, BS_TOP | BS_MULTILINE + LTEXT "Zmiana tych ustawień wymaga wiedzy o protokołach bezpieczeństwa.", 1539, 26, 111, 136, 20 PUSHBUTTON "&Ustawienia", 1180, 151, 134, 60, 14 PUSHBUTTON "Ustawienia &IPSec", 1598, 126, 163, 85, 14 END @@ -1318,31 +1319,31 @@ FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "OK", 1, 151, 104, 50, 14 PUSHBUTTON "Anuluj", 2, 207, 104, 50, 14 - AUTOCHECKBOX "&Uyj klucza pre-shared do uwierzytelniania", 1604, 21, 15, 217, 10 + AUTOCHECKBOX "&Użyj klucza pre-shared do uwierzytelniania", 1604, 21, 15, 217, 10 LTEXT "&Klucz:", 1602, 20, 31, 44, 12 EDITTEXT 1605, 66, 30, 172, 12, ES_AUTOHSCROLL - AUTOCHECKBOX "Zezwl na certyfikaty z mojego magazynu uytkownika oprcz certifikatw systemowych", 1606, 20, 50, 242, 13, WS_DISABLED - AUTOCHECKBOX "Uyj wybranego certyfikatu", 1607, 20, 67, 239, 10, WS_DISABLED + AUTOCHECKBOX "Zezwól na certyfikaty z mojego magazynu użytkownika oprócz certifikatów systemowych", 1606, 20, 50, 242, 13, WS_DISABLED + AUTOCHECKBOX "Użyj wybranego certyfikatu", 1607, 20, 67, 239, 10, WS_DISABLED PUSHBUTTON "Wybierz", 1608, 31, 84, 50, 14, WS_DISABLED COMBOBOX 1610, 91, 84, 135, 30, CBS_DROPDOWN | CBS_SORT | WS_DISABLED | WS_VSCROLL | NOT WS_TABSTOP END 571 DIALOGEX 0, 0, 230, 215 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "Logowanie komunikatw bezpieczestwa" +CAPTION "Logowanie komunikatów bezpieczeństwa" FONT 8, "MS Shell Dlg" BEGIN GROUPBOX "Opcje logowania:", -1, 6, 8, 216, 47 - AUTOCHECKBOX "Loguj &nieudane prby pocze przychodzcych", 1642, 14, 22, 201, 10 - AUTOCHECKBOX "Loguj &udane poczenia wychodzce", 1641, 14, 37, 200, 10 - GROUPBOX "Opcje pliku logw:", -1, 7, 64, 215, 91 + AUTOCHECKBOX "Loguj &nieudane próby połączeń przychodzących", 1642, 14, 22, 201, 10 + AUTOCHECKBOX "Loguj &udane połączenia wychodzące", 1641, 14, 37, 200, 10 + GROUPBOX "Opcje pliku logów:", -1, 7, 64, 215, 91 LTEXT "&Nazwa:", -1, 14, 78, 199, 8 EDITTEXT 1674, 14, 90, 199, 14, ES_READONLY - PUSHBUTTON "&Przegldaj", 1639, 153, 108, 60, 14 - LTEXT "&Limit wielkoci:", -1, 14, 133, 67, 8 + PUSHBUTTON "&Przeglądaj", 1639, 153, 108, 60, 14 + LTEXT "&Limit wielkości:", -1, 14, 133, 67, 8 EDITTEXT 1640, 86, 130, 50, 14, ES_AUTOHSCROLL | ES_NUMBER LTEXT "KB", -1, 140, 133, 20, 8 - PUSHBUTTON "&Ustawienia Domylne", 1643, 135, 197, 85, 14 + PUSHBUTTON "&Ustawienia Domyślne", 1643, 135, 197, 85, 14 END 572 DIALOGEX 0, 0, 230, 215 @@ -1350,7 +1351,7 @@ STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION CAPTION "ICMP" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "&Internet Control Message Protocol (ICMP) pozwala komputerom w sieci na przesyanie informacji o bdach i o stanie wasnym. Wybierz zapytania ICMP na ktre ten komputer bdzie mg odpowiedzie:", -1, 7, 5, 215, 37 + LTEXT "&Internet Control Message Protocol (ICMP) pozwala komputerom w sieci na przesyłanie informacji o błędach i o stanie własnym. Wybierz zapytania ICMP na które ten komputer będzie mógł odpowiedzieć:", -1, 7, 5, 215, 37 CONTROL "IList1", 1644, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x0000440D, 7, 45, 215, 100, WS_EX_CLIENTEDGE GROUPBOX "Opis:", -1, 7, 153, 215, 55 LTEXT "", 1645, 14, 171, 199, 32 @@ -1366,107 +1367,107 @@ END 577 DIALOGEX 0, 0, 312, 144 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Kreator konfiguracji poczenia" +CAPTION "Kreator konfiguracji połączenia" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Wpisz nazw ISP w pole poniej.", 1681, 10, 3, 296, 11 + LTEXT "Wpisz nazwę ISP w pole poniżej.", 1681, 10, 3, 296, 11 LTEXT "N&azwa:", 1690, 18, 20, 127, 10 EDITTEXT 1680, 17, 32, 222, 14, ES_AUTOHSCROLL - LTEXT "Nazwa wpisana tutaj bdzie domyln nazw utworzonego poczenia internetowego.", 1683, 17, 52, 282, 42 + LTEXT "Nazwa wpisana tutaj będzie domyślną nazwą utworzonego połączenia internetowego.", 1683, 17, 52, 282, 42 END 580 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_CHILD | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - AUTORADIOBUTTON "&Wybr automatyczny", 1534, 21, 20, 288, 11, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP | NOT WS_TABSTOP + AUTORADIOBUTTON "&Wybór automatyczny", 1534, 21, 20, 288, 11, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP | NOT WS_TABSTOP AUTORADIOBUTTON "&Point to Point Tunneling Protocol (PPTP)", 1532, 21, 39, 290, 11, BS_LEFT | BS_TOP | BS_MULTILINE | NOT WS_TABSTOP AUTORADIOBUTTON "&Layer 2 Tunneling Protocol (L2TP)", 1533, 21, 56, 286, 11, BS_LEFT | BS_TOP | BS_MULTILINE | NOT WS_TABSTOP END 1420 DIALOGEX 0, 0, 265, 108 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "Pocz z %1" +CAPTION "Połącz z %1" FONT 8, "MS Shell Dlg" BEGIN CONTROL 1678, 1100, "STATIC", SS_BITMAP, 0, 0, 265, 50 - LTEXT "&czenie:", 1412, 14, 63, 86, 8 + LTEXT "Łą&czenie:", 1412, 14, 63, 86, 8 COMBOBOX 1416, 104, 60, 154, 112, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | NOT WS_TABSTOP CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 10, 80, 248, 1 - DEFPUSHBUTTON "P&ocz", 1590, 9, 87, 60, 14 + DEFPUSHBUTTON "P&ołącz", 1590, 9, 87, 60, 14 PUSHBUTTON "Anuluj", 1591, 72, 87, 60, 14 - PUSHBUTTON "&Waciwoci", 1107, 135, 87, 60, 14 + PUSHBUTTON "&Właściwości", 1107, 135, 87, 60, 14 PUSHBUTTON "&Pomoc", 1592, 198, 87, 60, 14 END 1421 DIALOGEX 0, 0, 265, 223 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "Pocz z %1" +CAPTION "Połącz z %1" FONT 8, "MS Shell Dlg" BEGIN CONTROL 1678, 1100, "STATIC", SS_BITMAP, 0, 0, 265, 50 - LTEXT "&Nazwa uytkownika:", 1413, 10, 61, 90, 8 + LTEXT "&Nazwa użytkownika:", 1413, 10, 61, 90, 8 EDITTEXT 1104, 104, 58, 154, 14, ES_AUTOHSCROLL - LTEXT "&Haso:", 1112, 11, 81, 90, 8 + LTEXT "&Hasło:", 1112, 11, 81, 90, 8 EDITTEXT 1103, 104, 77, 154, 14, ES_PASSWORD | ES_AUTOHSCROLL CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN, 10, 98, 248, 1 - AUTOCHECKBOX "&Zapisz t nazw uytkownika i haso dla nastpujcych uytkownikw:", 1101, 14, 105, 242, 13, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP + AUTOCHECKBOX "&Zapisz tą nazwę użytkownika i hasło dla następujących użytkowników:", 1101, 14, 105, 242, 13, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP AUTORADIOBUTTON "Tylko &ja", 1622, 26, 119, 225, 11, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP - AUTORADIOBUTTON "&Kady kto uywa tego komputera", 1623, 26, 133, 225, 11, BS_LEFT | BS_TOP | BS_MULTILINE + AUTORADIOBUTTON "&Każdy kto używa tego komputera", 1623, 26, 133, 225, 11, BS_LEFT | BS_TOP | BS_MULTILINE CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 10, 149, 248, 1 - LTEXT "P&oczenie:", 1412, 14, 161, 87, 8 + LTEXT "P&ołączenie:", 1412, 14, 161, 87, 8 COMBOBOX 1416, 104, 157, 154, 112, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | NOT WS_TABSTOP LTEXT "Wy&bieranie z:", 1415, 14, 178, 88, 8 COMBOBOX 1414, 104, 175, 87, 112, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | NOT WS_TABSTOP - PUSHBUTTON "&Reguy wybierania", 1108, 193, 175, 65, 14 + PUSHBUTTON "&Reguły wybierania", 1108, 193, 175, 65, 14 CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 10, 196, 248, 1 - DEFPUSHBUTTON "&Dzwo", 1590, 9, 202, 60, 14, WS_GROUP + DEFPUSHBUTTON "&Dzwoń", 1590, 9, 202, 60, 14, WS_GROUP PUSHBUTTON "Anuluj", 1591, 72, 202, 60, 14 - PUSHBUTTON "&Waciwoci", 1107, 135, 202, 60, 14 + PUSHBUTTON "&Właściwości", 1107, 135, 202, 60, 14 PUSHBUTTON "&Pomoc", 1592, 198, 202, 60, 14 END 1422 DIALOGEX 0, 0, 265, 242 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "Pocz z %1" +CAPTION "Połącz z %1" FONT 8, "MS Shell Dlg" BEGIN CONTROL 1678, 1100, "STATIC", SS_BITMAP, 0, 0, 265, 50 - LTEXT "&Nazwa uytkownika:", 1413, 10, 67, 91, 8 + LTEXT "&Nazwa użytkownika:", 1413, 10, 67, 91, 8 EDITTEXT 1104, 104, 63, 154, 14, ES_AUTOHSCROLL - LTEXT "&Haso:", 1112, 10, 85, 92, 8 + LTEXT "&Hasło:", 1112, 10, 85, 92, 8 EDITTEXT 1103, 104, 82, 154, 14, ES_PASSWORD | ES_AUTOHSCROLL LTEXT "&Domena:", 1110, 10, 104, 92, 8 EDITTEXT 1102, 104, 101, 154, 14, ES_UPPERCASE | ES_AUTOHSCROLL CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN, 10, 121, 248, 1 - AUTOCHECKBOX "&Zapisz t nazw uytkownika i haso dla nastpujcych uytkownikw:", 1101, 12, 127, 242, 13, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP + AUTOCHECKBOX "&Zapisz tą nazwę użytkownika i hasło dla następujących użytkowników:", 1101, 12, 127, 242, 13, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP AUTORADIOBUTTON "Tylko &ja", 1622, 24, 141, 227, 11, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP - AUTORADIOBUTTON "&Kady kto uywa tego komputera", 1623, 24, 155, 230, 11, BS_LEFT | BS_TOP | BS_MULTILINE + AUTORADIOBUTTON "&Każdy kto używa tego komputera", 1623, 24, 155, 230, 11, BS_LEFT | BS_TOP | BS_MULTILINE CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 10, 170, 248, 1 - LTEXT "P&oczenie:", 1412, 14, 182, 87, 8 + LTEXT "P&ołączenie:", 1412, 14, 182, 87, 8 COMBOBOX 1416, 104, 178, 154, 112, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | NOT WS_TABSTOP LTEXT "Wy&bieranie z:", 1415, 14, 198, 87, 8 COMBOBOX 1414, 104, 195, 87, 112, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | NOT WS_TABSTOP - PUSHBUTTON "&Reguy wybierania", 1108, 193, 195, 65, 14 + PUSHBUTTON "&Reguły wybierania", 1108, 193, 195, 65, 14 CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 10, 215, 248, 1 - DEFPUSHBUTTON "&Dzwo", 1590, 8, 221, 60, 14, WS_GROUP + DEFPUSHBUTTON "&Dzwoń", 1590, 8, 221, 60, 14, WS_GROUP PUSHBUTTON "Anuluj", 1591, 71, 221, 60, 14 - PUSHBUTTON "&Waciwoci", 1107, 134, 221, 60, 14 + PUSHBUTTON "&Właściwości", 1107, 134, 221, 60, 14 PUSHBUTTON "&Pomoc", 1592, 198, 221, 60, 14 END 1425 DIALOGEX 0, 0, 230, 215 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION -CAPTION "Oglne" +CAPTION "Ogólne" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Wprowad &nazw hosta albo adres IP celu (na przykad reactos.org albo 145.52.0.1):", 1430, 7, 5, 217, 18 + LTEXT "Wprowadź &nazwę hosta albo adres IP celu (na przykład reactos.org albo 145.52.0.1):", 1430, 7, 5, 217, 18 EDITTEXT 1427, 7, 25, 215, 14, ES_AUTOHSCROLL - GROUPBOX "Poczenie wstpne", 1431, 9, 48, 213, 78 - LTEXT "ReactOS moe wpierw poczy si z sieci publiczn, np z Internetem, przed prb ustanowienia tego poczenia z VPN.", 1432, 17, 63, 199, 24 - AUTOCHECKBOX "&Wybierz najpierw inne poczenie:", 1428, 19, 89, 183, 10 + GROUPBOX "Połączenie wstępne", 1431, 9, 48, 213, 78 + LTEXT "ReactOS może wpierw połączyć się z siecią publiczną, np z Internetem, przed próbą ustanowienia tego połączenia z VPN.", 1432, 17, 63, 199, 24 + AUTOCHECKBOX "&Wybierz najpierw inne połączenie:", 1428, 19, 89, 183, 10 COMBOBOX 1429, 29, 103, 182, 87, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | NOT WS_TABSTOP - AUTOCHECKBOX "Po&ka ikon w zasobniku systemowym podczas trwania poczenia", 1120, 10, 192, 213, 13 + AUTOCHECKBOX "Po&każ ikonę w zasobniku systemowym podczas trwania połączenia", 1120, 10, 192, 213, 13 END 1426 DIALOGEX 0, 0, 230, 215 @@ -1475,75 +1476,75 @@ CAPTION "Opcje" FONT 8, "MS Shell Dlg" BEGIN GROUPBOX "Opcje wybierania", 1289, 8, 7, 214, 56 - AUTOCHECKBOX "&Wywietlaj przebieg poczenia", 1284, 16, 17, 199, 10 - AUTOCHECKBOX "&Zapytaj o nazw uytkownika, haso, certyfikat itd.", 1554, 16, 32, 199, 10 - AUTOCHECKBOX "Docz domen logowania z &ReactOS", 1555, 16, 47, 178, 10 + AUTOCHECKBOX "&Wyświetlaj przebieg połączenia", 1284, 16, 17, 199, 10 + AUTOCHECKBOX "&Zapytaj o nazwę użytkownika, hasło, certyfikat itd.", 1554, 16, 32, 199, 10 + AUTOCHECKBOX "Dołącz domenę logowania z &ReactOS", 1555, 16, 47, 178, 10 GROUPBOX "Wybieranie ponowne", 1290, 8, 68, 214, 89 - LTEXT "&Ilo prb wybierania:", 1300, 16, 81, 121, 8 + LTEXT "&Ilość prób wybierania:", 1300, 16, 81, 121, 8 EDITTEXT 1287, 140, 77, 70, 14, ES_AUTOHSCROLL | ES_NUMBER - LTEXT "&Czas pomidzy prbami wybierania:", 1301, 16, 99, 121, 8 + LTEXT "&Czas pomiędzy próbami wybierania:", 1301, 16, 99, 121, 8 COMBOBOX 1292, 141, 95, 70, 123, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - LTEXT "Czas &bezczynnoci przed zawieszeniem poczenia:", 1299, 16, 117, 121, 8 + LTEXT "Czas &bezczynności przed zawieszeniem połączenia:", 1299, 16, 117, 121, 8 COMBOBOX 1291, 141, 113, 70, 108, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - AUTOCHECKBOX "Wybieraj &ponownie przy zerwaniu poczenia", 1286, 16, 138, 199, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Wybieraj &ponownie przy zerwaniu połączenia", 1286, 16, 138, 199, 10, BS_TOP | BS_MULTILINE END 1427 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Wprowad nazw hosta albo adres IP komputera z ktrym chcesz si poczy.", -1, 10, 6, 275, 16 - LTEXT "&Nazwa hosta albo adres IP (na przykad, reactos.org or 145.52.0.1 ):", -1, 21, 28, 277, 11 + LTEXT "Wprowadź nazwę hosta albo adres IP komputera z którym chcesz się połączyć.", -1, 10, 6, 275, 16 + LTEXT "&Nazwa hosta albo adres IP (na przykład, reactos.org or 145.52.0.1 ):", -1, 21, 28, 277, 11 EDITTEXT 1433, 21, 42, 275, 14, ES_AUTOHSCROLL END 1428 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Kreator konfiguracji poczenia" +CAPTION "Kreator konfiguracji połączenia" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "ReactOS moe wpierw poczy si z sieci publiczn, np z Internetem, przed prb ustanowienia tego poczenia z VPN.", -1, 10, 6, 275, 24 - AUTORADIOBUTTON "&Nie wykonuj poczenia wstpnego.", 1509, 32, 31, 271, 10, BS_TOP | BS_MULTILINE | NOT WS_TABSTOP - AUTORADIOBUTTON "&Automagicznie wykonaj poczenie wstpne:", 1510, 32, 45, 269, 10, BS_TOP | BS_MULTILINE | NOT WS_TABSTOP + LTEXT "ReactOS może wpierw połączyć się z siecią publiczną, np z Internetem, przed próbą ustanowienia tego połączenia z VPN.", -1, 10, 6, 275, 24 + AUTORADIOBUTTON "&Nie wykonuj połączenia wstępnego.", 1509, 32, 31, 271, 10, BS_TOP | BS_MULTILINE | NOT WS_TABSTOP + AUTORADIOBUTTON "&Automagicznie wykonaj połączenie wstępne:", 1510, 32, 45, 269, 10, BS_TOP | BS_MULTILINE | NOT WS_TABSTOP COMBOBOX 1435, 43, 62, 253, 87, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | NOT WS_TABSTOP END 1436 DIALOGEX 0, 0, 230, 215 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION -CAPTION "Oglne" +CAPTION "Ogólne" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "&Wybierz urzdzenie:", 1597, 8, 5, 213, 8 + LTEXT "&Wybierz urządzenie:", 1597, 8, 5, 213, 8 COMBOBOX 1437, 7, 17, 217, 166, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | NOT WS_TABSTOP - AUTOCHECKBOX "P&oka ikon w zasobniku systemowym podczas trwania poczenia", 1120, 11, 195, 213, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "P&okaż ikonę w zasobniku systemowym podczas trwania połączenia", 1120, 11, 195, 213, 10, BS_TOP | BS_MULTILINE PUSHBUTTON "&Konfiguruj", 1130, 160, 34, 60, 14 END 1448 DIALOGEX 10, 20, 265, 71 STYLE DS_SHELLFONT | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION "Poczenia sieciowe" +CAPTION "Połączenia sieciowe" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "&Wybierz poczenie sieciowe:", 1456, 7, 7, 251, 10 + LTEXT "&Wybierz połączenie sieciowe:", 1456, 7, 7, 251, 10 COMBOBOX 1457, 8, 18, 250, 140, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | NOT WS_TABSTOP - DEFPUSHBUTTON "&Pocz...", 1449, 7, 50, 60, 14 + DEFPUSHBUTTON "&Połącz...", 1449, 7, 50, 60, 14 PUSHBUTTON "Anuluj", 1455, 70, 50, 60, 14 PUSHBUTTON "&Nowe...", 1459, 134, 50, 60, 14 - PUSHBUTTON "W&aciwoci", 1460, 198, 50, 60, 14 + PUSHBUTTON "Wł&aściwości", 1460, 198, 50, 60, 14 END 1466 DIALOGEX 6, 18, 265, 262 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Przykadowy tekst", 1469, 7, 7, 251, 8 + LTEXT "Przykładowy tekst", 1469, 7, 7, 251, 8 EDITTEXT 1470, 7, 17, 193, 14, ES_AUTOHSCROLL PUSHBUTTON "&Dodaj", 1471, 77, 36, 60, 14 - PUSHBUTTON "&Zamie", 1472, 141, 36, 60, 14 - LTEXT "Przykadowy tekst", 1473, 7, 57, 193, 8 + PUSHBUTTON "&Zamień", 1472, 141, 36, 60, 14 + LTEXT "Przykładowy tekst", 1473, 7, 57, 193, 8 LISTBOX 1474, 7, 68, 193, 145, WS_VSCROLL | WS_TABSTOP PUSHBUTTON "", 1475, 206, 68, 51, 14, BS_BITMAP | WS_GROUP - PUSHBUTTON "&D", 1476, 206, 86, 51, 14, BS_BITMAP + PUSHBUTTON "&Dół", 1476, 206, 86, 51, 14, BS_BITMAP PUSHBUTTON "&Skasuj", 1477, 141, 215, 60, 14 CONTROL "", 1479, "STATIC", SS_ETCHEDHORZ, 7, 233, 249, 1 PUSHBUTTON "OK", 1, 132, 242, 60, 14, WS_GROUP @@ -1554,16 +1555,16 @@ END STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Przykadowy tekst", 1469, 7, 7, 197, 8 + LTEXT "Przykładowy tekst", 1469, 7, 7, 197, 8 EDITTEXT 1470, 7, 17, 193, 14, ES_AUTOHSCROLL PUSHBUTTON "&Dodaj", 1471, 76, 36, 60, 14 - PUSHBUTTON "&Zamie", 1472, 141, 36, 60, 14 - LTEXT "Przykadowy tekst", 1473, 7, 57, 193, 8 + PUSHBUTTON "&Zamień", 1472, 141, 36, 60, 14 + LTEXT "Przykładowy tekst", 1473, 7, 57, 193, 8 LISTBOX 1474, 7, 68, 193, 135, WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "&Gra", 1475, 206, 68, 51, 14, BS_BITMAP | WS_GROUP - PUSHBUTTON "&D", 1476, 206, 86, 51, 14, BS_BITMAP + PUSHBUTTON "&Góra", 1475, 206, 68, 51, 14, BS_BITMAP | WS_GROUP + PUSHBUTTON "&Dół", 1476, 206, 86, 51, 14, BS_BITMAP PUSHBUTTON "&Skasuj", 1477, 141, 204, 60, 14 - AUTOCHECKBOX "Przykadowy tekst", 1478, 7, 225, 249, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Przykładowy tekst", 1478, 7, 225, 249, 10, BS_TOP | BS_MULTILINE PUSHBUTTON "OK", 1, 132, 242, 60, 14, WS_GROUP PUSHBUTTON "Anuluj", 2, 196, 242, 60, 14 END @@ -1572,11 +1573,11 @@ END STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Przykadowy tekst", 1469, 7, 5, 249, 8 + LTEXT "Przykładowy tekst", 1469, 7, 5, 249, 8 EDITTEXT 1470, 7, 17, 249, 14, ES_AUTOHSCROLL PUSHBUTTON "&Dodaj", 1471, 132, 36, 60, 14 - PUSHBUTTON "&Zamie", 1472, 196, 36, 60, 14 - LTEXT "Przykadowy tekst", 1473, 7, 55, 251, 8 + PUSHBUTTON "&Zamień", 1472, 196, 36, 60, 14 + LTEXT "Przykładowy tekst", 1473, 7, 55, 251, 8 LISTBOX 1474, 7, 68, 249, 140, LBS_STANDARD | WS_TABSTOP PUSHBUTTON "&Skasuj", 1477, 196, 214, 60, 14, WS_GROUP CONTROL "", 1479, "STATIC", SS_ETCHEDHORZ, 7, 233, 249, 1 @@ -1586,25 +1587,25 @@ END 1469 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Kreator konfiguracji poczenia" +CAPTION "Kreator konfiguracji połączenia" FONT 8, "MS Shell Dlg" BEGIN - AUTORADIOBUTTON "Poczenie &Dial-up do sieci prywatnej.", 1488, 24, 9, 116, 10, NOT WS_TABSTOP - AUTORADIOBUTTON "Pocz si z sieci prywatn za porednictwem &Internetu.", 1489, 24, 34, 206, 10, NOT WS_TABSTOP - AUTORADIOBUTTON "&Bezporednie poczenie z innym komputerem.", 1490, 24, 59, 157, 10, NOT WS_TABSTOP - AUTORADIOBUTTON "Poczenie z sieci poprzez cze &stae", 1491, 24, 83, 273, 10, NOT WS_TABSTOP - LTEXT "Pocz za pomoc linii telefonicznej (modem albo ISDN).", -1, 45, 21, 156, 8 - LTEXT "Stwrz poczenie VPN albo poczenie tunelowe poprzez internet.", -1, 45, 46, 266, 8 - LTEXT "Pocz za pomoc portu szeregowego, rwnolegego albo podczerwieni.", -1, 45, 71, 266, 8 - LTEXT "Connect through my broadband connection.", -1, 45, 95, 266, 8 + AUTORADIOBUTTON "Połączenie &Dial-up do sieci prywatnej.", 1488, 24, 9, 116, 10, NOT WS_TABSTOP + AUTORADIOBUTTON "Połącz się z siecią prywatną za pośrednictwem &Internetu.", 1489, 24, 34, 206, 10, NOT WS_TABSTOP + AUTORADIOBUTTON "&Bezpośrednie połączenie z innym komputerem.", 1490, 24, 59, 157, 10, NOT WS_TABSTOP + AUTORADIOBUTTON "Połączenie z siecią poprzez łącze &stałe", 1491, 24, 83, 273, 10, NOT WS_TABSTOP + LTEXT "Połącz za pomocą linii telefonicznej (modem albo ISDN).", -1, 45, 21, 156, 8 + LTEXT "Stwórz połączenie VPN albo połączenie tunelowe poprzez internet.", -1, 45, 46, 266, 8 + LTEXT "Połącz za pomocą portu szeregowego, równoległego albo podczerwieni.", -1, 45, 71, 266, 8 + LTEXT "Połącz za pomocą łącza szerokopasmowego.", -1, 45, 95, 266, 8 END 1480 DIALOGEX 0, 0, 230, 61 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "Edytor numerw telefonicznych" +CAPTION "Edytor numerów telefonicznych" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "&Prosz wprowadzi nowy numer:", 1481, 7, 7, 218, 8 + LTEXT "&Proszę wprowadzić nowy numer:", 1481, 7, 7, 218, 8 EDITTEXT 1482, 7, 17, 217, 15, ES_AUTOHSCROLL DEFPUSHBUTTON "OK", 1, 99, 40, 60, 14 PUSHBUTTON "Anuluj", 2, 163, 40, 60, 14 @@ -1612,19 +1613,19 @@ END 1481 DIALOGEX 0, 0, 321, 157 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "Kreator konfiguracji poczenia" +CAPTION "Kreator konfiguracji połączenia" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Wprowad nazw konta i haso u ISP, nastpnie zapisz te informacje i przechowaj w bezpiecznym miejscu. (Jeeli mimo to zapomniae nazwy konta albo hasa, skontaktuj si ze swoim ISP.)", 1689, 10, 4, 308, 25 + LTEXT "Wprowadź nazwę konta i hasło u ISP, następnie zapisz te informacje i przechowaj w bezpiecznym miejscu. (Jeżeli mimo to zapomniałeś nazwy konta albo hasła, skontaktuj się ze swoim ISP.)", 1689, 10, 4, 308, 25 LTEXT "&Nazwa konta:", 1636, 23, 35, 89, 15 EDITTEXT 1614, 115, 34, 190, 15, ES_AUTOHSCROLL - LTEXT "&Haso:", 1637, 23, 55, 90, 13 + LTEXT "&Hasło:", 1637, 23, 55, 90, 13 EDITTEXT 1615, 115, 54, 190, 15, ES_PASSWORD | ES_AUTOHSCROLL - LTEXT "&Potwierd haso:", 1638, 23, 74, 88, 13 + LTEXT "&Potwierdź hasło:", 1638, 23, 74, 88, 13 EDITTEXT 1616, 115, 73, 190, 15, ES_PASSWORD | ES_AUTOHSCROLL - AUTOCHECKBOX "U&yj tej nazwy konta i hasa gdy ktrykolwiek uytkownik bdzie czy si z Internetem, z tego komputera", 1596, 23, 91, 291, 17, BS_LEFT | BS_TOP | BS_MULTILINE - AUTOCHECKBOX "&Ustaw to poczenie sieciowe jako domylne", 1595, 23, 112, 288, 14 - AUTOCHECKBOX "&Wcz Firewall Systemowy dla tego poczenia", 1682, 23, 133, 290, 14 + AUTOCHECKBOX "Uż&yj tej nazwy konta i hasła gdy którykolwiek użytkownik będzie łączył się z Internetem, z tego komputera", 1596, 23, 91, 291, 17, BS_LEFT | BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Ustaw to połączenie sieciowe jako domyślne", 1595, 23, 112, 288, 14 + AUTOCHECKBOX "&Włącz Firewall Systemowy dla tego połączenia", 1682, 23, 133, 290, 14 END 1660 DIALOGEX 0, 0, 258, 78 @@ -1633,24 +1634,24 @@ CAPTION "Internet Connection Firewall" FONT 8, "MS Shell Dlg" BEGIN ICON 32515, -1, 7, 7, 20, 20 - LTEXT "Wyczenie Firewalla Systemowego moe narazi twj komputer na nieautoryzowane wtargnicie z Internetu. Czy na pewno chcesz go wyczy?", -1, 44, 5, 212, 24 - AUTOCHECKBOX "&Nie pokazuj wicej tej wiadomoci", 1662, 42, 40, 210, 10 + LTEXT "Wyłączenie Firewalla Systemowego może narazić twój komputer na nieautoryzowane wtargnięcie z Internetu. Czy na pewno chcesz go wyłączyć?", -1, 44, 5, 212, 24 + AUTOCHECKBOX "&Nie pokazuj więcej tej wiadomości", 1662, 42, 40, 210, 10 DEFPUSHBUTTON "&Tak", 6, 74, 60, 50, 14 PUSHBUTTON "&Nie", 7, 128, 60, 50, 14 END 7000 DIALOGEX 0, 0, 215, 103 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUPWINDOW | WS_CAPTION -CAPTION "Oglne" +CAPTION "Ogólne" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "&Nazwa uytkownika:", -1, 7, 8, 90, 12, SS_CENTERIMAGE + LTEXT "&Nazwa użytkownika:", -1, 7, 8, 90, 12, SS_CENTERIMAGE EDITTEXT 7001, 101, 7, 108, 14, ES_AUTOHSCROLL LTEXT "&Imie i nazwisko:", -1, 7, 26, 90, 12 EDITTEXT 7002, 101, 25, 108, 14, ES_AUTOHSCROLL - LTEXT "&Haso:", -1, 7, 44, 90, 12 + LTEXT "&Hasło:", -1, 7, 44, 90, 12 EDITTEXT 7003, 101, 43, 108, 14, ES_PASSWORD | ES_AUTOHSCROLL - LTEXT "&Potwierd haso:", -1, 7, 62, 91, 12 + LTEXT "&Potwierdź hasło:", -1, 7, 62, 91, 12 EDITTEXT 7004, 101, 61, 108, 14, ES_PASSWORD | ES_AUTOHSCROLL PUSHBUTTON "OK", 1, 84, 82, 60, 14 PUSHBUTTON "Anuluj", 2, 149, 82, 60, 14 @@ -1662,68 +1663,68 @@ CAPTION "Oddzwanianie" FONT 8, "MS Shell Dlg" BEGIN AUTORADIOBUTTON "&Nie zezwalaj na oddzwanianie", 7009, 9, 7, 219, 10, BS_TOP | BS_MULTILINE | WS_GROUP - AUTORADIOBUTTON "&Zezwl na wybr numeru przez oddzwaniajcego", 7006, 9, 20, 218, 10, BS_TOP | BS_MULTILINE | NOT WS_TABSTOP - AUTORADIOBUTTON "&Uywaj wycznie podanych numerw do oddzwaniania:", 7007, 9, 34, 217, 10, BS_TOP | BS_MULTILINE | NOT WS_TABSTOP + AUTORADIOBUTTON "&Zezwól na wybór numeru przez oddzwaniającego", 7006, 9, 20, 218, 10, BS_TOP | BS_MULTILINE | NOT WS_TABSTOP + AUTORADIOBUTTON "&Używaj wyłącznie podanych numerów do oddzwaniania:", 7007, 9, 34, 217, 10, BS_TOP | BS_MULTILINE | NOT WS_TABSTOP EDITTEXT 7008, 19, 49, 204, 14, ES_AUTOHSCROLL | WS_GROUP END 7010 DIALOGEX 0, 0, 230, 215 STYLE DS_SHELLFONT | DS_CONTEXTHELP | WS_CHILD | WS_CAPTION -CAPTION "Oglne" +CAPTION "Ogólne" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "Poczenia przychodzce", -1, 7, 4, 214, 110, WS_GROUP - LTEXT "Zezwalaj na poczenia przychodzce do tych urzdze.", -1, 17, 17, 195, 8 - LTEXT "&Urzdzenia:", -1, 17, 29, 29, 8 + GROUPBOX "Połączenia przychodzące", -1, 7, 4, 214, 110, WS_GROUP + LTEXT "Zezwalaj na połączenia przychodzące do tych urządzeń.", -1, 17, 17, 195, 8 + LTEXT "&Urządzenia:", -1, 17, 29, 29, 8 CONTROL "", 7011, "SYSLISTVIEW32", WS_BORDER | WS_GROUP | WS_TABSTOP | 0x00004405, 17, 41, 193, 47, WS_EX_CLIENTEDGE - AUTOCHECKBOX "&Wcz multipoczenia", 7012, 17, 96, 121, 10, BS_TOP | BS_MULTILINE | WS_GROUP - PUSHBUTTON "W&aciwoci", 7013, 145, 94, 65, 14, WS_GROUP + AUTOCHECKBOX "&Włącz multipołączenia", 7012, 17, 96, 121, 10, BS_TOP | BS_MULTILINE | WS_GROUP + PUSHBUTTON "Wł&aściwości", 7013, 145, 94, 65, 14, WS_GROUP GROUPBOX "Wirtualne sieci prywatne", -1, 6, 122, 214, 49, WS_GROUP - AUTOCHECKBOX "&Zezwl innym na ustanawianie pocze z moim komputerem poprzez tunelowanie przez Internet lub inn sie", 7014, 17, 137, 195, 27, BS_TOP | BS_MULTILINE | WS_GROUP - AUTOCHECKBOX "&Poka ikon w zasobniku systemowym podczas trwania poczenia", 7015, 12, 184, 209, 10, BS_TOP | BS_MULTILINE | WS_GROUP + AUTOCHECKBOX "&Zezwól innym na ustanawianie połączeń z moim komputerem poprzez tunelowanie przez Internet lub inną sieć", 7014, 17, 137, 195, 27, BS_TOP | BS_MULTILINE | WS_GROUP + AUTOCHECKBOX "&Pokaż ikonę w zasobniku systemowym podczas trwania połączenia", 7015, 12, 184, 209, 10, BS_TOP | BS_MULTILINE | WS_GROUP END 7016 DIALOGEX 0, 0, 265, 190 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUPWINDOW | WS_CAPTION -CAPTION "Waciwoci przychodzcych pocze TCP/IP" +CAPTION "Właściwości przychodzących połączeń TCP/IP" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "Dostp sieciowy", -1, 6, 5, 252, 32 - AUTOCHECKBOX "&Zezwl dzwonicym na dostp do mojej sieci lokalnej", 7017, 20, 20, 228, 9, BS_LEFT | BS_TOP | BS_MULTILINE - GROUPBOX "Przydzia adresw TCP/IP", -1, 6, 42, 250, 122 - AUTORADIOBUTTON "&Przydziel adresy TCP/IP automagicznie, za pomoc DHCP", 7019, 20, 54, 231, 10, BS_TOP | BS_MULTILINE | WS_GROUP + GROUPBOX "Dostęp sieciowy", -1, 6, 5, 252, 32 + AUTOCHECKBOX "&Zezwól dzwoniącym na dostęp do mojej sieci lokalnej", 7017, 20, 20, 228, 9, BS_LEFT | BS_TOP | BS_MULTILINE + GROUPBOX "Przydział adresów TCP/IP", -1, 6, 42, 250, 122 + AUTORADIOBUTTON "&Przydziel adresy TCP/IP automagicznie, za pomocą DHCP", 7019, 20, 54, 231, 10, BS_TOP | BS_MULTILINE | WS_GROUP AUTORADIOBUTTON "&Wyznacz adresy TCP/IP", 7020, 20, 71, 231, 10, BS_TOP | BS_MULTILINE LTEXT "&Od:", -1, 29, 88, 53, 8 CONTROL "", 7018, "RASIPADDRESS", WS_GROUP | WS_TABSTOP, 90, 85, 103, 13 LTEXT "&Do:", -1, 29, 105, 53, 8 CONTROL "", 7021, "RASIPADDRESS", WS_GROUP | WS_TABSTOP, 90, 102, 103, 13 - LTEXT "Oglnie:", -1, 29, 124, 53, 10 + LTEXT "Ogólnie:", -1, 29, 124, 53, 10 LTEXT "", 7024, 90, 121, 150, 14, 0, WS_EX_STATICEDGE - AUTOCHECKBOX "Zezwl dz&wonicym komputerom na ustawienie wasnych adresw IP", 7022, 20, 144, 231, 10, BS_TOP | BS_MULTILINE | WS_GROUP + AUTOCHECKBOX "Zezwól dz&woniącym komputerom na ustawienie własnych adresów IP", 7022, 20, 144, 231, 10, BS_TOP | BS_MULTILINE | WS_GROUP DEFPUSHBUTTON "OK", 1, 133, 169, 60, 14, WS_GROUP PUSHBUTTON "Anuluj", 2, 197, 169, 60, 14 END 7025 DIALOGEX 0, 0, 250, 157 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUPWINDOW | WS_CAPTION -CAPTION "Waciwoci przychodzcych pocze IPX" +CAPTION "Właściwości przychodzących połączeń IPX" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX "Dostp sieciowy", -1, 8, 6, 234, 32 - AUTOCHECKBOX "A&Zezwl dzwonicym na dostp do mojej sieci lokalnej", 7032, 18, 19, 194, 12, BS_LEFT | BS_TOP | BS_MULTILINE - GROUPBOX "Przydzia adresw sieciowych", -1, 8, 43, 234, 87 + GROUPBOX "Dostęp sieciowy", -1, 8, 6, 234, 32 + AUTOCHECKBOX "A&Zezwól dzwoniącym na dostęp do mojej sieci lokalnej", 7032, 18, 19, 194, 12, BS_LEFT | BS_TOP | BS_MULTILINE + GROUPBOX "Przydział adresów sieciowych", -1, 8, 43, 234, 87 AUTOCHECKBOX "&Przydziel ten sam adres sieciowy wszystkim komputerom", 7028, 17, 56, 203, 10, BS_TOP | BS_MULTILINE | WS_GROUP AUTORADIOBUTTON "P&rzydziel adres sieciowy automagicznie", 7026, 28, 68, 191, 10, BS_TOP | BS_MULTILINE | WS_GROUP AUTORADIOBUTTON "&Wyznacz adresy sieciowe:", 7027, 28, 81, 189, 10, BS_TOP | BS_MULTILINE | NOT WS_TABSTOP EDITTEXT 7029, 40, 92, 154, 14, ES_UPPERCASE | WS_GROUP - AUTOCHECKBOX "Zezwl &dzwonicym na ustawienie wasnych numerw wza", 7031, 17, 113, 208, 11, BS_TOP | BS_MULTILINE | WS_GROUP + AUTOCHECKBOX "Zezwól &dzwoniącym na ustawienie własnych numerów węzła", 7031, 17, 113, 208, 11, BS_TOP | BS_MULTILINE | WS_GROUP DEFPUSHBUTTON "OK", 1, 116, 136, 60, 14, WS_GROUP PUSHBUTTON "Anuluj", 2, 181, 136, 60, 14 END 7033 DIALOGEX 0, 0, 220, 50 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUPWINDOW | WS_CAPTION -CAPTION "Wa" +CAPTION "Wła" FONT 8, "MS Shell Dlg" BEGIN AUTOCHECKBOX "Allow &callers to access my local area network", 7034, 7, 7, 208, 18, BS_LEFT | BS_TOP | BS_MULTILINE @@ -1733,65 +1734,65 @@ END 7035 DIALOGEX 0, 0, 230, 215 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUPWINDOW | WS_CAPTION -CAPTION "Sie" +CAPTION "Sieć" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "&Skadniki sieci:", -1, 7, 7, 217, 9 + LTEXT "&Składniki sieci:", -1, 7, 7, 217, 9 CONTROL "", 7036, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x0000440D, 7, 17, 215, 89, WS_EX_CLIENTEDGE PUSHBUTTON "&Instaluj..", 7037, 9, 110, 67, 14, WS_GROUP PUSHBUTTON "&Odinstaluj", 7038, 80, 110, 67, 14, WS_GROUP - PUSHBUTTON "&Waciwoci", 7039, 153, 110, 67, 14, WS_GROUP + PUSHBUTTON "&Właściwości", 7039, 153, 110, 67, 14, WS_GROUP GROUPBOX "Opis", -1, 7, 138, 213, 69 - LTEXT "", 7040, 17, 150, 193, 48 + LTEXT "", 7040, 17, 150, 193, 48 END 7042 DIALOGEX 0, 0, 230, 215 STYLE DS_SHELLFONT | DS_CONTEXTHELP | WS_CHILD | WS_CAPTION -CAPTION "Uytkownicy" +CAPTION "Użytkownicy" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "&Uytkownicy ktrzy mog si poczy:", -1, 7, 5, 213, 8 + LTEXT "&Użytkownicy którzy mogą się połączyć:", -1, 7, 5, 213, 8 CONTROL "", 7043, "SYSLISTVIEW32", WS_BORDER | WS_GROUP | WS_TABSTOP | 0x0000440D, 7, 19, 214, 83, WS_EX_CLIENTEDGE PUSHBUTTON "&Nowy.....", 7044, 7, 107, 67, 14, WS_GROUP - PUSHBUTTON "&Usu.....", 7045, 80, 107, 67, 14, WS_GROUP - PUSHBUTTON "&Waciwoci", 7046, 153, 107, 67, 14, WS_GROUP - AUTOCHECKBOX "Wy&magaj zabezpieczenia danych i hase od wszystkich uytkownikw.", 7048, 8, 151, 217, 12, BS_TOP | BS_MULTILINE - AUTOCHECKBOX "&Zawsze zezwalaj urzdzeniom bezporednio poczonym z komputerem do poczenia si bez podawania hasa.", 7049, 8, 169, 217, 23, BS_TOP | BS_MULTILINE - LTEXT "Zauwa e inne ustawienia, takie jak wyczone konto uytkownika, mog mie wpyw na moliwo poczenia si uytkownika.", -1, 9, 126, 212, 23 + PUSHBUTTON "&Usuń.....", 7045, 80, 107, 67, 14, WS_GROUP + PUSHBUTTON "&Właściwości", 7046, 153, 107, 67, 14, WS_GROUP + AUTOCHECKBOX "Wy&magaj zabezpieczenia danych i haseł od wszystkich użytkowników.", 7048, 8, 151, 217, 12, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Zawsze zezwalaj urządzeniom bezpośrednio połączonym z komputerem do połączenia się bez podawania hasła.", 7049, 8, 169, 217, 23, BS_TOP | BS_MULTILINE + LTEXT "Zauważ że inne ustawienia, takie jak wyłączone konto użytkownika, mogą mieć wpływ na możliwość połączenia się użytkownika.", -1, 9, 126, 212, 23 END 7049 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Wybierz uytkownikw, ktrym chcesz zezwoli na czenie si z tym komputerem. Note that other factors, such as a disabled user account, may affect a user's ability to connect.", -1, 10, 1, 275, 27 - LTEXT "&Uytkownicy, ktrzy mog si poczy:", -1, 10, 28, 275, 8 + LTEXT "Wybierz użytkowników, którym chcesz zezwolić na łączenie się z tym komputerem. Note that other factors, such as a disabled user account, may affect a user's ability to connect.", -1, 10, 1, 275, 27 + LTEXT "&Użytkownicy, którzy mogą się połączyć:", -1, 10, 28, 275, 8 CONTROL "", 7043, "SYSLISTVIEW32", WS_BORDER | WS_GROUP | WS_TABSTOP | 0x0000440D, 10, 42, 275, 73 PUSHBUTTON "&Dodaj", 7044, 10, 122, 65, 14, WS_GROUP - PUSHBUTTON "&Usu", 7045, 79, 122, 65, 14, WS_GROUP - PUSHBUTTON "&Waciwoci", 7046, 147, 122, 65, 14, WS_GROUP + PUSHBUTTON "&Usuń", 7045, 79, 122, 65, 14, WS_GROUP + PUSHBUTTON "&Właściwości", 7046, 147, 122, 65, 14, WS_GROUP END 7050 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Wybierz urzdzenie, ktre chcesz uy do odbierania pocze przychodzcych.", -1, 10, 4, 299, 10 - LTEXT "&Urzdzenia:", -1, 10, 16, 275, 8 + LTEXT "Wybierz urządzenie, które chcesz użyć do odbierania połączeń przychodzących.", -1, 10, 4, 299, 10 + LTEXT "&Urządzenia:", -1, 10, 16, 275, 8 CONTROL "", 7011, "SYSLISTVIEW32", WS_BORDER | WS_GROUP | WS_TABSTOP | 0x0000440D, 10, 26, 297, 87 - PUSHBUTTON "&Waciwoci", 7013, 243, 120, 65, 14, WS_GROUP + PUSHBUTTON "&Właściwości", 7013, 243, 120, 65, 14, WS_GROUP END 7051 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Wybierz usugi sieciowe, ktre maj by uyte do obsugi pocze przychodzcych.", -1, 10, 1, 288, 20 - LTEXT "&Usugi sieciowe:", -1, 10, 24, 274, 8 + LTEXT "Wybierz usługi sieciowe, które mają być użyte do obsługi połączeń przychodzących.", -1, 10, 1, 288, 20 + LTEXT "&Usługi sieciowe:", -1, 10, 24, 274, 8 CONTROL "", 7036, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x0000440D, 10, 34, 286, 33 PUSHBUTTON "&Instaluj...", 7037, 108, 71, 60, 14, WS_GROUP PUSHBUTTON "&Odinstaluj", 7038, 172, 71, 60, 14, WS_GROUP - PUSHBUTTON "&Waciwoci", 7039, 236, 71, 60, 14, WS_GROUP + PUSHBUTTON "&Właściwości", 7039, 236, 71, 60, 14, WS_GROUP LTEXT "", 7040, 21, 105, 273, 38 LTEXT "Opis:", -1, 21, 95, 275, 8 END @@ -1800,21 +1801,21 @@ END STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Wirtualne Poczenia Prywatne do twojego komputera poprzez Internet s moliwe wycznie gdy komputer ogasza swoj nazw albo adres IP.", -1, 10, 4, 290, 20 - AUTORADIOBUTTON "&Zezwalaj na Wirtualne Poczenia Prywatne", 7053, 29, 63, 265, 10, BS_TOP | BS_MULTILINE | WS_GROUP - AUTORADIOBUTTON "&Nie zezwalaj na Wirtualne Poczenia Prywatne", 7054, 29, 78, 265, 10, BS_TOP | BS_MULTILINE | NOT WS_TABSTOP - LTEXT "Czy chcesz zezwoli na Wirtualne Poczenia Prywatne z tym komputerem?", -1, 17, 49, 275, 8 - LTEXT " Jeli tak, ReactOS zmodyfikuje Firewall Systemowy aby przepuszcza on pakiety VPN.", -1, 10, 25, 293, 25 + LTEXT "Wirtualne Połączenia Prywatne do twojego komputera poprzez Internet są możliwe wyłącznie gdy komputer ogłasza swoją nazwę albo adres IP.", -1, 10, 4, 290, 20 + AUTORADIOBUTTON "&Zezwalaj na Wirtualne Połączenia Prywatne", 7053, 29, 63, 265, 10, BS_TOP | BS_MULTILINE | WS_GROUP + AUTORADIOBUTTON "&Nie zezwalaj na Wirtualne Połączenia Prywatne", 7054, 29, 78, 265, 10, BS_TOP | BS_MULTILINE | NOT WS_TABSTOP + LTEXT "Czy chcesz zezwolić na Wirtualne Połączenia Prywatne z tym komputerem?", -1, 17, 49, 275, 8 + LTEXT " Jeśli tak, ReactOS zmodyfikuje Firewall Systemowy aby przepuszczał on pakiety VPN.", -1, 10, 25, 293, 25 END 7055 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT "&Urzdzenie dla tego pozenia:", -1, 23, 24, 275, 8 + LTEXT "&Urządzenie dla tego połąćzenia:", -1, 23, 24, 275, 8 COMBOBOX 7056, 22, 36, 275, 125, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - LTEXT "Urzdzenia inne ni wybrane nie zostan zajte i bd mogy by wykorzystane do innych celw.", -1, 10, 4, 275, 17 - PUSHBUTTON "&Waciwoci", 7061, 232, 53, 65, 14, WS_GROUP + LTEXT "Urządzenia inne niż wybrane nie zostaną zajęte i będą mogły być wykorzystane do innych celów.", -1, 10, 4, 275, 17 + PUSHBUTTON "&Właściwości", 7061, 232, 53, 65, 14, WS_GROUP END 7379 DIALOGEX 0, 0, 317, 143 @@ -1825,264 +1826,264 @@ END 19900 DIALOGEX 0, 0, 156, 44 STYLE DS_SHELLFONT | WS_POPUP | WS_CAPTION -CAPTION "Poczenia Dial-Up" +CAPTION "Połączenia Dial-Up" FONT 8, "MS Shell Dlg" BEGIN ICON 563, 19901, 10, 10, 18, 20 - LTEXT "Oczekiwanie na start usugi...", 19902, 34, 16, 120, 8 + LTEXT "Oczekiwanie na start usługi...", 19902, 34, 16, 120, 8 END STRINGTABLE BEGIN 187 "&Nie wybieraj\0" - 188 "Uytkownik (lub program) zarzda informacji z %1. Ktrego poczenia chcesz uy?\0" + 188 "Użytkownik (lub program) zarządał informacji z %1. Którego połączenia chcesz użyć?\0" 189 "Dodaj kolejne numery telefoniczne\0" - 190 "Wybieraj tylko na pierwszym dostpnym urzdzeniu\0" - 191 "Wybieraj na wszystkich urzdzeniach\0" - 192 "Wybieraj na urzdzeniach wedug potrzeb\0" - 193 "Wprowad nazw uytkownika i haso z dostpem do zdalnej domeny sieciowej.\0" - 194 "Translacja Adresw w Sieci (NAT) jest obecnie zainstalowana jako protok routujcy,\ni musi zosta usunita przed wczeniem Udostpniania Poczenia Internetowego.\nAby usun NAT, otwrz Menedera Routingu i Dostpu Zdalnego\nsnapin i rozwi opcje routera w panelu po lewej.\nSkasuj protok Translacji Adresw w Sieci z listy\nprotokow routingu IP.\0" - 195 "Numer kierunkowy moe zawiera jedynie cyfry od 0 do 9.\0" - 196 "Wprowadzona nazwa musi zawiera co najmniej jeden znak rny od spacji i nie moe zaczyna si od kropki. Prosz wybra inn nazw.\0" - 197 "Musisz wybra warto od %1 do %2 dla tego pola.\0" - 198 "Biblioteka DLL konfiugracji wasnego uwierzytelniania nie zostaa zaadowana. Upewnij si, e pakiet wasnego uwierzytelniania si zosta poprawnie zainstalowany.\0" - 199 "Wybrane poczenie zostao utworzone przez router wieloprotokoowy.\nProsz uy narzdzia 'Routing i Admin RAS' do zawieszenia tego poczenia.\0" + 190 "Wybieraj tylko na pierwszym dostępnym urządzeniu\0" + 191 "Wybieraj na wszystkich urządzeniach\0" + 192 "Wybieraj na urządzeniach według potrzeb\0" + 193 "Wprowadź nazwę użytkownika i hasło z dostępem do zdalnej domeny sieciowej.\0" + 194 "Translacja Adresów w Sieci (NAT) jest obecnie zainstalowana jako protokół routujący,\ni musi zostać usunięta przed włączeniem Udostępniania Połączenia Internetowego.\nAby usunąć NAT, otwórz Menedżera Routingu i Dostępu Zdalnego\nsnapin i rozwiń opcje routera w panelu po lewej.\nSkasuj protokół Translacji Adresów w Sieci z listy\nprotokołów routingu IP.\0" + 195 "Numer kierunkowy może zawierać jedynie cyfry od 0 do 9.\0" + 196 "Wprowadzona nazwa musi zawierać co najmniej jeden znak różny od spacji i nie może zaczynać się od kropki. Proszę wybrać inną nazwę.\0" + 197 "Musisz wybrać wartość od %1 do %2 dla tego pola.\0" + 198 "Biblioteka DLL konfiugracji własnego uwierzytelniania nie została załadowana. Upewnij się, że pakiet własnego uwierzytelniania się został poprawnie zainstalowany.\0" + 199 "Wybrane połączenie zostało utworzone przez router wieloprotokołowy.\nProszę użyć narzędzia 'Routing i Admin RAS' do zawieszenia tego połączenia.\0" 200 "Komentarz\0" - 201 "Konfiguracja pakietu wasnego uwierzytelniania zakoczone niepowodzeniem.\0" - 202 "TCP/IP nie zosta zainstalowanay albo jest wyczony dla Routingu i Dostpu Zdalnego. W Panelu Sterowania, wybierz Sieci, przejd na Usugi, wybierz Waciwoci usugi 'Routing i Dostp Zdalny', i nacinij przycisk Sie.\0" - 203 "IPX nie zosta zainstalowanay albo jest wyczony dla Routingu i Dostpu Zdalnego. Moesz zainstalowa/wczy IPX przegldajc Waciwoci dowolnego poczenia.\0" - 204 "Czy usun wybrane urzdzenia z listy?\0" - 205 "Skasowa %1 z Ksiki Telefonicznej?\0" - 206 "Rozczy si z %1?\0" - 207 "Plik o nazwie %1 ju istnieje. Czy chcesz go nadpisa?\0" - 208 "W skrypcie znajduj si bdy skadni. Czy chcesz przejrze komunikaty o bdach?\0" - 209 "'%1' jest teraz poczony. \0" - 210 "Nacinij prawy przycisk myszki na Monitorze Sieci Dial-Up w zasobniku systemowym, aby rozczy si lub sprawdzi stan twojego poczenia.\0" - 212 "Poczenie udane.\0" - 213 "Wybrana metoda uwierzytelniania wasnego musi zosta uaktywniona we Waciwociach.\0" + 201 "Konfiguracja pakietu własnego uwierzytelniania zakończone niepowodzeniem.\0" + 202 "TCP/IP nie został zainstalowanay albo jest wyłączony dla Routingu i Dostępu Zdalnego. W Panelu Sterowania, wybierz Sieci, przejdź na Usługi, wybierz Właściwości usługi 'Routing i Dostęp Zdalny', i naciśnij przycisk Sieć.\0" + 203 "IPX nie został zainstalowanay albo jest wyłączony dla Routingu i Dostępu Zdalnego. Możesz zainstalować/włączyć IPX przeglądając Właściwości dowolnego połączenia.\0" + 204 "Czy usunąć wybrane urządzenia z listy?\0" + 205 "Skasować %1 z Książki Telefonicznej?\0" + 206 "Rozłączyć się z %1?\0" + 207 "Plik o nazwie %1 już istnieje. Czy chcesz go nadpisać?\0" + 208 "W skrypcie znajdują się błędy składni. Czy chcesz przejrzeć komunikaty o błędach?\0" + 209 "'%1' jest teraz połączony. \0" + 210 "Naciśnij prawy przycisk myszki na Monitorze Sieci Dial-Up w zasobniku systemowym, aby rozłączyć się lub sprawdzić stan twojego połączenia.\0" + 212 "Połączenie udane.\0" + 213 "Wybrana metoda uwierzytelniania własnego musi zostać uaktywniona we Właściwościach.\0" 214 "lnk\0" - 215 "Skrt poczenia Dial-up(*.rnk)\0" + 215 "Skrót połączenia Dial-up(*.rnk)\0" 216 "*.rnk\0" - 217 "Utwrz skrt poczenia Dial-Up\0" - 218 "Poczenie z %1 nieudane. Ponowne poczenie w toku...\0" - 219 "Nie mona uzyska informacji o ramce.\0" - 220 "Nie mona uzyska informacji o.\0" + 217 "Utwórz skrót połączenia Dial-Up\0" + 218 "Połączenie z %1 nieudane. Ponowne połączenie w toku...\0" + 219 "Nie można uzyskać informacji o ramce.\0" + 220 "Nie można uzyskać informacji o.\0" 221 "Cannot retrieve projection information.\0" - 222 "Nie mona zadowa listy pocze.\0" + 222 "Nie można załądować listy połączeń.\0" 223 "Klienci:\0" - 224 "Szczegy\0" - 225 "Urzdzenia:\0" - 226 "Sie:\0" - 227 "(niepoczony)\0" - 228 "&Pocz...\0" - 229 "Zawie &poczenie\0" - 230 "Poczenie Dial-up\0" - 231 "Konfiguracja Modemu ustawiona na domylne\0" + 224 "Szczegóły\0" + 225 "Urządzenia:\0" + 226 "Sieć:\0" + 227 "(niepołączony)\0" + 228 "&Połącz...\0" + 229 "Zawieś &połączenie\0" + 230 "Połączenie Dial-up\0" + 231 "Konfiguracja Modemu ustawiona na domyślne\0" 232 "COM1\0" 233 "Router Zdalny\0" - 234 "Modem albo urzdzenie\0" - 235 "Prosz wprowadzi nazw uytkownika dla konta tego interface na routerze zdalnym.\0" - 236 "Nazwa %1 ju istnieje. Prosz wprowadzi inn nazw.\0" - 237 "Moesz zezwoli na wysyanie twojego hasa bez szyfrowania.\0" - 238 "Szyfrowanie Hasa\0" - 239 "Kreator konfiguracji moe ju utworzy poczenie.\0" + 234 "Modem albo urządzenie\0" + 235 "Proszę wprowadzić nazwę użytkownika dla konta tego interface na routerze zdalnym.\0" + 236 "Nazwa %1 już istnieje. Proszę wprowadzić inną nazwę.\0" + 237 "Możesz zezwolić na wysyłanie twojego hasła bez szyfrowania.\0" + 238 "Szyfrowanie Hasła\0" + 239 "Kreator konfiguracji może już utworzyć połączenie.\0" 240 "Gotowe\0" 241 "Numer &telefoniczny:\0" - 242 "Oddzwo na numer\0" - 243 "Edycja dodatkowych numerw \0" - 244 "Jako, e to poczenie jest obecnie aktywne, niektre ustawienia zostan uwzgldnione dopiero po rozczeniu.\0" - 245 "Nie ma adnych pocze dostpnych dla dowolnego uytkownika. Musisz zalogowa si przed poczeniem.\0" - 246 "Ksika telefoniczna jest pusta.\n\nNacinij OK by doda now pozycj.\0" - 247 "Ze wzgldu na ograniczenia w imporcie/eksporcie, szyfrowanie danych nie jest dostpne w tej wersji ReactOS.\0" - 248 "Prosz wprowadzi adres X.25 na nastpnym ekranie.\0" - 249 "Bd %1: %2\0" - 250 "%1\n\nBd %2: %3\0" - 251 "%1\n\nBd %2: %3\nDiagnostyka: %4\0" - 252 "%1\n\nBd %2: %3\nKod bdu: %4\0" - 253 "%1\n\nBd %2: %3\n\nNacinij F1 aby zobaczy wicej informacji.\0" - 254 "%1\n\nBd %2: %3\nNazwa: %4\0" + 242 "Oddzwoń na numer\0" + 243 "Edycja dodatkowych numerów \0" + 244 "Jako, że to połączenie jest obecnie aktywne, niektóre ustawienia zostaną uwzględnione dopiero po rozłączeniu.\0" + 245 "Nie ma żadnych połączeń dostępnych dla dowolnego użytkownika. Musisz zalogować się przed połączeniem.\0" + 246 "Książka telefoniczna jest pusta.\n\nNaciśnij OK by dodać nową pozycję.\0" + 247 "Ze względu na ograniczenia w imporcie/eksporcie, szyfrowanie danych nie jest dostępne w tej wersji ReactOS.\0" + 248 "Proszę wprowadzić adres X.25 na następnym ekranie.\0" + 249 "Błąd %1: %2\0" + 250 "%1\n\nBłąd %2: %3\0" + 251 "%1\n\nBłąd %2: %3\nDiagnostyka: %4\0" + 252 "%1\n\nBłąd %2: %3\nKod błędu: %4\0" + 253 "%1\n\nBłąd %2: %3\n\nNaciśnij F1 aby zobaczyć więcej informacji.\0" + 254 "%1\n\nBłąd %2: %3\nNazwa: %4\0" 255 "%1\n\n%4\0" - 256 "%1\n\nBd %2: %3\nOdpowied: %4\0" - 257 "Kod bdu: 0x%1\n\0" + 256 "%1\n\nBłąd %2: %3\nOdpowiedź: %4\0" + 257 "Kod błędu: 0x%1\n\0" 258 "Nazwa: %1\n\0" - 259 "%1 CP zgosi bd %2: %3\n\0" - 260 "%1 CP poczy si.\n\0" - 261 "Moesz wybra protok dial-up ktrego chcesz uywa.\0" - 262 "Wybierz protok Dial-up\0" - 263 "Nacinij Zakocz by zapisa '%1'.\0" + 259 "%1 CP zgłosił błąd %2: %3\n\0" + 260 "%1 CP połączył się.\n\0" + 261 "Możesz wybrać protokół dial-up którego chcesz używać.\0" + 262 "Wybierz protokół Dial-up\0" + 263 "Naciśnij Zakończ by zapisać '%1'.\0" 264 "netcfg.hlp\0" - 265 "&Przenie dziaajcy numer na pocztek listy przy poczeniu\0" + 265 "&Przenieś działający numer na początek listy przy połączeniu\0" 266 "&Nowy numer telefoniczny:\0" 267 "N&umery telefoniczne:\0" 268 "Numery telefoniczne\0" - 269 "Moesz wprowadzi stay adres IP.\0" + 269 "Możesz wprowadzić stały adres IP.\0" 270 "Adres IP\0" - 271 "Protok TCP/IP, nie zosta zainstalowanay albo jest wyczony dla Dostpu Zdalnego. W Panelu Sterowania, wybierz Sieci, przejd na Usugi, wybierz Waciwoci usugi 'Dostp Zdalny', i nacinij przycisk Sie.\0" + 271 "Protokół TCP/IP, nie został zainstalowanay albo jest wyłączony dla Dostępu Zdalnego. W Panelu Sterowania, wybierz Sieci, przejdź na Usługi, wybierz Właściwości usługi 'Dostęp Zdalny', i naciśnij przycisk Sieć.\0" 272 "TCP/IP\0" - 273 "IPSec, ustawienia domylne\0" + 273 "IPSec, ustawienia domyślne\0" 274 "IPX/SPX lub kompatybilne\0" 275 " (obecna lokalizacja)\0" 276 "ISDN\0" - 277 "Wszystkie dostpne linie ISDN poczone\0" + 277 "Wszystkie dostępne linie ISDN połączone\0" 278 "64K Cyfrowy\0" 279 "56K Cyfrowy\0" 280 "56K Analogowy\0" - 281 "Moesz potrzebowa specjalnej procedury przed poczeniem.\0" + 281 "Możesz potrzebować specjalnej procedury przed połączeniem.\0" 282 "Wybierz Opcje Logowania\0" 283 "%d%%\0" 284 "Numer telefoniczny dla %s\0" 285 "&Nowa lokalizacja:\0" 286 "&Lokalizacje:\0" 287 "Lokalizacje\0" - 288 "To urzdzenie bdzie uyte do nawizania poczenia.\0" - 289 "Wybierz urzdzenie\0" + 288 "To urządzenie będzie użyte do nawiązania połączenia.\0" + 289 "Wybierz urządzenie\0" 290 "Multiple Lines cannot be bundled unless you are calling a PPP server.\0" 291 "Modem\0" 292 "Modem nie jest zainstalowany.\0" 293 "Szyfrowanie MS Point-to-Point, 128 bit RSA/RC4\0" 294 "Szyfrowanie MS Point-to-Point, 40 bit RSA/RC4\0" 295 "Multiple Lines\0" - 296 "(Nacinij Konfiguruj aby ustawi)\0" - 297 "Moesz wprowadzi stae adresy serwerw DNS i WINS.\0" + 296 "(Naciśnij Konfiguruj aby ustawić)\0" + 297 "Możesz wprowadzić stałe adresy serwerów DNS i WINS.\0" 298 "Adres DNS\0" 299 "Down-level RAS\0" 300 "PPP\0" 301 "PPP multi-link\0" 302 "SLIP\0" 303 "NetBEUI\0" - 304 "Osobista Ksika Telefoniczna zostaa stworzona i uzupeniona zawartoci Systemowej Ksiki Telefonicznej.\0" - 305 "Brak Dodatkowej Ksiki Telefonicznej.\0" - 306 "To urzdzenie nie moe by skonfigurowane dynamicznie.\0" - 307 "Ten wpis nie moe zosta skasowany podczas trwania poczenia.\0" - 308 "Nie wybrano adnego wpisu. Nacinij przycisk Nowy aby utworzy wpis.\0" - 309 "Niezerowy adres IP musi zosta podany, gdy zaznaczona jest opcja 'wyznacz adres IP'.\0" - 310 "Aby uywa interface sieciowego X.25 dial-up albo urzdzenia X.25, wymagany jest Adres X.25.\0" + 304 "Osobista Książka Telefoniczna została stworzona i uzupełniona zawartością Systemowej Książki Telefonicznej.\0" + 305 "Brak Dodatkowej Książki Telefonicznej.\0" + 306 "To urządzenie nie może być skonfigurowane dynamicznie.\0" + 307 "Ten wpis nie może zostać skasowany podczas trwania połączenia.\0" + 308 "Nie wybrano żadnego wpisu. Naciśnij przycisk Nowy aby utworzyć wpis.\0" + 309 "Niezerowy adres IP musi zostać podany, gdy zaznaczona jest opcja 'wyznacz adres IP'.\0" + 310 "Aby używać interface sieciowego X.25 dial-up albo urządzenia X.25, wymagany jest Adres X.25.\0" 311 "(brak)\0" - 312 "'%1' jest ju na licie.\0" - 313 "Zaszyfruj moje haso i dane\0" - 314 "Protok %1 nie moe zosta wybrany, gdy nie jest zainstalowany albo jest wyczony dla Dostpu Zdalnego. Aby to zmieni, wPanelu Sterowania, wybierz Sieci, przejd na Usugi, wybierz Waciwoci usugi 'Dostp Zdalny', i nacinij przycisk Sie.\0" - 315 "Nie mona zapisa hasa.\0" - 316 "Nie mona wywietli danych.\0" - 317 "Nie mona pobra informacji o autowybieraniu.\0" - 318 "Nie mona zaadowa dialogu.\0" - 319 "Nie mona wyczy dostpu wspdzielonego.\0" - 320 "Nie mona zaadowa waciwoci.\0" - 321 "Nie mona zaadowa Ksiki Telefonicznej.\0" - 322 "Nie mona zaadowa informacji o porcie z RAS Managera.\0" - 323 "Nie mona odczyta ustawie z rejestru.\0" - 324 "Nie mona zaadowa informacji o skrypcie.\0" - 325 "Nie mona obejrze script.log za pomoc notepad.exe\0" - 326 "Nie mona edytowa switch.inf za pomoc notepad.exe\0" - 327 "Nie mona zaadowa informacji TAPI.\0" - 328 "Nie mona zaadowa informacji o X.25.\0" - 329 "Nie mona utworzy nowej Ksiki Telefonicznej.\0" - 330 "Nie mona wczy dostpu wspdzielonego.\0" - 331 "Nie mona poczy si z numerem pod tym wpisie w Ksizce Telefonicznej.\0" - 332 "Nie mona otworzy bufora odbierania/wysyania.\0" - 333 "Nie mona uzyska informacji o stanie z portu.\0" - 334 "Nie mona uzyska informacji o protokole.\0" - 335 "Nie mona otworzy bufora w urzdzeniu.\0" - 336 "Nie mona wysa danych do bufora w urzdzeniu.\0" - 337 "Nie mona odebra danych.\0" - 338 "Nie mona zapisa informacji TAPI.\0" - 339 "Nie mona zapisa danych.\0" - 340 "Skrypt zosta zatrzymany.\0" - 341 "Skrypt zosta zatrzymany z powodu bdu. Czy chcesz przejrze logi z bdami?\0" - 342 "Nie mona ustawi danych do autowybierania.\0" - 343 "Nie mona skasowa zapisanego hasa.\0" - 344 "Nie mona zapisa Ksiki Telefonicznej.\0" - 345 "Zapisywanie ustawie do rejestru\0" - 346 "Nie mona zapisa skrtu.\0" + 312 "'%1' jest już na liście.\0" + 313 "Zaszyfruj moje hasło i dane\0" + 314 "Protokół %1 nie może zostać wybrany, gdyż nie jest zainstalowany albo jest wyłączony dla Dostępu Zdalnego. Aby to zmienić, wPanelu Sterowania, wybierz Sieci, przejdź na Usługi, wybierz Właściwości usługi 'Dostęp Zdalny', i naciśnij przycisk Sieć.\0" + 315 "Nie można zapisać hasła.\0" + 316 "Nie można wyświetlić danych.\0" + 317 "Nie można pobrać informacji o autowybieraniu.\0" + 318 "Nie można załadować dialogu.\0" + 319 "Nie można wyłączyć dostępu współdzielonego.\0" + 320 "Nie można załadować właściwości.\0" + 321 "Nie można załadować Książki Telefonicznej.\0" + 322 "Nie można załadować informacji o porcie z RAS Managera.\0" + 323 "Nie można odczytać ustawień z rejestru.\0" + 324 "Nie można załadować informacji o skrypcie.\0" + 325 "Nie można obejrzeć script.log za pomocą notepad.exe\0" + 326 "Nie można edytować switch.inf za pomocą notepad.exe\0" + 327 "Nie można załadować informacji TAPI.\0" + 328 "Nie można załadować informacji o X.25.\0" + 329 "Nie można utworzyć nowej Książki Telefonicznej.\0" + 330 "Nie można włączyć dostępu współdzielonego.\0" + 331 "Nie można połączyć się z numerem pod tym wpisie w Ksiązce Telefonicznej.\0" + 332 "Nie można otworzyć bufora odbierania/wysyłania.\0" + 333 "Nie można uzyskać informacji o stanie z portu.\0" + 334 "Nie można uzyskać informacji o protokole.\0" + 335 "Nie można otworzyć bufora w urządzeniu.\0" + 336 "Nie można wysłać danych do bufora w urządzeniu.\0" + 337 "Nie można odebrać danych.\0" + 338 "Nie można zapisać informacji TAPI.\0" + 339 "Nie można zapisać danych.\0" + 340 "Skrypt został zatrzymany.\0" + 341 "Skrypt został zatrzymany z powodu błędu. Czy chcesz przejrzeć logi z błędami?\0" + 342 "Nie można ustawić danych do autowybierania.\0" + 343 "Nie można skasować zapisanego hasła.\0" + 344 "Nie można zapisać Książki Telefonicznej.\0" + 345 "Zapisywanie ustawień do rejestru\0" + 346 "Nie można zapisać skrótu.\0" 347 "OK\0" 348 "Jaki jest numer telefoniczny twojego ISP?\0" 349 "Numer telefoniczny do wybierania\0" - 350 "Pola Haso i Potwierd haso nie zgadzaj si ze sob.\0" - 351 "Pola Nowe Haso i Potwierd Nowe haso nie zgadzaj si ze sob.\0" + 350 "Pola Hasło i Potwierdź hasło nie zgadzają się ze sobą.\0" + 351 "Pola Nowe Hasło i Potwierdź Nowe hasło nie zgadzają się ze sobą.\0" 352 "pbk\0" - 353 "Pliki Ksiki Telefonicznej (*.pbk)\0" + 353 "Pliki Książki Telefonicznej (*.pbk)\0" 354 "*.pbk\0" - 355 "Otwrz Ksik Telefoniczn\0" - 356 "Skopiuj Wpis w Ksice Telefonicznej\0" - 357 "Edytuj Wpis w Ksice Telefonicznej\0" - 358 "Nowy Wpis w Ksice Telefonicznej\0" + 355 "Otwórz Książkę Telefoniczną\0" + 356 "Skopiuj Wpis w Książce Telefonicznej\0" + 357 "Edytuj Wpis w Książce Telefonicznej\0" + 358 "Nowy Wpis w Książce Telefonicznej\0" 359 "Numer Telefoniczny\0" 360 "Numery Telefoniczne\0" - 361 "Poczenia sieciowe\0" - 362 "Musisz wybra przynajmniej jeden protok sieciowy.\0" - 363 "Zanim poczysz si z ktrym z serwerw PPP musisz zainstalowa protok sieciowy za pomoc apletu Control Network.\0" + 361 "Połączenia sieciowe\0" + 362 "Musisz wybrać przynajmniej jeden protokół sieciowy.\0" + 363 "Zanim połączysz się z którymś z serwerów PPP musisz zainstalować protokół sieciowy za pomocą apletu Control Network.\0" 364 "&Nowy prefiks:\0" 365 "&Prefiksy:\0" 366 "Prefiksy Numeru Telefonicznego\0" - 367 "Jeden lub wicej wymaganych protokow nie ustanowio prawidowego poczenia.\n\n\0" - 368 "Nacinij Akceptuj aby uy poczenia w obecnym stanie, albo Zawie aby si rozczy.\0" - 369 "Protok Point-to-point (PPP) ustawiony do uycia gdy %1 zainicjuje poczenie dial-up na interface %2:\0" - 370 "[Aby zmieni zapisane haso, nacinij tutaj]\0" - 405 "Protok NetBEUI jest wymagany do poczenia ze starszymi serwerami RAS.\0" - 406 "Zanim bdziesz w stanie poczy si ze starszymi serwerami RAS, musisz zainstalowa protok NetBEUI. NetBEUI z apletu Sieci w Panelu Sterowania.\0" + 367 "Jeden lub więcej wymaganych protokołów nie ustanowiło prawidłowego połączenia.\n\n\0" + 368 "Naciśnij Akceptuj aby użyć połączenia w obecnym stanie, albo Zawieś aby się rozłączyć.\0" + 369 "Protokół Point-to-point (PPP) ustawiony do użycia gdy %1 zainicjuje połączenie dial-up na interface %2:\0" + 370 "[Aby zmienić zapisane hasło, naciśnij tutaj]\0" + 405 "Protokół NetBEUI jest wymagany do połączenia ze starszymi serwerami RAS.\0" + 406 "Zanim będziesz w stanie połączyć się ze starszymi serwerami RAS, musisz zainstalować protokół NetBEUI. NetBEUI z apletu Sieci w Panelu Sterowania.\0" 407 "&Ponowne Wybieranie\0" - 408 "Zdecydowae si na wyczenie jednego lub wicej transportw. Wymaga to usunicia menederw i protokow routowania wyczonych transportw z tego interface demand-dial.\nNacinij Tak jeli chcesz konty \n \n\n\n\n\n\nnuowa, lub Nie, jeli chcesz ponownie wczy te transporty.\0" - 409 "Wspdzielenie cza Internetowego\0" + 408 "Zdecydowałeś się na wyłączenie jednego lub więcej transportów. Wymaga to usunięcia menedżerów i protokołów routowania wyłączonych transportów z tego interface demand-dial.\nNaciśnij Tak jeśli chcesz konty \n \n\n\n\n\n\nnuować, lub Nie, jeśli chcesz ponownie włączyć te transporty.\0" + 409 "Współdzielenie Łącza Internetowego\0" 410 "Konto dial-in interface Demand-dial.\0" - 411 "Musisz teraz ustawi informacje dial-out ktre interface '%1' wykorzysta w poczeniu z routerem zdalnym. Te dane musz zgadza si z informacjami ktre zostay wprowadzone do routera zdalnego. Podczas poczenia z \n \n\n\n\n\n\n routerem Win NT4/2000 nazwa uytkownika musi rownie zgadza si z nazw interface routera zdalnego.\0" + 411 "Musisz teraz ustawić informacje dial-out które interface '%1' wykorzysta w połączeniu z routerem zdalnym. Te dane muszą zgadzać się z informacjami które zostały wprowadzone do routera zdalnego. Podczas połączenia z \n \n\n\n\n\n\n routerem Win NT4/2000 nazwa użytkownika musi rownież zgadzać się z nazwą interface routera zdalnego.\0" 412 "mpradmin.hlp\0" - 413 "&Podczas prby poczeia, przenie dziaajcy numer lub adres na pocztek listy\0" + 413 "&Podczas próby połączeia, przenieś działający numer lub adres na początek listy\0" 414 "&Nowe numery telefoniczne albo adresy:\0" 415 "&Numery telefoniczne lub adresy:\0" 416 "Numery i Adresy\0" 417 "PPP: Win 95/98/NT4/2000, Internet\0" 418 "Brak\0" - 419 "SLIP: Poczenie z Unix \0" - 420 "Wszystkie urzdzenia podczone.\0" - 421 "Odbir rezultatu rejestracji...\0" - 422 "Przesyanie informacji o oddzwanianiu...\0" - 423 "Wysyanie nowego hasa...\0" - 424 "Szacowanie przepustowoci cza...\0" + 419 "SLIP: Połączenie z Unix \0" + 420 "Wszystkie urządzenia podłączone.\0" + 421 "Odbiór rezultatu rejestracji...\0" + 422 "Przesyłanie informacji o oddzwanianiu...\0" + 423 "Wysyłanie nowego hasła...\0" + 424 "Szacowanie przepustowości łącza...\0" 425 "Sprawdzanie stanu uwierzytelniania...\0" 426 "Rejestrowanie twojego komputera w sieci..\0" 427 "Powtarzanie uwierzytelniania...\0" - 428 "Weryfikacja nazwy uytkownika i hasa...\0" + 428 "Weryfikacja nazwy użytkownika i hasła...\0" 429 "Uwierzytelniono.\0" - 430 "czenie za pomoc %1...\0" + 430 "Łączenie za pomocą %1...\0" 431 "Wybieranie...\0" - 432 "Poczenie modemw...\0" - 433 "Poczenie poprzez kabel...\0" + 432 "Połączenie modemów...\0" + 433 "Połączenie poprzez kabel...\0" 434 "Wybieranie %1...\0" - 435 "Poczenie przez X.25 do %1...\0" + 435 "Połączenie przez X.25 do %1...\0" 436 "Postconnecting through %1...\0" 437 "Preconnecting through %1...\0" - 438 "Poczono.\0" - 439 "Urzdzenie podczone.\0" - 440 "Rozczono.\0" - 441 "Modem poczony.\0" - 442 "Kabel poczony.\0" + 438 "Połączono.\0" + 439 "Urządzenie podłączone.\0" + 440 "Rozłączono.\0" + 441 "Modem połączony.\0" + 442 "Kabel połączony.\0" 443 "Otwieranie portu...\0" - 444 "X.25 poczony.\0" + 444 "X.25 połączony.\0" 445 "Port otwarty.\0" 446 "Postconnect complete.\0" 447 "Preconnect complete.\0" 448 "Przygotowywanie oddzwaniania...\0" - 449 "Sprawdzanie poczenia protokow sieciowych...\0" - 450 "Weryfikacja nazwy uytkownika i hasa...\0" - 451 "Poczono, dodawanie kolejnych linii\0" + 449 "Sprawdzanie połączenia protokołów sieciowych...\0" + 450 "Weryfikacja nazwy użytkownika i hasła...\0" + 451 "Połączono, dodawanie kolejnych linii\0" 452 "Stan nieznany.\0" 453 "Oczekiwanie na oddzwonienie...\0" 454 "Oczekiwanie na reset modemu...\0" - 455 "Czy zmieni numer telefoniczny modemu na stae?\0" + 455 "Czy zmienić numer telefoniczny modemu na stałe?\0" 456 "scp\0" 457 "*.scp\0" - 458 "Pliku skryptw Dial-up (*.scp)\0" - 459 "Przegldaj skrypty Dial-Up\0" - 460 "Musisz zaznaczy przynajmniej jeden modem lub adapter.\0" + 458 "Pliku skryptów Dial-up (*.scp)\0" + 459 "Przeglądaj skrypty Dial-Up\0" + 460 "Musisz zaznaczyć przynajmniej jeden modem lub adapter.\0" 461 "Numer telefoniczny\0" - 462 "Protok TCP/IP jest niezbdny do poczenia z serwerami SLIP.\0" - 463 "Przed poczeniem z serwerami SLIP musisz zainstalowa protok TCP/IP, za pomoc apletu Sieci w Panelu Sterowania.\0" + 462 "Protokół TCP/IP jest niezbędny do połączenia z serwerami SLIP.\0" + 463 "Przed połączeniem z serwerami SLIP musisz zainstalować protokół TCP/IP, za pomocą apletu Sieci w Panelu Sterowania.\0" 464 "Stan\0" 465 "&Nowy sufiks:\0" 466 "&Sufiksy:\0" 467 "Sufiks numeru telefonicznego\0" - 468 "Moesz dostosowa ustawienia specjalne, w razie potrzeby.\0" + 468 "Możesz dostosować ustawienia specjalne, w razie potrzeby.\0" 469 "Ustawienia specjalne\0" - 470 "Terminal wasnych komend Modemu\0" + 470 "Terminal własnych komend Modemu\0" 471 "Terminal po wybraniu\0" 472 "Terminal przed wybraniem\0" 473 "Terminal logowania do SLIP\0" @@ -2102,279 +2103,279 @@ BEGIN 487 "5 sekund\0" 488 "8 godzin\0" 489 "nigdy\0" - 490 "Moesz ustawi to poczenia dla wszystkich uytkownikw albo tylko dla siebie.\0" - 491 "Dostpno poczenia\0" + 490 "Możesz ustawić to połączenia dla wszystkich użytkowników albo tylko dla siebie.\0" + 491 "Dostępność połączenia\0" 492 "Discard multiple line settings for the entry?\0" - 493 "Urzdzenie niedostpne\0" + 493 "Urządzenie niedostępne\0" 494 "Preferencje logowania\0" 495 "Preferencje Dial-up\0" 496 "X.25\0" 497 "X.25 PAD\0" - 498 "Moesz zezwoli innym komputerom na dostp do zasobw poprzez to poczenie dial-up.\0" - 499 "Wybr serwera VPN\0" + 498 "Możesz zezwolić innym komputerom na dostęp do zasobów poprzez to połączenie dial-up.\0" + 499 "Wybór serwera VPN\0" 500 "Cannot enable on-demand dialing.\0" 501 "Jaka jest nazwa albo adres serwera VPN?\0" 502 "Cannot disable on-demand dialing.\0" - 503 "Sie publiczna\0" - 504 "ReactOS moe upewni si, e najpierw poczono si z sieci publiczn.\0" + 503 "Sieć publiczna\0" + 504 "ReactOS może upewnić się, że najpierw połączono się z siecią publiczną.\0" 505 "VPN1\0" 506 "Wsp\0" 507 "You can let a local network access resources through this dial-up connection.\0" 508 "Host or Guest?\0" - 509 "Wspdzielenie cza Internetowego byo do tej pory ustawione na poczenie '%1'.\n\nBdzie teraz ustawione na poczenie '%2'.\0" - 510 "Aby poczy dwa komputery, twj komputer musi by ustawiony jako host albo jako go.\0" - 511 "Z wczonym Wspdzieleniem cza Internetowego, twj adapter LAN adapter zostanie ustawiony na adres IP 192.168.0.1. Twj komputer moe straci poczenie z innymi komputerami w sieci lokalnej. Jeli te komputery maj adresy IP ustawione statycznie, powiniene je ustawi na otrzymywanie adresw IP automatycznie. Czy na pewno chcesz wczy Wspdzielenie cza Internetowego?\0" - 512 "Wybierz urzdzenie\0" - 513 "To urzdzenie zostanie uyte do ustanownienia poczenia.\0" - 514 "&Pocz\0" - 515 "Pozwl by serwer wybra metod szyfrowania\0" + 509 "Współdzielenie Łącza Internetowego było do tej pory ustawione na połączenie '%1'.\n\nBędzie teraz ustawione na połączenie '%2'.\0" + 510 "Aby połączyć dwa komputery, twój komputer musi być ustawiony jako host albo jako gość.\0" + 511 "Z włączonym Współdzieleniem Łącza Internetowego, twój adapter LAN adapter zostanie ustawiony na adres IP 192.168.0.1. Twój komputer może stracić połączenie z innymi komputerami w sieci lokalnej. Jeśli te komputery mają adresy IP ustawione statycznie, powinieneś je ustawić na otrzymywanie adresów IP automatycznie. Czy na pewno chcesz włączyć Współdzielenie Łącza Internetowego?\0" + 512 "Wybierz urządzenie\0" + 513 "To urządzenie zostanie użyte do ustanownienia połączenia.\0" + 514 "&Połącz\0" + 515 "Pozwól by serwer wybrał metodę szyfrowania\0" 516 "Zawsze szyfruj moje dane\0" - 517 "Uyj szyfrowania danych MPPE-40\0" - 518 "Uyj szyfrowania danychMPPE-128\0" - 519 "Bierzce ustawienie szyfrowania wymaga uwierzytelnienia MS-CHAP lub EAP.\0" + 517 "Użyj szyfrowania danych MPPE-40\0" + 518 "Użyj szyfrowania danychMPPE-128\0" + 519 "Bierzące ustawienie szyfrowania wymaga uwierzytelnienia MS-CHAP lub EAP.\0" 520 "Custom Authentication Message\0" - 521 "czenie z %1...\0" - 522 "Nazwa poczenia\0" + 521 "Łączenie z %1...\0" + 522 "Nazwa połączenia\0" 523 "Automagicznie\0" 524 "PPTP VPN\0" 525 "L2TP IPSec VPN\0" - 526 "Wybierz rodzaj poczenia.\0" - 527 "Rodzaj poczenia\0" + 526 "Wybierz rodzaj połączenia.\0" + 527 "Rodzaj połączenia\0" 528 "hh.exe netcfg.chm::/trouble_all.htm\0" - 529 "Wirtualne poczenie prywatne\0" - 530 "Uyj dowolnej metody uwierzytelniania wczajc otwarty tekst. Nie szyfruj danych.\0" - 531 "Uyj dowolnej metody uwierzytelniania, ktra wymaga szyfrowania hasa. Nie szyfruj danych.\0" - 532 "Prosz poda nazw tego wpisu.\0" - 533 "Szyfruj haso i dane.\0" - 534 "Prosz poda numer portu, pomidzy 1 a 65535.\0" - 535 "Ustaw wasne uwierzytelnianie i szyfrowanie danych przyciskiem Ustawienia.\0" - 536 "Uyj dowolnej metody uwierzytelniania, ktra wymaga szyfrowania hasa. Nie szyfruj danych.\0" - 537 "Szyfruj haso i dane.\0" - 538 "Ustaw wasne uwierzytelnianie i szyfrowanie danych przyciskiem Ustawienia.\0" - 539 "Ten numer portu jest ju zajty przez inny wpis.\nProsz uy unikalnego numeru portu.\0" - 540 "Prosz wprowadzi jeden lub wicej numerw portu na odpowiedzi przychodzce.\0" - 541 "Prosz wybra wpis do skasowania.\0" + 529 "Wirtualne połączenie prywatne\0" + 530 "Użyj dowolnej metody uwierzytelniania włączając otwarty tekst. Nie szyfruj danych.\0" + 531 "Użyj dowolnej metody uwierzytelniania, która wymaga szyfrowania hasła. Nie szyfruj danych.\0" + 532 "Proszę podać nazwę tego wpisu.\0" + 533 "Szyfruj hasło i dane.\0" + 534 "Proszę podać numer portu, pomiędzy 1 a 65535.\0" + 535 "Ustaw własne uwierzytelnianie i szyfrowanie danych przyciskiem Ustawienia.\0" + 536 "Użyj dowolnej metody uwierzytelniania, która wymaga szyfrowania hasła. Nie szyfruj danych.\0" + 537 "Szyfruj hasło i dane.\0" + 538 "Ustaw własne uwierzytelnianie i szyfrowanie danych przyciskiem Ustawienia.\0" + 539 "Ten numer portu jest już zajęty przez inny wpis.\nProszę użyć unikalnego numeru portu.\0" + 540 "Proszę wprowadzić jeden lub więcej numerów portu na odpowiedzi przychodzące.\0" + 541 "Proszę wybrać wpis do skasowania.\0" 542 "1 sekunda\0" - 543 "Prosz wybra wpis do edycji.\0" - 549 "Jak si znazywa komputer z ktrym si czysz?\0" + 543 "Proszę wybrać wpis do edycji.\0" + 549 "Jak się znazywa komputer z którym się łączysz?\0" 576 "20 minut\0" - 579 "Wprowad nazw dla poczenia z twoim miejscem pracy.\0" + 579 "Wprowadź nazwę dla połączenia z twoim miejscem pracy.\0" 581 "Ustawienia aplikacji sieciowych\0" - 582 "Wpisz nazw dla tego poczenia w polu poniej.\0" - 583 "Wpisz nazw drugiego komputera w polu poniej.\0" - 584 "Wpisz nazw swojego ISP w polu poniej.\0" - 585 "Jak si nazywa usuga za porednictwem ktrej czysz si z Internetem?\0" - 586 "Prosz wprowadzi adres IP serwera w sieci prywatnej.\0" + 582 "Wpisz nazwę dla tego połączenia w polu poniżej.\0" + 583 "Wpisz nazwę drugiego komputera w polu poniżej.\0" + 584 "Wpisz nazwę swojego ISP w polu poniżej.\0" + 585 "Jak się nazywa usługa za pośrednictwem której łączysz się z Internetem?\0" + 586 "Proszę wprowadzić adres IP serwera w sieci prywatnej.\0" 587 "Ustawienia Zaawansowane\0" - 588 "Nazwa wpisu zaczyna si od kropki albo zawiera niedozwolone znaku. \nWybierz inn nazw.\0" - 589 "Waciwoci\0" + 588 "Nazwa wpisu zaczyna się od kropki albo zawiera niedozwolone znaku. \nWybierz inną nazwę.\0" + 589 "Właściwości\0" 1512 "Port komunikacyjny\0" - 1523 " kana\0" + 1523 " kanał\0" 1526 "Smart Cards\0" - 1527 "Moesz uy swoich smart card z tym poczeniem.\0" - 1528 "Poczenie bezporednie\0" - 1529 "Prosz wybra urzdzenie dla tego poczenia.\0" + 1527 "Możesz użyć swoich smart card z tym połączeniem.\0" + 1528 "Połączenie bezpośrednie\0" + 1529 "Proszę wybrać urządzenie dla tego połączenia.\0" 1530 "Verdana Bold\0" 1531 "12\0" - 1532 "Typ poczenia\0" - 1533 "Wybierz typ interface demand dial, ktry chcesz utworzy.\0" - 1534 "Wybierz urzdzenie\0" - 1535 "To urzdznie bdzie uyte w tym poczeniu.\0" + 1532 "Typ połączenia\0" + 1533 "Wybierz typ interface demand dial, który chcesz utworzyć.\0" + 1534 "Wybierz urządzenie\0" + 1535 "To urządznie będzie użyte w tym połączeniu.\0" 1536 "Numer telefoniczny\0" - 1537 "Wprowad numer telefoniczny serwera zdalnego albo routera z ktrym si czysz.\0" + 1537 "Wprowadź numer telefoniczny serwera zdalnego albo routera z którym się łączysz.\0" 1538 "Rodzaj VPN\0" - 1539 "Wybierz rodzaj inferface VPN, ktry chcesz stworzy.\0" + 1539 "Wybierz rodzaj inferface VPN, który chcesz stworzyć.\0" 1540 "Adres docelowy\0" - 1541 "Jaka jest nazwa bd adres routera zdalnego?\0" + 1541 "Jaka jest nazwa bądź adres routera zdalnego?\0" 1544 "Adres IP\0" 1545 "Ustaw adres IP routera dla tego interface.\0" 1546 "Adres serwera nazw\0" 1547 "Ustaw adres serwera DNS lub WINS dla tego interface.\0" 1548 "Skrypty Routera\0" - 1549 "Moesz ustawi skrypty poczenia z routerem zdalnym.\0" + 1549 "Możesz ustawić skrypty połączenia z routerem zdalnym.\0" 1550 "Dial In Credentials\0" - 1551 "Ustaw nazw uytkownika i haso ktre router zdalny wykorzysta podcza poczenia z tym serwerem.\0" + 1551 "Ustaw nazwę użytkownika i hasło które router zdalny wykorzysta podcza połączenia z tym serwerem.\0" 1552 "Dial Out Credentials\0" - 1553 "Ustaw nazw uytkownika i haso ktre bd wykorzystane podczas poczenia z routerem zdalnym.\0" + 1553 "Ustaw nazwę użytkownika i hasło które będą wykorzystane podczas połączenia z routerem zdalnym.\0" 1554 "Nazwa Interface\0" - 1555 "Wybierz nazw pod ktr bdzie opisany ten interface.\0" - 1556 "Brak dostpnych urzdze\0" - 1557 "Konto uytkownika %1 ju istnieje na tym komputerze. Czy interface Demand Dial powinien zosta skonfigurowany tak by je uywac?\0" - 1558 "Nie ma ustawie protokow bezpieczestwa dla pocze z serwerem SLIP.\0" - 1559 "Zezwl na niezabezpieczone haso\0" - 1560 "Wymagaj zabezpieczonego hasa\0" - 1561 "Uyj smart card\0" - 1562 "Musisz wybra co najmniej jeden protok uwierzytelniania hasa.\0" - 1563 "Nie uywaj szyfrowania (serwer zostanie rozczony, jeli bdzie wymaga szyforwania)\0" - 1564 "Szyfrowanie opcjonalne (pocz take gdy nie ma szyfrowania)\0" - 1565 "Wymagaj szyfrowania (rozcz si jeli serwer nie zapewnia)\0" - 1566 "Wymagaj silnego szyfrowania (rozcz si jeli serwer nie zapewnia)\0" - 1567 " (szyfrowanie wczone)\0" + 1555 "Wybierz nazwę pod którą będzie opisany ten interface.\0" + 1556 "Brak dostępnych urządzeń\0" + 1557 "Konto użytkownika %1 już istnieje na tym komputerze. Czy interface Demand Dial powinien zostać skonfigurowany tak by je używac?\0" + 1558 "Nie ma ustawień protokołów bezpieczeństwa dla połączeń z serwerem SLIP.\0" + 1559 "Zezwól na niezabezpieczone hasło\0" + 1560 "Wymagaj zabezpieczonego hasła\0" + 1561 "Użyj smart card\0" + 1562 "Musisz wybrać co najmniej jeden protokół uwierzytelniania hasła.\0" + 1563 "Nie używaj szyfrowania (serwer zostanie rozłączony, jeśli będzie wymagał szyforwania)\0" + 1564 "Szyfrowanie opcjonalne (połącz także gdy nie ma szyfrowania)\0" + 1565 "Wymagaj szyfrowania (rozłącz się jeśli serwer nie zapewnia)\0" + 1566 "Wymagaj silnego szyfrowania (rozłącz się jeśli serwer nie zapewnia)\0" + 1567 " (szyfrowanie włączone)\0" 1568 "Informacje Konta Internetowego\0" - 1569 "Potrzebujesz nazwy uytkownika i hasa by skorzysta ze swojego Konta Internetowego.\0" - 1570 "Wybrany pakiet EAP nie zawiera kluczy szyfrowania. Wybierz pakiet EAP ktry zawiera klucze szyfrowania albo wycz szyfrowanie.\0" + 1569 "Potrzebujesz nazwy użytkownika i hasła by skorzystać ze swojego Konta Internetowego.\0" + 1570 "Wybrany pakiet EAP nie zawiera kluczy szyfrowania. Wybierz pakiet EAP który zawiera klucze szyfrowania albo wyłącz szyfrowanie.\0" 1571 "Wybrana metoda szyfrowania wymaga szyfrowania logowania EAP albo MS-CHAP.\0" - 1572 "Protokoy i Bezpieczestwo\0" - 1573 "Wybierz transporty i opcje bezpieczestwa dla tego poczenia.\0" - 1574 "Wybrane przez ciebie protokoy zawieraj PAP, SPAP, i/lub CHAP. Jeli ktrykolwiek z nich zostanie uyty, poczenie nie bdzie szyfrowane. Czy chcesz zachowa te ustawienia?\0" - 1575 "Aby poczy si z '%1', najpierw musisz by poczony z '%2'. Czy chcesz si poczy z '%2' w tej chwili?\0" - 1576 "czenie poprzez kabel rwnolegy...\0" - 1577 "czenie poprzez podczerwie...\0" - 1578 "Kabel rwnolegy podczony.\0" - 1579 "Podczerwie podczona.\0" - 1580 "To poczeni zostao skonfigurowane do uycia szyfrowania danych o sile, ktra nie jest obsugiwana przez zainstalowane oprogramowanie. Waciwoci bezpieczestwa zostay zmodyfikowanie do obsugiwanych wartoci siy szyfrowania.\0" + 1572 "Protokoły i Bezpieczeństwo\0" + 1573 "Wybierz transporty i opcje bezpieczeństwa dla tego połączenia.\0" + 1574 "Wybrane przez ciebie protokoły zawierają PAP, SPAP, i/lub CHAP. Jeśli którykolwiek z nich zostanie użyty, połączenie nie będzie szyfrowane. Czy chcesz zachować te ustawienia?\0" + 1575 "Aby połączyć się z '%1', najpierw musisz być połączony z '%2'. Czy chcesz się połączyć z '%2' w tej chwili?\0" + 1576 "Łączenie poprzez kabel równoległy...\0" + 1577 "Łączenie poprzez podczerwień...\0" + 1578 "Kabel równoległy podłączony.\0" + 1579 "Podczerwień podłączona.\0" + 1580 "To połączeni zostało skonfigurowane do użycia szyfrowania danych o sile, która nie jest obsługiwana przez zainstalowane oprogramowanie. Właściwości bezpieczeństwa zostały zmodyfikowanie do obsługiwanych wartości siły szyfrowania.\0" 1581 "R&odzaje VPN:\0" - 1582 "Prosz wprowadzzi nazw uytkownika.\0" - 1583 "Ta nazwa uykownika i haso zostan zapisane dla twojego uytku. Istnieje ju zapisana nazwa uytkownika i haso dla kadego uytkownika do uycia w tym poczeniu. Czy chcesz skasowa nazw uytkownika i haso, przeznaczon dla wszystkich uytkownikw?\0" - 1584 "Na przykad, mgby poda nazw twojego miejsca pracy albo nazw serwera z ktrym si czysz.\0" + 1582 "Proszę wprowadzzić nazwę użytkownika.\0" + 1583 "Ta nazwa użykownika i hasło zostaną zapisane dla twojego użytku. Istnieje już zapisana nazwa użytkownika i hasło dla każdego użytkownika do użycia w tym połączeniu. Czy chcesz skasować nazwę użytkownika i hasło, przeznaczoną dla wszystkich użytkowników?\0" + 1584 "Na przykład, mógłbyć podać nazwę twojego miejsca pracy albo nazwę serwera z którym się łączysz.\0" 1585 "Informacje o koncie\0" - 1586 "Ustawienia w tym oknie waciwoci s niedostpne, jako, e wpierw trzeba zrestartowa system zanim bdzie mona wprowadzi jakiekolwiek zmiany w konfiguracji.\0" - 1587 "Ustawienia w tym oknie waciwoci s niedostpne, jako, e jedno lub wicej innych okien waciwoci Sieci jest ju otwarte. Aby zmieni ustawienia, zamknij wszystkie otwarte okna waciwoci i ponownie otwrz te.\0" - 1588 "Niektre z ustawie w tym oknie waciwoci s niedostpne, gdy nie masz wystarczajcych uprawnie na dostp do nich.\0" - 1589 "Otrzymano nastpujc wiadomo od twojego ISP:\r\n\r\n%1\0" - 1590 "Pocz ponownie z %1\0" - 1591 "Nazwa usugi\0" - 1592 "Jak sie nazywa usuga, dostarczajca twoje cze internetowe?\0" - 1593 "Do zalogowania na twoje konto bdziesz potrzebowa nazwy konta i hasa\0" + 1586 "Ustawienia w tym oknie właściwości są niedostępne, jako, że wpierw trzeba zrestartować system zanim będzie można wprowadzić jakiekolwiek zmiany w konfiguracji.\0" + 1587 "Ustawienia w tym oknie właściwości są niedostępne, jako, że jedno lub więcej innych okien właściwości Sieci jest już otwarte. Aby zmienić ustawienia, zamknij wszystkie otwarte okna właściwości i ponownie otwórz te.\0" + 1588 "Niektóre z ustawień w tym oknie właściwości są niedostępne, gdyż nie masz wystarczających uprawnień na dostęp do nich.\0" + 1589 "Otrzymano następującą wiadomość od twojego ISP:\r\n\r\n%1\0" + 1590 "Połącz ponownie z %1\0" + 1591 "Nazwa usługi\0" + 1592 "Jak sie nazywa usługa, dostarczająca twoje łącze internetowe?\0" + 1593 "Do zalogowania na twoje konto będziesz potrzebować nazwy konta i hasła\0" 1594 "PPPOE1-0\0" 1595 "Point-to-Point Protocol over Ethernet (PPPoE)\0" - 1596 "Rodzaj cza &szerokopasmowego, ktre uywasz:\0" - 1611 "cze szerokopasmowe\0" - 1612 "Wybrae uycie klucza preshared ale nie wprowadzie adnego. \nProsz wprowadzi klucz preshared.\0" - 1613 "Nie mona wysa danych do uwierzytelnienia\0" - 1634 "Z powodu wyczenia usugi Instrumentacji Zarzdzania Windows (WMI), nie moe wywietli waciwoci tego poczenia albo sieci lokalnej.\n\nAby uzyska dostp do waciwoci, musisz wpierw uruchomi usug WMI.\0" - 1635 "ReactOS nie moe wywietli waciwoci tego poczenia. Informacja w Instrumentacji Zarzdzania Windows (WMI) moe by uszkodzona. Aby to poprawi, uyj Odtwarzania Systemu, by odtworzy ReactOS z wczeniejszego momentu (punktu odtwarzania).\0" - 1646 "Zezwl na przychodzce zapytania ECHO\0" - 1647 "Zezwl na przychodzce zapytania timestamp\0" - 1648 "Zezwl na przychodzce zapytania mask\0" - 1649 "Zezwl na przychodzce zapytania o router\0" - 1650 "Zezwl na wychodzce destination unreachable\0" - 1651 "Zezwl na wychodzce source quench\0" - 1652 "Zezwl na wychodzce parameter problem\0" - 1653 "Zezwl na wychodzce time exceeded\0" - 1654 "Zezwl na przekierowanie\0" + 1596 "Rodzaj łącza &szerokopasmowego, które używasz:\0" + 1611 "Łącze szerokopasmowe\0" + 1612 "Wybrałeś użycie klucza preshared ale nie wprowadziłeś żadnego. \nProszę wprowadzić klucz preshared.\0" + 1613 "Nie można wysłać danych do uwierzytelnienia\0" + 1634 "Z powodu wyłączenia usługi Instrumentacji Zarządzania Windows (WMI), nie może wyświetlić właściwości tego połączenia albo sieci lokalnej.\n\nAby uzyskać dostęp do właściwości, musisz wpierw uruchomić usługę WMI.\0" + 1635 "ReactOS nie może wyświetlić właściwości tego połączenia. Informacja w Instrumentacji Zarządzania Windows (WMI) może być uszkodzona. Aby to poprawić, użyj Odtwarzania Systemu, by odtworzyć ReactOS z wcześniejszego momentu (punktu odtwarzania).\0" + 1646 "Zezwól na przychodzące zapytania ECHO\0" + 1647 "Zezwól na przychodzące zapytania timestamp\0" + 1648 "Zezwól na przychodzące zapytania mask\0" + 1649 "Zezwól na przychodzące zapytania o router\0" + 1650 "Zezwól na wychodzące destination unreachable\0" + 1651 "Zezwól na wychodzące source quench\0" + 1652 "Zezwól na wychodzące parameter problem\0" + 1653 "Zezwól na wychodzące time exceeded\0" + 1654 "Zezwól na przekierowanie\0" 1655 "log\0" 1656 "*.log\0" - 1657 "Pliki logw Firewalla (*.log)\0" - 1658 "Przegldaj\0" - 1663 "Wybierz poczenie z sieci lokaln\0" - 1664 "Aby wczy Wspdzielenie cza Internetowego, musisz wybra poczenie dla sieci lokalnej. Prosz je wybra z listy dostpnych pocze.\0" - 1665 "Wiadomoci wysane do tego komputera bd jednoczenie odsyane do nadawcw. Jest to zwykle uywane do rozwizywania problemw z poczeniem.\0" - 1666 "Dane wysane do tego komputera mog by potwierdzane w specjalnej wiadomoci, zawierajcej czas dostarczenia tych danych.\0" - 1667 "Ten komputer bdzie nasuchiwa i odpowiada na dania informacji o sieci publicznej, do ktrej jest podczony.\0" - 1668 "Ten komputer bdzie odpowiada na dania informacji dotyczcych znanych mu tras.\0" - 1669 "Dane, wysane przez Internet, ktre nie dotr do tego komputera z powodu bdw zostan odrzucone z odesaniem komunikatu ""destination unreachable"" o przyczynach bdw.\0" - 1670 "Kiedy zdolno tego komputera do przetwarzania napywajcych danych nie bdzie w stanie nady za prdkoci transmisji, dane zostan odrzucone a wysyajcy dostanie wiadomo z prob o zmniejszenie prdkoci.\0" - 1671 "Kiedy ten komputer odrzuca otrzymane dane z powodu bdnego nagwka, wyle on do nadawcy wiadomo o bdzie ""bad header"".\0" - 1672 "Kiedy ten komputer odrzuca niekompletne dane z poczenia, jako, e caa transmisja danych wymagaa wicej czasu ni byo przeznaczone, wyle on do nadawcy wiadomo o bdzie ""time expired"".\0" - 1673 "Dane wysane z tego komputera bd przekierowane, gdy zmieni si domylna trasa.\0" - 1675 "Warto podana jako rozmiar pliku logw. Podaj warto od 1 and 32767 k.\0" - 1685 "Twoje konto uytkownika nie ma dostatecznych uprawnie by uywa tego poczenia. Zwykle dzieje sie tak gdy jeste zalogowany jako Go.\0" - 1686 "Wprowad nazw uytkownika i haso. (Jeli zapomniae nazwy uytkownika lub hasa, skontaktuj si z twoim administratorem sieci.)\0" + 1657 "Pliki logów Firewalla (*.log)\0" + 1658 "Przeglądaj\0" + 1663 "Wybierz połączenie z siecią lokalną\0" + 1664 "Aby włączyć Współdzielenie Łącza Internetowego, musisz wybrać połączenie dla sieci lokalnej. Proszę je wybrać z listy dostępnych połączeń.\0" + 1665 "Wiadomości wysłane do tego komputera będą jednocześnie odsyłane do nadawców. Jest to zwykle używane do rozwiązywania problemów z połączeniem.\0" + 1666 "Dane wysłane do tego komputera mogą być potwierdzane w specjalnej wiadomości, zawierającej czas dostarczenia tych danych.\0" + 1667 "Ten komputer będzie nasłuchiwał i odpowiadał na żądania informacji o sieci publicznej, do której jest podłączony.\0" + 1668 "Ten komputer będzie odpowiadał na żądania informacji dotyczących znanych mu tras.\0" + 1669 "Dane, wysłane przez Internet, które nie dotrą do tego komputera z powodu błędów zostaną odrzucone z odesłaniem komunikatu ""destination unreachable"" o przyczynach błędów.\0" + 1670 "Kiedy zdolność tego komputera do przetwarzania napływających danych nie będzie w stanie nadążyć za prędkością transmisji, dane zostaną odrzucone a wysyłający dostanie wiadomość z prośbą o zmniejszenie prędkości.\0" + 1671 "Kiedy ten komputer odrzuca otrzymane dane z powodu błędnego nagłówka, wyśle on do nadawcy wiadomość o błędzie ""bad header"".\0" + 1672 "Kiedy ten komputer odrzuca niekompletne dane z połączenia, jako, że cała transmisja danych wymagała więcej czasu niż było przeznaczone, wyśle on do nadawcy wiadomość o błędzie ""time expired"".\0" + 1673 "Dane wysłane z tego komputera będą przekierowane, gdy zmieni się domyślna trasa.\0" + 1675 "Wartość podana jako rozmiar pliku logów. Podaj wartość od 1 and 32767 k.\0" + 1685 "Twoje konto użytkownika nie ma dostatecznych uprawnień by używać tego połączenia. Zwykle dzieje sie tak gdy jesteś zalogowany jako Gość.\0" + 1686 "Wprowadź nazwę użytkownika i hasło. (Jeśli zapomniałeś nazwy użytkownika lub hasła, skontaktuj się z twoim administratorem sieci.)\0" 1687 "&Nazwa komputera\0" 1688 "Nazwa &ISP\0" 1689 "Nazwa &firmy\0" - 1690 "Jaki jest numer telefoniczny, za pomoc ktrego si czysz?\n\0" - 7301 "Waciwoci przychodzcych pocze TCP/IP\0" - 7302 "Musisz wybra warto pomidzy %1 a %2 dla tego pola.\0" - 7306 "Bd Pocze Przychodzcych\0" - 7307 "Oglny bd Pocze Przychodzcych\0" - 7308 "Pocze Przychodzcych\0" - 7309 "Bd sieciowy Pocze Przychodzcych\0" - 7310 "Bd stanu Multilik Pocze Przychodzcych\0" - 7311 "Bd Pocze Przychodzcych\0" - 7312 "Bd inicjalizacji Pocze Przychodzcych\0" - 7313 "Bd waciwoci TCP/IP Pocze Przychodzcych\0" - 7314 "Bd waciwoci IPX Pocze Przychodzcych\0" - 7315 "Bd Pocze Przychodzcych\0" - 7316 "Domylne\0" - 7317 "Urzdzenie\0" + 1690 "Jaki jest numer telefoniczny, za pomocą którego się łączysz?\n\0" + 7301 "Właściwości przychodzących połączeń TCP/IP\0" + 7302 "Musisz wybrać wartość pomiędzy %1 a %2 dla tego pola.\0" + 7306 "Błąd Połączeń Przychodzących\0" + 7307 "Ogólny błąd Połączeń Przychodzących\0" + 7308 "Połączeń Przychodzących\0" + 7309 "Błąd sieciowy Połączeń Przychodzących\0" + 7310 "Błąd stanu Multilik Połączeń Przychodzących\0" + 7311 "Błąd Połączeń Przychodzących\0" + 7312 "Błąd inicjalizacji Połączeń Przychodzących\0" + 7313 "Błąd właściwości TCP/IP Połączeń Przychodzących\0" + 7314 "Błąd właściwości IPX Połączeń Przychodzących\0" + 7315 "Błąd Połączeń Przychodzących\0" + 7316 "Domyślne\0" + 7317 "Urządzenie\0" 7318 "Pomocnicza baza danych\0" - 7319 "Baza danych Uytkownikw\0" - 7320 "Baza danych Protokow\0" - 7321 "Musisz wprowadzi nazw logowania nowego uytkownika albo nacisn Anuluj.\0" - 7322 "Wprowadzone haso jest zbyt krtkie.\0" - 7323 "Oba wprowadzone hasa nie s identyczne. Prosz je poprawi.\0" - 7324 "Wystpi bd wewntrzny. \0" + 7319 "Baza danych Użytkowników\0" + 7320 "Baza danych Protokołów\0" + 7321 "Musisz wprowadzić nazwę logowania nowego użytkownika albo nacisnąć Anuluj.\0" + 7322 "Wprowadzone hasło jest zbyt krótkie.\0" + 7323 "Oba wprowadzone hasła nie są identyczne. Proszę je poprawić.\0" + 7324 "Wystąpił błąd wewnętrzny. \0" 7325 "Listview\0" - 7326 "Wystpi bd podczas przesyania wprowadzonych zmian do bazy danych uytkownika lokalnego. \0" - 7327 "Nie masz dostatecznych przywilejw by doda uytkownika do lokalnej systemowej bazy danych. \0" - 7328 "Uytkownik, ktrego chcesz stworzy, ju istnieje w lokalnej bazie danych uytkownikw.\0" - 7329 "Uytkownik nie zosta dodany do lokalnej bazy danych uytkownikw, dlatego, e jego haso zostao odrzucone.\0" - 7330 "Nie mona przeadowa systemowej bazy danych uytkownikw z powodu bdu wewntrznego.\0" - 7331 "Wystpi bd wewntrzny: Handle lokalnej bazy danych uytkownikw jest uszkodzony.\0" - 7332 "Nie udao si zaadowa zasobw, niezbdnych do wywietlenia zakadki Uytkownicy.\0" - 7333 "Wystpi bd wewnytrzny podczas odwracania zmian, uczynionych w lokalnej bazie danych uytkownikw. \0" - 7334 "Handle bazy danych urzdze jest uszkodzony.\0" - 7335 "Nie udao si zaadowa zasobw, niezbdnych do wywietlenia zakadki Oglne.\0" - 7336 "Nastpi bd podczas zapisywania zmian jakie dokonane zostay w Urzdzeniach/VPN. \0" - 7337 "Wystpi bd wewntrzny.\0" - 7338 "Wystpi bd wewntrzny: Handle bazy danych komponentw sieci jest uszkodzony.\0" - 7339 "Wystpi bd wewntrzny. \0" - 7340 "Wystpi bd pocdczas zapisywania zmian, uczynionych w komponentach sieci.\0" - 7341 "Wystpi bd wewntrzny.\0" - 7342 "Nie mona zapisa zmian dokonanych w protokole TCP/IP. \0" - 7343 "Nie mona zapisa zmian dokonanych w protokole IPX. \0" - 7344 "Nie mona wywietli waciwoci TCP/IP.\0" - 7345 "Nie mona wywietli waciwoci IPX.\0" - 7346 "Nie mona zaadowa waciwoci TCP/IP. \0" - 7347 "Nie mona zaadowa waciwoci IPX. \0" - 7348 "Poczenia przychodzce zale od usugi Routingu i Dostpu Zdalnego, ktrej to nie dao si uruchomi. Wicej informacji znajdziesz w logach Zdarze Systemowych.\0" - 7349 "Nie mona zezwoli na edycj komponentw sieci w danej chwili, gdy wanie s modyfikowane przez kogo innego.\0" - 7350 "Nowoutworzony uytkownik nie zosta dodany do lokalnej bazy danych uytkownikw dlatego, e jego nazwa albo haso nie byo zgodne z wymaganiami systemu (byo zbyt due, za mae, albo le sformuowane). \0" - 7351 "System nie moe usun wybranego uytkownika. \0" - 7352 "Nie mona usun wybranego komponentu sieci, poniewa jest on obecnie uywany.\0" - 7353 "Ostrzeenie o poczeniu przychodzcym\0" - 7354 "Kady skasowany uytkownik zostanie trwale usunity z systemu, nawet jeli naciniesz pniej Anuluj. Czy na pewno chcesz trwale usun %s? \0" - 7355 "Masz zamiar si przeczy na konsol zarzdzania systemem. Te okno waciwoci Pocze przychodzcych zostanie zamknite a wszystkie dokonane zmiany - zapisane w systemie. Czy kontynuowa?\0" - 7356 "Twoja Maska Podsieci ulega zmianie. Po bicie zerowym w Masce mog nastpi wycznie bity zerowe. Na przykad, Maska, wyraona w zapisie dziesitnym jako 255.255.0.0, jest prawidowa, ale 255.0.255.0 ju nie. \n\0" - 7357 "Dopuszczenie Uytkownikw\0" - 7358 "Moesz wyznaczy uytkownikw, ktrzy bd mogli si poczy z tym komputerem.\0" - 7359 "Urzdzenia dla pocze przychodzcych\0" - 7360 "Moesz wybra urzdzenia jakich komputer uyje do obsugi pocze przychodzcych.\0" - 7361 "Przychodzce poczenie Wirtualnych Sieci Prywatnych (VPN)\0" - 7362 "Inny komputer moe poczy si z twoim za porednictwem poczenia VPN\0" + 7326 "Wystąpił błąd podczas przesyłania wprowadzonych zmian do bazy danych użytkownika lokalnego. \0" + 7327 "Nie masz dostatecznych przywilejów by dodać użytkownika do lokalnej systemowej bazy danych. \0" + 7328 "Użytkownik, którego chcesz stworzyć, już istnieje w lokalnej bazie danych użytkowników.\0" + 7329 "Użytkownik nie został dodany do lokalnej bazy danych użytkowników, dlatego, że jego hasło zostało odrzucone.\0" + 7330 "Nie można przeładować systemowej bazy danych użytkowników z powodu błędu wewnętrznego.\0" + 7331 "Wystąpił błąd wewnętrzny: Handle lokalnej bazy danych użytkowników jest uszkodzony.\0" + 7332 "Nie udało się załadować zasobów, niezbędnych do wyświetlenia zakładki Użytkownicy.\0" + 7333 "Wystąpił błąd wewnęytrzny podczas odwracania zmian, uczynionych w lokalnej bazie danych użytkowników. \0" + 7334 "Handle bazy danych urządzeń jest uszkodzony.\0" + 7335 "Nie udało się załadować zasobów, niezbędnych do wyświetlenia zakładki Ogólne.\0" + 7336 "Nastąpił błąd podczas zapisywania zmian jakie dokonane zostały w Urządzeniach/VPN. \0" + 7337 "Wystąpił błąd wewnętrzny.\0" + 7338 "Wystąpił błąd wewnętrzny: Handle bazy danych komponentów sieci jest uszkodzony.\0" + 7339 "Wystąpił błąd wewnętrzny. \0" + 7340 "Wystąpił błąd pocdczas zapisywania zmian, uczynionych w komponentach sieci.\0" + 7341 "Wystąpił błąd wewnętrzny.\0" + 7342 "Nie można zapisać zmian dokonanych w protokole TCP/IP. \0" + 7343 "Nie można zapisać zmian dokonanych w protokole IPX. \0" + 7344 "Nie można wyświetlić właściwości TCP/IP.\0" + 7345 "Nie można wyświetlić właściwości IPX.\0" + 7346 "Nie można załadować właściwości TCP/IP. \0" + 7347 "Nie można załadować właściwości IPX. \0" + 7348 "Połączenia przychodzące zależą od usługi Routingu i Dostępu Zdalnego, której to nie dało się uruchomić. Więcej informacji znajdziesz w logach Zdarzeń Systemowych.\0" + 7349 "Nie można zezwolić na edycję komponentów sieci w danej chwili, gdyż właśnie są modyfikowane przez kogoś innego.\0" + 7350 "Nowoutworzony użytkownik nie został dodany do lokalnej bazy danych użytkowników dlatego, że jego nazwa albo hasło nie było zgodne z wymaganiami systemu (było zbyt duże, za małe, albo źle sformułowane). \0" + 7351 "System nie może usunąć wybranego użytkownika. \0" + 7352 "Nie można usunąć wybranego komponentu sieci, ponieważ jest on obecnie używany.\0" + 7353 "Ostrzeżenie o połączeniu przychodzącym\0" + 7354 "Każdy skasowany użytkownik zostanie trwale usunięty z systemu, nawet jeśli naciśniesz później Anuluj. Czy na pewno chcesz trwale usunąć %s? \0" + 7355 "Masz zamiar się przełączyć na konsolę zarządzania systemem. Te okno właściwości Połączeń przychodzących zostanie zamknięte a wszystkie dokonane zmiany - zapisane w systemie. Czy kontynuować?\0" + 7356 "Twoja Maska Podsieci uległa zmianie. Po bicie zerowym w Masce mogą nastąpić wyłącznie bity zerowe. Na przykład, Maska, wyrażona w zapisie dziesiętnym jako 255.255.0.0, jest prawidłowa, ale 255.0.255.0 już nie. \n\0" + 7357 "Dopuszczenie Użytkowników\0" + 7358 "Możesz wyznaczyć użytkowników, którzy będą mogli się połączyć z tym komputerem.\0" + 7359 "Urządzenia dla połączeń przychodzących\0" + 7360 "Możesz wybrać urządzenia jakich komputer użyje do obsługi połączeń przychodzących.\0" + 7361 "Przychodzące połączenie Wirtualnych Sieci Prywatnych (VPN)\0" + 7362 "Inny komputer może połączyć się z twoim za pośrednictwem połączenia VPN\0" 7363 "Aplikacje sieciowe\0" - 7364 "Aplikacje sieciowe pozwala temu komputerowi na odbir pocze z innych komputerw.\0" - 7365 "Zakaczanie Kreatora konfiguracji poczenia\0" + 7364 "Aplikacje sieciowe pozwalaą temu komputerowi na odbiór połączeń z innych komputerów.\0" + 7365 "Zakańczanie Kreatora konfiguracji połączenia\0" 7366 " \0" - 7367 "Poczenia przychodzce\0" - 7371 "Nie zainstalowano adnego urzdzenia, zdolnego do odbioru pocze.\0" + 7367 "Połączenia przychodzące\0" + 7371 "Nie zainstalowano żadnego urządzenia, zdolnego do odbioru połączeń.\0" 7372 " \0" 7373 "Przydziel &ustalony numer adresu sieciowego:\0" - 7374 "Przydziel &numery adresw sieciowych sekwencyjnie od:\0" - 7375 "Nowy uytkownik\0" - 7376 "Urzdzenie sieciowe\0" - 7377 "Ktrego urzdzenia chcesz uy w tym poczeniu?\0" - 7378 "Nie ma obecnie adnych urzdze zainstalowanych, ktre byyby w stanie przyj poczenia przychodzce.\0" - 7379 "Ostrzeenie o nowym poczeniu przychodzcym\0" - 7380 "Poniewa ten Serwer Win 2000 naley do, albo kontroluje domen, musisz uy konsoli Routingu i Dostpu Zdalnego by skonfigurowa t maszyn tak by akceptowaa poczenia przychodzce. Anulowa zmiany i wczy t konsol?\n\0" + 7374 "Przydziel &numery adresów sieciowych sekwencyjnie od:\0" + 7375 "Nowy użytkownik\0" + 7376 "Urządzenie sieciowe\0" + 7377 "Którego urządzenia chcesz użyć w tym połączeniu?\0" + 7378 "Nie ma obecnie żadnych urządzeń zainstalowanych, które byłyby w stanie przyjąć połączenia przychodzące.\0" + 7379 "Ostrzeżenie o nowym połączeniu przychodzącym\0" + 7380 "Ponieważ ten Serwer Win 2000 należy do, albo kontroluje domenę, musisz użyć konsoli Routingu i Dostępu Zdalnego by skonfigurować tą maszynę tak by akceptowała połączenia przychodzące. Anulować zmiany i włączyć tą konsolę?\n\0" 7381 "Przydziel &numer adresu automagicznie\0" 7382 "Przydziel n&umer adresu automagicznie\0" - 7383 "Poczenia przychodzce nie mog uywa adresw IPX o numerach 00000000 lub FFFFFFFF. Prosz zmieni przydzielone numery adresw albo ustawi automagiczne przydzielanie numerw.\0" + 7383 "Połączenia przychodzące nie mogą używać adresów IPX o numerach 00000000 lub FFFFFFFF. Proszę zmienić przydzielone numery adresów albo ustawić automagiczne przydzielanie numerów.\0" 7384 "do\0" 7385 "Port Komunikacyjny (%s)\0" - 7386 "Poczenia Sieciowe nie wywietlaj niektrych zaawansowanych opcji dla pocze przychodzcych, ktre mona ustawi za pomc konsol Menedera Uytkownika Lokalnego albo Zdalnego Dostpu do Ustawie Remote. Aby uzyska aktualne i szczegowe informacje o poczeniach przychodzcych, bdziesz musia uy tych konsol.\0" - 7387 "Wasny tryb oddzwaniania, ktry wybrae, wymaga wprowadzenia waciwego numeru oddzwaniania.\0" - 7388 "ReactOS musi zrestartowa system by dokoczy konfiguracj. Czy mona zrestartowa w tej cwili?\0" - 7389 "Obecnie wybrane urzdzenie nie posiada adnych opcji konfiguracji.\0" - 7390 "Nieprawidowy zasig\0" - 7391 "Chcesz wyczy '%1' dla Pocze Przychodzcych.W tym celu musisz wpierw zatrzyma usug 'Serwer'. Po zatrzymaniu, aden z udostpnionych katalogw czy drukarek na tym komputerze nie bdzie dostpny dla innych komputerw. Czy chcesz wywoa konsol systemow ktra pozwoli ci zatrzyma usug 'Serwer'?\r\n\nW Zarzdzanie Komputerem kliknij na Narzdzia Systemowe a nastpnie na Usugi. W prawym panelu kliknij prawym przyciskiem na usug 'Serwer' a nastpnie na 'Zatrzymaj'.\0" - 7392 "Ten port szeregowy nie zosta ustawiony do uycia w bezporednim pozeniu z innym komputerem. Zostanie on ustawiony za pomoc kreatora konfiguracji. Aby uruchomi kreatora, nacinij prawym przyciskiem na ikon poczenia i wybierz Waciwoci.\n\0" - 7393 "Poczenia Przychodzce\0" - 7394 "Wprowadzona pula adresw IP jest nieprawidowa.\0" - 7395 "Podana maska podsieci jest nieprawidowa.\0" - 7396 "Adres startowy wprowadzonej puli TCP/IP jest nieprawidowy. Musi on znajdowa si pomidzy 1.0.0.0 a 224.0.0.0 i nie moe mie postaci 127.x.x.x.\0" - 7397 "Wprowadzona pula adresw TCP/IP jest nieprawidowa, gdy jest dokadniejsza ni maska podsieci.\0" - 7398 "Adres startowy musi by mniejszy ni kocowy\0" - 7399 "Usuga Routingu i Dostpu Zdalnego jest wanie zatrzymywana. Do czasu jej zatrzymania, Poczenia Przychodzce nie s dostpne. Prosz sprbowa ponownie za kilka chwil.\0" + 7386 "Połączenia Sieciowe nie wyświetlają niektórych zaawansowanych opcji dla połączeń przychodzących, które można ustawić za pomcą konsol Menedźera Użytkownika Lokalnego albo Zdalnego Dostępu do Ustawień Remote. Aby uzyskać aktualne i szczegółowe informacje o połączeniach przychodzących, będziesz musiał użyć tych konsol.\0" + 7387 "Własny tryb oddzwaniania, który wybrałeś, wymaga wprowadzenia właściwego numeru oddzwaniania.\0" + 7388 "ReactOS musi zrestartować system by dokończyć konfigurację. Czy można zrestartować w tej cwili?\0" + 7389 "Obecnie wybrane urządzenie nie posiada żadnych opcji konfiguracji.\0" + 7390 "Nieprawidłowy zasięg\0" + 7391 "Chcesz wyłączyć '%1' dla Połączeń Przychodzących.W tym celu musisz wpierw zatrzymać usługę 'Serwer'. Po zatrzymaniu, żaden z udostępnionych katalogów czy drukarek na tym komputerze nie będzie dostępny dla innych komputerów. Czy chcesz wywołać konsolę systemową która pozwoli ci zatrzymać usługę 'Serwer'?\r\n\nW Zarządzanie Komputerem kliknij na Narzędzia Systemowe a następnie na Usługi. W prawym panelu kliknij prawym przyciskiem na usługę 'Serwer' a następnie na 'Zatrzymaj'.\0" + 7392 "Ten port szeregowy nie został ustawiony do użycia w bezpośrednim połąćzeniu z innym komputerem. Zostanie on ustawiony za pomocą kreatora konfiguracji. Aby uruchomić kreatora, naciśnij prawym przyciskiem na ikonę połączenia i wybierz Właściwości.\n\0" + 7393 "Połączenia Przychodzące\0" + 7394 "Wprowadzona pula adresów IP jest nieprawidłowa.\0" + 7395 "Podana maska podsieci jest nieprawidłowa.\0" + 7396 "Adres startowy wprowadzonej puli TCP/IP jest nieprawidłowy. Musi on znajdować się pomiędzy 1.0.0.0 a 224.0.0.0 i nie może mieć postaci 127.x.x.x.\0" + 7397 "Wprowadzona pula adresów TCP/IP jest nieprawidłowa, gdyż jest dokładniejsza niż maska podsieci.\0" + 7398 "Adres startowy musi być mniejszy niż końcowy\0" + 7399 "Usługa Routingu i Dostępu Zdalnego jest właśnie zatrzymywana. Do czasu jej zatrzymania, Połączenia Przychodzące nie są dostępne. Proszę spróbować ponownie za kilka chwil.\0" 7400 "%s (%s)\0" - 7401 "%s (%d kanaw)\0" - 7402 "Poczenia Przychodzce VPN (PPTP)\0" - 7403 "Poczenia Przychodzce VPN (L2TP)\0" - 7404 "Bezpieczestwo IP(IKE)\0" + 7401 "%s (%d kanałów)\0" + 7402 "Połączenia Przychodzące VPN (PPTP)\0" + 7403 "Połączenia Przychodzące VPN (L2TP)\0" + 7404 "Bezpieczeństwo IP(IKE)\0" 7405 "127.0.0.1\0" - 7406 "Nie masz wystarczajcych przywilejw by ustawic Poczenia Przychodzce\0" - 29900 "Nie mona zaadowa usugi Menedera Dostpu Zdalnego.\0" - 29901 "Nie mona zaadowa pliku MPRAPI.DLL z katalogu system32.\0" + 7406 "Nie masz wystarczających przywilejów by ustawic Połączenia Przychodzące\0" + 29900 "Nie można załadować usługi Menedżera Dostępu Zdalnego.\0" + 29901 "Nie można załadować pliku MPRAPI.DLL z katalogu system32.\0" END diff --git a/dll/win32/rasdlg/lang/ru-RU.rc b/dll/win32/rasdlg/lang/ru-RU.rc index c20351d5e04..4d828d26a5c 100644 --- a/dll/win32/rasdlg/lang/ru-RU.rc +++ b/dll/win32/rasdlg/lang/ru-RU.rc @@ -2,342 +2,342 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT 102 DIALOGEX 0, 0, 255, 265 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION " " +CAPTION "Дополнительные номера телефонов" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " , .", 1018, 7, 5, 243, 16 - LTEXT " &:", 1019, 7, 27, 238, 8 + LTEXT "Укажите дополнительные номера телефонов, которые вы хотели бы использовать для установления этого подключения.", 1018, 7, 5, 243, 16 + LTEXT "Номера &телефонов:", 1019, 7, 27, 238, 8 CONTROL "", 1012, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x0000848D, 7, 38, 217, 144 - PUSHBUTTON "&", 1017, 230, 40, 18, 16, BS_ICON - PUSHBUTTON "&", 1015, 230, 61, 18, 16, BS_ICON - PUSHBUTTON "&...", 1013, 7, 187, 70, 14 - PUSHBUTTON "&...", 1016, 81, 187, 70, 14 - PUSHBUTTON "&", 1014, 154, 187, 70, 14 - AUTOCHECKBOX "& ", 1011, 8, 210, 243, 10, BS_TOP | BS_MULTILINE - AUTOCHECKBOX "& ", 1010, 8, 228, 243, 10, BS_TOP | BS_MULTILINE + PUSHBUTTON "&Вверх", 1017, 230, 40, 18, 16, BS_ICON + PUSHBUTTON "Вни&з", 1015, 230, 61, 18, 16, BS_ICON + PUSHBUTTON "&Добавить...", 1013, 7, 187, 70, 14 + PUSHBUTTON "&Изменить...", 1016, 81, 187, 70, 14 + PUSHBUTTON "&Удалить", 1014, 154, 187, 70, 14 + AUTOCHECKBOX "&При сбое пытаться соединиться по следующему номеру", 1011, 8, 210, 243, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "П&ереносить успешно набранный номер в начало списка", 1010, 8, 228, 243, 10, BS_TOP | BS_MULTILINE DEFPUSHBUTTON "OK", 1, 122, 245, 60, 14 - PUSHBUTTON "", 2, 188, 245, 60, 14 + PUSHBUTTON "Отмена", 2, 188, 245, 60, 14 END 103 DIALOGEX 6, 18, 250, 170 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION -CAPTION " " +CAPTION "Сетевые подключения" FONT 8, "MS Shell Dlg" BEGIN LTEXT "", 1029, 5, 5, 241, 35, NOT WS_GROUP - LTEXT "&:", -1, 5, 46, 238, 10 + LTEXT "&Подключения:", -1, 5, 46, 238, 10 CONTROL "List1", 1677, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x0000440D, 5, 57, 240, 57 - AUTOCHECKBOX "& ", 1022, 8, 125, 235, 10 - PUSHBUTTON "&", 1026, 7, 149, 60, 14 - DEFPUSHBUTTON "&...", 1024, 117, 149, 60, 14 - PUSHBUTTON "", 1025, 183, 149, 60, 14 + AUTOCHECKBOX "&Не спрашивать до следующей загрузки", 1022, 8, 125, 235, 10 + PUSHBUTTON "П&араметры", 1026, 7, 149, 60, 14 + DEFPUSHBUTTON "Под&ключить...", 1024, 117, 149, 60, 14 + PUSHBUTTON "Отмена", 1025, 183, 149, 60, 14 END 104 DIALOGEX 6, 18, 269, 263 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION " " +CAPTION "Ошибки группы линий" FONT 8, "MS Shell Dlg" BEGIN ICON 32516, 1031, 7, 7, 20, 20 - LTEXT " . ", 1033, 37, 8, 216, 20 + LTEXT "Некоторые из дополнительных линий не подключены. ", 1033, 37, 8, 216, 20 CONTROL "", 1032, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x00008401, 37, 83, 224, 136 - AUTOCHECKBOX "& ", 1030, 38, 226, 222, 10 - DEFPUSHBUTTON "&", 1, 135, 242, 60, 14 - PUSHBUTTON "&", 2, 201, 242, 60, 14 - LTEXT " , , , . "" "".", -1, 37, 36, 224, 44 + AUTOCHECKBOX "Н&е использовать отказавшие линии", 1030, 38, 226, 222, 10 + DEFPUSHBUTTON "&Принять", 1, 135, 242, 60, 14 + PUSHBUTTON "&Завершить", 2, 201, 242, 60, 14 + LTEXT "Если связь установлена только по одной линии, то сервер, вероятно, не поддерживает связь по нескольким каналам. В этом случае установите флажок ""Не использовать отказавшие линии"".", -1, 37, 36, 224, 44 END 105 DIALOGEX 0, 0, 261, 253 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION " " +CAPTION "Дополнительные параметры безопасности" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ", 1547, 7, 33, 246, 191 - LTEXT "& :", 1546, 7, 5, 247, 10 + GROUPBOX "Безопасный вход", 1547, 7, 33, 246, 191 + LTEXT "&Шифрование данных:", 1546, 7, 5, 247, 10 COMBOBOX 1495, 7, 17, 247, 76, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - AUTORADIOBUTTON "& (EAP)", 1544, 17, 47, 226, 8, WS_GROUP - LTEXT " EAP", -1, 18, 64, 35, 8, NOT WS_VISIBLE | NOT WS_GROUP + AUTORADIOBUTTON "П&ротокол расширенной проверки подлинности (EAP)", 1544, 17, 47, 226, 8, WS_GROUP + LTEXT "Тип EAP", -1, 18, 64, 35, 8, NOT WS_VISIBLE | NOT WS_GROUP COMBOBOX 1034, 53, 62, 191, 42, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | NOT WS_TABSTOP - PUSHBUTTON "&", 1035, 184, 77, 60, 14 - AUTORADIOBUTTON " & ", 1545, 17, 92, 224, 10 - AUTOCHECKBOX "& ()", 1491, 28, 105, 215, 10, BS_TOP | BS_MULTILINE | WS_GROUP - AUTOCHECKBOX "& Shiva (SPAP)", 1496, 28, 119, 214, 10, BS_TOP | BS_MULTILINE - AUTOCHECKBOX "& (CHAP)", 1494, 28, 133, 215, 10, BS_TOP | BS_MULTILINE - AUTOCHECKBOX "& MS (MS-CHAP)", 1493, 28, 148, 212, 10, BS_TOP | BS_MULTILINE - AUTOCHECKBOX "& MS-CHAP Win 95", 200, 46, 162, 198, 10, BS_TOP | BS_MULTILINE - AUTOCHECKBOX "& MS (MS-CHAP v2)", 1492, 28, 176, 200, 10, BS_TOP | BS_MULTILINE + PUSHBUTTON "Сво&йств", 1035, 184, 77, 60, 14 + AUTORADIOBUTTON "Разрешить сле&дующие протоколы", 1545, 17, 92, 224, 10 + AUTOCHECKBOX "&Незашифрованный пароль (РАР)", 1491, 28, 105, 215, 10, BS_TOP | BS_MULTILINE | WS_GROUP + AUTOCHECKBOX "Про&токол проверки пароля Shiva (SPAP)", 1496, 28, 119, 214, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Пр&отокол проверки пароля (CHAP)", 1494, 28, 133, 215, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Протокол проверки пароля MS (MS-CHAP)", 1493, 28, 148, 212, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Ра&зрешить старый протокол MS-CHAP для Win 95", 200, 46, 162, 198, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Прото&кол проверки пароля MS (MS-CHAP v2)", 1492, 28, 176, 200, 10, BS_TOP | BS_MULTILINE CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 28, 189, 208, 1 - AUTOCHECKBOX "& MS-CHAP ReactOS ( , )", 1549, 28, 195, 213, 24, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Д&ля протоколов на основе MS-CHAP автоматически использовать имя входа и пароль ReactOS (и имя домена, если существует)", 1549, 28, 195, 213, 24, BS_TOP | BS_MULTILINE DEFPUSHBUTTON "OK", 1, 127, 232, 60, 14 - PUSHBUTTON "", 2, 192, 232, 60, 14 + PUSHBUTTON "Отмена", 2, 192, 232, 60, 14 END 106 DIALOGEX 6, 18, 255, 109 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION " " +CAPTION "Завершение подключения" FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "OK", 1, 97, 91, 60, 14 ICON 563, 1046, 7, 7, 20, 20 - LTEXT " .", 1047, 40, 7, 212, 16 - LTEXT " "" "" ( ).", -1, 40, 30, 212, 34 - AUTOCHECKBOX "& ", 1045, 40, 69, 212, 10, BS_TOP | BS_MULTILINE + LTEXT "Подключение установлено.", 1047, 40, 7, 212, 16 + LTEXT "Для проверки наличия подключения щелкните правой кнопкой мыши по папке ""Сетевые подключения"" или щелкните по значку на панели задач (если он есть).", -1, 40, 30, 212, 34 + AUTOCHECKBOX "&Не выводить это сообщение в дальнейшем", 1045, 40, 69, 212, 10, BS_TOP | BS_MULTILINE END 107 DIALOGEX 0, 0, 258, 167 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ", 1053, 7, 5, 243, 92 - LTEXT "& :", 1055, 18, 17, 54, 8 + GROUPBOX "Номер телефона", 1053, 7, 5, 243, 92 + LTEXT "&Код города:", 1055, 18, 17, 54, 8 COMBOBOX 1049, 17, 30, 55, 129, CBS_DROPDOWN | WS_VSCROLL | NOT WS_TABSTOP - LTEXT "& :", 1057, 77, 17, 166, 8, NOT WS_GROUP + LTEXT "&Номер телефона:", 1057, 77, 17, 166, 8, NOT WS_GROUP EDITTEXT 1051, 77, 30, 163, 14, ES_AUTOHSCROLL - LTEXT "& :", 1056, 18, 48, 221, 8, NOT WS_GROUP + LTEXT "К&од страны или региона:", 1056, 18, 48, 221, 8, NOT WS_GROUP COMBOBOX 1054, 17, 61, 224, 93, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | NOT WS_TABSTOP - AUTOCHECKBOX "& ", 1048, 20, 81, 219, 10, BS_TOP | BS_MULTILINE - GROUPBOX "&", 1052, 7, 102, 243, 36 + AUTOCHECKBOX "&Использовать правила набора номера", 1048, 20, 81, 219, 10, BS_TOP | BS_MULTILINE + GROUPBOX "Комм&ентарий", 1052, 7, 102, 243, 36 EDITTEXT 1050, 17, 115, 224, 14, ES_AUTOHSCROLL DEFPUSHBUTTON "OK", 1, 127, 147, 60, 14 - PUSHBUTTON "", 2, 191, 147, 60, 14 + PUSHBUTTON "Отмена", 2, 191, 147, 60, 14 END 108 DIALOGEX 6, 18, 222, 104 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION " " +CAPTION "Смена пароля" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " . """".", 1062, 7, 5, 210, 24 - LTEXT "& :", 1064, 8, 43, 108, 8 + LTEXT "Срок действия пароля в удаленной сети истек. Введите новый пароль и нажмите кнопку ""ОК"".", 1062, 7, 5, 210, 24 + LTEXT "&Новый пароль:", 1064, 8, 43, 108, 8 EDITTEXT 1060, 118, 38, 98, 14, ES_PASSWORD | ES_AUTOHSCROLL - LTEXT "&:", 1061, 8, 61, 102, 8 + LTEXT "&Подтверждение:", 1061, 8, 61, 102, 8 EDITTEXT 1058, 118, 57, 98, 14, ES_PASSWORD | ES_AUTOHSCROLL DEFPUSHBUTTON "OK", 1, 90, 84, 60, 14, WS_GROUP - PUSHBUTTON "", 2, 154, 84, 60, 14 + PUSHBUTTON "Отмена", 2, 154, 84, 60, 14 END 109 DIALOGEX 6, 18, 223, 122 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION " " +CAPTION "Смена пароля" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " . """".", 1062, 7, 5, 212, 29 - LTEXT "& :", 1063, 7, 42, 108, 8 + LTEXT "Срок действия пароля в удаленной сети истек. Введите новый пароль и нажмите кнопку ""ОК"".", 1062, 7, 5, 212, 29 + LTEXT "&Старый пароль:", 1063, 7, 42, 108, 8 EDITTEXT 1059, 116, 38, 100, 14, ES_PASSWORD | ES_AUTOHSCROLL - LTEXT "& :", 1064, 7, 60, 108, 8 + LTEXT "&Новый пароль:", 1064, 7, 60, 108, 8 EDITTEXT 1060, 116, 56, 100, 14, ES_PASSWORD | ES_AUTOHSCROLL - LTEXT "&:", 1061, 7, 78, 108, 8 + LTEXT "&Подтверждение:", 1061, 7, 78, 108, 8 EDITTEXT 1058, 116, 74, 100, 14, ES_PASSWORD | ES_AUTOHSCROLL DEFPUSHBUTTON "OK", 1, 92, 101, 60, 14, WS_GROUP - PUSHBUTTON "", 2, 156, 101, 60, 14 + PUSHBUTTON "Отмена", 2, 156, 101, 60, 14 END 110 DIALOGEX 12, 16, 230, 105 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION " " +CAPTION "Ответный вызов сервера" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " . """" . """" .", 1066, 5, 5, 221, 39, SS_NOPREFIX - LTEXT "& :", 1067, 5, 46, 222, 8, NOT WS_GROUP + LTEXT "Вы имеете право на ответный вызов со стороны сервера. После нажатия кнопки ""ОК"" сервер выполнит ответный вызов по указанному ниже телефону. Кнопка ""Отмена"" служит для отказа от ответного вызова.", 1066, 5, 5, 221, 39, SS_NOPREFIX + LTEXT "&Введите номер телефона вашего модема:", 1067, 5, 46, 222, 8, NOT WS_GROUP EDITTEXT 1065, 5, 57, 221, 14, ES_AUTOHSCROLL DEFPUSHBUTTON "OK", 1, 100, 85, 60, 14, WS_GROUP - PUSHBUTTON "", 2, 164, 85, 60, 14 + PUSHBUTTON "Отмена", 2, 164, 85, 60, 14 END 111 DIALOGEX 6, 19, 265, 135 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION " : %1" +CAPTION "Ошибка подключения: %1" FONT 8, "MS Shell Dlg" BEGIN ICON 32515, 1068, 7, 7, 20, 20, WS_GROUP LTEXT "", 1070, 34, 7, 226, 105 - DEFPUSHBUTTON " =88", 1, 4, 117, 128, 14, WS_GROUP - PUSHBUTTON "", 2, 136, 117, 60, 14 - PUSHBUTTON "&", 1069, 200, 117, 60, 14 + DEFPUSHBUTTON "Не звонить=88", 1, 4, 117, 128, 14, WS_GROUP + PUSHBUTTON "Отмена", 2, 136, 117, 60, 14 + PUSHBUTTON "По&дробнее", 1069, 200, 117, 60, 14 END 112 DIALOGEX 6, 18, 263, 219 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION " " +CAPTION "Автоматическое выполнение звонков" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "ReactOS .", 1085, 9, 7, 253, 30 - GROUPBOX " ", -1, 6, 38, 249, 71 - LTEXT " , :", 1083, 16, 51, 237, 16, NOT WS_GROUP - LTEXT " &:", -1, 16, 73, 100, 8 + LTEXT "ReactOS может автоматически подключаться и завершать связь с коммутируемыми устройствами в зависимости от интенсивности обмена данными.", 1085, 9, 7, 253, 30 + GROUPBOX "Автоматическое подключение", -1, 6, 38, 249, 71 + LTEXT "Позвонить по другой линии, когда подключение удовлетворяет двум условиям одновременно:", 1083, 16, 51, 237, 16, NOT WS_GROUP + LTEXT "Активно не ме&нее:", -1, 16, 73, 100, 8 COMBOBOX 1079, 117, 70, 60, 100, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - LTEXT " &:", 1084, 16, 87, 99, 17, NOT WS_GROUP + LTEXT "Продолжительность не &менее:", 1084, 16, 87, 99, 17, NOT WS_GROUP COMBOBOX 1080, 117, 89, 90, 162, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - GROUPBOX " ", -1, 6, 113, 248, 81 - LTEXT " , :", 1086, 16, 127, 230, 18, NOT WS_GROUP - LTEXT " &:", -1, 16, 150, 92, 8 + GROUPBOX "Автоматический разрыв соединения", -1, 6, 113, 248, 81 + LTEXT "Завершить связь, когда подключение удовлетворяет двум условиям одновременно:", 1086, 16, 127, 230, 18, NOT WS_GROUP + LTEXT "Активно не &более:", -1, 16, 150, 92, 8 COMBOBOX 1081, 115, 146, 60, 100, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - LTEXT "& :", 1087, 16, 164, 92, 17, NOT WS_GROUP + LTEXT "Продолжит&ельность не менее:", 1087, 16, 164, 92, 17, NOT WS_GROUP COMBOBOX 1082, 115, 166, 90, 151, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP DEFPUSHBUTTON "OK", 1, 131, 199, 60, 14, WS_GROUP - PUSHBUTTON "", 2, 194, 199, 60, 14 + PUSHBUTTON "Отмена", 2, 194, 199, 60, 14 END 113 DIALOGEX 21, 46, 225, 65 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION -CAPTION " %1..." +CAPTION "Установка связи с %1..." FONT 8, "MS Shell Dlg" BEGIN ICON 563, 1417, 7, 7, 20, 20 LTEXT "", 1097, 36, 7, 185, 35, SS_NOPREFIX - PUSHBUTTON "", 2, 83, 47, 60, 14 + PUSHBUTTON "Отмена", 2, 83, 47, 60, 14 END 114 DIALOGEX 6, 18, 225, 60 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION " " +CAPTION "Удаленный доступ к сети" FONT 8, "MS Shell Dlg" BEGIN ICON 563, 1098, 7, 6, 20, 20, WS_GROUP - LTEXT " . ?", 1099, 40, 6, 181, 34, NOT WS_GROUP - PUSHBUTTON "&", 1, 60, 42, 50, 14 - DEFPUSHBUTTON "&", 2, 115, 42, 50, 14 + LTEXT "Сбой при автоматическом наборе номера. Отключить автонабор номера для данного места вызова?", 1099, 40, 6, 181, 34, NOT WS_GROUP + PUSHBUTTON "&Да", 1, 60, 42, 50, 14 + DEFPUSHBUTTON "&Нет", 2, 115, 42, 50, 14 END 115 DIALOGEX 0, 0, 263, 124 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION " %1" +CAPTION "Подключение к %1" FONT 8, "MS Shell Dlg" BEGIN CONTROL 1678, 1100, "STATIC", SS_BITMAP, 0, 0, 263, 50 - LTEXT "&:", 1412, 9, 60, 68, 8 + LTEXT "&Набрать:", 1412, 9, 60, 68, 8 COMBOBOX 1416, 88, 56, 165, 112, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | NOT WS_TABSTOP - LTEXT "& :", 1415, 9, 77, 71, 8 + LTEXT "&Место вызова:", 1415, 9, 77, 71, 8 COMBOBOX 1414, 88, 75, 89, 112, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | NOT WS_TABSTOP - PUSHBUTTON "&", 1108, 181, 75, 72, 14 + PUSHBUTTON "&Правила", 1108, 181, 75, 72, 14 CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 8, 96, 245, 1 - DEFPUSHBUTTON "&", 1590, 8, 103, 61, 14 - PUSHBUTTON "", 1591, 70, 103, 60, 14 - PUSHBUTTON "&", 1107, 132, 103, 60, 14 - PUSHBUTTON "&", 1592, 194, 103, 60, 14 + DEFPUSHBUTTON "В&ызов", 1590, 8, 103, 61, 14 + PUSHBUTTON "Отмена", 1591, 70, 103, 60, 14 + PUSHBUTTON "С&войства", 1107, 132, 103, 60, 14 + PUSHBUTTON "&Справка", 1592, 194, 103, 60, 14 END 116 DIALOGEX 0, 0, 265, 176 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION " %1" +CAPTION "Подключение к %1" FONT 8, "MS Shell Dlg" BEGIN CONTROL 1678, 1100, "STATIC", SS_BITMAP, 0, 0, 265, 50 - LTEXT "&:", 1413, 8, 60, 88, 8 + LTEXT "По&льзователь:", 1413, 8, 60, 88, 8 EDITTEXT 1104, 103, 57, 154, 14, ES_AUTOHSCROLL - LTEXT "&:", 1112, 8, 79, 88, 8 + LTEXT "П&ароль:", 1112, 8, 79, 88, 8 EDITTEXT 1103, 103, 76, 154, 14, ES_PASSWORD | ES_AUTOHSCROLL CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN, 8, 97, 248, 1 - AUTOCHECKBOX "& :", 1101, 14, 105, 239, 13, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP - AUTORADIOBUTTON " & ", 1622, 26, 120, 226, 11, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP - AUTORADIOBUTTON " & ", 1623, 26, 134, 229, 11, BS_LEFT | BS_TOP | BS_MULTILINE + AUTOCHECKBOX "С&охранять имя пользователя и пароль:", 1101, 14, 105, 239, 13, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP + AUTORADIOBUTTON "только дл&я меня", 1622, 26, 120, 226, 11, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP + AUTORADIOBUTTON "для л&юбого пользователя", 1623, 26, 134, 229, 11, BS_LEFT | BS_TOP | BS_MULTILINE CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 8, 149, 248, 1 - DEFPUSHBUTTON "&", 1590, 8, 156, 60, 14, WS_GROUP - PUSHBUTTON "", 1591, 71, 156, 60, 14 - PUSHBUTTON "&", 1107, 133, 156, 60, 14 - PUSHBUTTON "&", 1592, 195, 156, 60, 14 + DEFPUSHBUTTON "В&ызов", 1590, 8, 156, 60, 14, WS_GROUP + PUSHBUTTON "Отмена", 1591, 71, 156, 60, 14 + PUSHBUTTON "С&войства", 1107, 133, 156, 60, 14 + PUSHBUTTON "&Справка", 1592, 195, 156, 60, 14 END 117 DIALOGEX 0, 0, 263, 192 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION " %1" +CAPTION "Подключение к %1" FONT 8, "MS Shell Dlg" BEGIN CONTROL 1678, 1100, "STATIC", SS_BITMAP, 0, 0, 265, 50 - LTEXT "&:", 1413, 9, 61, 92, 8 + LTEXT "По&льзователь:", 1413, 9, 61, 92, 8 EDITTEXT 1104, 102, 57, 154, 14, ES_AUTOHSCROLL - LTEXT "&:", 1112, 9, 80, 92, 8 + LTEXT "&Пароль:", 1112, 9, 80, 92, 8 EDITTEXT 1103, 102, 76, 154, 14, ES_PASSWORD | ES_AUTOHSCROLL - LTEXT "&:", 1110, 9, 99, 91, 8 + LTEXT "&Домен:", 1110, 9, 99, 91, 8 EDITTEXT 1102, 102, 95, 154, 14, ES_UPPERCASE | ES_AUTOHSCROLL CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN, 9, 116, 247, 1 - AUTOCHECKBOX "& :", 1101, 12, 123, 243, 13, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP - AUTORADIOBUTTON " & ", 1622, 25, 137, 229, 11, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP - AUTORADIOBUTTON " & ", 1623, 25, 151, 230, 11, BS_LEFT | BS_TOP | BS_MULTILINE + AUTOCHECKBOX "С&охранять имя пользователя и пароль:", 1101, 12, 123, 243, 13, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP + AUTORADIOBUTTON "только дл&я меня", 1622, 25, 137, 229, 11, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP + AUTORADIOBUTTON "для л&юбого пользователя", 1623, 25, 151, 230, 11, BS_LEFT | BS_TOP | BS_MULTILINE CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 9, 167, 247, 1 - DEFPUSHBUTTON "&", 1590, 8, 173, 60, 14, WS_GROUP - PUSHBUTTON "", 1591, 71, 173, 60, 14 - PUSHBUTTON "&", 1107, 133, 173, 60, 14 - PUSHBUTTON "&", 1592, 195, 173, 60, 14 + DEFPUSHBUTTON "В&ызов", 1590, 8, 173, 60, 14, WS_GROUP + PUSHBUTTON "Отмена", 1591, 71, 173, 60, 14 + PUSHBUTTON "С&войства", 1107, 133, 173, 60, 14 + PUSHBUTTON "&Справка", 1592, 195, 173, 60, 14 END 118 DIALOGEX 0, 0, 265, 220 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION " %1" +CAPTION "Подключение к %1" FONT 8, "MS Shell Dlg" BEGIN CONTROL 1678, 1100, "STATIC", SS_BITMAP, 0, 0, 265, 50 - LTEXT "&:", 1413, 10, 61, 92, 8 + LTEXT "По&льзователь:", 1413, 10, 61, 92, 8 EDITTEXT 1104, 104, 57, 154, 14, ES_AUTOHSCROLL - LTEXT "&:", 1112, 10, 80, 92, 8 + LTEXT "&Пароль:", 1112, 10, 80, 92, 8 EDITTEXT 1103, 104, 76, 154, 14, ES_PASSWORD | ES_AUTOHSCROLL - LTEXT "&:", 1110, 10, 100, 92, 8 + LTEXT "&Домен:", 1110, 10, 100, 92, 8 EDITTEXT 1102, 104, 95, 154, 14, ES_UPPERCASE | ES_AUTOHSCROLL CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN, 11, 116, 247, 1 - AUTOCHECKBOX "& :", 1101, 16, 124, 239, 13, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP - AUTORADIOBUTTON " & ", 1622, 29, 139, 225, 11, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP - AUTORADIOBUTTON " & ", 1623, 29, 152, 225, 11, BS_LEFT | BS_TOP | BS_MULTILINE + AUTOCHECKBOX "С&охранять имя пользователя и пароль:", 1101, 16, 124, 239, 13, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP + AUTORADIOBUTTON "только дл&я меня", 1622, 29, 139, 225, 11, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP + AUTORADIOBUTTON "для л&юбого пользователя", 1623, 29, 152, 225, 11, BS_LEFT | BS_TOP | BS_MULTILINE CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 10, 167, 247, 1 - LTEXT "&:", 1412, 10, 177, 90, 8 + LTEXT "&Набрать:", 1412, 10, 177, 90, 8 COMBOBOX 1416, 102, 173, 154, 112, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | NOT WS_TABSTOP CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 10, 192, 247, 1 - DEFPUSHBUTTON "&", 1590, 10, 199, 60, 14, WS_GROUP - PUSHBUTTON "", 1591, 72, 199, 60, 14 - PUSHBUTTON "&", 1107, 134, 199, 60, 14 - PUSHBUTTON "&", 1592, 196, 199, 60, 14 + DEFPUSHBUTTON "В&ызов", 1590, 10, 199, 60, 14, WS_GROUP + PUSHBUTTON "Отмена", 1591, 72, 199, 60, 14 + PUSHBUTTON "С&войства", 1107, 134, 199, 60, 14 + PUSHBUTTON "&Справка", 1592, 196, 199, 60, 14 END 119 DIALOGEX 0, 0, 265, 200 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION " %1" +CAPTION "Подключение к %1" FONT 8, "MS Shell Dlg" BEGIN CONTROL 1678, 1100, "STATIC", SS_BITMAP, 0, 0, 265, 50 - LTEXT "&:", 1413, 10, 62, 91, 8 + LTEXT "По&льзователь:", 1413, 10, 62, 91, 8 EDITTEXT 1104, 104, 58, 154, 14, ES_AUTOHSCROLL - LTEXT "&:", 1112, 10, 81, 92, 8 + LTEXT "&Пароль:", 1112, 10, 81, 92, 8 EDITTEXT 1103, 104, 77, 154, 14, ES_PASSWORD | ES_AUTOHSCROLL CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN, 10, 97, 247, 1 - AUTOCHECKBOX "& :", 1101, 12, 103, 243, 13, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP - AUTORADIOBUTTON " & ", 1622, 24, 117, 229, 11, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP - AUTORADIOBUTTON " & ", 1623, 24, 132, 229, 11, BS_LEFT | BS_TOP | BS_MULTILINE + AUTOCHECKBOX "С&охранять имя пользователя и пароль:", 1101, 12, 103, 243, 13, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP + AUTORADIOBUTTON "только дл&я меня", 1622, 24, 117, 229, 11, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP + AUTORADIOBUTTON "для л&юбого пользователя", 1623, 24, 132, 229, 11, BS_LEFT | BS_TOP | BS_MULTILINE CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 10, 147, 247, 1 - LTEXT "&:", 1412, 13, 157, 88, 8 + LTEXT "&Набрать:", 1412, 13, 157, 88, 8 COMBOBOX 1416, 103, 154, 154, 112, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | NOT WS_TABSTOP CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 10, 173, 247, 1 - DEFPUSHBUTTON "&", 1590, 10, 180, 60, 14, WS_GROUP - PUSHBUTTON "", 1591, 72, 180, 60, 14 - PUSHBUTTON "&", 1107, 134, 180, 60, 14 - PUSHBUTTON "&", 1592, 197, 180, 60, 14 + DEFPUSHBUTTON "В&ызов", 1590, 10, 180, 60, 14, WS_GROUP + PUSHBUTTON "Отмена", 1591, 72, 180, 60, 14 + PUSHBUTTON "С&войства", 1107, 134, 180, 60, 14 + PUSHBUTTON "&Справка", 1592, 197, 180, 60, 14 END 121 DIALOGEX 6, 18, 230, 131 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION " ISDN" +CAPTION "Настройка ISDN" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "& :", 1155, 9, 9, 65, 8 + LTEXT "&Тип линии:", 1155, 9, 9, 65, 8 COMBOBOX 1153, 76, 7, 148, 42, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP - AUTOCHECKBOX "& ", 1150, 23, 26, 199, 10, BS_TOP | BS_MULTILINE | WS_GROUP + AUTOCHECKBOX "С&огласование типа линии", 1150, 23, 26, 199, 10, BS_TOP | BS_MULTILINE | WS_GROUP GROUPBOX " ", 1152, 8, 48, 214, 51, WS_GROUP - AUTOCHECKBOX "& ", 1149, 17, 48, 102, 10, BS_TOP | BS_MULTILINE - LTEXT "& :", 1154, 16, 65, 100, 8, NOT WS_GROUP + AUTOCHECKBOX "&Использовать старый протокол", 1149, 17, 48, 102, 10, BS_TOP | BS_MULTILINE + LTEXT "И&спользовать каналы:", 1154, 16, 65, 100, 8, NOT WS_GROUP EDITTEXT 1151, 119, 61, 94, 14, ES_AUTOHSCROLL - AUTOCHECKBOX "& ", 1148, 16, 82, 198, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Включить аппаратное сжатие", 1148, 16, 82, 198, 10, BS_TOP | BS_MULTILINE PUSHBUTTON "OK", 1, 99, 109, 60, 14, WS_GROUP - PUSHBUTTON "", 2, 163, 109, 60, 14 + PUSHBUTTON "Отмена", 2, 163, 109, 60, 14 END 122 DIALOGEX 6, 18, 220, 68 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION " ISDN" +CAPTION "Настройка ISDN" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "& :", 1155, 9, 11, 55, 8 + LTEXT "&Тип линии:", 1155, 9, 11, 55, 8 COMBOBOX 1153, 67, 7, 148, 43, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP - AUTOCHECKBOX "& ", 1150, 21, 28, 194, 10, BS_TOP | BS_MULTILINE | WS_GROUP + AUTOCHECKBOX "С&огласование типа линии", 1150, 21, 28, 194, 10, BS_TOP | BS_MULTILINE | WS_GROUP PUSHBUTTON "OK", 1, 90, 49, 60, 14, WS_GROUP - PUSHBUTTON "", 2, 154, 49, 60, 14 + PUSHBUTTON "Отмена", 2, 154, 49, 60, 14 END 123 DIALOGEX 11, 20, 350, 275 @@ -345,11 +345,11 @@ STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN EDITTEXT 1161, 5, 5, 338, 236, ES_MULTILINE | ES_AUTOVSCROLL | WS_VSCROLL | WS_GROUP - LTEXT "IP-&:", 1163, 7, 253, 68, 8 + LTEXT "IP-&адрес:", 1163, 7, 253, 68, 8 CONTROL "", 1160, "RASIPADDRESS", WS_TABSTOP, 76, 250, 117, 14 DEFPUSHBUTTON "", 1162, 197, 252, 16, 13, NOT WS_VISIBLE | WS_GROUP | NOT WS_TABSTOP - PUSHBUTTON "&", 1, 219, 252, 60, 14, WS_GROUP - PUSHBUTTON "", 2, 283, 252, 60, 14 + PUSHBUTTON "&Готово", 1, 219, 252, 60, 14, WS_GROUP + PUSHBUTTON "Отмена", 2, 283, 252, 60, 14 END 124 DIALOGEX 6, 17, 350, 266 @@ -358,151 +358,151 @@ FONT 8, "MS Shell Dlg" BEGIN EDITTEXT 1161, 5, 4, 340, 236, ES_MULTILINE | ES_AUTOVSCROLL | WS_VSCROLL | WS_GROUP DEFPUSHBUTTON "", 1162, 7, 247, 50, 14, NOT WS_VISIBLE | WS_GROUP | NOT WS_TABSTOP - PUSHBUTTON "&", 1, 222, 247, 60, 14, WS_GROUP - PUSHBUTTON "", 2, 286, 247, 60, 14 + PUSHBUTTON "&Готово", 1, 222, 247, 60, 14, WS_GROUP + PUSHBUTTON "Отмена", 2, 286, 247, 60, 14 END 125 DIALOGEX 12, 16, 261, 190 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION " " +CAPTION "Конфигурация модема" FONT 8, "MS Shell Dlg" BEGIN ICON 15102, 1238, 7, 7, 20, 20 - LTEXT "", -1, 25, 27, 24, 8, NOT WS_VISIBLE | NOT WS_GROUP + LTEXT "Модем", -1, 25, 27, 24, 8, NOT WS_VISIBLE | NOT WS_GROUP EDITTEXT 1235, 40, 7, 214, 16, ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER - LTEXT "& (/):", 1243, 7, 36, 110, 8 + LTEXT "&Наибольшая скорость (бит/с):", 1243, 7, 36, 110, 8 COMBOBOX 1239, 119, 34, 136, 186, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | NOT WS_TABSTOP - LTEXT "& ", 1244, 7, 52, 111, 8 + LTEXT "&Протокол модема", 1244, 7, 52, 111, 8 COMBOBOX 1245, 119, 50, 136, 186, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | NOT WS_TABSTOP - GROUPBOX " ", 1237, 6, 70, 248, 61, WS_GROUP - AUTOCHECKBOX "& ", 1232, 19, 82, 217, 10, BS_TOP | BS_MULTILINE - AUTOCHECKBOX "& ", 1231, 19, 98, 217, 10, BS_TOP | BS_MULTILINE - AUTOCHECKBOX "& ", 1229, 19, 115, 217, 10, BS_TOP | BS_MULTILINE - AUTOCHECKBOX "& ", 1234, 8, 136, 246, 10, BS_TOP | BS_MULTILINE - AUTOCHECKBOX " & ", 1230, 8, 151, 247, 10, BS_TOP | BS_MULTILINE | WS_GROUP + GROUPBOX "Параметры оборудования", 1237, 6, 70, 248, 61, WS_GROUP + AUTOCHECKBOX "&Аппаратное управление потоком", 1232, 19, 82, 217, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "О&бработка ошибок модемом", 1231, 19, 98, 217, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "С&жатие данных модемом", 1229, 19, 115, 217, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Вывести окно терминала", 1234, 8, 136, 246, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Включить &динамик модема", 1230, 8, 151, 247, 10, BS_TOP | BS_MULTILINE | WS_GROUP DEFPUSHBUTTON "OK", 1, 129, 171, 60, 14, WS_GROUP - PUSHBUTTON "", 2, 194, 171, 60, 14 + PUSHBUTTON "Отмена", 2, 194, 171, 60, 14 END 126 DIALOGEX 0, 0, 270, 117 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION " " +CAPTION "Выбор типа сетевого компонента" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " :", -1, 8, 7, 258, 8 + LTEXT "Выберите тип устанавливаемого сетевого компонента:", -1, 8, 7, 258, 8 CONTROL "", 1251, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x0000C04D, 8, 20, 188, 58 GROUPBOX "", -1, 8, 81, 188, 30 LTEXT "", 1250, 12, 90, 177, 17 - DEFPUSHBUTTON "&...", 1252, 205, 20, 60, 14 - PUSHBUTTON "", 2, 205, 38, 60, 14 + DEFPUSHBUTTON "&Добавить...", 1252, 205, 20, 60, 14 + PUSHBUTTON "Отмена", 2, 205, 38, 60, 14 END 127 DIALOGEX 16, 20, 260, 135 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION " NetWare " +CAPTION "Подключения к NetWare или совместимой сети" FONT 8, "MS Shell Dlg" BEGIN ICON 32515, 1278, 7, 7, 21, 20, WS_GROUP - LTEXT " NetWare- PPP IPX.", 1279, 42, 7, 215, 37 - LTEXT " , , , IPX .", 1280, 42, 46, 215, 38, NOT WS_GROUP - AUTOCHECKBOX "& ", 1277, 42, 86, 215, 10, BS_TOP | BS_MULTILINE | WS_GROUP + LTEXT "Открытые подключения к NetWare-совместимой сети будут закрыты при установке связи PPP IPX.", 1279, 42, 7, 215, 37 + LTEXT "Чтобы избежать потери данных, закройте перед вызовом все файлы, использующие эти подключения, либо снимите флажок IPX в окне настройки сетевого протокола для этого элемента.", 1280, 42, 46, 215, 38, NOT WS_GROUP + AUTOCHECKBOX "&Не выводить более это сообщение", 1277, 42, 86, 215, 10, BS_TOP | BS_MULTILINE | WS_GROUP DEFPUSHBUTTON "OK", 1, 65, 112, 60, 14, WS_GROUP - PUSHBUTTON "", 2, 134, 112, 60, 14 + PUSHBUTTON "Отмена", 2, 134, 112, 60, 14 END 128 DIALOGEX 7, 22, 236, 90 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION " " +CAPTION "Набор номера вручную" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ( ). """". , .", 1281, 8, 8, 219, 32 - LTEXT " :", 1282, 8, 46, 91, 8 + LTEXT "Снимите трубку и наберите номер (или попросите это сделать оператора). После набора сразу же нажмите кнопку ""ОК"". Подождите отключения сигнала в трубке, затем положите ее на рычаг.", 1281, 8, 8, 219, 32 + LTEXT "Номер телефона:", 1282, 8, 46, 91, 8 LTEXT "", 1283, 103, 46, 126, 8, NOT WS_GROUP DEFPUSHBUTTON "OK", 1, 104, 70, 60, 14, WS_GROUP - PUSHBUTTON "", 2, 168, 70, 60, 14 + PUSHBUTTON "Отмена", 2, 168, 70, 60, 14 END 129 DIALOGEX 6, 20, 260, 85 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION " " +CAPTION "Результат подключения сетевых протоколов" FONT 8, "MS Shell Dlg" BEGIN ICON 32516, 1328, 7, 7, 21, 20, WS_GROUP LTEXT "", 1329, 38, 7, 216, 24, NOT WS_GROUP - AUTOCHECKBOX "& ", 1327, 40, 44, 215, 10, BS_TOP | BS_MULTILINE | WS_GROUP - PUSHBUTTON "&", 1, 129, 64, 60, 14 - PUSHBUTTON "&", 2, 193, 64, 60, 14 + AUTOCHECKBOX "&Не запрашивать более протоколы с ошибками", 1327, 40, 44, 215, 10, BS_TOP | BS_MULTILINE | WS_GROUP + PUSHBUTTON "&Принять", 1, 129, 64, 60, 14 + PUSHBUTTON "&Завершить", 2, 193, 64, 60, 14 END 133 DIALOGEX 6, 18, 231, 211 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION " X.25" +CAPTION "Параметры входа в сеть X.25" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " X.25 X.121 :", 1408, 7, 4, 220, 27 - LTEXT "&:", 1410, 9, 35, 213, 8, NOT WS_GROUP + LTEXT "Выберите службу доступа к сети по протоколу X.25 и введите адрес X.121 удаленного сервера:", 1408, 7, 4, 220, 27 + LTEXT "&Сеть:", 1410, 9, 35, 213, 8, NOT WS_GROUP COMBOBOX 1406, 9, 46, 215, 125, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | NOT WS_TABSTOP - LTEXT "& X.121:", 1407, 9, 66, 213, 8, NOT WS_GROUP + LTEXT "&Адрес X.121:", 1407, 9, 66, 213, 8, NOT WS_GROUP EDITTEXT 1402, 8, 77, 215, 14, ES_AUTOHSCROLL - GROUPBOX "", 1405, 8, 95, 215, 79 - LTEXT "& :", 1411, 19, 109, 182, 8, NOT WS_GROUP + GROUPBOX "Дополнительно", 1405, 8, 95, 215, 79 + LTEXT "&Данные пользователя:", 1411, 19, 109, 182, 8, NOT WS_GROUP EDITTEXT 1404, 19, 120, 193, 14, ES_AUTOHSCROLL - LTEXT "&:", 1409, 19, 138, 182, 8, NOT WS_GROUP + LTEXT "&Услуги:", 1409, 19, 138, 182, 8, NOT WS_GROUP EDITTEXT 1403, 19, 149, 193, 14, ES_AUTOHSCROLL DEFPUSHBUTTON "OK", 1, 100, 189, 60, 14 - PUSHBUTTON "", 2, 164, 189, 60, 14 + PUSHBUTTON "Отмена", 2, 164, 189, 60, 14 END 146 DIALOGEX 6, 18, 230, 210 STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE | WS_CAPTION -CAPTION " " +CAPTION "Автонабор номера" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " , .", -1, 7, 4, 219, 32 - LTEXT "& :", 1006, 8, 42, 213, 8 + LTEXT "Если подключение к сети окажется разорванным, то будет произведен автонабор номера при любой попытке доступа к сетевым данным.", -1, 7, 4, 219, 32 + LTEXT "В&ключить автонабор номера для:", 1006, 8, 42, 213, 8 CONTROL "", 1004, "SYSLISTVIEW32", WS_BORDER | WS_GROUP | WS_TABSTOP | 0x0000C401, 7, 53, 216, 109 - AUTOCHECKBOX "& ", 1496, 8, 170, 218, 9, BS_TOP | BS_MULTILINE - AUTOCHECKBOX "& ReactOS", 1550, 8, 185, 217, 9, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Запрашивать подтверждение на автонабор номера", 1496, 8, 170, 218, 9, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Отключить автонабор до моего выхода из ReactOS", 1550, 8, 185, 217, 9, BS_TOP | BS_MULTILINE END 147 DIALOGEX 6, 18, 230, 215 STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE | WS_CAPTION -CAPTION " " +CAPTION "Набор номера" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " Ctrl+Alt+Delete. .", 1007, 7, 4, 221, 40, NOT WS_GROUP - LTEXT "& :", 1005, 7, 55, 154, 8 + LTEXT "Параметры входа в систему через телефонное подключение после нажатия клавиш Ctrl+Alt+Delete. Доступ к этой вкладке предоставлен вам как администратору.", 1007, 7, 4, 221, 40, NOT WS_GROUP + LTEXT "&Число повторений набора номера:", 1005, 7, 55, 154, 8 EDITTEXT 1001, 164, 52, 60, 14, ES_AUTOHSCROLL - LTEXT "& ():", 1009, 7, 73, 156, 8, NOT WS_GROUP + LTEXT "&Интервал между повторениями (с):", 1009, 7, 73, 156, 8, NOT WS_GROUP EDITTEXT 1003, 164, 70, 60, 14, ES_AUTOHSCROLL - LTEXT "& ():", 1008, 7, 91, 154, 8, NOT WS_GROUP + LTEXT "&Время простоя до разъединения (с):", 1008, 7, 91, 154, 8, NOT WS_GROUP EDITTEXT 1002, 164, 88, 60, 14, ES_AUTOHSCROLL END 148 DIALOGEX 6, 18, 230, 215 STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE | WS_CAPTION -CAPTION " " +CAPTION "Ответный вызов сервера" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " . ? ( VPN-)", 1043, 8, 4, 219, 43 - AUTORADIOBUTTON "& ", 1041, 7, 48, 219, 10, BS_TOP | BS_MULTILINE | WS_GROUP - AUTORADIOBUTTON "&. ", 1040, 7, 61, 219, 10, BS_TOP | BS_MULTILINE - AUTORADIOBUTTON "& :", 1042, 7, 74, 219, 10, BS_TOP | BS_MULTILINE + LTEXT "При коммутируемом подключении к серверу он может сделать ответный вызов для сокращения ваших телефонных расходов. Использовать ответный вызов? (Ответный вызов не поддерживается для VPN-подключений)", 1043, 8, 4, 219, 43 + AUTORADIOBUTTON "Ответ&ный вызов не выполняется", 1041, 7, 48, 219, 10, BS_TOP | BS_MULTILINE | WS_GROUP + AUTORADIOBUTTON "&Иногда. Выдавать запрос при подключении к серверу", 1040, 7, 61, 219, 10, BS_TOP | BS_MULTILINE + AUTORADIOBUTTON "&Всегда выполнять ответный вызов по указанным номерам:", 1042, 7, 74, 219, 10, BS_TOP | BS_MULTILINE CONTROL "", 1037, "SYSLISTVIEW32", WS_BORDER | WS_GROUP | WS_TABSTOP | 0x00008401, 16, 88, 204, 94 - PUSHBUTTON "&...", 1039, 96, 190, 60, 14 - PUSHBUTTON "&", 1038, 159, 190, 60, 14 + PUSHBUTTON "И&зменить...", 1039, 96, 190, 60, 14 + PUSHBUTTON "&Удалить", 1038, 159, 190, 60, 14 END 149 DIALOGEX 6, 18, 317, 142 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT " , . .", 1094, 8, 5, 307, 35 - LTEXT "& :", 1078, 8, 47, 124, 8, NOT WS_GROUP + LTEXT "Необходимо задать учетные данные входящего подключения, которые будут использоваться удаленными маршрутизаторами для подключения к этому интерфейсу. На этом маршрутизаторе будет создана учетная запись с введенными данными.", 1094, 8, 5, 307, 35 + LTEXT "&Имя пользователя:", 1078, 8, 47, 124, 8, NOT WS_GROUP EDITTEXT 1074, 135, 45, 175, 12, ES_AUTOHSCROLL | WS_DISABLED - LTEXT "&:", 1077, 8, 68, 124, 8, NOT WS_GROUP + LTEXT "П&ароль:", 1077, 8, 68, 124, 8, NOT WS_GROUP EDITTEXT 1073, 135, 66, 175, 12, ES_PASSWORD | ES_AUTOHSCROLL - LTEXT "&:", 1075, 8, 90, 124, 8, NOT WS_GROUP + LTEXT "П&одтверждение:", 1075, 8, 90, 124, 8, NOT WS_GROUP EDITTEXT 1071, 135, 87, 175, 12, ES_PASSWORD | ES_AUTOHSCROLL END @@ -510,14 +510,14 @@ END STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT " , . .", 1094, 8, 5, 308, 33 - LTEXT "& :", 1096, 8, 43, 130, 8, NOT WS_GROUP + LTEXT "Необходимо задать учетные данные исходящего подключения, которые будут использоваться интерфейсом для подключения к удаленному маршрутизатору. Эти учетные данные должны соответствовать учетным данным входящего подключения на этом удаленном маршрутизаторе.", 1094, 8, 5, 308, 33 + LTEXT "&Имя пользователя:", 1096, 8, 43, 130, 8, NOT WS_GROUP EDITTEXT 1091, 140, 40, 175, 12, ES_AUTOHSCROLL - LTEXT "&:", 1093, 8, 63, 130, 8, NOT WS_GROUP + LTEXT "&Домен:", 1093, 8, 63, 130, 8, NOT WS_GROUP EDITTEXT 1089, 140, 60, 175, 12, ES_UPPERCASE | ES_AUTOHSCROLL - LTEXT "&:", 1095, 8, 81, 130, 8, NOT WS_GROUP + LTEXT "П&ароль:", 1095, 8, 81, 130, 8, NOT WS_GROUP EDITTEXT 1090, 140, 78, 175, 12, ES_PASSWORD | ES_AUTOHSCROLL - LTEXT "&:", 1092, 8, 99, 130, 8, NOT WS_GROUP + LTEXT "П&одтверждение:", 1092, 8, 99, 130, 8, NOT WS_GROUP EDITTEXT 1088, 140, 96, 175, 12, ES_PASSWORD | ES_AUTOHSCROLL END @@ -525,140 +525,140 @@ END STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT " :", -1, 8, 4, 190, 8 + LTEXT "Введите название для этого подключения:", -1, 8, 4, 190, 8 EDITTEXT 1114, 8, 17, 190, 12, ES_AUTOHSCROLL - LTEXT " """" .", -1, 8, 38, 193, 20 - LTEXT " """" """".", -1, 8, 58, 193, 16 + LTEXT "Нажмите кнопку ""Готово"" для сохранения значка подключения в папке сетевых подключений.", -1, 8, 38, 193, 20 + LTEXT "Для изменения свойств подключения выберите в меню ""Файл"" команду ""Свойства"".", -1, 8, 58, 193, 16 END 155 DIALOGEX 0, 0, 231, 215 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION -CAPTION "" +CAPTION "Общие" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "& :", 1124, 7, 5, 219, 8 + LTEXT "Подкл&ючаться через:", 1124, 7, 5, 219, 8 CONTROL "", 1128, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x00004C0D, 7, 17, 198, 44, WS_EX_CLIENTEDGE - PUSHBUTTON "&", 1132, 210, 18, 16, 14, BS_ICON - PUSHBUTTON "&", 1131, 210, 36, 16, 14, BS_ICON - AUTOCHECKBOX "& ", 1119, 9, 66, 133, 18, BS_TOP | BS_MULTILINE - PUSHBUTTON "&...", 1130, 144, 66, 60, 14 - GROUPBOX "", 1125, 8, 84, 215, 100, WS_GROUP - LTEXT "& :", 1133, 17, 102, 52, 8 + PUSHBUTTON "&Вверх", 1132, 210, 18, 16, 14, BS_ICON + PUSHBUTTON "В&низ", 1131, 210, 36, 16, 14, BS_ICON + AUTOCHECKBOX "О&бщие номера для подключения всех устройств", 1119, 9, 66, 133, 18, BS_TOP | BS_MULTILINE + PUSHBUTTON "Н&астроить...", 1130, 144, 66, 60, 14 + GROUPBOX "Образец", 1125, 8, 84, 215, 100, WS_GROUP + LTEXT "&Код города:", 1133, 17, 102, 52, 8 COMBOBOX 1122, 17, 112, 52, 110, CBS_DROPDOWN | WS_VSCROLL | NOT WS_TABSTOP - LTEXT " &:", 1135, 71, 102, 139, 8 + LTEXT "Номер &телефона:", 1135, 71, 102, 139, 8 EDITTEXT 1123, 73, 112, 79, 14, ES_AUTOHSCROLL - PUSHBUTTON "&", 1129, 154, 112, 60, 14 - LTEXT "& :", 1134, 17, 132, 197, 8 + PUSHBUTTON "&Другие", 1129, 154, 112, 60, 14 + LTEXT "К&од страны или региона:", 1134, 17, 132, 197, 8 COMBOBOX 1126, 17, 143, 193, 130, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | NOT WS_TABSTOP - AUTOCHECKBOX "& ", 1121, 17, 163, 132, 17, BS_TOP | BS_MULTILINE - PUSHBUTTON "&", 1136, 151, 161, 60, 14 - AUTOCHECKBOX " & ", 1120, 10, 192, 214, 19, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Использовать правила набора номера", 1121, 17, 163, 132, 17, BS_TOP | BS_MULTILINE + PUSHBUTTON "&Правила", 1136, 151, 161, 60, 14 + AUTOCHECKBOX "При подключении в&ывести значок в области уведомлений", 1120, 10, 192, 214, 19, BS_TOP | BS_MULTILINE END 156 DIALOGEX 0, 0, 231, 215 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION -CAPTION "" +CAPTION "Общие" FONT 8, "MS Shell Dlg" BEGIN - PUSHBUTTON "&...", 1130, 164, 38, 60, 14 - GROUPBOX "", 1125, 8, 55, 217, 100, WS_GROUP - LTEXT "& :", 1133, 17, 72, 48, 8 + PUSHBUTTON "Н&астроить...", 1130, 164, 38, 60, 14 + GROUPBOX "Образец", 1125, 8, 55, 217, 100, WS_GROUP + LTEXT "&Код города:", 1133, 17, 72, 48, 8 COMBOBOX 1122, 17, 83, 48, 119, CBS_DROPDOWN | WS_VSCROLL | NOT WS_TABSTOP - LTEXT "& :", 1135, 71, 72, 146, 8 + LTEXT "&Номер телефона:", 1135, 71, 72, 146, 8 EDITTEXT 1123, 71, 83, 81, 14, ES_AUTOHSCROLL - PUSHBUTTON "&", 1129, 155, 83, 63, 14 - LTEXT "& :", 1134, 17, 103, 193, 8 + PUSHBUTTON "&Другие", 1129, 155, 83, 63, 14 + LTEXT "К&од страны или региона:", 1134, 17, 103, 193, 8 COMBOBOX 1126, 17, 114, 201, 130, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | NOT WS_TABSTOP - AUTOCHECKBOX "& ", 1121, 19, 134, 136, 17, BS_TOP | BS_MULTILINE - PUSHBUTTON "&", 1136, 157, 132, 60, 14 - AUTOCHECKBOX " & ", 1120, 12, 164, 209, 18, BS_TOP | BS_MULTILINE - LTEXT " :", 1124, 8, 5, 217, 8 + AUTOCHECKBOX "&Использовать правила набора номера", 1121, 19, 134, 136, 17, BS_TOP | BS_MULTILINE + PUSHBUTTON "&Правила", 1136, 157, 132, 60, 14 + AUTOCHECKBOX "При подключении в&ывести значок в области уведомлений", 1120, 12, 164, 209, 18, BS_TOP | BS_MULTILINE + LTEXT "Подключаться через:", 1124, 8, 5, 217, 8 CONTROL "", 1127, "SYSLISTVIEW32", WS_DISABLED | WS_BORDER | 0x0000EC0D, 7, 18, 217, 15 END 157 DIALOGEX 6, 18, 268, 160 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION "" +CAPTION "Оформление" FONT 8, "MS Shell Dlg" BEGIN - AUTOCHECKBOX "& ", 1142, 8, 10, 256, 10, WS_GROUP - AUTOCHECKBOX "& ", 1139, 8, 27, 256, 10 - AUTOCHECKBOX "& ", 1140, 21, 43, 245, 10 - AUTOCHECKBOX "& ", 1143, 8, 59, 256, 10 - AUTOCHECKBOX "& ", 1137, 8, 76, 256, 10 - AUTOCHECKBOX "& ", 1141, 8, 94, 256, 10 - AUTOCHECKBOX "& ", 1144, 22, 111, 245, 10 + AUTOCHECKBOX "&Просматривать телефонные номера перед набором номера", 1142, 8, 10, 256, 10, WS_GROUP + AUTOCHECKBOX "&Отображать сведения о месте вызова перед набором номера", 1139, 8, 27, 256, 10 + AUTOCHECKBOX "&Разрешить изменения места вызова во время входа в систему", 1140, 21, 43, 245, 10 + AUTOCHECKBOX "О&тображать состояние подключения при установке связи", 1143, 8, 59, 256, 10 + AUTOCHECKBOX "&Закрыть после установки связи", 1137, 8, 76, 256, 10 + AUTOCHECKBOX "Р&азрешить изменения телефонной книги во время входа в систему", 1141, 8, 94, 256, 10 + AUTOCHECKBOX "&Использовать мастера для создания записей в телефонной книге", 1144, 22, 111, 245, 10 END 158 DIALOGEX 6, 18, 268, 160 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION "" +CAPTION "Оформление" FONT 8, "MS Shell Dlg" BEGIN - AUTOCHECKBOX "& ", 1142, 8, 10, 256, 10, WS_GROUP - AUTOCHECKBOX "& ", 1139, 8, 27, 256, 10 - AUTOCHECKBOX "& ", 1138, 8, 44, 256, 10 - AUTOCHECKBOX "& ", 1143, 8, 61, 256, 10 - AUTOCHECKBOX "& ", 1137, 8, 79, 256, 10 - AUTOCHECKBOX "& ", 1144, 8, 97, 256, 10 - AUTOCHECKBOX "& ", 1136, 8, 114, 256, 10 + AUTOCHECKBOX "&Просматривать телефонные номера перед набором номера", 1142, 8, 10, 256, 10, WS_GROUP + AUTOCHECKBOX "&Отображать сведения о месте вызова перед набором номера", 1139, 8, 27, 256, 10 + AUTOCHECKBOX "&Запускать монитор удаленного доступа к сети перед набором номера", 1138, 8, 44, 256, 10 + AUTOCHECKBOX "О&тображать состояние подключения при установке связи", 1143, 8, 61, 256, 10 + AUTOCHECKBOX "З&акрыть после установки связи", 1137, 8, 79, 256, 10 + AUTOCHECKBOX "&Использовать мастера для создания записей в телефонной книге", 1144, 8, 97, 256, 10 + AUTOCHECKBOX "&Всегда выводить приглашение перед автонабором номера", 1136, 8, 114, 256, 10 END 160 DIALOGEX 6, 18, 320, 145 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_CHILD | WS_VISIBLE | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT " . , .", 1158, 7, 5, 309, 29 - LTEXT "& :", 1159, 17, 41, 285, 8, NOT WS_GROUP + LTEXT "Выберите имя для интерфейса вызова по требованию. Общепринятой практикой является присвоение имен интерфейсам после имен сети или маршрутизатора, к которым они подключены.", 1158, 7, 5, 309, 29 + LTEXT "&Имя интерфейса:", 1159, 17, 41, 285, 8, NOT WS_GROUP EDITTEXT 1157, 17, 53, 284, 12, ES_AUTOHSCROLL - AUTOCHECKBOX " , & ", 1156, 24, 100, 258, 31, BS_TOP | BS_MULTILINE | NOT WS_VISIBLE | WS_DISABLED + AUTOCHECKBOX "Мне хорошо знакомы интерфейсы вызова по требованию, &я хочу перейти к настройке параметров вручную", 1156, 24, 100, 258, 31, BS_TOP | BS_MULTILINE | NOT WS_VISIBLE | WS_DISABLED END 162 DIALOGEX 0, 0, 230, 215 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION "" +CAPTION "Безопасность" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ", 1580, 8, 3, 215, 139 - AUTORADIOBUTTON "& ( )", 1540, 14, 16, 201, 9, BS_NOTIFY | WS_GROUP - AUTORADIOBUTTON "& ( )", 1541, 14, 102, 198, 8, BS_NOTIFY - LTEXT "& :", 1537, 26, 29, 187, 8, NOT WS_GROUP + GROUPBOX "Параметры безопасности", 1580, 8, 3, 215, 139 + AUTORADIOBUTTON "Об&ычные (рекомендуемые параметры)", 1540, 14, 16, 201, 9, BS_NOTIFY | WS_GROUP + AUTORADIOBUTTON "&Дополнительные (выборочные параметры)", 1541, 14, 102, 198, 8, BS_NOTIFY + LTEXT "&При проверке используется:", 1537, 26, 29, 187, 8, NOT WS_GROUP COMBOBOX 1178, 26, 40, 184, 78, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | NOT WS_TABSTOP - AUTOCHECKBOX "& ReactOS ( , )", 1174, 26, 58, 184, 20, BS_TOP | BS_MULTILINE - AUTOCHECKBOX "& ( )", 1169, 26, 82, 191, 10, BS_TOP | BS_MULTILINE - LTEXT " .", 1539, 15, 114, 134, 25 - PUSHBUTTON "&...", 1180, 151, 115, 60, 14 - GROUPBOX " ", 1177, 8, 146, 215, 62, WS_GROUP - AUTOCHECKBOX "& ", 1173, 14, 159, 198, 11, BS_TOP | BS_MULTILINE - AUTOCHECKBOX "&:", 1172, 14, 172, 57, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Использовать автоматически имя входа и пароль из ReactOS (и имя домена, если существует)", 1174, 26, 58, 184, 20, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Тре&буется шифрование данных (иначе отключаться)", 1169, 26, 82, 191, 10, BS_TOP | BS_MULTILINE + LTEXT "Применение этих параметров требует знания протоколов обеспечения безопасности.", 1539, 15, 114, 134, 25 + PUSHBUTTON "Парам&етры...", 1180, 151, 115, 60, 14 + GROUPBOX "Интерактивная регистрация и сценарий", 1177, 8, 146, 215, 62, WS_GROUP + AUTOCHECKBOX "&Вывести окно терминала", 1173, 14, 159, 198, 11, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Сценарий:", 1172, 14, 172, 57, 10, BS_TOP | BS_MULTILINE COMBOBOX 1179, 72, 171, 140, 104, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | NOT WS_TABSTOP - PUSHBUTTON "&...", 1182, 87, 187, 60, 14 - PUSHBUTTON "&...", 1181, 151, 187, 60, 14 + PUSHBUTTON "И&зменить...", 1182, 87, 187, 60, 14 + PUSHBUTTON "&Обзор...", 1181, 151, 187, 60, 14 END 163 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT " .", -1, 6, 3, 307, 13 - LTEXT "& :", -1, 6, 15, 307, 11 + LTEXT "На этом компьютере имеется более одного устройства удаленного доступа к сети.", -1, 6, 3, 307, 13 + LTEXT "&Выберите устройства для данного подключения:", -1, 6, 15, 307, 11 CONTROL "", 1228, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x0000C415, 7, 28, 304, 77 END 165 DIALOGEX 0, 0, 230, 215 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "" +CAPTION "Сеть" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "& :", 1583, 7, 4, 219, 8 + LTEXT "&Тип подключаемого сервера удаленного доступа:", 1583, 7, 4, 219, 8 COMBOBOX 1418, 7, 17, 215, 46, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - PUSHBUTTON "&", 1419, 160, 35, 60, 14 - LTEXT ", & :", 1684, 8, 64, 219, 10 + PUSHBUTTON "&Параметры", 1419, 160, 35, 60, 14 + LTEXT "Компоненты, &используемые этим подключением:", 1684, 8, 64, 219, 10 CONTROL "", 1251, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x0000C40D, 7, 75, 216, 53 - PUSHBUTTON "&...", 1252, 7, 133, 67, 14 - PUSHBUTTON "&", 1254, 80, 133, 67, 14 - PUSHBUTTON "&", 1253, 153, 133, 67, 14 - GROUPBOX "", 1585, 9, 158, 213, 43 + PUSHBUTTON "&Установить...", 1252, 7, 133, 67, 14 + PUSHBUTTON "Уда&лить", 1254, 80, 133, 67, 14 + PUSHBUTTON "Сво&йства", 1253, 153, 133, 67, 14 + GROUPBOX "Описание", 1585, 9, 158, 213, 43 LTEXT "", 1250, 18, 167, 195, 25 END @@ -666,118 +666,118 @@ END STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT " IP- DNS WINS (0.0.0.0), , .", 1275, 7, 2, 311, 25 - LTEXT "DNS-&:", 1274, 7, 29, 160, 8, NOT WS_GROUP + LTEXT "Введите IP-адреса серверов DNS и WINS удаленной сети или оставьте их нулевыми (0.0.0.0), если ожидается, что их предоставит удаленный маршрутизатор или если вы не знаете этих адресов.", 1275, 7, 2, 311, 25 + LTEXT "DNS-с&ервер:", 1274, 7, 29, 160, 8, NOT WS_GROUP CONTROL "", 1272, "RASIPADDRESS", WS_TABSTOP, 21, 41, 85, 12 - LTEXT "WINS-&:", 1276, 7, 65, 166, 8, NOT WS_GROUP + LTEXT "WINS-&сервер:", 1276, 7, 65, 166, 8, NOT WS_GROUP CONTROL "", 1273, "RASIPADDRESS", WS_TABSTOP, 21, 77, 85, 12 END 167 DIALOGEX 0, 0, 230, 215 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION "" +CAPTION "Параметры" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ", 1289, 7, 2, 213, 64 - AUTOCHECKBOX "& ", 1284, 16, 14, 201, 10 - AUTOCHECKBOX "& , , ..", 1554, 16, 27, 201, 10 - AUTOCHECKBOX "& ReactOS", 1555, 16, 39, 201, 10 - AUTOCHECKBOX "& ", 1285, 16, 52, 200, 10, BS_TOP | BS_MULTILINE - GROUPBOX " ", 1290, 6, 72, 213, 79 - LTEXT "& :", 1300, 16, 87, 123, 8 + GROUPBOX "Параметры набора номера", 1289, 7, 2, 213, 64 + AUTOCHECKBOX "&Отображать ход подключения", 1284, 16, 14, 201, 10 + AUTOCHECKBOX "&Запрашивать имя, пароль, сертификат и т.д.", 1554, 16, 27, 201, 10 + AUTOCHECKBOX "Вкл&ючать домен входа в ReactOS", 1555, 16, 39, 201, 10 + AUTOCHECKBOX "Запр&ашивать номер телефона", 1285, 16, 52, 200, 10, BS_TOP | BS_MULTILINE + GROUPBOX "Параметры повторного звонка", 1290, 6, 72, 213, 79 + LTEXT "&Число повторений набора номера:", 1300, 16, 87, 123, 8 EDITTEXT 1287, 141, 84, 69, 14, ES_AUTOHSCROLL | ES_NUMBER - LTEXT " & :", 1301, 16, 103, 123, 8 + LTEXT "Интервал ме&жду повторениями:", 1301, 16, 103, 123, 8 COMBOBOX 1292, 141, 101, 70, 123, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - LTEXT "& :", 1299, 16, 120, 123, 8 + LTEXT "&Время простоя до разъединения:", 1299, 16, 120, 123, 8 COMBOBOX 1291, 141, 116, 70, 108, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - AUTOCHECKBOX "& ", 1286, 16, 136, 199, 10, BS_TOP | BS_MULTILINE - GROUPBOX " ", 1288, 7, 156, 213, 32 + AUTOCHECKBOX "П&ерезвонить при разрыве связи", 1286, 16, 136, 199, 10, BS_TOP | BS_MULTILINE + GROUPBOX "Использование нескольких устройств", 1288, 7, 156, 213, 32 COMBOBOX 1551, 16, 169, 128, 45, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - PUSHBUTTON "&...", 1293, 150, 168, 60, 14 + PUSHBUTTON "&Настроить...", 1293, 150, 168, 60, 14 PUSHBUTTON "&X.25", 1295, 7, 194, 50, 14 - PUSHBUTTON "& ", 1294, 62, 194, 150, 14, NOT WS_VISIBLE | WS_DISABLED + PUSHBUTTON "В&иртуальное туннельное подключение", 1294, 62, 194, 150, 14, NOT WS_VISIBLE | WS_DISABLED END 168 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Мастер новых подключений" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " . ", -1, 7, 4, 306, 14 - LTEXT " &:", 1308, 7, 19, 130, 8 + LTEXT "Введите номер телефона. ", -1, 7, 4, 306, 14 + LTEXT "Номер &телефона:", 1308, 7, 19, 130, 8 EDITTEXT 1304, 7, 30, 304, 14, ES_AUTOHSCROLL - LTEXT " ""1"", . . , .", -1, 20, 50, 291, 53 + LTEXT "Возможно потребуется добавить ""1"", код региона или оба числа вместе. Для проверки наберите комбинацию номера и кода на своем телефоне. Комбинация подобрана правильно, если слышен звук модема.", -1, 20, 50, 291, 53 END 169 DIALOGEX 6, 18, 235, 135 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION " " +CAPTION "Телефонная книга" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " :", 1326, 8, 8, 222, 8 - AUTORADIOBUTTON "& ", 1325, 14, 22, 216, 10, WS_GROUP - AUTORADIOBUTTON "& ", 1324, 14, 34, 216, 10 - AUTORADIOBUTTON "& :", 1323, 14, 46, 217, 10 + LTEXT "Для хранения записей используется:", 1326, 8, 8, 222, 8 + AUTORADIOBUTTON "&Телефонная книга системы", 1325, 14, 22, 216, 10, WS_GROUP + AUTORADIOBUTTON "&Личная телефонная книга", 1324, 14, 34, 216, 10 + AUTORADIOBUTTON "&Дополнительная телефонная книга:", 1323, 14, 46, 217, 10 COMBOBOX 1321, 26, 61, 201, 77, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_GROUP | NOT WS_TABSTOP - PUSHBUTTON "&...", 1322, 167, 81, 60, 14 + PUSHBUTTON "&Обзор...", 1322, 167, 81, 60, 14 END 170 DIALOGEX 6, 18, 235, 135 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION " " +CAPTION "Телефонная книга" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " :", 1326, 8, 8, 223, 8 - AUTORADIOBUTTON "& ", 1325, 14, 22, 217, 10, WS_GROUP - AUTORADIOBUTTON "& :", 1323, 14, 36, 216, 10 + LTEXT "Для хранения записей используется:", 1326, 8, 8, 223, 8 + AUTORADIOBUTTON "&телефонная книга системы", 1325, 14, 22, 217, 10, WS_GROUP + AUTORADIOBUTTON "&дополнительная телефонная книга:", 1323, 14, 36, 216, 10 COMBOBOX 1321, 26, 51, 203, 77, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_GROUP | NOT WS_TABSTOP - PUSHBUTTON "&...", 1322, 169, 69, 60, 14 + PUSHBUTTON "&Обзор...", 1322, 169, 69, 60, 14 END 171 DIALOGEX 6, 18, 317, 144 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT " IP- (0.0.0.0), , . .", 1331, 5, 4, 308, 35 - LTEXT "& IP-:", 1332, 4, 51, 100, 8, NOT WS_GROUP + LTEXT "Введите IP-адрес этого маршрутизатора в удаленной сети или оставьте его нулевым (0.0.0.0), если ожидается, что этот адрес предоставит удаленный маршрутизатор. Обратитесь к оператору удаленной сети или маршрутизатора за необходимыми сведениями.", 1331, 5, 4, 308, 35 + LTEXT "&Мой IP-адрес:", 1332, 4, 51, 100, 8, NOT WS_GROUP CONTROL "", 1330, "RASIPADDRESS", WS_TABSTOP, 21, 62, 104, 12 - LTEXT ": , .", 1333, 5, 94, 306, 36, NOT WS_GROUP + LTEXT "Примечание: при наличии установленного сетевого адаптера НЕ СЛЕДУЕТ использовать тот же адрес, что у сетевого адаптера.", 1333, 5, 94, 306, 36, NOT WS_GROUP END 172 DIALOGEX 6, 18, 317, 144 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT " . - .", 1339, 5, 3, 309, 27 - AUTOCHECKBOX "& ", 1462, 15, 31, 162, 10 - AUTOCHECKBOX "&:", 1463, 15, 45, 58, 10 + LTEXT "Некоторые серверы удаленного доступа и маршрутизаторы при регистрации требуют ввода информации от пользователя. Вы можете использовать файлы-сценарии для автоматического ввода информации о вашей учетной записи.", 1339, 5, 3, 309, 27 + AUTOCHECKBOX "&Вывести окно терминала", 1462, 15, 31, 162, 10 + AUTOCHECKBOX "&Сценарий:", 1463, 15, 45, 58, 10 COMBOBOX 1334, 30, 60, 275, 88, CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | NOT WS_TABSTOP - PUSHBUTTON "&...", 1335, 180, 77, 60, 14 - PUSHBUTTON "&...", 1465, 244, 77, 60, 14 + PUSHBUTTON "&Изменить...", 1335, 180, 77, 60, 14 + PUSHBUTTON "&Обзор...", 1465, 244, 77, 60, 14 END 173 DIALOGEX 6, 18, 230, 215 STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE | WS_CAPTION -CAPTION " " +CAPTION "Набор номера" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ", 1344, 9, 4, 213, 53, WS_GROUP - LTEXT "& :", 1349, 16, 22, 140, 8, NOT WS_GROUP + GROUPBOX "Политика набора номера", 1344, 9, 4, 213, 53, WS_GROUP + LTEXT "&Число повторений набора номера:", 1349, 16, 22, 140, 8, NOT WS_GROUP EDITTEXT 1340, 158, 19, 56, 14, ES_AUTOHSCROLL - LTEXT "& ():", 1351, 16, 38, 140, 8, NOT WS_GROUP + LTEXT "&Интервал между повторениями (с):", 1351, 16, 38, 140, 8, NOT WS_GROUP EDITTEXT 1342, 158, 36, 56, 14, ES_AUTOHSCROLL - GROUPBOX " ", 1343, 9, 63, 213, 56, WS_GROUP - LTEXT "& ():", 1350, 28, 88, 124, 8, NOT WS_GROUP - AUTORADIOBUTTON "& ", 1347, 16, 78, 135, 10, WS_GROUP - AUTORADIOBUTTON "& ", 1348, 16, 103, 199, 10, NOT WS_TABSTOP, WS_EX_TRANSPARENT + GROUPBOX "Тип подключения", 1343, 9, 63, 213, 56, WS_GROUP + LTEXT "&Время простоя до разъединения (с):", 1350, 28, 88, 124, 8, NOT WS_GROUP + AUTORADIOBUTTON "Под&ключение по требованию", 1347, 16, 78, 135, 10, WS_GROUP + AUTORADIOBUTTON "&Постоянное подключение", 1348, 16, 103, 199, 10, NOT WS_TABSTOP, WS_EX_TRANSPARENT EDITTEXT 1341, 159, 85, 56, 14, ES_AUTOHSCROLL - PUSHBUTTON "& ...", 1345, 140, 125, 80, 14, WS_GROUP - PUSHBUTTON "& ...", 1346, 55, 125, 80, 14 + PUSHBUTTON "&Ответный вызов...", 1345, 140, 125, 80, 14, WS_GROUP + PUSHBUTTON "&Несколько линий...", 1346, 55, 125, 80, 14 END 174 DIALOGEX 0, 0, 215, 226 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "" +CAPTION "Маршрутизатор" FONT 8, "MS Shell Dlg" BEGIN CTEXT "NYI...need spec from KCrocker", -1, 57, 86, 106, 28 @@ -787,74 +787,74 @@ END STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT " .", 1352, 122, 5, 192, 32 - LTEXT " """".", 1354, 122, 41, 192, 26, NOT WS_GROUP - LTEXT " , """".", 1355, 122, 68, 190, 39, NOT WS_GROUP + LTEXT "Работа мастера интерфейса вызова по требованию успешно завершена.", 1352, 122, 5, 192, 32 + LTEXT "Для создания этого интерфейса и подключения его к маршрутизатору нажмите кнопку ""Готово"".", 1354, 122, 41, 192, 26, NOT WS_GROUP + LTEXT "Чтобы изменить этот интерфейс, с помощью диспетчера маршрутизации и удаленного доступа выберите его среди интерфейсов маршрутизатора и нажмите кнопку ""Свойства"".", 1355, 122, 68, 190, 39, NOT WS_GROUP END 179 DIALOGEX 6, 18, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT "& .", 1356, 7, 4, 306, 11 + LTEXT "&Выберите используемый модем или адаптер.", 1356, 7, 4, 306, 11 CONTROL "", 1355, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x0000C415, 6, 15, 305, 80 - LTEXT " , .", 1357, 15, 98, 288, 37, NOT WS_GROUP + LTEXT "В этом списке перечислены устройства, выбранные для маршрутизации.", 1357, 15, 98, 288, 37, NOT WS_GROUP END 180 DIALOGEX 6, 18, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT " . , , .", 1360, 7, 4, 305, 42 - LTEXT "& :", 1361, 7, 50, 275, 8, NOT WS_GROUP + LTEXT "Введите номер телефона сервера удаленного доступа или маршрутизатора. Если этот номер окажется недоступен, то будут сделаны попытки доступа по дополнительным номерам, если таковые существуют.", 1360, 7, 4, 305, 42 + LTEXT "&Номер телефона или адрес:", 1361, 7, 50, 275, 8, NOT WS_GROUP EDITTEXT 1358, 7, 62, 304, 14, ES_AUTOHSCROLL - PUSHBUTTON "...", 1359, 240, 80, 70, 14 + PUSHBUTTON "Дополнительно...", 1359, 240, 80, 70, 14 END 181 DIALOGEX 6, 18, 230, 215 STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE | WS_CAPTION -CAPTION "" +CAPTION "Безопасность" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ", 1367, 6, 8, 216, 103, WS_GROUP - AUTORADIOBUTTON "& ( )", 1370, 16, 20, 204, 10, BS_TOP | BS_MULTILINE - AUTORADIOBUTTON "& ", 1373, 16, 36, 195, 10, BS_TOP | BS_MULTILINE - AUTORADIOBUTTON "& MS ", 1374, 16, 52, 195, 10, BS_TOP | BS_MULTILINE - AUTOCHECKBOX "& ", 1363, 27, 65, 184, 10, BS_TOP | BS_MULTILINE | WS_GROUP - AUTOCHECKBOX "& ", 1364, 41, 80, 172, 10, BS_TOP | BS_MULTILINE - AUTOCHECKBOX "& ", 1362, 17, 95, 194, 10, BS_TOP | BS_MULTILINE - PUSHBUTTON "& ", 1369, 19, 117, 120, 14, WS_GROUP - PUSHBUTTON "&...", 1368, 142, 117, 80, 14, NOT WS_VISIBLE | WS_DISABLED - AUTOCHECKBOX "& ", 1365, 7, 198, 218, 10, BS_TOP | BS_MULTILINE | NOT WS_VISIBLE | WS_DISABLED + GROUPBOX "Политика проверки подлинности и шифрования", 1367, 6, 8, 216, 103, WS_GROUP + AUTORADIOBUTTON "До&пустимы незашифрованные пароли (обычный текст)", 1370, 16, 20, 204, 10, BS_TOP | BS_MULTILINE + AUTORADIOBUTTON "Тре&бовать шифрование паролей", 1373, 16, 36, 195, 10, BS_TOP | BS_MULTILINE + AUTORADIOBUTTON "Тр&ебовать шифрование MS для паролей", 1374, 16, 52, 195, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Требовать шифрование данных", 1363, 27, 65, 184, 10, BS_TOP | BS_MULTILINE | WS_GROUP + AUTOCHECKBOX "Требоват&ь стойкое шифрование данных", 1364, 41, 80, 172, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Д&вусторонняя проверка подлинности", 1362, 17, 95, 194, 10, BS_TOP | BS_MULTILINE + PUSHBUTTON "&Стереть сохраненный пароль", 1369, 19, 117, 120, 14, WS_GROUP + PUSHBUTTON "&Дополнительно...", 1368, 142, 117, 80, 14, NOT WS_VISIBLE | WS_DISABLED + AUTOCHECKBOX "&Определять общие файлы и принтеры до установки связи", 1365, 7, 198, 218, 10, BS_TOP | BS_MULTILINE | NOT WS_VISIBLE | WS_DISABLED END 182 DIALOGEX 6, 18, 248, 148 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION "" +CAPTION "Безопасность" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ", 1367, 7, 8, 216, 98, WS_GROUP - AUTORADIOBUTTON "& ( )", 1370, 14, 24, 206, 10 - AUTORADIOBUTTON "& ", 1373, 14, 39, 183, 10 - AUTORADIOBUTTON "& MS ", 1374, 14, 53, 184, 10 - AUTOCHECKBOX "& ", 1363, 33, 67, 165, 10, WS_GROUP - AUTOCHECKBOX "& ", 1364, 48, 79, 152, 10 - AUTOCHECKBOX "& ", 1366, 31, 91, 165, 10 - PUSHBUTTON "& ", 1369, 6, 114, 120, 14, WS_GROUP - PUSHBUTTON "&...", 1368, 129, 114, 78, 14, NOT WS_VISIBLE | WS_DISABLED - AUTOCHECKBOX "& ", 1365, 14, 134, 225, 10, NOT WS_VISIBLE | WS_DISABLED + GROUPBOX "Политика проверки подлинности и шифрования", 1367, 7, 8, 216, 98, WS_GROUP + AUTORADIOBUTTON "До&пустимы незашифрованные пароли (обычный текст)", 1370, 14, 24, 206, 10 + AUTORADIOBUTTON "Тре&бовать шифрование паролей", 1373, 14, 39, 183, 10 + AUTORADIOBUTTON "Тр&ебовать шифрование MS для паролей", 1374, 14, 53, 184, 10 + AUTOCHECKBOX "&Требовать шифрования данных", 1363, 33, 67, 165, 10, WS_GROUP + AUTOCHECKBOX "Требоват&ь стойкое шифрование данных", 1364, 48, 79, 152, 10 + AUTOCHECKBOX "&Использовать текущие имя и пароль", 1366, 31, 91, 165, 10 + PUSHBUTTON "&Стереть сохраненный пароль", 1369, 6, 114, 120, 14, WS_GROUP + PUSHBUTTON "&Дополнительно...", 1368, 129, 114, 78, 14, NOT WS_VISIBLE | WS_DISABLED + AUTOCHECKBOX "&Определять общие файлы и принтеры до установки связи", 1365, 14, 134, 225, 10, NOT WS_VISIBLE | WS_DISABLED END 183 DIALOGEX 6, 18, 317, 144 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT " :", 1388, 7, 4, 296, 9 - AUTOCHECKBOX " & IP .", 1386, 20, 19, 285, 11, BS_LEFT | BS_TOP | BS_MULTILINE - AUTOCHECKBOX " & IPX .", 1387, 20, 35, 287, 11, BS_LEFT | BS_TOP | BS_MULTILINE - AUTOCHECKBOX "& .", 1382, 20, 52, 287, 11, BS_LEFT | BS_TOP | BS_MULTILINE - AUTOCHECKBOX "& , .", 1385, 20, 70, 287, 18, BS_LEFT | BS_TOP | BS_MULTILINE - AUTOCHECKBOX "& .", 1384, 20, 87, 289, 22, BS_LEFT | BS_TOP | BS_MULTILINE + LTEXT "Отметьте все применимые параметры:", 1388, 7, 4, 296, 9 + AUTOCHECKBOX "Перенаправлять &пакеты IP на этот интерфейс.", 1386, 20, 19, 285, 11, BS_LEFT | BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Перенаправлять п&акеты IPX на этот интерфейс.", 1387, 20, 35, 287, 11, BS_LEFT | BS_TOP | BS_MULTILINE + AUTOCHECKBOX "До&бавить учетную запись для входящих звонков удаленного маршрутизатора.", 1382, 20, 52, 287, 11, BS_LEFT | BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Использовать незашифрованный пароль, если это единственный способ подключения.", 1385, 20, 70, 287, 18, BS_LEFT | BS_TOP | BS_MULTILINE + AUTOCHECKBOX "И&спользовать сценарий для завершения подключения к удаленному маршрутизатору.", 1384, 20, 87, 289, 22, BS_LEFT | BS_TOP | BS_MULTILINE END 184 DIALOGEX 0, 0, 317, 143 @@ -865,202 +865,202 @@ END 186 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Мастер новых подключений" FONT 8, "MS Shell Dlg" BEGIN - LTEXT ", , , , .", -1, 7, 4, 306, 26 - LTEXT " :", -1, 14, 29, 288, 12 - AUTORADIOBUTTON " & ", 1400, 26, 40, 265, 10, BS_TOP | BS_MULTILINE | NOT WS_TABSTOP - AUTORADIOBUTTON " &", 1401, 26, 55, 265, 10, BS_TOP | BS_MULTILINE | NOT WS_TABSTOP + LTEXT "Подключение, которое создается только для вашего использования, сохраняется в профиле вашей учетной записи, и оно недоступно до тех пор, пока вы не выполнили вход в систему.", -1, 7, 4, 306, 26 + LTEXT "Создать это подключение:", -1, 14, 29, 288, 12 + AUTORADIOBUTTON "для в&сех пользователей", 1400, 26, 40, 265, 10, BS_TOP | BS_MULTILINE | NOT WS_TABSTOP + AUTORADIOBUTTON "только для мен&я", 1401, 26, 55, 265, 10, BS_TOP | BS_MULTILINE | NOT WS_TABSTOP END 498 DIALOGEX 12, 16, 215, 126 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION " %1" +CAPTION "Подключение к %1" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ReactOS , . .", 1396, 7, 6, 206, 36 - LTEXT "& :", 1399, 8, 51, 74, 8 + LTEXT "Системе ReactOS не удалось подключиться к сети, используя предоставленные пароль и имя пользователя. Повторите ввод пароля и имени пользователя.", 1396, 7, 6, 206, 36 + LTEXT "&Имя пользователя:", 1399, 8, 51, 74, 8 EDITTEXT 1394, 85, 46, 124, 14, ES_AUTOHSCROLL - LTEXT "&:", 1397, 8, 70, 74, 8, NOT WS_GROUP + LTEXT "П&ароль:", 1397, 8, 70, 74, 8, NOT WS_GROUP EDITTEXT 1393, 85, 64, 124, 14, ES_PASSWORD | ES_AUTOHSCROLL - AUTOCHECKBOX "& ", 1391, 66, 84, 143, 10 + AUTOCHECKBOX "С&охранить пароль", 1391, 66, 84, 143, 10 CONTROL "", 1398, "STATIC", SS_ETCHEDHORZ | WS_GROUP, 7, 98, 200, 1 DEFPUSHBUTTON "OK", 1, 81, 104, 60, 14, WS_GROUP - PUSHBUTTON "", 2, 145, 104, 60, 14 + PUSHBUTTON "Отмена", 2, 145, 104, 60, 14 END 500 DIALOGEX 12, 16, 215, 173 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION " %1" +CAPTION "Подключение к %1" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ReactOS , . .", 1396, 7, 6, 209, 26 - LTEXT "& :", 1399, 7, 72, 80, 8 + LTEXT "Системе ReactOS не удалось подключиться к сети, используя предоставленные пароль и имя пользователя. Повторите ввод пароля и имени пользователя.", 1396, 7, 6, 209, 26 + LTEXT "&Имя пользователя:", 1399, 7, 72, 80, 8 EDITTEXT 1394, 97, 69, 115, 14, ES_AUTOHSCROLL - LTEXT "&:", 1397, 7, 90, 45, 8, NOT WS_GROUP + LTEXT "П&ароль:", 1397, 7, 90, 45, 8, NOT WS_GROUP EDITTEXT 1393, 97, 87, 115, 14, ES_PASSWORD | ES_AUTOHSCROLL - LTEXT "&:", 1395, 7, 108, 53, 8, NOT WS_GROUP + LTEXT "&Домен:", 1395, 7, 108, 53, 8, NOT WS_GROUP EDITTEXT 1392, 97, 105, 115, 14, ES_UPPERCASE | ES_AUTOHSCROLL - AUTOCHECKBOX "& ", 1391, 85, 125, 123, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "С&охранить пароль", 1391, 85, 125, 123, 10, BS_TOP | BS_MULTILINE DEFPUSHBUTTON "OK", 1, 87, 146, 60, 14, WS_GROUP - PUSHBUTTON "", 2, 151, 146, 60, 14 + PUSHBUTTON "Отмена", 2, 151, 146, 60, 14 CONTROL "", 1398, "STATIC", SS_ETCHEDHORZ | WS_GROUP, 7, 140, 205, 1 - LTEXT " .\n( )", -1, 8, 38, 209, 26 + LTEXT "Поле имени домена можно заполнить или оставить пустым.\n(Имя домена не является необходимым для подключения к Интернет)", -1, 8, 38, 209, 26 END 502 DIALOGEX 20, 60, 215, 79 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION " PPP" +CAPTION "Параметры PPP" FONT 8, "MS Shell Dlg" BEGIN - AUTOCHECKBOX "& LCP", 1423, 9, 7, 200, 10, BS_TOP | BS_MULTILINE - AUTOCHECKBOX "& ", 1424, 9, 22, 201, 10, BS_TOP | BS_MULTILINE - AUTOCHECKBOX " & ", 1557, 9, 37, 202, 21, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Включить расширения LCP", 1423, 9, 7, 200, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Использовать программное сжатие данных", 1424, 9, 22, 201, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Согласовывать &многоканальное подключение для одноканальных подключений", 1557, 9, 37, 202, 21, BS_TOP | BS_MULTILINE DEFPUSHBUTTON "OK", 1, 82, 60, 60, 14 - PUSHBUTTON "", 2, 148, 60, 60, 14 + PUSHBUTTON "Отмена", 2, 148, 60, 60, 14 END 509 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION -CAPTION " " +CAPTION "Мастер новых подключений" FONT 8, "MS Shell Dlg" BEGIN - LTEXT ", :", -1, 10, 5, 275, 9 - AUTORADIOBUTTON "& ", 1483, 31, 20, 265, 10, BS_TOP | BS_MULTILINE | WS_GROUP - AUTORADIOBUTTON "& ", 1484, 31, 50, 265, 10, BS_TOP | BS_MULTILINE - LTEXT " , .", -1, 45, 31, 253, 19, NOT WS_GROUP | WS_TABSTOP - LTEXT " , .", -1, 45, 61, 253, 23, NOT WS_GROUP + LTEXT "Выберите, в какой роли будет обычно выступать этот компьютер:", -1, 10, 5, 275, 9 + AUTORADIOBUTTON "&Ведомый компьютер", 1483, 31, 20, 265, 10, BS_TOP | BS_MULTILINE | WS_GROUP + AUTORADIOBUTTON "В&едущий компьютер", 1484, 31, 50, 265, 10, BS_TOP | BS_MULTILINE + LTEXT "На этом компьютере хранится информация, к которой вы хотите получить доступ.", -1, 45, 31, 253, 19, NOT WS_GROUP | WS_TABSTOP + LTEXT "Этот компьютер используется для получения доступа к информации, хранящейся на ведомом компьютере.", -1, 45, 61, 253, 23, NOT WS_GROUP END 511 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT " &:", -1, 8, 5, 261, 8 + LTEXT "Выберите у&стройство:", -1, 8, 5, 261, 8 COMBOBOX 1485, 9, 18, 302, 62, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | NOT WS_TABSTOP END 528 DIALOGEX 0, 0, 227, 215 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION "" +CAPTION "Подключения" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ", 1582, 8, 10, 213, 63 - LTEXT " , .", 1581, 16, 21, 194, 30 - AUTOCHECKBOX "& ", 1497, 16, 56, 195, 10, BS_TOP | BS_MULTILINE + GROUPBOX "Привилегии входа", 1582, 8, 10, 213, 63 + LTEXT "Можно разрешить создавать и изменять подключения перед входом в сеть для пользователей, не являющихся администраторами.", 1581, 16, 21, 194, 30 + AUTOCHECKBOX "&Разрешить создание и изменение подключений перед входом в сеть", 1497, 16, 56, 195, 10, BS_TOP | BS_MULTILINE END 532 DIALOGEX 0, 0, 263, 263 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION " " +CAPTION "Ответный вызов маршрутизатора" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " . , .", 1043, 7, 3, 253, 33 - AUTORADIOBUTTON "& ", 1501, 9, 36, 252, 10, BS_TOP | BS_MULTILINE | WS_GROUP - AUTORADIOBUTTON "& :", 1502, 9, 48, 252, 10, BS_TOP | BS_MULTILINE, WS_EX_TRANSPARENT + LTEXT "При звонке на маршрутизатор вам может быть предложено принять ответный вызов для уменьшения ваших расходов на связь и повышения безопасности соединения. Укажите, нужна ли вам возможность ответного вызова.", 1043, 7, 3, 253, 33 + AUTORADIOBUTTON "&Ответный вызов не выполняется", 1501, 9, 36, 252, 10, BS_TOP | BS_MULTILINE | WS_GROUP + AUTORADIOBUTTON "&Всегда выполнять ответный вызов по указанным номерам:", 1502, 9, 48, 252, 10, BS_TOP | BS_MULTILINE, WS_EX_TRANSPARENT CONTROL "", 1503, "SYSLISTVIEW32", WS_BORDER | WS_GROUP | WS_TABSTOP | 0x00008401, 15, 63, 240, 143 - PUSHBUTTON "&...", 1504, 131, 213, 60, 14 - PUSHBUTTON "&", 1505, 194, 213, 60, 14 + PUSHBUTTON "&Изменить...", 1504, 131, 213, 60, 14 + PUSHBUTTON "&Удалить", 1505, 194, 213, 60, 14 CONTROL "", -1, "STATIC", SS_ETCHEDHORZ, 7, 233, 249, 1 DEFPUSHBUTTON "OK", 1, 132, 242, 60, 14 - PUSHBUTTON "", 2, 196, 242, 60, 14 + PUSHBUTTON "Отмена", 2, 196, 242, 60, 14 END 534 DIALOGEX 0, 0, 230, 215 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION "" +CAPTION "Параметры" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ", 1289, 7, 7, 215, 55 - AUTORADIOBUTTON "& ", 1506, 16, 20, 199, 9, BS_TOP | BS_MULTILINE | WS_GROUP | NOT WS_TABSTOP - LTEXT "& :", 1299, 27, 33, 117, 8, NOT WS_GROUP + GROUPBOX "Тип подключения", 1289, 7, 7, 215, 55 + AUTORADIOBUTTON "Вы&зов по требованию", 1506, 16, 20, 199, 9, BS_TOP | BS_MULTILINE | WS_GROUP | NOT WS_TABSTOP + LTEXT "&Время простоя до разъединения:", 1299, 27, 33, 117, 8, NOT WS_GROUP COMBOBOX 1291, 144, 30, 70, 108, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - AUTORADIOBUTTON "& ", 1507, 16, 47, 197, 9, BS_TOP | BS_MULTILINE | NOT WS_TABSTOP - GROUPBOX " ", 1290, 7, 66, 215, 48 - LTEXT "& :", 1300, 14, 79, 123, 8 + AUTORADIOBUTTON "Посто&янное подключение", 1507, 16, 47, 197, 9, BS_TOP | BS_MULTILINE | NOT WS_TABSTOP + GROUPBOX "Политика набора номера", 1290, 7, 66, 215, 48 + LTEXT "&Число повторений набора номера:", 1300, 14, 79, 123, 8 EDITTEXT 1287, 143, 76, 70, 14, ES_AUTOHSCROLL | ES_NUMBER - LTEXT "& :", 1301, 14, 96, 123, 8 + LTEXT "&Среднее время между попытками:", 1301, 14, 96, 123, 8 COMBOBOX 1292, 143, 94, 70, 123, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - GROUPBOX " ", 1288, 7, 116, 215, 35 + GROUPBOX "Использование нескольких устройств", 1288, 7, 116, 215, 35 COMBOBOX 1551, 16, 130, 128, 41, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - PUSHBUTTON "&...", 1293, 150, 129, 65, 14 - PUSHBUTTON "& ", 1302, 8, 195, 80, 14 + PUSHBUTTON "&Настроить...", 1293, 150, 129, 65, 14 + PUSHBUTTON "&Ответный вызов", 1302, 8, 195, 80, 14 PUSHBUTTON "&X.25", 1295, 93, 195, 50, 14 END 539 DIALOGEX 0, 0, 265, 110 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION " %1" +CAPTION "Подключение к %1" FONT 8, "MS Shell Dlg" BEGIN CONTROL 1678, 1100, "STATIC", SS_BITMAP, 0, 0, 265, 50 - LTEXT "&:", 1413, 14, 64, 84, 8 + LTEXT "&Пользователь:", 1413, 14, 64, 84, 8 EDITTEXT 1104, 102, 62, 154, 14, ES_AUTOHSCROLL CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 9, 82, 247, 1 - DEFPUSHBUTTON "&", 1590, 8, 89, 60, 14 - PUSHBUTTON "", 1591, 71, 89, 60, 14 - PUSHBUTTON "&", 1107, 133, 89, 60, 14 - PUSHBUTTON "&", 1592, 195, 89, 60, 14 + DEFPUSHBUTTON "В&ызов", 1590, 8, 89, 60, 14 + PUSHBUTTON "Отмена", 1591, 71, 89, 60, 14 + PUSHBUTTON "Сво&йства", 1107, 133, 89, 60, 14 + PUSHBUTTON "&Справка", 1592, 195, 89, 60, 14 END 540 DIALOGEX 0, 0, 265, 133 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION " %1" +CAPTION "Подключение к %1" FONT 8, "MS Shell Dlg" BEGIN CONTROL 1678, 1100, "STATIC", SS_BITMAP, 0, 0, 265, 50 - LTEXT "&:", 1413, 10, 64, 90, 8 + LTEXT "&Пользователь:", 1413, 10, 64, 90, 8 EDITTEXT 1104, 105, 60, 154, 14, ES_AUTOHSCROLL CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 7, 80, 252, 1 - LTEXT "&:", 1412, 10, 91, 92, 10 + LTEXT "&Набрать:", 1412, 10, 91, 92, 10 COMBOBOX 1416, 105, 88, 154, 112, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | NOT WS_TABSTOP CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 7, 107, 251, 1 - DEFPUSHBUTTON "&", 1590, 8, 113, 60, 14 - PUSHBUTTON "", 1591, 71, 113, 60, 14 - PUSHBUTTON "&", 1107, 134, 113, 60, 14 - PUSHBUTTON "&", 1592, 197, 113, 60, 14 + DEFPUSHBUTTON "В&ызов", 1590, 8, 113, 60, 14 + PUSHBUTTON "Отмена", 1591, 71, 113, 60, 14 + PUSHBUTTON "Сво&йства", 1107, 134, 113, 60, 14 + PUSHBUTTON "&Справка", 1592, 197, 113, 60, 14 END 541 DIALOGEX 0, 0, 265, 157 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION " %1" +CAPTION "Подключение к %1" FONT 8, "MS Shell Dlg" BEGIN CONTROL 1678, 1100, "STATIC", SS_BITMAP, 0, 0, 265, 50 - LTEXT "&:", 1413, 12, 67, 87, 8 + LTEXT "&Пользователь:", 1413, 12, 67, 87, 8 EDITTEXT 1104, 103, 63, 154, 14, ES_AUTOHSCROLL CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 9, 84, 248, 1 - LTEXT "&:", 1412, 11, 96, 48, 8 + LTEXT "&Набрать:", 1412, 11, 96, 48, 8 COMBOBOX 1416, 103, 92, 154, 112, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | NOT WS_TABSTOP - LTEXT "& :", 1415, 10, 114, 46, 8 + LTEXT "&Место вызова:", 1415, 10, 114, 46, 8 COMBOBOX 1414, 102, 110, 87, 112, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | NOT WS_TABSTOP - PUSHBUTTON "&", 1108, 193, 110, 64, 14 + PUSHBUTTON "Прави&ла", 1108, 193, 110, 64, 14 CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 7, 130, 250, 1 - DEFPUSHBUTTON "&", 1590, 6, 136, 60, 14 - PUSHBUTTON "", 1591, 69, 136, 60, 14 - PUSHBUTTON "&", 1107, 132, 136, 60, 14 - PUSHBUTTON "&", 1592, 196, 136, 60, 14 + DEFPUSHBUTTON "В&ызов", 1590, 6, 136, 60, 14 + PUSHBUTTON "Отмена", 1591, 69, 136, 60, 14 + PUSHBUTTON "Сво&йства", 1107, 132, 136, 60, 14 + PUSHBUTTON "&Справка", 1592, 196, 136, 60, 14 END 544 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Мастер новых подключений" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " .", -1, 10, 5, 300, 22 - AUTOCHECKBOX "& ", 1512, 21, 31, 272, 10 - LTEXT " , , .", 1514, 10, 56, 294, 27 - AUTOCHECKBOX "& ", 1513, 21, 86, 260, 10 + LTEXT "Общий доступ к подключению Интернета позволят компьютерам в локальной сети получить доступ к внешним ресурсам через это подключение.", -1, 10, 5, 300, 22 + AUTOCHECKBOX "&Разрешить общий доступ для этого подключения", 1512, 21, 31, 272, 10 + LTEXT "Чтобы устанавливать данное подключение автоматически, когда другой компьютер в вашей локальной сети пытается получить доступ к внешним ресурсам, установить флажок ниже.", 1514, 10, 56, 294, 27 + AUTOCHECKBOX "Ра&зрешить вызов по требованию", 1513, 21, 86, 260, 10 END 545 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Мастер новых подключений" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " . .", -1, 10, 5, 300, 37 - LTEXT "& , :", -1, 21, 43, 285, 8 + LTEXT "Общий доступ позволят другим компьютерам в локальной сети получить доступ к внешним ресурсам через это удаленное подключение. В каждый момент времени разрешение на общий доступ можно выдать только для одного подключения и одной сети.", -1, 10, 5, 300, 37 + LTEXT "&Выберите локальную сеть, которая получит доступ через это подключение:", -1, 21, 43, 285, 8 COMBOBOX 1522, 21, 55, 231, 56, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | NOT WS_TABSTOP END @@ -1068,274 +1068,274 @@ END STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT " - . , - .", -1, 10, 5, 303, 27 - AUTORADIOBUTTON "& - ", 1524, 26, 36, 264, 12, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP | NOT WS_TABSTOP - AUTORADIOBUTTON "& - ", 1525, 26, 52, 261, 16, BS_LEFT | BS_TOP | BS_MULTILINE | NOT WS_TABSTOP + LTEXT "Вы можете настроить это подключение для использования смарт-карты для входа в удаленную сеть. Укажите, следует ли использовать смарт-карту для этого подключения.", -1, 10, 5, 303, 27 + AUTORADIOBUTTON "&Использовать мою смарт-карту ", 1524, 26, 36, 264, 12, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP | NOT WS_TABSTOP + AUTORADIOBUTTON "&Не использовать мою смарт-карту ", 1525, 26, 52, 261, 16, BS_LEFT | BS_TOP | BS_MULTILINE | NOT WS_TABSTOP END 547 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION -CAPTION " " +CAPTION "Мастер интерфейса вызова по требованию" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " .", 1530, 122, 8, 192, 32 - LTEXT " .", 1531, 122, 43, 192, 37 - LTEXT " """".", 1532, 122, 85, 191, 29 + LTEXT "Мастер интерфейса вызова по требованию.", 1530, 122, 8, 192, 32 + LTEXT "Используя этот мастер можно создать интерфейс вызова по требованию для подключения этого маршрутизатора к другим маршрутизаторам.", 1531, 122, 43, 192, 37 + LTEXT "Для продолжения нажмите кнопку ""Далее"".", 1532, 122, 85, 191, 29 END 548 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - AUTORADIOBUTTON " &, ISDN .", 1531, 21, 17, 290, 15, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP | NOT WS_TABSTOP - AUTORADIOBUTTON " & (VPN)", 1532, 21, 38, 291, 15, BS_LEFT | BS_TOP | BS_MULTILINE | NOT WS_TABSTOP - AUTORADIOBUTTON " Ethernet (PPPoE) PPP", 1688, 21, 58, 290, 12, NOT WS_TABSTOP + AUTORADIOBUTTON "Подключаться используя &модем, адаптер ISDN или другое устройство.", 1531, 21, 17, 290, 15, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP | NOT WS_TABSTOP + AUTORADIOBUTTON "Подключаться с использованием &виртуальной частной сети (VPN)", 1532, 21, 38, 291, 15, BS_LEFT | BS_TOP | BS_MULTILINE | NOT WS_TABSTOP + AUTORADIOBUTTON "Подключаться через Ethernet (PPPoE) с использованием PPP", 1688, 21, 58, 290, 12, NOT WS_TABSTOP END 550 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_CHILD | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT " IP- .", 1535, 10, 8, 289, 18 - LTEXT "& IP- (, reactos.org 145.52.0.1):", 1537, 21, 35, 285, 8 + LTEXT "Введите имя или IP-адрес маршрутизатора к которому производится подключение.", 1535, 10, 8, 289, 18 + LTEXT "&Имя компьютера или IP-адрес (например, reactos.org или 145.52.0.1):", 1537, 21, 35, 285, 8 EDITTEXT 1536, 21, 47, 285, 14, ES_AUTOHSCROLL END 551 DIALOGEX 0, 0, 265, 127 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION " %1" +CAPTION "Подключение к %1" FONT 8, "MS Shell Dlg" BEGIN CONTROL 1678, 1100, "STATIC", SS_BITMAP, 0, 0, 265, 50 - LTEXT "&:", 1413, 12, 62, 89, 8 + LTEXT "&Пользователь:", 1413, 12, 62, 89, 8 EDITTEXT 1104, 104, 58, 154, 14, ES_AUTOHSCROLL - LTEXT "&:", 1110, 12, 82, 90, 8 + LTEXT "&Домен:", 1110, 12, 82, 90, 8 EDITTEXT 1102, 104, 79, 154, 14, ES_UPPERCASE | ES_AUTOHSCROLL CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 10, 99, 248, 1 - DEFPUSHBUTTON "&", 1590, 9, 106, 61, 14 - PUSHBUTTON "", 1591, 72, 106, 60, 14 - PUSHBUTTON "&", 1107, 135, 106, 60, 14 - PUSHBUTTON "&", 1592, 198, 106, 60, 14 + DEFPUSHBUTTON "В&ызов", 1590, 9, 106, 61, 14 + PUSHBUTTON "Отмена", 1591, 72, 106, 60, 14 + PUSHBUTTON "Сво&йства", 1107, 135, 106, 60, 14 + PUSHBUTTON "&Справка", 1592, 198, 106, 60, 14 END 552 DIALOGEX 0, 0, 265, 159 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION " %1" +CAPTION "Подключение к %1" FONT 8, "MS Shell Dlg" BEGIN CONTROL 1678, 1100, "STATIC", SS_BITMAP, 0, 0, 265, 50 - LTEXT "&:", 1413, 10, 67, 91, 10 + LTEXT "&Пользователь:", 1413, 10, 67, 91, 10 EDITTEXT 1104, 104, 64, 154, 14, ES_AUTOHSCROLL - LTEXT "&:", 1110, 11, 86, 91, 8 + LTEXT "&Домен:", 1110, 11, 86, 91, 8 EDITTEXT 1102, 104, 83, 154, 14, ES_UPPERCASE | ES_AUTOHSCROLL CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 10, 103, 248, 1 - LTEXT "&:", 1412, 10, 115, 91, 8 + LTEXT "&Набрать:", 1412, 10, 115, 91, 8 COMBOBOX 1416, 104, 111, 154, 112, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | NOT WS_TABSTOP CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 10, 132, 248, 1 - DEFPUSHBUTTON "&", 1590, 8, 139, 60, 14 - PUSHBUTTON "", 1591, 71, 139, 60, 14 - PUSHBUTTON "&", 1107, 134, 139, 60, 14 - PUSHBUTTON "&", 1592, 198, 139, 60, 14 + DEFPUSHBUTTON "В&ызов", 1590, 8, 139, 60, 14 + PUSHBUTTON "Отмена", 1591, 71, 139, 60, 14 + PUSHBUTTON "Сво&йства", 1107, 134, 139, 60, 14 + PUSHBUTTON "&Справка", 1592, 198, 139, 60, 14 END 553 DIALOGEX 0, 0, 265, 183 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION " %1" +CAPTION "Подключение к %1" FONT 8, "MS Shell Dlg" BEGIN CONTROL 1678, 1100, "STATIC", SS_BITMAP, 0, 0, 265, 50 - LTEXT "&:", 1413, 10, 68, 92, 10 + LTEXT "&Пользователь:", 1413, 10, 68, 92, 10 EDITTEXT 1104, 104, 65, 154, 14, ES_AUTOHSCROLL - LTEXT "&:", 1110, 10, 90, 91, 8 + LTEXT "&Домен:", 1110, 10, 90, 91, 8 EDITTEXT 1102, 104, 86, 154, 14, ES_UPPERCASE | ES_AUTOHSCROLL CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 10, 106, 248, 1 - LTEXT "&:", 1412, 10, 118, 92, 8 + LTEXT "&Набрать:", 1412, 10, 118, 92, 8 COMBOBOX 1416, 104, 114, 154, 112, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | NOT WS_TABSTOP - LTEXT "& :", 1415, 10, 137, 91, 8 + LTEXT "&Место вызова:", 1415, 10, 137, 91, 8 COMBOBOX 1414, 104, 134, 87, 112, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | NOT WS_TABSTOP - PUSHBUTTON "&", 1108, 194, 134, 65, 14 + PUSHBUTTON "Прави&ла", 1108, 194, 134, 65, 14 CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 10, 154, 248, 1 - DEFPUSHBUTTON "&", 1590, 8, 162, 60, 14 - PUSHBUTTON "", 1591, 71, 162, 60, 14 - PUSHBUTTON "&", 1107, 134, 162, 60, 14 - PUSHBUTTON "&", 1592, 198, 162, 60, 14 + DEFPUSHBUTTON "В&ызов", 1590, 8, 162, 60, 14 + PUSHBUTTON "Отмена", 1591, 71, 162, 60, 14 + PUSHBUTTON "Сво&йства", 1107, 134, 162, 60, 14 + PUSHBUTTON "&Справка", 1592, 198, 162, 60, 14 END 554 DIALOGEX 0, 0, 230, 215 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION -CAPTION "" +CAPTION "Общие" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "& :", 1124, 7, 4, 193, 8 + LTEXT "&Подключаться через:", 1124, 7, 4, 193, 8 CONTROL "", 1128, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x00004C0D, 7, 17, 195, 44, WS_EX_CLIENTEDGE - PUSHBUTTON "&", 1132, 208, 18, 16, 14, BS_ICON - PUSHBUTTON "&", 1131, 208, 36, 16, 14, BS_ICON - AUTOCHECKBOX "& ", 1119, 7, 65, 131, 21, BS_TOP | BS_MULTILINE - PUSHBUTTON "&...", 1130, 140, 66, 60, 14 - GROUPBOX "", 1125, 7, 87, 213, 56, WS_GROUP - LTEXT "& :", 1135, 19, 102, 191, 8 + PUSHBUTTON "&Вверх", 1132, 208, 18, 16, 14, BS_ICON + PUSHBUTTON "В&низ", 1131, 208, 36, 16, 14, BS_ICON + AUTOCHECKBOX "О&бщие номера для подключения всех устройств", 1119, 7, 65, 131, 21, BS_TOP | BS_MULTILINE + PUSHBUTTON "На&строить...", 1130, 140, 66, 60, 14 + GROUPBOX "Образец", 1125, 7, 87, 213, 56, WS_GROUP + LTEXT "Но&мер телефона:", 1135, 19, 102, 191, 8 EDITTEXT 1123, 17, 112, 138, 14, ES_AUTOHSCROLL - PUSHBUTTON "&", 1129, 161, 112, 50, 14 - AUTOCHECKBOX " & ", 1120, 11, 194, 212, 20, BS_TOP | BS_MULTILINE + PUSHBUTTON "&Другие", 1129, 161, 112, 50, 14 + AUTOCHECKBOX "При подключении в&ывести значок в области уведомлений", 1120, 11, 194, 212, 20, BS_TOP | BS_MULTILINE END 555 DIALOGEX 0, 0, 230, 215 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION -CAPTION "" +CAPTION "Общие" FONT 8, "MS Shell Dlg" BEGIN - PUSHBUTTON "&...", 1130, 160, 38, 60, 14 - LTEXT "& :", 1135, 8, 72, 194, 8 + PUSHBUTTON "&Настроить...", 1130, 160, 38, 60, 14 + LTEXT "Но&мер телефона:", 1135, 8, 72, 194, 8 EDITTEXT 1123, 8, 83, 148, 14, ES_AUTOHSCROLL - PUSHBUTTON "&", 1129, 160, 83, 60, 14 - AUTOCHECKBOX " & ", 1120, 11, 194, 213, 10, BS_TOP | BS_MULTILINE - LTEXT "& :", 1124, 8, 5, 214, 8 + PUSHBUTTON "&Другие", 1129, 160, 83, 60, 14 + AUTOCHECKBOX "При подключении в&ывести значок в области уведомлений", 1120, 11, 194, 213, 10, BS_TOP | BS_MULTILINE + LTEXT "&Подключаться через:", 1124, 8, 5, 214, 8 CONTROL "", 1127, "SYSLISTVIEW32", WS_DISABLED | WS_BORDER | 0x0000EC0D, 7, 18, 214, 15 END 556 DIALOGEX 0, 0, 220, 165 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION " " +CAPTION "Параметры программ" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "& , :", -1, 7, 5, 203, 8 + LTEXT "Опис&ание программы, работающей в вашей сети:", -1, 7, 5, 203, 8 EDITTEXT 1565, 7, 17, 206, 14, ES_AUTOHSCROLL - LTEXT "& -:", -1, 7, 35, 202, 8 + LTEXT "Ном&ер порта Интернет-сервера:", -1, 7, 35, 202, 8 EDITTEXT 1566, 7, 47, 113, 14, ES_AUTOHSCROLL | ES_NUMBER - AUTORADIOBUTTON "& TCP", 1548, 125, 50, 45, 10, NOT WS_TABSTOP - AUTORADIOBUTTON "& UDP", 1567, 172, 50, 47, 10, NOT WS_TABSTOP - LTEXT "& -:\n(: 1024-1209, 1300-1310, 1450)", -1, 7, 70, 207, 27 - LTEXT "& TCP:", -1, 7, 100, 40, 8 + AUTORADIOBUTTON "дл&я TCP", 1548, 125, 50, 45, 10, NOT WS_TABSTOP + AUTORADIOBUTTON "д&ля UDP", 1567, 172, 50, 47, 10, NOT WS_TABSTOP + LTEXT "&Порт или диапазон портов для прослушивания ответных сообщений от Интернет-серверов:\n(например: 1024-1209, 1300-1310, 1450)", -1, 7, 70, 207, 27 + LTEXT "п&орт TCP:", -1, 7, 100, 40, 8 EDITTEXT 1569, 50, 97, 162, 14, ES_AUTOHSCROLL - LTEXT "& UDP:", -1, 7, 121, 40, 8 + LTEXT "пор&т UDP:", -1, 7, 121, 40, 8 EDITTEXT 1551, 50, 117, 162, 14, ES_AUTOHSCROLL DEFPUSHBUTTON "OK", 1, 90, 144, 60, 14 - PUSHBUTTON "", 2, 154, 144, 60, 14 + PUSHBUTTON "Отмена", 2, 154, 144, 60, 14 END 557 DIALOGEX 0, 0, 217, 164 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION " " +CAPTION "Параметры службы" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "& :", -1, 7, 5, 203, 8 + LTEXT "&Описание службы:", -1, 7, 5, 203, 8 EDITTEXT 1552, 7, 18, 205, 14, ES_AUTOHSCROLL - LTEXT "& IP- , (, 192.168.0.12):", -1, 7, 37, 208, 16 + LTEXT "&Имя или IP-адрес компьютера вашей сети, на котором располагается эта служба (например, 192.168.0.12):", -1, 7, 37, 208, 16 EDITTEXT 1556, 7, 57, 203, 14, ES_AUTOHSCROLL - LTEXT " &, :", -1, 7, 85, 203, 8 + LTEXT "Номер порт&а, на котором располагается эта служба:", -1, 7, 85, 203, 8 EDITTEXT 1553, 7, 97, 113, 14, ES_AUTOHSCROLL | ES_NUMBER - AUTORADIOBUTTON "& TCP", 1554, 126, 100, 44, 10, NOT WS_TABSTOP - AUTORADIOBUTTON "& UDP", 1555, 170, 100, 47, 10, NOT WS_TABSTOP + AUTORADIOBUTTON "дл&я TCP", 1554, 126, 100, 44, 10, NOT WS_TABSTOP + AUTORADIOBUTTON "д&ля UDP", 1555, 170, 100, 47, 10, NOT WS_TABSTOP DEFPUSHBUTTON "OK", 1, 86, 143, 60, 14 - PUSHBUTTON "", 2, 150, 143, 60, 14 + PUSHBUTTON "Отмена", 2, 150, 143, 60, 14 END 558 DIALOGEX 0, 0, 230, 215 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "" +CAPTION "Программы" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " , :", -1, 7, 7, 218, 28 + LTEXT "Подключение к Интернету на этом компьютере было настроено таким образом, чтобы разрешить запускаться в вашей сети следующим программам:", -1, 7, 7, 218, 28 CONTROL "List1", 1558, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x0000441D, 7, 37, 215, 155, WS_EX_CLIENTEDGE - PUSHBUTTON "&...", 1538, 7, 197, 67, 14 - PUSHBUTTON "&...", 1559, 80, 197, 67, 14 - PUSHBUTTON "&", 1568, 153, 197, 67, 14 + PUSHBUTTON "&Добавить...", 1538, 7, 197, 67, 14 + PUSHBUTTON "&Изменить...", 1559, 80, 197, 67, 14 + PUSHBUTTON "&Удалить", 1568, 153, 197, 67, 14 END 559 DIALOGEX 0, 0, 230, 215 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "" +CAPTION "Службы" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "& , , .", -1, 7, 5, 216, 22 - LTEXT ":", -1, 7, 27, 143, 8 + LTEXT "&Выберите службы, работающие в вашей сети, к которым могут получать доступ пользователи Интернета.", -1, 7, 5, 216, 22 + LTEXT "Службы:", -1, 7, 27, 143, 8 CONTROL "List1", 1560, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x0000441D, 7, 37, 215, 155, WS_EX_CLIENTEDGE - PUSHBUTTON "&...", 1561, 7, 197, 67, 14 - PUSHBUTTON "&...", 1563, 80, 197, 67, 14 - PUSHBUTTON "&", 1562, 153, 197, 67, 14 + PUSHBUTTON "&Добавить...", 1561, 7, 197, 67, 14 + PUSHBUTTON "&Изменить...", 1563, 80, 197, 67, 14 + PUSHBUTTON "&Удалить", 1562, 153, 197, 67, 14 END 560 DIALOGEX 6, 18, 240, 88 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION " " +CAPTION "Начальное подключение" FONT 8, "MS Shell Dlg" BEGIN - DEFPUSHBUTTON "&", 6, 68, 68, 50, 14 - PUSHBUTTON "&", 7, 125, 68, 50, 14 + DEFPUSHBUTTON "&Да", 6, 68, 68, 50, 14 + PUSHBUTTON "&Нет", 7, 125, 68, 50, 14 ICON 32516, 1575, 7, 7, 20, 20 LTEXT "", 1576, 40, 7, 190, 33 - AUTOCHECKBOX " & ", 1579, 40, 48, 192, 11, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Не &выводить более это напоминание", 1579, 40, 48, 192, 11, BS_TOP | BS_MULTILINE END 567 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Мастер новых подключений" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " . , ReactOS .", -1, 10, 7, 301, 25 - LTEXT "& ( ):", -1, 22, 32, 229, 8 + LTEXT "Введите имя службы в указанном текстовом поле. Если оставить это поле пустым, ReactOS автоматически обнаружит и настроит службу при подключении.", -1, 10, 7, 301, 25 + LTEXT "&Имя службы (не обязательно):", -1, 22, 32, 229, 8 EDITTEXT 1593, 22, 44, 275, 14, ES_AUTOHSCROLL END 568 DIALOGEX 0, 0, 230, 215 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION -CAPTION "" +CAPTION "Общие" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "& :", 1686, 7, 5, 217, 10 + LTEXT "&Имя службы:", 1686, 7, 5, 217, 10 EDITTEXT 1594, 7, 17, 217, 14, ES_AUTOHSCROLL - AUTOCHECKBOX " & ", 1120, 9, 196, 215, 8 + AUTOCHECKBOX "При подключении в&ывести значок в области уведомлений", 1120, 9, 196, 215, 8 END 569 DIALOGEX 0, 0, 230, 215 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION "" +CAPTION "Безопасность" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ", 1580, 8, 4, 213, 151 - AUTORADIOBUTTON "& ( )", 1540, 14, 16, 197, 9, BS_NOTIFY | WS_GROUP - AUTORADIOBUTTON "& ( )", 1541, 14, 100, 197, 8, BS_NOTIFY - LTEXT "& :", 1537, 26, 29, 183, 8, NOT WS_GROUP + GROUPBOX "Параметры безопасности", 1580, 8, 4, 213, 151 + AUTORADIOBUTTON "Об&ычные (рекомендуемые параметры)", 1540, 14, 16, 197, 9, BS_NOTIFY | WS_GROUP + AUTORADIOBUTTON "&Дополнительные (выборочные параметры)", 1541, 14, 100, 197, 8, BS_NOTIFY + LTEXT "&При проверке используется:", 1537, 26, 29, 183, 8, NOT WS_GROUP COMBOBOX 1178, 26, 40, 184, 78, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | NOT WS_TABSTOP - AUTOCHECKBOX "& ReactOS ( , )", 1174, 26, 59, 186, 20, BS_TOP | BS_MULTILINE - AUTOCHECKBOX "& ( )", 1169, 26, 79, 185, 18, BS_TOP | BS_MULTILINE - LTEXT " .", 1539, 26, 111, 184, 20 - PUSHBUTTON "&...", 1180, 151, 134, 60, 14 - PUSHBUTTON " I&PSec...", 1598, 126, 163, 85, 14 + AUTOCHECKBOX "&Использовать автоматически имя входа и пароль из ReactOS (и имя домена, если существует)", 1174, 26, 59, 186, 20, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Тре&буется шифрование данных (иначе отключаться)", 1169, 26, 79, 185, 18, BS_TOP | BS_MULTILINE + LTEXT "Применение этих параметров требует знания протоколов обеспечения безопасности.", 1539, 26, 111, 184, 20 + PUSHBUTTON "&Параметры...", 1180, 151, 134, 60, 14 + PUSHBUTTON "Параметры I&PSec...", 1598, 126, 163, 85, 14 END 570 DIALOGEX 0, 0, 265, 126 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION " IPSec" +CAPTION "Параметры IPSec" FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "OK", 1, 151, 104, 50, 14 - PUSHBUTTON "", 2, 207, 104, 50, 14 - AUTOCHECKBOX " & ", 1604, 21, 15, 217, 10 - LTEXT "&:", 1602, 20, 31, 44, 12 + PUSHBUTTON "Отмена", 2, 207, 104, 50, 14 + AUTOCHECKBOX "Для проверки подлинности &использовать предварительный ключ", 1604, 21, 15, 217, 10 + LTEXT "&Ключ:", 1602, 20, 31, 44, 12 EDITTEXT 1605, 66, 30, 172, 12, ES_AUTOHSCROLL - AUTOCHECKBOX " ", 1606, 20, 50, 242, 13, WS_DISABLED - AUTOCHECKBOX " ", 1607, 20, 67, 239, 10, WS_DISABLED - PUSHBUTTON "", 1608, 31, 84, 50, 14, WS_DISABLED + AUTOCHECKBOX "Разрешить сертификаты из моего хранилища сертификатов", 1606, 20, 50, 242, 13, WS_DISABLED + AUTOCHECKBOX "Использовать особый сертификат", 1607, 20, 67, 239, 10, WS_DISABLED + PUSHBUTTON "Выбрать", 1608, 31, 84, 50, 14, WS_DISABLED COMBOBOX 1610, 91, 84, 135, 30, CBS_DROPDOWN | CBS_SORT | WS_DISABLED | WS_VSCROLL | NOT WS_TABSTOP END 571 DIALOGEX 0, 0, 230, 215 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION " " +CAPTION "Ведение журнала безопасности" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " :", -1, 6, 8, 216, 47 - AUTOCHECKBOX "& ", 1642, 14, 22, 201, 10 - AUTOCHECKBOX " & ", 1641, 14, 37, 200, 10 - GROUPBOX " :", -1, 7, 64, 215, 91 - LTEXT "&:", -1, 14, 78, 199, 8 + GROUPBOX "Параметры ведения журнала:", -1, 6, 8, 216, 47 + AUTOCHECKBOX "Записы&вать неудавшиеся входящие подключения", 1642, 14, 22, 201, 10 + AUTOCHECKBOX "Записывать успешные &исходящие подключения", 1641, 14, 37, 200, 10 + GROUPBOX "Параметры файла журнала:", -1, 7, 64, 215, 91 + LTEXT "&Имя:", -1, 14, 78, 199, 8 EDITTEXT 1674, 14, 90, 199, 14, ES_READONLY - PUSHBUTTON "&...", 1639, 153, 108, 60, 14 - LTEXT "& :", -1, 14, 133, 90, 8 + PUSHBUTTON "Об&зор...", 1639, 153, 108, 60, 14 + LTEXT "М&аксимальный размер:", -1, 14, 133, 90, 8 EDITTEXT 1640, 112, 130, 50, 14, ES_AUTOHSCROLL | ES_NUMBER - LTEXT "", -1, 170, 133, 20, 8 - PUSHBUTTON "& ", 1643, 115, 197, 105, 14 + LTEXT "КБ", -1, 170, 133, 20, 8 + PUSHBUTTON "&Восстановить умолчания", 1643, 115, 197, 105, 14 END 572 DIALOGEX 0, 0, 230, 215 @@ -1343,15 +1343,15 @@ STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION CAPTION "ICMP" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " & (ICMP) . -, :", -1, 7, 5, 215, 37 + LTEXT "Протокол упр&авляющих сообщений Интернета (ICMP) позволяет компьютерам в сети обмениваться информацией об ошибках и своем состоянии. Выберите Интернет-запросы, на которые будет отвечать этот компьютер:", -1, 7, 5, 215, 37 CONTROL "IList1", 1644, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x0000440D, 7, 45, 215, 100, WS_EX_CLIENTEDGE - GROUPBOX ":", -1, 7, 153, 215, 55 + GROUPBOX "Описание:", -1, 7, 153, 215, 55 LTEXT "", 1645, 14, 171, 199, 32 END 574 DIALOGEX 0, 0, 230, 215 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "" +CAPTION "Дополнительно" FONT 8, "MS Shell Dlg" BEGIN LTEXT "", 575, 7, 60, 213, 100 @@ -1359,455 +1359,455 @@ END 577 DIALOGEX 0, 0, 312, 144 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Мастер новых подключений" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " .", 1681, 10, 3, 296, 11 - LTEXT "&:", 1690, 18, 20, 127, 10 + LTEXT "Введите имя поставщика услуг Интернета.", 1681, 10, 3, 296, 11 + LTEXT "&Имя:", 1690, 18, 20, 127, 10 EDITTEXT 1680, 17, 32, 222, 14, ES_AUTOHSCROLL - LTEXT " .", 1683, 17, 52, 282, 42 + LTEXT "Введенное имя будет именем создаваемого соединения.", 1683, 17, 52, 282, 42 END 580 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_CHILD | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - AUTORADIOBUTTON "& ", 1534, 21, 20, 288, 11, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP | NOT WS_TABSTOP - AUTORADIOBUTTON "& - (PPTP)", 1532, 21, 39, 290, 11, BS_LEFT | BS_TOP | BS_MULTILINE | NOT WS_TABSTOP - AUTORADIOBUTTON "& (L2TP)", 1533, 21, 56, 286, 11, BS_LEFT | BS_TOP | BS_MULTILINE | NOT WS_TABSTOP + AUTORADIOBUTTON "&Автоматический выбор", 1534, 21, 20, 288, 11, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP | NOT WS_TABSTOP + AUTORADIOBUTTON "&Туннельный протокол точка-точка (PPTP)", 1532, 21, 39, 290, 11, BS_LEFT | BS_TOP | BS_MULTILINE | NOT WS_TABSTOP + AUTORADIOBUTTON "&Туннельный протокол второго уровня (L2TP)", 1533, 21, 56, 286, 11, BS_LEFT | BS_TOP | BS_MULTILINE | NOT WS_TABSTOP END 1420 DIALOGEX 0, 0, 265, 108 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION " %1" +CAPTION "Подключение к %1" FONT 8, "MS Shell Dlg" BEGIN CONTROL 1678, 1100, "STATIC", SS_BITMAP, 0, 0, 265, 50 - LTEXT "&:", 1412, 14, 63, 86, 8 + LTEXT "&Набрать:", 1412, 14, 63, 86, 8 COMBOBOX 1416, 104, 60, 154, 112, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | NOT WS_TABSTOP CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 10, 80, 248, 1 - DEFPUSHBUTTON "&", 1590, 9, 87, 60, 14 - PUSHBUTTON "", 1591, 72, 87, 60, 14 - PUSHBUTTON "&", 1107, 135, 87, 60, 14 - PUSHBUTTON "&", 1592, 198, 87, 60, 14 + DEFPUSHBUTTON "В&ызов", 1590, 9, 87, 60, 14 + PUSHBUTTON "Отмена", 1591, 72, 87, 60, 14 + PUSHBUTTON "Сво&йства", 1107, 135, 87, 60, 14 + PUSHBUTTON "&Справка", 1592, 198, 87, 60, 14 END 1421 DIALOGEX 0, 0, 265, 223 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION " %1" +CAPTION "Подключение к %1" FONT 8, "MS Shell Dlg" BEGIN CONTROL 1678, 1100, "STATIC", SS_BITMAP, 0, 0, 265, 50 - LTEXT "&:", 1413, 10, 61, 90, 8 + LTEXT "&Пользователь:", 1413, 10, 61, 90, 8 EDITTEXT 1104, 104, 58, 154, 14, ES_AUTOHSCROLL - LTEXT "&:", 1112, 11, 81, 90, 8 + LTEXT "П&ароль:", 1112, 11, 81, 90, 8 EDITTEXT 1103, 104, 77, 154, 14, ES_PASSWORD | ES_AUTOHSCROLL CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN, 10, 98, 248, 1 - AUTOCHECKBOX "& :", 1101, 14, 105, 242, 13, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP - AUTORADIOBUTTON " & ", 1622, 26, 119, 225, 11, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP - AUTORADIOBUTTON " & ", 1623, 26, 133, 225, 11, BS_LEFT | BS_TOP | BS_MULTILINE + AUTOCHECKBOX "С&охранять имя пользователя и пароль:", 1101, 14, 105, 242, 13, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP + AUTORADIOBUTTON "только дл&я меня", 1622, 26, 119, 225, 11, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP + AUTORADIOBUTTON "для л&юбого пользователя", 1623, 26, 133, 225, 11, BS_LEFT | BS_TOP | BS_MULTILINE CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 10, 149, 248, 1 - LTEXT "&:", 1412, 14, 161, 87, 8 + LTEXT "&Набрать:", 1412, 14, 161, 87, 8 COMBOBOX 1416, 104, 157, 154, 112, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | NOT WS_TABSTOP - LTEXT "& :", 1415, 14, 178, 88, 8 + LTEXT "&Место вызова:", 1415, 14, 178, 88, 8 COMBOBOX 1414, 104, 175, 87, 112, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | NOT WS_TABSTOP - PUSHBUTTON "&", 1108, 193, 175, 65, 14 + PUSHBUTTON "Прави&ла", 1108, 193, 175, 65, 14 CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 10, 196, 248, 1 - DEFPUSHBUTTON "&", 1590, 9, 202, 60, 14, WS_GROUP - PUSHBUTTON "", 1591, 72, 202, 60, 14 - PUSHBUTTON "&", 1107, 135, 202, 60, 14 - PUSHBUTTON "&", 1592, 198, 202, 60, 14 + DEFPUSHBUTTON "В&ызов", 1590, 9, 202, 60, 14, WS_GROUP + PUSHBUTTON "Отмена", 1591, 72, 202, 60, 14 + PUSHBUTTON "Сво&йства", 1107, 135, 202, 60, 14 + PUSHBUTTON "&Справка", 1592, 198, 202, 60, 14 END 1422 DIALOGEX 0, 0, 265, 242 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION " %1" +CAPTION "Подключение к %1" FONT 8, "MS Shell Dlg" BEGIN CONTROL 1678, 1100, "STATIC", SS_BITMAP, 0, 0, 265, 50 - LTEXT "&:", 1413, 10, 67, 91, 8 + LTEXT "&Пользователь:", 1413, 10, 67, 91, 8 EDITTEXT 1104, 104, 63, 154, 14, ES_AUTOHSCROLL - LTEXT "&:", 1112, 10, 85, 92, 8 + LTEXT "П&ароль:", 1112, 10, 85, 92, 8 EDITTEXT 1103, 104, 82, 154, 14, ES_PASSWORD | ES_AUTOHSCROLL - LTEXT "&:", 1110, 10, 104, 92, 8 + LTEXT "&Домен:", 1110, 10, 104, 92, 8 EDITTEXT 1102, 104, 101, 154, 14, ES_UPPERCASE | ES_AUTOHSCROLL CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN, 10, 121, 248, 1 - AUTOCHECKBOX "& :", 1101, 12, 127, 242, 13, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP - AUTORADIOBUTTON " & ", 1622, 24, 141, 227, 11, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP - AUTORADIOBUTTON " & ", 1623, 24, 155, 230, 11, BS_LEFT | BS_TOP | BS_MULTILINE + AUTOCHECKBOX "С&охранять имя пользователя и пароль:", 1101, 12, 127, 242, 13, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP + AUTORADIOBUTTON "только дл&я меня", 1622, 24, 141, 227, 11, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP + AUTORADIOBUTTON "для л&юбого пользователя", 1623, 24, 155, 230, 11, BS_LEFT | BS_TOP | BS_MULTILINE CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 10, 170, 248, 1 - LTEXT "&:", 1412, 14, 182, 87, 8 + LTEXT "&Набрать:", 1412, 14, 182, 87, 8 COMBOBOX 1416, 104, 178, 154, 112, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | NOT WS_TABSTOP - LTEXT "& :", 1415, 14, 198, 87, 8 + LTEXT "&Место вызова:", 1415, 14, 198, 87, 8 COMBOBOX 1414, 104, 195, 87, 112, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | NOT WS_TABSTOP - PUSHBUTTON "&", 1108, 193, 195, 65, 14 + PUSHBUTTON "Прави&ла", 1108, 193, 195, 65, 14 CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 10, 215, 248, 1 - DEFPUSHBUTTON "&", 1590, 8, 221, 60, 14, WS_GROUP - PUSHBUTTON "", 1591, 71, 221, 60, 14 - PUSHBUTTON "&", 1107, 134, 221, 60, 14 - PUSHBUTTON "&", 1592, 198, 221, 60, 14 + DEFPUSHBUTTON "В&ызов", 1590, 8, 221, 60, 14, WS_GROUP + PUSHBUTTON "Отмена", 1591, 71, 221, 60, 14 + PUSHBUTTON "Сво&йства", 1107, 134, 221, 60, 14 + PUSHBUTTON "&Справка", 1592, 198, 221, 60, 14 END 1425 DIALOGEX 0, 0, 230, 215 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION -CAPTION "" +CAPTION "Общие" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "& IP- (, reactos.org 145.52.0.1):", 1430, 7, 5, 217, 18 + LTEXT "&Имя компьютера или IP-адрес назначения (например, reactos.org или 145.52.0.1):", 1430, 7, 5, 217, 18 EDITTEXT 1427, 7, 25, 215, 14, ES_AUTOHSCROLL - GROUPBOX " ", 1431, 9, 48, 213, 78 - LTEXT " , , , .", 1432, 17, 63, 199, 24 - AUTOCHECKBOX "& :", 1428, 19, 89, 183, 10 + GROUPBOX "Очередность установления подключения", 1431, 9, 48, 213, 78 + LTEXT "Перед тем как установить виртуальное подключение, можно сначала подключиться к общедоступной сети, например, к Интернет.", 1432, 17, 63, 199, 24 + AUTOCHECKBOX "&Сначала набрать номер для этого подключения:", 1428, 19, 89, 183, 10 COMBOBOX 1429, 29, 103, 182, 87, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | NOT WS_TABSTOP - AUTOCHECKBOX " & ", 1120, 10, 192, 213, 13 + AUTOCHECKBOX "При подключении в&ывести значок в области уведомлений", 1120, 10, 192, 213, 13 END 1426 DIALOGEX 0, 0, 230, 215 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION "" +CAPTION "Параметры" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ", 1289, 8, 7, 214, 56 - AUTOCHECKBOX "& ", 1284, 16, 17, 199, 10 - AUTOCHECKBOX "& , , ..", 1554, 16, 32, 199, 10 - AUTOCHECKBOX "& ReactOS", 1555, 16, 47, 178, 10 - GROUPBOX " ", 1290, 8, 68, 214, 89 - LTEXT "& :", 1300, 16, 81, 121, 8 + GROUPBOX "Параметры набора номера", 1289, 8, 7, 214, 56 + AUTOCHECKBOX "&Отображать ход подключения", 1284, 16, 17, 199, 10 + AUTOCHECKBOX "&Запрашивать имя, пароль, сертификат и т.д.", 1554, 16, 32, 199, 10 + AUTOCHECKBOX "Вкл&ючать домен входа в ReactOS", 1555, 16, 47, 178, 10 + GROUPBOX "Параметры повторного звонка", 1290, 8, 68, 214, 89 + LTEXT "&Число повторений набора номера:", 1300, 16, 81, 121, 8 EDITTEXT 1287, 140, 77, 70, 14, ES_AUTOHSCROLL | ES_NUMBER - LTEXT " & :", 1301, 16, 99, 121, 8 + LTEXT "Интервал ме&жду повторениями:", 1301, 16, 99, 121, 8 COMBOBOX 1292, 141, 95, 70, 123, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - LTEXT "& :", 1299, 16, 117, 121, 8 + LTEXT "Вре&мя простоя до разъединения:", 1299, 16, 117, 121, 8 COMBOBOX 1291, 141, 113, 70, 108, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - AUTOCHECKBOX "& ", 1286, 16, 138, 199, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "П&ерезвонить при разрыве связи", 1286, 16, 138, 199, 10, BS_TOP | BS_MULTILINE END 1427 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT " IP- , .", -1, 10, 6, 275, 16 - LTEXT "& IP- (, reactos.org 145.52.0.1):", -1, 21, 28, 277, 11 + LTEXT "Введите имя узла или IP-адрес компьютера, к которому осуществляется подключение.", -1, 10, 6, 275, 16 + LTEXT "&Имя компьютера или IP-адрес (например, reactos.org или 145.52.0.1):", -1, 21, 28, 277, 11 EDITTEXT 1433, 21, 42, 275, 14, ES_AUTOHSCROLL END 1428 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Мастер новых подключений" FONT 8, "MS Shell Dlg" BEGIN - LTEXT ", .", -1, 10, 6, 275, 24 - AUTORADIOBUTTON "& .", 1509, 32, 31, 271, 10, BS_TOP | BS_MULTILINE | NOT WS_TABSTOP - AUTORADIOBUTTON "& :", 1510, 32, 45, 269, 10, BS_TOP | BS_MULTILINE | NOT WS_TABSTOP + LTEXT "Выберите, надо ли автоматически подключаться к Интернету или иной общей сети перед установлением виртуального подключения.", -1, 10, 6, 275, 24 + AUTORADIOBUTTON "Н&е набирать номер для предварительного подключения.", 1509, 32, 31, 271, 10, BS_TOP | BS_MULTILINE | NOT WS_TABSTOP + AUTORADIOBUTTON "Н&абрать номер для следующего предварительного подключения:", 1510, 32, 45, 269, 10, BS_TOP | BS_MULTILINE | NOT WS_TABSTOP COMBOBOX 1435, 43, 62, 253, 87, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | NOT WS_TABSTOP END 1436 DIALOGEX 0, 0, 230, 215 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION -CAPTION "" +CAPTION "Общие" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "& :", 1597, 8, 5, 213, 8 + LTEXT "&Выберите устройство:", 1597, 8, 5, 213, 8 COMBOBOX 1437, 7, 17, 217, 166, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | NOT WS_TABSTOP - AUTOCHECKBOX " & ", 1120, 11, 195, 213, 10, BS_TOP | BS_MULTILINE - PUSHBUTTON "&...", 1130, 160, 34, 60, 14 + AUTOCHECKBOX "При подключении в&ывести значок в области уведомлений", 1120, 11, 195, 213, 10, BS_TOP | BS_MULTILINE + PUSHBUTTON "&Настроить...", 1130, 160, 34, 60, 14 END 1448 DIALOGEX 10, 20, 265, 71 STYLE DS_SHELLFONT | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION " " +CAPTION "Сетевые подключения" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "& :", 1456, 7, 7, 251, 10 + LTEXT "&Выберите сетевое подключение:", 1456, 7, 7, 251, 10 COMBOBOX 1457, 8, 18, 250, 140, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | NOT WS_TABSTOP - DEFPUSHBUTTON "&...", 1449, 7, 50, 60, 14 - PUSHBUTTON "", 1455, 70, 50, 60, 14 - PUSHBUTTON "&...", 1459, 134, 50, 60, 14 - PUSHBUTTON "&", 1460, 198, 50, 60, 14 + DEFPUSHBUTTON "&Подключить...", 1449, 7, 50, 60, 14 + PUSHBUTTON "Отмена", 1455, 70, 50, 60, 14 + PUSHBUTTON "Созда&ть...", 1459, 134, 50, 60, 14 + PUSHBUTTON "&Свойства", 1460, 198, 50, 60, 14 END 1466 DIALOGEX 6, 18, 265, 262 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT "", 1469, 7, 7, 251, 8 + LTEXT "Образец", 1469, 7, 7, 251, 8 EDITTEXT 1470, 7, 17, 193, 14, ES_AUTOHSCROLL - PUSHBUTTON "&", 1471, 77, 36, 60, 14 - PUSHBUTTON "&", 1472, 141, 36, 60, 14 - LTEXT "", 1473, 7, 57, 193, 8 + PUSHBUTTON "&Добавить", 1471, 77, 36, 60, 14 + PUSHBUTTON "&Заменить", 1472, 141, 36, 60, 14 + LTEXT "Образец", 1473, 7, 57, 193, 8 LISTBOX 1474, 7, 68, 193, 145, WS_VSCROLL | WS_TABSTOP PUSHBUTTON "", 1475, 206, 68, 51, 14, BS_BITMAP | WS_GROUP - PUSHBUTTON "&", 1476, 206, 86, 51, 14, BS_BITMAP - PUSHBUTTON "&", 1477, 141, 215, 60, 14 + PUSHBUTTON "В&низ", 1476, 206, 86, 51, 14, BS_BITMAP + PUSHBUTTON "&Удалить", 1477, 141, 215, 60, 14 CONTROL "", 1479, "STATIC", SS_ETCHEDHORZ, 7, 233, 249, 1 PUSHBUTTON "OK", 1, 132, 242, 60, 14, WS_GROUP - PUSHBUTTON "", 2, 196, 242, 60, 14 + PUSHBUTTON "Отмена", 2, 196, 242, 60, 14 END 1467 DIALOGEX 6, 18, 263, 263 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT "", 1469, 7, 7, 197, 8 + LTEXT "Образец", 1469, 7, 7, 197, 8 EDITTEXT 1470, 7, 17, 193, 14, ES_AUTOHSCROLL - PUSHBUTTON "&", 1471, 76, 36, 60, 14 - PUSHBUTTON "&", 1472, 141, 36, 60, 14 - LTEXT "", 1473, 7, 57, 193, 8 + PUSHBUTTON "&Добавить", 1471, 76, 36, 60, 14 + PUSHBUTTON "&Заменить", 1472, 141, 36, 60, 14 + LTEXT "Образец", 1473, 7, 57, 193, 8 LISTBOX 1474, 7, 68, 193, 135, WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "&", 1475, 206, 68, 51, 14, BS_BITMAP | WS_GROUP - PUSHBUTTON "&", 1476, 206, 86, 51, 14, BS_BITMAP - PUSHBUTTON "&", 1477, 141, 204, 60, 14 - AUTOCHECKBOX "", 1478, 7, 225, 249, 10, BS_TOP | BS_MULTILINE + PUSHBUTTON "&Вверх", 1475, 206, 68, 51, 14, BS_BITMAP | WS_GROUP + PUSHBUTTON "В&низ", 1476, 206, 86, 51, 14, BS_BITMAP + PUSHBUTTON "&Удалить", 1477, 141, 204, 60, 14 + AUTOCHECKBOX "Образец", 1478, 7, 225, 249, 10, BS_TOP | BS_MULTILINE PUSHBUTTON "OK", 1, 132, 242, 60, 14, WS_GROUP - PUSHBUTTON "", 2, 196, 242, 60, 14 + PUSHBUTTON "Отмена", 2, 196, 242, 60, 14 END 1468 DIALOGEX 6, 18, 263, 263 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT "", 1469, 7, 5, 249, 8 + LTEXT "Образец", 1469, 7, 5, 249, 8 EDITTEXT 1470, 7, 17, 249, 14, ES_AUTOHSCROLL - PUSHBUTTON "&", 1471, 132, 36, 60, 14 - PUSHBUTTON "&", 1472, 196, 36, 60, 14 - LTEXT "", 1473, 7, 55, 251, 8 + PUSHBUTTON "&Добавить", 1471, 132, 36, 60, 14 + PUSHBUTTON "&Заменить", 1472, 196, 36, 60, 14 + LTEXT "Образец", 1473, 7, 55, 251, 8 LISTBOX 1474, 7, 68, 249, 140, LBS_STANDARD | WS_TABSTOP - PUSHBUTTON "&", 1477, 196, 214, 60, 14, WS_GROUP + PUSHBUTTON "&Удалить", 1477, 196, 214, 60, 14, WS_GROUP CONTROL "", 1479, "STATIC", SS_ETCHEDHORZ, 7, 233, 249, 1 PUSHBUTTON "OK", 1, 132, 242, 60, 14, WS_GROUP - PUSHBUTTON "", 2, 196, 242, 60, 14 + PUSHBUTTON "Отмена", 2, 196, 242, 60, 14 END 1469 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Мастер новых подключений" FONT 8, "MS Shell Dlg" BEGIN - AUTORADIOBUTTON "& .", 1488, 24, 9, 250, 10, NOT WS_TABSTOP - AUTORADIOBUTTON "& .", 1489, 24, 34, 250, 10, NOT WS_TABSTOP - AUTORADIOBUTTON "& .", 1490, 24, 64, 250, 10, NOT WS_TABSTOP - AUTORADIOBUTTON " & ", 1491, 24, 94, 275, 10, NOT WS_TABSTOP - LTEXT " ISDN.", -1, 45, 21, 250, 8 - LTEXT " (VPN) .", -1, 45, 46, 260, 18 - LTEXT " , .", -1, 44, 76, 264, 18 - LTEXT " .", -1, 43, 105, 266, 14 + AUTORADIOBUTTON "&Телефонное подключение к частной сети.", 1488, 24, 9, 250, 10, NOT WS_TABSTOP + AUTORADIOBUTTON "Подключ&ение к виртуальной частной сети через Интернет.", 1489, 24, 34, 250, 10, NOT WS_TABSTOP + AUTORADIOBUTTON "&Прямое подключение к другому компьютеру.", 1490, 24, 64, 250, 10, NOT WS_TABSTOP + AUTORADIOBUTTON "Подключение к сети через &высокоскоростное соединение", 1491, 24, 94, 275, 10, NOT WS_TABSTOP + LTEXT "Подключение через модем или адаптер ISDN.", -1, 45, 21, 250, 8 + LTEXT "Подключение через виртуальную частную сеть (VPN) или туннель через Интернет.", -1, 45, 46, 260, 18 + LTEXT "Подключение через последовательный, параллельный или инфракрасный порт.", -1, 44, 76, 264, 18 + LTEXT "Подключение через ваше высокоскоростное соединение.", -1, 43, 105, 266, 14 END 1480 DIALOGEX 0, 0, 230, 61 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION " " +CAPTION "Редактор номера телефона" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "& :", 1481, 7, 7, 218, 8 + LTEXT "&Введите новый номер телефона:", 1481, 7, 7, 218, 8 EDITTEXT 1482, 7, 17, 217, 15, ES_AUTOHSCROLL DEFPUSHBUTTON "OK", 1, 99, 40, 60, 14 - PUSHBUTTON "", 2, 163, 40, 60, 14 + PUSHBUTTON "Отмена", 2, 163, 40, 60, 14 END 1481 DIALOGEX 0, 0, 321, 157 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Мастер новых подключений" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " , . ( , .)", 1689, 10, 4, 308, 25 - LTEXT "&:", 1636, 23, 35, 89, 15 + LTEXT "Введите имя и пароль для учетной записи поставщика услуг Интернета, запишите и храните в безопасном месте. (Обратитесь к поставщику, если забыли эти сведения.)", 1689, 10, 4, 308, 25 + LTEXT "&Пользователь:", 1636, 23, 35, 89, 15 EDITTEXT 1614, 115, 34, 190, 15, ES_AUTOHSCROLL - LTEXT "&:", 1637, 23, 55, 90, 13 + LTEXT "П&ароль:", 1637, 23, 55, 90, 13 EDITTEXT 1615, 115, 54, 190, 15, ES_PASSWORD | ES_AUTOHSCROLL - LTEXT "&:", 1638, 23, 74, 88, 13 + LTEXT "Под&тверждение:", 1638, 23, 74, 88, 13 EDITTEXT 1616, 115, 73, 190, 15, ES_PASSWORD | ES_AUTOHSCROLL - AUTOCHECKBOX "& :", 1596, 23, 91, 291, 17, BS_LEFT | BS_TOP | BS_MULTILINE - AUTOCHECKBOX " & ", 1595, 23, 112, 288, 14 - AUTOCHECKBOX "& ", 1682, 23, 133, 290, 14 + AUTOCHECKBOX "И&спользовать следующие имя пользователя и пароль при подключении любого пользователя:", 1596, 23, 91, 291, 17, BS_LEFT | BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Сделать &это подключение подключением к Интернет по умолчанию", 1595, 23, 112, 288, 14 + AUTOCHECKBOX "&Включить брандмауэр для подключения к Интернет", 1682, 23, 133, 290, 14 END 1660 DIALOGEX 0, 0, 258, 78 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION " " +CAPTION "Брандмауэр подключения к Интернет" FONT 8, "MS Shell Dlg" BEGIN ICON 32515, -1, 7, 7, 20, 20 - LTEXT " . ?", -1, 44, 5, 212, 35 - AUTOCHECKBOX " & ", 1662, 42, 42, 210, 10 - DEFPUSHBUTTON "&", 6, 74, 60, 50, 14 - PUSHBUTTON "&", 7, 128, 60, 50, 14 + LTEXT "Отключение брандмауэра подключения к Интернет может привести к неавторизованному доступу через Интернет к вашему компьютеру. Вы действительно хотите отключить защиту?", -1, 44, 5, 212, 35 + AUTOCHECKBOX "Не в&ыводить это окно в дальнейшем", 1662, 42, 42, 210, 10 + DEFPUSHBUTTON "Д&а", 6, 74, 60, 50, 14 + PUSHBUTTON "Н&ет", 7, 128, 60, 50, 14 END 7000 DIALOGEX 0, 0, 215, 103 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUPWINDOW | WS_CAPTION -CAPTION "" +CAPTION "Общие" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "&:", -1, 7, 8, 90, 12, SS_CENTERIMAGE + LTEXT "&Пользователь:", -1, 7, 8, 90, 12, SS_CENTERIMAGE EDITTEXT 7001, 101, 7, 108, 14, ES_AUTOHSCROLL - LTEXT "& :", -1, 7, 26, 90, 12 + LTEXT "П&олное имя:", -1, 7, 26, 90, 12 EDITTEXT 7002, 101, 25, 108, 14, ES_AUTOHSCROLL - LTEXT "&:", -1, 7, 44, 90, 12 + LTEXT "П&ароль:", -1, 7, 44, 90, 12 EDITTEXT 7003, 101, 43, 108, 14, ES_PASSWORD | ES_AUTOHSCROLL - LTEXT "&:", -1, 7, 62, 91, 12 + LTEXT "По&дтверждение:", -1, 7, 62, 91, 12 EDITTEXT 7004, 101, 61, 108, 14, ES_PASSWORD | ES_AUTOHSCROLL PUSHBUTTON "OK", 1, 84, 82, 60, 14 - PUSHBUTTON "", 2, 149, 82, 60, 14 + PUSHBUTTON "Отмена", 2, 149, 82, 60, 14 END 7005 DIALOGEX 0, 0, 230, 215 STYLE DS_SHELLFONT | DS_CONTEXTHELP | WS_CHILD | WS_CAPTION -CAPTION " " +CAPTION "Ответный вызов сервера" FONT 8, "MS Shell Dlg" BEGIN - AUTORADIOBUTTON "& ", 7009, 9, 7, 219, 10, BS_TOP | BS_MULTILINE | WS_GROUP - AUTORADIOBUTTON "& ", 7006, 9, 20, 218, 10, BS_TOP | BS_MULTILINE | NOT WS_TABSTOP - AUTORADIOBUTTON "& :", 7007, 9, 34, 217, 10, BS_TOP | BS_MULTILINE | NOT WS_TABSTOP + AUTORADIOBUTTON "&Запретить ответный вызов", 7009, 9, 7, 219, 10, BS_TOP | BS_MULTILINE | WS_GROUP + AUTORADIOBUTTON "З&вонящий может выбрать номер ответного вызова", 7006, 9, 20, 218, 10, BS_TOP | BS_MULTILINE | NOT WS_TABSTOP + AUTORADIOBUTTON "&Только этот номер для ответного вызова:", 7007, 9, 34, 217, 10, BS_TOP | BS_MULTILINE | NOT WS_TABSTOP EDITTEXT 7008, 19, 49, 204, 14, ES_AUTOHSCROLL | WS_GROUP END 7010 DIALOGEX 0, 0, 230, 215 STYLE DS_SHELLFONT | DS_CONTEXTHELP | WS_CHILD | WS_CAPTION -CAPTION "" +CAPTION "Общие" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ", -1, 7, 4, 214, 110, WS_GROUP - LTEXT " :", -1, 17, 17, 195, 8 - LTEXT "&:", -1, 17, 29, 60, 8 + GROUPBOX "Входящие подключения", -1, 7, 4, 214, 110, WS_GROUP + LTEXT "Входящие подключения будут разрешены для устройств:", -1, 17, 17, 195, 8 + LTEXT "&Устройства:", -1, 17, 29, 60, 8 CONTROL "", 7011, "SYSLISTVIEW32", WS_BORDER | WS_GROUP | WS_TABSTOP | 0x00004405, 17, 41, 193, 47, WS_EX_CLIENTEDGE - AUTOCHECKBOX "& ", 7012, 17, 96, 121, 10, BS_TOP | BS_MULTILINE | WS_GROUP - PUSHBUTTON "&", 7013, 145, 94, 65, 14, WS_GROUP - GROUPBOX " (VPN)", -1, 6, 122, 214, 49, WS_GROUP - AUTOCHECKBOX "& ", 7014, 17, 137, 195, 27, BS_TOP | BS_MULTILINE | WS_GROUP - AUTOCHECKBOX " & ", 7015, 12, 184, 209, 10, BS_TOP | BS_MULTILINE | WS_GROUP + AUTOCHECKBOX "М&ногоканальное подключение", 7012, 17, 96, 121, 10, BS_TOP | BS_MULTILINE | WS_GROUP + PUSHBUTTON "&Свойства", 7013, 145, 94, 65, 14, WS_GROUP + GROUPBOX "Виртуальная частная сеть (VPN)", -1, 6, 122, 214, 49, WS_GROUP + AUTOCHECKBOX "&Разрешить другим пользователям устанавливать частное подключение к моему компьютеру с помощью туннеля в Интернете или в другой сети", 7014, 17, 137, 195, 27, BS_TOP | BS_MULTILINE | WS_GROUP + AUTOCHECKBOX "При подключении &вывести значок в области уведомлений", 7015, 12, 184, 209, 10, BS_TOP | BS_MULTILINE | WS_GROUP END 7016 DIALOGEX 0, 0, 265, 190 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUPWINDOW | WS_CAPTION -CAPTION " TCP/IP" +CAPTION "Свойства входящих вызовов TCP/IP" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ", -1, 6, 5, 252, 32 - AUTOCHECKBOX "& ", 7017, 20, 20, 228, 9, BS_LEFT | BS_TOP | BS_MULTILINE - GROUPBOX " TCP/IP", -1, 6, 42, 250, 122 - AUTORADIOBUTTON "& TCP/IP DHCP", 7019, 20, 54, 231, 10, BS_TOP | BS_MULTILINE | WS_GROUP - AUTORADIOBUTTON "& TCP/IP ", 7020, 20, 71, 231, 10, BS_TOP | BS_MULTILINE - LTEXT "&:", -1, 29, 88, 53, 8 + GROUPBOX "Доступ к сети", -1, 6, 5, 252, 32 + AUTOCHECKBOX "&Разрешить звонящим доступ к локальной сети", 7017, 20, 20, 228, 9, BS_LEFT | BS_TOP | BS_MULTILINE + GROUPBOX "Назначение адресов TCP/IP", -1, 6, 42, 250, 122 + AUTORADIOBUTTON "&Назначить адреса TCP/IP автоматически по DHCP", 7019, 20, 54, 231, 10, BS_TOP | BS_MULTILINE | WS_GROUP + AUTORADIOBUTTON "&Указать адреса TCP/IP явным образом", 7020, 20, 71, 231, 10, BS_TOP | BS_MULTILINE + LTEXT "&С:", -1, 29, 88, 53, 8 CONTROL "", 7018, "RASIPADDRESS", WS_GROUP | WS_TABSTOP, 90, 85, 103, 13 - LTEXT "&:", -1, 29, 105, 53, 8 + LTEXT "&По:", -1, 29, 105, 53, 8 CONTROL "", 7021, "RASIPADDRESS", WS_GROUP | WS_TABSTOP, 90, 102, 103, 13 - LTEXT ":", -1, 29, 124, 53, 10 + LTEXT "Всего:", -1, 29, 124, 53, 10 LTEXT "", 7024, 90, 121, 150, 14, 0, WS_EX_STATICEDGE - AUTOCHECKBOX "& IP", 7022, 20, 144, 231, 10, BS_TOP | BS_MULTILINE | WS_GROUP + AUTOCHECKBOX "Разре&шить звонящему указать свой адрес IP", 7022, 20, 144, 231, 10, BS_TOP | BS_MULTILINE | WS_GROUP DEFPUSHBUTTON "OK", 1, 133, 169, 60, 14, WS_GROUP - PUSHBUTTON "", 2, 197, 169, 60, 14 + PUSHBUTTON "Отмена", 2, 197, 169, 60, 14 END 7025 DIALOGEX 0, 0, 250, 157 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUPWINDOW | WS_CAPTION -CAPTION " IPX" +CAPTION "Свойства входящих вызовов IPX" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ", -1, 8, 6, 234, 32 - AUTOCHECKBOX "& ", 7032, 18, 19, 194, 12, BS_LEFT | BS_TOP | BS_MULTILINE - GROUPBOX " ", -1, 8, 43, 234, 87 - AUTOCHECKBOX "& ", 7028, 17, 56, 203, 10, BS_TOP | BS_MULTILINE | WS_GROUP - AUTORADIOBUTTON "& ", 7026, 28, 68, 191, 10, BS_TOP | BS_MULTILINE | WS_GROUP - AUTORADIOBUTTON "& :", 7027, 28, 81, 189, 10, BS_TOP | BS_MULTILINE | NOT WS_TABSTOP + GROUPBOX "Доступ к сети", -1, 8, 6, 234, 32 + AUTOCHECKBOX "&Разрешить звонящим доступ к локальной сети", 7032, 18, 19, 194, 12, BS_LEFT | BS_TOP | BS_MULTILINE + GROUPBOX "Назначение номера сети", -1, 8, 43, 234, 87 + AUTOCHECKBOX "&Присвоить единый номер сети всем компьютерам", 7028, 17, 56, 203, 10, BS_TOP | BS_MULTILINE | WS_GROUP + AUTORADIOBUTTON "&Назначать номера сети автоматически", 7026, 28, 68, 191, 10, BS_TOP | BS_MULTILINE | WS_GROUP + AUTORADIOBUTTON "&Указать номер сети явным образом:", 7027, 28, 81, 189, 10, BS_TOP | BS_MULTILINE | NOT WS_TABSTOP EDITTEXT 7029, 40, 92, 154, 14, ES_UPPERCASE | WS_GROUP - AUTOCHECKBOX "& ", 7031, 17, 113, 208, 11, BS_TOP | BS_MULTILINE | WS_GROUP + AUTOCHECKBOX "Р&азрешить звонящим указать их собственные номера узлов", 7031, 17, 113, 208, 11, BS_TOP | BS_MULTILINE | WS_GROUP DEFPUSHBUTTON "OK", 1, 116, 136, 60, 14, WS_GROUP - PUSHBUTTON "", 2, 181, 136, 60, 14 + PUSHBUTTON "Отмена", 2, 181, 136, 60, 14 END 7033 DIALOGEX 0, 0, 220, 50 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUPWINDOW | WS_CAPTION -CAPTION " " +CAPTION "Свойства протоколов" FONT 8, "MS Shell Dlg" BEGIN - AUTOCHECKBOX "& ", 7034, 7, 7, 208, 18, BS_LEFT | BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Разрешить звонящим доступ к локальной сети", 7034, 7, 7, 208, 18, BS_LEFT | BS_TOP | BS_MULTILINE DEFPUSHBUTTON "OK", 1, 86, 30, 60, 14 - PUSHBUTTON "", 2, 151, 30, 60, 14 + PUSHBUTTON "Отмена", 2, 151, 30, 60, 14 END 7035 DIALOGEX 0, 0, 230, 215 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUPWINDOW | WS_CAPTION -CAPTION "" +CAPTION "Сеть" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "& :", -1, 7, 7, 217, 9 + LTEXT "&Сетевые компоненты:", -1, 7, 7, 217, 9 CONTROL "", 7036, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x0000440D, 7, 17, 215, 89, WS_EX_CLIENTEDGE - PUSHBUTTON "&...", 7037, 9, 110, 67, 14, WS_GROUP - PUSHBUTTON "&", 7038, 80, 110, 67, 14, WS_GROUP - PUSHBUTTON "&", 7039, 153, 110, 67, 14, WS_GROUP - GROUPBOX "", -1, 7, 138, 213, 69 + PUSHBUTTON "Ус&тановить...", 7037, 9, 110, 67, 14, WS_GROUP + PUSHBUTTON "&Удалить", 7038, 80, 110, 67, 14, WS_GROUP + PUSHBUTTON "С&войства", 7039, 153, 110, 67, 14, WS_GROUP + GROUPBOX "Описание", -1, 7, 138, 213, 69 LTEXT "", 7040, 17, 150, 193, 48 END 7042 DIALOGEX 0, 0, 230, 215 STYLE DS_SHELLFONT | DS_CONTEXTHELP | WS_CHILD | WS_CAPTION -CAPTION "" +CAPTION "Пользователи" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "&, :", -1, 7, 5, 213, 8 + LTEXT "&Пользователи, которым разрешено подключение:", -1, 7, 5, 213, 8 CONTROL "", 7043, "SYSLISTVIEW32", WS_BORDER | WS_GROUP | WS_TABSTOP | 0x0000440D, 7, 19, 214, 83, WS_EX_CLIENTEDGE - PUSHBUTTON "&...", 7044, 7, 107, 67, 14, WS_GROUP - PUSHBUTTON "&", 7045, 80, 107, 67, 14, WS_GROUP - PUSHBUTTON "&", 7046, 153, 107, 67, 14, WS_GROUP - AUTOCHECKBOX "& .", 7048, 8, 151, 217, 18, BS_TOP | BS_MULTILINE - AUTOCHECKBOX "& , (palmtop PC).", 7049, 8, 169, 217, 28, BS_TOP | BS_MULTILINE - LTEXT " , , .", -1, 9, 126, 212, 23 + PUSHBUTTON "&Новый...", 7044, 7, 107, 67, 14, WS_GROUP + PUSHBUTTON "&Удалить", 7045, 80, 107, 67, 14, WS_GROUP + PUSHBUTTON "&Свойства", 7046, 153, 107, 67, 14, WS_GROUP + AUTOCHECKBOX "&Все пользователи должны держать в секрете свои пароли и данные.", 7048, 8, 151, 217, 18, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Вс&егда разрешать подключение без пароля устройствам с прямым соединением, таким как карманные компьютеры (palmtop PC).", 7049, 8, 169, 217, 28, BS_TOP | BS_MULTILINE + LTEXT "Другие факторы, такие как отключенная учетная запись пользователя, могут препятствовать подключению пользователя.", -1, 9, 126, 212, 23 END 7049 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT " , . , , .", -1, 10, 1, 300, 27 - LTEXT "&, :", -1, 10, 28, 275, 8 + LTEXT "Установите флажки рядом с пользователями, которым разрешено подключаться к этому компьютеру. Другие факторы, такие как отключенная учетная запись пользователя, могут препятствовать подключению пользователя.", -1, 10, 1, 300, 27 + LTEXT "&Пользователи, которым разрешено подключение:", -1, 10, 28, 275, 8 CONTROL "", 7043, "SYSLISTVIEW32", WS_BORDER | WS_GROUP | WS_TABSTOP | 0x0000440D, 10, 42, 275, 73 - PUSHBUTTON "&...", 7044, 10, 122, 65, 14, WS_GROUP - PUSHBUTTON "&", 7045, 79, 122, 65, 14, WS_GROUP - PUSHBUTTON "&", 7046, 147, 122, 65, 14, WS_GROUP + PUSHBUTTON "Д&обавить...", 7044, 10, 122, 65, 14, WS_GROUP + PUSHBUTTON "&Удалить", 7045, 79, 122, 65, 14, WS_GROUP + PUSHBUTTON "&Свойства", 7046, 147, 122, 65, 14, WS_GROUP END 7050 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT " , .", -1, 10, 4, 299, 10 - LTEXT "& :", -1, 10, 16, 275, 8 + LTEXT "Установите флажки рядом с устройствами, используемыми для входящих подключений.", -1, 10, 4, 299, 10 + LTEXT "&Устройства для подключения:", -1, 10, 16, 275, 8 CONTROL "", 7011, "SYSLISTVIEW32", WS_BORDER | WS_GROUP | WS_TABSTOP | 0x0000440D, 10, 26, 297, 87 - PUSHBUTTON "&", 7013, 243, 120, 65, 14, WS_GROUP + PUSHBUTTON "Сво&йства", 7013, 243, 120, 65, 14, WS_GROUP END 7051 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT " , .", -1, 10, 1, 288, 20 - LTEXT " &:", -1, 10, 24, 274, 8 + LTEXT "Установите флажки рядом с именами всех программ для работы с сетью, которые должны быть разрешены для входящих подключений.", -1, 10, 1, 288, 20 + LTEXT "Программы для работы с &сетью:", -1, 10, 24, 274, 8 CONTROL "", 7036, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x0000440D, 10, 34, 286, 33 - PUSHBUTTON "&...", 7037, 108, 71, 60, 14, WS_GROUP - PUSHBUTTON "&", 7038, 172, 71, 60, 14, WS_GROUP - PUSHBUTTON "&", 7039, 236, 71, 60, 14, WS_GROUP + PUSHBUTTON "Ус&тановить...", 7037, 108, 71, 60, 14, WS_GROUP + PUSHBUTTON "&Удалить", 7038, 172, 71, 60, 14, WS_GROUP + PUSHBUTTON "&Свойства", 7039, 236, 71, 60, 14, WS_GROUP LTEXT "", 7040, 21, 105, 273, 38 - LTEXT ":", -1, 21, 95, 275, 8 + LTEXT "Описание:", -1, 21, 95, 275, 8 END 7052 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT " , IP- .", -1, 10, 4, 290, 20 - AUTORADIOBUTTON "& ", 7053, 29, 63, 265, 10, BS_TOP | BS_MULTILINE | WS_GROUP - AUTORADIOBUTTON "& ", 7054, 29, 78, 265, 10, BS_TOP | BS_MULTILINE | NOT WS_TABSTOP - LTEXT " ?", -1, 17, 49, 275, 8 - LTEXT " VPN-, ReactOS , VPN-.", -1, 10, 25, 293, 25 + LTEXT "Виртуальные частные подключения через Интернет возможны только в случае, если компьютер имеет постоянный IP-адрес или имя в Интернете.", -1, 10, 4, 290, 20 + AUTORADIOBUTTON "&Разрешить виртуальные частные подключения", 7053, 29, 63, 265, 10, BS_TOP | BS_MULTILINE | WS_GROUP + AUTORADIOBUTTON "&Запретить виртуальные частные подключения", 7054, 29, 78, 265, 10, BS_TOP | BS_MULTILINE | NOT WS_TABSTOP + LTEXT "Разрешить виртуальные частные подключения к этому компьютеру?", -1, 17, 49, 275, 8 + LTEXT " Если вы разрешите VPN-подключения, ReactOS изменит брандмауэр подключения к Интернет, что позволит вашему компьютеру отправлять и получать VPN-пакеты.", -1, 10, 25, 293, 25 END 7055 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT "& :", -1, 23, 24, 275, 8 + LTEXT "&Устройство для этого подключения:", -1, 23, 24, 275, 8 COMBOBOX 7056, 22, 36, 275, 125, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - LTEXT " .", -1, 10, 4, 275, 17 - PUSHBUTTON "&", 7061, 232, 53, 65, 14, WS_GROUP + LTEXT "Невыбранные устройства не будут задействованы и могут использоваться для других целей.", -1, 10, 4, 275, 17 + PUSHBUTTON "Сво&йства", 7061, 232, 53, 65, 14, WS_GROUP END 7379 DIALOGEX 0, 0, 317, 143 @@ -1818,556 +1818,556 @@ END 19900 DIALOGEX 0, 0, 156, 44 STYLE DS_SHELLFONT | WS_POPUP | WS_CAPTION -CAPTION " " +CAPTION "Удаленный доступ к сети" FONT 8, "MS Shell Dlg" BEGIN ICON 563, 19901, 10, 10, 18, 20 - LTEXT " ...", 19902, 34, 16, 120, 8 + LTEXT "Ожидается запуск служб...", 19902, 34, 16, 120, 8 END STRINGTABLE BEGIN - 187 "&, " - 188 " ( ) %1. ?" - 189 " " - 190 " " - 191 " " - 192 " " - 193 " ." - 194 " \n (NAT), \n .\n \n .\n IP-." - 195 " 0 9." - 196 " . ." - 197 " %1 %2." - 198 " DLL . , ." - 199 " .\n "" "" ." - 200 "" - 201 " ." - 202 " TCP/IP . "" "", """", """", , """"." - 203 " IPX . IPX """"." - 204 " ?" - 205 " %1 ?" - 206 " %1?" - 207 " ""%1"" . ?" - 208 " . ?" - 209 " %1. " - 210 " "" "" ." - 212 " ." - 213 " , """"." + 187 "&Нет, не набирать номер" + 188 "Вы (или программа) запросили информацию с %1. Какое подключение выбрать?" + 189 "Добавить дополнительный номер телефона" + 190 "Задействовать первое из доступных устройств" + 191 "Задействовать все устройства" + 192 "Лишь необходимые устройства" + 193 "Введите имя и пароль пользователя для удаленного доступа к сетевому домену." + 194 "В настоящий момент в качестве протокола маршрутизации используется\nпреобразование сетевых адресов (NAT), которое требуется удалить перед\nиспользованием общего доступа к подключению к Интернету.\nДля удаления преобразования сетевых адресов откройте оснастку диспетчера\nмаршрутизации и удаленного доступа и выберите в левой панели маршрутизатор.\nУдалите протокол преобразования адресов из списка протоколов IP-маршрутизации." + 195 "Междугородный код должен состоять только из цифр от 0 до 9." + 196 "Имя элемента должно содержать хотя бы один непустой знак и не может начинаться с точки. Укажите правильное имя." + 197 "Для этого поля необходимо выбрать значение от %1 до %2." + 198 "Не удалось загрузить библиотеку DLL специальной проверки. Проверьте, правильно ли установлен пакет специальной проверки." + 199 "Выбранное подключение было установлено многопротокольным маршрутизатором.\nИспользуйте ""Администратор маршрутизации и удаленного доступа"" для завершения связи." + 200 "Комментарий" + 201 "Не удалось настроить специальный пакет проверки." + 202 "Протокол TCP/IP не установлен или отключен для маршрутизации и удаленного доступа. Откройте ""Панель управления"", затем ""Сеть"", страницу ""Службы"", откройте свойства службы маршрутизации и удаленного доступа, нажмите кнопку ""Сеть""." + 203 "Протокол IPX не установлен или отключен для маршрутизации и удаленного доступа. Для установки и применения IPX обратитесь к свойствам соединений в папке ""Подключения""." + 204 "Удалить выбранные устройства из этого списка?" + 205 "Удалить %1 из телефонной книги?" + 206 "Отключиться от %1?" + 207 "Файл ""%1"" уже существует. Перезаписать этот файл?" + 208 "В сценарии обнаружены синтаксические ошибки. Вывести на экран журнал ошибок?" + 209 "Установлено соединение с %1. " + 210 "Сделайте правый щелчок по значку ""Монитора удаленного доступа"" для завершения связи или проверки состояния текущего подключения." + 212 "Успешное подключение." + 213 "Выбранный специальный метод проверки должен быть инициализирован, нажмите кнопку ""Свойства""." 214 "lnk" - 215 " (*.rnk)" + 215 "Ярлыки удаленного доступа (*.rnk)" 216 "*.rnk" - 217 " " - 218 " %1. ..." - 219 " ." - 220 " ." - 221 " ." - 222 " ." - 223 ":" - 224 "" - 225 ":" - 226 ":" - 227 "( )" - 228 "&..." - 229 "&" - 230 " " - 231 " " + 217 "Создать ярлык удаленного доступа" + 218 "Не удалось связаться с %1. Ожидается повторное подключение..." + 219 "Не удалось получить данные о формировании пакетов." + 220 "Не удалось получить данные о портах." + 221 "Не удалось получить данные о проекции." + 222 "Не удалось загрузить список подключений." + 223 "Клиент:" + 224 "Сведения" + 225 "Устройство:" + 226 "Сеть:" + 227 "(нет подключения)" + 228 "&Подключить..." + 229 "Завер&шить" + 230 "Подключение удаленного доступа" + 231 "Параметры модема установлены по умолчанию" 232 "COM1" - 233 " " - 234 " " - 235 " ." - 236 " %1 . ." - 237 " ." - 238 " " - 239 " ." - 240 "" - 241 "& :" - 242 " " - 243 " " - 244 " , ." - 245 " , . ." - 246 " .\n\n ." - 247 "- ReactOS." - 248 " X.25 ." - 249 " %1: %2" - 250 "%1\n\n: %2: %3" - 251 "%1\n\n %2: %3\n: %4" - 252 "%1\n\n %2: %3\n : %4" - 253 "%1\n\n %2: %3\n\n F1 ." - 254 "%1\n\n %2: %3\n: %4" + 233 "Удаленный маршрутизатор" + 234 "Модем или иное устройство" + 235 "Укажите имя учетной записи для этого интерфейса на удаленном маршрутизаторе." + 236 "Элемент с именем %1 уже существует. Выберите другое имя." + 237 "Вы можете разрешить пересылку вашего пароля без шифрования." + 238 "Шифрование пароля" + 239 "Мастер готов к созданию нового подключения." + 240 "Завершено" + 241 "&Номер телефона:" + 242 "Сервер сделает ответный звонок" + 243 "Изменение дополнительного номера телефона" + 244 "Поскольку это подключение в данный момент используется, изменения ряда параметров будут применены при следующем наборе номера." + 245 "Отсутствуют подключения, доступные всем пользователям. Необходимо выполнить вход в систему." + 246 "Телефонная книга пуста.\n\nНажмите кнопку ОК для добавления элемента." + 247 "Из-за экспортных ограничений шифрование данных не поддерживается этой версией ReactOS." + 248 "Введите адрес X.25 на следующем экране." + 249 "Ошибка %1: %2" + 250 "%1\n\nОшибка: %2: %3" + 251 "%1\n\nОшибка %2: %3\nДиагностика: %4" + 252 "%1\n\nОшибка %2: %3\nКод ошибки: %4" + 253 "%1\n\nОшибка %2: %3\n\nНажмите F1 для получения дополнительных сведений." + 254 "%1\n\nОшибка %2: %3\nИмя: %4" 255 "%1\n\n%4" - 256 "%1\n\n %2: %3\n: %4" - 257 " : 0x%1\n" - 258 ": %1\n" - 259 "%1 %2: %3\n" - 260 "%1 .\n" - 261 " ." - 262 " " - 263 " """" ""%1""." + 256 "%1\n\nОшибка %2: %3\nОтвет: %4" + 257 "Код ошибки: 0x%1\n" + 258 "Имя: %1\n" + 259 "%1 протокол сообщает об ошибке %2: %3\n" + 260 "%1 протокол успешно подключен.\n" + 261 "Можно выбрать используемый протокол удаленного доступа." + 262 "Выберите протокол удаленного доступа" + 263 "Нажмите кнопку ""Готово"" для сохранения ""%1""." 264 "netcfg.hlp" - 265 "& " - 266 "& :" - 267 "& :" - 268 " " - 269 " IP-." - 270 "IP-" - 271 " TCP/IP . "" "", """", """", , """"." + 265 "&Переместить удачный номер в начало списка при подключении" + 266 "&Новый номер телефона:" + 267 "&Номера телефонов:" + 268 "Номера телефонов" + 269 "Можно ввести фиксированный IP-адрес." + 270 "IP-адрес" + 271 "Протоколы TCP/IP не установлены или отключены для удаленного доступа. Откройте ""Панель управления"", затем ""Сеть"", страницу ""Службы"", откройте свойства службы удаленного доступа, нажмите кнопку ""Сеть""." 272 "TCP/IP" - 273 "IPSec, " - 274 "IPX/SPX " - 275 " ( )" + 273 "IPSec, политика по умолчанию" + 274 "IPX/SPX или совместимый" + 275 " (текущее место)" 276 "ISDN" - 277 " ISDN " - 278 "64K " - 279 "56K " - 280 "56K " - 281 " ." - 282 " " + 277 "Все доступные линии ISDN многосвязаны" + 278 "64K цифровой" + 279 "56K цифровой" + 280 "56K голосовой" + 281 "Может потребоваться дополнительная процедура перед подключением." + 282 "Выберите параметры входа в систему" 283 "%d%%" - 284 " %s" - 285 "& :" - 286 "&:" - 287 "" - 288 " ." - 289 " " - 290 " PPP." - 291 "" - 292 " ." - 293 " Point-to-Point MS, 128 RSA/RC4" - 294 " Point-to-Point MS, 40 RSA/RC4" - 295 " " - 296 "( """")" - 297 " DNS WINS." - 298 " " - 299 " RAS" + 284 "Номер телефона для %s" + 285 "&Новое место:" + 286 "&Размещение:" + 287 "Размещение" + 288 "Это устройство будет использовано для подключения." + 289 "Выберите устройство" + 290 "Несколько линий могут быть объединены в пучок только при подключении к серверу PPP." + 291 "Модем" + 292 "Этот модем не установлен." + 293 "Шифрование Point-to-Point MS, 128 бит RSA/RC4" + 294 "Шифрование Point-to-Point MS, 40 бит RSA/RC4" + 295 "Несколько линий" + 296 "(нажмите кнопку ""Настроить"")" + 297 "Можно указать фиксированные адреса DNS и WINS." + 298 "Адреса серверов имен" + 299 "Ранняя версия RAS" 300 "PPP" - 301 " PPP" + 301 "Многоканальный PPP" 302 "SLIP" 303 "NetBEUI" - 304 " , ." - 305 " ." - 306 " ." - 307 " , ." - 308 " . """" , ." - 309 " IP-, "" IP-""." - 310 " X.25-, X.25 X.25." - 311 "()" - 312 """%1"" ." - 313 " " - 314 " %1 , . "" "", """", """", """"." - 315 " ." - 316 " ." - 317 " ." - 318 " ." - 319 " ." - 320 " ." - 321 " ." - 322 " RAS." - 323 " ." - 324 " ." - 325 " script.log notepad.exe" - 326 " switch.inf notepad.exe" - 327 " TAPI." - 328 " X.25." - 329 " ." - 330 " ." - 331 " ." - 332 " /." - 333 " ." - 334 " ." - 335 " ." - 336 " ." - 337 " ." - 338 " TAPI." - 339 " ." - 340 " ." - 341 " - . ?" - 342 " ." - 343 " ." - 344 " ." - 345 " " - 346 " ." - 347 "" - 348 " ISP ." - 349 " " - 350 " ." - 351 " ." + 304 "Была создана личная телефонная книга, в нее скопировано содержимое системной телефонной книги." + 305 "Никакая другая телефонная книга не выбрана." + 306 "Это устройство не может быть настроено динамически." + 307 "Этот элемент не может быть удален, поскольку в данный момент используется для подключения." + 308 "Ни один элемент не выбран. Нажмите кнопку ""Создать"" для того, чтобы создать новый элемент." + 309 "Следует указать ненулевой IP-адрес, если выбран параметр ""укажите IP-адрес""." + 310 "Требуется указать X.25-адрес, когда выбрано удаленное подключение к сети X.25 или к устройству X.25." + 311 "(нет)" + 312 """%1"" уже присутствует в списке." + 313 "Защищать пароль и данные при пересылке" + 314 "Протокол %1 нельзя использовать, поскольку он не установлен или запрещен для удаленного доступа. Для изменения откройте ""Панель управления"", ""Сеть"", страницу ""Службы"", свойства удаленного доступа и нажмите кнопку ""Сеть""." + 315 "Не удалось сохранить пароль." + 316 "Не удалось отобразить данные." + 317 "Не удалось получить данные об автоматической коммутации." + 318 "Не удается загрузить диалоговое окно." + 319 "Не удается запретить общий доступ." + 320 "Не удалось загрузить страницу свойств." + 321 "Не удалось загрузить телефонную книгу." + 322 "Не удалось загрузить данные о порте Диспетчера RAS." + 323 "Не удалось прочесть предпочтительную настройку параметров пользователя из реестра." + 324 "Не удалось загрузить данные о сценарии." + 325 "Не удалось просмотреть script.log с помощью notepad.exe" + 326 "Не удалось изменить switch.inf с помощью notepad.exe" + 327 "Не удалось загрузить данные о TAPI." + 328 "Не удалось загрузить данные о X.25." + 329 "Не удалось создать новую телефонную книгу." + 330 "Не удается разрешить общий доступ." + 331 "Не удалось подключиться с помощью этого элемента телефонной книги." + 332 "Не удалось получить буфер приема/передачи." + 333 "Не удалось получить данные о состоянии порта." + 334 "Не удалось получить данные о протоколе." + 335 "Не удалось получить буфер от устройства." + 336 "Не удалось отправить буфер на устройство." + 337 "Не удалось получить данные." + 338 "Не удалось сохранить данные о TAPI." + 339 "Не удалось сохранить данные." + 340 "Произошла остановка сценария." + 341 "Произошла остановка сценария из-за ошибки. Вывести журнал ошибок?" + 342 "Не удалось установить данные об автоматической коммутации." + 343 "Не удалось удалить сохраненный пароль." + 344 "Не удалось сделать запись в телефонную книгу." + 345 "Права на запись в реестр" + 346 "Не удалось записать файл ярлыка." + 347 "ОК" + 348 "Укажите телефонный ISP номер." + 349 "Введите телефонный номер" + 350 "Пароль и подтверждение пароля не совпадают." + 351 "Новый пароль и подтверждение нового пароля не совпадают." 352 "pbk" - 353 " (*.pbk)" + 353 "Файлы телефонной книги (*.pbk)" 354 "*.pbk" - 355 " " - 356 " " - 357 " " - 358 " " - 359 " " - 360 " " - 361 " " - 362 " ." - 363 ", PPP, "" ""." - 364 "& :" - 365 "&:" - 366 " " - 367 " .\n\n" - 368 " """" , """" ." - 369 " %1 %2, -:" - 370 "[ , ]" - 405 " NetBEUI RAS-." - 406 ", RAS-, NetBEUI. "" ""." - 407 "& " - 408 " . .\n """" , """"\n \n\n\n\n\n\n ." - 409 " " - 410 " ." - 411 " , ""%1"" . . \n \n\n\n\n\n\n Win NT/2000, ." + 355 "Открыть телефонную книгу" + 356 "Копировать элемент телефонной книги" + 357 "Изменить элемент телефонной книги" + 358 "Создать элемент телефонной книги" + 359 "Номер телефона" + 360 "Номера телефонов" + 361 "Сетевые подключения" + 362 "Необходимо выбрать хотя бы один протокол." + 363 "Прежде, чем подключаться к серверам PPP, следует установить сетевой протокол с приложением ""Управление сетью""." + 364 "&Новый префикс:" + 365 "&Префиксы:" + 366 "Префиксы телефонных номеров" + 367 "Один или несколько сетевых протоколов не были успешно подключены.\n\n" + 368 "Нажмите кнопку ""Связь"" чтобы использовать текущее подключение как есть, или кнопку ""Завершить"" для отключения." + 369 "Когда %1 устанавливает подключение по требованию через интерфейс %2, использовать следующие параметры протокола точка-точка:" + 370 "[Чтобы изменить сохраненный пароль, щелкните здесь]" + 405 "Протокол NetBEUI требуется для вызова старых RAS-серверов." + 406 "Прежде, чем подключаться к старым RAS-серверам, следует установить протокол NetBEUI. Он может быть установлен с приложением ""Управление сетью""." + 407 "&Повторный звонок" + 408 "Было задано запрещение одного или нескольких транспортов. При этом диспетчеры маршрутизации и протоколы маршрутизации для запрещаемых транспортов будут удалены из этого интерфейса коммутации.\nНажмите кнопку ""Да"" для подтверждения, или кнопку ""Нет""\n \n\n\n\n\n\n для разрешения транспортов." + 409 "Общий доступ к подключению Интернета" + 410 "Учетная запись интерфейса коммутации." + 411 "Необходимо задать учетные данные исходящего подключения, которые будут использоваться интерфейсом ""%1"" для подключения к удаленному маршрутизатору. Эти учетные данные должны соответствовать учетным данным входящего подключения на этом удаленном маршрутизаторе. При подключении к\n \n\n\n\n\n\nмаршрутизатору Win NT/2000, имя пользователя должно также соответствовать имени интерфейса удаленного маршрутизатора." 412 "mpradmin.hlp" - 413 "& " - 414 "& :" - 415 "& :" - 416 " " + 413 "&При подключении переместить удачный номер или адрес в начало" + 414 "&Новый номер телефона или адрес:" + 415 "&Номер телефона или адрес:" + 416 "Номера телефонов и адреса" 417 "PPP: Win 95/98/NT4/2000, Internet" - 418 "" - 419 "SLIP: Unix" - 420 " ." - 421 " ..." - 422 " ..." - 423 " ..." - 424 " ..." - 425 " ..." - 426 " ..." - 427 " ..." - 428 " ..." - 429 " ." - 430 " %1..." - 431 " ..." - 432 " ..." - 433 " ..." - 434 " %1..." - 435 " X.25 %1..." - 436 "- %1..." - 437 " %1..." - 438 " ." - 439 " ." - 440 "." - 441 " ." - 442 " ." - 443 " ..." - 444 " X.25 ." - 445 " ." - 446 "- ." - 447 " ." - 448 " ..." - 449 " ..." - 450 " ..." - 451 ", " - 452 " ." - 453 " ..." - 454 " ..." - 455 " ?" + 418 "Нет" + 419 "SLIP: подключение Unix" + 420 "Все устройства подключены." + 421 "Получение результатов регистрации..." + 422 "Отправлены сведения об ответном вызове..." + 423 "Отправлен новый пароль..." + 424 "Определение скорости связи..." + 425 "Проверка личных данных..." + 426 "Регистрация компьютера в сети..." + 427 "Повторная проверка подлинности..." + 428 "Проверка имени и пароля..." + 429 "Проверка выполнена." + 430 "Подключение через %1..." + 431 "Набор номера..." + 432 "Подключение модемов..." + 433 "Подключение через кабель..." + 434 "Набор номера %1..." + 435 "Подключение через X.25 к %1..." + 436 "Пост-подключение через %1..." + 437 "Предподключение через %1..." + 438 "Подключение выполнено." + 439 "Устройство подключено." + 440 "Отключено." + 441 "Подключение через модем выполнено." + 442 "Подключение через кабель выполнено." + 443 "Открытие порта..." + 444 "Подключение X.25 выполнено." + 445 "Порт открыт." + 446 "Пост-подключение выполнено." + 447 "Предподключение выполнено." + 448 "Подготовка к ответному вызову..." + 449 "Проверка подключений сетевых протоколов..." + 450 "Проверка имени и пароля..." + 451 "Подключено, создание пучка дополнительных линий" + 452 "Неизвестное состояние." + 453 "Ожидание ответного вызова сервера..." + 454 "Ожидание сброса модема..." + 455 "Сохранить это изменение номера телефона?" 456 "scp" 457 "*.scp" - 458 " (*.scp)" - 459 " " - 460 " ." - 461 " " - 462 " SLIP TCP/IP." - 463 ", SLIP, TCP/IP. "" ""." - 464 "" - 465 "& :" - 466 "&:" - 467 " " - 468 " , ." - 469 "" - 470 " " - 471 " " - 472 " " - 473 " SLIP" - 474 "10 " - 475 "10 " - 476 "1 " - 477 "1 " - 478 "24 " - 479 "2 " - 480 "2 " - 481 "30 " - 482 "30 " - 483 "3 " - 484 "4 " - 485 "4 " - 486 "5 " - 487 "5 " - 488 "8 " - 489 "" - 490 " ." - 491 " " - 492 " ?" - 493 " " - 494 " " - 495 " " + 458 "Файлы сценария коммутации (*.scp)" + 459 "Обзор сценариев коммутации" + 460 "Необходимо отметить хотя бы один модем или адаптер." + 461 "Номер телефона" + 462 "Для подключения к серверу SLIP требуется протокол TCP/IP." + 463 "Прежде, чем подключаться к серверам SLIP, следует установить протокол TCP/IP. Он может быть установлен с приложением ""Управление сетью""." + 464 "Состояние" + 465 "&Новый суффикс:" + 466 "&Суффиксы:" + 467 "Суффиксы телефонных номеров" + 468 "Если необходимо, можно выполнить особую настройку." + 469 "Настроить" + 470 "Терминал ввода команд модема" + 471 "Терминал после набора номера" + 472 "Терминал до набора номера" + 473 "Терминал для входа SLIP" + 474 "10 минут" + 475 "10 секунд" + 476 "1 час" + 477 "1 минута" + 478 "24 часа" + 479 "2 часа" + 480 "2 минуты" + 481 "30 минут" + 482 "30 секунд" + 483 "3 секунд" + 484 "4 часа" + 485 "4 минут" + 486 "5 минут" + 487 "5 секунд" + 488 "8 часов" + 489 "никогда" + 490 "Новое подключение можно сделать доступным для всех пользователей или только для вас." + 491 "Доступность подключения" + 492 "Отбросить параметры многоканальной связи для этого элемента?" + 493 "Недоступное устройство" + 494 "Параметры входа" + 495 "Параметры телефонного соединения" 496 "X.25" 497 "X.25 PAD" - 498 " ." - 499 " VPN-" - 500 " ." - 501 " VPN-" - 502 " ." - 503 " " - 504 "ReactOS ." + 498 "Можно предоставить доступ к ресурсам компьютера другим компьютерам в сети с использованием этого подключения." + 499 "Выбор VPN-сервера" + 500 "Не удалось разрешить вызов по требованию." + 501 "Укажите имя или адрес VPN-сервера" + 502 "Не удалось запретить вызов по требованию." + 503 "Публичная сеть" + 504 "ReactOS может сначала установить подключение к публичной сети." 505 "VPN1" - 506 " " - 507 " ." - 508 " ?" - 509 " ""%1"".\n\n ""%2""." - 510 " , , ." - 511 " , IP- 192.168.0.1. . IP-, . ?" - 512 " " - 513 " ." - 514 "&" - 515 " " - 516 " " - 517 " MPPE-40" - 518 " MPPE-128" - 519 " MS-CHAP EAP." - 520 " " - 521 " %1..." - 522 " " - 523 "" + 506 "Общий доступ к подключению Интернета" + 507 "Можно предоставить доступ внешним ресурсам компьютерам в локальной сети с использованием этого подключения." + 508 "Ведомый или ведущий?" + 509 "Был разрешен общий доступ к подключению Интернета для ""%1"".\n\nВместо этого будет разрешен общий доступ для подключения Интернета ""%2""." + 510 "Чтобы подключить два компьютера, ваш компьютер должен быть либо ведомым, либо ведущим." + 511 "Когда общий доступ к подключению к Интернету будет разрешен, сетевой плате локальной сети будет назначен IP-адрес 192.168.0.1. При этом связь с компьютерами сети может быть потеряна. Если другие компьютеры используют статические IP-адреса, следует настроить их на использование динамических адресов. Разрешить общий доступ к подключению Интернета?" + 512 "Выберите устройство" + 513 "Это устройство будет использовано для подключения." + 514 "&Подключение" + 515 "Параметры шифрования определяются сервером" + 516 "Всегда шифровать мои данные" + 517 "Использовать шифрование данных MPPE-40" + 518 "Использовать шифрование данных MPPE-128" + 519 "Выбранное шифрование требует проверки MS-CHAP или EAP." + 520 "Специальное сообщение проверки" + 521 "Установка связи с %1..." + 522 "Имя подключения" + 523 "Автоматически" 524 "PPTP VPN" 525 "L2TP IPSec VPN" - 526 " ." - 527 " " + 526 "Выберите тип подключения." + 527 "Тип подключения" 528 "hh.exe netcfg.chm::/trouble_all.htm" - 529 " " - 530 " , . ." - 531 " , . ." - 532 " ." - 533 " ." - 534 " 1 65535." - 535 " , """"." - 536 " , . ." - 537 " ." - 538 " , """"." - 539 " .\n ." - 540 " ." - 541 " ." - 542 "1 " - 543 " ." - 549 " , ?" - 576 "20 " - 579 " ." - 581 " " - 582 " ." - 583 " ." - 584 " ." - 585 " , ." - 586 " IP- ." - 587 " " - 588 " . \n ." - 589 "" - 1512 " " - 1523 " " - 1526 "-" - 1527 " - ." - 1528 " " - 1529 " ." + 529 "Виртуальное частное подключение" + 530 "Использовать любой способ проверки подлинности, включая незашифрованные пароли. Данные не шифруются." + 531 "Использовать любой способ проверки подлинности, требующий зашифрованный пароль. Данные не шифруются." + 532 "Введите имя этой записи." + 533 "Шифровать пароли и данные." + 534 "Введите номер порта в диапазоне от 1 до 65535." + 535 "Укажите особый способ проверки подлинности, нажав кнопку ""Параметры""." + 536 "Использовать любой способ проверки подлинности, требующий зашифрованный пароль. Данные не шифруются." + 537 "Шифровать пароли и данные." + 538 "Укажите особый способ проверки подлинности, нажав кнопку ""Параметры""." + 539 "Этот номер порта уже используется в другой записи.\nВведите другой номер порта." + 540 "Введите один или несколько портов для входящих ответов." + 541 "Выберите удаляемые записи." + 542 "1 секунда" + 543 "Выберите изменяемый элемент." + 549 "Какое имя у компьютера, к которому выполняется подключение?" + 576 "20 минут" + 579 "Укажите имя для этого подключения к рабочему месту." + 581 "Параметры сетевого приложения" + 582 "Введите в следующем поле имя для этого подключения." + 583 "Введите в следующем поле имя другого компьютера." + 584 "Введите в следующем поле имя поставщика услуг Интернета." + 585 "Введите имя службы, выполняющей подключение к Интернету." + 586 "Введите IP-адрес сервера в частной сети." + 587 "Дополнительные параметры" + 588 "Имя элемента начинается с точки или содержит некоторые недопустимые знаки. \nВыберите другое имя." + 589 "Свойства" + 1512 "Последовательный порт" + 1523 " канал" + 1526 "Смарт-карты" + 1527 "Можно использовать вашу смарт-карту при этом подключении." + 1528 "Прямое подключение" + 1529 "Выберите устройство для этого подключения." 1530 "Verdana Bold" 1531 "12" - 1532 " " - 1533 " ." - 1534 " " - 1535 " ." - 1536 " " - 1537 " ." - 1538 " VPN" - 1539 " ." - 1540 " " - 1541 " " - 1544 "IP-" - 1545 "IP- ." - 1546 " " - 1547 " DNS WINS ." - 1548 " " - 1549 " ." - 1550 " " - 1551 " , ." - 1552 " " - 1553 " , ." - 1554 " " - 1555 " ." - 1556 " " - 1557 " %1 . ?" - 1558 " SLIP ." - 1559 " " - 1560 " " - 1561 "-" - 1562 " ." - 1563 " ( )" - 1564 " ( )" - 1565 " ( )" - 1566 " ( )" - 1567 " ( )" - 1568 " " - 1569 " ." - 1570 " EAP . EAP, ." - 1571 " EAP - MS-CHAP." - 1572 " " - 1573 " ." - 1574 " PAP, SPAP, CHAP. , . ?" - 1575 " '%1', '%2'. '%2' ?" - 1576 " ..." - 1577 " -..." - 1578 " ." - 1579 " -." - 1580 " , . ." - 1581 "& VPN:" - 1582 " ." - 1583 " . . , ?" - 1584 ", , ." - 1585 " " - 1586 " , , ." - 1587 " , . , ." - 1588 " , ." - 1589 " :\r\n\r\n%1" - 1590 " %1" - 1591 " " - 1592 " , ." - 1593 " ." + 1532 "Тип подключения" + 1533 "Выберите тип создаваемого интерфейса вызова по требованию." + 1534 "Выберите устройство" + 1535 "Это устройство будет использовано для подключения." + 1536 "Номер телефона" + 1537 "Выберите номер телефона удаленного сервера или маршрутизатор по которому производится вызов." + 1538 "Тип сети VPN" + 1539 "Выберите тип создаваемого интерфейса виртуальной частной сети." + 1540 "Адрес назначения" + 1541 "Укажите имя или адрес удаленного маршрутизатора" + 1544 "IP-адрес" + 1545 "IP-адрес маршрутизатора для этого интерфейса." + 1546 "Адреса серверов имен" + 1547 "Адреса DNS и WINS для этого интерфейса." + 1548 "Сценарии маршрутизатора" + 1549 "Можно задать сценарии для подключения к удаленному маршрутизатору." + 1550 "Учетные данные входящего подключения" + 1551 "Имя пользователя и пароль, используемые удаленным маршрутизатором при наборе номера этого сервера." + 1552 "Учетные данные исходящего подключения" + 1553 "Имя пользователя и пароль, используемые при подключении к удаленному маршрутизатору." + 1554 "Имя интерфейса" + 1555 "Выберите имя для этого нового интерфейса." + 1556 "Нет доступных устройств" + 1557 "Учетная запись пользователя %1 уже существует на локальном компьютере. Должен ли интерфейс вызова по требованию использовать эту учетную запись?" + 1558 "Параметры безопасности для подключений к серверам SLIP отсутствуют." + 1559 "Небезопасный пароль" + 1560 "Безопасный пароль" + 1561 "Смарт-карта" + 1562 "Необходимо выбрать хотя бы один протокол проверки пароля." + 1563 "не разрешено (отключиться если требуется шифрование)" + 1564 "необязательное (подключиться даже без шифрования)" + 1565 "обязательное (отключиться если нет шифрования)" + 1566 "самое стойкое (отключиться если нет шифрования)" + 1567 " (шифрование включено)" + 1568 "Детали учетной записи в Интернете" + 1569 "Для учетной записи Интернета потребуется имя учетной записи и пароль." + 1570 "Выбранные пакет EAP не предоставляет ключи шифрования. Выберите пакет EAP, обеспечивающий ключи или не используйте шифрование вообще." + 1571 "Выбранное шифрование требует методов проверки EAP или какой-либо версии MS-CHAP." + 1572 "Протоколы и безопасность" + 1573 "Выберите транспортные протоколы и параметры безопасности для этого подключения." + 1574 "Выбранные протоколы включают PAP, SPAP, и CHAP. Если будет произведено согласование одного из них, шифрование данных использоваться не будет. Использовать эти параметры?" + 1575 "Для подключения '%1', требуется сначала подключиться к '%2'. Произвести подключение к '%2' сейчас?" + 1576 "Подключение через параллельный кабель..." + 1577 "Подключение через ИК-связь..." + 1578 "Подключено через параллельный кабель." + 1579 "Подключено через ИК-связь." + 1580 "Это подключение было настроено на использование шифрования данных, не поддерживаемого установленным программным обеспечением. Параметры безопасности этого подключения будут изменены на использование наиболее сильного из поддерживаемых методов шифрования." + 1581 "Т&ип VPN:" + 1582 "Введите имя пользователя." + 1583 "Это имя и пароль будут сохранены для вас. Уже существуют сохраненные имя и пароль для всех других пользователей этого подключения. Удалить имя и пароль, сохраненные для всех других пользователей подключения?" + 1584 "Например, можно ввести имя рабочего места или имя сервера, к которому будет выполняться подключение." + 1585 "Сведения об учетной записи" + 1586 "Элементы управления на этой странице свойств отключены, поскольку надо выполнить перезагрузку системы, прежде чем изменять параметры настройки." + 1587 "Элементы управления на этой странице свойств отключены, поскольку уже открыты один или несколько других страниц свойств сети. Чтобы воспользоваться элементами управления, закройте все страницы свойств и заново откройте эту страницу." + 1588 "Некоторые элементы управления на этой странице свойств отключены, поскольку вы не имеете достаточных привилегий для доступа к ним." + 1589 "От поставщика службы доступа получено следующее сообщение:\r\n\r\n%1" + 1590 "Переподключение %1" + 1591 "Имя службы" + 1592 "Укажите имя службы, обеспечивающей высокоскоростное подключение." + 1593 "Для вашей учетной записи потребуется имя учетной записи и пароль." 1594 "PPPOE1-0" - 1595 " - Ethernet(PPPoE)" - 1596 " & :" - 1611 " " - 1612 " , . \n ." - 1613 " " - 1634 " ReactOS (WMI) , ReactOS .\n\n , WMI. """" """", "" ReactOS"" """"." - 1635 "ReactOS . , ReactOS (WMI) . , "" "" ReactOS ( ). "" "" "" "" ( """")." - 1646 " " - 1647 " " - 1648 " " - 1649 " " - 1650 " " - 1651 " " - 1652 " " - 1653 " " - 1654 " " + 1595 "Протокол точка-точка по Ethernet(PPPoE)" + 1596 "Тип создаваемого в&ысокоскоростного подключения:" + 1611 "Высокоскоростное подключение" + 1612 "Предварительный ключ выбран для использования, но не был введен. \nВведите предварительный ключ." + 1613 "Не удается отправить учетные данные" + 1634 "Поскольку служба инструментария управления ReactOS (WMI) была выключена, ReactOS не может вывести свойства этого подключения или домашней сети.\n\nЧтобы настроить свойства подключения или домашней сети, необходимо включить службу WMI. Для этого на панели управления ""Администрирование"" дважды щелкните значок ""Службы"", щелкните правой кнопкой службу ""Инструментарий управления ReactOS"" и выберите пункт ""Запустить""." + 1635 "ReactOS не удается вывести свойства этого подключения. Возможно, данные инструментария управления ReactOS (WMI) повреждены. Чтобы исправить это, воспользуйтесь средством ""Восстановление системы"" для восстановления предыдущего состояния ReactOS (возврата к точке восстановления). Средство ""Восстановление системы"" находится в папке ""Служебные программы"" (меню ""Стандартные"")." + 1646 "Разрешить входящий запрос эха" + 1647 "Разрешить входящий запрос штампа времени" + 1648 "Разрешить входящий запрос маски" + 1649 "Разрешить входящий запрос маршрутизатора" + 1650 "Разрешать присваивать исходящему назначению недоступное значение" + 1651 "Разрешать снижать скорость источнику исходящих сообщений" + 1652 "Разрешать любые параметры исходящих сообщений" + 1653 "Разрешить превышение исходящего времени" + 1654 "Разрешать перенаправление" 1655 "log" 1656 "*.log" - 1657 " (*.log)" - 1658 "" - 1663 " " - 1664 " , . ." - 1665 ", , . , , ." - 1666 " , , ." - 1667 " , , , ." - 1668 " ." - 1669 ", - , "" ""." - 1670 " , , ." - 1671 " - , "" "" (bad header)." - 1672 " - , , , "" "" (time expired)." - 1673 ", , ." - 1675 " . 1 32767KB." - 1685 " . (Guest)." - 1686 " . ( , .)" - 1687 "& " - 1688 "& " - 1689 "&" - 1690 " ?\n" - 7301 " TCP/IP" - 7302 " %1 %2." - 7306 " " - 7307 " " - 7308 " " - 7309 " " - 7310 " " - 7311 " " - 7312 " " - 7313 " TCP/IP " - 7314 " IPX " - 7315 " " - 7316 "" - 7317 "" - 7318 " " - 7319 " " - 7320 " " - 7321 " """"." - 7322 " ." - 7323 " . ." - 7324 " ." - 7325 " " - 7326 " ." - 7327 " ." - 7328 " ." - 7329 " . " - 7330 " - ." - 7331 " : ." - 7332 " , ." - 7333 " , ." - 7334 " ." - 7335 " , """"." - 7336 " VPN ( )." - 7337 " ." - 7338 " : ." - 7339 " ." - 7340 " ." - 7341 " ." - 7342 " , TCP/IP." - 7343 " , IPX." - 7344 " TCP/IP." - 7345 " IPX." - 7346 " TCP/IP ." - 7347 " IPX ." - 7348 " , . ." - 7349 " , ." - 7350 " , ( )." - 7351 " ." - 7352 " , ." - 7353 " " - 7354 ", , , """". %s? " - 7355 " . . ?" - 7356 " . . , , 255.255.0.0, , 255.0.255.0 - . \n" - 7357 " " - 7358 " , ." - 7359 " " - 7360 " ." - 7361 " (VPN)" - 7362 " VPN-." - 7363 " " - 7364 " ." - 7365 " " + 1657 "Файлы журнала брандмауэра (*.log)" + 1658 "Обзор" + 1663 "Выберите подключение к частной сети" + 1664 "Чтобы разрешить общий доступ к подключению к Интернету, необходимо выбрать подключение для частной сети. Выберите подключение из списка доступных подключений." + 1665 "Сообщения, отправленные на этот компьютер, будут переданы обратно отправителю. Такой режим обычно используется для устранения неполадок, например, при проверке связи с компьютером." + 1666 "Получение данных, отправленных на данный компьютер, может быть подтверждено сообщением с указанием времени получения." + 1667 "Этот компьютер будет прослушивать сообщения, содержащие дополнительные сведения об общедоступной сети, к которой он подключен, а также отвечать на них." + 1668 "Этот компьютер будет отвечать на запросы о распознанных им маршрутах." + 1669 "Данные, отправленные через Интернет и не дошедшие до данного компьютера из-за ошибки, будут отброшены с уведомлением ""точка назначения недоступна""." + 1670 "Когда возможности компьютера по обработке входящих данных будут недостаточны для текущей скорости передачи, данные будут отброшены, а отправителю будет направлен запрос на уменьшение скорости." + 1671 "Когда этот компьютер отбросит полученные данные из-за неправильных заголовков, он ответит отправителю сообщением об ошибке ""неверный заголовок"" (bad header)." + 1672 "Когда этот компьютер прервет передачу неполного набора данных из-за того, что передача полного набора потребует время, превышающее допустимое, он ответит отправителю сообщением об ошибке ""время истекло"" (time expired)." + 1673 "Данные, отправленные с этого компьютера, будут отправлены по другому маршруту в соответствии с изменениями пути по умолчанию." + 1675 "Введено недопустимое значение размера файла журнала. Введите значение от 1 до 32767KB." + 1685 "В вашей учетной записи отсутствует разрешение на использование этого подключения. Обычно причиной этого является вход с учетной записью гостя (Guest)." + 1686 "Введите имя учетной записи и пароль. (Если вы забыли имя существующей учетной записи или пароль, обратитесь к администратору сети.)" + 1687 "&Имя компьютера" + 1688 "Им&я поставщика услуг" + 1689 "&Организация" + 1690 "Какой номер телефона будет использоваться для этого подключения?\n" + 7301 "Свойства входящих вызовов TCP/IP" + 7302 "Для этого поля необходимо выбрать значение от %1 до %2." + 7306 "Ошибка входящих подключений" + 7307 "Общая ошибка входящих подключений" + 7308 "Входящие подключения" + 7309 "Ошибка сетевых входящих подключений" + 7310 "Многоканальная ошибка входящих подключений" + 7311 "Ошибка входящих подключений" + 7312 "Ошибка инициализации входящих подключений" + 7313 "Ошибка свойств TCP/IP входящих подключений" + 7314 "Ошибка свойств IPX входящих подключений" + 7315 "Ошибка входящих подключений" + 7316 "Универсальный" + 7317 "Устройство" + 7318 "Различные базы данных" + 7319 "База данных пользователей" + 7320 "База данных протоколов" + 7321 "Необходимо ввести имя входа нового пользователя или нажать кнопку ""Отмена""." + 7322 "Длина введенного пароля слишком мала." + 7323 "Введенные пароли не совпадают. Повторите ввод паролей." + 7324 "Произошла внутренняя ошибка." + 7325 "Просмотр списка" + 7326 "Произошла ошибка при внесении изменений в локальную базу данных пользователей." + 7327 "У вас нет прав на добавление пользователей в локальную базу данных." + 7328 "Такой пользователь уже существует в локальной базе данных пользователей." + 7329 "Введенный пароль отвергнут системой и пользователь не был добавлен в локальную базу. " + 7330 "Не удалось перезагрузить локальную базу пользователей из-за внутренней ошибки." + 7331 "Произошла внутренняя ошибка: испорченный дескриптор локальной базы данных пользователей." + 7332 "Не удалось загрузить ресурсы, необходимые для отображения вкладки пользователей." + 7333 "Произошла ошибка при попытке отката изменений, внесенных вами в локальную базу данных пользователей." + 7334 "Дескриптор базы данных устройств испорчена." + 7335 "Не удалось загрузить ресурсы, необходимые для отображения вкладки ""Общие""." + 7336 "Произошла ошибка при попытке применить сделанные вами изменения настройки устройств или VPN (виртуальной частной сети)." + 7337 "Произошла внутренняя ошибка." + 7338 "Произошла внутренняя ошибка: дескриптор базы данных сетевых компонентов поврежден." + 7339 "Произошла внутренняя ошибка." + 7340 "Произошла ошибка при попытке применить сделанные вами изменения для указанных выше сетевых компонентов." + 7341 "Произошла внутренняя ошибка." + 7342 "Не удалось внести изменения, сделанные для протокола TCP/IP." + 7343 "Не удалось внести изменения, сделанные для протокола IPX." + 7344 "Не удалось отобразить диалог свойств TCP/IP." + 7345 "Не удалось отобразить диалог свойств IPX." + 7346 "Не удалось загрузить свойства TCP/IP с этой системы." + 7347 "Не удалось загрузить свойства IPX с этой системы." + 7348 "Входящие подключения зависят от служб маршрутизации и удаленного доступа, запуск которых не удался. Дополнительные сведения содержатся в журнале событий." + 7349 "Не удается разрешить изменение компонентов сети в настоящее время, поскольку их изменение уже производится." + 7350 "Введенные вами данные о новом пользователе не были добавлены в локальную базу данных пользователей, поскольку указанные имя или пароль не соответствуют системной политике (неправильная длина или формат)." + 7351 "Не удалось удалить указанного пользователя." + 7352 "Не удалось удалить указанный сетевой компонент, поскольку он используется в данный момент." + 7353 "Предупреждение входящих подключений" + 7354 "Пользователи, которых вы удалите, будут удалены окончательно, даже если затем будет нажата кнопка ""Отмена"". Подтверждаете окончательное удаление %s? " + 7355 "Вы собираетесь переключиться на работу с системной консолью управления. Страница свойств входящих подключений будет закрыта и сделанные изменения вступят в силу. Подтверждаете продолжение?" + 7356 "Было изменено значение сетевой маски. За первым же нулевым битом маски могут следовать только нулевые биты. Например, значение сетевой маски, записанное в десятичной нотации как 255.255.0.0, допустимо, а 255.0.255.0 - нет. \n" + 7357 "Разрешения пользователей" + 7358 "Можно указать пользователей, которым разрешается подключаться к этому компьютеру." + 7359 "Устройства для входящих подключений" + 7360 "Можно выбрать устройства используемые для приема входящих подключений." + 7361 "Входящее подключение к виртуальной частной сети (VPN)" + 7362 "Другой компьютер подключиться к вашему через VPN-подключение." + 7363 "Программы работы с сетью" + 7364 "Программы работы с сетью позволяют этому компьютеру принимать подключения от других типов компьютеров." + 7365 "Завершение работы мастера новых подключений" 7366 " " - 7367 " " - 7371 ", , ." + 7367 "Входящие подключения" + 7371 "Оборудование, способное принимать входящие звонки, не установлено." 7372 " " - 7373 " &:" - 7374 " & :" - 7375 " " - 7376 " " - 7377 " ?" - 7378 ", , ." - 7379 " " - 7380 " , "" "" . ?\n" - 7381 "& " - 7382 "& " - 7383 " IPX 00000000 FFFFFFFF. , ." - 7384 "" - 7385 " (%s)" - 7386 " "" "" , . ." - 7387 " ." - 7388 " ReactOS. ?" - 7389 " ." - 7390 " " - 7391 " ""%1"". """". . , """"?\r\n\n "" "", """", """". """" ." - 7392 " . . , """".\n" - 7393 " " - 7394 " IP-." - 7395 " ." - 7396 " TCP/IP. 1.0.0.0 224.0.0.0 127.x.x.x." - 7397 " TCP/IP, ." - 7398 " ." - 7399 " . "" "" , . ." + 7373 "Назначить указанный номер &сети:" + 7374 "Назначать номера &сети последовательно из:" + 7375 "Новый пользователь" + 7376 "Устройство подключения" + 7377 "Какое устройство будет использовано для подключения?" + 7378 "Оборудование, способное принимать прямые подключения, не установлено." + 7379 "Предупреждение нового входящего подключения" + 7380 "Поскольку этот сервер принадлежит домену, необходимо использовать консоль ""Маршрутизация и удаленный доступ"" для настройки этого компьютера на прием входящих подключений. Отменить изменения и переключиться на эту консоль?\n" + 7381 "&Назначить номер сети автоматически" + 7382 "&Назначать номера сети автоматически" + 7383 "Входящие подключения не могут использовать номера сетей IPX 00000000 или FFFFFFFF. Либо измените назначенный номер сети, либо используйте автоматическое назначение номеров сетей." + 7384 "на" + 7385 "Последовательный порт (%s)" + 7386 "В окне ""Сетевые подключения"" не отображаются некоторые параметры входящих подключений, установленные с использованием консолей диспетчера локальных пользователей или политики удаленного доступа. Для получения полных сведений о входящих подключениях необходимо воспользоваться этими консолями." + 7387 "Выбранный режим ответного вызова требует ввода правильного номера для ответного вызова." + 7388 "Для завершения операции необходимо перезагрузить ReactOS. Произвести перезагрузку сейчас?" + 7389 "Выбранное устройство не имеет настраиваемых параметров." + 7390 "Неправильный диапазон" + 7391 "Произведен запрос на запрет входящих подключений для ""%1"". Для выполнения этого необходимо остановить службу ""Сервер"". После ее остановки доступ к общим папкам и принтерам этого компьютера будет невозможен. Вызвать системную консоль, которая позволяет остановить службу ""Сервер""?\r\n\nВыберите ""Управление компьютером"", ""Служебные"", ""Службы"". В правой панели щелкните правой кнопкой мыши по значку ""Сервер"" и выберите команду остановки." + 7392 "Использование последовательного порта для прямого подключения к другому компьютеру запрещено. Оно будет разрешено после завершения работы мастера. Затем можно будет произвести настройку скорости и других параметров порта, нажав правой кнопкой мыши на значке этого подключения и выбрав пункт ""Свойства"".\n" + 7393 "Входящие подключения" + 7394 "Указан неправильный пул IP-адресов." + 7395 "Указана неправильная маска подсети." + 7396 "Указан неправильный начальный адрес пула адресов TCP/IP. Адреса должны находиться в переделах от 1.0.0.0 до 224.0.0.0 за исключением диапазона 127.x.x.x." + 7397 "Указан неправильный пул адресов TCP/IP, поскольку введенный адрес выходит за рамки маски." + 7398 "Начальный адрес должен быть меньше конечного адреса." + 7399 "Производится остановка службы маршрутизации и удаленного доступа. Параметр ""Входящие подключения"" не будет доступен до тех пор, пока остановка не будет полностью произведена. Подождите немного и повторите попытку." 7400 "%s (%s)" - 7401 "%s (: %d)" - 7402 " VPN- (PPTP)" - 7403 " VPN- (L2TP)" - 7404 "IP- (IKE)" + 7401 "%s (каналов: %d)" + 7402 "Входящее VPN-подключение (PPTP)" + 7403 "Входящее VPN-подключение (L2TP)" + 7404 "IP-безопасность (IKE)" 7405 "127.0.0.1" - 7406 " " - 29900 " ." - 29901 " MPRAPI.DLL SYSTEM32." + 7406 "У вас недостаточно полномочий для настройки входящих подключений" + 29900 "Не удается загрузить службу диспетчера подключений удаленного доступа." + 29901 "Не удалось загрузить файл MPRAPI.DLL из папки SYSTEM32." END diff --git a/dll/win32/rasdlg/lang/uk-UA.rc b/dll/win32/rasdlg/lang/uk-UA.rc index be47f0fdc29..f956dc1d8d5 100644 --- a/dll/win32/rasdlg/lang/uk-UA.rc +++ b/dll/win32/rasdlg/lang/uk-UA.rc @@ -10,342 +10,342 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT 102 DIALOGEX 0, 0, 255, 265 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION " " +CAPTION "Додаткові номери телефонів" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " , .", 1018, 7, 5, 243, 16 - LTEXT " &:", 1019, 7, 27, 238, 8 + LTEXT "Укажіть додаткові номери телефону, які слід використовувати для цього підключення.", 1018, 7, 5, 243, 16 + LTEXT "Номери &телефонів:", 1019, 7, 27, 238, 8 CONTROL "", 1012, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x0000848D, 7, 38, 217, 144 - PUSHBUTTON "&", 1017, 230, 40, 18, 16, BS_ICON - PUSHBUTTON "&", 1015, 230, 61, 18, 16, BS_ICON - PUSHBUTTON "&...", 1013, 7, 187, 70, 14 - PUSHBUTTON "&...", 1016, 81, 187, 70, 14 - PUSHBUTTON "&", 1014, 154, 187, 70, 14 - AUTOCHECKBOX "& ' ", 1011, 8, 210, 243, 10, BS_TOP | BS_MULTILINE - AUTOCHECKBOX "& ", 1010, 8, 228, 243, 10, BS_TOP | BS_MULTILINE + PUSHBUTTON "В&гору", 1017, 230, 40, 18, 16, BS_ICON + PUSHBUTTON "В&низ", 1015, 230, 61, 18, 16, BS_ICON + PUSHBUTTON "&Додати...", 1013, 7, 187, 70, 14 + PUSHBUTTON "З&мінити...", 1016, 81, 187, 70, 14 + PUSHBUTTON "В&идалити", 1014, 154, 187, 70, 14 + AUTOCHECKBOX "&У разі невдачі спробувати з'єднатися за наступним номером", 1011, 8, 210, 243, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "П&еремістити вдалий номер на початок списку", 1010, 8, 228, 243, 10, BS_TOP | BS_MULTILINE DEFPUSHBUTTON "OK", 1, 122, 245, 60, 14 - PUSHBUTTON "", 2, 188, 245, 60, 14 + PUSHBUTTON "Скасувати", 2, 188, 245, 60, 14 END 103 DIALOGEX 6, 18, 250, 170 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION -CAPTION " " +CAPTION "Мережні підключення" FONT 8, "MS Shell Dlg" BEGIN LTEXT "", 1029, 5, 5, 241, 35, NOT WS_GROUP - LTEXT "&ϳ:", -1, 5, 46, 238, 10 + LTEXT "&Підключення:", -1, 5, 46, 238, 10 CONTROL "List1", 1677, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x0000440D, 5, 57, 240, 57 - AUTOCHECKBOX "& ", 1022, 8, 125, 235, 10 - PUSHBUTTON "&", 1026, 7, 149, 60, 14 - DEFPUSHBUTTON "ϳ&...", 1024, 117, 149, 60, 14 - PUSHBUTTON "", 1025, 183, 149, 60, 14 + AUTOCHECKBOX "&Не питати до наступного входу до системи", 1022, 8, 125, 235, 10 + PUSHBUTTON "П&араметри", 1026, 7, 149, 60, 14 + DEFPUSHBUTTON "Підкл&ючити...", 1024, 117, 149, 60, 14 + PUSHBUTTON "Скасувати", 1025, 183, 149, 60, 14 END 104 DIALOGEX 6, 18, 269, 263 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION " " +CAPTION "Помилки групи ліній" FONT 8, "MS Shell Dlg" BEGIN ICON 32516, 1031, 7, 7, 20, 20 - LTEXT " . ", 1033, 37, 8, 216, 20 + LTEXT "Деякі додаткові лінії не підключені. ", 1033, 37, 8, 216, 20 CONTROL "", 1032, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x00008401, 37, 83, 224, 136 - AUTOCHECKBOX "& ", 1030, 38, 226, 222, 10 - DEFPUSHBUTTON "&", 1, 135, 242, 60, 14 - PUSHBUTTON "&", 2, 201, 242, 60, 14 - LTEXT " ' , , '. "" "".", -1, 37, 36, 224, 44 + AUTOCHECKBOX "Більш&е не використовувати невдалі лінії", 1030, 38, 226, 222, 10 + DEFPUSHBUTTON "Прий&мати", 1, 135, 242, 60, 14 + PUSHBUTTON "&Завершити", 2, 201, 242, 60, 14 + LTEXT "Якщо вдалося з'єднатися лише по одній лінії, можливо, сервер не налаштовано на багатоканальний зв'язок. У такому разі установіть прапорець ""Більше не використовувати невдалі лінії"".", -1, 37, 36, 224, 44 END 105 DIALOGEX 0, 0, 261, 253 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION " " +CAPTION "Додаткові параметри безпеки" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ", 1547, 7, 33, 246, 191 - LTEXT "& :", 1546, 7, 5, 247, 10 + GROUPBOX "Безпечний вхід", 1547, 7, 33, 246, 191 + LTEXT "&Шифрування даних:", 1546, 7, 5, 247, 10 COMBOBOX 1495, 7, 17, 247, 76, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - AUTORADIOBUTTON "& (EAP)", 1544, 17, 47, 226, 8, WS_GROUP - LTEXT " EAP", -1, 18, 64, 35, 8, NOT WS_VISIBLE | NOT WS_GROUP + AUTORADIOBUTTON "П&ротокол розширеної перевірки автентичності (EAP)", 1544, 17, 47, 226, 8, WS_GROUP + LTEXT "Тип EAP", -1, 18, 64, 35, 8, NOT WS_VISIBLE | NOT WS_GROUP COMBOBOX 1034, 53, 62, 191, 42, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | NOT WS_TABSTOP - PUSHBUTTON "&", 1035, 184, 77, 60, 14 - AUTORADIOBUTTON "& ", 1545, 17, 92, 224, 10 - AUTOCHECKBOX "& (PAP)", 1491, 28, 105, 215, 10, BS_TOP | BS_MULTILINE | WS_GROUP - AUTOCHECKBOX "& Shiva (SPAP)", 1496, 28, 119, 214, 10, BS_TOP | BS_MULTILINE - AUTOCHECKBOX "& (CHAP)", 1494, 28, 133, 215, 10, BS_TOP | BS_MULTILINE - AUTOCHECKBOX "& MS CHAP (MS-CHAP)", 1493, 28, 148, 212, 10, BS_TOP | BS_MULTILINE - AUTOCHECKBOX "& MS-CHAP Win 95", 200, 46, 162, 198, 10, BS_TOP | BS_MULTILINE - AUTOCHECKBOX "& Microsoft (MS-CHAP v2)", 1492, 28, 176, 200, 10, BS_TOP | BS_MULTILINE + PUSHBUTTON "В&ластивості", 1035, 184, 77, 60, 14 + AUTORADIOBUTTON "&Дозволити такі протоколи", 1545, 17, 92, 224, 10 + AUTOCHECKBOX "&Незашифрований пароль (PAP)", 1491, 28, 105, 215, 10, BS_TOP | BS_MULTILINE | WS_GROUP + AUTOCHECKBOX "Про&токол перевірки пароля Shiva (SPAP)", 1496, 28, 119, 214, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Пр&отокол перевірки пароля (CHAP)", 1494, 28, 133, 215, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Протокол перевірки пароля MS CHAP (MS-CHAP)", 1493, 28, 148, 212, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "До&зволити старий протокол MS-CHAP для Win 95", 200, 46, 162, 198, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Прото&кол перевірки пароля Microsoft (MS-CHAP v2)", 1492, 28, 176, 200, 10, BS_TOP | BS_MULTILINE CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 28, 189, 208, 1 - AUTOCHECKBOX "& MS-CHAP ' ReactOS ( ' , )", 1549, 28, 195, 213, 24, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Дл&я протоколів на основі MS-CHAP автоматично використовувати ім'я для входу та пароль ReactOS (а також ім'я домену, якщо воно є)", 1549, 28, 195, 213, 24, BS_TOP | BS_MULTILINE DEFPUSHBUTTON "OK", 1, 127, 232, 60, 14 - PUSHBUTTON "", 2, 192, 232, 60, 14 + PUSHBUTTON "Скасувати", 2, 192, 232, 60, 14 END 106 DIALOGEX 6, 18, 255, 109 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION " " +CAPTION "Завершення підключення" FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "OK", 1, 97, 91, 60, 14 ICON 563, 1046, 7, 7, 20, 20 - LTEXT "ϳ .", 1047, 40, 7, 212, 16 - LTEXT " , "" "" ( ).", -1, 40, 30, 212, 34 - AUTOCHECKBOX "& ", 1045, 40, 69, 212, 10, BS_TOP | BS_MULTILINE + LTEXT "Підключення установлено.", 1047, 40, 7, 212, 16 + LTEXT "Щоб перевірити стан цього підключення, клацніть правою кнопкою миші його значок у папці ""Мережні підключення"" або на панелі завдань (якщо він там є).", -1, 40, 30, 212, 34 + AUTOCHECKBOX "&Більше не показувати це повідомлення", 1045, 40, 69, 212, 10, BS_TOP | BS_MULTILINE END 107 DIALOGEX 0, 0, 258, 167 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ", 1053, 7, 5, 243, 92 - LTEXT "& :", 1055, 18, 17, 54, 8 + GROUPBOX "Номер телефону", 1053, 7, 5, 243, 92 + LTEXT "&Код міста:", 1055, 18, 17, 54, 8 COMBOBOX 1049, 17, 30, 55, 129, CBS_DROPDOWN | WS_VSCROLL | NOT WS_TABSTOP - LTEXT "& :", 1057, 77, 17, 166, 8, NOT WS_GROUP + LTEXT "&Номер телефону:", 1057, 77, 17, 166, 8, NOT WS_GROUP EDITTEXT 1051, 77, 30, 163, 14, ES_AUTOHSCROLL - LTEXT " &:", 1056, 18, 48, 221, 8, NOT WS_GROUP + LTEXT "Код країни або ре&гіону:", 1056, 18, 48, 221, 8, NOT WS_GROUP COMBOBOX 1054, 17, 61, 224, 93, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | NOT WS_TABSTOP - AUTOCHECKBOX "& ", 1048, 20, 81, 219, 10, BS_TOP | BS_MULTILINE - GROUPBOX "&", 1052, 7, 102, 243, 36 + AUTOCHECKBOX "&Використовувати правила набору номера", 1048, 20, 81, 219, 10, BS_TOP | BS_MULTILINE + GROUPBOX "&Примітка", 1052, 7, 102, 243, 36 EDITTEXT 1050, 17, 115, 224, 14, ES_AUTOHSCROLL DEFPUSHBUTTON "OK", 1, 127, 147, 60, 14 - PUSHBUTTON "", 2, 191, 147, 60, 14 + PUSHBUTTON "Скасувати", 2, 191, 147, 60, 14 END 108 DIALOGEX 6, 18, 222, 104 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION " " +CAPTION "Зміна пароля" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " 䳿 . ""OK"".", 1062, 7, 5, 210, 24 - LTEXT "& :", 1064, 8, 43, 108, 8 + LTEXT "Термін дії пароля у віддаленій мережі минув. Введіть пароль і натисніть кнопку ""OK"".", 1062, 7, 5, 210, 24 + LTEXT "&Новий пароль:", 1064, 8, 43, 108, 8 EDITTEXT 1060, 118, 38, 98, 14, ES_PASSWORD | ES_AUTOHSCROLL - LTEXT "&ϳ:", 1061, 8, 61, 102, 8 + LTEXT "&Підтвердження:", 1061, 8, 61, 102, 8 EDITTEXT 1058, 118, 57, 98, 14, ES_PASSWORD | ES_AUTOHSCROLL DEFPUSHBUTTON "OK", 1, 90, 84, 60, 14, WS_GROUP - PUSHBUTTON "", 2, 154, 84, 60, 14 + PUSHBUTTON "Скасувати", 2, 154, 84, 60, 14 END 109 DIALOGEX 6, 18, 223, 122 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION " " +CAPTION "Зміна пароля" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " 䳿 . ""OK"".", 1062, 7, 5, 212, 29 - LTEXT "& :", 1063, 7, 42, 108, 8 + LTEXT "Термін дії пароля у віддаленій мережі минув. Введіть пароль і натисніть кнопку ""OK"".", 1062, 7, 5, 212, 29 + LTEXT "&Старий пароль:", 1063, 7, 42, 108, 8 EDITTEXT 1059, 116, 38, 100, 14, ES_PASSWORD | ES_AUTOHSCROLL - LTEXT "& :", 1064, 7, 60, 108, 8 + LTEXT "&Новий пароль:", 1064, 7, 60, 108, 8 EDITTEXT 1060, 116, 56, 100, 14, ES_PASSWORD | ES_AUTOHSCROLL - LTEXT "&ϳ:", 1061, 7, 78, 108, 8 + LTEXT "&Підтвердження:", 1061, 7, 78, 108, 8 EDITTEXT 1058, 116, 74, 100, 14, ES_PASSWORD | ES_AUTOHSCROLL DEFPUSHBUTTON "OK", 1, 92, 101, 60, 14, WS_GROUP - PUSHBUTTON "", 2, 156, 101, 60, 14 + PUSHBUTTON "Скасувати", 2, 156, 101, 60, 14 END 110 DIALOGEX 12, 16, 230, 105 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION "³ " +CAPTION "Відповідний виклик" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " . ""OK"", . , """".", 1066, 5, 5, 221, 39, SS_NOPREFIX - LTEXT "& :", 1067, 5, 46, 222, 8, NOT WS_GROUP + LTEXT "Ви маєте право на зворотний виклик із боку сервера. Якщо натиснути кнопку ""OK"", сервер зробить зворотний виклик за вказаним нижче номером. Щоб відмовитися від зворотного виклику, натисніть кнопку ""Скасувати"".", 1066, 5, 5, 221, 39, SS_NOPREFIX + LTEXT "&Введіть номер телефону вашого модема:", 1067, 5, 46, 222, 8, NOT WS_GROUP EDITTEXT 1065, 5, 57, 221, 14, ES_AUTOHSCROLL DEFPUSHBUTTON "OK", 1, 100, 85, 60, 14, WS_GROUP - PUSHBUTTON "", 2, 164, 85, 60, 14 + PUSHBUTTON "Скасувати", 2, 164, 85, 60, 14 END 111 DIALOGEX 6, 19, 265, 135 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION " : %1" +CAPTION "Помилка підключення: %1" FONT 8, "MS Shell Dlg" BEGIN ICON 32515, 1068, 7, 7, 20, 20, WS_GROUP LTEXT "", 1070, 34, 7, 226, 105 - DEFPUSHBUTTON " =88", 1, 4, 117, 128, 14, WS_GROUP - PUSHBUTTON "", 2, 136, 117, 60, 14 - PUSHBUTTON "&", 1069, 200, 117, 60, 14 + DEFPUSHBUTTON "Не набирати номер=88", 1, 4, 117, 128, 14, WS_GROUP + PUSHBUTTON "Скасувати", 2, 136, 117, 60, 14 + PUSHBUTTON "&Подробиці", 1069, 200, 117, 60, 14 END 112 DIALOGEX 6, 18, 263, 219 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION " " +CAPTION "Автоматичне виконання дзвінків" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "ReactOS ' .", 1085, 9, 7, 253, 30 - GROUPBOX " ", -1, 6, 38, 249, 71 - LTEXT " , :", 1083, 16, 51, 237, 16, NOT WS_GROUP - LTEXT " &:", -1, 16, 73, 100, 8 + LTEXT "ReactOS може автоматично установлювати й завершувати зв'язок через пристрої залежно від інтенсивності обміну даними.", 1085, 9, 7, 253, 30 + GROUPBOX "Автоматичне підключення", -1, 6, 38, 249, 71 + LTEXT "Зателефонувати по іншій лінії, коли підключення відповідає обом таким умовам:", 1083, 16, 51, 237, 16, NOT WS_GROUP + LTEXT "Активно не ме&нше:", -1, 16, 73, 100, 8 COMBOBOX 1079, 117, 70, 60, 100, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - LTEXT " &:", 1084, 16, 92, 99, 8, NOT WS_GROUP + LTEXT "Тривалість не &менше:", 1084, 16, 92, 99, 8, NOT WS_GROUP COMBOBOX 1080, 117, 89, 90, 162, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - GROUPBOX " '", -1, 6, 113, 248, 81 - LTEXT " ', :", 1086, 16, 127, 230, 18, NOT WS_GROUP - LTEXT " &:", -1, 16, 150, 92, 8 + GROUPBOX "Автоматичний розрив з'єднання", -1, 6, 113, 248, 81 + LTEXT "Завершити зв'язок, коли підключення відповідає обом таким умовам:", 1086, 16, 127, 230, 18, NOT WS_GROUP + LTEXT "Активно не &більше:", -1, 16, 150, 92, 8 COMBOBOX 1081, 115, 146, 60, 100, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - LTEXT " &:", 1087, 16, 168, 92, 8, NOT WS_GROUP + LTEXT "Тривалість не м&енше:", 1087, 16, 168, 92, 8, NOT WS_GROUP COMBOBOX 1082, 115, 166, 90, 151, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP DEFPUSHBUTTON "OK", 1, 131, 199, 60, 14, WS_GROUP - PUSHBUTTON "", 2, 194, 199, 60, 14 + PUSHBUTTON "Скасувати", 2, 194, 199, 60, 14 END 113 DIALOGEX 21, 46, 225, 65 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION -CAPTION "ϳ %1..." +CAPTION "Підключення до %1..." FONT 8, "MS Shell Dlg" BEGIN ICON 563, 1417, 7, 7, 20, 20 LTEXT "", 1097, 36, 7, 185, 35, SS_NOPREFIX - PUSHBUTTON "", 2, 83, 47, 60, 14 + PUSHBUTTON "Скасувати", 2, 83, 47, 60, 14 END 114 DIALOGEX 6, 18, 225, 60 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "³ " +CAPTION "Віддалений доступ до мережі" FONT 8, "MS Shell Dlg" BEGIN ICON 563, 1098, 7, 6, 20, 20, WS_GROUP - LTEXT " . ?", 1099, 40, 6, 181, 34, NOT WS_GROUP - PUSHBUTTON "&", 1, 60, 42, 50, 14 - DEFPUSHBUTTON "&ͳ", 2, 115, 42, 50, 14 + LTEXT "Спроба автоматичного набору номера не вдалася. Вимкнути автоматичний набір номера для цього розташування?", 1099, 40, 6, 181, 34, NOT WS_GROUP + PUSHBUTTON "&Так", 1, 60, 42, 50, 14 + DEFPUSHBUTTON "&Ні", 2, 115, 42, 50, 14 END 115 DIALOGEX 0, 0, 263, 124 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "ϳ %1" +CAPTION "Підключення до %1" FONT 8, "MS Shell Dlg" BEGIN CONTROL 1678, 1100, "STATIC", SS_BITMAP, 0, 0, 263, 50 - LTEXT "&:", 1412, 9, 60, 68, 8 + LTEXT "Н&абрати:", 1412, 9, 60, 68, 8 COMBOBOX 1416, 88, 56, 165, 112, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | NOT WS_TABSTOP - LTEXT "&̳ :", 1415, 9, 77, 71, 8 + LTEXT "&Місце виклику:", 1415, 9, 77, 71, 8 COMBOBOX 1414, 88, 75, 89, 112, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | NOT WS_TABSTOP - PUSHBUTTON "&", 1108, 181, 75, 72, 14 + PUSHBUTTON "&Правила", 1108, 181, 75, 72, 14 CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 8, 96, 245, 1 - DEFPUSHBUTTON "&", 1590, 8, 103, 61, 14 - PUSHBUTTON "", 1591, 70, 103, 60, 14 - PUSHBUTTON "&", 1107, 132, 103, 60, 14 - PUSHBUTTON "&", 1592, 194, 103, 60, 14 + DEFPUSHBUTTON "&Виклик", 1590, 8, 103, 61, 14 + PUSHBUTTON "Скасувати", 1591, 70, 103, 60, 14 + PUSHBUTTON "В&ластивості", 1107, 132, 103, 60, 14 + PUSHBUTTON "&Довідка", 1592, 194, 103, 60, 14 END 116 DIALOGEX 0, 0, 265, 176 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "ϳ %1" +CAPTION "Підключення до %1" FONT 8, "MS Shell Dlg" BEGIN CONTROL 1678, 1100, "STATIC", SS_BITMAP, 0, 0, 265, 50 - LTEXT "&:", 1413, 8, 60, 88, 8 + LTEXT "&Користувач:", 1413, 8, 60, 88, 8 EDITTEXT 1104, 103, 57, 154, 14, ES_AUTOHSCROLL - LTEXT "&:", 1112, 8, 79, 88, 8 + LTEXT "Парол&ь:", 1112, 8, 79, 88, 8 EDITTEXT 1103, 103, 76, 154, 14, ES_PASSWORD | ES_AUTOHSCROLL CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN, 8, 97, 248, 1 - AUTOCHECKBOX "& ' :", 1101, 14, 105, 239, 13, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP - AUTORADIOBUTTON " & ", 1622, 26, 120, 226, 11, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP - AUTORADIOBUTTON " &- ", 1623, 26, 134, 229, 11, BS_LEFT | BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Зберігати ім'я користувача та пароль:", 1101, 14, 105, 239, 13, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP + AUTORADIOBUTTON "лише дл&я мене", 1622, 26, 120, 226, 11, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP + AUTORADIOBUTTON "для &будь-якого користувача", 1623, 26, 134, 229, 11, BS_LEFT | BS_TOP | BS_MULTILINE CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 8, 149, 248, 1 - DEFPUSHBUTTON "&", 1590, 8, 156, 60, 14, WS_GROUP - PUSHBUTTON "", 1591, 71, 156, 60, 14 - PUSHBUTTON "&", 1107, 133, 156, 60, 14 - PUSHBUTTON "&", 1592, 195, 156, 60, 14 + DEFPUSHBUTTON "&Виклик", 1590, 8, 156, 60, 14, WS_GROUP + PUSHBUTTON "Скасувати", 1591, 71, 156, 60, 14 + PUSHBUTTON "В&ластивості", 1107, 133, 156, 60, 14 + PUSHBUTTON "&Довідка", 1592, 195, 156, 60, 14 END 117 DIALOGEX 0, 0, 263, 192 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "ϳ %1" +CAPTION "Підключення до %1" FONT 8, "MS Shell Dlg" BEGIN CONTROL 1678, 1100, "STATIC", SS_BITMAP, 0, 0, 265, 50 - LTEXT "&:", 1413, 9, 61, 92, 8 + LTEXT "&Користувач:", 1413, 9, 61, 92, 8 EDITTEXT 1104, 102, 57, 154, 14, ES_AUTOHSCROLL - LTEXT "&:", 1112, 9, 80, 92, 8 + LTEXT "Парол&ь:", 1112, 9, 80, 92, 8 EDITTEXT 1103, 102, 76, 154, 14, ES_PASSWORD | ES_AUTOHSCROLL - LTEXT "&:", 1110, 9, 99, 91, 8 + LTEXT "До&мен:", 1110, 9, 99, 91, 8 EDITTEXT 1102, 102, 95, 154, 14, ES_UPPERCASE | ES_AUTOHSCROLL CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN, 9, 116, 247, 1 - AUTOCHECKBOX "& ' :", 1101, 12, 123, 243, 13, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP - AUTORADIOBUTTON " & ", 1622, 25, 137, 229, 11, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP - AUTORADIOBUTTON " &- ", 1623, 25, 151, 230, 11, BS_LEFT | BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Зберігати ім'я користувача та пароль:", 1101, 12, 123, 243, 13, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP + AUTORADIOBUTTON "лише дл&я мене", 1622, 25, 137, 229, 11, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP + AUTORADIOBUTTON "для &будь-якого користувача", 1623, 25, 151, 230, 11, BS_LEFT | BS_TOP | BS_MULTILINE CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 9, 167, 247, 1 - DEFPUSHBUTTON "&", 1590, 8, 173, 60, 14, WS_GROUP - PUSHBUTTON "", 1591, 71, 173, 60, 14 - PUSHBUTTON "&", 1107, 133, 173, 60, 14 - PUSHBUTTON "&", 1592, 195, 173, 60, 14 + DEFPUSHBUTTON "&Виклик", 1590, 8, 173, 60, 14, WS_GROUP + PUSHBUTTON "Скасувати", 1591, 71, 173, 60, 14 + PUSHBUTTON "В&ластивості", 1107, 133, 173, 60, 14 + PUSHBUTTON "&Довідка", 1592, 195, 173, 60, 14 END 118 DIALOGEX 0, 0, 265, 220 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "ϳ %1" +CAPTION "Підключення до %1" FONT 8, "MS Shell Dlg" BEGIN CONTROL 1678, 1100, "STATIC", SS_BITMAP, 0, 0, 265, 50 - LTEXT "&:", 1413, 10, 61, 92, 8 + LTEXT "&Користувач:", 1413, 10, 61, 92, 8 EDITTEXT 1104, 104, 57, 154, 14, ES_AUTOHSCROLL - LTEXT "&:", 1112, 10, 80, 92, 8 + LTEXT "Парол&ь:", 1112, 10, 80, 92, 8 EDITTEXT 1103, 104, 76, 154, 14, ES_PASSWORD | ES_AUTOHSCROLL - LTEXT "&:", 1110, 10, 100, 92, 8 + LTEXT "До&мен:", 1110, 10, 100, 92, 8 EDITTEXT 1102, 104, 95, 154, 14, ES_UPPERCASE | ES_AUTOHSCROLL CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN, 11, 116, 247, 1 - AUTOCHECKBOX "& ' :", 1101, 16, 124, 239, 13, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP - AUTORADIOBUTTON " & ", 1622, 29, 139, 225, 11, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP - AUTORADIOBUTTON " &- ", 1623, 29, 152, 225, 11, BS_LEFT | BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Зберігати ім'я користувача та пароль:", 1101, 16, 124, 239, 13, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP + AUTORADIOBUTTON "лише дл&я мене", 1622, 29, 139, 225, 11, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP + AUTORADIOBUTTON "для &будь-якого користувача", 1623, 29, 152, 225, 11, BS_LEFT | BS_TOP | BS_MULTILINE CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 10, 167, 247, 1 - LTEXT "&:", 1412, 10, 177, 90, 8 + LTEXT "Н&абрати:", 1412, 10, 177, 90, 8 COMBOBOX 1416, 102, 173, 154, 112, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | NOT WS_TABSTOP CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 10, 192, 247, 1 - DEFPUSHBUTTON "&", 1590, 10, 199, 60, 14, WS_GROUP - PUSHBUTTON "", 1591, 72, 199, 60, 14 - PUSHBUTTON "&", 1107, 134, 199, 60, 14 - PUSHBUTTON "&", 1592, 196, 199, 60, 14 + DEFPUSHBUTTON "&Виклик", 1590, 10, 199, 60, 14, WS_GROUP + PUSHBUTTON "Скасувати", 1591, 72, 199, 60, 14 + PUSHBUTTON "В&ластивості", 1107, 134, 199, 60, 14 + PUSHBUTTON "&Довідка", 1592, 196, 199, 60, 14 END 119 DIALOGEX 0, 0, 265, 200 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "ϳ %1" +CAPTION "Підключення до %1" FONT 8, "MS Shell Dlg" BEGIN CONTROL 1678, 1100, "STATIC", SS_BITMAP, 0, 0, 265, 50 - LTEXT "&:", 1413, 10, 62, 91, 8 + LTEXT "&Користувач:", 1413, 10, 62, 91, 8 EDITTEXT 1104, 104, 58, 154, 14, ES_AUTOHSCROLL - LTEXT "&:", 1112, 10, 81, 92, 8 + LTEXT "Парол&ь:", 1112, 10, 81, 92, 8 EDITTEXT 1103, 104, 77, 154, 14, ES_PASSWORD | ES_AUTOHSCROLL CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN, 10, 97, 247, 1 - AUTOCHECKBOX "& ' :", 1101, 12, 103, 243, 13, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP - AUTORADIOBUTTON " & ", 1622, 24, 117, 229, 11, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP - AUTORADIOBUTTON " &- ", 1623, 24, 132, 229, 11, BS_LEFT | BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Зберігати ім'я користувача та пароль:", 1101, 12, 103, 243, 13, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP + AUTORADIOBUTTON "лише дл&я мене", 1622, 24, 117, 229, 11, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP + AUTORADIOBUTTON "для &будь-якого користувача", 1623, 24, 132, 229, 11, BS_LEFT | BS_TOP | BS_MULTILINE CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 10, 147, 247, 1 - LTEXT "&:", 1412, 13, 157, 88, 8 + LTEXT "Н&абрати:", 1412, 13, 157, 88, 8 COMBOBOX 1416, 103, 154, 154, 112, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | NOT WS_TABSTOP CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 10, 173, 247, 1 - DEFPUSHBUTTON "&", 1590, 10, 180, 60, 14, WS_GROUP - PUSHBUTTON "", 1591, 72, 180, 60, 14 - PUSHBUTTON "&", 1107, 134, 180, 60, 14 - PUSHBUTTON "&", 1592, 197, 180, 60, 14 + DEFPUSHBUTTON "&Виклик", 1590, 10, 180, 60, 14, WS_GROUP + PUSHBUTTON "Скасувати", 1591, 72, 180, 60, 14 + PUSHBUTTON "В&ластивості", 1107, 134, 180, 60, 14 + PUSHBUTTON "&Довідка", 1592, 197, 180, 60, 14 END 121 DIALOGEX 6, 18, 230, 131 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION " ISDN" +CAPTION "Настройка ISDN" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "& :", 1155, 9, 9, 65, 8 + LTEXT "&Тип лінії:", 1155, 9, 9, 65, 8 COMBOBOX 1153, 76, 7, 148, 42, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP - AUTOCHECKBOX "& ", 1150, 23, 26, 199, 10, BS_TOP | BS_MULTILINE | WS_GROUP + AUTOCHECKBOX "У&згодження типу лінії", 1150, 23, 26, 199, 10, BS_TOP | BS_MULTILINE | WS_GROUP GROUPBOX " ", 1152, 8, 48, 214, 51, WS_GROUP - AUTOCHECKBOX "& ", 1149, 17, 48, 102, 10, BS_TOP | BS_MULTILINE - LTEXT "& :", 1154, 16, 65, 100, 8, NOT WS_GROUP + AUTOCHECKBOX "&Використовувати старий протокол", 1149, 17, 48, 102, 10, BS_TOP | BS_MULTILINE + LTEXT "Викори&стовувати канали:", 1154, 16, 65, 100, 8, NOT WS_GROUP EDITTEXT 1151, 119, 61, 94, 14, ES_AUTOHSCROLL - AUTOCHECKBOX "& ", 1148, 16, 82, 198, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Увімкнути апаратне стискання", 1148, 16, 82, 198, 10, BS_TOP | BS_MULTILINE PUSHBUTTON "OK", 1, 99, 109, 60, 14, WS_GROUP - PUSHBUTTON "", 2, 163, 109, 60, 14 + PUSHBUTTON "Скасувати", 2, 163, 109, 60, 14 END 122 DIALOGEX 6, 18, 220, 68 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION " ISDN" +CAPTION "Настройка ISDN" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "& :", 1155, 9, 11, 55, 8 + LTEXT "&Тип лінії:", 1155, 9, 11, 55, 8 COMBOBOX 1153, 67, 7, 148, 43, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP - AUTOCHECKBOX "& ", 1150, 21, 28, 194, 10, BS_TOP | BS_MULTILINE | WS_GROUP + AUTOCHECKBOX "У&згодження типу лінії", 1150, 21, 28, 194, 10, BS_TOP | BS_MULTILINE | WS_GROUP PUSHBUTTON "OK", 1, 90, 49, 60, 14, WS_GROUP - PUSHBUTTON "", 2, 154, 49, 60, 14 + PUSHBUTTON "Скасувати", 2, 154, 49, 60, 14 END 123 DIALOGEX 11, 20, 350, 275 @@ -353,11 +353,11 @@ STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN EDITTEXT 1161, 5, 5, 338, 236, ES_MULTILINE | ES_AUTOVSCROLL | WS_VSCROLL | WS_GROUP - LTEXT "IP-&:", 1163, 7, 253, 68, 8 + LTEXT "IP-&адреса:", 1163, 7, 253, 68, 8 CONTROL "", 1160, "RASIPADDRESS", WS_TABSTOP, 76, 250, 117, 14 DEFPUSHBUTTON "", 1162, 197, 252, 16, 13, NOT WS_VISIBLE | WS_GROUP | NOT WS_TABSTOP - PUSHBUTTON "&", 1, 219, 252, 60, 14, WS_GROUP - PUSHBUTTON "", 2, 283, 252, 60, 14 + PUSHBUTTON "&Готово", 1, 219, 252, 60, 14, WS_GROUP + PUSHBUTTON "Скасувати", 2, 283, 252, 60, 14 END 124 DIALOGEX 6, 17, 350, 266 @@ -366,151 +366,151 @@ FONT 8, "MS Shell Dlg" BEGIN EDITTEXT 1161, 5, 4, 340, 236, ES_MULTILINE | ES_AUTOVSCROLL | WS_VSCROLL | WS_GROUP DEFPUSHBUTTON "", 1162, 7, 247, 50, 14, NOT WS_VISIBLE | WS_GROUP | NOT WS_TABSTOP - PUSHBUTTON "&", 1, 222, 247, 60, 14, WS_GROUP - PUSHBUTTON "", 2, 286, 247, 60, 14 + PUSHBUTTON "&Готово", 1, 222, 247, 60, 14, WS_GROUP + PUSHBUTTON "Скасувати", 2, 286, 247, 60, 14 END 125 DIALOGEX 12, 16, 261, 190 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION " " +CAPTION "Настройка модема" FONT 8, "MS Shell Dlg" BEGIN ICON 15102, 1238, 7, 7, 20, 20 - LTEXT "", -1, 25, 27, 24, 8, NOT WS_VISIBLE | NOT WS_GROUP + LTEXT "Модем", -1, 25, 27, 24, 8, NOT WS_VISIBLE | NOT WS_GROUP EDITTEXT 1235, 40, 7, 214, 16, ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER - LTEXT "& (/):", 1243, 7, 36, 110, 8 + LTEXT "&Найбільша швидкість (біт/с):", 1243, 7, 36, 110, 8 COMBOBOX 1239, 119, 34, 136, 186, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | NOT WS_TABSTOP - LTEXT " &", 1244, 7, 52, 111, 8 + LTEXT "Протокол &модема", 1244, 7, 52, 111, 8 COMBOBOX 1245, 119, 50, 136, 186, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | NOT WS_TABSTOP - GROUPBOX " ", 1237, 6, 70, 248, 61, WS_GROUP - AUTOCHECKBOX "& ", 1232, 19, 82, 217, 10, BS_TOP | BS_MULTILINE - AUTOCHECKBOX "& ", 1231, 19, 98, 217, 10, BS_TOP | BS_MULTILINE - AUTOCHECKBOX "& ", 1229, 19, 115, 217, 10, BS_TOP | BS_MULTILINE - AUTOCHECKBOX "& ", 1234, 8, 136, 246, 10, BS_TOP | BS_MULTILINE - AUTOCHECKBOX " & ", 1230, 8, 151, 247, 10, BS_TOP | BS_MULTILINE | WS_GROUP + GROUPBOX "Параметри устаткування", 1237, 6, 70, 248, 61, WS_GROUP + AUTOCHECKBOX "&Апаратне керування потоком", 1232, 19, 82, 217, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "О&бробка помилок модемом", 1231, 19, 98, 217, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Стискання даних модемом", 1229, 19, 115, 217, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Показати вікно термінала", 1234, 8, 136, 246, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Увімкнути &динамік модема", 1230, 8, 151, 247, 10, BS_TOP | BS_MULTILINE | WS_GROUP DEFPUSHBUTTON "OK", 1, 129, 171, 60, 14, WS_GROUP - PUSHBUTTON "", 2, 194, 171, 60, 14 + PUSHBUTTON "Скасувати", 2, 194, 171, 60, 14 END 126 DIALOGEX 0, 0, 270, 117 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION " " +CAPTION "Вибір типу мережного компонента" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " :", -1, 8, 7, 258, 8 + LTEXT "Виберіть тип установлюваного мережного компонента:", -1, 8, 7, 258, 8 CONTROL "", 1251, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x0000C04D, 8, 20, 188, 58 GROUPBOX "", -1, 8, 81, 188, 30 LTEXT "", 1250, 12, 90, 177, 17 - DEFPUSHBUTTON "&...", 1252, 205, 20, 60, 14 - PUSHBUTTON "", 2, 205, 38, 60, 14 + DEFPUSHBUTTON "&Додати...", 1252, 205, 20, 60, 14 + PUSHBUTTON "Скасувати", 2, 205, 38, 60, 14 END 127 DIALOGEX 16, 20, 260, 135 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION "ϳ NetWare " +CAPTION "Підключення до NetWare або сумісної мережі" FONT 8, "MS Shell Dlg" BEGIN ICON 32515, 1278, 7, 7, 21, 20, WS_GROUP - LTEXT " NetWare- PPP IPX.", 1279, 42, 7, 215, 37 - LTEXT " , , , IPX .", 1280, 42, 46, 215, 38, NOT WS_GROUP - AUTOCHECKBOX "& ", 1277, 42, 86, 215, 10, BS_TOP | BS_MULTILINE | WS_GROUP + LTEXT "Наявні підключення до NetWare-сумісної мережі будуть закриті під час установки підключення PPP IPX.", 1279, 42, 7, 215, 37 + LTEXT "Щоб запобігти втраті даних, перед набором номера закрийте всі файли, які використовують ці підключення, або зніміть прапорець IPX у вікні параметрів мережного протоколу для цього елемента.", 1280, 42, 46, 215, 38, NOT WS_GROUP + AUTOCHECKBOX "&Більше не показувати це повідомлення", 1277, 42, 86, 215, 10, BS_TOP | BS_MULTILINE | WS_GROUP DEFPUSHBUTTON "OK", 1, 65, 112, 60, 14, WS_GROUP - PUSHBUTTON "", 2, 134, 112, 60, 14 + PUSHBUTTON "Скасувати", 2, 134, 112, 60, 14 END 128 DIALOGEX 7, 22, 236, 90 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION " " +CAPTION "Набір номера вручну" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ( ). ϳ ""OK"". , , .", 1281, 8, 8, 219, 32 - LTEXT " :", 1282, 8, 46, 91, 8 + LTEXT "Зніміть слухавку і наберіть номер (або попросіть оператора зробити цю дію). Після закінчення набору натисніть кнопку ""OK"". Почекайте, поки сигнал у слухавці не зникне, а потім покладіть її.", 1281, 8, 8, 219, 32 + LTEXT "Номер телефону:", 1282, 8, 46, 91, 8 LTEXT "", 1283, 103, 46, 126, 8, NOT WS_GROUP DEFPUSHBUTTON "OK", 1, 104, 70, 60, 14, WS_GROUP - PUSHBUTTON "", 2, 168, 70, 60, 14 + PUSHBUTTON "Скасувати", 2, 168, 70, 60, 14 END 129 DIALOGEX 6, 20, 260, 85 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION " " +CAPTION "Результат підключення мережних протоколів" FONT 8, "MS Shell Dlg" BEGIN ICON 32516, 1328, 7, 7, 21, 20, WS_GROUP LTEXT "", 1329, 38, 7, 216, 24, NOT WS_GROUP - AUTOCHECKBOX " & ", 1327, 40, 44, 215, 10, BS_TOP | BS_MULTILINE | WS_GROUP - PUSHBUTTON "&", 1, 129, 64, 60, 14 - PUSHBUTTON "&", 2, 193, 64, 60, 14 + AUTOCHECKBOX "Більше &не запитувати невдалі протоколи", 1327, 40, 44, 215, 10, BS_TOP | BS_MULTILINE | WS_GROUP + PUSHBUTTON "Прий&мати", 1, 129, 64, 60, 14 + PUSHBUTTON "&Завершити", 2, 193, 64, 60, 14 END 133 DIALOGEX 6, 18, 231, 211 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION " X.25" +CAPTION "Параметри входу до мережі X.25" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " X.25 X.121 :", 1408, 7, 4, 220, 27 - LTEXT "&:", 1410, 9, 35, 213, 8, NOT WS_GROUP + LTEXT "Виберіть службу доступу до мережі X.25 і введіть адресу X.121 віддаленого сервера:", 1408, 7, 4, 220, 27 + LTEXT "Мере&жа:", 1410, 9, 35, 213, 8, NOT WS_GROUP COMBOBOX 1406, 9, 46, 215, 125, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | NOT WS_TABSTOP - LTEXT "& X.121:", 1407, 9, 66, 213, 8, NOT WS_GROUP + LTEXT "&Адреса X.121:", 1407, 9, 66, 213, 8, NOT WS_GROUP EDITTEXT 1402, 8, 77, 215, 14, ES_AUTOHSCROLL - GROUPBOX "", 1405, 8, 95, 215, 79 - LTEXT "& :", 1411, 19, 109, 182, 8, NOT WS_GROUP + GROUPBOX "Додатково", 1405, 8, 95, 215, 79 + LTEXT "&Дані користувача:", 1411, 19, 109, 182, 8, NOT WS_GROUP EDITTEXT 1404, 19, 120, 193, 14, ES_AUTOHSCROLL - LTEXT "&:", 1409, 19, 138, 182, 8, NOT WS_GROUP + LTEXT "&Послуги:", 1409, 19, 138, 182, 8, NOT WS_GROUP EDITTEXT 1403, 19, 149, 193, 14, ES_AUTOHSCROLL DEFPUSHBUTTON "OK", 1, 100, 189, 60, 14 - PUSHBUTTON "", 2, 164, 189, 60, 14 + PUSHBUTTON "Скасувати", 2, 164, 189, 60, 14 END 146 DIALOGEX 6, 18, 230, 210 STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE | WS_CAPTION -CAPTION " " +CAPTION "Автонабір номера" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " .", -1, 7, 4, 219, 32 - LTEXT "& :", 1006, 8, 42, 213, 8 + LTEXT "У разі розриву підключення до мережі автонабір номера виконуватиметься за кожної спроби отримати доступ до віддаленої інформації.", -1, 7, 4, 219, 32 + LTEXT "Увім&кнути автонабір номера для:", 1006, 8, 42, 213, 8 CONTROL "", 1004, "SYSLISTVIEW32", WS_BORDER | WS_GROUP | WS_TABSTOP | 0x0000C401, 7, 53, 216, 109 - AUTOCHECKBOX "& ", 1496, 8, 170, 218, 9, BS_TOP | BS_MULTILINE - AUTOCHECKBOX "& ", 1550, 8, 185, 217, 9, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Завжди запитувати перед автонабором номера", 1496, 8, 170, 218, 9, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Вимкнути автонабір до мого виходу із системи", 1550, 8, 185, 217, 9, BS_TOP | BS_MULTILINE END 147 DIALOGEX 6, 18, 230, 215 STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE | WS_CAPTION -CAPTION " " +CAPTION "Набір номера" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " Ctrl-Alt-Delete. , , .", 1007, 7, 4, 221, 40, NOT WS_GROUP - LTEXT "&ʳ :", 1005, 7, 55, 154, 8 + LTEXT "Параметри входу до системи через віддалений доступ після натиснення клавіш Ctrl-Alt-Delete. Ви, як адміністратор, маєте доступ до цієї вкладки.", 1007, 7, 4, 221, 40, NOT WS_GROUP + LTEXT "&Кількість спроб повторного набору:", 1005, 7, 55, 154, 8 EDITTEXT 1001, 164, 52, 60, 14, ES_AUTOHSCROLL - LTEXT " & ():", 1009, 7, 73, 156, 8, NOT WS_GROUP + LTEXT "Інтервал між спробам&и набору (с):", 1009, 7, 73, 156, 8, NOT WS_GROUP EDITTEXT 1003, 164, 70, 60, 14, ES_AUTOHSCROLL - LTEXT "& ' ():", 1008, 7, 91, 154, 8, NOT WS_GROUP + LTEXT "&Час простою до роз'єднання (с):", 1008, 7, 91, 154, 8, NOT WS_GROUP EDITTEXT 1002, 164, 88, 60, 14, ES_AUTOHSCROLL END 148 DIALOGEX 6, 18, 230, 215 STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE | WS_CAPTION -CAPTION "³ " +CAPTION "Відповідний виклик" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "ϳ ' , . ? ( VPN-.)", 1043, 8, 4, 219, 43 - AUTORADIOBUTTON "&³ ", 1041, 7, 48, 219, 10, BS_TOP | BS_MULTILINE | WS_GROUP - AUTORADIOBUTTON "&, ", 1040, 7, 61, 219, 10, BS_TOP | BS_MULTILINE - AUTORADIOBUTTON "& :", 1042, 7, 74, 219, 10, BS_TOP | BS_MULTILINE + LTEXT "Після установки зв'язку із сервером він може зробити виклик у відповідь, що зменшить ваші витрати на телефонування. Використовувати зворотний виклик? (Зворотний виклик не підтримується для VPN-підключень.)", 1043, 8, 4, 219, 43 + AUTORADIOBUTTON "&Відповідний виклик не виконується", 1041, 7, 48, 219, 10, BS_TOP | BS_MULTILINE | WS_GROUP + AUTORADIOBUTTON "&Запитувати, коли це пропонує сервер", 1040, 7, 61, 219, 10, BS_TOP | BS_MULTILINE + AUTORADIOBUTTON "Зав&жди робити зворотний виклик за вказаними номерами:", 1042, 7, 74, 219, 10, BS_TOP | BS_MULTILINE CONTROL "", 1037, "SYSLISTVIEW32", WS_BORDER | WS_GROUP | WS_TABSTOP | 0x00008401, 16, 88, 204, 94 - PUSHBUTTON "&...", 1039, 96, 190, 60, 14 - PUSHBUTTON "&", 1038, 159, 190, 60, 14 + PUSHBUTTON "З&мінити...", 1039, 96, 190, 60, 14 + PUSHBUTTON "В&идалити", 1038, 159, 190, 60, 14 END 149 DIALOGEX 6, 18, 317, 142 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT " , . .", 1094, 8, 5, 307, 35 - LTEXT "&:", 1078, 8, 47, 124, 8, NOT WS_GROUP + LTEXT "Слід указати облікові дані вихідного підключення, які використовуватимуться віддаленими маршрутизаторами для підключення до цього інтерфейсу. На цьому маршрутизаторі буде створено обліковий запис користувача із введеними зараз даними.", 1094, 8, 5, 307, 35 + LTEXT "&Користувач:", 1078, 8, 47, 124, 8, NOT WS_GROUP EDITTEXT 1074, 135, 45, 175, 12, ES_AUTOHSCROLL | WS_DISABLED - LTEXT "&:", 1077, 8, 68, 124, 8, NOT WS_GROUP + LTEXT "Парол&ь:", 1077, 8, 68, 124, 8, NOT WS_GROUP EDITTEXT 1073, 135, 66, 175, 12, ES_PASSWORD | ES_AUTOHSCROLL - LTEXT "&ϳ:", 1075, 8, 90, 124, 8, NOT WS_GROUP + LTEXT "&Підтвердження:", 1075, 8, 90, 124, 8, NOT WS_GROUP EDITTEXT 1071, 135, 87, 175, 12, ES_PASSWORD | ES_AUTOHSCROLL END @@ -518,14 +518,14 @@ END STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT " , . ֳ .", 1094, 8, 5, 308, 33 - LTEXT "&:", 1096, 8, 43, 130, 8, NOT WS_GROUP + LTEXT "Слід указати облікові дані вихідного підключення, які використовуватимуться цим інтерфейсом для підключення до віддаленого маршрутизатора. Ці облікові дані мусять співпадати з обліковими даними вхідного підключення на цьому віддаленому маршрутизаторі.", 1094, 8, 5, 308, 33 + LTEXT "&Користувач:", 1096, 8, 43, 130, 8, NOT WS_GROUP EDITTEXT 1091, 140, 40, 175, 12, ES_AUTOHSCROLL - LTEXT "&:", 1093, 8, 63, 130, 8, NOT WS_GROUP + LTEXT "До&мен:", 1093, 8, 63, 130, 8, NOT WS_GROUP EDITTEXT 1089, 140, 60, 175, 12, ES_UPPERCASE | ES_AUTOHSCROLL - LTEXT "&:", 1095, 8, 81, 130, 8, NOT WS_GROUP + LTEXT "Парол&ь:", 1095, 8, 81, 130, 8, NOT WS_GROUP EDITTEXT 1090, 140, 78, 175, 12, ES_PASSWORD | ES_AUTOHSCROLL - LTEXT "&ϳ:", 1092, 8, 99, 130, 8, NOT WS_GROUP + LTEXT "&Підтвердження:", 1092, 8, 99, 130, 8, NOT WS_GROUP EDITTEXT 1088, 140, 96, 175, 12, ES_PASSWORD | ES_AUTOHSCROLL END @@ -533,140 +533,140 @@ END STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT " :", -1, 8, 4, 190, 8 + LTEXT "Введіть назву для цього підключення:", -1, 8, 4, 190, 8 EDITTEXT 1114, 8, 17, 190, 12, ES_AUTOHSCROLL - LTEXT " "" "", """".", -1, 8, 38, 193, 8 - LTEXT " , """" """".", -1, 8, 58, 193, 16 + LTEXT "Щоб зберегти значок підключення до папці ""Мережні підключення"", натисніть кнопку ""Готово"".", -1, 8, 38, 193, 8 + LTEXT "Щоб змінити властивості цього підключення, виділіть його та виберіть із меню ""Файл"" команду ""Властивості"".", -1, 8, 58, 193, 16 END 155 DIALOGEX 0, 0, 231, 215 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION -CAPTION "" +CAPTION "Загальні" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "ϳ& :", 1124, 7, 5, 219, 8 + LTEXT "Підкл&ючення через:", 1124, 7, 5, 219, 8 CONTROL "", 1128, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x00004C0D, 7, 17, 198, 44, WS_EX_CLIENTEDGE - PUSHBUTTON "&", 1132, 210, 18, 16, 14, BS_ICON - PUSHBUTTON "&", 1131, 210, 36, 16, 14, BS_ICON - AUTOCHECKBOX "& ", 1119, 9, 66, 133, 14, BS_TOP | BS_MULTILINE - PUSHBUTTON "&...", 1130, 144, 66, 60, 14 - GROUPBOX "", 1125, 8, 84, 215, 100, WS_GROUP - LTEXT " &:", 1133, 17, 102, 52, 8 + PUSHBUTTON "В&гору", 1132, 210, 18, 16, 14, BS_ICON + PUSHBUTTON "В&низ", 1131, 210, 36, 16, 14, BS_ICON + AUTOCHECKBOX "На&бирати однакові номери для підключення всіх пристроїв", 1119, 9, 66, 133, 14, BS_TOP | BS_MULTILINE + PUSHBUTTON "Нала&штувати...", 1130, 144, 66, 60, 14 + GROUPBOX "Зразок", 1125, 8, 84, 215, 100, WS_GROUP + LTEXT "Код &міста:", 1133, 17, 102, 52, 8 COMBOBOX 1122, 17, 112, 52, 110, CBS_DROPDOWN | WS_VSCROLL | NOT WS_TABSTOP - LTEXT " &:", 1135, 71, 102, 139, 8 + LTEXT "Номер &телефону:", 1135, 71, 102, 139, 8 EDITTEXT 1123, 73, 112, 79, 14, ES_AUTOHSCROLL - PUSHBUTTON "&", 1129, 154, 112, 60, 14 - LTEXT "& :", 1134, 17, 132, 197, 8 + PUSHBUTTON "&Інші", 1129, 154, 112, 60, 14 + LTEXT "&Код країни або регіону:", 1134, 17, 132, 197, 8 COMBOBOX 1126, 17, 143, 193, 130, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | NOT WS_TABSTOP - AUTOCHECKBOX "& ", 1121, 17, 163, 132, 14, BS_TOP | BS_MULTILINE - PUSHBUTTON "&", 1136, 151, 161, 60, 14 - AUTOCHECKBOX "ϳ& ", 1120, 10, 192, 214, 19, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Використовувати правила набору номера", 1121, 17, 163, 132, 14, BS_TOP | BS_MULTILINE + PUSHBUTTON "&Правила", 1136, 151, 161, 60, 14 + AUTOCHECKBOX "Післ&я підключення показати значок в області сповіщень", 1120, 10, 192, 214, 19, BS_TOP | BS_MULTILINE END 156 DIALOGEX 0, 0, 231, 215 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION -CAPTION "" +CAPTION "Загальні" FONT 8, "MS Shell Dlg" BEGIN - PUSHBUTTON "&...", 1130, 164, 38, 60, 14 - GROUPBOX "", 1125, 8, 55, 217, 100, WS_GROUP - LTEXT " &:", 1133, 17, 72, 48, 8 + PUSHBUTTON "Нала&штувати...", 1130, 164, 38, 60, 14 + GROUPBOX "Зразок", 1125, 8, 55, 217, 100, WS_GROUP + LTEXT "Код &міста:", 1133, 17, 72, 48, 8 COMBOBOX 1122, 17, 83, 48, 119, CBS_DROPDOWN | WS_VSCROLL | NOT WS_TABSTOP - LTEXT " &:", 1135, 71, 72, 146, 8 + LTEXT "Номер &телефону:", 1135, 71, 72, 146, 8 EDITTEXT 1123, 71, 83, 81, 14, ES_AUTOHSCROLL - PUSHBUTTON "&", 1129, 155, 83, 63, 14 - LTEXT "& :", 1134, 17, 103, 193, 8 + PUSHBUTTON "&Інші", 1129, 155, 83, 63, 14 + LTEXT "&Код країни або регіону:", 1134, 17, 103, 193, 8 COMBOBOX 1126, 17, 114, 201, 130, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | NOT WS_TABSTOP - AUTOCHECKBOX "& ", 1121, 19, 134, 136, 12, BS_TOP | BS_MULTILINE - PUSHBUTTON "&", 1136, 157, 132, 60, 14 - AUTOCHECKBOX "ϳ& ", 1120, 12, 164, 209, 18, BS_TOP | BS_MULTILINE - LTEXT "ϳ :", 1124, 8, 5, 217, 8 + AUTOCHECKBOX "&Використовувати правила набору номера", 1121, 19, 134, 136, 12, BS_TOP | BS_MULTILINE + PUSHBUTTON "&Правила", 1136, 157, 132, 60, 14 + AUTOCHECKBOX "Післ&я підключення показати значок в області сповіщень", 1120, 12, 164, 209, 18, BS_TOP | BS_MULTILINE + LTEXT "Підключення через:", 1124, 8, 5, 217, 8 CONTROL "", 1127, "SYSLISTVIEW32", WS_DISABLED | WS_BORDER | 0x0000EC0D, 7, 18, 217, 15 END 157 DIALOGEX 6, 18, 235, 160 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION "" +CAPTION "Оформлення" FONT 8, "MS Shell Dlg" BEGIN - AUTOCHECKBOX "& ", 1142, 8, 10, 224, 10, WS_GROUP - AUTOCHECKBOX "& ", 1139, 8, 27, 224, 10 - AUTOCHECKBOX " & ", 1140, 21, 43, 212, 10 - AUTOCHECKBOX "& ", 1143, 8, 59, 224, 10 - AUTOCHECKBOX "& '", 1137, 8, 76, 224, 10 - AUTOCHECKBOX " & ", 1141, 8, 94, 224, 10 - AUTOCHECKBOX "& ", 1144, 22, 111, 210, 10 + AUTOCHECKBOX "&Переглядати номери телефону перед набором номера", 1142, 8, 10, 224, 10, WS_GROUP + AUTOCHECKBOX "По&казувати відомості про розташування перед набором номера", 1139, 8, 27, 224, 10 + AUTOCHECKBOX "Дозволити змінювати &розташування під час входу до системи", 1140, 21, 43, 212, 10 + AUTOCHECKBOX "Показува&ти перебіг підключення під час набору номера", 1143, 8, 59, 224, 10 + AUTOCHECKBOX "&Закрити після установки зв'язку", 1137, 8, 76, 224, 10 + AUTOCHECKBOX "Дозволити вносити зміни до телефонної книги під час в&ходу до системи", 1141, 8, 94, 224, 10 + AUTOCHECKBOX "В&икористовувати майстер для створення записів у телефонній книзі", 1144, 22, 111, 210, 10 END 158 DIALOGEX 6, 18, 235, 160 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION "" +CAPTION "Оформлення" FONT 8, "MS Shell Dlg" BEGIN - AUTOCHECKBOX "& ", 1142, 8, 10, 223, 10, WS_GROUP - AUTOCHECKBOX " & ", 1139, 8, 27, 206, 10 - AUTOCHECKBOX "& ", 1138, 8, 44, 226, 10 - AUTOCHECKBOX "& ", 1143, 8, 61, 224, 10 - AUTOCHECKBOX "& '", 1137, 8, 79, 220, 10 - AUTOCHECKBOX "& ", 1144, 8, 97, 220, 10 - AUTOCHECKBOX "& ", 1136, 8, 114, 220, 10 + AUTOCHECKBOX "&Переглядати номери телефону перед набором номера", 1142, 8, 10, 223, 10, WS_GROUP + AUTOCHECKBOX "Показувати відо&мості про розташування перед набором номера", 1139, 8, 27, 206, 10 + AUTOCHECKBOX "&Запускати монітор віддаленого доступу перед набором номера", 1138, 8, 44, 226, 10 + AUTOCHECKBOX "Показува&ти перебіг підключення під час набору номера", 1143, 8, 61, 224, 10 + AUTOCHECKBOX "За&крити після установки зв'язку", 1137, 8, 79, 220, 10 + AUTOCHECKBOX "В&икористовувати майстер для створення записів у телефонній книзі", 1144, 8, 97, 220, 10 + AUTOCHECKBOX "За&вжди запитувати перед автонабором номера", 1136, 8, 114, 220, 10 END 160 DIALOGEX 6, 18, 320, 145 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_CHILD | WS_VISIBLE | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ' . , .", 1158, 7, 5, 309, 29 - LTEXT "&' :", 1159, 17, 41, 285, 8, NOT WS_GROUP + LTEXT "Виберіть ім'я для інтерфейсу виклику на вимогу. Звичайно інтерфейсам призначаються імена мережі або інтерфейсу, до якого вони підключені.", 1158, 7, 5, 309, 29 + LTEXT "&Ім'я інтерфейсу:", 1159, 17, 41, 285, 8, NOT WS_GROUP EDITTEXT 1157, 17, 53, 284, 12, ES_AUTOHSCROLL - AUTOCHECKBOX " , & ", 1156, 24, 100, 258, 31, BS_TOP | BS_MULTILINE | NOT WS_VISIBLE | WS_DISABLED + AUTOCHECKBOX "Мені добре відомі інтерфейси виклику на вимогу, &я хочу налаштувати властивості вручну", 1156, 24, 100, 258, 31, BS_TOP | BS_MULTILINE | NOT WS_VISIBLE | WS_DISABLED END 162 DIALOGEX 0, 0, 230, 215 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION "" +CAPTION "Безпека" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ", 1580, 8, 3, 215, 139 - AUTORADIOBUTTON "& ( )", 1540, 14, 16, 201, 9, BS_NOTIFY | WS_GROUP - AUTORADIOBUTTON "& ( )", 1541, 14, 102, 198, 8, BS_NOTIFY - LTEXT "& :", 1537, 26, 29, 187, 8, NOT WS_GROUP + GROUPBOX "Параметри безпеки", 1580, 8, 3, 215, 139 + AUTORADIOBUTTON "&Звичайні (рекомендовані параметри)", 1540, 14, 16, 201, 9, BS_NOTIFY | WS_GROUP + AUTORADIOBUTTON "&Додаткові (вибіркові параметри)", 1541, 14, 102, 198, 8, BS_NOTIFY + LTEXT "П&еревіряти користувача таким чином:", 1537, 26, 29, 187, 8, NOT WS_GROUP COMBOBOX 1178, 26, 40, 184, 78, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | NOT WS_TABSTOP - AUTOCHECKBOX "& ' ReactOS ( ' , )", 1174, 26, 58, 184, 20, BS_TOP | BS_MULTILINE - AUTOCHECKBOX "& ( , ')", 1169, 26, 82, 183, 10, BS_TOP | BS_MULTILINE - LTEXT " .", 1539, 15, 114, 134, 20 - PUSHBUTTON "&...", 1180, 151, 115, 60, 14 - GROUPBOX " ", 1177, 8, 146, 215, 62, WS_GROUP - AUTOCHECKBOX "& ", 1173, 14, 159, 198, 11, BS_TOP | BS_MULTILINE - AUTOCHECKBOX "&:", 1172, 14, 172, 57, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Автомат&ично використовувати ім'я для входу та пароль ReactOS (а також ім'я домену, якщо воно є)", 1174, 26, 58, 184, 20, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Потрі&бне шифрування даних (якщо ні, роз'єднуватися)", 1169, 26, 82, 183, 10, BS_TOP | BS_MULTILINE + LTEXT "Використання цих параметрів потребує знання протоколів безпеки.", 1539, 15, 114, 134, 20 + PUSHBUTTON "Параме&три...", 1180, 151, 115, 60, 14 + GROUPBOX "Інтерактивна реєстрація й сценарій", 1177, 8, 146, 215, 62, WS_GROUP + AUTOCHECKBOX "&Показати вікно термінала", 1173, 14, 159, 198, 11, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Сценарій:", 1172, 14, 172, 57, 10, BS_TOP | BS_MULTILINE COMBOBOX 1179, 72, 171, 140, 104, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | NOT WS_TABSTOP - PUSHBUTTON "&...", 1182, 87, 187, 60, 14 - PUSHBUTTON "&...", 1181, 151, 187, 60, 14 + PUSHBUTTON "З&мінити...", 1182, 87, 187, 60, 14 + PUSHBUTTON "О&гляд...", 1181, 151, 187, 60, 14 END 163 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ' .", -1, 6, 3, 307, 13 - LTEXT "& :", -1, 6, 15, 307, 11 + LTEXT "На цьому комп'ютері є більше одного пристрою віддаленого доступу.", -1, 6, 3, 307, 13 + LTEXT "&Виберіть пристрої для цього підключення:", -1, 6, 15, 307, 11 CONTROL "", 1228, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x0000C415, 7, 28, 304, 77 END 165 DIALOGEX 0, 0, 230, 215 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "" +CAPTION "Мережа" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "& , :", 1583, 7, 4, 219, 8 + LTEXT "&Тип сервера віддаленого доступу, який викликають:", 1583, 7, 4, 219, 8 COMBOBOX 1418, 7, 17, 215, 46, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - PUSHBUTTON "&", 1419, 160, 35, 60, 14 - LTEXT "&, :", 1684, 8, 64, 219, 10 + PUSHBUTTON "Парам&етри", 1419, 160, 35, 60, 14 + LTEXT "&Компоненти, які використовуються цим підключенням:", 1684, 8, 64, 219, 10 CONTROL "", 1251, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x0000C40D, 7, 75, 216, 53 - PUSHBUTTON "&...", 1252, 7, 133, 67, 14 - PUSHBUTTON "&", 1254, 80, 133, 67, 14 - PUSHBUTTON "&", 1253, 153, 133, 67, 14 - GROUPBOX "", 1585, 9, 158, 213, 43 + PUSHBUTTON "&Установити...", 1252, 7, 133, 67, 14 + PUSHBUTTON "&Видалити", 1254, 80, 133, 67, 14 + PUSHBUTTON "Власт&ивості", 1253, 153, 133, 67, 14 + GROUPBOX "Опис", 1585, 9, 158, 213, 43 LTEXT "", 1250, 18, 167, 195, 25 END @@ -674,118 +674,118 @@ END STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT " IP- DNS WINS (0.0.0.0), .", 1275, 7, 2, 311, 25 - LTEXT "DNS-&:", 1274, 7, 29, 160, 8, NOT WS_GROUP + LTEXT "Введіть IP-адресу сервера DNS або WINS у віддаленій мережі або залиште нульову адресу (0.0.0.0), якщо її повинен надати віддалений маршрутизатор або якщо вона невідома.", 1275, 7, 2, 311, 25 + LTEXT "DNS-&сервер:", 1274, 7, 29, 160, 8, NOT WS_GROUP CONTROL "", 1272, "RASIPADDRESS", WS_TABSTOP, 21, 41, 85, 12 - LTEXT "WINS-&:", 1276, 7, 65, 166, 8, NOT WS_GROUP + LTEXT "WINS-с&ервер:", 1276, 7, 65, 166, 8, NOT WS_GROUP CONTROL "", 1273, "RASIPADDRESS", WS_TABSTOP, 21, 77, 85, 12 END 167 DIALOGEX 0, 0, 230, 215 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION "" +CAPTION "Параметри" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ", 1289, 7, 2, 213, 64 - AUTOCHECKBOX "& ", 1284, 16, 14, 201, 10 - AUTOCHECKBOX "& ', , ", 1554, 16, 27, 201, 10 - AUTOCHECKBOX "& ReactOS", 1555, 16, 39, 201, 10 - AUTOCHECKBOX " & ", 1285, 16, 52, 200, 10, BS_TOP | BS_MULTILINE - GROUPBOX " ", 1290, 6, 72, 213, 79 - LTEXT "&ʳ :", 1300, 16, 87, 123, 8 + GROUPBOX "Параметри набору номера", 1289, 7, 2, 213, 64 + AUTOCHECKBOX "&Показувати перебіг підключення", 1284, 16, 14, 201, 10 + AUTOCHECKBOX "&Запитувати ім'я, пароль, сертифікат тощо", 1554, 16, 27, 201, 10 + AUTOCHECKBOX "&Включати домен входу до ReactOS", 1555, 16, 39, 201, 10 + AUTOCHECKBOX "Запитувати но&мер телефону", 1285, 16, 52, 200, 10, BS_TOP | BS_MULTILINE + GROUPBOX "Параметри повторного дзвінка", 1290, 6, 72, 213, 79 + LTEXT "&Кількість спроб повторного набору:", 1300, 16, 87, 123, 8 EDITTEXT 1287, 141, 84, 69, 14, ES_AUTOHSCROLL | ES_NUMBER - LTEXT " & :", 1301, 16, 103, 123, 8 + LTEXT "Інтервал мі&ж спробами набору:", 1301, 16, 103, 123, 8 COMBOBOX 1292, 141, 101, 70, 123, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - LTEXT "& ':", 1299, 16, 120, 123, 8 + LTEXT "&Час простою до роз'єднання:", 1299, 16, 120, 123, 8 COMBOBOX 1291, 141, 116, 70, 108, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - AUTOCHECKBOX " '&", 1286, 16, 136, 199, 10, BS_TOP | BS_MULTILINE - GROUPBOX " ", 1288, 7, 156, 213, 32 + AUTOCHECKBOX "Повторити в разі роз'&єднання", 1286, 16, 136, 199, 10, BS_TOP | BS_MULTILINE + GROUPBOX "Використання декількох пристроїв", 1288, 7, 156, 213, 32 COMBOBOX 1551, 16, 169, 128, 45, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - PUSHBUTTON "&...", 1293, 150, 168, 60, 14 + PUSHBUTTON "&Налаштувати...", 1293, 150, 168, 60, 14 PUSHBUTTON "&X.25", 1295, 7, 194, 50, 14 - PUSHBUTTON "& ", 1294, 62, 194, 120, 14, NOT WS_VISIBLE | WS_DISABLED + PUSHBUTTON "В&іртуальне тунельне підключення", 1294, 62, 194, 120, 14, NOT WS_VISIBLE | WS_DISABLED END 168 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Майстер нових підключень" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " . ", -1, 7, 4, 306, 14 - LTEXT " &:", 1308, 7, 19, 130, 8 + LTEXT "Введіть номер телефону. ", -1, 7, 4, 306, 14 + LTEXT "Номер &телефону:", 1308, 7, 19, 130, 8 EDITTEXT 1304, 7, 30, 304, 14, ES_AUTOHSCROLL - LTEXT ", ""1"", . , , . , .", -1, 20, 50, 291, 53 + LTEXT "Можливо, знадобиться додати ""1"", код міста або обидва значення. Щоб визначити, чи це потрібно, наберіть комбінацію номера й коду на своєму телефоні. Якщо чутно звук модема, комбінацію вибрано правильно.", -1, 20, 50, 291, 53 END 169 DIALOGEX 6, 18, 235, 135 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION " " +CAPTION "Телефонна книга" FONT 8, "MS Shell Dlg" BEGIN - LTEXT ":", 1326, 8, 8, 222, 8 - AUTORADIOBUTTON "& ", 1325, 14, 22, 216, 10, WS_GROUP - AUTORADIOBUTTON "& ", 1324, 14, 34, 216, 10 - AUTORADIOBUTTON "& :", 1323, 14, 46, 217, 10 + LTEXT "Використовувати:", 1326, 8, 8, 222, 8 + AUTORADIOBUTTON "&телефонну книгу системи", 1325, 14, 22, 216, 10, WS_GROUP + AUTORADIOBUTTON "&мою особисту телефонну книгу", 1324, 14, 34, 216, 10 + AUTORADIOBUTTON "&цю додаткову телефонну книгу:", 1323, 14, 46, 217, 10 COMBOBOX 1321, 26, 61, 201, 77, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_GROUP | NOT WS_TABSTOP - PUSHBUTTON "&...", 1322, 167, 81, 60, 14 + PUSHBUTTON "О&гляд...", 1322, 167, 81, 60, 14 END 170 DIALOGEX 6, 18, 235, 135 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION " " +CAPTION "Телефонна книга" FONT 8, "MS Shell Dlg" BEGIN - LTEXT ":", 1326, 8, 8, 223, 8 - AUTORADIOBUTTON "& ", 1325, 14, 22, 217, 10, WS_GROUP - AUTORADIOBUTTON "& :", 1323, 14, 36, 216, 10 + LTEXT "Використовувати:", 1326, 8, 8, 223, 8 + AUTORADIOBUTTON "&телефонну книгу системи", 1325, 14, 22, 217, 10, WS_GROUP + AUTORADIOBUTTON "&цю додаткову телефонну книгу:", 1323, 14, 36, 216, 10 COMBOBOX 1321, 26, 51, 203, 77, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | WS_GROUP | NOT WS_TABSTOP - PUSHBUTTON "&...", 1322, 169, 69, 60, 14 + PUSHBUTTON "О&гляд...", 1322, 169, 69, 60, 14 END 171 DIALOGEX 6, 18, 317, 144 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT " IP- (0.0.0.0), . .", 1331, 5, 4, 308, 35 - LTEXT "& IP-:", 1332, 4, 51, 100, 8, NOT WS_GROUP + LTEXT "Введіть IP-адресу цього маршрутизатора в віддаленій мережі або залиште нульову адресу (0.0.0.0), якщо її повинен надати віддалений маршрутизатор. Необхідні відомості можна отримати від оператора віддаленої мережі або маршрутизатора.", 1331, 5, 4, 308, 35 + LTEXT "&Моя IP-адреса:", 1332, 4, 51, 100, 8, NOT WS_GROUP CONTROL "", 1330, "RASIPADDRESS", WS_TABSTOP, 21, 62, 104, 12 - LTEXT ": , ˲ , .", 1333, 5, 94, 306, 36, NOT WS_GROUP + LTEXT "Примітка: якщо установлено мережну плату, НЕ СЛІД використовувати ту саму адресу, що й у вашої мережної плати.", 1333, 5, 94, 306, 36, NOT WS_GROUP END 172 DIALOGEX 6, 18, 317, 144 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ' . .", 1339, 5, 3, 309, 27 - AUTOCHECKBOX "& ", 1462, 15, 31, 162, 10 - AUTOCHECKBOX "&:", 1463, 15, 45, 58, 10 + LTEXT "Деякі сервери й маршрутизатори віддаленого доступу після з'єднання потребують від користувача ввійти до них. Для автоматичного вводу інформації можна використовувати сценарії.", 1339, 5, 3, 309, 27 + AUTOCHECKBOX "&Показати вікно термінала", 1462, 15, 31, 162, 10 + AUTOCHECKBOX "&Сценарій:", 1463, 15, 45, 58, 10 COMBOBOX 1334, 30, 60, 275, 88, CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | NOT WS_TABSTOP - PUSHBUTTON "&...", 1335, 180, 77, 60, 14 - PUSHBUTTON "&...", 1465, 244, 77, 60, 14 + PUSHBUTTON "З&мінити...", 1335, 180, 77, 60, 14 + PUSHBUTTON "О&гляд...", 1465, 244, 77, 60, 14 END 173 DIALOGEX 6, 18, 230, 215 STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE | WS_CAPTION -CAPTION " " +CAPTION "Набір номера" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ", 1344, 9, 4, 213, 53, WS_GROUP - LTEXT "&ʳ :", 1349, 16, 22, 140, 8, NOT WS_GROUP + GROUPBOX "Політика набору номера", 1344, 9, 4, 213, 53, WS_GROUP + LTEXT "&Кількість спроб повторного набору:", 1349, 16, 22, 140, 8, NOT WS_GROUP EDITTEXT 1340, 158, 19, 56, 14, ES_AUTOHSCROLL - LTEXT " & ():", 1351, 16, 38, 140, 8, NOT WS_GROUP + LTEXT "Інтервал між спробам&и набору (с):", 1351, 16, 38, 140, 8, NOT WS_GROUP EDITTEXT 1342, 158, 36, 56, 14, ES_AUTOHSCROLL - GROUPBOX " ", 1343, 9, 63, 213, 56, WS_GROUP - LTEXT "& ' ():", 1350, 28, 88, 124, 8, NOT WS_GROUP - AUTORADIOBUTTON "ϳ& ", 1347, 16, 78, 135, 10, WS_GROUP - AUTORADIOBUTTON "& ", 1348, 16, 103, 199, 10, NOT WS_TABSTOP, WS_EX_TRANSPARENT + GROUPBOX "Тип підключення", 1343, 9, 63, 213, 56, WS_GROUP + LTEXT "&Час простою до роз'єднання (с):", 1350, 28, 88, 124, 8, NOT WS_GROUP + AUTORADIOBUTTON "Підкл&ючення на вимогу", 1347, 16, 78, 135, 10, WS_GROUP + AUTORADIOBUTTON "&Постійне підключення", 1348, 16, 103, 199, 10, NOT WS_TABSTOP, WS_EX_TRANSPARENT EDITTEXT 1341, 159, 85, 56, 14, ES_AUTOHSCROLL - PUSHBUTTON "&³ ...", 1345, 150, 125, 70, 14, WS_GROUP - PUSHBUTTON "& ...", 1346, 74, 125, 70, 14 + PUSHBUTTON "&Відповідний виклик...", 1345, 150, 125, 70, 14, WS_GROUP + PUSHBUTTON "&Декілька ліній...", 1346, 74, 125, 70, 14 END 174 DIALOGEX 0, 0, 215, 226 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "" +CAPTION "Маршрутизатор" FONT 8, "MS Shell Dlg" BEGIN CTEXT "NYI...need spec from KCrocker", -1, 57, 86, 106, 28 @@ -795,74 +795,74 @@ END STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT " .", 1352, 122, 5, 192, 32 - LTEXT " , """".", 1354, 122, 41, 192, 26, NOT WS_GROUP - LTEXT " , """".", 1355, 122, 68, 190, 39, NOT WS_GROUP + LTEXT "Завершення роботи майстра інтерфейсу виклику на вимогу.", 1352, 122, 5, 192, 32 + LTEXT "Щоб створити цей інтерфейс і підключити його до маршрутизатора, натисніть кнопку ""Готово"".", 1354, 122, 41, 192, 26, NOT WS_GROUP + LTEXT "Щоб змінити цей інтерфейс за допомогою диспетчера маршрутизації та віддаленого доступу, виберіть його серед інтерфейсів маршрутизатора й натисніть кнопку ""Властивості"".", 1355, 122, 68, 190, 39, NOT WS_GROUP END 179 DIALOGEX 6, 18, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT "& , .", 1356, 7, 4, 306, 11 + LTEXT "&Виберіть модем або адаптер, який використовуватиметься цим інтерфейсом.", 1356, 7, 4, 306, 11 CONTROL "", 1355, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x0000C415, 6, 15, 305, 80 - LTEXT " , .", 1357, 15, 98, 288, 37, NOT WS_GROUP + LTEXT "У цьому списку наведені пристрої, вибрані для маршрутизації.", 1357, 15, 98, 288, 37, NOT WS_GROUP END 180 DIALOGEX 6, 18, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT " , . , , .", 1360, 7, 4, 305, 42 - LTEXT "& :", 1361, 7, 50, 275, 8, NOT WS_GROUP + LTEXT "Введіть номер телефону сервера або маршрутизатора віддаленого доступу, який слід викликати. Якщо перший номер виявиться недоступним, буде автоматично продовжено набір додаткових номерів, якщо вони є.", 1360, 7, 4, 305, 42 + LTEXT "&Номер телефону або адреса:", 1361, 7, 50, 275, 8, NOT WS_GROUP EDITTEXT 1358, 7, 62, 304, 14, ES_AUTOHSCROLL - PUSHBUTTON "...", 1359, 250, 80, 60, 14 + PUSHBUTTON "Інші...", 1359, 250, 80, 60, 14 END 181 DIALOGEX 6, 18, 230, 215 STYLE DS_SHELLFONT | WS_CHILD | WS_VISIBLE | WS_CAPTION -CAPTION "" +CAPTION "Безпека" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ", 1367, 6, 8, 216, 103, WS_GROUP - AUTORADIOBUTTON " - & , ", 1370, 16, 20, 195, 10, BS_TOP | BS_MULTILINE - AUTORADIOBUTTON "& ", 1373, 16, 36, 195, 10, BS_TOP | BS_MULTILINE - AUTORADIOBUTTON " & MS", 1374, 16, 52, 195, 10, BS_TOP | BS_MULTILINE - AUTOCHECKBOX "& ", 1363, 27, 65, 184, 10, BS_TOP | BS_MULTILINE | WS_GROUP - AUTOCHECKBOX "& ", 1364, 41, 80, 172, 10, BS_TOP | BS_MULTILINE - AUTOCHECKBOX "& ", 1362, 17, 95, 194, 10, BS_TOP | BS_MULTILINE - PUSHBUTTON "& ", 1369, 59, 117, 80, 14, WS_GROUP - PUSHBUTTON "&...", 1368, 142, 117, 80, 14, NOT WS_VISIBLE | WS_DISABLED - AUTOCHECKBOX " & '", 1365, 7, 198, 218, 10, BS_TOP | BS_MULTILINE | NOT WS_VISIBLE | WS_DISABLED + GROUPBOX "Політика перевірки автентичності й шифрування", 1367, 6, 8, 216, 103, WS_GROUP + AUTORADIOBUTTON "Дозволити будь-яку &перевірку автентичності, включаючи відкритий текст", 1370, 16, 20, 195, 10, BS_TOP | BS_MULTILINE + AUTORADIOBUTTON "До&зволити лише шифровану перевірку автентичності", 1373, 16, 36, 195, 10, BS_TOP | BS_MULTILINE + AUTORADIOBUTTON "Дозволити лиш&е перевірку автентичності з шифруванням MS", 1374, 16, 52, 195, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Вимага&ти шифрування даних", 1363, 27, 65, 184, 10, BS_TOP | BS_MULTILINE | WS_GROUP + AUTOCHECKBOX "&Вимагати стійкого шифрування даних", 1364, 41, 80, 172, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Дво&бічна перевірка автентичності", 1362, 17, 95, 194, 10, BS_TOP | BS_MULTILINE + PUSHBUTTON "В&идалити збережений пароль", 1369, 59, 117, 80, 14, WS_GROUP + PUSHBUTTON "&Додатково...", 1368, 142, 117, 80, 14, NOT WS_VISIBLE | WS_DISABLED + AUTOCHECKBOX "Виявляти спільні файли й при&нтери до установки зв'язку", 1365, 7, 198, 218, 10, BS_TOP | BS_MULTILINE | NOT WS_VISIBLE | WS_DISABLED END 182 DIALOGEX 6, 18, 248, 148 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION "" +CAPTION "Безпека" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ", 1367, 7, 8, 200, 98, WS_GROUP - AUTORADIOBUTTON " - & , ", 1370, 14, 24, 183, 10 - AUTORADIOBUTTON " & ", 1373, 14, 39, 183, 10 - AUTORADIOBUTTON " & MS", 1374, 14, 53, 184, 10 - AUTOCHECKBOX "& ", 1363, 33, 67, 165, 10, WS_GROUP - AUTOCHECKBOX "& ", 1364, 48, 79, 152, 10 - AUTOCHECKBOX "& ' ", 1366, 31, 91, 165, 10 - PUSHBUTTON " & ", 1369, 6, 114, 100, 14, WS_GROUP - PUSHBUTTON "&...", 1368, 109, 114, 60, 14, NOT WS_VISIBLE | WS_DISABLED - AUTOCHECKBOX " & '", 1365, 14, 134, 193, 10, NOT WS_VISIBLE | WS_DISABLED + GROUPBOX "Політика перевірки автентичності й шифрування", 1367, 7, 8, 200, 98, WS_GROUP + AUTORADIOBUTTON "Дозволити будь-яку &перевірку автентичності, включаючи відкритий текст", 1370, 14, 24, 183, 10 + AUTORADIOBUTTON "Дозволити лише &шифровану перевірку автентичності", 1373, 14, 39, 183, 10 + AUTORADIOBUTTON "Дозволити лиш&е перевірку автентичності з шифруванням MS", 1374, 14, 53, 184, 10 + AUTOCHECKBOX "Вимага&ти шифрування даних", 1363, 33, 67, 165, 10, WS_GROUP + AUTOCHECKBOX "&Вимагати стійкого шифрування даних", 1364, 48, 79, 152, 10 + AUTOCHECKBOX "В&икористовувати поточні ім'я й пароль ", 1366, 31, 91, 165, 10 + PUSHBUTTON "Видалити &збережений пароль", 1369, 6, 114, 100, 14, WS_GROUP + PUSHBUTTON "&Додатково...", 1368, 109, 114, 60, 14, NOT WS_VISIBLE | WS_DISABLED + AUTOCHECKBOX "Виявляти спільні файли й при&нтери до установки зв'язку", 1365, 14, 134, 193, 10, NOT WS_VISIBLE | WS_DISABLED END 183 DIALOGEX 6, 18, 317, 144 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT " :", 1388, 7, 4, 296, 9 - AUTOCHECKBOX "& IP .", 1386, 20, 19, 285, 11, BS_LEFT | BS_TOP | BS_MULTILINE - AUTOCHECKBOX "& IPX .", 1387, 20, 35, 287, 11, BS_LEFT | BS_TOP | BS_MULTILINE - AUTOCHECKBOX " & .", 1382, 20, 52, 287, 11, BS_LEFT | BS_TOP | BS_MULTILINE - AUTOCHECKBOX "& , .", 1385, 20, 70, 287, 11, BS_LEFT | BS_TOP | BS_MULTILINE - AUTOCHECKBOX "& .", 1384, 20, 87, 289, 22, BS_LEFT | BS_TOP | BS_MULTILINE + LTEXT "Позначте всі застосовні параметри:", 1388, 7, 4, 296, 9 + AUTOCHECKBOX "&Переспрямовувати пакети IP на цей інтерфейс.", 1386, 20, 19, 285, 11, BS_LEFT | BS_TOP | BS_MULTILINE + AUTOCHECKBOX "П&ереспрямовувати пакети IPX на цей інтерфейс.", 1387, 20, 35, 287, 11, BS_LEFT | BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Додати о&бліковий запис для вхідних дзвінків віддаленого маршрутизатора.", 1382, 20, 52, 287, 11, BS_LEFT | BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Надс&илати незашифрований пароль, якщо це єдиний спосіб підключення.", 1385, 20, 70, 287, 11, BS_LEFT | BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Викори&стовувати сценарій для завершення підключення до віддаленого маршрутизатора.", 1384, 20, 87, 289, 22, BS_LEFT | BS_TOP | BS_MULTILINE END 184 DIALOGEX 0, 0, 317, 143 @@ -873,202 +873,202 @@ END 186 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Майстер нових підключень" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "ϳ, , , .", -1, 7, 4, 306, 23 - LTEXT " :", -1, 14, 27, 288, 12 - AUTORADIOBUTTON " & ", 1400, 26, 40, 265, 10, BS_TOP | BS_MULTILINE | NOT WS_TABSTOP - AUTORADIOBUTTON " & ", 1401, 26, 55, 265, 10, BS_TOP | BS_MULTILINE | NOT WS_TABSTOP + LTEXT "Підключення, створене лише для вашого використання, зберігається в профілі вашого облікового запису й недоступне, поки ви не ввійдете до системи.", -1, 7, 4, 306, 23 + LTEXT "Створити це підключення:", -1, 14, 27, 288, 12 + AUTORADIOBUTTON "для в&сіх користувачів", 1400, 26, 40, 265, 10, BS_TOP | BS_MULTILINE | NOT WS_TABSTOP + AUTORADIOBUTTON "лише дл&я мене", 1401, 26, 55, 265, 10, BS_TOP | BS_MULTILINE | NOT WS_TABSTOP END 498 DIALOGEX 12, 16, 215, 126 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "ϳ %1" +CAPTION "Підключення до %1" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "ReactOS . ' .", 1396, 7, 6, 206, 36 - LTEXT "&:", 1399, 8, 51, 49, 8 + LTEXT "ReactOS не вдалося підключитися до мережі з використанням наданих імені користувача й пароля. Введіть ім'я користувача й пароль заново.", 1396, 7, 6, 206, 36 + LTEXT "&Користувач:", 1399, 8, 51, 49, 8 EDITTEXT 1394, 66, 46, 143, 14, ES_AUTOHSCROLL - LTEXT "&:", 1397, 8, 70, 49, 8, NOT WS_GROUP + LTEXT "Парол&ь:", 1397, 8, 70, 49, 8, NOT WS_GROUP EDITTEXT 1393, 66, 64, 143, 14, ES_PASSWORD | ES_AUTOHSCROLL - AUTOCHECKBOX "& ", 1391, 66, 84, 143, 10 + AUTOCHECKBOX "&Зберегти пароль", 1391, 66, 84, 143, 10 CONTROL "", 1398, "STATIC", SS_ETCHEDHORZ | WS_GROUP, 7, 98, 200, 1 DEFPUSHBUTTON "OK", 1, 81, 104, 60, 14, WS_GROUP - PUSHBUTTON "", 2, 145, 104, 60, 14 + PUSHBUTTON "Скасувати", 2, 145, 104, 60, 14 END 500 DIALOGEX 12, 16, 215, 173 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "ϳ %1" +CAPTION "Підключення до %1" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "ReactOS . ' .", 1396, 7, 6, 209, 26 - LTEXT "&:", 1399, 7, 72, 44, 8 + LTEXT "ReactOS не вдалося підключитися до мережі з використанням наданих імені користувача й пароля. Введіть ім'я користувача й пароль заново.", 1396, 7, 6, 209, 26 + LTEXT "&Користувач:", 1399, 7, 72, 44, 8 EDITTEXT 1394, 97, 69, 115, 14, ES_AUTOHSCROLL - LTEXT "&:", 1397, 7, 90, 45, 8, NOT WS_GROUP + LTEXT "Парол&ь:", 1397, 7, 90, 45, 8, NOT WS_GROUP EDITTEXT 1393, 97, 87, 115, 14, ES_PASSWORD | ES_AUTOHSCROLL - LTEXT "&:", 1395, 7, 108, 53, 8, NOT WS_GROUP + LTEXT "&Домен:", 1395, 7, 108, 53, 8, NOT WS_GROUP EDITTEXT 1392, 97, 105, 115, 14, ES_UPPERCASE | ES_AUTOHSCROLL - AUTOCHECKBOX "& ", 1391, 85, 125, 123, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Зберегти пароль", 1391, 85, 125, 123, 10, BS_TOP | BS_MULTILINE DEFPUSHBUTTON "OK", 1, 87, 146, 60, 14, WS_GROUP - PUSHBUTTON "", 2, 151, 146, 60, 14 + PUSHBUTTON "Скасувати", 2, 151, 146, 60, 14 CONTROL "", 1398, "STATIC", SS_ETCHEDHORZ | WS_GROUP, 7, 140, 205, 1 - LTEXT " \n. ( ' ')", -1, 8, 38, 209, 26 + LTEXT "Поле імені домену можна заповнити або залишити \nпустим. (Для підключення до Інтернету ім'я домену не є обов'язковим)", -1, 8, 38, 209, 26 END 502 DIALOGEX 20, 60, 215, 73 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION " PPP" +CAPTION "Параметри PPP" FONT 8, "MS Shell Dlg" BEGIN - AUTOCHECKBOX "& LCP", 1423, 9, 7, 200, 10, BS_TOP | BS_MULTILINE - AUTOCHECKBOX "& ", 1424, 9, 22, 201, 10, BS_TOP | BS_MULTILINE - AUTOCHECKBOX "& ", 1557, 9, 37, 202, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Увімкнути розширення LCP", 1423, 9, 7, 200, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Використовувати програмне стискання даних", 1424, 9, 22, 201, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "У&згоджувати багатоканальність для одноканальних підключень", 1557, 9, 37, 202, 10, BS_TOP | BS_MULTILINE DEFPUSHBUTTON "OK", 1, 82, 53, 60, 14 - PUSHBUTTON "", 2, 148, 53, 60, 14 + PUSHBUTTON "Скасувати", 2, 148, 53, 60, 14 END 509 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION -CAPTION " " +CAPTION "Майстер нових підключень" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ':", -1, 10, 5, 275, 9 - AUTORADIOBUTTON "& '", 1483, 31, 20, 265, 10, BS_TOP | BS_MULTILINE | WS_GROUP - AUTORADIOBUTTON "& '", 1484, 31, 44, 265, 10, BS_TOP | BS_MULTILINE - LTEXT " ' , .", -1, 45, 31, 253, 13, NOT WS_GROUP | WS_TABSTOP - LTEXT " ' '.", -1, 43, 56, 253, 23, NOT WS_GROUP + LTEXT "Виберіть роль для цього комп'ютера:", -1, 10, 5, 275, 9 + AUTORADIOBUTTON "&Ведений комп'ютер", 1483, 31, 20, 265, 10, BS_TOP | BS_MULTILINE | WS_GROUP + AUTORADIOBUTTON "&Провідний комп'ютер", 1484, 31, 44, 265, 10, BS_TOP | BS_MULTILINE + LTEXT "Цей комп'ютер містить інформацію, до якої потрібно отримати доступ.", -1, 45, 31, 253, 13, NOT WS_GROUP | WS_TABSTOP + LTEXT "Цей комп'ютер використовується для доступу до інформації на веденому комп'ютері.", -1, 43, 56, 253, 23, NOT WS_GROUP END 511 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT "& :", -1, 8, 5, 261, 8 + LTEXT "&Виберіть пристрій:", -1, 8, 5, 261, 8 COMBOBOX 1485, 9, 18, 302, 62, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | NOT WS_TABSTOP END 528 DIALOGEX 0, 0, 227, 215 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION "ϳ" +CAPTION "Підключення" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ", 1582, 8, 10, 213, 63 - LTEXT ", , .", 1581, 16, 21, 194, 30 - AUTOCHECKBOX " & ", 1497, 16, 56, 195, 10, BS_TOP | BS_MULTILINE + GROUPBOX "Привілеї входу", 1582, 8, 10, 213, 63 + LTEXT "Користувачам, які не є адміністраторами, може бути дозволено створювати або змінювати підключення перед входом до мережі.", 1581, 16, 21, 194, 30 + AUTOCHECKBOX "Дозволити ство&рення й зміну підключень перед входом до мережі", 1497, 16, 56, 195, 10, BS_TOP | BS_MULTILINE END 532 DIALOGEX 0, 0, 263, 263 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "³ " +CAPTION "Відповідний виклик маршрутизатора" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "ϳ ' , '. ?", 1043, 7, 5, 253, 24 - AUTORADIOBUTTON "&³ ", 1501, 9, 36, 252, 10, BS_TOP | BS_MULTILINE | WS_GROUP - AUTORADIOBUTTON "& :", 1502, 9, 48, 252, 10, BS_TOP | BS_MULTILINE, WS_EX_TRANSPARENT + LTEXT "Після установки зв'язку з маршрутизатором він може зробити виклик у відповідь, що зменшить ваші витрати на телефонування та підвищить безпеку з'єднання. Використовувати зворотний виклик?", 1043, 7, 5, 253, 24 + AUTORADIOBUTTON "&Відповідний виклик не виконується", 1501, 9, 36, 252, 10, BS_TOP | BS_MULTILINE | WS_GROUP + AUTORADIOBUTTON "Зав&жди робити зворотний виклик за вказаними номерами:", 1502, 9, 48, 252, 10, BS_TOP | BS_MULTILINE, WS_EX_TRANSPARENT CONTROL "", 1503, "SYSLISTVIEW32", WS_BORDER | WS_GROUP | WS_TABSTOP | 0x00008401, 15, 63, 240, 143 - PUSHBUTTON "&...", 1504, 131, 213, 60, 14 - PUSHBUTTON "&", 1505, 194, 213, 60, 14 + PUSHBUTTON "З&мінити...", 1504, 131, 213, 60, 14 + PUSHBUTTON "В&идалити", 1505, 194, 213, 60, 14 CONTROL "", -1, "STATIC", SS_ETCHEDHORZ, 7, 233, 249, 1 DEFPUSHBUTTON "OK", 1, 132, 242, 60, 14 - PUSHBUTTON "", 2, 196, 242, 60, 14 + PUSHBUTTON "Скасувати", 2, 196, 242, 60, 14 END 534 DIALOGEX 0, 0, 230, 215 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION "" +CAPTION "Параметри" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ", 1289, 7, 7, 215, 55 - AUTORADIOBUTTON "& ", 1506, 16, 20, 199, 9, BS_TOP | BS_MULTILINE | WS_GROUP | NOT WS_TABSTOP - LTEXT "& ':", 1299, 27, 33, 99, 8, NOT WS_GROUP + GROUPBOX "Тип підключення", 1289, 7, 7, 215, 55 + AUTORADIOBUTTON "В&иклик на вимогу", 1506, 16, 20, 199, 9, BS_TOP | BS_MULTILINE | WS_GROUP | NOT WS_TABSTOP + LTEXT "&Час простою до роз'єднання:", 1299, 27, 33, 99, 8, NOT WS_GROUP COMBOBOX 1291, 144, 30, 70, 108, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - AUTORADIOBUTTON "& ", 1507, 16, 47, 197, 9, BS_TOP | BS_MULTILINE | NOT WS_TABSTOP - GROUPBOX " ", 1290, 7, 66, 215, 48 - LTEXT "&ʳ :", 1300, 14, 79, 123, 8 + AUTORADIOBUTTON "&Постійне підключення", 1507, 16, 47, 197, 9, BS_TOP | BS_MULTILINE | NOT WS_TABSTOP + GROUPBOX "Політика набору номера", 1290, 7, 66, 215, 48 + LTEXT "&Кількість спроб повторного набору:", 1300, 14, 79, 123, 8 EDITTEXT 1287, 143, 76, 70, 14, ES_AUTOHSCROLL | ES_NUMBER - LTEXT "& :", 1301, 14, 96, 123, 8 + LTEXT "&Середній інтервал між спробами:", 1301, 14, 96, 123, 8 COMBOBOX 1292, 143, 94, 70, 123, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - GROUPBOX " ", 1288, 7, 116, 215, 35 + GROUPBOX "Використання декількох пристроїв", 1288, 7, 116, 215, 35 COMBOBOX 1551, 16, 130, 128, 41, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - PUSHBUTTON "&...", 1293, 150, 129, 65, 14 - PUSHBUTTON "&³ ", 1302, 8, 195, 60, 14 + PUSHBUTTON "&Налаштувати...", 1293, 150, 129, 65, 14 + PUSHBUTTON "&Відповідний виклик", 1302, 8, 195, 60, 14 PUSHBUTTON "&X.25", 1295, 73, 195, 50, 14 END 539 DIALOGEX 0, 0, 265, 110 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "ϳ %1" +CAPTION "Підключення до %1" FONT 8, "MS Shell Dlg" BEGIN CONTROL 1678, 1100, "STATIC", SS_BITMAP, 0, 0, 265, 50 - LTEXT "&:", 1413, 14, 64, 84, 8 + LTEXT "&Користувач:", 1413, 14, 64, 84, 8 EDITTEXT 1104, 102, 62, 154, 14, ES_AUTOHSCROLL CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 9, 82, 247, 1 - DEFPUSHBUTTON "&", 1590, 8, 89, 60, 14 - PUSHBUTTON "", 1591, 71, 89, 60, 14 - PUSHBUTTON "&", 1107, 133, 89, 60, 14 - PUSHBUTTON "&", 1592, 195, 89, 60, 14 + DEFPUSHBUTTON "&Виклик", 1590, 8, 89, 60, 14 + PUSHBUTTON "Скасувати", 1591, 71, 89, 60, 14 + PUSHBUTTON "В&ластивості", 1107, 133, 89, 60, 14 + PUSHBUTTON "&Довідка", 1592, 195, 89, 60, 14 END 540 DIALOGEX 0, 0, 265, 133 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "ϳ %1" +CAPTION "Підключення до %1" FONT 8, "MS Shell Dlg" BEGIN CONTROL 1678, 1100, "STATIC", SS_BITMAP, 0, 0, 265, 50 - LTEXT "&:", 1413, 10, 64, 90, 8 + LTEXT "&Користувач:", 1413, 10, 64, 90, 8 EDITTEXT 1104, 105, 60, 154, 14, ES_AUTOHSCROLL CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 7, 80, 252, 1 - LTEXT "&:", 1412, 10, 91, 92, 10 + LTEXT "Н&абрати:", 1412, 10, 91, 92, 10 COMBOBOX 1416, 105, 88, 154, 112, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | NOT WS_TABSTOP CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 7, 107, 251, 1 - DEFPUSHBUTTON "&", 1590, 8, 113, 60, 14 - PUSHBUTTON "", 1591, 71, 113, 60, 14 - PUSHBUTTON "&", 1107, 134, 113, 60, 14 - PUSHBUTTON "&", 1592, 197, 113, 60, 14 + DEFPUSHBUTTON "&Виклик", 1590, 8, 113, 60, 14 + PUSHBUTTON "Скасувати", 1591, 71, 113, 60, 14 + PUSHBUTTON "В&ластивості", 1107, 134, 113, 60, 14 + PUSHBUTTON "&Довідка", 1592, 197, 113, 60, 14 END 541 DIALOGEX 0, 0, 265, 157 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "ϳ %1" +CAPTION "Підключення до %1" FONT 8, "MS Shell Dlg" BEGIN CONTROL 1678, 1100, "STATIC", SS_BITMAP, 0, 0, 265, 50 - LTEXT "&:", 1413, 12, 67, 87, 8 + LTEXT "&Користувач:", 1413, 12, 67, 87, 8 EDITTEXT 1104, 103, 63, 154, 14, ES_AUTOHSCROLL CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 9, 84, 248, 1 - LTEXT "&:", 1412, 11, 96, 48, 8 + LTEXT "Н&абрати:", 1412, 11, 96, 48, 8 COMBOBOX 1416, 103, 92, 154, 112, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | NOT WS_TABSTOP - LTEXT "&̳ :", 1415, 10, 114, 46, 8 + LTEXT "&Місце виклику:", 1415, 10, 114, 46, 8 COMBOBOX 1414, 102, 110, 87, 112, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | NOT WS_TABSTOP - PUSHBUTTON "&", 1108, 193, 110, 64, 14 + PUSHBUTTON "&Правила", 1108, 193, 110, 64, 14 CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 7, 130, 250, 1 - DEFPUSHBUTTON "&", 1590, 6, 136, 60, 14 - PUSHBUTTON "", 1591, 69, 136, 60, 14 - PUSHBUTTON "&", 1107, 132, 136, 60, 14 - PUSHBUTTON "&", 1592, 196, 136, 60, 14 + DEFPUSHBUTTON "&Виклик", 1590, 6, 136, 60, 14 + PUSHBUTTON "Скасувати", 1591, 69, 136, 60, 14 + PUSHBUTTON "В&ластивості", 1107, 132, 136, 60, 14 + PUSHBUTTON "&Довідка", 1592, 196, 136, 60, 14 END 544 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Майстер нових підключень" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ' .", -1, 10, 5, 300, 22 - AUTOCHECKBOX "& ", 1512, 21, 31, 272, 10 - LTEXT " , - ' , .", 1514, 10, 56, 294, 22 - AUTOCHECKBOX "& ", 1513, 21, 86, 260, 10 + LTEXT "Спільний доступ до підключення до Інтернету дає змогу іншим комп'ютерам у вашій локальній мережі отримувати доступ до зовнішніх ресурсів через це підключення.", -1, 10, 5, 300, 22 + AUTOCHECKBOX "&Дозволити спільний доступ для цього підключення", 1512, 21, 31, 272, 10 + LTEXT "Щоб установлювати це підключення автоматично, коли будь-який комп'ютер у вашій локальній мережі намагатиметься отримати доступ до зовнішніх ресурсів, установіть цей прапорець.", 1514, 10, 56, 294, 22 + AUTOCHECKBOX "До&зволити виклик на вимогу", 1513, 21, 86, 260, 10 END 545 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Майстер нових підключень" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ' . .", -1, 10, 5, 300, 25 - LTEXT "& , :", -1, 21, 35, 285, 8 + LTEXT "Спільний доступ дає змогу іншим комп'ютерам у вашій локальній мережі отримувати доступ до зовнішніх ресурсів через це підключення віддаленого доступу. Одночасно можна дозволяти спільний доступ лише для одного підключення й одної локальної мережі.", -1, 10, 5, 300, 25 + LTEXT "&Виберіть локальну мережу, яка отримає доступ до ресурсів через це підключення:", -1, 21, 35, 285, 8 COMBOBOX 1522, 21, 48, 231, 56, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | NOT WS_TABSTOP END @@ -1076,274 +1076,274 @@ END STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT " - . - ?", -1, 10, 5, 303, 22 - AUTORADIOBUTTON "& - ", 1524, 26, 29, 264, 12, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP | NOT WS_TABSTOP - AUTORADIOBUTTON "& - ", 1525, 26, 44, 261, 16, BS_LEFT | BS_TOP | BS_MULTILINE | NOT WS_TABSTOP + LTEXT "Можна налаштувати це підключення для використання смарт-картки для входу до віддаленої мережі. Використовувати смарт-картку для цього підключення?", -1, 10, 5, 303, 22 + AUTORADIOBUTTON "&Використовувати мою смарт-картку ", 1524, 26, 29, 264, 12, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP | NOT WS_TABSTOP + AUTORADIOBUTTON "&Не використовувати мою смарт-картку ", 1525, 26, 44, 261, 16, BS_LEFT | BS_TOP | BS_MULTILINE | NOT WS_TABSTOP END 547 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION -CAPTION " " +CAPTION "Майстер інтерфейсу виклику на вимогу" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " .", 1530, 122, 8, 192, 32 - LTEXT " .", 1531, 122, 43, 192, 37 - LTEXT " , """".", 1532, 122, 85, 191, 29 + LTEXT "Майстер інтерфейсу виклику на вимогу.", 1530, 122, 8, 192, 32 + LTEXT "За допомогою цього майстра можна створити інтерфейс виклику на вимогу для підключення цього маршрутизатора до інших маршрутизаторів.", 1531, 122, 43, 192, 37 + LTEXT "Щоб продовжити, натисніть кнопку ""Далі"".", 1532, 122, 85, 191, 29 END 548 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - AUTORADIOBUTTON "ϳ & , ISDN .", 1531, 21, 17, 290, 15, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP | NOT WS_TABSTOP - AUTORADIOBUTTON "ϳ & (VPN)", 1532, 21, 38, 291, 15, BS_LEFT | BS_TOP | BS_MULTILINE | NOT WS_TABSTOP - AUTORADIOBUTTON "ϳ PPP Ethernet (PPPoE)", 1688, 21, 58, 290, 12, NOT WS_TABSTOP + AUTORADIOBUTTON "Підключатися за допо&могою модема, адаптера ISDN або іншого фізичного пристрою.", 1531, 21, 17, 290, 15, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP | NOT WS_TABSTOP + AUTORADIOBUTTON "Підключатися за допомогою &віртуальної приватної мережі (VPN)", 1532, 21, 38, 291, 15, BS_LEFT | BS_TOP | BS_MULTILINE | NOT WS_TABSTOP + AUTORADIOBUTTON "Підключатися за допомогою PPP через Ethernet (PPPoE)", 1688, 21, 58, 290, 12, NOT WS_TABSTOP END 550 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_CHILD | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ' IP- , .", 1535, 10, 8, 289, 18 - LTEXT "' ' IP- (&, reactos.org 145.52.0.1):", 1537, 21, 35, 285, 8 + LTEXT "Введіть ім'я або IP-адресу маршрутизатора, до якого ви підключаєтеся.", 1535, 10, 8, 289, 18 + LTEXT "Ім'я комп'ютера або IP-адреса (напр&иклад, reactos.org або 145.52.0.1):", 1537, 21, 35, 285, 8 EDITTEXT 1536, 21, 47, 285, 14, ES_AUTOHSCROLL END 551 DIALOGEX 0, 0, 265, 127 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "ϳ %1" +CAPTION "Підключення до %1" FONT 8, "MS Shell Dlg" BEGIN CONTROL 1678, 1100, "STATIC", SS_BITMAP, 0, 0, 265, 50 - LTEXT "&:", 1413, 12, 62, 89, 8 + LTEXT "&Користувач:", 1413, 12, 62, 89, 8 EDITTEXT 1104, 104, 58, 154, 14, ES_AUTOHSCROLL - LTEXT "&:", 1110, 12, 82, 90, 8 + LTEXT "До&мен:", 1110, 12, 82, 90, 8 EDITTEXT 1102, 104, 79, 154, 14, ES_UPPERCASE | ES_AUTOHSCROLL CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 10, 99, 248, 1 - DEFPUSHBUTTON "&", 1590, 9, 106, 61, 14 - PUSHBUTTON "", 1591, 72, 106, 60, 14 - PUSHBUTTON "&", 1107, 135, 106, 60, 14 - PUSHBUTTON "&", 1592, 198, 106, 60, 14 + DEFPUSHBUTTON "&Виклик", 1590, 9, 106, 61, 14 + PUSHBUTTON "Скасувати", 1591, 72, 106, 60, 14 + PUSHBUTTON "В&ластивості", 1107, 135, 106, 60, 14 + PUSHBUTTON "&Довідка", 1592, 198, 106, 60, 14 END 552 DIALOGEX 0, 0, 265, 159 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "ϳ %1" +CAPTION "Підключення до %1" FONT 8, "MS Shell Dlg" BEGIN CONTROL 1678, 1100, "STATIC", SS_BITMAP, 0, 0, 265, 50 - LTEXT "&:", 1413, 10, 67, 91, 10 + LTEXT "&Користувач:", 1413, 10, 67, 91, 10 EDITTEXT 1104, 104, 64, 154, 14, ES_AUTOHSCROLL - LTEXT "&:", 1110, 11, 86, 91, 8 + LTEXT "До&мен:", 1110, 11, 86, 91, 8 EDITTEXT 1102, 104, 83, 154, 14, ES_UPPERCASE | ES_AUTOHSCROLL CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 10, 103, 248, 1 - LTEXT "&:", 1412, 10, 115, 91, 8 + LTEXT "Н&абрати:", 1412, 10, 115, 91, 8 COMBOBOX 1416, 104, 111, 154, 112, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | NOT WS_TABSTOP CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 10, 132, 248, 1 - DEFPUSHBUTTON "&", 1590, 8, 139, 60, 14 - PUSHBUTTON "", 1591, 71, 139, 60, 14 - PUSHBUTTON "&", 1107, 134, 139, 60, 14 - PUSHBUTTON "&", 1592, 198, 139, 60, 14 + DEFPUSHBUTTON "&Виклик", 1590, 8, 139, 60, 14 + PUSHBUTTON "Скасувати", 1591, 71, 139, 60, 14 + PUSHBUTTON "В&ластивості", 1107, 134, 139, 60, 14 + PUSHBUTTON "&Довідка", 1592, 198, 139, 60, 14 END 553 DIALOGEX 0, 0, 265, 183 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "ϳ %1" +CAPTION "Підключення до %1" FONT 8, "MS Shell Dlg" BEGIN CONTROL 1678, 1100, "STATIC", SS_BITMAP, 0, 0, 265, 50 - LTEXT "&:", 1413, 10, 68, 92, 10 + LTEXT "&Користувач:", 1413, 10, 68, 92, 10 EDITTEXT 1104, 104, 65, 154, 14, ES_AUTOHSCROLL - LTEXT "&:", 1110, 10, 90, 91, 8 + LTEXT "До&мен:", 1110, 10, 90, 91, 8 EDITTEXT 1102, 104, 86, 154, 14, ES_UPPERCASE | ES_AUTOHSCROLL CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 10, 106, 248, 1 - LTEXT "&:", 1412, 10, 118, 92, 8 + LTEXT "Н&абрати:", 1412, 10, 118, 92, 8 COMBOBOX 1416, 104, 114, 154, 112, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | NOT WS_TABSTOP - LTEXT "̳& :", 1415, 10, 137, 91, 8 + LTEXT "Міс&це виклику:", 1415, 10, 137, 91, 8 COMBOBOX 1414, 104, 134, 87, 112, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | NOT WS_TABSTOP - PUSHBUTTON "&", 1108, 194, 134, 65, 14 + PUSHBUTTON "&Правила", 1108, 194, 134, 65, 14 CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 10, 154, 248, 1 - DEFPUSHBUTTON "&", 1590, 8, 162, 60, 14 - PUSHBUTTON "", 1591, 71, 162, 60, 14 - PUSHBUTTON "&", 1107, 134, 162, 60, 14 - PUSHBUTTON "&", 1592, 198, 162, 60, 14 + DEFPUSHBUTTON "&Виклик", 1590, 8, 162, 60, 14 + PUSHBUTTON "Скасувати", 1591, 71, 162, 60, 14 + PUSHBUTTON "В&ластивості", 1107, 134, 162, 60, 14 + PUSHBUTTON "&Довідка", 1592, 198, 162, 60, 14 END 554 DIALOGEX 0, 0, 230, 215 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION -CAPTION "" +CAPTION "Загальні" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "ϳ& :", 1124, 7, 4, 193, 8 + LTEXT "Підкл&ючення через:", 1124, 7, 4, 193, 8 CONTROL "", 1128, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x00004C0D, 7, 17, 195, 44, WS_EX_CLIENTEDGE - PUSHBUTTON "&", 1132, 208, 18, 16, 14, BS_ICON - PUSHBUTTON "&", 1131, 208, 36, 16, 14, BS_ICON - AUTOCHECKBOX "& ", 1119, 7, 65, 131, 21, BS_TOP | BS_MULTILINE - PUSHBUTTON "&...", 1130, 140, 66, 60, 14 - GROUPBOX "", 1125, 7, 87, 213, 56, WS_GROUP - LTEXT " &:", 1135, 19, 102, 191, 8 + PUSHBUTTON "В&гору", 1132, 208, 18, 16, 14, BS_ICON + PUSHBUTTON "В&низ", 1131, 208, 36, 16, 14, BS_ICON + AUTOCHECKBOX "На&бирати однакові номери для підключення всіх пристроїв", 1119, 7, 65, 131, 21, BS_TOP | BS_MULTILINE + PUSHBUTTON "Нала&штувати...", 1130, 140, 66, 60, 14 + GROUPBOX "Зразок", 1125, 7, 87, 213, 56, WS_GROUP + LTEXT "Номер &телефону:", 1135, 19, 102, 191, 8 EDITTEXT 1123, 17, 112, 138, 14, ES_AUTOHSCROLL - PUSHBUTTON "&", 1129, 161, 112, 50, 14 - AUTOCHECKBOX "&ϳ ", 1120, 11, 194, 212, 20, BS_TOP | BS_MULTILINE + PUSHBUTTON "&Інші", 1129, 161, 112, 50, 14 + AUTOCHECKBOX "&Після підключення показати значок в області сповіщень", 1120, 11, 194, 212, 20, BS_TOP | BS_MULTILINE END 555 DIALOGEX 0, 0, 230, 215 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION -CAPTION "" +CAPTION "Загальні" FONT 8, "MS Shell Dlg" BEGIN - PUSHBUTTON "&...", 1130, 160, 38, 60, 14 - LTEXT " &:", 1135, 8, 72, 194, 8 + PUSHBUTTON "Нала&штувати...", 1130, 160, 38, 60, 14 + LTEXT "Номер &телефону:", 1135, 8, 72, 194, 8 EDITTEXT 1123, 8, 83, 148, 14, ES_AUTOHSCROLL - PUSHBUTTON "&", 1129, 160, 83, 60, 14 - AUTOCHECKBOX "&ϳ ", 1120, 11, 194, 213, 10, BS_TOP | BS_MULTILINE - LTEXT "ϳ& :", 1124, 8, 5, 214, 8 + PUSHBUTTON "&Інші", 1129, 160, 83, 60, 14 + AUTOCHECKBOX "&Після підключення показати значок в області сповіщень", 1120, 11, 194, 213, 10, BS_TOP | BS_MULTILINE + LTEXT "Підкл&ючення через:", 1124, 8, 5, 214, 8 CONTROL "", 1127, "SYSLISTVIEW32", WS_DISABLED | WS_BORDER | 0x0000EC0D, 7, 18, 214, 15 END 556 DIALOGEX 0, 0, 220, 165 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION " " +CAPTION "Параметри програм" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " &, :", -1, 7, 5, 203, 8 + LTEXT "Опис прогр&ами, яка працює у вашій мережі:", -1, 7, 5, 203, 8 EDITTEXT 1565, 7, 17, 206, 14, ES_AUTOHSCROLL - LTEXT "& -:", -1, 7, 35, 202, 8 + LTEXT "Ном&ер порту Інтернет-сервера:", -1, 7, 35, 202, 8 EDITTEXT 1566, 7, 47, 113, 14, ES_AUTOHSCROLL | ES_NUMBER - AUTORADIOBUTTON "& TCP", 1548, 128, 49, 30, 10, NOT WS_TABSTOP - AUTORADIOBUTTON "& UDP", 1567, 166, 49, 31, 10, NOT WS_TABSTOP - LTEXT "& :\n(: 1024-1209, 1300-1310, 1450)", -1, 7, 70, 207, 22 - LTEXT "& TCP:", -1, 7, 100, 28, 8 + AUTORADIOBUTTON "дл&я TCP", 1548, 128, 49, 30, 10, NOT WS_TABSTOP + AUTORADIOBUTTON "д&ля UDP", 1567, 166, 49, 31, 10, NOT WS_TABSTOP + LTEXT "&Порт або діапазон портів для прослухування відповідей від серверів Інтернету:\n(наприклад: 1024-1209, 1300-1310, 1450)", -1, 7, 70, 207, 22 + LTEXT "п&орт TCP:", -1, 7, 100, 28, 8 EDITTEXT 1569, 50, 97, 162, 14, ES_AUTOHSCROLL - LTEXT "& UDP:", -1, 7, 121, 30, 8 + LTEXT "пор&т UDP:", -1, 7, 121, 30, 8 EDITTEXT 1551, 51, 117, 162, 14, ES_AUTOHSCROLL DEFPUSHBUTTON "OK", 1, 90, 144, 60, 14 - PUSHBUTTON "", 2, 154, 144, 60, 14 + PUSHBUTTON "Скасувати", 2, 154, 144, 60, 14 END 557 DIALOGEX 0, 0, 217, 164 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION " " +CAPTION "Параметри служби" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "& :", -1, 7, 5, 203, 8 + LTEXT "&Опис служби:", -1, 7, 5, 203, 8 EDITTEXT 1552, 7, 18, 205, 14, ES_AUTOHSCROLL - LTEXT "&' IP- (, 192.168.0.12) ' , :", -1, 7, 37, 208, 16 + LTEXT "&Ім'я або IP-адреса (наприклад, 192.168.0.12) комп'ютера мережі, на якому розташована ця служба:", -1, 7, 37, 208, 16 EDITTEXT 1556, 7, 57, 203, 14, ES_AUTOHSCROLL - LTEXT " , & :", -1, 7, 85, 203, 8 + LTEXT "Номер порту, н&а якому розташована ця служба:", -1, 7, 85, 203, 8 EDITTEXT 1553, 7, 97, 113, 14, ES_AUTOHSCROLL | ES_NUMBER - AUTORADIOBUTTON "& TCP", 1554, 128, 99, 30, 10, NOT WS_TABSTOP - AUTORADIOBUTTON "& UDP", 1555, 166, 99, 31, 10, NOT WS_TABSTOP + AUTORADIOBUTTON "дл&я TCP", 1554, 128, 99, 30, 10, NOT WS_TABSTOP + AUTORADIOBUTTON "д&ля UDP", 1555, 166, 99, 31, 10, NOT WS_TABSTOP DEFPUSHBUTTON "OK", 1, 86, 143, 60, 14 - PUSHBUTTON "", 2, 150, 143, 60, 14 + PUSHBUTTON "Скасувати", 2, 150, 143, 60, 14 END 558 DIALOGEX 0, 0, 230, 215 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "" +CAPTION "Програми" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "ϳ ' , :", -1, 7, 7, 218, 28 + LTEXT "Підключення до Інтернету на цьому комп'ютері було налаштовано таким чином, щоб дозволити запуск через мережу таких програм:", -1, 7, 7, 218, 28 CONTROL "List1", 1558, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x0000441D, 7, 37, 215, 155, WS_EX_CLIENTEDGE - PUSHBUTTON "&...", 1538, 7, 197, 67, 14 - PUSHBUTTON "&...", 1559, 80, 197, 67, 14 - PUSHBUTTON "&", 1568, 153, 197, 67, 14 + PUSHBUTTON "&Додати...", 1538, 7, 197, 67, 14 + PUSHBUTTON "З&мінити...", 1559, 80, 197, 67, 14 + PUSHBUTTON "В&идалити", 1568, 153, 197, 67, 14 END 559 DIALOGEX 0, 0, 230, 215 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "" +CAPTION "Служби" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "& , .", -1, 7, 5, 216, 22 - LTEXT ":", -1, 7, 27, 143, 8 + LTEXT "&Виберіть служби вашої мережі, до яких можуть отримувати доступ користувачі Інтернету.", -1, 7, 5, 216, 22 + LTEXT "Служби:", -1, 7, 27, 143, 8 CONTROL "List1", 1560, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x0000441D, 7, 37, 215, 155, WS_EX_CLIENTEDGE - PUSHBUTTON "&...", 1561, 7, 197, 67, 14 - PUSHBUTTON "&...", 1563, 80, 197, 67, 14 - PUSHBUTTON "&", 1562, 153, 197, 67, 14 + PUSHBUTTON "&Додати...", 1561, 7, 197, 67, 14 + PUSHBUTTON "З&мінити...", 1563, 80, 197, 67, 14 + PUSHBUTTON "В&идалити", 1562, 153, 197, 67, 14 END 560 DIALOGEX 6, 18, 240, 88 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION " " +CAPTION "Початкове підключення" FONT 8, "MS Shell Dlg" BEGIN - DEFPUSHBUTTON "&", 6, 68, 68, 50, 14 - PUSHBUTTON "&ͳ", 7, 125, 68, 50, 14 + DEFPUSHBUTTON "&Так", 6, 68, 68, 50, 14 + PUSHBUTTON "&Ні", 7, 125, 68, 50, 14 ICON 32516, 1575, 7, 7, 20, 20 LTEXT "", 1576, 40, 7, 190, 33 - AUTOCHECKBOX "& ", 1579, 40, 48, 192, 11, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Більше не показувати це нагадування", 1579, 40, 48, 192, 11, BS_TOP | BS_MULTILINE END 567 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Майстер нових підключень" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ' . , ReactOS .", -1, 10, 7, 301, 25 - LTEXT "&' ('):", -1, 22, 32, 229, 8 + LTEXT "Введіть ім'я служби в цьому текстовому полі. Якщо залишити поле пустим, ReactOS автоматично виявить і налаштує службу при підключенні.", -1, 10, 7, 301, 25 + LTEXT "&Ім'я служби (необов'язкове):", -1, 22, 32, 229, 8 EDITTEXT 1593, 22, 44, 275, 14, ES_AUTOHSCROLL END 568 DIALOGEX 0, 0, 230, 215 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION -CAPTION "" +CAPTION "Загальні" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "&' :", 1686, 7, 5, 217, 10 + LTEXT "&Ім'я служби:", 1686, 7, 5, 217, 10 EDITTEXT 1594, 7, 17, 217, 14, ES_AUTOHSCROLL - AUTOCHECKBOX "&ϳ ", 1120, 9, 196, 215, 8 + AUTOCHECKBOX "&Після підключення показати значок в області сповіщень", 1120, 9, 196, 215, 8 END 569 DIALOGEX 0, 0, 230, 215 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION "" +CAPTION "Безпека" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ", 1580, 8, 4, 213, 151 - AUTORADIOBUTTON "& ( )", 1540, 14, 16, 197, 9, BS_NOTIFY | WS_GROUP - AUTORADIOBUTTON "& ( )", 1541, 14, 100, 197, 8, BS_NOTIFY - LTEXT "& :", 1537, 26, 29, 183, 8, NOT WS_GROUP + GROUPBOX "Параметри безпеки", 1580, 8, 4, 213, 151 + AUTORADIOBUTTON "&Звичайні (рекомендовані параметри)", 1540, 14, 16, 197, 9, BS_NOTIFY | WS_GROUP + AUTORADIOBUTTON "&Додаткові (вибіркові параметри)", 1541, 14, 100, 197, 8, BS_NOTIFY + LTEXT "П&еревіряти користувача таким чином:", 1537, 26, 29, 183, 8, NOT WS_GROUP COMBOBOX 1178, 26, 40, 184, 78, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | NOT WS_TABSTOP - AUTOCHECKBOX "& ' ReactOS ( ' , )", 1174, 26, 59, 182, 20, BS_TOP | BS_MULTILINE - AUTOCHECKBOX "& ( , ')", 1169, 26, 83, 182, 10, BS_TOP | BS_MULTILINE - LTEXT " .", 1539, 26, 111, 136, 20 - PUSHBUTTON "&...", 1180, 151, 134, 60, 14 - PUSHBUTTON "& IPSec...", 1598, 126, 163, 85, 14 + AUTOCHECKBOX "Автомат&ично використовувати ім'я для входу та пароль ReactOS (а також ім'я домену, якщо воно є)", 1174, 26, 59, 182, 20, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "Потрі&бне шифрування даних (якщо ні, роз'єднуватися)", 1169, 26, 83, 182, 10, BS_TOP | BS_MULTILINE + LTEXT "Використання цих параметрів потребує знання протоколів безпеки.", 1539, 26, 111, 136, 20 + PUSHBUTTON "&Параметри...", 1180, 151, 134, 60, 14 + PUSHBUTTON "Пара&метри IPSec...", 1598, 126, 163, 85, 14 END 570 DIALOGEX 0, 0, 265, 126 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION " IPSec" +CAPTION "Параметри IPSec" FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "OK", 1, 151, 104, 50, 14 - PUSHBUTTON "", 2, 207, 104, 50, 14 - AUTOCHECKBOX "& ", 1604, 21, 15, 217, 10 - LTEXT "&:", 1602, 20, 31, 44, 12 + PUSHBUTTON "Скасувати", 2, 207, 104, 50, 14 + AUTOCHECKBOX "В&икористовувати попередній спільний ключ для перевірки автентичності", 1604, 21, 15, 217, 10 + LTEXT "&Ключ:", 1602, 20, 31, 44, 12 EDITTEXT 1605, 66, 30, 172, 12, ES_AUTOHSCROLL - AUTOCHECKBOX " , ", 1606, 20, 50, 242, 13, WS_DISABLED - AUTOCHECKBOX " ", 1607, 20, 67, 239, 10, WS_DISABLED - PUSHBUTTON "", 1608, 31, 84, 50, 14, WS_DISABLED + AUTOCHECKBOX "Дозволити сертифікати з мого сховища, на додаток до системних сертифікатів", 1606, 20, 50, 242, 13, WS_DISABLED + AUTOCHECKBOX "Використовувати особливий сертифікат", 1607, 20, 67, 239, 10, WS_DISABLED + PUSHBUTTON "Вибрати", 1608, 31, 84, 50, 14, WS_DISABLED COMBOBOX 1610, 91, 84, 135, 30, CBS_DROPDOWN | CBS_SORT | WS_DISABLED | WS_VSCROLL | NOT WS_TABSTOP END 571 DIALOGEX 0, 0, 230, 215 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION " " +CAPTION "Ведення журналу безпеки" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " :", -1, 6, 8, 216, 47 - AUTOCHECKBOX "& ", 1642, 14, 22, 201, 10 - AUTOCHECKBOX "& ", 1641, 14, 37, 200, 10 - GROUPBOX " :", -1, 7, 64, 215, 91 - LTEXT "&':", -1, 14, 78, 199, 8 + GROUPBOX "Параметри ведення журналу:", -1, 6, 8, 216, 47 + AUTOCHECKBOX "&Реєструвати невдалі спроби вхідних підключень", 1642, 14, 22, 201, 10 + AUTOCHECKBOX "Ре&єструвати успішні вихідні підключення", 1641, 14, 37, 200, 10 + GROUPBOX "Параметри файлу журналу:", -1, 7, 64, 215, 91 + LTEXT "&Ім'я:", -1, 14, 78, 199, 8 EDITTEXT 1674, 14, 90, 199, 14, ES_READONLY - PUSHBUTTON "&...", 1639, 153, 108, 60, 14 - LTEXT "& :", -1, 14, 133, 67, 8 + PUSHBUTTON "О&гляд...", 1639, 153, 108, 60, 14 + LTEXT "Гра&ничний розмір файлу журналу:", -1, 14, 133, 67, 8 EDITTEXT 1640, 86, 130, 50, 14, ES_AUTOHSCROLL | ES_NUMBER - LTEXT "", -1, 140, 133, 20, 8 - PUSHBUTTON "&³", 1643, 135, 197, 85, 14 + LTEXT "КБ", -1, 140, 133, 20, 8 + PUSHBUTTON "&Відновити", 1643, 135, 197, 85, 14 END 572 DIALOGEX 0, 0, 230, 215 @@ -1351,15 +1351,15 @@ STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION CAPTION "ICMP" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "& (ICMP) ' . , ':", -1, 7, 5, 215, 37 + LTEXT "&Протокол керівних повідомлень Інтернету (ICMP) дає комп'ютерам у мережі змогу обмінюватися відомостями про помилки та свій стан. Виберіть запити з Інтернету, на які відповідатиме цей комп'ютер:", -1, 7, 5, 215, 37 CONTROL "IList1", 1644, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x0000440D, 7, 45, 215, 100, WS_EX_CLIENTEDGE - GROUPBOX ":", -1, 7, 153, 215, 55 + GROUPBOX "Опис:", -1, 7, 153, 215, 55 LTEXT "", 1645, 14, 171, 199, 32 END 574 DIALOGEX 0, 0, 230, 215 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "" +CAPTION "Додатково" FONT 8, "MS Shell Dlg" BEGIN LTEXT "", 575, 7, 60, 213, 100 @@ -1367,455 +1367,455 @@ END 577 DIALOGEX 0, 0, 312, 144 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Майстер нових підключень" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ' .", 1681, 10, 3, 296, 11 - LTEXT "&':", 1690, 18, 20, 127, 10 + LTEXT "Введіть ім'я постачальника послуг Інтернету.", 1681, 10, 3, 296, 11 + LTEXT "&Ім'я:", 1690, 18, 20, 127, 10 EDITTEXT 1680, 17, 32, 222, 14, ES_AUTOHSCROLL - LTEXT " ' ' .", 1683, 17, 52, 282, 42 + LTEXT "Введене тут ім'я буде ім'ям нового підключення.", 1683, 17, 52, 282, 42 END 580 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_CHILD | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - AUTORADIOBUTTON "& ", 1534, 21, 20, 288, 11, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP | NOT WS_TABSTOP - AUTORADIOBUTTON "& PPP (PPTP)", 1532, 21, 39, 290, 11, BS_LEFT | BS_TOP | BS_MULTILINE | NOT WS_TABSTOP - AUTORADIOBUTTON " & (L2TP)", 1533, 21, 56, 286, 11, BS_LEFT | BS_TOP | BS_MULTILINE | NOT WS_TABSTOP + AUTORADIOBUTTON "Авто&матичний вибір", 1534, 21, 20, 288, 11, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP | NOT WS_TABSTOP + AUTORADIOBUTTON "&Тунельний протокол PPP (PPTP)", 1532, 21, 39, 290, 11, BS_LEFT | BS_TOP | BS_MULTILINE | NOT WS_TABSTOP + AUTORADIOBUTTON "Тунельний &протокол другого рівня (L2TP)", 1533, 21, 56, 286, 11, BS_LEFT | BS_TOP | BS_MULTILINE | NOT WS_TABSTOP END 1420 DIALOGEX 0, 0, 265, 108 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "ϳ %1" +CAPTION "Підключення до %1" FONT 8, "MS Shell Dlg" BEGIN CONTROL 1678, 1100, "STATIC", SS_BITMAP, 0, 0, 265, 50 - LTEXT "&:", 1412, 14, 63, 86, 8 + LTEXT "Н&абрати:", 1412, 14, 63, 86, 8 COMBOBOX 1416, 104, 60, 154, 112, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | NOT WS_TABSTOP CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 10, 80, 248, 1 - DEFPUSHBUTTON "&", 1590, 9, 87, 60, 14 - PUSHBUTTON "", 1591, 72, 87, 60, 14 - PUSHBUTTON "&", 1107, 135, 87, 60, 14 - PUSHBUTTON "&", 1592, 198, 87, 60, 14 + DEFPUSHBUTTON "&Виклик", 1590, 9, 87, 60, 14 + PUSHBUTTON "Скасувати", 1591, 72, 87, 60, 14 + PUSHBUTTON "В&ластивості", 1107, 135, 87, 60, 14 + PUSHBUTTON "&Довідка", 1592, 198, 87, 60, 14 END 1421 DIALOGEX 0, 0, 265, 223 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "ϳ %1" +CAPTION "Підключення до %1" FONT 8, "MS Shell Dlg" BEGIN CONTROL 1678, 1100, "STATIC", SS_BITMAP, 0, 0, 265, 50 - LTEXT "&:", 1413, 10, 61, 90, 8 + LTEXT "&Користувач:", 1413, 10, 61, 90, 8 EDITTEXT 1104, 104, 58, 154, 14, ES_AUTOHSCROLL - LTEXT "&:", 1112, 11, 81, 90, 8 + LTEXT "Парол&ь:", 1112, 11, 81, 90, 8 EDITTEXT 1103, 104, 77, 154, 14, ES_PASSWORD | ES_AUTOHSCROLL CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN, 10, 98, 248, 1 - AUTOCHECKBOX "& ' :", 1101, 14, 105, 242, 13, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP - AUTORADIOBUTTON " & ", 1622, 26, 119, 225, 11, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP - AUTORADIOBUTTON " &- ", 1623, 26, 133, 225, 11, BS_LEFT | BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Зберігати ім'я користувача та пароль:", 1101, 14, 105, 242, 13, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP + AUTORADIOBUTTON "лише дл&я мене", 1622, 26, 119, 225, 11, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP + AUTORADIOBUTTON "для &будь-якого користувача", 1623, 26, 133, 225, 11, BS_LEFT | BS_TOP | BS_MULTILINE CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 10, 149, 248, 1 - LTEXT "&:", 1412, 14, 161, 87, 8 + LTEXT "Н&абрати:", 1412, 14, 161, 87, 8 COMBOBOX 1416, 104, 157, 154, 112, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | NOT WS_TABSTOP - LTEXT "&̳ :", 1415, 14, 178, 88, 8 + LTEXT "&Місце виклику:", 1415, 14, 178, 88, 8 COMBOBOX 1414, 104, 175, 87, 112, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | NOT WS_TABSTOP - PUSHBUTTON "&", 1108, 193, 175, 65, 14 + PUSHBUTTON "&Правила", 1108, 193, 175, 65, 14 CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 10, 196, 248, 1 - DEFPUSHBUTTON "&", 1590, 9, 202, 60, 14, WS_GROUP - PUSHBUTTON "", 1591, 72, 202, 60, 14 - PUSHBUTTON "&", 1107, 135, 202, 60, 14 - PUSHBUTTON "&", 1592, 198, 202, 60, 14 + DEFPUSHBUTTON "&Виклик", 1590, 9, 202, 60, 14, WS_GROUP + PUSHBUTTON "Скасувати", 1591, 72, 202, 60, 14 + PUSHBUTTON "В&ластивості", 1107, 135, 202, 60, 14 + PUSHBUTTON "&Довідка", 1592, 198, 202, 60, 14 END 1422 DIALOGEX 0, 0, 265, 242 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "ϳ %1" +CAPTION "Підключення до %1" FONT 8, "MS Shell Dlg" BEGIN CONTROL 1678, 1100, "STATIC", SS_BITMAP, 0, 0, 265, 50 - LTEXT "&:", 1413, 10, 67, 91, 8 + LTEXT "&Користувач:", 1413, 10, 67, 91, 8 EDITTEXT 1104, 104, 63, 154, 14, ES_AUTOHSCROLL - LTEXT "&:", 1112, 10, 85, 92, 8 + LTEXT "Парол&ь:", 1112, 10, 85, 92, 8 EDITTEXT 1103, 104, 82, 154, 14, ES_PASSWORD | ES_AUTOHSCROLL - LTEXT "&:", 1110, 10, 104, 92, 8 + LTEXT "До&мен:", 1110, 10, 104, 92, 8 EDITTEXT 1102, 104, 101, 154, 14, ES_UPPERCASE | ES_AUTOHSCROLL CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN, 10, 121, 248, 1 - AUTOCHECKBOX "& ' :", 1101, 12, 127, 242, 13, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP - AUTORADIOBUTTON " & ", 1622, 24, 141, 227, 11, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP - AUTORADIOBUTTON " &- ", 1623, 24, 155, 230, 11, BS_LEFT | BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Зберігати ім'я користувача та пароль:", 1101, 12, 127, 242, 13, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP + AUTORADIOBUTTON "лише дл&я мене", 1622, 24, 141, 227, 11, BS_LEFT | BS_TOP | BS_MULTILINE | WS_GROUP + AUTORADIOBUTTON "для &будь-якого користувача", 1623, 24, 155, 230, 11, BS_LEFT | BS_TOP | BS_MULTILINE CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 10, 170, 248, 1 - LTEXT "&:", 1412, 14, 182, 87, 8 + LTEXT "Н&абрати:", 1412, 14, 182, 87, 8 COMBOBOX 1416, 104, 178, 154, 112, CBS_DROPDOWN | CBS_AUTOHSCROLL | WS_VSCROLL | NOT WS_TABSTOP - LTEXT "̳& :", 1415, 14, 198, 87, 8 + LTEXT "Міс&це виклику:", 1415, 14, 198, 87, 8 COMBOBOX 1414, 104, 195, 87, 112, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | NOT WS_TABSTOP - PUSHBUTTON "&", 1108, 193, 195, 65, 14 + PUSHBUTTON "&Правила", 1108, 193, 195, 65, 14 CONTROL "", -1, "STATIC", SS_LEFTNOWORDWRAP | SS_SUNKEN | WS_GROUP, 10, 215, 248, 1 - DEFPUSHBUTTON "&", 1590, 8, 221, 60, 14, WS_GROUP - PUSHBUTTON "", 1591, 71, 221, 60, 14 - PUSHBUTTON "&", 1107, 134, 221, 60, 14 - PUSHBUTTON "&", 1592, 198, 221, 60, 14 + DEFPUSHBUTTON "&Виклик", 1590, 8, 221, 60, 14, WS_GROUP + PUSHBUTTON "Скасувати", 1591, 71, 221, 60, 14 + PUSHBUTTON "В&ластивості", 1107, 134, 221, 60, 14 + PUSHBUTTON "&Довідка", 1592, 198, 221, 60, 14 END 1425 DIALOGEX 0, 0, 230, 215 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION -CAPTION "" +CAPTION "Загальні" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "' ' IP- & (, reactos.org 145.52.0.1):", 1430, 7, 5, 217, 18 + LTEXT "Ім'я комп'ютера або IP-адреса пр&изначення (наприклад, reactos.org або 145.52.0.1):", 1430, 7, 5, 217, 18 EDITTEXT 1427, 7, 25, 215, 14, ES_AUTOHSCROLL - GROUPBOX " ", 1431, 9, 48, 213, 78 - LTEXT " , , , .", 1432, 17, 63, 199, 24 - AUTOCHECKBOX "& :", 1428, 19, 89, 183, 10 + GROUPBOX "Спочатку установлювати підключення", 1431, 9, 48, 213, 78 + LTEXT "Можна спочатку підключитися до публічної мережі, наприклад, до Інтернету, а вже потім намагатися установити це віртуальне підключення.", 1432, 17, 63, 199, 24 + AUTOCHECKBOX "&Спочатку набирати номер для іншого підключення:", 1428, 19, 89, 183, 10 COMBOBOX 1429, 29, 103, 182, 87, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | NOT WS_TABSTOP - AUTOCHECKBOX "&ϳ ", 1120, 10, 192, 213, 13 + AUTOCHECKBOX "&Після підключення показати значок в області сповіщень", 1120, 10, 192, 213, 13 END 1426 DIALOGEX 0, 0, 230, 215 STYLE DS_SHELLFONT | WS_CHILD | WS_CAPTION -CAPTION "" +CAPTION "Параметри" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ", 1289, 8, 7, 214, 56 - AUTOCHECKBOX " & ", 1284, 16, 17, 199, 10 - AUTOCHECKBOX "& ', , ", 1554, 16, 32, 199, 10 - AUTOCHECKBOX "& ReactOS", 1555, 16, 47, 178, 10 - GROUPBOX " ", 1290, 8, 68, 214, 89 - LTEXT "&ʳ :", 1300, 16, 81, 121, 8 + GROUPBOX "Параметри набору номера", 1289, 8, 7, 214, 56 + AUTOCHECKBOX "Показувати п&еребіг підключення", 1284, 16, 17, 199, 10 + AUTOCHECKBOX "&Запитувати ім'я, пароль, сертифікат тощо", 1554, 16, 32, 199, 10 + AUTOCHECKBOX "Вкл&ючати домен входу до ReactOS", 1555, 16, 47, 178, 10 + GROUPBOX "Параметри повторного дзвінка", 1290, 8, 68, 214, 89 + LTEXT "&Кількість спроб повторного набору:", 1300, 16, 81, 121, 8 EDITTEXT 1287, 140, 77, 70, 14, ES_AUTOHSCROLL | ES_NUMBER - LTEXT " & :", 1301, 16, 99, 121, 8 + LTEXT "Інтервал мі&ж спробами набору:", 1301, 16, 99, 121, 8 COMBOBOX 1292, 141, 95, 70, 123, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - LTEXT "& ':", 1299, 16, 117, 121, 8 + LTEXT "&Час простою до роз'єднання:", 1299, 16, 117, 121, 8 COMBOBOX 1291, 141, 113, 70, 108, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - AUTOCHECKBOX "& '", 1286, 16, 138, 199, 10, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Повторити в разі роз'єднання", 1286, 16, 138, 199, 10, BS_TOP | BS_MULTILINE END 1427 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ' IP- ', .", -1, 10, 6, 275, 16 - LTEXT "&' ' IP- (, reactos.org 145.52.0.1 ):", -1, 21, 28, 277, 11 + LTEXT "Введіть ім'я вузла або IP-адресу комп'ютера, до якого підключаєтеся.", -1, 10, 6, 275, 16 + LTEXT "&Ім'я комп'ютера або IP-адреса (наприклад, reactos.org або 145.52.0.1 ):", -1, 21, 28, 277, 11 EDITTEXT 1433, 21, 42, 275, 14, ES_AUTOHSCROLL END 1428 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Майстер нових підключень" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "ReactOS .", -1, 10, 6, 275, 24 - AUTORADIOBUTTON "& .", 1509, 32, 31, 271, 10, BS_TOP | BS_MULTILINE | NOT WS_TABSTOP - AUTORADIOBUTTON "& :", 1510, 32, 45, 269, 10, BS_TOP | BS_MULTILINE | NOT WS_TABSTOP + LTEXT "ReactOS може автоматично установлювати початкове підключення до Інтернету або до іншої публічної мережі перед установкою віртуального підключення.", -1, 10, 6, 275, 24 + AUTORADIOBUTTON "Н&е набирати номер для початкового підключення.", 1509, 32, 31, 271, 10, BS_TOP | BS_MULTILINE | NOT WS_TABSTOP + AUTORADIOBUTTON "Авто&матично набирати номер для цього початкового підключення:", 1510, 32, 45, 269, 10, BS_TOP | BS_MULTILINE | NOT WS_TABSTOP COMBOBOX 1435, 43, 62, 253, 87, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | NOT WS_TABSTOP END 1436 DIALOGEX 0, 0, 230, 215 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION -CAPTION "" +CAPTION "Загальні" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "& :", 1597, 8, 5, 213, 8 + LTEXT "&Виберіть пристрій:", 1597, 8, 5, 213, 8 COMBOBOX 1437, 7, 17, 217, 166, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_VSCROLL | NOT WS_TABSTOP - AUTOCHECKBOX "&ϳ ", 1120, 11, 195, 213, 10, BS_TOP | BS_MULTILINE - PUSHBUTTON "&...", 1130, 160, 34, 60, 14 + AUTOCHECKBOX "&Після підключення показати значок в області сповіщень", 1120, 11, 195, 213, 10, BS_TOP | BS_MULTILINE + PUSHBUTTON "&Налаштувати...", 1130, 160, 34, 60, 14 END 1448 DIALOGEX 10, 20, 265, 71 STYLE DS_SHELLFONT | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION " " +CAPTION "Мережні підключення" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "& :", 1456, 7, 7, 251, 10 + LTEXT "&Виберіть мережне підключення:", 1456, 7, 7, 251, 10 COMBOBOX 1457, 8, 18, 250, 140, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | NOT WS_TABSTOP - DEFPUSHBUTTON "ϳ&...", 1449, 7, 50, 60, 14 - PUSHBUTTON "", 1455, 70, 50, 60, 14 - PUSHBUTTON "&...", 1459, 134, 50, 60, 14 - PUSHBUTTON "&", 1460, 198, 50, 60, 14 + DEFPUSHBUTTON "Підкл&ючити...", 1449, 7, 50, 60, 14 + PUSHBUTTON "Скасувати", 1455, 70, 50, 60, 14 + PUSHBUTTON "&Створити...", 1459, 134, 50, 60, 14 + PUSHBUTTON "В&ластивості", 1460, 198, 50, 60, 14 END 1466 DIALOGEX 6, 18, 265, 262 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT "", 1469, 7, 7, 251, 8 + LTEXT "Зразок", 1469, 7, 7, 251, 8 EDITTEXT 1470, 7, 17, 193, 14, ES_AUTOHSCROLL - PUSHBUTTON "&", 1471, 77, 36, 60, 14 - PUSHBUTTON "&", 1472, 141, 36, 60, 14 - LTEXT "", 1473, 7, 57, 193, 8 + PUSHBUTTON "&Додати", 1471, 77, 36, 60, 14 + PUSHBUTTON "&Замінити", 1472, 141, 36, 60, 14 + LTEXT "Зразок", 1473, 7, 57, 193, 8 LISTBOX 1474, 7, 68, 193, 145, WS_VSCROLL | WS_TABSTOP PUSHBUTTON "", 1475, 206, 68, 51, 14, BS_BITMAP | WS_GROUP - PUSHBUTTON "&", 1476, 206, 86, 51, 14, BS_BITMAP - PUSHBUTTON "&", 1477, 141, 215, 60, 14 + PUSHBUTTON "В&низ", 1476, 206, 86, 51, 14, BS_BITMAP + PUSHBUTTON "В&идалити", 1477, 141, 215, 60, 14 CONTROL "", 1479, "STATIC", SS_ETCHEDHORZ, 7, 233, 249, 1 PUSHBUTTON "OK", 1, 132, 242, 60, 14, WS_GROUP - PUSHBUTTON "", 2, 196, 242, 60, 14 + PUSHBUTTON "Скасувати", 2, 196, 242, 60, 14 END 1467 DIALOGEX 6, 18, 263, 263 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT "", 1469, 7, 7, 197, 8 + LTEXT "Зразок", 1469, 7, 7, 197, 8 EDITTEXT 1470, 7, 17, 193, 14, ES_AUTOHSCROLL - PUSHBUTTON "&", 1471, 76, 36, 60, 14 - PUSHBUTTON "&", 1472, 141, 36, 60, 14 - LTEXT "", 1473, 7, 57, 193, 8 + PUSHBUTTON "&Додати", 1471, 76, 36, 60, 14 + PUSHBUTTON "&Замінити", 1472, 141, 36, 60, 14 + LTEXT "Зразок", 1473, 7, 57, 193, 8 LISTBOX 1474, 7, 68, 193, 135, WS_VSCROLL | WS_TABSTOP - PUSHBUTTON "&", 1475, 206, 68, 51, 14, BS_BITMAP | WS_GROUP - PUSHBUTTON "&", 1476, 206, 86, 51, 14, BS_BITMAP - PUSHBUTTON "&", 1477, 141, 204, 60, 14 - AUTOCHECKBOX "", 1478, 7, 225, 249, 10, BS_TOP | BS_MULTILINE + PUSHBUTTON "В&гору", 1475, 206, 68, 51, 14, BS_BITMAP | WS_GROUP + PUSHBUTTON "В&низ", 1476, 206, 86, 51, 14, BS_BITMAP + PUSHBUTTON "В&идалити", 1477, 141, 204, 60, 14 + AUTOCHECKBOX "Зразок", 1478, 7, 225, 249, 10, BS_TOP | BS_MULTILINE PUSHBUTTON "OK", 1, 132, 242, 60, 14, WS_GROUP - PUSHBUTTON "", 2, 196, 242, 60, 14 + PUSHBUTTON "Скасувати", 2, 196, 242, 60, 14 END 1468 DIALOGEX 6, 18, 263, 263 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT "", 1469, 7, 5, 249, 8 + LTEXT "Зразок", 1469, 7, 5, 249, 8 EDITTEXT 1470, 7, 17, 249, 14, ES_AUTOHSCROLL - PUSHBUTTON "&", 1471, 132, 36, 60, 14 - PUSHBUTTON "&", 1472, 196, 36, 60, 14 - LTEXT "", 1473, 7, 55, 251, 8 + PUSHBUTTON "&Додати", 1471, 132, 36, 60, 14 + PUSHBUTTON "&Замінити", 1472, 196, 36, 60, 14 + LTEXT "Зразок", 1473, 7, 55, 251, 8 LISTBOX 1474, 7, 68, 249, 140, LBS_STANDARD | WS_TABSTOP - PUSHBUTTON "&", 1477, 196, 214, 60, 14, WS_GROUP + PUSHBUTTON "В&идалити", 1477, 196, 214, 60, 14, WS_GROUP CONTROL "", 1479, "STATIC", SS_ETCHEDHORZ, 7, 233, 249, 1 PUSHBUTTON "OK", 1, 132, 242, 60, 14, WS_GROUP - PUSHBUTTON "", 2, 196, 242, 60, 14 + PUSHBUTTON "Скасувати", 2, 196, 242, 60, 14 END 1469 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Майстер нових підключень" FONT 8, "MS Shell Dlg" BEGIN - AUTORADIOBUTTON "& .", 1488, 24, 9, 116, 10, NOT WS_TABSTOP - AUTORADIOBUTTON "ϳ & .", 1489, 24, 34, 206, 10, NOT WS_TABSTOP - AUTORADIOBUTTON "& '.", 1490, 24, 59, 157, 10, NOT WS_TABSTOP - AUTORADIOBUTTON "ϳ & '", 1491, 24, 83, 273, 10, NOT WS_TABSTOP - LTEXT "ϳ ISDN.", -1, 45, 21, 156, 8 - LTEXT "ϳ (VPN) .", -1, 45, 46, 266, 8 - LTEXT "ϳ , .", -1, 45, 71, 266, 8 - LTEXT "ϳ '.", -1, 45, 95, 266, 8 + AUTORADIOBUTTON "&Телефонне підключення до приватної мережі.", 1488, 24, 9, 116, 10, NOT WS_TABSTOP + AUTORADIOBUTTON "Підключення до віртуальної приватної мережі &через Інтернет.", 1489, 24, 34, 206, 10, NOT WS_TABSTOP + AUTORADIOBUTTON "&Пряме підключення до іншого комп'ютера.", 1490, 24, 59, 157, 10, NOT WS_TABSTOP + AUTORADIOBUTTON "Підключення до мережі через &високошвидкісне з'єднання", 1491, 24, 83, 273, 10, NOT WS_TABSTOP + LTEXT "Підключення через модем або адаптер ISDN.", -1, 45, 21, 156, 8 + LTEXT "Підключення через віртуальну приватну мережу (VPN) або тунель через Інтернет.", -1, 45, 46, 266, 8 + LTEXT "Підключення через послідовний, паралельний або інфрачервоний порт.", -1, 45, 71, 266, 8 + LTEXT "Підключення через високошвидкісне з'єднання.", -1, 45, 95, 266, 8 END 1480 DIALOGEX 0, 0, 230, 61 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION " " +CAPTION "Редактор номера телефону" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "& :", 1481, 7, 7, 218, 8 + LTEXT "&Введіть новий номер телефону:", 1481, 7, 7, 218, 8 EDITTEXT 1482, 7, 17, 217, 15, ES_AUTOHSCROLL DEFPUSHBUTTON "OK", 1, 99, 40, 60, 14 - PUSHBUTTON "", 2, 163, 40, 60, 14 + PUSHBUTTON "Скасувати", 2, 163, 40, 60, 14 END 1481 DIALOGEX 0, 0, 321, 157 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Майстер нових підключень" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ' , . ( ' , .)", 1689, 10, 4, 308, 25 - LTEXT "&:", 1636, 23, 35, 89, 15 + LTEXT "Введіть ім'я й пароль для облікового запису постачальника послуг Інтернету, запишіть їх і зберігайте в безпечному місці. (Якщо ви забули існуючі ім'я облікового запису або пароль, зверніться до постачальника.)", 1689, 10, 4, 308, 25 + LTEXT "&Користувач:", 1636, 23, 35, 89, 15 EDITTEXT 1614, 115, 34, 190, 15, ES_AUTOHSCROLL - LTEXT "&:", 1637, 23, 55, 90, 13 + LTEXT "Парол&ь:", 1637, 23, 55, 90, 13 EDITTEXT 1615, 115, 54, 190, 15, ES_PASSWORD | ES_AUTOHSCROLL - LTEXT "&ϳ:", 1638, 23, 74, 88, 13 + LTEXT "&Підтвердження:", 1638, 23, 74, 88, 13 EDITTEXT 1616, 115, 73, 190, 15, ES_PASSWORD | ES_AUTOHSCROLL - AUTOCHECKBOX "& ' - '", 1596, 23, 91, 291, 17, BS_LEFT | BS_TOP | BS_MULTILINE - AUTOCHECKBOX "& ", 1595, 23, 112, 288, 14 - AUTOCHECKBOX "& ", 1682, 23, 133, 290, 14 + AUTOCHECKBOX "Викори&стовувати такі ім'я користувача й пароль при підключенні будь-кого з цього комп'ютера", 1596, 23, 91, 291, 17, BS_LEFT | BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Використовувати це підключення до Інтернету за замовчуванням", 1595, 23, 112, 288, 14 + AUTOCHECKBOX "&Увімкнути брандмауер для цього підключення", 1682, 23, 133, 290, 14 END 1660 DIALOGEX 0, 0, 258, 78 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION " " +CAPTION "Брандмауер підключення до Інтернету" FONT 8, "MS Shell Dlg" BEGIN ICON 32515, -1, 7, 7, 20, 20 - LTEXT " ' . ?", -1, 44, 5, 212, 24 - AUTOCHECKBOX "& ", 1662, 42, 40, 210, 10 - DEFPUSHBUTTON "&", 6, 74, 60, 50, 14 - PUSHBUTTON "&ͳ", 7, 128, 60, 50, 14 + LTEXT "Вимкнення брандмауера підключення до Інтернету може відкрити ваш комп'ютер для несанкціонованого доступу через Інтернет. Ви дійсно бажаєте вимкнути захист?", -1, 44, 5, 212, 24 + AUTOCHECKBOX "&Більше не показувати це вікно", 1662, 42, 40, 210, 10 + DEFPUSHBUTTON "&Так", 6, 74, 60, 50, 14 + PUSHBUTTON "&Ні", 7, 128, 60, 50, 14 END 7000 DIALOGEX 0, 0, 215, 103 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUPWINDOW | WS_CAPTION -CAPTION "" +CAPTION "Загальні" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "&:", -1, 7, 8, 90, 12, SS_CENTERIMAGE + LTEXT "&Користувач:", -1, 7, 8, 90, 12, SS_CENTERIMAGE EDITTEXT 7001, 101, 7, 108, 14, ES_AUTOHSCROLL - LTEXT "& ':", -1, 7, 26, 90, 12 + LTEXT "П&овне ім'я:", -1, 7, 26, 90, 12 EDITTEXT 7002, 101, 25, 108, 14, ES_AUTOHSCROLL - LTEXT "&:", -1, 7, 44, 90, 12 + LTEXT "Парол&ь:", -1, 7, 44, 90, 12 EDITTEXT 7003, 101, 43, 108, 14, ES_PASSWORD | ES_AUTOHSCROLL - LTEXT "&ϳ:", -1, 7, 62, 91, 12 + LTEXT "&Підтвердження:", -1, 7, 62, 91, 12 EDITTEXT 7004, 101, 61, 108, 14, ES_PASSWORD | ES_AUTOHSCROLL PUSHBUTTON "OK", 1, 84, 82, 60, 14 - PUSHBUTTON "", 2, 149, 82, 60, 14 + PUSHBUTTON "Скасувати", 2, 149, 82, 60, 14 END 7005 DIALOGEX 0, 0, 230, 215 STYLE DS_SHELLFONT | DS_CONTEXTHELP | WS_CHILD | WS_CAPTION -CAPTION "³ " +CAPTION "Відповідний виклик" FONT 8, "MS Shell Dlg" BEGIN - AUTORADIOBUTTON "& ", 7009, 9, 7, 219, 10, BS_TOP | BS_MULTILINE | WS_GROUP - AUTORADIOBUTTON "& ", 7006, 9, 20, 218, 10, BS_TOP | BS_MULTILINE | NOT WS_TABSTOP - AUTORADIOBUTTON " & :", 7007, 9, 34, 217, 10, BS_TOP | BS_MULTILINE | NOT WS_TABSTOP + AUTORADIOBUTTON "&Заборонити зворотний виклик", 7009, 9, 7, 219, 10, BS_TOP | BS_MULTILINE | WS_GROUP + AUTORADIOBUTTON "Доз&волити абонентові визначати номер зворотного виклику", 7006, 9, 20, 218, 10, BS_TOP | BS_MULTILINE | NOT WS_TABSTOP + AUTORADIOBUTTON "Завжди викорис&товувати для зворотного виклику цей номер:", 7007, 9, 34, 217, 10, BS_TOP | BS_MULTILINE | NOT WS_TABSTOP EDITTEXT 7008, 19, 49, 204, 14, ES_AUTOHSCROLL | WS_GROUP END 7010 DIALOGEX 0, 0, 230, 215 STYLE DS_SHELLFONT | DS_CONTEXTHELP | WS_CHILD | WS_CAPTION -CAPTION "" +CAPTION "Загальні" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ", -1, 7, 4, 214, 110, WS_GROUP - LTEXT " :", -1, 17, 17, 195, 8 - LTEXT "&:", -1, 17, 29, 29, 8 + GROUPBOX "Вхідні підключення", -1, 7, 4, 214, 110, WS_GROUP + LTEXT "Дозволити вхідні підключення для таких пристроїв:", -1, 17, 17, 195, 8 + LTEXT "&Пристрої:", -1, 17, 29, 29, 8 CONTROL "", 7011, "SYSLISTVIEW32", WS_BORDER | WS_GROUP | WS_TABSTOP | 0x00004405, 17, 41, 193, 47, WS_EX_CLIENTEDGE - AUTOCHECKBOX "& ", 7012, 17, 96, 121, 10, BS_TOP | BS_MULTILINE | WS_GROUP - PUSHBUTTON "&", 7013, 145, 94, 65, 14, WS_GROUP - GROUPBOX "³ (VPN)", -1, 6, 122, 214, 49, WS_GROUP - AUTOCHECKBOX " & ' ", 7014, 17, 137, 195, 27, BS_TOP | BS_MULTILINE | WS_GROUP - AUTOCHECKBOX "ϳ & ", 7015, 12, 184, 209, 10, BS_TOP | BS_MULTILINE | WS_GROUP + AUTOCHECKBOX "&Багатоканальне підключення", 7012, 17, 96, 121, 10, BS_TOP | BS_MULTILINE | WS_GROUP + PUSHBUTTON "Влас&тивості", 7013, 145, 94, 65, 14, WS_GROUP + GROUPBOX "Віртуальна приватна мережа (VPN)", -1, 6, 122, 214, 49, WS_GROUP + AUTOCHECKBOX "Дозволити іншим ко&ристувачам робити приватні підключення до мого комп'ютера через тунель в Інтернеті або іншій мережі", 7014, 17, 137, 195, 27, BS_TOP | BS_MULTILINE | WS_GROUP + AUTOCHECKBOX "Після підключення показати значок &в області сповіщень", 7015, 12, 184, 209, 10, BS_TOP | BS_MULTILINE | WS_GROUP END 7016 DIALOGEX 0, 0, 265, 190 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUPWINDOW | WS_CAPTION -CAPTION " TCP/IP" +CAPTION "Властивості вхідних викликів TCP/IP" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ", -1, 6, 5, 252, 32 - AUTOCHECKBOX " &", 7017, 20, 20, 228, 9, BS_LEFT | BS_TOP | BS_MULTILINE - GROUPBOX " TCP/IP", -1, 6, 42, 250, 122 - AUTORADIOBUTTON "& TCP/IP DHCP", 7019, 20, 54, 231, 10, BS_TOP | BS_MULTILINE | WS_GROUP - AUTORADIOBUTTON "& TCP/IP", 7020, 20, 71, 231, 10, BS_TOP | BS_MULTILINE - LTEXT "&:", -1, 29, 88, 53, 8 + GROUPBOX "Доступ до мережі", -1, 6, 5, 252, 32 + AUTOCHECKBOX "Дозволити абонентам доступ до локальної ме&режі", 7017, 20, 20, 228, 9, BS_LEFT | BS_TOP | BS_MULTILINE + GROUPBOX "Призначення адрес TCP/IP", -1, 6, 42, 250, 122 + AUTORADIOBUTTON "Приз&начити адреси TCP/IP автоматично за допомогою DHCP", 7019, 20, 54, 231, 10, BS_TOP | BS_MULTILINE | WS_GROUP + AUTORADIOBUTTON "&Указати адреси TCP/IP", 7020, 20, 71, 231, 10, BS_TOP | BS_MULTILINE + LTEXT "&З:", -1, 29, 88, 53, 8 CONTROL "", 7018, "RASIPADDRESS", WS_GROUP | WS_TABSTOP, 90, 85, 103, 13 - LTEXT "&:", -1, 29, 105, 53, 8 + LTEXT "&По:", -1, 29, 105, 53, 8 CONTROL "", 7021, "RASIPADDRESS", WS_GROUP | WS_TABSTOP, 90, 102, 103, 13 - LTEXT ":", -1, 29, 124, 53, 10 + LTEXT "Усього:", -1, 29, 124, 53, 10 LTEXT "", 7024, 90, 121, 150, 14, 0, WS_EX_STATICEDGE - AUTOCHECKBOX "& IP-", 7022, 20, 144, 231, 10, BS_TOP | BS_MULTILINE | WS_GROUP + AUTOCHECKBOX "&Дозволити абоненту вказати свою IP-адресу", 7022, 20, 144, 231, 10, BS_TOP | BS_MULTILINE | WS_GROUP DEFPUSHBUTTON "OK", 1, 133, 169, 60, 14, WS_GROUP - PUSHBUTTON "", 2, 197, 169, 60, 14 + PUSHBUTTON "Скасувати", 2, 197, 169, 60, 14 END 7025 DIALOGEX 0, 0, 250, 157 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUPWINDOW | WS_CAPTION -CAPTION " IPX" +CAPTION "Властивості вхідних викликів IPX" FONT 8, "MS Shell Dlg" BEGIN - GROUPBOX " ", -1, 8, 6, 234, 32 - AUTOCHECKBOX " &", 7032, 18, 19, 194, 12, BS_LEFT | BS_TOP | BS_MULTILINE - GROUPBOX " ", -1, 8, 43, 234, 87 - AUTOCHECKBOX "& '", 7028, 17, 56, 203, 10, BS_TOP | BS_MULTILINE | WS_GROUP - AUTORADIOBUTTON "& ", 7026, 28, 68, 191, 10, BS_TOP | BS_MULTILINE | WS_GROUP - AUTORADIOBUTTON "& :", 7027, 28, 81, 189, 10, BS_TOP | BS_MULTILINE | NOT WS_TABSTOP + GROUPBOX "Доступ до мережі", -1, 8, 6, 234, 32 + AUTOCHECKBOX "Дозволити абонентам доступ до локальної ме&режі", 7032, 18, 19, 194, 12, BS_LEFT | BS_TOP | BS_MULTILINE + GROUPBOX "Призначення номера мережі", -1, 8, 43, 234, 87 + AUTOCHECKBOX "&Призначити один номер мережі всім комп'ютерам", 7028, 17, 56, 203, 10, BS_TOP | BS_MULTILINE | WS_GROUP + AUTORADIOBUTTON "Приз&начати номери мереж автоматично", 7026, 28, 68, 191, 10, BS_TOP | BS_MULTILINE | WS_GROUP + AUTORADIOBUTTON "&Указати номери мереж:", 7027, 28, 81, 189, 10, BS_TOP | BS_MULTILINE | NOT WS_TABSTOP EDITTEXT 7029, 40, 92, 154, 14, ES_UPPERCASE | WS_GROUP - AUTOCHECKBOX " & ", 7031, 17, 113, 208, 11, BS_TOP | BS_MULTILINE | WS_GROUP + AUTOCHECKBOX "Дозволити &абонентам указувати свої номери вузлів", 7031, 17, 113, 208, 11, BS_TOP | BS_MULTILINE | WS_GROUP DEFPUSHBUTTON "OK", 1, 116, 136, 60, 14, WS_GROUP - PUSHBUTTON "", 2, 181, 136, 60, 14 + PUSHBUTTON "Скасувати", 2, 181, 136, 60, 14 END 7033 DIALOGEX 0, 0, 220, 50 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUPWINDOW | WS_CAPTION -CAPTION " " +CAPTION "Властивості протоколів" FONT 8, "MS Shell Dlg" BEGIN - AUTOCHECKBOX "& ", 7034, 7, 7, 208, 18, BS_LEFT | BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Дозволити абонентам доступ до локальної мережі", 7034, 7, 7, 208, 18, BS_LEFT | BS_TOP | BS_MULTILINE DEFPUSHBUTTON "OK", 1, 86, 30, 60, 14 - PUSHBUTTON "", 2, 151, 30, 60, 14 + PUSHBUTTON "Скасувати", 2, 151, 30, 60, 14 END 7035 DIALOGEX 0, 0, 230, 215 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUPWINDOW | WS_CAPTION -CAPTION "" +CAPTION "Мережа" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "& :", -1, 7, 7, 217, 9 + LTEXT "&Мережні компоненти:", -1, 7, 7, 217, 9 CONTROL "", 7036, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x0000440D, 7, 17, 215, 89, WS_EX_CLIENTEDGE - PUSHBUTTON "&...", 7037, 9, 110, 67, 14, WS_GROUP - PUSHBUTTON "&", 7038, 80, 110, 67, 14, WS_GROUP - PUSHBUTTON "&", 7039, 153, 110, 67, 14, WS_GROUP - GROUPBOX "", -1, 7, 138, 213, 69 + PUSHBUTTON "&Установити...", 7037, 9, 110, 67, 14, WS_GROUP + PUSHBUTTON "&Видалити", 7038, 80, 110, 67, 14, WS_GROUP + PUSHBUTTON "Влас&тивості", 7039, 153, 110, 67, 14, WS_GROUP + GROUPBOX "Опис", -1, 7, 138, 213, 69 LTEXT "", 7040, 17, 150, 193, 48 END 7042 DIALOGEX 0, 0, 230, 215 STYLE DS_SHELLFONT | DS_CONTEXTHELP | WS_CHILD | WS_CAPTION -CAPTION "" +CAPTION "Користувачі" FONT 8, "MS Shell Dlg" BEGIN - LTEXT ", &:", -1, 7, 5, 213, 8 + LTEXT "Користувачі, яким дозволено &підключатися:", -1, 7, 5, 213, 8 CONTROL "", 7043, "SYSLISTVIEW32", WS_BORDER | WS_GROUP | WS_TABSTOP | 0x0000440D, 7, 19, 214, 83, WS_EX_CLIENTEDGE - PUSHBUTTON "&...", 7044, 7, 107, 67, 14, WS_GROUP - PUSHBUTTON "&", 7045, 80, 107, 67, 14, WS_GROUP - PUSHBUTTON "&", 7046, 153, 107, 67, 14, WS_GROUP - AUTOCHECKBOX "& .", 7048, 8, 151, 217, 12, BS_TOP | BS_MULTILINE - AUTOCHECKBOX "& ', , ', .", 7049, 8, 169, 217, 23, BS_TOP | BS_MULTILINE - LTEXT " , , .", -1, 9, 126, 212, 23 + PUSHBUTTON "&Новий...", 7044, 7, 107, 67, 14, WS_GROUP + PUSHBUTTON "В&идалити", 7045, 80, 107, 67, 14, WS_GROUP + PUSHBUTTON "Влас&тивості", 7046, 153, 107, 67, 14, WS_GROUP + AUTOCHECKBOX "&Усі користувачі повинні тримати в секреті свої паролі й дані.", 7048, 8, 151, 217, 12, BS_TOP | BS_MULTILINE + AUTOCHECKBOX "&Завжди дозволяти пристроям із прямим з'єднанням, наприклад, кишеньковим комп'ютерам, підключення без пароля.", 7049, 8, 169, 217, 23, BS_TOP | BS_MULTILINE + LTEXT "Інші фактори, такі як вимкнення облікового запису, можуть перешкодити підключенню користувача.", -1, 9, 126, 212, 23 END 7049 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT " , '. , , .", -1, 10, 1, 275, 27 - LTEXT ", &:", -1, 10, 28, 275, 8 + LTEXT "Установіть прапорці поруч із користувачами, яким слід дозволити підключатися до цього комп'ютера. Інші фактори, такі як вимкнення облікового запису, можуть перешкодити підключенню користувача.", -1, 10, 1, 275, 27 + LTEXT "Користувачі, яким дозволено &підключатися:", -1, 10, 28, 275, 8 CONTROL "", 7043, "SYSLISTVIEW32", WS_BORDER | WS_GROUP | WS_TABSTOP | 0x0000440D, 10, 42, 275, 73 - PUSHBUTTON "&...", 7044, 10, 122, 65, 14, WS_GROUP - PUSHBUTTON "&", 7045, 79, 122, 65, 14, WS_GROUP - PUSHBUTTON "&", 7046, 147, 122, 65, 14, WS_GROUP + PUSHBUTTON "&Додати...", 7044, 10, 122, 65, 14, WS_GROUP + PUSHBUTTON "В&идалити", 7045, 79, 122, 65, 14, WS_GROUP + PUSHBUTTON "Влас&тивості", 7046, 147, 122, 65, 14, WS_GROUP END 7050 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT " , .", -1, 10, 4, 299, 10 - LTEXT "& :", -1, 10, 16, 275, 8 + LTEXT "Установіть прапорці поруч із пристроями, які потрібно використовувати для вхідних підключень.", -1, 10, 4, 299, 10 + LTEXT "&Пристрої для підключення:", -1, 10, 16, 275, 8 CONTROL "", 7011, "SYSLISTVIEW32", WS_BORDER | WS_GROUP | WS_TABSTOP | 0x0000440D, 10, 26, 297, 87 - PUSHBUTTON "&", 7013, 243, 120, 65, 14, WS_GROUP + PUSHBUTTON "Влас&тивості", 7013, 243, 120, 65, 14, WS_GROUP END 7051 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT " , .", -1, 10, 1, 288, 20 - LTEXT "& :", -1, 10, 24, 274, 8 + LTEXT "Установіть прапорці поруч із назвами мережних програм, які слід дозволити для вхідних підключень.", -1, 10, 1, 288, 20 + LTEXT "&Мережне програмне забезпечення:", -1, 10, 24, 274, 8 CONTROL "", 7036, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x0000440D, 10, 34, 286, 33 - PUSHBUTTON "&...", 7037, 108, 71, 60, 14, WS_GROUP - PUSHBUTTON "&", 7038, 172, 71, 60, 14, WS_GROUP - PUSHBUTTON "&", 7039, 236, 71, 60, 14, WS_GROUP + PUSHBUTTON "&Установити...", 7037, 108, 71, 60, 14, WS_GROUP + PUSHBUTTON "В&идалити", 7038, 172, 71, 60, 14, WS_GROUP + PUSHBUTTON "Влас&тивості", 7039, 236, 71, 60, 14, WS_GROUP LTEXT "", 7040, 21, 105, 273, 38 - LTEXT ":", -1, 21, 95, 275, 8 + LTEXT "Опис:", -1, 21, 95, 275, 8 END 7052 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT "³ , ' ' IP- .", -1, 10, 4, 290, 20 - AUTORADIOBUTTON "& ", 7053, 29, 63, 265, 10, BS_TOP | BS_MULTILINE | WS_GROUP - AUTORADIOBUTTON "& ", 7054, 29, 78, 265, 10, BS_TOP | BS_MULTILINE | NOT WS_TABSTOP - LTEXT " '?", -1, 17, 49, 275, 8 - LTEXT " VPN-, Windows , ' VPN-.", -1, 10, 25, 293, 25 + LTEXT "Віртуальні приватні підключення через Інтернет можливі, лише якщо ваш комп'ютер має відоме ім'я або IP-адресу в Інтернеті.", -1, 10, 4, 290, 20 + AUTORADIOBUTTON "Дозвол&ити віртуальні приватні підключення", 7053, 29, 63, 265, 10, BS_TOP | BS_MULTILINE | WS_GROUP + AUTORADIOBUTTON "&Заборонити віртуальні приватні підключення", 7054, 29, 78, 265, 10, BS_TOP | BS_MULTILINE | NOT WS_TABSTOP + LTEXT "Дозволити віртуальні приватні підключення до цього комп'ютера?", -1, 17, 49, 275, 8 + LTEXT " Якщо дозволити VPN-підключення, Windows змінить брандмауер підключення до Інтернету таким чином, що вашому комп'ютеру буде дозволено надсилати й отримувати VPN-пакети.", -1, 10, 25, 293, 25 END 7055 DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN - LTEXT "& :", -1, 23, 24, 275, 8 + LTEXT "&Пристрій для цього підключення:", -1, 23, 24, 275, 8 COMBOBOX 7056, 22, 36, 275, 125, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - LTEXT " , , .", -1, 10, 4, 275, 17 - PUSHBUTTON "&", 7061, 232, 53, 65, 14, WS_GROUP + LTEXT "Усі пристрої, окрім вибраних, не будуть задіяні й можуть використовуватися для інших потреб.", -1, 10, 4, 275, 17 + PUSHBUTTON "Влас&тивості", 7061, 232, 53, 65, 14, WS_GROUP END 7379 DIALOGEX 0, 0, 317, 143 @@ -1826,556 +1826,556 @@ END 19900 DIALOGEX 0, 0, 156, 44 STYLE DS_SHELLFONT | WS_POPUP | WS_CAPTION -CAPTION "³ " +CAPTION "Віддалений доступ до мережі" FONT 8, "MS Shell Dlg" BEGIN ICON 563, 19901, 10, 10, 18, 20 - LTEXT " ...", 19902, 34, 16, 120, 8 + LTEXT "Очікується запуск служби...", 19902, 34, 16, 120, 8 END STRINGTABLE BEGIN - 187 "&ͳ, \0" - 188 " ( ) %1. ?\0" - 189 " \0" - 190 " \0" - 191 " \0" - 192 " \0" - 193 " ' .\0" - 194 " \n (NAT). \n . , \n \n . \n IP-.\0" - 195 " 0 9.\0" - 196 "' . '.\0" - 197 " %1 %2.\0" - 198 " DLL . , .\0" - 199 " .\n , '.\0" - 200 "\0" - 201 " .\0" - 202 " TCP/IP . ³ """", """", """".\0" - 203 " IPX . IPX, - ""ϳ"".\0" - 204 " ?\0" - 205 " %1 ?\0" - 206 "³ %1?\0" - 207 " ""%1"" . ?\0" - 208 " . ?\0" - 209 " ' ""%1"". \0" - 210 " ' , "" "" .\0" - 212 " .\0" - 213 " , """".\0" + 187 "&Ні, не набирати номер\0" + 188 "Ви (або програма) замовили відомості від %1. Яке підключення використати?\0" + 189 "Додати додатковий номер телефону\0" + 190 "Задіяти лише перший наявний пристрій\0" + 191 "Задіяти всі пристрої\0" + 192 "Задіяти лише необхідні пристрої\0" + 193 "Введіть ім'я користувача й пароль для віддаленого доступу до мережного домену.\0" + 194 "На цей час як протокол маршрутизації установлено протокол перетворення\nмережних адрес (NAT). Його слід вимкнути перед увімкненням спільного доступу\nдо підключення до Інтернету. Щоб видалити перетворення мережних адрес, відкрийте\nоснащення диспетчера маршрутизації й віддаленого доступу та виберіть\nмаршрутизатор у лівій області. Видаліть протокол перетворення мережних адрес\nзі списку протоколів IP-маршрутизації.\0" + 195 "Код міста повинен складатися лише з цифр від 0 до 9.\0" + 196 "Ім'я елемента повинно містити принаймні один непустий знак і не може починатися із крапки. Виберіть інше ім'я.\0" + 197 "Для цього поля слід вибрати значення в межах від %1 до %2.\0" + 198 "Не вдалося завантажити бібліотеку DLL спеціальної перевірки. Перевірте, чи правильно установлено пакет спеціальної перевірки.\0" + 199 "Вибране підключення було установлено багатопротокольним маршрутизатором.\nСкористайтеся засобом адміністрування маршрутизації та віддаленого доступу, щоб завершити зв'язок.\0" + 200 "Примітка\0" + 201 "Не вдалося налаштувати пакет спеціальної перевірки.\0" + 202 "Протокол TCP/IP не установлено або вимкнуто для маршрутизації та віддаленого доступу. Відкрийте на панелі керування значок ""Мережа"", перейдіть на сторінку ""Служби"", виберіть властивості служби маршрутизації та віддаленого доступу й натисніть кнопку ""Мережа"".\0" + 203 "Протокол IPX не установлено або вимкнуто для маршрутизації та віддаленого доступу. Щоб установити або ввімкнути IPX, відкрийте сторінку властивостей будь-якого підключення в папці ""Підключення"".\0" + 204 "Видалити вибрані пристрої з цього списку?\0" + 205 "Видалити %1 із телефонної книги?\0" + 206 "Відключитися від %1?\0" + 207 "Файл ""%1"" уже існує. Перезаписати його?\0" + 208 "У сценарії знайдено синтаксичні помилки. Показати журнал помилок?\0" + 209 "Установлено з'єднання з ""%1"". \0" + 210 "Щоб завершити зв'язок або перевірити стан поточного підключення, клацніть правою кнопкою миші значок ""Монітор віддаленого доступу"" на панелі завдань.\0" + 212 "Успішне підключення.\0" + 213 "Вибраний метод спеціальної перевірки слід ініціалізувати, натиснувши кнопку ""Властивості"".\0" 214 "lnk\0" - 215 " (*.rnk)\0" + 215 "Ярлики віддаленого доступу (*.rnk)\0" 216 "*.rnk\0" - 217 " \0" - 218 " ' %1. ...\0" - 219 " .\0" - 220 " .\0" - 221 " .\0" - 222 " .\0" - 223 "볺:\0" - 224 "\0" - 225 ":\0" - 226 ":\0" - 227 "( )\0" - 228 "ϳ&...\0" - 229 "&\0" - 230 "ϳ \0" - 231 " \0" + 217 "Створити ярлик віддаленого доступу\0" + 218 "Не вдалося зв'язатися з %1. Очікується повторне підключення...\0" + 219 "Не вдалося отримати дані про формування пакетів.\0" + 220 "Не вдалося отримати дані про порти.\0" + 221 "Не вдалося отримати дані про проекцію.\0" + 222 "Не вдалося завантажити список підключень.\0" + 223 "Клієнт:\0" + 224 "Подробиці\0" + 225 "Пристрій:\0" + 226 "Мережа:\0" + 227 "(немає підключення)\0" + 228 "Підкл&ючити...\0" + 229 "&Завершити\0" + 230 "Підключення віддаленого доступу\0" + 231 "Параметри модема установлені за замовчуванням\0" 232 "COM1\0" - 233 "³ \0" - 234 " \0" - 235 " ' .\0" - 236 " ' %1 . '.\0" - 237 " .\0" - 238 " \0" - 239 " .\0" - 240 "\0" - 241 "& :\0" - 242 " \0" - 243 " \0" - 244 " , .\0" - 245 " , . .\0" - 246 " .\n\n ""OK"", .\0" - 247 " / ReactOS .\0" - 248 " X.25 .\0" - 249 " %1: %2\0" - 250 "%1\n\n %2: %3\0" - 251 "%1\n\n %2: %3\nij: %4\0" - 252 "%1\n\n %2: %3\n : %4\0" - 253 "%1\n\n %2: %3\n\n F1.\0" - 254 "%1\n\n %2: %3\n': %4\0" + 233 "Віддалений маршрутизатор\0" + 234 "Модем або інший пристрій\0" + 235 "Введіть ім'я облікового запису для цього інтерфейсу на віддаленому маршрутизаторі.\0" + 236 "Елемент з ім'ям %1 уже існує. Виберіть інше ім'я.\0" + 237 "Ви можете дозволити надсилання вашого пароля без шифрування.\0" + 238 "Шифрування пароля\0" + 239 "Майстер готовий створити нове підключення.\0" + 240 "Завершено\0" + 241 "&Номер телефону:\0" + 242 "Час зворотного виклику\0" + 243 "Змінити додатковий номер телефону\0" + 244 "Оскільки це підключення зараз активне, зміни деяких параметрів наберуть сили лише за наступного набору номера.\0" + 245 "Немає підключень, доступних для всіх користувачів. Перед набором номера слід ввійти до системи.\0" + 246 "Телефонна книга пуста.\n\nНатисніть кнопку ""OK"", щоб додати елемент.\0" + 247 "Внаслідок обмежень на імпорт/експорт шифрування даних у цій версії ReactOS не підтримується.\0" + 248 "Введіть адресу X.25 на наступному екрані.\0" + 249 "Помилка %1: %2\0" + 250 "%1\n\nПомилка %2: %3\0" + 251 "%1\n\nПомилка %2: %3\nДіагностика: %4\0" + 252 "%1\n\nПомилка %2: %3\nКод помилки: %4\0" + 253 "%1\n\nПомилка %2: %3\n\nДля отримання додаткових відомостей натисніть клавішу F1.\0" + 254 "%1\n\nПомилка %2: %3\nІм'я: %4\0" 255 "%1\n\n%4\0" - 256 "%1\n\n %2: %3\n³: %4\0" - 257 " : 0x%1\n\0" - 258 "': %1\n\0" - 259 "%1 %2: %3\n\0" - 260 "%1 .\n\0" - 261 " , .\0" - 262 " \0" - 263 " ""%1"", """".\0" + 256 "%1\n\nПомилка %2: %3\nВідповідь: %4\0" + 257 "Код помилки: 0x%1\n\0" + 258 "Ім'я: %1\n\0" + 259 "%1 протокол повідомляє про помилку %2: %3\n\0" + 260 "%1 протокол успішно підключено.\n\0" + 261 "Можна вибрати, який протокол віддаленого доступу слід використовувати.\0" + 262 "Виберіть протокол віддаленого доступу\0" + 263 "Щоб зберегти ""%1"", натисніть кнопку ""Готово"".\0" 264 "netcfg.hlp\0" - 265 "& \0" - 266 "& :\0" - 267 " &:\0" - 268 " \0" - 269 " IP-.\0" - 270 "IP-\0" - 271 " TCP/IP . ³ """", """", """".\0" + 265 "&Перемістити вдалий номер на початок списку при підключенні\0" + 266 "&Новий номер телефону:\0" + 267 "Номери &телефонів:\0" + 268 "Номери телефонів\0" + 269 "Можна ввести фіксовану IP-адресу.\0" + 270 "IP-адреса\0" + 271 "Протоколи TCP/IP не установлені або вимкнуті для віддаленого доступу. Відкрийте на панелі керування значок ""Мережа"", перейдіть на сторінку ""Служби"", виберіть властивості служби віддаленого доступу й натисніть кнопку ""Мережа"".\0" 272 "TCP/IP\0" - 273 "IPSec, \0" - 274 "IPX/SPX \0" - 275 " ( )\0" + 273 "IPSec, політика за замовчуванням\0" + 274 "IPX/SPX або сумісний\0" + 275 " (поточне розташування)\0" 276 "ISDN\0" - 277 " ISDN \0" - 278 "64 ()\0" - 279 "56 ()\0" - 280 "56 ()\0" - 281 " .\0" - 282 " \0" + 277 "Усі доступні лінії ISDN багатоканальні\0" + 278 "64К (цифровий)\0" + 279 "56К (цифровий)\0" + 280 "56К (голосовий)\0" + 281 "Може знадобитися особлива процедура перед підключенням.\0" + 282 "Виберіть параметри входу до системи\0" 283 "%d%%\0" - 284 " %s\0" - 285 "& :\0" - 286 "&:\0" - 287 "\0" - 288 " .\0" - 289 " \0" - 290 "' ' PPP.\0" - 291 "\0" - 292 " .\0" - 293 " MS Point-to-Point, RSA/RC4, 128 \0" - 294 " MS Point-to-Point, RSA/RC4, 40 \0" - 295 " \0" - 296 "( """")\0" - 297 " DNS WINS.\0" - 298 " \0" - 299 " RAS\0" + 284 "Номер телефону для %s\0" + 285 "&Нове розташування:\0" + 286 "&Розташування:\0" + 287 "Розташування\0" + 288 "Цей пристрій буде використано для підключення.\0" + 289 "Виберіть пристрій\0" + 290 "Об'єднання ліній у в'язку можливе лише за підключення до сервера PPP.\0" + 291 "Модем\0" + 292 "Цей модем не установлено.\0" + 293 "Шифрування MS Point-to-Point, RSA/RC4, 128 біт\0" + 294 "Шифрування MS Point-to-Point, RSA/RC4, 40 біт\0" + 295 "Декілька ліній\0" + 296 "(натисніть кнопку ""Налаштувати"")\0" + 297 "Можна ввести фіксовані адреси DNS і WINS.\0" + 298 "Адреси серверів імен\0" + 299 "Рання версія RAS\0" 300 "PPP\0" - 301 " PPP\0" + 301 "Багатоканальний PPP\0" 302 "SLIP\0" 303 "NetBEUI\0" - 304 " , .\0" - 305 " .\0" - 306 " .\0" - 307 " , .\0" - 308 " . """", .\0" - 309 " "" IP-"", IP-.\0" - 310 " X.25 X.25, X.25.\0" - 311 "()\0" - 312 "%1 .\0" - 313 " \0" - 314 " %1 , . ³ """", """", """".\0" - 315 " .\0" - 316 " .\0" - 317 " .\0" - 318 " .\0" - 319 " .\0" - 320 " .\0" - 321 " .\0" - 322 " RAS.\0" - 323 " .\0" - 324 " .\0" - 325 " script.log notepad.exe\0" - 326 " switch.inf notepad.exe\0" - 327 " TAPI.\0" - 328 " X.25.\0" - 329 " .\0" - 330 " .\0" - 331 " ' .\0" - 332 " /.\0" - 333 " .\0" - 334 " .\0" - 335 " .\0" - 336 " .\0" - 337 " .\0" - 338 " TAPI.\0" - 339 " .\0" - 340 " .\0" - 341 " . ?\0" - 342 " .\0" - 343 " .\0" - 344 " .\0" - 345 " \0" - 346 " .\0" - 347 "\0" - 348 " .\0" - 349 " \0" - 350 " .\0" - 351 " .\0" + 304 "Було створено особисту телефонну книгу, до якої скопійовано вміст системної телефонної книги.\0" + 305 "Не вибрано жодної іншої телефонної книги.\0" + 306 "Цей пристрій неможливо налаштувати динамічно.\0" + 307 "Цей елемент неможливо видалити, оскільки він зараз підключений.\0" + 308 "Не вибрано жодного елемента. Натисніть кнопку ""Створити"", щоб створити новий елемент.\0" + 309 "Якщо вибрано параметр ""укажіть IP-адресу"", слід указати ненульову IP-адресу.\0" + 310 "Якщо вибрано віддалене підключення до мережі X.25 або до пристрою X.25, слід указати адресу X.25.\0" + 311 "(немає)\0" + 312 "%1 уже є в списку.\0" + 313 "Захищати мої пароль і дані\0" + 314 "Протокол %1 неможливо вибрати, оскільки він не установлений або вимкнутий для віддаленого доступу. Відкрийте на панелі керування значок ""Мережа"", перейдіть на сторінку ""Служби"", виберіть властивості служби віддаленого доступу й натисніть кнопку ""Мережа"".\0" + 315 "Не вдалося зберегти пароль.\0" + 316 "Не вдалося показати дані.\0" + 317 "Не вдалося отримати дані про автоматичний набір номера.\0" + 318 "Не вдається завантажити діалогове вікно.\0" + 319 "Не вдається відключити спільний доступ.\0" + 320 "Не вдалося завантажити сторінку властивостей.\0" + 321 "Не вдалося завантажити телефонну книгу.\0" + 322 "Не вдалося завантажити дані про порт диспетчера RAS.\0" + 323 "Не вдалося прочитати настройки користувача з реєстру.\0" + 324 "Не вдалося завантажити дані про сценарій.\0" + 325 "Неможливо переглянути script.log за допомогою notepad.exe\0" + 326 "Неможливо змінити switch.inf за допомогою notepad.exe\0" + 327 "Не вдалося завантажити дані про TAPI.\0" + 328 "Не вдалося завантажити дані про X.25.\0" + 329 "Не вдалося створити нову телефонну книгу.\0" + 330 "Неможливо ввімкнути спільний доступ.\0" + 331 "Не вдалося з'єднатися з цим елементом телефонної книги.\0" + 332 "Не вдалося отримати буфер прийому/передачі.\0" + 333 "Не вдалося отримати дані про стан порту.\0" + 334 "Не вдалося отримати дані про протокол.\0" + 335 "Не вдалося отримати буфер від пристрою.\0" + 336 "Не вдалося надіслати буфер до пристрою.\0" + 337 "Не вдалося отримати дані.\0" + 338 "Не вдалося зберегти дані про TAPI.\0" + 339 "Не вдалося зберегти дані.\0" + 340 "Сценарій припинено.\0" + 341 "Сценарій припинено через помилку. Показати журнал помилок?\0" + 342 "Не вдалося установити дані про автоматичний набір номера.\0" + 343 "Не вдалося видалити збережений пароль.\0" + 344 "Не вдалося записати до телефонної книги.\0" + 345 "Записування параметрів до реєстру\0" + 346 "Не вдалося записати файл ярлика.\0" + 347 "ОК\0" + 348 "Укажіть номер телефону постачальника послуг Інтернету.\0" + 349 "Введіть номер телефону\0" + 350 "Пароль і підтвердження пароля не співпадають.\0" + 351 "Новий пароль і підтвердження нового пароля не співпадають.\0" 352 "pbk\0" - 353 " (*.pbk)\0" + 353 "Файли телефонної книги (*.pbk)\0" 354 "*.pbk\0" - 355 "³ \0" - 356 " \0" - 357 " \0" - 358 " \0" - 359 " \0" - 360 " \0" - 361 " \0" - 362 " .\0" - 363 " PPP, """" .\0" - 364 "& :\0" - 365 "&:\0" - 366 " \0" - 367 " .\n\n\0" - 368 " """", , """", '.\0" - 369 " %1 %2, PPP:\0" - 370 "[ , ]\0" - 405 " RAS NetBEUI.\0" - 406 " RAS, NetBEUI. """" .\0" - 407 "& \0" - 408 " . , .\n """", , ""ͳ"",\n . \n\n\n\n\n\n\0" - 409 " \0" - 410 " .\0" - 411 " , ""%1"" . ֳ . \n Win NT4/2000 ' ' . \n\n\n\n\n\n\0" + 355 "Відкрити телефонну книгу\0" + 356 "Скопіювати елемент телефонної книги\0" + 357 "Змінити елемент телефонної книги\0" + 358 "Створити елемент телефонної книги\0" + 359 "Номер телефону\0" + 360 "Номери телефонів\0" + 361 "Сетевые подключения\0" + 362 "Слід вибрати принаймні один мережний протокол.\0" + 363 "Щоб мати змогу підключатися до серверів PPP, слід установити мережний протокол за допомогою значка ""Мережа"" на панелі керування.\0" + 364 "&Новий префікс:\0" + 365 "&Префікси:\0" + 366 "Префікси номерів телефонів\0" + 367 "Один або декілька потрібних мережних протоколів не було успішно підключено.\n\n\0" + 368 "Натисніть кнопку ""Приймати"", щоб використовувати підключення як є, або кнопку ""Завершити"", щоб завершити зв'язок.\0" + 369 "Коли %1 установлює підключення на вимогу через інтерфейс %2, використовувати такі параметри протоколу PPP:\0" + 370 "[Щоб змінити збережений пароль, клацніть тут]\0" + 405 "Для виклику старих серверів RAS потрібен протокол NetBEUI.\0" + 406 "Щоб мати змогу підключатися до старих серверів RAS, слід установити протокол NetBEUI. Цей протокол можна установити за допомогою значка ""Мережа"" на панелі керування.\0" + 407 "&Повторний дзвінок\0" + 408 "Ви заборонили використання одного або декількох транспортних протоколів. Таким чином, диспетчери маршрутизації та протоколи маршрутизації для заборонених транспортних протоколів будуть видалені із цього інтерфейсу виклику на вимогу.\nНатисніть кнопку ""Так"", щоб підтвердити видалення, або кнопку ""Ні"",\nщоб дозволити транспорти. \n\n\n\n\n\n\0" + 409 "Спільний доступ до підключення до Інтернету\0" + 410 "Обліковий запис інтерфейсу виклику на вимогу.\0" + 411 "Слід указати облікові дані вихідного підключення, які використовуватимуться інтерфейсом ""%1"" для підключення до віддаленого маршрутизатора. Ці облікові дані мусять співпадати з обліковими даними вхідного підключення на цьому віддаленому маршрутизаторі. В разі підключення до \nмаршрутизатора Win NT4/2000 ім'я користувача також мусить співпадати з ім'ям інтерфейсу віддаленого маршрутизатора. \n\n\n\n\n\n\0" 412 "mpradmin.hlp\0" - 413 "& \0" - 414 "& :\0" - 415 "& :\0" - 416 " \0" + 413 "&Перемістити вдалий номер або адресу на початок списку при підключенні\0" + 414 "&Новий номер телефону або адреса:\0" + 415 "&Номери телефонів або адреси:\0" + 416 "Номери телефонів і адреси\0" 417 "PPP: Win 95/98/NT4/2000, Internet\0" - 418 "\0" - 419 "SLIP: Unix\0" - 420 " .\0" - 421 " ...\0" - 422 " ...\0" - 423 " ...\0" - 424 " '...\0" - 425 " ...\0" - 426 " ' ...\0" - 427 " ...\0" - 428 " ...\0" - 429 " .\0" - 430 "ϳ %1...\0" - 431 " ...\0" - 432 "ϳ ...\0" - 433 "ϳ ...\0" - 434 " %1...\0" - 435 "ϳ X.25 %1...\0" - 436 "ϳ %1...\0" - 437 " %1...\0" - 438 "ϳ .\0" - 439 " .\0" - 440 ".\0" - 441 "ϳ .\0" - 442 "ϳ .\0" - 443 "³ ...\0" - 444 "ϳ X.25 .\0" - 445 " .\0" - 446 "ϳ .\0" - 447 " .\0" - 448 "ϳ ...\0" - 449 " ...\0" - 450 " ...\0" - 451 "ϳ, ' \0" - 452 " .\0" - 453 " ...\0" - 454 " ...\0" - 455 " ?\0" + 418 "Немає\0" + 419 "SLIP: підключення Unix\0" + 420 "Усі пристрої підключено.\0" + 421 "Отримання результатів реєстрації...\0" + 422 "Надсилання відомостей зворотного виклику...\0" + 423 "Надсилання нового пароля...\0" + 424 "Обчислення швидкості зв'язку...\0" + 425 "Перевірка стану автентичності...\0" + 426 "Реєстрація комп'ютера в мережі...\0" + 427 "Повторна перевірка автентичності...\0" + 428 "Перевірка імені користувача й пароля...\0" + 429 "Перевірку виконано.\0" + 430 "Підключення через %1...\0" + 431 "Набір номера...\0" + 432 "Підключення модемів...\0" + 433 "Підключення через кабель...\0" + 434 "Набір номера %1...\0" + 435 "Підключення через X.25 до %1...\0" + 436 "Післяпідключення через %1...\0" + 437 "Передпідключення через %1...\0" + 438 "Підключення виконано.\0" + 439 "Пристрій підключений.\0" + 440 "Вимкнено.\0" + 441 "Підключення через модем виконано.\0" + 442 "Підключення через кабель виконано.\0" + 443 "Відкриття порту...\0" + 444 "Підключення через X.25 виконано.\0" + 445 "Порт відкритий.\0" + 446 "Післяпідключення закінчено.\0" + 447 "Передпідключення закінчено.\0" + 448 "Підготовка до зворотного виклику...\0" + 449 "Перевірка підключень мережних протоколів...\0" + 450 "Перевірка імені та пароля...\0" + 451 "Підключено, створення в'язки додаткових ліній\0" + 452 "Невідомий стан.\0" + 453 "Очікування зворотного виклику...\0" + 454 "Очікування скидання модема...\0" + 455 "Зберегти цю зміну номера телефону?\0" 456 "scp\0" 457 "*.scp\0" - 458 " (*.scp)\0" - 459 " \0" - 460 " .\0" - 461 " \0" - 462 " SLIP TCP/IP.\0" - 463 " SLIP, TCP/IP. """" .\0" - 464 "\0" - 465 "& :\0" - 466 "&:\0" - 467 " \0" - 468 " .\0" - 469 " \0" - 470 " \0" - 471 " \0" - 472 " \0" - 473 " SLIP\0" - 474 "10 \0" - 475 "10 \0" - 476 "1 \0" - 477 "1 \0" - 478 "24 \0" - 479 "2 \0" - 480 "2 \0" - 481 "30 \0" - 482 "30 \0" - 483 "3 \0" - 484 "4 \0" - 485 "4 \0" - 486 "5 \0" - 487 "5 \0" - 488 "8 \0" - 489 "\0" - 490 " .\0" - 491 " \0" - 492 "³ ' ?\0" - 493 " \0" - 494 " \0" - 495 " \0" + 458 "Файли сценарію комутації (*.scp)\0" + 459 "Огляд сценаріїв комутації\0" + 460 "Слід позначити принаймні один модем або адаптер.\0" + 461 "Номер телефону\0" + 462 "Для виклику старих серверів SLIP потрібен протокол TCP/IP.\0" + 463 "Щоб мати змогу підключатися до старих серверів SLIP, слід установити протокол TCP/IP. Цей протокол можна установити за допомогою значка ""Мережа"" на панелі керування.\0" + 464 "Стан\0" + 465 "&Новий суфікс:\0" + 466 "&Суфікси:\0" + 467 "Суфікси номерів телефонів\0" + 468 "При потребі можна виконати особливу настройку.\0" + 469 "Особливі параметри\0" + 470 "Термінал вводу команд модема\0" + 471 "Термінал після набору номера\0" + 472 "Термінал до набору номера\0" + 473 "Термінал для входу SLIP\0" + 474 "10 хвилин\0" + 475 "10 секунд\0" + 476 "1 година\0" + 477 "1 хвилина\0" + 478 "24 години\0" + 479 "2 години\0" + 480 "2 хвилини\0" + 481 "30 хвилин\0" + 482 "30 секунд\0" + 483 "3 секунди\0" + 484 "4 години\0" + 485 "4 хвилини\0" + 486 "5 хвилин\0" + 487 "5 секунд\0" + 488 "8 годин\0" + 489 "ніколи\0" + 490 "Нове підключення можна зробити доступним для всіх користувачів або лише для вас.\0" + 491 "Доступність підключення\0" + 492 "Відмовитися від параметрів багатоканального зв'язку для цього елемента?\0" + 493 "Недоступний пристрій\0" + 494 "Параметри входу\0" + 495 "Параметри віддаленого доступу\0" 496 "X.25\0" 497 "X.25 PAD\0" - 498 " ' ' .\0" - 499 " VPN-\0" - 500 " .\0" - 501 " ' VPN-.\0" - 502 " .\0" - 503 " \0" - 504 "ReactOS .\0" + 498 "Можна надати доступ до ресурсів комп'ютера іншим комп'ютерам за допомогою цього підключення віддаленого доступу.\0" + 499 "Вибір VPN-сервера\0" + 500 "Неможливо дозволити виклик на вимогу.\0" + 501 "Укажіть ім'я або адресу VPN-сервера.\0" + 502 "Неможливо заборонити виклик на вимогу.\0" + 503 "Публічна мережа\0" + 504 "ReactOS може спочатку підключати публічну мережу.\0" 505 "VPN1\0" - 506 " \0" - 507 " ' .\0" - 508 " ?\0" - 509 " ""%1"".\n\n ""%2"".\0" - 510 " ' ' ' .\0" - 511 " , IP- 192.168.0.1. ' ' ' . ' IP-, . ?\0" - 512 " \0" - 513 " .\0" - 514 "ϳ&\0" - 515 " \0" - 516 " \0" - 517 " MPPE-40\0" - 518 " MPPE-128\0" - 519 " MS-CHAP EAP.\0" - 520 " \0" - 521 "ϳ %1...\0" - 522 "' \0" - 523 "\0" + 506 "Спільний доступ до підключення до Інтернету\0" + 507 "Можна надати доступ до ресурсів іншим комп'ютерам у локальній мережі за допомогою цього підключення віддаленого доступу.\0" + 508 "Ведений або провідний?\0" + 509 "Спільний доступ до підключення до Інтернету вже дозволено для підключення ""%1"".\n\nНатомість буде дозволено спільний доступ для підключення ""%2"".\0" + 510 "Для з'єднання двох комп'ютерів слід визначити ваш комп'ютер як ведений або як провідний.\0" + 511 "Коли спільний доступ до підключення до Інтернету буде дозволено, мережній платі локальної мережі буде призначено IP-адресу 192.168.0.1. Через це ваш комп'ютер може втратити зв'язок з іншими комп'ютерами в мережі. Якщо ці комп'ютери мають статичні IP-адреси, слід налаштувати їх на використання динамічних адрес. Ви дійсно бажаєте дозволити спільний доступ до підключення до Інтернету?\0" + 512 "Виберіть пристрій\0" + 513 "Цей пристрій буде використано для підключення.\0" + 514 "Підкл&ючити\0" + 515 "Параметри шифрування визначаються сервером\0" + 516 "Завжди шифрувати мої дані\0" + 517 "Використовувати шифрування даних MPPE-40\0" + 518 "Використовувати шифрування даних MPPE-128\0" + 519 "Вибране шифрування потребує перевірки MS-CHAP або EAP.\0" + 520 "Особливе повідомлення перевірки\0" + 521 "Підключення до %1...\0" + 522 "Ім'я підключення\0" + 523 "Автоматичне\0" 524 "PPTP VPN\0" 525 "L2TP IPSec VPN\0" - 526 " .\0" - 527 " \0" + 526 "Виберіть тип підключення.\0" + 527 "Тип підключення\0" 528 "hh.exe netcfg.chm::/trouble_all.htm\0" - 529 "³ \0" - 530 " - , . .\0" - 531 " - . .\0" - 532 " ' .\0" - 533 " .\0" - 534 " 1 65535.\0" - 535 " , """".\0" - 536 " - . .\0" - 537 " .\0" - 538 " , """".\0" - 539 " .\n .\0" - 540 " .\0" - 541 " , .\0" - 542 "1 \0" - 543 " , .\0" - 549 " ' ', ?\0" - 576 "20 \0" - 579 " ' .\0" - 581 " \0" - 582 " ' .\0" - 583 " ' ' .\0" - 584 " ' .\0" - 585 " ' , .\0" - 586 " IP- .\0" - 587 " \0" - 588 "' . \n '.\0" - 589 "\0" - 1512 " \0" - 1523 " \0" - 1526 "-\0" - 1527 " - .\0" - 1528 " \0" - 1529 " .\0" + 529 "Віртуальне приватне підключення\0" + 530 "Використовувати будь-яку форму перевірки автентичності, включаючи незашифровані паролі. Не шифрувати дані.\0" + 531 "Використовувати будь-яку форму перевірки автентичності з шифруванням пароля. Не шифрувати дані.\0" + 532 "Введіть ім'я цього запису.\0" + 533 "Шифрувати паролі й дані.\0" + 534 "Введіть номер порту в межах від 1 до 65535.\0" + 535 "Укажіть спосіб спеціальної перевірки та шифрування даних, натиснувши кнопку ""Параметри"".\0" + 536 "Використовувати будь-яку форму перевірки автентичності з шифруванням пароля. Не шифрувати дані.\0" + 537 "Шифрувати паролі й дані.\0" + 538 "Укажіть спосіб спеціальної перевірки та шифрування даних, натиснувши кнопку ""Параметри"".\0" + 539 "Цей номер порту вже використовується іншим записом.\nВведіть інший номер порту.\0" + 540 "Введіть один або декілька портів для вхідних відповідей.\0" + 541 "Виберіть записи, які слід видалити.\0" + 542 "1 секунда\0" + 543 "Виберіть запис, який слід змінити.\0" + 549 "Яке ім'я комп'ютера, до якого ви підключаєтеся?\0" + 576 "20 хвилин\0" + 579 "Укажіть ім'я для цього підключення до робочого місця.\0" + 581 "Параметри мережного додатка\0" + 582 "Введіть ім'я для підключення в цьому полі.\0" + 583 "Введіть ім'я іншого комп'ютера в цьому полі.\0" + 584 "Введіть ім'я постачальника послуг Інтернету в цьому полі.\0" + 585 "Введіть ім'я служби, яка надає доступ до Інтернету.\0" + 586 "Введіть IP-адресу сервера у приватній мережі.\0" + 587 "Додаткові параметри\0" + 588 "Ім'я елемента починається із крапки або містить деякі неприпустимі знаки. \nВиберіть інше ім'я.\0" + 589 "Властивості\0" + 1512 "Послідовний порт\0" + 1523 " канал\0" + 1526 "Смарт-картки\0" + 1527 "Можна використовувати вашу смарт-картку для цього підключення.\0" + 1528 "Пряме підключення\0" + 1529 "Виберіть пристрій для цього підключення.\0" 1530 "Verdana Bold\0" 1531 "12\0" - 1532 " \0" - 1533 " , .\0" - 1534 " \0" - 1535 " .\0" - 1536 " \0" - 1537 " , .\0" - 1538 " \0" - 1539 " , .\0" - 1540 " \0" - 1541 " ' .\0" - 1544 "IP-\0" - 1545 "IP- .\0" - 1546 " \0" - 1547 " DNS WINS .\0" - 1548 " \0" - 1549 " .\0" - 1550 " \0" - 1551 "' , , .\0" - 1552 " \0" - 1553 "' , .\0" - 1554 "' \0" - 1555 " ' .\0" - 1556 " \0" - 1557 " %1 '. ?\0" - 1558 " SLIP.\0" - 1559 " \0" - 1560 " \0" - 1561 "-\0" - 1562 " .\0" - 1563 " ( ', )\0" - 1564 "' ( )\0" - 1565 "' ( ', )\0" - 1566 " ( ', )\0" - 1567 " ( )\0" - 1568 "³ \0" - 1569 " ' .\0" - 1570 " EAP . EAP, , .\0" - 1571 " EAP - MS-CHAP.\0" - 1572 " \0" - 1573 " .\0" - 1574 " PAP, SPAP / CHAP. , . ?\0" - 1575 " ""%1"", ""%2"". ϳ ""%2"" ?\0" - 1576 "ϳ ...\0" - 1577 "ϳ ...\0" - 1578 "ϳ .\0" - 1579 "ϳ .\0" - 1580 " , . .\0" - 1581 "& :\0" - 1582 " ' .\0" - 1583 "ֳ ' . ' , . ' , ?\0" - 1584 ", ' ' , .\0" - 1585 "³ \0" - 1586 " , , - .\0" - 1587 " , . , .\0" - 1588 " , .\0" - 1589 "³ :\r\n\r\n%1\0" - 1590 " %1\0" - 1591 "' \0" - 1592 " ' , .\0" - 1593 " ' .\0" + 1532 "Тип підключення\0" + 1533 "Виберіть тип інтерфейсу виклику на вимогу, який бажаєте створити.\0" + 1534 "Виберіть пристрій\0" + 1535 "Цей пристрій буде використано для підключення.\0" + 1536 "Номер телефону\0" + 1537 "Введіть номер телефону віддаленого сервера або маршрутизатора, який слід викликати.\0" + 1538 "Тип віртуальної приватної мережі\0" + 1539 "Виберіть тип інтерфейсу віртуальної приватної мережі, який бажаєте створити.\0" + 1540 "Адреса призначення\0" + 1541 "Укажіть ім'я або адресу віддаленого маршрутизатора.\0" + 1544 "IP-адреса\0" + 1545 "IP-адресу маршрутизатора для цього інтерфейсу.\0" + 1546 "Адреси серверів імен\0" + 1547 "Адреси DNS і WINS для цього інтерфейсу.\0" + 1548 "Сценарії маршрутизатора\0" + 1549 "Можна налаштовувати сценарії для підключення до віддаленого маршрутизатора.\0" + 1550 "Облікові дані вхідного підключення\0" + 1551 "Ім'я користувача й пароль, які використовуватиме віддалений маршрутизатор, підключаючись до цього сервера.\0" + 1552 "Облікові дані вихідного підключення\0" + 1553 "Ім'я користувача й пароль, які слід використовувати при підключенні до віддаленого маршрутизатора.\0" + 1554 "Ім'я інтерфейсу\0" + 1555 "Виберіть ім'я для цього нового інтерфейсу.\0" + 1556 "Немає доступних пристроїв\0" + 1557 "Обліковий запис користувача %1 уже існує на локальному комп'ютері. Чи повинен інтерфейс виклику на вимогу використовувати цей обліковий запис?\0" + 1558 "Параметри безпеки для підключень до серверів SLIP.\0" + 1559 "Незахищений пароль\0" + 1560 "Безпечний пароль\0" + 1561 "Смарт-картка\0" + 1562 "Слід вибрати принаймні один протокол перевірки пароля.\0" + 1563 "не дозволене (сервер розриватиме зв'язок, якщо потрібне шифрування)\0" + 1564 "необов'язкове (підключатися навіть без шифрування)\0" + 1565 "обов'язкове (розірвати зв'язок, якщо сервер працює без шифрування)\0" + 1566 "найстійкіше (розірвати зв'язок, якщо сервер працює без шифрування)\0" + 1567 " (шифрування ввімкнуто)\0" + 1568 "Відомості про обліковий запис Інтернету\0" + 1569 "Для облікового запису Інтернету буде потрібне ім'я облікового запису та пароль.\0" + 1570 "Вибраний пакет EAP не надає ключів шифрування. Виберіть пакет EAP, який надає ключі, або взагалі відмовтеся від шифрування.\0" + 1571 "Вибране шифрування потребує методів перевірки EAP або будь-якої версії MS-CHAP.\0" + 1572 "Протоколи та безпека\0" + 1573 "Виберіть транспортні протоколи та параметри безпеки для цього підключення.\0" + 1574 "Вибрані протоколи включають PAP, SPAP та/або CHAP. Якщо буде узгоджено використання одного з них, шифрування даних не виконуватиметься. Залишити ці параметри?\0" + 1575 "Щоб підключитися до ""%1"", спочатку слід підключитися до ""%2"". Підключитися до ""%2"" зараз?\0" + 1576 "Підключення через паралельний кабель...\0" + 1577 "Підключення через інфрачервоний канал...\0" + 1578 "Підключено через паралельний кабель.\0" + 1579 "Підключено через інфрачервоний канал.\0" + 1580 "Це підключення було налаштовано на використання шифрування даних зі стійкістю, яка не підтримується установленим програмним забезпеченням. Параметри безпеки цього підключення змінено на використання шифрування з доступним ступенем стійкості.\0" + 1581 "&Тип віртуальної приватної мережі:\0" + 1582 "Введіть ім'я користувача.\0" + 1583 "Ці ім'я та пароль будуть збережені для вас. Уже існують ім'я та пароль, збережені для всіх інших користувачів цього підключення. Видалити ім'я та пароль, збережені для всіх інших користувачів?\0" + 1584 "Наприклад, можна ввести ім'я робочого місця або ім'я сервера, до якого ви будете підключатися.\0" + 1585 "Відомості про обліковий запис\0" + 1586 "Елементи керування в цьому вікні властивостей вимкнуті, оскільки слід перезавантажити систему, перед тим як вносити будь-які зміни до настройки.\0" + 1587 "Елементи керування в цьому вікні властивостей вимкнуті, оскільки вже відкрито одне або декілька інших вікон властивостей мережі. Щоб скористатися цими елементами, закрийте всі вікна властивостей і відкрийте це вікно знову.\0" + 1588 "Деякі елементи керування в цьому вікні властивостей вимкнуті, оскільки ви не маєте достатніх прав на доступ до них.\0" + 1589 "Від постачальника служби доступу отримано таке повідомлення:\r\n\r\n%1\0" + 1590 "Перепідключення %1\0" + 1591 "Ім'я служби\0" + 1592 "Укажіть ім'я служби, яка забезпечує високошвидкісне підключення.\0" + 1593 "Для вашого облікового запису буде потрібно ім'я облікового запису та пароль.\0" 1594 "PPPOE1-0\0" - 1595 " PPP Ethernet (PPPoE)\0" - 1596 "& :\0" - 1611 " \0" - 1612 " , . \n .\0" - 1613 " \0" - 1634 " Windows (WMI) , ReactOS .\n\n , WMI. """" """", "" Windows"" """".\0" - 1635 "ReactOS . , Windows (WMI) . , ""³ "" ReactOS ( ). ""³ "" """" ( """").\0" - 1646 " \0" - 1647 " \0" - 1648 " \0" - 1649 " \0" - 1650 " \0" - 1651 " \0" - 1652 " \0" - 1653 " \0" - 1654 " \0" + 1595 "Протокол PPP через Ethernet (PPPoE)\0" + 1596 "&Тип створюваного високошвидкісного підключення:\0" + 1611 "Високошвидкісне підключення\0" + 1612 "Попередній спільний ключ вибрано для використання, але не введено. \nВведіть попередній ключ.\0" + 1613 "Не вдається надіслати облікові дані\0" + 1634 "Оскільки службу інструментарію керування Windows (WMI) було вимкнуто, ReactOS не може показати властивості цього підключення або домашньої мережі.\n\nЩоб налаштувати властивості підключення або домашньої мережі, слід спочатку ввімкнути службу WMI. Для цього на панелі керування ""Адміністрування"" двічі клацніть значок ""Служби"", клацніть правою кнопкою миші службу ""Інструментарій керування Windows"" і виберіть пункт ""Запустити"".\0" + 1635 "ReactOS не може показати властивості цього підключення. Можливо, дані інструментарію керування Windows (WMI) пошкоджені. Щоб виправити це, за допомогою засобу ""Відновлення системи"" відновіть попередній стан ReactOS (тобто поверніться до контрольної точки відновлення). Засіб ""Відновлення системи"" міститься в папці ""Службові"" (меню ""Стандартні"").\0" + 1646 "Дозволити вхідний запит луни\0" + 1647 "Дозволити вхідний запит мітки часу\0" + 1648 "Дозволити вхідний запит маски\0" + 1649 "Дозволити вхідний запит маршрутизатора\0" + 1650 "Дозволити недоступне вихідне місце призначення\0" + 1651 "Дозволити вимкнення вихідного джерела\0" + 1652 "Дозволити помилки у вихідних параметрах\0" + 1653 "Дозволити перевищення вихідного часу\0" + 1654 "Дозволити переспрямування\0" 1655 "log\0" 1656 "*.log\0" - 1657 " (*.log)\0" - 1658 "\0" - 1663 " \0" - 1664 " , . .\0" - 1665 ", ', . , , ' '.\0" - 1666 " , ', , .\0" - 1667 " ' , .\0" - 1668 " ' .\0" - 1669 ", ' , "" "".\0" - 1670 " ' , , .\0" - 1671 " ' , , "" "".\0" - 1672 " ' , "" "".\0" - 1673 ", ', , .\0" - 1675 " . 1 32767 .\0" - 1685 " . .\0" - 1686 " ' . ( ' , .)\0" - 1687 "&' '\0" - 1688 "& \0" - 1689 "&\0" - 1690 " ?\n\0" - 7301 " TCP/IP\0" - 7302 " %1 %2.\0" - 7306 " \0" - 7307 " \0" - 7308 " \0" - 7309 " \0" - 7310 " \0" - 7311 " \0" - 7312 " \0" - 7313 " TCP/IP \0" - 7314 " IPX \0" - 7315 " \0" - 7316 "\0" - 7317 "\0" - 7318 " \0" - 7319 " \0" - 7320 " \0" - 7321 " ' """".\0" - 7322 " .\0" - 7323 " . .\0" - 7324 " . \0" - 7325 " \0" - 7326 " . \0" - 7327 " . \0" - 7328 " .\0" - 7329 " , .\0" - 7330 " .\0" - 7331 " : .\0" - 7332 " , .\0" - 7333 " . \0" - 7334 " .\0" - 7335 " , """".\0" - 7336 " . \0" - 7337 " .\0" - 7338 " : .\0" - 7339 " . \0" - 7340 " .\0" - 7341 " .\0" - 7342 " TCP/IP. \0" - 7343 " IPX. \0" - 7344 " TCP/IP.\0" - 7345 " IPX.\0" - 7346 " TCP/IP . \0" - 7347 " IPX . \0" - 7348 " , . .\0" - 7349 " , .\0" - 7350 " , ' ( ). \0" - 7351 " . \0" - 7352 " , .\0" - 7353 " \0" - 7354 ", , , """". %s? \0" - 7355 " . ³ , . ?\0" - 7356 " . ϳ . , 255.255.0.0 ( ) , 255.0.255.0 - . \n\0" - 7357 " \0" - 7358 " , '.\0" - 7359 " \0" - 7360 " , ' .\0" - 7361 " (VPN)\0" - 7362 " ' ' ' VPN-\0" - 7363 " \0" - 7364 " ' ' .\0" - 7365 " \0" + 1657 "Файли журналу брандмауера (*.log)\0" + 1658 "Огляд\0" + 1663 "Виберіть підключення до приватної мережі\0" + 1664 "Щоб дозволити спільний доступ до підключення до Інтернету, слід вибрати підключення для приватної мережі. Виберіть підключення зі списку наявних підключень.\0" + 1665 "Повідомлення, надіслані на цей комп'ютер, будуть повернуті відправникові. Це звичайно використовується для пошуку несправностей, наприклад, для перевірки зв'язку з комп'ютером.\0" + 1666 "Отримання даних, надісланих на цей комп'ютер, може бути підтверджено повідомленням, в якому буде вказано дату та час прийому.\0" + 1667 "Цей комп'ютер отримуватиме та відповідатиме на запити про додаткову інформацію щодо мережі, до якої його підключено.\0" + 1668 "Цей комп'ютер відповідатиме на запити про інформацію щодо розпізнаних маршрутизаторів.\0" + 1669 "Дані, які були надіслані через Інтернет і не досягли цього комп'ютера помилково, будуть відкинуті з повідомленням ""місце призначення недоступне"".\0" + 1670 "Коли інтенсивність вхідного потоку перевищить можливості цього комп'ютера з обробки вхідних даних, дані будуть пропущені, а відправника попросять зменшити темп передачі.\0" + 1671 "Коли цей комп'ютер відкине дані, отримані з помилковим заголовком, він відповість відправникові повідомленням про помилку ""неправильний заголовок"".\0" + 1672 "Коли цей комп'ютер відкине незакінчену передачу даних через перевищення дозволеного часу передачі, він відповість відправникові повідомленням про помилку ""час минув"".\0" + 1673 "Дані, надіслані з цього комп'ютера, будуть переспрямовані, якщо маршрут за замовчуванням зміниться.\0" + 1675 "Введене значення розміру файлу журналу неприпустиме. Укажіть значення від 1 до 32767 КБ.\0" + 1685 "Ваш обліковий запис не має дозволу на використання цього підключення. Звичайно причиною цього буває вхід з обліковим записом гостя.\0" + 1686 "Введіть ім'я облікового запису й пароль. (Якщо ви забули існуючі ім'я облікового запису або пароль, зверніться до адміністратора мережі.)\0" + 1687 "&Ім'я комп'ютера\0" + 1688 "Ім&я постачальника послуг Інтернету\0" + 1689 "&Організація\0" + 1690 "Який номер телефону слід використовувати для цього підключення?\n\0" + 7301 "Властивості вхідних викликів TCP/IP\0" + 7302 "Для цього поля слід вибрати значення в межах від %1 до %2.\0" + 7306 "Помилка вхідних підключень\0" + 7307 "Загальна помилка вхідних підключень\0" + 7308 "Вхідні підключення\0" + 7309 "Мережна помилка вхідних підключень\0" + 7310 "Помилка багатоканального стану вхідних підключень\0" + 7311 "Помилка вхідних підключень\0" + 7312 "Помилка ініціалізації вхідних підключень\0" + 7313 "Помилка властивостей TCP/IP вхідних підключень\0" + 7314 "Помилка властивостей IPX вхідних підключень\0" + 7315 "Помилка вхідних підключень\0" + 7316 "Універсальний\0" + 7317 "Пристрій\0" + 7318 "Інші бази даних\0" + 7319 "База даних користувачів\0" + 7320 "База даних протоколів\0" + 7321 "Слід ввести ім'я входу до системи для нового користувача або натиснути кнопку ""Скасувати"".\0" + 7322 "Введений пароль занадто короткий.\0" + 7323 "Введені паролі неоднакові. Введіть їх знову.\0" + 7324 "Сталася внутрішня помилка. \0" + 7325 "Просмотр списка\0" + 7326 "Сталася помилка при спробі зафіксувати внесені зміни в базі даних локальних користувачів. \0" + 7327 "Ви не маєте достатніх прав на додання користувачів до бази даних локальної системи. \0" + 7328 "Такий користувач уже існує в базі даних локальних користувачів.\0" + 7329 "Користувача не додано до бази даних локальних користувачів, оскільки система відкинула введений пароль.\0" + 7330 "Не вдалося перезавантажити базу даних користувачів через внутрішню помилку.\0" + 7331 "Сталася внутрішня помилка: пошкоджено дескриптор бази даних локальних користувачів.\0" + 7332 "Неможливо завантажити ресурси, потрібні для показу вкладки користувачів.\0" + 7333 "Сталася внутрішня помилка при спробі відкоту внесених змін в базі даних локальних користувачів. \0" + 7334 "Дескриптор бази даних пристроїв пошкоджено.\0" + 7335 "Неможливо завантажити ресурси, потрібні для показу вкладки ""Загальні"".\0" + 7336 "Сталася помилка при спробі зафіксувати деякі внесені зміни настройки пристроїв або віртуальної приватної мережі. \0" + 7337 "Сталася внутрішня помилка.\0" + 7338 "Сталася внутрішня помилка: пошкоджено дескриптор бази даних мережних компонентів.\0" + 7339 "Сталася внутрішня помилка. \0" + 7340 "Сталася помилка при спробі зафіксувати внесені зміни настройки мережних компонентів.\0" + 7341 "Сталася внутрішня помилка.\0" + 7342 "Не вдалося зафіксувати внесені зміни настройки протоколу TCP/IP. \0" + 7343 "Не вдалося зафіксувати внесені зміни настройки протоколу IPX. \0" + 7344 "Неможливо показати вікно властивостей TCP/IP.\0" + 7345 "Неможливо показати вікно властивостей IPX.\0" + 7346 "Неможливо завантажити властивості TCP/IP із цієї системи. \0" + 7347 "Неможливо завантажити властивості IPX із цієї системи. \0" + 7348 "Вхідні підключення залежать від служби маршрутизації та віддаленого доступу, яку не вдалося запустити. Додаткові відомості містяться в журналі системних подій.\0" + 7349 "Зараз неможливо дозволити редагування мережних компонентів, оскільки вони вже змінюються ще кимсь.\0" + 7350 "Указаного нового користувача не додано до бази даних локальних користувачів, оскільки введені ім'я або пароль порушують системну політику (неправильний розмір або формат). \0" + 7351 "Неможливо видалити вказаного користувача. \0" + 7352 "Неможливо видалити вибраний мережний компонент, оскільки він зараз використовується.\0" + 7353 "Попередження вхідних підключень\0" + 7354 "Користувачі, яких ви видалите, будуть необоротно видалені із системи, навіть якщо потім натиснути кнопку ""Скасувати"". Ви дійсно бажаєте остаточно видалити %s? \0" + 7355 "Ви збираєтеся переключитися на консоль керування системою. Вікно властивостей вхідних підключень буде закрито, і усі внесені зміни наберуть сили. Продовжити?\0" + 7356 "Значення мережної маски було змінено. Після нульового біта в масці можуть стояти лише інші нульові біти. Наприклад, значення нульової маски 255.255.0.0 (у десятковій нотації) є припустимим, а значення 255.0.255.0 - ні. \n\0" + 7357 "Дозволи користувачів\0" + 7358 "Можна вказати користувачів, яким дозволено підключатися до цього комп'ютера.\0" + 7359 "Пристрої для вхідних підключень\0" + 7360 "Можна вибрати пристрої, які комп'ютер використовуватиме для приймання вхідних підключень.\0" + 7361 "Вхідне підключення до віртуальної приватної мережі (VPN)\0" + 7362 "Інший комп'ютер може з'єднатися з вашим комп'ютером через VPN-підключення\0" + 7363 "Мережне програмне забезпечення\0" + 7364 "Мережне програмне забезпечення дає змогу цьому комп'ютеру приймати підключення від комп'ютерів інших типів.\0" + 7365 "Завершення роботи майстра нових підключень\0" 7366 " \0" - 7367 " \0" - 7371 " , .\0" + 7367 "Вхідні підключення\0" + 7371 "Не установлено устаткування, здатного приймати вхідні дзвінки.\0" 7372 " \0" - 7373 "& :\0" - 7374 " & :\0" - 7375 " \0" - 7376 " \0" - 7377 " ?\0" - 7378 " , .\0" - 7379 " \0" - 7380 " Win 2000 Server , ' "" "". ?\n\0" - 7381 "& \0" - 7382 "& \0" - 7383 " IPX 00000000 FFFFFFFF. .\0" - 7384 "\0" - 7385 " (%s)\0" - 7386 " "" "" , . , .\0" - 7387 " .\0" - 7388 " ReactOS. ?\0" - 7389 " .\0" - 7390 " \0" - 7391 " ""%1"". """". , ' - '. , """"?\r\n\n "" '"", """" """". """" """".\0" - 7392 " '. . , """".\n\0" - 7393 " \0" - 7394 " IP- .\0" - 7395 " .\0" - 7396 " . 1.0.0.0 224.0.0.0 127.x.x.x.\0" - 7397 " TCP/IP , .\0" - 7398 " .\0" - 7399 " "" "". , "" "" . .\0" + 7373 "&Призначити вказаний номер мережі:\0" + 7374 "Призначати номери мереж по&слідовно з:\0" + 7375 "Новий користувач\0" + 7376 "Пристрій підключення\0" + 7377 "Який пристрій слід використовувати для цього підключення?\0" + 7378 "Не установлено устаткування, здатного приймати прямі підключення.\0" + 7379 "Попередження нового вхідного підключення\0" + 7380 "Оскільки цей сервер Win 2000 Server належить до домену або керує ним, слід налаштувати цей комп'ютер на приймання вхідних підключень за допомогою консолі ""Маршрутизація та віддалений доступ"". Скасувати зміни та перейти до цієї консолі?\n\0" + 7381 "Приз&начити номер мережі автоматично\0" + 7382 "Приз&начати номери мереж автоматично\0" + 7383 "Вхідні підключення не можуть видавати номери мереж IPX 00000000 або FFFFFFFF. Змініть призначений номер мережі або застосуйте автоматичне призначення номерів.\0" + 7384 "на\0" + 7385 "Послідовний порт (%s)\0" + 7386 "У вікні ""Мережні підключення"" не показані деякі спеціальні параметри вхідних підключень, установлені за допомогою консолей диспетчера локальних користувачів або політики віддаленого доступу. Щоб отримати вичерпні та правильні відомості про вхідні підключення, скористайтеся цими консолями.\0" + 7387 "Вибраний режим зворотного виклику користувача потребує введення правильного номера для зворотного виклику.\0" + 7388 "Для завершення операції необхідно перезавантажити ReactOS. Перезавантажити зараз?\0" + 7389 "Вибраний пристрій не має параметрів для настройки.\0" + 7390 "Неприпустимий діапазон\0" + 7391 "Ви вимагаєте заборонити вхідні підключення для ""%1"". Для цього слід зупинити службу ""Сервер"". Коли її буде зупинено, спільні папки або принтери цього комп'ютера будуть недоступні з будь-якого іншого комп'ютера. Викликати системну консоль, яка дає змогу зупинити службу ""Сервер""?\r\n\nВиберіть меню ""Керування комп'ютером"", потім ""Службові"" та ""Служби"". У правій області клацніть правою кнопкою миші значок ""Сервер"" і виберіть пункт ""Зупинити"".\0" + 7392 "Цей послідовний порт заборонено використовувати для прямого підключення до іншого комп'ютера. Його можна буде використовувати після завершення цього майстра. Потім можна буде налаштувати швидкість та інші параметри порту, клацнувши правою кнопкою миші значок цього підключення й вибравши пункт ""Властивості"".\n\0" + 7393 "Вхідні підключення\0" + 7394 "Указаний пул IP-адрес неправильний.\0" + 7395 "Указана маска підмережі неправильна.\0" + 7396 "Указана початкова адреса пула адрес неправильна. Вона повинна лежати в межах від 1.0.0.0 до 224.0.0.0 за винятком діапазону 127.x.x.x.\0" + 7397 "Указаний пул адрес TCP/IP неправильний, оскільки адреса виходить за межі маски.\0" + 7398 "Початкова адреса повинна бути меншою за кінцеву адресу.\0" + 7399 "Триває зупинення служби ""Маршрутизація та віддалений доступ"". Поки зупинення не буде остаточно виконане, параметр ""Вхідні підключення"" буде недоступним. Трохи зачекайте й повторіть спробу.\0" 7400 "%s (%s)\0" - 7401 "%s (: %d)\0" - 7402 " VPN- (PPTP)\0" - 7403 " VPN- (L2TP)\0" - 7404 "IP- (IKE)\0" + 7401 "%s (каналів: %d)\0" + 7402 "Вхідне VPN-підключення (PPTP)\0" + 7403 "Вхідне VPN-підключення (L2TP)\0" + 7404 "IP-безпека (IKE)\0" 7405 "127.0.0.1\0" - 7406 " \0" -29900 " .\0" -29901 " MPRAPI.DLL system32.\0" + 7406 "Ви не маєте достатніх прав на настройку вхідних підключень\0" +29900 "Неможливо завантажити службу диспетчера підключень віддаленого доступу.\0" +29901 "Не вдалося завантажити файл MPRAPI.DLL з папки system32.\0" END diff --git a/dll/win32/rasdlg/rasdlg.rc b/dll/win32/rasdlg/rasdlg.rc index 1af7f8e15b9..e01737eaaaa 100644 --- a/dll/win32/rasdlg/rasdlg.rc +++ b/dll/win32/rasdlg/rasdlg.rc @@ -37,6 +37,9 @@ #include "lang/de-DE.rc" #include "lang/en-US.rc" #include "lang/no-NO.rc" + +// UTF-8 +#pragma code_page(65001) #include "lang/pl-PL.rc" #include "lang/ru-RU.rc" #include "lang/uk-UA.rc" diff --git a/dll/win32/riched20/CMakeLists.txt b/dll/win32/riched20/CMakeLists.txt index 60362843d05..b73767d15c7 100644 --- a/dll/win32/riched20/CMakeLists.txt +++ b/dll/win32/riched20/CMakeLists.txt @@ -1,11 +1,9 @@ -add_definitions( - -D__WINESRC__ - -D_DLL -D__USE_CRTIMP) - +add_definitions(-D__WINESRC__) include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine) spec2def(riched20.dll riched20.spec) + set_rc_compiler() list(APPEND SOURCE @@ -50,6 +48,6 @@ add_importlibs(riched20 kernel32 ntdll) +add_pch(riched20 editor.h) add_importlib_target(riched20.spec) - add_cd_file(TARGET riched20 DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/riched20/riched20.rbuild b/dll/win32/riched20/riched20.rbuild index b176049bb8a..f5869ae868e 100644 --- a/dll/win32/riched20/riched20.rbuild +++ b/dll/win32/riched20/riched20.rbuild @@ -28,6 +28,7 @@ wrap.c writer.c version.rc + editor.h wine uuid ole32 diff --git a/dll/win32/rpcrt4/CMakeLists.txt b/dll/win32/rpcrt4/CMakeLists.txt index e54607353f2..e9c1175fd44 100644 --- a/dll/win32/rpcrt4/CMakeLists.txt +++ b/dll/win32/rpcrt4/CMakeLists.txt @@ -1,4 +1,6 @@ +add_rpc_files(client epm.idl) + list(APPEND SOURCE cproxy.c cpsf.c @@ -20,9 +22,14 @@ list(APPEND SOURCE rpc_server.c rpc_transport.c unix_func.c + ${CMAKE_CURRENT_BINARY_DIR}/epm_c.c ${CMAKE_CURRENT_BINARY_DIR}/rpcrt4_stubs.c ${CMAKE_CURRENT_BINARY_DIR}/rpcrt4.def) +if(MSVC) + list(APPEND SOURCE msvc.S) +endif() + remove_definitions(-D_WIN32_WINNT=0x502) add_definitions(-D_WIN32_WINNT=0x600) @@ -31,23 +38,21 @@ add_definitions( -DCOM_NO_WINDOWS_H -DMSWMSG) +include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine) + spec2def(rpcrt4.dll rpcrt4.spec) add_library(rpcrt4 SHARED ${SOURCE}) set_module_type(rpcrt4 win32dll) -include_directories( - ${REACTOS_SOURCE_DIR}/include/reactos/wine - ${REACTOS_BINARY_DIR}/include/reactos/wine) - target_link_libraries(rpcrt4 wine uuid - epmrpc ${PSEH_LIB}) add_importlibs(rpcrt4 msvcrt user32 advapi32 secur32 iphlpapi ws2_32 kernel32 ntdll) -add_dependencies(rpcrt4 winesdk) +add_delay_importlibs(rpcrt4 wininet) + add_cd_file(TARGET rpcrt4 DESTINATION reactos/system32 FOR all) add_importlib_target(rpcrt4.spec) diff --git a/dll/win32/rpcrt4/cproxy.c b/dll/win32/rpcrt4/cproxy.c index 176204667ad..b1acbb0c5dd 100644 --- a/dll/win32/rpcrt4/cproxy.c +++ b/dll/win32/rpcrt4/cproxy.c @@ -17,7 +17,7 @@ * 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 - * + * * TODO: Handle non-i386 architectures */ @@ -37,6 +37,7 @@ #include "cpsf.h" #include "ndr_misc.h" +#include "ndr_stubless.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(ole); @@ -44,7 +45,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(ole); /* I don't know what MS's std proxy structure looks like, so this probably doesn't match, but that shouldn't matter */ typedef struct { - const IRpcProxyBufferVtbl *lpVtbl; + IRpcProxyBuffer IRpcProxyBuffer_iface; LPVOID *PVtbl; LONG RefCount; const IID* piid; @@ -58,47 +59,130 @@ typedef struct { static const IRpcProxyBufferVtbl StdProxy_Vtbl; -#define ICOM_THIS_MULTI(impl,field,iface) impl* const This=(impl*)((char*)(iface) - offsetof(impl,field)) +static inline StdProxyImpl *impl_from_IRpcProxyBuffer(IRpcProxyBuffer *iface) +{ + return CONTAINING_RECORD(iface, StdProxyImpl, IRpcProxyBuffer_iface); +} -#if defined(__i386__) +static inline StdProxyImpl *impl_from_proxy_obj( void *iface ) +{ + return CONTAINING_RECORD(iface, StdProxyImpl, PVtbl); +} -#include "pshpack1.h" - -struct thunk { - BYTE push; - DWORD index; - BYTE jmp; - LONG handler; -}; - -#include "poppack.h" +#ifdef __i386__ extern void call_stubless_func(void); __ASM_GLOBAL_FUNC(call_stubless_func, - "pushl %esp\n\t" /* pointer to index */ + "movl 4(%esp),%ecx\n\t" /* This pointer */ + "movl (%ecx),%ecx\n\t" /* This->lpVtbl */ + "movl -8(%ecx),%ecx\n\t" /* MIDL_STUBLESS_PROXY_INFO */ + "movl 8(%ecx),%edx\n\t" /* info->FormatStringOffset */ + "movzwl (%edx,%eax,2),%edx\n\t" /* FormatStringOffset[index] */ + "addl 4(%ecx),%edx\n\t" /* info->ProcFormatString + offset */ + "movzwl 8(%edx),%eax\n\t" /* arguments size */ + "pushl %eax\n\t" __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t") - "call " __ASM_NAME("ObjectStubless") __ASM_STDCALL(4) "\n\t" - "popl %edx\n\t" /* args size */ + "leal 8(%esp),%eax\n\t" /* &This */ + "pushl %eax\n\t" + __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t") + "pushl %edx\n\t" /* format string */ + __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t") + "pushl (%ecx)\n\t" /* info->pStubDesc */ + __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t") + "call " __ASM_NAME("ndr_client_call") "\n\t" + "leal 12(%esp),%esp\n\t" + __ASM_CFI(".cfi_adjust_cfa_offset -12\n\t") + "popl %edx\n\t" /* arguments size */ __ASM_CFI(".cfi_adjust_cfa_offset -4\n\t") "movl (%esp),%ecx\n\t" /* return address */ "addl %edx,%esp\n\t" "jmp *%ecx" ); -HRESULT WINAPI ObjectStubless(DWORD *args) +#include "pshpack1.h" +struct thunk { - DWORD index = args[0]; - void **iface = (void **)args[2]; - const void **vtbl = (const void **)*iface; - const MIDL_STUBLESS_PROXY_INFO *stubless = *(const MIDL_STUBLESS_PROXY_INFO **)(vtbl - 2); - const PFORMAT_STRING fs = stubless->ProcFormatString + stubless->FormatStringOffset[index]; + BYTE mov_eax; + DWORD index; + BYTE jmp; + LONG handler; +}; +#include "poppack.h" - /* store bytes to remove from stack */ - args[0] = *(const WORD*)(fs + 8); - TRACE("(%p)->(%d)([%d bytes]) ret=%08x\n", iface, index, args[0], args[1]); - - return NdrClientCall2(stubless->pStubDesc, fs, args + 2).Simple; +static inline void init_thunk( struct thunk *thunk, unsigned int index ) +{ + thunk->mov_eax = 0xb8; /* movl $n,%eax */ + thunk->index = index; + thunk->jmp = 0xe9; /* jmp */ + thunk->handler = (char *)call_stubless_func - (char *)(&thunk->handler + 1); } +#elif defined(__x86_64__) + +extern void call_stubless_func(void); +__ASM_GLOBAL_FUNC(call_stubless_func, + "movq %rcx,0x8(%rsp)\n\t" + "movq %rdx,0x10(%rsp)\n\t" + "movq %r8,0x18(%rsp)\n\t" + "movq %r9,0x20(%rsp)\n\t" + "leaq 0x8(%rsp),%r8\n\t" /* &This */ + "movq (%rcx),%rcx\n\t" /* This->lpVtbl */ + "movq -0x10(%rcx),%rcx\n\t" /* MIDL_STUBLESS_PROXY_INFO */ + "movq 0x10(%rcx),%rdx\n\t" /* info->FormatStringOffset */ + "movzwq (%rdx,%r10,2),%rdx\n\t" /* FormatStringOffset[index] */ + "addq 8(%rcx),%rdx\n\t" /* info->ProcFormatString + offset */ + "movq (%rcx),%rcx\n\t" /* info->pStubDesc */ + "subq $0x38,%rsp\n\t" + __ASM_CFI(".cfi_adjust_cfa_offset 0x38\n\t") + "movq %xmm1,0x20(%rsp)\n\t" + "movq %xmm2,0x28(%rsp)\n\t" + "movq %xmm3,0x30(%rsp)\n\t" + "leaq 0x18(%rsp),%r9\n\t" /* fpu_args */ + "call " __ASM_NAME("ndr_client_call") "\n\t" + "addq $0x38,%rsp\n\t" + __ASM_CFI(".cfi_adjust_cfa_offset -0x38\n\t") + "ret" ); + +#include "pshpack1.h" +struct thunk +{ + BYTE mov_r10[3]; + DWORD index; + BYTE mov_rax[2]; + void *call_stubless; + BYTE jmp_rax[2]; +}; +#include "poppack.h" + +static const struct thunk thunk_template = +{ + { 0x49, 0xc7, 0xc2 }, 0, /* movq $index,%r10 */ + { 0x48, 0xb8 }, 0, /* movq $call_stubless_func,%rax */ + { 0xff, 0xe0 } /* jmp *%rax */ +}; + +static inline void init_thunk( struct thunk *thunk, unsigned int index ) +{ + *thunk = thunk_template; + thunk->index = index; + thunk->call_stubless = call_stubless_func; +} + +#else /* __i386__ */ + +#warning You must implement stubless proxies for your CPU + +struct thunk +{ + DWORD index; +}; + +static inline void init_thunk( struct thunk *thunk, unsigned int index ) +{ + thunk->index = index; +} + +#endif /* __i386__ */ + #define BLOCK_SIZE 1024 #define MAX_BLOCKS 64 /* 64k methods should be enough for anybody */ @@ -113,13 +197,7 @@ static const struct thunk *allocate_block( unsigned int num ) MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE ); if (!block) return NULL; - for (i = 0; i < BLOCK_SIZE; i++) - { - block[i].push = 0x68; /* pushl */ - block[i].index = BLOCK_SIZE * num + i + 3; - block[i].jmp = 0xe9; /* jmp */ - block[i].handler = (char *)call_stubless_func - (char *)(&block[i].handler + 1); - } + for (i = 0; i < BLOCK_SIZE; i++) init_thunk( &block[i], BLOCK_SIZE * num + i + 3 ); VirtualProtect( block, BLOCK_SIZE * sizeof(*block), PAGE_EXECUTE_READ, NULL ); prev = InterlockedCompareExchangePointer( (void **)&method_blocks[num], block, NULL ); if (prev) /* someone beat us to it */ @@ -150,16 +228,6 @@ static BOOL fill_stubless_table( IUnknownVtbl *vtbl, DWORD num ) return TRUE; } -#else /* __i386__ */ - -static BOOL fill_stubless_table( IUnknownVtbl *vtbl, DWORD num ) -{ - ERR("stubless proxies are not supported on this architecture\n"); - return FALSE; -} - -#endif /* __i386__ */ - HRESULT StdProxy_Construct(REFIID riid, LPUNKNOWN pUnkOuter, const ProxyFileInfo *ProxyInfo, @@ -191,7 +259,7 @@ HRESULT StdProxy_Construct(REFIID riid, if (!This) return E_OUTOFMEMORY; if (!pUnkOuter) pUnkOuter = (IUnknown *)This; - This->lpVtbl = &StdProxy_Vtbl; + This->IRpcProxyBuffer_iface.lpVtbl = &StdProxy_Vtbl; This->PVtbl = vtbl->Vtbl; /* one reference for the proxy */ This->RefCount = 1; @@ -214,7 +282,7 @@ HRESULT StdProxy_Construct(REFIID riid, } } - *ppProxy = (LPRPCPROXYBUFFER)&This->lpVtbl; + *ppProxy = &This->IRpcProxyBuffer_iface; *ppvObj = &This->PVtbl; IUnknown_AddRef((IUnknown *)*ppvObj); IPSFactoryBuffer_AddRef(pPSFactory); @@ -224,25 +292,11 @@ HRESULT StdProxy_Construct(REFIID riid, return S_OK; } -static void StdProxy_Destruct(LPRPCPROXYBUFFER iface) -{ - ICOM_THIS_MULTI(StdProxyImpl,lpVtbl,iface); - - if (This->pChannel) - IRpcProxyBuffer_Disconnect(iface); - - if (This->base_object) IUnknown_Release( This->base_object ); - if (This->base_proxy) IRpcProxyBuffer_Release( This->base_proxy ); - - IPSFactoryBuffer_Release(This->pPSFactory); - HeapFree(GetProcessHeap(),0,This); -} - static HRESULT WINAPI StdProxy_QueryInterface(LPRPCPROXYBUFFER iface, REFIID riid, LPVOID *obj) { - ICOM_THIS_MULTI(StdProxyImpl,lpVtbl,iface); + StdProxyImpl *This = impl_from_IRpcProxyBuffer(iface); TRACE("(%p)->QueryInterface(%s,%p)\n",This,debugstr_guid(riid),obj); if (IsEqualGUID(&IID_IUnknown,riid) || @@ -253,7 +307,7 @@ static HRESULT WINAPI StdProxy_QueryInterface(LPRPCPROXYBUFFER iface, } if (IsEqualGUID(&IID_IRpcProxyBuffer,riid)) { - *obj = &This->lpVtbl; + *obj = &This->IRpcProxyBuffer_iface; InterlockedIncrement(&This->RefCount); return S_OK; } @@ -263,7 +317,7 @@ static HRESULT WINAPI StdProxy_QueryInterface(LPRPCPROXYBUFFER iface, static ULONG WINAPI StdProxy_AddRef(LPRPCPROXYBUFFER iface) { - ICOM_THIS_MULTI(StdProxyImpl,lpVtbl,iface); + StdProxyImpl *This = impl_from_IRpcProxyBuffer(iface); TRACE("(%p)->AddRef()\n",This); return InterlockedIncrement(&This->RefCount); @@ -272,19 +326,29 @@ static ULONG WINAPI StdProxy_AddRef(LPRPCPROXYBUFFER iface) static ULONG WINAPI StdProxy_Release(LPRPCPROXYBUFFER iface) { ULONG refs; - ICOM_THIS_MULTI(StdProxyImpl,lpVtbl,iface); + StdProxyImpl *This = impl_from_IRpcProxyBuffer(iface); TRACE("(%p)->Release()\n",This); refs = InterlockedDecrement(&This->RefCount); if (!refs) - StdProxy_Destruct((LPRPCPROXYBUFFER)&This->lpVtbl); + { + if (This->pChannel) + IRpcProxyBuffer_Disconnect(&This->IRpcProxyBuffer_iface); + + if (This->base_object) IUnknown_Release( This->base_object ); + if (This->base_proxy) IRpcProxyBuffer_Release( This->base_proxy ); + + IPSFactoryBuffer_Release(This->pPSFactory); + HeapFree(GetProcessHeap(),0,This); + } + return refs; } static HRESULT WINAPI StdProxy_Connect(LPRPCPROXYBUFFER iface, LPRPCCHANNELBUFFER pChannel) { - ICOM_THIS_MULTI(StdProxyImpl,lpVtbl,iface); + StdProxyImpl *This = impl_from_IRpcProxyBuffer(iface); TRACE("(%p)->Connect(%p)\n",This,pChannel); This->pChannel = pChannel; @@ -295,7 +359,7 @@ static HRESULT WINAPI StdProxy_Connect(LPRPCPROXYBUFFER iface, static VOID WINAPI StdProxy_Disconnect(LPRPCPROXYBUFFER iface) { - ICOM_THIS_MULTI(StdProxyImpl,lpVtbl,iface); + StdProxyImpl *This = impl_from_IRpcProxyBuffer(iface); TRACE("(%p)->Disconnect()\n",This); if (This->base_proxy) IRpcProxyBuffer_Disconnect( This->base_proxy ); @@ -316,7 +380,7 @@ static const IRpcProxyBufferVtbl StdProxy_Vtbl = static void StdProxy_GetChannel(LPVOID iface, LPRPCCHANNELBUFFER *ppChannel) { - ICOM_THIS_MULTI(StdProxyImpl,PVtbl,iface); + StdProxyImpl *This = impl_from_proxy_obj( iface ); TRACE("(%p)->GetChannel(%p) %s\n",This,ppChannel,This->name); *ppChannel = This->pChannel; @@ -325,7 +389,7 @@ static void StdProxy_GetChannel(LPVOID iface, static void StdProxy_GetIID(LPVOID iface, const IID **ppiid) { - ICOM_THIS_MULTI(StdProxyImpl,PVtbl,iface); + StdProxyImpl *This = impl_from_proxy_obj( iface ); TRACE("(%p)->GetIID(%p) %s\n",This,ppiid,This->name); *ppiid = This->piid; @@ -335,21 +399,21 @@ HRESULT WINAPI IUnknown_QueryInterface_Proxy(LPUNKNOWN iface, REFIID riid, LPVOID *ppvObj) { - ICOM_THIS_MULTI(StdProxyImpl,PVtbl,iface); + StdProxyImpl *This = impl_from_proxy_obj( iface ); TRACE("(%p)->QueryInterface(%s,%p) %s\n",This,debugstr_guid(riid),ppvObj,This->name); return IUnknown_QueryInterface(This->pUnkOuter,riid,ppvObj); } ULONG WINAPI IUnknown_AddRef_Proxy(LPUNKNOWN iface) { - ICOM_THIS_MULTI(StdProxyImpl,PVtbl,iface); + StdProxyImpl *This = impl_from_proxy_obj( iface ); TRACE("(%p)->AddRef() %s\n",This,This->name); return IUnknown_AddRef(This->pUnkOuter); } ULONG WINAPI IUnknown_Release_Proxy(LPUNKNOWN iface) { - ICOM_THIS_MULTI(StdProxyImpl,PVtbl,iface); + StdProxyImpl *This = impl_from_proxy_obj( iface ); TRACE("(%p)->Release() %s\n",This,This->name); return IUnknown_Release(This->pUnkOuter); } @@ -483,3 +547,24 @@ CreateProxyFromTypeInfo( LPTYPEINFO pTypeInfo, LPUNKNOWN pUnkOuter, REFIID riid, } return E_NOTIMPL; } + +HRESULT WINAPI +CreateStubFromTypeInfo(ITypeInfo *pTypeInfo, REFIID riid, IUnknown *pUnkServer, + IRpcStubBuffer **ppStub ) +{ + typedef INT (WINAPI *MessageBoxA)(HWND,LPCSTR,LPCSTR,UINT); + HMODULE hUser32 = LoadLibraryA("user32"); + MessageBoxA pMessageBoxA = (void *)GetProcAddress(hUser32, "MessageBoxA"); + + FIXME("%p %s %p %p\n", pTypeInfo, debugstr_guid(riid), pUnkServer, ppStub); + if (pMessageBoxA) + { + pMessageBoxA(NULL, + "The native implementation of OLEAUT32.DLL cannot be used " + "with Wine's RPCRT4.DLL. Remove OLEAUT32.DLL and try again.\n", + "Wine: Unimplemented CreateProxyFromTypeInfo", + 0x10); + ExitProcess(1); + } + return E_NOTIMPL; +} diff --git a/dll/win32/rpcrt4/cpsf.c b/dll/win32/rpcrt4/cpsf.c index d2efa012581..bf04bb85de3 100644 --- a/dll/win32/rpcrt4/cpsf.c +++ b/dll/win32/rpcrt4/cpsf.c @@ -242,7 +242,7 @@ HRESULT WINAPI NdrDllRegisterProxy(HMODULE hDll, TRACE("(%p,%p,%s)\n", hDll, pProxyFileList, debugstr_guid(pclsid)); //if (!hDll) return E_HANDLE; - if (!pProxyFileList || !*pProxyFileList) return E_NOINTERFACE; + if (!*pProxyFileList) return E_NOINTERFACE; if (pclsid) format_clsid( clsid, pclsid ); diff --git a/dll/win32/rpcrt4/cpsf.h b/dll/win32/rpcrt4/cpsf.h index 9cc046ff7ca..964fb4551fe 100644 --- a/dll/win32/rpcrt4/cpsf.h +++ b/dll/win32/rpcrt4/cpsf.h @@ -23,23 +23,23 @@ HRESULT StdProxy_Construct(REFIID riid, LPUNKNOWN pUnkOuter, const ProxyFileInfo *ProxyInfo, int Index, LPPSFACTORYBUFFER pPSFactory, LPRPCPROXYBUFFER *ppProxy, - LPVOID *ppvObj); + LPVOID *ppvObj) DECLSPEC_HIDDEN; HRESULT CStdStubBuffer_Construct(REFIID riid, LPUNKNOWN pUnkServer, PCInterfaceName name, CInterfaceStubVtbl *vtbl, LPPSFACTORYBUFFER pPSFactory, - LPRPCSTUBBUFFER *ppStub); + LPRPCSTUBBUFFER *ppStub) DECLSPEC_HIDDEN; HRESULT CStdStubBuffer_Delegating_Construct(REFIID riid, LPUNKNOWN pUnkServer, PCInterfaceName name, CInterfaceStubVtbl *vtbl, REFIID delegating_iid, - LPPSFACTORYBUFFER pPSFactory, LPRPCSTUBBUFFER *ppStub); + LPPSFACTORYBUFFER pPSFactory, LPRPCSTUBBUFFER *ppStub) DECLSPEC_HIDDEN; -const MIDL_SERVER_INFO *CStdStubBuffer_GetServerInfo(IRpcStubBuffer *iface); +const MIDL_SERVER_INFO *CStdStubBuffer_GetServerInfo(IRpcStubBuffer *iface) DECLSPEC_HIDDEN; -const IRpcStubBufferVtbl CStdStubBuffer_Vtbl; -const IRpcStubBufferVtbl CStdStubBuffer_Delegating_Vtbl; +extern const IRpcStubBufferVtbl CStdStubBuffer_Vtbl DECLSPEC_HIDDEN; +extern const IRpcStubBufferVtbl CStdStubBuffer_Delegating_Vtbl DECLSPEC_HIDDEN; -BOOL fill_delegated_proxy_table(IUnknownVtbl *vtbl, DWORD num); -HRESULT create_proxy(REFIID iid, IUnknown *pUnkOuter, IRpcProxyBuffer **pproxy, void **ppv); -HRESULT create_stub(REFIID iid, IUnknown *pUnk, IRpcStubBuffer **ppstub); +BOOL fill_delegated_proxy_table(IUnknownVtbl *vtbl, DWORD num) DECLSPEC_HIDDEN; +HRESULT create_proxy(REFIID iid, IUnknown *pUnkOuter, IRpcProxyBuffer **pproxy, void **ppv) DECLSPEC_HIDDEN; +HRESULT create_stub(REFIID iid, IUnknown *pUnk, IRpcStubBuffer **ppstub) DECLSPEC_HIDDEN; #endif /* __WINE_CPSF_H */ diff --git a/dll/win32/rpcrt4/cstub.c b/dll/win32/rpcrt4/cstub.c index 95ac1d89af2..74801f69b70 100644 --- a/dll/win32/rpcrt4/cstub.c +++ b/dll/win32/rpcrt4/cstub.c @@ -137,27 +137,54 @@ static ULONG WINAPI delegating_Release(IUnknown *pUnk) return 1; } -#if defined(__i386__) - /* The idea here is to replace the first param on the stack ie. This (which will point to cstdstubbuffer_delegating_t) with This->stub_buffer.pvServerObject and then jump to the relevant offset in This->stub_buffer.pvServerObject's vtbl. */ +#ifdef __i386__ + #include "pshpack1.h" typedef struct { - DWORD mov1; /* mov 0x4(%esp), %eax 8b 44 24 04 */ - WORD mov2; /* mov 0x10(%eax), %eax 8b 40 */ - BYTE sixteen; /* 10 */ - DWORD mov3; /* mov %eax, 0x4(%esp) 89 44 24 04 */ - WORD mov4; /* mov (%eax), %eax 8b 00 */ - WORD mov5; /* mov offset(%eax), %eax 8b 80 */ - DWORD offset; /* xx xx xx xx */ - WORD jmp; /* jmp *%eax ff e0 */ - BYTE pad[3]; /* lea 0x0(%esi), %esi 8d 76 00 */ + BYTE mov1[4]; /* mov 0x4(%esp),%eax 8b 44 24 04 */ + BYTE mov2[3]; /* mov 0x10(%eax),%eax 8b 40 10 */ + BYTE mov3[4]; /* mov %eax,0x4(%esp) 89 44 24 04 */ + BYTE mov4[2]; /* mov (%eax),%eax 8b 00 */ + BYTE mov5[2]; /* jmp *offset(%eax) ff a0 offset */ + DWORD offset; + BYTE pad[1]; /* nop 90 */ } vtbl_method_t; #include "poppack.h" +static const BYTE opcodes[20] = { 0x8b, 0x44, 0x24, 0x04, 0x8b, 0x40, 0x10, 0x89, 0x44, 0x24, 0x04, + 0x8b, 0x00, 0xff, 0xa0, 0, 0, 0, 0, 0x90 }; + +#elif defined(__x86_64__) + +#include "pshpack1.h" +typedef struct +{ + BYTE mov1[4]; /* movq 0x20(%rcx),%rcx 48 8b 49 20 */ + BYTE mov2[3]; /* movq (%rcx),%rax 48 8b 01 */ + BYTE jmp[2]; /* jmp *offset(%rax) ff a0 offset */ + DWORD offset; + BYTE pad[3]; /* lea 0x0(%rsi),%rsi 48 8d 36 */ +} vtbl_method_t; +#include "poppack.h" + +static const BYTE opcodes[16] = { 0x48, 0x8b, 0x49, 0x20, 0x48, 0x8b, 0x01, + 0xff, 0xa0, 0, 0, 0, 0, 0x48, 0x8d, 0x36 }; +#else + +#warning You must implement delegated proxies/stubs for your CPU +typedef struct +{ + DWORD offset; +} vtbl_method_t; +static const BYTE opcodes[1]; + +#endif + #define BLOCK_SIZE 1024 #define MAX_BLOCKS 64 /* 64k methods should be enough for anybody */ @@ -174,17 +201,8 @@ static const vtbl_method_t *allocate_block( unsigned int num ) for (i = 0; i < BLOCK_SIZE; i++) { - block[i].mov1 = 0x0424448b; - block[i].mov2 = 0x408b; - block[i].sixteen = 0x10; - block[i].mov3 = 0x04244489; - block[i].mov4 = 0x008b; - block[i].mov5 = 0x808b; - block[i].offset = (BLOCK_SIZE * num + i + 3) << 2; - block[i].jmp = 0xe0ff; - block[i].pad[0] = 0x8d; - block[i].pad[1] = 0x76; - block[i].pad[2] = 0x00; + memcpy( &block[i], opcodes, sizeof(opcodes) ); + block[i].offset = (BLOCK_SIZE * num + i + 3) * sizeof(void *); } VirtualProtect( block, BLOCK_SIZE * sizeof(*block), PAGE_EXECUTE_READ, NULL ); prev = InterlockedCompareExchangePointer( (void **)&method_blocks[num], block, NULL ); @@ -241,22 +259,6 @@ BOOL fill_delegated_proxy_table(IUnknownVtbl *vtbl, DWORD num) return TRUE; } -#else /* __i386__ */ - -static BOOL fill_delegated_stub_table(IUnknownVtbl *vtbl, DWORD num) -{ - ERR("delegated stubs are not supported on this architecture\n"); - return FALSE; -} - -BOOL fill_delegated_proxy_table(IUnknownVtbl *vtbl, DWORD num) -{ - ERR("delegated proxies are not supported on this architecture\n"); - return FALSE; -} - -#endif /* __i386__ */ - static IUnknownVtbl *get_delegating_vtbl(DWORD num_methods) { IUnknownVtbl *ret; diff --git a/dll/win32/rpcrt4/msvc.S b/dll/win32/rpcrt4/msvc.S new file mode 100644 index 00000000000..81a589b5e7f --- /dev/null +++ b/dll/win32/rpcrt4/msvc.S @@ -0,0 +1,32 @@ + +#include + +.code32 + +EXTERN _ndr_client_call:PROC + +PUBLIC _call_stubless_func +_call_stubless_func: + + mov ecx,[esp+4] /* This Pointer */ + mov ecx,[ecx] /* This->lpVtbl */ + mov ecx,[ecx-8] /* MIDL_STUBLESS_PROXY_INFO */ + mov edx,[ecx+8] /* Info->FormatStringOffset */ + mov edx,[edx+eax*2] /* FormatStringOffset[index] */ + and edx, 0000FFFFh + add edx,[ecx+4] /* info->ProcFormatString + offset */ + mov eax, [edx+8] /* arguments size */ + and eax, 0000FFFFh + push eax + lea eax, [esp+8] /* &This */ + push eax + push edx /* format string */ + push [ecx] /* info->pstubdesc */ + call _ndr_client_call + lea esp, [esp+12] + pop edx /* arguments size */ + mov ecx, [esp] /* return address */ + add esp, edx + jmp ecx + +END \ No newline at end of file diff --git a/dll/win32/rpcrt4/ndr_es.c b/dll/win32/rpcrt4/ndr_es.c index 52200dc3e3e..cd0967ddea9 100644 --- a/dll/win32/rpcrt4/ndr_es.c +++ b/dll/win32/rpcrt4/ndr_es.c @@ -329,9 +329,10 @@ void WINAPIV NdrMesProcEncodeDecode(handle_t Handle, const MIDL_STUB_DESC * pStu unsigned short stack_size; /* header for procedure string */ const NDR_PROC_HEADER *pProcHeader = (const NDR_PROC_HEADER *)&pFormat[0]; - /* the value to return to the client from the remote procedure */ - LONG_PTR RetVal = 0; const RPC_CLIENT_INTERFACE *client_interface; + __ms_va_list args; + unsigned int number_of_params; + ULONG_PTR arg_buffer[256]; TRACE("Handle %p, pStubDesc %p, pFormat %p, ...\n", Handle, pStubDesc, pFormat); @@ -396,29 +397,26 @@ void WINAPIV NdrMesProcEncodeDecode(handle_t Handle, const MIDL_STUB_DESC * pStu TRACE("MIDL stub version = 0x%x\n", pStubDesc->MIDLVersion); /* needed for conformance of top-level objects */ -#ifdef __i386__ - pEsMsg->StubMsg.StackTop = *(unsigned char **)(&pFormat+1); -#else -# warning Stack not retrieved for your CPU architecture -#endif + __ms_va_start( args, pFormat ); + pEsMsg->StubMsg.StackTop = va_arg( args, unsigned char * ); + __ms_va_end( args ); + + pFormat = convert_old_args( &pEsMsg->StubMsg, pFormat, stack_size, FALSE, + arg_buffer, sizeof(arg_buffer), &number_of_params ); switch (pEsMsg->Operation) { case MES_ENCODE: pEsMsg->StubMsg.BufferLength = mes_proc_header_buffer_size(); - client_do_args_old_format(&pEsMsg->StubMsg, pFormat, PROXY_CALCSIZE, - pEsMsg->StubMsg.StackTop, stack_size, (unsigned char *)&RetVal, - FALSE /* object_proc */, TRUE /* ignore_retval */); + client_do_args( &pEsMsg->StubMsg, pFormat, STUBLESS_CALCSIZE, NULL, number_of_params, NULL ); pEsMsg->ByteCount = pEsMsg->StubMsg.BufferLength - mes_proc_header_buffer_size(); es_data_alloc(pEsMsg, pEsMsg->StubMsg.BufferLength); mes_proc_header_marshal(pEsMsg); - client_do_args_old_format(&pEsMsg->StubMsg, pFormat, PROXY_MARSHAL, - pEsMsg->StubMsg.StackTop, stack_size, (unsigned char *)&RetVal, - FALSE /* object_proc */, TRUE /* ignore_retval */); + client_do_args( &pEsMsg->StubMsg, pFormat, STUBLESS_MARSHAL, NULL, number_of_params, NULL ); es_data_write(pEsMsg, pEsMsg->ByteCount); break; @@ -427,9 +425,7 @@ void WINAPIV NdrMesProcEncodeDecode(handle_t Handle, const MIDL_STUB_DESC * pStu es_data_read(pEsMsg, pEsMsg->ByteCount); - client_do_args_old_format(&pEsMsg->StubMsg, pFormat, PROXY_UNMARSHAL, - pEsMsg->StubMsg.StackTop, stack_size, (unsigned char *)&RetVal, - FALSE /* object_proc */, TRUE /* ignore_retval */); + client_do_args( &pEsMsg->StubMsg, pFormat, STUBLESS_UNMARSHAL, NULL, number_of_params, NULL ); break; default: RpcRaiseException(RPC_S_INTERNAL_ERROR); @@ -446,6 +442,12 @@ void RPC_ENTRY NdrMesTypeDecode2(handle_t Handle, const MIDL_TYPE_PICKLING_INFO FIXME("(%p, %p, %p, %p, %p)\n", Handle, pPicklingInfo, pStubDesc, pFormatString, pObject); } +void RPC_ENTRY NdrMesTypeEncode2(handle_t Handle, const MIDL_TYPE_PICKLING_INFO *pPicklingInfo, + const MIDL_STUB_DESC *pStubDesc, PFORMAT_STRING pFormatString, const void *pObject) +{ + FIXME("(%p, %p, %p, %p, %p)\n", Handle, pPicklingInfo, pStubDesc, pFormatString, pObject); +} + void RPC_ENTRY NdrMesTypeFree2(handle_t Handle, const MIDL_TYPE_PICKLING_INFO *pPicklingInfo, const MIDL_STUB_DESC *pStubDesc, PFORMAT_STRING pFormatString, void *pObject) { diff --git a/dll/win32/rpcrt4/ndr_marshall.c b/dll/win32/rpcrt4/ndr_marshall.c index 839a4cad882..f0482e62dd3 100644 --- a/dll/win32/rpcrt4/ndr_marshall.c +++ b/dll/win32/rpcrt4/ndr_marshall.c @@ -27,6 +27,7 @@ * - Checks for integer addition overflow in user marshall functions */ +#include #include #include #include @@ -91,17 +92,23 @@ WINE_DEFAULT_DEBUG_CHANNEL(ole); LITTLE_ENDIAN_UINT32_READ(pchar) #endif -/* _Align must be the desired alignment, - * e.g. ALIGN_LENGTH(len, 4) to align on a dword boundary. */ -#define ALIGNED_LENGTH(_Len, _Align) (((_Len)+(_Align)-1)&~((_Align)-1)) -#define ALIGNED_POINTER(_Ptr, _Align) ((LPVOID)ALIGNED_LENGTH((ULONG_PTR)(_Ptr), _Align)) -#define ALIGN_LENGTH(_Len, _Align) _Len = ALIGNED_LENGTH(_Len, _Align) -#define ALIGN_POINTER(_Ptr, _Align) _Ptr = ALIGNED_POINTER(_Ptr, _Align) -#define ALIGN_POINTER_CLEAR(_Ptr, _Align) \ - do { \ - memset((_Ptr), 0, ((_Align) - (ULONG_PTR)(_Ptr)) & ((_Align) - 1)); \ - ALIGN_POINTER(_Ptr, _Align); \ - } while(0) +static inline void align_length( ULONG *len, unsigned int align ) +{ + *len = (*len + align - 1) & ~(align - 1); +} + +static inline void align_pointer( unsigned char **ptr, unsigned int align ) +{ + ULONG_PTR mask = align - 1; + *ptr = (unsigned char *)(((ULONG_PTR)*ptr + mask) & ~mask); +} + +static inline void align_pointer_clear( unsigned char **ptr, unsigned int align ) +{ + ULONG_PTR mask = align - 1; + memset( *ptr, 0, (align - (ULONG_PTR)*ptr) & mask ); + *ptr = (unsigned char *)(((ULONG_PTR)*ptr + mask) & ~mask); +} #define STD_OVERFLOW_CHECK(_Msg) do { \ TRACE("buffer=%d/%d\n", (ULONG)(_Msg->Buffer - (unsigned char *)_Msg->RpcMsg->Buffer), _Msg->BufferLength); \ @@ -133,6 +140,27 @@ static void WINAPI NdrRangeFree(PMIDL_STUB_MESSAGE, unsigned char *, PFORMAT_STR static ULONG WINAPI NdrByteCountPointerMemorySize(PMIDL_STUB_MESSAGE, PFORMAT_STRING); +static unsigned char * ComplexBufferSize(PMIDL_STUB_MESSAGE pStubMsg, + unsigned char *pMemory, + PFORMAT_STRING pFormat, + PFORMAT_STRING pPointer); +static unsigned char * ComplexMarshall(PMIDL_STUB_MESSAGE pStubMsg, + unsigned char *pMemory, + PFORMAT_STRING pFormat, + PFORMAT_STRING pPointer); +static unsigned char * ComplexUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, + unsigned char *pMemory, + PFORMAT_STRING pFormat, + PFORMAT_STRING pPointer, + unsigned char fMustAlloc); +static ULONG ComplexStructMemorySize(PMIDL_STUB_MESSAGE pStubMsg, + PFORMAT_STRING pFormat, + PFORMAT_STRING pPointer); +static unsigned char * ComplexFree(PMIDL_STUB_MESSAGE pStubMsg, + unsigned char *pMemory, + PFORMAT_STRING pFormat, + PFORMAT_STRING pPointer); + const NDR_MARSHALL NdrMarshaller[NDR_TABLE_SIZE] = { 0, NdrBaseTypeMarshall, NdrBaseTypeMarshall, NdrBaseTypeMarshall, @@ -377,7 +405,7 @@ void * WINAPI NdrAllocate(MIDL_STUB_MESSAGE *pStubMsg, SIZE_T len) void *p; NDR_MEMORY_LIST *mem_list; - aligned_len = ALIGNED_LENGTH(len, 8); + aligned_len = (len + 7) & ~7; adjusted_len = aligned_len + sizeof(NDR_MEMORY_LIST); /* check for overflow */ if (adjusted_len < len) @@ -414,7 +442,7 @@ static inline BOOL IsConformanceOrVariancePresent(PFORMAT_STRING pFormat) static PFORMAT_STRING ReadConformance(MIDL_STUB_MESSAGE *pStubMsg, PFORMAT_STRING pFormat) { - ALIGN_POINTER(pStubMsg->Buffer, 4); + align_pointer(&pStubMsg->Buffer, 4); if (pStubMsg->Buffer + 4 > pStubMsg->BufferEnd) RpcRaiseException(RPC_X_BAD_STUB_DATA); pStubMsg->MaxCount = NDR_LOCAL_UINT32_READ(pStubMsg->Buffer); @@ -435,7 +463,7 @@ static inline PFORMAT_STRING ReadVariance(MIDL_STUB_MESSAGE *pStubMsg, PFORMAT_S goto done; } - ALIGN_POINTER(pStubMsg->Buffer, 4); + align_pointer(&pStubMsg->Buffer, 4); if (pStubMsg->Buffer + 8 > pStubMsg->BufferEnd) RpcRaiseException(RPC_X_BAD_STUB_DATA); pStubMsg->Offset = NDR_LOCAL_UINT32_READ(pStubMsg->Buffer); @@ -464,7 +492,7 @@ done: /* writes the conformance value to the buffer */ static inline void WriteConformance(MIDL_STUB_MESSAGE *pStubMsg) { - ALIGN_POINTER_CLEAR(pStubMsg->Buffer, 4); + align_pointer_clear(&pStubMsg->Buffer, 4); if (pStubMsg->Buffer + 4 > (unsigned char *)pStubMsg->RpcMsg->Buffer + pStubMsg->BufferLength) RpcRaiseException(RPC_X_BAD_STUB_DATA); NDR_LOCAL_UINT32_WRITE(pStubMsg->Buffer, pStubMsg->MaxCount); @@ -474,7 +502,7 @@ static inline void WriteConformance(MIDL_STUB_MESSAGE *pStubMsg) /* writes the variance values to the buffer */ static inline void WriteVariance(MIDL_STUB_MESSAGE *pStubMsg) { - ALIGN_POINTER_CLEAR(pStubMsg->Buffer, 4); + align_pointer_clear(&pStubMsg->Buffer, 4); if (pStubMsg->Buffer + 8 > (unsigned char *)pStubMsg->RpcMsg->Buffer + pStubMsg->BufferLength) RpcRaiseException(RPC_X_BAD_STUB_DATA); NDR_LOCAL_UINT32_WRITE(pStubMsg->Buffer, pStubMsg->Offset); @@ -486,7 +514,7 @@ static inline void WriteVariance(MIDL_STUB_MESSAGE *pStubMsg) /* requests buffer space for the conformance value */ static inline void SizeConformance(MIDL_STUB_MESSAGE *pStubMsg) { - ALIGN_LENGTH(pStubMsg->BufferLength, 4); + align_length(&pStubMsg->BufferLength, 4); if (pStubMsg->BufferLength + 4 < pStubMsg->BufferLength) RpcRaiseException(RPC_X_BAD_STUB_DATA); pStubMsg->BufferLength += 4; @@ -495,7 +523,7 @@ static inline void SizeConformance(MIDL_STUB_MESSAGE *pStubMsg) /* requests buffer space for the variance values */ static inline void SizeVariance(MIDL_STUB_MESSAGE *pStubMsg) { - ALIGN_LENGTH(pStubMsg->BufferLength, 4); + align_length(&pStubMsg->BufferLength, 4); if (pStubMsg->BufferLength + 8 < pStubMsg->BufferLength) RpcRaiseException(RPC_X_BAD_STUB_DATA); pStubMsg->BufferLength += 8; @@ -508,7 +536,7 @@ PFORMAT_STRING ComputeConformanceOrVariance( BYTE dtype = pFormat[0] & 0xf; short ofs = *(const short *)&pFormat[2]; LPVOID ptr = NULL; - DWORD data = 0; + ULONG_PTR data = 0; if (!IsConformanceOrVariancePresent(pFormat)) { /* null descriptor */ @@ -537,7 +565,7 @@ PFORMAT_STRING ComputeConformanceOrVariance( break; case RPC_FC_CONSTANT_CONFORMANCE: data = ofs | ((DWORD)pFormat[1] << 16); - TRACE("constant conformance, val=%d\n", data); + TRACE("constant conformance, val=%ld\n", data); *pCount = data; goto finish_conf; case RPC_FC_TOP_LEVEL_MULTID_CONFORMANCE: @@ -562,6 +590,8 @@ PFORMAT_STRING ComputeConformanceOrVariance( case RPC_FC_CALLBACK: { unsigned char *old_stack_top = pStubMsg->StackTop; + ULONG_PTR max_count, old_max_count = pStubMsg->MaxCount; + pStubMsg->StackTop = ptr; /* ofs is index into StubDesc->apfnExprEval */ @@ -571,7 +601,9 @@ PFORMAT_STRING ComputeConformanceOrVariance( pStubMsg->StackTop = old_stack_top; /* the callback function always stores the computed value in MaxCount */ - *pCount = pStubMsg->MaxCount; + max_count = pStubMsg->MaxCount; + pStubMsg->MaxCount = old_max_count; + *pCount = max_count; goto finish_conf; } default: @@ -598,11 +630,14 @@ PFORMAT_STRING ComputeConformanceOrVariance( case RPC_FC_USMALL: data = *(UCHAR*)ptr; break; + case RPC_FC_HYPER: + data = *(ULONGLONG *)ptr; + break; default: FIXME("unknown conformance data type %x\n", dtype); goto done_conf_grab; } - TRACE("dereferenced data type %x at %p, got %d\n", dtype, ptr, data); + TRACE("dereferenced data type %x at %p, got %ld\n", dtype, ptr, data); done_conf_grab: switch (pFormat[1]) { @@ -638,14 +673,16 @@ finish_conf: static inline PFORMAT_STRING SkipConformance(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat) { - if (IsConformanceOrVariancePresent(pFormat)) - { if (pStubMsg->fHasNewCorrDesc) pFormat += 6; else pFormat += 4; - } - return pFormat; + return pFormat; +} + +static inline PFORMAT_STRING SkipVariance(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat) +{ + return SkipConformance( pStubMsg, pFormat ); } /* multiply two numbers together, raising an RPC_S_INVALID_BOUND exception if @@ -889,7 +926,6 @@ static void PointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, } if (pointer_needs_unmarshaling) { - unsigned char *base_ptr_val = *pPointer; unsigned char **current_ptr = pPointer; if (pStubMsg->IsClient) { TRACE("client\n"); @@ -902,7 +938,7 @@ static void PointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, if (!fMustAlloc) { if (pSrcPointer) { TRACE("setting *pPointer to %p\n", pSrcPointer); - *pPointer = base_ptr_val = pSrcPointer; + *pPointer = pSrcPointer; } else fMustAlloc = TRUE; } @@ -915,7 +951,6 @@ static void PointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, if (attr & RPC_FC_P_DEREF) { fMustAlloc = TRUE; } else { - base_ptr_val = NULL; *current_ptr = NULL; } } @@ -925,7 +960,7 @@ static void PointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, if (attr & RPC_FC_P_DEREF) { if (fMustAlloc) { - base_ptr_val = NdrAllocate(pStubMsg, sizeof(void *)); + unsigned char *base_ptr_val = NdrAllocate(pStubMsg, sizeof(void *)); *pPointer = base_ptr_val; current_ptr = (unsigned char **)base_ptr_val; } else @@ -1047,7 +1082,7 @@ static ULONG PointerMemorySize(PMIDL_STUB_MESSAGE pStubMsg, } if (attr & RPC_FC_P_DEREF) { - ALIGN_LENGTH(pStubMsg->MemorySize, sizeof(void*)); + align_length(&pStubMsg->MemorySize, sizeof(void*)); pStubMsg->MemorySize += sizeof(void*); TRACE("deref\n"); } @@ -1482,7 +1517,7 @@ unsigned char * WINAPI NdrPointerMarshall(PMIDL_STUB_MESSAGE pStubMsg, * the buffer, and shouldn't write any additional pointer data to the wire */ if (*pFormat != RPC_FC_RP) { - ALIGN_POINTER_CLEAR(pStubMsg->Buffer, 4); + align_pointer_clear(&pStubMsg->Buffer, 4); Buffer = pStubMsg->Buffer; safe_buffer_increment(pStubMsg, 4); } @@ -1524,7 +1559,7 @@ unsigned char * WINAPI NdrPointerUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, * as that is used by embedded pointers which already handle the incrementing * the buffer, and shouldn't read any additional pointer data from the * buffer */ - ALIGN_POINTER(pStubMsg->Buffer, 4); + align_pointer(&pStubMsg->Buffer, 4); Buffer = pStubMsg->Buffer; safe_buffer_increment(pStubMsg, 4); } @@ -1548,7 +1583,7 @@ void WINAPI NdrPointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg, * length, and shouldn't write anything more to the wire */ if (*pFormat != RPC_FC_RP) { - ALIGN_LENGTH(pStubMsg->BufferLength, 4); + align_length(&pStubMsg->BufferLength, 4); safe_buffer_length_increment(pStubMsg, 4); } @@ -1564,10 +1599,10 @@ ULONG WINAPI NdrPointerMemorySize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *Buffer = pStubMsg->Buffer; if (*pFormat != RPC_FC_RP) { - ALIGN_POINTER(pStubMsg->Buffer, 4); + align_pointer(&pStubMsg->Buffer, 4); safe_buffer_increment(pStubMsg, 4); } - ALIGN_LENGTH(pStubMsg->MemorySize, sizeof(void *)); + align_length(&pStubMsg->MemorySize, sizeof(void *)); return PointerMemorySize(pStubMsg, Buffer, pFormat); } @@ -1604,7 +1639,7 @@ void WINAPI NdrSimpleTypeUnmarshall( PMIDL_STUB_MESSAGE pStubMsg, unsigned char* unsigned char FormatChar ) { #define BASE_TYPE_UNMARSHALL(type) \ - ALIGN_POINTER(pStubMsg->Buffer, sizeof(type)); \ + align_pointer(&pStubMsg->Buffer, sizeof(type)); \ TRACE("pMemory: %p\n", pMemory); \ *(type *)pMemory = *(type *)pStubMsg->Buffer; \ pStubMsg->Buffer += sizeof(type); @@ -1644,13 +1679,27 @@ void WINAPI NdrSimpleTypeUnmarshall( PMIDL_STUB_MESSAGE pStubMsg, unsigned char* TRACE("value: %s\n", wine_dbgstr_longlong(*(ULONGLONG *)pMemory)); break; case RPC_FC_ENUM16: - ALIGN_POINTER(pStubMsg->Buffer, sizeof(USHORT)); + align_pointer(&pStubMsg->Buffer, sizeof(USHORT)); TRACE("pMemory: %p\n", pMemory); /* 16-bits on the wire, but int in memory */ *(UINT *)pMemory = *(USHORT *)pStubMsg->Buffer; pStubMsg->Buffer += sizeof(USHORT); TRACE("value: 0x%08x\n", *(UINT *)pMemory); break; + case RPC_FC_INT3264: + align_pointer(&pStubMsg->Buffer, sizeof(INT)); + /* 32-bits on the wire, but int_ptr in memory */ + *(INT_PTR *)pMemory = *(INT *)pStubMsg->Buffer; + pStubMsg->Buffer += sizeof(INT); + TRACE("value: 0x%08lx\n", *(INT_PTR *)pMemory); + break; + case RPC_FC_UINT3264: + align_pointer(&pStubMsg->Buffer, sizeof(UINT)); + /* 32-bits on the wire, but int_ptr in memory */ + *(UINT_PTR *)pMemory = *(UINT *)pStubMsg->Buffer; + pStubMsg->Buffer += sizeof(UINT); + TRACE("value: 0x%08lx\n", *(UINT_PTR *)pMemory); + break; case RPC_FC_IGNORE: break; default: @@ -1669,7 +1718,7 @@ unsigned char * WINAPI NdrSimpleStructMarshall(PMIDL_STUB_MESSAGE pStubMsg, unsigned size = *(const WORD*)(pFormat+2); TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat); - ALIGN_POINTER_CLEAR(pStubMsg->Buffer, pFormat[1] + 1); + align_pointer_clear(&pStubMsg->Buffer, pFormat[1] + 1); pStubMsg->BufferMark = pStubMsg->Buffer; safe_copy_to_buffer(pStubMsg, pMemory, size); @@ -1692,7 +1741,7 @@ unsigned char * WINAPI NdrSimpleStructUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *saved_buffer; TRACE("(%p,%p,%p,%d)\n", pStubMsg, ppMemory, pFormat, fMustAlloc); - ALIGN_POINTER(pStubMsg->Buffer, pFormat[1] + 1); + align_pointer(&pStubMsg->Buffer, pFormat[1] + 1); if (fMustAlloc) *ppMemory = NdrAllocate(pStubMsg, size); @@ -1725,7 +1774,7 @@ void WINAPI NdrSimpleStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned size = *(const WORD*)(pFormat+2); TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat); - ALIGN_LENGTH(pStubMsg->BufferLength, pFormat[1] + 1); + align_length(&pStubMsg->BufferLength, pFormat[1] + 1); safe_buffer_length_increment(pStubMsg, size); if (pFormat[0] != RPC_FC_STRUCT) @@ -1742,7 +1791,7 @@ ULONG WINAPI NdrSimpleStructMemorySize(PMIDL_STUB_MESSAGE pStubMsg, TRACE("(%p,%p)\n", pStubMsg, pFormat); - ALIGN_POINTER(pStubMsg->Buffer, pFormat[1] + 1); + align_pointer(&pStubMsg->Buffer, pFormat[1] + 1); pStubMsg->MemorySize += size; safe_buffer_increment(pStubMsg, size); @@ -1769,6 +1818,8 @@ static inline void array_compute_and_size_conformance( unsigned char fc, PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat) { + DWORD count; + switch (fc) { case RPC_FC_CARRAY: @@ -1800,6 +1851,13 @@ static inline void array_compute_and_size_conformance( SizeConformance(pStubMsg); break; + case RPC_FC_BOGUS_ARRAY: + count = *(const WORD *)(pFormat + 2); + pFormat += 4; + if (IsConformanceOrVariancePresent(pFormat)) SizeConformance(pStubMsg); + pFormat = ComputeConformance(pStubMsg, pMemory, pFormat, count); + pFormat = ComputeVariance(pStubMsg, pMemory, pFormat, pStubMsg->MaxCount); + break; default: ERR("unknown array format 0x%x\n", fc); RpcRaiseException(RPC_X_BAD_STUB_DATA); @@ -1810,7 +1868,7 @@ static inline void array_buffer_size( unsigned char fc, PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat, unsigned char fHasPointers) { - DWORD size; + DWORD i, size; DWORD esize; unsigned char alignment; @@ -1822,7 +1880,7 @@ static inline void array_buffer_size( pFormat = SkipConformance(pStubMsg, pFormat + 4); - ALIGN_LENGTH(pStubMsg->BufferLength, alignment); + align_length(&pStubMsg->BufferLength, alignment); size = safe_multiply(esize, pStubMsg->MaxCount); /* conformance value plus array */ @@ -1836,11 +1894,11 @@ static inline void array_buffer_size( alignment = pFormat[1] + 1; pFormat = SkipConformance(pStubMsg, pFormat + 4); - pFormat = SkipConformance(pStubMsg, pFormat); + pFormat = SkipVariance(pStubMsg, pFormat); SizeVariance(pStubMsg); - ALIGN_LENGTH(pStubMsg->BufferLength, alignment); + align_length(&pStubMsg->BufferLength, alignment); size = safe_multiply(esize, pStubMsg->ActualCount); safe_buffer_length_increment(pStubMsg, size); @@ -1860,6 +1918,18 @@ static inline void array_buffer_size( size = safe_multiply(esize, pStubMsg->ActualCount); safe_buffer_length_increment(pStubMsg, size); break; + case RPC_FC_BOGUS_ARRAY: + alignment = pFormat[1] + 1; + pFormat = SkipConformance(pStubMsg, pFormat + 4); + if (IsConformanceOrVariancePresent(pFormat)) SizeVariance(pStubMsg); + pFormat = SkipVariance(pStubMsg, pFormat); + + align_length(&pStubMsg->BufferLength, alignment); + + size = pStubMsg->ActualCount; + for (i = 0; i < size; i++) + pMemory = ComplexBufferSize(pStubMsg, pMemory, pFormat, NULL); + break; default: ERR("unknown array format 0x%x\n", fc); RpcRaiseException(RPC_X_BAD_STUB_DATA); @@ -1870,6 +1940,9 @@ static inline void array_compute_and_write_conformance( unsigned char fc, PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat) { + ULONG def; + BOOL conformance_present; + switch (fc) { case RPC_FC_CARRAY: @@ -1900,6 +1973,14 @@ static inline void array_compute_and_write_conformance( pStubMsg->Offset = 0; WriteConformance(pStubMsg); break; + case RPC_FC_BOGUS_ARRAY: + def = *(const WORD *)(pFormat + 2); + pFormat += 4; + conformance_present = IsConformanceOrVariancePresent(pFormat); + pFormat = ComputeConformance(pStubMsg, pMemory, pFormat, def); + pFormat = ComputeVariance(pStubMsg, pMemory, pFormat, pStubMsg->MaxCount); + if (conformance_present) WriteConformance(pStubMsg); + break; default: ERR("unknown array format 0x%x\n", fc); RpcRaiseException(RPC_X_BAD_STUB_DATA); @@ -1910,7 +1991,7 @@ static inline void array_write_variance_and_marshall( unsigned char fc, PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat, unsigned char fHasPointers) { - DWORD size; + DWORD i, size; DWORD esize; unsigned char alignment; @@ -1922,7 +2003,7 @@ static inline void array_write_variance_and_marshall( pFormat = SkipConformance(pStubMsg, pFormat + 4); - ALIGN_POINTER_CLEAR(pStubMsg->Buffer, alignment); + align_pointer_clear(&pStubMsg->Buffer, alignment); size = safe_multiply(esize, pStubMsg->MaxCount); if (fHasPointers) @@ -1936,14 +2017,12 @@ static inline void array_write_variance_and_marshall( esize = *(const WORD*)(pFormat+2); alignment = pFormat[1] + 1; - /* conformance */ pFormat = SkipConformance(pStubMsg, pFormat + 4); - /* variance */ - pFormat = SkipConformance(pStubMsg, pFormat); + pFormat = SkipVariance(pStubMsg, pFormat); WriteVariance(pStubMsg); - ALIGN_POINTER_CLEAR(pStubMsg->Buffer, alignment); + align_pointer_clear(&pStubMsg->Buffer, alignment); size = safe_multiply(esize, pStubMsg->ActualCount); @@ -1966,6 +2045,18 @@ static inline void array_write_variance_and_marshall( size = safe_multiply(esize, pStubMsg->ActualCount); safe_copy_to_buffer(pStubMsg, pMemory, size); /* the string itself */ break; + case RPC_FC_BOGUS_ARRAY: + alignment = pFormat[1] + 1; + pFormat = SkipConformance(pStubMsg, pFormat + 4); + if (IsConformanceOrVariancePresent(pFormat)) WriteVariance(pStubMsg); + pFormat = SkipVariance(pStubMsg, pFormat); + + align_pointer_clear(&pStubMsg->Buffer, alignment); + + size = pStubMsg->ActualCount; + for (i = 0; i < size; i++) + pMemory = ComplexMarshall(pStubMsg, pMemory, pFormat, NULL); + break; default: ERR("unknown array format 0x%x\n", fc); RpcRaiseException(RPC_X_BAD_STUB_DATA); @@ -1975,7 +2066,7 @@ static inline void array_write_variance_and_marshall( static inline ULONG array_read_conformance( unsigned char fc, PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat) { - DWORD esize; + DWORD def, esize; switch (fc) { @@ -1999,6 +2090,19 @@ static inline ULONG array_read_conformance( else ReadConformance(pStubMsg, NULL); return safe_multiply(esize, pStubMsg->MaxCount); + case RPC_FC_BOGUS_ARRAY: + def = *(const WORD *)(pFormat + 2); + pFormat += 4; + if (IsConformanceOrVariancePresent(pFormat)) pFormat = ReadConformance(pStubMsg, pFormat); + else + { + pStubMsg->MaxCount = def; + pFormat = SkipConformance( pStubMsg, pFormat ); + } + pFormat = SkipVariance( pStubMsg, pFormat ); + + esize = ComplexStructSize(pStubMsg, pFormat); + return safe_multiply(pStubMsg->MaxCount, esize); default: ERR("unknown array format 0x%x\n", fc); RpcRaiseException(RPC_X_BAD_STUB_DATA); @@ -2013,8 +2117,8 @@ static inline ULONG array_read_variance_and_unmarshall( ULONG bufsize, memsize; WORD esize; unsigned char alignment; - unsigned char *saved_buffer; - ULONG offset; + unsigned char *saved_buffer, *pMemory; + ULONG i, offset, count; switch (fc) { @@ -2026,7 +2130,7 @@ static inline ULONG array_read_variance_and_unmarshall( pFormat = SkipConformance(pStubMsg, pFormat + 4); - ALIGN_POINTER(pStubMsg->Buffer, alignment); + align_pointer(&pStubMsg->Buffer, alignment); if (fUnmarshall) { @@ -2058,7 +2162,7 @@ static inline ULONG array_read_variance_and_unmarshall( pFormat = ReadVariance(pStubMsg, pFormat, pStubMsg->MaxCount); - ALIGN_POINTER(pStubMsg->Buffer, alignment); + align_pointer(&pStubMsg->Buffer, alignment); bufsize = safe_multiply(esize, pStubMsg->ActualCount); memsize = safe_multiply(esize, pStubMsg->MaxCount); @@ -2133,6 +2237,31 @@ static inline ULONG array_read_variance_and_unmarshall( TRACE("string=%s\n", debugstr_w((LPWSTR)*ppMemory)); } return bufsize; + + case RPC_FC_BOGUS_ARRAY: + alignment = pFormat[1] + 1; + pFormat = SkipConformance(pStubMsg, pFormat + 4); + pFormat = ReadVariance(pStubMsg, pFormat, pStubMsg->MaxCount); + + esize = ComplexStructSize(pStubMsg, pFormat); + memsize = safe_multiply(esize, pStubMsg->MaxCount); + + assert( fUnmarshall ); + + if (!fMustAlloc && !*ppMemory) + fMustAlloc = TRUE; + if (fMustAlloc) + *ppMemory = NdrAllocate(pStubMsg, memsize); + + align_pointer(&pStubMsg->Buffer, alignment); + saved_buffer = pStubMsg->Buffer; + + pMemory = *ppMemory; + count = pStubMsg->ActualCount; + for (i = 0; i < count; i++) + pMemory = ComplexUnmarshall(pStubMsg, pMemory, pFormat, NULL, fMustAlloc); + return pStubMsg->Buffer - saved_buffer; + default: ERR("unknown array format 0x%x\n", fc); RpcRaiseException(RPC_X_BAD_STUB_DATA); @@ -2143,6 +2272,7 @@ static inline void array_memory_size( unsigned char fc, PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, unsigned char fHasPointers) { + ULONG i, count, SavedMemorySize; ULONG bufsize, memsize; DWORD esize; unsigned char alignment; @@ -2158,7 +2288,7 @@ static inline void array_memory_size( bufsize = memsize = safe_multiply(esize, pStubMsg->MaxCount); pStubMsg->MemorySize += memsize; - ALIGN_POINTER(pStubMsg->Buffer, alignment); + align_pointer(&pStubMsg->Buffer, alignment); if (fHasPointers) pStubMsg->BufferMark = pStubMsg->Buffer; safe_buffer_increment(pStubMsg, bufsize); @@ -2178,7 +2308,7 @@ static inline void array_memory_size( memsize = safe_multiply(esize, pStubMsg->MaxCount); pStubMsg->MemorySize += memsize; - ALIGN_POINTER(pStubMsg->Buffer, alignment); + align_pointer(&pStubMsg->Buffer, alignment); if (fHasPointers) pStubMsg->BufferMark = pStubMsg->Buffer; safe_buffer_increment(pStubMsg, bufsize); @@ -2215,6 +2345,24 @@ static inline void array_memory_size( safe_buffer_increment(pStubMsg, bufsize); pStubMsg->MemorySize += memsize; break; + case RPC_FC_BOGUS_ARRAY: + alignment = pFormat[1] + 1; + pFormat = SkipConformance(pStubMsg, pFormat + 4); + pFormat = ReadVariance(pStubMsg, pFormat, pStubMsg->MaxCount); + + align_pointer(&pStubMsg->Buffer, alignment); + + SavedMemorySize = pStubMsg->MemorySize; + + esize = ComplexStructSize(pStubMsg, pFormat); + memsize = safe_multiply(pStubMsg->MaxCount, esize); + + count = pStubMsg->ActualCount; + for (i = 0; i < count; i++) + ComplexStructMemorySize(pStubMsg, pFormat, NULL); + + pStubMsg->MemorySize = SavedMemorySize + memsize; + break; default: ERR("unknown array format 0x%x\n", fc); RpcRaiseException(RPC_X_BAD_STUB_DATA); @@ -2225,6 +2373,8 @@ static inline void array_free( unsigned char fc, PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat, unsigned char fHasPointers) { + DWORD i, count; + switch (fc) { case RPC_FC_CARRAY: @@ -2242,6 +2392,15 @@ static inline void array_free( case RPC_FC_C_WSTRING: /* No embedded pointers so nothing to do */ break; + case RPC_FC_BOGUS_ARRAY: + count = *(const WORD *)(pFormat + 2); + pFormat = ComputeConformance(pStubMsg, pMemory, pFormat + 4, count); + pFormat = ComputeVariance(pStubMsg, pMemory, pFormat, pStubMsg->MaxCount); + + count = pStubMsg->ActualCount; + for (i = 0; i < count; i++) + pMemory = ComplexFree(pStubMsg, pMemory, pFormat, NULL); + break; default: ERR("unknown array format 0x%x\n", fc); RpcRaiseException(RPC_X_BAD_STUB_DATA); @@ -2395,24 +2554,22 @@ unsigned char * WINAPI NdrNonConformantStringMarshall(PMIDL_STUB_MESSAGE pStubM TRACE("(pStubMsg == ^%p, pMemory == ^%p, pFormat == ^%p)\n", pStubMsg, pMemory, pFormat); - maxsize = *(USHORT *)&pFormat[2]; + maxsize = *(const USHORT *)&pFormat[2]; if (*pFormat == RPC_FC_CSTRING) { - ULONG i; + ULONG i = 0; const char *str = (const char *)pMemory; - for (i = 0; i < maxsize && *str; i++, str++) - ; + while (i < maxsize && str[i]) i++; TRACE("string=%s\n", debugstr_an(str, i)); pStubMsg->ActualCount = i + 1; esize = 1; } else if (*pFormat == RPC_FC_WSTRING) { - ULONG i; + ULONG i = 0; const WCHAR *str = (const WCHAR *)pMemory; - for (i = 0; i < maxsize && *str; i++, str++) - ; + while (i < maxsize && str[i]) i++; TRACE("string=%s\n", debugstr_wn(str, i)); pStubMsg->ActualCount = i + 1; esize = 2; @@ -2445,7 +2602,7 @@ unsigned char * WINAPI NdrNonConformantStringUnmarshall(PMIDL_STUB_MESSAGE pStu TRACE("(pStubMsg == ^%p, *pMemory == ^%p, pFormat == ^%p, fMustAlloc == %u)\n", pStubMsg, *ppMemory, pFormat, fMustAlloc); - maxsize = *(USHORT *)&pFormat[2]; + maxsize = *(const USHORT *)&pFormat[2]; ReadVariance(pStubMsg, NULL, maxsize); if (pStubMsg->Offset) @@ -2495,26 +2652,24 @@ void WINAPI NdrNonConformantStringBufferSize(PMIDL_STUB_MESSAGE pStubMsg, TRACE("(pStubMsg == ^%p, pMemory == ^%p, pFormat == ^%p)\n", pStubMsg, pMemory, pFormat); - maxsize = *(USHORT *)&pFormat[2]; + maxsize = *(const USHORT *)&pFormat[2]; SizeVariance(pStubMsg); if (*pFormat == RPC_FC_CSTRING) { - ULONG i; + ULONG i = 0; const char *str = (const char *)pMemory; - for (i = 0; i < maxsize && *str; i++, str++) - ; + while (i < maxsize && str[i]) i++; TRACE("string=%s\n", debugstr_an(str, i)); pStubMsg->ActualCount = i + 1; esize = 1; } else if (*pFormat == RPC_FC_WSTRING) { - ULONG i; + ULONG i = 0; const WCHAR *str = (const WCHAR *)pMemory; - for (i = 0; i < maxsize && *str; i++, str++) - ; + while (i < maxsize && str[i]) i++; TRACE("string=%s\n", debugstr_wn(str, i)); pStubMsg->ActualCount = i + 1; esize = 2; @@ -2538,7 +2693,7 @@ ULONG WINAPI NdrNonConformantStringMemorySize(PMIDL_STUB_MESSAGE pStubMsg, TRACE("(pStubMsg == ^%p, pFormat == ^%p)\n", pStubMsg, pFormat); - maxsize = *(USHORT *)&pFormat[2]; + maxsize = *(const USHORT *)&pFormat[2]; ReadVariance(pStubMsg, NULL, maxsize); @@ -2607,6 +2762,8 @@ static ULONG EmbeddedComplexSize(MIDL_STUB_MESSAGE *pStubMsg, case RPC_FC_LONG: case RPC_FC_ULONG: case RPC_FC_ENUM32: + case RPC_FC_INT3264: + case RPC_FC_UINT3264: return sizeof(ULONG); case RPC_FC_FLOAT: return sizeof(float); @@ -2683,12 +2840,15 @@ static unsigned char * ComplexMarshall(PMIDL_STUB_MESSAGE pStubMsg, pMemory += 2; break; case RPC_FC_ENUM16: + { + USHORT val = *(DWORD *)pMemory; TRACE("enum16=%d <= %p\n", *(DWORD*)pMemory, pMemory); if (32767 < *(DWORD*)pMemory) RpcRaiseException(RPC_X_ENUM_VALUE_OUT_OF_RANGE); - safe_copy_to_buffer(pStubMsg, pMemory, 2); + safe_copy_to_buffer(pStubMsg, &val, 2); pMemory += 4; break; + } case RPC_FC_LONG: case RPC_FC_ULONG: case RPC_FC_ENUM32: @@ -2696,6 +2856,15 @@ static unsigned char * ComplexMarshall(PMIDL_STUB_MESSAGE pStubMsg, safe_copy_to_buffer(pStubMsg, pMemory, 4); pMemory += 4; break; + case RPC_FC_INT3264: + case RPC_FC_UINT3264: + { + UINT val = *(UINT_PTR *)pMemory; + TRACE("int3264=%ld <= %p\n", *(UINT_PTR *)pMemory, pMemory); + safe_copy_to_buffer(pStubMsg, &val, sizeof(UINT)); + pMemory += sizeof(UINT_PTR); + break; + } case RPC_FC_FLOAT: TRACE("float=%f <= %p\n", *(float*)pMemory, pMemory); safe_copy_to_buffer(pStubMsg, pMemory, sizeof(float)); @@ -2724,7 +2893,7 @@ static unsigned char * ComplexMarshall(PMIDL_STUB_MESSAGE pStubMsg, if (*pFormat != RPC_FC_POINTER) pPointer = pFormat; if (*pPointer != RPC_FC_RP) - ALIGN_POINTER_CLEAR(pStubMsg->Buffer, 4); + align_pointer_clear(&pStubMsg->Buffer, 4); saved_buffer = pStubMsg->Buffer; if (pStubMsg->PointerBufferMark) { @@ -2752,13 +2921,13 @@ static unsigned char * ComplexMarshall(PMIDL_STUB_MESSAGE pStubMsg, break; } case RPC_FC_ALIGNM2: - ALIGN_POINTER(pMemory, 2); + align_pointer(&pMemory, 2); break; case RPC_FC_ALIGNM4: - ALIGN_POINTER(pMemory, 4); + align_pointer(&pMemory, 4); break; case RPC_FC_ALIGNM8: - ALIGN_POINTER(pMemory, 8); + align_pointer(&pMemory, 8); break; case RPC_FC_STRUCTPAD1: case RPC_FC_STRUCTPAD2: @@ -2830,13 +2999,16 @@ static unsigned char * ComplexUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, pMemory += 2; break; case RPC_FC_ENUM16: - safe_copy_from_buffer(pStubMsg, pMemory, 2); - *(DWORD*)pMemory &= 0xffff; + { + WORD val; + safe_copy_from_buffer(pStubMsg, &val, 2); + *(DWORD*)pMemory = val; TRACE("enum16=%d => %p\n", *(DWORD*)pMemory, pMemory); if (32767 < *(DWORD*)pMemory) RpcRaiseException(RPC_X_ENUM_VALUE_OUT_OF_RANGE); pMemory += 4; break; + } case RPC_FC_LONG: case RPC_FC_ULONG: case RPC_FC_ENUM32: @@ -2844,6 +3016,24 @@ static unsigned char * ComplexUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, TRACE("long=%d => %p\n", *(DWORD*)pMemory, pMemory); pMemory += 4; break; + case RPC_FC_INT3264: + { + INT val; + safe_copy_from_buffer(pStubMsg, &val, 4); + *(INT_PTR *)pMemory = val; + TRACE("int3264=%ld => %p\n", *(INT_PTR*)pMemory, pMemory); + pMemory += sizeof(INT_PTR); + break; + } + case RPC_FC_UINT3264: + { + UINT val; + safe_copy_from_buffer(pStubMsg, &val, 4); + *(UINT_PTR *)pMemory = val; + TRACE("uint3264=%ld => %p\n", *(UINT_PTR*)pMemory, pMemory); + pMemory += sizeof(UINT_PTR); + break; + } case RPC_FC_FLOAT: safe_copy_from_buffer(pStubMsg, pMemory, sizeof(float)); TRACE("float=%f => %p\n", *(float*)pMemory, pMemory); @@ -2871,7 +3061,7 @@ static unsigned char * ComplexUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, if (*pFormat != RPC_FC_POINTER) pPointer = pFormat; if (*pPointer != RPC_FC_RP) - ALIGN_POINTER(pStubMsg->Buffer, 4); + align_pointer(&pStubMsg->Buffer, 4); saved_buffer = pStubMsg->Buffer; if (pStubMsg->PointerBufferMark) { @@ -2899,13 +3089,13 @@ static unsigned char * ComplexUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, break; } case RPC_FC_ALIGNM2: - ALIGN_POINTER_CLEAR(pMemory, 2); + align_pointer_clear(&pMemory, 2); break; case RPC_FC_ALIGNM4: - ALIGN_POINTER_CLEAR(pMemory, 4); + align_pointer_clear(&pMemory, 4); break; case RPC_FC_ALIGNM8: - ALIGN_POINTER_CLEAR(pMemory, 8); + align_pointer_clear(&pMemory, 8); break; case RPC_FC_STRUCTPAD1: case RPC_FC_STRUCTPAD2: @@ -2992,6 +3182,11 @@ static unsigned char * ComplexBufferSize(PMIDL_STUB_MESSAGE pStubMsg, safe_buffer_length_increment(pStubMsg, 4); pMemory += 4; break; + case RPC_FC_INT3264: + case RPC_FC_UINT3264: + safe_buffer_length_increment(pStubMsg, 4); + pMemory += sizeof(INT_PTR); + break; case RPC_FC_HYPER: case RPC_FC_DOUBLE: safe_buffer_length_increment(pStubMsg, 8); @@ -3017,7 +3212,7 @@ static unsigned char * ComplexBufferSize(PMIDL_STUB_MESSAGE pStubMsg, } if (*pPointer != RPC_FC_RP) { - ALIGN_LENGTH(pStubMsg->BufferLength, 4); + align_length(&pStubMsg->BufferLength, 4); safe_buffer_length_increment(pStubMsg, 4); } if (*pFormat == RPC_FC_POINTER) @@ -3027,13 +3222,13 @@ static unsigned char * ComplexBufferSize(PMIDL_STUB_MESSAGE pStubMsg, pMemory += sizeof(void*); break; case RPC_FC_ALIGNM2: - ALIGN_POINTER(pMemory, 2); + align_pointer(&pMemory, 2); break; case RPC_FC_ALIGNM4: - ALIGN_POINTER(pMemory, 4); + align_pointer(&pMemory, 4); break; case RPC_FC_ALIGNM8: - ALIGN_POINTER(pMemory, 8); + align_pointer(&pMemory, 8); break; case RPC_FC_STRUCTPAD1: case RPC_FC_STRUCTPAD2: @@ -3105,6 +3300,10 @@ static unsigned char * ComplexFree(PMIDL_STUB_MESSAGE pStubMsg, case RPC_FC_FLOAT: pMemory += 4; break; + case RPC_FC_INT3264: + case RPC_FC_UINT3264: + pMemory += sizeof(INT_PTR); + break; case RPC_FC_HYPER: case RPC_FC_DOUBLE: pMemory += 8; @@ -3124,13 +3323,13 @@ static unsigned char * ComplexFree(PMIDL_STUB_MESSAGE pStubMsg, pMemory += sizeof(void *); break; case RPC_FC_ALIGNM2: - ALIGN_POINTER(pMemory, 2); + align_pointer(&pMemory, 2); break; case RPC_FC_ALIGNM4: - ALIGN_POINTER(pMemory, 4); + align_pointer(&pMemory, 4); break; case RPC_FC_ALIGNM8: - ALIGN_POINTER(pMemory, 8); + align_pointer(&pMemory, 8); break; case RPC_FC_STRUCTPAD1: case RPC_FC_STRUCTPAD2: @@ -3205,6 +3404,11 @@ static ULONG ComplexStructMemorySize(PMIDL_STUB_MESSAGE pStubMsg, size += 4; safe_buffer_increment(pStubMsg, 4); break; + case RPC_FC_INT3264: + case RPC_FC_UINT3264: + size += sizeof(INT_PTR); + safe_buffer_increment(pStubMsg, 4); + break; case RPC_FC_HYPER: case RPC_FC_DOUBLE: size += 8; @@ -3221,7 +3425,7 @@ static ULONG ComplexStructMemorySize(PMIDL_STUB_MESSAGE pStubMsg, if (*pFormat != RPC_FC_POINTER) pPointer = pFormat; if (*pPointer != RPC_FC_RP) - ALIGN_POINTER(pStubMsg->Buffer, 4); + align_pointer(&pStubMsg->Buffer, 4); saved_buffer = pStubMsg->Buffer; if (pStubMsg->PointerBufferMark) { @@ -3250,13 +3454,13 @@ static ULONG ComplexStructMemorySize(PMIDL_STUB_MESSAGE pStubMsg, break; } case RPC_FC_ALIGNM2: - ALIGN_LENGTH(size, 2); + align_length(&size, 2); break; case RPC_FC_ALIGNM4: - ALIGN_LENGTH(size, 4); + align_length(&size, 4); break; case RPC_FC_ALIGNM8: - ALIGN_LENGTH(size, 8); + align_length(&size, 8); break; case RPC_FC_STRUCTPAD1: case RPC_FC_STRUCTPAD2: @@ -3310,6 +3514,10 @@ ULONG ComplexStructSize(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat) case RPC_FC_FLOAT: size += 4; break; + case RPC_FC_INT3264: + case RPC_FC_UINT3264: + size += sizeof(INT_PTR); + break; case RPC_FC_HYPER: case RPC_FC_DOUBLE: size += 8; @@ -3324,13 +3532,13 @@ ULONG ComplexStructSize(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat) pFormat += 4; break; case RPC_FC_ALIGNM2: - ALIGN_LENGTH(size, 2); + align_length(&size, 2); break; case RPC_FC_ALIGNM4: - ALIGN_LENGTH(size, 4); + align_length(&size, 4); break; case RPC_FC_ALIGNM8: - ALIGN_LENGTH(size, 8); + align_length(&size, 8); break; case RPC_FC_STRUCTPAD1: case RPC_FC_STRUCTPAD2: @@ -3398,7 +3606,7 @@ unsigned char * WINAPI NdrComplexStructMarshall(PMIDL_STUB_MESSAGE pStubMsg, pStubMsg->BufferLength = saved_buffer_length; } - ALIGN_POINTER_CLEAR(pStubMsg->Buffer, pFormat[1] + 1); + align_pointer_clear(&pStubMsg->Buffer, pFormat[1] + 1); pFormat += 4; if (*(const SHORT*)pFormat) conf_array = pFormat + *(const SHORT*)pFormat; @@ -3484,7 +3692,7 @@ unsigned char * WINAPI NdrComplexStructUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, pStubMsg->Buffer = saved_buffer; } - ALIGN_POINTER(pStubMsg->Buffer, pFormat[1] + 1); + align_pointer(&pStubMsg->Buffer, pFormat[1] + 1); pFormat += 4; if (*(const SHORT*)pFormat) conf_array = pFormat + *(const SHORT*)pFormat; @@ -3549,7 +3757,7 @@ void WINAPI NdrComplexStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg, TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat); - ALIGN_LENGTH(pStubMsg->BufferLength, pFormat[1] + 1); + align_length(&pStubMsg->BufferLength, pFormat[1] + 1); if(!pStubMsg->IgnoreEmbeddedPointers && !pStubMsg->PointerLength) { @@ -3627,7 +3835,7 @@ ULONG WINAPI NdrComplexStructMemorySize(PMIDL_STUB_MESSAGE pStubMsg, TRACE("(%p,%p)\n", pStubMsg, pFormat); - ALIGN_POINTER(pStubMsg->Buffer, pFormat[1] + 1); + align_pointer(&pStubMsg->Buffer, pFormat[1] + 1); pFormat += 4; if (*(const SHORT*)pFormat) conf_array = pFormat + *(const SHORT*)pFormat; @@ -3918,9 +4126,6 @@ unsigned char * WINAPI NdrComplexArrayMarshall(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat) { - ULONG i, count, def; - BOOL variance_present; - unsigned char alignment; int pointer_buffer_mark_set = 0; TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat); @@ -3932,8 +4137,6 @@ unsigned char * WINAPI NdrComplexArrayMarshall(PMIDL_STUB_MESSAGE pStubMsg, return NULL; } - alignment = pFormat[1] + 1; - if (!pStubMsg->PointerBufferMark) { /* save buffer fields that may be changed by buffer sizer functions @@ -3963,25 +4166,9 @@ unsigned char * WINAPI NdrComplexArrayMarshall(PMIDL_STUB_MESSAGE pStubMsg, pStubMsg->BufferLength = saved_buffer_length; } - def = *(const WORD*)&pFormat[2]; - pFormat += 4; - - pFormat = ComputeConformance(pStubMsg, pMemory, pFormat, def); - TRACE("conformance = %ld\n", pStubMsg->MaxCount); - - variance_present = IsConformanceOrVariancePresent(pFormat); - pFormat = ComputeVariance(pStubMsg, pMemory, pFormat, pStubMsg->MaxCount); - TRACE("variance = %d\n", pStubMsg->ActualCount); - - WriteConformance(pStubMsg); - if (variance_present) - WriteVariance(pStubMsg); - - ALIGN_POINTER_CLEAR(pStubMsg->Buffer, alignment); - - count = pStubMsg->ActualCount; - for (i = 0; i < count; i++) - pMemory = ComplexMarshall(pStubMsg, pMemory, pFormat, NULL); + array_compute_and_write_conformance(RPC_FC_BOGUS_ARRAY, pStubMsg, pMemory, pFormat); + array_write_variance_and_marshall(RPC_FC_BOGUS_ARRAY, pStubMsg, + pMemory, pFormat, TRUE /* fHasPointers */); STD_OVERFLOW_CHECK(pStubMsg); @@ -4002,9 +4189,6 @@ unsigned char * WINAPI NdrComplexArrayUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, unsigned char fMustAlloc) { - ULONG i, count, size; - unsigned char alignment; - unsigned char *pMemory; unsigned char *saved_buffer; int pointer_buffer_mark_set = 0; int saved_ignore_embedded; @@ -4018,8 +4202,6 @@ unsigned char * WINAPI NdrComplexArrayUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, return NULL; } - alignment = pFormat[1] + 1; - saved_ignore_embedded = pStubMsg->IgnoreEmbeddedPointers; /* save buffer pointer */ saved_buffer = pStubMsg->Buffer; @@ -4028,7 +4210,6 @@ unsigned char * WINAPI NdrComplexArrayUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, pStubMsg->IgnoreEmbeddedPointers = 1; pStubMsg->MemorySize = 0; NdrComplexArrayMemorySize(pStubMsg, pFormat); - size = pStubMsg->MemorySize; pStubMsg->IgnoreEmbeddedPointers = saved_ignore_embedded; TRACE("difference = 0x%x\n", (ULONG)(pStubMsg->Buffer - saved_buffer)); @@ -4041,22 +4222,9 @@ unsigned char * WINAPI NdrComplexArrayUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, /* restore the original buffer */ pStubMsg->Buffer = saved_buffer; - pFormat += 4; - - pFormat = ReadConformance(pStubMsg, pFormat); - pFormat = ReadVariance(pStubMsg, pFormat, pStubMsg->MaxCount); - - if (!fMustAlloc && !*ppMemory) - fMustAlloc = TRUE; - if (fMustAlloc) - *ppMemory = NdrAllocate(pStubMsg, size); - - ALIGN_POINTER(pStubMsg->Buffer, alignment); - - pMemory = *ppMemory; - count = pStubMsg->ActualCount; - for (i = 0; i < count; i++) - pMemory = ComplexUnmarshall(pStubMsg, pMemory, pFormat, NULL, fMustAlloc); + array_read_conformance(RPC_FC_BOGUS_ARRAY, pStubMsg, pFormat); + array_read_variance_and_unmarshall(RPC_FC_BOGUS_ARRAY, pStubMsg, ppMemory, pFormat, fMustAlloc, + TRUE /* fUseBufferMemoryServer */, TRUE /* fUnmarshall */); if (pointer_buffer_mark_set) { @@ -4074,9 +4242,6 @@ void WINAPI NdrComplexArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat) { - ULONG i, count, def; - unsigned char alignment; - BOOL variance_present; int pointer_length_set = 0; TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat); @@ -4088,8 +4253,6 @@ void WINAPI NdrComplexArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg, return; } - alignment = pFormat[1] + 1; - if (!pStubMsg->IgnoreEmbeddedPointers && !pStubMsg->PointerLength) { /* save buffer fields that may be changed by buffer sizer functions @@ -4116,25 +4279,9 @@ void WINAPI NdrComplexArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg, pStubMsg->MaxCount = saved_max_count; pStubMsg->BufferLength = saved_buffer_length; } - def = *(const WORD*)&pFormat[2]; - pFormat += 4; - pFormat = ComputeConformance(pStubMsg, pMemory, pFormat, def); - TRACE("conformance = %ld\n", pStubMsg->MaxCount); - SizeConformance(pStubMsg); - - variance_present = IsConformanceOrVariancePresent(pFormat); - pFormat = ComputeVariance(pStubMsg, pMemory, pFormat, pStubMsg->MaxCount); - TRACE("variance = %d\n", pStubMsg->ActualCount); - - if (variance_present) - SizeVariance(pStubMsg); - - ALIGN_LENGTH(pStubMsg->BufferLength, alignment); - - count = pStubMsg->ActualCount; - for (i = 0; i < count; i++) - pMemory = ComplexBufferSize(pStubMsg, pMemory, pFormat, NULL); + array_compute_and_size_conformance(RPC_FC_BOGUS_ARRAY, pStubMsg, pMemory, pFormat); + array_buffer_size(RPC_FC_BOGUS_ARRAY, pStubMsg, pMemory, pFormat, TRUE /* fHasPointers */); if(pointer_length_set) { @@ -4149,9 +4296,6 @@ void WINAPI NdrComplexArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg, ULONG WINAPI NdrComplexArrayMemorySize(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat) { - ULONG i, count, esize, SavedMemorySize, MemorySize; - unsigned char alignment; - TRACE("(%p,%p)\n", pStubMsg, pFormat); if (pFormat[0] != RPC_FC_BOGUS_ARRAY) @@ -4161,29 +4305,9 @@ ULONG WINAPI NdrComplexArrayMemorySize(PMIDL_STUB_MESSAGE pStubMsg, return 0; } - alignment = pFormat[1] + 1; - - pFormat += 4; - - pFormat = ReadConformance(pStubMsg, pFormat); - pFormat = ReadVariance(pStubMsg, pFormat, pStubMsg->MaxCount); - - ALIGN_POINTER(pStubMsg->Buffer, alignment); - - SavedMemorySize = pStubMsg->MemorySize; - - esize = ComplexStructSize(pStubMsg, pFormat); - - MemorySize = safe_multiply(pStubMsg->MaxCount, esize); - - count = pStubMsg->ActualCount; - for (i = 0; i < count; i++) - ComplexStructMemorySize(pStubMsg, pFormat, NULL); - - pStubMsg->MemorySize = SavedMemorySize; - - pStubMsg->MemorySize += MemorySize; - return MemorySize; + array_read_conformance(RPC_FC_BOGUS_ARRAY, pStubMsg, pFormat); + array_memory_size(RPC_FC_BOGUS_ARRAY, pStubMsg, pFormat, TRUE /* fHasPointers */); + return pStubMsg->MemorySize; } /*********************************************************************** @@ -4255,7 +4379,7 @@ unsigned char * WINAPI NdrUserMarshalMarshall(PMIDL_STUB_MESSAGE pStubMsg, if (flags & USER_MARSHAL_POINTER) { - ALIGN_POINTER_CLEAR(pStubMsg->Buffer, 4); + align_pointer_clear(&pStubMsg->Buffer, 4); NDR_LOCAL_UINT32_WRITE(pStubMsg->Buffer, USER_MARSHAL_PTR_PREFIX); pStubMsg->Buffer += 4; if (pStubMsg->PointerBufferMark) @@ -4264,10 +4388,10 @@ unsigned char * WINAPI NdrUserMarshalMarshall(PMIDL_STUB_MESSAGE pStubMsg, pStubMsg->Buffer = pStubMsg->PointerBufferMark; pStubMsg->PointerBufferMark = NULL; } - ALIGN_POINTER_CLEAR(pStubMsg->Buffer, 8); + align_pointer_clear(&pStubMsg->Buffer, 8); } else - ALIGN_POINTER_CLEAR(pStubMsg->Buffer, (flags & 0xf) + 1); + align_pointer_clear(&pStubMsg->Buffer, (flags & 0xf) + 1); pStubMsg->Buffer = pStubMsg->StubDesc->aUserMarshalQuadruple[index].pfnMarshall( @@ -4306,7 +4430,7 @@ unsigned char * WINAPI NdrUserMarshalUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, if (flags & USER_MARSHAL_POINTER) { - ALIGN_POINTER(pStubMsg->Buffer, 4); + align_pointer(&pStubMsg->Buffer, 4); /* skip pointer prefix */ pStubMsg->Buffer += 4; if (pStubMsg->PointerBufferMark) @@ -4315,10 +4439,10 @@ unsigned char * WINAPI NdrUserMarshalUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, pStubMsg->Buffer = pStubMsg->PointerBufferMark; pStubMsg->PointerBufferMark = NULL; } - ALIGN_POINTER(pStubMsg->Buffer, 8); + align_pointer(&pStubMsg->Buffer, 8); } else - ALIGN_POINTER(pStubMsg->Buffer, (flags & 0xf) + 1); + align_pointer(&pStubMsg->Buffer, (flags & 0xf) + 1); if (!fMustAlloc && !*ppMemory) fMustAlloc = TRUE; @@ -4362,7 +4486,7 @@ void WINAPI NdrUserMarshalBufferSize(PMIDL_STUB_MESSAGE pStubMsg, if (flags & USER_MARSHAL_POINTER) { - ALIGN_LENGTH(pStubMsg->BufferLength, 4); + align_length(&pStubMsg->BufferLength, 4); /* skip pointer prefix */ safe_buffer_length_increment(pStubMsg, 4); if (pStubMsg->IgnoreEmbeddedPointers) @@ -4373,10 +4497,10 @@ void WINAPI NdrUserMarshalBufferSize(PMIDL_STUB_MESSAGE pStubMsg, pStubMsg->BufferLength = pStubMsg->PointerLength; pStubMsg->PointerLength = 0; } - ALIGN_LENGTH(pStubMsg->BufferLength, 8); + align_length(&pStubMsg->BufferLength, 8); } else - ALIGN_LENGTH(pStubMsg->BufferLength, (flags & 0xf) + 1); + align_length(&pStubMsg->BufferLength, (flags & 0xf) + 1); if (bufsize) { TRACE("size=%d\n", bufsize); @@ -4413,15 +4537,15 @@ ULONG WINAPI NdrUserMarshalMemorySize(PMIDL_STUB_MESSAGE pStubMsg, if (flags & USER_MARSHAL_POINTER) { - ALIGN_POINTER(pStubMsg->Buffer, 4); + align_pointer(&pStubMsg->Buffer, 4); /* skip pointer prefix */ pStubMsg->Buffer += 4; if (pStubMsg->IgnoreEmbeddedPointers) return pStubMsg->MemorySize; - ALIGN_POINTER(pStubMsg->Buffer, 8); + align_pointer(&pStubMsg->Buffer, 8); } else - ALIGN_POINTER(pStubMsg->Buffer, (flags & 0xf) + 1); + align_pointer(&pStubMsg->Buffer, (flags & 0xf) + 1); if (!bufsize) FIXME("not implemented for varying buffer size\n"); @@ -4578,7 +4702,7 @@ unsigned char * WINAPI NdrConformantStructMarshall(PMIDL_STUB_MESSAGE pStubMsg, WriteConformance(pStubMsg); - ALIGN_POINTER_CLEAR(pStubMsg->Buffer, pCStructFormat->alignment + 1); + align_pointer_clear(&pStubMsg->Buffer, pCStructFormat->alignment + 1); TRACE("memory_size = %d\n", pCStructFormat->memory_size); @@ -4633,7 +4757,7 @@ unsigned char * WINAPI NdrConformantStructUnmarshall(PMIDL_STUB_MESSAGE pStubMs pCArrayFormat = ReadConformance(pStubMsg, pCArrayFormat + 4); - ALIGN_POINTER(pStubMsg->Buffer, pCStructFormat->alignment + 1); + align_pointer(&pStubMsg->Buffer, pCStructFormat->alignment + 1); TRACE("memory_size = %d\n", pCStructFormat->memory_size); @@ -4702,7 +4826,7 @@ void WINAPI NdrConformantStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg, pCArrayFormat = ComputeConformance(pStubMsg, pMemory + pCStructFormat->memory_size, pCArrayFormat+4, 0); SizeConformance(pStubMsg); - ALIGN_LENGTH(pStubMsg->BufferLength, pCStructFormat->alignment + 1); + align_length(&pStubMsg->BufferLength, pCStructFormat->alignment + 1); TRACE("memory_size = %d\n", pCStructFormat->memory_size); @@ -4791,7 +4915,7 @@ unsigned char * WINAPI NdrConformantVaryingStructMarshall(PMIDL_STUB_MESSAGE pS pMemory + pCVStructFormat->memory_size, pCVArrayFormat); - ALIGN_POINTER_CLEAR(pStubMsg->Buffer, pCVStructFormat->alignment + 1); + align_pointer_clear(&pStubMsg->Buffer, pCVStructFormat->alignment + 1); TRACE("memory_size = %d\n", pCVStructFormat->memory_size); @@ -4839,7 +4963,7 @@ unsigned char * WINAPI NdrConformantVaryingStructUnmarshall(PMIDL_STUB_MESSAGE memsize = array_read_conformance(*pCVArrayFormat, pStubMsg, pCVArrayFormat); - ALIGN_POINTER(pStubMsg->Buffer, pCVStructFormat->alignment + 1); + align_pointer(&pStubMsg->Buffer, pCVStructFormat->alignment + 1); TRACE("memory_size = %d\n", pCVStructFormat->memory_size); @@ -4913,7 +5037,7 @@ void WINAPI NdrConformantVaryingStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg, pMemory + pCVStructFormat->memory_size, pCVArrayFormat); - ALIGN_LENGTH(pStubMsg->BufferLength, pCVStructFormat->alignment + 1); + align_length(&pStubMsg->BufferLength, pCVStructFormat->alignment + 1); TRACE("memory_size = %d\n", pCVStructFormat->memory_size); @@ -4949,7 +5073,7 @@ ULONG WINAPI NdrConformantVaryingStructMemorySize(PMIDL_STUB_MESSAGE pStubMsg, pCVStructFormat->offset_to_array_description; array_read_conformance(*pCVArrayFormat, pStubMsg, pCVArrayFormat); - ALIGN_POINTER(pStubMsg->Buffer, pCVStructFormat->alignment + 1); + align_pointer(&pStubMsg->Buffer, pCVStructFormat->alignment + 1); TRACE("memory_size = %d\n", pCVStructFormat->memory_size); @@ -5031,7 +5155,7 @@ unsigned char * WINAPI NdrFixedArrayMarshall(PMIDL_STUB_MESSAGE pStubMsg, return NULL; } - ALIGN_POINTER_CLEAR(pStubMsg->Buffer, pSmFArrayFormat->alignment + 1); + align_pointer_clear(&pStubMsg->Buffer, pSmFArrayFormat->alignment + 1); if (pSmFArrayFormat->type == RPC_FC_SMFARRAY) { @@ -5075,7 +5199,7 @@ unsigned char * WINAPI NdrFixedArrayUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, return NULL; } - ALIGN_POINTER(pStubMsg->Buffer, pSmFArrayFormat->alignment + 1); + align_pointer(&pStubMsg->Buffer, pSmFArrayFormat->alignment + 1); if (pSmFArrayFormat->type == RPC_FC_SMFARRAY) { @@ -5129,7 +5253,7 @@ void WINAPI NdrFixedArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg, return; } - ALIGN_LENGTH(pStubMsg->BufferLength, pSmFArrayFormat->alignment + 1); + align_length(&pStubMsg->BufferLength, pSmFArrayFormat->alignment + 1); if (pSmFArrayFormat->type == RPC_FC_SMFARRAY) { @@ -5166,7 +5290,7 @@ ULONG WINAPI NdrFixedArrayMemorySize(PMIDL_STUB_MESSAGE pStubMsg, return 0; } - ALIGN_POINTER(pStubMsg->Buffer, pSmFArrayFormat->alignment + 1); + align_pointer(&pStubMsg->Buffer, pSmFArrayFormat->alignment + 1); if (pSmFArrayFormat->type == RPC_FC_SMFARRAY) { @@ -5269,7 +5393,7 @@ unsigned char * WINAPI NdrVaryingArrayMarshall(PMIDL_STUB_MESSAGE pStubMsg, WriteVariance(pStubMsg); - ALIGN_POINTER_CLEAR(pStubMsg->Buffer, alignment); + align_pointer_clear(&pStubMsg->Buffer, alignment); bufsize = safe_multiply(esize, pStubMsg->ActualCount); pStubMsg->BufferMark = pStubMsg->Buffer; @@ -5328,7 +5452,7 @@ unsigned char * WINAPI NdrVaryingArrayUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, pFormat = ReadVariance(pStubMsg, pFormat, elements); - ALIGN_POINTER(pStubMsg->Buffer, alignment); + align_pointer(&pStubMsg->Buffer, alignment); bufsize = safe_multiply(esize, pStubMsg->ActualCount); offset = pStubMsg->Offset; @@ -5397,7 +5521,7 @@ void WINAPI NdrVaryingArrayBufferSize(PMIDL_STUB_MESSAGE pStubMsg, SizeVariance(pStubMsg); - ALIGN_LENGTH(pStubMsg->BufferLength, alignment); + align_length(&pStubMsg->BufferLength, alignment); safe_buffer_length_increment(pStubMsg, safe_multiply(esize, pStubMsg->ActualCount)); @@ -5447,7 +5571,7 @@ ULONG WINAPI NdrVaryingArrayMemorySize(PMIDL_STUB_MESSAGE pStubMsg, pFormat = ReadVariance(pStubMsg, pFormat, elements); - ALIGN_POINTER(pStubMsg->Buffer, alignment); + align_pointer(&pStubMsg->Buffer, alignment); safe_buffer_increment(pStubMsg, safe_multiply(esize, pStubMsg->ActualCount)); pStubMsg->MemorySize += size; @@ -5522,6 +5646,9 @@ static ULONG get_discriminant(unsigned char fc, const unsigned char *pMemory) case RPC_FC_ULONG: case RPC_FC_ENUM32: return *(const ULONG *)pMemory; + case RPC_FC_INT3264: + case RPC_FC_UINT3264: + return *(const ULONG_PTR *)pMemory; default: FIXME("Unhandled base type: 0x%02x\n", fc); return 0; @@ -5595,7 +5722,7 @@ static unsigned char *union_arm_marshall(PMIDL_STUB_MESSAGE pStubMsg, unsigned c case RPC_FC_UP: case RPC_FC_OP: case RPC_FC_FP: - ALIGN_POINTER_CLEAR(pStubMsg->Buffer, 4); + align_pointer_clear(&pStubMsg->Buffer, 4); saved_buffer = pStubMsg->Buffer; if (pStubMsg->PointerBufferMark) { @@ -5663,7 +5790,7 @@ static unsigned char *union_arm_unmarshall(PMIDL_STUB_MESSAGE pStubMsg, case RPC_FC_UP: case RPC_FC_OP: case RPC_FC_FP: - ALIGN_POINTER(pStubMsg->Buffer, 4); + align_pointer(&pStubMsg->Buffer, 4); saved_buffer = pStubMsg->Buffer; if (pStubMsg->PointerBufferMark) { @@ -5729,7 +5856,7 @@ static void union_arm_buffer_size(PMIDL_STUB_MESSAGE pStubMsg, case RPC_FC_UP: case RPC_FC_OP: case RPC_FC_FP: - ALIGN_LENGTH(pStubMsg->BufferLength, 4); + align_length(&pStubMsg->BufferLength, 4); safe_buffer_length_increment(pStubMsg, 4); /* for pointer ID */ if (!pStubMsg->IgnoreEmbeddedPointers) { @@ -5783,10 +5910,10 @@ static ULONG union_arm_memory_size(PMIDL_STUB_MESSAGE pStubMsg, case RPC_FC_UP: case RPC_FC_OP: case RPC_FC_FP: - ALIGN_POINTER(pStubMsg->Buffer, 4); + align_pointer(&pStubMsg->Buffer, 4); saved_buffer = pStubMsg->Buffer; safe_buffer_increment(pStubMsg, 4); - ALIGN_LENGTH(pStubMsg->MemorySize, sizeof(void *)); + align_length(&pStubMsg->MemorySize, sizeof(void *)); pStubMsg->MemorySize += sizeof(void *); if (!pStubMsg->IgnoreEmbeddedPointers) PointerMemorySize(pStubMsg, saved_buffer, pFormat); @@ -5855,7 +5982,7 @@ unsigned char * WINAPI NdrEncapsulatedUnionMarshall(PMIDL_STUB_MESSAGE pStubMsg increment = (*pFormat & 0xf0) >> 4; pFormat++; - ALIGN_POINTER_CLEAR(pStubMsg->Buffer, increment); + align_pointer_clear(&pStubMsg->Buffer, increment); switch_value = get_discriminant(switch_type, pMemory); TRACE("got switch value 0x%x\n", switch_value); @@ -5887,7 +6014,7 @@ unsigned char * WINAPI NdrEncapsulatedUnionUnmarshall(PMIDL_STUB_MESSAGE pStubM increment = (*pFormat & 0xf0) >> 4; pFormat++; - ALIGN_POINTER(pStubMsg->Buffer, increment); + align_pointer(&pStubMsg->Buffer, increment); switch_value = get_discriminant(switch_type, pStubMsg->Buffer); TRACE("got switch value 0x%x\n", switch_value); @@ -5929,7 +6056,7 @@ void WINAPI NdrEncapsulatedUnionBufferSize(PMIDL_STUB_MESSAGE pStubMsg, increment = (*pFormat & 0xf0) >> 4; pFormat++; - ALIGN_LENGTH(pStubMsg->BufferLength, increment); + align_length(&pStubMsg->BufferLength, increment); switch_value = get_discriminant(switch_type, pMemory); TRACE("got switch value 0x%x\n", switch_value); @@ -5954,7 +6081,7 @@ ULONG WINAPI NdrEncapsulatedUnionMemorySize(PMIDL_STUB_MESSAGE pStubMsg, increment = (*pFormat & 0xf0) >> 4; pFormat++; - ALIGN_POINTER(pStubMsg->Buffer, increment); + align_pointer(&pStubMsg->Buffer, increment); switch_value = get_discriminant(switch_type, pStubMsg->Buffer); TRACE("got switch value 0x%x\n", switch_value); @@ -6035,7 +6162,7 @@ static LONG unmarshall_discriminant(PMIDL_STUB_MESSAGE pStubMsg, case RPC_FC_ENUM16: { USHORT d; - ALIGN_POINTER(pStubMsg->Buffer, sizeof(USHORT)); + align_pointer(&pStubMsg->Buffer, sizeof(USHORT)); safe_copy_from_buffer(pStubMsg, &d, sizeof(d)); discriminant = d; break; @@ -6044,7 +6171,7 @@ static LONG unmarshall_discriminant(PMIDL_STUB_MESSAGE pStubMsg, case RPC_FC_ULONG: { ULONG d; - ALIGN_POINTER(pStubMsg->Buffer, sizeof(ULONG)); + align_pointer(&pStubMsg->Buffer, sizeof(ULONG)); safe_copy_from_buffer(pStubMsg, &d, sizeof(d)); discriminant = d; break; @@ -6269,7 +6396,7 @@ static unsigned char *WINAPI NdrRangeMarshall( unsigned char *pMemory, PFORMAT_STRING pFormat) { - NDR_RANGE *pRange = (NDR_RANGE *)pFormat; + const NDR_RANGE *pRange = (const NDR_RANGE *)pFormat; unsigned char base_type; TRACE("pStubMsg %p, pMemory %p, type 0x%02x\n", pStubMsg, pMemory, *pFormat); @@ -6295,7 +6422,7 @@ unsigned char *WINAPI NdrRangeUnmarshall( PFORMAT_STRING pFormat, unsigned char fMustAlloc) { - NDR_RANGE *pRange = (NDR_RANGE *)pFormat; + const NDR_RANGE *pRange = (const NDR_RANGE *)pFormat; unsigned char base_type; TRACE("pStubMsg: %p, ppMemory: %p, type: 0x%02x, fMustAlloc: %s\n", pStubMsg, ppMemory, *pFormat, fMustAlloc ? "true" : "false"); @@ -6314,7 +6441,7 @@ unsigned char *WINAPI NdrRangeUnmarshall( #define RANGE_UNMARSHALL(mem_type, wire_type, format_spec) \ do \ { \ - ALIGN_POINTER(pStubMsg->Buffer, sizeof(wire_type)); \ + align_pointer(&pStubMsg->Buffer, sizeof(wire_type)); \ if (!fMustAlloc && !*ppMemory) \ fMustAlloc = TRUE; \ if (fMustAlloc) \ @@ -6392,7 +6519,7 @@ static void WINAPI NdrRangeBufferSize( unsigned char *pMemory, PFORMAT_STRING pFormat) { - NDR_RANGE *pRange = (NDR_RANGE *)pFormat; + const NDR_RANGE *pRange = (const NDR_RANGE *)pFormat; unsigned char base_type; TRACE("pStubMsg %p, pMemory %p, type 0x%02x\n", pStubMsg, pMemory, *pFormat); @@ -6414,7 +6541,7 @@ static ULONG WINAPI NdrRangeMemorySize( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat) { - NDR_RANGE *pRange = (NDR_RANGE *)pFormat; + const NDR_RANGE *pRange = (const NDR_RANGE *)pFormat; unsigned char base_type; if (pRange->type != RPC_FC_RANGE) @@ -6462,7 +6589,7 @@ static unsigned char *WINAPI NdrBaseTypeMarshall( case RPC_FC_WCHAR: case RPC_FC_SHORT: case RPC_FC_USHORT: - ALIGN_POINTER_CLEAR(pStubMsg->Buffer, sizeof(USHORT)); + align_pointer_clear(&pStubMsg->Buffer, sizeof(USHORT)); safe_copy_to_buffer(pStubMsg, pMemory, sizeof(USHORT)); TRACE("value: 0x%04x\n", *(USHORT *)pMemory); break; @@ -6470,34 +6597,42 @@ static unsigned char *WINAPI NdrBaseTypeMarshall( case RPC_FC_ULONG: case RPC_FC_ERROR_STATUS_T: case RPC_FC_ENUM32: - ALIGN_POINTER_CLEAR(pStubMsg->Buffer, sizeof(ULONG)); + align_pointer_clear(&pStubMsg->Buffer, sizeof(ULONG)); safe_copy_to_buffer(pStubMsg, pMemory, sizeof(ULONG)); TRACE("value: 0x%08x\n", *(ULONG *)pMemory); break; case RPC_FC_FLOAT: - ALIGN_POINTER_CLEAR(pStubMsg->Buffer, sizeof(float)); + align_pointer_clear(&pStubMsg->Buffer, sizeof(float)); safe_copy_to_buffer(pStubMsg, pMemory, sizeof(float)); break; case RPC_FC_DOUBLE: - ALIGN_POINTER_CLEAR(pStubMsg->Buffer, sizeof(double)); + align_pointer_clear(&pStubMsg->Buffer, sizeof(double)); safe_copy_to_buffer(pStubMsg, pMemory, sizeof(double)); break; case RPC_FC_HYPER: - ALIGN_POINTER_CLEAR(pStubMsg->Buffer, sizeof(ULONGLONG)); + align_pointer_clear(&pStubMsg->Buffer, sizeof(ULONGLONG)); safe_copy_to_buffer(pStubMsg, pMemory, sizeof(ULONGLONG)); TRACE("value: %s\n", wine_dbgstr_longlong(*(ULONGLONG*)pMemory)); break; case RPC_FC_ENUM16: + { + USHORT val = *(UINT *)pMemory; /* only 16-bits on the wire, so do a sanity check */ if (*(UINT *)pMemory > SHRT_MAX) RpcRaiseException(RPC_X_ENUM_VALUE_OUT_OF_RANGE); - ALIGN_POINTER_CLEAR(pStubMsg->Buffer, sizeof(USHORT)); - if (pStubMsg->Buffer + sizeof(USHORT) > (unsigned char *)pStubMsg->RpcMsg->Buffer + pStubMsg->BufferLength) - RpcRaiseException(RPC_X_BAD_STUB_DATA); - *(USHORT *)pStubMsg->Buffer = *(UINT *)pMemory; - pStubMsg->Buffer += sizeof(USHORT); + align_pointer_clear(&pStubMsg->Buffer, sizeof(USHORT)); + safe_copy_to_buffer(pStubMsg, &val, sizeof(val)); TRACE("value: 0x%04x\n", *(UINT *)pMemory); break; + } + case RPC_FC_INT3264: + case RPC_FC_UINT3264: + { + UINT val = *(UINT_PTR *)pMemory; + align_pointer_clear(&pStubMsg->Buffer, sizeof(UINT)); + safe_copy_to_buffer(pStubMsg, &val, sizeof(val)); + break; + } case RPC_FC_IGNORE: break; default: @@ -6519,8 +6654,8 @@ static unsigned char *WINAPI NdrBaseTypeUnmarshall( { TRACE("pStubMsg: %p, ppMemory: %p, type: 0x%02x, fMustAlloc: %s\n", pStubMsg, ppMemory, *pFormat, fMustAlloc ? "true" : "false"); -#define BASE_TYPE_UNMARSHALL(type) \ - ALIGN_POINTER(pStubMsg->Buffer, sizeof(type)); \ +#define BASE_TYPE_UNMARSHALL(type) do { \ + align_pointer(&pStubMsg->Buffer, sizeof(type)); \ if (!fMustAlloc && !pStubMsg->IsClient && !*ppMemory) \ { \ *ppMemory = pStubMsg->Buffer; \ @@ -6533,7 +6668,8 @@ static unsigned char *WINAPI NdrBaseTypeUnmarshall( *ppMemory = NdrAllocate(pStubMsg, sizeof(type)); \ TRACE("*ppMemory: %p\n", *ppMemory); \ safe_copy_from_buffer(pStubMsg, *ppMemory, sizeof(type)); \ - } + } \ + } while (0) switch(*pFormat) { @@ -6570,19 +6706,49 @@ static unsigned char *WINAPI NdrBaseTypeUnmarshall( TRACE("value: %s\n", wine_dbgstr_longlong(**(ULONGLONG **)ppMemory)); break; case RPC_FC_ENUM16: - ALIGN_POINTER(pStubMsg->Buffer, sizeof(USHORT)); + { + USHORT val; + align_pointer(&pStubMsg->Buffer, sizeof(USHORT)); if (!fMustAlloc && !*ppMemory) fMustAlloc = TRUE; if (fMustAlloc) *ppMemory = NdrAllocate(pStubMsg, sizeof(UINT)); - if (pStubMsg->Buffer + sizeof(USHORT) > pStubMsg->BufferEnd) - RpcRaiseException(RPC_X_BAD_STUB_DATA); - TRACE("*ppMemory: %p\n", *ppMemory); + safe_copy_from_buffer(pStubMsg, &val, sizeof(USHORT)); /* 16-bits on the wire, but int in memory */ - **(UINT **)ppMemory = *(USHORT *)pStubMsg->Buffer; - pStubMsg->Buffer += sizeof(USHORT); + **(UINT **)ppMemory = val; TRACE("value: 0x%08x\n", **(UINT **)ppMemory); break; + } + case RPC_FC_INT3264: + if (sizeof(INT_PTR) == sizeof(INT)) BASE_TYPE_UNMARSHALL(INT); + else + { + INT val; + align_pointer(&pStubMsg->Buffer, sizeof(INT)); + if (!fMustAlloc && !*ppMemory) + fMustAlloc = TRUE; + if (fMustAlloc) + *ppMemory = NdrAllocate(pStubMsg, sizeof(INT_PTR)); + safe_copy_from_buffer(pStubMsg, &val, sizeof(INT)); + **(INT_PTR **)ppMemory = val; + TRACE("value: 0x%08lx\n", **(INT_PTR **)ppMemory); + } + break; + case RPC_FC_UINT3264: + if (sizeof(UINT_PTR) == sizeof(UINT)) BASE_TYPE_UNMARSHALL(UINT); + else + { + UINT val; + align_pointer(&pStubMsg->Buffer, sizeof(UINT)); + if (!fMustAlloc && !*ppMemory) + fMustAlloc = TRUE; + if (fMustAlloc) + *ppMemory = NdrAllocate(pStubMsg, sizeof(UINT_PTR)); + safe_copy_from_buffer(pStubMsg, &val, sizeof(UINT)); + **(UINT_PTR **)ppMemory = val; + TRACE("value: 0x%08lx\n", **(UINT_PTR **)ppMemory); + } + break; case RPC_FC_IGNORE: break; default: @@ -6617,29 +6783,31 @@ static void WINAPI NdrBaseTypeBufferSize( case RPC_FC_SHORT: case RPC_FC_USHORT: case RPC_FC_ENUM16: - ALIGN_LENGTH(pStubMsg->BufferLength, sizeof(USHORT)); + align_length(&pStubMsg->BufferLength, sizeof(USHORT)); safe_buffer_length_increment(pStubMsg, sizeof(USHORT)); break; case RPC_FC_LONG: case RPC_FC_ULONG: case RPC_FC_ENUM32: - ALIGN_LENGTH(pStubMsg->BufferLength, sizeof(ULONG)); + case RPC_FC_INT3264: + case RPC_FC_UINT3264: + align_length(&pStubMsg->BufferLength, sizeof(ULONG)); safe_buffer_length_increment(pStubMsg, sizeof(ULONG)); break; case RPC_FC_FLOAT: - ALIGN_LENGTH(pStubMsg->BufferLength, sizeof(float)); + align_length(&pStubMsg->BufferLength, sizeof(float)); safe_buffer_length_increment(pStubMsg, sizeof(float)); break; case RPC_FC_DOUBLE: - ALIGN_LENGTH(pStubMsg->BufferLength, sizeof(double)); + align_length(&pStubMsg->BufferLength, sizeof(double)); safe_buffer_length_increment(pStubMsg, sizeof(double)); break; case RPC_FC_HYPER: - ALIGN_LENGTH(pStubMsg->BufferLength, sizeof(ULONGLONG)); + align_length(&pStubMsg->BufferLength, sizeof(ULONGLONG)); safe_buffer_length_increment(pStubMsg, sizeof(ULONGLONG)); break; case RPC_FC_ERROR_STATUS_T: - ALIGN_LENGTH(pStubMsg->BufferLength, sizeof(error_status_t)); + align_length(&pStubMsg->BufferLength, sizeof(error_status_t)); safe_buffer_length_increment(pStubMsg, sizeof(error_status_t)); break; case RPC_FC_IGNORE: @@ -6670,51 +6838,58 @@ static ULONG WINAPI NdrBaseTypeMemorySize( case RPC_FC_WCHAR: case RPC_FC_SHORT: case RPC_FC_USHORT: - ALIGN_POINTER(pStubMsg->Buffer, sizeof(USHORT)); + align_pointer(&pStubMsg->Buffer, sizeof(USHORT)); safe_buffer_increment(pStubMsg, sizeof(USHORT)); - ALIGN_LENGTH(pStubMsg->MemorySize, sizeof(USHORT)); + align_length(&pStubMsg->MemorySize, sizeof(USHORT)); pStubMsg->MemorySize += sizeof(USHORT); return sizeof(USHORT); case RPC_FC_LONG: case RPC_FC_ULONG: case RPC_FC_ENUM32: - ALIGN_POINTER(pStubMsg->Buffer, sizeof(ULONG)); + align_pointer(&pStubMsg->Buffer, sizeof(ULONG)); safe_buffer_increment(pStubMsg, sizeof(ULONG)); - ALIGN_LENGTH(pStubMsg->MemorySize, sizeof(ULONG)); + align_length(&pStubMsg->MemorySize, sizeof(ULONG)); pStubMsg->MemorySize += sizeof(ULONG); return sizeof(ULONG); case RPC_FC_FLOAT: - ALIGN_POINTER(pStubMsg->Buffer, sizeof(float)); + align_pointer(&pStubMsg->Buffer, sizeof(float)); safe_buffer_increment(pStubMsg, sizeof(float)); - ALIGN_LENGTH(pStubMsg->MemorySize, sizeof(float)); + align_length(&pStubMsg->MemorySize, sizeof(float)); pStubMsg->MemorySize += sizeof(float); return sizeof(float); case RPC_FC_DOUBLE: - ALIGN_POINTER(pStubMsg->Buffer, sizeof(double)); + align_pointer(&pStubMsg->Buffer, sizeof(double)); safe_buffer_increment(pStubMsg, sizeof(double)); - ALIGN_LENGTH(pStubMsg->MemorySize, sizeof(double)); + align_length(&pStubMsg->MemorySize, sizeof(double)); pStubMsg->MemorySize += sizeof(double); return sizeof(double); case RPC_FC_HYPER: - ALIGN_POINTER(pStubMsg->Buffer, sizeof(ULONGLONG)); + align_pointer(&pStubMsg->Buffer, sizeof(ULONGLONG)); safe_buffer_increment(pStubMsg, sizeof(ULONGLONG)); - ALIGN_LENGTH(pStubMsg->MemorySize, sizeof(ULONGLONG)); + align_length(&pStubMsg->MemorySize, sizeof(ULONGLONG)); pStubMsg->MemorySize += sizeof(ULONGLONG); return sizeof(ULONGLONG); case RPC_FC_ERROR_STATUS_T: - ALIGN_POINTER(pStubMsg->Buffer, sizeof(error_status_t)); + align_pointer(&pStubMsg->Buffer, sizeof(error_status_t)); safe_buffer_increment(pStubMsg, sizeof(error_status_t)); - ALIGN_LENGTH(pStubMsg->MemorySize, sizeof(error_status_t)); + align_length(&pStubMsg->MemorySize, sizeof(error_status_t)); pStubMsg->MemorySize += sizeof(error_status_t); return sizeof(error_status_t); case RPC_FC_ENUM16: - ALIGN_POINTER(pStubMsg->Buffer, sizeof(USHORT)); + align_pointer(&pStubMsg->Buffer, sizeof(USHORT)); safe_buffer_increment(pStubMsg, sizeof(USHORT)); - ALIGN_LENGTH(pStubMsg->MemorySize, sizeof(UINT)); + align_length(&pStubMsg->MemorySize, sizeof(UINT)); pStubMsg->MemorySize += sizeof(UINT); return sizeof(UINT); + case RPC_FC_INT3264: + case RPC_FC_UINT3264: + align_pointer(&pStubMsg->Buffer, sizeof(UINT)); + safe_buffer_increment(pStubMsg, sizeof(UINT)); + align_length(&pStubMsg->MemorySize, sizeof(UINT_PTR)); + pStubMsg->MemorySize += sizeof(UINT_PTR); + return sizeof(UINT_PTR); case RPC_FC_IGNORE: - ALIGN_LENGTH(pStubMsg->MemorySize, sizeof(void *)); + align_length(&pStubMsg->MemorySize, sizeof(void *)); pStubMsg->MemorySize += sizeof(void *); return sizeof(void *); default: @@ -6750,7 +6925,7 @@ static void WINAPI NdrContextHandleBufferSize( ERR("invalid format type %x\n", *pFormat); RpcRaiseException(RPC_S_INTERNAL_ERROR); } - ALIGN_LENGTH(pStubMsg->BufferLength, 4); + align_length(&pStubMsg->BufferLength, 4); safe_buffer_length_increment(pStubMsg, cbNDRContext); } @@ -6836,7 +7011,7 @@ void WINAPI NdrClientContextMarshall(PMIDL_STUB_MESSAGE pStubMsg, { TRACE("(%p, %p, %d)\n", pStubMsg, ContextHandle, fCheck); - ALIGN_POINTER_CLEAR(pStubMsg->Buffer, 4); + align_pointer_clear(&pStubMsg->Buffer, 4); if (pStubMsg->Buffer + cbNDRContext > (unsigned char *)pStubMsg->RpcMsg->Buffer + pStubMsg->BufferLength) { @@ -6861,7 +7036,7 @@ void WINAPI NdrClientContextUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, { TRACE("(%p, %p, %p)\n", pStubMsg, pContextHandle, BindHandle); - ALIGN_POINTER(pStubMsg->Buffer, 4); + align_pointer(&pStubMsg->Buffer, 4); if (pStubMsg->Buffer + cbNDRContext > pStubMsg->BufferEnd) RpcRaiseException(RPC_X_BAD_STUB_DATA); @@ -6880,7 +7055,7 @@ void WINAPI NdrServerContextMarshall(PMIDL_STUB_MESSAGE pStubMsg, { TRACE("(%p, %p, %p)\n", pStubMsg, ContextHandle, RundownRoutine); - ALIGN_POINTER(pStubMsg->Buffer, 4); + align_pointer(&pStubMsg->Buffer, 4); if (pStubMsg->Buffer + cbNDRContext > (unsigned char *)pStubMsg->RpcMsg->Buffer + pStubMsg->BufferLength) { @@ -6901,7 +7076,7 @@ NDR_SCONTEXT WINAPI NdrServerContextUnmarshall(PMIDL_STUB_MESSAGE pStubMsg) TRACE("(%p)\n", pStubMsg); - ALIGN_POINTER(pStubMsg->Buffer, 4); + align_pointer(&pStubMsg->Buffer, 4); if (pStubMsg->Buffer + cbNDRContext > (unsigned char *)pStubMsg->RpcMsg->Buffer + pStubMsg->BufferLength) { @@ -6959,7 +7134,7 @@ void WINAPI NdrServerContextNewMarshall(PMIDL_STUB_MESSAGE pStubMsg, TRACE("(%p, %p, %p, %p)\n", pStubMsg, ContextHandle, RundownRoutine, pFormat); - ALIGN_POINTER(pStubMsg->Buffer, 4); + align_pointer(&pStubMsg->Buffer, 4); if (pStubMsg->Buffer + cbNDRContext > (unsigned char *)pStubMsg->RpcMsg->Buffer + pStubMsg->BufferLength) { @@ -6992,7 +7167,7 @@ NDR_SCONTEXT WINAPI NdrServerContextNewUnmarshall(PMIDL_STUB_MESSAGE pStubMsg, TRACE("(%p, %p)\n", pStubMsg, pFormat); - ALIGN_POINTER(pStubMsg->Buffer, 4); + align_pointer(&pStubMsg->Buffer, 4); if (pStubMsg->Buffer + cbNDRContext > (unsigned char *)pStubMsg->RpcMsg->Buffer + pStubMsg->BufferLength) { diff --git a/dll/win32/rpcrt4/ndr_misc.h b/dll/win32/rpcrt4/ndr_misc.h index b0150c3a2eb..2ca89b1744d 100644 --- a/dll/win32/rpcrt4/ndr_misc.h +++ b/dll/win32/rpcrt4/ndr_misc.h @@ -32,7 +32,7 @@ struct IPSFactoryBuffer; PFORMAT_STRING ComputeConformanceOrVariance( MIDL_STUB_MESSAGE *pStubMsg, unsigned char *pMemory, - PFORMAT_STRING pFormat, ULONG_PTR def, ULONG_PTR *pCount); + PFORMAT_STRING pFormat, ULONG_PTR def, ULONG_PTR *pCount) DECLSPEC_HIDDEN; static inline PFORMAT_STRING ComputeConformance(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat, ULONG def) { @@ -56,12 +56,12 @@ typedef void (WINAPI *NDR_BUFFERSIZE)(PMIDL_STUB_MESSAGE, unsigned cha typedef ULONG (WINAPI *NDR_MEMORYSIZE)(PMIDL_STUB_MESSAGE, PFORMAT_STRING); typedef void (WINAPI *NDR_FREE) (PMIDL_STUB_MESSAGE, unsigned char*, PFORMAT_STRING); -extern const NDR_MARSHALL NdrMarshaller[]; -extern const NDR_UNMARSHALL NdrUnmarshaller[]; -extern const NDR_BUFFERSIZE NdrBufferSizer[]; -extern const NDR_MEMORYSIZE NdrMemorySizer[]; -extern const NDR_FREE NdrFreer[]; +extern const NDR_MARSHALL NdrMarshaller[] DECLSPEC_HIDDEN; +extern const NDR_UNMARSHALL NdrUnmarshaller[] DECLSPEC_HIDDEN; +extern const NDR_BUFFERSIZE NdrBufferSizer[] DECLSPEC_HIDDEN; +extern const NDR_MEMORYSIZE NdrMemorySizer[] DECLSPEC_HIDDEN; +extern const NDR_FREE NdrFreer[] DECLSPEC_HIDDEN; -ULONG ComplexStructSize(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat); +ULONG ComplexStructSize(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat) DECLSPEC_HIDDEN; #endif /* __WINE_NDR_MISC_H */ diff --git a/dll/win32/rpcrt4/ndr_ole.c b/dll/win32/rpcrt4/ndr_ole.c index a4c23c2c5c2..c3ab5297df3 100644 --- a/dll/win32/rpcrt4/ndr_ole.c +++ b/dll/win32/rpcrt4/ndr_ole.c @@ -78,7 +78,7 @@ static HMODULE LoadCOM(void) * (which also implements the MInterfacePointer structure) */ typedef struct RpcStreamImpl { - const IStreamVtbl *lpVtbl; + IStream IStream_iface; LONG RefCount; PMIDL_STUB_MESSAGE pMsg; LPDWORD size; @@ -86,11 +86,16 @@ typedef struct RpcStreamImpl DWORD pos; } RpcStreamImpl; +static inline RpcStreamImpl *impl_from_IStream(IStream *iface) +{ + return CONTAINING_RECORD(iface, RpcStreamImpl, IStream_iface); +} + static HRESULT WINAPI RpcStream_QueryInterface(LPSTREAM iface, REFIID riid, LPVOID *obj) { - RpcStreamImpl *This = (RpcStreamImpl *)iface; + RpcStreamImpl *This = impl_from_IStream(iface); if (IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_ISequentialStream, riid) || IsEqualGUID(&IID_IStream, riid)) { @@ -103,13 +108,13 @@ static HRESULT WINAPI RpcStream_QueryInterface(LPSTREAM iface, static ULONG WINAPI RpcStream_AddRef(LPSTREAM iface) { - RpcStreamImpl *This = (RpcStreamImpl *)iface; + RpcStreamImpl *This = impl_from_IStream(iface); return InterlockedIncrement( &This->RefCount ); } static ULONG WINAPI RpcStream_Release(LPSTREAM iface) { - RpcStreamImpl *This = (RpcStreamImpl *)iface; + RpcStreamImpl *This = impl_from_IStream(iface); ULONG ref = InterlockedDecrement( &This->RefCount ); if (!ref) { TRACE("size=%d\n", *This->size); @@ -125,7 +130,7 @@ static HRESULT WINAPI RpcStream_Read(LPSTREAM iface, ULONG cb, ULONG *pcbRead) { - RpcStreamImpl *This = (RpcStreamImpl *)iface; + RpcStreamImpl *This = impl_from_IStream(iface); HRESULT hr = S_OK; if (This->pos + cb > *This->size) { @@ -145,7 +150,7 @@ static HRESULT WINAPI RpcStream_Write(LPSTREAM iface, ULONG cb, ULONG *pcbWritten) { - RpcStreamImpl *This = (RpcStreamImpl *)iface; + RpcStreamImpl *This = impl_from_IStream(iface); if (This->data + cb > (unsigned char *)This->pMsg->RpcMsg->Buffer + This->pMsg->BufferLength) return STG_E_MEDIUMFULL; memcpy(This->data + This->pos, pv, cb); @@ -160,7 +165,7 @@ static HRESULT WINAPI RpcStream_Seek(LPSTREAM iface, DWORD origin, ULARGE_INTEGER *newPos) { - RpcStreamImpl *This = (RpcStreamImpl *)iface; + RpcStreamImpl *This = impl_from_IStream(iface); switch (origin) { case STREAM_SEEK_SET: This->pos = move.u.LowPart; @@ -184,7 +189,7 @@ static HRESULT WINAPI RpcStream_Seek(LPSTREAM iface, static HRESULT WINAPI RpcStream_SetSize(LPSTREAM iface, ULARGE_INTEGER newSize) { - RpcStreamImpl *This = (RpcStreamImpl *)iface; + RpcStreamImpl *This = impl_from_IStream(iface); *This->size = newSize.u.LowPart; return S_OK; } @@ -212,7 +217,7 @@ static LPSTREAM RpcStream_Create(PMIDL_STUB_MESSAGE pStubMsg, BOOL init) RpcStreamImpl *This; This = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(RpcStreamImpl)); if (!This) return NULL; - This->lpVtbl = &RpcStream_Vtbl; + This->IStream_iface.lpVtbl = &RpcStream_Vtbl; This->RefCount = 1; This->pMsg = pStubMsg; This->size = (LPDWORD)pStubMsg->Buffer; @@ -309,13 +314,12 @@ void WINAPI NdrInterfacePointerBufferSize(PMIDL_STUB_MESSAGE pStubMsg, { const IID *riid = get_ip_iid(pStubMsg, pMemory, pFormat); ULONG size = 0; - HRESULT hr; TRACE("(%p,%p,%p)\n", pStubMsg, pMemory, pFormat); if (!LoadCOM()) return; - hr = COM_GetMarshalSizeMax(&size, riid, (LPUNKNOWN)pMemory, - pStubMsg->dwDestContext, pStubMsg->pvDestContext, - MSHLFLAGS_NORMAL); + COM_GetMarshalSizeMax(&size, riid, (LPUNKNOWN)pMemory, + pStubMsg->dwDestContext, pStubMsg->pvDestContext, + MSHLFLAGS_NORMAL); TRACE("size=%d\n", size); pStubMsg->BufferLength += sizeof(DWORD) + size; } diff --git a/dll/win32/rpcrt4/ndr_stubless.c b/dll/win32/rpcrt4/ndr_stubless.c index d6b9c5f90c2..fa5aad0f877 100644 --- a/dll/win32/rpcrt4/ndr_stubless.c +++ b/dll/win32/rpcrt4/ndr_stubless.c @@ -50,9 +50,24 @@ WINE_DEFAULT_DEBUG_CHANNEL(rpc); #define NDR_TABLE_MASK 127 -static inline void call_buffer_sizer(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat) +static inline void call_buffer_sizer(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, + const NDR_PARAM_OIF *param) { - NDR_BUFFERSIZE m = NdrBufferSizer[pFormat[0] & NDR_TABLE_MASK]; + PFORMAT_STRING pFormat; + NDR_BUFFERSIZE m; + + if (param->attr.IsBasetype) + { + pFormat = ¶m->u.type_format_char; + if (param->attr.IsSimpleRef) pMemory = *(unsigned char **)pMemory; + } + else + { + pFormat = &pStubMsg->StubDesc->pFormatTypes[param->u.type_offset]; + if (!param->attr.IsByValue) pMemory = *(unsigned char **)pMemory; + } + + m = NdrBufferSizer[pFormat[0] & NDR_TABLE_MASK]; if (m) m(pStubMsg, pMemory, pFormat); else { @@ -61,9 +76,24 @@ static inline void call_buffer_sizer(PMIDL_STUB_MESSAGE pStubMsg, unsigned char } } -static inline unsigned char *call_marshaller(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat) +static inline unsigned char *call_marshaller(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, + const NDR_PARAM_OIF *param) { - NDR_MARSHALL m = NdrMarshaller[pFormat[0] & NDR_TABLE_MASK]; + PFORMAT_STRING pFormat; + NDR_MARSHALL m; + + if (param->attr.IsBasetype) + { + pFormat = ¶m->u.type_format_char; + if (param->attr.IsSimpleRef) pMemory = *(unsigned char **)pMemory; + } + else + { + pFormat = &pStubMsg->StubDesc->pFormatTypes[param->u.type_offset]; + if (!param->attr.IsByValue) pMemory = *(unsigned char **)pMemory; + } + + m = NdrMarshaller[pFormat[0] & NDR_TABLE_MASK]; if (m) return m(pStubMsg, pMemory, pFormat); else { @@ -73,9 +103,24 @@ static inline unsigned char *call_marshaller(PMIDL_STUB_MESSAGE pStubMsg, unsign } } -static inline unsigned char *call_unmarshaller(PMIDL_STUB_MESSAGE pStubMsg, unsigned char **ppMemory, PFORMAT_STRING pFormat, unsigned char fMustAlloc) +static inline unsigned char *call_unmarshaller(PMIDL_STUB_MESSAGE pStubMsg, unsigned char **ppMemory, + const NDR_PARAM_OIF *param, unsigned char fMustAlloc) { - NDR_UNMARSHALL m = NdrUnmarshaller[pFormat[0] & NDR_TABLE_MASK]; + PFORMAT_STRING pFormat; + NDR_UNMARSHALL m; + + if (param->attr.IsBasetype) + { + pFormat = ¶m->u.type_format_char; + if (param->attr.IsSimpleRef) ppMemory = (unsigned char **)*ppMemory; + } + else + { + pFormat = &pStubMsg->StubDesc->pFormatTypes[param->u.type_offset]; + if (!param->attr.IsByValue) ppMemory = (unsigned char **)*ppMemory; + } + + m = NdrUnmarshaller[pFormat[0] & NDR_TABLE_MASK]; if (m) return m(pStubMsg, ppMemory, pFormat, fMustAlloc); else { @@ -85,19 +130,85 @@ static inline unsigned char *call_unmarshaller(PMIDL_STUB_MESSAGE pStubMsg, unsi } } -static inline void call_freer(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, PFORMAT_STRING pFormat) +static inline void call_freer(PMIDL_STUB_MESSAGE pStubMsg, unsigned char *pMemory, + const NDR_PARAM_OIF *param) { - NDR_FREE m = NdrFreer[pFormat[0] & NDR_TABLE_MASK]; + PFORMAT_STRING pFormat; + NDR_FREE m; + + if (param->attr.IsBasetype) return; /* nothing to do */ + pFormat = &pStubMsg->StubDesc->pFormatTypes[param->u.type_offset]; + if (!param->attr.IsByValue) pMemory = *(unsigned char **)pMemory; + + m = NdrFreer[pFormat[0] & NDR_TABLE_MASK]; if (m) m(pStubMsg, pMemory, pFormat); } -#define STUBLESS_UNMARSHAL 1 -#define STUBLESS_INITOUT 2 -#define STUBLESS_CALLSERVER 3 -#define STUBLESS_CALCSIZE 4 -#define STUBLESS_GETBUFFER 5 -#define STUBLESS_MARSHAL 6 -#define STUBLESS_FREE 7 +static DWORD calc_arg_size(MIDL_STUB_MESSAGE *pStubMsg, PFORMAT_STRING pFormat) +{ + DWORD size; + switch(*pFormat) + { + case RPC_FC_STRUCT: + case RPC_FC_PSTRUCT: + size = *(const WORD*)(pFormat + 2); + break; + case RPC_FC_BOGUS_STRUCT: + size = *(const WORD*)(pFormat + 2); + if(*(const WORD*)(pFormat + 4)) + FIXME("Unhandled conformant description\n"); + break; + case RPC_FC_CARRAY: + case RPC_FC_CVARRAY: + size = *(const WORD*)(pFormat + 2); + ComputeConformance(pStubMsg, NULL, pFormat + 4, 0); + size *= pStubMsg->MaxCount; + break; + case RPC_FC_SMFARRAY: + case RPC_FC_SMVARRAY: + size = *(const WORD*)(pFormat + 2); + break; + case RPC_FC_LGFARRAY: + case RPC_FC_LGVARRAY: + size = *(const DWORD*)(pFormat + 2); + break; + case RPC_FC_BOGUS_ARRAY: + pFormat = ComputeConformance(pStubMsg, NULL, pFormat + 4, *(const WORD*)&pFormat[2]); + TRACE("conformance = %ld\n", pStubMsg->MaxCount); + pFormat = ComputeVariance(pStubMsg, NULL, pFormat, pStubMsg->MaxCount); + size = ComplexStructSize(pStubMsg, pFormat); + size *= pStubMsg->MaxCount; + break; + case RPC_FC_USER_MARSHAL: + size = *(const WORD*)(pFormat + 4); + break; + case RPC_FC_CSTRING: + size = *(const WORD*)(pFormat + 2); + break; + case RPC_FC_WSTRING: + size = *(const WORD*)(pFormat + 2) * sizeof(WCHAR); + break; + case RPC_FC_C_CSTRING: + case RPC_FC_C_WSTRING: + if (*pFormat == RPC_FC_C_CSTRING) + size = sizeof(CHAR); + else + size = sizeof(WCHAR); + if (pFormat[1] == RPC_FC_STRING_SIZED) + ComputeConformance(pStubMsg, NULL, pFormat + 2, 0); + else + pStubMsg->MaxCount = 0; + size *= pStubMsg->MaxCount; + break; + default: + FIXME("Unhandled type %02x\n", *pFormat); + /* fallthrough */ + case RPC_FC_RP: + size = sizeof(void *); + break; + } + return size; +} void WINAPI NdrRpcSmSetClientToOsf(PMIDL_STUB_MESSAGE pMessage) { @@ -107,33 +218,41 @@ void WINAPI NdrRpcSmSetClientToOsf(PMIDL_STUB_MESSAGE pMessage) #endif } -static void dump_RPC_FC_PROC_PF(PARAM_ATTRIBUTES param_attributes) +static const char *debugstr_PROC_PF(PARAM_ATTRIBUTES param_attributes) { - if (param_attributes.MustSize) TRACE(" MustSize"); - if (param_attributes.MustFree) TRACE(" MustFree"); - if (param_attributes.IsPipe) TRACE(" IsPipe"); - if (param_attributes.IsIn) TRACE(" IsIn"); - if (param_attributes.IsOut) TRACE(" IsOut"); - if (param_attributes.IsReturn) TRACE(" IsReturn"); - if (param_attributes.IsBasetype) TRACE(" IsBasetype"); - if (param_attributes.IsByValue) TRACE(" IsByValue"); - if (param_attributes.IsSimpleRef) TRACE(" IsSimpleRef"); - if (param_attributes.IsDontCallFreeInst) TRACE(" IsDontCallFreeInst"); - if (param_attributes.SaveForAsyncFinish) TRACE(" SaveForAsyncFinish"); - if (param_attributes.ServerAllocSize) TRACE(" ServerAllocSize = %d", param_attributes.ServerAllocSize * 8); + char buffer[160]; + + buffer[0] = 0; + if (param_attributes.MustSize) strcat(buffer, " MustSize"); + if (param_attributes.MustFree) strcat(buffer, " MustFree"); + if (param_attributes.IsPipe) strcat(buffer, " IsPipe"); + if (param_attributes.IsIn) strcat(buffer, " IsIn"); + if (param_attributes.IsOut) strcat(buffer, " IsOut"); + if (param_attributes.IsReturn) strcat(buffer, " IsReturn"); + if (param_attributes.IsBasetype) strcat(buffer, " IsBasetype"); + if (param_attributes.IsByValue) strcat(buffer, " IsByValue"); + if (param_attributes.IsSimpleRef) strcat(buffer, " IsSimpleRef"); + if (param_attributes.IsDontCallFreeInst) strcat(buffer, " IsDontCallFreeInst"); + if (param_attributes.SaveForAsyncFinish) strcat(buffer, " SaveForAsyncFinish"); + if (param_attributes.ServerAllocSize) + sprintf( buffer + strlen(buffer), " ServerAllocSize = %d", param_attributes.ServerAllocSize * 8); + return buffer[0] ? wine_dbg_sprintf( "%s", buffer + 1 ) : ""; } -static void dump_INTERPRETER_OPT_FLAGS(INTERPRETER_OPT_FLAGS Oi2Flags) +static const char *debugstr_INTERPRETER_OPT_FLAGS(INTERPRETER_OPT_FLAGS Oi2Flags) { - if (Oi2Flags.ServerMustSize) TRACE(" ServerMustSize"); - if (Oi2Flags.ClientMustSize) TRACE(" ClientMustSize"); - if (Oi2Flags.HasReturn) TRACE(" HasReturn"); - if (Oi2Flags.HasPipes) TRACE(" HasPipes"); - if (Oi2Flags.Unused) TRACE(" Unused"); - if (Oi2Flags.HasAsyncUuid) TRACE(" HasAsyncUuid"); - if (Oi2Flags.HasExtensions) TRACE(" HasExtensions"); - if (Oi2Flags.HasAsyncHandle) TRACE(" HasAsyncHandle"); - TRACE("\n"); + char buffer[160]; + + buffer[0] = 0; + if (Oi2Flags.ServerMustSize) strcat(buffer, " ServerMustSize"); + if (Oi2Flags.ClientMustSize) strcat(buffer, " ClientMustSize"); + if (Oi2Flags.HasReturn) strcat(buffer, " HasReturn"); + if (Oi2Flags.HasPipes) strcat(buffer, " HasPipes"); + if (Oi2Flags.Unused) strcat(buffer, " Unused"); + if (Oi2Flags.HasAsyncUuid) strcat(buffer, " HasAsyncUuid"); + if (Oi2Flags.HasExtensions) strcat(buffer, " HasExtensions"); + if (Oi2Flags.HasAsyncHandle) strcat(buffer, " HasAsyncHandle"); + return buffer[0] ? wine_dbg_sprintf( "%s", buffer + 1 ) : ""; } #define ARG_FROM_OFFSET(args, offset) ((args) + (offset)) @@ -173,7 +292,7 @@ static PFORMAT_STRING client_get_handle( if (pDesc->flag_and_size & HANDLE_PARAM_IS_VIA_PTR) pArg = *(void **)ARG_FROM_OFFSET(pStubMsg->StackTop, pDesc->offset); else - pArg = (void *)ARG_FROM_OFFSET(pStubMsg->StackTop, pDesc->offset); + pArg = ARG_FROM_OFFSET(pStubMsg->StackTop, pDesc->offset); memcpy(&pObject, pArg, pDesc->flag_and_size & 0xf); pGenPair = &pStubMsg->StubDesc->aGenericBindingRoutinePairs[pDesc->binding_routine_pair_index]; *phBinding = pGenPair->pfnBind(pObject); @@ -191,14 +310,14 @@ static PFORMAT_STRING client_get_handle( } else context_handle = *(NDR_CCONTEXT *)ARG_FROM_OFFSET(pStubMsg->StackTop, pDesc->offset); - if ((pDesc->flags & NDR_CONTEXT_HANDLE_CANNOT_BE_NULL) && - !context_handle) + + if (context_handle) *phBinding = NDRCContextBinding(context_handle); + else if (pDesc->flags & NDR_CONTEXT_HANDLE_CANNOT_BE_NULL) { ERR("null context handle isn't allowed\n"); RpcRaiseException(RPC_X_SS_IN_NULL_CONTEXT); return NULL; } - *phBinding = NDRCContextBinding(context_handle); /* FIXME: should we store this structure in stubMsg.pContext? */ return pFormat + sizeof(NDR_EHD_CONTEXT); } @@ -256,7 +375,7 @@ static void client_free_handle( if (pDesc->flag_and_size & HANDLE_PARAM_IS_VIA_PTR) pArg = *(void **)ARG_FROM_OFFSET(pStubMsg->StackTop, pDesc->offset); else - pArg = (void *)ARG_FROM_OFFSET(pStubMsg->StackTop, pDesc->offset); + pArg = ARG_FROM_OFFSET(pStubMsg->StackTop, pDesc->offset); memcpy(&pObject, pArg, pDesc->flag_and_size & 0xf); pGenPair = &pStubMsg->StubDesc->aGenericBindingRoutinePairs[pDesc->binding_routine_pair_index]; pGenPair->pfnUnbind(pObject, hBinding); @@ -284,123 +403,65 @@ static void client_free_handle( } } -static void client_do_args(PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, - int phase, unsigned char *args, unsigned short number_of_params, - unsigned char *pRetVal) +void client_do_args( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, enum stubless_phase phase, + void **fpu_args, unsigned short number_of_params, unsigned char *pRetVal ) { - /* current format string offset */ - int current_offset = 0; - /* current stack offset */ - unsigned short current_stack_offset = 0; - /* counter */ - unsigned short i; + const NDR_PARAM_OIF *params = (const NDR_PARAM_OIF *)pFormat; + unsigned int i; for (i = 0; i < number_of_params; i++) { - const NDR_PARAM_OIF_BASETYPE *pParam = - (const NDR_PARAM_OIF_BASETYPE *)&pFormat[current_offset]; - unsigned char * pArg; + unsigned char *pArg = pStubMsg->StackTop + params[i].stack_offset; + PFORMAT_STRING pTypeFormat = (PFORMAT_STRING)&pStubMsg->StubDesc->pFormatTypes[params[i].u.type_offset]; - current_stack_offset = pParam->stack_offset; - pArg = ARG_FROM_OFFSET(args, current_stack_offset); +#ifdef __x86_64__ /* floats are passed as doubles through varargs functions */ + float f; - TRACE("param[%d]: new format\n", i); - TRACE("\tparam_attributes:"); dump_RPC_FC_PROC_PF(pParam->param_attributes); TRACE("\n"); - TRACE("\tstack_offset: 0x%x\n", current_stack_offset); - TRACE("\tmemory addr (before): %p\n", pArg); - - if (pParam->param_attributes.IsBasetype) + if (params[i].attr.IsBasetype && + params[i].u.type_format_char == RPC_FC_FLOAT && + !params[i].attr.IsSimpleRef && + !fpu_args) { - const unsigned char * pTypeFormat = - &pParam->type_format_char; - - if (pParam->param_attributes.IsSimpleRef) - pArg = *(unsigned char **)pArg; - - TRACE("\tbase type: 0x%02x\n", *pTypeFormat); - - switch (phase) - { - case PROXY_CALCSIZE: - if (pParam->param_attributes.IsIn) - call_buffer_sizer(pStubMsg, pArg, pTypeFormat); - break; - case PROXY_MARSHAL: - if (pParam->param_attributes.IsIn) - call_marshaller(pStubMsg, pArg, pTypeFormat); - break; - case PROXY_UNMARSHAL: - if (pParam->param_attributes.IsOut) - { - if (pParam->param_attributes.IsReturn) - call_unmarshaller(pStubMsg, &pRetVal, pTypeFormat, 0); - else - call_unmarshaller(pStubMsg, &pArg, pTypeFormat, 0); - TRACE("pRetVal = %p\n", pRetVal); - } - break; - default: - RpcRaiseException(RPC_S_INTERNAL_ERROR); - } - - current_offset += sizeof(NDR_PARAM_OIF_BASETYPE); + f = *(double *)pArg; + pArg = (unsigned char *)&f; } - else +#endif + + TRACE("param[%d]: %p type %02x %s\n", i, pArg, + params[i].attr.IsBasetype ? params[i].u.type_format_char : *pTypeFormat, + debugstr_PROC_PF( params[i].attr )); + + switch (phase) { - const NDR_PARAM_OIF_OTHER *pParamOther = - (const NDR_PARAM_OIF_OTHER *)&pFormat[current_offset]; - - const unsigned char * pTypeFormat = - &(pStubMsg->StubDesc->pFormatTypes[pParamOther->type_offset]); - - /* if a simple ref pointer then we have to do the - * check for the pointer being non-NULL. */ - if (pParam->param_attributes.IsSimpleRef) + case STUBLESS_INITOUT: + if (!params[i].attr.IsBasetype && params[i].attr.IsOut && + !params[i].attr.IsIn && !params[i].attr.IsByValue) { - if (!*(unsigned char **)pArg) - RpcRaiseException(RPC_X_NULL_REF_POINTER); + memset( *(unsigned char **)pArg, 0, calc_arg_size( pStubMsg, pTypeFormat )); } - - TRACE("\tcomplex type: 0x%02x\n", *pTypeFormat); - - switch (phase) + break; + case STUBLESS_CALCSIZE: + if (params[i].attr.IsSimpleRef && !*(unsigned char **)pArg) + RpcRaiseException(RPC_X_NULL_REF_POINTER); + if (params[i].attr.IsIn) call_buffer_sizer(pStubMsg, pArg, ¶ms[i]); + break; + case STUBLESS_MARSHAL: + if (params[i].attr.IsIn) call_marshaller(pStubMsg, pArg, ¶ms[i]); + break; + case STUBLESS_UNMARSHAL: + if (params[i].attr.IsOut) { - case PROXY_CALCSIZE: - if (pParam->param_attributes.IsIn) - { - if (pParam->param_attributes.IsByValue) - call_buffer_sizer(pStubMsg, pArg, pTypeFormat); - else - call_buffer_sizer(pStubMsg, *(unsigned char **)pArg, pTypeFormat); - } - break; - case PROXY_MARSHAL: - if (pParam->param_attributes.IsIn) - { - if (pParam->param_attributes.IsByValue) - call_marshaller(pStubMsg, pArg, pTypeFormat); - else - call_marshaller(pStubMsg, *(unsigned char **)pArg, pTypeFormat); - } - break; - case PROXY_UNMARSHAL: - if (pParam->param_attributes.IsOut) - { - if (pParam->param_attributes.IsReturn) - call_unmarshaller(pStubMsg, &pRetVal, pTypeFormat, 0); - else if (pParam->param_attributes.IsByValue) - call_unmarshaller(pStubMsg, &pArg, pTypeFormat, 0); - else - call_unmarshaller(pStubMsg, (unsigned char **)pArg, pTypeFormat, 0); - } - break; - default: - RpcRaiseException(RPC_S_INTERNAL_ERROR); + if (params[i].attr.IsReturn && pRetVal) pArg = pRetVal; + call_unmarshaller(pStubMsg, &pArg, ¶ms[i], 0); } - - current_offset += sizeof(NDR_PARAM_OIF_OTHER); + break; + case STUBLESS_FREE: + if (!params[i].attr.IsBasetype && params[i].attr.IsOut && !params[i].attr.IsByValue) + NdrClearOutParameters( pStubMsg, pTypeFormat, *(unsigned char **)pArg ); + break; + default: + RpcRaiseException(RPC_S_INTERNAL_ERROR); } - TRACE("\tmemory addr (after): %p\n", pArg); } } @@ -412,143 +473,119 @@ static unsigned int type_stack_size(unsigned char fc) case RPC_FC_CHAR: case RPC_FC_SMALL: case RPC_FC_USMALL: - return sizeof(char); case RPC_FC_WCHAR: case RPC_FC_SHORT: case RPC_FC_USHORT: - return sizeof(short); case RPC_FC_LONG: case RPC_FC_ULONG: + case RPC_FC_INT3264: + case RPC_FC_UINT3264: case RPC_FC_ENUM16: case RPC_FC_ENUM32: - return sizeof(int); case RPC_FC_FLOAT: - return sizeof(float); + case RPC_FC_ERROR_STATUS_T: + case RPC_FC_IGNORE: + return sizeof(void *); case RPC_FC_DOUBLE: return sizeof(double); case RPC_FC_HYPER: return sizeof(ULONGLONG); - case RPC_FC_ERROR_STATUS_T: - return sizeof(error_status_t); - case RPC_FC_IGNORE: - return sizeof(void *); default: ERR("invalid base type 0x%x\n", fc); RpcRaiseException(RPC_S_INTERNAL_ERROR); } } -void client_do_args_old_format(PMIDL_STUB_MESSAGE pStubMsg, - PFORMAT_STRING pFormat, int phase, unsigned char *args, - unsigned short stack_size, - unsigned char *pRetVal, BOOL object_proc, BOOL ignore_retval) +static BOOL is_by_value( PFORMAT_STRING format ) { - /* current format string offset */ - int current_offset = 0; - /* current stack offset */ - unsigned short current_stack_offset = 0; - /* counter */ - unsigned short i; - - /* NOTE: V1 style format doesn't terminate on the number_of_params - * condition as it doesn't have this attribute. Instead it - * terminates when the stack size given in the header is exceeded. - */ - for (i = 0; TRUE; i++) + switch (*format) { - const NDR_PARAM_OI_BASETYPE *pParam = - (const NDR_PARAM_OI_BASETYPE *)&pFormat[current_offset]; - /* note: current_stack_offset starts after the This pointer - * if present, so adjust this */ - unsigned short current_stack_offset_adjusted = current_stack_offset + - (object_proc ? sizeof(void *) : 0); - unsigned char * pArg = ARG_FROM_OFFSET(args, current_stack_offset_adjusted); - - /* no more parameters; exit loop */ - if (current_stack_offset_adjusted >= stack_size) - break; - - TRACE("param[%d]: old format\n", i); - TRACE("\tparam_direction: 0x%x\n", pParam->param_direction); - TRACE("\tstack_offset: 0x%x\n", current_stack_offset_adjusted); - TRACE("\tmemory addr (before): %p\n", pArg); - - if (pParam->param_direction == RPC_FC_IN_PARAM_BASETYPE || - pParam->param_direction == RPC_FC_RETURN_PARAM_BASETYPE) - { - const unsigned char * pTypeFormat = - &pParam->type_format_char; - - TRACE("\tbase type 0x%02x\n", *pTypeFormat); - - switch (phase) - { - case PROXY_CALCSIZE: - if (pParam->param_direction == RPC_FC_IN_PARAM_BASETYPE) - call_buffer_sizer(pStubMsg, pArg, pTypeFormat); - break; - case PROXY_MARSHAL: - if (pParam->param_direction == RPC_FC_IN_PARAM_BASETYPE) - call_marshaller(pStubMsg, pArg, pTypeFormat); - break; - case PROXY_UNMARSHAL: - if (!ignore_retval && - pParam->param_direction == RPC_FC_RETURN_PARAM_BASETYPE) - { - if (pParam->param_direction & RPC_FC_RETURN_PARAM) - call_unmarshaller(pStubMsg, &pRetVal, pTypeFormat, 0); - else - call_unmarshaller(pStubMsg, &pArg, pTypeFormat, 0); - } - break; - default: - RpcRaiseException(RPC_S_INTERNAL_ERROR); - } - - current_stack_offset += type_stack_size(*pTypeFormat); - current_offset += sizeof(NDR_PARAM_OI_BASETYPE); - } - else - { - const NDR_PARAM_OI_OTHER *pParamOther = - (const NDR_PARAM_OI_OTHER *)&pFormat[current_offset]; - - const unsigned char *pTypeFormat = - &pStubMsg->StubDesc->pFormatTypes[pParamOther->type_offset]; - - TRACE("\tcomplex type 0x%02x\n", *pTypeFormat); - - switch (phase) - { - case PROXY_CALCSIZE: - if (pParam->param_direction == RPC_FC_IN_PARAM || - pParam->param_direction & RPC_FC_IN_OUT_PARAM) - call_buffer_sizer(pStubMsg, *(unsigned char **)pArg, pTypeFormat); - break; - case PROXY_MARSHAL: - if (pParam->param_direction == RPC_FC_IN_PARAM || - pParam->param_direction & RPC_FC_IN_OUT_PARAM) - call_marshaller(pStubMsg, *(unsigned char **)pArg, pTypeFormat); - break; - case PROXY_UNMARSHAL: - if (pParam->param_direction == RPC_FC_IN_OUT_PARAM || - pParam->param_direction == RPC_FC_OUT_PARAM) - call_unmarshaller(pStubMsg, (unsigned char **)pArg, pTypeFormat, 0); - else if (pParam->param_direction == RPC_FC_RETURN_PARAM) - call_unmarshaller(pStubMsg, (unsigned char **)pRetVal, pTypeFormat, 0); - break; - default: - RpcRaiseException(RPC_S_INTERNAL_ERROR); - } - - current_stack_offset += pParamOther->stack_size * sizeof(INT); - current_offset += sizeof(NDR_PARAM_OI_OTHER); - } - TRACE("\tmemory addr (after): %p\n", pArg); + case RPC_FC_USER_MARSHAL: + case RPC_FC_STRUCT: + case RPC_FC_PSTRUCT: + case RPC_FC_CSTRUCT: + case RPC_FC_CPSTRUCT: + case RPC_FC_CVSTRUCT: + case RPC_FC_BOGUS_STRUCT: + return TRUE; + default: + return FALSE; } } -CLIENT_CALL_RETURN WINAPIV NdrClientCall2(PMIDL_STUB_DESC pStubDesc, PFORMAT_STRING pFormat, ...) +PFORMAT_STRING convert_old_args( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, + unsigned int stack_size, BOOL object_proc, + void *buffer, unsigned int size, unsigned int *count ) +{ + NDR_PARAM_OIF *args = buffer; + unsigned int i, stack_offset = object_proc ? sizeof(void *) : 0; + + for (i = 0; stack_offset < stack_size; i++) + { + const NDR_PARAM_OI_BASETYPE *param = (const NDR_PARAM_OI_BASETYPE *)pFormat; + const NDR_PARAM_OI_OTHER *other = (const NDR_PARAM_OI_OTHER *)pFormat; + + if (i + 1 > size / sizeof(*args)) + { + FIXME( "%u args not supported\n", i ); + RpcRaiseException( RPC_S_INTERNAL_ERROR ); + } + + args[i].stack_offset = stack_offset; + memset( &args[i].attr, 0, sizeof(args[i].attr) ); + + switch (param->param_direction) + { + case RPC_FC_IN_PARAM_BASETYPE: + args[i].attr.IsIn = 1; + args[i].attr.IsBasetype = 1; + break; + case RPC_FC_RETURN_PARAM_BASETYPE: + args[i].attr.IsOut = 1; + args[i].attr.IsReturn = 1; + args[i].attr.IsBasetype = 1; + break; + case RPC_FC_IN_PARAM: + args[i].attr.IsIn = 1; + args[i].attr.MustFree = 1; + break; + case RPC_FC_IN_PARAM_NO_FREE_INST: + args[i].attr.IsIn = 1; + args[i].attr.IsDontCallFreeInst = 1; + break; + case RPC_FC_IN_OUT_PARAM: + args[i].attr.IsIn = 1; + args[i].attr.IsOut = 1; + args[i].attr.MustFree = 1; + break; + case RPC_FC_OUT_PARAM: + args[i].attr.IsOut = 1; + break; + case RPC_FC_RETURN_PARAM: + args[i].attr.IsOut = 1; + args[i].attr.IsReturn = 1; + break; + } + if (args[i].attr.IsBasetype) + { + args[i].u.type_format_char = param->type_format_char; + stack_offset += type_stack_size( param->type_format_char ); + pFormat += sizeof(NDR_PARAM_OI_BASETYPE); + } + else + { + args[i].u.type_offset = other->type_offset; + args[i].attr.IsByValue = is_by_value( &pStubMsg->StubDesc->pFormatTypes[other->type_offset] ); + stack_offset += other->stack_size * sizeof(void *); + pFormat += sizeof(NDR_PARAM_OI_OTHER); + } + } + *count = i; + return (PFORMAT_STRING)args; +} + +LONG_PTR CDECL ndr_client_call( PMIDL_STUB_DESC pStubDesc, PFORMAT_STRING pFormat, + void **stack_top, void **fpu_stack ) { /* pointer to start of stack where arguments start */ RPC_MESSAGE rpcMsg; @@ -559,24 +596,20 @@ CLIENT_CALL_RETURN WINAPIV NdrClientCall2(PMIDL_STUB_DESC pStubDesc, PFORMAT_STR /* size of stack */ unsigned short stack_size; /* number of parameters. optional for client to give it to us */ - unsigned char number_of_params = ~0; + unsigned int number_of_params; /* cache of Oif_flags from v2 procedure header */ INTERPRETER_OPT_FLAGS Oif_flags = { 0 }; /* cache of extension flags from NDR_PROC_HEADER_EXTS */ INTERPRETER_OPT_FLAGS2 ext_flags = { 0 }; - /* the type of pass we are currently doing */ - int phase; /* header for procedure string */ const NDR_PROC_HEADER * pProcHeader = (const NDR_PROC_HEADER *)&pFormat[0]; - /* -Oif or -Oicf generated format */ - BOOL bV2Format = FALSE; /* the value to return to the client from the remote procedure */ - CLIENT_CALL_RETURN RetVal = {0}; + LONG_PTR RetVal = 0; /* the pointer to the object when in OLE mode */ void * This = NULL; PFORMAT_STRING pHandleFormat; /* correlation cache */ - unsigned long NdrCorrCache[256]; + ULONG_PTR NdrCorrCache[256]; TRACE("pStubDesc %p, pFormat %p, ...\n", pStubDesc, pFormat); @@ -605,7 +638,7 @@ CLIENT_CALL_RETURN WINAPIV NdrClientCall2(PMIDL_STUB_DESC pStubDesc, PFORMAT_STR if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_OBJECT) { /* object is always the first argument */ - This = **(void *const **)(&pFormat+1); + This = stack_top[0]; NdrProxyInitialize(This, &rpcMsg, &stubMsg, pStubDesc, procedure_number); } else @@ -614,25 +647,17 @@ CLIENT_CALL_RETURN WINAPIV NdrClientCall2(PMIDL_STUB_DESC pStubDesc, PFORMAT_STR TRACE("Oi_flags = 0x%02x\n", pProcHeader->Oi_flags); TRACE("MIDL stub version = 0x%x\n", pStubDesc->MIDLVersion); - /* needed for conformance of top-level objects */ -#ifdef __i386__ - stubMsg.StackTop = *(unsigned char **)(&pFormat+1); -#else -# warning Stack not retrieved for your CPU architecture -#endif - + stubMsg.StackTop = (unsigned char *)stack_top; pHandleFormat = pFormat; /* we only need a handle if this isn't an object method */ if (!(pProcHeader->Oi_flags & RPC_FC_PROC_OIF_OBJECT)) { pFormat = client_get_handle(&stubMsg, pProcHeader, pHandleFormat, &hBinding); - if (!pFormat) return RetVal; + if (!pFormat) goto done; } - bV2Format = (pStubDesc->Version >= 0x20000); - - if (bV2Format) + if (pStubDesc->Version >= 0x20000) /* -Oicf format */ { const NDR_PROC_PARTIAL_OIF_HEADER *pOIFHeader = (const NDR_PROC_PARTIAL_OIF_HEADER *)pFormat; @@ -641,16 +666,35 @@ CLIENT_CALL_RETURN WINAPIV NdrClientCall2(PMIDL_STUB_DESC pStubDesc, PFORMAT_STR number_of_params = pOIFHeader->number_of_params; pFormat += sizeof(NDR_PROC_PARTIAL_OIF_HEADER); + + TRACE("Oif_flags = %s\n", debugstr_INTERPRETER_OPT_FLAGS(Oif_flags) ); + + if (Oif_flags.HasExtensions) + { + const NDR_PROC_HEADER_EXTS *pExtensions = (const NDR_PROC_HEADER_EXTS *)pFormat; + ext_flags = pExtensions->Flags2; + pFormat += pExtensions->Size; +#ifdef __x86_64__ + if (pExtensions->Size > sizeof(*pExtensions) && fpu_stack) + { + int i; + unsigned short fpu_mask = *(unsigned short *)(pExtensions + 1); + for (i = 0; i < 4; i++, fpu_mask >>= 2) + switch (fpu_mask & 3) + { + case 1: *(float *)&stack_top[i] = *(float *)&fpu_stack[i]; break; + case 2: *(double *)&stack_top[i] = *(double *)&fpu_stack[i]; break; + } + } +#endif + } } - - TRACE("Oif_flags = "); dump_INTERPRETER_OPT_FLAGS(Oif_flags); - - if (Oif_flags.HasExtensions) + else { - const NDR_PROC_HEADER_EXTS *pExtensions = - (const NDR_PROC_HEADER_EXTS *)pFormat; - ext_flags = pExtensions->Flags2; - pFormat += pExtensions->Size; + pFormat = convert_old_args( &stubMsg, pFormat, stack_size, + pProcHeader->Oi_flags & RPC_FC_PROC_OIF_OBJECT, + /* reuse the correlation cache, it's not needed for v1 format */ + NdrCorrCache, sizeof(NdrCorrCache), &number_of_params ); } stubMsg.BufferLength = 0; @@ -677,74 +721,41 @@ CLIENT_CALL_RETURN WINAPIV NdrClientCall2(PMIDL_STUB_DESC pStubDesc, PFORMAT_STR } /* order of phases: - * 1. PROXY_CALCSIZE - calculate the buffer size - * 2. PROXY_GETBUFFER - allocate the buffer - * 3. PROXY_MARHSAL - marshal [in] params into the buffer - * 4. PROXY_SENDRECEIVE - send/receive buffer - * 5. PROXY_UNMARHSAL - unmarshal [out] params from buffer + * 1. INITOUT - zero [out] parameters (proxies only) + * 2. CALCSIZE - calculate the buffer size + * 3. GETBUFFER - allocate the buffer + * 4. MARSHAL - marshal [in] params into the buffer + * 5. SENDRECEIVE - send/receive buffer + * 6. UNMARSHAL - unmarshal [out] params from buffer + * 7. FREE - clear [out] parameters (for proxies, and only on error) */ - if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_OBJECT) + if ((pProcHeader->Oi_flags & RPC_FC_PROC_OIF_OBJECT) || + (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_HAS_COMM_OR_FAULT)) { + /* 1. INITOUT */ + if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_OBJECT) + { + TRACE( "INITOUT\n" ); + client_do_args(&stubMsg, pFormat, STUBLESS_INITOUT, fpu_stack, + number_of_params, (unsigned char *)&RetVal); + } + __TRY { - for (phase = PROXY_CALCSIZE; phase <= PROXY_UNMARSHAL; phase++) + /* 2. CALCSIZE */ + TRACE( "CALCSIZE\n" ); + client_do_args(&stubMsg, pFormat, STUBLESS_CALCSIZE, fpu_stack, + number_of_params, (unsigned char *)&RetVal); + + /* 3. GETBUFFER */ + TRACE( "GETBUFFER\n" ); + if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_OBJECT) { - TRACE("phase = %d\n", phase); - switch (phase) - { - case PROXY_GETBUFFER: - /* allocate the buffer */ - NdrProxyGetBuffer(This, &stubMsg); - break; - case PROXY_SENDRECEIVE: - /* send the [in] params and receive the [out] and [retval] - * params */ - NdrProxySendReceive(This, &stubMsg); - - /* convert strings, floating point values and endianess into our - * preferred format */ - if ((rpcMsg.DataRepresentation & 0x0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION) - NdrConvert(&stubMsg, pFormat); - - break; - case PROXY_CALCSIZE: - case PROXY_MARSHAL: - case PROXY_UNMARSHAL: - if (bV2Format) - client_do_args(&stubMsg, pFormat, phase, stubMsg.StackTop, - number_of_params, (unsigned char *)&RetVal); - else - client_do_args_old_format(&stubMsg, pFormat, phase, - stubMsg.StackTop, stack_size, (unsigned char *)&RetVal, - (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_OBJECT), FALSE); - break; - default: - ERR("shouldn't reach here. phase %d\n", phase); - break; - } + /* allocate the buffer */ + NdrProxyGetBuffer(This, &stubMsg); } - } - __EXCEPT_ALL - { - RetVal.Simple = NdrProxyErrorHandler(GetExceptionCode()); - } - __ENDTRY - } - else - { - /* order of phases: - * 1. PROXY_CALCSIZE - calculate the buffer size - * 2. PROXY_GETBUFFER - allocate the buffer - * 3. PROXY_MARHSAL - marshal [in] params into the buffer - * 4. PROXY_SENDRECEIVE - send/receive buffer - * 5. PROXY_UNMARHSAL - unmarshal [out] params from buffer - */ - for (phase = PROXY_CALCSIZE; phase <= PROXY_UNMARSHAL; phase++) - { - TRACE("phase = %d\n", phase); - switch (phase) + else { - case PROXY_GETBUFFER: /* allocate the buffer */ if (Oif_flags.HasPipes) /* NdrGetPipeBuffer(...) */ @@ -755,13 +766,28 @@ CLIENT_CALL_RETURN WINAPIV NdrClientCall2(PMIDL_STUB_DESC pStubDesc, PFORMAT_STR #if 0 NdrNsGetBuffer(&stubMsg, stubMsg.BufferLength, hBinding); #else - FIXME("using auto handle - call NdrNsGetBuffer when it gets implemented\n"); + FIXME("using auto handle - call NdrNsGetBuffer when it gets implemented\n"); #endif else NdrGetBuffer(&stubMsg, stubMsg.BufferLength, hBinding); } - break; - case PROXY_SENDRECEIVE: + } + + /* 4. MARSHAL */ + TRACE( "MARSHAL\n" ); + client_do_args(&stubMsg, pFormat, STUBLESS_MARSHAL, fpu_stack, + number_of_params, (unsigned char *)&RetVal); + + /* 5. SENDRECEIVE */ + TRACE( "SENDRECEIVE\n" ); + if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_OBJECT) + { + /* send the [in] params and receive the [out] and [retval] + * params */ + NdrProxySendReceive(This, &stubMsg); + } + else + { /* send the [in] params and receive the [out] and [retval] * params */ if (Oif_flags.HasPipes) @@ -773,34 +799,116 @@ CLIENT_CALL_RETURN WINAPIV NdrClientCall2(PMIDL_STUB_DESC pStubDesc, PFORMAT_STR #if 0 NdrNsSendReceive(&stubMsg, stubMsg.Buffer, pStubDesc->IMPLICIT_HANDLE_INFO.pAutoHandle); #else - FIXME("using auto handle - call NdrNsSendReceive when it gets implemented\n"); + FIXME("using auto handle - call NdrNsSendReceive when it gets implemented\n"); #endif else NdrSendReceive(&stubMsg, stubMsg.Buffer); } + } - /* convert strings, floating point values and endianess into our - * preferred format */ - if ((rpcMsg.DataRepresentation & 0x0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION) - NdrConvert(&stubMsg, pFormat); + /* convert strings, floating point values and endianess into our + * preferred format */ + if ((rpcMsg.DataRepresentation & 0x0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION) + NdrConvert(&stubMsg, pFormat); - break; - case PROXY_CALCSIZE: - case PROXY_MARSHAL: - case PROXY_UNMARSHAL: - if (bV2Format) - client_do_args(&stubMsg, pFormat, phase, stubMsg.StackTop, - number_of_params, (unsigned char *)&RetVal); + /* 6. UNMARSHAL */ + TRACE( "UNMARSHAL\n" ); + client_do_args(&stubMsg, pFormat, STUBLESS_UNMARSHAL, fpu_stack, + number_of_params, (unsigned char *)&RetVal); + } + __EXCEPT_ALL + { + if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_OBJECT) + { + /* 7. FREE */ + TRACE( "FREE\n" ); + client_do_args(&stubMsg, pFormat, STUBLESS_FREE, fpu_stack, + number_of_params, (unsigned char *)&RetVal); + RetVal = NdrProxyErrorHandler(GetExceptionCode()); + } + else + { + const COMM_FAULT_OFFSETS *comm_fault_offsets = &pStubDesc->CommFaultOffsets[procedure_number]; + ULONG *comm_status; + ULONG *fault_status; + + TRACE("comm_fault_offsets = {0x%hx, 0x%hx}\n", comm_fault_offsets->CommOffset, comm_fault_offsets->FaultOffset); + + if (comm_fault_offsets->CommOffset == -1) + comm_status = (ULONG *)&RetVal; + else if (comm_fault_offsets->CommOffset >= 0) + comm_status = *(ULONG **)ARG_FROM_OFFSET(stubMsg.StackTop, comm_fault_offsets->CommOffset); else - client_do_args_old_format(&stubMsg, pFormat, phase, - stubMsg.StackTop, stack_size, (unsigned char *)&RetVal, - (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_OBJECT), FALSE); - break; - default: - ERR("shouldn't reach here. phase %d\n", phase); - break; + comm_status = NULL; + + if (comm_fault_offsets->FaultOffset == -1) + fault_status = (ULONG *)&RetVal; + else if (comm_fault_offsets->FaultOffset >= 0) + fault_status = *(ULONG **)ARG_FROM_OFFSET(stubMsg.StackTop, comm_fault_offsets->CommOffset); + else + fault_status = NULL; + + NdrMapCommAndFaultStatus(&stubMsg, comm_status, fault_status, + GetExceptionCode()); } } + __ENDTRY + } + else + { + /* 2. CALCSIZE */ + TRACE( "CALCSIZE\n" ); + client_do_args(&stubMsg, pFormat, STUBLESS_CALCSIZE, fpu_stack, + number_of_params, (unsigned char *)&RetVal); + + /* 3. GETBUFFER */ + TRACE( "GETBUFFER\n" ); + if (Oif_flags.HasPipes) + /* NdrGetPipeBuffer(...) */ + FIXME("pipes not supported yet\n"); + else + { + if (pProcHeader->handle_type == RPC_FC_AUTO_HANDLE) +#if 0 + NdrNsGetBuffer(&stubMsg, stubMsg.BufferLength, hBinding); +#else + FIXME("using auto handle - call NdrNsGetBuffer when it gets implemented\n"); +#endif + else + NdrGetBuffer(&stubMsg, stubMsg.BufferLength, hBinding); + } + + /* 4. MARSHAL */ + TRACE( "MARSHAL\n" ); + client_do_args(&stubMsg, pFormat, STUBLESS_MARSHAL, fpu_stack, + number_of_params, (unsigned char *)&RetVal); + + /* 5. SENDRECEIVE */ + TRACE( "SENDRECEIVE\n" ); + if (Oif_flags.HasPipes) + /* NdrPipesSendReceive(...) */ + FIXME("pipes not supported yet\n"); + else + { + if (pProcHeader->handle_type == RPC_FC_AUTO_HANDLE) +#if 0 + NdrNsSendReceive(&stubMsg, stubMsg.Buffer, pStubDesc->IMPLICIT_HANDLE_INFO.pAutoHandle); +#else + FIXME("using auto handle - call NdrNsSendReceive when it gets implemented\n"); +#endif + else + NdrSendReceive(&stubMsg, stubMsg.Buffer); + } + + /* convert strings, floating point values and endianness into our + * preferred format */ + if ((rpcMsg.DataRepresentation & 0x0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION) + NdrConvert(&stubMsg, pFormat); + + /* 6. UNMARSHAL */ + TRACE( "UNMARSHAL\n" ); + client_do_args(&stubMsg, pFormat, STUBLESS_UNMARSHAL, fpu_stack, + number_of_params, (unsigned char *)&RetVal); } if (ext_flags.HasNewCorrDesc) @@ -827,11 +935,43 @@ CLIENT_CALL_RETURN WINAPIV NdrClientCall2(PMIDL_STUB_DESC pStubDesc, PFORMAT_STR client_free_handle(&stubMsg, pProcHeader, pHandleFormat, hBinding); } - TRACE("RetVal = 0x%p\n", RetVal.Pointer); - +done: + TRACE("RetVal = 0x%lx\n", RetVal); return RetVal; } +#ifdef __x86_64__ + +__ASM_GLOBAL_FUNC( NdrClientCall2, + "movq %r8,0x18(%rsp)\n\t" + "movq %r9,0x20(%rsp)\n\t" + "leaq 0x18(%rsp),%r8\n\t" + "xorq %r9,%r9\n\t" + "subq $0x28,%rsp\n\t" + __ASM_CFI(".cfi_adjust_cfa_offset 0x28\n\t") + "call " __ASM_NAME("ndr_client_call") "\n\t" + "addq $0x28,%rsp\n\t" + __ASM_CFI(".cfi_adjust_cfa_offset -0x28\n\t") + "ret" ); + +#else /* __x86_64__ */ + +/*********************************************************************** + * NdrClientCall2 [RPCRT4.@] + */ +CLIENT_CALL_RETURN WINAPIV NdrClientCall2( PMIDL_STUB_DESC desc, PFORMAT_STRING format, ... ) +{ + __ms_va_list args; + LONG_PTR ret; + + __ms_va_start( args, format ); + ret = ndr_client_call( desc, format, va_arg( args, void ** ), NULL ); + __ms_va_end( args ); + return *(CLIENT_CALL_RETURN *)&ret; +} + +#endif /* __x86_64__ */ + /* Calls a function with the specified arguments, restoring the stack * properly afterwards as we don't know the calling convention of the * function */ @@ -841,11 +981,12 @@ __declspec(naked) LONG_PTR __cdecl call_server_func(SERVER_ROUTINE func, unsigne __asm { push ebp + mov ebp, esp push edi ; Save registers push esi - mov ebp, esp mov eax, [ebp+16] ; Get stack size sub esp, eax ; Make room in stack for arguments + and esp, 0xFFFFFFF0 mov edi, esp mov ecx, eax mov esi, [ebp+12] @@ -864,9 +1005,14 @@ __declspec(naked) LONG_PTR __cdecl call_server_func(SERVER_ROUTINE func, unsigne LONG_PTR __cdecl call_server_func(SERVER_ROUTINE func, unsigned char * args, unsigned int stack_size); __ASM_GLOBAL_FUNC(call_server_func, "pushl %ebp\n\t" - "movl %esp, %ebp\n\t" + __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t") + __ASM_CFI(".cfi_rel_offset %ebp,0\n\t") + "movl %esp,%ebp\n\t" + __ASM_CFI(".cfi_def_cfa_register %ebp\n\t") "pushl %edi\n\t" /* Save registers */ + __ASM_CFI(".cfi_rel_offset %edi,-4\n\t") "pushl %esi\n\t" + __ASM_CFI(".cfi_rel_offset %esi,-8\n\t") "movl 16(%ebp), %eax\n\t" /* Get stack size */ "subl %eax, %esp\n\t" /* Make room in stack for arguments */ "andl $~15, %esp\n\t" /* Make sure stack has 16-byte alignment for Mac OS X */ @@ -879,9 +1025,55 @@ __ASM_GLOBAL_FUNC(call_server_func, "call *8(%ebp)\n\t" /* Call function */ "leal -8(%ebp), %esp\n\t" /* Restore stack */ "popl %esi\n\t" /* Restore registers */ + __ASM_CFI(".cfi_same_value %esi\n\t") "popl %edi\n\t" + __ASM_CFI(".cfi_same_value %edi\n\t") "popl %ebp\n\t" - "ret\n" ) + __ASM_CFI(".cfi_def_cfa %esp,4\n\t") + __ASM_CFI(".cfi_same_value %ebp\n\t") + "ret" ) +#elif defined __x86_64__ +LONG_PTR __cdecl call_server_func(SERVER_ROUTINE func, unsigned char * args, unsigned int stack_size); +__ASM_GLOBAL_FUNC( call_server_func, + "pushq %rbp\n\t" + __ASM_CFI(".cfi_adjust_cfa_offset 8\n\t") + __ASM_CFI(".cfi_rel_offset %rbp,0\n\t") + "movq %rsp,%rbp\n\t" + __ASM_CFI(".cfi_def_cfa_register %rbp\n\t") + "pushq %rsi\n\t" + __ASM_CFI(".cfi_rel_offset %rsi,-8\n\t") + "pushq %rdi\n\t" + __ASM_CFI(".cfi_rel_offset %rdi,-16\n\t") + "movq %rcx,%rax\n\t" /* function to call */ + "movq $32,%rcx\n\t" /* allocate max(32,stack_size) bytes of stack space */ + "cmpq %rcx,%r8\n\t" + "cmovgq %r8,%rcx\n\t" + "subq %rcx,%rsp\n\t" + "andq $~15,%rsp\n\t" + "movq %r8,%rcx\n\t" + "shrq $3,%rcx\n\t" + "movq %rsp,%rdi\n\t" + "movq %rdx,%rsi\n\t" + "rep; movsq\n\t" /* copy arguments */ + "movq 0(%rsp),%rcx\n\t" + "movq 8(%rsp),%rdx\n\t" + "movq 16(%rsp),%r8\n\t" + "movq 24(%rsp),%r9\n\t" + "movq %rcx,%xmm0\n\t" + "movq %rdx,%xmm1\n\t" + "movq %r8,%xmm2\n\t" + "movq %r9,%xmm3\n\t" + "callq *%rax\n\t" + "leaq -16(%rbp),%rsp\n\t" /* restore stack */ + "popq %rdi\n\t" + __ASM_CFI(".cfi_same_value %rdi\n\t") + "popq %rsi\n\t" + __ASM_CFI(".cfi_same_value %rsi\n\t") + __ASM_CFI(".cfi_def_cfa_register %rsp\n\t") + "popq %rbp\n\t" + __ASM_CFI(".cfi_adjust_cfa_offset -8\n\t") + __ASM_CFI(".cfi_same_value %rbp\n\t") + "ret") #else #warning call_server_func not implemented for your architecture LONG_PTR __cdecl call_server_func(SERVER_ROUTINE func, unsigned char * args, unsigned short stack_size) @@ -891,344 +1083,90 @@ LONG_PTR __cdecl call_server_func(SERVER_ROUTINE func, unsigned char * args, uns } #endif -static DWORD calc_arg_size(MIDL_STUB_MESSAGE *pStubMsg, PFORMAT_STRING pFormat) -{ - DWORD size; - switch(*pFormat) - { - case RPC_FC_STRUCT: - size = *(const WORD*)(pFormat + 2); - break; - case RPC_FC_CARRAY: - size = *(const WORD*)(pFormat + 2); - ComputeConformance(pStubMsg, NULL, pFormat + 4, 0); - size *= pStubMsg->MaxCount; - break; - case RPC_FC_SMFARRAY: - size = *(const WORD*)(pFormat + 2); - break; - case RPC_FC_LGFARRAY: - size = *(const DWORD*)(pFormat + 2); - break; - case RPC_FC_BOGUS_ARRAY: - pFormat = ComputeConformance(pStubMsg, NULL, pFormat + 4, *(const WORD*)&pFormat[2]); - TRACE("conformance = %ld\n", pStubMsg->MaxCount); - pFormat = ComputeVariance(pStubMsg, NULL, pFormat, pStubMsg->MaxCount); - size = ComplexStructSize(pStubMsg, pFormat); - size *= pStubMsg->MaxCount; - break; - default: - FIXME("Unhandled type %02x\n", *pFormat); - /* fallthrough */ - case RPC_FC_RP: - size = sizeof(void *); - break; - } - return size; -} - static LONG_PTR *stub_do_args(MIDL_STUB_MESSAGE *pStubMsg, - PFORMAT_STRING pFormat, int phase, - unsigned char *args, + PFORMAT_STRING pFormat, enum stubless_phase phase, unsigned short number_of_params) { - /* counter */ - unsigned short i; - /* current format string offset */ - int current_offset = 0; - /* current stack offset */ - unsigned short current_stack_offset = 0; - /* location to put retval into */ + const NDR_PARAM_OIF *params = (const NDR_PARAM_OIF *)pFormat; + unsigned int i; LONG_PTR *retval_ptr = NULL; for (i = 0; i < number_of_params; i++) { - const NDR_PARAM_OIF_BASETYPE *pParam = - (const NDR_PARAM_OIF_BASETYPE *)&pFormat[current_offset]; - unsigned char *pArg; + unsigned char *pArg = pStubMsg->StackTop + params[i].stack_offset; + const unsigned char *pTypeFormat = &pStubMsg->StubDesc->pFormatTypes[params[i].u.type_offset]; - current_stack_offset = pParam->stack_offset; - pArg = args + current_stack_offset; + TRACE("param[%d]: %p -> %p type %02x %s\n", i, + pArg, *(unsigned char **)pArg, + params[i].attr.IsBasetype ? params[i].u.type_format_char : *pTypeFormat, + debugstr_PROC_PF( params[i].attr )); - TRACE("param[%d]: new format\n", i); - TRACE("\tparam_attributes:"); dump_RPC_FC_PROC_PF(pParam->param_attributes); TRACE("\n"); - TRACE("\tstack_offset: 0x%x\n", current_stack_offset); - TRACE("\tmemory addr (before): %p -> %p\n", pArg, *(unsigned char **)pArg); - - if (pParam->param_attributes.IsBasetype) + switch (phase) { - const unsigned char *pTypeFormat = - &pParam->type_format_char; - - TRACE("\tbase type: 0x%02x\n", *pTypeFormat); - - /* make a note of the address of the return value parameter for later */ - if (pParam->param_attributes.IsReturn) - retval_ptr = (LONG_PTR *)pArg; - - switch (phase) + case STUBLESS_MARSHAL: + if (params[i].attr.IsOut || params[i].attr.IsReturn) + call_marshaller(pStubMsg, pArg, ¶ms[i]); + break; + case STUBLESS_FREE: + if (params[i].attr.MustFree) { - case STUBLESS_MARSHAL: - if (pParam->param_attributes.IsOut || pParam->param_attributes.IsReturn) - { - if (pParam->param_attributes.IsSimpleRef) - call_marshaller(pStubMsg, *(unsigned char **)pArg, pTypeFormat); - else - call_marshaller(pStubMsg, pArg, pTypeFormat); - } - break; - case STUBLESS_FREE: - if (pParam->param_attributes.ServerAllocSize) - HeapFree(GetProcessHeap(), 0, *(void **)pArg); - break; - case STUBLESS_INITOUT: - break; - case STUBLESS_UNMARSHAL: - if (pParam->param_attributes.ServerAllocSize) - *(void **)pArg = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, - pParam->param_attributes.ServerAllocSize * 8); - - if (pParam->param_attributes.IsIn) - { - if (pParam->param_attributes.IsSimpleRef) - call_unmarshaller(pStubMsg, (unsigned char **)pArg, pTypeFormat, 0); - else - call_unmarshaller(pStubMsg, &pArg, pTypeFormat, 0); - } - break; - case STUBLESS_CALCSIZE: - if (pParam->param_attributes.IsOut || pParam->param_attributes.IsReturn) - { - if (pParam->param_attributes.IsSimpleRef) - call_buffer_sizer(pStubMsg, *(unsigned char **)pArg, pTypeFormat); - else - call_buffer_sizer(pStubMsg, pArg, pTypeFormat); - } - break; - default: - RpcRaiseException(RPC_S_INTERNAL_ERROR); + call_freer(pStubMsg, pArg, ¶ms[i]); } - - current_offset += sizeof(NDR_PARAM_OIF_BASETYPE); - } - else - { - const NDR_PARAM_OIF_OTHER *pParamOther = - (const NDR_PARAM_OIF_OTHER *)&pFormat[current_offset]; - - const unsigned char * pTypeFormat = - &(pStubMsg->StubDesc->pFormatTypes[pParamOther->type_offset]); - - TRACE("\tcomplex type 0x%02x\n", *pTypeFormat); - - switch (phase) + else if (params[i].attr.ServerAllocSize) { - case STUBLESS_MARSHAL: - if (pParam->param_attributes.IsOut || pParam->param_attributes.IsReturn) - { - if (pParam->param_attributes.IsByValue) - call_marshaller(pStubMsg, pArg, pTypeFormat); - else - call_marshaller(pStubMsg, *(unsigned char **)pArg, pTypeFormat); - } - break; - case STUBLESS_FREE: - if (pParam->param_attributes.MustFree) - { - if (pParam->param_attributes.IsByValue) - call_freer(pStubMsg, pArg, pTypeFormat); - else - call_freer(pStubMsg, *(unsigned char **)pArg, pTypeFormat); - } - - if (pParam->param_attributes.IsOut && - !pParam->param_attributes.IsIn && - !pParam->param_attributes.IsByValue && - !pParam->param_attributes.ServerAllocSize) - { - pStubMsg->pfnFree(*(void **)pArg); - } - - if (pParam->param_attributes.ServerAllocSize) - HeapFree(GetProcessHeap(), 0, *(void **)pArg); - break; - case STUBLESS_INITOUT: - if (!pParam->param_attributes.IsIn && - pParam->param_attributes.IsOut && - !pParam->param_attributes.ServerAllocSize && - !pParam->param_attributes.IsByValue) - { - DWORD size = calc_arg_size(pStubMsg, pTypeFormat); - - if(size) - { - *(void **)pArg = NdrAllocate(pStubMsg, size); - memset(*(void **)pArg, 0, size); - } - } - break; - case STUBLESS_UNMARSHAL: - if (pParam->param_attributes.ServerAllocSize) - *(void **)pArg = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, - pParam->param_attributes.ServerAllocSize * 8); - - if (pParam->param_attributes.IsIn) - { - if (pParam->param_attributes.IsByValue) - call_unmarshaller(pStubMsg, &pArg, pTypeFormat, 0); - else - call_unmarshaller(pStubMsg, (unsigned char **)pArg, pTypeFormat, 0); - } - break; - case STUBLESS_CALCSIZE: - if (pParam->param_attributes.IsOut || pParam->param_attributes.IsReturn) - { - if (pParam->param_attributes.IsByValue) - call_buffer_sizer(pStubMsg, pArg, pTypeFormat); - else - call_buffer_sizer(pStubMsg, *(unsigned char **)pArg, pTypeFormat); - } - break; - default: - RpcRaiseException(RPC_S_INTERNAL_ERROR); + HeapFree(GetProcessHeap(), 0, *(void **)pArg); } + else if (params[i].attr.IsOut && + !params[i].attr.IsIn && + !params[i].attr.IsBasetype && + !params[i].attr.IsByValue) + { + if (*pTypeFormat != RPC_FC_BIND_CONTEXT) pStubMsg->pfnFree(*(void **)pArg); + } + break; + case STUBLESS_INITOUT: + if (!params[i].attr.IsIn && + params[i].attr.IsOut && + !params[i].attr.IsBasetype && + !params[i].attr.ServerAllocSize && + !params[i].attr.IsByValue) + { + if (*pTypeFormat == RPC_FC_BIND_CONTEXT) + { + NDR_SCONTEXT ctxt = NdrContextHandleInitialize(pStubMsg, pTypeFormat); + *(void **)pArg = NDRSContextValue(ctxt); + } + else + { + DWORD size = calc_arg_size(pStubMsg, pTypeFormat); + if (size) + { + *(void **)pArg = NdrAllocate(pStubMsg, size); + memset(*(void **)pArg, 0, size); + } + } + } + break; + case STUBLESS_UNMARSHAL: + if (params[i].attr.ServerAllocSize) + *(void **)pArg = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, + params[i].attr.ServerAllocSize * 8); - current_offset += sizeof(NDR_PARAM_OIF_OTHER); + if (params[i].attr.IsIn) + call_unmarshaller(pStubMsg, &pArg, ¶ms[i], 0); + break; + case STUBLESS_CALCSIZE: + if (params[i].attr.IsOut || params[i].attr.IsReturn) + call_buffer_sizer(pStubMsg, pArg, ¶ms[i]); + break; + default: + RpcRaiseException(RPC_S_INTERNAL_ERROR); } TRACE("\tmemory addr (after): %p -> %p\n", pArg, *(unsigned char **)pArg); + + /* make a note of the address of the return value parameter for later */ + if (params[i].attr.IsReturn) retval_ptr = (LONG_PTR *)pArg; } - - return retval_ptr; -} - -static LONG_PTR *stub_do_old_args(MIDL_STUB_MESSAGE *pStubMsg, - PFORMAT_STRING pFormat, int phase, - unsigned char *args, - unsigned short stack_size, BOOL object) -{ - /* counter */ - unsigned short i; - /* current format string offset */ - int current_offset = 0; - /* current stack offset */ - unsigned short current_stack_offset = 0; - /* location to put retval into */ - LONG_PTR *retval_ptr = NULL; - - for (i = 0; TRUE; i++) - { - const NDR_PARAM_OI_BASETYPE *pParam = - (const NDR_PARAM_OI_BASETYPE *)&pFormat[current_offset]; - /* note: current_stack_offset starts after the This pointer - * if present, so adjust this */ - unsigned short current_stack_offset_adjusted = current_stack_offset + - (object ? sizeof(void *) : 0); - unsigned char *pArg = args + current_stack_offset_adjusted; - - /* no more parameters; exit loop */ - if (current_stack_offset_adjusted >= stack_size) - break; - - TRACE("param[%d]: old format\n", i); - TRACE("\tparam_direction: 0x%x\n", pParam->param_direction); - TRACE("\tstack_offset: 0x%x\n", current_stack_offset_adjusted); - - if (pParam->param_direction == RPC_FC_IN_PARAM_BASETYPE || - pParam->param_direction == RPC_FC_RETURN_PARAM_BASETYPE) - { - const unsigned char *pTypeFormat = - &pParam->type_format_char; - - TRACE("\tbase type 0x%02x\n", *pTypeFormat); - - if (pParam->param_direction == RPC_FC_RETURN_PARAM_BASETYPE) - retval_ptr = (LONG_PTR *)pArg; - - switch (phase) - { - case STUBLESS_MARSHAL: - if (pParam->param_direction == RPC_FC_RETURN_PARAM_BASETYPE) - call_marshaller(pStubMsg, pArg, pTypeFormat); - break; - case STUBLESS_FREE: - if (pParam->param_direction == RPC_FC_IN_PARAM_BASETYPE) - call_freer(pStubMsg, pArg, pTypeFormat); - break; - case STUBLESS_UNMARSHAL: - if (pParam->param_direction == RPC_FC_IN_PARAM_BASETYPE) - call_unmarshaller(pStubMsg, &pArg, pTypeFormat, 0); - break; - case STUBLESS_CALCSIZE: - if (pParam->param_direction == RPC_FC_RETURN_PARAM_BASETYPE) - call_buffer_sizer(pStubMsg, pArg, pTypeFormat); - break; - default: - RpcRaiseException(RPC_S_INTERNAL_ERROR); - } - - current_stack_offset += type_stack_size(*pTypeFormat); - current_offset += sizeof(NDR_PARAM_OI_BASETYPE); - } - else - { - const NDR_PARAM_OI_OTHER *pParamOther = - (const NDR_PARAM_OI_OTHER *)&pFormat[current_offset]; - - const unsigned char * pTypeFormat = - &pStubMsg->StubDesc->pFormatTypes[pParamOther->type_offset]; - - TRACE("\tcomplex type 0x%02x\n", *pTypeFormat); - - if (pParam->param_direction == RPC_FC_RETURN_PARAM) - retval_ptr = (LONG_PTR *)pArg; - - switch (phase) - { - case STUBLESS_MARSHAL: - if (pParam->param_direction == RPC_FC_OUT_PARAM || - pParam->param_direction == RPC_FC_IN_OUT_PARAM || - pParam->param_direction == RPC_FC_RETURN_PARAM) - call_marshaller(pStubMsg, *(unsigned char **)pArg, pTypeFormat); - break; - case STUBLESS_FREE: - if (pParam->param_direction == RPC_FC_IN_OUT_PARAM || - pParam->param_direction == RPC_FC_IN_PARAM) - call_freer(pStubMsg, *(unsigned char **)pArg, pTypeFormat); - else if (pParam->param_direction == RPC_FC_OUT_PARAM) - pStubMsg->pfnFree(*(void **)pArg); - break; - case STUBLESS_INITOUT: - if (pParam->param_direction == RPC_FC_OUT_PARAM) - { - DWORD size = calc_arg_size(pStubMsg, pTypeFormat); - - if(size) - { - *(void **)pArg = NdrAllocate(pStubMsg, size); - memset(*(void **)pArg, 0, size); - } - } - break; - case STUBLESS_UNMARSHAL: - if (pParam->param_direction == RPC_FC_IN_OUT_PARAM || - pParam->param_direction == RPC_FC_IN_PARAM) - call_unmarshaller(pStubMsg, (unsigned char **)pArg, pTypeFormat, 0); - break; - case STUBLESS_CALCSIZE: - if (pParam->param_direction == RPC_FC_OUT_PARAM || - pParam->param_direction == RPC_FC_IN_OUT_PARAM || - pParam->param_direction == RPC_FC_RETURN_PARAM) - call_buffer_sizer(pStubMsg, *(unsigned char **)pArg, pTypeFormat); - break; - default: - RpcRaiseException(RPC_S_INTERNAL_ERROR); - } - - current_stack_offset += pParamOther->stack_size * sizeof(INT); - current_offset += sizeof(NDR_PARAM_OI_OTHER); - } - } - return retval_ptr; } @@ -1256,23 +1194,19 @@ LONG WINAPI NdrStubCall2( /* size of stack */ unsigned short stack_size; /* number of parameters. optional for client to give it to us */ - unsigned char number_of_params = ~0; + unsigned int number_of_params; /* cache of Oif_flags from v2 procedure header */ INTERPRETER_OPT_FLAGS Oif_flags = { 0 }; /* cache of extension flags from NDR_PROC_HEADER_EXTS */ INTERPRETER_OPT_FLAGS2 ext_flags = { 0 }; /* the type of pass we are currently doing */ - int phase; + enum stubless_phase phase; /* header for procedure string */ const NDR_PROC_HEADER *pProcHeader; - /* offset in format string for start of params */ - int parameter_start_offset; - /* current format string offset */ - int current_offset; - /* -Oif or -Oicf generated format */ - BOOL bV2Format = FALSE; /* location to put retval into */ LONG_PTR *retval_ptr = NULL; + /* correlation cache */ + ULONG_PTR NdrCorrCache[256]; TRACE("pThis %p, pChannel %p, pRpcMsg %p, pdwStubPhase %p\n", pThis, pChannel, pRpcMsg, pdwStubPhase); @@ -1287,21 +1221,17 @@ LONG WINAPI NdrStubCall2( TRACE("NDR Version: 0x%x\n", pStubDesc->Version); - /* create the full pointer translation tables, if requested */ - if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_FULLPTR) - stubMsg.FullPtrXlatTables = NdrFullPointerXlatInit(0,XLAT_SERVER); - if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_RPCFLAGS) { const NDR_PROC_HEADER_RPC *pProcHeader = (const NDR_PROC_HEADER_RPC *)&pFormat[0]; stack_size = pProcHeader->stack_size; - current_offset = sizeof(NDR_PROC_HEADER_RPC); + pFormat += sizeof(NDR_PROC_HEADER_RPC); } else { stack_size = pProcHeader->stack_size; - current_offset = sizeof(NDR_PROC_HEADER); + pFormat += sizeof(NDR_PROC_HEADER); } TRACE("Oi_flags = 0x%02x\n", pProcHeader->Oi_flags); @@ -1311,16 +1241,16 @@ LONG WINAPI NdrStubCall2( { /* explicit binding: parse additional section */ case RPC_FC_BIND_EXPLICIT: - switch (pFormat[current_offset]) /* handle_type */ + switch (*pFormat) /* handle_type */ { case RPC_FC_BIND_PRIMITIVE: /* explicit primitive */ - current_offset += sizeof(NDR_EHD_PRIMITIVE); + pFormat += sizeof(NDR_EHD_PRIMITIVE); break; case RPC_FC_BIND_GENERIC: /* explicit generic */ - current_offset += sizeof(NDR_EHD_GENERIC); + pFormat += sizeof(NDR_EHD_GENERIC); break; case RPC_FC_BIND_CONTEXT: /* explicit context */ - current_offset += sizeof(NDR_EHD_CONTEXT); + pFormat += sizeof(NDR_EHD_CONTEXT); break; default: ERR("bad explicit binding handle type (0x%02x)\n", pProcHeader->handle_type); @@ -1337,34 +1267,15 @@ LONG WINAPI NdrStubCall2( RpcRaiseException(RPC_X_BAD_STUB_DATA); } - bV2Format = (pStubDesc->Version >= 0x20000); - - if (bV2Format) - { - const NDR_PROC_PARTIAL_OIF_HEADER *pOIFHeader = - (const NDR_PROC_PARTIAL_OIF_HEADER *)&pFormat[current_offset]; - - Oif_flags = pOIFHeader->Oi2Flags; - number_of_params = pOIFHeader->number_of_params; - - current_offset += sizeof(NDR_PROC_PARTIAL_OIF_HEADER); - } - - TRACE("Oif_flags = "); dump_INTERPRETER_OPT_FLAGS(Oif_flags); - - if (Oif_flags.HasExtensions) - { - const NDR_PROC_HEADER_EXTS *pExtensions = - (const NDR_PROC_HEADER_EXTS *)&pFormat[current_offset]; - ext_flags = pExtensions->Flags2; - current_offset += pExtensions->Size; - } - if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_OBJECT) NdrStubInitialize(pRpcMsg, &stubMsg, pStubDesc, pChannel); else NdrServerInitializeNew(pRpcMsg, &stubMsg, pStubDesc); + /* create the full pointer translation tables, if requested */ + if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_FULLPTR) + stubMsg.FullPtrXlatTables = NdrFullPointerXlatInit(0,XLAT_SERVER); + /* store the RPC flags away */ if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_RPCFLAGS) pRpcMsg->RpcFlags = ((const NDR_PROC_HEADER_RPC *)pProcHeader)->rpc_flags; @@ -1377,27 +1288,6 @@ LONG WINAPI NdrStubCall2( FIXME("Set RPCSS memory allocation routines\n"); #endif - if (Oif_flags.HasPipes) - { - FIXME("pipes not supported yet\n"); - RpcRaiseException(RPC_X_WRONG_STUB_VERSION); /* FIXME: remove when implemented */ - /* init pipes package */ - /* NdrPipesInitialize(...) */ - } - if (ext_flags.HasNewCorrDesc) - { - /* initialize extra correlation package */ - FIXME("new correlation description not implemented\n"); - stubMsg.fHasNewCorrDesc = TRUE; - } - - /* convert strings, floating point values and endianess into our - * preferred format */ - if ((pRpcMsg->DataRepresentation & 0x0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION) - NdrConvert(&stubMsg, pFormat); - - parameter_start_offset = current_offset; - TRACE("allocating memory for stack of size %x\n", stack_size); args = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, stack_size); @@ -1408,13 +1298,51 @@ LONG WINAPI NdrStubCall2( if (pThis) *(void **)args = ((CStdStubBuffer *)pThis)->pvServerObject; - /* order of phases: - * 1. STUBLESS_UNMARHSAL - unmarshal [in] params from buffer - * 2. STUBLESS_CALLSERVER - send/receive buffer - * 3. STUBLESS_CALCSIZE - get [out] buffer size - * 4. STUBLESS_GETBUFFER - allocate [out] buffer - * 5. STUBLESS_MARHSAL - marshal [out] params to buffer - */ + if (pStubDesc->Version >= 0x20000) /* -Oicf format */ + { + const NDR_PROC_PARTIAL_OIF_HEADER *pOIFHeader = (const NDR_PROC_PARTIAL_OIF_HEADER *)pFormat; + + Oif_flags = pOIFHeader->Oi2Flags; + number_of_params = pOIFHeader->number_of_params; + + pFormat += sizeof(NDR_PROC_PARTIAL_OIF_HEADER); + + TRACE("Oif_flags = %s\n", debugstr_INTERPRETER_OPT_FLAGS(Oif_flags) ); + + if (Oif_flags.HasExtensions) + { + const NDR_PROC_HEADER_EXTS *pExtensions = (const NDR_PROC_HEADER_EXTS *)pFormat; + ext_flags = pExtensions->Flags2; + pFormat += pExtensions->Size; + } + + if (Oif_flags.HasPipes) + { + FIXME("pipes not supported yet\n"); + RpcRaiseException(RPC_X_WRONG_STUB_VERSION); /* FIXME: remove when implemented */ + /* init pipes package */ + /* NdrPipesInitialize(...) */ + } + if (ext_flags.HasNewCorrDesc) + { + /* initialize extra correlation package */ + FIXME("new correlation description not implemented\n"); + stubMsg.fHasNewCorrDesc = TRUE; + } + } + else + { + pFormat = convert_old_args( &stubMsg, pFormat, stack_size, + pProcHeader->Oi_flags & RPC_FC_PROC_OIF_OBJECT, + /* reuse the correlation cache, it's not needed for v1 format */ + NdrCorrCache, sizeof(NdrCorrCache), &number_of_params ); + } + + /* convert strings, floating point values and endianess into our + * preferred format */ + if ((pRpcMsg->DataRepresentation & 0x0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION) + NdrConvert(&stubMsg, pFormat); + for (phase = STUBLESS_UNMARSHAL; phase <= STUBLESS_FREE; phase++) { TRACE("phase = %d\n", phase); @@ -1462,7 +1390,7 @@ LONG WINAPI NdrStubCall2( pRpcMsg->BufferLength = stubMsg.BufferLength; /* allocate buffer for [out] and [ret] params */ - Status = I_RpcGetBuffer(pRpcMsg); + Status = I_RpcGetBuffer(pRpcMsg); if (Status) RpcRaiseException(Status); stubMsg.Buffer = pRpcMsg->Buffer; @@ -1473,14 +1401,7 @@ LONG WINAPI NdrStubCall2( case STUBLESS_CALCSIZE: case STUBLESS_MARSHAL: case STUBLESS_FREE: - if (bV2Format) - retval_ptr = stub_do_args(&stubMsg, &pFormat[parameter_start_offset], - phase, args, number_of_params); - else - retval_ptr = stub_do_old_args(&stubMsg, &pFormat[parameter_start_offset], - phase, args, stack_size, - (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_OBJECT)); - + retval_ptr = stub_do_args(&stubMsg, pFormat, phase, number_of_params); break; default: ERR("shouldn't reach here. phase %d\n", phase); @@ -1519,3 +1440,357 @@ void WINAPI NdrServerCall2(PRPC_MESSAGE pRpcMsg) DWORD dwPhase; NdrStubCall2(NULL, NULL, pRpcMsg, &dwPhase); } + +/*********************************************************************** + * NdrStubCall [RPCRT4.@] + */ +LONG WINAPI NdrStubCall( struct IRpcStubBuffer *This, struct IRpcChannelBuffer *channel, + PRPC_MESSAGE msg, DWORD *phase ) +{ + return NdrStubCall2( This, channel, msg, phase ); +} + +/*********************************************************************** + * NdrServerCall [RPCRT4.@] + */ +void WINAPI NdrServerCall( PRPC_MESSAGE msg ) +{ + DWORD phase; + NdrStubCall( NULL, NULL, msg, &phase ); +} + +struct async_call_data +{ + MIDL_STUB_MESSAGE *pStubMsg; + const NDR_PROC_HEADER *pProcHeader; + PFORMAT_STRING pHandleFormat; + PFORMAT_STRING pParamFormat; + RPC_BINDING_HANDLE hBinding; + /* size of stack */ + unsigned short stack_size; + /* number of parameters. optional for client to give it to us */ + unsigned int number_of_params; + /* correlation cache */ + ULONG_PTR NdrCorrCache[256]; +}; + +LONG_PTR CDECL ndr_async_client_call( PMIDL_STUB_DESC pStubDesc, PFORMAT_STRING pFormat, void **stack_top ) +{ + /* pointer to start of stack where arguments start */ + PRPC_MESSAGE pRpcMsg; + PMIDL_STUB_MESSAGE pStubMsg; + RPC_ASYNC_STATE *pAsync; + struct async_call_data *async_call_data; + /* procedure number */ + unsigned short procedure_number; + /* cache of Oif_flags from v2 procedure header */ + INTERPRETER_OPT_FLAGS Oif_flags = { 0 }; + /* cache of extension flags from NDR_PROC_HEADER_EXTS */ + INTERPRETER_OPT_FLAGS2 ext_flags = { 0 }; + /* header for procedure string */ + const NDR_PROC_HEADER * pProcHeader = (const NDR_PROC_HEADER *)&pFormat[0]; + /* -Oif or -Oicf generated format */ + BOOL bV2Format = FALSE; + RPC_STATUS status; + + TRACE("pStubDesc %p, pFormat %p, ...\n", pStubDesc, pFormat); + + /* Later NDR language versions probably won't be backwards compatible */ + if (pStubDesc->Version > 0x50002) + { + FIXME("Incompatible stub description version: 0x%x\n", pStubDesc->Version); + RpcRaiseException(RPC_X_WRONG_STUB_VERSION); + } + + async_call_data = I_RpcAllocate(sizeof(*async_call_data) + sizeof(MIDL_STUB_MESSAGE) + sizeof(RPC_MESSAGE)); + if (!async_call_data) RpcRaiseException(ERROR_OUTOFMEMORY); + async_call_data->pProcHeader = pProcHeader; + + async_call_data->pStubMsg = pStubMsg = (PMIDL_STUB_MESSAGE)(async_call_data + 1); + pRpcMsg = (PRPC_MESSAGE)(pStubMsg + 1); + + if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_RPCFLAGS) + { + const NDR_PROC_HEADER_RPC *pProcHeader = (const NDR_PROC_HEADER_RPC *)&pFormat[0]; + async_call_data->stack_size = pProcHeader->stack_size; + procedure_number = pProcHeader->proc_num; + pFormat += sizeof(NDR_PROC_HEADER_RPC); + } + else + { + async_call_data->stack_size = pProcHeader->stack_size; + procedure_number = pProcHeader->proc_num; + pFormat += sizeof(NDR_PROC_HEADER); + } + TRACE("stack size: 0x%x\n", async_call_data->stack_size); + TRACE("proc num: %d\n", procedure_number); + + /* create the full pointer translation tables, if requested */ + if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_FULLPTR) + pStubMsg->FullPtrXlatTables = NdrFullPointerXlatInit(0,XLAT_CLIENT); + + if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_OBJECT) + { + ERR("objects not supported\n"); + I_RpcFree(async_call_data); + RpcRaiseException(RPC_X_BAD_STUB_DATA); + } + + NdrClientInitializeNew(pRpcMsg, pStubMsg, pStubDesc, procedure_number); + + TRACE("Oi_flags = 0x%02x\n", pProcHeader->Oi_flags); + TRACE("MIDL stub version = 0x%x\n", pStubDesc->MIDLVersion); + + /* needed for conformance of top-level objects */ + pStubMsg->StackTop = I_RpcAllocate(async_call_data->stack_size); + memcpy(pStubMsg->StackTop, stack_top, async_call_data->stack_size); + + pAsync = *(RPC_ASYNC_STATE **)pStubMsg->StackTop; + pAsync->StubInfo = async_call_data; + async_call_data->pHandleFormat = pFormat; + + pFormat = client_get_handle(pStubMsg, pProcHeader, async_call_data->pHandleFormat, &async_call_data->hBinding); + if (!pFormat) goto done; + + bV2Format = (pStubDesc->Version >= 0x20000); + + if (bV2Format) + { + const NDR_PROC_PARTIAL_OIF_HEADER *pOIFHeader = + (const NDR_PROC_PARTIAL_OIF_HEADER *)pFormat; + + Oif_flags = pOIFHeader->Oi2Flags; + async_call_data->number_of_params = pOIFHeader->number_of_params; + + pFormat += sizeof(NDR_PROC_PARTIAL_OIF_HEADER); + + TRACE("Oif_flags = %s\n", debugstr_INTERPRETER_OPT_FLAGS(Oif_flags) ); + + if (Oif_flags.HasExtensions) + { + const NDR_PROC_HEADER_EXTS *pExtensions = + (const NDR_PROC_HEADER_EXTS *)pFormat; + ext_flags = pExtensions->Flags2; + pFormat += pExtensions->Size; + } + } + else + { + pFormat = convert_old_args( pStubMsg, pFormat, async_call_data->stack_size, + pProcHeader->Oi_flags & RPC_FC_PROC_OIF_OBJECT, + async_call_data->NdrCorrCache, sizeof(async_call_data->NdrCorrCache), + &async_call_data->number_of_params ); + } + + async_call_data->pParamFormat = pFormat; + + pStubMsg->BufferLength = 0; + + /* store the RPC flags away */ + if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_RPCFLAGS) + pRpcMsg->RpcFlags = ((const NDR_PROC_HEADER_RPC *)pProcHeader)->rpc_flags; + + /* use alternate memory allocation routines */ + if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_RPCSSALLOC) + NdrRpcSmSetClientToOsf(pStubMsg); + + if (Oif_flags.HasPipes) + { + FIXME("pipes not supported yet\n"); + RpcRaiseException(RPC_X_WRONG_STUB_VERSION); /* FIXME: remove when implemented */ + /* init pipes package */ + /* NdrPipesInitialize(...) */ + } + if (ext_flags.HasNewCorrDesc) + { + /* initialize extra correlation package */ + NdrCorrelationInitialize(pStubMsg, async_call_data->NdrCorrCache, sizeof(async_call_data->NdrCorrCache), 0); + } + + /* order of phases: + * 1. CALCSIZE - calculate the buffer size + * 2. GETBUFFER - allocate the buffer + * 3. MARSHAL - marshal [in] params into the buffer + * 4. SENDRECEIVE - send buffer + * Then in NdrpCompleteAsyncClientCall: + * 1. SENDRECEIVE - receive buffer + * 2. UNMARSHAL - unmarshal [out] params from buffer + */ + + /* 1. CALCSIZE */ + TRACE( "CALCSIZE\n" ); + client_do_args(pStubMsg, pFormat, STUBLESS_CALCSIZE, NULL, async_call_data->number_of_params, NULL); + + /* 2. GETBUFFER */ + TRACE( "GETBUFFER\n" ); + if (Oif_flags.HasPipes) + /* NdrGetPipeBuffer(...) */ + FIXME("pipes not supported yet\n"); + else + { + if (pProcHeader->handle_type == RPC_FC_AUTO_HANDLE) +#if 0 + NdrNsGetBuffer(pStubMsg, pStubMsg->BufferLength, async_call_data->hBinding); +#else + FIXME("using auto handle - call NdrNsGetBuffer when it gets implemented\n"); +#endif + else + NdrGetBuffer(pStubMsg, pStubMsg->BufferLength, async_call_data->hBinding); + } + pRpcMsg->RpcFlags |= RPC_BUFFER_ASYNC; + status = I_RpcAsyncSetHandle(pRpcMsg, pAsync); + if (status != RPC_S_OK) + RpcRaiseException(status); + + /* 3. MARSHAL */ + TRACE( "MARSHAL\n" ); + client_do_args(pStubMsg, pFormat, STUBLESS_MARSHAL, NULL, async_call_data->number_of_params, NULL); + + /* 4. SENDRECEIVE */ + TRACE( "SEND\n" ); + pRpcMsg->RpcFlags |= RPC_BUFFER_ASYNC; + /* send the [in] params only */ + if (Oif_flags.HasPipes) + /* NdrPipesSend(...) */ + FIXME("pipes not supported yet\n"); + else + { + if (pProcHeader->handle_type == RPC_FC_AUTO_HANDLE) +#if 0 + NdrNsSend(&stubMsg, stubMsg.Buffer, pStubDesc->IMPLICIT_HANDLE_INFO.pAutoHandle); +#else + FIXME("using auto handle - call NdrNsSend when it gets implemented\n"); +#endif + else + { + pStubMsg->RpcMsg->BufferLength = pStubMsg->Buffer - (unsigned char *)pStubMsg->RpcMsg->Buffer; + status = I_RpcSend(pStubMsg->RpcMsg); + if (status != RPC_S_OK) + RpcRaiseException(status); + } + } + +done: + TRACE("returning 0\n"); + return 0; +} + +RPC_STATUS NdrpCompleteAsyncClientCall(RPC_ASYNC_STATE *pAsync, void *Reply) +{ + /* pointer to start of stack where arguments start */ + PMIDL_STUB_MESSAGE pStubMsg; + struct async_call_data *async_call_data; + /* header for procedure string */ + const NDR_PROC_HEADER * pProcHeader; + RPC_STATUS status = RPC_S_OK; + + if (!pAsync->StubInfo) + return RPC_S_INVALID_ASYNC_HANDLE; + + async_call_data = pAsync->StubInfo; + pStubMsg = async_call_data->pStubMsg; + pProcHeader = async_call_data->pProcHeader; + + /* order of phases: + * 1. CALCSIZE - calculate the buffer size + * 2. GETBUFFER - allocate the buffer + * 3. MARSHAL - marshal [in] params into the buffer + * 4. SENDRECEIVE - send buffer + * Then in NdrpCompleteAsyncClientCall: + * 1. SENDRECEIVE - receive buffer + * 2. UNMARSHAL - unmarshal [out] params from buffer + */ + + /* 1. SENDRECEIVE */ + TRACE( "RECEIVE\n" ); + pStubMsg->RpcMsg->RpcFlags |= RPC_BUFFER_ASYNC; + /* receive the [out] params */ + if (pProcHeader->handle_type == RPC_FC_AUTO_HANDLE) +#if 0 + NdrNsReceive(&stubMsg, stubMsg.Buffer, pStubDesc->IMPLICIT_HANDLE_INFO.pAutoHandle); +#else + FIXME("using auto handle - call NdrNsReceive when it gets implemented\n"); +#endif + else + { + status = I_RpcReceive(pStubMsg->RpcMsg); + if (status != RPC_S_OK) + goto cleanup; + pStubMsg->BufferLength = pStubMsg->RpcMsg->BufferLength; + pStubMsg->BufferStart = pStubMsg->RpcMsg->Buffer; + pStubMsg->BufferEnd = pStubMsg->BufferStart + pStubMsg->BufferLength; + pStubMsg->Buffer = pStubMsg->BufferStart; + } + + /* convert strings, floating point values and endianness into our + * preferred format */ +#if 0 + if ((pStubMsg->RpcMsg.DataRepresentation & 0x0000FFFFUL) != NDR_LOCAL_DATA_REPRESENTATION) + NdrConvert(pStubMsg, pFormat); +#endif + + /* 2. UNMARSHAL */ + TRACE( "UNMARSHAL\n" ); + client_do_args(pStubMsg, async_call_data->pParamFormat, STUBLESS_UNMARSHAL, + NULL, async_call_data->number_of_params, Reply); + +cleanup: + if (pStubMsg->fHasNewCorrDesc) + { + /* free extra correlation package */ + NdrCorrelationFree(pStubMsg); + } + + /* free the full pointer translation tables */ + if (pProcHeader->Oi_flags & RPC_FC_PROC_OIF_FULLPTR) + NdrFullPointerXlatFree(pStubMsg->FullPtrXlatTables); + + /* free marshalling buffer */ + NdrFreeBuffer(pStubMsg); + client_free_handle(pStubMsg, pProcHeader, async_call_data->pHandleFormat, async_call_data->hBinding); + + I_RpcFree(pStubMsg->StackTop); + I_RpcFree(async_call_data); + + TRACE("-- 0x%x\n", status); + return status; +} + +#ifdef __x86_64__ + +__ASM_GLOBAL_FUNC( NdrAsyncClientCall, + "movq %r8,0x18(%rsp)\n\t" + "movq %r9,0x20(%rsp)\n\t" + "leaq 0x18(%rsp),%r8\n\t" + "subq $0x28,%rsp\n\t" + __ASM_CFI(".cfi_adjust_cfa_offset 0x28\n\t") + "call " __ASM_NAME("ndr_async_client_call") "\n\t" + "addq $0x28,%rsp\n\t" + __ASM_CFI(".cfi_adjust_cfa_offset -0x28\n\t") + "ret" ); + +#else /* __x86_64__ */ + +/*********************************************************************** + * NdrAsyncClientCall [RPCRT4.@] + */ +CLIENT_CALL_RETURN WINAPIV NdrAsyncClientCall( PMIDL_STUB_DESC desc, PFORMAT_STRING format, ... ) +{ + __ms_va_list args; + LONG_PTR ret; + + __ms_va_start( args, format ); + ret = ndr_async_client_call( desc, format, va_arg( args, void ** )); + __ms_va_end( args ); + return *(CLIENT_CALL_RETURN *)&ret; +} + +#endif /* __x86_64__ */ + +RPCRTAPI LONG RPC_ENTRY NdrAsyncStubCall(struct IRpcStubBuffer* pThis, + struct IRpcChannelBuffer* pChannel, PRPC_MESSAGE pRpcMsg, + DWORD * pdwStubPhase) +{ + FIXME("unimplemented, expect crash!\n"); + return 0; +} diff --git a/dll/win32/rpcrt4/ndr_stubless.h b/dll/win32/rpcrt4/ndr_stubless.h index 9a6fb444783..61bc60682c1 100644 --- a/dll/win32/rpcrt4/ndr_stubless.h +++ b/dll/win32/rpcrt4/ndr_stubless.h @@ -85,7 +85,7 @@ typedef struct _NDR_PROC_HEADER_RPC * RPCF_Asynchronous = 0x4000 - [async] MIDL attribute * Reserved = 0x8000 */ - unsigned long rpc_flags; + unsigned int rpc_flags; unsigned short proc_num; unsigned short stack_size; @@ -141,31 +141,20 @@ typedef struct _NDR_PARAM_OI_OTHER unsigned short type_offset; } NDR_PARAM_OI_OTHER; -typedef struct _NDR_PARAM_OIF_BASETYPE +typedef struct { - PARAM_ATTRIBUTES param_attributes; - + PARAM_ATTRIBUTES attr; /* the offset on the calling stack where the parameter is located */ unsigned short stack_offset; - - /* see NDR_PARAM_OI_BASETYPE::type_format_char */ - unsigned char type_format_char; - - /* always FC_PAD */ - unsigned char unused; -} NDR_PARAM_OIF_BASETYPE; - -typedef struct _NDR_PARAM_OIF_OTHER -{ - PARAM_ATTRIBUTES param_attributes; - - /* see NDR_PARAM_OIF_BASETYPE::stack_offset */ - unsigned short stack_offset; - - /* offset into the provided type format string where the type for this - * parameter starts */ - unsigned short type_offset; -} NDR_PARAM_OIF_OTHER; + union + { + /* see NDR_PARAM_OI_BASETYPE::type_format_char */ + unsigned char type_format_char; + /* offset into the provided type format string where the type for this + * parameter starts */ + unsigned short type_offset; + } u; +} NDR_PARAM_OIF; /* explicit handle description for FC_BIND_PRIMITIVE type */ typedef struct _NDR_EHD_PRIMITIVE @@ -236,7 +225,24 @@ typedef struct _NDR_EHD_CONTEXT #include "poppack.h" -void client_do_args_old_format(PMIDL_STUB_MESSAGE pStubMsg, - PFORMAT_STRING pFormat, int phase, unsigned char *args, - unsigned short stack_size, unsigned char *pRetVal, BOOL object_proc, - BOOL ignore_retval); +enum stubless_phase +{ + STUBLESS_UNMARSHAL, + STUBLESS_INITOUT, + STUBLESS_CALLSERVER, + STUBLESS_CALCSIZE, + STUBLESS_GETBUFFER, + STUBLESS_MARSHAL, + STUBLESS_FREE +}; + +LONG_PTR CDECL ndr_client_call( PMIDL_STUB_DESC pStubDesc, PFORMAT_STRING pFormat, + void **stack_top, void **fpu_stack ) DECLSPEC_HIDDEN; +LONG_PTR CDECL ndr_async_client_call( PMIDL_STUB_DESC pStubDesc, PFORMAT_STRING pFormat, + void **stack_top ) DECLSPEC_HIDDEN; +void client_do_args( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, enum stubless_phase phase, + void **fpu_args, unsigned short number_of_params, unsigned char *pRetVal ) DECLSPEC_HIDDEN; +PFORMAT_STRING convert_old_args( PMIDL_STUB_MESSAGE pStubMsg, PFORMAT_STRING pFormat, + unsigned int stack_size, BOOL object_proc, + void *buffer, unsigned int size, unsigned int *count ) DECLSPEC_HIDDEN; +RPC_STATUS NdrpCompleteAsyncClientCall(RPC_ASYNC_STATE *pAsync, void *Reply) DECLSPEC_HIDDEN; diff --git a/dll/win32/rpcrt4/rpc_assoc.c b/dll/win32/rpcrt4/rpc_assoc.c index 32e951a929a..8364a9a4f36 100644 --- a/dll/win32/rpcrt4/rpc_assoc.c +++ b/dll/win32/rpcrt4/rpc_assoc.c @@ -84,6 +84,15 @@ static RPC_STATUS RpcAssoc_Alloc(LPCSTR Protseq, LPCSTR NetworkAddr, return RPC_S_OK; } +static BOOL compare_networkoptions(LPCWSTR opts1, LPCWSTR opts2) +{ + if ((opts1 == NULL) && (opts2 == NULL)) + return TRUE; + if ((opts1 == NULL) || (opts2 == NULL)) + return FALSE; + return !strcmpW(opts1, opts2); +} + RPC_STATUS RPCRT4_GetAssociation(LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, RpcAssoc **assoc_out) @@ -97,7 +106,7 @@ RPC_STATUS RPCRT4_GetAssociation(LPCSTR Protseq, LPCSTR NetworkAddr, if (!strcmp(Protseq, assoc->Protseq) && !strcmp(NetworkAddr, assoc->NetworkAddr) && !strcmp(Endpoint, assoc->Endpoint) && - ((!assoc->NetworkOptions && !NetworkOptions) || !strcmpW(NetworkOptions, assoc->NetworkOptions))) + compare_networkoptions(NetworkOptions, assoc->NetworkOptions)) { assoc->refs++; *assoc_out = assoc; @@ -125,7 +134,7 @@ RPC_STATUS RPCRT4_GetAssociation(LPCSTR Protseq, LPCSTR NetworkAddr, RPC_STATUS RpcServerAssoc_GetAssociation(LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, - unsigned long assoc_gid, + ULONG assoc_gid, RpcAssoc **assoc_out) { RpcAssoc *assoc; @@ -223,7 +232,7 @@ static RPC_STATUS RpcAssoc_BindConnection(const RpcAssoc *assoc, RpcConnection * RPC_MESSAGE msg; RPC_STATUS status; unsigned char *auth_data = NULL; - unsigned long auth_length; + ULONG auth_length; TRACE("sending bind request to server\n"); @@ -254,18 +263,19 @@ static RPC_STATUS RpcAssoc_BindConnection(const RpcAssoc *assoc, RpcConnection * { unsigned short remaining = msg.BufferLength - ROUND_UP(FIELD_OFFSET(RpcAddressString, string[server_address->length]), 4); - RpcResults *results = (RpcResults*)((ULONG_PTR)server_address + - ROUND_UP(FIELD_OFFSET(RpcAddressString, string[server_address->length]), 4)); - if ((results->num_results == 1) && (remaining >= sizeof(*results))) + RpcResultList *results = (RpcResultList*)((ULONG_PTR)server_address + + ROUND_UP(FIELD_OFFSET(RpcAddressString, string[server_address->length]), 4)); + if ((results->num_results == 1) && + (remaining >= FIELD_OFFSET(RpcResultList, results[results->num_results]))) { switch (results->results[0].result) { case RESULT_ACCEPT: /* respond to authorization request */ if (auth_length > sizeof(RpcAuthVerifier)) - status = RPCRT4_AuthorizeConnection(conn, - auth_data + sizeof(RpcAuthVerifier), - auth_length); + status = RPCRT4_ClientConnectionAuth(conn, + auth_data + sizeof(RpcAuthVerifier), + auth_length); if (status == RPC_S_OK) { conn->assoc_group_id = response_hdr->bind_ack.assoc_gid; @@ -394,6 +404,7 @@ RPC_STATUS RpcAssoc_GetClientConnection(RpcAssoc *assoc, if (status != RPC_S_OK) return status; + NewConnection->assoc = assoc; status = RPCRT4_OpenClientConnection(NewConnection); if (status != RPC_S_OK) { @@ -416,6 +427,7 @@ RPC_STATUS RpcAssoc_GetClientConnection(RpcAssoc *assoc, void RpcAssoc_ReleaseIdleConnection(RpcAssoc *assoc, RpcConnection *Connection) { assert(!Connection->server); + Connection->async_state = NULL; EnterCriticalSection(&assoc->cs); if (!assoc->assoc_group_id) assoc->assoc_group_id = Connection->assoc_group_id; list_add_head(&assoc->free_connection_pool, &Connection->conn_pool_entry); diff --git a/dll/win32/rpcrt4/rpc_assoc.h b/dll/win32/rpcrt4/rpc_assoc.h index 1ce1f135638..f8df62d3802 100644 --- a/dll/win32/rpcrt4/rpc_assoc.h +++ b/dll/win32/rpcrt4/rpc_assoc.h @@ -34,6 +34,7 @@ typedef struct _RpcAssoc /* id of this association group */ ULONG assoc_group_id; + UUID http_uuid; CRITICAL_SECTION cs; @@ -45,14 +46,14 @@ typedef struct _RpcAssoc struct list context_handle_list; /* protected by cs */ } RpcAssoc; -RPC_STATUS RPCRT4_GetAssociation(LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, RpcAssoc **assoc); -RPC_STATUS RpcAssoc_GetClientConnection(RpcAssoc *assoc, const RPC_SYNTAX_IDENTIFIER *InterfaceId, const RPC_SYNTAX_IDENTIFIER *TransferSyntax, RpcAuthInfo *AuthInfo, RpcQualityOfService *QOS, RpcConnection **Connection); -void RpcAssoc_ReleaseIdleConnection(RpcAssoc *assoc, RpcConnection *Connection); -ULONG RpcAssoc_Release(RpcAssoc *assoc); -RPC_STATUS RpcServerAssoc_GetAssociation(LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, unsigned long assoc_gid, RpcAssoc **assoc_out); -RPC_STATUS RpcServerAssoc_AllocateContextHandle(RpcAssoc *assoc, void *CtxGuard, NDR_SCONTEXT *SContext); -RPC_STATUS RpcServerAssoc_FindContextHandle(RpcAssoc *assoc, const UUID *uuid, void *CtxGuard, ULONG Flags, NDR_SCONTEXT *SContext); -RPC_STATUS RpcServerAssoc_UpdateContextHandle(RpcAssoc *assoc, NDR_SCONTEXT SContext, void *CtxGuard, NDR_RUNDOWN rundown_routine); -unsigned int RpcServerAssoc_ReleaseContextHandle(RpcAssoc *assoc, NDR_SCONTEXT SContext, BOOL release_lock); -void RpcContextHandle_GetUuid(NDR_SCONTEXT SContext, UUID *uuid); -BOOL RpcContextHandle_IsGuardCorrect(NDR_SCONTEXT SContext, void *CtxGuard); +RPC_STATUS RPCRT4_GetAssociation(LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, RpcAssoc **assoc) DECLSPEC_HIDDEN; +RPC_STATUS RpcAssoc_GetClientConnection(RpcAssoc *assoc, const RPC_SYNTAX_IDENTIFIER *InterfaceId, const RPC_SYNTAX_IDENTIFIER *TransferSyntax, RpcAuthInfo *AuthInfo, RpcQualityOfService *QOS, RpcConnection **Connection) DECLSPEC_HIDDEN; +void RpcAssoc_ReleaseIdleConnection(RpcAssoc *assoc, RpcConnection *Connection) DECLSPEC_HIDDEN; +ULONG RpcAssoc_Release(RpcAssoc *assoc) DECLSPEC_HIDDEN; +RPC_STATUS RpcServerAssoc_GetAssociation(LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, ULONG assoc_gid, RpcAssoc **assoc_out) DECLSPEC_HIDDEN; +RPC_STATUS RpcServerAssoc_AllocateContextHandle(RpcAssoc *assoc, void *CtxGuard, NDR_SCONTEXT *SContext) DECLSPEC_HIDDEN; +RPC_STATUS RpcServerAssoc_FindContextHandle(RpcAssoc *assoc, const UUID *uuid, void *CtxGuard, ULONG Flags, NDR_SCONTEXT *SContext) DECLSPEC_HIDDEN; +RPC_STATUS RpcServerAssoc_UpdateContextHandle(RpcAssoc *assoc, NDR_SCONTEXT SContext, void *CtxGuard, NDR_RUNDOWN rundown_routine) DECLSPEC_HIDDEN; +unsigned int RpcServerAssoc_ReleaseContextHandle(RpcAssoc *assoc, NDR_SCONTEXT SContext, BOOL release_lock) DECLSPEC_HIDDEN; +void RpcContextHandle_GetUuid(NDR_SCONTEXT SContext, UUID *uuid) DECLSPEC_HIDDEN; +BOOL RpcContextHandle_IsGuardCorrect(NDR_SCONTEXT SContext, void *CtxGuard) DECLSPEC_HIDDEN; diff --git a/dll/win32/rpcrt4/rpc_async.c b/dll/win32/rpcrt4/rpc_async.c index 33fdc774304..891fc5ad725 100644 --- a/dll/win32/rpcrt4/rpc_async.c +++ b/dll/win32/rpcrt4/rpc_async.c @@ -29,11 +29,17 @@ #include "rpc_binding.h" #include "rpc_message.h" +#include "ndr_stubless.h" WINE_DEFAULT_DEBUG_CHANNEL(rpc); #define RPC_ASYNC_SIGNATURE 0x43595341 +static inline BOOL valid_async_handle(PRPC_ASYNC_STATE pAsync) +{ + return pAsync->Signature == RPC_ASYNC_SIGNATURE; +} + /*********************************************************************** * RpcAsyncInitializeHandle [RPCRT4.@] * @@ -104,8 +110,14 @@ RPC_STATUS WINAPI RpcAsyncGetCallStatus(PRPC_ASYNC_STATE pAsync) */ RPC_STATUS WINAPI RpcAsyncCompleteCall(PRPC_ASYNC_STATE pAsync, void *Reply) { - FIXME("(%p, %p): stub\n", pAsync, Reply); - return RPC_S_INVALID_ASYNC_HANDLE; + TRACE("(%p, %p)\n", pAsync, Reply); + + if (!valid_async_handle(pAsync)) + return RPC_S_INVALID_ASYNC_HANDLE; + + /* FIXME: check completed */ + + return NdrpCompleteAsyncClientCall(pAsync, Reply); } /*********************************************************************** diff --git a/dll/win32/rpcrt4/rpc_binding.c b/dll/win32/rpcrt4/rpc_binding.c index 7a1359fc570..685b569835e 100644 --- a/dll/win32/rpcrt4/rpc_binding.c +++ b/dll/win32/rpcrt4/rpc_binding.c @@ -661,11 +661,11 @@ RPC_STATUS WINAPI RpcStringBindingParseA( RPC_CSTR StringBinding, RPC_CSTR *ObjU return RPC_S_OK; fail: - if (ObjUuid) RpcStringFreeA((unsigned char**)ObjUuid); - if (Protseq) RpcStringFreeA((unsigned char**)Protseq); - if (NetworkAddr) RpcStringFreeA((unsigned char**)NetworkAddr); - if (Endpoint) RpcStringFreeA((unsigned char**)Endpoint); - if (Options) RpcStringFreeA((unsigned char**)Options); + if (ObjUuid) RpcStringFreeA(ObjUuid); + if (Protseq) RpcStringFreeA(Protseq); + if (NetworkAddr) RpcStringFreeA(NetworkAddr); + if (Endpoint) RpcStringFreeA(Endpoint); + if (Options) RpcStringFreeA(Options); return RPC_S_INVALID_STRING_BINDING; } @@ -798,13 +798,10 @@ RPC_STATUS WINAPI RpcBindingFree( RPC_BINDING_HANDLE* Binding ) */ RPC_STATUS WINAPI RpcBindingVectorFree( RPC_BINDING_VECTOR** BindingVector ) { - RPC_STATUS status; - unsigned long c; + ULONG c; TRACE("(%p)\n", BindingVector); - for (c=0; c<(*BindingVector)->Count; c++) { - status = RpcBindingFree(&(*BindingVector)->BindingH[c]); - } + for (c=0; c<(*BindingVector)->Count; c++) RpcBindingFree(&(*BindingVector)->BindingH[c]); HeapFree(GetProcessHeap(), 0, *BindingVector); *BindingVector = NULL; return RPC_S_OK; @@ -815,7 +812,7 @@ RPC_STATUS WINAPI RpcBindingVectorFree( RPC_BINDING_VECTOR** BindingVector ) */ RPC_STATUS WINAPI RpcBindingInqObject( RPC_BINDING_HANDLE Binding, UUID* ObjectUuid ) { - RpcBinding* bind = (RpcBinding*)Binding; + RpcBinding* bind = Binding; TRACE("(%p,%p) = %s\n", Binding, ObjectUuid, debugstr_guid(&bind->ObjectUuid)); *ObjectUuid = bind->ObjectUuid; @@ -827,7 +824,7 @@ RPC_STATUS WINAPI RpcBindingInqObject( RPC_BINDING_HANDLE Binding, UUID* ObjectU */ RPC_STATUS WINAPI RpcBindingSetObject( RPC_BINDING_HANDLE Binding, UUID* ObjectUuid ) { - RpcBinding* bind = (RpcBinding*)Binding; + RpcBinding* bind = Binding; TRACE("(%p,%s)\n", Binding, debugstr_guid(ObjectUuid)); if (bind->server) return RPC_S_WRONG_KIND_OF_BINDING; @@ -859,11 +856,11 @@ RPC_STATUS WINAPI RpcBindingFromStringBindingA( RPC_CSTR StringBinding, RPC_BIND if (ret == RPC_S_OK) ret = RPCRT4_CompleteBindingA(bind, (char*)NetworkAddr, (char*)Endpoint, (char*)Options); - RpcStringFreeA((unsigned char**)&Options); - RpcStringFreeA((unsigned char**)&Endpoint); - RpcStringFreeA((unsigned char**)&NetworkAddr); - RpcStringFreeA((unsigned char**)&Protseq); - RpcStringFreeA((unsigned char**)&ObjectUuid); + RpcStringFreeA(&Options); + RpcStringFreeA(&Endpoint); + RpcStringFreeA(&NetworkAddr); + RpcStringFreeA(&Protseq); + RpcStringFreeA(&ObjectUuid); if (ret == RPC_S_OK) *Binding = (RPC_BINDING_HANDLE)bind; @@ -918,7 +915,7 @@ RPC_STATUS WINAPI RpcBindingFromStringBindingW( RPC_WSTR StringBinding, RPC_BIND RPC_STATUS WINAPI RpcBindingToStringBindingA( RPC_BINDING_HANDLE Binding, RPC_CSTR *StringBinding ) { RPC_STATUS ret; - RpcBinding* bind = (RpcBinding*)Binding; + RpcBinding* bind = Binding; RPC_CSTR ObjectUuid; TRACE("(%p,%p)\n", Binding, StringBinding); @@ -949,7 +946,7 @@ RPC_STATUS WINAPI RpcBindingToStringBindingW( RPC_BINDING_HANDLE Binding, RPC_WS TRACE("(%p,%p)\n", Binding, StringBinding); ret = RpcBindingToStringBindingA(Binding, &str); *StringBinding = RPCRT4_strdupAtoW((char*)str); - RpcStringFreeA((unsigned char**)&str); + RpcStringFreeA(&str); return ret; } @@ -972,7 +969,7 @@ RPC_STATUS WINAPI I_RpcBindingInqTransportType( RPC_BINDING_HANDLE Binding, unsi */ RPC_STATUS WINAPI I_RpcBindingSetAsync( RPC_BINDING_HANDLE Binding, RPC_BLOCKING_FN BlockingFn) { - RpcBinding* bind = (RpcBinding*)Binding; + RpcBinding* bind = Binding; TRACE( "(%p,%p): stub\n", Binding, BlockingFn ); @@ -989,7 +986,7 @@ RPC_STATUS RPC_ENTRY RpcBindingCopy( RPC_BINDING_HANDLE* DestinationBinding) { RpcBinding *DestBinding; - RpcBinding *SrcBinding = (RpcBinding*)SourceBinding; + RpcBinding *SrcBinding = SourceBinding; RPC_STATUS status; TRACE("(%p, %p)\n", SourceBinding, DestinationBinding); @@ -1052,9 +1049,17 @@ RPC_STATUS RPC_ENTRY RpcBindingReset(RPC_BINDING_HANDLE Binding) */ RPC_STATUS WINAPI RpcImpersonateClient(RPC_BINDING_HANDLE BindingHandle) { - FIXME("(%p): stub\n", BindingHandle); - ImpersonateSelf(SecurityImpersonation); - return RPC_S_OK; + RpcBinding *bind; + + TRACE("(%p)\n", BindingHandle); + + if (!BindingHandle) BindingHandle = I_RpcGetCurrentCallHandle(); + if (!BindingHandle) return RPC_S_INVALID_BINDING; + + bind = BindingHandle; + if (bind->FromConn) + return rpcrt4_conn_impersonate_client(bind->FromConn); + return RPC_S_WRONG_KIND_OF_BINDING; } /*********************************************************************** @@ -1077,8 +1082,17 @@ RPC_STATUS WINAPI RpcImpersonateClient(RPC_BINDING_HANDLE BindingHandle) */ RPC_STATUS WINAPI RpcRevertToSelfEx(RPC_BINDING_HANDLE BindingHandle) { - FIXME("(%p): stub\n", BindingHandle); - return RPC_S_OK; + RpcBinding *bind; + + TRACE("(%p)\n", BindingHandle); + + if (!BindingHandle) BindingHandle = I_RpcGetCurrentCallHandle(); + if (!BindingHandle) return RPC_S_INVALID_BINDING; + + bind = BindingHandle; + if (bind->FromConn) + return rpcrt4_conn_revert_to_self(bind->FromConn); + return RPC_S_WRONG_KIND_OF_BINDING; } static inline BOOL has_nt_auth_identity(ULONG AuthnLevel) @@ -1094,11 +1108,11 @@ static inline BOOL has_nt_auth_identity(ULONG AuthnLevel) } } -static RPC_STATUS RpcAuthInfo_Create(ULONG AuthnLevel, ULONG AuthnSvc, - CredHandle cred, TimeStamp exp, - ULONG cbMaxToken, - RPC_AUTH_IDENTITY_HANDLE identity, - RpcAuthInfo **ret) +RPC_STATUS RpcAuthInfo_Create(ULONG AuthnLevel, ULONG AuthnSvc, + CredHandle cred, TimeStamp exp, + ULONG cbMaxToken, + RPC_AUTH_IDENTITY_HANDLE identity, + RpcAuthInfo **ret) { RpcAuthInfo *AuthInfo = HeapAlloc(GetProcessHeap(), 0, sizeof(*AuthInfo)); if (!AuthInfo) @@ -1286,7 +1300,7 @@ static RPC_STATUS RpcQualityOfService_Create(const RPC_SECURITY_QOS *qos_src, BO cred_dst->User = HeapAlloc(GetProcessHeap(), 0, cred_dst->UserLength * sizeof(WCHAR)); cred_dst->Password = HeapAlloc(GetProcessHeap(), 0, cred_dst->PasswordLength * sizeof(WCHAR)); cred_dst->Domain = HeapAlloc(GetProcessHeap(), 0, cred_dst->DomainLength * sizeof(WCHAR)); - if (!cred_dst || !cred_dst->Password || !cred_dst->Domain) goto error; + if (!cred_dst->Password || !cred_dst->Domain) goto error; MultiByteToWideChar(CP_ACP, 0, (char *)cred_src->User, cred_src->UserLength, cred_dst->User, cred_dst->UserLength); MultiByteToWideChar(CP_ACP, 0, (char *)cred_src->Domain, cred_src->DomainLength, cred_dst->Domain, cred_dst->DomainLength); MultiByteToWideChar(CP_ACP, 0, (char *)cred_src->Password, cred_src->PasswordLength, cred_dst->Password, cred_dst->PasswordLength); @@ -1431,9 +1445,8 @@ BOOL RpcQualityOfService_IsEqual(const RpcQualityOfService *qos1, const RpcQuali */ RPC_STATUS WINAPI RpcRevertToSelf(void) { - FIXME("stub\n"); - RevertToSelf(); - return RPC_S_OK; + TRACE("\n"); + return RpcRevertToSelfEx(NULL); } /*********************************************************************** @@ -1453,9 +1466,22 @@ RpcBindingInqAuthInfoExA( RPC_BINDING_HANDLE Binding, RPC_CSTR *ServerPrincName, ULONG *AuthnSvc, RPC_AUTH_IDENTITY_HANDLE *AuthIdentity, ULONG *AuthzSvc, ULONG RpcQosVersion, RPC_SECURITY_QOS *SecurityQOS ) { - FIXME("%p %p %p %p %p %p %u %p\n", Binding, ServerPrincName, AuthnLevel, + RPC_STATUS status; + RPC_WSTR principal; + + TRACE("%p %p %p %p %p %p %u %p\n", Binding, ServerPrincName, AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvc, RpcQosVersion, SecurityQOS); - return RPC_S_INVALID_BINDING; + + status = RpcBindingInqAuthInfoExW(Binding, ServerPrincName ? &principal : NULL, AuthnLevel, + AuthnSvc, AuthIdentity, AuthzSvc, RpcQosVersion, SecurityQOS); + if (status == RPC_S_OK && ServerPrincName) + { + *ServerPrincName = (RPC_CSTR)RPCRT4_strdupWtoA(principal); + RpcStringFreeW(&principal); + if (!*ServerPrincName) return ERROR_OUTOFMEMORY; + } + + return status; } /*********************************************************************** @@ -1466,9 +1492,38 @@ RpcBindingInqAuthInfoExW( RPC_BINDING_HANDLE Binding, RPC_WSTR *ServerPrincName, ULONG *AuthnSvc, RPC_AUTH_IDENTITY_HANDLE *AuthIdentity, ULONG *AuthzSvc, ULONG RpcQosVersion, RPC_SECURITY_QOS *SecurityQOS ) { - FIXME("%p %p %p %p %p %p %u %p\n", Binding, ServerPrincName, AuthnLevel, + RpcBinding *bind = Binding; + + TRACE("%p %p %p %p %p %p %u %p\n", Binding, ServerPrincName, AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvc, RpcQosVersion, SecurityQOS); - return RPC_S_INVALID_BINDING; + + if (!bind->AuthInfo) return RPC_S_BINDING_HAS_NO_AUTH; + + if (SecurityQOS) + { + FIXME("QOS not implemented\n"); + return RPC_S_INVALID_BINDING; + } + + if (ServerPrincName) + { + if (bind->AuthInfo->server_principal_name) + { + *ServerPrincName = RPCRT4_strdupW(bind->AuthInfo->server_principal_name); + if (!*ServerPrincName) return ERROR_OUTOFMEMORY; + } + else *ServerPrincName = NULL; + } + if (AuthnLevel) *AuthnLevel = bind->AuthInfo->AuthnLevel; + if (AuthnSvc) *AuthnSvc = bind->AuthInfo->AuthnSvc; + if (AuthIdentity) *AuthIdentity = bind->AuthInfo->identity; + if (AuthzSvc) + { + FIXME("authorization service not implemented\n"); + *AuthzSvc = RPC_C_AUTHZ_NONE; + } + + return RPC_S_OK; } /*********************************************************************** @@ -1478,9 +1533,8 @@ RPCRTAPI RPC_STATUS RPC_ENTRY RpcBindingInqAuthInfoA( RPC_BINDING_HANDLE Binding, RPC_CSTR *ServerPrincName, ULONG *AuthnLevel, ULONG *AuthnSvc, RPC_AUTH_IDENTITY_HANDLE *AuthIdentity, ULONG *AuthzSvc ) { - FIXME("%p %p %p %p %p %p\n", Binding, ServerPrincName, AuthnLevel, - AuthnSvc, AuthIdentity, AuthzSvc); - return RPC_S_INVALID_BINDING; + return RpcBindingInqAuthInfoExA(Binding, ServerPrincName, AuthnLevel, AuthnSvc, AuthIdentity, + AuthzSvc, 0, NULL); } /*********************************************************************** @@ -1490,9 +1544,78 @@ RPCRTAPI RPC_STATUS RPC_ENTRY RpcBindingInqAuthInfoW( RPC_BINDING_HANDLE Binding, RPC_WSTR *ServerPrincName, ULONG *AuthnLevel, ULONG *AuthnSvc, RPC_AUTH_IDENTITY_HANDLE *AuthIdentity, ULONG *AuthzSvc ) { - FIXME("%p %p %p %p %p %p\n", Binding, ServerPrincName, AuthnLevel, - AuthnSvc, AuthIdentity, AuthzSvc); - return RPC_S_INVALID_BINDING; + return RpcBindingInqAuthInfoExW(Binding, ServerPrincName, AuthnLevel, AuthnSvc, AuthIdentity, + AuthzSvc, 0, NULL); +} + +/*********************************************************************** + * RpcBindingInqAuthClientA (RPCRT4.@) + */ +RPCRTAPI RPC_STATUS RPC_ENTRY +RpcBindingInqAuthClientA( RPC_BINDING_HANDLE ClientBinding, RPC_AUTHZ_HANDLE *Privs, + RPC_CSTR *ServerPrincName, ULONG *AuthnLevel, ULONG *AuthnSvc, + ULONG *AuthzSvc ) +{ + return RpcBindingInqAuthClientExA(ClientBinding, Privs, ServerPrincName, AuthnLevel, + AuthnSvc, AuthzSvc, 0); +} + +/*********************************************************************** + * RpcBindingInqAuthClientW (RPCRT4.@) + */ +RPCRTAPI RPC_STATUS RPC_ENTRY +RpcBindingInqAuthClientW( RPC_BINDING_HANDLE ClientBinding, RPC_AUTHZ_HANDLE *Privs, + RPC_WSTR *ServerPrincName, ULONG *AuthnLevel, ULONG *AuthnSvc, + ULONG *AuthzSvc ) +{ + return RpcBindingInqAuthClientExW(ClientBinding, Privs, ServerPrincName, AuthnLevel, + AuthnSvc, AuthzSvc, 0); +} + +/*********************************************************************** + * RpcBindingInqAuthClientExA (RPCRT4.@) + */ +RPCRTAPI RPC_STATUS RPC_ENTRY +RpcBindingInqAuthClientExA( RPC_BINDING_HANDLE ClientBinding, RPC_AUTHZ_HANDLE *Privs, + RPC_CSTR *ServerPrincName, ULONG *AuthnLevel, ULONG *AuthnSvc, + ULONG *AuthzSvc, ULONG Flags ) +{ + RPC_STATUS status; + RPC_WSTR principal; + + TRACE("%p %p %p %p %p %p 0x%x\n", ClientBinding, Privs, ServerPrincName, AuthnLevel, + AuthnSvc, AuthzSvc, Flags); + + status = RpcBindingInqAuthClientExW(ClientBinding, Privs, ServerPrincName ? &principal : NULL, + AuthnLevel, AuthnSvc, AuthzSvc, Flags); + if (status == RPC_S_OK && ServerPrincName) + { + *ServerPrincName = (RPC_CSTR)RPCRT4_strdupWtoA(principal); + if (!*ServerPrincName && principal) status = ERROR_OUTOFMEMORY; + RpcStringFreeW(&principal); + } + + return status; +} + +/*********************************************************************** + * RpcBindingInqAuthClientExW (RPCRT4.@) + */ +RPCRTAPI RPC_STATUS RPC_ENTRY +RpcBindingInqAuthClientExW( RPC_BINDING_HANDLE ClientBinding, RPC_AUTHZ_HANDLE *Privs, + RPC_WSTR *ServerPrincName, ULONG *AuthnLevel, ULONG *AuthnSvc, + ULONG *AuthzSvc, ULONG Flags ) +{ + RpcBinding *bind = ClientBinding; + + TRACE("%p %p %p %p %p %p 0x%x\n", ClientBinding, Privs, ServerPrincName, AuthnLevel, + AuthnSvc, AuthzSvc, Flags); + + if (!bind->FromConn) return RPC_S_INVALID_BINDING; + + return rpcrt4_conn_inquire_auth_client(bind->FromConn, Privs, + ServerPrincName, AuthnLevel, + AuthnSvc, AuthzSvc, Flags); } /*********************************************************************** @@ -1504,7 +1627,7 @@ RpcBindingSetAuthInfoExA( RPC_BINDING_HANDLE Binding, RPC_CSTR ServerPrincName, RPC_AUTH_IDENTITY_HANDLE AuthIdentity, ULONG AuthzSvr, RPC_SECURITY_QOS *SecurityQos ) { - RpcBinding* bind = (RpcBinding*)Binding; + RpcBinding* bind = Binding; SECURITY_STATUS r; CredHandle cred; TimeStamp exp; @@ -1634,7 +1757,7 @@ RpcBindingSetAuthInfoExW( RPC_BINDING_HANDLE Binding, RPC_WSTR ServerPrincName, ULONG AuthnSvc, RPC_AUTH_IDENTITY_HANDLE AuthIdentity, ULONG AuthzSvr, RPC_SECURITY_QOS *SecurityQos ) { - RpcBinding* bind = (RpcBinding*)Binding; + RpcBinding* bind = Binding; SECURITY_STATUS r; CredHandle cred; TimeStamp exp; @@ -1643,7 +1766,7 @@ RpcBindingSetAuthInfoExW( RPC_BINDING_HANDLE Binding, RPC_WSTR ServerPrincName, PSecPkgInfoW packages; ULONG cbMaxToken; - TRACE("%p %s %u %u %p %u %p\n", Binding, debugstr_w((const WCHAR*)ServerPrincName), + TRACE("%p %s %u %u %p %u %p\n", Binding, debugstr_w(ServerPrincName), AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvr, SecurityQos); if (SecurityQos) @@ -1775,7 +1898,7 @@ RPCRTAPI RPC_STATUS RPC_ENTRY RpcBindingSetAuthInfoW( RPC_BINDING_HANDLE Binding, RPC_WSTR ServerPrincName, ULONG AuthnLevel, ULONG AuthnSvc, RPC_AUTH_IDENTITY_HANDLE AuthIdentity, ULONG AuthzSvr ) { - TRACE("%p %s %u %u %p %u\n", Binding, debugstr_w((const WCHAR*)ServerPrincName), + TRACE("%p %s %u %u %p %u\n", Binding, debugstr_w(ServerPrincName), AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvr); return RpcBindingSetAuthInfoExW(Binding, ServerPrincName, AuthnLevel, AuthnSvc, AuthIdentity, AuthzSvr, NULL); } diff --git a/dll/win32/rpcrt4/rpc_binding.h b/dll/win32/rpcrt4/rpc_binding.h index 5aa83079d51..7d49074fc5e 100644 --- a/dll/win32/rpcrt4/rpc_binding.h +++ b/dll/win32/rpcrt4/rpc_binding.h @@ -24,8 +24,15 @@ #include "rpcndr.h" #include "security.h" #include "wine/list.h" +#include "rpc_defs.h" +enum secure_packet_direction +{ + SECURE_PACKET_SEND, + SECURE_PACKET_RECEIVE +}; + typedef struct _RpcAuthInfo { LONG refs; @@ -66,6 +73,7 @@ typedef struct _RpcConnection TimeStamp exp; ULONG attr; RpcAuthInfo *AuthInfo; + ULONG auth_context_id; ULONG encryption_auth_len; ULONG signature_auth_len; RpcQualityOfService *QOS; @@ -74,6 +82,7 @@ typedef struct _RpcConnection struct list conn_pool_entry; ULONG assoc_group_id; /* association group returned during binding */ RPC_ASYNC_STATE *async_state; + struct _RpcAssoc *assoc; /* association this connection is part of */ /* server-only */ /* The active interface bound to server. */ @@ -96,6 +105,13 @@ struct connection_ops { int (*wait_for_incoming_data)(RpcConnection *conn); size_t (*get_top_of_tower)(unsigned char *tower_data, const char *networkaddr, const char *endpoint); RPC_STATUS (*parse_top_of_tower)(const unsigned char *tower_data, size_t tower_size, char **networkaddr, char **endpoint); + RPC_STATUS (*receive_fragment)(RpcConnection *conn, RpcPktHdr **Header, void **Payload); + BOOL (*is_authorized)(RpcConnection *conn); + RPC_STATUS (*authorize)(RpcConnection *conn, BOOL first_time, unsigned char *in_buffer, unsigned int in_len, unsigned char *out_buffer, unsigned int *out_len); + RPC_STATUS (*secure_packet)(RpcConnection *Connection, enum secure_packet_direction dir, RpcPktHdr *hdr, unsigned int hdr_size, unsigned char *stub_data, unsigned int stub_data_size, RpcAuthVerifier *auth_hdr, unsigned char *auth_value, unsigned int auth_value_size); + RPC_STATUS (*impersonate_client)(RpcConnection *conn); + RPC_STATUS (*revert_to_self)(RpcConnection *conn); + RPC_STATUS (*inquire_auth_client)(RpcConnection *, RPC_AUTHZ_HANDLE *, RPC_WSTR *, ULONG *, ULONG *, ULONG *, ULONG); }; /* don't know what MS's structure looks like */ @@ -119,35 +135,36 @@ typedef struct _RpcBinding RpcQualityOfService *QOS; } RpcBinding; -LPSTR RPCRT4_strndupA(LPCSTR src, INT len); -LPWSTR RPCRT4_strndupW(LPCWSTR src, INT len); -LPSTR RPCRT4_strdupWtoA(LPCWSTR src); -LPWSTR RPCRT4_strdupAtoW(LPCSTR src); -void RPCRT4_strfree(LPSTR src); +LPSTR RPCRT4_strndupA(LPCSTR src, INT len) DECLSPEC_HIDDEN; +LPWSTR RPCRT4_strndupW(LPCWSTR src, INT len) DECLSPEC_HIDDEN; +LPSTR RPCRT4_strdupWtoA(LPCWSTR src) DECLSPEC_HIDDEN; +LPWSTR RPCRT4_strdupAtoW(LPCSTR src) DECLSPEC_HIDDEN; +void RPCRT4_strfree(LPSTR src) DECLSPEC_HIDDEN; #define RPCRT4_strdupA(x) RPCRT4_strndupA((x),-1) #define RPCRT4_strdupW(x) RPCRT4_strndupW((x),-1) -ULONG RpcAuthInfo_AddRef(RpcAuthInfo *AuthInfo); -ULONG RpcAuthInfo_Release(RpcAuthInfo *AuthInfo); -BOOL RpcAuthInfo_IsEqual(const RpcAuthInfo *AuthInfo1, const RpcAuthInfo *AuthInfo2); -ULONG RpcQualityOfService_AddRef(RpcQualityOfService *qos); -ULONG RpcQualityOfService_Release(RpcQualityOfService *qos); -BOOL RpcQualityOfService_IsEqual(const RpcQualityOfService *qos1, const RpcQualityOfService *qos2); +RPC_STATUS RpcAuthInfo_Create(ULONG AuthnLevel, ULONG AuthnSvc, CredHandle cred, TimeStamp exp, ULONG cbMaxToken, RPC_AUTH_IDENTITY_HANDLE identity, RpcAuthInfo **ret) DECLSPEC_HIDDEN; +ULONG RpcAuthInfo_AddRef(RpcAuthInfo *AuthInfo) DECLSPEC_HIDDEN; +ULONG RpcAuthInfo_Release(RpcAuthInfo *AuthInfo) DECLSPEC_HIDDEN; +BOOL RpcAuthInfo_IsEqual(const RpcAuthInfo *AuthInfo1, const RpcAuthInfo *AuthInfo2) DECLSPEC_HIDDEN; +ULONG RpcQualityOfService_AddRef(RpcQualityOfService *qos) DECLSPEC_HIDDEN; +ULONG RpcQualityOfService_Release(RpcQualityOfService *qos) DECLSPEC_HIDDEN; +BOOL RpcQualityOfService_IsEqual(const RpcQualityOfService *qos1, const RpcQualityOfService *qos2) DECLSPEC_HIDDEN; -RPC_STATUS RPCRT4_CreateConnection(RpcConnection** Connection, BOOL server, LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, RpcAuthInfo* AuthInfo, RpcQualityOfService *QOS); -RPC_STATUS RPCRT4_DestroyConnection(RpcConnection* Connection); -RPC_STATUS RPCRT4_OpenClientConnection(RpcConnection* Connection); -RPC_STATUS RPCRT4_CloseConnection(RpcConnection* Connection); +RPC_STATUS RPCRT4_CreateConnection(RpcConnection** Connection, BOOL server, LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, RpcAuthInfo* AuthInfo, RpcQualityOfService *QOS) DECLSPEC_HIDDEN; +RPC_STATUS RPCRT4_DestroyConnection(RpcConnection* Connection) DECLSPEC_HIDDEN; +RPC_STATUS RPCRT4_OpenClientConnection(RpcConnection* Connection) DECLSPEC_HIDDEN; +RPC_STATUS RPCRT4_CloseConnection(RpcConnection* Connection) DECLSPEC_HIDDEN; -RPC_STATUS RPCRT4_ResolveBinding(RpcBinding* Binding, LPCSTR Endpoint); -RPC_STATUS RPCRT4_SetBindingObject(RpcBinding* Binding, const UUID* ObjectUuid); -RPC_STATUS RPCRT4_MakeBinding(RpcBinding** Binding, RpcConnection* Connection); -void RPCRT4_AddRefBinding(RpcBinding* Binding); -RPC_STATUS RPCRT4_ReleaseBinding(RpcBinding* Binding); +RPC_STATUS RPCRT4_ResolveBinding(RpcBinding* Binding, LPCSTR Endpoint) DECLSPEC_HIDDEN; +RPC_STATUS RPCRT4_SetBindingObject(RpcBinding* Binding, const UUID* ObjectUuid) DECLSPEC_HIDDEN; +RPC_STATUS RPCRT4_MakeBinding(RpcBinding** Binding, RpcConnection* Connection) DECLSPEC_HIDDEN; +void RPCRT4_AddRefBinding(RpcBinding* Binding) DECLSPEC_HIDDEN; +RPC_STATUS RPCRT4_ReleaseBinding(RpcBinding* Binding) DECLSPEC_HIDDEN; RPC_STATUS RPCRT4_OpenBinding(RpcBinding* Binding, RpcConnection** Connection, - const RPC_SYNTAX_IDENTIFIER *TransferSyntax, const RPC_SYNTAX_IDENTIFIER *InterfaceId); -RPC_STATUS RPCRT4_CloseBinding(RpcBinding* Binding, RpcConnection* Connection); + const RPC_SYNTAX_IDENTIFIER *TransferSyntax, const RPC_SYNTAX_IDENTIFIER *InterfaceId) DECLSPEC_HIDDEN; +RPC_STATUS RPCRT4_CloseBinding(RpcBinding* Binding, RpcConnection* Connection) DECLSPEC_HIDDEN; static inline const char *rpcrt4_conn_get_name(const RpcConnection *Connection) { @@ -181,15 +198,55 @@ static inline RPC_STATUS rpcrt4_conn_handoff(RpcConnection *old_conn, RpcConnect return old_conn->ops->handoff(old_conn, new_conn); } -/* floors 3 and up */ -RPC_STATUS RpcTransport_GetTopOfTower(unsigned char *tower_data, size_t *tower_size, const char *protseq, const char *networkaddr, const char *endpoint); -RPC_STATUS RpcTransport_ParseTopOfTower(const unsigned char *tower_data, size_t tower_size, char **protseq, char **networkaddr, char **endpoint); +static inline BOOL rpcrt4_conn_is_authorized(RpcConnection *Connection) +{ + return Connection->ops->is_authorized(Connection); +} -void RPCRT4_SetThreadCurrentConnection(RpcConnection *Connection); -void RPCRT4_SetThreadCurrentCallHandle(RpcBinding *Binding); -RpcBinding *RPCRT4_GetThreadCurrentCallHandle(void); -void RPCRT4_PushThreadContextHandle(NDR_SCONTEXT SContext); -void RPCRT4_RemoveThreadContextHandle(NDR_SCONTEXT SContext); -NDR_SCONTEXT RPCRT4_PopThreadContextHandle(void); +static inline RPC_STATUS rpcrt4_conn_authorize( + RpcConnection *conn, BOOL first_time, unsigned char *in_buffer, + unsigned int in_len, unsigned char *out_buffer, unsigned int *out_len) +{ + return conn->ops->authorize(conn, first_time, in_buffer, in_len, out_buffer, out_len); +} + +static inline RPC_STATUS rpcrt4_conn_secure_packet( + RpcConnection *conn, enum secure_packet_direction dir, + RpcPktHdr *hdr, unsigned int hdr_size, unsigned char *stub_data, + unsigned int stub_data_size, RpcAuthVerifier *auth_hdr, + unsigned char *auth_value, unsigned int auth_value_size) +{ + return conn->ops->secure_packet(conn, dir, hdr, hdr_size, stub_data, stub_data_size, auth_hdr, auth_value, auth_value_size); +} + +static inline RPC_STATUS rpcrt4_conn_impersonate_client( + RpcConnection *conn) +{ + return conn->ops->impersonate_client(conn); +} + +static inline RPC_STATUS rpcrt4_conn_revert_to_self( + RpcConnection *conn) +{ + return conn->ops->revert_to_self(conn); +} + +static inline RPC_STATUS rpcrt4_conn_inquire_auth_client( + RpcConnection *conn, RPC_AUTHZ_HANDLE *privs, RPC_WSTR *server_princ_name, + ULONG *authn_level, ULONG *authn_svc, ULONG *authz_svc, ULONG flags) +{ + return conn->ops->inquire_auth_client(conn, privs, server_princ_name, authn_level, authn_svc, authz_svc, flags); +} + +/* floors 3 and up */ +RPC_STATUS RpcTransport_GetTopOfTower(unsigned char *tower_data, size_t *tower_size, const char *protseq, const char *networkaddr, const char *endpoint) DECLSPEC_HIDDEN; +RPC_STATUS RpcTransport_ParseTopOfTower(const unsigned char *tower_data, size_t tower_size, char **protseq, char **networkaddr, char **endpoint) DECLSPEC_HIDDEN; + +void RPCRT4_SetThreadCurrentConnection(RpcConnection *Connection) DECLSPEC_HIDDEN; +void RPCRT4_SetThreadCurrentCallHandle(RpcBinding *Binding) DECLSPEC_HIDDEN; +RpcBinding *RPCRT4_GetThreadCurrentCallHandle(void) DECLSPEC_HIDDEN; +void RPCRT4_PushThreadContextHandle(NDR_SCONTEXT SContext) DECLSPEC_HIDDEN; +void RPCRT4_RemoveThreadContextHandle(NDR_SCONTEXT SContext) DECLSPEC_HIDDEN; +NDR_SCONTEXT RPCRT4_PopThreadContextHandle(void) DECLSPEC_HIDDEN; #endif diff --git a/dll/win32/rpcrt4/rpc_defs.h b/dll/win32/rpcrt4/rpc_defs.h index cae77c4f356..434d39699ee 100644 --- a/dll/win32/rpcrt4/rpc_defs.h +++ b/dll/win32/rpcrt4/rpc_defs.h @@ -22,6 +22,7 @@ #ifndef __WINE_RPC_DEFS_H #define __WINE_RPC_DEFS_H +#include "pshpack1.h" typedef struct { unsigned char rpc_ver; /* RPC major version (5) */ @@ -31,13 +32,13 @@ typedef struct unsigned char drep[4]; /* Data representation */ unsigned short frag_len; /* Data size in bytes including header and tail. */ unsigned short auth_len; /* Authentication length */ - unsigned long call_id; /* Call identifier. */ + unsigned int call_id; /* Call identifier. */ } RpcPktCommonHdr; typedef struct { RpcPktCommonHdr common; - unsigned long alloc_hint; /* Data size in bytes excluding header and tail. */ + unsigned int alloc_hint; /* Data size in bytes excluding header and tail. */ unsigned short context_id; /* Presentation context identifier */ unsigned short opnum; } RpcPktRequestHdr; @@ -45,7 +46,7 @@ typedef struct typedef struct { RpcPktCommonHdr common; - unsigned long alloc_hint; /* Data size in bytes excluding header and tail. */ + unsigned int alloc_hint; /* Data size in bytes excluding header and tail. */ unsigned short context_id; /* Presentation context identifier */ unsigned char cancel_count; unsigned char reserved; @@ -54,58 +55,68 @@ typedef struct typedef struct { RpcPktCommonHdr common; - unsigned long alloc_hint; /* Data size in bytes excluding header and tail. */ + unsigned int alloc_hint; /* Data size in bytes excluding header and tail. */ unsigned short context_id; /* Presentation context identifier */ unsigned char cancel_count; /* Received cancel count */ unsigned char reserved; /* Force alignment! */ - unsigned long status; /* Runtime fault code (RPC_STATUS) */ - unsigned long reserved2; + unsigned int status; /* Runtime fault code (RPC_STATUS) */ + unsigned int reserved2; } RpcPktFaultHdr; +typedef struct +{ + unsigned short context_id; /* Presentation context identifier */ + unsigned char num_syntaxes; /* Number of syntaxes */ + unsigned char reserved; /* For alignment */ + RPC_SYNTAX_IDENTIFIER abstract_syntax; + RPC_SYNTAX_IDENTIFIER transfer_syntaxes[ANYSIZE_ARRAY]; /* size_is(num_syntaxes) */ +} RpcContextElement; + typedef struct { RpcPktCommonHdr common; unsigned short max_tsize; /* Maximum transmission fragment size */ unsigned short max_rsize; /* Maximum receive fragment size */ - unsigned long assoc_gid; /* Associated group id */ + unsigned int assoc_gid; /* Associated group id */ unsigned char num_elements; /* Number of elements */ unsigned char padding[3]; /* Force alignment! */ - unsigned short context_id; /* Presentation context identifier */ - unsigned char num_syntaxes; /* Number of syntaxes */ - RPC_SYNTAX_IDENTIFIER abstract; - RPC_SYNTAX_IDENTIFIER transfer; + /* + * Following this header are these fields: + * RpcContextElement context_elements[num_elements] + */ } RpcPktBindHdr; -#include "pshpack1.h" typedef struct { unsigned short length; /* Length of the string including null terminator */ - char string[1]; /* String data in single byte, null terminated form */ + char string[ANYSIZE_ARRAY]; /* String data in single byte, null terminated form */ } RpcAddressString; -#include "poppack.h" + +typedef struct +{ + unsigned short result; + unsigned short reason; + RPC_SYNTAX_IDENTIFIER transfer_syntax; +} RpcResult; typedef struct { unsigned char num_results; /* Number of results */ unsigned char reserved[3]; /* Force alignment! */ - struct { - unsigned short result; - unsigned short reason; - } results[1]; -} RpcResults; + RpcResult results[ANYSIZE_ARRAY]; /* size_is(num_results) */ +} RpcResultList; typedef struct { RpcPktCommonHdr common; unsigned short max_tsize; /* Maximum transmission fragment size */ unsigned short max_rsize; /* Maximum receive fragment size */ - unsigned long assoc_gid; /* Associated group id */ + unsigned int assoc_gid; /* Associated group id */ /* * Following this header are these fields: * RpcAddressString server_address; * [0 - 3 bytes of padding so that results is 4-byte aligned] - * RpcResults results; - * RPC_SYNTAX_IDENTIFIER transfer; + * RpcResultList results; */ } RpcPktBindAckHdr; @@ -117,9 +128,24 @@ typedef struct struct { unsigned char rpc_ver; unsigned char rpc_ver_minor; - } protocols[1]; + } protocols[ANYSIZE_ARRAY]; } RpcPktBindNAckHdr; +/* undocumented packet sent during RPC over HTTP */ +typedef struct +{ + RpcPktCommonHdr common; + unsigned short flags; + unsigned short num_data_items; +} RpcPktHttpHdr; + +/* AUTH3 packet */ +typedef struct +{ + RpcPktCommonHdr common; + unsigned int pad; /* ignored */ +} RpcPktAuth3Hdr; + /* Union representing all possible packet headers */ typedef union { @@ -130,6 +156,8 @@ typedef union RpcPktBindHdr bind; RpcPktBindAckHdr bind_ack; RpcPktBindNAckHdr bind_nack; + RpcPktHttpHdr http; + RpcPktAuth3Hdr auth3; } RpcPktHdr; typedef struct @@ -138,8 +166,9 @@ typedef struct unsigned char auth_level; /* RPC_C_AUTHN_LEVEL* */ unsigned char auth_pad_length; /* length of padding to restore n % 4 alignment */ unsigned char auth_reserved; /* reserved, must be zero */ - unsigned long auth_context_id; /* unique value for the authenticated connection */ + unsigned int auth_context_id; /* unique value for the authenticated connection */ } RpcAuthVerifier; +#include "poppack.h" #define RPC_AUTH_VERIFIER_LEN(common_hdr) \ ((common_hdr)->auth_len ? (common_hdr)->auth_len + sizeof(RpcAuthVerifier) : 0) @@ -154,26 +183,30 @@ typedef struct #define RPC_MIN_PACKET_SIZE 0x1000 #define RPC_MAX_PACKET_SIZE 0x16D0 -#define PKT_REQUEST 0 -#define PKT_PING 1 -#define PKT_RESPONSE 2 -#define PKT_FAULT 3 -#define PKT_WORKING 4 -#define PKT_NOCALL 5 -#define PKT_REJECT 6 -#define PKT_ACK 7 -#define PKT_CL_CANCEL 8 -#define PKT_FACK 9 -#define PKT_CANCEL_ACK 10 -#define PKT_BIND 11 -#define PKT_BIND_ACK 12 -#define PKT_BIND_NACK 13 -#define PKT_ALTER_CONTEXT 14 -#define PKT_ALTER_CONTEXT_RESP 15 -#define PKT_AUTH3 16 -#define PKT_SHUTDOWN 17 -#define PKT_CO_CANCEL 18 -#define PKT_ORPHANED 19 +enum rpc_packet_type +{ + PKT_REQUEST = 0, + PKT_PING = 1, + PKT_RESPONSE = 2, + PKT_FAULT = 3, + PKT_WORKING = 4, + PKT_NOCALL = 5, + PKT_REJECT = 6, + PKT_ACK = 7, + PKT_CL_CANCEL = 8, + PKT_FACK = 9, + PKT_CANCEL_ACK = 10, + PKT_BIND = 11, + PKT_BIND_ACK = 12, + PKT_BIND_NACK = 13, + PKT_ALTER_CONTEXT = 14, + PKT_ALTER_CONTEXT_RESP = 15, + PKT_AUTH3 = 16, + PKT_SHUTDOWN = 17, + PKT_CO_CANCEL = 18, + PKT_ORPHANED = 19, + PKT_HTTP = 20, +}; #define RESULT_ACCEPT 0 #define RESULT_USER_REJECTION 1 diff --git a/dll/win32/rpcrt4/rpc_epmap.c b/dll/win32/rpcrt4/rpc_epmap.c index 286ffbf9973..c5c25778bfb 100644 --- a/dll/win32/rpcrt4/rpc_epmap.c +++ b/dll/win32/rpcrt4/rpc_epmap.c @@ -79,30 +79,21 @@ static BOOL start_rpcss(void) { PROCESS_INFORMATION pi; STARTUPINFOW si; - static WCHAR cmd[6]; - static const WCHAR rpcss[] = {'r','p','c','s','s',0}; + WCHAR cmd[MAX_PATH]; + static const WCHAR rpcss[] = {'\\','r','p','c','s','s','.','e','x','e',0}; BOOL rslt; + void *redir; TRACE("\n"); - ZeroMemory(&pi, sizeof(PROCESS_INFORMATION)); ZeroMemory(&si, sizeof(STARTUPINFOA)); si.cb = sizeof(STARTUPINFOA); + GetSystemDirectoryW( cmd, MAX_PATH - sizeof(rpcss)/sizeof(WCHAR) ); + lstrcatW( cmd, rpcss ); - memcpy(cmd, rpcss, sizeof(rpcss)); - - rslt = CreateProcessW( - NULL, /* executable */ - cmd, /* command line */ - NULL, /* process security attributes */ - NULL, /* primary thread security attributes */ - FALSE, /* inherit handles */ - 0, /* creation flags */ - NULL, /* use parent's environment */ - NULL, /* use parent's current directory */ - &si, /* STARTUPINFO pointer */ - &pi /* PROCESS_INFORMATION */ - ); + Wow64DisableWow64FsRedirection( &redir ); + rslt = CreateProcessW( cmd, cmd, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi ); + Wow64RevertWow64FsRedirection( redir ); if (rslt) { @@ -116,18 +107,18 @@ static BOOL start_rpcss(void) static inline BOOL is_epm_destination_local(RPC_BINDING_HANDLE handle) { - RpcBinding *bind = (RpcBinding *)handle; + RpcBinding *bind = handle; const char *protseq = bind->Protseq; const char *network_addr = bind->NetworkAddr; - return ((!strcmp(protseq, "ncalrpc") && !network_addr) || - (!strcmp(protseq, "ncacn_np") && + return (!strcmp(protseq, "ncalrpc") || + (!strcmp(protseq, "ncacn_np") && (!network_addr || !strcmp(network_addr, ".")))); } static RPC_STATUS get_epm_handle_client(RPC_BINDING_HANDLE handle, RPC_BINDING_HANDLE *epm_handle) { - RpcBinding *bind = (RpcBinding *)handle; + RpcBinding *bind = handle; const char * pszEndpoint = NULL; RPC_STATUS status; RpcBinding* epm_bind; @@ -149,7 +140,7 @@ static RPC_STATUS get_epm_handle_client(RPC_BINDING_HANDLE handle, RPC_BINDING_H status = RpcBindingCopy(handle, epm_handle); if (status != RPC_S_OK) return status; - epm_bind = (RpcBinding*)*epm_handle; + epm_bind = *epm_handle; if (epm_bind->AuthInfo) { /* don't bother with authenticating against the EPM by default @@ -171,7 +162,7 @@ static RPC_STATUS get_epm_handle_server(RPC_BINDING_HANDLE *epm_handle) static LONG WINAPI rpc_filter(EXCEPTION_POINTERS *__eptr) { - switch (GetExceptionCode()) + switch (__eptr->ExceptionRecord->ExceptionCode) { case EXCEPTION_ACCESS_VIOLATION: case EXCEPTION_ILLEGAL_INSTRUCTION: @@ -187,8 +178,8 @@ static LONG WINAPI rpc_filter(EXCEPTION_POINTERS *__eptr) RPC_STATUS WINAPI RpcEpRegisterA( RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR *BindingVector, UUID_VECTOR *UuidVector, RPC_CSTR Annotation ) { - PRPC_SERVER_INTERFACE If = (PRPC_SERVER_INTERFACE)IfSpec; - unsigned long i; + PRPC_SERVER_INTERFACE If = IfSpec; + ULONG i; RPC_STATUS status = RPC_S_OK; error_status_t status2; ept_entry_t *entries; @@ -197,13 +188,13 @@ RPC_STATUS WINAPI RpcEpRegisterA( RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR *Bind TRACE("(%p,%p,%p,%s)\n", IfSpec, BindingVector, UuidVector, debugstr_a((char*)Annotation)); TRACE(" ifid=%s\n", debugstr_guid(&If->InterfaceId.SyntaxGUID)); for (i=0; iCount; i++) { - RpcBinding* bind = (RpcBinding*)(BindingVector->BindingH[i]); - TRACE(" protseq[%ld]=%s\n", i, debugstr_a(bind->Protseq)); - TRACE(" endpoint[%ld]=%s\n", i, debugstr_a(bind->Endpoint)); + RpcBinding* bind = BindingVector->BindingH[i]; + TRACE(" protseq[%d]=%s\n", i, debugstr_a(bind->Protseq)); + TRACE(" endpoint[%d]=%s\n", i, debugstr_a(bind->Endpoint)); } if (UuidVector) { for (i=0; iCount; i++) - TRACE(" obj[%ld]=%s\n", i, debugstr_guid(UuidVector->Uuid[i])); + TRACE(" obj[%d]=%s\n", i, debugstr_guid(UuidVector->Uuid[i])); } if (!BindingVector->Count) return RPC_S_OK; @@ -222,10 +213,9 @@ RPC_STATUS WINAPI RpcEpRegisterA( RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR *Bind for (i = 0; i < BindingVector->Count; i++) { unsigned j; - RpcBinding* bind = (RpcBinding*)(BindingVector->BindingH[i]); + RpcBinding* bind = BindingVector->BindingH[i]; for (j = 0; j < (UuidVector ? UuidVector->Count : 1); j++) { - int len = strlen((char *)Annotation); status = TowerConstruct(&If->InterfaceId, &If->TransferSyntax, bind->Protseq, bind->Endpoint, bind->NetworkAddr, @@ -236,7 +226,9 @@ RPC_STATUS WINAPI RpcEpRegisterA( RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR *Bind memcpy(&entries[i * UuidVector->Count].object, &UuidVector->Uuid[j], sizeof(GUID)); else memset(&entries[i].object, 0, sizeof(entries[i].object)); - memcpy(entries[i].annotation, Annotation, min(len + 1, ept_max_annotation_size)); + if (Annotation) + memcpy(entries[i].annotation, Annotation, + min(strlen((char *)Annotation) + 1, ept_max_annotation_size)); } } @@ -280,14 +272,29 @@ RPC_STATUS WINAPI RpcEpRegisterA( RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR *Bind return status; } +/*********************************************************************** + * RpcEpRegisterW (RPCRT4.@) + */ +RPC_STATUS WINAPI RpcEpRegisterW( RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR *BindingVector, + UUID_VECTOR *UuidVector, RPC_WSTR Annotation ) +{ + LPSTR annA = RPCRT4_strdupWtoA(Annotation); + RPC_STATUS status; + + status = RpcEpRegisterA(IfSpec, BindingVector, UuidVector, (RPC_CSTR)annA); + + HeapFree(GetProcessHeap(), 0, annA); + return status; +} + /*********************************************************************** * RpcEpUnregister (RPCRT4.@) */ RPC_STATUS WINAPI RpcEpUnregister( RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR *BindingVector, UUID_VECTOR *UuidVector ) { - PRPC_SERVER_INTERFACE If = (PRPC_SERVER_INTERFACE)IfSpec; - unsigned long i; + PRPC_SERVER_INTERFACE If = IfSpec; + ULONG i; RPC_STATUS status = RPC_S_OK; error_status_t status2; ept_entry_t *entries; @@ -296,13 +303,13 @@ RPC_STATUS WINAPI RpcEpUnregister( RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR *Bin TRACE("(%p,%p,%p)\n", IfSpec, BindingVector, UuidVector); TRACE(" ifid=%s\n", debugstr_guid(&If->InterfaceId.SyntaxGUID)); for (i=0; iCount; i++) { - RpcBinding* bind = (RpcBinding*)(BindingVector->BindingH[i]); - TRACE(" protseq[%ld]=%s\n", i, debugstr_a(bind->Protseq)); - TRACE(" endpoint[%ld]=%s\n", i, debugstr_a(bind->Endpoint)); + RpcBinding* bind = BindingVector->BindingH[i]; + TRACE(" protseq[%d]=%s\n", i, debugstr_a(bind->Protseq)); + TRACE(" endpoint[%d]=%s\n", i, debugstr_a(bind->Endpoint)); } if (UuidVector) { for (i=0; iCount; i++) - TRACE(" obj[%ld]=%s\n", i, debugstr_guid(UuidVector->Uuid[i])); + TRACE(" obj[%d]=%s\n", i, debugstr_guid(UuidVector->Uuid[i])); } entries = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*entries) * BindingVector->Count * (UuidVector ? UuidVector->Count : 1)); @@ -319,7 +326,7 @@ RPC_STATUS WINAPI RpcEpUnregister( RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR *Bin for (i = 0; i < BindingVector->Count; i++) { unsigned j; - RpcBinding* bind = (RpcBinding*)(BindingVector->BindingH[i]); + RpcBinding* bind = BindingVector->BindingH[i]; for (j = 0; j < (UuidVector ? UuidVector->Count : 1); j++) { status = TowerConstruct(&If->InterfaceId, &If->TransferSyntax, @@ -372,8 +379,8 @@ RPC_STATUS WINAPI RpcEpUnregister( RPC_IF_HANDLE IfSpec, RPC_BINDING_VECTOR *Bin */ RPC_STATUS WINAPI RpcEpResolveBinding( RPC_BINDING_HANDLE Binding, RPC_IF_HANDLE IfSpec ) { - PRPC_CLIENT_INTERFACE If = (PRPC_CLIENT_INTERFACE)IfSpec; - RpcBinding* bind = (RpcBinding*)Binding; + PRPC_CLIENT_INTERFACE If = IfSpec; + RpcBinding* bind = Binding; RPC_STATUS status; error_status_t status2; handle_t handle; diff --git a/dll/win32/rpcrt4/rpc_message.c b/dll/win32/rpcrt4/rpc_message.c index e4f96a9179e..1d18627c339 100644 --- a/dll/win32/rpcrt4/rpc_message.c +++ b/dll/win32/rpcrt4/rpc_message.c @@ -51,32 +51,26 @@ WINE_DEFAULT_DEBUG_CHANNEL(rpc); (((alignment) - (((value) % (alignment)))) % (alignment)) #define ROUND_UP(value, alignment) (((value) + ((alignment) - 1)) & ~((alignment)-1)) -enum secure_packet_direction -{ - SECURE_PACKET_SEND, - SECURE_PACKET_RECEIVE -}; - static RPC_STATUS I_RpcReAllocateBuffer(PRPC_MESSAGE pMsg); -static DWORD RPCRT4_GetHeaderSize(const RpcPktHdr *Header) +DWORD RPCRT4_GetHeaderSize(const RpcPktHdr *Header) { static const DWORD header_sizes[] = { sizeof(Header->request), 0, sizeof(Header->response), sizeof(Header->fault), 0, 0, 0, 0, 0, 0, 0, sizeof(Header->bind), sizeof(Header->bind_ack), sizeof(Header->bind_nack), - 0, 0, 0, 0, 0 + 0, 0, sizeof(Header->auth3), 0, 0, 0, sizeof(Header->http) }; ULONG ret = 0; if (Header->common.ptype < sizeof(header_sizes) / sizeof(header_sizes[0])) { ret = header_sizes[Header->common.ptype]; if (ret == 0) - FIXME("unhandled packet type\n"); + FIXME("unhandled packet type %u\n", Header->common.ptype); if (Header->common.flags & RPC_FLG_OBJECT_UUID) ret += sizeof(UUID); } else { - TRACE("invalid packet type\n"); + WARN("invalid packet type %u\n", Header->common.ptype); } return ret; @@ -95,8 +89,23 @@ static int packet_has_auth_verifier(const RpcPktHdr *Header) !(Header->common.ptype == PKT_SHUTDOWN); } +static int packet_does_auth_negotiation(const RpcPktHdr *Header) +{ + switch (Header->common.ptype) + { + case PKT_BIND: + case PKT_BIND_ACK: + case PKT_AUTH3: + case PKT_ALTER_CONTEXT: + case PKT_ALTER_CONTEXT_RESP: + return TRUE; + default: + return FALSE; + } +} + static VOID RPCRT4_BuildCommonHeader(RpcPktHdr *Header, unsigned char PacketType, - unsigned long DataRepresentation) + ULONG DataRepresentation) { Header->common.rpc_ver = RPC_VER_MAJOR; Header->common.rpc_ver_minor = RPC_VER_MINOR; @@ -111,8 +120,8 @@ static VOID RPCRT4_BuildCommonHeader(RpcPktHdr *Header, unsigned char PacketType /* Flags and fragment length are computed in RPCRT4_Send. */ } -static RpcPktHdr *RPCRT4_BuildRequestHeader(unsigned long DataRepresentation, - unsigned long BufferLength, +static RpcPktHdr *RPCRT4_BuildRequestHeader(ULONG DataRepresentation, + ULONG BufferLength, unsigned short ProcNum, UUID *ObjectUuid) { @@ -141,8 +150,7 @@ static RpcPktHdr *RPCRT4_BuildRequestHeader(unsigned long DataRepresentation, return header; } -RpcPktHdr *RPCRT4_BuildResponseHeader(unsigned long DataRepresentation, - unsigned long BufferLength) +RpcPktHdr *RPCRT4_BuildResponseHeader(ULONG DataRepresentation, ULONG BufferLength) { RpcPktHdr *header; @@ -158,8 +166,7 @@ RpcPktHdr *RPCRT4_BuildResponseHeader(unsigned long DataRepresentation, return header; } -RpcPktHdr *RPCRT4_BuildFaultHeader(unsigned long DataRepresentation, - RPC_STATUS Status) +RpcPktHdr *RPCRT4_BuildFaultHeader(ULONG DataRepresentation, RPC_STATUS Status) { RpcPktHdr *header; @@ -175,63 +182,66 @@ RpcPktHdr *RPCRT4_BuildFaultHeader(unsigned long DataRepresentation, return header; } -RpcPktHdr *RPCRT4_BuildBindHeader(unsigned long DataRepresentation, +RpcPktHdr *RPCRT4_BuildBindHeader(ULONG DataRepresentation, unsigned short MaxTransmissionSize, unsigned short MaxReceiveSize, - unsigned long AssocGroupId, + ULONG AssocGroupId, const RPC_SYNTAX_IDENTIFIER *AbstractId, const RPC_SYNTAX_IDENTIFIER *TransferId) { RpcPktHdr *header; + RpcContextElement *ctxt_elem; - header = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(header->bind)); + header = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, + sizeof(header->bind) + FIELD_OFFSET(RpcContextElement, transfer_syntaxes[1])); if (header == NULL) { return NULL; } + ctxt_elem = (RpcContextElement *)(&header->bind + 1); RPCRT4_BuildCommonHeader(header, PKT_BIND, DataRepresentation); - header->common.frag_len = sizeof(header->bind); + header->common.frag_len = sizeof(header->bind) + FIELD_OFFSET(RpcContextElement, transfer_syntaxes[1]); header->bind.max_tsize = MaxTransmissionSize; header->bind.max_rsize = MaxReceiveSize; header->bind.assoc_gid = AssocGroupId; header->bind.num_elements = 1; - header->bind.num_syntaxes = 1; - header->bind.abstract = *AbstractId; - header->bind.transfer = *TransferId; + ctxt_elem->num_syntaxes = 1; + ctxt_elem->abstract_syntax = *AbstractId; + ctxt_elem->transfer_syntaxes[0] = *TransferId; return header; } -static RpcPktHdr *RPCRT4_BuildAuthHeader(unsigned long DataRepresentation) +static RpcPktHdr *RPCRT4_BuildAuthHeader(ULONG DataRepresentation) { RpcPktHdr *header; header = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, - sizeof(header->common) + 12); + sizeof(header->auth3)); if (header == NULL) return NULL; RPCRT4_BuildCommonHeader(header, PKT_AUTH3, DataRepresentation); - header->common.frag_len = 0x14; - header->common.auth_len = 0; + header->common.frag_len = sizeof(header->auth3); return header; } -RpcPktHdr *RPCRT4_BuildBindNackHeader(unsigned long DataRepresentation, +RpcPktHdr *RPCRT4_BuildBindNackHeader(ULONG DataRepresentation, unsigned char RpcVersion, - unsigned char RpcVersionMinor) + unsigned char RpcVersionMinor, + unsigned short RejectReason) { RpcPktHdr *header; - header = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(header->bind_nack)); + header = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, FIELD_OFFSET(RpcPktHdr, bind_nack.protocols[1])); if (header == NULL) { return NULL; } RPCRT4_BuildCommonHeader(header, PKT_BIND_NACK, DataRepresentation); - header->common.frag_len = sizeof(header->bind_nack); - header->bind_nack.reject_reason = REJECT_REASON_NOT_SPECIFIED; + header->common.frag_len = FIELD_OFFSET(RpcPktHdr, bind_nack.protocols[1]); + header->bind_nack.reject_reason = RejectReason; header->bind_nack.protocols_count = 1; header->bind_nack.protocols[0].rpc_ver = RpcVersion; header->bind_nack.protocols[0].rpc_ver_minor = RpcVersionMinor; @@ -239,25 +249,22 @@ RpcPktHdr *RPCRT4_BuildBindNackHeader(unsigned long DataRepresentation, return header; } -RpcPktHdr *RPCRT4_BuildBindAckHeader(unsigned long DataRepresentation, +RpcPktHdr *RPCRT4_BuildBindAckHeader(ULONG DataRepresentation, unsigned short MaxTransmissionSize, unsigned short MaxReceiveSize, - unsigned long AssocGroupId, + ULONG AssocGroupId, LPCSTR ServerAddress, - unsigned long Result, - unsigned long Reason, - const RPC_SYNTAX_IDENTIFIER *TransferId) + unsigned char ResultCount, + const RpcResult *Results) { RpcPktHdr *header; - unsigned long header_size; + ULONG header_size; RpcAddressString *server_address; - RpcResults *results; - RPC_SYNTAX_IDENTIFIER *transfer_id; + RpcResultList *results; header_size = sizeof(header->bind_ack) + ROUND_UP(FIELD_OFFSET(RpcAddressString, string[strlen(ServerAddress) + 1]), 4) + - sizeof(RpcResults) + - sizeof(RPC_SYNTAX_IDENTIFIER); + FIELD_OFFSET(RpcResultList, results[ResultCount]); header = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, header_size); if (header == NULL) { @@ -273,16 +280,125 @@ RpcPktHdr *RPCRT4_BuildBindAckHeader(unsigned long DataRepresentation, server_address->length = strlen(ServerAddress) + 1; strcpy(server_address->string, ServerAddress); /* results is 4-byte aligned */ - results = (RpcResults*)((ULONG_PTR)server_address + ROUND_UP(FIELD_OFFSET(RpcAddressString, string[server_address->length]), 4)); - results->num_results = 1; - results->results[0].result = Result; - results->results[0].reason = Reason; - transfer_id = (RPC_SYNTAX_IDENTIFIER*)(results + 1); - *transfer_id = *TransferId; + results = (RpcResultList*)((ULONG_PTR)server_address + ROUND_UP(FIELD_OFFSET(RpcAddressString, string[server_address->length]), 4)); + results->num_results = ResultCount; + memcpy(&results->results[0], Results, ResultCount * sizeof(*Results)); return header; } +RpcPktHdr *RPCRT4_BuildHttpHeader(ULONG DataRepresentation, + unsigned short flags, + unsigned short num_data_items, + unsigned int payload_size) +{ + RpcPktHdr *header; + + header = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(header->http) + payload_size); + if (header == NULL) { + ERR("failed to allocate memory\n"); + return NULL; + } + + RPCRT4_BuildCommonHeader(header, PKT_HTTP, DataRepresentation); + /* since the packet isn't current sent using RPCRT4_Send, set the flags + * manually here */ + header->common.flags = RPC_FLG_FIRST|RPC_FLG_LAST; + header->common.call_id = 0; + header->common.frag_len = sizeof(header->http) + payload_size; + header->http.flags = flags; + header->http.num_data_items = num_data_items; + + return header; +} + +#define WRITE_HTTP_PAYLOAD_FIELD_UINT32(payload, type, value) \ + do { \ + *(unsigned int *)(payload) = (type); \ + (payload) += 4; \ + *(unsigned int *)(payload) = (value); \ + (payload) += 4; \ + } while (0) + +#define WRITE_HTTP_PAYLOAD_FIELD_UUID(payload, type, uuid) \ + do { \ + *(unsigned int *)(payload) = (type); \ + (payload) += 4; \ + *(UUID *)(payload) = (uuid); \ + (payload) += sizeof(UUID); \ + } while (0) + +#define WRITE_HTTP_PAYLOAD_FIELD_FLOW_CONTROL(payload, bytes_transmitted, flow_control_increment, uuid) \ + do { \ + *(unsigned int *)(payload) = 0x00000001; \ + (payload) += 4; \ + *(unsigned int *)(payload) = (bytes_transmitted); \ + (payload) += 4; \ + *(unsigned int *)(payload) = (flow_control_increment); \ + (payload) += 4; \ + *(UUID *)(payload) = (uuid); \ + (payload) += sizeof(UUID); \ + } while (0) + +RpcPktHdr *RPCRT4_BuildHttpConnectHeader(unsigned short flags, int out_pipe, + const UUID *connection_uuid, + const UUID *pipe_uuid, + const UUID *association_uuid) +{ + RpcPktHdr *header; + unsigned int size; + char *payload; + + size = 8 + 4 + sizeof(UUID) + 4 + sizeof(UUID) + 8; + if (!out_pipe) + size += 8 + 4 + sizeof(UUID); + + header = RPCRT4_BuildHttpHeader(NDR_LOCAL_DATA_REPRESENTATION, flags, + out_pipe ? 4 : 6, size); + if (!header) return NULL; + payload = (char *)(&header->http+1); + + /* FIXME: what does this part of the payload do? */ + WRITE_HTTP_PAYLOAD_FIELD_UINT32(payload, 0x00000006, 0x00000001); + + WRITE_HTTP_PAYLOAD_FIELD_UUID(payload, 0x00000003, *connection_uuid); + WRITE_HTTP_PAYLOAD_FIELD_UUID(payload, 0x00000003, *pipe_uuid); + + if (out_pipe) + /* FIXME: what does this part of the payload do? */ + WRITE_HTTP_PAYLOAD_FIELD_UINT32(payload, 0x00000000, 0x00010000); + else + { + /* FIXME: what does this part of the payload do? */ + WRITE_HTTP_PAYLOAD_FIELD_UINT32(payload, 0x00000004, 0x40000000); + /* FIXME: what does this part of the payload do? */ + WRITE_HTTP_PAYLOAD_FIELD_UINT32(payload, 0x00000005, 0x000493e0); + + WRITE_HTTP_PAYLOAD_FIELD_UUID(payload, 0x0000000c, *association_uuid); + } + + return header; +} + +RpcPktHdr *RPCRT4_BuildHttpFlowControlHeader(BOOL server, ULONG bytes_transmitted, + ULONG flow_control_increment, + const UUID *pipe_uuid) +{ + RpcPktHdr *header; + char *payload; + + header = RPCRT4_BuildHttpHeader(NDR_LOCAL_DATA_REPRESENTATION, 0x2, 2, + 5 * sizeof(ULONG) + sizeof(UUID)); + if (!header) return NULL; + payload = (char *)(&header->http+1); + + WRITE_HTTP_PAYLOAD_FIELD_UINT32(payload, 0x0000000d, (server ? 0x0 : 0x3)); + + WRITE_HTTP_PAYLOAD_FIELD_FLOW_CONTROL(payload, bytes_transmitted, + flow_control_increment, *pipe_uuid); + return header; +} + VOID RPCRT4_FreeHeader(RpcPktHdr *Header) { HeapFree(GetProcessHeap(), 0, Header); @@ -362,7 +478,207 @@ static RPC_STATUS NCA2RPC_STATUS(NCA_STATUS status) } } -static RPC_STATUS RPCRT4_SecurePacket(RpcConnection *Connection, +/* assumes the common header fields have already been validated */ +BOOL RPCRT4_IsValidHttpPacket(RpcPktHdr *hdr, unsigned char *data, + unsigned short data_len) +{ + unsigned short i; + BYTE *p = data; + + for (i = 0; i < hdr->http.num_data_items; i++) + { + ULONG type; + + if (data_len < sizeof(ULONG)) + return FALSE; + + type = *(ULONG *)p; + p += sizeof(ULONG); + data_len -= sizeof(ULONG); + + switch (type) + { + case 0x3: + case 0xc: + if (data_len < sizeof(GUID)) + return FALSE; + p += sizeof(GUID); + data_len -= sizeof(GUID); + break; + case 0x0: + case 0x2: + case 0x4: + case 0x5: + case 0x6: + case 0xd: + if (data_len < sizeof(ULONG)) + return FALSE; + p += sizeof(ULONG); + data_len -= sizeof(ULONG); + break; + case 0x1: + if (data_len < 24) + return FALSE; + p += 24; + data_len -= 24; + break; + default: + FIXME("unimplemented type 0x%x\n", type); + break; + } + } + return TRUE; +} + +/* assumes the HTTP packet has been validated */ +static unsigned char *RPCRT4_NextHttpHeaderField(unsigned char *data) +{ + ULONG type; + + type = *(ULONG *)data; + data += sizeof(ULONG); + + switch (type) + { + case 0x3: + case 0xc: + return data + sizeof(GUID); + case 0x0: + case 0x2: + case 0x4: + case 0x5: + case 0x6: + case 0xd: + return data + sizeof(ULONG); + case 0x1: + return data + 24; + default: + FIXME("unimplemented type 0x%x\n", type); + return data; + } +} + +#define READ_HTTP_PAYLOAD_FIELD_TYPE(data) *(ULONG *)(data) +#define GET_HTTP_PAYLOAD_FIELD_DATA(data) ((data) + sizeof(ULONG)) + +/* assumes the HTTP packet has been validated */ +RPC_STATUS RPCRT4_ParseHttpPrepareHeader1(RpcPktHdr *header, + unsigned char *data, ULONG *field1) +{ + ULONG type; + if (header->http.flags != 0x0) + { + ERR("invalid flags 0x%x\n", header->http.flags); + return RPC_S_PROTOCOL_ERROR; + } + if (header->http.num_data_items != 1) + { + ERR("invalid number of data items %d\n", header->http.num_data_items); + return RPC_S_PROTOCOL_ERROR; + } + type = READ_HTTP_PAYLOAD_FIELD_TYPE(data); + if (type != 0x00000002) + { + ERR("invalid type 0x%08x\n", type); + return RPC_S_PROTOCOL_ERROR; + } + *field1 = *(ULONG *)GET_HTTP_PAYLOAD_FIELD_DATA(data); + return RPC_S_OK; +} + +/* assumes the HTTP packet has been validated */ +RPC_STATUS RPCRT4_ParseHttpPrepareHeader2(RpcPktHdr *header, + unsigned char *data, ULONG *field1, + ULONG *bytes_until_next_packet, + ULONG *field3) +{ + ULONG type; + if (header->http.flags != 0x0) + { + ERR("invalid flags 0x%x\n", header->http.flags); + return RPC_S_PROTOCOL_ERROR; + } + if (header->http.num_data_items != 3) + { + ERR("invalid number of data items %d\n", header->http.num_data_items); + return RPC_S_PROTOCOL_ERROR; + } + + type = READ_HTTP_PAYLOAD_FIELD_TYPE(data); + if (type != 0x00000006) + { + ERR("invalid type for field 1: 0x%08x\n", type); + return RPC_S_PROTOCOL_ERROR; + } + *field1 = *(ULONG *)GET_HTTP_PAYLOAD_FIELD_DATA(data); + data = RPCRT4_NextHttpHeaderField(data); + + type = READ_HTTP_PAYLOAD_FIELD_TYPE(data); + if (type != 0x00000000) + { + ERR("invalid type for field 2: 0x%08x\n", type); + return RPC_S_PROTOCOL_ERROR; + } + *bytes_until_next_packet = *(ULONG *)GET_HTTP_PAYLOAD_FIELD_DATA(data); + data = RPCRT4_NextHttpHeaderField(data); + + type = READ_HTTP_PAYLOAD_FIELD_TYPE(data); + if (type != 0x00000002) + { + ERR("invalid type for field 3: 0x%08x\n", type); + return RPC_S_PROTOCOL_ERROR; + } + *field3 = *(ULONG *)GET_HTTP_PAYLOAD_FIELD_DATA(data); + + return RPC_S_OK; +} + +RPC_STATUS RPCRT4_ParseHttpFlowControlHeader(RpcPktHdr *header, + unsigned char *data, BOOL server, + ULONG *bytes_transmitted, + ULONG *flow_control_increment, + UUID *pipe_uuid) +{ + ULONG type; + if (header->http.flags != 0x2) + { + ERR("invalid flags 0x%x\n", header->http.flags); + return RPC_S_PROTOCOL_ERROR; + } + if (header->http.num_data_items != 2) + { + ERR("invalid number of data items %d\n", header->http.num_data_items); + return RPC_S_PROTOCOL_ERROR; + } + + type = READ_HTTP_PAYLOAD_FIELD_TYPE(data); + if (type != 0x0000000d) + { + ERR("invalid type for field 1: 0x%08x\n", type); + return RPC_S_PROTOCOL_ERROR; + } + if (*(ULONG *)GET_HTTP_PAYLOAD_FIELD_DATA(data) != (server ? 0x3 : 0x0)) + { + ERR("invalid type for 0xd field data: 0x%08x\n", *(ULONG *)GET_HTTP_PAYLOAD_FIELD_DATA(data)); + return RPC_S_PROTOCOL_ERROR; + } + data = RPCRT4_NextHttpHeaderField(data); + + type = READ_HTTP_PAYLOAD_FIELD_TYPE(data); + if (type != 0x00000001) + { + ERR("invalid type for field 2: 0x%08x\n", type); + return RPC_S_PROTOCOL_ERROR; + } + *bytes_transmitted = *(ULONG *)GET_HTTP_PAYLOAD_FIELD_DATA(data); + *flow_control_increment = *(ULONG *)(GET_HTTP_PAYLOAD_FIELD_DATA(data) + 4); + *pipe_uuid = *(UUID *)(GET_HTTP_PAYLOAD_FIELD_DATA(data) + 8); + + return RPC_S_OK; +} + + +RPC_STATUS RPCRT4_default_secure_packet(RpcConnection *Connection, enum secure_packet_direction dir, RpcPktHdr *hdr, unsigned int hdr_size, unsigned char *stub_data, unsigned int stub_data_size, @@ -441,9 +757,9 @@ static RPC_STATUS RPCRT4_SecurePacket(RpcConnection *Connection, * * Transmit a packet with authorization data over connection in acceptable fragments. */ -static RPC_STATUS RPCRT4_SendWithAuth(RpcConnection *Connection, RpcPktHdr *Header, - void *Buffer, unsigned int BufferLength, - const void *Auth, unsigned int AuthLength) +RPC_STATUS RPCRT4_SendWithAuth(RpcConnection *Connection, RpcPktHdr *Header, + void *Buffer, unsigned int BufferLength, + const void *Auth, unsigned int AuthLength) { PUCHAR buffer_pos; DWORD hdr_size; @@ -500,7 +816,7 @@ static RPC_STATUS RPCRT4_SendWithAuth(RpcConnection *Connection, RpcPktHdr *Head memcpy(pkt + hdr_size, buffer_pos, Header->common.frag_len - hdr_size - auth_pad_len - alen); /* add the authorization info */ - if (Connection->AuthInfo && packet_has_auth_verifier(Header)) + if (Header->common.auth_len) { RpcAuthVerifier *auth_hdr = (RpcAuthVerifier *)&pkt[Header->common.frag_len - alen]; @@ -509,13 +825,13 @@ static RPC_STATUS RPCRT4_SendWithAuth(RpcConnection *Connection, RpcPktHdr *Head auth_hdr->auth_pad_length = auth_pad_len; auth_hdr->auth_reserved = 0; /* a unique number... */ - auth_hdr->auth_context_id = (unsigned long)Connection; + auth_hdr->auth_context_id = Connection->auth_context_id; if (AuthLength) memcpy(auth_hdr + 1, Auth, AuthLength); else { - status = RPCRT4_SecurePacket(Connection, SECURE_PACKET_SEND, + status = rpcrt4_conn_secure_packet(Connection, SECURE_PACKET_SEND, (RpcPktHdr *)pkt, hdr_size, pkt + hdr_size, Header->common.frag_len - hdr_size - alen, auth_hdr, @@ -548,43 +864,84 @@ write: } /*********************************************************************** - * RPCRT4_ClientAuthorize (internal) + * RPCRT4_default_authorize (internal) * - * Authorize a client connection. A NULL in param signifies a new connection. + * Authorize a client connection. */ -static RPC_STATUS RPCRT4_ClientAuthorize(RpcConnection *conn, SecBuffer *in, - SecBuffer *out) +RPC_STATUS RPCRT4_default_authorize(RpcConnection *conn, BOOL first_time, + unsigned char *in_buffer, + unsigned int in_size, + unsigned char *out_buffer, + unsigned int *out_size) { SECURITY_STATUS r; SecBufferDesc out_desc; SecBufferDesc inp_desc; SecPkgContext_Sizes secctx_sizes; BOOL continue_needed; - ULONG context_req = ISC_REQ_CONNECTION | ISC_REQ_USE_DCE_STYLE | - ISC_REQ_MUTUAL_AUTH | ISC_REQ_DELEGATE; + ULONG context_req; + SecBuffer in, out; - if (conn->AuthInfo->AuthnLevel == RPC_C_AUTHN_LEVEL_PKT_INTEGRITY) - context_req |= ISC_REQ_INTEGRITY; - else if (conn->AuthInfo->AuthnLevel == RPC_C_AUTHN_LEVEL_PKT_PRIVACY) - context_req |= ISC_REQ_CONFIDENTIALITY | ISC_REQ_INTEGRITY; + if (!out_buffer) + { + *out_size = conn->AuthInfo->cbMaxToken; + return RPC_S_OK; + } - out->BufferType = SECBUFFER_TOKEN; - out->cbBuffer = conn->AuthInfo->cbMaxToken; - out->pvBuffer = HeapAlloc(GetProcessHeap(), 0, out->cbBuffer); - if (!out->pvBuffer) return ERROR_OUTOFMEMORY; + in.BufferType = SECBUFFER_TOKEN; + in.pvBuffer = in_buffer; + in.cbBuffer = in_size; + + out.BufferType = SECBUFFER_TOKEN; + out.pvBuffer = out_buffer; + out.cbBuffer = *out_size; out_desc.ulVersion = 0; out_desc.cBuffers = 1; - out_desc.pBuffers = out; + out_desc.pBuffers = &out; - inp_desc.cBuffers = 1; - inp_desc.pBuffers = in; inp_desc.ulVersion = 0; + inp_desc.cBuffers = 1; + inp_desc.pBuffers = ∈ - r = InitializeSecurityContextW(&conn->AuthInfo->cred, in ? &conn->ctx : NULL, - in ? NULL : conn->AuthInfo->server_principal_name, context_req, 0, - SECURITY_NETWORK_DREP, in ? &inp_desc : NULL, 0, &conn->ctx, - &out_desc, &conn->attr, &conn->exp); + if (conn->server) + { + context_req = ASC_REQ_CONNECTION | ASC_REQ_USE_DCE_STYLE | + ASC_REQ_DELEGATE; + + if (conn->AuthInfo->AuthnLevel == RPC_C_AUTHN_LEVEL_PKT_INTEGRITY) + context_req |= ASC_REQ_INTEGRITY; + else if (conn->AuthInfo->AuthnLevel == RPC_C_AUTHN_LEVEL_PKT_PRIVACY) + context_req |= ASC_REQ_CONFIDENTIALITY | ASC_REQ_INTEGRITY; + + r = AcceptSecurityContext(&conn->AuthInfo->cred, + first_time ? NULL : &conn->ctx, + &inp_desc, context_req, SECURITY_NETWORK_DREP, + &conn->ctx, + &out_desc, &conn->attr, &conn->exp); + if (r == SEC_E_OK || r == SEC_I_COMPLETE_NEEDED) + { + /* authorisation done, so nothing more to send */ + out.cbBuffer = 0; + } + } + else + { + context_req = ISC_REQ_CONNECTION | ISC_REQ_USE_DCE_STYLE | + ISC_REQ_MUTUAL_AUTH | ISC_REQ_DELEGATE; + + if (conn->AuthInfo->AuthnLevel == RPC_C_AUTHN_LEVEL_PKT_INTEGRITY) + context_req |= ISC_REQ_INTEGRITY; + else if (conn->AuthInfo->AuthnLevel == RPC_C_AUTHN_LEVEL_PKT_PRIVACY) + context_req |= ISC_REQ_CONFIDENTIALITY | ISC_REQ_INTEGRITY; + + r = InitializeSecurityContextW(&conn->AuthInfo->cred, + first_time ? NULL: &conn->ctx, + first_time ? conn->AuthInfo->server_principal_name : NULL, + context_req, 0, SECURITY_NETWORK_DREP, + first_time ? NULL : &inp_desc, 0, &conn->ctx, + &out_desc, &conn->attr, &conn->exp); + } if (FAILED(r)) { WARN("InitializeSecurityContext failed with error 0x%08x\n", r); @@ -606,7 +963,7 @@ static RPC_STATUS RPCRT4_ClientAuthorize(RpcConnection *conn, SecBuffer *in, } } - TRACE("cbBuffer = %d\n", out->cbBuffer); + TRACE("cbBuffer = %d\n", out.cbBuffer); if (!continue_needed) { @@ -620,45 +977,240 @@ static RPC_STATUS RPCRT4_ClientAuthorize(RpcConnection *conn, SecBuffer *in, conn->encryption_auth_len = secctx_sizes.cbSecurityTrailer; } + *out_size = out.cbBuffer; return RPC_S_OK; failed: - HeapFree(GetProcessHeap(), 0, out->pvBuffer); - out->pvBuffer = NULL; + *out_size = 0; return ERROR_ACCESS_DENIED; /* FIXME: is this correct? */ } /*********************************************************************** - * RPCRT4_AuthorizeBinding (internal) + * RPCRT4_ClientConnectionAuth (internal) */ -RPC_STATUS RPCRT4_AuthorizeConnection(RpcConnection* conn, BYTE *challenge, - ULONG count) +RPC_STATUS RPCRT4_ClientConnectionAuth(RpcConnection* conn, BYTE *challenge, + ULONG count) { - SecBuffer inp, out; RpcPktHdr *resp_hdr; RPC_STATUS status; + unsigned char *out_buffer; + unsigned int out_len = 0; TRACE("challenge %s, %d bytes\n", challenge, count); - inp.BufferType = SECBUFFER_TOKEN; - inp.pvBuffer = challenge; - inp.cbBuffer = count; - - status = RPCRT4_ClientAuthorize(conn, &inp, &out); + status = rpcrt4_conn_authorize(conn, FALSE, challenge, count, NULL, &out_len); + if (status) return status; + out_buffer = HeapAlloc(GetProcessHeap(), 0, out_len); + if (!out_buffer) return RPC_S_OUT_OF_RESOURCES; + status = rpcrt4_conn_authorize(conn, FALSE, challenge, count, out_buffer, &out_len); if (status) return status; resp_hdr = RPCRT4_BuildAuthHeader(NDR_LOCAL_DATA_REPRESENTATION); - if (!resp_hdr) - return E_OUTOFMEMORY; - status = RPCRT4_SendWithAuth(conn, resp_hdr, NULL, 0, out.pvBuffer, out.cbBuffer); + if (resp_hdr) + status = RPCRT4_SendWithAuth(conn, resp_hdr, NULL, 0, out_buffer, out_len); + else + status = RPC_S_OUT_OF_RESOURCES; - HeapFree(GetProcessHeap(), 0, out.pvBuffer); + HeapFree(GetProcessHeap(), 0, out_buffer); RPCRT4_FreeHeader(resp_hdr); return status; } +/*********************************************************************** + * RPCRT4_ServerConnectionAuth (internal) + */ +RPC_STATUS RPCRT4_ServerConnectionAuth(RpcConnection* conn, + BOOL start, + RpcAuthVerifier *auth_data_in, + ULONG auth_length_in, + unsigned char **auth_data_out, + ULONG *auth_length_out) +{ + unsigned char *out_buffer; + unsigned int out_size; + RPC_STATUS status; + + if (start) + { + /* remove any existing authentication information */ + if (conn->AuthInfo) + { + RpcAuthInfo_Release(conn->AuthInfo); + conn->AuthInfo = NULL; + } + if (SecIsValidHandle(&conn->ctx)) + { + DeleteSecurityContext(&conn->ctx); + SecInvalidateHandle(&conn->ctx); + } + if (auth_length_in >= sizeof(RpcAuthVerifier)) + { + CredHandle cred; + TimeStamp exp; + ULONG max_token; + + status = RPCRT4_ServerGetRegisteredAuthInfo( + auth_data_in->auth_type, &cred, &exp, &max_token); + if (status != RPC_S_OK) + { + ERR("unknown authentication service %u\n", auth_data_in->auth_type); + return status; + } + + status = RpcAuthInfo_Create(auth_data_in->auth_level, + auth_data_in->auth_type, cred, exp, + max_token, NULL, &conn->AuthInfo); + if (status != RPC_S_OK) + return status; + + /* FIXME: should auth_data_in->auth_context_id be checked in the !start case? */ + conn->auth_context_id = auth_data_in->auth_context_id; + } + } + + if (auth_length_in < sizeof(RpcAuthVerifier)) + return RPC_S_OK; + + if (!conn->AuthInfo) + /* should have filled in authentication info by now */ + return RPC_S_PROTOCOL_ERROR; + + status = rpcrt4_conn_authorize( + conn, start, (unsigned char *)(auth_data_in + 1), + auth_length_in - sizeof(RpcAuthVerifier), NULL, &out_size); + if (status) return status; + + out_buffer = HeapAlloc(GetProcessHeap(), 0, out_size); + if (!out_buffer) return RPC_S_OUT_OF_RESOURCES; + + status = rpcrt4_conn_authorize( + conn, start, (unsigned char *)(auth_data_in + 1), + auth_length_in - sizeof(RpcAuthVerifier), out_buffer, &out_size); + if (status != RPC_S_OK) + { + HeapFree(GetProcessHeap(), 0, out_buffer); + return status; + } + + if (out_size && !auth_length_out) + { + ERR("expected authentication to be complete but SSP returned data of " + "%u bytes to be sent back to client\n", out_size); + HeapFree(GetProcessHeap(), 0, out_buffer); + return RPC_S_SEC_PKG_ERROR; + } + else + { + *auth_data_out = out_buffer; + *auth_length_out = out_size; + } + + return status; +} + +/*********************************************************************** + * RPCRT4_default_is_authorized (internal) + * + * Has a connection started the process of authorizing with the server? + */ +BOOL RPCRT4_default_is_authorized(RpcConnection *Connection) +{ + return Connection->AuthInfo && SecIsValidHandle(&Connection->ctx); +} + +/*********************************************************************** + * RPCRT4_default_impersonate_client (internal) + * + */ +RPC_STATUS RPCRT4_default_impersonate_client(RpcConnection *conn) +{ + SECURITY_STATUS sec_status; + + TRACE("(%p)\n", conn); + + if (!conn->AuthInfo || !SecIsValidHandle(&conn->ctx)) + return RPC_S_NO_CONTEXT_AVAILABLE; + sec_status = ImpersonateSecurityContext(&conn->ctx); + if (sec_status != SEC_E_OK) + WARN("ImpersonateSecurityContext returned 0x%08x\n", sec_status); + switch (sec_status) + { + case SEC_E_UNSUPPORTED_FUNCTION: + return RPC_S_CANNOT_SUPPORT; + case SEC_E_NO_IMPERSONATION: + return RPC_S_NO_CONTEXT_AVAILABLE; + case SEC_E_OK: + return RPC_S_OK; + default: + return RPC_S_SEC_PKG_ERROR; + } +} + +/*********************************************************************** + * RPCRT4_default_revert_to_self (internal) + * + */ +RPC_STATUS RPCRT4_default_revert_to_self(RpcConnection *conn) +{ + SECURITY_STATUS sec_status; + + TRACE("(%p)\n", conn); + + if (!conn->AuthInfo || !SecIsValidHandle(&conn->ctx)) + return RPC_S_NO_CONTEXT_AVAILABLE; + sec_status = RevertSecurityContext(&conn->ctx); + if (sec_status != SEC_E_OK) + WARN("RevertSecurityContext returned 0x%08x\n", sec_status); + switch (sec_status) + { + case SEC_E_UNSUPPORTED_FUNCTION: + return RPC_S_CANNOT_SUPPORT; + case SEC_E_NO_IMPERSONATION: + return RPC_S_NO_CONTEXT_AVAILABLE; + case SEC_E_OK: + return RPC_S_OK; + default: + return RPC_S_SEC_PKG_ERROR; + } +} + +/*********************************************************************** + * RPCRT4_default_inquire_auth_client (internal) + * + * Default function to retrieve the authentication details that the client + * is using to call the server. + */ +RPC_STATUS RPCRT4_default_inquire_auth_client( + RpcConnection *conn, RPC_AUTHZ_HANDLE *privs, RPC_WSTR *server_princ_name, + ULONG *authn_level, ULONG *authn_svc, ULONG *authz_svc, ULONG flags) +{ + if (!conn->AuthInfo) return RPC_S_BINDING_HAS_NO_AUTH; + + if (privs) + { + FIXME("privs not implemented\n"); + *privs = NULL; + } + if (server_princ_name) + { + *server_princ_name = RPCRT4_strdupW(conn->AuthInfo->server_principal_name); + if (!*server_princ_name) return ERROR_OUTOFMEMORY; + } + if (authn_level) *authn_level = conn->AuthInfo->AuthnLevel; + if (authn_svc) *authn_svc = conn->AuthInfo->AuthnSvc; + if (authz_svc) + { + FIXME("authorization service not implemented\n"); + *authz_svc = RPC_C_AUTHZ_NONE; + } + if (flags) + FIXME("flags 0x%x not implemented\n", flags); + + return RPC_S_OK; +} + /*********************************************************************** * RPCRT4_Send (internal) * @@ -668,26 +1220,35 @@ RPC_STATUS RPCRT4_Send(RpcConnection *Connection, RpcPktHdr *Header, void *Buffer, unsigned int BufferLength) { RPC_STATUS r; - SecBuffer out; - if (!Connection->AuthInfo || SecIsValidHandle(&Connection->ctx)) + if (packet_does_auth_negotiation(Header) && + Connection->AuthInfo && + !rpcrt4_conn_is_authorized(Connection)) { - return RPCRT4_SendWithAuth(Connection, Header, Buffer, BufferLength, NULL, 0); - } + unsigned int out_size = 0; + unsigned char *out_buffer; - /* tack on a negotiate packet */ - r = RPCRT4_ClientAuthorize(Connection, NULL, &out); - if (r == RPC_S_OK) - { - r = RPCRT4_SendWithAuth(Connection, Header, Buffer, BufferLength, out.pvBuffer, out.cbBuffer); - HeapFree(GetProcessHeap(), 0, out.pvBuffer); + r = rpcrt4_conn_authorize(Connection, TRUE, NULL, 0, NULL, &out_size); + if (r != RPC_S_OK) return r; + + out_buffer = HeapAlloc(GetProcessHeap(), 0, out_size); + if (!out_buffer) return RPC_S_OUT_OF_RESOURCES; + + /* tack on a negotiate packet */ + r = rpcrt4_conn_authorize(Connection, TRUE, NULL, 0, out_buffer, &out_size); + if (r == RPC_S_OK) + r = RPCRT4_SendWithAuth(Connection, Header, Buffer, BufferLength, out_buffer, out_size); + + HeapFree(GetProcessHeap(), 0, out_buffer); } + else + r = RPCRT4_SendWithAuth(Connection, Header, Buffer, BufferLength, NULL, 0); return r; } /* validates version and frag_len fields */ -static RPC_STATUS RPCRT4_ValidateCommonHeader(const RpcPktCommonHdr *hdr) +RPC_STATUS RPCRT4_ValidateCommonHeader(const RpcPktCommonHdr *hdr) { DWORD hdr_length; @@ -716,11 +1277,11 @@ static RPC_STATUS RPCRT4_ValidateCommonHeader(const RpcPktCommonHdr *hdr) } /*********************************************************************** - * RPCRT4_receive_fragment (internal) + * RPCRT4_default_receive_fragment (internal) * * Receive a fragment from a connection. */ -static RPC_STATUS RPCRT4_receive_fragment(RpcConnection *Connection, RpcPktHdr **Header, void **Payload) +static RPC_STATUS RPCRT4_default_receive_fragment(RpcConnection *Connection, RpcPktHdr **Header, void **Payload) { RPC_STATUS status; DWORD hdr_length; @@ -794,6 +1355,14 @@ fail: return status; } +static RPC_STATUS RPCRT4_receive_fragment(RpcConnection *Connection, RpcPktHdr **Header, void **Payload) +{ + if (Connection->ops->receive_fragment) + return Connection->ops->receive_fragment(Connection, Header, Payload); + else + return RPCRT4_default_receive_fragment(Connection, Header, Payload); +} + /*********************************************************************** * RPCRT4_ReceiveWithAuth (internal) * @@ -803,20 +1372,22 @@ fail: RPC_STATUS RPCRT4_ReceiveWithAuth(RpcConnection *Connection, RpcPktHdr **Header, PRPC_MESSAGE pMsg, unsigned char **auth_data_out, - unsigned long *auth_length_out) + ULONG *auth_length_out) { RPC_STATUS status; DWORD hdr_length; unsigned short first_flag; - unsigned long data_length; - unsigned long buffer_length; - unsigned long auth_length = 0; + ULONG data_length; + ULONG buffer_length; + ULONG auth_length = 0; unsigned char *auth_data = NULL; RpcPktHdr *CurrentHeader = NULL; void *payload = NULL; *Header = NULL; pMsg->Buffer = NULL; + if (auth_data_out) *auth_data_out = NULL; + if (auth_length_out) *auth_length_out = 0; TRACE("(%p, %p, %p, %p)\n", Connection, Header, pMsg, auth_data_out); @@ -874,7 +1445,7 @@ RPC_STATUS RPCRT4_ReceiveWithAuth(RpcConnection *Connection, RpcPktHdr **Header, } if (CurrentHeader->common.auth_len != auth_length) { - WARN("auth_len header field changed from %ld to %d\n", + WARN("auth_len header field changed from %d to %d\n", auth_length, CurrentHeader->common.auth_len); status = RPC_S_PROTOCOL_ERROR; goto fail; @@ -888,7 +1459,7 @@ RPC_STATUS RPCRT4_ReceiveWithAuth(RpcConnection *Connection, RpcPktHdr **Header, data_length = CurrentHeader->common.frag_len - hdr_length - header_auth_len; if (data_length + buffer_length > pMsg->BufferLength) { - TRACE("allocation hint exceeded, new buffer length = %ld\n", + TRACE("allocation hint exceeded, new buffer length = %d\n", data_length + buffer_length); pMsg->BufferLength = data_length + buffer_length; status = I_RpcReAllocateBuffer(pMsg); @@ -914,9 +1485,9 @@ RPC_STATUS RPCRT4_ReceiveWithAuth(RpcConnection *Connection, RpcPktHdr **Header, /* these packets are handled specially, not by the generic SecurePacket * function */ - if (!auth_data_out && SecIsValidHandle(&Connection->ctx)) + if (!packet_does_auth_negotiation(*Header) && rpcrt4_conn_is_authorized(Connection)) { - status = RPCRT4_SecurePacket(Connection, SECURE_PACKET_RECEIVE, + status = rpcrt4_conn_secure_packet(Connection, SECURE_PACKET_RECEIVE, CurrentHeader, hdr_length, (unsigned char *)pMsg->Buffer + buffer_length, data_length, (RpcAuthVerifier *)auth_data, @@ -976,8 +1547,8 @@ fail: * * Receive a packet from connection and merge the fragments. */ -RPC_STATUS RPCRT4_Receive(RpcConnection *Connection, RpcPktHdr **Header, - PRPC_MESSAGE pMsg) +static RPC_STATUS RPCRT4_Receive(RpcConnection *Connection, RpcPktHdr **Header, + PRPC_MESSAGE pMsg) { return RPCRT4_ReceiveWithAuth(Connection, Header, pMsg, NULL, NULL); } @@ -998,7 +1569,7 @@ RPC_STATUS RPCRT4_Receive(RpcConnection *Connection, RpcPktHdr **Header, */ RPC_STATUS WINAPI I_RpcNegotiateTransferSyntax(PRPC_MESSAGE pMsg) { - RpcBinding* bind = (RpcBinding*)pMsg->Handle; + RpcBinding* bind = pMsg->Handle; RpcConnection* conn; RPC_STATUS status = RPC_S_OK; @@ -1063,7 +1634,7 @@ RPC_STATUS WINAPI I_RpcNegotiateTransferSyntax(PRPC_MESSAGE pMsg) RPC_STATUS WINAPI I_RpcGetBuffer(PRPC_MESSAGE pMsg) { RPC_STATUS status; - RpcBinding* bind = (RpcBinding*)pMsg->Handle; + RpcBinding* bind = pMsg->Handle; TRACE("(%p): BufferLength=%d\n", pMsg, pMsg->BufferLength); @@ -1120,7 +1691,7 @@ static RPC_STATUS I_RpcReAllocateBuffer(PRPC_MESSAGE pMsg) */ RPC_STATUS WINAPI I_RpcFreeBuffer(PRPC_MESSAGE pMsg) { - RpcBinding* bind = (RpcBinding*)pMsg->Handle; + RpcBinding* bind = pMsg->Handle; TRACE("(%p) Buffer=%p\n", pMsg, pMsg->Buffer); @@ -1214,7 +1785,7 @@ static DWORD WINAPI async_notifier_proc(LPVOID p) */ RPC_STATUS WINAPI I_RpcSend(PRPC_MESSAGE pMsg) { - RpcBinding* bind = (RpcBinding*)pMsg->Handle; + RpcBinding* bind = pMsg->Handle; RpcConnection* conn; RPC_STATUS status; RpcPktHdr *hdr; @@ -1268,7 +1839,7 @@ static inline BOOL is_hard_error(RPC_STATUS status) */ RPC_STATUS WINAPI I_RpcReceive(PRPC_MESSAGE pMsg) { - RpcBinding* bind = (RpcBinding*)pMsg->Handle; + RpcBinding* bind = pMsg->Handle; RPC_STATUS status; RpcPktHdr *hdr = NULL; RpcConnection *conn; @@ -1287,7 +1858,7 @@ RPC_STATUS WINAPI I_RpcReceive(PRPC_MESSAGE pMsg) case PKT_RESPONSE: break; case PKT_FAULT: - ERR ("we got fault packet with status 0x%lx\n", hdr->fault.status); + ERR ("we got fault packet with status 0x%x\n", hdr->fault.status); status = NCA2RPC_STATUS(hdr->fault.status); if (is_hard_error(status)) goto fail; @@ -1360,7 +1931,7 @@ RPC_STATUS WINAPI I_RpcSendReceive(PRPC_MESSAGE pMsg) */ RPC_STATUS WINAPI I_RpcAsyncSetHandle(PRPC_MESSAGE pMsg, PRPC_ASYNC_STATE pAsync) { - RpcBinding* bind = (RpcBinding*)pMsg->Handle; + RpcBinding* bind = pMsg->Handle; RpcConnection *conn; TRACE("(%p, %p)\n", pMsg, pAsync); diff --git a/dll/win32/rpcrt4/rpc_message.h b/dll/win32/rpcrt4/rpc_message.h index e4033882feb..3ad876174e0 100644 --- a/dll/win32/rpcrt4/rpc_message.h +++ b/dll/win32/rpcrt4/rpc_message.h @@ -25,16 +25,35 @@ typedef unsigned int NCA_STATUS; -RpcPktHdr *RPCRT4_BuildFaultHeader(unsigned long DataRepresentation, RPC_STATUS Status); -RpcPktHdr *RPCRT4_BuildResponseHeader(unsigned long DataRepresentation, unsigned long BufferLength); -RpcPktHdr *RPCRT4_BuildBindHeader(unsigned long DataRepresentation, unsigned short MaxTransmissionSize, unsigned short MaxReceiveSize, unsigned long AssocGroupId, const RPC_SYNTAX_IDENTIFIER *AbstractId, const RPC_SYNTAX_IDENTIFIER *TransferId); -RpcPktHdr *RPCRT4_BuildBindNackHeader(unsigned long DataRepresentation, unsigned char RpcVersion, unsigned char RpcVersionMinor); -RpcPktHdr *RPCRT4_BuildBindAckHeader(unsigned long DataRepresentation, unsigned short MaxTransmissionSize, unsigned short MaxReceiveSize, unsigned long AssocGroupId, LPCSTR ServerAddress, unsigned long Result, unsigned long Reason, const RPC_SYNTAX_IDENTIFIER *TransferId); -VOID RPCRT4_FreeHeader(RpcPktHdr *Header); -RPC_STATUS RPCRT4_Send(RpcConnection *Connection, RpcPktHdr *Header, void *Buffer, unsigned int BufferLength); -RPC_STATUS RPCRT4_Receive(RpcConnection *Connection, RpcPktHdr **Header, PRPC_MESSAGE pMsg); -RPC_STATUS RPCRT4_ReceiveWithAuth(RpcConnection *Connection, RpcPktHdr **Header, PRPC_MESSAGE pMsg, unsigned char **auth_data_out, unsigned long *auth_length_out); -NCA_STATUS RPC2NCA_STATUS(RPC_STATUS status); -RPC_STATUS RPCRT4_AuthorizeConnection(RpcConnection* conn, BYTE *challenge, ULONG count); +RpcPktHdr *RPCRT4_BuildFaultHeader(ULONG DataRepresentation, RPC_STATUS Status) DECLSPEC_HIDDEN; +RpcPktHdr *RPCRT4_BuildResponseHeader(ULONG DataRepresentation, ULONG BufferLength) DECLSPEC_HIDDEN; +RpcPktHdr *RPCRT4_BuildBindHeader(ULONG DataRepresentation, unsigned short MaxTransmissionSize, unsigned short MaxReceiveSize, ULONG AssocGroupId, const RPC_SYNTAX_IDENTIFIER *AbstractId, const RPC_SYNTAX_IDENTIFIER *TransferId) DECLSPEC_HIDDEN; +RpcPktHdr *RPCRT4_BuildBindNackHeader(ULONG DataRepresentation, unsigned char RpcVersion, unsigned char RpcVersionMinor, unsigned short RejectReason) DECLSPEC_HIDDEN; +RpcPktHdr *RPCRT4_BuildBindAckHeader(ULONG DataRepresentation, unsigned short MaxTransmissionSize, unsigned short MaxReceiveSize, ULONG AssocGroupId, LPCSTR ServerAddress, unsigned char ResultCount, const RpcResult *Results) DECLSPEC_HIDDEN; +RpcPktHdr *RPCRT4_BuildHttpHeader(ULONG DataRepresentation, unsigned short flags, unsigned short num_data_items, unsigned int payload_size) DECLSPEC_HIDDEN; +RpcPktHdr *RPCRT4_BuildHttpConnectHeader(unsigned short flags, int out_pipe, const UUID *connection_uuid, const UUID *pipe_uuid, const UUID *association_uuid) DECLSPEC_HIDDEN; +RpcPktHdr *RPCRT4_BuildHttpFlowControlHeader(BOOL server, ULONG bytes_transmitted, ULONG flow_control_increment, const UUID *pipe_uuid) DECLSPEC_HIDDEN; +VOID RPCRT4_FreeHeader(RpcPktHdr *Header) DECLSPEC_HIDDEN; +RPC_STATUS RPCRT4_Send(RpcConnection *Connection, RpcPktHdr *Header, void *Buffer, unsigned int BufferLength) DECLSPEC_HIDDEN; +RPC_STATUS RPCRT4_SendWithAuth(RpcConnection *Connection, RpcPktHdr *Header, void *Buffer, unsigned int BufferLength, const void *Auth, unsigned int AuthLength) DECLSPEC_HIDDEN; +RPC_STATUS RPCRT4_ReceiveWithAuth(RpcConnection *Connection, RpcPktHdr **Header, PRPC_MESSAGE pMsg, unsigned char **auth_data_out, ULONG *auth_length_out) DECLSPEC_HIDDEN; +DWORD RPCRT4_GetHeaderSize(const RpcPktHdr *Header) DECLSPEC_HIDDEN; +RPC_STATUS RPCRT4_ValidateCommonHeader(const RpcPktCommonHdr *hdr) DECLSPEC_HIDDEN; + +BOOL RPCRT4_IsValidHttpPacket(RpcPktHdr *hdr, unsigned char *data, unsigned short data_len) DECLSPEC_HIDDEN; +RPC_STATUS RPCRT4_ParseHttpPrepareHeader1(RpcPktHdr *header, unsigned char *data, ULONG *field1) DECLSPEC_HIDDEN; +RPC_STATUS RPCRT4_ParseHttpPrepareHeader2(RpcPktHdr *header, unsigned char *data, ULONG *field1, ULONG *bytes_until_next_packet, ULONG *field3) DECLSPEC_HIDDEN; +RPC_STATUS RPCRT4_ParseHttpFlowControlHeader(RpcPktHdr *header, unsigned char *data, BOOL server, ULONG *bytes_transmitted, ULONG *flow_control_increment, UUID *pipe_uuid) DECLSPEC_HIDDEN; +NCA_STATUS RPC2NCA_STATUS(RPC_STATUS status) DECLSPEC_HIDDEN; +RPC_STATUS RPCRT4_ClientConnectionAuth(RpcConnection* conn, BYTE *challenge, ULONG count) DECLSPEC_HIDDEN; +RPC_STATUS RPCRT4_ServerConnectionAuth(RpcConnection* conn, BOOL start, RpcAuthVerifier *auth_data_in, ULONG auth_length_in, unsigned char **auth_data_out, ULONG *auth_length_out) DECLSPEC_HIDDEN; +RPC_STATUS RPCRT4_AuthorizeConnection(RpcConnection* conn, BYTE *challenge, ULONG count) DECLSPEC_HIDDEN; +RPC_STATUS RPCRT4_ServerGetRegisteredAuthInfo(USHORT auth_type, CredHandle *cred, TimeStamp *exp, ULONG *max_token) DECLSPEC_HIDDEN; +RPC_STATUS RPCRT4_default_authorize(RpcConnection *conn, BOOL first_time, unsigned char *in_buffer, unsigned int in_size, unsigned char *out_buffer, unsigned int *out_size) DECLSPEC_HIDDEN; +BOOL RPCRT4_default_is_authorized(RpcConnection *Connection) DECLSPEC_HIDDEN; +RPC_STATUS RPCRT4_default_secure_packet(RpcConnection *Connection, enum secure_packet_direction dir, RpcPktHdr *hdr, unsigned int hdr_size, unsigned char *stub_data, unsigned int stub_data_size, RpcAuthVerifier *auth_hdr, unsigned char *auth_value, unsigned int auth_value_size) DECLSPEC_HIDDEN; +RPC_STATUS RPCRT4_default_impersonate_client(RpcConnection *conn) DECLSPEC_HIDDEN; +RPC_STATUS RPCRT4_default_revert_to_self(RpcConnection *conn) DECLSPEC_HIDDEN; +RPC_STATUS RPCRT4_default_inquire_auth_client(RpcConnection *conn, RPC_AUTHZ_HANDLE *privs, RPC_WSTR *server_princ_name, ULONG *authn_level, ULONG *authn_svc, ULONG *authz_svc, ULONG flags) DECLSPEC_HIDDEN; #endif diff --git a/dll/win32/rpcrt4/rpc_server.c b/dll/win32/rpcrt4/rpc_server.c index 473c7ba9328..e18cb5c3a7f 100644 --- a/dll/win32/rpcrt4/rpc_server.c +++ b/dll/win32/rpcrt4/rpc_server.c @@ -52,6 +52,8 @@ typedef struct _RpcPacket struct _RpcConnection* conn; RpcPktHdr* hdr; RPC_MESSAGE* msg; + unsigned char *auth_data; + ULONG auth_length; } RpcPacket; typedef struct _RpcObjTypeMap @@ -67,6 +69,7 @@ static RpcObjTypeMap *RpcObjTypeMaps; /* list of type RpcServerProtseq */ static struct list protseqs = LIST_INIT(protseqs); static struct list server_interfaces = LIST_INIT(server_interfaces); +static struct list server_registered_auth_info = LIST_INIT(server_registered_auth_info); static CRITICAL_SECTION server_cs; static CRITICAL_SECTION_DEBUG server_cs_debug = @@ -86,12 +89,23 @@ static CRITICAL_SECTION_DEBUG listen_cs_debug = }; static CRITICAL_SECTION listen_cs = { &listen_cs_debug, -1, 0, 0, 0, 0 }; +static CRITICAL_SECTION server_auth_info_cs; +static CRITICAL_SECTION_DEBUG server_auth_info_cs_debug = +{ + 0, 0, &server_auth_info_cs, + { &server_auth_info_cs_debug.ProcessLocksList, &server_auth_info_cs_debug.ProcessLocksList }, + 0, 0, { (DWORD_PTR)(__FILE__ ": server_auth_info_cs") } +}; +static CRITICAL_SECTION server_auth_info_cs = { &server_auth_info_cs_debug, -1, 0, 0, 0, 0 }; + /* whether the server is currently listening */ static BOOL std_listen; /* number of manual listeners (calls to RpcServerListen) */ static LONG manual_listen_count; /* total listeners including auto listeners */ static LONG listen_count; +/* event set once all listening is finished */ +static HANDLE listen_done_event; static UUID uuid_nil; @@ -118,7 +132,8 @@ static inline UUID *LookupObjType(UUID *ObjUuid) } static RpcServerInterface* RPCRT4_find_interface(UUID* object, - const RPC_SYNTAX_IDENTIFIER* if_id, + const RPC_SYNTAX_IDENTIFIER *if_id, + const RPC_SYNTAX_IDENTIFIER *transfer_syntax, BOOL check_object) { UUID* MgrType = NULL; @@ -130,6 +145,7 @@ static RpcServerInterface* RPCRT4_find_interface(UUID* object, EnterCriticalSection(&server_cs); LIST_FOR_EACH_ENTRY(cif, &server_interfaces, RpcServerInterface, entry) { if (!memcmp(if_id, &cif->If->InterfaceId, sizeof(RPC_SYNTAX_IDENTIFIER)) && + (!transfer_syntax || !memcmp(transfer_syntax, &cif->If->TransferSyntax, sizeof(RPC_SYNTAX_IDENTIFIER))) && (check_object == FALSE || UuidEqual(MgrType, &cif->MgrTypeUuid, &status)) && std_listen) { InterlockedIncrement(&cif->CurrentCalls); @@ -156,64 +172,197 @@ static void RPCRT4_release_server_interface(RpcServerInterface *sif) } } -static RPC_STATUS process_bind_packet(RpcConnection *conn, RpcPktBindHdr *hdr, RPC_MESSAGE *msg) +static RpcPktHdr *handle_bind_error(RpcConnection *conn, RPC_STATUS error) +{ + unsigned int reject_reason; + switch (error) + { + case RPC_S_SERVER_TOO_BUSY: + reject_reason = REJECT_TEMPORARY_CONGESTION; + break; + case ERROR_OUTOFMEMORY: + case RPC_S_OUT_OF_RESOURCES: + reject_reason = REJECT_LOCAL_LIMIT_EXCEEDED; + break; + case RPC_S_PROTOCOL_ERROR: + reject_reason = REJECT_PROTOCOL_VERSION_NOT_SUPPORTED; + break; + case RPC_S_UNKNOWN_AUTHN_SERVICE: + reject_reason = REJECT_UNKNOWN_AUTHN_SERVICE; + break; + case ERROR_ACCESS_DENIED: + reject_reason = REJECT_INVALID_CHECKSUM; + break; + default: + FIXME("unexpected status value %d\n", error); + /* fall through */ + case RPC_S_INVALID_BOUND: + reject_reason = REJECT_REASON_NOT_SPECIFIED; + break; + } + return RPCRT4_BuildBindNackHeader(NDR_LOCAL_DATA_REPRESENTATION, + RPC_VER_MAJOR, RPC_VER_MINOR, + reject_reason); +} + +static RPC_STATUS process_bind_packet_no_send( + RpcConnection *conn, RpcPktBindHdr *hdr, RPC_MESSAGE *msg, + unsigned char *auth_data, ULONG auth_length, RpcPktHdr **ack_response, + unsigned char **auth_data_out, ULONG *auth_length_out) { RPC_STATUS status; - RpcServerInterface* sif; - RpcPktHdr *response = NULL; + RpcContextElement *ctxt_elem; + unsigned int i; + RpcResult *results; + + /* validate data */ + for (i = 0, ctxt_elem = msg->Buffer; + i < hdr->num_elements; + i++, ctxt_elem = (RpcContextElement *)&ctxt_elem->transfer_syntaxes[ctxt_elem->num_syntaxes]) + { + if (((char *)ctxt_elem - (char *)msg->Buffer) > msg->BufferLength || + ((char *)&ctxt_elem->transfer_syntaxes[ctxt_elem->num_syntaxes] - (char *)msg->Buffer) > msg->BufferLength) + { + ERR("inconsistent data in packet - packet length %d, num elements %d\n", + msg->BufferLength, hdr->num_elements); + return RPC_S_INVALID_BOUND; + } + } - /* FIXME: do more checks! */ if (hdr->max_tsize < RPC_MIN_PACKET_SIZE || !UuidIsNil(&conn->ActiveInterface.SyntaxGUID, &status) || - conn->server_binding) { + conn->server_binding) + { TRACE("packet size less than min size, or active interface syntax guid non-null\n"); - sif = NULL; - } else { - /* create temporary binding */ - if (RPCRT4_MakeBinding(&conn->server_binding, conn) == RPC_S_OK && - RpcServerAssoc_GetAssociation(rpcrt4_conn_get_name(conn), - conn->NetworkAddr, conn->Endpoint, - conn->NetworkOptions, - hdr->assoc_gid, - &conn->server_binding->Assoc) == RPC_S_OK) - sif = RPCRT4_find_interface(NULL, &hdr->abstract, FALSE); - else - sif = NULL; - } - if (sif == NULL) { - TRACE("rejecting bind request on connection %p\n", conn); - /* Report failure to client. */ - response = RPCRT4_BuildBindNackHeader(NDR_LOCAL_DATA_REPRESENTATION, - RPC_VER_MAJOR, RPC_VER_MINOR); - } else { - TRACE("accepting bind request on connection %p for %s\n", conn, - debugstr_guid(&hdr->abstract.SyntaxGUID)); - /* accept. */ - response = RPCRT4_BuildBindAckHeader(NDR_LOCAL_DATA_REPRESENTATION, - RPC_MAX_PACKET_SIZE, - RPC_MAX_PACKET_SIZE, - conn->server_binding->Assoc->assoc_group_id, - conn->Endpoint, - RESULT_ACCEPT, REASON_NONE, - &sif->If->TransferSyntax); - - /* save the interface for later use */ - conn->ActiveInterface = hdr->abstract; - conn->MaxTransmissionSize = hdr->max_tsize; - - RPCRT4_release_server_interface(sif); + return RPC_S_INVALID_BOUND; } - if (response) - status = RPCRT4_Send(conn, response, NULL, 0); + results = HeapAlloc(GetProcessHeap(), 0, + hdr->num_elements * sizeof(*results)); + if (!results) + return RPC_S_OUT_OF_RESOURCES; + + for (i = 0, ctxt_elem = (RpcContextElement *)msg->Buffer; + i < hdr->num_elements; + i++, ctxt_elem = (RpcContextElement *)&ctxt_elem->transfer_syntaxes[ctxt_elem->num_syntaxes]) + { + RpcServerInterface* sif = NULL; + unsigned int j; + + for (j = 0; !sif && j < ctxt_elem->num_syntaxes; j++) + { + sif = RPCRT4_find_interface(NULL, &ctxt_elem->abstract_syntax, + &ctxt_elem->transfer_syntaxes[j], FALSE); + if (sif) + break; + } + if (sif) + { + RPCRT4_release_server_interface(sif); + TRACE("accepting bind request on connection %p for %s\n", conn, + debugstr_guid(&ctxt_elem->abstract_syntax.SyntaxGUID)); + results[i].result = RESULT_ACCEPT; + results[i].reason = REASON_NONE; + results[i].transfer_syntax = ctxt_elem->transfer_syntaxes[j]; + + /* save the interface for later use */ + /* FIXME: save linked list */ + conn->ActiveInterface = ctxt_elem->abstract_syntax; + } + else if ((sif = RPCRT4_find_interface(NULL, &ctxt_elem->abstract_syntax, + NULL, FALSE)) != NULL) + { + RPCRT4_release_server_interface(sif); + TRACE("not accepting bind request on connection %p for %s - no transfer syntaxes supported\n", + conn, debugstr_guid(&ctxt_elem->abstract_syntax.SyntaxGUID)); + results[i].result = RESULT_PROVIDER_REJECTION; + results[i].reason = REASON_TRANSFER_SYNTAXES_NOT_SUPPORTED; + memset(&results[i].transfer_syntax, 0, sizeof(results[i].transfer_syntax)); + } + else + { + TRACE("not accepting bind request on connection %p for %s - abstract syntax not supported\n", + conn, debugstr_guid(&ctxt_elem->abstract_syntax.SyntaxGUID)); + results[i].result = RESULT_PROVIDER_REJECTION; + results[i].reason = REASON_ABSTRACT_SYNTAX_NOT_SUPPORTED; + memset(&results[i].transfer_syntax, 0, sizeof(results[i].transfer_syntax)); + } + } + + /* create temporary binding */ + status = RPCRT4_MakeBinding(&conn->server_binding, conn); + if (status != RPC_S_OK) + { + HeapFree(GetProcessHeap(), 0, results); + return status; + } + + status = RpcServerAssoc_GetAssociation(rpcrt4_conn_get_name(conn), + conn->NetworkAddr, conn->Endpoint, + conn->NetworkOptions, + hdr->assoc_gid, + &conn->server_binding->Assoc); + if (status != RPC_S_OK) + { + HeapFree(GetProcessHeap(), 0, results); + return status; + } + + if (auth_length) + { + status = RPCRT4_ServerConnectionAuth(conn, TRUE, + (RpcAuthVerifier *)auth_data, + auth_length, auth_data_out, + auth_length_out); + if (status != RPC_S_OK) + { + HeapFree(GetProcessHeap(), 0, results); + return status; + } + } + + *ack_response = RPCRT4_BuildBindAckHeader(NDR_LOCAL_DATA_REPRESENTATION, + RPC_MAX_PACKET_SIZE, + RPC_MAX_PACKET_SIZE, + conn->server_binding->Assoc->assoc_group_id, + conn->Endpoint, hdr->num_elements, + results); + HeapFree(GetProcessHeap(), 0, results); + + if (*ack_response) + conn->MaxTransmissionSize = hdr->max_tsize; else - status = ERROR_OUTOFMEMORY; - RPCRT4_FreeHeader(response); + status = RPC_S_OUT_OF_RESOURCES; return status; } +static RPC_STATUS process_bind_packet(RpcConnection *conn, RpcPktBindHdr *hdr, + RPC_MESSAGE *msg, + unsigned char *auth_data, + ULONG auth_length) +{ + RPC_STATUS status; + RpcPktHdr *response = NULL; + unsigned char *auth_data_out = NULL; + ULONG auth_length_out = 0; + + status = process_bind_packet_no_send(conn, hdr, msg, auth_data, auth_length, + &response, &auth_data_out, + &auth_length_out); + if (status != RPC_S_OK) + response = handle_bind_error(conn, status); + if (response) + status = RPCRT4_SendWithAuth(conn, response, NULL, 0, auth_data_out, auth_length_out); + else + status = ERROR_OUTOFMEMORY; + RPCRT4_FreeHeader(response); + + return status; +} + + static RPC_STATUS process_request_packet(RpcConnection *conn, RpcPktRequestHdr *hdr, RPC_MESSAGE *msg) { RPC_STATUS status; @@ -242,7 +391,7 @@ static RPC_STATUS process_request_packet(RpcConnection *conn, RpcPktRequestHdr * object_uuid = NULL; } - sif = RPCRT4_find_interface(object_uuid, &conn->ActiveInterface, TRUE); + sif = RPCRT4_find_interface(object_uuid, &conn->ActiveInterface, NULL, TRUE); if (!sif) { WARN("interface %s no longer registered, returning fault packet\n", debugstr_guid(&conn->ActiveInterface.SyntaxGUID)); response = RPCRT4_BuildFaultHeader(NDR_LOCAL_DATA_REPRESENTATION, @@ -327,25 +476,52 @@ static RPC_STATUS process_request_packet(RpcConnection *conn, RpcPktRequestHdr * return status; } -static void RPCRT4_process_packet(RpcConnection* conn, RpcPktHdr* hdr, RPC_MESSAGE* msg) +static RPC_STATUS process_auth3_packet(RpcConnection *conn, + RpcPktCommonHdr *hdr, + RPC_MESSAGE *msg, + unsigned char *auth_data, + ULONG auth_length) { - RPC_STATUS status; + RPC_STATUS status; + if (UuidIsNil(&conn->ActiveInterface.SyntaxGUID, &status) || + !auth_length || msg->BufferLength != 0) + status = RPC_S_PROTOCOL_ERROR; + else + { + status = RPCRT4_ServerConnectionAuth(conn, FALSE, + (RpcAuthVerifier *)auth_data, + auth_length, NULL, NULL); + } + + /* FIXME: client doesn't expect a response to this message so must store + * status in connection so that fault packet can be returned when next + * packet is received */ + + return RPC_S_OK; +} + +static void RPCRT4_process_packet(RpcConnection* conn, RpcPktHdr* hdr, + RPC_MESSAGE* msg, unsigned char *auth_data, + ULONG auth_length) +{ msg->Handle = (RPC_BINDING_HANDLE)conn->server_binding; switch (hdr->common.ptype) { case PKT_BIND: TRACE("got bind packet\n"); - - status = process_bind_packet(conn, &hdr->bind, msg); + process_bind_packet(conn, &hdr->bind, msg, auth_data, auth_length); break; case PKT_REQUEST: TRACE("got request packet\n"); - - status = process_request_packet(conn, &hdr->request, msg); + process_request_packet(conn, &hdr->request, msg); break; + case PKT_AUTH3: + TRACE("got auth3 packet\n"); + process_auth3_packet(conn, &hdr->common, msg, auth_data, auth_length); + break; default: FIXME("unhandled packet type %u\n", hdr->common.ptype); break; @@ -355,57 +531,96 @@ static void RPCRT4_process_packet(RpcConnection* conn, RpcPktHdr* hdr, RPC_MESSA I_RpcFree(msg->Buffer); RPCRT4_FreeHeader(hdr); HeapFree(GetProcessHeap(), 0, msg); + HeapFree(GetProcessHeap(), 0, auth_data); } static DWORD CALLBACK RPCRT4_worker_thread(LPVOID the_arg) { RpcPacket *pkt = the_arg; - RPCRT4_process_packet(pkt->conn, pkt->hdr, pkt->msg); + RPCRT4_process_packet(pkt->conn, pkt->hdr, pkt->msg, pkt->auth_data, + pkt->auth_length); HeapFree(GetProcessHeap(), 0, pkt); return 0; } static DWORD CALLBACK RPCRT4_io_thread(LPVOID the_arg) { - RpcConnection* conn = (RpcConnection*)the_arg; + RpcConnection* conn = the_arg; RpcPktHdr *hdr; RPC_MESSAGE *msg; RPC_STATUS status; RpcPacket *packet; + unsigned char *auth_data; + ULONG auth_length; TRACE("(%p)\n", conn); for (;;) { msg = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(RPC_MESSAGE)); + if (!msg) break; - status = RPCRT4_Receive(conn, &hdr, msg); + status = RPCRT4_ReceiveWithAuth(conn, &hdr, msg, &auth_data, &auth_length); if (status != RPC_S_OK) { WARN("receive failed with error %x\n", status); HeapFree(GetProcessHeap(), 0, msg); break; } - packet = HeapAlloc(GetProcessHeap(), 0, sizeof(RpcPacket)); - if (!packet) { - I_RpcFree(msg->Buffer); - RPCRT4_FreeHeader(hdr); - HeapFree(GetProcessHeap(), 0, msg); + switch (hdr->common.ptype) { + case PKT_BIND: + TRACE("got bind packet\n"); + + status = process_bind_packet(conn, &hdr->bind, msg, auth_data, + auth_length); break; - } - packet->conn = conn; - packet->hdr = hdr; - packet->msg = msg; - if (!QueueUserWorkItem(RPCRT4_worker_thread, packet, WT_EXECUTELONGFUNCTION)) { - ERR("couldn't queue work item for worker thread, error was %d\n", GetLastError()); - I_RpcFree(msg->Buffer); - RPCRT4_FreeHeader(hdr); - HeapFree(GetProcessHeap(), 0, msg); - HeapFree(GetProcessHeap(), 0, packet); + + case PKT_REQUEST: + TRACE("got request packet\n"); + + packet = HeapAlloc(GetProcessHeap(), 0, sizeof(RpcPacket)); + if (!packet) { + I_RpcFree(msg->Buffer); + RPCRT4_FreeHeader(hdr); + HeapFree(GetProcessHeap(), 0, msg); + HeapFree(GetProcessHeap(), 0, auth_data); + goto exit; + } + packet->conn = conn; + packet->hdr = hdr; + packet->msg = msg; + packet->auth_data = auth_data; + packet->auth_length = auth_length; + if (!QueueUserWorkItem(RPCRT4_worker_thread, packet, WT_EXECUTELONGFUNCTION)) { + ERR("couldn't queue work item for worker thread, error was %d\n", GetLastError()); + HeapFree(GetProcessHeap(), 0, packet); + status = RPC_S_OUT_OF_RESOURCES; + } else { + continue; + } + break; + + case PKT_AUTH3: + TRACE("got auth3 packet\n"); + + status = process_auth3_packet(conn, &hdr->common, msg, auth_data, + auth_length); + break; + default: + FIXME("unhandled packet type %u\n", hdr->common.ptype); break; } - msg = NULL; + I_RpcFree(msg->Buffer); + RPCRT4_FreeHeader(hdr); + HeapFree(GetProcessHeap(), 0, msg); + HeapFree(GetProcessHeap(), 0, auth_data); + + if (status != RPC_S_OK) { + WARN("processing packet failed with error %u\n", status); + break; + } } +exit: RPCRT4_DestroyConnection(conn); return 0; } @@ -449,27 +664,23 @@ static DWORD CALLBACK RPCRT4_server_thread(LPVOID the_arg) /* start waiting */ res = cps->ops->wait_for_new_connection(cps, count, objs); - if (res == -1) - break; - else if (res == 0) + + if (res == -1 || (res == 0 && !std_listen)) { - if (!std_listen) - { + /* cleanup */ + cps->ops->free_wait_array(cps, objs); + EnterCriticalSection(&cps->cs); + for (conn = cps->conn; conn; conn = conn->Next) + RPCRT4_CloseConnection(conn); + LeaveCriticalSection(&cps->cs); + + if (res == 0 && !std_listen) SetEvent(cps->server_ready_event); - break; - } - set_ready_event = TRUE; + break; } + else if (res == 0) + set_ready_event = TRUE; } - cps->ops->free_wait_array(cps, objs); - EnterCriticalSection(&cps->cs); - /* close connections */ - conn = cps->conn; - while (conn) { - RPCRT4_CloseConnection(conn); - conn = conn->Next; - } - LeaveCriticalSection(&cps->cs); return 0; } @@ -563,6 +774,10 @@ static void RPCRT4_stop_listen(BOOL auto_listen) LIST_FOR_EACH_ENTRY(cps, &protseqs, RpcServerProtseq, entry) RPCRT4_sync_with_server_thread(cps); + EnterCriticalSection(&listen_cs); + if (listen_done_event) SetEvent( listen_done_event ); + listen_done_event = 0; + LeaveCriticalSection(&listen_cs); return; } assert(listen_count >= 0); @@ -570,11 +785,32 @@ static void RPCRT4_stop_listen(BOOL auto_listen) LeaveCriticalSection(&listen_cs); } -static RPC_STATUS RPCRT4_use_protseq(RpcServerProtseq* ps, LPSTR endpoint) +static BOOL RPCRT4_protseq_is_endpoint_registered(RpcServerProtseq *protseq, const char *endpoint) +{ + RpcConnection *conn; + EnterCriticalSection(&protseq->cs); + for (conn = protseq->conn; conn; conn = conn->Next) + { + if (!endpoint || !strcmp(endpoint, conn->Endpoint)) + break; + } + LeaveCriticalSection(&protseq->cs); + return (conn != NULL); +} + +static RPC_STATUS RPCRT4_use_protseq(RpcServerProtseq* ps, const char *endpoint) { RPC_STATUS status; - status = ps->ops->open_endpoint(ps, endpoint); + EnterCriticalSection(&ps->cs); + + if (RPCRT4_protseq_is_endpoint_registered(ps, endpoint)) + status = RPC_S_OK; + else + status = ps->ops->open_endpoint(ps, endpoint); + + LeaveCriticalSection(&ps->cs); + if (status != RPC_S_OK) return status; @@ -608,11 +844,8 @@ RPC_STATUS WINAPI RpcServerInqBindings( RPC_BINDING_VECTOR** BindingVector ) count = 0; LIST_FOR_EACH_ENTRY(ps, &protseqs, RpcServerProtseq, entry) { EnterCriticalSection(&ps->cs); - conn = ps->conn; - while (conn) { + for (conn = ps->conn; conn; conn = conn->Next) count++; - conn = conn->Next; - } LeaveCriticalSection(&ps->cs); } if (count) { @@ -624,12 +857,10 @@ RPC_STATUS WINAPI RpcServerInqBindings( RPC_BINDING_VECTOR** BindingVector ) count = 0; LIST_FOR_EACH_ENTRY(ps, &protseqs, RpcServerProtseq, entry) { EnterCriticalSection(&ps->cs); - conn = ps->conn; - while (conn) { + for (conn = ps->conn; conn; conn = conn->Next) { RPCRT4_MakeBinding((RpcBinding**)&(*BindingVector)->BindingH[count], conn); count++; - conn = conn->Next; } LeaveCriticalSection(&ps->cs); } @@ -681,7 +912,7 @@ RPC_STATUS WINAPI RpcServerUseProtseqEpW( RPC_WSTR Protseq, UINT MaxCalls, RPC_W * * Must be called with server_cs held. */ -static RPC_STATUS alloc_serverprotoseq(UINT MaxCalls, char *Protseq, RpcServerProtseq **ps) +static RPC_STATUS alloc_serverprotoseq(UINT MaxCalls, const char *Protseq, RpcServerProtseq **ps) { const struct protseq_ops *ops = rpcrt4_get_protseq_ops(Protseq); @@ -695,7 +926,7 @@ static RPC_STATUS alloc_serverprotoseq(UINT MaxCalls, char *Protseq, RpcServerPr if (!*ps) return RPC_S_OUT_OF_RESOURCES; (*ps)->MaxCalls = MaxCalls; - (*ps)->Protseq = Protseq; + (*ps)->Protseq = RPCRT4_strdupA(Protseq); (*ps)->ops = ops; (*ps)->MaxCalls = 0; (*ps)->conn = NULL; @@ -711,8 +942,19 @@ static RPC_STATUS alloc_serverprotoseq(UINT MaxCalls, char *Protseq, RpcServerPr return RPC_S_OK; } +/* must be called with server_cs held */ +static void destroy_serverprotoseq(RpcServerProtseq *ps) +{ + RPCRT4_strfree(ps->Protseq); + DeleteCriticalSection(&ps->cs); + CloseHandle(ps->mgr_mutex); + CloseHandle(ps->server_ready_event); + list_remove(&ps->entry); + HeapFree(GetProcessHeap(), 0, ps); +} + /* Finds a given protseq or creates a new one if one doesn't already exist */ -static RPC_STATUS RPCRT4_get_or_create_serverprotseq(UINT MaxCalls, char *Protseq, RpcServerProtseq **ps) +static RPC_STATUS RPCRT4_get_or_create_serverprotseq(UINT MaxCalls, const char *Protseq, RpcServerProtseq **ps) { RPC_STATUS status; RpcServerProtseq *cps; @@ -741,19 +983,18 @@ static RPC_STATUS RPCRT4_get_or_create_serverprotseq(UINT MaxCalls, char *Protse RPC_STATUS WINAPI RpcServerUseProtseqEpExA( RPC_CSTR Protseq, UINT MaxCalls, RPC_CSTR Endpoint, LPVOID SecurityDescriptor, PRPC_POLICY lpPolicy ) { - char *szps = (char*)Protseq, *szep = (char*)Endpoint; RpcServerProtseq* ps; RPC_STATUS status; - TRACE("(%s,%u,%s,%p,{%u,%u,%u})\n", debugstr_a(szps), MaxCalls, - debugstr_a(szep), SecurityDescriptor, + TRACE("(%s,%u,%s,%p,{%u,%u,%u})\n", debugstr_a((const char *)Protseq), + MaxCalls, debugstr_a((const char *)Endpoint), SecurityDescriptor, lpPolicy->Length, lpPolicy->EndpointFlags, lpPolicy->NICFlags ); - status = RPCRT4_get_or_create_serverprotseq(MaxCalls, RPCRT4_strdupA(szps), &ps); + status = RPCRT4_get_or_create_serverprotseq(MaxCalls, (const char *)Protseq, &ps); if (status != RPC_S_OK) return status; - return RPCRT4_use_protseq(ps, szep); + return RPCRT4_use_protseq(ps, (const char *)Endpoint); } /*********************************************************************** @@ -764,13 +1005,16 @@ RPC_STATUS WINAPI RpcServerUseProtseqEpExW( RPC_WSTR Protseq, UINT MaxCalls, RPC { RpcServerProtseq* ps; RPC_STATUS status; + LPSTR ProtseqA; LPSTR EndpointA; TRACE("(%s,%u,%s,%p,{%u,%u,%u})\n", debugstr_w( Protseq ), MaxCalls, debugstr_w( Endpoint ), SecurityDescriptor, lpPolicy->Length, lpPolicy->EndpointFlags, lpPolicy->NICFlags ); - status = RPCRT4_get_or_create_serverprotseq(MaxCalls, RPCRT4_strdupWtoA(Protseq), &ps); + ProtseqA = RPCRT4_strdupWtoA(Protseq); + status = RPCRT4_get_or_create_serverprotseq(MaxCalls, ProtseqA, &ps); + RPCRT4_strfree(ProtseqA); if (status != RPC_S_OK) return status; @@ -785,8 +1029,16 @@ RPC_STATUS WINAPI RpcServerUseProtseqEpExW( RPC_WSTR Protseq, UINT MaxCalls, RPC */ RPC_STATUS WINAPI RpcServerUseProtseqA(RPC_CSTR Protseq, unsigned int MaxCalls, void *SecurityDescriptor) { + RPC_STATUS status; + RpcServerProtseq* ps; + TRACE("(Protseq == %s, MaxCalls == %d, SecurityDescriptor == ^%p)\n", debugstr_a((char*)Protseq), MaxCalls, SecurityDescriptor); - return RpcServerUseProtseqEpA(Protseq, MaxCalls, NULL, SecurityDescriptor); + + status = RPCRT4_get_or_create_serverprotseq(MaxCalls, (const char *)Protseq, &ps); + if (status != RPC_S_OK) + return status; + + return RPCRT4_use_protseq(ps, NULL); } /*********************************************************************** @@ -794,8 +1046,34 @@ RPC_STATUS WINAPI RpcServerUseProtseqA(RPC_CSTR Protseq, unsigned int MaxCalls, */ RPC_STATUS WINAPI RpcServerUseProtseqW(RPC_WSTR Protseq, unsigned int MaxCalls, void *SecurityDescriptor) { + RPC_STATUS status; + RpcServerProtseq* ps; + LPSTR ProtseqA; + TRACE("Protseq == %s, MaxCalls == %d, SecurityDescriptor == ^%p)\n", debugstr_w(Protseq), MaxCalls, SecurityDescriptor); - return RpcServerUseProtseqEpW(Protseq, MaxCalls, NULL, SecurityDescriptor); + + ProtseqA = RPCRT4_strdupWtoA(Protseq); + status = RPCRT4_get_or_create_serverprotseq(MaxCalls, ProtseqA, &ps); + RPCRT4_strfree(ProtseqA); + if (status != RPC_S_OK) + return status; + + return RPCRT4_use_protseq(ps, NULL); +} + +void RPCRT4_destroy_all_protseqs(void) +{ + RpcServerProtseq *cps, *cursor2; + + if (listen_count != 0) + std_listen = FALSE; + + EnterCriticalSection(&server_cs); + LIST_FOR_EACH_ENTRY_SAFE(cps, cursor2, &protseqs, RpcServerProtseq, entry) + { + destroy_serverprotoseq(cps); + } + LeaveCriticalSection(&server_cs); } /*********************************************************************** @@ -823,7 +1101,7 @@ RPC_STATUS WINAPI RpcServerRegisterIfEx( RPC_IF_HANDLE IfSpec, UUID* MgrTypeUuid RPC_STATUS WINAPI RpcServerRegisterIf2( RPC_IF_HANDLE IfSpec, UUID* MgrTypeUuid, RPC_MGR_EPV* MgrEpv, UINT Flags, UINT MaxCalls, UINT MaxRpcSize, RPC_IF_CALLBACK_FN* IfCallbackFn ) { - PRPC_SERVER_INTERFACE If = (PRPC_SERVER_INTERFACE)IfSpec; + PRPC_SERVER_INTERFACE If = IfSpec; RpcServerInterface* sif; unsigned int i; @@ -876,7 +1154,7 @@ RPC_STATUS WINAPI RpcServerRegisterIf2( RPC_IF_HANDLE IfSpec, UUID* MgrTypeUuid, */ RPC_STATUS WINAPI RpcServerUnregisterIf( RPC_IF_HANDLE IfSpec, UUID* MgrTypeUuid, UINT WaitForCallsToComplete ) { - PRPC_SERVER_INTERFACE If = (PRPC_SERVER_INTERFACE)IfSpec; + PRPC_SERVER_INTERFACE If = IfSpec; HANDLE event = NULL; BOOL found = FALSE; BOOL completed = TRUE; @@ -944,7 +1222,7 @@ RPC_STATUS WINAPI RpcServerUnregisterIfEx( RPC_IF_HANDLE IfSpec, UUID* MgrTypeUu * RPC_S_INVALID_OBJECT The provided object (nil) is not valid * RPC_S_ALREADY_REGISTERED The provided object is already registered * - * Maps "Object" UUIDs to "Type" UUID's. Passing the nil UUID as the type + * Maps "Object" UUIDs to "Type" UUIDs. Passing the nil UUID as the type * resets the mapping for the specified object UUID to nil (the default). * The nil object is always associated with the nil type and cannot be * reassigned. Servers can support multiple implementations on the same @@ -996,15 +1274,114 @@ RPC_STATUS WINAPI RpcObjectSetType( UUID* ObjUuid, UUID* TypeUuid ) return RPC_S_OK; } +struct rpc_server_registered_auth_info +{ + struct list entry; + TimeStamp exp; + CredHandle cred; + ULONG max_token; + USHORT auth_type; +}; + +RPC_STATUS RPCRT4_ServerGetRegisteredAuthInfo( + USHORT auth_type, CredHandle *cred, TimeStamp *exp, ULONG *max_token) +{ + RPC_STATUS status = RPC_S_UNKNOWN_AUTHN_SERVICE; + struct rpc_server_registered_auth_info *auth_info; + + EnterCriticalSection(&server_auth_info_cs); + LIST_FOR_EACH_ENTRY(auth_info, &server_registered_auth_info, struct rpc_server_registered_auth_info, entry) + { + if (auth_info->auth_type == auth_type) + { + *cred = auth_info->cred; + *exp = auth_info->exp; + *max_token = auth_info->max_token; + status = RPC_S_OK; + break; + } + } + LeaveCriticalSection(&server_auth_info_cs); + + return status; +} + +void RPCRT4_ServerFreeAllRegisteredAuthInfo(void) +{ + struct rpc_server_registered_auth_info *auth_info, *cursor2; + + EnterCriticalSection(&server_auth_info_cs); + LIST_FOR_EACH_ENTRY_SAFE(auth_info, cursor2, &server_registered_auth_info, struct rpc_server_registered_auth_info, entry) + { + FreeCredentialsHandle(&auth_info->cred); + HeapFree(GetProcessHeap(), 0, auth_info); + } + LeaveCriticalSection(&server_auth_info_cs); +} + /*********************************************************************** * RpcServerRegisterAuthInfoA (RPCRT4.@) */ RPC_STATUS WINAPI RpcServerRegisterAuthInfoA( RPC_CSTR ServerPrincName, ULONG AuthnSvc, RPC_AUTH_KEY_RETRIEVAL_FN GetKeyFn, LPVOID Arg ) { - FIXME( "(%s,%u,%p,%p): stub\n", ServerPrincName, AuthnSvc, GetKeyFn, Arg ); - - return RPC_S_UNKNOWN_AUTHN_SERVICE; /* We don't know any authentication services */ + SECURITY_STATUS sec_status; + CredHandle cred; + TimeStamp exp; + ULONG package_count; + ULONG i; + PSecPkgInfoA packages; + ULONG max_token; + struct rpc_server_registered_auth_info *auth_info; + + TRACE("(%s,%u,%p,%p)\n", ServerPrincName, AuthnSvc, GetKeyFn, Arg); + + sec_status = EnumerateSecurityPackagesA(&package_count, &packages); + if (sec_status != SEC_E_OK) + { + ERR("EnumerateSecurityPackagesA failed with error 0x%08x\n", + sec_status); + return RPC_S_SEC_PKG_ERROR; + } + + for (i = 0; i < package_count; i++) + if (packages[i].wRPCID == AuthnSvc) + break; + + if (i == package_count) + { + WARN("unsupported AuthnSvc %u\n", AuthnSvc); + FreeContextBuffer(packages); + return RPC_S_UNKNOWN_AUTHN_SERVICE; + } + TRACE("found package %s for service %u\n", packages[i].Name, + AuthnSvc); + sec_status = AcquireCredentialsHandleA((SEC_CHAR *)ServerPrincName, + packages[i].Name, + SECPKG_CRED_INBOUND, NULL, NULL, + NULL, NULL, &cred, &exp); + max_token = packages[i].cbMaxToken; + FreeContextBuffer(packages); + if (sec_status != SEC_E_OK) + return RPC_S_SEC_PKG_ERROR; + + auth_info = HeapAlloc(GetProcessHeap(), 0, sizeof(*auth_info)); + if (!auth_info) + { + FreeCredentialsHandle(&cred); + return RPC_S_OUT_OF_RESOURCES; + } + + auth_info->exp = exp; + auth_info->cred = cred; + auth_info->max_token = max_token; + auth_info->auth_type = AuthnSvc; + + EnterCriticalSection(&server_auth_info_cs); + list_add_tail(&server_registered_auth_info, &auth_info->entry); + LeaveCriticalSection(&server_auth_info_cs); + + return RPC_S_OK; } /*********************************************************************** @@ -1013,9 +1390,63 @@ RPC_STATUS WINAPI RpcServerRegisterAuthInfoA( RPC_CSTR ServerPrincName, ULONG Au RPC_STATUS WINAPI RpcServerRegisterAuthInfoW( RPC_WSTR ServerPrincName, ULONG AuthnSvc, RPC_AUTH_KEY_RETRIEVAL_FN GetKeyFn, LPVOID Arg ) { - FIXME( "(%s,%u,%p,%p): stub\n", debugstr_w( ServerPrincName ), AuthnSvc, GetKeyFn, Arg ); - - return RPC_S_UNKNOWN_AUTHN_SERVICE; /* We don't know any authentication services */ + SECURITY_STATUS sec_status; + CredHandle cred; + TimeStamp exp; + ULONG package_count; + ULONG i; + PSecPkgInfoW packages; + ULONG max_token; + struct rpc_server_registered_auth_info *auth_info; + + TRACE("(%s,%u,%p,%p)\n", debugstr_w(ServerPrincName), AuthnSvc, GetKeyFn, Arg); + + sec_status = EnumerateSecurityPackagesW(&package_count, &packages); + if (sec_status != SEC_E_OK) + { + ERR("EnumerateSecurityPackagesW failed with error 0x%08x\n", + sec_status); + return RPC_S_SEC_PKG_ERROR; + } + + for (i = 0; i < package_count; i++) + if (packages[i].wRPCID == AuthnSvc) + break; + + if (i == package_count) + { + WARN("unsupported AuthnSvc %u\n", AuthnSvc); + FreeContextBuffer(packages); + return RPC_S_UNKNOWN_AUTHN_SERVICE; + } + TRACE("found package %s for service %u\n", debugstr_w(packages[i].Name), + AuthnSvc); + sec_status = AcquireCredentialsHandleW((SEC_WCHAR *)ServerPrincName, + packages[i].Name, + SECPKG_CRED_INBOUND, NULL, NULL, + NULL, NULL, &cred, &exp); + max_token = packages[i].cbMaxToken; + FreeContextBuffer(packages); + if (sec_status != SEC_E_OK) + return RPC_S_SEC_PKG_ERROR; + + auth_info = HeapAlloc(GetProcessHeap(), 0, sizeof(*auth_info)); + if (!auth_info) + { + FreeCredentialsHandle(&cred); + return RPC_S_OUT_OF_RESOURCES; + } + + auth_info->exp = exp; + auth_info->cred = cred; + auth_info->max_token = max_token; + auth_info->auth_type = AuthnSvc; + + EnterCriticalSection(&server_auth_info_cs); + list_add_tail(&server_registered_auth_info, &auth_info->entry); + LeaveCriticalSection(&server_auth_info_cs); + + return RPC_S_OK; } /*********************************************************************** @@ -1042,7 +1473,9 @@ RPC_STATUS WINAPI RpcServerListen( UINT MinimumCallThreads, UINT MaxCalls, UINT */ RPC_STATUS WINAPI RpcMgmtWaitServerListen( void ) { - RpcServerProtseq *cps; + HANDLE event; + + TRACE("()\n"); EnterCriticalSection(&listen_cs); @@ -1050,17 +1483,20 @@ RPC_STATUS WINAPI RpcMgmtWaitServerListen( void ) LeaveCriticalSection(&listen_cs); return RPC_S_NOT_LISTENING; } - - do { + if (listen_done_event) { LeaveCriticalSection(&listen_cs); - LIST_FOR_EACH_ENTRY(cps, &protseqs, RpcServerProtseq, entry) - WaitForSingleObject(cps->server_ready_event, INFINITE); - - EnterCriticalSection(&listen_cs); - } while (!std_listen); + return RPC_S_ALREADY_LISTENING; + } + event = CreateEventW( NULL, TRUE, FALSE, NULL ); + listen_done_event = event; LeaveCriticalSection(&listen_cs); + TRACE( "waiting for server calls to finish\n" ); + WaitForSingleObject( event, INFINITE ); + TRACE( "done waiting\n" ); + + CloseHandle( event ); return RPC_S_OK; } @@ -1183,6 +1619,15 @@ RPC_STATUS WINAPI RpcMgmtIsServerListening(RPC_BINDING_HANDLE Binding) return RPC_S_INVALID_BINDING; } +/*********************************************************************** + * RpcMgmtSetAuthorizationFn (RPCRT4.@) + */ +RPC_STATUS WINAPI RpcMgmtSetAuthorizationFn(RPC_MGMT_AUTHORIZATION_FN fn) +{ + FIXME("(%p): stub\n", fn); + return RPC_S_OK; +} + /*********************************************************************** * RpcMgmtSetServerStackSize (RPCRT4.@) */ diff --git a/dll/win32/rpcrt4/rpc_server.h b/dll/win32/rpcrt4/rpc_server.h index ffd5b016e4b..a7f95395465 100644 --- a/dll/win32/rpcrt4/rpc_server.h +++ b/dll/win32/rpcrt4/rpc_server.h @@ -56,7 +56,7 @@ struct protseq_ops * new connection was established */ int (*wait_for_new_connection)(RpcServerProtseq *protseq, unsigned int count, void *wait_array); /* opens the endpoint and optionally begins listening */ - RPC_STATUS (*open_endpoint)(RpcServerProtseq *protseq, LPSTR endpoint); + RPC_STATUS (*open_endpoint)(RpcServerProtseq *protseq, const char *endpoint); }; typedef struct _RpcServerInterface @@ -76,7 +76,10 @@ typedef struct _RpcServerInterface BOOL Delete; /* delete when the last call finishes */ } RpcServerInterface; -void RPCRT4_new_client(RpcConnection* conn); -const struct protseq_ops *rpcrt4_get_protseq_ops(const char *protseq); +void RPCRT4_new_client(RpcConnection* conn) DECLSPEC_HIDDEN; +const struct protseq_ops *rpcrt4_get_protseq_ops(const char *protseq) DECLSPEC_HIDDEN; + +void RPCRT4_destroy_all_protseqs(void) DECLSPEC_HIDDEN; +void RPCRT4_ServerFreeAllRegisteredAuthInfo(void) DECLSPEC_HIDDEN; #endif /* __WINE_RPC_SERVER_H */ diff --git a/dll/win32/rpcrt4/rpc_transport.c b/dll/win32/rpcrt4/rpc_transport.c index 92588bad087..dc2ae19cccf 100644 --- a/dll/win32/rpcrt4/rpc_transport.c +++ b/dll/win32/rpcrt4/rpc_transport.c @@ -40,6 +40,8 @@ # ifndef EAGAIN # define EAGAIN WSAEWOULDBLOCK # endif +# undef errno +# define errno WSAGetLastError() #else # include # ifdef HAVE_UNISTD_H @@ -97,6 +99,8 @@ # define SOL_TCP IPPROTO_TCP #endif +#define DEFAULT_NCACN_HTTP_TIMEOUT (60 * 1000) + WINE_DEFAULT_DEBUG_CHANNEL(rpc); static RPC_STATUS RPCRT4_SpawnConnection(RpcConnection** Connection, RpcConnection* OldConnection); @@ -107,7 +111,7 @@ typedef struct _RpcConnection_np { RpcConnection common; HANDLE pipe; - OVERLAPPED ovl[2]; + OVERLAPPED ovl; BOOL listening; } RpcConnection_np; @@ -131,13 +135,13 @@ static RPC_STATUS rpcrt4_conn_listen_pipe(RpcConnection_np *npc) npc->listening = TRUE; for (;;) { - if (ConnectNamedPipe(npc->pipe, &npc->ovl[0])) + if (ConnectNamedPipe(npc->pipe, &npc->ovl)) return RPC_S_OK; switch(GetLastError()) { case ERROR_PIPE_CONNECTED: - SetEvent(npc->ovl[0].hEvent); + SetEvent(npc->ovl.hEvent); return RPC_S_OK; case ERROR_IO_PENDING: /* will be completed in rpcrt4_protseq_np_wait_for_new_connection */ @@ -172,8 +176,7 @@ static RPC_STATUS rpcrt4_conn_create_pipe(RpcConnection *Connection, LPCSTR pnam } memset(&npc->ovl, 0, sizeof(npc->ovl)); - npc->ovl[0].hEvent = CreateEventW(NULL, TRUE, FALSE, NULL); - npc->ovl[1].hEvent = CreateEventW(NULL, TRUE, FALSE, NULL); + npc->ovl.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL); /* Note: we don't call ConnectNamedPipe here because it must be done in the * server thread as the thread must be alertable */ @@ -219,20 +222,13 @@ static RPC_STATUS rpcrt4_conn_open_pipe(RpcConnection *Connection, LPCSTR pname, if (pipe != INVALID_HANDLE_VALUE) break; err = GetLastError(); if (err == ERROR_PIPE_BUSY) { - ERR("connection to %s failed, error=%x\n", pname, err); + TRACE("connection failed, error=%x\n", err); return RPC_S_SERVER_TOO_BUSY; } - if (wait) ERR("Waiting for Pipe Instance\n"); - if (wait) { - if (!WaitNamedPipeA(pname, NMPWAIT_WAIT_FOREVER)) { - err = GetLastError(); - ERR("connection to %s failed, error=%x, wait %x\n", pname, err, wait); - return RPC_S_SERVER_UNAVAILABLE; - } - else - { - ERR("Pipe Instance Ready!!!!!!!!!!!!!!!!!!\n"); - } + if (!wait || !WaitNamedPipeA(pname, NMPWAIT_WAIT_FOREVER)) { + err = GetLastError(); + WARN("connection failed, error=%x\n", err); + return RPC_S_SERVER_UNAVAILABLE; } } @@ -241,8 +237,7 @@ static RPC_STATUS rpcrt4_conn_open_pipe(RpcConnection *Connection, LPCSTR pname, /* pipe is connected; change to message-read mode. */ dwMode = PIPE_READMODE_MESSAGE; SetNamedPipeHandleState(pipe, &dwMode, NULL, NULL); - npc->ovl[0].hEvent = CreateEventW(NULL, TRUE, FALSE, NULL); - npc->ovl[1].hEvent = CreateEventW(NULL, TRUE, FALSE, NULL); + npc->ovl.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL); npc->pipe = pipe; return RPC_S_OK; @@ -269,7 +264,7 @@ static RPC_STATUS rpcrt4_ncalrpc_open(RpcConnection* Connection) return r; } -static RPC_STATUS rpcrt4_protseq_ncalrpc_open_endpoint(RpcServerProtseq* protseq, LPSTR endpoint) +static RPC_STATUS rpcrt4_protseq_ncalrpc_open_endpoint(RpcServerProtseq* protseq, const char *endpoint) { static const char prefix[] = "\\\\.\\pipe\\lrpc\\"; RPC_STATUS r; @@ -327,7 +322,7 @@ static RPC_STATUS rpcrt4_ncacn_np_open(RpcConnection* Connection) return r; } -static RPC_STATUS rpcrt4_protseq_ncacn_np_open_endpoint(RpcServerProtseq *protseq, LPSTR endpoint) +static RPC_STATUS rpcrt4_protseq_ncacn_np_open_endpoint(RpcServerProtseq *protseq, const char *endpoint) { static const char prefix[] = "\\\\."; RPC_STATUS r; @@ -370,8 +365,7 @@ static void rpcrt4_conn_np_handoff(RpcConnection_np *old_npc, RpcConnection_np * * to the child, then reopen the server binding to continue listening */ new_npc->pipe = old_npc->pipe; - new_npc->ovl[0] = old_npc->ovl[0]; - new_npc->ovl[1] = old_npc->ovl[1]; + new_npc->ovl = old_npc->ovl; old_npc->pipe = 0; memset(&old_npc->ovl, 0, sizeof(old_npc->ovl)); old_npc->listening = FALSE; @@ -418,21 +412,24 @@ static int rpcrt4_conn_np_read(RpcConnection *Connection, char *buf = buffer; BOOL ret = TRUE; unsigned int bytes_left = count; + OVERLAPPED ovl; + + ZeroMemory(&ovl, sizeof(ovl)); + ovl.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL); while (bytes_left) { DWORD bytes_read; - ret = ReadFile(npc->pipe, buf, bytes_left, &bytes_read, &npc->ovl[0]); - if ((!ret || !bytes_read) && (GetLastError() != ERROR_IO_PENDING)) + ret = ReadFile(npc->pipe, buf, bytes_left, &bytes_read, &ovl); + if ((!ret || !bytes_read) && (GetLastError() != ERROR_IO_PENDING)) break; - - ret = GetOverlappedResult(npc->pipe, &npc->ovl[0], &bytes_read, TRUE); + ret = GetOverlappedResult(npc->pipe, &ovl, &bytes_read, TRUE); if (!ret && (GetLastError() != ERROR_MORE_DATA)) break; - bytes_left -= bytes_read; buf += bytes_read; } + CloseHandle(ovl.hEvent); return ret ? count : -1; } @@ -443,21 +440,25 @@ static int rpcrt4_conn_np_write(RpcConnection *Connection, const char *buf = buffer; BOOL ret = TRUE; unsigned int bytes_left = count; + OVERLAPPED ovl; + + ZeroMemory(&ovl, sizeof(ovl)); + ovl.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL); while (bytes_left) { DWORD bytes_written; - ret = WriteFile(npc->pipe, buf, bytes_left, &bytes_written, &npc->ovl[1]); + ret = WriteFile(npc->pipe, buf, bytes_left, &bytes_written, &ovl); if ((!ret || !bytes_written) && (GetLastError() != ERROR_IO_PENDING)) break; - ret = GetOverlappedResult(npc->pipe, &npc->ovl[1], &bytes_written, TRUE); + ret = GetOverlappedResult(npc->pipe, &ovl, &bytes_written, TRUE); if (!ret && (GetLastError() != ERROR_MORE_DATA)) break; - bytes_left -= bytes_written; buf += bytes_written; } + CloseHandle(ovl.hEvent); return ret ? count : -1; } @@ -469,13 +470,9 @@ static int rpcrt4_conn_np_close(RpcConnection *Connection) CloseHandle(npc->pipe); npc->pipe = 0; } - if (npc->ovl[0].hEvent) { - CloseHandle(npc->ovl[0].hEvent); - npc->ovl[0].hEvent = 0; - } - if (npc->ovl[1].hEvent) { - CloseHandle(npc->ovl[1].hEvent); - npc->ovl[1].hEvent = 0; + if (npc->ovl.hEvent) { + CloseHandle(npc->ovl.hEvent); + npc->ovl.hEvent = 0; } return 0; } @@ -604,6 +601,48 @@ static RPC_STATUS rpcrt4_ncacn_np_parse_top_of_tower(const unsigned char *tower_ return RPC_S_OK; } +static RPC_STATUS rpcrt4_conn_np_impersonate_client(RpcConnection *conn) +{ + RpcConnection_np *npc = (RpcConnection_np *)conn; + BOOL ret; + + TRACE("(%p)\n", conn); + + if (conn->AuthInfo && SecIsValidHandle(&conn->ctx)) + return RPCRT4_default_impersonate_client(conn); + + ret = ImpersonateNamedPipeClient(npc->pipe); + if (!ret) + { + DWORD error = GetLastError(); + WARN("ImpersonateNamedPipeClient failed with error %u\n", error); + switch (error) + { + case ERROR_CANNOT_IMPERSONATE: + return RPC_S_NO_CONTEXT_AVAILABLE; + } + } + return RPC_S_OK; +} + +static RPC_STATUS rpcrt4_conn_np_revert_to_self(RpcConnection *conn) +{ + BOOL ret; + + TRACE("(%p)\n", conn); + + if (conn->AuthInfo && SecIsValidHandle(&conn->ctx)) + return RPCRT4_default_revert_to_self(conn); + + ret = RevertToSelf(); + if (!ret) + { + WARN("RevertToSelf failed with error %u\n", GetLastError()); + return RPC_S_NO_CONTEXT_AVAILABLE; + } + return RPC_S_OK; +} + typedef struct _RpcServerProtseq_np { RpcServerProtseq common; @@ -637,7 +676,7 @@ static void *rpcrt4_protseq_np_get_wait_array(RpcServerProtseq *protseq, void *p conn = CONTAINING_RECORD(protseq->conn, RpcConnection_np, common); while (conn) { rpcrt4_conn_listen_pipe(conn); - if (conn->ovl[0].hEvent) + if (conn->ovl.hEvent) (*count)++; conn = CONTAINING_RECORD(conn->common.Next, RpcConnection_np, common); } @@ -658,7 +697,7 @@ static void *rpcrt4_protseq_np_get_wait_array(RpcServerProtseq *protseq, void *p *count = 1; conn = CONTAINING_RECORD(protseq->conn, RpcConnection_np, common); while (conn) { - if ((objs[*count] = conn->ovl[0].hEvent)) + if ((objs[*count] = conn->ovl.hEvent)) (*count)++; conn = CONTAINING_RECORD(conn->common.Next, RpcConnection_np, common); } @@ -705,7 +744,7 @@ static int rpcrt4_protseq_np_wait_for_new_connection(RpcServerProtseq *protseq, EnterCriticalSection(&protseq->cs); conn = CONTAINING_RECORD(protseq->conn, RpcConnection_np, common); while (conn) { - if (b_handle == conn->ovl[0].hEvent) break; + if (b_handle == conn->ovl.hEvent) break; conn = CONTAINING_RECORD(conn->common.Next, RpcConnection_np, common); } cconn = NULL; @@ -787,6 +826,65 @@ static RPC_STATUS rpcrt4_ncalrpc_parse_top_of_tower(const unsigned char *tower_d return RPC_S_OK; } +static BOOL rpcrt4_ncalrpc_is_authorized(RpcConnection *conn) +{ + return FALSE; +} + +static RPC_STATUS rpcrt4_ncalrpc_authorize(RpcConnection *conn, BOOL first_time, + unsigned char *in_buffer, + unsigned int in_size, + unsigned char *out_buffer, + unsigned int *out_size) +{ + /* since this protocol is local to the machine there is no need to + * authenticate the caller */ + *out_size = 0; + return RPC_S_OK; +} + +static RPC_STATUS rpcrt4_ncalrpc_secure_packet(RpcConnection *conn, + enum secure_packet_direction dir, + RpcPktHdr *hdr, unsigned int hdr_size, + unsigned char *stub_data, unsigned int stub_data_size, + RpcAuthVerifier *auth_hdr, + unsigned char *auth_value, unsigned int auth_value_size) +{ + /* since this protocol is local to the machine there is no need to secure + * the packet */ + return RPC_S_OK; +} + +static RPC_STATUS rpcrt4_ncalrpc_inquire_auth_client( + RpcConnection *conn, RPC_AUTHZ_HANDLE *privs, RPC_WSTR *server_princ_name, + ULONG *authn_level, ULONG *authn_svc, ULONG *authz_svc, ULONG flags) +{ + TRACE("(%p, %p, %p, %p, %p, %p, 0x%x)\n", conn, privs, + server_princ_name, authn_level, authn_svc, authz_svc, flags); + + if (privs) + { + FIXME("privs not implemented\n"); + *privs = NULL; + } + if (server_princ_name) + { + FIXME("server_princ_name not implemented\n"); + *server_princ_name = NULL; + } + if (authn_level) *authn_level = RPC_C_AUTHN_LEVEL_PKT_PRIVACY; + if (authn_svc) *authn_svc = RPC_C_AUTHN_WINNT; + if (authz_svc) + { + FIXME("authorization service not implemented\n"); + *authz_svc = RPC_C_AUTHZ_NONE; + } + if (flags) + FIXME("flags 0x%x not implemented\n", flags); + + return RPC_S_OK; +} + /**** ncacn_ip_tcp support ****/ static size_t rpcrt4_ip_tcp_get_top_of_tower(unsigned char *tower_data, @@ -1176,7 +1274,7 @@ static RPC_STATUS rpcrt4_ncacn_ip_tcp_open(RpcConnection* Connection) return RPC_S_SERVER_UNAVAILABLE; } -static RPC_STATUS rpcrt4_protseq_ncacn_ip_tcp_open_endpoint(RpcServerProtseq *protseq, LPSTR endpoint) +static RPC_STATUS rpcrt4_protseq_ncacn_ip_tcp_open_endpoint(RpcServerProtseq *protseq, const char *endpoint) { RPC_STATUS status = RPC_S_CANT_CREATE_ENDPOINT; int sock; @@ -1742,6 +1840,945 @@ static RPC_STATUS rpcrt4_ncacn_ip_tcp_parse_top_of_tower(const unsigned char *to endpoint); } +/**** ncacn_http support ****/ + +/* 60 seconds is the period native uses */ +#define HTTP_IDLE_TIME 60000 + +/* reference counted to avoid a race between a cancelled call's connection + * being destroyed and the asynchronous InternetReadFileEx call being + * completed */ +typedef struct _RpcHttpAsyncData +{ + LONG refs; + HANDLE completion_event; + INTERNET_BUFFERSA inet_buffers; + void *destination_buffer; /* the address that inet_buffers.lpvBuffer will be + * copied into when the call completes */ + CRITICAL_SECTION cs; +} RpcHttpAsyncData; + +static ULONG RpcHttpAsyncData_AddRef(RpcHttpAsyncData *data) +{ + return InterlockedIncrement(&data->refs); +} + +static ULONG RpcHttpAsyncData_Release(RpcHttpAsyncData *data) +{ + ULONG refs = InterlockedDecrement(&data->refs); + if (!refs) + { + TRACE("destroying async data %p\n", data); + CloseHandle(data->completion_event); + HeapFree(GetProcessHeap(), 0, data->inet_buffers.lpvBuffer); + DeleteCriticalSection(&data->cs); + HeapFree(GetProcessHeap(), 0, data); + } + return refs; +} + +typedef struct _RpcConnection_http +{ + RpcConnection common; + HINTERNET app_info; + HINTERNET session; + HINTERNET in_request; + HINTERNET out_request; + HANDLE timer_cancelled; + HANDLE cancel_event; + DWORD last_sent_time; + ULONG bytes_received; + ULONG flow_control_mark; /* send a control packet to the server when this many bytes received */ + ULONG flow_control_increment; /* number of bytes to increment flow_control_mark by */ + UUID connection_uuid; + UUID in_pipe_uuid; + UUID out_pipe_uuid; + RpcHttpAsyncData *async_data; +} RpcConnection_http; + +static RpcConnection *rpcrt4_ncacn_http_alloc(void) +{ + RpcConnection_http *httpc; + httpc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*httpc)); + if (!httpc) return NULL; + httpc->async_data = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(RpcHttpAsyncData)); + if (!httpc->async_data) + { + HeapFree(GetProcessHeap(), 0, httpc); + return NULL; + } + TRACE("async data = %p\n", httpc->async_data); + httpc->cancel_event = CreateEventW(NULL, FALSE, FALSE, NULL); + httpc->async_data->refs = 1; + httpc->async_data->inet_buffers.dwStructSize = sizeof(INTERNET_BUFFERSA); + httpc->async_data->inet_buffers.lpvBuffer = NULL; + httpc->async_data->destination_buffer = NULL; + InitializeCriticalSection(&httpc->async_data->cs); + return &httpc->common; +} + +typedef struct _HttpTimerThreadData +{ + PVOID timer_param; + DWORD *last_sent_time; + HANDLE timer_cancelled; +} HttpTimerThreadData; + +static VOID rpcrt4_http_keep_connection_active_timer_proc(PVOID param, BOOLEAN dummy) +{ + HINTERNET in_request = param; + RpcPktHdr *idle_pkt; + + idle_pkt = RPCRT4_BuildHttpHeader(NDR_LOCAL_DATA_REPRESENTATION, 0x0001, + 0, 0); + if (idle_pkt) + { + DWORD bytes_written; + InternetWriteFile(in_request, idle_pkt, idle_pkt->common.frag_len, &bytes_written); + RPCRT4_FreeHeader(idle_pkt); + } +} + +static inline DWORD rpcrt4_http_timer_calc_timeout(DWORD *last_sent_time) +{ + DWORD cur_time = GetTickCount(); + DWORD cached_last_sent_time = *last_sent_time; + return HTTP_IDLE_TIME - (cur_time - cached_last_sent_time > HTTP_IDLE_TIME ? 0 : cur_time - cached_last_sent_time); +} + +static DWORD CALLBACK rpcrt4_http_timer_thread(PVOID param) +{ + HttpTimerThreadData *data_in = param; + HttpTimerThreadData data; + DWORD timeout; + + data = *data_in; + HeapFree(GetProcessHeap(), 0, data_in); + + for (timeout = HTTP_IDLE_TIME; + WaitForSingleObject(data.timer_cancelled, timeout) == WAIT_TIMEOUT; + timeout = rpcrt4_http_timer_calc_timeout(data.last_sent_time)) + { + /* are we too soon after last send? */ + if (GetTickCount() - HTTP_IDLE_TIME < *data.last_sent_time) + continue; + rpcrt4_http_keep_connection_active_timer_proc(data.timer_param, TRUE); + } + + CloseHandle(data.timer_cancelled); + return 0; +} + +static VOID WINAPI rpcrt4_http_internet_callback( + HINTERNET hInternet, + DWORD_PTR dwContext, + DWORD dwInternetStatus, + LPVOID lpvStatusInformation, + DWORD dwStatusInformationLength) +{ + RpcHttpAsyncData *async_data = (RpcHttpAsyncData *)dwContext; + + switch (dwInternetStatus) + { + case INTERNET_STATUS_REQUEST_COMPLETE: + TRACE("INTERNET_STATUS_REQUEST_COMPLETED\n"); + if (async_data) + { + if (async_data->inet_buffers.lpvBuffer) + { + EnterCriticalSection(&async_data->cs); + if (async_data->destination_buffer) + { + memcpy(async_data->destination_buffer, + async_data->inet_buffers.lpvBuffer, + async_data->inet_buffers.dwBufferLength); + async_data->destination_buffer = NULL; + } + LeaveCriticalSection(&async_data->cs); + } + HeapFree(GetProcessHeap(), 0, async_data->inet_buffers.lpvBuffer); + async_data->inet_buffers.lpvBuffer = NULL; + SetEvent(async_data->completion_event); + RpcHttpAsyncData_Release(async_data); + } + break; + } +} + +static RPC_STATUS rpcrt4_http_check_response(HINTERNET hor) +{ + BOOL ret; + DWORD status_code; + DWORD size; + DWORD index; + WCHAR buf[32]; + WCHAR *status_text = buf; + TRACE("\n"); + + index = 0; + size = sizeof(status_code); + ret = HttpQueryInfoW(hor, HTTP_QUERY_STATUS_CODE|HTTP_QUERY_FLAG_NUMBER, &status_code, &size, &index); + if (!ret) + return GetLastError(); + if (status_code < 400) + return RPC_S_OK; + index = 0; + size = sizeof(buf); + ret = HttpQueryInfoW(hor, HTTP_QUERY_STATUS_TEXT, status_text, &size, &index); + if (!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER) + { + status_text = HeapAlloc(GetProcessHeap(), 0, size); + ret = HttpQueryInfoW(hor, HTTP_QUERY_STATUS_TEXT, status_text, &size, &index); + } + + ERR("server returned: %d %s\n", status_code, ret ? debugstr_w(status_text) : ""); + if(status_text != buf) HeapFree(GetProcessHeap(), 0, status_text); + + if (status_code == HTTP_STATUS_DENIED) + return ERROR_ACCESS_DENIED; + return RPC_S_SERVER_UNAVAILABLE; +} + +static RPC_STATUS rpcrt4_http_internet_connect(RpcConnection_http *httpc) +{ + static const WCHAR wszUserAgent[] = {'M','S','R','P','C',0}; + LPWSTR proxy = NULL; + LPWSTR user = NULL; + LPWSTR password = NULL; + LPWSTR servername = NULL; + const WCHAR *option; + INTERNET_PORT port = INTERNET_INVALID_PORT_NUMBER; /* use default port */ + + if (httpc->common.QOS && + (httpc->common.QOS->qos->AdditionalSecurityInfoType == RPC_C_AUTHN_INFO_TYPE_HTTP)) + { + const RPC_HTTP_TRANSPORT_CREDENTIALS_W *http_cred = httpc->common.QOS->qos->u.HttpCredentials; + if (http_cred->TransportCredentials) + { + WCHAR *p; + const SEC_WINNT_AUTH_IDENTITY_W *cred = http_cred->TransportCredentials; + ULONG len = cred->DomainLength + 1 + cred->UserLength; + user = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR)); + if (!user) + return RPC_S_OUT_OF_RESOURCES; + p = user; + if (cred->DomainLength) + { + memcpy(p, cred->Domain, cred->DomainLength * sizeof(WCHAR)); + p += cred->DomainLength; + *p = '\\'; + p++; + } + memcpy(p, cred->User, cred->UserLength * sizeof(WCHAR)); + p[cred->UserLength] = 0; + + password = RPCRT4_strndupW(cred->Password, cred->PasswordLength); + } + } + + for (option = httpc->common.NetworkOptions; option; + option = (strchrW(option, ',') ? strchrW(option, ',')+1 : NULL)) + { + static const WCHAR wszRpcProxy[] = {'R','p','c','P','r','o','x','y','=',0}; + static const WCHAR wszHttpProxy[] = {'H','t','t','p','P','r','o','x','y','=',0}; + + if (!strncmpiW(option, wszRpcProxy, sizeof(wszRpcProxy)/sizeof(wszRpcProxy[0])-1)) + { + const WCHAR *value_start = option + sizeof(wszRpcProxy)/sizeof(wszRpcProxy[0])-1; + const WCHAR *value_end; + const WCHAR *p; + + value_end = strchrW(option, ','); + if (!value_end) + value_end = value_start + strlenW(value_start); + for (p = value_start; p < value_end; p++) + if (*p == ':') + { + port = atoiW(p+1); + value_end = p; + break; + } + TRACE("RpcProxy value is %s\n", debugstr_wn(value_start, value_end-value_start)); + servername = RPCRT4_strndupW(value_start, value_end-value_start); + } + else if (!strncmpiW(option, wszHttpProxy, sizeof(wszHttpProxy)/sizeof(wszHttpProxy[0])-1)) + { + const WCHAR *value_start = option + sizeof(wszHttpProxy)/sizeof(wszHttpProxy[0])-1; + const WCHAR *value_end; + + value_end = strchrW(option, ','); + if (!value_end) + value_end = value_start + strlenW(value_start); + TRACE("HttpProxy value is %s\n", debugstr_wn(value_start, value_end-value_start)); + proxy = RPCRT4_strndupW(value_start, value_end-value_start); + } + else + FIXME("unhandled option %s\n", debugstr_w(option)); + } + + httpc->app_info = InternetOpenW(wszUserAgent, proxy ? INTERNET_OPEN_TYPE_PROXY : INTERNET_OPEN_TYPE_PRECONFIG, + NULL, NULL, INTERNET_FLAG_ASYNC); + if (!httpc->app_info) + { + HeapFree(GetProcessHeap(), 0, password); + HeapFree(GetProcessHeap(), 0, user); + ERR("InternetOpenW failed with error %d\n", GetLastError()); + return RPC_S_SERVER_UNAVAILABLE; + } + InternetSetStatusCallbackW(httpc->app_info, rpcrt4_http_internet_callback); + + /* if no RpcProxy option specified, set the HTTP server address to the + * RPC server address */ + if (!servername) + { + servername = HeapAlloc(GetProcessHeap(), 0, (strlen(httpc->common.NetworkAddr) + 1)*sizeof(WCHAR)); + if (!servername) + { + HeapFree(GetProcessHeap(), 0, password); + HeapFree(GetProcessHeap(), 0, user); + return RPC_S_OUT_OF_RESOURCES; + } + MultiByteToWideChar(CP_ACP, 0, httpc->common.NetworkAddr, -1, servername, strlen(httpc->common.NetworkAddr) + 1); + } + + httpc->session = InternetConnectW(httpc->app_info, servername, port, user, password, + INTERNET_SERVICE_HTTP, 0, 0); + + HeapFree(GetProcessHeap(), 0, password); + HeapFree(GetProcessHeap(), 0, user); + HeapFree(GetProcessHeap(), 0, servername); + + if (!httpc->session) + { + ERR("InternetConnectW failed with error %d\n", GetLastError()); + return RPC_S_SERVER_UNAVAILABLE; + } + + return RPC_S_OK; +} + +/* prepare the in pipe for use by RPC packets */ +static RPC_STATUS rpcrt4_http_prepare_in_pipe(HINTERNET in_request, RpcHttpAsyncData *async_data, + const UUID *connection_uuid, + const UUID *in_pipe_uuid, + const UUID *association_uuid) +{ + BYTE packet[44]; + BOOL ret; + RPC_STATUS status; + RpcPktHdr *hdr; + INTERNET_BUFFERSW buffers_in; + DWORD bytes_read, bytes_written; + + /* prepare in pipe */ + ResetEvent(async_data->completion_event); + RpcHttpAsyncData_AddRef(async_data); + ret = HttpSendRequestW(in_request, NULL, 0, NULL, 0); + if (!ret) + { + if (GetLastError() == ERROR_IO_PENDING) + WaitForSingleObject(async_data->completion_event, INFINITE); + else + { + RpcHttpAsyncData_Release(async_data); + ERR("HttpSendRequestW failed with error %d\n", GetLastError()); + return RPC_S_SERVER_UNAVAILABLE; + } + } + status = rpcrt4_http_check_response(in_request); + if (status != RPC_S_OK) return status; + + InternetReadFile(in_request, packet, 20, &bytes_read); + /* FIXME: do something with retrieved data */ + + memset(&buffers_in, 0, sizeof(buffers_in)); + buffers_in.dwStructSize = sizeof(buffers_in); + /* FIXME: get this from the registry */ + buffers_in.dwBufferTotal = 1024 * 1024 * 1024; /* 1Gb */ + ResetEvent(async_data->completion_event); + RpcHttpAsyncData_AddRef(async_data); + ret = HttpSendRequestExW(in_request, &buffers_in, NULL, 0, 0); + if (!ret) + { + if (GetLastError() == ERROR_IO_PENDING) + WaitForSingleObject(async_data->completion_event, INFINITE); + else + { + RpcHttpAsyncData_Release(async_data); + ERR("HttpSendRequestExW failed with error %d\n", GetLastError()); + return RPC_S_SERVER_UNAVAILABLE; + } + } + + TRACE("sending HTTP connect header to server\n"); + hdr = RPCRT4_BuildHttpConnectHeader(0, FALSE, connection_uuid, in_pipe_uuid, association_uuid); + if (!hdr) return RPC_S_OUT_OF_RESOURCES; + ret = InternetWriteFile(in_request, hdr, hdr->common.frag_len, &bytes_written); + RPCRT4_FreeHeader(hdr); + if (!ret) + { + ERR("InternetWriteFile failed with error %d\n", GetLastError()); + return RPC_S_SERVER_UNAVAILABLE; + } + + return RPC_S_OK; +} + +static RPC_STATUS rpcrt4_http_read_http_packet(HINTERNET request, RpcPktHdr *hdr, BYTE **data) +{ + BOOL ret; + DWORD bytes_read; + unsigned short data_len; + + ret = InternetReadFile(request, hdr, sizeof(hdr->common), &bytes_read); + if (!ret) + return RPC_S_SERVER_UNAVAILABLE; + if (hdr->common.ptype != PKT_HTTP || hdr->common.frag_len < sizeof(hdr->http)) + { + ERR("wrong packet type received %d or wrong frag_len %d\n", + hdr->common.ptype, hdr->common.frag_len); + return RPC_S_PROTOCOL_ERROR; + } + + ret = InternetReadFile(request, &hdr->common + 1, sizeof(hdr->http) - sizeof(hdr->common), &bytes_read); + if (!ret) + return RPC_S_SERVER_UNAVAILABLE; + + data_len = hdr->common.frag_len - sizeof(hdr->http); + if (data_len) + { + *data = HeapAlloc(GetProcessHeap(), 0, data_len); + if (!*data) + return RPC_S_OUT_OF_RESOURCES; + ret = InternetReadFile(request, *data, data_len, &bytes_read); + if (!ret) + { + HeapFree(GetProcessHeap(), 0, *data); + return RPC_S_SERVER_UNAVAILABLE; + } + } + else + *data = NULL; + + if (!RPCRT4_IsValidHttpPacket(hdr, *data, data_len)) + { + ERR("invalid http packet\n"); + return RPC_S_PROTOCOL_ERROR; + } + + return RPC_S_OK; +} + +/* prepare the out pipe for use by RPC packets */ +static RPC_STATUS rpcrt4_http_prepare_out_pipe(HINTERNET out_request, + RpcHttpAsyncData *async_data, + const UUID *connection_uuid, + const UUID *out_pipe_uuid, + ULONG *flow_control_increment) +{ + BYTE packet[20]; + BOOL ret; + RPC_STATUS status; + RpcPktHdr *hdr; + DWORD bytes_read; + BYTE *data_from_server; + RpcPktHdr pkt_from_server; + ULONG field1, field3; + + ResetEvent(async_data->completion_event); + RpcHttpAsyncData_AddRef(async_data); + ret = HttpSendRequestW(out_request, NULL, 0, NULL, 0); + if (!ret) + { + if (GetLastError() == ERROR_IO_PENDING) + WaitForSingleObject(async_data->completion_event, INFINITE); + else + { + RpcHttpAsyncData_Release(async_data); + ERR("HttpSendRequestW failed with error %d\n", GetLastError()); + return RPC_S_SERVER_UNAVAILABLE; + } + } + status = rpcrt4_http_check_response(out_request); + if (status != RPC_S_OK) return status; + + InternetReadFile(out_request, packet, 20, &bytes_read); + /* FIXME: do something with retrieved data */ + + hdr = RPCRT4_BuildHttpConnectHeader(0, TRUE, connection_uuid, out_pipe_uuid, NULL); + if (!hdr) return RPC_S_OUT_OF_RESOURCES; + ResetEvent(async_data->completion_event); + RpcHttpAsyncData_AddRef(async_data); + ret = HttpSendRequestW(out_request, NULL, 0, hdr, hdr->common.frag_len); + if (!ret) + { + if (GetLastError() == ERROR_IO_PENDING) + WaitForSingleObject(async_data->completion_event, INFINITE); + else + { + RpcHttpAsyncData_Release(async_data); + ERR("HttpSendRequestW failed with error %d\n", GetLastError()); + RPCRT4_FreeHeader(hdr); + return RPC_S_SERVER_UNAVAILABLE; + } + } + RPCRT4_FreeHeader(hdr); + status = rpcrt4_http_check_response(out_request); + if (status != RPC_S_OK) return status; + + status = rpcrt4_http_read_http_packet(out_request, &pkt_from_server, + &data_from_server); + if (status != RPC_S_OK) return status; + status = RPCRT4_ParseHttpPrepareHeader1(&pkt_from_server, data_from_server, + &field1); + HeapFree(GetProcessHeap(), 0, data_from_server); + if (status != RPC_S_OK) return status; + TRACE("received (%d) from first prepare header\n", field1); + + status = rpcrt4_http_read_http_packet(out_request, &pkt_from_server, + &data_from_server); + if (status != RPC_S_OK) return status; + status = RPCRT4_ParseHttpPrepareHeader2(&pkt_from_server, data_from_server, + &field1, flow_control_increment, + &field3); + HeapFree(GetProcessHeap(), 0, data_from_server); + if (status != RPC_S_OK) return status; + TRACE("received (0x%08x 0x%08x %d) from second prepare header\n", field1, *flow_control_increment, field3); + + return RPC_S_OK; +} + +static RPC_STATUS rpcrt4_ncacn_http_open(RpcConnection* Connection) +{ + RpcConnection_http *httpc = (RpcConnection_http *)Connection; + static const WCHAR wszVerbIn[] = {'R','P','C','_','I','N','_','D','A','T','A',0}; + static const WCHAR wszVerbOut[] = {'R','P','C','_','O','U','T','_','D','A','T','A',0}; + static const WCHAR wszRpcProxyPrefix[] = {'/','r','p','c','/','r','p','c','p','r','o','x','y','.','d','l','l','?',0}; + static const WCHAR wszColon[] = {':',0}; + static const WCHAR wszAcceptType[] = {'a','p','p','l','i','c','a','t','i','o','n','/','r','p','c',0}; + LPCWSTR wszAcceptTypes[] = { wszAcceptType, NULL }; + WCHAR *url; + RPC_STATUS status; + BOOL secure; + HttpTimerThreadData *timer_data; + HANDLE thread; + + TRACE("(%s, %s)\n", Connection->NetworkAddr, Connection->Endpoint); + + if (Connection->server) + { + ERR("ncacn_http servers not supported yet\n"); + return RPC_S_SERVER_UNAVAILABLE; + } + + if (httpc->in_request) + return RPC_S_OK; + + httpc->async_data->completion_event = CreateEventW(NULL, FALSE, FALSE, NULL); + + status = UuidCreate(&httpc->connection_uuid); + status = UuidCreate(&httpc->in_pipe_uuid); + status = UuidCreate(&httpc->out_pipe_uuid); + + status = rpcrt4_http_internet_connect(httpc); + if (status != RPC_S_OK) + return status; + + url = HeapAlloc(GetProcessHeap(), 0, sizeof(wszRpcProxyPrefix) + (strlen(Connection->NetworkAddr) + 1 + strlen(Connection->Endpoint))*sizeof(WCHAR)); + if (!url) + return RPC_S_OUT_OF_MEMORY; + memcpy(url, wszRpcProxyPrefix, sizeof(wszRpcProxyPrefix)); + MultiByteToWideChar(CP_ACP, 0, Connection->NetworkAddr, -1, url+sizeof(wszRpcProxyPrefix)/sizeof(wszRpcProxyPrefix[0])-1, strlen(Connection->NetworkAddr)+1); + strcatW(url, wszColon); + MultiByteToWideChar(CP_ACP, 0, Connection->Endpoint, -1, url+strlenW(url), strlen(Connection->Endpoint)+1); + + secure = httpc->common.QOS && + (httpc->common.QOS->qos->AdditionalSecurityInfoType == RPC_C_AUTHN_INFO_TYPE_HTTP) && + (httpc->common.QOS->qos->u.HttpCredentials->Flags & RPC_C_HTTP_FLAG_USE_SSL); + + httpc->in_request = HttpOpenRequestW(httpc->session, wszVerbIn, url, NULL, NULL, + wszAcceptTypes, + (secure ? INTERNET_FLAG_SECURE : 0)|INTERNET_FLAG_KEEP_CONNECTION|INTERNET_FLAG_PRAGMA_NOCACHE, + (DWORD_PTR)httpc->async_data); + if (!httpc->in_request) + { + ERR("HttpOpenRequestW failed with error %d\n", GetLastError()); + return RPC_S_SERVER_UNAVAILABLE; + } + httpc->out_request = HttpOpenRequestW(httpc->session, wszVerbOut, url, NULL, NULL, + wszAcceptTypes, + (secure ? INTERNET_FLAG_SECURE : 0)|INTERNET_FLAG_KEEP_CONNECTION|INTERNET_FLAG_PRAGMA_NOCACHE, + (DWORD_PTR)httpc->async_data); + if (!httpc->out_request) + { + ERR("HttpOpenRequestW failed with error %d\n", GetLastError()); + return RPC_S_SERVER_UNAVAILABLE; + } + + status = rpcrt4_http_prepare_in_pipe(httpc->in_request, + httpc->async_data, + &httpc->connection_uuid, + &httpc->in_pipe_uuid, + &Connection->assoc->http_uuid); + if (status != RPC_S_OK) + return status; + + status = rpcrt4_http_prepare_out_pipe(httpc->out_request, + httpc->async_data, + &httpc->connection_uuid, + &httpc->out_pipe_uuid, + &httpc->flow_control_increment); + if (status != RPC_S_OK) + return status; + + httpc->flow_control_mark = httpc->flow_control_increment / 2; + httpc->last_sent_time = GetTickCount(); + httpc->timer_cancelled = CreateEventW(NULL, FALSE, FALSE, NULL); + + timer_data = HeapAlloc(GetProcessHeap(), 0, sizeof(*timer_data)); + if (!timer_data) + return ERROR_OUTOFMEMORY; + timer_data->timer_param = httpc->in_request; + timer_data->last_sent_time = &httpc->last_sent_time; + timer_data->timer_cancelled = httpc->timer_cancelled; + /* FIXME: should use CreateTimerQueueTimer when implemented */ + thread = CreateThread(NULL, 0, rpcrt4_http_timer_thread, timer_data, 0, NULL); + if (!thread) + { + HeapFree(GetProcessHeap(), 0, timer_data); + return GetLastError(); + } + CloseHandle(thread); + + return RPC_S_OK; +} + +static RPC_STATUS rpcrt4_ncacn_http_handoff(RpcConnection *old_conn, RpcConnection *new_conn) +{ + assert(0); + return RPC_S_SERVER_UNAVAILABLE; +} + +static int rpcrt4_ncacn_http_read(RpcConnection *Connection, + void *buffer, unsigned int count) +{ + RpcConnection_http *httpc = (RpcConnection_http *) Connection; + char *buf = buffer; + BOOL ret = TRUE; + unsigned int bytes_left = count; + + ResetEvent(httpc->async_data->completion_event); + while (bytes_left) + { + RpcHttpAsyncData_AddRef(httpc->async_data); + httpc->async_data->inet_buffers.dwBufferLength = bytes_left; + httpc->async_data->inet_buffers.lpvBuffer = HeapAlloc(GetProcessHeap(), 0, bytes_left); + httpc->async_data->destination_buffer = buf; + ret = InternetReadFileExA(httpc->out_request, &httpc->async_data->inet_buffers, IRF_ASYNC, 0); + if (ret) + { + /* INTERNET_STATUS_REQUEST_COMPLETED won't be sent, so release our + * async ref now */ + RpcHttpAsyncData_Release(httpc->async_data); + memcpy(buf, httpc->async_data->inet_buffers.lpvBuffer, + httpc->async_data->inet_buffers.dwBufferLength); + HeapFree(GetProcessHeap(), 0, httpc->async_data->inet_buffers.lpvBuffer); + httpc->async_data->inet_buffers.lpvBuffer = NULL; + httpc->async_data->destination_buffer = NULL; + } + else + { + if (GetLastError() == ERROR_IO_PENDING) + { + HANDLE handles[2] = { httpc->async_data->completion_event, httpc->cancel_event }; + DWORD result = WaitForMultipleObjects(2, handles, FALSE, DEFAULT_NCACN_HTTP_TIMEOUT); + if (result == WAIT_OBJECT_0) + ret = TRUE; + else + { + TRACE("call cancelled\n"); + EnterCriticalSection(&httpc->async_data->cs); + httpc->async_data->destination_buffer = NULL; + LeaveCriticalSection(&httpc->async_data->cs); + break; + } + } + else + { + HeapFree(GetProcessHeap(), 0, httpc->async_data->inet_buffers.lpvBuffer); + httpc->async_data->inet_buffers.lpvBuffer = NULL; + httpc->async_data->destination_buffer = NULL; + RpcHttpAsyncData_Release(httpc->async_data); + break; + } + } + if (!httpc->async_data->inet_buffers.dwBufferLength) + break; + bytes_left -= httpc->async_data->inet_buffers.dwBufferLength; + buf += httpc->async_data->inet_buffers.dwBufferLength; + } + TRACE("%p %p %u -> %s\n", httpc->out_request, buffer, count, ret ? "TRUE" : "FALSE"); + return ret ? count : -1; +} + +static RPC_STATUS rpcrt4_ncacn_http_receive_fragment(RpcConnection *Connection, RpcPktHdr **Header, void **Payload) +{ + RpcConnection_http *httpc = (RpcConnection_http *) Connection; + RPC_STATUS status; + DWORD hdr_length; + LONG dwRead; + RpcPktCommonHdr common_hdr; + + *Header = NULL; + + TRACE("(%p, %p, %p)\n", Connection, Header, Payload); + +again: + /* read packet common header */ + dwRead = rpcrt4_ncacn_http_read(Connection, &common_hdr, sizeof(common_hdr)); + if (dwRead != sizeof(common_hdr)) { + WARN("Short read of header, %d bytes\n", dwRead); + status = RPC_S_PROTOCOL_ERROR; + goto fail; + } + if (!memcmp(&common_hdr, "HTTP/1.1", sizeof("HTTP/1.1")) || + !memcmp(&common_hdr, "HTTP/1.0", sizeof("HTTP/1.0"))) + { + FIXME("server returned %s\n", debugstr_a((const char *)&common_hdr)); + status = RPC_S_PROTOCOL_ERROR; + goto fail; + } + + status = RPCRT4_ValidateCommonHeader(&common_hdr); + if (status != RPC_S_OK) goto fail; + + hdr_length = RPCRT4_GetHeaderSize((RpcPktHdr*)&common_hdr); + if (hdr_length == 0) { + WARN("header length == 0\n"); + status = RPC_S_PROTOCOL_ERROR; + goto fail; + } + + *Header = HeapAlloc(GetProcessHeap(), 0, hdr_length); + if (!*Header) + { + status = RPC_S_OUT_OF_RESOURCES; + goto fail; + } + memcpy(*Header, &common_hdr, sizeof(common_hdr)); + + /* read the rest of packet header */ + dwRead = rpcrt4_ncacn_http_read(Connection, &(*Header)->common + 1, hdr_length - sizeof(common_hdr)); + if (dwRead != hdr_length - sizeof(common_hdr)) { + WARN("bad header length, %d bytes, hdr_length %d\n", dwRead, hdr_length); + status = RPC_S_PROTOCOL_ERROR; + goto fail; + } + + if (common_hdr.frag_len - hdr_length) + { + *Payload = HeapAlloc(GetProcessHeap(), 0, common_hdr.frag_len - hdr_length); + if (!*Payload) + { + status = RPC_S_OUT_OF_RESOURCES; + goto fail; + } + + dwRead = rpcrt4_ncacn_http_read(Connection, *Payload, common_hdr.frag_len - hdr_length); + if (dwRead != common_hdr.frag_len - hdr_length) + { + WARN("bad data length, %d/%d\n", dwRead, common_hdr.frag_len - hdr_length); + status = RPC_S_PROTOCOL_ERROR; + goto fail; + } + } + else + *Payload = NULL; + + if ((*Header)->common.ptype == PKT_HTTP) + { + if (!RPCRT4_IsValidHttpPacket(*Header, *Payload, common_hdr.frag_len - hdr_length)) + { + ERR("invalid http packet of length %d bytes\n", (*Header)->common.frag_len); + status = RPC_S_PROTOCOL_ERROR; + goto fail; + } + if ((*Header)->http.flags == 0x0001) + { + TRACE("http idle packet, waiting for real packet\n"); + if ((*Header)->http.num_data_items != 0) + { + ERR("HTTP idle packet should have no data items instead of %d\n", (*Header)->http.num_data_items); + status = RPC_S_PROTOCOL_ERROR; + goto fail; + } + } + else if ((*Header)->http.flags == 0x0002) + { + ULONG bytes_transmitted; + ULONG flow_control_increment; + UUID pipe_uuid; + status = RPCRT4_ParseHttpFlowControlHeader(*Header, *Payload, + Connection->server, + &bytes_transmitted, + &flow_control_increment, + &pipe_uuid); + if (status != RPC_S_OK) + goto fail; + TRACE("received http flow control header (0x%x, 0x%x, %s)\n", + bytes_transmitted, flow_control_increment, debugstr_guid(&pipe_uuid)); + /* FIXME: do something with parsed data */ + } + else + { + FIXME("unrecognised http packet with flags 0x%04x\n", (*Header)->http.flags); + status = RPC_S_PROTOCOL_ERROR; + goto fail; + } + RPCRT4_FreeHeader(*Header); + *Header = NULL; + HeapFree(GetProcessHeap(), 0, *Payload); + *Payload = NULL; + goto again; + } + + /* success */ + status = RPC_S_OK; + + httpc->bytes_received += common_hdr.frag_len; + + TRACE("httpc->bytes_received = 0x%x\n", httpc->bytes_received); + + if (httpc->bytes_received > httpc->flow_control_mark) + { + RpcPktHdr *hdr = RPCRT4_BuildHttpFlowControlHeader(httpc->common.server, + httpc->bytes_received, + httpc->flow_control_increment, + &httpc->out_pipe_uuid); + if (hdr) + { + DWORD bytes_written; + BOOL ret2; + TRACE("sending flow control packet at 0x%x\n", httpc->bytes_received); + ret2 = InternetWriteFile(httpc->in_request, hdr, hdr->common.frag_len, &bytes_written); + RPCRT4_FreeHeader(hdr); + if (ret2) + httpc->flow_control_mark = httpc->bytes_received + httpc->flow_control_increment / 2; + } + } + +fail: + if (status != RPC_S_OK) { + RPCRT4_FreeHeader(*Header); + *Header = NULL; + HeapFree(GetProcessHeap(), 0, *Payload); + *Payload = NULL; + } + return status; +} + +static int rpcrt4_ncacn_http_write(RpcConnection *Connection, + const void *buffer, unsigned int count) +{ + RpcConnection_http *httpc = (RpcConnection_http *) Connection; + DWORD bytes_written; + BOOL ret; + + httpc->last_sent_time = ~0U; /* disable idle packet sending */ + ret = InternetWriteFile(httpc->in_request, buffer, count, &bytes_written); + httpc->last_sent_time = GetTickCount(); + TRACE("%p %p %u -> %s\n", httpc->in_request, buffer, count, ret ? "TRUE" : "FALSE"); + return ret ? bytes_written : -1; +} + +static int rpcrt4_ncacn_http_close(RpcConnection *Connection) +{ + RpcConnection_http *httpc = (RpcConnection_http *) Connection; + + TRACE("\n"); + + SetEvent(httpc->timer_cancelled); + if (httpc->in_request) + InternetCloseHandle(httpc->in_request); + httpc->in_request = NULL; + if (httpc->out_request) + InternetCloseHandle(httpc->out_request); + httpc->out_request = NULL; + if (httpc->app_info) + InternetCloseHandle(httpc->app_info); + httpc->app_info = NULL; + if (httpc->session) + InternetCloseHandle(httpc->session); + httpc->session = NULL; + RpcHttpAsyncData_Release(httpc->async_data); + if (httpc->cancel_event) + CloseHandle(httpc->cancel_event); + + return 0; +} + +static void rpcrt4_ncacn_http_cancel_call(RpcConnection *Connection) +{ + RpcConnection_http *httpc = (RpcConnection_http *) Connection; + + SetEvent(httpc->cancel_event); +} + +static int rpcrt4_ncacn_http_wait_for_incoming_data(RpcConnection *Connection) +{ + BOOL ret; + RpcConnection_http *httpc = (RpcConnection_http *) Connection; + + RpcHttpAsyncData_AddRef(httpc->async_data); + ret = InternetQueryDataAvailable(httpc->out_request, + &httpc->async_data->inet_buffers.dwBufferLength, IRF_ASYNC, 0); + if (ret) + { + /* INTERNET_STATUS_REQUEST_COMPLETED won't be sent, so release our + * async ref now */ + RpcHttpAsyncData_Release(httpc->async_data); + } + else + { + if (GetLastError() == ERROR_IO_PENDING) + { + HANDLE handles[2] = { httpc->async_data->completion_event, httpc->cancel_event }; + DWORD result = WaitForMultipleObjects(2, handles, FALSE, DEFAULT_NCACN_HTTP_TIMEOUT); + if (result != WAIT_OBJECT_0) + { + TRACE("call cancelled\n"); + return -1; + } + } + else + { + RpcHttpAsyncData_Release(httpc->async_data); + return -1; + } + } + + /* success */ + return 0; +} + +static size_t rpcrt4_ncacn_http_get_top_of_tower(unsigned char *tower_data, + const char *networkaddr, + const char *endpoint) +{ + return rpcrt4_ip_tcp_get_top_of_tower(tower_data, networkaddr, + EPM_PROTOCOL_HTTP, endpoint); +} + +static RPC_STATUS rpcrt4_ncacn_http_parse_top_of_tower(const unsigned char *tower_data, + size_t tower_size, + char **networkaddr, + char **endpoint) +{ + return rpcrt4_ip_tcp_parse_top_of_tower(tower_data, tower_size, + networkaddr, EPM_PROTOCOL_HTTP, + endpoint); +} + static const struct connection_ops conn_protseq_list[] = { { "ncacn_np", { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_SMB }, @@ -1755,6 +2792,13 @@ static const struct connection_ops conn_protseq_list[] = { rpcrt4_conn_np_wait_for_incoming_data, rpcrt4_ncacn_np_get_top_of_tower, rpcrt4_ncacn_np_parse_top_of_tower, + NULL, + RPCRT4_default_is_authorized, + RPCRT4_default_authorize, + RPCRT4_default_secure_packet, + rpcrt4_conn_np_impersonate_client, + rpcrt4_conn_np_revert_to_self, + RPCRT4_default_inquire_auth_client, }, { "ncalrpc", { EPM_PROTOCOL_NCALRPC, EPM_PROTOCOL_PIPE }, @@ -1768,6 +2812,13 @@ static const struct connection_ops conn_protseq_list[] = { rpcrt4_conn_np_wait_for_incoming_data, rpcrt4_ncalrpc_get_top_of_tower, rpcrt4_ncalrpc_parse_top_of_tower, + NULL, + rpcrt4_ncalrpc_is_authorized, + rpcrt4_ncalrpc_authorize, + rpcrt4_ncalrpc_secure_packet, + rpcrt4_conn_np_impersonate_client, + rpcrt4_conn_np_revert_to_self, + rpcrt4_ncalrpc_inquire_auth_client, }, { "ncacn_ip_tcp", { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_TCP }, @@ -1781,8 +2832,34 @@ static const struct connection_ops conn_protseq_list[] = { rpcrt4_conn_tcp_wait_for_incoming_data, rpcrt4_ncacn_ip_tcp_get_top_of_tower, rpcrt4_ncacn_ip_tcp_parse_top_of_tower, - } - + NULL, + RPCRT4_default_is_authorized, + RPCRT4_default_authorize, + RPCRT4_default_secure_packet, + RPCRT4_default_impersonate_client, + RPCRT4_default_revert_to_self, + RPCRT4_default_inquire_auth_client, + }, + { "ncacn_http", + { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_HTTP }, + rpcrt4_ncacn_http_alloc, + rpcrt4_ncacn_http_open, + rpcrt4_ncacn_http_handoff, + rpcrt4_ncacn_http_read, + rpcrt4_ncacn_http_write, + rpcrt4_ncacn_http_close, + rpcrt4_ncacn_http_cancel_call, + rpcrt4_ncacn_http_wait_for_incoming_data, + rpcrt4_ncacn_http_get_top_of_tower, + rpcrt4_ncacn_http_parse_top_of_tower, + rpcrt4_ncacn_http_receive_fragment, + RPCRT4_default_is_authorized, + RPCRT4_default_authorize, + RPCRT4_default_secure_packet, + RPCRT4_default_impersonate_client, + RPCRT4_default_revert_to_self, + RPCRT4_default_inquire_auth_client, + }, }; @@ -1863,6 +2940,7 @@ RPC_STATUS RPCRT4_CreateConnection(RpcConnection** Connection, BOOL server, LPCSTR Protseq, LPCSTR NetworkAddr, LPCSTR Endpoint, LPCWSTR NetworkOptions, RpcAuthInfo* AuthInfo, RpcQualityOfService *QOS) { + static LONG next_id; const struct connection_ops *ops; RpcConnection* NewConnection; @@ -1890,6 +2968,7 @@ RPC_STATUS RPCRT4_CreateConnection(RpcConnection** Connection, BOOL server, NewConnection->attr = 0; if (AuthInfo) RpcAuthInfo_AddRef(AuthInfo); NewConnection->AuthInfo = AuthInfo; + NewConnection->auth_context_id = InterlockedIncrement( &next_id ); NewConnection->encryption_auth_len = 0; NewConnection->signature_auth_len = 0; if (QOS) RpcQualityOfService_AddRef(QOS); @@ -2060,3 +3139,104 @@ RPC_STATUS WINAPI RpcNetworkIsProtseqValidA(RPC_CSTR protseq) } return RPC_S_OUT_OF_MEMORY; } + +/*********************************************************************** + * RpcProtseqVectorFreeA (RPCRT4.@) + */ +RPC_STATUS WINAPI RpcProtseqVectorFreeA(RPC_PROTSEQ_VECTORA **protseqs) +{ + TRACE("(%p)\n", protseqs); + + if (*protseqs) + { + int i; + for (i = 0; i < (*protseqs)->Count; i++) + HeapFree(GetProcessHeap(), 0, (*protseqs)->Protseq[i]); + HeapFree(GetProcessHeap(), 0, *protseqs); + *protseqs = NULL; + } + return RPC_S_OK; +} + +/*********************************************************************** + * RpcProtseqVectorFreeW (RPCRT4.@) + */ +RPC_STATUS WINAPI RpcProtseqVectorFreeW(RPC_PROTSEQ_VECTORW **protseqs) +{ + TRACE("(%p)\n", protseqs); + + if (*protseqs) + { + int i; + for (i = 0; i < (*protseqs)->Count; i++) + HeapFree(GetProcessHeap(), 0, (*protseqs)->Protseq[i]); + HeapFree(GetProcessHeap(), 0, *protseqs); + *protseqs = NULL; + } + return RPC_S_OK; +} + +/*********************************************************************** + * RpcNetworkInqProtseqsW (RPCRT4.@) + */ +RPC_STATUS WINAPI RpcNetworkInqProtseqsW( RPC_PROTSEQ_VECTORW** protseqs ) +{ + RPC_PROTSEQ_VECTORW *pvector; + int i = 0; + RPC_STATUS status = RPC_S_OUT_OF_MEMORY; + + TRACE("(%p)\n", protseqs); + + *protseqs = HeapAlloc(GetProcessHeap(), 0, sizeof(RPC_PROTSEQ_VECTORW)+(sizeof(unsigned short*)*ARRAYSIZE(protseq_list))); + if (!*protseqs) + goto end; + pvector = *protseqs; + pvector->Count = 0; + for (i = 0; i < ARRAYSIZE(protseq_list); i++) + { + pvector->Protseq[i] = HeapAlloc(GetProcessHeap(), 0, (strlen(protseq_list[i].name)+1)*sizeof(unsigned short)); + if (pvector->Protseq[i] == NULL) + goto end; + MultiByteToWideChar(CP_ACP, 0, (CHAR*)protseq_list[i].name, -1, + (WCHAR*)pvector->Protseq[i], strlen(protseq_list[i].name) + 1); + pvector->Count++; + } + status = RPC_S_OK; + +end: + if (status != RPC_S_OK) + RpcProtseqVectorFreeW(protseqs); + return status; +} + +/*********************************************************************** + * RpcNetworkInqProtseqsA (RPCRT4.@) + */ +RPC_STATUS WINAPI RpcNetworkInqProtseqsA(RPC_PROTSEQ_VECTORA** protseqs) +{ + RPC_PROTSEQ_VECTORA *pvector; + int i = 0; + RPC_STATUS status = RPC_S_OUT_OF_MEMORY; + + TRACE("(%p)\n", protseqs); + + *protseqs = HeapAlloc(GetProcessHeap(), 0, sizeof(RPC_PROTSEQ_VECTORW)+(sizeof(unsigned char*)*ARRAYSIZE(protseq_list))); + if (!*protseqs) + goto end; + pvector = *protseqs; + pvector->Count = 0; + for (i = 0; i < ARRAYSIZE(protseq_list); i++) + { + pvector->Protseq[i] = HeapAlloc(GetProcessHeap(), 0, strlen(protseq_list[i].name)+1); + if (pvector->Protseq[i] == NULL) + goto end; + strcpy((char*)pvector->Protseq[i], protseq_list[i].name); + pvector->Count++; + } + status = RPC_S_OK; + +end: + if (status != RPC_S_OK) + RpcProtseqVectorFreeA(protseqs); + return status; +} diff --git a/dll/win32/rpcrt4/rpcrt4.rbuild b/dll/win32/rpcrt4/rpcrt4.rbuild index 10d83df2f6f..54841c607ef 100644 --- a/dll/win32/rpcrt4/rpcrt4.rbuild +++ b/dll/win32/rpcrt4/rpcrt4.rbuild @@ -16,6 +16,8 @@ user32 advapi32 secur32 + wininet + delayimp iphlpapi ws2_32 ntdll diff --git a/dll/win32/rpcrt4/rpcrt4.spec b/dll/win32/rpcrt4/rpcrt4.spec index 4550889f62a..62bee47089e 100644 --- a/dll/win32/rpcrt4/rpcrt4.spec +++ b/dll/win32/rpcrt4/rpcrt4.spec @@ -1,5 +1,5 @@ @ stdcall CreateProxyFromTypeInfo(ptr ptr ptr ptr ptr) -@ stub CreateStubFromTypeInfo +@ stdcall CreateStubFromTypeInfo(ptr ptr ptr ptr) @ stdcall CStdStubBuffer_AddRef(ptr) @ stdcall CStdStubBuffer_Connect(ptr ptr) @ stdcall CStdStubBuffer_CountRefs(ptr) @@ -53,7 +53,7 @@ @ stub I_RpcIfInqTransferSyntaxes @ stub I_RpcLogEvent @ stdcall I_RpcMapWin32Status(long) -@ stub I_RpcNegotiateTransferSyntax # wxp +@ stdcall I_RpcNegotiateTransferSyntax(ptr) @ stub I_RpcNsBindingSetEntryName @ stub I_RpcNsBindingSetEntryNameA @ stub I_RpcNsBindingSetEntryNameW @@ -116,8 +116,9 @@ @ stdcall NDRSContextUnmarshallEx(ptr ptr ptr) @ stub NDRcopy @ stdcall NdrAllocate(ptr long) -@ stub NdrAsyncClientCall +@ varargs NdrAsyncClientCall(ptr ptr) @ stub NdrAsyncServerCall +@ stdcall NdrAsyncStubCall(ptr ptr ptr ptr) @ stdcall NdrByteCountPointerBufferSize(ptr ptr ptr) @ stdcall NdrByteCountPointerFree(ptr ptr ptr) @ stdcall NdrByteCountPointerMarshall(ptr ptr ptr) @@ -126,7 +127,7 @@ @ stdcall NdrCStdStubBuffer_Release(ptr ptr) @ stdcall NdrClearOutParameters(ptr ptr ptr) @ varargs NdrClientCall2(ptr ptr) -@ varargs NdrClientCall(ptr ptr) NdrClientCall2 +@ varargs -arch=i386 NdrClientCall(ptr ptr) NdrClientCall2 @ stdcall NdrClientContextMarshall(ptr ptr long) @ stdcall NdrClientContextUnmarshall(ptr ptr ptr) @ stub NdrClientInitialize @@ -226,7 +227,7 @@ @ stub NdrMesTypeAlignSize @ stdcall NdrMesTypeDecode2(ptr ptr ptr ptr ptr) @ stub NdrMesTypeDecode -@ stub NdrMesTypeEncode2 +@ stdcall NdrMesTypeEncode2(ptr ptr ptr ptr ptr) @ stub NdrMesTypeEncode @ stdcall NdrMesTypeFree2(ptr ptr ptr ptr ptr) @ stdcall NdrNonConformantStringBufferSize(ptr ptr ptr) @@ -265,14 +266,14 @@ @ stdcall NdrRangeUnmarshall(ptr ptr ptr long) @ stub NdrRpcSmClientAllocate @ stub NdrRpcSmClientFree -@ stub NdrRpcSmSetClientToOsf +@ stdcall NdrRpcSmSetClientToOsf(ptr) @ stub NdrRpcSsDefaultAllocate @ stub NdrRpcSsDefaultFree @ stub NdrRpcSsDisableAllocate @ stub NdrRpcSsEnableAllocate @ stdcall NdrSendReceive(ptr ptr) @ stdcall NdrServerCall2(ptr) -@ stub NdrServerCall +@ stdcall NdrServerCall(ptr) @ stdcall NdrServerContextMarshall(ptr ptr long) @ stdcall NdrServerContextNewMarshall(ptr ptr ptr ptr) # wxp @ stdcall NdrServerContextNewUnmarshall(ptr ptr) # wxp @@ -292,7 +293,7 @@ @ stdcall NdrSimpleTypeMarshall(ptr ptr long) @ stdcall NdrSimpleTypeUnmarshall(ptr ptr long) @ stdcall NdrStubCall2(ptr ptr ptr ptr) -@ stub NdrStubCall +@ stdcall NdrStubCall(ptr ptr ptr ptr) @ stdcall NdrStubForwardingFunction(ptr ptr ptr ptr) @ stdcall NdrStubGetBuffer(ptr ptr ptr) @ stdcall NdrStubInitialize(ptr ptr ptr ptr) @@ -340,10 +341,10 @@ @ stdcall RpcBindingFree(ptr) @ stdcall RpcBindingFromStringBindingA(str ptr) @ stdcall RpcBindingFromStringBindingW(wstr ptr) -@ stub RpcBindingInqAuthClientA -@ stub RpcBindingInqAuthClientExA -@ stub RpcBindingInqAuthClientExW -@ stub RpcBindingInqAuthClientW +@ stdcall RpcBindingInqAuthClientA(ptr ptr ptr ptr ptr ptr) +@ stdcall RpcBindingInqAuthClientExA(ptr ptr ptr ptr ptr ptr long) +@ stdcall RpcBindingInqAuthClientExW(ptr ptr ptr ptr ptr ptr long) +@ stdcall RpcBindingInqAuthClientW(ptr ptr ptr ptr ptr ptr) @ stdcall RpcBindingInqAuthInfoA(ptr ptr ptr ptr ptr ptr) @ stdcall RpcBindingInqAuthInfoExA(ptr ptr ptr ptr ptr ptr long ptr) @ stdcall RpcBindingInqAuthInfoExW(ptr ptr ptr ptr ptr ptr long ptr) @@ -370,7 +371,7 @@ @ stdcall RpcEpRegisterA(ptr ptr ptr str) @ stub RpcEpRegisterNoReplaceA @ stub RpcEpRegisterNoReplaceW -@ stub RpcEpRegisterW +@ stdcall RpcEpRegisterW(ptr ptr ptr wstr) @ stdcall RpcEpResolveBinding(ptr ptr) @ stdcall RpcEpUnregister(ptr ptr ptr) @ stub RpcErrorAddRecord # wxp @@ -401,15 +402,15 @@ @ stub RpcMgmtInqServerPrincNameW @ stdcall RpcMgmtInqStats(ptr ptr) @ stdcall RpcMgmtIsServerListening(ptr) -@ stub RpcMgmtSetAuthorizationFn +@ stdcall RpcMgmtSetAuthorizationFn(ptr) @ stdcall RpcMgmtSetCancelTimeout(long) @ stdcall RpcMgmtSetComTimeout(ptr long) @ stdcall RpcMgmtSetServerStackSize(long) @ stdcall RpcMgmtStatsVectorFree(ptr) @ stdcall RpcMgmtStopServerListening(ptr) @ stdcall RpcMgmtWaitServerListen() -@ stub RpcNetworkInqProtseqsA -@ stub RpcNetworkInqProtseqsW +@ stdcall RpcNetworkInqProtseqsA(ptr) +@ stdcall RpcNetworkInqProtseqsW(ptr) @ stdcall RpcNetworkIsProtseqValidA(ptr) @ stdcall RpcNetworkIsProtseqValidW(ptr) @ stub RpcNsBindingInqEntryNameA @@ -417,8 +418,8 @@ @ stub RpcObjectInqType @ stub RpcObjectSetInqFn @ stdcall RpcObjectSetType(ptr ptr) -@ stub RpcProtseqVectorFreeA -@ stub RpcProtseqVectorFreeW +@ stdcall RpcProtseqVectorFreeA(ptr) +@ stdcall RpcProtseqVectorFreeW(ptr) @ stdcall RpcRaiseException(long) @ stub RpcRegisterAsyncInfo @ stdcall RpcRevertToSelf() diff --git a/dll/win32/rpcrt4/rpcrt4_main.c b/dll/win32/rpcrt4/rpcrt4_main.c index 537a00537bc..2d7a754d626 100644 --- a/dll/win32/rpcrt4/rpcrt4_main.c +++ b/dll/win32/rpcrt4/rpcrt4_main.c @@ -43,6 +43,7 @@ #include "winuser.h" #include "winnt.h" #include "winternl.h" +#include "ntsecapi.h" #include "iptypes.h" #include "iphlpapi.h" #include "wine/unicode.h" @@ -53,6 +54,7 @@ #include "rpcproxy.h" #include "rpc_binding.h" +#include "rpc_server.h" #include "wine/debug.h" @@ -135,6 +137,8 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) break; case DLL_PROCESS_DETACH: + RPCRT4_destroy_all_protseqs(); + RPCRT4_ServerFreeAllRegisteredAuthInfo(); break; } @@ -280,6 +284,38 @@ RPC_STATUS WINAPI UuidCreateNil(UUID *Uuid) return RPC_S_OK; } +/************************************************************************* + * UuidCreate [RPCRT4.@] + * + * Creates a 128bit UUID. + * + * RETURNS + * + * RPC_S_OK if successful. + * RPC_S_UUID_LOCAL_ONLY if UUID is only locally unique. + * + * NOTES + * + * Follows RFC 4122, section 4.4 (Algorithms for Creating a UUID from + * Truly Random or Pseudo-Random Numbers) + */ +RPC_STATUS WINAPI UuidCreate(UUID *Uuid) +{ + RtlGenRandom(Uuid, sizeof(*Uuid)); + /* Clear the version bits and set the version (4) */ + Uuid->Data3 &= 0x0fff; + Uuid->Data3 |= (4 << 12); + /* Set the topmost bits of Data4 (clock_seq_hi_and_reserved) as + * specified in RFC 4122, section 4.4. + */ + Uuid->Data4[0] &= 0x3f; + Uuid->Data4[0] |= 0x80; + + TRACE("%s\n", debugstr_guid(Uuid)); + + return RPC_S_OK; +} + /* Number of 100ns ticks per clock tick. To be safe, assume that the clock resolution is at least 1000 * 100 * (1/1000000) = 1/10 of a second */ #define TICKS_PER_CLOCK_TICK 1000 @@ -299,7 +335,7 @@ static void RPC_UuidGetSystemTime(ULONGLONG *time) *time += TICKS_15_OCT_1582_TO_1601; } -/* Assume that a hardware address is at least 6 bytes long */ +/* Assume that a hardware address is at least 6 bytes long */ #define ADDRESS_BYTES_NEEDED 6 static RPC_STATUS RPC_UuidGetNodeAddress(BYTE *address) @@ -323,10 +359,7 @@ static RPC_STATUS RPC_UuidGetNodeAddress(BYTE *address) /* We can't get a hardware address, just use random numbers. Set the multicast bit to prevent conflicts with real cards. */ else { - for (i = 0; i < ADDRESS_BYTES_NEEDED; i++) { - address[i] = rand() & 0xff; - } - + RtlGenRandom(address, ADDRESS_BYTES_NEEDED); address[0] |= 0x01; status = RPC_S_UUID_LOCAL_ONLY; } @@ -336,7 +369,7 @@ static RPC_STATUS RPC_UuidGetNodeAddress(BYTE *address) } /************************************************************************* - * UuidCreate [RPCRT4.@] + * UuidCreateSequential [RPCRT4.@] * * Creates a 128bit UUID. * @@ -346,12 +379,12 @@ static RPC_STATUS RPC_UuidGetNodeAddress(BYTE *address) * RPC_S_UUID_LOCAL_ONLY if UUID is only locally unique. * * FIXME: No compensation for changes across reloading - * this dll or across reboots (e.g. clock going + * this dll or across reboots (e.g. clock going * backwards and swapped network cards). The RFC - * suggests using NVRAM for storing persistent + * suggests using NVRAM for storing persistent * values. */ -RPC_STATUS WINAPI UuidCreate(UUID *Uuid) +RPC_STATUS WINAPI UuidCreateSequential(UUID *Uuid) { static int initialised, count; @@ -399,7 +432,7 @@ RPC_STATUS WINAPI UuidCreate(UUID *Uuid) /* Pack the information into the UUID structure. */ - Uuid->Data1 = (unsigned long)(time & 0xffffffff); + Uuid->Data1 = (ULONG)(time & 0xffffffff); Uuid->Data2 = (unsigned short)((time >> 32) & 0xffff); Uuid->Data3 = (unsigned short)((time >> 48) & 0x0fff); @@ -409,13 +442,7 @@ RPC_STATUS WINAPI UuidCreate(UUID *Uuid) Uuid->Data4[0] = sequence & 0xff; Uuid->Data4[1] = (sequence & 0x3f00) >> 8; Uuid->Data4[1] |= 0x80; - - Uuid->Data4[2] = address[0]; - Uuid->Data4[3] = address[1]; - Uuid->Data4[4] = address[2]; - Uuid->Data4[5] = address[3]; - Uuid->Data4[6] = address[4]; - Uuid->Data4[7] = address[5]; + memcpy(&Uuid->Data4[2], address, ADDRESS_BYTES_NEEDED); LeaveCriticalSection(&uuid_cs); @@ -424,22 +451,6 @@ RPC_STATUS WINAPI UuidCreate(UUID *Uuid) return status; } -/************************************************************************* - * UuidCreateSequential [RPCRT4.@] - * - * Creates a 128bit UUID. - * - * RETURNS - * - * RPC_S_OK if successful. - * RPC_S_UUID_LOCAL_ONLY if UUID is only locally unique. - * - */ -RPC_STATUS WINAPI UuidCreateSequential(UUID *Uuid) -{ - return UuidCreate(Uuid); -} - /************************************************************************* * UuidHash [RPCRT4.@] diff --git a/dll/win32/rpcrt4/version.rc b/dll/win32/rpcrt4/version.rc new file mode 100644 index 00000000000..f0422acd1e3 --- /dev/null +++ b/dll/win32/rpcrt4/version.rc @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2007 Alexandre Julliard + * + * 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 + */ + +#define WINE_FILEDESCRIPTION_STR "Wine rpcrt4" +#define WINE_FILENAME_STR "rpcrt4.dll" +#define WINE_FILEVERSION 5,1,2600,2180 +#define WINE_FILEVERSION_STR "5.1.2600.2180" +#define WINE_PRODUCTVERSION 5,1,2600,2180 +#define WINE_PRODUCTVERSION_STR "5.1.2600.2180" + +#include "wine/wine_common_ver.rc" diff --git a/dll/win32/rsaenh/CMakeLists.txt b/dll/win32/rsaenh/CMakeLists.txt index 50904526195..1fea4c9d719 100644 --- a/dll/win32/rsaenh/CMakeLists.txt +++ b/dll/win32/rsaenh/CMakeLists.txt @@ -1,8 +1,5 @@ -add_definitions( - -D__WINESRC__ - -D_DLL -D__USE_CRTIMP) - +add_definitions(-D__WINESRC__) include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine) spec2def(rsaenh.dll rsaenh.spec) @@ -27,5 +24,6 @@ add_library(rsaenh SHARED ${SOURCE}) set_module_type(rsaenh win32dll) target_link_libraries(rsaenh wine) add_importlibs(rsaenh msvcrt crypt32 advapi32 kernel32 ntdll) +add_pch(rsaenh tomcrypt.h) add_importlib_target(rsaenh.spec) add_cd_file(TARGET rsaenh DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/rsaenh/rsaenh.rbuild b/dll/win32/rsaenh/rsaenh.rbuild index 49973032b7e..4c909f3254d 100644 --- a/dll/win32/rsaenh/rsaenh.rbuild +++ b/dll/win32/rsaenh/rsaenh.rbuild @@ -19,6 +19,7 @@ rsaenh.c sha2.c version.rc + tomcrypt.h wine crypt32 advapi32 diff --git a/dll/win32/rsaenh/rsaenh.spec b/dll/win32/rsaenh/rsaenh.spec index e3ceb02bc0d..becbbd4058f 100644 --- a/dll/win32/rsaenh/rsaenh.spec +++ b/dll/win32/rsaenh/rsaenh.spec @@ -23,5 +23,5 @@ @ stdcall CPSetProvParam(long long ptr long) RSAENH_CPSetProvParam @ stdcall CPSignHash(long long long wstr long ptr ptr) RSAENH_CPSignHash @ stdcall CPVerifySignature(long long ptr long long wstr long) RSAENH_CPVerifySignature -@ stdcall -private DllRegisterServer() -@ stdcall -private DllUnregisterServer() +@ stdcall DllRegisterServer() +@ stdcall DllUnregisterServer() diff --git a/dll/win32/samlib/CMakeLists.txt b/dll/win32/samlib/CMakeLists.txt index 5b2754ad93e..b26706182cd 100644 --- a/dll/win32/samlib/CMakeLists.txt +++ b/dll/win32/samlib/CMakeLists.txt @@ -13,10 +13,8 @@ list(APPEND SOURCE ${CMAKE_CURRENT_BINARY_DIR}/samlib.def) add_library(samlib SHARED ${SOURCE}) - set_module_type(samlib win32dll) - add_importlibs(samlib advapi32 msvcrt kernel32 ntdll) - +add_pch(samlib precomp.h) add_cd_file(TARGET samlib DESTINATION reactos/system32 FOR all) add_importlib_target(samlib.spec) diff --git a/dll/win32/samlib/dllmain.c b/dll/win32/samlib/dllmain.c index 4614e683087..27f247121be 100644 --- a/dll/win32/samlib/dllmain.c +++ b/dll/win32/samlib/dllmain.c @@ -27,13 +27,7 @@ /* INCLUDES *****************************************************************/ -#include -#include - -#include -#include - -#include "debug.h" +#include "precomp.h" //#define LOG_DEBUG_MESSAGES diff --git a/dll/win32/samlib/precomp.h b/dll/win32/samlib/precomp.h new file mode 100644 index 00000000000..15bfac7d1c7 --- /dev/null +++ b/dll/win32/samlib/precomp.h @@ -0,0 +1,10 @@ +#include +#include + +#define WIN32_NO_STATUS +#include +#include +#define NTOS_MODE_USER +#include + +#include "debug.h" diff --git a/dll/win32/samlib/samlib.c b/dll/win32/samlib/samlib.c index 32f0c036364..9a50c728bbb 100644 --- a/dll/win32/samlib/samlib.c +++ b/dll/win32/samlib/samlib.c @@ -26,14 +26,9 @@ */ /* INCLUDES *****************************************************************/ -#define WIN32_NO_STATUS -#include -#include -#define NTOS_MODE_USER -#include #define NDEBUG -#include "debug.h" +#include "precomp.h" /* GLOBALS *******************************************************************/ diff --git a/dll/win32/samlib/samlib.rbuild b/dll/win32/samlib/samlib.rbuild index 3771b94afa8..ef18092c2ba 100644 --- a/dll/win32/samlib/samlib.rbuild +++ b/dll/win32/samlib/samlib.rbuild @@ -6,4 +6,5 @@ dllmain.c samlib.c samlib.rc + precomp.h diff --git a/dll/win32/samsrv/samsrv.c b/dll/win32/samsrv/samsrv.c index f87e6e69a74..c3418fce387 100644 --- a/dll/win32/samsrv/samsrv.c +++ b/dll/win32/samsrv/samsrv.c @@ -22,7 +22,7 @@ #define WIN32_NO_STATUS #include #define NTOS_MODE_USER -#include +#include //#include diff --git a/dll/win32/secur32/CMakeLists.txt b/dll/win32/secur32/CMakeLists.txt index 04ca218a1c6..a460f046863 100644 --- a/dll/win32/secur32/CMakeLists.txt +++ b/dll/win32/secur32/CMakeLists.txt @@ -14,16 +14,14 @@ list(APPEND SOURCE ${CMAKE_CURRENT_BINARY_DIR}/secur32.def ) -add_library(secur32 SHARED - ${CMAKE_CURRENT_BINARY_DIR}/secur32_precomp.h.gch - ${SOURCE}) +add_library(secur32 SHARED ${SOURCE}) set_module_type(secur32 win32dll) target_link_libraries(secur32 lsalib) add_importlibs(secur32 advapi32 msvcrt kernel32 ntdll) -add_pch(secur32 ${CMAKE_CURRENT_SOURCE_DIR}/precomp.h ${SOURCE}) +add_pch(secur32 precomp.h) add_cd_file(TARGET secur32 DESTINATION reactos/system32 FOR all) add_importlib_target(secur32.spec) diff --git a/dll/win32/secur32/precomp.h b/dll/win32/secur32/precomp.h index 08cf17c4b7c..b28355c09e2 100644 --- a/dll/win32/secur32/precomp.h +++ b/dll/win32/secur32/precomp.h @@ -12,7 +12,7 @@ #define WIN32_NO_STATUS #include #define NTOS_MODE_USER -#include +#include #include #include diff --git a/dll/win32/secur32/stubs.c b/dll/win32/secur32/stubs.c index e7003bc7eed..a864105de12 100644 --- a/dll/win32/secur32/stubs.c +++ b/dll/win32/secur32/stubs.c @@ -1,14 +1,11 @@ - -#include +#include #define NDEBUG #include #define SEC_ENTRY WINAPI -#define STATUS_UNSUCCESSFUL ((SECURITY_STATUS)0x80000001) -typedef LONG SECURITY_STATUS; typedef PVOID PSECURITY_PACKAGE_OPTIONS, PSecurityUserData; SECURITY_STATUS diff --git a/dll/win32/serialui/lang/pl-PL.rc b/dll/win32/serialui/lang/pl-PL.rc index 7962c89d09a..25674707a02 100644 --- a/dll/win32/serialui/lang/pl-PL.rc +++ b/dll/win32/serialui/lang/pl-PL.rc @@ -1,8 +1,10 @@ -/** -* translated by Caemyr - Olaf Siejka -* caemyr@gmail.com -* https://sourceforge.net/projects/reactospl -*/ +/* + * translated by Caemyr - Olaf Siejka + * Use ReactOS forum PM or IRC to contact me + * http://www.reactos.org + * IRC: irc.freenode.net #reactos-pl; + * UTF-8 conversion by Caemyr (May, 2011) + */ LANGUAGE LANG_POLISH, SUBLANG_DEFAULT @@ -22,7 +24,7 @@ BEGIN IDS_FC_CTSRTS, "CTS/RTS" IDS_FC_XONXOFF, "XON/XOFF" - IDS_TITLE, "Waciwoci dla: %s" + IDS_TITLE, "Właściwości dla: %s" END IDD_COMMDLG DIALOGEX 6,5,222,175 @@ -33,15 +35,14 @@ BEGIN CONTROL "",IDC_GRP1,"Button",0x50000007,6,5,210,146,0x00000000 CONTROL "Tak",IDC_OKBTN,"Button",0x50010000,98,156,56,13,0x00000000 CONTROL "Anuluj",IDC_CANCELBTN,"Button",0x50010000,158,156,56,13,0x00000000 - CONTROL "Prdko w bodach:",IDC_STC1,"Static",0x50000000,24,31,42,9,0x00000000 + CONTROL "Prędkość w bodach:",IDC_STC1,"Static",0x50000000,24,31,42,9,0x00000000 CONTROL "Bity danych:",IDC_STC2,"Static",0x50000000,24,53,42,9,0x00000000 - CONTROL "Kontrola parzystoci:",IDC_STC3,"Static",0x50000000,24,73,42,9,0x00000000 - CONTROL "Ilo bitw stopu:",IDC_STC4,"Static",0x50000000,24,96,42,9,0x00000000 - CONTROL "Kontrola przepywu:",IDC_STC5,"Static",0x50000000,24,120,42,9,0x00000000 + CONTROL "Kontrola parzystości:",IDC_STC3,"Static",0x50000000,24,73,42,9,0x00000000 + CONTROL "Ilość bitów stopu:",IDC_STC4,"Static",0x50000000,24,96,42,9,0x00000000 + CONTROL "Kontrola przepływu:",IDC_STC5,"Static",0x50000000,24,120,42,9,0x00000000 CONTROL "",IDC_BAUDRATE,"ComboBox",0x50210003,98,29,100,50,0x00000000 CONTROL "",IDC_BYTESIZE,"ComboBox",0x50210003,98,49,100,50,0x00000000 CONTROL "",IDC_PARITY,"ComboBox",0x50210003,98,72,100,50,0x00000000 CONTROL "",IDC_STOPBITS,"ComboBox",0x50210003,98,94,100,50,0x00000000 CONTROL "",IDC_FLOW,"ComboBox",0x50210003,98,116,100,50,0x00000000 END - diff --git a/dll/win32/serialui/lang/ru-RU.rc b/dll/win32/serialui/lang/ru-RU.rc index ace7b3db8e8..5be3eedfd18 100644 --- a/dll/win32/serialui/lang/ru-RU.rc +++ b/dll/win32/serialui/lang/ru-RU.rc @@ -2,21 +2,21 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT STRINGTABLE LOADONCALL DISCARDABLE BEGIN - IDS_EVENPARITY, "" - IDS_MARKPARITY, " (1)" + IDS_EVENPARITY, "Чет" + IDS_MARKPARITY, "Маркер (1)" IDS_NOPARITY, "No parity" - IDS_ODDPARITY, "" - IDS_SPACEPARITY, " (0)" + IDS_ODDPARITY, "Нечет" + IDS_SPACEPARITY, "Пробел (0)" IDS_ONESTOPBIT, "1 stop bit" IDS_ONE5STOPBITS, "1.5 stop bits" IDS_TWOSTOPBITS, "2 stop bits" - IDS_FC_NO, "" + IDS_FC_NO, "Нет" IDS_FC_CTSRTS, "CTS/RTS" IDS_FC_XONXOFF, "XON/XOFF" - IDS_TITLE, ": %s" + IDS_TITLE, "Свойства: %s" END IDD_COMMDLG DIALOGEX 6,5,222,175 @@ -26,12 +26,12 @@ EXSTYLE 0x00000001 BEGIN CONTROL "",IDC_GRP1,"Button",0x50000007,6,5,210,146,0x00000000 CONTROL "OK",IDC_OKBTN,"Button",0x50010000,98,156,56,14,0x00000000 - CONTROL "",IDC_CANCELBTN,"Button",0x50010000,158,156,56,14,0x00000000 - CONTROL "& (/):",IDC_STC1,"Static",0x50000000,16,31,80,9,0x00000000 - CONTROL "& :",IDC_STC2,"Static",0x50000000,16,53,80,9,0x00000000 - CONTROL "&:",IDC_STC3,"Static",0x50000000,16,73,80,9,0x00000000 - CONTROL "& :",IDC_STC4,"Static",0x50000000,16,96,80,9,0x00000000 - CONTROL "& :",IDC_STC5,"Static",0x50000000,16,120,80,9,0x00000000 + CONTROL "Отмена",IDC_CANCELBTN,"Button",0x50010000,158,156,56,14,0x00000000 + CONTROL "&Скорость (бит/с):",IDC_STC1,"Static",0x50000000,16,31,80,9,0x00000000 + CONTROL "&Биты данных:",IDC_STC2,"Static",0x50000000,16,53,80,9,0x00000000 + CONTROL "&Четность:",IDC_STC3,"Static",0x50000000,16,73,80,9,0x00000000 + CONTROL "С&топовые биты:",IDC_STC4,"Static",0x50000000,16,96,80,9,0x00000000 + CONTROL "&Управление потоком:",IDC_STC5,"Static",0x50000000,16,120,80,9,0x00000000 CONTROL "",IDC_BAUDRATE,"ComboBox",0x50210003,98,29,100,50,0x00000000 CONTROL "",IDC_BYTESIZE,"ComboBox",0x50210003,98,49,100,50,0x00000000 CONTROL "",IDC_PARITY,"ComboBox",0x50210003,98,72,100,50,0x00000000 diff --git a/dll/win32/serialui/lang/uk-UA.rc b/dll/win32/serialui/lang/uk-UA.rc index 3ee6f0904e0..b1048a95012 100644 --- a/dll/win32/serialui/lang/uk-UA.rc +++ b/dll/win32/serialui/lang/uk-UA.rc @@ -10,21 +10,21 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT STRINGTABLE LOADONCALL DISCARDABLE BEGIN - IDS_EVENPARITY, "" - IDS_MARKPARITY, "" - IDS_NOPARITY, " " - IDS_ODDPARITY, "" - IDS_SPACEPARITY, "" + IDS_EVENPARITY, "Парна" + IDS_MARKPARITY, "Маркер" + IDS_NOPARITY, "Без перевірки" + IDS_ODDPARITY, "Непарна" + IDS_SPACEPARITY, "Пробіл" - IDS_ONESTOPBIT, "1 " - IDS_ONE5STOPBITS, "1,5 " - IDS_TWOSTOPBITS, "2 " + IDS_ONESTOPBIT, "1 стоповий біт" + IDS_ONE5STOPBITS, "1,5 стопових біта" + IDS_TWOSTOPBITS, "2 стопових біта" - IDS_FC_NO, "" - IDS_FC_CTSRTS, " (CTS/RTS)" + IDS_FC_NO, "Немає" + IDS_FC_CTSRTS, "Апаратне (CTS/RTS)" IDS_FC_XONXOFF, "XON/XOFF" - IDS_TITLE, ": %s" + IDS_TITLE, "Властивості: %s" END IDD_COMMDLG DIALOGEX 6,5,222,175 @@ -34,12 +34,12 @@ EXSTYLE 0x00000001 BEGIN CONTROL "",IDC_GRP1,"Button",0x50000007,6,5,210,146,0x00000000 CONTROL "OK",IDC_OKBTN,"Button",0x50010000,98,156,56,13,0x00000000 - CONTROL "",IDC_CANCELBTN,"Button",0x50010000,158,156,56,13,0x00000000 - CONTROL " (/):",IDC_STC1,"Static",0x50000000,24,31,42,9,0x00000000 - CONTROL " :",IDC_STC2,"Static",0x50000000,24,53,42,9,0x00000000 - CONTROL ":",IDC_STC3,"Static",0x50000000,24,73,42,9,0x00000000 - CONTROL " :",IDC_STC4,"Static",0x50000000,24,96,42,9,0x00000000 - CONTROL " :",IDC_STC5,"Static",0x50000000,24,120,42,9,0x00000000 + CONTROL "Скасувати",IDC_CANCELBTN,"Button",0x50010000,158,156,56,13,0x00000000 + CONTROL "Швидкість (біт/с):",IDC_STC1,"Static",0x50000000,24,31,42,9,0x00000000 + CONTROL "Біти даних:",IDC_STC2,"Static",0x50000000,24,53,42,9,0x00000000 + CONTROL "Парність:",IDC_STC3,"Static",0x50000000,24,73,42,9,0x00000000 + CONTROL "Стопові біти:",IDC_STC4,"Static",0x50000000,24,96,42,9,0x00000000 + CONTROL "Керування потоком:",IDC_STC5,"Static",0x50000000,24,120,42,9,0x00000000 CONTROL "",IDC_BAUDRATE,"ComboBox",0x50210003,98,29,100,50,0x00000000 CONTROL "",IDC_BYTESIZE,"ComboBox",0x50210003,98,49,100,50,0x00000000 CONTROL "",IDC_PARITY,"ComboBox",0x50210003,98,72,100,50,0x00000000 diff --git a/dll/win32/serialui/serialui.rc b/dll/win32/serialui/serialui.rc index b015c0af101..da29ed52b85 100644 --- a/dll/win32/serialui/serialui.rc +++ b/dll/win32/serialui/serialui.rc @@ -18,6 +18,9 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL #include "lang/id-ID.rc" #include "lang/it-IT.rc" #include "lang/no-NO.rc" + +// UTF-8 +#pragma code_page(65001) #include "lang/pl-PL.rc" #include "lang/ru-RU.rc" #include "lang/uk-UA.rc" diff --git a/dll/win32/setupapi/CMakeLists.txt b/dll/win32/setupapi/CMakeLists.txt index 0858278e369..cb2b6113860 100644 --- a/dll/win32/setupapi/CMakeLists.txt +++ b/dll/win32/setupapi/CMakeLists.txt @@ -1,18 +1,20 @@ -set_unicode() - +include_directories( + ${REACTOS_SOURCE_DIR}/include/reactos/wine + ${REACTOS_SOURCE_DIR}/include/reactos/idl + ${CMAKE_CURRENT_BINARY_DIR}) + add_definitions( - -D_DLL - -D__USE_CRTIMP -D_SETUPAPI_ -D_CFGMGR32_ -Dwcsnicmp=_wcsnicmp) -include_directories( - ${REACTOS_SOURCE_DIR}/include/reactos/wine - ${REACTOS_BINARY_DIR}/include/reactos/idl) +add_rpc_files(client ${REACTOS_SOURCE_DIR}/include/reactos/idl/pnp.idl) + +set_unicode() set_rc_compiler() + spec2def(setupapi.dll setupapi.spec) list(APPEND SOURCE @@ -34,14 +36,14 @@ list(APPEND SOURCE rpc.c setupapi.rc ${CMAKE_CURRENT_BINARY_DIR}/setupapi_stubs.c - ${CMAKE_CURRENT_BINARY_DIR}/setupapi.def) + ${CMAKE_CURRENT_BINARY_DIR}/setupapi.def + ${CMAKE_CURRENT_BINARY_DIR}/pnp_c.c) add_library(setupapi SHARED ${SOURCE}) set_module_type(setupapi win32dll) target_link_libraries(setupapi - pnprpc uuid wine ${PSEH_LIB}) @@ -58,6 +60,6 @@ add_importlibs(setupapi kernel32 ntdll) - +add_pch(setupapi setupapi_private.h) add_cd_file(TARGET setupapi DESTINATION reactos/system32 FOR all) add_importlib_target(setupapi.spec) diff --git a/dll/win32/setupapi/cfgmgr.c b/dll/win32/setupapi/cfgmgr.c index 212fa3d7964..482d711458e 100644 --- a/dll/win32/setupapi/cfgmgr.c +++ b/dll/win32/setupapi/cfgmgr.c @@ -5000,6 +5000,32 @@ CONFIGRET WINAPI CM_Run_Detection_Ex( } +/*********************************************************************** + * CM_Set_Class_Registry_PropertyA [SETUPAPI.@] + */ +CONFIGRET WINAPI CM_Set_Class_Registry_PropertyA( + LPGUID ClassGuid, ULONG ulProperty, PCVOID Buffer, ULONG ulLength, + ULONG ulFlags, HMACHINE hMachine) +{ + FIXME("%p %lx %p %lu %lx %p\n", + ClassGuid, ulProperty, Buffer, ulLength, ulFlags, hMachine); + return CR_CALL_NOT_IMPLEMENTED; +} + + +/*********************************************************************** + * CM_Set_Class_Registry_PropertyW [SETUPAPI.@] + */ +CONFIGRET WINAPI CM_Set_Class_Registry_PropertyW( + LPGUID ClassGuid, ULONG ulProperty, PCVOID Buffer, ULONG ulLength, + ULONG ulFlags, HMACHINE hMachine) +{ + FIXME("%p %lx %p %lu %lx %p\n", + ClassGuid, ulProperty, Buffer, ulLength, ulFlags, hMachine); + return CR_CALL_NOT_IMPLEMENTED; +} + + /*********************************************************************** * CM_Set_DevNode_Problem [SETUPAPI.@] */ @@ -5180,6 +5206,30 @@ CONFIGRET WINAPI CM_Set_DevNode_Registry_Property_ExA( ulType = REG_MULTI_SZ; break; + case CM_DRP_SECURITY: + ulType = REG_BINARY; + break; + + case CM_DRP_DEVTYPE: + ulType = REG_DWORD; + break; + + case CM_DRP_EXCLUSIVE: + ulType = REG_DWORD; + break; + + case CM_DRP_CHARACTERISTICS: + ulType = REG_DWORD; + break; + + case CM_DRP_UI_NUMBER_DESC_FORMAT: + ulType = REG_SZ; + break; + + case CM_DRP_REMOVAL_POLICY_OVERRIDE: + ulType = REG_DWORD; + break; + default: return CR_INVALID_PROPERTY; } @@ -5332,6 +5382,30 @@ CONFIGRET WINAPI CM_Set_DevNode_Registry_Property_ExW( ulType = REG_MULTI_SZ; break; + case CM_DRP_SECURITY: + ulType = REG_BINARY; + break; + + case CM_DRP_DEVTYPE: + ulType = REG_DWORD; + break; + + case CM_DRP_EXCLUSIVE: + ulType = REG_DWORD; + break; + + case CM_DRP_CHARACTERISTICS: + ulType = REG_DWORD; + break; + + case CM_DRP_UI_NUMBER_DESC_FORMAT: + ulType = REG_SZ; + break; + + case CM_DRP_REMOVAL_POLICY_OVERRIDE: + ulType = REG_DWORD; + break; + default: return CR_INVALID_PROPERTY; } diff --git a/dll/win32/setupapi/devclass.c b/dll/win32/setupapi/devclass.c index 61a9be49276..f694e4d6e73 100644 --- a/dll/win32/setupapi/devclass.c +++ b/dll/win32/setupapi/devclass.c @@ -1135,9 +1135,10 @@ SetupDiGetClassDevPropertySheetsA( struct ClassDevPropertySheetsData { - HPROPSHEETPAGE *PropertySheetPages; - DWORD MaximumNumberOfPages; + LPPROPSHEETHEADERW PropertySheetHeader; + DWORD PropertySheetHeaderPageListSize; DWORD NumberOfPages; + BOOL DontCancel; }; static BOOL WINAPI @@ -1149,14 +1150,16 @@ SETUP_GetClassDevPropertySheetsCallback( PropPageData = (struct ClassDevPropertySheetsData *)lParam; - if (PropPageData->NumberOfPages < PropPageData->MaximumNumberOfPages) + PropPageData->NumberOfPages++; + + if (PropPageData->PropertySheetHeader->nPages < PropPageData->PropertySheetHeaderPageListSize) { - *PropPageData->PropertySheetPages = hPropSheetPage; - PropPageData->PropertySheetPages++; + PropPageData->PropertySheetHeader->phpage[PropPageData->PropertySheetHeader->nPages] = hPropSheetPage; + PropPageData->PropertySheetHeader->nPages++; + return TRUE; } - PropPageData->NumberOfPages++; - return TRUE; + return PropPageData->DontCancel; } /*********************************************************************** @@ -1208,6 +1211,7 @@ SetupDiGetClassDevPropertySheetsW( PROPERTY_PAGE_PROVIDER pPropPageProvider = NULL; struct ClassDevPropertySheetsData PropPageData; DWORD dwLength, dwRegType; + DWORD InitialNumberOfPages; DWORD rc; if (DeviceInfoData) @@ -1256,27 +1260,29 @@ SetupDiGetClassDevPropertySheetsW( goto cleanup; } + InitialNumberOfPages = PropertySheetHeader->nPages; + Request.cbSize = sizeof(SP_PROPSHEETPAGE_REQUEST); Request.PageRequested = SPPSR_ENUM_ADV_DEVICE_PROPERTIES; Request.DeviceInfoSet = DeviceInfoSet; Request.DeviceInfoData = DeviceInfoData; - PropPageData.PropertySheetPages = &PropertySheetHeader->phpage[PropertySheetHeader->nPages]; - PropPageData.MaximumNumberOfPages = PropertySheetHeaderPageListSize - PropertySheetHeader->nPages; + + PropPageData.PropertySheetHeader = PropertySheetHeader; + PropPageData.PropertySheetHeaderPageListSize = PropertySheetHeaderPageListSize; PropPageData.NumberOfPages = 0; - ret = pPropPageProvider(&Request, SETUP_GetClassDevPropertySheetsCallback, (LPARAM)&PropPageData); - if (!ret) - goto cleanup; + PropPageData.DontCancel = (RequiredSize != NULL) ? TRUE : FALSE; + + pPropPageProvider(&Request, SETUP_GetClassDevPropertySheetsCallback, (LPARAM)&PropPageData); if (RequiredSize) - *RequiredSize = PropPageData.NumberOfPages + PropertySheetHeader->nPages; - if (PropPageData.NumberOfPages <= PropPageData.MaximumNumberOfPages) + *RequiredSize = PropPageData.NumberOfPages; + + if (InitialNumberOfPages + PropPageData.NumberOfPages <= PropertySheetHeaderPageListSize) { - PropertySheetHeader->nPages += PropPageData.NumberOfPages; ret = TRUE; } else { - PropertySheetHeader->nPages += PropPageData.MaximumNumberOfPages; SetLastError(ERROR_INSUFFICIENT_BUFFER); } diff --git a/dll/win32/setupapi/devinst.c b/dll/win32/setupapi/devinst.c index 53f472c2b36..f2c86d20dfd 100644 --- a/dll/win32/setupapi/devinst.c +++ b/dll/win32/setupapi/devinst.c @@ -1288,7 +1288,10 @@ SetupDiCreateDeviceInfoListExW(const GUID *ClassGuid, SetLastError(ERROR_INVALID_MACHINENAME); goto cleanup; } - size += (len + 3) * sizeof(WCHAR); + if(len > 0) + size += (len + 3) * sizeof(WCHAR); + else + MachineName = NULL; } if (Reserved != NULL) @@ -3022,13 +3025,19 @@ BOOL WINAPI SetupDiGetDeviceInterfaceDetailA( SetLastError(ERROR_INVALID_PARAMETER); return FALSE; } - if (DeviceInterfaceDetailData && (DeviceInterfaceDetailData->cbSize < - FIELD_OFFSET(SP_DEVICE_INTERFACE_DETAIL_DATA_A, DevicePath) + 1 || - DeviceInterfaceDetailData->cbSize > sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_A))) + if (DeviceInterfaceDetailData && (DeviceInterfaceDetailData->cbSize != sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_A))) { SetLastError(ERROR_INVALID_USER_BUFFER); return FALSE; } + + if((DeviceInterfaceDetailDataSize != 0) && + (DeviceInterfaceDetailDataSize < (FIELD_OFFSET(SP_DEVICE_INTERFACE_DETAIL_DATA_A, DevicePath) + sizeof(CHAR)))) + { + SetLastError(ERROR_INVALID_USER_BUFFER); + return FALSE; + } + if (!DeviceInterfaceDetailData && DeviceInterfaceDetailDataSize) { SetLastError(ERROR_INVALID_USER_BUFFER); @@ -3045,10 +3054,10 @@ BOOL WINAPI SetupDiGetDeviceInterfaceDetailA( { SetLastError(ERROR_NOT_ENOUGH_MEMORY); } + DeviceInterfaceDetailDataW->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_W); } if (!DeviceInterfaceDetailData || (DeviceInterfaceDetailData && DeviceInterfaceDetailDataW)) { - DeviceInterfaceDetailDataW->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA_W); ret = SetupDiGetDeviceInterfaceDetailW( DeviceInfoSet, DeviceInterfaceData, @@ -3060,7 +3069,7 @@ BOOL WINAPI SetupDiGetDeviceInterfaceDetailA( + FIELD_OFFSET(SP_DEVICE_INTERFACE_DETAIL_DATA_A, DevicePath); if (RequiredSize) *RequiredSize = bytesNeeded; - if (ret && DeviceInterfaceDetailData && DeviceInterfaceDetailDataSize <= bytesNeeded) + if (ret && DeviceInterfaceDetailData && DeviceInterfaceDetailDataSize >= bytesNeeded) { if (!WideCharToMultiByte( CP_ACP, 0, @@ -3123,7 +3132,8 @@ BOOL WINAPI SetupDiGetDeviceInterfaceDetailW( SetLastError(ERROR_INVALID_PARAMETER); return FALSE; } - if (DeviceInterfaceDetailData != NULL && DeviceInterfaceDetailDataSize < FIELD_OFFSET(SP_DEVICE_INTERFACE_DETAIL_DATA_W, DevicePath) + sizeof(WCHAR)) + if ((DeviceInterfaceDetailData != NULL) + && (DeviceInterfaceDetailDataSize < (FIELD_OFFSET(SP_DEVICE_INTERFACE_DETAIL_DATA_W, DevicePath)) + sizeof(WCHAR))) { SetLastError(ERROR_INVALID_PARAMETER); return FALSE; diff --git a/dll/win32/setupapi/driver.c b/dll/win32/setupapi/driver.c index 3892bd5e2ca..9b65943f8d4 100644 --- a/dll/win32/setupapi/driver.c +++ b/dll/win32/setupapi/driver.c @@ -609,7 +609,7 @@ RegpApplyRestrictions( DWORD dwFlags, DWORD dwType, DWORD cbData, if ((dwFlags & RRF_RT_DWORD) == RRF_RT_DWORD) cbExpect = 4; - else if ((dwFlags & RRF_RT_DWORD) == RRF_RT_QWORD) + else if ((dwFlags & RRF_RT_QWORD) == RRF_RT_QWORD) cbExpect = 8; if (cbExpect && cbData != cbExpect) @@ -681,9 +681,9 @@ RegGetValueW( HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue, if (dwType == REG_EXPAND_SZ) { cbData = ExpandEnvironmentStringsW(pvBuf, pvData, - pcbData ? *pcbData : 0); + pcbData ? (*pcbData)/sizeof(WCHAR) : 0); dwType = REG_SZ; - if(pcbData && cbData > *pcbData) + if(pcbData && cbData > ((*pcbData)/sizeof(WCHAR))) ret = ERROR_MORE_DATA; } else if (pcbData) @@ -814,7 +814,7 @@ SetupDiBuildDriverInfoList( KEY_QUERY_VALUE); if (hDriverKey == INVALID_HANDLE_VALUE) goto done; - RequiredSize = len - strlenW(InfFileName); + RequiredSize = (len - strlenW(InfFileName)) * sizeof(WCHAR); rc = RegGetValueW( hDriverKey, NULL, diff --git a/dll/win32/setupapi/lang/pl-PL.rc b/dll/win32/setupapi/lang/pl-PL.rc index 7e14ecb5670..d6c269dce5a 100644 --- a/dll/win32/setupapi/lang/pl-PL.rc +++ b/dll/win32/setupapi/lang/pl-PL.rc @@ -1,11 +1,5 @@ /* * Polish resources for SETUPAPI - * - * Copyright 2005 Sebastian Gasiorek - * - * Translation update by Caemyr (Olaf Siejka) - * April, 2008 - * * 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 @@ -19,13 +13,18 @@ * 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 + * + * Copyright 2005 Sebastian Gasiorek + * + * Translation update by Caemyr -Olaf Siejka (April, 2008) + * UTF-8 conversion by Caemyr (May, 2011) */ LANGUAGE LANG_POLISH, SUBLANG_DEFAULT COPYFILEDLGORD DIALOGEX LOADONCALL MOVEABLE DISCARDABLE 20, 20, 208, 105 STYLE DS_MODALFRAME | DS_SHELLFONT | WS_POPUP | WS_VISIBLE | WS_CAPTION -CAPTION "Kopiowanie plikw..." +CAPTION "Kopiowanie plików..." FONT 8, "MS Shell Dlg" BEGIN PUSHBUTTON "Anuluj", IDCANCEL, 79, 84, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP @@ -38,7 +37,7 @@ END STRINGTABLE DISCARDABLE BEGIN - IDS_QUERY_REBOOT_TEXT "Twj komputer musi zosta zrestartowany, by ukoczy instalacj. Czy chcesz kontynuowa?" + IDS_QUERY_REBOOT_TEXT "Twój komputer musi zostać zrestartowany, by ukończyć instalację. Czy chcesz kontynuować?" IDS_QUERY_REBOOT_CAPTION "Restart" IDS_INF_FILE "Plik Instalatora" END diff --git a/dll/win32/setupapi/lang/ru-RU.rc b/dll/win32/setupapi/lang/ru-RU.rc index 111fae95b47..80ad343b14c 100644 --- a/dll/win32/setupapi/lang/ru-RU.rc +++ b/dll/win32/setupapi/lang/ru-RU.rc @@ -22,20 +22,20 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT COPYFILEDLGORD DIALOGEX LOADONCALL MOVEABLE DISCARDABLE 20, 20, 208, 105 STYLE DS_MODALFRAME | DS_SHELLFONT | WS_POPUP | WS_VISIBLE | WS_CAPTION -CAPTION " ..." +CAPTION "Копирование файлов..." FONT 8, "MS Shell Dlg" BEGIN - PUSHBUTTON "", IDCANCEL, 79, 84, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP - LTEXT ":", -1, 7, 7, 77, 11, WS_CHILD | WS_VISIBLE | WS_GROUP + PUSHBUTTON "Отмена", IDCANCEL, 79, 84, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP + LTEXT "Откуда:", -1, 7, 7, 77, 11, WS_CHILD | WS_VISIBLE | WS_GROUP LTEXT "", SOURCESTRORD, 7, 18, 194, 11, WS_CHILD | WS_VISIBLE | WS_GROUP - LTEXT ":", -1, 7, 30, 77, 11, WS_CHILD | WS_VISIBLE | WS_GROUP + LTEXT "Куда:", -1, 7, 30, 77, 11, WS_CHILD | WS_VISIBLE | WS_GROUP LTEXT "", DESTSTRORD, 7, 41, 194, 22, WS_CHILD | WS_VISIBLE | WS_GROUP CONTROL "", PROGRESSORD, "setupx_progress", 7, 63, 194, 13, WS_CHILD | WS_VISIBLE | WS_TABSTOP END STRINGTABLE DISCARDABLE BEGIN - IDS_QUERY_REBOOT_TEXT " , . ?" - IDS_QUERY_REBOOT_CAPTION "" - IDS_INF_FILE " " + IDS_QUERY_REBOOT_TEXT "Ваш компьютер должен быть перезагружен, чтобы завершить установку. Продолжить?" + IDS_QUERY_REBOOT_CAPTION "Перезагрузка" + IDS_INF_FILE "Информация для установки" END diff --git a/dll/win32/setupapi/lang/uk-UA.rc b/dll/win32/setupapi/lang/uk-UA.rc index 74114f10545..0dbf4ea82a3 100644 --- a/dll/win32/setupapi/lang/uk-UA.rc +++ b/dll/win32/setupapi/lang/uk-UA.rc @@ -10,20 +10,20 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT COPYFILEDLGORD DIALOGEX LOADONCALL MOVEABLE DISCARDABLE 20, 20, 208, 105 STYLE DS_MODALFRAME | DS_SHELLFONT | WS_POPUP | WS_VISIBLE | WS_CAPTION -CAPTION " ..." +CAPTION "Копіювання Файлів..." FONT 8, "MS Shell Dlg" BEGIN - PUSHBUTTON "", IDCANCEL, 79, 84, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP - LTEXT ":", -1, 7, 7, 77, 11, WS_CHILD | WS_VISIBLE | WS_GROUP + PUSHBUTTON "Скасувати", IDCANCEL, 79, 84, 50, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP + LTEXT "Джерело:", -1, 7, 7, 77, 11, WS_CHILD | WS_VISIBLE | WS_GROUP LTEXT "", SOURCESTRORD, 7, 18, 194, 11, WS_CHILD | WS_VISIBLE | WS_GROUP - LTEXT ":", -1, 7, 30, 77, 11, WS_CHILD | WS_VISIBLE | WS_GROUP + LTEXT "Призначення:", -1, 7, 30, 77, 11, WS_CHILD | WS_VISIBLE | WS_GROUP LTEXT "", DESTSTRORD, 7, 41, 194, 22, WS_CHILD | WS_VISIBLE | WS_GROUP CONTROL "", PROGRESSORD, "setupx_progress", 7, 63, 194, 13, WS_CHILD | WS_VISIBLE | WS_TABSTOP END STRINGTABLE DISCARDABLE BEGIN - IDS_QUERY_REBOOT_TEXT " '. ?" - IDS_QUERY_REBOOT_CAPTION "" - IDS_INF_FILE "³ " + IDS_QUERY_REBOOT_TEXT "Для закінчення установки необхідно перезапустити Ваш комп'ютер. Продовжити?" + IDS_QUERY_REBOOT_CAPTION "Перезапустити" + IDS_INF_FILE "Відомості для установки" END diff --git a/dll/win32/setupapi/setupapi.rbuild b/dll/win32/setupapi/setupapi.rbuild index 6f2d0c2c627..4943f56eecc 100644 --- a/dll/win32/setupapi/setupapi.rbuild +++ b/dll/win32/setupapi/setupapi.rbuild @@ -40,4 +40,5 @@ stubs.c rpc.c setupapi.rc + setupapi_private.h diff --git a/dll/win32/setupapi/setupapi.rc b/dll/win32/setupapi/setupapi.rc index f6328364f8a..4f0c1c3f50c 100644 --- a/dll/win32/setupapi/setupapi.rc +++ b/dll/win32/setupapi/setupapi.rc @@ -38,11 +38,14 @@ #include "lang/ko-KR.rc" #include "lang/nl-NL.rc" #include "lang/no-NO.rc" -#include "lang/pl-PL.rc" #include "lang/pt-BR.rc" -#include "lang/ru-RU.rc" #include "lang/sk-SK.rc" #include "lang/sv-SE.rc" #include "lang/th-TH.rc" #include "lang/tr-TR.rc" + +// UTF-8 +#pragma code_page(65001) +#include "lang/pl-PL.rc" +#include "lang/ru-RU.rc" #include "lang/uk-UA.rc" diff --git a/dll/win32/setupapi/setupapi.spec b/dll/win32/setupapi/setupapi.spec index c2ee1836809..e76d8720dec 100644 --- a/dll/win32/setupapi/setupapi.spec +++ b/dll/win32/setupapi/setupapi.spec @@ -184,8 +184,8 @@ @ stdcall CM_Request_Eject_PC_Ex(long) @ stdcall CM_Run_Detection(long) @ stdcall CM_Run_Detection_Ex(long long) -@ stub CM_Set_Class_Registry_PropertyA -@ stub CM_Set_Class_Registry_PropertyW +@ stdcall CM_Set_Class_Registry_PropertyA(ptr long ptr long long ptr) +@ stdcall CM_Set_Class_Registry_PropertyW(ptr long ptr long long ptr) @ stdcall CM_Set_DevNode_Problem(long long long) @ stdcall CM_Set_DevNode_Problem_Ex(long long long long) @ stdcall CM_Set_DevNode_Registry_PropertyA(long long ptr long long) diff --git a/dll/win32/setupapi/setupapi_private.h b/dll/win32/setupapi/setupapi_private.h index a3ff489b9c3..a8aa5917ab2 100644 --- a/dll/win32/setupapi/setupapi_private.h +++ b/dll/win32/setupapi/setupapi_private.h @@ -41,7 +41,9 @@ #include #include #define NTOS_MODE_USER -#include +#include +#include +#include #include diff --git a/dll/win32/sfc/CMakeLists.txt b/dll/win32/sfc/CMakeLists.txt index b01fe34b46c..9be0fb71fbc 100644 --- a/dll/win32/sfc/CMakeLists.txt +++ b/dll/win32/sfc/CMakeLists.txt @@ -6,13 +6,11 @@ list(APPEND SOURCE ${CMAKE_CURRENT_BINARY_DIR}/sfc_stubs.c ${CMAKE_CURRENT_BINARY_DIR}/sfc.def) -add_library(sfc SHARED - ${CMAKE_CURRENT_BINARY_DIR}/sfc_precomp.h.gch - ${SOURCE}) +add_library(sfc SHARED ${SOURCE}) set_module_type(sfc win32dll) -add_importlibs(sfc msvcrt kernel32 ntdll) -add_pch(sfc ${CMAKE_CURRENT_SOURCE_DIR}/precomp.h ${SOURCE}) +add_importlibs(sfc sfc_os msvcrt kernel32 ntdll) +add_pch(sfc precomp.h) add_cd_file(TARGET sfc DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/sfc_os/CMakeLists.txt b/dll/win32/sfc_os/CMakeLists.txt index c50b8f26494..0ffd0e7d5ca 100644 --- a/dll/win32/sfc_os/CMakeLists.txt +++ b/dll/win32/sfc_os/CMakeLists.txt @@ -6,13 +6,10 @@ list(APPEND SOURCE ${CMAKE_CURRENT_BINARY_DIR}/sfc_os_stubs.c ${CMAKE_CURRENT_BINARY_DIR}/sfc_os.def) -add_library(sfc_os SHARED - ${CMAKE_CURRENT_BINARY_DIR}/sfc_os_precomp.h.gch - ${SOURCE}) +add_library(sfc_os SHARED ${SOURCE}) set_module_type(sfc_os win32dll) - add_importlibs(sfc_os msvcrt kernel32 ntdll) -add_pch(sfc_os ${CMAKE_CURRENT_SOURCE_DIR}/precomp.h ${SOURCE}) - +add_importlib_target(sfc_os.spec) +add_pch(sfc_os precomp.h) add_cd_file(TARGET sfc_os DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/sfc_os/sfc_os.c b/dll/win32/sfc_os/sfc_os.c index 84fb96bace6..57a104d1139 100644 --- a/dll/win32/sfc_os/sfc_os.c +++ b/dll/win32/sfc_os/sfc_os.c @@ -142,3 +142,24 @@ BOOL WINAPI SfcGetNextProtectedFile(HANDLE RpcHandle, PPROTECTED_FILE_DATA ProtF return FALSE; } +/****************************************************************** + * SfcFileException [sfc_os.@] + * + * Disable the protection for the given file during one minute + * + * PARAMS + * dwUnknown0 [I] Set to 0 + * pwszFile [I] Name of the file to unprotect + * dwUnknown1 [I] Set to -1 + * + * RETURNS + * Failure: 1; + * Success: 0; + * + */ +DWORD WINAPI SfcFileException(DWORD dwUnknown0, PWCHAR pwszFile, DWORD dwUnknown1) +{ + UNIMPLEMENTED; + /* Always return success */ + return 0; +} \ No newline at end of file diff --git a/dll/win32/sfc_os/sfc_os.spec b/dll/win32/sfc_os/sfc_os.spec index 0fa440aff08..e8f44d9bf7a 100644 --- a/dll/win32/sfc_os/sfc_os.spec +++ b/dll/win32/sfc_os/sfc_os.spec @@ -2,7 +2,7 @@ @ stub sfc_os_2 @ stub sfc_os_3 @ stub sfc_os_4 -@ stub sfc_os_5 +@ stdcall SfcFileException(long ptr long) @ stub sfc_os_6 @ stub sfc_os_7 @ stdcall SfcGetNextProtectedFile(ptr ptr) diff --git a/dll/win32/shdocvw/CMakeLists.txt b/dll/win32/shdocvw/CMakeLists.txt index db2f0c48a1f..c4f7e01d50e 100644 --- a/dll/win32/shdocvw/CMakeLists.txt +++ b/dll/win32/shdocvw/CMakeLists.txt @@ -54,5 +54,6 @@ add_importlibs(shdocvw ntdll) add_dependencies(shdocvw shdocvw_v1) +add_pch(shdocvw shdocvw.h) add_cd_file(TARGET shdocvw DESTINATION reactos/system32 FOR all) add_importlib_target(shdocvw.spec) diff --git a/dll/win32/shdocvw/shdocvw.rbuild b/dll/win32/shdocvw/shdocvw.rbuild index c7b565269d2..e7a721bfe7d 100644 --- a/dll/win32/shdocvw/shdocvw.rbuild +++ b/dll/win32/shdocvw/shdocvw.rbuild @@ -41,6 +41,7 @@ view.c webbrowser.c shdocvw.rc + shdocvw.h stdole2 diff --git a/dll/win32/shell32/CMakeLists.txt b/dll/win32/shell32/CMakeLists.txt index ecc3efb5bb4..a312d014e36 100644 --- a/dll/win32/shell32/CMakeLists.txt +++ b/dll/win32/shell32/CMakeLists.txt @@ -15,8 +15,6 @@ include_directories( ${REACTOS_SOURCE_DIR}/lib/atl ${REACTOS_SOURCE_DIR}) -generate_idl_iids(shobjidl_local.idl) - spec2def(shell32.dll shell32.spec) list(APPEND SOURCE @@ -73,14 +71,9 @@ list(APPEND SOURCE shv_item_new.cpp folder_options.cpp shell32.rc - ${CMAKE_CURRENT_BINARY_DIR}/shobjidl_local_i.c ${CMAKE_CURRENT_BINARY_DIR}/shell32_stubs.c ${CMAKE_CURRENT_BINARY_DIR}/shell32.def) -# FIXME -#add_pch(shell32 ${CMAKE_CURRENT_SOURCE_DIR}/precomp.h ${SOURCE}) -#add_library(shell32 SHARED ${CMAKE_CURRENT_BINARY_DIR}/shell32_precomp.h.gch ${SOURCE}) - add_library(shell32 SHARED ${SOURCE}) set_module_type(shell32 win32dll) @@ -103,9 +96,11 @@ add_importlibs(shell32 devmgr winspool winmm - kernel32 msvcrt + kernel32 ntdll) +add_pch(shell32 precomp.h) + add_cd_file(TARGET shell32 DESTINATION reactos/system32 FOR all) add_importlib_target(shell32.spec) diff --git a/dll/win32/shell32/authors.cpp b/dll/win32/shell32/authors.cpp index adf252d56c9..36243b617b7 100644 --- a/dll/win32/shell32/authors.cpp +++ b/dll/win32/shell32/authors.cpp @@ -1,2 +1,2 @@ -const char * const SHELL_Authors[] = { "Copyright 1993-2009 WINE team", "Copyright 1998-2011 ReactOS Team", 0 }; +const char * const SHELL_Authors[] = { "Copyright 1993-2011 WINE team", "Copyright 1998-2011 ReactOS Team", 0 }; diff --git a/dll/win32/shell32/autocomplete.cpp b/dll/win32/shell32/autocomplete.cpp index da141540441..0fb7c7617f8 100644 --- a/dll/win32/shell32/autocomplete.cpp +++ b/dll/win32/shell32/autocomplete.cpp @@ -36,12 +36,6 @@ */ #include -#include -#include -#include -#include -#include "autocomplete.h" - WINE_DEFAULT_DEBUG_CHANNEL(shell); diff --git a/dll/win32/shell32/dataobject.cpp b/dll/win32/shell32/dataobject.cpp index 2cb86034ae5..ec483981d38 100644 --- a/dll/win32/shell32/dataobject.cpp +++ b/dll/win32/shell32/dataobject.cpp @@ -21,10 +21,6 @@ */ #include -#include -#include -#include -#include WINE_DEFAULT_DEBUG_CHANNEL(shell); diff --git a/dll/win32/shell32/desktop.cpp b/dll/win32/shell32/desktop.cpp index 60370f138bb..9bdfceac09a 100644 --- a/dll/win32/shell32/desktop.cpp +++ b/dll/win32/shell32/desktop.cpp @@ -19,10 +19,6 @@ */ #include -#include -#include -#include -#include WINE_DEFAULT_DEBUG_CHANNEL(desktop); diff --git a/dll/win32/shell32/dragdrophelper.cpp b/dll/win32/shell32/dragdrophelper.cpp index 0b87d31819e..faf307d3b07 100644 --- a/dll/win32/shell32/dragdrophelper.cpp +++ b/dll/win32/shell32/dragdrophelper.cpp @@ -21,11 +21,6 @@ */ #include -#include -#include -#include -#include -#include "dragdrophelper.h" WINE_DEFAULT_DEBUG_CHANNEL (shell); diff --git a/dll/win32/shell32/enumidlist.cpp b/dll/win32/shell32/enumidlist.cpp index abe2e02a0d3..916d7562353 100644 --- a/dll/win32/shell32/enumidlist.cpp +++ b/dll/win32/shell32/enumidlist.cpp @@ -19,10 +19,6 @@ */ #include -#include -#include -#include -#include WINE_DEFAULT_DEBUG_CHANNEL(shell); diff --git a/dll/win32/shell32/extracticon.cpp b/dll/win32/shell32/extracticon.cpp index 7f2daa09686..a304487224c 100644 --- a/dll/win32/shell32/extracticon.cpp +++ b/dll/win32/shell32/extracticon.cpp @@ -8,10 +8,6 @@ */ #include -#include -#include -#include -#include WINE_DEFAULT_DEBUG_CHANNEL(shell); diff --git a/dll/win32/shell32/lang/bg-BG.rc b/dll/win32/shell32/lang/bg-BG.rc index 6bc22cf438a..3176ae676b9 100644 --- a/dll/win32/shell32/lang/bg-BG.rc +++ b/dll/win32/shell32/lang/bg-BG.rc @@ -125,7 +125,7 @@ FONT 8, "MS Shell Dlg" BEGIN ICON "", IDC_SHELL_ABOUT_ICON, 7, 55, 21, 20 LTEXT "", IDC_SHELL_ABOUT_APPNAME, 35, 55, 200, 10 - LTEXT " " KERNEL_VERSION_STR " (" KERNEL_VERSION_BUILD_STR ")", IDC_STATIC, 35, 65, 235, 10 + LTEXT " "KERNEL_VERSION_STR" ("KERNEL_VERSION_BUILD_STR")", IDC_STATIC, 35, 65, 235, 10 LTEXT REACTOS_DEFAULT_STR_LEGAL_COPYRIGHT, IDC_STATIC, 35, 75, 210, 10 LTEXT "", IDC_SHELL_ABOUT_OTHERSTUFF, 35, 90, 180, 20 LTEXT " :", IDC_STATIC, 35, 115, 180, 10 @@ -656,10 +656,7 @@ BEGIN IDS_CANTTRASH_TEXT " '%1' . ?" IDS_OVERWRITEFILE_TEXT " '%1'.\n\n ?" IDS_OVERWRITEFILE_CAPTION " " - IDS_OVERWRITEFOLDER_TEXT " '%1'.\n\n"\ - " \n"\ - " , . \n"\ - " ?" + IDS_OVERWRITEFOLDER_TEXT " '%1'.\n\n \n , . \n ?" // message box strings IDS_RESTART_TITLE "" diff --git a/dll/win32/shell32/lang/ca-ES.rc b/dll/win32/shell32/lang/ca-ES.rc index 0c0571e0f4c..9ccb77133a1 100644 --- a/dll/win32/shell32/lang/ca-ES.rc +++ b/dll/win32/shell32/lang/ca-ES.rc @@ -125,7 +125,7 @@ FONT 8, "MS Shell Dlg" BEGIN ICON "", IDC_SHELL_ABOUT_ICON, 7, 55, 21, 20 LTEXT "", IDC_SHELL_ABOUT_APPNAME, 35, 55, 200, 10 - LTEXT "Version " KERNEL_VERSION_STR " (" KERNEL_VERSION_BUILD_STR ")", IDC_STATIC, 35, 65, 235, 10 + LTEXT "Version "KERNEL_VERSION_STR" ("KERNEL_VERSION_BUILD_STR")", IDC_STATIC, 35, 65, 235, 10 LTEXT REACTOS_DEFAULT_STR_LEGAL_COPYRIGHT, IDC_STATIC, 35, 75, 210, 10 LTEXT "", IDC_SHELL_ABOUT_OTHERSTUFF, 35, 90, 180, 20 LTEXT "This ReactOS version is registered to:", IDC_STATIC, 35, 115, 180, 10 @@ -655,10 +655,7 @@ BEGIN IDS_CANTTRASH_TEXT "The item '%1' can't be sent to Trash. Do you want to delete it instead?" IDS_OVERWRITEFILE_TEXT "This folder already contains a file called '%1'.\n\nDo you want to replace it?" IDS_OVERWRITEFILE_CAPTION "Confirm file overwrite" - IDS_OVERWRITEFOLDER_TEXT "This folder already contains a folder named '%1'.\n\n"\ - "If the files in the destination folder have the same names as files in the\n"\ - "selected folder they will be replaced. Do you still want to move or copy\n"\ - "the folder?" + IDS_OVERWRITEFOLDER_TEXT "This folder already contains a folder named '%1'.\n\nIf the files in the destination folder have the same names as files in the\nselected folder they will be replaced. Do you still want to move or copy\nthe folder?" /* message box strings */ IDS_RESTART_TITLE "Restart" diff --git a/dll/win32/shell32/lang/cs-CZ.rc b/dll/win32/shell32/lang/cs-CZ.rc index ae61ccdefbe..14d4f3a8c92 100644 --- a/dll/win32/shell32/lang/cs-CZ.rc +++ b/dll/win32/shell32/lang/cs-CZ.rc @@ -113,7 +113,7 @@ FONT 8, "MS Shell Dlg" BEGIN ICON "", IDC_SHELL_ABOUT_ICON, 7, 55, 21, 20 LTEXT "", IDC_SHELL_ABOUT_APPNAME, 35, 55, 200, 10 - LTEXT "Verze " KERNEL_VERSION_STR " (" KERNEL_VERSION_BUILD_STR ")", IDC_STATIC, 35, 65, 235, 10 + LTEXT "Verze "KERNEL_VERSION_STR" ("KERNEL_VERSION_BUILD_STR")", IDC_STATIC, 35, 65, 235, 10 LTEXT REACTOS_DEFAULT_STR_LEGAL_COPYRIGHT, IDC_STATIC, 35, 75, 210, 10 LTEXT "", IDC_SHELL_ABOUT_OTHERSTUFF, 35, 90, 180, 20 LTEXT "Tato verze ReactOS je zaregistrovna na:", IDC_STATIC, 35, 115, 180, 10 @@ -643,9 +643,7 @@ BEGIN IDS_CANTTRASH_TEXT "Poloka '%1' neme bt pesunuta do Koe. Chcete ji msto toho smazat?" IDS_OVERWRITEFILE_TEXT "Tato sloka ji obsahuje soubor s nzvem '%1'.\n\nChcete jej pepsat?" IDS_OVERWRITEFILE_CAPTION "Potvrdit pepsn souboru" - IDS_OVERWRITEFOLDER_TEXT "Tato sloka ji obsahuje sloku s nzvem '%1'.\n\n"\ - "Pokud maj soubory v clov sloce stejn nzvy jako soubory ve zvolen\n"\ - "sloce, budou pepsny. Opravdu chcete pesunout nebo zkoprovat tuto sloku?" + IDS_OVERWRITEFOLDER_TEXT "Tato sloka ji obsahuje sloku s nzvem '%1'.\n\nPokud maj soubory v clov sloce stejn nzvy jako soubory ve zvolen\nsloce, budou pepsny. Opravdu chcete pesunout nebo zkoprovat tuto sloku?" /* message box strings */ IDS_RESTART_TITLE "Restartovat" diff --git a/dll/win32/shell32/lang/da-DK.rc b/dll/win32/shell32/lang/da-DK.rc index 31142a6196c..65a866f1d15 100644 --- a/dll/win32/shell32/lang/da-DK.rc +++ b/dll/win32/shell32/lang/da-DK.rc @@ -113,7 +113,7 @@ FONT 8, "MS Shell Dlg" BEGIN ICON "", IDC_SHELL_ABOUT_ICON, 7, 55, 21, 20 LTEXT "", IDC_SHELL_ABOUT_APPNAME, 35, 55, 200, 10 - LTEXT "Version " KERNEL_VERSION_STR " (" KERNEL_VERSION_BUILD_STR ")", IDC_STATIC, 35, 65, 235, 10 + LTEXT "Version "KERNEL_VERSION_STR" ("KERNEL_VERSION_BUILD_STR")", IDC_STATIC, 35, 65, 235, 10 LTEXT REACTOS_DEFAULT_STR_LEGAL_COPYRIGHT, IDC_STATIC, 35, 75, 210, 10 LTEXT "", IDC_SHELL_ABOUT_OTHERSTUFF, 35, 90, 180, 20 LTEXT "This ReactOS version is registered to:", IDC_STATIC, 35, 115, 180, 10 @@ -644,10 +644,7 @@ BEGIN IDS_CANTTRASH_TEXT "The item '%1' can't be sent to Trash. Do you want to delete it instead?" IDS_OVERWRITEFILE_TEXT "Overskriv fil %1?" IDS_OVERWRITEFILE_CAPTION "Bekrft overskrivelse af fil" - IDS_OVERWRITEFOLDER_TEXT "This folder already contains a folder named '%1'.\n\n"\ - "If the files in the destination folder have the same names as files in the\n"\ - "selected folder they will be replaced. Do you still want to move or copy\n"\ - "the folder?" + IDS_OVERWRITEFOLDER_TEXT "This folder already contains a folder named '%1'.\n\nIf the files in the destination folder have the same names as files in the\nselected folder they will be replaced. Do you still want to move or copy\nthe folder?" /* message box strings */ IDS_RESTART_TITLE "Genstart" diff --git a/dll/win32/shell32/lang/de-DE.rc b/dll/win32/shell32/lang/de-DE.rc index 72edc251120..e2136f9552f 100644 --- a/dll/win32/shell32/lang/de-DE.rc +++ b/dll/win32/shell32/lang/de-DE.rc @@ -127,7 +127,7 @@ FONT 8, "MS Shell Dlg" BEGIN ICON "", IDC_SHELL_ABOUT_ICON, 7, 55, 21, 20 LTEXT "", IDC_SHELL_ABOUT_APPNAME, 35, 55, 200, 10 - LTEXT "Version " KERNEL_VERSION_STR " (" KERNEL_VERSION_BUILD_STR ")", IDC_STATIC, 35, 65, 235, 10 + LTEXT "Version "KERNEL_VERSION_STR" ("KERNEL_VERSION_BUILD_STR")", IDC_STATIC, 35, 65, 235, 10 LTEXT REACTOS_DEFAULT_STR_LEGAL_COPYRIGHT, IDC_STATIC, 35, 75, 210, 10 LTEXT "", IDC_SHELL_ABOUT_OTHERSTUFF, 35, 90, 180, 20 LTEXT "Diese ReactOS-Version wurde registriert auf:", IDC_STATIC, 35, 115, 180, 10 @@ -660,9 +660,7 @@ BEGIN IDS_CANTTRASH_TEXT "Das Objekt '%1' kann nicht in den Papierkorb verschoben werden. Mchten Sie es stattdessen lschen?" IDS_OVERWRITEFILE_TEXT "Dieser Ordner enthlt bereits eine Datei namens '%1'.\n\nWollen Sie diese berschreiben?" IDS_OVERWRITEFILE_CAPTION "Besttigung: Datei berschreiben" - IDS_OVERWRITEFOLDER_TEXT "Dieser Ordner enthlt bereits einen Ordner namens '%1'.\n\n"\ - "Wenn Dateien im Zielordner die gleichen Namen haben, wie Dateien\n"\ - "im gewhlten Ordner, werden diese ersetzt. Soll der Vorgang fortgesetzt werden?" + IDS_OVERWRITEFOLDER_TEXT "Dieser Ordner enthlt bereits einen Ordner namens '%1'.\n\nWenn Dateien im Zielordner die gleichen Namen haben, wie Dateien\nim gewhlten Ordner, werden diese ersetzt. Soll der Vorgang fortgesetzt werden?" /* message box strings */ IDS_RESTART_TITLE "Neu starten" diff --git a/dll/win32/shell32/lang/el-GR.rc b/dll/win32/shell32/lang/el-GR.rc index bb08952155a..773da617bc3 100644 --- a/dll/win32/shell32/lang/el-GR.rc +++ b/dll/win32/shell32/lang/el-GR.rc @@ -125,7 +125,7 @@ FONT 8, "MS Shell Dlg" BEGIN ICON "", IDC_SHELL_ABOUT_ICON, 7, 55, 21, 20 LTEXT "", IDC_SHELL_ABOUT_APPNAME, 35, 55, 200, 10 - LTEXT " " KERNEL_VERSION_STR " (" KERNEL_VERSION_BUILD_STR ")", IDC_STATIC, 35, 65, 235, 10 + LTEXT " "KERNEL_VERSION_STR" ("KERNEL_VERSION_BUILD_STR")", IDC_STATIC, 35, 65, 235, 10 LTEXT REACTOS_DEFAULT_STR_LEGAL_COPYRIGHT, IDC_STATIC, 35, 75, 210, 10 LTEXT "", IDC_SHELL_ABOUT_OTHERSTUFF, 35, 90, 180, 20 LTEXT " ReactOS :", IDC_STATIC, 35, 115, 180, 10 @@ -656,10 +656,7 @@ BEGIN IDS_CANTTRASH_TEXT " '%1' . ;" IDS_OVERWRITEFILE_TEXT " '%1'.\n\n ;" IDS_OVERWRITEFILE_CAPTION " " - IDS_OVERWRITEFOLDER_TEXT " ed '%1'.\n\n"\ - " \n"\ - " . ;\n"\ - "the folder?" + IDS_OVERWRITEFOLDER_TEXT " ed '%1'.\n\n \n . ;\nthe folder?" /* message box strings */ IDS_RESTART_TITLE "" diff --git a/dll/win32/shell32/lang/en-GB.rc b/dll/win32/shell32/lang/en-GB.rc index 20844af2f95..777cde9ca43 100644 --- a/dll/win32/shell32/lang/en-GB.rc +++ b/dll/win32/shell32/lang/en-GB.rc @@ -125,7 +125,7 @@ FONT 8, "MS Shell Dlg" BEGIN ICON "", IDC_SHELL_ABOUT_ICON, 7, 55, 21, 20 LTEXT "", IDC_SHELL_ABOUT_APPNAME, 35, 55, 200, 10 - LTEXT "Version " KERNEL_VERSION_STR " (" KERNEL_VERSION_BUILD_STR ")", IDC_STATIC, 35, 65, 235, 10 + LTEXT "Version "KERNEL_VERSION_STR" ("KERNEL_VERSION_BUILD_STR")", IDC_STATIC, 35, 65, 235, 10 LTEXT REACTOS_DEFAULT_STR_LEGAL_COPYRIGHT, IDC_STATIC, 35, 75, 210, 10 LTEXT "", IDC_SHELL_ABOUT_OTHERSTUFF, 35, 90, 180, 20 LTEXT "This ReactOS version is registered to:", IDC_STATIC, 35, 115, 180, 10 @@ -655,10 +655,7 @@ BEGIN IDS_CANTTRASH_TEXT "The item '%1' can't be sent to Recycle Bin. Do you want to delete it instead?" IDS_OVERWRITEFILE_TEXT "This folder already contains a file called '%1'.\n\nDo you want to replace it?" IDS_OVERWRITEFILE_CAPTION "Confirm file overwrite" - IDS_OVERWRITEFOLDER_TEXT "This folder already contains a folder named '%1'.\n\n"\ - "If the files in the destination folder have the same names as files in the\n"\ - "selected folder they will be replaced. Do you still want to move or copy\n"\ - "the folder?" + IDS_OVERWRITEFOLDER_TEXT "This folder already contains a folder named '%1'.\n\nIf the files in the destination folder have the same names as files in the\nselected folder they will be replaced. Do you still want to move or copy\nthe folder?" /* message box strings */ IDS_RESTART_TITLE "Restart" diff --git a/dll/win32/shell32/lang/en-US.rc b/dll/win32/shell32/lang/en-US.rc index 1ae2b8c0c26..edca6e8bf23 100644 --- a/dll/win32/shell32/lang/en-US.rc +++ b/dll/win32/shell32/lang/en-US.rc @@ -125,7 +125,7 @@ FONT 8, "MS Shell Dlg" BEGIN ICON "", IDC_SHELL_ABOUT_ICON, 7, 55, 21, 20 LTEXT "", IDC_SHELL_ABOUT_APPNAME, 35, 55, 200, 10 - LTEXT "Version " KERNEL_VERSION_STR " (" KERNEL_VERSION_BUILD_STR ")", IDC_STATIC, 35, 65, 235, 10 + LTEXT "Version "KERNEL_VERSION_STR" ("KERNEL_VERSION_BUILD_STR")", IDC_STATIC, 35, 65, 235, 10 LTEXT REACTOS_DEFAULT_STR_LEGAL_COPYRIGHT, IDC_STATIC, 35, 75, 210, 10 LTEXT "", IDC_SHELL_ABOUT_OTHERSTUFF, 35, 90, 180, 20 LTEXT "This ReactOS version is registered to:", IDC_STATIC, 35, 115, 180, 10 @@ -666,10 +666,7 @@ BEGIN IDS_CANTTRASH_TEXT "The item '%1' can't be sent to Trash. Do you want to delete it instead?" IDS_OVERWRITEFILE_TEXT "This folder already contains a file called '%1'.\n\nDo you want to replace it?" IDS_OVERWRITEFILE_CAPTION "Confirm file overwrite" - IDS_OVERWRITEFOLDER_TEXT "This folder already contains a folder named '%1'.\n\n"\ - "If the files in the destination folder have the same names as files in the\n"\ - "selected folder they will be replaced. Do you still want to move or copy\n"\ - "the folder?" + IDS_OVERWRITEFOLDER_TEXT "This folder already contains a folder named '%1'.\n\nIf the files in the destination folder have the same names as files in the\nselected folder they will be replaced. Do you still want to move or copy\nthe folder?" /* message box strings */ IDS_RESTART_TITLE "Restart" diff --git a/dll/win32/shell32/lang/es-ES.rc b/dll/win32/shell32/lang/es-ES.rc index 56a9039b91f..faba57de667 100644 --- a/dll/win32/shell32/lang/es-ES.rc +++ b/dll/win32/shell32/lang/es-ES.rc @@ -128,7 +128,7 @@ FONT 8, "MS Shell Dlg" BEGIN ICON "", IDC_SHELL_ABOUT_ICON, 7, 55, 21, 20 LTEXT "", IDC_SHELL_ABOUT_APPNAME, 35, 55, 200, 10 - LTEXT "Versin " KERNEL_VERSION_STR " (" KERNEL_VERSION_BUILD_STR ")", IDC_STATIC, 35, 65, 235, 10 + LTEXT "Versin "KERNEL_VERSION_STR" ("KERNEL_VERSION_BUILD_STR")", IDC_STATIC, 35, 65, 235, 10 LTEXT REACTOS_DEFAULT_STR_LEGAL_COPYRIGHT, IDC_STATIC, 35, 75, 210, 10 LTEXT "", IDC_SHELL_ABOUT_OTHERSTUFF, 35, 90, 180, 20 LTEXT "Esta versin de ReactOS est registrada a:", IDC_STATIC, 35, 115, 180, 10 @@ -668,10 +668,7 @@ BEGIN IDS_CANTTRASH_TEXT "El elemento '%1' no puede ser enviado a la Papelera de reciclaje. En vez de ello Desea borrarlo?" IDS_OVERWRITEFILE_TEXT "Esta carpeta ya contiene un archivo con el nombre '%1'.\n\nDesea reemplazar el archivo existente?" IDS_OVERWRITEFILE_CAPTION "Confirmar el reemplazo de archivo" - IDS_OVERWRITEFOLDER_TEXT "Esta carpeta ya contiene una carpeta con el nombre '%1'.\n\n"\ - "Si los archivos de la carpeta existente tienen el mismo nombre que los\n"\ - "archivos de la carpeta que est moviendo o copiando, sern\n"\ - "reemplazados. Desea mover o copiar la carpeta de todas formas?" + IDS_OVERWRITEFOLDER_TEXT "Esta carpeta ya contiene una carpeta con el nombre '%1'.\n\nSi los archivos de la carpeta existente tienen el mismo nombre que los\narchivos de la carpeta que est moviendo o copiando, sern\nreemplazados. Desea mover o copiar la carpeta de todas formas?" /* message box strings */ IDS_RESTART_TITLE "Reiniciar" diff --git a/dll/win32/shell32/lang/fi-FI.rc b/dll/win32/shell32/lang/fi-FI.rc index e554eba007c..036208b542a 100644 --- a/dll/win32/shell32/lang/fi-FI.rc +++ b/dll/win32/shell32/lang/fi-FI.rc @@ -125,7 +125,7 @@ FONT 8, "MS Shell Dlg" BEGIN ICON "", IDC_SHELL_ABOUT_ICON, 7, 55, 21, 20 LTEXT "", IDC_SHELL_ABOUT_APPNAME, 35, 55, 200, 10 - LTEXT "Version " KERNEL_VERSION_STR " (" KERNEL_VERSION_BUILD_STR ")", IDC_STATIC, 35, 65, 235, 10 + LTEXT "Version "KERNEL_VERSION_STR" ("KERNEL_VERSION_BUILD_STR")", IDC_STATIC, 35, 65, 235, 10 LTEXT REACTOS_DEFAULT_STR_LEGAL_COPYRIGHT, IDC_STATIC, 35, 75, 210, 10 LTEXT "", IDC_SHELL_ABOUT_OTHERSTUFF, 35, 90, 180, 20 LTEXT "This ReactOS version is registered to:", IDC_STATIC, 35, 115, 180, 10 @@ -655,10 +655,7 @@ BEGIN IDS_CANTTRASH_TEXT "The item '%1' can't be sent to Trash. Do you want to delete it instead?" IDS_OVERWRITEFILE_TEXT "This folder already contains a file called '%1'.\n\nDo you want to replace it?" IDS_OVERWRITEFILE_CAPTION "Vahvista Tiedoston Ylikirjoitus" - IDS_OVERWRITEFOLDER_TEXT "This folder already contains a folder named '%1'.\n\n"\ - "If the files in the destination folder have the same names as files in the\n"\ - "selected folder they will be replaced. Do you still want to move or copy\n"\ - "the folder?" + IDS_OVERWRITEFOLDER_TEXT "This folder already contains a folder named '%1'.\n\nIf the files in the destination folder have the same names as files in the\nselected folder they will be replaced. Do you still want to move or copy\nthe folder?" /* message box strings */ IDS_RESTART_TITLE "Kynnist uudestaan" diff --git a/dll/win32/shell32/lang/fr-FR.rc b/dll/win32/shell32/lang/fr-FR.rc index ec088732e40..4ba19d8c85a 100644 --- a/dll/win32/shell32/lang/fr-FR.rc +++ b/dll/win32/shell32/lang/fr-FR.rc @@ -129,7 +129,7 @@ FONT 8, "MS Shell Dlg" BEGIN ICON "", IDC_SHELL_ABOUT_ICON, 7, 55, 21, 20 LTEXT "", IDC_SHELL_ABOUT_APPNAME, 35, 55, 200, 10 - LTEXT "Version " KERNEL_VERSION_STR " (" KERNEL_VERSION_BUILD_STR ")", IDC_STATIC, 35, 65, 235, 10 + LTEXT "Version "KERNEL_VERSION_STR" ("KERNEL_VERSION_BUILD_STR")", IDC_STATIC, 35, 65, 235, 10 LTEXT REACTOS_DEFAULT_STR_LEGAL_COPYRIGHT, IDC_STATIC, 35, 75, 210, 10 LTEXT "", IDC_SHELL_ABOUT_OTHERSTUFF, 35, 90, 180, 20 LTEXT "Cette version de ReactOS est enregistre :", IDC_STATIC, 35, 115, 180, 10 @@ -659,10 +659,7 @@ BEGIN IDS_CANTTRASH_TEXT "L'lment '%1' ne peut tre envoy la Corbeille. Voulez-vous le supprimer ?" IDS_OVERWRITEFILE_TEXT "Ce dossier contient dj un fichier nomm '%1'.\n\nVoulez-vous le remplacer ?" IDS_OVERWRITEFILE_CAPTION "Confirmer l'crasement du fichier" - IDS_OVERWRITEFOLDER_TEXT "Ce dossier contient dj un dossier nomm '%1'.\n\n"\ - "Si les fichiers dans le dossier de destination ont les mmes noms que ceux dans le\n"\ - "dossier slectionn, ils seront remplacs. Voulez-vous toujours dplacer ou copier\n"\ - "le dossier?" + IDS_OVERWRITEFOLDER_TEXT "Ce dossier contient dj un dossier nomm '%1'.\n\nSi les fichiers dans le dossier de destination ont les mmes noms que ceux dans le\ndossier slectionn, ils seront remplacs. Voulez-vous toujours dplacer ou copier\nle dossier?" /* message box strings */ IDS_RESTART_TITLE "Redmarrer" diff --git a/dll/win32/shell32/lang/hu-HU.rc b/dll/win32/shell32/lang/hu-HU.rc index 8f7d4e15650..03ee27ee56b 100644 --- a/dll/win32/shell32/lang/hu-HU.rc +++ b/dll/win32/shell32/lang/hu-HU.rc @@ -128,7 +128,7 @@ FONT 8, "MS Shell Dlg" BEGIN ICON "", IDC_SHELL_ABOUT_ICON, 7, 55, 21, 20 LTEXT "", IDC_SHELL_ABOUT_APPNAME, 35, 55, 200, 10 - LTEXT "Version " KERNEL_VERSION_STR " (" KERNEL_VERSION_BUILD_STR ")", IDC_STATIC, 35, 65, 235, 10 + LTEXT "Version "KERNEL_VERSION_STR" ("KERNEL_VERSION_BUILD_STR")", IDC_STATIC, 35, 65, 235, 10 LTEXT REACTOS_DEFAULT_STR_LEGAL_COPYRIGHT, IDC_STATIC, 35, 75, 210, 10 LTEXT "", IDC_SHELL_ABOUT_OTHERSTUFF, 35, 90, 180, 20 LTEXT "This ReactOS version is registered to:", IDC_STATIC, 35, 115, 180, 10 @@ -658,10 +658,7 @@ BEGIN IDS_CANTTRASH_TEXT "The item '%1' can't be sent to Trash. Do you want to delete it instead?" IDS_OVERWRITEFILE_TEXT "This folder already contains a file called '%1'.\n\nDo you want to replace it?" IDS_OVERWRITEFILE_CAPTION "llomny fellrsa" - IDS_OVERWRITEFOLDER_TEXT "This folder already contains a folder named '%1'.\n\n"\ - "If the files in the destination folder have the same names as files in the\n"\ - "selected folder they will be replaced. Do you still want to move or copy\n"\ - "the folder?" + IDS_OVERWRITEFOLDER_TEXT "This folder already contains a folder named '%1'.\n\nIf the files in the destination folder have the same names as files in the\nselected folder they will be replaced. Do you still want to move or copy\nthe folder?" /* message box strings */ IDS_RESTART_TITLE "jraindts" diff --git a/dll/win32/shell32/lang/it-IT.rc b/dll/win32/shell32/lang/it-IT.rc index 1aea150df34..3ee1aa38dea 100644 --- a/dll/win32/shell32/lang/it-IT.rc +++ b/dll/win32/shell32/lang/it-IT.rc @@ -126,7 +126,7 @@ FONT 8, "MS Shell Dlg" BEGIN ICON "", IDC_SHELL_ABOUT_ICON, 7, 55, 21, 20 LTEXT "", IDC_SHELL_ABOUT_APPNAME, 35, 55, 200, 10 - LTEXT "Versione " KERNEL_VERSION_STR " (" KERNEL_VERSION_BUILD_STR ")", IDC_STATIC, 35, 65, 235, 10 + LTEXT "Versione "KERNEL_VERSION_STR" ("KERNEL_VERSION_BUILD_STR")", IDC_STATIC, 35, 65, 235, 10 LTEXT REACTOS_DEFAULT_STR_LEGAL_COPYRIGHT, IDC_STATIC, 35, 75, 210, 10 LTEXT "", IDC_SHELL_ABOUT_OTHERSTUFF, 35, 90, 180, 20 LTEXT "Questa versione di ReactOS registrata a nome di:", IDC_STATIC, 35, 115, 180, 10 @@ -666,10 +666,7 @@ BEGIN IDS_CANTTRASH_TEXT "L'elemento '%1' non pu essere spostato nel cestino. Volete cancellarlo?" IDS_OVERWRITEFILE_TEXT "Questa cartella contiene gi un file con nome '%1'.\n\nVolete sostituirlo?" IDS_OVERWRITEFILE_CAPTION "Confermare la sovrascrittura del File" - IDS_OVERWRITEFOLDER_TEXT "Questa cartella contiene gi una cartella con nome '%1'.\n\n"\ - "Se i file nella cartella di destinazione hanno gli stessi nomi di quelli della \n"\ - "cartella selezionata saranno sovrascritti. Volete procedere comunque?\n"\ - "" + IDS_OVERWRITEFOLDER_TEXT "Questa cartella contiene gi una cartella con nome '%1'.\n\nSe i file nella cartella di destinazione hanno gli stessi nomi di quelli della \ncartella selezionata saranno sovrascritti. Volete procedere comunque?\n" /* message box strings */ IDS_RESTART_TITLE "Riavvia" diff --git a/dll/win32/shell32/lang/ja-JP.rc b/dll/win32/shell32/lang/ja-JP.rc index 077bf43339c..ec1189689e2 100644 --- a/dll/win32/shell32/lang/ja-JP.rc +++ b/dll/win32/shell32/lang/ja-JP.rc @@ -125,7 +125,7 @@ FONT 9, "MS UI Gothic" BEGIN ICON "", IDC_SHELL_ABOUT_ICON, 7, 55, 21, 20 LTEXT "", IDC_SHELL_ABOUT_APPNAME, 35, 55, 200, 10 - LTEXT "o[W " KERNEL_VERSION_STR " (" KERNEL_VERSION_BUILD_STR ")", IDC_STATIC, 35, 65, 235, 10 + LTEXT "o[W "KERNEL_VERSION_STR" ("KERNEL_VERSION_BUILD_STR")", IDC_STATIC, 35, 65, 235, 10 LTEXT REACTOS_DEFAULT_STR_LEGAL_COPYRIGHT, IDC_STATIC, 35, 75, 210, 10 LTEXT "", IDC_SHELL_ABOUT_OTHERSTUFF, 35, 90, 180, 20 LTEXT "ReactOS̃o[W͎̕ɓo^Ă܂:", IDC_STATIC, 35, 115, 180, 10 @@ -655,10 +655,7 @@ BEGIN IDS_CANTTRASH_TEXT " '%1' ͂ݔɑ܂B ɍ폜Ă낵ł?" IDS_OVERWRITEFILE_TEXT "̃tH_ɂ͊Ƀt@C'%1'܂܂Ă܂B\n\nuĂ낵ł?" IDS_OVERWRITEFILE_CAPTION "t@C㏑̊mF" - IDS_OVERWRITEFOLDER_TEXT "̃tH_ɂ͊ɃtH_'%1'܂܂Ă܂B\n\n"\ - "fBNgtH_̃t@CIꂽtH_̃t@C\n"\ - "Ɠ͒u܂BłAtH_ړ܂\n"\ - "Rs[܂?" + IDS_OVERWRITEFOLDER_TEXT "̃tH_ɂ͊ɃtH_'%1'܂܂Ă܂B\n\nfBNgtH_̃t@CIꂽtH_̃t@C\nƓ͒u܂BłAtH_ړ܂\nRs[܂?" /* message box strings */ IDS_RESTART_TITLE "ċN" diff --git a/dll/win32/shell32/lang/ko-KR.rc b/dll/win32/shell32/lang/ko-KR.rc index 0f746160c3d..3ac3b8db34c 100644 --- a/dll/win32/shell32/lang/ko-KR.rc +++ b/dll/win32/shell32/lang/ko-KR.rc @@ -125,7 +125,7 @@ FONT 8, "MS Shell Dlg" BEGIN ICON "", IDC_SHELL_ABOUT_ICON, 7, 55, 21, 20 LTEXT "", IDC_SHELL_ABOUT_APPNAME, 35, 55, 200, 10 - LTEXT "Version " KERNEL_VERSION_STR " (" KERNEL_VERSION_BUILD_STR ")", IDC_STATIC, 35, 65, 235, 10 + LTEXT "Version "KERNEL_VERSION_STR" ("KERNEL_VERSION_BUILD_STR")", IDC_STATIC, 35, 65, 235, 10 LTEXT REACTOS_DEFAULT_STR_LEGAL_COPYRIGHT, IDC_STATIC, 35, 75, 210, 10 LTEXT "", IDC_SHELL_ABOUT_OTHERSTUFF, 35, 90, 180, 20 LTEXT "This ReactOS version is registered to:", IDC_STATIC, 35, 115, 180, 10 @@ -655,10 +655,7 @@ BEGIN IDS_CANTTRASH_TEXT "The item '%1' can't be sent to Trash. Do you want to delete it instead?" IDS_OVERWRITEFILE_TEXT "This folder already contains a file called '%1'.\n\nDo you want to replace it?" IDS_OVERWRITEFILE_CAPTION "Confirm file overwrite" - IDS_OVERWRITEFOLDER_TEXT "This folder already contains a folder named '%1'.\n\n"\ - "If the files in the destination folder have the same names as files in the\n"\ - "selected folder they will be replaced. Do you still want to move or copy\n"\ - "the folder?" + IDS_OVERWRITEFOLDER_TEXT "This folder already contains a folder named '%1'.\n\nIf the files in the destination folder have the same names as files in the\nselected folder they will be replaced. Do you still want to move or copy\nthe folder?" /* message box strings */ IDS_RESTART_TITLE "Restart" diff --git a/dll/win32/shell32/lang/nl-NL.rc b/dll/win32/shell32/lang/nl-NL.rc index 0e55ef5c514..c1bac043c4d 100644 --- a/dll/win32/shell32/lang/nl-NL.rc +++ b/dll/win32/shell32/lang/nl-NL.rc @@ -125,7 +125,7 @@ FONT 8, "MS Shell Dlg" BEGIN ICON "", IDC_SHELL_ABOUT_ICON, 7, 55, 21, 20 LTEXT "", IDC_SHELL_ABOUT_APPNAME, 35, 55, 200, 10 - LTEXT "Version " KERNEL_VERSION_STR " (" KERNEL_VERSION_BUILD_STR ")", IDC_STATIC, 35, 65, 235, 10 + LTEXT "Version "KERNEL_VERSION_STR" ("KERNEL_VERSION_BUILD_STR")", IDC_STATIC, 35, 65, 235, 10 LTEXT REACTOS_DEFAULT_STR_LEGAL_COPYRIGHT, IDC_STATIC, 35, 75, 210, 10 LTEXT "", IDC_SHELL_ABOUT_OTHERSTUFF, 35, 90, 180, 20 LTEXT "This ReactOS version is registered to:", IDC_STATIC, 35, 115, 180, 10 @@ -655,10 +655,7 @@ BEGIN IDS_CANTTRASH_TEXT "The item '%1' can't be sent to Trash. Do you want to delete it instead?" IDS_OVERWRITEFILE_TEXT "This folder already contains a file called '%1'.\n\nDo you want to replace it?" IDS_OVERWRITEFILE_CAPTION "Confirm file overwrite" - IDS_OVERWRITEFOLDER_TEXT "This folder already contains a folder named '%1'.\n\n"\ - "If the files in the destination folder have the same names as files in the\n"\ - "selected folder they will be replaced. Do you still want to move or copy\n"\ - "the folder?" + IDS_OVERWRITEFOLDER_TEXT "This folder already contains a folder named '%1'.\n\nIf the files in the destination folder have the same names as files in the\nselected folder they will be replaced. Do you still want to move or copy\nthe folder?" /* message box strings */ IDS_RESTART_TITLE "Restart" diff --git a/dll/win32/shell32/lang/no-NO.rc b/dll/win32/shell32/lang/no-NO.rc index 5b5342912e0..adbe3b20f04 100644 --- a/dll/win32/shell32/lang/no-NO.rc +++ b/dll/win32/shell32/lang/no-NO.rc @@ -125,7 +125,7 @@ FONT 8, "MS Shell Dlg" BEGIN ICON "", IDC_SHELL_ABOUT_ICON, 7, 55, 21, 20 LTEXT "", IDC_SHELL_ABOUT_APPNAME, 35, 55, 200, 10 - LTEXT "Versjon " KERNEL_VERSION_STR " (" KERNEL_VERSION_BUILD_STR ")", IDC_STATIC, 35, 65, 235, 10 + LTEXT "Versjon "KERNEL_VERSION_STR" ("KERNEL_VERSION_BUILD_STR")", IDC_STATIC, 35, 65, 235, 10 LTEXT REACTOS_DEFAULT_STR_LEGAL_COPYRIGHT, IDC_STATIC, 35, 75, 210, 10 LTEXT "", IDC_SHELL_ABOUT_OTHERSTUFF, 35, 90, 180, 20 LTEXT "Denne ReactOS versjonen er registert til:", IDC_STATIC, 35, 115, 180, 10 @@ -658,10 +658,7 @@ BEGIN IDS_CANTTRASH_TEXT "Elementet %1 kan ikke legges i papirkurven. Vil du slette det i stedet?" IDS_OVERWRITEFILE_TEXT "Denne mapppen innholder allerede en fil som heter '%1'.\n\nVil du overskrive denne?" IDS_OVERWRITEFILE_CAPTION "Bekreft overskriving av fil" - IDS_OVERWRITEFOLDER_TEXT "Denne mappen inneholder allerede en mappe som heter '%1'.\n\n"\ - "Hvis filene i destinasjon mappen har samme navn filer i \n"\ - "valgte mapper her vil bli overskrevet. nsker du fortsatt flytte eller kopiere \n"\ - "denne mappen?" + IDS_OVERWRITEFOLDER_TEXT "Denne mappen inneholder allerede en mappe som heter '%1'.\n\nHvis filene i destinasjon mappen har samme navn filer i \nvalgte mapper her vil bli overskrevet. nsker du fortsatt flytte eller kopiere \ndenne mappen?" /* message box strings */ IDS_RESTART_TITLE "Starte p nytt" diff --git a/dll/win32/shell32/lang/pl-PL.rc b/dll/win32/shell32/lang/pl-PL.rc index 29f5d4922db..889057c6760 100644 --- a/dll/win32/shell32/lang/pl-PL.rc +++ b/dll/win32/shell32/lang/pl-PL.rc @@ -21,7 +21,7 @@ * Use ReactOS forum PM or IRC to contact me * http://www.reactos.org * IRC: irc.freenode.net #reactos-pl; - * updated by Saibamen - Adam Stachowicz (saibamenppl@gmail.com) (Apr, 2011) + * updated by Saibamen - Adam Stachowicz (saibamenppl@gmail.com) (August, 2011) */ LANGUAGE LANG_POLISH, SUBLANG_DEFAULT @@ -133,10 +133,10 @@ FONT 8, "MS Shell Dlg" BEGIN ICON "", IDC_SHELL_ABOUT_ICON, 7, 55, 21, 20 LTEXT "", IDC_SHELL_ABOUT_APPNAME, 35, 55, 200, 10 - LTEXT "Wersja " KERNEL_VERSION_STR " (" KERNEL_VERSION_BUILD_STR ")", IDC_STATIC, 35, 65, 235, 10 + LTEXT "Wersja "KERNEL_VERSION_STR" ("KERNEL_VERSION_BUILD_STR")", IDC_STATIC, 35, 65, 235, 10 LTEXT REACTOS_DEFAULT_STR_LEGAL_COPYRIGHT, IDC_STATIC, 35, 75, 210, 10 LTEXT "", IDC_SHELL_ABOUT_OTHERSTUFF, 35, 90, 180, 20 - LTEXT "Ta kopia ReactOS jest zarejestrowna na:", IDC_STATIC, 35, 115, 180, 10 + LTEXT "Ta kopia ReactOS jest zarejestrowana na:", IDC_STATIC, 35, 115, 180, 10 LTEXT "", IDC_SHELL_ABOUT_REG_USERNAME, 45, 125, 180, 10 LTEXT "", IDC_SHELL_ABOUT_REG_ORGNAME, 45, 135, 180, 10 LTEXT "", IDC_STATIC, 35, 147, 235, 1, SS_ETCHEDHORZ @@ -179,7 +179,7 @@ BEGIN LTEXT "", 14005, 78, 38, 142, 10 LTEXT "Lokalizacja:", 14006, 8, 58, 64, 10 EDITTEXT 14007, 79, 58, 141, 10, ES_LEFT | ES_READONLY | NOT WS_BORDER - LTEXT "Element docelowy:", 14008, 8, 77, 45, 10 + LTEXT "Element docelowy:", 14008, 8, 77, 60, 10 EDITTEXT 14009, 79, 75, 150, 14, ES_AUTOHSCROLL LTEXT "&Uruchom w:", 14010, 8, 96, 57, 10 EDITTEXT 14011, 79, 94, 150, 14, ES_AUTOHSCROLL @@ -663,10 +663,7 @@ BEGIN IDS_CANTTRASH_TEXT "Nie mog przenie elementu '%1' do Kosza. Czy chcesz go zamiast tego usun?" IDS_OVERWRITEFILE_TEXT "Ten folder zawiera ju plik o nazwie '%1'.\n\nCzy chcesz go zastpi?" IDS_OVERWRITEFILE_CAPTION "Potwierd zastpienie pliku" - IDS_OVERWRITEFOLDER_TEXT "Ten folder zawiera ju katalog o nazwie '%1'.\n\n"\ - "Jeeli w docelowym folderze wystpi pliki o takich samych nazwach jak\n"\ - "w wybranym folderze, to zostan one zastpione. Czy chcesz mimo to przenie\n"\ - "lub skopiowa folder?" + IDS_OVERWRITEFOLDER_TEXT "Ten folder zawiera ju katalog o nazwie '%1'.\n\nJeeli w docelowym folderze wystpi pliki o takich samych nazwach jak\nw wybranym folderze, to zostan one zastpione. Czy chcesz mimo to przenie\nlub skopiowa folder?" /* message box strings */ IDS_RESTART_TITLE "Uruchom ponownie" diff --git a/dll/win32/shell32/lang/pt-BR.rc b/dll/win32/shell32/lang/pt-BR.rc index b795809137b..a5ccf333d5f 100644 --- a/dll/win32/shell32/lang/pt-BR.rc +++ b/dll/win32/shell32/lang/pt-BR.rc @@ -127,7 +127,7 @@ FONT 8, "MS Shell Dlg" BEGIN ICON "", IDC_SHELL_ABOUT_ICON, 7, 55, 21, 20 LTEXT "", IDC_SHELL_ABOUT_APPNAME, 35, 55, 200, 10 - LTEXT "Version " KERNEL_VERSION_STR " (" KERNEL_VERSION_BUILD_STR ")", IDC_STATIC, 35, 65, 235, 10 + LTEXT "Version "KERNEL_VERSION_STR" ("KERNEL_VERSION_BUILD_STR")", IDC_STATIC, 35, 65, 235, 10 LTEXT REACTOS_DEFAULT_STR_LEGAL_COPYRIGHT, IDC_STATIC, 35, 75, 210, 10 LTEXT "", IDC_SHELL_ABOUT_OTHERSTUFF, 35, 90, 180, 20 LTEXT "This ReactOS version is registered to:", IDC_STATIC, 35, 115, 180, 10 @@ -657,10 +657,7 @@ BEGIN IDS_CANTTRASH_TEXT "The item '%1' can't be sent to Trash. Do you want to delete it instead?" IDS_OVERWRITEFILE_TEXT "This folder already contains a file called '%1'.\n\nDo you want to replace it?" IDS_OVERWRITEFILE_CAPTION "Confirmar sobreescrever arquivo" - IDS_OVERWRITEFOLDER_TEXT "This folder already contains a folder named '%1'.\n\n"\ - "If the files in the destination folder have the same names as files in the\n"\ - "selected folder they will be replaced. Do you still want to move or copy\n"\ - "the folder?" + IDS_OVERWRITEFOLDER_TEXT "This folder already contains a folder named '%1'.\n\nIf the files in the destination folder have the same names as files in the\nselected folder they will be replaced. Do you still want to move or copy\nthe folder?" /* message box strings */ IDS_RESTART_TITLE "Reiniciar" diff --git a/dll/win32/shell32/lang/pt-PT.rc b/dll/win32/shell32/lang/pt-PT.rc index 99d51b58331..005f63cfbe2 100644 --- a/dll/win32/shell32/lang/pt-PT.rc +++ b/dll/win32/shell32/lang/pt-PT.rc @@ -128,7 +128,7 @@ FONT 8, "MS Shell Dlg" BEGIN ICON "", IDC_SHELL_ABOUT_ICON, 7, 55, 21, 20 LTEXT "", IDC_SHELL_ABOUT_APPNAME, 35, 55, 200, 10 - LTEXT "Verso " KERNEL_VERSION_STR " (" KERNEL_VERSION_BUILD_STR ")", IDC_STATIC, 35, 65, 235, 10 + LTEXT "Verso "KERNEL_VERSION_STR" ("KERNEL_VERSION_BUILD_STR")", IDC_STATIC, 35, 65, 235, 10 LTEXT REACTOS_DEFAULT_STR_LEGAL_COPYRIGHT, IDC_STATIC, 35, 75, 210, 10 LTEXT "", IDC_SHELL_ABOUT_OTHERSTUFF, 35, 90, 180, 20 LTEXT "Esta verso do ReactOS registado a:", IDC_STATIC, 35, 115, 180, 10 @@ -658,10 +658,7 @@ BEGIN IDS_CANTTRASH_TEXT "O item '%1' no pode ser enviado para a reciclagem. Em vez disso pretende elimin-lo?" IDS_OVERWRITEFILE_TEXT "Esta pasta j contm um ficheiro com o nome '%1'.\n\npretende substitu-lo?" IDS_OVERWRITEFILE_CAPTION "Confirmar substituio de ficheiro" - IDS_OVERWRITEFOLDER_TEXT "Esta pasta j contm uma pasta com o nome '%1'.\n\n"\ - "Se os ficheiros na pasta de destino tiverem o mesmo nome dos ficheiros na\n"\ - "pasta seleccionada, sero substitudos. Ainda assim pretende mover ou copiar\n"\ - "a pasta?" + IDS_OVERWRITEFOLDER_TEXT "Esta pasta j contm uma pasta com o nome '%1'.\n\nSe os ficheiros na pasta de destino tiverem o mesmo nome dos ficheiros na\npasta seleccionada, sero substitudos. Ainda assim pretende mover ou copiar\na pasta?" /* message box strings */ IDS_RESTART_TITLE "Reiniciar" diff --git a/dll/win32/shell32/lang/ro-RO.rc b/dll/win32/shell32/lang/ro-RO.rc index ebf83231aa9..a0979c8acf3 100644 --- a/dll/win32/shell32/lang/ro-RO.rc +++ b/dll/win32/shell32/lang/ro-RO.rc @@ -127,7 +127,7 @@ FONT 8, "MS Shell Dlg" BEGIN ICON "", IDC_SHELL_ABOUT_ICON, 7, 55, 21, 20 LTEXT "", IDC_SHELL_ABOUT_APPNAME, 35, 55, 200, 10 - LTEXT "Versiune " KERNEL_VERSION_STR " (" KERNEL_VERSION_BUILD_STR ")", IDC_STATIC, 35, 65, 235, 10 + LTEXT "Versiune "KERNEL_VERSION_STR" ("KERNEL_VERSION_BUILD_STR")", IDC_STATIC, 35, 65, 235, 10 LTEXT REACTOS_DEFAULT_STR_LEGAL_COPYRIGHT, IDC_STATIC, 35, 75, 210, 10 LTEXT "", IDC_SHELL_ABOUT_OTHERSTUFF, 35, 90, 180, 20 LTEXT "Versiune de ReactOS înregistrată pentru:", IDC_STATIC, 35, 115, 180, 10 @@ -658,10 +658,7 @@ BEGIN IDS_CANTTRASH_TEXT "Elementul '%1' nu poate fi trimit la gunoi. Vreți să îl ștergeți definitiv în schimb?" IDS_OVERWRITEFILE_TEXT "Acest dosar deja conține un fișier numit '%1'.\n\nVreți să îl înlocuiți" IDS_OVERWRITEFILE_CAPTION "Confirmare înlocuire fișier" - IDS_OVERWRITEFOLDER_TEXT "Acest dosar deja conține un sub-dosar cu numele '%1'.\n\n"\ - "Dacă fișierele din dosarul de destinație au același nume ca cele din\n"\ - "dosarul selectat, ele vor fi înlocuite. Sigur vreți să copiați sau\n"\ - "mutați dosarul?" + IDS_OVERWRITEFOLDER_TEXT "Acest dosar deja conține un sub-dosar cu numele '%1'.\n\nDacă fișierele din dosarul de destinație au același nume ca cele din\ndosarul selectat, ele vor fi înlocuite. Sigur vreți să copiați sau\nmutați dosarul?" /* message box strings */ IDS_RESTART_TITLE "Repornire" diff --git a/dll/win32/shell32/lang/ru-RU.rc b/dll/win32/shell32/lang/ru-RU.rc index 36de151db0d..28f8f7a7cd1 100644 --- a/dll/win32/shell32/lang/ru-RU.rc +++ b/dll/win32/shell32/lang/ru-RU.rc @@ -21,10 +21,10 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT MENU_001 MENU DISCARDABLE BEGIN - MENUITEM "& ", FCIDM_SHVIEW_BIGICON - MENUITEM "& ", FCIDM_SHVIEW_SMALLICON - MENUITEM "&", FCIDM_SHVIEW_LISTVIEW - MENUITEM "&", FCIDM_SHVIEW_REPORTVIEW + MENUITEM "&Большие значки", FCIDM_SHVIEW_BIGICON + MENUITEM "&Мелкие значки", FCIDM_SHVIEW_SMALLICON + MENUITEM "&Список", FCIDM_SHVIEW_LISTVIEW + MENUITEM "&Подробно", FCIDM_SHVIEW_REPORTVIEW END /* shellview background menu */ @@ -32,31 +32,31 @@ MENU_002 MENU DISCARDABLE BEGIN POPUP "" BEGIN - POPUP "&" + POPUP "&Просмотр" BEGIN - MENUITEM "& ", FCIDM_SHVIEW_BIGICON - MENUITEM "& ", FCIDM_SHVIEW_SMALLICON - MENUITEM "&", FCIDM_SHVIEW_LISTVIEW - MENUITEM "&", FCIDM_SHVIEW_REPORTVIEW + MENUITEM "&Большие значки", FCIDM_SHVIEW_BIGICON + MENUITEM "&Мелкие значки", FCIDM_SHVIEW_SMALLICON + MENUITEM "&Список", FCIDM_SHVIEW_LISTVIEW + MENUITEM "&Подробно", FCIDM_SHVIEW_REPORTVIEW END MENUITEM SEPARATOR - POPUP " &" + POPUP "Упорядочить &значки" BEGIN - MENUITEM " &", 0x30 /* column 0 */ - MENUITEM " &", 0x32 /* column 2 */ - MENUITEM " &", 0x31 /* ... */ - MENUITEM " &", 0x33 + MENUITEM "По &имени", 0x30 /* column 0 */ + MENUITEM "По &типу", 0x32 /* column 2 */ + MENUITEM "По &размеру", 0x31 /* ... */ + MENUITEM "По &дате", 0x33 MENUITEM SEPARATOR - MENUITEM "&", FCIDM_SHVIEW_AUTOARRANGE + MENUITEM "&Автоматически", FCIDM_SHVIEW_AUTOARRANGE END - MENUITEM "& ", FCIDM_SHVIEW_SNAPTOGRID + MENUITEM "В&ыровнять значки", FCIDM_SHVIEW_SNAPTOGRID MENUITEM SEPARATOR - MENUITEM "&", FCIDM_SHVIEW_REFRESH + MENUITEM "О&бновить", FCIDM_SHVIEW_REFRESH MENUITEM SEPARATOR - MENUITEM "&", FCIDM_SHVIEW_INSERT - MENUITEM " &", FCIDM_SHVIEW_INSERTLINK + MENUITEM "&Вставить", FCIDM_SHVIEW_INSERT + MENUITEM "Вставить &ярлык", FCIDM_SHVIEW_INSERTLINK MENUITEM SEPARATOR - MENUITEM "&", FCIDM_SHVIEW_PROPERTIES + MENUITEM "Сво&йства", FCIDM_SHVIEW_PROPERTIES END END @@ -65,27 +65,27 @@ MENU_SHV_FILE MENU DISCARDABLE BEGIN POPUP "" BEGIN - MENUITEM "&", FCIDM_SHVIEW_EXPLORE - MENUITEM "&", FCIDM_SHVIEW_OPEN + MENUITEM "&Проводник", FCIDM_SHVIEW_EXPLORE + MENUITEM "&Открыть", FCIDM_SHVIEW_OPEN MENUITEM SEPARATOR - MENUITEM "&", FCIDM_SHVIEW_CUT - MENUITEM "&", FCIDM_SHVIEW_COPY + MENUITEM "&Вырезать", FCIDM_SHVIEW_CUT + MENUITEM "&Копировать", FCIDM_SHVIEW_COPY MENUITEM SEPARATOR - MENUITEM " &", FCIDM_SHVIEW_CREATELINK - MENUITEM "&", FCIDM_SHVIEW_DELETE - MENUITEM "&", FCIDM_SHVIEW_RENAME + MENUITEM "Создать &ярлык", FCIDM_SHVIEW_CREATELINK + MENUITEM "&Удалить", FCIDM_SHVIEW_DELETE + MENUITEM "Переи&меновать", FCIDM_SHVIEW_RENAME MENUITEM SEPARATOR - MENUITEM "&", FCIDM_SHVIEW_PROPERTIES + MENUITEM "Сво&йства", FCIDM_SHVIEW_PROPERTIES END END SHBRSFORFOLDER_MSGBOX DIALOGEX LOADONCALL MOVEABLE DISCARDABLE 15, 40, 188, 192 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU -CAPTION "" +CAPTION "Обзор" FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "OK", 1, 80, 174, 50, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP - PUSHBUTTON "", 2, 134, 174, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "Отмена", 2, 134, 174, 50, 14, WS_GROUP | WS_TABSTOP LTEXT "", IDD_TITLE, 4, 4, 180, 12 LTEXT "", IDD_STATUS, 4, 25, 180, 12 CONTROL "", IDD_TREEVIEW, "SysTreeView32", TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | WS_BORDER | WS_TABSTOP, 4, 40, 180, 120 @@ -93,47 +93,47 @@ END SHNEWBRSFORFOLDER_MSGBOX DIALOGEX LOADONCALL MOVEABLE DISCARDABLE 15, 40, 218, 196 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU -CAPTION "" +CAPTION "Обзор" FONT 8, "MS Shell Dlg" BEGIN LTEXT "", IDD_TITLE, 10, 8, 198, 24 LTEXT "", IDD_STATUS, 10, 25, 198, 12 - LTEXT ":", IDD_FOLDER, 10, 152, 40, 12 + LTEXT "Папка:", IDD_FOLDER, 10, 152, 40, 12 CONTROL "", IDD_TREEVIEW, "SysTreeView32", TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | WS_BORDER | WS_TABSTOP, 12, 38, 194, 105 EDITTEXT IDD_FOLDERTEXT, 46, 150, 160, 14, WS_BORDER | WS_GROUP | WS_TABSTOP - PUSHBUTTON "& ", IDD_MAKENEWFOLDER, 12, 174, 77, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&Создать папку", IDD_MAKENEWFOLDER, 12, 174, 77, 14, WS_GROUP | WS_TABSTOP DEFPUSHBUTTON "OK", IDOK, 102, 174, 50, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP - PUSHBUTTON "", IDCANCEL, 156, 174, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "Отменить", IDCANCEL, 156, 174, 50, 14, WS_GROUP | WS_TABSTOP END SHELL_YESTOALL_MSGBOX DIALOGEX 200, 100, 280, 90 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "" +CAPTION "Уведомление" FONT 8, "MS Shell Dlg" BEGIN - DEFPUSHBUTTON "&", IDYES, 34, 69, 53, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON "& ", IDD_YESTOALL, 92, 69, 65, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON "&", IDNO, 162, 69, 53, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON "&", IDCANCEL, 220, 69, 53, 14, WS_GROUP | WS_TABSTOP + DEFPUSHBUTTON "&Да", IDYES, 34, 69, 53, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "Д&а для всех", IDD_YESTOALL, 92, 69, 65, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&Нет", IDNO, 162, 69, 53, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&Отмена", IDCANCEL, 220, 69, 53, 14, WS_GROUP | WS_TABSTOP ICON "", IDD_ICON, 10, 10, 16, 16 LTEXT "", IDD_MESSAGE, 40, 10, 238, 52, 0 END IDD_SHELL_ABOUT DIALOGEX LOADONCALL MOVEABLE DISCARDABLE 0, 0, 275, 198 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " %s" +CAPTION "О %s" FONT 8, "MS Shell Dlg" BEGIN ICON "", IDC_SHELL_ABOUT_ICON, 7, 55, 21, 20 LTEXT "", IDC_SHELL_ABOUT_APPNAME, 35, 55, 200, 10 - LTEXT " " KERNEL_VERSION_STR " (" KERNEL_VERSION_BUILD_STR ")", IDC_STATIC, 35, 65, 235, 10 + LTEXT "Версия "KERNEL_VERSION_STR" ("KERNEL_VERSION_BUILD_STR")", IDC_STATIC, 35, 65, 235, 10 LTEXT REACTOS_DEFAULT_STR_LEGAL_COPYRIGHT, IDC_STATIC, 35, 75, 210, 10 LTEXT "", IDC_SHELL_ABOUT_OTHERSTUFF, 35, 90, 180, 20 - LTEXT " ReactOS :", IDC_STATIC, 35, 115, 180, 10 + LTEXT "Данная версия ReactOS зарегистрирована на:", IDC_STATIC, 35, 115, 180, 10 LTEXT "", IDC_SHELL_ABOUT_REG_USERNAME, 45, 125, 180, 10 LTEXT "", IDC_SHELL_ABOUT_REG_ORGNAME, 45, 135, 180, 10 LTEXT "", IDC_STATIC, 35, 147, 235, 1, SS_ETCHEDHORZ - LTEXT " :", IDC_STATIC, 35, 152, 130, 10 + LTEXT "Доступная физическая память:", IDC_STATIC, 35, 152, 130, 10 LTEXT "", IDC_SHELL_ABOUT_PHYSMEM, 167, 152, 88, 10 DEFPUSHBUTTON "OK", IDOK, 220, 178, 50, 14 @@ -144,7 +144,7 @@ IDD_SHELL_ABOUT_AUTHORS DIALOGEX MOVEABLE DISCARDABLE 35, 90, 235, 85 STYLE DS_SHELLFONT | WS_CHILD FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ReactOS:", IDC_STATIC, 0, 0, 180, 10 + LTEXT "Разработчики ReactOS:", IDC_STATIC, 0, 0, 180, 10 LISTBOX IDC_SHELL_ABOUT_AUTHORS_LISTBOX, 0, 10, 165, 75 END @@ -154,612 +154,610 @@ CAPTION "" FONT 8, "MS Shell Dlg" BEGIN ICON "", 12297, 7, 11, 18, 20, WS_VISIBLE - LTEXT " , , , ReactOS .", 12289, 36, 11, 182, 18 - LTEXT "&:", 12305, 5, 39, 34, 10 + LTEXT "Введите имя программы, папки, документа или ресурс Интернета, и ReactOS откроет их.", 12289, 36, 11, 182, 18 + LTEXT "&Открыть:", 12305, 5, 39, 34, 10 CONTROL "", 12298, "COMBOBOX", WS_TABSTOP | WS_GROUP | WS_VSCROLL | WS_VISIBLE | CBS_AUTOHSCROLL | CBS_DROPDOWN, 40, 37, 183, 100 DEFPUSHBUTTON "OK", IDOK, 62, 63, 50, 14, WS_TABSTOP - PUSHBUTTON "", IDCANCEL, 116, 63, 50, 14, WS_TABSTOP - PUSHBUTTON "&...", 12288, 170, 63, 50, 14, WS_TABSTOP + PUSHBUTTON "Отмена", IDCANCEL, 116, 63, 50, 14, WS_TABSTOP + PUSHBUTTON "Об&зор...", 12288, 170, 63, 50, 14, WS_TABSTOP END SHELL_GENERAL_SHORTCUT_DLG DIALOGEX 0, 0, 235, 215 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Ярлык" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN ICON "", 14000, 10, 4, 30, 30, WS_VISIBLE - LTEXT " :", 14004, 8, 38, 64, 10 + LTEXT "Тип объекта:", 14004, 8, 38, 64, 10 LTEXT "", 14005, 78, 38, 142, 10 - LTEXT ":", 14006, 8, 58, 64, 10 + LTEXT "Размещение:", 14006, 8, 58, 64, 10 EDITTEXT 14007, 79, 58, 141, 10, ES_LEFT | ES_READONLY | NOT WS_BORDER - LTEXT ":", 14008, 8, 77, 45, 10 + LTEXT "Объект:", 14008, 8, 77, 45, 10 EDITTEXT 14009, 79, 75, 150, 14, ES_AUTOHSCROLL - LTEXT "& :", 14010, 8, 96, 57, 10 + LTEXT "&Рабочая папка:", 14010, 8, 96, 57, 10 EDITTEXT 14011, 79, 94, 150, 14, ES_AUTOHSCROLL - LTEXT "& :", 14014, 8, 115, 57, 10 + LTEXT "Б&ыстрый вызов:", 14014, 8, 115, 57, 10 EDITTEXT 14015, 79, 112, 150, 14, ES_LEFT - LTEXT ":", 14016, 8, 134, 57, 10 + LTEXT "Окно:", 14016, 8, 134, 57, 10 EDITTEXT 14017, 79, 131, 150, 14, ES_AUTOHSCROLL - LTEXT "&:", 14018, 8, 152, 57, 10 + LTEXT "&Коментарий:", 14018, 8, 152, 57, 10 EDITTEXT 14019, 79, 149, 150, 14, ES_AUTOHSCROLL - PUSHBUTTON "& ...", 14020, 9, 172, 70, 14, ES_LEFT - PUSHBUTTON "& ...", 14021, 84, 172, 70, 14, ES_LEFT - PUSHBUTTON "&...", 14022, 159, 172, 70, 14, ES_LEFT + PUSHBUTTON "&Найти объект...", 14020, 9, 172, 70, 14, ES_LEFT + PUSHBUTTON "См&енить значок...", 14021, 84, 172, 70, 14, ES_LEFT + PUSHBUTTON "&Дополнительно...", 14022, 159, 172, 70, 14, ES_LEFT END SHELL_EXTENDED_SHORTCUT_DLG DIALOGEX 0, 0, 230, 150 STYLE DS_SHELLFONT | WS_POPUP | WS_CAPTION -CAPTION " " +CAPTION "Дополнительные свойства" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT " .", -1, 5, 30, 210, 10 - CHECKBOX " ", 14000, 25, 50, 150, 10 - LTEXT " & , , .", -1, 50, 60, 175, 40 - CHECKBOX "& ", 14001, 25, 104, 160, 10, WS_DISABLED + LTEXT "Установите нужные свойства для этого ярлыка.", -1, 5, 30, 210, 10 + CHECKBOX "Запускать с другими учетными данными", 14000, 25, 50, 150, 10 + LTEXT "Позволяет использовать этот ярлык для запуска программы от &имени администратора, в то же время продолжая работу от своего имени, что защищает компьютер от несанкционированных действий других программ.", -1, 50, 60, 175, 40 + CHECKBOX "Запус&кать в отдельной области памяти", 14001, 25, 104, 160, 10, WS_DISABLED PUSHBUTTON "OK", IDOK, 54, 123, 50, 14, WS_VISIBLE - PUSHBUTTON "", IDCANCEL, 120, 123, 50, 14, WS_VISIBLE + PUSHBUTTON "Отмена", IDCANCEL, 120, 123, 50, 14, WS_VISIBLE END SHELL_FOLDER_GENERAL_DLG DIALOGEX 0, 0, 240, 205 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Общие" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN ICON "", 14000, 10, 3, 30, 30, WS_VISIBLE EDITTEXT 14001, 70, 9, 158, 14, ES_LEFT | ES_READONLY - LTEXT " :", 14004, 8, 35, 50, 10 - LTEXT "", 14005, 68, 35, 160, 10 - LTEXT ":", 14006, 8, 53, 50, 10 + LTEXT "Тип файла:", 14004, 8, 35, 50, 10 + LTEXT "Папка", 14005, 68, 35, 160, 10 + LTEXT "Расположение:", 14006, 8, 53, 50, 10 EDITTEXT 14007, 68, 53, 315, 10, ES_LEFT | ES_READONLY | NOT WS_BORDER - LTEXT ":", 14008, 8, 72, 45, 10 + LTEXT "Размер:", 14008, 8, 72, 45, 10 EDITTEXT 14009, 68, 72, 315, 10, ES_LEFT | ES_READONLY | NOT WS_BORDER - LTEXT ":", 14010, 8, 93, 45, 10 + LTEXT "Содержит:", 14010, 8, 93, 45, 10 EDITTEXT 14011, 68, 93, 160, 10, ES_LEFT | ES_READONLY | NOT WS_BORDER - LTEXT ":", 14014, 8, 118, 45, 10 + LTEXT "Создано:", 14014, 8, 118, 45, 10 EDITTEXT 14015, 68, 118, 160, 10, ES_LEFT | ES_READONLY | NOT WS_BORDER - AUTOCHECKBOX "& ", 14021, 45, 150, 67, 10 - AUTOCHECKBOX "&", 14022, 126, 150, 50, 10 + AUTOCHECKBOX "&Только чтение", 14021, 45, 150, 67, 10 + AUTOCHECKBOX "&Скрыто", 14022, 126, 150, 50, 10 END SHELL_FILE_GENERAL_DLG DIALOGEX 0, 0, 240, 205 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Общие" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN ICON "", 14000, 10, 3, 30, 30, WS_VISIBLE EDITTEXT 14001, 70, 9, 158, 14, ES_LEFT | ES_READONLY - LTEXT " :", 14004, 8, 35, 50, 10 - LTEXT "", 14005, 68, 35, 160, 10 - LTEXT ":", 14006, 8, 53, 50, 10 + LTEXT "Тип файла:", 14004, 8, 35, 50, 10 + LTEXT "файл", 14005, 68, 35, 160, 10 + LTEXT "Приложение:", 14006, 8, 53, 50, 10 EDITTEXT 14007, 68, 53, 160, 10, ES_LEFT | ES_READONLY | NOT WS_BORDER - LTEXT ":", 14008, 8, 72, 45, 10 + LTEXT "Размещение:", 14008, 8, 72, 45, 10 EDITTEXT 14009, 68, 72, 315, 10, ES_LEFT | ES_READONLY | NOT WS_BORDER - LTEXT ":", 14010, 8, 93, 45, 10 + LTEXT "Размер:", 14010, 8, 93, 45, 10 EDITTEXT 14011, 68, 93, 160, 10, ES_LEFT | ES_READONLY | NOT WS_BORDER - LTEXT ":", 14014, 8, 118, 45, 10 + LTEXT "Создан:", 14014, 8, 118, 45, 10 EDITTEXT 14015, 68, 118, 160, 10, ES_LEFT | ES_READONLY | NOT WS_BORDER - LTEXT ":", 14016, 8, 140, 45, 10 + LTEXT "Изменен:", 14016, 8, 140, 45, 10 EDITTEXT 14017, 68, 140, 160, 10, ES_LEFT | ES_READONLY | NOT WS_BORDER - LTEXT ":", 14018, 8, 160, 45, 10 + LTEXT "Открыт:", 14018, 8, 160, 45, 10 EDITTEXT 14019, 68, 160, 160, 10, ES_LEFT | ES_READONLY | NOT WS_BORDER - LTEXT ":", 14020, 8, 189, 45, 10 - CHECKBOX " &", 14021, 58, 189, 67, 10 - CHECKBOX "&", 14022, 126, 189, 50, 10 - CHECKBOX "&", 14023, 181, 189, 49, 10 + LTEXT "Атрибуты:", 14020, 8, 189, 45, 10 + CHECKBOX "Только &чтение", 14021, 58, 189, 67, 10 + CHECKBOX "Скр&ытый", 14022, 126, 189, 50, 10 + CHECKBOX "&Архивный", 14023, 181, 189, 49, 10 END SHELL_FILE_VERSION_DLG DIALOGEX 0, 0, 235, 215 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Версия" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT " : ", 14000, 10, 10, 55, 10 + LTEXT "Версия файла: ", 14000, 10, 10, 55, 10 EDITTEXT 14001, 77, 10, 152, 10, ES_LEFT | ES_READONLY | NOT WS_BORDER - LTEXT ": ", 14002, 10, 27, 45, 10 + LTEXT "Описание: ", 14002, 10, 27, 45, 10 EDITTEXT 14003, 77, 27, 152, 10, ES_LEFT | ES_READONLY | NOT WS_BORDER - LTEXT " : ", 14004, 10, 46, 66, 10 + LTEXT "Авторские права: ", 14004, 10, 46, 66, 10 EDITTEXT 14005, 77, 46, 152, 10, ES_LEFT | ES_READONLY | NOT WS_BORDER - GROUPBOX " : ", 14006, 6, 70, 222, 115 - LTEXT " : ", 14007, 13, 82, 63, 10 - LTEXT ": ", 14008, 112, 82, 45, 10 + GROUPBOX "Дополнительные сведения: ", 14006, 6, 70, 222, 115 + LTEXT "Имя элемента: ", 14007, 13, 82, 63, 10 + LTEXT "Значение: ", 14008, 112, 82, 45, 10 LISTBOX 14009, 12, 94, 94, 83, LBS_STANDARD | WS_TABSTOP | LBS_NOTIFY EDITTEXT 14010, 112, 93, 109, 83, ES_LEFT | WS_BORDER | WS_VSCROLL | WS_GROUP | ES_MULTILINE | ES_READONLY END DRIVE_GENERAL_DLG DIALOGEX 0, 0, 240, 230 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Общие" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN EDITTEXT 14000, 40, 20, 190, 14, ES_LEFT|WS_BORDER|WS_GROUP - LTEXT ":", -1, 15, 49, 40, 10 + LTEXT "Тип:", -1, 15, 49, 40, 10 EDITTEXT 14001, 110, 49, 100, 10, ES_LEFT | ES_READONLY | NOT WS_BORDER - LTEXT " :", -1, 15, 68, 86, 10 + LTEXT "Файловая система:", -1, 15, 68, 86, 10 EDITTEXT 14002, 110, 68, 100, 10, ES_LEFT | ES_READONLY | NOT WS_BORDER CONTROL "", 14013, "STATIC", SS_OWNERDRAW | SS_NOTIFY | SS_SUNKEN, 5, 90, 10, 10 - LTEXT ":", -1, 25, 90, 78, 10 + LTEXT "Занято:", -1, 25, 90, 78, 10 EDITTEXT 14003, 110, 90, 85, 10, ES_LEFT | ES_READONLY | NOT WS_BORDER EDITTEXT 14004, 200, 90, 40, 10, ES_LEFT | ES_READONLY | NOT WS_BORDER CONTROL "", 14014, "STATIC", SS_OWNERDRAW | SS_NOTIFY | SS_SUNKEN, 5, 105, 10, 10 - LTEXT ":", -1, 25, 105, 70, 10 + LTEXT "Свободно:", -1, 25, 105, 70, 10 EDITTEXT 14005, 110, 105, 85, 10, ES_LEFT | ES_READONLY | NOT WS_BORDER EDITTEXT 14006, 200, 105, 40, 10, ES_LEFT | ES_READONLY | NOT WS_BORDER - LTEXT ":", -1, 25, 125, 80, 10 + LTEXT "Емкость:", -1, 25, 125, 80, 10 EDITTEXT 14007, 110, 125, 85, 10, ES_LEFT | ES_READONLY | NOT WS_BORDER EDITTEXT 14008, 200, 125, 40, 10, ES_LEFT | ES_READONLY | NOT WS_BORDER CONTROL "", 14015, "STATIC", SS_OWNERDRAW | SS_NOTIFY | SS_SUNKEN, 20, 140, 200, 20 - LTEXT " %s", 14009, 100, 170, 52, 10 - PUSHBUTTON " ", 14010, 166, 175, 64, 15, WS_TABSTOP - CHECKBOX "& ", 14011, 15, 205, 180, 10, WS_DISABLED - CHECKBOX " & ", 14012, 15, 220, 216, 10, WS_DISABLED + LTEXT "Диск %s", 14009, 100, 170, 52, 10 + PUSHBUTTON "Очистка диска", 14010, 166, 175, 64, 15, WS_TABSTOP + CHECKBOX "&Сжимать для экономии места", 14011, 15, 205, 180, 10, WS_DISABLED + CHECKBOX "Разрешить &индексирование диска для быстрого поиска", 14012, 15, 220, 216, 10, WS_DISABLED END DRIVE_EXTRA_DLG DIALOGEX 0, 0, 240, 230 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Сервис" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - GROUPBOX " ", -1, 5, 5, 230, 60 - LTEXT " .", -1, 40, 25, 160, 20 - PUSHBUTTON " &...", 14000, 116, 45, 112, 15, WS_TABSTOP - GROUPBOX " ", -1, 5, 65, 230, 60 - LTEXT " , .", -1, 40, 85, 160, 20 - PUSHBUTTON " &...", 14001, 116, 105, 112, 15, WS_TABSTOP - GROUPBOX "", -1, 5, 130, 230, 60 - LTEXT " , .", -1, 40, 150, 160, 20 - PUSHBUTTON " &...", 14002, 116, 170, 112, 15, WS_TABSTOP + GROUPBOX "Проверка диска", -1, 5, 5, 230, 60 + LTEXT "Проверка тома на наличие ошибок.", -1, 40, 25, 160, 20 + PUSHBUTTON "Выполнить &проверку...", 14000, 116, 45, 112, 15, WS_TABSTOP + GROUPBOX "Дефрагментация диска", -1, 5, 65, 230, 60 + LTEXT "Дефрагментация файлов, хранящихся на этом томе.", -1, 40, 85, 160, 20 + PUSHBUTTON "Выполнить д&ефрагментацию...", 14001, 116, 105, 112, 15, WS_TABSTOP + GROUPBOX "Архивация", -1, 5, 130, 230, 60 + LTEXT "Архивация файлов, хранящихся на этом томе.", -1, 40, 150, 160, 20 + PUSHBUTTON "Выполнить &архивацию...", 14002, 116, 170, 112, 15, WS_TABSTOP END DRIVE_HARDWARE_DLG DIALOGEX 0, 0, 240, 230 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Оборудование" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN END RUN_AS_DIALOG DIALOGEX 0, 0, 252, 190 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Запуск от другого имени" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT " ?", -1, 10, 19, 230, 20 - CHECKBOX " %s", 14000, 10, 42, 210, 10 - LTEXT " .", -1, 21, 57, 225, 20, WS_DISABLED - CHECKBOX " , ", 14001, 25, 79, 221, 24, BS_MULTILINE | WS_DISABLED - CHECKBOX " :", 14002, 10, 110, 187, 10 - LTEXT " :", -1, 16, 133, 54, 10 + LTEXT "От имени какого пользователя вы хотите запустить программу?", -1, 10, 19, 230, 20 + CHECKBOX "Текущий пользователь %s", 14000, 10, 42, 210, 10 + LTEXT "Защитить мой компьютер и мои данные от несанкционированной деятельности программ.", -1, 21, 57, 225, 20, WS_DISABLED + CHECKBOX "Данная опция может защитить ваш компьютер и данные от вирусов, но программа может работать неправильно", 14001, 25, 79, 221, 24, BS_MULTILINE | WS_DISABLED + CHECKBOX "Запустить от имени следующего пользователя:", 14002, 10, 110, 187, 10 + LTEXT "Имя пользователя:", -1, 16, 133, 54, 10 COMBOBOX 14003, 76, 130, 100, 15, CBS_DROPDOWNLIST | WS_VSCROLL | WS_VISIBLE | WS_TABSTOP PUSHBUTTON "...", 14004, 180, 130, 30, 14, WS_TABSTOP - LTEXT ":", -1, 16, 152, 60, 10 + LTEXT "Пароль:", -1, 16, 152, 60, 10 EDITTEXT 14005, 76, 148, 100, 14, ES_LEFT | WS_BORDER | WS_GROUP PUSHBUTTON "...", 14006, 180, 148, 30, 14, WS_TABSTOP PUSHBUTTON "OK", 14007, 59, 170, 60, 14, WS_TABSTOP - PUSHBUTTON "", 14008, 125, 170, 60, 14, WS_TABSTOP + PUSHBUTTON "Отмена", 14008, 125, 170, 60, 14, WS_TABSTOP END BITBUCKET_PROPERTIES_DLG DIALOGEX 0, 0, 240, 190 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION ": " +CAPTION "Свойства: Корзина" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN CONTROL "", 14000, "SysListView32", LVS_REPORT | LVS_SHAREIMAGELISTS | WS_BORDER | WS_TABSTOP, 10, 10, 220, 50 - GROUPBOX " ", -1, 10, 66, 220, 73 - RADIOBUTTON "& :", 14001, 17, 80, 80, 10, NOT WS_TABSTOP + GROUPBOX "Установки для выбранного расположения", -1, 10, 66, 220, 73 + RADIOBUTTON "&Другой размер:", 14001, 17, 80, 80, 10, NOT WS_TABSTOP EDITTEXT 14002, 100, 78, 65, 14, WS_TABSTOP | ES_NUMBER - LTEXT "& ():", -1, 17, 95, 102, 10 - RADIOBUTTON "& , .", 14003, 17, 108, 206, 20, BS_MULTILINE | WS_TABSTOP - AUTOCHECKBOX "& ", 14004, 20, 145, 176, 10, WS_TABSTOP + LTEXT "&Максимальный размер(Мб):", -1, 17, 95, 102, 10 + RADIOBUTTON "&Уничтожать файлы сразу после удаления, не помещая их в корзину.", 14003, 17, 108, 206, 20, BS_MULTILINE | WS_TABSTOP + AUTOCHECKBOX "&Запрашивать подтверждение на удаление", 14004, 20, 145, 176, 10, WS_TABSTOP END OPEN_WITH_PROGRAMM_DLG DIALOGEX 0, 0, 264, 256 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUPWINDOW | WS_CAPTION -CAPTION " " +CAPTION "Выбор программы" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN ICON IDI_SHELL_OPEN_WITH, -1, 8, 12, 21, 20 - LTEXT " .", -1, 44, 12, 211, 10 - LTEXT ": ", 14001, 44, 25, 188, 10 - GROUPBOX "", -1, 7, 42, 249, 187 + LTEXT "Выберите программу для открытия этого файла.", -1, 44, 12, 211, 10 + LTEXT "Файл: ", 14001, 44, 25, 188, 10 + GROUPBOX "Программы", -1, 7, 42, 249, 187 LISTBOX 14002, 16 ,57, 230, 130, LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP, WS_EX_STATICEDGE - AUTOCHECKBOX "& ", 14003, 20, 193, 225, 10 - PUSHBUTTON "&...", 14004, 198, 207, 50, 14 + AUTOCHECKBOX "&Использовать ее для всех файлов такого типа", 14003, 20, 193, 225, 10 + PUSHBUTTON "&Обзор...", 14004, 198, 207, 50, 14 PUSHBUTTON "OK", 14005, 150, 236, 50, 14 - PUSHBUTTON "", 14006, 206, 236, 50, 14 + PUSHBUTTON "Отмена", 14006, 206, 236, 50, 14 END FOLDER_OPTIONS_GENERAL_DLG DIALOGEX 0, 0, 264, 238 STYLE DS_SHELLFONT | WS_POPUP | WS_CAPTION -CAPTION "" +CAPTION "Общие" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - GROUPBOX "", -1, 7, 10, 249, 45 + GROUPBOX "Задачи", -1, 7, 10, 249, 45 ICON "", 30109, 14, 24, 21, 20, SS_REALSIZECONTROL - AUTORADIOBUTTON "& ", 14001, 40, 24, 185, 10, WS_TABSTOP | WS_GROUP - AUTORADIOBUTTON " & ReactOS", 14002, 40, 36, 185, 10, WS_TABSTOP | WS_GROUP - GROUPBOX " ", -1, 7, 60, 249, 45, WS_TABSTOP + AUTORADIOBUTTON "Отобра&жение списка типичных задач в папках", 14001, 40, 24, 185, 10, WS_TABSTOP | WS_GROUP + AUTORADIOBUTTON "Использовать обы&чные папки ReactOS", 14002, 40, 36, 185, 10, WS_TABSTOP | WS_GROUP + GROUPBOX "Обзор папок", -1, 7, 60, 249, 45, WS_TABSTOP ICON "", 30110, 14, 75, 21, 20, SS_REALSIZECONTROL - AUTORADIOBUTTON "& ", 14004, 40, 75, 185, 10, WS_TABSTOP | WS_GROUP - AUTORADIOBUTTON "& ", 14005, 40, 87, 185, 10, WS_TABSTOP | WS_GROUP - GROUPBOX " ", -1, 7, 110, 249, 60 + AUTORADIOBUTTON "&Открывать папки в одном и том же окне", 14004, 40, 75, 185, 10, WS_TABSTOP | WS_GROUP + AUTORADIOBUTTON "О&ткрывать каждую папку в отдельном окне", 14005, 40, 87, 185, 10, WS_TABSTOP | WS_GROUP + GROUPBOX "Щелчки мышью", -1, 7, 110, 249, 60 ICON "", 30111, 14, 120, 21, 20, SS_REALSIZECONTROL - AUTORADIOBUTTON "& , ", 14007, 40, 120, 200, 10, WS_TABSTOP | WS_GROUP - AUTORADIOBUTTON "& ", 14008, 50, 132, 170, 10, WS_TABSTOP | WS_GROUP - AUTORADIOBUTTON " & ", 14009, 50, 144, 185, 10, WS_TABSTOP | WS_GROUP - AUTORADIOBUTTON "& , ", 14010, 40, 156, 195, 10, WS_TABSTOP | WS_GROUP - PUSHBUTTON "& ", 14011, 148, 180, 104, 14, WS_TABSTOP + AUTORADIOBUTTON "От&крывать одним щелчком, выделять указателем", 14007, 40, 120, 200, 10, WS_TABSTOP | WS_GROUP + AUTORADIOBUTTON "Подчеркив&ать подписи значков", 14008, 50, 132, 170, 10, WS_TABSTOP | WS_GROUP + AUTORADIOBUTTON "Подчеркивать подписи з&начков при наведении", 14009, 50, 144, 185, 10, WS_TABSTOP | WS_GROUP + AUTORADIOBUTTON "Откр&ывать двойным, а выделять одним щелчком", 14010, 40, 156, 195, 10, WS_TABSTOP | WS_GROUP + PUSHBUTTON "&Восстановить умолчания", 14011, 148, 180, 104, 14, WS_TABSTOP END FOLDER_OPTIONS_VIEW_DLG DIALOGEX 0, 0, 264, 238 STYLE DS_SHELLFONT | WS_POPUP | WS_CAPTION -CAPTION "" +CAPTION "Вид" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN -GROUPBOX " ", -1, 7, 10, 249, 60 +GROUPBOX "Представление папок", -1, 7, 10, 249, 60 //ICON -LTEXT " , , , """" """", .", -1, 60, 24, 180, 20 -PUSHBUTTON "& ", 14001, 60, 50, 100, 14, WS_TABSTOP -PUSHBUTTON "& ", 14002, 164, 50, 80, 14, WS_TABSTOP -LTEXT " :", -1, 9, 78, 120, 10 +LTEXT "Можно применить вид, выбранный для этой папки, например, ""Таблица"" или ""Плитка"", ко всем папкам.", -1, 60, 24, 180, 20 +PUSHBUTTON "&Применить ко всем папкам", 14001, 60, 50, 100, 14, WS_TABSTOP +PUSHBUTTON "&Сброс для всех папок", 14002, 164, 50, 80, 14, WS_TABSTOP +LTEXT "Дополнительные параметры:", -1, 9, 78, 120, 10 CONTROL "", 14003, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_NOCOLUMNHEADER | LVS_SHAREIMAGELISTS | WS_BORDER | WS_TABSTOP, 7, 90, 249, 120 -PUSHBUTTON "& ", 14004, 156, 216, 101, 14, WS_TABSTOP +PUSHBUTTON "&Восстановить умолчания", 14004, 156, 216, 101, 14, WS_TABSTOP END FOLDER_OPTIONS_FILETYPES_DLG DIALOGEX 0, 0, 264, 238 STYLE DS_SHELLFONT | WS_POPUP | WS_CAPTION -CAPTION " " +CAPTION "Типы файлов" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN -LTEXT "& :", -1, 9, 7, 133, 10 +LTEXT "&Зарегистрированные типы файлов:", -1, 9, 7, 133, 10 CONTROL "", 14000, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHAREIMAGELISTS | WS_BORDER | WS_TABSTOP, 7, 20, 249, 80 -PUSHBUTTON "&", 14001, 147, 110, 50, 14, WS_TABSTOP -PUSHBUTTON "&", 14002, 202, 110, 50, 14, WS_TABSTOP -GROUPBOX " '%s'", 14003, 7, 130, 249, 70 -LTEXT " :", -1, 12, 142, 54, 10 +PUSHBUTTON "&Создать", 14001, 147, 110, 50, 14, WS_TABSTOP +PUSHBUTTON "&Удалить", 14002, 202, 110, 50, 14, WS_TABSTOP +GROUPBOX "Описание расширения '%s'", 14003, 7, 130, 249, 70 +LTEXT "Открывать в:", -1, 12, 142, 54, 10 //ICON -LTEXT ":", 14005, 100, 142, 54, 10 -PUSHBUTTON "&...", 14006, 180, 140, 63, 14, WS_TABSTOP +LTEXT "Приложение:", 14005, 100, 142, 54, 10 +PUSHBUTTON "&Изменить...", 14006, 180, 140, 63, 14, WS_TABSTOP LTEXT "", 14007, 12, 155, 162, 36 -PUSHBUTTON "&", 14008, 180, 175, 63, 14, WS_TABSTOP +PUSHBUTTON "До&полнительно", 14008, 180, 175, 63, 14, WS_TABSTOP END CONFIRM_FILE_REPLACE_DLG DIALOGEX 0, 0, 282, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_CENTER | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION " " +CAPTION "Подтверждение замены файла" FONT 8, "MS Shell Dlg" BEGIN - DEFPUSHBUTTON "&", IDYES, 20, 122, 60, 14 - PUSHBUTTON " - &", 12807, 85, 122, 60, 14 - PUSHBUTTON "&", IDNO, 150, 122, 60, 14 - PUSHBUTTON "", IDCANCEL, 215, 122, 60, 14 + DEFPUSHBUTTON "&Да", IDYES, 20, 122, 60, 14 + PUSHBUTTON "Да - для &всех", 12807, 85, 122, 60, 14 + PUSHBUTTON "&Нет", IDNO, 150, 122, 60, 14 + PUSHBUTTON "Отмена", IDCANCEL, 215, 122, 60, 14 ICON 146, -1, 11, 10, 21, 20, SS_REALSIZECONTROL - LTEXT " ""%2"".", 12291, 44, 10, 231, 22, SS_NOPREFIX - LTEXT " ""%2"".", 12292, 41, 10, 222, 22, SS_NOPREFIX - LTEXT " ""%2"".", 12293, 41, 10, 222, 22, SS_NOPREFIX - LTEXT " ", -1, 44, 35, 228, 10, SS_NOPREFIX - LTEXT "( )", 12302, 79, 51, 198, 20, SS_NOPREFIX + LTEXT "Папка уже содержит файл ""%2"".", 12291, 44, 10, 231, 22, SS_NOPREFIX + LTEXT "Папка уже содержит доступный только для чтения файл ""%2"".", 12292, 41, 10, 222, 22, SS_NOPREFIX + LTEXT "Папка уже содержит системный файл ""%2"".", 12293, 41, 10, 222, 22, SS_NOPREFIX + LTEXT "Заменить имеющийся файл", -1, 44, 35, 228, 10, SS_NOPREFIX + LTEXT "(дата и размер неизвестны)", 12302, 79, 51, 198, 20, SS_NOPREFIX ICON "", 12300, 50, 49, 21, 20, SS_REALSIZECONTROL - LTEXT " ?", -1, 44, 75, 228, 10, SS_NOPREFIX - LTEXT "( )", 12303, 79, 91, 198, 20, SS_NOPREFIX + LTEXT "следующим файлом?", -1, 44, 75, 228, 10, SS_NOPREFIX + LTEXT "(дата и размер неизвестны)", 12303, 79, 91, 198, 20, SS_NOPREFIX ICON "", 12301, 50, 89, 21, 20, SS_REALSIZECONTROL END LOGOFF_DLG DIALOGEX 0, 0, 190, 60 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUPWINDOW | WS_CAPTION -CAPTION " ReactOS" +CAPTION "Выход из ReactOS" FONT 8, "MS Shell Dlg" BEGIN ICON 45, 14344, 10, 10, 21, 20, SS_REALSIZECONTROL - LTEXT " ?", -1, 43, 11, 140, 22 - DEFPUSHBUTTON "&", IDOK, 57, 40, 60, 14 - PUSHBUTTON "", IDCANCEL, 122, 40, 60, 14 + LTEXT "Вы действительно хотите выйти из системы?", -1, 43, 11, 140, 22 + DEFPUSHBUTTON "В&ыход", IDOK, 57, 40, 60, 14 + PUSHBUTTON "Отмена", IDCANCEL, 122, 40, 60, 14 END DISCONNECT_DLG DIALOGEX 0, 0, 190, 60 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUPWINDOW | WS_CAPTION -CAPTION " ReactOS" +CAPTION "Отключение ReactOS" FONT 8, "MS Shell Dlg" BEGIN ICON 49, 14346, 10, 10, 21, 20, SS_REALSIZECONTROL - LTEXT " ?", -1, 49, 12, 137, 23 - DEFPUSHBUTTON "&", IDOK, 57, 40, 60, 14 - PUSHBUTTON "", IDCANCEL, 123, 40, 60, 14 + LTEXT "Вы действительно хотите выполнить отключение?", -1, 49, 12, 137, 23 + DEFPUSHBUTTON "Отклю&чение", IDOK, 57, 40, 60, 14 + PUSHBUTTON "Отмена", IDCANCEL, 123, 40, 60, 14 END AUTOPLAY1_DLG DIALOGEX 0, 0, 227, 218 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CAPTION -CAPTION "" +CAPTION "Автозапуск" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " & , , :", 1000, 7, 7, 215, 20 + LTEXT "Выберите &тип содержимого, а затем действие, автоматически выполняемое при его обнаружении в этом устройстве:", 1000, 7, 7, 215, 20 CONTROL "", 1001, "COMBOBOXEX32", WS_TABSTOP | 0x00000043, 7, 27, 212, 200 - GROUPBOX "", -1, 7, 45, 212, 146 - AUTORADIOBUTTON "& :", 1005, 14, 54, 202, 10, WS_GROUP + GROUPBOX "Действия", -1, 7, 45, 212, 146 + AUTORADIOBUTTON "&Выберите выполняемое действие:", 1005, 14, 54, 202, 10, WS_GROUP CONTROL "LIST2", 1002, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x0000C04D, 22, 66, 192, 107 - AUTORADIOBUTTON " & ", 1006, 14, 177, 202, 10 - PUSHBUTTON " &", 1008, 108, 197, 110, 14, WS_DISABLED + AUTORADIOBUTTON "Выдавать &запрос на выбор выполняемого действия", 1006, 14, 177, 202, 10 + PUSHBUTTON "Восстановить умол&чания", 1008, 108, 197, 110, 14, WS_DISABLED END MIXED_CONTENT1_DLG DIALOGEX 0, 0, 227, 207 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUPWINDOW | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CAPTION -CAPTION " " +CAPTION "Смешанное содержимое" FONT 8, "MS Shell Dlg" BEGIN ICON "", 1000, 5, 7, 21, 20 - LTEXT " .", 1001, 32, 7, 191, 20 - LTEXT " ReactOS?", 1002, 32, 31, 188, 8 + LTEXT "На этом диске или устройстве хранится содержимое различных типов.", 1001, 32, 7, 191, 20 + LTEXT "Какое действие следует выполнять ReactOS?", 1002, 32, 31, 188, 8 CONTROL "", 1003, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x0000C04D, 32, 43, 188, 139 DEFPUSHBUTTON "OK", IDOK, 96, 186, 60, 14 - PUSHBUTTON "", IDCANCEL, 160, 186, 60, 14 + PUSHBUTTON "Отмена", IDCANCEL, 160, 186, 60, 14 END MIXED_CONTENT2_DLG DIALOGEX 0, 0, 227, 206 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUPWINDOW | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CAPTION -CAPTION " " +CAPTION "Смешанное содержимое" FONT 8, "MS Shell Dlg" BEGIN ICON "", 1000, 5, 7, 21, 20 - LTEXT "ReactOS , :", 1001, 30, 7, 193, 20 + LTEXT "ReactOS может всегда выполнять одно и то же действие, когда вы вставляете диск или подключаете устройство с файлами следующего типа:", 1001, 30, 7, 193, 20 ICON "", 1005, 32, 27, 11, 10, SS_REALSIZECONTROL EDITTEXT 1006, 49, 28, 177, 14, ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP - LTEXT " ReactOS?", 1002, 32, 41, 190, 8 + LTEXT "Какое действие следует выполнять ReactOS?", 1002, 32, 41, 190, 8 CONTROL "", 1003, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x0000C04D, 32, 55, 188, 112 - AUTOCHECKBOX " .", 1004, 32, 171, 190, 10 + AUTOCHECKBOX "Всегда выполнять выбранное действие.", 1004, 32, 171, 190, 10 DEFPUSHBUTTON "OK", IDOK, 96, 185, 60, 14 - PUSHBUTTON "", IDCANCEL, 160, 185, 60, 14 + PUSHBUTTON "Отмена", IDCANCEL, 160, 185, 60, 14 END AUTOPLAY2_DLG DIALOGEX 0, 0, 227, 181 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUPWINDOW | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CAPTION -CAPTION "" +CAPTION "Автозапуск" FONT 8, "MS Shell Dlg" BEGIN ICON "", 1000, 5, 7, 21, 20 - LTEXT "ReactOS .", 1001, 32, 7, 190, 22 - LTEXT "& ReactOS?", 1002, 32, 31, 190, 8 + LTEXT "ReactOS может выполнять одно и то же действие при каждом подключении этого устройства.", 1001, 32, 7, 190, 22 + LTEXT "&Какое действие следует выполнять ReactOS?", 1002, 32, 31, 190, 8 CONTROL "", 1003, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x0000C04D, 32, 43, 187, 96 - AUTOCHECKBOX "& ", 1004, 32, 143, 190, 8 + AUTOCHECKBOX "&Всегда выполнять выбранное действие", 1004, 32, 143, 190, 8 DEFPUSHBUTTON "OK", IDOK, 94, 160, 60, 14 - PUSHBUTTON "", IDCANCEL, 159, 160, 60, 14 + PUSHBUTTON "Отмена", IDCANCEL, 159, 160, 60, 14 END SHUTDOWN_DLG DIALOGEX 0, 0, 211, 103 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUPWINDOW | WS_CAPTION -CAPTION " ReactOS" +CAPTION "Завершение работы ReactOS" FONT 8, "MS Shell Dlg" BEGIN ICON 8240, -1, 6, 6, 21, 20, SS_REALSIZECONTROL | WS_GROUP - LTEXT " .", -1, 39, 7, 167, 10 + LTEXT "Выберите желаемое действие.", -1, 39, 7, 167, 10 COMBOBOX 8224, 39, 20, 165, 200, CBS_DROPDOWNLIST | WS_VSCROLL - LTEXT " , . .", 8225, 39, 40, 167, 37 + LTEXT "Сохранить сеанс, обеспечивая работу компьютера в спящем режиме и данными в памяти. При нажатии на любую клавишу или передвижении мыши компьютер возвратится в обычный режим.", 8225, 39, 40, 167, 37 DEFPUSHBUTTON "OK", 1, 7, 82, 60, 14, WS_GROUP - PUSHBUTTON "", IDCANCEL, 75, 82, 60, 14 - PUSHBUTTON "&", IDHELP, 144, 82, 60, 14 + PUSHBUTTON "Отмена", IDCANCEL, 75, 82, 60, 14 + PUSHBUTTON "&Справка", IDHELP, 144, 82, 60, 14 END FORMAT_DLG DIALOGEX 50, 50, 184, 218 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION "" +CAPTION "Форматирование" FONT 8, "MS Shell Dlg" BEGIN - DEFPUSHBUTTON "&", IDOK, 53, 198, 60, 14 - PUSHBUTTON "&", IDCANCEL, 118, 198, 60, 14 - LTEXT "&:", -1, 7, 6, 169, 9 + DEFPUSHBUTTON "&Начать", IDOK, 53, 198, 60, 14 + PUSHBUTTON "&Закрыть", IDCANCEL, 118, 198, 60, 14 + LTEXT "&Емкость:", -1, 7, 6, 169, 9 COMBOBOX 28673, 7, 17, 170, 200, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - LTEXT "& :", -1, 7, 35, 170, 9 + LTEXT "&Файловая система:", -1, 7, 35, 170, 9 COMBOBOX 28677, 7, 46, 170, 200, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP CONTROL "", 28678, "MSCTLS_PROGRESS32", 0, 7, 181, 170, 8 - LTEXT "& :", -1, 7, 64, 170, 9 + LTEXT "&Размер кластера:", -1, 7, 64, 170, 9 COMBOBOX 28680, 7, 75, 170, 200, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - LTEXT "& :", -1, 7, 93, 170, 9 + LTEXT "&Метка тома:", -1, 7, 93, 170, 9 EDITTEXT 28679, 7, 103, 170, 13, ES_AUTOHSCROLL - GROUPBOX "& :", 4610, 7, 121, 170, 49 - AUTOCHECKBOX "& ( )", 28674, 16, 135, 155, 10 - AUTOCHECKBOX "& ", 28675, 16, 152, 155, 10 + GROUPBOX "&Способы форматирования:", 4610, 7, 121, 170, 49 + AUTOCHECKBOX "&Быстрое (очистка оглавления)", 28674, 16, 135, 155, 10 + AUTOCHECKBOX "&Использовать сжатие", 28675, 16, 152, 155, 10 END CHKDSK_DLG DIALOGEX 50, 50, 232, 111 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION " " +CAPTION "Проверка диска" FONT 8, "MS Shell Dlg" BEGIN - DEFPUSHBUTTON "", IDOK, 101, 91, 60, 14 - GROUPBOX " ", -1, 7, 5, 218, 50 - PUSHBUTTON "", IDCANCEL, 165, 91, 60, 14 - AUTOCHECKBOX "& ", 14000, 16, 19, 178, 10 - AUTOCHECKBOX "& ", 14001, 16, 35, 200, 10 + DEFPUSHBUTTON "Запуск", IDOK, 101, 91, 60, 14 + GROUPBOX "Параметры проверки диска", -1, 7, 5, 218, 50 + PUSHBUTTON "Отмена", IDCANCEL, 165, 91, 60, 14 + AUTOCHECKBOX "&Автоматически исправлять системные ошибки", 14000, 16, 19, 178, 10 + AUTOCHECKBOX "&Проверять и востанавливать поврежденные сектора", 14001, 16, 35, 200, 10 CONTROL "", 14002, "MSCTLS_PROGRESS32", 16, 7, 60, 218, 8 LTEXT "", 14003, 7, 75, 218, 10 END IDD_PICK_ICON_DIALOG DIALOGEX 0, 0, 237, 204 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION " " +CAPTION "Изменение значка" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - LTEXT " :", -1, 7, 14, 208, 10 - PUSHBUTTON "...",IDC_BUTTON_PATH, 148, 24,67,14 + LTEXT "Имя файла:", -1, 7, 14, 208, 10 + PUSHBUTTON "Обзор...",IDC_BUTTON_PATH, 148, 24,67,14 EDITTEXT IDC_EDIT_PATH, 6, 24, 135, 15, ES_AUTOHSCROLL - LTEXT ":", -1, 7, 47, 208, 10 + LTEXT "Значки:", -1, 7, 47, 208, 10 LISTBOX IDC_PICKICON_LIST,7,57,208,119,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | LBS_MULTICOLUMN | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP,WS_EX_STATICEDGE DEFPUSHBUTTON "OK",IDOK, 107, 181,50, 14 - PUSHBUTTON "",IDCANCEL, 167, 181, 50, 14 + PUSHBUTTON "Отмена",IDCANCEL, 167, 181, 50, 14 END STRINGTABLE DISCARDABLE BEGIN /* columns in the shellview */ - IDS_SHV_COLUMN1 "" - IDS_SHV_COLUMN2 "" - IDS_SHV_COLUMN3 "" - IDS_SHV_COLUMN4 "" - IDS_SHV_COLUMN5 "" - IDS_SHV_COLUMN6 " " - IDS_SHV_COLUMN7 "" - IDS_SHV_COLUMN8 "" - IDS_SHV_COLUMN9 "" - IDS_SHV_COLUMN10 "" - IDS_SHV_COLUMN11 "" - IDS_SHV_COLUMN12 " " - IDS_SHV_COLUMN13 "" - IDS_SHV_COLUMN_DELFROM " " - IDS_SHV_COLUMN_DELDATE " " - IDS_SHV_COLUMN_FONTTYPE " " - IDS_SHV_COLUMN_WORKGROUP " " - IDS_SHV_NETWORKLOCATION " " - IDS_SHV_COLUMN_DOCUMENTS "" - IDS_SHV_COLUMN_STATUS "" - IDS_SHV_COLUMN_COMMENTS "" - IDS_SHV_COLUMN_LOCATION "" - IDS_SHV_COLUMN_MODEL "" + IDS_SHV_COLUMN1 "Имя" + IDS_SHV_COLUMN2 "Размер" + IDS_SHV_COLUMN3 "Тип" + IDS_SHV_COLUMN4 "Изменён" + IDS_SHV_COLUMN5 "Атрибуты" + IDS_SHV_COLUMN6 "Полный объём" + IDS_SHV_COLUMN7 "Свободно" + IDS_SHV_COLUMN8 "Имя" + IDS_SHV_COLUMN9 "Комментарий" + IDS_SHV_COLUMN10 "Владелец" + IDS_SHV_COLUMN11 "Группа" + IDS_SHV_COLUMN12 "Имя файла" + IDS_SHV_COLUMN13 "Категория" + IDS_SHV_COLUMN_DELFROM "Изначальное расположение" + IDS_SHV_COLUMN_DELDATE "Дата удаления" + IDS_SHV_COLUMN_FONTTYPE "Тип шрифта" + IDS_SHV_COLUMN_WORKGROUP "Рабочая группа" + IDS_SHV_NETWORKLOCATION "Сетевое расположение" + IDS_SHV_COLUMN_DOCUMENTS "Документы" + IDS_SHV_COLUMN_STATUS "Состояние" + IDS_SHV_COLUMN_COMMENTS "Коментарии" + IDS_SHV_COLUMN_LOCATION "Расположение" + IDS_SHV_COLUMN_MODEL "Модель" /* special folders */ - IDS_DESKTOP " " - IDS_MYCOMPUTER " " - IDS_RECYCLEBIN_FOLDER_NAME "" - IDS_CONTROLPANEL " " - IDS_ADMINISTRATIVETOOLS "" + IDS_DESKTOP "Рабочий стол" + IDS_MYCOMPUTER "Мой компьютер" + IDS_RECYCLEBIN_FOLDER_NAME "Корзина" + IDS_CONTROLPANEL "Панель управления" + IDS_ADMINISTRATIVETOOLS "Администрирование" /* context menus */ - IDS_VIEW_LARGE "& " - IDS_VIEW_SMALL "& " - IDS_VIEW_LIST "&" - IDS_VIEW_DETAILS "&" - IDS_SELECT "&" - IDS_OPEN "&" - IDS_CREATELINK " &" - IDS_COPY "" - IDS_DELETE "" - IDS_PROPERTIES "" - IDS_CUT "" - IDS_RESTORE "" - IDS_FORMATDRIVE "..." - IDS_RENAME "" - IDS_INSERT "" + IDS_VIEW_LARGE "&Большие значки" + IDS_VIEW_SMALL "&Мелкие значки" + IDS_VIEW_LIST "&Список" + IDS_VIEW_DETAILS "&Подробно" + IDS_SELECT "&Выбрать" + IDS_OPEN "&Открыть" + IDS_CREATELINK "Создать &ярлык" + IDS_COPY "Копировать" + IDS_DELETE "Удалить" + IDS_PROPERTIES "Свойства" + IDS_CUT "Вырезать" + IDS_RESTORE "Востановить" + IDS_FORMATDRIVE "Форматировать..." + IDS_RENAME "Переименовать" + IDS_INSERT "Вставить" - IDS_CREATEFOLDER_DENIED " - ." - IDS_CREATEFOLDER_CAPTION " " - IDS_DELETEITEM_CAPTION " " - IDS_DELETEFOLDER_CAPTION " " - IDS_DELETEITEM_TEXT " '%1'?" - IDS_DELETEMULTIPLE_TEXT " (%1?" - IDS_DELETESELECTED_TEXT " ()?" - IDS_TRASHITEM_TEXT " '%1' ?" - IDS_TRASHFOLDER_TEXT " '%1' ?" - IDS_TRASHMULTIPLE_TEXT " %1 ?" - IDS_CANTTRASH_TEXT " '%1' . ?" - IDS_OVERWRITEFILE_TEXT " '%1'.\n\n ?" - IDS_OVERWRITEFILE_CAPTION " " - IDS_OVERWRITEFOLDER_TEXT " '%1'.\n\n"\ - " , \n"\ - ". ?" + IDS_CREATEFOLDER_DENIED "Невозможно создать папку - нет полномочий." + IDS_CREATEFOLDER_CAPTION "Ошибка во время создания папки" + IDS_DELETEITEM_CAPTION "Подтверждение удаления файла" + IDS_DELETEFOLDER_CAPTION "Подтверждение удаления папки" + IDS_DELETEITEM_TEXT "Удалить '%1'?" + IDS_DELETEMULTIPLE_TEXT "Удалить эти обьекты (%1?" + IDS_DELETESELECTED_TEXT "Вы действительно хотите удалить выбранный элементы(ы)?" + IDS_TRASHITEM_TEXT "Вы действильно хотите поместить '%1' в Корзину?" + IDS_TRASHFOLDER_TEXT "Вы действительно хотите поместить '%1' и все содержащиеся файлы в Корзину?" + IDS_TRASHMULTIPLE_TEXT "Вы действительно хотите переместить элементы %1 в Корзину?" + IDS_CANTTRASH_TEXT "Файл '%1' не может быть помещен в Корзину. Удалить безвозвратно?" + IDS_OVERWRITEFILE_TEXT "В этой папке уже имеется элемент '%1'.\n\nЗаменить его?" + IDS_OVERWRITEFILE_CAPTION "Подтверждение замены файла" + IDS_OVERWRITEFOLDER_TEXT "Эта папка уже содержит папку с именем '%1'.\n\nЕсли в папке содержатся файлы с одинаковыми именами, то они так же будут\nземенены. Продолжить?" /* message box strings */ - IDS_RESTART_TITLE "" - IDS_RESTART_PROMPT " ReactOS?" - IDS_SHUTDOWN_TITLE " " - IDS_SHUTDOWN_PROMPT " ReactOS?" + IDS_RESTART_TITLE "Перезагрузить" + IDS_RESTART_PROMPT "Вы действительно хотите перезагрузить ReactOS?" + IDS_SHUTDOWN_TITLE "Выключить питание" + IDS_SHUTDOWN_PROMPT "Закончить работу с ReactOS?" IDS_LOGOFF_TITLE "Log Off" IDS_LOGOFF_PROMPT "Do you want to log off?" /* Run File dialog */ - IDS_RUNDLG_ERROR " ( )" - IDS_RUNDLG_BROWSE_ERROR " ( )" - IDS_RUNDLG_BROWSE_CAPTION "" - IDS_RUNDLG_BROWSE_FILTER " (*.exe)\0*.exe\0 (*.*)\0*.*\0" + IDS_RUNDLG_ERROR "Невозможно отобразить Диалог Выполнить Файл (внутренняя ошибка)" + IDS_RUNDLG_BROWSE_ERROR "Невозможно отобразить Диалог Обзор (внутренняя ошибка)" + IDS_RUNDLG_BROWSE_CAPTION "Обзор" + IDS_RUNDLG_BROWSE_FILTER "Исполняемые файлы (*.exe)\0*.exe\0Все файлы (*.*)\0*.*\0" /* shell folder path default values */ - IDS_PROGRAMS " \\" - IDS_PERSONAL " " - IDS_FAVORITES "" - IDS_STARTUP " \\\\" - IDS_RECENT "" - IDS_SENDTO "" - IDS_STARTMENU " " - IDS_MYMUSIC " " - IDS_MYVIDEO " " - IDS_DESKTOPDIRECTORY " " - IDS_NETHOOD " " - IDS_TEMPLATES "" + IDS_PROGRAMS "Главное меню\\Программы" + IDS_PERSONAL "Мои документы" + IDS_FAVORITES "Избранное" + IDS_STARTUP "Главное меню\\Программы\\Автозагрузка" + IDS_RECENT "Недавнее" + IDS_SENDTO "Отправить" + IDS_STARTMENU "Главное меню" + IDS_MYMUSIC "Моя музыка" + IDS_MYVIDEO "Мои фильмы" + IDS_DESKTOPDIRECTORY "Рабочий стол" + IDS_NETHOOD "Сетевое окружение" + IDS_TEMPLATES "Шаблоны" IDS_APPDATA "Application Data" - IDS_PRINTHOOD "" + IDS_PRINTHOOD "Принтеры" IDS_LOCAL_APPDATA "Local Settings\\Application Data" IDS_INTERNET_CACHE "Local Settings\\Temporary Internet Files" IDS_COOKIES "Cookies" IDS_HISTORY "Local Settings\\History" IDS_PROGRAM_FILES "Program Files" - IDS_MYPICTURES " " + IDS_MYPICTURES "Мои рисунки" IDS_PROGRAM_FILES_COMMON "Program Files\\Common Files" - IDS_COMMON_DOCUMENTS " " - IDS_ADMINTOOLS " \\\\" - IDS_COMMON_MUSIC " \\ " - IDS_COMMON_PICTURES " \\ " - IDS_COMMON_VIDEO " \\ " + IDS_COMMON_DOCUMENTS "Общие документы" + IDS_ADMINTOOLS "Главное меню\\Программы\\Администрирование" + IDS_COMMON_MUSIC "Общие документы\\Моя музыка" + IDS_COMMON_PICTURES "Общие документы\\Мои рисунки" + IDS_COMMON_VIDEO "Общие документы\\Мои фильмы" IDS_CDBURN_AREA "Local Settings\\Application Data\\Microsoft\\CD Burning" - IDS_NETWORKPLACE " " + IDS_NETWORKPLACE "Сетевое окружение" - IDS_NEWFOLDER " " + IDS_NEWFOLDER "Новая папка" - IDS_DRIVE_FIXED " " + IDS_DRIVE_FIXED "Локальный диск" IDS_DRIVE_CDROM "CDROM" - IDS_DRIVE_NETWORK " " + IDS_DRIVE_NETWORK "Сетевой диск" - IDS_OPEN_WITH " " - IDS_OPEN_WITH_CHOOSE " ..." + IDS_OPEN_WITH "Открыть с помощью" + IDS_OPEN_WITH_CHOOSE "Выбрать программу..." - IDS_SHELL_ABOUT_AUTHORS "&" - IDS_SHELL_ABOUT_BACK "< &" - FCIDM_SHVIEW_NEW "" - FCIDM_SHVIEW_NEWFOLDER "&" - FCIDM_SHVIEW_NEWLINK "&" - IDS_FOLDER_OPTIONS " " - IDS_RECYCLEBIN_LOCATION " " - IDS_RECYCLEBIN_DISKSPACE " " - IDS_EMPTY_BITBUCKET " " - IDS_PICK_ICON_TITLE " " - IDS_PICK_ICON_FILTER " (*.ico, *.icl, *.exe, *.dll)\0*.ico;*.icl;*.exe;*.dll\0 (*.*)\0*.*\0" - IDS_OPEN_WITH_FILTER " (*.exe)\0*.exe\0 (*.*)\0*.*\0" - IDS_DIRECTORY "" - IDS_VIRTUAL_DRIVER " " - IDS_BAT_FILE " ReactOS" - IDS_CMD_FILE " ReactOS" - IDS_COM_FILE " Dos" - IDS_CPL_FILE " " - IDS_CUR_FILE "" - IDS_DLL_FILE " " - IDS_DRV_FILE " " - IDS_EXE_FILE "" - IDS_FON_FILE " " - IDS_TTF_FILE " TrueType" - IDS_HLP_FILE " " - IDS_INI_FILE " " - IDS_LNK_FILE "" - IDS_SYS_FILE " " + IDS_SHELL_ABOUT_AUTHORS "&Авторы" + IDS_SHELL_ABOUT_BACK "< &Назад" + FCIDM_SHVIEW_NEW "Создать" + FCIDM_SHVIEW_NEWFOLDER "&Папка" + FCIDM_SHVIEW_NEWLINK "&Ярлык" + IDS_FOLDER_OPTIONS "Свойства папки" + IDS_RECYCLEBIN_LOCATION "Расположение Корзины" + IDS_RECYCLEBIN_DISKSPACE "Доступное пространство" + IDS_EMPTY_BITBUCKET "Очистить корзину" + IDS_PICK_ICON_TITLE "Выбрать значок" + IDS_PICK_ICON_FILTER "Файлы значков (*.ico, *.icl, *.exe, *.dll)\0*.ico;*.icl;*.exe;*.dll\0Все файлы (*.*)\0*.*\0" + IDS_OPEN_WITH_FILTER "Исполняемые файлы (*.exe)\0*.exe\0Все файлы (*.*)\0*.*\0" + IDS_DIRECTORY "Папка" + IDS_VIRTUAL_DRIVER "Драйвер виртуального устройства" + IDS_BAT_FILE "Пакетный файл ReactOS" + IDS_CMD_FILE "Командный скрипт ReactOS" + IDS_COM_FILE "Приложение Dos" + IDS_CPL_FILE "Аплет панели управления" + IDS_CUR_FILE "Курсор" + IDS_DLL_FILE "Расширение приложения" + IDS_DRV_FILE "Драйвер устройства" + IDS_EXE_FILE "Приложение" + IDS_FON_FILE "Файл шрифта" + IDS_TTF_FILE "Файл шрифта TrueType" + IDS_HLP_FILE "Файл справки" + IDS_INI_FILE "Файл конфигурации" + IDS_LNK_FILE "Ярлык" + IDS_SYS_FILE "Системный файл" - IDS_OPEN_VERB "" - IDS_EXPLORE_VERB " " - IDS_RUNAS_VERB " " - IDS_EDIT_VERB "" - IDS_FIND_VERB "" - IDS_PRINT_VERB "" + IDS_OPEN_VERB "Открыть" + IDS_EXPLORE_VERB "Открыть в дереве" + IDS_RUNAS_VERB "Запустить как " + IDS_EDIT_VERB "Изменить" + IDS_FIND_VERB "Поиск" + IDS_PRINT_VERB "Печать" - IDS_FILE_FOLDER "%u , %u " - IDS_PRINTERS "" - IDS_FONTS "" - IDS_INSTALLNEWFONT " ..." + IDS_FILE_FOLDER "%u файлов, %u папок" + IDS_PRINTERS "Принтеры" + IDS_FONTS "Шрифты" + IDS_INSTALLNEWFONT "Установить новый шрифт..." - IDS_DEFAULT_CLUSTER_SIZE " " + IDS_DEFAULT_CLUSTER_SIZE "Выделяемый по умолчанию размер" IDS_COPY_OF "Copy of" IDS_SHLEXEC_NOASSOC "There is no Windows program configured to open this type of file." - IDS_FILE_DETAILS " '%s'" - IDS_FILE_DETAILSADV " '%s' '%s'. '%s', ''." - IDS_FILE_TYPES " " - IDS_COLUMN_EXTENSION "" + IDS_FILE_DETAILS "Описание расширения '%s'" + IDS_FILE_DETAILSADV "Файлы с расширением '%s' имеют тип '%s'. Для изменения параметров всех файлов '%s', нажмите 'Дополнительно'." + IDS_FILE_TYPES "Типы файлов" + IDS_COLUMN_EXTENSION "Расширения" END diff --git a/dll/win32/shell32/lang/sk-SK.rc b/dll/win32/shell32/lang/sk-SK.rc index 44e228a878a..59a5cfede43 100644 --- a/dll/win32/shell32/lang/sk-SK.rc +++ b/dll/win32/shell32/lang/sk-SK.rc @@ -131,7 +131,7 @@ FONT 8, "MS Shell Dlg" BEGIN ICON "", IDC_SHELL_ABOUT_ICON, 7, 55, 21, 20 LTEXT "", IDC_SHELL_ABOUT_APPNAME, 35, 55, 200, 10 - LTEXT "Verzia " KERNEL_VERSION_STR " (" KERNEL_VERSION_BUILD_STR ")", IDC_STATIC, 35, 65, 235, 10 + LTEXT "Verzia "KERNEL_VERSION_STR" ("KERNEL_VERSION_BUILD_STR")", IDC_STATIC, 35, 65, 235, 10 LTEXT REACTOS_DEFAULT_STR_LEGAL_COPYRIGHT, IDC_STATIC, 35, 75, 210, 10 LTEXT "", IDC_SHELL_ABOUT_OTHERSTUFF, 35, 90, 180, 20 LTEXT "Tto verzia systmu ReactOS je registrovan pre:", IDC_STATIC, 35, 115, 180, 10 @@ -661,10 +661,7 @@ BEGIN IDS_CANTTRASH_TEXT "Poloka '%1' neme by odoslan do koa. Chcete ju namiesto toho vymaza?" IDS_OVERWRITEFILE_TEXT "Tento prieinok u obsahuje sbor s nzvom '%1'.\n\nChcete ho nahradi?" IDS_OVERWRITEFILE_CAPTION "Potvrdenie prepsania sboru" - IDS_OVERWRITEFOLDER_TEXT "Tento prieinok u obsahuje prieinok s nzvom '%1'.\n\n"\ - "Ak bud ma sbory v cieovom prieinku rovnak nzvy ako sbory\n"\ - "vo vybranom prieinku, tak bud nahraden. Stle chcete presun\n"\ - "alebo skoprova prieinok?" + IDS_OVERWRITEFOLDER_TEXT "Tento prieinok u obsahuje prieinok s nzvom '%1'.\n\nAk bud ma sbory v cieovom prieinku rovnak nzvy ako sbory\nvo vybranom prieinku, tak bud nahraden. Stle chcete presun\nalebo skoprova prieinok?" /* message box strings */ IDS_RESTART_TITLE "Retartova" diff --git a/dll/win32/shell32/lang/sl-SI.rc b/dll/win32/shell32/lang/sl-SI.rc index 5fbdbdd1518..50e42afd81c 100644 --- a/dll/win32/shell32/lang/sl-SI.rc +++ b/dll/win32/shell32/lang/sl-SI.rc @@ -125,7 +125,7 @@ FONT 8, "MS Shell Dlg" BEGIN ICON "", IDC_SHELL_ABOUT_ICON, 7, 55, 21, 20 LTEXT "", IDC_SHELL_ABOUT_APPNAME, 35, 55, 200, 10 - LTEXT "Version " KERNEL_VERSION_STR " (" KERNEL_VERSION_BUILD_STR ")", IDC_STATIC, 35, 65, 235, 10 + LTEXT "Version "KERNEL_VERSION_STR" ("KERNEL_VERSION_BUILD_STR")", IDC_STATIC, 35, 65, 235, 10 LTEXT REACTOS_DEFAULT_STR_LEGAL_COPYRIGHT, IDC_STATIC, 35, 75, 210, 10 LTEXT "", IDC_SHELL_ABOUT_OTHERSTUFF, 35, 90, 180, 20 LTEXT "This ReactOS version is registered to:", IDC_STATIC, 35, 115, 180, 10 @@ -655,10 +655,7 @@ BEGIN IDS_CANTTRASH_TEXT "The item '%1' can't be sent to Trash. Do you want to delete it instead?" IDS_OVERWRITEFILE_TEXT "This folder already contains a file called '%1'.\n\nDo you want to replace it?" IDS_OVERWRITEFILE_CAPTION "Confirm file overwrite" - IDS_OVERWRITEFOLDER_TEXT "This folder already contains a folder named '%1'.\n\n"\ - "If the files in the destination folder have the same names as files in the\n"\ - "selected folder they will be replaced. Do you still want to move or copy\n"\ - "the folder?" + IDS_OVERWRITEFOLDER_TEXT "This folder already contains a folder named '%1'.\n\nIf the files in the destination folder have the same names as files in the\nselected folder they will be replaced. Do you still want to move or copy\nthe folder?" /* message box strings */ IDS_RESTART_TITLE "Restart" diff --git a/dll/win32/shell32/lang/sv-SE.rc b/dll/win32/shell32/lang/sv-SE.rc index ae5f88381bf..1ab43f1c1b9 100644 --- a/dll/win32/shell32/lang/sv-SE.rc +++ b/dll/win32/shell32/lang/sv-SE.rc @@ -125,7 +125,7 @@ FONT 8, "MS Shell Dlg" BEGIN ICON "", IDC_SHELL_ABOUT_ICON, 7, 55, 21, 20 LTEXT "", IDC_SHELL_ABOUT_APPNAME, 35, 55, 200, 10 - LTEXT "Version " KERNEL_VERSION_STR " (" KERNEL_VERSION_BUILD_STR ")", IDC_STATIC, 35, 65, 235, 10 + LTEXT "Version "KERNEL_VERSION_STR" ("KERNEL_VERSION_BUILD_STR")", IDC_STATIC, 35, 65, 235, 10 LTEXT REACTOS_DEFAULT_STR_LEGAL_COPYRIGHT, IDC_STATIC, 35, 75, 210, 10 LTEXT "", IDC_SHELL_ABOUT_OTHERSTUFF, 35, 90, 180, 20 LTEXT "This ReactOS version is registered to:", IDC_STATIC, 35, 115, 180, 10 @@ -655,10 +655,7 @@ BEGIN IDS_CANTTRASH_TEXT "The item '%1' can't be sent to Trash. Do you want to delete it instead?" IDS_OVERWRITEFILE_TEXT "This folder already contains a file called '%1'.\n\nDo you want to replace it?" IDS_OVERWRITEFILE_CAPTION "Confirm file overwrite" - IDS_OVERWRITEFOLDER_TEXT "This folder already contains a folder named '%1'.\n\n"\ - "If the files in the destination folder have the same names as files in the\n"\ - "selected folder they will be replaced. Do you still want to move or copy\n"\ - "the folder?" + IDS_OVERWRITEFOLDER_TEXT "This folder already contains a folder named '%1'.\n\nIf the files in the destination folder have the same names as files in the\nselected folder they will be replaced. Do you still want to move or copy\nthe folder?" /* message box strings */ IDS_RESTART_TITLE "Restart" diff --git a/dll/win32/shell32/lang/tr-TR.rc b/dll/win32/shell32/lang/tr-TR.rc index 59600e9c3d1..cc0d4ed0ad7 100644 --- a/dll/win32/shell32/lang/tr-TR.rc +++ b/dll/win32/shell32/lang/tr-TR.rc @@ -125,7 +125,7 @@ FONT 8, "MS Shell Dlg" BEGIN ICON "", IDC_SHELL_ABOUT_ICON, 7, 55, 21, 20 LTEXT "", IDC_SHELL_ABOUT_APPNAME, 35, 55, 200, 10 - LTEXT "Version " KERNEL_VERSION_STR " (" KERNEL_VERSION_BUILD_STR ")", IDC_STATIC, 35, 65, 235, 10 + LTEXT "Version "KERNEL_VERSION_STR" ("KERNEL_VERSION_BUILD_STR")", IDC_STATIC, 35, 65, 235, 10 LTEXT REACTOS_DEFAULT_STR_LEGAL_COPYRIGHT, IDC_STATIC, 35, 75, 210, 10 LTEXT "", IDC_SHELL_ABOUT_OTHERSTUFF, 35, 90, 180, 20 LTEXT "This ReactOS version is registered to:", IDC_STATIC, 35, 115, 180, 10 @@ -655,10 +655,7 @@ BEGIN IDS_CANTTRASH_TEXT "'%1' adl e pe gnderilemiyor. Tamamen silmek ister misiniz?" IDS_OVERWRITEFILE_TEXT "This folder already contains a file called '%1'.\n\nDo you want to replace it?" IDS_OVERWRITEFILE_CAPTION "Dosya zerine Yazmay Onayla" - IDS_OVERWRITEFOLDER_TEXT "This folder already contains a folder named '%1'.\n\n"\ - "If the files in the destination folder have the same names as files in the\n"\ - "selected folder they will be replaced. Do you still want to move or copy\n"\ - "the folder?" + IDS_OVERWRITEFOLDER_TEXT "This folder already contains a folder named '%1'.\n\nIf the files in the destination folder have the same names as files in the\nselected folder they will be replaced. Do you still want to move or copy\nthe folder?" /* message box strings */ IDS_RESTART_TITLE "Yeniden Balat" diff --git a/dll/win32/shell32/lang/uk-UA.rc b/dll/win32/shell32/lang/uk-UA.rc index 37541587583..8f2a3ebcf90 100644 --- a/dll/win32/shell32/lang/uk-UA.rc +++ b/dll/win32/shell32/lang/uk-UA.rc @@ -22,10 +22,10 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT MENU_001 MENU DISCARDABLE BEGIN - MENUITEM "& ", FCIDM_SHVIEW_BIGICON - MENUITEM "& ", FCIDM_SHVIEW_SMALLICON - MENUITEM "&", FCIDM_SHVIEW_LISTVIEW - MENUITEM "&", FCIDM_SHVIEW_REPORTVIEW + MENUITEM "&Великі значки", FCIDM_SHVIEW_BIGICON + MENUITEM "&Дрібні значки", FCIDM_SHVIEW_SMALLICON + MENUITEM "Спис&ок", FCIDM_SHVIEW_LISTVIEW + MENUITEM "&Подробиці", FCIDM_SHVIEW_REPORTVIEW END /* shellview background menu */ @@ -33,31 +33,31 @@ MENU_002 MENU DISCARDABLE BEGIN POPUP "" BEGIN - POPUP "&" + POPUP "&Вигляд" BEGIN - MENUITEM "& ", FCIDM_SHVIEW_BIGICON - MENUITEM "& ", FCIDM_SHVIEW_SMALLICON - MENUITEM "&", FCIDM_SHVIEW_LISTVIEW - MENUITEM "&", FCIDM_SHVIEW_REPORTVIEW + MENUITEM "&Великі значки", FCIDM_SHVIEW_BIGICON + MENUITEM "&Дрібні значки", FCIDM_SHVIEW_SMALLICON + MENUITEM "Спис&ок", FCIDM_SHVIEW_LISTVIEW + MENUITEM "&Подробиці", FCIDM_SHVIEW_REPORTVIEW END MENUITEM SEPARATOR - POPUP "& " + POPUP "&Упорядкувати значки" BEGIN - MENUITEM " &'", 0x30 /* column 0 */ - MENUITEM " &", 0x32 /* column 2 */ - MENUITEM " &", 0x31 /* ... */ - MENUITEM " &", 0x33 + MENUITEM "за &ім'ям", 0x30 /* column 0 */ + MENUITEM "за &типом", 0x32 /* column 2 */ + MENUITEM "за &розміром", 0x31 /* ... */ + MENUITEM "за &датою", 0x33 MENUITEM SEPARATOR - MENUITEM "&", FCIDM_SHVIEW_AUTOARRANGE + MENUITEM "&автоматично", FCIDM_SHVIEW_AUTOARRANGE END - MENUITEM " ", FCIDM_SHVIEW_SNAPTOGRID + MENUITEM "Вирівняти значки", FCIDM_SHVIEW_SNAPTOGRID MENUITEM SEPARATOR - MENUITEM "", FCIDM_SHVIEW_REFRESH + MENUITEM "Оновити", FCIDM_SHVIEW_REFRESH MENUITEM SEPARATOR - MENUITEM "", FCIDM_SHVIEW_INSERT - MENUITEM " ", FCIDM_SHVIEW_INSERTLINK + MENUITEM "Вставити", FCIDM_SHVIEW_INSERT + MENUITEM "Вставити ярлик", FCIDM_SHVIEW_INSERTLINK MENUITEM SEPARATOR - MENUITEM "", FCIDM_SHVIEW_PROPERTIES + MENUITEM "Властивості", FCIDM_SHVIEW_PROPERTIES END END @@ -66,27 +66,27 @@ MENU_SHV_FILE MENU DISCARDABLE BEGIN POPUP "" BEGIN - MENUITEM "&", FCIDM_SHVIEW_EXPLORE - MENUITEM "&", FCIDM_SHVIEW_OPEN + MENUITEM "&Провідник", FCIDM_SHVIEW_EXPLORE + MENUITEM "В&ідкрити", FCIDM_SHVIEW_OPEN MENUITEM SEPARATOR - MENUITEM "&", FCIDM_SHVIEW_CUT - MENUITEM "&", FCIDM_SHVIEW_COPY + MENUITEM "&Вирізати", FCIDM_SHVIEW_CUT + MENUITEM "&Копіювати", FCIDM_SHVIEW_COPY MENUITEM SEPARATOR - MENUITEM " &", FCIDM_SHVIEW_CREATELINK - MENUITEM "&", FCIDM_SHVIEW_DELETE - MENUITEM "&", FCIDM_SHVIEW_RENAME + MENUITEM "Створити &ярлик", FCIDM_SHVIEW_CREATELINK + MENUITEM "В&идалити", FCIDM_SHVIEW_DELETE + MENUITEM "Перей&менувати", FCIDM_SHVIEW_RENAME MENUITEM SEPARATOR - MENUITEM "&", FCIDM_SHVIEW_PROPERTIES + MENUITEM "В&ластивості", FCIDM_SHVIEW_PROPERTIES END END SHBRSFORFOLDER_MSGBOX DIALOGEX LOADONCALL MOVEABLE DISCARDABLE 15, 40, 188, 192 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Огляд тек" FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "OK", 1, 80, 176, 50, 12, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP - PUSHBUTTON "", 2, 134, 176, 50, 12, WS_GROUP | WS_TABSTOP + PUSHBUTTON "Скасувати", 2, 134, 176, 50, 12, WS_GROUP | WS_TABSTOP LTEXT "", IDD_TITLE, 4, 4, 180, 12 LTEXT "", IDD_STATUS, 4, 25, 180, 12 CONTROL "", IDD_TREEVIEW, "SysTreeView32", TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | WS_BORDER | WS_TABSTOP, 4, 40, 180, 120 @@ -94,47 +94,47 @@ END SHNEWBRSFORFOLDER_MSGBOX DIALOGEX LOADONCALL MOVEABLE DISCARDABLE 15, 40, 218, 196 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Огляд тек" FONT 8, "MS Shell Dlg" BEGIN LTEXT "", IDD_TITLE, 10, 8, 198, 24 LTEXT "", IDD_STATUS, 10, 25, 198, 12 - LTEXT ":", IDD_FOLDER, 10, 152, 40, 12 + LTEXT "Тека:", IDD_FOLDER, 10, 152, 40, 12 CONTROL "", IDD_TREEVIEW, "SysTreeView32", TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | WS_BORDER | WS_TABSTOP, 12, 38, 194, 105 EDITTEXT IDD_FOLDERTEXT, 46, 150, 160, 14, WS_BORDER | WS_GROUP | WS_TABSTOP - PUSHBUTTON " &", IDD_MAKENEWFOLDER, 12, 174, 77, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "Створити &теку", IDD_MAKENEWFOLDER, 12, 174, 77, 14, WS_GROUP | WS_TABSTOP DEFPUSHBUTTON "OK", IDOK, 102, 174, 50, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP - PUSHBUTTON "", IDCANCEL, 156, 174, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "Скасувати", IDCANCEL, 156, 174, 50, 14, WS_GROUP | WS_TABSTOP END SHELL_YESTOALL_MSGBOX DIALOGEX 200, 100, 280, 90 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "" +CAPTION "Повідомлення" FONT 8, "MS Shell Dlg" BEGIN - DEFPUSHBUTTON "&", IDYES, 34, 69, 53, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON " &", IDD_YESTOALL, 92, 69, 65, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON "&ͳ", IDNO, 162, 69, 53, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON "&", IDCANCEL, 220, 69, 53, 14, WS_GROUP | WS_TABSTOP + DEFPUSHBUTTON "&Так", IDYES, 34, 69, 53, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "Так для &всіх", IDD_YESTOALL, 92, 69, 65, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&Ні", IDNO, 162, 69, 53, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&Скасувати", IDCANCEL, 220, 69, 53, 14, WS_GROUP | WS_TABSTOP ICON "", IDD_ICON, 10, 10, 16, 16 LTEXT "", IDD_MESSAGE, 40, 10, 238, 52, 0 END IDD_SHELL_ABOUT DIALOGEX LOADONCALL MOVEABLE DISCARDABLE 0, 0, 275, 198 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " %s" +CAPTION "Про %s" FONT 8, "MS Shell Dlg" BEGIN ICON "", IDC_SHELL_ABOUT_ICON, 7, 55, 21, 20 LTEXT "", IDC_SHELL_ABOUT_APPNAME, 35, 55, 200, 10 - LTEXT " " KERNEL_VERSION_STR " (" KERNEL_VERSION_BUILD_STR ")", IDC_STATIC, 35, 65, 235, 10 + LTEXT "Версія "KERNEL_VERSION_STR" ("KERNEL_VERSION_BUILD_STR")", IDC_STATIC, 35, 65, 235, 10 LTEXT REACTOS_DEFAULT_STR_LEGAL_COPYRIGHT, IDC_STATIC, 35, 75, 210, 10 LTEXT "", IDC_SHELL_ABOUT_OTHERSTUFF, 35, 90, 180, 20 - LTEXT " ReactOS :", IDC_STATIC, 35, 115, 180, 10 + LTEXT "Ця версія ReactOS зареєстрована на:", IDC_STATIC, 35, 115, 180, 10 LTEXT "", IDC_SHELL_ABOUT_REG_USERNAME, 45, 125, 180, 10 LTEXT "", IDC_SHELL_ABOUT_REG_ORGNAME, 45, 135, 180, 10 LTEXT "", IDC_STATIC, 35, 147, 235, 1, SS_ETCHEDHORZ - LTEXT " ':", IDC_STATIC, 35, 152, 130, 10 + LTEXT "Доступна фізична пам'ять:", IDC_STATIC, 35, 152, 130, 10 LTEXT "", IDC_SHELL_ABOUT_PHYSMEM, 167, 152, 88, 10 DEFPUSHBUTTON "OK", IDOK, 220, 178, 50, 14 @@ -145,635 +145,632 @@ IDD_SHELL_ABOUT_AUTHORS DIALOGEX MOVEABLE DISCARDABLE 35, 90, 235, 85 STYLE DS_SHELLFONT | WS_CHILD FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ReactOS:", IDC_STATIC, 0, 0, 180, 10 + LTEXT "Розробники ReactOS:", IDC_STATIC, 0, 0, 180, 10 LISTBOX IDC_SHELL_ABOUT_AUTHORS_LISTBOX, 0, 10, 165, 75 END SHELL_RUN_DLG DIALOGEX LOADONCALL MOVEABLE DISCARDABLE 0, 0, 227, 95 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "" +CAPTION "Виконати" FONT 8, "MS Shell Dlg" BEGIN ICON "", 12297, 7, 11, 18, 20, WS_VISIBLE - LTEXT " ' , , , ReactOS .", 12289, 36, 11, 182, 18 - LTEXT "&³:", 12305, 3, 39, 32, 10 + LTEXT "Введіть ім'я програми, теки, документа або ресурсу Інтернету, і ReactOS відкриє їх.", 12289, 36, 11, 182, 18 + LTEXT "&Відкрити:", 12305, 3, 39, 32, 10 CONTROL "", 12298, "COMBOBOX", WS_TABSTOP | WS_GROUP | WS_VSCROLL | WS_VISIBLE | CBS_AUTOHSCROLL | CBS_DROPDOWN, 36, 37, 183, 100 DEFPUSHBUTTON "OK", IDOK, 62, 63, 50, 14, WS_TABSTOP - PUSHBUTTON "", IDCANCEL, 116, 63, 50, 14, WS_TABSTOP - PUSHBUTTON "&...", 12288, 170, 63, 50, 14, WS_TABSTOP + PUSHBUTTON "Скасувати", IDCANCEL, 116, 63, 50, 14, WS_TABSTOP + PUSHBUTTON "О&гляд...", 12288, 170, 63, 50, 14, WS_TABSTOP END SHELL_GENERAL_SHORTCUT_DLG DIALOGEX 0, 0, 235, 215 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Ярлик" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN ICON "", 14000, 10, 4, 30, 30, WS_VISIBLE - LTEXT " ':", 14004, 8, 38, 64, 10 + LTEXT "Тип об'єкта:", 14004, 8, 38, 64, 10 LTEXT "", 14005, 78, 38, 142, 10 - LTEXT ":", 14006, 8, 58, 64, 10 + LTEXT "Розташування:", 14006, 8, 58, 64, 10 EDITTEXT 14007, 79, 58, 141, 10, ES_LEFT | ES_READONLY | NOT WS_BORDER - LTEXT "&':", 14008, 8, 77, 45, 10 + LTEXT "О&б'єкт:", 14008, 8, 77, 45, 10 EDITTEXT 14009, 79, 75, 150, 14, ES_AUTOHSCROLL - LTEXT "& :", 14010, 8, 96, 57, 10 + LTEXT "&Робоча папка:", 14010, 8, 96, 57, 10 EDITTEXT 14011, 79, 94, 150, 14, ES_AUTOHSCROLL - LTEXT "& :", 14014, 8, 115, 57, 10 + LTEXT "&Швидкий виклик:", 14014, 8, 115, 57, 10 EDITTEXT 14015, 79, 112, 150, 14, ES_LEFT - LTEXT "&³:", 14016, 8, 134, 57, 10 + LTEXT "&Вікно:", 14016, 8, 134, 57, 10 EDITTEXT 14017, 79, 131, 150, 14, ES_AUTOHSCROLL - LTEXT "&:", 14018, 8, 152, 57, 10 + LTEXT "&Примітка:", 14018, 8, 152, 57, 10 EDITTEXT 14019, 79, 149, 150, 14, ES_AUTOHSCROLL - PUSHBUTTON "& '...", 14020, 9, 172, 70, 14, ES_LEFT - PUSHBUTTON "& ...", 14021, 84, 172, 70, 14, ES_LEFT - PUSHBUTTON "&...", 14022, 159, 172, 70, 14, ES_LEFT + PUSHBUTTON "З&найти об'єкт...", 14020, 9, 172, 70, 14, ES_LEFT + PUSHBUTTON "&Змінити значок...", 14021, 84, 172, 70, 14, ES_LEFT + PUSHBUTTON "&Додатково...", 14022, 159, 172, 70, 14, ES_LEFT END SHELL_EXTENDED_SHORTCUT_DLG DIALOGEX 0, 0, 230, 150 STYLE DS_SHELLFONT | WS_POPUP | WS_CAPTION -CAPTION " " +CAPTION "Додаткові властивості" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT " .", -1, 5, 30, 210, 10 - CHECKBOX " ", 14000, 25, 50, 150, 10 - LTEXT " , ' .", -1, 50, 60, 175, 40 - CHECKBOX " '", 14001, 25, 100, 90, 10, WS_DISABLED + LTEXT "Виберіть потрібні властивості для цього ярлика.", -1, 5, 30, 210, 10 + CHECKBOX "Запускати з іншими обліковими даними", 14000, 25, 50, 150, 10 + LTEXT "Цей параметр дозволяє використовувати цей ярлик від імені іншого користувача або продовжувати роботу від свого імені, що захищає комп'ютер й дані від несанкціонованих дій програми.", -1, 50, 60, 175, 40 + CHECKBOX "Запускати в окремій області пам'яті", 14001, 25, 100, 90, 10, WS_DISABLED PUSHBUTTON "OK", 1, 63, 124, 50, 15, WS_VISIBLE - PUSHBUTTON "", 2, 120, 124, 50, 15, WS_VISIBLE + PUSHBUTTON "Скасувати", 2, 120, 124, 50, 15, WS_VISIBLE END SHELL_FOLDER_GENERAL_DLG DIALOGEX 0, 0, 240, 205 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Загальні" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN ICON "", 14000, 10, 3, 30, 30, WS_VISIBLE EDITTEXT 14001, 70, 9, 158, 14, ES_LEFT | ES_READONLY - LTEXT " :", 14004, 8, 35, 50, 10 - LTEXT "", 14005, 68, 35, 160, 10 - LTEXT ":", 14006, 8, 53, 50, 10 + LTEXT "Тип файлу:", 14004, 8, 35, 50, 10 + LTEXT "Тека", 14005, 68, 35, 160, 10 + LTEXT "Розташування:", 14006, 8, 53, 50, 10 EDITTEXT 14007, 68, 53, 315, 10, ES_LEFT | ES_READONLY | NOT WS_BORDER - LTEXT ":", 14008, 8, 72, 45, 10 + LTEXT "Розмір:", 14008, 8, 72, 45, 10 EDITTEXT 14009, 68, 72, 315, 10, ES_LEFT | ES_READONLY | NOT WS_BORDER - LTEXT "̳:", 14010, 8, 93, 45, 10 + LTEXT "Містить:", 14010, 8, 93, 45, 10 EDITTEXT 14011, 68, 93, 160, 10, ES_LEFT | ES_READONLY | NOT WS_BORDER - LTEXT ":", 14014, 8, 118, 45, 10 + LTEXT "Створено:", 14014, 8, 118, 45, 10 EDITTEXT 14015, 68, 118, 160, 10, ES_LEFT | ES_READONLY | NOT WS_BORDER - AUTOCHECKBOX " &", 14021, 45, 150, 67, 10 - AUTOCHECKBOX "&", 14022, 126, 150, 50, 10 + AUTOCHECKBOX "Лише &читання", 14021, 45, 150, 67, 10 + AUTOCHECKBOX "При&хована", 14022, 126, 150, 50, 10 END SHELL_FILE_GENERAL_DLG DIALOGEX 0, 0, 240, 205 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Загальні" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN ICON "", 14000, 10, 3, 30, 30, WS_VISIBLE EDITTEXT 14001, 70, 9, 158, 14, ES_LEFT | ES_READONLY - LTEXT " :", 14004, 8, 35, 50, 10 - LTEXT "", 14005, 68, 35, 160, 10 - LTEXT ":", 14006, 8, 53, 50, 10 + LTEXT "Тип файлу:", 14004, 8, 35, 50, 10 + LTEXT "Файл", 14005, 68, 35, 160, 10 + LTEXT "Додаток:", 14006, 8, 53, 50, 10 EDITTEXT 14007, 68, 53, 160, 10, ES_LEFT | ES_READONLY | NOT WS_BORDER - LTEXT ":", 14008, 8, 72, 50, 10 + LTEXT "Розташування:", 14008, 8, 72, 50, 10 EDITTEXT 14009, 68, 72, 315, 10, ES_LEFT | ES_READONLY | NOT WS_BORDER - LTEXT ":", 14010, 8, 93, 45, 10 + LTEXT "Розмір:", 14010, 8, 93, 45, 10 EDITTEXT 14011, 68, 93, 160, 10, ES_LEFT | ES_READONLY | NOT WS_BORDER - LTEXT ":", 14014, 8, 118, 45, 10 + LTEXT "Створено:", 14014, 8, 118, 45, 10 EDITTEXT 14015, 68, 118, 160, 10, ES_LEFT | ES_READONLY | NOT WS_BORDER - LTEXT ":", 14016, 8, 140, 45, 10 + LTEXT "Змінено:", 14016, 8, 140, 45, 10 EDITTEXT 14017, 68, 140, 160, 10, ES_LEFT | ES_READONLY | NOT WS_BORDER - LTEXT "³:", 14018, 8, 160, 45, 10 + LTEXT "Відкрито:", 14018, 8, 160, 45, 10 EDITTEXT 14019, 68, 160, 160, 10, ES_LEFT | ES_READONLY | NOT WS_BORDER - LTEXT ":", 14020, 8, 189, 45, 10 - CHECKBOX " &", 14021, 58, 189, 67, 10 - CHECKBOX "&", 14022, 126, 189, 50, 10 - CHECKBOX "&", 14023, 181, 189, 49, 10 + LTEXT "Атрибути:", 14020, 8, 189, 45, 10 + CHECKBOX "Лише &читання", 14021, 58, 189, 67, 10 + CHECKBOX "При&хований", 14022, 126, 189, 50, 10 + CHECKBOX "&Архівний", 14023, 181, 189, 49, 10 END SHELL_FILE_VERSION_DLG DIALOGEX 0, 0, 235, 215 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Версія" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT " : ", 14000, 10, 10, 55, 10 + LTEXT "Версія файлу: ", 14000, 10, 10, 55, 10 EDITTEXT 14001, 77, 10, 152, 10, ES_LEFT | ES_READONLY | NOT WS_BORDER - LTEXT ": ", 14002, 10, 27, 45, 10 + LTEXT "Опис: ", 14002, 10, 27, 45, 10 EDITTEXT 14003, 77, 27, 152, 10, ES_LEFT | ES_READONLY | NOT WS_BORDER - LTEXT " : ", 14004, 10, 46, 66, 10 + LTEXT "Авторські права: ", 14004, 10, 46, 66, 10 EDITTEXT 14005, 77, 46, 152, 10, ES_LEFT | ES_READONLY | NOT WS_BORDER - GROUPBOX " : ", 14006, 6, 70, 222, 115 - LTEXT "' : ", 14007, 13, 82, 50, 10 - LTEXT ": ", 14008, 112, 82, 45, 10 + GROUPBOX "Додаткові відомості: ", 14006, 6, 70, 222, 115 + LTEXT "Ім'я елемента: ", 14007, 13, 82, 50, 10 + LTEXT "Значення: ", 14008, 112, 82, 45, 10 LISTBOX 14009, 12, 94, 94, 83, LBS_STANDARD | WS_TABSTOP | LBS_NOTIFY EDITTEXT 14010, 112, 93, 109, 83, ES_LEFT | WS_BORDER | WS_VSCROLL | WS_GROUP | ES_MULTILINE | ES_READONLY END DRIVE_GENERAL_DLG DIALOGEX 0, 0, 240, 230 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Загальні" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN EDITTEXT 14000, 40, 20, 190, 14, ES_LEFT|WS_BORDER|WS_GROUP - LTEXT ":", -1, 15, 55, 40, 10 + LTEXT "Тип:", -1, 15, 55, 40, 10 EDITTEXT 14001, 110, 55, 100, 10, ES_LEFT | ES_READONLY | NOT WS_BORDER - LTEXT " :", -1, 15, 70, 100, 10 + LTEXT "Файлова система:", -1, 15, 70, 100, 10 EDITTEXT 14002, 110, 70, 100, 10, ES_LEFT | ES_READONLY | NOT WS_BORDER CONTROL "", 14013, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 5, 90, 10, 10 - LTEXT ":", -1, 25, 90, 120, 10 + LTEXT "Зайнято:", -1, 25, 90, 120, 10 EDITTEXT 14003, 110, 90, 85, 10, ES_LEFT | ES_READONLY | NOT WS_BORDER EDITTEXT 14004, 200, 90, 40, 10, ES_LEFT | ES_READONLY | NOT WS_BORDER CONTROL "", 14014, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 5, 105, 10, 10 - LTEXT ":", -1, 25, 105, 70, 10 + LTEXT "Доступно:", -1, 25, 105, 70, 10 EDITTEXT 14005, 110, 105, 85, 10, ES_LEFT | ES_READONLY | NOT WS_BORDER EDITTEXT 14006, 200, 105, 40, 10, ES_LEFT | ES_READONLY | NOT WS_BORDER - LTEXT "̳:", -1, 25, 125, 80, 10 + LTEXT "Місткість:", -1, 25, 125, 80, 10 EDITTEXT 14007, 110, 125, 85, 10, ES_LEFT | ES_READONLY | NOT WS_BORDER EDITTEXT 14008, 200, 125, 40, 10, ES_LEFT | ES_READONLY | NOT WS_BORDER CONTROL "", 14015, "Static", SS_NOTIFY | SS_SUNKEN | SS_OWNERDRAW, 20, 140, 200, 20 - LTEXT " %s", 14009, 100, 170, 40, 10 - PUSHBUTTON " ", 14010, 178, 175, 60, 15, WS_TABSTOP - CHECKBOX " ", 14011, 15, 205, 180, 10, WS_DISABLED - CHECKBOX " ", 14012, 15, 220, 200, 10, WS_DISABLED + LTEXT "Диск %s", 14009, 100, 170, 40, 10 + PUSHBUTTON "Очищення диску", 14010, 178, 175, 60, 15, WS_TABSTOP + CHECKBOX "Стискати диск для заощадження місця", 14011, 15, 205, 180, 10, WS_DISABLED + CHECKBOX "Дозволити індексування диску для прискорення пошуку", 14012, 15, 220, 200, 10, WS_DISABLED END DRIVE_EXTRA_DLG DIALOGEX 0, 0, 240, 230 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Сервіс" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - GROUPBOX " ", -1, 5, 5, 230, 60 - LTEXT " .", -1, 40, 25, 160, 20 - PUSHBUTTON " ...", 14000, 125, 45, 100, 15, WS_TABSTOP - GROUPBOX " ", -1, 5, 65, 230, 60 - LTEXT " ", -1, 40, 85, 160, 20 - PUSHBUTTON " ...", 14001, 125, 105, 100, 15, WS_TABSTOP - GROUPBOX "", -1, 5, 130, 230, 60 - LTEXT " .", -1, 40, 150, 160, 20 - PUSHBUTTON " ...", 14002, 125, 170, 100, 15, WS_TABSTOP + GROUPBOX "Перевірка диску", -1, 5, 5, 230, 60 + LTEXT "Перевірка тому на наявність помилок.", -1, 40, 25, 160, 20 + PUSHBUTTON "Виконати перевірку...", 14000, 125, 45, 100, 15, WS_TABSTOP + GROUPBOX "Дефрагментація диску", -1, 5, 65, 230, 60 + LTEXT "Дефрагментація файлів на цьому томі", -1, 40, 85, 160, 20 + PUSHBUTTON "Виконати дефрагментацію...", 14001, 125, 105, 100, 15, WS_TABSTOP + GROUPBOX "Архівація", -1, 5, 130, 230, 60 + LTEXT "Резервне копіювання файлів на цьому томі.", -1, 40, 150, 160, 20 + PUSHBUTTON "Виконати архівацію...", 14002, 125, 170, 100, 15, WS_TABSTOP END DRIVE_HARDWARE_DLG DIALOGEX 0, 0, 240, 230 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION "" +CAPTION "Обладнання" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN END RUN_AS_DIALOG DIALOGEX 0, 0, 240, 190 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Запуск від імені іншого користувача" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT " ?", -1, 10, 20, 220, 20 - CHECKBOX " %s", 14000, 10, 45, 150, 10 - LTEXT " ' ", -1, 25, 57, 200, 10, WS_DISABLED - CHECKBOX " ' , .", 14001, 25, 68, 200, 30, WS_DISABLED | BS_MULTILINE - CHECKBOX " :", 14002, 10, 100, 90, 10 - LTEXT "' :", -1, 20, 118, 54, 10 + LTEXT "Чий обліковий запис використовувати для запуску цієї програми?", -1, 10, 20, 220, 20 + CHECKBOX "Поточний користувач %s", 14000, 10, 45, 150, 10 + LTEXT "Захистити мій комп'ютер і мої дані від несанкціонованої діяльності програм", -1, 25, 57, 200, 10, WS_DISABLED + CHECKBOX "Цей режим може захистити ваш комп'ютер і дані від вірусів, але програма може працювати неправильно.", 14001, 25, 68, 200, 30, WS_DISABLED | BS_MULTILINE + CHECKBOX "Указаний користувач:", 14002, 10, 100, 90, 10 + LTEXT "Ім'я користувача:", -1, 20, 118, 54, 10 COMBOBOX 14003, 75, 115, 100, 15, CBS_DROPDOWNLIST | WS_VSCROLL | WS_VISIBLE | WS_TABSTOP PUSHBUTTON "...", 14004, 180, 115, 30, 14, WS_TABSTOP - LTEXT ":", -1, 20, 143, 53, 10 + LTEXT "Пароль:", -1, 20, 143, 53, 10 EDITTEXT 14005, 74, 140, 100, 14, ES_LEFT | WS_BORDER | WS_GROUP PUSHBUTTON "...", 14006, 180, 140, 30, 14, WS_TABSTOP PUSHBUTTON "OK", 14007, 57, 170, 60, 14, WS_TABSTOP - PUSHBUTTON "", 14008, 122, 170, 60, 14, WS_TABSTOP + PUSHBUTTON "Скасувати", 14008, 122, 170, 60, 14, WS_TABSTOP END BITBUCKET_PROPERTIES_DLG DIALOGEX 0, 0, 240, 190 STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION -CAPTION " " +CAPTION "Властивості Кошика" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN CONTROL "", 14000, "SysListView32", LVS_REPORT | LVS_SHAREIMAGELISTS | WS_BORDER | WS_TABSTOP, 10, 10, 220, 50 - GROUPBOX " ", -1, 10, 72, 220, 70 - RADIOBUTTON "& :", 14001, 20, 90, 92, 10, WS_TABSTOP + GROUPBOX "Налаштування для вибраного розташування", -1, 10, 72, 220, 70 + RADIOBUTTON "&Особливий розмір:", 14001, 20, 90, 92, 10, WS_TABSTOP EDITTEXT 14002, 120, 100, 50, 14, WS_TABSTOP | ES_NUMBER - LTEXT "& ():", -1, 20, 105, 100, 10 - RADIOBUTTON " & , ", 14003, 20, 117, 170, 20, BS_MULTILINE | WS_TABSTOP - AUTOCHECKBOX "& ", 14004, 20, 155, 165, 10, WS_TABSTOP + LTEXT "&Максимальний розмір(Мб):", -1, 20, 105, 100, 10 + RADIOBUTTON "Не переміщ&увати файли до кошика, а видаляти їх остаточно відразу", 14003, 20, 117, 170, 20, BS_MULTILINE | WS_TABSTOP + AUTOCHECKBOX "Пока&зувати діалог підтвердження видалення", 14004, 20, 155, 165, 10, WS_TABSTOP END OPEN_WITH_PROGRAMM_DLG DIALOGEX 0, 0, 264, 256 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUPWINDOW | WS_CAPTION -CAPTION " " +CAPTION "Вибір програми" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN ICON IDI_SHELL_OPEN_WITH, -1, 8, 12, 21, 20 - LTEXT " , .", -1, 44, 12, 234, 10 - LTEXT ": ", 14001, 44, 25, 188, 10 - GROUPBOX "&", -1, 7, 42, 249, 187 + LTEXT "Виберіть програму, за допомогою якої слід відкрити цей файл.", -1, 44, 12, 234, 10 + LTEXT "Файл: ", 14001, 44, 25, 188, 10 + GROUPBOX "&Програми", -1, 7, 42, 249, 187 LISTBOX 14002, 16 ,57, 230, 130, LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP, WS_EX_STATICEDGE - AUTOCHECKBOX "& ", 14003, 20, 193, 225, 10 - PUSHBUTTON "&...", 14004, 198, 207, 50, 14 + AUTOCHECKBOX "Завжд&и використовувати цю програму для файлів цього типу", 14003, 20, 193, 225, 10 + PUSHBUTTON "О&гляд...", 14004, 198, 207, 50, 14 PUSHBUTTON "OK", 14005, 150, 236, 50, 14 - PUSHBUTTON "", 14006, 206, 236, 50, 14 + PUSHBUTTON "Скасувати", 14006, 206, 236, 50, 14 END IDD_SH_FILE_COPY DIALOGEX 0, 0, 264, 45 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUPWINDOW | WS_CAPTION -CAPTION "..." +CAPTION "Копіювання..." FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - PUSHBUTTON "", 14002, 195, 14, 60, 16 + PUSHBUTTON "Скасувати", 14002, 195, 14, 60, 16 CONTROL "", 14000, "MSCTLS_PROGRESS32", 0, 8, 20, 170, 10 - LTEXT "", 14001, 8, 6, 169, 10 + LTEXT "Файл", 14001, 8, 6, 169, 10 END FOLDER_OPTIONS_GENERAL_DLG DIALOGEX 0, 0, 264, 256 STYLE DS_SHELLFONT | WS_POPUP | WS_CAPTION -CAPTION "" +CAPTION "Загальні" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - GROUPBOX "", -1, 7, 10, 249, 45 + GROUPBOX "Завдання", -1, 7, 10, 249, 45 ICON "", 30109, 14, 25, 21, 20, SS_REALSIZECONTROL - AUTORADIOBUTTON "& ", 14001, 40, 25, 170, 10, WS_TABSTOP | WS_GROUP - AUTORADIOBUTTON " & ReactOS", 14002, 40, 37, 149, 10, WS_TABSTOP | WS_GROUP - GROUPBOX " ", -1, 7, 60, 249, 45, WS_TABSTOP + AUTORADIOBUTTON "&Показувати список типових завдань у теках", 14001, 40, 25, 170, 10, WS_TABSTOP | WS_GROUP + AUTORADIOBUTTON "Використовувати зви&чайні теки ReactOS", 14002, 40, 37, 149, 10, WS_TABSTOP | WS_GROUP + GROUPBOX "Огляд тек", -1, 7, 60, 249, 45, WS_TABSTOP ICON "", 30110, 14, 70, 21, 20, SS_REALSIZECONTROL - AUTORADIOBUTTON "³ & ", 14004, 40, 70, 140, 10, WS_TABSTOP | WS_GROUP - AUTORADIOBUTTON "³& ", 14005, 40, 82, 155, 10, WS_TABSTOP | WS_GROUP - GROUPBOX " ", -1, 7, 110, 249, 60 + AUTORADIOBUTTON "Відкривати папки в то&му самому вікні", 14004, 40, 70, 140, 10, WS_TABSTOP | WS_GROUP + AUTORADIOBUTTON "Відкрива&ти кожну папку в окремому вікні", 14005, 40, 82, 155, 10, WS_TABSTOP | WS_GROUP + GROUPBOX "Клацання мишею", -1, 7, 110, 249, 60 ICON "", 30111, 14, 120, 21, 20, SS_REALSIZECONTROL - AUTORADIOBUTTON "³& , ", 14007, 40, 120, 170, 10, WS_TABSTOP | WS_GROUP - AUTORADIOBUTTON "ϳ& ", 14008, 50, 132, 170, 10, WS_TABSTOP | WS_GROUP - AUTORADIOBUTTON "ϳ& ", 14009, 50, 144, 170, 10, WS_TABSTOP | WS_GROUP - AUTORADIOBUTTON "³& , ", 14010, 40, 156, 170, 10, WS_TABSTOP | WS_GROUP - PUSHBUTTON "&", 14011, 180, 180, 60, 14, WS_TABSTOP + AUTORADIOBUTTON "Від&кривати одиночним, виділяти вказівником", 14007, 40, 120, 170, 10, WS_TABSTOP | WS_GROUP + AUTORADIOBUTTON "Підкресл&ювати підписи значків", 14008, 50, 132, 170, 10, WS_TABSTOP | WS_GROUP + AUTORADIOBUTTON "Підкр&еслювати лише при наведенні", 14009, 50, 144, 170, 10, WS_TABSTOP | WS_GROUP + AUTORADIOBUTTON "Відкрив&ати подвійним, виділяти одиночним", 14010, 40, 156, 170, 10, WS_TABSTOP | WS_GROUP + PUSHBUTTON "&Стандартно", 14011, 180, 180, 60, 14, WS_TABSTOP END FOLDER_OPTIONS_VIEW_DLG DIALOGEX 0, 0, 264, 256 STYLE DS_SHELLFONT | WS_POPUP | WS_CAPTION -CAPTION "" +CAPTION "Вигляд" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN -GROUPBOX " ", -1, 7, 10, 249, 60 +GROUPBOX "Вигляд тек", -1, 7, 10, 249, 60 //ICON -LTEXT " , (, """" """"), .", -1, 60, 20, 180, 23 -PUSHBUTTON "& ", 14001, 58, 50, 84, 14, WS_TABSTOP -PUSHBUTTON "& ", 14002, 150, 50, 80, 14, WS_TABSTOP -LTEXT " :", -1, 7, 80, 100, 10 +LTEXT "Можна застосувати вигляд, який використовується для цієї теки (наприклад, ""Таблиця"" або ""Плитка""), до всіх тек.", -1, 60, 20, 180, 23 +PUSHBUTTON "&Застосувати до всіх тек", 14001, 58, 50, 84, 14, WS_TABSTOP +PUSHBUTTON "&Скид для всіх тек", 14002, 150, 50, 80, 14, WS_TABSTOP +LTEXT "Додаткові параметри:", -1, 7, 80, 100, 10 CONTROL "", 14003, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_NOCOLUMNHEADER | LVS_SHAREIMAGELISTS | WS_BORDER | WS_TABSTOP, 7, 90, 249, 120 -PUSHBUTTON "&", 14004, 180, 210, 80, 14, WS_TABSTOP +PUSHBUTTON "&Стандартно", 14004, 180, 210, 80, 14, WS_TABSTOP END FOLDER_OPTIONS_FILETYPES_DLG DIALOGEX 0, 0, 264, 256 STYLE DS_SHELLFONT | WS_POPUP | WS_CAPTION -CAPTION " " +CAPTION "Типи файлів" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN -LTEXT " & :", -1, 7, 10, 70, 10 +LTEXT "Зареєстровані &типи файлів:", -1, 7, 10, 70, 10 CONTROL "", 14000, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHAREIMAGELISTS | WS_BORDER | WS_TABSTOP, 7, 20, 249, 80 -PUSHBUTTON "&", 14001, 120, 110, 50, 14, WS_TABSTOP -PUSHBUTTON "&", 14002, 180, 110, 50, 14, WS_TABSTOP -GROUPBOX " '%s'", 14003, 7, 130, 249, 70 -LTEXT "³ :", -1, 12, 140, 48, 10 +PUSHBUTTON "&Створити", 14001, 120, 110, 50, 14, WS_TABSTOP +PUSHBUTTON "В&идалити", 14002, 180, 110, 50, 14, WS_TABSTOP +GROUPBOX "Подробиці для розширення '%s'", 14003, 7, 130, 249, 70 +LTEXT "Відкривати у:", -1, 12, 140, 48, 10 //ICON -LTEXT "", 14005, 100, 140, 40, 10 -PUSHBUTTON "&...", 14006, 180, 140, 50, 14, WS_TABSTOP +LTEXT "Додаток", 14005, 100, 140, 40, 10 +PUSHBUTTON "&Змінити...", 14006, 180, 140, 50, 14, WS_TABSTOP LTEXT "", 14007, 12, 155, 160, 40 -PUSHBUTTON "&", 14008, 180, 175, 50, 14, WS_TABSTOP +PUSHBUTTON "&Додатково", 14008, 180, 175, 50, 14, WS_TABSTOP END CONFIRM_FILE_REPLACE_DLG DIALOGEX 0, 0, 282, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_CENTER | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION "ϳ " +CAPTION "Підтвердження заміни файлу" FONT 8, "MS Shell Dlg" BEGIN - DEFPUSHBUTTON "&", IDYES, 20, 122, 60, 14 - PUSHBUTTON " &", 12807, 85, 122, 60, 14 - PUSHBUTTON "&ͳ", IDNO, 150, 122, 60, 14 - PUSHBUTTON "", IDCANCEL, 215, 122, 60, 14 + DEFPUSHBUTTON "&Так", IDYES, 20, 122, 60, 14 + PUSHBUTTON "Так для &всіх", 12807, 85, 122, 60, 14 + PUSHBUTTON "&Ні", IDNO, 150, 122, 60, 14 + PUSHBUTTON "Скасувати", IDCANCEL, 215, 122, 60, 14 ICON 146, -1, 11, 10, 21, 20, SS_REALSIZECONTROL - LTEXT " ' '%2'.", 12291, 44, 10, 231, 22, SS_NOPREFIX - LTEXT " ' '%2'.", 12292, 41, 10, 222, 22, SS_NOPREFIX - LTEXT " ' '%2'.", 12293, 41, 10, 222, 22, SS_NOPREFIX - LTEXT " ", -1, 44, 35, 228, 10, SS_NOPREFIX - LTEXT "( )", 12302, 79, 51, 198, 20, SS_NOPREFIX + LTEXT "Ця папка вже містить файл з ім'ям '%2'.", 12291, 44, 10, 231, 22, SS_NOPREFIX + LTEXT "Ця папка вже містить доступний лише для читання файл з ім'ям '%2'.", 12292, 41, 10, 222, 22, SS_NOPREFIX + LTEXT "Ця папка вже містить системний файл з ім'ям '%2'.", 12293, 41, 10, 222, 22, SS_NOPREFIX + LTEXT "Замінити наявний файл", -1, 44, 35, 228, 10, SS_NOPREFIX + LTEXT "(дата й розмір невідомі)", 12302, 79, 51, 198, 20, SS_NOPREFIX ICON "", 12300, 50, 49, 21, 20, SS_REALSIZECONTROL - LTEXT " ?", -1, 44, 75, 228, 10, SS_NOPREFIX - LTEXT "( )", 12303, 79, 91, 198, 20, SS_NOPREFIX + LTEXT "на цей файл?", -1, 44, 75, 228, 10, SS_NOPREFIX + LTEXT "(дата й розмір невідомі)", 12303, 79, 91, 198, 20, SS_NOPREFIX ICON "", 12301, 50, 89, 21, 20, SS_REALSIZECONTROL END LOGOFF_DLG DIALOGEX 0, 0, 190, 60 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUPWINDOW | WS_CAPTION -CAPTION " ReactOS" +CAPTION "Вихід із ReactOS" FONT 8, "MS Shell Dlg" BEGIN ICON 45, 14344, 10, 10, 21, 20, SS_REALSIZECONTROL - LTEXT " ?", -1, 43, 11, 140, 22 - DEFPUSHBUTTON "&", IDOK, 57, 40, 60, 14 - PUSHBUTTON "", IDCANCEL, 122, 40, 60, 14 + LTEXT "Ви дійсно бажаєте вийти із системи?", -1, 43, 11, 140, 22 + DEFPUSHBUTTON "В&ихід", IDOK, 57, 40, 60, 14 + PUSHBUTTON "Скасувати", IDCANCEL, 122, 40, 60, 14 END DISCONNECT_DLG DIALOGEX 0, 0, 190, 60 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUPWINDOW | WS_CAPTION -CAPTION " ReactOS" +CAPTION "Вимкнення ReactOS" FONT 8, "MS Shell Dlg" BEGIN ICON 49, 14346, 10, 10, 21, 20, SS_REALSIZECONTROL - LTEXT " ?", -1, 49, 12, 137, 23 - DEFPUSHBUTTON "&", IDOK, 57, 40, 60, 14 - PUSHBUTTON "", IDCANCEL, 123, 40, 60, 14 + LTEXT "Ви дійсно бажаєте відключитися?", -1, 49, 12, 137, 23 + DEFPUSHBUTTON "&Вимкнення", IDOK, 57, 40, 60, 14 + PUSHBUTTON "Скасувати", IDCANCEL, 123, 40, 60, 14 END AUTOPLAY1_DLG DIALOGEX 0, 0, 227, 218 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CAPTION -CAPTION "" +CAPTION "Автозапуск" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "& , , :", 1000, 7, 7, 215, 20 + LTEXT "Вибері&ть тип вмісту, а потім дію, яка автоматично виконуватиметься в разі використання такого вмісту в цьому пристрої:", 1000, 7, 7, 215, 20 CONTROL "", 1001, "COMBOBOXEX32", WS_TABSTOP | 0x00000043, 7, 27, 212, 200 - GROUPBOX "ij", -1, 7, 45, 212, 146 - AUTORADIOBUTTON " &:", 1005, 14, 54, 202, 10, WS_GROUP + GROUPBOX "Дії", -1, 7, 45, 212, 146 + AUTORADIOBUTTON "Виберіть виконувану &дію:", 1005, 14, 54, 202, 10, WS_GROUP CONTROL "LIST2", 1002, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x0000C04D, 22, 66, 192, 107 - AUTORADIOBUTTON " & 䳿", 1006, 14, 177, 202, 10 - PUSHBUTTON "&³", 1008, 108, 197, 110, 14, WS_DISABLED + AUTORADIOBUTTON "Кожного ра&зу пропонувати вибір дії", 1006, 14, 177, 202, 10 + PUSHBUTTON "&Відновити", 1008, 108, 197, 110, 14, WS_DISABLED END MIXED_CONTENT1_DLG DIALOGEX 0, 0, 227, 207 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUPWINDOW | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CAPTION -CAPTION "̳ " +CAPTION "Мішаний вміст" FONT 8, "MS Shell Dlg" BEGIN ICON "", 1000, 5, 7, 21, 20 - LTEXT " .", 1001, 32, 7, 191, 20 - LTEXT " ReactOS?", 1002, 32, 31, 188, 8 + LTEXT "На цьому диску або пристрої зберігається вміст декількох типів.", 1001, 32, 7, 191, 20 + LTEXT "Яку дію слід виконувати ReactOS?", 1002, 32, 31, 188, 8 CONTROL "", 1003, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x0000C04D, 32, 43, 188, 139 DEFPUSHBUTTON "OK", IDOK, 96, 186, 60, 14 - PUSHBUTTON "", IDCANCEL, 160, 186, 60, 14 + PUSHBUTTON "Скасувати", IDCANCEL, 160, 186, 60, 14 END MIXED_CONTENT2_DLG DIALOGEX 0, 0, 227, 206 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUPWINDOW | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CAPTION -CAPTION "̳ " +CAPTION "Мішаний вміст" FONT 8, "MS Shell Dlg" BEGIN ICON "", 1000, 5, 7, 21, 20 - LTEXT "ReactOS , ' :", 1001, 30, 7, 193, 20 + LTEXT "ReactOS може виконувати одну й ту саму дію кожного разу, коли ви вставляєте диск або під'єднуєте пристрій із файлами цього типу:", 1001, 30, 7, 193, 20 ICON "", 1005, 32, 27, 11, 10, SS_REALSIZECONTROL EDITTEXT 1006, 49, 28, 177, 14, ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER | NOT WS_TABSTOP - LTEXT " ReactOS?", 1002, 32, 41, 190, 8 + LTEXT "Яку дію слід виконувати ReactOS?", 1002, 32, 41, 190, 8 CONTROL "", 1003, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x0000C04D, 32, 55, 188, 112 - AUTOCHECKBOX " .", 1004, 32, 171, 190, 10 + AUTOCHECKBOX "Завжди виконувати вибрану дію.", 1004, 32, 171, 190, 10 DEFPUSHBUTTON "OK", IDOK, 96, 185, 60, 14 - PUSHBUTTON "", IDCANCEL, 160, 185, 60, 14 + PUSHBUTTON "Скасувати", IDCANCEL, 160, 185, 60, 14 END AUTOPLAY2_DLG DIALOGEX 0, 0, 227, 181 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUPWINDOW | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CAPTION -CAPTION "" +CAPTION "Автозапуск" FONT 8, "MS Shell Dlg" BEGIN ICON "", 1000, 5, 7, 21, 20 - LTEXT "ReactOS , ' .", 1001, 32, 7, 190, 22 - LTEXT "& ReactOS?", 1002, 32, 31, 190, 8 + LTEXT "ReactOS може виконувати одну й ту саму дію кожного разу, коли ви під'єднуєте цей пристрій.", 1001, 32, 7, 190, 22 + LTEXT "&Яку дію слід виконувати ReactOS?", 1002, 32, 31, 190, 8 CONTROL "", 1003, "SYSLISTVIEW32", WS_BORDER | WS_TABSTOP | 0x0000C04D, 32, 43, 187, 96 - AUTOCHECKBOX "& ", 1004, 32, 143, 190, 8 + AUTOCHECKBOX "&Завжди виконувати вибрану дію", 1004, 32, 143, 190, 8 DEFPUSHBUTTON "OK", IDOK, 94, 160, 60, 14 - PUSHBUTTON "", IDCANCEL, 159, 160, 60, 14 + PUSHBUTTON "Скасувати", IDCANCEL, 159, 160, 60, 14 END SHUTDOWN_DLG DIALOGEX 0, 0, 211, 103 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUPWINDOW | WS_CAPTION -CAPTION " ReactOS" +CAPTION "Завершення роботи ReactOS" FONT 8, "MS Shell Dlg" BEGIN ICON 8240, -1, 6, 6, 21, 20, SS_REALSIZECONTROL | WS_GROUP - LTEXT " ?", -1, 39, 7, 167, 10 + LTEXT "Виберіть одну з таких можливостей?", -1, 39, 7, 167, 10 COMBOBOX 8224, 39, 20, 165, 200, CBS_DROPDOWNLIST | WS_VSCROLL - LTEXT " ' '. - , ' .", 8225, 39, 40, 167, 37 + LTEXT "Збереження сеансу з переведенням комп'ютера до режиму низького енергоспоживання зі збереженням даних у пам'яті. Якщо натиснути будь-яку клавішу або пересунути мишу, комп'ютер повернеться до звичайного режиму.", 8225, 39, 40, 167, 37 DEFPUSHBUTTON "OK", 1, 7, 82, 60, 14, WS_GROUP - PUSHBUTTON "", IDCANCEL, 75, 82, 60, 14 - PUSHBUTTON "&", IDHELP, 144, 82, 60, 14 + PUSHBUTTON "Скасувати", IDCANCEL, 75, 82, 60, 14 + PUSHBUTTON "&Довідка", IDHELP, 144, 82, 60, 14 END FORMAT_DLG DIALOGEX 50, 50, 184, 218 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION "" +CAPTION "Форматування" FONT 8, "MS Shell Dlg" BEGIN - DEFPUSHBUTTON "&", IDOK, 53, 198, 60, 14 - PUSHBUTTON "&", IDCANCEL, 118, 198, 60, 14 - LTEXT "&̳:", -1, 7, 6, 169, 9 + DEFPUSHBUTTON "&Почати", IDOK, 53, 198, 60, 14 + PUSHBUTTON "&Закрити", IDCANCEL, 118, 198, 60, 14 + LTEXT "&Місткість:", -1, 7, 6, 169, 9 COMBOBOX 28673, 7, 17, 170, 200, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - LTEXT "& ", -1, 7, 35, 170, 9 + LTEXT "&Файлова система", -1, 7, 35, 170, 9 COMBOBOX 28677, 7, 46, 170, 200, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP CONTROL "", 28678, "MSCTLS_PROGRESS32", 0, 7, 181, 170, 8 - LTEXT "& ", -1, 7, 64, 170, 9 + LTEXT "&Розмір кластера", -1, 7, 64, 170, 9 COMBOBOX 28680, 7, 75, 170, 200, CBS_DROPDOWNLIST | WS_VSCROLL | NOT WS_TABSTOP - LTEXT "̳& ", -1, 7, 93, 170, 9 + LTEXT "Мі&тка тому", -1, 7, 93, 170, 9 EDITTEXT 28679, 7, 103, 170, 13, ES_AUTOHSCROLL - GROUPBOX "& ", 4610, 7, 121, 170, 49 - AUTOCHECKBOX "& ( )", 28674, 16, 135, 155, 10 - AUTOCHECKBOX "& ", 28675, 16, 152, 155, 10 + GROUPBOX "&Способи форматування", 4610, 7, 121, 170, 49 + AUTOCHECKBOX "&Швидке (очищення змісту)", 28674, 16, 135, 155, 10 + AUTOCHECKBOX "&Використовувати стискання", 28675, 16, 152, 155, 10 END CHKDSK_DLG DIALOGEX 50, 50, 194, 120 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION " " +CAPTION "Перевірка диску" FONT 8, "MS Shell Dlg" BEGIN - DEFPUSHBUTTON "", IDOK, 53, 100, 60, 14 - GROUPBOX " ", -1, 7, 6, 179, 50 - PUSHBUTTON "", IDCANCEL, 118, 100, 60, 14 - AUTOCHECKBOX " ", 14000, 16, 15, 165, 10 - AUTOCHECKBOX "& ", 14001, 16, 30, 165, 10 + DEFPUSHBUTTON "Почати", IDOK, 53, 100, 60, 14 + GROUPBOX "Опції перевірки диску", -1, 7, 6, 179, 50 + PUSHBUTTON "Скасувати", IDCANCEL, 118, 100, 60, 14 + AUTOCHECKBOX "Виправити помилки файлової системи", 14000, 16, 15, 165, 10 + AUTOCHECKBOX "&Спробувати відновити погані сектори", 14001, 16, 30, 165, 10 CONTROL "", 14002, "MSCTLS_PROGRESS32", 16, 7, 60, 170, 8 LTEXT "", 14003, 60, 80, 170, 10 END IDD_PICK_ICON_DIALOG DIALOGEX 0, 0, 237, 204 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION " " +CAPTION "Зміна значка" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - LTEXT "' :", -1, 7, 14, 208, 10 - PUSHBUTTON "&...",IDC_BUTTON_PATH, 148, 24,67,14 + LTEXT "Ім'я файла:", -1, 7, 14, 208, 10 + PUSHBUTTON "О&гляд...",IDC_BUTTON_PATH, 148, 24,67,14 EDITTEXT IDC_EDIT_PATH, 6, 24, 135, 15, ES_AUTOHSCROLL - LTEXT ":", -1, 7, 47, 208, 10 + LTEXT "Значки:", -1, 7, 47, 208, 10 LISTBOX IDC_PICKICON_LIST,7,57,208,119,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | LBS_MULTICOLUMN | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP,WS_EX_STATICEDGE DEFPUSHBUTTON "OK",IDOK, 107, 181,50, 14 - PUSHBUTTON "",IDCANCEL, 167, 181, 50, 14 + PUSHBUTTON "Скасувати",IDCANCEL, 167, 181, 50, 14 END STRINGTABLE DISCARDABLE BEGIN /* columns in the shellview */ - IDS_SHV_COLUMN1 "" - IDS_SHV_COLUMN2 "" - IDS_SHV_COLUMN3 "" - IDS_SHV_COLUMN4 "" - IDS_SHV_COLUMN5 "" - IDS_SHV_COLUMN6 "" - IDS_SHV_COLUMN7 "³ " - IDS_SHV_COLUMN8 "'" - IDS_SHV_COLUMN9 "" - IDS_SHV_COLUMN10 "" - IDS_SHV_COLUMN11 "" - IDS_SHV_COLUMN12 "' " - IDS_SHV_COLUMN13 "" - IDS_SHV_COLUMN_DELFROM " " - IDS_SHV_COLUMN_DELDATE " " - IDS_SHV_COLUMN_FONTTYPE " " - IDS_SHV_COLUMN_WORKGROUP " " - IDS_SHV_NETWORKLOCATION " " - IDS_SHV_COLUMN_DOCUMENTS "" - IDS_SHV_COLUMN_STATUS "" - IDS_SHV_COLUMN_COMMENTS "" - IDS_SHV_COLUMN_LOCATION "" - IDS_SHV_COLUMN_MODEL "" + IDS_SHV_COLUMN1 "Файл" + IDS_SHV_COLUMN2 "Розмір" + IDS_SHV_COLUMN3 "Тип" + IDS_SHV_COLUMN4 "Змінено" + IDS_SHV_COLUMN5 "Атрибути" + IDS_SHV_COLUMN6 "Розмір" + IDS_SHV_COLUMN7 "Вільний Розмір" + IDS_SHV_COLUMN8 "Ім'я" + IDS_SHV_COLUMN9 "Примітка" + IDS_SHV_COLUMN10 "Власник" + IDS_SHV_COLUMN11 "Група" + IDS_SHV_COLUMN12 "Ім'я файла" + IDS_SHV_COLUMN13 "Категорія" + IDS_SHV_COLUMN_DELFROM "Вихідне розташування" + IDS_SHV_COLUMN_DELDATE "Дата видалення" + IDS_SHV_COLUMN_FONTTYPE "Тип шрифту" + IDS_SHV_COLUMN_WORKGROUP "Робоча група" + IDS_SHV_NETWORKLOCATION "Мережне розташування" + IDS_SHV_COLUMN_DOCUMENTS "Документи" + IDS_SHV_COLUMN_STATUS "Стан" + IDS_SHV_COLUMN_COMMENTS "Примітки" + IDS_SHV_COLUMN_LOCATION "Розташування" + IDS_SHV_COLUMN_MODEL "Модель" /* special folders */ - IDS_DESKTOP " " - IDS_MYCOMPUTER "̳ '" - IDS_RECYCLEBIN_FOLDER_NAME "" - IDS_CONTROLPANEL " " - IDS_ADMINISTRATIVETOOLS "" + IDS_DESKTOP "Робочий стіл" + IDS_MYCOMPUTER "Мій Комп'ютер" + IDS_RECYCLEBIN_FOLDER_NAME "Кошик" + IDS_CONTROLPANEL "Панель керування" + IDS_ADMINISTRATIVETOOLS "Адміністрування" /* context menus */ - IDS_VIEW_LARGE "& " - IDS_VIEW_SMALL "& " - IDS_VIEW_LIST "&" - IDS_VIEW_DETAILS "&" - IDS_SELECT "&" - IDS_OPEN "³&" - IDS_CREATELINK " &" - IDS_COPY "&" - IDS_DELETE "&" - IDS_PROPERTIES "&" - IDS_CUT "&" - IDS_RESTORE "³" - IDS_FORMATDRIVE "..." - IDS_RENAME "" - IDS_INSERT "" + IDS_VIEW_LARGE "&Великі значки" + IDS_VIEW_SMALL "&Дрібні значки" + IDS_VIEW_LIST "Спис&ок" + IDS_VIEW_DETAILS "&Подробиці" + IDS_SELECT "Ви&брати" + IDS_OPEN "Ві&дкрити" + IDS_CREATELINK "Створити &ярлик" + IDS_COPY "&Копіювати" + IDS_DELETE "В&идалити" + IDS_PROPERTIES "В&ластивості" + IDS_CUT "&Вирізати" + IDS_RESTORE "Відновити" + IDS_FORMATDRIVE "Форматувати..." + IDS_RENAME "Перейменувати" + IDS_INSERT "Вставити" - IDS_CREATEFOLDER_DENIED " : ³ ." - IDS_CREATEFOLDER_CAPTION " " - IDS_DELETEITEM_CAPTION "ϳ " - IDS_DELETEFOLDER_CAPTION "ϳ " - IDS_DELETEITEM_TEXT " '%1'?" - IDS_DELETEMULTIPLE_TEXT " %1 '()?" - IDS_DELETESELECTED_TEXT " '?" - IDS_TRASHITEM_TEXT " '%1' ?" - IDS_TRASHFOLDER_TEXT " '%1' ?" - IDS_TRASHMULTIPLE_TEXT " ' (%1 .) ?" - IDS_CANTTRASH_TEXT "' '%1' . ?" - IDS_OVERWRITEFILE_TEXT " ' '%1'.\n\n ?" - IDS_OVERWRITEFILE_CAPTION "ϳ " - IDS_OVERWRITEFOLDER_TEXT " ' '%1'.\n\n"\ - " , ,\n"\ - " . \n"\ - " ?" + IDS_CREATEFOLDER_DENIED "Не вдалося створити нову папку: Відмова у доступі." + IDS_CREATEFOLDER_CAPTION "Помилка при створенні нової папки" + IDS_DELETEITEM_CAPTION "Підтвердження вилучення файлу" + IDS_DELETEFOLDER_CAPTION "Підтвердження вилучення папки" + IDS_DELETEITEM_TEXT "Ви дійсно бажаєте видалити '%1'?" + IDS_DELETEMULTIPLE_TEXT "Ви дійсно бажаєте видалити ці %1 об'єкти(ів)?" + IDS_DELETESELECTED_TEXT "Ви дійсно бажаєте видалити ці об'єкти?" + IDS_TRASHITEM_TEXT "Ви дійсно бажаєте перемістити '%1' до кошика?" + IDS_TRASHFOLDER_TEXT "Ви дійсно бажаєте перемістити '%1' і весь її вміст до кошика?" + IDS_TRASHMULTIPLE_TEXT "Ви дійсно бажаєте перемістити ці об'єкти (%1 шт.) до кошика?" + IDS_CANTTRASH_TEXT "Об'єкт '%1' не можна перемістити до кошика. Бажаєте видалити його?" + IDS_OVERWRITEFILE_TEXT "Ця папка вже містить файл з ім'ям '%1'.\n\nБажаєте замінити його?" + IDS_OVERWRITEFILE_CAPTION "Підтвердження Перезапису Файлу" + IDS_OVERWRITEFOLDER_TEXT "Ця папка вже містить папку з ім'ям '%1'.\n\nЯкщо файли в папці призначення мають ті ж імена, що файли у вибраній папці,\nвони будуть замінені. Ви все ще бажаєте перемістити або\nскопіювати папку?" /* message box strings */ - IDS_RESTART_TITLE "" - IDS_RESTART_PROMPT " ?" - IDS_SHUTDOWN_TITLE "" - IDS_SHUTDOWN_PROMPT " '?" - IDS_LOGOFF_TITLE " " - IDS_LOGOFF_PROMPT " ?" + IDS_RESTART_TITLE "Перезавантажити" + IDS_RESTART_PROMPT "Ви хочете перезавантажити систему?" + IDS_SHUTDOWN_TITLE "Вимкнути" + IDS_SHUTDOWN_PROMPT "Ви хочете вимкнути комп'ютер?" + IDS_LOGOFF_TITLE "Вихід з системи" + IDS_LOGOFF_PROMPT "Ви хочете вийти з системи?" /* Run File dialog */ - IDS_RUNDLG_ERROR " ij ( )" - IDS_RUNDLG_BROWSE_ERROR " ij ( )" - IDS_RUNDLG_BROWSE_CAPTION "" - IDS_RUNDLG_BROWSE_FILTER " (*.exe)\0*.exe\0 (*.*)\0*.*\0" + IDS_RUNDLG_ERROR "Неможливо відобразити Діалог Запуску Файлу (внутрішня помилка)" + IDS_RUNDLG_BROWSE_ERROR "Неможливо відобразити Діалог Огляду (внутрішня помилка)" + IDS_RUNDLG_BROWSE_CAPTION "Огляд" + IDS_RUNDLG_BROWSE_FILTER "Виконувані Файли (*.exe)\0*.exe\0Всі Файли (*.*)\0*.*\0" /* shell folder path default values */ IDS_PROGRAMS "Start Menu\\Programs" - IDS_PERSONAL " " - IDS_FAVORITES "" + IDS_PERSONAL "Мої документи" + IDS_FAVORITES "Обране" IDS_STARTUP "Start Menu\\Programs\\StartUp" IDS_RECENT "Recent" - IDS_SENDTO "" - IDS_STARTMENU " " - IDS_MYMUSIC " " - IDS_MYVIDEO " " - IDS_DESKTOPDIRECTORY " " - IDS_NETHOOD " " - IDS_TEMPLATES "" + IDS_SENDTO "Надіслати" + IDS_STARTMENU "Головне меню" + IDS_MYMUSIC "Моя музика" + IDS_MYVIDEO "Мої відеозаписи" + IDS_DESKTOPDIRECTORY "Робочий стіл" + IDS_NETHOOD "Мережне оточення" + IDS_TEMPLATES "Шаблони" IDS_APPDATA "Application Data" - IDS_PRINTHOOD "" + IDS_PRINTHOOD "Принтери" IDS_LOCAL_APPDATA "Local Settings\\Application Data" IDS_INTERNET_CACHE "Local Settings\\Temporary Internet Files" IDS_COOKIES "Cookies" IDS_HISTORY "Local Settings\\History" IDS_PROGRAM_FILES "Program Files" - IDS_MYPICTURES " " + IDS_MYPICTURES "Мої малюнки" IDS_PROGRAM_FILES_COMMON "Program Files\\Common Files" - IDS_COMMON_DOCUMENTS " " + IDS_COMMON_DOCUMENTS "Загальні документи" IDS_ADMINTOOLS "Start Menu\\Programs\\Administrative Tools" - IDS_COMMON_MUSIC " \\ " - IDS_COMMON_PICTURES " \\ " - IDS_COMMON_VIDEO " \\ " + IDS_COMMON_MUSIC "Загальні документи\\Моя музика" + IDS_COMMON_PICTURES "Загальні документи\\Мої малюнки" + IDS_COMMON_VIDEO "Загальні документи\\Мої відеозаписи" IDS_CDBURN_AREA "Local Settings\\Application Data\\Microsoft\\CD Burning" - IDS_NETWORKPLACE " " + IDS_NETWORKPLACE "Мережне оточення" - IDS_NEWFOLDER " " + IDS_NEWFOLDER "Нова папка" - IDS_DRIVE_FIXED " " + IDS_DRIVE_FIXED "Локальний диск" IDS_DRIVE_CDROM "CDROM" - IDS_DRIVE_NETWORK " " + IDS_DRIVE_NETWORK "Мережний диск" - IDS_OPEN_WITH "³ " - IDS_OPEN_WITH_CHOOSE " ..." + IDS_OPEN_WITH "Відкрити за допомогою" + IDS_OPEN_WITH_CHOOSE "Вибрати програму..." - IDS_SHELL_ABOUT_AUTHORS "&" - IDS_SHELL_ABOUT_BACK "< &" - FCIDM_SHVIEW_NEW "" - FCIDM_SHVIEW_NEWFOLDER "&" - FCIDM_SHVIEW_NEWLINK "&" - IDS_FOLDER_OPTIONS " " - IDS_RECYCLEBIN_LOCATION " " - IDS_RECYCLEBIN_DISKSPACE " " - IDS_EMPTY_BITBUCKET " " - IDS_PICK_ICON_TITLE " " - IDS_PICK_ICON_FILTER " (*.ico, *.icl, *.exe, *.dll)\0*.ico;*.icl;*.exe;*.dll\0 (*.*)\0*.*\0" - IDS_OPEN_WITH_FILTER " (*.exe)\0*.exe\0 (*.*)\0*.*\0" - IDS_DIRECTORY "" - IDS_VIRTUAL_DRIVER " " - IDS_BAT_FILE " ReactOS" - IDS_CMD_FILE " ReactOS" - IDS_COM_FILE " Dos" - IDS_CPL_FILE " " - IDS_CUR_FILE "" - IDS_DLL_FILE " " - IDS_DRV_FILE " " - IDS_EXE_FILE "" - IDS_FON_FILE " " - IDS_TTF_FILE " TrueType" - IDS_HLP_FILE " " - IDS_INI_FILE " " - IDS_LNK_FILE "" - IDS_SYS_FILE " " + IDS_SHELL_ABOUT_AUTHORS "&Автори" + IDS_SHELL_ABOUT_BACK "< &Назад" + FCIDM_SHVIEW_NEW "Створити" + FCIDM_SHVIEW_NEWFOLDER "&Папку" + FCIDM_SHVIEW_NEWLINK "&Ярлик" + IDS_FOLDER_OPTIONS "Властивості теки" + IDS_RECYCLEBIN_LOCATION "Розташування Кошика" + IDS_RECYCLEBIN_DISKSPACE "Доступний простір" + IDS_EMPTY_BITBUCKET "Очистити Кошик" + IDS_PICK_ICON_TITLE "Вибрати значок" + IDS_PICK_ICON_FILTER "Файли значків (*.ico, *.icl, *.exe, *.dll)\0*.ico;*.icl;*.exe;*.dll\0Всі Файли (*.*)\0*.*\0" + IDS_OPEN_WITH_FILTER "Виконувані файли (*.exe)\0*.exe\0Всі Файли (*.*)\0*.*\0" + IDS_DIRECTORY "Папка" + IDS_VIRTUAL_DRIVER "Драйвер віртуального пристрою" + IDS_BAT_FILE "Пакетний файл ReactOS" + IDS_CMD_FILE "Командний скрипт ReactOS" + IDS_COM_FILE "Додаток Dos" + IDS_CPL_FILE "Елемент панелі керування" + IDS_CUR_FILE "Курсор" + IDS_DLL_FILE "Розширення додатку" + IDS_DRV_FILE "Драйвер пристрою" + IDS_EXE_FILE "Додаток" + IDS_FON_FILE "Файл шрифту" + IDS_TTF_FILE "Файл шрифту TrueType" + IDS_HLP_FILE "Файл довідки" + IDS_INI_FILE "Файл налаштувань" + IDS_LNK_FILE "Ярлик" + IDS_SYS_FILE "Системний файл" - IDS_OPEN_VERB "³" - IDS_EXPLORE_VERB "³ " - IDS_RUNAS_VERB " " - IDS_EDIT_VERB "" - IDS_FIND_VERB "" - IDS_PRINT_VERB "" + IDS_OPEN_VERB "Відкрити" + IDS_EXPLORE_VERB "Відкрити в дереві" + IDS_RUNAS_VERB "Запустити як " + IDS_EDIT_VERB "Змінити" + IDS_FIND_VERB "Пошук" + IDS_PRINT_VERB "Друк" - IDS_FILE_FOLDER "%u , %u " - IDS_PRINTERS "" - IDS_FONTS "" - IDS_INSTALLNEWFONT " ..." + IDS_FILE_FOLDER "%u файлів, %u папок" + IDS_PRINTERS "Принтери" + IDS_FONTS "Шрифти" + IDS_INSTALLNEWFONT "Інсталювати новий шрифт..." - IDS_DEFAULT_CLUSTER_SIZE " " - IDS_COPY_OF "" + IDS_DEFAULT_CLUSTER_SIZE "Розмір кластера за замовчуванням" + IDS_COPY_OF "Копія" - IDS_SHLEXEC_NOASSOC " Windows, ." + IDS_SHLEXEC_NOASSOC "Немає програми Windows, сконфігурованої для відкриття цього типу файлів." - IDS_FILE_DETAILS " '%s'" - IDS_FILE_DETAILSADV " '%s' '%s'. , '%s', ''." - IDS_FILE_TYPES " " - IDS_COLUMN_EXTENSION "" + IDS_FILE_DETAILS "Подробиці для розширення '%s'" + IDS_FILE_DETAILSADV "Файли з розширенням '%s' мають тип '%s'. Щоб змінити параметри, які впливатимуть на всі файли '%s', натисніть кнопку 'Додатково'." + IDS_FILE_TYPES "Типи Файлів" + IDS_COLUMN_EXTENSION "Розширення" END diff --git a/dll/win32/shell32/lang/zh-CN.rc b/dll/win32/shell32/lang/zh-CN.rc index 00602a08085..9ee6d341b93 100644 --- a/dll/win32/shell32/lang/zh-CN.rc +++ b/dll/win32/shell32/lang/zh-CN.rc @@ -114,7 +114,7 @@ FONT 8, "MS Shell Dlg" BEGIN ICON "", IDC_SHELL_ABOUT_ICON, 7, 55, 21, 20 LTEXT "", IDC_SHELL_ABOUT_APPNAME, 35, 55, 200, 10 - LTEXT "Version " KERNEL_VERSION_STR " (" KERNEL_VERSION_BUILD_STR ")", IDC_STATIC, 35, 65, 235, 10 + LTEXT "Version "KERNEL_VERSION_STR" ("KERNEL_VERSION_BUILD_STR")", IDC_STATIC, 35, 65, 235, 10 LTEXT REACTOS_DEFAULT_STR_LEGAL_COPYRIGHT, IDC_STATIC, 35, 75, 210, 10 LTEXT "", IDC_SHELL_ABOUT_OTHERSTUFF, 35, 90, 180, 20 LTEXT "This ReactOS version is registered to:", IDC_STATIC, 35, 115, 180, 10 @@ -644,10 +644,7 @@ BEGIN IDS_CANTTRASH_TEXT "The item '%1' can't be sent to Trash. Do you want to delete it instead?" IDS_OVERWRITEFILE_TEXT "This folder already contains a file called '%1'.\n\nDo you want to replace it?" IDS_OVERWRITEFILE_CAPTION "Confirm file overwrite" - IDS_OVERWRITEFOLDER_TEXT "This folder already contains a folder named '%1'.\n\n"\ - "If the files in the destination folder have the same names as files in the\n"\ - "selected folder they will be replaced. Do you still want to move or copy\n"\ - "the folder?" + IDS_OVERWRITEFOLDER_TEXT "This folder already contains a folder named '%1'.\n\nIf the files in the destination folder have the same names as files in the\nselected folder they will be replaced. Do you still want to move or copy\nthe folder?" /* message box strings */ IDS_RESTART_TITLE "" diff --git a/dll/win32/shell32/lang/zh-TW.rc b/dll/win32/shell32/lang/zh-TW.rc index 376f7fbb056..28cc99410f7 100644 --- a/dll/win32/shell32/lang/zh-TW.rc +++ b/dll/win32/shell32/lang/zh-TW.rc @@ -126,7 +126,7 @@ FONT 8, "MS Shell Dlg" BEGIN ICON "", IDC_SHELL_ABOUT_ICON, 7, 55, 21, 20 LTEXT "", IDC_SHELL_ABOUT_APPNAME, 35, 55, 200, 10 - LTEXT "Version " KERNEL_VERSION_STR " (" KERNEL_VERSION_BUILD_STR ")", IDC_STATIC, 35, 65, 235, 10 + LTEXT "Version "KERNEL_VERSION_STR" ("KERNEL_VERSION_BUILD_STR")", IDC_STATIC, 35, 65, 235, 10 LTEXT REACTOS_DEFAULT_STR_LEGAL_COPYRIGHT, IDC_STATIC, 35, 75, 210, 10 LTEXT "", IDC_SHELL_ABOUT_OTHERSTUFF, 35, 90, 180, 20 LTEXT "This ReactOS version is registered to:", IDC_STATIC, 35, 115, 180, 10 @@ -656,10 +656,7 @@ BEGIN IDS_CANTTRASH_TEXT "The item '%1' can't be sent to Trash. Do you want to delete it instead?" IDS_OVERWRITEFILE_TEXT "This folder already contains a file called '%1'.\n\nDo you want to replace it?" IDS_OVERWRITEFILE_CAPTION "Confirm file overwrite" - IDS_OVERWRITEFOLDER_TEXT "This folder already contains a folder named '%1'.\n\n"\ - "If the files in the destination folder have the same names as files in the\n"\ - "selected folder they will be replaced. Do you still want to move or copy\n"\ - "the folder?" + IDS_OVERWRITEFOLDER_TEXT "This folder already contains a folder named '%1'.\n\nIf the files in the destination folder have the same names as files in the\nselected folder they will be replaced. Do you still want to move or copy\nthe folder?" /* message box strings */ IDS_RESTART_TITLE "Restart" diff --git a/dll/win32/shell32/precomp.h b/dll/win32/shell32/precomp.h index a9bc7a39af3..f3f84169159 100644 --- a/dll/win32/shell32/precomp.h +++ b/dll/win32/shell32/precomp.h @@ -11,10 +11,13 @@ #include #include +#define COBJMACROS +#define NONAMELESSUNION +#define NONAMELESSSTRUCT #define WIN32_NO_STATUS #define NTOS_MODE_USER + #include -#include #include #include @@ -30,6 +33,8 @@ #include #include #include +//#include +//#include #include #include #include @@ -37,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -61,7 +67,36 @@ #include "xdg.h" #include "shellapi.h" +#include "shfldr_fs.h" +#include "shfldr_mycomp.h" +#include "shfldr_desktop.h" +#include "shellitem.h" +#include "shelllink.h" +#include "dragdrophelper.h" +#include "shfldr_cpanel.h" +#include "autocomplete.h" +#include "shfldr_mydocuments.h" +#include "shfldr_netplaces.h" +#include "shfldr_fonts.h" +#include "shfldr_printers.h" +#include "shfldr_admintools.h" +#include "shfldr_recyclebin.h" +#include "she_ocmenu.h" +#include "shv_item_new.h" +#include "startmenu.h" + #include "wine/debug.h" #include "wine/unicode.h" +extern const GUID CLSID_AdminFolderShortcut; +extern const GUID CLSID_FontsFolderShortcut; +extern const GUID CLSID_StartMenu; +extern const GUID CLSID_MenuBandSite; +extern const GUID CLSID_OpenWith; +extern const GUID CLSID_UnixFolder; +extern const GUID CLSID_UnixDosFolder; +extern const GUID SHELL32_AdvtShortcutProduct; +extern const GUID SHELL32_AdvtShortcutComponent; + + #endif diff --git a/dll/win32/shell32/she_ocmenu.cpp b/dll/win32/shell32/she_ocmenu.cpp index 9911f00d9a2..c595b5b6df2 100644 --- a/dll/win32/shell32/she_ocmenu.cpp +++ b/dll/win32/shell32/she_ocmenu.cpp @@ -20,11 +20,6 @@ */ #include -#include -#include -#include -#include -#include "she_ocmenu.h" WINE_DEFAULT_DEBUG_CHANNEL (shell); diff --git a/dll/win32/shell32/shell.cpp b/dll/win32/shell32/shell.cpp index 71761fc49ad..2813943aff7 100644 --- a/dll/win32/shell32/shell.cpp +++ b/dll/win32/shell32/shell.cpp @@ -19,15 +19,3 @@ * 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 -#include -#include -#include -#include -#include -#include - - - - diff --git a/dll/win32/shell32/shell32.rc b/dll/win32/shell32/shell32.rc index 5fc578b5334..88169ea741b 100644 --- a/dll/win32/shell32/shell32.rc +++ b/dll/win32/shell32/shell32.rc @@ -69,11 +69,14 @@ END #include "lang/pt-BR.rc" #include "lang/pt-PT.rc" #include "lang/ro-RO.rc" -#include "lang/ru-RU.rc" #include "lang/sl-SI.rc" #include "lang/sk-SK.rc" #include "lang/sv-SE.rc" #include "lang/tr-TR.rc" -#include "lang/uk-UA.rc" #include "lang/zh-CN.rc" #include "lang/zh-TW.rc" + +// UTF-8 +#pragma code_page(65001) +#include "lang/ru-RU.rc" +#include "lang/uk-UA.rc" diff --git a/dll/win32/shell32/shell32_main.cpp b/dll/win32/shell32/shell32_main.cpp index 631ef229a0c..c87ab499065 100644 --- a/dll/win32/shell32/shell32_main.cpp +++ b/dll/win32/shell32/shell32_main.cpp @@ -20,23 +20,6 @@ */ #include -#include "shfldr_fs.h" -#include "shfldr_mycomp.h" -#include "shfldr_desktop.h" -#include "shellitem.h" -#include "shelllink.h" -#include "dragdrophelper.h" -#include "shfldr_cpanel.h" -#include "autocomplete.h" -#include "shfldr_mydocuments.h" -#include "shfldr_netplaces.h" -#include "shfldr_fonts.h" -#include "shfldr_printers.h" -#include "shfldr_admintools.h" -#include "shfldr_recyclebin.h" -#include "she_ocmenu.h" -#include "shv_item_new.h" -#include "startmenu.h" WINE_DEFAULT_DEBUG_CHANNEL(shell); diff --git a/dll/win32/shell32/shellitem.cpp b/dll/win32/shell32/shellitem.cpp index 4a7b52d3383..e0620b12388 100644 --- a/dll/win32/shell32/shellitem.cpp +++ b/dll/win32/shell32/shellitem.cpp @@ -20,11 +20,6 @@ */ #include "precomp.h" -#include -#include -#include -#include -#include "shellitem.h" WINE_DEFAULT_DEBUG_CHANNEL(shell); diff --git a/dll/win32/shell32/shelllink.cpp b/dll/win32/shell32/shelllink.cpp index ac6f2f92a4e..5ec47f0088c 100644 --- a/dll/win32/shell32/shelllink.cpp +++ b/dll/win32/shell32/shelllink.cpp @@ -34,11 +34,6 @@ */ #include -#include -#include -#include -#include -#include "shelllink.h" WINE_DEFAULT_DEBUG_CHANNEL(shell); diff --git a/dll/win32/shell32/shellole.cpp b/dll/win32/shell32/shellole.cpp index 3c01c0a360d..2ab756154c6 100644 --- a/dll/win32/shell32/shellole.cpp +++ b/dll/win32/shell32/shellole.cpp @@ -20,11 +20,6 @@ */ #include -#include -#include -#include -#include -#include "shfldr_desktop.h" WINE_DEFAULT_DEBUG_CHANNEL(shell); diff --git a/dll/win32/shell32/shellord.cpp b/dll/win32/shell32/shellord.cpp index 94829301fb6..5aa69e432d6 100644 --- a/dll/win32/shell32/shellord.cpp +++ b/dll/win32/shell32/shellord.cpp @@ -19,61 +19,19 @@ * 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 "config.h" -#include -#include -#include - -#include "winerror.h" -#include "windef.h" -#include "winbase.h" -#include "winreg.h" -#include "wine/debug.h" -#include "winnls.h" -#include "winternl.h" - -#include -#include -#include -#include - -#include "shellapi.h" -#include "objbase.h" -#include "shlguid.h" -#include "wingdi.h" -#include "winuser.h" -#include "shlobj.h" -#include "shell32_main.h" -#include "undocshell.h" -#include "pidl.h" -#include "shlwapi.h" -#include "commdlg.h" -#include "recyclebin.h" -#include "commoncontrols.h" +#include WINE_DEFAULT_DEBUG_CHANNEL(shell); WINE_DECLARE_DEBUG_CHANNEL(pidl); -/* FIXME: !!! move CREATEMRULIST and flags to header file !!! */ -/* !!! it is in both here and comctl32undoc.c !!! */ -typedef struct tagCREATEMRULIST -{ - DWORD cbSize; /* size of struct */ - DWORD nMaxItems; /* max no. of items in list */ - DWORD dwFlags; /* see below */ - HKEY hKey; /* root reg. key under which list is saved */ - LPCSTR lpszSubKey; /* reg. subkey */ - PROC lpfnCompare; /* item compare proc */ -} CREATEMRULISTA, *LPCREATEMRULISTA; - +/* FIXME: !!! move flags to header file !!! */ /* dwFlags */ #define MRUF_STRING_LIST 0 /* list will contain strings */ #define MRUF_BINARY_LIST 1 /* list will contain binary data */ #define MRUF_DELAYED_SAVE 2 /* only save list order to reg. is FreeMRUList */ EXTERN_C HANDLE WINAPI CreateMRUListA(LPCREATEMRULISTA lpcml); -EXTERN_C DWORD WINAPI FreeMRUList(HANDLE hMRUList); EXTERN_C INT WINAPI AddMRUData(HANDLE hList, LPCVOID lpData, DWORD cbData); EXTERN_C INT WINAPI FindMRUData(HANDLE hList, LPCVOID lpData, DWORD cbData, LPINT lpRegNum); EXTERN_C INT WINAPI EnumMRUListA(HANDLE hList, INT nItemPos, LPVOID lpBuffer, DWORD nBufferSize); diff --git a/dll/win32/shell32/shfldr_admintools.cpp b/dll/win32/shell32/shfldr_admintools.cpp index 756228e31bf..e9762f388d4 100644 --- a/dll/win32/shell32/shfldr_admintools.cpp +++ b/dll/win32/shell32/shfldr_admintools.cpp @@ -20,11 +20,6 @@ */ #include -#include -#include -#include -#include -#include "shfldr_admintools.h" WINE_DEFAULT_DEBUG_CHANNEL (shell); diff --git a/dll/win32/shell32/shfldr_cpanel.cpp b/dll/win32/shell32/shfldr_cpanel.cpp index 5f72b859c12..45806237ccd 100644 --- a/dll/win32/shell32/shfldr_cpanel.cpp +++ b/dll/win32/shell32/shfldr_cpanel.cpp @@ -26,12 +26,6 @@ TODO: */ #include -#include -#include -#include -#include -#include "shfldr_cpanel.h" -#include "shelllink.h" WINE_DEFAULT_DEBUG_CHANNEL(shell); diff --git a/dll/win32/shell32/shfldr_desktop.cpp b/dll/win32/shell32/shfldr_desktop.cpp index fe03e9ed913..6b87052964a 100644 --- a/dll/win32/shell32/shfldr_desktop.cpp +++ b/dll/win32/shell32/shfldr_desktop.cpp @@ -21,11 +21,6 @@ */ #include -#include -#include -#include -#include -#include "shfldr_desktop.h" WINE_DEFAULT_DEBUG_CHANNEL (shell); diff --git a/dll/win32/shell32/shfldr_fonts.cpp b/dll/win32/shell32/shfldr_fonts.cpp index 3d88bdad834..37f9ad74894 100644 --- a/dll/win32/shell32/shfldr_fonts.cpp +++ b/dll/win32/shell32/shfldr_fonts.cpp @@ -20,11 +20,6 @@ */ #include -#include -#include -#include -#include -#include "shfldr_fonts.h" WINE_DEFAULT_DEBUG_CHANNEL (shell); diff --git a/dll/win32/shell32/shfldr_fs.cpp b/dll/win32/shell32/shfldr_fs.cpp index df1d3cc48d9..030b6daee81 100644 --- a/dll/win32/shell32/shfldr_fs.cpp +++ b/dll/win32/shell32/shfldr_fs.cpp @@ -21,11 +21,6 @@ */ #include -#include -#include -#include -#include -#include "shfldr_fs.h" WINE_DEFAULT_DEBUG_CHANNEL (shell); diff --git a/dll/win32/shell32/shfldr_mycomp.cpp b/dll/win32/shell32/shfldr_mycomp.cpp index d950fb6b22c..a294f2ccd16 100644 --- a/dll/win32/shell32/shfldr_mycomp.cpp +++ b/dll/win32/shell32/shfldr_mycomp.cpp @@ -21,11 +21,6 @@ */ #include -#include -#include -#include -#include -#include "shfldr_mycomp.h" WINE_DEFAULT_DEBUG_CHANNEL (shell); diff --git a/dll/win32/shell32/shfldr_mydocuments.cpp b/dll/win32/shell32/shfldr_mydocuments.cpp index f72f32c88ce..525a0823edd 100644 --- a/dll/win32/shell32/shfldr_mydocuments.cpp +++ b/dll/win32/shell32/shfldr_mydocuments.cpp @@ -20,11 +20,6 @@ */ #include -#include -#include -#include -#include -#include "shfldr_mydocuments.h" WINE_DEFAULT_DEBUG_CHANNEL (mydocs); diff --git a/dll/win32/shell32/shfldr_netplaces.cpp b/dll/win32/shell32/shfldr_netplaces.cpp index c4facd2a829..3320697093b 100644 --- a/dll/win32/shell32/shfldr_netplaces.cpp +++ b/dll/win32/shell32/shfldr_netplaces.cpp @@ -22,11 +22,6 @@ */ #include -#include -#include -#include -#include -#include "shfldr_netplaces.h" WINE_DEFAULT_DEBUG_CHANNEL (shell); diff --git a/dll/win32/shell32/shfldr_printers.cpp b/dll/win32/shell32/shfldr_printers.cpp index b04601b8b54..c04aac00a26 100644 --- a/dll/win32/shell32/shfldr_printers.cpp +++ b/dll/win32/shell32/shfldr_printers.cpp @@ -22,11 +22,6 @@ */ #include -#include -#include -#include -#include -#include "shfldr_printers.h" WINE_DEFAULT_DEBUG_CHANNEL (shell); diff --git a/dll/win32/shell32/shfldr_recyclebin.cpp b/dll/win32/shell32/shfldr_recyclebin.cpp index d0c39eb13a2..1035a1ee250 100644 --- a/dll/win32/shell32/shfldr_recyclebin.cpp +++ b/dll/win32/shell32/shfldr_recyclebin.cpp @@ -22,11 +22,6 @@ #define MAX_PROPERTY_SHEET_PAGE 32 #include -#include -#include -#include -#include -#include "shfldr_recyclebin.h" WINE_DEFAULT_DEBUG_CHANNEL(CBitBucket); diff --git a/dll/win32/shell32/shlfsbind.cpp b/dll/win32/shell32/shlfsbind.cpp index 6cd898531b8..c194a8df7bf 100644 --- a/dll/win32/shell32/shlfsbind.cpp +++ b/dll/win32/shell32/shlfsbind.cpp @@ -21,10 +21,6 @@ */ #include -#include -#include -#include -#include WINE_DEFAULT_DEBUG_CHANNEL(pidl); diff --git a/dll/win32/shell32/shlview.cpp b/dll/win32/shell32/shlview.cpp index 1a7c6d9e914..fb4ecc861fb 100644 --- a/dll/win32/shell32/shlview.cpp +++ b/dll/win32/shell32/shlview.cpp @@ -49,11 +49,6 @@ TODO: */ #include -#include -#include -#include -#include -#include "shlwapi_undoc.h" WINE_DEFAULT_DEBUG_CHANNEL(shell); diff --git a/dll/win32/shell32/shv_def_cmenu.cpp b/dll/win32/shell32/shv_def_cmenu.cpp index 13ce1a1028b..250c5da8898 100644 --- a/dll/win32/shell32/shv_def_cmenu.cpp +++ b/dll/win32/shell32/shv_def_cmenu.cpp @@ -16,11 +16,6 @@ TODO: */ #include -#include -#include -#include -#include -#include "shelllink.h" WINE_DEFAULT_DEBUG_CHANNEL(dmenu); diff --git a/dll/win32/shell32/shv_item_new.cpp b/dll/win32/shell32/shv_item_new.cpp index c04b3870f9b..8bdf93f552c 100644 --- a/dll/win32/shell32/shv_item_new.cpp +++ b/dll/win32/shell32/shv_item_new.cpp @@ -20,12 +20,6 @@ */ #include -#include -#include -#include -#include -#include -#include "shv_item_new.h" WINE_DEFAULT_DEBUG_CHANNEL(shell); diff --git a/dll/win32/shell32/startmenu.cpp b/dll/win32/shell32/startmenu.cpp index 2b3f81101a0..9834b36272a 100644 --- a/dll/win32/shell32/startmenu.cpp +++ b/dll/win32/shell32/startmenu.cpp @@ -19,11 +19,6 @@ */ #include -#include -#include -#include -#include -#include "startmenu.h" WINE_DEFAULT_DEBUG_CHANNEL(shell32start); diff --git a/dll/win32/shell32/systray.cpp b/dll/win32/shell32/systray.cpp index 81297a78907..1ca8edfd431 100644 --- a/dll/win32/shell32/systray.cpp +++ b/dll/win32/shell32/systray.cpp @@ -20,19 +20,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#define NONAMELESSUNION -#define NONAMELESSSTRUCT - -#include - -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "winnls.h" -#include "winuser.h" -#include "shellapi.h" - -#include "wine/debug.h" +#include WINE_DEFAULT_DEBUG_CHANNEL(systray); diff --git a/dll/win32/shimgvw/lang/pl-PL.rc b/dll/win32/shimgvw/lang/pl-PL.rc index 1237b398840..dd90848c68b 100644 --- a/dll/win32/shimgvw/lang/pl-PL.rc +++ b/dll/win32/shimgvw/lang/pl-PL.rc @@ -1,18 +1,23 @@ +/* + * Polish translation by Rafal Harabien (Apr, 2011) + * UTF-8 conversion by Caemyr (May, 2011) + */ + LANGUAGE LANG_POLISH, SUBLANG_DEFAULT STRINGTABLE BEGIN - IDS_APPTITLE "Przegldarka obrazw i faxw ReactOS" - IDS_SETASDESKBG "Ustaw jako to pulpitu" - IDS_PREVIEW "Podgld" + IDS_APPTITLE "Przeglądarka obrazów i faksów ReactOS" + IDS_SETASDESKBG "Ustaw jako tło pulpitu" + IDS_PREVIEW "Podgląd" /* Tooltips */ - IDS_TOOLTIP_NEXT_PIC "Nastpny obraz" + IDS_TOOLTIP_NEXT_PIC "Następny obraz" IDS_TOOLTIP_PREV_PIC "Poprzedni obraz" - IDS_TOOLTIP_ZOOM_IN "Powiksz (+)" + IDS_TOOLTIP_ZOOM_IN "Powiększ (+)" IDS_TOOLTIP_ZOOM_OUT "Pomniejsz (-)" - IDS_TOOLTIP_ROT_CLOCKW "Obr zgodnie z ruchem wskazwek zegara (Ctrl+K)" - IDS_TOOLTIP_ROT_COUNCW "Obr przeciwnie do ruchu wskazwek zegara (Ctrl+L)" + IDS_TOOLTIP_ROT_CLOCKW "Obróć zgodnie z ruchem wskazówek zegara (Ctrl+K)" + IDS_TOOLTIP_ROT_COUNCW "Obróć przeciwnie do ruchu wskazówek zegara (Ctrl+L)" IDS_TOOLTIP_PRINT "Drukuj (Ctrl+P)" IDS_TOOLTIP_SAVEAS "Zapisz jako... (Ctrl+S)" END diff --git a/dll/win32/shimgvw/lang/ru-RU.rc b/dll/win32/shimgvw/lang/ru-RU.rc index 27ae9d88042..82c054ed056 100644 --- a/dll/win32/shimgvw/lang/ru-RU.rc +++ b/dll/win32/shimgvw/lang/ru-RU.rc @@ -2,17 +2,17 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT STRINGTABLE BEGIN - IDS_APPTITLE " " - IDS_SETASDESKBG " " - IDS_PREVIEW "" + IDS_APPTITLE "Программа просмотра изображений и факсов" + IDS_SETASDESKBG "Установить как фон рабочего стола" + IDS_PREVIEW "Предпросмотр" /* Tooltips */ - IDS_TOOLTIP_NEXT_PIC " " - IDS_TOOLTIP_PREV_PIC " " - IDS_TOOLTIP_ZOOM_IN " (+)" - IDS_TOOLTIP_ZOOM_OUT " (-)" - IDS_TOOLTIP_ROT_CLOCKW " (Ctrl+K)" - IDS_TOOLTIP_ROT_COUNCW " (Ctrl+L)" - IDS_TOOLTIP_PRINT " (Ctrl+P)" - IDS_TOOLTIP_SAVEAS " ... (Ctrl+S)" + IDS_TOOLTIP_NEXT_PIC "Следующее изображение" + IDS_TOOLTIP_PREV_PIC "Предыдущее изображение" + IDS_TOOLTIP_ZOOM_IN "Увеличить (+)" + IDS_TOOLTIP_ZOOM_OUT "Уменьшить (-)" + IDS_TOOLTIP_ROT_CLOCKW "Повернуть по часовой стрелке (Ctrl+K)" + IDS_TOOLTIP_ROT_COUNCW "Повернуть против часовой стрелки (Ctrl+L)" + IDS_TOOLTIP_PRINT "Печать (Ctrl+P)" + IDS_TOOLTIP_SAVEAS "Сохранить как... (Ctrl+S)" END diff --git a/dll/win32/shimgvw/lang/uk-UA.rc b/dll/win32/shimgvw/lang/uk-UA.rc index 3c323fc2e4e..b69a9247303 100644 --- a/dll/win32/shimgvw/lang/uk-UA.rc +++ b/dll/win32/shimgvw/lang/uk-UA.rc @@ -10,17 +10,17 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT STRINGTABLE BEGIN - IDS_APPTITLE " ReactOS" - IDS_SETASDESKBG " " - IDS_PREVIEW "" + IDS_APPTITLE "Програма перегляду зображень і факсів ReactOS" + IDS_SETASDESKBG "Встановити як фон робочого столу" + IDS_PREVIEW "Перегляд" /* Tooltips */ - IDS_TOOLTIP_NEXT_PIC " " - IDS_TOOLTIP_PREV_PIC " " - IDS_TOOLTIP_ZOOM_IN " (+)" - IDS_TOOLTIP_ZOOM_OUT " (-)" - IDS_TOOLTIP_ROT_CLOCKW " (Ctrl+K)" - IDS_TOOLTIP_ROT_COUNCW " (Ctrl+L)" - IDS_TOOLTIP_PRINT " (Ctrl+P)" - IDS_TOOLTIP_SAVEAS " ... (Ctrl+S)" + IDS_TOOLTIP_NEXT_PIC "Наступне зображення" + IDS_TOOLTIP_PREV_PIC "Попереднє зображення" + IDS_TOOLTIP_ZOOM_IN "Збільшити (+)" + IDS_TOOLTIP_ZOOM_OUT "Зменшити (-)" + IDS_TOOLTIP_ROT_CLOCKW "Повернути за годинниковою стрілкою (Ctrl+K)" + IDS_TOOLTIP_ROT_COUNCW "Повернути проти годинникової стрілки (Ctrl+L)" + IDS_TOOLTIP_PRINT "Друк (Ctrl+P)" + IDS_TOOLTIP_SAVEAS "Зберегти як... (Ctrl+S)" END diff --git a/dll/win32/shimgvw/rsrc.rc b/dll/win32/shimgvw/rsrc.rc index 55f1bd3cb83..8b45ab5d4a5 100644 --- a/dll/win32/shimgvw/rsrc.rc +++ b/dll/win32/shimgvw/rsrc.rc @@ -10,7 +10,10 @@ #include "lang/it-IT.rc" #include "lang/no-NO.rc" #include "lang/lt-LT.rc" +#include "lang/sk-SK.rc" + +// UTF-8 +#pragma code_page(65001) #include "lang/pl-PL.rc" #include "lang/ru-RU.rc" -#include "lang/sk-SK.rc" #include "lang/uk-UA.rc" diff --git a/dll/win32/shlwapi/CMakeLists.txt b/dll/win32/shlwapi/CMakeLists.txt index f4d8ab7023b..bffd225a6e8 100644 --- a/dll/win32/shlwapi/CMakeLists.txt +++ b/dll/win32/shlwapi/CMakeLists.txt @@ -46,10 +46,10 @@ add_importlibs(shlwapi winmm version shell32 + msvcrt kernel32 userenv wininet - msvcrt ntdll) add_cd_file(TARGET shlwapi DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/shlwapi/shlwapi.rc b/dll/win32/shlwapi/shlwapi.rc index 0dd60f80528..869e4296aae 100644 --- a/dll/win32/shlwapi/shlwapi.rc +++ b/dll/win32/shlwapi/shlwapi.rc @@ -37,7 +37,6 @@ #include "shlwapi_Sk.rc" #include "shlwapi_Sv.rc" #include "shlwapi_Tr.rc" -#include "shlwapi_Uk.rc" /* UTF-8 */ @@ -50,4 +49,5 @@ #include "shlwapi_Ro.rc" #include "shlwapi_Ru.rc" #include "shlwapi_Si.rc" +#include "shlwapi_Uk.rc" #include "shlwapi_Zh.rc" diff --git a/dll/win32/shlwapi/shlwapi_Es.rc b/dll/win32/shlwapi/shlwapi_Es.rc index 4de3cb22d21..16c9d52cc35 100644 --- a/dll/win32/shlwapi/shlwapi_Es.rc +++ b/dll/win32/shlwapi/shlwapi_Es.rc @@ -30,10 +30,10 @@ FONT 8, "MS Shell Dlg" LTEXT "", IDS_ERR_USER_MSG2, 15, 5, 28, 20 LTEXT "", IDS_ERR_USER_MSG, 15, 5, 210, 8 CHECKBOX "No volver a mostrar este &mensaje", IDC_ERR_DONT_SHOW, 5, 20, 210, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP - PUSHBUTTON L"&Aceptar", IDOK, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON L"&Cancelar", IDCANCEL, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON L"&S", IDYES, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON L"&No", IDNO, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&Aceptar", IDOK, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&Cancelar", IDCANCEL, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&S", IDYES, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&No", IDNO, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP } STRINGTABLE diff --git a/dll/win32/shlwapi/shlwapi_Fi.rc b/dll/win32/shlwapi/shlwapi_Fi.rc index 13dff2ca647..54fa502048c 100644 --- a/dll/win32/shlwapi/shlwapi_Fi.rc +++ b/dll/win32/shlwapi/shlwapi_Fi.rc @@ -30,10 +30,10 @@ FONT 8, "MS Shell Dlg" LTEXT "", IDS_ERR_USER_MSG2, 15, 5, 28, 20 LTEXT "", IDS_ERR_USER_MSG, 15, 5, 210, 8 CHECKBOX "l nyt tt viesti en", IDC_ERR_DONT_SHOW, 5, 20, 210, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP - PUSHBUTTON L"&OK", IDOK, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON L"&Peruuta", IDCANCEL, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON L"&Kyll", IDYES, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON L"&Ei", IDNO, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&OK", IDOK, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&Peruuta", IDCANCEL, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&Kyll", IDYES, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&Ei", IDNO, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP } STRINGTABLE diff --git a/dll/win32/shlwapi/shlwapi_Hu.rc b/dll/win32/shlwapi/shlwapi_Hu.rc index 676b1d4c87d..60252038e20 100644 --- a/dll/win32/shlwapi/shlwapi_Hu.rc +++ b/dll/win32/shlwapi/shlwapi_Hu.rc @@ -33,10 +33,10 @@ FONT 8, "MS Shell Dlg" LTEXT "", IDS_ERR_USER_MSG2, 15, 5, 28, 20 LTEXT "", IDS_ERR_USER_MSG, 15, 5, 210, 8 CHECKBOX "Ne jelení&tse meg ezt az üzenetet mégegyszer", IDC_ERR_DONT_SHOW, 5, 20, 210, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP - PUSHBUTTON L"&OK" IDOK, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON L"&Mégse" IDCANCEL, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON L"&Igen" IDYES, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON L"&Nem" IDNO, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&OK" IDOK, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&Mégse" IDCANCEL, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&Igen" IDYES, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&Nem" IDNO, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP } STRINGTABLE diff --git a/dll/win32/shlwapi/shlwapi_Ja.rc b/dll/win32/shlwapi/shlwapi_Ja.rc index 32eabd6b5a8..722a01b8056 100644 --- a/dll/win32/shlwapi/shlwapi_Ja.rc +++ b/dll/win32/shlwapi/shlwapi_Ja.rc @@ -33,10 +33,10 @@ FONT 9, "MS Shell Dlg" LTEXT "", IDS_ERR_USER_MSG2, 15, 5, 28, 20 LTEXT "", IDS_ERR_USER_MSG, 15, 5, 210, 8 CHECKBOX "今後はこのメッセージを表示しない(&i)", IDC_ERR_DONT_SHOW, 5, 20, 210, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP - PUSHBUTTON L"&OK", IDOK, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON L"キャンセル(&C)", IDCANCEL, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON L"はい(&Y)", IDYES, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON L"いいえ(&N)", IDNO, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&OK", IDOK, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "キャンセル(&C)", IDCANCEL, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "はい(&Y)", IDYES, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "いいえ(&N)", IDNO, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP } STRINGTABLE diff --git a/dll/win32/shlwapi/shlwapi_Pt.rc b/dll/win32/shlwapi/shlwapi_Pt.rc index 2080fc5bcdc..0cbbe83f4be 100644 --- a/dll/win32/shlwapi/shlwapi_Pt.rc +++ b/dll/win32/shlwapi/shlwapi_Pt.rc @@ -34,10 +34,10 @@ FONT 8, "MS Shell Dlg" LTEXT "", IDS_ERR_USER_MSG2, 15, 5, 28, 20 LTEXT "", IDS_ERR_USER_MSG, 15, 5, 210, 8 CHECKBOX "Não &mostrar esta mensagem novamente", IDC_ERR_DONT_SHOW, 5, 20, 210, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP - PUSHBUTTON L"&OK" IDOK, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON L"&Cancelar" IDCANCEL, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON L"&Sim" IDYES, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON L"&Não" IDNO, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&OK" IDOK, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&Cancelar" IDCANCEL, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&Sim" IDYES, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&Não" IDNO, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP } STRINGTABLE diff --git a/dll/win32/shlwapi/shlwapi_Ro.rc b/dll/win32/shlwapi/shlwapi_Ro.rc index 21b3bf04f78..d59a92fcb5d 100644 --- a/dll/win32/shlwapi/shlwapi_Ro.rc +++ b/dll/win32/shlwapi/shlwapi_Ro.rc @@ -31,10 +31,10 @@ FONT 8, "MS Shell Dlg" LTEXT "", IDS_ERR_USER_MSG2, 15, 5, 28, 20 LTEXT "", IDS_ERR_USER_MSG, 15, 5, 210, 8 CHECKBOX "Nu &afișa din nou acest mesaj", IDC_ERR_DONT_SHOW, 5, 20, 210, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP - PUSHBUTTON L"&OK", IDOK, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON L"&Renunță", IDCANCEL, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON L"&Da", IDYES, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON L"&Nu", IDNO, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&OK", IDOK, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&Renunță", IDCANCEL, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&Da", IDYES, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&Nu", IDNO, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP } STRINGTABLE diff --git a/dll/win32/shlwapi/shlwapi_Ru.rc b/dll/win32/shlwapi/shlwapi_Ru.rc index e8d36aaab3b..8d833b1f97e 100644 --- a/dll/win32/shlwapi/shlwapi_Ru.rc +++ b/dll/win32/shlwapi/shlwapi_Ru.rc @@ -33,10 +33,10 @@ FONT 8, "MS Shell Dlg" LTEXT "", IDS_ERR_USER_MSG2, 15, 5, 28, 20 LTEXT "", IDS_ERR_USER_MSG, 15, 5, 210, 8 CHECKBOX "Больше не &показывать это сообщение", IDC_ERR_DONT_SHOW, 5, 20, 210, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP - PUSHBUTTON L"&OK", IDOK, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON L"О&тменить", IDCANCEL, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON L"&Да", IDYES, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON L"&Нет", IDNO, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&OK", IDOK, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "О&тменить", IDCANCEL, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&Да", IDYES, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&Нет", IDNO, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP } STRINGTABLE diff --git a/dll/win32/shlwapi/shlwapi_Si.rc b/dll/win32/shlwapi/shlwapi_Si.rc index eaa047c2af2..926460183d8 100644 --- a/dll/win32/shlwapi/shlwapi_Si.rc +++ b/dll/win32/shlwapi/shlwapi_Si.rc @@ -32,10 +32,10 @@ FONT 8, "MS Shell Dlg" LTEXT "", IDS_ERR_USER_MSG2, 15, 5, 28, 20 LTEXT "", IDS_ERR_USER_MSG, 15, 5, 210, 8 CHECKBOX "Tega sporočila ne &kaži več", IDC_ERR_DONT_SHOW, 5, 20, 210, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP - PUSHBUTTON L"&V redu", IDOK, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON L"&Prekliči", IDCANCEL, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON L"&Da", IDYES, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON L"&Ne", IDNO, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&V redu", IDOK, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&Prekliči", IDCANCEL, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&Da", IDYES, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&Ne", IDNO, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP } STRINGTABLE diff --git a/dll/win32/shlwapi/shlwapi_Sk.rc b/dll/win32/shlwapi/shlwapi_Sk.rc index 52ccf349cca..6f2354b6d67 100644 --- a/dll/win32/shlwapi/shlwapi_Sk.rc +++ b/dll/win32/shlwapi/shlwapi_Sk.rc @@ -30,10 +30,10 @@ FONT 8, "MS Shell Dlg" LTEXT "", IDS_ERR_USER_MSG2, 15, 5, 28, 20 LTEXT "", IDS_ERR_USER_MSG, 15, 5, 210, 8 CHECKBOX "Nabudce toto dialgov okno nezo&brazova", IDC_ERR_DONT_SHOW, 5, 20, 210, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP - PUSHBUTTON L"&OK", IDOK, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON L"&Zrui", IDCANCEL, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON L"n&o", IDYES, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON L"&Nie", IDNO, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&OK", IDOK, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&Zrui", IDCANCEL, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "n&o", IDYES, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&Nie", IDNO, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP } STRINGTABLE diff --git a/dll/win32/shlwapi/shlwapi_Sv.rc b/dll/win32/shlwapi/shlwapi_Sv.rc index 6d6994fad38..c55b1d36e9c 100644 --- a/dll/win32/shlwapi/shlwapi_Sv.rc +++ b/dll/win32/shlwapi/shlwapi_Sv.rc @@ -30,10 +30,10 @@ FONT 8, "MS Shell Dlg" LTEXT "", IDS_ERR_USER_MSG2, 15, 5, 28, 20 LTEXT "", IDS_ERR_USER_MSG, 15, 5, 210, 8 CHECKBOX "Visa inte &det hr meddelandet igen", IDC_ERR_DONT_SHOW, 5, 20, 210, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP - PUSHBUTTON L"&OK", IDOK, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON L"&Avbryt", IDCANCEL, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON L"&Ja", IDYES, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON L"&Nej", IDNO, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&OK", IDOK, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&Avbryt", IDCANCEL, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&Ja", IDYES, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&Nej", IDNO, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP } STRINGTABLE diff --git a/dll/win32/shlwapi/shlwapi_Tr.rc b/dll/win32/shlwapi/shlwapi_Tr.rc index 4a41c615469..c51e80abe53 100644 --- a/dll/win32/shlwapi/shlwapi_Tr.rc +++ b/dll/win32/shlwapi/shlwapi_Tr.rc @@ -30,10 +30,10 @@ FONT 8, "MS Shell Dlg" LTEXT "", IDS_ERR_USER_MSG2, 15, 5, 28, 20 LTEXT "", IDS_ERR_USER_MSG, 15, 5, 210, 8 CHECKBOX "Bu iletiyi bir daha &gsterme", IDC_ERR_DONT_SHOW, 5, 20, 210, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP - PUSHBUTTON L"&Tamam", IDOK, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON L"&ptal", IDCANCEL, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON L"&Evet", IDYES, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON L"&Hayr", IDNO, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&Tamam", IDOK, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&ptal", IDCANCEL, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&Evet", IDYES, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&Hayr", IDNO, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP } STRINGTABLE diff --git a/dll/win32/shlwapi/shlwapi_Uk.rc b/dll/win32/shlwapi/shlwapi_Uk.rc index e468c4ac451..099f2bf3131 100644 --- a/dll/win32/shlwapi/shlwapi_Uk.rc +++ b/dll/win32/shlwapi/shlwapi_Uk.rc @@ -20,26 +20,29 @@ #include "resource.h" +/* UTF-8 */ +#pragma code_page(65001) + LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT IDD_ERR_DIALOG DIALOG 0, 0, 220, 60 STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "!" +CAPTION "Помилка!" FONT 8, "MS Shell Dlg" { LTEXT "", IDS_ERR_USER_MSG2, 15, 5, 28, 20 LTEXT "", IDS_ERR_USER_MSG, 15, 5, 210, 8 - CHECKBOX "& ", IDC_ERR_DONT_SHOW, 5, 20, 210, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP - PUSHBUTTON L"&OK", IDOK, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON L"&", IDCANCEL, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON L"&", IDYES, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON L"&ͳ", IDNO, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP + CHECKBOX "&Більше не показувати це повідомлення", IDC_ERR_DONT_SHOW, 5, 20, 210, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP + PUSHBUTTON "&OK", IDOK, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&Скасувати", IDCANCEL, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&Так", IDYES, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "&Ні", IDNO, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP } STRINGTABLE { - IDS_BYTES_FORMAT "%ld " - IDS_TIME_INTERVAL_HOURS " " - IDS_TIME_INTERVAL_MINUTES " " - IDS_TIME_INTERVAL_SECONDS " ." + IDS_BYTES_FORMAT "%ld байт" + IDS_TIME_INTERVAL_HOURS " год" + IDS_TIME_INTERVAL_MINUTES " хв" + IDS_TIME_INTERVAL_SECONDS " сек." } diff --git a/dll/win32/shlwapi/shlwapi_Zh.rc b/dll/win32/shlwapi/shlwapi_Zh.rc index 33961fb10a9..77d6f3ac449 100644 --- a/dll/win32/shlwapi/shlwapi_Zh.rc +++ b/dll/win32/shlwapi/shlwapi_Zh.rc @@ -33,10 +33,10 @@ FONT 9, "MS Shell Dlg" LTEXT "", IDS_ERR_USER_MSG2, 15, 5, 28, 20 LTEXT "", IDS_ERR_USER_MSG, 15, 5, 210, 8 CHECKBOX "不要再显示这个讯息", IDC_ERR_DONT_SHOW, 5, 20, 210, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP - PUSHBUTTON L"确定(&O)", IDOK, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON L"取消(&C)", IDCANCEL, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON L"是(&Y)", IDYES, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON L"否(&N)", IDNO, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "确定(&O)", IDOK, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "取消(&C)", IDCANCEL, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "是(&Y)", IDYES, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "否(&N)", IDNO, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP } STRINGTABLE @@ -57,10 +57,10 @@ FONT 9, "MS Shell Dlg" LTEXT "", IDS_ERR_USER_MSG2, 15, 5, 28, 20 LTEXT "", IDS_ERR_USER_MSG, 15, 5, 210, 8 CHECKBOX "不要再顯示這個訊息", IDC_ERR_DONT_SHOW, 5, 20, 210, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP - PUSHBUTTON L"確定(&O)", IDOK, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON L"取消(&C)", IDCANCEL, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON L"是(&Y)", IDYES, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON L"否(&N)", IDNO, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "確定(&O)", IDOK, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "取消(&C)", IDCANCEL, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "是(&Y)", IDYES, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "否(&N)", IDNO, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP } STRINGTABLE diff --git a/dll/win32/smdll/CMakeLists.txt b/dll/win32/smdll/CMakeLists.txt index cb850fc1bde..6a8026f1fc5 100644 --- a/dll/win32/smdll/CMakeLists.txt +++ b/dll/win32/smdll/CMakeLists.txt @@ -12,7 +12,9 @@ list(APPEND SOURCE add_library(smdll SHARED ${SOURCE}) target_link_libraries(smdll smlib) +set_entrypoint(smdll DllMainCRTStartup 12) add_importlibs(smdll ntdll) +add_pch(smdll precomp.h) add_dependencies(smdll psdk) add_cd_file(TARGET smdll DESTINATION reactos/system32 FOR all) add_importlib_target(smdll.spec) diff --git a/dll/win32/smdll/dllmain.c b/dll/win32/smdll/dllmain.c index f49080ec7f5..3d0554e9451 100644 --- a/dll/win32/smdll/dllmain.c +++ b/dll/win32/smdll/dllmain.c @@ -6,7 +6,7 @@ * PURPOSE: SM Helper Library */ -#include +#include BOOL WINAPI DllMainCRTStartup(HANDLE hinstDll, DWORD fdwReason, LPVOID fImpLoad) { diff --git a/dll/win32/smdll/precomp.h b/dll/win32/smdll/precomp.h new file mode 100644 index 00000000000..24c55447dad --- /dev/null +++ b/dll/win32/smdll/precomp.h @@ -0,0 +1,6 @@ +#define WIN32_NO_STATUS +#include +#define NTOS_MODE_USER +#include +#include +#include diff --git a/dll/win32/smdll/query.c b/dll/win32/smdll/query.c index ba502c12dcc..56718d8752c 100644 --- a/dll/win32/smdll/query.c +++ b/dll/win32/smdll/query.c @@ -5,11 +5,8 @@ * FILE: lib/smdll/query.c * PURPOSE: Call SM API SM_API_QUERY_INFORMATION (not in NT) */ -#define WIN32_NO_STATUS -#include -#define NTOS_MODE_USER -#include -#include + +#include #define NDEBUG #include diff --git a/dll/win32/sti/CMakeLists.txt b/dll/win32/sti/CMakeLists.txt index 9a06b70d782..bf59c851302 100644 --- a/dll/win32/sti/CMakeLists.txt +++ b/dll/win32/sti/CMakeLists.txt @@ -36,6 +36,7 @@ add_importlibs(sti oleaut32 rpcrt4 advapi32 + msvcrt kernel32 ntdll) diff --git a/dll/win32/syssetup/CMakeLists.txt b/dll/win32/syssetup/CMakeLists.txt index 9f8ac236bd0..9ebd0fe2bf7 100644 --- a/dll/win32/syssetup/CMakeLists.txt +++ b/dll/win32/syssetup/CMakeLists.txt @@ -1,8 +1,7 @@ + set_unicode() - -add_definitions(-D_DLL -D__USE_CRTIMP) - set_rc_compiler() + spec2def(syssetup.dll syssetup.spec) list(APPEND SOURCE @@ -16,12 +15,9 @@ list(APPEND SOURCE ${CMAKE_CURRENT_BINARY_DIR}/syssetup.def) add_library(syssetup SHARED ${SOURCE}) - +add_pch(syssetup precomp.h) set_module_type(syssetup win32dll) - -target_link_libraries(syssetup - uuid - ${PSEH_LIB}) +target_link_libraries(syssetup uuid ${PSEH_LIB}) add_importlibs(syssetup msvcrt @@ -38,5 +34,4 @@ add_importlibs(syssetup kernel32 ntdll) - add_cd_file(TARGET syssetup DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/syssetup/classinst.c b/dll/win32/syssetup/classinst.c index 7bf990c3347..e791e38030d 100644 --- a/dll/win32/syssetup/classinst.c +++ b/dll/win32/syssetup/classinst.c @@ -6,8 +6,7 @@ * PROGRAMMERS: Copyright 2006 Herv Poussineau (hpoussin@reactos.org) */ -#include -#include +#include "precomp.h" #define NDEBUG #include diff --git a/dll/win32/syssetup/dllmain.c b/dll/win32/syssetup/dllmain.c index c4960461bdd..fe19b4c74ef 100644 --- a/dll/win32/syssetup/dllmain.c +++ b/dll/win32/syssetup/dllmain.c @@ -27,12 +27,7 @@ /* INCLUDES *****************************************************************/ -#include -#include -#include - -#include "globals.h" - +#include "precomp.h" /* GLOBALS *******************************************************************/ diff --git a/dll/win32/syssetup/install.c b/dll/win32/syssetup/install.c index fb3a5808e9f..b098d6f859e 100644 --- a/dll/win32/syssetup/install.c +++ b/dll/win32/syssetup/install.c @@ -26,28 +26,7 @@ /* INCLUDES *****************************************************************/ -#define WIN32_NO_STATUS -#include -#define NTOS_MODE_USER -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include - -#include "globals.h" -#include "resource.h" +#include "precomp.h" #define NDEBUG #include diff --git a/dll/win32/syssetup/lang/bg-BG.rc b/dll/win32/syssetup/lang/bg-BG.rc index 44bd6211055..06e1ebe4c99 100644 --- a/dll/win32/syssetup/lang/bg-BG.rc +++ b/dll/win32/syssetup/lang/bg-BG.rc @@ -27,9 +27,7 @@ CAPTION " FONT 8, "MS Shell Dlg" BEGIN LTEXT " !", IDC_WELCOMETITLE, 115, 8, 195, 24 - LTEXT " . "\ - " , "\ - " .", IDC_STATIC, 115, 40, 195, 100 + LTEXT " . , .", IDC_STATIC, 115, 40, 195, 100 LTEXT " .", IDC_STATIC, 115, 169, 200, 17 END @@ -39,13 +37,11 @@ STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYS CAPTION " " FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT " "\ - " , ( ) :", + LTEXT " , ( ) :", IDC_STATIC,15,2,286,24 LISTBOX IDC_PROJECTS,15,30,286,75,LBS_NOSEL | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL - LTEXT " GPL "\ - "( ), GPL.", + LTEXT " GPL ( ), GPL.", IDC_STATIC,15,110,227,20 PUSHBUTTON "& GPL...",IDC_VIEWGPL,251,110,50,19 LTEXT " .",IDC_STATIC,15,136, @@ -74,14 +70,12 @@ CAPTION " FONT 8, "MS Shell Dlg" BEGIN ICON IDI_ICON1, IDC_STATIC, 21, 7, 20, 20 - LTEXT " 15 . "\ - " , .", + LTEXT " 15 . , .", IDC_STATIC, 45, 7, 250, 24 LTEXT " &:", IDC_STATIC, 45, 38, 75, 8 EDITTEXT IDC_COMPUTERNAME, 132, 35, 163, 14, WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL | ES_UPPERCASE ICON IDI_ICON5, IDC_STATIC, 21, 57, 20, 20 - LTEXT " , Administrator. "\ - " , .", + LTEXT " , Administrator. , .", IDC_STATIC, 45, 57, 250, 25 LTEXT " Administrator, - 14 .", IDC_STATIC, 54, 87, 250, 8 @@ -98,9 +92,7 @@ CAPTION " FONT 8, "MS Shell Dlg" BEGIN ICON IDI_ICON4, IDC_STATIC, 21, 7, 20, 20 - LTEXT " , "\ - " . "\ - " .", IDC_STATIC, 53, 2, 253, 26 + LTEXT " , . .", IDC_STATIC, 53, 2, 253, 26 LTEXT "", IDC_LOCALETEXT, 53, 29, 250, 16 LTEXT " , .", IDC_STATIC, 53, 60, 184, 16 @@ -151,11 +143,9 @@ CAPTION " FONT 8, "MS Shell Dlg" BEGIN LTEXT " ", IDC_FINISHTITLE, 115, 8, 195, 24 - LTEXT " .\n\n" \ - " , .", IDC_STATIC, 115, 40, 195, 100 + LTEXT " .\n\n , .", IDC_STATIC, 115, 40, 195, 100 CONTROL "", IDC_RESTART_PROGRESS, "msctls_progress32", PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 115, 138, 188, 12 - LTEXT " , . "\ - " .", IDC_STATIC, 115, 169, 200, 17 + LTEXT " , . .", IDC_STATIC, 115, 169, 200, 17 END diff --git a/dll/win32/syssetup/lang/cs-CZ.rc b/dll/win32/syssetup/lang/cs-CZ.rc index 3a334191b55..cb32b17d606 100644 --- a/dll/win32/syssetup/lang/cs-CZ.rc +++ b/dll/win32/syssetup/lang/cs-CZ.rc @@ -12,9 +12,7 @@ CAPTION "ReactOS Instal FONT 8, "MS Shell Dlg" BEGIN LTEXT "Vtejte v prvodci instalace systmu ReactOS.", IDC_WELCOMETITLE, 115, 9, 189, 31 - LTEXT "Tento prvodce nainstaluje systm ReactOS na V pota. Prvodce "\ - "potebuje zskat nkter informace o Vs a Vaem potai "\ - "aby mohl systm sprvn nastavit.", IDC_STATIC, 115, 50, 189, 100 + LTEXT "Tento prvodce nainstaluje systm ReactOS na V pota. Prvodce potebuje zskat nkter informace o Vs a Vaem potai aby mohl systm sprvn nastavit.", IDC_STATIC, 115, 50, 189, 100 LTEXT "Kliknutm na Dal pokraujte v instalaci.", IDC_STATIC, 115, 160, 189, 31 END @@ -24,13 +22,11 @@ STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYS CAPTION "ReactOS Instaltor" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT "Vvoji systmu ReactOS by rdi zmnili nsledujc Open Source projekty."\ - "Tyto projekty (nebo jejich sti) byly pouity pi vvoji systmu ReactOS:", + LTEXT "Vvoji systmu ReactOS by rdi zmnili nsledujc Open Source projekty. Tyto projekty (nebo jejich sti) byly pouity pi vvoji systmu ReactOS:", IDC_STATIC,15,7,286,19 LISTBOX IDC_PROJECTS,15,30,286,75,LBS_NOSEL | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL - LTEXT "ReactOS je licencovn pod GPL. Pokud chcete systm (nebo jeho sti) pout "\ - "nebo redistribuovat, muste respektovat GPL", + LTEXT "ReactOS je licencovn pod GPL. Pokud chcete systm (nebo jeho sti) pout nebo redistribuovat, muste respektovat GPL", IDC_STATIC,15,110,227,19 PUSHBUTTON "&Zobrazit GPL...",IDC_VIEWGPL,251,110,50,19 LTEXT "Kliknutm na Dal pokraujte v instalaci.",IDC_STATIC,15,136, @@ -59,14 +55,12 @@ CAPTION "ReactOS Instal FONT 8, "MS Shell Dlg" BEGIN ICON IDI_ICON1, IDC_STATIC, 21, 7, 20, 20 - LTEXT "Napite jmno Vaeho potae o dlce 15 znak nebo mn. "\ - "Pokud je pota pipojen k sti, mus bt jeho jmno uniktn.", + LTEXT "Napite jmno Vaeho potae o dlce 15 znak nebo mn. Pokud je pota pipojen k sti, mus bt jeho jmno uniktn.", IDC_STATIC, 54, 7, 250, 24 LTEXT "&Jmno potae:", IDC_STATIC, 54, 38, 75, 8 EDITTEXT IDC_COMPUTERNAME, 132, 35, 163, 14, WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL | ES_UPPERCASE ICON IDI_ICON5, IDC_STATIC, 21, 57, 20, 20 - LTEXT "Instaltor vytvo uivatelsk et nazvan Administrator. "\ - "Mete tento et pout, pokud budete potebovat pln pstup k Vaemu potai.", + LTEXT "Instaltor vytvo uivatelsk et nazvan Administrator. Mete tento et pout, pokud budete potebovat pln pstup k Vaemu potai.", IDC_STATIC, 54, 57, 250, 25 LTEXT "Zadejte heslo tu Administrator o dlce 14 znak nebo mn.", IDC_STATIC, 54, 87, 250, 8 @@ -83,9 +77,7 @@ CAPTION "ReactOS Instal FONT 8, "MS Shell Dlg" BEGIN ICON IDI_ICON4, IDC_STATIC, 21, 7, 20, 20 - LTEXT "Lokalizace systmu by mla souhlasit s jazykem aplikac, "\ - "kter chcete pouvat. Localizace ur jak budou zobrazena "\ - "sla, mny a kalendn data.", IDC_STATIC, 53, 7, 253, 20 + LTEXT "Lokalizace systmu by mla souhlasit s jazykem aplikac, kter chcete pouvat. Localizace ur jak budou zobrazena sla, mny a kalendn data.", IDC_STATIC, 53, 7, 253, 20 LTEXT "", IDC_LOCALETEXT, 53, 29, 250, 16 LTEXT "Pro zmnu lokalizace systmu kliknte na Zmnit.", IDC_STATIC, 53, 60, 184, 8 @@ -135,11 +127,9 @@ CAPTION "Dokon FONT 8, "MS Shell Dlg" BEGIN LTEXT "Dokonen prvodce instalac systmu ReactOS",IDC_FINISHTITLE,115,9,195,37 - LTEXT "Prvodce instalac systmu ReactOS byl spn dokonen.\n\n" \ - "Po kliknut na Dokonit bude pota restartovn.", IDC_STATIC, 115, 58, 195, 100 + LTEXT "Prvodce instalac systmu ReactOS byl spn dokonen.\n\nPo kliknut na Dokonit bude pota restartovn.", IDC_STATIC, 115, 58, 195, 100 CONTROL "", IDC_RESTART_PROGRESS, "msctls_progress32", PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 115, 138, 188, 12 - LTEXT "Pokud je v mechanice instalan CD, vyjmte jej. Pot kliknutm na Dokonit "\ - "restartujte pota.", IDC_STATIC, 115, 160, 195, 31 + LTEXT "Pokud je v mechanice instalan CD, vyjmte jej. Pot kliknutm na Dokonit restartujte pota.", IDC_STATIC, 115, 160, 195, 31 END diff --git a/dll/win32/syssetup/lang/de-DE.rc b/dll/win32/syssetup/lang/de-DE.rc index 95441e76417..53585237fe3 100644 --- a/dll/win32/syssetup/lang/de-DE.rc +++ b/dll/win32/syssetup/lang/de-DE.rc @@ -26,9 +26,7 @@ CAPTION "ReactOS-Setup" FONT 8, "MS Shell Dlg" BEGIN LTEXT "Willkommen beim ReactOS-Setupassistenten.", IDC_WELCOMETITLE, 115, 9, 189, 31 - LTEXT "Dieser Assistent wird ReactOS auf Ihrem Computer installieren. "\ - "Der Assistent bentigt einige Informationen, um ReactOS "\ - "installieren zu knnen.", IDC_STATIC, 115, 50, 189, 100 + LTEXT "Dieser Assistent wird ReactOS auf Ihrem Computer installieren. Der Assistent bentigt einige Informationen, um ReactOS installieren zu knnen.", IDC_STATIC, 115, 50, 189, 100 LTEXT "Klicken Sie auf Weiter, um fortzufahren.", IDC_STATIC, 115, 160, 189, 31 END @@ -38,13 +36,11 @@ STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYS CAPTION "ReactOS-Setup" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT "Die ReactOS-Programmierer mchten folgende Open-Source-Projekte anerkennen, "\ - "die (teils) verwendet wurden, um ReactOS zu erstellen:", + LTEXT "Die ReactOS-Programmierer mchten folgende Open-Source-Projekte anerkennen, die (teils) verwendet wurden, um ReactOS zu erstellen:", IDC_STATIC,15,7,286,19 LISTBOX IDC_PROJECTS,15,30,286,75,LBS_NOSEL | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL - LTEXT "ReactOS ist unter der GPL verffentlicht, wenn Sie (Teile von) ReactOS wiederverwenden "\ - "oder wiederverffentlichen wollen, mssen Sie die Bestimmungen der GPL anerkennen.", + LTEXT "ReactOS ist unter der GPL verffentlicht, wenn Sie (Teile von) ReactOS wiederverwenden oder wiederverffentlichen wollen, mssen Sie die Bestimmungen der GPL anerkennen.", IDC_STATIC,15,110,227,24 PUSHBUTTON "GPL &ansehen...",IDC_VIEWGPL,251,110,55,19 LTEXT "Klicken Sie auf Weiter, um mit der Einrichtung fortzufahren.",IDC_STATIC,15,136, @@ -73,14 +69,12 @@ CAPTION "ReactOS-Setup" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_ICON1, IDC_STATIC, 21, 7, 20, 20 - LTEXT "Bitte geben sie einen Computernamen ein (maximal 15 Zeichen). "\ - "Wenn Sie im Netzwerk sind, muss dieser Name einmalig sein.", + LTEXT "Bitte geben sie einen Computernamen ein (maximal 15 Zeichen). Wenn Sie im Netzwerk sind, muss dieser Name einmalig sein.", IDC_STATIC, 54, 7, 250, 24 LTEXT "&Computername:", IDC_STATIC, 54, 38, 75, 8 EDITTEXT IDC_COMPUTERNAME, 132, 35, 163, 14, WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL | ES_UPPERCASE ICON IDI_ICON5, IDC_STATIC, 21, 57, 20, 20 - LTEXT "Das Setup wird ein Administratorkonto erstellen. "\ - "Benutzen Sie es, wenn Sie vollen Zugriff auf Ihren Computer bentigen.", + LTEXT "Das Setup wird ein Administratorkonto erstellen. Benutzen Sie es, wenn Sie vollen Zugriff auf Ihren Computer bentigen.", IDC_STATIC, 54, 57, 250, 25 LTEXT "Geben Sie ein Passwort fr das Administratorkonto mit max. 14 Zeichen ein.", IDC_STATIC, 54, 87, 250, 8 @@ -97,9 +91,7 @@ CAPTION "ReactOS-Setup" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_ICON4, IDC_STATIC, 21, 7, 20, 20 - LTEXT "Die lokalen Systemeinstellungen sollten mit der Sprache der Anwendungen, "\ - "die Sie nutzen wollen bereinstimmen. Die lokalen Nutzereinstellungen geben vor, "\ - "wie Nummern, Whrungen und Datumsangaben dargestellt werden.", IDC_STATIC, 53, 6, 253, 30 + LTEXT "Die lokalen Systemeinstellungen sollten mit der Sprache der Anwendungen, die Sie nutzen wollen bereinstimmen. Die lokalen Nutzereinstellungen geben vor, wie Nummern, Whrungen und Datumsangaben dargestellt werden.", IDC_STATIC, 53, 6, 253, 30 LTEXT "", IDC_LOCALETEXT, 54, 34, 250, 16 LTEXT "Um die lokalen Nutzer- oder Systemeinstellungen zu ndern, klicken Sie auf Einstellen.", IDC_STATIC, 53, 57, 188, 15 @@ -149,11 +141,9 @@ CAPTION "Fertigstellung des ReactOS-Setups" FONT 8, "MS Shell Dlg" BEGIN LTEXT "Fertigstellung des ReactOS-Setupassistenten",IDC_FINISHTITLE,115,9,195,37 - LTEXT "Das ReactOS-Setup wurde erfolgreich fertiggestellt.\n\n" \ - "Wenn Sie auf Beenden klicken, wird der Computer neu gestartet.", IDC_STATIC, 115, 58, 195, 100 + LTEXT "Das ReactOS-Setup wurde erfolgreich fertiggestellt.\n\nWenn Sie auf Beenden klicken, wird der Computer neu gestartet.", IDC_STATIC, 115, 58, 195, 100 CONTROL "", IDC_RESTART_PROGRESS, "msctls_progress32", PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 115, 138, 188, 12 - LTEXT "Entfernen Sie die CD, wenn vorhanden. Danach klicken Sie "\ - "auf Beenden, um den Computer neu zu starten.", IDC_STATIC, 115, 160, 195, 31 + LTEXT "Entfernen Sie die CD, wenn vorhanden. Danach klicken Sie auf Beenden, um den Computer neu zu starten.", IDC_STATIC, 115, 160, 195, 31 END diff --git a/dll/win32/syssetup/lang/el-GR.rc b/dll/win32/syssetup/lang/el-GR.rc index 5b4da9111f6..2ba56a0020d 100644 --- a/dll/win32/syssetup/lang/el-GR.rc +++ b/dll/win32/syssetup/lang/el-GR.rc @@ -26,9 +26,7 @@ CAPTION " FONT 8, "MS Shell Dlg" BEGIN LTEXT " ReactOS.", IDC_WELCOMETITLE, 115, 8, 195, 24 - LTEXT " ReactOS . "\ - " "\ - " ReactOS.", IDC_STATIC, 115, 40, 195, 100 + LTEXT " ReactOS . ReactOS.", IDC_STATIC, 115, 40, 195, 100 LTEXT " '' .", IDC_STATIC, 115, 169, 195, 17 END @@ -38,13 +36,11 @@ STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYS CAPTION " ReactOS" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT " ReactOS "\ - " , ( ) ReactOS:", + LTEXT " ReactOS , ( ) ReactOS:", IDC_STATIC,15,4,286,25 LISTBOX IDC_PROJECTS,15,30,286,75,LBS_NOSEL | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL - LTEXT " ReactOS GPL, "\ - " ReactOS, GPL.", + LTEXT " ReactOS GPL, ReactOS, GPL.", IDC_STATIC,15,110,227,24 PUSHBUTTON "&...",IDC_VIEWGPL,251,110,50,19 LTEXT " '' .",IDC_STATIC,15,136, @@ -73,14 +69,12 @@ CAPTION " FONT 8, "MS Shell Dlg" BEGIN ICON IDI_ICON1, IDC_STATIC, 21, 7, 20, 20 - LTEXT " , 15 . "\ - " , .", + LTEXT " , 15 . , .", IDC_STATIC, 54, 7, 250, 24 LTEXT "& :", IDC_STATIC, 54, 38, 75, 8 EDITTEXT IDC_COMPUTERNAME, 132, 35, 163, 14, WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL | ES_UPPERCASE ICON IDI_ICON5, IDC_STATIC, 21, 57, 20, 20 - LTEXT " Administrator. "\ - " .", + LTEXT " Administrator. .", IDC_STATIC, 54, 57, 250, 25 LTEXT " 14 .", IDC_STATIC, 54, 83, 250, 16 @@ -97,9 +91,7 @@ CAPTION " FONT 8, "MS Shell Dlg" BEGIN ICON IDI_ICON4, IDC_STATIC, 21, 7, 20, 20 - LTEXT " "\ - " . "\ - " , .", IDC_STATIC, 53, 7, 253, 31 + LTEXT " . , .", IDC_STATIC, 53, 7, 253, 31 LTEXT "", IDC_LOCALETEXT, 53, 31, 250, 16 LTEXT " , ''.", IDC_STATIC, 53, 57, 184, 16 @@ -150,11 +142,9 @@ CAPTION " FONT 8, "MS Shell Dlg" BEGIN LTEXT " ReactOS", IDC_FINISHTITLE, 115, 8, 195, 27 - LTEXT " ReactOS.\n\n"\ - " '' .", IDC_STATIC, 115, 40, 195, 100 + LTEXT " ReactOS.\n\n '' .", IDC_STATIC, 115, 40, 195, 100 CONTROL "", IDC_RESTART_PROGRESS, "msctls_progress32", PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 115, 138, 188, 12 - LTEXT " CD/DVD , . , "\ - "'' .", IDC_STATIC, 115, 160, 195, 25 + LTEXT " CD/DVD , . , '' .", IDC_STATIC, 115, 160, 195, 25 END diff --git a/dll/win32/syssetup/lang/en-US.rc b/dll/win32/syssetup/lang/en-US.rc index bd0d16410a0..b7e28324826 100644 --- a/dll/win32/syssetup/lang/en-US.rc +++ b/dll/win32/syssetup/lang/en-US.rc @@ -26,9 +26,7 @@ CAPTION "ReactOS Setup" FONT 8, "MS Shell Dlg" BEGIN LTEXT "Welcome to the ReactOS Setup Wizard.", IDC_WELCOMETITLE, 115, 8, 195, 24 - LTEXT "This wizard installs ReactOS on your computer. The wizard "\ - "needs to gather some information about you and your computer "\ - "to set up ReactOS properly.", IDC_STATIC, 115, 40, 195, 100 + LTEXT "This wizard installs ReactOS on your computer. The wizard needs to gather some information about you and your computer to set up ReactOS properly.", IDC_STATIC, 115, 40, 195, 100 LTEXT "Click Next to continue with Setup.", IDC_STATIC, 115, 169, 195, 17 END @@ -38,13 +36,11 @@ STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYS CAPTION "ReactOS Setup" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT "The ReactOS developers would like to acknowledge the following Open Source projects, "\ - "(parts of) which were used to create ReactOS:", + LTEXT "The ReactOS developers would like to acknowledge the following Open Source projects, (parts of) which were used to create ReactOS:", IDC_STATIC,15,7,286,19 LISTBOX IDC_PROJECTS,15,30,286,75,LBS_NOSEL | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL - LTEXT "ReactOS is licensed under the GPL, so if you want to reuse or redistribute "\ - "(parts of) it you must respect the GPL", + LTEXT "ReactOS is licensed under the GPL, so if you want to reuse or redistribute (parts of) it you must respect the GPL", IDC_STATIC,15,110,227,19 PUSHBUTTON "&View GPL...",IDC_VIEWGPL,251,110,50,19 LTEXT "Click Next to continue with Setup.",IDC_STATIC,15,136, @@ -73,14 +69,12 @@ CAPTION "ReactOS Setup" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_ICON1, IDC_STATIC, 21, 7, 20, 20 - LTEXT "Type a name for your computer that is 15 characters or less. "\ - "If you are on a network, your computer name must be unique.", + LTEXT "Type a name for your computer that is 15 characters or less. If you are on a network, your computer name must be unique.", IDC_STATIC, 54, 7, 250, 24 LTEXT "&Computer Name:", IDC_STATIC, 54, 38, 75, 8 EDITTEXT IDC_COMPUTERNAME, 165, 35, 148, 14, WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL | ES_UPPERCASE ICON IDI_ICON5, IDC_STATIC, 21, 57, 20, 20 - LTEXT "Setup will create a user account on your computer called Administrator. "\ - "You can use this account if you need full access to your computer.", + LTEXT "Setup will create a user account on your computer called Administrator. You can use this account if you need full access to your computer.", IDC_STATIC, 54, 57, 250, 25 LTEXT "Type an Administrator Password that is 14 characters or less.", IDC_STATIC, 54, 87, 250, 8 @@ -97,9 +91,7 @@ CAPTION "ReactOS Setup" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_ICON4, IDC_STATIC, 21, 7, 20, 20 - LTEXT "The system locale should match the language of the applications "\ - "you want to use. The user locale controls how numbers, "\ - "currencies, and dates appear.", IDC_STATIC, 53, 7, 253, 20 + LTEXT "The system locale should match the language of the applications you want to use. The user locale controls how numbers, currencies, and dates appear.", IDC_STATIC, 53, 7, 253, 20 LTEXT "", IDC_LOCALETEXT, 53, 29, 250, 16 LTEXT "To change system or user locale settings, click Customize.", IDC_STATIC, 53, 60, 196, 8 @@ -150,11 +142,9 @@ CAPTION "Completing ReactOS Setup" FONT 8, "MS Shell Dlg" BEGIN LTEXT "Completing the ReactOS Setup Wizard", IDC_FINISHTITLE, 115, 8, 195, 24 - LTEXT "You have successfully completed ReactOS Setup.\n\n" \ - "When you click Finish, your computer will restart.", IDC_STATIC, 115, 40, 195, 100 + LTEXT "You have successfully completed ReactOS Setup.\n\nWhen you click Finish, your computer will restart.", IDC_STATIC, 115, 40, 195, 100 CONTROL "", IDC_RESTART_PROGRESS, "msctls_progress32", PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 115, 138, 188, 12 - LTEXT "If there is a CD in a drive, remove it. Then, to restart "\ - "your computer, click Finish.", IDC_STATIC, 115, 169, 195, 17 + LTEXT "If there is a CD in a drive, remove it. Then, to restart your computer, click Finish.", IDC_STATIC, 115, 169, 195, 17 END @@ -284,7 +274,7 @@ BEGIN IDS_SHORT_SOLITAIRE "Solitaire.lnk" IDS_SHORT_WINEMINE "WineMine.lnk" IDS_SHORT_WORDPAD "WordPad.lnk" - IDS_SHORT_PAINT "Paint.lnk" + IDS_SHORT_PAINT "MSPaint.lnk" IDS_SHORT_SPIDER "Spider Solitaire.lnk" END diff --git a/dll/win32/syssetup/lang/es-ES.rc b/dll/win32/syssetup/lang/es-ES.rc index 081d5fdc4cd..3e6be5d56af 100644 --- a/dll/win32/syssetup/lang/es-ES.rc +++ b/dll/win32/syssetup/lang/es-ES.rc @@ -34,9 +34,7 @@ CAPTION "Instalaci FONT 8, "MS Shell Dlg" BEGIN LTEXT "Bienvenido al asistente de instalacin de ReactOS.", IDC_WELCOMETITLE, 115, 8, 195, 24 - LTEXT "Este asistente instalar ReactOS en su equipo. El asistente "\ - "necesita recopilar alguna informacin sobre usted y su equipo "\ - "para configurar ReactOS apropiadamente.", IDC_STATIC, 115, 40, 195, 100 + LTEXT "Este asistente instalar ReactOS en su equipo. El asistente necesita recopilar alguna informacin sobre usted y su equipo para configurar ReactOS apropiadamente.", IDC_STATIC, 115, 40, 195, 100 LTEXT "Pulse Siguiente para continuar la instalacin.", IDC_STATIC, 115, 169, 195, 17 END @@ -46,13 +44,11 @@ STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYS CAPTION "Instalacin de ReactOS" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT "Los desarrolladores de ReactOS quieren agradecer a los siguientes proyectos Open Source, "\ - "los cuales (o parte de ellos) han sido usados para crear ReactOS:", + LTEXT "Los desarrolladores de ReactOS quieren agradecer a los siguientes proyectos Open Source, los cuales (o parte de ellos) han sido usados para crear ReactOS:", IDC_STATIC,15,7,286,19 LISTBOX IDC_PROJECTS,15,30,286,75,LBS_NOSEL | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL - LTEXT "ReactOS est bajo licencia GPL, asi que si quiere reutilizarlo o redistribuirlo "\ - "(o parte de el) debe respetar la licencia GPL", + LTEXT "ReactOS est bajo licencia GPL, asi que si quiere reutilizarlo o redistribuirlo (o parte de el) debe respetar la licencia GPL", IDC_STATIC,15,110,227,19 PUSHBUTTON "&Ver GPL...",IDC_VIEWGPL,251,110,50,19 LTEXT "Pulse siguiente para cotinuar con la instalacin.",IDC_STATIC,15,136, @@ -81,14 +77,12 @@ CAPTION "Instalaci FONT 8, "MS Shell Dlg" BEGIN ICON IDI_ICON1, IDC_STATIC, 21, 7, 20, 20 - LTEXT "Escriba un nombre para su equipo que sea de 15 caracteres o menos. "\ - "Si se encuentra conectado a una red, el nombre debe ser nico.", + LTEXT "Escriba un nombre para su equipo que sea de 15 caracteres o menos. Si se encuentra conectado a una red, el nombre debe ser nico.", IDC_STATIC, 54, 7, 250, 24 LTEXT "Nombre del &Equipo:", IDC_STATIC, 54, 38, 75, 8 EDITTEXT IDC_COMPUTERNAME, 132, 35, 163, 14, WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL | ES_UPPERCASE ICON IDI_ICON5, IDC_STATIC, 21, 57, 20, 20 - LTEXT "El instalador crear un perfil de usuario en su equipo llamado Administrator. "\ - "Puede utilizar este perfil si necesita acceso completo a su equipo.", + LTEXT "El instalador crear un perfil de usuario en su equipo llamado Administrator. Puede utilizar este perfil si necesita acceso completo a su equipo.", IDC_STATIC, 54, 57, 250, 25 LTEXT "Escriba una contrasea para este perfil de 14 caracteres o menos.", IDC_STATIC, 54, 87, 250, 8 @@ -105,15 +99,12 @@ CAPTION "Instalaci FONT 8, "MS Shell Dlg" BEGIN ICON IDI_ICON4, IDC_STATIC, 21, 7, 20, 20 - LTEXT "Las opciones regionales y de idioma permiten configurar la manera en que se representan "\ - "fechas ,nmero ,monedas y horas. Tambin puede agregar compatibilidad con otros idiomas "\ - "y cambiar la configuracin de su ubicacin.", IDC_STATIC, 53, 6, 253, 30 + LTEXT "Las opciones regionales y de idioma permiten configurar la manera en que se representan fechas ,nmero ,monedas y horas. Tambin puede agregar compatibilidad con otros idiomas y cambiar la configuracin de su ubicacin.", IDC_STATIC, 53, 6, 253, 30 LTEXT "", IDC_LOCALETEXT, 53, 34, 250, 16 LTEXT "Para modificar esta configuracin, pulse Modificar.", IDC_STATIC, 53, 60, 184, 8 PUSHBUTTON "&Modificar...", IDC_CUSTOMLOCALE, 245, 57, 50, 14 - LTEXT "La disposicin de teclado especifica los caracteres que aparecen cuando "\ - "usted escribe.", + LTEXT "La disposicin de teclado especifica los caracteres que aparecen cuando usted escribe.", IDC_STATIC, 53, 86, 253, 32 LTEXT "", IDC_LAYOUTTEXT, 53, 109, 250, 16 LTEXT "Para cambiar la disposicin de teclado, pulse Modificar.", @@ -159,11 +150,9 @@ CAPTION "Finalizaci FONT 8, "MS Shell Dlg" BEGIN LTEXT "El asistente de Instalacin de ReactOS ha terminado", IDC_FINISHTITLE, 115, 8, 195, 24 - LTEXT "Usted ha finalizado con xito la instalacin de ReactOS.\n\n" \ - "Cuando pulse Terminar, su equipo ser reiniciado.", IDC_STATIC, 115, 40, 195, 100 + LTEXT "Usted ha finalizado con xito la instalacin de ReactOS.\n\nCuando pulse Terminar, su equipo ser reiniciado.", IDC_STATIC, 115, 40, 195, 100 CONTROL "", IDC_RESTART_PROGRESS, "msctls_progress32", PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 115, 138, 188, 12 - LTEXT "Si hay un CD en alguna unidad, retrelo. Luego, reinicie su equipo "\ - "pulsando Terminar.", IDC_STATIC, 115, 169, 195, 17 + LTEXT "Si hay un CD en alguna unidad, retrelo. Luego, reinicie su equipo pulsando Terminar.", IDC_STATIC, 115, 169, 195, 17 END diff --git a/dll/win32/syssetup/lang/et-EE.rc b/dll/win32/syssetup/lang/et-EE.rc index 98a931bb47b..957eedd7ade 100644 --- a/dll/win32/syssetup/lang/et-EE.rc +++ b/dll/win32/syssetup/lang/et-EE.rc @@ -26,8 +26,7 @@ CAPTION "ReactOSi paigaldamine" FONT 8, "MS Shell Dlg" BEGIN LTEXT "Tere tulemast ReactOSi paigaldusprogrammi.", IDC_WELCOMETITLE, 115, 8, 195, 24 - LTEXT "Selle programmi abil paigaldatakse ReactOS arvutisse. "\ - "Selleks peab esmalt koguma natuke andmeid sinu ja su arvuti kohta.",\ + LTEXT "Selle programmi abil paigaldatakse ReactOS arvutisse. Selleks peab esmalt koguma natuke andmeid sinu ja su arvuti kohta.", IDC_STATIC, 115, 40, 195, 100 LTEXT "Vajuta Jrgmine, et jtkata paigaldamist.", IDC_STATIC, 115, 169, 195, 17 END @@ -38,13 +37,11 @@ STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYS CAPTION "ReactOS Setup" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT "ReactOSi arendajad sooviksid tunnustada jrgmisi avatud lhtekoodiga projekte, "\ - "mida kasutati ReactOSi loomisel:", + LTEXT "ReactOSi arendajad sooviksid tunnustada jrgmisi avatud lhtekoodiga projekte, mida kasutati ReactOSi loomisel:", IDC_STATIC,15,7,286,19 LISTBOX IDC_PROJECTS,15,30,286,75,LBS_NOSEL | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL - LTEXT "ReactOSi litsentsiks on GPL, seega kui soovid ReactOSi (vi selle osasid) "\ - "kasutada vi levitada, peab see toimuma GPL litsentsiga koosklas", + LTEXT "ReactOSi litsentsiks on GPL, seega kui soovid ReactOSi (vi selle osasid) kasutada vi levitada, peab see toimuma GPL litsentsiga koosklas", IDC_STATIC,15,110,220,22 PUSHBUTTON "&Vaata GPL litsentsi...",IDC_VIEWGPL,230,110,71,19 LTEXT "Vajuta Jrgmine, et jtkata paigaldamist.",IDC_STATIC,15,136, @@ -73,13 +70,12 @@ CAPTION "ReactOSi paigaldamine" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_ICON1, IDC_STATIC, 21, 7, 20, 20 - LTEXT "Anna oma arvutile nimi. See ei tohi olla pikem kui 15 themrki. "\ - "Vrgus peab arvuti nimi olema unikaalne.", + LTEXT "Anna oma arvutile nimi. See ei tohi olla pikem kui 15 themrki. Vrgus peab arvuti nimi olema unikaalne.", IDC_STATIC, 54, 7, 250, 24 LTEXT "&Arvuti nimi:", IDC_STATIC, 54, 38, 75, 8 EDITTEXT IDC_COMPUTERNAME, 165, 35, 148, 14, WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL | ES_UPPERCASE ICON IDI_ICON5, IDC_STATIC, 21, 57, 20, 20 - LTEXT "Arvuti tielikuks haldamiseks luuakse administraatori konto (Administrator). ",\ + LTEXT "Arvuti tielikuks haldamiseks luuakse administraatori konto (Administrator). ", IDC_STATIC, 54, 57, 250, 25 LTEXT "Sisesta administraatori parool, mille pikkus on maksimaalselt 14 themrki.", IDC_STATIC, 54, 87, 250, 8 @@ -96,9 +92,7 @@ CAPTION "ReactOSi paigaldamine" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_ICON4, IDC_STATIC, 21, 7, 20, 20 - LTEXT "Ssteemi lokaat peaks olema htiv nende programmide keelega, "\ - "mida soovid kasutada. Kasutaja lokaat mrab, kuidas nidatakse numbreid, "\ - "valuutat ja kuupeva.", IDC_STATIC, 53, 7, 253, 22 + LTEXT "Ssteemi lokaat peaks olema htiv nende programmide keelega, mida soovid kasutada. Kasutaja lokaat mrab, kuidas nidatakse numbreid, valuutat ja kuupeva.", IDC_STATIC, 53, 7, 253, 22 LTEXT "", IDC_LOCALETEXT, 53, 29, 250, 16 LTEXT "Ssteemi vi kasutaja lokaadi muutmiseks vajuta Tpsusta.", IDC_STATIC, 53, 60, 196, 8 @@ -149,11 +143,9 @@ CAPTION "ReactOSi paigaldamise l FONT 8, "MS Shell Dlg" BEGIN LTEXT "ReactOSi paigalduse lpetamine", IDC_FINISHTITLE, 115, 8, 195, 24 - LTEXT "ReactOS on edukalt paigaldatud.\n\n" \ - "Prast Lpeta vajutamist taaskivitatakse arvuti.", IDC_STATIC, 115, 40, 195, 100 + LTEXT "ReactOS on edukalt paigaldatud.\n\nPrast Lpeta vajutamist taaskivitatakse arvuti.", IDC_STATIC, 115, 40, 195, 100 CONTROL "", IDC_RESTART_PROGRESS, "msctls_progress32", PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 115, 138, 188, 12 - LTEXT "Kui CD draivis on CD, siis eemalda see. Seejrel vajuta "\ - "taaskivitamiseks Lpeta.", IDC_STATIC, 115, 169, 195, 17 + LTEXT "Kui CD draivis on CD, siis eemalda see. Seejrel vajuta taaskivitamiseks Lpeta.", IDC_STATIC, 115, 169, 195, 17 END diff --git a/dll/win32/syssetup/lang/fr-FR.rc b/dll/win32/syssetup/lang/fr-FR.rc index 8ab886be23d..dcc49e88c44 100644 --- a/dll/win32/syssetup/lang/fr-FR.rc +++ b/dll/win32/syssetup/lang/fr-FR.rc @@ -27,9 +27,7 @@ CAPTION "Installation de ReactOS" FONT 8, "MS Shell Dlg" BEGIN LTEXT "Bienvenue dans l'assistant d'installation de ReactOS.", IDC_WELCOMETITLE, 115, 9, 189, 31 - LTEXT "Cet assistant installe ReactOS sur votre ordinateur. Il a "\ - "besoin de certaines informations sur vous et votre ordinateur "\ - "pour configurer ReactOS correctement.", IDC_STATIC, 115, 50, 189, 100 + LTEXT "Cet assistant installe ReactOS sur votre ordinateur. Il a besoin de certaines informations sur vous et votre ordinateur pour configurer ReactOS correctement.", IDC_STATIC, 115, 50, 189, 100 LTEXT "Appuyez sur Suivant pour continuer l'installation.", IDC_STATIC, 115, 160, 189, 31 END @@ -39,13 +37,11 @@ STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYS CAPTION "Installation de ReactOS" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT "Les dveloppeurs de ReactOS voudraient prsenter les projets Open Source suivants, "\ - "(ou seulement des composants) qui ont t utiliss pour crer ReactOS :", + LTEXT "Les dveloppeurs de ReactOS voudraient prsenter les projets Open Source suivants, (ou seulement des composants) qui ont t utiliss pour crer ReactOS :", IDC_STATIC,15,7,286,19 LISTBOX IDC_PROJECTS,15,30,286,75,LBS_NOSEL | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL - LTEXT "ReactOS est sous license GPL, ainsi si vous voulez le rutiliser ou le redistribuer "\ - "(ou seulement des composants) vous devez respecter la GPL", + LTEXT "ReactOS est sous license GPL, ainsi si vous voulez le rutiliser ou le redistribuer (ou seulement des composants) vous devez respecter la GPL", IDC_STATIC,15,110,227,19 PUSHBUTTON "&Voir la GPL...",IDC_VIEWGPL,251,110,50,19 LTEXT "Cliquez sur Suivant pour continuer l'installation.",IDC_STATIC,15,136, @@ -74,14 +70,12 @@ CAPTION "Installation de ReactOS" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_ICON1, IDC_STATIC, 21, 7, 20, 20 - LTEXT "Entrez un nom pour votre ordinateur de 15 caractres ou moins. "\ - "Si vous tes sur un rseau, le nom saisi doit tre unique.", + LTEXT "Entrez un nom pour votre ordinateur de 15 caractres ou moins. Si vous tes sur un rseau, le nom saisi doit tre unique.", IDC_STATIC, 54, 7, 250, 24 LTEXT "&Nom de l'ordinateur :", IDC_STATIC, 54, 38, 75, 8 EDITTEXT IDC_COMPUTERNAME, 165, 35, 148, 14, WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL | ES_UPPERCASE ICON IDI_ICON5, IDC_STATIC, 21, 57, 20, 20 - LTEXT "L'assistant va crer un compte utilisateur sur votre ordinateur appel Administrateur. "\ - "Vous pourrez utiliser ce compte pour avoir un accs complet votre ordinateur.", + LTEXT "L'assistant va crer un compte utilisateur sur votre ordinateur appel Administrateur. Vous pourrez utiliser ce compte pour avoir un accs complet votre ordinateur.", IDC_STATIC, 54, 57, 250, 25 LTEXT "Entrez le mot de passe Administrateur (14 caractres ou moins).", IDC_STATIC, 54, 87, 250, 8 @@ -98,9 +92,7 @@ CAPTION "Installation de ReactOS" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_ICON4, IDC_STATIC, 21, 7, 20, 20 - LTEXT "La localisation systme correspond la langue souhaite "\ - "pour les applications. Elle contrle la manire dont les nombres, "\ - "monnaies et dates sont affiches.", IDC_STATIC, 53, 7, 253, 20 + LTEXT "La localisation systme correspond la langue souhaite pour les applications. Elle contrle la manire dont les nombres, monnaies et dates sont affiches.", IDC_STATIC, 53, 7, 253, 20 LTEXT "", IDC_LOCALETEXT, 53, 29, 250, 16 LTEXT "Pour changer la localisation systme, cliquez sur Modifier.", IDC_STATIC, 53, 60, 184, 8 @@ -150,11 +142,9 @@ CAPTION "Installation de ReactOS" FONT 8, "MS Shell Dlg" BEGIN LTEXT "L'assistant d'installation de ReactOS est termin.",IDC_FINISHTITLE,115,9,195,37 - LTEXT "Vous avez install avec succs ReactOS.\n\n" \ - "En cliquant sur Terminer, votre ordinateur va redmarrer.", IDC_STATIC, 115, 58, 195, 100 + LTEXT "Vous avez install avec succs ReactOS.\n\nEn cliquant sur Terminer, votre ordinateur va redmarrer.", IDC_STATIC, 115, 58, 195, 100 CONTROL "", IDC_RESTART_PROGRESS, "msctls_progress32", PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 115, 138, 188, 12 - LTEXT "S'il y a un CD dans un lecteur, enlevez-le. Puis, pour redmarrer "\ - "votre ordinateur, cliquez sur Terminer.", IDC_STATIC, 115, 160, 195, 31 + LTEXT "S'il y a un CD dans un lecteur, enlevez-le. Puis, pour redmarrer votre ordinateur, cliquez sur Terminer.", IDC_STATIC, 115, 160, 195, 31 END diff --git a/dll/win32/syssetup/lang/hu-HU.rc b/dll/win32/syssetup/lang/hu-HU.rc index 33cc05b16dd..a3d5e56a364 100644 --- a/dll/win32/syssetup/lang/hu-HU.rc +++ b/dll/win32/syssetup/lang/hu-HU.rc @@ -26,8 +26,7 @@ CAPTION "ReactOS Telep FONT 8, "MS Shell Dlg" BEGIN LTEXT "dvzlnk a ReactOS teleptben.", IDC_WELCOMETITLE, 115, 8, 195, 24 - LTEXT "A ReactOS telept segtsgvel felteleptjk a ReactOS rendszert a gpedre. "\ - "A telept elbb sszegyjt pr informcit, majd vglegestjk a teleptst. ", IDC_STATIC, 115, 40, 195, 100 + LTEXT "A ReactOS telept segtsgvel felteleptjk a ReactOS rendszert a gpedre. A telept elbb sszegyjt pr informcit, majd vglegestjk a teleptst. ", IDC_STATIC, 115, 40, 195, 100 LTEXT "Kattints a Tovbb gombra a folytatshoz.", IDC_STATIC, 115, 169, 195, 17 END @@ -37,13 +36,11 @@ STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYS CAPTION "ReactOS Telept" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT "A ReactOS fejlesztk szeretnnek ksznetet mondani az albbi Open Source projekteknek "\ - "amiket (rszben) felhasznltak a ReactOS fejlesztshez:", + LTEXT "A ReactOS fejlesztk szeretnnek ksznetet mondani az albbi Open Source projekteknek amiket (rszben) felhasznltak a ReactOS fejlesztshez:", IDC_STATIC,15,7,286,19 LISTBOX IDC_PROJECTS,15,30,286,75,LBS_NOSEL | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL - LTEXT "A ReactOS a GPL licenszvel rendelkezik, gy felhasznlshoz s terjesztshez "\ - "ezt a licenszt kell figyelembe venni.", + LTEXT "A ReactOS a GPL licenszvel rendelkezik, gy felhasznlshoz s terjesztshez ezt a licenszt kell figyelembe venni.", IDC_STATIC,15,110,227,19 PUSHBUTTON "&Licensz megtekintse...",IDC_VIEWGPL,200,120,90,19 LTEXT "Kattints a Tovbb gombra a folytatshoz.",IDC_STATIC,15,136,170,17 @@ -71,14 +68,12 @@ CAPTION "ReactOS Telep FONT 8, "MS Shell Dlg" BEGIN ICON IDI_ICON1, IDC_STATIC, 21, 7, 20, 20 - LTEXT "Adj egy nevet a szmtgpednek, ami nem tbb mint 15 bet. "\ - "Ha hlzaton vagy, akkor ennek a nvnek egyedinek kell lennie.", + LTEXT "Adj egy nevet a szmtgpednek, ami nem tbb mint 15 bet. Ha hlzaton vagy, akkor ennek a nvnek egyedinek kell lennie.", IDC_STATIC, 54, 7, 250, 24 LTEXT "&Szmtgp nv:", IDC_STATIC, 54, 38, 75, 8 EDITTEXT IDC_COMPUTERNAME, 132, 35, 163, 14, WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL | ES_UPPERCASE ICON IDI_ICON5, IDC_STATIC, 21, 57, 20, 20 - LTEXT "A telept ltrehoz egy felhasznli fikot, a Rendszergazdt. "\ - "Ezzel a fikkal teljes jogod van a szmtgped felett.", IDC_STATIC, 54, 57, 250, 25 + LTEXT "A telept ltrehoz egy felhasznli fikot, a Rendszergazdt. Ezzel a fikkal teljes jogod van a szmtgped felett.", IDC_STATIC, 54, 57, 250, 25 LTEXT "Adj meg egy jelszt, ami nem tbb mint 14 karakter.", IDC_STATIC, 54, 87, 250, 8 LTEXT "&Jelsz:", IDC_STATIC, 54, 104, 75, 8 EDITTEXT IDC_ADMINPASSWORD1, 132, 101, 172, 14, WS_VISIBLE | WS_TABSTOP | ES_PASSWORD @@ -93,12 +88,9 @@ CAPTION "ReactOS Telep FONT 8, "MS Shell Dlg" BEGIN ICON IDI_ICON4, IDC_STATIC, 21, 7, 20, 20 - LTEXT "A rendszer terleti belltsa meghatrozzk a hasznlni kvnt nyelvet. "\ - "A terleti belltsok hatrozzk meg, hogy a szmok, "\ - "valuta s dtum informcik hogyan jelennek meg.", IDC_STATIC, 53, 7, 253, 24 + LTEXT "A rendszer terleti belltsa meghatrozzk a hasznlni kvnt nyelvet. A terleti belltsok hatrozzk meg, hogy a szmok, valuta s dtum informcik hogyan jelennek meg.", IDC_STATIC, 53, 7, 253, 24 LTEXT "", IDC_LOCALETEXT, 53, 35, 250, 16 - LTEXT "A terleti bellts megvltoztatshoz kattints\n" \ - "a Kivlaszts gombra.", IDC_STATIC, 53, 56, 184, 16 + LTEXT "A terleti bellts megvltoztatshoz kattints\na Kivlaszts gombra.", IDC_STATIC, 53, 56, 184, 16 PUSHBUTTON "&Kivlaszts...", IDC_CUSTOMLOCALE, 245, 57, 50, 14 LTEXT "A billentyzet kioszts hatrozza meg a gombok mkdst.", IDC_STATIC, 53, 86, 253, 8 LTEXT "", IDC_LAYOUTTEXT, 53, 100, 250, 16 @@ -144,11 +136,9 @@ CAPTION "A ReactOS telep FONT 8, "MS Shell Dlg" BEGIN LTEXT "A telepts befejezse", IDC_FINISHTITLE, 115, 8, 195, 24 - LTEXT "Sikeresen felteleptetted a ReactOS rendszert.\n\n" \ - "Ha a befejezsre kattintasz, a szmtgped jraindul.", IDC_STATIC, 115, 40, 195, 100 + LTEXT "Sikeresen felteleptetted a ReactOS rendszert.\n\nHa a befejezsre kattintasz, a szmtgped jraindul.", IDC_STATIC, 115, 40, 195, 100 CONTROL "", IDC_RESTART_PROGRESS, "msctls_progress32", PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 115, 138, 188, 12 - LTEXT "Ha van CD vagy DVD lemez a meghajtdban, vedd ki, s utnna "\ - "kattints a Befejezs gombra.", IDC_STATIC, 115, 169, 195, 17 + LTEXT "Ha van CD vagy DVD lemez a meghajtdban, vedd ki, s utnna kattints a Befejezs gombra.", IDC_STATIC, 115, 169, 195, 17 END @@ -161,9 +151,7 @@ CAPTION "ReactOS Telep FONT 8, "MS Shell Dlg" BEGIN LTEXT "Sikeresen felteleptetted a ReactOS rendszert.", IDC_STATIC, 13, 12, 212, 16 - LTEXT "A folytatshoz jra kell indtani a rendszert. "\ - "A szmtgp 15 msodperc mlva jraindul, vagy azonnal ha rkattintasz "\ - "az jraindts gombra.", IDC_STATIC, 13, 33, 212, 32 + LTEXT "A folytatshoz jra kell indtani a rendszert. A szmtgp 15 msodperc mlva jraindul, vagy azonnal ha rkattintasz az jraindts gombra.", IDC_STATIC, 13, 33, 212, 32 // GROUPBOX "", -1, 7, 3, 231, 106 CONTROL "", IDC_RESTART_PROGRESS, "msctls_progress32", PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 13, 70, 212, 8 PUSHBUTTON "&jraindts", IDOK, 98, 87, 50, 14 diff --git a/dll/win32/syssetup/lang/id-ID.rc b/dll/win32/syssetup/lang/id-ID.rc index c42d42bd9ea..2c72cfb066c 100644 --- a/dll/win32/syssetup/lang/id-ID.rc +++ b/dll/win32/syssetup/lang/id-ID.rc @@ -24,9 +24,7 @@ CAPTION "ReactOS Setup" FONT 8, "MS Shell Dlg" BEGIN LTEXT "Welcome to the ReactOS Setup Wizard.", IDC_WELCOMETITLE, 115, 8, 195, 24 - LTEXT "This wizard installs ReactOS on your computer. The wizard "\ - "needs to gather some information about you and your computer "\ - "to set up ReactOS properly.", IDC_STATIC, 115, 40, 195, 100 + LTEXT "This wizard installs ReactOS on your computer. The wizard needs to gather some information about you and your computer to set up ReactOS properly.", IDC_STATIC, 115, 40, 195, 100 LTEXT "Click Next to continue with Setup.", IDC_STATIC, 115, 169, 195, 17 END @@ -36,13 +34,11 @@ STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYS CAPTION "ReactOS Setup" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT "The ReactOS developers would like to acknowledge the following Open Source projects, "\ - "(parts of) which were used to create ReactOS:", + LTEXT "The ReactOS developers would like to acknowledge the following Open Source projects, (parts of) which were used to create ReactOS:", IDC_STATIC,15,7,286,19 LISTBOX IDC_PROJECTS,15,30,286,75,LBS_NOSEL | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL - LTEXT "ReactOS is licensed under the GPL, so if you want to reuse or redistribute "\ - "(parts of) it you must respect the GPL", + LTEXT "ReactOS is licensed under the GPL, so if you want to reuse or redistribute (parts of) it you must respect the GPL", IDC_STATIC,15,110,227,19 PUSHBUTTON "&View GPL...",IDC_VIEWGPL,251,110,50,19 LTEXT "Click Next to continue with Setup.",IDC_STATIC,15,136, @@ -71,14 +67,12 @@ CAPTION "ReactOS Setup" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_ICON1, IDC_STATIC, 21, 7, 20, 20 - LTEXT "Type a name for your computer that is 15 characters or less. "\ - "If you are on a network, your computer name must be unique.", + LTEXT "Type a name for your computer that is 15 characters or less. If you are on a network, your computer name must be unique.", IDC_STATIC, 54, 7, 250, 24 LTEXT "&Computer Name:", IDC_STATIC, 54, 38, 75, 8 EDITTEXT IDC_COMPUTERNAME, 132, 35, 163, 14, WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL | ES_UPPERCASE ICON IDI_ICON5, IDC_STATIC, 21, 57, 20, 20 - LTEXT "Setup will create a user account on your computer called Administrator. "\ - "You can use this account if you need full access to your computer.", + LTEXT "Setup will create a user account on your computer called Administrator. You can use this account if you need full access to your computer.", IDC_STATIC, 54, 57, 250, 25 LTEXT "Type an Administrator Password that is 14 characters or less.", IDC_STATIC, 54, 87, 250, 8 @@ -95,9 +89,7 @@ CAPTION "Setup ReactOS" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_ICON4, IDC_STATIC, 21, 7, 20, 20 - LTEXT "Lokal sistem harus sama bahasa dari aplikasi "\ - "yang ingin anda gunakan. Pengguna lokal mengontrol bagaimana "\ - "angka, kurs, dan tampilan tanggal.", IDC_STATIC, 53, 7, 253, 20 + LTEXT "Lokal sistem harus sama bahasa dari aplikasi yang ingin anda gunakan. Pengguna lokal mengontrol bagaimana angka, kurs, dan tampilan tanggal.", IDC_STATIC, 53, 7, 253, 20 LTEXT "", IDC_LOCALETEXT, 53, 29, 250, 16 LTEXT "Untuk mengubah sistem atau setelan lokal pengguna, klik Kustomisasi.", IDC_STATIC, 53, 60, 184, 8 @@ -148,11 +140,9 @@ CAPTION "Menyelesaikan Setup ReactOS" FONT 8, "MS Shell Dlg" BEGIN LTEXT "Menyelesaikan Bimbingan Setup ReactOS", IDC_FINISHTITLE, 115, 8, 195, 24 - LTEXT "Anda telah sukses menyelesaikan Setup ReactOS.\n\n" \ - "Saat anda mengklik Selesai, komputer anda akan dimulai lagi.", IDC_STATIC, 115, 40, 195, 100 + LTEXT "Anda telah sukses menyelesaikan Setup ReactOS.\n\nSaat anda mengklik Selesai, komputer anda akan dimulai lagi.", IDC_STATIC, 115, 40, 195, 100 CONTROL "", IDC_RESTART_PROGRESS, "msctls_progress32", PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 115, 138, 188, 12 - LTEXT "Jika ada CD di dalam drive, keluarkan. Lalu, untuk memulai lagi "\ - "komputer anda, klik Selesai.", IDC_STATIC, 115, 169, 195, 17 + LTEXT "Jika ada CD di dalam drive, keluarkan. Lalu, untuk memulai lagi komputer anda, klik Selesai.", IDC_STATIC, 115, 169, 195, 17 END diff --git a/dll/win32/syssetup/lang/it-IT.rc b/dll/win32/syssetup/lang/it-IT.rc index d6603962a0a..ea2cdf398af 100644 --- a/dll/win32/syssetup/lang/it-IT.rc +++ b/dll/win32/syssetup/lang/it-IT.rc @@ -17,9 +17,7 @@ CAPTION "Installazione di ReactOS" FONT 8, "MS Shell Dlg" BEGIN LTEXT "Benvenuti alla configurazione guidata di ReactOS.", IDC_WELCOMETITLE, 115, 8, 195, 24 - LTEXT "Questa procedura guidata installa ReactOS su questo computer.\nLa procedura "\ - "deve raccogliere alcune informazioni sull'utente e sul computer "\ - "per configurare ReactOS adeguatamente.", IDC_STATIC, 115, 40, 195, 100 + LTEXT "Questa procedura guidata installa ReactOS su questo computer.\nLa procedura deve raccogliere alcune informazioni sull'utente e sul computer per configurare ReactOS adeguatamente.", IDC_STATIC, 115, 40, 195, 100 LTEXT "Selezionare Avanti per proseguire con la configurazione.", IDC_STATIC, 115, 169, 195, 17 END @@ -29,13 +27,11 @@ STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYS CAPTION "Installazione di ReactOS" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT "Gli sviluppatori di ReactOS desiderano citare i seguenti progetti Open Source, "\ - "che sono stati usati (in tutto o in parte) per creare ReactOS:", + LTEXT "Gli sviluppatori di ReactOS desiderano citare i seguenti progetti Open Source, che sono stati usati (in tutto o in parte) per creare ReactOS:", IDC_STATIC,20,7,286,19 LISTBOX IDC_PROJECTS,20,30,280,75,LBS_NOSEL | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL - LTEXT "ReactOS soggetto alla licenza GPL, per cui se si desidera riusarlo o ridistribuirlo "\ - "(in tutto o in parte) necessario rispettare la GPL", + LTEXT "ReactOS soggetto alla licenza GPL, per cui se si desidera riusarlo o ridistribuirlo (in tutto o in parte) necessario rispettare la GPL", IDC_STATIC,20,110,217,22 PUSHBUTTON "&Mostra la GPL...",IDC_VIEWGPL,241,110,60,19 LTEXT "Selezionare Avanti per proseguire con la configurazione.",IDC_STATIC,20,136, @@ -64,14 +60,12 @@ CAPTION "Installazione di ReactOS" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_ICON1, IDC_STATIC, 21, 7, 20, 20 - LTEXT "Scrivere un nome per il computer che sia lungo al massimo 15 caratteri.\n"\ - "Se si in rete, il nome del computer deve essere univoco.", + LTEXT "Scrivere un nome per il computer che sia lungo al massimo 15 caratteri.\nSe si in rete, il nome del computer deve essere univoco.", IDC_STATIC, 54, 7, 250, 24 LTEXT "Nome del &computer:", IDC_STATIC, 29, 38, 75, 8 EDITTEXT IDC_COMPUTERNAME, 140, 35, 160, 14, WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL | ES_UPPERCASE ICON IDI_ICON5, IDC_STATIC, 21, 57, 20, 20 - LTEXT "Questa procedura creer su questo computer un account utente chiamato Administrator. "\ - "Si potr usare questo account se si necessita l'accesso completo al computer.", + LTEXT "Questa procedura creer su questo computer un account utente chiamato Administrator. Si potr usare questo account se si necessita l'accesso completo al computer.", IDC_STATIC, 54, 57, 250, 25 LTEXT "Scrivere una password per Administrator che sia lunga al massimo 14 caratteri.", IDC_STATIC, 26, 87, 280, 8 @@ -88,9 +82,7 @@ CAPTION "Installazione di ReactOS" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_ICON4, IDC_STATIC, 21, 7, 20, 20 - LTEXT "Le impostazioni linguistiche del sistema devono coincidere con la lingua degli applicativi "\ - "che si desidera usare. Le impostazioni linguistiche dell'utente stabiliscono come appaiono "\ - "i numeri, i valori monetari e le date.", IDC_STATIC, 56, 7, 253, 26 + LTEXT "Le impostazioni linguistiche del sistema devono coincidere con la lingua degli applicativi che si desidera usare. Le impostazioni linguistiche dell'utente stabiliscono come appaiono i numeri, i valori monetari e le date.", IDC_STATIC, 56, 7, 253, 26 LTEXT "", IDC_LOCALETEXT, 56, 35, 250, 16 LTEXT "Per cambiare le impostazioni linguistiche del sistema o dell'utente, selezionare Personalizza.", IDC_STATIC, 20, 55, 184, 16 @@ -141,11 +133,9 @@ CAPTION "L'installazione di ReactOS FONT 8, "MS Shell Dlg" BEGIN LTEXT "Completamento della procedura guidata di installazione di ReactOS", IDC_FINISHTITLE, 115, 8, 195, 24 - LTEXT "La procedura guidata di installazione di ReactOS completata.\n\n" \ - "Selezionando Fine, il computer sar riavviato.", IDC_STATIC, 115, 40, 195, 100 + LTEXT "La procedura guidata di installazione di ReactOS completata.\n\nSelezionando Fine, il computer sar riavviato.", IDC_STATIC, 115, 40, 195, 100 CONTROL "", IDC_RESTART_PROGRESS, "msctls_progress32", PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 115, 138, 188, 12 - LTEXT "Se c' un CD in un lettore, necessario rimuoverlo. Poi, per riavviare "\ - "il computer, selezionare Fine.", IDC_STATIC, 115, 169, 195, 17 + LTEXT "Se c' un CD in un lettore, necessario rimuoverlo. Poi, per riavviare il computer, selezionare Fine.", IDC_STATIC, 115, 169, 195, 17 END diff --git a/dll/win32/syssetup/lang/ja-JP.rc b/dll/win32/syssetup/lang/ja-JP.rc index ebe36a432d3..6fb7e03e9d5 100644 --- a/dll/win32/syssetup/lang/ja-JP.rc +++ b/dll/win32/syssetup/lang/ja-JP.rc @@ -26,9 +26,7 @@ CAPTION "ReactOS FONT 9, "MS UI Gothic" BEGIN LTEXT "ReactOSZbgAbv EBU[hւ悤B", IDC_WELCOMETITLE, 115, 8, 195, 24 - LTEXT "̃EBU[hł́AReactOS Rs[^ɃCXg[܂B "\ - "ReactOS𐳂ZbgAbv邽߂ɁA[U[ƃRs[^ "\ - "ւW߂Kv܂B", IDC_STATIC, 115, 40, 195, 100 + LTEXT "̃EBU[hł́AReactOS Rs[^ɃCXg[܂B ReactOS𐳂ZbgAbv邽߂ɁA[U[ƃRs[^ ւW߂Kv܂B", IDC_STATIC, 115, 40, 195, 100 LTEXT "ZbgAbv𑱍sɂ [] NbNĂB", IDC_STATIC, 115, 169, 195, 17 END @@ -38,13 +36,11 @@ STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYS CAPTION "ReactOS ZbgAbv" FONT 9, "MS UI Gothic", 0, 0, 0x0 BEGIN - LTEXT "ReactOS̊J҂AL̃I[v\\[X vWFNgɊӂ̈ӂ\\܂B "\ - "ׂ̂Ă܂͈ꕔReactOS̊Jɗp܂B", + LTEXT "ReactOS̊J҂AL̃I[v\\[X vWFNgɊӂ̈ӂ\\܂B ׂ̂Ă܂͈ꕔReactOS̊Jɗp܂B", IDC_STATIC,15,7,286,19 LISTBOX IDC_PROJECTS,15,30,286,75,LBS_NOSEL | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL - LTEXT "ReactOSGPL̉ɃCZXĂAׂĂ܂͈ꕔėpA "\ - "ĔzzꍇGPLɏ]Kv܂B", + LTEXT "ReactOSGPL̉ɃCZXĂAׂĂ܂͈ꕔėpA ĔzzꍇGPLɏ]Kv܂B", IDC_STATIC,15,110,227,19 PUSHBUTTON "GPL\\(&V)...",IDC_VIEWGPL,251,110,50,19 LTEXT "ZbgAbv𑱍sɂ [] NbNĂB",IDC_STATIC,15,136, @@ -73,14 +69,12 @@ CAPTION "ReactOS FONT 9, "MS UI Gothic" BEGIN ICON IDI_ICON1, IDC_STATIC, 21, 7, 20, 20 - LTEXT "Rs[^𔼊p63ȓœ͂ĂB "\ - "Rs[^lbg[Nɂꍇ́AOdȂ悤ɂĂB", + LTEXT "Rs[^𔼊p63ȓœ͂ĂB Rs[^lbg[Nɂꍇ́AOdȂ悤ɂĂB", IDC_STATIC, 54, 7, 250, 24 LTEXT "Rs[^(&C):", IDC_STATIC, 54, 38, 75, 8 EDITTEXT IDC_COMPUTERNAME, 165, 35, 148, 14, WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL | ES_UPPERCASE ICON IDI_ICON5, IDC_STATIC, 21, 57, 20, 20 - LTEXT "AdministratorƌĂ΂郆[U[AJEg쐬܂B "\ - "Rs[^ɃtANZXKvȂƂÃAJEggp܂B", + LTEXT "AdministratorƌĂ΂郆[U[AJEg쐬܂B Rs[^ɃtANZXKvȂƂÃAJEggp܂B", IDC_STATIC, 54, 57, 250, 25 LTEXT "Administrator̃pX[h𔼊p 14 ȓœ͂ĂB", IDC_STATIC, 54, 87, 250, 8 @@ -97,9 +91,7 @@ CAPTION "ReactOS FONT 9, "MS UI Gothic" BEGIN ICON IDI_ICON4, IDC_STATIC, 21, 7, 20, 20 - LTEXT "VXẽP[AAvP[VŎgpɐݒ肵ĂB "\ - "[U[P[́AlAʉ݁At̕\\@𐧌䂵܂B "\ - "", IDC_STATIC, 53, 7, 253, 20 + LTEXT "VXẽP[AAvP[VŎgpɐݒ肵ĂB [U[P[́AlAʉ݁At̕\\@𐧌䂵܂B ", IDC_STATIC, 53, 7, 253, 20 LTEXT "", IDC_LOCALETEXT, 53, 29, 250, 16 LTEXT "VXeA[U[P[ݒύXɂ[JX^}CY]NbN܂B", IDC_STATIC, 53, 50, 166, 25 @@ -150,11 +142,9 @@ CAPTION "ReactOS FONT 9, "MS UI Gothic" BEGIN LTEXT "ReactOS ZbgAbv EBU[h̊", IDC_FINISHTITLE, 115, 8, 195, 24 - LTEXT "ReactOS ZbgAbvɊ܂B\n\n" \ - "[] NbNƁARs[^ċN܂B", IDC_STATIC, 115, 40, 195, 100 + LTEXT "ReactOS ZbgAbvɊ܂B\n\n[] NbNƁARs[^ċN܂B", IDC_STATIC, 115, 40, 195, 100 CONTROL "", IDC_RESTART_PROGRESS, "msctls_progress32", PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 115, 138, 188, 12 - LTEXT "hCuCDꍇ͎oĂB ċNɂ "\ - "NbNĂB", IDC_STATIC, 115, 169, 195, 17 + LTEXT "hCuCDꍇ͎oĂB ċNɂ NbNĂB", IDC_STATIC, 115, 169, 195, 17 END diff --git a/dll/win32/syssetup/lang/nl-NL.rc b/dll/win32/syssetup/lang/nl-NL.rc index 85fd68f61cb..41f042d0afb 100644 --- a/dll/win32/syssetup/lang/nl-NL.rc +++ b/dll/win32/syssetup/lang/nl-NL.rc @@ -26,9 +26,7 @@ CAPTION "ReactOS Setup" FONT 8, "MS Shell Dlg" BEGIN LTEXT "Welkom bij de Reactos installatiewizard.", IDC_WELCOMETITLE, 115, 8, 195, 24 - LTEXT "Deze wizard zal Reactos op je computer installeren. De wizard "\ - "heeft informatie over jou en jouw computer nodig "\ - "om Reactos correct in te stellen.", IDC_STATIC, 115, 40, 195, 100 + LTEXT "Deze wizard zal Reactos op je computer installeren. De wizard heeft informatie over jou en jouw computer nodig om Reactos correct in te stellen.", IDC_STATIC, 115, 40, 195, 100 LTEXT "Klik op Volgende om voort te gaan met de installatie.", IDC_STATIC, 115, 169, 195, 17 END @@ -38,13 +36,11 @@ STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYS CAPTION "ReactOS Setup" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT "The ReactOS developers would like to acknowledge the following Open Source projects, "\ - "(parts of) which were used to create ReactOS:", + LTEXT "The ReactOS developers would like to acknowledge the following Open Source projects, (parts of) which were used to create ReactOS:", IDC_STATIC,15,7,286,19 LISTBOX IDC_PROJECTS,15,30,286,75,LBS_NOSEL | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL - LTEXT "ReactOS is licensed under the GPL, so if you want to reuse or redistribute "\ - "(parts of) it you must respect the GPL", + LTEXT "ReactOS is licensed under the GPL, so if you want to reuse or redistribute (parts of) it you must respect the GPL", IDC_STATIC,15,110,227,19 PUSHBUTTON "&View GPL...",IDC_VIEWGPL,251,110,50,19 LTEXT "Klik op Volgende om voort te gaan met de installatie.",IDC_STATIC,15,136, @@ -73,14 +69,12 @@ CAPTION "ReactOS Setup" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_ICON1, IDC_STATIC, 21, 7, 20, 20 - LTEXT "Geef een naam in voor de computer. "\ - "In een netwerk moet je een unieke naam kiezen.", + LTEXT "Geef een naam in voor de computer. In een netwerk moet je een unieke naam kiezen.", IDC_STATIC, 54, 7, 250, 24 LTEXT "&Computernaam:", IDC_STATIC, 54, 38, 75, 8 EDITTEXT IDC_COMPUTERNAME, 132, 35, 163, 14, WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL | ES_UPPERCASE ICON IDI_ICON5, IDC_STATIC, 21, 57, 20, 20 - LTEXT "Setup will create a user account on your computer called Administrator. "\ - "You can use this account if you need full access to your computer.", + LTEXT "Setup will create a user account on your computer called Administrator. You can use this account if you need full access to your computer.", IDC_STATIC, 54, 57, 250, 25 LTEXT "Type an Administrator Password that is 14 characters or less.", IDC_STATIC, 54, 87, 250, 8 @@ -97,9 +91,7 @@ CAPTION "ReactOS Setup" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_ICON4, IDC_STATIC, 21, 7, 20, 20 - LTEXT "The system locale should match the language of the applications "\ - "you want to use. The user locale controls how numbers, "\ - "currencies, and dates appear.", IDC_STATIC, 53, 7, 253, 20 + LTEXT "The system locale should match the language of the applications you want to use. The user locale controls how numbers, currencies, and dates appear.", IDC_STATIC, 53, 7, 253, 20 LTEXT "", IDC_LOCALETEXT, 53, 29, 250, 16 LTEXT "To change system or user locale settings, click Customize.", IDC_STATIC, 53, 60, 184, 8 @@ -150,11 +142,9 @@ CAPTION "Completing ReactOS Setup" FONT 8, "MS Shell Dlg" BEGIN LTEXT "Completing the ReactOS Setup Wizard", IDC_FINISHTITLE, 115, 8, 195, 24 - LTEXT "You have successfully completed ReactOS Setup.\n\n" \ - "When you click Finish, your computer will restart.", IDC_STATIC, 115, 40, 195, 100 + LTEXT "You have successfully completed ReactOS Setup.\n\nWhen you click Finish, your computer will restart.", IDC_STATIC, 115, 40, 195, 100 CONTROL "", IDC_RESTART_PROGRESS, "msctls_progress32", PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 115, 138, 188, 12 - LTEXT "If there is a CD in a drive, remove it. Then, to restart "\ - "your computer, click Finish.", IDC_STATIC, 115, 169, 195, 17 + LTEXT "If there is a CD in a drive, remove it. Then, to restart your computer, click Finish.", IDC_STATIC, 115, 169, 195, 17 END diff --git a/dll/win32/syssetup/lang/no-NO.rc b/dll/win32/syssetup/lang/no-NO.rc index 2ce6965bf56..1bfed28f3b4 100644 --- a/dll/win32/syssetup/lang/no-NO.rc +++ b/dll/win32/syssetup/lang/no-NO.rc @@ -29,9 +29,7 @@ CAPTION "ReactOS installasjon" FONT 8, "MS Shell Dlg" BEGIN LTEXT "Velkommen til ReactOS installasjon veiviser.", IDC_WELCOMETITLE, 115, 8, 195, 24 - LTEXT "Denne veiviseren installerer ReactOS p din datamaskin. Veiviseren "\ - "m samle sammen ndvendig informasjon om deg og din datamaskin "\ - "for sette opp ReactOS skikkelig.", IDC_STATIC, 115, 40, 195, 100 + LTEXT "Denne veiviseren installerer ReactOS p din datamaskin. Veiviseren m samle sammen ndvendig informasjon om deg og din datamaskin for sette opp ReactOS skikkelig.", IDC_STATIC, 115, 40, 195, 100 LTEXT "Klikk Neste for fortsette installasjonen.", IDC_STATIC, 115, 169, 195, 17 END @@ -41,13 +39,11 @@ STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYS CAPTION "ReactOS installasjon" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT "ReactOS utviklerene anerkjenner de flgende pen kildekode prosjektene, "\ - "(deler av) som ble brukt til skape ReactOS:", + LTEXT "ReactOS utviklerene anerkjenner de flgende pen kildekode prosjektene, (deler av) som ble brukt til skape ReactOS:", IDC_STATIC,15,7,286,19 LISTBOX IDC_PROJECTS,15,30,286,75,LBS_NOSEL | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL - LTEXT "ReactOS er lisensert under GPL, s hvis du vil bruke eller gi ut "\ - "(deler av) ReactOS, m du respektere GPL", + LTEXT "ReactOS er lisensert under GPL, s hvis du vil bruke eller gi ut (deler av) ReactOS, m du respektere GPL", IDC_STATIC,15,110,227,19 PUSHBUTTON "&Vis GPL...",IDC_VIEWGPL,251,110,50,19 LTEXT "Klikk Neste for fortsette installasjonen.",IDC_STATIC,15,136, @@ -76,14 +72,12 @@ CAPTION "ReactOS installasjon" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_ICON1, IDC_STATIC, 21, 7, 20, 20 - LTEXT "Skriv inn et navn for din datamaskin som er 15 karakterer eller mindre. "\ - "Hvis du er p et nettverk, s m ditt datamaskin navn vre unikt.", + LTEXT "Skriv inn et navn for din datamaskin som er 15 karakterer eller mindre. Hvis du er p et nettverk, s m ditt datamaskin navn vre unikt.", IDC_STATIC, 54, 7, 250, 24 LTEXT "&Datamaskin navn:", IDC_STATIC, 54, 38, 75, 8 EDITTEXT IDC_COMPUTERNAME, 132, 35, 163, 14, WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL | ES_UPPERCASE ICON IDI_ICON5, IDC_STATIC, 21, 57, 20, 20 - LTEXT "Installasjonen vil lage en brukerkonto som blir kalt Administrator. "\ - "Du kan bruke denne kontoen hvis du trenger full adgang til din datamaskin.", + LTEXT "Installasjonen vil lage en brukerkonto som blir kalt Administrator. Du kan bruke denne kontoen hvis du trenger full adgang til din datamaskin.", IDC_STATIC, 54, 57, 250, 25 LTEXT "Skriv inn et Administrator passord som er 14 karakterer eller mindre.", IDC_STATIC, 54, 87, 250, 8 @@ -100,9 +94,7 @@ CAPTION "ReactOS installasjon" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_ICON4, IDC_STATIC, 21, 7, 20, 20 - LTEXT "Systemets sprk og region burde samsvare med sprket p programmene "\ - "du vil bruke. Innstillingene for sprk og region kontrollerer hvordan tall, "\ - "valutaer, og dato vises.", IDC_STATIC, 55, 7, 259, 24 + LTEXT "Systemets sprk og region burde samsvare med sprket p programmene du vil bruke. Innstillingene for sprk og region kontrollerer hvordan tall, valutaer, og dato vises.", IDC_STATIC, 55, 7, 259, 24 LTEXT "", IDC_LOCALETEXT, 53, 32, 250, 18 LTEXT "For forandre systemets sprk og region instilling, Trykk p Tilpass.", IDC_STATIC, 53, 60, 184, 8 @@ -153,11 +145,9 @@ CAPTION "Fullf FONT 8, "MS Shell Dlg" BEGIN LTEXT "Fullfrer ReactOS installasjons veiviser", IDC_FINISHTITLE, 115, 8, 195, 24 - LTEXT "Installasjonen av ReactOS er fullfrt.\n\n" \ - "Nr du trykker p fullfr, vil datamaskinen bli startet p nytt.", IDC_STATIC, 115, 40, 205, 100 + LTEXT "Installasjonen av ReactOS er fullfrt.\n\nNr du trykker p fullfr, vil datamaskinen bli startet p nytt.", IDC_STATIC, 115, 40, 205, 100 CONTROL "", IDC_RESTART_PROGRESS, "msctls_progress32", PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 115, 138, 188, 12 - LTEXT "Fjern en eventuell CD-ROM fra stasjonen. Klikk Fullfr "\ - "for starte datamaskinen p nytt.", IDC_STATIC, 115, 169, 195, 17 + LTEXT "Fjern en eventuell CD-ROM fra stasjonen. Klikk Fullfr for starte datamaskinen p nytt.", IDC_STATIC, 115, 169, 195, 17 END diff --git a/dll/win32/syssetup/lang/pl-PL.rc b/dll/win32/syssetup/lang/pl-PL.rc index 57a8613cbb3..25d2873b1ea 100644 --- a/dll/win32/syssetup/lang/pl-PL.rc +++ b/dll/win32/syssetup/lang/pl-PL.rc @@ -17,12 +17,12 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * translated by Caemyr - * updated by Caemyr - Olaf Siejka (Jan, 2008), (Aug, 2009) - * Use ReactOS forum PM or IRC to contact me - * http://www.reactos.org - * IRC: irc.freenode.net #reactos-pl; - * + * translated by Caemyr + * updated by Caemyr - Olaf Siejka (Jan, 2008), (Aug, 2009) + * Use ReactOS forum PM or IRC to contact me + * http://www.reactos.org + * IRC: irc.freenode.net #reactos-pl; + * UTF-8 conversion by Caemyr (May, 2011) */ LANGUAGE LANG_POLISH, SUBLANG_DEFAULT @@ -34,10 +34,8 @@ CAPTION "Instalator ReactOS" FONT 8, "MS Shell Dlg" BEGIN LTEXT "Witamy w programie instalacyjnym ReactOS.", IDC_WELCOMETITLE, 115, 8, 195, 24 - LTEXT "Ten program pomoe w instalacji systemu ReactOS. W tym celu "\ - "konieczne bdzie zebranie informacji o twoim komputerze, by "\ - "prawidowo skonfigurowa system operacyjny.", IDC_STATIC, 115, 40, 168, 100 - LTEXT "Nacinij Dalej, by kontynuowa.", IDC_STATIC, 115, 169, 195, 17 + LTEXT "Ten program pomoże w instalacji systemu ReactOS. W tym celu konieczne będzie zebranie informacji o twoim komputerze, by prawidłowo skonfigurować system operacyjny.", IDC_STATIC, 115, 40, 168, 100 + LTEXT "Naciśnij Dalej, by kontynuować.", IDC_STATIC, 115, 169, 195, 17 END @@ -46,16 +44,14 @@ STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYS CAPTION "Instalator ReactOS" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT "Twrcy ReactOS chcieliby podzikowa nastpujcym projektom Open Source, "\ - "ktrych to fragmenty zostay wykorzystane do stworzenia ReactOS:", + LTEXT "Twórcy ReactOS chcieliby podziękować następującym projektom Open Source, których to fragmenty zostały wykorzystane do stworzenia ReactOS:", IDC_STATIC,15,7,286,19 LISTBOX IDC_PROJECTS,15,30,286,75,LBS_NOSEL | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL - LTEXT "ReactOS oparty jest na licencji GPL, wic by w caoci lub czciowo wykorzysta rda "\ - "ReactOS, musisz przestrzega postanowie licencji.", + LTEXT "ReactOS oparty jest na licencji GPL, więc by w całości lub częściowo wykorzystać źródła ReactOS, musisz przestrzegać postanowień licencji.", IDC_STATIC,15,110,247,19 - PUSHBUTTON "Poka &GPL..",IDC_VIEWGPL,251,110,50,19 - LTEXT "Nacinij Dalej, by kontynuowa.",IDC_STATIC,15,136, + PUSHBUTTON "Pokaż &GPL..",IDC_VIEWGPL,251,110,50,19 + LTEXT "Naciśnij Dalej, by kontynuować.",IDC_STATIC,15,136, 195,17 END @@ -66,7 +62,7 @@ CAPTION "Instalator ReactOS" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_ICON2, IDC_STATIC, 21, 7, 20, 20 - LTEXT "Podaj swoje imi i nazwisko, a take nazw Twojej firmy lub organizacji.", + LTEXT "Podaj swoje imię i nazwisko, a także nazwę Twojej firmy lub organizacji.", IDC_STATIC, 54, 7, 242, 21 LTEXT "Na&zwa:", IDC_STATIC, 54, 37, 44, 8 EDITTEXT IDC_OWNERNAME, 132, 35, 163, 14, WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL @@ -81,20 +77,18 @@ CAPTION "Instalator ReactOS" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_ICON1, IDC_STATIC, 21, 7, 20, 20 - LTEXT "Podaj nazw komputera, nie dusz ni 15 znakw. "\ - "Jeli chcesz pracowa w sieci, nazwa musi pozosta unikalna.", + LTEXT "Podaj nazwę komputera, nie dłuższą niż 15 znaków. Jeśli chcesz pracować w sieci, nazwa musi pozostać unikalna.", IDC_STATIC, 54, 7, 250, 24 LTEXT "&Nazwa komputera:", IDC_STATIC, 54, 38, 75, 8 EDITTEXT IDC_COMPUTERNAME, 132, 35, 163, 14, WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL | ES_UPPERCASE ICON IDI_ICON5, IDC_STATIC, 21, 57, 20, 20 - LTEXT "Program konfiguracyjny stworzy konto Administrator. "\ - "Dziki niemu uzyskasz, w razie potrzeby, peen dostp do systemu.", + LTEXT "Program konfiguracyjny stworzy konto Administrator. Dzięki niemu uzyskasz, w razie potrzeby, pełny dostęp do systemu.", IDC_STATIC, 54, 57, 250, 25 - LTEXT "Podaj haso administratora, nie dusze ni 14 znakw.", + LTEXT "Podaj hasło administratora, nie dłuższe niż 14 znaków.", IDC_STATIC, 54, 87, 250, 8 - LTEXT "&Haso administratora:", IDC_STATIC, 54, 104, 75, 8 + LTEXT "&Hasło administratora:", IDC_STATIC, 54, 104, 75, 8 EDITTEXT IDC_ADMINPASSWORD1, 132, 101, 172, 14, WS_VISIBLE | WS_TABSTOP | ES_PASSWORD - LTEXT "&Potwierdzenie hasa:", IDC_STATIC, 54, 123, 75, 8 + LTEXT "&Potwierdzenie hasła:", IDC_STATIC, 54, 123, 75, 8 EDITTEXT IDC_ADMINPASSWORD2, 132, 120, 172, 14, WS_VISIBLE | WS_TABSTOP | ES_PASSWORD END @@ -105,17 +99,15 @@ CAPTION "Instalator ReactOS" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_ICON4, IDC_STATIC, 21, 7, 20, 20 - LTEXT "Lokalizacja systemu powinna by zgodna (jzykowo) z aplikacjami, "\ - "ktrych planujesz uywa. Lokalizacja odpowiada rwnie za wywietlanie "\ - "danych, liczb i walut.", IDC_STATIC, 53, 7, 238, 25 + LTEXT "Lokalizacja systemu powinna być zgodna (językowo) z aplikacjami, których planujesz używać. Lokalizacja odpowiada również za wyświetlanie danych, liczb i walut.", IDC_STATIC, 53, 7, 238, 25 LTEXT "", IDC_LOCALETEXT, 53, 29, 250, 16 - LTEXT "By zmieni lokalizacj systemu, nacinij Ustaw.", + LTEXT "By zmienić lokalizację systemu, naciśnij Ustaw.", IDC_STATIC, 53, 60, 184, 8 PUSHBUTTON "&Ustaw...", IDC_CUSTOMLOCALE, 245, 57, 50, 14 - LTEXT "Ukad klawiatury decyduje o przyporzdkowaniu znakw pod klawisze.", + LTEXT "Układ klawiatury decyduje o przyporządkowaniu znaków pod klawisze.", IDC_STATIC, 53, 86, 253, 8 LTEXT "", IDC_LAYOUTTEXT, 53, 100, 250, 16 - LTEXT "Aby zmieni ukad klawiatury, nacinij Ustaw.", + LTEXT "Aby zmienić układ klawiatury, naciśnij Ustaw.", IDC_STATIC, 53, 126, 184, 8 PUSHBUTTON "U&staw...", IDC_CUSTOMLAYOUT, 245, 122, 50, 14 END @@ -154,15 +146,13 @@ END IDD_FINISHPAGE DIALOGEX DISCARDABLE 0, 0, 317, 193 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION "Zakoczenie instalacji ReactOS" +CAPTION "Zakończenie instalacji ReactOS" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Konfiguracja ReactOS ukoczona.", IDC_FINISHTITLE, 115, 8, 195, 24 - LTEXT "To ju koniec ustawie ReactOS.\n\n" \ - "Teraz nacinij Koniec, by ponownie uruchomi komputer.", IDC_STATIC, 115, 40, 195, 100 + LTEXT "Konfiguracja ReactOS ukończona.", IDC_FINISHTITLE, 115, 8, 195, 24 + LTEXT "To już koniec ustawień ReactOS.\n\nTeraz naciśnij Koniec, by ponownie uruchomić komputer.", IDC_STATIC, 115, 40, 195, 100 CONTROL "", IDC_RESTART_PROGRESS, "msctls_progress32", PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 115, 138, 188, 12 - LTEXT "Upewnij si, czy w napdach CD/DVD nie pozosta aden nonik. "\ - "Jeli tak, to wyjmij go przed naciniciem przycisku Koniec.", IDC_STATIC, 115, 169, 195, 17 + LTEXT "Upewnij się, czy w napędach CD/DVD nie pozostał żaden nośnik. Jeśli tak, to wyjmij go przed naciśnięciem przycisku Koniec.", IDC_STATIC, 115, 169, 195, 17 END @@ -179,7 +169,7 @@ END IDD_STATUSWINDOW_DLG DIALOGEX 0,0,274,26 STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP -CAPTION "Prosz czeka..." +CAPTION "Proszę czekać..." FONT 8,"MS Shell Dlg 2",400,0,1 BEGIN LTEXT "",IDC_STATUSLABEL,7,8,234,12,SS_WORDELLIPSIS @@ -188,47 +178,47 @@ END STRINGTABLE BEGIN - IDS_ACKTITLE "Podzikowania" - IDS_ACKSUBTITLE "Wszyscy, bez ktrych nie byoby ReactOS, a take informacje o Licencji " + IDS_ACKTITLE "Podziękowania" + IDS_ACKSUBTITLE "Wszyscy, bez których nie byłoby ReactOS, a także informacje o Licencji " IDS_OWNERTITLE "Personalizacja systemu" - IDS_OWNERSUBTITLE "Program konfiguracyjny wykorzysta te informacje, aby spersonalizowa system." - IDS_COMPUTERTITLE "Nazwa komputera i haso administratora" - IDS_COMPUTERSUBTITLE "Musisz poda nazw swojego komputera a take haso administratora." + IDS_OWNERSUBTITLE "Program konfiguracyjny wykorzysta te informacje, aby spersonalizować system." + IDS_COMPUTERTITLE "Nazwa komputera i hasło administratora" + IDS_COMPUTERSUBTITLE "Musisz podać nazwę swojego komputera a także hasło administratora." IDS_LOCALETITLE "Ustawienia regionalne" - IDS_LOCALESUBTITLE "Moesz ustawi ReactOS pod ktem jzyka i sposobu wywietlania danych." + IDS_LOCALESUBTITLE "Możesz ustawić ReactOS pod kątem języka i sposobu wyświetlania danych." IDS_DATETIMETITLE "Data i czas" - IDS_DATETIMESUBTITLE "Ustaw prawidow dat i czas." - IDS_PROCESSTITLE "Rejestracja skadnikw" - IDS_PROCESSSUBTITLE "Prosz czeka..." + IDS_DATETIMESUBTITLE "Ustaw prawidłową datę i czas." + IDS_PROCESSTITLE "Rejestracja składników" + IDS_PROCESSSUBTITLE "Proszę czekać..." END STRINGTABLE BEGIN - IDS_CMT_DOWNLOADER "cignij i zainstaluj inne aplikacje" + IDS_CMT_DOWNLOADER "Ściągnij i zainstaluj inne aplikacje" END STRINGTABLE BEGIN IDS_ACCESSORIES "Akcesoria" IDS_CMT_CALC "Uruchom Kalkulator" - IDS_CMT_CMD "Uruchom konsol" + IDS_CMT_CMD "Uruchom konsolę" IDS_CMT_EXPLORER "Uruchom Eksplorator" IDS_CMT_NOTEPAD "Uruchom Edytor tekstu" IDS_CMT_REGEDIT "Uruchom Edytor rejestru" IDS_CMT_WORDPAD "Uruchom WordPada" IDS_CMT_SCREENSHOT "Zrzut ekranu" - IDS_CMT_DEVMGMT "Uruchom Meneder urzdze" - IDS_CMT_SERVMAN "Uruchom Meneder usug" + IDS_CMT_DEVMGMT "Uruchom Menedżer urządzeń" + IDS_CMT_SERVMAN "Uruchom Menedżer usług" IDS_CMT_RDESKTOP "Uruchom Zdalny pulpit" - IDS_CMT_EVENTVIEW "Uruchom Podgld Zdarze" - IDS_CMT_MSCONFIG "Uruchom Narzdzie konfiguracji systemu" + IDS_CMT_EVENTVIEW "Uruchom Podgląd Zdarzeń" + IDS_CMT_MSCONFIG "Uruchom Narzędzie konfiguracji systemu" IDS_CMT_PAINT "Uruchom Paint" END STRINGTABLE BEGIN - IDS_SYS_ACCESSIBILITY "Uatwienia Dostpu" + IDS_SYS_ACCESSIBILITY "Ułatwienia Dostępu" IDS_CMT_MAGNIFY "Lupa" END @@ -236,15 +226,15 @@ STRINGTABLE BEGIN IDS_SYS_ENTERTAINMENT "Rozrywka" IDS_CMT_MPLAY32 "Uruchom Odtwarzacz multimedialny" - IDS_CMT_SNDVOL32 "Uruchom regulacj gonoci" + IDS_CMT_SNDVOL32 "Uruchom regulację głośności" IDS_CMT_SNDREC32 "Launch Sound Recorder" END STRINGTABLE BEGIN - IDS_SYS_TOOLS "Narzdzia systemowe" - IDS_CMT_CHARMAP "Tablica znakw" - IDS_CMT_KBSWITCH "Zmiana ukadu klawiatury" + IDS_SYS_TOOLS "Narzędzia systemowe" + IDS_CMT_CHARMAP "Tablica znaków" + IDS_CMT_KBSWITCH "Zmiana układu klawiatury" IDS_CMT_DXDIAG "Uruchom program diagnostyczny ReactX" END @@ -259,23 +249,23 @@ END STRINGTABLE BEGIN IDS_REACTOS_SETUP "Ustawienia ReactOS" - IDS_UNKNOWN_ERROR "Nieznany bd" - IDS_REGISTERING_COMPONENTS "Rejestracja skadnikw..." + IDS_UNKNOWN_ERROR "Nieznany błąd" + IDS_REGISTERING_COMPONENTS "Rejestracja składników..." IDS_LOADLIBRARY_FAILED "Nieudane LoadLibrary : " IDS_GETPROCADDR_FAILED "Nieudane GetProcAddr : " IDS_REGSVR_FAILED "Nieudane DllRegisterServer: " IDS_DLLINSTALL_FAILED "Nieudane DllInstall: " - IDS_TIMEOUT "Upyn czas rejestracji" + IDS_TIMEOUT "Upłynął czas rejestracji" IDS_REASON_UNKNOWN "" END STRINGTABLE BEGIN - IDS_SHORT_CMD "Wiersz polece.lnk" + IDS_SHORT_CMD "Wiersz poleceń.lnk" IDS_SHORT_EXPLORER "Eksplorator ReactOS.lnk" - IDS_SHORT_DOWNLOADER "Meneder aplikacji ReactOS.lnk" - IDS_SHORT_SERVICE "Meneder usug.lnk" - IDS_SHORT_DEVICE "Meneder urzdze.lnk" + IDS_SHORT_DOWNLOADER "Menedżer aplikacji ReactOS.lnk" + IDS_SHORT_SERVICE "Menedżer usług.lnk" + IDS_SHORT_DEVICE "Menedżer urządzeń.lnk" IDS_SHORT_MPLAY32 "Odtwarzacz multimedialny.lnk" IDS_SHORT_CALC "Kalkulator.lnk" IDS_SHORT_REGEDIT "Edytor rejestru.lnk" @@ -285,31 +275,31 @@ BEGIN IDS_SHORT_SOLITAIRE "Pasjans.lnk" IDS_SHORT_WINEMINE "Saper.lnk" IDS_SHORT_MAGNIFY "Lupa.lnk" - IDS_SHORT_RDESKTOP "Dostp zdalny.lnk" - IDS_SHORT_KBSWITCH "Zmiana ukadu klawiatury.lnk" - IDS_SHORT_EVENTVIEW "Podgld zdarze.lnk" + IDS_SHORT_RDESKTOP "Dostęp zdalny.lnk" + IDS_SHORT_KBSWITCH "Zmiana układu klawiatury.lnk" + IDS_SHORT_EVENTVIEW "Podgląd zdarzeń.lnk" IDS_SHORT_MSCONFIG "Konfiguracja systemowa.lnk" - IDS_SHORT_SNDVOL32 "Regulacja gonoci.lnk" - IDS_SHORT_SNDREC32 "Audiorecorder.lnk" + IDS_SHORT_SNDVOL32 "Regulacja głośności.lnk" + IDS_SHORT_SNDREC32 "Rejestrator dźwięku.lnk" IDS_SHORT_DXDIAG "Program diagnostyczny ReactX.lnk" - IDS_SHORT_PAINT "Paint.lnk" + IDS_SHORT_PAINT "MSPaint.lnk" IDS_SHORT_SPIDER "Spider Solitaire.lnk" END STRINGTABLE BEGIN - IDS_WZD_NAME "Program instalacyjny nie moe kontynuowa dopki nie wpiszesz swojego imienia i nazwiska." - IDS_WZD_SETCOMPUTERNAME "Program instalacyjny nie zdoa ustawi nowej nazwy komputera." - IDS_WZD_COMPUTERNAME "Program instalacyjny nie moe kontynuowa dopki nie wpiszesz nazwy komputera." - IDS_WZD_PASSWORDEMPTY "Musisz wprowadzi haso!" - IDS_WZD_PASSWORDMATCH "Oba wprowadzone hasa nie s identyczne. Musisz wpisa to samo haso dwa razy." - IDS_WZD_PASSWORDCHAR "Wprowadzone haso zawiera nieodpowiednie znaki. Prosz wprowadzi haso bez ich udziau." - IDS_WZD_LOCALTIME "Program instalacyjny nie zdoa ustawi czasu lokalnego." + IDS_WZD_NAME "Program instalacyjny nie może kontynuować dopóki nie wpiszesz swojego imienia i nazwiska." + IDS_WZD_SETCOMPUTERNAME "Program instalacyjny nie zdołał ustawić nowej nazwy komputera." + IDS_WZD_COMPUTERNAME "Program instalacyjny nie może kontynuować dopóki nie wpiszesz nazwy komputera." + IDS_WZD_PASSWORDEMPTY "Musisz wprowadzić hasło!" + IDS_WZD_PASSWORDMATCH "Oba wprowadzone hasła nie są identyczne. Musisz wpisać to samo hasło dwa razy." + IDS_WZD_PASSWORDCHAR "Wprowadzone hasło zawiera nieodpowiednie znaki. Proszę wprowadzić hasło bez ich udziału." + IDS_WZD_LOCALTIME "Program instalacyjny nie zdołał ustawić czasu lokalnego." END STRINGTABLE BEGIN - IDS_STATUS_INSTALL_DEV "Instalacja urzdze..." + IDS_STATUS_INSTALL_DEV "Instalacja urządzeń..." END /* EOF */ diff --git a/dll/win32/syssetup/lang/pt-BR.rc b/dll/win32/syssetup/lang/pt-BR.rc index c8ca8e9d3b1..29f9a679339 100644 --- a/dll/win32/syssetup/lang/pt-BR.rc +++ b/dll/win32/syssetup/lang/pt-BR.rc @@ -24,9 +24,7 @@ CAPTION "Instala FONT 8, "MS Shell Dlg" BEGIN LTEXT "Bem-vindo ao assistente de instalao do ReactOS.", IDC_WELCOMETITLE, 115, 8, 195, 24 - LTEXT "Este assistente instala o ReactOS no seu computador. Ele "\ - "precisa reunir algumas informaes sobre voc e seu computador "\ - "para instalar o ReactOS devidamente.", IDC_STATIC, 115, 40, 195, 100 + LTEXT "Este assistente instala o ReactOS no seu computador. Ele precisa reunir algumas informaes sobre voc e seu computador para instalar o ReactOS devidamente.", IDC_STATIC, 115, 40, 195, 100 LTEXT "Clique Avanar para continuar a instalao.", IDC_STATIC, 115, 169, 195, 17 END @@ -36,13 +34,11 @@ STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYS CAPTION "Instalao do ReactOS" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT "Os desenvolvedores do ReactOS gostariam de agradecer aos seguintes projetos Open Source, "\ - "cujo partes foram utilizadas para criar o ReactOS:", + LTEXT "Os desenvolvedores do ReactOS gostariam de agradecer aos seguintes projetos Open Source, cujo partes foram utilizadas para criar o ReactOS:", IDC_STATIC,15,7,286,19 LISTBOX IDC_PROJECTS,15,30,286,75,LBS_NOSEL | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL - LTEXT "ReactOS est licenciado sob a GPL, se voc deseja reutilizar ou redistribuir "\ - "(partes) (d)ele voc deve respeitar a GPL", + LTEXT "ReactOS est licenciado sob a GPL, se voc deseja reutilizar ou redistribuir (partes) (d)ele voc deve respeitar a GPL", IDC_STATIC,15,110,227,19 PUSHBUTTON "&Visualizar GPL...",IDC_VIEWGPL,251,110,50,19 LTEXT "Clique Avanar para continuar com a instalao.",IDC_STATIC,15,136, @@ -71,14 +67,12 @@ CAPTION "Instala FONT 8, "MS Shell Dlg" BEGIN ICON IDI_ICON1, IDC_STATIC, 21, 7, 20, 20 - LTEXT "Digite um nome para o seu computador com 15 caracteres ou menos. "\ - "Se voc est em uma rede, o nome do computador deve ser exclusivo.", + LTEXT "Digite um nome para o seu computador com 15 caracteres ou menos. Se voc est em uma rede, o nome do computador deve ser exclusivo.", IDC_STATIC, 54, 7, 250, 24 LTEXT "Nome do &Computador:", IDC_STATIC, 54, 38, 75, 8 EDITTEXT IDC_COMPUTERNAME, 165, 35, 148, 14, WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL | ES_UPPERCASE ICON IDI_ICON5, IDC_STATIC, 21, 57, 20, 20 - LTEXT "A instalao vai criar uma conta no seu computador chamada Administrator. "\ - "Voc pode usar esta conta se precisar de acesso total ao seu computador.", + LTEXT "A instalao vai criar uma conta no seu computador chamada Administrator. Voc pode usar esta conta se precisar de acesso total ao seu computador.", IDC_STATIC, 54, 57, 250, 25 LTEXT "Digite uma senha para o administrador com 14 caracteres ou menos.", IDC_STATIC, 54, 87, 250, 8 @@ -95,9 +89,7 @@ CAPTION "Instala FONT 8, "MS Shell Dlg" BEGIN ICON IDI_ICON4, IDC_STATIC, 21, 7, 20, 20 - LTEXT "A localidade do sistema deve coincidir com o idioma das aplicaes "\ - "que voc quer utilizar. A localidade de usurio controla como nmeros, "\ - "moeda e datas aparecem.", IDC_STATIC, 53, 7, 253, 20 + LTEXT "A localidade do sistema deve coincidir com o idioma das aplicaes que voc quer utilizar. A localidade de usurio controla como nmeros, moeda e datas aparecem.", IDC_STATIC, 53, 7, 253, 20 LTEXT "", IDC_LOCALETEXT, 53, 29, 250, 16 LTEXT "Para alterar a localidade de sistema ou usurio, clique Personalizar.", IDC_STATIC, 53, 60, 196, 8 @@ -148,11 +140,9 @@ CAPTION "Finalizando a instala FONT 8, "MS Shell Dlg" BEGIN LTEXT "Finalizando o Assistente de Instalao do ReactOS", IDC_FINISHTITLE, 115, 8, 195, 24 - LTEXT "Voc completou a instalao do ReactOS com sucesso.\n\n" \ - "Quando voc clicar em Finalizar, o computador ser reiniciado.", IDC_STATIC, 115, 40, 195, 100 + LTEXT "Voc completou a instalao do ReactOS com sucesso.\n\nQuando voc clicar em Finalizar, o computador ser reiniciado.", IDC_STATIC, 115, 40, 195, 100 CONTROL "", IDC_RESTART_PROGRESS, "msctls_progress32", PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 115, 138, 188, 12 - LTEXT "Se houver um cd em algum drive, remova-o. Depois, para "\ - "reiniciar seu computador, clique Finalizar.", IDC_STATIC, 115, 169, 195, 17 + LTEXT "Se houver um cd em algum drive, remova-o. Depois, para reiniciar seu computador, clique Finalizar.", IDC_STATIC, 115, 169, 195, 17 END diff --git a/dll/win32/syssetup/lang/ro-RO.rc b/dll/win32/syssetup/lang/ro-RO.rc index 35ff476c2e1..553aefa57f9 100644 --- a/dll/win32/syssetup/lang/ro-RO.rc +++ b/dll/win32/syssetup/lang/ro-RO.rc @@ -19,17 +19,13 @@ LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL -#pragma code_page(65001) - IDD_WELCOMEPAGE DIALOGEX DISCARDABLE 0, 0, 317, 193 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "Instalare ReactOS" FONT 8, "MS Shell Dlg" BEGIN LTEXT "Bun venit la Expertul de instalare al ReactOS.", IDC_WELCOMETITLE, 115, 8, 195, 24 - LTEXT "Acest expert instalează ReactOS pe computerul dvs. Expertul "\ - "trebuie să adune niște informații despre computer"\ - "pentru a instala ReactOS corect.", IDC_STATIC, 115, 40, 195, 100 + LTEXT "Acest expert instalează ReactOS pe computerul dvs. Expertul trebuie să adune niște informații despre computerpentru a instala ReactOS corect.", IDC_STATIC, 115, 40, 195, 100 LTEXT "Clic pe Următor pentru a continua.", IDC_STATIC, 115, 169, 195, 17 END @@ -39,13 +35,11 @@ STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYS CAPTION "Instalare ReactOS" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT "Dezvoltatorii ReactOS le sunt recunoscători următoarelor proiecte de software liber "\ - "care au fost utilizate la crearea ReactOS:", + LTEXT "Dezvoltatorii ReactOS le sunt recunoscători următoarelor proiecte de software liber care au fost utilizate la crearea ReactOS:", IDC_STATIC,15,7,286,19 LISTBOX IDC_PROJECTS,15,30,286,75,LBS_NOSEL | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL - LTEXT "ReactOS este sub licența GPL, astfel dacă vreți să îl redistribuiți "\ - "trebuie să respectați licența GPL.", + LTEXT "ReactOS este sub licența GPL, astfel dacă vreți să îl redistribuiți trebuie să respectați licența GPL.", IDC_STATIC,15,110,227,19 PUSHBUTTON "&Vizualizare GPL...",IDC_VIEWGPL,251,110,50,19 LTEXT "Clic pe Următor pentru a continua.",IDC_STATIC,15,136, @@ -74,14 +68,12 @@ CAPTION "Instalare ReactOS" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_ICON1, IDC_STATIC, 21, 7, 20, 20 - LTEXT "Scrieți un nume pentru computer de maxim 15 de caractere. "\ - "Dacă sunteți în rețea, numele computerului trebuie să fie unic.", + LTEXT "Scrieți un nume pentru computer de maxim 15 de caractere. Dacă sunteți în rețea, numele computerului trebuie să fie unic.", IDC_STATIC, 54, 7, 250, 24 LTEXT "&Nume:", IDC_STATIC, 54, 38, 75, 8 EDITTEXT IDC_COMPUTERNAME, 165, 35, 148, 14, WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL | ES_UPPERCASE ICON IDI_ICON5, IDC_STATIC, 21, 57, 20, 20 - LTEXT "Expertul va crea un cont de utilizator cu numele Administrator. "\ - "Îl puteți folosi când vreți control complet asupra computerului.", + LTEXT "Expertul va crea un cont de utilizator cu numele Administrator. Îl puteți folosi când vreți control complet asupra computerului.", IDC_STATIC, 54, 57, 250, 25 LTEXT "Scrieți o parolă pentru Administrator de maxim 14 caractere.", IDC_STATIC, 54, 87, 250, 8 @@ -98,9 +90,7 @@ CAPTION "Instalare ReactOS" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_ICON4, IDC_STATIC, 21, 7, 20, 20 - LTEXT "Setările regionale ar trebui să se potrivească cu limba"\ - "programelor. Acestea controlează cum apar numerele, "\ - "datele și valutele.", IDC_STATIC, 53, 7, 253, 20 + LTEXT "Setările regionale ar trebui să se potrivească cu limbaprogramelor. Acestea controlează cum apar numerele, datele și valutele.", IDC_STATIC, 53, 7, 253, 20 LTEXT "", IDC_LOCALETEXT, 53, 29, 250, 16 LTEXT "Pentru a aceste setări, clic pe Particularizare.", IDC_STATIC, 53, 60, 196, 8 @@ -151,11 +141,9 @@ CAPTION "Finalizare instalare ReactOS" FONT 8, "MS Shell Dlg" BEGIN LTEXT "Terminare Expert instalare ReactOS", IDC_FINISHTITLE, 115, 8, 195, 24 - LTEXT "Ați terminat cu succes instalarea ReactOS.\n\n" \ - "După ce veți apăsa Termină computerul va reporni.", IDC_STATIC, 115, 40, 195, 100 + LTEXT "Ați terminat cu succes instalarea ReactOS.\n\nDupă ce veți apăsa Termină computerul va reporni.", IDC_STATIC, 115, 40, 195, 100 CONTROL "", IDC_RESTART_PROGRESS, "msctls_progress32", PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 115, 138, 188, 12 - LTEXT "Dacă aveți un CD introdus în computer, scoateți-l. Pentru a "\ - "reporni computerul, clic pe Termină.", IDC_STATIC, 115, 169, 195, 17 + LTEXT "Dacă aveți un CD introdus în computer, scoateți-l. Pentru a reporni computerul, clic pe Termină.", IDC_STATIC, 115, 169, 195, 17 END @@ -304,6 +292,3 @@ STRINGTABLE BEGIN IDS_STATUS_INSTALL_DEV "Instalare dispozitive..." END - -#pragma code_page(default) -/* EOF */ diff --git a/dll/win32/syssetup/lang/ru-RU.rc b/dll/win32/syssetup/lang/ru-RU.rc index 769cfcb7885..087e35051db 100644 --- a/dll/win32/syssetup/lang/ru-RU.rc +++ b/dll/win32/syssetup/lang/ru-RU.rc @@ -5,117 +5,111 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT IDD_WELCOMEPAGE DIALOGEX DISCARDABLE 0, 0, 317, 193 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " ReactOS" +CAPTION "Установка ReactOS" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ReactOS.", IDC_WELCOMETITLE, 115, 8, 195, 24 - LTEXT " "\ - " ReactOS .", IDC_STATIC, 115, 40, 195, 100 - LTEXT " """" .", IDC_STATIC, 115, 169, 195, 17 + LTEXT "Добро пожаловать в мастер установки ReactOS.", IDC_WELCOMETITLE, 115, 8, 195, 24 + LTEXT "Этот мастер поможет ввести сведения для правильной установки ReactOS и установит ее на ваш компьютер.", IDC_STATIC, 115, 40, 195, 100 + LTEXT "Нажмите ""Далее"" для продолжения установки.", IDC_STATIC, 115, 169, 195, 17 END IDD_ACKPAGE DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " ReactOS" +CAPTION "Установка ReactOS" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT " ReactOS Open Source-, "\ - " ReactOS:", + LTEXT "Разработчики ReactOS и Open Source-проекты, благодаря которым была создана ReactOS:", IDC_STATIC,15,7,286,19 LISTBOX IDC_PROJECTS,15,30,286,75,LBS_NOSEL | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL - LTEXT "ReactOS GPL, "\ - " , GPL.", + LTEXT "ReactOS распространяется под лицензией GPL, если вы хотите использовать и распространять ее, вы должны соблюдать GPL.", IDC_STATIC,15,110,227,19 - PUSHBUTTON "&...",IDC_VIEWGPL,251,110,50,14 - LTEXT " """" .",IDC_STATIC,15,136, + PUSHBUTTON "&Лицензия...",IDC_VIEWGPL,251,110,50,14 + LTEXT "Нажмите ""Далее"" для продолжения установки.",IDC_STATIC,15,136, 195,17 END IDD_OWNERPAGE DIALOGEX DISCARDABLE 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " ReactOS" +CAPTION "Установка ReactOS" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_ICON2, IDC_STATIC, 21, 7, 20, 20 - LTEXT " .", + LTEXT "Введите ваше полное имя и название организации.", IDC_STATIC, 54, 7, 242, 21 - LTEXT "&:", IDC_STATIC, 54, 37, 44, 8 + LTEXT "&Имя:", IDC_STATIC, 54, 37, 44, 8 EDITTEXT IDC_OWNERNAME, 132, 35, 163, 14, WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL - LTEXT "&:", IDC_STATIC, 54, 57, 47, 8 + LTEXT "&Организация:", IDC_STATIC, 54, 57, 47, 8 EDITTEXT IDC_OWNERORGANIZATION, 132, 55, 163, 14, WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL END IDD_COMPUTERPAGE DIALOGEX DISCARDABLE 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " ReactOS" +CAPTION "Установка ReactOS" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_ICON1, IDC_STATIC, 21, 7, 20, 20 - LTEXT " ( 15 ). "\ - " , .", + LTEXT "Введите имя вашего компьютера (не более 15 символов). Если ваш компьютер подключен к сети, то его имя должно быть уникально.", IDC_STATIC, 54, 7, 250, 24 - LTEXT "& :", IDC_STATIC, 54, 38, 75, 8 + LTEXT "&Имя компьютера:", IDC_STATIC, 54, 38, 75, 8 EDITTEXT IDC_COMPUTERNAME, 165, 35, 148, 14, WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL | ES_UPPERCASE ICON IDI_ICON5, IDC_STATIC, 21, 57, 20, 20 - LTEXT " Administrator "\ - " , .", + LTEXT "При установке будет создан профиль пользователя с именем Administrator Вы можете использовать этот профиль, если вам нужно получить права администратора.", IDC_STATIC, 54, 57, 250, 25 - LTEXT " ( 14 ).", + LTEXT "Введите пароль администратора (не более 14 символов).", IDC_STATIC, 54, 87, 250, 8 - LTEXT "& :", IDC_STATIC, 54, 104, 96, 8 + LTEXT "&Пароль администратора:", IDC_STATIC, 54, 104, 96, 8 EDITTEXT IDC_ADMINPASSWORD1, 165, 101, 148, 14, WS_VISIBLE | WS_TABSTOP | ES_PASSWORD - LTEXT "& :", IDC_STATIC, 54, 123, 75, 8 + LTEXT "П&овторите пароль:", IDC_STATIC, 54, 123, 75, 8 EDITTEXT IDC_ADMINPASSWORD2, 165, 120, 148, 14, WS_VISIBLE | WS_TABSTOP | ES_PASSWORD END IDD_LOCALEPAGE DIALOGEX DISCARDABLE 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " ReactOS" +CAPTION "Установка ReactOS" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_ICON4, IDC_STATIC, 21, 7, 20, 20 - LTEXT " . "\ - " , .", IDC_STATIC, 53, 7, 253, 20 + LTEXT "Язык системы устанавливается и действует во всех приложениях. Можно выбрать систему исчисления, формат чисел и даты.", IDC_STATIC, 53, 7, 253, 20 LTEXT "", IDC_LOCALETEXT, 53, 29, 250, 16 - LTEXT " """".", + LTEXT "Для изменения языка системы нажмите ""Настроить"".", IDC_STATIC, 53, 60, 197, 8 - PUSHBUTTON "&...", IDC_CUSTOMLOCALE, 245, 57, 55, 14 - LTEXT " .", + PUSHBUTTON "&Настроить...", IDC_CUSTOMLOCALE, 245, 57, 55, 14 + LTEXT "Выбрав раскладку вы сможете вводить символы на вашем языке.", IDC_STATIC, 53, 86, 253, 8 LTEXT "", IDC_LAYOUTTEXT, 53, 100, 250, 16 - LTEXT " """".", + LTEXT "Для изменения раскладки нажмите ""Настроить"".", IDC_STATIC, 53, 126, 184, 8 - PUSHBUTTON "&...", IDC_CUSTOMLAYOUT, 245, 122, 55, 14 + PUSHBUTTON "Н&астроить...", IDC_CUSTOMLAYOUT, 245, 122, 55, 14 END IDD_DATETIMEPAGE DIALOGEX DISCARDABLE 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " ReactOS" +CAPTION "Установка ReactOS" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_ICON3, IDC_STATIC, 21, 10, 20, 20 - LTEXT " :", IDC_STATIC, 53, 7, 253, 8 + LTEXT "Дата и время:", IDC_STATIC, 53, 7, 253, 8 CONTROL "", IDC_DATEPICKER, "SysDateTimePick32", DTS_LONGDATEFORMAT | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 53, 17, 137, 14 CONTROL "", IDC_TIMEPICKER, "SysDateTimePick32", DTS_TIMEFORMAT | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 200, 17, 54, 14 - LTEXT " :", IDC_STATIC, 53, 42, 253, 8 + LTEXT "Часовой пояс:", IDC_STATIC, 53, 42, 253, 8 COMBOBOX IDC_TIMEZONELIST, 53, 52, 201, 93, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL - AUTOCHECKBOX "& .", + AUTOCHECKBOX "Ав&томатический переход на летнее время и обратно.", IDC_AUTODAYLIGHT, 53, 124, 201, 10 END IDD_PROCESSPAGE DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " ReactOS" +CAPTION "Установка ReactOS" FONT 8, "MS Shell Dlg" BEGIN LTEXT "", IDC_ACTIVITY, 53, 7, 253, 20 @@ -127,21 +121,19 @@ END IDD_FINISHPAGE DIALOGEX DISCARDABLE 0, 0, 317, 193 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " ReactOS" +CAPTION "Завершение установки ReactOS" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ReactOS", IDC_FINISHTITLE, 115, 8, 195, 24 - LTEXT " ReactOS.\n\n" \ - " """" .", IDC_STATIC, 115, 40, 195, 100 + LTEXT "Завершение мастера установки ReactOS", IDC_FINISHTITLE, 115, 8, 195, 24 + LTEXT "Вы успешно закончили установку ReactOS.\n\nНажмите ""Готово"" для перезагрузки вашего компьютера.", IDC_STATIC, 115, 40, 195, 100 CONTROL "", IDC_RESTART_PROGRESS, "msctls_progress32", PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 115, 138, 188, 12 - LTEXT " CD , . "\ - " """".", IDC_STATIC, 115, 169, 195, 17 + LTEXT "Если в CD находится в приводе, нужно извлечь его. Для перезагрузки компьютера нажмите ""Готово"".", IDC_STATIC, 115, 169, 195, 17 END IDD_GPL DIALOGEX 0, 0, 333, 230 STYLE DS_SHELLFONT | DS_CENTER | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " GNU" +CAPTION "Открытое лицензионное соглашение GNU" FONT 8, "MS Shell Dlg" BEGIN EDITTEXT IDC_GPL_TEXT,7,7,319,190,ES_MULTILINE | ES_AUTOHSCROLL | @@ -152,7 +144,7 @@ END IDD_STATUSWINDOW_DLG DIALOGEX 0,0,274,26 STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP -CAPTION " ..." +CAPTION "Пожалуйста подождите..." FONT 8,"MS Shell Dlg 2",400,0,1 BEGIN LTEXT "",IDC_STATUSLABEL,7,8,234,12,SS_WORDELLIPSIS @@ -161,129 +153,129 @@ END STRINGTABLE BEGIN - IDS_ACKTITLE " " - IDS_ACKSUBTITLE " ReactOS ." - IDS_OWNERTITLE " " - IDS_OWNERSUBTITLE " ReactOS." - IDS_COMPUTERTITLE " " - IDS_COMPUTERSUBTITLE " ." - IDS_LOCALETITLE " " - IDS_LOCALESUBTITLE " ReactOS ." - IDS_DATETIMETITLE " " - IDS_DATETIMESUBTITLE " ." - IDS_PROCESSTITLE " " - IDS_PROCESSSUBTITLE " ReactOS ." + IDS_ACKTITLE "Подтверждение лицензии" + IDS_ACKSUBTITLE "Информация о разработчиках ReactOS и лизензионное соглашение." + IDS_OWNERTITLE "Персональные данные" + IDS_OWNERSUBTITLE "Установка информации о пользователях ReactOS." + IDS_COMPUTERTITLE "Имя компьютера и пароль администратора" + IDS_COMPUTERSUBTITLE "Вы должны ввести имя и администраторский пароль для вашего компьютера." + IDS_LOCALETITLE "Региональные настройки" + IDS_LOCALESUBTITLE "Вы можете настраивать ReactOS для разных регионов и языков." + IDS_DATETIMETITLE "Дата и время" + IDS_DATETIMESUBTITLE "Установите правильную дату и время на вашем компьютере." + IDS_PROCESSTITLE "Процесс установки" + IDS_PROCESSSUBTITLE "Установка ReactOS на ваш компьютер." END STRINGTABLE BEGIN - IDS_CMT_DOWNLOADER " " + IDS_CMT_DOWNLOADER "Скачать и установить другие приложения" END STRINGTABLE BEGIN - IDS_ACCESSORIES "" - IDS_CMT_CALC " " - IDS_CMT_CMD " " - IDS_CMT_EXPLORER " " - IDS_CMT_NOTEPAD " " - IDS_CMT_REGEDIT " " - IDS_CMT_WORDPAD " " - IDS_CMT_SCREENSHOT " " - IDS_CMT_DEVMGMT " " - IDS_CMT_SERVMAN " " - IDS_CMT_RDESKTOP " " - IDS_CMT_EVENTVIEW " " - IDS_CMT_MSCONFIG " " - IDS_CMT_PAINT " Paint" + IDS_ACCESSORIES "Стандартные" + IDS_CMT_CALC "Запустить калькулятор" + IDS_CMT_CMD "Открыть командную строку" + IDS_CMT_EXPLORER "Запустить Проводник" + IDS_CMT_NOTEPAD "Запустить текстовый редактор" + IDS_CMT_REGEDIT "Запустить редактор реестра" + IDS_CMT_WORDPAD "Запустить редактор документов" + IDS_CMT_SCREENSHOT "Сделать снимок экрана" + IDS_CMT_DEVMGMT "Запустить диспетчер устройств" + IDS_CMT_SERVMAN "Запустить диспетчер служб" + IDS_CMT_RDESKTOP "Запустить удаленный рабочий стол" + IDS_CMT_EVENTVIEW "Запустить программу просмотра событий" + IDS_CMT_MSCONFIG "Запустить программу настройки системы" + IDS_CMT_PAINT "Запустить Paint" END STRINGTABLE BEGIN - IDS_GAMES "" - IDS_CMT_SOLITAIRE " " - IDS_CMT_WINEMINE "" - IDS_CMT_SPIDER " " + IDS_GAMES "Игры" + IDS_CMT_SOLITAIRE "Пасьянс Косынка" + IDS_CMT_WINEMINE "Сапер" + IDS_CMT_SPIDER "Пасьянс Паук" END STRINGTABLE BEGIN - IDS_SYS_TOOLS "" - IDS_CMT_CHARMAP " " - IDS_CMT_KBSWITCH " " - IDS_CMT_DXDIAG " ReactX" + IDS_SYS_TOOLS "Служебные" + IDS_CMT_CHARMAP "Таблица символов" + IDS_CMT_KBSWITCH "Переключатель раскладки клавиатуры" + IDS_CMT_DXDIAG "Запустить программу диагностики ReactX" END STRINGTABLE BEGIN - IDS_SYS_ACCESSIBILITY " " - IDS_CMT_MAGNIFY " " + IDS_SYS_ACCESSIBILITY "Специальные возможности" + IDS_CMT_MAGNIFY "Экранная лупа" END STRINGTABLE BEGIN - IDS_SYS_ENTERTAINMENT "" - IDS_CMT_MPLAY32 " " - IDS_CMT_SNDVOL32 " " + IDS_SYS_ENTERTAINMENT "Развлечения" + IDS_CMT_MPLAY32 "Запустить проигрыватель" + IDS_CMT_SNDVOL32 "Запустить регулятор громкости" IDS_CMT_SNDREC32 "Launch Sound Recorder" END STRINGTABLE BEGIN - IDS_REACTOS_SETUP " ReactOS" - IDS_UNKNOWN_ERROR " " - IDS_REGISTERING_COMPONENTS " ..." - IDS_LOADLIBRARY_FAILED " LoadLibrary: " - IDS_GETPROCADDR_FAILED " GetProcAddr: " - IDS_REGSVR_FAILED " DllRegisterServer: " - IDS_DLLINSTALL_FAILED " DllInstall: " - IDS_TIMEOUT " " + IDS_REACTOS_SETUP "Установка ReactOS" + IDS_UNKNOWN_ERROR "Неизвестная ошибка" + IDS_REGISTERING_COMPONENTS "Регистрация компонентов..." + IDS_LOADLIBRARY_FAILED "Ошибка LoadLibrary: " + IDS_GETPROCADDR_FAILED "Ошибка GetProcAddr: " + IDS_REGSVR_FAILED "Ошибка DllRegisterServer: " + IDS_DLLINSTALL_FAILED "Ошибка DllInstall: " + IDS_TIMEOUT "Таймаут в ходе регистрации" IDS_REASON_UNKNOWN "" END STRINGTABLE BEGIN - IDS_SHORT_CMD " .lnk" - IDS_SHORT_EXPLORER " ReactOS.lnk" - IDS_SHORT_DOWNLOADER " ReactOS.lnk" - IDS_SHORT_SERVICE " .lnk" - IDS_SHORT_DEVICE " .lnk" - IDS_SHORT_MPLAY32 ".lnk" - IDS_SHORT_CALC ".lnk" - IDS_SHORT_REGEDIT " .lnk" - IDS_SHORT_NOTEPAD ".lnk" + IDS_SHORT_CMD "Командная строка.lnk" + IDS_SHORT_EXPLORER "Проводник ReactOS.lnk" + IDS_SHORT_DOWNLOADER "Менеджер приложений ReactOS.lnk" + IDS_SHORT_SERVICE "Диспетчер служб.lnk" + IDS_SHORT_DEVICE "Диспетчер устройств.lnk" + IDS_SHORT_MPLAY32 "Проигрыватель.lnk" + IDS_SHORT_CALC "Калькулятор.lnk" + IDS_SHORT_REGEDIT "Редактор реестра.lnk" + IDS_SHORT_NOTEPAD "Блокнот.lnk" IDS_SHORT_WORDPAD "WordPad.lnk" IDS_SHORT_SNAP "SnapShot.lnk" - IDS_SHORT_SOLITAIRE " .lnk" - IDS_SHORT_WINEMINE ".lnk" - IDS_SHORT_CHARMAP " .lnk" - IDS_SHORT_MAGNIFY " .lnk" - IDS_SHORT_RDESKTOP " .lnk" - IDS_SHORT_KBSWITCH " .lnk" - IDS_SHORT_EVENTVIEW " .lnk" - IDS_SHORT_MSCONFIG " .lnk" - IDS_SHORT_SNDVOL32 ".lnk" + IDS_SHORT_SOLITAIRE "Пасьянс Косынка.lnk" + IDS_SHORT_WINEMINE "Сапер.lnk" + IDS_SHORT_CHARMAP "Таблица символов.lnk" + IDS_SHORT_MAGNIFY "Экранная лупа.lnk" + IDS_SHORT_RDESKTOP "Удаленный рабочий стол.lnk" + IDS_SHORT_KBSWITCH "Переключатель раскладки клавиатуры.lnk" + IDS_SHORT_EVENTVIEW "Просмотр событий.lnk" + IDS_SHORT_MSCONFIG "Параметры системы.lnk" + IDS_SHORT_SNDVOL32 "Громкость.lnk" IDS_SHORT_SNDREC32 "Audiorecorder.lnk" - IDS_SHORT_DXDIAG " ReactX.lnk" + IDS_SHORT_DXDIAG "Средство диагностики ReactX.lnk" IDS_SHORT_PAINT "Paint.lnk" - IDS_SHORT_SPIDER " .lnk" + IDS_SHORT_SPIDER "Пасьянс Паук.lnk" END STRINGTABLE BEGIN - IDS_WZD_NAME " ." - IDS_WZD_SETCOMPUTERNAME " ! ." - IDS_WZD_COMPUTERNAME " ." - IDS_WZD_PASSWORDEMPTY " !" - IDS_WZD_PASSWORDMATCH ", . ." - IDS_WZD_PASSWORDCHAR ", . ." - IDS_WZD_LOCALTIME " ." + IDS_WZD_NAME "Для продолжения установки нужно ввести ваше имя." + IDS_WZD_SETCOMPUTERNAME "Ошибка установки! Нужно ввести имя компьютера." + IDS_WZD_COMPUTERNAME "Для продолжения установки нужно ввести имя компьютера." + IDS_WZD_PASSWORDEMPTY "Вы должны ввести пароль!" + IDS_WZD_PASSWORDMATCH "Пароли, которые вы ввели не совпадают. Введите их снова." + IDS_WZD_PASSWORDCHAR "Пароли, которые вы ввели содержат запрещенные символы. Введите их снова." + IDS_WZD_LOCALTIME "Не удалось установить местное время." END STRINGTABLE BEGIN - IDS_STATUS_INSTALL_DEV " ..." + IDS_STATUS_INSTALL_DEV "Установка оборудования..." END /* EOF */ diff --git a/dll/win32/syssetup/lang/sk-SK.rc b/dll/win32/syssetup/lang/sk-SK.rc index 7804ec23e59..d8338d8e19c 100644 --- a/dll/win32/syssetup/lang/sk-SK.rc +++ b/dll/win32/syssetup/lang/sk-SK.rc @@ -12,9 +12,7 @@ CAPTION "In FONT 8, "MS Shell Dlg" BEGIN LTEXT "Vitajte v sprievodcovi intalcie systmu ReactOS.", IDC_WELCOMETITLE, 115, 9, 189, 31 - LTEXT "Tento sprievodca naintaluje systm ReactOS na V pota. Sprievodca "\ - "potrebuje zska niektor informcie o Vs a Vaom potai "\ - "aby mohol systm ReactOS sprvne nastavi.", IDC_STATIC, 115, 50, 189, 100 + LTEXT "Tento sprievodca naintaluje systm ReactOS na V pota. Sprievodca potrebuje zska niektor informcie o Vs a Vaom potai aby mohol systm ReactOS sprvne nastavi.", IDC_STATIC, 115, 50, 189, 100 LTEXT "Kliknutm na alej pokraujte v intalcii.", IDC_STATIC, 115, 160, 189, 31 END @@ -24,13 +22,11 @@ STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYS CAPTION "Intaltor systmu ReactOS" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT "Vvojri systmu ReactOS by sa chceli poakova nasledujcim Open Source projektom, "\ - "ktor (alebo asti ktorch) boli pouit pri vvoji systmu ReactOS:", + LTEXT "Vvojri systmu ReactOS by sa chceli poakova nasledujcim Open Source projektom, ktor (alebo asti ktorch) boli pouit pri vvoji systmu ReactOS:", IDC_STATIC,15,7,286,19 LISTBOX IDC_PROJECTS,15,30,286,75,LBS_NOSEL | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL - LTEXT "Systm ReactOS je vydan pod licenciou GPL. Pokia chcete systm (alebo jeho asti) poui "\ - "alebo redistribuova, muste repektova GPL", + LTEXT "Systm ReactOS je vydan pod licenciou GPL. Pokia chcete systm (alebo jeho asti) poui alebo redistribuova, muste repektova GPL", IDC_STATIC,15,110,228,22 PUSHBUTTON "&Zobrazi GPL...",IDC_VIEWGPL,245,110,56,19 LTEXT "Kliknutm na alej pokraujte v intalcii.",IDC_STATIC,15,136, @@ -59,14 +55,12 @@ CAPTION "In FONT 8, "MS Shell Dlg" BEGIN ICON IDI_ICON1, IDC_STATIC, 21, 7, 20, 20 - LTEXT "Napte nzov Vho potaa v dke 15 znakov alebo menej. "\ - "Ak je pota pripojen k sieti, mus b jeho nzov uniktny.", + LTEXT "Napte nzov Vho potaa v dke 15 znakov alebo menej. Ak je pota pripojen k sieti, mus b jeho nzov uniktny.", IDC_STATIC, 54, 7, 250, 24 LTEXT "&Nzov potaa:", IDC_STATIC, 54, 38, 75, 8 EDITTEXT IDC_COMPUTERNAME, 132, 35, 163, 14, WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL | ES_UPPERCASE ICON IDI_ICON5, IDC_STATIC, 21, 57, 20, 20 - LTEXT "Intaltor vytvor na potai pouvatesk et nazvan Administrator. "\ - "Tento et mete poui, ke budete potrebova pln prstup k Vmu potau.", + LTEXT "Intaltor vytvor na potai pouvatesk et nazvan Administrator. Tento et mete poui, ke budete potrebova pln prstup k Vmu potau.", IDC_STATIC, 54, 57, 250, 25 LTEXT "Zadajte heslo tu Administrator v dke 14 znakov alebo menej.", IDC_STATIC, 54, 87, 250, 8 @@ -83,9 +77,7 @@ CAPTION "In FONT 8, "MS Shell Dlg" BEGIN ICON IDI_ICON4, IDC_STATIC, 21, 7, 20, 20 - LTEXT "Lokalizcia systmu by mala shlasi s jazykom aplikci, "\ - "ktor chcete pouva. Lokalizcia ur ako bud zobrazen "\ - "sla, meny a daje kalendra.", IDC_STATIC, 53, 7, 253, 20 + LTEXT "Lokalizcia systmu by mala shlasi s jazykom aplikci, ktor chcete pouva. Lokalizcia ur ako bud zobrazen sla, meny a daje kalendra.", IDC_STATIC, 53, 7, 253, 20 LTEXT "", IDC_LOCALETEXT, 53, 29, 250, 16 LTEXT "Pre zmenu lokalizcie systmu kliknite na Zmeni.", IDC_STATIC, 53, 60, 184, 8 @@ -135,11 +127,9 @@ CAPTION "Dokon FONT 8, "MS Shell Dlg" BEGIN LTEXT "Dokonenie sprievodcu intalciou systmu ReactOS",IDC_FINISHTITLE,115,9,195,37 - LTEXT "Sprievodca intalciou systmu ReactOS bol spene dokonen.\n\n" \ - "Po kliknut na Dokoni sa pota retartuje.", IDC_STATIC, 115, 58, 195, 100 + LTEXT "Sprievodca intalciou systmu ReactOS bol spene dokonen.\n\nPo kliknut na Dokoni sa pota retartuje.", IDC_STATIC, 115, 58, 195, 100 CONTROL "", IDC_RESTART_PROGRESS, "msctls_progress32", PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 115, 138, 188, 12 - LTEXT "Ak je v mechanike intalan mdium, vyberte ho. Potom kliknutm na Dokoni "\ - "retartujte pota.", IDC_STATIC, 115, 160, 195, 31 + LTEXT "Ak je v mechanike intalan mdium, vyberte ho. Potom kliknutm na Dokoni retartujte pota.", IDC_STATIC, 115, 160, 195, 31 END diff --git a/dll/win32/syssetup/lang/uk-UA.rc b/dll/win32/syssetup/lang/uk-UA.rc index eda7715287f..9fe6a7a2668 100644 --- a/dll/win32/syssetup/lang/uk-UA.rc +++ b/dll/win32/syssetup/lang/uk-UA.rc @@ -11,119 +11,111 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT IDD_WELCOMEPAGE DIALOGEX DISCARDABLE 0, 0, 317, 193 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " ReactOS" +CAPTION "Встановлення ReactOS" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ReactOS.", IDC_WELCOMETITLE, 115, 8, 195, 24 - LTEXT " ReactOS '. "\ - " ' "\ - " ReactOS .", IDC_STATIC, 115, 40, 195, 100 - LTEXT " """", .", IDC_STATIC, 115, 169, 195, 17 + LTEXT "Ласкаво просимо до майстра встановлення ReactOS.", IDC_WELCOMETITLE, 115, 8, 195, 24 + LTEXT "Цей майстер встановлює ReactOS на Ваш комп'ютер. Йому потрібно зібрати деякі відомості про Вас і Ваш комп'ютер щоб установити ReactOS належним чином.", IDC_STATIC, 115, 40, 195, 100 + LTEXT "Натисніть ""Далі"", щоб продовжити встановлення.", IDC_STATIC, 115, 169, 195, 17 END IDD_ACKPAGE DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " ReactOS" +CAPTION "Встановлення ReactOS" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT " ReactOS Open Source , "\ - " () ReactOS:", + LTEXT "Розробники ReactOS хотіли б подякувати наступним Open Source проектам, що (частково) використовувалися при створенні ReactOS:", IDC_STATIC,15,7,286,19 LISTBOX IDC_PROJECTS,15,30,286,75,LBS_NOSEL | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL - LTEXT "ReactOS GPL, "\ - " (), GPL", + LTEXT "ReactOS ліцензується за GPL, так що якщо Ви хочете повторно використовувати або поширювати його (частини), Ви повинні поважати GPL", IDC_STATIC,15,110,227,24 - PUSHBUTTON "& GPL...",IDC_VIEWGPL,244,110,58,19 - LTEXT " """", .",IDC_STATIC,15,136, + PUSHBUTTON "&Перегляд GPL...",IDC_VIEWGPL,244,110,58,19 + LTEXT "Натисніть ""Далі"", щоб продовжити встановлення.",IDC_STATIC,15,136, 195,17 END IDD_OWNERPAGE DIALOGEX DISCARDABLE 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " ReactOS" +CAPTION "Встановлення ReactOS" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_ICON2, IDC_STATIC, 21, 7, 20, 20 - LTEXT " ' .", + LTEXT "Введіть своє повне ім'я і назву вашої компанії або організації.", IDC_STATIC, 54, 7, 242, 21 - LTEXT "&':", IDC_STATIC, 54, 37, 44, 8 + LTEXT "&Ім'я:", IDC_STATIC, 54, 37, 44, 8 EDITTEXT IDC_OWNERNAME, 132, 35, 163, 14, WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL - LTEXT "&:", IDC_STATIC, 54, 57, 44, 8 + LTEXT "&Організація:", IDC_STATIC, 54, 57, 44, 8 EDITTEXT IDC_OWNERORGANIZATION, 132, 55, 163, 14, WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL END IDD_COMPUTERPAGE DIALOGEX DISCARDABLE 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " ReactOS" +CAPTION "Встановлення ReactOS" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_ICON1, IDC_STATIC, 21, 7, 20, 20 - LTEXT " ' ' 15 . "\ - " , ' ' .", + LTEXT "Введіть ім'я Вашого комп'ютера довжиною до 15 символів. Якщо Ви працюєте в мережі, ім'я Вашого комп'ютера має бути унікальним.", IDC_STATIC, 54, 7, 250, 24 - LTEXT "&' ':", IDC_STATIC, 54, 38, 75, 8 + LTEXT "&Ім'я комп'ютера:", IDC_STATIC, 54, 38, 75, 8 EDITTEXT IDC_COMPUTERNAME, 132, 35, 163, 14, WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL | ES_UPPERCASE ICON IDI_ICON5, IDC_STATIC, 21, 57, 20, 20 - LTEXT " '', "\ - " '.", + LTEXT "Програма встановлення створить обліковий запис користувача 'Адміністратор', який дає повні права доступу до Вашого комп'ютера.", IDC_STATIC, 54, 57, 250, 25 - LTEXT " 14 .", + LTEXT "Введіть пароль адміністратора довжиною до 14 символів.", IDC_STATIC, 54, 87, 250, 8 - LTEXT "& :", IDC_STATIC, 54, 104, 75, 8 + LTEXT "&Пароль адміністратора:", IDC_STATIC, 54, 104, 75, 8 EDITTEXT IDC_ADMINPASSWORD1, 132, 101, 172, 14, WS_VISIBLE | WS_TABSTOP | ES_PASSWORD - LTEXT "ϳ&:", IDC_STATIC, 54, 123, 75, 8 + LTEXT "Пі&дтвердження:", IDC_STATIC, 54, 123, 75, 8 EDITTEXT IDC_ADMINPASSWORD2, 132, 120, 172, 14, WS_VISIBLE | WS_TABSTOP | ES_PASSWORD END IDD_LOCALEPAGE DIALOGEX DISCARDABLE 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " ReactOS" +CAPTION "Встановлення ReactOS" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_ICON4, IDC_STATIC, 21, 7, 20, 20 - LTEXT " , "\ - ". "\ - ", .", IDC_STATIC, 53, 5, 253, 27 + LTEXT "Мова системи має відповідати мові додатків, які ви хочете використовувати. Мова користувача задає формат виведення чисел, грошових одиниць і дат.", IDC_STATIC, 53, 5, 253, 27 LTEXT "", IDC_LOCALETEXT, 53, 29, 250, 16 - LTEXT " """".", + LTEXT "Для зміни мови системи або мови користувача натисніть ""Налаштувати"".", IDC_STATIC, 53, 60, 184, 16 - PUSHBUTTON "&...", IDC_CUSTOMLOCALE, 240, 57, 57, 14 - LTEXT " , .", + PUSHBUTTON "На&лаштувати...", IDC_CUSTOMLOCALE, 240, 57, 57, 14 + LTEXT "Розкладка клавіатури визначає символи, що вводяться при натисненні клавіш.", IDC_STATIC, 53, 84, 253, 18 LTEXT "", IDC_LAYOUTTEXT, 53, 100, 250, 16 - LTEXT " """".", + LTEXT "Для зміни розкладки клавіатури натисніть ""Налаштувати"".", IDC_STATIC, 53, 126, 184, 18 - PUSHBUTTON "&...", IDC_CUSTOMLAYOUT, 240, 122, 57, 14 + PUSHBUTTON "Нал&аштувати...", IDC_CUSTOMLAYOUT, 240, 122, 57, 14 END IDD_DATETIMEPAGE DIALOGEX DISCARDABLE 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " ReactOS" +CAPTION "Встановлення ReactOS" FONT 8, "MS Shell Dlg" BEGIN ICON IDI_ICON3, IDC_STATIC, 21, 10, 20, 20 - LTEXT " ", IDC_STATIC, 53, 7, 253, 8 + LTEXT "Дата й час", IDC_STATIC, 53, 7, 253, 8 CONTROL "", IDC_DATEPICKER, "SysDateTimePick32", DTS_LONGDATEFORMAT | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 53, 17, 137, 14 CONTROL "", IDC_TIMEPICKER, "SysDateTimePick32", DTS_TIMEFORMAT | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 200, 17, 54, 14 - LTEXT " ", IDC_STATIC, 53, 42, 253, 8 + LTEXT "Часовий пояс", IDC_STATIC, 53, 42, 253, 8 COMBOBOX IDC_TIMEZONELIST, 53, 52, 201, 93, CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL - AUTOCHECKBOX "& / ", + AUTOCHECKBOX "Автомати&чне переведення годинника на літний/зимовий час", IDC_AUTODAYLIGHT, 53, 124, 219, 10 END IDD_PROCESSPAGE DIALOGEX 0, 0, 317, 143 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " ReactOS" +CAPTION "Встановлення ReactOS" FONT 8, "MS Shell Dlg" BEGIN LTEXT "", IDC_ACTIVITY, 53, 7, 253, 20 @@ -135,15 +127,13 @@ END IDD_FINISHPAGE DIALOGEX DISCARDABLE 0, 0, 317, 193 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -CAPTION " ReactOS" +CAPTION "Завершення встановлення ReactOS" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ReactOS", IDC_FINISHTITLE, 115, 8, 195, 24 - LTEXT " ReactOS.\n\n" \ - "ϳ """" ' .", IDC_STATIC, 115, 40, 195, 100 + LTEXT "Завершення встановлення ReactOS", IDC_FINISHTITLE, 115, 8, 195, 24 + LTEXT "Ви успішно завершили встановлення ReactOS.\n\nПісля натиснення кнопки ""Завершити"" комп'ютер буде перезавантажений.", IDC_STATIC, 115, 40, 195, 100 CONTROL "", IDC_RESTART_PROGRESS, "msctls_progress32", PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 115, 138, 188, 12 - LTEXT " -, . "\ - " ' """".", IDC_STATIC, 115, 163, 195, 25 + LTEXT "Якщо в дисковод вставлений компакт-диск, вийміть його. Потім для перезавантаження Вашого комп'ютера натистніть ""Завершити"".", IDC_STATIC, 115, 163, 195, 25 END @@ -160,7 +150,7 @@ END IDD_STATUSWINDOW_DLG DIALOGEX 0,0,274,26 STYLE NOT WS_VISIBLE | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_POPUP -CAPTION "..." +CAPTION "Зачекайте..." FONT 8,"MS Shell Dlg 2",400,0,1 BEGIN LTEXT "",IDC_STATUSLABEL,7,8,234,12,SS_WORDELLIPSIS @@ -169,129 +159,129 @@ END STRINGTABLE BEGIN - IDS_ACKTITLE "" - IDS_ACKSUBTITLE " ReactOS " - IDS_OWNERTITLE " " - IDS_OWNERSUBTITLE "ֳ ReactOS." - IDS_COMPUTERTITLE "' ' " - IDS_COMPUTERSUBTITLE " ' '." - IDS_LOCALETITLE " " - IDS_LOCALESUBTITLE " ReactOS ." - IDS_DATETIMETITLE " " - IDS_DATETIMESUBTITLE " '." - IDS_PROCESSTITLE " " - IDS_PROCESSSUBTITLE ", ..." + IDS_ACKTITLE "Подяки" + IDS_ACKSUBTITLE "Інформація про розробників ReactOS і лізензійна угода" + IDS_OWNERTITLE "Налаштування ваших програм" + IDS_OWNERSUBTITLE "Ці особисті відомості будуть використані для налаштування ReactOS." + IDS_COMPUTERTITLE "Ім'я комп'ютера та пароль адміністратора" + IDS_COMPUTERSUBTITLE "Ви маєте вказати ім'я та пароль адміністратора Вашого комп'ютера." + IDS_LOCALETITLE "Мова і стандарти" + IDS_LOCALESUBTITLE "Ви можете налаштувати ReactOS для різних регіонів і мов." + IDS_DATETIMETITLE "Дата та час" + IDS_DATETIMESUBTITLE "Встановити правильні дату і час для Вашого комп'ютера." + IDS_PROCESSTITLE "Реєстрація компонентів" + IDS_PROCESSSUBTITLE "Зачекайте, будь ласка..." END STRINGTABLE BEGIN - IDS_CMT_DOWNLOADER " " + IDS_CMT_DOWNLOADER "Завантаження і встановлення різних додатків" END STRINGTABLE BEGIN - IDS_ACCESSORIES " " - IDS_CMT_CALC " " - IDS_CMT_CMD "³ " - IDS_CMT_DEVMGMT " " - IDS_CMT_EVENTVIEW " " - IDS_CMT_EXPLORER " " - IDS_CMT_MSCONFIG " " - IDS_CMT_NOTEPAD " " - IDS_CMT_RDESKTOP " ³ " - IDS_CMT_REGEDIT " " - IDS_CMT_SCREENSHOT " " - IDS_CMT_SERVMAN " " - IDS_CMT_WORDPAD " " - IDS_CMT_PAINT " Paint" + IDS_ACCESSORIES "Допоміжні програми" + IDS_CMT_CALC "Запустити Калькулятор" + IDS_CMT_CMD "Відкрити командний рядок" + IDS_CMT_DEVMGMT "Запустити Диспетчер пристроїв" + IDS_CMT_EVENTVIEW "Запустити Оглядач подій" + IDS_CMT_EXPLORER "Запустити Провідник" + IDS_CMT_MSCONFIG "Запустити Програму конфігурації системи" + IDS_CMT_NOTEPAD "Запустити Текстовий редактор" + IDS_CMT_RDESKTOP "Запустити Віддалене керування робочим столом" + IDS_CMT_REGEDIT "Запустити Редактор реєстру" + IDS_CMT_SCREENSHOT "Зробити знімок екрана" + IDS_CMT_SERVMAN "Запустити Диспетчер керування службами" + IDS_CMT_WORDPAD "Запустити Редактор документів" + IDS_CMT_PAINT "Запустити Графічний редактор Paint" END STRINGTABLE BEGIN - IDS_GAMES "" - IDS_CMT_SOLITAIRE "" - IDS_CMT_WINEMINE "" - IDS_CMT_SPIDER "' " + IDS_GAMES "Ігри" + IDS_CMT_SOLITAIRE "Косинка" + IDS_CMT_WINEMINE "Сапер" + IDS_CMT_SPIDER "Пас'янс Павук" END STRINGTABLE BEGIN - IDS_SYS_TOOLS "" - IDS_CMT_CHARMAP " " - IDS_CMT_DXDIAG " ReactX" - IDS_CMT_KBSWITCH " " + IDS_SYS_TOOLS "Службові" + IDS_CMT_CHARMAP "Таблиця символів" + IDS_CMT_DXDIAG "Запуск програми діагностики ReactX" + IDS_CMT_KBSWITCH "Перемикач розкладки клавіатури" END STRINGTABLE BEGIN - IDS_SYS_ACCESSIBILITY " " - IDS_CMT_MAGNIFY " " + IDS_SYS_ACCESSIBILITY "Спеціальні можливості" + IDS_CMT_MAGNIFY "Екранна лупа" END STRINGTABLE BEGIN - IDS_SYS_ENTERTAINMENT "" - IDS_CMT_MPLAY32 " " - IDS_CMT_SNDVOL32 " " - IDS_CMT_SNDREC32 " " + IDS_SYS_ENTERTAINMENT "Розваги" + IDS_CMT_MPLAY32 "Запуск мультимедійного плеєра" + IDS_CMT_SNDVOL32 "Запуск регулятора гучності" + IDS_CMT_SNDREC32 "Запуск записувача звуку" END STRINGTABLE BEGIN - IDS_REACTOS_SETUP " ReactOS" - IDS_UNKNOWN_ERROR " " - IDS_REGISTERING_COMPONENTS " ..." - IDS_LOADLIBRARY_FAILED " LoadLibrary: " - IDS_GETPROCADDR_FAILED " GetProcAddr: " - IDS_REGSVR_FAILED " DllRegisterServer: " - IDS_DLLINSTALL_FAILED " DllInstall: " - IDS_TIMEOUT " " + IDS_REACTOS_SETUP "Встановлення ReactOS" + IDS_UNKNOWN_ERROR "Невідома помилка" + IDS_REGISTERING_COMPONENTS "Реєстрація компонентів..." + IDS_LOADLIBRARY_FAILED "Помилка LoadLibrary: " + IDS_GETPROCADDR_FAILED "Помилка GetProcAddr: " + IDS_REGSVR_FAILED "Помилка DllRegisterServer: " + IDS_DLLINSTALL_FAILED "Помилка DllInstall: " + IDS_TIMEOUT "Таймаут під час реєстрації" IDS_REASON_UNKNOWN "" END STRINGTABLE BEGIN - IDS_SHORT_CALC ".lnk" - IDS_SHORT_CHARMAP " .lnk" - IDS_SHORT_CMD " .lnk" - IDS_SHORT_DEVICE " .lnk" - IDS_SHORT_DOWNLOADER " ReactOS.lnk" - IDS_SHORT_DXDIAG "ij ReactX.lnk" - IDS_SHORT_EVENTVIEW " .lnk" - IDS_SHORT_EXPLORER " ReactOS.lnk" - IDS_SHORT_KBSWITCH " .lnk" - IDS_SHORT_MAGNIFY " .lnk" - IDS_SHORT_MPLAY32 " .lnk" - IDS_SHORT_MSCONFIG " .lnk" - IDS_SHORT_NOTEPAD ".lnk" - IDS_SHORT_RDESKTOP "³ .lnk" - IDS_SHORT_REGEDIT " .lnk" - IDS_SHORT_SERVICE " .lnk" - IDS_SHORT_SNAP " .lnk" - IDS_SHORT_SNDVOL32 " .lnk" - IDS_SHORT_SNDREC32 " .lnk" - IDS_SHORT_SOLITAIRE ".lnk" + IDS_SHORT_CALC "Калькулятор.lnk" + IDS_SHORT_CHARMAP "Таблиця символів.lnk" + IDS_SHORT_CMD "Командний рядок.lnk" + IDS_SHORT_DEVICE "Диспетчер пристроїв.lnk" + IDS_SHORT_DOWNLOADER "Менеджер програм ReactOS.lnk" + IDS_SHORT_DXDIAG "Діагностика ReactX.lnk" + IDS_SHORT_EVENTVIEW "Оглядач подій.lnk" + IDS_SHORT_EXPLORER "Провідник ReactOS.lnk" + IDS_SHORT_KBSWITCH "Перемикач розкладки клавіатури.lnk" + IDS_SHORT_MAGNIFY "Екранна лупа.lnk" + IDS_SHORT_MPLAY32 "Мультимедійний плеєр.lnk" + IDS_SHORT_MSCONFIG "Конфігурація системи.lnk" + IDS_SHORT_NOTEPAD "Блокнот.lnk" + IDS_SHORT_RDESKTOP "Віддалене керування робочим столом.lnk" + IDS_SHORT_REGEDIT "Редактор реєстру.lnk" + IDS_SHORT_SERVICE "Диспетчер служб.lnk" + IDS_SHORT_SNAP "Знімок екрану.lnk" + IDS_SHORT_SNDVOL32 "Регулятор гучності.lnk" + IDS_SHORT_SNDREC32 "Записувач звуку.lnk" + IDS_SHORT_SOLITAIRE "Косинка.lnk" IDS_SHORT_WINEMINE "WineMine.lnk" IDS_SHORT_WORDPAD "WordPad.lnk" IDS_SHORT_PAINT "Paint.lnk" - IDS_SHORT_SPIDER "' .lnk" + IDS_SHORT_SPIDER "Пас'янс Павук.lnk" END STRINGTABLE BEGIN - IDS_WZD_NAME " '." - IDS_WZD_SETCOMPUTERNAME " ' '." - IDS_WZD_COMPUTERNAME " ' '." - IDS_WZD_PASSWORDEMPTY " !" - IDS_WZD_PASSWORDMATCH ", , . ." - IDS_WZD_PASSWORDCHAR ", , . ." - IDS_WZD_LOCALTIME " ." + IDS_WZD_NAME "Для продовження встановлення необхідно ввести ваше ім'я." + IDS_WZD_SETCOMPUTERNAME "Програмі інсталяції не вдалося встановити ім'я комп'ютера." + IDS_WZD_COMPUTERNAME "Для продовження встановлення необхідно ввести ім'я комп'ютера." + IDS_WZD_PASSWORDEMPTY "Ви маєте ввести пароль !" + IDS_WZD_PASSWORDMATCH "Паролі, які ви ввели, не співпадають. Будь ласка введіть потрібний пароль знову." + IDS_WZD_PASSWORDCHAR "Пароль, який ви ввели, містить заборонені символи. Будь ласка введіть інший пароль." + IDS_WZD_LOCALTIME "Програмі інсталяції не вдалося встановити місцевий час." END STRINGTABLE BEGIN - IDS_STATUS_INSTALL_DEV " ..." + IDS_STATUS_INSTALL_DEV "Встановлення пристроїв..." END /* EOF */ diff --git a/dll/win32/syssetup/lang/zh-CN.rc b/dll/win32/syssetup/lang/zh-CN.rc index 871238d0989..3a01d28ce65 100644 --- a/dll/win32/syssetup/lang/zh-CN.rc +++ b/dll/win32/syssetup/lang/zh-CN.rc @@ -17,9 +17,7 @@ CAPTION "ReactOS FONT 9, "MS Shell Dlg" BEGIN LTEXT "ӭʹReactOSװ򵼡", IDC_WELCOMETITLE, 115, 8, 195, 24 - LTEXT "װ򵼽ڼϰװ ReactOS \n"\ - "ҪѼйĺͼϢ\n"\ - "Աȷװ ReactOS", IDC_STATIC, 115, 40, 195, 100 + LTEXT "װ򵼽ڼϰװ ReactOS \nҪѼйĺͼϢ\nԱȷװ ReactOS", IDC_STATIC, 115, 40, 195, 100 LTEXT "Ҫ뵥һ.", IDC_STATIC, 115, 169, 195, 17 END @@ -29,13 +27,11 @@ STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYS CAPTION "ReactOS װ " FONT 9, "MS Shell Dlg", 0, 0, 0x0 BEGIN - LTEXT "ReactOS ĿԱµĿʾл"\ - "ڽ ReactOS ʱʹеĴ :", + LTEXT "ReactOS ĿԱµĿʾлڽ ReactOS ʱʹеĴ :", IDC_STATIC,15,7,286,19 LISTBOX IDC_PROJECTS,15,30,286,75,LBS_NOSEL | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL - LTEXT "ReactOS ǻGPLЭ鷢ģҪû· ReactOS "\ - "(򲿷)ѭGPLɡ", + LTEXT "ReactOS ǻGPLЭ鷢ģҪû· ReactOS (򲿷)ѭGPLɡ", IDC_STATIC,15,110,227,19 PUSHBUTTON "鿴GPL(&V)...",IDC_VIEWGPL,245,110,65,15 LTEXT "װ һ ",IDC_STATIC,15,136,195,17 @@ -62,14 +58,12 @@ CAPTION "ReactOS FONT 9, "MS Shell Dlg" BEGIN ICON IDI_ICON1, IDC_STATIC, 21, 7, 20, 20 - LTEXT "벻63ַļ"\ - "ÿһϵļһΨһơ", + LTEXT "벻63ַļÿһϵļһΨһơ", IDC_STATIC, 54, 7, 250, 24 LTEXT "(&C):", IDC_STATIC,54,38,75,8 EDITTEXT IDC_COMPUTERNAME, 132, 35, 163, 14, WS_VISIBLE | WS_TABSTOP | ES_AUTOHSCROLL | ES_UPPERCASE ICON IDI_ICON5, IDC_STATIC, 21, 57, 20, 20 - LTEXT "װᴴһΪ Administrator (ϵͳԱ)ûʻ"\ - "ҪȫƼʱʹʻ", + LTEXT "װᴴһΪ Administrator (ϵͳԱ)ûʻҪȫƼʱʹʻ", IDC_STATIC, 54, 57, 250, 25 LTEXT "벻14ַϵͳԱ롣", IDC_STATIC, 54, 87, 250, 8 @@ -86,8 +80,7 @@ CAPTION "ReactOS FONT 9, "MS Shell Dlg" BEGIN ICON IDI_ICON4, IDC_STATIC, 21, 7, 20, 20 - LTEXT "ϵͳӦʹõԣ"\ - "ûֵңڵʾʽ ", IDC_STATIC, 53, 7, 253, 20 + LTEXT "ϵͳӦʹõԣûֵңڵʾʽ ", IDC_STATIC, 53, 7, 253, 20 LTEXT "", IDC_LOCALETEXT, 53, 29, 250, 16 LTEXT "Ҫϵͳûã뵥 Զ塱 ", IDC_STATIC, 53, 60, 184, 8 @@ -138,11 +131,9 @@ CAPTION "ReactOS FONT 9, "MS Shell Dlg" BEGIN LTEXT " ReactOS װ", IDC_FINISHTITLE,115,8,195,24 - LTEXT "ReactOS װ˳ɡ\n\n"\ - "Ҫ뵥ɡ", IDC_STATIC, 115, 40, 195, 100 + LTEXT "ReactOS װ˳ɡ\n\nҪ뵥ɡ", IDC_STATIC, 115, 40, 195, 100 CONTROL "", IDC_RESTART_PROGRESS, "msctls_progress32", PBS_SMOOTH | WS_CHILD | WS_VISIBLE | WS_BORDER, 115, 138, 188, 12 - LTEXT "CD뽫ȡ"\ - "Ҫ뵥ɡ", IDC_STATIC, 115, 160, 195, 17 + LTEXT "CD뽫ȡҪ뵥ɡ", IDC_STATIC, 115, 160, 195, 17 END diff --git a/dll/win32/syssetup/logfile.c b/dll/win32/syssetup/logfile.c index 275cb440eef..ccbea67c9b3 100644 --- a/dll/win32/syssetup/logfile.c +++ b/dll/win32/syssetup/logfile.c @@ -25,12 +25,7 @@ */ /* INCLUDES *****************************************************************/ -#define WIN32_NO_STATUS -#include -#define NTOS_MODE_USER -#include - -#include +#include "precomp.h" /* GLOBALS ******************************************************************/ diff --git a/dll/win32/syssetup/precomp.h b/dll/win32/syssetup/precomp.h new file mode 100644 index 00000000000..db7010b9e42 --- /dev/null +++ b/dll/win32/syssetup/precomp.h @@ -0,0 +1,27 @@ +#define WIN32_NO_STATUS +#include +#include + +#define NTOS_MODE_USER +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "globals.h" +#include "resource.h" diff --git a/dll/win32/syssetup/syssetup.rbuild b/dll/win32/syssetup/syssetup.rbuild index 4fd7e6249da..863745a090b 100644 --- a/dll/win32/syssetup/syssetup.rbuild +++ b/dll/win32/syssetup/syssetup.rbuild @@ -20,4 +20,5 @@ logfile.c wizard.c syssetup.rc + precomp.h diff --git a/dll/win32/syssetup/syssetup.rc b/dll/win32/syssetup/syssetup.rc index d13f09ba5eb..ca7bcb28083 100644 --- a/dll/win32/syssetup/syssetup.rc +++ b/dll/win32/syssetup/syssetup.rc @@ -24,23 +24,7 @@ IDI_ICON5 ICON "resources/5.ico" STRINGTABLE BEGIN - IDS_ACKPROJECTS "Wine - http://www.winehq.org\n"\ - "FreeType - http://www.freetype.org\n"\ - "Expat - http://expat.sourceforge.net\n"\ - "DJGPP - http://www.delorie.com/djgpp\n"\ - "SYSLINUX - http://syslinux.zytor.com\n"\ - "Xbox Linux - http://www.xbox-linux.org\n"\ - "MinGW - http://www.mingw.org\n"\ - "Bochs - http://bochs.sourceforge.net\n"\ - "QEMU - http://fabrice.bellard.free.fr/qemu\n"\ - "Mesa3D - http://www.mesa3d.org\n"\ - "FreeBSD - http://www.freebsd.org\n"\ - "adns - http://adns.jgaa.com\n"\ - "ICU - http://www.icu-project.org/\n"\ - "GraphApp - http://enchantia.com/software/graphapp/\n"\ - "Ext2 - http://winext2fsd.sourceforge.net/\n"\ - "X - http://www.x.org/\n"\ - "" + IDS_ACKPROJECTS "Wine - http://www.winehq.org\nFreeType - http://www.freetype.org\nExpat - http://expat.sourceforge.net\nDJGPP - http://www.delorie.com/djgpp\nSYSLINUX - http://syslinux.zytor.com\nXbox Linux - http://www.xbox-linux.org\nMinGW - http://www.mingw.org\nBochs - http://bochs.sourceforge.net\nQEMU - http://fabrice.bellard.free.fr/qemu\nMesa3D - http://www.mesa3d.org\nFreeBSD - http://www.freebsd.org\nadns - http://adns.jgaa.com\nICU - http://www.icu-project.org/\nGraphApp - http://enchantia.com/software/graphapp/\nExt2 - http://winext2fsd.sourceforge.net/\nX - http://www.x.org/\n" END IDR_GPL RT_TEXT "COPYING" @@ -66,10 +50,13 @@ IDR_GPL RT_TEXT "COPYING" #include "lang/ja-JP.rc" #include "lang/no-NO.rc" #include "lang/nl-NL.rc" -#include "lang/pl-PL.rc" #include "lang/pt-BR.rc" #include "lang/sk-SK.rc" -#include "lang/uk-UA.rc" #include "lang/zh-CN.rc" + +// UTF-8 +#pragma code_page(65001) +#include "lang/pl-PL.rc" #include "lang/ro-RO.rc" #include "lang/ru-RU.rc" +#include "lang/uk-UA.rc" diff --git a/dll/win32/syssetup/wizard.c b/dll/win32/syssetup/wizard.c index 9547493ec51..bb57f7d11be 100644 --- a/dll/win32/syssetup/wizard.c +++ b/dll/win32/syssetup/wizard.c @@ -9,27 +9,11 @@ /* INCLUDES *****************************************************************/ -#include -#define WIN32_NO_STATUS -#include -#include -#include -#include -#include -#include -#include -#define NTOS_MODE_USER -#include -#include - -#include +#include "precomp.h" #define NDEBUG #include -#include "globals.h" -#include "resource.h" - #define VMWINST #define PM_REGISTRATION_NOTIFY (WM_APP + 1) diff --git a/dll/win32/tapiui/lang/pl-PL.rc b/dll/win32/tapiui/lang/pl-PL.rc index 5ce9741ff9a..7ee56bf44c4 100644 --- a/dll/win32/tapiui/lang/pl-PL.rc +++ b/dll/win32/tapiui/lang/pl-PL.rc @@ -1,67 +1,68 @@ /* - * translated by Caemyr - Olaf Siejka (Jan, 2008) - * Use ReactOS forum PM or IRC to contact me - * http://www.reactos.org - * IRC: irc.freenode.net #reactos-pl; + * translated by Caemyr - Olaf Siejka (Jan, 2008) + * Use ReactOS forum PM or IRC to contact me + * http://www.reactos.org + * IRC: irc.freenode.net #reactos-pl; + * UTF-8 conversion by Caemyr (May, 2011) */ LANGUAGE LANG_POLISH, SUBLANG_DEFAULT 101 DIALOGEX 0, 0, 252, 218 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "Reguy wybierania" +CAPTION "Reguły wybierania" FONT 8, "MS Shell Dlg" BEGIN ICON 201, 2000, 7, 7, 21, 20 - LTEXT "Ponisza lista pokazuje wyznaczone lokalizacje. Wybierz spord nich t z ktrej dzwonisz.", -1, 35, 7, 210, 16 + LTEXT "Poniższa lista pokazuje wyznaczone lokalizacje. Wybierz spośród nich tą z której dzwonisz.", -1, 35, 7, 210, 16 LTEXT "&Lokalizacje:", -1, 7, 35, 210, 8 CONTROL "", 1033, "SysListView32", WS_BORDER | WS_TABSTOP | 0x0000011D, 7, 46, 238, 105, WS_EX_CLIENTEDGE PUSHBUTTON "&Nowa", 1030, 87, 155, 50, 14 PUSHBUTTON "&Edycja", 1031, 141, 155, 50, 14 PUSHBUTTON "&Skasuj", 1032, 195, 155, 50, 14 - LTEXT "Numer telefoniczny bdzie wybierany jako:", 1052, 7, 181, 100, 8 + LTEXT "Numer telefoniczny będzie wybierany jako:", 1052, 7, 181, 100, 8 LTEXT "", 1053, 14, 195, 224, 16 END 102 DIALOGEX 0, 0, 252, 255 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "Oglne" +CAPTION "Ogólne" FONT 8, "MS Shell Dlg" BEGIN ICON 202, 2000, 7, 7, 20, 20 LTEXT "&Nazwa lokalizacji:", -1, 35, 11, 56, 8, SS_CENTERIMAGE EDITTEXT 1038, 96, 8, 149, 14, ES_AUTOHSCROLL - LTEXT "Wyznacz lokalizacj z ktrej bdziesz dzwoni.", 2001, 7, 33, 238, 8 + LTEXT "Wyznacz lokalizację z której będziesz dzwonić.", 2001, 7, 33, 238, 8 LTEXT "Kraj/®ion:", -1, 7, 49, 161, 8 COMBOBOX 1006, 7, 60, 175, 200, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL LTEXT "N&umer zamiejscowy:", -1, 190, 49, 48, 8 EDITTEXT 1034, 190, 60, 48, 12, ES_AUTOHSCROLL - GROUPBOX "Reguu wybierania", 2002, 7, 80, 238, 92 - LTEXT "Dzwonic z poniszej lokalizacji, uyj nastpujcych regu:", 2003, 14, 92, 224, 8 - LTEXT "Aby uzyska dostp do zewntrznej linii dla pocze &lokalnych, wybierz:", -1, 14, 106, 170, 8 + GROUPBOX "Regułu wybierania", 2002, 7, 80, 238, 92 + LTEXT "Dzwoniąc z poniższej lokalizacji, użyj następujących reguł:", 2003, 14, 92, 224, 8 + LTEXT "Aby uzyskać dostęp do zewnętrznej linii dla połączeń &lokalnych, wybierz:", -1, 14, 106, 170, 8 EDITTEXT 1010, 190, 104, 48, 12, ES_AUTOHSCROLL - LTEXT "Aby uzyska dostp do zewntrznej linii dla pocze &zamiejscowych, wybierz:", -1, 14, 122, 170, 8 + LTEXT "Aby uzyskać dostęp do zewnętrznej linii dla połączeń &zamiejscowych, wybierz:", -1, 14, 122, 170, 8 EDITTEXT 1011, 190, 120, 48, 12, ES_AUTOHSCROLL - LTEXT "Uyj nastpujcego &kodu dla pocze zamiejscowych:", -1, 14, 138, 170, 8 + LTEXT "Użyj następującego &kodu dla połączeń zamiejscowych:", -1, 14, 138, 170, 8 EDITTEXT 1059, 190, 136, 48, 12, ES_AUTOHSCROLL - LTEXT "Uyj nastpujcego kodu dla pocze &midzynarodowych:", -1, 14, 154, 170, 8 + LTEXT "Użyj następującego kodu dla połączeń &międzynarodowych:", -1, 14, 154, 170, 8 EDITTEXT 1060, 190, 152, 48, 12, ES_AUTOHSCROLL - AUTOCHECKBOX "Aby &wyczy oczekiwanie przy poczeniu, wybierz:", 1035, 14, 177, 170, 10 + AUTOCHECKBOX "Aby &wyłączyć oczekiwanie przy połączeniu, wybierz:", 1035, 14, 177, 170, 10 COMBOBOX 1013, 190, 176, 48, 73, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL LTEXT "Wybierz numer:", -1, 14, 195, 40, 8 AUTORADIOBUTTON "&Tonowo", 1036, 58, 194, 50, 10, NOT WS_TABSTOP - AUTORADIOBUTTON "&Cigiem impulsw", 1037, 112, 194, 50, 10, NOT WS_TABSTOP - LTEXT "Numer telefoniczny bdzie wybierany jako:", 1052, 7, 219, 100, 8 + AUTORADIOBUTTON "&Ciągiem impulsów", 1037, 112, 194, 50, 10, NOT WS_TABSTOP + LTEXT "Numer telefoniczny będzie wybierany jako:", 1052, 7, 219, 100, 8 LTEXT "", 1053, 14, 232, 224, 16 END 103 DIALOGEX 0, 0, 252, 218 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "Reguy numerw zamiejscowych" +CAPTION "Reguły numerów zamiejscowych" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Regua numerw zamiejscowych okrela, w jaki naley dzwoni z twojego obecnego rejonu do innych a take w obrbie twojego rejonu.", 2000, 7, 7, 238, 16 - LTEXT "Reguy &numerw zamiejscowych:", -1, 7, 31, 238, 8 + LTEXT "Reguła numerów zamiejscowych określa, w jaki należy dzwonić z twojego obecnego rejonu do innych a także w obrębie twojego rejonu.", 2000, 7, 7, 238, 16 + LTEXT "Reguły &numerów zamiejscowych:", -1, 7, 31, 238, 8 CONTROL "", 1033, "SysListView32", WS_BORDER | WS_TABSTOP | 0x0000801D, 7, 42, 238, 99, WS_EX_CLIENTEDGE PUSHBUTTON "&Nowa..", 1030, 87, 147, 50, 14 PUSHBUTTON "&Edytuj", 1031, 141, 147, 50, 14 @@ -75,7 +76,7 @@ STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION CAPTION "Karta telefoniczna" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Wybierz kart telefoniczn, jak chcesz uy albo kliknij na Nowa by doda inn kart.", 2000, 7, 7, 238, 8 + LTEXT "Wybierz kartę telefoniczną, jaką chcesz użyć albo kliknij na Nowa by dodać inną kartę.", 2000, 7, 7, 238, 8 LTEXT "&Rodzaje kart:", -1, 7, 23, 238, 8 CONTROL "", 1033, "SysListView32", WS_BORDER | WS_TABSTOP | 0x0000400D, 7, 34, 238, 63, WS_EX_CLIENTEDGE PUSHBUTTON "&Nowa..", 1030, 87, 103, 50, 14 @@ -85,10 +86,10 @@ BEGIN EDITTEXT 1018, 102, 125, 143, 12, ES_AUTOHSCROLL LTEXT "Numer &Identyfikacyjny (PIN):", -1, 7, 145, 91, 8 EDITTEXT 1019, 102, 143, 143, 12, ES_AUTOHSCROLL - GROUPBOX "Uyj do pocze", 2001, 7, 158, 238, 53 + GROUPBOX "Użyj do połączeń", 2001, 7, 158, 238, 53 LTEXT "Zamiejscowych:", -1, 14, 172, 84, 8 LTEXT "", 1042, 102, 172, 136, 8 - LTEXT "Midzynarodowych:", -1, 14, 184, 84, 8 + LTEXT "Międzynarodowych:", -1, 14, 184, 84, 8 LTEXT "", 1043, 102, 184, 136, 8 LTEXT "Lokalnych:", -1, 14, 196, 84, 8 LTEXT "", 1051, 102, 196, 136, 8 @@ -96,7 +97,7 @@ END 105 DIALOGEX 0, 0, 252, 218 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "Oglne" +CAPTION "Ogólne" FONT 8, "MS Shell Dlg" BEGIN ICON 203, 2000, 7, 7, 20, 20 @@ -106,8 +107,8 @@ BEGIN EDITTEXT 1018, 7, 46, 116, 14, ES_AUTOHSCROLL LTEXT "Numer &Identyfikacyjny (PIN):", -1, 7, 68, 238, 8 EDITTEXT 1019, 7, 80, 116, 14, ES_AUTOHSCROLL - LTEXT "Ta karta telefoniczna bdzie uyta, gdy:", 1056, 14, 117, 224, 8 - GROUPBOX "Informacje szczegowe o karcie", 2001, 7, 105, 238, 66 + LTEXT "Ta karta telefoniczna będzie użyta, gdy:", 1056, 14, 117, 224, 8 + GROUPBOX "Informacje szczegółowe o karcie", 2001, 7, 105, 238, 66 LTEXT "", 1000, 22, 131, 216, 8 LTEXT "", 1001, 22, 143, 216, 8 LTEXT "", 1002, 22, 155, 216, 8 @@ -118,41 +119,41 @@ STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION CAPTION "Long Distance" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Numer dostpowy dla pocze &midzymiastowych:", -1, 7, 7, 238, 8 + LTEXT "Numer dostępowy dla połączeń &międzymiastowych:", -1, 7, 7, 238, 8 EDITTEXT 1044, 7, 18, 140, 14, ES_AUTOHSCROLL - LTEXT "Uyj przyciskw poniej by wprowadzi sekwencj wybierania pocze midzymiastowych. Pamitaj o zachowaniu dokadnie takiej kolejnoci, jaka jest podana na karcie.", 2000, 7, 40, 238, 24 + LTEXT "Użyj przycisków poniżej by wprowadzić sekwencję wybierania połączeń międzymiastowych. Pamiętaj o zachowaniu dokładnie takiej kolejności, jaka jest podana na karcie.", 2000, 7, 40, 238, 24 LTEXT "Sekwe&ncja wybierania numeru:", -1, 7, 72, 80, 8 CONTROL "List1", 1033, "SysListView32", WS_BORDER | WS_TABSTOP | 0x0000400D, 7, 83, 184, 74, WS_EX_CLIENTEDGE - PUSHBUTTON "W &gr", 1022, 195, 83, 50, 14 - PUSHBUTTON "W &d", 1023, 195, 101, 50, 14 + PUSHBUTTON "W &górę", 1022, 195, 83, 50, 14 + PUSHBUTTON "W &dół", 1023, 195, 101, 50, 14 PUSHBUTTON "&Skasuj", 1024, 195, 119, 50, 14 - PUSHBUTTON "Numer d&ostpowy", 1025, 7, 161, 90, 14 + PUSHBUTTON "Numer d&ostępowy", 1025, 7, 161, 90, 14 PUSHBUTTON "Numer &konta", 1018, 101, 161, 90, 14 PUSHBUTTON "&PIN", 1019, 7, 179, 90, 14 PUSHBUTTON "Numer &telefoniczny", 1020, 101, 179, 90, 14 PUSHBUTTON "&Czekaj na wpisanie", 1017, 7, 197, 90, 14 - PUSHBUTTON "Ok&rel cyfry", 1021, 101, 197, 90, 14 + PUSHBUTTON "Ok&reśl cyfry", 1021, 101, 197, 90, 14 END 107 DIALOGEX 0, 0, 252, 218 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "Midzynarodowe" +CAPTION "Międzynarodowe" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Numer dostpowy dla pocze &midzynarodowych:", -1, 7, 7, 238, 8 + LTEXT "Numer dostępowy dla połączeń &międzynarodowych:", -1, 7, 7, 238, 8 EDITTEXT 1045, 7, 18, 140, 14, ES_AUTOHSCROLL - LTEXT "Uyj przyciskw poniej by wprowadzi sekwencj wybierania pocze midzynarodowych. Pamitaj o zachowaniu dokadnie takiej kolejnoci, jaka jest podana na karcie.", 2000, 7, 40, 244, 24 + LTEXT "Użyj przycisków poniżej by wprowadzić sekwencję wybierania połączeń międzynarodowych. Pamiętaj o zachowaniu dokładnie takiej kolejności, jaka jest podana na karcie.", 2000, 7, 40, 244, 24 LTEXT "Sekwe&ncja wybierania numeru:", -1, 7, 72, 80, 8 CONTROL "List1", 1033, "SysListView32", WS_BORDER | WS_TABSTOP | 0x0000400D, 7, 83, 184, 74, WS_EX_CLIENTEDGE - PUSHBUTTON "W &gr", 1022, 195, 83, 50, 14 - PUSHBUTTON "W &d", 1023, 195, 101, 50, 14 + PUSHBUTTON "W &górę", 1022, 195, 83, 50, 14 + PUSHBUTTON "W &dół", 1023, 195, 101, 50, 14 PUSHBUTTON "&Skasuj", 1024, 195, 119, 50, 14 - PUSHBUTTON "Numer d&ostpowy", 1025, 7, 161, 90, 14 + PUSHBUTTON "Numer d&ostępowy", 1025, 7, 161, 90, 14 PUSHBUTTON "Numer &konta", 1018, 101, 161, 90, 14 PUSHBUTTON "&PIN", 1019, 7, 179, 90, 14 PUSHBUTTON "Numer &telefoniczny", 1020, 101, 179, 90, 14 PUSHBUTTON "&Czekaj na wpisanie", 1017, 7, 197, 90, 14 - PUSHBUTTON "&Okrel cyfry", 1021, 101, 197, 90, 14 + PUSHBUTTON "&Określ cyfry", 1021, 101, 197, 90, 14 END 108 DIALOGEX 0, 0, 252, 218 @@ -160,43 +161,43 @@ STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION CAPTION "Lokalne" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Numer dostpowy dla pocze &lokalnych:", -1, 7, 7, 238, 8 + LTEXT "Numer dostępowy dla połączeń &lokalnych:", -1, 7, 7, 238, 8 EDITTEXT 1008, 7, 18, 140, 14, ES_AUTOHSCROLL - LTEXT "Uyj przyciskw poniej by wprowadzi sekwencj wybierania pocze midzynarodowych. Pamitaj o zachowaniu dokadnie takiej kolejnoci, jaka jest podana na karcie. Aby dzwoni z pominiciem karty, zostaw to pole puste.", 2000, 7, 40, 238, 24 + LTEXT "Użyj przycisków poniżej by wprowadzić sekwencję wybierania połączeń międzynarodowych. Pamiętaj o zachowaniu dokładnie takiej kolejności, jaka jest podana na karcie. Aby dzwonić z pominięciem karty, zostaw to pole puste.", 2000, 7, 40, 238, 24 LTEXT "Sekwe&ncja wybierania numeru:", -1, 7, 72, 238, 8 CONTROL "List1", 1033, "SysListView32", WS_BORDER | WS_TABSTOP | 0x0000400D, 7, 83, 184, 74, WS_EX_CLIENTEDGE - PUSHBUTTON "W &gr", 1022, 195, 83, 50, 14 - PUSHBUTTON "W &d", 1023, 195, 101, 50, 14 + PUSHBUTTON "W &górę", 1022, 195, 83, 50, 14 + PUSHBUTTON "W &dół", 1023, 195, 101, 50, 14 PUSHBUTTON "&Skasuj", 1024, 195, 119, 50, 14 - PUSHBUTTON "Numer d&ostpowy", 1025, 7, 161, 90, 14 + PUSHBUTTON "Numer d&ostępowy", 1025, 7, 161, 90, 14 PUSHBUTTON "Numer &konta", 1018, 101, 161, 90, 14 PUSHBUTTON "&PIN", 1019, 7, 179, 90, 14 PUSHBUTTON "Numer &telefoniczny", 1020, 101, 179, 90, 14 PUSHBUTTON "&Czekaj na wpisanie", 1017, 7, 197, 90, 14 - PUSHBUTTON "&Okrel cyfry", 1021, 101, 197, 90, 14 + PUSHBUTTON "&Określ cyfry", 1021, 101, 197, 90, 14 END 109 DIALOGEX 0, 0, 252, 257 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION EXSTYLE WS_EX_CONTEXTHELP -CAPTION "Nowa regua numeru zamiejscowego" +CAPTION "Nowa reguła numeru zamiejscowego" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Ta regua numeru zamiejscowego zostanie uyta tylko dla pocze o podanej poniej kombinacji numeru zamiejscowego i prefiksu.", 2000, 7, 6, 238, 16 + LTEXT "Ta reguła numeru zamiejscowego zostanie użyta tylko dla połączeń o podanej poniżej kombinacji numeru zamiejscowego i prefiksu.", 2000, 7, 6, 238, 16 LTEXT "Numer zamiejscowy na jaki dzwonisz:", -1, 7, 31, 110, 8 LTEXT "&Numer zamiejscowy:", -1, 7, 47, 36, 8 EDITTEXT 1034, 46, 44, 50, 14, ES_AUTOHSCROLL - LTEXT "Podaj prefiks jaki ma by uyty z t regu numeru zamiejscowego.", -1, 14, 78, 224, 8 - AUTORADIOBUTTON "&Zacz wszystkie prefiksy z tego numeru zamiejscowego", 1014, 14, 90, 224, 12, NOT WS_TABSTOP - AUTORADIOBUTTON "Z&acz tylko prefiksy z listy poniej:", 1015, 14, 104, 224, 12, NOT WS_TABSTOP - LTEXT "&Prefiksy do zaczenia", 1057, 26, 117, 119, 8 + LTEXT "Podaj prefiks jaki ma być użyty z tą regułą numeru zamiejscowego.", -1, 14, 78, 224, 8 + AUTORADIOBUTTON "&Załącz wszystkie prefiksy z tego numeru zamiejscowego", 1014, 14, 90, 224, 12, NOT WS_TABSTOP + AUTORADIOBUTTON "Z&ałącz tylko prefiksy z listy poniżej:", 1015, 14, 104, 224, 12, NOT WS_TABSTOP + LTEXT "&Prefiksy do załączenia", 1057, 26, 117, 119, 8 CONTROL "List1", 1033, "SysListView32", WS_BORDER | WS_TABSTOP | 0x0000411D, 25, 128, 66, 32, WS_EX_CLIENTEDGE PUSHBUTTON "&Dodaj", 1005, 95, 128, 50, 14 PUSHBUTTON "&Skasuj", 1024, 95, 146, 50, 14 - LTEXT "Podczas wybierania numerw, ktre zawieraj powysze prefiksy:", -1, 14, 184, 224, 8 + LTEXT "Podczas wybierania numerów, które zawierają powyższe prefiksy:", -1, 14, 184, 224, 8 AUTOCHECKBOX "&Wybierz:", 1012, 14, 198, 30, 12 EDITTEXT 1007, 46, 196, 42, 14, ES_AUTOHSCROLL - AUTOCHECKBOX "Docz numer zamiejscowy", 1029, 14, 214, 85, 12 + AUTOCHECKBOX "Dołącz numer zamiejscowy", 1029, 14, 214, 85, 12 DEFPUSHBUTTON "OK", 1, 141, 236, 50, 14 PUSHBUTTON "Anuluj", 2, 195, 236, 50, 14 RTEXT "Numer zamiejscowy", 2001, 133, 31, 51, 8 @@ -205,7 +206,7 @@ BEGIN CONTROL "", 2004, "STATIC", SS_BLACKFRAME | SS_SUNKEN, 203, 41, 1, 6 RTEXT "X - X X X - X X X - X X X X", 2005, 133, 48, 112, 8 GROUPBOX "Prefiksy", -1, 7, 64, 238, 102 - GROUPBOX "Reguy", -1, 7, 170, 238, 60 + GROUPBOX "Reguły", -1, 7, 170, 238, 60 END 110 DIALOGEX 0, 0, 227, 82 @@ -226,10 +227,10 @@ EXSTYLE WS_EX_CONTEXTHELP CAPTION "Oczekuj" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Wybierz rodzaj znaku zachty na oczekiwanie przed rozpoczciem sekwencji wybierania.", 2000, 7, 7, 238, 16 + LTEXT "Wybierz rodzaj znaku zachęty na oczekiwanie przed rozpoczęciem sekwencji wybierania.", 2000, 7, 7, 238, 16 AUTORADIOBUTTON "Czekaj na &ton wybierania", 1009, 7, 31, 238, 10, WS_GROUP - AUTORADIOBUTTON "Czekaj na wiadomo &gosow", 1016, 7, 47, 238, 10, NOT WS_TABSTOP - AUTORADIOBUTTON "Czekaj przez okrelony czas:", 1048, 7, 63, 238, 10, NOT WS_TABSTOP + AUTORADIOBUTTON "Czekaj na wiadomość &głosową", 1016, 7, 47, 238, 10, NOT WS_TABSTOP + AUTORADIOBUTTON "Czekaj przez określony czas:", 1048, 7, 63, 238, 10, NOT WS_TABSTOP EDITTEXT 1050, 18, 77, 36, 14, ES_AUTOHSCROLL | WS_GROUP CONTROL "Spin1", 1049, "msctls_updown32", 0x00000036, 42, 78, 11, 14 LTEXT "&sekund", -1, 58, 81, 187, 8 @@ -243,9 +244,9 @@ EXSTYLE WS_EX_CONTEXTHELP CAPTION "Numer docelowy" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "W tym kroku trzeba poda numer docelowy, ktry bdzie wybierany przy uyciu karty telefonicznej. Wybierz czci numeru ktre maj zosta wybrane automagicznie:", 2000, 7, 7, 238, 24 - AUTOCHECKBOX "Wybieraj numer &midzynarodowy", 1027, 7, 39, 238, 10 - AUTOCHECKBOX "Wybieraj numer mi&dzymiastowy", 1034, 7, 55, 238, 10 + LTEXT "W tym kroku trzeba podać numer docelowy, który będzie wybierany przy użyciu karty telefonicznej. Wybierz części numeru które mają zostać wybrane automagicznie:", 2000, 7, 7, 238, 24 + AUTOCHECKBOX "Wybieraj numer &międzynarodowy", 1027, 7, 39, 238, 10 + AUTOCHECKBOX "Wybieraj numer mię&dzymiastowy", 1034, 7, 55, 238, 10 AUTOCHECKBOX "Wybieraj numer &telefoniczny", 1008, 7, 71, 238, 10, WS_DISABLED DEFPUSHBUTTON "OK", 1, 141, 92, 50, 14 PUSHBUTTON "Anuluj", 2, 195, 92, 50, 14 @@ -257,11 +258,11 @@ CAPTION "Zaawansowane" FONT 8, "MS Shell Dlg" BEGIN ICON 201, 2000, 7, 7, 20, 20 - LTEXT "Nastpujcy providerzy usug telefonicznych s zainstalowani na tym komputerze:", -1, 40, 7, 205, 8 + LTEXT "Następujący providerzy usług telefonicznych są zainstalowani na tym komputerze:", -1, 40, 7, 205, 8 LTEXT "&Providerzy:", -1, 7, 35, 238, 8 LISTBOX 1033, 7, 46, 238, 147, LBS_STANDARD | LBS_NOINTEGRALHEIGHT | WS_TABSTOP PUSHBUTTON "&Dodaj...", 1005, 87, 197, 50, 14 - PUSHBUTTON "&Usu....", 1024, 141, 197, 50, 14 + PUSHBUTTON "&Usuń....", 1024, 141, 197, 50, 14 PUSHBUTTON "&Konfiguruj", 1031, 195, 197, 50, 14 END @@ -270,8 +271,8 @@ STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUPWINDOW | WS_VISIBL CAPTION "Dodaj Providera" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Wybierz providera, ktrego chciaby zainstalowa, z listy poniej, i nacinij Dodaj.", 2000, 7, 7, 241, 8 - LTEXT "&Providerzy usug telefonicznych:", -1, 7, 23, 144, 10 + LTEXT "Wybierz providera, którego chciałbyś zainstalować, z listy poniżej, i naciśnij Dodaj.", 2000, 7, 7, 241, 8 + LTEXT "&Providerzy usług telefonicznych:", -1, 7, 23, 144, 10 LISTBOX 1055, 7, 34, 238, 74, LBS_STANDARD | WS_TABSTOP PUSHBUTTON "&Dodaj", 1005, 141, 106, 50, 14 DEFPUSHBUTTON "Anuluj", 2, 195, 106, 50, 14 @@ -284,18 +285,18 @@ CAPTION "Informacje o lokalizacji" FONT 8, "MS Shell Dlg" BEGIN CONTROL 302, 302, "STATIC", SS_BITMAP, 10, 10, 88, 155 - LTEXT "Zanim bdziesz mg dokona jakichkolwiek pocze telefonicznych albo modemowych, ReactOS porzebuje nastpujcych informacji o twojej obecnej lokalizacji.", 2000, 107, 15, 188, 25 + LTEXT "Zanim będziesz mógł dokonać jakichkolwiek połączeń telefonicznych albo modemowych, ReactOS porzebuje następujących informacji o twojej obecnej lokalizacji.", 2000, 107, 15, 188, 25 LTEXT "&Kraj/Region", -1, 107, 43, 189, 10 COMBOBOX 1006, 107, 55, 180, 200, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL - LTEXT "Numer &midzymiastowy", -1, 107, 74, 189, 10 + LTEXT "Numer &międzymiastowy", -1, 107, 74, 189, 10 EDITTEXT 1034, 107, 87, 45, 12, ES_AUTOHSCROLL - LTEXT "Kod &nonej (o ile potrzebny)", -1, 107, 105, 189, 10 + LTEXT "Kod &nośnej (o ile potrzebny)", -1, 107, 105, 189, 10 EDITTEXT 1058, 106, 118, 45, 12, ES_UPPERCASE | ES_AUTOHSCROLL - LTEXT "Numer do &linii zewntrznej", -1, 107, 137, 189, 10 + LTEXT "Numer do &linii zewnętrznej", -1, 107, 137, 189, 10 EDITTEXT 1010, 107, 149, 45, 12, ES_UPPERCASE | ES_AUTOHSCROLL - LTEXT "System telefoniczny uywa:", -1, 107, 168, 189, 10 + LTEXT "System telefoniczny używa:", -1, 107, 168, 189, 10 AUTORADIOBUTTON "Wybierania &Tonowego", 1036, 107, 178, 57, 14, WS_GROUP | NOT WS_TABSTOP - AUTORADIOBUTTON "Wybierania &Cigiem Impulsw", 1037, 175, 178, 57, 14, NOT WS_TABSTOP + AUTORADIOBUTTON "Wybierania &Ciągiem Impulsów", 1037, 175, 178, 57, 14, NOT WS_TABSTOP DEFPUSHBUTTON "OK", 1, 192, 204, 50, 14 PUSHBUTTON "Anuluj", 2, 246, 204, 50, 14 END @@ -305,21 +306,21 @@ STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN CONTROL 302, 302, "STATIC", SS_BITMAP, 0, 0, 88, 155 - LTEXT "Zanim bdziesz mg dokona jakichkolwiek pocze telefonicznych albo modemowych, ReactOS porzebuje nastpujcych informacji o twojej obecnej lokalizacji.", 2000, 95, 2, 188, 25 + LTEXT "Zanim będziesz mógł dokonać jakichkolwiek połączeń telefonicznych albo modemowych, ReactOS porzebuje następujących informacji o twojej obecnej lokalizacji.", 2000, 95, 2, 188, 25 LTEXT "&What country/region are you in now?", -1, 95, 30, 188, 10 COMBOBOX 1006, 95, 41, 177, 68, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL - LTEXT "Numer &midzymiastowy", -1, 95, 61, 188, 10 + LTEXT "Numer &międzymiastowy", -1, 95, 61, 188, 10 EDITTEXT 1034, 95, 73, 40, 14, ES_AUTOHSCROLL - LTEXT "Numer do &linii zewntrznej", -1, 95, 96, 188, 10 + LTEXT "Numer do &linii zewnętrznej", -1, 95, 96, 188, 10 EDITTEXT 1010, 95, 107, 40, 14, ES_UPPERCASE | ES_AUTOHSCROLL - LTEXT "System telefoniczny uywa:", -1, 95, 129, 159, 10 + LTEXT "System telefoniczny używa:", -1, 95, 129, 159, 10 AUTORADIOBUTTON "Wybierania &Tonowego", 1036, 95, 139, 55, 12, WS_GROUP | NOT WS_TABSTOP - AUTORADIOBUTTON "Wybierania &Cigiem Impulsw", 1037, 155, 139, 55, 12, NOT WS_TABSTOP + AUTORADIOBUTTON "Wybierania &Ciągiem Impulsów", 1037, 155, 139, 55, 12, NOT WS_TABSTOP END 500 DIALOGEX 0, 0, 235, 88 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_CENTER | WS_POPUPWINDOW | WS_CAPTION -CAPTION "Explorer ReactOS" +CAPTION "Explorator ReactOS" FONT 8, "MS Shell Dlg" BEGIN ICON 504, 501, 13, 14, 21, 20 @@ -332,111 +333,111 @@ END STRINGTABLE BEGIN 1 "Opcje telefonu i modemu" - 2 "Ustawienia regu wybierania i waciwoci twojego modemu." + 2 "Ustawienia reguł wybierania i właściwości twojego modemu." 3 "Lokalizacja" - 4 "Aby utworzy now lokalizacj, nacinij Nowa." + 4 "Aby utworzyć nową lokalizację, naciśnij Nowa." 5 "Nowa Lokalizacja" - 6 "Edytuj Lokalizacj" + 6 "Edytuj Lokalizację" 7 "Nowa Karta Telefoniczna" - 8 "Edytuj Kart Telefoniczn" + 8 "Edytuj Kartę Telefoniczną" 9 "Numer zamiejscowy" 10 "Prefiksy" - 11 "Reguy" - 12 "Wprowadzony znak jest nieprawidowy.\n\nPrawidowe znaki to te od 0 do 9, *, # i przecinek." - 13 "Wprowadzony znak jest nieprawidowy.\n\nPrawidowe znaki to te od 0 do 9, *, #, spacja i przecinek." - 14 "Wprowadzony znak jest nieprawidowy.\n\nPrawidowe znaki to te od 0 do 9." - 15 "Wprowadzony znak jest nieprawidowy." + 11 "Reguły" + 12 "Wprowadzony znak jest nieprawidłowy.\n\nPrawidłowe znaki to te od 0 do 9, *, # i przecinek." + 13 "Wprowadzony znak jest nieprawidłowy.\n\nPrawidłowe znaki to te od 0 do 9, *, #, spacja i przecinek." + 14 "Wprowadzony znak jest nieprawidłowy.\n\nPrawidłowe znaki to te od 0 do 9." + 15 "Wprowadzony znak jest nieprawidłowy." 16 "Wybieraj %1" 17 "Wybieraj %1 i numer zamiejscowy" 18 "Wybieraj numer zamiejscowy" 19 "Wybieraj tylko numer telefoniczny" 20 "Wszystkie" 21 "Wybrane" - 22 "Edytuj Regu numerw zamiejscowych" - 23 "Wybierz regu z listy powyej aby przejrze jej opis, albo nacinij Nowa aby doda regu." - 24 "Wybieraj '%2' z numerem midzymiastowym przed numerem telefonicznym, dla wszystkich pocze w obszarze %1." - 25 "Wybieraj '%2' przed numerem telefonicznym, dla wszystkich pocze w obszarze %1." - 26 "Wybieraj numer midzymiastowy przed numerem telefonicznym, dla wszystkich pocze w obszarze %1." - 27 "Wybieraj tylko numer telefoniczny, dla wszystkich pocze w obszarze %1." - 28 "Wybieraj '%2' z numerem midzymiastowym przed numerem telefonicznym, dla wszystkich pocze w obszarze %1, zawierajcych wyznaczone prefiksy." - 29 "Wybieraj '%2' przed numerem telefonicznym, dla wszystkich pocze w obszarze %1, zawierajcych wyznaczone prefiksy." - 30 "Wybieraj numer midzymiastowy przed numerem telefonicznym, dla wszystkich pocze w obszarze %1, zawierajcych wyznaczone prefiksy." - 31 "Wybieraj tylko numer telefoniczny, dla wszystkich pocze w obszarze %1, zawierajcych wyznaczone prefiksy." - 32 "Wybieraj '1' przed poczeniami ze wszystkimi numerami midzymiastowymi i docz numer midzymiastowy przy wszystkich prefiksach." + 22 "Edytuj Regułę numerów zamiejscowych" + 23 "Wybierz regułę z listy powyżej aby przejrzeć jej opis, albo naciśnij Nowa aby dodać regułę." + 24 "Wybieraj '%2' z numerem międzymiastowym przed numerem telefonicznym, dla wszystkich połączeń w obszarze %1." + 25 "Wybieraj '%2' przed numerem telefonicznym, dla wszystkich połączeń w obszarze %1." + 26 "Wybieraj numer międzymiastowy przed numerem telefonicznym, dla wszystkich połączeń w obszarze %1." + 27 "Wybieraj tylko numer telefoniczny, dla wszystkich połączeń w obszarze %1." + 28 "Wybieraj '%2' z numerem międzymiastowym przed numerem telefonicznym, dla wszystkich połączeń w obszarze %1, zawierających wyznaczone prefiksy." + 29 "Wybieraj '%2' przed numerem telefonicznym, dla wszystkich połączeń w obszarze %1, zawierających wyznaczone prefiksy." + 30 "Wybieraj numer międzymiastowy przed numerem telefonicznym, dla wszystkich połączeń w obszarze %1, zawierających wyznaczone prefiksy." + 31 "Wybieraj tylko numer telefoniczny, dla wszystkich połączeń w obszarze %1, zawierających wyznaczone prefiksy." + 32 "Wybieraj '1' przed połączeniami ze wszystkimi numerami międzymiastowymi i dołącz numer międzymiastowy przy wszystkich prefiksach." 33 "Dodaj Prefiks" - 34 "Wprowad jeden lub wicej prefiksw, rozdzielajc je spacjami lub przecinkami." + 34 "Wprowadź jeden lub więcej prefiksów, rozdzielając je spacjami lub przecinkami." 35 "Wyznacz cyfry" - 36 "Wprowad jedn lub wicej cyfr (wczajc * i #) do wybierania." - 37 "Wprowadzie nieprawidowy znak.\n\nPrawidowymi znakami s liczby od 0 do 9 i spacja." - 38 "Czekaj przez %1!d! sekund()." - 39 "Wybierz numer dostpowy." + 36 "Wprowadź jedną lub więcej cyfr (włączając * i #) do wybierania." + 37 "Wprowadziłeś nieprawidłowy znak.\n\nPrawidłowymi znakami są liczby od 0 do 9 i spacja." + 38 "Czekaj przez %1!d! sekund(ę)." + 39 "Wybierz numer dostępowy." 40 "Wybierz numer konta." 41 "Wybierz numer PIN." - 42 "Czekaj na sygna wybierania." - 43 "Czekaj na koniec wiadomoci gosowej." - 44 "Wybieraj numer midzynarodowy, midzymiastowy i telefoniczny." - 45 "Wybieraj numer midzynarodowy i telefoniczny." - 46 "Wybieraj numer midzymiastowy i telefoniczny." - 47 "Wybieraj numer midzynarodowy." - 48 "Wybieraj numer midzymiastowy." + 42 "Czekaj na sygnał wybierania." + 43 "Czekaj na koniec wiadomości głosowej." + 44 "Wybieraj numer międzynarodowy, międzymiastowy i telefoniczny." + 45 "Wybieraj numer międzynarodowy i telefoniczny." + 46 "Wybieraj numer międzymiastowy i telefoniczny." + 47 "Wybieraj numer międzynarodowy." + 48 "Wybieraj numer międzymiastowy." 49 "Wybieraj numer telefoniczny." 50 "wybieranie numeru zamiejscowego." 51 "wybieranie numeru zagranicznego." 52 "wybieranie numeru lokalnego." - 53 "Nie ma zdefiniowanych regu do uycia tej karty telefonicznej." - 54 "Musisz wprowadzi kod operatora midzymiastowego dla tej lokalizacji." - 55 "Musisz wprowadzi nazw dla tej lokalizacji." - 56 "Musisz wprowadzi numer midzymiastowy dla tej lokalizacji." - 57 "Musisz wybra kod do usunicia oczekiwania na wybieranie." - 58 "Musisz wybra kraj lub region, z ktrego dzwonisz." - 59 "Brakujce informacje" - 60 "Wprowadzona nazwa lokalizacji jest ju uyta. Prosz wprowadzi nazw unikaln." - 61 "Brak potrzebnych dla tej karty informacji. Aby jej uy, nacinij Edytuj aby wprowadzi potrzebne informacje, albo wybierz inn kart." - 62 "Musisz wybra domyln kart telefoniczn. Wybierz kart z listy, albo kliknij na Nowa aby wprowadzi now kart." - 63 "Musisz wprowadzi nazw karty telefonicznej." - 64 "Musisz wprowadzi numer konta." - 65 "Musisz wprowadzi numer PIN." - 66 "Nie ma zdefiniowanych regu dla tej karty telefonicznej. Aby stworzy regu, wybierz zakadk Zamiejscowe, Midzynarodowe lub Lokalne." - 67 "Twoja regua Rozmowy Zamiejscowej wymaga podania numeru dostpowego z twojej karty, do rozmw zamiejscowych." - 68 "Twoja regua Rozmowy Midzynarodowej wymaga podania numeru dostpowego z twojej karty, do rozmw midzynarodowych." - 69 "Twoja regua Rozmowy Lokalnej wymaga podania numeru dostpowego z twojej karty, do rozmw lokalnych." + 53 "Nie ma zdefiniowanych reguł do użycia tej karty telefonicznej." + 54 "Musisz wprowadzić kod operatora międzymiastowego dla tej lokalizacji." + 55 "Musisz wprowadzić nazwę dla tej lokalizacji." + 56 "Musisz wprowadzić numer międzymiastowy dla tej lokalizacji." + 57 "Musisz wybrać kod do usunięcia oczekiwania na wybieranie." + 58 "Musisz wybrać kraj lub region, z którego dzwonisz." + 59 "Brakujące informacje" + 60 "Wprowadzona nazwa lokalizacji jest już użyta. Proszę wprowadzić nazwę unikalną." + 61 "Brak potrzebnych dla tej karty informacji. Aby jej użyć, naciśnij Edytuj aby wprowadzić potrzebne informacje, albo wybierz inną kartę." + 62 "Musisz wybrać domyślną kartę telefoniczną. Wybierz kartę z listy, albo kliknij na Nowa aby wprowadzić nową kartę." + 63 "Musisz wprowadzić nazwę karty telefonicznej." + 64 "Musisz wprowadzić numer konta." + 65 "Musisz wprowadzić numer PIN." + 66 "Nie ma zdefiniowanych reguł dla tej karty telefonicznej. Aby stworzyć regułę, wybierz zakładkę Zamiejscowe, Międzynarodowe lub Lokalne." + 67 "Twoja reguła Rozmowy Zamiejscowej wymaga podania numeru dostępowego z twojej karty, do rozmów zamiejscowych." + 68 "Twoja reguła Rozmowy Międzynarodowej wymaga podania numeru dostępowego z twojej karty, do rozmów międzynarodowych." + 69 "Twoja reguła Rozmowy Lokalnej wymaga podania numeru dostępowego z twojej karty, do rozmów lokalnych." 70 "Brak" - 71 "Czy jeste pewien, e chcesz usun wybranego Providera Usug Telefonicznych?" - 72 "" - 73 "Musisz wprowadzi prefiksy, do ktrych odnosi si ta regua." + 71 "Czy jesteś pewien, że chcesz usunąć wybranego Providera Usług Telefonicznych?" + 72 "" + 73 "Musisz wprowadzić prefiksy, do których odnosi się ta reguła." 74 "&Cyfry:" 75 "&Prefiksy:" - 76 "Wprowadzie nieprawidowy znak.\n\nPrawidowymi znakami s liczby od 0 do 9, spacja i przecinek." - 77 "Potwierd skasowanie" - 78 "Czy na pewno chcesz skasowa t lokalizacj?" - 79 "Czy na pewno chcesz skasowa t kart telefoniczn?" - 80 "Czy na pewno chcesz skasowa t regu numeru midzymiastowego?" - 81 "Musisz wprowadzi cyfry do wybierania." - 82 "Podana nazwa karty telefonicznej jest ju uyta. Prosz wprowadzi nazw unikaln." - 83 "ReactOS potrzebuje informacji o lokalizacji z ktrej bdziesz dzwoni. Jeeli anulujesz, bez podania tych informacji, ten program moe nie dziaa poprawnie podczas wybierania. W dodatku niektre aplikacje ponownie wywoaj to okno po naciniciu Anuluj\nCzy na pewno chcesz anulowa?" - 84 "Potwierd Anulowanie" + 76 "Wprowadziłeś nieprawidłowy znak.\n\nPrawidłowymi znakami są liczby od 0 do 9, spacja i przecinek." + 77 "Potwierdź skasowanie" + 78 "Czy na pewno chcesz skasować tą lokalizację?" + 79 "Czy na pewno chcesz skasować tą kartę telefoniczną?" + 80 "Czy na pewno chcesz skasować tę regułę numeru międzymiastowego?" + 81 "Musisz wprowadzić cyfry do wybierania." + 82 "Podana nazwa karty telefonicznej jest już użyta. Proszę wprowadzić nazwę unikalną." + 83 "ReactOS potrzebuje informacji o lokalizacji z której będziesz dzwonić. Jeżeli anulujesz, bez podania tych informacji, ten program może nie działać poprawnie podczas wybierania. W dodatku niektóre aplikacje ponownie wywołają to okno po naciśnięciu Anuluj\nCzy na pewno chcesz anulować?" + 84 "Potwierdź Anulowanie" 85 "Moja Lokalizacja" - 86 "" - 87 "Wprowadzie nieprawidowy znak.\n\nPrawidowymi znakami s liczby od 0 do 9, litery od A do D, *, #, +, !, spacja i przecinek." - 88 "Musisz wprowadzi kod operatora midzynarodowego dla tej lokalizacji." - 89 "Musisz wprowadzi kod operatora dla tej lokalizacji." - 90 "Te okno prbuje utworzy albo monitorowa poczenie telefoniczne albo podobne, na twoim komputerze.\nCzy chcesz kontynuowa?" - 91 "Te okno prbuje uzyska dostp do informacji o poczeniach w twojej sieci.\nCzy chcesz kontynuowa?" - 92 "Te okno prbuje uzyska dostp do albo zmieni informacje o konferencjach w sieci.\nCzy chcesz kontynuowa?" - 93 "Te okno prbuje uzyska dostp do albo zmieni ustawienia w rejestrze.\nCzy chcesz kontynuowa?" - 1064 "Aplet Telefon i Modem w Panelu Sterowania nie moe by otwarty. Moesz mie problem z uruchomieniem usugi Telefon." - 1065 "Usu Providera" + 86 "" + 87 "Wprowadziłeś nieprawidłowy znak.\n\nPrawidłowymi znakami są liczby od 0 do 9, litery od A do D, *, #, +, !, spacja i przecinek." + 88 "Musisz wprowadzić kod operatora międzynarodowego dla tej lokalizacji." + 89 "Musisz wprowadzić kod operatora dla tej lokalizacji." + 90 "Te okno próbuje utworzyć albo monitorować połączenie telefoniczne albo podobne, na twoim komputerze.\nCzy chcesz kontynuować?" + 91 "Te okno próbuje uzyskać dostęp do informacji o połączeniach w twojej sieci.\nCzy chcesz kontynuować?" + 92 "Te okno próbuje uzyskać dostęp do albo zmienić informacje o konferencjach w sieci.\nCzy chcesz kontynuować?" + 93 "Te okno próbuje uzyskać dostęp do albo zmienić ustawienia w rejestrze.\nCzy chcesz kontynuować?" + 1064 "Aplet Telefon i Modem w Panelu Sterowania nie może być otwarty. Możesz mieć problem z uruchomieniem usługi Telefon." + 1065 "Usuń Providera" 15800 "23" - 15801 "0,""Brak (wybiernie bezporednie)"","""","""","""","""","""","""","""","""",1" - 15802 "1,""AT&T wybieranie bezporednie przez 1010ATT1"","""",""G"",""J1FG"",""J011EFG"","""","""",""1010288"",""1010288"",1" + 15801 "0,""Brak (wybiernie bezpośrednie)"","""","""","""","""","""","""","""","""",1" + 15802 "1,""AT&T wybieranie bezpośrednie przez 1010ATT1"","""",""G"",""J1FG"",""J011EFG"","""","""",""1010288"",""1010288"",1" 15803 "2,""AT&T przez 1010ATT0"","""",""G"",""J0FG$TH"",""J01EFG$TH"","""","""",""1010288"",""1010288"",1" 15804 "3,""AT&T przez 1-800-321-0288"","""",""G"",""J$TFG$TH"",""J$T01EFG$TH"","""","""",""18003210288"",""18003210288"",1" - 15805 "4,""MCI wybieranie bezporednie przez 10102221"","""",""G"",""J1FG"",""J011EFG"","""","""",""1010222"",""1010222"",1" + 15805 "4,""MCI wybieranie bezpośrednie przez 10102221"","""",""G"",""J1FG"",""J011EFG"","""","""",""1010222"",""1010222"",1" 15806 "5,""MCI przez 10102220"","""",""G"",""J0FG$TH"",""J01EFG$TH"","""","""",""1010222"",""1010222"",1" 15807 "6,""MCI przez 1-800-888-8000"","""",""G"",""J,,,,,,TH,,FG"",""J,,,,,,TH,,011EFG"","""","""",""18008888000"",""18008888000"",1" 15808 "7,""MCI przez 1-800-674-0700"","""",""G"",""J,,,,,,TH,,FG"",""J,,,,,,TH,,011EFG"","""","""",""18006740700"",""18006740700"",1" 15809 "8,""MCI przez 1-800-674-7000"","""",""G"",""J,,,,,,TH,,FG"",""J,,,,,,TH,,011EFG"","""","""",""18006747000"",""18006747000"",1" - 15810 "9,""US Sprint wybieranie bezporednie przez 10103331"","""",""G"",""J1FG"",""J011EFG"","""","""",""1010333"",""1010333"",1" + 15810 "9,""US Sprint wybieranie bezpośrednie przez 10103331"","""",""G"",""J1FG"",""J011EFG"","""","""",""1010333"",""1010333"",1" 15811 "10,""US Sprint przez 10103330"","""",""G"",""J0FG$TH"",""J01EFG$TH"","""","""",""1010333"",""1010333"",1" 15812 "11,""US Sprint przez 1-800-877-8000"","""",""G"",""J,,,T0FG,,H"",""J,,,T01EFG#,H"","""","""",""18008778000"",""18008778000"",1" 15813 "12,""Karta Telefoniczna przez 0"","""",""G"",""0FG$TH"",""01EFG$TH"","""","""","""","""",1" @@ -446,7 +447,7 @@ BEGIN 15817 "16,""CLEAR Communications (New Zealand)"","""",""J$TH,0FG"",""J$TH,0FG"",""J$TH,00EFG"","""",""0502333"",""0502333"",""0502333"",1" 15818 "17,""Telecom New Zealand"","""",""J,0FG?H"",""J,0FG?H"",""J,00EFG?H"","""",""012"",""012"",""012"",1" 15819 "18,""Karta Global (Taiwan do USA)"","""",""G"",""0FG"",""J,102880$TFG$H"","""","""","""",""0080"",1" - 15820 "19,""Telstra (Australia) przez 1818 (gos)"","""",""J$TH,FG#"",""J$TH,FG#"",""J$TH,0011EFG#"","""",""1818"",""1818"",""1818"",1" + 15820 "19,""Telstra (Australia) przez 1818 (głos)"","""",""J$TH,FG#"",""J$TH,FG#"",""J$TH,0011EFG#"","""",""1818"",""1818"",""1818"",1" 15821 "20,""Telstra (Australia) przez 1818 (faks)"","""",""J$TH,FG#"",""J$TH,FG#"",""J$TH,0015EFG#"","""",""1818"",""1818"",""1818"",1" 15822 "21,""Optus (Australia) przez 1812"","""",""FG"",""FG"",""J@TH,0011EFG"","""","""","""",""1812"",1" 15823 "22,""Optus (Australia) przez 008551812"","""",""FG"",""FG"",""J@TH,0011EFG"","""","""","""",""008551812"",1" diff --git a/dll/win32/tapiui/lang/ru-RU.rc b/dll/win32/tapiui/lang/ru-RU.rc index 6d29dd4bbf5..9ac5f8f93b9 100644 --- a/dll/win32/tapiui/lang/ru-RU.rc +++ b/dll/win32/tapiui/lang/ru-RU.rc @@ -2,105 +2,105 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT 101 DIALOGEX 0, 0, 252, 226 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION " " +CAPTION "Набор номера" FONT 8, "MS Shell Dlg" BEGIN ICON 201, 2000, 7, 7, 21, 20 - LTEXT "&:", -1, 7, 43, 210, 8 - LTEXT " . , .", -1, 35, 12, 210, 24 + LTEXT "&Размещение:", -1, 7, 43, 210, 8 + LTEXT "В списке содержатся указанные местоположения. Выберите место, из которого производится набор номера.", -1, 35, 12, 210, 24 CONTROL "", 1033, "SysListView32", WS_BORDER | WS_TABSTOP | 0x0000011D, 7, 54, 238, 105, WS_EX_CLIENTEDGE - PUSHBUTTON "&...", 1030, 87, 163, 50, 14 - PUSHBUTTON "&...", 1031, 141, 163, 50, 14 - PUSHBUTTON "&", 1032, 195, 163, 50, 14 - LTEXT " :", 1052, 7, 189, 121, 8 + PUSHBUTTON "&Создать...", 1030, 87, 163, 50, 14 + PUSHBUTTON "&Изменить...", 1031, 141, 163, 50, 14 + PUSHBUTTON "&Удалить", 1032, 195, 163, 50, 14 + LTEXT "Номер телефона будет набран как:", 1052, 7, 189, 121, 8 LTEXT "", 1053, 14, 203, 224, 16 END 102 DIALOGEX 0, 0, 252, 255 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "" +CAPTION "Общие" FONT 8, "MS Shell Dlg" BEGIN ICON 202, 2000, 7, 7, 21, 20 - LTEXT "& :", -1, 35, 12, 79, 8, SS_CENTERIMAGE + LTEXT "&Имя местоположения:", -1, 35, 12, 79, 8, SS_CENTERIMAGE EDITTEXT 1038, 118, 9, 127, 14, ES_AUTOHSCROLL - LTEXT " , .", 2001, 7, 35, 238, 8 - LTEXT "& :", -1, 7, 49, 161, 8 + LTEXT "Выберите место, из которого производится набор номера.", 2001, 7, 35, 238, 8 + LTEXT "&Страна или регион:", -1, 7, 49, 161, 8 COMBOBOX 1006, 7, 60, 175, 152, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL - LTEXT " &:", -1, 190, 49, 48, 8 + LTEXT "Код &города:", -1, 190, 49, 48, 8 EDITTEXT 1034, 190, 60, 48, 12, ES_AUTOHSCROLL - GROUPBOX "", 2002, 7, 80, 238, 92 - LTEXT " :", 2003, 14, 92, 224, 8 - LTEXT " - & , :", -1, 14, 106, 174, 8 + GROUPBOX "Правила", 2002, 7, 80, 238, 92 + LTEXT "При наборе номера из этого места:", 2003, 14, 92, 224, 8 + LTEXT " - для доступа &к внешней местной линии, набирать:", -1, 14, 106, 174, 8 EDITTEXT 1010, 190, 104, 48, 12, ES_AUTOHSCROLL - LTEXT " - & :", -1, 14, 122, 170, 8 + LTEXT " - а для доступа к внешней ме&ждународной линии:", -1, 14, 122, 170, 8 EDITTEXT 1011, 190, 120, 48, 12, ES_AUTOHSCROLL - LTEXT "& :", -1, 14, 138, 170, 8 + LTEXT "Д&ля междугородных звонков использовать код:", -1, 14, 138, 170, 8 EDITTEXT 1059, 190, 136, 48, 12, ES_AUTOHSCROLL - LTEXT "& :", -1, 14, 154, 170, 8 + LTEXT "Дл&я международных звонков использовать код:", -1, 14, 154, 170, 8 EDITTEXT 1060, 190, 152, 48, 12, ES_AUTOHSCROLL - AUTOCHECKBOX " & :", 1035, 14, 175, 170, 10 + AUTOCHECKBOX "Код откл&ючения режима оповещения:", 1035, 14, 175, 170, 10 COMBOBOX 1013, 190, 174, 48, 73, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL - LTEXT " :", -1, 14, 193, 70, 8 - AUTORADIOBUTTON "&", 1036, 123, 192, 50, 10, NOT WS_TABSTOP - AUTORADIOBUTTON "&", 1037, 177, 192, 54, 10, NOT WS_TABSTOP - LTEXT " :", 1052, 7, 219, 126, 8 + LTEXT "Тип набора номера:", -1, 14, 193, 70, 8 + AUTORADIOBUTTON "&тоновый", 1036, 123, 192, 50, 10, NOT WS_TABSTOP + AUTORADIOBUTTON "им&пульсный", 1037, 177, 192, 54, 10, NOT WS_TABSTOP + LTEXT "Номер телефона будет набран как:", 1052, 7, 219, 126, 8 LTEXT "", 1053, 14, 232, 224, 16 END 103 DIALOGEX 0, 0, 252, 218 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION " " +CAPTION "Код города" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " .", 2000, 7, 7, 238, 16 - LTEXT "& :", -1, 7, 31, 238, 8 + LTEXT "Правило набора номера определяет способ набора номеров с таким же или другим кодом города.", 2000, 7, 7, 238, 16 + LTEXT "&Правила набора номера:", -1, 7, 31, 238, 8 CONTROL "", 1033, "SysListView32", WS_BORDER | WS_TABSTOP | 0x0000801D, 7, 42, 238, 99, WS_EX_CLIENTEDGE - PUSHBUTTON "&...", 1030, 87, 145, 50, 14 - PUSHBUTTON "&...", 1031, 141, 145, 50, 14 - PUSHBUTTON "&", 1032, 195, 145, 50, 14 - GROUPBOX "", 2006, 7, 166, 238, 45 + PUSHBUTTON "&Создать...", 1030, 87, 145, 50, 14 + PUSHBUTTON "&Изменить...", 1031, 141, 145, 50, 14 + PUSHBUTTON "&Удалить", 1032, 195, 145, 50, 14 + GROUPBOX "Описание", 2006, 7, 166, 238, 45 LTEXT "", 1039, 14, 180, 224, 24 END 104 DIALOGEX 0, 0, 252, 234 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION " " +CAPTION "Телефонная карточка" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " """" .", 2000, 7, 7, 238, 8 - LTEXT "& :", -1, 7, 31, 238, 8 + LTEXT "Выберите используемую телефонную карточку или нажмите кнопку ""Создать"" для добавления другой карточки.", 2000, 7, 7, 238, 8 + LTEXT "&Типы карточек:", -1, 7, 31, 238, 8 CONTROL "", 1033, "SysListView32", WS_BORDER | WS_TABSTOP | 0x0000400D, 7, 42, 238, 63, WS_EX_CLIENTEDGE - PUSHBUTTON "&...", 1030, 87, 109, 50, 14 - PUSHBUTTON "&...", 1031, 141, 109, 50, 14 - PUSHBUTTON "&", 1032, 195, 109, 50, 14 - LTEXT " &:", -1, 7, 135, 91, 8 + PUSHBUTTON "&Создать...", 1030, 87, 109, 50, 14 + PUSHBUTTON "&Изменить...", 1031, 141, 109, 50, 14 + PUSHBUTTON "&Удалить", 1032, 195, 109, 50, 14 + LTEXT "Учетный &номер:", -1, 7, 135, 91, 8 EDITTEXT 1018, 102, 133, 143, 12, ES_AUTOHSCROLL - LTEXT "& PIN-:", -1, 7, 153, 91, 8 + LTEXT "&Личный PIN-код:", -1, 7, 153, 91, 8 EDITTEXT 1019, 102, 151, 143, 12, ES_AUTOHSCROLL - GROUPBOX " ", 2001, 7, 166, 238, 53 - LTEXT " :", -1, 14, 180, 87, 8 + GROUPBOX "Набираемые номера для", 2001, 7, 166, 238, 53 + LTEXT "междугородных звонков:", -1, 14, 180, 87, 8 LTEXT "", 1042, 106, 180, 132, 8 - LTEXT " :", -1, 14, 192, 88, 8 + LTEXT "международных звонков:", -1, 14, 192, 88, 8 LTEXT "", 1043, 106, 192, 132, 8 - LTEXT " :", -1, 14, 204, 84, 8 + LTEXT "местных звонков:", -1, 14, 204, 84, 8 LTEXT "", 1051, 106, 204, 132, 8 END 105 DIALOGEX 0, 0, 252, 218 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "" +CAPTION "Общие" FONT 8, "MS Shell Dlg" BEGIN ICON 203, 2000, 7, 7, 21, 20 - LTEXT "& :", -1, 35, 12, 64, 8, SS_CENTERIMAGE + LTEXT "&Имя карточки:", -1, 35, 12, 64, 8, SS_CENTERIMAGE EDITTEXT 1047, 105, 9, 140, 14, ES_AUTOHSCROLL - LTEXT " &:", -1, 7, 35, 238, 8 + LTEXT "Учетный &номер:", -1, 7, 35, 238, 8 EDITTEXT 1018, 7, 46, 116, 14, ES_AUTOHSCROLL - LTEXT "& PIN-:", -1, 7, 68, 238, 8 + LTEXT "&Личный PIN-код:", -1, 7, 68, 238, 8 EDITTEXT 1019, 7, 79, 116, 14, ES_AUTOHSCROLL - LTEXT " :", 1056, 14, 117, 224, 8 - GROUPBOX " ", 2001, 7, 105, 238, 66 + LTEXT "Эта карточка будет использоваться при:", 1056, 14, 117, 224, 8 + GROUPBOX "Использовать карточки", 2001, 7, 105, 238, 66 LTEXT "", 1000, 22, 131, 216, 8 LTEXT "", 1001, 22, 143, 216, 8 LTEXT "", 1002, 22, 155, 216, 8 @@ -108,97 +108,97 @@ END 106 DIALOGEX 0, 0, 252, 218 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION " " +CAPTION "Междугородные звонки" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "& :", -1, 7, 7, 238, 8 + LTEXT "&Номер для выхода на междугородную линию:", -1, 7, 7, 238, 8 EDITTEXT 1044, 7, 18, 116, 14, ES_AUTOHSCROLL - LTEXT " . .", 2000, 7, 40, 238, 24 - LTEXT "& :", -1, 7, 72, 174, 8 + LTEXT "Укажите последовательность выхода на междугородную линию. Последовательность шагов должна совпадать с приведенной на карточке.", 2000, 7, 40, 238, 24 + LTEXT "&Шаги набора номера при использовании карточки:", -1, 7, 72, 174, 8 CONTROL "List1", 1033, "SysListView32", WS_BORDER | WS_TABSTOP | 0x0000400D, 7, 83, 184, 74, WS_EX_CLIENTEDGE - PUSHBUTTON "&", 1022, 195, 83, 50, 14 - PUSHBUTTON "&", 1023, 195, 101, 50, 14 - PUSHBUTTON "&", 1024, 195, 119, 50, 14 - PUSHBUTTON "& ", 1025, 7, 161, 90, 14 - PUSHBUTTON "& ", 1018, 101, 161, 90, 14 - PUSHBUTTON "PIN-&", 1019, 7, 179, 90, 14 - PUSHBUTTON "& ...", 1020, 101, 179, 90, 14 - PUSHBUTTON "&...", 1017, 7, 197, 90, 14 - PUSHBUTTON "& ...", 1021, 101, 197, 90, 14 + PUSHBUTTON "В&верх", 1022, 195, 83, 50, 14 + PUSHBUTTON "Вни&з", 1023, 195, 101, 50, 14 + PUSHBUTTON "&Удалить", 1024, 195, 119, 50, 14 + PUSHBUTTON "Но&мер доступа", 1025, 7, 161, 90, 14 + PUSHBUTTON "У&четный номер", 1018, 101, 161, 90, 14 + PUSHBUTTON "PIN-&код", 1019, 7, 179, 90, 14 + PUSHBUTTON "В&ызываемый номер...", 1020, 101, 179, 90, 14 + PUSHBUTTON "О&жидание...", 1017, 7, 197, 90, 14 + PUSHBUTTON "Вв&едите цифры...", 1021, 101, 197, 90, 14 END 107 DIALOGEX 0, 0, 252, 218 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION " " +CAPTION "Международная связь" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "& :", -1, 7, 7, 238, 8 + LTEXT "&Номер для выхода на международную линию:", -1, 7, 7, 238, 8 EDITTEXT 1045, 7, 18, 116, 14, ES_AUTOHSCROLL - LTEXT " . .", 2000, 7, 40, 244, 24 - LTEXT "& :", -1, 7, 72, 174, 8 + LTEXT "Укажите последовательность выхода на международную линию. Последовательность шагов должна совпадать с приведенной на карточке.", 2000, 7, 40, 244, 24 + LTEXT "&Шаги набора номера при использовании карточки:", -1, 7, 72, 174, 8 CONTROL "List1", 1033, "SysListView32", WS_BORDER | WS_TABSTOP | 0x0000400D, 7, 83, 184, 74, WS_EX_CLIENTEDGE - PUSHBUTTON "&", 1022, 195, 83, 50, 14 - PUSHBUTTON "&", 1023, 195, 101, 50, 14 - PUSHBUTTON "&", 1024, 195, 119, 50, 14 - PUSHBUTTON "& ", 1025, 7, 161, 90, 14 - PUSHBUTTON "& ", 1018, 101, 161, 90, 14 - PUSHBUTTON "PIN-&", 1019, 7, 179, 90, 14 - PUSHBUTTON "& ...", 1020, 101, 179, 90, 14 - PUSHBUTTON "&...", 1017, 7, 197, 90, 14 - PUSHBUTTON "& ...", 1021, 101, 197, 90, 14 + PUSHBUTTON "В&верх", 1022, 195, 83, 50, 14 + PUSHBUTTON "Вни&з", 1023, 195, 101, 50, 14 + PUSHBUTTON "&Удалить", 1024, 195, 119, 50, 14 + PUSHBUTTON "Но&мер доступа", 1025, 7, 161, 90, 14 + PUSHBUTTON "У&четный номер", 1018, 101, 161, 90, 14 + PUSHBUTTON "PIN-&код", 1019, 7, 179, 90, 14 + PUSHBUTTON "В&ызываемый номер...", 1020, 101, 179, 90, 14 + PUSHBUTTON "О&жидание...", 1017, 7, 197, 90, 14 + PUSHBUTTON "Вв&едите цифры...", 1021, 101, 197, 90, 14 END 108 DIALOGEX 0, 0, 252, 226 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION " " +CAPTION "Местные звонки" FONT 8, "MS Shell Dlg" BEGIN - LTEXT "& :", -1, 7, 7, 238, 8 + LTEXT "&Номер для выхода на внешнюю линию:", -1, 7, 7, 238, 8 EDITTEXT 1008, 7, 18, 132, 14, ES_AUTOHSCROLL - LTEXT " . . .", 2000, 7, 40, 238, 32 - LTEXT "& :", -1, 7, 80, 238, 8 + LTEXT "Укажите последовательность выхода на местную линию. Последовательность шагов должна совпадать с приведенной на карточке. Для выполнения звонков без использования телефонной карточки оставьте поля пустыми.", 2000, 7, 40, 238, 32 + LTEXT "&Шаги набора номера при использовании карточки:", -1, 7, 80, 238, 8 CONTROL "List1", 1033, "SysListView32", WS_BORDER | WS_TABSTOP | 0x0000400D, 7, 91, 184, 74, WS_EX_CLIENTEDGE - PUSHBUTTON "&", 1022, 195, 91, 50, 14 - PUSHBUTTON "&", 1023, 195, 109, 50, 14 - PUSHBUTTON "&", 1024, 195, 127, 50, 14 - PUSHBUTTON "& ", 1025, 7, 169, 90, 14 - PUSHBUTTON "& ", 1018, 101, 169, 90, 14 - PUSHBUTTON "PIN-&", 1019, 7, 187, 90, 14 - PUSHBUTTON "& ...", 1020, 101, 187, 90, 14 - PUSHBUTTON "&...", 1017, 7, 205, 90, 14 - PUSHBUTTON "& ...", 1021, 101, 205, 90, 14 + PUSHBUTTON "В&верх", 1022, 195, 91, 50, 14 + PUSHBUTTON "Вни&з", 1023, 195, 109, 50, 14 + PUSHBUTTON "&Удалить", 1024, 195, 127, 50, 14 + PUSHBUTTON "Но&мер доступа", 1025, 7, 169, 90, 14 + PUSHBUTTON "У&четный номер", 1018, 101, 169, 90, 14 + PUSHBUTTON "PIN-&код", 1019, 7, 187, 90, 14 + PUSHBUTTON "В&ызываемый номер...", 1020, 101, 187, 90, 14 + PUSHBUTTON "О&жидание...", 1017, 7, 205, 90, 14 + PUSHBUTTON "Вв&едите цифры...", 1021, 101, 205, 90, 14 END 109 DIALOGEX 0, 0, 252, 257 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION EXSTYLE WS_EX_CONTEXTHELP -CAPTION " " +CAPTION "Новое правило набора номера" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " .", 2000, 7, 7, 238, 16 - LTEXT " :", -1, 7, 31, 122, 8 - LTEXT " &:", -1, 7, 45, 41, 8 + LTEXT "Это правило будет применяться только к звонкам с указанными кодом города и префиксом.", 2000, 7, 7, 238, 16 + LTEXT "Используемый код города:", -1, 7, 31, 122, 8 + LTEXT "Код &города:", -1, 7, 45, 41, 8 EDITTEXT 1034, 50, 42, 50, 14, ES_AUTOHSCROLL - LTEXT ", .", -1, 14, 78, 224, 8 - AUTORADIOBUTTON "& ", 1014, 14, 90, 224, 12, NOT WS_TABSTOP - AUTORADIOBUTTON "& :", 1015, 14, 104, 224, 12, NOT WS_TABSTOP - LTEXT "& :", 1057, 26, 117, 119, 8 + LTEXT "Префиксы, используемые с этим кодом города.", -1, 14, 78, 224, 8 + AUTORADIOBUTTON "&Включить все префиксы в код города", 1014, 14, 90, 224, 12, NOT WS_TABSTOP + AUTORADIOBUTTON "В&клюсчить только префикы из списка:", 1015, 14, 104, 224, 12, NOT WS_TABSTOP + LTEXT "Вк&лючаемые префиксы:", 1057, 26, 117, 119, 8 CONTROL "List1", 1033, "SysListView32", WS_BORDER | WS_TABSTOP | 0x0000411D, 25, 128, 66, 32, WS_EX_CLIENTEDGE - PUSHBUTTON "&...", 1005, 95, 128, 50, 14 - PUSHBUTTON "&", 1024, 95, 146, 50, 14 - LTEXT " , :", -1, 14, 184, 224, 8 - AUTOCHECKBOX "&:", 1012, 14, 198, 46, 10 + PUSHBUTTON "&Добавить...", 1005, 95, 128, 50, 14 + PUSHBUTTON "&Удалить", 1024, 95, 146, 50, 14 + LTEXT "При наборе номеров, содержащих указанные префиксы:", -1, 14, 184, 224, 8 + AUTOCHECKBOX "Н&абрать:", 1012, 14, 198, 46, 10 EDITTEXT 1007, 62, 196, 42, 14, ES_AUTOHSCROLL - AUTOCHECKBOX "& ", 1029, 14, 214, 85, 12 + AUTOCHECKBOX "На&брать код города", 1029, 14, 214, 85, 12 DEFPUSHBUTTON "OK", 1, 141, 236, 50, 14 - PUSHBUTTON "", 2, 195, 236, 50, 14 - RTEXT " ", 2001, 133, 31, 51, 8 - LTEXT "", 2002, 200, 31, 45, 8 + PUSHBUTTON "Отмена", 2, 195, 236, 50, 14 + RTEXT "Код города", 2001, 133, 31, 51, 8 + LTEXT "Префикс", 2002, 200, 31, 45, 8 CONTROL "", 2003, "STATIC", SS_BLACKFRAME | SS_SUNKEN, 180, 41, 1, 6 CONTROL "", 2004, "STATIC", SS_BLACKFRAME | SS_SUNKEN, 203, 41, 1, 6 RTEXT "X - X X X - X X X - X X X X", 2005, 133, 48, 112, 8 - GROUPBOX "", -1, 7, 64, 238, 102 - GROUPBOX "", -1, 7, 170, 238, 60 + GROUPBOX "Префиксы", -1, 7, 64, 238, 102 + GROUPBOX "Правила", -1, 7, 170, 238, 60 END 110 DIALOGEX 0, 0, 227, 82 @@ -210,87 +210,87 @@ BEGIN LTEXT "", 1039, 7, 23, 213, 8 EDITTEXT 1031, 7, 34, 213, 14, ES_AUTOHSCROLL DEFPUSHBUTTON "OK", 1, 116, 61, 50, 14 - PUSHBUTTON "", 2, 170, 61, 50, 14 + PUSHBUTTON "Отмена", 2, 170, 61, 50, 14 END 111 DIALOGEX 0, 0, 252, 124 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION EXSTYLE WS_EX_CONTEXTHELP -CAPTION "" +CAPTION "Ожидание" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " .", 2000, 7, 7, 238, 16 - AUTORADIOBUTTON " &", 1009, 7, 31, 238, 10, WS_GROUP - AUTORADIOBUTTON " & ", 1016, 7, 47, 238, 10, NOT WS_TABSTOP - AUTORADIOBUTTON " & :", 1048, 7, 63, 238, 10, NOT WS_TABSTOP - LTEXT "&.", -1, 58, 80, 187, 8 + LTEXT "Выберите тип ожидаемого сигнала перед продолжением набора номера.", 2000, 7, 7, 238, 16 + AUTORADIOBUTTON "Ждать &гудка", 1009, 7, 31, 238, 10, WS_GROUP + AUTORADIOBUTTON "Ждать &завершения голосового сообщения", 1016, 7, 47, 238, 10, NOT WS_TABSTOP + AUTORADIOBUTTON "Ждать &в течение:", 1048, 7, 63, 238, 10, NOT WS_TABSTOP + LTEXT "&сек.", -1, 58, 80, 187, 8 EDITTEXT 1050, 18, 77, 36, 14, ES_AUTOHSCROLL | WS_GROUP CONTROL "Spin1", 1049, "msctls_updown32", 0x00000036, 42, 77, 11, 14 DEFPUSHBUTTON "OK", 1, 141, 103, 50, 14 - PUSHBUTTON "", 2, 195, 103, 50, 14 + PUSHBUTTON "Отмена", 2, 195, 103, 50, 14 END 112 DIALOGEX 0, 0, 252, 111 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION EXSTYLE WS_EX_CONTEXTHELP -CAPTION " " +CAPTION "Вызываемый номер" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " . ?", 2000, 7, 7, 238, 24 - AUTOCHECKBOX " &/", 1027, 7, 39, 238, 10 - AUTOCHECKBOX " &", 1034, 7, 55, 238, 10 - AUTOCHECKBOX " &", 1008, 7, 71, 238, 10, WS_DISABLED + LTEXT "На этом шаге требуется указать способ набора номера при использовании телефонной карточки. Набор каких частей номера требуется производить?", 2000, 7, 7, 238, 24 + AUTOCHECKBOX "Набрать код &страны/региона", 1027, 7, 39, 238, 10 + AUTOCHECKBOX "Набрать код &города", 1034, 7, 55, 238, 10 + AUTOCHECKBOX "Набрать &номер", 1008, 7, 71, 238, 10, WS_DISABLED DEFPUSHBUTTON "OK", 1, 141, 91, 50, 14 - PUSHBUTTON "", 2, 195, 91, 50, 14 + PUSHBUTTON "Отмена", 2, 195, 91, 50, 14 END 113 DIALOGEX 0, 0, 252, 218 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "" +CAPTION "Дополнительно" FONT 8, "MS Shell Dlg" BEGIN ICON 201, 2000, 7, 7, 20, 20 - LTEXT " :", -1, 40, 12, 205, 16 - LTEXT "& :", -1, 7, 35, 238, 8 + LTEXT "На компьютере установлены следующие службы доступа к телефонии:", -1, 40, 12, 205, 16 + LTEXT "С&лужбы доступа:", -1, 7, 35, 238, 8 LISTBOX 1033, 7, 46, 238, 147, LBS_STANDARD | LBS_NOINTEGRALHEIGHT | WS_TABSTOP - PUSHBUTTON "&...", 1005, 87, 197, 50, 14 - PUSHBUTTON "&", 1024, 141, 197, 50, 14 - PUSHBUTTON "&...", 1031, 195, 197, 50, 14 + PUSHBUTTON "До&бавить...", 1005, 87, 197, 50, 14 + PUSHBUTTON "&Удалить", 1024, 141, 197, 50, 14 + PUSHBUTTON "&Настроить...", 1031, 195, 197, 50, 14 END 114 DIALOGEX 20, 15, 252, 135 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION " " +CAPTION "Установка службы доступа" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " """".", 2000, 7, 7, 241, 16 - LTEXT "& :", -1, 7, 31, 155, 10 + LTEXT "Выберите устанавливаемую службу доступа из списка и нажмите кнопку ""Добавить"".", 2000, 7, 7, 241, 16 + LTEXT "С&лужбы доступа к телефонии:", -1, 7, 31, 155, 10 LISTBOX 1055, 7, 42, 238, 74, LBS_STANDARD | WS_TABSTOP - PUSHBUTTON "&", 1005, 141, 114, 50, 14 - DEFPUSHBUTTON "", 2, 195, 114, 50, 14 + PUSHBUTTON "&Добавить", 1005, 141, 114, 50, 14 + DEFPUSHBUTTON "Отмена", 2, 195, 114, 50, 14 END 115 DIALOGEX 10, 10, 303, 228 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION EXSTYLE WS_EX_CONTEXTHELP -CAPTION " " +CAPTION "Сведения о местонахождении" FONT 8, "MS Shell Dlg" BEGIN CONTROL 302, 302, "STATIC", SS_BITMAP, 10, 10, 88, 155 - LTEXT " .", 2000, 107, 15, 188, 25 - LTEXT "&, :", -1, 107, 43, 189, 10 + LTEXT "Перед созданием телефонного или модемного подключения требуется ввести сведения о вашем текущем нахождении.", 2000, 107, 15, 188, 25 + LTEXT "&Страна, где вы сейчас находитесь:", -1, 107, 43, 189, 10 COMBOBOX 1006, 107, 55, 180, 68, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL - LTEXT " &", -1, 107, 73, 189, 10 + LTEXT "Телефонный код &города", -1, 107, 73, 189, 10 EDITTEXT 1034, 107, 87, 40, 12, ES_AUTOHSCROLL - LTEXT " & :", -1, 107, 104, 189, 10 + LTEXT "Код выхода на линию поста&вщика услуг:", -1, 107, 104, 189, 10 EDITTEXT 1058, 106, 118, 40, 12, ES_UPPERCASE | ES_AUTOHSCROLL - LTEXT " ( ):", -1, 107, 136, 189, 10 + LTEXT "Код выхода на городкую линию (для офисных АТС):", -1, 107, 136, 189, 10 EDITTEXT 1010, 107, 149, 40, 12, ES_UPPERCASE | ES_AUTOHSCROLL - LTEXT " :", -1, 107, 167, 189, 10 - AUTORADIOBUTTON "& ", 1036, 107, 178, 73, 14, WS_GROUP | NOT WS_TABSTOP - AUTORADIOBUTTON "& ", 1037, 192, 178, 80, 14, NOT WS_TABSTOP + LTEXT "Тип набора номера:", -1, 107, 167, 189, 10 + AUTORADIOBUTTON "&тоновый набор", 1036, 107, 178, 73, 14, WS_GROUP | NOT WS_TABSTOP + AUTORADIOBUTTON "&импульсный набор", 1037, 192, 178, 80, 14, NOT WS_TABSTOP DEFPUSHBUTTON "OK", 1, 192, 204, 50, 14 - PUSHBUTTON "", 2, 246, 204, 50, 14 + PUSHBUTTON "Отмена", 2, 246, 204, 50, 14 END 400 DIALOGEX 0, 0, 290, 151 @@ -298,149 +298,149 @@ STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN CONTROL 302, 302, "STATIC", SS_BITMAP, 0, 0, 88, 155 - LTEXT " .", 2000, 95, 0, 188, 25 - LTEXT "&, :", -1, 95, 30, 188, 10 + LTEXT "Перед созданием телефонного или модемного подключения требуется ввести сведения в вашем текущем нахождении.", 2000, 95, 0, 188, 25 + LTEXT "&Страна, где вы сейчас находитесь:", -1, 95, 30, 188, 10 COMBOBOX 1006, 95, 41, 177, 68, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL - LTEXT " &:", -1, 95, 60, 188, 10 + LTEXT "Телефонный код &города:", -1, 95, 60, 188, 10 EDITTEXT 1034, 95, 73, 40, 14, ES_AUTOHSCROLL - LTEXT "& ( ):", -1, 95, 96, 188, 10 + LTEXT "&Код выхода на городскую линию (для офисных АТС):", -1, 95, 96, 188, 10 EDITTEXT 1010, 95, 107, 40, 14, ES_UPPERCASE | ES_AUTOHSCROLL - LTEXT " :", -1, 95, 129, 159, 10 - AUTORADIOBUTTON "& ", 1036, 95, 139, 67, 12, WS_GROUP | NOT WS_TABSTOP - AUTORADIOBUTTON "& ", 1037, 167, 139, 79, 12, NOT WS_TABSTOP + LTEXT "Тип набора номера:", -1, 95, 129, 159, 10 + AUTORADIOBUTTON "&тоновый набор", 1036, 95, 139, 67, 12, WS_GROUP | NOT WS_TABSTOP + AUTORADIOBUTTON "&импульсный набор", 1037, 167, 139, 79, 12, NOT WS_TABSTOP END 500 DIALOGEX 0, 0, 235, 88 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_CENTER | WS_POPUPWINDOW | WS_CAPTION -CAPTION " ReactOS" +CAPTION "Обозреватель ReactOS" FONT 8, "MS Shell Dlg" BEGIN ICON 504, 501, 13, 14, 21, 20 LTEXT "", 502, 47, 15, 180, 32 - AUTOCHECKBOX "& ", 503, 47, 47, 180, 12 + AUTOCHECKBOX "&Всегда доверять содержимому этой страницы", 503, 47, 47, 180, 12 DEFPUSHBUTTON "&OK", 505, 110, 65, 50, 14 - PUSHBUTTON "&", 506, 164, 65, 50, 14 + PUSHBUTTON "&Отмена", 506, 164, 65, 50, 14 END STRINGTABLE BEGIN - 1 " " - 2 " ." - 3 "" - 4 " """"." - 5 " " - 6 " " - 7 " " - 8 " " - 9 " " - 10 "" - 11 "" - 12 " .\n\n 0 9, *, # ." - 13 " .\n\n 0 9, *, #, ." - 14 " .\n\n 0 9." - 15 " ." - 16 " %1" - 17 " %1 " - 18 " " - 19 " " - 20 "" - 21 "" - 22 " " - 23 " """" ." - 24 " '%2' %1." - 25 " '%2' %1." - 26 " %1." - 27 " %1." - 28 " '%2' %1, ." - 29 " '%2' %1, ." - 30 " %1, ." - 31 " %1, ." - 32 " '1' , ." - 33 " " - 34 " ." - 35 " " - 36 " ( * #) ." - 37 " .\n\n 0 9 ." - 38 " %1!d! ." - 39 " ." - 40 " ." - 41 " PIN-." - 42 " ." - 43 " ." - 44 " /, ." - 45 " / ." - 46 " ." - 47 " /." - 48 " ." - 49 " ." - 50 " ." - 51 " ." - 52 " ." - 53 " ." - 54 " ." - 55 " ." - 56 " ." - 57 " ." - 58 " ." - 59 " " - 60 " . ." - 61 " . """" ." - 62 " , . """" ." - 63 " ." - 64 " ." - 65 " PIN-." - 66 " . """", """" """"." - 67 " ." - 68 " ." - 69 " ." - 70 "" - 71 " ?" - 72 "< >" - 73 " , ." - 74 "&:" - 75 "&:" - 76 " .\n\n 0 9, ." - 77 " " - 78 " ?" - 79 " ?" - 80 " ?" - 81 " ." - 82 " . ." - 83 " , . , . , .\n ?" - 84 " " - 85 " " - 86 "< >" - 87 " .\n\n 0 9, A D, *, #, +, !, ." - 88 " ." - 89 " ." - 90 " , .\n ?" - 91 " .\n ?" - 92 " .\n ?" - 93 " .\n ?" - 1064 " . ." - 1065 " " + 1 "Телефон и модем" + 2 "Настройка правил набора номера и иных параметров при работе с модемом." + 3 "Размещение" + 4 "Для создания нового размещения нажмите кнопку ""Создать""." + 5 "Новое место" + 6 "Изменение местонахождения" + 7 "Новая карточка" + 8 "Изменить телефонную карточку" + 9 "Код города" + 10 "Префиксы" + 11 "Правило" + 12 "Введен недопустимый символ.\n\nДопустимыми символами являются цифры от 0 до 9, *, # и запятая." + 13 "Введен недопустимый символ.\n\nДопустимыми символами являются цифры от 0 до 9, *, #, пробел и запятая." + 14 "Введен недопустимый символ.\n\nДопустимыми символами являются цифры от 0 до 9." + 15 "Введен недопустимый символ." + 16 "Набрать %1" + 17 "Набрать %1 и код города" + 18 "Набрать код города" + 19 "Набрать только номер" + 20 "Все" + 21 "Выбранный" + 22 "Изменение правила набора номера" + 23 "Выберите элемент списка для просмотра его описания или нажмите кнопку ""Создать"" для добавления нового." + 24 "Набрать '%2' и код города перед номером для всех номеров с кодом города %1." + 25 "Набрать '%2' перед номером для всех номеров с кодом города %1." + 26 "Набрать код города перед номером для всех номеров с кодом города %1." + 27 "Набрать только номер телефона для всех номеров с кодом города %1." + 28 "Набрать '%2' и код города перед номером для номеров с кодом города %1, содержащих указанные префиксы." + 29 "Набрать '%2' перед номером для номеров с кодом города %1, содержащих указанные префиксы." + 30 "Набрать код города перед номером для номеров с кодом города %1, содержащих указанные префиксы." + 31 "Набрать только номер телефона для номеров с кодом города %1, содержащих указанные префиксы." + 32 "Набрать '1' перед набором номера для всех кодов городов, включая код города для всех префиксов." + 33 "Добавить префикс" + 34 "Введите один или несколько префиксов разделенных пробелами или запятыми." + 35 "Введите цифры" + 36 "Введите одну или несколько цифр (а также * и #) которые должны быть набраны." + 37 "Введен неправильный символ.\n\nДопустимыми символами являются цифры от 0 до 9 и пробел." + 38 "Ожидание %1!d! сек." + 39 "Набор номера доступа." + 40 "Набор номера учетной записи." + 41 "Набрать PIN-код." + 42 "Ждать гудка." + 43 "Ожидание окончания голосового сообщения." + 44 "Набрать код страны/региона, код города и номер." + 45 "Набрать код страны/региона и номер." + 46 "Набрать код города и номер." + 47 "Набрать код страны/региона." + 48 "Набрать код города." + 49 "Набор номера." + 50 "наборе междугородных номеров." + 51 "наборе международных номеров." + 52 "наборе местных номеров." + 53 "Правила набора номера для этой карточки не определены." + 54 "Необходимо ввести код носителя для междугородных звонков для этого размещения." + 55 "Необходимо ввести имя для этого размещения." + 56 "Необходимо ввести код города для этого размещения." + 57 "Для отключения режима оповещения требуется ввести номер." + 58 "Необходимо выбрать страну или регион из которого производится вызов." + 59 "Сведения отсутствуют" + 60 "Введенное имя размещения уже используется. Введите другое имя." + 61 "Отсутствуют необходимые сведения для использования этой телефонной карточки. Нажмите кнопку ""Изменить"" и укажите отсутствующие сведения или выберите другую карточку." + 62 "Требуется указать карточку, используемую по умолчанию. Выберите карточку из списка или нажмите кнопку ""Создать"" для добавления новой карточки." + 63 "Необходимо ввести имя телефонной карточки." + 64 "Необходимо ввести учетный номер." + 65 "Необходимо ввести PIN-код." + 66 "Правила набора номера для этой карточки не определены. Для создания правила выберите вкладку ""Междугородный"", ""Международный"" или ""Местный""." + 67 "Правило для междугородного звонка требует указания номера доступа." + 68 "Правило для международного звонка требует указания номера доступа." + 69 "Правило для местного звонка требует указания номера доступа." + 70 "Нет" + 71 "Удалить выбранного поставщика услуг телефонной службы?" + 72 "<нет установленных поставщиков услуг>" + 73 "Необходимо ввести префиксы, для которых применимо это правило." + 74 "&Цифры:" + 75 "&Префиксы:" + 76 "Введен неправильный символ.\n\nДопустимыми символами являются цифры от 0 до 9, пробел и запятая." + 77 "Подтверждение удаления" + 78 "Подтверждаете удаление этого размещения?" + 79 "Подтверждаете удаление этой карточки?" + 80 "Подтверждаете удаление этого правила?" + 81 "Необходимо ввести набираемые цифры." + 82 "Введенное имя карточки уже используется. Введите другое имя." + 83 "Требуется указание сведений о местонахождении, откуда производится вызов. Если не указать эти сведения, данная программа может неправильно набирать номер. Кроме того, некоторые приложения отвечают на отмену ввода данных повторной их отправкой.\nОтменить ввод данных?" + 84 "Подтверждение отмены" + 85 "Мое размещение" + 86 "<отсутствуют поставщики служб доступа для установки>" + 87 "Введен недопустимый символ.\n\nДопустимыми символами являются цифры от 0 до 9, буквы от A до D, *, #, +, !, пробел и запятая." + 88 "Необходимо ввести код носителя для международных звонков для этого размещения." + 89 "Необходимо ввести код носителя для этого размещения." + 90 "С этой страницы произведена попытка произвести вызов или наблюдать за вызовами, производимыми на этом компьютере.\nПродолжить выполнение?" + 91 "С этой страницы произведена попытка получить доступ к информации каталога сети.\nПродолжить выполнение?" + 92 "С этой страницы произведена попытка получить доступ или изменить информацию о сетевых конференциях.\nПродолжить выполнение?" + 93 "С этой страницы произведена попытка получить доступ или изменить информацию в реестре.\nРазрешить и продолжить выполнение?" + 1064 "Не удалось открыть панель управления телефоном и модемом. Возможны проблемы с запуском приложения." + 1065 "Удаленный поставщик" 15800 "23" - 15801 "0,"" "","""","""","""","""","""","""","""","""",1" - 15802 "1,"" AT&T 1010ATT1"","""",""G"",""J1FG"",""J011EFG"","""","""",""1010288"",""1010288"",1" - 15803 "2,""AT&T 1010ATT0"","""",""G"",""J0FG$TH"",""J01EFG$TH"","""","""",""1010288"",""1010288"",1" - 15804 "3,""AT&T 1-800-321-0288"","""",""G"",""J$TFG$TH"",""J$T01EFG$TH"","""","""",""18003210288"",""18003210288"",1" - 15805 "4,"" MCI 10102221"","""",""G"",""J1FG"",""J011EFG"","""","""",""1010222"",""1010222"",1" - 15806 "5,""MCI 10102220"","""",""G"",""J0FG$TH"",""J01EFG$TH"","""","""",""1010222"",""1010222"",1" - 15807 "6,""MCI 1-800-888-8000"","""",""G"",""J,,,,,,TH,,FG"",""J,,,,,,TH,,011EFG"","""","""",""18008888000"",""18008888000"",1" - 15808 "7,""MCI 1-800-674-0700"","""",""G"",""J,,,,,,TH,,FG"",""J,,,,,,TH,,011EFG"","""","""",""18006740700"",""18006740700"",1" - 15809 "8,""MCI 1-800-674-7000"","""",""G"",""J,,,,,,TH,,FG"",""J,,,,,,TH,,011EFG"","""","""",""18006747000"",""18006747000"",1" - 15810 "9,"" US Sprint 10103331"","""",""G"",""J1FG"",""J011EFG"","""","""",""1010333"",""1010333"",1" - 15811 "10,""US Sprint 10103330"","""",""G"",""J0FG$TH"",""J01EFG$TH"","""","""",""1010333"",""1010333"",1" - 15812 "11,""US Sprint 1-800-877-8000"","""",""G"",""J,,,T0FG,,H"",""J,,,T01EFG#,H"","""","""",""18008778000"",""18008778000"",1" - 15813 "12,"" 0"","""",""G"",""0FG$TH"",""01EFG$TH"","""","""","""","""",1" + 15801 "0,""Не используется"","""","""","""","""","""","""","""","""",1" + 15802 "1,""Прямой канал AT&T через 1010ATT1"","""",""G"",""J1FG"",""J011EFG"","""","""",""1010288"",""1010288"",1" + 15803 "2,""AT&T через 1010ATT0"","""",""G"",""J0FG$TH"",""J01EFG$TH"","""","""",""1010288"",""1010288"",1" + 15804 "3,""AT&T через 1-800-321-0288"","""",""G"",""J$TFG$TH"",""J$T01EFG$TH"","""","""",""18003210288"",""18003210288"",1" + 15805 "4,""Прямой канал MCI через 10102221"","""",""G"",""J1FG"",""J011EFG"","""","""",""1010222"",""1010222"",1" + 15806 "5,""MCI через 10102220"","""",""G"",""J0FG$TH"",""J01EFG$TH"","""","""",""1010222"",""1010222"",1" + 15807 "6,""MCI через 1-800-888-8000"","""",""G"",""J,,,,,,TH,,FG"",""J,,,,,,TH,,011EFG"","""","""",""18008888000"",""18008888000"",1" + 15808 "7,""MCI через 1-800-674-0700"","""",""G"",""J,,,,,,TH,,FG"",""J,,,,,,TH,,011EFG"","""","""",""18006740700"",""18006740700"",1" + 15809 "8,""MCI через 1-800-674-7000"","""",""G"",""J,,,,,,TH,,FG"",""J,,,,,,TH,,011EFG"","""","""",""18006747000"",""18006747000"",1" + 15810 "9,""Прямой канал US Sprint через 10103331"","""",""G"",""J1FG"",""J011EFG"","""","""",""1010333"",""1010333"",1" + 15811 "10,""US Sprint через 10103330"","""",""G"",""J0FG$TH"",""J01EFG$TH"","""","""",""1010333"",""1010333"",1" + 15812 "11,""US Sprint через 1-800-877-8000"","""",""G"",""J,,,T0FG,,H"",""J,,,T01EFG#,H"","""","""",""18008778000"",""18008778000"",1" + 15813 "12,""Телефонная карточка через 0"","""",""G"",""0FG$TH"",""01EFG$TH"","""","""","""","""",1" 15814 "13,""Carte France Telecom"","""",""T3010,H,0FG#"",""T3010,H,0FG#"",""T3010,H,00EFG#"","""","""","""","""",1" 15815 "14,""Mercury (UK)"","""",""J$TH,0FG"",""J$TH,0FG"",""J$TH,0FG"","""",""0500800800"",""0500800800"",""0500800800"",1" 15816 "15,""British Telecom (UK)"","""",""J$H,0FG"",""J$H,0FG"",""J$H,00EFG"","""",""144"",""144"".""144"",1" - 15817 "16,""CLEAR Communications ( )"","""",""J$TH,0FG"",""J$TH,0FG"",""J$TH,00EFG"","""",""0502333"",""0502333"",""0502333"",1" + 15817 "16,""CLEAR Communications (Новая Зеландия)"","""",""J$TH,0FG"",""J$TH,0FG"",""J$TH,00EFG"","""",""0502333"",""0502333"",""0502333"",1" 15818 "17,""Telecom New Zealand"","""",""J,0FG?H"",""J,0FG?H"",""J,00EFG?H"","""",""012"",""012"",""012"",1" - 15819 "18,""Global Card ( - )"","""",""G"",""0FG"",""J,102880$TFG$H"","""","""","""",""0080"",1" - 15820 "19,""Telstra () 1818 ()"","""",""J$TH,FG#"",""J$TH,FG#"",""J$TH,0011EFG#"","""",""1818"",""1818"",""1818"",1" - 15821 "20,""Telstra () 1818 ()"","""",""J$TH,FG#"",""J$TH,FG#"",""J$TH,0015EFG#"","""",""1818"",""1818"",""1818"",1" - 15822 "21,""Optus () 1812"","""",""FG"",""FG"",""J@TH,0011EFG"","""","""","""",""1812"",1" - 15823 "22,""Optus () 008551812"","""",""FG"",""FG"",""J@TH,0011EFG"","""","""","""",""008551812"",1" + 15819 "18,""Global Card (Тайвань - США)"","""",""G"",""0FG"",""J,102880$TFG$H"","""","""","""",""0080"",1" + 15820 "19,""Telstra (Австралия) через 1818 (голосом)"","""",""J$TH,FG#"",""J$TH,FG#"",""J$TH,0011EFG#"","""",""1818"",""1818"",""1818"",1" + 15821 "20,""Telstra (Австралия) через 1818 (факс)"","""",""J$TH,FG#"",""J$TH,FG#"",""J$TH,0015EFG#"","""",""1818"",""1818"",""1818"",1" + 15822 "21,""Optus (Австралия) через 1812"","""",""FG"",""FG"",""J@TH,0011EFG"","""","""","""",""1812"",1" + 15823 "22,""Optus (Австралия) через 008551812"","""",""FG"",""FG"",""J@TH,0011EFG"","""","""","""",""008551812"",1" END diff --git a/dll/win32/tapiui/lang/uk-UA.rc b/dll/win32/tapiui/lang/uk-UA.rc index 7eff0eebde6..67a147e9fca 100644 --- a/dll/win32/tapiui/lang/uk-UA.rc +++ b/dll/win32/tapiui/lang/uk-UA.rc @@ -10,105 +10,105 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT 101 DIALOGEX 0, 0, 252, 218 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION " " +CAPTION "Правила набору номера" FONT 8, "MS Shell Dlg" BEGIN ICON 201, 2000, 7, 7, 21, 20 - LTEXT " . , .", -1, 35, 7, 210, 16 - LTEXT "&:", -1, 7, 35, 210, 8 + LTEXT "Нижченаведений список містить вказані розташування. Виберіть розташування, з якого ви телефонуєте.", -1, 35, 7, 210, 16 + LTEXT "&Розташування:", -1, 7, 35, 210, 8 CONTROL "", 1033, "SysListView32", WS_BORDER | WS_TABSTOP | 0x0000011D, 7, 46, 238, 105, WS_EX_CLIENTEDGE - PUSHBUTTON "&...", 1030, 87, 155, 50, 14 - PUSHBUTTON "&...", 1031, 141, 155, 50, 14 - PUSHBUTTON "&", 1032, 195, 155, 50, 14 - LTEXT " :", 1052, 7, 181, 100, 8 + PUSHBUTTON "&Створити...", 1030, 87, 155, 50, 14 + PUSHBUTTON "З&мінити...", 1031, 141, 155, 50, 14 + PUSHBUTTON "В&идалити", 1032, 195, 155, 50, 14 + LTEXT "Номер телефону буде набрано як:", 1052, 7, 181, 100, 8 LTEXT "", 1053, 14, 195, 224, 16 END 102 DIALOGEX 0, 0, 252, 255 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "" +CAPTION "Загальні" FONT 8, "MS Shell Dlg" BEGIN ICON 202, 2000, 7, 7, 20, 20 - LTEXT "&' :", -1, 35, 11, 56, 8, SS_CENTERIMAGE + LTEXT "&Ім'я розташування:", -1, 35, 11, 56, 8, SS_CENTERIMAGE EDITTEXT 1038, 96, 8, 149, 14, ES_AUTOHSCROLL - LTEXT " , .", 2001, 7, 33, 238, 8 - LTEXT "&/:", -1, 7, 49, 161, 8 + LTEXT "Укажіть розташування, звідки ви телефонуєте.", 2001, 7, 33, 238, 8 + LTEXT "&Країна/регіон:", -1, 7, 49, 161, 8 COMBOBOX 1006, 7, 60, 175, 200, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL - LTEXT " &:", -1, 190, 49, 48, 8 + LTEXT "Код &міста:", -1, 190, 49, 48, 8 EDITTEXT 1034, 190, 60, 48, 12, ES_AUTOHSCROLL - GROUPBOX " ", 2002, 7, 80, 238, 92 - LTEXT " , :", 2003, 14, 92, 224, 8 - LTEXT " & :", -1, 14, 106, 170, 8 + GROUPBOX "Правила набору номера", 2002, 7, 80, 238, 92 + LTEXT "Телефонуючи з цього розташування, застосовувати такі правила:", 2003, 14, 92, 224, 8 + LTEXT "для доступу до &зовнішньої місцевої лінії набирати:", -1, 14, 106, 170, 8 EDITTEXT 1010, 190, 104, 48, 12, ES_AUTOHSCROLL - LTEXT " & :", -1, 14, 122, 170, 8 + LTEXT "для доступу до зовнішньої мі&жміської лінії набирати:", -1, 14, 122, 170, 8 EDITTEXT 1011, 190, 120, 48, 12, ES_AUTOHSCROLL - LTEXT " & :", -1, 14, 138, 170, 8 + LTEXT "для міжміськ&их дзвінків використовувати код:", -1, 14, 138, 170, 8 EDITTEXT 1059, 190, 136, 48, 12, ES_AUTOHSCROLL - LTEXT "& :", -1, 14, 154, 170, 8 + LTEXT "дл&я міжнародних дзвінків використовувати код:", -1, 14, 154, 170, 8 EDITTEXT 1060, 190, 152, 48, 12, ES_AUTOHSCROLL - AUTOCHECKBOX " & :", 1035, 14, 177, 170, 10 + AUTOCHECKBOX "Код вимкнення режиму очіку&ючого дзвінка:", 1035, 14, 177, 170, 10 COMBOBOX 1013, 190, 176, 48, 73, CBS_DROPDOWN | CBS_SORT | WS_VSCROLL - LTEXT " :", -1, 14, 195, 40, 8 - AUTORADIOBUTTON "&", 1036, 58, 194, 50, 10, NOT WS_TABSTOP - AUTORADIOBUTTON "&", 1037, 112, 194, 50, 10, NOT WS_TABSTOP - LTEXT " :", 1052, 7, 219, 100, 8 + LTEXT "Тип набору номера:", -1, 14, 195, 40, 8 + AUTORADIOBUTTON "&тоновий", 1036, 58, 194, 50, 10, NOT WS_TABSTOP + AUTORADIOBUTTON "ім&пульсний", 1037, 112, 194, 50, 10, NOT WS_TABSTOP + LTEXT "Номер телефону буде набрано як:", 1052, 7, 219, 100, 8 LTEXT "", 1053, 14, 232, 224, 16 END 103 DIALOGEX 0, 0, 252, 218 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION " " +CAPTION "Правила набору коду міста" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " .", 2000, 7, 7, 238, 16 - LTEXT "& :", -1, 7, 31, 238, 8 + LTEXT "Правило набору коду міста визначає спосіб набору номерів із таким самим або іншим кодом міста.", 2000, 7, 7, 238, 16 + LTEXT "&Правила набору коду міста:", -1, 7, 31, 238, 8 CONTROL "", 1033, "SysListView32", WS_BORDER | WS_TABSTOP | 0x0000801D, 7, 42, 238, 99, WS_EX_CLIENTEDGE - PUSHBUTTON "&...", 1030, 87, 147, 50, 14 - PUSHBUTTON "&...", 1031, 141, 147, 50, 14 - PUSHBUTTON "&", 1032, 195, 147, 50, 14 - GROUPBOX "", 2006, 7, 166, 238, 45 + PUSHBUTTON "&Створити...", 1030, 87, 147, 50, 14 + PUSHBUTTON "З&мінити...", 1031, 141, 147, 50, 14 + PUSHBUTTON "В&идалити", 1032, 195, 147, 50, 14 + GROUPBOX "Опис", 2006, 7, 166, 238, 45 LTEXT "", 1039, 14, 180, 224, 24 END 104 DIALOGEX 0, 0, 252, 218 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION " " +CAPTION "Телефонна картка" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " , , """", .", 2000, 7, 7, 238, 8 - LTEXT "& :", -1, 7, 23, 238, 8 + LTEXT "Виберіть телефонну картку, яка використовуватиметься, або натисніть кнопку ""Створити"", щоб додати іншу картку.", 2000, 7, 7, 238, 8 + LTEXT "&Типи карток:", -1, 7, 23, 238, 8 CONTROL "", 1033, "SysListView32", WS_BORDER | WS_TABSTOP | 0x0000400D, 7, 34, 238, 63, WS_EX_CLIENTEDGE - PUSHBUTTON "&...", 1030, 87, 103, 50, 14 - PUSHBUTTON "&...", 1031, 141, 103, 50, 14 - PUSHBUTTON "&", 1032, 195, 103, 50, 14 - LTEXT " &:", -1, 7, 127, 91, 8 + PUSHBUTTON "&Створити...", 1030, 87, 103, 50, 14 + PUSHBUTTON "З&мінити...", 1031, 141, 103, 50, 14 + PUSHBUTTON "З&мінити", 1032, 195, 103, 50, 14 + LTEXT "Обліковий &номер:", -1, 7, 127, 91, 8 EDITTEXT 1018, 102, 125, 143, 12, ES_AUTOHSCROLL - LTEXT "& PIN-:", -1, 7, 145, 91, 8 + LTEXT "Осо&бистий PIN-код:", -1, 7, 145, 91, 8 EDITTEXT 1019, 102, 143, 143, 12, ES_AUTOHSCROLL - GROUPBOX ", ", 2001, 7, 158, 238, 53 - LTEXT " :", -1, 14, 172, 84, 8 + GROUPBOX "Номери, які слід набирати для", 2001, 7, 158, 238, 53 + LTEXT "міжміських дзвінків:", -1, 14, 172, 84, 8 LTEXT "", 1042, 102, 172, 136, 8 - LTEXT " :", -1, 14, 184, 84, 8 + LTEXT "міжнародних дзвінків:", -1, 14, 184, 84, 8 LTEXT "", 1043, 102, 184, 136, 8 - LTEXT " :", -1, 14, 196, 84, 8 + LTEXT "місцевих дзвінків:", -1, 14, 196, 84, 8 LTEXT "", 1051, 102, 196, 136, 8 END 105 DIALOGEX 0, 0, 252, 218 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "" +CAPTION "Загальні" FONT 8, "MS Shell Dlg" BEGIN ICON 203, 2000, 7, 7, 20, 20 - LTEXT "&' :", -1, 35, 12, 64, 8, SS_CENTERIMAGE + LTEXT "&Ім'я картки:", -1, 35, 12, 64, 8, SS_CENTERIMAGE EDITTEXT 1047, 105, 9, 140, 14, ES_AUTOHSCROLL - LTEXT " &:", -1, 7, 35, 238, 8 + LTEXT "Обліковий &номер:", -1, 7, 35, 238, 8 EDITTEXT 1018, 7, 46, 116, 14, ES_AUTOHSCROLL - LTEXT "& PIN-:", -1, 7, 68, 238, 8 + LTEXT "Осо&бистий PIN-код:", -1, 7, 68, 238, 8 EDITTEXT 1019, 7, 80, 116, 14, ES_AUTOHSCROLL - LTEXT " :", 1056, 14, 117, 224, 8 - GROUPBOX "³ ", 2001, 7, 105, 238, 66 + LTEXT "Ця телефонна картка застосовуватиметься за:", 1056, 14, 117, 224, 8 + GROUPBOX "Відомості про телефонну картку", 2001, 7, 105, 238, 66 LTEXT "", 1000, 22, 131, 216, 8 LTEXT "", 1001, 22, 143, 216, 8 LTEXT "", 1002, 22, 155, 216, 8 @@ -116,97 +116,97 @@ END 106 DIALOGEX 0, 0, 252, 218 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "̳" +CAPTION "Міжміські" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " & :", -1, 7, 7, 238, 8 + LTEXT "Номер для ви&ходу на міжміську лінію:", -1, 7, 7, 238, 8 EDITTEXT 1044, 7, 18, 140, 14, ES_AUTOHSCROLL - LTEXT " . , .", 2000, 7, 40, 238, 24 - LTEXT " & :", -1, 7, 72, 80, 8 + LTEXT "За допомогою кнопок укажіть послідовність виходу на міжміську лінію. Укажіть послідовність кроків у тому порядку, як вони зазначені на картці.", 2000, 7, 40, 238, 24 + LTEXT "Кроки на&бору номера за використання картки:", -1, 7, 72, 80, 8 CONTROL "List1", 1033, "SysListView32", WS_BORDER | WS_TABSTOP | 0x0000400D, 7, 83, 184, 74, WS_EX_CLIENTEDGE - PUSHBUTTON "&", 1022, 195, 83, 50, 14 - PUSHBUTTON "&", 1023, 195, 101, 50, 14 - PUSHBUTTON "&", 1024, 195, 119, 50, 14 - PUSHBUTTON "& ", 1025, 7, 161, 90, 14 - PUSHBUTTON " &", 1018, 101, 161, 90, 14 - PUSHBUTTON "PIN-&", 1019, 7, 179, 90, 14 - PUSHBUTTON " &...", 1020, 101, 179, 90, 14 - PUSHBUTTON "&...", 1017, 7, 197, 90, 14 - PUSHBUTTON "& ...", 1021, 101, 197, 90, 14 + PUSHBUTTON "В&гору", 1022, 195, 83, 50, 14 + PUSHBUTTON "В&низ", 1023, 195, 101, 50, 14 + PUSHBUTTON "В&идалити", 1024, 195, 119, 50, 14 + PUSHBUTTON "Но&мер доступу", 1025, 7, 161, 90, 14 + PUSHBUTTON "Обліковий ном&ер", 1018, 101, 161, 90, 14 + PUSHBUTTON "PIN-&код", 1019, 7, 179, 90, 14 + PUSHBUTTON "Номер при&значення...", 1020, 101, 179, 90, 14 + PUSHBUTTON "О&чікування...", 1017, 7, 197, 90, 14 + PUSHBUTTON "Ука&жіть цифри...", 1021, 101, 197, 90, 14 END 107 DIALOGEX 0, 0, 252, 218 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "̳" +CAPTION "Міжнародні" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " & :", -1, 7, 7, 238, 8 + LTEXT "Номер для ви&ходу на міжнародну лінію:", -1, 7, 7, 238, 8 EDITTEXT 1045, 7, 18, 140, 14, ES_AUTOHSCROLL - LTEXT " . , .", 2000, 7, 40, 244, 24 - LTEXT " & :", -1, 7, 72, 80, 8 + LTEXT "За допомогою кнопок укажіть послідовність виходу на міжнародну лінію. Укажіть послідовність кроків у тому порядку, в якому вони зазначені на картці.", 2000, 7, 40, 244, 24 + LTEXT "Кроки на&бору номера за використання картки:", -1, 7, 72, 80, 8 CONTROL "List1", 1033, "SysListView32", WS_BORDER | WS_TABSTOP | 0x0000400D, 7, 83, 184, 74, WS_EX_CLIENTEDGE - PUSHBUTTON "&", 1022, 195, 83, 50, 14 - PUSHBUTTON "&", 1023, 195, 101, 50, 14 - PUSHBUTTON "&", 1024, 195, 119, 50, 14 - PUSHBUTTON "& ", 1025, 7, 161, 90, 14 - PUSHBUTTON " &", 1018, 101, 161, 90, 14 - PUSHBUTTON "PIN-&", 1019, 7, 179, 90, 14 - PUSHBUTTON " &...", 1020, 101, 179, 90, 14 - PUSHBUTTON "&...", 1017, 7, 197, 90, 14 - PUSHBUTTON "& ...", 1021, 101, 197, 90, 14 + PUSHBUTTON "В&гору", 1022, 195, 83, 50, 14 + PUSHBUTTON "В&низ", 1023, 195, 101, 50, 14 + PUSHBUTTON "В&идалити", 1024, 195, 119, 50, 14 + PUSHBUTTON "Но&мер доступу", 1025, 7, 161, 90, 14 + PUSHBUTTON "Обліковий ном&ер", 1018, 101, 161, 90, 14 + PUSHBUTTON "PIN-&код", 1019, 7, 179, 90, 14 + PUSHBUTTON "Номер при&значення...", 1020, 101, 179, 90, 14 + PUSHBUTTON "О&чікування...", 1017, 7, 197, 90, 14 + PUSHBUTTON "Ука&жіть цифри...", 1021, 101, 197, 90, 14 END 108 DIALOGEX 0, 0, 252, 218 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "̳" +CAPTION "Місцеві" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " & :", -1, 7, 7, 238, 8 + LTEXT "Номер для ви&ходу на місцеву лінію:", -1, 7, 7, 238, 8 EDITTEXT 1008, 7, 18, 140, 14, ES_AUTOHSCROLL - LTEXT " . , . .", 2000, 7, 40, 238, 24 - LTEXT " & :", -1, 7, 72, 238, 8 + LTEXT "За допомогою кнопок укажіть послідовність виходу на місцеву лінію. Укажіть послідовність кроків у тому порядку, як вони зазначені на картці. Для дзвінків без використання телефонної картки залиште ці поля пустими.", 2000, 7, 40, 238, 24 + LTEXT "Кроки на&бору номера за використання картки:", -1, 7, 72, 238, 8 CONTROL "List1", 1033, "SysListView32", WS_BORDER | WS_TABSTOP | 0x0000400D, 7, 83, 184, 74, WS_EX_CLIENTEDGE - PUSHBUTTON "&", 1022, 195, 83, 50, 14 - PUSHBUTTON "&", 1023, 195, 101, 50, 14 - PUSHBUTTON "&", 1024, 195, 119, 50, 14 - PUSHBUTTON "& ", 1025, 7, 161, 90, 14 - PUSHBUTTON " &", 1018, 101, 161, 90, 14 - PUSHBUTTON "PIN-&", 1019, 7, 179, 90, 14 - PUSHBUTTON " &...", 1020, 101, 179, 90, 14 - PUSHBUTTON "&...", 1017, 7, 197, 90, 14 - PUSHBUTTON "& ...", 1021, 101, 197, 90, 14 + PUSHBUTTON "В&гору", 1022, 195, 83, 50, 14 + PUSHBUTTON "В&низ", 1023, 195, 101, 50, 14 + PUSHBUTTON "В&идалити", 1024, 195, 119, 50, 14 + PUSHBUTTON "Но&мер доступу", 1025, 7, 161, 90, 14 + PUSHBUTTON "Обліковий ном&ер", 1018, 101, 161, 90, 14 + PUSHBUTTON "PIN-&код", 1019, 7, 179, 90, 14 + PUSHBUTTON "Номер при&значення...", 1020, 101, 179, 90, 14 + PUSHBUTTON "О&чікування...", 1017, 7, 197, 90, 14 + PUSHBUTTON "Ука&жіть цифри...", 1021, 101, 197, 90, 14 END 109 DIALOGEX 0, 0, 252, 257 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION EXSTYLE WS_EX_CONTEXTHELP -CAPTION " " +CAPTION "Нове правило набору коду міста" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " .", 2000, 7, 6, 238, 16 - LTEXT " , :", -1, 7, 31, 110, 8 - LTEXT " &:", -1, 7, 47, 36, 8 + LTEXT "Це правило застосовуватиметься лише до дзвінків з указаними кодом міста й префіксом.", 2000, 7, 6, 238, 16 + LTEXT "Код міста, куди телефонують:", -1, 7, 31, 110, 8 + LTEXT "Код &міста:", -1, 7, 47, 36, 8 EDITTEXT 1034, 46, 44, 50, 14, ES_AUTOHSCROLL - LTEXT ", .", -1, 14, 78, 224, 8 - AUTORADIOBUTTON "& ", 1014, 14, 90, 224, 12, NOT WS_TABSTOP - AUTORADIOBUTTON "& :", 1015, 14, 104, 224, 12, NOT WS_TABSTOP - LTEXT ", & :", 1057, 26, 117, 119, 8 + LTEXT "Префікси, які слід використовувати з цим кодом міста.", -1, 14, 78, 224, 8 + AUTORADIOBUTTON "&Включити всі префікси до коду міста", 1014, 14, 90, 224, 12, NOT WS_TABSTOP + AUTORADIOBUTTON "В&ключити лише префікси зі списку:", 1015, 14, 104, 224, 12, NOT WS_TABSTOP + LTEXT "Префікси, які с&лід включити:", 1057, 26, 117, 119, 8 CONTROL "List1", 1033, "SysListView32", WS_BORDER | WS_TABSTOP | 0x0000411D, 25, 128, 66, 32, WS_EX_CLIENTEDGE - PUSHBUTTON "&...", 1005, 95, 128, 50, 14 - PUSHBUTTON "&", 1024, 95, 146, 50, 14 - LTEXT " , :", -1, 14, 184, 224, 8 - AUTOCHECKBOX "&:", 1012, 14, 198, 30, 12 + PUSHBUTTON "&Додати...", 1005, 95, 128, 50, 14 + PUSHBUTTON "В&идалити", 1024, 95, 146, 50, 14 + LTEXT "Набираючи номери, які містять указані префікси:", -1, 14, 184, 224, 8 + AUTOCHECKBOX "Н&абрати:", 1012, 14, 198, 30, 12 EDITTEXT 1007, 46, 196, 42, 14, ES_AUTOHSCROLL - AUTOCHECKBOX "& ", 1029, 14, 214, 85, 12 + AUTOCHECKBOX "На&брати код міста", 1029, 14, 214, 85, 12 DEFPUSHBUTTON "OK", 1, 141, 236, 50, 14 - PUSHBUTTON "", 2, 195, 236, 50, 14 - RTEXT " ", 2001, 133, 31, 51, 8 - LTEXT "", 2002, 200, 31, 45, 8 + PUSHBUTTON "Скасувати", 2, 195, 236, 50, 14 + RTEXT "Код міста", 2001, 133, 31, 51, 8 + LTEXT "Префікс", 2002, 200, 31, 45, 8 CONTROL "", 2003, "STATIC", SS_BLACKFRAME | SS_SUNKEN, 180, 41, 1, 6 CONTROL "", 2004, "STATIC", SS_BLACKFRAME | SS_SUNKEN, 203, 41, 1, 6 RTEXT "X - X X X - X X X - X X X X", 2005, 133, 48, 112, 8 - GROUPBOX "", -1, 7, 64, 238, 102 - GROUPBOX "", -1, 7, 170, 238, 60 + GROUPBOX "Префікси", -1, 7, 64, 238, 102 + GROUPBOX "Правила", -1, 7, 170, 238, 60 END 110 DIALOGEX 0, 0, 227, 82 @@ -218,87 +218,87 @@ BEGIN LTEXT "", 1039, 7, 23, 213, 8 EDITTEXT 1031, 7, 34, 213, 14, ES_AUTOHSCROLL DEFPUSHBUTTON "OK", 1, 116, 62, 50, 14 - PUSHBUTTON "", 2, 170, 62, 50, 14 + PUSHBUTTON "Скасувати", 2, 170, 62, 50, 14 END 111 DIALOGEX 0, 0, 252, 124 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION EXSTYLE WS_EX_CONTEXTHELP -CAPTION "" +CAPTION "Очікування" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " .", 2000, 7, 7, 238, 16 - AUTORADIOBUTTON " &", 1009, 7, 31, 238, 10, WS_GROUP - AUTORADIOBUTTON " & ", 1016, 7, 47, 238, 10, NOT WS_TABSTOP - AUTORADIOBUTTON " & :", 1048, 7, 63, 238, 10, NOT WS_TABSTOP + LTEXT "Виберіть тип очікуваного сигналу перед продовженням набору номера.", 2000, 7, 7, 238, 16 + AUTORADIOBUTTON "Чекати на &гудок", 1009, 7, 31, 238, 10, WS_GROUP + AUTORADIOBUTTON "Чекати на &закінчення голосового повідомлення", 1016, 7, 47, 238, 10, NOT WS_TABSTOP + AUTORADIOBUTTON "Чекати &протягом певного часу:", 1048, 7, 63, 238, 10, NOT WS_TABSTOP EDITTEXT 1050, 18, 77, 36, 14, ES_AUTOHSCROLL | WS_GROUP CONTROL "Spin1", 1049, "msctls_updown32", 0x00000036, 42, 78, 11, 14 - LTEXT "&", -1, 58, 81, 187, 8 + LTEXT "&сек", -1, 58, 81, 187, 8 DEFPUSHBUTTON "OK", 1, 141, 103, 50, 14 - PUSHBUTTON "", 2, 195, 103, 50, 14 + PUSHBUTTON "Скасувати", 2, 195, 103, 50, 14 END 112 DIALOGEX 0, 0, 252, 111 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION EXSTYLE WS_EX_CONTEXTHELP -CAPTION " " +CAPTION "Номер призначення" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " . ?", 2000, 7, 7, 238, 24 - AUTOCHECKBOX "& /", 1027, 7, 39, 238, 10 - AUTOCHECKBOX " & ", 1034, 7, 55, 238, 10 - AUTOCHECKBOX "& ", 1008, 7, 71, 238, 10, WS_DISABLED + LTEXT "На цьому кроці слід указати спосіб набору номера за використання телефонної картки. Які частини номера слід набирати?", 2000, 7, 7, 238, 24 + AUTOCHECKBOX "На&брати код країни/регіону", 1027, 7, 39, 238, 10 + AUTOCHECKBOX "Набрати &код міста", 1034, 7, 55, 238, 10 + AUTOCHECKBOX "&Набрати номер", 1008, 7, 71, 238, 10, WS_DISABLED DEFPUSHBUTTON "OK", 1, 141, 92, 50, 14 - PUSHBUTTON "", 2, 195, 92, 50, 14 + PUSHBUTTON "Скасувати", 2, 195, 92, 50, 14 END 113 DIALOGEX 0, 0, 252, 218 STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUPWINDOW | WS_CAPTION -CAPTION "" +CAPTION "Додатково" FONT 8, "MS Shell Dlg" BEGIN ICON 201, 2000, 7, 7, 20, 20 - LTEXT " ' :", -1, 40, 7, 205, 8 - LTEXT "& :", -1, 7, 35, 238, 8 + LTEXT "На цьому комп'ютері установлені такі служби телефонного доступу:", -1, 40, 7, 205, 8 + LTEXT "Слу&жби доступу:", -1, 7, 35, 238, 8 LISTBOX 1033, 7, 46, 238, 147, LBS_STANDARD | LBS_NOINTEGRALHEIGHT | WS_TABSTOP - PUSHBUTTON "&...", 1005, 87, 197, 50, 14 - PUSHBUTTON "&", 1024, 141, 197, 50, 14 - PUSHBUTTON "&...", 1031, 195, 197, 50, 14 + PUSHBUTTON "&Додати...", 1005, 87, 197, 50, 14 + PUSHBUTTON "В&идалити", 1024, 141, 197, 50, 14 + PUSHBUTTON "&Налаштувати...", 1031, 195, 197, 50, 14 END 114 DIALOGEX 20, 15, 252, 127 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION -CAPTION " " +CAPTION "Установка служби доступу" FONT 8, "MS Shell Dlg" BEGIN - LTEXT " , , """".", 2000, 7, 7, 241, 8 - LTEXT "& :", -1, 7, 23, 144, 10 + LTEXT "Виберіть зі списку службу доступу, яку потрібно установити, й натисніть кнопку ""Додати"".", 2000, 7, 7, 241, 8 + LTEXT "С&лужби телефонного доступу:", -1, 7, 23, 144, 10 LISTBOX 1055, 7, 34, 238, 74, LBS_STANDARD | WS_TABSTOP - PUSHBUTTON "&", 1005, 141, 106, 50, 14 - DEFPUSHBUTTON "", 2, 195, 106, 50, 14 + PUSHBUTTON "&Додати", 1005, 141, 106, 50, 14 + DEFPUSHBUTTON "Скасувати", 2, 195, 106, 50, 14 END 115 DIALOGEX 10, 10, 303, 228 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CONTEXTHELP | WS_POPUPWINDOW | WS_VISIBLE | WS_CAPTION EXSTYLE WS_EX_CONTEXTHELP -CAPTION "³ " +CAPTION "Відомості про розташування" FONT 8, "MS Shell Dlg" BEGIN CONTROL 302, 302, "STATIC", SS_BITMAP, 10, 10, 88, 155 - LTEXT " .", 2000, 107, 15, 188, 25 - LTEXT "&, :", -1, 107, 43, 189, 10 + LTEXT "Перед створенням телефонного або модемного підключення потрібно вказати відомості про ваше поточне розташування.", 2000, 107, 15, 188, 25 + LTEXT "&Країна, в якій ви зараз перебуваєте:", -1, 107, 43, 189, 10 COMBOBOX 1006, 107, 55, 180, 200, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL - LTEXT "& :", -1, 107, 74, 189, 10 + LTEXT "Те&лефонний код міста:", -1, 107, 74, 189, 10 EDITTEXT 1034, 107, 87, 45, 12, ES_AUTOHSCROLL - LTEXT " & ':", -1, 107, 105, 189, 10 + LTEXT "Код &виходу на лінію оператора зв'язку:", -1, 107, 105, 189, 10 EDITTEXT 1058, 106, 118, 45, 12, ES_UPPERCASE | ES_AUTOHSCROLL - LTEXT " & :", -1, 107, 137, 189, 10 + LTEXT "Код ви&ходу на зовнішню лінію:", -1, 107, 137, 189, 10 EDITTEXT 1010, 107, 149, 45, 12, ES_UPPERCASE | ES_AUTOHSCROLL - LTEXT " :", -1, 107, 168, 189, 10 - AUTORADIOBUTTON "& ", 1036, 107, 178, 57, 14, WS_GROUP | NOT WS_TABSTOP - AUTORADIOBUTTON "& ", 1037, 175, 178, 57, 14, NOT WS_TABSTOP + LTEXT "Тип набору номера:", -1, 107, 168, 189, 10 + AUTORADIOBUTTON "&тоновий набір", 1036, 107, 178, 57, 14, WS_GROUP | NOT WS_TABSTOP + AUTORADIOBUTTON "&імпульсний набір", 1037, 175, 178, 57, 14, NOT WS_TABSTOP DEFPUSHBUTTON "OK", 1, 192, 204, 50, 14 - PUSHBUTTON "", 2, 246, 204, 50, 14 + PUSHBUTTON "Скасувати", 2, 246, 204, 50, 14 END 400 DIALOGEX 0, 0, 290, 151 @@ -306,16 +306,16 @@ STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION FONT 8, "MS Shell Dlg" BEGIN CONTROL 302, 302, "STATIC", SS_BITMAP, 0, 0, 88, 155 - LTEXT " .", 2000, 95, 2, 188, 25 - LTEXT "&, :", -1, 95, 30, 188, 10 + LTEXT "Перед створенням телефонного або модемного підключення потрібно вказати відомості про ваше поточне розташування.", 2000, 95, 2, 188, 25 + LTEXT "&Країна, в якій ви зараз перебуваєте:", -1, 95, 30, 188, 10 COMBOBOX 1006, 95, 41, 177, 68, CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL - LTEXT "& :", -1, 95, 61, 188, 10 + LTEXT "Т&елефонний код міста:", -1, 95, 61, 188, 10 EDITTEXT 1034, 95, 73, 40, 14, ES_AUTOHSCROLL - LTEXT " & :", -1, 95, 96, 188, 10 + LTEXT "Код ви&ходу на зовнішню лінію:", -1, 95, 96, 188, 10 EDITTEXT 1010, 95, 107, 40, 14, ES_UPPERCASE | ES_AUTOHSCROLL - LTEXT " :", -1, 95, 129, 159, 10 - AUTORADIOBUTTON "& ", 1036, 95, 139, 55, 12, WS_GROUP | NOT WS_TABSTOP - AUTORADIOBUTTON "& ", 1037, 155, 139, 55, 12, NOT WS_TABSTOP + LTEXT "Тип набору номера:", -1, 95, 129, 159, 10 + AUTORADIOBUTTON "&тоновий набір", 1036, 95, 139, 55, 12, WS_GROUP | NOT WS_TABSTOP + AUTORADIOBUTTON "&імпульсний набір", 1037, 155, 139, 55, 12, NOT WS_TABSTOP END 500 DIALOGEX 0, 0, 235, 88 @@ -325,130 +325,130 @@ FONT 8, "MS Shell Dlg" BEGIN ICON 504, 501, 13, 14, 21, 20 LTEXT "", 502, 47, 15, 180, 32 - AUTOCHECKBOX "& ", 503, 50, 47, 147, 12 + AUTOCHECKBOX "За&вжди довіряти вмісту цієї сторінки", 503, 50, 47, 147, 12 DEFPUSHBUTTON "&OK", 505, 110, 65, 50, 14 - PUSHBUTTON "&", 506, 164, 65, 50, 14 + PUSHBUTTON "&Скасувати", 506, 164, 65, 50, 14 END STRINGTABLE BEGIN - 1 " " - 2 " ." - 3 "" - 4 " , """"." - 5 " " - 6 " " - 7 " " - 8 " " - 9 " " - 10 "" - 11 "" - 12 " .\n\n 0 9, (*), # ." - 13 " .\n\n 0 9, (*), #, ." - 14 " .\n\n 0 9." - 15 " ." - 16 " %1" - 17 " %1 " - 18 " " - 19 " " - 20 "" - 21 "" - 22 " " - 23 " , , """", ." - 24 " ""%2"" %1." - 25 " ""%2"" %1." - 26 " %1." - 27 " %1." - 28 " ""%2"" %1, ." - 29 " ""%2"" %1, ." - 30 " %1, ." - 31 " %1, ." - 32 " ""1"" ." - 33 " " - 34 " ." - 35 " " - 36 " ( * #), ." - 37 " .\n\n 0 9 ." - 38 " %1!d! ." - 39 " ." - 40 " ." - 41 " PIN-." - 42 " ." - 43 " ." - 44 " /, ." - 45 " / ." - 46 " ." - 47 " /." - 48 " ." - 49 " ." - 50 " ." - 51 " ." - 52 " ." - 53 " ." - 54 " ' ." - 55 " ' ." - 56 " ." - 57 " , ." - 58 " , ." - 59 "³ " - 60 " ' . '." - 61 "³ , . """" ." - 62 " , . """", ." - 63 " ' ." - 64 " ." - 65 " PIN-." - 66 " . , ""̳"", ""̳"" ""̳""." - 67 " '." - 68 " '." - 69 " '." - 70 "" - 71 " ?" - 72 "< >" - 73 " , ." - 74 "&:" - 75 "&:" - 76 " .\n\n 0 9, ." - 77 "ϳ " - 78 " ?" - 79 " ?" - 80 " ?" - 81 " ." - 82 " ' . '." - 83 "ReactOS , . , . , , .\n ?" - 84 "ϳ " - 85 " " - 86 "< >" - 87 " .\n\n 0 9, A D, *, #, +, !, ." - 88 " ' ." - 89 " ' ." - 90 " ', '.\n ?" - 91 " .\n ?" - 92 " .\n ?" - 93 " .\n ?" - 1064 " . ." - 1065 " " + 1 "Телефон і модем" + 2 "Настройка правил набору номера та інших параметрів використання модема." + 3 "Розташування" + 4 "Щоб створити нове розташування, натисніть кнопку ""Створити""." + 5 "Нове розташування" + 6 "Змінити розташування" + 7 "Нова телефонна картка" + 8 "Змінити телефонну картку" + 9 "Код міста" + 10 "Префікси" + 11 "Правило" + 12 "Введено неприпустимий символ.\n\nДозволені цифри від 0 до 9, зірочка (*), знак # і кома." + 13 "Введено неприпустимий символ.\n\nДозволені цифри від 0 до 9, зірочка (*), знак #, пробіл і кома." + 14 "Введено неприпустимий символ.\n\nДозволені цифри від 0 до 9." + 15 "Введено неприпустимий символ." + 16 "Набрати %1" + 17 "Набрати %1 і код міста" + 18 "Набрати код міста" + 19 "Набрати лише номер" + 20 "Усі" + 21 "Вибраний" + 22 "Змінити правило набору коду міста" + 23 "Виберіть зі списку правило, щоб переглянути його опис, або натисніть кнопку ""Створити"", щоб додати нове правило." + 24 "Набрати ""%2"" і код міста перед номером для всіх номерів із кодом міста %1." + 25 "Набрати ""%2"" перед номером для всіх номерів із кодом міста %1." + 26 "Набрати код міста перед номером для всіх номерів із кодом міста %1." + 27 "Набрати лише номер телефону для всіх номерів із кодом міста %1." + 28 "Набрати ""%2"" і код міста перед номером для номерів із кодом міста %1, які містять указані префікси." + 29 "Набрати ""%2"" перед номером для номерів із кодом міста %1, які містять указані префікси." + 30 "Набрати код міста перед номером для номерів із кодом міста %1, які містять указані префікси." + 31 "Набрати лише номер телефону для номерів із кодом міста %1, які містять указані префікси." + 32 "Набрати ""1"" перед набором номера для всіх кодів міст і включити код міста для всіх префіксів." + 33 "Додати префікс" + 34 "Введіть один або декілька префіксів через пробіли або коми." + 35 "Укажіть цифри" + 36 "Введіть одну або декілька цифр (а також * і #), які слід набрати." + 37 "Введено неприпустимий символ.\n\nДозволені цифри від 0 до 9 і пробіл." + 38 "Чекати %1!d! секунд." + 39 "Набрати номер доступу." + 40 "Набрати номер облікового запису." + 41 "Набрати PIN-код." + 42 "Чекати на гудок." + 43 "Чекати на закінчення голосового повідомлення." + 44 "Набрати код країни/регіону, код міста й номер." + 45 "Набрати код країни/регіону й номер." + 46 "Набрати код міста й номер." + 47 "Набрати код країни/регіону." + 48 "Набрати код міста." + 49 "Набрати номер." + 50 "наборі міжміських номерів." + 51 "наборі міжнародних номерів." + 52 "наборі місцевих номерів." + 53 "Для цієї телефонної картки не визначено правил набору номера." + 54 "Слід ввести код оператора міжміського зв'язку для цього розташування." + 55 "Слід ввести ім'я для цього розташування." + 56 "Слід ввести код міста для цього розташування." + 57 "Щоб вимкнути режим очікуючого дзвінка, слід вибрати номер." + 58 "Слід вибрати країну або регіон, з якого ви телефонуєте." + 59 "Відомості відсутні" + 60 "Указане ім'я розташування вже використовується. Введіть унікальне ім'я." + 61 "Відсутні деякі відомості, потрібні для використання цієї телефонної картки. Натисніть кнопку ""Змінити"" і вкажіть потрібні відомості або виберіть іншу картку." + 62 "Слід вибрати телефонну картку, яка використовуватиметься за замовчуванням. Виберіть її зі списку або натисніть кнопку ""Створити"", щоб додати нову картку." + 63 "Слід ввести ім'я телефонної картки." + 64 "Слід ввести обліковий номер." + 65 "Слід ввести PIN-код." + 66 "Для цієї телефонної картки не визначено правил набору номера. Щоб створити правило, виберіть вкладку ""Міжміські"", ""Міжнародні"" або ""Місцеві""." + 67 "Правило для міжміського дзвінка потребує вказання номера доступу для міжміського зв'язку." + 68 "Правило для міжнародного дзвінка потребує вказання номера доступу для міжнародного зв'язку." + 69 "Правило для місцевого дзвінка потребує вказання номера доступу для місцевого зв'язку." + 70 "Немає" + 71 "Ви дійсно бажаєте видалити вибраного постачальника послуг телефонної служби?" + 72 "<немає установлених постачальників послуг>" + 73 "Слід ввести префікси, для яких застосовується це правило." + 74 "&Цифри:" + 75 "&Префікси:" + 76 "Введено неприпустимий символ.\n\nДозволені цифри від 0 до 9, пробіл і кома." + 77 "Підтвердження видалення" + 78 "Ви дійсно бажаєте видалити це розташування?" + 79 "Ви дійсно бажаєте видалити цю картку?" + 80 "Ви дійсно бажаєте видалити це правило?" + 81 "Слід ввести цифри для набору." + 82 "Указане ім'я телефонної картки вже використовується. Введіть унікальне ім'я." + 83 "ReactOS потребує відомостей про розташування, звідки ви телефонуєте. Якщо не вказати ці відомості, програма може неправильно набирати номер. Крім того, деякі додатки реагують на скасування вводу даних, відправляючи їх повторно.\nВи дійсно бажаєте скасувати ввід даних?" + 84 "Підтвердження скасування" + 85 "Моє розташування" + 86 "<немає постачальників послуг доступу для установки>" + 87 "Введено неприпустимий символ.\n\nДозволені цифри від 0 до 9, літери від A до D, *, #, +, !, пробіл і кома." + 88 "Слід ввести код оператора міжнародного зв'язку для цього розташування." + 89 "Слід ввести код оператора зв'язку для цього розташування." + 90 "Ця сторінка намагається зробити або проконтролювати телефонні дзвінки або інші з'єднання, які виконуються на вашому комп'ютері.\nДозволити продовження?" + 91 "Ця сторінка намагається отримати доступ до інформації каталогів у вашій мережі.\nДозволити продовження?" + 92 "Ця сторінка намагається отримати доступ або змінити інформацію про мережні конференції.\nДозволити продовження?" + 93 "Ця сторінка намагається отримати доступ або змінити інформацію в реєстрі.\nДозволити продовження?" + 1064 "Не вдалося відкрити панель керування телефоном і модемом. Можливі неполадки під час запуску телефонної служби." + 1065 "Видалити постачальника" 15800 "23" - 15801 "0,"" "","""","""","""","""","""","""","""","""",1" - 15802 "1,"" AT&T 1010ATT1"","""",""G"",""J1FG"",""J011EFG"","""","""",""1010288"",""1010288"",1" - 15803 "2,""AT&T 1010ATT0"","""",""G"",""J0FG$TH"",""J01EFG$TH"","""","""",""1010288"",""1010288"",1" - 15804 "3,""AT&T 1-800-321-0288"","""",""G"",""J$TFG$TH"",""J$T01EFG$TH"","""","""",""18003210288"",""18003210288"",1" - 15805 "4,"" MCI 10102221"","""",""G"",""J1FG"",""J011EFG"","""","""",""1010222"",""1010222"",1" - 15806 "5,""MCI 10102220"","""",""G"",""J0FG$TH"",""J01EFG$TH"","""","""",""1010222"",""1010222"",1" - 15807 "6,""MCI 1-800-888-8000"","""",""G"",""J,,,,,,TH,,FG"",""J,,,,,,TH,,011EFG"","""","""",""18008888000"",""18008888000"",1" - 15808 "7,""MCI 1-800-674-0700"","""",""G"",""J,,,,,,TH,,FG"",""J,,,,,,TH,,011EFG"","""","""",""18006740700"",""18006740700"",1" - 15809 "8,""MCI 1-800-674-7000"","""",""G"",""J,,,,,,TH,,FG"",""J,,,,,,TH,,011EFG"","""","""",""18006747000"",""18006747000"",1" - 15810 "9,"" US Sprint 10103331"","""",""G"",""J1FG"",""J011EFG"","""","""",""1010333"",""1010333"",1" - 15811 "10,""US Sprint 10103330"","""",""G"",""J0FG$TH"",""J01EFG$TH"","""","""",""1010333"",""1010333"",1" - 15812 "11,""US Sprint 1-800-877-8000"","""",""G"",""J,,,T0FG,,H"",""J,,,T01EFG#,H"","""","""",""18008778000"",""18008778000"",1" - 15813 "12,"" 0"","""",""G"",""0FG$TH"",""01EFG$TH"","""","""","""","""",1" + 15801 "0,""Не використовується"","""","""","""","""","""","""","""","""",1" + 15802 "1,""Прямий канал AT&T через 1010ATT1"","""",""G"",""J1FG"",""J011EFG"","""","""",""1010288"",""1010288"",1" + 15803 "2,""AT&T через 1010ATT0"","""",""G"",""J0FG$TH"",""J01EFG$TH"","""","""",""1010288"",""1010288"",1" + 15804 "3,""AT&T через 1-800-321-0288"","""",""G"",""J$TFG$TH"",""J$T01EFG$TH"","""","""",""18003210288"",""18003210288"",1" + 15805 "4,""Прямий канал MCI через 10102221"","""",""G"",""J1FG"",""J011EFG"","""","""",""1010222"",""1010222"",1" + 15806 "5,""MCI через 10102220"","""",""G"",""J0FG$TH"",""J01EFG$TH"","""","""",""1010222"",""1010222"",1" + 15807 "6,""MCI через 1-800-888-8000"","""",""G"",""J,,,,,,TH,,FG"",""J,,,,,,TH,,011EFG"","""","""",""18008888000"",""18008888000"",1" + 15808 "7,""MCI через 1-800-674-0700"","""",""G"",""J,,,,,,TH,,FG"",""J,,,,,,TH,,011EFG"","""","""",""18006740700"",""18006740700"",1" + 15809 "8,""MCI через 1-800-674-7000"","""",""G"",""J,,,,,,TH,,FG"",""J,,,,,,TH,,011EFG"","""","""",""18006747000"",""18006747000"",1" + 15810 "9,""Прямий канал US Sprint через 10103331"","""",""G"",""J1FG"",""J011EFG"","""","""",""1010333"",""1010333"",1" + 15811 "10,""US Sprint через 10103330"","""",""G"",""J0FG$TH"",""J01EFG$TH"","""","""",""1010333"",""1010333"",1" + 15812 "11,""US Sprint через 1-800-877-8000"","""",""G"",""J,,,T0FG,,H"",""J,,,T01EFG#,H"","""","""",""18008778000"",""18008778000"",1" + 15813 "12,""Телефонна картка через 0"","""",""G"",""0FG$TH"",""01EFG$TH"","""","""","""","""",1" 15814 "13,""Carte France Telecom"","""",""T3010,H,0FG#"",""T3010,H,0FG#"",""T3010,H,00EFG#"","""","""","""","""",1" - 15815 "14,""Mercury ()"","""",""J$TH,0FG"",""J$TH,0FG"",""J$TH,0FG"","""",""0500800800"",""0500800800"",""0500800800"",1" - 15816 "15,""British Telecom ()"","""",""J$H,0FG"",""J$H,0FG"",""J$H,00EFG"","""",""144"",""144"".""144"",1" - 15817 "16,""CLEAR Communications ( )"","""",""J$TH,0FG"",""J$TH,0FG"",""J$TH,00EFG"","""",""0502333"",""0502333"",""0502333"",1" - 15818 "17,""Telecom ( )"","""",""J,0FG?H"",""J,0FG?H"",""J,00EFG?H"","""",""012"",""012"",""012"",1" - 15819 "18,""Global Card ( - )"","""",""G"",""0FG"",""J,102880$TFG$H"","""","""","""",""0080"",1" - 15820 "19,""Telstra () 1818 ()"","""",""J$TH,FG#"",""J$TH,FG#"",""J$TH,0011EFG#"","""",""1818"",""1818"",""1818"",1" - 15821 "20,""Telstra () 1818 ()"","""",""J$TH,FG#"",""J$TH,FG#"",""J$TH,0015EFG#"","""",""1818"",""1818"",""1818"",1" - 15822 "21,""Optus () 1812"","""",""FG"",""FG"",""J@TH,0011EFG"","""","""","""",""1812"",1" - 15823 "22,""Optus () 008551812"","""",""FG"",""FG"",""J@TH,0011EFG"","""","""","""",""008551812"",1" + 15815 "14,""Mercury (Великобританія)"","""",""J$TH,0FG"",""J$TH,0FG"",""J$TH,0FG"","""",""0500800800"",""0500800800"",""0500800800"",1" + 15816 "15,""British Telecom (Великобританія)"","""",""J$H,0FG"",""J$H,0FG"",""J$H,00EFG"","""",""144"",""144"".""144"",1" + 15817 "16,""CLEAR Communications (Нова Зеландія)"","""",""J$TH,0FG"",""J$TH,0FG"",""J$TH,00EFG"","""",""0502333"",""0502333"",""0502333"",1" + 15818 "17,""Telecom (Нова Зеландія)"","""",""J,0FG?H"",""J,0FG?H"",""J,00EFG?H"","""",""012"",""012"",""012"",1" + 15819 "18,""Global Card (Тайвань - США)"","""",""G"",""0FG"",""J,102880$TFG$H"","""","""","""",""0080"",1" + 15820 "19,""Telstra (Австралія) через 1818 (голосом)"","""",""J$TH,FG#"",""J$TH,FG#"",""J$TH,0011EFG#"","""",""1818"",""1818"",""1818"",1" + 15821 "20,""Telstra (Австралія) через 1818 (факс)"","""",""J$TH,FG#"",""J$TH,FG#"",""J$TH,0015EFG#"","""",""1818"",""1818"",""1818"",1" + 15822 "21,""Optus (Австралія) через 1812"","""",""FG"",""FG"",""J@TH,0011EFG"","""","""","""",""1812"",1" + 15823 "22,""Optus (Австралія) через 008551812"","""",""FG"",""FG"",""J@TH,0011EFG"","""","""","""",""008551812"",1" END diff --git a/dll/win32/tapiui/tapiui.rc b/dll/win32/tapiui/tapiui.rc index 0546f0fc681..df707fbbfcc 100644 --- a/dll/win32/tapiui/tapiui.rc +++ b/dll/win32/tapiui/tapiui.rc @@ -18,6 +18,9 @@ IDB_WIZARD BITMAP "res/302.bmp" #include "lang/de-DE.rc" #include "lang/en-US.rc" #include "lang/no-NO.rc" + +// UTF-8 +#pragma code_page(65001) #include "lang/pl-PL.rc" #include "lang/ru-RU.rc" #include "lang/uk-UA.rc" diff --git a/dll/win32/twain_32/CMakeLists.txt b/dll/win32/twain_32/CMakeLists.txt index 5eb3ac68cf3..597903e8867 100644 --- a/dll/win32/twain_32/CMakeLists.txt +++ b/dll/win32/twain_32/CMakeLists.txt @@ -1,6 +1,4 @@ -add_definitions(-D_DLL -D__USE_CRTIMP) - spec2def(twain_32.dll twain_32.spec) list(APPEND SOURCE diff --git a/dll/win32/uext2/CMakeLists.txt b/dll/win32/uext2/CMakeLists.txt index 19858c8f0b4..8a18c50a1ca 100644 --- a/dll/win32/uext2/CMakeLists.txt +++ b/dll/win32/uext2/CMakeLists.txt @@ -8,7 +8,7 @@ list(APPEND SOURCE add_library(uext2 SHARED ${SOURCE}) -set_module_type(uext2 win32dll) +set_module_type(uext2 nativedll) target_link_libraries(uext2 ext2lib) -add_importlibs(uext2 msvcrt kernel32 ntdll) +add_importlibs(uext2 ntdll) add_cd_file(TARGET uext2 DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/uext2/uext2.c b/dll/win32/uext2/uext2.c index 2e3ecfe0367..7b6ddc99d19 100644 --- a/dll/win32/uext2/uext2.c +++ b/dll/win32/uext2/uext2.c @@ -10,7 +10,7 @@ #define WIN32_NO_STATUS #include #define NTOS_MODE_USER -#include +#include #include INT WINAPI diff --git a/dll/win32/ufat/CMakeLists.txt b/dll/win32/ufat/CMakeLists.txt index 658ab44fb36..9548798a627 100644 --- a/dll/win32/ufat/CMakeLists.txt +++ b/dll/win32/ufat/CMakeLists.txt @@ -8,7 +8,7 @@ list(APPEND SOURCE add_library(ufat SHARED ${SOURCE}) -set_module_type(ufat win32dll) +set_module_type(ufat nativedll) target_link_libraries(ufat vfatlib) -add_importlibs(ufat msvcrt kernel32 ntdll) +add_importlibs(ufat ntdll) add_cd_file(TARGET ufat DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/ufat/ufat.c b/dll/win32/ufat/ufat.c index 8a876a29ab3..af0c81a0317 100644 --- a/dll/win32/ufat/ufat.c +++ b/dll/win32/ufat/ufat.c @@ -10,7 +10,7 @@ #define WIN32_NO_STATUS #include #define NTOS_MODE_USER -#include +#include #include INT WINAPI diff --git a/dll/win32/ufatx/CMakeLists.txt b/dll/win32/ufatx/CMakeLists.txt index 8cf783e9fab..1c8704e7551 100644 --- a/dll/win32/ufatx/CMakeLists.txt +++ b/dll/win32/ufatx/CMakeLists.txt @@ -9,8 +9,8 @@ add_library(ufatx SHARED ${SOURCE}) set_entrypoint(ufatx 0) -target_link_libraries(ufatx vfatxlib -lgcc) -add_importlibs(ufatx kernel32 ntdll) +target_link_libraries(ufatx vfatxlib) +add_importlibs(ufatx ntdll) add_importlib_target(ufatx.spec) add_dependencies(ufatx psdk) add_cd_file(TARGET ufatx DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/unicows/CMakeLists.txt b/dll/win32/unicows/CMakeLists.txt index 27ecb838a7d..a8ef2fab00e 100644 --- a/dll/win32/unicows/CMakeLists.txt +++ b/dll/win32/unicows/CMakeLists.txt @@ -7,7 +7,8 @@ list(APPEND SOURCE add_library(unicows SHARED ${SOURCE}) -set_module_type(unicows win32dll) +set_entrypoint(unicows 0) + add_importlibs(unicows avicap32 msvfw32 @@ -24,6 +25,7 @@ add_importlibs(unicows mpr gdi32 advapi32 + msvcrt kernel32 ntdll) add_cd_file(TARGET unicows DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/untfs/CMakeLists.txt b/dll/win32/untfs/CMakeLists.txt index 0416542d1e0..818df413b80 100644 --- a/dll/win32/untfs/CMakeLists.txt +++ b/dll/win32/untfs/CMakeLists.txt @@ -8,7 +8,7 @@ list(APPEND SOURCE add_library(untfs SHARED ${SOURCE}) -set_module_type(untfs win32dll) +set_module_type(untfs nativedll) target_link_libraries(untfs ntfslib) -add_importlibs(untfs msvcrt kernel32 ntdll) +add_importlibs(untfs ntdll) add_cd_file(TARGET untfs DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/untfs/untfs.c b/dll/win32/untfs/untfs.c index f359e5f90e6..b033ea725f7 100644 --- a/dll/win32/untfs/untfs.c +++ b/dll/win32/untfs/untfs.c @@ -10,7 +10,7 @@ #define WIN32_NO_STATUS #include #define NTOS_MODE_USER -#include +#include #include INT WINAPI diff --git a/dll/win32/updspapi/updspapi.spec b/dll/win32/updspapi/updspapi.spec index dc6b25f0471..17c393ee857 100644 --- a/dll/win32/updspapi/updspapi.spec +++ b/dll/win32/updspapi/updspapi.spec @@ -67,12 +67,12 @@ @ stub UpdSpSetDynamicStringExA @ stub UpdSpSetDynamicStringExW @ stub UpdSpSetDynamicStringW -@ stdcall UpdSpStringTableAddString(ptr wstr long) setupapi.StringTableAddString -@ stdcall UpdSpStringTableAddStringEx(ptr wstr long ptr long) setupapi.StringTableAddStringEx -@ stdcall UpdSpStringTableDestroy(ptr) setupapi.StringTableDestroy +@ stdcall UpdSpStringTableAddString(ptr wstr long) setupapi.pSetupStringTableAddString +@ stdcall UpdSpStringTableAddStringEx(ptr wstr long ptr long) setupapi.pSetupStringTableAddStringEx +@ stdcall UpdSpStringTableDestroy(ptr) setupapi.pSetupStringTableDestroy @ stub UpdSpStringTableEnum -@ stdcall UpdSpStringTableInitialize() setupapi.StringTableInitialize -@ stdcall UpdSpStringTableInitializeEx(long long) setupapi.StringTableInitializeEx -@ stdcall UpdSpStringTableLookUpString(ptr wstr long) setupapi.StringTableLookUpString -@ stdcall UpdSpStringTableLookUpStringEx(ptr wstr long ptr long) setupapi.StringTableLookUpStringEx +@ stdcall UpdSpStringTableInitialize() setupapi.pSetupStringTableInitialize +@ stdcall UpdSpStringTableInitializeEx(long long) setupapi.pSetupStringTableInitializeEx +@ stdcall UpdSpStringTableLookUpString(ptr wstr long) setupapi.pSetupStringTableLookUpString +@ stdcall UpdSpStringTableLookUpStringEx(ptr wstr long ptr long) setupapi.pSetupStringTableLookUpStringEx @ stdcall UpdSpTermDefaultQueueCallback(ptr) setupapi.SetupTermDefaultQueueCallback diff --git a/dll/win32/urlmon/CMakeLists.txt b/dll/win32/urlmon/CMakeLists.txt index 76abc2893e1..cf667761faf 100644 --- a/dll/win32/urlmon/CMakeLists.txt +++ b/dll/win32/urlmon/CMakeLists.txt @@ -27,7 +27,6 @@ list(APPEND SOURCE mk.c protocol.c protproxy.c - regsvr.c sec_mgr.c session.c umon.c @@ -71,7 +70,7 @@ add_definitions( -DREGISTER_PROXY_DLL -D_URLMON_) +add_pch(urlmon urlmon_main.h) add_definitions(-DPROXY_CLSID_IS="{0x79EAC9F1,0xBAF9,0x11CE,{0x8C,0x82,0x00,0xAA,0x00,0x4B,0xA9,0x0B}}") - add_cd_file(TARGET urlmon DESTINATION reactos/system32 FOR all) add_importlib_target(urlmon.spec) diff --git a/dll/win32/urlmon/bindctx.c b/dll/win32/urlmon/bindctx.c index b08eb80e7a5..1af7fa7a129 100644 --- a/dll/win32/urlmon/bindctx.c +++ b/dll/win32/urlmon/bindctx.c @@ -28,10 +28,10 @@ static WCHAR BSCBHolder[] = { '_','B','S','C','B','_','H','o','l','d','e','r','_ extern IID IID_IBindStatusCallbackHolder; typedef struct { - const IBindStatusCallbackExVtbl *lpBindStatusCallbackExVtbl; - const IServiceProviderVtbl *lpServiceProviderVtbl; - const IHttpNegotiate2Vtbl *lpHttpNegotiate2Vtbl; - const IAuthenticateVtbl *lpAuthenticateVtbl; + IBindStatusCallbackEx IBindStatusCallbackEx_iface; + IServiceProvider IServiceProvider_iface; + IHttpNegotiate2 IHttpNegotiate2_iface; + IAuthenticate IAuthenticate_iface; LONG ref; @@ -39,12 +39,6 @@ typedef struct { IServiceProvider *serv_prov; } BindStatusCallback; -#define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackExVtbl) -#define STATUSCLBEX(x) ((IBindStatusCallbackEx*)&(x)->lpBindStatusCallbackExVtbl) -#define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl) -#define HTTPNEG2(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl) -#define AUTHENTICATE(x) ((IAuthenticate*) &(x)->lpAuthenticateVtbl) - static void *get_callback_iface(BindStatusCallback *This, REFIID riid) { void *ret; @@ -57,39 +51,42 @@ static void *get_callback_iface(BindStatusCallback *This, REFIID riid) return SUCCEEDED(hres) ? ret : NULL; } -#define STATUSCLB_THIS(iface) DEFINE_THIS(BindStatusCallback, BindStatusCallbackEx, iface) +static inline BindStatusCallback *impl_from_IBindStatusCallbackEx(IBindStatusCallbackEx *iface) +{ + return CONTAINING_RECORD(iface, BindStatusCallback, IBindStatusCallbackEx_iface); +} static HRESULT WINAPI BindStatusCallback_QueryInterface(IBindStatusCallbackEx *iface, REFIID riid, void **ppv) { - BindStatusCallback *This = STATUSCLB_THIS(iface); + BindStatusCallback *This = impl_from_IBindStatusCallbackEx(iface); *ppv = NULL; if(IsEqualGUID(&IID_IUnknown, riid)) { TRACE("(%p)->(IID_IUnknown, %p)\n", This, ppv); - *ppv = STATUSCLB(This); + *ppv = &This->IBindStatusCallbackEx_iface; }else if(IsEqualGUID(&IID_IBindStatusCallback, riid)) { TRACE("(%p)->(IID_IBindStatusCallback, %p)\n", This, ppv); - *ppv = STATUSCLB(This); + *ppv = &This->IBindStatusCallbackEx_iface; }else if(IsEqualGUID(&IID_IBindStatusCallbackEx, riid)) { TRACE("(%p)->(IID_IBindStatusCallback, %p)\n", This, ppv); - *ppv = STATUSCLBEX(This); + *ppv = &This->IBindStatusCallbackEx_iface; }else if(IsEqualGUID(&IID_IBindStatusCallbackHolder, riid)) { TRACE("(%p)->(IID_IBindStatusCallbackHolder, %p)\n", This, ppv); *ppv = This; }else if(IsEqualGUID(&IID_IServiceProvider, riid)) { TRACE("(%p)->(IID_IServiceProvider, %p)\n", This, ppv); - *ppv = SERVPROV(This); + *ppv = &This->IServiceProvider_iface; }else if(IsEqualGUID(&IID_IHttpNegotiate, riid)) { TRACE("(%p)->(IID_IHttpNegotiate, %p)\n", This, ppv); - *ppv = HTTPNEG2(This); + *ppv = &This->IHttpNegotiate2_iface; }else if(IsEqualGUID(&IID_IHttpNegotiate2, riid)) { TRACE("(%p)->(IID_IHttpNegotiate2, %p)\n", This, ppv); - *ppv = HTTPNEG2(This); + *ppv = &This->IHttpNegotiate2_iface; }else if(IsEqualGUID(&IID_IAuthenticate, riid)) { TRACE("(%p)->(IID_IAuthenticate, %p)\n", This, ppv); - *ppv = AUTHENTICATE(This); + *ppv = &This->IAuthenticate_iface; } if(*ppv) { @@ -103,7 +100,7 @@ static HRESULT WINAPI BindStatusCallback_QueryInterface(IBindStatusCallbackEx *i static ULONG WINAPI BindStatusCallback_AddRef(IBindStatusCallbackEx *iface) { - BindStatusCallback *This = STATUSCLB_THIS(iface); + BindStatusCallback *This = impl_from_IBindStatusCallbackEx(iface); LONG ref = InterlockedIncrement(&This->ref); TRACE("(%p) ref = %d\n", This, ref); @@ -113,7 +110,7 @@ static ULONG WINAPI BindStatusCallback_AddRef(IBindStatusCallbackEx *iface) static ULONG WINAPI BindStatusCallback_Release(IBindStatusCallbackEx *iface) { - BindStatusCallback *This = STATUSCLB_THIS(iface); + BindStatusCallback *This = impl_from_IBindStatusCallbackEx(iface); LONG ref = InterlockedDecrement(&This->ref); TRACE("(%p) ref = %d\n", This, ref); @@ -131,7 +128,7 @@ static ULONG WINAPI BindStatusCallback_Release(IBindStatusCallbackEx *iface) static HRESULT WINAPI BindStatusCallback_OnStartBinding(IBindStatusCallbackEx *iface, DWORD dwReserved, IBinding *pbind) { - BindStatusCallback *This = STATUSCLB_THIS(iface); + BindStatusCallback *This = impl_from_IBindStatusCallbackEx(iface); TRACE("(%p)->(%d %p)\n", This, dwReserved, pbind); @@ -140,7 +137,7 @@ static HRESULT WINAPI BindStatusCallback_OnStartBinding(IBindStatusCallbackEx *i static HRESULT WINAPI BindStatusCallback_GetPriority(IBindStatusCallbackEx *iface, LONG *pnPriority) { - BindStatusCallback *This = STATUSCLB_THIS(iface); + BindStatusCallback *This = impl_from_IBindStatusCallbackEx(iface); TRACE("(%p)->(%p)\n", This, pnPriority); @@ -149,7 +146,7 @@ static HRESULT WINAPI BindStatusCallback_GetPriority(IBindStatusCallbackEx *ifac static HRESULT WINAPI BindStatusCallback_OnLowResource(IBindStatusCallbackEx *iface, DWORD reserved) { - BindStatusCallback *This = STATUSCLB_THIS(iface); + BindStatusCallback *This = impl_from_IBindStatusCallbackEx(iface); TRACE("(%p)->(%d)\n", This, reserved); @@ -159,7 +156,7 @@ static HRESULT WINAPI BindStatusCallback_OnLowResource(IBindStatusCallbackEx *if static HRESULT WINAPI BindStatusCallback_OnProgress(IBindStatusCallbackEx *iface, ULONG ulProgress, ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText) { - BindStatusCallback *This = STATUSCLB_THIS(iface); + BindStatusCallback *This = impl_from_IBindStatusCallbackEx(iface); TRACE("%p)->(%u %u %u %s)\n", This, ulProgress, ulProgressMax, ulStatusCode, debugstr_w(szStatusText)); @@ -171,7 +168,7 @@ static HRESULT WINAPI BindStatusCallback_OnProgress(IBindStatusCallbackEx *iface static HRESULT WINAPI BindStatusCallback_OnStopBinding(IBindStatusCallbackEx *iface, HRESULT hresult, LPCWSTR szError) { - BindStatusCallback *This = STATUSCLB_THIS(iface); + BindStatusCallback *This = impl_from_IBindStatusCallbackEx(iface); TRACE("(%p)->(%08x %s)\n", This, hresult, debugstr_w(szError)); @@ -181,7 +178,7 @@ static HRESULT WINAPI BindStatusCallback_OnStopBinding(IBindStatusCallbackEx *if static HRESULT WINAPI BindStatusCallback_GetBindInfo(IBindStatusCallbackEx *iface, DWORD *grfBINDF, BINDINFO *pbindinfo) { - BindStatusCallback *This = STATUSCLB_THIS(iface); + BindStatusCallback *This = impl_from_IBindStatusCallbackEx(iface); IBindStatusCallbackEx *bscex; HRESULT hres; @@ -203,7 +200,7 @@ static HRESULT WINAPI BindStatusCallback_GetBindInfo(IBindStatusCallbackEx *ifac static HRESULT WINAPI BindStatusCallback_OnDataAvailable(IBindStatusCallbackEx *iface, DWORD grfBSCF, DWORD dwSize, FORMATETC *pformatetc, STGMEDIUM *pstgmed) { - BindStatusCallback *This = STATUSCLB_THIS(iface); + BindStatusCallback *This = impl_from_IBindStatusCallbackEx(iface); TRACE("(%p)->(%08x %d %p %p)\n", This, grfBSCF, dwSize, pformatetc, pstgmed); @@ -213,7 +210,7 @@ static HRESULT WINAPI BindStatusCallback_OnDataAvailable(IBindStatusCallbackEx * static HRESULT WINAPI BindStatusCallback_OnObjectAvailable(IBindStatusCallbackEx *iface, REFIID riid, IUnknown *punk) { - BindStatusCallback *This = STATUSCLB_THIS(iface); + BindStatusCallback *This = impl_from_IBindStatusCallbackEx(iface); TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), punk); @@ -223,7 +220,7 @@ static HRESULT WINAPI BindStatusCallback_OnObjectAvailable(IBindStatusCallbackEx static HRESULT WINAPI BindStatusCallback_GetBindInfoEx(IBindStatusCallbackEx *iface, DWORD *grfBINDF, BINDINFO *pbindinfo, DWORD *grfBINDF2, DWORD *pdwReserved) { - BindStatusCallback *This = STATUSCLB_THIS(iface); + BindStatusCallback *This = impl_from_IBindStatusCallbackEx(iface); IBindStatusCallbackEx *bscex; HRESULT hres; @@ -240,8 +237,6 @@ static HRESULT WINAPI BindStatusCallback_GetBindInfoEx(IBindStatusCallbackEx *if return hres; } -#undef STATUSCLB_THIS - static const IBindStatusCallbackExVtbl BindStatusCallbackExVtbl = { BindStatusCallback_QueryInterface, BindStatusCallback_AddRef, @@ -257,46 +252,49 @@ static const IBindStatusCallbackExVtbl BindStatusCallbackExVtbl = { BindStatusCallback_GetBindInfoEx }; -#define SERVPROV_THIS(iface) DEFINE_THIS(BindStatusCallback, ServiceProvider, iface) +static inline BindStatusCallback *impl_from_IServiceProvider(IServiceProvider *iface) +{ + return CONTAINING_RECORD(iface, BindStatusCallback, IServiceProvider_iface); +} static HRESULT WINAPI BSCServiceProvider_QueryInterface(IServiceProvider *iface, REFIID riid, void **ppv) { - BindStatusCallback *This = SERVPROV_THIS(iface); - return IBindStatusCallback_QueryInterface(STATUSCLB(This), riid, ppv); + BindStatusCallback *This = impl_from_IServiceProvider(iface); + return IBindStatusCallback_QueryInterface(&This->IBindStatusCallbackEx_iface, riid, ppv); } static ULONG WINAPI BSCServiceProvider_AddRef(IServiceProvider *iface) { - BindStatusCallback *This = SERVPROV_THIS(iface); - return IBindStatusCallback_AddRef(STATUSCLB(This)); + BindStatusCallback *This = impl_from_IServiceProvider(iface); + return IBindStatusCallback_AddRef(&This->IBindStatusCallbackEx_iface); } static ULONG WINAPI BSCServiceProvider_Release(IServiceProvider *iface) { - BindStatusCallback *This = SERVPROV_THIS(iface); - return IBindStatusCallback_Release(STATUSCLB(This)); + BindStatusCallback *This = impl_from_IServiceProvider(iface); + return IBindStatusCallback_Release(&This->IBindStatusCallbackEx_iface); } static HRESULT WINAPI BSCServiceProvider_QueryService(IServiceProvider *iface, REFGUID guidService, REFIID riid, void **ppv) { - BindStatusCallback *This = SERVPROV_THIS(iface); + BindStatusCallback *This = impl_from_IServiceProvider(iface); HRESULT hres; if(IsEqualGUID(&IID_IHttpNegotiate, guidService)) { TRACE("(%p)->(IID_IHttpNegotiate %s %p)\n", This, debugstr_guid(riid), ppv); - return IBindStatusCallback_QueryInterface(STATUSCLB(This), riid, ppv); + return IBindStatusCallback_QueryInterface(&This->IBindStatusCallbackEx_iface, riid, ppv); } if(IsEqualGUID(&IID_IHttpNegotiate2, guidService)) { TRACE("(%p)->(IID_IHttpNegotiate2 %s %p)\n", This, debugstr_guid(riid), ppv); - return IBindStatusCallback_QueryInterface(STATUSCLB(This), riid, ppv); + return IBindStatusCallback_QueryInterface(&This->IBindStatusCallbackEx_iface, riid, ppv); } if(IsEqualGUID(&IID_IAuthenticate, guidService)) { TRACE("(%p)->(IID_IAuthenticate %s %p)\n", This, debugstr_guid(riid), ppv); - return IBindStatusCallback_QueryInterface(STATUSCLB(This), riid, ppv); + return IBindStatusCallback_QueryInterface(&This->IBindStatusCallbackEx_iface, riid, ppv); } TRACE("(%p)->(%s %s %p)\n", This, debugstr_guid(guidService), debugstr_guid(riid), ppv); @@ -314,8 +312,6 @@ static HRESULT WINAPI BSCServiceProvider_QueryService(IServiceProvider *iface, return E_NOINTERFACE; } -#undef SERVPROV_THIS - static const IServiceProviderVtbl BSCServiceProviderVtbl = { BSCServiceProvider_QueryInterface, BSCServiceProvider_AddRef, @@ -323,31 +319,34 @@ static const IServiceProviderVtbl BSCServiceProviderVtbl = { BSCServiceProvider_QueryService }; -#define HTTPNEG2_THIS(iface) DEFINE_THIS(BindStatusCallback, HttpNegotiate2, iface) +static inline BindStatusCallback *impl_from_IHttpNegotiate2(IHttpNegotiate2 *iface) +{ + return CONTAINING_RECORD(iface, BindStatusCallback, IHttpNegotiate2_iface); +} static HRESULT WINAPI BSCHttpNegotiate_QueryInterface(IHttpNegotiate2 *iface, REFIID riid, void **ppv) { - BindStatusCallback *This = HTTPNEG2_THIS(iface); - return IBindStatusCallback_QueryInterface(STATUSCLB(This), riid, ppv); + BindStatusCallback *This = impl_from_IHttpNegotiate2(iface); + return IBindStatusCallback_QueryInterface(&This->IBindStatusCallbackEx_iface, riid, ppv); } static ULONG WINAPI BSCHttpNegotiate_AddRef(IHttpNegotiate2 *iface) { - BindStatusCallback *This = HTTPNEG2_THIS(iface); - return IBindStatusCallback_AddRef(STATUSCLB(This)); + BindStatusCallback *This = impl_from_IHttpNegotiate2(iface); + return IBindStatusCallback_AddRef(&This->IBindStatusCallbackEx_iface); } static ULONG WINAPI BSCHttpNegotiate_Release(IHttpNegotiate2 *iface) { - BindStatusCallback *This = HTTPNEG2_THIS(iface); - return IBindStatusCallback_Release(STATUSCLB(This)); + BindStatusCallback *This = impl_from_IHttpNegotiate2(iface); + return IBindStatusCallback_Release(&This->IBindStatusCallbackEx_iface); } static HRESULT WINAPI BSCHttpNegotiate_BeginningTransaction(IHttpNegotiate2 *iface, LPCWSTR szURL, LPCWSTR szHeaders, DWORD dwReserved, LPWSTR *pszAdditionalHeaders) { - BindStatusCallback *This = HTTPNEG2_THIS(iface); + BindStatusCallback *This = impl_from_IHttpNegotiate2(iface); IHttpNegotiate *http_negotiate; HRESULT hres = S_OK; @@ -370,7 +369,7 @@ static HRESULT WINAPI BSCHttpNegotiate_OnResponse(IHttpNegotiate2 *iface, DWORD LPCWSTR szResponseHeaders, LPCWSTR szRequestHeaders, LPWSTR *pszAdditionalRequestHeaders) { - BindStatusCallback *This = HTTPNEG2_THIS(iface); + BindStatusCallback *This = impl_from_IHttpNegotiate2(iface); LPWSTR additional_headers = NULL; IHttpNegotiate *http_negotiate; HRESULT hres = S_OK; @@ -396,7 +395,7 @@ static HRESULT WINAPI BSCHttpNegotiate_OnResponse(IHttpNegotiate2 *iface, DWORD static HRESULT WINAPI BSCHttpNegotiate_GetRootSecurityId(IHttpNegotiate2 *iface, BYTE *pbSecurityId, DWORD *pcbSecurityId, DWORD_PTR dwReserved) { - BindStatusCallback *This = HTTPNEG2_THIS(iface); + BindStatusCallback *This = impl_from_IHttpNegotiate2(iface); IHttpNegotiate2 *http_negotiate2; HRESULT hres = E_FAIL; @@ -412,8 +411,6 @@ static HRESULT WINAPI BSCHttpNegotiate_GetRootSecurityId(IHttpNegotiate2 *iface, return hres; } -#undef HTTPNEG2_THIS - static const IHttpNegotiate2Vtbl BSCHttpNegotiateVtbl = { BSCHttpNegotiate_QueryInterface, BSCHttpNegotiate_AddRef, @@ -423,36 +420,37 @@ static const IHttpNegotiate2Vtbl BSCHttpNegotiateVtbl = { BSCHttpNegotiate_GetRootSecurityId }; -#define AUTHENTICATE_THIS(iface) DEFINE_THIS(BindStatusCallback, Authenticate, iface) +static inline BindStatusCallback *impl_from_IAuthenticate(IAuthenticate *iface) +{ + return CONTAINING_RECORD(iface, BindStatusCallback, IAuthenticate_iface); +} static HRESULT WINAPI BSCAuthenticate_QueryInterface(IAuthenticate *iface, REFIID riid, void **ppv) { - BindStatusCallback *This = AUTHENTICATE_THIS(iface); - return IBindStatusCallback_QueryInterface(AUTHENTICATE(This), riid, ppv); + BindStatusCallback *This = impl_from_IAuthenticate(iface); + return IBindStatusCallback_QueryInterface(&This->IAuthenticate_iface, riid, ppv); } static ULONG WINAPI BSCAuthenticate_AddRef(IAuthenticate *iface) { - BindStatusCallback *This = AUTHENTICATE_THIS(iface); - return IBindStatusCallback_AddRef(STATUSCLB(This)); + BindStatusCallback *This = impl_from_IAuthenticate(iface); + return IBindStatusCallback_AddRef(&This->IBindStatusCallbackEx_iface); } static ULONG WINAPI BSCAuthenticate_Release(IAuthenticate *iface) { - BindStatusCallback *This = AUTHENTICATE_THIS(iface); - return IBindStatusCallback_Release(STATUSCLB(This)); + BindStatusCallback *This = impl_from_IAuthenticate(iface); + return IBindStatusCallback_Release(&This->IBindStatusCallbackEx_iface); } static HRESULT WINAPI BSCAuthenticate_Authenticate(IAuthenticate *iface, HWND *phwnd, LPWSTR *pszUsername, LPWSTR *pszPassword) { - BindStatusCallback *This = AUTHENTICATE_THIS(iface); + BindStatusCallback *This = impl_from_IAuthenticate(iface); FIXME("(%p)->(%p %p %p)\n", This, phwnd, pszUsername, pszPassword); return E_NOTIMPL; } -#undef AUTHENTICATE_THIS - static const IAuthenticateVtbl BSCAuthenticateVtbl = { BSCAuthenticate_QueryInterface, BSCAuthenticate_AddRef, @@ -485,15 +483,15 @@ HRESULT wrap_callback(IBindStatusCallback *bsc, IBindStatusCallback **ret_iface) if(!ret) return E_OUTOFMEMORY; - ret->lpBindStatusCallbackExVtbl = &BindStatusCallbackExVtbl; - ret->lpServiceProviderVtbl = &BSCServiceProviderVtbl; - ret->lpHttpNegotiate2Vtbl = &BSCHttpNegotiateVtbl; - ret->lpAuthenticateVtbl = &BSCAuthenticateVtbl; + ret->IBindStatusCallbackEx_iface.lpVtbl = &BindStatusCallbackExVtbl; + ret->IServiceProvider_iface.lpVtbl = &BSCServiceProviderVtbl; + ret->IHttpNegotiate2_iface.lpVtbl = &BSCHttpNegotiateVtbl; + ret->IAuthenticate_iface.lpVtbl = &BSCAuthenticateVtbl; ret->ref = 1; set_callback(ret, bsc); - *ret_iface = STATUSCLB(ret); + *ret_iface = (IBindStatusCallback*)&ret->IBindStatusCallbackEx_iface; return S_OK; } @@ -541,7 +539,7 @@ HRESULT WINAPI RegisterBindStatusCallback(IBindCtx *pbc, IBindStatusCallback *pb set_callback(holder, pbsc); IBindStatusCallback_Release(bsc); - IBindStatusCallback_Release(STATUSCLB(holder)); + IBindStatusCallback_Release(&holder->IBindStatusCallbackEx_iface); return S_OK; }else { prev = bsc; @@ -605,7 +603,7 @@ HRESULT WINAPI RevokeBindStatusCallback(IBindCtx *pbc, IBindStatusCallback *pbsc if(SUCCEEDED(hres)) { if(pbsc == holder->callback) dorevoke = TRUE; - IBindStatusCallback_Release(STATUSCLB(holder)); + IBindStatusCallback_Release(&holder->IBindStatusCallbackEx_iface); }else if(pbsc == callback) { dorevoke = TRUE; } @@ -618,32 +616,33 @@ HRESULT WINAPI RevokeBindStatusCallback(IBindCtx *pbc, IBindStatusCallback *pbsc } typedef struct { - const IBindCtxVtbl *lpBindCtxVtbl; + IBindCtx IBindCtx_iface; LONG ref; IBindCtx *bindctx; } AsyncBindCtx; -#define BINDCTX(x) ((IBindCtx*) &(x)->lpBindCtxVtbl) - -#define BINDCTX_THIS(iface) DEFINE_THIS(AsyncBindCtx, BindCtx, iface) +static inline AsyncBindCtx *impl_from_IBindCtx(IBindCtx *iface) +{ + return CONTAINING_RECORD(iface, AsyncBindCtx, IBindCtx_iface); +} static HRESULT WINAPI AsyncBindCtx_QueryInterface(IBindCtx *iface, REFIID riid, void **ppv) { - AsyncBindCtx *This = BINDCTX_THIS(iface); + AsyncBindCtx *This = impl_from_IBindCtx(iface); *ppv = NULL; if(IsEqualGUID(riid, &IID_IUnknown)) { TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv); - *ppv = BINDCTX(This); + *ppv = &This->IBindCtx_iface; }else if(IsEqualGUID(riid, &IID_IBindCtx)) { TRACE("(%p)->(IID_IBindCtx %p)\n", This, ppv); - *ppv = BINDCTX(This); + *ppv = &This->IBindCtx_iface; }else if(IsEqualGUID(riid, &IID_IAsyncBindCtx)) { TRACE("(%p)->(IID_IAsyncBindCtx %p)\n", This, ppv); - *ppv = BINDCTX(This); + *ppv = &This->IBindCtx_iface; } if(*ppv) { @@ -657,7 +656,7 @@ static HRESULT WINAPI AsyncBindCtx_QueryInterface(IBindCtx *iface, REFIID riid, static ULONG WINAPI AsyncBindCtx_AddRef(IBindCtx *iface) { - AsyncBindCtx *This = BINDCTX_THIS(iface); + AsyncBindCtx *This = impl_from_IBindCtx(iface); LONG ref = InterlockedIncrement(&This->ref); TRACE("(%p) ref=%d\n", This, ref); @@ -667,7 +666,7 @@ static ULONG WINAPI AsyncBindCtx_AddRef(IBindCtx *iface) static ULONG WINAPI AsyncBindCtx_Release(IBindCtx *iface) { - AsyncBindCtx *This = BINDCTX_THIS(iface); + AsyncBindCtx *This = impl_from_IBindCtx(iface); LONG ref = InterlockedDecrement(&This->ref); TRACE("(%p) ref=%d\n", This, ref); @@ -682,7 +681,7 @@ static ULONG WINAPI AsyncBindCtx_Release(IBindCtx *iface) static HRESULT WINAPI AsyncBindCtx_RegisterObjectBound(IBindCtx *iface, IUnknown *punk) { - AsyncBindCtx *This = BINDCTX_THIS(iface); + AsyncBindCtx *This = impl_from_IBindCtx(iface); TRACE("(%p)->(%p)\n", This, punk); @@ -691,7 +690,7 @@ static HRESULT WINAPI AsyncBindCtx_RegisterObjectBound(IBindCtx *iface, IUnknown static HRESULT WINAPI AsyncBindCtx_RevokeObjectBound(IBindCtx *iface, IUnknown *punk) { - AsyncBindCtx *This = BINDCTX_THIS(iface); + AsyncBindCtx *This = impl_from_IBindCtx(iface); TRACE("(%p %p)\n", This, punk); @@ -700,7 +699,7 @@ static HRESULT WINAPI AsyncBindCtx_RevokeObjectBound(IBindCtx *iface, IUnknown * static HRESULT WINAPI AsyncBindCtx_ReleaseBoundObjects(IBindCtx *iface) { - AsyncBindCtx *This = BINDCTX_THIS(iface); + AsyncBindCtx *This = impl_from_IBindCtx(iface); TRACE("(%p)\n", This); @@ -709,7 +708,7 @@ static HRESULT WINAPI AsyncBindCtx_ReleaseBoundObjects(IBindCtx *iface) static HRESULT WINAPI AsyncBindCtx_SetBindOptions(IBindCtx *iface, BIND_OPTS *pbindopts) { - AsyncBindCtx *This = BINDCTX_THIS(iface); + AsyncBindCtx *This = impl_from_IBindCtx(iface); TRACE("(%p)->(%p)\n", This, pbindopts); @@ -718,7 +717,7 @@ static HRESULT WINAPI AsyncBindCtx_SetBindOptions(IBindCtx *iface, BIND_OPTS *pb static HRESULT WINAPI AsyncBindCtx_GetBindOptions(IBindCtx *iface, BIND_OPTS *pbindopts) { - AsyncBindCtx *This = BINDCTX_THIS(iface); + AsyncBindCtx *This = impl_from_IBindCtx(iface); TRACE("(%p)->(%p)\n", This, pbindopts); @@ -727,7 +726,7 @@ static HRESULT WINAPI AsyncBindCtx_GetBindOptions(IBindCtx *iface, BIND_OPTS *pb static HRESULT WINAPI AsyncBindCtx_GetRunningObjectTable(IBindCtx *iface, IRunningObjectTable **pprot) { - AsyncBindCtx *This = BINDCTX_THIS(iface); + AsyncBindCtx *This = impl_from_IBindCtx(iface); TRACE("(%p)->(%p)\n", This, pprot); @@ -736,7 +735,7 @@ static HRESULT WINAPI AsyncBindCtx_GetRunningObjectTable(IBindCtx *iface, IRunni static HRESULT WINAPI AsyncBindCtx_RegisterObjectParam(IBindCtx *iface, LPOLESTR pszkey, IUnknown *punk) { - AsyncBindCtx *This = BINDCTX_THIS(iface); + AsyncBindCtx *This = impl_from_IBindCtx(iface); TRACE("(%p)->(%s %p)\n", This, debugstr_w(pszkey), punk); @@ -745,7 +744,7 @@ static HRESULT WINAPI AsyncBindCtx_RegisterObjectParam(IBindCtx *iface, LPOLESTR static HRESULT WINAPI AsyncBindCtx_GetObjectParam(IBindCtx* iface, LPOLESTR pszkey, IUnknown **punk) { - AsyncBindCtx *This = BINDCTX_THIS(iface); + AsyncBindCtx *This = impl_from_IBindCtx(iface); TRACE("(%p)->(%s %p)\n", This, debugstr_w(pszkey), punk); @@ -754,7 +753,7 @@ static HRESULT WINAPI AsyncBindCtx_GetObjectParam(IBindCtx* iface, LPOLESTR pszk static HRESULT WINAPI AsyncBindCtx_RevokeObjectParam(IBindCtx *iface, LPOLESTR pszkey) { - AsyncBindCtx *This = BINDCTX_THIS(iface); + AsyncBindCtx *This = impl_from_IBindCtx(iface); TRACE("(%p)->(%s)\n", This, debugstr_w(pszkey)); @@ -763,15 +762,13 @@ static HRESULT WINAPI AsyncBindCtx_RevokeObjectParam(IBindCtx *iface, LPOLESTR p static HRESULT WINAPI AsyncBindCtx_EnumObjectParam(IBindCtx *iface, IEnumString **pszkey) { - AsyncBindCtx *This = BINDCTX_THIS(iface); + AsyncBindCtx *This = impl_from_IBindCtx(iface); TRACE("(%p)->(%p)\n", This, pszkey); return IBindCtx_EnumObjectParam(This->bindctx, pszkey); } -#undef BINDCTX_THIS - static const IBindCtxVtbl AsyncBindCtxVtbl = { AsyncBindCtx_QueryInterface, @@ -878,16 +875,16 @@ HRESULT WINAPI CreateAsyncBindCtxEx(IBindCtx *ibind, DWORD options, ret = heap_alloc(sizeof(AsyncBindCtx)); - ret->lpBindCtxVtbl = &AsyncBindCtxVtbl; + ret->IBindCtx_iface.lpVtbl = &AsyncBindCtxVtbl; ret->ref = 1; ret->bindctx = bindctx; - hres = init_bindctx(BINDCTX(ret), options, callback, format); + hres = init_bindctx(&ret->IBindCtx_iface, options, callback, format); if(FAILED(hres)) { - IBindCtx_Release(BINDCTX(ret)); + IBindCtx_Release(&ret->IBindCtx_iface); return hres; } - *pbind = BINDCTX(ret); + *pbind = &ret->IBindCtx_iface; return S_OK; } diff --git a/dll/win32/urlmon/binding.c b/dll/win32/urlmon/binding.c index 699bf98a76d..5504f6f2f4b 100644 --- a/dll/win32/urlmon/binding.c +++ b/dll/win32/urlmon/binding.c @@ -27,27 +27,13 @@ WINE_DEFAULT_DEBUG_CHANNEL(urlmon); static WCHAR cbinding_contextW[] = {'C','B','i','n','d','i','n','g',' ','C','o','n','t','e','x','t',0}; static WCHAR bscb_holderW[] = { '_','B','S','C','B','_','H','o','l','d','e','r','_',0 }; -typedef struct Binding Binding; - -struct _task_header_t; - -typedef void (*task_proc_t)(Binding*, struct _task_header_t*); - -typedef struct _task_header_t { - task_proc_t proc; - struct _task_header_t *next; -} task_header_t; - typedef struct { - const IUnknownVtbl *lpUnknownVtbl; + IUnknown IUnknown_iface; LONG ref; IInternetProtocolEx *protocol; - BYTE buf[1024*8]; - DWORD size; - BOOL init; HANDLE file; HRESULT hres; @@ -66,8 +52,6 @@ struct _stgmed_obj_t { const stgmed_obj_vtbl *vtbl; }; -#define STGMEDUNK(x) ((IUnknown*) &(x)->lpUnknownVtbl) - typedef enum { BEFORE_DOWNLOAD, DOWNLOADING, @@ -79,19 +63,20 @@ typedef enum { #define BINDING_OBJAVAIL 0x0004 #define BINDING_ABORTED 0x0008 -struct Binding { - const IBindingVtbl *lpBindingVtbl; - const IInternetProtocolSinkVtbl *lpIInternetProtocolSinkVtbl; - const IInternetBindInfoVtbl *lpInternetBindInfoVtbl; - const IWinInetHttpInfoVtbl *lpWinInetHttpInfoVtbl; - const IServiceProviderVtbl *lpServiceProviderVtbl; +typedef struct { + IBinding IBinding_iface; + IInternetProtocolSink IInternetProtocolSink_iface; + IInternetBindInfo IInternetBindInfo_iface; + IWinInetHttpInfo IWinInetHttpInfo_iface; + IServiceProvider IServiceProvider_iface; LONG ref; IBindStatusCallback *callback; - IInternetProtocolEx *protocol; IServiceProvider *service_provider; + BindProtocol *protocol; + stgmed_buf_t *stgmed_buf; stgmed_obj_t *stgmed_obj; @@ -114,29 +99,7 @@ struct Binding { HWND notif_hwnd; CRITICAL_SECTION section; -}; - -#define BINDING(x) ((IBinding*) &(x)->lpBindingVtbl) -#define BINDINF(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl) -#define INETINFO(x) ((IWinInetHttpInfo*) &(x)->lpWinInetHttpInfoVtbl) -#define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl) - -#define STREAM(x) ((IStream*) &(x)->lpStreamVtbl) -#define HTTPNEG2(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl) - -static void fill_stgmed_buffer(stgmed_buf_t *buf) -{ - DWORD read = 0; - - if(sizeof(buf->buf) == buf->size) - return; - - buf->hres = IInternetProtocol_Read(buf->protocol, buf->buf+buf->size, - sizeof(buf->buf)-buf->size, &read); - buf->size += read; - if(read > 0) - buf->init = TRUE; -} +} Binding; static void read_protocol_data(stgmed_buf_t *stgmed_buf) { @@ -144,10 +107,6 @@ static void read_protocol_data(stgmed_buf_t *stgmed_buf) DWORD read; HRESULT hres; - fill_stgmed_buffer(stgmed_buf); - if(stgmed_buf->size < sizeof(stgmed_buf->buf)) - return; - do hres = IInternetProtocol_Read(stgmed_buf->protocol, buf, sizeof(buf), &read); while(hres == S_OK); } @@ -212,7 +171,7 @@ static void mime_available(Binding *This, LPCWSTR mime) static void stop_binding(Binding *binding, HRESULT hres, LPCWSTR str) { if(binding->state & BINDING_LOCKED) { - IInternetProtocol_UnlockRequest(binding->protocol); + IInternetProtocolEx_UnlockRequest(&binding->protocol->IInternetProtocolEx_iface); binding->state &= ~BINDING_LOCKED; } @@ -281,7 +240,7 @@ static void load_doc_mon(Binding *binding, IPersistMoniker *persist) } IBindCtx_RevokeObjectParam(bctx, bscb_holderW); - IBindCtx_RegisterObjectParam(bctx, cbinding_contextW, (IUnknown*)BINDING(binding)); + IBindCtx_RegisterObjectParam(bctx, cbinding_contextW, (IUnknown*)&binding->IBinding_iface); hres = IPersistMoniker_Load(persist, binding->download_state == END_DOWNLOAD, binding->mon, bctx, 0x12); IBindCtx_RevokeObjectParam(bctx, cbinding_contextW); @@ -354,7 +313,7 @@ static void create_object(Binding *binding) stop_binding(binding, hres, NULL); if(FAILED(hres)) - IInternetProtocol_Terminate(binding->protocol, 0); + IInternetProtocolEx_Terminate(&binding->protocol->IInternetProtocolEx_iface, 0); } static void cache_file_available(Binding *This, const WCHAR *file_name) @@ -370,19 +329,22 @@ static void cache_file_available(Binding *This, const WCHAR *file_name) } } -#define STGMEDUNK_THIS(iface) DEFINE_THIS(stgmed_buf_t, Unknown, iface) +static inline stgmed_buf_t *impl_from_IUnknown(IUnknown *iface) +{ + return CONTAINING_RECORD(iface, stgmed_buf_t, IUnknown_iface); +} static HRESULT WINAPI StgMedUnk_QueryInterface(IUnknown *iface, REFIID riid, void **ppv) { - stgmed_buf_t *This = STGMEDUNK_THIS(iface); + stgmed_buf_t *This = impl_from_IUnknown(iface); *ppv = NULL; if(IsEqualGUID(riid, &IID_IUnknown)) { TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv); - *ppv = STGMEDUNK(This); - IUnknown_AddRef(STGMEDUNK(This)); + *ppv = &This->IUnknown_iface; + IUnknown_AddRef(&This->IUnknown_iface); return S_OK; } @@ -392,7 +354,7 @@ static HRESULT WINAPI StgMedUnk_QueryInterface(IUnknown *iface, REFIID riid, voi static ULONG WINAPI StgMedUnk_AddRef(IUnknown *iface) { - stgmed_buf_t *This = STGMEDUNK_THIS(iface); + stgmed_buf_t *This = impl_from_IUnknown(iface); LONG ref = InterlockedIncrement(&This->ref); TRACE("(%p) ref=%d\n", This, ref); @@ -402,7 +364,7 @@ static ULONG WINAPI StgMedUnk_AddRef(IUnknown *iface) static ULONG WINAPI StgMedUnk_Release(IUnknown *iface) { - stgmed_buf_t *This = STGMEDUNK_THIS(iface); + stgmed_buf_t *This = impl_from_IUnknown(iface); LONG ref = InterlockedDecrement(&This->ref); TRACE("(%p) ref=%d\n", This, ref); @@ -420,8 +382,6 @@ static ULONG WINAPI StgMedUnk_Release(IUnknown *iface) return ref; } -#undef STGMEDUNK_THIS - static const IUnknownVtbl StgMedUnkVtbl = { StgMedUnk_QueryInterface, StgMedUnk_AddRef, @@ -432,10 +392,8 @@ static stgmed_buf_t *create_stgmed_buf(IInternetProtocolEx *protocol) { stgmed_buf_t *ret = heap_alloc(sizeof(*ret)); - ret->lpUnknownVtbl = &StgMedUnkVtbl; + ret->IUnknown_iface.lpVtbl = &StgMedUnkVtbl; ret->ref = 1; - ret->size = 0; - ret->init = FALSE; ret->file = INVALID_HANDLE_VALUE; ret->hres = S_OK; ret->cache_file = NULL; @@ -450,35 +408,38 @@ static stgmed_buf_t *create_stgmed_buf(IInternetProtocolEx *protocol) typedef struct { stgmed_obj_t stgmed_obj; - const IStreamVtbl *lpStreamVtbl; + IStream IStream_iface; LONG ref; stgmed_buf_t *buf; } ProtocolStream; -#define STREAM_THIS(iface) DEFINE_THIS(ProtocolStream, Stream, iface) +static inline ProtocolStream *impl_from_IStream(IStream *iface) +{ + return CONTAINING_RECORD(iface, ProtocolStream, IStream_iface); +} static HRESULT WINAPI ProtocolStream_QueryInterface(IStream *iface, REFIID riid, void **ppv) { - ProtocolStream *This = STREAM_THIS(iface); + ProtocolStream *This = impl_from_IStream(iface); *ppv = NULL; if(IsEqualGUID(&IID_IUnknown, riid)) { TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv); - *ppv = STREAM(This); + *ppv = &This->IStream_iface; }else if(IsEqualGUID(&IID_ISequentialStream, riid)) { TRACE("(%p)->(IID_ISequentialStream %p)\n", This, ppv); - *ppv = STREAM(This); + *ppv = &This->IStream_iface; }else if(IsEqualGUID(&IID_IStream, riid)) { TRACE("(%p)->(IID_IStream %p)\n", This, ppv); - *ppv = STREAM(This); + *ppv = &This->IStream_iface; } if(*ppv) { - IStream_AddRef(STREAM(This)); + IStream_AddRef(&This->IStream_iface); return S_OK; } @@ -488,7 +449,7 @@ static HRESULT WINAPI ProtocolStream_QueryInterface(IStream *iface, static ULONG WINAPI ProtocolStream_AddRef(IStream *iface) { - ProtocolStream *This = STREAM_THIS(iface); + ProtocolStream *This = impl_from_IStream(iface); LONG ref = InterlockedIncrement(&This->ref); TRACE("(%p) ref=%d\n", This, ref); @@ -498,13 +459,13 @@ static ULONG WINAPI ProtocolStream_AddRef(IStream *iface) static ULONG WINAPI ProtocolStream_Release(IStream *iface) { - ProtocolStream *This = STREAM_THIS(iface); + ProtocolStream *This = impl_from_IStream(iface); LONG ref = InterlockedDecrement(&This->ref); TRACE("(%p) ref=%d\n", This, ref); if(!ref) { - IUnknown_Release(STGMEDUNK(This->buf)); + IUnknown_Release(&This->buf->IUnknown_iface); heap_free(This); URLMON_UnlockModule(); @@ -516,56 +477,33 @@ static ULONG WINAPI ProtocolStream_Release(IStream *iface) static HRESULT WINAPI ProtocolStream_Read(IStream *iface, void *pv, ULONG cb, ULONG *pcbRead) { - ProtocolStream *This = STREAM_THIS(iface); - DWORD read = 0, pread = 0; + ProtocolStream *This = impl_from_IStream(iface); + DWORD read = 0; HRESULT hres; TRACE("(%p)->(%p %d %p)\n", This, pv, cb, pcbRead); - if(This->buf->file != INVALID_HANDLE_VALUE) { - if (!ReadFile(This->buf->file, pv, cb, &read, NULL)) - return INET_E_DOWNLOAD_FAILURE; - - if(pcbRead) - *pcbRead = read; - return read ? S_OK : S_FALSE; + if(This->buf->file == INVALID_HANDLE_VALUE) { + hres = This->buf->hres = IInternetProtocol_Read(This->buf->protocol, (PBYTE)pv, cb, &read); + }else { + hres = ReadFile(This->buf->file, pv, cb, &read, NULL) ? S_OK : INET_E_DOWNLOAD_FAILURE; } - if(This->buf->size) { - read = cb; - - if(read > This->buf->size) - read = This->buf->size; - - memcpy(pv, This->buf->buf, read); - - if(read < This->buf->size) - memmove(This->buf->buf, This->buf->buf+read, This->buf->size-read); - This->buf->size -= read; - } - - if(read == cb) { - if (pcbRead) - *pcbRead = read; - return S_OK; - } - - hres = This->buf->hres = IInternetProtocol_Read(This->buf->protocol, (PBYTE)pv+read, cb-read, &pread); if (pcbRead) - *pcbRead = read + pread; + *pcbRead = read; if(hres == E_PENDING) return E_PENDING; else if(FAILED(hres)) FIXME("Read failed: %08x\n", hres); - return read || pread ? S_OK : S_FALSE; + return read ? S_OK : S_FALSE; } static HRESULT WINAPI ProtocolStream_Write(IStream *iface, const void *pv, ULONG cb, ULONG *pcbWritten) { - ProtocolStream *This = STREAM_THIS(iface); + ProtocolStream *This = impl_from_IStream(iface); TRACE("(%p)->(%p %d %p)\n", This, pv, cb, pcbWritten); @@ -575,14 +513,14 @@ static HRESULT WINAPI ProtocolStream_Write(IStream *iface, const void *pv, static HRESULT WINAPI ProtocolStream_Seek(IStream *iface, LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition) { - ProtocolStream *This = STREAM_THIS(iface); + ProtocolStream *This = impl_from_IStream(iface); FIXME("(%p)->(%d %08x %p)\n", This, dlibMove.u.LowPart, dwOrigin, plibNewPosition); return E_NOTIMPL; } static HRESULT WINAPI ProtocolStream_SetSize(IStream *iface, ULARGE_INTEGER libNewSize) { - ProtocolStream *This = STREAM_THIS(iface); + ProtocolStream *This = impl_from_IStream(iface); FIXME("(%p)->(%d)\n", This, libNewSize.u.LowPart); return E_NOTIMPL; } @@ -590,14 +528,14 @@ static HRESULT WINAPI ProtocolStream_SetSize(IStream *iface, ULARGE_INTEGER libN static HRESULT WINAPI ProtocolStream_CopyTo(IStream *iface, IStream *pstm, ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten) { - ProtocolStream *This = STREAM_THIS(iface); + ProtocolStream *This = impl_from_IStream(iface); FIXME("(%p)->(%p %d %p %p)\n", This, pstm, cb.u.LowPart, pcbRead, pcbWritten); return E_NOTIMPL; } static HRESULT WINAPI ProtocolStream_Commit(IStream *iface, DWORD grfCommitFlags) { - ProtocolStream *This = STREAM_THIS(iface); + ProtocolStream *This = impl_from_IStream(iface); TRACE("(%p)->(%08x)\n", This, grfCommitFlags); @@ -606,7 +544,7 @@ static HRESULT WINAPI ProtocolStream_Commit(IStream *iface, DWORD grfCommitFlags static HRESULT WINAPI ProtocolStream_Revert(IStream *iface) { - ProtocolStream *This = STREAM_THIS(iface); + ProtocolStream *This = impl_from_IStream(iface); TRACE("(%p)\n", This); @@ -616,7 +554,7 @@ static HRESULT WINAPI ProtocolStream_Revert(IStream *iface) static HRESULT WINAPI ProtocolStream_LockRegion(IStream *iface, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) { - ProtocolStream *This = STREAM_THIS(iface); + ProtocolStream *This = impl_from_IStream(iface); FIXME("(%p)->(%d %d %d)\n", This, libOffset.u.LowPart, cb.u.LowPart, dwLockType); return E_NOTIMPL; } @@ -624,7 +562,7 @@ static HRESULT WINAPI ProtocolStream_LockRegion(IStream *iface, ULARGE_INTEGER l static HRESULT WINAPI ProtocolStream_UnlockRegion(IStream *iface, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType) { - ProtocolStream *This = STREAM_THIS(iface); + ProtocolStream *This = impl_from_IStream(iface); FIXME("(%p)->(%d %d %d)\n", This, libOffset.u.LowPart, cb.u.LowPart, dwLockType); return E_NOTIMPL; } @@ -632,7 +570,7 @@ static HRESULT WINAPI ProtocolStream_UnlockRegion(IStream *iface, static HRESULT WINAPI ProtocolStream_Stat(IStream *iface, STATSTG *pstatstg, DWORD dwStatFlag) { - ProtocolStream *This = STREAM_THIS(iface); + ProtocolStream *This = impl_from_IStream(iface); TRACE("(%p)->(%p %08x)\n", This, pstatstg, dwStatFlag); if(!pstatstg) @@ -661,13 +599,11 @@ static HRESULT WINAPI ProtocolStream_Stat(IStream *iface, STATSTG *pstatstg, static HRESULT WINAPI ProtocolStream_Clone(IStream *iface, IStream **ppstm) { - ProtocolStream *This = STREAM_THIS(iface); + ProtocolStream *This = impl_from_IStream(iface); FIXME("(%p)->(%p)\n", This, ppstm); return E_NOTIMPL; } -#undef STREAM_THIS - static const IStreamVtbl ProtocolStreamVtbl = { ProtocolStream_QueryInterface, ProtocolStream_AddRef, @@ -688,7 +624,7 @@ static const IStreamVtbl ProtocolStreamVtbl = { static void stgmed_stream_release(stgmed_obj_t *obj) { ProtocolStream *stream = (ProtocolStream*)obj; - IStream_Release(STREAM(stream)); + IStream_Release(&stream->IStream_iface); } static HRESULT stgmed_stream_fill_stgmed(stgmed_obj_t *obj, STGMEDIUM *stgmed) @@ -696,8 +632,8 @@ static HRESULT stgmed_stream_fill_stgmed(stgmed_obj_t *obj, STGMEDIUM *stgmed) ProtocolStream *stream = (ProtocolStream*)obj; stgmed->tymed = TYMED_ISTREAM; - stgmed->u.pstm = STREAM(stream); - stgmed->pUnkForRelease = STGMEDUNK(stream->buf); + stgmed->u.pstm = &stream->IStream_iface; + stgmed->pUnkForRelease = &stream->buf->IUnknown_iface; return S_OK; } @@ -707,11 +643,11 @@ static HRESULT stgmed_stream_get_result(stgmed_obj_t *obj, DWORD bindf, void **r ProtocolStream *stream = (ProtocolStream*)obj; if(!(bindf & BINDF_ASYNCHRONOUS) && stream->buf->file == INVALID_HANDLE_VALUE - && (stream->buf->hres != S_FALSE || stream->buf->size)) + && stream->buf->hres != S_FALSE) return INET_E_DATA_NOT_AVAILABLE; - IStream_AddRef(STREAM(stream)); - *result = STREAM(stream); + IStream_AddRef(&stream->IStream_iface); + *result = &stream->IStream_iface; return S_OK; } @@ -731,10 +667,10 @@ static stgmed_obj_t *create_stgmed_stream(stgmed_buf_t *buf) ProtocolStream *ret = heap_alloc(sizeof(ProtocolStream)); ret->stgmed_obj.vtbl = &stgmed_stream_vtbl; - ret->lpStreamVtbl = &ProtocolStreamVtbl; + ret->IStream_iface.lpVtbl = &ProtocolStreamVtbl; ret->ref = 1; - IUnknown_AddRef(STGMEDUNK(buf)); + IUnknown_AddRef(&buf->IUnknown_iface); ret->buf = buf; URLMON_LockModule(); @@ -746,7 +682,7 @@ static void stgmed_file_release(stgmed_obj_t *obj) { stgmed_file_obj_t *file_obj = (stgmed_file_obj_t*)obj; - IUnknown_Release(STGMEDUNK(file_obj->buf)); + IUnknown_Release(&file_obj->buf->IUnknown_iface); heap_free(file_obj); } @@ -763,7 +699,7 @@ static HRESULT stgmed_file_fill_stgmed(stgmed_obj_t *obj, STGMEDIUM *stgmed) stgmed->tymed = TYMED_FILE; stgmed->u.lpszFileName = file_obj->buf->cache_file; - stgmed->pUnkForRelease = STGMEDUNK(file_obj->buf); + stgmed->pUnkForRelease = &file_obj->buf->IUnknown_iface; return S_OK; } @@ -785,64 +721,57 @@ static stgmed_obj_t *create_stgmed_file(stgmed_buf_t *buf) ret->stgmed_obj.vtbl = &stgmed_file_vtbl; - IUnknown_AddRef(STGMEDUNK(buf)); + IUnknown_AddRef(&buf->IUnknown_iface); ret->buf = buf; return &ret->stgmed_obj; } -#define BINDING_THIS(iface) DEFINE_THIS(Binding, Binding, iface) +static inline Binding *impl_from_IBinding(IBinding *iface) +{ + return CONTAINING_RECORD(iface, Binding, IBinding_iface); +} static HRESULT WINAPI Binding_QueryInterface(IBinding *iface, REFIID riid, void **ppv) { - Binding *This = BINDING_THIS(iface); + Binding *This = impl_from_IBinding(iface); *ppv = NULL; if(IsEqualGUID(&IID_IUnknown, riid)) { TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv); - *ppv = BINDING(This); + *ppv = &This->IBinding_iface; }else if(IsEqualGUID(&IID_IBinding, riid)) { TRACE("(%p)->(IID_IBinding %p)\n", This, ppv); - *ppv = BINDING(This); + *ppv = &This->IBinding_iface; }else if(IsEqualGUID(&IID_IInternetProtocolSink, riid)) { TRACE("(%p)->(IID_IInternetProtocolSink %p)\n", This, ppv); - *ppv = PROTSINK(This); + *ppv = &This->IInternetProtocolSink_iface; }else if(IsEqualGUID(&IID_IInternetBindInfo, riid)) { TRACE("(%p)->(IID_IInternetBindInfo %p)\n", This, ppv); - *ppv = BINDINF(This); + *ppv = &This->IInternetBindInfo_iface; }else if(IsEqualGUID(&IID_IServiceProvider, riid)) { TRACE("(%p)->(IID_IServiceProvider %p)\n", This, ppv); - *ppv = SERVPROV(This); + *ppv = &This->IServiceProvider_iface; }else if(IsEqualGUID(&IID_IWinInetInfo, riid)) { TRACE("(%p)->(IID_IWinInetInfo %p)\n", This, ppv); /* NOTE: This violidates COM rules, but tests prove that we should do it */ - if(!get_wininet_info(This->protocol)) + if(!This->protocol->wininet_info) return E_NOINTERFACE; - *ppv = INETINFO(This); + *ppv = &This->IWinInetHttpInfo_iface; }else if(IsEqualGUID(&IID_IWinInetHttpInfo, riid)) { - IWinInetHttpInfo *http_info; - IWinInetInfo *info; - HRESULT hres; - TRACE("(%p)->(IID_IWinInetHttpInfo %p)\n", This, ppv); - info = get_wininet_info(This->protocol); - if(!info) + if(!This->protocol->wininet_http_info) return E_NOINTERFACE; - hres = IWinInetInfo_QueryInterface(info, &IID_IWinInetHttpInfo, (void**)&http_info); - if(FAILED(hres)) - return E_NOINTERFACE; - - IWinInetHttpInfo_Release(http_info); - *ppv = INETINFO(This); + *ppv = &This->IWinInetHttpInfo_iface; } if(*ppv) { - IBinding_AddRef(BINDING(This)); + IBinding_AddRef(&This->IBinding_iface); return S_OK; } @@ -852,7 +781,7 @@ static HRESULT WINAPI Binding_QueryInterface(IBinding *iface, REFIID riid, void static ULONG WINAPI Binding_AddRef(IBinding *iface) { - Binding *This = BINDING_THIS(iface); + Binding *This = impl_from_IBinding(iface); LONG ref = InterlockedIncrement(&This->ref); TRACE("(%p) ref=%d\n", This, ref); @@ -862,7 +791,7 @@ static ULONG WINAPI Binding_AddRef(IBinding *iface) static ULONG WINAPI Binding_Release(IBinding *iface) { - Binding *This = BINDING_THIS(iface); + Binding *This = impl_from_IBinding(iface); LONG ref = InterlockedDecrement(&This->ref); TRACE("(%p) ref=%d\n", This, ref); @@ -875,11 +804,11 @@ static ULONG WINAPI Binding_Release(IBinding *iface) if(This->callback) IBindStatusCallback_Release(This->callback); if(This->protocol) - IInternetProtocol_Release(This->protocol); + IInternetProtocolEx_Release(&This->protocol->IInternetProtocolEx_iface); if(This->service_provider) IServiceProvider_Release(This->service_provider); if(This->stgmed_buf) - IUnknown_Release(STGMEDUNK(This->stgmed_buf)); + IUnknown_Release(&This->stgmed_buf->IUnknown_iface); if(This->stgmed_obj) This->stgmed_obj->vtbl->release(This->stgmed_obj); if(This->obj) @@ -903,7 +832,7 @@ static ULONG WINAPI Binding_Release(IBinding *iface) static HRESULT WINAPI Binding_Abort(IBinding *iface) { - Binding *This = BINDING_THIS(iface); + Binding *This = impl_from_IBinding(iface); HRESULT hres; TRACE("(%p)\n", This); @@ -911,7 +840,8 @@ static HRESULT WINAPI Binding_Abort(IBinding *iface) if(This->state & BINDING_ABORTED) return E_FAIL; - hres = IInternetProtocol_Abort(This->protocol, E_ABORT, ERROR_SUCCESS); + hres = IInternetProtocolEx_Abort(&This->protocol->IInternetProtocolEx_iface, E_ABORT, + ERROR_SUCCESS); if(FAILED(hres)) return hres; @@ -921,28 +851,28 @@ static HRESULT WINAPI Binding_Abort(IBinding *iface) static HRESULT WINAPI Binding_Suspend(IBinding *iface) { - Binding *This = BINDING_THIS(iface); + Binding *This = impl_from_IBinding(iface); FIXME("(%p)\n", This); return E_NOTIMPL; } static HRESULT WINAPI Binding_Resume(IBinding *iface) { - Binding *This = BINDING_THIS(iface); + Binding *This = impl_from_IBinding(iface); FIXME("(%p)\n", This); return E_NOTIMPL; } static HRESULT WINAPI Binding_SetPriority(IBinding *iface, LONG nPriority) { - Binding *This = BINDING_THIS(iface); + Binding *This = impl_from_IBinding(iface); FIXME("(%p)->(%d)\n", This, nPriority); return E_NOTIMPL; } static HRESULT WINAPI Binding_GetPriority(IBinding *iface, LONG *pnPriority) { - Binding *This = BINDING_THIS(iface); + Binding *This = impl_from_IBinding(iface); FIXME("(%p)->(%p)\n", This, pnPriority); return E_NOTIMPL; } @@ -950,32 +880,11 @@ static HRESULT WINAPI Binding_GetPriority(IBinding *iface, LONG *pnPriority) static HRESULT WINAPI Binding_GetBindResult(IBinding *iface, CLSID *pclsidProtocol, DWORD *pdwResult, LPOLESTR *pszResult, DWORD *pdwReserved) { - Binding *This = BINDING_THIS(iface); + Binding *This = impl_from_IBinding(iface); FIXME("(%p)->(%p %p %p %p)\n", This, pclsidProtocol, pdwResult, pszResult, pdwReserved); return E_NOTIMPL; } -static Binding *get_bctx_binding(IBindCtx *bctx) -{ - IBinding *binding; - IUnknown *unk; - HRESULT hres; - - hres = IBindCtx_GetObjectParam(bctx, cbinding_contextW, &unk); - if(FAILED(hres)) - return NULL; - - hres = IUnknown_QueryInterface(unk, &IID_IBinding, (void*)&binding); - IUnknown_Release(unk); - if(FAILED(hres)) - return NULL; - - /* FIXME!!! */ - return BINDING_THIS(binding); -} - -#undef BINDING_THIS - static const IBindingVtbl BindingVtbl = { Binding_QueryInterface, Binding_AddRef, @@ -988,31 +897,54 @@ static const IBindingVtbl BindingVtbl = { Binding_GetBindResult }; -#define PROTSINK_THIS(iface) DEFINE_THIS(Binding, IInternetProtocolSink, iface) +static Binding *get_bctx_binding(IBindCtx *bctx) +{ + IBinding *binding; + IUnknown *unk; + HRESULT hres; + + hres = IBindCtx_GetObjectParam(bctx, cbinding_contextW, &unk); + if(FAILED(hres)) + return NULL; + + hres = IUnknown_QueryInterface(unk, &IID_IBinding, (void**)&binding); + IUnknown_Release(unk); + if(FAILED(hres)) + return NULL; + + if (binding->lpVtbl != &BindingVtbl) + return NULL; + return impl_from_IBinding(binding); +} + +static inline Binding *impl_from_IInternetProtocolSink(IInternetProtocolSink *iface) +{ + return CONTAINING_RECORD(iface, Binding, IInternetProtocolSink_iface); +} static HRESULT WINAPI InternetProtocolSink_QueryInterface(IInternetProtocolSink *iface, REFIID riid, void **ppv) { - Binding *This = PROTSINK_THIS(iface); - return IBinding_QueryInterface(BINDING(This), riid, ppv); + Binding *This = impl_from_IInternetProtocolSink(iface); + return IBinding_QueryInterface(&This->IBinding_iface, riid, ppv); } static ULONG WINAPI InternetProtocolSink_AddRef(IInternetProtocolSink *iface) { - Binding *This = PROTSINK_THIS(iface); - return IBinding_AddRef(BINDING(This)); + Binding *This = impl_from_IInternetProtocolSink(iface); + return IBinding_AddRef(&This->IBinding_iface); } static ULONG WINAPI InternetProtocolSink_Release(IInternetProtocolSink *iface) { - Binding *This = PROTSINK_THIS(iface); - return IBinding_Release(BINDING(This)); + Binding *This = impl_from_IInternetProtocolSink(iface); + return IBinding_Release(&This->IBinding_iface); } static HRESULT WINAPI InternetProtocolSink_Switch(IInternetProtocolSink *iface, PROTOCOLDATA *pProtocolData) { - Binding *This = PROTSINK_THIS(iface); + Binding *This = impl_from_IInternetProtocolSink(iface); WARN("(%p)->(%p)\n", This, pProtocolData); @@ -1029,7 +961,7 @@ static void on_progress(Binding *This, ULONG progress, ULONG progress_max, static HRESULT WINAPI InternetProtocolSink_ReportProgress(IInternetProtocolSink *iface, ULONG ulStatusCode, LPCWSTR szStatusText) { - Binding *This = PROTSINK_THIS(iface); + Binding *This = impl_from_IInternetProtocolSink(iface); TRACE("(%p)->(%u %s)\n", This, ulStatusCode, debugstr_w(szStatusText)); @@ -1046,7 +978,6 @@ static HRESULT WINAPI InternetProtocolSink_ReportProgress(IInternetProtocolSink on_progress(This, 0, 0, BINDSTATUS_REDIRECTING, szStatusText); break; case BINDSTATUS_BEGINDOWNLOADDATA: - fill_stgmed_buffer(This->stgmed_buf); break; case BINDSTATUS_SENDINGREQUEST: on_progress(This, 0, 0, BINDSTATUS_SENDINGREQUEST, szStatusText); @@ -1086,13 +1017,16 @@ static void report_data(Binding *This, DWORD bscf, ULONG progress, ULONG progres TRACE("(%p)->(%d %u %u)\n", This, bscf, progress, progress_max); - if(This->download_state == END_DOWNLOAD || (This->state & (BINDING_STOPPED|BINDING_ABORTED))) + if(This->download_state == END_DOWNLOAD || (This->state & BINDING_ABORTED)) { + read_protocol_data(This->stgmed_buf); + return; + } + + if(This->state & BINDING_STOPPED) return; if(This->stgmed_buf->file != INVALID_HANDLE_VALUE) read_protocol_data(This->stgmed_buf); - else if(This->download_state == BEFORE_DOWNLOAD) - fill_stgmed_buffer(This->stgmed_buf); if(This->download_state == BEFORE_DOWNLOAD) { This->download_state = DOWNLOADING; @@ -1119,16 +1053,17 @@ static void report_data(Binding *This, DWORD bscf, ULONG progress, ULONG progres if(This->to_object) { if(!(This->state & BINDING_OBJAVAIL)) { - IBinding_AddRef(BINDING(This)); + IBinding_AddRef(&This->IBinding_iface); create_object(This); - IBinding_Release(BINDING(This)); + IBinding_Release(&This->IBinding_iface); } }else { STGMEDIUM stgmed; HRESULT hres; if(!(This->state & BINDING_LOCKED)) { - HRESULT hres = IInternetProtocol_LockRequest(This->protocol, 0); + HRESULT hres = IInternetProtocolEx_LockRequest( + &This->protocol->IInternetProtocolEx_iface, 0); if(SUCCEEDED(hres)) This->state |= BINDING_LOCKED; } @@ -1153,7 +1088,7 @@ static void report_data(Binding *This, DWORD bscf, ULONG progress, ULONG progres static HRESULT WINAPI InternetProtocolSink_ReportData(IInternetProtocolSink *iface, DWORD grfBSCF, ULONG ulProgress, ULONG ulProgressMax) { - Binding *This = PROTSINK_THIS(iface); + Binding *This = impl_from_IInternetProtocolSink(iface); TRACE("(%p)->(%d %u %u)\n", This, grfBSCF, ulProgress, ulProgressMax); @@ -1164,17 +1099,15 @@ static HRESULT WINAPI InternetProtocolSink_ReportData(IInternetProtocolSink *ifa static HRESULT WINAPI InternetProtocolSink_ReportResult(IInternetProtocolSink *iface, HRESULT hrResult, DWORD dwError, LPCWSTR szResult) { - Binding *This = PROTSINK_THIS(iface); + Binding *This = impl_from_IInternetProtocolSink(iface); TRACE("(%p)->(%08x %d %s)\n", This, hrResult, dwError, debugstr_w(szResult)); stop_binding(This, hrResult, szResult); - IInternetProtocol_Terminate(This->protocol, 0); + IInternetProtocolEx_Terminate(&This->protocol->IInternetProtocolEx_iface, 0); return S_OK; } -#undef PROTSINK_THIS - static const IInternetProtocolSinkVtbl InternetProtocolSinkVtbl = { InternetProtocolSink_QueryInterface, InternetProtocolSink_AddRef, @@ -1185,31 +1118,34 @@ static const IInternetProtocolSinkVtbl InternetProtocolSinkVtbl = { InternetProtocolSink_ReportResult }; -#define BINDINF_THIS(iface) DEFINE_THIS(Binding, InternetBindInfo, iface) +static inline Binding *impl_from_IInternetBindInfo(IInternetBindInfo *iface) +{ + return CONTAINING_RECORD(iface, Binding, IInternetBindInfo_iface); +} static HRESULT WINAPI InternetBindInfo_QueryInterface(IInternetBindInfo *iface, REFIID riid, void **ppv) { - Binding *This = BINDINF_THIS(iface); - return IBinding_QueryInterface(BINDING(This), riid, ppv); + Binding *This = impl_from_IInternetBindInfo(iface); + return IBinding_QueryInterface(&This->IBinding_iface, riid, ppv); } static ULONG WINAPI InternetBindInfo_AddRef(IInternetBindInfo *iface) { - Binding *This = BINDINF_THIS(iface); - return IBinding_AddRef(BINDING(This)); + Binding *This = impl_from_IInternetBindInfo(iface); + return IBinding_AddRef(&This->IBinding_iface); } static ULONG WINAPI InternetBindInfo_Release(IInternetBindInfo *iface) { - Binding *This = BINDINF_THIS(iface); - return IBinding_Release(BINDING(This)); + Binding *This = impl_from_IInternetBindInfo(iface); + return IBinding_Release(&This->IBinding_iface); } static HRESULT WINAPI InternetBindInfo_GetBindInfo(IInternetBindInfo *iface, DWORD *grfBINDF, BINDINFO *pbindinfo) { - Binding *This = BINDINF_THIS(iface); + Binding *This = impl_from_IInternetBindInfo(iface); TRACE("(%p)->(%p %p)\n", This, grfBINDF, pbindinfo); @@ -1232,7 +1168,7 @@ static HRESULT WINAPI InternetBindInfo_GetBindInfo(IInternetBindInfo *iface, static HRESULT WINAPI InternetBindInfo_GetBindString(IInternetBindInfo *iface, ULONG ulStringType, LPOLESTR *ppwzStr, ULONG cEl, ULONG *pcElFetched) { - Binding *This = BINDINF_THIS(iface); + Binding *This = impl_from_IInternetBindInfo(iface); TRACE("(%p)->(%d %p %d %p)\n", This, ulStringType, ppwzStr, cEl, pcElFetched); @@ -1280,8 +1216,6 @@ static HRESULT WINAPI InternetBindInfo_GetBindString(IInternetBindInfo *iface, return E_NOTIMPL; } -#undef BINDF_THIS - static const IInternetBindInfoVtbl InternetBindInfoVtbl = { InternetBindInfo_QueryInterface, InternetBindInfo_AddRef, @@ -1290,43 +1224,54 @@ static const IInternetBindInfoVtbl InternetBindInfoVtbl = { InternetBindInfo_GetBindString }; -#define INETINFO_THIS(iface) DEFINE_THIS(Binding, WinInetHttpInfo, iface) +static inline Binding *impl_from_IWinInetHttpInfo(IWinInetHttpInfo *iface) +{ + return CONTAINING_RECORD(iface, Binding, IWinInetHttpInfo_iface); +} static HRESULT WINAPI WinInetHttpInfo_QueryInterface(IWinInetHttpInfo *iface, REFIID riid, void **ppv) { - Binding *This = INETINFO_THIS(iface); - return IBinding_QueryInterface(BINDING(This), riid, ppv); + Binding *This = impl_from_IWinInetHttpInfo(iface); + return IBinding_QueryInterface(&This->IBinding_iface, riid, ppv); } static ULONG WINAPI WinInetHttpInfo_AddRef(IWinInetHttpInfo *iface) { - Binding *This = INETINFO_THIS(iface); - return IBinding_AddRef(BINDING(This)); + Binding *This = impl_from_IWinInetHttpInfo(iface); + return IBinding_AddRef(&This->IBinding_iface); } static ULONG WINAPI WinInetHttpInfo_Release(IWinInetHttpInfo *iface) { - Binding *This = INETINFO_THIS(iface); - return IBinding_Release(BINDING(This)); + Binding *This = impl_from_IWinInetHttpInfo(iface); + return IBinding_Release(&This->IBinding_iface); } static HRESULT WINAPI WinInetHttpInfo_QueryOption(IWinInetHttpInfo *iface, DWORD dwOption, void *pBuffer, DWORD *pcbBuffer) { - Binding *This = INETINFO_THIS(iface); - FIXME("(%p)->(%x %p %p)\n", This, dwOption, pBuffer, pcbBuffer); - return E_NOTIMPL; + Binding *This = impl_from_IWinInetHttpInfo(iface); + TRACE("(%p)->(%x %p %p)\n", This, dwOption, pBuffer, pcbBuffer); + + if(!This->protocol->wininet_info) + return E_FAIL; + + return IWinInetInfo_QueryOption(This->protocol->wininet_info, + dwOption, pBuffer, pcbBuffer); } static HRESULT WINAPI WinInetHttpInfo_QueryInfo(IWinInetHttpInfo *iface, DWORD dwOption, void *pBuffer, DWORD *pcbBuffer, DWORD *pdwFlags, DWORD *pdwReserved) { - Binding *This = INETINFO_THIS(iface); - FIXME("(%p)->(%x %p %p %p %p)\n", This, dwOption, pBuffer, pcbBuffer, pdwFlags, pdwReserved); - return E_NOTIMPL; -} + Binding *This = impl_from_IWinInetHttpInfo(iface); + TRACE("(%p)->(%x %p %p %p %p)\n", This, dwOption, pBuffer, pcbBuffer, pdwFlags, pdwReserved); -#undef INETINFO_THIS + if(!This->protocol->wininet_http_info) + return E_FAIL; + + return IWinInetHttpInfo_QueryInfo(This->protocol->wininet_http_info, + dwOption, pBuffer, pcbBuffer, pdwFlags, pdwReserved); +} static const IWinInetHttpInfoVtbl WinInetHttpInfoVtbl = { WinInetHttpInfo_QueryInterface, @@ -1336,31 +1281,34 @@ static const IWinInetHttpInfoVtbl WinInetHttpInfoVtbl = { WinInetHttpInfo_QueryInfo }; -#define SERVPROV_THIS(iface) DEFINE_THIS(Binding, ServiceProvider, iface) +static inline Binding *impl_from_IServiceProvider(IServiceProvider *iface) +{ + return CONTAINING_RECORD(iface, Binding, IServiceProvider_iface); +} static HRESULT WINAPI ServiceProvider_QueryInterface(IServiceProvider *iface, REFIID riid, void **ppv) { - Binding *This = SERVPROV_THIS(iface); - return IBinding_QueryInterface(BINDING(This), riid, ppv); + Binding *This = impl_from_IServiceProvider(iface); + return IBinding_QueryInterface(&This->IBinding_iface, riid, ppv); } static ULONG WINAPI ServiceProvider_AddRef(IServiceProvider *iface) { - Binding *This = SERVPROV_THIS(iface); - return IBinding_AddRef(BINDING(This)); + Binding *This = impl_from_IServiceProvider(iface); + return IBinding_AddRef(&This->IBinding_iface); } static ULONG WINAPI ServiceProvider_Release(IServiceProvider *iface) { - Binding *This = SERVPROV_THIS(iface); - return IBinding_Release(BINDING(This)); + Binding *This = impl_from_IServiceProvider(iface); + return IBinding_Release(&This->IBinding_iface); } static HRESULT WINAPI ServiceProvider_QueryService(IServiceProvider *iface, REFGUID guidService, REFIID riid, void **ppv) { - Binding *This = SERVPROV_THIS(iface); + Binding *This = impl_from_IServiceProvider(iface); HRESULT hres; TRACE("(%p)->(%s %s %p)\n", This, debugstr_guid(guidService), debugstr_guid(riid), ppv); @@ -1373,11 +1321,9 @@ static HRESULT WINAPI ServiceProvider_QueryService(IServiceProvider *iface, } WARN("unknown service %s\n", debugstr_guid(guidService)); - return E_NOTIMPL; + return E_NOINTERFACE; } -#undef SERVPROV_THIS - static const IServiceProviderVtbl ServiceProviderVtbl = { ServiceProvider_QueryInterface, ServiceProvider_AddRef, @@ -1431,11 +1377,11 @@ static HRESULT Binding_Create(IMoniker *mon, Binding *binding_ctx, IUri *uri, IB ret = heap_alloc_zero(sizeof(Binding)); - ret->lpBindingVtbl = &BindingVtbl; - ret->lpIInternetProtocolSinkVtbl = &InternetProtocolSinkVtbl; - ret->lpInternetBindInfoVtbl = &InternetBindInfoVtbl; - ret->lpWinInetHttpInfoVtbl = &WinInetHttpInfoVtbl; - ret->lpServiceProviderVtbl = &ServiceProviderVtbl; + ret->IBinding_iface.lpVtbl = &BindingVtbl; + ret->IInternetProtocolSink_iface.lpVtbl = &InternetProtocolSinkVtbl; + ret->IInternetBindInfo_iface.lpVtbl = &InternetBindInfoVtbl; + ret->IWinInetHttpInfo_iface.lpVtbl = &WinInetHttpInfoVtbl; + ret->IServiceProvider_iface.lpVtbl = &ServiceProviderVtbl; ret->ref = 1; @@ -1463,7 +1409,7 @@ static HRESULT Binding_Create(IMoniker *mon, Binding *binding_ctx, IUri *uri, IB hres = get_callback(pbc, &ret->callback); if(FAILED(hres)) { WARN("Could not get IBindStatusCallback\n"); - IBinding_Release(BINDING(ret)); + IBinding_Release(&ret->IBinding_iface); return hres; } @@ -1472,12 +1418,12 @@ static HRESULT Binding_Create(IMoniker *mon, Binding *binding_ctx, IUri *uri, IB if(binding_ctx) { ret->protocol = binding_ctx->protocol; - IInternetProtocol_AddRef(ret->protocol); + IInternetProtocolEx_AddRef(&ret->protocol->IInternetProtocolEx_iface); }else { hres = create_binding_protocol(TRUE, &ret->protocol); if(FAILED(hres)) { WARN("Could not get protocol handler\n"); - IBinding_Release(BINDING(ret)); + IBinding_Release(&ret->IBinding_iface); return hres; } } @@ -1485,7 +1431,7 @@ static HRESULT Binding_Create(IMoniker *mon, Binding *binding_ctx, IUri *uri, IB hres = IBindStatusCallback_GetBindInfo(ret->callback, &ret->bindf, &ret->bindinfo); if(FAILED(hres)) { WARN("GetBindInfo failed: %08x\n", hres); - IBinding_Release(BINDING(ret)); + IBinding_Release(&ret->IBinding_iface); return hres; } @@ -1496,7 +1442,7 @@ static HRESULT Binding_Create(IMoniker *mon, Binding *binding_ctx, IUri *uri, IB if(to_obj) ret->bindinfo.dwOptions |= 0x100000; - if(!(ret->bindf & BINDF_ASYNCHRONOUS)) { + if(!(ret->bindf & BINDF_ASYNCHRONOUS) || !(ret->bindf & BINDF_PULLDATA)) { ret->bindf |= BINDF_NEEDFILE; ret->use_cache_file = TRUE; }else if(!is_urlmon_protocol(uri)) { @@ -1505,16 +1451,16 @@ static HRESULT Binding_Create(IMoniker *mon, Binding *binding_ctx, IUri *uri, IB hres = IUri_GetDisplayUri(uri, &ret->url); if(FAILED(hres)) { - IBinding_Release(BINDING(ret)); + IBinding_Release(&ret->IBinding_iface); return hres; } if(binding_ctx) { ret->stgmed_buf = binding_ctx->stgmed_buf; - IUnknown_AddRef(STGMEDUNK(ret->stgmed_buf)); + IUnknown_AddRef(&ret->stgmed_buf->IUnknown_iface); ret->clipboard_format = binding_ctx->clipboard_format; }else { - ret->stgmed_buf = create_stgmed_buf(ret->protocol); + ret->stgmed_buf = create_stgmed_buf(&ret->protocol->IInternetProtocolEx_iface); } if(to_obj) { @@ -1526,7 +1472,7 @@ static HRESULT Binding_Create(IMoniker *mon, Binding *binding_ctx, IUri *uri, IB ret->stgmed_obj = create_stgmed_file(ret->stgmed_buf); }else { FIXME("Unsupported riid %s\n", debugstr_guid(riid)); - IBinding_Release(BINDING(ret)); + IBinding_Release(&ret->IBinding_iface); return E_NOTIMPL; } @@ -1545,29 +1491,34 @@ static HRESULT start_binding(IMoniker *mon, Binding *binding_ctx, IUri *uri, IBi if(FAILED(hres)) return hres; - hres = IBindStatusCallback_OnStartBinding(binding->callback, 0, BINDING(binding)); + hres = IBindStatusCallback_OnStartBinding(binding->callback, 0, &binding->IBinding_iface); if(FAILED(hres)) { WARN("OnStartBinding failed: %08x\n", hres); - stop_binding(binding, INET_E_DOWNLOAD_FAILURE, NULL); - IBinding_Release(BINDING(binding)); + if(hres != E_ABORT && hres != E_NOTIMPL) + hres = INET_E_DOWNLOAD_FAILURE; + + stop_binding(binding, hres, NULL); + IBinding_Release(&binding->IBinding_iface); return hres; } if(binding_ctx) { - set_binding_sink(binding->protocol, PROTSINK(binding), BINDINF(binding)); + set_binding_sink(binding->protocol, &binding->IInternetProtocolSink_iface, + &binding->IInternetBindInfo_iface); if(binding_ctx->redirect_url) IBindStatusCallback_OnProgress(binding->callback, 0, 0, BINDSTATUS_REDIRECTING, binding_ctx->redirect_url); report_data(binding, BSCF_FIRSTDATANOTIFICATION | (binding_ctx->download_state == END_DOWNLOAD ? BSCF_LASTDATANOTIFICATION : 0), 0, 0); }else { - hres = IInternetProtocolEx_StartEx(binding->protocol, uri, PROTSINK(binding), - BINDINF(binding), PI_APARTMENTTHREADED|PI_MIMEVERIFICATION, 0); + hres = IInternetProtocolEx_StartEx(&binding->protocol->IInternetProtocolEx_iface, uri, + &binding->IInternetProtocolSink_iface, &binding->IInternetBindInfo_iface, + PI_APARTMENTTHREADED|PI_MIMEVERIFICATION, 0); TRACE("start ret %08x\n", hres); if(FAILED(hres) && hres != E_PENDING) { stop_binding(binding, hres, NULL); - IBinding_Release(BINDING(binding)); + IBinding_Release(&binding->IBinding_iface); return hres; } @@ -1591,19 +1542,17 @@ HRESULT bind_to_storage(IUri *uri, IBindCtx *pbc, REFIID riid, void **ppv) Binding *binding = NULL, *binding_ctx; HRESULT hres; - *ppv = NULL; - binding_ctx = get_bctx_binding(pbc); hres = start_binding(NULL, binding_ctx, uri, pbc, FALSE, riid, &binding); if(binding_ctx) - IBinding_Release(BINDING(binding_ctx)); + IBinding_Release(&binding_ctx->IBinding_iface); if(FAILED(hres)) return hres; - if(binding->hres == S_OK && binding->stgmed_buf->init) { + if(binding->hres == S_OK && binding->download_state != BEFORE_DOWNLOAD /* FIXME */) { if((binding->state & BINDING_STOPPED) && (binding->state & BINDING_LOCKED)) - IInternetProtocol_UnlockRequest(binding->protocol); + IInternetProtocolEx_UnlockRequest(&binding->protocol->IInternetProtocolEx_iface); hres = binding->stgmed_obj->vtbl->get_result(binding->stgmed_obj, binding->bindf, ppv); }else if(binding->bindf & BINDF_ASYNCHRONOUS) { @@ -1612,7 +1561,7 @@ HRESULT bind_to_storage(IUri *uri, IBindCtx *pbc, REFIID riid, void **ppv) hres = FAILED(binding->hres) ? binding->hres : S_OK; } - IBinding_Release(BINDING(binding)); + IBinding_Release(&binding->IBinding_iface); return hres; } @@ -1638,7 +1587,7 @@ HRESULT bind_to_object(IMoniker *mon, IUri *uri, IBindCtx *pbc, REFIID riid, voi hres = S_OK; } - IBinding_Release(BINDING(binding)); + IBinding_Release(&binding->IBinding_iface); return hres; } diff --git a/dll/win32/urlmon/bindprot.c b/dll/win32/urlmon/bindprot.c index 0549712a048..45cf14c2cc6 100644 --- a/dll/win32/urlmon/bindprot.c +++ b/dll/win32/urlmon/bindprot.c @@ -21,67 +21,13 @@ WINE_DEFAULT_DEBUG_CHANNEL(urlmon); -typedef struct BindProtocol BindProtocol; +typedef void (*task_proc_t)(BindProtocol*,task_header_t*); -struct _task_header_t; - -typedef void (*task_proc_t)(BindProtocol*,struct _task_header_t*); - -typedef struct _task_header_t { +struct _task_header_t { task_proc_t proc; - struct _task_header_t *next; -} task_header_t; - -struct BindProtocol { - const IInternetProtocolExVtbl *lpIInternetProtocolExVtbl; - const IInternetBindInfoVtbl *lpInternetBindInfoVtbl; - const IInternetPriorityVtbl *lpInternetPriorityVtbl; - const IServiceProviderVtbl *lpServiceProviderVtbl; - const IInternetProtocolSinkVtbl *lpIInternetProtocolSinkVtbl; - const IWinInetHttpInfoVtbl *lpIWinInetHttpInfoVtbl; - - LONG ref; - - IInternetProtocol *protocol; - IInternetBindInfo *bind_info; - IInternetProtocolSink *protocol_sink; - IServiceProvider *service_provider; - IWinInetInfo *wininet_info; - - struct { - IInternetProtocol IInternetProtocol_iface; - } default_protocol_handler; - IInternetProtocol *protocol_handler; - - LONG priority; - - BOOL reported_result; - BOOL reported_mime; - BOOL from_urlmon; - DWORD pi; - - DWORD apartment_thread; - HWND notif_hwnd; - DWORD continue_call; - - CRITICAL_SECTION section; - task_header_t *task_queue_head, *task_queue_tail; - - BYTE *buf; - DWORD buf_size; - LPWSTR mime; - IUri *uri; - ProtocolProxy *filter_proxy; + task_header_t *next; }; -#define BINDINFO(x) ((IInternetBindInfo*) &(x)->lpInternetBindInfoVtbl) -#define PRIORITY(x) ((IInternetPriority*) &(x)->lpInternetPriorityVtbl) -#define HTTPINFO(x) ((IWinInetHttpInfo*) &(x)->lpIWinInetHttpInfoVtbl) -#define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl) -#define PROTOCOLEX(x) ((IInternetProtocolEx*) &(x)->lpIInternetProtocolExVtbl) - -#define PROTOCOLHANDLER(x) ((IInternetProtocol*) &(x)->lpIInternetProtocolHandlerVtbl) - #define BUFFER_SIZE 2048 #define MIME_TEST_SIZE 255 @@ -115,7 +61,7 @@ static LRESULT WINAPI notif_wnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM This->continue_call--; } - IInternetProtocolEx_Release(PROTOCOLEX(This)); + IInternetProtocolEx_Release(&This->IInternetProtocolEx_iface); return 0; } case WM_MK_RELEASE: { @@ -214,7 +160,7 @@ static void push_task(BindProtocol *This, task_header_t *task, task_proc_t proc) LeaveCriticalSection(&This->section); if(do_post) { - IInternetProtocolEx_AddRef(PROTOCOLEX(This)); + IInternetProtocolEx_AddRef(&This->IInternetProtocolEx_iface); PostMessageW(This->notif_hwnd, WM_MK_CONTINUE, 0, (LPARAM)This); } } @@ -248,9 +194,10 @@ static HRESULT handle_mime_filter(BindProtocol *This, IInternetProtocol *mime_fi IInternetProtocol_AddRef(mime_filter); This->protocol_handler = mime_filter; - filter_data.pProtocol = PROTOCOL(filter_proxy); - hres = IInternetProtocol_Start(mime_filter, mime, PROTSINK(filter_proxy), BINDINFO(This), - PI_FILTER_MODE|PI_FORCE_ASYNC, (HANDLE_PTR)&filter_data); + filter_data.pProtocol = &filter_proxy->IInternetProtocol_iface; + hres = IInternetProtocol_Start(mime_filter, mime, &filter_proxy->IInternetProtocolSink_iface, + &This->IInternetBindInfo_iface, PI_FILTER_MODE|PI_FORCE_ASYNC, + (HANDLE_PTR)&filter_data); if(FAILED(hres)) { IInternetProtocolSink_Release(old_sink); return hres; @@ -291,39 +238,42 @@ static void mime_available(BindProtocol *This, LPCWSTR mime, BOOL verified) } } -#define PROTOCOL_THIS(iface) DEFINE_THIS(BindProtocol, IInternetProtocolEx, iface) +static inline BindProtocol *impl_from_IInternetProtocolEx(IInternetProtocolEx *iface) +{ + return CONTAINING_RECORD(iface, BindProtocol, IInternetProtocolEx_iface); +} static HRESULT WINAPI BindProtocol_QueryInterface(IInternetProtocolEx *iface, REFIID riid, void **ppv) { - BindProtocol *This = PROTOCOL_THIS(iface); + BindProtocol *This = impl_from_IInternetProtocolEx(iface); *ppv = NULL; if(IsEqualGUID(&IID_IUnknown, riid)) { TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv); - *ppv = PROTOCOLEX(This); + *ppv = &This->IInternetProtocolEx_iface; }else if(IsEqualGUID(&IID_IInternetProtocolRoot, riid)) { TRACE("(%p)->(IID_IInternetProtocolRoot %p)\n", This, ppv); - *ppv = PROTOCOLEX(This); + *ppv = &This->IInternetProtocolEx_iface; }else if(IsEqualGUID(&IID_IInternetProtocol, riid)) { TRACE("(%p)->(IID_IInternetProtocol %p)\n", This, ppv); - *ppv = PROTOCOLEX(This); + *ppv = &This->IInternetProtocolEx_iface; }else if(IsEqualGUID(&IID_IInternetProtocolEx, riid)) { TRACE("(%p)->(IID_IInternetProtocolEx %p)\n", This, ppv); - *ppv = PROTOCOLEX(This); + *ppv = &This->IInternetProtocolEx_iface; }else if(IsEqualGUID(&IID_IInternetBindInfo, riid)) { TRACE("(%p)->(IID_IInternetBindInfo %p)\n", This, ppv); - *ppv = BINDINFO(This); + *ppv = &This->IInternetBindInfo_iface; }else if(IsEqualGUID(&IID_IInternetPriority, riid)) { TRACE("(%p)->(IID_IInternetPriority %p)\n", This, ppv); - *ppv = PRIORITY(This); + *ppv = &This->IInternetPriority_iface; }else if(IsEqualGUID(&IID_IAuthenticate, riid)) { FIXME("(%p)->(IID_IAuthenticate %p)\n", This, ppv); }else if(IsEqualGUID(&IID_IServiceProvider, riid)) { TRACE("(%p)->(IID_IServiceProvider %p)\n", This, ppv); - *ppv = SERVPROV(This); + *ppv = &This->IServiceProvider_iface; }else if(IsEqualGUID(&IID_IInternetProtocolSink, riid)) { TRACE("(%p)->(IID_IInternetProtocolSink %p)\n", This, ppv); - *ppv = PROTSINK(This); + *ppv = &This->IInternetProtocolSink_iface; }else if(IsEqualGUID(&IID_IWinInetInfo, riid)) { TRACE("(%p)->(IID_IWinInetInfo %p)\n", This, ppv); @@ -333,7 +283,7 @@ static HRESULT WINAPI BindProtocol_QueryInterface(IInternetProtocolEx *iface, RE hres = IInternetProtocol_QueryInterface(This->protocol, &IID_IWinInetInfo, (void**)&inet_info); if(SUCCEEDED(hres)) { - *ppv = HTTPINFO(This); + *ppv = &This->IWinInetHttpInfo_iface; IWinInetInfo_Release(inet_info); } } @@ -346,7 +296,7 @@ static HRESULT WINAPI BindProtocol_QueryInterface(IInternetProtocolEx *iface, RE hres = IInternetProtocol_QueryInterface(This->protocol, &IID_IWinInetHttpInfo, (void**)&http_info); if(SUCCEEDED(hres)) { - *ppv = HTTPINFO(This); + *ppv = &This->IWinInetHttpInfo_iface; IWinInetHttpInfo_Release(http_info); } } @@ -363,7 +313,7 @@ static HRESULT WINAPI BindProtocol_QueryInterface(IInternetProtocolEx *iface, RE static ULONG WINAPI BindProtocol_AddRef(IInternetProtocolEx *iface) { - BindProtocol *This = PROTOCOL_THIS(iface); + BindProtocol *This = impl_from_IInternetProtocolEx(iface); LONG ref = InterlockedIncrement(&This->ref); TRACE("(%p) ref=%d\n", This, ref); return ref; @@ -371,7 +321,7 @@ static ULONG WINAPI BindProtocol_AddRef(IInternetProtocolEx *iface) static ULONG WINAPI BindProtocol_Release(IInternetProtocolEx *iface) { - BindProtocol *This = PROTOCOL_THIS(iface); + BindProtocol *This = impl_from_IInternetProtocolEx(iface); LONG ref = InterlockedDecrement(&This->ref); TRACE("(%p) ref=%d\n", This, ref); @@ -379,6 +329,8 @@ static ULONG WINAPI BindProtocol_Release(IInternetProtocolEx *iface) if(!ref) { if(This->wininet_info) IWinInetInfo_Release(This->wininet_info); + if(This->wininet_http_info) + IWinInetHttpInfo_Release(This->wininet_http_info); if(This->protocol) IInternetProtocol_Release(This->protocol); if(This->bind_info) @@ -386,11 +338,11 @@ static ULONG WINAPI BindProtocol_Release(IInternetProtocolEx *iface) if(This->protocol_handler && This->protocol_handler != &This->default_protocol_handler.IInternetProtocol_iface) IInternetProtocol_Release(This->protocol_handler); if(This->filter_proxy) - IInternetProtocol_Release(PROTOCOL(This->filter_proxy)); + IInternetProtocol_Release(&This->filter_proxy->IInternetProtocol_iface); if(This->uri) IUri_Release(This->uri); - set_binding_sink(PROTOCOLEX(This), NULL, NULL); + set_binding_sink(This, NULL, NULL); if(This->notif_hwnd) release_notif_hwnd(This->notif_hwnd); @@ -409,7 +361,7 @@ static HRESULT WINAPI BindProtocol_Start(IInternetProtocolEx *iface, LPCWSTR szU IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE_PTR dwReserved) { - BindProtocol *This = PROTOCOL_THIS(iface); + BindProtocol *This = impl_from_IInternetProtocolEx(iface); IUri *uri; HRESULT hres; @@ -420,8 +372,8 @@ static HRESULT WINAPI BindProtocol_Start(IInternetProtocolEx *iface, LPCWSTR szU if(FAILED(hres)) return hres; - hres = IInternetProtocolEx_StartEx(PROTOCOLEX(This), uri, pOIProtSink, pOIBindInfo, - grfPI, (HANDLE*)dwReserved); + hres = IInternetProtocolEx_StartEx(&This->IInternetProtocolEx_iface, uri, pOIProtSink, + pOIBindInfo, grfPI, (HANDLE*)dwReserved); IUri_Release(uri); return hres; @@ -429,7 +381,7 @@ static HRESULT WINAPI BindProtocol_Start(IInternetProtocolEx *iface, LPCWSTR szU static HRESULT WINAPI BindProtocol_Continue(IInternetProtocolEx *iface, PROTOCOLDATA *pProtocolData) { - BindProtocol *This = PROTOCOL_THIS(iface); + BindProtocol *This = impl_from_IInternetProtocolEx(iface); TRACE("(%p)->(%p)\n", This, pProtocolData); @@ -439,7 +391,7 @@ static HRESULT WINAPI BindProtocol_Continue(IInternetProtocolEx *iface, PROTOCOL static HRESULT WINAPI BindProtocol_Abort(IInternetProtocolEx *iface, HRESULT hrReason, DWORD dwOptions) { - BindProtocol *This = PROTOCOL_THIS(iface); + BindProtocol *This = impl_from_IInternetProtocolEx(iface); TRACE("(%p)->(%08x %08x)\n", This, hrReason, dwOptions); @@ -448,7 +400,7 @@ static HRESULT WINAPI BindProtocol_Abort(IInternetProtocolEx *iface, HRESULT hrR static HRESULT WINAPI BindProtocol_Terminate(IInternetProtocolEx *iface, DWORD dwOptions) { - BindProtocol *This = PROTOCOL_THIS(iface); + BindProtocol *This = impl_from_IInternetProtocolEx(iface); TRACE("(%p)->(%08x)\n", This, dwOptions); @@ -457,14 +409,14 @@ static HRESULT WINAPI BindProtocol_Terminate(IInternetProtocolEx *iface, DWORD d static HRESULT WINAPI BindProtocol_Suspend(IInternetProtocolEx *iface) { - BindProtocol *This = PROTOCOL_THIS(iface); + BindProtocol *This = impl_from_IInternetProtocolEx(iface); FIXME("(%p)\n", This); return E_NOTIMPL; } static HRESULT WINAPI BindProtocol_Resume(IInternetProtocolEx *iface) { - BindProtocol *This = PROTOCOL_THIS(iface); + BindProtocol *This = impl_from_IInternetProtocolEx(iface); FIXME("(%p)\n", This); return E_NOTIMPL; } @@ -472,7 +424,7 @@ static HRESULT WINAPI BindProtocol_Resume(IInternetProtocolEx *iface) static HRESULT WINAPI BindProtocol_Read(IInternetProtocolEx *iface, void *pv, ULONG cb, ULONG *pcbRead) { - BindProtocol *This = PROTOCOL_THIS(iface); + BindProtocol *This = impl_from_IInternetProtocolEx(iface); TRACE("(%p)->(%p %u %p)\n", This, pv, cb, pcbRead); @@ -484,14 +436,14 @@ static HRESULT WINAPI BindProtocol_Read(IInternetProtocolEx *iface, void *pv, static HRESULT WINAPI BindProtocol_Seek(IInternetProtocolEx *iface, LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition) { - BindProtocol *This = PROTOCOL_THIS(iface); + BindProtocol *This = impl_from_IInternetProtocolEx(iface); FIXME("(%p)->(%d %d %p)\n", This, dlibMove.u.LowPart, dwOrigin, plibNewPosition); return E_NOTIMPL; } static HRESULT WINAPI BindProtocol_LockRequest(IInternetProtocolEx *iface, DWORD dwOptions) { - BindProtocol *This = PROTOCOL_THIS(iface); + BindProtocol *This = impl_from_IInternetProtocolEx(iface); TRACE("(%p)->(%08x)\n", This, dwOptions); @@ -500,7 +452,7 @@ static HRESULT WINAPI BindProtocol_LockRequest(IInternetProtocolEx *iface, DWORD static HRESULT WINAPI BindProtocol_UnlockRequest(IInternetProtocolEx *iface) { - BindProtocol *This = PROTOCOL_THIS(iface); + BindProtocol *This = impl_from_IInternetProtocolEx(iface); TRACE("(%p)\n", This); @@ -511,7 +463,7 @@ static HRESULT WINAPI BindProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUr IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE *dwReserved) { - BindProtocol *This = PROTOCOL_THIS(iface); + BindProtocol *This = impl_from_IInternetProtocolEx(iface); IInternetProtocol *protocol = NULL; IInternetProtocolEx *protocolex; IInternetPriority *priority; @@ -554,7 +506,7 @@ static HRESULT WINAPI BindProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUr if(FAILED(hres)) return hres; }else { - hres = IClassFactory_CreateInstance(cf, (IUnknown*)BINDINFO(This), + hres = IClassFactory_CreateInstance(cf, (IUnknown*)&This->IInternetBindInfo_iface, &IID_IUnknown, (void**)&unk); IClassFactory_Release(cf); if(FAILED(hres)) @@ -573,10 +525,12 @@ static HRESULT WINAPI BindProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUr This->protocol = protocol; - if(urlmon_protocol) + if(urlmon_protocol) { IInternetProtocol_QueryInterface(protocol, &IID_IWinInetInfo, (void**)&This->wininet_info); + IInternetProtocol_QueryInterface(protocol, &IID_IWinInetHttpInfo, (void**)&This->wininet_http_info); + } - set_binding_sink(PROTOCOLEX(This), pOIProtSink, pOIBindInfo); + set_binding_sink(This, pOIProtSink, pOIBindInfo); hres = IInternetProtocol_QueryInterface(protocol, &IID_IInternetPriority, (void**)&priority); if(SUCCEEDED(hres)) { @@ -586,7 +540,8 @@ static HRESULT WINAPI BindProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUr hres = IInternetProtocol_QueryInterface(protocol, &IID_IInternetProtocolEx, (void**)&protocolex); if(SUCCEEDED(hres)) { - hres = IInternetProtocolEx_StartEx(protocolex, pUri, PROTSINK(This), BINDINFO(This), 0, NULL); + hres = IInternetProtocolEx_StartEx(protocolex, pUri, &This->IInternetProtocolSink_iface, + &This->IInternetBindInfo_iface, 0, NULL); IInternetProtocolEx_Release(protocolex); }else { BSTR display_uri; @@ -595,16 +550,16 @@ static HRESULT WINAPI BindProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUr if(FAILED(hres)) return hres; - hres = IInternetProtocol_Start(protocol, display_uri, PROTSINK(This), BINDINFO(This), 0, 0); + hres = IInternetProtocol_Start(protocol, display_uri, &This->IInternetProtocolSink_iface, + &This->IInternetBindInfo_iface, 0, 0); SysFreeString(display_uri); } return hres; } -void set_binding_sink(IInternetProtocolEx *bind_protocol, IInternetProtocolSink *sink, IInternetBindInfo *bind_info) +void set_binding_sink(BindProtocol *This, IInternetProtocolSink *sink, IInternetBindInfo *bind_info) { - BindProtocol *This = PROTOCOL_THIS(bind_protocol); IInternetProtocolSink *prev_sink; IServiceProvider *service_provider = NULL; @@ -627,15 +582,6 @@ void set_binding_sink(IInternetProtocolEx *bind_protocol, IInternetProtocolSink IInternetBindInfo_Release(bind_info); } -IWinInetInfo *get_wininet_info(IInternetProtocolEx *bind_protocol) -{ - BindProtocol *This = PROTOCOL_THIS(bind_protocol); - - return This->wininet_info; -} - -#undef PROTOCOL_THIS - static const IInternetProtocolExVtbl BindProtocolVtbl = { BindProtocol_QueryInterface, BindProtocol_AddRef, @@ -667,13 +613,13 @@ static HRESULT WINAPI ProtocolHandler_QueryInterface(IInternetProtocol *iface, R static ULONG WINAPI ProtocolHandler_AddRef(IInternetProtocol *iface) { BindProtocol *This = impl_from_IInternetProtocol(iface); - return IInternetProtocolEx_AddRef(PROTOCOLEX(This)); + return IInternetProtocolEx_AddRef(&This->IInternetProtocolEx_iface); } static ULONG WINAPI ProtocolHandler_Release(IInternetProtocol *iface) { BindProtocol *This = impl_from_IInternetProtocol(iface); - return IInternetProtocolEx_Release(PROTOCOLEX(This)); + return IInternetProtocolEx_Release(&This->IInternetProtocolEx_iface); } static HRESULT WINAPI ProtocolHandler_Start(IInternetProtocol *iface, LPCWSTR szUrl, @@ -722,11 +668,11 @@ static HRESULT WINAPI ProtocolHandler_Terminate(IInternetProtocol *iface, DWORD IInternetProtocol_Terminate(This->protocol, 0); if(This->filter_proxy) { - IInternetProtocol_Release(PROTOCOL(This->filter_proxy)); + IInternetProtocol_Release(&This->filter_proxy->IInternetProtocol_iface); This->filter_proxy = NULL; } - set_binding_sink(PROTOCOLEX(This), NULL, NULL); + set_binding_sink(This, NULL, NULL); if(This->bind_info) { IInternetBindInfo_Release(This->bind_info); @@ -826,31 +772,34 @@ static const IInternetProtocolVtbl InternetProtocolHandlerVtbl = { ProtocolHandler_UnlockRequest }; -#define BINDINFO_THIS(iface) DEFINE_THIS(BindProtocol, InternetBindInfo, iface) +static inline BindProtocol *impl_from_IInternetBindInfo(IInternetBindInfo *iface) +{ + return CONTAINING_RECORD(iface, BindProtocol, IInternetBindInfo_iface); +} static HRESULT WINAPI BindInfo_QueryInterface(IInternetBindInfo *iface, REFIID riid, void **ppv) { - BindProtocol *This = BINDINFO_THIS(iface); - return IInternetProtocolEx_QueryInterface(PROTOCOLEX(This), riid, ppv); + BindProtocol *This = impl_from_IInternetBindInfo(iface); + return IInternetProtocolEx_QueryInterface(&This->IInternetProtocolEx_iface, riid, ppv); } static ULONG WINAPI BindInfo_AddRef(IInternetBindInfo *iface) { - BindProtocol *This = BINDINFO_THIS(iface); - return IInternetProtocolEx_AddRef(PROTOCOLEX(This)); + BindProtocol *This = impl_from_IInternetBindInfo(iface); + return IInternetProtocolEx_AddRef(&This->IInternetProtocolEx_iface); } static ULONG WINAPI BindInfo_Release(IInternetBindInfo *iface) { - BindProtocol *This = BINDINFO_THIS(iface); - return IInternetProtocolEx_Release(PROTOCOLEX(This)); + BindProtocol *This = impl_from_IInternetBindInfo(iface); + return IInternetProtocolEx_Release(&This->IInternetProtocolEx_iface); } static HRESULT WINAPI BindInfo_GetBindInfo(IInternetBindInfo *iface, DWORD *grfBINDF, BINDINFO *pbindinfo) { - BindProtocol *This = BINDINFO_THIS(iface); + BindProtocol *This = impl_from_IInternetBindInfo(iface); HRESULT hres; TRACE("(%p)->(%p %p)\n", This, grfBINDF, pbindinfo); @@ -868,15 +817,13 @@ static HRESULT WINAPI BindInfo_GetBindInfo(IInternetBindInfo *iface, static HRESULT WINAPI BindInfo_GetBindString(IInternetBindInfo *iface, ULONG ulStringType, LPOLESTR *ppwzStr, ULONG cEl, ULONG *pcElFetched) { - BindProtocol *This = BINDINFO_THIS(iface); + BindProtocol *This = impl_from_IInternetBindInfo(iface); TRACE("(%p)->(%d %p %d %p)\n", This, ulStringType, ppwzStr, cEl, pcElFetched); return IInternetBindInfo_GetBindString(This->bind_info, ulStringType, ppwzStr, cEl, pcElFetched); } -#undef BINDFO_THIS - static const IInternetBindInfoVtbl InternetBindInfoVtbl = { BindInfo_QueryInterface, BindInfo_AddRef, @@ -885,30 +832,33 @@ static const IInternetBindInfoVtbl InternetBindInfoVtbl = { BindInfo_GetBindString }; -#define PRIORITY_THIS(iface) DEFINE_THIS(BindProtocol, InternetPriority, iface) +static inline BindProtocol *impl_from_IInternetPriority(IInternetPriority *iface) +{ + return CONTAINING_RECORD(iface, BindProtocol, IInternetPriority_iface); +} static HRESULT WINAPI InternetPriority_QueryInterface(IInternetPriority *iface, REFIID riid, void **ppv) { - BindProtocol *This = PRIORITY_THIS(iface); - return IInternetProtocolEx_QueryInterface(PROTOCOLEX(This), riid, ppv); + BindProtocol *This = impl_from_IInternetPriority(iface); + return IInternetProtocolEx_QueryInterface(&This->IInternetProtocolEx_iface, riid, ppv); } static ULONG WINAPI InternetPriority_AddRef(IInternetPriority *iface) { - BindProtocol *This = PRIORITY_THIS(iface); - return IInternetProtocolEx_AddRef(PROTOCOLEX(This)); + BindProtocol *This = impl_from_IInternetPriority(iface); + return IInternetProtocolEx_AddRef(&This->IInternetProtocolEx_iface); } static ULONG WINAPI InternetPriority_Release(IInternetPriority *iface) { - BindProtocol *This = PRIORITY_THIS(iface); - return IInternetProtocolEx_Release(PROTOCOLEX(This)); + BindProtocol *This = impl_from_IInternetPriority(iface); + return IInternetProtocolEx_Release(&This->IInternetProtocolEx_iface); } static HRESULT WINAPI InternetPriority_SetPriority(IInternetPriority *iface, LONG nPriority) { - BindProtocol *This = PRIORITY_THIS(iface); + BindProtocol *This = impl_from_IInternetPriority(iface); TRACE("(%p)->(%d)\n", This, nPriority); @@ -918,7 +868,7 @@ static HRESULT WINAPI InternetPriority_SetPriority(IInternetPriority *iface, LON static HRESULT WINAPI InternetPriority_GetPriority(IInternetPriority *iface, LONG *pnPriority) { - BindProtocol *This = PRIORITY_THIS(iface); + BindProtocol *This = impl_from_IInternetPriority(iface); TRACE("(%p)->(%p)\n", This, pnPriority); @@ -926,8 +876,6 @@ static HRESULT WINAPI InternetPriority_GetPriority(IInternetPriority *iface, LON return S_OK; } -#undef PRIORITY_THIS - static const IInternetPriorityVtbl InternetPriorityVtbl = { InternetPriority_QueryInterface, InternetPriority_AddRef, @@ -937,25 +885,28 @@ static const IInternetPriorityVtbl InternetPriorityVtbl = { }; -#define PROTSINK_THIS(iface) DEFINE_THIS(BindProtocol, IInternetProtocolSink, iface) +static inline BindProtocol *impl_from_IInternetProtocolSink(IInternetProtocolSink *iface) +{ + return CONTAINING_RECORD(iface, BindProtocol, IInternetProtocolSink_iface); +} static HRESULT WINAPI BPInternetProtocolSink_QueryInterface(IInternetProtocolSink *iface, REFIID riid, void **ppv) { - BindProtocol *This = PROTSINK_THIS(iface); - return IInternetProtocolEx_QueryInterface(PROTOCOLEX(This), riid, ppv); + BindProtocol *This = impl_from_IInternetProtocolSink(iface); + return IInternetProtocolEx_QueryInterface(&This->IInternetProtocolEx_iface, riid, ppv); } static ULONG WINAPI BPInternetProtocolSink_AddRef(IInternetProtocolSink *iface) { - BindProtocol *This = PROTSINK_THIS(iface); - return IInternetProtocolEx_AddRef(PROTOCOLEX(This)); + BindProtocol *This = impl_from_IInternetProtocolSink(iface); + return IInternetProtocolEx_AddRef(&This->IInternetProtocolEx_iface); } static ULONG WINAPI BPInternetProtocolSink_Release(IInternetProtocolSink *iface) { - BindProtocol *This = PROTSINK_THIS(iface); - return IInternetProtocolEx_Release(PROTOCOLEX(This)); + BindProtocol *This = impl_from_IInternetProtocolSink(iface); + return IInternetProtocolEx_Release(&This->IInternetProtocolEx_iface); } typedef struct { @@ -975,7 +926,7 @@ static void switch_proc(BindProtocol *bind, task_header_t *t) static HRESULT WINAPI BPInternetProtocolSink_Switch(IInternetProtocolSink *iface, PROTOCOLDATA *pProtocolData) { - BindProtocol *This = PROTSINK_THIS(iface); + BindProtocol *This = impl_from_IInternetProtocolSink(iface); PROTOCOLDATA *data; TRACE("(%p)->(%p)\n", This, pProtocolData); @@ -1015,7 +966,6 @@ static void report_progress(BindProtocol *This, ULONG status_code, LPCWSTR statu case BINDSTATUS_FINDINGRESOURCE: case BINDSTATUS_CONNECTING: case BINDSTATUS_REDIRECTING: - case BINDSTATUS_BEGINDOWNLOADDATA: case BINDSTATUS_SENDINGREQUEST: case BINDSTATUS_CACHEFILENAMEAVAILABLE: case BINDSTATUS_DIRECTBIND: @@ -1024,6 +974,11 @@ static void report_progress(BindProtocol *This, ULONG status_code, LPCWSTR statu IInternetProtocolSink_ReportProgress(This->protocol_sink, status_code, status_text); break; + case BINDSTATUS_BEGINDOWNLOADDATA: + if(This->protocol_sink) + IInternetProtocolSink_ReportData(This->protocol_sink, This->bscf, This->progress, This->progress_max); + break; + case BINDSTATUS_MIMETYPEAVAILABLE: mime_available(This, status_text, FALSE); break; @@ -1057,7 +1012,7 @@ static void on_progress_proc(BindProtocol *This, task_header_t *t) static HRESULT WINAPI BPInternetProtocolSink_ReportProgress(IInternetProtocolSink *iface, ULONG ulStatusCode, LPCWSTR szStatusText) { - BindProtocol *This = PROTSINK_THIS(iface); + BindProtocol *This = impl_from_IInternetProtocolSink(iface); TRACE("(%p)->(%u %s)\n", This, ulStatusCode, debugstr_w(szStatusText)); @@ -1079,6 +1034,10 @@ static HRESULT WINAPI BPInternetProtocolSink_ReportProgress(IInternetProtocolSin static HRESULT report_data(BindProtocol *This, DWORD bscf, ULONG progress, ULONG progress_max) { + This->bscf = bscf; + This->progress = progress; + This->progress_max = progress_max; + if(!This->protocol_sink) return S_OK; @@ -1161,7 +1120,7 @@ static void report_data_proc(BindProtocol *This, task_header_t *t) static HRESULT WINAPI BPInternetProtocolSink_ReportData(IInternetProtocolSink *iface, DWORD grfBSCF, ULONG ulProgress, ULONG ulProgressMax) { - BindProtocol *This = PROTSINK_THIS(iface); + BindProtocol *This = impl_from_IInternetProtocolSink(iface); TRACE("(%p)->(%d %u %u)\n", This, grfBSCF, ulProgress, ulProgressMax); @@ -1208,7 +1167,7 @@ static void report_result_proc(BindProtocol *This, task_header_t *t) static HRESULT WINAPI BPInternetProtocolSink_ReportResult(IInternetProtocolSink *iface, HRESULT hrResult, DWORD dwError, LPCWSTR szResult) { - BindProtocol *This = PROTSINK_THIS(iface); + BindProtocol *This = impl_from_IInternetProtocolSink(iface); TRACE("(%p)->(%08x %d %s)\n", This, hrResult, dwError, debugstr_w(szResult)); @@ -1235,8 +1194,6 @@ static HRESULT WINAPI BPInternetProtocolSink_ReportResult(IInternetProtocolSink return IInternetProtocolSink_ReportResult(This->protocol_sink, hrResult, dwError, szResult); } -#undef PROTSINK_THIS - static const IInternetProtocolSinkVtbl InternetProtocolSinkVtbl = { BPInternetProtocolSink_QueryInterface, BPInternetProtocolSink_AddRef, @@ -1247,30 +1204,33 @@ static const IInternetProtocolSinkVtbl InternetProtocolSinkVtbl = { BPInternetProtocolSink_ReportResult }; -#define INETINFO_THIS(iface) DEFINE_THIS(BindProtocol, IWinInetHttpInfo, iface) +static inline BindProtocol *impl_from_IWinInetHttpInfo(IWinInetHttpInfo *iface) +{ + return CONTAINING_RECORD(iface, BindProtocol, IWinInetHttpInfo_iface); +} static HRESULT WINAPI WinInetHttpInfo_QueryInterface(IWinInetHttpInfo *iface, REFIID riid, void **ppv) { - BindProtocol *This = INETINFO_THIS(iface); - return IInternetProtocolEx_QueryInterface(PROTOCOLEX(This), riid, ppv); + BindProtocol *This = impl_from_IWinInetHttpInfo(iface); + return IInternetProtocolEx_QueryInterface(&This->IInternetProtocolEx_iface, riid, ppv); } static ULONG WINAPI WinInetHttpInfo_AddRef(IWinInetHttpInfo *iface) { - BindProtocol *This = INETINFO_THIS(iface); - return IInternetProtocolEx_AddRef(PROTOCOLEX(This)); + BindProtocol *This = impl_from_IWinInetHttpInfo(iface); + return IInternetProtocolEx_AddRef(&This->IInternetProtocolEx_iface); } static ULONG WINAPI WinInetHttpInfo_Release(IWinInetHttpInfo *iface) { - BindProtocol *This = INETINFO_THIS(iface); - return IInternetProtocolEx_Release(PROTOCOLEX(This)); + BindProtocol *This = impl_from_IWinInetHttpInfo(iface); + return IInternetProtocolEx_Release(&This->IInternetProtocolEx_iface); } static HRESULT WINAPI WinInetHttpInfo_QueryOption(IWinInetHttpInfo *iface, DWORD dwOption, void *pBuffer, DWORD *pcbBuffer) { - BindProtocol *This = INETINFO_THIS(iface); + BindProtocol *This = impl_from_IWinInetHttpInfo(iface); FIXME("(%p)->(%x %p %p)\n", This, dwOption, pBuffer, pcbBuffer); return E_NOTIMPL; } @@ -1278,13 +1238,11 @@ static HRESULT WINAPI WinInetHttpInfo_QueryOption(IWinInetHttpInfo *iface, DWORD static HRESULT WINAPI WinInetHttpInfo_QueryInfo(IWinInetHttpInfo *iface, DWORD dwOption, void *pBuffer, DWORD *pcbBuffer, DWORD *pdwFlags, DWORD *pdwReserved) { - BindProtocol *This = INETINFO_THIS(iface); + BindProtocol *This = impl_from_IWinInetHttpInfo(iface); FIXME("(%p)->(%x %p %p %p %p)\n", This, dwOption, pBuffer, pcbBuffer, pdwFlags, pdwReserved); return E_NOTIMPL; } -#undef INETINFO_THIS - static const IWinInetHttpInfoVtbl WinInetHttpInfoVtbl = { WinInetHttpInfo_QueryInterface, WinInetHttpInfo_AddRef, @@ -1293,31 +1251,34 @@ static const IWinInetHttpInfoVtbl WinInetHttpInfoVtbl = { WinInetHttpInfo_QueryInfo }; -#define SERVPROV_THIS(iface) DEFINE_THIS(BindProtocol, ServiceProvider, iface) +static inline BindProtocol *impl_from_IServiceProvider(IServiceProvider *iface) +{ + return CONTAINING_RECORD(iface, BindProtocol, IServiceProvider_iface); +} static HRESULT WINAPI BPServiceProvider_QueryInterface(IServiceProvider *iface, REFIID riid, void **ppv) { - BindProtocol *This = SERVPROV_THIS(iface); - return IInternetProtocolEx_QueryInterface(PROTOCOLEX(This), riid, ppv); + BindProtocol *This = impl_from_IServiceProvider(iface); + return IInternetProtocolEx_QueryInterface(&This->IInternetProtocolEx_iface, riid, ppv); } static ULONG WINAPI BPServiceProvider_AddRef(IServiceProvider *iface) { - BindProtocol *This = SERVPROV_THIS(iface); - return IInternetProtocolEx_AddRef(PROTOCOLEX(This)); + BindProtocol *This = impl_from_IServiceProvider(iface); + return IInternetProtocolEx_AddRef(&This->IInternetProtocolEx_iface); } static ULONG WINAPI BPServiceProvider_Release(IServiceProvider *iface) { - BindProtocol *This = SERVPROV_THIS(iface); - return IInternetProtocolEx_Release(PROTOCOLEX(This)); + BindProtocol *This = impl_from_IServiceProvider(iface); + return IInternetProtocolEx_Release(&This->IInternetProtocolEx_iface); } static HRESULT WINAPI BPServiceProvider_QueryService(IServiceProvider *iface, REFGUID guidService, REFIID riid, void **ppv) { - BindProtocol *This = SERVPROV_THIS(iface); + BindProtocol *This = impl_from_IServiceProvider(iface); TRACE("(%p)->(%s %s %p)\n", This, debugstr_guid(guidService), debugstr_guid(riid), ppv); @@ -1327,8 +1288,6 @@ static HRESULT WINAPI BPServiceProvider_QueryService(IServiceProvider *iface, return IServiceProvider_QueryService(This->service_provider, guidService, riid, ppv); } -#undef SERVPROV_THIS - static const IServiceProviderVtbl ServiceProviderVtbl = { BPServiceProvider_QueryInterface, BPServiceProvider_AddRef, @@ -1336,16 +1295,16 @@ static const IServiceProviderVtbl ServiceProviderVtbl = { BPServiceProvider_QueryService }; -HRESULT create_binding_protocol(BOOL from_urlmon, IInternetProtocolEx **protocol) +HRESULT create_binding_protocol(BOOL from_urlmon, BindProtocol **protocol) { BindProtocol *ret = heap_alloc_zero(sizeof(BindProtocol)); - ret->lpIInternetProtocolExVtbl = &BindProtocolVtbl; - ret->lpInternetBindInfoVtbl = &InternetBindInfoVtbl; - ret->lpInternetPriorityVtbl = &InternetPriorityVtbl; - ret->lpServiceProviderVtbl = &ServiceProviderVtbl; - ret->lpIInternetProtocolSinkVtbl = &InternetProtocolSinkVtbl; - ret->lpIWinInetHttpInfoVtbl = &WinInetHttpInfoVtbl; + ret->IInternetProtocolEx_iface.lpVtbl = &BindProtocolVtbl; + ret->IInternetBindInfo_iface.lpVtbl = &InternetBindInfoVtbl; + ret->IInternetPriority_iface.lpVtbl = &InternetPriorityVtbl; + ret->IServiceProvider_iface.lpVtbl = &ServiceProviderVtbl; + ret->IInternetProtocolSink_iface.lpVtbl = &InternetProtocolSinkVtbl; + ret->IWinInetHttpInfo_iface.lpVtbl = &WinInetHttpInfoVtbl; ret->default_protocol_handler.IInternetProtocol_iface.lpVtbl = &InternetProtocolHandlerVtbl; @@ -1358,6 +1317,6 @@ HRESULT create_binding_protocol(BOOL from_urlmon, IInternetProtocolEx **protocol URLMON_LockModule(); - *protocol = PROTOCOLEX(ret); + *protocol = ret; return S_OK; } diff --git a/dll/win32/urlmon/download.c b/dll/win32/urlmon/download.c index 9759e71d18e..c20c87c5a1a 100644 --- a/dll/win32/urlmon/download.c +++ b/dll/win32/urlmon/download.c @@ -28,6 +28,7 @@ typedef struct { LONG ref; IBindStatusCallback *callback; + IBinding *binding; LPWSTR file_name; LPWSTR cache_file; } DownloadBSC; @@ -89,6 +90,8 @@ static ULONG WINAPI DownloadBSC_Release(IBindStatusCallback *iface) if(!ref) { if(This->callback) IBindStatusCallback_Release(This->callback); + if(This->binding) + IBinding_Release(This->binding); heap_free(This->file_name); heap_free(This->cache_file); heap_free(This); @@ -101,13 +104,19 @@ static HRESULT WINAPI DownloadBSC_OnStartBinding(IBindStatusCallback *iface, DWORD dwReserved, IBinding *pbind) { DownloadBSC *This = impl_from_IBindStatusCallback(iface); + HRESULT hres = S_OK; TRACE("(%p)->(%d %p)\n", This, dwReserved, pbind); - if(This->callback) - IBindStatusCallback_OnStartBinding(This->callback, dwReserved, pbind); + if(This->callback) { + hres = IBindStatusCallback_OnStartBinding(This->callback, dwReserved, pbind); - return S_OK; + IBinding_AddRef(pbind); + This->binding = pbind; + } + + /* Windows seems to ignore E_NOTIMPL if it's returned from the client. */ + return hres == E_NOTIMPL ? S_OK : hres; } static HRESULT WINAPI DownloadBSC_GetPriority(IBindStatusCallback *iface, LONG *pnPriority) @@ -132,6 +141,13 @@ static HRESULT on_progress(DownloadBSC *This, ULONG progress, ULONG progress_max return S_OK; hres = IBindStatusCallback_OnProgress(This->callback, progress, progress_max, status_code, status_text); + if(hres == E_ABORT) { + if(This->binding) + IBinding_Abort(This->binding); + else + FIXME("No binding, not sure what to do!\n"); + } + return hres; } @@ -191,6 +207,11 @@ static HRESULT WINAPI DownloadBSC_OnStopBinding(IBindStatusCallback *iface, if(This->callback) IBindStatusCallback_OnStopBinding(This->callback, hresult, szError); + if(This->binding) { + IBinding_Release(This->binding); + This->binding = NULL; + } + return S_OK; } @@ -311,6 +332,7 @@ static HRESULT DownloadBSC_Create(IBindStatusCallback *callback, LPCWSTR file_na ret->ref = 1; ret->file_name = heap_strdupW(file_name); ret->cache_file = NULL; + ret->binding = NULL; if(callback) IBindStatusCallback_AddRef(callback); diff --git a/dll/win32/urlmon/ftp.c b/dll/win32/urlmon/ftp.c index deb611bc901..04cf49c5d82 100644 --- a/dll/win32/urlmon/ftp.c +++ b/dll/win32/urlmon/ftp.c @@ -50,12 +50,15 @@ static inline FtpProtocol *impl_from_IWinInetHttpInfo(IWinInetHttpInfo *iface) return CONTAINING_RECORD(iface, FtpProtocol, IWinInetHttpInfo_iface); } -#define ASYNCPROTOCOL_THIS(iface) DEFINE_THIS2(FtpProtocol, base, iface) +static inline FtpProtocol *impl_from_Protocol(Protocol *prot) +{ + return CONTAINING_RECORD(prot, FtpProtocol, base); +} static HRESULT FtpProtocol_open_request(Protocol *prot, IUri *uri, DWORD request_flags, HINTERNET internet_session, IInternetBindInfo *bind_info) { - FtpProtocol *This = ASYNCPROTOCOL_THIS(prot); + FtpProtocol *This = impl_from_Protocol(prot); BSTR url; HRESULT hres; @@ -82,7 +85,7 @@ static HRESULT FtpProtocol_end_request(Protocol *prot) static HRESULT FtpProtocol_start_downloading(Protocol *prot) { - FtpProtocol *This = ASYNCPROTOCOL_THIS(prot); + FtpProtocol *This = impl_from_Protocol(prot); DWORD size; BOOL res; @@ -99,13 +102,17 @@ static void FtpProtocol_close_connection(Protocol *prot) { } -#undef ASYNCPROTOCOL_THIS +static void FtpProtocol_on_error(Protocol *prot, DWORD error) +{ + FIXME("(%p) %d - stub\n", prot, error); +} static const ProtocolVtbl AsyncProtocolVtbl = { FtpProtocol_open_request, FtpProtocol_end_request, FtpProtocol_start_downloading, - FtpProtocol_close_connection + FtpProtocol_close_connection, + FtpProtocol_on_error }; static HRESULT WINAPI FtpProtocol_QueryInterface(IInternetProtocolEx *iface, REFIID riid, void **ppv) @@ -377,16 +384,28 @@ static HRESULT WINAPI HttpInfo_QueryOption(IWinInetHttpInfo *iface, DWORD dwOpti void *pBuffer, DWORD *pcbBuffer) { FtpProtocol *This = impl_from_IWinInetHttpInfo(iface); - FIXME("(%p)->(%x %p %p)\n", This, dwOption, pBuffer, pcbBuffer); - return E_NOTIMPL; + TRACE("(%p)->(%x %p %p)\n", This, dwOption, pBuffer, pcbBuffer); + + if(!This->base.request) + return E_FAIL; + + if(!InternetQueryOptionW(This->base.request, dwOption, pBuffer, pcbBuffer)) + return S_FALSE; + return S_OK; } static HRESULT WINAPI HttpInfo_QueryInfo(IWinInetHttpInfo *iface, DWORD dwOption, void *pBuffer, DWORD *pcbBuffer, DWORD *pdwFlags, DWORD *pdwReserved) { FtpProtocol *This = impl_from_IWinInetHttpInfo(iface); - FIXME("(%p)->(%x %p %p %p %p)\n", This, dwOption, pBuffer, pcbBuffer, pdwFlags, pdwReserved); - return E_NOTIMPL; + TRACE("(%p)->(%x %p %p %p %p)\n", This, dwOption, pBuffer, pcbBuffer, pdwFlags, pdwReserved); + + if(!This->base.request) + return E_FAIL; + + if(!HttpQueryInfoW(This->base.request, dwOption, pBuffer, pcbBuffer, pdwFlags)) + return S_FALSE; + return S_OK; } static const IWinInetHttpInfoVtbl WinInetHttpInfoVtbl = { diff --git a/dll/win32/urlmon/gopher.c b/dll/win32/urlmon/gopher.c index da241e9358e..4087ed5ace2 100644 --- a/dll/win32/urlmon/gopher.c +++ b/dll/win32/urlmon/gopher.c @@ -24,20 +24,21 @@ WINE_DEFAULT_DEBUG_CHANNEL(urlmon); typedef struct { Protocol base; - const IInternetProtocolVtbl *lpIInternetProtocolVtbl; - const IInternetPriorityVtbl *lpInternetPriorityVtbl; + IInternetProtocol IInternetProtocol_iface; + IInternetPriority IInternetPriority_iface; LONG ref; } GopherProtocol; -#define PRIORITY(x) ((IInternetPriority*) &(x)->lpInternetPriorityVtbl) - -#define ASYNCPROTOCOL_THIS(iface) DEFINE_THIS2(GopherProtocol, base, iface) +static inline GopherProtocol *impl_from_Protocol(Protocol *prot) +{ + return CONTAINING_RECORD(prot, GopherProtocol, base); +} static HRESULT GopherProtocol_open_request(Protocol *prot, IUri *uri, DWORD request_flags, HINTERNET internet_session, IInternetBindInfo *bind_info) { - GopherProtocol *This = ASYNCPROTOCOL_THIS(prot); + GopherProtocol *This = impl_from_Protocol(prot); BSTR url; HRESULT hres; @@ -70,34 +71,41 @@ static void GopherProtocol_close_connection(Protocol *prot) { } -#undef ASYNCPROTOCOL_THIS +static void GopherProtocol_on_error(Protocol *prot, DWORD error) +{ + FIXME("(%p) %d - stub\n", prot, error); +} static const ProtocolVtbl AsyncProtocolVtbl = { GopherProtocol_open_request, GopherProtocol_end_request, GopherProtocol_start_downloading, - GopherProtocol_close_connection + GopherProtocol_close_connection, + GopherProtocol_on_error }; -#define PROTOCOL_THIS(iface) DEFINE_THIS(GopherProtocol, IInternetProtocol, iface) +static inline GopherProtocol *impl_from_IInternetProtocol(IInternetProtocol *iface) +{ + return CONTAINING_RECORD(iface, GopherProtocol, IInternetProtocol_iface); +} static HRESULT WINAPI GopherProtocol_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv) { - GopherProtocol *This = PROTOCOL_THIS(iface); + GopherProtocol *This = impl_from_IInternetProtocol(iface); *ppv = NULL; if(IsEqualGUID(&IID_IUnknown, riid)) { TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv); - *ppv = PROTOCOL(This); + *ppv = &This->IInternetProtocol_iface; }else if(IsEqualGUID(&IID_IInternetProtocolRoot, riid)) { TRACE("(%p)->(IID_IInternetProtocolRoot %p)\n", This, ppv); - *ppv = PROTOCOL(This); + *ppv = &This->IInternetProtocol_iface; }else if(IsEqualGUID(&IID_IInternetProtocol, riid)) { TRACE("(%p)->(IID_IInternetProtocol %p)\n", This, ppv); - *ppv = PROTOCOL(This); + *ppv = &This->IInternetProtocol_iface; }else if(IsEqualGUID(&IID_IInternetPriority, riid)) { TRACE("(%p)->(IID_IInternetPriority %p)\n", This, ppv); - *ppv = PRIORITY(This); + *ppv = &This->IInternetPriority_iface; } if(*ppv) { @@ -111,7 +119,7 @@ static HRESULT WINAPI GopherProtocol_QueryInterface(IInternetProtocol *iface, RE static ULONG WINAPI GopherProtocol_AddRef(IInternetProtocol *iface) { - GopherProtocol *This = PROTOCOL_THIS(iface); + GopherProtocol *This = impl_from_IInternetProtocol(iface); LONG ref = InterlockedIncrement(&This->ref); TRACE("(%p) ref=%d\n", This, ref); return ref; @@ -119,7 +127,7 @@ static ULONG WINAPI GopherProtocol_AddRef(IInternetProtocol *iface) static ULONG WINAPI GopherProtocol_Release(IInternetProtocol *iface) { - GopherProtocol *This = PROTOCOL_THIS(iface); + GopherProtocol *This = impl_from_IInternetProtocol(iface); LONG ref = InterlockedDecrement(&This->ref); TRACE("(%p) ref=%d\n", This, ref); @@ -137,7 +145,7 @@ static HRESULT WINAPI GopherProtocol_Start(IInternetProtocol *iface, LPCWSTR szU IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE_PTR dwReserved) { - GopherProtocol *This = PROTOCOL_THIS(iface); + GopherProtocol *This = impl_from_IInternetProtocol(iface); IUri *uri; HRESULT hres; @@ -148,7 +156,8 @@ static HRESULT WINAPI GopherProtocol_Start(IInternetProtocol *iface, LPCWSTR szU if(FAILED(hres)) return hres; - hres = protocol_start(&This->base, PROTOCOL(This), uri, pOIProtSink, pOIBindInfo); + hres = protocol_start(&This->base, &This->IInternetProtocol_iface, uri, pOIProtSink, + pOIBindInfo); IUri_Release(uri); return hres; @@ -156,7 +165,7 @@ static HRESULT WINAPI GopherProtocol_Start(IInternetProtocol *iface, LPCWSTR szU static HRESULT WINAPI GopherProtocol_Continue(IInternetProtocol *iface, PROTOCOLDATA *pProtocolData) { - GopherProtocol *This = PROTOCOL_THIS(iface); + GopherProtocol *This = impl_from_IInternetProtocol(iface); TRACE("(%p)->(%p)\n", This, pProtocolData); @@ -166,7 +175,7 @@ static HRESULT WINAPI GopherProtocol_Continue(IInternetProtocol *iface, PROTOCOL static HRESULT WINAPI GopherProtocol_Abort(IInternetProtocol *iface, HRESULT hrReason, DWORD dwOptions) { - GopherProtocol *This = PROTOCOL_THIS(iface); + GopherProtocol *This = impl_from_IInternetProtocol(iface); TRACE("(%p)->(%08x %08x)\n", This, hrReason, dwOptions); @@ -175,7 +184,7 @@ static HRESULT WINAPI GopherProtocol_Abort(IInternetProtocol *iface, HRESULT hrR static HRESULT WINAPI GopherProtocol_Terminate(IInternetProtocol *iface, DWORD dwOptions) { - GopherProtocol *This = PROTOCOL_THIS(iface); + GopherProtocol *This = impl_from_IInternetProtocol(iface); TRACE("(%p)->(%08x)\n", This, dwOptions); @@ -185,14 +194,14 @@ static HRESULT WINAPI GopherProtocol_Terminate(IInternetProtocol *iface, DWORD d static HRESULT WINAPI GopherProtocol_Suspend(IInternetProtocol *iface) { - GopherProtocol *This = PROTOCOL_THIS(iface); + GopherProtocol *This = impl_from_IInternetProtocol(iface); FIXME("(%p)\n", This); return E_NOTIMPL; } static HRESULT WINAPI GopherProtocol_Resume(IInternetProtocol *iface) { - GopherProtocol *This = PROTOCOL_THIS(iface); + GopherProtocol *This = impl_from_IInternetProtocol(iface); FIXME("(%p)\n", This); return E_NOTIMPL; } @@ -200,7 +209,7 @@ static HRESULT WINAPI GopherProtocol_Resume(IInternetProtocol *iface) static HRESULT WINAPI GopherProtocol_Read(IInternetProtocol *iface, void *pv, ULONG cb, ULONG *pcbRead) { - GopherProtocol *This = PROTOCOL_THIS(iface); + GopherProtocol *This = impl_from_IInternetProtocol(iface); TRACE("(%p)->(%p %u %p)\n", This, pv, cb, pcbRead); @@ -210,14 +219,14 @@ static HRESULT WINAPI GopherProtocol_Read(IInternetProtocol *iface, void *pv, static HRESULT WINAPI GopherProtocol_Seek(IInternetProtocol *iface, LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition) { - GopherProtocol *This = PROTOCOL_THIS(iface); + GopherProtocol *This = impl_from_IInternetProtocol(iface); FIXME("(%p)->(%d %d %p)\n", This, dlibMove.u.LowPart, dwOrigin, plibNewPosition); return E_NOTIMPL; } static HRESULT WINAPI GopherProtocol_LockRequest(IInternetProtocol *iface, DWORD dwOptions) { - GopherProtocol *This = PROTOCOL_THIS(iface); + GopherProtocol *This = impl_from_IInternetProtocol(iface); TRACE("(%p)->(%08x)\n", This, dwOptions); @@ -226,15 +235,13 @@ static HRESULT WINAPI GopherProtocol_LockRequest(IInternetProtocol *iface, DWORD static HRESULT WINAPI GopherProtocol_UnlockRequest(IInternetProtocol *iface) { - GopherProtocol *This = PROTOCOL_THIS(iface); + GopherProtocol *This = impl_from_IInternetProtocol(iface); TRACE("(%p)\n", This); return protocol_unlock_request(&This->base); } -#undef PROTOCOL_THIS - static const IInternetProtocolVtbl GopherProtocolVtbl = { GopherProtocol_QueryInterface, GopherProtocol_AddRef, @@ -251,29 +258,32 @@ static const IInternetProtocolVtbl GopherProtocolVtbl = { GopherProtocol_UnlockRequest }; -#define PRIORITY_THIS(iface) DEFINE_THIS(GopherProtocol, InternetPriority, iface) +static inline GopherProtocol *impl_from_IInternetPriority(IInternetPriority *iface) +{ + return CONTAINING_RECORD(iface, GopherProtocol, IInternetPriority_iface); +} static HRESULT WINAPI GopherPriority_QueryInterface(IInternetPriority *iface, REFIID riid, void **ppv) { - GopherProtocol *This = PRIORITY_THIS(iface); - return IInternetProtocol_QueryInterface(PROTOCOL(This), riid, ppv); + GopherProtocol *This = impl_from_IInternetPriority(iface); + return IInternetProtocol_QueryInterface(&This->IInternetProtocol_iface, riid, ppv); } static ULONG WINAPI GopherPriority_AddRef(IInternetPriority *iface) { - GopherProtocol *This = PRIORITY_THIS(iface); - return IInternetProtocol_AddRef(PROTOCOL(This)); + GopherProtocol *This = impl_from_IInternetPriority(iface); + return IInternetProtocol_AddRef(&This->IInternetProtocol_iface); } static ULONG WINAPI GopherPriority_Release(IInternetPriority *iface) { - GopherProtocol *This = PRIORITY_THIS(iface); - return IInternetProtocol_Release(PROTOCOL(This)); + GopherProtocol *This = impl_from_IInternetPriority(iface); + return IInternetProtocol_Release(&This->IInternetProtocol_iface); } static HRESULT WINAPI GopherPriority_SetPriority(IInternetPriority *iface, LONG nPriority) { - GopherProtocol *This = PRIORITY_THIS(iface); + GopherProtocol *This = impl_from_IInternetPriority(iface); TRACE("(%p)->(%d)\n", This, nPriority); @@ -283,7 +293,7 @@ static HRESULT WINAPI GopherPriority_SetPriority(IInternetPriority *iface, LONG static HRESULT WINAPI GopherPriority_GetPriority(IInternetPriority *iface, LONG *pnPriority) { - GopherProtocol *This = PRIORITY_THIS(iface); + GopherProtocol *This = impl_from_IInternetPriority(iface); TRACE("(%p)->(%p)\n", This, pnPriority); @@ -291,8 +301,6 @@ static HRESULT WINAPI GopherPriority_GetPriority(IInternetPriority *iface, LONG return S_OK; } -#undef PRIORITY_THIS - static const IInternetPriorityVtbl GopherPriorityVtbl = { GopherPriority_QueryInterface, GopherPriority_AddRef, @@ -312,11 +320,11 @@ HRESULT GopherProtocol_Construct(IUnknown *pUnkOuter, LPVOID *ppobj) ret = heap_alloc_zero(sizeof(GopherProtocol)); ret->base.vtbl = &AsyncProtocolVtbl; - ret->lpIInternetProtocolVtbl = &GopherProtocolVtbl; - ret->lpInternetPriorityVtbl = &GopherPriorityVtbl; + ret->IInternetProtocol_iface.lpVtbl = &GopherProtocolVtbl; + ret->IInternetPriority_iface.lpVtbl = &GopherPriorityVtbl; ret->ref = 1; - *ppobj = PROTOCOL(ret); + *ppobj = &ret->IInternetProtocol_iface; return S_OK; } diff --git a/dll/win32/urlmon/http.c b/dll/win32/urlmon/http.c index 2aaefb085ec..5a606ca774d 100644 --- a/dll/win32/urlmon/http.c +++ b/dll/win32/urlmon/http.c @@ -36,7 +36,7 @@ typedef struct { BOOL https; IHttpNegotiate *http_negotiate; - LPWSTR full_header; + WCHAR *full_header; LONG ref; } HttpProtocol; @@ -56,9 +56,8 @@ static inline HttpProtocol *impl_from_IWinInetHttpInfo(IWinInetHttpInfo *iface) return CONTAINING_RECORD(iface, HttpProtocol, IWinInetHttpInfo_iface); } -/* Default headers from native */ -static const WCHAR wszHeaders[] = {'A','c','c','e','p','t','-','E','n','c','o','d','i','n','g', - ':',' ','g','z','i','p',',',' ','d','e','f','l','a','t','e',0}; +static const WCHAR default_headersW[] = { + 'A','c','c','e','p','t','-','E','n','c','o','d','i','n','g',':',' ','g','z','i','p',',',' ','d','e','f','l','a','t','e',0}; static LPWSTR query_http_info(HttpProtocol *This, DWORD option) { @@ -80,13 +79,196 @@ static LPWSTR query_http_info(HttpProtocol *This, DWORD option) return ret; } -#define ASYNCPROTOCOL_THIS(iface) DEFINE_THIS2(HttpProtocol, base, iface) +static inline BOOL set_security_flag(HttpProtocol *This, DWORD new_flag) +{ + DWORD flags, size = sizeof(flags); + BOOL res; + + res = InternetQueryOptionW(This->base.request, INTERNET_OPTION_SECURITY_FLAGS, &flags, &size); + if(res) { + flags |= new_flag; + res = InternetSetOptionW(This->base.request, INTERNET_OPTION_SECURITY_FLAGS, &flags, size); + } + if(!res) + ERR("Failed to set security flag(s): %x\n", new_flag); + + return res; +} + +static inline HRESULT internet_error_to_hres(DWORD error) +{ + switch(error) + { + case ERROR_INTERNET_SEC_CERT_DATE_INVALID: + case ERROR_INTERNET_SEC_CERT_CN_INVALID: + case ERROR_INTERNET_INVALID_CA: + case ERROR_INTERNET_CLIENT_AUTH_CERT_NEEDED: + return INET_E_INVALID_CERTIFICATE; + case ERROR_INTERNET_HTTP_TO_HTTPS_ON_REDIR: + case ERROR_INTERNET_HTTPS_TO_HTTP_ON_REDIR: + case ERROR_HTTP_REDIRECT_NEEDS_CONFIRMATION: + return INET_E_REDIRECT_FAILED; + default: + return INET_E_DOWNLOAD_FAILURE; + } +} + +static HRESULT handle_http_error(HttpProtocol *This, DWORD error) +{ + IServiceProvider *serv_prov; + IWindowForBindingUI *wfb_ui; + IHttpSecurity *http_security; + BOOL security_problem; + HRESULT hres; + + switch(error) { + case ERROR_INTERNET_SEC_CERT_DATE_INVALID: + case ERROR_INTERNET_SEC_CERT_CN_INVALID: + case ERROR_INTERNET_HTTP_TO_HTTPS_ON_REDIR: + case ERROR_INTERNET_HTTPS_TO_HTTP_ON_REDIR: + case ERROR_HTTP_REDIRECT_NEEDS_CONFIRMATION: + case ERROR_INTERNET_INVALID_CA: + case ERROR_INTERNET_CLIENT_AUTH_CERT_NEEDED: + security_problem = TRUE; + break; + default: + security_problem = FALSE; + } + + hres = IInternetProtocolSink_QueryInterface(This->base.protocol_sink, &IID_IServiceProvider, + (void**)&serv_prov); + if(FAILED(hres)) { + ERR("Failed to get IServiceProvider.\n"); + return E_ABORT; + } + + if(security_problem) { + hres = IServiceProvider_QueryService(serv_prov, &IID_IHttpSecurity, &IID_IHttpSecurity, + (void**)&http_security); + if(SUCCEEDED(hres)) { + hres = IHttpSecurity_OnSecurityProblem(http_security, error); + IHttpSecurity_Release(http_security); + + if(hres != S_FALSE) + { + BOOL res = FALSE; + + IServiceProvider_Release(serv_prov); + + if(hres == S_OK) { + if(error == ERROR_INTERNET_SEC_CERT_DATE_INVALID) + res = set_security_flag(This, SECURITY_FLAG_IGNORE_CERT_DATE_INVALID); + else if(error == ERROR_INTERNET_SEC_CERT_CN_INVALID) + res = set_security_flag(This, SECURITY_FLAG_IGNORE_CERT_CN_INVALID); + else if(error == ERROR_INTERNET_INVALID_CA) + res = set_security_flag(This, SECURITY_FLAG_IGNORE_UNKNOWN_CA); + + if(res) + return RPC_E_RETRY; + + FIXME("Don't know how to ignore error %d\n", error); + return E_ABORT; + } + + if(hres == E_ABORT) + return E_ABORT; + if(hres == RPC_E_RETRY) + return RPC_E_RETRY; + + return internet_error_to_hres(error); + } + } + } + + hres = IServiceProvider_QueryService(serv_prov, &IID_IWindowForBindingUI, &IID_IWindowForBindingUI, + (void**)&wfb_ui); + if(SUCCEEDED(hres)) { + HWND hwnd; + const IID *iid_reason; + + if(security_problem) + iid_reason = &IID_IHttpSecurity; + else if(error == ERROR_INTERNET_INCORRECT_PASSWORD) + iid_reason = &IID_IAuthenticate; + else + iid_reason = &IID_IWindowForBindingUI; + + hres = IWindowForBindingUI_GetWindow(wfb_ui, iid_reason, &hwnd); + if(SUCCEEDED(hres) && hwnd) + { + DWORD res; + + res = InternetErrorDlg(hwnd, This->base.request, error, + FLAGS_ERROR_UI_FLAGS_CHANGE_OPTIONS | FLAGS_ERROR_UI_FLAGS_GENERATE_DATA, + NULL); + + if(res == ERROR_INTERNET_FORCE_RETRY || res == ERROR_SUCCESS) + hres = RPC_E_RETRY; + else + hres = E_FAIL; + } + IWindowForBindingUI_Release(wfb_ui); + } + + IServiceProvider_Release(serv_prov); + + if(hres == RPC_E_RETRY) + return hres; + + return internet_error_to_hres(error); +} + +static ULONG send_http_request(HttpProtocol *This) +{ + INTERNET_BUFFERSW send_buffer = {sizeof(INTERNET_BUFFERSW)}; + BOOL res; + + send_buffer.lpcszHeader = This->full_header; + send_buffer.dwHeadersLength = send_buffer.dwHeadersTotal = strlenW(This->full_header); + + if(This->base.bind_info.dwBindVerb != BINDVERB_GET) { + switch(This->base.bind_info.stgmedData.tymed) { + case TYMED_HGLOBAL: + /* Native does not use GlobalLock/GlobalUnlock, so we won't either */ + send_buffer.lpvBuffer = This->base.bind_info.stgmedData.u.hGlobal; + send_buffer.dwBufferLength = send_buffer.dwBufferTotal = This->base.bind_info.cbstgmedData; + break; + case TYMED_ISTREAM: { + LARGE_INTEGER offset; + + send_buffer.dwBufferTotal = This->base.bind_info.cbstgmedData; + if(!This->base.post_stream) { + This->base.post_stream = This->base.bind_info.stgmedData.u.pstm; + IStream_AddRef(This->base.post_stream); + } + + offset.QuadPart = 0; + IStream_Seek(This->base.post_stream, offset, STREAM_SEEK_SET, NULL); + break; + } + default: + FIXME("Unsupported This->base.bind_info.stgmedData.tymed %d\n", This->base.bind_info.stgmedData.tymed); + } + } + + if(This->base.post_stream) + res = HttpSendRequestExW(This->base.request, &send_buffer, NULL, 0, 0); + else + res = HttpSendRequestW(This->base.request, send_buffer.lpcszHeader, send_buffer.dwHeadersLength, + send_buffer.lpvBuffer, send_buffer.dwBufferLength); + + return res ? 0 : GetLastError(); +} + +static inline HttpProtocol *impl_from_Protocol(Protocol *prot) +{ + return CONTAINING_RECORD(prot, HttpProtocol, base); +} static HRESULT HttpProtocol_open_request(Protocol *prot, IUri *uri, DWORD request_flags, HINTERNET internet_session, IInternetBindInfo *bind_info) { - HttpProtocol *This = ASYNCPROTOCOL_THIS(prot); - INTERNET_BUFFERSW send_buffer = {sizeof(INTERNET_BUFFERSW)}; + HttpProtocol *This = impl_from_Protocol(prot); LPWSTR addl_header = NULL, post_cookie = NULL; IServiceProvider *service_provider = NULL; IHttpNegotiate2 *http_negotiate2 = NULL; @@ -94,8 +276,8 @@ static HRESULT HttpProtocol_open_request(Protocol *prot, IUri *uri, DWORD reques LPOLESTR accept_mimes[257]; const WCHAR **accept_types; BYTE security_id[512]; - DWORD len = 0, port; - ULONG num; + DWORD len, port; + ULONG num, error; BOOL res, b; HRESULT hres; @@ -188,7 +370,7 @@ static HRESULT HttpProtocol_open_request(Protocol *prot, IUri *uri, DWORD reques return hres; } - hres = IHttpNegotiate_BeginningTransaction(This->http_negotiate, url, wszHeaders, + hres = IHttpNegotiate_BeginningTransaction(This->http_negotiate, url, default_headersW, 0, &addl_header); SysFreeString(url); if(hres != S_OK) { @@ -197,18 +379,19 @@ static HRESULT HttpProtocol_open_request(Protocol *prot, IUri *uri, DWORD reques return hres; } - if(addl_header) { - int len_addl_header = strlenW(addl_header); + len = addl_header ? strlenW(addl_header) : 0; - This->full_header = heap_alloc(len_addl_header*sizeof(WCHAR)+sizeof(wszHeaders)); - - lstrcpyW(This->full_header, addl_header); - lstrcpyW(&This->full_header[len_addl_header], wszHeaders); - CoTaskMemFree(addl_header); - }else { - This->full_header = (LPWSTR)wszHeaders; + This->full_header = heap_alloc(len*sizeof(WCHAR)+sizeof(default_headersW)); + if(!This->full_header) { + IServiceProvider_Release(service_provider); + return E_OUTOFMEMORY; } + if(len) + memcpy(This->full_header, addl_header, len*sizeof(WCHAR)); + CoTaskMemFree(addl_header); + memcpy(This->full_header+len, default_headersW, sizeof(default_headersW)); + hres = IServiceProvider_QueryService(service_provider, &IID_IHttpNegotiate2, &IID_IHttpNegotiate2, (void **)&http_negotiate2); IServiceProvider_Release(service_provider); @@ -236,48 +419,23 @@ static HRESULT HttpProtocol_open_request(Protocol *prot, IUri *uri, DWORD reques } } - send_buffer.lpcszHeader = This->full_header; - send_buffer.dwHeadersLength = send_buffer.dwHeadersTotal = strlenW(This->full_header); - - if(This->base.bind_info.dwBindVerb != BINDVERB_GET) { - switch(This->base.bind_info.stgmedData.tymed) { - case TYMED_HGLOBAL: - /* Native does not use GlobalLock/GlobalUnlock, so we won't either */ - send_buffer.lpvBuffer = This->base.bind_info.stgmedData.u.hGlobal; - send_buffer.dwBufferLength = send_buffer.dwBufferTotal = This->base.bind_info.cbstgmedData; - break; - case TYMED_ISTREAM: { - LARGE_INTEGER offset; - - send_buffer.dwBufferTotal = This->base.bind_info.cbstgmedData; - This->base.post_stream = This->base.bind_info.stgmedData.u.pstm; - IStream_AddRef(This->base.post_stream); - - offset.QuadPart = 0; - IStream_Seek(This->base.post_stream, offset, STREAM_SEEK_SET, NULL); - break; - } - default: - FIXME("Unsupported This->base.bind_info.stgmedData.tymed %d\n", This->base.bind_info.stgmedData.tymed); - } - } - b = TRUE; res = InternetSetOptionW(This->base.request, INTERNET_OPTION_HTTP_DECODING, &b, sizeof(b)); if(!res) WARN("InternetSetOption(INTERNET_OPTION_HTTP_DECODING) failed: %08x\n", GetLastError()); - if(This->base.post_stream) - res = HttpSendRequestExW(This->base.request, &send_buffer, NULL, 0, 0); - else - res = HttpSendRequestW(This->base.request, send_buffer.lpcszHeader, send_buffer.dwHeadersLength, - send_buffer.lpvBuffer, send_buffer.dwBufferLength); - if(!res && GetLastError() != ERROR_IO_PENDING) { - WARN("HttpSendRequest failed: %d\n", GetLastError()); - return INET_E_DOWNLOAD_FAILURE; - } + do { + error = send_http_request(This); - return S_OK; + if(error == ERROR_IO_PENDING || error == ERROR_SUCCESS) + return S_OK; + + hres = handle_http_error(This, error); + + } while(hres == RPC_E_RETRY); + + WARN("HttpSendRequest failed: %d\n", error); + return hres; } static HRESULT HttpProtocol_end_request(Protocol *protocol) @@ -295,7 +453,7 @@ static HRESULT HttpProtocol_end_request(Protocol *protocol) static HRESULT HttpProtocol_start_downloading(Protocol *prot) { - HttpProtocol *This = ASYNCPROTOCOL_THIS(prot); + HttpProtocol *This = impl_from_Protocol(prot); LPWSTR content_type, content_length, ranges; DWORD len = sizeof(DWORD); DWORD status_code; @@ -363,27 +521,49 @@ static HRESULT HttpProtocol_start_downloading(Protocol *prot) static void HttpProtocol_close_connection(Protocol *prot) { - HttpProtocol *This = ASYNCPROTOCOL_THIS(prot); + HttpProtocol *This = impl_from_Protocol(prot); if(This->http_negotiate) { IHttpNegotiate_Release(This->http_negotiate); - This->http_negotiate = 0; + This->http_negotiate = NULL; } if(This->full_header) { - if(This->full_header != wszHeaders) - heap_free(This->full_header); - This->full_header = 0; + heap_free(This->full_header); + This->full_header = NULL; } } -#undef ASYNCPROTOCOL_THIS +static void HttpProtocol_on_error(Protocol *prot, DWORD error) +{ + HttpProtocol *This = impl_from_Protocol(prot); + HRESULT hres; + + TRACE("(%p) %d\n", prot, error); + + if(prot->flags & FLAG_FIRST_CONTINUE_COMPLETE) { + FIXME("Not handling error %d\n", error); + return; + } + + while((hres = handle_http_error(This, error)) == RPC_E_RETRY) { + error = send_http_request(This); + + if(error == ERROR_IO_PENDING || error == ERROR_SUCCESS) + return; + } + + protocol_abort(prot, hres); + protocol_close_connection(prot); + return; +} static const ProtocolVtbl AsyncProtocolVtbl = { HttpProtocol_open_request, HttpProtocol_end_request, HttpProtocol_start_downloading, - HttpProtocol_close_connection + HttpProtocol_close_connection, + HttpProtocol_on_error }; static HRESULT WINAPI HttpProtocol_QueryInterface(IInternetProtocolEx *iface, REFIID riid, void **ppv) @@ -655,16 +835,31 @@ static HRESULT WINAPI HttpInfo_QueryOption(IWinInetHttpInfo *iface, DWORD dwOpti void *pBuffer, DWORD *pcbBuffer) { HttpProtocol *This = impl_from_IWinInetHttpInfo(iface); - FIXME("(%p)->(%x %p %p)\n", This, dwOption, pBuffer, pcbBuffer); - return E_NOTIMPL; + TRACE("(%p)->(%x %p %p)\n", This, dwOption, pBuffer, pcbBuffer); + + if(!This->base.request) + return E_FAIL; + + if(!InternetQueryOptionW(This->base.request, dwOption, pBuffer, pcbBuffer)) + return S_FALSE; + return S_OK; } static HRESULT WINAPI HttpInfo_QueryInfo(IWinInetHttpInfo *iface, DWORD dwOption, void *pBuffer, DWORD *pcbBuffer, DWORD *pdwFlags, DWORD *pdwReserved) { HttpProtocol *This = impl_from_IWinInetHttpInfo(iface); - FIXME("(%p)->(%x %p %p %p %p)\n", This, dwOption, pBuffer, pcbBuffer, pdwFlags, pdwReserved); - return E_NOTIMPL; + TRACE("(%p)->(%x %p %p %p %p)\n", This, dwOption, pBuffer, pcbBuffer, pdwFlags, pdwReserved); + + if(!This->base.request) + return E_FAIL; + + if(!HttpQueryInfoW(This->base.request, dwOption, pBuffer, pcbBuffer, pdwFlags)) { + if(pBuffer) + memset(pBuffer, 0, *pcbBuffer); + return S_OK; + } + return S_OK; } static const IWinInetHttpInfoVtbl WinInetHttpInfoVtbl = { diff --git a/dll/win32/urlmon/internet.c b/dll/win32/urlmon/internet.c index 3d41defe8f6..3832c524daa 100644 --- a/dll/win32/urlmon/internet.c +++ b/dll/win32/urlmon/internet.c @@ -1,5 +1,6 @@ /* * Copyright 2005 Jacek Caban + * Copyright 2011 Thomas Mullaly for CodeWeavers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -24,6 +25,127 @@ WINE_DEFAULT_DEBUG_CHANNEL(urlmon); +static const WCHAR feature_control_keyW[] = + {'S','o','f','t','w','a','r','e','\\', + 'M','i','c','r','o','s','o','f','t','\\', + 'I','n','t','e','r','n','e','t',' ','E','x','p','l','o','r','e','r','\\', + 'M','a','i','n','\\', + 'F','e','a','t','u','r','e','C','o','n','t','r','o','l',0}; + +static const WCHAR feature_object_cachingW[] = + {'F','E','A','T','U','R','E','_','O','B','J','E','C','T','_','C','A','C','H','I','N','G',0}; +static const WCHAR feature_zone_elevationW[] = + {'F','E','A','T','U','R','E','_','Z','O','N','E','_','E','L','E','V','A','T','I','O','N',0}; +static const WCHAR feature_mime_handlingW[] = + {'F','E','A','T','U','R','E','_','M','I','M','E','_','H','A','N','D','L','I','N','G',0}; +static const WCHAR feature_mime_sniffingW[] = + {'F','E','A','T','U','R','E','_','M','I','M','E','_','S','N','I','F','F','I','N','G',0}; +static const WCHAR feature_window_restrictionsW[] = + {'F','E','A','T','U','R','E','_','W','I','N','D','O','W','_','R','E','S','T','R','I','C','T','I','O','N','S',0}; +static const WCHAR feature_weboc_popupmanagementW[] = + {'F','E','A','T','U','R','E','_','W','E','B','O','C','_','P','O','P','U','P','M','A','N','A','G','E','M','E','N','T',0}; +static const WCHAR feature_behaviorsW[] = + {'F','E','A','T','U','R','E','_','B','E','H','A','V','I','O','R','S',0}; +static const WCHAR feature_disable_mk_protocolW[] = + {'F','E','A','T','U','R','E','_','D','I','S','A','B','L','E','_','M','K','_','P','R','O','T','O','C','O','L',0}; +static const WCHAR feature_localmachine_lockdownW[] = + {'F','E','A','T','U','R','E','_','L','O','C','A','L','M','A','C','H','I','N','E','_','L','O','C','K','D','O','W','N',0}; +static const WCHAR feature_securitybandW[] = + {'F','E','A','T','U','R','E','_','S','E','C','U','R','I','T','Y','B','A','N','D',0}; +static const WCHAR feature_restrict_activexinstallW[] = + {'F','E','A','T','U','R','E','_','R','E','S','T','R','I','C','T','_','A','C','T','I','V','E','X','I','N','S','T','A','L','L',0}; +static const WCHAR feature_validate_navigate_urlW[] = + {'F','E','A','T','U','R','E','_','V','A','L','I','D','A','T','E','_','N','A','V','I','G','A','T','E','_','U','R','L',0}; +static const WCHAR feature_restrict_filedownloadW[] = + {'F','E','A','T','U','R','E','_','R','E','S','T','R','I','C','T','_','F','I','L','E','D','O','W','N','L','O','A','D',0}; +static const WCHAR feature_addon_managementW[] = + {'F','E','A','T','U','R','E','_','A','D','D','O','N','_','M','A','N','A','G','E','M','E','N','T',0}; +static const WCHAR feature_protocol_lockdownW[] = + {'F','E','A','T','U','R','E','_','P','R','O','T','O','C','O','L','_','L','O','C','K','D','O','W','N',0}; +static const WCHAR feature_http_username_password_disableW[] = + {'F','E','A','T','U','R','E','_','H','T','T','P','_','U','S','E','R','N','A','M','E','_', + 'P','A','S','S','W','O','R','D','_','D','I','S','A','B','L','E',0}; +static const WCHAR feature_safe_bindtoobjectW[] = + {'F','E','A','T','U','R','E','_','S','A','F','E','_','B','I','N','D','T','O','O','B','J','E','C','T',0}; +static const WCHAR feature_unc_savedfilecheckW[] = + {'F','E','A','T','U','R','E','_','U','N','C','_','S','A','V','E','D','F','I','L','E','C','H','E','C','K',0}; +static const WCHAR feature_get_url_dom_filepath_unencodedW[] = + {'F','E','A','T','U','R','E','_','G','E','T','_','U','R','L','_','D','O','M','_', + 'F','I','L','E','P','A','T','H','_','U','N','E','N','C','O','D','E','D',0}; +static const WCHAR feature_tabbed_browsingW[] = + {'F','E','A','T','U','R','E','_','T','A','B','B','E','D','_','B','R','O','W','S','I','N','G',0}; +static const WCHAR feature_ssluxW[] = + {'F','E','A','T','U','R','E','_','S','S','L','U','X',0}; +static const WCHAR feature_disable_navigation_soundsW[] = + {'F','E','A','T','U','R','E','_','D','I','S','A','B','L','E','_','N','A','V','I','G','A','T','I','O','N','_', + 'S','O','U','N','D','S',0}; +static const WCHAR feature_disable_legacy_compressionW[] = + {'F','E','A','T','U','R','E','_','D','I','S','A','B','L','E','_','L','E','G','A','C','Y','_', + 'C','O','M','P','R','E','S','S','I','O','N',0}; +static const WCHAR feature_force_addr_and_statusW[] = + {'F','E','A','T','U','R','E','_','F','O','R','C','E','_','A','D','D','R','_','A','N','D','_', + 'S','T','A','T','U','S',0}; +static const WCHAR feature_xmlhttpW[] = + {'F','E','A','T','U','R','E','_','X','M','L','H','T','T','P',0}; +static const WCHAR feature_disable_telnet_protocolW[] = + {'F','E','A','T','U','R','E','_','D','I','S','A','B','L','E','_','T','E','L','N','E','T','_', + 'P','R','O','T','O','C','O','L',0}; +static const WCHAR feature_feedsW[] = + {'F','E','A','T','U','R','E','_','F','E','E','D','S',0}; +static const WCHAR feature_block_input_promptsW[] = + {'F','E','A','T','U','R','E','_','B','L','O','C','K','_','I','N','P','U','T','_','P','R','O','M','P','T','S',0}; + +static CRITICAL_SECTION process_features_cs; +static CRITICAL_SECTION_DEBUG process_features_cs_dbg = +{ + 0, 0, &process_features_cs, + { &process_features_cs_dbg.ProcessLocksList, &process_features_cs_dbg.ProcessLocksList }, + 0, 0, { (DWORD_PTR)(__FILE__ ": process features") } +}; +static CRITICAL_SECTION process_features_cs = { &process_features_cs_dbg, -1, 0, 0, 0, 0 }; + +typedef struct feature_control { + LPCWSTR feature_name; + BOOL enabled; + BOOL check_registry; +} feature_control; + +/* IMPORTANT!!! + * + * This array is indexed using INTERNETFEATURELIST values, so everything must + * appear in the same order as it does in INTERNETFEATURELIST. + */ +static feature_control process_feature_controls[FEATURE_ENTRY_COUNT] = { + {feature_object_cachingW, TRUE ,TRUE}, + {feature_zone_elevationW, FALSE,TRUE}, + {feature_mime_handlingW, FALSE,TRUE}, + {feature_mime_sniffingW, FALSE,TRUE}, + {feature_window_restrictionsW, FALSE,TRUE}, + {feature_weboc_popupmanagementW, FALSE,TRUE}, + {feature_behaviorsW, TRUE ,TRUE}, + {feature_disable_mk_protocolW, TRUE ,TRUE}, + {feature_localmachine_lockdownW, FALSE,TRUE}, + {feature_securitybandW, FALSE,TRUE}, + {feature_restrict_activexinstallW, FALSE,TRUE}, + {feature_validate_navigate_urlW, FALSE,TRUE}, + {feature_restrict_filedownloadW, FALSE,TRUE}, + {feature_addon_managementW, FALSE,TRUE}, + {feature_protocol_lockdownW, FALSE,TRUE}, + {feature_http_username_password_disableW, FALSE,TRUE}, + {feature_safe_bindtoobjectW, FALSE,TRUE}, + {feature_unc_savedfilecheckW, FALSE,TRUE}, + {feature_get_url_dom_filepath_unencodedW, TRUE ,TRUE}, + {feature_tabbed_browsingW, FALSE,TRUE}, + {feature_ssluxW, FALSE,TRUE}, + {feature_disable_navigation_soundsW, FALSE,TRUE}, + {feature_disable_legacy_compressionW, TRUE ,TRUE}, + {feature_force_addr_and_statusW, FALSE,TRUE}, + {feature_xmlhttpW, TRUE ,TRUE}, + {feature_disable_telnet_protocolW, FALSE,TRUE}, + {feature_feedsW, FALSE,TRUE}, + {feature_block_input_promptsW, FALSE,TRUE} +}; + static HRESULT parse_schema(LPCWSTR url, DWORD flags, LPWSTR result, DWORD size, DWORD *rsize) { WCHAR *ptr; @@ -397,20 +519,182 @@ HRESULT WINAPI CoInternetQueryInfo(LPCWSTR pwzUrl, QUERYOPTION QueryOption, return S_OK; } +static void set_feature_on_process(INTERNETFEATURELIST feature, BOOL enable) +{ + EnterCriticalSection(&process_features_cs); + + process_feature_controls[feature].enabled = enable; + process_feature_controls[feature].check_registry = FALSE; + + LeaveCriticalSection(&process_features_cs); +} + +static HRESULT set_internet_feature(INTERNETFEATURELIST feature, DWORD flags, BOOL enable) +{ + const DWORD supported_flags = SET_FEATURE_ON_PROCESS; + + if(feature >= FEATURE_ENTRY_COUNT) + return E_FAIL; + + if(flags & ~supported_flags) { + FIXME("Unsupported flags: %08x\n", flags & ~supported_flags); + return E_NOTIMPL; + } + + if(flags & SET_FEATURE_ON_PROCESS) + set_feature_on_process(feature, enable); + + return S_OK; +} + +static BOOL get_feature_from_reg(HKEY feature_control, LPCWSTR feature_name, LPCWSTR process_name, BOOL *enabled) +{ + BOOL ret = FALSE; + HKEY feature; + DWORD res; + + static const WCHAR wildcardW[] = {'*',0}; + + res = RegOpenKeyW(feature_control, feature_name, &feature); + if(res == ERROR_SUCCESS) { + DWORD type, value, size; + + size = sizeof(DWORD); + res = RegQueryValueExW(feature, process_name, NULL, &type, (BYTE*)&value, &size); + if(type != REG_DWORD) + WARN("Unexpected registry value type %d (expected REG_DWORD) for %s\n", type, debugstr_w(process_name)); + + if(res == ERROR_SUCCESS && type == REG_DWORD) { + *enabled = value == 1; + ret = TRUE; + } else { + size = sizeof(DWORD); + res = RegQueryValueExW(feature, wildcardW, NULL, &type, (BYTE*)&value, &size); + if(type != REG_DWORD) + WARN("Unexpected registry value type %d (expected REG_DWORD) for %s\n", type, debugstr_w(wildcardW)); + + if(res == ERROR_SUCCESS && type == REG_DWORD) { + *enabled = value == 1; + ret = TRUE; + } + } + RegCloseKey(feature); + } + + return ret; +} + +/* Assumes 'process_features_cs' is held. */ +static HRESULT load_process_feature(INTERNETFEATURELIST feature) +{ + DWORD res; + HKEY feature_control; + WCHAR module_name[MAX_PATH]; + LPCWSTR process_name, feature_name; + HRESULT hres = S_FALSE; + BOOL check_hklm = FALSE; + BOOL enabled; + + if (!GetModuleFileNameW(NULL, module_name, sizeof(module_name)/sizeof(WCHAR))) { + ERR("Failed to get module file name: %u\n", GetLastError()); + return E_UNEXPECTED; + } + + process_name = strrchrW(module_name, '\\'); + if(!process_name) { + ERR("Invalid module file name: %s\n", debugstr_w(module_name)); + return E_UNEXPECTED; + } + + /* Skip past the '\\' in front of the filename. */ + ++process_name; + + feature_name = process_feature_controls[feature].feature_name; + + res = RegOpenKeyW(HKEY_CURRENT_USER, feature_control_keyW, &feature_control); + if(res == ERROR_SUCCESS) { + if(get_feature_from_reg(feature_control, feature_name, process_name, &enabled)) { + hres = enabled ? S_OK : S_FALSE; + process_feature_controls[feature].enabled = enabled; + } else + /* We didn't find anything in HKCU, so check HKLM. */ + check_hklm = TRUE; + + RegCloseKey(feature_control); + } + + if(check_hklm) { + res = RegOpenKeyW(HKEY_LOCAL_MACHINE, feature_control_keyW, &feature_control); + if(res == ERROR_SUCCESS) { + if(get_feature_from_reg(feature_control, feature_name, process_name, &enabled)) { + hres = enabled ? S_OK : S_FALSE; + process_feature_controls[feature].enabled = enabled; + } + RegCloseKey(feature_control); + } + } + + /* Don't bother checking the registry again for this feature. */ + process_feature_controls[feature].check_registry = FALSE; + + return hres; +} + +static HRESULT get_feature_from_process(INTERNETFEATURELIST feature) +{ + HRESULT hres; + + EnterCriticalSection(&process_features_cs); + + /* Try loading the feature from the registry, if it hasn't already + * been done. + */ + if(process_feature_controls[feature].check_registry) { + hres = load_process_feature(feature); + if(FAILED(hres)) { + LeaveCriticalSection(&process_features_cs); + return hres; + } + } + + hres = process_feature_controls[feature].enabled ? S_OK : S_FALSE; + + LeaveCriticalSection(&process_features_cs); + + return hres; +} + +static HRESULT get_internet_feature(INTERNETFEATURELIST feature, DWORD flags) +{ + HRESULT hres; + + if(feature >= FEATURE_ENTRY_COUNT) + return E_FAIL; + + if(flags == GET_FEATURE_FROM_PROCESS) + hres = get_feature_from_process(feature); + else { + FIXME("Unsupported flags: %08x\n", flags); + hres = E_NOTIMPL; + } + + return hres; +} + /*********************************************************************** * CoInternetSetFeatureEnabled (URLMON.@) */ -HRESULT WINAPI CoInternetSetFeatureEnabled(INTERNETFEATURELIST feature, DWORD flags, BOOL enable) +HRESULT WINAPI CoInternetSetFeatureEnabled(INTERNETFEATURELIST FeatureEntry, DWORD dwFlags, BOOL fEnable) { - FIXME("%d, 0x%08x, %x, stub\n", feature, flags, enable); - return E_NOTIMPL; + TRACE("(%d, %08x, %x)\n", FeatureEntry, dwFlags, fEnable); + return set_internet_feature(FeatureEntry, dwFlags, fEnable); } /*********************************************************************** * CoInternetIsFeatureEnabled (URLMON.@) */ -HRESULT WINAPI CoInternetIsFeatureEnabled(INTERNETFEATURELIST feature, DWORD flags) +HRESULT WINAPI CoInternetIsFeatureEnabled(INTERNETFEATURELIST FeatureEntry, DWORD dwFlags) { - FIXME("%d, 0x%08x, stub\n", feature, flags); - return E_NOTIMPL; + TRACE("(%d, %08x)\n", FeatureEntry, dwFlags); + return get_internet_feature(FeatureEntry, dwFlags); } diff --git a/dll/win32/urlmon/mimefilter.c b/dll/win32/urlmon/mimefilter.c index ee6f50f238f..1fe5246cbb0 100644 --- a/dll/win32/urlmon/mimefilter.c +++ b/dll/win32/urlmon/mimefilter.c @@ -22,34 +22,34 @@ WINE_DEFAULT_DEBUG_CHANNEL(urlmon); typedef struct { - const IInternetProtocolVtbl *lpIInternetProtocolVtbl; - const IInternetProtocolSinkVtbl *lpIInternetProtocolSinkVtbl; + IInternetProtocol IInternetProtocol_iface; + IInternetProtocolSink IInternetProtocolSink_iface; LONG ref; } MimeFilter; -#define PROTOCOL(x) ((IInternetProtocol*) &(x)->lpIInternetProtocolVtbl) -#define PROTOCOLSINK(x) ((IInternetProtocolSink*) &(x)->lpIInternetProtocolSinkVtbl) - -#define PROTOCOL_THIS(iface) DEFINE_THIS(MimeFilter, IInternetProtocol, iface) +static inline MimeFilter *impl_from_IInternetProtocol(IInternetProtocol *iface) +{ + return CONTAINING_RECORD(iface, MimeFilter, IInternetProtocol_iface); +} static HRESULT WINAPI MimeFilterProtocol_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv) { - MimeFilter *This = PROTOCOL_THIS(iface); + MimeFilter *This = impl_from_IInternetProtocol(iface); *ppv = NULL; if(IsEqualGUID(&IID_IUnknown, riid)) { TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv); - *ppv = PROTOCOL(This); + *ppv = &This->IInternetProtocol_iface; }else if(IsEqualGUID(&IID_IInternetProtocolRoot, riid)) { TRACE("(%p)->(IID_IInternetProtocolRoot %p)\n", This, ppv); - *ppv = PROTOCOL(This); + *ppv = &This->IInternetProtocol_iface; }else if(IsEqualGUID(&IID_IInternetProtocol, riid)) { TRACE("(%p)->(IID_IInternetProtocol %p)\n", This, ppv); - *ppv = PROTOCOL(This); + *ppv = &This->IInternetProtocol_iface; }else if(IsEqualGUID(&IID_IInternetProtocolSink, riid)) { TRACE("(%p)->(IID_IInternetProtocolSink %p)\n", This, ppv); - *ppv = PROTOCOLSINK(This); + *ppv = &This->IInternetProtocolSink_iface; } if(*ppv) { @@ -63,7 +63,7 @@ static HRESULT WINAPI MimeFilterProtocol_QueryInterface(IInternetProtocol *iface static ULONG WINAPI MimeFilterProtocol_AddRef(IInternetProtocol *iface) { - MimeFilter *This = PROTOCOL_THIS(iface); + MimeFilter *This = impl_from_IInternetProtocol(iface); LONG ref = InterlockedIncrement(&This->ref); TRACE("(%p) ref=%d\n", This, ref); return ref; @@ -71,7 +71,7 @@ static ULONG WINAPI MimeFilterProtocol_AddRef(IInternetProtocol *iface) static ULONG WINAPI MimeFilterProtocol_Release(IInternetProtocol *iface) { - MimeFilter *This = PROTOCOL_THIS(iface); + MimeFilter *This = impl_from_IInternetProtocol(iface); LONG ref = InterlockedDecrement(&This->ref); TRACE("(%p) ref=%d\n", This, ref); @@ -89,7 +89,7 @@ static HRESULT WINAPI MimeFilterProtocol_Start(IInternetProtocol *iface, LPCWSTR IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE_PTR dwReserved) { - MimeFilter *This = PROTOCOL_THIS(iface); + MimeFilter *This = impl_from_IInternetProtocol(iface); FIXME("(%p)->(%s %p %p %08x %lx)\n", This, debugstr_w(szUrl), pOIProtSink, pOIBindInfo, grfPI, dwReserved); return E_NOTIMPL; @@ -97,7 +97,7 @@ static HRESULT WINAPI MimeFilterProtocol_Start(IInternetProtocol *iface, LPCWSTR static HRESULT WINAPI MimeFilterProtocol_Continue(IInternetProtocol *iface, PROTOCOLDATA *pProtocolData) { - MimeFilter *This = PROTOCOL_THIS(iface); + MimeFilter *This = impl_from_IInternetProtocol(iface); FIXME("(%p)->(%p)\n", This, pProtocolData); return E_NOTIMPL; } @@ -105,28 +105,28 @@ static HRESULT WINAPI MimeFilterProtocol_Continue(IInternetProtocol *iface, PROT static HRESULT WINAPI MimeFilterProtocol_Abort(IInternetProtocol *iface, HRESULT hrReason, DWORD dwOptions) { - MimeFilter *This = PROTOCOL_THIS(iface); + MimeFilter *This = impl_from_IInternetProtocol(iface); FIXME("(%p)->(%08x %08x)\n", This, hrReason, dwOptions); return E_NOTIMPL; } static HRESULT WINAPI MimeFilterProtocol_Terminate(IInternetProtocol *iface, DWORD dwOptions) { - MimeFilter *This = PROTOCOL_THIS(iface); + MimeFilter *This = impl_from_IInternetProtocol(iface); FIXME("(%p)->(%08x)\n", This, dwOptions); return E_NOTIMPL; } static HRESULT WINAPI MimeFilterProtocol_Suspend(IInternetProtocol *iface) { - MimeFilter *This = PROTOCOL_THIS(iface); + MimeFilter *This = impl_from_IInternetProtocol(iface); FIXME("(%p)\n", This); return E_NOTIMPL; } static HRESULT WINAPI MimeFilterProtocol_Resume(IInternetProtocol *iface) { - MimeFilter *This = PROTOCOL_THIS(iface); + MimeFilter *This = impl_from_IInternetProtocol(iface); FIXME("(%p)\n", This); return E_NOTIMPL; } @@ -134,7 +134,7 @@ static HRESULT WINAPI MimeFilterProtocol_Resume(IInternetProtocol *iface) static HRESULT WINAPI MimeFilterProtocol_Read(IInternetProtocol *iface, void *pv, ULONG cb, ULONG *pcbRead) { - MimeFilter *This = PROTOCOL_THIS(iface); + MimeFilter *This = impl_from_IInternetProtocol(iface); FIXME("(%p)->(%p %u %p)\n", This, pv, cb, pcbRead); return E_NOTIMPL; } @@ -142,27 +142,25 @@ static HRESULT WINAPI MimeFilterProtocol_Read(IInternetProtocol *iface, void *pv static HRESULT WINAPI MimeFilterProtocol_Seek(IInternetProtocol *iface, LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition) { - MimeFilter *This = PROTOCOL_THIS(iface); + MimeFilter *This = impl_from_IInternetProtocol(iface); FIXME("(%p)->(%d %d %p)\n", This, dlibMove.u.LowPart, dwOrigin, plibNewPosition); return E_NOTIMPL; } static HRESULT WINAPI MimeFilterProtocol_LockRequest(IInternetProtocol *iface, DWORD dwOptions) { - MimeFilter *This = PROTOCOL_THIS(iface); + MimeFilter *This = impl_from_IInternetProtocol(iface); FIXME("(%p)->(%08x)\n", This, dwOptions); return E_NOTIMPL; } static HRESULT WINAPI MimeFilterProtocol_UnlockRequest(IInternetProtocol *iface) { - MimeFilter *This = PROTOCOL_THIS(iface); + MimeFilter *This = impl_from_IInternetProtocol(iface); FIXME("(%p)\n", This); return E_NOTIMPL; } -#undef PROTOCOL_THIS - static const IInternetProtocolVtbl MimeFilterProtocolVtbl = { MimeFilterProtocol_QueryInterface, MimeFilterProtocol_AddRef, @@ -179,31 +177,34 @@ static const IInternetProtocolVtbl MimeFilterProtocolVtbl = { MimeFilterProtocol_UnlockRequest }; -#define PROTSINK_THIS(iface) DEFINE_THIS(MimeFilter, IInternetProtocolSink, iface) +static inline MimeFilter *impl_from_IInternetProtocolSink(IInternetProtocolSink *iface) +{ + return CONTAINING_RECORD(iface, MimeFilter, IInternetProtocolSink_iface); +} static HRESULT WINAPI MimeFilterSink_QueryInterface(IInternetProtocolSink *iface, REFIID riid, void **ppv) { - MimeFilter *This = PROTSINK_THIS(iface); - return IInternetProtocol_QueryInterface(PROTOCOL(This), riid, ppv); + MimeFilter *This = impl_from_IInternetProtocolSink(iface); + return IInternetProtocol_QueryInterface(&This->IInternetProtocol_iface, riid, ppv); } static ULONG WINAPI MimeFilterSink_AddRef(IInternetProtocolSink *iface) { - MimeFilter *This = PROTSINK_THIS(iface); - return IInternetProtocol_AddRef(PROTOCOL(This)); + MimeFilter *This = impl_from_IInternetProtocolSink(iface); + return IInternetProtocol_AddRef(&This->IInternetProtocol_iface); } static ULONG WINAPI MimeFilterSink_Release(IInternetProtocolSink *iface) { - MimeFilter *This = PROTSINK_THIS(iface); - return IInternetProtocol_Release(PROTOCOL(This)); + MimeFilter *This = impl_from_IInternetProtocolSink(iface); + return IInternetProtocol_Release(&This->IInternetProtocol_iface); } static HRESULT WINAPI MimeFilterSink_Switch(IInternetProtocolSink *iface, PROTOCOLDATA *pProtocolData) { - MimeFilter *This = PROTSINK_THIS(iface); + MimeFilter *This = impl_from_IInternetProtocolSink(iface); FIXME("(%p)->(%p)\n", This, pProtocolData); return E_NOTIMPL; } @@ -211,7 +212,7 @@ static HRESULT WINAPI MimeFilterSink_Switch(IInternetProtocolSink *iface, static HRESULT WINAPI MimeFilterSink_ReportProgress(IInternetProtocolSink *iface, ULONG ulStatusCode, LPCWSTR szStatusText) { - MimeFilter *This = PROTSINK_THIS(iface); + MimeFilter *This = impl_from_IInternetProtocolSink(iface); FIXME("(%p)->(%u %s)\n", This, ulStatusCode, debugstr_w(szStatusText)); return E_NOTIMPL; } @@ -219,7 +220,7 @@ static HRESULT WINAPI MimeFilterSink_ReportProgress(IInternetProtocolSink *iface static HRESULT WINAPI MimeFilterSink_ReportData(IInternetProtocolSink *iface, DWORD grfBSCF, ULONG ulProgress, ULONG ulProgressMax) { - MimeFilter *This = PROTSINK_THIS(iface); + MimeFilter *This = impl_from_IInternetProtocolSink(iface); FIXME("(%p)->(%d %u %u)\n", This, grfBSCF, ulProgress, ulProgressMax); return E_NOTIMPL; } @@ -227,13 +228,11 @@ static HRESULT WINAPI MimeFilterSink_ReportData(IInternetProtocolSink *iface, static HRESULT WINAPI MimeFilterSink_ReportResult(IInternetProtocolSink *iface, HRESULT hrResult, DWORD dwError, LPCWSTR szResult) { - MimeFilter *This = PROTSINK_THIS(iface); + MimeFilter *This = impl_from_IInternetProtocolSink(iface); FIXME("(%p)->(%08x %d %s)\n", This, hrResult, dwError, debugstr_w(szResult)); return E_NOTIMPL; } -#undef PROTSINK_THIS - static const IInternetProtocolSinkVtbl InternetProtocolSinkVtbl = { MimeFilterSink_QueryInterface, MimeFilterSink_AddRef, @@ -254,10 +253,10 @@ HRESULT MimeFilter_Construct(IUnknown *pUnkOuter, LPVOID *ppobj) ret = heap_alloc_zero(sizeof(MimeFilter)); - ret->lpIInternetProtocolVtbl = &MimeFilterProtocolVtbl; - ret->lpIInternetProtocolSinkVtbl = &InternetProtocolSinkVtbl; + ret->IInternetProtocol_iface.lpVtbl = &MimeFilterProtocolVtbl; + ret->IInternetProtocolSink_iface.lpVtbl = &InternetProtocolSinkVtbl; ret->ref = 1; - *ppobj = PROTOCOL(ret); + *ppobj = &ret->IInternetProtocol_iface; return S_OK; } diff --git a/dll/win32/urlmon/mk.c b/dll/win32/urlmon/mk.c index 0befe5c34c6..46b4ddcc778 100644 --- a/dll/win32/urlmon/mk.c +++ b/dll/win32/urlmon/mk.c @@ -19,32 +19,41 @@ #include "urlmon_main.h" #include "wine/debug.h" +#define NO_SHLWAPI_REG +#include "shlwapi.h" + WINE_DEFAULT_DEBUG_CHANNEL(urlmon); typedef struct { - const IInternetProtocolVtbl *lpIInternetProtocolVtbl; + IInternetProtocolEx IInternetProtocolEx_iface; LONG ref; IStream *stream; } MkProtocol; -#define PROTOCOL_THIS(iface) DEFINE_THIS(MkProtocol, IInternetProtocol, iface) - -static HRESULT WINAPI MkProtocol_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv) +static inline MkProtocol *impl_from_IInternetProtocolEx(IInternetProtocolEx *iface) { - MkProtocol *This = PROTOCOL_THIS(iface); + return CONTAINING_RECORD(iface, MkProtocol, IInternetProtocolEx_iface); +} + +static HRESULT WINAPI MkProtocol_QueryInterface(IInternetProtocolEx *iface, REFIID riid, void **ppv) +{ + MkProtocol *This = impl_from_IInternetProtocolEx(iface); *ppv = NULL; if(IsEqualGUID(&IID_IUnknown, riid)) { TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv); - *ppv = PROTOCOL(This); + *ppv = &This->IInternetProtocolEx_iface; }else if(IsEqualGUID(&IID_IInternetProtocolRoot, riid)) { TRACE("(%p)->(IID_IInternetProtocolRoot %p)\n", This, ppv); - *ppv = PROTOCOL(This); + *ppv = &This->IInternetProtocolEx_iface; }else if(IsEqualGUID(&IID_IInternetProtocol, riid)) { TRACE("(%p)->(IID_IInternetProtocol %p)\n", This, ppv); - *ppv = PROTOCOL(This); + *ppv = &This->IInternetProtocolEx_iface; + }else if(IsEqualGUID(&IID_IInternetProtocolEx, riid)) { + TRACE("(%p)->(IID_IInternetProtocolEx %p)\n", This, ppv); + *ppv = &This->IInternetProtocolEx_iface; } if(*ppv) { @@ -56,17 +65,17 @@ static HRESULT WINAPI MkProtocol_QueryInterface(IInternetProtocol *iface, REFIID return E_NOINTERFACE; } -static ULONG WINAPI MkProtocol_AddRef(IInternetProtocol *iface) +static ULONG WINAPI MkProtocol_AddRef(IInternetProtocolEx *iface) { - MkProtocol *This = PROTOCOL_THIS(iface); + MkProtocol *This = impl_from_IInternetProtocolEx(iface); LONG ref = InterlockedIncrement(&This->ref); TRACE("(%p) ref=%d\n", This, ref); return ref; } -static ULONG WINAPI MkProtocol_Release(IInternetProtocol *iface) +static ULONG WINAPI MkProtocol_Release(IInternetProtocolEx *iface) { - MkProtocol *This = PROTOCOL_THIS(iface); + MkProtocol *This = impl_from_IInternetProtocolEx(iface); LONG ref = InterlockedDecrement(&This->ref); TRACE("(%p) ref=%d\n", This, ref); @@ -89,27 +98,128 @@ static HRESULT report_result(IInternetProtocolSink *sink, HRESULT hres, DWORD dw return hres; } -static HRESULT WINAPI MkProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl, +static HRESULT WINAPI MkProtocol_Start(IInternetProtocolEx *iface, LPCWSTR szUrl, IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE_PTR dwReserved) { - MkProtocol *This = PROTOCOL_THIS(iface); - IParseDisplayName *pdn; - IMoniker *mon; - LPWSTR mime, progid, display_name; - LPCWSTR ptr, ptr2; - BINDINFO bindinfo; - STATSTG statstg; - DWORD bindf=0, eaten=0, len; - CLSID clsid; + MkProtocol *This = impl_from_IInternetProtocolEx(iface); HRESULT hres; - - static const WCHAR wszMK[] = {'m','k',':','@'}; + IUri *uri; TRACE("(%p)->(%s %p %p %08x %lx)\n", This, debugstr_w(szUrl), pOIProtSink, pOIBindInfo, grfPI, dwReserved); - if(strncmpiW(szUrl, wszMK, sizeof(wszMK)/sizeof(WCHAR))) + hres = CreateUri(szUrl, 0, 0, &uri); + if(FAILED(hres)) + return hres; + + hres = IInternetProtocolEx_StartEx(&This->IInternetProtocolEx_iface, uri, pOIProtSink, + pOIBindInfo, grfPI, (HANDLE*)dwReserved); + + IUri_Release(uri); + return hres; +} + +static HRESULT WINAPI MkProtocol_Continue(IInternetProtocolEx *iface, PROTOCOLDATA *pProtocolData) +{ + MkProtocol *This = impl_from_IInternetProtocolEx(iface); + FIXME("(%p)->(%p)\n", This, pProtocolData); + return E_NOTIMPL; +} + +static HRESULT WINAPI MkProtocol_Abort(IInternetProtocolEx *iface, HRESULT hrReason, + DWORD dwOptions) +{ + MkProtocol *This = impl_from_IInternetProtocolEx(iface); + FIXME("(%p)->(%08x %08x)\n", This, hrReason, dwOptions); + return E_NOTIMPL; +} + +static HRESULT WINAPI MkProtocol_Terminate(IInternetProtocolEx *iface, DWORD dwOptions) +{ + MkProtocol *This = impl_from_IInternetProtocolEx(iface); + + TRACE("(%p)->(%08x)\n", This, dwOptions); + + return S_OK; +} + +static HRESULT WINAPI MkProtocol_Suspend(IInternetProtocolEx *iface) +{ + MkProtocol *This = impl_from_IInternetProtocolEx(iface); + FIXME("(%p)\n", This); + return E_NOTIMPL; +} + +static HRESULT WINAPI MkProtocol_Resume(IInternetProtocolEx *iface) +{ + MkProtocol *This = impl_from_IInternetProtocolEx(iface); + FIXME("(%p)\n", This); + return E_NOTIMPL; +} + +static HRESULT WINAPI MkProtocol_Read(IInternetProtocolEx *iface, void *pv, + ULONG cb, ULONG *pcbRead) +{ + MkProtocol *This = impl_from_IInternetProtocolEx(iface); + + TRACE("(%p)->(%p %u %p)\n", This, pv, cb, pcbRead); + + if(!This->stream) + return E_FAIL; + + return IStream_Read(This->stream, pv, cb, pcbRead); +} + +static HRESULT WINAPI MkProtocol_Seek(IInternetProtocolEx *iface, LARGE_INTEGER dlibMove, + DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition) +{ + MkProtocol *This = impl_from_IInternetProtocolEx(iface); + FIXME("(%p)->(%d %d %p)\n", This, dlibMove.u.LowPart, dwOrigin, plibNewPosition); + return E_NOTIMPL; +} + +static HRESULT WINAPI MkProtocol_LockRequest(IInternetProtocolEx *iface, DWORD dwOptions) +{ + MkProtocol *This = impl_from_IInternetProtocolEx(iface); + + TRACE("(%p)->(%08x)\n", This, dwOptions); + + return S_OK; +} + +static HRESULT WINAPI MkProtocol_UnlockRequest(IInternetProtocolEx *iface) +{ + MkProtocol *This = impl_from_IInternetProtocolEx(iface); + + TRACE("(%p)\n", This); + + return S_OK; +} + +static HRESULT WINAPI MkProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUri, + IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo, + DWORD grfPI, HANDLE *dwReserved) +{ + MkProtocol *This = impl_from_IInternetProtocolEx(iface); + LPWSTR mime, progid, display_name, colon_ptr; + DWORD path_size = INTERNET_MAX_URL_LENGTH; + DWORD bindf=0, eaten=0, scheme=0, len; + BSTR url, path_tmp, path = NULL; + IParseDisplayName *pdn; + BINDINFO bindinfo; + STATSTG statstg; + IMoniker *mon; + HRESULT hres; + CLSID clsid; + + TRACE("(%p)->(%p %p %p %08x %p)\n", This, pUri, pOIProtSink, + pOIBindInfo, grfPI, dwReserved); + + hres = IUri_GetScheme(pUri, &scheme); + if(FAILED(hres)) + return hres; + if(scheme != URL_SCHEME_MK) return INET_E_INVALID_URL; memset(&bindinfo, 0, sizeof(bindinfo)); @@ -124,35 +234,56 @@ static HRESULT WINAPI MkProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl, IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_SENDINGREQUEST, NULL); - hres = FindMimeFromData(NULL, szUrl, NULL, 0, NULL, 0, &mime, 0); + hres = IUri_GetDisplayUri(pUri, &url); + if(FAILED(hres)) + return hres; + hres = FindMimeFromData(NULL, url, NULL, 0, NULL, 0, &mime, 0); + SysFreeString(url); if(SUCCEEDED(hres)) { IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_MIMETYPEAVAILABLE, mime); CoTaskMemFree(mime); } - ptr2 = szUrl + sizeof(wszMK)/sizeof(WCHAR); - ptr = strchrW(ptr2, ':'); - if(!ptr) - return report_result(pOIProtSink, INET_E_RESOURCE_NOT_FOUND, ERROR_INVALID_PARAMETER); - - progid = heap_alloc((ptr-ptr2+1)*sizeof(WCHAR)); - memcpy(progid, ptr2, (ptr-ptr2)*sizeof(WCHAR)); - progid[ptr-ptr2] = 0; - hres = CLSIDFromProgID(progid, &clsid); - heap_free(progid); + hres = IUri_GetPath(pUri, &path_tmp); if(FAILED(hres)) + return hres; + path = heap_alloc(path_size); + hres = UrlUnescapeW((LPWSTR)path_tmp, path, &path_size, 0); + SysFreeString(path_tmp); + if (FAILED(hres)) + { + heap_free(path); return report_result(pOIProtSink, INET_E_RESOURCE_NOT_FOUND, ERROR_INVALID_PARAMETER); + } + progid = path+1; /* skip '@' symbol */ + colon_ptr = strchrW(path, ':'); + if(!colon_ptr) + { + heap_free(path); + return report_result(pOIProtSink, INET_E_RESOURCE_NOT_FOUND, ERROR_INVALID_PARAMETER); + } + + len = strlenW(path); + display_name = heap_alloc((len+1)*sizeof(WCHAR)); + memcpy(display_name, path, (len+1)*sizeof(WCHAR)); + + progid[colon_ptr-progid] = 0; /* overwrite ':' with NULL terminator */ + hres = CLSIDFromProgID(progid, &clsid); + heap_free(path); + if(FAILED(hres)) + { + heap_free(display_name); + return report_result(pOIProtSink, INET_E_RESOURCE_NOT_FOUND, ERROR_INVALID_PARAMETER); + } hres = CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER, &IID_IParseDisplayName, (void**)&pdn); if(FAILED(hres)) { WARN("Could not create object %s\n", debugstr_guid(&clsid)); + heap_free(display_name); return report_result(pOIProtSink, hres, ERROR_INVALID_PARAMETER); } - len = strlenW(--ptr2); - display_name = heap_alloc((len+1)*sizeof(WCHAR)); - memcpy(display_name, ptr2, (len+1)*sizeof(WCHAR)); hres = IParseDisplayName_ParseDisplayName(pdn, NULL /* FIXME */, display_name, &eaten, &mon); heap_free(display_name); IParseDisplayName_Release(pdn); @@ -182,90 +313,10 @@ static HRESULT WINAPI MkProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl, IInternetProtocolSink_ReportData(pOIProtSink, BSCF_FIRSTDATANOTIFICATION | BSCF_LASTDATANOTIFICATION, statstg.cbSize.u.LowPart, statstg.cbSize.u.LowPart); - return report_result(pOIProtSink, S_OK, ERROR_SUCCESS); } -static HRESULT WINAPI MkProtocol_Continue(IInternetProtocol *iface, PROTOCOLDATA *pProtocolData) -{ - MkProtocol *This = PROTOCOL_THIS(iface); - FIXME("(%p)->(%p)\n", This, pProtocolData); - return E_NOTIMPL; -} - -static HRESULT WINAPI MkProtocol_Abort(IInternetProtocol *iface, HRESULT hrReason, - DWORD dwOptions) -{ - MkProtocol *This = PROTOCOL_THIS(iface); - FIXME("(%p)->(%08x %08x)\n", This, hrReason, dwOptions); - return E_NOTIMPL; -} - -static HRESULT WINAPI MkProtocol_Terminate(IInternetProtocol *iface, DWORD dwOptions) -{ - MkProtocol *This = PROTOCOL_THIS(iface); - - TRACE("(%p)->(%08x)\n", This, dwOptions); - - return S_OK; -} - -static HRESULT WINAPI MkProtocol_Suspend(IInternetProtocol *iface) -{ - MkProtocol *This = PROTOCOL_THIS(iface); - FIXME("(%p)\n", This); - return E_NOTIMPL; -} - -static HRESULT WINAPI MkProtocol_Resume(IInternetProtocol *iface) -{ - MkProtocol *This = PROTOCOL_THIS(iface); - FIXME("(%p)\n", This); - return E_NOTIMPL; -} - -static HRESULT WINAPI MkProtocol_Read(IInternetProtocol *iface, void *pv, - ULONG cb, ULONG *pcbRead) -{ - MkProtocol *This = PROTOCOL_THIS(iface); - - TRACE("(%p)->(%p %u %p)\n", This, pv, cb, pcbRead); - - if(!This->stream) - return E_FAIL; - - return IStream_Read(This->stream, pv, cb, pcbRead); -} - -static HRESULT WINAPI MkProtocol_Seek(IInternetProtocol *iface, LARGE_INTEGER dlibMove, - DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition) -{ - MkProtocol *This = PROTOCOL_THIS(iface); - FIXME("(%p)->(%d %d %p)\n", This, dlibMove.u.LowPart, dwOrigin, plibNewPosition); - return E_NOTIMPL; -} - -static HRESULT WINAPI MkProtocol_LockRequest(IInternetProtocol *iface, DWORD dwOptions) -{ - MkProtocol *This = PROTOCOL_THIS(iface); - - TRACE("(%p)->(%08x)\n", This, dwOptions); - - return S_OK; -} - -static HRESULT WINAPI MkProtocol_UnlockRequest(IInternetProtocol *iface) -{ - MkProtocol *This = PROTOCOL_THIS(iface); - - TRACE("(%p)\n", This); - - return S_OK; -} - -#undef PROTOCOL_THIS - -static const IInternetProtocolVtbl MkProtocolVtbl = { +static const IInternetProtocolExVtbl MkProtocolVtbl = { MkProtocol_QueryInterface, MkProtocol_AddRef, MkProtocol_Release, @@ -278,7 +329,8 @@ static const IInternetProtocolVtbl MkProtocolVtbl = { MkProtocol_Read, MkProtocol_Seek, MkProtocol_LockRequest, - MkProtocol_UnlockRequest + MkProtocol_UnlockRequest, + MkProtocol_StartEx }; HRESULT MkProtocol_Construct(IUnknown *pUnkOuter, LPVOID *ppobj) @@ -291,14 +343,14 @@ HRESULT MkProtocol_Construct(IUnknown *pUnkOuter, LPVOID *ppobj) ret = heap_alloc(sizeof(MkProtocol)); - ret->lpIInternetProtocolVtbl = &MkProtocolVtbl; + ret->IInternetProtocolEx_iface.lpVtbl = &MkProtocolVtbl; ret->ref = 1; ret->stream = NULL; /* NOTE: * Native returns NULL ppobj and S_OK in CreateInstance if called with IID_IUnknown riid. */ - *ppobj = PROTOCOL(ret); + *ppobj = &ret->IInternetProtocolEx_iface; return S_OK; } diff --git a/dll/win32/urlmon/protocol.c b/dll/win32/urlmon/protocol.c index 669343b211f..326564b907c 100644 --- a/dll/win32/urlmon/protocol.c +++ b/dll/win32/urlmon/protocol.c @@ -23,36 +23,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(urlmon); -/* Flags are needed for, among other things, return HRESULTs from the Read function - * to conform to native. For example, Read returns: - * - * 1. E_PENDING if called before the request has completed, - * (flags = 0) - * 2. S_FALSE after all data has been read and S_OK has been reported, - * (flags = FLAG_REQUEST_COMPLETE | FLAG_ALL_DATA_READ | FLAG_RESULT_REPORTED) - * 3. INET_E_DATA_NOT_AVAILABLE if InternetQueryDataAvailable fails. The first time - * this occurs, INET_E_DATA_NOT_AVAILABLE will also be reported to the sink, - * (flags = FLAG_REQUEST_COMPLETE) - * but upon subsequent calls to Read no reporting will take place, yet - * InternetQueryDataAvailable will still be called, and, on failure, - * INET_E_DATA_NOT_AVAILABLE will still be returned. - * (flags = FLAG_REQUEST_COMPLETE | FLAG_RESULT_REPORTED) - * - * FLAG_FIRST_DATA_REPORTED and FLAG_LAST_DATA_REPORTED are needed for proper - * ReportData reporting. For example, if OnResponse returns S_OK, Continue will - * report BSCF_FIRSTDATANOTIFICATION, and when all data has been read Read will - * report BSCF_INTERMEDIATEDATANOTIFICATION|BSCF_LASTDATANOTIFICATION. However, - * if OnResponse does not return S_OK, Continue will not report data, and Read - * will report BSCF_FIRSTDATANOTIFICATION|BSCF_LASTDATANOTIFICATION when all - * data has been read. - */ -#define FLAG_REQUEST_COMPLETE 0x0001 -#define FLAG_FIRST_CONTINUE_COMPLETE 0x0002 -#define FLAG_FIRST_DATA_REPORTED 0x0004 -#define FLAG_ALL_DATA_READ 0x0008 -#define FLAG_LAST_DATA_REPORTED 0x0010 -#define FLAG_RESULT_REPORTED 0x0020 - static inline HRESULT report_progress(Protocol *protocol, ULONG status_code, LPCWSTR status_text) { return IInternetProtocolSink_ReportProgress(protocol->protocol_sink, status_code, status_text); @@ -106,25 +76,27 @@ static void request_complete(Protocol *protocol, INTERNET_ASYNC_RESULT *ar) TRACE("(%p)->(%p)\n", protocol, ar); - if(!ar->dwResult) { - WARN("request failed: %d\n", ar->dwError); - return; - } - - protocol->flags |= FLAG_REQUEST_COMPLETE; - - if(!protocol->request) { - TRACE("setting request handle %p\n", (HINTERNET)ar->dwResult); - protocol->request = (HINTERNET)ar->dwResult; - } - /* PROTOCOLDATA same as native */ memset(&data, 0, sizeof(data)); data.dwState = 0xf1000000; - if(protocol->flags & FLAG_FIRST_CONTINUE_COMPLETE) - data.pData = (LPVOID)BINDSTATUS_ENDDOWNLOADCOMPONENTS; - else - data.pData = (LPVOID)BINDSTATUS_DOWNLOADINGDATA; + + if(ar->dwResult) { + protocol->flags |= FLAG_REQUEST_COMPLETE; + + if(!protocol->request) { + TRACE("setting request handle %p\n", (HINTERNET)ar->dwResult); + protocol->request = (HINTERNET)ar->dwResult; + } + + if(protocol->flags & FLAG_FIRST_CONTINUE_COMPLETE) + data.pData = (LPVOID)BINDSTATUS_ENDDOWNLOADCOMPONENTS; + else + data.pData = (LPVOID)BINDSTATUS_DOWNLOADINGDATA; + + }else { + protocol->flags |= FLAG_ERROR; + data.pData = (LPVOID)ar->dwError; + } if (protocol->bindf & BINDF_FROMURLMON) IInternetProtocolSink_Switch(protocol->protocol_sink, &data); @@ -331,6 +303,12 @@ HRESULT protocol_continue(Protocol *protocol, PROTOCOLDATA *data) return S_OK; } + if(protocol->flags & FLAG_ERROR) { + protocol->flags &= ~FLAG_ERROR; + protocol->vtbl->on_error(protocol, (DWORD)data->pData); + return S_OK; + } + if(protocol->post_stream) return write_post_stream(protocol); @@ -357,7 +335,7 @@ HRESULT protocol_continue(Protocol *protocol, PROTOCOLDATA *data) protocol->flags |= FLAG_FIRST_CONTINUE_COMPLETE; } - if(data->pData >= (LPVOID)BINDSTATUS_DOWNLOADINGDATA) { + if(data->pData >= (LPVOID)BINDSTATUS_DOWNLOADINGDATA && !protocol->available_bytes) { BOOL res; /* InternetQueryDataAvailable may immediately fork and perform its asynchronous @@ -389,33 +367,33 @@ HRESULT protocol_read(Protocol *protocol, void *buf, ULONG size, ULONG *read_ret return S_FALSE; } - if(!(protocol->flags & FLAG_REQUEST_COMPLETE)) { + if(!(protocol->flags & FLAG_REQUEST_COMPLETE) || !protocol->available_bytes) { *read_ret = 0; return E_PENDING; } - while(read < size) { - if(protocol->available_bytes) { - ULONG len; + while(read < size && protocol->available_bytes) { + ULONG len; - res = InternetReadFile(protocol->request, ((BYTE *)buf)+read, - protocol->available_bytes > size-read ? size-read : protocol->available_bytes, &len); - if(!res) { - WARN("InternetReadFile failed: %d\n", GetLastError()); - hres = INET_E_DOWNLOAD_FAILURE; - report_result(protocol, hres); - break; - } + res = InternetReadFile(protocol->request, ((BYTE *)buf)+read, + protocol->available_bytes > size-read ? size-read : protocol->available_bytes, &len); + if(!res) { + WARN("InternetReadFile failed: %d\n", GetLastError()); + hres = INET_E_DOWNLOAD_FAILURE; + report_result(protocol, hres); + break; + } - if(!len) { - all_data_read(protocol); - break; - } + if(!len) { + all_data_read(protocol); + break; + } - read += len; - protocol->current_position += len; - protocol->available_bytes -= len; - }else { + read += len; + protocol->current_position += len; + protocol->available_bytes -= len; + + if(!protocol->available_bytes) { /* InternetQueryDataAvailable may immediately fork and perform its asynchronous * read, so clear the flag _before_ calling so it does not incorrectly get cleared * after the status callback is called */ diff --git a/dll/win32/urlmon/protproxy.c b/dll/win32/urlmon/protproxy.c index c3d64c48221..06a85863b6d 100644 --- a/dll/win32/urlmon/protproxy.c +++ b/dll/win32/urlmon/protproxy.c @@ -21,25 +21,28 @@ WINE_DEFAULT_DEBUG_CHANNEL(urlmon); -#define PROTOCOL_THIS(iface) DEFINE_THIS(ProtocolProxy, IInternetProtocol, iface) +static inline ProtocolProxy *impl_from_IInternetProtocol(IInternetProtocol *iface) +{ + return CONTAINING_RECORD(iface, ProtocolProxy, IInternetProtocol_iface); +} static HRESULT WINAPI ProtocolProxy_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv) { - ProtocolProxy *This = PROTOCOL_THIS(iface); + ProtocolProxy *This = impl_from_IInternetProtocol(iface); *ppv = NULL; if(IsEqualGUID(&IID_IUnknown, riid)) { TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv); - *ppv = PROTOCOL(This); + *ppv = &This->IInternetProtocol_iface; }else if(IsEqualGUID(&IID_IInternetProtocolRoot, riid)) { TRACE("(%p)->(IID_IInternetProtocolRoot %p)\n", This, ppv); - *ppv = PROTOCOL(This); + *ppv = &This->IInternetProtocol_iface; }else if(IsEqualGUID(&IID_IInternetProtocol, riid)) { TRACE("(%p)->(IID_IInternetProtocol %p)\n", This, ppv); - *ppv = PROTOCOL(This); + *ppv = &This->IInternetProtocol_iface; }else if(IsEqualGUID(&IID_IInternetProtocolSink, riid)) { TRACE("(%p)->(IID_IInternetProtocolSink %p)\n", This, ppv); - *ppv = PROTSINK(This); + *ppv = &This->IInternetProtocolSink_iface; } if(*ppv) { @@ -53,7 +56,7 @@ static HRESULT WINAPI ProtocolProxy_QueryInterface(IInternetProtocol *iface, REF static ULONG WINAPI ProtocolProxy_AddRef(IInternetProtocol *iface) { - ProtocolProxy *This = PROTOCOL_THIS(iface); + ProtocolProxy *This = impl_from_IInternetProtocol(iface); LONG ref = InterlockedIncrement(&This->ref); TRACE("(%p) ref=%d\n", This, ref); return ref; @@ -61,7 +64,7 @@ static ULONG WINAPI ProtocolProxy_AddRef(IInternetProtocol *iface) static ULONG WINAPI ProtocolProxy_Release(IInternetProtocol *iface) { - ProtocolProxy *This = PROTOCOL_THIS(iface); + ProtocolProxy *This = impl_from_IInternetProtocol(iface); LONG ref = InterlockedDecrement(&This->ref); TRACE("(%p) ref=%d\n", This, ref); @@ -84,7 +87,7 @@ static HRESULT WINAPI ProtocolProxy_Start(IInternetProtocol *iface, LPCWSTR szUr IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo, DWORD grfPI, HANDLE_PTR dwReserved) { - ProtocolProxy *This = PROTOCOL_THIS(iface); + ProtocolProxy *This = impl_from_IInternetProtocol(iface); TRACE("(%p)->(%s %p %p %08x %lx)\n", This, debugstr_w(szUrl), pOIProtSink, pOIBindInfo, grfPI, dwReserved); @@ -94,7 +97,7 @@ static HRESULT WINAPI ProtocolProxy_Start(IInternetProtocol *iface, LPCWSTR szUr static HRESULT WINAPI ProtocolProxy_Continue(IInternetProtocol *iface, PROTOCOLDATA *pProtocolData) { - ProtocolProxy *This = PROTOCOL_THIS(iface); + ProtocolProxy *This = impl_from_IInternetProtocol(iface); TRACE("(%p)->(%p)\n", This, pProtocolData); @@ -104,14 +107,14 @@ static HRESULT WINAPI ProtocolProxy_Continue(IInternetProtocol *iface, PROTOCOLD static HRESULT WINAPI ProtocolProxy_Abort(IInternetProtocol *iface, HRESULT hrReason, DWORD dwOptions) { - ProtocolProxy *This = PROTOCOL_THIS(iface); + ProtocolProxy *This = impl_from_IInternetProtocol(iface); FIXME("(%p)->(%08x %08x)\n", This, hrReason, dwOptions); return E_NOTIMPL; } static HRESULT WINAPI ProtocolProxy_Terminate(IInternetProtocol *iface, DWORD dwOptions) { - ProtocolProxy *This = PROTOCOL_THIS(iface); + ProtocolProxy *This = impl_from_IInternetProtocol(iface); TRACE("(%p)->(%08x)\n", This, dwOptions); @@ -120,14 +123,14 @@ static HRESULT WINAPI ProtocolProxy_Terminate(IInternetProtocol *iface, DWORD dw static HRESULT WINAPI ProtocolProxy_Suspend(IInternetProtocol *iface) { - ProtocolProxy *This = PROTOCOL_THIS(iface); + ProtocolProxy *This = impl_from_IInternetProtocol(iface); FIXME("(%p)\n", This); return E_NOTIMPL; } static HRESULT WINAPI ProtocolProxy_Resume(IInternetProtocol *iface) { - ProtocolProxy *This = PROTOCOL_THIS(iface); + ProtocolProxy *This = impl_from_IInternetProtocol(iface); FIXME("(%p)\n", This); return E_NOTIMPL; } @@ -135,7 +138,7 @@ static HRESULT WINAPI ProtocolProxy_Resume(IInternetProtocol *iface) static HRESULT WINAPI ProtocolProxy_Read(IInternetProtocol *iface, void *pv, ULONG cb, ULONG *pcbRead) { - ProtocolProxy *This = PROTOCOL_THIS(iface); + ProtocolProxy *This = impl_from_IInternetProtocol(iface); TRACE("(%p)->(%p %u %p)\n", This, pv, cb, pcbRead); @@ -145,14 +148,14 @@ static HRESULT WINAPI ProtocolProxy_Read(IInternetProtocol *iface, void *pv, static HRESULT WINAPI ProtocolProxy_Seek(IInternetProtocol *iface, LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition) { - ProtocolProxy *This = PROTOCOL_THIS(iface); + ProtocolProxy *This = impl_from_IInternetProtocol(iface); FIXME("(%p)->(%d %d %p)\n", This, dlibMove.u.LowPart, dwOrigin, plibNewPosition); return E_NOTIMPL; } static HRESULT WINAPI ProtocolProxy_LockRequest(IInternetProtocol *iface, DWORD dwOptions) { - ProtocolProxy *This = PROTOCOL_THIS(iface); + ProtocolProxy *This = impl_from_IInternetProtocol(iface); TRACE("(%p)->(%08x)\n", This, dwOptions); @@ -161,15 +164,13 @@ static HRESULT WINAPI ProtocolProxy_LockRequest(IInternetProtocol *iface, DWORD static HRESULT WINAPI ProtocolProxy_UnlockRequest(IInternetProtocol *iface) { - ProtocolProxy *This = PROTOCOL_THIS(iface); + ProtocolProxy *This = impl_from_IInternetProtocol(iface); TRACE("(%p)\n", This); return IInternetProtocol_UnlockRequest(This->protocol); } -#undef PROTOCOL_THIS - static const IInternetProtocolVtbl ProtocolProxyVtbl = { ProtocolProxy_QueryInterface, ProtocolProxy_AddRef, @@ -186,31 +187,34 @@ static const IInternetProtocolVtbl ProtocolProxyVtbl = { ProtocolProxy_UnlockRequest }; -#define PROTSINK_THIS(iface) DEFINE_THIS(ProtocolProxy, IInternetProtocolSink, iface) +static inline ProtocolProxy *impl_from_IInternetProtocolSink(IInternetProtocolSink *iface) +{ + return CONTAINING_RECORD(iface, ProtocolProxy, IInternetProtocolSink_iface); +} static HRESULT WINAPI ProtocolProxySink_QueryInterface(IInternetProtocolSink *iface, REFIID riid, void **ppv) { - ProtocolProxy *This = PROTSINK_THIS(iface); - return IInternetProtocol_QueryInterface(PROTOCOL(This), riid, ppv); + ProtocolProxy *This = impl_from_IInternetProtocolSink(iface); + return IInternetProtocol_QueryInterface(&This->IInternetProtocol_iface, riid, ppv); } static ULONG WINAPI ProtocolProxySink_AddRef(IInternetProtocolSink *iface) { - ProtocolProxy *This = PROTSINK_THIS(iface); - return IInternetProtocol_AddRef(PROTOCOL(This)); + ProtocolProxy *This = impl_from_IInternetProtocolSink(iface); + return IInternetProtocol_AddRef(&This->IInternetProtocol_iface); } static ULONG WINAPI ProtocolProxySink_Release(IInternetProtocolSink *iface) { - ProtocolProxy *This = PROTSINK_THIS(iface); - return IInternetProtocol_Release(PROTOCOL(This)); + ProtocolProxy *This = impl_from_IInternetProtocolSink(iface); + return IInternetProtocol_Release(&This->IInternetProtocol_iface); } static HRESULT WINAPI ProtocolProxySink_Switch(IInternetProtocolSink *iface, PROTOCOLDATA *pProtocolData) { - ProtocolProxy *This = PROTSINK_THIS(iface); + ProtocolProxy *This = impl_from_IInternetProtocolSink(iface); TRACE("(%p)->(%p)\n", This, pProtocolData); @@ -220,7 +224,7 @@ static HRESULT WINAPI ProtocolProxySink_Switch(IInternetProtocolSink *iface, static HRESULT WINAPI ProtocolProxySink_ReportProgress(IInternetProtocolSink *iface, ULONG ulStatusCode, LPCWSTR szStatusText) { - ProtocolProxy *This = PROTSINK_THIS(iface); + ProtocolProxy *This = impl_from_IInternetProtocolSink(iface); TRACE("(%p)->(%u %s)\n", This, ulStatusCode, debugstr_w(szStatusText)); @@ -238,7 +242,7 @@ static HRESULT WINAPI ProtocolProxySink_ReportProgress(IInternetProtocolSink *if static HRESULT WINAPI ProtocolProxySink_ReportData(IInternetProtocolSink *iface, DWORD grfBSCF, ULONG ulProgress, ULONG ulProgressMax) { - ProtocolProxy *This = PROTSINK_THIS(iface); + ProtocolProxy *This = impl_from_IInternetProtocolSink(iface); TRACE("(%p)->(%d %u %u)\n", This, grfBSCF, ulProgress, ulProgressMax); @@ -248,15 +252,13 @@ static HRESULT WINAPI ProtocolProxySink_ReportData(IInternetProtocolSink *iface, static HRESULT WINAPI ProtocolProxySink_ReportResult(IInternetProtocolSink *iface, HRESULT hrResult, DWORD dwError, LPCWSTR szResult) { - ProtocolProxy *This = PROTSINK_THIS(iface); + ProtocolProxy *This = impl_from_IInternetProtocolSink(iface); TRACE("(%p)->(%08x %d %s)\n", This, hrResult, dwError, debugstr_w(szResult)); return IInternetProtocolSink_ReportResult(This->protocol_sink, hrResult, dwError, szResult); } -#undef PROTSINK_THIS - static const IInternetProtocolSinkVtbl InternetProtocolSinkVtbl = { ProtocolProxySink_QueryInterface, ProtocolProxySink_AddRef, @@ -275,8 +277,8 @@ HRESULT create_protocol_proxy(IInternetProtocol *protocol, IInternetProtocolSink if(!sink) return E_OUTOFMEMORY; - sink->lpIInternetProtocolVtbl = &ProtocolProxyVtbl; - sink->lpIInternetProtocolSinkVtbl = &InternetProtocolSinkVtbl; + sink->IInternetProtocol_iface.lpVtbl = &ProtocolProxyVtbl; + sink->IInternetProtocolSink_iface.lpVtbl = &InternetProtocolSinkVtbl; sink->ref = 1; IInternetProtocol_AddRef(protocol); diff --git a/dll/win32/urlmon/regsvr.c b/dll/win32/urlmon/regsvr.c deleted file mode 100644 index 6e417ac9607..00000000000 --- a/dll/win32/urlmon/regsvr.c +++ /dev/null @@ -1,609 +0,0 @@ -/* - * self-registerable dll functions for urlmon.dll - * - * Copyright (C) 2003 John K. Hohm - * - * 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 - -#include "urlmon_main.h" - -#include "winreg.h" -#include "advpub.h" - -#include "wine/debug.h" -#include "wine/unicode.h" - -WINE_DEFAULT_DEBUG_CHANNEL(urlmon); - -/* - * Near the bottom of this file are the exported DllRegisterServer and - * DllUnregisterServer, which make all this worthwhile. - */ - -/*********************************************************************** - * interface for self-registering - */ -struct regsvr_interface -{ - IID const *iid; /* NULL for end of list */ - LPCSTR name; /* can be NULL to omit */ - IID const *base_iid; /* can be NULL to omit */ - int num_methods; /* can be <0 to omit */ - CLSID const *ps_clsid; /* can be NULL to omit */ - CLSID const *ps_clsid32; /* can be NULL to omit */ -}; - -static HRESULT register_interfaces(struct regsvr_interface const *list); -static HRESULT unregister_interfaces(struct regsvr_interface const *list); - -struct regsvr_coclass -{ - CLSID const *clsid; /* NULL for end of list */ - LPCSTR name; /* can be NULL to omit */ - LPCSTR ips; /* can be NULL to omit */ - LPCSTR ips32; /* can be NULL to omit */ - LPCSTR ips32_tmodel; /* can be NULL to omit */ - LPCSTR progid; /* can be NULL to omit */ - LPCSTR viprogid; /* can be NULL to omit */ - LPCSTR progid_extra; /* can be NULL to omit */ -}; - -static HRESULT register_coclasses(struct regsvr_coclass const *list); -static HRESULT unregister_coclasses(struct regsvr_coclass const *list); - -/*********************************************************************** - * static string constants - */ -static WCHAR const interface_keyname[10] = { - 'I', 'n', 't', 'e', 'r', 'f', 'a', 'c', 'e', 0 }; -static WCHAR const base_ifa_keyname[14] = { - 'B', 'a', 's', 'e', 'I', 'n', 't', 'e', 'r', 'f', 'a', 'c', - 'e', 0 }; -static WCHAR const num_methods_keyname[11] = { - 'N', 'u', 'm', 'M', 'e', 't', 'h', 'o', 'd', 's', 0 }; -static WCHAR const ps_clsid_keyname[15] = { - 'P', 'r', 'o', 'x', 'y', 'S', 't', 'u', 'b', 'C', 'l', 's', - 'i', 'd', 0 }; -static WCHAR const ps_clsid32_keyname[17] = { - 'P', 'r', 'o', 'x', 'y', 'S', 't', 'u', 'b', 'C', 'l', 's', - 'i', 'd', '3', '2', 0 }; -static WCHAR const clsid_keyname[6] = { - 'C', 'L', 'S', 'I', 'D', 0 }; -static WCHAR const curver_keyname[7] = { - 'C', 'u', 'r', 'V', 'e', 'r', 0 }; -static WCHAR const ips_keyname[13] = { - 'I', 'n', 'P', 'r', 'o', 'c', 'S', 'e', 'r', 'v', 'e', 'r', - 0 }; -static WCHAR const ips32_keyname[15] = { - 'I', 'n', 'P', 'r', 'o', 'c', 'S', 'e', 'r', 'v', 'e', 'r', - '3', '2', 0 }; -static WCHAR const progid_keyname[7] = { - 'P', 'r', 'o', 'g', 'I', 'D', 0 }; -static WCHAR const viprogid_keyname[25] = { - 'V', 'e', 'r', 's', 'i', 'o', 'n', 'I', 'n', 'd', 'e', 'p', - 'e', 'n', 'd', 'e', 'n', 't', 'P', 'r', 'o', 'g', 'I', 'D', - 0 }; -static char const tmodel_valuename[] = "ThreadingModel"; - -/*********************************************************************** - * static helper functions - */ -static LONG register_key_guid(HKEY base, WCHAR const *name, GUID const *guid); -static LONG register_key_defvalueW(HKEY base, WCHAR const *name, - WCHAR const *value); -static LONG register_key_defvalueA(HKEY base, WCHAR const *name, - char const *value); -static LONG register_progid(WCHAR const *clsid, - char const *progid, char const *curver_progid, - char const *name, char const *extra); - -/*********************************************************************** - * register_interfaces - */ -static HRESULT register_interfaces(struct regsvr_interface const *list) -{ - LONG res = ERROR_SUCCESS; - HKEY interface_key; - - res = RegCreateKeyExW(HKEY_CLASSES_ROOT, interface_keyname, 0, NULL, 0, - KEY_READ | KEY_WRITE, NULL, &interface_key, NULL); - if (res != ERROR_SUCCESS) goto error_return; - - for (; res == ERROR_SUCCESS && list->iid; ++list) { - WCHAR buf[39]; - HKEY iid_key; - - StringFromGUID2(list->iid, buf, 39); - res = RegCreateKeyExW(interface_key, buf, 0, NULL, 0, - KEY_READ | KEY_WRITE, NULL, &iid_key, NULL); - if (res != ERROR_SUCCESS) goto error_close_interface_key; - - if (list->name) { - res = RegSetValueExA(iid_key, NULL, 0, REG_SZ, - (CONST BYTE*)(list->name), - strlen(list->name) + 1); - if (res != ERROR_SUCCESS) goto error_close_iid_key; - } - - if (list->base_iid) { - res = register_key_guid(iid_key, base_ifa_keyname, list->base_iid); - if (res != ERROR_SUCCESS) goto error_close_iid_key; - } - - if (0 <= list->num_methods) { - static WCHAR const fmt[3] = { '%', 'd', 0 }; - HKEY key; - - res = RegCreateKeyExW(iid_key, num_methods_keyname, 0, NULL, 0, - KEY_READ | KEY_WRITE, NULL, &key, NULL); - if (res != ERROR_SUCCESS) goto error_close_iid_key; - - sprintfW(buf, fmt, list->num_methods); - res = RegSetValueExW(key, NULL, 0, REG_SZ, - (CONST BYTE*)buf, - (lstrlenW(buf) + 1) * sizeof(WCHAR)); - RegCloseKey(key); - - if (res != ERROR_SUCCESS) goto error_close_iid_key; - } - - if (list->ps_clsid) { - res = register_key_guid(iid_key, ps_clsid_keyname, list->ps_clsid); - if (res != ERROR_SUCCESS) goto error_close_iid_key; - } - - if (list->ps_clsid32) { - res = register_key_guid(iid_key, ps_clsid32_keyname, list->ps_clsid32); - if (res != ERROR_SUCCESS) goto error_close_iid_key; - } - - error_close_iid_key: - RegCloseKey(iid_key); - } - -error_close_interface_key: - RegCloseKey(interface_key); -error_return: - return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK; -} - -/*********************************************************************** - * unregister_interfaces - */ -static HRESULT unregister_interfaces(struct regsvr_interface const *list) -{ - LONG res = ERROR_SUCCESS; - HKEY interface_key; - - res = RegOpenKeyExW(HKEY_CLASSES_ROOT, interface_keyname, 0, - KEY_READ | KEY_WRITE, &interface_key); - if (res == ERROR_FILE_NOT_FOUND) return S_OK; - if (res != ERROR_SUCCESS) goto error_return; - - for (; res == ERROR_SUCCESS && list->iid; ++list) { - WCHAR buf[39]; - - StringFromGUID2(list->iid, buf, 39); - res = RegDeleteTreeW(interface_key, buf); - if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS; - } - - RegCloseKey(interface_key); -error_return: - return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK; -} - -/*********************************************************************** - * register_coclasses - */ -static HRESULT register_coclasses(struct regsvr_coclass const *list) -{ - LONG res = ERROR_SUCCESS; - HKEY coclass_key; - - res = RegCreateKeyExW(HKEY_CLASSES_ROOT, clsid_keyname, 0, NULL, 0, - KEY_READ | KEY_WRITE, NULL, &coclass_key, NULL); - if (res != ERROR_SUCCESS) goto error_return; - - for (; res == ERROR_SUCCESS && list->clsid; ++list) { - WCHAR buf[39]; - HKEY clsid_key; - - StringFromGUID2(list->clsid, buf, 39); - res = RegCreateKeyExW(coclass_key, buf, 0, NULL, 0, - KEY_READ | KEY_WRITE, NULL, &clsid_key, NULL); - if (res != ERROR_SUCCESS) goto error_close_coclass_key; - - if (list->name) { - res = RegSetValueExA(clsid_key, NULL, 0, REG_SZ, - (CONST BYTE*)(list->name), - strlen(list->name) + 1); - if (res != ERROR_SUCCESS) goto error_close_clsid_key; - } - - if (list->ips) { - res = register_key_defvalueA(clsid_key, ips_keyname, list->ips); - if (res != ERROR_SUCCESS) goto error_close_clsid_key; - } - - if (list->ips32) { - HKEY ips32_key; - - res = RegCreateKeyExW(clsid_key, ips32_keyname, 0, NULL, 0, - KEY_READ | KEY_WRITE, NULL, - &ips32_key, NULL); - if (res != ERROR_SUCCESS) goto error_close_clsid_key; - - res = RegSetValueExA(ips32_key, NULL, 0, REG_SZ, - (CONST BYTE*)list->ips32, - lstrlenA(list->ips32) + 1); - if (res == ERROR_SUCCESS && list->ips32_tmodel) - res = RegSetValueExA(ips32_key, tmodel_valuename, 0, REG_SZ, - (CONST BYTE*)list->ips32_tmodel, - strlen(list->ips32_tmodel) + 1); - RegCloseKey(ips32_key); - if (res != ERROR_SUCCESS) goto error_close_clsid_key; - } - - if (list->progid) { - res = register_key_defvalueA(clsid_key, progid_keyname, - list->progid); - if (res != ERROR_SUCCESS) goto error_close_clsid_key; - - res = register_progid(buf, list->progid, NULL, - list->name, list->progid_extra); - if (res != ERROR_SUCCESS) goto error_close_clsid_key; - } - - if (list->viprogid) { - res = register_key_defvalueA(clsid_key, viprogid_keyname, - list->viprogid); - if (res != ERROR_SUCCESS) goto error_close_clsid_key; - - res = register_progid(buf, list->viprogid, list->progid, - list->name, list->progid_extra); - if (res != ERROR_SUCCESS) goto error_close_clsid_key; - } - - error_close_clsid_key: - RegCloseKey(clsid_key); - } - -error_close_coclass_key: - RegCloseKey(coclass_key); -error_return: - return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK; -} - -/*********************************************************************** - * unregister_coclasses - */ -static HRESULT unregister_coclasses(struct regsvr_coclass const *list) -{ - LONG res = ERROR_SUCCESS; - HKEY coclass_key; - - res = RegOpenKeyExW(HKEY_CLASSES_ROOT, clsid_keyname, 0, - KEY_READ | KEY_WRITE, &coclass_key); - if (res == ERROR_FILE_NOT_FOUND) return S_OK; - if (res != ERROR_SUCCESS) goto error_return; - - for (; res == ERROR_SUCCESS && list->clsid; ++list) { - WCHAR buf[39]; - - StringFromGUID2(list->clsid, buf, 39); - res = RegDeleteTreeW(coclass_key, buf); - if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS; - if (res != ERROR_SUCCESS) goto error_close_coclass_key; - - if (list->progid) { - res = RegDeleteTreeA(HKEY_CLASSES_ROOT, list->progid); - if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS; - if (res != ERROR_SUCCESS) goto error_close_coclass_key; - } - - if (list->viprogid) { - res = RegDeleteTreeA(HKEY_CLASSES_ROOT, list->viprogid); - if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS; - if (res != ERROR_SUCCESS) goto error_close_coclass_key; - } - } - -error_close_coclass_key: - RegCloseKey(coclass_key); -error_return: - return res != ERROR_SUCCESS ? HRESULT_FROM_WIN32(res) : S_OK; -} - -/*********************************************************************** - * regsvr_key_guid - */ -static LONG register_key_guid(HKEY base, WCHAR const *name, GUID const *guid) -{ - WCHAR buf[39]; - - StringFromGUID2(guid, buf, 39); - return register_key_defvalueW(base, name, buf); -} - -/*********************************************************************** - * regsvr_key_defvalueW - */ -static LONG register_key_defvalueW( - HKEY base, - WCHAR const *name, - WCHAR const *value) -{ - LONG res; - HKEY key; - - res = RegCreateKeyExW(base, name, 0, NULL, 0, - KEY_READ | KEY_WRITE, NULL, &key, NULL); - if (res != ERROR_SUCCESS) return res; - res = RegSetValueExW(key, NULL, 0, REG_SZ, (CONST BYTE*)value, - (lstrlenW(value) + 1) * sizeof(WCHAR)); - RegCloseKey(key); - return res; -} - -/*********************************************************************** - * regsvr_key_defvalueA - */ -static LONG register_key_defvalueA( - HKEY base, - WCHAR const *name, - char const *value) -{ - LONG res; - HKEY key; - - res = RegCreateKeyExW(base, name, 0, NULL, 0, - KEY_READ | KEY_WRITE, NULL, &key, NULL); - if (res != ERROR_SUCCESS) return res; - res = RegSetValueExA(key, NULL, 0, REG_SZ, (CONST BYTE*)value, - lstrlenA(value) + 1); - RegCloseKey(key); - return res; -} - -/*********************************************************************** - * regsvr_progid - */ -static LONG register_progid( - WCHAR const *clsid, - char const *progid, - char const *curver_progid, - char const *name, - char const *extra) -{ - LONG res; - HKEY progid_key; - - res = RegCreateKeyExA(HKEY_CLASSES_ROOT, progid, 0, - NULL, 0, KEY_READ | KEY_WRITE, NULL, - &progid_key, NULL); - if (res != ERROR_SUCCESS) return res; - - if (name) { - res = RegSetValueExA(progid_key, NULL, 0, REG_SZ, - (CONST BYTE*)name, strlen(name) + 1); - if (res != ERROR_SUCCESS) goto error_close_progid_key; - } - - if (clsid) { - res = register_key_defvalueW(progid_key, clsid_keyname, clsid); - if (res != ERROR_SUCCESS) goto error_close_progid_key; - } - - if (curver_progid) { - res = register_key_defvalueA(progid_key, curver_keyname, - curver_progid); - if (res != ERROR_SUCCESS) goto error_close_progid_key; - } - - if (extra) { - HKEY extra_key; - - res = RegCreateKeyExA(progid_key, extra, 0, - NULL, 0, KEY_READ | KEY_WRITE, NULL, - &extra_key, NULL); - if (res == ERROR_SUCCESS) - RegCloseKey(extra_key); - } - -error_close_progid_key: - RegCloseKey(progid_key); - return res; -} - -/*********************************************************************** - * coclass list - */ -static struct regsvr_coclass const coclass_list[] = { - { &CLSID_StdURLMoniker, - "URL Moniker", - NULL, - "urlmon.dll", - "Apartment" - }, - { &CLSID_CdlProtocol, - "CDL: Asynchronous Pluggable Protocol Handler", - NULL, - "urlmon.dll", - "Apartment" - }, - { &CLSID_FileProtocol, - "file:, local: Asynchronous Pluggable Protocol Handler", - NULL, - "urlmon.dll", - "Apartment" - }, - { &CLSID_FtpProtocol, - "ftp: Asynchronous Pluggable Protocol Handler", - NULL, - "urlmon.dll", - "Apartment" - }, - { &CLSID_GopherProtocol, - "gopher: Asynchronous Pluggable Protocol Handler", - NULL, - "urlmon.dll", - "Apartment" - }, - { &CLSID_HttpProtocol, - "http: Asynchronous Pluggable Protocol Handler", - NULL, - "urlmon.dll", - "Apartment" - }, - { &CLSID_HttpSProtocol, - "https: Asynchronous Pluggable Protocol Handler", - NULL, - "urlmon.dll", - "Apartment" - }, - { &CLSID_MkProtocol, - "mk: Asynchronous Pluggable Protocol Handler", - NULL, - "urlmon.dll", - "Apartment" - }, - { &CLSID_InternetSecurityManager, - "Security Manager", - NULL, - "urlmon.dll", - "Both" - }, - { &CLSID_InternetZoneManager, - "URL Zone Manager", - NULL, - "urlmon.dll", - "Both" - }, - { &CLSID_PSFactoryBuffer, - "URLMoniker ProxyStub Factory", - NULL, - "urlmon.dll", - "Apartment" - }, - { NULL } /* list terminator */ -}; - -/*********************************************************************** - * interface list - */ - -static struct regsvr_interface const interface_list[] = { - { NULL } /* list terminator */ -}; - -/*********************************************************************** - * register_inf - */ - -#define INF_SET_CLSID(clsid) \ - do \ - { \ - static CHAR name[] = #clsid; \ - \ - pse[i].pszName = name; \ - clsids[i++] = &clsid; \ - } while (0) - -static HRESULT register_inf(BOOL doregister) -{ - HRESULT hres; - HMODULE hAdvpack; - HRESULT (WINAPI *pRegInstall)(HMODULE hm, LPCSTR pszSection, const STRTABLEA* pstTable); - STRTABLEA strtable; - STRENTRYA pse[8]; - static CLSID const *clsids[8]; - unsigned int i = 0; - - static const WCHAR wszAdvpack[] = {'a','d','v','p','a','c','k','.','d','l','l',0}; - - INF_SET_CLSID(CLSID_CdlProtocol); - INF_SET_CLSID(CLSID_FileProtocol); - INF_SET_CLSID(CLSID_FtpProtocol); - INF_SET_CLSID(CLSID_GopherProtocol); - INF_SET_CLSID(CLSID_HttpProtocol); - INF_SET_CLSID(CLSID_HttpSProtocol); - INF_SET_CLSID(CLSID_MkProtocol); - INF_SET_CLSID(CLSID_DeCompMimeFilter); - - for(i = 0; i < sizeof(pse)/sizeof(pse[0]); i++) { - pse[i].pszValue = heap_alloc(39); - sprintf(pse[i].pszValue, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}", - clsids[i]->Data1, clsids[i]->Data2, clsids[i]->Data3, clsids[i]->Data4[0], - clsids[i]->Data4[1], clsids[i]->Data4[2], clsids[i]->Data4[3], clsids[i]->Data4[4], - clsids[i]->Data4[5], clsids[i]->Data4[6], clsids[i]->Data4[7]); - } - - strtable.cEntries = sizeof(pse)/sizeof(pse[0]); - strtable.pse = pse; - - hAdvpack = LoadLibraryW(wszAdvpack); - pRegInstall = (void *)GetProcAddress(hAdvpack, "RegInstall"); - - hres = pRegInstall(hProxyDll, doregister ? "RegisterDll" : "UnregisterDll", &strtable); - - for(i=0; i < sizeof(pse)/sizeof(pse[0]); i++) - heap_free(pse[i].pszValue); - - return hres; -} - -#undef INF_SET_CLSID - -/*********************************************************************** - * DllRegisterServer (URLMON.@) - */ -HRESULT WINAPI DllRegisterServer(void) -{ - HRESULT hr; - - TRACE("\n"); - - hr = URLMON_DllRegisterServer(); - if(SUCCEEDED(hr)) - hr = register_coclasses(coclass_list); - if(SUCCEEDED(hr)) - hr = register_interfaces(interface_list); - if(SUCCEEDED(hr)) - hr = register_inf(TRUE); - return hr; -} - -/*********************************************************************** - * DllUnregisterServer (URLMON.@) - */ -HRESULT WINAPI DllUnregisterServer(void) -{ - HRESULT hr; - - TRACE("\n"); - - hr = URLMON_DllUnregisterServer(); - if(SUCCEEDED(hr)) - hr = unregister_coclasses(coclass_list); - if(SUCCEEDED(hr)) - hr = unregister_interfaces(interface_list); - if(SUCCEEDED(hr)) - hr = register_inf(FALSE); - return hr; -} diff --git a/dll/win32/urlmon/rsrc.rc b/dll/win32/urlmon/rsrc.rc index c87ea81998c..c86575d228d 100644 --- a/dll/win32/urlmon/rsrc.rc +++ b/dll/win32/urlmon/rsrc.rc @@ -16,6 +16,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +/* @makedep: urlmon.rgs */ +1 WINE_REGISTRY urlmon.rgs + /* @makedep: urlmon.inf */ REGINST REGINST urlmon.inf diff --git a/dll/win32/urlmon/sec_mgr.c b/dll/win32/urlmon/sec_mgr.c index 6b12a9aabaa..7b4bb35dc2a 100644 --- a/dll/win32/urlmon/sec_mgr.c +++ b/dll/win32/urlmon/sec_mgr.c @@ -4,6 +4,7 @@ * Copyright (c) 2004 Huw D M Davies * Copyright 2004 Jacek Caban * Copyright 2009 Detlef Riekenberg + * Copyright 2011 Thomas Mullaly for CodeWeavers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -26,6 +27,9 @@ #include "winreg.h" #include "wininet.h" +#define NO_SHLWAPI_REG +#include "shlwapi.h" + #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(urlmon); @@ -45,6 +49,13 @@ static const WCHAR wszZonesKey[] = {'S','o','f','t','w','a','r','e','\\', 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\', 'I','n','t','e','r','n','e','t',' ','S','e','t','t','i','n','g','s','\\', 'Z','o','n','e','s','\\',0}; +static const WCHAR wszZoneMapDomainsKey[] = {'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','\\', + 'I','n','t','e','r','n','e','t',' ','S','e','t','t','i','n','g','s','\\', + 'Z','o','n','e','M','a','p','\\', + 'D','o','m','a','i','n','s',0}; /******************************************************************** * get_string_from_reg [internal] @@ -140,6 +151,350 @@ static HRESULT get_zone_from_reg(LPCWSTR schema, DWORD *zone) return S_OK; } +/******************************************************************** + * matches_domain_pattern [internal] + * + * Checks if the given string matches the specified domain pattern. + * + * This function looks for explicit wildcard domain components iff + * they appear at the very beginning of the 'pattern' string + * + * pattern = "*.google.com" + */ +static BOOL matches_domain_pattern(LPCWSTR pattern, LPCWSTR str, BOOL implicit_wildcard, LPCWSTR *matched) +{ + BOOL matches = FALSE; + DWORD pattern_len = strlenW(pattern); + DWORD str_len = strlenW(str); + + TRACE("(%d) Checking if %s matches %s\n", implicit_wildcard, debugstr_w(str), debugstr_w(pattern)); + + *matched = NULL; + if(str_len >= pattern_len) { + /* Check if there's an explicit wildcard in the pattern. */ + if(pattern[0] == '*' && pattern[1] == '.') { + /* Make sure that 'str' matches the wildcard pattern. + * + * Example: + * pattern = "*.google.com" + * + * So in this case 'str' would have to end with ".google.com" in order + * to map to this pattern. + */ + if(str_len >= pattern_len+1 && !strcmpiW(str+(str_len-pattern_len+1), pattern+1)) { + /* Check if there's another '.' inside of the "unmatched" portion + * of 'str'. + * + * Example: + * pattern = "*.google.com" + * str = "test.testing.google.com" + * + * The currently matched portion is ".google.com" in 'str', we need + * see if there's a '.' inside of the unmatched portion ("test.testing"), because + * if there is and 'implicit_wildcard' isn't set, then this isn't + * a match. + */ + const WCHAR *ptr; + if(str_len > pattern_len+1 && (ptr = memrchrW(str, '.', str_len-pattern_len-2))) { + if(implicit_wildcard) { + matches = TRUE; + *matched = ptr+1; + } + } else { + matches = TRUE; + *matched = str; + } + } + } else if(implicit_wildcard && str_len > pattern_len) { + /* When the pattern has an implicit wildcard component, it means + * that anything goes in 'str' as long as it ends with the pattern + * and that the beginning of the match has a '.' before it. + * + * Example: + * pattern = "google.com" + * str = "www.google.com" + * + * Implicitly matches the pattern, where as: + * + * pattern = "google.com" + * str = "wwwgoogle.com" + * + * Doesn't match the pattern. + */ + if(str_len > pattern_len) { + if(str[str_len-pattern_len-1] == '.' && !strcmpiW(str+(str_len-pattern_len), pattern)) { + matches = TRUE; + *matched = str+(str_len-pattern_len); + } + } + } else { + /* The pattern doesn't have an implicit wildcard, or an explicit wildcard, + * so 'str' has to be an exact match to the 'pattern'. + */ + if(!strcmpiW(str, pattern)) { + matches = TRUE; + *matched = str; + } + } + } + + if(matches) + TRACE("Found a match: matched=%s\n", debugstr_w(*matched)); + else + TRACE("No match found\n"); + + return matches; +} + +static BOOL get_zone_for_scheme(HKEY key, LPCWSTR schema, DWORD *zone) +{ + static const WCHAR wildcardW[] = {'*',0}; + + DWORD res; + DWORD size = sizeof(DWORD); + DWORD type; + + /* See if the key contains a value for the scheme first. */ + res = RegQueryValueExW(key, schema, NULL, &type, (BYTE*)zone, &size); + if(type != REG_DWORD) + WARN("Unexpected value type %d for value %s, expected REG_DWORD\n", type, debugstr_w(schema)); + + if(res != ERROR_SUCCESS || type != REG_DWORD) { + /* Try to get the zone for the wildcard scheme. */ + size = sizeof(DWORD); + res = RegQueryValueExW(key, wildcardW, NULL, &type, (BYTE*)zone, &size); + if(type != REG_DWORD) + WARN("Unexpected value type %d for value %s, expected REG_DWORD\n", type, debugstr_w(wildcardW)); + } + + return res == ERROR_SUCCESS && type == REG_DWORD; +} + +/******************************************************************** + * search_domain_for_zone [internal] + * + * Searches the specified 'domain' registry key to see if 'host' maps into it, or any + * of it's subdomain registry keys. + * + * Returns S_OK if a match is found, S_FALSE if no matches were found, or an error code. + */ +static HRESULT search_domain_for_zone(HKEY domains, LPCWSTR domain, DWORD domain_len, LPCWSTR schema, + LPCWSTR host, DWORD host_len, DWORD *zone) +{ + BOOL found = FALSE; + HKEY domain_key; + DWORD res; + LPCWSTR matched; + + if(host_len >= domain_len && matches_domain_pattern(domain, host, TRUE, &matched)) { + res = RegOpenKeyW(domains, domain, &domain_key); + if(res != ERROR_SUCCESS) { + ERR("Failed to open domain key %s: %d\n", debugstr_w(domain), res); + return E_UNEXPECTED; + } + + if(matched == host) + found = get_zone_for_scheme(domain_key, schema, zone); + else { + INT domain_offset; + DWORD subdomain_count, subdomain_len; + BOOL check_domain = TRUE; + + find_domain_name(domain, domain_len, &domain_offset); + + res = RegQueryInfoKeyW(domain_key, NULL, NULL, NULL, &subdomain_count, &subdomain_len, + NULL, NULL, NULL, NULL, NULL, NULL); + if(res != ERROR_SUCCESS) { + ERR("Unable to query info for key %s: %d\n", debugstr_w(domain), res); + RegCloseKey(domain_key); + return E_UNEXPECTED; + } + + if(subdomain_count) { + WCHAR *subdomain; + WCHAR *component; + DWORD i; + + subdomain = heap_alloc((subdomain_len+1)*sizeof(WCHAR)); + if(!subdomain) { + RegCloseKey(domain_key); + return E_OUTOFMEMORY; + } + + component = heap_strndupW(host, matched-host-1); + if(!component) { + heap_free(subdomain); + RegCloseKey(domain_key); + return E_OUTOFMEMORY; + } + + for(i = 0; i < subdomain_count; ++i) { + DWORD len = subdomain_len+1; + const WCHAR *sub_matched; + + res = RegEnumKeyExW(domain_key, i, subdomain, &len, NULL, NULL, NULL, NULL); + if(res != ERROR_SUCCESS) { + heap_free(component); + heap_free(subdomain); + RegCloseKey(domain_key); + return E_UNEXPECTED; + } + + if(matches_domain_pattern(subdomain, component, FALSE, &sub_matched)) { + HKEY subdomain_key; + + res = RegOpenKeyW(domain_key, subdomain, &subdomain_key); + if(res != ERROR_SUCCESS) { + ERR("Unable to open subdomain key %s of %s: %d\n", debugstr_w(subdomain), + debugstr_w(domain), res); + heap_free(component); + heap_free(subdomain); + RegCloseKey(domain_key); + return E_UNEXPECTED; + } + + found = get_zone_for_scheme(subdomain_key, schema, zone); + check_domain = FALSE; + RegCloseKey(subdomain_key); + break; + } + } + heap_free(subdomain); + heap_free(component); + } + + /* There's a chance that 'host' implicitly mapped into 'domain', in + * which case we check to see if 'domain' contains zone information. + * + * This can only happen if 'domain' is it's own domain name. + * Example: + * "google.com" (domain name = "google.com") + * + * So if: + * host = "www.google.com" + * + * Then host would map directly into the "google.com" domain key. + * + * If 'domain' has more than just it's domain name, or it does not + * have a domain name, then we don't perform the check. The reason + * for this is that these domains don't allow implicit mappings. + * Example: + * domain = "org" (has no domain name) + * host = "www.org" + * + * The mapping would only happen if the "org" key had an explicit subkey + * called "www". + */ + if(check_domain && !domain_offset && !strchrW(host, matched-host-1)) + found = get_zone_for_scheme(domain_key, schema, zone); + } + RegCloseKey(domain_key); + } + + return found ? S_OK : S_FALSE; +} + +static HRESULT search_for_domain_mapping(HKEY domains, LPCWSTR schema, LPCWSTR host, DWORD host_len, DWORD *zone) +{ + WCHAR *domain; + DWORD domain_count, domain_len, i; + DWORD res; + HRESULT hres = S_FALSE; + + res = RegQueryInfoKeyW(domains, NULL, NULL, NULL, &domain_count, &domain_len, + NULL, NULL, NULL, NULL, NULL, NULL); + if(res != ERROR_SUCCESS) { + WARN("Failed to retrieve information about key\n"); + return E_UNEXPECTED; + } + + if(!domain_count) + return S_FALSE; + + domain = heap_alloc((domain_len+1)*sizeof(WCHAR)); + if(!domain) + return E_OUTOFMEMORY; + + for(i = 0; i < domain_count; ++i) { + DWORD len = domain_len+1; + + res = RegEnumKeyExW(domains, i, domain, &len, NULL, NULL, NULL, NULL); + if(res != ERROR_SUCCESS) { + heap_free(domain); + return E_UNEXPECTED; + } + + hres = search_domain_for_zone(domains, domain, len, schema, host, host_len, zone); + if(FAILED(hres) || hres == S_OK) + break; + } + + heap_free(domain); + return hres; +} + +static HRESULT get_zone_from_domains(LPCWSTR url, LPCWSTR schema, DWORD *zone) +{ + HRESULT hres; + WCHAR *host_name; + DWORD host_len = lstrlenW(url)+1; + DWORD res; + HKEY domains; + + host_name = heap_alloc(host_len*sizeof(WCHAR)); + if(!host_name) + return E_OUTOFMEMORY; + + hres = CoInternetParseUrl(url, PARSE_DOMAIN, 0, host_name, host_len, &host_len, 0); + if(hres == S_FALSE) { + WCHAR *tmp = heap_realloc(host_name, (host_len+1)*sizeof(WCHAR)); + if(!tmp) { + heap_free(host_name); + return E_OUTOFMEMORY; + } + + host_name = tmp; + hres = CoInternetParseUrl(url, PARSE_DOMAIN, 0, host_name, host_len+1, &host_len, 0); + } + + /* Windows doesn't play nice with unknown scheme types when it tries + * to check if a host name maps into any domains. + * + * The reason is with how CoInternetParseUrl handles unknown scheme types + * when it's parsing the domain of a URL (IE it always returns E_FAIL). + * + * Windows doesn't compenstate for this and simply doesn't check if + * the URL maps into any domains. + */ + if(hres != S_OK) { + heap_free(host_name); + if(hres == E_FAIL) + return S_FALSE; + return hres; + } + + /* First try CURRENT_USER. */ + res = RegOpenKeyW(HKEY_CURRENT_USER, wszZoneMapDomainsKey, &domains); + if(res == ERROR_SUCCESS) { + hres = search_for_domain_mapping(domains, schema, host_name, host_len, zone); + RegCloseKey(domains); + } else + WARN("Failed to open HKCU's %s key\n", debugstr_w(wszZoneMapDomainsKey)); + + /* If that doesn't work try LOCAL_MACHINE. */ + if(hres == S_FALSE) { + res = RegOpenKeyW(HKEY_LOCAL_MACHINE, wszZoneMapDomainsKey, &domains); + if(res == ERROR_SUCCESS) { + hres = search_for_domain_mapping(domains, schema, host_name, host_len, zone); + RegCloseKey(domains); + } else + WARN("Failed to open HKLM's %s key\n", debugstr_w(wszZoneMapDomainsKey)); + } + + heap_free(host_name); + return hres; +} + static HRESULT map_url_to_zone(LPCWSTR url, DWORD *zone, LPWSTR *ret_url) { LPWSTR secur_url; @@ -147,7 +502,7 @@ static HRESULT map_url_to_zone(LPCWSTR url, DWORD *zone, LPWSTR *ret_url) DWORD size=0; HRESULT hres; - *zone = -1; + *zone = URLZONE_INVALID; hres = CoInternetGetSecurityUrl(url, &secur_url, PSU_SECURITY_URL_ONLY, 0); if(hres != S_OK) { @@ -190,11 +545,11 @@ static HRESULT map_url_to_zone(LPCWSTR url, DWORD *zone, LPWSTR *ret_url) case DRIVE_FIXED: case DRIVE_CDROM: case DRIVE_RAMDISK: - *zone = 0; + *zone = URLZONE_LOCAL_MACHINE; hres = S_OK; break; case DRIVE_REMOTE: - *zone = 3; + *zone = URLZONE_INTERNET; hres = S_OK; break; default: @@ -203,9 +558,10 @@ static HRESULT map_url_to_zone(LPCWSTR url, DWORD *zone, LPWSTR *ret_url) } } - if(*zone == -1) { - WARN("domains are not yet implemented\n"); - hres = get_zone_from_reg(schema, zone); + if(*zone == URLZONE_INVALID) { + hres = get_zone_from_domains(secur_url, schema, zone); + if(hres == S_FALSE) + hres = get_zone_from_reg(schema, zone); } if(FAILED(hres) || !ret_url) @@ -218,9 +574,9 @@ static HRESULT map_url_to_zone(LPCWSTR url, DWORD *zone, LPWSTR *ret_url) static HRESULT open_zone_key(HKEY parent_key, DWORD zone, HKEY *hkey) { - static const WCHAR wszFormat[] = {'%','s','%','l','d',0}; + static const WCHAR wszFormat[] = {'%','s','%','u',0}; - WCHAR key_name[sizeof(wszZonesKey)/sizeof(WCHAR)+8]; + WCHAR key_name[sizeof(wszZonesKey)/sizeof(WCHAR)+12]; DWORD res; wsprintfW(key_name, wszFormat, wszZonesKey, zone); @@ -439,7 +795,7 @@ static HRESULT WINAPI SecManagerImpl_MapUrlToZone(IInternetSecurityManager *ifac } if(!pwszUrl) { - *pdwZone = -1; + *pdwZone = URLZONE_INVALID; return E_INVALIDARG; } @@ -864,8 +1220,42 @@ static HRESULT WINAPI ZoneMgrImpl_SetZoneAttributes(IInternetZoneManagerEx2* ifa DWORD dwZone, ZONEATTRIBUTES* pZoneAttributes) { - FIXME("(%p)->(%08x %p) stub\n", iface, dwZone, pZoneAttributes); - return E_NOTIMPL; + ZoneMgrImpl* This = impl_from_IInternetZoneManagerEx2(iface); + HRESULT hr; + HKEY hcu; + + TRACE("(%p)->(%d %p)\n", This, dwZone, pZoneAttributes); + + if (!pZoneAttributes) + return E_INVALIDARG; + + hr = open_zone_key(HKEY_CURRENT_USER, dwZone, &hcu); + if (FAILED(hr)) + return S_OK; /* IE6 returned E_FAIL here */ + + /* cbSize is ignored */ + RegSetValueExW(hcu, displaynameW, 0, REG_SZ, (LPBYTE) pZoneAttributes->szDisplayName, + (lstrlenW(pZoneAttributes->szDisplayName)+1)* sizeof(WCHAR)); + + RegSetValueExW(hcu, descriptionW, 0, REG_SZ, (LPBYTE) pZoneAttributes->szDescription, + (lstrlenW(pZoneAttributes->szDescription)+1)* sizeof(WCHAR)); + + RegSetValueExW(hcu, iconW, 0, REG_SZ, (LPBYTE) pZoneAttributes->szIconPath, + (lstrlenW(pZoneAttributes->szIconPath)+1)* sizeof(WCHAR)); + + RegSetValueExW(hcu, minlevelW, 0, REG_DWORD, + (const BYTE*) &pZoneAttributes->dwTemplateMinLevel, sizeof(DWORD)); + + RegSetValueExW(hcu, currentlevelW, 0, REG_DWORD, + (const BYTE*) &pZoneAttributes->dwTemplateCurrentLevel, sizeof(DWORD)); + + RegSetValueExW(hcu, recommendedlevelW, 0, REG_DWORD, + (const BYTE*) &pZoneAttributes->dwTemplateRecommended, sizeof(DWORD)); + + RegSetValueExW(hcu, flagsW, 0, REG_DWORD, (const BYTE*) &pZoneAttributes->dwFlags, sizeof(DWORD)); + RegCloseKey(hcu); + return S_OK; + } /******************************************************************** @@ -1243,86 +1633,209 @@ HRESULT WINAPI CoInternetCreateZoneManager(IServiceProvider* pSP, IInternetZoneM return ZoneMgrImpl_Construct(NULL, (void**)ppZM); } +static HRESULT parse_security_url(const WCHAR *url, PSUACTION action, WCHAR **result) { + IInternetProtocolInfo *protocol_info; + WCHAR *tmp, *new_url = NULL, *alloc_url = NULL; + DWORD size, new_size; + HRESULT hres = S_OK, parse_hres; + + while(1) { + TRACE("parsing %s\n", debugstr_w(url)); + + protocol_info = get_protocol_info(url); + if(!protocol_info) + break; + + size = strlenW(url)+1; + new_url = CoTaskMemAlloc(size*sizeof(WCHAR)); + if(!new_url) { + hres = E_OUTOFMEMORY; + break; + } + + new_size = 0; + parse_hres = IInternetProtocolInfo_ParseUrl(protocol_info, url, PARSE_SECURITY_URL, 0, new_url, size, &new_size, 0); + if(parse_hres == S_FALSE) { + if(!new_size) { + hres = E_UNEXPECTED; + break; + } + + tmp = CoTaskMemRealloc(new_url, new_size*sizeof(WCHAR)); + if(!tmp) { + hres = E_OUTOFMEMORY; + break; + } + new_url = tmp; + parse_hres = IInternetProtocolInfo_ParseUrl(protocol_info, url, PARSE_SECURITY_URL, 0, new_url, + new_size, &new_size, 0); + if(parse_hres == S_FALSE) { + hres = E_FAIL; + break; + } + } + + if(parse_hres != S_OK || !strcmpW(url, new_url)) + break; + + CoTaskMemFree(alloc_url); + url = alloc_url = new_url; + new_url = NULL; + } + + CoTaskMemFree(new_url); + + if(hres != S_OK) { + WARN("failed: %08x\n", hres); + CoTaskMemFree(alloc_url); + return hres; + } + + if(action == PSU_DEFAULT && (protocol_info = get_protocol_info(url))) { + size = strlenW(url)+1; + new_url = CoTaskMemAlloc(size * sizeof(WCHAR)); + if(new_url) { + new_size = 0; + parse_hres = IInternetProtocolInfo_ParseUrl(protocol_info, url, PARSE_SECURITY_DOMAIN, 0, + new_url, size, &new_size, 0); + if(parse_hres == S_FALSE) { + if(new_size) { + tmp = CoTaskMemRealloc(new_url, new_size*sizeof(WCHAR)); + if(tmp) { + new_url = tmp; + parse_hres = IInternetProtocolInfo_ParseUrl(protocol_info, url, PARSE_SECURITY_DOMAIN, 0, new_url, + new_size, &new_size, 0); + if(parse_hres == S_FALSE) + hres = E_FAIL; + }else { + hres = E_OUTOFMEMORY; + } + }else { + hres = E_UNEXPECTED; + } + } + + if(hres == S_OK && parse_hres == S_OK) { + CoTaskMemFree(alloc_url); + url = alloc_url = new_url; + new_url = NULL; + } + + CoTaskMemFree(new_url); + }else { + hres = E_OUTOFMEMORY; + } + IInternetProtocolInfo_Release(protocol_info); + } + + if(FAILED(hres)) { + WARN("failed %08x\n", hres); + CoTaskMemFree(alloc_url); + return hres; + } + + if(!alloc_url) { + size = strlenW(url)+1; + alloc_url = CoTaskMemAlloc(size * sizeof(WCHAR)); + if(!alloc_url) + return E_OUTOFMEMORY; + memcpy(alloc_url, url, size * sizeof(WCHAR)); + } + + *result = alloc_url; + return S_OK; +} + /******************************************************************** * CoInternetGetSecurityUrl (URLMON.@) */ HRESULT WINAPI CoInternetGetSecurityUrl(LPCWSTR pwzUrl, LPWSTR *ppwzSecUrl, PSUACTION psuAction, DWORD dwReserved) { - WCHAR buf1[INTERNET_MAX_URL_LENGTH], buf2[INTERNET_MAX_URL_LENGTH]; - LPWSTR url, domain; - DWORD len; + WCHAR *secure_url; HRESULT hres; TRACE("(%p,%p,%u,%u)\n", pwzUrl, ppwzSecUrl, psuAction, dwReserved); - url = buf1; - domain = buf2; - strcpyW(url, pwzUrl); - - while(1) { - hres = CoInternetParseUrl(url, PARSE_SECURITY_URL, 0, domain, INTERNET_MAX_URL_LENGTH, &len, 0); - if(hres!=S_OK || !strcmpW(url, domain)) - break; - - if(url == buf1) { - url = buf2; - domain = buf1; - } else { - url = buf1; - domain = buf2; - } - } - - if(psuAction==PSU_SECURITY_URL_ONLY) { - len = lstrlenW(url)+1; - *ppwzSecUrl = CoTaskMemAlloc(len*sizeof(WCHAR)); - if(!*ppwzSecUrl) - return E_OUTOFMEMORY; - - memcpy(*ppwzSecUrl, url, len*sizeof(WCHAR)); - return S_OK; - } - - hres = CoInternetParseUrl(url, PARSE_SECURITY_DOMAIN, 0, domain, - INTERNET_MAX_URL_LENGTH, &len, 0); - if(SUCCEEDED(hres)) { - len++; - *ppwzSecUrl = CoTaskMemAlloc(len*sizeof(WCHAR)); - if(!*ppwzSecUrl) - return E_OUTOFMEMORY; - - memcpy(*ppwzSecUrl, domain, len*sizeof(WCHAR)); - return S_OK; - } - - hres = CoInternetParseUrl(url, PARSE_SCHEMA, 0, domain, - INTERNET_MAX_URL_LENGTH, &len, 0); - if(hres == S_OK){ - const WCHAR fileW[] = {'f','i','l','e',0}; - if(!strcmpW(domain, fileW)){ - hres = CoInternetParseUrl(url, PARSE_ROOTDOCUMENT, 0, domain, INTERNET_MAX_URL_LENGTH, &len, 0); - }else{ - domain[len] = ':'; - hres = CoInternetParseUrl(url, PARSE_DOMAIN, 0, domain+len+1, - INTERNET_MAX_URL_LENGTH-len-1, &len, 0); - if(hres == S_OK) { - len = lstrlenW(domain)+1; - *ppwzSecUrl = CoTaskMemAlloc(len*sizeof(WCHAR)); - if(!*ppwzSecUrl) - return E_OUTOFMEMORY; - - memcpy(*ppwzSecUrl, domain, len*sizeof(WCHAR)); - return S_OK; - } - } - }else + hres = parse_security_url(pwzUrl, psuAction, &secure_url); + if(FAILED(hres)) return hres; - len = lstrlenW(url)+1; - *ppwzSecUrl = CoTaskMemAlloc(len*sizeof(WCHAR)); - if(!*ppwzSecUrl) - return E_OUTOFMEMORY; + if(psuAction != PSU_SECURITY_URL_ONLY) { + PARSEDURLW parsed_url = { sizeof(parsed_url) }; + DWORD size; - memcpy(*ppwzSecUrl, url, len*sizeof(WCHAR)); + /* FIXME: Use helpers from uri.c */ + if(SUCCEEDED(ParseURLW(secure_url, &parsed_url))) { + WCHAR *new_url; + + switch(parsed_url.nScheme) { + case URL_SCHEME_FTP: + case URL_SCHEME_HTTP: + case URL_SCHEME_HTTPS: + size = strlenW(secure_url)+1; + new_url = CoTaskMemAlloc(size * sizeof(WCHAR)); + if(new_url) + hres = UrlGetPartW(secure_url, new_url, &size, URL_PART_HOSTNAME, URL_PARTFLAG_KEEPSCHEME); + else + hres = E_OUTOFMEMORY; + CoTaskMemFree(secure_url); + if(hres != S_OK) { + WARN("UrlGetPart failed: %08x\n", hres); + CoTaskMemFree(new_url); + return FAILED(hres) ? hres : E_FAIL; + } + secure_url = new_url; + } + } + } + + *ppwzSecUrl = secure_url; return S_OK; } + +/******************************************************************** + * CoInternetGetSecurityUrlEx (URLMON.@) + */ +HRESULT WINAPI CoInternetGetSecurityUrlEx(IUri *pUri, IUri **ppSecUri, PSUACTION psuAction, DWORD_PTR dwReserved) +{ + URL_SCHEME scheme_type; + BSTR secure_uri; + WCHAR *ret_url; + HRESULT hres; + + TRACE("(%p,%p,%u,%u)\n", pUri, ppSecUri, psuAction, (DWORD)dwReserved); + + if(!pUri || !ppSecUri) + return E_INVALIDARG; + + hres = IUri_GetDisplayUri(pUri, &secure_uri); + if(FAILED(hres)) + return hres; + + hres = parse_security_url(secure_uri, psuAction, &ret_url); + SysFreeString(secure_uri); + if(FAILED(hres)) + return hres; + + hres = CreateUri(ret_url, Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME, 0, ppSecUri); + if(FAILED(hres)) { + CoTaskMemFree(ret_url); + return hres; + } + + /* File URIs have to hierarchical. */ + hres = IUri_GetScheme(pUri, (DWORD*)&scheme_type); + if(SUCCEEDED(hres) && scheme_type == URL_SCHEME_FILE) { + const WCHAR *tmp = ret_url; + + /* Check and see if a "//" is after the scheme name. */ + tmp += sizeof(fileW)/sizeof(WCHAR); + if(*tmp != '/' || *(tmp+1) != '/') + hres = E_INVALIDARG; + } + + if(SUCCEEDED(hres)) + hres = CreateUri(ret_url, Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME, 0, ppSecUri); + CoTaskMemFree(ret_url); + return hres; +} diff --git a/dll/win32/urlmon/session.c b/dll/win32/urlmon/session.c index 72a3e2a3c56..fc36c0bcceb 100644 --- a/dll/win32/urlmon/session.c +++ b/dll/win32/urlmon/session.c @@ -424,7 +424,7 @@ static HRESULT WINAPI InternetSession_CreateBinding(IInternetSession *iface, LPBC pBC, LPCWSTR szUrl, IUnknown *pUnkOuter, IUnknown **ppUnk, IInternetProtocol **ppOInetProt, DWORD dwOption) { - IInternetProtocolEx *protocol; + BindProtocol *protocol; HRESULT hres; TRACE("(%p %s %p %p %p %08x)\n", pBC, debugstr_w(szUrl), pUnkOuter, ppUnk, @@ -437,7 +437,7 @@ static HRESULT WINAPI InternetSession_CreateBinding(IInternetSession *iface, if(FAILED(hres)) return hres; - *ppOInetProt = (IInternetProtocol*)protocol; + *ppOInetProt = (IInternetProtocol*)&protocol->IInternetProtocolEx_iface; return S_OK; } diff --git a/dll/win32/urlmon/umon.c b/dll/win32/urlmon/umon.c index fbb00a44baa..8ef740fedc0 100644 --- a/dll/win32/urlmon/umon.c +++ b/dll/win32/urlmon/umon.c @@ -32,18 +32,22 @@ WINE_DEFAULT_DEBUG_CHANNEL(urlmon); typedef struct { - const IMonikerVtbl *lpIMonikerVtbl; + IMoniker IMoniker_iface; + IUriContainer IUriContainer_iface; LONG ref; LPOLESTR URLName; /* URL string identified by this URLmoniker */ } URLMoniker; -#define MONIKER_THIS(iface) DEFINE_THIS(URLMoniker, IMoniker, iface) +static inline URLMoniker *impl_from_IMoniker(IMoniker *iface) +{ + return CONTAINING_RECORD(iface, URLMoniker, IMoniker_iface); +} static HRESULT WINAPI URLMoniker_QueryInterface(IMoniker *iface, REFIID riid, void **ppv) { - URLMoniker *This = MONIKER_THIS(iface); + URLMoniker *This = impl_from_IMoniker(iface); if(!ppv) return E_INVALIDARG; @@ -63,6 +67,9 @@ static HRESULT WINAPI URLMoniker_QueryInterface(IMoniker *iface, REFIID riid, vo }else if(IsEqualIID(&IID_IAsyncMoniker, riid)) { TRACE("(%p)->(IID_IAsyncMoniker %p)\n", This, ppv); *ppv = iface; + }else if(IsEqualIID(&IID_IUriContainer, riid)) { + TRACE("(%p)->(IID_IUriContainer %p)\n", This, ppv); + *ppv = &This->IUriContainer_iface; }else { WARN("(%p)->(%s,%p)\n", This, debugstr_guid(riid), ppv); *ppv = NULL; @@ -75,7 +82,7 @@ static HRESULT WINAPI URLMoniker_QueryInterface(IMoniker *iface, REFIID riid, vo static ULONG WINAPI URLMoniker_AddRef(IMoniker *iface) { - URLMoniker *This = MONIKER_THIS(iface); + URLMoniker *This = impl_from_IMoniker(iface); ULONG refCount = InterlockedIncrement(&This->ref); TRACE("(%p) ref=%u\n",This, refCount); @@ -85,7 +92,7 @@ static ULONG WINAPI URLMoniker_AddRef(IMoniker *iface) static ULONG WINAPI URLMoniker_Release(IMoniker *iface) { - URLMoniker *This = MONIKER_THIS(iface); + URLMoniker *This = impl_from_IMoniker(iface); ULONG refCount = InterlockedDecrement(&This->ref); TRACE("(%p) ref=%u\n",This, refCount); @@ -102,7 +109,7 @@ static ULONG WINAPI URLMoniker_Release(IMoniker *iface) static HRESULT WINAPI URLMoniker_GetClassID(IMoniker *iface, CLSID *pClassID) { - URLMoniker *This = MONIKER_THIS(iface); + URLMoniker *This = impl_from_IMoniker(iface); TRACE("(%p,%p)\n", This, pClassID); @@ -116,7 +123,7 @@ static HRESULT WINAPI URLMoniker_GetClassID(IMoniker *iface, CLSID *pClassID) static HRESULT WINAPI URLMoniker_IsDirty(IMoniker *iface) { - URLMoniker *This = MONIKER_THIS(iface); + URLMoniker *This = impl_from_IMoniker(iface); TRACE("(%p)\n",This); @@ -128,7 +135,7 @@ static HRESULT WINAPI URLMoniker_IsDirty(IMoniker *iface) static HRESULT WINAPI URLMoniker_Load(IMoniker* iface,IStream* pStm) { - URLMoniker *This = MONIKER_THIS(iface); + URLMoniker *This = impl_from_IMoniker(iface); HRESULT res; ULONG size; ULONG got; @@ -164,7 +171,7 @@ static HRESULT WINAPI URLMoniker_Load(IMoniker* iface,IStream* pStm) static HRESULT WINAPI URLMoniker_Save(IMoniker *iface, IStream* pStm, BOOL fClearDirty) { - URLMoniker *This = MONIKER_THIS(iface); + URLMoniker *This = impl_from_IMoniker(iface); HRESULT res; ULONG size; @@ -184,7 +191,7 @@ static HRESULT WINAPI URLMoniker_Save(IMoniker *iface, IStream* pStm, BOOL fClea static HRESULT WINAPI URLMoniker_GetSizeMax(IMoniker* iface, ULARGE_INTEGER *pcbSize) { - URLMoniker *This = MONIKER_THIS(iface); + URLMoniker *This = impl_from_IMoniker(iface); TRACE("(%p,%p)\n",This,pcbSize); @@ -198,7 +205,7 @@ static HRESULT WINAPI URLMoniker_GetSizeMax(IMoniker* iface, ULARGE_INTEGER *pcb static HRESULT WINAPI URLMoniker_BindToObject(IMoniker *iface, IBindCtx* pbc, IMoniker *pmkToLeft, REFIID riid, void **ppv) { - URLMoniker *This = MONIKER_THIS(iface); + URLMoniker *This = impl_from_IMoniker(iface); IRunningObjectTable *obj_tbl; IUri *uri; HRESULT hres; @@ -224,12 +231,16 @@ static HRESULT WINAPI URLMoniker_BindToObject(IMoniker *iface, IBindCtx* pbc, IM static HRESULT WINAPI URLMoniker_BindToStorage(IMoniker* iface, IBindCtx* pbc, IMoniker* pmkToLeft, REFIID riid, void **ppvObject) { - URLMoniker *This = MONIKER_THIS(iface); + URLMoniker *This = impl_from_IMoniker(iface); IUri *uri; HRESULT hres; TRACE("(%p)->(%p %p %s %p)\n", This, pbc, pmkToLeft, debugstr_guid(riid), ppvObject); + if(ppvObject) *ppvObject = NULL; + + if(!pbc || !ppvObject) return E_INVALIDARG; + if(pmkToLeft) FIXME("Unsupported pmkToLeft\n"); @@ -246,8 +257,8 @@ static HRESULT WINAPI URLMoniker_BindToStorage(IMoniker* iface, IBindCtx* pbc, static HRESULT WINAPI URLMoniker_Reduce(IMoniker *iface, IBindCtx *pbc, DWORD dwReduceHowFar, IMoniker **ppmkToLeft, IMoniker **ppmkReduced) { - URLMoniker *This = MONIKER_THIS(iface); - + URLMoniker *This = impl_from_IMoniker(iface); + TRACE("(%p,%p,%d,%p,%p)\n", This, pbc, dwReduceHowFar, ppmkToLeft, ppmkReduced); if(!ppmkReduced) @@ -261,14 +272,14 @@ static HRESULT WINAPI URLMoniker_Reduce(IMoniker *iface, IBindCtx *pbc, static HRESULT WINAPI URLMoniker_ComposeWith(IMoniker *iface, IMoniker *pmkRight, BOOL fOnlyIfNotGeneric, IMoniker **ppmkComposite) { - URLMoniker *This = MONIKER_THIS(iface); + URLMoniker *This = impl_from_IMoniker(iface); FIXME("(%p)->(%p,%d,%p): stub\n",This,pmkRight,fOnlyIfNotGeneric,ppmkComposite); return E_NOTIMPL; } static HRESULT WINAPI URLMoniker_Enum(IMoniker *iface, BOOL fForward, IEnumMoniker **ppenumMoniker) { - URLMoniker *This = MONIKER_THIS(iface); + URLMoniker *This = impl_from_IMoniker(iface); TRACE("(%p,%d,%p)\n", This, fForward, ppenumMoniker); @@ -282,7 +293,7 @@ static HRESULT WINAPI URLMoniker_Enum(IMoniker *iface, BOOL fForward, IEnumMonik static HRESULT WINAPI URLMoniker_IsEqual(IMoniker *iface, IMoniker *pmkOtherMoniker) { - URLMoniker *This = MONIKER_THIS(iface); + URLMoniker *This = impl_from_IMoniker(iface); CLSID clsid; LPOLESTR urlPath; IBindCtx* bind; @@ -316,7 +327,7 @@ static HRESULT WINAPI URLMoniker_IsEqual(IMoniker *iface, IMoniker *pmkOtherMoni static HRESULT WINAPI URLMoniker_Hash(IMoniker *iface, DWORD *pdwHash) { - URLMoniker *This = MONIKER_THIS(iface); + URLMoniker *This = impl_from_IMoniker(iface); int h = 0,i,skip,len; int off = 0; LPOLESTR val; @@ -347,7 +358,7 @@ static HRESULT WINAPI URLMoniker_Hash(IMoniker *iface, DWORD *pdwHash) static HRESULT WINAPI URLMoniker_IsRunning(IMoniker* iface, IBindCtx* pbc, IMoniker *pmkToLeft, IMoniker *pmkNewlyRunning) { - URLMoniker *This = MONIKER_THIS(iface); + URLMoniker *This = impl_from_IMoniker(iface); FIXME("(%p)->(%p,%p,%p): stub\n",This,pbc,pmkToLeft,pmkNewlyRunning); return E_NOTIMPL; } @@ -355,28 +366,28 @@ static HRESULT WINAPI URLMoniker_IsRunning(IMoniker* iface, IBindCtx* pbc, static HRESULT WINAPI URLMoniker_GetTimeOfLastChange(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft, FILETIME *pFileTime) { - URLMoniker *This = MONIKER_THIS(iface); + URLMoniker *This = impl_from_IMoniker(iface); FIXME("(%p)->(%p,%p,%p): stub\n", This, pbc, pmkToLeft, pFileTime); return E_NOTIMPL; } static HRESULT WINAPI URLMoniker_Inverse(IMoniker *iface, IMoniker **ppmk) { - URLMoniker *This = MONIKER_THIS(iface); + URLMoniker *This = impl_from_IMoniker(iface); TRACE("(%p,%p)\n",This,ppmk); return MK_E_NOINVERSE; } static HRESULT WINAPI URLMoniker_CommonPrefixWith(IMoniker *iface, IMoniker *pmkOther, IMoniker **ppmkPrefix) { - URLMoniker *This = MONIKER_THIS(iface); + URLMoniker *This = impl_from_IMoniker(iface); FIXME("(%p)->(%p,%p): stub\n",This,pmkOther,ppmkPrefix); return E_NOTIMPL; } static HRESULT WINAPI URLMoniker_RelativePathTo(IMoniker *iface, IMoniker *pmOther, IMoniker **ppmkRelPath) { - URLMoniker *This = MONIKER_THIS(iface); + URLMoniker *This = impl_from_IMoniker(iface); FIXME("(%p)->(%p,%p): stub\n",This,pmOther,ppmkRelPath); return E_NOTIMPL; } @@ -384,7 +395,7 @@ static HRESULT WINAPI URLMoniker_RelativePathTo(IMoniker *iface, IMoniker *pmOth static HRESULT WINAPI URLMoniker_GetDisplayName(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft, LPOLESTR *ppszDisplayName) { - URLMoniker *This = MONIKER_THIS(iface); + URLMoniker *This = impl_from_IMoniker(iface); int len; TRACE("(%p,%p,%p,%p)\n", This, pbc, pmkToLeft, ppszDisplayName); @@ -409,14 +420,14 @@ static HRESULT WINAPI URLMoniker_GetDisplayName(IMoniker *iface, IBindCtx *pbc, static HRESULT WINAPI URLMoniker_ParseDisplayName(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft, LPOLESTR pszDisplayName, ULONG *pchEaten, IMoniker **ppmkOut) { - URLMoniker *This = MONIKER_THIS(iface); + URLMoniker *This = impl_from_IMoniker(iface); FIXME("(%p)->(%p,%p,%p,%p,%p): stub\n",This,pbc,pmkToLeft,pszDisplayName,pchEaten,ppmkOut); return E_NOTIMPL; } static HRESULT WINAPI URLMoniker_IsSystemMoniker(IMoniker *iface, DWORD *pwdMksys) { - URLMoniker *This = MONIKER_THIS(iface); + URLMoniker *This = impl_from_IMoniker(iface); TRACE("(%p,%p)\n",This,pwdMksys); @@ -454,6 +465,46 @@ static const IMonikerVtbl URLMonikerVtbl = URLMoniker_IsSystemMoniker }; +static inline URLMoniker *impl_from_IUriContainer(IUriContainer *iface) +{ + return CONTAINING_RECORD(iface, URLMoniker, IUriContainer_iface); +} + +static HRESULT WINAPI UriContainer_QueryInterface(IUriContainer *iface, REFIID riid, void **ppv) +{ + URLMoniker *This = impl_from_IUriContainer(iface); + return IMoniker_QueryInterface(&This->IMoniker_iface, riid, ppv); +} + +static ULONG WINAPI UriContainer_AddRef(IUriContainer *iface) +{ + URLMoniker *This = impl_from_IUriContainer(iface); + return IMoniker_AddRef(&This->IMoniker_iface); +} + +static ULONG WINAPI UriContainer_Release(IUriContainer *iface) +{ + URLMoniker *This = impl_from_IUriContainer(iface); + return IMoniker_Release(&This->IMoniker_iface); +} + +static HRESULT WINAPI UriContainer_GetIUri(IUriContainer *iface, IUri **ppIUri) +{ + URLMoniker *This = impl_from_IUriContainer(iface); + + FIXME("(%p)->(%p)\n", This, ppIUri); + + *ppIUri = NULL; + return S_FALSE; +} + +static const IUriContainerVtbl UriContainerVtbl = { + UriContainer_QueryInterface, + UriContainer_AddRef, + UriContainer_Release, + UriContainer_GetIUri +}; + static URLMoniker *alloc_moniker(void) { URLMoniker *ret; @@ -462,7 +513,8 @@ static URLMoniker *alloc_moniker(void) if(!ret) return NULL; - ret->lpIMonikerVtbl = &URLMonikerVtbl; + ret->IMoniker_iface.lpVtbl = &URLMonikerVtbl; + ret->IUriContainer_iface.lpVtbl = &UriContainerVtbl; ret->ref = 1; ret->URLName = NULL; @@ -557,8 +609,8 @@ HRESULT WINAPI CreateURLMonikerEx(IMoniker *pmkContext, LPCWSTR szURL, IMoniker hres = URLMoniker_Init(obj, lefturl, szURL); CoTaskMemFree(lefturl); if(SUCCEEDED(hres)) - hres = URLMoniker_QueryInterface((IMoniker*)obj, &IID_IMoniker, (void**)ppmk); - IMoniker_Release((IMoniker*)obj); + hres = URLMoniker_QueryInterface(&obj->IMoniker_iface, &IID_IMoniker, (void**)ppmk); + IMoniker_Release(&obj->IMoniker_iface); return hres; } diff --git a/dll/win32/urlmon/umstream.c b/dll/win32/urlmon/umstream.c index 5a942f612f6..792cd64979b 100644 --- a/dll/win32/urlmon/umstream.c +++ b/dll/win32/urlmon/umstream.c @@ -32,11 +32,16 @@ WINE_DEFAULT_DEBUG_CHANNEL(urlmon); typedef struct ProxyBindStatusCallback { - const IBindStatusCallbackVtbl *lpVtbl; + IBindStatusCallback IBindStatusCallback_iface; IBindStatusCallback *pBSC; } ProxyBindStatusCallback; +static inline ProxyBindStatusCallback *impl_from_IBindStatusCallback(IBindStatusCallback *iface) +{ + return CONTAINING_RECORD(iface, ProxyBindStatusCallback, IBindStatusCallback_iface); +} + static HRESULT WINAPI ProxyBindStatusCallback_QueryInterface(IBindStatusCallback *iface, REFIID riid, void **ppv) { if (IsEqualGUID(&IID_IBindStatusCallback, riid) || @@ -64,7 +69,7 @@ static ULONG WINAPI ProxyBindStatusCallback_Release(IBindStatusCallback *iface) static HRESULT WINAPI ProxyBindStatusCallback_OnStartBinding(IBindStatusCallback *iface, DWORD dwReserved, IBinding *pib) { - ProxyBindStatusCallback *This = (ProxyBindStatusCallback *)iface; + ProxyBindStatusCallback *This = impl_from_IBindStatusCallback(iface); if(This->pBSC) return IBindStatusCallback_OnStartBinding(This->pBSC, dwReserved, pib); @@ -74,7 +79,7 @@ static HRESULT WINAPI ProxyBindStatusCallback_OnStartBinding(IBindStatusCallback static HRESULT WINAPI ProxyBindStatusCallback_GetPriority(IBindStatusCallback *iface, LONG *pnPriority) { - ProxyBindStatusCallback *This = (ProxyBindStatusCallback *)iface; + ProxyBindStatusCallback *This = impl_from_IBindStatusCallback(iface); if(This->pBSC) return IBindStatusCallback_GetPriority(This->pBSC, pnPriority); @@ -84,7 +89,7 @@ static HRESULT WINAPI ProxyBindStatusCallback_GetPriority(IBindStatusCallback *i static HRESULT WINAPI ProxyBindStatusCallback_OnLowResource(IBindStatusCallback *iface, DWORD reserved) { - ProxyBindStatusCallback *This = (ProxyBindStatusCallback *)iface; + ProxyBindStatusCallback *This = impl_from_IBindStatusCallback(iface); if(This->pBSC) return IBindStatusCallback_OnLowResource(This->pBSC, reserved); @@ -95,7 +100,7 @@ static HRESULT WINAPI ProxyBindStatusCallback_OnLowResource(IBindStatusCallback static HRESULT WINAPI ProxyBindStatusCallback_OnProgress(IBindStatusCallback *iface, ULONG ulProgress, ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText) { - ProxyBindStatusCallback *This = (ProxyBindStatusCallback *)iface; + ProxyBindStatusCallback *This = impl_from_IBindStatusCallback(iface); if(This->pBSC) return IBindStatusCallback_OnProgress(This->pBSC, ulProgress, @@ -107,7 +112,7 @@ static HRESULT WINAPI ProxyBindStatusCallback_OnProgress(IBindStatusCallback *if static HRESULT WINAPI ProxyBindStatusCallback_OnStopBinding(IBindStatusCallback *iface, HRESULT hresult, LPCWSTR szError) { - ProxyBindStatusCallback *This = (ProxyBindStatusCallback *)iface; + ProxyBindStatusCallback *This = impl_from_IBindStatusCallback(iface); if(This->pBSC) return IBindStatusCallback_OnStopBinding(This->pBSC, hresult, szError); @@ -117,7 +122,7 @@ static HRESULT WINAPI ProxyBindStatusCallback_OnStopBinding(IBindStatusCallback static HRESULT WINAPI ProxyBindStatusCallback_GetBindInfo(IBindStatusCallback *iface, DWORD *grfBINDF, BINDINFO *pbindinfo) { - ProxyBindStatusCallback *This = (ProxyBindStatusCallback *)iface; + ProxyBindStatusCallback *This = impl_from_IBindStatusCallback(iface); if(This->pBSC) return IBindStatusCallback_GetBindInfo(This->pBSC, grfBINDF, pbindinfo); @@ -128,7 +133,7 @@ static HRESULT WINAPI ProxyBindStatusCallback_GetBindInfo(IBindStatusCallback *i static HRESULT WINAPI ProxyBindStatusCallback_OnDataAvailable(IBindStatusCallback *iface, DWORD grfBSCF, DWORD dwSize, FORMATETC* pformatetc, STGMEDIUM* pstgmed) { - ProxyBindStatusCallback *This = (ProxyBindStatusCallback *)iface; + ProxyBindStatusCallback *This = impl_from_IBindStatusCallback(iface); if(This->pBSC) return IBindStatusCallback_OnDataAvailable(This->pBSC, grfBSCF, dwSize, @@ -139,7 +144,7 @@ static HRESULT WINAPI ProxyBindStatusCallback_OnDataAvailable(IBindStatusCallbac static HRESULT WINAPI ProxyBindStatusCallback_OnObjectAvailable(IBindStatusCallback *iface, REFIID riid, IUnknown *punk) { - ProxyBindStatusCallback *This = (ProxyBindStatusCallback *)iface; + ProxyBindStatusCallback *This = impl_from_IBindStatusCallback(iface); if(This->pBSC) return IBindStatusCallback_OnObjectAvailable(This->pBSC, riid, punk); @@ -170,7 +175,7 @@ static const IBindStatusCallbackVtbl BlockingBindStatusCallbackVtbl = static HRESULT WINAPI AsyncBindStatusCallback_GetBindInfo(IBindStatusCallback *iface, DWORD *grfBINDF, BINDINFO *pbindinfo) { - ProxyBindStatusCallback *This = (ProxyBindStatusCallback *)iface; + ProxyBindStatusCallback *This = impl_from_IBindStatusCallback(iface); HRESULT hr = IBindStatusCallback_GetBindInfo(This->pBSC, grfBINDF, pbindinfo); *grfBINDF |= BINDF_PULLDATA | BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE; return hr; @@ -276,10 +281,10 @@ HRESULT WINAPI URLOpenBlockingStreamW(LPUNKNOWN pCaller, LPCWSTR szURL, if (!szURL || !ppStream) return E_INVALIDARG; - blocking_bsc.lpVtbl = &BlockingBindStatusCallbackVtbl; + blocking_bsc.IBindStatusCallback_iface.lpVtbl = &BlockingBindStatusCallbackVtbl; blocking_bsc.pBSC = lpfnCB; - return URLStartDownload(szURL, ppStream, (IBindStatusCallback *)&blocking_bsc); + return URLStartDownload(szURL, ppStream, &blocking_bsc.IBindStatusCallback_iface); } /*********************************************************************** @@ -326,10 +331,10 @@ HRESULT WINAPI URLOpenStreamW(LPUNKNOWN pCaller, LPCWSTR szURL, DWORD dwReserved if (!szURL) return E_INVALIDARG; - async_bsc.lpVtbl = &AsyncBindStatusCallbackVtbl; + async_bsc.IBindStatusCallback_iface.lpVtbl = &AsyncBindStatusCallbackVtbl; async_bsc.pBSC = lpfnCB; - hr = URLStartDownload(szURL, &pStream, (IBindStatusCallback *)&async_bsc); + hr = URLStartDownload(szURL, &pStream, &async_bsc.IBindStatusCallback_iface); if (SUCCEEDED(hr) && pStream) IStream_Release(pStream); diff --git a/dll/win32/urlmon/uri.c b/dll/win32/urlmon/uri.c index 681327f6cb8..f12f826e8e5 100644 --- a/dll/win32/urlmon/uri.c +++ b/dll/win32/urlmon/uri.c @@ -258,11 +258,11 @@ static Uri *get_uri_obj(IUri *uri) } static inline BOOL is_alpha(WCHAR val) { - return ((val >= 'a' && val <= 'z') || (val >= 'A' && val <= 'Z')); + return ((val >= 'a' && val <= 'z') || (val >= 'A' && val <= 'Z')); } static inline BOOL is_num(WCHAR val) { - return (val >= '0' && val <= '9'); + return (val >= '0' && val <= '9'); } static inline BOOL is_drive_path(const WCHAR *str) { @@ -350,6 +350,11 @@ static inline BOOL is_path_delim(WCHAR val) { return (!val || val == '#' || val == '?'); } +static inline BOOL is_slash(WCHAR c) +{ + return c == '/' || c == '\\'; +} + static BOOL is_default_port(URL_SCHEME scheme, DWORD port) { DWORD i; @@ -592,21 +597,6 @@ static inline void pct_encode_val(WCHAR val, WCHAR *dest) { dest[2] = hexDigits[val & 0xf]; } -/* Scans the range of characters [str, end] and returns the last occurrence - * of 'ch' or returns NULL. - */ -static const WCHAR *str_last_of(const WCHAR *str, const WCHAR *end, WCHAR ch) { - const WCHAR *ptr = end; - - while(ptr >= str) { - if(*ptr == ch) - return ptr; - --ptr; - } - - return NULL; -} - /* Attempts to parse the domain name from the host. * * This function also includes the Top-level Domain (TLD) name @@ -614,10 +604,10 @@ static const WCHAR *str_last_of(const WCHAR *str, const WCHAR *end, WCHAR ch) { * a valid domain name it will assign 'domain_start' the offset * into 'host' where the domain name starts. * - * It's implied that if a domain name its range is implied to be + * It's implied that if there is a domain name its range is: * [host+domain_start, host+host_len). */ -static void find_domain_name(const WCHAR *host, DWORD host_len, +void find_domain_name(const WCHAR *host, DWORD host_len, INT *domain_start) { const WCHAR *last_tld, *sec_last_tld, *end; @@ -631,12 +621,12 @@ static void find_domain_name(const WCHAR *host, DWORD host_len, if(host_len < 4) return; - last_tld = str_last_of(host, end, '.'); + last_tld = memrchrW(host, '.', host_len); if(!last_tld) /* http://hostname -> has no domain name. */ return; - sec_last_tld = str_last_of(host, last_tld-1, '.'); + sec_last_tld = memrchrW(host, '.', last_tld-host); if(!sec_last_tld) { /* If the '.' is at the beginning of the host there * has to be at least 3 characters in the TLD for it @@ -687,7 +677,7 @@ static void find_domain_name(const WCHAR *host, DWORD host_len, if(last_tld - (sec_last_tld+1) == 3) { for(i = 0; i < sizeof(recognized_tlds)/sizeof(recognized_tlds[0]); ++i) { if(!StrCmpNIW(sec_last_tld+1, recognized_tlds[i].tld_name, 3)) { - const WCHAR *domain = str_last_of(host, sec_last_tld-1, '.'); + const WCHAR *domain = memrchrW(host, '.', sec_last_tld-host); if(!domain) *domain_start = 0; @@ -705,7 +695,7 @@ static void find_domain_name(const WCHAR *host, DWORD host_len, * part of the TLD. * Ex: www.google.fo.uk -> google.fo.uk as the domain name. */ - const WCHAR *domain = str_last_of(host, sec_last_tld-1, '.'); + const WCHAR *domain = memrchrW(host, '.', sec_last_tld-host); if(!domain) *domain_start = 0; @@ -727,8 +717,6 @@ static void find_domain_name(const WCHAR *host, DWORD host_len, /* Removes the dot segments from a hierarchical URIs path component. This * function performs the removal in place. * - * This is a modified version of Qt's QUrl function "removeDotsFromPath". - * * This function returns the new length of the path string. */ static DWORD remove_dot_segments(WCHAR *path, DWORD path_len) { @@ -738,48 +726,46 @@ static DWORD remove_dot_segments(WCHAR *path, DWORD path_len) { DWORD len; while(in < end) { - /* A. if the input buffer begins with a prefix of "/./" or "/.", - * where "." is a complete path segment, then replace that - * prefix with "/" in the input buffer; otherwise, + /* Move the first path segment in the input buffer to the end of + * the output buffer, and any subsequent characters up to, including + * the next "/" character (if any) or the end of the input buffer. */ - if(in <= end - 3 && in[0] == '/' && in[1] == '.' && in[2] == '/') { - in += 2; - continue; - } else if(in == end - 2 && in[0] == '/' && in[1] == '.') { - *out++ = '/'; - in += 2; - break; - } - - /* B. if the input buffer begins with a prefix of "/../" or "/..", - * where ".." is a complete path segment, then replace that - * prefix with "/" in the input buffer and remove the last - * segment and its preceding "/" (if any) from the output - * buffer; otherwise, - */ - if(in <= end - 4 && in[0] == '/' && in[1] == '.' && in[2] == '.' && in[3] == '/') { - while(out > path && *(--out) != '/'); - - in += 3; - continue; - } else if(in == end - 3 && in[0] == '/' && in[1] == '.' && in[2] == '.') { - while(out > path && *(--out) != '/'); - - if(*out == '/') - ++out; - - in += 3; - break; - } - - /* C. move the first path segment in the input buffer to the end of - * the output buffer, including the initial "/" character (if - * any) and any subsequent characters up to, but not including, - * the next "/" character or the end of the input buffer. - */ - *out++ = *in++; - while(in < end && *in != '/') + while(in < end && !is_slash(*in)) *out++ = *in++; + if(in == end) + break; + *out++ = *in++; + + while(in < end) { + if(*in != '.') + break; + + /* Handle ending "/." */ + if(in + 1 == end) { + ++in; + break; + } + + /* Handle "/./" */ + if(is_slash(in[1])) { + in += 2; + continue; + } + + /* If we don't have "/../" or ending "/.." */ + if(in[1] != '.' || (in + 2 != end && !is_slash(in[2]))) + break; + + /* Find the slash preceding out pointer and move out pointer to it */ + if(out > path+1 && is_slash(*--out)) + --out; + while(out > path && !is_slash(*(--out))); + if(is_slash(*out)) + ++out; + in += 2; + if(in != end) + ++in; + } } len = out - path; @@ -809,12 +795,12 @@ static INT find_file_extension(const WCHAR *path, DWORD path_len) { * * NOTES: * Windows will expand an elision if the elision only represents 1 h16 - * component of the URI. + * component of the address. * * Ex: [1::2:3:4:5:6:7] -> [1:0:2:3:4:5:6:7] * * If the IPv6 address contains an IPv4 address, the IPv4 address is also - * considered for being included as part of an elision if all it's components + * considered for being included as part of an elision if all its components * are zeros. * * Ex: [1:2:3:4:5:6:0.0.0.0] -> [1:2:3:4:5:6::] @@ -987,7 +973,7 @@ static USHORT h16tous(h16 component) { return ret; } -/* Converts an IPv6 address into it's 128 bits (16 bytes) numerical value. +/* Converts an IPv6 address into its 128 bits (16 bytes) numerical value. * * This function assumes that the ipv6_address has already been validated. */ @@ -998,7 +984,7 @@ static BOOL ipv6_to_number(const ipv6_address *address, USHORT number[8]) { for(i = 0; i < address->h16_count; ++i) { if(address->elision) { if(address->components[i].str > address->elision && !already_passed_elision) { - /* Means we just passed the elision and need to add it's values to + /* Means we just passed the elision and need to add its values to * 'number' before we do anything else. */ DWORD j = 0; @@ -1016,7 +1002,6 @@ static BOOL ipv6_to_number(const ipv6_address *address, USHORT number[8]) { if(!already_passed_elision && address->elision) { for(i = 0; i < address->elision_size; i+=2) number[cur_component++] = 0; - already_passed_elision = TRUE; } if(address->ipv4) { @@ -1818,7 +1803,7 @@ static BOOL parse_ipv6address(const WCHAR **ptr, parse_data *data, DWORD flags) TRACE("(%p %p %x): Found valid IPv6 literal %s len=%d\n", ptr, data, flags, debugstr_wn(start, *ptr-start), - *ptr-start); + (int)(*ptr-start)); return TRUE; } @@ -1860,7 +1845,7 @@ static BOOL parse_ipvfuture(const WCHAR **ptr, parse_data *data, DWORD flags) { data->host_type = Uri_HOST_UNKNOWN; TRACE("(%p %p %x): Parsed IPvFuture address %s len=%d\n", ptr, data, flags, - debugstr_wn(start, *ptr-start), *ptr-start); + debugstr_wn(start, *ptr-start), (int)(*ptr-start)); return TRUE; } @@ -3151,10 +3136,17 @@ static BOOL canonicalize_path_opaque(const parse_data *data, Uri *uri, DWORD fla } } + if(data->scheme_type == URL_SCHEME_MK && !computeOnly && !(flags & Uri_CREATE_NO_CANONICALIZE)) { + DWORD new_len = remove_dot_segments(uri->canon_uri + uri->path_start, + uri->canon_len - uri->path_start); + uri->canon_len = uri->path_start + new_len; + } + uri->path_len = uri->canon_len - uri->path_start; - TRACE("(%p %p %x %d): Canonicalized opaque URI path %s len=%d\n", data, uri, flags, computeOnly, - debugstr_wn(uri->canon_uri+uri->path_start, uri->path_len), uri->path_len); + if(!computeOnly) + TRACE("(%p %p %x %d): Canonicalized opaque URI path %s len=%d\n", data, uri, flags, computeOnly, + debugstr_wn(uri->canon_uri+uri->path_start, uri->path_len), uri->path_len); return TRUE; } @@ -3436,7 +3428,7 @@ static HRESULT canonicalize_uri(const parse_data *data, Uri *uri, DWORD flags) { INT len; uri->canon_uri = NULL; - len = uri->canon_size = uri->canon_len = 0; + uri->canon_size = uri->canon_len = 0; TRACE("(%p %p %x): beginning to canonicalize URI %s.\n", data, uri, flags, debugstr_w(data->uri)); @@ -5007,10 +4999,10 @@ static ULONG WINAPI UriBuilderFactory_Release(IUriBuilderFactory *iface) return ref; } -static HRESULT WINAPI UriBuilderFactory_CreateInitializedIUriBuilder(IUriBuilderFactory *iface, - DWORD dwFlags, - DWORD_PTR dwReserved, - IUriBuilder **ppIUriBuilder) +static HRESULT WINAPI UriBuilderFactory_CreateIUriBuilder(IUriBuilderFactory *iface, + DWORD dwFlags, + DWORD_PTR dwReserved, + IUriBuilder **ppIUriBuilder) { Uri *This = impl_from_IUriBuilderFactory(iface); TRACE("(%p)->(%08x %08x %p)\n", This, dwFlags, (DWORD)dwReserved, ppIUriBuilder); @@ -5026,10 +5018,10 @@ static HRESULT WINAPI UriBuilderFactory_CreateInitializedIUriBuilder(IUriBuilder return CreateIUriBuilder(NULL, 0, 0, ppIUriBuilder); } -static HRESULT WINAPI UriBuilderFactory_CreateIUriBuilder(IUriBuilderFactory *iface, - DWORD dwFlags, - DWORD_PTR dwReserved, - IUriBuilder **ppIUriBuilder) +static HRESULT WINAPI UriBuilderFactory_CreateInitializedIUriBuilder(IUriBuilderFactory *iface, + DWORD dwFlags, + DWORD_PTR dwReserved, + IUriBuilder **ppIUriBuilder) { Uri *This = impl_from_IUriBuilderFactory(iface); TRACE("(%p)->(%08x %08x %p)\n", This, dwFlags, (DWORD)dwReserved, ppIUriBuilder); @@ -5049,8 +5041,8 @@ static const IUriBuilderFactoryVtbl UriBuilderFactoryVtbl = { UriBuilderFactory_QueryInterface, UriBuilderFactory_AddRef, UriBuilderFactory_Release, - UriBuilderFactory_CreateInitializedIUriBuilder, - UriBuilderFactory_CreateIUriBuilder + UriBuilderFactory_CreateIUriBuilder, + UriBuilderFactory_CreateInitializedIUriBuilder }; static Uri* create_uri_obj(void) { @@ -5795,10 +5787,10 @@ static HRESULT merge_paths(parse_data *data, const WCHAR *base, DWORD base_len, /* Find the characters the will be copied over from * the base path. */ - end = str_last_of(base, base+(base_len-1), '/'); + end = memrchrW(base, '/', base_len); if(!end && data->scheme_type == URL_SCHEME_FILE) /* Try looking for a '\\'. */ - end = str_last_of(base, base+(base_len-1), '\\'); + end = memrchrW(base, '\\', base_len); } if(end) { @@ -6002,7 +5994,7 @@ static HRESULT combine_uri(Uri *base, Uri *relative, DWORD flags, IUri **result, DWORD new_len = remove_dot_segments(path+offset,path_len-offset); if(new_len != path_len) { - WCHAR *tmp = heap_realloc(path, (path_offset+new_len+1)*sizeof(WCHAR)); + WCHAR *tmp = heap_realloc(path, (offset+new_len+1)*sizeof(WCHAR)); if(!tmp) { heap_free(path); *result = NULL; @@ -6015,6 +6007,11 @@ static HRESULT combine_uri(Uri *base, Uri *relative, DWORD flags, IUri **result, } } + if(relative->query_start > -1) { + data.query = relative->canon_uri+relative->query_start; + data.query_len = relative->query_len; + } + /* Make sure the path component is valid. */ ptr = path; pptr = &ptr; diff --git a/dll/win32/urlmon/urlmon.inf b/dll/win32/urlmon/urlmon.inf index c9debb43a80..77bb8f21165 100644 --- a/dll/win32/urlmon/urlmon.inf +++ b/dll/win32/urlmon/urlmon.inf @@ -3,43 +3,11 @@ Signature="$CHICAGO$" [RegisterDll] -AddReg=Classes.Reg, Protocols.Reg, ZoneMap.Reg, Zones.Reg, Misc.Reg +AddReg=ZoneMap.Reg, Zones.Reg [UnregisterDll] -DelReg=Classes.Reg, Protocols.Reg, ZoneMap.Reg, Zones.Reg, Misc.Reg - - -[Classes.Reg] - -;; CLSID_DeCompMimeFilter -HKCR,"CLSID\%CLSID_DeCompMimeFilter%",,,"AP lzdhtml encoding/decoding Filter" -HKCR,"CLSID\%CLSID_DeCompMimeFilter%\InProcServer32",,,"%MODULE%" -HKCR,"CLSID\%CLSID_DeCompMimeFilter%\InProcServer32","ThreadingModel",,"Apartment" - - -[Protocols.Reg] -HKCR,"PROTOCOLS\Handler\cdl",,,"CDL: Asynchronous Pluggable Protocol Handler" -HKCR,"PROTOCOLS\Handler\cdl","CLSID",,"%CLSID_CdlProtocol%" -HKCR,"PROTOCOLS\Handler\file",,,"file:, local: Asynchronous Pluggable Protocol Handler" -HKCR,"PROTOCOLS\Handler\file","CLSID",,"%CLSID_FileProtocol%" -HKCR,"PROTOCOLS\Handler\local",,,"file:, local: Asynchronous Pluggable Protocol Handler" -HKCR,"PROTOCOLS\Handler\local","CLSID",,"%CLSID_FileProtocol%" -HKCR,"PROTOCOLS\Handler\ftp",,,"ftp: Asynchronous Pluggable Protocol Handler" -HKCR,"PROTOCOLS\Handler\ftp","CLSID",,"%CLSID_FtpProtocol%" -HKCR,"PROTOCOLS\Handler\gopher",,,"gopher: Asynchronous Pluggable Protocol Handler" -HKCR,"PROTOCOLS\Handler\gopher","CLSID",,"%CLSID_GopherProtocol%" -HKCR,"PROTOCOLS\Handler\http",,,"http: Asynchronous Pluggable Protocol Handler" -HKCR,"PROTOCOLS\Handler\http","CLSID",,"%CLSID_HttpProtocol%" -HKCR,"PROTOCOLS\Handler\https",,,"https: Asynchronous Pluggable Protocol Handler" -HKCR,"PROTOCOLS\Handler\https","CLSID",,"%CLSID_HttpsProtocol%" -HKCR,"PROTOCOLS\Handler\mk",,,"mk: Asynchronous Pluggable Protocol Handler" -HKCR,"PROTOCOLS\Filter\deflate",,,"AP Deflate Encoding/Decoding Filter" -HKCR,"PROTOCOLS\Filter\deflate","CLSID",,"%CLSID_DeCompMimeFilter%" -HKCR,"PROTOCOLS\Filter\gzip",,,"AP Deflate Encoding/Decoding Filter" -HKCR,"PROTOCOLS\Filter\gzip","CLSID",,"%CLSID_DeCompMimeFilter%" -HKCR,"PROTOCOLS\Filter\lzdhtml",,,"AP Deflate Encoding/Decoding Filter" -HKCR,"PROTOCOLS\Filter\lzdhtml","CLSID",,"%CLSID_DeCompMimeFilter%" +DelReg=ZoneMap.Reg, Zones.Reg [ZoneMap.Reg] @@ -459,16 +427,7 @@ HKCU,"%ZONES_UNTRUSTED%","1E05",0x10003,0x10000 HKLM,"%ZONES_UNTRUSTED%","1E05",0x10003,0x10000 -[Misc.Reg] -HKCU,"%INTERNET_SETTINGS%","User Agent",,"%USER_AGENT%" - - [Strings] -MODULE="urlmon.dll" - -USER_AGENT="Mozilla/4.0 (compatible; MSIE 8.0; Win32)" -INTERNET_SETTINGS="Software\Microsoft\Windows\CurrentVersion\Internet Settings" - PATH_ZONEMAP="Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap" PATH_ZONEMAP_PROTOCOLS="Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\ProtocolDefaults" PATH_ZONEMAP_DOMAINS="Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains" diff --git a/dll/win32/urlmon/urlmon.rbuild b/dll/win32/urlmon/urlmon.rbuild index ffca7d9514b..050c77cdf3d 100644 --- a/dll/win32/urlmon/urlmon.rbuild +++ b/dll/win32/urlmon/urlmon.rbuild @@ -22,7 +22,6 @@ mk.c protocol.c protproxy.c - regsvr.c sec_mgr.c session.c umon.c @@ -31,6 +30,7 @@ urlmon_main.c usrmarshal.c rsrc.rc + urlmon_main.h wine uuid rpcrt4 diff --git a/dll/win32/urlmon/urlmon.rgs b/dll/win32/urlmon/urlmon.rgs new file mode 100644 index 00000000000..868baad2a58 --- /dev/null +++ b/dll/win32/urlmon/urlmon.rgs @@ -0,0 +1,123 @@ +HKCR +{ + NoRemove PROTOCOLS + { + NoRemove Handler + { + ForceRemove cdl = s 'CDL: Asynchronous Pluggable Protocol Handler' + { + val CLSID = s '{3dd53d40-7b8b-11d0-b013-00aa0059ce02}' + } + ForceRemove file = s 'file:, local: Asynchronous Pluggable Protocol Handler' + { + val CLSID = s '{79eac9e7-baf9-11ce-8c82-00aa004ba90b}' + } + ForceRemove local = s 'file:, local: Asynchronous Pluggable Protocol Handler' + { + val CLSID = s '{79eac9e7-baf9-11ce-8c82-00aa004ba90b}' + } + ForceRemove ftp = s 'ftp: Asynchronous Pluggable Protocol Handler' + { + val CLSID = s '{79eac9e3-baf9-11ce-8c82-00aa004ba90b}' + } + ForceRemove gopher = s 'gopher: Asynchronous Pluggable Protocol Handler' + { + val CLSID = s '{79eac9e4-baf9-11ce-8c82-00aa004ba90b}' + } + ForceRemove http = s 'http: Asynchronous Pluggable Protocol Handler' + { + val CLSID = s '{79eac9e2-baf9-11ce-8c82-00aa004ba90b}' + } + ForceRemove https = s 'https: Asynchronous Pluggable Protocol Handler' + { + val CLSID = s '{79eac9e5-baf9-11ce-8c82-00aa004ba90b}' + } + ForceRemove mk = s 'mk: Asynchronous Pluggable Protocol Handler' + { + val CLSID = s '{79eac9e6-baf9-11ce-8c82-00aa004ba90b}' + } + } + NoRemove Filter + { + ForceRemove deflate = s 'AP Deflate Encoding/Decoding Filter' + { + val CLSID = s '{8f6b0360-b80d-11d0-a9b3-006097942311}' + } + ForceRemove gzip = s 'AP Deflate Encoding/Decoding Filter' + { + val CLSID = s '{8f6b0360-b80d-11d0-a9b3-006097942311}' + } + ForceRemove lzdhtml = s 'AP Deflate Encoding/Decoding Filter' + { + val CLSID = s '{8f6b0360-b80d-11d0-a9b3-006097942311}' + } + } + } +} +HKCU +{ + NoRemove Software + { + NoRemove Microsoft + { + NoRemove Windows + { + NoRemove CurrentVersion + { + NoRemove 'Internet Settings' + { + val 'User Agent' = s 'Mozilla/4.0 (compatible; MSIE 8.0; Win32)' + } + } + } + NoRemove 'Internet Explorer' + { + NoRemove Main + { + FeatureControl + } + } + } + } +} +HKLM +{ + NoRemove Software + { + NoRemove Microsoft + { + NoRemove 'Internet Explorer' + { + NoRemove Main + { + FeatureControl + { + FEATURE_OBJECT_CACHING + FEATURE_ZONE_ELEVATION + FEATURE_MIME_HANDLING + FEATURE_MIME_SNIFFING + FEATURE_WINDOW_RESTRICTIONS + FEATURE_WEBOC_POPUPMANAGEMENT + FEATURE_BEHAVIORS + FEATURE_DISABLE_MK_PROTOCOL + FEATURE_LOCALMACHINE_LOCKDOWN + FEATURE_SECURITYBAND + FEATURE_RESTRICT_ACTIVEXINSTALL + FEATURE_VALIDATE_NAVIGATE_URL + FEATURE_RESTRICT_FILEDOWNLOAD + FEATURE_ADDON_MANAGEMENT + FEATURE_PROTOCOL_LOCKDOWN + FEATURE_HTTP_USERNAME_PASSWORD_DISABLE + FEATURE_SAFE_BINDTOOBJECT + FEATURE_UNC_SAVEDFILECHECK + FEATURE_SSLUX + FEATURE_DISABLE_LEGACY_COMPRESSION + FEATURE_FORCE_ADDR_AND_STATUS + FEATURE_DISABLE_TELNET_PROTOCOL + FEATURE_FEEDS + } + } + } + } + } +} diff --git a/dll/win32/urlmon/urlmon.spec b/dll/win32/urlmon/urlmon.spec index 9d3de3a61dc..58b3f330f59 100644 --- a/dll/win32/urlmon/urlmon.spec +++ b/dll/win32/urlmon/urlmon.spec @@ -18,6 +18,7 @@ @ stdcall CoInternetCreateZoneManager(ptr ptr long) @ stub CoInternetGetProtocolFlags @ stdcall CoInternetGetSecurityUrl(ptr ptr long long) +@ stdcall CoInternetGetSecurityUrlEx(ptr ptr long long) @ stdcall CoInternetGetSession(long ptr long) @ stdcall CoInternetIsFeatureEnabled(long long) @ stdcall CoInternetParseUrl(wstr long long wstr long ptr long) @@ -57,6 +58,7 @@ @ stdcall HlinkNavigateString(ptr wstr) @ stdcall HlinkSimpleNavigateToMoniker(ptr wstr wstr ptr ptr ptr long long) @ stdcall HlinkSimpleNavigateToString(wstr wstr wstr ptr ptr ptr long long) +@ stub IEInstallScope @ stdcall IsAsyncMoniker(ptr) @ stdcall IsLoggingEnabledA(str) @ stdcall IsLoggingEnabledW(wstr) @@ -89,3 +91,6 @@ @ stdcall UrlMkSetSessionOption(long ptr long long) @ stub WriteHitLogging @ stub ZonesReInit + +410 stdcall @(long long) URLMON_410 +423 stdcall @(long long long long) URLMON_423 diff --git a/dll/win32/urlmon/urlmon_main.c b/dll/win32/urlmon/urlmon_main.c index 6ecd1dec954..01442c1f5c5 100644 --- a/dll/win32/urlmon/urlmon_main.c +++ b/dll/win32/urlmon/urlmon_main.c @@ -26,6 +26,8 @@ #define NO_SHLWAPI_REG #include "shlwapi.h" +#include "advpub.h" + #include "wine/debug.h" #include "urlmon.h" @@ -187,12 +189,15 @@ HRESULT WINAPI DllCanUnloadNow(void) * Urlmon ClassFactory */ typedef struct { - const IClassFactoryVtbl *lpClassFactoryVtbl; + IClassFactory IClassFactory_iface; HRESULT (*pfnCreateInstance)(IUnknown *pUnkOuter, LPVOID *ppObj); } ClassFactory; -#define CLASSFACTORY(x) ((IClassFactory*) &(x)->lpClassFactoryVtbl) +static inline ClassFactory *impl_from_IClassFactory(IClassFactory *iface) +{ + return CONTAINING_RECORD(iface, ClassFactory, IClassFactory_iface); +} static HRESULT WINAPI CF_QueryInterface(IClassFactory *iface, REFIID riid, LPVOID *ppv) { @@ -231,7 +236,7 @@ static ULONG WINAPI CF_Release(IClassFactory *iface) static HRESULT WINAPI CF_CreateInstance(IClassFactory *iface, IUnknown *pOuter, REFIID riid, LPVOID *ppobj) { - ClassFactory *This = (ClassFactory*)iface; + ClassFactory *This = impl_from_IClassFactory(iface); HRESULT hres; LPUNKNOWN punk; @@ -266,27 +271,27 @@ static const IClassFactoryVtbl ClassFactoryVtbl = CF_LockServer }; -static const ClassFactory FileProtocolCF = - { &ClassFactoryVtbl, FileProtocol_Construct}; -static const ClassFactory FtpProtocolCF = - { &ClassFactoryVtbl, FtpProtocol_Construct}; -static const ClassFactory GopherProtocolCF = - { &ClassFactoryVtbl, GopherProtocol_Construct}; -static const ClassFactory HttpProtocolCF = - { &ClassFactoryVtbl, HttpProtocol_Construct}; -static const ClassFactory HttpSProtocolCF = - { &ClassFactoryVtbl, HttpSProtocol_Construct}; -static const ClassFactory MkProtocolCF = - { &ClassFactoryVtbl, MkProtocol_Construct}; -static const ClassFactory SecurityManagerCF = - { &ClassFactoryVtbl, SecManagerImpl_Construct}; -static const ClassFactory ZoneManagerCF = - { &ClassFactoryVtbl, ZoneMgrImpl_Construct}; -static const ClassFactory StdURLMonikerCF = - { &ClassFactoryVtbl, StdURLMoniker_Construct}; -static const ClassFactory MimeFilterCF = - { &ClassFactoryVtbl, MimeFilter_Construct}; - +static ClassFactory FileProtocolCF = + { { &ClassFactoryVtbl }, FileProtocol_Construct}; +static ClassFactory FtpProtocolCF = + { { &ClassFactoryVtbl }, FtpProtocol_Construct}; +static ClassFactory GopherProtocolCF = + { { &ClassFactoryVtbl }, GopherProtocol_Construct}; +static ClassFactory HttpProtocolCF = + { { &ClassFactoryVtbl }, HttpProtocol_Construct}; +static ClassFactory HttpSProtocolCF = + { { &ClassFactoryVtbl }, HttpSProtocol_Construct}; +static ClassFactory MkProtocolCF = + { { &ClassFactoryVtbl }, MkProtocol_Construct}; +static ClassFactory SecurityManagerCF = + { { &ClassFactoryVtbl }, SecManagerImpl_Construct}; +static ClassFactory ZoneManagerCF = + { { &ClassFactoryVtbl }, ZoneMgrImpl_Construct}; +static ClassFactory StdURLMonikerCF = + { { &ClassFactoryVtbl }, StdURLMoniker_Construct}; +static ClassFactory MimeFilterCF = + { { &ClassFactoryVtbl }, MimeFilter_Construct}; + struct object_creation_info { const CLSID *clsid; @@ -303,16 +308,16 @@ static const WCHAR wszMk[] = {'m','k',0}; static const struct object_creation_info object_creation[] = { - { &CLSID_FileProtocol, CLASSFACTORY(&FileProtocolCF), wszFile }, - { &CLSID_FtpProtocol, CLASSFACTORY(&FtpProtocolCF), wszFtp }, - { &CLSID_GopherProtocol, CLASSFACTORY(&GopherProtocolCF), wszGopher }, - { &CLSID_HttpProtocol, CLASSFACTORY(&HttpProtocolCF), wszHttp }, - { &CLSID_HttpSProtocol, CLASSFACTORY(&HttpSProtocolCF), wszHttps }, - { &CLSID_MkProtocol, CLASSFACTORY(&MkProtocolCF), wszMk }, - { &CLSID_InternetSecurityManager, CLASSFACTORY(&SecurityManagerCF), NULL }, - { &CLSID_InternetZoneManager, CLASSFACTORY(&ZoneManagerCF), NULL }, - { &CLSID_StdURLMoniker, CLASSFACTORY(&StdURLMonikerCF), NULL }, - { &CLSID_DeCompMimeFilter, CLASSFACTORY(&MimeFilterCF), NULL } + { &CLSID_FileProtocol, &FileProtocolCF.IClassFactory_iface, wszFile }, + { &CLSID_FtpProtocol, &FtpProtocolCF.IClassFactory_iface, wszFtp }, + { &CLSID_GopherProtocol, &GopherProtocolCF.IClassFactory_iface, wszGopher }, + { &CLSID_HttpProtocol, &HttpProtocolCF.IClassFactory_iface, wszHttp }, + { &CLSID_HttpSProtocol, &HttpSProtocolCF.IClassFactory_iface, wszHttps }, + { &CLSID_MkProtocol, &MkProtocolCF.IClassFactory_iface, wszMk }, + { &CLSID_InternetSecurityManager, &SecurityManagerCF.IClassFactory_iface, NULL }, + { &CLSID_InternetZoneManager, &ZoneManagerCF.IClassFactory_iface, NULL }, + { &CLSID_StdURLMoniker, &StdURLMonikerCF.IClassFactory_iface, NULL }, + { &CLSID_DeCompMimeFilter, &MimeFilterCF.IClassFactory_iface, NULL } }; static void init_session(BOOL init) @@ -366,6 +371,44 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv) return CLASS_E_CLASSNOTAVAILABLE; } +static HRESULT register_inf(BOOL doregister) +{ + HRESULT (WINAPI *pRegInstall)(HMODULE hm, LPCSTR pszSection, const STRTABLEA* pstTable); + HMODULE hAdvpack; + + static const WCHAR wszAdvpack[] = {'a','d','v','p','a','c','k','.','d','l','l',0}; + + hAdvpack = LoadLibraryW(wszAdvpack); + pRegInstall = (void *)GetProcAddress(hAdvpack, "RegInstall"); + + return pRegInstall(hProxyDll, doregister ? "RegisterDll" : "UnregisterDll", NULL); +} + +/*********************************************************************** + * DllRegisterServer (URLMON.@) + */ +HRESULT WINAPI DllRegisterServer(void) +{ + HRESULT hr; + + TRACE("\n"); + + hr = URLMON_DllRegisterServer(); + return SUCCEEDED(hr) ? register_inf(TRUE) : hr; +} + +/*********************************************************************** + * DllUnregisterServer (URLMON.@) + */ +HRESULT WINAPI DllUnregisterServer(void) +{ + HRESULT hr; + + TRACE("\n"); + + hr = URLMON_DllUnregisterServer(); + return SUCCEEDED(hr) ? register_inf(FALSE) : hr; +} /*********************************************************************** * DllRegisterServerEx (URLMON.@) @@ -383,7 +426,7 @@ HRESULT WINAPI DllRegisterServerEx(void) * Determines if a specified string is a valid URL. * * PARAMS - * pBC [I] ignored, must be NULL. + * pBC [I] ignored, should be NULL. * szURL [I] string that represents the URL in question. * dwReserved [I] reserved and must be zero. * @@ -399,7 +442,7 @@ HRESULT WINAPI IsValidURL(LPBC pBC, LPCWSTR szURL, DWORD dwReserved) { FIXME("(%p, %s, %d): stub\n", pBC, debugstr_w(szURL), dwReserved); - if (pBC || dwReserved || !szURL) + if (dwReserved || !szURL) return E_INVALIDARG; return S_OK; @@ -862,3 +905,23 @@ BOOL WINAPI IsLoggingEnabledW(LPCWSTR url) FIXME("(%s)\n", debugstr_w(url)); return FALSE; } + +/*********************************************************************** + * URLMON_410 (URLMON.410) + * Undocumented, added in IE8 + */ +BOOL WINAPI URLMON_410(DWORD unknown1, DWORD unknown2) +{ + FIXME("stub: %d %d\n", unknown1, unknown2); + return FALSE; +} + +/*********************************************************************** + * URLMON_423 (URLMON.423) + * Undocumented, added in IE8 + */ +BOOL WINAPI URLMON_423(DWORD unknown1, DWORD unknown2, DWORD unknown3, DWORD unknown4) +{ + FIXME("stub: %d %d %d %d\n", unknown1, unknown2, unknown3, unknown4); + return FALSE; +} diff --git a/dll/win32/urlmon/urlmon_main.h b/dll/win32/urlmon/urlmon_main.h index ea33f152bae..b60d6787a7b 100644 --- a/dll/win32/urlmon/urlmon_main.h +++ b/dll/win32/urlmon/urlmon_main.h @@ -37,16 +37,16 @@ #include "wine/list.h" extern HINSTANCE hProxyDll DECLSPEC_HIDDEN; -extern HRESULT SecManagerImpl_Construct(IUnknown *pUnkOuter, LPVOID *ppobj); -extern HRESULT ZoneMgrImpl_Construct(IUnknown *pUnkOuter, LPVOID *ppobj); -extern HRESULT StdURLMoniker_Construct(IUnknown *pUnkOuter, LPVOID *ppobj); -extern HRESULT FileProtocol_Construct(IUnknown *pUnkOuter, LPVOID *ppobj); -extern HRESULT HttpProtocol_Construct(IUnknown *pUnkOuter, LPVOID *ppobj); -extern HRESULT HttpSProtocol_Construct(IUnknown *pUnkOuter, LPVOID *ppobj); -extern HRESULT FtpProtocol_Construct(IUnknown *pUnkOuter, LPVOID *ppobj); -extern HRESULT GopherProtocol_Construct(IUnknown *pUnkOuter, LPVOID *ppobj); -extern HRESULT MkProtocol_Construct(IUnknown *pUnkOuter, LPVOID *ppobj); -extern HRESULT MimeFilter_Construct(IUnknown *pUnkOuter, LPVOID *ppobj); +extern HRESULT SecManagerImpl_Construct(IUnknown *pUnkOuter, LPVOID *ppobj) DECLSPEC_HIDDEN; +extern HRESULT ZoneMgrImpl_Construct(IUnknown *pUnkOuter, LPVOID *ppobj) DECLSPEC_HIDDEN; +extern HRESULT StdURLMoniker_Construct(IUnknown *pUnkOuter, LPVOID *ppobj) DECLSPEC_HIDDEN; +extern HRESULT FileProtocol_Construct(IUnknown *pUnkOuter, LPVOID *ppobj) DECLSPEC_HIDDEN; +extern HRESULT HttpProtocol_Construct(IUnknown *pUnkOuter, LPVOID *ppobj) DECLSPEC_HIDDEN; +extern HRESULT HttpSProtocol_Construct(IUnknown *pUnkOuter, LPVOID *ppobj) DECLSPEC_HIDDEN; +extern HRESULT FtpProtocol_Construct(IUnknown *pUnkOuter, LPVOID *ppobj) DECLSPEC_HIDDEN; +extern HRESULT GopherProtocol_Construct(IUnknown *pUnkOuter, LPVOID *ppobj) DECLSPEC_HIDDEN; +extern HRESULT MkProtocol_Construct(IUnknown *pUnkOuter, LPVOID *ppobj) DECLSPEC_HIDDEN; +extern HRESULT MimeFilter_Construct(IUnknown *pUnkOuter, LPVOID *ppobj) DECLSPEC_HIDDEN; extern BOOL WINAPI URLMON_DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) DECLSPEC_HIDDEN; extern HRESULT WINAPI URLMON_DllGetClassObject(REFCLSID rclsid, REFIID iid,LPVOID *ppv) DECLSPEC_HIDDEN; @@ -58,30 +58,24 @@ extern GUID const CLSID_PSFactoryBuffer DECLSPEC_HIDDEN; /********************************************************************** * Dll lifetime tracking declaration for urlmon.dll */ -extern LONG URLMON_refCount; +extern LONG URLMON_refCount DECLSPEC_HIDDEN; static inline void URLMON_LockModule(void) { InterlockedIncrement( &URLMON_refCount ); } static inline void URLMON_UnlockModule(void) { InterlockedDecrement( &URLMON_refCount ); } -#define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc))) -#define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface) +IInternetProtocolInfo *get_protocol_info(LPCWSTR) DECLSPEC_HIDDEN; +HRESULT get_protocol_handler(IUri*,CLSID*,BOOL*,IClassFactory**) DECLSPEC_HIDDEN; +IInternetProtocol *get_mime_filter(LPCWSTR) DECLSPEC_HIDDEN; +BOOL is_registered_protocol(LPCWSTR) DECLSPEC_HIDDEN; +void register_urlmon_namespace(IClassFactory*,REFIID,LPCWSTR,BOOL) DECLSPEC_HIDDEN; +HINTERNET get_internet_session(IInternetBindInfo*) DECLSPEC_HIDDEN; +LPWSTR get_useragent(void) DECLSPEC_HIDDEN; +void free_session(void) DECLSPEC_HIDDEN; -IInternetProtocolInfo *get_protocol_info(LPCWSTR); -HRESULT get_protocol_handler(IUri*,CLSID*,BOOL*,IClassFactory**); -IInternetProtocol *get_mime_filter(LPCWSTR); -BOOL is_registered_protocol(LPCWSTR); -void register_urlmon_namespace(IClassFactory*,REFIID,LPCWSTR,BOOL); -HINTERNET get_internet_session(IInternetBindInfo*); -LPWSTR get_useragent(void); -void free_session(void); +HRESULT bind_to_storage(IUri*,IBindCtx*,REFIID,void**) DECLSPEC_HIDDEN; +HRESULT bind_to_object(IMoniker*,IUri*,IBindCtx*,REFIID,void**ppv) DECLSPEC_HIDDEN; -HRESULT bind_to_storage(IUri*,IBindCtx*,REFIID,void**); -HRESULT bind_to_object(IMoniker*,IUri*,IBindCtx*,REFIID,void**ppv); - -HRESULT create_binding_protocol(BOOL,IInternetProtocolEx**); -void set_binding_sink(IInternetProtocolEx*,IInternetProtocolSink*,IInternetBindInfo*); -IWinInetInfo *get_wininet_info(IInternetProtocolEx*); -HRESULT create_default_callback(IBindStatusCallback**); -HRESULT wrap_callback(IBindStatusCallback*,IBindStatusCallback**); +HRESULT create_default_callback(IBindStatusCallback**) DECLSPEC_HIDDEN; +HRESULT wrap_callback(IBindStatusCallback*,IBindStatusCallback**) DECLSPEC_HIDDEN; typedef struct ProtocolVtbl ProtocolVtbl; @@ -113,19 +107,53 @@ struct ProtocolVtbl { HRESULT (*end_request)(Protocol*); HRESULT (*start_downloading)(Protocol*); void (*close_connection)(Protocol*); + void (*on_error)(Protocol*,DWORD); }; -HRESULT protocol_start(Protocol*,IInternetProtocol*,IUri*,IInternetProtocolSink*,IInternetBindInfo*); -HRESULT protocol_continue(Protocol*,PROTOCOLDATA*); -HRESULT protocol_read(Protocol*,void*,ULONG,ULONG*); -HRESULT protocol_lock_request(Protocol*); -HRESULT protocol_unlock_request(Protocol*); -HRESULT protocol_abort(Protocol*,HRESULT); -void protocol_close_connection(Protocol*); +/* Flags are needed for, among other things, return HRESULTs from the Read function + * to conform to native. For example, Read returns: + * + * 1. E_PENDING if called before the request has completed, + * (flags = 0) + * 2. S_FALSE after all data has been read and S_OK has been reported, + * (flags = FLAG_REQUEST_COMPLETE | FLAG_ALL_DATA_READ | FLAG_RESULT_REPORTED) + * 3. INET_E_DATA_NOT_AVAILABLE if InternetQueryDataAvailable fails. The first time + * this occurs, INET_E_DATA_NOT_AVAILABLE will also be reported to the sink, + * (flags = FLAG_REQUEST_COMPLETE) + * but upon subsequent calls to Read no reporting will take place, yet + * InternetQueryDataAvailable will still be called, and, on failure, + * INET_E_DATA_NOT_AVAILABLE will still be returned. + * (flags = FLAG_REQUEST_COMPLETE | FLAG_RESULT_REPORTED) + * + * FLAG_FIRST_DATA_REPORTED and FLAG_LAST_DATA_REPORTED are needed for proper + * ReportData reporting. For example, if OnResponse returns S_OK, Continue will + * report BSCF_FIRSTDATANOTIFICATION, and when all data has been read Read will + * report BSCF_INTERMEDIATEDATANOTIFICATION|BSCF_LASTDATANOTIFICATION. However, + * if OnResponse does not return S_OK, Continue will not report data, and Read + * will report BSCF_FIRSTDATANOTIFICATION|BSCF_LASTDATANOTIFICATION when all + * data has been read. + */ +#define FLAG_REQUEST_COMPLETE 0x0001 +#define FLAG_FIRST_CONTINUE_COMPLETE 0x0002 +#define FLAG_FIRST_DATA_REPORTED 0x0004 +#define FLAG_ALL_DATA_READ 0x0008 +#define FLAG_LAST_DATA_REPORTED 0x0010 +#define FLAG_RESULT_REPORTED 0x0020 +#define FLAG_ERROR 0x0040 + +HRESULT protocol_start(Protocol*,IInternetProtocol*,IUri*,IInternetProtocolSink*,IInternetBindInfo*) DECLSPEC_HIDDEN; +HRESULT protocol_continue(Protocol*,PROTOCOLDATA*) DECLSPEC_HIDDEN; +HRESULT protocol_read(Protocol*,void*,ULONG,ULONG*) DECLSPEC_HIDDEN; +HRESULT protocol_lock_request(Protocol*) DECLSPEC_HIDDEN; +HRESULT protocol_unlock_request(Protocol*) DECLSPEC_HIDDEN; +HRESULT protocol_abort(Protocol*,HRESULT) DECLSPEC_HIDDEN; +void protocol_close_connection(Protocol*) DECLSPEC_HIDDEN; + +void find_domain_name(const WCHAR*,DWORD,INT*) DECLSPEC_HIDDEN; typedef struct { - const IInternetProtocolVtbl *lpIInternetProtocolVtbl; - const IInternetProtocolSinkVtbl *lpIInternetProtocolSinkVtbl; + IInternetProtocol IInternetProtocol_iface; + IInternetProtocolSink IInternetProtocolSink_iface; LONG ref; @@ -133,10 +161,59 @@ typedef struct { IInternetProtocol *protocol; } ProtocolProxy; -#define PROTOCOL(x) ((IInternetProtocol*) &(x)->lpIInternetProtocolVtbl) -#define PROTSINK(x) ((IInternetProtocolSink*) &(x)->lpIInternetProtocolSinkVtbl) +HRESULT create_protocol_proxy(IInternetProtocol*,IInternetProtocolSink*,ProtocolProxy**) DECLSPEC_HIDDEN; -HRESULT create_protocol_proxy(IInternetProtocol*,IInternetProtocolSink*,ProtocolProxy**); +typedef struct _task_header_t task_header_t; + +typedef struct { + IInternetProtocolEx IInternetProtocolEx_iface; + IInternetBindInfo IInternetBindInfo_iface; + IInternetPriority IInternetPriority_iface; + IServiceProvider IServiceProvider_iface; + IInternetProtocolSink IInternetProtocolSink_iface; + IWinInetHttpInfo IWinInetHttpInfo_iface; + + LONG ref; + + IInternetProtocol *protocol; + IInternetBindInfo *bind_info; + IInternetProtocolSink *protocol_sink; + IServiceProvider *service_provider; + IWinInetInfo *wininet_info; + IWinInetHttpInfo *wininet_http_info; + + struct { + IInternetProtocol IInternetProtocol_iface; + } default_protocol_handler; + IInternetProtocol *protocol_handler; + + LONG priority; + + BOOL reported_result; + BOOL reported_mime; + BOOL from_urlmon; + DWORD pi; + + DWORD bscf; + ULONG progress; + ULONG progress_max; + + DWORD apartment_thread; + HWND notif_hwnd; + DWORD continue_call; + + CRITICAL_SECTION section; + task_header_t *task_queue_head, *task_queue_tail; + + BYTE *buf; + DWORD buf_size; + LPWSTR mime; + IUri *uri; + ProtocolProxy *filter_proxy; +} BindProtocol; + +HRESULT create_binding_protocol(BOOL,BindProtocol**) DECLSPEC_HIDDEN; +void set_binding_sink(BindProtocol*,IInternetProtocolSink*,IInternetBindInfo*) DECLSPEC_HIDDEN; typedef struct { HWND notif_hwnd; @@ -145,10 +222,10 @@ typedef struct { struct list entry; } tls_data_t; -tls_data_t *get_tls_data(void); +tls_data_t *get_tls_data(void) DECLSPEC_HIDDEN; -HWND get_notif_hwnd(void); -void release_notif_hwnd(HWND); +HWND get_notif_hwnd(void) DECLSPEC_HIDDEN; +void release_notif_hwnd(HWND) DECLSPEC_HIDDEN; static inline void *heap_alloc(size_t len) { diff --git a/dll/win32/urlmon/urlmon_urlmon.idl b/dll/win32/urlmon/urlmon_urlmon.idl index d45ba07e456..3ee8688c897 100644 --- a/dll/win32/urlmon/urlmon_urlmon.idl +++ b/dll/win32/urlmon/urlmon_urlmon.idl @@ -17,3 +17,97 @@ */ #include "urlmon.idl" + +#ifndef __WIDL__ +#define threading(model) +#define progid(str) +#define vi_progid(str) +#endif + +#ifndef __midl +[ + helpstring("URL Moniker"), + threading(apartment), + uuid(79eac9e0-baf9-11ce-8c82-00aa004ba90b) +] +coclass StdURLMoniker { interface IMoniker; } +#endif + +[ + helpstring("http: Asynchronous Pluggable Protocol Handler"), + threading(apartment), + uuid(79eac9e2-baf9-11ce-8c82-00aa004ba90b) +] +coclass HttpProtocol { interface IInternetProtocolEx; interface IInternetPriority; } + +[ + helpstring("ftp: Asynchronous Pluggable Protocol Handler"), + threading(apartment), + uuid(79eac9e3-baf9-11ce-8c82-00aa004ba90b) +] +coclass FtpProtocol { interface IInternetProtocolEx; interface IInternetPriority; } + +[ + helpstring("gopher: Asynchronous Pluggable Protocol Handler"), + threading(apartment), + uuid(79eac9e4-baf9-11ce-8c82-00aa004ba90b) +] +coclass GopherProtocol { interface IInternetProtocolEx; interface IInternetPriority; } + +[ + helpstring("https: Asynchronous Pluggable Protocol Handler"), + threading(apartment), + uuid(79eac9e5-baf9-11ce-8c82-00aa004ba90b) +] +coclass HttpsProtocol { interface IInternetProtocolEx; interface IInternetPriority; } + +[ + helpstring("mk: Asynchronous Pluggable Protocol Handler"), + threading(apartment), + uuid(79eac9e6-baf9-11ce-8c82-00aa004ba90b) +] +coclass MkProtocol { interface IInternetProtocolEx; interface IInternetPriority; } + +#ifndef __midl +[ + helpstring("file:, local: Asynchronous Pluggable Protocol Handler"), + threading(apartment), + uuid(79eac9e7-baf9-11ce-8c82-00aa004ba90b) +] +coclass FileProtocol { interface IInternetProtocolEx; interface IInternetPriority; } +#endif + +[ + helpstring("CDL: Asynchronous Pluggable Protocol Handler"), + threading(apartment), + uuid(3dd53d40-7b8b-11d0-b013-00aa0059ce02) +] +coclass CdlProtocol { interface IInternetProtocolEx; interface IInternetPriority; } + +[ + helpstring("Security Manager"), + threading(both), + uuid(7b8a2d94-0ac9-11d1-896c-00c04fb6bfc4) +] +coclass InternetSecurityManager { interface IInternetSecurityManager; } + +[ + helpstring("URL Zone Manager"), + threading(both), + uuid(7b8a2d95-0ac9-11d1-896c-00c04fb6bfc4) +] +coclass InternetZoneManager { interface IInternetZoneManagerEx2; } + +[ + helpstring("URLMoniker ProxyStub Factory"), + threading(apartment), + uuid(79eac9f1-baf9-11ce-8c82-00aa004ba90b) +] +coclass PSFactoryBuffer { interface IPSFactoryBuffer; } + +[ + helpstring("AP lzdhtml encoding/decoding Filter"), + threading(apartment), + uuid(8f6b0360-b80d-11d0-a9b3-006097942311) +] +coclass DeCompMimeFilter { interface IInternetProtocol; interface IInternetProtocolSink; } diff --git a/dll/win32/user32/CMakeLists.txt b/dll/win32/user32/CMakeLists.txt index c31d3554b0d..d40679495f9 100644 --- a/dll/win32/user32/CMakeLists.txt +++ b/dll/win32/user32/CMakeLists.txt @@ -3,8 +3,6 @@ set_unicode() spec2def(user32.dll user32.spec) -add_definitions(-D_DLL -D__USE_CRTIMP) - include_directories( BEFORE ${REACTOS_SOURCE_DIR}/include/reactos/wine ${REACTOS_SOURCE_DIR}/include/reactos/subsys @@ -67,9 +65,7 @@ list(APPEND SOURCE user32.rc ${CMAKE_CURRENT_BINARY_DIR}/user32.def) -add_library(user32 SHARED - ${CMAKE_CURRENT_BINARY_DIR}/user32_user32.h.gch - ${SOURCE}) +add_library(user32 SHARED ${SOURCE}) set_module_type(user32 win32dll) @@ -79,7 +75,7 @@ target_link_libraries(user32 win32ksys ${PSEH_LIB}) -add_pch(user32 ${CMAKE_CURRENT_SOURCE_DIR}/include/user32.h ${SOURCE}) add_importlibs(user32 gdi32 advapi32 imm32 msvcrt kernel32 ntdll) +add_pch(user32 include/user32.h) add_cd_file(TARGET user32 DESTINATION reactos/system32 FOR all) add_importlib_target(user32.spec) diff --git a/dll/win32/user32/controls/icontitle.c b/dll/win32/user32/controls/icontitle.c index 6daf27ec125..edcdd6bbfc2 100644 --- a/dll/win32/user32/controls/icontitle.c +++ b/dll/win32/user32/controls/icontitle.c @@ -188,7 +188,6 @@ LRESULT WINAPI IconTitleWndProc( HWND hWnd, UINT msg, { HWND owner = GetWindow( hWnd, GW_OWNER ); - if (!IsWindow(hWnd)) return 0; #ifdef __REACTOS__ // Do this now, remove after Server side is fixed. PWND pWnd; @@ -202,6 +201,8 @@ LRESULT WINAPI IconTitleWndProc( HWND hWnd, UINT msg, } #endif + if (!IsWindow(hWnd)) return 0; + switch( msg ) { case WM_CREATE: diff --git a/dll/win32/user32/controls/scrollbar.c b/dll/win32/user32/controls/scrollbar.c index b238b64532a..5a37fa6b8c3 100644 --- a/dll/win32/user32/controls/scrollbar.c +++ b/dll/win32/user32/controls/scrollbar.c @@ -1243,11 +1243,6 @@ ScrollTrackScrollBar(HWND Wnd, INT SBType, POINT Pt) LRESULT WINAPI ScrollBarWndProc(WNDPROC DefWindowProc, HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam) { - if (! IsWindow(Wnd)) - { - return 0; - } - #ifdef __REACTOS__ // Do this now, remove after Server side is fixed. PWND pWnd; @@ -1261,6 +1256,11 @@ ScrollBarWndProc(WNDPROC DefWindowProc, HWND Wnd, UINT Msg, WPARAM wParam, LPARA } #endif + if (! IsWindow(Wnd)) + { + return 0; + } + switch (Msg) { case WM_CREATE: diff --git a/dll/win32/user32/controls/static.c b/dll/win32/user32/controls/static.c index d421eae4671..811bae47043 100644 --- a/dll/win32/user32/controls/static.c +++ b/dll/win32/user32/controls/static.c @@ -55,15 +55,13 @@ static void STATIC_PaintIconfn( HWND hwnd, HDC hdc, DWORD style ); static void STATIC_PaintBitmapfn( HWND hwnd, HDC hdc, DWORD style ); static void STATIC_PaintEnhMetafn( HWND hwnd, HDC hdc, DWORD style ); static void STATIC_PaintEtchedfn( HWND hwnd, HDC hdc, DWORD style ); -//static LRESULT WINAPI StaticWndProcA( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); -//static LRESULT WINAPI StaticWndProcW( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); static COLORREF color_3dshadow, color_3ddkshadow, color_3dhighlight; /* offsets for GetWindowLong for static private information */ #define HFONT_GWL_OFFSET 0 #define HICON_GWL_OFFSET (sizeof(HFONT)) -#define UISTATE_GWL_OFFSET (HICON_GWL_OFFSET+sizeof(HICON)) +#define UISTATE_GWL_OFFSET (HICON_GWL_OFFSET+sizeof(HICON)) // ReactOS: keep in sync with STATIC_UISTATE_GWL_OFFSET #define STATIC_EXTRA_BYTES (UISTATE_GWL_OFFSET + sizeof(LONG)) typedef void (*pfPaint)( HWND hwnd, HDC hdc, DWORD style ); @@ -107,40 +105,6 @@ const struct builtin_class_descr STATIC_builtin_class = 0 /* brush */ }; -/* REACTOS ONLY */ -static __inline void set_ui_state( HWND hwnd, LONG flags ) -{ - SetWindowLongPtrW( hwnd, UISTATE_GWL_OFFSET, flags ); -} - -static __inline LONG get_ui_state( HWND hwnd ) -{ - return GetWindowLongPtrW( hwnd, UISTATE_GWL_OFFSET ); -} - -/* Retrieve the UI state for the control */ -static BOOL STATIC_update_uistate(HWND hwnd, BOOL unicode) -{ - LONG flags, prevflags; - - if (unicode) - flags = DefWindowProcW(hwnd, WM_QUERYUISTATE, 0, 0); - else - flags = DefWindowProcA(hwnd, WM_QUERYUISTATE, 0, 0); - - prevflags = get_ui_state(hwnd); - - if (prevflags != flags) - { - set_ui_state(hwnd, flags); - return TRUE; - } - - return FALSE; -} - -/* END REACTOS ONLY */ - static void setup_clipping(HWND hwnd, HDC hdc, HRGN *orig) { RECT rc; @@ -172,28 +136,22 @@ static void restore_clipping(HDC hdc, HRGN hrgn) /*********************************************************************** * STATIC_SetIcon * - * Set the icon for an SS_ICON control. Modified for ReactOS + * Set the icon for an SS_ICON control. */ static HICON STATIC_SetIcon( HWND hwnd, HICON hicon, DWORD style ) { HICON prevIcon; - ICONINFO info; + SIZE size; if ((style & SS_TYPEMASK) != SS_ICON) return 0; - if (hicon && (!GetIconInfo(hicon, &info))) { - WARN("hicon != 0, but info == 0\n"); + if (hicon && !get_icon_size( hicon, &size )) + { + WARN("hicon != 0, but invalid\n"); return 0; } prevIcon = (HICON)SetWindowLongPtrW( hwnd, HICON_GWL_OFFSET, (LONG_PTR)hicon ); if (hicon && !(style & SS_CENTERIMAGE) && !(style & SS_REALSIZECONTROL)) { - BITMAP bm; - - if (!GetObjectW(info.hbmColor, sizeof(BITMAP), &bm)) - { - return 0; - } - /* Windows currently doesn't implement SS_RIGHTJUST */ /* if ((style & SS_RIGHTJUST) != 0) @@ -205,8 +163,7 @@ static HICON STATIC_SetIcon( HWND hwnd, HICON hicon, DWORD style ) } else */ { - SetWindowPos( hwnd, 0, 0, 0, bm.bmWidth, bm.bmHeight, - SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER ); + SetWindowPos( hwnd, 0, 0, 0, size.cx, size.cy, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER ); } } return prevIcon; @@ -215,7 +172,7 @@ static HICON STATIC_SetIcon( HWND hwnd, HICON hicon, DWORD style ) /*********************************************************************** * STATIC_SetBitmap * - * Set the bitmap for an SS_BITMAP control. Modified for ReactOS + * Set the bitmap for an SS_BITMAP control. */ static HBITMAP STATIC_SetBitmap( HWND hwnd, HBITMAP hBitmap, DWORD style ) { @@ -328,13 +285,13 @@ static HICON STATIC_LoadIconW( HINSTANCE hInstance, LPCWSTR name, DWORD style ) if (hInstance && ((ULONG_PTR)hInstance >> 16)) { - if ((style & SS_REALSIZEIMAGE) != 0) - hicon = LoadImageW(hInstance, name, IMAGE_ICON, 0, 0, LR_SHARED); - else - { - hicon = LoadIconW( hInstance, name ); - if (!hicon) hicon = LoadCursorW( hInstance, name ); - } + if ((style & SS_REALSIZEIMAGE) != 0) + hicon = LoadImageW(hInstance, name, IMAGE_ICON, 0, 0, LR_SHARED); + else + { + hicon = LoadIconW( hInstance, name ); + if (!hicon) hicon = LoadCursorW( hInstance, name ); + } } if (!hicon) hicon = LoadIconW( 0, name ); /* Windows doesn't try to load a standard cursor, @@ -343,7 +300,6 @@ static HICON STATIC_LoadIconW( HINSTANCE hInstance, LPCWSTR name, DWORD style ) return hicon; } - /*********************************************************************** * STATIC_TryPaintFcn * @@ -359,11 +315,11 @@ static VOID STATIC_TryPaintFcn(HWND hwnd, LONG full_style) { HDC hdc; HRGN hOrigClipping; - + hdc = GetDC( hwnd ); setup_clipping(hwnd, hdc, &hOrigClipping); (staticPaintFunc[style])( hwnd, hdc, full_style ); - restore_clipping(hdc, hOrigClipping); + restore_clipping(hdc, hOrigClipping); ReleaseDC( hwnd, hdc ); } } @@ -417,11 +373,10 @@ static BOOL hasTextStyle( DWORD style ) /*********************************************************************** * StaticWndProc_common */ -LRESULT WINAPI StaticWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam, - LPARAM lParam, BOOL unicode ) +LRESULT WINAPI StaticWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL unicode ) // ReactOS { LRESULT lResult = 0; - LONG full_style = GetWindowLongPtrW( hwnd, GWL_STYLE ); + LONG full_style = GetWindowLongW( hwnd, GWL_STYLE ); LONG style = full_style & SS_TYPEMASK; #ifdef __REACTOS__ PWND pWnd; @@ -433,8 +388,10 @@ LRESULT WINAPI StaticWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam, { NtUserSetWindowFNID(hwnd, FNID_STATIC); } - } -#endif + } +#endif + + if (!IsWindow( hwnd )) return 0; switch (uMsg) { @@ -444,7 +401,7 @@ LRESULT WINAPI StaticWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam, ERR("Unknown style 0x%02lx\n", style ); return -1; } - STATIC_update_uistate(hwnd, unicode); + STATIC_update_uistate(hwnd, unicode); // ReactOS r30727 STATIC_InitColours(); break; @@ -467,8 +424,8 @@ LRESULT WINAPI StaticWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam, DefWindowProcA(hwnd, uMsg, wParam, lParam); case WM_ERASEBKGND: - /* do all painting in WM_PAINT like Windows does */ - return 1; + /* do all painting in WM_PAINT like Windows does */ + return 1; case WM_PRINTCLIENT: case WM_PAINT: @@ -507,47 +464,31 @@ LRESULT WINAPI StaticWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam, case WM_NCCREATE: { - LPCSTR textA; - LPCWSTR textW; - HINSTANCE hInstance; + CREATESTRUCTW *cs = (CREATESTRUCTW *)lParam; if (full_style & SS_SUNKEN) - SetWindowLongPtrW( hwnd, GWL_EXSTYLE, - GetWindowLongPtrW( hwnd, GWL_EXSTYLE ) | WS_EX_STATICEDGE ); - - if(unicode) - { - textA = NULL; - textW = ((LPCREATESTRUCTW)lParam)->lpszName; - } - else - { - textA = ((LPCREATESTRUCTA)lParam)->lpszName; - textW = NULL; - - } - - hInstance = (HINSTANCE)GetWindowLongPtrW( hwnd, GWLP_HINSTANCE ); + SetWindowLongW( hwnd, GWL_EXSTYLE, + GetWindowLongW( hwnd, GWL_EXSTYLE ) | WS_EX_STATICEDGE ); switch (style) { case SS_ICON: { HICON hIcon; - if(unicode ) - hIcon = STATIC_LoadIconW(hInstance, textW, full_style); + if (unicode || IS_INTRESOURCE(cs->lpszName)) + hIcon = STATIC_LoadIconW(cs->hInstance, cs->lpszName, full_style); else - hIcon = STATIC_LoadIconA(hInstance, textA, full_style); + hIcon = STATIC_LoadIconA(cs->hInstance, (LPCSTR)cs->lpszName, full_style); STATIC_SetIcon(hwnd, hIcon, full_style); } break; case SS_BITMAP: - if ((ULONG_PTR)hInstance >> 16) + if ((ULONG_PTR)cs->hInstance >> 16) { HBITMAP hBitmap; - if(unicode) - hBitmap = LoadBitmapW(hInstance, textW); + if (unicode || IS_INTRESOURCE(cs->lpszName)) + hBitmap = LoadBitmapW(cs->hInstance, cs->lpszName); else - hBitmap = LoadBitmapA(hInstance, textA); + hBitmap = LoadBitmapA(cs->hInstance, (LPCSTR)cs->lpszName); STATIC_SetBitmap(hwnd, hBitmap, full_style); } break; @@ -616,16 +557,16 @@ LRESULT WINAPI StaticWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam, case STM_SETIMAGE: switch(wParam) { case IMAGE_BITMAP: - if (style != SS_BITMAP) return 0; + if (style != SS_BITMAP) return 0; // ReactOS r43158 lResult = (LRESULT)STATIC_SetBitmap( hwnd, (HBITMAP)lParam, full_style ); break; case IMAGE_ENHMETAFILE: - if (style != SS_ENHMETAFILE) return 0; + if (style != SS_ENHMETAFILE) return 0; // ReactOS r43158 lResult = (LRESULT)STATIC_SetEnhMetaFile( hwnd, (HENHMETAFILE)lParam, full_style ); break; case IMAGE_ICON: case IMAGE_CURSOR: - if (style != SS_ICON) return 0; + if (style != SS_ICON) return 0; // ReactOS r43158 lResult = (LRESULT)STATIC_SetIcon( hwnd, (HICON)lParam, full_style ); break; default: @@ -640,6 +581,7 @@ LRESULT WINAPI StaticWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam, STATIC_TryPaintFcn( hwnd, full_style ); break; +#ifdef __REACTOS__ case WM_UPDATEUISTATE: if (unicode) DefWindowProcW(hwnd, uMsg, wParam, lParam); @@ -651,6 +593,7 @@ LRESULT WINAPI StaticWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam, RedrawWindow( hwnd, NULL, 0, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_ALLCHILDREN ); } break; +#endif default: return unicode ? DefWindowProcW(hwnd, uMsg, wParam, lParam) : @@ -742,7 +685,7 @@ static void STATIC_PaintTextfn( HWND hwnd, HDC hdc, DWORD style ) if (style & SS_NOPREFIX) wFormat |= DT_NOPREFIX; - else if (get_ui_state(hwnd) & UISF_HIDEACCEL) + else if (GetWindowLongW(hwnd, UISTATE_GWL_OFFSET) & UISF_HIDEACCEL) // ReactOS r30727 wFormat |= DT_HIDEPREFIX; if ((style & SS_TYPEMASK) != SS_SIMPLE) @@ -778,9 +721,9 @@ static void STATIC_PaintTextfn( HWND hwnd, HDC hdc, DWORD style ) while ((len = InternalGetWindowText( hwnd, text, buf_size )) == buf_size - 1) { - buf_size *= 2; - if (!(text = HeapReAlloc( GetProcessHeap(), 0, text, buf_size * sizeof(WCHAR) ))) - goto no_TextOut; + buf_size *= 2; + if (!(text = HeapReAlloc( GetProcessHeap(), 0, text, buf_size * sizeof(WCHAR) ))) + goto no_TextOut; } if (!len) goto no_TextOut; @@ -848,6 +791,7 @@ static void STATIC_PaintRectfn( HWND hwnd, HDC hdc, DWORD style ) DeleteObject( hBrush ); } + static void STATIC_PaintIconfn( HWND hwnd, HDC hdc, DWORD style ) { RECT rc, iconRect; @@ -966,4 +910,3 @@ static void STATIC_PaintEtchedfn( HWND hwnd, HDC hdc, DWORD style ) break; } } - diff --git a/dll/win32/user32/include/ntwrapper.h b/dll/win32/user32/include/ntwrapper.h index b10b5e603f4..1751d189be4 100644 --- a/dll/win32/user32/include/ntwrapper.h +++ b/dll/win32/user32/include/ntwrapper.h @@ -234,30 +234,12 @@ ChangeClipboardChain(HWND hWndRemove, HWND hWndNewNext) return NtUserChangeClipboardChain(hWndRemove, hWndNewNext); } -EXTINLINE BOOL WINAPI -GetClipCursor(LPRECT lpRect) -{ - return NtUserGetClipCursor(lpRect); -} - EXTINLINE BOOL WINAPI GetCursorInfo(PCURSORINFO pci) { return NtUserGetCursorInfo(pci); } -EXTINLINE BOOL WINAPI -ClipCursor(CONST RECT *lpRect) -{ - return NtUserClipCursor((RECT *)lpRect); -} - -EXTINLINE HCURSOR WINAPI -SetCursor(HCURSOR hCursor) -{ - return NtUserSetCursor(hCursor); -} - EXTINLINE HDC WINAPI GetDC(HWND hWnd) { @@ -468,12 +450,6 @@ GetMenuItemRect(HWND hWnd, HMENU hMenu, UINT uItem, LPRECT lprcItem) return NtUserGetMenuItemRect(hWnd, hMenu, uItem, lprcItem); } -EXTINLINE BOOL WINAPI -HiliteMenuItem(HWND hwnd, HMENU hmenu, UINT uItemHilite, UINT uHilite) -{ - return NtUserHiliteMenuItem(hwnd, hmenu, uItemHilite, uHilite); -} - EXTINLINE BOOL WINAPI RemoveMenu(HMENU hMenu, UINT uPosition, UINT uFlags) { diff --git a/dll/win32/user32/include/user32.h b/dll/win32/user32/include/user32.h index f93eee60a27..d54f31a3e6b 100644 --- a/dll/win32/user32/include/user32.h +++ b/dll/win32/user32/include/user32.h @@ -22,8 +22,11 @@ #include #include #include -#include -#include +#include +#include +#include +#include +#include /* CSRSS Headers */ #include diff --git a/dll/win32/user32/include/user32p.h b/dll/win32/user32/include/user32p.h index 2f47ccc231c..eafd5c2d6ac 100644 --- a/dll/win32/user32/include/user32p.h +++ b/dll/win32/user32/include/user32p.h @@ -214,4 +214,28 @@ PVOID FASTCALL ValidateHandle(HANDLE, UINT); #define __EXCEPT_PAGE_FAULT else #define __ENDTRY +#define STATIC_UISTATE_GWL_OFFSET (sizeof(HFONT)+sizeof(HICON))// see UISTATE_GWL_OFFSET in static.c + +/* Retrieve the UI state for the control */ +static __inline BOOL STATIC_update_uistate(HWND hwnd, BOOL unicode) +{ + LONG flags, prevflags; + + if (unicode) + flags = DefWindowProcW(hwnd, WM_QUERYUISTATE, 0, 0); + else + flags = DefWindowProcA(hwnd, WM_QUERYUISTATE, 0, 0); + + prevflags = GetWindowLongW(hwnd, STATIC_UISTATE_GWL_OFFSET); + + if (prevflags != flags) + { + SetWindowLongW(hwnd, STATIC_UISTATE_GWL_OFFSET, flags); + return TRUE; + } + + return FALSE; +} + + /* EOF */ diff --git a/dll/win32/user32/lang/pl-PL.rc b/dll/win32/user32/lang/pl-PL.rc index 06e3ab6e319..7fe3b32b658 100644 --- a/dll/win32/user32/lang/pl-PL.rc +++ b/dll/win32/user32/lang/pl-PL.rc @@ -1,4 +1,7 @@ -//Polish translation by Sebastian Gasiorek +/* + * translated by Sebastian Gasiorek + * UTF-8 conversion by Caemyr (May, 2011) + */ LANGUAGE LANG_POLISH, SUBLANG_DEFAULT @@ -32,7 +35,7 @@ BEGIN MENUITEM "&Wytnij", WM_CUT MENUITEM "&Kopiuj", WM_COPY MENUITEM "Wkl&ej", WM_PASTE - MENUITEM "&Usuñ", WM_CLEAR + MENUITEM "&Usuń", WM_CLEAR MENUITEM SEPARATOR MENUITEM "Zaznacz w&szystko", EM_SETSEL END @@ -41,8 +44,8 @@ END SYSMENU MENU LOADONCALL MOVEABLE DISCARDABLE BEGIN - MENUITEM "&Przywróæ", 61728 - MENUITEM "Prz&enieœ", 61456 + MENUITEM "&Przywróć", 61728 + MENUITEM "Prz&enieś", 61456 MENUITEM "&Rozmiar", 61440 MENUITEM "&Minimalizuj", 61472 MENUITEM "Mak&symalizuj", 61488 @@ -57,22 +60,20 @@ END STRINGTABLE BEGIN - IDS_ERROR, "B³¹d" + IDS_ERROR, "Błąd" IDS_OK, "OK" IDS_CANCEL, "Anuluj" IDS_ABORT, "&Przerwij" - IDS_RETRY, "&Ponów próbê" + IDS_RETRY, "&Ponów próbę" IDS_IGNORE, "&Ignoruj" IDS_YES, "&Tak" IDS_NO, "&Nie" IDS_HELP, "Pomoc" - IDS_TRYAGAIN, "&Ponów próbê" + IDS_TRYAGAIN, "&Ponów próbę" IDS_CONTINUE, "&Kontynuuj" END STRINGTABLE BEGIN - IDS_MDI_MOREWINDOWS, "&Wiêcej okien..." + IDS_MDI_MOREWINDOWS, "&Więcej okien..." END - - diff --git a/dll/win32/user32/lang/sk-SK.rc b/dll/win32/user32/lang/sk-SK.rc index 0ffdafe27ea..04e87fadcb2 100644 --- a/dll/win32/user32/lang/sk-SK.rc +++ b/dll/win32/user32/lang/sk-SK.rc @@ -17,7 +17,7 @@ CAPTION "Výber okna" BEGIN LISTBOX 100, 5, 5, 210, 110, LBS_NOTIFY | LBS_NOINTEGRALHEIGHT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_HSCROLL PUSHBUTTON "&OK", 1, 60, 120, 40, 15, BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP - PUSHBUTTON "&Zruši", 2, 120, 120, 40, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP + PUSHBUTTON "&Zrušiť", 2, 120, 120, 40, 15, WS_CHILD | WS_VISIBLE | WS_TABSTOP END ///////////////////////////////////////////////////////////////////////////// @@ -29,27 +29,27 @@ EDITMENU MENU LOADONCALL MOVEABLE DISCARDABLE BEGIN POPUP "DUMMY" BEGIN - MENUITEM "&Spä", EM_UNDO + MENUITEM "&Späť", EM_UNDO MENUITEM SEPARATOR - MENUITEM "Vystri&hnú", WM_CUT - MENUITEM "&Kopírova", WM_COPY - MENUITEM "&Prilepi", WM_PASTE - MENUITEM "&Odstráni", WM_CLEAR + MENUITEM "Vystri&hnúť", WM_CUT + MENUITEM "&Kopírovať", WM_COPY + MENUITEM "&Prilepiť", WM_PASTE + MENUITEM "&Odstrániť", WM_CLEAR MENUITEM SEPARATOR - MENUITEM "Vybra &všetko", EM_SETSEL + MENUITEM "Vybrať &všetko", EM_SETSEL END END SYSMENU MENU LOADONCALL MOVEABLE DISCARDABLE BEGIN - MENUITEM "&Obnovi", SC_RESTORE - MENUITEM "&Premiestni", SC_MOVE - MENUITEM "&Ve¾kos", SC_SIZE - MENUITEM "&Minimalizova", SC_MINIMIZE - MENUITEM "M&aximalizova", SC_MAXIMIZE + MENUITEM "&Obnoviť", SC_RESTORE + MENUITEM "&Premiestniť", SC_MOVE + MENUITEM "&Veľkosť", SC_SIZE + MENUITEM "&Minimalizovať", SC_MINIMIZE + MENUITEM "M&aximalizovať", SC_MAXIMIZE MENUITEM SEPARATOR - MENUITEM "&Zavrie\tAlt-F4", SC_CLOSE + MENUITEM "&Zavrieť\tAlt-F4", SC_CLOSE END ///////////////////////////////////////////////////////////////////////////// @@ -61,15 +61,15 @@ STRINGTABLE BEGIN IDS_ERROR, "Chyba" IDS_OK, "OK" - IDS_CANCEL, "Zruši" - IDS_ABORT, "&Preruši" + IDS_CANCEL, "Zrušiť" + IDS_ABORT, "&Prerušiť" IDS_RETRY, "&Znova" - IDS_IGNORE, "&Ignorova" + IDS_IGNORE, "&Ignorovať" IDS_YES, "Án&o" IDS_NO, "&Nie" IDS_HELP, "Pomoc" - IDS_TRYAGAIN, "&Skúsi znova" - IDS_CONTINUE, "&Pokraèova" + IDS_TRYAGAIN, "&Skúsiť znova" + IDS_CONTINUE, "&Pokračovať" END STRINGTABLE diff --git a/dll/win32/user32/misc/display.c b/dll/win32/user32/misc/display.c index af430b3bbc1..2773cd09f51 100644 --- a/dll/win32/user32/misc/display.c +++ b/dll/win32/user32/misc/display.c @@ -83,7 +83,7 @@ WINAPI EnumDisplayDevicesW( LPCWSTR lpDevice, DWORD iDevNum, - PDISPLAY_DEVICE lpDisplayDevice, + PDISPLAY_DEVICEW lpDisplayDevice, DWORD dwFlags) { UNICODE_STRING Device; diff --git a/dll/win32/user32/user32.rc b/dll/win32/user32/user32.rc index 4734d6f89a5..51cecf10c97 100644 --- a/dll/win32/user32/user32.rc +++ b/dll/win32/user32/user32.rc @@ -1,7 +1,7 @@ /* $Id$ */ #include -#include "resource.h" +#include "include/resource.h" #define REACTOS_VERSION_DLL #define REACTOS_STR_FILE_DESCRIPTION "ReactOS User API Client Dll\0" diff --git a/dll/win32/user32/windows/cursoricon.c b/dll/win32/user32/windows/cursoricon.c index e3c5ca13b29..710f1011164 100644 --- a/dll/win32/user32/windows/cursoricon.c +++ b/dll/win32/user32/windows/cursoricon.c @@ -2201,6 +2201,12 @@ BOOL get_icon_size(HICON hIcon, SIZE *size) { size->cy /= 2; } + else + { + DeleteObject(info.hbmColor); + } + + DeleteObject(info.hbmMask); return TRUE; } diff --git a/dll/win32/user32/windows/defwnd.c b/dll/win32/user32/windows/defwnd.c index 8f7d809e8bf..e8fda2ffb07 100644 --- a/dll/win32/user32/windows/defwnd.c +++ b/dll/win32/user32/windows/defwnd.c @@ -753,6 +753,7 @@ DefWndTrackScrollBar(HWND Wnd, WPARAM wParam, POINT Pt) ScrollTrackScrollBar(Wnd, ScrollBar, Pt ); } +LRESULT WINAPI DoAppSwitch( WPARAM wParam, LPARAM lParam); LRESULT DefWndHandleSysCommand(HWND hWnd, WPARAM wParam, LPARAM lParam) @@ -824,7 +825,7 @@ DefWndHandleSysCommand(HWND hWnd, WPARAM wParam, LPARAM lParam) case SC_SCREENSAVE: NtUserMessageCall( hWnd, WM_SYSCOMMAND, wParam, lParam, (ULONG_PTR)&lResult, FNID_DEFWINDOWPROC, FALSE); break; -LRESULT WINAPI DoAppSwitch( WPARAM wParam, LPARAM lParam); + case SC_NEXTWINDOW: case SC_PREVWINDOW: DoAppSwitch( wParam, lParam); @@ -833,9 +834,10 @@ LRESULT WINAPI DoAppSwitch( WPARAM wParam, LPARAM lParam); case SC_HOTKEY: { HWND hwnd, hWndLastActive; + PWND pWnd; hwnd = (HWND)lParam; - PWND pWnd = ValidateHwnd(hwnd); + pWnd = ValidateHwnd(hwnd); if (pWnd) { hWndLastActive = GetLastActivePopup(hwnd); diff --git a/dll/win32/user32/windows/draw.c b/dll/win32/user32/windows/draw.c index 5ecf9a53462..ddf43102dd9 100644 --- a/dll/win32/user32/windows/draw.c +++ b/dll/win32/user32/windows/draw.c @@ -1,4 +1,4 @@ -/* +/* * ReactOS User32 Library * - Various drawing functions * @@ -1254,7 +1254,6 @@ IntDrawState(HDC hdc, HBRUSH hbr, DRAWSTATEPROC func, LPARAM lp, WPARAM wp, if(!cx || !cy) { SIZE s; - ICONINFO ici; BITMAP bm; switch(opcode) @@ -1270,12 +1269,8 @@ IntDrawState(HDC hdc, HBRUSH hbr, DRAWSTATEPROC func, LPARAM lp, WPARAM wp, break; case DST_ICON: - if(!GetIconInfo((HICON)lp, &ici)) + if(!get_icon_size((HICON)lp, &s)) return FALSE; - if(!GetObjectW(ici.hbmColor, sizeof(bm), &bm)) - return FALSE; - s.cx = bm.bmWidth; - s.cy = bm.bmHeight; break; case DST_BITMAP: diff --git a/dll/win32/user32/windows/input.c b/dll/win32/user32/windows/input.c index 9eadc0e81c2..b761d26760b 100644 --- a/dll/win32/user32/windows/input.c +++ b/dll/win32/user32/windows/input.c @@ -181,7 +181,6 @@ GetKeyNameTextW(LONG lParam, return NtUserGetKeyNameText( lParam, lpString, nSize ); } - /* * @implemented */ @@ -191,7 +190,6 @@ GetKeyState(int nVirtKey) return (SHORT) NtUserGetKeyState((DWORD) nVirtKey); } - /* * @implemented */ @@ -225,16 +223,23 @@ GetKeyboardType(int nTypeFlag) return (int)NtUserCallOneParam((DWORD_PTR) nTypeFlag, ONEPARAM_ROUTINE_GETKEYBOARDTYPE); } - /* * @implemented */ BOOL WINAPI GetLastInputInfo(PLASTINPUTINFO plii) { - return NtUserGetLastInputInfo(plii); -} + TRACE("%p\n", plii); + if (plii->cbSize != sizeof (*plii) ) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + plii->dwTime = gpsi->dwLastRITEventTickCount; + return TRUE; +} /* * @implemented @@ -248,7 +253,6 @@ LoadKeyboardLayoutA(LPCSTR pwszKLID, Flags); } - /* * @implemented */ @@ -263,7 +267,6 @@ LoadKeyboardLayoutW(LPCWSTR pwszKLID, Flags); } - /* * @implemented */ @@ -274,7 +277,6 @@ MapVirtualKeyA(UINT uCode, return MapVirtualKeyExA( uCode, uMapType, GetKeyboardLayout( 0 ) ); } - /* * @implemented */ diff --git a/dll/win32/user32/windows/menu.c b/dll/win32/user32/windows/menu.c index d6332ac5dcf..11b9b1f9500 100644 --- a/dll/win32/user32/windows/menu.c +++ b/dll/win32/user32/windows/menu.c @@ -1791,7 +1791,6 @@ MenuMoveSelection(HWND WndOwner, PROSMENUINFO MenuInfo, INT Offset) // LRESULT WINAPI PopupMenuWndProcA(HWND Wnd, UINT Message, WPARAM wParam, LPARAM lParam) { - TRACE("YES! hwnd=%x msg=0x%04x wp=0x%04lx lp=0x%08lx\n", Wnd, Message, wParam, lParam); #ifdef __REACTOS__ PWND pWnd; @@ -1805,6 +1804,8 @@ LRESULT WINAPI PopupMenuWndProcA(HWND Wnd, UINT Message, WPARAM wParam, LPARAM l } #endif + TRACE("YES! hwnd=%x msg=0x%04x wp=0x%04lx lp=0x%08lx\n", Wnd, Message, wParam, lParam); + switch(Message) { case WM_CREATE: @@ -1879,7 +1880,6 @@ LRESULT WINAPI PopupMenuWndProcA(HWND Wnd, UINT Message, WPARAM wParam, LPARAM l LRESULT WINAPI PopupMenuWndProcW(HWND Wnd, UINT Message, WPARAM wParam, LPARAM lParam) { - TRACE("hwnd=%x msg=0x%04x wp=0x%04lx lp=0x%08lx\n", Wnd, Message, wParam, lParam); #ifdef __REACTOS__ // Do this now, remove after Server side is fixed. PWND pWnd; @@ -1893,6 +1893,8 @@ PopupMenuWndProcW(HWND Wnd, UINT Message, WPARAM wParam, LPARAM lParam) } #endif + TRACE("hwnd=%x msg=0x%04x wp=0x%04lx lp=0x%08lx\n", Wnd, Message, wParam, lParam); + switch(Message) { case WM_CREATE: diff --git a/dll/win32/userenv/CMakeLists.txt b/dll/win32/userenv/CMakeLists.txt index 32d3bd41711..f9327fedf99 100644 --- a/dll/win32/userenv/CMakeLists.txt +++ b/dll/win32/userenv/CMakeLists.txt @@ -17,16 +17,14 @@ list(APPEND SOURCE ${CMAKE_CURRENT_BINARY_DIR}/userenv_stubs.c ${CMAKE_CURRENT_BINARY_DIR}/userenv.def) -add_library(userenv SHARED - ${CMAKE_CURRENT_BINARY_DIR}/userenv_precomp.h.gch - ${SOURCE}) +add_library(userenv SHARED ${SOURCE}) set_module_type(userenv win32dll) target_link_libraries(userenv uuid) add_importlibs(userenv advapi32 user32 msvcrt kernel32 ntdll) -add_pch(userenv ${CMAKE_CURRENT_SOURCE_DIR}/precomp.h ${SOURCE}) +add_pch(userenv precomp.h) add_cd_file(TARGET userenv DESTINATION reactos/system32 FOR all) add_importlib_target(userenv.spec) diff --git a/dll/win32/userenv/lang/pl-PL.rc b/dll/win32/userenv/lang/pl-PL.rc index a79db963e07..bfa5ab22ac3 100644 --- a/dll/win32/userenv/lang/pl-PL.rc +++ b/dll/win32/userenv/lang/pl-PL.rc @@ -15,10 +15,11 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * updated by Caemyr - Olaf Siejka (Jan, 2008) - * Use ReactOS forum PM or IRC to contact me - * http://www.reactos.org - * IRC: irc.freenode.net #reactos-pl; + * updated by Caemyr - Olaf Siejka (Jan, 2008) + * Use ReactOS forum PM or IRC to contact me + * http://www.reactos.org + * IRC: irc.freenode.net #reactos-pl; + * UTF-8 conversion by Caemyr (May, 2011) */ LANGUAGE LANG_POLISH, SUBLANG_DEFAULT @@ -31,7 +32,7 @@ BEGIN IDS_FAVORITES "Ulubione" IDS_STARTMENU "Menu Start" IDS_PROGRAMS "Menu Start\\Programy" - IDS_ADMINTOOLS "Menu Start\\Programy\\Narzdzia administracyjne" + IDS_ADMINTOOLS "Menu Start\\Programy\\Narzędzia administracyjne" IDS_STARTUP "Menu Start\\Programy\\Autostart" IDS_MYDOCUMENTS "Moje dokumenty" IDS_MYPICTURES "Moje dokumenty\\Moje obrazy" @@ -39,7 +40,7 @@ BEGIN IDS_MYVIDEOS "Moje dokumenty\\Moje wideo" IDS_TEMPLATES "Szablony" IDS_RECENT "Ostatnie" - IDS_SENDTO "WylijDo" + IDS_SENDTO "Wyślij Do" IDS_PRINTHOOD "Drukarki" IDS_NETHOOD "Sieci" IDS_LOCALSETTINGS "Ustawienia lokalne" diff --git a/dll/win32/userenv/lang/ru-RU.rc b/dll/win32/userenv/lang/ru-RU.rc index 6268a4a5287..b177d3d43aa 100644 --- a/dll/win32/userenv/lang/ru-RU.rc +++ b/dll/win32/userenv/lang/ru-RU.rc @@ -22,19 +22,19 @@ STRINGTABLE BEGIN IDS_PROFILEPATH "%SystemDrive%\\Documents and Settings" IDS_APPDATA "Application Data" - IDS_DESKTOP " " - IDS_FAVORITES "" - IDS_STARTMENU " " - IDS_PROGRAMS " \\" - IDS_ADMINTOOLS " \\\\" - IDS_STARTUP " \\\\" - IDS_MYDOCUMENTS " " - IDS_MYPICTURES " \\ " - IDS_MYMUSIC " \\ " - IDS_MYVIDEOS " \\ " - IDS_TEMPLATES "" + IDS_DESKTOP "Рабочий стол" + IDS_FAVORITES "Избранное" + IDS_STARTMENU "Главное меню" + IDS_PROGRAMS "Главное меню\\Программы" + IDS_ADMINTOOLS "Главное меню\\Программы\\Служебные" + IDS_STARTUP "Главное меню\\Программы\\Автозапуск" + IDS_MYDOCUMENTS "Мои документы" + IDS_MYPICTURES "Мои документы\\Мои рисунки" + IDS_MYMUSIC "Мои документы\\Моя музыка" + IDS_MYVIDEOS "Мои документы\\Мои видеозаписи" + IDS_TEMPLATES "Шаблоны" IDS_RECENT "Recent" - IDS_SENDTO "" + IDS_SENDTO "Отправить" IDS_PRINTHOOD "PrintHood" IDS_NETHOOD "NetHood" IDS_LOCALSETTINGS "Local Settings" diff --git a/dll/win32/userenv/lang/uk-UA.rc b/dll/win32/userenv/lang/uk-UA.rc index 7b2d44e4e28..25c1cd45a8b 100644 --- a/dll/win32/userenv/lang/uk-UA.rc +++ b/dll/win32/userenv/lang/uk-UA.rc @@ -23,18 +23,18 @@ BEGIN IDS_PROFILEPATH "%SystemDrive%\\Documents and Settings" IDS_APPDATA "Application Data" IDS_DESKTOP "Desktop" - IDS_FAVORITES "" - IDS_STARTMENU " " - IDS_PROGRAMS " \\" - IDS_ADMINTOOLS " \\\\" - IDS_STARTUP " \\\\" - IDS_MYDOCUMENTS " " - IDS_MYPICTURES " \\ " - IDS_MYMUSIC " \\ " - IDS_MYVIDEOS " \\ " - IDS_TEMPLATES "" + IDS_FAVORITES "Обране" + IDS_STARTMENU "Головне меню" + IDS_PROGRAMS "Головне меню\\Програми" + IDS_ADMINTOOLS "Головне меню\\Програми\\Службові" + IDS_STARTUP "Головне меню\\Програми\\Автозапуск" + IDS_MYDOCUMENTS "Мої документи" + IDS_MYPICTURES "Мої документи\\Мої малюнки" + IDS_MYMUSIC "Мої документи\\Моя музика" + IDS_MYVIDEOS "Мої документи\\Мої відеозаписи" + IDS_TEMPLATES "Шаблони" IDS_RECENT "Recent" - IDS_SENDTO "³" + IDS_SENDTO "Відправити" IDS_PRINTHOOD "PrintHood" IDS_NETHOOD "NetHood" IDS_LOCALSETTINGS "Local Settings" diff --git a/dll/win32/userenv/precomp.h b/dll/win32/userenv/precomp.h index ae1fb5f04d5..77f4faaf224 100644 --- a/dll/win32/userenv/precomp.h +++ b/dll/win32/userenv/precomp.h @@ -2,7 +2,8 @@ #define WIN32_NO_STATUS #include #define NTOS_MODE_USER -#include +#include +#include #include #include #include diff --git a/dll/win32/userenv/userenv.rc b/dll/win32/userenv/userenv.rc index 3a0d1e9078d..3f314471ad9 100644 --- a/dll/win32/userenv/userenv.rc +++ b/dll/win32/userenv/userenv.rc @@ -52,10 +52,13 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL #include "lang/lt-LT.rc" #include "lang/no-NO.rc" #include "lang/nl-NL.rc" -#include "lang/pl-PL.rc" #include "lang/pt-BR.rc" -#include "lang/ru-RU.rc" #include "lang/sk-SK.rc" #include "lang/sv-SE.rc" #include "lang/th-TH.rc" + +// UTF-8 +#pragma code_page(65001) +#include "lang/pl-PL.rc" +#include "lang/ru-RU.rc" #include "lang/uk-UA.rc" diff --git a/dll/win32/vdmdbg/CMakeLists.txt b/dll/win32/vdmdbg/CMakeLists.txt index a312742e646..81237307e95 100644 --- a/dll/win32/vdmdbg/CMakeLists.txt +++ b/dll/win32/vdmdbg/CMakeLists.txt @@ -7,11 +7,9 @@ list(APPEND SOURCE vdmdbg.c ${CMAKE_CURRENT_BINARY_DIR}/vdmdbg.def) -add_library(vdmdbg SHARED - ${CMAKE_CURRENT_BINARY_DIR}/vdmdbg_vdmdbg.h.gch - ${SOURCE}) +add_library(vdmdbg SHARED ${SOURCE}) set_module_type(vdmdbg win32dll) add_importlibs(vdmdbg msvcrt kernel32 ntdll) -add_pch(vdmdbg ${CMAKE_CURRENT_SOURCE_DIR}/vdmdbg.h ${SOURCE}) +add_pch(vdmdbg vdmdbg.h) add_cd_file(TARGET vdmdbg DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/version/ver.spec b/dll/win32/version/ver.spec deleted file mode 100644 index 14ce7e7b895..00000000000 --- a/dll/win32/version/ver.spec +++ /dev/null @@ -1,12 +0,0 @@ -#1 DLLENTRYPOINT -2 pascal GetFileResourceSize(str str str ptr) GetFileResourceSize16 -3 pascal GetFileResource(str str str long long ptr) GetFileResource16 -6 pascal GetFileVersionInfoSize(str ptr) GetFileVersionInfoSize16 -7 pascal GetFileVersionInfo(str long long ptr) GetFileVersionInfo16 -8 pascal VerFindFile(word str str str ptr ptr ptr ptr) VerFindFile16 -9 pascal VerInstallFile(word str str str str str ptr ptr) VerInstallFile16 -10 pascal VerLanguageName(word ptr word) VerLanguageName16 -11 pascal VerQueryValue(segptr str ptr ptr) VerQueryValue16 -20 stub GETFILEVERSIONINFORAW -#21 VERFTHK_THUNKDATA16 -#22 VERTHKSL_THUNKDATA16 diff --git a/dll/win32/wdmaud.drv/CMakeLists.txt b/dll/win32/wdmaud.drv/CMakeLists.txt index 5272364e516..4985bd23081 100644 --- a/dll/win32/wdmaud.drv/CMakeLists.txt +++ b/dll/win32/wdmaud.drv/CMakeLists.txt @@ -31,4 +31,5 @@ target_link_libraries(wdmaud.drv mmixer) add_importlibs(wdmaud.drv user32 winmm advapi32 msvcrt setupapi ksuser kernel32 ntdll) +add_pch(wdmaud.drv wdmaud.h) add_cd_file(TARGET wdmaud.drv DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/wdmaud.drv/legacy.c b/dll/win32/wdmaud.drv/legacy.c index 90a00b4f8dc..1ee0f22559f 100644 --- a/dll/win32/wdmaud.drv/legacy.c +++ b/dll/win32/wdmaud.drv/legacy.c @@ -15,8 +15,6 @@ #include "wdmaud.h" -#include - #define KERNEL_DEVICE_NAME L"\\\\.\\wdmaud" HANDLE KernelHandle = INVALID_HANDLE_VALUE; diff --git a/dll/win32/wdmaud.drv/mixer.c b/dll/win32/wdmaud.drv/mixer.c index 8aa9b835b95..f26ee9d82b0 100644 --- a/dll/win32/wdmaud.drv/mixer.c +++ b/dll/win32/wdmaud.drv/mixer.c @@ -7,19 +7,7 @@ * PROGRAMMERS: Johannes Anderwald */ -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include "interface.h" - +#include "wdmaud.h" extern HANDLE KernelHandle; diff --git a/dll/win32/wdmaud.drv/wdmaud.h b/dll/win32/wdmaud.drv/wdmaud.h index 1374cea1a98..08e43c536de 100644 --- a/dll/win32/wdmaud.drv/wdmaud.h +++ b/dll/win32/wdmaud.drv/wdmaud.h @@ -1,15 +1,17 @@ #ifndef WDMAUD_H__ #define WDMAUD_H__ +#include #include #include #include #include #include #include - #include #include +#include +#include #include "interface.h" #include "mmixer.h" #include diff --git a/dll/win32/wdmaud.drv/wdmaud.rbuild b/dll/win32/wdmaud.drv/wdmaud.rbuild index 89269d330bb..abeb3320430 100644 --- a/dll/win32/wdmaud.drv/wdmaud.rbuild +++ b/dll/win32/wdmaud.drv/wdmaud.rbuild @@ -23,4 +23,5 @@ mmixer.c legacy.c wdmaud.rc + wdmaud.h diff --git a/dll/win32/windowscodecs/CMakeLists.txt b/dll/win32/windowscodecs/CMakeLists.txt index 47ec0d9c422..d99a32ce498 100644 --- a/dll/win32/windowscodecs/CMakeLists.txt +++ b/dll/win32/windowscodecs/CMakeLists.txt @@ -12,6 +12,10 @@ include_directories( ${REACTOS_SOURCE_DIR}/include/reactos/libs/libtiff) set_rc_compiler() +if(MSVC) + add_compiler_flags(/FItypeof.h) +endif() + spec2def(windowscodecs.dll windowscodecs.spec) list(APPEND SOURCE @@ -37,6 +41,12 @@ list(APPEND SOURCE ${CMAKE_CURRENT_BINARY_DIR}/windowscodecs_stubs.c ${CMAKE_CURRENT_BINARY_DIR}/windowscodecs.def) +if(MSVC) + set_source_files_properties(${REACTOS_BINARY_DIR}/include/psdk/wincodec_i.c PROPERTIES GENERATED TRUE) + list(APPEND SOURCE + ${REACTOS_BINARY_DIR}/include/psdk/wincodec_i.c) +endif() + add_library(windowscodecs SHARED ${SOURCE}) set_module_type(windowscodecs win32dll) diff --git a/dll/win32/windowscodecs/typeof.h b/dll/win32/windowscodecs/typeof.h new file mode 100644 index 00000000000..006ae624b34 --- /dev/null +++ b/dll/win32/windowscodecs/typeof.h @@ -0,0 +1,79 @@ +#define typeof(X_) __typeof_ ## X_ + +#ifdef _WIN64 +#define __typeof_intptr long long +#define __typeof_longptr long long +#else +#define __typeof_intptr int +#define __typeof_longptr long +#endif + +#ifdef __cplusplus +#define __typeof_size size_t +#define __typeof_wchar wchar_t +#else +#define __typeof_size __typeof_intptr +#define __typeof_wchar unsigned short +#endif + +typedef struct jpeg_error_mgr * (__cdecl typeof(jpeg_std_error))(struct jpeg_error_mgr *); +typedef void (__cdecl typeof(jpeg_CreateDecompress))(struct jpeg_decompress_struct *, int, __typeof_size); +typedef int (__cdecl typeof(jpeg_read_header))(struct jpeg_decompress_struct *, int); +typedef int (__cdecl typeof(jpeg_start_decompress))(struct jpeg_decompress_struct *); +typedef unsigned int (__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *, unsigned char **, unsigned int); +typedef int (__cdecl typeof(jpeg_finish_decompress))(struct jpeg_decompress_struct *); +typedef void (__cdecl typeof(jpeg_destroy_decompress))(struct jpeg_decompress_struct *); +typedef unsigned char (__cdecl typeof(jpeg_resync_to_restart))(struct jpeg_decompress_struct *, int); + +typedef void (*png_error_ptr_1)(struct png_struct_def *, const char *); +typedef struct png_struct_def * (__cdecl typeof(png_create_read_struct))(const char *, void*, png_error_ptr_1, png_error_ptr_1); +typedef struct png_info_def* (__cdecl typeof(png_create_info_struct))(struct png_struct_def *); + +// FIXME the following types are not correct, but they help to compile +typedef void* (__cdecl typeof(png_create_write_struct))(void*); +typedef void* (__cdecl typeof(png_destroy_read_struct))(void*, void*, void*); +typedef void* (__cdecl typeof(png_destroy_write_struct))(void*); +typedef void* (__cdecl typeof(png_destroy_write_struct))(void*); +typedef void* (__cdecl typeof(png_error))(void*); +typedef void* (__cdecl typeof(png_get_bit_depth))(void *); +typedef void* (__cdecl typeof(png_get_color_type))(void *); +typedef void* (__cdecl typeof(png_get_error_ptr))(void *); +typedef void* (__cdecl typeof(png_get_image_height))(void *); +typedef void* (__cdecl typeof(png_get_image_width))(void *); +typedef void* (__cdecl typeof(png_get_io_ptr))(void *); +typedef void* (__cdecl typeof(png_get_pHYs))(void *); +typedef void* (__cdecl typeof(png_get_PLTE))(void *); +typedef void* (__cdecl typeof(png_get_tRNS))(void *); +typedef void* (__cdecl typeof(png_set_bgr))(void *); +typedef void* (__cdecl typeof(png_set_error_fn))(void *); +typedef void* (__cdecl typeof(png_set_expand_gray_1_2_4_to_8))(void *); +typedef void* (__cdecl typeof(png_set_filler))(void *); +typedef void* (__cdecl typeof(png_set_gray_to_rgb))(void *); +typedef void* (__cdecl typeof(png_set_IHDR))(void *); +typedef void* (__cdecl typeof(png_set_pHYs))(void *); +typedef void* (__cdecl typeof(png_set_read_fn))(void *); +typedef void* (__cdecl typeof(png_set_strip_16))(void *); +typedef void* (__cdecl typeof(png_set_tRNS_to_alpha))(void *); +typedef void* (__cdecl typeof(png_set_write_fn))(void *); +typedef void* (__cdecl typeof(png_read_end))(void *); +typedef void* (__cdecl typeof(png_read_image))(void *); +typedef void* (__cdecl typeof(png_read_info))(void *); +typedef void* (__cdecl typeof(png_write_end))(void *); +typedef void* (__cdecl typeof(png_write_info))(void *); +typedef void* (__cdecl typeof(png_write_rows))(void *); + +typedef void* (__cdecl typeof(TIFFClientOpen))(void *); +typedef void* (__cdecl typeof(TIFFClose))(void *); +typedef char* (__cdecl typeof(TIFFCurrentDirectory))(void *); +typedef void* (__cdecl typeof(TIFFGetField))(void *); +typedef void* (__cdecl typeof(TIFFReadDirectory))(void *); +typedef void* (__cdecl typeof(TIFFReadEncodedStrip))(void *); +typedef void* (__cdecl typeof(TIFFSetDirectory))(void *); + +#undef __typeof_intptr +#undef __typeof_longptr +#undef __typeof_wchar +#undef __typeof_size + +/* EOF */ + diff --git a/dll/win32/winemp3.acm/CMakeLists.txt b/dll/win32/winemp3.acm/CMakeLists.txt index e948366308d..a7f7e01edf3 100644 --- a/dll/win32/winemp3.acm/CMakeLists.txt +++ b/dll/win32/winemp3.acm/CMakeLists.txt @@ -1,6 +1,5 @@ add_definitions( - -D_DLL -D__USE_CRTIMP -D__WINESRC__ -DWIN32) @@ -16,18 +15,14 @@ add_library(winemp3.acm SHARED set_entrypoint(winemp3.acm 0) set_target_properties(winemp3.acm PROPERTIES SUFFIX "") - -target_link_libraries(winemp3.acm - wine - libmpg123) +target_link_libraries(winemp3.acm wine libmpg123 oldnames) add_importlibs(winemp3.acm - msvcrt winmm user32 + msvcrt kernel32 ntdll) add_dependencies(winemp3.acm psdk) - -add_cd_file(TARGET winemp3.acm DESTINATION reactos/system32 FOR all) \ No newline at end of file +add_cd_file(TARGET winemp3.acm DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/winhttp/net.c b/dll/win32/winhttp/net.c index 276d4d73622..2f7b35dfa49 100644 --- a/dll/win32/winhttp/net.c +++ b/dll/win32/winhttp/net.c @@ -134,6 +134,7 @@ MAKE_FUNCPTR( ERR_free_strings ); MAKE_FUNCPTR( ERR_get_error ); MAKE_FUNCPTR( ERR_error_string ); MAKE_FUNCPTR( X509_STORE_CTX_get_ex_data ); +MAKE_FUNCPTR( X509_STORE_CTX_get_chain ); MAKE_FUNCPTR( i2d_X509 ); MAKE_FUNCPTR( sk_value ); MAKE_FUNCPTR( sk_num ); @@ -374,13 +375,14 @@ static int netconn_secure_verify( int preverify_ok, X509_STORE_CTX *ctx ) X509 *cert; int i; PCCERT_CONTEXT endCert = NULL; + struct stack_st *chain = (struct stack_st *)pX509_STORE_CTX_get_chain( ctx ); ret = TRUE; - for (i = 0; ret && i < psk_num((struct stack_st *)ctx->chain); i++) + for (i = 0; ret && i < psk_num(chain); i++) { PCCERT_CONTEXT context; - cert = (X509 *)psk_value((struct stack_st *)ctx->chain, i); + cert = (X509 *)psk_value(chain, i); if ((context = X509_to_cert_context( cert ))) { if (i == 0) @@ -488,6 +490,7 @@ BOOL netconn_init( netconn_t *conn, BOOL secure ) LOAD_FUNCPTR( ERR_get_error ); LOAD_FUNCPTR( ERR_error_string ); LOAD_FUNCPTR( X509_STORE_CTX_get_ex_data ); + LOAD_FUNCPTR( X509_STORE_CTX_get_chain ); LOAD_FUNCPTR( i2d_X509 ); LOAD_FUNCPTR( sk_value ); LOAD_FUNCPTR( sk_num ); diff --git a/dll/win32/winhttp/request.c b/dll/win32/winhttp/request.c index 80a1b572d4d..4bd411c097f 100644 --- a/dll/win32/winhttp/request.c +++ b/dll/win32/winhttp/request.c @@ -504,7 +504,7 @@ static WCHAR *build_request_path( request_t *request ) sprintfW( ret, fmt, scheme, request->connect->hostname ); if (request->connect->hostport) { - static const WCHAR colonFmt[] = { ':','%','d',0 }; + static const WCHAR colonFmt[] = { ':','%','u',0 }; sprintfW( ret + strlenW( ret ), colonFmt, request->connect->hostport ); @@ -870,7 +870,7 @@ static BOOL read_reply( request_t *request ); static BOOL secure_proxy_connect( request_t *request ) { static const WCHAR verbConnect[] = {'C','O','N','N','E','C','T',0}; - static const WCHAR fmt[] = {'%','s',':','%','d',0}; + static const WCHAR fmt[] = {'%','s',':','%','u',0}; BOOL ret = FALSE; LPWSTR path; connect_t *connect = request->connect; @@ -1837,7 +1837,7 @@ static BOOL receive_response( request_t *request, BOOL async ) if (!(request->hdr.disable_flags & WINHTTP_DISABLE_COOKIES)) record_cookies( request ); - if (status == 301 || status == 302) + if (status == HTTP_STATUS_MOVED || status == HTTP_STATUS_REDIRECT || status == HTTP_STATUS_REDIRECT_KEEP_VERB) { if (request->hdr.disable_flags & WINHTTP_DISABLE_REDIRECTS) break; diff --git a/dll/win32/winhttp/url.c b/dll/win32/winhttp/url.c index 09835b43c91..6ead33cbf27 100644 --- a/dll/win32/winhttp/url.c +++ b/dll/win32/winhttp/url.c @@ -299,7 +299,7 @@ static DWORD comp_length( DWORD len, DWORD flags, WCHAR *comp ) static BOOL calc_length( URL_COMPONENTS *uc, DWORD flags, LPDWORD len ) { - static const WCHAR formatW[] = {'%','d',0}; + static const WCHAR formatW[] = {'%','u',0}; INTERNET_SCHEME scheme; *len = 0; @@ -360,7 +360,7 @@ static BOOL calc_length( URL_COMPONENTS *uc, DWORD flags, LPDWORD len ) */ BOOL WINAPI WinHttpCreateUrl( LPURL_COMPONENTS uc, DWORD flags, LPWSTR url, LPDWORD required ) { - static const WCHAR formatW[] = {'%','d',0}; + static const WCHAR formatW[] = {'%','u',0}; static const WCHAR twoslashW[] = {'/','/'}; DWORD len; diff --git a/dll/win32/winhttp/winhttp_private.h b/dll/win32/winhttp/winhttp_private.h index 5da3ae1d547..24440528308 100644 --- a/dll/win32/winhttp/winhttp_private.h +++ b/dll/win32/winhttp/winhttp_private.h @@ -204,38 +204,38 @@ typedef struct LPDWORD written; } write_data_t; -object_header_t *addref_object( object_header_t * ); -object_header_t *grab_object( HINTERNET ); -void release_object( object_header_t * ); -HINTERNET alloc_handle( object_header_t * ); -BOOL free_handle( HINTERNET ); +object_header_t *addref_object( object_header_t * ) DECLSPEC_HIDDEN; +object_header_t *grab_object( HINTERNET ) DECLSPEC_HIDDEN; +void release_object( object_header_t * ) DECLSPEC_HIDDEN; +HINTERNET alloc_handle( object_header_t * ) DECLSPEC_HIDDEN; +BOOL free_handle( HINTERNET ) DECLSPEC_HIDDEN; -void set_last_error( DWORD ); -DWORD get_last_error( void ); -void send_callback( object_header_t *, DWORD, LPVOID, DWORD ); -void close_connection( request_t * ); +void set_last_error( DWORD ) DECLSPEC_HIDDEN; +DWORD get_last_error( void ) DECLSPEC_HIDDEN; +void send_callback( object_header_t *, DWORD, LPVOID, DWORD ) DECLSPEC_HIDDEN; +void close_connection( request_t * ) DECLSPEC_HIDDEN; -BOOL netconn_close( netconn_t * ); -BOOL netconn_connect( netconn_t *, const struct sockaddr *, unsigned int, int ); -BOOL netconn_connected( netconn_t * ); -BOOL netconn_create( netconn_t *, int, int, int ); -BOOL netconn_get_next_line( netconn_t *, char *, DWORD * ); -BOOL netconn_init( netconn_t *, BOOL ); -void netconn_unload( void ); -BOOL netconn_query_data_available( netconn_t *, DWORD * ); -BOOL netconn_recv( netconn_t *, void *, size_t, int, int * ); -BOOL netconn_resolve( WCHAR *, INTERNET_PORT, struct sockaddr *, socklen_t *, int ); -BOOL netconn_secure_connect( netconn_t *, WCHAR * ); -BOOL netconn_send( netconn_t *, const void *, size_t, int, int * ); -DWORD netconn_set_timeout( netconn_t *, BOOL, int ); -const void *netconn_get_certificate( netconn_t * ); -int netconn_get_cipher_strength( netconn_t * ); +BOOL netconn_close( netconn_t * ) DECLSPEC_HIDDEN; +BOOL netconn_connect( netconn_t *, const struct sockaddr *, unsigned int, int ) DECLSPEC_HIDDEN; +BOOL netconn_connected( netconn_t * ) DECLSPEC_HIDDEN; +BOOL netconn_create( netconn_t *, int, int, int ) DECLSPEC_HIDDEN; +BOOL netconn_get_next_line( netconn_t *, char *, DWORD * ) DECLSPEC_HIDDEN; +BOOL netconn_init( netconn_t *, BOOL ) DECLSPEC_HIDDEN; +void netconn_unload( void ) DECLSPEC_HIDDEN; +BOOL netconn_query_data_available( netconn_t *, DWORD * ) DECLSPEC_HIDDEN; +BOOL netconn_recv( netconn_t *, void *, size_t, int, int * ) DECLSPEC_HIDDEN; +BOOL netconn_resolve( WCHAR *, INTERNET_PORT, struct sockaddr *, socklen_t *, int ) DECLSPEC_HIDDEN; +BOOL netconn_secure_connect( netconn_t *, WCHAR * ) DECLSPEC_HIDDEN; +BOOL netconn_send( netconn_t *, const void *, size_t, int, int * ) DECLSPEC_HIDDEN; +DWORD netconn_set_timeout( netconn_t *, BOOL, int ) DECLSPEC_HIDDEN; +const void *netconn_get_certificate( netconn_t * ) DECLSPEC_HIDDEN; +int netconn_get_cipher_strength( netconn_t * ) DECLSPEC_HIDDEN; -BOOL set_cookies( request_t *, const WCHAR * ); -BOOL add_cookie_headers( request_t * ); -BOOL add_request_headers( request_t *, LPCWSTR, DWORD, DWORD ); -void delete_domain( domain_t * ); -BOOL set_server_for_hostname( connect_t *connect, LPCWSTR server, INTERNET_PORT port ); +BOOL set_cookies( request_t *, const WCHAR * ) DECLSPEC_HIDDEN; +BOOL add_cookie_headers( request_t * ) DECLSPEC_HIDDEN; +BOOL add_request_headers( request_t *, LPCWSTR, DWORD, DWORD ) DECLSPEC_HIDDEN; +void delete_domain( domain_t * ) DECLSPEC_HIDDEN; +BOOL set_server_for_hostname( connect_t *connect, LPCWSTR server, INTERNET_PORT port ) DECLSPEC_HIDDEN; static inline void *heap_alloc( SIZE_T size ) { diff --git a/dll/win32/wininet/cookie.c b/dll/win32/wininet/cookie.c index 7dfd2a82a8d..77e22ac1af6 100644 --- a/dll/win32/wininet/cookie.c +++ b/dll/win32/wininet/cookie.c @@ -89,7 +89,7 @@ static void COOKIE_deleteDomain(cookie_domain *deadDomain); /* adds a cookie to the domain */ static cookie *COOKIE_addCookie(cookie_domain *domain, LPCWSTR name, LPCWSTR data, FILETIME expiry) { - cookie *newCookie = HeapAlloc(GetProcessHeap(), 0, sizeof(cookie)); + cookie *newCookie = heap_alloc(sizeof(cookie)); list_init(&newCookie->entry); newCookie->lpCookieName = NULL; @@ -145,7 +145,7 @@ static void COOKIE_deleteCookie(cookie *deadCookie, BOOL deleteDomain) /* allocates a domain and adds it to the end */ static cookie_domain *COOKIE_addDomain(LPCWSTR domain, LPCWSTR path) { - cookie_domain *newDomain = HeapAlloc(GetProcessHeap(), 0, sizeof(cookie_domain)); + cookie_domain *newDomain = heap_alloc(sizeof(cookie_domain)); list_init(&newDomain->entry); list_init(&newDomain->cookie_list); @@ -260,6 +260,78 @@ static void COOKIE_deleteDomain(cookie_domain *deadDomain) HeapFree(GetProcessHeap(), 0, deadDomain); } +BOOL get_cookie(const WCHAR *host, const WCHAR *path, WCHAR *cookie_data, DWORD *size) +{ + unsigned cnt = 0, len, domain_count = 0, cookie_count = 0; + cookie_domain *domain; + FILETIME tm; + + GetSystemTimeAsFileTime(&tm); + + LIST_FOR_EACH_ENTRY(domain, &domain_list, cookie_domain, entry) { + struct list *cursor, *cursor2; + + if(!COOKIE_matchDomain(host, path, domain, TRUE)) + continue; + + domain_count++; + TRACE("found domain %p\n", domain); + + LIST_FOR_EACH_SAFE(cursor, cursor2, &domain->cookie_list) { + cookie *cookie_iter = LIST_ENTRY(cursor, cookie, entry); + + /* check for expiry */ + if((cookie_iter->expiry.dwLowDateTime != 0 || cookie_iter->expiry.dwHighDateTime != 0) + && CompareFileTime(&tm, &cookie_iter->expiry) > 0) + { + TRACE("Found expired cookie. deleting\n"); + COOKIE_deleteCookie(cookie_iter, FALSE); + continue; + } + + if(!cookie_data) { /* return the size of the buffer required to lpdwSize */ + if (cookie_count) + cnt += 2; /* '; ' */ + cnt += strlenW(cookie_iter->lpCookieName); + if ((len = strlenW(cookie_iter->lpCookieData))) { + cnt += 1; /* = */ + cnt += len; + } + }else { + static const WCHAR szsc[] = { ';',' ',0 }; + static const WCHAR szname[] = { '%','s',0 }; + static const WCHAR szdata[] = { '=','%','s',0 }; + + if (cookie_count) cnt += snprintfW(cookie_data + cnt, *size - cnt, szsc); + cnt += snprintfW(cookie_data + cnt, *size - cnt, szname, cookie_iter->lpCookieName); + + if (cookie_iter->lpCookieData[0]) + cnt += snprintfW(cookie_data + cnt, *size - cnt, szdata, cookie_iter->lpCookieData); + + TRACE("Cookie: %s\n", debugstr_w(cookie_data)); + } + cookie_count++; + } + } + + if (!domain_count) { + TRACE("no cookies found for %s\n", debugstr_w(host)); + SetLastError(ERROR_NO_MORE_ITEMS); + return FALSE; + } + + if(!cookie_data) { + *size = (cnt + 1) * sizeof(WCHAR); + TRACE("returning %u\n", *size); + return TRUE; + } + + *size = cnt + 1; + + TRACE("Returning %u (from %u domains): %s\n", cnt, domain_count, debugstr_w(cookie_data)); + return cnt != 0; +} + /*********************************************************************** * InternetGetCookieW (WININET.@) * @@ -276,14 +348,10 @@ static void COOKIE_deleteDomain(cookie_domain *deadDomain) BOOL WINAPI InternetGetCookieW(LPCWSTR lpszUrl, LPCWSTR lpszCookieName, LPWSTR lpCookieData, LPDWORD lpdwSize) { + WCHAR host[INTERNET_MAX_HOST_NAME_LENGTH], path[INTERNET_MAX_PATH_LENGTH]; BOOL ret; - struct list * cursor; - unsigned int cnt = 0, domain_count = 0, cookie_count = 0; - WCHAR hostName[2048], path[2048]; - FILETIME tm; - TRACE("(%s, %s, %p, %p)\n", debugstr_w(lpszUrl),debugstr_w(lpszCookieName), - lpCookieData, lpdwSize); + TRACE("(%s, %s, %p, %p)\n", debugstr_w(lpszUrl),debugstr_w(lpszCookieName), lpCookieData, lpdwSize); if (!lpszUrl) { @@ -291,83 +359,11 @@ BOOL WINAPI InternetGetCookieW(LPCWSTR lpszUrl, LPCWSTR lpszCookieName, return FALSE; } - hostName[0] = 0; - ret = COOKIE_crackUrlSimple(lpszUrl, hostName, sizeof(hostName)/sizeof(hostName[0]), path, sizeof(path)/sizeof(path[0])); - if (!ret || !hostName[0]) return FALSE; + host[0] = 0; + ret = COOKIE_crackUrlSimple(lpszUrl, host, sizeof(host)/sizeof(host[0]), path, sizeof(path)/sizeof(path[0])); + if (!ret || !host[0]) return FALSE; - GetSystemTimeAsFileTime(&tm); - - LIST_FOR_EACH(cursor, &domain_list) - { - cookie_domain *cookiesDomain = LIST_ENTRY(cursor, cookie_domain, entry); - if (COOKIE_matchDomain(hostName, path, cookiesDomain, TRUE)) - { - struct list * cursor; - domain_count++; - TRACE("found domain %p\n", cookiesDomain); - - LIST_FOR_EACH(cursor, &cookiesDomain->cookie_list) - { - cookie *thisCookie = LIST_ENTRY(cursor, cookie, entry); - /* check for expiry */ - if ((thisCookie->expiry.dwLowDateTime != 0 || thisCookie->expiry.dwHighDateTime != 0) && CompareFileTime(&tm,&thisCookie->expiry) > 0) - { - TRACE("Found expired cookie. deleting\n"); - COOKIE_deleteCookie(thisCookie, FALSE); - continue; - } - - if (lpCookieData == NULL) /* return the size of the buffer required to lpdwSize */ - { - unsigned int len; - - if (cookie_count) cnt += 2; /* '; ' */ - cnt += strlenW(thisCookie->lpCookieName); - if ((len = strlenW(thisCookie->lpCookieData))) - { - cnt += 1; /* = */ - cnt += len; - } - } - else - { - static const WCHAR szsc[] = { ';',' ',0 }; - static const WCHAR szname[] = { '%','s',0 }; - static const WCHAR szdata[] = { '=','%','s',0 }; - - if (cookie_count) cnt += snprintfW(lpCookieData + cnt, *lpdwSize - cnt, szsc); - cnt += snprintfW(lpCookieData + cnt, *lpdwSize - cnt, szname, thisCookie->lpCookieName); - - if (thisCookie->lpCookieData[0]) - cnt += snprintfW(lpCookieData + cnt, *lpdwSize - cnt, szdata, thisCookie->lpCookieData); - - TRACE("Cookie: %s\n", debugstr_w(lpCookieData)); - } - cookie_count++; - } - } - } - - if (!domain_count) - { - TRACE("no cookies found for %s\n", debugstr_w(hostName)); - SetLastError(ERROR_NO_MORE_ITEMS); - return FALSE; - } - - if (lpCookieData == NULL) - { - *lpdwSize = (cnt + 1) * sizeof(WCHAR); - TRACE("returning %u\n", *lpdwSize); - return TRUE; - } - - *lpdwSize = cnt + 1; - - TRACE("Returning %u (from %u domains): %s\n", cnt, domain_count, - debugstr_w(lpCookieData)); - - return (cnt ? TRUE : FALSE); + return get_cookie(host, path, lpCookieData, lpdwSize); } @@ -397,7 +393,7 @@ BOOL WINAPI InternetGetCookieA(LPCSTR lpszUrl, LPCSTR lpszCookieName, r = InternetGetCookieW( url, name, NULL, &len ); if( r ) { - szCookieData = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ); + szCookieData = heap_alloc(len * sizeof(WCHAR)); if( !szCookieData ) { r = FALSE; @@ -418,7 +414,7 @@ BOOL WINAPI InternetGetCookieA(LPCSTR lpszUrl, LPCSTR lpszCookieName, return r; } -static BOOL set_cookie(LPCWSTR domain, LPCWSTR path, LPCWSTR cookie_name, LPCWSTR cookie_data) +BOOL set_cookie(LPCWSTR domain, LPCWSTR path, LPCWSTR cookie_name, LPCWSTR cookie_data) { cookie_domain *thisCookieDomain = NULL; cookie *thisCookie; @@ -453,7 +449,7 @@ static BOOL set_cookie(LPCWSTR domain, LPCWSTR path, LPCWSTR cookie_name, LPCWST if (value != data) HeapFree(GetProcessHeap(), 0, value); - value = HeapAlloc(GetProcessHeap(), 0, (ptr - data) * sizeof(WCHAR)); + value = heap_alloc((ptr - data) * sizeof(WCHAR)); if (value == NULL) { HeapFree(GetProcessHeap(), 0, data); diff --git a/dll/win32/wininet/dialogs.c b/dll/win32/wininet/dialogs.c index 2c4a5278569..5e226c476fd 100644 --- a/dll/win32/wininet/dialogs.c +++ b/dll/win32/wininet/dialogs.c @@ -44,6 +44,8 @@ #include "resource.h" +#define MAX_STRING_LEN 1024 + WINE_DEFAULT_DEBUG_CHANNEL(wininet); struct WININET_ErrorDlgParams @@ -62,25 +64,25 @@ struct WININET_ErrorDlgParams */ static BOOL WININET_GetProxyServer( HINTERNET hRequest, LPWSTR szBuf, DWORD sz ) { - http_request_t *lpwhr; - http_session_t *lpwhs = NULL; + http_request_t *request; + http_session_t *session = NULL; appinfo_t *hIC = NULL; BOOL ret = FALSE; LPWSTR p; - lpwhr = (http_request_t*) WININET_GetObject( hRequest ); - if (NULL == lpwhr) + request = (http_request_t*) get_handle_object( hRequest ); + if (NULL == request) return FALSE; - lpwhs = lpwhr->lpHttpSession; - if (NULL == lpwhs) + session = request->session; + if (NULL == session) goto done; - hIC = lpwhs->lpAppInfo; + hIC = session->appInfo; if (NULL == hIC) goto done; - lstrcpynW(szBuf, hIC->lpszProxy, sz); + lstrcpynW(szBuf, hIC->proxy, sz); /* FIXME: perhaps it would be better to use InternetCrackUrl here */ p = strchrW(szBuf, ':'); @@ -90,7 +92,7 @@ static BOOL WININET_GetProxyServer( HINTERNET hRequest, LPWSTR szBuf, DWORD sz ) ret = TRUE; done: - WININET_Release( &lpwhr->hdr ); + WININET_Release( &request->hdr ); return ret; } @@ -101,24 +103,24 @@ done: */ static BOOL WININET_GetServer( HINTERNET hRequest, LPWSTR szBuf, DWORD sz ) { - http_request_t *lpwhr; - http_session_t *lpwhs = NULL; + http_request_t *request; + http_session_t *session = NULL; BOOL ret = FALSE; - lpwhr = (http_request_t*) WININET_GetObject( hRequest ); - if (NULL == lpwhr) + request = (http_request_t*) get_handle_object( hRequest ); + if (NULL == request) return FALSE; - lpwhs = lpwhr->lpHttpSession; - if (NULL == lpwhs) + session = request->session; + if (NULL == session) goto done; - lstrcpynW(szBuf, lpwhs->lpszHostName, sz); + lstrcpynW(szBuf, session->hostName, sz); ret = TRUE; done: - WININET_Release( &lpwhr->hdr ); + WININET_Release( &request->hdr ); return ret; } @@ -239,17 +241,17 @@ static BOOL WININET_GetSetPassword( HWND hdlg, LPCWSTR szServer, static BOOL WININET_SetAuthorization( HINTERNET hRequest, LPWSTR username, LPWSTR password, BOOL proxy ) { - http_request_t *lpwhr; - http_session_t *lpwhs; + http_request_t *request; + http_session_t *session; BOOL ret = FALSE; LPWSTR p, q; - lpwhr = (http_request_t*) WININET_GetObject( hRequest ); - if( !lpwhr ) + request = (http_request_t*) get_handle_object( hRequest ); + if( !request ) return FALSE; - lpwhs = lpwhr->lpHttpSession; - if (NULL == lpwhs || lpwhs->hdr.htype != WH_HHTTPSESSION) + session = request->session; + if (NULL == session || session->hdr.htype != WH_HHTTPSESSION) { INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE); goto done; @@ -268,27 +270,27 @@ static BOOL WININET_SetAuthorization( HINTERNET hRequest, LPWSTR username, if (proxy) { - appinfo_t *hIC = lpwhs->lpAppInfo; + appinfo_t *hIC = session->appInfo; - HeapFree(GetProcessHeap(), 0, hIC->lpszProxyUsername); - hIC->lpszProxyUsername = p; + HeapFree(GetProcessHeap(), 0, hIC->proxyUsername); + hIC->proxyUsername = p; - HeapFree(GetProcessHeap(), 0, hIC->lpszProxyPassword); - hIC->lpszProxyPassword = q; + HeapFree(GetProcessHeap(), 0, hIC->proxyPassword); + hIC->proxyPassword = q; } else { - HeapFree(GetProcessHeap(), 0, lpwhs->lpszUserName); - lpwhs->lpszUserName = p; + HeapFree(GetProcessHeap(), 0, session->userName); + session->userName = p; - HeapFree(GetProcessHeap(), 0, lpwhs->lpszPassword); - lpwhs->lpszPassword = q; + HeapFree(GetProcessHeap(), 0, session->password); + session->password = q; } ret = TRUE; done: - WININET_Release( &lpwhr->hdr ); + WININET_Release( &request->hdr ); return ret; } @@ -460,6 +462,109 @@ static INT_PTR WINAPI WININET_PasswordDialog( return FALSE; } +/*********************************************************************** + * WININET_InvalidCertificateDialog + */ +static INT_PTR WINAPI WININET_InvalidCertificateDialog( + HWND hdlg, UINT uMsg, WPARAM wParam, LPARAM lParam ) +{ + struct WININET_ErrorDlgParams *params; + HWND hitem; + WCHAR buf[1024]; + + if( uMsg == WM_INITDIALOG ) + { + TRACE("WM_INITDIALOG (%08lx)\n", lParam); + + /* save the parameter list */ + params = (struct WININET_ErrorDlgParams*) lParam; + SetWindowLongPtrW( hdlg, GWLP_USERDATA, lParam ); + + switch( params->dwError ) + { + case ERROR_INTERNET_INVALID_CA: + LoadStringW( WININET_hModule, IDS_CERT_CA_INVALID, buf, 1024 ); + break; + case ERROR_INTERNET_SEC_CERT_DATE_INVALID: + LoadStringW( WININET_hModule, IDS_CERT_DATE_INVALID, buf, 1024 ); + break; + case ERROR_INTERNET_SEC_CERT_CN_INVALID: + LoadStringW( WININET_hModule, IDS_CERT_CN_INVALID, buf, 1024 ); + break; + case ERROR_INTERNET_SEC_CERT_ERRORS: + /* FIXME: We should fetch information about the + * certificate here and show all the relevant errors. + */ + LoadStringW( WININET_hModule, IDS_CERT_ERRORS, buf, 1024 ); + break; + default: + FIXME( "No message for error %d\n", params->dwError ); + buf[0] = '\0'; + } + + hitem = GetDlgItem( hdlg, IDC_CERT_ERROR ); + SetWindowTextW( hitem, buf ); + + return TRUE; + } + + params = (struct WININET_ErrorDlgParams*) + GetWindowLongPtrW( hdlg, GWLP_USERDATA ); + + switch( uMsg ) + { + case WM_COMMAND: + if( wParam == IDOK ) + { + BOOL res = TRUE; + + if( params->dwFlags & FLAGS_ERROR_UI_FLAGS_CHANGE_OPTIONS ) + { + DWORD flags, size = sizeof(flags); + + InternetQueryOptionW( params->hRequest, INTERNET_OPTION_SECURITY_FLAGS, &flags, &size ); + switch( params->dwError ) + { + case ERROR_INTERNET_INVALID_CA: + flags |= SECURITY_FLAG_IGNORE_UNKNOWN_CA; + break; + case ERROR_INTERNET_SEC_CERT_DATE_INVALID: + flags |= SECURITY_FLAG_IGNORE_CERT_DATE_INVALID; + break; + case ERROR_INTERNET_SEC_CERT_CN_INVALID: + flags |= SECURITY_FLAG_IGNORE_CERT_CN_INVALID; + break; + case ERROR_INTERNET_SEC_CERT_ERRORS: + FIXME("Should only add ignore flags as needed.\n"); + flags |= SECURITY_FLAG_IGNORE_CERT_CN_INVALID | + SECURITY_FLAG_IGNORE_CERT_DATE_INVALID | + SECURITY_FLAG_IGNORE_UNKNOWN_CA; + /* FIXME: ERROR_INTERNET_SEC_CERT_ERRORS also + * seems to set the corresponding DLG_* flags. + */ + break; + } + res = InternetSetOptionW( params->hRequest, INTERNET_OPTION_SECURITY_FLAGS, &flags, size ); + if(!res) + WARN("InternetSetOption(INTERNET_OPTION_SECURITY_FLAGS) failed.\n"); + } + + EndDialog( hdlg, res ? ERROR_SUCCESS : ERROR_NOT_SUPPORTED ); + return TRUE; + } + if( wParam == IDCANCEL ) + { + TRACE("Pressed cancel.\n"); + + EndDialog( hdlg, ERROR_CANCELLED ); + return TRUE; + } + break; + } + + return FALSE; +} + /*********************************************************************** * WININET_GetConnectionStatus */ @@ -490,11 +595,13 @@ DWORD WINAPI InternetErrorDlg(HWND hWnd, HINTERNET hRequest, DWORD dwError, DWORD dwFlags, LPVOID* lppvData) { struct WININET_ErrorDlgParams params; - HMODULE hwininet = GetModuleHandleA( "wininet.dll" ); INT dwStatus; TRACE("%p %p %d %08x %p\n", hWnd, hRequest, dwError, dwFlags, lppvData); + if( !hWnd && !(dwFlags & FLAGS_ERROR_UI_FLAGS_NO_UI) ) + return ERROR_INVALID_HANDLE; + params.hWnd = hWnd; params.hRequest = hRequest; params.dwError = dwError; @@ -512,23 +619,32 @@ DWORD WINAPI InternetErrorDlg(HWND hWnd, HINTERNET hRequest, switch (dwStatus) { case HTTP_STATUS_PROXY_AUTH_REQ: - return DialogBoxParamW( hwininet, MAKEINTRESOURCEW( IDD_PROXYDLG ), + return DialogBoxParamW( WININET_hModule, MAKEINTRESOURCEW( IDD_PROXYDLG ), hWnd, WININET_ProxyPasswordDialog, (LPARAM) ¶ms ); case HTTP_STATUS_DENIED: - return DialogBoxParamW( hwininet, MAKEINTRESOURCEW( IDD_AUTHDLG ), + return DialogBoxParamW( WININET_hModule, MAKEINTRESOURCEW( IDD_AUTHDLG ), hWnd, WININET_PasswordDialog, (LPARAM) ¶ms ); default: WARN("unhandled status %u\n", dwStatus); return 0; } - - case ERROR_INTERNET_HTTP_TO_HTTPS_ON_REDIR: - case ERROR_INTERNET_INVALID_CA: - case ERROR_INTERNET_POST_IS_NON_SECURE: + case ERROR_INTERNET_SEC_CERT_ERRORS: case ERROR_INTERNET_SEC_CERT_CN_INVALID: case ERROR_INTERNET_SEC_CERT_DATE_INVALID: + case ERROR_INTERNET_INVALID_CA: + if( dwFlags & FLAGS_ERROR_UI_FLAGS_NO_UI ) + return ERROR_CANCELLED; + + if( dwFlags & ~FLAGS_ERROR_UI_FLAGS_CHANGE_OPTIONS ) + FIXME("%08x contains unsupported flags.\n", dwFlags); + + return DialogBoxParamW( WININET_hModule, MAKEINTRESOURCEW( IDD_INVCERTDLG ), + hWnd, WININET_InvalidCertificateDialog, (LPARAM) ¶ms ); + case ERROR_INTERNET_HTTP_TO_HTTPS_ON_REDIR: + case ERROR_INTERNET_POST_IS_NON_SECURE: FIXME("Need to display dialog for error %d\n", dwError); return ERROR_SUCCESS; } - return ERROR_INVALID_PARAMETER; + + return ERROR_NOT_SUPPORTED; } diff --git a/dll/win32/wininet/ftp.c b/dll/win32/wininet/ftp.c index 80cc6f0e60a..07052c2d60c 100644 --- a/dll/win32/wininet/ftp.c +++ b/dll/win32/wininet/ftp.c @@ -288,7 +288,7 @@ BOOL WINAPI FtpPutFileW(HINTERNET hConnect, LPCWSTR lpszLocalFile, return FALSE; } - lpwfs = (ftp_session_t*) WININET_GetObject( hConnect ); + lpwfs = (ftp_session_t*) get_handle_object( hConnect ); if (!lpwfs) { INTERNET_SetLastError(ERROR_INVALID_HANDLE); @@ -470,7 +470,7 @@ BOOL WINAPI FtpSetCurrentDirectoryW(HINTERNET hConnect, LPCWSTR lpszDirectory) goto lend; } - lpwfs = (ftp_session_t*) WININET_GetObject( hConnect ); + lpwfs = (ftp_session_t*) get_handle_object( hConnect ); if (NULL == lpwfs || WH_HFTPSESSION != lpwfs->hdr.htype) { INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE); @@ -610,7 +610,7 @@ BOOL WINAPI FtpCreateDirectoryW(HINTERNET hConnect, LPCWSTR lpszDirectory) appinfo_t *hIC = NULL; BOOL r = FALSE; - lpwfs = (ftp_session_t*) WININET_GetObject( hConnect ); + lpwfs = (ftp_session_t*) get_handle_object( hConnect ); if (!lpwfs) { INTERNET_SetLastError(ERROR_INVALID_HANDLE); @@ -766,7 +766,7 @@ HINTERNET WINAPI FtpFindFirstFileW(HINTERNET hConnect, appinfo_t *hIC = NULL; HINTERNET r = NULL; - lpwfs = (ftp_session_t*) WININET_GetObject( hConnect ); + lpwfs = (ftp_session_t*) get_handle_object( hConnect ); if (NULL == lpwfs || WH_HFTPSESSION != lpwfs->hdr.htype) { INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE); @@ -916,7 +916,7 @@ BOOL WINAPI FtpGetCurrentDirectoryA(HINTERNET hFtpSession, LPSTR lpszCurrentDire len = *lpdwCurrentDirectory; if(lpszCurrentDirectory) { - dir = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + dir = heap_alloc(len * sizeof(WCHAR)); if (NULL == dir) { INTERNET_SetLastError(ERROR_OUTOFMEMORY); @@ -964,7 +964,7 @@ BOOL WINAPI FtpGetCurrentDirectoryW(HINTERNET hFtpSession, LPWSTR lpszCurrentDir TRACE("%p %p %p\n", hFtpSession, lpszCurrentDirectory, lpdwCurrentDirectory); - lpwfs = (ftp_session_t*) WININET_GetObject( hFtpSession ); + lpwfs = (ftp_session_t*) get_handle_object( hFtpSession ); if (NULL == lpwfs) { INTERNET_SetLastError(ERROR_INVALID_HANDLE); @@ -1127,8 +1127,6 @@ static void FTPFILE_Destroy(object_header_t *hdr) if (nResCode > 0 && nResCode != 226) WARN("server reports failed transfer\n"); WININET_Release(&lpwh->lpFtpSession->hdr); - - HeapFree(GetProcessHeap(), 0, lpwh); } static DWORD FTPFILE_QueryOption(object_header_t *hdr, DWORD option, void *buffer, DWORD *size, BOOL unicode) @@ -1326,7 +1324,6 @@ static HINTERNET FTP_FtpOpenFileW(ftp_session_t *lpwfs, BOOL bSuccess = FALSE; ftp_file_t *lpwh = NULL; appinfo_t *hIC = NULL; - HINTERNET handle = NULL; TRACE("\n"); @@ -1347,14 +1344,10 @@ static HINTERNET FTP_FtpOpenFileW(ftp_session_t *lpwfs, /* Get data socket to server */ if (bSuccess && FTP_GetDataSocket(lpwfs, &nDataSocket)) { - lpwh = HeapAlloc(GetProcessHeap(), 0, sizeof(ftp_file_t)); + lpwh = alloc_object(&lpwfs->hdr, &FTPFILEVtbl, sizeof(ftp_file_t)); lpwh->hdr.htype = WH_HFILE; - lpwh->hdr.vtbl = &FTPFILEVtbl; lpwh->hdr.dwFlags = dwFlags; lpwh->hdr.dwContext = dwContext; - lpwh->hdr.dwInternalFlags = 0; - lpwh->hdr.refs = 1; - lpwh->hdr.lpfnStatusCB = lpwfs->hdr.lpfnStatusCB; lpwh->nDataSocket = nDataSocket; lpwh->cache_file = NULL; lpwh->cache_file_handle = INVALID_HANDLE_VALUE; @@ -1364,10 +1357,6 @@ static HINTERNET FTP_FtpOpenFileW(ftp_session_t *lpwfs, lpwh->lpFtpSession = lpwfs; list_add_head( &lpwfs->hdr.children, &lpwh->hdr.entry ); - handle = WININET_AllocHandle( &lpwh->hdr ); - if( !handle ) - goto lend; - /* Indicate that a download is currently in progress */ lpwfs->download_in_progress = lpwh; } @@ -1394,7 +1383,7 @@ static HINTERNET FTP_FtpOpenFileW(ftp_session_t *lpwfs, if (!InternetCreateUrlW(&uc, 0, NULL, &len) && GetLastError() == ERROR_INSUFFICIENT_BUFFER) { - WCHAR *url = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + WCHAR *url = heap_alloc(len * sizeof(WCHAR)); if (url && InternetCreateUrlW(&uc, 0, url, &len) && CreateUrlCacheEntryW(url, 0, NULL, filename, 0)) { @@ -1420,7 +1409,7 @@ static HINTERNET FTP_FtpOpenFileW(ftp_session_t *lpwfs, if (lpwh) { - iar.dwResult = (DWORD_PTR)handle; + iar.dwResult = (DWORD_PTR)lpwh->hdr.hInternet; iar.dwError = ERROR_SUCCESS; SendAsyncCallback(&lpwfs->hdr, lpwfs->hdr.dwContext, INTERNET_STATUS_HANDLE_CREATED, &iar, sizeof(INTERNET_ASYNC_RESULT)); @@ -1436,11 +1425,13 @@ static HINTERNET FTP_FtpOpenFileW(ftp_session_t *lpwfs, } } -lend: - if( lpwh ) - WININET_Release( &lpwh->hdr ); + if(!bSuccess) { + if(lpwh) + WININET_Release( &lpwh->hdr ); + return FALSE; + } - return handle; + return lpwh->hdr.hInternet; } @@ -1501,7 +1492,7 @@ HINTERNET WINAPI FtpOpenFileW(HINTERNET hFtpSession, TRACE("(%p,%s,0x%08x,0x%08x,0x%08lx)\n", hFtpSession, debugstr_w(lpszFileName), fdwAccess, dwFlags, dwContext); - lpwfs = (ftp_session_t*) WININET_GetObject( hFtpSession ); + lpwfs = (ftp_session_t*) get_handle_object( hFtpSession ); if (!lpwfs) { INTERNET_SetLastError(ERROR_INVALID_HANDLE); @@ -1624,7 +1615,7 @@ BOOL WINAPI FtpGetFileW(HINTERNET hInternet, LPCWSTR lpszRemoteFile, LPCWSTR lps return FALSE; } - lpwfs = (ftp_session_t*) WININET_GetObject( hInternet ); + lpwfs = (ftp_session_t*) get_handle_object( hInternet ); if (!lpwfs) { INTERNET_SetLastError(ERROR_INVALID_HANDLE); @@ -1818,7 +1809,7 @@ BOOL WINAPI FtpDeleteFileW(HINTERNET hFtpSession, LPCWSTR lpszFileName) appinfo_t *hIC = NULL; BOOL r = FALSE; - lpwfs = (ftp_session_t*) WININET_GetObject( hFtpSession ); + lpwfs = (ftp_session_t*) get_handle_object( hFtpSession ); if (!lpwfs) { INTERNET_SetLastError(ERROR_INVALID_HANDLE); @@ -1963,7 +1954,7 @@ BOOL WINAPI FtpRemoveDirectoryW(HINTERNET hFtpSession, LPCWSTR lpszDirectory) appinfo_t *hIC = NULL; BOOL r = FALSE; - lpwfs = (ftp_session_t*) WININET_GetObject( hFtpSession ); + lpwfs = (ftp_session_t*) get_handle_object( hFtpSession ); if (!lpwfs) { INTERNET_SetLastError(ERROR_INVALID_HANDLE); @@ -2113,7 +2104,7 @@ BOOL WINAPI FtpRenameFileW(HINTERNET hFtpSession, LPCWSTR lpszSrc, LPCWSTR lpszD appinfo_t *hIC = NULL; BOOL r = FALSE; - lpwfs = (ftp_session_t*) WININET_GetObject( hFtpSession ); + lpwfs = (ftp_session_t*) get_handle_object( hFtpSession ); if (!lpwfs) { INTERNET_SetLastError(ERROR_INVALID_HANDLE); @@ -2279,7 +2270,7 @@ BOOL WINAPI FtpCommandW( HINTERNET hConnect, BOOL fExpectResponse, DWORD dwFlags return FALSE; } - lpwfs = (ftp_session_t*) WININET_GetObject( hConnect ); + lpwfs = (ftp_session_t*) get_handle_object( hConnect ); if (!lpwfs) { INTERNET_SetLastError(ERROR_INVALID_HANDLE); @@ -2299,7 +2290,7 @@ BOOL WINAPI FtpCommandW( HINTERNET hConnect, BOOL fExpectResponse, DWORD dwFlags } len = WideCharToMultiByte(CP_ACP, 0, lpszCommand, -1, NULL, 0, NULL, NULL) + strlen(szCRLF); - if ((cmd = HeapAlloc(GetProcessHeap(), 0, len ))) + if ((cmd = heap_alloc(len))) WideCharToMultiByte(CP_ACP, 0, lpszCommand, -1, cmd, len, NULL, NULL); else { @@ -2353,7 +2344,6 @@ static void FTPSESSION_Destroy(object_header_t *hdr) HeapFree(GetProcessHeap(), 0, lpwfs->lpszPassword); HeapFree(GetProcessHeap(), 0, lpwfs->lpszUserName); HeapFree(GetProcessHeap(), 0, lpwfs->servername); - HeapFree(GetProcessHeap(), 0, lpwfs); } static void FTPSESSION_CloseConnection(object_header_t *hdr) @@ -2449,7 +2439,6 @@ HINTERNET FTP_Connect(appinfo_t *hIC, LPCWSTR lpszServerName, UINT sock_namelen; BOOL bSuccess = FALSE; ftp_session_t *lpwfs = NULL; - HINTERNET handle = NULL; char szaddr[INET_ADDRSTRLEN]; TRACE("%p Server(%s) Port(%d) User(%s) Paswd(%s)\n", @@ -2461,14 +2450,14 @@ HINTERNET FTP_Connect(appinfo_t *hIC, LPCWSTR lpszServerName, if ((!lpszUserName || !*lpszUserName) && lpszPassword && *lpszPassword) { INTERNET_SetLastError(ERROR_INVALID_PARAMETER); - goto lerror; + return NULL; } - lpwfs = HeapAlloc(GetProcessHeap(), 0, sizeof(ftp_session_t)); + lpwfs = alloc_object(&hIC->hdr, &FTPSESSIONVtbl, sizeof(ftp_session_t)); if (NULL == lpwfs) { INTERNET_SetLastError(ERROR_OUTOFMEMORY); - goto lerror; + return NULL; } if (nServerPort == INTERNET_INVALID_PORT_NUMBER) @@ -2477,12 +2466,9 @@ HINTERNET FTP_Connect(appinfo_t *hIC, LPCWSTR lpszServerName, lpwfs->serverport = nServerPort; lpwfs->hdr.htype = WH_HFTPSESSION; - lpwfs->hdr.vtbl = &FTPSESSIONVtbl; lpwfs->hdr.dwFlags = dwFlags; lpwfs->hdr.dwContext = dwContext; - lpwfs->hdr.dwInternalFlags = dwInternalFlags; - lpwfs->hdr.refs = 1; - lpwfs->hdr.lpfnStatusCB = hIC->hdr.lpfnStatusCB; + lpwfs->hdr.dwInternalFlags |= dwInternalFlags; lpwfs->download_in_progress = NULL; lpwfs->sndSocket = -1; lpwfs->lstnSocket = -1; @@ -2492,18 +2478,10 @@ HINTERNET FTP_Connect(appinfo_t *hIC, LPCWSTR lpszServerName, lpwfs->lpAppInfo = hIC; list_add_head( &hIC->hdr.children, &lpwfs->hdr.entry ); - handle = WININET_AllocHandle( &lpwfs->hdr ); - if( !handle ) - { - ERR("Failed to alloc handle\n"); - INTERNET_SetLastError(ERROR_OUTOFMEMORY); - goto lerror; - } - - if(hIC->lpszProxy && hIC->dwAccessType == INTERNET_OPEN_TYPE_PROXY) { - if(strchrW(hIC->lpszProxy, ' ')) + if(hIC->proxy && hIC->accessType == INTERNET_OPEN_TYPE_PROXY) { + if(strchrW(hIC->proxy, ' ')) FIXME("Several proxies not implemented.\n"); - if(hIC->lpszProxyBypass) + if(hIC->proxyBypass) FIXME("Proxy bypass is ignored.\n"); } if (!lpszUserName || !strlenW(lpszUserName)) { @@ -2537,7 +2515,7 @@ HINTERNET FTP_Connect(appinfo_t *hIC, LPCWSTR lpszServerName, { INTERNET_ASYNC_RESULT iar; - iar.dwResult = (DWORD_PTR)handle; + iar.dwResult = (DWORD_PTR)lpwfs->hdr.hInternet; iar.dwError = ERROR_SUCCESS; SendAsyncCallback(&hIC->hdr, dwContext, @@ -2600,15 +2578,14 @@ HINTERNET FTP_Connect(appinfo_t *hIC, LPCWSTR lpszServerName, } lerror: - if (lpwfs) WININET_Release( &lpwfs->hdr ); - - if (!bSuccess && handle) + if (!bSuccess) { - WININET_FreeHandle( handle ); - handle = NULL; + if(lpwfs) + WININET_Release( &lpwfs->hdr ); + return NULL; } - return handle; + return lpwfs->hdr.hInternet; } @@ -2683,7 +2660,7 @@ static BOOL FTP_SendCommandA(INT nSocket, FTP_COMMAND ftpCmd, LPCSTR lpszParam, dwParamLen = lpszParam?strlen(lpszParam)+1:0; len = dwParamLen + strlen(szFtpCommands[ftpCmd]) + strlen(szCRLF); - if (NULL == (buf = HeapAlloc(GetProcessHeap(), 0, len+1))) + if (NULL == (buf = heap_alloc(len+1))) { INTERNET_SetLastError(ERROR_OUTOFMEMORY); return FALSE; @@ -3250,7 +3227,7 @@ static BOOL FTP_SendData(ftp_session_t *lpwfs, INT nDataSocket, HANDLE hFile) CHAR *lpszBuffer; TRACE("\n"); - lpszBuffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CHAR)*DATA_PACKET_SIZE); + lpszBuffer = heap_alloc_zero(sizeof(CHAR)*DATA_PACKET_SIZE); /* Get the size of the file. */ GetFileInformationByHandle(hFile, &fi); @@ -3372,7 +3349,7 @@ static BOOL FTP_RetrieveFileData(ftp_session_t *lpwfs, INT nDataSocket, HANDLE h TRACE("\n"); - lpszBuffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(CHAR)*DATA_PACKET_SIZE); + lpszBuffer = heap_alloc_zero(sizeof(CHAR)*DATA_PACKET_SIZE); if (NULL == lpszBuffer) { INTERNET_SetLastError(ERROR_OUTOFMEMORY); @@ -3419,7 +3396,6 @@ static void FTPFINDNEXT_Destroy(object_header_t *hdr) } HeapFree(GetProcessHeap(), 0, lpwfn->lpafp); - HeapFree(GetProcessHeap(), 0, lpwfn); } static DWORD FTPFINDNEXT_FindNextFileProc(WININETFTPFINDNEXTW *find, LPVOID data) @@ -3530,7 +3506,6 @@ static HINTERNET FTP_ReceiveFileList(ftp_session_t *lpwfs, INT nSocket, LPCWSTR DWORD dwSize = 0; LPFILEPROPERTIESW lpafp = NULL; LPWININETFTPFINDNEXTW lpwfn = NULL; - HINTERNET handle = 0; TRACE("(%p,%d,%s,%p,%08lx)\n", lpwfs, nSocket, debugstr_w(lpszSearchFile), lpFindFileData, dwContext); @@ -3539,14 +3514,11 @@ static HINTERNET FTP_ReceiveFileList(ftp_session_t *lpwfs, INT nSocket, LPCWSTR if(lpFindFileData) FTP_ConvertFileProp(lpafp, lpFindFileData); - lpwfn = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WININETFTPFINDNEXTW)); + lpwfn = alloc_object(&lpwfs->hdr, &FTPFINDNEXTVtbl, sizeof(WININETFTPFINDNEXTW)); if (lpwfn) { lpwfn->hdr.htype = WH_HFTPFINDNEXT; - lpwfn->hdr.vtbl = &FTPFINDNEXTVtbl; lpwfn->hdr.dwContext = dwContext; - lpwfn->hdr.refs = 1; - lpwfn->hdr.lpfnStatusCB = lpwfs->hdr.lpfnStatusCB; lpwfn->index = 1; /* Next index is 1 since we return index 0 */ lpwfn->size = dwSize; lpwfn->lpafp = lpafp; @@ -3554,16 +3526,11 @@ static HINTERNET FTP_ReceiveFileList(ftp_session_t *lpwfs, INT nSocket, LPCWSTR WININET_AddRef( &lpwfs->hdr ); lpwfn->lpFtpSession = lpwfs; list_add_head( &lpwfs->hdr.children, &lpwfn->hdr.entry ); - - handle = WININET_AllocHandle( &lpwfn->hdr ); } } - if( lpwfn ) - WININET_Release( &lpwfn->hdr ); - TRACE("Matched %d files\n", dwSize); - return handle; + return lpwfn ? lpwfn->hdr.hInternet : NULL; } @@ -3785,7 +3752,7 @@ static BOOL FTP_ParseDirectory(ftp_session_t *lpwfs, INT nSocket, LPCWSTR lpszSe TRACE("\n"); /* Allocate initial file properties array */ - *lpafp = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(FILEPROPERTIESW)*(sizeFilePropArray)); + *lpafp = heap_alloc_zero(sizeof(FILEPROPERTIESW)*(sizeFilePropArray)); if (!*lpafp) return FALSE; @@ -3795,8 +3762,7 @@ static BOOL FTP_ParseDirectory(ftp_session_t *lpwfs, INT nSocket, LPCWSTR lpszSe LPFILEPROPERTIESW tmpafp; sizeFilePropArray *= 2; - tmpafp = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, *lpafp, - sizeof(FILEPROPERTIESW)*sizeFilePropArray); + tmpafp = heap_realloc_zero(*lpafp, sizeof(FILEPROPERTIESW)*sizeFilePropArray); if (NULL == tmpafp) { bSuccess = FALSE; @@ -3814,8 +3780,7 @@ static BOOL FTP_ParseDirectory(ftp_session_t *lpwfs, INT nSocket, LPCWSTR lpszSe { LPFILEPROPERTIESW tmpafp; - tmpafp = HeapReAlloc(GetProcessHeap(), 0, *lpafp, - sizeof(FILEPROPERTIESW)*indexFilePropArray); + tmpafp = heap_realloc(*lpafp, sizeof(FILEPROPERTIESW)*indexFilePropArray); if (NULL != tmpafp) *lpafp = tmpafp; } diff --git a/dll/win32/wininet/http.c b/dll/win32/wininet/http.c index 796c3595f7b..89ea4ad0b0c 100644 --- a/dll/win32/wininet/http.c +++ b/dll/win32/wininet/http.c @@ -7,6 +7,7 @@ * Copyright 2004 Mike McCormack for CodeWeavers * Copyright 2005 Aric Stewart for CodeWeavers * Copyright 2006 Robert Shearman for CodeWeavers + * Copyright 2011 Jacek Caban for CodeWeavers * * Ulrich Czekalla * David Hammerton @@ -56,6 +57,7 @@ #include "winbase.h" #include "wininet.h" #include "winerror.h" +#include "winternl.h" #define NO_SHLWAPI_STREAM #define NO_SHLWAPI_REG #define NO_SHLWAPI_STRFCNS @@ -155,6 +157,8 @@ static const WCHAR szWWW_Authenticate[] = { 'W','W','W','-','A','u','t','h','e', #define HTTP_ADDHDR_FLAG_REPLACE 0x80000000 #define HTTP_ADDHDR_FLAG_REQ 0x02000000 +#define COLLECT_TIME 60000 + #define ARRAYSIZE(array) (sizeof(array)/sizeof((array)[0])) struct HttpAuthInfo @@ -171,24 +175,14 @@ struct HttpAuthInfo }; -struct gzip_stream_t { -#ifdef HAVE_ZLIB - z_stream zstream; -#endif - BYTE buf[8192]; - DWORD buf_size; - DWORD buf_pos; - BOOL end_of_data; -}; - typedef struct _basicAuthorizationData { struct list entry; - LPWSTR lpszwHost; - LPWSTR lpszwRealm; - LPSTR lpszAuthorization; - UINT AuthorizationLen; + LPWSTR host; + LPWSTR realm; + LPSTR authorization; + UINT authorizationLen; } basicAuthorizationData; typedef struct _authorizationData @@ -217,7 +211,6 @@ static CRITICAL_SECTION_DEBUG critsect_debug = }; static CRITICAL_SECTION authcache_cs = { &critsect_debug, -1, 0, 0, 0, 0 }; -static DWORD HTTP_OpenConnection(http_request_t *req); static BOOL HTTP_GetResponseHeaders(http_request_t *req, BOOL clear); static DWORD HTTP_ProcessHeader(http_request_t *req, LPCWSTR field, LPCWSTR value, DWORD dwModifier); static LPWSTR * HTTP_InterpretHttpHeader(LPCWSTR buffer); @@ -229,8 +222,123 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t*, DWORD, LPVOID, LPDWORD, LPDWOR static LPWSTR HTTP_GetRedirectURL(http_request_t *req, LPCWSTR lpszUrl); static UINT HTTP_DecodeBase64(LPCWSTR base64, LPSTR bin); static BOOL HTTP_VerifyValidHeader(http_request_t *req, LPCWSTR field); -static void HTTP_DrainContent(http_request_t *req); -static BOOL HTTP_FinishedReading(http_request_t *req); + +static CRITICAL_SECTION connection_pool_cs; +static CRITICAL_SECTION_DEBUG connection_pool_debug = +{ + 0, 0, &connection_pool_cs, + { &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList }, + 0, 0, { (DWORD_PTR)(__FILE__ ": connection_pool_cs") } +}; +static CRITICAL_SECTION connection_pool_cs = { &connection_pool_debug, -1, 0, 0, 0, 0 }; + +static struct list connection_pool = LIST_INIT(connection_pool); +static BOOL collector_running; + +void server_addref(server_t *server) +{ + InterlockedIncrement(&server->ref); +} + +void server_release(server_t *server) +{ + if(InterlockedDecrement(&server->ref)) + return; + + if(!server->ref) + server->keep_until = (DWORD64)GetTickCount() + COLLECT_TIME; +} + +static server_t *get_server(const WCHAR *name, INTERNET_PORT port) +{ + server_t *iter, *server = NULL; + + EnterCriticalSection(&connection_pool_cs); + + LIST_FOR_EACH_ENTRY(iter, &connection_pool, server_t, entry) { + if(iter->port == port && !strcmpW(iter->name, name)) { + server = iter; + server_addref(server); + break; + } + } + + if(!server) { + server = heap_alloc(sizeof(*server)); + if(server) { + server->addr_len = 0; + server->ref = 1; + server->port = port; + list_init(&server->conn_pool); + server->name = heap_strdupW(name); + if(server->name) { + list_add_head(&connection_pool, &server->entry); + }else { + heap_free(server); + server = NULL; + } + } + } + + LeaveCriticalSection(&connection_pool_cs); + + return server; +} + +BOOL collect_connections(BOOL collect_all) +{ + netconn_t *netconn, *netconn_safe; + server_t *server, *server_safe; + BOOL remaining = FALSE; + DWORD64 now; + + now = GetTickCount(); + + LIST_FOR_EACH_ENTRY_SAFE(server, server_safe, &connection_pool, server_t, entry) { + LIST_FOR_EACH_ENTRY_SAFE(netconn, netconn_safe, &server->conn_pool, netconn_t, pool_entry) { + if(collect_all || netconn->keep_until < now) { + TRACE("freeing %p\n", netconn); + list_remove(&netconn->pool_entry); + free_netconn(netconn); + }else { + remaining = TRUE; + } + } + + if(!server->ref) { + if(collect_all || server->keep_until < now) { + list_remove(&server->entry); + + heap_free(server->name); + heap_free(server); + }else { + remaining = TRUE; + } + } + } + + return remaining; +} + +static DWORD WINAPI collect_connections_proc(void *arg) +{ + BOOL remaining_conns; + + do { + /* FIXME: Use more sophisticated method */ + Sleep(5000); + + EnterCriticalSection(&connection_pool_cs); + + remaining_conns = collect_connections(FALSE); + if(!remaining_conns) + collector_running = FALSE; + + LeaveCriticalSection(&connection_pool_cs); + }while(remaining_conns); + + FreeLibraryAndExitThread(WININET_hModule, 0); +} static LPHTTPHEADERW HTTP_GetHeader(http_request_t *req, LPCWSTR head) { @@ -239,14 +347,163 @@ static LPHTTPHEADERW HTTP_GetHeader(http_request_t *req, LPCWSTR head) if (HeaderIndex == -1) return NULL; else - return &req->pCustHeaders[HeaderIndex]; + return &req->custHeaders[HeaderIndex]; +} + +typedef enum { + READMODE_SYNC, + READMODE_ASYNC, + READMODE_NOBLOCK +} read_mode_t; + +struct data_stream_vtbl_t { + DWORD (*get_avail_data)(data_stream_t*,http_request_t*); + BOOL (*end_of_data)(data_stream_t*,http_request_t*); + DWORD (*read)(data_stream_t*,http_request_t*,BYTE*,DWORD,DWORD*,read_mode_t); + BOOL (*drain_content)(data_stream_t*,http_request_t*); + void (*destroy)(data_stream_t*); +}; + +typedef struct { + data_stream_t data_stream; + + BYTE buf[READ_BUFFER_SIZE]; + DWORD buf_size; + DWORD buf_pos; + DWORD chunk_size; +} chunked_stream_t; + +static inline void destroy_data_stream(data_stream_t *stream) +{ + stream->vtbl->destroy(stream); +} + +static void reset_data_stream(http_request_t *req) +{ + destroy_data_stream(req->data_stream); + req->data_stream = &req->netconn_stream.data_stream; + req->read_pos = req->read_size = req->netconn_stream.content_read = 0; + req->read_chunked = req->read_gzip = FALSE; } #ifdef HAVE_ZLIB +typedef struct { + data_stream_t stream; + data_stream_t *parent_stream; + z_stream zstream; + BYTE buf[READ_BUFFER_SIZE]; + DWORD buf_size; + DWORD buf_pos; + BOOL end_of_data; +} gzip_stream_t; + +static DWORD gzip_get_avail_data(data_stream_t *stream, http_request_t *req) +{ + /* Allow reading only from read buffer */ + return 0; +} + +static BOOL gzip_end_of_data(data_stream_t *stream, http_request_t *req) +{ + gzip_stream_t *gzip_stream = (gzip_stream_t*)stream; + return gzip_stream->end_of_data; +} + +static DWORD gzip_read(data_stream_t *stream, http_request_t *req, BYTE *buf, DWORD size, + DWORD *read, read_mode_t read_mode) +{ + gzip_stream_t *gzip_stream = (gzip_stream_t*)stream; + z_stream *zstream = &gzip_stream->zstream; + DWORD current_read, ret_read = 0; + BOOL end; + int zres; + DWORD res = ERROR_SUCCESS; + + while(size && !gzip_stream->end_of_data) { + end = gzip_stream->parent_stream->vtbl->end_of_data(gzip_stream->parent_stream, req); + + if(gzip_stream->buf_size <= 64 && !end) { + if(gzip_stream->buf_pos) { + if(gzip_stream->buf_size) + memmove(gzip_stream->buf, gzip_stream->buf+gzip_stream->buf_pos, gzip_stream->buf_size); + gzip_stream->buf_pos = 0; + } + res = gzip_stream->parent_stream->vtbl->read(gzip_stream->parent_stream, req, gzip_stream->buf+gzip_stream->buf_size, + sizeof(gzip_stream->buf)-gzip_stream->buf_size, ¤t_read, read_mode); + gzip_stream->buf_size += current_read; + if(res != ERROR_SUCCESS) + break; + end = gzip_stream->parent_stream->vtbl->end_of_data(gzip_stream->parent_stream, req); + if(!current_read && !end) { + if(read_mode != READMODE_NOBLOCK) { + WARN("unexpected end of data\n"); + gzip_stream->end_of_data = TRUE; + } + break; + } + if(gzip_stream->buf_size <= 64 && !end) + continue; + } + + zstream->next_in = gzip_stream->buf+gzip_stream->buf_pos; + zstream->avail_in = gzip_stream->buf_size-(end ? 0 : 64); + zstream->next_out = buf+ret_read; + zstream->avail_out = size; + zres = inflate(&gzip_stream->zstream, 0); + current_read = size - zstream->avail_out; + size -= current_read; + ret_read += current_read; + gzip_stream->buf_size -= zstream->next_in - (gzip_stream->buf+gzip_stream->buf_pos); + gzip_stream->buf_pos = zstream->next_in-gzip_stream->buf; + if(zres == Z_STREAM_END) { + TRACE("end of data\n"); + gzip_stream->end_of_data = TRUE; + inflateEnd(zstream); + }else if(zres != Z_OK) { + WARN("inflate failed %d: %s\n", zres, debugstr_a(zstream->msg)); + if(!ret_read) + res = ERROR_INTERNET_DECODING_FAILED; + break; + } + + if(ret_read && read_mode == READMODE_ASYNC) + read_mode = READMODE_NOBLOCK; + } + + TRACE("read %u bytes\n", ret_read); + *read = ret_read; + return res; +} + +static BOOL gzip_drain_content(data_stream_t *stream, http_request_t *req) +{ + gzip_stream_t *gzip_stream = (gzip_stream_t*)stream; + return gzip_stream->parent_stream->vtbl->drain_content(gzip_stream->parent_stream, req); +} + +static void gzip_destroy(data_stream_t *stream) +{ + gzip_stream_t *gzip_stream = (gzip_stream_t*)stream; + + destroy_data_stream(gzip_stream->parent_stream); + + if(!gzip_stream->end_of_data) + inflateEnd(&gzip_stream->zstream); + heap_free(gzip_stream); +} + +static const data_stream_vtbl_t gzip_stream_vtbl = { + gzip_get_avail_data, + gzip_end_of_data, + gzip_read, + gzip_drain_content, + gzip_destroy +}; + static voidpf wininet_zalloc(voidpf opaque, uInt items, uInt size) { - return HeapAlloc(GetProcessHeap(), 0, items*size); + return heap_alloc(items*size); } static void wininet_zfree(voidpf opaque, voidpf address) @@ -254,79 +511,52 @@ static void wininet_zfree(voidpf opaque, voidpf address) HeapFree(GetProcessHeap(), 0, address); } -static void init_gzip_stream(http_request_t *req) +static DWORD init_gzip_stream(http_request_t *req) { gzip_stream_t *gzip_stream; int index, zres; - gzip_stream = HeapAlloc(GetProcessHeap(), 0, sizeof(gzip_stream_t)); + gzip_stream = heap_alloc_zero(sizeof(gzip_stream_t)); + if(!gzip_stream) + return ERROR_OUTOFMEMORY; + + gzip_stream->stream.vtbl = &gzip_stream_vtbl; gzip_stream->zstream.zalloc = wininet_zalloc; gzip_stream->zstream.zfree = wininet_zfree; - gzip_stream->zstream.opaque = NULL; - gzip_stream->zstream.next_in = NULL; - gzip_stream->zstream.avail_in = 0; - gzip_stream->zstream.next_out = NULL; - gzip_stream->zstream.avail_out = 0; - gzip_stream->buf_pos = 0; - gzip_stream->buf_size = 0; - gzip_stream->end_of_data = FALSE; zres = inflateInit2(&gzip_stream->zstream, 0x1f); if(zres != Z_OK) { ERR("inflateInit failed: %d\n", zres); HeapFree(GetProcessHeap(), 0, gzip_stream); - return; + return ERROR_OUTOFMEMORY; } - req->gzip_stream = gzip_stream; - index = HTTP_GetCustomHeaderIndex(req, szContent_Length, 0, FALSE); if(index != -1) HTTP_DeleteCustomHeader(req, index); + + if(req->read_size) { + memcpy(gzip_stream->buf, req->read_buf+req->read_pos, req->read_size); + gzip_stream->buf_size = req->read_size; + req->read_pos = req->read_size = 0; + } + + req->read_gzip = TRUE; + gzip_stream->parent_stream = req->data_stream; + req->data_stream = &gzip_stream->stream; + return ERROR_SUCCESS; } #else -static void init_gzip_stream(http_request_t *req) +static DWORD init_gzip_stream(http_request_t *req) { ERR("gzip stream not supported, missing zlib.\n"); + return ERROR_SUCCESS; } #endif -/* set the request content length based on the headers */ -static DWORD set_content_length( http_request_t *lpwhr ) -{ - static const WCHAR szChunked[] = {'c','h','u','n','k','e','d',0}; - WCHAR encoding[20]; - DWORD size; - - size = sizeof(lpwhr->dwContentLength); - if (HTTP_HttpQueryInfoW(lpwhr, HTTP_QUERY_FLAG_NUMBER|HTTP_QUERY_CONTENT_LENGTH, - &lpwhr->dwContentLength, &size, NULL) != ERROR_SUCCESS) - lpwhr->dwContentLength = ~0u; - - size = sizeof(encoding); - if (HTTP_HttpQueryInfoW(lpwhr, HTTP_QUERY_TRANSFER_ENCODING, encoding, &size, NULL) == ERROR_SUCCESS && - !strcmpiW(encoding, szChunked)) - { - lpwhr->dwContentLength = ~0u; - lpwhr->read_chunked = TRUE; - } - - if(lpwhr->decoding) { - int encoding_idx; - - static const WCHAR gzipW[] = {'g','z','i','p',0}; - - encoding_idx = HTTP_GetCustomHeaderIndex(lpwhr, szContent_Encoding, 0, FALSE); - if(encoding_idx != -1 && !strcmpiW(lpwhr->pCustHeaders[encoding_idx].lpszValue, gzipW)) - init_gzip_stream(lpwhr); - } - - return lpwhr->dwContentLength; -} - /*********************************************************************** * HTTP_Tokenize (internal) * @@ -361,7 +591,7 @@ static LPWSTR * HTTP_Tokenize(LPCWSTR string, LPCWSTR token_string) } /* add 1 for terminating NULL */ - token_array = HeapAlloc(GetProcessHeap(), 0, (tokens+1) * sizeof(*token_array)); + token_array = heap_alloc((tokens+1) * sizeof(*token_array)); token_array[tokens] = NULL; if (!tokens) return token_array; @@ -371,7 +601,7 @@ static LPWSTR * HTTP_Tokenize(LPCWSTR string, LPCWSTR token_string) next_token = strstrW(string, token_string); if (!next_token) next_token = string+strlenW(string); len = next_token - string; - token_array[i] = HeapAlloc(GetProcessHeap(), 0, (len+1)*sizeof(WCHAR)); + token_array[i] = heap_alloc((len+1)*sizeof(WCHAR)); memcpy(token_array[i], string, len*sizeof(WCHAR)); token_array[i][len] = '\0'; string = next_token+strlenW(token_string); @@ -392,43 +622,42 @@ static void HTTP_FreeTokens(LPWSTR * token_array) HeapFree(GetProcessHeap(), 0, token_array); } -static void HTTP_FixURL(http_request_t *lpwhr) +static void HTTP_FixURL(http_request_t *request) { static const WCHAR szSlash[] = { '/',0 }; static const WCHAR szHttp[] = { 'h','t','t','p',':','/','/', 0 }; /* If we don't have a path we set it to root */ - if (NULL == lpwhr->lpszPath) - lpwhr->lpszPath = heap_strdupW(szSlash); + if (NULL == request->path) + request->path = heap_strdupW(szSlash); else /* remove \r and \n*/ { - int nLen = strlenW(lpwhr->lpszPath); - while ((nLen >0 ) && ((lpwhr->lpszPath[nLen-1] == '\r')||(lpwhr->lpszPath[nLen-1] == '\n'))) + int nLen = strlenW(request->path); + while ((nLen >0 ) && ((request->path[nLen-1] == '\r')||(request->path[nLen-1] == '\n'))) { nLen--; - lpwhr->lpszPath[nLen]='\0'; + request->path[nLen]='\0'; } /* Replace '\' with '/' */ while (nLen>0) { nLen--; - if (lpwhr->lpszPath[nLen] == '\\') lpwhr->lpszPath[nLen]='/'; + if (request->path[nLen] == '\\') request->path[nLen]='/'; } } if(CSTR_EQUAL != CompareStringW( LOCALE_SYSTEM_DEFAULT, NORM_IGNORECASE, - lpwhr->lpszPath, strlenW(lpwhr->lpszPath), szHttp, strlenW(szHttp) ) - && lpwhr->lpszPath[0] != '/') /* not an absolute path ?? --> fix it !! */ + request->path, strlenW(request->path), szHttp, strlenW(szHttp) ) + && request->path[0] != '/') /* not an absolute path ?? --> fix it !! */ { - WCHAR *fixurl = HeapAlloc(GetProcessHeap(), 0, - (strlenW(lpwhr->lpszPath) + 2)*sizeof(WCHAR)); + WCHAR *fixurl = heap_alloc((strlenW(request->path) + 2)*sizeof(WCHAR)); *fixurl = '/'; - strcpyW(fixurl + 1, lpwhr->lpszPath); - HeapFree( GetProcessHeap(), 0, lpwhr->lpszPath ); - lpwhr->lpszPath = fixurl; + strcpyW(fixurl + 1, request->path); + HeapFree( GetProcessHeap(), 0, request->path ); + request->path = fixurl; } } -static LPWSTR HTTP_BuildHeaderRequestString( http_request_t *lpwhr, LPCWSTR verb, LPCWSTR path, LPCWSTR version ) +static LPWSTR HTTP_BuildHeaderRequestString( http_request_t *request, LPCWSTR verb, LPCWSTR path, LPCWSTR version ) { LPWSTR requestString; DWORD len, n; @@ -441,8 +670,8 @@ static LPWSTR HTTP_BuildHeaderRequestString( http_request_t *lpwhr, LPCWSTR verb static const WCHAR sztwocrlf[] = {'\r','\n','\r','\n', 0}; /* allocate space for an array of all the string pointers to be added */ - len = (lpwhr->nCustHeaders)*4 + 10; - req = HeapAlloc( GetProcessHeap(), 0, len*sizeof(LPCWSTR) ); + len = (request->nCustHeaders)*4 + 10; + req = heap_alloc(len*sizeof(LPCWSTR)); /* add the verb, path and HTTP version string */ n = 0; @@ -453,18 +682,18 @@ static LPWSTR HTTP_BuildHeaderRequestString( http_request_t *lpwhr, LPCWSTR verb req[n++] = version; /* Append custom request headers */ - for (i = 0; i < lpwhr->nCustHeaders; i++) + for (i = 0; i < request->nCustHeaders; i++) { - if (lpwhr->pCustHeaders[i].wFlags & HDR_ISREQUEST) + if (request->custHeaders[i].wFlags & HDR_ISREQUEST) { req[n++] = szCrLf; - req[n++] = lpwhr->pCustHeaders[i].lpszField; + req[n++] = request->custHeaders[i].lpszField; req[n++] = szColon; - req[n++] = lpwhr->pCustHeaders[i].lpszValue; + req[n++] = request->custHeaders[i].lpszValue; TRACE("Adding custom header %s (%s)\n", - debugstr_w(lpwhr->pCustHeaders[i].lpszField), - debugstr_w(lpwhr->pCustHeaders[i].lpszValue)); + debugstr_w(request->custHeaders[i].lpszField), + debugstr_w(request->custHeaders[i].lpszValue)); } } @@ -487,32 +716,41 @@ static LPWSTR HTTP_BuildHeaderRequestString( http_request_t *lpwhr, LPCWSTR verb return requestString; } -static void HTTP_ProcessCookies( http_request_t *lpwhr ) +static void HTTP_ProcessCookies( http_request_t *request ) { int HeaderIndex; int numCookies = 0; LPHTTPHEADERW setCookieHeader; - while((HeaderIndex = HTTP_GetCustomHeaderIndex(lpwhr, szSet_Cookie, numCookies, FALSE)) != -1) + if(request->hdr.dwFlags & INTERNET_FLAG_NO_COOKIES) + return; + + while((HeaderIndex = HTTP_GetCustomHeaderIndex(request, szSet_Cookie, numCookies++, FALSE)) != -1) { - setCookieHeader = &lpwhr->pCustHeaders[HeaderIndex]; + HTTPHEADERW *host; + const WCHAR *data; + WCHAR *name; - if (!(lpwhr->hdr.dwFlags & INTERNET_FLAG_NO_COOKIES) && setCookieHeader->lpszValue) - { - int len; - static const WCHAR szFmt[] = { 'h','t','t','p',':','/','/','%','s','%','s',0}; - LPWSTR buf_url; - LPHTTPHEADERW Host; + setCookieHeader = &request->custHeaders[HeaderIndex]; - Host = HTTP_GetHeader(lpwhr, hostW); - len = lstrlenW(Host->lpszValue) + 9 + lstrlenW(lpwhr->lpszPath); - buf_url = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR)); - sprintfW(buf_url, szFmt, Host->lpszValue, lpwhr->lpszPath); - InternetSetCookieW(buf_url, NULL, setCookieHeader->lpszValue); + if (!setCookieHeader->lpszValue) + continue; - HeapFree(GetProcessHeap(), 0, buf_url); - } - numCookies++; + host = HTTP_GetHeader(request, hostW); + if(!host) + continue; + + data = strchrW(setCookieHeader->lpszValue, '='); + if(!data) + continue; + + name = heap_strndupW(setCookieHeader->lpszValue, data-setCookieHeader->lpszValue); + if(!name) + continue; + + data++; + set_cookie(host->lpszValue, request->path, name, data); + heap_free(name); } } @@ -595,12 +833,12 @@ static UINT retrieve_cached_basic_authorization(LPWSTR host, LPWSTR realm, LPSTR EnterCriticalSection(&authcache_cs); LIST_FOR_EACH_ENTRY(ad, &basicAuthorizationCache, basicAuthorizationData, entry) { - if (!strcmpiW(host,ad->lpszwHost) && !strcmpW(realm,ad->lpszwRealm)) + if (!strcmpiW(host,ad->host) && !strcmpW(realm,ad->realm)) { TRACE("Authorization found in cache\n"); - *auth_data = HeapAlloc(GetProcessHeap(),0,ad->AuthorizationLen); - memcpy(*auth_data,ad->lpszAuthorization,ad->AuthorizationLen); - rc = ad->AuthorizationLen; + *auth_data = heap_alloc(ad->authorizationLen); + memcpy(*auth_data,ad->authorization,ad->authorizationLen); + rc = ad->authorizationLen; break; } } @@ -619,7 +857,7 @@ static void cache_basic_authorization(LPWSTR host, LPWSTR realm, LPSTR auth_data LIST_FOR_EACH(cursor, &basicAuthorizationCache) { basicAuthorizationData *check = LIST_ENTRY(cursor,basicAuthorizationData,entry); - if (!strcmpiW(host,check->lpszwHost) && !strcmpW(realm,check->lpszwRealm)) + if (!strcmpiW(host,check->host) && !strcmpW(realm,check->realm)) { ad = check; break; @@ -629,19 +867,19 @@ static void cache_basic_authorization(LPWSTR host, LPWSTR realm, LPSTR auth_data if (ad) { TRACE("Found match in cache, replacing\n"); - HeapFree(GetProcessHeap(),0,ad->lpszAuthorization); - ad->lpszAuthorization = HeapAlloc(GetProcessHeap(),0,auth_data_len); - memcpy(ad->lpszAuthorization, auth_data, auth_data_len); - ad->AuthorizationLen = auth_data_len; + HeapFree(GetProcessHeap(),0,ad->authorization); + ad->authorization = heap_alloc(auth_data_len); + memcpy(ad->authorization, auth_data, auth_data_len); + ad->authorizationLen = auth_data_len; } else { - ad = HeapAlloc(GetProcessHeap(),0,sizeof(basicAuthorizationData)); - ad->lpszwHost = heap_strdupW(host); - ad->lpszwRealm = heap_strdupW(realm); - ad->lpszAuthorization = HeapAlloc(GetProcessHeap(),0,auth_data_len); - memcpy(ad->lpszAuthorization, auth_data, auth_data_len); - ad->AuthorizationLen = auth_data_len; + ad = heap_alloc(sizeof(basicAuthorizationData)); + ad->host = heap_strdupW(host); + ad->host = heap_strdupW(realm); + ad->authorization = heap_alloc(auth_data_len); + memcpy(ad->authorization, auth_data, auth_data_len); + ad->authorizationLen = auth_data_len; list_add_head(&basicAuthorizationCache,&ad->entry); TRACE("authorization cached\n"); } @@ -662,7 +900,7 @@ static BOOL retrieve_cached_authorization(LPWSTR host, LPWSTR scheme, nt_auth_identity->User = heap_strdupW(ad->user); nt_auth_identity->Password = heap_strdupW(ad->password); - nt_auth_identity->Domain = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*ad->domain_len); + nt_auth_identity->Domain = heap_alloc(sizeof(WCHAR)*ad->domain_len); if(!nt_auth_identity->User || !nt_auth_identity->Password || (!nt_auth_identity->Domain && ad->domain_len)) { HeapFree(GetProcessHeap(), 0, nt_auth_identity->User); @@ -705,7 +943,7 @@ static void cache_authorization(LPWSTR host, LPWSTR scheme, HeapFree(GetProcessHeap(), 0, ad->password); HeapFree(GetProcessHeap(), 0, ad->domain); } else { - ad = HeapAlloc(GetProcessHeap(), 0, sizeof(authorizationData)); + ad = heap_alloc(sizeof(authorizationData)); if(!ad) { LeaveCriticalSection(&authcache_cs); return; @@ -737,7 +975,7 @@ static void cache_authorization(LPWSTR host, LPWSTR scheme, LeaveCriticalSection(&authcache_cs); } -static BOOL HTTP_DoAuthorization( http_request_t *lpwhr, LPCWSTR pszAuthValue, +static BOOL HTTP_DoAuthorization( http_request_t *request, LPCWSTR pszAuthValue, struct HttpAuthInfo **ppAuthInfo, LPWSTR domain_and_username, LPWSTR password, LPWSTR host ) @@ -754,7 +992,7 @@ static BOOL HTTP_DoAuthorization( http_request_t *lpwhr, LPCWSTR pszAuthValue, TimeStamp exp; first = TRUE; - pAuthInfo = HeapAlloc(GetProcessHeap(), 0, sizeof(*pAuthInfo)); + pAuthInfo = heap_alloc(sizeof(*pAuthInfo)); if (!pAuthInfo) return FALSE; @@ -889,7 +1127,7 @@ static BOOL HTTP_DoAuthorization( http_request_t *lpwhr, LPCWSTR pszAuthValue, passlen = WideCharToMultiByte(CP_UTF8, 0, password, lstrlenW(password), NULL, 0, NULL, NULL); /* length includes a nul terminator, which will be re-used for the ':' */ - auth_data = HeapAlloc(GetProcessHeap(), 0, userlen + 1 + passlen); + auth_data = heap_alloc(userlen + 1 + passlen); if (!auth_data) { HeapFree(GetProcessHeap(),0,szRealm); @@ -933,11 +1171,11 @@ static BOOL HTTP_DoAuthorization( http_request_t *lpwhr, LPCWSTR pszAuthValue, { pszAuthData++; in.cbBuffer = HTTP_DecodeBase64(pszAuthData, NULL); - in.pvBuffer = HeapAlloc(GetProcessHeap(), 0, in.cbBuffer); + in.pvBuffer = heap_alloc(in.cbBuffer); HTTP_DecodeBase64(pszAuthData, in.pvBuffer); } - buffer = HeapAlloc(GetProcessHeap(), 0, pAuthInfo->max_token); + buffer = heap_alloc(pAuthInfo->max_token); out.BufferType = SECBUFFER_TOKEN; out.cbBuffer = pAuthInfo->max_token; @@ -949,7 +1187,7 @@ static BOOL HTTP_DoAuthorization( http_request_t *lpwhr, LPCWSTR pszAuthValue, sec_status = InitializeSecurityContextW(first ? &pAuthInfo->cred : NULL, first ? NULL : &pAuthInfo->ctx, - first ? lpwhr->lpHttpSession->lpszServerName : NULL, + first ? request->session->serverName : NULL, context_req, 0, SECURITY_NETWORK_DREP, in.pvBuffer ? &in_desc : NULL, 0, &pAuthInfo->ctx, &out_desc, @@ -983,7 +1221,7 @@ static BOOL HTTP_DoAuthorization( http_request_t *lpwhr, LPCWSTR pszAuthValue, /*********************************************************************** * HTTP_HttpAddRequestHeadersW (internal) */ -static DWORD HTTP_HttpAddRequestHeadersW(http_request_t *lpwhr, +static DWORD HTTP_HttpAddRequestHeadersW(http_request_t *request, LPCWSTR lpszHeader, DWORD dwHeaderLength, DWORD dwModifier) { LPWSTR lpszStart; @@ -997,7 +1235,7 @@ static DWORD HTTP_HttpAddRequestHeadersW(http_request_t *lpwhr, len = strlenW(lpszHeader); else len = dwHeaderLength; - buffer = HeapAlloc( GetProcessHeap(), 0, sizeof(WCHAR)*(len+1) ); + buffer = heap_alloc(sizeof(WCHAR)*(len+1)); lstrcpynW( buffer, lpszHeader, len + 1); lpszStart = buffer; @@ -1034,9 +1272,9 @@ static DWORD HTTP_HttpAddRequestHeadersW(http_request_t *lpwhr, pFieldAndValue = HTTP_InterpretHttpHeader(lpszStart); if (pFieldAndValue) { - res = HTTP_VerifyValidHeader(lpwhr, pFieldAndValue[0]); + res = HTTP_VerifyValidHeader(request, pFieldAndValue[0]); if (res == ERROR_SUCCESS) - res = HTTP_ProcessHeader(lpwhr, pFieldAndValue[0], + res = HTTP_ProcessHeader(request, pFieldAndValue[0], pFieldAndValue[1], dwModifier | HTTP_ADDHDR_FLAG_REQ); HTTP_FreeTokens(pFieldAndValue); } @@ -1068,7 +1306,7 @@ static DWORD HTTP_HttpAddRequestHeadersW(http_request_t *lpwhr, BOOL WINAPI HttpAddRequestHeadersW(HINTERNET hHttpRequest, LPCWSTR lpszHeader, DWORD dwHeaderLength, DWORD dwModifier) { - http_request_t *lpwhr; + http_request_t *request; DWORD res = ERROR_INTERNET_INCORRECT_HANDLE_TYPE; TRACE("%p, %s, %i, %i\n", hHttpRequest, debugstr_wn(lpszHeader, dwHeaderLength), dwHeaderLength, dwModifier); @@ -1076,11 +1314,11 @@ BOOL WINAPI HttpAddRequestHeadersW(HINTERNET hHttpRequest, if (!lpszHeader) return TRUE; - lpwhr = (http_request_t*) WININET_GetObject( hHttpRequest ); - if (lpwhr && lpwhr->hdr.htype == WH_HHTTPREQ) - res = HTTP_HttpAddRequestHeadersW( lpwhr, lpszHeader, dwHeaderLength, dwModifier ); - if( lpwhr ) - WININET_Release( &lpwhr->hdr ); + request = (http_request_t*) get_handle_object( hHttpRequest ); + if (request && request->hdr.htype == WH_HHTTPREQ) + res = HTTP_HttpAddRequestHeadersW( request, lpszHeader, dwHeaderLength, dwModifier ); + if( request ) + WININET_Release( &request->hdr ); if(res != ERROR_SUCCESS) SetLastError(res); @@ -1107,7 +1345,7 @@ BOOL WINAPI HttpAddRequestHeadersA(HINTERNET hHttpRequest, TRACE("%p, %s, %i, %i\n", hHttpRequest, debugstr_an(lpszHeader, dwHeaderLength), dwHeaderLength, dwModifier); len = MultiByteToWideChar( CP_ACP, 0, lpszHeader, dwHeaderLength, NULL, 0 ); - hdr = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) ); + hdr = heap_alloc(len*sizeof(WCHAR)); MultiByteToWideChar( CP_ACP, 0, lpszHeader, dwHeaderLength, hdr, len ); if( dwHeaderLength != ~0U ) dwHeaderLength = len; @@ -1195,7 +1433,7 @@ HINTERNET WINAPI HttpOpenRequestA(HINTERNET hHttpSession, __ENDTRY; types++; } - szAcceptTypes = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR *) * (acceptTypesCount+1)); + szAcceptTypes = heap_alloc(sizeof(WCHAR *) * (acceptTypesCount+1)); if (!szAcceptTypes) goto end; acceptTypesCount = 0; @@ -1377,7 +1615,7 @@ static UINT HTTP_DecodeBase64( LPCWSTR base64, LPSTR bin ) * * Insert or delete the authorization field in the request header. */ -static BOOL HTTP_InsertAuthorization( http_request_t *lpwhr, struct HttpAuthInfo *pAuthInfo, LPCWSTR header ) +static BOOL HTTP_InsertAuthorization( http_request_t *request, struct HttpAuthInfo *pAuthInfo, LPCWSTR header ) { if (pAuthInfo) { @@ -1390,7 +1628,7 @@ static BOOL HTTP_InsertAuthorization( http_request_t *lpwhr, struct HttpAuthInfo { /* scheme + space + base64 encoded data (3/2/1 bytes data -> 4 bytes of characters) */ len = strlenW(pAuthInfo->scheme)+1+((pAuthInfo->auth_data_len+2)*4)/3; - authorization = HeapAlloc(GetProcessHeap(), 0, (len+1)*sizeof(WCHAR)); + authorization = heap_alloc((len+1)*sizeof(WCHAR)); if (!authorization) return FALSE; @@ -1413,7 +1651,7 @@ static BOOL HTTP_InsertAuthorization( http_request_t *lpwhr, struct HttpAuthInfo TRACE("Inserting authorization: %s\n", debugstr_w(authorization)); - HTTP_ProcessHeader(lpwhr, header, authorization, HTTP_ADDHDR_FLAG_REQ | HTTP_ADDHDR_FLAG_REPLACE); + HTTP_ProcessHeader(request, header, authorization, HTTP_ADDHDR_FLAG_REQ | HTTP_ADDHDR_FLAG_REPLACE); HeapFree(GetProcessHeap(), 0, authorization); } @@ -1428,27 +1666,27 @@ static WCHAR *HTTP_BuildProxyRequestUrl(http_request_t *req) size = sizeof(new_location); if (HTTP_HttpQueryInfoW(req, HTTP_QUERY_LOCATION, new_location, &size, NULL) == ERROR_SUCCESS) { - if (!(url = HeapAlloc( GetProcessHeap(), 0, size + sizeof(WCHAR) ))) return NULL; + if (!(url = heap_alloc(size + sizeof(WCHAR)))) return NULL; strcpyW( url, new_location ); } else { static const WCHAR slash[] = { '/',0 }; - static const WCHAR format[] = { 'h','t','t','p',':','/','/','%','s',':','%','d',0 }; - static const WCHAR formatSSL[] = { 'h','t','t','p','s',':','/','/','%','s',':','%','d',0 }; - http_session_t *session = req->lpHttpSession; + static const WCHAR format[] = { 'h','t','t','p',':','/','/','%','s',':','%','u',0 }; + static const WCHAR formatSSL[] = { 'h','t','t','p','s',':','/','/','%','s',':','%','u',0 }; + http_session_t *session = req->session; size = 16; /* "https://" + sizeof(port#) + ":/\0" */ - size += strlenW( session->lpszHostName ) + strlenW( req->lpszPath ); + size += strlenW( session->hostName ) + strlenW( req->path ); - if (!(url = HeapAlloc( GetProcessHeap(), 0, size * sizeof(WCHAR) ))) return NULL; + if (!(url = heap_alloc(size * sizeof(WCHAR)))) return NULL; if (req->hdr.dwFlags & INTERNET_FLAG_SECURE) - sprintfW( url, formatSSL, session->lpszHostName, session->nHostPort ); + sprintfW( url, formatSSL, session->hostName, session->hostPort ); else - sprintfW( url, format, session->lpszHostName, session->nHostPort ); - if (req->lpszPath[0] != '/') strcatW( url, slash ); - strcatW( url, req->lpszPath ); + sprintfW( url, format, session->hostName, session->hostPort ); + if (req->path[0] != '/') strcatW( url, slash ); + strcatW( url, req->path ); } TRACE("url=%s\n", debugstr_w(url)); return url; @@ -1457,7 +1695,7 @@ static WCHAR *HTTP_BuildProxyRequestUrl(http_request_t *req) /*********************************************************************** * HTTP_DealWithProxy */ -static BOOL HTTP_DealWithProxy(appinfo_t *hIC, http_session_t *lpwhs, http_request_t *lpwhr) +static BOOL HTTP_DealWithProxy(appinfo_t *hIC, http_session_t *session, http_request_t *request) { WCHAR buf[MAXHOSTNAME]; WCHAR protoProxy[MAXHOSTNAME + 15]; @@ -1474,7 +1712,7 @@ static BOOL HTTP_DealWithProxy(appinfo_t *hIC, http_session_t *lpwhs, http_reque UrlComponents.lpszHostName = buf; UrlComponents.dwHostNameLength = MAXHOSTNAME; - if (!INTERNET_FindProxyForProtocol(hIC->lpszProxy, protoHttp, protoProxy, &protoProxyLen)) + if (!INTERNET_FindProxyForProtocol(hIC->proxy, protoHttp, protoProxy, &protoProxyLen)) return FALSE; if( CSTR_EQUAL != CompareStringW(LOCALE_SYSTEM_DEFAULT, NORM_IGNORECASE, protoProxy,strlenW(szHttp),szHttp,strlenW(szHttp)) ) @@ -1486,72 +1724,80 @@ static BOOL HTTP_DealWithProxy(appinfo_t *hIC, http_session_t *lpwhs, http_reque if( UrlComponents.dwHostNameLength == 0 ) return FALSE; - if( !lpwhr->lpszPath ) - lpwhr->lpszPath = szNul; + if( !request->path ) + request->path = szNul; if(UrlComponents.nPort == INTERNET_INVALID_PORT_NUMBER) UrlComponents.nPort = INTERNET_DEFAULT_HTTP_PORT; - HeapFree(GetProcessHeap(), 0, lpwhs->lpszServerName); - lpwhs->lpszServerName = heap_strdupW(UrlComponents.lpszHostName); - lpwhs->nServerPort = UrlComponents.nPort; + HeapFree(GetProcessHeap(), 0, session->serverName); + session->serverName = heap_strdupW(UrlComponents.lpszHostName); + session->serverPort = UrlComponents.nPort; - TRACE("proxy server=%s port=%d\n", debugstr_w(lpwhs->lpszServerName), lpwhs->nServerPort); + TRACE("proxy server=%s port=%d\n", debugstr_w(session->serverName), session->serverPort); return TRUE; } -#ifndef INET6_ADDRSTRLEN -#define INET6_ADDRSTRLEN 46 -#endif - -static DWORD HTTP_ResolveName(http_request_t *lpwhr) +static DWORD HTTP_ResolveName(http_request_t *request, server_t *server) { - char szaddr[INET6_ADDRSTRLEN]; - http_session_t *lpwhs = lpwhr->lpHttpSession; + socklen_t addr_len; const void *addr; - INTERNET_SendCallback(&lpwhr->hdr, lpwhr->hdr.dwContext, - INTERNET_STATUS_RESOLVING_NAME, - lpwhs->lpszServerName, - (strlenW(lpwhs->lpszServerName)+1) * sizeof(WCHAR)); + if(server->addr_len) + return ERROR_SUCCESS; - lpwhs->sa_len = sizeof(lpwhs->socketAddress); - if (!GetAddress(lpwhs->lpszServerName, lpwhs->nServerPort, - (struct sockaddr *)&lpwhs->socketAddress, &lpwhs->sa_len)) + INTERNET_SendCallback(&request->hdr, request->hdr.dwContext, + INTERNET_STATUS_RESOLVING_NAME, + server->name, + (strlenW(server->name)+1) * sizeof(WCHAR)); + + addr_len = sizeof(server->addr); + if (!GetAddress(server->name, server->port, (struct sockaddr *)&server->addr, &addr_len)) return ERROR_INTERNET_NAME_NOT_RESOLVED; - switch (lpwhs->socketAddress.ss_family) - { + switch(server->addr.ss_family) { case AF_INET: - addr = &((struct sockaddr_in *)&lpwhs->socketAddress)->sin_addr; + addr = &((struct sockaddr_in *)&server->addr)->sin_addr; break; case AF_INET6: - addr = &((struct sockaddr_in6 *)&lpwhs->socketAddress)->sin6_addr; + addr = &((struct sockaddr_in6 *)&server->addr)->sin6_addr; break; default: - WARN("unsupported family %d\n", lpwhs->socketAddress.ss_family); + WARN("unsupported family %d\n", server->addr.ss_family); return ERROR_INTERNET_NAME_NOT_RESOLVED; } - inet_ntop(lpwhs->socketAddress.ss_family, addr, szaddr, sizeof(szaddr)); - INTERNET_SendCallback(&lpwhr->hdr, lpwhr->hdr.dwContext, - INTERNET_STATUS_NAME_RESOLVED, - szaddr, strlen(szaddr)+1); - TRACE("resolved %s to %s\n", debugstr_w(lpwhs->lpszServerName), szaddr); + server->addr_len = addr_len; + inet_ntop(server->addr.ss_family, addr, server->addr_str, sizeof(server->addr_str)); + INTERNET_SendCallback(&request->hdr, request->hdr.dwContext, + INTERNET_STATUS_NAME_RESOLVED, + server->addr_str, strlen(server->addr_str)+1); + + TRACE("resolved %s to %s\n", debugstr_w(server->name), server->addr_str); return ERROR_SUCCESS; } static BOOL HTTP_GetRequestURL(http_request_t *req, LPWSTR buf) { + static const WCHAR http[] = { 'h','t','t','p',':','/','/',0 }; + static const WCHAR https[] = { 'h','t','t','p','s',':','/','/',0 }; + static const WCHAR slash[] = { '/',0 }; LPHTTPHEADERW host_header; - - static const WCHAR formatW[] = {'h','t','t','p',':','/','/','%','s','%','s',0}; + LPCWSTR scheme; host_header = HTTP_GetHeader(req, hostW); if(!host_header) return FALSE; - sprintfW(buf, formatW, host_header->lpszValue, req->lpszPath); /* FIXME */ + if (req->hdr.dwFlags & INTERNET_FLAG_SECURE) + scheme = https; + else + scheme = http; + strcpyW(buf, scheme); + strcatW(buf, host_header->lpszValue); + if (req->path[0] != '/') + strcatW(buf, slash); + strcatW(buf, req->path); return TRUE; } @@ -1564,75 +1810,117 @@ static BOOL HTTP_GetRequestURL(http_request_t *req, LPWSTR buf) */ static void HTTPREQ_Destroy(object_header_t *hdr) { - http_request_t *lpwhr = (http_request_t*) hdr; + http_request_t *request = (http_request_t*) hdr; DWORD i; TRACE("\n"); - if(lpwhr->hCacheFile) { + if(request->hCacheFile) { WCHAR url[INTERNET_MAX_URL_LENGTH]; - FILETIME ft; - CloseHandle(lpwhr->hCacheFile); + CloseHandle(request->hCacheFile); - memset(&ft, 0, sizeof(FILETIME)); - if(HTTP_GetRequestURL(lpwhr, url)) { - CommitUrlCacheEntryW(url, lpwhr->lpszCacheFile, ft, ft, - NORMAL_CACHE_ENTRY, NULL, 0, NULL, 0); + if(HTTP_GetRequestURL(request, url)) { + DWORD headersLen; + + headersLen = request->rawHeaders ? strlenW(request->rawHeaders) : 0; + CommitUrlCacheEntryW(url, request->cacheFile, request->expires, + request->last_modified, NORMAL_CACHE_ENTRY, + request->rawHeaders, headersLen, NULL, 0); } } - HeapFree(GetProcessHeap(), 0, lpwhr->lpszCacheFile); + HeapFree(GetProcessHeap(), 0, request->cacheFile); - DeleteCriticalSection( &lpwhr->read_section ); - WININET_Release(&lpwhr->lpHttpSession->hdr); + DeleteCriticalSection( &request->read_section ); + WININET_Release(&request->session->hdr); - destroy_authinfo(lpwhr->pAuthInfo); - destroy_authinfo(lpwhr->pProxyAuthInfo); + destroy_authinfo(request->authInfo); + destroy_authinfo(request->proxyAuthInfo); - HeapFree(GetProcessHeap(), 0, lpwhr->lpszPath); - HeapFree(GetProcessHeap(), 0, lpwhr->lpszVerb); - HeapFree(GetProcessHeap(), 0, lpwhr->lpszRawHeaders); - HeapFree(GetProcessHeap(), 0, lpwhr->lpszVersion); - HeapFree(GetProcessHeap(), 0, lpwhr->lpszStatusText); + HeapFree(GetProcessHeap(), 0, request->path); + HeapFree(GetProcessHeap(), 0, request->verb); + HeapFree(GetProcessHeap(), 0, request->rawHeaders); + HeapFree(GetProcessHeap(), 0, request->version); + HeapFree(GetProcessHeap(), 0, request->statusText); - for (i = 0; i < lpwhr->nCustHeaders; i++) + for (i = 0; i < request->nCustHeaders; i++) { - HeapFree(GetProcessHeap(), 0, lpwhr->pCustHeaders[i].lpszField); - HeapFree(GetProcessHeap(), 0, lpwhr->pCustHeaders[i].lpszValue); + HeapFree(GetProcessHeap(), 0, request->custHeaders[i].lpszField); + HeapFree(GetProcessHeap(), 0, request->custHeaders[i].lpszValue); } -#ifdef HAVE_ZLIB - if(lpwhr->gzip_stream) { - if(!lpwhr->gzip_stream->end_of_data) - inflateEnd(&lpwhr->gzip_stream->zstream); - HeapFree(GetProcessHeap(), 0, lpwhr->gzip_stream); - } -#endif - - HeapFree(GetProcessHeap(), 0, lpwhr->pCustHeaders); - HeapFree(GetProcessHeap(), 0, lpwhr); + destroy_data_stream(request->data_stream); + HeapFree(GetProcessHeap(), 0, request->custHeaders); } -static void HTTPREQ_CloseConnection(object_header_t *hdr) +static void http_release_netconn(http_request_t *req, BOOL reuse) { - http_request_t *lpwhr = (http_request_t*) hdr; + TRACE("%p %p\n",req, req->netconn); - TRACE("%p\n",lpwhr); - - if (!NETCON_connected(&lpwhr->netConnection)) + if(!req->netconn) return; - INTERNET_SendCallback(&lpwhr->hdr, lpwhr->hdr.dwContext, + if(reuse && req->netconn->keep_alive) { + BOOL run_collector; + + EnterCriticalSection(&connection_pool_cs); + + list_add_head(&req->netconn->server->conn_pool, &req->netconn->pool_entry); + req->netconn->keep_until = (DWORD64)GetTickCount() + COLLECT_TIME; + req->netconn = NULL; + + run_collector = !collector_running; + collector_running = TRUE; + + LeaveCriticalSection(&connection_pool_cs); + + if(run_collector) { + HANDLE thread = NULL; + HMODULE module; + + GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, (const WCHAR*)WININET_hModule, &module); + if(module) + thread = CreateThread(NULL, 0, collect_connections_proc, NULL, 0, NULL); + if(!thread) { + EnterCriticalSection(&connection_pool_cs); + collector_running = FALSE; + LeaveCriticalSection(&connection_pool_cs); + + if(module) + FreeLibrary(module); + } + } + return; + } + + INTERNET_SendCallback(&req->hdr, req->hdr.dwContext, INTERNET_STATUS_CLOSING_CONNECTION, 0, 0); - NETCON_close(&lpwhr->netConnection); + free_netconn(req->netconn); + req->netconn = NULL; - INTERNET_SendCallback(&lpwhr->hdr, lpwhr->hdr.dwContext, + INTERNET_SendCallback(&req->hdr, req->hdr.dwContext, INTERNET_STATUS_CONNECTION_CLOSED, 0, 0); } -static BOOL HTTP_KeepAlive(http_request_t *lpwhr) +static void drain_content(http_request_t *req) +{ + BOOL try_reuse; + + if (!req->netconn) return; + + if (req->contentLength == -1) + try_reuse = FALSE; + else if(!strcmpW(req->verb, szHEAD)) + try_reuse = TRUE; + else + try_reuse = req->data_stream->vtbl->drain_content(req->data_stream, req); + + http_release_netconn(req, try_reuse); +} + +static BOOL HTTP_KeepAlive(http_request_t *request) { WCHAR szVersion[10]; WCHAR szConnectionResponse[20]; @@ -1641,15 +1929,15 @@ static BOOL HTTP_KeepAlive(http_request_t *lpwhr) /* as per RFC 2068, S8.1.2.1, if the client is HTTP/1.1 then assume that * the connection is keep-alive by default */ - if (HTTP_HttpQueryInfoW(lpwhr, HTTP_QUERY_VERSION, szVersion, &dwBufferSize, NULL) == ERROR_SUCCESS + if (HTTP_HttpQueryInfoW(request, HTTP_QUERY_VERSION, szVersion, &dwBufferSize, NULL) == ERROR_SUCCESS && !strcmpiW(szVersion, g_szHttp1_1)) { keepalive = TRUE; } dwBufferSize = sizeof(szConnectionResponse); - if (HTTP_HttpQueryInfoW(lpwhr, HTTP_QUERY_PROXY_CONNECTION, szConnectionResponse, &dwBufferSize, NULL) == ERROR_SUCCESS - || HTTP_HttpQueryInfoW(lpwhr, HTTP_QUERY_CONNECTION, szConnectionResponse, &dwBufferSize, NULL) == ERROR_SUCCESS) + if (HTTP_HttpQueryInfoW(request, HTTP_QUERY_PROXY_CONNECTION, szConnectionResponse, &dwBufferSize, NULL) == ERROR_SUCCESS + || HTTP_HttpQueryInfoW(request, HTTP_QUERY_CONNECTION, szConnectionResponse, &dwBufferSize, NULL) == ERROR_SUCCESS) { keepalive = !strcmpiW(szConnectionResponse, szKeepAlive); } @@ -1657,6 +1945,13 @@ static BOOL HTTP_KeepAlive(http_request_t *lpwhr) return keepalive; } +static void HTTPREQ_CloseConnection(object_header_t *hdr) +{ + http_request_t *req = (http_request_t*)hdr; + + drain_content(req); +} + static DWORD HTTPREQ_QueryOption(object_header_t *hdr, DWORD option, void *buffer, DWORD *size, BOOL unicode) { http_request_t *req = (http_request_t*)hdr; @@ -1664,7 +1959,7 @@ static DWORD HTTPREQ_QueryOption(object_header_t *hdr, DWORD option, void *buffe switch(option) { case INTERNET_OPTION_DIAGNOSTIC_SOCKET_INFO: { - http_session_t *lpwhs = req->lpHttpSession; + http_session_t *session = req->session; INTERNET_DIAGNOSTIC_SOCKET_INFO *info = buffer; FIXME("INTERNET_DIAGNOSTIC_SOCKET_INFO stub\n"); @@ -1678,13 +1973,13 @@ static DWORD HTTPREQ_QueryOption(object_header_t *hdr, DWORD option, void *buffe info->Socket = 0; /* FIXME: get source port from req->netConnection */ info->SourcePort = 0; - info->DestPort = lpwhs->nHostPort; + info->DestPort = session->hostPort; info->Flags = 0; if (HTTP_KeepAlive(req)) info->Flags |= IDSI_FLAG_KEEP_ALIVE; - if (lpwhs->lpAppInfo->lpszProxy && lpwhs->lpAppInfo->lpszProxy[0] != 0) + if (session->appInfo->proxy && session->appInfo->proxy[0] != 0) info->Flags |= IDSI_FLAG_PROXY; - if (req->netConnection.useSSL) + if (req->netconn->useSSL) info->Flags |= IDSI_FLAG_SECURE; return ERROR_SUCCESS; @@ -1693,7 +1988,6 @@ static DWORD HTTPREQ_QueryOption(object_header_t *hdr, DWORD option, void *buffe case INTERNET_OPTION_SECURITY_FLAGS: { DWORD flags; - int bits; if (*size < sizeof(ULONG)) return ERROR_INSUFFICIENT_BUFFER; @@ -1702,14 +1996,16 @@ static DWORD HTTPREQ_QueryOption(object_header_t *hdr, DWORD option, void *buffe flags = 0; if (req->hdr.dwFlags & INTERNET_FLAG_SECURE) flags |= SECURITY_FLAG_SECURE; - flags |= req->netConnection.security_flags; - bits = NETCON_GetCipherStrength(&req->netConnection); - if (bits >= 128) - flags |= SECURITY_FLAG_STRENGTH_STRONG; - else if (bits >= 56) - flags |= SECURITY_FLAG_STRENGTH_MEDIUM; - else - flags |= SECURITY_FLAG_STRENGTH_WEAK; + flags |= req->security_flags; + if(req->netconn) { + int bits = NETCON_GetCipherStrength(req->netconn); + if (bits >= 128) + flags |= SECURITY_FLAG_STRENGTH_STRONG; + else if (bits >= 56) + flags |= SECURITY_FLAG_STRENGTH_MEDIUM; + else + flags |= SECURITY_FLAG_STRENGTH_WEAK; + } *(DWORD *)buffer = flags; return ERROR_SUCCESS; } @@ -1739,7 +2035,7 @@ static DWORD HTTPREQ_QueryOption(object_header_t *hdr, DWORD option, void *buffe strcatW(url, host->lpszValue); if (NULL != (pch = strchrW(url + strlenW(httpW), ':'))) *pch = 0; - strcatW(url, req->lpszPath); + strcatW(url, req->path); TRACE("INTERNET_OPTION_URL: %s\n",debugstr_w(url)); @@ -1781,7 +2077,7 @@ static DWORD HTTPREQ_QueryOption(object_header_t *hdr, DWORD option, void *buffe error = GetLastError(); if (!ret && error == ERROR_INSUFFICIENT_BUFFER) { - if (!(info = HeapAlloc(GetProcessHeap(), 0, nbytes))) + if (!(info = heap_alloc(nbytes))) return ERROR_OUTOFMEMORY; GetUrlCacheEntryInfoW(url, info, &nbytes); @@ -1801,25 +2097,25 @@ static DWORD HTTPREQ_QueryOption(object_header_t *hdr, DWORD option, void *buffe TRACE("INTERNET_OPTION_DATAFILE_NAME\n"); - if(!req->lpszCacheFile) { + if(!req->cacheFile) { *size = 0; return ERROR_INTERNET_ITEM_NOT_FOUND; } if(unicode) { - req_size = (lstrlenW(req->lpszCacheFile)+1) * sizeof(WCHAR); + req_size = (lstrlenW(req->cacheFile)+1) * sizeof(WCHAR); if(*size < req_size) return ERROR_INSUFFICIENT_BUFFER; *size = req_size; - memcpy(buffer, req->lpszCacheFile, *size); + memcpy(buffer, req->cacheFile, *size); return ERROR_SUCCESS; }else { - req_size = WideCharToMultiByte(CP_ACP, 0, req->lpszCacheFile, -1, NULL, 0, NULL, NULL); + req_size = WideCharToMultiByte(CP_ACP, 0, req->cacheFile, -1, NULL, 0, NULL, NULL); if (req_size > *size) return ERROR_INSUFFICIENT_BUFFER; - *size = WideCharToMultiByte(CP_ACP, 0, req->lpszCacheFile, + *size = WideCharToMultiByte(CP_ACP, 0, req->cacheFile, -1, buffer, *size, NULL, NULL); return ERROR_SUCCESS; } @@ -1833,7 +2129,7 @@ static DWORD HTTPREQ_QueryOption(object_header_t *hdr, DWORD option, void *buffe return ERROR_INSUFFICIENT_BUFFER; } - context = (PCCERT_CONTEXT)NETCON_GetCert(&(req->netConnection)); + context = (PCCERT_CONTEXT)NETCON_GetCert(req->netconn); if(context) { INTERNET_CERTIFICATE_INFOA *info = (INTERNET_CERTIFICATE_INFOA*)buffer; DWORD len; @@ -1855,7 +2151,7 @@ static DWORD HTTPREQ_QueryOption(object_header_t *hdr, DWORD option, void *buffe CertNameToStrA(context->dwCertEncodingType, &context->pCertInfo->Issuer, CERT_SIMPLE_NAME_STR, info->lpszIssuerInfo, len); - info->dwKeySize = NETCON_GetCipherStrength(&req->netConnection); + info->dwKeySize = NETCON_GetCipherStrength(req->netconn); CertFreeCertificateContext(context); return ERROR_SUCCESS; } @@ -1878,7 +2174,9 @@ static DWORD HTTPREQ_SetOption(object_header_t *hdr, DWORD option, void *buffer, return ERROR_INVALID_PARAMETER; flags = *(DWORD *)buffer; TRACE("%08x\n", flags); - req->netConnection.security_flags = flags; + req->security_flags = flags; + if(req->netconn) + req->netconn->security_flags = flags; return ERROR_SUCCESS; } case INTERNET_OPTION_SEND_TIMEOUT: @@ -1888,17 +2186,22 @@ static DWORD HTTPREQ_SetOption(object_header_t *hdr, DWORD option, void *buffer, if (size != sizeof(DWORD)) return ERROR_INVALID_PARAMETER; - return NETCON_set_timeout(&req->netConnection, option == INTERNET_OPTION_SEND_TIMEOUT, + if(!req->netconn) { + FIXME("unsupported without active connection\n"); + return ERROR_SUCCESS; + } + + return NETCON_set_timeout(req->netconn, option == INTERNET_OPTION_SEND_TIMEOUT, *(DWORD*)buffer); case INTERNET_OPTION_USERNAME: - HeapFree(GetProcessHeap(), 0, req->lpHttpSession->lpszUserName); - if (!(req->lpHttpSession->lpszUserName = heap_strdupW(buffer))) return ERROR_OUTOFMEMORY; + HeapFree(GetProcessHeap(), 0, req->session->userName); + if (!(req->session->userName = heap_strdupW(buffer))) return ERROR_OUTOFMEMORY; return ERROR_SUCCESS; case INTERNET_OPTION_PASSWORD: - HeapFree(GetProcessHeap(), 0, req->lpHttpSession->lpszPassword); - if (!(req->lpHttpSession->lpszPassword = heap_strdupW(buffer))) return ERROR_OUTOFMEMORY; + HeapFree(GetProcessHeap(), 0, req->session->password); + if (!(req->session->password = heap_strdupW(buffer))) return ERROR_OUTOFMEMORY; return ERROR_SUCCESS; case INTERNET_OPTION_HTTP_DECODING: if(size != sizeof(BOOL)) @@ -1926,7 +2229,7 @@ static DWORD read_more_data( http_request_t *req, int maxlen ) if (maxlen == -1) maxlen = sizeof(req->read_buf); - res = NETCON_recv( &req->netConnection, req->read_buf + req->read_size, + res = NETCON_recv( req->netconn, req->read_buf + req->read_size, maxlen - req->read_size, 0, &len ); if(res == ERROR_SUCCESS) req->read_size += len; @@ -1967,7 +2270,7 @@ static BOOL read_line( http_request_t *req, LPSTR buffer, DWORD *len ) if ((res = read_more_data( req, -1 )) != ERROR_SUCCESS || !req->read_size) { *len = 0; - TRACE( "returning empty string\n" ); + TRACE( "returning empty string %u\n", res); LeaveCriticalSection( &req->read_section ); INTERNET_SetLastError(res); return FALSE; @@ -1985,187 +2288,382 @@ static BOOL read_line( http_request_t *req, LPSTR buffer, DWORD *len ) return TRUE; } +/* check if we have reached the end of the data to read (the read section must be held) */ +static BOOL end_of_read_data( http_request_t *req ) +{ + return !req->read_size && req->data_stream->vtbl->end_of_data(req->data_stream, req); +} + +/* fetch some more data into the read buffer (the read section must be held) */ +static DWORD refill_read_buffer(http_request_t *req, read_mode_t read_mode, DWORD *read_bytes) +{ + DWORD res, read=0; + + if(req->read_size == sizeof(req->read_buf)) + return ERROR_SUCCESS; + + if(req->read_pos) { + if(req->read_size) + memmove(req->read_buf, req->read_buf+req->read_pos, req->read_size); + req->read_pos = 0; + } + + res = req->data_stream->vtbl->read(req->data_stream, req, req->read_buf+req->read_size, + sizeof(req->read_buf)-req->read_size, &read, read_mode); + req->read_size += read; + + TRACE("read %u bytes, read_size %u\n", read, req->read_size); + if(read_bytes) + *read_bytes = read; + return res; +} + +/* return the size of data available to be read immediately (the read section must be held) */ +static DWORD get_avail_data( http_request_t *req ) +{ + return req->read_size + req->data_stream->vtbl->get_avail_data(req->data_stream, req); +} + +static DWORD netconn_get_avail_data(data_stream_t *stream, http_request_t *req) +{ + netconn_stream_t *netconn_stream = (netconn_stream_t*)stream; + DWORD avail = 0; + + if(req->netconn) + NETCON_query_data_available(req->netconn, &avail); + return netconn_stream->content_length == ~0u + ? avail + : min(avail, netconn_stream->content_length-netconn_stream->content_read); +} + +static BOOL netconn_end_of_data(data_stream_t *stream, http_request_t *req) +{ + netconn_stream_t *netconn_stream = (netconn_stream_t*)stream; + return netconn_stream->content_read == netconn_stream->content_length || !req->netconn; +} + +static DWORD netconn_read(data_stream_t *stream, http_request_t *req, BYTE *buf, DWORD size, + DWORD *read, read_mode_t read_mode) +{ + netconn_stream_t *netconn_stream = (netconn_stream_t*)stream; + int len = 0; + + size = min(size, netconn_stream->content_length-netconn_stream->content_read); + + if(read_mode == READMODE_NOBLOCK) + size = min(size, netconn_get_avail_data(stream, req)); + + if(size && req->netconn) { + if(NETCON_recv(req->netconn, buf, size, read_mode == READMODE_SYNC ? MSG_WAITALL : 0, &len) != ERROR_SUCCESS) + len = 0; + } + + netconn_stream->content_read += *read = len; + TRACE("read %u bytes\n", len); + return ERROR_SUCCESS; +} + +static BOOL netconn_drain_content(data_stream_t *stream, http_request_t *req) +{ + netconn_stream_t *netconn_stream = (netconn_stream_t*)stream; + BYTE buf[1024]; + DWORD avail; + int len; + + if(netconn_end_of_data(stream, req)) + return TRUE; + + do { + avail = netconn_get_avail_data(stream, req); + if(!avail) + return FALSE; + + if(NETCON_recv(req->netconn, buf, min(avail, sizeof(buf)), 0, &len) != ERROR_SUCCESS) + return FALSE; + + netconn_stream->content_read += len; + }while(netconn_stream->content_read < netconn_stream->content_length); + + return TRUE; +} + +static void netconn_destroy(data_stream_t *stream) +{ +} + +static const data_stream_vtbl_t netconn_stream_vtbl = { + netconn_get_avail_data, + netconn_end_of_data, + netconn_read, + netconn_drain_content, + netconn_destroy +}; + +/* read some more data into the read buffer (the read section must be held) */ +static DWORD read_more_chunked_data(chunked_stream_t *stream, http_request_t *req, int maxlen) +{ + DWORD res; + int len; + + if (stream->buf_pos) + { + /* move existing data to the start of the buffer */ + if(stream->buf_size) + memmove(stream->buf, stream->buf + stream->buf_pos, stream->buf_size); + stream->buf_pos = 0; + } + + if (maxlen == -1) maxlen = sizeof(stream->buf); + + res = NETCON_recv( req->netconn, stream->buf + stream->buf_size, + maxlen - stream->buf_size, 0, &len ); + if(res == ERROR_SUCCESS) + stream->buf_size += len; + + return res; +} + +/* remove some amount of data from the read buffer (the read section must be held) */ +static void remove_chunked_data(chunked_stream_t *stream, int count) +{ + if (!(stream->buf_size -= count)) stream->buf_pos = 0; + else stream->buf_pos += count; +} + /* discard data contents until we reach end of line (the read section must be held) */ -static DWORD discard_eol( http_request_t *req ) +static DWORD discard_chunked_eol(chunked_stream_t *stream, http_request_t *req) { DWORD res; do { - BYTE *eol = memchr( req->read_buf + req->read_pos, '\n', req->read_size ); + BYTE *eol = memchr(stream->buf + stream->buf_pos, '\n', stream->buf_size); if (eol) { - remove_data( req, (eol + 1) - (req->read_buf + req->read_pos) ); + remove_chunked_data(stream, (eol + 1) - (stream->buf + stream->buf_pos)); break; } - req->read_pos = req->read_size = 0; /* discard everything */ - if ((res = read_more_data( req, -1 )) != ERROR_SUCCESS) return res; - } while (req->read_size); + stream->buf_pos = stream->buf_size = 0; /* discard everything */ + if ((res = read_more_chunked_data(stream, req, -1)) != ERROR_SUCCESS) return res; + } while (stream->buf_size); return ERROR_SUCCESS; } /* read the size of the next chunk (the read section must be held) */ -static DWORD start_next_chunk( http_request_t *req ) +static DWORD start_next_chunk(chunked_stream_t *stream, http_request_t *req) { + /* TODOO */ DWORD chunk_size = 0, res; - if (!req->dwContentLength) return ERROR_SUCCESS; - if (req->dwContentLength == req->dwContentRead) - { - /* read terminator for the previous chunk */ - if ((res = discard_eol( req )) != ERROR_SUCCESS) return res; - req->dwContentLength = ~0u; - req->dwContentRead = 0; - } + if(stream->chunk_size != ~0u && (res = discard_chunked_eol(stream, req)) != ERROR_SUCCESS) + return res; + for (;;) { - while (req->read_size) + while (stream->buf_size) { - char ch = req->read_buf[req->read_pos]; + char ch = stream->buf[stream->buf_pos]; if (ch >= '0' && ch <= '9') chunk_size = chunk_size * 16 + ch - '0'; else if (ch >= 'a' && ch <= 'f') chunk_size = chunk_size * 16 + ch - 'a' + 10; else if (ch >= 'A' && ch <= 'F') chunk_size = chunk_size * 16 + ch - 'A' + 10; else if (ch == ';' || ch == '\r' || ch == '\n') { TRACE( "reading %u byte chunk\n", chunk_size ); - req->dwContentLength = chunk_size; - req->dwContentRead = 0; - return discard_eol( req ); + stream->chunk_size = chunk_size; + req->contentLength += chunk_size; + return discard_chunked_eol(stream, req); } - remove_data( req, 1 ); + remove_chunked_data(stream, 1); } - if ((res = read_more_data( req, -1 )) != ERROR_SUCCESS) return res; - if (!req->read_size) + if ((res = read_more_chunked_data(stream, req, -1)) != ERROR_SUCCESS) return res; + if (!stream->buf_size) { - req->dwContentLength = req->dwContentRead = 0; + stream->chunk_size = 0; return ERROR_SUCCESS; } } } -/* check if we have reached the end of the data to read (the read section must be held) */ -static BOOL end_of_read_data( http_request_t *req ) +static DWORD chunked_get_avail_data(data_stream_t *stream, http_request_t *req) { - if (req->gzip_stream) return req->gzip_stream->end_of_data && !req->gzip_stream->buf_size; - if (req->read_chunked) return (req->dwContentLength == 0); - if (req->dwContentLength == ~0u) return FALSE; - return (req->dwContentLength == req->dwContentRead); + /* Allow reading only from read buffer */ + return 0; } -/* fetch some more data into the read buffer (the read section must be held) */ -static DWORD refill_buffer( http_request_t *req ) +static BOOL chunked_end_of_data(data_stream_t *stream, http_request_t *req) { - int len = sizeof(req->read_buf); - DWORD res; + chunked_stream_t *chunked_stream = (chunked_stream_t*)stream; + return !chunked_stream->chunk_size; +} - if (req->read_chunked && (req->dwContentLength == ~0u || req->dwContentLength == req->dwContentRead)) - { - if ((res = start_next_chunk( req )) != ERROR_SUCCESS) return res; +static DWORD chunked_read(data_stream_t *stream, http_request_t *req, BYTE *buf, DWORD size, + DWORD *read, read_mode_t read_mode) +{ + chunked_stream_t *chunked_stream = (chunked_stream_t*)stream; + DWORD read_bytes = 0, ret_read = 0, res = ERROR_SUCCESS; + + if(chunked_stream->chunk_size == ~0u) { + res = start_next_chunk(chunked_stream, req); + if(res != ERROR_SUCCESS) + return res; } - if (req->dwContentLength != ~0u) len = min( len, req->dwContentLength - req->dwContentRead ); - if (len <= req->read_size) return ERROR_SUCCESS; + while(size && chunked_stream->chunk_size) { + if(chunked_stream->buf_size) { + read_bytes = min(size, min(chunked_stream->buf_size, chunked_stream->chunk_size)); - if ((res = read_more_data( req, len )) != ERROR_SUCCESS) return res; - if (!req->read_size) req->dwContentLength = req->dwContentRead = 0; - return ERROR_SUCCESS; -} + /* this could block */ + if(read_mode == READMODE_NOBLOCK && read_bytes == chunked_stream->chunk_size) + break; -static DWORD read_gzip_data(http_request_t *req, BYTE *buf, int size, BOOL sync, int *read_ret) -{ - DWORD ret = ERROR_SUCCESS; - int read = 0; + memcpy(buf+ret_read, chunked_stream->buf+chunked_stream->buf_pos, read_bytes); + remove_chunked_data(chunked_stream, read_bytes); + }else { + read_bytes = min(size, chunked_stream->chunk_size); -#ifdef HAVE_ZLIB - z_stream *zstream = &req->gzip_stream->zstream; - DWORD buf_avail; - int zres; + if(read_mode == READMODE_NOBLOCK) { + DWORD avail; - while(read < size && !req->gzip_stream->end_of_data) { - if(!req->read_size) { - if(!sync || refill_buffer(req) != ERROR_SUCCESS) + if(!NETCON_query_data_available(req->netconn, &avail) || !avail) + break; + if(read_bytes > avail) + read_bytes = avail; + + /* this could block */ + if(read_bytes == chunked_stream->chunk_size) + break; + } + + res = NETCON_recv(req->netconn, (char *)buf+ret_read, read_bytes, 0, (int*)&read_bytes); + if(res != ERROR_SUCCESS) break; } - if(req->dwContentRead == req->dwContentLength) - break; - - buf_avail = req->dwContentLength == ~0 ? req->read_size : min(req->read_size, req->dwContentLength-req->dwContentRead); - - zstream->next_in = req->read_buf+req->read_pos; - zstream->avail_in = buf_avail; - zstream->next_out = buf+read; - zstream->avail_out = size-read; - zres = inflate(zstream, Z_FULL_FLUSH); - read = size - zstream->avail_out; - req->dwContentRead += buf_avail-zstream->avail_in; - remove_data(req, buf_avail-zstream->avail_in); - if(zres == Z_STREAM_END) { - TRACE("end of data\n"); - req->gzip_stream->end_of_data = TRUE; - inflateEnd(&req->gzip_stream->zstream); - }else if(zres != Z_OK) { - WARN("inflate failed %d\n", zres); - if(!read) - ret = ERROR_INTERNET_DECODING_FAILED; - break; + chunked_stream->chunk_size -= read_bytes; + size -= read_bytes; + ret_read += read_bytes; + if(!chunked_stream->chunk_size) { + assert(read_mode != READMODE_NOBLOCK); + res = start_next_chunk(chunked_stream, req); + if(res != ERROR_SUCCESS) + break; } - } -#endif - *read_ret = read; - return ret; + if(read_mode == READMODE_ASYNC) + read_mode = READMODE_NOBLOCK; + } + + TRACE("read %u bytes\n", ret_read); + *read = ret_read; + return res; } -static void refill_gzip_buffer(http_request_t *req) +static BOOL chunked_drain_content(data_stream_t *stream, http_request_t *req) { - DWORD res; - int len; + chunked_stream_t *chunked_stream = (chunked_stream_t*)stream; - if(!req->gzip_stream || !req->read_size || req->gzip_stream->buf_size == sizeof(req->gzip_stream->buf)) - return; - - if(req->gzip_stream->buf_pos) { - if(req->gzip_stream->buf_size) - memmove(req->gzip_stream->buf, req->gzip_stream->buf + req->gzip_stream->buf_pos, req->gzip_stream->buf_size); - req->gzip_stream->buf_pos = 0; - } - - res = read_gzip_data(req, req->gzip_stream->buf + req->gzip_stream->buf_size, - sizeof(req->gzip_stream->buf) - req->gzip_stream->buf_size, FALSE, &len); - if(res == ERROR_SUCCESS) - req->gzip_stream->buf_size += len; + /* FIXME: we can do better */ + return !chunked_stream->chunk_size; } -/* return the size of data available to be read immediately (the read section must be held) */ -static DWORD get_avail_data( http_request_t *req ) +static void chunked_destroy(data_stream_t *stream) { - if (req->gzip_stream) { - refill_gzip_buffer(req); - return req->gzip_stream->buf_size; + chunked_stream_t *chunked_stream = (chunked_stream_t*)stream; + heap_free(chunked_stream); +} + +static const data_stream_vtbl_t chunked_stream_vtbl = { + chunked_get_avail_data, + chunked_end_of_data, + chunked_read, + chunked_drain_content, + chunked_destroy +}; + +/* set the request content length based on the headers */ +static DWORD set_content_length(http_request_t *request, DWORD status_code) +{ + static const WCHAR szChunked[] = {'c','h','u','n','k','e','d',0}; + WCHAR encoding[20]; + DWORD size; + + if(status_code == HTTP_STATUS_NO_CONTENT) { + request->contentLength = request->netconn_stream.content_length = 0; + return ERROR_SUCCESS; } - if (req->read_chunked && (req->dwContentLength == ~0u || req->dwContentLength == req->dwContentRead)) - return 0; - return min( req->read_size, req->dwContentLength - req->dwContentRead ); + + size = sizeof(request->contentLength); + if (HTTP_HttpQueryInfoW(request, HTTP_QUERY_FLAG_NUMBER|HTTP_QUERY_CONTENT_LENGTH, + &request->contentLength, &size, NULL) != ERROR_SUCCESS) + request->contentLength = ~0u; + request->netconn_stream.content_length = request->contentLength; + request->netconn_stream.content_read = request->read_size; + + size = sizeof(encoding); + if (HTTP_HttpQueryInfoW(request, HTTP_QUERY_TRANSFER_ENCODING, encoding, &size, NULL) == ERROR_SUCCESS && + !strcmpiW(encoding, szChunked)) + { + chunked_stream_t *chunked_stream; + + chunked_stream = heap_alloc(sizeof(*chunked_stream)); + if(!chunked_stream) + return ERROR_OUTOFMEMORY; + + chunked_stream->data_stream.vtbl = &chunked_stream_vtbl; + chunked_stream->buf_size = chunked_stream->buf_pos = 0; + chunked_stream->chunk_size = ~0u; + + if(request->read_size) { + memcpy(chunked_stream->buf, request->read_buf+request->read_pos, request->read_size); + chunked_stream->buf_size = request->read_size; + request->read_size = request->read_pos = 0; + } + + request->data_stream = &chunked_stream->data_stream; + request->contentLength = ~0u; + request->read_chunked = TRUE; + } + + if(request->decoding) { + int encoding_idx; + + static const WCHAR gzipW[] = {'g','z','i','p',0}; + + encoding_idx = HTTP_GetCustomHeaderIndex(request, szContent_Encoding, 0, FALSE); + if(encoding_idx != -1 && !strcmpiW(request->custHeaders[encoding_idx].lpszValue, gzipW)) + return init_gzip_stream(request); + } + + return ERROR_SUCCESS; } static void HTTP_ReceiveRequestData(http_request_t *req, BOOL first_notif) { INTERNET_ASYNC_RESULT iar; - DWORD res; + DWORD res, read = 0; + read_mode_t mode; TRACE("%p\n", req); EnterCriticalSection( &req->read_section ); - if ((res = refill_buffer( req )) == ERROR_SUCCESS) { + + mode = first_notif && req->read_size ? READMODE_NOBLOCK : READMODE_ASYNC; + res = refill_read_buffer(req, mode, &read); + if(res == ERROR_SUCCESS) { iar.dwResult = (DWORD_PTR)req->hdr.hInternet; iar.dwError = first_notif ? 0 : get_avail_data(req); }else { iar.dwResult = 0; iar.dwError = res; } + LeaveCriticalSection( &req->read_section ); + if(res != ERROR_SUCCESS || (mode != READMODE_NOBLOCK && !read)) { + WARN("res %u read %u, closing connection\n", res, read); + http_release_netconn(req, FALSE); + } + INTERNET_SendCallback(&req->hdr, req->hdr.dwContext, INTERNET_STATUS_REQUEST_COMPLETE, &iar, sizeof(INTERNET_ASYNC_RESULT)); } @@ -2173,72 +2671,46 @@ static void HTTP_ReceiveRequestData(http_request_t *req, BOOL first_notif) /* read data from the http connection (the read section must be held) */ static DWORD HTTPREQ_Read(http_request_t *req, void *buffer, DWORD size, DWORD *read, BOOL sync) { - BOOL finished_reading = FALSE; - int len, bytes_read = 0; - DWORD ret = ERROR_SUCCESS; + DWORD current_read = 0, ret_read = 0; + read_mode_t read_mode; + DWORD res = ERROR_SUCCESS; + + read_mode = req->session->appInfo->hdr.dwFlags & INTERNET_FLAG_ASYNC ? READMODE_ASYNC : READMODE_SYNC; EnterCriticalSection( &req->read_section ); - if (req->read_chunked && (req->dwContentLength == ~0u || req->dwContentLength == req->dwContentRead)) - { - if (start_next_chunk( req ) != ERROR_SUCCESS) goto done; + if(req->read_size) { + ret_read = min(size, req->read_size); + memcpy(buffer, req->read_buf+req->read_pos, ret_read); + req->read_size -= ret_read; + req->read_pos += ret_read; + if(read_mode == READMODE_ASYNC) + read_mode = READMODE_NOBLOCK; } - if(req->gzip_stream) { - if(req->gzip_stream->buf_size) { - bytes_read = min(req->gzip_stream->buf_size, size); - memcpy(buffer, req->gzip_stream->buf + req->gzip_stream->buf_pos, bytes_read); - req->gzip_stream->buf_pos += bytes_read; - req->gzip_stream->buf_size -= bytes_read; - }else if(!req->read_size && !req->gzip_stream->end_of_data) { - refill_buffer(req); - } - - if(size > bytes_read) { - ret = read_gzip_data(req, (BYTE*)buffer+bytes_read, size-bytes_read, sync, &len); - if(ret == ERROR_SUCCESS) - bytes_read += len; - } - - finished_reading = req->gzip_stream->end_of_data && !req->gzip_stream->buf_size; - }else { - if (req->dwContentLength != ~0u) size = min( size, req->dwContentLength - req->dwContentRead ); - - if (req->read_size) { - bytes_read = min( req->read_size, size ); - memcpy( buffer, req->read_buf + req->read_pos, bytes_read ); - remove_data( req, bytes_read ); - } - - if (size > bytes_read && (!bytes_read || sync)) { - if (NETCON_recv( &req->netConnection, (char *)buffer + bytes_read, size - bytes_read, - sync ? MSG_WAITALL : 0, &len) == ERROR_SUCCESS) - bytes_read += len; - /* always return success, even if the network layer returns an error */ - } - - finished_reading = !bytes_read && req->dwContentRead == req->dwContentLength; - req->dwContentRead += bytes_read; + if(ret_read < size) { + res = req->data_stream->vtbl->read(req->data_stream, req, (BYTE*)buffer+ret_read, size-ret_read, ¤t_read, read_mode); + ret_read += current_read; } -done: - *read = bytes_read; - TRACE( "retrieved %u bytes (%u/%u)\n", bytes_read, req->dwContentRead, req->dwContentLength ); LeaveCriticalSection( &req->read_section ); - if(ret == ERROR_SUCCESS && req->lpszCacheFile) { - BOOL res; - DWORD dwBytesWritten; + *read = ret_read; + TRACE( "retrieved %u bytes (%u)\n", ret_read, req->contentLength ); - res = WriteFile(req->hCacheFile, buffer, bytes_read, &dwBytesWritten, NULL); + if(req->hCacheFile && res == ERROR_SUCCESS && ret_read) { + BOOL res; + DWORD written; + + res = WriteFile(req->hCacheFile, buffer, ret_read, &written, NULL); if(!res) WARN("WriteFile failed: %u\n", GetLastError()); } - if(finished_reading) - HTTP_FinishedReading(req); + if(size && !ret_read) + http_release_netconn(req, res == ERROR_SUCCESS); - return ret; + return res; } @@ -2331,14 +2803,13 @@ static DWORD HTTPREQ_ReadFileExA(object_header_t *hdr, INTERNET_BUFFERSA *buffer while(1) { res = HTTPREQ_Read(req, (char*)buffers->lpvBuffer+read, size-read, &buffers->dwBufferLength, !(flags & IRF_NO_WAIT)); - if(res == ERROR_SUCCESS) - read += buffers->dwBufferLength; - else + if(res != ERROR_SUCCESS) break; - if(!req->read_chunked || read==size || req->dwContentLength!=req->dwContentRead - || !req->dwContentLength || (req->gzip_stream && req->gzip_stream->end_of_data)) + read += buffers->dwBufferLength; + if(read == size || end_of_read_data(req)) break; + LeaveCriticalSection( &req->read_section ); INTERNET_SendCallback(&req->hdr, req->hdr.dwContext, INTERNET_STATUS_RESPONSE_RECEIVED, @@ -2440,14 +2911,13 @@ static DWORD HTTPREQ_ReadFileExW(object_header_t *hdr, INTERNET_BUFFERSW *buffer while(1) { res = HTTPREQ_Read(req, (char*)buffers->lpvBuffer+read, size-read, &buffers->dwBufferLength, !(flags & IRF_NO_WAIT)); - if(res == ERROR_SUCCESS) - read += buffers->dwBufferLength; - else + if(res != ERROR_SUCCESS) break; - if(!req->read_chunked || read==size || req->dwContentLength!=req->dwContentRead - || !req->dwContentLength || (req->gzip_stream && req->gzip_stream->end_of_data)) + read += buffers->dwBufferLength; + if(read == size || end_of_read_data(req)) break; + LeaveCriticalSection( &req->read_section ); INTERNET_SendCallback(&req->hdr, req->hdr.dwContext, INTERNET_STATUS_RESPONSE_RECEIVED, @@ -2479,16 +2949,16 @@ done: static DWORD HTTPREQ_WriteFile(object_header_t *hdr, const void *buffer, DWORD size, DWORD *written) { DWORD res; - http_request_t *lpwhr = (http_request_t*)hdr; + http_request_t *request = (http_request_t*)hdr; - INTERNET_SendCallback(&lpwhr->hdr, lpwhr->hdr.dwContext, INTERNET_STATUS_SENDING_REQUEST, NULL, 0); + INTERNET_SendCallback(&request->hdr, request->hdr.dwContext, INTERNET_STATUS_SENDING_REQUEST, NULL, 0); *written = 0; - res = NETCON_send(&lpwhr->netConnection, buffer, size, 0, (LPINT)written); + res = NETCON_send(request->netconn, buffer, size, 0, (LPINT)written); if (res == ERROR_SUCCESS) - lpwhr->dwBytesWritten += *written; + request->bytesWritten += *written; - INTERNET_SendCallback(&lpwhr->hdr, lpwhr->hdr.dwContext, INTERNET_STATUS_REQUEST_SENT, written, sizeof(DWORD)); + INTERNET_SendCallback(&request->hdr, request->hdr.dwContext, INTERNET_STATUS_REQUEST_SENT, written, sizeof(DWORD)); return res; } @@ -2505,13 +2975,14 @@ static DWORD HTTPREQ_QueryDataAvailable(object_header_t *hdr, DWORD *available, TRACE("(%p %p %x %lx)\n", req, available, flags, ctx); - if (req->lpHttpSession->lpAppInfo->hdr.dwFlags & INTERNET_FLAG_ASYNC) + if (req->session->appInfo->hdr.dwFlags & INTERNET_FLAG_ASYNC) { WORKREQUEST workRequest; /* never wait, if we can't enter the section we queue an async request right away */ if (TryEnterCriticalSection( &req->read_section )) { + refill_read_buffer(req, READMODE_NOBLOCK, NULL); if ((*available = get_avail_data( req ))) goto done; if (end_of_read_data( req )) goto done; LeaveCriticalSection( &req->read_section ); @@ -2529,17 +3000,11 @@ static DWORD HTTPREQ_QueryDataAvailable(object_header_t *hdr, DWORD *available, if (!(*available = get_avail_data( req )) && !end_of_read_data( req )) { - refill_buffer( req ); + refill_read_buffer( req, READMODE_ASYNC, NULL ); *available = get_avail_data( req ); } done: - if (*available == sizeof(req->read_buf) && !req->gzip_stream) /* check if we have even more pending in the socket */ - { - DWORD extra; - if (NETCON_query_data_available(&req->netConnection, &extra)) - *available = min( *available + extra, req->dwContentLength - req->dwContentRead ); - } LeaveCriticalSection( &req->read_section ); TRACE( "returning %u\n", *available ); @@ -2569,64 +3034,39 @@ static const object_vtbl_t HTTPREQVtbl = { * NULL on failure * */ -static DWORD HTTP_HttpOpenRequestW(http_session_t *lpwhs, +static DWORD HTTP_HttpOpenRequestW(http_session_t *session, LPCWSTR lpszVerb, LPCWSTR lpszObjectName, LPCWSTR lpszVersion, LPCWSTR lpszReferrer , LPCWSTR *lpszAcceptTypes, DWORD dwFlags, DWORD_PTR dwContext, HINTERNET *ret) { - appinfo_t *hIC = NULL; - http_request_t *lpwhr; - LPWSTR lpszHostName = NULL; - HINTERNET handle = NULL; - static const WCHAR szHostForm[] = {'%','s',':','%','u',0}; - DWORD len, res; + appinfo_t *hIC = session->appInfo; + http_request_t *request; + DWORD len, res = ERROR_SUCCESS; TRACE("-->\n"); - assert( lpwhs->hdr.htype == WH_HHTTPSESSION ); - hIC = lpwhs->lpAppInfo; + request = alloc_object(&session->hdr, &HTTPREQVtbl, sizeof(http_request_t)); + if(!request) + return ERROR_OUTOFMEMORY; - lpwhr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(http_request_t)); - if (NULL == lpwhr) - { - res = ERROR_OUTOFMEMORY; - goto lend; - } - lpwhr->hdr.htype = WH_HHTTPREQ; - lpwhr->hdr.vtbl = &HTTPREQVtbl; - lpwhr->hdr.dwFlags = dwFlags; - lpwhr->hdr.dwContext = dwContext; - lpwhr->hdr.refs = 1; - lpwhr->hdr.lpfnStatusCB = lpwhs->hdr.lpfnStatusCB; - lpwhr->hdr.dwInternalFlags = lpwhs->hdr.dwInternalFlags & INET_CALLBACKW; - lpwhr->dwContentLength = ~0u; - InitializeCriticalSection( &lpwhr->read_section ); + request->hdr.htype = WH_HHTTPREQ; + request->hdr.dwFlags = dwFlags; + request->hdr.dwContext = dwContext; + request->contentLength = ~0u; - WININET_AddRef( &lpwhs->hdr ); - lpwhr->lpHttpSession = lpwhs; - list_add_head( &lpwhs->hdr.children, &lpwhr->hdr.entry ); + request->netconn_stream.data_stream.vtbl = &netconn_stream_vtbl; + request->data_stream = &request->netconn_stream.data_stream; - lpszHostName = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR) * - (strlenW(lpwhs->lpszHostName) + 7 /* length of ":65535" + 1 */)); - if (NULL == lpszHostName) - { - res = ERROR_OUTOFMEMORY; - goto lend; - } + InitializeCriticalSection( &request->read_section ); - handle = WININET_AllocHandle( &lpwhr->hdr ); - if (NULL == handle) - { - res = ERROR_OUTOFMEMORY; - goto lend; - } + WININET_AddRef( &session->hdr ); + request->session = session; + list_add_head( &session->hdr.children, &request->hdr.entry ); - if ((res = NETCON_init(&lpwhr->netConnection, dwFlags & INTERNET_FLAG_SECURE)) != ERROR_SUCCESS) - { - InternetCloseHandle( handle ); - handle = NULL; - goto lend; - } + if (dwFlags & INTERNET_FLAG_IGNORE_CERT_CN_INVALID) + request->security_flags |= SECURITY_FLAG_IGNORE_CERT_CN_INVALID; + if (dwFlags & INTERNET_FLAG_IGNORE_CERT_DATE_INVALID) + request->security_flags |= SECURITY_FLAG_IGNORE_CERT_DATE_INVALID; if (lpszObjectName && *lpszObjectName) { HRESULT rc; @@ -2635,22 +3075,22 @@ static DWORD HTTP_HttpOpenRequestW(http_session_t *lpwhs, rc = UrlEscapeW(lpszObjectName, NULL, &len, URL_ESCAPE_SPACES_ONLY); if (rc != E_POINTER) len = strlenW(lpszObjectName)+1; - lpwhr->lpszPath = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR)); - rc = UrlEscapeW(lpszObjectName, lpwhr->lpszPath, &len, + request->path = heap_alloc(len*sizeof(WCHAR)); + rc = UrlEscapeW(lpszObjectName, request->path, &len, URL_ESCAPE_SPACES_ONLY); if (rc != S_OK) { ERR("Unable to escape string!(%s) (%d)\n",debugstr_w(lpszObjectName),rc); - strcpyW(lpwhr->lpszPath,lpszObjectName); + strcpyW(request->path,lpszObjectName); } }else { static const WCHAR slashW[] = {'/',0}; - lpwhr->lpszPath = heap_strdupW(slashW); + request->path = heap_strdupW(slashW); } if (lpszReferrer && *lpszReferrer) - HTTP_ProcessHeader(lpwhr, HTTP_REFERER, lpszReferrer, HTTP_ADDREQ_FLAG_ADD | HTTP_ADDHDR_FLAG_REQ); + HTTP_ProcessHeader(request, HTTP_REFERER, lpszReferrer, HTTP_ADDREQ_FLAG_ADD | HTTP_ADDHDR_FLAG_REQ); if (lpszAcceptTypes) { @@ -2658,53 +3098,66 @@ static DWORD HTTP_HttpOpenRequestW(http_session_t *lpwhs, for (i = 0; lpszAcceptTypes[i]; i++) { if (!*lpszAcceptTypes[i]) continue; - HTTP_ProcessHeader(lpwhr, HTTP_ACCEPT, lpszAcceptTypes[i], + HTTP_ProcessHeader(request, HTTP_ACCEPT, lpszAcceptTypes[i], HTTP_ADDHDR_FLAG_COALESCE_WITH_COMMA | HTTP_ADDHDR_FLAG_REQ | (i == 0 ? HTTP_ADDHDR_FLAG_REPLACE : 0)); } } - lpwhr->lpszVerb = heap_strdupW(lpszVerb && *lpszVerb ? lpszVerb : szGET); - lpwhr->lpszVersion = heap_strdupW(lpszVersion ? lpszVersion : g_szHttp1_1); + request->verb = heap_strdupW(lpszVerb && *lpszVerb ? lpszVerb : szGET); + request->version = heap_strdupW(lpszVersion ? lpszVersion : g_szHttp1_1); - if (lpwhs->nHostPort != INTERNET_INVALID_PORT_NUMBER && - lpwhs->nHostPort != INTERNET_DEFAULT_HTTP_PORT && - lpwhs->nHostPort != INTERNET_DEFAULT_HTTPS_PORT) + if (session->hostPort != INTERNET_INVALID_PORT_NUMBER && + session->hostPort != INTERNET_DEFAULT_HTTP_PORT && + session->hostPort != INTERNET_DEFAULT_HTTPS_PORT) { - sprintfW(lpszHostName, szHostForm, lpwhs->lpszHostName, lpwhs->nHostPort); - HTTP_ProcessHeader(lpwhr, hostW, lpszHostName, - HTTP_ADDREQ_FLAG_ADD | HTTP_ADDHDR_FLAG_REQ); + WCHAR *host_name; + + static const WCHAR host_formatW[] = {'%','s',':','%','u',0}; + + host_name = heap_alloc((strlenW(session->hostName) + 7 /* length of ":65535" + 1 */) * sizeof(WCHAR)); + if (!host_name) { + res = ERROR_OUTOFMEMORY; + goto lend; + } + + sprintfW(host_name, host_formatW, session->hostName, session->hostPort); + HTTP_ProcessHeader(request, hostW, host_name, HTTP_ADDREQ_FLAG_ADD | HTTP_ADDHDR_FLAG_REQ); + heap_free(host_name); } else - HTTP_ProcessHeader(lpwhr, hostW, lpwhs->lpszHostName, + HTTP_ProcessHeader(request, hostW, session->hostName, HTTP_ADDREQ_FLAG_ADD | HTTP_ADDHDR_FLAG_REQ); - if (lpwhs->nServerPort == INTERNET_INVALID_PORT_NUMBER) - lpwhs->nServerPort = (dwFlags & INTERNET_FLAG_SECURE ? + if (session->serverPort == INTERNET_INVALID_PORT_NUMBER) + session->serverPort = (dwFlags & INTERNET_FLAG_SECURE ? INTERNET_DEFAULT_HTTPS_PORT : INTERNET_DEFAULT_HTTP_PORT); - if (lpwhs->nHostPort == INTERNET_INVALID_PORT_NUMBER) - lpwhs->nHostPort = (dwFlags & INTERNET_FLAG_SECURE ? + if (session->hostPort == INTERNET_INVALID_PORT_NUMBER) + session->hostPort = (dwFlags & INTERNET_FLAG_SECURE ? INTERNET_DEFAULT_HTTPS_PORT : INTERNET_DEFAULT_HTTP_PORT); - if (NULL != hIC->lpszProxy && hIC->lpszProxy[0] != 0) - HTTP_DealWithProxy( hIC, lpwhs, lpwhr ); + if (hIC->proxy && hIC->proxy[0]) + HTTP_DealWithProxy( hIC, session, request ); - INTERNET_SendCallback(&lpwhs->hdr, dwContext, - INTERNET_STATUS_HANDLE_CREATED, &handle, - sizeof(handle)); + INTERNET_SendCallback(&session->hdr, dwContext, + INTERNET_STATUS_HANDLE_CREATED, &request->hdr.hInternet, + sizeof(HINTERNET)); lend: - HeapFree(GetProcessHeap(), 0, lpszHostName); - if( lpwhr ) - WININET_Release( &lpwhr->hdr ); + TRACE("<-- %u (%p)\n", res, request); - TRACE("<-- %p (%p)\n", handle, lpwhr); - *ret = handle; - return res; + if(res != ERROR_SUCCESS) { + WININET_Release( &request->hdr ); + *ret = NULL; + return res; + } + + *ret = request->hdr.hInternet; + return ERROR_SUCCESS; } /*********************************************************************** @@ -2722,7 +3175,7 @@ HINTERNET WINAPI HttpOpenRequestW(HINTERNET hHttpSession, LPCWSTR lpszReferrer , LPCWSTR *lpszAcceptTypes, DWORD dwFlags, DWORD_PTR dwContext) { - http_session_t *lpwhs; + http_session_t *session; HINTERNET handle = NULL; DWORD res; @@ -2737,8 +3190,8 @@ HINTERNET WINAPI HttpOpenRequestW(HINTERNET hHttpSession, TRACE("\taccept type: %s\n",debugstr_w(lpszAcceptTypes[i])); } - lpwhs = (http_session_t*) WININET_GetObject( hHttpSession ); - if (NULL == lpwhs || lpwhs->hdr.htype != WH_HHTTPSESSION) + session = (http_session_t*) get_handle_object( hHttpSession ); + if (NULL == session || session->hdr.htype != WH_HHTTPSESSION) { res = ERROR_INTERNET_INCORRECT_HANDLE_TYPE; goto lend; @@ -2751,41 +3204,18 @@ HINTERNET WINAPI HttpOpenRequestW(HINTERNET hHttpSession, * necessary HINTERNET pointer returned by this function. * */ - res = HTTP_HttpOpenRequestW(lpwhs, lpszVerb, lpszObjectName, + res = HTTP_HttpOpenRequestW(session, lpszVerb, lpszObjectName, lpszVersion, lpszReferrer, lpszAcceptTypes, dwFlags, dwContext, &handle); lend: - if( lpwhs ) - WININET_Release( &lpwhs->hdr ); + if( session ) + WININET_Release( &session->hdr ); TRACE("returning %p\n", handle); if(res != ERROR_SUCCESS) SetLastError(res); return handle; } -/* read any content returned by the server so that the connection can be - * reused */ -static void HTTP_DrainContent(http_request_t *req) -{ - DWORD bytes_read; - - if (!NETCON_connected(&req->netConnection)) return; - - if (req->dwContentLength == -1) - { - NETCON_close(&req->netConnection); - return; - } - if (!strcmpW(req->lpszVerb, szHEAD)) return; - - do - { - char buffer[2048]; - if (HTTPREQ_Read(req, buffer, sizeof(buffer), &bytes_read, TRUE) != ERROR_SUCCESS) - return; - } while (bytes_read); -} - static const LPCWSTR header_lookup[] = { szMime_Version, /* HTTP_QUERY_MIME_VERSION = 0 */ szContent_Type, /* HTTP_QUERY_CONTENT_TYPE = 1 */ @@ -2865,7 +3295,7 @@ static const LPCWSTR header_lookup[] = { /*********************************************************************** * HTTP_HttpQueryInfoW (internal) */ -static DWORD HTTP_HttpQueryInfoW(http_request_t *lpwhr, DWORD dwInfoLevel, +static DWORD HTTP_HttpQueryInfoW(http_request_t *request, DWORD dwInfoLevel, LPVOID lpBuffer, LPDWORD lpdwBufferLength, LPDWORD lpdwIndex) { LPHTTPHEADERW lphttpHdr = NULL; @@ -2879,7 +3309,7 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t *lpwhr, DWORD dwInfoLevel, { case HTTP_QUERY_CUSTOM: if (!lpBuffer) return ERROR_INVALID_PARAMETER; - index = HTTP_GetCustomHeaderIndex(lpwhr, lpBuffer, requested_index, request_only); + index = HTTP_GetCustomHeaderIndex(request, lpBuffer, requested_index, request_only); break; case HTTP_QUERY_RAW_HEADERS_CRLF: { @@ -2888,9 +3318,9 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t *lpwhr, DWORD dwInfoLevel, DWORD res = ERROR_INVALID_PARAMETER; if (request_only) - headers = HTTP_BuildHeaderRequestString(lpwhr, lpwhr->lpszVerb, lpwhr->lpszPath, lpwhr->lpszVersion); + headers = HTTP_BuildHeaderRequestString(request, request->verb, request->path, request->version); else - headers = lpwhr->lpszRawHeaders; + headers = request->rawHeaders; if (headers) len = strlenW(headers) * sizeof(WCHAR); @@ -2920,7 +3350,7 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t *lpwhr, DWORD dwInfoLevel, } case HTTP_QUERY_RAW_HEADERS: { - LPWSTR * ppszRawHeaderLines = HTTP_Tokenize(lpwhr->lpszRawHeaders, szCrLf); + LPWSTR * ppszRawHeaderLines = HTTP_Tokenize(request->rawHeaders, szCrLf); DWORD i, size = 0; LPWSTR pszString = lpBuffer; @@ -2950,9 +3380,9 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t *lpwhr, DWORD dwInfoLevel, return ERROR_SUCCESS; } case HTTP_QUERY_STATUS_TEXT: - if (lpwhr->lpszStatusText) + if (request->statusText) { - DWORD len = strlenW(lpwhr->lpszStatusText); + DWORD len = strlenW(request->statusText); if (len + 1 > *lpdwBufferLength/sizeof(WCHAR)) { *lpdwBufferLength = (len + 1) * sizeof(WCHAR); @@ -2960,7 +3390,7 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t *lpwhr, DWORD dwInfoLevel, } if (lpBuffer) { - memcpy(lpBuffer, lpwhr->lpszStatusText, (len + 1) * sizeof(WCHAR)); + memcpy(lpBuffer, request->statusText, (len + 1) * sizeof(WCHAR)); TRACE("returning data: %s\n", debugstr_wn(lpBuffer, len)); } *lpdwBufferLength = len * sizeof(WCHAR); @@ -2968,9 +3398,9 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t *lpwhr, DWORD dwInfoLevel, } break; case HTTP_QUERY_VERSION: - if (lpwhr->lpszVersion) + if (request->version) { - DWORD len = strlenW(lpwhr->lpszVersion); + DWORD len = strlenW(request->version); if (len + 1 > *lpdwBufferLength/sizeof(WCHAR)) { *lpdwBufferLength = (len + 1) * sizeof(WCHAR); @@ -2978,7 +3408,7 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t *lpwhr, DWORD dwInfoLevel, } if (lpBuffer) { - memcpy(lpBuffer, lpwhr->lpszVersion, (len + 1) * sizeof(WCHAR)); + memcpy(lpBuffer, request->version, (len + 1) * sizeof(WCHAR)); TRACE("returning data: %s\n", debugstr_wn(lpBuffer, len)); } *lpdwBufferLength = len * sizeof(WCHAR); @@ -2986,19 +3416,19 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t *lpwhr, DWORD dwInfoLevel, } break; case HTTP_QUERY_CONTENT_ENCODING: - index = HTTP_GetCustomHeaderIndex(lpwhr, header_lookup[lpwhr->gzip_stream ? HTTP_QUERY_CONTENT_TYPE : level], + index = HTTP_GetCustomHeaderIndex(request, header_lookup[request->read_gzip ? HTTP_QUERY_CONTENT_TYPE : level], requested_index,request_only); break; default: assert (LAST_TABLE_HEADER == (HTTP_QUERY_UNLESS_MODIFIED_SINCE + 1)); if (level < LAST_TABLE_HEADER && header_lookup[level]) - index = HTTP_GetCustomHeaderIndex(lpwhr, header_lookup[level], + index = HTTP_GetCustomHeaderIndex(request, header_lookup[level], requested_index,request_only); } if (index >= 0) - lphttpHdr = &lpwhr->pCustHeaders[index]; + lphttpHdr = &request->custHeaders[index]; /* Ensure header satisfies requested attributes */ if (!lphttpHdr || @@ -3071,7 +3501,7 @@ static DWORD HTTP_HttpQueryInfoW(http_request_t *lpwhr, DWORD dwInfoLevel, BOOL WINAPI HttpQueryInfoW(HINTERNET hHttpRequest, DWORD dwInfoLevel, LPVOID lpBuffer, LPDWORD lpdwBufferLength, LPDWORD lpdwIndex) { - http_request_t *lpwhr; + http_request_t *request; DWORD res; if (TRACE_ON(wininet)) { @@ -3184,8 +3614,8 @@ BOOL WINAPI HttpQueryInfoW(HINTERNET hHttpRequest, DWORD dwInfoLevel, TRACE("\n"); } - lpwhr = (http_request_t*) WININET_GetObject( hHttpRequest ); - if (NULL == lpwhr || lpwhr->hdr.htype != WH_HHTTPREQ) + request = (http_request_t*) get_handle_object( hHttpRequest ); + if (NULL == request || request->hdr.htype != WH_HHTTPREQ) { res = ERROR_INTERNET_INCORRECT_HANDLE_TYPE; goto lend; @@ -3193,12 +3623,12 @@ BOOL WINAPI HttpQueryInfoW(HINTERNET hHttpRequest, DWORD dwInfoLevel, if (lpBuffer == NULL) *lpdwBufferLength = 0; - res = HTTP_HttpQueryInfoW( lpwhr, dwInfoLevel, + res = HTTP_HttpQueryInfoW( request, dwInfoLevel, lpBuffer, lpdwBufferLength, lpdwIndex); lend: - if( lpwhr ) - WININET_Release( &lpwhr->hdr ); + if( request ) + WININET_Release( &request->hdr ); TRACE("%u <--\n", res); if(res != ERROR_SUCCESS) @@ -3242,7 +3672,7 @@ BOOL WINAPI HttpQueryInfoA(HINTERNET hHttpRequest, DWORD dwInfoLevel, } else alloclen = len; - bufferW = HeapAlloc( GetProcessHeap(), 0, alloclen ); + bufferW = heap_alloc(alloclen); /* buffer is in/out because of HTTP_QUERY_CUSTOM */ if ((dwInfoLevel & HTTP_QUERY_HEADER_MASK) == HTTP_QUERY_CUSTOM) MultiByteToWideChar( CP_ACP, 0, lpBuffer, -1, bufferW, alloclen / sizeof(WCHAR) ); @@ -3276,27 +3706,27 @@ BOOL WINAPI HttpQueryInfoA(HINTERNET hHttpRequest, DWORD dwInfoLevel, /*********************************************************************** * HTTP_GetRedirectURL (internal) */ -static LPWSTR HTTP_GetRedirectURL(http_request_t *lpwhr, LPCWSTR lpszUrl) +static LPWSTR HTTP_GetRedirectURL(http_request_t *request, LPCWSTR lpszUrl) { static WCHAR szHttp[] = {'h','t','t','p',0}; static WCHAR szHttps[] = {'h','t','t','p','s',0}; - http_session_t *lpwhs = lpwhr->lpHttpSession; + http_session_t *session = request->session; URL_COMPONENTSW urlComponents; DWORD url_length = 0; LPWSTR orig_url; LPWSTR combined_url; urlComponents.dwStructSize = sizeof(URL_COMPONENTSW); - urlComponents.lpszScheme = (lpwhr->hdr.dwFlags & INTERNET_FLAG_SECURE) ? szHttps : szHttp; + urlComponents.lpszScheme = (request->hdr.dwFlags & INTERNET_FLAG_SECURE) ? szHttps : szHttp; urlComponents.dwSchemeLength = 0; - urlComponents.lpszHostName = lpwhs->lpszHostName; + urlComponents.lpszHostName = session->hostName; urlComponents.dwHostNameLength = 0; - urlComponents.nPort = lpwhs->nHostPort; - urlComponents.lpszUserName = lpwhs->lpszUserName; + urlComponents.nPort = session->hostPort; + urlComponents.lpszUserName = session->userName; urlComponents.dwUserNameLength = 0; urlComponents.lpszPassword = NULL; urlComponents.dwPasswordLength = 0; - urlComponents.lpszUrlPath = lpwhr->lpszPath; + urlComponents.lpszUrlPath = request->path; urlComponents.dwUrlPathLength = 0; urlComponents.lpszExtraInfo = NULL; urlComponents.dwExtraInfoLength = 0; @@ -3305,7 +3735,7 @@ static LPWSTR HTTP_GetRedirectURL(http_request_t *lpwhr, LPCWSTR lpszUrl) (GetLastError() != ERROR_INSUFFICIENT_BUFFER)) return NULL; - orig_url = HeapAlloc(GetProcessHeap(), 0, url_length); + orig_url = heap_alloc(url_length); /* convert from bytes to characters */ url_length = url_length / sizeof(WCHAR) - 1; @@ -3322,7 +3752,7 @@ static LPWSTR HTTP_GetRedirectURL(http_request_t *lpwhr, LPCWSTR lpszUrl) HeapFree(GetProcessHeap(), 0, orig_url); return NULL; } - combined_url = HeapAlloc(GetProcessHeap(), 0, url_length * sizeof(WCHAR)); + combined_url = heap_alloc(url_length * sizeof(WCHAR)); if (!InternetCombineUrlW(orig_url, lpszUrl, combined_url, &url_length, ICU_ENCODE_SPACES_ONLY)) { @@ -3338,11 +3768,11 @@ static LPWSTR HTTP_GetRedirectURL(http_request_t *lpwhr, LPCWSTR lpszUrl) /*********************************************************************** * HTTP_HandleRedirect (internal) */ -static DWORD HTTP_HandleRedirect(http_request_t *lpwhr, LPCWSTR lpszUrl) +static DWORD HTTP_HandleRedirect(http_request_t *request, LPCWSTR lpszUrl) { - http_session_t *lpwhs = lpwhr->lpHttpSession; - appinfo_t *hIC = lpwhs->lpAppInfo; - BOOL using_proxy = hIC->lpszProxy && hIC->lpszProxy[0]; + http_session_t *session = request->session; + appinfo_t *hIC = session->appInfo; + BOOL using_proxy = hIC->proxy && hIC->proxy[0]; WCHAR path[INTERNET_MAX_URL_LENGTH]; int index; @@ -3379,18 +3809,18 @@ static DWORD HTTP_HandleRedirect(http_request_t *lpwhr, LPCWSTR lpszUrl) return INTERNET_GetLastError(); if (!strncmpW(szHttp, urlComponents.lpszScheme, strlenW(szHttp)) && - (lpwhr->hdr.dwFlags & INTERNET_FLAG_SECURE)) + (request->hdr.dwFlags & INTERNET_FLAG_SECURE)) { TRACE("redirect from secure page to non-secure page\n"); /* FIXME: warn about from secure redirect to non-secure page */ - lpwhr->hdr.dwFlags &= ~INTERNET_FLAG_SECURE; + request->hdr.dwFlags &= ~INTERNET_FLAG_SECURE; } if (!strncmpW(szHttps, urlComponents.lpszScheme, strlenW(szHttps)) && - !(lpwhr->hdr.dwFlags & INTERNET_FLAG_SECURE)) + !(request->hdr.dwFlags & INTERNET_FLAG_SECURE)) { TRACE("redirect from non-secure page to secure page\n"); /* FIXME: notify about redirect to secure page */ - lpwhr->hdr.dwFlags |= INTERNET_FLAG_SECURE; + request->hdr.dwFlags |= INTERNET_FLAG_SECURE; } if (urlComponents.nPort == INTERNET_INVALID_PORT_NUMBER) @@ -3412,61 +3842,46 @@ static DWORD HTTP_HandleRedirect(http_request_t *lpwhr, LPCWSTR lpszUrl) */ /* consider the current host as the referrer */ - if (lpwhs->lpszServerName && *lpwhs->lpszServerName) - HTTP_ProcessHeader(lpwhr, HTTP_REFERER, lpwhs->lpszServerName, + if (session->lpszServerName && *session->lpszServerName) + HTTP_ProcessHeader(request, HTTP_REFERER, session->lpszServerName, HTTP_ADDHDR_FLAG_REQ|HTTP_ADDREQ_FLAG_REPLACE| HTTP_ADDHDR_FLAG_ADD_IF_NEW); #endif - HeapFree(GetProcessHeap(), 0, lpwhs->lpszHostName); + HeapFree(GetProcessHeap(), 0, session->hostName); if (urlComponents.nPort != INTERNET_DEFAULT_HTTP_PORT && urlComponents.nPort != INTERNET_DEFAULT_HTTPS_PORT) { int len; - static const WCHAR fmt[] = {'%','s',':','%','i',0}; + static const WCHAR fmt[] = {'%','s',':','%','u',0}; len = lstrlenW(hostName); len += 7; /* 5 for strlen("65535") + 1 for ":" + 1 for '\0' */ - lpwhs->lpszHostName = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR)); - sprintfW(lpwhs->lpszHostName, fmt, hostName, urlComponents.nPort); + session->hostName = heap_alloc(len*sizeof(WCHAR)); + sprintfW(session->hostName, fmt, hostName, urlComponents.nPort); } else - lpwhs->lpszHostName = heap_strdupW(hostName); + session->hostName = heap_strdupW(hostName); - HTTP_ProcessHeader(lpwhr, hostW, lpwhs->lpszHostName, HTTP_ADDREQ_FLAG_ADD | HTTP_ADDREQ_FLAG_REPLACE | HTTP_ADDHDR_FLAG_REQ); + HTTP_ProcessHeader(request, hostW, session->hostName, HTTP_ADDREQ_FLAG_ADD | HTTP_ADDREQ_FLAG_REPLACE | HTTP_ADDHDR_FLAG_REQ); - HeapFree(GetProcessHeap(), 0, lpwhs->lpszUserName); - lpwhs->lpszUserName = NULL; + HeapFree(GetProcessHeap(), 0, session->userName); + session->userName = NULL; if (userName[0]) - lpwhs->lpszUserName = heap_strdupW(userName); + session->userName = heap_strdupW(userName); - if (!using_proxy) - { - if (strcmpiW(lpwhs->lpszServerName, hostName) || lpwhs->nServerPort != urlComponents.nPort) - { - DWORD res; + reset_data_stream(request); - HeapFree(GetProcessHeap(), 0, lpwhs->lpszServerName); - lpwhs->lpszServerName = heap_strdupW(hostName); - lpwhs->nServerPort = urlComponents.nPort; - - NETCON_close(&lpwhr->netConnection); - if ((res = HTTP_ResolveName(lpwhr)) != ERROR_SUCCESS) - return res; - - res = NETCON_init(&lpwhr->netConnection, lpwhr->hdr.dwFlags & INTERNET_FLAG_SECURE); - if (res != ERROR_SUCCESS) - return res; - - lpwhr->read_pos = lpwhr->read_size = 0; - lpwhr->read_chunked = FALSE; + if(!using_proxy) { + if(strcmpiW(session->serverName, hostName)) { + HeapFree(GetProcessHeap(), 0, session->serverName); + session->serverName = heap_strdupW(hostName); } + session->serverPort = urlComponents.nPort; } - else - TRACE("Redirect through proxy\n"); } - HeapFree(GetProcessHeap(), 0, lpwhr->lpszPath); - lpwhr->lpszPath=NULL; + HeapFree(GetProcessHeap(), 0, request->path); + request->path=NULL; if (*path) { DWORD needed = 0; @@ -3475,23 +3890,23 @@ static DWORD HTTP_HandleRedirect(http_request_t *lpwhr, LPCWSTR lpszUrl) rc = UrlEscapeW(path, NULL, &needed, URL_ESCAPE_SPACES_ONLY); if (rc != E_POINTER) needed = strlenW(path)+1; - lpwhr->lpszPath = HeapAlloc(GetProcessHeap(), 0, needed*sizeof(WCHAR)); - rc = UrlEscapeW(path, lpwhr->lpszPath, &needed, + request->path = heap_alloc(needed*sizeof(WCHAR)); + rc = UrlEscapeW(path, request->path, &needed, URL_ESCAPE_SPACES_ONLY); if (rc != S_OK) { ERR("Unable to escape string!(%s) (%d)\n",debugstr_w(path),rc); - strcpyW(lpwhr->lpszPath,path); + strcpyW(request->path,path); } } /* Remove custom content-type/length headers on redirects. */ - index = HTTP_GetCustomHeaderIndex(lpwhr, szContent_Type, 0, TRUE); + index = HTTP_GetCustomHeaderIndex(request, szContent_Type, 0, TRUE); if (0 <= index) - HTTP_DeleteCustomHeader(lpwhr, index); - index = HTTP_GetCustomHeaderIndex(lpwhr, szContent_Length, 0, TRUE); + HTTP_DeleteCustomHeader(request, index); + index = HTTP_GetCustomHeaderIndex(request, szContent_Length, 0, TRUE); if (0 <= index) - HTTP_DeleteCustomHeader(lpwhr, index); + HTTP_DeleteCustomHeader(request, index); return ERROR_SUCCESS; } @@ -3510,7 +3925,7 @@ static LPWSTR HTTP_build_req( LPCWSTR *list, int len ) len += strlenW( *t ); len++; - str = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) ); + str = heap_alloc(len*sizeof(WCHAR)); *str = 0; for( t = list; *t ; t++ ) @@ -3519,7 +3934,7 @@ static LPWSTR HTTP_build_req( LPCWSTR *list, int len ) return str; } -static DWORD HTTP_SecureProxyConnect(http_request_t *lpwhr) +static DWORD HTTP_SecureProxyConnect(http_request_t *request) { LPWSTR lpszPath; LPWSTR requestString; @@ -3529,66 +3944,594 @@ static DWORD HTTP_SecureProxyConnect(http_request_t *lpwhr) char *ascii_req; DWORD res; static const WCHAR szConnect[] = {'C','O','N','N','E','C','T',0}; - static const WCHAR szFormat[] = {'%','s',':','%','d',0}; - http_session_t *lpwhs = lpwhr->lpHttpSession; + static const WCHAR szFormat[] = {'%','s',':','%','u',0}; + http_session_t *session = request->session; TRACE("\n"); - lpszPath = HeapAlloc( GetProcessHeap(), 0, (lstrlenW( lpwhs->lpszHostName ) + 13)*sizeof(WCHAR) ); - sprintfW( lpszPath, szFormat, lpwhs->lpszHostName, lpwhs->nHostPort ); - requestString = HTTP_BuildHeaderRequestString( lpwhr, szConnect, lpszPath, g_szHttp1_1 ); + lpszPath = heap_alloc((lstrlenW( session->hostName ) + 13)*sizeof(WCHAR)); + sprintfW( lpszPath, szFormat, session->hostName, session->hostPort ); + requestString = HTTP_BuildHeaderRequestString( request, szConnect, lpszPath, g_szHttp1_1 ); HeapFree( GetProcessHeap(), 0, lpszPath ); len = WideCharToMultiByte( CP_ACP, 0, requestString, -1, NULL, 0, NULL, NULL ); len--; /* the nul terminator isn't needed */ - ascii_req = HeapAlloc( GetProcessHeap(), 0, len ); + ascii_req = heap_alloc(len); WideCharToMultiByte( CP_ACP, 0, requestString, -1, ascii_req, len, NULL, NULL ); HeapFree( GetProcessHeap(), 0, requestString ); TRACE("full request -> %s\n", debugstr_an( ascii_req, len ) ); - res = NETCON_send( &lpwhr->netConnection, ascii_req, len, 0, &cnt ); + res = NETCON_send( request->netconn, ascii_req, len, 0, &cnt ); HeapFree( GetProcessHeap(), 0, ascii_req ); if (res != ERROR_SUCCESS) return res; - responseLen = HTTP_GetResponseHeaders( lpwhr, TRUE ); + responseLen = HTTP_GetResponseHeaders( request, TRUE ); if (!responseLen) return ERROR_HTTP_INVALID_HEADER; return ERROR_SUCCESS; } -static void HTTP_InsertCookies(http_request_t *lpwhr) +static void HTTP_InsertCookies(http_request_t *request) { - static const WCHAR szUrlForm[] = {'h','t','t','p',':','/','/','%','s','%','s',0}; - LPWSTR lpszCookies, lpszUrl = NULL; - DWORD nCookieSize, size; - LPHTTPHEADERW Host = HTTP_GetHeader(lpwhr, hostW); + DWORD cookie_size, size, cnt = 0; + HTTPHEADERW *host; + WCHAR *cookies; - size = (strlenW(Host->lpszValue) + strlenW(szUrlForm) + strlenW(lpwhr->lpszPath)) * sizeof(WCHAR); - if (!(lpszUrl = HeapAlloc(GetProcessHeap(), 0, size))) return; - sprintfW( lpszUrl, szUrlForm, Host->lpszValue, lpwhr->lpszPath); + static const WCHAR cookieW[] = {'C','o','o','k','i','e',':',' ',0}; - if (InternetGetCookieW(lpszUrl, NULL, NULL, &nCookieSize)) + host = HTTP_GetHeader(request, hostW); + if(!host) + return; + + if(!get_cookie(host->lpszValue, request->path, NULL, &cookie_size)) + return; + + size = sizeof(cookieW) + cookie_size * sizeof(WCHAR) + sizeof(szCrLf); + if(!(cookies = heap_alloc(size))) + return; + + cnt += sprintfW(cookies, cookieW); + get_cookie(host->lpszValue, request->path, cookies+cnt, &cookie_size); + strcatW(cookies, szCrLf); + + HTTP_HttpAddRequestHeadersW(request, cookies, strlenW(cookies), HTTP_ADDREQ_FLAG_REPLACE); + + heap_free(cookies); +} + +static WORD HTTP_ParseDay(LPCWSTR day) +{ + static const WCHAR days[7][4] = {{ 's','u','n',0 }, + { 'm','o','n',0 }, + { 't','u','e',0 }, + { 'w','e','d',0 }, + { 't','h','u',0 }, + { 'f','r','i',0 }, + { 's','a','t',0 }}; + int i; + for (i = 0; i < sizeof(days)/sizeof(*days); i++) + if (!strcmpiW(day, days[i])) + return i; + + /* Invalid */ + return 7; +} + +static WORD HTTP_ParseMonth(LPCWSTR month) +{ + static const WCHAR jan[] = { 'j','a','n',0 }; + static const WCHAR feb[] = { 'f','e','b',0 }; + static const WCHAR mar[] = { 'm','a','r',0 }; + static const WCHAR apr[] = { 'a','p','r',0 }; + static const WCHAR may[] = { 'm','a','y',0 }; + static const WCHAR jun[] = { 'j','u','n',0 }; + static const WCHAR jul[] = { 'j','u','l',0 }; + static const WCHAR aug[] = { 'a','u','g',0 }; + static const WCHAR sep[] = { 's','e','p',0 }; + static const WCHAR oct[] = { 'o','c','t',0 }; + static const WCHAR nov[] = { 'n','o','v',0 }; + static const WCHAR dec[] = { 'd','e','c',0 }; + + if (!strcmpiW(month, jan)) return 1; + if (!strcmpiW(month, feb)) return 2; + if (!strcmpiW(month, mar)) return 3; + if (!strcmpiW(month, apr)) return 4; + if (!strcmpiW(month, may)) return 5; + if (!strcmpiW(month, jun)) return 6; + if (!strcmpiW(month, jul)) return 7; + if (!strcmpiW(month, aug)) return 8; + if (!strcmpiW(month, sep)) return 9; + if (!strcmpiW(month, oct)) return 10; + if (!strcmpiW(month, nov)) return 11; + if (!strcmpiW(month, dec)) return 12; + /* Invalid */ + return 0; +} + +/* Parses the string pointed to by *str, assumed to be a 24-hour time HH:MM:SS, + * optionally preceded by whitespace. + * Upon success, returns TRUE, sets the wHour, wMinute, and wSecond fields of + * st, and sets *str to the first character after the time format. + */ +static BOOL HTTP_ParseTime(SYSTEMTIME *st, LPCWSTR *str) +{ + LPCWSTR ptr = *str; + WCHAR *nextPtr; + unsigned long num; + + while (isspaceW(*ptr)) + ptr++; + + num = strtoulW(ptr, &nextPtr, 10); + if (!nextPtr || nextPtr <= ptr || *nextPtr != ':') { - int cnt = 0; - static const WCHAR szCookie[] = {'C','o','o','k','i','e',':',' ',0}; + ERR("unexpected time format %s\n", debugstr_w(ptr)); + return FALSE; + } + if (num > 23) + { + ERR("unexpected hour in time format %s\n", debugstr_w(ptr)); + return FALSE; + } + ptr = nextPtr + 1; + st->wHour = (WORD)num; + num = strtoulW(ptr, &nextPtr, 10); + if (!nextPtr || nextPtr <= ptr || *nextPtr != ':') + { + ERR("unexpected time format %s\n", debugstr_w(ptr)); + return FALSE; + } + if (num > 59) + { + ERR("unexpected minute in time format %s\n", debugstr_w(ptr)); + return FALSE; + } + ptr = nextPtr + 1; + st->wMinute = (WORD)num; + num = strtoulW(ptr, &nextPtr, 10); + if (!nextPtr || nextPtr <= ptr) + { + ERR("unexpected time format %s\n", debugstr_w(ptr)); + return FALSE; + } + if (num > 59) + { + ERR("unexpected second in time format %s\n", debugstr_w(ptr)); + return FALSE; + } + ptr = nextPtr + 1; + *str = ptr; + st->wSecond = (WORD)num; + return TRUE; +} - size = sizeof(szCookie) + nCookieSize * sizeof(WCHAR) + sizeof(szCrLf); - if ((lpszCookies = HeapAlloc(GetProcessHeap(), 0, size))) +static BOOL HTTP_ParseDateAsAsctime(LPCWSTR value, FILETIME *ft) +{ + static const WCHAR gmt[]= { 'G','M','T',0 }; + WCHAR day[4], *dayPtr, month[4], *monthPtr, *nextPtr; + LPCWSTR ptr; + SYSTEMTIME st = { 0 }; + unsigned long num; + + for (ptr = value, dayPtr = day; *ptr && !isspaceW(*ptr) && + dayPtr - day < sizeof(day) / sizeof(day[0]) - 1; ptr++, dayPtr++) + *dayPtr = *ptr; + *dayPtr = 0; + st.wDayOfWeek = HTTP_ParseDay(day); + if (st.wDayOfWeek >= 7) + { + ERR("unexpected weekday %s\n", debugstr_w(day)); + return FALSE; + } + + while (isspaceW(*ptr)) + ptr++; + + for (monthPtr = month; !isspace(*ptr) && + monthPtr - month < sizeof(month) / sizeof(month[0]) - 1; + monthPtr++, ptr++) + *monthPtr = *ptr; + *monthPtr = 0; + st.wMonth = HTTP_ParseMonth(month); + if (!st.wMonth || st.wMonth > 12) + { + ERR("unexpected month %s\n", debugstr_w(month)); + return FALSE; + } + + while (isspaceW(*ptr)) + ptr++; + + num = strtoulW(ptr, &nextPtr, 10); + if (!nextPtr || nextPtr <= ptr || !num || num > 31) + { + ERR("unexpected day %s\n", debugstr_w(ptr)); + return FALSE; + } + ptr = nextPtr; + st.wDay = (WORD)num; + + while (isspaceW(*ptr)) + ptr++; + + if (!HTTP_ParseTime(&st, &ptr)) + return FALSE; + + while (isspaceW(*ptr)) + ptr++; + + num = strtoulW(ptr, &nextPtr, 10); + if (!nextPtr || nextPtr <= ptr || num < 1601 || num > 30827) + { + ERR("unexpected year %s\n", debugstr_w(ptr)); + return FALSE; + } + ptr = nextPtr; + st.wYear = (WORD)num; + + while (isspaceW(*ptr)) + ptr++; + + /* asctime() doesn't report a timezone, but some web servers do, so accept + * with or without GMT. + */ + if (*ptr && strcmpW(ptr, gmt)) + { + ERR("unexpected timezone %s\n", debugstr_w(ptr)); + return FALSE; + } + return SystemTimeToFileTime(&st, ft); +} + +static BOOL HTTP_ParseRfc1123Date(LPCWSTR value, FILETIME *ft) +{ + static const WCHAR gmt[]= { 'G','M','T',0 }; + WCHAR *nextPtr, day[4], month[4], *monthPtr; + LPCWSTR ptr; + unsigned long num; + SYSTEMTIME st = { 0 }; + + ptr = strchrW(value, ','); + if (!ptr) + return FALSE; + if (ptr - value != 3) + { + ERR("unexpected weekday %s\n", debugstr_wn(value, ptr - value)); + return FALSE; + } + memcpy(day, value, (ptr - value) * sizeof(WCHAR)); + day[3] = 0; + st.wDayOfWeek = HTTP_ParseDay(day); + if (st.wDayOfWeek > 6) + { + ERR("unexpected weekday %s\n", debugstr_wn(value, ptr - value)); + return FALSE; + } + ptr++; + + while (isspaceW(*ptr)) + ptr++; + + num = strtoulW(ptr, &nextPtr, 10); + if (!nextPtr || nextPtr <= ptr || !num || num > 31) + { + ERR("unexpected day %s\n", debugstr_w(value)); + return FALSE; + } + ptr = nextPtr; + st.wDay = (WORD)num; + + while (isspaceW(*ptr)) + ptr++; + + for (monthPtr = month; !isspace(*ptr) && + monthPtr - month < sizeof(month) / sizeof(month[0]) - 1; + monthPtr++, ptr++) + *monthPtr = *ptr; + *monthPtr = 0; + st.wMonth = HTTP_ParseMonth(month); + if (!st.wMonth || st.wMonth > 12) + { + ERR("unexpected month %s\n", debugstr_w(month)); + return FALSE; + } + + while (isspaceW(*ptr)) + ptr++; + + num = strtoulW(ptr, &nextPtr, 10); + if (!nextPtr || nextPtr <= ptr || num < 1601 || num > 30827) + { + ERR("unexpected year %s\n", debugstr_w(value)); + return FALSE; + } + ptr = nextPtr; + st.wYear = (WORD)num; + + if (!HTTP_ParseTime(&st, &ptr)) + return FALSE; + + while (isspaceW(*ptr)) + ptr++; + + if (strcmpW(ptr, gmt)) + { + ERR("unexpected time zone %s\n", debugstr_w(ptr)); + return FALSE; + } + return SystemTimeToFileTime(&st, ft); +} + +/* FIXME: only accepts dates in RFC 1123 format and asctime() format, + * which may not be the only formats actually seen in the wild. + * http://www.hackcraft.net/web/datetime/ suggests at least RFC 850 dates + * should be accepted as well. + */ +static BOOL HTTP_ParseDate(LPCWSTR value, FILETIME *ft) +{ + static const WCHAR zero[] = { '0',0 }; + BOOL ret; + + if (!strcmpW(value, zero)) + { + ft->dwLowDateTime = ft->dwHighDateTime = 0; + ret = TRUE; + } + else if (strchrW(value, ',')) + ret = HTTP_ParseRfc1123Date(value, ft); + else + { + ret = HTTP_ParseDateAsAsctime(value, ft); + if (!ret) + ERR("unexpected date format %s\n", debugstr_w(value)); + } + return ret; +} + +static void HTTP_ProcessExpires(http_request_t *request) +{ + BOOL expirationFound = FALSE; + int headerIndex; + + /* Look for a Cache-Control header with a max-age directive, as it takes + * precedence over the Expires header. + */ + headerIndex = HTTP_GetCustomHeaderIndex(request, szCache_Control, 0, FALSE); + if (headerIndex != -1) + { + LPHTTPHEADERW ccHeader = &request->custHeaders[headerIndex]; + LPWSTR ptr; + + for (ptr = ccHeader->lpszValue; ptr && *ptr; ) { - cnt += sprintfW(lpszCookies, szCookie); - InternetGetCookieW(lpszUrl, NULL, lpszCookies + cnt, &nCookieSize); - strcatW(lpszCookies, szCrLf); + LPWSTR comma = strchrW(ptr, ','), end, equal; - HTTP_HttpAddRequestHeadersW(lpwhr, lpszCookies, strlenW(lpszCookies), HTTP_ADDREQ_FLAG_REPLACE); - HeapFree(GetProcessHeap(), 0, lpszCookies); + if (comma) + end = comma; + else + end = ptr + strlenW(ptr); + for (equal = end - 1; equal > ptr && *equal != '='; equal--) + ; + if (*equal == '=') + { + static const WCHAR max_age[] = { + 'm','a','x','-','a','g','e',0 }; + + if (!strncmpiW(ptr, max_age, equal - ptr - 1)) + { + LPWSTR nextPtr; + unsigned long age; + + age = strtoulW(equal + 1, &nextPtr, 10); + if (nextPtr > equal + 1) + { + LARGE_INTEGER ft; + + NtQuerySystemTime( &ft ); + /* Age is in seconds, FILETIME resolution is in + * 100 nanosecond intervals. + */ + ft.QuadPart += age * (ULONGLONG)1000000; + request->expires.dwLowDateTime = ft.u.LowPart; + request->expires.dwHighDateTime = ft.u.HighPart; + expirationFound = TRUE; + } + } + } + if (comma) + { + ptr = comma + 1; + while (isspaceW(*ptr)) + ptr++; + } + else + ptr = NULL; } } - HeapFree(GetProcessHeap(), 0, lpszUrl); + if (!expirationFound) + { + headerIndex = HTTP_GetCustomHeaderIndex(request, szExpires, 0, FALSE); + if (headerIndex != -1) + { + LPHTTPHEADERW expiresHeader = &request->custHeaders[headerIndex]; + FILETIME ft; + + if (HTTP_ParseDate(expiresHeader->lpszValue, &ft)) + { + expirationFound = TRUE; + request->expires = ft; + } + } + } + if (!expirationFound) + { + LARGE_INTEGER t; + + /* With no known age, default to 10 minutes until expiration. */ + NtQuerySystemTime( &t ); + t.QuadPart += 10 * 60 * (ULONGLONG)10000000; + request->expires.dwLowDateTime = t.u.LowPart; + request->expires.dwHighDateTime = t.u.HighPart; + } +} + +static void HTTP_ProcessLastModified(http_request_t *request) +{ + int headerIndex; + + headerIndex = HTTP_GetCustomHeaderIndex(request, szLast_Modified, 0, FALSE); + if (headerIndex != -1) + { + LPHTTPHEADERW expiresHeader = &request->custHeaders[headerIndex]; + FILETIME ft; + + if (HTTP_ParseDate(expiresHeader->lpszValue, &ft)) + request->last_modified = ft; + } +} + +static void http_process_keep_alive(http_request_t *req) +{ + int index; + + index = HTTP_GetCustomHeaderIndex(req, szConnection, 0, FALSE); + if(index != -1) + req->netconn->keep_alive = !strcmpiW(req->custHeaders[index].lpszValue, szKeepAlive); + else + req->netconn->keep_alive = !strcmpiW(req->version, g_szHttp1_1); +} + +static void HTTP_CacheRequest(http_request_t *request) +{ + WCHAR url[INTERNET_MAX_URL_LENGTH]; + WCHAR cacheFileName[MAX_PATH+1]; + BOOL b; + + b = HTTP_GetRequestURL(request, url); + if(!b) { + WARN("Could not get URL\n"); + return; + } + + b = CreateUrlCacheEntryW(url, request->contentLength, NULL, cacheFileName, 0); + if(b) { + HeapFree(GetProcessHeap(), 0, request->cacheFile); + CloseHandle(request->hCacheFile); + + request->cacheFile = heap_strdupW(cacheFileName); + request->hCacheFile = CreateFileW(request->cacheFile, GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, + NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + if(request->hCacheFile == INVALID_HANDLE_VALUE) { + WARN("Could not create file: %u\n", GetLastError()); + request->hCacheFile = NULL; + } + }else { + WARN("Could not create cache entry: %08x\n", GetLastError()); + } +} + +static DWORD open_http_connection(http_request_t *request, BOOL *reusing) +{ + const BOOL is_https = (request->hdr.dwFlags & INTERNET_FLAG_SECURE) != 0; + http_session_t *session = request->session; + netconn_t *netconn = NULL; + server_t *server; + DWORD res; + + assert(!request->netconn); + reset_data_stream(request); + + server = get_server(session->serverName, session->serverPort); + if(!server) + return ERROR_OUTOFMEMORY; + + res = HTTP_ResolveName(request, server); + if(res != ERROR_SUCCESS) { + server_release(server); + return res; + } + + EnterCriticalSection(&connection_pool_cs); + + while(!list_empty(&server->conn_pool)) { + netconn = LIST_ENTRY(list_head(&server->conn_pool), netconn_t, pool_entry); + list_remove(&netconn->pool_entry); + + if(NETCON_is_alive(netconn)) + break; + + TRACE("connection %p closed during idle\n", netconn); + free_netconn(netconn); + netconn = NULL; + } + + LeaveCriticalSection(&connection_pool_cs); + + if(netconn) { + TRACE("<-- reusing %p netconn\n", netconn); + request->netconn = netconn; + *reusing = TRUE; + return ERROR_SUCCESS; + } + + INTERNET_SendCallback(&request->hdr, request->hdr.dwContext, + INTERNET_STATUS_CONNECTING_TO_SERVER, + server->addr_str, + strlen(server->addr_str)+1); + + res = create_netconn(is_https, server, request->security_flags, &netconn); + server_release(server); + if(res != ERROR_SUCCESS) { + ERR("create_netconn failed: %u\n", res); + return res; + } + + request->netconn = netconn; + + INTERNET_SendCallback(&request->hdr, request->hdr.dwContext, + INTERNET_STATUS_CONNECTED_TO_SERVER, + server->addr_str, strlen(server->addr_str)+1); + + if(is_https) { + /* Note: we differ from Microsoft's WinINet here. they seem to have + * a bug that causes no status callbacks to be sent when starting + * a tunnel to a proxy server using the CONNECT verb. i believe our + * behaviour to be more correct and to not cause any incompatibilities + * because using a secure connection through a proxy server is a rare + * case that would be hard for anyone to depend on */ + if(session->appInfo->proxy) + res = HTTP_SecureProxyConnect(request); + if(res == ERROR_SUCCESS) + res = NETCON_secure_connect(request->netconn, session->hostName); + if(res != ERROR_SUCCESS) + { + WARN("Couldn't connect securely to host\n"); + + if((request->hdr.ErrorMask&INTERNET_ERROR_MASK_COMBINED_SEC_CERT) && ( + res == ERROR_INTERNET_SEC_CERT_DATE_INVALID + || res == ERROR_INTERNET_INVALID_CA + || res == ERROR_INTERNET_SEC_CERT_NO_REV + || res == ERROR_INTERNET_SEC_CERT_REV_FAILED + || res == ERROR_INTERNET_SEC_CERT_REVOKED + || res == ERROR_INTERNET_SEC_INVALID_CERT + || res == ERROR_INTERNET_SEC_CERT_CN_INVALID)) + res = ERROR_INTERNET_SEC_CERT_ERRORS; + } + } + + if(res != ERROR_SUCCESS) { + http_release_netconn(request, FALSE); + return res; + } + + *reusing = FALSE; + TRACE("Created connection to %s: %p\n", debugstr_w(server->name), netconn); + return ERROR_SUCCESS; } /*********************************************************************** @@ -3597,11 +4540,11 @@ static void HTTP_InsertCookies(http_request_t *lpwhr) * Sends the specified request to the HTTP server * * RETURNS - * TRUE on success - * FALSE on failure + * ERROR_SUCCESS on success + * win32 error code on failure * */ -static DWORD HTTP_HttpSendRequestW(http_request_t *lpwhr, LPCWSTR lpszHeaders, +static DWORD HTTP_HttpSendRequestW(http_request_t *request, LPCWSTR lpszHeaders, DWORD dwHeaderLength, LPVOID lpOptional, DWORD dwOptionalLength, DWORD dwContentLength, BOOL bEndRequest) { @@ -3617,43 +4560,43 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *lpwhr, LPCWSTR lpszHeaders, WCHAR contentLengthStr[sizeof szContentLength/2 /* includes \r\n */ + 20 /* int */ ]; DWORD res; - TRACE("--> %p\n", lpwhr); + TRACE("--> %p\n", request); - assert(lpwhr->hdr.htype == WH_HHTTPREQ); + assert(request->hdr.htype == WH_HHTTPREQ); /* if the verb is NULL default to GET */ - if (!lpwhr->lpszVerb) - lpwhr->lpszVerb = heap_strdupW(szGET); + if (!request->verb) + request->verb = heap_strdupW(szGET); - if (dwContentLength || strcmpW(lpwhr->lpszVerb, szGET)) + if (dwContentLength || strcmpW(request->verb, szGET)) { sprintfW(contentLengthStr, szContentLength, dwContentLength); - HTTP_HttpAddRequestHeadersW(lpwhr, contentLengthStr, -1L, HTTP_ADDREQ_FLAG_REPLACE); - lpwhr->dwBytesToWrite = dwContentLength; + HTTP_HttpAddRequestHeadersW(request, contentLengthStr, -1L, HTTP_ADDREQ_FLAG_REPLACE); + request->bytesToWrite = dwContentLength; } - if (lpwhr->lpHttpSession->lpAppInfo->lpszAgent) + if (request->session->appInfo->agent) { WCHAR *agent_header; static const WCHAR user_agent[] = {'U','s','e','r','-','A','g','e','n','t',':',' ','%','s','\r','\n',0}; int len; - len = strlenW(lpwhr->lpHttpSession->lpAppInfo->lpszAgent) + strlenW(user_agent); - agent_header = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); - sprintfW(agent_header, user_agent, lpwhr->lpHttpSession->lpAppInfo->lpszAgent); + len = strlenW(request->session->appInfo->agent) + strlenW(user_agent); + agent_header = heap_alloc(len * sizeof(WCHAR)); + sprintfW(agent_header, user_agent, request->session->appInfo->agent); - HTTP_HttpAddRequestHeadersW(lpwhr, agent_header, strlenW(agent_header), HTTP_ADDREQ_FLAG_ADD_IF_NEW); + HTTP_HttpAddRequestHeadersW(request, agent_header, strlenW(agent_header), HTTP_ADDREQ_FLAG_ADD_IF_NEW); HeapFree(GetProcessHeap(), 0, agent_header); } - if (lpwhr->hdr.dwFlags & INTERNET_FLAG_PRAGMA_NOCACHE) + if (request->hdr.dwFlags & INTERNET_FLAG_PRAGMA_NOCACHE) { static const WCHAR pragma_nocache[] = {'P','r','a','g','m','a',':',' ','n','o','-','c','a','c','h','e','\r','\n',0}; - HTTP_HttpAddRequestHeadersW(lpwhr, pragma_nocache, strlenW(pragma_nocache), HTTP_ADDREQ_FLAG_ADD_IF_NEW); + HTTP_HttpAddRequestHeadersW(request, pragma_nocache, strlenW(pragma_nocache), HTTP_ADDREQ_FLAG_ADD_IF_NEW); } - if ((lpwhr->hdr.dwFlags & INTERNET_FLAG_NO_CACHE_WRITE) && !strcmpW(lpwhr->lpszVerb, szPost)) + if ((request->hdr.dwFlags & INTERNET_FLAG_NO_CACHE_WRITE) && !strcmpW(request->verb, szPost)) { static const WCHAR cache_control[] = {'C','a','c','h','e','-','C','o','n','t','r','o','l',':', ' ','n','o','-','c','a','c','h','e','\r','\n',0}; - HTTP_HttpAddRequestHeadersW(lpwhr, cache_control, strlenW(cache_control), HTTP_ADDREQ_FLAG_ADD_IF_NEW); + HTTP_HttpAddRequestHeadersW(request, cache_control, strlenW(cache_control), HTTP_ADDREQ_FLAG_ADD_IF_NEW); } do @@ -3666,64 +4609,57 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *lpwhr, LPCWSTR lpszHeaders, /* like native, just in case the caller forgot to call InternetReadFile * for all the data */ - HTTP_DrainContent(lpwhr); - lpwhr->dwContentRead = 0; + drain_content(request); if(redirected) { - lpwhr->dwContentLength = ~0u; - lpwhr->dwBytesToWrite = 0; + request->contentLength = ~0u; + request->bytesToWrite = 0; } if (TRACE_ON(wininet)) { - LPHTTPHEADERW Host = HTTP_GetHeader(lpwhr, hostW); - TRACE("Going to url %s %s\n", debugstr_w(Host->lpszValue), debugstr_w(lpwhr->lpszPath)); + LPHTTPHEADERW Host = HTTP_GetHeader(request, hostW); + TRACE("Going to url %s %s\n", debugstr_w(Host->lpszValue), debugstr_w(request->path)); } - HTTP_FixURL(lpwhr); - if (lpwhr->hdr.dwFlags & INTERNET_FLAG_KEEP_CONNECTION) + HTTP_FixURL(request); + if (request->hdr.dwFlags & INTERNET_FLAG_KEEP_CONNECTION) { - HTTP_ProcessHeader(lpwhr, szConnection, szKeepAlive, HTTP_ADDHDR_FLAG_REQ | HTTP_ADDHDR_FLAG_REPLACE); + HTTP_ProcessHeader(request, szConnection, szKeepAlive, HTTP_ADDHDR_FLAG_REQ | HTTP_ADDHDR_FLAG_REPLACE); } - HTTP_InsertAuthorization(lpwhr, lpwhr->pAuthInfo, szAuthorization); - HTTP_InsertAuthorization(lpwhr, lpwhr->pProxyAuthInfo, szProxy_Authorization); + HTTP_InsertAuthorization(request, request->authInfo, szAuthorization); + HTTP_InsertAuthorization(request, request->proxyAuthInfo, szProxy_Authorization); - if (!(lpwhr->hdr.dwFlags & INTERNET_FLAG_NO_COOKIES)) - HTTP_InsertCookies(lpwhr); + if (!(request->hdr.dwFlags & INTERNET_FLAG_NO_COOKIES)) + HTTP_InsertCookies(request); /* add the headers the caller supplied */ if( lpszHeaders && dwHeaderLength ) { - HTTP_HttpAddRequestHeadersW(lpwhr, lpszHeaders, dwHeaderLength, + HTTP_HttpAddRequestHeadersW(request, lpszHeaders, dwHeaderLength, HTTP_ADDREQ_FLAG_ADD | HTTP_ADDHDR_FLAG_REPLACE); } - if (lpwhr->lpHttpSession->lpAppInfo->lpszProxy && lpwhr->lpHttpSession->lpAppInfo->lpszProxy[0]) + if (request->session->appInfo->proxy && request->session->appInfo->proxy[0]) { - WCHAR *url = HTTP_BuildProxyRequestUrl(lpwhr); - requestString = HTTP_BuildHeaderRequestString(lpwhr, lpwhr->lpszVerb, url, lpwhr->lpszVersion); + WCHAR *url = HTTP_BuildProxyRequestUrl(request); + requestString = HTTP_BuildHeaderRequestString(request, request->verb, url, request->version); HeapFree(GetProcessHeap(), 0, url); } else - requestString = HTTP_BuildHeaderRequestString(lpwhr, lpwhr->lpszVerb, lpwhr->lpszPath, lpwhr->lpszVersion); + requestString = HTTP_BuildHeaderRequestString(request, request->verb, request->path, request->version); TRACE("Request header -> %s\n", debugstr_w(requestString) ); - /* Send the request and store the results */ - if(NETCON_connected(&lpwhr->netConnection)) - reusing_connection = TRUE; - else - reusing_connection = FALSE; - - if ((res = HTTP_OpenConnection(lpwhr)) != ERROR_SUCCESS) - goto lend; + if ((res = open_http_connection(request, &reusing_connection)) != ERROR_SUCCESS) + break; /* send the request as ASCII, tack on the optional data */ if (!lpOptional || redirected) dwOptionalLength = 0; len = WideCharToMultiByte( CP_ACP, 0, requestString, -1, NULL, 0, NULL, NULL ); - ascii_req = HeapAlloc( GetProcessHeap(), 0, len + dwOptionalLength ); + ascii_req = heap_alloc(len + dwOptionalLength); WideCharToMultiByte( CP_ACP, 0, requestString, -1, ascii_req, len, NULL, NULL ); if( lpOptional ) @@ -3732,15 +4668,23 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *lpwhr, LPCWSTR lpszHeaders, ascii_req[len] = 0; TRACE("full request -> %s\n", debugstr_a(ascii_req) ); - INTERNET_SendCallback(&lpwhr->hdr, lpwhr->hdr.dwContext, + INTERNET_SendCallback(&request->hdr, request->hdr.dwContext, INTERNET_STATUS_SENDING_REQUEST, NULL, 0); - res = NETCON_send(&lpwhr->netConnection, ascii_req, len, 0, &cnt); + res = NETCON_send(request->netconn, ascii_req, len, 0, &cnt); HeapFree( GetProcessHeap(), 0, ascii_req ); + if(res != ERROR_SUCCESS) { + TRACE("send failed: %u\n", res); + if(!reusing_connection) + break; + http_release_netconn(request, FALSE); + loop_next = TRUE; + continue; + } - lpwhr->dwBytesWritten = dwOptionalLength; + request->bytesWritten = dwOptionalLength; - INTERNET_SendCallback(&lpwhr->hdr, lpwhr->hdr.dwContext, + INTERNET_SendCallback(&request->hdr, request->hdr.dwContext, INTERNET_STATUS_REQUEST_SENT, &len, sizeof(DWORD)); @@ -3749,54 +4693,60 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *lpwhr, LPCWSTR lpszHeaders, DWORD dwBufferSize; DWORD dwStatusCode; - INTERNET_SendCallback(&lpwhr->hdr, lpwhr->hdr.dwContext, + INTERNET_SendCallback(&request->hdr, request->hdr.dwContext, INTERNET_STATUS_RECEIVING_RESPONSE, NULL, 0); - if (res != ERROR_SUCCESS) - goto lend; - - responseLen = HTTP_GetResponseHeaders(lpwhr, TRUE); + responseLen = HTTP_GetResponseHeaders(request, TRUE); /* FIXME: We should know that connection is closed before sending * headers. Otherwise wrong callbacks are executed */ if(!responseLen && reusing_connection) { TRACE("Connection closed by server, reconnecting\n"); + http_release_netconn(request, FALSE); loop_next = TRUE; continue; } - - INTERNET_SendCallback(&lpwhr->hdr, lpwhr->hdr.dwContext, + + INTERNET_SendCallback(&request->hdr, request->hdr.dwContext, INTERNET_STATUS_RESPONSE_RECEIVED, &responseLen, sizeof(DWORD)); - HTTP_ProcessCookies(lpwhr); - - if (!set_content_length( lpwhr )) HTTP_FinishedReading(lpwhr); + http_process_keep_alive(request); + HTTP_ProcessCookies(request); + HTTP_ProcessExpires(request); + HTTP_ProcessLastModified(request); dwBufferSize = sizeof(dwStatusCode); - if (HTTP_HttpQueryInfoW(lpwhr,HTTP_QUERY_FLAG_NUMBER|HTTP_QUERY_STATUS_CODE, + if (HTTP_HttpQueryInfoW(request,HTTP_QUERY_FLAG_NUMBER|HTTP_QUERY_STATUS_CODE, &dwStatusCode,&dwBufferSize,NULL) != ERROR_SUCCESS) dwStatusCode = 0; - if (!(lpwhr->hdr.dwFlags & INTERNET_FLAG_NO_AUTO_REDIRECT) && responseLen) + res = set_content_length(request, dwStatusCode); + if(res != ERROR_SUCCESS) + goto lend; + if(!request->contentLength) + http_release_netconn(request, TRUE); + + if (!(request->hdr.dwFlags & INTERNET_FLAG_NO_AUTO_REDIRECT) && responseLen) { WCHAR *new_url, szNewLocation[INTERNET_MAX_URL_LENGTH]; dwBufferSize=sizeof(szNewLocation); if ((dwStatusCode == HTTP_STATUS_REDIRECT || dwStatusCode == HTTP_STATUS_MOVED || + dwStatusCode == HTTP_STATUS_REDIRECT_KEEP_VERB || dwStatusCode == HTTP_STATUS_REDIRECT_METHOD) && - HTTP_HttpQueryInfoW(lpwhr,HTTP_QUERY_LOCATION,szNewLocation,&dwBufferSize,NULL) == ERROR_SUCCESS) + HTTP_HttpQueryInfoW(request,HTTP_QUERY_LOCATION,szNewLocation,&dwBufferSize,NULL) == ERROR_SUCCESS) { - if (strcmpW(lpwhr->lpszVerb, szGET) && strcmpW(lpwhr->lpszVerb, szHEAD)) + if (strcmpW(request->verb, szGET) && strcmpW(request->verb, szHEAD)) { - HeapFree(GetProcessHeap(), 0, lpwhr->lpszVerb); - lpwhr->lpszVerb = heap_strdupW(szGET); + HeapFree(GetProcessHeap(), 0, request->verb); + request->verb = heap_strdupW(szGET); } - HTTP_DrainContent(lpwhr); - if ((new_url = HTTP_GetRedirectURL( lpwhr, szNewLocation ))) + drain_content(request); + if ((new_url = HTTP_GetRedirectURL( request, szNewLocation ))) { - INTERNET_SendCallback(&lpwhr->hdr, lpwhr->hdr.dwContext, INTERNET_STATUS_REDIRECT, + INTERNET_SendCallback(&request->hdr, request->hdr.dwContext, INTERNET_STATUS_REDIRECT, new_url, (strlenW(new_url) + 1) * sizeof(WCHAR)); - res = HTTP_HandleRedirect(lpwhr, new_url); + res = HTTP_HandleRedirect(request, new_url); if (res == ERROR_SUCCESS) { HeapFree(GetProcessHeap(), 0, requestString); @@ -3807,20 +4757,20 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *lpwhr, LPCWSTR lpszHeaders, redirected = TRUE; } } - if (!(lpwhr->hdr.dwFlags & INTERNET_FLAG_NO_AUTH) && res == ERROR_SUCCESS) + if (!(request->hdr.dwFlags & INTERNET_FLAG_NO_AUTH) && res == ERROR_SUCCESS) { WCHAR szAuthValue[2048]; dwBufferSize=2048; if (dwStatusCode == HTTP_STATUS_DENIED) { - LPHTTPHEADERW Host = HTTP_GetHeader(lpwhr, hostW); + LPHTTPHEADERW Host = HTTP_GetHeader(request, hostW); DWORD dwIndex = 0; - while (HTTP_HttpQueryInfoW(lpwhr,HTTP_QUERY_WWW_AUTHENTICATE,szAuthValue,&dwBufferSize,&dwIndex) == ERROR_SUCCESS) + while (HTTP_HttpQueryInfoW(request,HTTP_QUERY_WWW_AUTHENTICATE,szAuthValue,&dwBufferSize,&dwIndex) == ERROR_SUCCESS) { - if (HTTP_DoAuthorization(lpwhr, szAuthValue, - &lpwhr->pAuthInfo, - lpwhr->lpHttpSession->lpszUserName, - lpwhr->lpHttpSession->lpszPassword, + if (HTTP_DoAuthorization(request, szAuthValue, + &request->authInfo, + request->session->userName, + request->session->password, Host->lpszValue)) { HeapFree(GetProcessHeap(), 0, requestString); @@ -3831,19 +4781,19 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *lpwhr, LPCWSTR lpszHeaders, if(!loop_next) { TRACE("Cleaning wrong authorization data\n"); - destroy_authinfo(lpwhr->pAuthInfo); - lpwhr->pAuthInfo = NULL; + destroy_authinfo(request->authInfo); + request->authInfo = NULL; } } if (dwStatusCode == HTTP_STATUS_PROXY_AUTH_REQ) { DWORD dwIndex = 0; - while (HTTP_HttpQueryInfoW(lpwhr,HTTP_QUERY_PROXY_AUTHENTICATE,szAuthValue,&dwBufferSize,&dwIndex) == ERROR_SUCCESS) + while (HTTP_HttpQueryInfoW(request,HTTP_QUERY_PROXY_AUTHENTICATE,szAuthValue,&dwBufferSize,&dwIndex) == ERROR_SUCCESS) { - if (HTTP_DoAuthorization(lpwhr, szAuthValue, - &lpwhr->pProxyAuthInfo, - lpwhr->lpHttpSession->lpAppInfo->lpszProxyUsername, - lpwhr->lpHttpSession->lpAppInfo->lpszProxyPassword, + if (HTTP_DoAuthorization(request, szAuthValue, + &request->proxyAuthInfo, + request->session->appInfo->proxyUsername, + request->session->appInfo->proxyPassword, NULL)) { loop_next = TRUE; @@ -3853,8 +4803,8 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *lpwhr, LPCWSTR lpszHeaders, if(!loop_next) { TRACE("Cleaning wrong proxy authorization data\n"); - destroy_authinfo(lpwhr->pProxyAuthInfo); - lpwhr->pProxyAuthInfo = NULL; + destroy_authinfo(request->proxyAuthInfo); + request->proxyAuthInfo = NULL; } } } @@ -3864,33 +4814,8 @@ static DWORD HTTP_HttpSendRequestW(http_request_t *lpwhr, LPCWSTR lpszHeaders, } while (loop_next); - if(res == ERROR_SUCCESS) { - WCHAR url[INTERNET_MAX_URL_LENGTH]; - WCHAR cacheFileName[MAX_PATH+1]; - BOOL b; - - b = HTTP_GetRequestURL(lpwhr, url); - if(!b) { - WARN("Could not get URL\n"); - goto lend; - } - - b = CreateUrlCacheEntryW(url, lpwhr->dwContentLength > 0 ? lpwhr->dwContentLength : 0, NULL, cacheFileName, 0); - if(b) { - HeapFree(GetProcessHeap(), 0, lpwhr->lpszCacheFile); - CloseHandle(lpwhr->hCacheFile); - - lpwhr->lpszCacheFile = heap_strdupW(cacheFileName); - lpwhr->hCacheFile = CreateFileW(lpwhr->lpszCacheFile, GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, - NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - if(lpwhr->hCacheFile == INVALID_HANDLE_VALUE) { - WARN("Could not create file: %u\n", GetLastError()); - lpwhr->hCacheFile = NULL; - } - }else { - WARN("Could not create cache entry: %08x\n", GetLastError()); - } - } + if(res == ERROR_SUCCESS) + HTTP_CacheRequest(request); lend: @@ -3898,16 +4823,16 @@ lend: /* TODO: send notification for P3P header */ - if (lpwhr->lpHttpSession->lpAppInfo->hdr.dwFlags & INTERNET_FLAG_ASYNC) + if (request->session->appInfo->hdr.dwFlags & INTERNET_FLAG_ASYNC) { - if (res == ERROR_SUCCESS && lpwhr->dwBytesWritten == lpwhr->dwBytesToWrite) - HTTP_ReceiveRequestData(lpwhr, TRUE); + if (res == ERROR_SUCCESS && request->contentLength && request->bytesWritten == request->bytesToWrite) + HTTP_ReceiveRequestData(request, TRUE); else { - iar.dwResult = (res==ERROR_SUCCESS ? (DWORD_PTR)lpwhr->hdr.hInternet : 0); + iar.dwResult = (res==ERROR_SUCCESS ? (DWORD_PTR)request->hdr.hInternet : 0); iar.dwError = res; - INTERNET_SendCallback(&lpwhr->hdr, lpwhr->hdr.dwContext, + INTERNET_SendCallback(&request->hdr, request->hdr.dwContext, INTERNET_STATUS_REQUEST_COMPLETE, &iar, sizeof(INTERNET_ASYNC_RESULT)); } @@ -3925,11 +4850,11 @@ lend: static void AsyncHttpSendRequestProc(WORKREQUEST *workRequest) { struct WORKREQ_HTTPSENDREQUESTW const *req = &workRequest->u.HttpSendRequestW; - http_request_t *lpwhr = (http_request_t*) workRequest->hdr; + http_request_t *request = (http_request_t*) workRequest->hdr; - TRACE("%p\n", lpwhr); + TRACE("%p\n", request); - HTTP_HttpSendRequestW(lpwhr, req->lpszHeader, + HTTP_HttpSendRequestW(request, req->lpszHeader, req->dwHeaderLength, req->lpOptional, req->dwOptionalLength, req->dwContentLength, req->bEndRequest); @@ -3937,63 +4862,79 @@ static void AsyncHttpSendRequestProc(WORKREQUEST *workRequest) } -static DWORD HTTP_HttpEndRequestW(http_request_t *lpwhr, DWORD dwFlags, DWORD_PTR dwContext) +static DWORD HTTP_HttpEndRequestW(http_request_t *request, DWORD dwFlags, DWORD_PTR dwContext) { INT responseLen; + DWORD dwCode, dwCodeLength; DWORD dwBufferSize; - INTERNET_ASYNC_RESULT iar; DWORD res = ERROR_SUCCESS; - INTERNET_SendCallback(&lpwhr->hdr, lpwhr->hdr.dwContext, + INTERNET_SendCallback(&request->hdr, request->hdr.dwContext, INTERNET_STATUS_RECEIVING_RESPONSE, NULL, 0); - responseLen = HTTP_GetResponseHeaders(lpwhr, TRUE); + responseLen = HTTP_GetResponseHeaders(request, TRUE); if (!responseLen) res = ERROR_HTTP_HEADER_NOT_FOUND; - INTERNET_SendCallback(&lpwhr->hdr, lpwhr->hdr.dwContext, + INTERNET_SendCallback(&request->hdr, request->hdr.dwContext, INTERNET_STATUS_RESPONSE_RECEIVED, &responseLen, sizeof(DWORD)); /* process cookies here. Is this right? */ - HTTP_ProcessCookies(lpwhr); + http_process_keep_alive(request); + HTTP_ProcessCookies(request); + HTTP_ProcessExpires(request); + HTTP_ProcessLastModified(request); - if (!set_content_length( lpwhr )) HTTP_FinishedReading(lpwhr); + dwCodeLength = sizeof(dwCode); + if (HTTP_HttpQueryInfoW(request,HTTP_QUERY_FLAG_NUMBER|HTTP_QUERY_STATUS_CODE, + &dwCode,&dwCodeLength,NULL) != ERROR_SUCCESS) + dwCode = 0; - if (!(lpwhr->hdr.dwFlags & INTERNET_FLAG_NO_AUTO_REDIRECT)) + if ((res = set_content_length( request, dwCode )) == ERROR_SUCCESS) { + if(!request->contentLength) + http_release_netconn(request, TRUE); + } + + if (res == ERROR_SUCCESS && !(request->hdr.dwFlags & INTERNET_FLAG_NO_AUTO_REDIRECT)) { - DWORD dwCode,dwCodeLength = sizeof(DWORD); - if (HTTP_HttpQueryInfoW(lpwhr, HTTP_QUERY_FLAG_NUMBER|HTTP_QUERY_STATUS_CODE, &dwCode, &dwCodeLength, NULL) == ERROR_SUCCESS - && (dwCode == 302 || dwCode == 301 || dwCode == 303)) + if (dwCode == HTTP_STATUS_REDIRECT || + dwCode == HTTP_STATUS_MOVED || + dwCode == HTTP_STATUS_REDIRECT_METHOD || + dwCode == HTTP_STATUS_REDIRECT_KEEP_VERB) { WCHAR *new_url, szNewLocation[INTERNET_MAX_URL_LENGTH]; dwBufferSize=sizeof(szNewLocation); - if (HTTP_HttpQueryInfoW(lpwhr, HTTP_QUERY_LOCATION, szNewLocation, &dwBufferSize, NULL) == ERROR_SUCCESS) + if (HTTP_HttpQueryInfoW(request, HTTP_QUERY_LOCATION, szNewLocation, &dwBufferSize, NULL) == ERROR_SUCCESS) { - if (strcmpW(lpwhr->lpszVerb, szGET) && strcmpW(lpwhr->lpszVerb, szHEAD)) + if (strcmpW(request->verb, szGET) && strcmpW(request->verb, szHEAD)) { - HeapFree(GetProcessHeap(), 0, lpwhr->lpszVerb); - lpwhr->lpszVerb = heap_strdupW(szGET); + HeapFree(GetProcessHeap(), 0, request->verb); + request->verb = heap_strdupW(szGET); } - HTTP_DrainContent(lpwhr); - if ((new_url = HTTP_GetRedirectURL( lpwhr, szNewLocation ))) + drain_content(request); + if ((new_url = HTTP_GetRedirectURL( request, szNewLocation ))) { - INTERNET_SendCallback(&lpwhr->hdr, lpwhr->hdr.dwContext, INTERNET_STATUS_REDIRECT, + INTERNET_SendCallback(&request->hdr, request->hdr.dwContext, INTERNET_STATUS_REDIRECT, new_url, (strlenW(new_url) + 1) * sizeof(WCHAR)); - res = HTTP_HandleRedirect(lpwhr, new_url); + res = HTTP_HandleRedirect(request, new_url); if (res == ERROR_SUCCESS) - res = HTTP_HttpSendRequestW(lpwhr, NULL, 0, NULL, 0, 0, TRUE); + res = HTTP_HttpSendRequestW(request, NULL, 0, NULL, 0, 0, TRUE); HeapFree( GetProcessHeap(), 0, new_url ); } } } } - iar.dwResult = (res==ERROR_SUCCESS ? (DWORD_PTR)lpwhr->hdr.hInternet : 0); - iar.dwError = res; + if (res == ERROR_SUCCESS && request->contentLength) { + HTTP_ReceiveRequestData(request, TRUE); + }else { + INTERNET_ASYNC_RESULT iar = {0, res}; + + INTERNET_SendCallback(&request->hdr, request->hdr.dwContext, + INTERNET_STATUS_REQUEST_COMPLETE, &iar, + sizeof(INTERNET_ASYNC_RESULT)); + } - INTERNET_SendCallback(&lpwhr->hdr, lpwhr->hdr.dwContext, - INTERNET_STATUS_REQUEST_COMPLETE, &iar, - sizeof(INTERNET_ASYNC_RESULT)); return res; } @@ -4024,11 +4965,11 @@ BOOL WINAPI HttpEndRequestA(HINTERNET hRequest, static void AsyncHttpEndRequestProc(WORKREQUEST *work) { struct WORKREQ_HTTPENDREQUESTW const *req = &work->u.HttpEndRequestW; - http_request_t *lpwhr = (http_request_t*)work->hdr; + http_request_t *request = (http_request_t*)work->hdr; - TRACE("%p\n", lpwhr); + TRACE("%p\n", request); - HTTP_HttpEndRequestW(lpwhr, req->dwFlags, req->dwContext); + HTTP_HttpEndRequestW(request, req->dwFlags, req->dwContext); } /*********************************************************************** @@ -4044,7 +4985,7 @@ static void AsyncHttpEndRequestProc(WORKREQUEST *work) BOOL WINAPI HttpEndRequestW(HINTERNET hRequest, LPINTERNET_BUFFERSW lpBuffersOut, DWORD dwFlags, DWORD_PTR dwContext) { - http_request_t *lpwhr; + http_request_t *request; DWORD res; TRACE("-->\n"); @@ -4055,36 +4996,36 @@ BOOL WINAPI HttpEndRequestW(HINTERNET hRequest, return FALSE; } - lpwhr = (http_request_t*) WININET_GetObject( hRequest ); + request = (http_request_t*) get_handle_object( hRequest ); - if (NULL == lpwhr || lpwhr->hdr.htype != WH_HHTTPREQ) + if (NULL == request || request->hdr.htype != WH_HHTTPREQ) { SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE); - if (lpwhr) - WININET_Release( &lpwhr->hdr ); + if (request) + WININET_Release( &request->hdr ); return FALSE; } - lpwhr->hdr.dwFlags |= dwFlags; + request->hdr.dwFlags |= dwFlags; - if (lpwhr->lpHttpSession->lpAppInfo->hdr.dwFlags & INTERNET_FLAG_ASYNC) + if (request->session->appInfo->hdr.dwFlags & INTERNET_FLAG_ASYNC) { WORKREQUEST work; - struct WORKREQ_HTTPENDREQUESTW *request; + struct WORKREQ_HTTPENDREQUESTW *work_endrequest; work.asyncproc = AsyncHttpEndRequestProc; - work.hdr = WININET_AddRef( &lpwhr->hdr ); + work.hdr = WININET_AddRef( &request->hdr ); - request = &work.u.HttpEndRequestW; - request->dwFlags = dwFlags; - request->dwContext = dwContext; + work_endrequest = &work.u.HttpEndRequestW; + work_endrequest->dwFlags = dwFlags; + work_endrequest->dwContext = dwContext; INTERNET_AsyncCall(&work); res = ERROR_IO_PENDING; } else - res = HTTP_HttpEndRequestW(lpwhr, dwFlags, dwContext); + res = HTTP_HttpEndRequestW(request, dwFlags, dwContext); - WININET_Release( &lpwhr->hdr ); + WININET_Release( &request->hdr ); TRACE("%u <--\n", res); if(res != ERROR_SUCCESS) SetLastError(res); @@ -4121,7 +5062,7 @@ BOOL WINAPI HttpSendRequestExA(HINTERNET hRequest, { headerlen = MultiByteToWideChar(CP_ACP,0,lpBuffersIn->lpcszHeader, lpBuffersIn->dwHeadersLength,0,0); - header = HeapAlloc(GetProcessHeap(),0,headerlen*sizeof(WCHAR)); + header = heap_alloc(headerlen*sizeof(WCHAR)); if (!(BuffersInW.lpcszHeader = header)) { SetLastError(ERROR_OUTOFMEMORY); @@ -4162,25 +5103,25 @@ BOOL WINAPI HttpSendRequestExW(HINTERNET hRequest, LPINTERNET_BUFFERSW lpBuffersOut, DWORD dwFlags, DWORD_PTR dwContext) { - http_request_t *lpwhr; - http_session_t *lpwhs; + http_request_t *request; + http_session_t *session; appinfo_t *hIC; DWORD res; TRACE("(%p, %p, %p, %08x, %08lx)\n", hRequest, lpBuffersIn, lpBuffersOut, dwFlags, dwContext); - lpwhr = (http_request_t*) WININET_GetObject( hRequest ); + request = (http_request_t*) get_handle_object( hRequest ); - if (NULL == lpwhr || lpwhr->hdr.htype != WH_HHTTPREQ) + if (NULL == request || request->hdr.htype != WH_HHTTPREQ) { res = ERROR_INTERNET_INCORRECT_HANDLE_TYPE; goto lend; } - lpwhs = lpwhr->lpHttpSession; - assert(lpwhs->hdr.htype == WH_HHTTPSESSION); - hIC = lpwhs->lpAppInfo; + session = request->session; + assert(session->hdr.htype == WH_HHTTPSESSION); + hIC = session->appInfo; assert(hIC->hdr.htype == WH_HINIT); if (hIC->hdr.dwFlags & INTERNET_FLAG_ASYNC) @@ -4189,7 +5130,7 @@ BOOL WINAPI HttpSendRequestExW(HINTERNET hRequest, struct WORKREQ_HTTPSENDREQUESTW *req; workRequest.asyncproc = AsyncHttpSendRequestProc; - workRequest.hdr = WININET_AddRef( &lpwhr->hdr ); + workRequest.hdr = WININET_AddRef( &request->hdr ); req = &workRequest.u.HttpSendRequestW; if (lpBuffersIn) { @@ -4202,7 +5143,7 @@ BOOL WINAPI HttpSendRequestExW(HINTERNET hRequest, else size = lpBuffersIn->dwHeadersLength * sizeof(WCHAR); - req->lpszHeader = HeapAlloc( GetProcessHeap(), 0, size ); + req->lpszHeader = heap_alloc(size); memcpy( req->lpszHeader, lpBuffersIn->lpcszHeader, size ); } else req->lpszHeader = NULL; @@ -4232,16 +5173,16 @@ BOOL WINAPI HttpSendRequestExW(HINTERNET hRequest, else { if (lpBuffersIn) - res = HTTP_HttpSendRequestW(lpwhr, lpBuffersIn->lpcszHeader, lpBuffersIn->dwHeadersLength, + res = HTTP_HttpSendRequestW(request, lpBuffersIn->lpcszHeader, lpBuffersIn->dwHeadersLength, lpBuffersIn->lpvBuffer, lpBuffersIn->dwBufferLength, lpBuffersIn->dwBufferTotal, FALSE); else - res = HTTP_HttpSendRequestW(lpwhr, NULL, 0, NULL, 0, 0, FALSE); + res = HTTP_HttpSendRequestW(request, NULL, 0, NULL, 0, 0, FALSE); } lend: - if ( lpwhr ) - WININET_Release( &lpwhr->hdr ); + if ( request ) + WININET_Release( &request->hdr ); TRACE("<---\n"); SetLastError(res); @@ -4261,29 +5202,29 @@ lend: BOOL WINAPI HttpSendRequestW(HINTERNET hHttpRequest, LPCWSTR lpszHeaders, DWORD dwHeaderLength, LPVOID lpOptional ,DWORD dwOptionalLength) { - http_request_t *lpwhr; - http_session_t *lpwhs = NULL; + http_request_t *request; + http_session_t *session = NULL; appinfo_t *hIC = NULL; DWORD res = ERROR_SUCCESS; TRACE("%p, %s, %i, %p, %i)\n", hHttpRequest, debugstr_wn(lpszHeaders, dwHeaderLength), dwHeaderLength, lpOptional, dwOptionalLength); - lpwhr = (http_request_t*) WININET_GetObject( hHttpRequest ); - if (NULL == lpwhr || lpwhr->hdr.htype != WH_HHTTPREQ) + request = (http_request_t*) get_handle_object( hHttpRequest ); + if (NULL == request || request->hdr.htype != WH_HHTTPREQ) { res = ERROR_INTERNET_INCORRECT_HANDLE_TYPE; goto lend; } - lpwhs = lpwhr->lpHttpSession; - if (NULL == lpwhs || lpwhs->hdr.htype != WH_HHTTPSESSION) + session = request->session; + if (NULL == session || session->hdr.htype != WH_HHTTPSESSION) { res = ERROR_INTERNET_INCORRECT_HANDLE_TYPE; goto lend; } - hIC = lpwhs->lpAppInfo; + hIC = session->appInfo; if (NULL == hIC || hIC->hdr.htype != WH_HINIT) { res = ERROR_INTERNET_INCORRECT_HANDLE_TYPE; @@ -4296,7 +5237,7 @@ BOOL WINAPI HttpSendRequestW(HINTERNET hHttpRequest, LPCWSTR lpszHeaders, struct WORKREQ_HTTPSENDREQUESTW *req; workRequest.asyncproc = AsyncHttpSendRequestProc; - workRequest.hdr = WININET_AddRef( &lpwhr->hdr ); + workRequest.hdr = WININET_AddRef( &request->hdr ); req = &workRequest.u.HttpSendRequestW; if (lpszHeaders) { @@ -4305,7 +5246,7 @@ BOOL WINAPI HttpSendRequestW(HINTERNET hHttpRequest, LPCWSTR lpszHeaders, if (dwHeaderLength == ~0u) size = (strlenW(lpszHeaders) + 1) * sizeof(WCHAR); else size = dwHeaderLength * sizeof(WCHAR); - req->lpszHeader = HeapAlloc(GetProcessHeap(), 0, size); + req->lpszHeader = heap_alloc(size); memcpy(req->lpszHeader, lpszHeaders, size); } else @@ -4324,13 +5265,13 @@ BOOL WINAPI HttpSendRequestW(HINTERNET hHttpRequest, LPCWSTR lpszHeaders, } else { - res = HTTP_HttpSendRequestW(lpwhr, lpszHeaders, + res = HTTP_HttpSendRequestW(request, lpszHeaders, dwHeaderLength, lpOptional, dwOptionalLength, dwOptionalLength, TRUE); } lend: - if( lpwhr ) - WININET_Release( &lpwhr->hdr ); + if( request ) + WININET_Release( &request->hdr ); SetLastError(res); return res == ERROR_SUCCESS; @@ -4355,7 +5296,7 @@ BOOL WINAPI HttpSendRequestA(HINTERNET hHttpRequest, LPCSTR lpszHeaders, if(lpszHeaders!=NULL) { nLen=MultiByteToWideChar(CP_ACP,0,lpszHeaders,dwHeaderLength,NULL,0); - szHeaders=HeapAlloc(GetProcessHeap(),0,nLen*sizeof(WCHAR)); + szHeaders = heap_alloc(nLen*sizeof(WCHAR)); MultiByteToWideChar(CP_ACP,0,lpszHeaders,dwHeaderLength,szHeaders,nLen); } result=HttpSendRequestW(hHttpRequest, szHeaders, nLen, lpOptional, dwOptionalLength); @@ -4371,17 +5312,16 @@ BOOL WINAPI HttpSendRequestA(HINTERNET hHttpRequest, LPCSTR lpszHeaders, */ static void HTTPSESSION_Destroy(object_header_t *hdr) { - http_session_t *lpwhs = (http_session_t*) hdr; + http_session_t *session = (http_session_t*) hdr; - TRACE("%p\n", lpwhs); + TRACE("%p\n", session); - WININET_Release(&lpwhs->lpAppInfo->hdr); + WININET_Release(&session->appInfo->hdr); - HeapFree(GetProcessHeap(), 0, lpwhs->lpszHostName); - HeapFree(GetProcessHeap(), 0, lpwhs->lpszServerName); - HeapFree(GetProcessHeap(), 0, lpwhs->lpszPassword); - HeapFree(GetProcessHeap(), 0, lpwhs->lpszUserName); - HeapFree(GetProcessHeap(), 0, lpwhs); + HeapFree(GetProcessHeap(), 0, session->hostName); + HeapFree(GetProcessHeap(), 0, session->serverName); + HeapFree(GetProcessHeap(), 0, session->password); + HeapFree(GetProcessHeap(), 0, session->userName); } static DWORD HTTPSESSION_QueryOption(object_header_t *hdr, DWORD option, void *buffer, DWORD *size, BOOL unicode) @@ -4408,14 +5348,14 @@ static DWORD HTTPSESSION_SetOption(object_header_t *hdr, DWORD option, void *buf switch(option) { case INTERNET_OPTION_USERNAME: { - HeapFree(GetProcessHeap(), 0, ses->lpszUserName); - if (!(ses->lpszUserName = heap_strdupW(buffer))) return ERROR_OUTOFMEMORY; + HeapFree(GetProcessHeap(), 0, ses->userName); + if (!(ses->userName = heap_strdupW(buffer))) return ERROR_OUTOFMEMORY; return ERROR_SUCCESS; } case INTERNET_OPTION_PASSWORD: { - HeapFree(GetProcessHeap(), 0, ses->lpszPassword); - if (!(ses->lpszPassword = heap_strdupW(buffer))) return ERROR_OUTOFMEMORY; + HeapFree(GetProcessHeap(), 0, ses->password); + if (!(ses->password = heap_strdupW(buffer))) return ERROR_OUTOFMEMORY; return ERROR_SUCCESS; } default: break; @@ -4448,13 +5388,11 @@ static const object_vtbl_t HTTPSESSIONVtbl = { * */ DWORD HTTP_Connect(appinfo_t *hIC, LPCWSTR lpszServerName, - INTERNET_PORT nServerPort, LPCWSTR lpszUserName, + INTERNET_PORT serverPort, LPCWSTR lpszUserName, LPCWSTR lpszPassword, DWORD dwFlags, DWORD_PTR dwContext, DWORD dwInternalFlags, HINTERNET *ret) { - http_session_t *lpwhs = NULL; - HINTERNET handle = NULL; - DWORD res = ERROR_SUCCESS; + http_session_t *session = NULL; TRACE("-->\n"); @@ -4463,201 +5401,73 @@ DWORD HTTP_Connect(appinfo_t *hIC, LPCWSTR lpszServerName, assert( hIC->hdr.htype == WH_HINIT ); - lpwhs = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(http_session_t)); - if (!lpwhs) + session = alloc_object(&hIC->hdr, &HTTPSESSIONVtbl, sizeof(http_session_t)); + if (!session) return ERROR_OUTOFMEMORY; /* * According to my tests. The name is not resolved until a request is sent */ - lpwhs->hdr.htype = WH_HHTTPSESSION; - lpwhs->hdr.vtbl = &HTTPSESSIONVtbl; - lpwhs->hdr.dwFlags = dwFlags; - lpwhs->hdr.dwContext = dwContext; - lpwhs->hdr.dwInternalFlags = dwInternalFlags | (hIC->hdr.dwInternalFlags & INET_CALLBACKW); - lpwhs->hdr.refs = 1; - lpwhs->hdr.lpfnStatusCB = hIC->hdr.lpfnStatusCB; + session->hdr.htype = WH_HHTTPSESSION; + session->hdr.dwFlags = dwFlags; + session->hdr.dwContext = dwContext; + session->hdr.dwInternalFlags |= dwInternalFlags; WININET_AddRef( &hIC->hdr ); - lpwhs->lpAppInfo = hIC; - list_add_head( &hIC->hdr.children, &lpwhs->hdr.entry ); + session->appInfo = hIC; + list_add_head( &hIC->hdr.children, &session->hdr.entry ); - handle = WININET_AllocHandle( &lpwhs->hdr ); - if (NULL == handle) - { - ERR("Failed to alloc handle\n"); - res = ERROR_OUTOFMEMORY; - goto lerror; - } - - if(hIC->lpszProxy && hIC->dwAccessType == INTERNET_OPEN_TYPE_PROXY) { - if(hIC->lpszProxyBypass) + if(hIC->proxy && hIC->accessType == INTERNET_OPEN_TYPE_PROXY) { + if(hIC->proxyBypass) FIXME("Proxy bypass is ignored.\n"); } - lpwhs->lpszServerName = heap_strdupW(lpszServerName); - lpwhs->lpszHostName = heap_strdupW(lpszServerName); + session->serverName = heap_strdupW(lpszServerName); + session->hostName = heap_strdupW(lpszServerName); if (lpszUserName && lpszUserName[0]) - lpwhs->lpszUserName = heap_strdupW(lpszUserName); + session->userName = heap_strdupW(lpszUserName); if (lpszPassword && lpszPassword[0]) - lpwhs->lpszPassword = heap_strdupW(lpszPassword); - lpwhs->nServerPort = nServerPort; - lpwhs->nHostPort = nServerPort; + session->password = heap_strdupW(lpszPassword); + session->serverPort = serverPort; + session->hostPort = serverPort; /* Don't send a handle created callback if this handle was created with InternetOpenUrl */ - if (!(lpwhs->hdr.dwInternalFlags & INET_OPENURL)) + if (!(session->hdr.dwInternalFlags & INET_OPENURL)) { INTERNET_SendCallback(&hIC->hdr, dwContext, - INTERNET_STATUS_HANDLE_CREATED, &handle, - sizeof(handle)); + INTERNET_STATUS_HANDLE_CREATED, &session->hdr.hInternet, + sizeof(HINTERNET)); } -lerror: - if( lpwhs ) - WININET_Release( &lpwhs->hdr ); - /* * an INTERNET_STATUS_REQUEST_COMPLETE is NOT sent here as per my tests on * windows */ - TRACE("%p --> %p (%p)\n", hIC, handle, lpwhs); + TRACE("%p --> %p\n", hIC, session); - if(res == ERROR_SUCCESS) - *ret = handle; - return res; + *ret = session->hdr.hInternet; + return ERROR_SUCCESS; } - -/*********************************************************************** - * HTTP_OpenConnection (internal) - * - * Connect to a web server - * - * RETURNS - * - * TRUE on success - * FALSE on failure - */ -static DWORD HTTP_OpenConnection(http_request_t *lpwhr) -{ - http_session_t *lpwhs; - appinfo_t *hIC = NULL; - char szaddr[INET6_ADDRSTRLEN]; - const void *addr; - DWORD res = ERROR_SUCCESS; - - TRACE("-->\n"); - - - if (lpwhr->hdr.htype != WH_HHTTPREQ) - { - res = ERROR_INVALID_PARAMETER; - goto lend; - } - - if (NETCON_connected(&lpwhr->netConnection)) - goto lend; - if ((res = HTTP_ResolveName(lpwhr)) != ERROR_SUCCESS) goto lend; - - lpwhs = lpwhr->lpHttpSession; - - hIC = lpwhs->lpAppInfo; - switch (lpwhs->socketAddress.ss_family) - { - case AF_INET: - addr = &((struct sockaddr_in *)&lpwhs->socketAddress)->sin_addr; - break; - case AF_INET6: - addr = &((struct sockaddr_in6 *)&lpwhs->socketAddress)->sin6_addr; - break; - default: - WARN("unsupported family %d\n", lpwhs->socketAddress.ss_family); - return ERROR_INTERNET_NAME_NOT_RESOLVED; - } - inet_ntop(lpwhs->socketAddress.ss_family, addr, szaddr, sizeof(szaddr)); - INTERNET_SendCallback(&lpwhr->hdr, lpwhr->hdr.dwContext, - INTERNET_STATUS_CONNECTING_TO_SERVER, - szaddr, - strlen(szaddr)+1); - - res = NETCON_create(&lpwhr->netConnection, lpwhs->socketAddress.ss_family, SOCK_STREAM, 0); - if (res != ERROR_SUCCESS) - { - WARN("Socket creation failed: %u\n", res); - goto lend; - } - - res = NETCON_connect(&lpwhr->netConnection, (struct sockaddr *)&lpwhs->socketAddress, - lpwhs->sa_len); - if(res != ERROR_SUCCESS) - goto lend; - - INTERNET_SendCallback(&lpwhr->hdr, lpwhr->hdr.dwContext, - INTERNET_STATUS_CONNECTED_TO_SERVER, - szaddr, strlen(szaddr)+1); - - if (lpwhr->hdr.dwFlags & INTERNET_FLAG_SECURE) - { - /* Note: we differ from Microsoft's WinINet here. they seem to have - * a bug that causes no status callbacks to be sent when starting - * a tunnel to a proxy server using the CONNECT verb. i believe our - * behaviour to be more correct and to not cause any incompatibilities - * because using a secure connection through a proxy server is a rare - * case that would be hard for anyone to depend on */ - if (hIC->lpszProxy && (res = HTTP_SecureProxyConnect(lpwhr)) != ERROR_SUCCESS) { - HTTPREQ_CloseConnection(&lpwhr->hdr); - goto lend; - } - - res = NETCON_secure_connect(&lpwhr->netConnection, lpwhs->lpszHostName); - if(res != ERROR_SUCCESS) - { - WARN("Couldn't connect securely to host\n"); - - if((lpwhr->hdr.ErrorMask&INTERNET_ERROR_MASK_COMBINED_SEC_CERT) && ( - res == ERROR_INTERNET_SEC_CERT_DATE_INVALID - || res == ERROR_INTERNET_INVALID_CA - || res == ERROR_INTERNET_SEC_CERT_NO_REV - || res == ERROR_INTERNET_SEC_CERT_REV_FAILED - || res == ERROR_INTERNET_SEC_CERT_REVOKED - || res == ERROR_INTERNET_SEC_INVALID_CERT - || res == ERROR_INTERNET_SEC_CERT_CN_INVALID)) - res = ERROR_INTERNET_SEC_CERT_ERRORS; - - HTTPREQ_CloseConnection(&lpwhr->hdr); - goto lend; - } - } - - -lend: - lpwhr->read_pos = lpwhr->read_size = 0; - lpwhr->read_chunked = FALSE; - - TRACE("%d <--\n", res); - return res; -} - - /*********************************************************************** * HTTP_clear_response_headers (internal) * * clear out any old response headers */ -static void HTTP_clear_response_headers( http_request_t *lpwhr ) +static void HTTP_clear_response_headers( http_request_t *request ) { DWORD i; - for( i=0; inCustHeaders; i++) + for( i=0; inCustHeaders; i++) { - if( !lpwhr->pCustHeaders[i].lpszField ) + if( !request->custHeaders[i].lpszField ) continue; - if( !lpwhr->pCustHeaders[i].lpszValue ) + if( !request->custHeaders[i].lpszValue ) continue; - if ( lpwhr->pCustHeaders[i].wFlags & HDR_ISREQUEST ) + if ( request->custHeaders[i].wFlags & HDR_ISREQUEST ) continue; - HTTP_DeleteCustomHeader( lpwhr, i ); + HTTP_DeleteCustomHeader( request, i ); i--; } } @@ -4672,7 +5482,7 @@ static void HTTP_clear_response_headers( http_request_t *lpwhr ) * TRUE on success * FALSE on error */ -static INT HTTP_GetResponseHeaders(http_request_t *lpwhr, BOOL clear) +static INT HTTP_GetResponseHeaders(http_request_t *request, BOOL clear) { INT cbreaks = 0; WCHAR buffer[MAX_REPLY_LEN]; @@ -4689,7 +5499,7 @@ static INT HTTP_GetResponseHeaders(http_request_t *lpwhr, BOOL clear) TRACE("-->\n"); - if (!NETCON_connected(&lpwhr->netConnection)) + if(!request->netconn) goto lend; do { @@ -4698,12 +5508,12 @@ static INT HTTP_GetResponseHeaders(http_request_t *lpwhr, BOOL clear) * We should first receive 'HTTP/1.x nnn OK' where nnn is the status code. */ buflen = MAX_REPLY_LEN; - if (!read_line(lpwhr, bufferA, &buflen)) + if (!read_line(request, bufferA, &buflen)) goto lend; /* clear old response headers (eg. from a redirect response) */ if (clear) { - HTTP_clear_response_headers( lpwhr ); + HTTP_clear_response_headers( request ); clear = FALSE; } @@ -4733,14 +5543,14 @@ static INT HTTP_GetResponseHeaders(http_request_t *lpwhr, BOOL clear) { WARN("No status line at head of response (%s)\n", debugstr_w(buffer)); - HeapFree(GetProcessHeap(), 0, lpwhr->lpszVersion); - HeapFree(GetProcessHeap(), 0, lpwhr->lpszStatusText); + HeapFree(GetProcessHeap(), 0, request->version); + HeapFree(GetProcessHeap(), 0, request->statusText); - lpwhr->lpszVersion = heap_strdupW(g_szHttp1_0); - lpwhr->lpszStatusText = heap_strdupW(szOK); + request->version = heap_strdupW(g_szHttp1_0); + request->statusText = heap_strdupW(szOK); - HeapFree(GetProcessHeap(), 0, lpwhr->lpszRawHeaders); - lpwhr->lpszRawHeaders = heap_strdupW(szDefaultHeader); + HeapFree(GetProcessHeap(), 0, request->rawHeaders); + request->rawHeaders = heap_strdupW(szDefaultHeader); bSuccess = TRUE; goto lend; @@ -4748,26 +5558,26 @@ static INT HTTP_GetResponseHeaders(http_request_t *lpwhr, BOOL clear) } while (codeHundred); /* Add status code */ - HTTP_ProcessHeader(lpwhr, szStatus, status_code, + HTTP_ProcessHeader(request, szStatus, status_code, HTTP_ADDHDR_FLAG_REPLACE); - HeapFree(GetProcessHeap(),0,lpwhr->lpszVersion); - HeapFree(GetProcessHeap(),0,lpwhr->lpszStatusText); + HeapFree(GetProcessHeap(),0,request->version); + HeapFree(GetProcessHeap(),0,request->statusText); - lpwhr->lpszVersion = heap_strdupW(buffer); - lpwhr->lpszStatusText = heap_strdupW(status_text); + request->version = heap_strdupW(buffer); + request->statusText = heap_strdupW(status_text); /* Restore the spaces */ *(status_code-1) = ' '; *(status_text-1) = ' '; /* regenerate raw headers */ - lpszRawHeaders = HeapAlloc(GetProcessHeap(), 0, (cchMaxRawHeaders + 1) * sizeof(WCHAR)); + lpszRawHeaders = heap_alloc((cchMaxRawHeaders + 1) * sizeof(WCHAR)); if (!lpszRawHeaders) goto lend; while (cchRawHeaders + buflen + strlenW(szCrLf) > cchMaxRawHeaders) cchMaxRawHeaders *= 2; - temp = HeapReAlloc(GetProcessHeap(), 0, lpszRawHeaders, (cchMaxRawHeaders+1)*sizeof(WCHAR)); + temp = heap_realloc(lpszRawHeaders, (cchMaxRawHeaders+1)*sizeof(WCHAR)); if (temp == NULL) goto lend; lpszRawHeaders = temp; memcpy(lpszRawHeaders+cchRawHeaders, buffer, (buflen-1)*sizeof(WCHAR)); @@ -4780,7 +5590,7 @@ static INT HTTP_GetResponseHeaders(http_request_t *lpwhr, BOOL clear) do { buflen = MAX_REPLY_LEN; - if (read_line(lpwhr, bufferA, &buflen)) + if (read_line(request, bufferA, &buflen)) { LPWSTR * pFieldAndValue; @@ -4794,7 +5604,7 @@ static INT HTTP_GetResponseHeaders(http_request_t *lpwhr, BOOL clear) { while (cchRawHeaders + buflen + strlenW(szCrLf) > cchMaxRawHeaders) cchMaxRawHeaders *= 2; - temp = HeapReAlloc(GetProcessHeap(), 0, lpszRawHeaders, (cchMaxRawHeaders+1)*sizeof(WCHAR)); + temp = heap_realloc(lpszRawHeaders, (cchMaxRawHeaders+1)*sizeof(WCHAR)); if (temp == NULL) goto lend; lpszRawHeaders = temp; memcpy(lpszRawHeaders+cchRawHeaders, buffer, (buflen-1)*sizeof(WCHAR)); @@ -4803,7 +5613,7 @@ static INT HTTP_GetResponseHeaders(http_request_t *lpwhr, BOOL clear) cchRawHeaders += sizeof(szCrLf)/sizeof(szCrLf[0])-1; lpszRawHeaders[cchRawHeaders] = '\0'; - HTTP_ProcessHeader(lpwhr, pFieldAndValue[0], pFieldAndValue[1], + HTTP_ProcessHeader(request, pFieldAndValue[0], pFieldAndValue[1], HTTP_ADDREQ_FLAG_ADD ); HTTP_FreeTokens(pFieldAndValue); @@ -4823,15 +5633,15 @@ static INT HTTP_GetResponseHeaders(http_request_t *lpwhr, BOOL clear) if (cchRawHeaders + strlenW(szCrLf) > cchMaxRawHeaders) { cchMaxRawHeaders = cchRawHeaders + strlenW(szCrLf); - temp = HeapReAlloc(GetProcessHeap(), 0, lpszRawHeaders, (cchMaxRawHeaders + 1) * sizeof(WCHAR)); + temp = heap_realloc(lpszRawHeaders, (cchMaxRawHeaders + 1) * sizeof(WCHAR)); if (temp == NULL) goto lend; lpszRawHeaders = temp; } memcpy(&lpszRawHeaders[cchRawHeaders], szCrLf, sizeof(szCrLf)); - HeapFree(GetProcessHeap(), 0, lpwhr->lpszRawHeaders); - lpwhr->lpszRawHeaders = lpszRawHeaders; + HeapFree(GetProcessHeap(), 0, request->rawHeaders); + request->rawHeaders = lpszRawHeaders; TRACE("raw headers: %s\n", debugstr_w(lpszRawHeaders)); bSuccess = TRUE; @@ -4863,7 +5673,7 @@ static LPWSTR * HTTP_InterpretHttpHeader(LPCWSTR buffer) LPWSTR pszColon; INT len; - pTokenPair = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*pTokenPair)*3); + pTokenPair = heap_alloc_zero(sizeof(*pTokenPair)*3); pszColon = strchrW(buffer, ':'); /* must have two tokens */ @@ -4875,7 +5685,7 @@ static LPWSTR * HTTP_InterpretHttpHeader(LPCWSTR buffer) return NULL; } - pTokenPair[0] = HeapAlloc(GetProcessHeap(), 0, (pszColon - buffer + 1) * sizeof(WCHAR)); + pTokenPair[0] = heap_alloc((pszColon - buffer + 1) * sizeof(WCHAR)); if (!pTokenPair[0]) { HTTP_FreeTokens(pTokenPair); @@ -4887,7 +5697,7 @@ static LPWSTR * HTTP_InterpretHttpHeader(LPCWSTR buffer) /* skip colon */ pszColon++; len = strlenW(pszColon); - pTokenPair[1] = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR)); + pTokenPair[1] = heap_alloc((len + 1) * sizeof(WCHAR)); if (!pTokenPair[1]) { HTTP_FreeTokens(pTokenPair); @@ -4911,7 +5721,7 @@ static LPWSTR * HTTP_InterpretHttpHeader(LPCWSTR buffer) #define COALESCEFLAGS (HTTP_ADDHDR_FLAG_COALESCE|HTTP_ADDHDR_FLAG_COALESCE_WITH_COMMA|HTTP_ADDHDR_FLAG_COALESCE_WITH_SEMICOLON) -static DWORD HTTP_ProcessHeader(http_request_t *lpwhr, LPCWSTR field, LPCWSTR value, DWORD dwModifier) +static DWORD HTTP_ProcessHeader(http_request_t *request, LPCWSTR field, LPCWSTR value, DWORD dwModifier) { LPHTTPHEADERW lphttpHdr = NULL; INT index = -1; @@ -4927,13 +5737,13 @@ static DWORD HTTP_ProcessHeader(http_request_t *lpwhr, LPCWSTR field, LPCWSTR va if (dwModifier & HTTP_ADDHDR_FLAG_ADD) index = -1; else - index = HTTP_GetCustomHeaderIndex(lpwhr, field, 0, request_only); + index = HTTP_GetCustomHeaderIndex(request, field, 0, request_only); if (index >= 0) { if (dwModifier & HTTP_ADDHDR_FLAG_ADD_IF_NEW) return ERROR_HTTP_INVALID_HEADER; - lphttpHdr = &lpwhr->pCustHeaders[index]; + lphttpHdr = &request->custHeaders[index]; } else if (value) { @@ -4946,7 +5756,7 @@ static DWORD HTTP_ProcessHeader(http_request_t *lpwhr, LPCWSTR field, LPCWSTR va if (dwModifier & HTTP_ADDHDR_FLAG_REQ) hdr.wFlags |= HDR_ISREQUEST; - return HTTP_InsertCustomHeader(lpwhr, &hdr); + return HTTP_InsertCustomHeader(request, &hdr); } /* no value to delete */ else return ERROR_SUCCESS; @@ -4958,7 +5768,7 @@ static DWORD HTTP_ProcessHeader(http_request_t *lpwhr, LPCWSTR field, LPCWSTR va if (dwModifier & HTTP_ADDHDR_FLAG_REPLACE) { - HTTP_DeleteCustomHeader( lpwhr, index ); + HTTP_DeleteCustomHeader( request, index ); if (value) { @@ -4971,7 +5781,7 @@ static DWORD HTTP_ProcessHeader(http_request_t *lpwhr, LPCWSTR field, LPCWSTR va if (dwModifier & HTTP_ADDHDR_FLAG_REQ) hdr.wFlags |= HDR_ISREQUEST; - return HTTP_InsertCustomHeader(lpwhr, &hdr); + return HTTP_InsertCustomHeader(request, &hdr); } return ERROR_SUCCESS; @@ -4997,7 +5807,7 @@ static DWORD HTTP_ProcessHeader(http_request_t *lpwhr, LPCWSTR field, LPCWSTR va len = origlen + valuelen + ((ch > 0) ? 2 : 0); - lpsztmp = HeapReAlloc(GetProcessHeap(), 0, lphttpHdr->lpszValue, (len+1)*sizeof(WCHAR)); + lpsztmp = heap_realloc(lphttpHdr->lpszValue, (len+1)*sizeof(WCHAR)); if (lpsztmp) { lphttpHdr->lpszValue = lpsztmp; @@ -5016,7 +5826,7 @@ static DWORD HTTP_ProcessHeader(http_request_t *lpwhr, LPCWSTR field, LPCWSTR va } else { - WARN("HeapReAlloc (%d bytes) failed\n",len+1); + WARN("heap_realloc (%d bytes) failed\n",len+1); res = ERROR_OUTOFMEMORY; } } @@ -5024,53 +5834,28 @@ static DWORD HTTP_ProcessHeader(http_request_t *lpwhr, LPCWSTR field, LPCWSTR va return res; } - -/*********************************************************************** - * HTTP_FinishedReading (internal) - * - * Called when all content from server has been read by client. - * - */ -static BOOL HTTP_FinishedReading(http_request_t *lpwhr) -{ - BOOL keepalive = HTTP_KeepAlive(lpwhr); - - TRACE("\n"); - - - if (!keepalive) - { - HTTPREQ_CloseConnection(&lpwhr->hdr); - } - - /* FIXME: store data in the URL cache here */ - - return TRUE; -} - - /*********************************************************************** * HTTP_GetCustomHeaderIndex (internal) * * Return index of custom header from header array * */ -static INT HTTP_GetCustomHeaderIndex(http_request_t *lpwhr, LPCWSTR lpszField, +static INT HTTP_GetCustomHeaderIndex(http_request_t *request, LPCWSTR lpszField, int requested_index, BOOL request_only) { DWORD index; TRACE("%s, %d, %d\n", debugstr_w(lpszField), requested_index, request_only); - for (index = 0; index < lpwhr->nCustHeaders; index++) + for (index = 0; index < request->nCustHeaders; index++) { - if (strcmpiW(lpwhr->pCustHeaders[index].lpszField, lpszField)) + if (strcmpiW(request->custHeaders[index].lpszField, lpszField)) continue; - if (request_only && !(lpwhr->pCustHeaders[index].wFlags & HDR_ISREQUEST)) + if (request_only && !(request->custHeaders[index].wFlags & HDR_ISREQUEST)) continue; - if (!request_only && (lpwhr->pCustHeaders[index].wFlags & HDR_ISREQUEST)) + if (!request_only && (request->custHeaders[index].wFlags & HDR_ISREQUEST)) continue; if (requested_index == 0) @@ -5078,7 +5863,7 @@ static INT HTTP_GetCustomHeaderIndex(http_request_t *lpwhr, LPCWSTR lpszField, requested_index --; } - if (index >= lpwhr->nCustHeaders) + if (index >= request->nCustHeaders) index = -1; TRACE("Return: %d\n", index); @@ -5092,27 +5877,27 @@ static INT HTTP_GetCustomHeaderIndex(http_request_t *lpwhr, LPCWSTR lpszField, * Insert header into array * */ -static DWORD HTTP_InsertCustomHeader(http_request_t *lpwhr, LPHTTPHEADERW lpHdr) +static DWORD HTTP_InsertCustomHeader(http_request_t *request, LPHTTPHEADERW lpHdr) { INT count; LPHTTPHEADERW lph = NULL; TRACE("--> %s: %s\n", debugstr_w(lpHdr->lpszField), debugstr_w(lpHdr->lpszValue)); - count = lpwhr->nCustHeaders + 1; + count = request->nCustHeaders + 1; if (count > 1) - lph = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, lpwhr->pCustHeaders, sizeof(HTTPHEADERW) * count); + lph = heap_realloc_zero(request->custHeaders, sizeof(HTTPHEADERW) * count); else - lph = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(HTTPHEADERW) * count); + lph = heap_alloc_zero(sizeof(HTTPHEADERW) * count); if (!lph) return ERROR_OUTOFMEMORY; - lpwhr->pCustHeaders = lph; - lpwhr->pCustHeaders[count-1].lpszField = heap_strdupW(lpHdr->lpszField); - lpwhr->pCustHeaders[count-1].lpszValue = heap_strdupW(lpHdr->lpszValue); - lpwhr->pCustHeaders[count-1].wFlags = lpHdr->wFlags; - lpwhr->pCustHeaders[count-1].wCount= lpHdr->wCount; - lpwhr->nCustHeaders++; + request->custHeaders = lph; + request->custHeaders[count-1].lpszField = heap_strdupW(lpHdr->lpszField); + request->custHeaders[count-1].lpszValue = heap_strdupW(lpHdr->lpszValue); + request->custHeaders[count-1].wFlags = lpHdr->wFlags; + request->custHeaders[count-1].wCount= lpHdr->wCount; + request->nCustHeaders++; return ERROR_SUCCESS; } @@ -5124,20 +5909,20 @@ static DWORD HTTP_InsertCustomHeader(http_request_t *lpwhr, LPHTTPHEADERW lpHdr) * Delete header from array * If this function is called, the indexs may change. */ -static BOOL HTTP_DeleteCustomHeader(http_request_t *lpwhr, DWORD index) +static BOOL HTTP_DeleteCustomHeader(http_request_t *request, DWORD index) { - if( lpwhr->nCustHeaders <= 0 ) + if( request->nCustHeaders <= 0 ) return FALSE; - if( index >= lpwhr->nCustHeaders ) + if( index >= request->nCustHeaders ) return FALSE; - lpwhr->nCustHeaders--; + request->nCustHeaders--; - HeapFree(GetProcessHeap(), 0, lpwhr->pCustHeaders[index].lpszField); - HeapFree(GetProcessHeap(), 0, lpwhr->pCustHeaders[index].lpszValue); + HeapFree(GetProcessHeap(), 0, request->custHeaders[index].lpszField); + HeapFree(GetProcessHeap(), 0, request->custHeaders[index].lpszValue); - memmove( &lpwhr->pCustHeaders[index], &lpwhr->pCustHeaders[index+1], - (lpwhr->nCustHeaders - index)* sizeof(HTTPHEADERW) ); - memset( &lpwhr->pCustHeaders[lpwhr->nCustHeaders], 0, sizeof(HTTPHEADERW) ); + memmove( &request->custHeaders[index], &request->custHeaders[index+1], + (request->nCustHeaders - index)* sizeof(HTTPHEADERW) ); + memset( &request->custHeaders[request->nCustHeaders], 0, sizeof(HTTPHEADERW) ); return TRUE; } @@ -5149,10 +5934,10 @@ static BOOL HTTP_DeleteCustomHeader(http_request_t *lpwhr, DWORD index) * Verify the given header is not invalid for the given http request * */ -static BOOL HTTP_VerifyValidHeader(http_request_t *lpwhr, LPCWSTR field) +static BOOL HTTP_VerifyValidHeader(http_request_t *request, LPCWSTR field) { /* Accept-Encoding is stripped from HTTP/1.0 requests. It is invalid */ - if (!strcmpW(lpwhr->lpszVersion, g_szHttp1_0) && !strcmpiW(field, szAccept_Encoding)) + if (!strcmpW(request->version, g_szHttp1_0) && !strcmpiW(field, szAccept_Encoding)) return ERROR_HTTP_INVALID_HEADER; return ERROR_SUCCESS; diff --git a/dll/win32/wininet/internet.c b/dll/win32/wininet/internet.c index 94df521e5e4..f473732c8f9 100644 --- a/dll/win32/wininet/internet.c +++ b/dll/win32/wininet/internet.c @@ -88,9 +88,7 @@ typedef struct } WITHREADERROR, *LPWITHREADERROR; static DWORD g_dwTlsErrIndex = TLS_OUT_OF_INDEXES; -static HMODULE WININET_hModule; - -#define HANDLE_CHUNK_SIZE 0x10 +HMODULE WININET_hModule; static CRITICAL_SECTION WININET_cs; static CRITICAL_SECTION_DEBUG WININET_cs_debug = @@ -101,9 +99,9 @@ static CRITICAL_SECTION_DEBUG WININET_cs_debug = }; static CRITICAL_SECTION WININET_cs = { &WININET_cs_debug, -1, 0, 0, 0, 0 }; -static object_header_t **WININET_Handles; -static UINT_PTR WININET_dwNextHandle; -static UINT_PTR WININET_dwMaxHandles; +static object_header_t **handle_table; +static UINT_PTR next_handle; +static UINT_PTR handle_table_size; typedef struct { @@ -119,48 +117,70 @@ static const WCHAR szInternetSettings[] = static const WCHAR szProxyServer[] = { 'P','r','o','x','y','S','e','r','v','e','r', 0 }; static const WCHAR szProxyEnable[] = { 'P','r','o','x','y','E','n','a','b','l','e', 0 }; -HINTERNET WININET_AllocHandle( object_header_t *info ) +void *alloc_object(object_header_t *parent, const object_vtbl_t *vtbl, size_t size) { - object_header_t **p; UINT_PTR handle = 0, num; + object_header_t *ret; + object_header_t **p; + BOOL res = TRUE; - list_init( &info->children ); + ret = heap_alloc_zero(size); + if(!ret) + return NULL; + + list_init(&ret->children); EnterCriticalSection( &WININET_cs ); - if( !WININET_dwMaxHandles ) - { - num = HANDLE_CHUNK_SIZE; - p = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, - sizeof (*WININET_Handles)* num); - if( !p ) - goto end; - WININET_Handles = p; - WININET_dwMaxHandles = num; - } - if( WININET_dwMaxHandles == WININET_dwNextHandle ) - { - num = WININET_dwMaxHandles + HANDLE_CHUNK_SIZE; - p = HeapReAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, - WININET_Handles, sizeof (*WININET_Handles)* num); - if( !p ) - goto end; - WININET_Handles = p; - WININET_dwMaxHandles = num; + + if(!handle_table_size) { + num = 16; + p = heap_alloc_zero(sizeof(handle_table[0]) * num); + if(p) { + handle_table = p; + handle_table_size = num; + next_handle = 1; + }else { + res = FALSE; + } + }else if(next_handle == handle_table_size) { + num = handle_table_size * 2; + p = heap_realloc_zero(handle_table, sizeof(handle_table[0]) * num); + if(p) { + handle_table = p; + handle_table_size = num; + }else { + res = FALSE; + } } - handle = WININET_dwNextHandle; - if( WININET_Handles[handle] ) - ERR("handle isn't free but should be\n"); - WININET_Handles[handle] = WININET_AddRef( info ); + if(res) { + handle = next_handle; + if(handle_table[handle]) + ERR("handle isn't free but should be\n"); + handle_table[handle] = ret; + ret->valid_handle = TRUE; + + while(handle_table[next_handle] && next_handle < handle_table_size) + next_handle++; + } - while( WININET_Handles[WININET_dwNextHandle] && - (WININET_dwNextHandle < WININET_dwMaxHandles ) ) - WININET_dwNextHandle++; - -end: LeaveCriticalSection( &WININET_cs ); - return info->hInternet = (HINTERNET) (handle+1); + if(!res) { + heap_free(ret); + return NULL; + } + + ret->vtbl = vtbl; + ret->refs = 1; + ret->hInternet = (HINTERNET)handle; + + if(parent) { + ret->lpfnStatusCB = parent->lpfnStatusCB; + ret->dwInternalFlags = parent->dwInternalFlags & INET_CALLBACKW; + } + + return ret; } object_header_t *WININET_AddRef( object_header_t *info ) @@ -170,16 +190,15 @@ object_header_t *WININET_AddRef( object_header_t *info ) return info; } -object_header_t *WININET_GetObject( HINTERNET hinternet ) +object_header_t *get_handle_object( HINTERNET hinternet ) { object_header_t *info = NULL; UINT_PTR handle = (UINT_PTR) hinternet; EnterCriticalSection( &WININET_cs ); - if( (handle > 0) && ( handle <= WININET_dwMaxHandles ) && - WININET_Handles[handle-1] ) - info = WININET_AddRef( WININET_Handles[handle-1] ); + if(handle > 0 && handle < handle_table_size && handle_table[handle] && handle_table[handle]->valid_handle) + info = WININET_AddRef(handle_table[handle]); LeaveCriticalSection( &WININET_cs ); @@ -188,12 +207,31 @@ object_header_t *WININET_GetObject( HINTERNET hinternet ) return info; } +static void invalidate_handle(object_header_t *info) +{ + object_header_t *child, *next; + + if(!info->valid_handle) + return; + info->valid_handle = FALSE; + + /* Free all children as native does */ + LIST_FOR_EACH_ENTRY_SAFE( child, next, &info->children, object_header_t, entry ) + { + TRACE("invalidating child handle %p for parent %p\n", child->hInternet, info); + invalidate_handle( child ); + } + + WININET_Release(info); +} + BOOL WININET_Release( object_header_t *info ) { ULONG refs = InterlockedDecrement(&info->refs); TRACE( "object %p refcount = %d\n", info, refs ); if( !refs ) { + invalidate_handle(info); if ( info->vtbl->CloseConnection ) { TRACE( "closing connection %p\n", info); @@ -211,57 +249,24 @@ BOOL WININET_Release( object_header_t *info ) if ( info->htype != WH_HINIT ) list_remove( &info->entry ); info->vtbl->Destroy( info ); + + if(info->hInternet) { + UINT_PTR handle = (UINT_PTR)info->hInternet; + + EnterCriticalSection( &WININET_cs ); + + handle_table[handle] = NULL; + if(next_handle > handle) + next_handle = handle; + + LeaveCriticalSection( &WININET_cs ); + } + + heap_free(info); } return TRUE; } -BOOL WININET_FreeHandle( HINTERNET hinternet ) -{ - BOOL ret = FALSE; - UINT_PTR handle = (UINT_PTR) hinternet; - object_header_t *info = NULL, *child, *next; - - EnterCriticalSection( &WININET_cs ); - - if( (handle > 0) && ( handle <= WININET_dwMaxHandles ) ) - { - handle--; - if( WININET_Handles[handle] ) - { - info = WININET_Handles[handle]; - TRACE( "destroying handle %ld for object %p\n", handle+1, info); - WININET_Handles[handle] = NULL; - ret = TRUE; - } - } - - LeaveCriticalSection( &WININET_cs ); - - /* As on native when the equivalent of WININET_Release is called, the handle - * is already invalid, but if a new handle is created at this time it does - * not yet get assigned the freed handle number */ - if( info ) - { - /* Free all children as native does */ - LIST_FOR_EACH_ENTRY_SAFE( child, next, &info->children, object_header_t, entry ) - { - TRACE( "freeing child handle %ld for parent handle %ld\n", - (UINT_PTR)child->hInternet, handle+1); - WININET_FreeHandle( child->hInternet ); - } - WININET_Release( info ); - } - - EnterCriticalSection( &WININET_cs ); - - if( WININET_dwNextHandle > handle && !WININET_Handles[handle] ) - WININET_dwNextHandle = handle; - - LeaveCriticalSection( &WININET_cs ); - - return ret; -} - /*********************************************************************** * DllMain [Internal] Initializes the internal 'WININET.DLL'. * @@ -303,7 +308,7 @@ BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) break; case DLL_PROCESS_DETACH: - + collect_connections(TRUE); NETCON_unload(); URLCacheContainers_DeleteAll(); @@ -538,7 +543,7 @@ static LONG INTERNET_LoadProxySettings( proxyinfo_t *lpwpi ) LPWSTR szProxy, p; static const WCHAR szHttp[] = {'h','t','t','p','=',0}; - if (!(szProxy = HeapAlloc( GetProcessHeap(), 0, len ))) + if (!(szProxy = heap_alloc(len))) { RegCloseKey( key ); return ERROR_OUTOFMEMORY; @@ -570,7 +575,7 @@ static LONG INTERNET_LoadProxySettings( proxyinfo_t *lpwpi ) WCHAR *envproxyW; len = MultiByteToWideChar( CP_UNIXCP, 0, envproxy, -1, NULL, 0 ); - if (!(envproxyW = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR)))) + if (!(envproxyW = heap_alloc(len * sizeof(WCHAR)))) return ERROR_OUTOFMEMORY; MultiByteToWideChar( CP_UNIXCP, 0, envproxy, -1, envproxyW, len ); @@ -598,12 +603,12 @@ static BOOL INTERNET_ConfigureProxy( appinfo_t *lpwai ) if (wpi.dwProxyEnabled) { - lpwai->dwAccessType = INTERNET_OPEN_TYPE_PROXY; - lpwai->lpszProxy = wpi.lpszProxyServer; + lpwai->accessType = INTERNET_OPEN_TYPE_PROXY; + lpwai->proxy = wpi.lpszProxyServer; return TRUE; } - lpwai->dwAccessType = INTERNET_OPEN_TYPE_DIRECT; + lpwai->accessType = INTERNET_OPEN_TYPE_DIRECT; return FALSE; } @@ -676,12 +681,11 @@ static VOID APPINFO_Destroy(object_header_t *hdr) TRACE("%p\n",lpwai); - HeapFree(GetProcessHeap(), 0, lpwai->lpszAgent); - HeapFree(GetProcessHeap(), 0, lpwai->lpszProxy); - HeapFree(GetProcessHeap(), 0, lpwai->lpszProxyBypass); - HeapFree(GetProcessHeap(), 0, lpwai->lpszProxyUsername); - HeapFree(GetProcessHeap(), 0, lpwai->lpszProxyPassword); - HeapFree(GetProcessHeap(), 0, lpwai); + HeapFree(GetProcessHeap(), 0, lpwai->agent); + HeapFree(GetProcessHeap(), 0, lpwai->proxy); + HeapFree(GetProcessHeap(), 0, lpwai->proxyBypass); + HeapFree(GetProcessHeap(), 0, lpwai->proxyUsername); + HeapFree(GetProcessHeap(), 0, lpwai->proxyPassword); } static DWORD APPINFO_QueryOption(object_header_t *hdr, DWORD option, void *buffer, DWORD *size, BOOL unicode) @@ -707,14 +711,14 @@ static DWORD APPINFO_QueryOption(object_header_t *hdr, DWORD option, void *buffe bufsize = *size; if (unicode) { - DWORD len = ai->lpszAgent ? strlenW(ai->lpszAgent) : 0; + DWORD len = ai->agent ? strlenW(ai->agent) : 0; *size = (len + 1) * sizeof(WCHAR); if(!buffer || bufsize < *size) return ERROR_INSUFFICIENT_BUFFER; - if (ai->lpszAgent) - strcpyW(buffer, ai->lpszAgent); + if (ai->agent) + strcpyW(buffer, ai->agent); else *(WCHAR *)buffer = 0; /* If the buffer is copied, the returned length doesn't include @@ -722,15 +726,15 @@ static DWORD APPINFO_QueryOption(object_header_t *hdr, DWORD option, void *buffe */ *size = len * sizeof(WCHAR); }else { - if (ai->lpszAgent) - *size = WideCharToMultiByte(CP_ACP, 0, ai->lpszAgent, -1, NULL, 0, NULL, NULL); + if (ai->agent) + *size = WideCharToMultiByte(CP_ACP, 0, ai->agent, -1, NULL, 0, NULL, NULL); else *size = 1; if(!buffer || bufsize < *size) return ERROR_INSUFFICIENT_BUFFER; - if (ai->lpszAgent) - WideCharToMultiByte(CP_ACP, 0, ai->lpszAgent, -1, buffer, *size, NULL, NULL); + if (ai->agent) + WideCharToMultiByte(CP_ACP, 0, ai->agent, -1, buffer, *size, NULL, NULL); else *(char *)buffer = 0; /* If the buffer is copied, the returned length doesn't include @@ -748,10 +752,10 @@ static DWORD APPINFO_QueryOption(object_header_t *hdr, DWORD option, void *buffe DWORD proxyBytesRequired = 0, proxyBypassBytesRequired = 0; LPWSTR proxy, proxy_bypass; - if (ai->lpszProxy) - proxyBytesRequired = (lstrlenW(ai->lpszProxy) + 1) * sizeof(WCHAR); - if (ai->lpszProxyBypass) - proxyBypassBytesRequired = (lstrlenW(ai->lpszProxyBypass) + 1) * sizeof(WCHAR); + if (ai->proxy) + proxyBytesRequired = (lstrlenW(ai->proxy) + 1) * sizeof(WCHAR); + if (ai->proxyBypass) + proxyBypassBytesRequired = (lstrlenW(ai->proxyBypass) + 1) * sizeof(WCHAR); if (*size < sizeof(INTERNET_PROXY_INFOW) + proxyBytesRequired + proxyBypassBytesRequired) { *size = sizeof(INTERNET_PROXY_INFOW) + proxyBytesRequired + proxyBypassBytesRequired; @@ -760,16 +764,16 @@ static DWORD APPINFO_QueryOption(object_header_t *hdr, DWORD option, void *buffe proxy = (LPWSTR)((LPBYTE)buffer + sizeof(INTERNET_PROXY_INFOW)); proxy_bypass = (LPWSTR)((LPBYTE)buffer + sizeof(INTERNET_PROXY_INFOW) + proxyBytesRequired); - pi->dwAccessType = ai->dwAccessType; + pi->dwAccessType = ai->accessType; pi->lpszProxy = NULL; pi->lpszProxyBypass = NULL; - if (ai->lpszProxy) { - lstrcpyW(proxy, ai->lpszProxy); + if (ai->proxy) { + lstrcpyW(proxy, ai->proxy); pi->lpszProxy = proxy; } - if (ai->lpszProxyBypass) { - lstrcpyW(proxy_bypass, ai->lpszProxyBypass); + if (ai->proxyBypass) { + lstrcpyW(proxy_bypass, ai->proxyBypass); pi->lpszProxyBypass = proxy_bypass; } @@ -780,10 +784,10 @@ static DWORD APPINFO_QueryOption(object_header_t *hdr, DWORD option, void *buffe DWORD proxyBytesRequired = 0, proxyBypassBytesRequired = 0; LPSTR proxy, proxy_bypass; - if (ai->lpszProxy) - proxyBytesRequired = WideCharToMultiByte(CP_ACP, 0, ai->lpszProxy, -1, NULL, 0, NULL, NULL); - if (ai->lpszProxyBypass) - proxyBypassBytesRequired = WideCharToMultiByte(CP_ACP, 0, ai->lpszProxyBypass, -1, + if (ai->proxy) + proxyBytesRequired = WideCharToMultiByte(CP_ACP, 0, ai->proxy, -1, NULL, 0, NULL, NULL); + if (ai->proxyBypass) + proxyBypassBytesRequired = WideCharToMultiByte(CP_ACP, 0, ai->proxyBypass, -1, NULL, 0, NULL, NULL); if (*size < sizeof(INTERNET_PROXY_INFOA) + proxyBytesRequired + proxyBypassBytesRequired) { @@ -793,16 +797,16 @@ static DWORD APPINFO_QueryOption(object_header_t *hdr, DWORD option, void *buffe proxy = (LPSTR)((LPBYTE)buffer + sizeof(INTERNET_PROXY_INFOA)); proxy_bypass = (LPSTR)((LPBYTE)buffer + sizeof(INTERNET_PROXY_INFOA) + proxyBytesRequired); - pi->dwAccessType = ai->dwAccessType; + pi->dwAccessType = ai->accessType; pi->lpszProxy = NULL; pi->lpszProxyBypass = NULL; - if (ai->lpszProxy) { - WideCharToMultiByte(CP_ACP, 0, ai->lpszProxy, -1, proxy, proxyBytesRequired, NULL, NULL); + if (ai->proxy) { + WideCharToMultiByte(CP_ACP, 0, ai->proxy, -1, proxy, proxyBytesRequired, NULL, NULL); pi->lpszProxy = proxy; } - if (ai->lpszProxyBypass) { - WideCharToMultiByte(CP_ACP, 0, ai->lpszProxyBypass, -1, proxy_bypass, + if (ai->proxyBypass) { + WideCharToMultiByte(CP_ACP, 0, ai->proxyBypass, -1, proxy_bypass, proxyBypassBytesRequired, NULL, NULL); pi->lpszProxyBypass = proxy_bypass; } @@ -842,7 +846,6 @@ HINTERNET WINAPI InternetOpenW(LPCWSTR lpszAgent, DWORD dwAccessType, LPCWSTR lpszProxy, LPCWSTR lpszProxyBypass, DWORD dwFlags) { appinfo_t *lpwai = NULL; - HINTERNET handle = NULL; if (TRACE_ON(wininet)) { #define FE(x) { x, #x } @@ -872,43 +875,28 @@ HINTERNET WINAPI InternetOpenW(LPCWSTR lpszAgent, DWORD dwAccessType, /* Clear any error information */ INTERNET_SetLastError(0); - lpwai = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(appinfo_t)); - if (NULL == lpwai) - { - INTERNET_SetLastError(ERROR_OUTOFMEMORY); - goto lend; + lpwai = alloc_object(NULL, &APPINFOVtbl, sizeof(appinfo_t)); + if (!lpwai) { + SetLastError(ERROR_OUTOFMEMORY); + return NULL; } lpwai->hdr.htype = WH_HINIT; - lpwai->hdr.vtbl = &APPINFOVtbl; lpwai->hdr.dwFlags = dwFlags; - lpwai->hdr.refs = 1; - lpwai->dwAccessType = dwAccessType; - lpwai->lpszProxyUsername = NULL; - lpwai->lpszProxyPassword = NULL; + lpwai->accessType = dwAccessType; + lpwai->proxyUsername = NULL; + lpwai->proxyPassword = NULL; - handle = WININET_AllocHandle( &lpwai->hdr ); - if( !handle ) - { - HeapFree( GetProcessHeap(), 0, lpwai ); - INTERNET_SetLastError(ERROR_OUTOFMEMORY); - goto lend; - } - - lpwai->lpszAgent = heap_strdupW(lpszAgent); + lpwai->agent = heap_strdupW(lpszAgent); if(dwAccessType == INTERNET_OPEN_TYPE_PRECONFIG) INTERNET_ConfigureProxy( lpwai ); else - lpwai->lpszProxy = heap_strdupW(lpszProxy); - lpwai->lpszProxyBypass = heap_strdupW(lpszProxyBypass); - -lend: - if( lpwai ) - WININET_Release( &lpwai->hdr ); + lpwai->proxy = heap_strdupW(lpszProxy); + lpwai->proxyBypass = heap_strdupW(lpszProxyBypass); TRACE("returning %p\n", lpwai); - return handle; + return lpwai->hdr.hInternet; } @@ -1097,7 +1085,7 @@ BOOL WINAPI InternetGetConnectedStateExA(LPDWORD lpdwStatus, LPSTR lpszConnectio TRACE("(%p, %p, %d, 0x%08x)\n", lpdwStatus, lpszConnectionName, dwNameLen, dwReserved); if (lpszConnectionName && dwNameLen > 0) - lpwszConnectionName= HeapAlloc(GetProcessHeap(), 0, dwNameLen * sizeof(WCHAR)); + lpwszConnectionName = heap_alloc(dwNameLen * sizeof(WCHAR)); rc = InternetGetConnectedStateExW(lpdwStatus,lpwszConnectionName, dwNameLen, dwReserved); @@ -1142,7 +1130,7 @@ HINTERNET WINAPI InternetConnectW(HINTERNET hInternet, return NULL; } - hIC = (appinfo_t*)WININET_GetObject( hInternet ); + hIC = (appinfo_t*)get_handle_object( hInternet ); if ( (hIC == NULL) || (hIC->hdr.htype != WH_HINIT) ) { res = ERROR_INVALID_HANDLE; @@ -1249,7 +1237,7 @@ BOOL WINAPI InternetFindNextFileW(HINTERNET hFind, LPVOID lpvFindData) TRACE("\n"); - hdr = WININET_GetObject(hFind); + hdr = get_handle_object(hFind); if(!hdr) { WARN("Invalid handle\n"); SetLastError(ERROR_INVALID_HANDLE); @@ -1282,19 +1270,18 @@ BOOL WINAPI InternetFindNextFileW(HINTERNET hFind, LPVOID lpvFindData) */ BOOL WINAPI InternetCloseHandle(HINTERNET hInternet) { - object_header_t *lpwh; + object_header_t *obj; - TRACE("%p\n",hInternet); + TRACE("%p\n", hInternet); - lpwh = WININET_GetObject( hInternet ); - if (NULL == lpwh) - { - INTERNET_SetLastError(ERROR_INVALID_HANDLE); + obj = get_handle_object( hInternet ); + if (!obj) { + SetLastError(ERROR_INVALID_HANDLE); return FALSE; } - WININET_Release( lpwh ); - WININET_FreeHandle( hInternet ); + invalidate_handle(obj); + WININET_Release(obj); return TRUE; } @@ -1370,7 +1357,7 @@ BOOL WINAPI InternetCrackUrlA(LPCSTR lpszUrl, DWORD dwUrlLength, DWORD dwFlags, InternetCrackUrlW should not include it */ if (dwUrlLength == -1) nLength--; - lpwszUrl = HeapAlloc(GetProcessHeap(), 0, (nLength + 1) * sizeof(WCHAR)); + lpwszUrl = heap_alloc((nLength + 1) * sizeof(WCHAR)); MultiByteToWideChar(CP_ACP,0,lpszUrl,dwUrlLength,lpwszUrl,nLength + 1); lpwszUrl[nLength] = '\0'; @@ -1381,7 +1368,7 @@ BOOL WINAPI InternetCrackUrlA(LPCSTR lpszUrl, DWORD dwUrlLength, DWORD dwFlags, UCW.dwHostNameLength = lpUrlComponents->dwHostNameLength; if (lpUrlComponents->lpszHostName) { - hostname = HeapAlloc(GetProcessHeap(), 0, UCW.dwHostNameLength * sizeof(WCHAR)); + hostname = heap_alloc(UCW.dwHostNameLength * sizeof(WCHAR)); UCW.lpszHostName = hostname; } } @@ -1390,7 +1377,7 @@ BOOL WINAPI InternetCrackUrlA(LPCSTR lpszUrl, DWORD dwUrlLength, DWORD dwFlags, UCW.dwUserNameLength = lpUrlComponents->dwUserNameLength; if (lpUrlComponents->lpszUserName) { - username = HeapAlloc(GetProcessHeap(), 0, UCW.dwUserNameLength * sizeof(WCHAR)); + username = heap_alloc(UCW.dwUserNameLength * sizeof(WCHAR)); UCW.lpszUserName = username; } } @@ -1399,7 +1386,7 @@ BOOL WINAPI InternetCrackUrlA(LPCSTR lpszUrl, DWORD dwUrlLength, DWORD dwFlags, UCW.dwPasswordLength = lpUrlComponents->dwPasswordLength; if (lpUrlComponents->lpszPassword) { - password = HeapAlloc(GetProcessHeap(), 0, UCW.dwPasswordLength * sizeof(WCHAR)); + password = heap_alloc(UCW.dwPasswordLength * sizeof(WCHAR)); UCW.lpszPassword = password; } } @@ -1408,7 +1395,7 @@ BOOL WINAPI InternetCrackUrlA(LPCSTR lpszUrl, DWORD dwUrlLength, DWORD dwFlags, UCW.dwUrlPathLength = lpUrlComponents->dwUrlPathLength; if (lpUrlComponents->lpszUrlPath) { - path = HeapAlloc(GetProcessHeap(), 0, UCW.dwUrlPathLength * sizeof(WCHAR)); + path = heap_alloc(UCW.dwUrlPathLength * sizeof(WCHAR)); UCW.lpszUrlPath = path; } } @@ -1417,7 +1404,7 @@ BOOL WINAPI InternetCrackUrlA(LPCSTR lpszUrl, DWORD dwUrlLength, DWORD dwFlags, UCW.dwSchemeLength = lpUrlComponents->dwSchemeLength; if (lpUrlComponents->lpszScheme) { - scheme = HeapAlloc(GetProcessHeap(), 0, UCW.dwSchemeLength * sizeof(WCHAR)); + scheme = heap_alloc(UCW.dwSchemeLength * sizeof(WCHAR)); UCW.lpszScheme = scheme; } } @@ -1426,7 +1413,7 @@ BOOL WINAPI InternetCrackUrlA(LPCSTR lpszUrl, DWORD dwUrlLength, DWORD dwFlags, UCW.dwExtraInfoLength = lpUrlComponents->dwExtraInfoLength; if (lpUrlComponents->lpszExtraInfo) { - extra = HeapAlloc(GetProcessHeap(), 0, UCW.dwExtraInfoLength * sizeof(WCHAR)); + extra = heap_alloc(UCW.dwExtraInfoLength * sizeof(WCHAR)); UCW.lpszExtraInfo = extra; } } @@ -1585,14 +1572,14 @@ BOOL WINAPI InternetCrackUrlW(LPCWSTR lpszUrl_orig, DWORD dwUrlLength_orig, DWOR WCHAR *url_tmp; DWORD len = dwUrlLength + 1; - if (!(url_tmp = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)))) + if (!(url_tmp = heap_alloc(len * sizeof(WCHAR)))) { INTERNET_SetLastError(ERROR_OUTOFMEMORY); return FALSE; } memcpy(url_tmp, lpszUrl_orig, dwUrlLength * sizeof(WCHAR)); url_tmp[dwUrlLength] = 0; - if (!(lpszUrl_decode = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)))) + if (!(lpszUrl_decode = heap_alloc(len * sizeof(WCHAR)))) { HeapFree(GetProcessHeap(), 0, url_tmp); INTERNET_SetLastError(ERROR_OUTOFMEMORY); @@ -2023,7 +2010,7 @@ INTERNET_STATUS_CALLBACK WINAPI InternetSetStatusCallbackA( TRACE("%p\n", hInternet); - if (!(lpwh = WININET_GetObject(hInternet))) + if (!(lpwh = get_handle_object(hInternet))) return INTERNET_INVALID_STATUS_CALLBACK; retVal = set_status_callback(lpwh, lpfnIntCB, FALSE); @@ -2051,7 +2038,7 @@ INTERNET_STATUS_CALLBACK WINAPI InternetSetStatusCallbackW( TRACE("%p\n", hInternet); - if (!(lpwh = WININET_GetObject(hInternet))) + if (!(lpwh = get_handle_object(hInternet))) return INTERNET_INVALID_STATUS_CALLBACK; retVal = set_status_callback(lpwh, lpfnIntCB, TRUE); @@ -2088,7 +2075,7 @@ BOOL WINAPI InternetWriteFile(HINTERNET hFile, LPCVOID lpBuffer, TRACE("(%p %p %d %p)\n", hFile, lpBuffer, dwNumOfBytesToWrite, lpdwNumOfBytesWritten); - lpwh = WININET_GetObject( hFile ); + lpwh = get_handle_object( hFile ); if (!lpwh) { WARN("Invalid handle\n"); SetLastError(ERROR_INVALID_HANDLE); @@ -2128,7 +2115,7 @@ BOOL WINAPI InternetReadFile(HINTERNET hFile, LPVOID lpBuffer, TRACE("%p %p %d %p\n", hFile, lpBuffer, dwNumOfBytesToRead, pdwNumOfBytesRead); - hdr = WININET_GetObject(hFile); + hdr = get_handle_object(hFile); if (!hdr) { INTERNET_SetLastError(ERROR_INVALID_HANDLE); return FALSE; @@ -2182,7 +2169,7 @@ BOOL WINAPI InternetReadFileExA(HINTERNET hFile, LPINTERNET_BUFFERSA lpBuffersOu TRACE("(%p %p 0x%x 0x%lx)\n", hFile, lpBuffersOut, dwFlags, dwContext); - hdr = WININET_GetObject(hFile); + hdr = get_handle_object(hFile); if (!hdr) { INTERNET_SetLastError(ERROR_INVALID_HANDLE); return FALSE; @@ -2214,7 +2201,7 @@ BOOL WINAPI InternetReadFileExW(HINTERNET hFile, LPINTERNET_BUFFERSW lpBuffer, TRACE("(%p %p 0x%x 0x%lx)\n", hFile, lpBuffer, dwFlags, dwContext); - hdr = WININET_GetObject(hFile); + hdr = get_handle_object(hFile); if (!hdr) { INTERNET_SetLastError(ERROR_INVALID_HANDLE); return FALSE; @@ -2305,7 +2292,7 @@ DWORD INET_QueryOption(object_header_t *hdr, DWORD option, void *buffer, DWORD * if (*size < sizeof(ULONG)) return ERROR_INSUFFICIENT_BUFFER; - *(ULONG*)size = 4; + *(ULONG*)buffer = 4; *size = sizeof(ULONG); return ERROR_SUCCESS; @@ -2347,27 +2334,27 @@ DWORD INET_QueryOption(object_header_t *hdr, DWORD option, void *buffer, DWORD * } for (i = 0; i < con->dwOptionCount; i++) { - INTERNET_PER_CONN_OPTIONW *option = con->pOptions + i; + INTERNET_PER_CONN_OPTIONW *optionW = con->pOptions + i; INTERNET_PER_CONN_OPTIONA *optionA = conA->pOptions + i; - switch (option->dwOption) { + switch (optionW->dwOption) { case INTERNET_PER_CONN_FLAGS: if(pi.dwProxyEnabled) - option->Value.dwValue = PROXY_TYPE_PROXY; + optionW->Value.dwValue = PROXY_TYPE_PROXY; else - option->Value.dwValue = PROXY_TYPE_DIRECT; + optionW->Value.dwValue = PROXY_TYPE_DIRECT; break; case INTERNET_PER_CONN_PROXY_SERVER: if (unicode) - option->Value.pszValue = heap_strdupW(pi.lpszProxyServer); + optionW->Value.pszValue = heap_strdupW(pi.lpszProxyServer); else optionA->Value.pszValue = heap_strdupWtoA(pi.lpszProxyServer); break; case INTERNET_PER_CONN_PROXY_BYPASS: if (unicode) - option->Value.pszValue = heap_strdupW(pi.lpszProxyBypass); + optionW->Value.pszValue = heap_strdupW(pi.lpszProxyBypass); else optionA->Value.pszValue = heap_strdupWtoA(pi.lpszProxyBypass); break; @@ -2378,12 +2365,12 @@ DWORD INET_QueryOption(object_header_t *hdr, DWORD option, void *buffer, DWORD * case INTERNET_PER_CONN_AUTOCONFIG_RELOAD_DELAY_MINS: case INTERNET_PER_CONN_AUTOCONFIG_LAST_DETECT_TIME: case INTERNET_PER_CONN_AUTOCONFIG_LAST_DETECT_URL: - FIXME("Unhandled dwOption %d\n", option->dwOption); - memset(&option->Value, 0, sizeof(option->Value)); + FIXME("Unhandled dwOption %d\n", optionW->dwOption); + memset(&optionW->Value, 0, sizeof(optionW->Value)); break; default: - FIXME("Unknown dwOption %d\n", option->dwOption); + FIXME("Unknown dwOption %d\n", optionW->dwOption); res = ERROR_INVALID_PARAMETER; break; } @@ -2440,7 +2427,7 @@ BOOL WINAPI InternetQueryOptionW(HINTERNET hInternet, DWORD dwOption, TRACE("%p %d %p %p\n", hInternet, dwOption, lpBuffer, lpdwBufferLength); if(hInternet) { - hdr = WININET_GetObject(hInternet); + hdr = get_handle_object(hInternet); if (hdr) { res = hdr->vtbl->QueryOption(hdr, dwOption, lpBuffer, lpdwBufferLength, TRUE); WININET_Release(hdr); @@ -2473,7 +2460,7 @@ BOOL WINAPI InternetQueryOptionA(HINTERNET hInternet, DWORD dwOption, TRACE("%p %d %p %p\n", hInternet, dwOption, lpBuffer, lpdwBufferLength); if(hInternet) { - hdr = WININET_GetObject(hInternet); + hdr = get_handle_object(hInternet); if (hdr) { res = hdr->vtbl->QueryOption(hdr, dwOption, lpBuffer, lpdwBufferLength, FALSE); WININET_Release(hdr); @@ -2506,7 +2493,7 @@ BOOL WINAPI InternetSetOptionW(HINTERNET hInternet, DWORD dwOption, TRACE("(%p %d %p %d)\n", hInternet, dwOption, lpBuffer, dwBufferLength); - lpwhh = (object_header_t*) WININET_GetObject( hInternet ); + lpwhh = (object_header_t*) get_handle_object( hInternet ); if(lpwhh && lpwhh->vtbl->SetOption) { DWORD res; @@ -2607,9 +2594,10 @@ BOOL WINAPI InternetSetOptionW(HINTERNET hInternet, DWORD dwOption, break; case INTERNET_OPTION_SEND_TIMEOUT: case INTERNET_OPTION_RECEIVE_TIMEOUT: + case INTERNET_OPTION_DATA_SEND_TIMEOUT: { ULONG timeout = *(ULONG *)lpBuffer; - FIXME("INTERNET_OPTION_SEND/RECEIVE_TIMEOUT %d\n", timeout); + FIXME("INTERNET_OPTION_SEND/RECEIVE_TIMEOUT/DATA_SEND_TIMEOUT %d\n", timeout); break; } case INTERNET_OPTION_CONNECT_RETRIES: @@ -2764,7 +2752,7 @@ BOOL WINAPI InternetSetOptionA(HINTERNET hInternet, DWORD dwOption, { object_header_t *lpwh; - if (!(lpwh = WININET_GetObject(hInternet))) + if (!(lpwh = get_handle_object(hInternet))) { INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE); return FALSE; @@ -2783,7 +2771,7 @@ BOOL WINAPI InternetSetOptionA(HINTERNET hInternet, DWORD dwOption, proxlen = MultiByteToWideChar( CP_ACP, 0, pi->lpszProxy, -1, NULL, 0); prbylen= MultiByteToWideChar( CP_ACP, 0, pi->lpszProxyBypass, -1, NULL, 0); wlen = sizeof(*piw) + proxlen + prbylen; - wbuffer = HeapAlloc( GetProcessHeap(), 0, wlen*sizeof(WCHAR) ); + wbuffer = heap_alloc(wlen*sizeof(WCHAR) ); piw = (LPINTERNET_PROXY_INFOW) wbuffer; piw->dwAccessType = pi->dwAccessType; prox = (LPWSTR) &piw[1]; @@ -2799,7 +2787,7 @@ BOOL WINAPI InternetSetOptionA(HINTERNET hInternet, DWORD dwOption, case INTERNET_OPTION_PASSWORD: wlen = MultiByteToWideChar( CP_ACP, 0, lpBuffer, dwBufferLength, NULL, 0 ); - wbuffer = HeapAlloc( GetProcessHeap(), 0, wlen*sizeof(WCHAR) ); + wbuffer = heap_alloc(wlen*sizeof(WCHAR) ); MultiByteToWideChar( CP_ACP, 0, lpBuffer, dwBufferLength, wbuffer, wlen ); break; @@ -2808,21 +2796,21 @@ BOOL WINAPI InternetSetOptionA(HINTERNET hInternet, DWORD dwOption, INTERNET_PER_CONN_OPTION_LISTW *listW; INTERNET_PER_CONN_OPTION_LISTA *listA = lpBuffer; wlen = sizeof(INTERNET_PER_CONN_OPTION_LISTW); - wbuffer = HeapAlloc( GetProcessHeap(), 0, wlen ); + wbuffer = heap_alloc(wlen); listW = wbuffer; listW->dwSize = sizeof(INTERNET_PER_CONN_OPTION_LISTW); if (listA->pszConnection) { wlen = MultiByteToWideChar( CP_ACP, 0, listA->pszConnection, -1, NULL, 0 ); - listW->pszConnection = HeapAlloc( GetProcessHeap(), 0, wlen*sizeof(WCHAR) ); + listW->pszConnection = heap_alloc(wlen*sizeof(WCHAR)); MultiByteToWideChar( CP_ACP, 0, listA->pszConnection, -1, listW->pszConnection, wlen ); } else listW->pszConnection = NULL; listW->dwOptionCount = listA->dwOptionCount; listW->dwOptionError = listA->dwOptionError; - listW->pOptions = HeapAlloc( GetProcessHeap(), 0, sizeof(INTERNET_PER_CONN_OPTIONW) * listA->dwOptionCount ); + listW->pOptions = heap_alloc(sizeof(INTERNET_PER_CONN_OPTIONW) * listA->dwOptionCount); for (i = 0; i < listA->dwOptionCount; ++i) { INTERNET_PER_CONN_OPTIONA *optA = listA->pOptions + i; @@ -2839,7 +2827,7 @@ BOOL WINAPI InternetSetOptionA(HINTERNET hInternet, DWORD dwOption, if (optA->Value.pszValue) { wlen = MultiByteToWideChar( CP_ACP, 0, optA->Value.pszValue, -1, NULL, 0 ); - optW->Value.pszValue = HeapAlloc( GetProcessHeap(), 0, wlen*sizeof(WCHAR) ); + optW->Value.pszValue = heap_alloc(wlen*sizeof(WCHAR)); MultiByteToWideChar( CP_ACP, 0, optA->Value.pszValue, -1, optW->Value.pszValue, wlen ); } else @@ -2852,6 +2840,7 @@ BOOL WINAPI InternetSetOptionA(HINTERNET hInternet, DWORD dwOption, break; case INTERNET_PER_CONN_AUTOCONFIG_LAST_DETECT_TIME: optW->Value.ftValue = optA->Value.ftValue; + break; default: WARN("Unknown PER_CONN dwOption: %d, guessing at conversion to Wide\n", optA->dwOption); optW->Value.dwValue = optA->Value.dwValue; @@ -3173,7 +3162,7 @@ BOOL WINAPI InternetCheckConnectionW( LPCWSTR lpszUrl, DWORD dwFlags, DWORD dwRe * Build our ping command */ len = WideCharToMultiByte(CP_UNIXCP, 0, hostW, -1, NULL, 0, NULL, NULL); - command = HeapAlloc( GetProcessHeap(), 0, strlen(ping)+len+strlen(redirect) ); + command = heap_alloc(strlen(ping)+len+strlen(redirect)); strcpy(command,ping); WideCharToMultiByte(CP_UNIXCP, 0, hostW, -1, command+strlen(ping), len, NULL, NULL); strcat(command,redirect); @@ -3301,7 +3290,7 @@ static HINTERNET INTERNET_InternetOpenUrlW(appinfo_t *hIC, LPCWSTR lpszUrl, WCHAR *path_extra; DWORD len = urlComponents.dwUrlPathLength + urlComponents.dwExtraInfoLength + 1; - if (!(path_extra = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)))) + if (!(path_extra = heap_alloc(len * sizeof(WCHAR)))) { InternetCloseHandle(client); break; @@ -3379,7 +3368,7 @@ HINTERNET WINAPI InternetOpenUrlW(HINTERNET hInternet, LPCWSTR lpszUrl, goto lend; } - hIC = (appinfo_t*)WININET_GetObject( hInternet ); + hIC = (appinfo_t*)get_handle_object( hInternet ); if (NULL == hIC || hIC->hdr.htype != WH_HINIT) { SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE); goto lend; @@ -3441,7 +3430,7 @@ HINTERNET WINAPI InternetOpenUrlA(HINTERNET hInternet, LPCSTR lpszUrl, if(lpszHeaders) { lenHeaders = MultiByteToWideChar(CP_ACP, 0, lpszHeaders, dwHeadersLength, NULL, 0 ); - szHeaders = HeapAlloc(GetProcessHeap(), 0, lenHeaders*sizeof(WCHAR)); + szHeaders = heap_alloc(lenHeaders*sizeof(WCHAR)); if(!szHeaders) { HeapFree(GetProcessHeap(), 0, szUrl); return NULL; @@ -3461,7 +3450,7 @@ HINTERNET WINAPI InternetOpenUrlA(HINTERNET hInternet, LPCSTR lpszUrl, static LPWITHREADERROR INTERNET_AllocThreadError(void) { - LPWITHREADERROR lpwite = HeapAlloc(GetProcessHeap(), 0, sizeof(*lpwite)); + LPWITHREADERROR lpwite = heap_alloc(sizeof(*lpwite)); if (lpwite) { @@ -3563,7 +3552,7 @@ DWORD INTERNET_AsyncCall(LPWORKREQUEST lpWorkRequest) TRACE("\n"); - lpNewRequest = HeapAlloc(GetProcessHeap(), 0, sizeof(WORKREQUEST)); + lpNewRequest = heap_alloc(sizeof(WORKREQUEST)); if (!lpNewRequest) return ERROR_OUTOFMEMORY; @@ -3682,7 +3671,7 @@ BOOL WINAPI InternetQueryDataAvailable( HINTERNET hFile, TRACE("(%p %p %x %lx)\n", hFile, lpdwNumberOfBytesAvailble, dwFlags, dwContext); - hdr = WININET_GetObject( hFile ); + hdr = get_handle_object( hFile ); if (!hdr) { SetLastError(ERROR_INVALID_HANDLE); return FALSE; @@ -3960,7 +3949,7 @@ static void convert_urlcomp_atow(LPURL_COMPONENTSA lpUrlComponents, LPURL_COMPON if (lpUrlComponents->lpszScheme) { len = URL_GET_COMP_LENGTHA(lpUrlComponents, Scheme) + 1; - urlCompW->lpszScheme = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + urlCompW->lpszScheme = heap_alloc(len * sizeof(WCHAR)); MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszScheme, -1, urlCompW->lpszScheme, len); } @@ -3968,7 +3957,7 @@ static void convert_urlcomp_atow(LPURL_COMPONENTSA lpUrlComponents, LPURL_COMPON if (lpUrlComponents->lpszHostName) { len = URL_GET_COMP_LENGTHA(lpUrlComponents, HostName) + 1; - urlCompW->lpszHostName = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + urlCompW->lpszHostName = heap_alloc(len * sizeof(WCHAR)); MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszHostName, -1, urlCompW->lpszHostName, len); } @@ -3976,7 +3965,7 @@ static void convert_urlcomp_atow(LPURL_COMPONENTSA lpUrlComponents, LPURL_COMPON if (lpUrlComponents->lpszUserName) { len = URL_GET_COMP_LENGTHA(lpUrlComponents, UserName) + 1; - urlCompW->lpszUserName = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + urlCompW->lpszUserName = heap_alloc(len * sizeof(WCHAR)); MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszUserName, -1, urlCompW->lpszUserName, len); } @@ -3984,7 +3973,7 @@ static void convert_urlcomp_atow(LPURL_COMPONENTSA lpUrlComponents, LPURL_COMPON if (lpUrlComponents->lpszPassword) { len = URL_GET_COMP_LENGTHA(lpUrlComponents, Password) + 1; - urlCompW->lpszPassword = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + urlCompW->lpszPassword = heap_alloc(len * sizeof(WCHAR)); MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszPassword, -1, urlCompW->lpszPassword, len); } @@ -3992,7 +3981,7 @@ static void convert_urlcomp_atow(LPURL_COMPONENTSA lpUrlComponents, LPURL_COMPON if (lpUrlComponents->lpszUrlPath) { len = URL_GET_COMP_LENGTHA(lpUrlComponents, UrlPath) + 1; - urlCompW->lpszUrlPath = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + urlCompW->lpszUrlPath = heap_alloc(len * sizeof(WCHAR)); MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszUrlPath, -1, urlCompW->lpszUrlPath, len); } @@ -4000,7 +3989,7 @@ static void convert_urlcomp_atow(LPURL_COMPONENTSA lpUrlComponents, LPURL_COMPON if (lpUrlComponents->lpszExtraInfo) { len = URL_GET_COMP_LENGTHA(lpUrlComponents, ExtraInfo) + 1; - urlCompW->lpszExtraInfo = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + urlCompW->lpszExtraInfo = heap_alloc(len * sizeof(WCHAR)); MultiByteToWideChar(CP_ACP, 0, lpUrlComponents->lpszExtraInfo, -1, urlCompW->lpszExtraInfo, len); } @@ -4029,7 +4018,7 @@ BOOL WINAPI InternetCreateUrlA(LPURL_COMPONENTSA lpUrlComponents, DWORD dwFlags, convert_urlcomp_atow(lpUrlComponents, &urlCompW); if (lpszUrl) - urlW = HeapAlloc(GetProcessHeap(), 0, *lpdwUrlLength * sizeof(WCHAR)); + urlW = heap_alloc(*lpdwUrlLength * sizeof(WCHAR)); ret = InternetCreateUrlW(&urlCompW, dwFlags, urlW, lpdwUrlLength); @@ -4083,7 +4072,7 @@ BOOL WINAPI InternetCreateUrlW(LPURL_COMPONENTSW lpUrlComponents, DWORD dwFlags, INTERNET_SCHEME nScheme; static const WCHAR slashSlashW[] = {'/','/'}; - static const WCHAR percentD[] = {'%','d',0}; + static const WCHAR fmtW[] = {'%','u',0}; TRACE("(%p,%d,%p,%p)\n", lpUrlComponents, dwFlags, lpszUrl, lpdwUrlLength); @@ -4170,7 +4159,7 @@ BOOL WINAPI InternetCreateUrlW(LPURL_COMPONENTSW lpUrlComponents, DWORD dwFlags, { WCHAR szPort[MAX_WORD_DIGITS+1]; - sprintfW(szPort, percentD, lpUrlComponents->nPort); + sprintfW(szPort, fmtW, lpUrlComponents->nPort); *lpszUrl = ':'; lpszUrl++; dwLen = strlenW(szPort); diff --git a/dll/win32/wininet/internet.h b/dll/win32/wininet/internet.h index 1b9aff25547..86626742b01 100644 --- a/dll/win32/wininet/internet.h +++ b/dll/win32/wininet/internet.h @@ -47,14 +47,68 @@ #define ioctlsocket ioctl #endif /* __MINGW32__ */ +extern HMODULE WININET_hModule DECLSPEC_HIDDEN; + +#ifndef INET6_ADDRSTRLEN +#define INET6_ADDRSTRLEN 46 +#endif + +typedef struct { + WCHAR *name; + INTERNET_PORT port; + struct sockaddr_storage addr; + socklen_t addr_len; + char addr_str[INET6_ADDRSTRLEN]; + + LONG ref; + DWORD64 keep_until; + + struct list entry; + struct list conn_pool; +} server_t; + +void server_addref(server_t*) DECLSPEC_HIDDEN; +void server_release(server_t*) DECLSPEC_HIDDEN; +BOOL collect_connections(BOOL) DECLSPEC_HIDDEN; + /* used for netconnection.c stuff */ typedef struct { BOOL useSSL; int socketFD; void *ssl_s; + server_t *server; DWORD security_flags; -} WININET_NETCONNECTION; + + BOOL keep_alive; + DWORD64 keep_until; + struct list pool_entry; +} netconn_t; + +static inline void * __WINE_ALLOC_SIZE(1) heap_alloc(size_t len) +{ + return HeapAlloc(GetProcessHeap(), 0, len); +} + +static inline void * __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t len) +{ + return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len); +} + +static inline void * __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, size_t len) +{ + return HeapReAlloc(GetProcessHeap(), 0, mem, len); +} + +static inline void * __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem, size_t len) +{ + return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, len); +} + +static inline BOOL heap_free(void *mem) +{ + return HeapFree(GetProcessHeap(), 0, mem); +} static inline LPWSTR heap_strdupW(LPCWSTR str) { @@ -64,7 +118,7 @@ static inline LPWSTR heap_strdupW(LPCWSTR str) DWORD size; size = (strlenW(str)+1)*sizeof(WCHAR); - ret = HeapAlloc(GetProcessHeap(), 0, size); + ret = heap_alloc(size); if(ret) memcpy(ret, str, size); } @@ -84,7 +138,7 @@ static inline LPWSTR heap_strndupW(LPCWSTR str, UINT max_len) if(str[len] == '\0') break; - ret = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*(len+1)); + ret = heap_alloc(sizeof(WCHAR)*(len+1)); if(ret) { memcpy(ret, str, sizeof(WCHAR)*len); ret[len] = '\0'; @@ -101,7 +155,7 @@ static inline WCHAR *heap_strdupAtoW(const char *str) DWORD len; len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0); - ret = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR)); + ret = heap_alloc(len*sizeof(WCHAR)); if(ret) MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len); } @@ -115,7 +169,7 @@ static inline char *heap_strdupWtoA(LPCWSTR str) if(str) { DWORD size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL); - ret = HeapAlloc(GetProcessHeap(), 0, size); + ret = heap_alloc(size); if(ret) WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL); } @@ -177,6 +231,7 @@ struct _object_header_t WH_TYPE htype; const object_vtbl_t *vtbl; HINTERNET hInternet; + BOOL valid_handle; DWORD dwFlags; DWORD_PTR dwContext; DWORD dwError; @@ -192,27 +247,24 @@ struct _object_header_t typedef struct { object_header_t hdr; - LPWSTR lpszAgent; - LPWSTR lpszProxy; - LPWSTR lpszProxyBypass; - LPWSTR lpszProxyUsername; - LPWSTR lpszProxyPassword; - DWORD dwAccessType; + LPWSTR agent; + LPWSTR proxy; + LPWSTR proxyBypass; + LPWSTR proxyUsername; + LPWSTR proxyPassword; + DWORD accessType; } appinfo_t; - typedef struct { object_header_t hdr; - appinfo_t *lpAppInfo; - LPWSTR lpszHostName; /* the final destination of the request */ - LPWSTR lpszServerName; /* the name of the server we directly connect to */ - LPWSTR lpszUserName; - LPWSTR lpszPassword; - INTERNET_PORT nHostPort; /* the final destination port of the request */ - INTERNET_PORT nServerPort; /* the port of the server we directly connect to */ - struct sockaddr_storage socketAddress; - socklen_t sa_len; + appinfo_t *appInfo; + LPWSTR hostName; /* the final destination of the request */ + LPWSTR serverName; /* the name of the server we directly connect to */ + LPWSTR userName; + LPWSTR password; + INTERNET_PORT hostPort; /* the final destination port of the request */ + INTERNET_PORT serverPort; /* the port of the server we directly connect to */ } http_session_t; #define HDR_ISREQUEST 0x0001 @@ -230,37 +282,53 @@ typedef struct struct HttpAuthInfo; -typedef struct gzip_stream_t gzip_stream_t; +typedef struct data_stream_vtbl_t data_stream_vtbl_t; + +typedef struct { + const data_stream_vtbl_t *vtbl; +} data_stream_t; + +typedef struct { + data_stream_t data_stream; + DWORD content_length; + DWORD content_read; +} netconn_stream_t; + +#define READ_BUFFER_SIZE 8192 typedef struct { object_header_t hdr; - http_session_t *lpHttpSession; - LPWSTR lpszPath; - LPWSTR lpszVerb; - LPWSTR lpszRawHeaders; - WININET_NETCONNECTION netConnection; - LPWSTR lpszVersion; - LPWSTR lpszStatusText; - DWORD dwBytesToWrite; - DWORD dwBytesWritten; - HTTPHEADERW *pCustHeaders; + http_session_t *session; + LPWSTR path; + LPWSTR verb; + LPWSTR rawHeaders; + netconn_t *netconn; + DWORD security_flags; + LPWSTR version; + LPWSTR statusText; + DWORD bytesToWrite; + DWORD bytesWritten; + HTTPHEADERW *custHeaders; DWORD nCustHeaders; + FILETIME last_modified; HANDLE hCacheFile; - LPWSTR lpszCacheFile; - struct HttpAuthInfo *pAuthInfo; - struct HttpAuthInfo *pProxyAuthInfo; + LPWSTR cacheFile; + FILETIME expires; + struct HttpAuthInfo *authInfo; + struct HttpAuthInfo *proxyAuthInfo; CRITICAL_SECTION read_section; /* section to protect the following fields */ - DWORD dwContentLength; /* total number of bytes to be read */ - DWORD dwContentRead; /* bytes of the content read so far */ + DWORD contentLength; /* total number of bytes to be read */ BOOL read_chunked; /* are we reading in chunked mode? */ + BOOL read_gzip; /* are we reading in gzip mode? */ DWORD read_pos; /* current read position in read_buf */ DWORD read_size; /* valid data size in read_buf */ - BYTE read_buf[4096]; /* buffer for already read but not returned data */ + BYTE read_buf[READ_BUFFER_SIZE]; /* buffer for already read but not returned data */ BOOL decoding; - gzip_stream_t *gzip_stream; + data_stream_t *data_stream; + netconn_stream_t netconn_stream; } http_request_t; @@ -407,65 +475,63 @@ typedef struct WORKREQ } WORKREQUEST, *LPWORKREQUEST; -HINTERNET WININET_AllocHandle( object_header_t *info ); -object_header_t *WININET_GetObject( HINTERNET hinternet ); -object_header_t *WININET_AddRef( object_header_t *info ); -BOOL WININET_Release( object_header_t *info ); -BOOL WININET_FreeHandle( HINTERNET hinternet ); +void *alloc_object(object_header_t*,const object_vtbl_t*,size_t) DECLSPEC_HIDDEN; +object_header_t *get_handle_object( HINTERNET hinternet ) DECLSPEC_HIDDEN; +object_header_t *WININET_AddRef( object_header_t *info ) DECLSPEC_HIDDEN; +BOOL WININET_Release( object_header_t *info ) DECLSPEC_HIDDEN; -DWORD INET_QueryOption( object_header_t *, DWORD, void *, DWORD *, BOOL ); +DWORD INET_QueryOption( object_header_t *, DWORD, void *, DWORD *, BOOL ) DECLSPEC_HIDDEN; -time_t ConvertTimeString(LPCWSTR asctime); +time_t ConvertTimeString(LPCWSTR asctime) DECLSPEC_HIDDEN; HINTERNET FTP_Connect(appinfo_t *hIC, LPCWSTR lpszServerName, INTERNET_PORT nServerPort, LPCWSTR lpszUserName, LPCWSTR lpszPassword, DWORD dwFlags, DWORD_PTR dwContext, - DWORD dwInternalFlags); + DWORD dwInternalFlags) DECLSPEC_HIDDEN; DWORD HTTP_Connect(appinfo_t*,LPCWSTR, INTERNET_PORT nServerPort, LPCWSTR lpszUserName, LPCWSTR lpszPassword, DWORD dwFlags, DWORD_PTR dwContext, - DWORD dwInternalFlags, HINTERNET*); + DWORD dwInternalFlags, HINTERNET*) DECLSPEC_HIDDEN; BOOL GetAddress(LPCWSTR lpszServerName, INTERNET_PORT nServerPort, - struct sockaddr *psa, socklen_t *sa_len); + struct sockaddr *psa, socklen_t *sa_len) DECLSPEC_HIDDEN; -void INTERNET_SetLastError(DWORD dwError); -DWORD INTERNET_GetLastError(void); -DWORD INTERNET_AsyncCall(LPWORKREQUEST lpWorkRequest); -LPSTR INTERNET_GetResponseBuffer(void); -LPSTR INTERNET_GetNextLine(INT nSocket, LPDWORD dwLen); +BOOL get_cookie(const WCHAR*,const WCHAR*,WCHAR*,DWORD*) DECLSPEC_HIDDEN; +BOOL set_cookie(const WCHAR*,const WCHAR*,const WCHAR*,const WCHAR*) DECLSPEC_HIDDEN; + +void INTERNET_SetLastError(DWORD dwError) DECLSPEC_HIDDEN; +DWORD INTERNET_GetLastError(void) DECLSPEC_HIDDEN; +DWORD INTERNET_AsyncCall(LPWORKREQUEST lpWorkRequest) DECLSPEC_HIDDEN; +LPSTR INTERNET_GetResponseBuffer(void) DECLSPEC_HIDDEN; +LPSTR INTERNET_GetNextLine(INT nSocket, LPDWORD dwLen) DECLSPEC_HIDDEN; VOID SendAsyncCallback(object_header_t *hdr, DWORD_PTR dwContext, DWORD dwInternetStatus, LPVOID lpvStatusInfo, - DWORD dwStatusInfoLength); + DWORD dwStatusInfoLength) DECLSPEC_HIDDEN; VOID INTERNET_SendCallback(object_header_t *hdr, DWORD_PTR dwContext, DWORD dwInternetStatus, LPVOID lpvStatusInfo, - DWORD dwStatusInfoLength); -BOOL INTERNET_FindProxyForProtocol(LPCWSTR szProxy, LPCWSTR proto, WCHAR *foundProxy, DWORD *foundProxyLen); + DWORD dwStatusInfoLength) DECLSPEC_HIDDEN; +BOOL INTERNET_FindProxyForProtocol(LPCWSTR szProxy, LPCWSTR proto, WCHAR *foundProxy, DWORD *foundProxyLen) DECLSPEC_HIDDEN; -BOOL NETCON_connected(WININET_NETCONNECTION *connection); -DWORD NETCON_init(WININET_NETCONNECTION *connnection, BOOL useSSL); -void NETCON_unload(void); -DWORD NETCON_create(WININET_NETCONNECTION *connection, int domain, - int type, int protocol); -DWORD NETCON_close(WININET_NETCONNECTION *connection); -DWORD NETCON_connect(WININET_NETCONNECTION *connection, const struct sockaddr *serv_addr, - unsigned int addrlen); -DWORD NETCON_secure_connect(WININET_NETCONNECTION *connection, LPWSTR hostname); -DWORD NETCON_send(WININET_NETCONNECTION *connection, const void *msg, size_t len, int flags, - int *sent /* out */); -DWORD NETCON_recv(WININET_NETCONNECTION *connection, void *buf, size_t len, int flags, - int *recvd /* out */); -BOOL NETCON_query_data_available(WININET_NETCONNECTION *connection, DWORD *available); -LPCVOID NETCON_GetCert(WININET_NETCONNECTION *connection); -int NETCON_GetCipherStrength(WININET_NETCONNECTION *connection); -DWORD NETCON_set_timeout(WININET_NETCONNECTION *connection, BOOL send, int value); +DWORD create_netconn(BOOL,server_t*,DWORD,netconn_t**) DECLSPEC_HIDDEN; +void free_netconn(netconn_t*) DECLSPEC_HIDDEN; +void NETCON_unload(void) DECLSPEC_HIDDEN; +DWORD NETCON_secure_connect(netconn_t *connection, LPWSTR hostname) DECLSPEC_HIDDEN; +DWORD NETCON_send(netconn_t *connection, const void *msg, size_t len, int flags, + int *sent /* out */) DECLSPEC_HIDDEN; +DWORD NETCON_recv(netconn_t *connection, void *buf, size_t len, int flags, + int *recvd /* out */) DECLSPEC_HIDDEN; +BOOL NETCON_query_data_available(netconn_t *connection, DWORD *available) DECLSPEC_HIDDEN; +BOOL NETCON_is_alive(netconn_t*) DECLSPEC_HIDDEN; +LPCVOID NETCON_GetCert(netconn_t *connection) DECLSPEC_HIDDEN; +int NETCON_GetCipherStrength(netconn_t*) DECLSPEC_HIDDEN; +DWORD NETCON_set_timeout(netconn_t *connection, BOOL send, int value) DECLSPEC_HIDDEN; #define sock_get_error(x) WSAGetLastError() -extern void URLCacheContainers_CreateDefaults(void); -extern void URLCacheContainers_DeleteAll(void); +extern void URLCacheContainers_CreateDefaults(void) DECLSPEC_HIDDEN; +extern void URLCacheContainers_DeleteAll(void) DECLSPEC_HIDDEN; #define MAX_REPLY_LEN 0x5B4 diff --git a/dll/win32/wininet/netconnection.c b/dll/win32/wininet/netconnection.c index 402cfd16a53..deca551283f 100644 --- a/dll/win32/wininet/netconnection.c +++ b/dll/win32/wininet/netconnection.c @@ -58,6 +58,9 @@ #ifdef HAVE_NETINET_IN_H # include #endif +#ifdef HAVE_NETINET_TCP_H +# include +#endif #ifdef HAVE_OPENSSL_SSL_H # include # include @@ -70,6 +73,7 @@ #include #include #include +#include #include "wine/library.h" #include "windef.h" @@ -101,16 +105,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(wininet); #include -static CRITICAL_SECTION init_ssl_cs; -static CRITICAL_SECTION_DEBUG init_ssl_cs_debug = -{ - 0, 0, &init_ssl_cs, - { &init_ssl_cs_debug.ProcessLocksList, - &init_ssl_cs_debug.ProcessLocksList }, - 0, 0, { (DWORD_PTR)(__FILE__ ": init_ssl_cs") } -}; -static CRITICAL_SECTION init_ssl_cs = { &init_ssl_cs_debug, -1, 0, 0, 0, 0 }; - static void *OpenSSL_ssl_handle; static void *OpenSSL_crypto_handle; @@ -162,6 +156,7 @@ MAKE_FUNCPTR(ERR_free_strings); MAKE_FUNCPTR(ERR_get_error); MAKE_FUNCPTR(ERR_error_string); MAKE_FUNCPTR(X509_STORE_CTX_get_ex_data); +MAKE_FUNCPTR(X509_STORE_CTX_get_chain); MAKE_FUNCPTR(i2d_X509); MAKE_FUNCPTR(sk_num); MAKE_FUNCPTR(sk_value); @@ -200,7 +195,7 @@ static PCCERT_CONTEXT X509_to_cert_context(X509 *cert) */ if (!p) { - buffer = HeapAlloc(GetProcessHeap(),0,len); + buffer = heap_alloc(len); p = buffer; len = pi2d_X509(cert,&p); } @@ -248,7 +243,8 @@ static DWORD netconn_verify_cert(PCCERT_CONTEXT cert, HCERTSTORE store, CERT_TRUST_IS_REVOKED | CERT_TRUST_IS_NOT_VALID_FOR_USAGE; - if (chain->TrustStatus.dwErrorStatus & CERT_TRUST_IS_NOT_TIME_VALID) + if (chain->TrustStatus.dwErrorStatus & CERT_TRUST_IS_NOT_TIME_VALID && + !(security_flags & SECURITY_FLAG_IGNORE_CERT_DATE_INVALID)) err = ERROR_INTERNET_SEC_CERT_DATE_INVALID; else if (chain->TrustStatus.dwErrorStatus & CERT_TRUST_IS_UNTRUSTED_ROOT && @@ -316,7 +312,7 @@ static int netconn_secure_verify(int preverify_ok, X509_STORE_CTX *ctx) BOOL ret = FALSE; HCERTSTORE store = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0, CERT_STORE_CREATE_NEW_FLAG, NULL); - WININET_NETCONNECTION *conn; + netconn_t *conn; ssl = pX509_STORE_CTX_get_ex_data(ctx, pSSL_get_ex_data_X509_STORE_CTX_idx()); @@ -327,13 +323,14 @@ static int netconn_secure_verify(int preverify_ok, X509_STORE_CTX *ctx) X509 *cert; int i; PCCERT_CONTEXT endCert = NULL; + struct stack_st *chain = (struct stack_st *)pX509_STORE_CTX_get_chain( ctx ); ret = TRUE; - for (i = 0; ret && i < psk_num((struct stack_st *)ctx->chain); i++) + for (i = 0; ret && i < psk_num(chain); i++) { PCCERT_CONTEXT context; - cert = (X509 *)psk_value((struct stack_st *)ctx->chain, i); + cert = (X509 *)psk_value(chain, i); if ((context = X509_to_cert_context(cert))) { if (i == 0) @@ -365,157 +362,206 @@ static int netconn_secure_verify(int preverify_ok, X509_STORE_CTX *ctx) #endif -DWORD NETCON_init(WININET_NETCONNECTION *connection, BOOL useSSL) +static CRITICAL_SECTION init_ssl_cs; +static CRITICAL_SECTION_DEBUG init_ssl_cs_debug = +{ + 0, 0, &init_ssl_cs, + { &init_ssl_cs_debug.ProcessLocksList, + &init_ssl_cs_debug.ProcessLocksList }, + 0, 0, { (DWORD_PTR)(__FILE__ ": init_ssl_cs") } +}; +static CRITICAL_SECTION init_ssl_cs = { &init_ssl_cs_debug, -1, 0, 0, 0, 0 }; + +static DWORD init_openssl(void) { - connection->useSSL = FALSE; - connection->socketFD = -1; - if (useSSL) - { #if defined(SONAME_LIBSSL) && defined(SONAME_LIBCRYPTO) - int i; + int i; - TRACE("using SSL connection\n"); - EnterCriticalSection(&init_ssl_cs); - if (OpenSSL_ssl_handle) /* already initialized everything */ - { - LeaveCriticalSection(&init_ssl_cs); - return ERROR_SUCCESS; - } - OpenSSL_ssl_handle = wine_dlopen(SONAME_LIBSSL, RTLD_NOW, NULL, 0); - if (!OpenSSL_ssl_handle) - { - ERR("trying to use a SSL connection, but couldn't load %s. Expect trouble.\n", - SONAME_LIBSSL); - LeaveCriticalSection(&init_ssl_cs); - return ERROR_INTERNET_SECURITY_CHANNEL_ERROR; - } - OpenSSL_crypto_handle = wine_dlopen(SONAME_LIBCRYPTO, RTLD_NOW, NULL, 0); - if (!OpenSSL_crypto_handle) - { - ERR("trying to use a SSL connection, but couldn't load %s. Expect trouble.\n", - SONAME_LIBCRYPTO); - LeaveCriticalSection(&init_ssl_cs); - return ERROR_INTERNET_SECURITY_CHANNEL_ERROR; - } + if(OpenSSL_ssl_handle) + return ERROR_SUCCESS; - /* mmm nice ugly macroness */ + OpenSSL_ssl_handle = wine_dlopen(SONAME_LIBSSL, RTLD_NOW, NULL, 0); + if(!OpenSSL_ssl_handle) { + ERR("trying to use a SSL connection, but couldn't load %s. Expect trouble.\n", SONAME_LIBSSL); + return ERROR_INTERNET_SECURITY_CHANNEL_ERROR; + } + + OpenSSL_crypto_handle = wine_dlopen(SONAME_LIBCRYPTO, RTLD_NOW, NULL, 0); + if(!OpenSSL_crypto_handle) { + ERR("trying to use a SSL connection, but couldn't load %s. Expect trouble.\n", SONAME_LIBCRYPTO); + return ERROR_INTERNET_SECURITY_CHANNEL_ERROR; + } + + /* mmm nice ugly macroness */ #define DYNSSL(x) \ p##x = wine_dlsym(OpenSSL_ssl_handle, #x, NULL, 0); \ - if (!p##x) \ - { \ + if (!p##x) { \ ERR("failed to load symbol %s\n", #x); \ - LeaveCriticalSection(&init_ssl_cs); \ return ERROR_INTERNET_SECURITY_CHANNEL_ERROR; \ } - DYNSSL(SSL_library_init); - DYNSSL(SSL_load_error_strings); - DYNSSL(SSLv23_method); - DYNSSL(SSL_CTX_free); - DYNSSL(SSL_CTX_new); - DYNSSL(SSL_new); - DYNSSL(SSL_free); - DYNSSL(SSL_set_fd); - DYNSSL(SSL_connect); - DYNSSL(SSL_shutdown); - DYNSSL(SSL_write); - DYNSSL(SSL_read); - DYNSSL(SSL_pending); - DYNSSL(SSL_get_error); - DYNSSL(SSL_get_ex_new_index); - DYNSSL(SSL_get_ex_data); - DYNSSL(SSL_set_ex_data); - DYNSSL(SSL_get_ex_data_X509_STORE_CTX_idx); - DYNSSL(SSL_get_peer_certificate); - DYNSSL(SSL_CTX_get_timeout); - DYNSSL(SSL_CTX_set_timeout); - DYNSSL(SSL_CTX_set_default_verify_paths); - DYNSSL(SSL_CTX_set_verify); - DYNSSL(SSL_get_current_cipher); - DYNSSL(SSL_CIPHER_get_bits); + DYNSSL(SSL_library_init); + DYNSSL(SSL_load_error_strings); + DYNSSL(SSLv23_method); + DYNSSL(SSL_CTX_free); + DYNSSL(SSL_CTX_new); + DYNSSL(SSL_new); + DYNSSL(SSL_free); + DYNSSL(SSL_set_fd); + DYNSSL(SSL_connect); + DYNSSL(SSL_shutdown); + DYNSSL(SSL_write); + DYNSSL(SSL_read); + DYNSSL(SSL_pending); + DYNSSL(SSL_get_error); + DYNSSL(SSL_get_ex_new_index); + DYNSSL(SSL_get_ex_data); + DYNSSL(SSL_set_ex_data); + DYNSSL(SSL_get_ex_data_X509_STORE_CTX_idx); + DYNSSL(SSL_get_peer_certificate); + DYNSSL(SSL_CTX_get_timeout); + DYNSSL(SSL_CTX_set_timeout); + DYNSSL(SSL_CTX_set_default_verify_paths); + DYNSSL(SSL_CTX_set_verify); + DYNSSL(SSL_get_current_cipher); + DYNSSL(SSL_CIPHER_get_bits); #undef DYNSSL #define DYNCRYPTO(x) \ p##x = wine_dlsym(OpenSSL_crypto_handle, #x, NULL, 0); \ - if (!p##x) \ - { \ + if (!p##x) { \ ERR("failed to load symbol %s\n", #x); \ - LeaveCriticalSection(&init_ssl_cs); \ return ERROR_INTERNET_SECURITY_CHANNEL_ERROR; \ } - DYNCRYPTO(BIO_new_fp); - DYNCRYPTO(CRYPTO_num_locks); - DYNCRYPTO(CRYPTO_set_id_callback); - DYNCRYPTO(CRYPTO_set_locking_callback); - DYNCRYPTO(ERR_free_strings); - DYNCRYPTO(ERR_get_error); - DYNCRYPTO(ERR_error_string); - DYNCRYPTO(X509_STORE_CTX_get_ex_data); - DYNCRYPTO(i2d_X509); - DYNCRYPTO(sk_num); - DYNCRYPTO(sk_value); + + DYNCRYPTO(BIO_new_fp); + DYNCRYPTO(CRYPTO_num_locks); + DYNCRYPTO(CRYPTO_set_id_callback); + DYNCRYPTO(CRYPTO_set_locking_callback); + DYNCRYPTO(ERR_free_strings); + DYNCRYPTO(ERR_get_error); + DYNCRYPTO(ERR_error_string); + DYNCRYPTO(X509_STORE_CTX_get_ex_data); + DYNCRYPTO(X509_STORE_CTX_get_chain); + DYNCRYPTO(i2d_X509); + DYNCRYPTO(sk_num); + DYNCRYPTO(sk_value); #undef DYNCRYPTO - pSSL_library_init(); - pSSL_load_error_strings(); - pBIO_new_fp(stderr, BIO_NOCLOSE); /* FIXME: should use winedebug stuff */ + pSSL_library_init(); + pSSL_load_error_strings(); + pBIO_new_fp(stderr, BIO_NOCLOSE); /* FIXME: should use winedebug stuff */ - meth = pSSLv23_method(); - ctx = pSSL_CTX_new(meth); - if (!pSSL_CTX_set_default_verify_paths(ctx)) - { - ERR("SSL_CTX_set_default_verify_paths failed: %s\n", - pERR_error_string(pERR_get_error(), 0)); - LeaveCriticalSection(&init_ssl_cs); - return ERROR_OUTOFMEMORY; - } - hostname_idx = pSSL_get_ex_new_index(0, (void *)"hostname index", - NULL, NULL, NULL); - if (hostname_idx == -1) - { - ERR("SSL_get_ex_new_index failed; %s\n", - pERR_error_string(pERR_get_error(), 0)); - LeaveCriticalSection(&init_ssl_cs); - return ERROR_OUTOFMEMORY; - } - error_idx = pSSL_get_ex_new_index(0, (void *)"error index", - NULL, NULL, NULL); - if (error_idx == -1) - { - ERR("SSL_get_ex_new_index failed; %s\n", - pERR_error_string(pERR_get_error(), 0)); - LeaveCriticalSection(&init_ssl_cs); - return ERROR_OUTOFMEMORY; - } - conn_idx = pSSL_get_ex_new_index(0, (void *)"netconn index", - NULL, NULL, NULL); - if (conn_idx == -1) - { - ERR("SSL_get_ex_new_index failed; %s\n", - pERR_error_string(pERR_get_error(), 0)); - LeaveCriticalSection(&init_ssl_cs); - return ERROR_OUTOFMEMORY; - } - pSSL_CTX_set_verify(ctx, SSL_VERIFY_PEER, netconn_secure_verify); - - pCRYPTO_set_id_callback(ssl_thread_id); - num_ssl_locks = pCRYPTO_num_locks(); - ssl_locks = HeapAlloc(GetProcessHeap(), 0, num_ssl_locks * sizeof(CRITICAL_SECTION)); - if (!ssl_locks) - { - LeaveCriticalSection(&init_ssl_cs); - return ERROR_OUTOFMEMORY; - } - for (i = 0; i < num_ssl_locks; i++) - InitializeCriticalSection(&ssl_locks[i]); - pCRYPTO_set_locking_callback(ssl_lock_callback); - LeaveCriticalSection(&init_ssl_cs); -#else - FIXME("can't use SSL, not compiled in.\n"); - return ERROR_INTERNET_SECURITY_CHANNEL_ERROR; -#endif + meth = pSSLv23_method(); + ctx = pSSL_CTX_new(meth); + if(!pSSL_CTX_set_default_verify_paths(ctx)) { + ERR("SSL_CTX_set_default_verify_paths failed: %s\n", + pERR_error_string(pERR_get_error(), 0)); + return ERROR_OUTOFMEMORY; } + + hostname_idx = pSSL_get_ex_new_index(0, (void *)"hostname index", NULL, NULL, NULL); + if(hostname_idx == -1) { + ERR("SSL_get_ex_new_index failed; %s\n", pERR_error_string(pERR_get_error(), 0)); + return ERROR_OUTOFMEMORY; + } + + error_idx = pSSL_get_ex_new_index(0, (void *)"error index", NULL, NULL, NULL); + if(error_idx == -1) { + ERR("SSL_get_ex_new_index failed; %s\n", pERR_error_string(pERR_get_error(), 0)); + return ERROR_OUTOFMEMORY; + } + + conn_idx = pSSL_get_ex_new_index(0, (void *)"netconn index", NULL, NULL, NULL); + if(conn_idx == -1) { + ERR("SSL_get_ex_new_index failed; %s\n", pERR_error_string(pERR_get_error(), 0)); + return ERROR_OUTOFMEMORY; + } + + pSSL_CTX_set_verify(ctx, SSL_VERIFY_PEER, netconn_secure_verify); + + pCRYPTO_set_id_callback(ssl_thread_id); + num_ssl_locks = pCRYPTO_num_locks(); + ssl_locks = HeapAlloc(GetProcessHeap(), 0, num_ssl_locks * sizeof(CRITICAL_SECTION)); + if(!ssl_locks) + return ERROR_OUTOFMEMORY; + + for(i = 0; i < num_ssl_locks; i++) + InitializeCriticalSection(&ssl_locks[i]); + pCRYPTO_set_locking_callback(ssl_lock_callback); + return ERROR_SUCCESS; +#else + FIXME("can't use SSL, not compiled in.\n"); + return ERROR_INTERNET_SECURITY_CHANNEL_ERROR; +#endif +} + +DWORD create_netconn(BOOL useSSL, server_t *server, DWORD security_flags, netconn_t **ret) +{ + netconn_t *netconn; + int result, flag; + + if(useSSL) { + DWORD res; + + TRACE("using SSL connection\n"); + + EnterCriticalSection(&init_ssl_cs); + res = init_openssl(); + LeaveCriticalSection(&init_ssl_cs); + if(res != ERROR_SUCCESS) + return res; + } + + netconn = heap_alloc_zero(sizeof(*netconn)); + if(!netconn) + return ERROR_OUTOFMEMORY; + + netconn->useSSL = useSSL; + netconn->socketFD = -1; + netconn->security_flags = security_flags; + list_init(&netconn->pool_entry); + + assert(server->addr_len); + result = netconn->socketFD = socket(server->addr.ss_family, SOCK_STREAM, 0); + if(result != -1) { + result = connect(netconn->socketFD, (struct sockaddr*)&server->addr, server->addr_len); + if(result == -1) + closesocket(netconn->socketFD); + } + if(result == -1) { + heap_free(netconn); + return sock_get_error(errno); + } + +#ifdef TCP_NODELAY + flag = 1; + result = setsockopt(netconn->socketFD, IPPROTO_TCP, TCP_NODELAY, (void*)&flag, sizeof(flag)); + if(result < 0) + WARN("setsockopt(TCP_NODELAY) failed\n"); +#endif + + server_addref(server); + netconn->server = server; + + *ret = netconn; + return ERROR_SUCCESS; +} + +void free_netconn(netconn_t *netconn) +{ + server_release(netconn->server); + +#ifdef SONAME_LIBSSL + if (netconn->ssl_s) { + pSSL_shutdown(netconn->ssl_s); + pSSL_free(netconn->ssl_s); + } +#endif + + closesocket(netconn->socketFD); + heap_free(netconn); } void NETCON_unload(void) @@ -541,14 +587,6 @@ void NETCON_unload(void) #endif } -BOOL NETCON_connected(WININET_NETCONNECTION *connection) -{ - if (connection->socketFD == -1) - return FALSE; - else - return TRUE; -} - #if 0 /* translate a unix error code into a winsock one */ int sock_get_error( int err ) @@ -618,80 +656,32 @@ int sock_get_error( int err ) } #endif -/****************************************************************************** - * NETCON_create - * Basically calls 'socket()' - */ -DWORD NETCON_create(WININET_NETCONNECTION *connection, int domain, - int type, int protocol) -{ -#ifdef SONAME_LIBSSL - if (connection->useSSL) - return ERROR_NOT_SUPPORTED; -#endif - - connection->socketFD = socket(domain, type, protocol); - if (connection->socketFD == -1) - return sock_get_error(errno); - - return ERROR_SUCCESS; -} - -/****************************************************************************** - * NETCON_close - * Basically calls 'close()' unless we should use SSL - */ -DWORD NETCON_close(WININET_NETCONNECTION *connection) -{ - int result; - - if (!NETCON_connected(connection)) return ERROR_SUCCESS; - -#ifdef SONAME_LIBSSL - if (connection->useSSL) - { - pSSL_shutdown(connection->ssl_s); - pSSL_free(connection->ssl_s); - connection->ssl_s = NULL; - - connection->useSSL = FALSE; - } -#endif - - result = closesocket(connection->socketFD); - connection->socketFD = -1; - - if (result == -1) - return sock_get_error(errno); - return ERROR_SUCCESS; -} - /****************************************************************************** * NETCON_secure_connect * Initiates a secure connection over an existing plaintext connection. */ -DWORD NETCON_secure_connect(WININET_NETCONNECTION *connection, LPWSTR hostname) +DWORD NETCON_secure_connect(netconn_t *connection, LPWSTR hostname) { + void *ssl_s; DWORD res = ERROR_NOT_SUPPORTED; #ifdef SONAME_LIBSSL /* can't connect if we are already connected */ - if (connection->useSSL) + if (connection->ssl_s) { ERR("already connected\n"); return ERROR_INTERNET_CANNOT_CONNECT; } - connection->ssl_s = pSSL_new(ctx); - if (!connection->ssl_s) + ssl_s = pSSL_new(ctx); + if (!ssl_s) { ERR("SSL_new failed: %s\n", pERR_error_string(pERR_get_error(), 0)); - res = ERROR_OUTOFMEMORY; - goto fail; + return ERROR_OUTOFMEMORY; } - if (!pSSL_set_fd(connection->ssl_s, connection->socketFD)) + if (!pSSL_set_fd(ssl_s, connection->socketFD)) { ERR("SSL_set_fd failed: %s\n", pERR_error_string(pERR_get_error(), 0)); @@ -699,74 +689,50 @@ DWORD NETCON_secure_connect(WININET_NETCONNECTION *connection, LPWSTR hostname) goto fail; } - if (!pSSL_set_ex_data(connection->ssl_s, hostname_idx, hostname)) + if (!pSSL_set_ex_data(ssl_s, hostname_idx, hostname)) { ERR("SSL_set_ex_data failed: %s\n", pERR_error_string(pERR_get_error(), 0)); res = ERROR_INTERNET_SECURITY_CHANNEL_ERROR; goto fail; } - if (!pSSL_set_ex_data(connection->ssl_s, conn_idx, connection)) + if (!pSSL_set_ex_data(ssl_s, conn_idx, connection)) { ERR("SSL_set_ex_data failed: %s\n", pERR_error_string(pERR_get_error(), 0)); res = ERROR_INTERNET_SECURITY_CHANNEL_ERROR; goto fail; } - if (pSSL_connect(connection->ssl_s) <= 0) + if (pSSL_connect(ssl_s) <= 0) { - res = (DWORD_PTR)pSSL_get_ex_data(connection->ssl_s, error_idx); + res = (DWORD_PTR)pSSL_get_ex_data(ssl_s, error_idx); if (!res) res = ERROR_INTERNET_SECURITY_CHANNEL_ERROR; ERR("SSL_connect failed: %d\n", res); goto fail; } - connection->useSSL = TRUE; + connection->ssl_s = ssl_s; return ERROR_SUCCESS; fail: - if (connection->ssl_s) + if (ssl_s) { - pSSL_shutdown(connection->ssl_s); - pSSL_free(connection->ssl_s); - connection->ssl_s = NULL; + pSSL_shutdown(ssl_s); + pSSL_free(ssl_s); } #endif return res; } -/****************************************************************************** - * NETCON_connect - * Connects to the specified address. - */ -DWORD NETCON_connect(WININET_NETCONNECTION *connection, const struct sockaddr *serv_addr, - unsigned int addrlen) -{ - int result; - - result = connect(connection->socketFD, serv_addr, addrlen); - if (result == -1) - { - WARN("Unable to connect to host (%s)\n", strerror(errno)); - - closesocket(connection->socketFD); - connection->socketFD = -1; - return sock_get_error(errno); - } - - return ERROR_SUCCESS; -} - /****************************************************************************** * NETCON_send * Basically calls 'send()' unless we should use SSL * number of chars send is put in *sent */ -DWORD NETCON_send(WININET_NETCONNECTION *connection, const void *msg, size_t len, int flags, +DWORD NETCON_send(netconn_t *connection, const void *msg, size_t len, int flags, int *sent /* out */) { - if (!NETCON_connected(connection)) return ERROR_INTERNET_CONNECTION_ABORTED; if (!connection->useSSL) { *sent = send(connection->socketFD, msg, len, flags); @@ -777,6 +743,10 @@ DWORD NETCON_send(WININET_NETCONNECTION *connection, const void *msg, size_t len else { #ifdef SONAME_LIBSSL + if(!connection->ssl_s) { + FIXME("not connected\n"); + return ERROR_NOT_SUPPORTED; + } if (flags) FIXME("SSL_write doesn't support any flags (%08x)\n", flags); *sent = pSSL_write(connection->ssl_s, msg, len); @@ -794,31 +764,30 @@ DWORD NETCON_send(WININET_NETCONNECTION *connection, const void *msg, size_t len * Basically calls 'recv()' unless we should use SSL * number of chars received is put in *recvd */ -DWORD NETCON_recv(WININET_NETCONNECTION *connection, void *buf, size_t len, int flags, +DWORD NETCON_recv(netconn_t *connection, void *buf, size_t len, int flags, int *recvd /* out */) { *recvd = 0; - if (!NETCON_connected(connection)) return ERROR_INTERNET_CONNECTION_ABORTED; if (!len) return ERROR_SUCCESS; if (!connection->useSSL) { *recvd = recv(connection->socketFD, buf, len, flags); - if(!*recvd) - NETCON_close(connection); return *recvd == -1 ? sock_get_error(errno) : ERROR_SUCCESS; } else { #ifdef SONAME_LIBSSL + if(!connection->ssl_s) { + FIXME("not connected\n"); + return ERROR_NOT_SUPPORTED; + } *recvd = pSSL_read(connection->ssl_s, buf, len); /* Check if EOF was received */ if(!*recvd && (pSSL_get_error(connection->ssl_s, *recvd)==SSL_ERROR_ZERO_RETURN - || pSSL_get_error(connection->ssl_s, *recvd)==SSL_ERROR_SYSCALL)) { - NETCON_close(connection); + || pSSL_get_error(connection->ssl_s, *recvd)==SSL_ERROR_SYSCALL)) return ERROR_SUCCESS; - } return *recvd > 0 ? ERROR_SUCCESS : ERROR_INTERNET_CONNECTION_ABORTED; #else @@ -832,11 +801,9 @@ DWORD NETCON_recv(WININET_NETCONNECTION *connection, void *buf, size_t len, int * Returns the number of bytes of peeked data plus the number of bytes of * queued, but unread data. */ -BOOL NETCON_query_data_available(WININET_NETCONNECTION *connection, DWORD *available) +BOOL NETCON_query_data_available(netconn_t *connection, DWORD *available) { *available = 0; - if (!NETCON_connected(connection)) - return FALSE; if (!connection->useSSL) { @@ -853,19 +820,49 @@ BOOL NETCON_query_data_available(WININET_NETCONNECTION *connection, DWORD *avail else { #ifdef SONAME_LIBSSL - *available = pSSL_pending(connection->ssl_s); + *available = connection->ssl_s ? pSSL_pending(connection->ssl_s) : 0; #endif } return TRUE; } -LPCVOID NETCON_GetCert(WININET_NETCONNECTION *connection) +BOOL NETCON_is_alive(netconn_t *netconn) +{ +#ifdef MSG_DONTWAIT + ssize_t len; + BYTE b; + + len = recv(netconn->socketFD, &b, 1, MSG_PEEK|MSG_DONTWAIT); + return len == 1 || (len == -1 && errno == EWOULDBLOCK); +#elif defined(__MINGW32__) || defined(_MSC_VER) + ULONG mode; + int len; + char b; + + mode = 1; + if(!ioctlsocket(netconn->socketFD, FIONBIO, &mode)) + return FALSE; + + len = recv(netconn->socketFD, &b, 1, MSG_PEEK); + + mode = 0; + if(!ioctlsocket(netconn->socketFD, FIONBIO, &mode)) + return FALSE; + + return len == 1 || (len == -1 && errno == WSAEWOULDBLOCK); +#else + FIXME("not supported on this platform\n"); + return TRUE; +#endif +} + +LPCVOID NETCON_GetCert(netconn_t *connection) { #ifdef SONAME_LIBSSL X509* cert; LPCVOID r = NULL; - if (!connection->useSSL) + if (!connection->ssl_s) return NULL; cert = pSSL_get_peer_certificate(connection->ssl_s); @@ -876,7 +873,7 @@ LPCVOID NETCON_GetCert(WININET_NETCONNECTION *connection) #endif } -int NETCON_GetCipherStrength(WININET_NETCONNECTION *connection) +int NETCON_GetCipherStrength(netconn_t *connection) { #ifdef SONAME_LIBSSL #if defined(OPENSSL_VERSION_NUMBER) && (OPENSSL_VERSION_NUMBER >= 0x0090707f) @@ -886,7 +883,7 @@ int NETCON_GetCipherStrength(WININET_NETCONNECTION *connection) #endif int bits = 0; - if (!connection->useSSL) + if (!connection->ssl_s) return 0; cipher = pSSL_get_current_cipher(connection->ssl_s); if (!cipher) @@ -898,16 +895,11 @@ int NETCON_GetCipherStrength(WININET_NETCONNECTION *connection) #endif } -DWORD NETCON_set_timeout(WININET_NETCONNECTION *connection, BOOL send, int value) +DWORD NETCON_set_timeout(netconn_t *connection, BOOL send, int value) { int result; struct timeval tv; - /* FIXME: we should probably store the timeout in the connection to set - * when we do connect */ - if (!NETCON_connected(connection)) - return ERROR_SUCCESS; - /* value is in milliseconds, convert to struct timeval */ tv.tv_sec = value / 1000; tv.tv_usec = (value % 1000) * 1000; diff --git a/dll/win32/wininet/resource.h b/dll/win32/wininet/resource.h index 279c1123db8..256a374af08 100644 --- a/dll/win32/wininet/resource.h +++ b/dll/win32/wininet/resource.h @@ -21,6 +21,7 @@ #include #include +#define IDD_INVCERTDLG 0x398 #define IDD_AUTHDLG 0x399 #define IDD_PROXYDLG 0x400 @@ -30,5 +31,10 @@ #define IDC_PASSWORD 0x404 #define IDC_SAVEPASSWORD 0x405 #define IDC_SERVER 0x406 +#define IDC_CERT_ERROR 0x407 #define IDS_LANCONNECTION 0x500 +#define IDS_CERT_CA_INVALID 0x501 +#define IDS_CERT_DATE_INVALID 0x502 +#define IDS_CERT_CN_INVALID 0x503 +#define IDS_CERT_ERRORS 0x504 diff --git a/dll/win32/wininet/rsrc.rc b/dll/win32/wininet/rsrc.rc index b936ed9e843..24b8f3bb0b2 100644 --- a/dll/win32/wininet/rsrc.rc +++ b/dll/win32/wininet/rsrc.rc @@ -45,14 +45,16 @@ #include "wininet_Da.rc" #include "wininet_En.rc" #include "wininet_Es.rc" +#include "wininet_Eo.rc" #include "wininet_Fi.rc" +#include "wininet_He.rc" #include "wininet_Hu.rc" #include "wininet_It.rc" #include "wininet_Ko.rc" #include "wininet_Nl.rc" #include "wininet_Pl.rc" +#include "wininet_Sr.rc" #include "wininet_Sv.rc" -#include "wininet_Uk.rc" #include "wininet_Tr.rc" /* UTF-8 */ @@ -65,5 +67,6 @@ #include "wininet_Ro.rc" #include "wininet_Ru.rc" #include "wininet_Si.rc" +#include "wininet_Uk.rc" #include "wininet_Zh.rc" diff --git a/dll/win32/wininet/urlcache.c b/dll/win32/wininet/urlcache.c index 63a160d4a29..5d9034804c2 100644 --- a/dll/win32/wininet/urlcache.c +++ b/dll/win32/wininet/urlcache.c @@ -48,10 +48,12 @@ #include "wininet.h" #include "winineti.h" #include "winerror.h" -#include "internet.h" #include "winreg.h" #include "shlwapi.h" #include "shlobj.h" +#include "shellapi.h" + +#include "internet.h" #include "wine/unicode.h" #include "wine/debug.h" @@ -96,8 +98,7 @@ typedef struct _URL_CACHEFILE_ENTRY WORD wExpiredDate; /* expire date in dos format */ WORD wExpiredTime; /* expire time in dos format */ DWORD dwUnknown1; /* usually zero */ - DWORD dwSizeLow; /* see INTERNET_CACHE_ENTRY_INFO::dwSizeLow */ - DWORD dwSizeHigh; /* see INTERNET_CACHE_ENTRY_INFO::dwSizeHigh */ + ULARGE_INTEGER size; /* see INTERNET_CACHE_ENTRY_INFO::dwSizeLow/High */ DWORD dwUnknown2; /* usually zero */ DWORD dwExemptDelta; /* see INTERNET_CACHE_ENTRY_INFO::dwExemptDelta */ DWORD dwUnknown3; /* usually 0x60 */ @@ -142,7 +143,7 @@ typedef struct _HASH_CACHEFILE_ENTRY typedef struct _DIRECTORY_DATA { - DWORD dwUnknown; + DWORD dwNumFiles; char filename[DIR_LENGTH]; } DIRECTORY_DATA; @@ -154,14 +155,10 @@ typedef struct _URLCACHE_HEADER DWORD dwIndexCapacityInBlocks; DWORD dwBlocksInUse; DWORD dwUnknown1; - DWORD dwCacheLimitLow; /* disk space limit for cache */ - DWORD dwCacheLimitHigh; /* disk space limit for cache */ - DWORD dwUnknown4; /* current disk space usage for cache */ - DWORD dwUnknown5; /* current disk space usage for cache */ - DWORD dwUnknown6; /* possibly a flag? */ - DWORD dwUnknown7; - BYTE DirectoryCount; /* number of directory_data's */ - BYTE Unknown8[3]; /* just padding? */ + ULARGE_INTEGER CacheLimit; + ULARGE_INTEGER CacheUsage; + ULARGE_INTEGER ExemptUsage; + DWORD DirectoryCount; /* number of directory_data's */ DIRECTORY_DATA directory_data[1]; /* first directory entry */ } URLCACHE_HEADER, *LPURLCACHE_HEADER; typedef const URLCACHE_HEADER *LPCURLCACHE_HEADER; @@ -227,8 +224,12 @@ static DWORD URLCacheContainer_OpenIndex(URLCACHECONTAINER * pContainer) static const WCHAR wszIndex[] = {'i','n','d','e','x','.','d','a','t',0}; static const WCHAR wszMappingFormat[] = {'%','s','%','s','_','%','l','u',0}; - if (pContainer->hMapping) + WaitForSingleObject(pContainer->hMutex, INFINITE); + + if (pContainer->hMapping) { + ReleaseMutex(pContainer->hMutex); return ERROR_SUCCESS; + } strcpyW(wszFilePath, pContainer->path); strcatW(wszFilePath, wszIndex); @@ -243,14 +244,10 @@ static DWORD URLCacheContainer_OpenIndex(URLCACHECONTAINER * pContainer) if (hFile == INVALID_HANDLE_VALUE) { TRACE("Could not open or create cache index file \"%s\"\n", debugstr_w(wszFilePath)); + ReleaseMutex(pContainer->hMutex); return GetLastError(); } - /* At this stage we need the mutex because we may be about to create the - * file. - */ - WaitForSingleObject(pContainer->hMutex, INFINITE); - dwFileSize = GetFileSize(hFile, NULL); if (dwFileSize == INVALID_FILE_SIZE) { @@ -313,8 +310,7 @@ static DWORD URLCacheContainer_OpenIndex(URLCACHECONTAINER * pContainer) pHeader->dwFileSize = dwFileSize; pHeader->dwIndexCapacityInBlocks = NEWFILE_NUM_BLOCKS; /* 127MB - taken from default for Windows 2000 */ - pHeader->dwCacheLimitHigh = 0; - pHeader->dwCacheLimitLow = 0x07ff5400; + pHeader->CacheLimit.QuadPart = 0x07ff5400; /* Copied from a Windows 2000 cache index */ pHeader->DirectoryCount = 4; @@ -329,8 +325,7 @@ static DWORD URLCacheContainer_OpenIndex(URLCACHECONTAINER * pContainer) (BYTE *) &dw, &len) == ERROR_SUCCESS && keytype == REG_DWORD) { - pHeader->dwCacheLimitHigh = (dw >> 22); - pHeader->dwCacheLimitLow = dw << 10; + pHeader->CacheLimit.QuadPart = (ULONGLONG)dw * 1024; } RegCloseKey(key); } @@ -347,12 +342,7 @@ static DWORD URLCacheContainer_OpenIndex(URLCACHECONTAINER * pContainer) for (i = 0; !dwError && i < pHeader->DirectoryCount; ++i) { - /* The following values were copied from a Windows index. - * I don't know what the values are supposed to mean but - * have made them the same in the hope that this will - * be better for compatibility - */ - pHeader->directory_data[i].dwUnknown = (i > 1) ? 0xfe : 0xff; + pHeader->directory_data[i].dwNumFiles = 0; for (j = 0;; ++j) { int k; @@ -430,8 +420,6 @@ static DWORD URLCacheContainer_OpenIndex(URLCACHECONTAINER * pContainer) } - ReleaseMutex(pContainer->hMutex); - wsprintfW(wszFilePath, wszMappingFormat, pContainer->path, wszIndex, dwFileSize); URLCache_PathToObjectName(wszFilePath, '_'); pContainer->hMapping = OpenFileMappingW(FILE_MAP_WRITE, FALSE, wszFilePath); @@ -441,9 +429,12 @@ static DWORD URLCacheContainer_OpenIndex(URLCACHECONTAINER * pContainer) if (!pContainer->hMapping) { ERR("Couldn't create file mapping (error is %d)\n", GetLastError()); + ReleaseMutex(pContainer->hMutex); return GetLastError(); } + ReleaseMutex(pContainer->hMutex); + return ERROR_SUCCESS; } @@ -464,7 +455,7 @@ static void URLCacheContainer_CloseIndex(URLCACHECONTAINER * pContainer) static BOOL URLCacheContainers_AddContainer(LPCWSTR cache_prefix, LPCWSTR path, LPWSTR mutex_name) { - URLCACHECONTAINER * pContainer = HeapAlloc(GetProcessHeap(), 0, sizeof(URLCACHECONTAINER)); + URLCACHECONTAINER * pContainer = heap_alloc(sizeof(URLCACHECONTAINER)); int cache_prefix_len = strlenW(cache_prefix); if (!pContainer) @@ -482,7 +473,7 @@ static BOOL URLCacheContainers_AddContainer(LPCWSTR cache_prefix, LPCWSTR path, return FALSE; } - pContainer->cache_prefix = HeapAlloc(GetProcessHeap(), 0, (cache_prefix_len + 1) * sizeof(WCHAR)); + pContainer->cache_prefix = heap_alloc((cache_prefix_len + 1) * sizeof(WCHAR)); if (!pContainer->cache_prefix) { HeapFree(GetProcessHeap(), 0, pContainer->path); @@ -884,7 +875,7 @@ static BOOL URLCache_LocalFileNameToPathW( } nRequired = (path_len + DIR_LENGTH + file_name_len + 1) * sizeof(WCHAR); - if (nRequired < *lpBufferSize) + if (nRequired <= *lpBufferSize) { int dir_len; @@ -946,6 +937,18 @@ static BOOL URLCache_LocalFileNameToPathA( return FALSE; } +/* Just like DosDateTimeToFileTime, except that it also maps the special + * case of a DOS date/time of (0,0) to a filetime of (0,0). + */ +static void URLCache_DosDateTimeToFileTime(WORD fatdate, WORD fattime, + FILETIME *ft) +{ + if (!fatdate && !fattime) + ft->dwLowDateTime = ft->dwHighDateTime = 0; + else + DosDateTimeToFileTime(fatdate, fattime, ft); +} + /*********************************************************************** * URLCache_CopyEntry (Internal) * @@ -977,16 +980,16 @@ static DWORD URLCache_CopyEntry( lpCacheEntryInfo->u.dwExemptDelta = pUrlEntry->dwExemptDelta; lpCacheEntryInfo->dwHeaderInfoSize = pUrlEntry->dwHeaderInfoSize; lpCacheEntryInfo->dwHitRate = pUrlEntry->dwHitRate; - lpCacheEntryInfo->dwSizeHigh = pUrlEntry->dwSizeHigh; - lpCacheEntryInfo->dwSizeLow = pUrlEntry->dwSizeLow; + lpCacheEntryInfo->dwSizeHigh = pUrlEntry->size.u.HighPart; + lpCacheEntryInfo->dwSizeLow = pUrlEntry->size.u.LowPart; lpCacheEntryInfo->dwStructSize = sizeof(*lpCacheEntryInfo); lpCacheEntryInfo->dwUseCount = pUrlEntry->dwUseCount; - DosDateTimeToFileTime(pUrlEntry->wExpiredDate, pUrlEntry->wExpiredTime, &lpCacheEntryInfo->ExpireTime); + URLCache_DosDateTimeToFileTime(pUrlEntry->wExpiredDate, pUrlEntry->wExpiredTime, &lpCacheEntryInfo->ExpireTime); lpCacheEntryInfo->LastAccessTime.dwHighDateTime = pUrlEntry->LastAccessTime.dwHighDateTime; lpCacheEntryInfo->LastAccessTime.dwLowDateTime = pUrlEntry->LastAccessTime.dwLowDateTime; lpCacheEntryInfo->LastModifiedTime.dwHighDateTime = pUrlEntry->LastModifiedTime.dwHighDateTime; lpCacheEntryInfo->LastModifiedTime.dwLowDateTime = pUrlEntry->LastModifiedTime.dwLowDateTime; - DosDateTimeToFileTime(pUrlEntry->wLastSyncDate, pUrlEntry->wLastSyncTime, &lpCacheEntryInfo->LastSyncTime); + URLCache_DosDateTimeToFileTime(pUrlEntry->wLastSyncDate, pUrlEntry->wLastSyncTime, &lpCacheEntryInfo->LastSyncTime); } if ((dwRequiredSize % 4) && (dwRequiredSize < *lpdwBufferSize)) @@ -1076,6 +1079,17 @@ static DWORD URLCache_CopyEntry( return ERROR_SUCCESS; } +/* Just like FileTimeToDosDateTime, except that it also maps the special + * case of a filetime of (0,0) to a DOS date/time of (0,0). + */ +static void URLCache_FileTimeToDosDateTime(const FILETIME *ft, WORD *fatdate, + WORD *fattime) +{ + if (!ft->dwLowDateTime && !ft->dwHighDateTime) + *fatdate = *fattime = 0; + else + FileTimeToDosDateTime(ft, fatdate, fattime); +} /*********************************************************************** * URLCache_SetEntryInfo (Internal) @@ -1097,7 +1111,7 @@ static DWORD URLCache_SetEntryInfo(URL_CACHEFILE_ENTRY * pUrlEntry, const INTERN if (dwFieldControl & CACHE_ENTRY_EXEMPT_DELTA_FC) pUrlEntry->dwExemptDelta = lpCacheEntryInfo->u.dwExemptDelta; if (dwFieldControl & CACHE_ENTRY_EXPTIME_FC) - FIXME("CACHE_ENTRY_EXPTIME_FC unimplemented\n"); + URLCache_FileTimeToDosDateTime(&lpCacheEntryInfo->ExpireTime, &pUrlEntry->wExpiredDate, &pUrlEntry->wExpiredTime); if (dwFieldControl & CACHE_ENTRY_HEADERINFO_FC) FIXME("CACHE_ENTRY_HEADERINFO_FC unimplemented\n"); if (dwFieldControl & CACHE_ENTRY_HITRATE_FC) @@ -1105,7 +1119,7 @@ static DWORD URLCache_SetEntryInfo(URL_CACHEFILE_ENTRY * pUrlEntry, const INTERN if (dwFieldControl & CACHE_ENTRY_MODTIME_FC) pUrlEntry->LastModifiedTime = lpCacheEntryInfo->LastModifiedTime; if (dwFieldControl & CACHE_ENTRY_SYNCTIME_FC) - FileTimeToDosDateTime(&lpCacheEntryInfo->LastAccessTime, &pUrlEntry->wLastSyncDate, &pUrlEntry->wLastSyncTime); + URLCache_FileTimeToDosDateTime(&lpCacheEntryInfo->LastAccessTime, &pUrlEntry->wLastSyncDate, &pUrlEntry->wLastSyncTime); return ERROR_SUCCESS; } @@ -1456,25 +1470,102 @@ static BOOL URLCache_EnumHashTableEntries(LPCURLCACHE_HEADER pHeader, const HASH } /*********************************************************************** - * FreeUrlCacheSpaceA (WININET.@) + * URLCache_DeleteCacheDirectory (Internal) + * + * Erase a directory containing an URL cache. + * + * RETURNS + * TRUE success, FALSE failure/aborted. * */ -BOOL WINAPI FreeUrlCacheSpaceA(LPCSTR lpszCachePath, DWORD dwSize, DWORD dwFilter) +static BOOL URLCache_DeleteCacheDirectory(LPCWSTR lpszPath) { - FIXME("stub!\n"); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + DWORD path_len; + WCHAR path[MAX_PATH + 1]; + SHFILEOPSTRUCTW shfos; + int ret; + + path_len = strlenW(lpszPath); + if (path_len >= MAX_PATH) + return FALSE; + strcpyW(path, lpszPath); + path[path_len + 1] = 0; /* double-NUL-terminate path */ + + shfos.hwnd = NULL; + shfos.wFunc = FO_DELETE; + shfos.pFrom = path; + shfos.pTo = NULL; + shfos.fFlags = 0; + shfos.fAnyOperationsAborted = FALSE; + ret = SHFileOperationW(&shfos); + if (ret) + ERR("SHFileOperationW on %s returned %i\n", debugstr_w(path), ret); + return !(ret || shfos.fAnyOperationsAborted); +} + +/*********************************************************************** + * FreeUrlCacheSpaceW (WININET.@) + * + * Frees up some cache. + * + * PARAMETERS + * lpszCachePath [I] Which volume to free up from, or NULL if you don't care. + * dwSize [I] How much space to free up. + * dwSizeType [I] How to interpret dwSize. + * + * RETURNS + * TRUE success. FALSE failure. + * + * IMPLEMENTATION + * This implementation just retrieves the path of the cache directory, and + * deletes its contents from the filesystem. The correct approach would + * probably be to implement and use {FindFirst,FindNext,Delete}UrlCacheGroup(). + */ +BOOL WINAPI FreeUrlCacheSpaceW(LPCWSTR lpszCachePath, DWORD dwSize, DWORD dwSizeType) +{ + URLCACHECONTAINER * pContainer; + + if (lpszCachePath != NULL || dwSize != 100 || dwSizeType != FCS_PERCENT_CACHE_SPACE) + { + FIXME("(%s, %x, %x): partial stub!\n", debugstr_w(lpszCachePath), dwSize, dwSizeType); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; + } + + LIST_FOR_EACH_ENTRY(pContainer, &UrlContainers, URLCACHECONTAINER, entry) + { + /* The URL cache has prefix L"" (unlike Cookies and History) */ + if (pContainer->cache_prefix[0] == 0) + { + BOOL ret_del; + DWORD ret_open; + WaitForSingleObject(pContainer->hMutex, INFINITE); + + /* unlock, delete, recreate and lock cache */ + URLCacheContainer_CloseIndex(pContainer); + ret_del = URLCache_DeleteCacheDirectory(pContainer->path); + ret_open = URLCacheContainer_OpenIndex(pContainer); + + ReleaseMutex(pContainer->hMutex); + return ret_del && (ret_open == ERROR_SUCCESS); + } + } return FALSE; } - /*********************************************************************** - * FreeUrlCacheSpaceW (WININET.@) +/*********************************************************************** + * FreeUrlCacheSpaceA (WININET.@) * + * See FreeUrlCacheSpaceW. */ -BOOL WINAPI FreeUrlCacheSpaceW(LPCWSTR lpszCachePath, DWORD dwSize, DWORD dwFilter) +BOOL WINAPI FreeUrlCacheSpaceA(LPCSTR lpszCachePath, DWORD dwSize, DWORD dwSizeType) { - FIXME("stub!\n"); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; + BOOL ret = FALSE; + LPWSTR path = heap_strdupAtoW(lpszCachePath); + if (lpszCachePath == NULL || path != NULL) + ret = FreeUrlCacheSpaceW(path, dwSize, dwSizeType); + heap_free(path); + return ret; } /*********************************************************************** @@ -1913,10 +2004,6 @@ BOOL WINAPI RetrieveUrlCacheEntryFileA( TRACE("Found URL: %s\n", (LPSTR)pUrlEntry + pUrlEntry->dwOffsetUrl); TRACE("Header info: %s\n", (LPBYTE)pUrlEntry + pUrlEntry->dwOffsetHeaderInfo); - pUrlEntry->dwHitRate++; - pUrlEntry->dwUseCount++; - URLCache_HashEntrySetUse(pHashEntry, pUrlEntry->dwUseCount); - error = URLCache_CopyEntry(pContainer, pHeader, lpCacheEntryInfo, lpdwCacheEntryInfoBufferSize, pUrlEntry, FALSE); @@ -1928,6 +2015,11 @@ BOOL WINAPI RetrieveUrlCacheEntryFileA( } TRACE("Local File Name: %s\n", debugstr_a((LPCSTR)pUrlEntry + pUrlEntry->dwOffsetLocalName)); + pUrlEntry->dwHitRate++; + pUrlEntry->dwUseCount++; + URLCache_HashEntrySetUse(pHashEntry, pUrlEntry->dwUseCount); + GetSystemTimeAsFileTime(&pUrlEntry->LastAccessTime); + URLCacheContainer_UnlockIndex(pContainer, pHeader); return TRUE; @@ -2009,10 +2101,6 @@ BOOL WINAPI RetrieveUrlCacheEntryFileW( TRACE("Found URL: %s\n", (LPSTR)pUrlEntry + pUrlEntry->dwOffsetUrl); TRACE("Header info: %s\n", (LPBYTE)pUrlEntry + pUrlEntry->dwOffsetHeaderInfo); - pUrlEntry->dwHitRate++; - pUrlEntry->dwUseCount++; - URLCache_HashEntrySetUse(pHashEntry, pUrlEntry->dwUseCount); - error = URLCache_CopyEntry( pContainer, pHeader, @@ -2028,11 +2116,57 @@ BOOL WINAPI RetrieveUrlCacheEntryFileW( } TRACE("Local File Name: %s\n", debugstr_a((LPCSTR)pUrlEntry + pUrlEntry->dwOffsetLocalName)); + pUrlEntry->dwHitRate++; + pUrlEntry->dwUseCount++; + URLCache_HashEntrySetUse(pHashEntry, pUrlEntry->dwUseCount); + GetSystemTimeAsFileTime(&pUrlEntry->LastAccessTime); + URLCacheContainer_UnlockIndex(pContainer, pHeader); return TRUE; } +static BOOL DeleteUrlCacheEntryInternal(LPURLCACHE_HEADER pHeader, + struct _HASH_ENTRY *pHashEntry) +{ + CACHEFILE_ENTRY * pEntry; + URL_CACHEFILE_ENTRY * pUrlEntry; + + pEntry = (CACHEFILE_ENTRY *)((LPBYTE)pHeader + pHashEntry->dwOffsetEntry); + if (pEntry->dwSignature != URL_SIGNATURE) + { + FIXME("Trying to delete entry of unknown format %s\n", + debugstr_an((LPCSTR)&pEntry->dwSignature, sizeof(DWORD))); + SetLastError(ERROR_FILE_NOT_FOUND); + return FALSE; + } + pUrlEntry = (URL_CACHEFILE_ENTRY *)pEntry; + if (pUrlEntry->CacheDir < pHeader->DirectoryCount) + { + if (pHeader->directory_data[pUrlEntry->CacheDir].dwNumFiles) + pHeader->directory_data[pUrlEntry->CacheDir].dwNumFiles--; + } + if (pUrlEntry->CacheEntryType & STICKY_CACHE_ENTRY) + { + if (pUrlEntry->size.QuadPart < pHeader->ExemptUsage.QuadPart) + pHeader->ExemptUsage.QuadPart -= pUrlEntry->size.QuadPart; + else + pHeader->ExemptUsage.QuadPart = 0; + } + else + { + if (pUrlEntry->size.QuadPart < pHeader->CacheUsage.QuadPart) + pHeader->CacheUsage.QuadPart -= pUrlEntry->size.QuadPart; + else + pHeader->CacheUsage.QuadPart = 0; + } + + URLCache_DeleteEntry(pHeader, pEntry); + + URLCache_DeleteEntryFromHash(pHashEntry); + return TRUE; +} + /*********************************************************************** * UnlockUrlCacheEntryFileA (WININET.@) * @@ -2450,8 +2584,7 @@ static BOOL CommitUrlCacheEntryInternal( DWORD dwOffsetLocalFileName = 0; DWORD dwOffsetHeader = 0; DWORD dwOffsetFileExtension = 0; - DWORD dwFileSizeLow = 0; - DWORD dwFileSizeHigh = 0; + LARGE_INTEGER file_size; BYTE cDirectory = 0; char achFile[MAX_PATH]; LPSTR lpszUrlNameA = NULL; @@ -2468,9 +2601,15 @@ static BOOL CommitUrlCacheEntryInternal( debugstr_w(lpszFileExtension), debugstr_w(lpszOriginalUrl)); + if (CacheEntryType & STICKY_CACHE_ENTRY && !lpszLocalFileName) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } if (lpszOriginalUrl) WARN(": lpszOriginalUrl ignored\n"); - + + file_size.QuadPart = 0; if (lpszLocalFileName) { HANDLE hFile; @@ -2483,8 +2622,7 @@ static BOOL CommitUrlCacheEntryInternal( } /* Get file size */ - dwFileSizeLow = GetFileSize(hFile, &dwFileSizeHigh); - if ((dwFileSizeLow == INVALID_FILE_SIZE) && (GetLastError() != NO_ERROR)) + if (!GetFileSizeEx(hFile, &file_size)) { ERR("couldn't get file size (error is %d)\n", GetLastError()); CloseHandle(hFile); @@ -2607,20 +2745,24 @@ static BOOL CommitUrlCacheEntryInternal( pUrlEntry->CacheDir = cDirectory; pUrlEntry->CacheEntryType = CacheEntryType; pUrlEntry->dwHeaderInfoSize = dwHeaderSize; - pUrlEntry->dwExemptDelta = 0; + if (CacheEntryType & STICKY_CACHE_ENTRY) + { + /* Sticky entries have a default exempt time of one day */ + pUrlEntry->dwExemptDelta = 86400; + } + else + pUrlEntry->dwExemptDelta = 0; pUrlEntry->dwHitRate = 0; pUrlEntry->dwOffsetFileExtension = dwOffsetFileExtension; pUrlEntry->dwOffsetHeaderInfo = dwOffsetHeader; pUrlEntry->dwOffsetLocalName = dwOffsetLocalFileName; pUrlEntry->dwOffsetUrl = DWORD_ALIGN(sizeof(*pUrlEntry)); - pUrlEntry->dwSizeHigh = 0; - pUrlEntry->dwSizeLow = dwFileSizeLow; - pUrlEntry->dwSizeHigh = dwFileSizeHigh; + pUrlEntry->size.QuadPart = file_size.QuadPart; pUrlEntry->dwUseCount = 0; GetSystemTimeAsFileTime(&pUrlEntry->LastAccessTime); pUrlEntry->LastModifiedTime = LastModifiedTime; - FileTimeToDosDateTime(&pUrlEntry->LastAccessTime, &pUrlEntry->wLastSyncDate, &pUrlEntry->wLastSyncTime); - FileTimeToDosDateTime(&ExpireTime, &pUrlEntry->wExpiredDate, &pUrlEntry->wExpiredTime); + URLCache_FileTimeToDosDateTime(&pUrlEntry->LastAccessTime, &pUrlEntry->wLastSyncDate, &pUrlEntry->wLastSyncTime); + URLCache_FileTimeToDosDateTime(&ExpireTime, &pUrlEntry->wExpiredDate, &pUrlEntry->wExpiredTime); pUrlEntry->wUnknownDate = pUrlEntry->wLastSyncDate; pUrlEntry->wUnknownTime = pUrlEntry->wLastSyncTime; @@ -2646,6 +2788,18 @@ static BOOL CommitUrlCacheEntryInternal( (DWORD)((LPBYTE)pUrlEntry - (LPBYTE)pHeader)); if (error != ERROR_SUCCESS) URLCache_DeleteEntry(pHeader, &pUrlEntry->CacheFileEntry); + else + { + if (pUrlEntry->CacheDir < pHeader->DirectoryCount) + pHeader->directory_data[pUrlEntry->CacheDir].dwNumFiles++; + if (CacheEntryType & STICKY_CACHE_ENTRY) + pHeader->ExemptUsage.QuadPart += file_size.QuadPart; + else + pHeader->CacheUsage.QuadPart += file_size.QuadPart; + if (pHeader->CacheUsage.QuadPart + pHeader->ExemptUsage.QuadPart > + pHeader->CacheLimit.QuadPart) + FIXME("file of size %s bytes fills cache\n", wine_dbgstr_longlong(file_size.QuadPart)); + } cleanup: URLCacheContainer_UnlockIndex(pContainer, pHeader); @@ -2855,7 +3009,7 @@ HANDLE WINAPI RetrieveUrlCacheEntryStreamA( return FALSE; /* allocate handle storage space */ - pStream = HeapAlloc(GetProcessHeap(), 0, sizeof(STREAM_HANDLE) + strlen(lpszUrlName) * sizeof(CHAR)); + pStream = heap_alloc(sizeof(STREAM_HANDLE) + strlen(lpszUrlName) * sizeof(CHAR)); if (!pStream) { CloseHandle(hFile); @@ -2880,9 +3034,53 @@ HANDLE WINAPI RetrieveUrlCacheEntryStreamW( IN DWORD dwReserved ) { - FIXME( "(%s, %p, %p, %x, 0x%08x)\n", debugstr_w(lpszUrlName), lpCacheEntryInfo, + DWORD size; + int url_len; + /* NOTE: this is not the same as the way that the native + * version allocates 'stream' handles. I did it this way + * as it is much easier and no applications should depend + * on this behaviour. (Native version appears to allocate + * indices into a table) + */ + STREAM_HANDLE * pStream; + HANDLE hFile; + + TRACE( "(%s, %p, %p, %x, 0x%08x)\n", debugstr_w(lpszUrlName), lpCacheEntryInfo, lpdwCacheEntryInfoBufferSize, fRandomRead, dwReserved ); - return NULL; + + if (!RetrieveUrlCacheEntryFileW(lpszUrlName, + lpCacheEntryInfo, + lpdwCacheEntryInfoBufferSize, + dwReserved)) + { + return NULL; + } + + hFile = CreateFileW(lpCacheEntryInfo->lpszLocalFileName, + GENERIC_READ, + FILE_SHARE_READ, + NULL, + OPEN_EXISTING, + fRandomRead ? FILE_FLAG_RANDOM_ACCESS : 0, + NULL); + if (hFile == INVALID_HANDLE_VALUE) + return FALSE; + + /* allocate handle storage space */ + size = sizeof(STREAM_HANDLE); + url_len = WideCharToMultiByte(CP_ACP, 0, lpszUrlName, -1, NULL, 0, NULL, NULL); + size += url_len; + pStream = heap_alloc(size); + if (!pStream) + { + CloseHandle(hFile); + SetLastError(ERROR_OUTOFMEMORY); + return FALSE; + } + + pStream->hFile = hFile; + WideCharToMultiByte(CP_ACP, 0, lpszUrlName, -1, pStream->lpszUrl, url_len, NULL, NULL); + return pStream; } /*********************************************************************** @@ -2931,8 +3129,8 @@ BOOL WINAPI DeleteUrlCacheEntryA(LPCSTR lpszUrlName) URLCACHECONTAINER * pContainer; LPURLCACHE_HEADER pHeader; struct _HASH_ENTRY * pHashEntry; - CACHEFILE_ENTRY * pEntry; DWORD error; + BOOL ret; TRACE("(%s)\n", debugstr_a(lpszUrlName)); @@ -2961,14 +3159,11 @@ BOOL WINAPI DeleteUrlCacheEntryA(LPCSTR lpszUrlName) return FALSE; } - pEntry = (CACHEFILE_ENTRY *)((LPBYTE)pHeader + pHashEntry->dwOffsetEntry); - URLCache_DeleteEntry(pHeader, pEntry); - - URLCache_DeleteEntryFromHash(pHashEntry); + ret = DeleteUrlCacheEntryInternal(pHeader, pHashEntry); URLCacheContainer_UnlockIndex(pContainer, pHeader); - return TRUE; + return ret; } /*********************************************************************** @@ -2980,9 +3175,9 @@ BOOL WINAPI DeleteUrlCacheEntryW(LPCWSTR lpszUrlName) URLCACHECONTAINER * pContainer; LPURLCACHE_HEADER pHeader; struct _HASH_ENTRY * pHashEntry; - CACHEFILE_ENTRY * pEntry; LPSTR urlA; DWORD error; + BOOL ret; TRACE("(%s)\n", debugstr_w(lpszUrlName)); @@ -3024,15 +3219,12 @@ BOOL WINAPI DeleteUrlCacheEntryW(LPCWSTR lpszUrlName) return FALSE; } - pEntry = (CACHEFILE_ENTRY *)((LPBYTE)pHeader + pHashEntry->dwOffsetEntry); - URLCache_DeleteEntry(pHeader, pEntry); - - URLCache_DeleteEntryFromHash(pHashEntry); + ret = DeleteUrlCacheEntryInternal(pHeader, pHashEntry); URLCacheContainer_UnlockIndex(pContainer, pHeader); HeapFree(GetProcessHeap(), 0, urlA); - return TRUE; + return ret; } BOOL WINAPI DeleteUrlCacheContainerA(DWORD d1, DWORD d2) @@ -3165,7 +3357,7 @@ INTERNETAPI HANDLE WINAPI FindFirstUrlCacheEntryA(LPCSTR lpszUrlSearchPattern, TRACE("(%s, %p, %p)\n", debugstr_a(lpszUrlSearchPattern), lpFirstCacheEntryInfo, lpdwFirstCacheEntryInfoBufferSize); - pEntryHandle = HeapAlloc(GetProcessHeap(), 0, sizeof(*pEntryHandle)); + pEntryHandle = heap_alloc(sizeof(*pEntryHandle)); if (!pEntryHandle) return NULL; @@ -3204,7 +3396,7 @@ INTERNETAPI HANDLE WINAPI FindFirstUrlCacheEntryW(LPCWSTR lpszUrlSearchPattern, TRACE("(%s, %p, %p)\n", debugstr_w(lpszUrlSearchPattern), lpFirstCacheEntryInfo, lpdwFirstCacheEntryInfoBufferSize); - pEntryHandle = HeapAlloc(GetProcessHeap(), 0, sizeof(*pEntryHandle)); + pEntryHandle = heap_alloc(sizeof(*pEntryHandle)); if (!pEntryHandle) return NULL; @@ -3232,19 +3424,15 @@ INTERNETAPI HANDLE WINAPI FindFirstUrlCacheEntryW(LPCWSTR lpszUrlSearchPattern, return pEntryHandle; } -/*********************************************************************** - * FindNextUrlCacheEntryA (WININET.@) - */ -BOOL WINAPI FindNextUrlCacheEntryA( +static BOOL FindNextUrlCacheEntryInternal( HANDLE hEnumHandle, LPINTERNET_CACHE_ENTRY_INFOA lpNextCacheEntryInfo, - LPDWORD lpdwNextCacheEntryInfoBufferSize) + LPDWORD lpdwNextCacheEntryInfoBufferSize, + BOOL unicode) { URLCacheFindEntryHandle *pEntryHandle = (URLCacheFindEntryHandle *)hEnumHandle; URLCACHECONTAINER * pContainer; - TRACE("(%p, %p, %p)\n", hEnumHandle, lpNextCacheEntryInfo, lpdwNextCacheEntryInfoBufferSize); - if (pEntryHandle->dwMagic != URLCACHE_FIND_ENTRY_HANDLE_MAGIC) { SetLastError(ERROR_INVALID_HANDLE); @@ -3282,8 +3470,10 @@ BOOL WINAPI FindNextUrlCacheEntryA( continue; pUrlEntry = (const URL_CACHEFILE_ENTRY *)pEntry; - TRACE("Found URL: %s\n", (LPCSTR)pUrlEntry + pUrlEntry->dwOffsetUrl); - TRACE("Header info: %s\n", (LPCSTR)pUrlEntry + pUrlEntry->dwOffsetHeaderInfo); + TRACE("Found URL: %s\n", + debugstr_a((LPCSTR)pUrlEntry + pUrlEntry->dwOffsetUrl)); + TRACE("Header info: %s\n", + debugstr_a((LPCSTR)pUrlEntry + pUrlEntry->dwOffsetHeaderInfo)); error = URLCache_CopyEntry( pContainer, @@ -3291,14 +3481,15 @@ BOOL WINAPI FindNextUrlCacheEntryA( lpNextCacheEntryInfo, lpdwNextCacheEntryInfoBufferSize, pUrlEntry, - FALSE /* not UNICODE */); + unicode); if (error != ERROR_SUCCESS) { URLCacheContainer_UnlockIndex(pContainer, pHeader); SetLastError(error); return FALSE; } - TRACE("Local File Name: %s\n", debugstr_a((LPCSTR)pUrlEntry + pUrlEntry->dwOffsetLocalName)); + TRACE("Local File Name: %s\n", + debugstr_a((LPCSTR)pUrlEntry + pUrlEntry->dwOffsetLocalName)); /* increment the current index so that next time the function * is called the next entry is returned */ @@ -3315,6 +3506,20 @@ BOOL WINAPI FindNextUrlCacheEntryA( return FALSE; } +/*********************************************************************** + * FindNextUrlCacheEntryA (WININET.@) + */ +BOOL WINAPI FindNextUrlCacheEntryA( + HANDLE hEnumHandle, + LPINTERNET_CACHE_ENTRY_INFOA lpNextCacheEntryInfo, + LPDWORD lpdwNextCacheEntryInfoBufferSize) +{ + TRACE("(%p, %p, %p)\n", hEnumHandle, lpNextCacheEntryInfo, lpdwNextCacheEntryInfoBufferSize); + + return FindNextUrlCacheEntryInternal(hEnumHandle, lpNextCacheEntryInfo, + lpdwNextCacheEntryInfoBufferSize, FALSE /* not UNICODE */); +} + /*********************************************************************** * FindNextUrlCacheEntryW (WININET.@) */ @@ -3324,9 +3529,11 @@ BOOL WINAPI FindNextUrlCacheEntryW( LPDWORD lpdwNextCacheEntryInfoBufferSize ) { - FIXME("(%p, %p, %p) stub\n", hEnumHandle, lpNextCacheEntryInfo, lpdwNextCacheEntryInfoBufferSize); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; + TRACE("(%p, %p, %p)\n", hEnumHandle, lpNextCacheEntryInfo, lpdwNextCacheEntryInfoBufferSize); + + return FindNextUrlCacheEntryInternal(hEnumHandle, + (LPINTERNET_CACHE_ENTRY_INFOA)lpNextCacheEntryInfo, + lpdwNextCacheEntryInfoBufferSize, TRUE /* UNICODE */); } /*********************************************************************** @@ -3456,8 +3663,6 @@ BOOL WINAPI GetUrlCacheConfigInfoW(LPINTERNET_CACHE_CONFIG_INFOW CacheInfo, LPDW /*********************************************************************** * GetUrlCacheConfigInfoA (WININET.@) - * - * CacheInfo is some CACHE_CONFIG_INFO structure, with no MS info found by google */ BOOL WINAPI GetUrlCacheConfigInfoA(LPINTERNET_CACHE_CONFIG_INFOA CacheInfo, LPDWORD size, DWORD bitmask) { @@ -3531,6 +3736,24 @@ DWORD WINAPI DeleteIE3Cache(HWND hWnd, HINSTANCE hInst, LPSTR lpszCmdLine, int n return 0; } +static BOOL IsUrlCacheEntryExpiredInternal(const URL_CACHEFILE_ENTRY *pUrlEntry, + FILETIME *pftLastModified) +{ + BOOL ret; + FILETIME now, expired; + + *pftLastModified = pUrlEntry->LastModifiedTime; + GetSystemTimeAsFileTime(&now); + URLCache_DosDateTimeToFileTime(pUrlEntry->wExpiredDate, + pUrlEntry->wExpiredTime, &expired); + /* If the expired time is 0, it's interpreted as not expired */ + if (!expired.dwLowDateTime && !expired.dwHighDateTime) + ret = FALSE; + else + ret = CompareFileTime(&expired, &now) < 0; + return ret; +} + /*********************************************************************** * IsUrlCacheEntryExpiredA (WININET.@) * @@ -3546,51 +3769,57 @@ BOOL WINAPI IsUrlCacheEntryExpiredA( LPCSTR url, DWORD dwFlags, FILETIME* pftLas const CACHEFILE_ENTRY * pEntry; const URL_CACHEFILE_ENTRY * pUrlEntry; URLCACHECONTAINER * pContainer; - DWORD error; + BOOL expired; TRACE("(%s, %08x, %p)\n", debugstr_a(url), dwFlags, pftLastModified); - error = URLCacheContainers_FindContainerA(url, &pContainer); - if (error != ERROR_SUCCESS) + if (!url || !pftLastModified) + return TRUE; + if (dwFlags) + FIXME("unknown flags 0x%08x\n", dwFlags); + + /* Any error implies that the URL is expired, i.e. not in the cache */ + if (URLCacheContainers_FindContainerA(url, &pContainer)) { - SetLastError(error); - return FALSE; + memset(pftLastModified, 0, sizeof(*pftLastModified)); + return TRUE; } - error = URLCacheContainer_OpenIndex(pContainer); - if (error != ERROR_SUCCESS) + if (URLCacheContainer_OpenIndex(pContainer)) { - SetLastError(error); - return FALSE; + memset(pftLastModified, 0, sizeof(*pftLastModified)); + return TRUE; } if (!(pHeader = URLCacheContainer_LockIndex(pContainer))) - return FALSE; + { + memset(pftLastModified, 0, sizeof(*pftLastModified)); + return TRUE; + } if (!URLCache_FindHash(pHeader, url, &pHashEntry)) { URLCacheContainer_UnlockIndex(pContainer, pHeader); + memset(pftLastModified, 0, sizeof(*pftLastModified)); TRACE("entry %s not found!\n", url); - SetLastError(ERROR_FILE_NOT_FOUND); - return FALSE; + return TRUE; } pEntry = (const CACHEFILE_ENTRY *)((LPBYTE)pHeader + pHashEntry->dwOffsetEntry); if (pEntry->dwSignature != URL_SIGNATURE) { URLCacheContainer_UnlockIndex(pContainer, pHeader); + memset(pftLastModified, 0, sizeof(*pftLastModified)); FIXME("Trying to retrieve entry of unknown format %s\n", debugstr_an((LPCSTR)&pEntry->dwSignature, sizeof(DWORD))); - SetLastError(ERROR_FILE_NOT_FOUND); - return FALSE; + return TRUE; } pUrlEntry = (const URL_CACHEFILE_ENTRY *)pEntry; - - DosDateTimeToFileTime(pUrlEntry->wExpiredDate, pUrlEntry->wExpiredTime, pftLastModified); + expired = IsUrlCacheEntryExpiredInternal(pUrlEntry, pftLastModified); URLCacheContainer_UnlockIndex(pContainer, pHeader); - return TRUE; + return expired; } /*********************************************************************** @@ -3608,51 +3837,65 @@ BOOL WINAPI IsUrlCacheEntryExpiredW( LPCWSTR url, DWORD dwFlags, FILETIME* pftLa const CACHEFILE_ENTRY * pEntry; const URL_CACHEFILE_ENTRY * pUrlEntry; URLCACHECONTAINER * pContainer; - DWORD error; + BOOL expired; TRACE("(%s, %08x, %p)\n", debugstr_w(url), dwFlags, pftLastModified); - error = URLCacheContainers_FindContainerW(url, &pContainer); - if (error != ERROR_SUCCESS) + if (!url || !pftLastModified) + return TRUE; + if (dwFlags) + FIXME("unknown flags 0x%08x\n", dwFlags); + + /* Any error implies that the URL is expired, i.e. not in the cache */ + if (URLCacheContainers_FindContainerW(url, &pContainer)) { - SetLastError(error); - return FALSE; + memset(pftLastModified, 0, sizeof(*pftLastModified)); + return TRUE; } - error = URLCacheContainer_OpenIndex(pContainer); - if (error != ERROR_SUCCESS) + if (URLCacheContainer_OpenIndex(pContainer)) { - SetLastError(error); - return FALSE; + memset(pftLastModified, 0, sizeof(*pftLastModified)); + return TRUE; } if (!(pHeader = URLCacheContainer_LockIndex(pContainer))) - return FALSE; + { + memset(pftLastModified, 0, sizeof(*pftLastModified)); + return TRUE; + } if (!URLCache_FindHashW(pHeader, url, &pHashEntry)) { URLCacheContainer_UnlockIndex(pContainer, pHeader); + memset(pftLastModified, 0, sizeof(*pftLastModified)); TRACE("entry %s not found!\n", debugstr_w(url)); - SetLastError(ERROR_FILE_NOT_FOUND); - return FALSE; + return TRUE; + } + + if (!URLCache_FindHashW(pHeader, url, &pHashEntry)) + { + URLCacheContainer_UnlockIndex(pContainer, pHeader); + memset(pftLastModified, 0, sizeof(*pftLastModified)); + TRACE("entry %s not found!\n", debugstr_w(url)); + return TRUE; } pEntry = (const CACHEFILE_ENTRY *)((LPBYTE)pHeader + pHashEntry->dwOffsetEntry); if (pEntry->dwSignature != URL_SIGNATURE) { URLCacheContainer_UnlockIndex(pContainer, pHeader); + memset(pftLastModified, 0, sizeof(*pftLastModified)); FIXME("Trying to retrieve entry of unknown format %s\n", debugstr_an((LPCSTR)&pEntry->dwSignature, sizeof(DWORD))); - SetLastError(ERROR_FILE_NOT_FOUND); - return FALSE; + return TRUE; } pUrlEntry = (const URL_CACHEFILE_ENTRY *)pEntry; - - DosDateTimeToFileTime(pUrlEntry->wExpiredDate, pUrlEntry->wExpiredTime, pftLastModified); + expired = IsUrlCacheEntryExpiredInternal(pUrlEntry, pftLastModified); URLCacheContainer_UnlockIndex(pContainer, pHeader); - return TRUE; + return expired; } /*********************************************************************** diff --git a/dll/win32/wininet/utility.c b/dll/win32/wininet/utility.c index 0639f40385e..c44aa6c1702 100644 --- a/dll/win32/wininet/utility.c +++ b/dll/win32/wininet/utility.c @@ -172,7 +172,7 @@ BOOL GetAddress(LPCWSTR lpszServerName, INTERNET_PORT nServerPort, len = strlenW(lpszServerName); sz = WideCharToMultiByte( CP_UNIXCP, 0, lpszServerName, len, NULL, 0, NULL, NULL ); - if (!(name = HeapAlloc( GetProcessHeap(), 0, sz + 1 ))) return FALSE; + if (!(name = heap_alloc(sz + 1))) return FALSE; WideCharToMultiByte( CP_UNIXCP, 0, lpszServerName, len, name, sz, NULL, NULL ); name[sz] = 0; @@ -320,7 +320,7 @@ VOID INTERNET_SendCallback(object_header_t *hdr, DWORD_PTR dwContext, case INTERNET_STATUS_NAME_RESOLVED: case INTERNET_STATUS_CONNECTING_TO_SERVER: case INTERNET_STATUS_CONNECTED_TO_SERVER: - lpvNewInfo = HeapAlloc(GetProcessHeap(), 0, strlen(lpvStatusInfo) + 1); + lpvNewInfo = heap_alloc(strlen(lpvStatusInfo) + 1); if (lpvNewInfo) strcpy(lpvNewInfo, lpvStatusInfo); break; case INTERNET_STATUS_RESOLVING_NAME: @@ -379,7 +379,7 @@ void SendAsyncCallback(object_header_t *hdr, DWORD_PTR dwContext, if (lpvStatusInfo) { - lpvStatusInfo_copy = HeapAlloc(GetProcessHeap(), 0, dwStatusInfoLength); + lpvStatusInfo_copy = heap_alloc(dwStatusInfoLength); memcpy(lpvStatusInfo_copy, lpvStatusInfo, dwStatusInfoLength); } diff --git a/dll/win32/wininet/wininet_Bg.rc b/dll/win32/wininet/wininet_Bg.rc index c2cd5550d5b..25461fc3ce2 100644 --- a/dll/win32/wininet/wininet_Bg.rc +++ b/dll/win32/wininet/wininet_Bg.rc @@ -20,7 +20,7 @@ LANGUAGE LANG_BULGARIAN, SUBLANG_DEFAULT -IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154 +IDD_PROXYDLG DIALOG 36, 24, 250, 154 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION " " FONT 8, "MS Shell Dlg" @@ -39,8 +39,3 @@ FONT 8, "MS Shell Dlg" PUSHBUTTON "OK", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON PUSHBUTTON "", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP } - -STRINGTABLE DISCARDABLE -{ - IDS_LANCONNECTION "LAN " -} diff --git a/dll/win32/wininet/wininet_Cs.rc b/dll/win32/wininet/wininet_Cs.rc index 7e0b214b75f..cbc2c5a1bb7 100644 --- a/dll/win32/wininet/wininet_Cs.rc +++ b/dll/win32/wininet/wininet_Cs.rc @@ -25,7 +25,7 @@ LANGUAGE LANG_CZECH, SUBLANG_DEFAULT /* Czech strings in CP1250 */ -IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154 +IDD_PROXYDLG DIALOG 36, 24, 250, 154 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Zadn sovho hesla" FONT 8, "MS Shell Dlg" diff --git a/dll/win32/wininet/wininet_Da.rc b/dll/win32/wininet/wininet_Da.rc index 6bde57d6851..767baec233a 100644 --- a/dll/win32/wininet/wininet_Da.rc +++ b/dll/win32/wininet/wininet_Da.rc @@ -1,5 +1,6 @@ /* * Copyright 2008 Jens Albretsen + * 2010 Thomas Larsen * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -18,11 +19,13 @@ #include "resource.h" +#pragma code_page(65001) + LANGUAGE LANG_DANISH, SUBLANG_DEFAULT -IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154 +IDD_PROXYDLG DIALOG 36, 24, 250, 154 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Skriv netvrkskodeord" +CAPTION "Skriv netværkskodeord" FONT 8, "MS Shell Dlg" { LTEXT "Skriv dit brugernavn og kodeord:", -1, 40, 6, 150, 15 @@ -40,7 +43,22 @@ FONT 8, "MS Shell Dlg" PUSHBUTTON "Annuller", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP } -STRINGTABLE DISCARDABLE +IDD_AUTHDLG DIALOG 36, 24, 250, 154 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Godkendelse Påkrævet" +FONT 8, "MS Shell Dlg" { - IDS_LANCONNECTION "Lokal netvrksforbindelse" + LTEXT "Indtast venligst, dit brugernavn og adgangskode:", -1, 40, 6, 150, 15 + LTEXT "Server", -1, 40, 26, 50, 10 + LTEXT "Domæne", -1, 40, 46, 50, 10 + LTEXT "Bruger", -1, 40, 66, 50, 10 + LTEXT "Adgangskode", -1, 40, 86, 50, 10 + LTEXT "", IDC_SERVER, 80, 26, 150, 14, 0 + LTEXT "", IDC_REALM, 80, 46, 150, 14, 0 + EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP + EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD + CHECKBOX "&Gem denne adgangskode (usikker)", IDC_SAVEPASSWORD, + 80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP + PUSHBUTTON "OK", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON + PUSHBUTTON "Annuller", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP } diff --git a/dll/win32/wininet/wininet_De.rc b/dll/win32/wininet/wininet_De.rc index 21dd6e4b5ec..893ec886286 100644 --- a/dll/win32/wininet/wininet_De.rc +++ b/dll/win32/wininet/wininet_De.rc @@ -1,6 +1,6 @@ /* * Copyright 2004 Henning Gerhardt - * Copyright 2009 André Hentschel + * Copyright 2009-2010 André Hentschel * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -23,7 +23,7 @@ LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL -IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154 +IDD_PROXYDLG DIALOG 36, 24, 250, 154 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Netzwerkkennung eingeben" FONT 8, "MS Shell Dlg" @@ -43,7 +43,7 @@ FONT 8, "MS Shell Dlg" PUSHBUTTON "Abbrechen", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP } -IDD_AUTHDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154 +IDD_AUTHDLG DIALOG 36, 24, 250, 154 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Benutzeranmeldung" FONT 8, "MS Shell Dlg" @@ -63,7 +63,14 @@ FONT 8, "MS Shell Dlg" PUSHBUTTON "Abbrechen", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP } -STRINGTABLE DISCARDABLE +IDD_INVCERTDLG DIALOG 3, 24, 250, 86 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Sicherheits Warnung" +FONT 8, "MS Shell Dlg" { - IDS_LANCONNECTION "LAN Verbindung" + LTEXT "Es gibt ein Problem mit dem Zertifikat dieser Seite.", -1, 40, 6, 200, 20 + LTEXT "", IDC_CERT_ERROR, 40, 26, 200, 20 + LTEXT "Möchten Sie dennoch fortfahren?", -1, 40, 46, 200, 20 + PUSHBUTTON "Ja", IDOK, 40, 66, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON + PUSHBUTTON "Nein", IDCANCEL, 100, 66, 56, 14, WS_GROUP | WS_TABSTOP } diff --git a/dll/win32/wininet/wininet_En.rc b/dll/win32/wininet/wininet_En.rc index 92590c16548..5c303fc824a 100644 --- a/dll/win32/wininet/wininet_En.rc +++ b/dll/win32/wininet/wininet_En.rc @@ -20,7 +20,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT -IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154 +IDD_PROXYDLG DIALOG 36, 24, 250, 154 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Enter Network Password" FONT 8, "MS Shell Dlg" @@ -40,7 +40,7 @@ FONT 8, "MS Shell Dlg" PUSHBUTTON "Cancel", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP } -IDD_AUTHDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154 +IDD_AUTHDLG DIALOG 36, 24, 250, 154 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Authentication Required" FONT 8, "MS Shell Dlg" @@ -60,7 +60,14 @@ FONT 8, "MS Shell Dlg" PUSHBUTTON "Cancel", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP } -STRINGTABLE DISCARDABLE +IDD_INVCERTDLG DIALOG 3, 24, 250, 86 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Security Warning" +FONT 8, "MS Shell Dlg" { - IDS_LANCONNECTION "LAN Connection" + LTEXT "There is a problem with the certificate for this site.", -1, 40, 6, 200, 20 + LTEXT "", IDC_CERT_ERROR, 40, 26, 200, 20 + LTEXT "Do you want to continue anyway?", -1, 40, 46, 200, 20 + PUSHBUTTON "Yes", IDOK, 40, 66, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON + PUSHBUTTON "No", IDCANCEL, 100, 66, 56, 14, WS_GROUP | WS_TABSTOP } diff --git a/dll/win32/wininet/wininet_Eo.rc b/dll/win32/wininet/wininet_Eo.rc new file mode 100644 index 00000000000..8929e7ec0f2 --- /dev/null +++ b/dll/win32/wininet/wininet_Eo.rc @@ -0,0 +1,43 @@ +/* + * Wininet Resources - Esperanto Language Support + * + * Copyright 2006 Antonio Codazzi + * + * 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 "resource.h" + +LANGUAGE LANG_ESPERANTO, SUBLANG_DEFAULT + +IDD_PROXYDLG DIALOG 36, 24, 250, 154 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Enmetu Retan Pasvorton" +FONT 8, "MS Shell Dlg" +{ + LTEXT "Enmetu uzantonomon kaj pasvorton:", -1, 40, 6, 150, 15 + LTEXT "Proxy", -1, 40, 26, 50, 10 + LTEXT "Realm", -1, 40, 46, 50, 10 + LTEXT "Uzanto", -1, 40, 66, 50, 10 + LTEXT "Pasvorto", -1, 40, 86, 50, 10 + LTEXT "", IDC_PROXY, 80, 26, 150, 14, 0 + LTEXT "", IDC_REALM, 80, 46, 150, 14, 0 + EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP + EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD + CHECKBOX "&Storu pasvorton ( RISKE! )", IDC_SAVEPASSWORD, + 80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP + PUSHBUTTON "Bone", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON + PUSHBUTTON "Rezigni", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP +} diff --git a/dll/win32/wininet/wininet_Es.rc b/dll/win32/wininet/wininet_Es.rc index 01b8b730ecd..a9b6abd33c0 100644 --- a/dll/win32/wininet/wininet_Es.rc +++ b/dll/win32/wininet/wininet_Es.rc @@ -1,5 +1,5 @@ -/* - * Copyright 2003, 2005 Jos Manuel Ferrer Ortiz +/* + * Copyright 2003, 2005 José Manuel Ferrer Ortiz * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,27 +20,42 @@ LANGUAGE LANG_SPANISH, SUBLANG_NEUTRAL -IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154 +IDD_PROXYDLG DIALOG 36, 24, 250, 154 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Introduzca contrasea de red" +CAPTION "Introduzca contraseña de red" FONT 8, "MS Shell Dlg" { - LTEXT "Por favor introduzca su nombre de usuario y contrasea:", -1, 40, 6, 150, 15 + LTEXT "Por favor introduzca su nombre de usuario y contraseña:", -1, 40, 6, 150, 15 LTEXT "Proxy", -1, 40, 26, 50, 10 LTEXT "Dominio", -1, 40, 46, 50, 10 LTEXT "Usuario", -1, 40, 66, 50, 10 - LTEXT "Contrasea", -1, 40, 86, 50, 10 + LTEXT "Contraseña", -1, 40, 86, 50, 10 LTEXT "", IDC_PROXY, 80, 26, 150, 14, 0 LTEXT "", IDC_REALM, 80, 46, 150, 14, 0 EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD - CHECKBOX "&Guardar esta contrasea (inseguro)", IDC_SAVEPASSWORD, + CHECKBOX "&Guardar esta contraseña (inseguro)", IDC_SAVEPASSWORD, 80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP PUSHBUTTON "Aceptar", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON PUSHBUTTON "Cancelar", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP } -STRINGTABLE DISCARDABLE +IDD_AUTHDLG DIALOG 36, 24, 250, 154 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Autentificación Requerida" +FONT 8, "MS Shell Dlg" { - IDS_LANCONNECTION "Conexin LAN" + LTEXT "Por favor introduzca su nombre de usuario y contraseña:", -1, 40, 6, 150, 15 + LTEXT "Servidor", -1, 40, 26, 50, 10 + LTEXT "Dominio", -1, 40, 46, 50, 10 + LTEXT "Usuario", -1, 40, 66, 50, 10 + LTEXT "Contraseña", -1, 40, 86, 50, 10 + LTEXT "", IDC_SERVER, 80, 26, 150, 14, 0 + LTEXT "", IDC_REALM, 80, 46, 150, 14, 0 + EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP + EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD + CHECKBOX "&Guardar esta contraseña (inseguro)", IDC_SAVEPASSWORD, + 80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP + PUSHBUTTON "Aceptar", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON + PUSHBUTTON "Cancelar", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP } diff --git a/dll/win32/wininet/wininet_Fi.rc b/dll/win32/wininet/wininet_Fi.rc index 6ab43d49945..302d090a532 100644 --- a/dll/win32/wininet/wininet_Fi.rc +++ b/dll/win32/wininet/wininet_Fi.rc @@ -1,4 +1,4 @@ -/* +/* * Copyright 2005 Kimmo Myllyvirta * * This library is free software; you can redistribute it and/or @@ -20,27 +20,22 @@ LANGUAGE LANG_FINNISH, SUBLANG_DEFAULT -IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154 +IDD_PROXYDLG DIALOG 36, 24, 250, 154 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Anna Verkon Salasana" +CAPTION "Anna verkon salasana" FONT 8, "MS Shell Dlg" { - LTEXT "Anna kyttjn nimi ja salasana:", -1, 40, 6, 150, 15 - LTEXT "Vlityspalvelin", -1, 40, 26, 50, 10 + LTEXT "Anna käyttäjän nimi ja salasana:", -1, 40, 6, 150, 15 + LTEXT "Välityspalvelin", -1, 40, 26, 50, 10 LTEXT "Alue", -1, 40, 46, 50, 10 - LTEXT "Kyttj", -1, 40, 66, 50, 10 + LTEXT "Käyttäjä", -1, 40, 66, 50, 10 LTEXT "Salasana", -1, 40, 86, 50, 10 LTEXT "", IDC_PROXY, 80, 26, 150, 14, 0 LTEXT "", IDC_REALM, 80, 46, 150, 14, 0 EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD - CHECKBOX "&Tallenna tm salasana (epturvallinen)", IDC_SAVEPASSWORD, + CHECKBOX "&Tallenna tämä salasana (epäturvallinen)", IDC_SAVEPASSWORD, 80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP PUSHBUTTON "OK", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON PUSHBUTTON "Peruuta", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP } - -STRINGTABLE DISCARDABLE -{ - IDS_LANCONNECTION "Lhiverkkoyhteys" -} diff --git a/dll/win32/wininet/wininet_Fr.rc b/dll/win32/wininet/wininet_Fr.rc index d78e4de8769..255b79dde03 100644 --- a/dll/win32/wininet/wininet_Fr.rc +++ b/dll/win32/wininet/wininet_Fr.rc @@ -5,7 +5,7 @@ * Copyright 2003 Mike McCormack for CodeWeavers * Copyright 2003 Vincent Béron * Copyright 2005 Jonathan Ernst - * Copyright 2009 Frédéric Delanoy + * Copyright 2009-2010 Frédéric Delanoy * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -29,7 +29,7 @@ LANGUAGE LANG_FRENCH, SUBLANG_NEUTRAL -IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 218, 150 +IDD_PROXYDLG DIALOG 36, 24, 218, 150 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Entrez le mot de passe réseau" FONT 8, "MS Shell Dlg" @@ -49,7 +49,7 @@ FONT 8, "MS Shell Dlg" PUSHBUTTON "Annuler", IDCANCEL, 147, 128, 56, 14, WS_GROUP | WS_TABSTOP } -IDD_AUTHDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 218, 150 +IDD_AUTHDLG DIALOG 36, 24, 218, 150 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Authentification requise" FONT 8, "MS Shell Dlg" @@ -69,7 +69,14 @@ FONT 8, "MS Shell Dlg" PUSHBUTTON "Annuler", IDCANCEL, 147, 128, 56, 14, WS_GROUP | WS_TABSTOP } -STRINGTABLE DISCARDABLE +IDD_INVCERTDLG DIALOG 3, 24, 250, 86 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Alerte de sécurité" +FONT 8, "MS Shell Dlg" { - IDS_LANCONNECTION "Connexion réseau local (LAN)" + LTEXT "Le certificat pour ce site pose problème.", -1, 40, 6, 200, 20 + LTEXT "", IDC_CERT_ERROR, 40, 26, 200, 20 + LTEXT "Voulez-vous tout de même continuer ?", -1, 40, 46, 200, 20 + PUSHBUTTON "Oui", IDOK, 40, 66, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON + PUSHBUTTON "Non", IDCANCEL, 100, 66, 56, 14, WS_GROUP | WS_TABSTOP } diff --git a/dll/win32/wininet/wininet_He.rc b/dll/win32/wininet/wininet_He.rc new file mode 100644 index 00000000000..4de3674097a --- /dev/null +++ b/dll/win32/wininet/wininet_He.rc @@ -0,0 +1,79 @@ +/* + * Copyright 2003 Mike McCormack for CodeWeavers + * Copyright 2010 Yaron Shahrabani + * + * 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 "resource.h" + +#pragma code_page(65001) + +LANGUAGE LANG_HEBREW, SUBLANG_DEFAULT + +IDD_PROXYDLG DIALOG 36, 24, 250, 154 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_LAYOUTRTL +CAPTION "הזנת ססמת הרשת" +FONT 8, "MS Shell Dlg" +{ + LTEXT "נא להזין את שם המשתמש ואת הססמה שלך:", -1, 40, 6, 150, 15 + LTEXT "מתווך", -1, 40, 26, 50, 10 + LTEXT "תחום", -1, 40, 46, 50, 10 + LTEXT "משתמש", -1, 40, 66, 50, 10 + LTEXT "ססמה", -1, 40, 86, 50, 10 + LTEXT "", IDC_PROXY, 80, 26, 150, 14, 0 + LTEXT "", IDC_REALM, 80, 46, 150, 14, 0 + EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP + EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD + CHECKBOX "&שמירת ססמה זו (לא מאובטח)", IDC_SAVEPASSWORD, + 80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP + PUSHBUTTON "אישור", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON + PUSHBUTTON "ביטול", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP +} + +IDD_AUTHDLG DIALOG 36, 24, 250, 154 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_LAYOUTRTL +CAPTION "נדרש אימות" +FONT 8, "MS Shell Dlg" +{ + LTEXT "נא להזין את שם המשתמש ואת הססמה שלך:", -1, 40, 6, 150, 15 + LTEXT "שרת", -1, 40, 26, 50, 10 + LTEXT "תחום", -1, 40, 46, 50, 10 + LTEXT "שם משתמש", -1, 40, 66, 50, 10 + LTEXT "ססמה", -1, 40, 86, 50, 10 + LTEXT "", IDC_SERVER, 80, 26, 150, 14, 0 + LTEXT "", IDC_REALM, 80, 46, 150, 14, 0 + EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP + EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD + CHECKBOX "&שמירת ססמה זו (לא מאובטח)", IDC_SAVEPASSWORD, + 80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP + PUSHBUTTON "אישור", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON + PUSHBUTTON "ביטול", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP +} + +IDD_INVCERTDLG DIALOG 3, 24, 250, 86 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_LAYOUTRTL +CAPTION "אזהרת אבטחה" +FONT 8, "MS Shell Dlg" +{ + LTEXT "אירעה תקלה עם האישור לאתר זה.", -1, 40, 6, 200, 20 + LTEXT "", IDC_CERT_ERROR, 40, 26, 200, 20 + LTEXT "האם ברצונך להמשיך בכל זאת?", -1, 40, 46, 200, 20 + PUSHBUTTON "כן", IDOK, 40, 66, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON + PUSHBUTTON "לא", IDCANCEL, 100, 66, 56, 14, WS_GROUP | WS_TABSTOP +} diff --git a/dll/win32/wininet/wininet_Hu.rc b/dll/win32/wininet/wininet_Hu.rc index 4ceb3771593..720c146dc6c 100644 --- a/dll/win32/wininet/wininet_Hu.rc +++ b/dll/win32/wininet/wininet_Hu.rc @@ -1,5 +1,5 @@ /* - * Copyright 2006 Andras Kovacs + * Copyright 2006-2010 Andras Kovacs * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,27 +20,45 @@ LANGUAGE LANG_HUNGARIAN, SUBLANG_DEFAULT -IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154 +/* UTF-8 */ +#pragma code_page(65001) + +IDD_PROXYDLG DIALOG 36, 24, 250, 154 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Hlzati jelsz megadsa" +CAPTION "Hálózati jelszó megadása" FONT 8, "MS Shell Dlg" { - LTEXT "Krem adja meg a felhasznlnevet, s jelszt:", -1, 40, 6, 150, 15 + LTEXT "Kérem adja meg a felhasználónevet és jelszót:", -1, 40, 6, 150, 15 LTEXT "Proxy", -1, 40, 26, 50, 10 LTEXT "Csoport", -1, 40, 46, 50, 10 - LTEXT "Felhasznl", -1, 40, 66, 50, 10 - LTEXT "Jelsz", -1, 40, 86, 50, 10 + LTEXT "Felhasználó", -1, 40, 66, 50, 10 + LTEXT "Jelszó", -1, 40, 86, 50, 10 LTEXT "", IDC_PROXY, 80, 26, 150, 14, 0 LTEXT "", IDC_REALM, 80, 46, 150, 14, 0 EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD - CHECKBOX "&Jelsz mentse (nem biztonsgos)", IDC_SAVEPASSWORD, + CHECKBOX "&Jelszó mentése (nem biztonságos)", IDC_SAVEPASSWORD, 80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP PUSHBUTTON "OK", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON - PUSHBUTTON "Mgse", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "Mégse", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP } -STRINGTABLE DISCARDABLE +IDD_AUTHDLG DIALOG 36, 24, 250, 154 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Hitelesítés szükséges" +FONT 8, "MS Shell Dlg" { - IDS_LANCONNECTION "LAN kapcsolat" + LTEXT "Kérem adja meg a felhasználónevet és jelszót:", -1, 40, 6, 150, 15 + LTEXT "Kiszolgáló", -1, 40, 26, 50, 10 + LTEXT "Tartomány", -1, 40, 46, 50, 10 + LTEXT "Felhasználó", -1, 40, 66, 50, 10 + LTEXT "Jelszó", -1, 40, 86, 50, 10 + LTEXT "", IDC_SERVER, 80, 26, 150, 14, 0 + LTEXT "", IDC_REALM, 80, 46, 150, 14, 0 + EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP + EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD + CHECKBOX "Jel&szó elmentése (nem biztonságos)", IDC_SAVEPASSWORD, + 80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP + PUSHBUTTON "OK", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON + PUSHBUTTON "Mégse", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP } diff --git a/dll/win32/wininet/wininet_It.rc b/dll/win32/wininet/wininet_It.rc index 0ea577abeb8..279f9915439 100644 --- a/dll/win32/wininet/wininet_It.rc +++ b/dll/win32/wininet/wininet_It.rc @@ -2,6 +2,7 @@ * Copyright 2003 Mike McCormack for CodeWeavers * Copyright 2003 Ivan Leo Puoti * Copyright 2006 Antonio Codazzi + * Copyright 2010 Luca Bennati * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,49 +21,59 @@ #include "resource.h" +/* UTF-8 */ +#pragma code_page(65001) + LANGUAGE LANG_ITALIAN, SUBLANG_NEUTRAL -IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154 +IDD_PROXYDLG DIALOG 36, 24, 250, 154 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Inserire la password di rete" FONT 8, "MS Shell Dlg" { LTEXT "Inserire il nome utente e la password:", -1, 40, 6, 150, 15 LTEXT "Proxy", -1, 40, 26, 50, 10 - LTEXT "Realm", -1, 40, 46, 50, 10 + LTEXT "Dominio", -1, 40, 46, 50, 10 LTEXT "Utente", -1, 40, 66, 50, 10 LTEXT "Password", -1, 40, 86, 50, 10 LTEXT "", IDC_PROXY, 80, 26, 150, 14, 0 LTEXT "", IDC_REALM, 80, 46, 150, 14, 0 EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD - CHECKBOX "&Memorizza la password ( RISCHIOSO )", IDC_SAVEPASSWORD, + CHECKBOX "&Memorizza la password (non sicuro)", IDC_SAVEPASSWORD, 80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP - PUSHBUTTON "OK", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON + PUSHBUTTON "Ok", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON PUSHBUTTON "Annulla", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP } -IDD_AUTHDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154 +IDD_AUTHDLG DIALOG 36, 24, 250, 154 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Autenticazione richiesta" FONT 8, "MS Shell Dlg" { LTEXT "Inserire il nome utente e la password:", -1, 40, 6, 150, 15 LTEXT "Server", -1, 40, 26, 50, 10 - LTEXT "Realm", -1, 40, 46, 50, 10 + LTEXT "Dominio", -1, 40, 46, 50, 10 LTEXT "Utente", -1, 40, 66, 50, 10 LTEXT "Password", -1, 40, 86, 50, 10 LTEXT "", IDC_SERVER, 80, 26, 150, 14, 0 LTEXT "", IDC_REALM, 80, 46, 150, 14, 0 EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD - CHECKBOX "&Memorizza la password (RISCHIOSO)", IDC_SAVEPASSWORD, + CHECKBOX "&Memorizza la password (non sicuro)", IDC_SAVEPASSWORD, 80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP - PUSHBUTTON "OK", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON + PUSHBUTTON "Ok", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON PUSHBUTTON "Annulla", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP } -STRINGTABLE DISCARDABLE +IDD_INVCERTDLG DIALOG 3, 24, 250, 86 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Avviso di sicurezza" +FONT 8, "MS Shell Dlg" { -IDS_LANCONNECTION "Connessione LAN" + LTEXT "È presente un problema con il certificato per questo sito.", -1, 40, 6, 200, 20 + LTEXT "", IDC_CERT_ERROR, 40, 26, 200, 20 + LTEXT "Vuoi continuare comunque?", -1, 40, 46, 200, 20 + PUSHBUTTON "Sì", IDOK, 40, 66, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON + PUSHBUTTON "No", IDCANCEL, 100, 66, 56, 14, WS_GROUP | WS_TABSTOP } diff --git a/dll/win32/wininet/wininet_Ja.rc b/dll/win32/wininet/wininet_Ja.rc index 94e3e25c960..c0c75678f06 100644 --- a/dll/win32/wininet/wininet_Ja.rc +++ b/dll/win32/wininet/wininet_Ja.rc @@ -23,14 +23,14 @@ LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT -IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154 +IDD_PROXYDLG DIALOG 36, 24, 250, 154 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "ネットワーク パスワードの入力" FONT 9, "MS Shell Dlg" { LTEXT "ユーザ名とパスワードを入力して下さい:", -1, 40, 6, 150, 15 LTEXT "プロキシ", -1, 40, 26, 50, 10 - LTEXT "地域", -1, 40, 46, 50, 10 + LTEXT "領域", -1, 40, 46, 50, 10 LTEXT "ユーザ名", -1, 40, 66, 50, 10 LTEXT "パスワード", -1, 40, 86, 50, 10 LTEXT "", IDC_PROXY, 80, 26, 150, 14, 0 @@ -43,7 +43,22 @@ FONT 9, "MS Shell Dlg" PUSHBUTTON "キャンセル", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP } -STRINGTABLE DISCARDABLE +IDD_AUTHDLG DIALOG 36, 24, 250, 154 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "認証が必要です" +FONT 8, "MS Shell Dlg" { - IDS_LANCONNECTION "LAN 接続" + LTEXT "ユーザ名とパスワードを入力して下さい:", -1, 40, 6, 150, 15 + LTEXT "サーバ", -1, 40, 26, 50, 10 + LTEXT "領域", -1, 40, 46, 50, 10 + LTEXT "ユーザ名", -1, 40, 66, 50, 10 + LTEXT "パスワード", -1, 40, 86, 50, 10 + LTEXT "", IDC_SERVER, 80, 26, 150, 14, 0 + LTEXT "", IDC_REALM, 80, 46, 150, 14, 0 + EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP + EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD + CHECKBOX "パスワードを保存する(&S)(セキュアではありません)", IDC_SAVEPASSWORD, + 80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP + PUSHBUTTON "OK", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON + PUSHBUTTON "キャンセル", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP } diff --git a/dll/win32/wininet/wininet_Ko.rc b/dll/win32/wininet/wininet_Ko.rc index 7e8fcaed3f7..f499cb237f5 100644 --- a/dll/win32/wininet/wininet_Ko.rc +++ b/dll/win32/wininet/wininet_Ko.rc @@ -1,6 +1,7 @@ /* - * Copyright 2005,2007 YunSong Hwang - * + * Copyright 2003 Mike McCormack for CodeWeavers + * Copyright 2005,2007,2010,2011 YunSong Hwang + * * 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 @@ -18,29 +19,58 @@ #include "resource.h" +#pragma code_page(65001) + LANGUAGE LANG_KOREAN, SUBLANG_DEFAULT -IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154 +IDD_PROXYDLG DIALOG 36, 24, 250, 154 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Ʈũ ȣ Է" +CAPTION "네트워크 암호 입력" FONT 9, "MS Shell Dlg" { - LTEXT " ̸ ȣ ԷϽÿ:", -1, 40, 6, 150, 15 - LTEXT "Ͻ", -1, 40, 26, 50, 10 - LTEXT "Realm", -1, 40, 46, 50, 10 - LTEXT "", -1, 40, 66, 50, 10 - LTEXT "ȣ", -1, 40, 86, 50, 10 + LTEXT "당신의 사용자 이름과 암호를 입력하십시오:", -1, 40, 6, 150, 15 + LTEXT "프록시", -1, 40, 26, 50, 10 + LTEXT "영역", -1, 40, 46, 50, 10 + LTEXT "사용자", -1, 40, 66, 50, 10 + LTEXT "암호", -1, 40, 86, 50, 10 LTEXT "", IDC_PROXY, 80, 26, 150, 14, 0 LTEXT "", IDC_REALM, 80, 46, 150, 14, 0 EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD - CHECKBOX "ȣ Է(&S)(Ͻÿ)", IDC_SAVEPASSWORD, + CHECKBOX "암호 저장(&S)(안전하지 못함)", IDC_SAVEPASSWORD, 80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP - PUSHBUTTON "Ȯ", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON - PUSHBUTTON "", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "확인", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON + PUSHBUTTON "취소", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP } -STRINGTABLE DISCARDABLE +IDD_AUTHDLG DIALOG 36, 24, 250, 154 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "인증 필요" +FONT 8, "MS Shell Dlg" { - IDS_LANCONNECTION " " + LTEXT "당신의 사용자 이름과 암호를 입력하십시오:", -1, 40, 6, 150, 15 + LTEXT "서버", -1, 40, 26, 50, 10 + LTEXT "영역", -1, 40, 46, 50, 10 + LTEXT "사용자", -1, 40, 66, 50, 10 + LTEXT "암호", -1, 40, 86, 50, 10 + LTEXT "", IDC_SERVER, 80, 26, 150, 14, 0 + LTEXT "", IDC_REALM, 80, 46, 150, 14, 0 + EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP + EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD + CHECKBOX "암호 저장(&S) (안전하지 못함)", IDC_SAVEPASSWORD, + 80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP + PUSHBUTTON "확인", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON + PUSHBUTTON "취소", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP +} + +IDD_INVCERTDLG DIALOG 3, 24, 250, 86 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "보안 경고" +FONT 8, "MS Shell Dlg" +{ + LTEXT "이 사이트의 인증서에 문제가 있습니다.", -1, 40, 6, 200, 20 + LTEXT "", IDC_CERT_ERROR, 40, 26, 200, 20 + LTEXT "그래도 계속 진행하겠습니까?", -1, 40, 46, 200, 20 + PUSHBUTTON "예", IDOK, 40, 66, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON + PUSHBUTTON "아니오", IDCANCEL, 100, 66, 56, 14, WS_GROUP | WS_TABSTOP } diff --git a/dll/win32/wininet/wininet_Lt.rc b/dll/win32/wininet/wininet_Lt.rc index 4fcb8cfc8ad..ab048d92577 100644 --- a/dll/win32/wininet/wininet_Lt.rc +++ b/dll/win32/wininet/wininet_Lt.rc @@ -1,5 +1,5 @@ /* - * Copyright 2009 Aurimas Fišeras + * Copyright 2009-2010 Aurimas Fišeras * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -23,7 +23,7 @@ LANGUAGE LANG_LITHUANIAN, SUBLANG_NEUTRAL -IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154 +IDD_PROXYDLG DIALOG 36, 24, 250, 154 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Įveskite tinklo slaptažodį" FONT 8, "MS Shell Dlg" @@ -43,7 +43,7 @@ FONT 8, "MS Shell Dlg" PUSHBUTTON "Atsisakyti", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP } -IDD_AUTHDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154 +IDD_AUTHDLG DIALOG 36, 24, 250, 154 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Reikalingas tapatumo nustatymas" FONT 8, "MS Shell Dlg" @@ -63,7 +63,14 @@ FONT 8, "MS Shell Dlg" PUSHBUTTON "Atsisakyti", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP } -STRINGTABLE DISCARDABLE +IDD_INVCERTDLG DIALOG 3, 24, 250, 86 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Įspėjimas apie saugumą" +FONT 8, "MS Shell Dlg" { - IDS_LANCONNECTION "Vietinio tinklo ryšys" + LTEXT "Yra nesklandumų su šios svetainės liudijimu.", -1, 40, 6, 200, 20 + LTEXT "", IDC_CERT_ERROR, 40, 26, 200, 20 + LTEXT "Ar vistiek norite tęsti?", -1, 40, 46, 200, 20 + PUSHBUTTON "Taip", IDOK, 40, 66, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON + PUSHBUTTON "Ne", IDCANCEL, 100, 66, 56, 14, WS_GROUP | WS_TABSTOP } diff --git a/dll/win32/wininet/wininet_Nl.rc b/dll/win32/wininet/wininet_Nl.rc index 2849d9c630b..adb49e6236d 100644 --- a/dll/win32/wininet/wininet_Nl.rc +++ b/dll/win32/wininet/wininet_Nl.rc @@ -22,7 +22,9 @@ LANGUAGE LANG_DUTCH, SUBLANG_NEUTRAL -IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154 +#pragma code_page(65001) + +IDD_PROXYDLG DIALOG 36, 24, 250, 154 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Netwerkwachtwoord invoeren" FONT 8, "MS Shell Dlg" @@ -42,7 +44,7 @@ FONT 8, "MS Shell Dlg" PUSHBUTTON "Annuleren", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP } -IDD_AUTHDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154 +IDD_AUTHDLG DIALOG 36, 24, 250, 154 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Authenticatie vereist" FONT 8, "MS Shell Dlg" @@ -62,7 +64,14 @@ FONT 8, "MS Shell Dlg" PUSHBUTTON "Annuleren", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP } -STRINGTABLE DISCARDABLE +IDD_INVCERTDLG DIALOG 3, 24, 250, 86 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Veiligheidswaarschuwing" +FONT 8, "MS Shell Dlg" { - IDS_LANCONNECTION "LAN Verbinding" + LTEXT "Er is een probleem met het certificaat voor deze site.", -1, 40, 6, 200, 20 + LTEXT "", IDC_CERT_ERROR, 40, 26, 200, 20 + LTEXT "Wilt u toch doorgaan?", -1, 40, 46, 200, 20 + PUSHBUTTON "Ja", IDOK, 40, 66, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON + PUSHBUTTON "Nee", IDCANCEL, 100, 66, 56, 14, WS_GROUP | WS_TABSTOP } diff --git a/dll/win32/wininet/wininet_No.rc b/dll/win32/wininet/wininet_No.rc index b3fd6adc121..9caaa7c55e7 100644 --- a/dll/win32/wininet/wininet_No.rc +++ b/dll/win32/wininet/wininet_No.rc @@ -22,7 +22,7 @@ LANGUAGE LANG_NORWEGIAN, SUBLANG_NORWEGIAN_BOKMAL -IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154 +IDD_PROXYDLG DIALOG 36, 24, 250, 154 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Skriv inn nettverkspassord" FONT 8, "MS Shell Dlg" @@ -42,7 +42,7 @@ FONT 8, "MS Shell Dlg" PUSHBUTTON "Avbryt", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP } -IDD_AUTHDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154 +IDD_AUTHDLG DIALOG 36, 24, 250, 154 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Pålogging" FONT 8, "MS Shell Dlg" @@ -61,8 +61,3 @@ FONT 8, "MS Shell Dlg" PUSHBUTTON "OK", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON PUSHBUTTON "Avbryt", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP } - -STRINGTABLE DISCARDABLE -{ - IDS_LANCONNECTION "Lokal nettverksforbindelse" -} diff --git a/dll/win32/wininet/wininet_Pl.rc b/dll/win32/wininet/wininet_Pl.rc index 610b5a275a1..4faa99397cb 100644 --- a/dll/win32/wininet/wininet_Pl.rc +++ b/dll/win32/wininet/wininet_Pl.rc @@ -1,6 +1,7 @@ -/* +/* * Copyright 2003 Mike McCormack for CodeWeavers * Copyright 2006 Mikolaj Zalewski + * Copyright 2010 £ukasz Wojni³owicz * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -21,27 +22,54 @@ LANGUAGE LANG_POLISH, SUBLANG_DEFAULT -IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154 +IDD_PROXYDLG DIALOG 36, 24, 250, 154 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Wprowad haso do sieci" +CAPTION "WprowadŸ has³o do sieci" FONT 8, "MS Shell Dlg" { - LTEXT "Prosz wprowadzi nazw uytkownika i haso:", -1, 40, 6, 150, 15 + LTEXT "Proszê wprowadziæ nazwê u¿ytkownika i has³o:", -1, 40, 6, 150, 15 LTEXT "Proxy", -1, 40, 26, 50, 10 LTEXT "Obszar", -1, 40, 46, 50, 10 - LTEXT "Uytkonik", -1, 40, 66, 50, 10 - LTEXT "Haso", -1, 40, 86, 50, 10 + LTEXT "U¿ytkownik", -1, 40, 66, 50, 10 + LTEXT "Has³o", -1, 40, 86, 50, 10 LTEXT "", IDC_PROXY, 80, 26, 150, 14, 0 LTEXT "", IDC_REALM, 80, 46, 150, 14, 0 EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD - CHECKBOX "&Zapamitaj to haso (nie bezpieczne)", IDC_SAVEPASSWORD, + CHECKBOX "&Zapamiêtaj to has³o (niebezpieczne)", IDC_SAVEPASSWORD, 80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP PUSHBUTTON "OK", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON PUSHBUTTON "Anuluj", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP } -STRINGTABLE DISCARDABLE +IDD_AUTHDLG DIALOG 36, 24, 250, 154 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Wymagane uwierzytelnienie " +FONT 8, "MS Shell Dlg" { - IDS_LANCONNECTION "Poczenie LAN" + LTEXT "Proszê wprowadziæ nazwê u¿ytkownika i has³o:", -1, 40, 6, 150, 15 + LTEXT "Serwer", -1, 40, 26, 50, 10 + LTEXT "Obszar", -1, 40, 46, 50, 10 + LTEXT "U¿ytkownik", -1, 40, 66, 50, 10 + LTEXT "Has³o", -1, 40, 86, 50, 10 + LTEXT "", IDC_SERVER, 80, 26, 150, 14, 0 + LTEXT "", IDC_REALM, 80, 46, 150, 14, 0 + EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP + EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD + CHECKBOX "&Zapamiêtaj to has³o (niebezpieczne)", IDC_SAVEPASSWORD, + 80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP + PUSHBUTTON "OK", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON + PUSHBUTTON "Anuluj", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP +} + +IDD_INVCERTDLG DIALOG 3, 24, 250, 86 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Ostrze¿enie o zabezpieczeniach" +FONT 8, "MS Shell Dlg" +{ + LTEXT "Wyst¹pi³ problem z certyfikatem dla tej strony.", -1, 40, 6, 200, 20 + LTEXT "", IDC_CERT_ERROR, 40, 26, 200, 20 + LTEXT "Czy mimo to chcesz kontynuowaæ?", -1, 40, 46, 200, 20 + PUSHBUTTON "Tak", IDOK, 40, 66, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON + PUSHBUTTON "Nie", IDCANCEL, 100, 66, 56, 14, WS_GROUP | WS_TABSTOP } diff --git a/dll/win32/wininet/wininet_Pt.rc b/dll/win32/wininet/wininet_Pt.rc index 92a6c9ad83b..28da452b1b2 100644 --- a/dll/win32/wininet/wininet_Pt.rc +++ b/dll/win32/wininet/wininet_Pt.rc @@ -2,6 +2,7 @@ * Copyright 2003 Marcelo Duarte * Copyright 2006-2007 Américo José Melo * Copyright 2009 Ricardo Filipe + * Copyright 2010 Gustavo Henrique Milaré * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -24,14 +25,14 @@ LANGUAGE LANG_PORTUGUESE, SUBLANG_PORTUGUESE_BRAZILIAN -IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154 +IDD_PROXYDLG DIALOG 36, 24, 250, 154 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Entrar Senha da Rede" FONT 8, "MS Shell Dlg" { LTEXT "Por favor, entre com o nome de usuário e a senha:", -1, 40, 6, 150, 15 LTEXT "Proxy", -1, 40, 26, 50, 10 - LTEXT "Realm", -1, 40, 46, 50, 10 + LTEXT "Domínio", -1, 40, 46, 50, 10 LTEXT "Usuário", -1, 40, 66, 50, 10 LTEXT "Senha", -1, 40, 86, 50, 10 LTEXT "", IDC_PROXY, 80, 26, 150, 14, 0 @@ -46,7 +47,7 @@ FONT 8, "MS Shell Dlg" LANGUAGE LANG_PORTUGUESE, SUBLANG_PORTUGUESE -IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154 +IDD_PROXYDLG DIALOG 36, 24, 250, 154 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Indicar Senha da Rede" FONT 8, "MS Shell Dlg" @@ -66,7 +67,32 @@ FONT 8, "MS Shell Dlg" PUSHBUTTON "Cancelar", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP } -IDD_AUTHDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154 + +LANGUAGE LANG_PORTUGUESE, SUBLANG_PORTUGUESE_BRAZILIAN + +IDD_AUTHDLG DIALOG 36, 24, 250, 154 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Autenticação necessária" +FONT 8, "MS Shell Dlg" +{ + LTEXT "Por favor insira o seu nome de usuário e senha:", -1, 40, 6, 150, 15 + LTEXT "Servidor", -1, 40, 26, 50, 10 + LTEXT "Domínio", -1, 40, 46, 50, 10 + LTEXT "Usuário", -1, 40, 66, 50, 10 + LTEXT "Senha", -1, 40, 86, 50, 10 + LTEXT "", IDC_SERVER, 80, 26, 150, 14, 0 + LTEXT "", IDC_REALM, 80, 46, 150, 14, 0 + EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP + EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD + CHECKBOX "&Salvar esta senha (inseguro)", IDC_SAVEPASSWORD, + 80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP + PUSHBUTTON "OK", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON + PUSHBUTTON "Cancelar", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP +} + +LANGUAGE LANG_PORTUGUESE, SUBLANG_PORTUGUESE + +IDD_AUTHDLG DIALOG 36, 24, 250, 154 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Autenticação necessária" FONT 8, "MS Shell Dlg" @@ -85,17 +111,3 @@ FONT 8, "MS Shell Dlg" PUSHBUTTON "OK", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON PUSHBUTTON "Cancelar", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP } - -LANGUAGE LANG_PORTUGUESE, SUBLANG_PORTUGUESE_BRAZILIAN - -STRINGTABLE DISCARDABLE -{ - IDS_LANCONNECTION "Conexão LAN" -} - -LANGUAGE LANG_PORTUGUESE, SUBLANG_PORTUGUESE - -STRINGTABLE DISCARDABLE -{ - IDS_LANCONNECTION "Ligação LAN" -} diff --git a/dll/win32/wininet/wininet_Ro.rc b/dll/win32/wininet/wininet_Ro.rc index 6ee9cddc517..8412035bc3b 100644 --- a/dll/win32/wininet/wininet_Ro.rc +++ b/dll/win32/wininet/wininet_Ro.rc @@ -23,7 +23,7 @@ LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL #pragma code_page(65001) -IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154 +IDD_PROXYDLG DIALOG 36, 24, 250, 154 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Introducere parolă de rețea" FONT 8, "MS Shell Dlg" @@ -43,7 +43,7 @@ FONT 8, "MS Shell Dlg" PUSHBUTTON "Renunță", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP } -IDD_AUTHDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154 +IDD_AUTHDLG DIALOG 36, 24, 250, 154 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Autentificare necesară" FONT 8, "MS Shell Dlg" @@ -62,8 +62,3 @@ FONT 8, "MS Shell Dlg" PUSHBUTTON "OK", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON PUSHBUTTON "Renunță", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP } - -STRINGTABLE DISCARDABLE -{ - IDS_LANCONNECTION "Conexiune LAN" -} diff --git a/dll/win32/wininet/wininet_Ru.rc b/dll/win32/wininet/wininet_Ru.rc index ba8d0258912..dbe38f00984 100644 --- a/dll/win32/wininet/wininet_Ru.rc +++ b/dll/win32/wininet/wininet_Ru.rc @@ -25,7 +25,7 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT -IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154 +IDD_PROXYDLG DIALOG 36, 24, 250, 154 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Ввод сетевого пароля" FONT 8, "MS Shell Dlg" @@ -45,7 +45,7 @@ FONT 8, "MS Shell Dlg" PUSHBUTTON "Отмена", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP } -IDD_AUTHDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154 +IDD_AUTHDLG DIALOG 36, 24, 250, 154 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Требуется идентификация" FONT 8, "MS Shell Dlg" @@ -64,8 +64,3 @@ FONT 8, "MS Shell Dlg" PUSHBUTTON "OK", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON PUSHBUTTON "Отмена", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP } - -STRINGTABLE DISCARDABLE -{ - IDS_LANCONNECTION "Сетевое подключение" -} diff --git a/dll/win32/wininet/wininet_Si.rc b/dll/win32/wininet/wininet_Si.rc index fb677ff6d32..3bc0213af38 100644 --- a/dll/win32/wininet/wininet_Si.rc +++ b/dll/win32/wininet/wininet_Si.rc @@ -22,7 +22,7 @@ LANGUAGE LANG_SLOVENIAN, SUBLANG_DEFAULT -IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154 +IDD_PROXYDLG DIALOG 36, 24, 250, 154 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Vnos omrežnega gesla" FONT 8, "MS Shell Dlg" @@ -42,7 +42,7 @@ FONT 8, "MS Shell Dlg" PUSHBUTTON "Prekliči", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP } -IDD_AUTHDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154 +IDD_AUTHDLG DIALOG 36, 24, 250, 154 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Authentication Required" FONT 8, "MS Shell Dlg" @@ -61,8 +61,3 @@ FONT 8, "MS Shell Dlg" PUSHBUTTON "V redu", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON PUSHBUTTON "Prekliči", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP } - -STRINGTABLE DISCARDABLE -{ - IDS_LANCONNECTION "LAN povezava" -} diff --git a/dll/win32/wininet/wininet_Sr.rc b/dll/win32/wininet/wininet_Sr.rc new file mode 100644 index 00000000000..37a57420514 --- /dev/null +++ b/dll/win32/wininet/wininet_Sr.rc @@ -0,0 +1,106 @@ +/* + * Copyright 2003 Mike McCormack for CodeWeavers + * Copyright 2010 Đorđe Vasiljević + * + * 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 "resource.h" + +#pragma code_page(65001) + +LANGUAGE LANG_SERBIAN, SUBLANG_SERBIAN_CYRILLIC + +IDD_PROXYDLG DIALOG 36, 24, 250, 154 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Унос мрежне лозинке" +FONT 8, "MS Shell Dlg" +{ + LTEXT "Унесите своје корисничко име и лозинку:", -1, 40, 6, 150, 15 + LTEXT "Посредник", -1, 40, 26, 50, 10 + LTEXT "Домен", -1, 40, 46, 50, 10 + LTEXT "Корисничко име", -1, 40, 66, 50, 10 + LTEXT "Лозинка", -1, 40, 86, 50, 10 + LTEXT "", IDC_PROXY, 80, 26, 150, 14, 0 + LTEXT "", IDC_REALM, 80, 46, 150, 14, 0 + EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP + EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD + CHECKBOX "&Сачувај ову лозинку (небезбедно)", IDC_SAVEPASSWORD, + 80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP + PUSHBUTTON "У реду", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON + PUSHBUTTON "Откажи", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP +} + +IDD_AUTHDLG DIALOG 36, 24, 250, 154 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Потврда идентитета" +FONT 8, "MS Shell Dlg" +{ + LTEXT "Унесите своје корисничко име и лозинку:", -1, 40, 6, 150, 15 + LTEXT "Сервер", -1, 40, 26, 50, 10 + LTEXT "Домен", -1, 40, 46, 50, 10 + LTEXT "Корисничко име", -1, 40, 66, 50, 10 + LTEXT "Лозинка", -1, 40, 86, 50, 10 + LTEXT "", IDC_SERVER, 80, 26, 150, 14, 0 + LTEXT "", IDC_REALM, 80, 46, 150, 14, 0 + EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP + EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD + CHECKBOX "&Сачувај ову лозинку (небезбедно)", IDC_SAVEPASSWORD, + 80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP + PUSHBUTTON "У реду", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON + PUSHBUTTON "Откажи", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP +} + +LANGUAGE LANG_SERBIAN, SUBLANG_SERBIAN_LATIN + +IDD_PROXYDLG DIALOG 36, 24, 250, 154 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Unos mrežne lozinke" +FONT 8, "MS Shell Dlg" +{ + LTEXT "Unesite svoje korisničko ime i lozinku:", -1, 40, 6, 150, 15 + LTEXT "Posrednik", -1, 40, 26, 50, 10 + LTEXT "Domen", -1, 40, 46, 50, 10 + LTEXT "Korisničko ime", -1, 40, 66, 50, 10 + LTEXT "Lozinka", -1, 40, 86, 50, 10 + LTEXT "", IDC_PROXY, 80, 26, 150, 14, 0 + LTEXT "", IDC_REALM, 80, 46, 150, 14, 0 + EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP + EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD + CHECKBOX "&Sačuvaj ovu lozinku (nebezbedno)", IDC_SAVEPASSWORD, + 80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP + PUSHBUTTON "U redu", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON + PUSHBUTTON "Otkaži", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP +} + +IDD_AUTHDLG DIALOG 36, 24, 250, 154 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Potvrda identiteta" +FONT 8, "MS Shell Dlg" +{ + LTEXT "Unesite svoje korisničko ime i lozinku:", -1, 40, 6, 150, 15 + LTEXT "Server", -1, 40, 26, 50, 10 + LTEXT "Domen", -1, 40, 46, 50, 10 + LTEXT "Korisničko ime", -1, 40, 66, 50, 10 + LTEXT "Lozinka", -1, 40, 86, 50, 10 + LTEXT "", IDC_SERVER, 80, 26, 150, 14, 0 + LTEXT "", IDC_REALM, 80, 46, 150, 14, 0 + EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP + EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD + CHECKBOX "&Sačuvaj ovu lozinku (nebezbedno)", IDC_SAVEPASSWORD, + 80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP + PUSHBUTTON "U redu", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON + PUSHBUTTON "Otkaži", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP +} diff --git a/dll/win32/wininet/wininet_Sv.rc b/dll/win32/wininet/wininet_Sv.rc index 65252f400e2..50e57d0ed49 100644 --- a/dll/win32/wininet/wininet_Sv.rc +++ b/dll/win32/wininet/wininet_Sv.rc @@ -1,4 +1,4 @@ -/* +/* * Copyright 2007 Daniel Nylander * * This library is free software; you can redistribute it and/or @@ -20,27 +20,54 @@ LANGUAGE LANG_SWEDISH, SUBLANG_NEUTRAL -IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154 +IDD_PROXYDLG DIALOG 36, 24, 250, 154 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Ange ntverkslsenord" +CAPTION "Ange nätverkslösenord" FONT 8, "MS Shell Dlg" { - LTEXT "Ange ditt anvndarnamn och lsenord:", -1, 40, 6, 150, 15 + LTEXT "Ange ditt användarnamn och lösenord:", -1, 40, 6, 150, 15 LTEXT "Proxy", -1, 40, 26, 50, 10 - LTEXT "Domn", -1, 40, 46, 50, 10 - LTEXT "Anvndarnamn", -1, 40, 66, 50, 10 - LTEXT "Lsenord", -1, 40, 86, 50, 10 + LTEXT "Domän", -1, 40, 46, 50, 10 + LTEXT "Användare", -1, 40, 66, 50, 10 + LTEXT "Lösenord", -1, 40, 86, 50, 10 LTEXT "", IDC_PROXY, 80, 26, 150, 14, 0 LTEXT "", IDC_REALM, 80, 46, 150, 14, 0 EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD - CHECKBOX "&Spara detta lsenord (oskert)", IDC_SAVEPASSWORD, + CHECKBOX "&Spara detta lösenord (osäkert)", IDC_SAVEPASSWORD, 80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP PUSHBUTTON "OK", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON PUSHBUTTON "Avbryt", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP } -STRINGTABLE DISCARDABLE +IDD_AUTHDLG DIALOG 36, 24, 250, 154 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Autentisering krävs" +FONT 8, "MS Shell Dlg" { - IDS_LANCONNECTION "LAN-anslutning" + LTEXT "Ange ditt användarnamn och lösenord:", -1, 40, 6, 150, 15 + LTEXT "Server", -1, 40, 26, 50, 10 + LTEXT "Domän", -1, 40, 46, 50, 10 + LTEXT "Användare", -1, 40, 66, 50, 10 + LTEXT "Lösenord", -1, 40, 86, 50, 10 + LTEXT "", IDC_SERVER, 80, 26, 150, 14, 0 + LTEXT "", IDC_REALM, 80, 46, 150, 14, 0 + EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP + EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD + CHECKBOX "&Spara detta lösenord (osäkert)", IDC_SAVEPASSWORD, + 80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP + PUSHBUTTON "OK", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON + PUSHBUTTON "Avbryt", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP +} + +IDD_INVCERTDLG DIALOG 3, 24, 250, 86 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Säkerhetsvarning" +FONT 8, "MS Shell Dlg" +{ + LTEXT "Ett problem upptäcktes med certifikatet för denna site.", -1, 40, 6, 200, 20 + LTEXT "", IDC_CERT_ERROR, 40, 26, 200, 20 + LTEXT "Vill du fortsätta ändå?", -1, 40, 46, 200, 20 + PUSHBUTTON "Ja", IDOK, 40, 66, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON + PUSHBUTTON "Nej", IDCANCEL, 100, 66, 56, 14, WS_GROUP | WS_TABSTOP } diff --git a/dll/win32/wininet/wininet_Tr.rc b/dll/win32/wininet/wininet_Tr.rc index bfd675e52a4..7d54a68408f 100644 --- a/dll/win32/wininet/wininet_Tr.rc +++ b/dll/win32/wininet/wininet_Tr.rc @@ -1,7 +1,7 @@ -/* +/* * Turkish Resources * - * Copyright 2006 Fatih Ac + * Copyright 2006 Fatih Aþýcý * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -22,27 +22,22 @@ LANGUAGE LANG_TURKISH, SUBLANG_DEFAULT -IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154 +IDD_PROXYDLG DIALOG 36, 24, 250, 154 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "A Parolasn Girin" +CAPTION "Að Parolasýný Girin" FONT 8, "MS Shell Dlg" { - LTEXT "Ltfen kullanc adnz ve parolanz girin:", -1, 40, 6, 150, 15 + LTEXT "Lütfen kullanýcý adýnýzý ve parolanýzý girin:", -1, 40, 6, 150, 15 LTEXT "Proxy", -1, 40, 26, 50, 10 LTEXT "Realm", -1, 40, 46, 50, 10 - LTEXT "Kullanc", -1, 40, 66, 50, 10 + LTEXT "Kullanýcý", -1, 40, 66, 50, 10 LTEXT "Parola", -1, 40, 86, 50, 10 LTEXT "", IDC_PROXY, 80, 26, 150, 14, 0 LTEXT "", IDC_REALM, 80, 46, 150, 14, 0 EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD - CHECKBOX "Bu parolay &sakla (gvensiz)", IDC_SAVEPASSWORD, + CHECKBOX "Bu parolayý &sakla (güvensiz)", IDC_SAVEPASSWORD, 80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP PUSHBUTTON "Tamam", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON - PUSHBUTTON "ptal", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP -} - -STRINGTABLE DISCARDABLE -{ - IDS_LANCONNECTION "LAN Balants" + PUSHBUTTON "Ýptal", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP } diff --git a/dll/win32/wininet/wininet_Uk.rc b/dll/win32/wininet/wininet_Uk.rc index 6a61a4c22c8..3ab0ec34671 100644 --- a/dll/win32/wininet/wininet_Uk.rc +++ b/dll/win32/wininet/wininet_Uk.rc @@ -2,6 +2,7 @@ * wininet.dll (Ukrainian resources) * * Copyright 2006 Artem Reznikov + * Copyright 2010 Igor Paliychuk * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,29 +21,47 @@ #include "resource.h" +/* UTF-8 */ +#pragma code_page(65001) + LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT -IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154 +IDD_PROXYDLG DIALOG 36, 24, 250, 154 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " " +CAPTION "Введіть Мережний Пароль" FONT 8, "MS Shell Dlg" { - LTEXT " , ' :", -1, 40, 6, 150, 15 - LTEXT "", -1, 40, 26, 50, 10 - LTEXT "", -1, 40, 46, 50, 10 - LTEXT "", -1, 40, 66, 50, 10 - LTEXT "", -1, 40, 86, 50, 10 + LTEXT "Будь ласка, введіть Ваші ім'я та пароль:", -1, 40, 6, 150, 15 + LTEXT "Проксі", -1, 40, 26, 50, 10 + LTEXT "Область", -1, 40, 46, 50, 10 + LTEXT "Користувач", -1, 40, 66, 50, 10 + LTEXT "Пароль", -1, 40, 86, 50, 10 LTEXT "", IDC_PROXY, 80, 26, 150, 14, 0 LTEXT "", IDC_REALM, 80, 46, 150, 14, 0 EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD - CHECKBOX "& ()", IDC_SAVEPASSWORD, + CHECKBOX "&Зберегти цей пароль (небезпечно)", IDC_SAVEPASSWORD, 80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP PUSHBUTTON "OK", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON - PUSHBUTTON "", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP + PUSHBUTTON "Скасувати", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP } -STRINGTABLE DISCARDABLE +IDD_AUTHDLG DIALOG 36, 24, 250, 154 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Необхідна авторизація" +FONT 8, "MS Shell Dlg" { - IDS_LANCONNECTION "ϳ " + LTEXT "Будь ласка, введіть Ваші ім'я та пароль:", -1, 40, 6, 150, 15 + LTEXT "Сервер", -1, 40, 26, 50, 10 + LTEXT "Область", -1, 40, 46, 50, 10 + LTEXT "Користувач", -1, 40, 66, 50, 10 + LTEXT "Пароль", -1, 40, 86, 50, 10 + LTEXT "", IDC_SERVER, 80, 26, 150, 14, 0 + LTEXT "", IDC_REALM, 80, 46, 150, 14, 0 + EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP + EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD + CHECKBOX "&Зберегти цей пароль (небезпечно)", IDC_SAVEPASSWORD, + 80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP + PUSHBUTTON "OK", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON + PUSHBUTTON "Скасувати", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP } diff --git a/dll/win32/wininet/wininet_Zh.rc b/dll/win32/wininet/wininet_Zh.rc index 4d5a5502ece..c242fd4f512 100644 --- a/dll/win32/wininet/wininet_Zh.rc +++ b/dll/win32/wininet/wininet_Zh.rc @@ -2,6 +2,7 @@ * wininet (Simplified and Traditional Chinese Resources) * * Copyright 2008 Hongbo Ni + * Copyright 2010 Rex Tsai * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -25,7 +26,7 @@ LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED -IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154 +IDD_PROXYDLG DIALOG 36, 24, 250, 154 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "输入网络密码" FONT 9, "MS Shell Dlg" @@ -45,34 +46,44 @@ FONT 9, "MS Shell Dlg" PUSHBUTTON "取消", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP } -STRINGTABLE DISCARDABLE -{ - IDS_LANCONNECTION "局域网连接" -} - LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL -IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154 +IDD_PROXYDLG DIALOG 36, 24, 250, 154 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "輸入網路密碼" FONT 9, "MS Shell Dlg" { - LTEXT "請輸入你的用戶名和密碼:", -1, 40, 6, 150, 15 - LTEXT "代理", -1, 40, 26, 50, 10 + LTEXT "請輸入您的帳號和密碼:", -1, 40, 6, 150, 15 + LTEXT "代理伺服器", -1, 40, 26, 50, 10 LTEXT "Realm", -1, 40, 46, 50, 10 - LTEXT "用戶", -1, 40, 66, 50, 10 + LTEXT "帳號", -1, 40, 66, 50, 10 LTEXT "密碼", -1, 40, 86, 50, 10 LTEXT "", IDC_PROXY, 80, 26, 150, 14, 0 LTEXT "", IDC_REALM, 80, 46, 150, 14, 0 EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD - CHECKBOX "儲存密碼(不安全)(&S)", IDC_SAVEPASSWORD, + CHECKBOX "儲存密碼 (不安全)(&S)", IDC_SAVEPASSWORD, 80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP PUSHBUTTON "確定", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON PUSHBUTTON "取消", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP } -STRINGTABLE DISCARDABLE +IDD_AUTHDLG DIALOG 36, 24, 250, 154 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "需要認證" +FONT 8, "MS Shell Dlg" { - IDS_LANCONNECTION "局域網連接" + LTEXT "請輸入您的帳號和密碼:", -1, 40, 6, 150, 15 + LTEXT "伺服器", -1, 40, 26, 50, 10 + LTEXT "Realm", -1, 40, 46, 50, 10 + LTEXT "帳號", -1, 40, 66, 50, 10 + LTEXT "密碼", -1, 40, 86, 50, 10 + LTEXT "", IDC_SERVER, 80, 26, 150, 14, 0 + LTEXT "", IDC_REALM, 80, 46, 150, 14, 0 + EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP + EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD + CHECKBOX "儲存密碼 (不安全)(&S)", IDC_SAVEPASSWORD, + 80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP + PUSHBUTTON "OK", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON + PUSHBUTTON "Cancel", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP } diff --git a/dll/win32/wininet/wininet_ros.diff b/dll/win32/wininet/wininet_ros.diff index a8721d6ec72..7aad769adcd 100644 --- a/dll/win32/wininet/wininet_ros.diff +++ b/dll/win32/wininet/wininet_ros.diff @@ -66,4 +66,29 @@ + if (select(0, &infd, NULL, NULL, &tv) > 0) { if (recv(nSocket, &lpszBuffer[nRecv], 1, 0) <= 0) - { \ No newline at end of file + { +Index: dll/win32/wininet/urlcache.c +=================================================================== +--- dll/win32/wininet/urlcache.c (revision 50814) ++++ dll/win32/wininet/urlcache.c (working copy) +@@ -527,6 +527,7 @@ + static const WCHAR HistoryPrefix[] = {'V','i','s','i','t','e','d',':',0}; + static const WCHAR CookieSuffix[] = {0}; + static const WCHAR CookiePrefix[] = {'C','o','o','k','i','e',':',0}; ++ static const WCHAR UserProfile[] = {'U','S','E','R','P','R','O','F','I','L','E',0}; + static const struct + { + int nFolder; /* CSIDL_* constant */ +@@ -540,6 +541,12 @@ + }; + DWORD i; + ++ if (GetEnvironmentVariableW(UserProfile, NULL, 0) == 0 && GetLastError() == ERROR_ENVVAR_NOT_FOUND) ++ { ++ TRACE("Environment variable 'USERPROFILE' does not exist!\n"); ++ return; ++ } ++ + for (i = 0; i < sizeof(DefaultContainerData) / sizeof(DefaultContainerData[0]); i++) + { + WCHAR wszCachePath[MAX_PATH]; diff --git a/dll/win32/winmm/registry.c b/dll/win32/winmm/registry.c index 8cb17651048..b967723d14b 100644 --- a/dll/win32/winmm/registry.c +++ b/dll/win32/winmm/registry.c @@ -29,10 +29,10 @@ BOOL LoadRegistryMMEDrivers(char* key) HKEY drivers_key; DWORD value_name_length = 256; - char value_name[value_name_length]; + char value_name[256]; DWORD value_data_length = 256; - char value_data[value_data_length]; + char value_data[256]; DWORD value_type; diff --git a/dll/win32/winmm/winmm_Uk.rc b/dll/win32/winmm/winmm_Uk.rc index fa23cc7b959..eca92ad8d93 100644 --- a/dll/win32/winmm/winmm_Uk.rc +++ b/dll/win32/winmm/winmm_Uk.rc @@ -16,111 +16,114 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +/* UTF-8 */ +#pragma code_page(65001) + STRINGTABLE LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT BEGIN /* MMSYS errors */ -MMSYSERR_NOERROR, " ." -MMSYSERR_ERROR, " ." -MMSYSERR_BADDEVICEID, " , ." -MMSYSERR_NOTENABLED, " ." -MMSYSERR_ALLOCATED, " . , , ." -MMSYSERR_INVALHANDLE, " ." -MMSYSERR_NODRIVER, " !\n" -MMSYSERR_NOMEM, " ' . ." -MMSYSERR_NOTSUPPORTED, " . Capabilities, , ." -MMSYSERR_BADERRNUM, " ." -MMSYSERR_INVALFLAG, " ." -MMSYSERR_INVALPARAM, " ." +MMSYSERR_NOERROR, "Указану команду виконано." +MMSYSERR_ERROR, "Невідома зовнішня помилка." +MMSYSERR_BADDEVICEID, "Указано код пристрою, який не використовується в системі." +MMSYSERR_NOTENABLED, "Драйвер не підключений." +MMSYSERR_ALLOCATED, "Указаний пристрій уже використовується. Зачекайте, поки він звільниться, і повторіть спробу." +MMSYSERR_INVALHANDLE, "Указано неправильний дескриптор пристрою." +MMSYSERR_NODRIVER, "У системі немає установлених драйверів !\n" +MMSYSERR_NOMEM, "Недостатньо пам'яті для виконання цього завдання. Закрийте один або декілька додатків і повторіть спробу." +MMSYSERR_NOTSUPPORTED, "Ця функція не підтримується. Скористайтеся функцією Capabilities, щоб одержати список функцій і повідомлень, які підтримує драйвер." +MMSYSERR_BADERRNUM, "Указаний номер помилки не визначений у системі." +MMSYSERR_INVALFLAG, "До системної функції передано неправильний прапор." +MMSYSERR_INVALPARAM, "До системної функції передано неправильний параметр." /* WAVE errors */ -WAVERR_BADFORMAT, " , . Capabilities, , ." -WAVERR_STILLPLAYING, " . ." -WAVERR_UNPREPARED, " . Prepare, , ." -WAVERR_SYNC, " WAVE_ALLOWSYNC. ." +WAVERR_BADFORMAT, "Указаний формат не підтримується, або його неможливо перетворити. Скористайтеся функцією Capabilities, щоб одержати список форматів, які підтримуються." +WAVERR_STILLPLAYING, "Неможливо виконати цю операцію під час відтворення даних із носія. Зупиніть відтворення даних або зачекайте на його закінчення." +WAVERR_UNPREPARED, "Заголовок звукозапису не підготований. Скористайтеся функцією Prepare, щоб підготувати його, і повторіть спробу." +WAVERR_SYNC, "Неможливо відкрити цей пристрій без використання прапорця WAVE_ALLOWSYNC. Установіть цей прапорець і повторіть спробу." /* MIDI errors */ -MIDIERR_UNPREPARED, " MIDI . Prepare, , ." -MIDIERR_STILLPLAYING, " . ." -MIDIERR_NOMAP, " MIDI. , , MIDIMAP.CFG ." -MIDIERR_NOTREADY, " . , , ." -MIDIERR_NODEVICE, " MIDI- , . MIDI Mapper." -MIDIERR_INVALIDSETUP, " MIDI . MIDIMAP.CFG SYSTEM ReactOS ." +MIDIERR_UNPREPARED, "Заголовок MIDI не підготовлений. Скористайтеся функцією Prepare, щоб підготувати його, і повторіть спробу." +MIDIERR_STILLPLAYING, "Неможливо виконати цю операцію під час відтворення даних із носія. Зупиніть відтворення даних або зачекайте на його закінчення." +MIDIERR_NOMAP, "Не знайдено таблиці пристроїв MIDI. Можливо, виникли проблеми з драйвером, або файл MIDIMAP.CFG пошкоджений або відсутній." +MIDIERR_NOTREADY, "Порт передає дані до пристрою. Зачекайте, поки дані не будуть передані, і повторіть спробу." +MIDIERR_NODEVICE, "Поточна настройка відповідності MIDI-пристроїв посилається на пристрій, не установлений у системі. Змініть параметри за допомогою MIDI Mapper." +MIDIERR_INVALIDSETUP, "Поточна настройка MIDI пошкоджена. Скопіюйте вихідний файл MIDIMAP.CFG до підпапки SYSTEM папки ReactOS і повторіть спробу." /* MCI errors */ -MCIERR_INVALID_DEVICE_ID, " MCI. , ." -MCIERR_UNRECOGNIZED_KEYWORD, " ." -MCIERR_UNRECOGNIZED_COMMAND, " ." -MCIERR_HARDWARE, " . , , ." -MCIERR_INVALID_DEVICE_NAME, " MCI." -MCIERR_OUT_OF_MEMORY, " ' . \n ." -MCIERR_DEVICE_OPEN, " ' . ." -MCIERR_CANNOT_LOAD_DRIVER, " ." -MCIERR_MISSING_COMMAND_STRING, " ." -MCIERR_PARAM_OVERFLOW, " . ." -MCIERR_MISSING_STRING_ARGUMENT, " . ." -MCIERR_BAD_INTEGER, " ." -MCIERR_PARSER_INTERNAL, " . , ." -MCIERR_DRIVER_INTERNAL, " . , ." -MCIERR_MISSING_PARAMETER, " . ." -MCIERR_UNSUPPORTED_FUNCTION, " MCI, , ." -MCIERR_FILE_NOT_FOUND, " . , ' ." -MCIERR_DEVICE_NOT_READY, " ." -MCIERR_INTERNAL, " MCI. ReactOS." -MCIERR_DRIVER, " . . ." -MCIERR_CANNOT_USE_ALL, " 'all' () ' ." -MCIERR_MULTIPLE, " . , ." -MCIERR_EXTENSION_NOT_FOUND, " ." -MCIERR_OUTOFRANGE, " ." -MCIERR_FLAGS_NOT_COMPATIBLE, " ." -MCIERR_FILE_NOT_SAVED, " . , , ' ." -MCIERR_DEVICE_TYPE_REQUIRED, " . , , ' ." -MCIERR_DEVICE_LOCKED, " . , ." -MCIERR_DUPLICATE_ALIAS, " . ." -MCIERR_BAD_CONSTANT, " ." -MCIERR_MUST_USE_SHAREABLE, " . , 'shareable' 'open'." -MCIERR_MISSING_DEVICE_NAME, " ' , . ." -MCIERR_BAD_TIME_FORMAT, " . MCI." -MCIERR_NO_CLOSING_QUOTE, " . ." -MCIERR_DUPLICATE_FLAGS, " . ." -MCIERR_INVALID_FILE, " MCI. , , ." -MCIERR_NULL_PARAMETER_BLOCK, " MCI ." -MCIERR_UNNAMED_RESOURCE, " . ' ." -MCIERR_NEW_REQUIRES_ALIAS, " 'new', ." -MCIERR_NOTIFY_ON_AUTO_OPEN, " 'notify' , ." -MCIERR_NO_ELEMENT_ALLOWED, " ' ." -MCIERR_NONAPPLICABLE_FUNCTION, " . ." -MCIERR_ILLEGAL_FOR_AUTO_OPEN, " , . , , ." -MCIERR_FILENAME_REQUIRED, "' . , 8 , ." -MCIERR_EXTRA_CHARACTERS, " , ." -MCIERR_DEVICE_NOT_INSTALLED, " . , ." -MCIERR_GET_CD, " MCI. '." -MCIERR_SET_CD, " MCI, ." -MCIERR_SET_DRIVE, " MCI, ." -MCIERR_DEVICE_LENGTH, " 79 ." -MCIERR_DEVICE_ORD_LENGTH, " 69 ." -MCIERR_NO_INTEGER, " . ." -MCIERR_WAVE_OUTPUTSINUSE, " , , . , , ." -MCIERR_WAVE_SETOUTPUTINUSE, " , . , , ." -MCIERR_WAVE_INPUTSINUSE, " , , . , , ." -MCIERR_WAVE_SETINPUTINUSE, " , . , , ." -MCIERR_WAVE_OUTPUTUNSPECIFIED, " - ." -MCIERR_WAVE_INPUTUNSPECIFIED, " - ." -MCIERR_WAVE_OUTPUTSUNSUITABLE, " , . , ." -MCIERR_WAVE_SETOUTPUTUNSUITABLE,", , ." -MCIERR_WAVE_INPUTSUNSUITABLE, " , . , ." -MCIERR_WAVE_SETINPUTUNSUITABLE, ", , ." -MCIERR_NO_WINDOW, " ." -MCIERR_CREATEWINDOW, " ." -MCIERR_FILE_READ, " . , , ." -MCIERR_FILE_WRITE, " . , ' ." -MCIERR_SEQ_DIV_INCOMPATIBLE, " "" "" SMPTE . ." -MCIERR_SEQ_NOMIDIPRESENT, " MIDI. , MIDI." -MCIERR_SEQ_PORT_INUSE, " MIDI . , , ." -MCIERR_SEQ_PORT_MAPNODEVICE, " MIDI- , . MIDI Mapper ." -MCIERR_SEQ_PORT_MISCERROR, " ." -MCIERR_SEQ_PORT_NONEXISTENT, " MIDI . , MIDI." -MCIERR_SEQ_PORTUNSPECIFIED, " MIDI." -MCIERR_SEQ_TIMER, " . ." +MCIERR_INVALID_DEVICE_ID, "Неправильний код пристрою MCI. Використайте код, який було повернуто після відкриття пристрою." +MCIERR_UNRECOGNIZED_KEYWORD, "Драйвер не може розпізнати вказаний параметр команди." +MCIERR_UNRECOGNIZED_COMMAND, "Драйвер не може розпізнати вказану команду." +MCIERR_HARDWARE, "Виникла проблема з пристроєм мультимедіа. Переконайтеся, що пристрій працює правильно, або зверніться до його виробника." +MCIERR_INVALID_DEVICE_NAME, "Указаний пристрій не відкритий або не розпізнається інтерфейсом MCI." +MCIERR_OUT_OF_MEMORY, "Недостатньо пам'яті для виконання цього завдання. \nЗакрийте один або декілька додатків і повторіть спробу." +MCIERR_DEVICE_OPEN, "Це ім'я пристрою вже використовується додатком як псевдонім. Задайте унікальний псевдонім." +MCIERR_CANNOT_LOAD_DRIVER, "Сталася невідома помилка під час завантаження вказаного драйвера пристрою." +MCIERR_MISSING_COMMAND_STRING, "Не вказана команда." +MCIERR_PARAM_OVERFLOW, "Довжина рядка виводу перевищує розмір буфера. Збільште розмір буфера." +MCIERR_MISSING_STRING_ARGUMENT, "Указана команда потребує текстовий параметр. Укажіть його." +MCIERR_BAD_INTEGER, "Указане ціле число непридатне для цієї команди." +MCIERR_PARSER_INTERNAL, "Драйвер пристрою повернув значення неприпустимого типу. Зверніться до виробника пристрою, щоб отримати новий драйвер." +MCIERR_DRIVER_INTERNAL, "Виникла проблема з драйвером пристрою. Зверніться до виробника пристрою, щоб отримати новий драйвер." +MCIERR_MISSING_PARAMETER, "Указана команда потребує параметр. Укажіть його." +MCIERR_UNSUPPORTED_FUNCTION, "Пристрій MCI, який використовується, не підтримує вказану команду." +MCIERR_FILE_NOT_FOUND, "Неможливо знайти вказаний файл. Перевірте, чи правильно вказані шлях та ім'я файлу." +MCIERR_DEVICE_NOT_READY, "Драйвер пристрою не готовий." +MCIERR_INTERNAL, "Сталася помилка під час ініціалізації MCI. Спробуйте перезапустити ReactOS." +MCIERR_DRIVER, "Виникла проблема із драйвером пристрою. Драйвер був закритий. Неможливо отримати код помилки." +MCIERR_CANNOT_USE_ALL, "Неможливо використовувати параметр 'all' (усі) як ім'я пристрою для вказаної команди." +MCIERR_MULTIPLE, "Сталося декілька помилок на різних пристроях. Щоб визначити джерело помилок, виконайте окремо кожну команду для кожного пристрою." +MCIERR_EXTENSION_NOT_FOUND, "Неможливо визначити тип пристрою за вказаним розширенням імені файлу." +MCIERR_OUTOFRANGE, "Указаний параметр має неприпустиме значення для вказаної команди." +MCIERR_FLAGS_NOT_COMPATIBLE, "Указані параметри неможливо використовувати одночасно." +MCIERR_FILE_NOT_SAVED, "Неможливо зберегти вказаний файл. Переконайтеся, що на диску достатньо вільного місця, або що комп'ютер ще підключений до мережі." +MCIERR_DEVICE_TYPE_REQUIRED, "Неможливо знайти вказаний пристрій. Переконайтеся, що він установлений, або що ім'я пристрою введено правильно." +MCIERR_DEVICE_LOCKED, "Указаний пристрій зараз закривається. Зачекайте декілька секунд, а потім повторіть спробу." +MCIERR_DUPLICATE_ALIAS, "Указаний псевдонім уже використовується в цьому додатку. Задайте унікальний псевдонім." +MCIERR_BAD_CONSTANT, "Указаний параметр неприпустимий для цієї команди." +MCIERR_MUST_USE_SHAREABLE, "Драйвер пристрою вже використовується. Щоб дозволити спільний доступ до драйвера, необхідно використовувати параметр 'shareable' із кожною командою 'open'." +MCIERR_MISSING_DEVICE_NAME, "Для вказаної команди потрібен псевдонім або ім'я файлу, драйвера або пристрою. Укажіть його." +MCIERR_BAD_TIME_FORMAT, "Указано невірне значення для формату часу. Припустимі формати вказані в документації з MCI." +MCIERR_NO_CLOSING_QUOTE, "При вводі значення параметра було пропущено закриваючий знак лапок. Введіть його." +MCIERR_DUPLICATE_FLAGS, "Параметр або значення вказані двічі. Укажіть його лише один раз." +MCIERR_INVALID_FILE, "Указаний файл не може бути відтворений на вибраному пристрої MCI. Можливо, файл пошкоджений, має неприпустимий формат." +MCIERR_NULL_PARAMETER_BLOCK, "До інтерфейсу MCI було передано пустий блок параметрів." +MCIERR_UNNAMED_RESOURCE, "Неможливо зберегти файл без імені. Введіть ім'я файлу." +MCIERR_NEW_REQUIRES_ALIAS, "Якщо використовується параметр 'new', необхідно вказати псевдонім." +MCIERR_NOTIFY_ON_AUTO_OPEN, "Прапор 'notify' неможливо використовувати для пристроїв, які відкриваються автоматично." +MCIERR_NO_ELEMENT_ALLOWED, "Неможливо використовувати ім'я файлу для вказаного пристрою." +MCIERR_NONAPPLICABLE_FUNCTION, "Неможливо виконати команди у вказаній послідовності. Змініть послідовність команд і повторіть спробу." +MCIERR_ILLEGAL_FOR_AUTO_OPEN, "Неможливо виконати вказану команду для пристрою, який відкривається автоматично. Зачекайте, поки пристрій не буде закрито, і повторіть спробу." +MCIERR_FILENAME_REQUIRED, "Ім'я файлу неправильне. Переконайтеся, що довжина імені файлу не перевищує 8 символів, після яких стоїть крапка й розширення." +MCIERR_EXTRA_CHARACTERS, "Неможливо вводити додаткові символи після рядка, забраного в лапки." +MCIERR_DEVICE_NOT_INSTALLED, "Указаний пристрій не установлений у системі. Скористайтесь пунктом Драйвери в Панелі керування, щоб установити пристрій." +MCIERR_GET_CD, "Неможливо отримати доступ до вказаного файлу або пристрою MCI. Спробуйте змінити каталог або перезавантажити комп'ютер." +MCIERR_SET_CD, "Неможливо отримати доступ до вказаного файлу або пристрою MCI, тому що додаток не може змінити папку." +MCIERR_SET_DRIVE, "Неможливо отримати доступ до вказаного файлу або пристрою MCI, тому що додаток не може змінити диск." +MCIERR_DEVICE_LENGTH, "Довжина імені пристрою або драйвера не може перевищувати 79 символів." +MCIERR_DEVICE_ORD_LENGTH, "Довжина імені пристрою або драйвера не може перевищувати 69 символів." +MCIERR_NO_INTEGER, "Указана команда потребує цілий параметр. Введіть його." +MCIERR_WAVE_OUTPUTSINUSE, "Усі пристрої, які можуть відтворювати файли поточного формату, зараз зайняті. Зачекайте, поки пристрій звільниться, і повторіть спробу." +MCIERR_WAVE_SETOUTPUTINUSE, "Неможливо ввімкнути режим відтворення для поточного звукового пристрою, тому що він зайнятий. Зачекайте, поки пристрій не звільниться, і повторіть спробу." +MCIERR_WAVE_INPUTSINUSE, "Усі пристрої, які можуть записувати файли поточного формату, зараз зайняті. Зачекайте, поки пристрій звільниться, і повторіть спробу." +MCIERR_WAVE_SETINPUTINUSE, "Неможливо ввімкнути режим запису для поточного звукового пристрою, тому що він зайнятий. Зачекайте, поки пристрій не звільниться, і повторіть спробу." +MCIERR_WAVE_OUTPUTUNSPECIFIED, "Можна використовувати будь-які сумісні пристрої відтворення звукових файлів." +MCIERR_WAVE_INPUTUNSPECIFIED, "Можна використовувати будь-які сумісні пристрої запису звукових файлів." +MCIERR_WAVE_OUTPUTSUNSUITABLE, "Не установлено жодного пристрою, який може відтворювати файли поточного формату. Скористайтесь пунктом Драйвери, щоб установити звуковий пристрій." +MCIERR_WAVE_SETOUTPUTUNSUITABLE,"Пристрій, на якому ви намагаєтесь відтворити звук, не розпізнає поточного формату файлу." +MCIERR_WAVE_INPUTSUNSUITABLE, "Не установлено жодного пристрою, який може записувати файли поточного формату. Скористайтесь пунктом Драйвери, щоб установити звуковий пристрій." +MCIERR_WAVE_SETINPUTUNSUITABLE, "Пристрій, на якому ви намагаєтеся записати звук, не розпізнає поточного формату файлу." +MCIERR_NO_WINDOW, "Немає вікна перегляду." +MCIERR_CREATEWINDOW, "Неможливо створити або використати вікно." +MCIERR_FILE_READ, "Неможливо прочитати вказаний файл. Переконайтеся, що файл не видалений, і перевірте підключення до диску або мережі." +MCIERR_FILE_WRITE, "Неможливо записати до вказаного файлу. Переконайтеся, що на диску є достатньо вільного простору та що комп'ютер ще підключений до мережі." +MCIERR_SEQ_DIV_INCOMPATIBLE, "Формати часу ""вказівник пісні"" та SMPTE взаємовиключні. Неможливо використовувати їх одночасно." +MCIERR_SEQ_NOMIDIPRESENT, "У системі немає установлених пристроїв MIDI. Скористайтесь пунктом Драйвери в Панелі керування, щоб установити драйвер MIDI." +MCIERR_SEQ_PORT_INUSE, "Указаний порт MIDI уже використовується. Зачекайте, поки він звільниться, і повторіть спробу." +MCIERR_SEQ_PORT_MAPNODEVICE, "Поточна настройка відповідності MIDI-пристроїв посилається на пристрій, не установлений у системі. Скористайтесь пунктом MIDI Mapper в Панелі керування для редагування установок." +MCIERR_SEQ_PORT_MISCERROR, "Сталася помилка із вказаним портом." +MCIERR_SEQ_PORT_NONEXISTENT, "Указаний пристрій MIDI не установлений у системі. Скористайтесь пунктом Драйвери в Панелі керування, щоб установити пристрій MIDI." +MCIERR_SEQ_PORTUNSPECIFIED, "У системі не указаний поточний порт MIDI." +MCIERR_SEQ_TIMER, "Усі таймери мультимедіа використовуються іншими додатками. Закрийте один із цих додатків і повторіть спробу." END diff --git a/dll/win32/winsta/CMakeLists.txt b/dll/win32/winsta/CMakeLists.txt index 2d46896145f..1b6ecef8477 100644 --- a/dll/win32/winsta/CMakeLists.txt +++ b/dll/win32/winsta/CMakeLists.txt @@ -12,12 +12,10 @@ list(APPEND SOURCE winsta.rc ${CMAKE_CURRENT_BINARY_DIR}/winsta.def) -add_library(winsta SHARED - ${CMAKE_CURRENT_BINARY_DIR}/winsta_winsta.h.gch - ${SOURCE}) +add_library(winsta SHARED ${SOURCE}) set_module_type(winsta win32dll) target_link_libraries(winsta wine) add_importlibs(winsta msvcrt kernel32 ntdll) -add_pch(winsta ${CMAKE_CURRENT_SOURCE_DIR}/winsta.h ${SOURCE}) +add_pch(winsta winsta.h) add_cd_file(TARGET winsta DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/wlanapi/CMakeLists.txt b/dll/win32/wlanapi/CMakeLists.txt index eeaa6894daf..5c040013b8a 100644 --- a/dll/win32/wlanapi/CMakeLists.txt +++ b/dll/win32/wlanapi/CMakeLists.txt @@ -1,23 +1,25 @@ -include_directories(${REACTOS_BINARY_DIR}/include/reactos/idl) +include_directories( ${REACTOS_SOURCE_DIR}/include/reactos/idl) + +add_rpc_files(client ${REACTOS_SOURCE_DIR}/include/reactos/idl/wlansvc.idl) spec2def(wlanapi.dll wlanapi.spec) list(APPEND SOURCE main.c ${CMAKE_CURRENT_BINARY_DIR}/wlanapi_stubs.c - ${CMAKE_CURRENT_BINARY_DIR}/wlanapi.def) + ${CMAKE_CURRENT_BINARY_DIR}/wlanapi.def + ${CMAKE_CURRENT_BINARY_DIR}/wlansvc_c.c) add_library(wlanapi SHARED ${SOURCE}) set_entrypoint(wlanapi 0) target_link_libraries(wlanapi - wlansvcrpc wine ${PSEH_LIB}) -add_importlibs(wlanapi rpcrt4 kernel32 ntdll) +add_importlibs(wlanapi rpcrt4 msvcrt kernel32 ntdll) add_importlib_target(wlanapi.spec) add_dependencies(wlanapi psdk) diff --git a/dll/win32/ws2_32/CMakeLists.txt b/dll/win32/ws2_32/CMakeLists.txt index a39c061f7d5..b2fdb3f6c63 100644 --- a/dll/win32/ws2_32/CMakeLists.txt +++ b/dll/win32/ws2_32/CMakeLists.txt @@ -23,14 +23,14 @@ list(APPEND SOURCE ws2_32.rc ${CMAKE_CURRENT_BINARY_DIR}/ws2_32.def) -add_library(ws2_32 SHARED ${CMAKE_CURRENT_BINARY_DIR}/ws2_32_ws2_32.h.gch ${SOURCE}) +add_library(ws2_32 SHARED ${SOURCE}) set_module_type(ws2_32 win32dll) target_link_libraries(ws2_32 wine) add_importlibs(ws2_32 user32 advapi32 dnsapi ws2help msvcrt kernel32 ntdll) -add_pch(ws2_32 ${CMAKE_CURRENT_SOURCE_DIR}/include/ws2_32.h ${SOURCE}) +add_pch(ws2_32 include/ws2_32.h) add_cd_file(TARGET ws2_32 DESTINATION reactos/system32 FOR all) add_importlib_target(ws2_32.spec) diff --git a/dll/win32/ws2_32/include/ws2_32.h b/dll/win32/ws2_32/include/ws2_32.h index 7272a14098a..cc72137d220 100644 --- a/dll/win32/ws2_32/include/ws2_32.h +++ b/dll/win32/ws2_32/include/ws2_32.h @@ -7,7 +7,9 @@ #ifndef __WS2_32_H #define __WS2_32_H +#include #include +#include #define WIN32_NO_STATUS #include @@ -15,7 +17,7 @@ #include #include #define NTOS_MODE_USER -#include +#include #include @@ -23,6 +25,12 @@ #include #include // DNS_A_DATA +#include + +#include "catalog.h" +#include "handle.h" +#include "upcall.h" + #define EXPORT WINAPI extern HINSTANCE g_hInstDll; diff --git a/dll/win32/ws2_32/misc/bsd.c b/dll/win32/ws2_32/misc/bsd.c index 2e39c24b5e9..80cbef22911 100644 --- a/dll/win32/ws2_32/misc/bsd.c +++ b/dll/win32/ws2_32/misc/bsd.c @@ -7,7 +7,8 @@ * REVISIONS: * CSH 15/06-2001 Created */ -#include + +#include "ws2_32.h" /* * @implemented diff --git a/dll/win32/ws2_32/misc/catalog.c b/dll/win32/ws2_32/misc/catalog.c index 53de8b5e970..987dc56887c 100644 --- a/dll/win32/ws2_32/misc/catalog.c +++ b/dll/win32/ws2_32/misc/catalog.c @@ -7,9 +7,8 @@ * REVISIONS: * CSH 01/09-2000 Created */ -#include -#include +#include "ws2_32.h" LIST_ENTRY CatalogListHead; CRITICAL_SECTION CatalogLock; diff --git a/dll/win32/ws2_32/misc/dllmain.c b/dll/win32/ws2_32/misc/dllmain.c index 6eeb37efcac..bb365e06b0f 100644 --- a/dll/win32/ws2_32/misc/dllmain.c +++ b/dll/win32/ws2_32/misc/dllmain.c @@ -8,11 +8,7 @@ * CSH 01/09-2000 Created */ -#include -#include -#include -#include -#include +#include "ws2_32.h" #if DBG diff --git a/dll/win32/ws2_32/misc/event.c b/dll/win32/ws2_32/misc/event.c index dcc541682d1..58d4e647243 100644 --- a/dll/win32/ws2_32/misc/event.c +++ b/dll/win32/ws2_32/misc/event.c @@ -7,9 +7,8 @@ * REVISIONS: * CSH 01/09-2000 Created */ -#include -#include +#include "ws2_32.h" /* * @implemented diff --git a/dll/win32/ws2_32/misc/handle.c b/dll/win32/ws2_32/misc/handle.c index d5b54e3fb28..f22b5e415f6 100644 --- a/dll/win32/ws2_32/misc/handle.c +++ b/dll/win32/ws2_32/misc/handle.c @@ -7,9 +7,8 @@ * REVISIONS: * CSH 01/09-2000 Created */ -#include -#include -#include + +#include "ws2_32.h" PPROVIDER_HANDLE_BLOCK ProviderHandleTable; CRITICAL_SECTION ProviderHandleTableLock; diff --git a/dll/win32/ws2_32/misc/ns.c b/dll/win32/ws2_32/misc/ns.c index b98c628a0c4..6d765fd3580 100644 --- a/dll/win32/ws2_32/misc/ns.c +++ b/dll/win32/ws2_32/misc/ns.c @@ -7,9 +7,8 @@ * REVISIONS: * CSH 01/09-2000 Created */ -#include -#include -#include + +#include "ws2_32.h" #ifndef BUFSIZ #define BUFSIZ 1024 diff --git a/dll/win32/ws2_32/misc/sndrcv.c b/dll/win32/ws2_32/misc/sndrcv.c index 8fb4186933e..0ee077d056a 100644 --- a/dll/win32/ws2_32/misc/sndrcv.c +++ b/dll/win32/ws2_32/misc/sndrcv.c @@ -8,11 +8,7 @@ * CSH 01/09-2000 Created */ -#include -#include -#include -#include - +#include "ws2_32.h" /* * @implemented diff --git a/dll/win32/ws2_32/misc/stubs.c b/dll/win32/ws2_32/misc/stubs.c index 10dd98e1ded..1d2b3f49d10 100644 --- a/dll/win32/ws2_32/misc/stubs.c +++ b/dll/win32/ws2_32/misc/stubs.c @@ -7,9 +7,8 @@ * REVISIONS: * CSH 01/09-2000 Created */ -#include -#include -#include + +#include "ws2_32.h" /* * @implemented diff --git a/dll/win32/ws2_32/misc/upcall.c b/dll/win32/ws2_32/misc/upcall.c index ad0ce94963a..2bf92315926 100644 --- a/dll/win32/ws2_32/misc/upcall.c +++ b/dll/win32/ws2_32/misc/upcall.c @@ -7,9 +7,8 @@ * REVISIONS: * CSH 01/09-2000 Created */ -#include -#include -#include + +#include "ws2_32.h" /* * @implemented diff --git a/dll/win32/ws2_32_new/CMakeLists.txt b/dll/win32/ws2_32_new/CMakeLists.txt index 5999316ca9a..e8634301f58 100644 --- a/dll/win32/ws2_32_new/CMakeLists.txt +++ b/dll/win32/ws2_32_new/CMakeLists.txt @@ -48,8 +48,8 @@ list(APPEND SOURCE ${CMAKE_CURRENT_BINARY_DIR}/ws2_32.def) add_library(ws2_32_new SHARED ${SOURCE}) - set_module_type(ws2_32_new win32dll) -target_link_libraries(ws2_32_new wine) add_importlibs(ws2_32_new user32 advapi32 dnsapi ws2help msvcrt kernel32 ntdll) +add_pch(ws2_32_new inc/ws2_32.h) +target_link_libraries(ws2_32_new wine) add_cd_file(TARGET ws2_32_new DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/ws2_32_new/inc/ws2_32.h b/dll/win32/ws2_32_new/inc/ws2_32.h index 35cbb5bd542..e680d3a8502 100644 --- a/dll/win32/ws2_32_new/inc/ws2_32.h +++ b/dll/win32/ws2_32_new/inc/ws2_32.h @@ -5,8 +5,6 @@ * PURPOSE: WinSock 2.2 Main Header */ -#pragma once - /* Definitions for NDK Usage */ #define WIN32_NO_STATUS //#define _WIN32_WINNT 0x502 @@ -28,6 +26,8 @@ /* Winsock Helper Header */ #include +#include + /* Missing definitions */ #define SO_OPENTYPE 0x7008 #define SO_SYNCHRONOUS_NONALERT 0x20 diff --git a/dll/win32/ws2_32_new/src/getxbyxx.c b/dll/win32/ws2_32_new/src/getxbyxx.c index 53489e07d24..eae2f24345b 100644 --- a/dll/win32/ws2_32_new/src/getxbyxx.c +++ b/dll/win32/ws2_32_new/src/getxbyxx.c @@ -8,7 +8,6 @@ /* INCLUDES ******************************************************************/ #include "ws2_32.h" -#include //#define NDEBUG #include diff --git a/dll/win32/ws2_32_new/ws2_32.rbuild b/dll/win32/ws2_32_new/ws2_32.rbuild index 2fee79c1a9e..58aa1b294fa 100644 --- a/dll/win32/ws2_32_new/ws2_32.rbuild +++ b/dll/win32/ws2_32_new/ws2_32.rbuild @@ -9,6 +9,9 @@ advapi32 dnsapi ws2help + + ws2_32.h + addrconv.c addrinfo.c diff --git a/dll/win32/ws2help/CMakeLists.txt b/dll/win32/ws2help/CMakeLists.txt index 6de001c474c..52c5e9ed9a9 100644 --- a/dll/win32/ws2help/CMakeLists.txt +++ b/dll/win32/ws2help/CMakeLists.txt @@ -12,8 +12,8 @@ list(APPEND SOURCE ${CMAKE_CURRENT_BINARY_DIR}/ws2help.def) add_library(ws2help SHARED ${SOURCE}) - set_module_type(ws2help win32dll) add_importlibs(ws2help advapi32 ws2_32 msvcrt kernel32 ntdll) +add_pch(ws2help precomp.h) add_cd_file(TARGET ws2help DESTINATION reactos/system32 FOR all) add_importlib_target(ws2help.spec) diff --git a/dll/win32/ws2help/precomp.h b/dll/win32/ws2help/precomp.h index ce5f0f83b23..85fdef32407 100644 --- a/dll/win32/ws2help/precomp.h +++ b/dll/win32/ws2help/precomp.h @@ -20,7 +20,7 @@ /* Shared Winsock Helper headers */ #include -#include +#include "wshdrv.h" /* Missing definition */ #define SO_OPENTYPE 0x20 diff --git a/dll/win32/ws2help/ws2help.rbuild b/dll/win32/ws2help/ws2help.rbuild index 045c924e7ff..8f6180d6971 100644 --- a/dll/win32/ws2help/ws2help.rbuild +++ b/dll/win32/ws2help/ws2help.rbuild @@ -11,4 +11,5 @@ handle.c notify.c ws2help.rc + precomp.h diff --git a/dll/win32/wshirda/wshirda.h b/dll/win32/wshirda/wshirda.h index 127b8251d1b..0402cf7144a 100644 --- a/dll/win32/wshirda/wshirda.h +++ b/dll/win32/wshirda/wshirda.h @@ -10,7 +10,7 @@ #define WIN32_NO_STATUS #include #define NTOS_MODE_USER -#include +#include #include diff --git a/dll/win32/wsock32/CMakeLists.txt b/dll/win32/wsock32/CMakeLists.txt index 3018af1f173..f6d69c68174 100644 --- a/dll/win32/wsock32/CMakeLists.txt +++ b/dll/win32/wsock32/CMakeLists.txt @@ -2,7 +2,7 @@ set_unicode() spec2def(wsock32.dll wsock32.spec) -add_library(wsock32 SHARED stubs.c wsock32.rc wsock32.def ${CMAKE_CURRENT_BINARY_DIR}/wsock32.def) +add_library(wsock32 SHARED stubs.c wsock32.rc ${CMAKE_CURRENT_BINARY_DIR}/wsock32.def) set_module_type(wsock32 win32dll) diff --git a/dll/win32/wsock32/wsock32.def b/dll/win32/wsock32/wsock32.def deleted file mode 100644 index 6b87a572cdc..00000000000 --- a/dll/win32/wsock32/wsock32.def +++ /dev/null @@ -1,78 +0,0 @@ -LIBRARY wsock32.dll - -EXPORTS -accept=ws2_32.accept @1 -bind=ws2_32.bind @2 -closesocket=ws2_32.closesocket @3 -connect=ws2_32.connect @4 -getpeername=ws2_32.getpeername @5 -getsockname=ws2_32.getsockname @6 -getsockopt@20=ws2_32.getsockopt @7 -htonl=ws2_32.htonl @8 -htons=ws2_32.htons @9 -inet_addr=ws2_32.inet_addr @10 -inet_ntoa=ws2_32.inet_ntoa @11 -ioctlsocket=ws2_32.ioctlsocket @12 -listen=ws2_32.listen @13 -ntohl=ws2_32.ntohl @14 -ntohs=ws2_32.ntohs @15 -recv@16=ws2_32.recv @16 -recvfrom@24=ws2_32.recvfrom @17 -select=ws2_32.select @18 -send=ws2_32.send @19 -sendto=ws2_32.sendto @20 -setsockopt@20=ws2_32.setsockopt @21 -shutdown=ws2_32.shutdown @22 -socket=ws2_32.socket @23 -MigrateWinsockConfiguration=MSWSOCK.MigrateWinsockConfiguration @24 -gethostbyaddr=ws2_32.gethostbyaddr @51 -gethostbyname=ws2_32.gethostbyname @52 -getprotobyname=ws2_32.getprotobyname @53 -getprotobynumber=ws2_32.getprotobynumber @54 -getservbyname=ws2_32.getservbyname @55 -getservbyport=ws2_32.getservbyport @56 -gethostname=ws2_32.gethostname @57 -WSAAsyncSelect=ws2_32.WSAAsyncSelect @101 -WSAAsyncGetHostByAddr=ws2_32.WSAAsyncGetHostByAddr @102 -WSAAsyncGetHostByName=ws2_32.WSAAsyncGetHostByName @103 -WSAAsyncGetProtoByNumber=ws2_32.WSAAsyncGetProtoByNumber @104 -WSAAsyncGetProtoByName=ws2_32.WSAAsyncGetProtoByName @105 -WSAAsyncGetServByPort=ws2_32.WSAAsyncGetServByPort @106 -WSAAsyncGetServByName=ws2_32.WSAAsyncGetServByName @107 -WSACancelAsyncRequest=ws2_32.WSACancelAsyncRequest @108 -WSASetBlockingHook=ws2_32.WSASetBlockingHook @109 -WSAUnhookBlockingHook=ws2_32.WSAUnhookBlockingHook @110 -WSAGetLastError=ws2_32.WSAGetLastError @111 -WSASetLastError=ws2_32.WSASetLastError @112 -WSACancelBlockingCall=ws2_32.WSACancelBlockingCall @113 -WSAIsBlocking=ws2_32.WSAIsBlocking @114 -WSAStartup=ws2_32.WSAStartup @115 -WSACleanup=ws2_32.WSACleanup @116 -__WSAFDIsSet=ws2_32.__WSAFDIsSet @151 -WEP=ws2_32.WEP @500 -WSApSetPostRoutine=ws2_32.WSApSetPostRoutine @1000 -inet_network=MSWSOCK.inet_network @1100 -getnetbyname=MSWSOCK.getnetbyname @1101 -rcmd=MSWSOCK.rcmd @1102 -rexec=MSWSOCK.rexec @1103 -rresvport=MSWSOCK.rresvport @1104 -sethostname=MSWSOCK.sethostname @1105 -dn_expand=MSWSOCK.dn_expand @1106 -WSARecvEx=MSWSOCK.WSARecvEx @1107 -s_perror=MSWSOCK.s_perror @1108 -GetAddressByNameA=MSWSOCK.GetAddressByNameA @1109 -GetAddressByNameW=MSWSOCK.GetAddressByNameW @1110 -EnumProtocolsA=MSWSOCK.EnumProtocolsA @1111 -EnumProtocolsW=MSWSOCK.EnumProtocolsW @1112 -GetTypeByNameA=MSWSOCK.GetTypeByNameA @1113 -GetTypeByNameW=MSWSOCK.GetTypeByNameW @1114 -GetNameByTypeA=MSWSOCK.GetNameByTypeA @1115 -GetNameByTypeW=MSWSOCK.GetNameByTypeW @1116 -SetServiceA=MSWSOCK.SetServiceA @1117 -SetServiceW=MSWSOCK.SetServiceW @1118 -GetServiceA=MSWSOCK.GetServiceA @1119 -GetServiceW=MSWSOCK.GetServiceW @1120 -NPLoadNameSpaces=MSWSOCK.NPLoadNameSpaces @1130 -TransmitFile=MSWSOCK.TransmitFile @1140 -AcceptEx=MSWSOCK.AcceptEx @1141 -GetAcceptExSockaddrs=MSWSOCK.GetAcceptExSockaddrs @1142 diff --git a/dll/win32/wsock32/wsock32.rbuild b/dll/win32/wsock32/wsock32.rbuild index a0d74bc4fd6..5375b531ac9 100644 --- a/dll/win32/wsock32/wsock32.rbuild +++ b/dll/win32/wsock32/wsock32.rbuild @@ -1,5 +1,5 @@ - + . ntdll ws2_32 diff --git a/dll/win32/wsock32/wsock32.spec b/dll/win32/wsock32/wsock32.spec index 493d01ebd4d..4d8571a8faa 100644 --- a/dll/win32/wsock32/wsock32.spec +++ b/dll/win32/wsock32/wsock32.spec @@ -7,9 +7,9 @@ 7 stdcall getsockopt(long long long ptr ptr) ws2_32.getsockopt 8 stdcall htonl(long) ws2_32.htonl 9 stdcall htons(long) ws2_32.htons -10 stdcall ioctlsocket(long long ptr) ws2_32.ioctlsocket -11 stdcall inet_addr(str) ws2_32.inet_addr -12 stdcall inet_ntoa(ptr) ws2_32.inet_ntoa +10 stdcall inet_addr(str) ws2_32.inet_addr +11 stdcall inet_ntoa(ptr) ws2_32.inet_ntoa +12 stdcall ioctlsocket(long long ptr) ws2_32.ioctlsocket 13 stdcall listen(long long) ws2_32.listen 14 stdcall ntohl(long) ws2_32.ntohl 15 stdcall ntohs(long) ws2_32.ntohs diff --git a/drivers/base/bootvid/CMakeLists.txt b/drivers/base/bootvid/CMakeLists.txt index 3c23c82e2e0..ded06a8e48f 100644 --- a/drivers/base/bootvid/CMakeLists.txt +++ b/drivers/base/bootvid/CMakeLists.txt @@ -16,14 +16,14 @@ list(APPEND SOURCE arm/bootdata.c) endif(ARCH MATCHES i386 OR ARCH MATCHES amd64) -add_library(bootvid SHARED ${CMAKE_CURRENT_BINARY_DIR}/bootvid_precomp.h.gch ${SOURCE}) +add_library(bootvid SHARED ${SOURCE}) set_entrypoint(bootvid 0) set_subsystem(bootvid native) set_image_base(bootvid 0x00010000) add_importlibs(bootvid ntoskrnl hal) -add_pch(bootvid ${CMAKE_CURRENT_SOURCE_DIR}/precomp.h ${SOURCE}) +add_pch(bootvid precomp.h) add_dependencies(bootvid psdk bugcodes) add_cd_file(TARGET bootvid DESTINATION reactos/system32 NO_CAB FOR all) add_importlib_target(bootvid.spec) diff --git a/drivers/base/bootvid/i386/vga.c b/drivers/base/bootvid/i386/vga.c index 9e64d1789d9..3c6d4ad8857 100644 --- a/drivers/base/bootvid/i386/vga.c +++ b/drivers/base/bootvid/i386/vga.c @@ -66,7 +66,7 @@ ULONG lookup[16] = ULONG TextColor = 0xF; ULONG curr_x = 0; ULONG curr_y = 0; -BOOLEAN NextLine = FALSE; +BOOLEAN CarriageReturn = FALSE; ULONG_PTR VgaRegisterBase = 0; ULONG_PTR VgaBase = 0; @@ -280,14 +280,8 @@ VOID NTAPI VgaScroll(ULONG Scroll) { - ULONG Top; - ULONG SourceOffset, DestOffset; - ULONG Offset; - ULONG i, j; - - /* Set memory positions of the scroll */ - SourceOffset = VgaBase + (ScrollRegion[1] * 80) + (ScrollRegion[0] >> 3); - DestOffset = SourceOffset + (Scroll * 80); + ULONG Top, RowSize, i; + PUCHAR OldPosition, NewPosition; /* Clear the 4 planes */ __outpw(0x3C4, 0xF02); @@ -297,50 +291,20 @@ VgaScroll(ULONG Scroll) /* Set Mode 1 */ ReadWriteMode(1); - - /* Save top and check if it's above the bottom */ - Top = ScrollRegion[1]; - if (Top > ScrollRegion[3]) return; + + RowSize = (ScrollRegion[2] - ScrollRegion[0] + 1) / 8; /* Start loop */ - do + for(Top = ScrollRegion[1]; Top <= ScrollRegion[3]; ++Top) { - /* Set number of bytes to loop and start offset */ - Offset = ScrollRegion[0] >> 3; - j = SourceOffset; - - /* Check if this is part of the scroll region */ - if (Offset <= (ScrollRegion[2] >> 3)) - { - /* Update position */ - i = DestOffset - SourceOffset; - - /* Loop the X axis */ - do - { - /* Write value in the new position so that we can do the scroll */ - WRITE_REGISTER_UCHAR(UlongToPtr(j), - READ_REGISTER_UCHAR(UlongToPtr(j + i))); - - /* Move to the next memory location to write to */ - j++; - - /* Move to the next byte in the region */ - Offset++; - - /* Make sure we don't go past the scroll region */ - } while (Offset <= (ScrollRegion[2] >> 3)); - } - - /* Move to the next line */ - SourceOffset += 80; - DestOffset += 80; - - /* Increase top */ - Top++; - - /* Make sure we don't go past the scroll region */ - } while (Top <= ScrollRegion[3]); + /* Calculate the position in memory for the row */ + OldPosition = (PUCHAR)VgaBase + (Top + Scroll) * 80 + ScrollRegion[0] / 8; + NewPosition = (PUCHAR)VgaBase + Top * 80 + ScrollRegion[0] / 8; + + /* Scroll the row */ + for(i = 0; i < RowSize; ++i) + WRITE_REGISTER_UCHAR(NewPosition + i, READ_REGISTER_UCHAR(OldPosition + i)); + } } VOID @@ -749,38 +713,40 @@ VidDisplayString(PUCHAR String) { /* Modify Y position */ curr_y += TopDelta; - if (curr_y >= ScrollRegion[3]) + if (curr_y + TopDelta >= ScrollRegion[3]) { /* Scroll the view */ VgaScroll(TopDelta); curr_y -= TopDelta; - + } + else + { /* Preserve row */ - PreserveRow(curr_y, TopDelta, TRUE); + PreserveRow(curr_y, TopDelta, FALSE); } /* Update current X */ curr_x = ScrollRegion[0]; - /* Preseve the current row */ - PreserveRow(curr_y, TopDelta, FALSE); + /* Do not clear line if "\r\n" is given */ + CarriageReturn = FALSE; } else if (*String == '\r') { /* Update current X */ curr_x = ScrollRegion[0]; - + /* Check if we're being followed by a new line */ - if (String[1] != '\n') NextLine = TRUE; + CarriageReturn = TRUE; } else { - /* Check if we had a \n\r last time */ - if (NextLine) + /* check if we had a '\r' last time */ + if (CarriageReturn) { - /* We did, preserve the current row */ + /* We did, clear the current row */ PreserveRow(curr_y, TopDelta, TRUE); - NextLine = FALSE; + CarriageReturn = FALSE; } /* Display this character */ @@ -788,18 +754,20 @@ VidDisplayString(PUCHAR String) curr_x += 8; /* Check if we should scroll */ - if (curr_x > ScrollRegion[2]) + if (curr_x + 8 > ScrollRegion[2]) { /* Update Y position and check if we should scroll it */ curr_y += TopDelta; - if (curr_y > ScrollRegion[3]) + if (curr_y + TopDelta > ScrollRegion[3]) { /* Do the scroll */ VgaScroll(TopDelta); curr_y -= TopDelta; - - /* Save the row */ - PreserveRow(curr_y, TopDelta, TRUE); + } + else + { + /* Preserve the current row */ + PreserveRow(curr_y, TopDelta, FALSE); } /* Update X */ diff --git a/drivers/base/kddll/CMakeLists.txt b/drivers/base/kddll/CMakeLists.txt index f46512ce02e..8083793ca03 100644 --- a/drivers/base/kddll/CMakeLists.txt +++ b/drivers/base/kddll/CMakeLists.txt @@ -10,8 +10,7 @@ add_library(kdcom SHARED set_entrypoint(kdcom 0) set_subsystem(kdcom native) set_image_base(kdcom 0x00010000) - add_importlibs(kdcom ntoskrnl hal) - add_dependencies(kdcom psdk bugcodes) add_importlib_target(kdcom.spec) +add_cd_file(TARGET kdcom DESTINATION reactos/system32 NO_CAB FOR all) diff --git a/drivers/base/kddll/kdcom.c b/drivers/base/kddll/kdcom.c index 343bce88004..1903e39d901 100644 --- a/drivers/base/kddll/kdcom.c +++ b/drivers/base/kddll/kdcom.c @@ -9,9 +9,6 @@ #include "kddll.h" #include "kdcom.h" -/* Define wait timeout value. */ -#define REPEAT_COUNT (1000 * 1000) - /* serial debug connection */ #define DEFAULT_DEBUG_PORT 2 /* COM2 */ #define DEFAULT_DEBUG_COM1_IRQ 4 /* COM1 IRQ */ @@ -126,6 +123,10 @@ KdDebuggerInitialize0( /* Check if e have a LoaderBlock */ if (LoaderBlock) { + /* HACK */ + KdpDbgPrint = LoaderBlock->u.I386.CommonDataArea; + KDDBGPRINT("KdDebuggerInitialize0\n"); + /* Get the Command Line */ CommandLine = LoaderBlock->LoadOptions; @@ -248,7 +249,7 @@ KDP_STATUS NTAPI KdpReceiveByte(OUT PBYTE OutByte) { - ULONG Repeats = REPEAT_COUNT; + ULONG Repeats = KdpStallScaleFactor * 100; while (Repeats--) { diff --git a/drivers/base/kddll/kddll.c b/drivers/base/kddll/kddll.c index 43aca1d534a..027306daf85 100644 --- a/drivers/base/kddll/kddll.c +++ b/drivers/base/kddll/kddll.c @@ -6,7 +6,6 @@ * PROGRAMMER: Timo Kreuzer (timo.kreuzer@ewactos.org) */ -//#define KDDEBUG /* uncomment to enable debugging this dll */ #include "kddll.h" /* GLOBALS ********************************************************************/ @@ -14,6 +13,8 @@ PFNDBGPRNT KdpDbgPrint = NULL; ULONG CurrentPacketId = INITIAL_PACKET_ID | SYNC_PACKET_ID; ULONG RemotePacketId = 0; +BOOLEAN KdpPhase1Complete = FALSE; +ULONG KdpStallScaleFactor = 10000; /* PRIVATE FUNCTIONS **********************************************************/ @@ -88,11 +89,10 @@ NTAPI KdDebuggerInitialize1( IN PLOADER_PARAMETER_BLOCK LoaderBlock OPTIONAL) { - // HACK: misuse this function to get a pointer to FrLdrDbgPrint - KdpDbgPrint = (PVOID)LoaderBlock; - KDDBGPRINT("KdDebuggerInitialize1\n"); + KdpStallScaleFactor = KeGetPcr()->StallScaleFactor * 100; + KdpPhase1Complete = TRUE; - return STATUS_NOT_IMPLEMENTED; + return STATUS_SUCCESS; } @@ -198,7 +198,7 @@ KdReceivePacket( switch (Packet.PacketType) { case PACKET_TYPE_KD_ACKNOWLEDGE: - /* Are we waiting for an ACK packet? */ + /* Are we waiting for an ACK packet? */ if (PacketType == PACKET_TYPE_KD_ACKNOWLEDGE && Packet.PacketId == (CurrentPacketId & ~SYNC_PACKET_ID)) { @@ -276,7 +276,7 @@ KdReceivePacket( if (MessageData) { /* Set the length of the message data */ - MessageData->Length = *DataLength; + MessageData->Length = (USHORT)*DataLength; /* Do we have data? */ if (MessageData->Length) @@ -359,7 +359,7 @@ KdSendPacket( /* Initialize a KD_PACKET */ Packet.PacketLeader = PACKET_LEADER; - Packet.PacketType = PacketType; + Packet.PacketType = (USHORT)PacketType; Packet.ByteCount = MessageHeader->Length; Packet.Checksum = KdpCalculateChecksum(MessageHeader->Buffer, MessageHeader->Length); diff --git a/drivers/base/kddll/kddll.h b/drivers/base/kddll/kddll.h index 50964141b8f..036f8b045ef 100644 --- a/drivers/base/kddll/kddll.h +++ b/drivers/base/kddll/kddll.h @@ -8,6 +8,8 @@ #pragma once +//#define KDDEBUG /* uncomment to enable debugging this dll */ + #define NOEXTAPI #include #define NDEBUG @@ -25,6 +27,8 @@ typedef UCHAR BYTE, *PBYTE; typedef ULONG (*PFNDBGPRNT)(const char *Format, ...); extern PFNDBGPRNT KdpDbgPrint; +extern BOOLEAN KdpPhase1Complete; +extern ULONG KdpStallScaleFactor; typedef enum { diff --git a/drivers/base/nmidebug/nmidebug.c b/drivers/base/nmidebug/nmidebug.c index 9b147850869..6a34792665a 100644 --- a/drivers/base/nmidebug/nmidebug.c +++ b/drivers/base/nmidebug/nmidebug.c @@ -9,7 +9,7 @@ /* INCLUDES *******************************************************************/ #include -#include +#include /* FUNCTIONS ******************************************************************/ diff --git a/drivers/battery/battc/CMakeLists.txt b/drivers/battery/battc/CMakeLists.txt index 2cfea3ab8b0..79accddba83 100644 --- a/drivers/battery/battc/CMakeLists.txt +++ b/drivers/battery/battc/CMakeLists.txt @@ -1,7 +1,7 @@ add_definitions(-D_BATTERYCLASS_) -spec2def(batc.sys battc.spec) +spec2def(battc.sys battc.spec) add_library(battc SHARED battc.c diff --git a/drivers/bus/acpi/CMakeLists.txt b/drivers/bus/acpi/CMakeLists.txt index 1793c66bf8c..05ac856d11e 100644 --- a/drivers/bus/acpi/CMakeLists.txt +++ b/drivers/bus/acpi/CMakeLists.txt @@ -121,7 +121,6 @@ add_library(acpica acpica/utilities/uttrack.c acpica/utilities/utxface.c) -set_target_properties(acpica PROPERTIES COMPILE_DEFINITIONS "ACPI_USE_LOCAL_CACHE") add_dependencies(acpica bugcodes) add_library(acpi SHARED diff --git a/drivers/bus/acpi/acpica/acpica.rbuild b/drivers/bus/acpi/acpica/acpica.rbuild index ce6fee8791f..719e125c76e 100644 --- a/drivers/bus/acpi/acpica/acpica.rbuild +++ b/drivers/bus/acpi/acpica/acpica.rbuild @@ -1,7 +1,6 @@ - include dsfield.c diff --git a/drivers/bus/acpi/busmgr/bus.c b/drivers/bus/acpi/busmgr/bus.c index e7901d21132..d9b3241a0c0 100644 --- a/drivers/bus/acpi/busmgr/bus.c +++ b/drivers/bus/acpi/busmgr/bus.c @@ -401,9 +401,9 @@ acpi_bus_get_power_flags ( char object_name[5] = {'_','P','R','0'+i,'\0'}; /* Evaluate "_PRx" to se if power resources are referenced */ - acpi_evaluate_reference(device->handle, object_name, NULL, + status = acpi_evaluate_reference(device->handle, object_name, NULL, &ps->resources); - if (ps->resources.count) { + if (ACPI_SUCCESS(status) && ps->resources.count) { device->power.flags.power_resources = 1; ps->flags.valid = 1; } diff --git a/drivers/bus/acpi/busmgr/button.c b/drivers/bus/acpi/busmgr/button.c index 9344a5f1f7d..73f4a615c99 100644 --- a/drivers/bus/acpi/busmgr/button.c +++ b/drivers/bus/acpi/busmgr/button.c @@ -42,13 +42,13 @@ static int acpi_button_add (struct acpi_device *device); static int acpi_button_remove (struct acpi_device *device, int type); static struct acpi_driver acpi_button_driver = { - .name = ACPI_BUTTON_DRIVER_NAME, - .class = ACPI_BUTTON_CLASS, - .ids = "ACPI_FPB,ACPI_FSB,PNP0C0D,PNP0C0C,PNP0C0E", - .ops = { - .add = acpi_button_add, - .remove = acpi_button_remove, - }, + {0,0}, + ACPI_BUTTON_DRIVER_NAME, + ACPI_BUTTON_CLASS, + 0, + 0, + "ACPI_FPB,ACPI_FSB,PNP0C0D,PNP0C0C,PNP0C0E", + {acpi_button_add,acpi_button_remove} }; struct acpi_button { diff --git a/drivers/bus/acpi/busmgr/power.c b/drivers/bus/acpi/busmgr/power.c index c10e98112ed..4027ef829cc 100644 --- a/drivers/bus/acpi/busmgr/power.c +++ b/drivers/bus/acpi/busmgr/power.c @@ -64,14 +64,13 @@ static int acpi_power_remove (struct acpi_device *device, int type); static int acpi_power_resume(struct acpi_device *device, int state); static struct acpi_driver acpi_power_driver = { - .name = ACPI_POWER_DRIVER_NAME, - .class = ACPI_POWER_CLASS, - .ids = ACPI_POWER_HID, - .ops = { - .add = acpi_power_add, - .remove = acpi_power_remove, - .resume = acpi_power_resume, - }, + {0,0}, + ACPI_POWER_DRIVER_NAME, + ACPI_POWER_CLASS, + 0, + 0, + ACPI_POWER_HID, + {acpi_power_add, acpi_power_remove, NULL, NULL, acpi_power_resume} }; struct acpi_power_reference { diff --git a/drivers/bus/acpi/busmgr/system.c b/drivers/bus/acpi/busmgr/system.c index ca5a0852bf9..79d8af4c263 100644 --- a/drivers/bus/acpi/busmgr/system.c +++ b/drivers/bus/acpi/busmgr/system.c @@ -48,13 +48,13 @@ static int acpi_system_remove (struct acpi_device *device, int type); ACPI_STATUS acpi_suspend (UINT32 state); static struct acpi_driver acpi_system_driver = { - .name = ACPI_SYSTEM_DRIVER_NAME, - .class = ACPI_SYSTEM_CLASS, - .ids = ACPI_SYSTEM_HID, - .ops = { - .add = acpi_system_add, - .remove = acpi_system_remove - }, + {0,0}, + ACPI_SYSTEM_DRIVER_NAME, + ACPI_SYSTEM_CLASS, + 0, + 0, + ACPI_SYSTEM_HID, + {acpi_system_add, acpi_system_remove} }; struct acpi_system diff --git a/drivers/bus/acpi/busmgr/utils.c b/drivers/bus/acpi/busmgr/utils.c index a60447429d0..3692e56963e 100644 --- a/drivers/bus/acpi/busmgr/utils.c +++ b/drivers/bus/acpi/busmgr/utils.c @@ -368,7 +368,8 @@ end: //ExFreePool(list->handles); } - AcpiOsFree(buffer.Pointer); + if (buffer.Pointer) + AcpiOsFree(buffer.Pointer); return_ACPI_STATUS(status); } diff --git a/drivers/bus/acpi/buspdo.c b/drivers/bus/acpi/buspdo.c index 7d167b7742c..a353c764311 100644 --- a/drivers/bus/acpi/buspdo.c +++ b/drivers/bus/acpi/buspdo.c @@ -66,40 +66,42 @@ Bus_PDO_PnP ( } DeviceData->InterfaceName.Length = 0; + status = STATUS_SUCCESS; if (!device) { - IoRegisterDeviceInterface(DeviceData->Common.Self, - &GUID_DEVICE_SYS_BUTTON, - NULL, - &DeviceData->InterfaceName); + status = IoRegisterDeviceInterface(DeviceData->Common.Self, + &GUID_DEVICE_SYS_BUTTON, + NULL, + &DeviceData->InterfaceName); } else if (device->flags.hardware_id && strstr(device->pnp.hardware_id, ACPI_THERMAL_HID)) { - IoRegisterDeviceInterface(DeviceData->Common.Self, - &GUID_DEVICE_THERMAL_ZONE, - NULL, - &DeviceData->InterfaceName); + status = IoRegisterDeviceInterface(DeviceData->Common.Self, + &GUID_DEVICE_THERMAL_ZONE, + NULL, + &DeviceData->InterfaceName); } else if (device->flags.hardware_id && strstr(device->pnp.hardware_id, ACPI_BUTTON_HID_LID)) { - IoRegisterDeviceInterface(DeviceData->Common.Self, - &GUID_DEVICE_LID, - NULL, - &DeviceData->InterfaceName); + status = IoRegisterDeviceInterface(DeviceData->Common.Self, + &GUID_DEVICE_LID, + NULL, + &DeviceData->InterfaceName); } else if (device->flags.hardware_id && strstr(device->pnp.hardware_id, ACPI_PROCESSOR_HID)) { - IoRegisterDeviceInterface(DeviceData->Common.Self, - &GUID_DEVICE_PROCESSOR, - NULL, - &DeviceData->InterfaceName); + status = IoRegisterDeviceInterface(DeviceData->Common.Self, + &GUID_DEVICE_PROCESSOR, + NULL, + &DeviceData->InterfaceName); } - if (DeviceData->InterfaceName.Length != 0) + /* Failure to register an interface is not a fatal failure so don't return a failure status */ + if (NT_SUCCESS(status) && DeviceData->InterfaceName.Length != 0) IoSetDeviceInterfaceState(&DeviceData->InterfaceName, TRUE); state.DeviceState = PowerDeviceD0; diff --git a/drivers/bus/acpi/cmbatt/CMakeLists.txt b/drivers/bus/acpi/cmbatt/CMakeLists.txt index 461adfeba51..afef8697887 100644 --- a/drivers/bus/acpi/cmbatt/CMakeLists.txt +++ b/drivers/bus/acpi/cmbatt/CMakeLists.txt @@ -6,12 +6,12 @@ list(APPEND SOURCE cmbwmi.c cmbatt.rc) -add_library(cmbatt SHARED ${CMAKE_CURRENT_BINARY_DIR}/cmbatt_cmbatt.h.gch ${SOURCE}) +add_library(cmbatt SHARED ${SOURCE}) set_module_type(cmbatt kernelmodedriver) add_importlibs(cmbatt ntoskrnl hal battc wmilib) -add_pch(cmbatt ${CMAKE_CURRENT_SOURCE_DIR}/cmbatt.h ${SOURCE}) +add_pch(cmbatt cmbatt.h) add_cd_file(TARGET cmbatt DESTINATION reactos/system32/drivers FOR all) \ No newline at end of file diff --git a/drivers/bus/acpi/compbatt/CMakeLists.txt b/drivers/bus/acpi/compbatt/CMakeLists.txt index 00f05b73271..a1a3b7bc7b1 100644 --- a/drivers/bus/acpi/compbatt/CMakeLists.txt +++ b/drivers/bus/acpi/compbatt/CMakeLists.txt @@ -5,11 +5,11 @@ list(APPEND SOURCE comppnp.c compbatt.rc) -add_library(compbatt SHARED ${CMAKE_CURRENT_BINARY_DIR}/compbatt_compbatt.h.gch ${SOURCE}) +add_library(compbatt SHARED ${SOURCE}) set_module_type(compbatt kernelmodedriver) add_importlibs(compbatt ntoskrnl hal battc) -add_pch(compbatt ${CMAKE_CURRENT_SOURCE_DIR}/compbatt.h ${SOURCE}) +add_pch(compbatt compbatt.h) add_cd_file(TARGET compbatt DESTINATION reactos/system32/drivers FOR all) \ No newline at end of file diff --git a/drivers/bus/acpi/main.c b/drivers/bus/acpi/main.c index 175ad53d728..7f2ae262e1b 100644 --- a/drivers/bus/acpi/main.c +++ b/drivers/bus/acpi/main.c @@ -12,6 +12,13 @@ #define NDEBUG #include +NTSTATUS +NTAPI +DriverEntry ( + PDRIVER_OBJECT DriverObject, + PUNICODE_STRING RegistryPath + ); + #ifdef ALLOC_PRAGMA #pragma alloc_text (INIT, DriverEntry) #pragma alloc_text (PAGE, Bus_AddDevice) diff --git a/drivers/bus/acpi/osl.c b/drivers/bus/acpi/osl.c index 4eeb71f8f51..a4c47ceb8dc 100644 --- a/drivers/bus/acpi/osl.c +++ b/drivers/bus/acpi/osl.c @@ -149,19 +149,6 @@ AcpiOsFree(void *ptr) #ifndef ACPI_USE_LOCAL_CACHE -void* -AcpiOsAcquireObjectHelper ( - POOL_TYPE PoolType, - SIZE_T NumberOfBytes, - ULONG Tag) -{ - void* Alloc = ExAllocatePool(PoolType, NumberOfBytes); - - /* acpica expects memory allocated from cache to be zeroed */ - RtlZeroMemory(Alloc,NumberOfBytes); - return Alloc; -} - ACPI_STATUS AcpiOsCreateCache ( char *CacheName, @@ -173,7 +160,7 @@ AcpiOsCreateCache ( ExAllocatePool(NonPagedPool,sizeof(NPAGED_LOOKASIDE_LIST)); ExInitializeNPagedLookasideList(Lookaside, - (PALLOCATE_FUNCTION)AcpiOsAcquireObjectHelper,// custom memory allocator + NULL, NULL, 0, ObjectSize, @@ -283,7 +270,7 @@ AcpiOsInstallInterruptHandler ( Internal, 0, InterruptNumber, - 0, + InterruptNumber, &DIrql, &Affinity); diff --git a/drivers/bus/acpi/pnp.c b/drivers/bus/acpi/pnp.c index 9259fb9d2a5..95ed06b44ad 100644 --- a/drivers/bus/acpi/pnp.c +++ b/drivers/bus/acpi/pnp.c @@ -10,11 +10,16 @@ #define NDEBUG #include +NTSTATUS +Bus_PlugInDevice ( + struct acpi_device *Device, + PFDO_DEVICE_DATA FdoData + ); + #ifdef ALLOC_PRAGMA #pragma alloc_text (PAGE, Bus_PnP) #pragma alloc_text (PAGE, Bus_PlugInDevice) #pragma alloc_text (PAGE, Bus_InitializePdo) -#pragma alloc_text (PAGE, Bus_UnPlugDevice) #pragma alloc_text (PAGE, Bus_DestroyPdo) #pragma alloc_text (PAGE, Bus_FDO_PnP) #pragma alloc_text (PAGE, Bus_StartFdo) @@ -188,7 +193,7 @@ Bus_FDO_PnP ( // length = sizeof(DEVICE_RELATIONS) + - ((numPdosPresent + prevcount) * sizeof (PDEVICE_OBJECT)) -1; + (((numPdosPresent + prevcount) - 1) * sizeof (PDEVICE_OBJECT)); relations = (PDEVICE_RELATIONS) ExAllocatePoolWithTag (PagedPool, length, 'IPCA'); diff --git a/drivers/bus/acpi/power.c b/drivers/bus/acpi/power.c index 2f7175c74ad..cb58d4ff0dd 100644 --- a/drivers/bus/acpi/power.c +++ b/drivers/bus/acpi/power.c @@ -224,7 +224,7 @@ Bus_PDO_Power ( return status; } -#ifndef NDEBUG +#if !defined(NDEBUG) || defined(_MSC_VER) PCHAR PowerMinorFunctionString ( diff --git a/drivers/bus/isapnp/CMakeLists.txt b/drivers/bus/isapnp/CMakeLists.txt index efb1f93256e..ea6eea4223b 100644 --- a/drivers/bus/isapnp/CMakeLists.txt +++ b/drivers/bus/isapnp/CMakeLists.txt @@ -8,5 +8,5 @@ add_library(isapnp SHARED set_module_type(isapnp kernelmodedriver) add_importlibs(isapnp ntoskrnl hal) - +add_pch(isapnp isapnp.h) add_cd_file(TARGET isapnp DESTINATION reactos/system32/drivers NO_CAB FOR all) diff --git a/drivers/bus/isapnp/isapnp.h b/drivers/bus/isapnp/isapnp.h index 85fcb7887f4..75ee3ecdd9d 100644 --- a/drivers/bus/isapnp/isapnp.h +++ b/drivers/bus/isapnp/isapnp.h @@ -1,4 +1,3 @@ -#pragma once #include diff --git a/drivers/bus/pci/CMakeLists.txt b/drivers/bus/pci/CMakeLists.txt index d9c7bbb1e22..5917718dec2 100644 --- a/drivers/bus/pci/CMakeLists.txt +++ b/drivers/bus/pci/CMakeLists.txt @@ -7,5 +7,5 @@ add_library(pci SHARED set_module_type(pci kernelmodedriver) add_importlibs(pci ntoskrnl hal) - +add_pch(pci pci.h) add_cd_file(TARGET pci DESTINATION reactos/system32/drivers NO_CAB FOR all) diff --git a/drivers/bus/pci/fdo.c b/drivers/bus/pci/fdo.c index 8a81d7b66cf..5f9ed35f182 100644 --- a/drivers/bus/pci/fdo.c +++ b/drivers/bus/pci/fdo.c @@ -547,10 +547,6 @@ FdoPnpControl( case IRP_MN_QUERY_REMOVE_DEVICE: Status = STATUS_NOT_IMPLEMENTED; break; - - case IRP_MN_QUERY_STOP_DEVICE: - Status = STATUS_NOT_IMPLEMENTED; - break; #endif case IRP_MN_START_DEVICE: DPRINT("IRP_MN_START_DEVICE received\n"); @@ -561,12 +557,17 @@ FdoPnpControl( Irp->IoStatus.Status = Status; IoCompleteRequest(Irp, IO_NO_INCREMENT); return Status; - case IRP_MN_STOP_DEVICE: - /* Currently not supported */ + + case IRP_MN_QUERY_STOP_DEVICE: + /* We don't support stopping yet */ Status = STATUS_UNSUCCESSFUL; Irp->IoStatus.Status = Status; IoCompleteRequest(Irp, IO_NO_INCREMENT); return Status; + + case IRP_MN_STOP_DEVICE: + /* We can't fail this one so we fail the QUERY_STOP request that precedes it */ + break; #if 0 case IRP_MN_SURPRISE_REMOVAL: Status = STATUS_NOT_IMPLEMENTED; diff --git a/drivers/bus/pci/pci.h b/drivers/bus/pci/pci.h index 2c4043396aa..f4001514391 100644 --- a/drivers/bus/pci/pci.h +++ b/drivers/bus/pci/pci.h @@ -1,5 +1,3 @@ -#pragma once - #include #include #include diff --git a/drivers/bus/pci/pdo.c b/drivers/bus/pci/pdo.c index e5961fbf3a2..23b9a96b635 100644 --- a/drivers/bus/pci/pdo.c +++ b/drivers/bus/pci/pdo.c @@ -669,6 +669,7 @@ PdoQueryResources( } if ((PciConfig.u.type0.InterruptPin != 0) && + (PciConfig.u.type0.InterruptLine != 0) && (PciConfig.u.type0.InterruptLine != 0xFF)) ResCount++; } @@ -769,6 +770,7 @@ PdoQueryResources( /* Add interrupt resource */ if ((PciConfig.u.type0.InterruptPin != 0) && + (PciConfig.u.type0.InterruptLine != 0) && (PciConfig.u.type0.InterruptLine != 0xFF)) { Descriptor->Type = CmResourceTypeInterrupt; diff --git a/drivers/bus/pcix/CMakeLists.txt b/drivers/bus/pcix/CMakeLists.txt index a805c580883..af110680f0f 100644 --- a/drivers/bus/pcix/CMakeLists.txt +++ b/drivers/bus/pcix/CMakeLists.txt @@ -36,12 +36,12 @@ list(APPEND SOURCE utils.c pci.rc) -add_library(pcix SHARED ${CMAKE_CURRENT_BINARY_DIR}/pcix_pci.h.gch ${SOURCE}) +add_library(pcix SHARED ${SOURCE}) set_module_type(pcix kernelmodedriver) add_importlibs(pcix ntoskrnl hal) -add_pch(pcix ${CMAKE_CURRENT_SOURCE_DIR}/pci.h ${SOURCE}) +add_pch(pcix pci.h) add_dependencies(pcix pciclass) add_cd_file(TARGET pcix DESTINATION reactos/system32/drivers NO_CAB FOR all) diff --git a/drivers/bus/pcix/device.c b/drivers/bus/pcix/device.c index c26fd92b7fe..360f5ceec5a 100644 --- a/drivers/bus/pcix/device.c +++ b/drivers/bus/pcix/device.c @@ -204,7 +204,7 @@ Device_SaveLimits(IN PPCI_CONFIGURATOR_CONTEXT Context) /* This function returns TRUE if the BAR was 64-bit, handle this */ ASSERT((i + 1) < PCI_TYPE0_ADDRESSES); i++; - (&Limit[i])->Type == CmResourceTypeNull; + Limit[i].Type = CmResourceTypeNull; } } diff --git a/drivers/bus/pcix/pci/busno.c b/drivers/bus/pcix/pci/busno.c index 6b6316493f3..caf7632cd79 100644 --- a/drivers/bus/pcix/pci/busno.c +++ b/drivers/bus/pcix/pci/busno.c @@ -20,9 +20,10 @@ BOOLEAN NTAPI PciAreBusNumbersConfigured(IN PPCI_PDO_EXTENSION PdoExtension) { - PAGED_CODE(); UCHAR PrimaryBus, BaseBus, SecondaryBus, SubordinateBus; + PAGED_CODE(); + /* Get all relevant bus number details */ PrimaryBus = PdoExtension->Dependent.type1.PrimaryBus; BaseBus = PdoExtension->ParentFdoExtension->BaseBus; diff --git a/drivers/bus/pcix/pci/ppbridge.c b/drivers/bus/pcix/pci/ppbridge.c index b7a9356bf25..d1a0eab1966 100644 --- a/drivers/bus/pcix/pci/ppbridge.c +++ b/drivers/bus/pcix/pci/ppbridge.c @@ -491,7 +491,7 @@ PPBridge_SaveLimits(IN PPCI_CONFIGURATOR_CONTEXT Context) /* Skip the next descriptor since this one is double sized */ i++; - (&Limit[i])->Type == CmResourceTypeNull; + Limit[i].Type = CmResourceTypeNull; } } diff --git a/drivers/bus/pcmcia/CMakeLists.txt b/drivers/bus/pcmcia/CMakeLists.txt index 9c4b1a34aac..65ca6785e95 100644 --- a/drivers/bus/pcmcia/CMakeLists.txt +++ b/drivers/bus/pcmcia/CMakeLists.txt @@ -6,6 +6,6 @@ add_library(pcmcia SHARED pcmcia.rc) set_module_type(pcmcia kernelmodedriver) +add_pch(pcmcia pcmcia.h) add_importlibs(pcmcia ntoskrnl hal) - add_cd_file(TARGET pcmcia DESTINATION reactos/system32/drivers NO_CAB FOR all) diff --git a/drivers/directx/dxapi/dxapi_driver.h b/drivers/directx/dxapi/dxapi_driver.h index 996353c7f2d..09a2ba7958a 100644 --- a/drivers/directx/dxapi/dxapi_driver.h +++ b/drivers/directx/dxapi/dxapi_driver.h @@ -1,20 +1,10 @@ +#include -/* DDK/NDK/SDK Headers */ -#include -#include -#include -#include -#include - -#include #include #include #include #define NT_BUILD_ENVIRONMENT #include -#include -#include - #include @@ -123,7 +113,6 @@ DWORD tblCheckOutBuffer [] = sizeof(DWORD) }; - /* Internal driver function */ DRVFN gDxApiEntryPoint [] = { @@ -150,6 +139,3 @@ DRVFN gDxApiEntryPoint [] = {DD_DXAPI_ADDVPCAPTUREBUFFER - DD_FIRST_DXAPI, (PFN) DxAddVpCaptureBuffer}, {DD_DXAPI_FLUSHVPCAPTUREBUFFERS - DD_FIRST_DXAPI, (PFN) DxFlushVpCaptureBuffs} }; - - - diff --git a/drivers/directx/dxg/CMakeLists.txt b/drivers/directx/dxg/CMakeLists.txt index f4eb99c8e77..320055b4fff 100644 --- a/drivers/directx/dxg/CMakeLists.txt +++ b/drivers/directx/dxg/CMakeLists.txt @@ -11,5 +11,5 @@ add_library(dxg SHARED set_module_type(dxg kernelmodedriver) add_importlibs(dxg dxgthk ntoskrnl) - -add_cd_file(TARGET dxg DESTINATION reactos/system32/drivers FOR all) \ No newline at end of file +add_pch(dxg dxg_int.h) +add_cd_file(TARGET dxg DESTINATION reactos/system32/drivers FOR all) diff --git a/drivers/directx/dxg/dxg_driver.h b/drivers/directx/dxg/dxg_driver.h index fa9b447e8b2..dcbaceb2443 100644 --- a/drivers/directx/dxg/dxg_driver.h +++ b/drivers/directx/dxg/dxg_driver.h @@ -1,5 +1,4 @@ - DRVFN gaDxgFuncs [] = { {DXG_INDEX_DxDxgGenericThunk, (PFN)DxDxgGenericThunk}, diff --git a/drivers/directx/dxg/dxg_int.h b/drivers/directx/dxg/dxg_int.h index ccb2204a781..d6509411b82 100644 --- a/drivers/directx/dxg/dxg_int.h +++ b/drivers/directx/dxg/dxg_int.h @@ -1,9 +1,4 @@ -/* DDK/NDK/SDK Headers */ -#include -#include #include -#include -#include /* Win32 Headers */ #define WINBASEAPI @@ -12,13 +7,10 @@ #define INTERNAL_CALL NTAPI #define NT_BUILD_ENVIRONMENT -#include #include #include #include #include -#include -#include /* DXG treats this as opaque */ typedef PVOID PDC; @@ -109,4 +101,3 @@ PVOID FASTCALL DdHmgLock(HANDLE DdHandle, UCHAR ObjectType, BOOLEAN LockOwned); #define drvDxEngUnlockDC gpEngFuncs[DXENG_INDEX_DxEngUnlockDC] #define drvDxEngUnlockHdev gpEngFuncs[DXENG_INDEX_DxEngUnlockHdev] #define drvDxEngLockHdev gpEngFuncs[DXENG_INDEX_DxEngLockHdev] - diff --git a/drivers/directx/dxg/eng.c b/drivers/directx/dxg/eng.c index 02e04e31471..6f5d36dad70 100644 --- a/drivers/directx/dxg/eng.c +++ b/drivers/directx/dxg/eng.c @@ -8,10 +8,8 @@ * 30/12-2007 Magnus Olsen */ - #include - PDD_SURFACE_LOCAL NTAPI DxDdLockDirectDrawSurface(HANDLE hDdSurface) @@ -44,11 +42,3 @@ DxDdUnlockDirectDrawSurface(PDD_SURFACE_LOCAL pSurface) return retVal; } - - - - - - - - diff --git a/drivers/directx/dxg/main.c b/drivers/directx/dxg/main.c index f014b37e65e..bdd0335bab2 100644 --- a/drivers/directx/dxg/main.c +++ b/drivers/directx/dxg/main.c @@ -8,7 +8,6 @@ * 15/10-2007 Magnus Olsen */ - #include #include "dxg_driver.h" @@ -18,12 +17,10 @@ VOID *gpDummyPage = NULL; PEPROCESS gpepSession = NULL; PLARGE_INTEGER gpLockShortDelay = NULL; - PDRVFN gpEngFuncs; const ULONG gcDxgFuncs = DXG_INDEX_DxDdIoctl + 1; - NTSTATUS NTAPI DriverEntry(IN PVOID Context1, IN PVOID Context2) @@ -112,9 +109,6 @@ DxDdStartupDxGraphics (ULONG SizeEngDrv, return STATUS_NO_MEMORY; } - - - NTSTATUS APIENTRY DxDdCleanupDxGraphics(VOID) @@ -135,4 +129,3 @@ DxDdCleanupDxGraphics(VOID) return 0; } - diff --git a/drivers/directx/dxg/tags.h b/drivers/directx/dxg/tags.h index 80afec11432..cf721f65165 100644 --- a/drivers/directx/dxg/tags.h +++ b/drivers/directx/dxg/tags.h @@ -1,8 +1,2 @@ - - - #define TAG_THDD 'ddht' #define TAG_GINI 'iniG' - - - diff --git a/drivers/drivers.rbuild b/drivers/drivers.rbuild index 7e6a925055f..4e3c60fa548 100644 --- a/drivers/drivers.rbuild +++ b/drivers/drivers.rbuild @@ -34,6 +34,9 @@ + + + diff --git a/drivers/filesystems/cdfs/CMakeLists.txt b/drivers/filesystems/cdfs/CMakeLists.txt index cc0fbc1b2f5..6aad25408bc 100644 --- a/drivers/filesystems/cdfs/CMakeLists.txt +++ b/drivers/filesystems/cdfs/CMakeLists.txt @@ -17,11 +17,11 @@ list(APPEND SOURCE volinfo.c cdfs.rc) -add_library(cdfs SHARED ${CMAKE_CURRENT_BINARY_DIR}/cdfs_cdfs.h.gch ${SOURCE}) +add_library(cdfs SHARED ${SOURCE}) set_module_type(cdfs kernelmodedriver) add_importlibs(cdfs ntoskrnl hal) -add_pch(cdfs ${CMAKE_CURRENT_SOURCE_DIR}/cdfs.h ${SOURCE}) +add_pch(cdfs cdfs.h) add_cd_file(TARGET cdfs DESTINATION reactos/system32/drivers NO_CAB FOR all) diff --git a/drivers/filesystems/cdfs/cdfs.h b/drivers/filesystems/cdfs/cdfs.h index 905a34e0c75..47d7d313041 100644 --- a/drivers/filesystems/cdfs/cdfs.h +++ b/drivers/filesystems/cdfs/cdfs.h @@ -143,7 +143,7 @@ typedef struct _CDINFO ULONG RootStart; ULONG RootSize; WCHAR VolumeLabel[MAXIMUM_VOLUME_LABEL_LENGTH / sizeof(WCHAR)]; - ULONG VolumeLabelLength; + USHORT VolumeLabelLength; ULONG SerialNumber; } CDINFO, *PCDINFO; diff --git a/drivers/filesystems/cdfs/common.c b/drivers/filesystems/cdfs/common.c index dd47a78a964..4dd9888492e 100644 --- a/drivers/filesystems/cdfs/common.c +++ b/drivers/filesystems/cdfs/common.c @@ -50,6 +50,7 @@ CdfsReadSectors(IN PDEVICE_OBJECT DeviceObject, PIRP Irp; NTSTATUS Status; +again: KeInitializeEvent(&Event, NotificationEvent, FALSE); @@ -102,14 +103,19 @@ CdfsReadSectors(IN PDEVICE_OBJECT DeviceObject, if (Status == STATUS_VERIFY_REQUIRED) { PDEVICE_OBJECT DeviceToVerify; - NTSTATUS NewStatus; DPRINT1("STATUS_VERIFY_REQUIRED\n"); DeviceToVerify = IoGetDeviceToVerify(PsGetCurrentThread()); IoSetDeviceToVerify(PsGetCurrentThread(), NULL); - NewStatus = IoVerifyVolume(DeviceToVerify, FALSE); - DPRINT1("IoVerifyVolume() returned (Status %lx)\n", NewStatus); + Status = IoVerifyVolume(DeviceToVerify, FALSE); + DPRINT1("IoVerifyVolume() returned (Status %lx)\n", Status); + + if (NT_SUCCESS(Status)) + { + DPRINT1("Volume verify succeeded; trying request again\n"); + goto again; + } } DPRINT("CdfsReadSectors() failed (Status %x)\n", Status); @@ -146,6 +152,7 @@ CdfsDeviceIoControl (IN PDEVICE_OBJECT DeviceObject, InputBuffer, InputBufferSize, OutputBuffer, OutputBufferSize, OutputBufferSize ? *OutputBufferSize : 0); +again: KeInitializeEvent (&Event, NotificationEvent, FALSE); DPRINT("Building device I/O control request ...\n"); @@ -191,7 +198,6 @@ CdfsDeviceIoControl (IN PDEVICE_OBJECT DeviceObject, if (Status == STATUS_VERIFY_REQUIRED) { PDEVICE_OBJECT DeviceToVerify; - NTSTATUS NewStatus; DPRINT1("STATUS_VERIFY_REQUIRED\n"); DeviceToVerify = IoGetDeviceToVerify(PsGetCurrentThread()); @@ -199,8 +205,14 @@ CdfsDeviceIoControl (IN PDEVICE_OBJECT DeviceObject, if (DeviceToVerify) { - NewStatus = IoVerifyVolume(DeviceToVerify, FALSE); - DPRINT1("IoVerifyVolume() returned (Status %lx)\n", NewStatus); + Status = IoVerifyVolume(DeviceToVerify, FALSE); + DPRINT1("IoVerifyVolume() returned (Status %lx)\n", Status); + } + + if (NT_SUCCESS(Status)) + { + DPRINT1("Volume verify succeeded; trying request again\n"); + goto again; } } diff --git a/drivers/filesystems/cdfs/create.c b/drivers/filesystems/cdfs/create.c index 2f088622262..d7a6440d820 100644 --- a/drivers/filesystems/cdfs/create.c +++ b/drivers/filesystems/cdfs/create.c @@ -40,7 +40,7 @@ CdfsMakeAbsoluteFilename(PFILE_OBJECT FileObject, PUNICODE_STRING RelativeFileName, PUNICODE_STRING AbsoluteFileName) { - ULONG Length; + USHORT Length; PFCB Fcb; NTSTATUS Status; diff --git a/drivers/filesystems/cdfs/dirctl.c b/drivers/filesystems/cdfs/dirctl.c index 0160c922321..8cf71a2d0dc 100644 --- a/drivers/filesystems/cdfs/dirctl.c +++ b/drivers/filesystems/cdfs/dirctl.c @@ -533,7 +533,7 @@ CdfsGetBothDirectoryInformation(PFCB Fcb, /* Copy short name */ ASSERT(Fcb->ShortNameU.Length / sizeof(WCHAR) <= 12); - Info->ShortNameLength = Fcb->ShortNameU.Length; + Info->ShortNameLength = (CCHAR)Fcb->ShortNameU.Length; RtlCopyMemory(Info->ShortName, Fcb->ShortNameU.Buffer, Fcb->ShortNameU.Length); return(STATUS_SUCCESS); diff --git a/drivers/filesystems/cdfs/finfo.c b/drivers/filesystems/cdfs/finfo.c index 25529f31607..07554c2890d 100644 --- a/drivers/filesystems/cdfs/finfo.c +++ b/drivers/filesystems/cdfs/finfo.c @@ -153,7 +153,7 @@ CdfsGetNameInformation(PFILE_OBJECT FileObject, ASSERT(Fcb != NULL); /* If buffer can't hold at least the file name length, bail out */ - if (*BufferLength < FIELD_OFFSET(FILE_NAME_INFORMATION, FileName[0])) + if (*BufferLength < (ULONG)FIELD_OFFSET(FILE_NAME_INFORMATION, FileName[0])) return STATUS_BUFFER_OVERFLOW; /* Calculate file name length in bytes */ diff --git a/drivers/filesystems/cdfs/fsctl.c b/drivers/filesystems/cdfs/fsctl.c index c0433db4768..a8543dbfb73 100644 --- a/drivers/filesystems/cdfs/fsctl.c +++ b/drivers/filesystems/cdfs/fsctl.c @@ -46,7 +46,7 @@ CdfsGetPVDData(PUCHAR Buffer, PCDINFO CdInfo) { PPVD Pvd; - ULONG i; + USHORT i; PUCHAR pc; PWCHAR pw; @@ -63,10 +63,10 @@ CdfsGetPVDData(PUCHAR Buffer, for (i = 0; i < 2048; i += 4) { /* DON'T optimize this to ULONG!!! (breaks overflow) */ - Serial.Part[0] += Buffer[i+3]; - Serial.Part[1] += Buffer[i+2]; - Serial.Part[2] += Buffer[i+1]; Serial.Part[3] += Buffer[i+0]; + Serial.Part[2] += Buffer[i+1]; + Serial.Part[1] += Buffer[i+2]; + Serial.Part[0] += Buffer[i+3]; } CdInfo->SerialNumber = Serial.Value; @@ -566,6 +566,7 @@ CdfsFileSystemControl(PDEVICE_OBJECT DeviceObject, switch (Stack->MinorFunction) { + case IRP_MN_KERNEL_CALL: case IRP_MN_USER_FS_REQUEST: switch (Stack->Parameters.DeviceIoControl.IoControlCode) { diff --git a/drivers/filesystems/ext2/CMakeLists.txt b/drivers/filesystems/ext2/CMakeLists.txt index 4917fb14311..46375e4b9b7 100644 --- a/drivers/filesystems/ext2/CMakeLists.txt +++ b/drivers/filesystems/ext2/CMakeLists.txt @@ -24,7 +24,7 @@ list(APPEND SOURCE add_library(ext2fs SHARED ${SOURCE}) target_link_libraries(ext2fs ${PSEH_LIB}) - +add_pch(ext2fs inc/ext2fsd.h) set_module_type(ext2fs kernelmodedriver) add_importlibs(ext2fs ntoskrnl hal) diff --git a/drivers/filesystems/fastfat/CMakeLists.txt b/drivers/filesystems/fastfat/CMakeLists.txt index 5d8dd934611..af6a263e2a0 100644 --- a/drivers/filesystems/fastfat/CMakeLists.txt +++ b/drivers/filesystems/fastfat/CMakeLists.txt @@ -23,11 +23,11 @@ list(APPEND SOURCE volume.c vfatfs.rc) -add_library(fastfat SHARED ${CMAKE_CURRENT_BINARY_DIR}/fastfat_vfat.h.gch ${SOURCE}) +add_library(fastfat SHARED ${SOURCE}) set_module_type(fastfat kernelmodedriver) add_importlibs(fastfat ntoskrnl hal) -add_pch(fastfat ${CMAKE_CURRENT_SOURCE_DIR}/vfat.h ${SOURCE}) +add_pch(fastfat vfat.h) add_cd_file(TARGET fastfat DESTINATION reactos/system32/drivers NO_CAB FOR all) diff --git a/drivers/filesystems/fastfat/blockdev.c b/drivers/filesystems/fastfat/blockdev.c index f0ff0598c2e..b3d3a0e39d8 100644 --- a/drivers/filesystems/fastfat/blockdev.c +++ b/drivers/filesystems/fastfat/blockdev.c @@ -38,6 +38,10 @@ VfatReadWritePartialCompletion (IN PDEVICE_OBJECT DeviceObject, { IrpContext->Flags |= IRPCONTEXT_PENDINGRETURNED; } + else + { + IrpContext->Flags &= ~IRPCONTEXT_PENDINGRETURNED; + } if (!NT_SUCCESS(Irp->IoStatus.Status)) { IrpContext->Irp->IoStatus.Status = Irp->IoStatus.Status; @@ -67,6 +71,7 @@ VfatReadDisk (IN PDEVICE_OBJECT pDeviceObject, KEVENT event; NTSTATUS Status; +again: KeInitializeEvent (&event, NotificationEvent, FALSE); DPRINT ("VfatReadDisk(pDeviceObject %p, Offset %I64x, Length %d, Buffer %p)\n", @@ -104,6 +109,25 @@ VfatReadDisk (IN PDEVICE_OBJECT pDeviceObject, Status = IoStatus.Status; } + if (Status == STATUS_VERIFY_REQUIRED) + { + PDEVICE_OBJECT DeviceToVerify; + + DPRINT1 ("Media change detected!\n"); + + /* Find the device to verify and reset the thread field to empty value again. */ + DeviceToVerify = IoGetDeviceToVerify (PsGetCurrentThread ()); + IoSetDeviceToVerify (PsGetCurrentThread (), NULL); + Status = IoVerifyVolume (DeviceToVerify, + FALSE); + + if (NT_SUCCESS(Status)) + { + DPRINT1 ("Volume verification successful; Reissuing read request\n"); + goto again; + } + } + if (!NT_SUCCESS (Status)) { DPRINT ("IO failed!!! VfatReadDisk : Error code: %x\n", Status); @@ -134,6 +158,7 @@ VfatReadDiskPartial (IN PVFAT_IRP_CONTEXT IrpContext, Buffer = (PCHAR)MmGetMdlVirtualAddress(IrpContext->Irp->MdlAddress) + BufferOffset; +again: Irp = IoAllocateIrp(IrpContext->DeviceExt->StorageDevice->StackSize, TRUE); if (Irp == NULL) { @@ -190,6 +215,25 @@ VfatReadDiskPartial (IN PVFAT_IRP_CONTEXT IrpContext, Status = IrpContext->Irp->IoStatus.Status; } + if (Status == STATUS_VERIFY_REQUIRED) + { + PDEVICE_OBJECT DeviceToVerify; + + DPRINT1 ("Media change detected!\n"); + + /* Find the device to verify and reset the thread field to empty value again. */ + DeviceToVerify = IoGetDeviceToVerify (PsGetCurrentThread ()); + IoSetDeviceToVerify (PsGetCurrentThread (), NULL); + Status = IoVerifyVolume (DeviceToVerify, + FALSE); + + if (NT_SUCCESS(Status)) + { + DPRINT1 ("Volume verification successful; Reissuing read request\n"); + goto again; + } + } + DPRINT("%x\n", Status); return Status; } @@ -212,6 +256,7 @@ VfatWriteDiskPartial (IN PVFAT_IRP_CONTEXT IrpContext, Buffer = (PCHAR)MmGetMdlVirtualAddress(IrpContext->Irp->MdlAddress) + BufferOffset; +again: DPRINT ("Building asynchronous FSD Request...\n"); Irp = IoAllocateIrp(IrpContext->DeviceExt->StorageDevice->StackSize, TRUE); if (Irp == NULL) @@ -268,6 +313,25 @@ VfatWriteDiskPartial (IN PVFAT_IRP_CONTEXT IrpContext, Status = IrpContext->Irp->IoStatus.Status; } + if (Status == STATUS_VERIFY_REQUIRED) + { + PDEVICE_OBJECT DeviceToVerify; + + DPRINT1 ("Media change detected!\n"); + + /* Find the device to verify and reset the thread field to empty value again. */ + DeviceToVerify = IoGetDeviceToVerify (PsGetCurrentThread ()); + IoSetDeviceToVerify (PsGetCurrentThread (), NULL); + Status = IoVerifyVolume (DeviceToVerify, + FALSE); + + if (NT_SUCCESS(Status)) + { + DPRINT1 ("Volume verification successful; Reissuing write request\n"); + goto again; + } + } + return Status; } @@ -292,6 +356,7 @@ VfatBlockDeviceIoControl (IN PDEVICE_OBJECT DeviceObject, InputBuffer, InputBufferSize, OutputBuffer, OutputBufferSize, OutputBufferSize ? *OutputBufferSize : 0); +again: KeInitializeEvent (&Event, NotificationEvent, FALSE); DPRINT("Building device I/O control request ...\n"); @@ -328,6 +393,25 @@ VfatBlockDeviceIoControl (IN PDEVICE_OBJECT DeviceObject, Status = IoStatus.Status; } + + if (Status == STATUS_VERIFY_REQUIRED) + { + PDEVICE_OBJECT DeviceToVerify; + + DPRINT1 ("Media change detected!\n"); + + /* Find the device to verify and reset the thread field to empty value again. */ + DeviceToVerify = IoGetDeviceToVerify (PsGetCurrentThread ()); + IoSetDeviceToVerify (PsGetCurrentThread (), NULL); + Status = IoVerifyVolume (DeviceToVerify, + FALSE); + + if (NT_SUCCESS(Status)) + { + DPRINT1 ("Volume verification successful; Reissuing IOCTL request\n"); + goto again; + } + } if (OutputBufferSize) { diff --git a/drivers/filesystems/fastfat/create.c b/drivers/filesystems/fastfat/create.c index 1053413d945..3a2f5be23ba 100644 --- a/drivers/filesystems/fastfat/create.c +++ b/drivers/filesystems/fastfat/create.c @@ -372,20 +372,6 @@ VfatOpenFile ( 0, FALSE); - if (Status == STATUS_VERIFY_REQUIRED) - - { - PDEVICE_OBJECT DeviceToVerify; - - DPRINT ("Media change detected!\n"); - DPRINT ("Device %p\n", DeviceExt->StorageDevice); - - /* Find the device to verify and reset the thread field to empty value again. */ - DeviceToVerify = IoGetDeviceToVerify (PsGetCurrentThread ()); - IoSetDeviceToVerify (PsGetCurrentThread (), NULL); - Status = IoVerifyVolume (DeviceToVerify, - FALSE); - } if (!NT_SUCCESS(Status)) { DPRINT ("Status %lx\n", Status); @@ -559,7 +545,7 @@ VfatCreateFile ( PDEVICE_OBJECT DeviceObject, PIRP Irp ) RequestedDisposition == FILE_SUPERSEDE) { ULONG Attributes; - Attributes = Stack->Parameters.Create.FileAttributes; + Attributes = Stack->Parameters.Create.FileAttributes & ~FILE_ATTRIBUTE_NORMAL; vfatSplitPathName(&PathNameU, NULL, &FileNameU); Status = VfatAddEntry (DeviceExt, &FileNameU, &pFcb, ParentFcb, RequestedOptions, diff --git a/drivers/filesystems/fastfat/fat.c b/drivers/filesystems/fastfat/fat.c index 8ff955a4fbd..b9157adf2e4 100644 --- a/drivers/filesystems/fastfat/fat.c +++ b/drivers/filesystems/fastfat/fat.c @@ -66,7 +66,7 @@ FAT16GetNextCluster(PDEVICE_EXTENSION DeviceExt, ChunkSize = CACHEPAGESIZE(DeviceExt); FATOffset = CurrentCluster * 2; Offset.QuadPart = ROUND_DOWN(FATOffset, ChunkSize); - if(!CcMapData(DeviceExt->FATFileObject, &Offset, ChunkSize, 1, &Context, &BaseAddress)) + if(!CcMapData(DeviceExt->FATFileObject, &Offset, ChunkSize, MAP_WAIT, &Context, &BaseAddress)) { return STATUS_UNSUCCESSFUL; } diff --git a/drivers/filesystems/fastfat/finfo.c b/drivers/filesystems/fastfat/finfo.c index cdadc87e4fa..61be39acbad 100644 --- a/drivers/filesystems/fastfat/finfo.c +++ b/drivers/filesystems/fastfat/finfo.c @@ -379,7 +379,7 @@ VfatGetNameInformation(PFILE_OBJECT FileObject, ASSERT(FCB != NULL); /* If buffer can't hold at least the file name length, bail out */ - if (*BufferLength < FIELD_OFFSET(FILE_NAME_INFORMATION, FileName[0])) + if (*BufferLength < (ULONG)FIELD_OFFSET(FILE_NAME_INFORMATION, FileName[0])) return STATUS_BUFFER_OVERFLOW; /* Save file name length, and as much file len, as buffer length allows */ diff --git a/drivers/filesystems/fastfat/fsctl.c b/drivers/filesystems/fastfat/fsctl.c index c6ec3044a62..6760ebfcbd9 100644 --- a/drivers/filesystems/fastfat/fsctl.c +++ b/drivers/filesystems/fastfat/fsctl.c @@ -841,6 +841,7 @@ NTSTATUS VfatFileSystemControl(PVFAT_IRP_CONTEXT IrpContext) switch (IrpContext->MinorFunction) { + case IRP_MN_KERNEL_CALL: case IRP_MN_USER_FS_REQUEST: switch(IrpContext->Stack->Parameters.DeviceIoControl.IoControlCode) { diff --git a/drivers/filesystems/fastfat/rw.c b/drivers/filesystems/fastfat/rw.c index bbcae945c83..5dd906b672a 100644 --- a/drivers/filesystems/fastfat/rw.c +++ b/drivers/filesystems/fastfat/rw.c @@ -537,7 +537,6 @@ VfatRead(PVFAT_IRP_CONTEXT IrpContext) PERESOURCE Resource = NULL; LARGE_INTEGER ByteOffset; PVOID Buffer; - PDEVICE_OBJECT DeviceToVerify; ULONG BytesPerSector; ASSERT(IrpContext); @@ -697,22 +696,6 @@ VfatRead(PVFAT_IRP_CONTEXT IrpContext) } Status = VfatReadFileData(IrpContext, Length, ByteOffset, &ReturnedLength); -/**/ - if (Status == STATUS_VERIFY_REQUIRED) - { - DPRINT("VfatReadFile returned STATUS_VERIFY_REQUIRED\n"); - DeviceToVerify = IoGetDeviceToVerify(PsGetCurrentThread()); - IoSetDeviceToVerify(PsGetCurrentThread(), DeviceToVerify); - Status = IoVerifyVolume (DeviceToVerify, FALSE); - - if (NT_SUCCESS(Status)) - { - Status = VfatReadFileData(IrpContext, Length, - ByteOffset, &ReturnedLength); - } - - } -/**/ if (NT_SUCCESS(Status)) { IrpContext->Irp->IoStatus.Information = ReturnedLength; diff --git a/drivers/filesystems/fastfat_new/CMakeLists.txt b/drivers/filesystems/fastfat_new/CMakeLists.txt index 57042c98d41..e25e5c853cc 100644 --- a/drivers/filesystems/fastfat_new/CMakeLists.txt +++ b/drivers/filesystems/fastfat_new/CMakeLists.txt @@ -24,7 +24,7 @@ list(APPEND SOURCE volume.c fastfat.rc) -add_library(fastfat_new SHARED ${CMAKE_CURRENT_BINARY_DIR}/fastfat_new_fastfat.h.gch ${SOURCE}) +add_library(fastfat_new SHARED ${SOURCE}) set_module_type(fastfat_new kernelmodedriver) @@ -34,4 +34,4 @@ target_link_libraries(fastfat_new add_importlibs(fastfat_new ntoskrnl hal) -add_pch(fastfat_new ${CMAKE_CURRENT_SOURCE_DIR}/fastfat.h ${SOURCE}) +add_pch(fastfat_new fastfat.h) diff --git a/drivers/filesystems/fastfat_new/fsctl.c b/drivers/filesystems/fastfat_new/fsctl.c index 540b417b8d8..fef6b239239 100644 --- a/drivers/filesystems/fastfat_new/fsctl.c +++ b/drivers/filesystems/fastfat_new/fsctl.c @@ -453,6 +453,7 @@ FatiFileSystemControl(PFAT_IRP_CONTEXT IrpContext, PIRP Irp) /* Dispatch depending on the minor function */ switch (IrpSp->MinorFunction) { + case IRP_MN_KERNEL_CALL: case IRP_MN_USER_FS_REQUEST: Status = FatUserFsCtrl(IrpContext, Irp); break; diff --git a/drivers/filesystems/fs_rec/CMakeLists.txt b/drivers/filesystems/fs_rec/CMakeLists.txt index 14bfce865de..dba33ead1be 100644 --- a/drivers/filesystems/fs_rec/CMakeLists.txt +++ b/drivers/filesystems/fs_rec/CMakeLists.txt @@ -11,5 +11,5 @@ add_library(fs_rec SHARED set_module_type(fs_rec kernelmodedriver) add_importlibs(fs_rec ntoskrnl hal) - +add_pch(fs_rec fs_rec.h) add_cd_file(TARGET fs_rec DESTINATION reactos/system32/drivers FOR all) diff --git a/drivers/filesystems/msfs/CMakeLists.txt b/drivers/filesystems/msfs/CMakeLists.txt index ddf2bf5b112..62f79d5f55b 100644 --- a/drivers/filesystems/msfs/CMakeLists.txt +++ b/drivers/filesystems/msfs/CMakeLists.txt @@ -7,11 +7,11 @@ list(APPEND SOURCE rw.c msfs.rc) -add_library(msfs SHARED ${CMAKE_CURRENT_BINARY_DIR}/msfs_msfs.h.gch ${SOURCE}) +add_library(msfs SHARED ${SOURCE}) set_module_type(msfs kernelmodedriver) add_importlibs(msfs ntoskrnl hal) -add_pch(msfs ${CMAKE_CURRENT_SOURCE_DIR}/msfs.h ${SOURCE}) +add_pch(msfs msfs.h) add_cd_file(TARGET msfs DESTINATION reactos/system32/drivers FOR all) diff --git a/drivers/filesystems/mup/CMakeLists.txt b/drivers/filesystems/mup/CMakeLists.txt index 6ac375d8025..19712432332 100644 --- a/drivers/filesystems/mup/CMakeLists.txt +++ b/drivers/filesystems/mup/CMakeLists.txt @@ -6,5 +6,5 @@ add_library(mup SHARED set_module_type(mup kernelmodedriver) add_importlibs(mup ntoskrnl hal) - +add_pch(mup mup.h) add_cd_file(TARGET mup DESTINATION reactos/system32/drivers FOR all) \ No newline at end of file diff --git a/drivers/filesystems/mup/create.c b/drivers/filesystems/mup/create.c index 1d96051dc7d..127a0756e5c 100644 --- a/drivers/filesystems/mup/create.c +++ b/drivers/filesystems/mup/create.c @@ -27,14 +27,11 @@ /* INCLUDES *****************************************************************/ -#include +#include "mup.h" //#define NDEBUG #include -#include "mup.h" - - /* FUNCTIONS ****************************************************************/ NTSTATUS NTAPI diff --git a/drivers/filesystems/mup/mup.c b/drivers/filesystems/mup/mup.c index cf75de6ffcd..845b6ba6699 100644 --- a/drivers/filesystems/mup/mup.c +++ b/drivers/filesystems/mup/mup.c @@ -27,14 +27,11 @@ /* INCLUDES *****************************************************************/ -#include +#include "mup.h" //#define NDEBUG #include -#include "mup.h" - - /* GLOBALS *****************************************************************/ diff --git a/drivers/filesystems/mup/mup.h b/drivers/filesystems/mup/mup.h index 7eca3a24f25..9bb1564aead 100644 --- a/drivers/filesystems/mup/mup.h +++ b/drivers/filesystems/mup/mup.h @@ -1,17 +1,14 @@ -#pragma once + +#include #define ROUND_UP(N, S) ((((N) + (S) - 1) / (S)) * (S)) - - typedef struct { ULONG Dummy; } DEVICE_EXTENSION, *PDEVICE_EXTENSION, VCB, *PVCB; - - /* create.c */ DRIVER_DISPATCH MupCreate; NTSTATUS NTAPI @@ -19,7 +16,6 @@ MupCreate(PDEVICE_OBJECT DeviceObject, PIRP Irp); /* mup.c */ - NTSTATUS NTAPI DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath); diff --git a/drivers/filesystems/npfs/CMakeLists.txt b/drivers/filesystems/npfs/CMakeLists.txt index 8f960fc81f7..b1d4c044782 100644 --- a/drivers/filesystems/npfs/CMakeLists.txt +++ b/drivers/filesystems/npfs/CMakeLists.txt @@ -9,11 +9,11 @@ list(APPEND SOURCE volume.c npfs.rc) -add_library(npfs SHARED ${CMAKE_CURRENT_BINARY_DIR}/npfs_npfs.h.gch ${SOURCE}) +add_library(npfs SHARED ${SOURCE}) target_link_libraries(npfs ${PSEH_LIB}) set_module_type(npfs kernelmodedriver) add_importlibs(npfs ntoskrnl hal) -add_pch(npfs ${CMAKE_CURRENT_SOURCE_DIR}/npfs.h ${SOURCE}) +add_pch(npfs npfs.h) add_cd_file(TARGET npfs DESTINATION reactos/system32/drivers FOR all) diff --git a/drivers/filesystems/npfs/create.c b/drivers/filesystems/npfs/create.c index 5a53f556300..a05c56902b9 100644 --- a/drivers/filesystems/npfs/create.c +++ b/drivers/filesystems/npfs/create.c @@ -17,6 +17,76 @@ /* FUNCTIONS *****************************************************************/ +static +VOID +NpfsDeleteFcb(PNPFS_FCB Fcb) +{ + PNPFS_VCB Vcb = Fcb->Vcb; + + KeLockMutex(&Vcb->PipeListLock); + RemoveEntryList(&Fcb->PipeListEntry); + KeUnlockMutex(&Vcb->PipeListLock); + RtlFreeUnicodeString(&Fcb->PipeName); + ExFreePoolWithTag(Fcb, TAG_NPFS_FCB); +} + +static +PNPFS_CCB +NpfsAllocateCcb(CCB_TYPE Type, PNPFS_FCB Fcb) +{ + PNPFS_CCB Ccb; + + Ccb = ExAllocatePoolWithTag(NonPagedPool, sizeof(NPFS_CCB), TAG_NPFS_CCB); + if (!Ccb) + { + return NULL; + } + + RtlZeroMemory(Ccb, sizeof(NPFS_CCB)); + + Ccb->RefCount = 1; + Ccb->Type = Type; + Ccb->Fcb = Fcb; + Ccb->OtherSide = NULL; + + return Ccb; +} + +static +VOID +NpfsReferenceCcb(PNPFS_CCB Ccb) +{ + ASSERT(Ccb->RefCount > 0); + InterlockedIncrement((PLONG)&Ccb->RefCount); +} + +static +VOID +NpfsDereferenceCcb(PNPFS_CCB Ccb) +{ + /* Decrement reference count */ + ASSERT(Ccb->RefCount > 0); + if (InterlockedDecrement((PLONG)&Ccb->RefCount) == 0) + { + /* Its zero, delete CCB */ + ExFreePoolWithTag(Ccb, TAG_NPFS_CCB); + } +} + +static +VOID +NpfsCcbSetOtherSide(PNPFS_CCB Ccb, PNPFS_CCB OtherSide) +{ + /* Dereference old other side */ + if (Ccb->OtherSide) NpfsDereferenceCcb(Ccb->OtherSide); + + /* Reference the new other side */ + if (OtherSide) NpfsReferenceCcb(OtherSide); + + /* Set new value */ + Ccb->OtherSide = OtherSide; +} + PNPFS_FCB NpfsFindPipe(PNPFS_VCB Vcb, PUNICODE_STRING PipeName) @@ -114,18 +184,13 @@ NpfsOpenFileSystem(PNPFS_FCB Fcb, DPRINT("NpfsOpenFileSystem()\n"); - Ccb = ExAllocatePool(NonPagedPool, sizeof(NPFS_CCB)); + Ccb = NpfsAllocateCcb(CCB_DEVICE, Fcb); if (Ccb == NULL) { IoStatus->Status = STATUS_NO_MEMORY; return; } - RtlZeroMemory(Ccb, sizeof(NPFS_CCB)); - - Ccb->Type = CCB_DEVICE; - Ccb->Fcb = Fcb; - FileObject->FsContext = Fcb; FileObject->FsContext2 = Ccb; @@ -145,18 +210,13 @@ NpfsOpenRootDirectory(PNPFS_FCB Fcb, DPRINT("NpfsOpenRootDirectory()\n"); - Ccb = ExAllocatePool(NonPagedPool, sizeof(NPFS_CCB)); + Ccb = NpfsAllocateCcb(CCB_DIRECTORY, Fcb); if (Ccb == NULL) { IoStatus->Status = STATUS_NO_MEMORY; return; } - RtlZeroMemory(Ccb, sizeof(NPFS_CCB)); - - Ccb->Type = CCB_DIRECTORY; - Ccb->Fcb = Fcb; - FileObject->FsContext = Fcb; FileObject->FsContext2 = Ccb; @@ -244,8 +304,7 @@ NpfsCreate(PDEVICE_OBJECT DeviceObject, * Step 1. Find the pipe we're trying to open. */ KeLockMutex(&Vcb->PipeListLock); - Fcb = NpfsFindPipe(Vcb, - &FileObject->FileName); + Fcb = NpfsFindPipe(Vcb, &FileObject->FileName); if (Fcb == NULL) { /* Not found, bail out with error. */ @@ -267,7 +326,7 @@ NpfsCreate(PDEVICE_OBJECT DeviceObject, /* * Step 2. Create the client CCB. */ - ClientCcb = ExAllocatePool(NonPagedPool, sizeof(NPFS_CCB)); + ClientCcb = NpfsAllocateCcb(CCB_PIPE, Fcb); if (ClientCcb == NULL) { DPRINT("No memory!\n"); @@ -277,11 +336,8 @@ NpfsCreate(PDEVICE_OBJECT DeviceObject, return STATUS_NO_MEMORY; } - ClientCcb->Type = CCB_PIPE; ClientCcb->Thread = (struct ETHREAD *)Irp->Tail.Overlay.Thread; - ClientCcb->Fcb = Fcb; ClientCcb->PipeEnd = FILE_PIPE_CLIENT_END; - ClientCcb->OtherSide = NULL; #ifndef USING_PROPER_NPFS_WAIT_SEMANTICS ClientCcb->PipeState = SpecialAccess ? 0 : FILE_PIPE_DISCONNECTED_STATE; #else @@ -294,11 +350,13 @@ NpfsCreate(PDEVICE_OBJECT DeviceObject, /* Initialize data list. */ if (Fcb->OutboundQuota) { - ClientCcb->Data = ExAllocatePool(PagedPool, Fcb->OutboundQuota); + ClientCcb->Data = ExAllocatePoolWithTag(PagedPool, + Fcb->OutboundQuota, + TAG_NPFS_CCB_DATA); if (ClientCcb->Data == NULL) { DPRINT("No memory!\n"); - ExFreePool(ClientCcb); + NpfsDereferenceCcb(ClientCcb); KeUnlockMutex(&Fcb->CcbListLock); Irp->IoStatus.Status = STATUS_NO_MEMORY; IoCompleteRequest(Irp, IO_NO_INCREMENT); @@ -367,10 +425,10 @@ NpfsCreate(PDEVICE_OBJECT DeviceObject, DPRINT("No listening server CCB found!\n"); if (ClientCcb->Data) { - ExFreePool(ClientCcb->Data); + ExFreePoolWithTag(ClientCcb->Data, TAG_NPFS_CCB_DATA); } - ExFreePool(ClientCcb); + NpfsDereferenceCcb(ClientCcb); KeUnlockMutex(&Fcb->CcbListLock); Irp->IoStatus.Status = STATUS_OBJECT_PATH_NOT_FOUND; IoCompleteRequest(Irp, IO_NO_INCREMENT); @@ -391,10 +449,10 @@ NpfsCreate(PDEVICE_OBJECT DeviceObject, if (ClientCcb->Data) { - ExFreePool(ClientCcb->Data); + ExFreePoolWithTag(ClientCcb->Data, TAG_NPFS_CCB_DATA); } - ExFreePool(ClientCcb); + NpfsDereferenceCcb(ClientCcb); KeUnlockMutex(&Fcb->CcbListLock); Irp->IoStatus.Status = STATUS_UNSUCCESSFUL; @@ -413,8 +471,8 @@ NpfsCreate(PDEVICE_OBJECT DeviceObject, /* Connect to listening server side */ if (ServerCcb) { - ClientCcb->OtherSide = ServerCcb; - ServerCcb->OtherSide = ClientCcb; + NpfsCcbSetOtherSide(ClientCcb, ServerCcb); + NpfsCcbSetOtherSide(ServerCcb, ClientCcb); ClientCcb->PipeState = FILE_PIPE_CONNECTED_STATE; ServerCcb->PipeState = FILE_PIPE_CONNECTED_STATE; KeSetEvent(&ServerCcb->ConnectEvent, IO_NO_INCREMENT, FALSE); @@ -467,23 +525,12 @@ NpfsCreateNamedPipe(PDEVICE_OBJECT DeviceObject, return STATUS_INVALID_PARAMETER; } - Ccb = ExAllocatePool(NonPagedPool, sizeof(NPFS_CCB)); - if (Ccb == NULL) - { - Irp->IoStatus.Status = STATUS_NO_MEMORY; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - return STATUS_NO_MEMORY; - } - - Ccb->Type = CCB_PIPE; - Ccb->Thread = (struct ETHREAD *)Irp->Tail.Overlay.Thread; KeLockMutex(&Vcb->PipeListLock); /* * First search for existing Pipe with the same name. */ - Fcb = NpfsFindPipe(Vcb, - &FileObject->FileName); + Fcb = NpfsFindPipe(Vcb, &FileObject->FileName); if (Fcb != NULL) { /* @@ -495,7 +542,6 @@ NpfsCreateNamedPipe(PDEVICE_OBJECT DeviceObject, if (Fcb->CurrentInstances >= Fcb->MaximumInstances) { DPRINT("Out of instances.\n"); - ExFreePool(Ccb); Irp->IoStatus.Status = STATUS_INSTANCE_NOT_AVAILABLE; IoCompleteRequest(Irp, IO_NO_INCREMENT); return STATUS_INSTANCE_NOT_AVAILABLE; @@ -506,7 +552,6 @@ NpfsCreateNamedPipe(PDEVICE_OBJECT DeviceObject, Fcb->PipeType != Buffer->NamedPipeType) { DPRINT("Asked for invalid pipe mode.\n"); - ExFreePool(Ccb); Irp->IoStatus.Status = STATUS_ACCESS_DENIED; IoCompleteRequest(Irp, IO_NO_INCREMENT); return STATUS_ACCESS_DENIED; @@ -515,11 +560,10 @@ NpfsCreateNamedPipe(PDEVICE_OBJECT DeviceObject, else { NewPipe = TRUE; - Fcb = ExAllocatePool(NonPagedPool, sizeof(NPFS_FCB)); + Fcb = ExAllocatePoolWithTag(NonPagedPool, sizeof(NPFS_FCB), TAG_NPFS_FCB); if (Fcb == NULL) { KeUnlockMutex(&Vcb->PipeListLock); - ExFreePool(Ccb); Irp->IoStatus.Status = STATUS_NO_MEMORY; Irp->IoStatus.Information = 0; IoCompleteRequest(Irp, IO_NO_INCREMENT); @@ -530,12 +574,13 @@ NpfsCreateNamedPipe(PDEVICE_OBJECT DeviceObject, Fcb->Vcb = Vcb; Fcb->PipeName.Length = FileObject->FileName.Length; Fcb->PipeName.MaximumLength = Fcb->PipeName.Length + sizeof(UNICODE_NULL); - Fcb->PipeName.Buffer = ExAllocatePool(NonPagedPool, Fcb->PipeName.MaximumLength); + Fcb->PipeName.Buffer = ExAllocatePoolWithTag(NonPagedPool, + Fcb->PipeName.MaximumLength, + TAG_NPFS_NAMEBLOCK); if (Fcb->PipeName.Buffer == NULL) { KeUnlockMutex(&Vcb->PipeListLock); - ExFreePool(Fcb); - ExFreePool(Ccb); + ExFreePoolWithTag(Fcb, TAG_NPFS_FCB); Irp->IoStatus.Status = STATUS_NO_MEMORY; Irp->IoStatus.Information = 0; IoCompleteRequest(Irp, IO_NO_INCREMENT); @@ -623,20 +668,33 @@ NpfsCreateNamedPipe(PDEVICE_OBJECT DeviceObject, KeUnlockMutex(&Vcb->PipeListLock); } + Ccb = NpfsAllocateCcb(CCB_PIPE, Fcb); + if (Ccb == NULL) + { + if (NewPipe) + { + NpfsDeleteFcb(Fcb); + } + + Irp->IoStatus.Status = STATUS_NO_MEMORY; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return STATUS_NO_MEMORY; + } + + Ccb->Thread = (struct ETHREAD *)Irp->Tail.Overlay.Thread; + if (Fcb->InboundQuota) { - Ccb->Data = ExAllocatePool(PagedPool, Fcb->InboundQuota); + Ccb->Data = ExAllocatePoolWithTag(PagedPool, + Fcb->InboundQuota, + TAG_NPFS_CCB_DATA); if (Ccb->Data == NULL) { - ExFreePool(Ccb); + NpfsDereferenceCcb(Ccb); if (NewPipe) { - KeLockMutex(&Vcb->PipeListLock); - RemoveEntryList(&Fcb->PipeListEntry); - KeUnlockMutex(&Vcb->PipeListLock); - RtlFreeUnicodeString(&Fcb->PipeName); - ExFreePool(Fcb); + NpfsDeleteFcb(Fcb); } Irp->IoStatus.Status = STATUS_NO_MEMORY; @@ -662,7 +720,6 @@ NpfsCreateNamedPipe(PDEVICE_OBJECT DeviceObject, Ccb->Fcb = Fcb; Ccb->PipeEnd = FILE_PIPE_SERVER_END; Ccb->PipeState = FILE_PIPE_LISTENING_STATE; - Ccb->OtherSide = NULL; DPRINT("CCB: %p\n", Ccb); @@ -753,6 +810,8 @@ NpfsCleanup(PDEVICE_OBJECT DeviceObject, if ((Ccb->PipeState == FILE_PIPE_CONNECTED_STATE) && (Ccb->OtherSide)) { OtherSide = Ccb->OtherSide; + ASSERT(OtherSide->OtherSide == Ccb); + /* Lock the server first */ if (Server) { @@ -764,7 +823,11 @@ NpfsCleanup(PDEVICE_OBJECT DeviceObject, ExAcquireFastMutex(&OtherSide->DataListLock); ExAcquireFastMutex(&Ccb->DataListLock); } - OtherSide->OtherSide = NULL; + + /* Unlink FCBs */ + NpfsCcbSetOtherSide(OtherSide, NULL); + NpfsCcbSetOtherSide(Ccb, NULL); + /* * Signaling the write event. If is possible that an other * thread waits for an empty buffer. @@ -824,7 +887,7 @@ NpfsCleanup(PDEVICE_OBJECT DeviceObject, ExAcquireFastMutex(&Ccb->DataListLock); if (Ccb->Data) { - ExFreePool(Ccb->Data); + ExFreePoolWithTag(Ccb->Data, TAG_NPFS_CCB_DATA); Ccb->Data = NULL; Ccb->ReadPtr = NULL; Ccb->WritePtr = NULL; @@ -871,7 +934,7 @@ NpfsClose(PDEVICE_OBJECT DeviceObject, { DPRINT("Closing the file system!\n"); - ExFreePool(Ccb); + NpfsDereferenceCcb(Ccb); FileObject->FsContext = NULL; FileObject->FsContext2 = NULL; @@ -886,9 +949,10 @@ NpfsClose(PDEVICE_OBJECT DeviceObject, DPRINT("Closing the root directory!\n"); if (Ccb->u.Directory.SearchPattern.Buffer != NULL) - ExFreePool(Ccb->u.Directory.SearchPattern.Buffer); + ExFreePoolWithTag(Ccb->u.Directory.SearchPattern.Buffer, + TAG_NPFS_NAMEBLOCK); - ExFreePool(Ccb); + NpfsDereferenceCcb(Ccb); FileObject->FsContext = NULL; FileObject->FsContext2 = NULL; @@ -920,8 +984,10 @@ NpfsClose(PDEVICE_OBJECT DeviceObject, /* Disconnect the pipes */ if (Ccb->OtherSide) { - Ccb->OtherSide->OtherSide = NULL; - Ccb->OtherSide = NULL; + /* FIXME: Timo wants it rewritten */ + /*ASSERT(Ccb->OtherSide->OtherSide == Ccb);*/ + NpfsCcbSetOtherSide(Ccb->OtherSide, NULL); + NpfsCcbSetOtherSide(Ccb, NULL); } ASSERT(Ccb->PipeState == FILE_PIPE_CLOSING_STATE); @@ -930,18 +996,14 @@ NpfsClose(PDEVICE_OBJECT DeviceObject, RemoveEntryList(&Ccb->CcbListEntry); - ExFreePool(Ccb); + NpfsDereferenceCcb(Ccb); KeUnlockMutex(&Fcb->CcbListLock); if (IsListEmpty(&Fcb->ServerCcbListHead) && IsListEmpty(&Fcb->ClientCcbListHead)) { - KeLockMutex(&Vcb->PipeListLock); - RemoveEntryList(&Fcb->PipeListEntry); - KeUnlockMutex(&Vcb->PipeListLock); - RtlFreeUnicodeString(&Fcb->PipeName); - ExFreePool(Fcb); + NpfsDeleteFcb(Fcb); FileObject->FsContext = NULL; } diff --git a/drivers/filesystems/npfs/dirctl.c b/drivers/filesystems/npfs/dirctl.c index ef7b1317774..87053e8aeb7 100644 --- a/drivers/filesystems/npfs/dirctl.c +++ b/drivers/filesystems/npfs/dirctl.c @@ -21,7 +21,7 @@ NpfsQueryDirectory(PNPFS_CCB Ccb, PULONG Size) { PIO_STACK_LOCATION Stack; - LONG BufferLength = 0; + ULONG BufferLength = 0; PUNICODE_STRING SearchPattern = NULL; FILE_INFORMATION_CLASS FileInformationClass; ULONG FileIndex = 0; @@ -71,7 +71,9 @@ NpfsQueryDirectory(PNPFS_CCB Ccb, if (SearchPattern != NULL) { Ccb->u.Directory.SearchPattern.Buffer = - ExAllocatePool(NonPagedPool, SearchPattern->Length + sizeof(WCHAR)); + ExAllocatePoolWithTag(NonPagedPool, + SearchPattern->Length + sizeof(WCHAR), + TAG_NPFS_NAMEBLOCK); if (Ccb->u.Directory.SearchPattern.Buffer == NULL) { return STATUS_INSUFFICIENT_RESOURCES; @@ -87,7 +89,9 @@ NpfsQueryDirectory(PNPFS_CCB Ccb, else { Ccb->u.Directory.SearchPattern.Buffer = - ExAllocatePool(NonPagedPool, 2 * sizeof(WCHAR)); + ExAllocatePoolWithTag(NonPagedPool, + 2 * sizeof(WCHAR), + TAG_NPFS_NAMEBLOCK); if (Ccb->u.Directory.SearchPattern.Buffer == NULL) { return STATUS_INSUFFICIENT_RESOURCES; diff --git a/drivers/filesystems/npfs/fsctrl.c b/drivers/filesystems/npfs/fsctrl.c index 4a325c28908..5e723b4db6b 100644 --- a/drivers/filesystems/npfs/fsctrl.c +++ b/drivers/filesystems/npfs/fsctrl.c @@ -441,7 +441,9 @@ NpfsWaitPipe2(PIRP Irp, /* Calculate the pipe name length and allocate the buffer */ PipeName.Length = WaitPipe->NameLength + sizeof(WCHAR); PipeName.MaximumLength = PipeName.Length + sizeof(WCHAR); - PipeName.Buffer = ExAllocatePool(NonPagedPool, PipeName.MaximumLength); + PipeName.Buffer = ExAllocatePoolWithTag(NonPagedPool, + PipeName.MaximumLength, + TAG_NPFS_NAMEBLOCK); if (PipeName.Buffer == NULL) { DPRINT1("Could not allocate memory for the pipe name!\n"); @@ -471,7 +473,7 @@ NpfsWaitPipe2(PIRP Irp, KeUnlockMutex(&Vcb->PipeListLock); /* Release the pipe name buffer */ - ExFreePool(PipeName.Buffer); + ExFreePoolWithTag(PipeName.Buffer, TAG_NPFS_NAMEBLOCK); /* Fail if not pipe was found */ if (Fcb == NULL) diff --git a/drivers/filesystems/npfs/npfs.c b/drivers/filesystems/npfs/npfs.c index dfe4ed9e4b1..58b0ffcee3b 100644 --- a/drivers/filesystems/npfs/npfs.c +++ b/drivers/filesystems/npfs/npfs.c @@ -86,13 +86,13 @@ DriverEntry(PDRIVER_OBJECT DriverObject, Vcb->MaxQuota = 64 * PAGE_SIZE; /* Create the device FCB */ - Fcb = ExAllocatePool(NonPagedPool, sizeof(NPFS_FCB)); + Fcb = ExAllocatePoolWithTag(NonPagedPool, sizeof(NPFS_FCB), TAG_NPFS_FCB); Fcb->Type = FCB_DEVICE; Fcb->Vcb = Vcb; Vcb->DeviceFcb = Fcb; /* Create the root directory FCB */ - Fcb = ExAllocatePool(NonPagedPool, sizeof(NPFS_FCB)); + Fcb = ExAllocatePoolWithTag(NonPagedPool, sizeof(NPFS_FCB), TAG_NPFS_FCB); Fcb->Type = FCB_DIRECTORY; Fcb->Vcb = Vcb; Vcb->RootFcb = Fcb; diff --git a/drivers/filesystems/npfs/npfs.h b/drivers/filesystems/npfs/npfs.h index b5435859641..5f8fabb8348 100644 --- a/drivers/filesystems/npfs/npfs.h +++ b/drivers/filesystems/npfs/npfs.h @@ -5,6 +5,12 @@ #include #include +#define TAG_NPFS_CCB 'cFpN' +#define TAG_NPFS_CCB_DATA 'iFpN' /* correct? */ +#define TAG_NPFS_FCB 'FFpN' +#define TAG_NPFS_NAMEBLOCK 'nFpN' +#define TAG_NPFS_THREAD_CONTEXT 'tFpN' + #define ROUND_DOWN(n, align) \ (((ULONG)n) & ~((align) - 1l)) @@ -87,6 +93,7 @@ typedef struct _NPFS_CCB ULONG PipeState; ULONG ReadDataAvailable; ULONG WriteQuotaAvailable; + ULONG RefCount; LIST_ENTRY ReadRequestListHead; diff --git a/drivers/filesystems/npfs/rw.c b/drivers/filesystems/npfs/rw.c index ea3449adb70..e8547f52a64 100644 --- a/drivers/filesystems/npfs/rw.c +++ b/drivers/filesystems/npfs/rw.c @@ -21,7 +21,7 @@ VOID HexDump(PUCHAR Buffer, ULONG Length) CHAR Line[65]; UCHAR ch; const char Hex[] = "0123456789ABCDEF"; - int i, j; + ULONG i, j; DbgPrint("---------------\n"); @@ -194,12 +194,11 @@ NpfsWaiterThread(PVOID InitContext) { /* it exist an other thread with empty wait slots, we can remove our thread from the list */ RemoveEntryList(&ThreadContext->ListEntry); - ThreadContext->Vcb->EmptyWaiterCount -= MAXIMUM_WAIT_OBJECTS - 1; + ExFreePoolWithTag(ThreadContext, TAG_NPFS_THREAD_CONTEXT); KeUnlockMutex(&ThreadContext->Vcb->PipeListLock); break; } } - ExFreePool(ThreadContext); } static NTSTATUS @@ -234,7 +233,9 @@ NpfsAddWaitingReadWriteRequest(IN PDEVICE_OBJECT DeviceObject, if (ListEntry == &Vcb->ThreadListHead) { - ThreadContext = ExAllocatePool(NonPagedPool, sizeof(NPFS_THREAD_CONTEXT)); + ThreadContext = ExAllocatePoolWithTag(NonPagedPool, + sizeof(NPFS_THREAD_CONTEXT), + TAG_NPFS_THREAD_CONTEXT); if (ThreadContext == NULL) { KeUnlockMutex(&Vcb->PipeListLock); @@ -257,7 +258,7 @@ NpfsAddWaitingReadWriteRequest(IN PDEVICE_OBJECT DeviceObject, (PVOID)ThreadContext); if (!NT_SUCCESS(Status)) { - ExFreePool(ThreadContext); + ExFreePoolWithTag(ThreadContext, TAG_NPFS_THREAD_CONTEXT); KeUnlockMutex(&Vcb->PipeListLock); return Status; } @@ -638,7 +639,7 @@ NpfsRead(IN PDEVICE_OBJECT DeviceObject, Buffer = (PVOID)((ULONG_PTR)Buffer + CopyLength); Length -= CopyLength; } - else + else { KeResetEvent(&Ccb->ReadEvent); diff --git a/drivers/filesystems/ntfs/CMakeLists.txt b/drivers/filesystems/ntfs/CMakeLists.txt index bef4973c8d9..172436e3bd8 100644 --- a/drivers/filesystems/ntfs/CMakeLists.txt +++ b/drivers/filesystems/ntfs/CMakeLists.txt @@ -17,11 +17,11 @@ list(APPEND SOURCE volinfo.c ntfs.rc) -add_library(ntfs SHARED ${CMAKE_CURRENT_BINARY_DIR}/ntfs_ntfs.h.gch ${SOURCE}) +add_library(ntfs SHARED ${SOURCE}) set_module_type(ntfs kernelmodedriver) add_importlibs(ntfs ntoskrnl hal) -add_pch(ntfs ${CMAKE_CURRENT_SOURCE_DIR}/ntfs.h ${SOURCE}) +add_pch(ntfs ntfs.h) add_cd_file(TARGET ntfs DESTINATION reactos/system32/drivers NO_CAB FOR all) diff --git a/drivers/filesystems/ntfs/fsctl.c b/drivers/filesystems/ntfs/fsctl.c index 0095ec1612c..ce63429d4df 100644 --- a/drivers/filesystems/ntfs/fsctl.c +++ b/drivers/filesystems/ntfs/fsctl.c @@ -483,8 +483,9 @@ NtfsFsdFileSystemControl(PDEVICE_OBJECT DeviceObject, switch (Stack->MinorFunction) { + case IRP_MN_KERNEL_CALL: case IRP_MN_USER_FS_REQUEST: - DPRINT("NTFS: IRP_MN_USER_FS_REQUEST\n"); + DPRINT("NTFS: IRP_MN_USER_FS_REQUEST/IRP_MN_KERNEL_CALL\n"); Status = STATUS_INVALID_DEVICE_REQUEST; break; diff --git a/drivers/input/i8042prt/CMakeLists.txt b/drivers/input/i8042prt/CMakeLists.txt index 1761b6111c5..ddeba6f0d09 100644 --- a/drivers/input/i8042prt/CMakeLists.txt +++ b/drivers/input/i8042prt/CMakeLists.txt @@ -16,5 +16,5 @@ add_library(i8042prt SHARED set_module_type(i8042prt kernelmodedriver) add_importlibs(i8042prt ntoskrnl hal) - +add_pch(i8042prt i8042prt.h) add_cd_file(TARGET i8042prt DESTINATION reactos/system32/drivers NO_CAB FOR all) \ No newline at end of file diff --git a/drivers/input/i8042prt/i8042prt.h b/drivers/input/i8042prt/i8042prt.h index 035feaf9ea9..a5aa4da41b4 100644 --- a/drivers/input/i8042prt/i8042prt.h +++ b/drivers/input/i8042prt/i8042prt.h @@ -1,5 +1,3 @@ -#pragma once - #include #include #include diff --git a/drivers/input/i8042prt/i8042prt.rbuild b/drivers/input/i8042prt/i8042prt.rbuild index 5542ab5d0e2..d7b76bb1c82 100644 --- a/drivers/input/i8042prt/i8042prt.rbuild +++ b/drivers/input/i8042prt/i8042prt.rbuild @@ -15,4 +15,5 @@ registry.c setup.c i8042prt.rc + i8042prt.h diff --git a/drivers/input/i8042prt/pnp.c b/drivers/input/i8042prt/pnp.c index ef0d6a7f747..62f7175898e 100644 --- a/drivers/input/i8042prt/pnp.c +++ b/drivers/input/i8042prt/pnp.c @@ -33,688 +33,695 @@ */ BOOLEAN i8042ChangeMode( - IN PPORT_DEVICE_EXTENSION DeviceExtension, - IN UCHAR FlagsToDisable, - IN UCHAR FlagsToEnable) + IN PPORT_DEVICE_EXTENSION DeviceExtension, + IN UCHAR FlagsToDisable, + IN UCHAR FlagsToEnable) { - UCHAR Value; - NTSTATUS Status; + UCHAR Value; + NTSTATUS Status; - if (!i8042Write(DeviceExtension, DeviceExtension->ControlPort, KBD_READ_MODE)) - { - WARN_(I8042PRT, "Can't read i8042 mode\n"); - return FALSE; - } + if (!i8042Write(DeviceExtension, DeviceExtension->ControlPort, KBD_READ_MODE)) + { + WARN_(I8042PRT, "Can't read i8042 mode\n"); + return FALSE; + } - Status = i8042ReadDataWait(DeviceExtension, &Value); - if (!NT_SUCCESS(Status)) - { - WARN_(I8042PRT, "No response after read i8042 mode\n"); - return FALSE; - } + Status = i8042ReadDataWait(DeviceExtension, &Value); + if (!NT_SUCCESS(Status)) + { + WARN_(I8042PRT, "No response after read i8042 mode\n"); + return FALSE; + } - Value &= ~FlagsToDisable; - Value |= FlagsToEnable; + Value &= ~FlagsToDisable; + Value |= FlagsToEnable; - if (!i8042Write(DeviceExtension, DeviceExtension->ControlPort, KBD_WRITE_MODE)) - { - WARN_(I8042PRT, "Can't set i8042 mode\n"); - return FALSE; - } + if (!i8042Write(DeviceExtension, DeviceExtension->ControlPort, KBD_WRITE_MODE)) + { + WARN_(I8042PRT, "Can't set i8042 mode\n"); + return FALSE; + } - if (!i8042Write(DeviceExtension, DeviceExtension->DataPort, Value)) - { - WARN_(I8042PRT, "Can't send i8042 mode\n"); - return FALSE; - } + if (!i8042Write(DeviceExtension, DeviceExtension->DataPort, Value)) + { + WARN_(I8042PRT, "Can't send i8042 mode\n"); + return FALSE; + } - return TRUE; + return TRUE; } static NTSTATUS i8042BasicDetect( - IN PPORT_DEVICE_EXTENSION DeviceExtension) + IN PPORT_DEVICE_EXTENSION DeviceExtension) { - NTSTATUS Status; - ULONG ResendIterations; - UCHAR Value = 0; + NTSTATUS Status; + ULONG ResendIterations; + UCHAR Value = 0; - /* Don't enable keyboard and mouse interrupts, disable keyboard/mouse */ - i8042Flush(DeviceExtension); - if (!i8042ChangeMode(DeviceExtension, CCB_KBD_INT_ENAB | CCB_MOUSE_INT_ENAB, CCB_KBD_DISAB | CCB_MOUSE_DISAB)) - return STATUS_IO_DEVICE_ERROR; + /* Don't enable keyboard and mouse interrupts, disable keyboard/mouse */ + i8042Flush(DeviceExtension); + if (!i8042ChangeMode(DeviceExtension, CCB_KBD_INT_ENAB | CCB_MOUSE_INT_ENAB, CCB_KBD_DISAB | CCB_MOUSE_DISAB)) + return STATUS_IO_DEVICE_ERROR; - i8042Flush(DeviceExtension); + i8042Flush(DeviceExtension); - /* Issue a CTRL_SELF_TEST command to check if this is really an i8042 controller */ - ResendIterations = DeviceExtension->Settings.ResendIterations + 1; - while (ResendIterations--) - { - if (!i8042Write(DeviceExtension, DeviceExtension->ControlPort, CTRL_SELF_TEST)) - { - WARN_(I8042PRT, "Writing CTRL_SELF_TEST command failed\n"); - return STATUS_IO_TIMEOUT; - } + /* Issue a CTRL_SELF_TEST command to check if this is really an i8042 controller */ + ResendIterations = DeviceExtension->Settings.ResendIterations + 1; + while (ResendIterations--) + { + if (!i8042Write(DeviceExtension, DeviceExtension->ControlPort, CTRL_SELF_TEST)) + { + WARN_(I8042PRT, "Writing CTRL_SELF_TEST command failed\n"); + return STATUS_IO_TIMEOUT; + } - Status = i8042ReadDataWait(DeviceExtension, &Value); - if (!NT_SUCCESS(Status)) - { - WARN_(I8042PRT, "Failed to read CTRL_SELF_TEST response, status 0x%08lx\n", Status); - return Status; - } + Status = i8042ReadDataWait(DeviceExtension, &Value); + if (!NT_SUCCESS(Status)) + { + WARN_(I8042PRT, "Failed to read CTRL_SELF_TEST response, status 0x%08lx\n", Status); + return Status; + } - if (Value == KBD_SELF_TEST_OK) - { - INFO_(I8042PRT, "CTRL_SELF_TEST completed successfully!\n"); - break; - } - else if (Value == KBD_RESEND) - { - TRACE_(I8042PRT, "Resending...\n", Value); - KeStallExecutionProcessor(50); - } - else - { - WARN_(I8042PRT, "Got 0x%02x instead of 0x55\n", Value); - return STATUS_IO_DEVICE_ERROR; - } - } + if (Value == KBD_SELF_TEST_OK) + { + INFO_(I8042PRT, "CTRL_SELF_TEST completed successfully!\n"); + break; + } + else if (Value == KBD_RESEND) + { + TRACE_(I8042PRT, "Resending...\n", Value); + KeStallExecutionProcessor(50); + } + else + { + WARN_(I8042PRT, "Got 0x%02x instead of 0x55\n", Value); + return STATUS_IO_DEVICE_ERROR; + } + } - return STATUS_SUCCESS; + return STATUS_SUCCESS; } static VOID i8042DetectKeyboard( - IN PPORT_DEVICE_EXTENSION DeviceExtension) + IN PPORT_DEVICE_EXTENSION DeviceExtension) { - NTSTATUS Status; + NTSTATUS Status; - /* Set LEDs (that is not fatal if some error occurs) */ - Status = i8042SynchWritePort(DeviceExtension, 0, KBD_CMD_SET_LEDS, TRUE); - if (NT_SUCCESS(Status)) - { - Status = i8042SynchWritePort(DeviceExtension, 0, 0, TRUE); - if (!NT_SUCCESS(Status)) - { - WARN_(I8042PRT, "Can't finish SET_LEDS (0x%08lx)\n", Status); - return; - } - } - else - { - WARN_(I8042PRT, "Warning: can't write SET_LEDS (0x%08lx)\n", Status); - } + /* Set LEDs (that is not fatal if some error occurs) */ + Status = i8042SynchWritePort(DeviceExtension, 0, KBD_CMD_SET_LEDS, TRUE); + if (NT_SUCCESS(Status)) + { + Status = i8042SynchWritePort(DeviceExtension, 0, 0, TRUE); + if (!NT_SUCCESS(Status)) + { + WARN_(I8042PRT, "Can't finish SET_LEDS (0x%08lx)\n", Status); + return; + } + } + else + { + WARN_(I8042PRT, "Warning: can't write SET_LEDS (0x%08lx)\n", Status); + } - /* Turn on translation and SF (Some machines don't reboot if SF is not set, see ReactOS bug #1842) */ - if (!i8042ChangeMode(DeviceExtension, 0, CCB_TRANSLATE | CCB_SYSTEM_FLAG)) - return; + /* Turn on translation and SF (Some machines don't reboot if SF is not set, see ReactOS bug #1842) */ + if (!i8042ChangeMode(DeviceExtension, 0, CCB_TRANSLATE | CCB_SYSTEM_FLAG)) + return; - /* - * We used to send a KBD_LINE_TEST (0xAB) command, but on at least HP - * Pavilion notebooks the response to that command was incorrect. - * So now we just assume that a keyboard is attached. - */ - DeviceExtension->Flags |= KEYBOARD_PRESENT; + /* + * We used to send a KBD_LINE_TEST (0xAB) command, but on at least HP + * Pavilion notebooks the response to that command was incorrect. + * So now we just assume that a keyboard is attached. + */ + DeviceExtension->Flags |= KEYBOARD_PRESENT; - INFO_(I8042PRT, "Keyboard detected\n"); + INFO_(I8042PRT, "Keyboard detected\n"); } static VOID i8042DetectMouse( - IN PPORT_DEVICE_EXTENSION DeviceExtension) + IN PPORT_DEVICE_EXTENSION DeviceExtension) { - NTSTATUS Status; - UCHAR Value; - UCHAR ExpectedReply[] = { MOUSE_ACK, 0xAA }; - UCHAR ReplyByte; + NTSTATUS Status; + UCHAR Value; + UCHAR ExpectedReply[] = { MOUSE_ACK, 0xAA }; + UCHAR ReplyByte; - /* First do a mouse line test */ - if (i8042Write(DeviceExtension, DeviceExtension->ControlPort, MOUSE_LINE_TEST)) - { - Status = i8042ReadDataWait(DeviceExtension, &Value); + /* First do a mouse line test */ + if (i8042Write(DeviceExtension, DeviceExtension->ControlPort, MOUSE_LINE_TEST)) + { + Status = i8042ReadDataWait(DeviceExtension, &Value); - if (!NT_SUCCESS(Status) || Value != 0) - { - WARN_(I8042PRT, "Mouse line test failed\n"); - goto failure; - } - } + if (!NT_SUCCESS(Status) || Value != 0) + { + WARN_(I8042PRT, "Mouse line test failed\n"); + goto failure; + } + } - /* Now reset the mouse */ - i8042Flush(DeviceExtension); + /* Now reset the mouse */ + i8042Flush(DeviceExtension); - if(!i8042IsrWritePort(DeviceExtension, MOU_CMD_RESET, CTRL_WRITE_MOUSE)) - { - WARN_(I8042PRT, "Failed to write reset command to mouse\n"); - goto failure; - } + if(!i8042IsrWritePort(DeviceExtension, MOU_CMD_RESET, CTRL_WRITE_MOUSE)) + { + WARN_(I8042PRT, "Failed to write reset command to mouse\n"); + goto failure; + } - /* The implementation of the "Mouse Reset" command differs much from chip to chip. + /* The implementation of the "Mouse Reset" command differs much from chip to chip. - By default, the first byte is an ACK, when the mouse is plugged in and working and NACK when it's not. - On success, the next bytes are 0xAA and 0x00. + By default, the first byte is an ACK, when the mouse is plugged in and working and NACK when it's not. + On success, the next bytes are 0xAA and 0x00. - But on some systems (like ECS K7S5A Pro, SiS 735 chipset), we always get an ACK and 0xAA. - Only the last byte indicates, whether a mouse is plugged in. - It is either sent or not, so there is no byte, which indicates a failure here. + But on some systems (like ECS K7S5A Pro, SiS 735 chipset), we always get an ACK and 0xAA. + Only the last byte indicates, whether a mouse is plugged in. + It is either sent or not, so there is no byte, which indicates a failure here. - After the Mouse Reset command was issued, it usually takes some time until we get a response. - So get the first two bytes in a loop. */ - for (ReplyByte = 0; - ReplyByte < sizeof(ExpectedReply) / sizeof(ExpectedReply[0]); - ReplyByte++) - { - ULONG Counter = 500; + After the Mouse Reset command was issued, it usually takes some time until we get a response. + So get the first two bytes in a loop. */ + for (ReplyByte = 0; + ReplyByte < sizeof(ExpectedReply) / sizeof(ExpectedReply[0]); + ReplyByte++) + { + ULONG Counter = 500; - do - { - Status = i8042ReadDataWait(DeviceExtension, &Value); + do + { + Status = i8042ReadDataWait(DeviceExtension, &Value); - if(!NT_SUCCESS(Status)) - { - /* Wait some time before trying again */ - KeStallExecutionProcessor(50); - } - } while (Status == STATUS_IO_TIMEOUT && Counter--); + if(!NT_SUCCESS(Status)) + { + /* Wait some time before trying again */ + KeStallExecutionProcessor(50); + } + } while (Status == STATUS_IO_TIMEOUT && Counter--); - if (!NT_SUCCESS(Status)) - { - WARN_(I8042PRT, "No ACK after mouse reset, status 0x%08lx\n", Status); - goto failure; - } - else if (Value != ExpectedReply[ReplyByte]) - { - WARN_(I8042PRT, "Unexpected reply: 0x%02x (expected 0x%02x)\n", Value, ExpectedReply[ReplyByte]); - goto failure; - } - } + if (!NT_SUCCESS(Status)) + { + WARN_(I8042PRT, "No ACK after mouse reset, status 0x%08lx\n", Status); + goto failure; + } + else if (Value != ExpectedReply[ReplyByte]) + { + WARN_(I8042PRT, "Unexpected reply: 0x%02x (expected 0x%02x)\n", Value, ExpectedReply[ReplyByte]); + goto failure; + } + } - /* Finally get the third byte, but only try it one time (see above). - Otherwise this takes around 45 seconds on a K7S5A Pro, when no mouse is plugged in. */ - Status = i8042ReadDataWait(DeviceExtension, &Value); + /* Finally get the third byte, but only try it one time (see above). + Otherwise this takes around 45 seconds on a K7S5A Pro, when no mouse is plugged in. */ + Status = i8042ReadDataWait(DeviceExtension, &Value); - if(!NT_SUCCESS(Status)) - { - WARN_(I8042PRT, "Last byte was not transmitted after mouse reset, status 0x%08lx\n", Status); - goto failure; - } - else if(Value != 0x00) - { - WARN_(I8042PRT, "Last byte after mouse reset was not 0x00, but 0x%02x\n", Value); - goto failure; - } + if(!NT_SUCCESS(Status)) + { + WARN_(I8042PRT, "Last byte was not transmitted after mouse reset, status 0x%08lx\n", Status); + goto failure; + } + else if(Value != 0x00) + { + WARN_(I8042PRT, "Last byte after mouse reset was not 0x00, but 0x%02x\n", Value); + goto failure; + } - DeviceExtension->Flags |= MOUSE_PRESENT; - INFO_(I8042PRT, "Mouse detected\n"); - return; + DeviceExtension->Flags |= MOUSE_PRESENT; + INFO_(I8042PRT, "Mouse detected\n"); + return; failure: - /* There is probably no mouse present. On some systems, - the probe locks the entire keyboard controller. Let's - try to get access to the keyboard again by sending a - reset */ - i8042Flush(DeviceExtension); - i8042Write(DeviceExtension, DeviceExtension->ControlPort, CTRL_SELF_TEST); - i8042ReadDataWait(DeviceExtension, &Value); - i8042Flush(DeviceExtension); + /* There is probably no mouse present. On some systems, + the probe locks the entire keyboard controller. Let's + try to get access to the keyboard again by sending a + reset */ + i8042Flush(DeviceExtension); + i8042Write(DeviceExtension, DeviceExtension->ControlPort, CTRL_SELF_TEST); + i8042ReadDataWait(DeviceExtension, &Value); + i8042Flush(DeviceExtension); - INFO_(I8042PRT, "Mouse not detected\n"); + INFO_(I8042PRT, "Mouse not detected\n"); } static NTSTATUS i8042ConnectKeyboardInterrupt( - IN PI8042_KEYBOARD_EXTENSION DeviceExtension) + IN PI8042_KEYBOARD_EXTENSION DeviceExtension) { - PPORT_DEVICE_EXTENSION PortDeviceExtension; - KIRQL DirqlMax; - NTSTATUS Status; + PPORT_DEVICE_EXTENSION PortDeviceExtension; + KIRQL DirqlMax; + NTSTATUS Status; - TRACE_(I8042PRT, "i8042ConnectKeyboardInterrupt()\n"); + TRACE_(I8042PRT, "i8042ConnectKeyboardInterrupt()\n"); - PortDeviceExtension = DeviceExtension->Common.PortDeviceExtension; - DirqlMax = MAX( - PortDeviceExtension->KeyboardInterrupt.Dirql, - PortDeviceExtension->MouseInterrupt.Dirql); + PortDeviceExtension = DeviceExtension->Common.PortDeviceExtension; + DirqlMax = MAX( + PortDeviceExtension->KeyboardInterrupt.Dirql, + PortDeviceExtension->MouseInterrupt.Dirql); - INFO_(I8042PRT, "KeyboardInterrupt.Vector %lu\n", - PortDeviceExtension->KeyboardInterrupt.Vector); - INFO_(I8042PRT, "KeyboardInterrupt.Dirql %lu\n", - PortDeviceExtension->KeyboardInterrupt.Dirql); - INFO_(I8042PRT, "KeyboardInterrupt.DirqlMax %lu\n", - DirqlMax); - INFO_(I8042PRT, "KeyboardInterrupt.InterruptMode %s\n", - PortDeviceExtension->KeyboardInterrupt.InterruptMode == LevelSensitive ? "LevelSensitive" : "Latched"); - INFO_(I8042PRT, "KeyboardInterrupt.ShareInterrupt %s\n", - PortDeviceExtension->KeyboardInterrupt.ShareInterrupt ? "yes" : "no"); - INFO_(I8042PRT, "KeyboardInterrupt.Affinity 0x%lx\n", - PortDeviceExtension->KeyboardInterrupt.Affinity); - Status = IoConnectInterrupt( - &PortDeviceExtension->KeyboardInterrupt.Object, - i8042KbdInterruptService, - DeviceExtension, &PortDeviceExtension->SpinLock, - PortDeviceExtension->KeyboardInterrupt.Vector, PortDeviceExtension->KeyboardInterrupt.Dirql, DirqlMax, - PortDeviceExtension->KeyboardInterrupt.InterruptMode, PortDeviceExtension->KeyboardInterrupt.ShareInterrupt, - PortDeviceExtension->KeyboardInterrupt.Affinity, FALSE); - if (!NT_SUCCESS(Status)) - { - WARN_(I8042PRT, "IoConnectInterrupt() failed with status 0x%08x\n", Status); - return Status; - } + INFO_(I8042PRT, "KeyboardInterrupt.Vector %lu\n", + PortDeviceExtension->KeyboardInterrupt.Vector); + INFO_(I8042PRT, "KeyboardInterrupt.Dirql %lu\n", + PortDeviceExtension->KeyboardInterrupt.Dirql); + INFO_(I8042PRT, "KeyboardInterrupt.DirqlMax %lu\n", + DirqlMax); + INFO_(I8042PRT, "KeyboardInterrupt.InterruptMode %s\n", + PortDeviceExtension->KeyboardInterrupt.InterruptMode == LevelSensitive ? "LevelSensitive" : "Latched"); + INFO_(I8042PRT, "KeyboardInterrupt.ShareInterrupt %s\n", + PortDeviceExtension->KeyboardInterrupt.ShareInterrupt ? "yes" : "no"); + INFO_(I8042PRT, "KeyboardInterrupt.Affinity 0x%lx\n", + PortDeviceExtension->KeyboardInterrupt.Affinity); + Status = IoConnectInterrupt( + &PortDeviceExtension->KeyboardInterrupt.Object, + i8042KbdInterruptService, + DeviceExtension, &PortDeviceExtension->SpinLock, + PortDeviceExtension->KeyboardInterrupt.Vector, PortDeviceExtension->KeyboardInterrupt.Dirql, DirqlMax, + PortDeviceExtension->KeyboardInterrupt.InterruptMode, PortDeviceExtension->KeyboardInterrupt.ShareInterrupt, + PortDeviceExtension->KeyboardInterrupt.Affinity, FALSE); + if (!NT_SUCCESS(Status)) + { + WARN_(I8042PRT, "IoConnectInterrupt() failed with status 0x%08x\n", Status); + return Status; + } - if (DirqlMax == PortDeviceExtension->KeyboardInterrupt.Dirql) - PortDeviceExtension->HighestDIRQLInterrupt = PortDeviceExtension->KeyboardInterrupt.Object; - PortDeviceExtension->Flags |= KEYBOARD_INITIALIZED; - return STATUS_SUCCESS; + if (DirqlMax == PortDeviceExtension->KeyboardInterrupt.Dirql) + PortDeviceExtension->HighestDIRQLInterrupt = PortDeviceExtension->KeyboardInterrupt.Object; + PortDeviceExtension->Flags |= KEYBOARD_INITIALIZED; + return STATUS_SUCCESS; } static NTSTATUS i8042ConnectMouseInterrupt( - IN PI8042_MOUSE_EXTENSION DeviceExtension) + IN PI8042_MOUSE_EXTENSION DeviceExtension) { - PPORT_DEVICE_EXTENSION PortDeviceExtension; - KIRQL DirqlMax; - NTSTATUS Status; + PPORT_DEVICE_EXTENSION PortDeviceExtension; + KIRQL DirqlMax; + NTSTATUS Status; - TRACE_(I8042PRT, "i8042ConnectMouseInterrupt()\n"); + TRACE_(I8042PRT, "i8042ConnectMouseInterrupt()\n"); - Status = i8042MouInitialize(DeviceExtension); - if (!NT_SUCCESS(Status)) - return Status; + Status = i8042MouInitialize(DeviceExtension); + if (!NT_SUCCESS(Status)) + return Status; - PortDeviceExtension = DeviceExtension->Common.PortDeviceExtension; - DirqlMax = MAX( - PortDeviceExtension->KeyboardInterrupt.Dirql, - PortDeviceExtension->MouseInterrupt.Dirql); + PortDeviceExtension = DeviceExtension->Common.PortDeviceExtension; + DirqlMax = MAX( + PortDeviceExtension->KeyboardInterrupt.Dirql, + PortDeviceExtension->MouseInterrupt.Dirql); - INFO_(I8042PRT, "MouseInterrupt.Vector %lu\n", - PortDeviceExtension->MouseInterrupt.Vector); - INFO_(I8042PRT, "MouseInterrupt.Dirql %lu\n", - PortDeviceExtension->MouseInterrupt.Dirql); - INFO_(I8042PRT, "MouseInterrupt.DirqlMax %lu\n", - DirqlMax); - INFO_(I8042PRT, "MouseInterrupt.InterruptMode %s\n", - PortDeviceExtension->MouseInterrupt.InterruptMode == LevelSensitive ? "LevelSensitive" : "Latched"); - INFO_(I8042PRT, "MouseInterrupt.ShareInterrupt %s\n", - PortDeviceExtension->MouseInterrupt.ShareInterrupt ? "yes" : "no"); - INFO_(I8042PRT, "MouseInterrupt.Affinity 0x%lx\n", - PortDeviceExtension->MouseInterrupt.Affinity); - Status = IoConnectInterrupt( - &PortDeviceExtension->MouseInterrupt.Object, - i8042MouInterruptService, - DeviceExtension, &PortDeviceExtension->SpinLock, - PortDeviceExtension->MouseInterrupt.Vector, PortDeviceExtension->MouseInterrupt.Dirql, DirqlMax, - PortDeviceExtension->MouseInterrupt.InterruptMode, PortDeviceExtension->MouseInterrupt.ShareInterrupt, - PortDeviceExtension->MouseInterrupt.Affinity, FALSE); - if (!NT_SUCCESS(Status)) - { - WARN_(I8042PRT, "IoConnectInterrupt() failed with status 0x%08x\n", Status); - goto cleanup; - } + INFO_(I8042PRT, "MouseInterrupt.Vector %lu\n", + PortDeviceExtension->MouseInterrupt.Vector); + INFO_(I8042PRT, "MouseInterrupt.Dirql %lu\n", + PortDeviceExtension->MouseInterrupt.Dirql); + INFO_(I8042PRT, "MouseInterrupt.DirqlMax %lu\n", + DirqlMax); + INFO_(I8042PRT, "MouseInterrupt.InterruptMode %s\n", + PortDeviceExtension->MouseInterrupt.InterruptMode == LevelSensitive ? "LevelSensitive" : "Latched"); + INFO_(I8042PRT, "MouseInterrupt.ShareInterrupt %s\n", + PortDeviceExtension->MouseInterrupt.ShareInterrupt ? "yes" : "no"); + INFO_(I8042PRT, "MouseInterrupt.Affinity 0x%lx\n", + PortDeviceExtension->MouseInterrupt.Affinity); + Status = IoConnectInterrupt( + &PortDeviceExtension->MouseInterrupt.Object, + i8042MouInterruptService, + DeviceExtension, &PortDeviceExtension->SpinLock, + PortDeviceExtension->MouseInterrupt.Vector, PortDeviceExtension->MouseInterrupt.Dirql, DirqlMax, + PortDeviceExtension->MouseInterrupt.InterruptMode, PortDeviceExtension->MouseInterrupt.ShareInterrupt, + PortDeviceExtension->MouseInterrupt.Affinity, FALSE); + if (!NT_SUCCESS(Status)) + { + WARN_(I8042PRT, "IoConnectInterrupt() failed with status 0x%08x\n", Status); + goto cleanup; + } - if (DirqlMax == PortDeviceExtension->MouseInterrupt.Dirql) - PortDeviceExtension->HighestDIRQLInterrupt = PortDeviceExtension->MouseInterrupt.Object; + if (DirqlMax == PortDeviceExtension->MouseInterrupt.Dirql) + PortDeviceExtension->HighestDIRQLInterrupt = PortDeviceExtension->MouseInterrupt.Object; - PortDeviceExtension->Flags |= MOUSE_INITIALIZED; - Status = STATUS_SUCCESS; + PortDeviceExtension->Flags |= MOUSE_INITIALIZED; + Status = STATUS_SUCCESS; cleanup: - if (!NT_SUCCESS(Status)) - { - PortDeviceExtension->Flags &= ~MOUSE_INITIALIZED; - if (PortDeviceExtension->MouseInterrupt.Object) - { - IoDisconnectInterrupt(PortDeviceExtension->MouseInterrupt.Object); - PortDeviceExtension->HighestDIRQLInterrupt = PortDeviceExtension->KeyboardInterrupt.Object; - } - } - return Status; + if (!NT_SUCCESS(Status)) + { + PortDeviceExtension->Flags &= ~MOUSE_INITIALIZED; + if (PortDeviceExtension->MouseInterrupt.Object) + { + IoDisconnectInterrupt(PortDeviceExtension->MouseInterrupt.Object); + PortDeviceExtension->HighestDIRQLInterrupt = PortDeviceExtension->KeyboardInterrupt.Object; + } + } + return Status; } static NTSTATUS EnableInterrupts( - IN PPORT_DEVICE_EXTENSION DeviceExtension, - IN UCHAR FlagsToDisable, - IN UCHAR FlagsToEnable) + IN PPORT_DEVICE_EXTENSION DeviceExtension, + IN UCHAR FlagsToDisable, + IN UCHAR FlagsToEnable) { - i8042Flush(DeviceExtension); + i8042Flush(DeviceExtension); - if (!i8042ChangeMode(DeviceExtension, FlagsToDisable, FlagsToEnable)) - return STATUS_UNSUCCESSFUL; + if (!i8042ChangeMode(DeviceExtension, FlagsToDisable, FlagsToEnable)) + return STATUS_UNSUCCESSFUL; - /* Reset the mouse (if any) to start the detection */ - if (DeviceExtension->Flags & MOUSE_PRESENT) - { - KIRQL Irql; + /* Reset the mouse (if any) to start the detection */ + if (DeviceExtension->Flags & MOUSE_PRESENT) + { + KIRQL Irql; - Irql = KeAcquireInterruptSpinLock(DeviceExtension->HighestDIRQLInterrupt); - i8042IsrWritePort(DeviceExtension, MOU_CMD_RESET, CTRL_WRITE_MOUSE); - KeReleaseInterruptSpinLock(DeviceExtension->HighestDIRQLInterrupt, Irql); - } + Irql = KeAcquireInterruptSpinLock(DeviceExtension->HighestDIRQLInterrupt); + i8042IsrWritePort(DeviceExtension, MOU_CMD_RESET, CTRL_WRITE_MOUSE); + KeReleaseInterruptSpinLock(DeviceExtension->HighestDIRQLInterrupt, Irql); + } - return STATUS_SUCCESS; + return STATUS_SUCCESS; } static NTSTATUS StartProcedure( - IN PPORT_DEVICE_EXTENSION DeviceExtension) + IN PPORT_DEVICE_EXTENSION DeviceExtension) { - NTSTATUS Status; - UCHAR FlagsToDisable = 0; - UCHAR FlagsToEnable = 0; + NTSTATUS Status; + UCHAR FlagsToDisable = 0; + UCHAR FlagsToEnable = 0; - if (DeviceExtension->DataPort == 0) - { - /* Unable to do something at the moment */ - return STATUS_SUCCESS; - } + if (DeviceExtension->DataPort == 0) + { + /* Unable to do something at the moment */ + return STATUS_SUCCESS; + } - if (!(DeviceExtension->Flags & (KEYBOARD_PRESENT | MOUSE_PRESENT))) - { - /* Try to detect them */ - TRACE_(I8042PRT, "Check if the controller is really a i8042\n"); - Status = i8042BasicDetect(DeviceExtension); - if (!NT_SUCCESS(Status)) - { - WARN_(I8042PRT, "i8042BasicDetect() failed with status 0x%08lx\n", Status); - return STATUS_UNSUCCESSFUL; - } + if (!(DeviceExtension->Flags & (KEYBOARD_PRESENT | MOUSE_PRESENT))) + { + /* Try to detect them */ + TRACE_(I8042PRT, "Check if the controller is really a i8042\n"); + Status = i8042BasicDetect(DeviceExtension); + if (!NT_SUCCESS(Status)) + { + WARN_(I8042PRT, "i8042BasicDetect() failed with status 0x%08lx\n", Status); + return STATUS_UNSUCCESSFUL; + } - /* First detect the mouse and then the keyboard! - If we do it the other way round, some systems throw away settings like the keyboard translation, when detecting the mouse. - - Don't detect the mouse if we're in 1st stage setup! */ - if(!IsFirstStageSetup()) - { - TRACE_(I8042PRT, "Detecting mouse\n"); - i8042DetectMouse(DeviceExtension); - } + /* First detect the mouse and then the keyboard! + If we do it the other way round, some systems throw away settings like the keyboard translation, when detecting the mouse. + + Don't detect the mouse if we're in 1st stage setup! */ + if(!IsFirstStageSetup()) + { + TRACE_(I8042PRT, "Detecting mouse\n"); + i8042DetectMouse(DeviceExtension); + } - TRACE_(I8042PRT, "Detecting keyboard\n"); - i8042DetectKeyboard(DeviceExtension); + TRACE_(I8042PRT, "Detecting keyboard\n"); + i8042DetectKeyboard(DeviceExtension); - INFO_(I8042PRT, "Keyboard present: %s\n", DeviceExtension->Flags & KEYBOARD_PRESENT ? "YES" : "NO"); - INFO_(I8042PRT, "Mouse present : %s\n", DeviceExtension->Flags & MOUSE_PRESENT ? "YES" : "NO"); - } + INFO_(I8042PRT, "Keyboard present: %s\n", DeviceExtension->Flags & KEYBOARD_PRESENT ? "YES" : "NO"); + INFO_(I8042PRT, "Mouse present : %s\n", DeviceExtension->Flags & MOUSE_PRESENT ? "YES" : "NO"); + } - /* Connect interrupts */ - if (DeviceExtension->Flags & KEYBOARD_PRESENT && - DeviceExtension->Flags & KEYBOARD_CONNECTED && - DeviceExtension->Flags & KEYBOARD_STARTED && - !(DeviceExtension->Flags & KEYBOARD_INITIALIZED)) - { - /* Keyboard is ready to be initialized */ - Status = i8042ConnectKeyboardInterrupt(DeviceExtension->KeyboardExtension); - if (NT_SUCCESS(Status)) - { - DeviceExtension->Flags |= KEYBOARD_INITIALIZED; - FlagsToDisable |= CCB_KBD_DISAB; - FlagsToEnable |= CCB_KBD_INT_ENAB; - } - } + /* Connect interrupts */ + if (DeviceExtension->Flags & KEYBOARD_PRESENT && + DeviceExtension->Flags & KEYBOARD_CONNECTED && + DeviceExtension->Flags & KEYBOARD_STARTED && + !(DeviceExtension->Flags & KEYBOARD_INITIALIZED)) + { + /* Keyboard is ready to be initialized */ + Status = i8042ConnectKeyboardInterrupt(DeviceExtension->KeyboardExtension); + if (NT_SUCCESS(Status)) + { + DeviceExtension->Flags |= KEYBOARD_INITIALIZED; + FlagsToDisable |= CCB_KBD_DISAB; + FlagsToEnable |= CCB_KBD_INT_ENAB; + } + } - if (DeviceExtension->Flags & MOUSE_PRESENT && - DeviceExtension->Flags & MOUSE_CONNECTED && - DeviceExtension->Flags & MOUSE_STARTED && - !(DeviceExtension->Flags & MOUSE_INITIALIZED)) - { - /* Mouse is ready to be initialized */ - Status = i8042ConnectMouseInterrupt(DeviceExtension->MouseExtension); - if (NT_SUCCESS(Status)) - { - DeviceExtension->Flags |= MOUSE_INITIALIZED; - FlagsToDisable |= CCB_MOUSE_DISAB; - FlagsToEnable |= CCB_MOUSE_INT_ENAB; - } - } + if (DeviceExtension->Flags & MOUSE_PRESENT && + DeviceExtension->Flags & MOUSE_CONNECTED && + DeviceExtension->Flags & MOUSE_STARTED && + !(DeviceExtension->Flags & MOUSE_INITIALIZED)) + { + /* Mouse is ready to be initialized */ + Status = i8042ConnectMouseInterrupt(DeviceExtension->MouseExtension); + if (NT_SUCCESS(Status)) + { + DeviceExtension->Flags |= MOUSE_INITIALIZED; + FlagsToDisable |= CCB_MOUSE_DISAB; + FlagsToEnable |= CCB_MOUSE_INT_ENAB; + } + } - if (FlagsToEnable) - Status = EnableInterrupts(DeviceExtension, FlagsToDisable, FlagsToEnable); - else - Status = STATUS_SUCCESS; + if (FlagsToEnable) + Status = EnableInterrupts(DeviceExtension, FlagsToDisable, FlagsToEnable); + else + Status = STATUS_SUCCESS; - return Status; + return Status; } static NTSTATUS i8042PnpStartDevice( - IN PDEVICE_OBJECT DeviceObject, - IN PCM_RESOURCE_LIST AllocatedResources, - IN PCM_RESOURCE_LIST AllocatedResourcesTranslated) + IN PDEVICE_OBJECT DeviceObject, + IN PCM_RESOURCE_LIST AllocatedResources, + IN PCM_RESOURCE_LIST AllocatedResourcesTranslated) { - PFDO_DEVICE_EXTENSION DeviceExtension; - PPORT_DEVICE_EXTENSION PortDeviceExtension; - PCM_PARTIAL_RESOURCE_DESCRIPTOR ResourceDescriptor, ResourceDescriptorTranslated; - INTERRUPT_DATA InterruptData; - BOOLEAN FoundDataPort = FALSE; - BOOLEAN FoundControlPort = FALSE; - BOOLEAN FoundIrq = FALSE; - ULONG i; - NTSTATUS Status; + PFDO_DEVICE_EXTENSION DeviceExtension; + PPORT_DEVICE_EXTENSION PortDeviceExtension; + PCM_PARTIAL_RESOURCE_DESCRIPTOR ResourceDescriptor, ResourceDescriptorTranslated; + INTERRUPT_DATA InterruptData; + BOOLEAN FoundDataPort = FALSE; + BOOLEAN FoundControlPort = FALSE; + BOOLEAN FoundIrq = FALSE; + ULONG i; + NTSTATUS Status; - TRACE_(I8042PRT, "i8042PnpStartDevice(%p)\n", DeviceObject); - DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension; - PortDeviceExtension = DeviceExtension->PortDeviceExtension; + TRACE_(I8042PRT, "i8042PnpStartDevice(%p)\n", DeviceObject); + DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension; + PortDeviceExtension = DeviceExtension->PortDeviceExtension; - ASSERT(DeviceExtension->PnpState == dsStopped); + ASSERT(DeviceExtension->PnpState == dsStopped); - if (!AllocatedResources) - { - WARN_(I8042PRT, "No allocated resources sent to driver\n"); - return STATUS_INSUFFICIENT_RESOURCES; - } - if (AllocatedResources->Count != 1) - { - WARN_(I8042PRT, "Wrong number of allocated resources sent to driver\n"); - return STATUS_INSUFFICIENT_RESOURCES; - } - if (AllocatedResources->List[0].PartialResourceList.Version != 1 - || AllocatedResources->List[0].PartialResourceList.Revision != 1 - || AllocatedResourcesTranslated->List[0].PartialResourceList.Version != 1 - || AllocatedResourcesTranslated->List[0].PartialResourceList.Revision != 1) - { - WARN_(I8042PRT, "Revision mismatch: %u.%u != 1.1 or %u.%u != 1.1\n", - AllocatedResources->List[0].PartialResourceList.Version, - AllocatedResources->List[0].PartialResourceList.Revision, - AllocatedResourcesTranslated->List[0].PartialResourceList.Version, - AllocatedResourcesTranslated->List[0].PartialResourceList.Revision); - return STATUS_REVISION_MISMATCH; - } + if (!AllocatedResources) + { + WARN_(I8042PRT, "No allocated resources sent to driver\n"); + return STATUS_INSUFFICIENT_RESOURCES; + } + if (AllocatedResources->Count != 1) + { + WARN_(I8042PRT, "Wrong number of allocated resources sent to driver\n"); + return STATUS_INSUFFICIENT_RESOURCES; + } + if (AllocatedResources->List[0].PartialResourceList.Version != 1 + || AllocatedResources->List[0].PartialResourceList.Revision != 1 + || AllocatedResourcesTranslated->List[0].PartialResourceList.Version != 1 + || AllocatedResourcesTranslated->List[0].PartialResourceList.Revision != 1) + { + WARN_(I8042PRT, "Revision mismatch: %u.%u != 1.1 or %u.%u != 1.1\n", + AllocatedResources->List[0].PartialResourceList.Version, + AllocatedResources->List[0].PartialResourceList.Revision, + AllocatedResourcesTranslated->List[0].PartialResourceList.Version, + AllocatedResourcesTranslated->List[0].PartialResourceList.Revision); + return STATUS_REVISION_MISMATCH; + } - /* Get Irq and optionally control port and data port */ - for (i = 0; i < AllocatedResources->List[0].PartialResourceList.Count; i++) - { - ResourceDescriptor = &AllocatedResources->List[0].PartialResourceList.PartialDescriptors[i]; - ResourceDescriptorTranslated = &AllocatedResourcesTranslated->List[0].PartialResourceList.PartialDescriptors[i]; - switch (ResourceDescriptor->Type) - { - case CmResourceTypePort: - { - if (ResourceDescriptor->u.Port.Length == 1) - { - /* We assume that the first ressource will - * be the control port and the second one - * will be the data port... - */ - if (!FoundDataPort) - { - PortDeviceExtension->DataPort = ULongToPtr(ResourceDescriptor->u.Port.Start.u.LowPart); - INFO_(I8042PRT, "Found data port: %p\n", PortDeviceExtension->DataPort); - FoundDataPort = TRUE; - } - else if (!FoundControlPort) - { - PortDeviceExtension->ControlPort = ULongToPtr(ResourceDescriptor->u.Port.Start.u.LowPart); - INFO_(I8042PRT, "Found control port: %p\n", PortDeviceExtension->ControlPort); - FoundControlPort = TRUE; - } - else - { - WARN_(I8042PRT, "Too much I/O ranges provided: 0x%lx\n", ResourceDescriptor->u.Port.Length); - return STATUS_INVALID_PARAMETER; - } - } - else - WARN_(I8042PRT, "Invalid I/O range length: 0x%lx\n", ResourceDescriptor->u.Port.Length); - break; - } - case CmResourceTypeInterrupt: - { - if (FoundIrq) - return STATUS_INVALID_PARAMETER; - InterruptData.Dirql = (KIRQL)ResourceDescriptorTranslated->u.Interrupt.Level; - InterruptData.Vector = ResourceDescriptorTranslated->u.Interrupt.Vector; - InterruptData.Affinity = ResourceDescriptorTranslated->u.Interrupt.Affinity; - if (ResourceDescriptorTranslated->Flags & CM_RESOURCE_INTERRUPT_LATCHED) - InterruptData.InterruptMode = Latched; - else - InterruptData.InterruptMode = LevelSensitive; - InterruptData.ShareInterrupt = (ResourceDescriptorTranslated->ShareDisposition == CmResourceShareShared); - INFO_(I8042PRT, "Found irq resource: %lu\n", ResourceDescriptor->u.Interrupt.Level); - FoundIrq = TRUE; - break; - } - default: - WARN_(I8042PRT, "Unknown resource descriptor type 0x%x\n", ResourceDescriptor->Type); - } - } + /* Get Irq and optionally control port and data port */ + for (i = 0; i < AllocatedResources->List[0].PartialResourceList.Count; i++) + { + ResourceDescriptor = &AllocatedResources->List[0].PartialResourceList.PartialDescriptors[i]; + ResourceDescriptorTranslated = &AllocatedResourcesTranslated->List[0].PartialResourceList.PartialDescriptors[i]; + switch (ResourceDescriptor->Type) + { + case CmResourceTypePort: + { + if (ResourceDescriptor->u.Port.Length == 1) + { + /* We assume that the first ressource will + * be the control port and the second one + * will be the data port... + */ + if (!FoundDataPort) + { + PortDeviceExtension->DataPort = ULongToPtr(ResourceDescriptor->u.Port.Start.u.LowPart); + INFO_(I8042PRT, "Found data port: %p\n", PortDeviceExtension->DataPort); + FoundDataPort = TRUE; + } + else if (!FoundControlPort) + { + PortDeviceExtension->ControlPort = ULongToPtr(ResourceDescriptor->u.Port.Start.u.LowPart); + INFO_(I8042PRT, "Found control port: %p\n", PortDeviceExtension->ControlPort); + FoundControlPort = TRUE; + } + else + { + WARN_(I8042PRT, "Too much I/O ranges provided: 0x%lx\n", ResourceDescriptor->u.Port.Length); + return STATUS_INVALID_PARAMETER; + } + } + else + WARN_(I8042PRT, "Invalid I/O range length: 0x%lx\n", ResourceDescriptor->u.Port.Length); + break; + } + case CmResourceTypeInterrupt: + { + if (FoundIrq) + return STATUS_INVALID_PARAMETER; + InterruptData.Dirql = (KIRQL)ResourceDescriptorTranslated->u.Interrupt.Level; + InterruptData.Vector = ResourceDescriptorTranslated->u.Interrupt.Vector; + InterruptData.Affinity = ResourceDescriptorTranslated->u.Interrupt.Affinity; + if (ResourceDescriptorTranslated->Flags & CM_RESOURCE_INTERRUPT_LATCHED) + InterruptData.InterruptMode = Latched; + else + InterruptData.InterruptMode = LevelSensitive; + InterruptData.ShareInterrupt = (ResourceDescriptorTranslated->ShareDisposition == CmResourceShareShared); + INFO_(I8042PRT, "Found irq resource: %lu\n", ResourceDescriptor->u.Interrupt.Level); + FoundIrq = TRUE; + break; + } + default: + WARN_(I8042PRT, "Unknown resource descriptor type 0x%x\n", ResourceDescriptor->Type); + } + } - if (!FoundIrq) - { - WARN_(I8042PRT, "Interrupt resource was not found in allocated resources list\n"); - return STATUS_INSUFFICIENT_RESOURCES; - } - else if (DeviceExtension->Type == Keyboard && (!FoundDataPort || !FoundControlPort)) - { - WARN_(I8042PRT, "Some required resources were not found in allocated resources list\n"); - return STATUS_INSUFFICIENT_RESOURCES; - } - else if (DeviceExtension->Type == Mouse && (FoundDataPort || FoundControlPort)) - { - WARN_(I8042PRT, "Too much resources were provided in allocated resources list\n"); - return STATUS_INVALID_PARAMETER; - } + if (!FoundIrq) + { + WARN_(I8042PRT, "Interrupt resource was not found in allocated resources list\n"); + return STATUS_INSUFFICIENT_RESOURCES; + } + else if (DeviceExtension->Type == Keyboard && (!FoundDataPort || !FoundControlPort)) + { + WARN_(I8042PRT, "Some required resources were not found in allocated resources list\n"); + return STATUS_INSUFFICIENT_RESOURCES; + } + else if (DeviceExtension->Type == Mouse && (FoundDataPort || FoundControlPort)) + { + WARN_(I8042PRT, "Too much resources were provided in allocated resources list\n"); + return STATUS_INVALID_PARAMETER; + } - switch (DeviceExtension->Type) - { - case Keyboard: - { - RtlCopyMemory( - &PortDeviceExtension->KeyboardInterrupt, - &InterruptData, - sizeof(INTERRUPT_DATA)); - PortDeviceExtension->Flags |= KEYBOARD_STARTED; - Status = StartProcedure(PortDeviceExtension); - break; - } - case Mouse: - { - RtlCopyMemory( - &PortDeviceExtension->MouseInterrupt, - &InterruptData, - sizeof(INTERRUPT_DATA)); - PortDeviceExtension->Flags |= MOUSE_STARTED; - Status = StartProcedure(PortDeviceExtension); - break; - } - default: - { - WARN_(I8042PRT, "Unknown FDO type %u\n", DeviceExtension->Type); - ASSERT(!(PortDeviceExtension->Flags & KEYBOARD_CONNECTED) || !(PortDeviceExtension->Flags & MOUSE_CONNECTED)); - Status = STATUS_INVALID_DEVICE_REQUEST; - } - } + switch (DeviceExtension->Type) + { + case Keyboard: + { + RtlCopyMemory( + &PortDeviceExtension->KeyboardInterrupt, + &InterruptData, + sizeof(INTERRUPT_DATA)); + PortDeviceExtension->Flags |= KEYBOARD_STARTED; + Status = StartProcedure(PortDeviceExtension); + break; + } + case Mouse: + { + RtlCopyMemory( + &PortDeviceExtension->MouseInterrupt, + &InterruptData, + sizeof(INTERRUPT_DATA)); + PortDeviceExtension->Flags |= MOUSE_STARTED; + Status = StartProcedure(PortDeviceExtension); + break; + } + default: + { + WARN_(I8042PRT, "Unknown FDO type %u\n", DeviceExtension->Type); + ASSERT(!(PortDeviceExtension->Flags & KEYBOARD_CONNECTED) || !(PortDeviceExtension->Flags & MOUSE_CONNECTED)); + Status = STATUS_INVALID_DEVICE_REQUEST; + } + } - if (NT_SUCCESS(Status)) - DeviceExtension->PnpState = dsStarted; + if (NT_SUCCESS(Status)) + DeviceExtension->PnpState = dsStarted; - return Status; + return Status; } NTSTATUS NTAPI i8042Pnp( - IN PDEVICE_OBJECT DeviceObject, - IN PIRP Irp) + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp) { - PIO_STACK_LOCATION Stack; - ULONG MinorFunction; - I8042_DEVICE_TYPE DeviceType; - ULONG_PTR Information = 0; - NTSTATUS Status; + PIO_STACK_LOCATION Stack; + ULONG MinorFunction; + I8042_DEVICE_TYPE DeviceType; + ULONG_PTR Information = 0; + NTSTATUS Status; - Stack = IoGetCurrentIrpStackLocation(Irp); - MinorFunction = Stack->MinorFunction; - DeviceType = ((PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->Type; + Stack = IoGetCurrentIrpStackLocation(Irp); + MinorFunction = Stack->MinorFunction; + DeviceType = ((PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->Type; - switch (MinorFunction) - { - case IRP_MN_START_DEVICE: /* 0x00 */ - { - TRACE_(I8042PRT, "IRP_MJ_PNP / IRP_MN_START_DEVICE\n"); + switch (MinorFunction) + { + case IRP_MN_START_DEVICE: /* 0x00 */ + { + TRACE_(I8042PRT, "IRP_MJ_PNP / IRP_MN_START_DEVICE\n"); - /* Call lower driver (if any) */ - if (DeviceType != PhysicalDeviceObject) - { - Status = ForwardIrpAndWait(DeviceObject, Irp); - if (NT_SUCCESS(Status)) - Status = i8042PnpStartDevice( - DeviceObject, - Stack->Parameters.StartDevice.AllocatedResources, - Stack->Parameters.StartDevice.AllocatedResourcesTranslated); - } - else - Status = STATUS_SUCCESS; - break; - } - case IRP_MN_QUERY_DEVICE_RELATIONS: /* (optional) 0x07 */ - { - switch (Stack->Parameters.QueryDeviceRelations.Type) - { - case BusRelations: - { - PDEVICE_RELATIONS DeviceRelations; + /* Call lower driver (if any) */ + if (DeviceType != PhysicalDeviceObject) + { + Status = ForwardIrpAndWait(DeviceObject, Irp); + if (NT_SUCCESS(Status)) + Status = i8042PnpStartDevice( + DeviceObject, + Stack->Parameters.StartDevice.AllocatedResources, + Stack->Parameters.StartDevice.AllocatedResourcesTranslated); + } + else + Status = STATUS_SUCCESS; + break; + } + case IRP_MN_QUERY_DEVICE_RELATIONS: /* (optional) 0x07 */ + { + switch (Stack->Parameters.QueryDeviceRelations.Type) + { + case BusRelations: + { + PDEVICE_RELATIONS DeviceRelations; - TRACE_(I8042PRT, "IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / BusRelations\n"); - DeviceRelations = ExAllocatePool(PagedPool, sizeof(DEVICE_RELATIONS)); - if (DeviceRelations) - { - DeviceRelations->Count = 0; - Information = (ULONG_PTR)DeviceRelations; - Status = STATUS_SUCCESS; - } - else - Status = STATUS_INSUFFICIENT_RESOURCES; - break; - } - case RemovalRelations: - { - TRACE_(I8042PRT, "IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / RemovalRelations\n"); - return ForwardIrpAndForget(DeviceObject, Irp); - } - default: - ERR_(I8042PRT, "IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / Unknown type 0x%lx\n", - Stack->Parameters.QueryDeviceRelations.Type); - ASSERT(FALSE); - return ForwardIrpAndForget(DeviceObject, Irp); - } - break; - } - case IRP_MN_FILTER_RESOURCE_REQUIREMENTS: /* (optional) 0x0d */ - { - TRACE_(I8042PRT, "IRP_MJ_PNP / IRP_MN_FILTER_RESOURCE_REQUIREMENTS\n"); - /* Nothing to do */ - Status = Irp->IoStatus.Status; - break; - } - default: - { - ERR_(I8042PRT, "IRP_MJ_PNP / unknown minor function 0x%x\n", MinorFunction); - ASSERT(FALSE); - return ForwardIrpAndForget(DeviceObject, Irp); - } - } + TRACE_(I8042PRT, "IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / BusRelations\n"); + DeviceRelations = ExAllocatePool(PagedPool, sizeof(DEVICE_RELATIONS)); + if (DeviceRelations) + { + DeviceRelations->Count = 0; + Information = (ULONG_PTR)DeviceRelations; + Status = STATUS_SUCCESS; + } + else + Status = STATUS_INSUFFICIENT_RESOURCES; + break; + } + case RemovalRelations: + { + TRACE_(I8042PRT, "IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / RemovalRelations\n"); + return ForwardIrpAndForget(DeviceObject, Irp); + } + default: + ERR_(I8042PRT, "IRP_MJ_PNP / IRP_MN_QUERY_DEVICE_RELATIONS / Unknown type 0x%lx\n", + Stack->Parameters.QueryDeviceRelations.Type); + ASSERT(FALSE); + return ForwardIrpAndForget(DeviceObject, Irp); + } + break; + } + case IRP_MN_FILTER_RESOURCE_REQUIREMENTS: /* (optional) 0x0d */ + { + TRACE_(I8042PRT, "IRP_MJ_PNP / IRP_MN_FILTER_RESOURCE_REQUIREMENTS\n"); + /* Nothing to do */ + Status = Irp->IoStatus.Status; + break; + } + case IRP_MN_QUERY_PNP_DEVICE_STATE: /* 0x14 */ + { + TRACE_(I8042PRT, "IRP_MJ_PNP / IRP_MN_QUERY_PNP_DEVICE_STATE\n"); + /* Nothing much to tell */ + Information = 0; + Status = STATUS_SUCCESS; + break; + } + default: + { + ERR_(I8042PRT, "IRP_MJ_PNP / unknown minor function 0x%x\n", MinorFunction); + return ForwardIrpAndForget(DeviceObject, Irp); + } + } - Irp->IoStatus.Information = Information; - Irp->IoStatus.Status = Status; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - return Status; + Irp->IoStatus.Information = Information; + Irp->IoStatus.Status = Status; + IoCompleteRequest(Irp, IO_NO_INCREMENT); + return Status; } diff --git a/drivers/input/kbdclass/CMakeLists.txt b/drivers/input/kbdclass/CMakeLists.txt index e25e6307fa6..40ede5e00e4 100644 --- a/drivers/input/kbdclass/CMakeLists.txt +++ b/drivers/input/kbdclass/CMakeLists.txt @@ -6,9 +6,7 @@ add_library(kbdclass SHARED kbdclass.rc) set_module_type(kbdclass kernelmodedriver) - +add_pch(kbdclass kbdclass.h) target_link_libraries(kbdclass ${PSEH_LIB}) - add_importlibs(kbdclass ntoskrnl hal) - -add_cd_file(TARGET kbdclass DESTINATION reactos/system32/drivers NO_CAB FOR all) \ No newline at end of file +add_cd_file(TARGET kbdclass DESTINATION reactos/system32/drivers NO_CAB FOR all) diff --git a/drivers/input/kbdclass/kbdclass.rbuild b/drivers/input/kbdclass/kbdclass.rbuild index 639e4738044..ca3cd9573fc 100644 --- a/drivers/input/kbdclass/kbdclass.rbuild +++ b/drivers/input/kbdclass/kbdclass.rbuild @@ -9,4 +9,5 @@ misc.c setup.c kbdclass.rc + kbdclass.h diff --git a/drivers/input/mouclass/CMakeLists.txt b/drivers/input/mouclass/CMakeLists.txt index 13463ba849f..f5bf9656690 100644 --- a/drivers/input/mouclass/CMakeLists.txt +++ b/drivers/input/mouclass/CMakeLists.txt @@ -5,9 +5,7 @@ add_library(mouclass SHARED mouclass.rc) set_module_type(mouclass kernelmodedriver) - +add_pch(mouclass mouclass.h) target_link_libraries(mouclass ${PSEH_LIB}) - add_importlibs(mouclass ntoskrnl hal) - -add_cd_file(TARGET mouclass DESTINATION reactos/system32/drivers FOR all) \ No newline at end of file +add_cd_file(TARGET mouclass DESTINATION reactos/system32/drivers FOR all) diff --git a/drivers/input/mouclass/mouclass.rbuild b/drivers/input/mouclass/mouclass.rbuild index 1b75a0111cd..845ed9776b7 100644 --- a/drivers/input/mouclass/mouclass.rbuild +++ b/drivers/input/mouclass/mouclass.rbuild @@ -8,4 +8,5 @@ misc.c mouclass.c mouclass.rc + mouclass.h diff --git a/drivers/input/sermouse/CMakeLists.txt b/drivers/input/sermouse/CMakeLists.txt index 06a91c05f3d..42dfee9ff78 100644 --- a/drivers/input/sermouse/CMakeLists.txt +++ b/drivers/input/sermouse/CMakeLists.txt @@ -10,6 +10,6 @@ add_library(sermouse SHARED sermouse.rc) set_module_type(sermouse kernelmodedriver) +add_pch(sermouse sermouse.h) add_importlibs(sermouse ntoskrnl hal) - add_cd_file(TARGET sermouse DESTINATION reactos/system32/drivers FOR all) diff --git a/drivers/input/sermouse/sermouse.rbuild b/drivers/input/sermouse/sermouse.rbuild index e231da9c428..e09decb316e 100644 --- a/drivers/input/sermouse/sermouse.rbuild +++ b/drivers/input/sermouse/sermouse.rbuild @@ -11,4 +11,5 @@ readmouse.c sermouse.c sermouse.rc + sermouse.h diff --git a/drivers/ksfilter/ks/CMakeLists.txt b/drivers/ksfilter/ks/CMakeLists.txt index 712848b6b2f..85ba42829c1 100644 --- a/drivers/ksfilter/ks/CMakeLists.txt +++ b/drivers/ksfilter/ks/CMakeLists.txt @@ -31,6 +31,10 @@ list(APPEND SOURCE ks.rc ${CMAKE_CURRENT_BINARY_DIR}/ks.def) +if(MSVC) + list(APPEND SOURCE msvc.S) +endif() + add_library(ks SHARED ${SOURCE}) set_target_properties(ks PROPERTIES SUFFIX ".sys") @@ -40,9 +44,8 @@ set_subsystem(ks native) set_image_base(ks 0x00010000) target_link_libraries(ks ${PSEH_LIB}) - +add_pch(ks priv.h) add_importlibs(ks ntoskrnl hal) add_dependencies(ks psdk bugcodes) - add_cd_file(TARGET ks DESTINATION reactos/system32/drivers FOR all) add_importlib_target(ks.spec) diff --git a/drivers/ksfilter/ks/driver.c b/drivers/ksfilter/ks/driver.c index c0195a4a97f..c6ef2c99389 100644 --- a/drivers/ksfilter/ks/driver.c +++ b/drivers/ksfilter/ks/driver.c @@ -8,9 +8,6 @@ #include "priv.h" -#include "ksfunc.h" - - /* @implemented */ diff --git a/drivers/ksfilter/ks/ks.rbuild b/drivers/ksfilter/ks/ks.rbuild index ffa517843bf..648b67386f2 100644 --- a/drivers/ksfilter/ks/ks.rbuild +++ b/drivers/ksfilter/ks/ks.rbuild @@ -33,4 +33,5 @@ worker.c kcom.c swenum.c + priv.h diff --git a/drivers/ksfilter/ks/msvc.S b/drivers/ksfilter/ks/msvc.S new file mode 100644 index 00000000000..449dcf7f3ab --- /dev/null +++ b/drivers/ksfilter/ks/msvc.S @@ -0,0 +1,26 @@ + +#include + +.code + +MACRO(DEFINE_ALIAS, alias, orig) +EXTERN &orig:PROC +ALIAS <&alias> = <&orig> +ENDM + +PUBLIC ?NonDelegatedRelease@CBaseUnknown@@UAGKXZ +?NonDelegatedRelease@CBaseUnknown@@UAGKXZ: + jmp _IIndirectedUnknown_fnRelease@4 + + +DEFINE_ALIAS ??0CBaseUnknown@@QAE@ABU_GUID@@PAUIUnknown@@@Z, @CBaseUnknown_ConstructorWithGUID@16 +DEFINE_ALIAS ??0CBaseUnknown@@QAE@PAUIUnknown@@@Z, @CBaseUnknown_Constructor@12 +DEFINE_ALIAS ??1CBaseUnknown@@UAE@XZ, @CBaseUnknown_DefaultDestructor@8 +DEFINE_ALIAS ??_FCBaseUnknown@@QAEXXZ, @CBaseUnknown_Destructor@12 +DEFINE_ALIAS ?IndirectedAddRef@CBaseUnknown@@UAGKXZ, _IIndirectedUnknown_fnAddRef@4 +DEFINE_ALIAS ?IndirectedQueryInterface@CBaseUnknown@@UAGJABU_GUID@@PAPAX@Z, _IIndirectedUnknown_fnQueryInterface@12 +DEFINE_ALIAS ?IndirectedRelease@CBaseUnknown@@UAGKXZ, _IIndirectedUnknown_fnRelease@4 +DEFINE_ALIAS ?NonDelegatedAddRef@CBaseUnknown@@UAGKXZ, _INonDelegatedUnknown_fnAddRef@4 +DEFINE_ALIAS ?NonDelegatedQueryInterface@CBaseUnknown@@UAGJABU_GUID@@PAPAX@Z, _INonDelegatedUnknown_fnQueryInterface@12 + +END diff --git a/drivers/ksfilter/ks/priv.h b/drivers/ksfilter/ks/priv.h index 8eb1959c288..eec30e2a38b 100644 --- a/drivers/ksfilter/ks/priv.h +++ b/drivers/ksfilter/ks/priv.h @@ -1,27 +1,22 @@ -#pragma once - #define _KSDDK_ +#include + #include -#include #define NDEBUG //#define YDEBUG #include #include -#include #include #include -#include + +#include +#include #include "ksfunc.h" -#include "kstypes.h" -#include "ksiface.h" - -#include "ksmedia.h" #include "bdamedia.h" #include - #define TAG_DEVICE_HEADER 'KSDH' #define REG_PINFLAG_B_MANY 0x4 /* strmif.h */ #define MERIT_DO_NOT_USE 0x200000 /* dshow.h */ @@ -51,7 +46,6 @@ DEFINE_KSPROPERTY_TABLE(PinSet) {\ DEFINE_KSPROPERTY_ITEM_CONNECTION_ALLOCATORFRAMING_EX(PropAllocatorFraming)\ } - #define DEFINE_KSPROPERTY_STREAMSET(PinSet,\ PropStreamAllocator, PropMasterClock, PropPipeId)\ DEFINE_KSPROPERTY_TABLE(PinSet) {\ @@ -59,7 +53,3 @@ DEFINE_KSPROPERTY_TABLE(PinSet) {\ DEFINE_KSPROPERTY_ITEM_STREAM_MASTERCLOCK(PropMasterClock, PropMasterClock),\ DEFINE_KSPROPERTY_ITEM_STREAM_PIPE_ID(PropPipeId, PropPipeId)\ } - - - - diff --git a/drivers/network/afd/CMakeLists.txt b/drivers/network/afd/CMakeLists.txt index 22ef729c619..f28c2663924 100644 --- a/drivers/network/afd/CMakeLists.txt +++ b/drivers/network/afd/CMakeLists.txt @@ -18,12 +18,10 @@ list(APPEND SOURCE afd/write.c afd.rc) -add_library(afd SHARED ${CMAKE_CURRENT_BINARY_DIR}/afd_afd.h.gch ${SOURCE}) +add_library(afd SHARED ${SOURCE}) target_link_libraries(afd ${PSEH_LIB}) set_module_type(afd kernelmodedriver) add_importlibs(afd ntoskrnl hal) - -add_pch(afd ${CMAKE_CURRENT_SOURCE_DIR}/include/afd.h ${SOURCE}) - +add_pch(afd include/afd.h) add_cd_file(TARGET afd DESTINATION reactos/system32/drivers FOR all) diff --git a/drivers/network/afd/afd.rbuild b/drivers/network/afd/afd.rbuild index 6e56ce23b07..f8f4585968b 100644 --- a/drivers/network/afd/afd.rbuild +++ b/drivers/network/afd/afd.rbuild @@ -8,7 +8,7 @@ ntoskrnl hal - afd.h + afd.h bind.c diff --git a/drivers/network/afd/afd/bind.c b/drivers/network/afd/afd/bind.c index 8144d035030..20a0e1137a1 100644 --- a/drivers/network/afd/afd/bind.c +++ b/drivers/network/afd/afd/bind.c @@ -9,9 +9,6 @@ */ #include "afd.h" -#include "tdi_proto.h" -#include "tdiconn.h" -#include "debug.h" NTSTATUS WarmSocketForBind( PAFD_FCB FCB ) { NTSTATUS Status; @@ -20,11 +17,11 @@ NTSTATUS WarmSocketForBind( PAFD_FCB FCB ) { FCB->LocalAddress->Address[0].AddressType)); if( !FCB->TdiDeviceName.Length || !FCB->TdiDeviceName.Buffer ) { - AFD_DbgPrint(MID_TRACE,("Null Device\n")); + AFD_DbgPrint(MIN_TRACE,("Null Device\n")); return STATUS_NO_SUCH_DEVICE; } if( !FCB->LocalAddress ) { - AFD_DbgPrint(MID_TRACE,("No local address\n")); + AFD_DbgPrint(MIN_TRACE,("No local address\n")); return STATUS_INVALID_PARAMETER; } @@ -37,14 +34,34 @@ NTSTATUS WarmSocketForBind( PAFD_FCB FCB ) { if (FCB->Flags & AFD_ENDPOINT_CONNECTIONLESS) { - Status = TdiQueryMaxDatagramLength(FCB->AddressFile.Object, - &FCB->Recv.Size); - if (NT_SUCCESS(Status)) + if (!FCB->Recv.Size) + { + Status = TdiQueryMaxDatagramLength(FCB->AddressFile.Object, + &FCB->Recv.Size); + } + + if (NT_SUCCESS(Status) && !FCB->Recv.Window) { FCB->Recv.Window = ExAllocatePool(PagedPool, FCB->Recv.Size); if (!FCB->Recv.Window) Status = STATUS_NO_MEMORY; } + + if (NT_SUCCESS(Status)) + { + Status = TdiReceiveDatagram(&FCB->ReceiveIrp.InFlightRequest, + FCB->AddressFile.Object, + 0, + FCB->Recv.Window, + FCB->Recv.Size, + FCB->AddressFrom, + &FCB->ReceiveIrp.Iosb, + PacketSocketRecvComplete, + FCB); + + /* We don't want to wait for this read to complete. */ + if( Status == STATUS_PENDING ) Status = STATUS_SUCCESS; + } } AFD_DbgPrint(MID_TRACE,("Returning %x\n", Status)); @@ -78,27 +95,6 @@ AfdBindSocket(PDEVICE_OBJECT DeviceObject, PIRP Irp, Status = WarmSocketForBind( FCB ); AFD_DbgPrint(MID_TRACE,("FCB->Flags %x\n", FCB->Flags)); - if( !NT_SUCCESS(Status) ) - return UnlockAndMaybeComplete(FCB, Status, Irp, 0); - - if( FCB->Flags & AFD_ENDPOINT_CONNECTIONLESS ) { - AFD_DbgPrint(MID_TRACE,("Calling TdiReceiveDatagram\n")); - - Status = TdiReceiveDatagram - ( &FCB->ReceiveIrp.InFlightRequest, - FCB->AddressFile.Object, - 0, - FCB->Recv.Window, - FCB->Recv.Size, - FCB->AddressFrom, - &FCB->ReceiveIrp.Iosb, - PacketSocketRecvComplete, - FCB ); - - /* We don't want to wait for this read to complete. */ - if( Status == STATUS_PENDING ) Status = STATUS_SUCCESS; - } - if (NT_SUCCESS(Status)) FCB->State = SOCKET_STATE_BOUND; diff --git a/drivers/network/afd/afd/connect.c b/drivers/network/afd/afd/connect.c index 28fcfada857..e11a5534621 100644 --- a/drivers/network/afd/afd/connect.c +++ b/drivers/network/afd/afd/connect.c @@ -8,9 +8,6 @@ * 20040708 Created */ #include "afd.h" -#include "tdi_proto.h" -#include "tdiconn.h" -#include "debug.h" NTSTATUS NTAPI AfdGetConnectOptions(PDEVICE_OBJECT DeviceObject, PIRP Irp, @@ -23,7 +20,10 @@ AfdGetConnectOptions(PDEVICE_OBJECT DeviceObject, PIRP Irp, if (!SocketAcquireStateLock(FCB)) return LostSocket(Irp); if (FCB->ConnectOptionsSize == 0) + { + AFD_DbgPrint(MIN_TRACE,("Invalid parameter\n")); return UnlockAndMaybeComplete(FCB, STATUS_INVALID_PARAMETER, Irp, 0); + } ASSERT(FCB->ConnectOptions); @@ -43,10 +43,13 @@ AfdSetConnectOptions(PDEVICE_OBJECT DeviceObject, PIRP Irp, { PFILE_OBJECT FileObject = IrpSp->FileObject; PAFD_FCB FCB = FileObject->FsContext; - PVOID ConnectOptions = IrpSp->Parameters.DeviceIoControl.Type3InputBuffer; + PVOID ConnectOptions = LockRequest(Irp, IrpSp); UINT ConnectOptionsSize = IrpSp->Parameters.DeviceIoControl.InputBufferLength; if (!SocketAcquireStateLock(FCB)) return LostSocket(Irp); + + if (!ConnectOptions) + return UnlockAndMaybeComplete(FCB, STATUS_NO_MEMORY, Irp, 0); if (FCB->ConnectOptions) { @@ -57,7 +60,8 @@ AfdSetConnectOptions(PDEVICE_OBJECT DeviceObject, PIRP Irp, } FCB->ConnectOptions = ExAllocatePool(PagedPool, ConnectOptionsSize); - if (!FCB->ConnectOptions) return UnlockAndMaybeComplete(FCB, STATUS_NO_MEMORY, Irp, 0); + if (!FCB->ConnectOptions) + return UnlockAndMaybeComplete(FCB, STATUS_NO_MEMORY, Irp, 0); RtlCopyMemory(FCB->ConnectOptions, ConnectOptions, @@ -75,13 +79,19 @@ AfdSetConnectOptionsSize(PDEVICE_OBJECT DeviceObject, PIRP Irp, { PFILE_OBJECT FileObject = IrpSp->FileObject; PAFD_FCB FCB = FileObject->FsContext; - PUINT ConnectOptionsSize = IrpSp->Parameters.DeviceIoControl.Type3InputBuffer; + PUINT ConnectOptionsSize = LockRequest(Irp, IrpSp); UINT BufferSize = IrpSp->Parameters.DeviceIoControl.InputBufferLength; if (!SocketAcquireStateLock(FCB)) return LostSocket(Irp); + + if (!ConnectOptionsSize) + return UnlockAndMaybeComplete(FCB, STATUS_NO_MEMORY, Irp, 0); if (BufferSize < sizeof(UINT)) + { + AFD_DbgPrint(MIN_TRACE,("Buffer too small\n")); return UnlockAndMaybeComplete(FCB, STATUS_BUFFER_TOO_SMALL, Irp, 0); + } if (FCB->ConnectOptions) { @@ -109,7 +119,10 @@ AfdGetConnectData(PDEVICE_OBJECT DeviceObject, PIRP Irp, if (!SocketAcquireStateLock(FCB)) return LostSocket(Irp); if (FCB->ConnectDataSize == 0) + { + AFD_DbgPrint(MIN_TRACE,("Invalid parameter\n")); return UnlockAndMaybeComplete(FCB, STATUS_INVALID_PARAMETER, Irp, 0); + } ASSERT(FCB->ConnectData); @@ -129,10 +142,13 @@ AfdSetConnectData(PDEVICE_OBJECT DeviceObject, PIRP Irp, { PFILE_OBJECT FileObject = IrpSp->FileObject; PAFD_FCB FCB = FileObject->FsContext; - PVOID ConnectData = IrpSp->Parameters.DeviceIoControl.Type3InputBuffer; + PVOID ConnectData = LockRequest(Irp, IrpSp); UINT ConnectDataSize = IrpSp->Parameters.DeviceIoControl.InputBufferLength; if (!SocketAcquireStateLock(FCB)) return LostSocket(Irp); + + if (!ConnectData) + return UnlockAndMaybeComplete(FCB, STATUS_NO_MEMORY, Irp, 0); if (FCB->ConnectData) { @@ -161,13 +177,19 @@ AfdSetConnectDataSize(PDEVICE_OBJECT DeviceObject, PIRP Irp, { PFILE_OBJECT FileObject = IrpSp->FileObject; PAFD_FCB FCB = FileObject->FsContext; - PUINT ConnectDataSize = IrpSp->Parameters.DeviceIoControl.Type3InputBuffer; + PUINT ConnectDataSize = LockRequest(Irp, IrpSp); UINT BufferSize = IrpSp->Parameters.DeviceIoControl.InputBufferLength; if (!SocketAcquireStateLock(FCB)) return LostSocket(Irp); + if (!ConnectDataSize) + return UnlockAndMaybeComplete(FCB, STATUS_NO_MEMORY, Irp, 0); + if (BufferSize < sizeof(UINT)) + { + AFD_DbgPrint(MIN_TRACE,("Buffer too small\n")); return UnlockAndMaybeComplete(FCB, STATUS_BUFFER_TOO_SMALL, Irp, 0); + } if (FCB->ConnectData) { @@ -189,7 +211,7 @@ NTSTATUS WarmSocketForConnection( PAFD_FCB FCB ) { NTSTATUS Status; if( !FCB->TdiDeviceName.Length || !FCB->TdiDeviceName.Buffer ) { - AFD_DbgPrint(MID_TRACE,("Null Device\n")); + AFD_DbgPrint(MIN_TRACE,("Null Device\n")); return STATUS_NO_SUCH_DEVICE; } @@ -211,26 +233,33 @@ NTSTATUS MakeSocketIntoConnection( PAFD_FCB FCB ) { ASSERT(!FCB->Recv.Window); ASSERT(!FCB->Send.Window); - Status = TdiQueryMaxDatagramLength(FCB->Connection.Object, - &FCB->Send.Size); - if (!NT_SUCCESS(Status)) - return Status; + if (!FCB->Recv.Size) + { + Status = TdiQueryMaxDatagramLength(FCB->Connection.Object, + &FCB->Recv.Size); + if (!NT_SUCCESS(Status)) + return Status; + } - FCB->Recv.Size = FCB->Send.Size; + if (!FCB->Send.Size) + { + Status = TdiQueryMaxDatagramLength(FCB->Connection.Object, + &FCB->Send.Size); + if (!NT_SUCCESS(Status)) + return Status; + } /* Allocate the receive area and start receiving */ - FCB->Recv.Window = - ExAllocatePool( PagedPool, FCB->Recv.Size ); + if (!FCB->Recv.Window) + { + FCB->Recv.Window = ExAllocatePool( PagedPool, FCB->Recv.Size ); + if( !FCB->Recv.Window ) return STATUS_NO_MEMORY; + } - if( !FCB->Recv.Window ) return STATUS_NO_MEMORY; - - FCB->Send.Window = - ExAllocatePool( PagedPool, FCB->Send.Size ); - - if( !FCB->Send.Window ) { - ExFreePool( FCB->Recv.Window ); - FCB->Recv.Window = NULL; - return STATUS_NO_MEMORY; + if (!FCB->Send.Window) + { + FCB->Send.Window = ExAllocatePool( PagedPool, FCB->Send.Size ); + if( !FCB->Send.Window ) return STATUS_NO_MEMORY; } FCB->State = SOCKET_STATE_CONNECTED; @@ -274,6 +303,7 @@ static NTSTATUS NTAPI StreamSocketConnectComplete AFD_DbgPrint(MID_TRACE,("Irp->IoStatus.Status = %x\n", Irp->IoStatus.Status)); + ASSERT(FCB->ConnectIrp.InFlightRequest == Irp); FCB->ConnectIrp.InFlightRequest = NULL; if( FCB->State == SOCKET_STATE_CLOSED ) { @@ -319,19 +349,19 @@ static NTSTATUS NTAPI StreamSocketConnectComplete return Status; } - FCB->FilledConnectData = MIN(FCB->ConnectInfo->UserDataLength, FCB->ConnectDataSize); + FCB->FilledConnectData = MIN(FCB->ConnectReturnInfo->UserDataLength, FCB->ConnectDataSize); if (FCB->FilledConnectData) { RtlCopyMemory(FCB->ConnectData, - FCB->ConnectInfo->UserData, + FCB->ConnectReturnInfo->UserData, FCB->FilledConnectData); } - FCB->FilledConnectOptions = MIN(FCB->ConnectInfo->OptionsLength, FCB->ConnectOptionsSize); + FCB->FilledConnectOptions = MIN(FCB->ConnectReturnInfo->OptionsLength, FCB->ConnectOptionsSize); if (FCB->FilledConnectOptions) { RtlCopyMemory(FCB->ConnectOptions, - FCB->ConnectInfo->Options, + FCB->ConnectReturnInfo->Options, FCB->FilledConnectOptions); } @@ -367,7 +397,6 @@ AfdStreamSocketConnect(PDEVICE_OBJECT DeviceObject, PIRP Irp, PFILE_OBJECT FileObject = IrpSp->FileObject; PAFD_FCB FCB = FileObject->FsContext; PAFD_CONNECT_INFO ConnectReq; - PTDI_CONNECTION_INFORMATION TargetAddress; AFD_DbgPrint(MID_TRACE,("Called on %x\n", FCB)); if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp ); @@ -407,7 +436,7 @@ AfdStreamSocketConnect(PDEVICE_OBJECT DeviceObject, PIRP Irp, case SOCKET_STATE_CREATED: if( FCB->LocalAddress ) ExFreePool( FCB->LocalAddress ); FCB->LocalAddress = - TaCopyTransportAddress( &ConnectReq->RemoteAddress ); + TaBuildNullTransportAddress( ConnectReq->RemoteAddress.Address[0].AddressType ); if( FCB->LocalAddress ) { Status = WarmSocketForBind( FCB ); @@ -437,43 +466,52 @@ AfdStreamSocketConnect(PDEVICE_OBJECT DeviceObject, PIRP Irp, if( !NT_SUCCESS(Status) ) break; + if (FCB->ConnectReturnInfo) ExFreePool(FCB->ConnectReturnInfo); Status = TdiBuildConnectionInfo - ( &FCB->ConnectInfo, + ( &FCB->ConnectReturnInfo, &ConnectReq->RemoteAddress ); if( NT_SUCCESS(Status) ) - Status = TdiBuildConnectionInfo(&TargetAddress, + { + if (FCB->ConnectCallInfo) ExFreePool(FCB->ConnectCallInfo); + Status = TdiBuildConnectionInfo(&FCB->ConnectCallInfo, &ConnectReq->RemoteAddress); + } else break; if( NT_SUCCESS(Status) ) { - TargetAddress->UserData = FCB->ConnectData; - TargetAddress->UserDataLength = FCB->ConnectDataSize; - TargetAddress->Options = FCB->ConnectOptions; - TargetAddress->OptionsLength = FCB->ConnectOptionsSize; + FCB->ConnectCallInfo->UserData = FCB->ConnectData; + FCB->ConnectCallInfo->UserDataLength = FCB->ConnectDataSize; + FCB->ConnectCallInfo->Options = FCB->ConnectOptions; + FCB->ConnectCallInfo->OptionsLength = FCB->ConnectOptionsSize; + + FCB->State = SOCKET_STATE_CONNECTING; + + AFD_DbgPrint(MID_TRACE,("Queueing IRP %x\n", Irp)); + Status = QueueUserModeIrp( FCB, Irp, FUNCTION_CONNECT ); + if (Status == STATUS_PENDING) + { + Status = TdiConnect( &FCB->ConnectIrp.InFlightRequest, + FCB->Connection.Object, + FCB->ConnectCallInfo, + FCB->ConnectReturnInfo, + &FCB->ConnectIrp.Iosb, + StreamSocketConnectComplete, + FCB ); + } + + if (Status != STATUS_PENDING) + FCB->State = SOCKET_STATE_BOUND; + + SocketStateUnlock(FCB); - Status = TdiConnect( &FCB->ConnectIrp.InFlightRequest, - FCB->Connection.Object, - TargetAddress, - FCB->ConnectInfo, - &FCB->ConnectIrp.Iosb, - StreamSocketConnectComplete, - FCB ); - - ExFreePool(TargetAddress); - - AFD_DbgPrint(MID_TRACE,("Queueing IRP %x\n", Irp)); - - if( Status == STATUS_PENDING ) { - FCB->State = SOCKET_STATE_CONNECTING; - return LeaveIrpUntilLater( FCB, Irp, FUNCTION_CONNECT ); - } + return Status; } break; default: - AFD_DbgPrint(MID_TRACE,("Inappropriate socket state %d for connect\n", + AFD_DbgPrint(MIN_TRACE,("Inappropriate socket state %d for connect\n", FCB->State)); break; } diff --git a/drivers/network/afd/afd/context.c b/drivers/network/afd/afd/context.c index e612cb9ff39..eb9cf7f4835 100644 --- a/drivers/network/afd/afd/context.c +++ b/drivers/network/afd/afd/context.c @@ -8,9 +8,6 @@ * 20040708 Created */ #include "afd.h" -#include "tdi_proto.h" -#include "tdiconn.h" -#include "debug.h" NTSTATUS NTAPI AfdGetContext( PDEVICE_OBJECT DeviceObject, PIRP Irp, @@ -46,7 +43,10 @@ AfdGetContextSize( PDEVICE_OBJECT DeviceObject, PIRP Irp, if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp ); if (IrpSp->Parameters.DeviceIoControl.OutputBufferLength < sizeof(ULONG)) + { + AFD_DbgPrint(MIN_TRACE,("Buffer too small\n")); return UnlockAndMaybeComplete(FCB, STATUS_BUFFER_TOO_SMALL, Irp, sizeof(ULONG)); + } RtlCopyMemory(Irp->UserBuffer, &FCB->ContextSize, @@ -54,14 +54,18 @@ AfdGetContextSize( PDEVICE_OBJECT DeviceObject, PIRP Irp, return UnlockAndMaybeComplete(FCB, STATUS_SUCCESS, Irp, sizeof(ULONG)); } - + NTSTATUS NTAPI AfdSetContext( PDEVICE_OBJECT DeviceObject, PIRP Irp, PIO_STACK_LOCATION IrpSp ) { PFILE_OBJECT FileObject = IrpSp->FileObject; PAFD_FCB FCB = FileObject->FsContext; + PVOID Context = LockRequest(Irp, IrpSp); if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp ); + + if (!Context) + return UnlockAndMaybeComplete(FCB, STATUS_NO_MEMORY, Irp, 0); if( FCB->Context ) { ExFreePool( FCB->Context ); @@ -76,7 +80,7 @@ AfdSetContext( PDEVICE_OBJECT DeviceObject, PIRP Irp, FCB->ContextSize = IrpSp->Parameters.DeviceIoControl.InputBufferLength; RtlCopyMemory( FCB->Context, - IrpSp->Parameters.DeviceIoControl.Type3InputBuffer, + Context, FCB->ContextSize ); return UnlockAndMaybeComplete( FCB, STATUS_SUCCESS, Irp, 0 ); diff --git a/drivers/network/afd/afd/info.c b/drivers/network/afd/afd/info.c index a5eabcb0d5c..16c46df4f02 100644 --- a/drivers/network/afd/afd/info.c +++ b/drivers/network/afd/afd/info.c @@ -8,16 +8,12 @@ * 20040708 Created */ #include "afd.h" -#include "tdi_proto.h" -#include "tdiconn.h" -#include "debug.h" -#include "pseh/pseh2.h" NTSTATUS NTAPI AfdGetInfo( PDEVICE_OBJECT DeviceObject, PIRP Irp, PIO_STACK_LOCATION IrpSp ) { NTSTATUS Status = STATUS_SUCCESS; - PAFD_INFO InfoReq = IrpSp->Parameters.DeviceIoControl.Type3InputBuffer; + PAFD_INFO InfoReq = LockRequest(Irp, IrpSp); PFILE_OBJECT FileObject = IrpSp->FileObject; PAFD_FCB FCB = FileObject->FsContext; PLIST_ENTRY CurrentEntry; @@ -26,6 +22,9 @@ AfdGetInfo( PDEVICE_OBJECT DeviceObject, PIRP Irp, InfoReq ? InfoReq->InformationClass : 0)); if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp ); + + if (!InfoReq) + return UnlockAndMaybeComplete(FCB, STATUS_NO_MEMORY, Irp, 0); _SEH2_TRY { switch( InfoReq->InformationClass ) { @@ -45,13 +44,17 @@ AfdGetInfo( PDEVICE_OBJECT DeviceObject, PIRP Irp, break; case AFD_INFO_BLOCKING_MODE: - InfoReq->Information.Ulong = FCB->BlockingMode; + InfoReq->Information.Boolean = FCB->NonBlocking; break; + + case AFD_INFO_INLINING_MODE: + InfoReq->Information.Boolean = FCB->OobInline; + break; case AFD_INFO_RECEIVE_CONTENT_SIZE: /* Only touch InfoReq if a socket has been set up. Behaviour was verified under WinXP SP2. */ - if(FCB->AddressFile.Object) + if(FCB->AddressFile.Object || FCB->Connection.Object) InfoReq->Information.Ulong = FCB->Recv.Content - FCB->Recv.BytesUsed; break; @@ -67,20 +70,27 @@ AfdGetInfo( PDEVICE_OBJECT DeviceObject, PIRP Irp, CurrentEntry = CurrentEntry->Flink; } - /* Count the send in progress */ - if (FCB->SendIrp.InFlightRequest) - InfoReq->Information.Ulong++; - - break; + /* This needs to count too because when this is dispatched + * the user-mode IRP has already been completed and therefore + * will NOT be in our pending IRP list. We count this as one send + * outstanding although it could be multiple since we batch sends + * when waiting for the in flight request to return, so this number + * may not be accurate but it really doesn't matter that much since + * it's more or less a zero/non-zero comparison to determine whether + * we can shutdown the socket + */ + if (FCB->SendIrp.InFlightRequest) + InfoReq->Information.Ulong++; + break; default: - AFD_DbgPrint(MID_TRACE,("Unknown info id %x\n", + AFD_DbgPrint(MIN_TRACE,("Unknown info id %x\n", InfoReq->InformationClass)); Status = STATUS_INVALID_PARAMETER; break; } } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { - AFD_DbgPrint(MID_TRACE,("Exception executing GetInfo\n")); + AFD_DbgPrint(MIN_TRACE,("Exception executing GetInfo\n")); Status = STATUS_INVALID_PARAMETER; } _SEH2_END; @@ -93,23 +103,83 @@ NTSTATUS NTAPI AfdSetInfo( PDEVICE_OBJECT DeviceObject, PIRP Irp, PIO_STACK_LOCATION IrpSp ) { NTSTATUS Status = STATUS_SUCCESS; - PAFD_INFO InfoReq = IrpSp->Parameters.DeviceIoControl.Type3InputBuffer; + PAFD_INFO InfoReq = LockRequest(Irp, IrpSp); PFILE_OBJECT FileObject = IrpSp->FileObject; PAFD_FCB FCB = FileObject->FsContext; + PCHAR NewBuffer; if (!SocketAcquireStateLock(FCB)) return LostSocket(Irp); + + if (!InfoReq) + return UnlockAndMaybeComplete(FCB, STATUS_NO_MEMORY, Irp, 0); _SEH2_TRY { switch (InfoReq->InformationClass) { case AFD_INFO_BLOCKING_MODE: - AFD_DbgPrint(MID_TRACE,("Blocking mode set to %d\n", InfoReq->Information.Ulong)); - FCB->BlockingMode = InfoReq->Information.Ulong; + AFD_DbgPrint(MID_TRACE,("Blocking mode set to %d\n", InfoReq->Information.Boolean)); + FCB->NonBlocking = InfoReq->Information.Boolean; + break; + case AFD_INFO_INLINING_MODE: + FCB->OobInline = InfoReq->Information.Boolean; + break; + case AFD_INFO_RECEIVE_WINDOW_SIZE: + NewBuffer = ExAllocatePool(PagedPool, InfoReq->Information.Ulong); + if (NewBuffer) + { + if (FCB->Recv.Content > InfoReq->Information.Ulong) + FCB->Recv.Content = InfoReq->Information.Ulong; + + if (FCB->Recv.Window) + { + RtlCopyMemory(NewBuffer, + FCB->Recv.Window, + FCB->Recv.Content); + + ExFreePool(FCB->Recv.Window); + } + + FCB->Recv.Size = InfoReq->Information.Ulong; + FCB->Recv.Window = NewBuffer; + + Status = STATUS_SUCCESS; + } + else + { + Status = STATUS_NO_MEMORY; + } + break; + case AFD_INFO_SEND_WINDOW_SIZE: + NewBuffer = ExAllocatePool(PagedPool, InfoReq->Information.Ulong); + if (NewBuffer) + { + if (FCB->Send.BytesUsed > InfoReq->Information.Ulong) + FCB->Send.BytesUsed = InfoReq->Information.Ulong; + + if (FCB->Send.Window) + { + RtlCopyMemory(NewBuffer, + FCB->Send.Window, + FCB->Send.BytesUsed); + + ExFreePool(FCB->Send.Window); + } + + FCB->Send.Size = InfoReq->Information.Ulong; + FCB->Send.Window = NewBuffer; + + Status = STATUS_SUCCESS; + } + else + { + Status = STATUS_NO_MEMORY; + } break; default: AFD_DbgPrint(MIN_TRACE,("Unknown request %d\n", InfoReq->InformationClass)); break; } } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { + AFD_DbgPrint(MIN_TRACE,("Exception executing SetInfo\n")); Status = STATUS_INVALID_PARAMETER; } _SEH2_END; @@ -162,56 +232,27 @@ AfdGetSockName( PDEVICE_OBJECT DeviceObject, PIRP Irp, NTSTATUS NTAPI AfdGetPeerName( PDEVICE_OBJECT DeviceObject, PIRP Irp, PIO_STACK_LOCATION IrpSp ) { - NTSTATUS Status = STATUS_SUCCESS; + NTSTATUS Status; PFILE_OBJECT FileObject = IrpSp->FileObject; PAFD_FCB FCB = FileObject->FsContext; - PMDL Mdl = NULL; - PTDI_CONNECTION_INFORMATION ConnInfo = NULL; if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp ); - if (FCB->RemoteAddress == NULL || FCB->Connection.Object == NULL) { + if (FCB->RemoteAddress == NULL) { + AFD_DbgPrint(MIN_TRACE,("Invalid parameter\n")); return UnlockAndMaybeComplete( FCB, STATUS_INVALID_PARAMETER, Irp, 0 ); } - if(NT_SUCCESS(Status = TdiBuildNullConnectionInfo - (&ConnInfo, - FCB->RemoteAddress->Address[0].AddressType))) + if (IrpSp->Parameters.DeviceIoControl.OutputBufferLength >= TaLengthOfTransportAddress(FCB->RemoteAddress)) { - Mdl = IoAllocateMdl(ConnInfo, - sizeof(TDI_CONNECTION_INFORMATION) + - TaLengthOfTransportAddress(ConnInfo->RemoteAddress), - FALSE, - FALSE, - NULL); - - if (Mdl) - { - _SEH2_TRY { - MmProbeAndLockPages(Mdl, Irp->RequestorMode, IoModifyAccess); - } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { - AFD_DbgPrint(MIN_TRACE, ("MmProbeAndLockPages() failed.\n")); - Status = _SEH2_GetExceptionCode(); - } _SEH2_END; - - if (NT_SUCCESS(Status)) - { - Status = TdiQueryInformation(FCB->Connection.Object, - TDI_QUERY_CONNECTION_INFO, - Mdl); - - if (NT_SUCCESS(Status)) - { - if (IrpSp->Parameters.DeviceIoControl.OutputBufferLength >= TaLengthOfTransportAddress(ConnInfo->RemoteAddress)) - RtlCopyMemory(Irp->UserBuffer, ConnInfo->RemoteAddress, TaLengthOfTransportAddress(ConnInfo->RemoteAddress)); - else - Status = STATUS_BUFFER_TOO_SMALL; - } - } - } - - ExFreePool(ConnInfo); + RtlCopyMemory(Irp->UserBuffer, FCB->RemoteAddress, TaLengthOfTransportAddress(FCB->RemoteAddress)); + Status = STATUS_SUCCESS; + } + else + { + AFD_DbgPrint(MIN_TRACE,("Buffer too small\n")); + Status = STATUS_BUFFER_TOO_SMALL; } return UnlockAndMaybeComplete( FCB, Status, Irp, 0 ); diff --git a/drivers/network/afd/afd/listen.c b/drivers/network/afd/afd/listen.c index f6eb1104210..21e567a64e3 100644 --- a/drivers/network/afd/afd/listen.c +++ b/drivers/network/afd/afd/listen.c @@ -8,9 +8,6 @@ * 20040708 Created */ #include "afd.h" -#include "tdi_proto.h" -#include "tdiconn.h" -#include "debug.h" static NTSTATUS SatisfyAccept( PAFD_DEVICE_EXTENSION DeviceExt, PIRP Irp, @@ -37,7 +34,10 @@ static NTSTATUS SatisfyAccept( PAFD_DEVICE_EXTENSION DeviceExt, Status = MakeSocketIntoConnection( FCB ); if (NT_SUCCESS(Status)) - Status = TdiBuildConnectionInfo(&FCB->ConnectInfo, FCB->RemoteAddress); + Status = TdiBuildConnectionInfo(&FCB->ConnectCallInfo, FCB->RemoteAddress); + + if (NT_SUCCESS(Status)) + Status = TdiBuildConnectionInfo(&FCB->ConnectReturnInfo, FCB->RemoteAddress); return UnlockAndMaybeComplete( FCB, Status, Irp, 0 ); } @@ -59,15 +59,6 @@ static NTSTATUS SatisfyPreAccept( PIRP Irp, PAFD_TDI_OBJECT_QELT Qelt ) { IPAddr = (PTA_IP_ADDRESS)&ListenReceive->Address; - if( !IPAddr ) { - if( Irp->MdlAddress ) UnlockRequest( Irp, IoGetCurrentIrpStackLocation( Irp ) ); - Irp->IoStatus.Status = STATUS_NO_MEMORY; - Irp->IoStatus.Information = 0; - (void)IoSetCancelRoutine(Irp, NULL); - IoCompleteRequest( Irp, IO_NETWORK_INCREMENT ); - return STATUS_NO_MEMORY; - } - AFD_DbgPrint(MID_TRACE,("IPAddr->TAAddressCount %d\n", IPAddr->TAAddressCount)); AFD_DbgPrint(MID_TRACE,("IPAddr->Address[0].AddressType %d\n", @@ -95,12 +86,13 @@ static NTSTATUS NTAPI ListenComplete NTSTATUS Status = STATUS_SUCCESS; PAFD_FCB FCB = (PAFD_FCB)Context; PAFD_TDI_OBJECT_QELT Qelt; - PLIST_ENTRY NextIrpEntry, QeltEntry; + PLIST_ENTRY NextIrpEntry; PIRP NextIrp; if( !SocketAcquireStateLock( FCB ) ) return STATUS_FILE_CLOSED; + ASSERT(FCB->ListenIrp.InFlightRequest == Irp); FCB->ListenIrp.InFlightRequest = NULL; if( FCB->State == SOCKET_STATE_CLOSED ) { @@ -115,13 +107,6 @@ static NTSTATUS NTAPI ListenComplete IoCompleteRequest( NextIrp, IO_NETWORK_INCREMENT ); } - /* Free all pending connections */ - while( !IsListEmpty( &FCB->PendingConnections ) ) { - QeltEntry = RemoveHeadList(&FCB->PendingConnections); - Qelt = CONTAINING_RECORD(QeltEntry, AFD_TDI_OBJECT_QELT, ListEntry); - ExFreePool(Qelt); - } - /* Free ConnectionReturnInfo and ConnectionCallInfo */ if (FCB->ListenIrp.ConnectionReturnInfo) { @@ -140,7 +125,13 @@ static NTSTATUS NTAPI ListenComplete } AFD_DbgPrint(MID_TRACE,("Completing listen request.\n")); - AFD_DbgPrint(MID_TRACE,("IoStatus was %x\n", FCB->ListenIrp.Iosb.Status)); + AFD_DbgPrint(MID_TRACE,("IoStatus was %x\n", Irp->IoStatus.Status)); + + if (Irp->IoStatus.Status != STATUS_SUCCESS) + { + SocketStateUnlock(FCB); + return Irp->IoStatus.Status; + } Qelt = ExAllocatePool( NonPagedPool, sizeof(*Qelt) ); if( !Qelt ) { @@ -178,18 +169,31 @@ static NTSTATUS NTAPI ListenComplete ListEntry ) ); } - if( FCB->ListenIrp.ConnectionCallInfo ) { - ExFreePool( FCB->ListenIrp.ConnectionCallInfo ); - FCB->ListenIrp.ConnectionCallInfo = NULL; - } + /* Launch new accept socket */ + Status = WarmSocketForConnection( FCB ); + + if (NT_SUCCESS(Status)) + { + Status = TdiBuildNullConnectionInfoInPlace(FCB->ListenIrp.ConnectionCallInfo, + FCB->LocalAddress->Address[0].AddressType); + ASSERT(Status == STATUS_SUCCESS); + + Status = TdiBuildNullConnectionInfoInPlace(FCB->ListenIrp.ConnectionReturnInfo, + FCB->LocalAddress->Address[0].AddressType); + ASSERT(Status == STATUS_SUCCESS); + + Status = TdiListen( &FCB->ListenIrp.InFlightRequest, + FCB->Connection.Object, + &FCB->ListenIrp.ConnectionCallInfo, + &FCB->ListenIrp.ConnectionReturnInfo, + &FCB->ListenIrp.Iosb, + ListenComplete, + FCB ); - if( FCB->ListenIrp.ConnectionReturnInfo ) { - ExFreePool( FCB->ListenIrp.ConnectionReturnInfo ); - FCB->ListenIrp.ConnectionReturnInfo = NULL; + if (Status == STATUS_PENDING) + Status = STATUS_SUCCESS; } - FCB->NeedsNewListen = TRUE; - /* Trigger a select return if appropriate */ if( !IsListEmpty( &FCB->PendingConnections ) ) { FCB->PollState |= AFD_EVENT_ACCEPT; @@ -220,7 +224,7 @@ NTSTATUS AfdListenSocket(PDEVICE_OBJECT DeviceObject, PIRP Irp, if( FCB->State != SOCKET_STATE_BOUND ) { Status = STATUS_INVALID_PARAMETER; - AFD_DbgPrint(MID_TRACE,("Could not listen an unbound socket\n")); + AFD_DbgPrint(MIN_TRACE,("Could not listen an unbound socket\n")); return UnlockAndMaybeComplete( FCB, Status, Irp, 0 ); } @@ -264,9 +268,6 @@ NTSTATUS AfdListenSocket(PDEVICE_OBJECT DeviceObject, PIRP Irp, if( Status == STATUS_PENDING ) Status = STATUS_SUCCESS; - if (NT_SUCCESS(Status)) - FCB->NeedsNewListen = FALSE; - AFD_DbgPrint(MID_TRACE,("Returning %x\n", Status)); return UnlockAndMaybeComplete( FCB, Status, Irp, 0 ); } @@ -302,6 +303,10 @@ NTSTATUS AfdWaitForListen( PDEVICE_OBJECT DeviceObject, PIRP Irp, SocketStateUnlock( FCB ); return Status; + } else if (FCB->NonBlocking) { + AFD_DbgPrint(MIN_TRACE,("No connection ready on a non-blocking socket\n")); + + return UnlockAndMaybeComplete(FCB, STATUS_CANT_WAIT, Irp, 0); } else { AFD_DbgPrint(MID_TRACE,("Holding\n")); @@ -323,48 +328,6 @@ NTSTATUS AfdAccept( PDEVICE_OBJECT DeviceObject, PIRP Irp, if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp ); - if( FCB->NeedsNewListen ) { - AFD_DbgPrint(MID_TRACE,("ADDRESSFILE: %x\n", FCB->AddressFile.Handle)); - - /* Launch new accept socket */ - Status = WarmSocketForConnection( FCB ); - - if( Status == STATUS_SUCCESS ) { - Status = TdiBuildNullConnectionInfo - ( &FCB->ListenIrp.ConnectionCallInfo, - FCB->LocalAddress->Address[0].AddressType ); - - if (!NT_SUCCESS(Status)) return UnlockAndMaybeComplete(FCB, Status, Irp, 0); - - Status = TdiBuildNullConnectionInfo - ( &FCB->ListenIrp.ConnectionReturnInfo, - FCB->LocalAddress->Address[0].AddressType ); - - if (!NT_SUCCESS(Status)) - { - ExFreePool(FCB->ListenIrp.ConnectionCallInfo); - FCB->ListenIrp.ConnectionCallInfo = NULL; - return UnlockAndMaybeComplete(FCB, Status, Irp, 0); - } - - Status = TdiListen( &FCB->ListenIrp.InFlightRequest, - FCB->Connection.Object, - &FCB->ListenIrp.ConnectionCallInfo, - &FCB->ListenIrp.ConnectionReturnInfo, - &FCB->ListenIrp.Iosb, - ListenComplete, - FCB ); - - if( Status == STATUS_PENDING ) - Status = STATUS_SUCCESS; - - if( !NT_SUCCESS(Status) ) - return UnlockAndMaybeComplete( FCB, Status, Irp, 0 ); - - FCB->NeedsNewListen = FALSE; - } else return UnlockAndMaybeComplete( FCB, Status, Irp, 0 ); - } - for( PendingConn = FCB->PendingConnections.Flink; PendingConn != &FCB->PendingConnections; PendingConn = PendingConn->Flink ) { @@ -401,18 +364,23 @@ NTSTATUS AfdAccept( PDEVICE_OBJECT DeviceObject, PIRP Irp, AFD_DbgPrint(MID_TRACE,("Completed a wait for accept\n")); ExFreePool( PendingConnObj ); + + FCB->EventSelectDisabled &= ~AFD_EVENT_ACCEPT; - if( !IsListEmpty( &FCB->PendingConnections ) ) { - FCB->PollState |= AFD_EVENT_ACCEPT; - FCB->PollStatus[FD_ACCEPT_BIT] = STATUS_SUCCESS; + if( !IsListEmpty( &FCB->PendingConnections ) ) + { + FCB->PollState |= AFD_EVENT_ACCEPT; + FCB->PollStatus[FD_ACCEPT_BIT] = STATUS_SUCCESS; PollReeval( FCB->DeviceExt, FCB->FileObject ); - } else - FCB->PollState &= ~AFD_EVENT_ACCEPT; + } else + FCB->PollState &= ~AFD_EVENT_ACCEPT; SocketStateUnlock( FCB ); return Status; } } + + AFD_DbgPrint(MIN_TRACE,("No connection waiting\n")); return UnlockAndMaybeComplete( FCB, STATUS_UNSUCCESSFUL, Irp, 0 ); } diff --git a/drivers/network/afd/afd/lock.c b/drivers/network/afd/afd/lock.c index dcc4f24089a..c64f8102e34 100644 --- a/drivers/network/afd/afd/lock.c +++ b/drivers/network/afd/afd/lock.c @@ -8,54 +8,88 @@ * 20040708 Created */ #include "afd.h" -#include "tdi_proto.h" -#include "tdiconn.h" -#include "debug.h" -#include "pseh/pseh2.h" + +PVOID GetLockedData(PIRP Irp, PIO_STACK_LOCATION IrpSp) +{ + ASSERT(Irp->MdlAddress); + + return MmGetSystemAddressForMdlSafe(Irp->MdlAddress, NormalPagePriority); +} /* Lock a method_neither request so it'll be available from DISPATCH_LEVEL */ PVOID LockRequest( PIRP Irp, PIO_STACK_LOCATION IrpSp ) { BOOLEAN LockFailed = FALSE; - - ASSERT(IrpSp->Parameters.DeviceIoControl.Type3InputBuffer); - ASSERT(IrpSp->Parameters.DeviceIoControl.InputBufferLength); + ASSERT(!Irp->MdlAddress); + + switch (IrpSp->MajorFunction) + { + case IRP_MJ_DEVICE_CONTROL: + case IRP_MJ_INTERNAL_DEVICE_CONTROL: + ASSERT(IrpSp->Parameters.DeviceIoControl.Type3InputBuffer); + ASSERT(IrpSp->Parameters.DeviceIoControl.InputBufferLength); - Irp->MdlAddress = - IoAllocateMdl( IrpSp->Parameters.DeviceIoControl.Type3InputBuffer, - IrpSp->Parameters.DeviceIoControl.InputBufferLength, - FALSE, - FALSE, - NULL ); - if( Irp->MdlAddress ) { - _SEH2_TRY { - MmProbeAndLockPages( Irp->MdlAddress, Irp->RequestorMode, IoModifyAccess ); - } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { - LockFailed = TRUE; - } _SEH2_END; - - if( LockFailed ) { - IoFreeMdl( Irp->MdlAddress ); - Irp->MdlAddress = NULL; - return NULL; - } - - IrpSp->Parameters.DeviceIoControl.Type3InputBuffer = - MmGetSystemAddressForMdlSafe( Irp->MdlAddress, NormalPagePriority ); - - if( !IrpSp->Parameters.DeviceIoControl.Type3InputBuffer ) { - MmUnlockPages( Irp->MdlAddress ); - IoFreeMdl( Irp->MdlAddress ); - Irp->MdlAddress = NULL; - return NULL; - } - - return IrpSp->Parameters.DeviceIoControl.Type3InputBuffer; - } else return NULL; + + Irp->MdlAddress = + IoAllocateMdl( IrpSp->Parameters.DeviceIoControl.Type3InputBuffer, + IrpSp->Parameters.DeviceIoControl.InputBufferLength, + FALSE, + FALSE, + NULL ); + if( Irp->MdlAddress ) { + _SEH2_TRY { + MmProbeAndLockPages( Irp->MdlAddress, Irp->RequestorMode, IoModifyAccess ); + } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { + LockFailed = TRUE; + } _SEH2_END; + + if( LockFailed ) { + AFD_DbgPrint(MIN_TRACE,("Failed to lock pages\n")); + IoFreeMdl( Irp->MdlAddress ); + Irp->MdlAddress = NULL; + return NULL; + } + } else return NULL; + break; + + case IRP_MJ_READ: + case IRP_MJ_WRITE: + ASSERT(Irp->UserBuffer); + + Irp->MdlAddress = + IoAllocateMdl(Irp->UserBuffer, + (IrpSp->MajorFunction == IRP_MJ_READ) ? + IrpSp->Parameters.Read.Length : IrpSp->Parameters.Write.Length, + FALSE, + FALSE, + NULL ); + if( Irp->MdlAddress ) { + _SEH2_TRY { + MmProbeAndLockPages( Irp->MdlAddress, Irp->RequestorMode, IoModifyAccess ); + } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { + LockFailed = TRUE; + } _SEH2_END; + + if( LockFailed ) { + AFD_DbgPrint(MIN_TRACE,("Failed to lock pages\n")); + IoFreeMdl( Irp->MdlAddress ); + Irp->MdlAddress = NULL; + return NULL; + } + } else return NULL; + break; + + default: + ASSERT(FALSE); + return NULL; + } + + return GetLockedData(Irp, IrpSp); } VOID UnlockRequest( PIRP Irp, PIO_STACK_LOCATION IrpSp ) { + ASSERT(Irp->MdlAddress); MmUnlockPages( Irp->MdlAddress ); IoFreeMdl( Irp->MdlAddress ); Irp->MdlAddress = NULL; @@ -122,7 +156,7 @@ PAFD_WSABUF LockBuffers( PAFD_WSABUF Buf, UINT Count, if( MapBuf[i].Mdl ) { AFD_DbgPrint(MID_TRACE,("Probe and lock pages\n")); _SEH2_TRY { - MmProbeAndLockPages( MapBuf[i].Mdl, KernelMode, + MmProbeAndLockPages( MapBuf[i].Mdl, UserMode, Write ? IoModifyAccess : IoReadAccess ); } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { LockFailed = TRUE; @@ -130,6 +164,7 @@ PAFD_WSABUF LockBuffers( PAFD_WSABUF Buf, UINT Count, AFD_DbgPrint(MID_TRACE,("MmProbeAndLock finished\n")); if( LockFailed ) { + AFD_DbgPrint(MIN_TRACE,("Failed to lock pages\n")); IoFreeMdl( MapBuf[i].Mdl ); MapBuf[i].Mdl = NULL; ExFreePool( NewBuf ); @@ -191,7 +226,10 @@ PAFD_HANDLE LockHandles( PAFD_HANDLE HandleArray, UINT HandleCount ) { } if( !NT_SUCCESS(Status) ) + { + AFD_DbgPrint(MIN_TRACE,("Failed to reference handles (0x%x)\n", Status)); FileObjects[i].Handle = 0; + } } if( !NT_SUCCESS(Status) ) { @@ -251,11 +289,48 @@ NTSTATUS LostSocket( PIRP Irp ) { return Status; } -NTSTATUS LeaveIrpUntilLater( PAFD_FCB FCB, PIRP Irp, UINT Function ) { +NTSTATUS QueueUserModeIrp(PAFD_FCB FCB, PIRP Irp, UINT Function) +{ + NTSTATUS Status; + + /* Add the IRP to the queue in all cases (so AfdCancelHandler will work properly) */ InsertTailList( &FCB->PendingIrpList[Function], - &Irp->Tail.Overlay.ListEntry ); - IoMarkIrpPending(Irp); - (void)IoSetCancelRoutine(Irp, AfdCancelHandler); - SocketStateUnlock( FCB ); - return STATUS_PENDING; + &Irp->Tail.Overlay.ListEntry ); + + /* Acquire the cancel spin lock and check the cancel bit */ + IoAcquireCancelSpinLock(&Irp->CancelIrql); + if (!Irp->Cancel) + { + /* We are not cancelled; we're good to go so + * set the cancel routine, release the cancel spin lock, + * mark the IRP as pending, and + * return STATUS_PENDING to the caller + */ + (void)IoSetCancelRoutine(Irp, AfdCancelHandler); + IoReleaseCancelSpinLock(Irp->CancelIrql); + IoMarkIrpPending(Irp); + Status = STATUS_PENDING; + } + else + { + /* We were already cancelled before we were able to register our cancel routine + * so we are to call the cancel routine ourselves right here to cancel the IRP + * (which handles all the stuff we do above) and return STATUS_CANCELLED to the caller + */ + AfdCancelHandler(IoGetCurrentIrpStackLocation(Irp)->DeviceObject, + Irp); + Status = STATUS_CANCELLED; + } + + return Status; +} + +NTSTATUS LeaveIrpUntilLater( PAFD_FCB FCB, PIRP Irp, UINT Function ) { + NTSTATUS Status; + + Status = QueueUserModeIrp(FCB, Irp, Function); + + SocketStateUnlock( FCB ); + + return Status; } diff --git a/drivers/network/afd/afd/main.c b/drivers/network/afd/afd/main.c index 03598f008c1..fa7f2bd5187 100644 --- a/drivers/network/afd/afd/main.c +++ b/drivers/network/afd/afd/main.c @@ -13,15 +13,12 @@ /* INCLUDES */ #include "afd.h" -#include "tdi_proto.h" -#include "tdiconn.h" -#include "debug.h" #if DBG /* See debug.h for debug/trace constants */ //DWORD DebugTraceLevel = DEBUG_ULTRA; -DWORD DebugTraceLevel = 0; +DWORD DebugTraceLevel = MIN_TRACE; #endif /* DBG */ @@ -52,7 +49,10 @@ AfdGetDisconnectOptions(PDEVICE_OBJECT DeviceObject, PIRP Irp, if (!SocketAcquireStateLock(FCB)) return LostSocket(Irp); if (FCB->DisconnectOptionsSize == 0) + { + AFD_DbgPrint(MIN_TRACE,("Invalid parameter\n")); return UnlockAndMaybeComplete(FCB, STATUS_INVALID_PARAMETER, Irp, 0); + } ASSERT(FCB->DisconnectOptions); @@ -72,10 +72,13 @@ AfdSetDisconnectOptions(PDEVICE_OBJECT DeviceObject, PIRP Irp, { PFILE_OBJECT FileObject = IrpSp->FileObject; PAFD_FCB FCB = FileObject->FsContext; - PVOID DisconnectOptions = IrpSp->Parameters.DeviceIoControl.Type3InputBuffer; + PVOID DisconnectOptions = LockRequest(Irp, IrpSp); UINT DisconnectOptionsSize = IrpSp->Parameters.DeviceIoControl.InputBufferLength; if (!SocketAcquireStateLock(FCB)) return LostSocket(Irp); + + if (!DisconnectOptions) + return UnlockAndMaybeComplete(FCB, STATUS_NO_MEMORY, Irp, 0); if (FCB->DisconnectOptions) { @@ -104,13 +107,19 @@ AfdSetDisconnectOptionsSize(PDEVICE_OBJECT DeviceObject, PIRP Irp, { PFILE_OBJECT FileObject = IrpSp->FileObject; PAFD_FCB FCB = FileObject->FsContext; - PUINT DisconnectOptionsSize = IrpSp->Parameters.DeviceIoControl.Type3InputBuffer; + PUINT DisconnectOptionsSize = LockRequest(Irp, IrpSp); UINT BufferSize = IrpSp->Parameters.DeviceIoControl.InputBufferLength; if (!SocketAcquireStateLock(FCB)) return LostSocket(Irp); + + if (!DisconnectOptionsSize) + return UnlockAndMaybeComplete(FCB, STATUS_NO_MEMORY, Irp, 0); if (BufferSize < sizeof(UINT)) + { + AFD_DbgPrint(MIN_TRACE,("Buffer too small\n")); return UnlockAndMaybeComplete(FCB, STATUS_BUFFER_TOO_SMALL, Irp, 0); + } if (FCB->DisconnectOptions) { @@ -138,7 +147,10 @@ AfdGetDisconnectData(PDEVICE_OBJECT DeviceObject, PIRP Irp, if (!SocketAcquireStateLock(FCB)) return LostSocket(Irp); if (FCB->DisconnectDataSize == 0) + { + AFD_DbgPrint(MIN_TRACE,("Invalid parameter\n")); return UnlockAndMaybeComplete(FCB, STATUS_INVALID_PARAMETER, Irp, 0); + } ASSERT(FCB->DisconnectData); @@ -158,10 +170,13 @@ AfdSetDisconnectData(PDEVICE_OBJECT DeviceObject, PIRP Irp, { PFILE_OBJECT FileObject = IrpSp->FileObject; PAFD_FCB FCB = FileObject->FsContext; - PVOID DisconnectData = IrpSp->Parameters.DeviceIoControl.Type3InputBuffer; + PVOID DisconnectData = LockRequest(Irp, IrpSp); UINT DisconnectDataSize = IrpSp->Parameters.DeviceIoControl.InputBufferLength; if (!SocketAcquireStateLock(FCB)) return LostSocket(Irp); + + if (!DisconnectData) + return UnlockAndMaybeComplete(FCB, STATUS_NO_MEMORY, Irp, 0); if (FCB->DisconnectData) { @@ -190,13 +205,19 @@ AfdSetDisconnectDataSize(PDEVICE_OBJECT DeviceObject, PIRP Irp, { PFILE_OBJECT FileObject = IrpSp->FileObject; PAFD_FCB FCB = FileObject->FsContext; - PUINT DisconnectDataSize = IrpSp->Parameters.DeviceIoControl.Type3InputBuffer; + PUINT DisconnectDataSize = LockRequest(Irp, IrpSp); UINT BufferSize = IrpSp->Parameters.DeviceIoControl.InputBufferLength; if (!SocketAcquireStateLock(FCB)) return LostSocket(Irp); + + if (!DisconnectDataSize) + return UnlockAndMaybeComplete(FCB, STATUS_NO_MEMORY, Irp, 0); if (BufferSize < sizeof(UINT)) + { + AFD_DbgPrint(MIN_TRACE,("Buffer too small\n")); return UnlockAndMaybeComplete(FCB, STATUS_BUFFER_TOO_SMALL, Irp, 0); + } if (FCB->DisconnectData) { @@ -219,14 +240,20 @@ AfdGetTdiHandles(PDEVICE_OBJECT DeviceObject, PIRP Irp, { PFILE_OBJECT FileObject = IrpSp->FileObject; PAFD_FCB FCB = FileObject->FsContext; - PULONG HandleFlags = IrpSp->Parameters.DeviceIoControl.Type3InputBuffer; + PULONG HandleFlags = LockRequest(Irp, IrpSp); PAFD_TDI_HANDLE_DATA HandleData = Irp->UserBuffer; if (!SocketAcquireStateLock(FCB)) return LostSocket(Irp); + + if (!HandleFlags) + return UnlockAndMaybeComplete(FCB, STATUS_NO_MEMORY, Irp, 0); if (IrpSp->Parameters.DeviceIoControl.InputBufferLength < sizeof(ULONG) || IrpSp->Parameters.DeviceIoControl.OutputBufferLength < sizeof(*HandleData)) + { + AFD_DbgPrint(MIN_TRACE,("Buffer too small\n")); return UnlockAndMaybeComplete(FCB, STATUS_BUFFER_TOO_SMALL, Irp, 0); + } if ((*HandleFlags) & AFD_ADDRESS_HANDLE) HandleData->TdiAddressHandle = FCB->AddressFile.Handle; @@ -394,6 +421,9 @@ AfdCloseSocket(PDEVICE_OBJECT DeviceObject, PIRP Irp, PAFD_FCB FCB = FileObject->FsContext; UINT i; PAFD_IN_FLIGHT_REQUEST InFlightRequest[IN_FLIGHT_REQUESTS]; + PAFD_TDI_OBJECT_QELT Qelt; + PLIST_ENTRY QeltEntry; + AFD_DbgPrint(MID_TRACE, ("AfdClose(DeviceObject %p Irp %p)\n", DeviceObject, Irp)); @@ -401,14 +431,12 @@ AfdCloseSocket(PDEVICE_OBJECT DeviceObject, PIRP Irp, if( !SocketAcquireStateLock( FCB ) ) return STATUS_FILE_CLOSED; FCB->State = SOCKET_STATE_CLOSED; - FCB->PollState = AFD_EVENT_CLOSE; - FCB->PollStatus[FD_CLOSE_BIT] = STATUS_SUCCESS; //I think we can return success here - PollReeval( FCB->DeviceExt, FCB->FileObject ); InFlightRequest[0] = &FCB->ListenIrp; InFlightRequest[1] = &FCB->ReceiveIrp; InFlightRequest[2] = &FCB->SendIrp; InFlightRequest[3] = &FCB->ConnectIrp; + InFlightRequest[4] = &FCB->DisconnectIrp; /* Cancel our pending requests */ for( i = 0; i < IN_FLIGHT_REQUESTS; i++ ) { @@ -421,6 +449,25 @@ AfdCloseSocket(PDEVICE_OBJECT DeviceObject, PIRP Irp, KillSelectsForFCB( FCB->DeviceExt, FileObject, FALSE ); + ASSERT(IsListEmpty(&FCB->PendingIrpList[FUNCTION_CONNECT])); + ASSERT(IsListEmpty(&FCB->PendingIrpList[FUNCTION_SEND])); + ASSERT(IsListEmpty(&FCB->PendingIrpList[FUNCTION_RECV])); + ASSERT(IsListEmpty(&FCB->PendingIrpList[FUNCTION_PREACCEPT])); + ASSERT(IsListEmpty(&FCB->PendingIrpList[FUNCTION_DISCONNECT])); + + while (!IsListEmpty(&FCB->PendingConnections)) + { + QeltEntry = RemoveHeadList(&FCB->PendingConnections); + Qelt = CONTAINING_RECORD(QeltEntry, AFD_TDI_OBJECT_QELT, ListEntry); + + /* We have to close all pending connections or the listen won't get closed */ + TdiDisassociateAddressFile(Qelt->Object.Object); + ObDereferenceObject(Qelt->Object.Object); + ZwClose(Qelt->Object.Handle); + + ExFreePool(Qelt); + } + SocketStateUnlock( FCB ); if( FCB->EventSelect ) @@ -438,8 +485,11 @@ AfdCloseSocket(PDEVICE_OBJECT DeviceObject, PIRP Irp, if( FCB->AddressFrom ) ExFreePool( FCB->AddressFrom ); - if( FCB->ConnectInfo ) - ExFreePool( FCB->ConnectInfo ); + if( FCB->ConnectCallInfo ) + ExFreePool( FCB->ConnectCallInfo ); + + if( FCB->ConnectReturnInfo ) + ExFreePool( FCB->ConnectReturnInfo ); if( FCB->ConnectData ) ExFreePool( FCB->ConnectData ); @@ -460,7 +510,10 @@ AfdCloseSocket(PDEVICE_OBJECT DeviceObject, PIRP Irp, ExFreePool( FCB->RemoteAddress ); if( FCB->Connection.Object ) + { + TdiDisassociateAddressFile(FCB->Connection.Object); ObDereferenceObject(FCB->Connection.Object); + } if( FCB->AddressFile.Object ) ObDereferenceObject(FCB->AddressFile.Object); @@ -495,83 +548,258 @@ AfdCloseSocket(PDEVICE_OBJECT DeviceObject, PIRP Irp, return STATUS_SUCCESS; } +static +NTSTATUS +NTAPI +DisconnectComplete(PDEVICE_OBJECT DeviceObject, + PIRP Irp, + PVOID Context) +{ + PAFD_FCB FCB = Context; + PIRP CurrentIrp; + PLIST_ENTRY CurrentEntry; + + if( !SocketAcquireStateLock( FCB ) ) + return STATUS_FILE_CLOSED; + + ASSERT(FCB->DisconnectIrp.InFlightRequest == Irp); + FCB->DisconnectIrp.InFlightRequest = NULL; + + ASSERT(FCB->DisconnectPending); + ASSERT((IsListEmpty(&FCB->PendingIrpList[FUNCTION_SEND]) && !FCB->SendIrp.InFlightRequest) || + (FCB->DisconnectFlags & TDI_DISCONNECT_ABORT)); + + if (NT_SUCCESS(Irp->IoStatus.Status) && (FCB->DisconnectFlags & TDI_DISCONNECT_RELEASE)) + { + FCB->FilledDisconnectData = MIN(FCB->DisconnectDataSize, FCB->ConnectReturnInfo->UserDataLength); + if (FCB->FilledDisconnectData) + { + RtlCopyMemory(FCB->DisconnectData, + FCB->ConnectReturnInfo->UserData, + FCB->FilledDisconnectData); + } + + FCB->FilledDisconnectOptions = MIN(FCB->DisconnectOptionsSize, FCB->ConnectReturnInfo->OptionsLength); + if (FCB->FilledDisconnectOptions) + { + RtlCopyMemory(FCB->DisconnectOptions, + FCB->ConnectReturnInfo->Options, + FCB->FilledDisconnectOptions); + } + } + + FCB->DisconnectPending = FALSE; + + while (!IsListEmpty(&FCB->PendingIrpList[FUNCTION_DISCONNECT])) + { + CurrentEntry = RemoveHeadList(&FCB->PendingIrpList[FUNCTION_DISCONNECT]); + CurrentIrp = CONTAINING_RECORD(CurrentEntry, IRP, Tail.Overlay.ListEntry); + CurrentIrp->IoStatus.Status = Irp->IoStatus.Status; + CurrentIrp->IoStatus.Information = 0; + UnlockRequest(CurrentIrp, IoGetCurrentIrpStackLocation(CurrentIrp)); + (void)IoSetCancelRoutine(CurrentIrp, NULL); + IoCompleteRequest(CurrentIrp, IO_NETWORK_INCREMENT ); + } + + if (!(FCB->DisconnectFlags & TDI_DISCONNECT_RELEASE)) + { + /* Signal complete connection closure immediately */ + FCB->PollState |= AFD_EVENT_ABORT; + FCB->PollStatus[FD_CLOSE_BIT] = Irp->IoStatus.Status; + PollReeval(FCB->DeviceExt, FCB->FileObject); + } + + SocketStateUnlock(FCB); + + return Irp->IoStatus.Status; +} + +static +NTSTATUS +DoDisconnect(PAFD_FCB FCB) +{ + NTSTATUS Status; + + ASSERT(FCB->DisconnectPending); + ASSERT((IsListEmpty(&FCB->PendingIrpList[FUNCTION_SEND]) && !FCB->SendIrp.InFlightRequest) || + (FCB->DisconnectFlags & TDI_DISCONNECT_ABORT)); + + if (FCB->DisconnectIrp.InFlightRequest) + { + return STATUS_PENDING; + } + + FCB->ConnectCallInfo->UserData = FCB->DisconnectData; + FCB->ConnectCallInfo->UserDataLength = FCB->DisconnectDataSize; + FCB->ConnectCallInfo->Options = FCB->DisconnectOptions; + FCB->ConnectCallInfo->OptionsLength = FCB->DisconnectOptionsSize; + + Status = TdiDisconnect(&FCB->DisconnectIrp.InFlightRequest, + FCB->Connection.Object, + &FCB->DisconnectTimeout, + FCB->DisconnectFlags, + &FCB->DisconnectIrp.Iosb, + DisconnectComplete, + FCB, + FCB->ConnectCallInfo, + FCB->ConnectReturnInfo); + if (Status != STATUS_PENDING) + { + FCB->DisconnectPending = FALSE; + } + + return Status; +} + +VOID +RetryDisconnectCompletion(PAFD_FCB FCB) +{ + ASSERT(FCB->RemoteAddress); + + if (IsListEmpty(&FCB->PendingIrpList[FUNCTION_SEND]) && !FCB->SendIrp.InFlightRequest && FCB->DisconnectPending) + { + /* Sends are done; fire off a TDI_DISCONNECT request */ + DoDisconnect(FCB); + } +} + static NTSTATUS NTAPI AfdDisconnect(PDEVICE_OBJECT DeviceObject, PIRP Irp, PIO_STACK_LOCATION IrpSp) { PFILE_OBJECT FileObject = IrpSp->FileObject; PAFD_FCB FCB = FileObject->FsContext; PAFD_DISCONNECT_INFO DisReq; - IO_STATUS_BLOCK Iosb; - PTDI_CONNECTION_INFORMATION ConnectionReturnInfo; NTSTATUS Status = STATUS_SUCCESS; - USHORT Flags = 0; + USHORT Flags; + PLIST_ENTRY CurrentEntry; + PIRP CurrentIrp; if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp ); if( !(DisReq = LockRequest( Irp, IrpSp )) ) return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY, Irp, 0 ); + + /* Send direction only */ + if ((DisReq->DisconnectType & AFD_DISCONNECT_SEND) && + !(DisReq->DisconnectType & AFD_DISCONNECT_RECV)) + { + /* Perform a controlled disconnect */ + Flags = TDI_DISCONNECT_RELEASE; + } + /* Receive direction or both */ + else + { + /* Mark that we can't issue another receive request */ + FCB->TdiReceiveClosed = TRUE; + + /* Try to cancel a pending TDI receive IRP if there was one in progress */ + if (FCB->ReceiveIrp.InFlightRequest) + IoCancelIrp(FCB->ReceiveIrp.InFlightRequest); + + /* Discard any pending data */ + FCB->Recv.Content = 0; + FCB->Recv.BytesUsed = 0; + + /* Mark us as overread to complete future reads with an error */ + FCB->Overread = TRUE; + + /* Set a successful close status to indicate a shutdown on overread */ + FCB->PollStatus[FD_CLOSE_BIT] = STATUS_SUCCESS; + + /* Clear the receive event */ + FCB->PollState &= ~AFD_EVENT_RECEIVE; + + /* Receive direction only */ + if ((DisReq->DisconnectType & AFD_DISCONNECT_RECV) && + !(DisReq->DisconnectType & AFD_DISCONNECT_SEND)) + { + /* No need to tell the transport driver for receive direction only */ + return UnlockAndMaybeComplete( FCB, STATUS_SUCCESS, Irp, 0 ); + } + else + { + /* Perform an abortive disconnect */ + Flags = TDI_DISCONNECT_ABORT; + } + } if (!(FCB->Flags & AFD_ENDPOINT_CONNECTIONLESS)) { - if( !FCB->ConnectInfo ) + if( !FCB->ConnectCallInfo ) + { + AFD_DbgPrint(MIN_TRACE,("Invalid parameter\n")); return UnlockAndMaybeComplete( FCB, STATUS_INVALID_PARAMETER, Irp, 0 ); - - ASSERT(FCB->RemoteAddress); - - Status = TdiBuildNullConnectionInfo - ( &ConnectionReturnInfo, FCB->RemoteAddress->Address[0].AddressType ); - - if( !NT_SUCCESS(Status) ) - return UnlockAndMaybeComplete( FCB, Status, - Irp, 0 ); - - if( DisReq->DisconnectType & AFD_DISCONNECT_SEND ) - Flags |= TDI_DISCONNECT_RELEASE; - if( DisReq->DisconnectType & AFD_DISCONNECT_RECV || - DisReq->DisconnectType & AFD_DISCONNECT_ABORT ) - Flags |= TDI_DISCONNECT_ABORT; - - FCB->ConnectInfo->UserData = FCB->DisconnectData; - FCB->ConnectInfo->UserDataLength = FCB->DisconnectDataSize; - FCB->ConnectInfo->Options = FCB->DisconnectOptions; - FCB->ConnectInfo->OptionsLength = FCB->DisconnectOptionsSize; - - Status = TdiDisconnect( FCB->Connection.Object, - &DisReq->Timeout, - Flags, - &Iosb, - NULL, - NULL, - FCB->ConnectInfo, - ConnectionReturnInfo); - - if (NT_SUCCESS(Status)) { - FCB->FilledDisconnectData = MIN(FCB->DisconnectDataSize, ConnectionReturnInfo->UserDataLength); - if (FCB->FilledDisconnectData) - { - RtlCopyMemory(FCB->DisconnectData, - ConnectionReturnInfo->UserData, - FCB->FilledDisconnectData); - } - - FCB->FilledDisconnectOptions = MIN(FCB->DisconnectOptionsSize, ConnectionReturnInfo->OptionsLength); - if (FCB->FilledDisconnectOptions) - { - RtlCopyMemory(FCB->DisconnectOptions, - ConnectionReturnInfo->Options, - FCB->FilledDisconnectOptions); - } } - ExFreePool( ConnectionReturnInfo ); + if (FCB->DisconnectPending) + { + if (FCB->DisconnectIrp.InFlightRequest) + { + IoCancelIrp(FCB->DisconnectIrp.InFlightRequest); + ASSERT(!FCB->DisconnectIrp.InFlightRequest); + } + else + { + while (!IsListEmpty(&FCB->PendingIrpList[FUNCTION_DISCONNECT])) + { + CurrentEntry = RemoveHeadList(&FCB->PendingIrpList[FUNCTION_DISCONNECT]); + CurrentIrp = CONTAINING_RECORD(CurrentEntry, IRP, Tail.Overlay.ListEntry); + CurrentIrp->IoStatus.Status = STATUS_CANCELLED; + CurrentIrp->IoStatus.Information = 0; + UnlockRequest(CurrentIrp, IoGetCurrentIrpStackLocation(CurrentIrp)); + (void)IoSetCancelRoutine(CurrentIrp, NULL); + IoCompleteRequest(CurrentIrp, IO_NETWORK_INCREMENT ); + } + } + } + + FCB->DisconnectFlags = Flags; + FCB->DisconnectTimeout = DisReq->Timeout; + FCB->DisconnectPending = TRUE; + FCB->SendClosed = TRUE; + FCB->PollState &= ~AFD_EVENT_SEND; + + Status = QueueUserModeIrp(FCB, Irp, FUNCTION_DISCONNECT); + if (Status == STATUS_PENDING) + { + if ((IsListEmpty(&FCB->PendingIrpList[FUNCTION_SEND]) && !FCB->SendIrp.InFlightRequest) || + (FCB->DisconnectFlags & TDI_DISCONNECT_ABORT)) + { + /* Go ahead and execute the disconnect because we're ready for it */ + Status = DoDisconnect(FCB); + } + + if (Status != STATUS_PENDING) + RemoveEntryList(&Irp->Tail.Overlay.ListEntry); + } + + if (Status == STATUS_PENDING) + { + SocketStateUnlock(FCB); - FCB->PollState |= AFD_EVENT_DISCONNECT; - FCB->PollStatus[FD_CLOSE_BIT] = STATUS_SUCCESS; - PollReeval( FCB->DeviceExt, FCB->FileObject ); - } else - Status = STATUS_INVALID_PARAMETER; + return Status; + } + } + else + { + if (!(Flags & TDI_DISCONNECT_RELEASE)) + { + if (!FCB->RemoteAddress) + { + AFD_DbgPrint(MIN_TRACE,("Invalid parameter\n")); + return UnlockAndMaybeComplete(FCB, STATUS_INVALID_PARAMETER, Irp, 0); + } + + ExFreePool(FCB->RemoteAddress); + + FCB->RemoteAddress = NULL; + } + + FCB->PollState &= ~AFD_EVENT_SEND; + FCB->SendClosed = TRUE; + } return UnlockAndMaybeComplete( FCB, Status, Irp, 0 ); } @@ -759,6 +987,81 @@ AfdDispatch(PDEVICE_OBJECT DeviceObject, PIRP Irp) return (Status); } +BOOLEAN CheckUnlockExtraBuffers(PAFD_FCB FCB, PIO_STACK_LOCATION IrpSp) +{ + if (FCB->Flags & AFD_ENDPOINT_CONNECTIONLESS) + { + if (IrpSp->MajorFunction == IRP_MJ_READ || IrpSp->MajorFunction == IRP_MJ_WRITE) + { + /* read()/write() call - no extra buffers */ + return FALSE; + } + else if (IrpSp->MajorFunction == IRP_MJ_DEVICE_CONTROL) + { + if (IrpSp->Parameters.DeviceIoControl.IoControlCode == IOCTL_AFD_RECV_DATAGRAM) + { + /* recvfrom() call - extra buffers */ + return TRUE; + } + else if (IrpSp->Parameters.DeviceIoControl.IoControlCode == IOCTL_AFD_RECV) + { + /* recv() call - no extra buffers */ + return FALSE; + } + else if (IrpSp->Parameters.DeviceIoControl.IoControlCode == IOCTL_AFD_SEND || + IrpSp->Parameters.DeviceIoControl.IoControlCode == IOCTL_AFD_SEND_DATAGRAM) + { + /* send()/sendto() call - no extra buffers */ + return FALSE; + } + else + { + /* Unknown IOCTL */ + ASSERT(FALSE); + return FALSE; + } + } + else + { + /* Unknown IRP_MJ code */ + ASSERT(FALSE); + return FALSE; + } + } + else + { + /* Connection-oriented never has extra buffers */ + return FALSE; + } +} + +VOID +CleanupPendingIrp(PAFD_FCB FCB, PIRP Irp, PIO_STACK_LOCATION IrpSp, PAFD_ACTIVE_POLL Poll) +{ + PAFD_RECV_INFO RecvReq; + PAFD_SEND_INFO SendReq; + PAFD_POLL_INFO PollReq; + + if (IrpSp->Parameters.DeviceIoControl.IoControlCode == IOCTL_AFD_RECV || + IrpSp->MajorFunction == IRP_MJ_READ) + { + RecvReq = GetLockedData(Irp, IrpSp); + UnlockBuffers(RecvReq->BufferArray, RecvReq->BufferCount, CheckUnlockExtraBuffers(FCB, IrpSp)); + } + else if ((IrpSp->Parameters.DeviceIoControl.IoControlCode == IOCTL_AFD_SEND || + IrpSp->MajorFunction == IRP_MJ_WRITE)) + { + SendReq = GetLockedData(Irp, IrpSp); + UnlockBuffers(SendReq->BufferArray, SendReq->BufferCount, CheckUnlockExtraBuffers(FCB, IrpSp)); + } + else if (IrpSp->Parameters.DeviceIoControl.IoControlCode == IOCTL_AFD_SELECT) + { + PollReq = Irp->AssociatedIrp.SystemBuffer; + ZeroEvents(PollReq->Handles, PollReq->HandleCount); + SignalSocket(Poll, NULL, PollReq, STATUS_CANCELLED); + } +} + VOID NTAPI AfdCancelHandler(PDEVICE_OBJECT DeviceObject, PIRP Irp) @@ -766,39 +1069,46 @@ AfdCancelHandler(PDEVICE_OBJECT DeviceObject, PIO_STACK_LOCATION IrpSp = IoGetCurrentIrpStackLocation(Irp); PFILE_OBJECT FileObject = IrpSp->FileObject; PAFD_FCB FCB = FileObject->FsContext; - UINT Function; - PAFD_RECV_INFO RecvReq; - PAFD_SEND_INFO SendReq; - PLIST_ENTRY CurrentEntry; + ULONG Function, IoctlCode; PIRP CurrentIrp; + PLIST_ENTRY CurrentEntry; PAFD_DEVICE_EXTENSION DeviceExt = DeviceObject->DeviceExtension; KIRQL OldIrql; PAFD_ACTIVE_POLL Poll; - PAFD_POLL_INFO PollReq; IoReleaseCancelSpinLock(Irp->CancelIrql); - + if (!SocketAcquireStateLock(FCB)) return; + + switch (IrpSp->MajorFunction) + { + case IRP_MJ_DEVICE_CONTROL: + IoctlCode = IrpSp->Parameters.DeviceIoControl.IoControlCode; + break; + + case IRP_MJ_READ: + IoctlCode = IOCTL_AFD_RECV; + break; + + case IRP_MJ_WRITE: + IoctlCode = IOCTL_AFD_SEND; + break; + + default: + ASSERT(FALSE); + SocketStateUnlock(FCB); + return; + } - ASSERT(IrpSp->MajorFunction == IRP_MJ_DEVICE_CONTROL); - - switch (IrpSp->Parameters.DeviceIoControl.IoControlCode) + switch (IoctlCode) { case IOCTL_AFD_RECV: - RecvReq = IrpSp->Parameters.DeviceIoControl.Type3InputBuffer; - UnlockBuffers(RecvReq->BufferArray, RecvReq->BufferCount, FALSE); - /* Fall through */ - case IOCTL_AFD_RECV_DATAGRAM: Function = FUNCTION_RECV; break; case IOCTL_AFD_SEND: - SendReq = IrpSp->Parameters.DeviceIoControl.Type3InputBuffer; - UnlockBuffers(SendReq->BufferArray, SendReq->BufferCount, FALSE); - /* Fall through */ - case IOCTL_AFD_SEND_DATAGRAM: Function = FUNCTION_SEND; break; @@ -818,14 +1128,13 @@ AfdCancelHandler(PDEVICE_OBJECT DeviceObject, while (CurrentEntry != &DeviceExt->Polls) { Poll = CONTAINING_RECORD(CurrentEntry, AFD_ACTIVE_POLL, ListEntry); - CurrentIrp = Poll->Irp; - PollReq = CurrentIrp->AssociatedIrp.SystemBuffer; - if (CurrentIrp == Irp) + if (Irp == Poll->Irp) { - ZeroEvents(PollReq->Handles, PollReq->HandleCount); - SignalSocket(Poll, NULL, PollReq, STATUS_CANCELLED); - break; + CleanupPendingIrp(FCB, Irp, IrpSp, Poll); + KeReleaseSpinLock(&DeviceExt->Lock, OldIrql); + SocketStateUnlock(FCB); + return; } else { @@ -835,10 +1144,15 @@ AfdCancelHandler(PDEVICE_OBJECT DeviceObject, KeReleaseSpinLock(&DeviceExt->Lock, OldIrql); - /* IRP already completed by SignalSocket */ SocketStateUnlock(FCB); + + DbgPrint("WARNING!!! IRP cancellation race could lead to a process hang! (IOCTL_AFD_SELECT)\n"); return; + case IOCTL_AFD_DISCONNECT: + Function = FUNCTION_DISCONNECT; + break; + default: ASSERT(FALSE); UnlockAndMaybeComplete(FCB, STATUS_CANCELLED, Irp, 0); @@ -853,7 +1167,9 @@ AfdCancelHandler(PDEVICE_OBJECT DeviceObject, if (CurrentIrp == Irp) { RemoveEntryList(CurrentEntry); - break; + CleanupPendingIrp(FCB, Irp, IrpSp, NULL); + UnlockAndMaybeComplete(FCB, STATUS_CANCELLED, Irp, 0); + return; } else { @@ -861,7 +1177,9 @@ AfdCancelHandler(PDEVICE_OBJECT DeviceObject, } } - UnlockAndMaybeComplete(FCB, STATUS_CANCELLED, Irp, 0); + SocketStateUnlock(FCB); + + DbgPrint("WARNING!!! IRP cancellation race could lead to a process hang! (Function: %d)\n", Function); } static VOID NTAPI diff --git a/drivers/network/afd/afd/read.c b/drivers/network/afd/afd/read.c index 91b20b2390e..05f1c3ee571 100644 --- a/drivers/network/afd/afd/read.c +++ b/drivers/network/afd/afd/read.c @@ -22,58 +22,66 @@ * in flight. */ #include "afd.h" -#include "tdi_proto.h" -#include "tdiconn.h" -#include "debug.h" -static VOID HandleEOFOnIrp( PAFD_FCB FCB, NTSTATUS Status, ULONG_PTR Information ) +static VOID HandleReceiveComplete( PAFD_FCB FCB, NTSTATUS Status, ULONG_PTR Information ) { - if( ( Status == STATUS_SUCCESS && !Information ) || - ( !NT_SUCCESS( Status ) ) ) - { - /* The socket has been closed */ - FCB->PollState |= AFD_EVENT_DISCONNECT; + FCB->Recv.BytesUsed = 0; + + /* We got closed while the receive was in progress */ + if (FCB->TdiReceiveClosed) + { + FCB->Recv.Content = 0; + } + /* Receive successful with new data */ + else if (Status == STATUS_SUCCESS && Information) + { + FCB->Recv.Content = Information; + } + /* Receive successful with no data (graceful closure) */ + else if (Status == STATUS_SUCCESS) + { + FCB->Recv.Content = 0; + FCB->TdiReceiveClosed = TRUE; + + /* Signal graceful receive shutdown */ + FCB->PollState |= AFD_EVENT_DISCONNECT; + FCB->PollStatus[FD_CLOSE_BIT] = Status; + + PollReeval( FCB->DeviceExt, FCB->FileObject ); + } + /* Receive failed with no data (unexpected closure) */ + else + { + FCB->Recv.Content = 0; + FCB->TdiReceiveClosed = TRUE; + + /* Signal complete connection failure immediately */ + FCB->PollState |= AFD_EVENT_CLOSE; FCB->PollStatus[FD_CLOSE_BIT] = Status; - + PollReeval( FCB->DeviceExt, FCB->FileObject ); - } + } } static BOOLEAN CantReadMore( PAFD_FCB FCB ) { UINT BytesAvailable = FCB->Recv.Content - FCB->Recv.BytesUsed; - return !BytesAvailable && - (FCB->PollState & (AFD_EVENT_CLOSE | AFD_EVENT_DISCONNECT)); + return !BytesAvailable && FCB->TdiReceiveClosed; } static VOID RefillSocketBuffer( PAFD_FCB FCB ) { - NTSTATUS Status; - - if( !FCB->ReceiveIrp.InFlightRequest ) { + if( !FCB->ReceiveIrp.InFlightRequest && + !FCB->TdiReceiveClosed ) { AFD_DbgPrint(MID_TRACE,("Replenishing buffer\n")); - Status = TdiReceive( &FCB->ReceiveIrp.InFlightRequest, - FCB->Connection.Object, - TDI_RECEIVE_NORMAL, - FCB->Recv.Window, - FCB->Recv.Size, - &FCB->ReceiveIrp.Iosb, - ReceiveComplete, - FCB ); - - if( Status == STATUS_SUCCESS && FCB->ReceiveIrp.Iosb.Information ) - { - FCB->Recv.Content = FCB->ReceiveIrp.Iosb.Information; - FCB->PollState |= AFD_EVENT_RECEIVE; - FCB->PollStatus[FD_READ_BIT] = STATUS_SUCCESS; - - PollReeval( FCB->DeviceExt, FCB->FileObject ); - } - else - { - /* Check for EOF */ - HandleEOFOnIrp(FCB, Status, FCB->ReceiveIrp.Iosb.Information); - } + TdiReceive( &FCB->ReceiveIrp.InFlightRequest, + FCB->Connection.Object, + TDI_RECEIVE_NORMAL, + FCB->Recv.Window, + FCB->Recv.Size, + &FCB->ReceiveIrp.Iosb, + ReceiveComplete, + FCB ); } } @@ -166,14 +174,23 @@ static NTSTATUS ReceiveActivity( PAFD_FCB FCB, PIRP Irp ) { NextIrp = CONTAINING_RECORD(NextIrpEntry, IRP, Tail.Overlay.ListEntry); NextIrpSp = IoGetCurrentIrpStackLocation( NextIrp ); - RecvReq = NextIrpSp->Parameters.DeviceIoControl.Type3InputBuffer; + RecvReq = GetLockedData(NextIrp, NextIrpSp); AFD_DbgPrint(MID_TRACE,("Completing recv %x (%d)\n", NextIrp, TotalBytesCopied)); UnlockBuffers( RecvReq->BufferArray, RecvReq->BufferCount, FALSE ); - Status = NextIrp->IoStatus.Status = - FCB->Overread ? STATUS_END_OF_FILE : STATUS_SUCCESS; + if (FCB->Overread && FCB->PollStatus[FD_CLOSE_BIT] == STATUS_SUCCESS) + { + /* Overread after a graceful disconnect so complete with an error */ + Status = STATUS_FILE_CLOSED; + } + else + { + /* Unexpected disconnect by the remote host or initial read after a graceful disconnnect */ + Status = FCB->PollStatus[FD_CLOSE_BIT]; + } + NextIrp->IoStatus.Status = Status; NextIrp->IoStatus.Information = 0; if( NextIrp == Irp ) RetStatus = Status; if( NextIrp->MdlAddress ) UnlockRequest( NextIrp, IoGetCurrentIrpStackLocation( NextIrp ) ); @@ -196,7 +213,7 @@ static NTSTATUS ReceiveActivity( PAFD_FCB FCB, PIRP Irp ) { NextIrp = CONTAINING_RECORD(NextIrpEntry, IRP, Tail.Overlay.ListEntry); NextIrpSp = IoGetCurrentIrpStackLocation( NextIrp ); - RecvReq = NextIrpSp->Parameters.DeviceIoControl.Type3InputBuffer; + RecvReq = GetLockedData(NextIrp, NextIrpSp); AFD_DbgPrint(MID_TRACE,("RecvReq @ %x\n", RecvReq)); @@ -226,12 +243,16 @@ static NTSTATUS ReceiveActivity( PAFD_FCB FCB, PIRP Irp ) { } } - if( FCB->Recv.Content ) { + if( FCB->Recv.Content - FCB->Recv.BytesUsed && + IsListEmpty(&FCB->PendingIrpList[FUNCTION_RECV]) ) { FCB->PollState |= AFD_EVENT_RECEIVE; FCB->PollStatus[FD_READ_BIT] = STATUS_SUCCESS; PollReeval( FCB->DeviceExt, FCB->FileObject ); - } else + } + else + { FCB->PollState &= ~AFD_EVENT_RECEIVE; + } AFD_DbgPrint(MID_TRACE,("RetStatus for irp %x is %x\n", Irp, RetStatus)); @@ -259,19 +280,16 @@ NTSTATUS NTAPI ReceiveComplete if( !SocketAcquireStateLock( FCB ) ) return STATUS_FILE_CLOSED; + ASSERT(FCB->ReceiveIrp.InFlightRequest == Irp); FCB->ReceiveIrp.InFlightRequest = NULL; - FCB->Recv.Content = Irp->IoStatus.Information; - FCB->Recv.BytesUsed = 0; - if( FCB->State == SOCKET_STATE_CLOSED ) { - AFD_DbgPrint(MIN_TRACE,("!!! CLOSING SOCK GOT A RECEIVE COMPLETE !!!\n")); /* Cleanup our IRP queue because the FCB is being destroyed */ while( !IsListEmpty( &FCB->PendingIrpList[FUNCTION_RECV] ) ) { NextIrpEntry = RemoveHeadList(&FCB->PendingIrpList[FUNCTION_RECV]); NextIrp = CONTAINING_RECORD(NextIrpEntry, IRP, Tail.Overlay.ListEntry); NextIrpSp = IoGetCurrentIrpStackLocation(NextIrp); - RecvReq = NextIrpSp->Parameters.DeviceIoControl.Type3InputBuffer; + RecvReq = GetLockedData(NextIrp, NextIrpSp); NextIrp->IoStatus.Status = STATUS_FILE_CLOSED; NextIrp->IoStatus.Information = 0; UnlockBuffers(RecvReq->BufferArray, RecvReq->BufferCount, FALSE); @@ -287,7 +305,7 @@ NTSTATUS NTAPI ReceiveComplete return STATUS_INVALID_PARAMETER; } - HandleEOFOnIrp( FCB, Irp->IoStatus.Status, Irp->IoStatus.Information ); + HandleReceiveComplete( FCB, Irp->IoStatus.Status, Irp->IoStatus.Information ); ReceiveActivity( FCB, NULL ); @@ -296,6 +314,108 @@ NTSTATUS NTAPI ReceiveComplete return STATUS_SUCCESS; } +static NTSTATUS NTAPI +SatisfyPacketRecvRequest( PAFD_FCB FCB, PIRP Irp, + PAFD_STORED_DATAGRAM DatagramRecv, + PUINT TotalBytesCopied ) { + NTSTATUS Status = STATUS_SUCCESS; + PIO_STACK_LOCATION IrpSp = IoGetCurrentIrpStackLocation( Irp ); + PAFD_RECV_INFO RecvReq = + GetLockedData(Irp, IrpSp); + UINT BytesToCopy = 0, BytesAvailable = DatagramRecv->Len, AddrLen = 0; + PAFD_MAPBUF Map; + BOOLEAN ExtraBuffers = CheckUnlockExtraBuffers(FCB, IrpSp); + + Map = (PAFD_MAPBUF)(RecvReq->BufferArray + + RecvReq->BufferCount + + (ExtraBuffers ? EXTRA_LOCK_BUFFERS : 0)); + + BytesToCopy = + MIN( RecvReq->BufferArray[0].len, BytesAvailable ); + + AFD_DbgPrint(MID_TRACE,("BytesToCopy: %d len %d\n", BytesToCopy, + RecvReq->BufferArray[0].len)); + + if( Map[0].Mdl ) { + /* Copy the address */ + if( ExtraBuffers && Map[1].Mdl && Map[2].Mdl ) { + AFD_DbgPrint(MID_TRACE,("Checking TAAddressCount\n")); + + if( DatagramRecv->Address->TAAddressCount != 1 ) { + AFD_DbgPrint + (MIN_TRACE, + ("Wierd address count %d\n", + DatagramRecv->Address->TAAddressCount)); + } + + AFD_DbgPrint(MID_TRACE,("Computing addr len\n")); + + AddrLen = MIN(DatagramRecv->Address->Address->AddressLength + + sizeof(USHORT), + RecvReq->BufferArray[1].len); + + AFD_DbgPrint(MID_TRACE,("Copying %d bytes of address\n", AddrLen)); + + Map[1].BufferAddress = MmMapLockedPages( Map[1].Mdl, KernelMode ); + + AFD_DbgPrint(MID_TRACE,("Done mapping, copying address\n")); + + RtlCopyMemory( Map[1].BufferAddress, + &DatagramRecv->Address->Address->AddressType, + AddrLen ); + + MmUnmapLockedPages( Map[1].BufferAddress, Map[1].Mdl ); + + AFD_DbgPrint(MID_TRACE,("Copying address len\n")); + + Map[2].BufferAddress = MmMapLockedPages( Map[2].Mdl, KernelMode ); + *((PINT)Map[2].BufferAddress) = AddrLen; + MmUnmapLockedPages( Map[2].BufferAddress, Map[2].Mdl ); + } + + AFD_DbgPrint(MID_TRACE,("Mapping data buffer pages\n")); + + Map[0].BufferAddress = MmMapLockedPages( Map[0].Mdl, KernelMode ); + + AFD_DbgPrint(MID_TRACE,("Buffer %d: %x:%d\n", + 0, + Map[0].BufferAddress, + BytesToCopy)); + + RtlCopyMemory( Map[0].BufferAddress, + DatagramRecv->Buffer, + BytesToCopy ); + + MmUnmapLockedPages( Map[0].BufferAddress, Map[0].Mdl ); + + *TotalBytesCopied = BytesToCopy; + } + + if (*TotalBytesCopied == DatagramRecv->Len) + { + /* We copied the whole datagram */ + Status = Irp->IoStatus.Status = STATUS_SUCCESS; + } + else + { + /* We only copied part of the datagram */ + Status = Irp->IoStatus.Status = STATUS_BUFFER_OVERFLOW; + } + + Irp->IoStatus.Information = *TotalBytesCopied; + + if (!(RecvReq->TdiFlags & TDI_RECEIVE_PEEK)) + { + FCB->Recv.Content -= *TotalBytesCopied; + ExFreePool( DatagramRecv->Address ); + ExFreePool( DatagramRecv ); + } + + AFD_DbgPrint(MID_TRACE,("Done\n")); + + return Status; +} + NTSTATUS NTAPI AfdConnectedSocketReadData(PDEVICE_OBJECT DeviceObject, PIRP Irp, PIO_STACK_LOCATION IrpSp, BOOLEAN Short) { @@ -304,40 +424,81 @@ AfdConnectedSocketReadData(PDEVICE_OBJECT DeviceObject, PIRP Irp, PAFD_FCB FCB = FileObject->FsContext; PAFD_RECV_INFO RecvReq; UINT TotalBytesCopied = 0; + PAFD_STORED_DATAGRAM DatagramRecv; + PLIST_ENTRY ListEntry; AFD_DbgPrint(MID_TRACE,("Called on %x\n", FCB)); if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp ); - if( FCB->State != SOCKET_STATE_CONNECTED && + if( !(FCB->Flags & AFD_ENDPOINT_CONNECTIONLESS) && + FCB->State != SOCKET_STATE_CONNECTED && FCB->State != SOCKET_STATE_CONNECTING ) { - AFD_DbgPrint(MID_TRACE,("Called recv on wrong kind of socket (s%x)\n", + AFD_DbgPrint(MIN_TRACE,("Called recv on wrong kind of socket (s%x)\n", FCB->State)); return UnlockAndMaybeComplete( FCB, STATUS_INVALID_PARAMETER, Irp, 0 ); } + + if( !(RecvReq = LockRequest( Irp, IrpSp )) ) + return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY, + Irp, 0 ); + + AFD_DbgPrint(MID_TRACE,("Recv flags %x\n", RecvReq->AfdFlags)); + + RecvReq->BufferArray = LockBuffers( RecvReq->BufferArray, + RecvReq->BufferCount, + NULL, NULL, + TRUE, FALSE ); + + if( !RecvReq->BufferArray ) { + return UnlockAndMaybeComplete( FCB, STATUS_ACCESS_VIOLATION, + Irp, 0 ); + } + + FCB->EventSelectDisabled &= ~AFD_EVENT_RECEIVE; if( FCB->Flags & AFD_ENDPOINT_CONNECTIONLESS ) { - AFD_DbgPrint(MID_TRACE,("Receive on connection-less sockets not implemented\n")); - return UnlockAndMaybeComplete( FCB, STATUS_NOT_IMPLEMENTED, - Irp, 0 ); - } + if (!IsListEmpty(&FCB->DatagramList)) + { + ListEntry = RemoveHeadList(&FCB->DatagramList); + DatagramRecv = CONTAINING_RECORD(ListEntry, AFD_STORED_DATAGRAM, ListEntry); + Status = SatisfyPacketRecvRequest(FCB, Irp, DatagramRecv, + (PUINT)&Irp->IoStatus.Information); - if( !(RecvReq = LockRequest( Irp, IrpSp )) ) - return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY, - Irp, 0 ); + if (RecvReq->TdiFlags & TDI_RECEIVE_PEEK) + { + InsertHeadList(&FCB->DatagramList, + &DatagramRecv->ListEntry); + } - AFD_DbgPrint(MID_TRACE,("Recv flags %x\n", RecvReq->AfdFlags)); + if (!IsListEmpty(&FCB->DatagramList)) + { + FCB->PollState |= AFD_EVENT_RECEIVE; + FCB->PollStatus[FD_READ_BIT] = STATUS_SUCCESS; + PollReeval( FCB->DeviceExt, FCB->FileObject ); + } + else + FCB->PollState &= ~AFD_EVENT_RECEIVE; - RecvReq->BufferArray = LockBuffers( RecvReq->BufferArray, - RecvReq->BufferCount, - NULL, NULL, - TRUE, FALSE ); + UnlockBuffers(RecvReq->BufferArray, RecvReq->BufferCount, FALSE); - if( !RecvReq->BufferArray ) { - return UnlockAndMaybeComplete( FCB, STATUS_ACCESS_VIOLATION, - Irp, 0 ); + return UnlockAndMaybeComplete(FCB, Status, Irp, Irp->IoStatus.Information); + } + else if( (RecvReq->AfdFlags & AFD_IMMEDIATE) || (FCB->NonBlocking) ) + { + AFD_DbgPrint(MID_TRACE,("Nonblocking\n")); + Status = STATUS_CANT_WAIT; + FCB->PollState &= ~AFD_EVENT_RECEIVE; + UnlockBuffers( RecvReq->BufferArray, RecvReq->BufferCount, FALSE ); + return UnlockAndMaybeComplete( FCB, Status, Irp, 0 ); + } + else + { + FCB->PollState &= ~AFD_EVENT_RECEIVE; + return LeaveIrpUntilLater( FCB, Irp, FUNCTION_RECV ); + } } Irp->IoStatus.Status = STATUS_PENDING; @@ -350,7 +511,8 @@ AfdConnectedSocketReadData(PDEVICE_OBJECT DeviceObject, PIRP Irp, Status = ReceiveActivity( FCB, Irp ); - if( Status == STATUS_PENDING && (RecvReq->AfdFlags & AFD_IMMEDIATE) ) { + if( Status == STATUS_PENDING && + ((RecvReq->AfdFlags & AFD_IMMEDIATE) || (FCB->NonBlocking)) ) { AFD_DbgPrint(MID_TRACE,("Nonblocking\n")); Status = STATUS_CANT_WAIT; TotalBytesCopied = 0; @@ -370,100 +532,6 @@ AfdConnectedSocketReadData(PDEVICE_OBJECT DeviceObject, PIRP Irp, return Status; } - -static NTSTATUS NTAPI -SatisfyPacketRecvRequest( PAFD_FCB FCB, PIRP Irp, - PAFD_STORED_DATAGRAM DatagramRecv, - PUINT TotalBytesCopied ) { - NTSTATUS Status = STATUS_SUCCESS; - PIO_STACK_LOCATION IrpSp = IoGetCurrentIrpStackLocation( Irp ); - PAFD_RECV_INFO RecvReq = - IrpSp->Parameters.DeviceIoControl.Type3InputBuffer; - UINT BytesToCopy = 0, BytesAvailable = DatagramRecv->Len, AddrLen = 0; - PAFD_MAPBUF Map; - - Map = (PAFD_MAPBUF)(RecvReq->BufferArray + - RecvReq->BufferCount + - EXTRA_LOCK_BUFFERS); - - BytesToCopy = - MIN( RecvReq->BufferArray[0].len, BytesAvailable ); - - AFD_DbgPrint(MID_TRACE,("BytesToCopy: %d len %d\n", BytesToCopy, - RecvReq->BufferArray[0].len)); - - if( Map[0].Mdl ) { - /* Copy the address */ - if( Map[1].Mdl && Map[2].Mdl ) { - AFD_DbgPrint(MID_TRACE,("Checking TAAddressCount\n")); - - if( DatagramRecv->Address->TAAddressCount != 1 ) { - AFD_DbgPrint - (MID_TRACE, - ("Wierd address count %d\n", - DatagramRecv->Address->TAAddressCount)); - } - - AFD_DbgPrint(MID_TRACE,("Computing addr len\n")); - - AddrLen = MIN(DatagramRecv->Address->Address->AddressLength + - sizeof(USHORT), - RecvReq->BufferArray[1].len); - - AFD_DbgPrint(MID_TRACE,("Copying %d bytes of address\n", AddrLen)); - - Map[1].BufferAddress = MmMapLockedPages( Map[1].Mdl, KernelMode ); - - AFD_DbgPrint(MID_TRACE,("Done mapping, copying address\n")); - - RtlCopyMemory( Map[1].BufferAddress, - &DatagramRecv->Address->Address->AddressType, - AddrLen ); - - MmUnmapLockedPages( Map[1].BufferAddress, Map[1].Mdl ); - - AFD_DbgPrint(MID_TRACE,("Copying address len\n")); - - Map[2].BufferAddress = MmMapLockedPages( Map[2].Mdl, KernelMode ); - *((PINT)Map[2].BufferAddress) = AddrLen; - MmUnmapLockedPages( Map[2].BufferAddress, Map[2].Mdl ); - } - - AFD_DbgPrint(MID_TRACE,("Mapping data buffer pages\n")); - - Map[0].BufferAddress = MmMapLockedPages( Map[0].Mdl, KernelMode ); - - AFD_DbgPrint(MID_TRACE,("Buffer %d: %x:%d\n", - 0, - Map[0].BufferAddress, - BytesToCopy)); - - /* OskitDumpBuffer - ( FCB->Recv.Window + FCB->Recv.BytesUsed, BytesToCopy ); */ - - RtlCopyMemory( Map[0].BufferAddress, - FCB->Recv.Window + FCB->Recv.BytesUsed, - BytesToCopy ); - - MmUnmapLockedPages( Map[0].BufferAddress, Map[0].Mdl ); - - *TotalBytesCopied = BytesToCopy; - - if (!(RecvReq->TdiFlags & TDI_RECEIVE_PEEK)) { - FCB->Recv.BytesUsed = 0; - } - } - - Status = Irp->IoStatus.Status = STATUS_SUCCESS; - Irp->IoStatus.Information = BytesToCopy; - ExFreePool( DatagramRecv->Address ); - ExFreePool( DatagramRecv ); - - AFD_DbgPrint(MID_TRACE,("Done\n")); - - return Status; -} - NTSTATUS NTAPI PacketSocketRecvComplete( PDEVICE_OBJECT DeviceObject, @@ -484,6 +552,7 @@ PacketSocketRecvComplete( if( !SocketAcquireStateLock( FCB ) ) return STATUS_FILE_CLOSED; + ASSERT(FCB->ReceiveIrp.InFlightRequest == Irp); FCB->ReceiveIrp.InFlightRequest = NULL; if( FCB->State == SOCKET_STATE_CLOSED ) { @@ -492,10 +561,10 @@ PacketSocketRecvComplete( NextIrpEntry = RemoveHeadList(&FCB->PendingIrpList[FUNCTION_RECV]); NextIrp = CONTAINING_RECORD(NextIrpEntry, IRP, Tail.Overlay.ListEntry); NextIrpSp = IoGetCurrentIrpStackLocation( NextIrp ); - RecvReq = NextIrpSp->Parameters.DeviceIoControl.Type3InputBuffer; + RecvReq = GetLockedData(NextIrp, NextIrpSp); NextIrp->IoStatus.Status = STATUS_FILE_CLOSED; NextIrp->IoStatus.Information = 0; - UnlockBuffers(RecvReq->BufferArray, RecvReq->BufferCount, FALSE); + UnlockBuffers(RecvReq->BufferArray, RecvReq->BufferCount, CheckUnlockExtraBuffers(FCB, NextIrpSp)); if( NextIrp->MdlAddress ) UnlockRequest( NextIrp, IoGetCurrentIrpStackLocation( NextIrp ) ); (void)IoSetCancelRoutine(NextIrp, NULL); IoCompleteRequest( NextIrp, IO_NETWORK_INCREMENT ); @@ -512,6 +581,18 @@ PacketSocketRecvComplete( SocketStateUnlock( FCB ); return STATUS_FILE_CLOSED; } + + if (Irp->IoStatus.Status != STATUS_SUCCESS) + { + SocketStateUnlock(FCB); + return Irp->IoStatus.Status; + } + + if (FCB->TdiReceiveClosed) + { + SocketStateUnlock(FCB); + return STATUS_FILE_CLOSED; + } DatagramRecv = ExAllocatePool( NonPagedPool, DGSize ); @@ -533,6 +614,7 @@ PacketSocketRecvComplete( SocketStateUnlock( FCB ); return Status; } else { + FCB->Recv.Content += DatagramRecv->Len; InsertTailList( &FCB->DatagramList, &DatagramRecv->ListEntry ); } @@ -547,36 +629,34 @@ PacketSocketRecvComplete( ListEntry = RemoveHeadList( &FCB->PendingIrpList[FUNCTION_RECV] ); NextIrp = CONTAINING_RECORD( ListEntry, IRP, Tail.Overlay.ListEntry ); NextIrpSp = IoGetCurrentIrpStackLocation( NextIrp ); - RecvReq = NextIrpSp->Parameters.DeviceIoControl.Type3InputBuffer; + RecvReq = GetLockedData(NextIrp, NextIrpSp); AFD_DbgPrint(MID_TRACE,("RecvReq: %x, DatagramRecv: %x\n", RecvReq, DatagramRecv)); - if( DatagramRecv->Len > RecvReq->BufferArray[0].len && - !(RecvReq->TdiFlags & TDI_RECEIVE_PARTIAL) ) { - InsertHeadList( &FCB->DatagramList, - &DatagramRecv->ListEntry ); - Status = NextIrp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL; - NextIrp->IoStatus.Information = DatagramRecv->Len; - UnlockBuffers( RecvReq->BufferArray, RecvReq->BufferCount, TRUE ); - if ( NextIrp->MdlAddress ) UnlockRequest( NextIrp, IoGetCurrentIrpStackLocation( NextIrp ) ); - (void)IoSetCancelRoutine(NextIrp, NULL); - IoCompleteRequest( NextIrp, IO_NETWORK_INCREMENT ); - } else { - AFD_DbgPrint(MID_TRACE,("Satisfying\n")); - Status = SatisfyPacketRecvRequest - ( FCB, NextIrp, DatagramRecv, - (PUINT)&NextIrp->IoStatus.Information ); - AFD_DbgPrint(MID_TRACE,("Unlocking\n")); - UnlockBuffers( RecvReq->BufferArray, RecvReq->BufferCount, TRUE ); - if ( NextIrp->MdlAddress ) UnlockRequest( NextIrp, IoGetCurrentIrpStackLocation( NextIrp ) ); - AFD_DbgPrint(MID_TRACE,("Completing\n")); - (void)IoSetCancelRoutine(NextIrp, NULL); - IoCompleteRequest( NextIrp, IO_NETWORK_INCREMENT ); - } + AFD_DbgPrint(MID_TRACE,("Satisfying\n")); + Status = SatisfyPacketRecvRequest + ( FCB, NextIrp, DatagramRecv, + (PUINT)&NextIrp->IoStatus.Information ); + + if (RecvReq->TdiFlags & TDI_RECEIVE_PEEK) + { + InsertHeadList(&FCB->DatagramList, + &DatagramRecv->ListEntry); + } + + AFD_DbgPrint(MID_TRACE,("Unlocking\n")); + UnlockBuffers( RecvReq->BufferArray, RecvReq->BufferCount, CheckUnlockExtraBuffers(FCB, NextIrpSp) ); + if ( NextIrp->MdlAddress ) UnlockRequest( NextIrp, IoGetCurrentIrpStackLocation( NextIrp ) ); + + AFD_DbgPrint(MID_TRACE,("Completing\n")); + (void)IoSetCancelRoutine(NextIrp, NULL); + NextIrp->IoStatus.Status = Status; + + IoCompleteRequest( NextIrp, IO_NETWORK_INCREMENT ); } - if( !IsListEmpty( &FCB->DatagramList ) ) { + if( !IsListEmpty( &FCB->DatagramList ) && IsListEmpty(&FCB->PendingIrpList[FUNCTION_RECV]) ) { AFD_DbgPrint(MID_TRACE,("Signalling\n")); FCB->PollState |= AFD_EVENT_RECEIVE; FCB->PollStatus[FD_READ_BIT] = STATUS_SUCCESS; @@ -619,8 +699,18 @@ AfdPacketSocketReadData(PDEVICE_OBJECT DeviceObject, PIRP Irp, /* Check that the socket is bound */ if( FCB->State != SOCKET_STATE_BOUND ) + { + AFD_DbgPrint(MIN_TRACE,("Invalid socket state\n")); return UnlockAndMaybeComplete ( FCB, STATUS_INVALID_PARAMETER, Irp, 0 ); + } + + if (FCB->TdiReceiveClosed) + { + AFD_DbgPrint(MIN_TRACE,("Receive closed\n")); + return UnlockAndMaybeComplete(FCB, STATUS_FILE_CLOSED, Irp, 0); + } + if( !(RecvReq = LockRequest( Irp, IrpSp )) ) return UnlockAndMaybeComplete ( FCB, STATUS_NO_MEMORY, Irp, 0 ); @@ -638,53 +728,45 @@ AfdPacketSocketReadData(PDEVICE_OBJECT DeviceObject, PIRP Irp, ( FCB, STATUS_ACCESS_VIOLATION, Irp, 0 ); } - if( !IsListEmpty( &FCB->DatagramList ) ) { - ListEntry = RemoveHeadList( &FCB->DatagramList ); - DatagramRecv = CONTAINING_RECORD - ( ListEntry, AFD_STORED_DATAGRAM, ListEntry ); - if( DatagramRecv->Len > RecvReq->BufferArray[0].len && - !(RecvReq->TdiFlags & TDI_RECEIVE_PARTIAL) ) { - InsertHeadList( &FCB->DatagramList, - &DatagramRecv->ListEntry ); - Status = Irp->IoStatus.Status = STATUS_BUFFER_TOO_SMALL; - Irp->IoStatus.Information = DatagramRecv->Len; + FCB->EventSelectDisabled &= ~AFD_EVENT_RECEIVE; - if( !IsListEmpty( &FCB->DatagramList ) ) { - FCB->PollState |= AFD_EVENT_RECEIVE; - FCB->PollStatus[FD_READ_BIT] = STATUS_SUCCESS; - PollReeval( FCB->DeviceExt, FCB->FileObject ); - } else - FCB->PollState &= ~AFD_EVENT_RECEIVE; - - UnlockBuffers( RecvReq->BufferArray, RecvReq->BufferCount, TRUE ); - - return UnlockAndMaybeComplete - ( FCB, Status, Irp, Irp->IoStatus.Information ); - } else { - Status = SatisfyPacketRecvRequest - ( FCB, Irp, DatagramRecv, - (PUINT)&Irp->IoStatus.Information ); - - if( !IsListEmpty( &FCB->DatagramList ) ) { - FCB->PollState |= AFD_EVENT_RECEIVE; - FCB->PollStatus[FD_READ_BIT] = STATUS_SUCCESS; - PollReeval( FCB->DeviceExt, FCB->FileObject ); - } else - FCB->PollState &= ~AFD_EVENT_RECEIVE; - - UnlockBuffers( RecvReq->BufferArray, RecvReq->BufferCount, TRUE ); - - return UnlockAndMaybeComplete - ( FCB, Status, Irp, Irp->IoStatus.Information ); - } - } else if( RecvReq->AfdFlags & AFD_IMMEDIATE ) { - AFD_DbgPrint(MID_TRACE,("Nonblocking\n")); - Status = STATUS_CANT_WAIT; - FCB->PollState &= ~AFD_EVENT_RECEIVE; - UnlockBuffers( RecvReq->BufferArray, RecvReq->BufferCount, TRUE ); - return UnlockAndMaybeComplete( FCB, Status, Irp, 0 ); - } else { - FCB->PollState &= ~AFD_EVENT_RECEIVE; - return LeaveIrpUntilLater( FCB, Irp, FUNCTION_RECV ); + if (!IsListEmpty(&FCB->DatagramList)) + { + ListEntry = RemoveHeadList(&FCB->DatagramList); + DatagramRecv = CONTAINING_RECORD(ListEntry, AFD_STORED_DATAGRAM, ListEntry); + Status = SatisfyPacketRecvRequest(FCB, Irp, DatagramRecv, + (PUINT)&Irp->IoStatus.Information); + + if (RecvReq->TdiFlags & TDI_RECEIVE_PEEK) + { + InsertHeadList(&FCB->DatagramList, + &DatagramRecv->ListEntry); + } + + if (!IsListEmpty(&FCB->DatagramList)) + { + FCB->PollState |= AFD_EVENT_RECEIVE; + FCB->PollStatus[FD_READ_BIT] = STATUS_SUCCESS; + PollReeval( FCB->DeviceExt, FCB->FileObject ); + } + else + FCB->PollState &= ~AFD_EVENT_RECEIVE; + + UnlockBuffers(RecvReq->BufferArray, RecvReq->BufferCount, TRUE); + + return UnlockAndMaybeComplete(FCB, Status, Irp, Irp->IoStatus.Information); + } + else if( (RecvReq->AfdFlags & AFD_IMMEDIATE) || (FCB->NonBlocking) ) + { + AFD_DbgPrint(MID_TRACE,("Nonblocking\n")); + Status = STATUS_CANT_WAIT; + FCB->PollState &= ~AFD_EVENT_RECEIVE; + UnlockBuffers( RecvReq->BufferArray, RecvReq->BufferCount, TRUE ); + return UnlockAndMaybeComplete( FCB, Status, Irp, 0 ); + } + else + { + FCB->PollState &= ~AFD_EVENT_RECEIVE; + return LeaveIrpUntilLater( FCB, Irp, FUNCTION_RECV ); } } diff --git a/drivers/network/afd/afd/select.c b/drivers/network/afd/afd/select.c index dd334d343a8..4d425a4c99e 100644 --- a/drivers/network/afd/afd/select.c +++ b/drivers/network/afd/afd/select.c @@ -8,9 +8,6 @@ * 20040708 Created */ #include "afd.h" -#include "tdi_proto.h" -#include "tdiconn.h" -#include "debug.h" static VOID PrintEvents( ULONG Events ) { #if DBG @@ -286,14 +283,17 @@ AfdEventSelect( PDEVICE_OBJECT DeviceObject, PIRP Irp, if( EventSelectInfo->EventObject && EventSelectInfo->Events ) { Status = ObReferenceObjectByHandle( (PVOID)EventSelectInfo-> EventObject, - FILE_ALL_ACCESS, - NULL, - KernelMode, + EVENT_ALL_ACCESS, + ExEventObjectType, + UserMode, (PVOID *)&FCB->EventSelect, NULL ); if( !NT_SUCCESS(Status) ) + { + AFD_DbgPrint(MIN_TRACE,("Failed reference event (0x%x)\n", Status)); FCB->EventSelect = NULL; + } else FCB->EventSelectTriggers = EventSelectInfo->Events; } else { @@ -302,6 +302,18 @@ AfdEventSelect( PDEVICE_OBJECT DeviceObject, PIRP Irp, Status = STATUS_SUCCESS; } + if((FCB->EventSelect) && + (FCB->PollState & (FCB->EventSelectTriggers & ~FCB->EventSelectDisabled))) + { + AFD_DbgPrint(MID_TRACE,("Setting event %x\n", FCB->EventSelect)); + + /* Disable the events that triggered the select until the reenabling function is called */ + FCB->EventSelectDisabled |= (FCB->PollState & (FCB->EventSelectTriggers & ~FCB->EventSelectDisabled)); + + /* Set the application's event */ + KeSetEvent( FCB->EventSelect, IO_NETWORK_INCREMENT, FALSE ); + } + AFD_DbgPrint(MID_TRACE,("Returning %x\n", Status)); return UnlockAndMaybeComplete( FCB, Status, Irp, @@ -400,8 +412,15 @@ VOID PollReeval( PAFD_DEVICE_EXTENSION DeviceExt, PFILE_OBJECT FileObject ) { KeReleaseSpinLock( &DeviceExt->Lock, OldIrql ); - if( FCB->EventSelect && (FCB->PollState & FCB->EventSelectTriggers) ) { + if((FCB->EventSelect) && + (FCB->PollState & (FCB->EventSelectTriggers & ~FCB->EventSelectDisabled))) + { AFD_DbgPrint(MID_TRACE,("Setting event %x\n", FCB->EventSelect)); + + /* Disable the events that triggered the select until the reenabling function is called */ + FCB->EventSelectDisabled |= (FCB->PollState & (FCB->EventSelectTriggers & ~FCB->EventSelectDisabled)); + + /* Set the application's event */ KeSetEvent( FCB->EventSelect, IO_NETWORK_INCREMENT, FALSE ); } diff --git a/drivers/network/afd/afd/tdi.c b/drivers/network/afd/afd/tdi.c index b6821b06c90..cfd187a6f87 100644 --- a/drivers/network/afd/afd/tdi.c +++ b/drivers/network/afd/afd/tdi.c @@ -30,7 +30,7 @@ static VOID DisplayBuffer( return; } - AFD_DbgPrint(MIN_TRACE, ("Displaying buffer at (0x%X) Size (%d).\n", Buffer, Size)); + AFD_DbgPrint(MID_TRACE, ("Displaying buffer at (0x%X) Size (%d).\n", Buffer, Size)); p = (PCHAR)Buffer; for (i = 0; i < Size; i++) { @@ -236,6 +236,7 @@ NTSTATUS TdiQueryMaxDatagramLength( if (!NT_SUCCESS(Status)) { + AFD_DbgPrint(MIN_TRACE,("Failed to lock pages\n")); IoFreeMdl(Mdl); ExFreePool(Buffer); return Status; @@ -325,20 +326,19 @@ NTSTATUS TdiConnect( */ { PDEVICE_OBJECT DeviceObject; - NTSTATUS Status; AFD_DbgPrint(MAX_TRACE, ("Called\n")); + + ASSERT(*Irp == NULL); if (!ConnectionObject) { AFD_DbgPrint(MIN_TRACE, ("Bad connection object.\n")); - *Irp = NULL; return STATUS_INVALID_PARAMETER; } DeviceObject = IoGetRelatedDeviceObject(ConnectionObject); if (!DeviceObject) { AFD_DbgPrint(MIN_TRACE, ("Bad device object.\n")); - *Irp = NULL; return STATUS_INVALID_PARAMETER; } @@ -360,9 +360,9 @@ NTSTATUS TdiConnect( ConnectionCallInfo, /* Request connection information */ ConnectionReturnInfo); /* Return connection information */ - Status = TdiCall(*Irp, DeviceObject, NULL, Iosb); + TdiCall(*Irp, DeviceObject, NULL, Iosb); - return Status; + return STATUS_PENDING; } @@ -380,7 +380,6 @@ NTSTATUS TdiAssociateAddressFile( { PDEVICE_OBJECT DeviceObject; IO_STATUS_BLOCK Iosb; - NTSTATUS Status; KEVENT Event; PIRP Irp; @@ -415,11 +414,55 @@ NTSTATUS TdiAssociateAddressFile( NULL, AddressHandle); - Status = TdiCall(Irp, DeviceObject, &Event, &Iosb); - - return Status; + return TdiCall(Irp, DeviceObject, &Event, &Iosb); } +NTSTATUS TdiDisassociateAddressFile( + PFILE_OBJECT ConnectionObject) +/* + * FUNCTION: Disassociates a connection endpoint from an address file object + * ARGUMENTS: + * ConnectionObject = Connection endpoint file object + * RETURNS: + * Status of operation + */ +{ + PDEVICE_OBJECT DeviceObject; + IO_STATUS_BLOCK Iosb; + KEVENT Event; + PIRP Irp; + + AFD_DbgPrint(MAX_TRACE, ("Called. ConnectionObject (0x%X)\n", ConnectionObject)); + + if (!ConnectionObject) { + AFD_DbgPrint(MIN_TRACE, ("Bad connection object.\n")); + return STATUS_INVALID_PARAMETER; + } + + DeviceObject = IoGetRelatedDeviceObject(ConnectionObject); + if (!DeviceObject) { + AFD_DbgPrint(MIN_TRACE, ("Bad device object.\n")); + return STATUS_INVALID_PARAMETER; + } + + KeInitializeEvent(&Event, NotificationEvent, FALSE); + + Irp = TdiBuildInternalDeviceControlIrp(TDI_DISASSOCIATE_ADDRESS, /* Sub function */ + DeviceObject, /* Device object */ + ConnectionObject, /* File object */ + &Event, /* Event */ + &Iosb); /* Status */ + if (!Irp) + return STATUS_INSUFFICIENT_RESOURCES; + + TdiBuildDisassociateAddress(Irp, + DeviceObject, + ConnectionObject, + NULL, + NULL); + + return TdiCall(Irp, DeviceObject, &Event, &Iosb); +} NTSTATUS TdiListen ( PIRP *Irp, @@ -440,20 +483,19 @@ NTSTATUS TdiListen */ { PDEVICE_OBJECT DeviceObject; - NTSTATUS Status; AFD_DbgPrint(MAX_TRACE, ("Called\n")); + + ASSERT(*Irp == NULL); if (!ConnectionObject) { AFD_DbgPrint(MIN_TRACE, ("Bad connection object.\n")); - *Irp = NULL; return STATUS_INVALID_PARAMETER; } DeviceObject = IoGetRelatedDeviceObject(ConnectionObject); if (!DeviceObject) { AFD_DbgPrint(MIN_TRACE, ("Bad device object.\n")); - *Irp = NULL; return STATUS_INVALID_PARAMETER; } @@ -474,9 +516,9 @@ NTSTATUS TdiListen *RequestConnectionInfo, /* Request connection information */ *ReturnConnectionInfo); /* Return connection information */ - Status = TdiCall(*Irp, DeviceObject, NULL /* Don't wait for completion */, Iosb); + TdiCall(*Irp, DeviceObject, NULL /* Don't wait for completion */, Iosb); - return Status; + return STATUS_PENDING; } @@ -500,7 +542,6 @@ NTSTATUS TdiSetEventHandler( { PDEVICE_OBJECT DeviceObject; IO_STATUS_BLOCK Iosb; - NTSTATUS Status; KEVENT Event; PIRP Irp; @@ -538,9 +579,7 @@ NTSTATUS TdiSetEventHandler( Handler, Context); - Status = TdiCall(Irp, DeviceObject, &Event, &Iosb); - - return Status; + return TdiCall(Irp, DeviceObject, &Event, &Iosb); } @@ -621,7 +660,6 @@ NTSTATUS TdiQueryInformation( { PDEVICE_OBJECT DeviceObject; IO_STATUS_BLOCK Iosb; - NTSTATUS Status; KEVENT Event; PIRP Irp; @@ -656,9 +694,7 @@ NTSTATUS TdiQueryInformation( QueryType, MdlBuffer); - Status = TdiCall(Irp, DeviceObject, &Event, &Iosb); - - return Status; + return TdiCall(Irp, DeviceObject, &Event, &Iosb); } NTSTATUS TdiQueryInformationEx( @@ -848,19 +884,18 @@ NTSTATUS TdiSend PVOID CompletionContext ) { PDEVICE_OBJECT DeviceObject; - NTSTATUS Status = STATUS_SUCCESS; PMDL Mdl; + + ASSERT(*Irp == NULL); if (!TransportObject) { AFD_DbgPrint(MIN_TRACE, ("Bad transport object.\n")); - *Irp = NULL; return STATUS_INVALID_PARAMETER; } DeviceObject = IoGetRelatedDeviceObject(TransportObject); if (!DeviceObject) { AFD_DbgPrint(MIN_TRACE, ("Bad device object.\n")); - *Irp = NULL; return STATUS_INVALID_PARAMETER; } @@ -911,11 +946,11 @@ NTSTATUS TdiSend Flags, /* Flags */ BufferLength); /* Length of data */ - Status = TdiCall(*Irp, DeviceObject, NULL, Iosb); + TdiCall(*Irp, DeviceObject, NULL, Iosb); /* Does not block... The MDL is deleted in the receive completion routine. */ - return Status; + return STATUS_PENDING; } NTSTATUS TdiReceive( @@ -928,20 +963,19 @@ NTSTATUS TdiReceive( PIO_COMPLETION_ROUTINE CompletionRoutine, PVOID CompletionContext) { - NTSTATUS Status = STATUS_SUCCESS; PDEVICE_OBJECT DeviceObject; PMDL Mdl; + + ASSERT(*Irp == NULL); if (!TransportObject) { AFD_DbgPrint(MIN_TRACE, ("Bad transport object.\n")); - *Irp = NULL; return STATUS_INVALID_PARAMETER; } DeviceObject = IoGetRelatedDeviceObject(TransportObject); if (!DeviceObject) { AFD_DbgPrint(MIN_TRACE, ("Bad device object.\n")); - *Irp = NULL; return STATUS_INVALID_PARAMETER; } @@ -972,14 +1006,14 @@ NTSTATUS TdiReceive( } _SEH2_TRY { - AFD_DbgPrint(MIN_TRACE, ("probe and lock\n")); + AFD_DbgPrint(MID_TRACE, ("probe and lock\n")); MmProbeAndLockPages(Mdl, (*Irp)->RequestorMode, IoModifyAccess); - AFD_DbgPrint(MIN_TRACE, ("probe and lock done\n")); + AFD_DbgPrint(MID_TRACE, ("probe and lock done\n")); } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { AFD_DbgPrint(MIN_TRACE, ("MmProbeAndLockPages() failed.\n")); IoFreeMdl(Mdl); IoCompleteRequest(*Irp, IO_NO_INCREMENT); - *Irp = NULL; + *Irp = NULL; _SEH2_YIELD(return STATUS_INSUFFICIENT_RESOURCES); } _SEH2_END; @@ -995,14 +1029,11 @@ NTSTATUS TdiReceive( BufferLength); /* Length of data */ - Status = TdiCall(*Irp, DeviceObject, NULL, Iosb); + TdiCall(*Irp, DeviceObject, NULL, Iosb); /* Does not block... The MDL is deleted in the receive completion routine. */ - AFD_DbgPrint(MID_TRACE,("Status %x Information %d\n", - Status, Iosb->Information)); - - return Status; + return STATUS_PENDING; } @@ -1029,19 +1060,18 @@ NTSTATUS TdiReceiveDatagram( */ { PDEVICE_OBJECT DeviceObject; - NTSTATUS Status; PMDL Mdl; + + ASSERT(*Irp == NULL); if (!TransportObject) { AFD_DbgPrint(MIN_TRACE, ("Bad tranport object.\n")); - *Irp = NULL; return STATUS_INVALID_PARAMETER; } DeviceObject = IoGetRelatedDeviceObject(TransportObject); if (!DeviceObject) { AFD_DbgPrint(MIN_TRACE, ("Bad device object.\n")); - *Irp = NULL; return STATUS_INVALID_PARAMETER; } @@ -1095,11 +1125,11 @@ NTSTATUS TdiReceiveDatagram( Addr, Flags); /* Length of data */ - Status = TdiCall(*Irp, DeviceObject, NULL, Iosb); + TdiCall(*Irp, DeviceObject, NULL, Iosb); /* Does not block... The MDL is deleted in the receive completion routine. */ - return Status; + return STATUS_PENDING; } @@ -1125,12 +1155,12 @@ NTSTATUS TdiSendDatagram( */ { PDEVICE_OBJECT DeviceObject; - NTSTATUS Status; PMDL Mdl; + + ASSERT(*Irp == NULL); if (!TransportObject) { AFD_DbgPrint(MIN_TRACE, ("Bad transport object.\n")); - *Irp = NULL; return STATUS_INVALID_PARAMETER; } @@ -1139,7 +1169,6 @@ NTSTATUS TdiSendDatagram( DeviceObject = IoGetRelatedDeviceObject(TransportObject); if (!DeviceObject) { AFD_DbgPrint(MIN_TRACE, ("Bad device object.\n")); - *Irp = NULL; return STATUS_INVALID_PARAMETER; } @@ -1192,14 +1221,15 @@ NTSTATUS TdiSendDatagram( BufferLength, /* Bytes to send */ Addr); /* Address */ - Status = TdiCall(*Irp, DeviceObject, NULL, Iosb); + TdiCall(*Irp, DeviceObject, NULL, Iosb); /* Does not block... The MDL is deleted in the send completion routine. */ - return Status; + return STATUS_PENDING; } NTSTATUS TdiDisconnect( + PIRP *Irp, PFILE_OBJECT TransportObject, PLARGE_INTEGER Time, USHORT Flags, @@ -1209,11 +1239,6 @@ NTSTATUS TdiDisconnect( PTDI_CONNECTION_INFORMATION RequestConnectionInfo, PTDI_CONNECTION_INFORMATION ReturnConnectionInfo) { PDEVICE_OBJECT DeviceObject; - NTSTATUS Status; - KEVENT Event; - PIRP Irp; - - KeInitializeEvent(&Event, NotificationEvent, FALSE); if (!TransportObject) { AFD_DbgPrint(MIN_TRACE, ("Bad transport object.\n")); @@ -1228,20 +1253,20 @@ NTSTATUS TdiDisconnect( return STATUS_INVALID_PARAMETER; } - Irp = TdiBuildInternalDeviceControlIrp - ( TDI_SEND_DATAGRAM, /* Sub function */ + *Irp = TdiBuildInternalDeviceControlIrp + ( TDI_DISCONNECT, /* Sub function */ DeviceObject, /* Device object */ TransportObject, /* File object */ - &Event, /* Event */ + NULL, /* Event */ Iosb ); /* Status */ - if (!Irp) { + if (!*Irp) { AFD_DbgPrint(MIN_TRACE, ("Insufficient resources.\n")); return STATUS_INSUFFICIENT_RESOURCES; } TdiBuildDisconnect - (Irp, /* I/O Request Packet */ + (*Irp, /* I/O Request Packet */ DeviceObject, /* Device object */ TransportObject, /* File object */ CompletionRoutine, /* Completion routine */ @@ -1251,9 +1276,9 @@ NTSTATUS TdiDisconnect( RequestConnectionInfo, /* Indication of who to disconnect */ ReturnConnectionInfo); /* Indication of who disconnected */ - Status = TdiCall(Irp, DeviceObject, &Event, Iosb); - - return Status; + TdiCall(*Irp, DeviceObject, NULL, Iosb); + + return STATUS_PENDING; } /* EOF */ diff --git a/drivers/network/afd/afd/tdiconn.c b/drivers/network/afd/afd/tdiconn.c index c95ed3bd423..f413c910257 100644 --- a/drivers/network/afd/afd/tdiconn.c +++ b/drivers/network/afd/afd/tdiconn.c @@ -8,38 +8,65 @@ * 20040708 Created */ #include -#include -#include "debug.h" -#include "tdiconn.h" UINT TdiAddressSizeFromType( UINT AddressType ) { switch( AddressType ) { case TDI_ADDRESS_TYPE_IP: - return sizeof(TA_IP_ADDRESS); + return TDI_ADDRESS_LENGTH_IP; case TDI_ADDRESS_TYPE_APPLETALK: - return sizeof(TA_APPLETALK_ADDRESS); + return TDI_ADDRESS_LENGTH_APPLETALK; case TDI_ADDRESS_TYPE_NETBIOS: - return sizeof(TA_NETBIOS_ADDRESS); + return TDI_ADDRESS_LENGTH_NETBIOS; /* case TDI_ADDRESS_TYPE_NS: */ case TDI_ADDRESS_TYPE_IPX: - return sizeof(TA_IPX_ADDRESS); + return TDI_ADDRESS_LENGTH_IPX; case TDI_ADDRESS_TYPE_VNS: - return sizeof(TA_VNS_ADDRESS); + return TDI_ADDRESS_LENGTH_VNS; default: DbgPrint("TdiAddressSizeFromType - invalid type: %x\n", AddressType); return 0; } } -UINT TaLengthOfAddress( PTA_ADDRESS Addr ) { - UINT AddrLen = 2 * sizeof( USHORT ) + Addr->AddressLength; +UINT TaLengthOfAddress( PTA_ADDRESS Addr ) +{ + UINT AddrLen = Addr->AddressLength; + + if (!AddrLen) + return 0; + + AddrLen += 2 * sizeof( USHORT ); + AFD_DbgPrint(MID_TRACE,("AddrLen %x\n", AddrLen)); + return AddrLen; } -UINT TaLengthOfTransportAddress( PTRANSPORT_ADDRESS Addr ) { - UINT AddrLen = 2 * sizeof( ULONG ) + Addr->Address[0].AddressLength; +UINT TaLengthOfTransportAddress( PTRANSPORT_ADDRESS Addr ) +{ + UINT AddrLen = TaLengthOfAddress(&Addr->Address[0]); + + if (!AddrLen) + return 0; + + AddrLen += sizeof(ULONG); + AFD_DbgPrint(MID_TRACE,("AddrLen %x\n", AddrLen)); + + return AddrLen; +} + +UINT TaLengthOfTransportAddressByType(UINT AddressType) +{ + UINT AddrLen = TdiAddressSizeFromType(AddressType); + + if (!AddrLen) + return 0; + + AddrLen += sizeof(ULONG) + 2 * sizeof(USHORT); + + AFD_DbgPrint(MID_TRACE,("AddrLen %x\n", AddrLen)); + return AddrLen; } @@ -51,9 +78,15 @@ VOID TaCopyAddressInPlace( PTA_ADDRESS Target, PTA_ADDRESS TaCopyAddress( PTA_ADDRESS Source ) { UINT AddrLen = TaLengthOfAddress( Source ); - PVOID Buffer = ExAllocatePool( NonPagedPool, AddrLen ); + PVOID Buffer; + if (!AddrLen) + return NULL; + + Buffer = ExAllocatePool( NonPagedPool, AddrLen ); + if (Buffer) RtlCopyMemory( Buffer, Source, AddrLen ); + return Buffer; } @@ -67,8 +100,10 @@ PTRANSPORT_ADDRESS TaCopyTransportAddress( PTRANSPORT_ADDRESS OtherAddress ) { UINT AddrLen; PTRANSPORT_ADDRESS A; - ASSERT(OtherAddress->TAAddressCount == 1); AddrLen = TaLengthOfTransportAddress( OtherAddress ); + if (!AddrLen) + return NULL; + A = ExAllocatePool( NonPagedPool, AddrLen ); if( A ) @@ -77,7 +112,45 @@ PTRANSPORT_ADDRESS TaCopyTransportAddress( PTRANSPORT_ADDRESS OtherAddress ) { return A; } -static NTSTATUS TdiBuildNullConnectionInfoInPlace +NTSTATUS TdiBuildNullTransportAddressInPlace(PTRANSPORT_ADDRESS A, UINT AddressType) +{ + A->TAAddressCount = 1; + + A->Address[0].AddressLength = TdiAddressSizeFromType(AddressType); + if (!A->Address[0].AddressLength) + return STATUS_INVALID_PARAMETER; + + A->Address[0].AddressType = AddressType; + + RtlZeroMemory(A->Address[0].Address, A->Address[0].AddressLength); + + return STATUS_SUCCESS; +} + +PTRANSPORT_ADDRESS TaBuildNullTransportAddress(UINT AddressType) +{ + UINT AddrLen; + PTRANSPORT_ADDRESS A; + + AddrLen = TaLengthOfTransportAddressByType(AddressType); + if (!AddrLen) + return NULL; + + A = ExAllocatePool(NonPagedPool, AddrLen); + + if (A) + { + if (TdiBuildNullTransportAddressInPlace(A, AddressType) != STATUS_SUCCESS) + { + ExFreePool(A); + return NULL; + } + } + + return A; +} + +NTSTATUS TdiBuildNullConnectionInfoInPlace ( PTDI_CONNECTION_INFORMATION ConnInfo, ULONG Type ) /* @@ -92,9 +165,12 @@ static NTSTATUS TdiBuildNullConnectionInfoInPlace ULONG TdiAddressSize; PTRANSPORT_ADDRESS TransportAddress; - TdiAddressSize = TdiAddressSizeFromType(Type); + TdiAddressSize = TaLengthOfTransportAddressByType(Type); if (!TdiAddressSize) + { + AFD_DbgPrint(MIN_TRACE,("Invalid parameter\n")); return STATUS_INVALID_PARAMETER; + } RtlZeroMemory(ConnInfo, sizeof(TDI_CONNECTION_INFORMATION) + @@ -104,10 +180,8 @@ static NTSTATUS TdiBuildNullConnectionInfoInPlace ConnInfo->RemoteAddressLength = TdiAddressSize; ConnInfo->RemoteAddress = TransportAddress = (PTRANSPORT_ADDRESS)&ConnInfo[1]; - TransportAddress->TAAddressCount = 1; - TransportAddress->Address[0].AddressType = Type; - return STATUS_SUCCESS; + return TdiBuildNullTransportAddressInPlace(TransportAddress, Type); } NTSTATUS TdiBuildNullConnectionInfo @@ -127,8 +201,9 @@ NTSTATUS TdiBuildNullConnectionInfo ULONG TdiAddressSize; NTSTATUS Status; - TdiAddressSize = TdiAddressSizeFromType(Type); + TdiAddressSize = TaLengthOfTransportAddressByType(Type); if (!TdiAddressSize) { + AFD_DbgPrint(MIN_TRACE,("Invalid parameter\n")); *ConnectionInfo = NULL; return STATUS_INVALID_PARAMETER; } @@ -144,15 +219,13 @@ NTSTATUS TdiBuildNullConnectionInfo Status = TdiBuildNullConnectionInfoInPlace( ConnInfo, Type ); - if (!NT_SUCCESS(Status)) { + if (!NT_SUCCESS(Status)) + { ExFreePool( ConnInfo ); - *ConnectionInfo = NULL; - return Status; - } else - *ConnectionInfo = ConnInfo; + ConnInfo = NULL; + } - ConnInfo->RemoteAddress = (PTA_ADDRESS)&ConnInfo[1]; - ConnInfo->RemoteAddressLength = TdiAddressSize; + *ConnectionInfo = ConnInfo; return Status; } @@ -189,60 +262,3 @@ TdiBuildConnectionInfo return Status; } -NTSTATUS -TdiBuildConnectionInfoPair -( PTDI_CONNECTION_INFO_PAIR ConnectionInfo, - PTRANSPORT_ADDRESS From, PTRANSPORT_ADDRESS To ) -/* - * FUNCTION: Fill a TDI_CONNECTION_INFO_PAIR struct will the two addresses - * given. - * ARGUMENTS: - * ConnectionInfo: The pair - * From: The from address - * To: The to address - * RETURNS: - * Status of the operation - */ -{ - PCHAR LayoutFrame; - UINT SizeOfEntry; - ULONG TdiAddressSize; - PTDI_CONNECTION_INFORMATION FromTdiConn, ToTdiConn; - - if (!From) return STATUS_INVALID_PARAMETER; - - /* FIXME: Get from socket information */ - TdiAddressSize = TdiAddressSizeFromType(From->Address[0].AddressType); - if (!TdiAddressSize) - return STATUS_INVALID_PARAMETER; - - SizeOfEntry = TdiAddressSize + sizeof(TDI_CONNECTION_INFORMATION); - - LayoutFrame = (PCHAR)ExAllocatePool(NonPagedPool, 2 * SizeOfEntry); - - if (!LayoutFrame) { - AFD_DbgPrint(MIN_TRACE, ("Insufficient resources.\n")); - return STATUS_INSUFFICIENT_RESOURCES; - } - - RtlZeroMemory( LayoutFrame, 2 * SizeOfEntry ); - - FromTdiConn = (PTDI_CONNECTION_INFORMATION)LayoutFrame; - ToTdiConn = (PTDI_CONNECTION_INFORMATION)LayoutFrame + SizeOfEntry; - - TdiBuildConnectionInfoInPlace( FromTdiConn, From ); - - TdiBuildConnectionInfoInPlace( ToTdiConn, To ); - - return STATUS_SUCCESS; -} - -PTA_ADDRESS TdiGetRemoteAddress( PTDI_CONNECTION_INFORMATION TdiConn ) -/* - * Convenience function that rounds out the abstraction of - * the TDI_CONNECTION_INFORMATION struct. - */ -{ - return TdiConn->RemoteAddress; -} - diff --git a/drivers/network/afd/afd/write.c b/drivers/network/afd/afd/write.c index 7506489be8e..003ab2eba1c 100644 --- a/drivers/network/afd/afd/write.c +++ b/drivers/network/afd/afd/write.c @@ -8,9 +8,6 @@ * 20040708 Created */ #include "afd.h" -#include "tdi_proto.h" -#include "tdiconn.h" -#include "debug.h" static NTSTATUS NTAPI SendComplete ( PDEVICE_OBJECT DeviceObject, @@ -23,7 +20,7 @@ static NTSTATUS NTAPI SendComplete PIO_STACK_LOCATION NextIrpSp; PAFD_SEND_INFO SendReq = NULL; PAFD_MAPBUF Map; - UINT TotalBytesCopied = 0, SpaceAvail, i, CopySize = 0; + UINT TotalBytesCopied = 0, TotalBytesProcessed = 0, SpaceAvail, i; /* * The Irp parameter passed in is the IRP of the stream between AFD and @@ -41,6 +38,7 @@ static NTSTATUS NTAPI SendComplete if( !SocketAcquireStateLock( FCB ) ) return STATUS_FILE_CLOSED; + ASSERT(FCB->SendIrp.InFlightRequest == Irp); FCB->SendIrp.InFlightRequest = NULL; /* Request is not in flight any longer */ @@ -50,7 +48,7 @@ static NTSTATUS NTAPI SendComplete NextIrpEntry = RemoveHeadList(&FCB->PendingIrpList[FUNCTION_SEND]); NextIrp = CONTAINING_RECORD(NextIrpEntry, IRP, Tail.Overlay.ListEntry); NextIrpSp = IoGetCurrentIrpStackLocation( NextIrp ); - SendReq = NextIrpSp->Parameters.DeviceIoControl.Type3InputBuffer; + SendReq = GetLockedData(NextIrp, NextIrpSp); NextIrp->IoStatus.Status = STATUS_FILE_CLOSED; NextIrp->IoStatus.Information = 0; UnlockBuffers(SendReq->BufferArray, SendReq->BufferCount, FALSE); @@ -58,8 +56,11 @@ static NTSTATUS NTAPI SendComplete (void)IoSetCancelRoutine(NextIrp, NULL); IoCompleteRequest( NextIrp, IO_NETWORK_INCREMENT ); } - SocketStateUnlock( FCB ); - return STATUS_FILE_CLOSED; + + RetryDisconnectCompletion(FCB); + + SocketStateUnlock( FCB ); + return STATUS_FILE_CLOSED; } if( !NT_SUCCESS(Status) ) { @@ -71,7 +72,7 @@ static NTSTATUS NTAPI SendComplete NextIrp = CONTAINING_RECORD(NextIrpEntry, IRP, Tail.Overlay.ListEntry); NextIrpSp = IoGetCurrentIrpStackLocation( NextIrp ); - SendReq = NextIrpSp->Parameters.DeviceIoControl.Type3InputBuffer; + SendReq = GetLockedData(NextIrp, NextIrpSp); UnlockBuffers( SendReq->BufferArray, SendReq->BufferCount, @@ -84,6 +85,8 @@ static NTSTATUS NTAPI SendComplete (void)IoSetCancelRoutine(NextIrp, NULL); IoCompleteRequest( NextIrp, IO_NETWORK_INCREMENT ); } + + RetryDisconnectCompletion(FCB); SocketStateUnlock( FCB ); @@ -93,45 +96,101 @@ static NTSTATUS NTAPI SendComplete RtlMoveMemory( FCB->Send.Window, FCB->Send.Window + FCB->Send.BytesUsed, FCB->Send.BytesUsed - Irp->IoStatus.Information ); - FCB->Send.BytesUsed -= Irp->IoStatus.Information; - if( !FCB->Send.BytesUsed && - !IsListEmpty( &FCB->PendingIrpList[FUNCTION_SEND] ) ) { + TotalBytesProcessed = 0; + while (!IsListEmpty(&FCB->PendingIrpList[FUNCTION_SEND]) && + TotalBytesProcessed != Irp->IoStatus.Information) { + NextIrpEntry = + RemoveHeadList(&FCB->PendingIrpList[FUNCTION_SEND]); + NextIrp = + CONTAINING_RECORD(NextIrpEntry, IRP, Tail.Overlay.ListEntry); + NextIrpSp = IoGetCurrentIrpStackLocation( NextIrp ); + SendReq = GetLockedData(NextIrp, NextIrpSp); + Map = (PAFD_MAPBUF)(SendReq->BufferArray + SendReq->BufferCount); + + TotalBytesCopied = 0; + + for( i = 0; i < SendReq->BufferCount; i++ ) + TotalBytesCopied += SendReq->BufferArray[i].len; + + NextIrp->IoStatus.Status = Irp->IoStatus.Status; + NextIrp->IoStatus.Information = TotalBytesCopied; + + TotalBytesProcessed += TotalBytesCopied; + + (void)IoSetCancelRoutine(NextIrp, NULL); + + UnlockBuffers( SendReq->BufferArray, + SendReq->BufferCount, + FALSE ); + + if (NextIrp->MdlAddress) UnlockRequest(NextIrp, NextIrpSp); + + IoCompleteRequest(NextIrp, IO_NETWORK_INCREMENT); + } + + ASSERT(TotalBytesProcessed == Irp->IoStatus.Information); + + FCB->Send.BytesUsed -= TotalBytesProcessed; + + while( !IsListEmpty( &FCB->PendingIrpList[FUNCTION_SEND] ) ) { NextIrpEntry = RemoveHeadList(&FCB->PendingIrpList[FUNCTION_SEND]); NextIrp = CONTAINING_RECORD(NextIrpEntry, IRP, Tail.Overlay.ListEntry); NextIrpSp = IoGetCurrentIrpStackLocation( NextIrp ); - SendReq = NextIrpSp->Parameters.DeviceIoControl.Type3InputBuffer; + SendReq = GetLockedData(NextIrp, NextIrpSp); Map = (PAFD_MAPBUF)(SendReq->BufferArray + SendReq->BufferCount); AFD_DbgPrint(MID_TRACE,("SendReq @ %x\n", SendReq)); SpaceAvail = FCB->Send.Size - FCB->Send.BytesUsed; + TotalBytesCopied = 0; for( i = 0; i < SendReq->BufferCount; i++ ) { + if (SpaceAvail < SendReq->BufferArray[i].len) + { + InsertHeadList(&FCB->PendingIrpList[FUNCTION_SEND], + &NextIrp->Tail.Overlay.ListEntry); + NextIrp = NULL; + break; + } Map[i].BufferAddress = MmMapLockedPages( Map[i].Mdl, KernelMode ); - CopySize = MIN( SpaceAvail, - SendReq->BufferArray[i].len ); - RtlCopyMemory( FCB->Send.Window + FCB->Send.BytesUsed, Map[i].BufferAddress, - CopySize ); + SendReq->BufferArray[i].len ); MmUnmapLockedPages( Map[i].BufferAddress, Map[i].Mdl ); - FCB->Send.BytesUsed += CopySize; - TotalBytesCopied += CopySize; - SpaceAvail -= CopySize; + TotalBytesCopied += SendReq->BufferArray[i].len; + SpaceAvail -= SendReq->BufferArray[i].len; } + + if (NextIrp != NULL) + { + FCB->Send.BytesUsed += TotalBytesCopied; + } + else + break; + } + + if (FCB->Send.Size - FCB->Send.BytesUsed != 0 && + !FCB->SendClosed) + { + FCB->PollState |= AFD_EVENT_SEND; + FCB->PollStatus[FD_WRITE_BIT] = STATUS_SUCCESS; + PollReeval( FCB->DeviceExt, FCB->FileObject ); + } + else + { + FCB->PollState &= ~AFD_EVENT_SEND; } /* Some data is still waiting */ - if( FCB->Send.BytesUsed ) { - FCB->PollState &= ~AFD_EVENT_SEND; - + if( FCB->Send.BytesUsed ) + { Status = TdiSend( &FCB->SendIrp.InFlightRequest, FCB->Connection.Object, 0, @@ -140,26 +199,11 @@ static NTSTATUS NTAPI SendComplete &FCB->SendIrp.Iosb, SendComplete, FCB ); - } else { - FCB->PollState |= AFD_EVENT_SEND; - FCB->PollStatus[FD_WRITE_BIT] = STATUS_SUCCESS; - PollReeval( FCB->DeviceExt, FCB->FileObject ); } - - if( TotalBytesCopied > 0 ) { - UnlockBuffers( SendReq->BufferArray, SendReq->BufferCount, FALSE ); - - if( Status == STATUS_PENDING ) - Status = STATUS_SUCCESS; - - AFD_DbgPrint(MID_TRACE,("Dismissing request: %x\n", Status)); - - return UnlockAndMaybeComplete( FCB, Status, NextIrp, TotalBytesCopied ); - } else if( NextIrp ) { - AFD_DbgPrint(MID_TRACE,("Could not do any more with Irp %x\n", - NextIrp)); - InsertHeadList( &FCB->PendingIrpList[FUNCTION_SEND], - &NextIrp->Tail.Overlay.ListEntry ); + else + { + /* Nothing is waiting so try to complete a pending disconnect */ + RetryDisconnectCompletion(FCB); } SocketStateUnlock( FCB ); @@ -174,6 +218,7 @@ static NTSTATUS NTAPI PacketSocketSendComplete PAFD_FCB FCB = (PAFD_FCB)Context; PLIST_ENTRY NextIrpEntry; PIRP NextIrp; + PAFD_SEND_INFO SendReq; AFD_DbgPrint(MID_TRACE,("Called, status %x, %d bytes used\n", Irp->IoStatus.Status, @@ -182,29 +227,51 @@ static NTSTATUS NTAPI PacketSocketSendComplete if( !SocketAcquireStateLock( FCB ) ) return STATUS_FILE_CLOSED; + ASSERT(FCB->SendIrp.InFlightRequest == Irp); FCB->SendIrp.InFlightRequest = NULL; /* Request is not in flight any longer */ - FCB->PollState |= AFD_EVENT_SEND; - FCB->PollStatus[FD_WRITE_BIT] = STATUS_SUCCESS; - PollReeval( FCB->DeviceExt, FCB->FileObject ); - if( FCB->State == SOCKET_STATE_CLOSED ) { /* Cleanup our IRP queue because the FCB is being destroyed */ while( !IsListEmpty( &FCB->PendingIrpList[FUNCTION_SEND] ) ) { - NextIrpEntry = RemoveHeadList(&FCB->PendingIrpList[FUNCTION_SEND]); - NextIrp = CONTAINING_RECORD(NextIrpEntry, IRP, Tail.Overlay.ListEntry); - NextIrp->IoStatus.Status = STATUS_FILE_CLOSED; - NextIrp->IoStatus.Information = 0; - if( NextIrp->MdlAddress ) UnlockRequest( NextIrp, IoGetCurrentIrpStackLocation( NextIrp ) ); - (void)IoSetCancelRoutine(NextIrp, NULL); - IoCompleteRequest( NextIrp, IO_NETWORK_INCREMENT ); + NextIrpEntry = RemoveHeadList(&FCB->PendingIrpList[FUNCTION_SEND]); + NextIrp = CONTAINING_RECORD(NextIrpEntry, IRP, Tail.Overlay.ListEntry); + SendReq = GetLockedData(NextIrp, IoGetCurrentIrpStackLocation(NextIrp)); + NextIrp->IoStatus.Status = STATUS_FILE_CLOSED; + NextIrp->IoStatus.Information = 0; + (void)IoSetCancelRoutine(NextIrp, NULL); + UnlockBuffers(SendReq->BufferArray, SendReq->BufferCount, FALSE); + UnlockRequest( NextIrp, IoGetCurrentIrpStackLocation( NextIrp ) ); + IoCompleteRequest( NextIrp, IO_NETWORK_INCREMENT ); } - SocketStateUnlock( FCB ); - return STATUS_FILE_CLOSED; + SocketStateUnlock( FCB ); + return STATUS_FILE_CLOSED; } + + ASSERT(!IsListEmpty(&FCB->PendingIrpList[FUNCTION_SEND])); + + /* TDI spec guarantees FIFO ordering on IRPs */ + NextIrpEntry = RemoveHeadList(&FCB->PendingIrpList[FUNCTION_SEND]); + NextIrp = CONTAINING_RECORD(NextIrpEntry, IRP, Tail.Overlay.ListEntry); + + SendReq = GetLockedData(NextIrp, IoGetCurrentIrpStackLocation(NextIrp)); + + NextIrp->IoStatus.Status = Irp->IoStatus.Status; + NextIrp->IoStatus.Information = Irp->IoStatus.Information; + + (void)IoSetCancelRoutine(NextIrp, NULL); + + UnlockBuffers(SendReq->BufferArray, SendReq->BufferCount, FALSE); + + UnlockRequest(NextIrp, IoGetCurrentIrpStackLocation(NextIrp)); + + IoCompleteRequest(NextIrp, IO_NETWORK_INCREMENT); - SocketStateUnlock( FCB ); + FCB->PollState |= AFD_EVENT_SEND; + FCB->PollStatus[FD_WRITE_BIT] = STATUS_SUCCESS; + PollReeval(FCB->DeviceExt, FCB->FileObject); + + SocketStateUnlock(FCB); return STATUS_SUCCESS; } @@ -216,9 +283,8 @@ AfdConnectedSocketWriteData(PDEVICE_OBJECT DeviceObject, PIRP Irp, PFILE_OBJECT FileObject = IrpSp->FileObject; PAFD_FCB FCB = FileObject->FsContext; PAFD_SEND_INFO SendReq; - ULONG Information; - UINT TotalBytesCopied = 0, i, CopySize = 0, - SpaceAvail = 0, TotalBytesEncountered = 0; + UINT TotalBytesCopied = 0, i, SpaceAvail = 0; + BOOLEAN NoSpace = FALSE; AFD_DbgPrint(MID_TRACE,("Called on %x\n", FCB)); @@ -231,8 +297,11 @@ AfdConnectedSocketWriteData(PDEVICE_OBJECT DeviceObject, PIRP Irp, /* Check that the socket is bound */ if( FCB->State != SOCKET_STATE_BOUND || !FCB->RemoteAddress ) + { + AFD_DbgPrint(MIN_TRACE,("Invalid parameter\n")); return UnlockAndMaybeComplete( FCB, STATUS_INVALID_PARAMETER, Irp, 0 ); + } if( !(SendReq = LockRequest( Irp, IrpSp )) ) return UnlockAndMaybeComplete( FCB, STATUS_NO_MEMORY, Irp, 0 ); @@ -250,29 +319,58 @@ AfdConnectedSocketWriteData(PDEVICE_OBJECT DeviceObject, PIRP Irp, Status = TdiBuildConnectionInfo( &TargetAddress, FCB->RemoteAddress ); - if( NT_SUCCESS(Status) ) { - Status = TdiSendDatagram - ( &FCB->SendIrp.InFlightRequest, - FCB->AddressFile.Object, - SendReq->BufferArray[0].buf, - SendReq->BufferArray[0].len, - TargetAddress, - &FCB->SendIrp.Iosb, - PacketSocketSendComplete, - FCB ); + if( NT_SUCCESS(Status) ) { + FCB->EventSelectDisabled &= ~AFD_EVENT_SEND; + FCB->PollState &= ~AFD_EVENT_SEND; + + Status = QueueUserModeIrp(FCB, Irp, FUNCTION_SEND); + if (Status == STATUS_PENDING) + { + TdiSendDatagram(&FCB->SendIrp.InFlightRequest, + FCB->AddressFile.Object, + SendReq->BufferArray[0].buf, + SendReq->BufferArray[0].len, + TargetAddress, + &FCB->SendIrp.Iosb, + PacketSocketSendComplete, + FCB); + } + + ExFreePool( TargetAddress ); + + SocketStateUnlock(FCB); + + return STATUS_PENDING; + } + else + { + UnlockBuffers(SendReq->BufferArray, SendReq->BufferCount, FALSE); + return UnlockAndMaybeComplete( FCB, Status, Irp, 0 ); + } + } + + if (FCB->PollState & AFD_EVENT_CLOSE) + { + AFD_DbgPrint(MIN_TRACE,("Connection reset by remote peer\n")); - ExFreePool( TargetAddress ); - } + /* This is an unexpected remote disconnect */ + return UnlockAndMaybeComplete(FCB, FCB->PollStatus[FD_CLOSE_BIT], Irp, 0); + } + + if (FCB->PollState & AFD_EVENT_ABORT) + { + AFD_DbgPrint(MIN_TRACE,("Connection aborted\n")); + + /* This is an abortive socket closure on our side */ + return UnlockAndMaybeComplete(FCB, FCB->PollStatus[FD_CLOSE_BIT], Irp, 0); + } + + if (FCB->SendClosed) + { + AFD_DbgPrint(MIN_TRACE,("No more sends\n")); - if( Status == STATUS_PENDING ) Status = STATUS_SUCCESS; - - AFD_DbgPrint(MID_TRACE,("Dismissing request: %x\n", Status)); - - /* Even if we were pended, we're done with the user buffer at this - * point. */ - Information = SendReq->BufferArray[0].len; - UnlockBuffers(SendReq->BufferArray, SendReq->BufferCount, FALSE); - return UnlockAndMaybeComplete( FCB, Status, Irp, Information ); + /* This is a graceful send closure */ + return UnlockAndMaybeComplete(FCB, STATUS_FILE_CLOSED, Irp, 0); } if( !(SendReq = LockRequest( Irp, IrpSp )) ) @@ -292,7 +390,7 @@ AfdConnectedSocketWriteData(PDEVICE_OBJECT DeviceObject, PIRP Irp, AFD_DbgPrint(MID_TRACE,("Socket state %d\n", FCB->State)); if( FCB->State != SOCKET_STATE_CONNECTED ) { - if( SendReq->AfdFlags & AFD_IMMEDIATE ) { + if( (SendReq->AfdFlags & AFD_IMMEDIATE) || (FCB->NonBlocking) ) { AFD_DbgPrint(MID_TRACE,("Nonblocking\n")); UnlockBuffers( SendReq->BufferArray, SendReq->BufferCount, FALSE ); return UnlockAndMaybeComplete @@ -306,75 +404,94 @@ AfdConnectedSocketWriteData(PDEVICE_OBJECT DeviceObject, PIRP Irp, AFD_DbgPrint(MID_TRACE,("FCB->Send.BytesUsed = %d\n", FCB->Send.BytesUsed)); - if( !FCB->Send.BytesUsed ) { - SpaceAvail = FCB->Send.Size - FCB->Send.BytesUsed; - - AFD_DbgPrint(MID_TRACE,("We can accept %d bytes\n", - SpaceAvail)); - - for( i = 0; FCB->Send.BytesUsed < FCB->Send.Size && - i < SendReq->BufferCount; i++ ) { - CopySize = MIN( SpaceAvail, - SendReq->BufferArray[i].len ); - - TotalBytesEncountered += SendReq->BufferArray[i].len; - - AFD_DbgPrint(MID_TRACE,("Copying Buffer %d, %x:%d to %x\n", - i, - SendReq->BufferArray[i].buf, - CopySize, - FCB->Send.Window + FCB->Send.BytesUsed)); - - RtlCopyMemory( FCB->Send.Window + FCB->Send.BytesUsed, - SendReq->BufferArray[i].buf, - CopySize ); - - FCB->Send.BytesUsed += CopySize; - TotalBytesCopied += CopySize; - SpaceAvail -= CopySize; - } - - if( TotalBytesEncountered == 0 ) { - UnlockBuffers( SendReq->BufferArray, SendReq->BufferCount, FALSE ); - - AFD_DbgPrint(MID_TRACE,("Empty send\n")); - return UnlockAndMaybeComplete - ( FCB, Status, Irp, TotalBytesCopied ); - } - - AFD_DbgPrint(MID_TRACE,("Completed %d bytes\n", TotalBytesCopied)); - - if( TotalBytesCopied > 0 ) { - UnlockBuffers( SendReq->BufferArray, SendReq->BufferCount, FALSE ); - - Status = TdiSend( &FCB->SendIrp.InFlightRequest, - FCB->Connection.Object, - 0, - FCB->Send.Window, - FCB->Send.BytesUsed, - &FCB->SendIrp.Iosb, - SendComplete, - FCB ); - - if( Status == STATUS_PENDING ) - Status = STATUS_SUCCESS; - - AFD_DbgPrint(MID_TRACE,("Dismissing request: %x (%d)\n", - Status, TotalBytesCopied)); - - return UnlockAndMaybeComplete - ( FCB, Status, Irp, TotalBytesCopied ); - } + SpaceAvail = FCB->Send.Size - FCB->Send.BytesUsed; + + AFD_DbgPrint(MID_TRACE,("We can accept %d bytes\n", + SpaceAvail)); + + for( i = 0; FCB->Send.BytesUsed < FCB->Send.Size && + i < SendReq->BufferCount; i++ ) { + + if (SpaceAvail < SendReq->BufferArray[i].len) + { + if (TotalBytesCopied + SendReq->BufferArray[i].len > FCB->Send.Size) + { + UnlockBuffers( SendReq->BufferArray, SendReq->BufferCount, FALSE ); + + return UnlockAndMaybeComplete(FCB, STATUS_BUFFER_OVERFLOW, Irp, 0); + } + SpaceAvail += TotalBytesCopied; + NoSpace = TRUE; + break; + } + + AFD_DbgPrint(MID_TRACE,("Copying Buffer %d, %x:%d to %x\n", + i, + SendReq->BufferArray[i].buf, + SendReq->BufferArray[i].len, + FCB->Send.Window + FCB->Send.BytesUsed)); + + RtlCopyMemory( FCB->Send.Window + FCB->Send.BytesUsed, + SendReq->BufferArray[i].buf, + SendReq->BufferArray[i].len ); + + TotalBytesCopied += SendReq->BufferArray[i].len; + SpaceAvail -= SendReq->BufferArray[i].len; + } + + FCB->EventSelectDisabled &= ~AFD_EVENT_SEND; + + if( TotalBytesCopied == 0 ) { + AFD_DbgPrint(MID_TRACE,("Empty send\n")); + UnlockBuffers( SendReq->BufferArray, SendReq->BufferCount, FALSE ); + return UnlockAndMaybeComplete + ( FCB, STATUS_SUCCESS, Irp, TotalBytesCopied ); } - if( SendReq->AfdFlags & AFD_IMMEDIATE ) { - AFD_DbgPrint(MID_TRACE,("Nonblocking\n")); - UnlockBuffers( SendReq->BufferArray, SendReq->BufferCount, FALSE ); - return UnlockAndMaybeComplete + if (SpaceAvail) + { + FCB->PollState |= AFD_EVENT_SEND; + FCB->PollStatus[FD_WRITE_BIT] = STATUS_SUCCESS; + PollReeval( FCB->DeviceExt, FCB->FileObject ); + } + else + { + FCB->PollState &= ~AFD_EVENT_SEND; + } + + if (!NoSpace) + { + FCB->Send.BytesUsed += TotalBytesCopied; + AFD_DbgPrint(MID_TRACE,("Copied %d bytes\n", TotalBytesCopied)); + + Status = QueueUserModeIrp(FCB, Irp, FUNCTION_SEND); + if (Status == STATUS_PENDING && !FCB->SendIrp.InFlightRequest) + { + TdiSend(&FCB->SendIrp.InFlightRequest, + FCB->Connection.Object, + 0, + FCB->Send.Window, + FCB->Send.BytesUsed, + &FCB->SendIrp.Iosb, + SendComplete, + FCB); + } + SocketStateUnlock(FCB); + + return STATUS_PENDING; + } + else + { + FCB->PollState &= ~AFD_EVENT_SEND; + if( (SendReq->AfdFlags & AFD_IMMEDIATE) || (FCB->NonBlocking) ) { + AFD_DbgPrint(MID_TRACE,("Nonblocking\n")); + UnlockBuffers( SendReq->BufferArray, SendReq->BufferCount, FALSE ); + return UnlockAndMaybeComplete ( FCB, STATUS_CANT_WAIT, Irp, 0 ); - } else { - AFD_DbgPrint(MID_TRACE,("Queuing request\n")); - return LeaveIrpUntilLater( FCB, Irp, FUNCTION_SEND ); + } else { + AFD_DbgPrint(MID_TRACE,("Queuing request\n")); + return LeaveIrpUntilLater( FCB, Irp, FUNCTION_SEND ); + } } } @@ -386,19 +503,48 @@ AfdPacketSocketWriteData(PDEVICE_OBJECT DeviceObject, PIRP Irp, PFILE_OBJECT FileObject = IrpSp->FileObject; PAFD_FCB FCB = FileObject->FsContext; PAFD_SEND_INFO_UDP SendReq; - ULONG Information; AFD_DbgPrint(MID_TRACE,("Called on %x\n", FCB)); if( !SocketAcquireStateLock( FCB ) ) return LostSocket( Irp ); /* Check that the socket is bound */ - if( FCB->State != SOCKET_STATE_BOUND ) + if( FCB->State != SOCKET_STATE_BOUND && + FCB->State != SOCKET_STATE_CREATED) + { + AFD_DbgPrint(MIN_TRACE,("Invalid socket state\n")); return UnlockAndMaybeComplete ( FCB, STATUS_INVALID_PARAMETER, Irp, 0 ); + } + + if (FCB->SendClosed) + { + AFD_DbgPrint(MIN_TRACE,("No more sends\n")); + return UnlockAndMaybeComplete(FCB, STATUS_FILE_CLOSED, Irp, 0); + } + if( !(SendReq = LockRequest( Irp, IrpSp )) ) return UnlockAndMaybeComplete ( FCB, STATUS_NO_MEMORY, Irp, 0 ); + + if (FCB->State == SOCKET_STATE_CREATED) + { + if( FCB->LocalAddress ) ExFreePool( FCB->LocalAddress ); + FCB->LocalAddress = + TaBuildNullTransportAddress( ((PTRANSPORT_ADDRESS)SendReq->TdiConnection.RemoteAddress)-> + Address[0].AddressType ); + + if( FCB->LocalAddress ) { + Status = WarmSocketForBind( FCB ); + + if( NT_SUCCESS(Status) ) + FCB->State = SOCKET_STATE_BOUND; + else + return UnlockAndMaybeComplete( FCB, Status, Irp, 0 ); + } else + return UnlockAndMaybeComplete + ( FCB, STATUS_NO_MEMORY, Irp, 0 ); + } SendReq->BufferArray = LockBuffers( SendReq->BufferArray, SendReq->BufferCount, @@ -422,29 +568,32 @@ AfdPacketSocketWriteData(PDEVICE_OBJECT DeviceObject, PIRP Irp, /* Check the size of the Address given ... */ if( NT_SUCCESS(Status) ) { + FCB->EventSelectDisabled &= ~AFD_EVENT_SEND; FCB->PollState &= ~AFD_EVENT_SEND; - Status = TdiSendDatagram - ( &FCB->SendIrp.InFlightRequest, - FCB->AddressFile.Object, - SendReq->BufferArray[0].buf, - SendReq->BufferArray[0].len, - TargetAddress, - &FCB->SendIrp.Iosb, - PacketSocketSendComplete, - FCB ); + Status = QueueUserModeIrp(FCB, Irp, FUNCTION_SEND); + if (Status == STATUS_PENDING) + { + TdiSendDatagram(&FCB->SendIrp.InFlightRequest, + FCB->AddressFile.Object, + SendReq->BufferArray[0].buf, + SendReq->BufferArray[0].len, + TargetAddress, + &FCB->SendIrp.Iosb, + PacketSocketSendComplete, + FCB); + } ExFreePool( TargetAddress ); + + SocketStateUnlock(FCB); + + return STATUS_PENDING; + } + else + { + UnlockBuffers(SendReq->BufferArray, SendReq->BufferCount, FALSE); + return UnlockAndMaybeComplete( FCB, Status, Irp, 0 ); } - - if( Status == STATUS_PENDING ) Status = STATUS_SUCCESS; - - AFD_DbgPrint(MID_TRACE,("Dismissing request: %x\n", Status)); - - /* Even if we were pended, we're done with the user buffer at this - * point. */ - Information = SendReq->BufferArray[0].len; - UnlockBuffers(SendReq->BufferArray, SendReq->BufferCount, FALSE); - return UnlockAndMaybeComplete( FCB, Status, Irp, Information ); } diff --git a/drivers/network/afd/include/afd.h b/drivers/network/afd/include/afd.h index ac3a286cd6c..04464ffff26 100644 --- a/drivers/network/afd/include/afd.h +++ b/drivers/network/afd/include/afd.h @@ -28,6 +28,11 @@ #include #include #include +#include + +#include "tdi_proto.h" +#include "tdiconn.h" +#include "debug.h" #ifndef MIN #define MIN(x,y) (((x)<(y))?(x):(y)) @@ -99,10 +104,11 @@ typedef struct IPADDR_ENTRY { #define FUNCTION_SEND 2 #define FUNCTION_PREACCEPT 3 #define FUNCTION_ACCEPT 4 -#define FUNCTION_CLOSE 5 -#define MAX_FUNCTIONS 6 +#define FUNCTION_DISCONNECT 5 +#define FUNCTION_CLOSE 6 +#define MAX_FUNCTIONS 7 -#define IN_FLIGHT_REQUESTS 4 +#define IN_FLIGHT_REQUESTS 5 #define EXTRA_LOCK_BUFFERS 2 /* Number of extra buffers needed * for ancillary data on packet @@ -172,23 +178,27 @@ typedef struct _AFD_STORED_DATAGRAM { } AFD_STORED_DATAGRAM, *PAFD_STORED_DATAGRAM; typedef struct _AFD_FCB { - BOOLEAN Locked, Critical, Overread; - UINT State, Flags, BlockingMode, GroupID, GroupType; + BOOLEAN Locked, Critical, Overread, NonBlocking, OobInline, TdiReceiveClosed, SendClosed; + UINT State, Flags, GroupID, GroupType; KIRQL OldIrql; UINT LockCount; PVOID CurrentThread; PFILE_OBJECT FileObject; PAFD_DEVICE_EXTENSION DeviceExt; - BOOLEAN DelayedAccept, NeedsNewListen; + BOOLEAN DelayedAccept; UINT ConnSeq; + USHORT DisconnectFlags; + BOOLEAN DisconnectPending; + LARGE_INTEGER DisconnectTimeout; PTRANSPORT_ADDRESS LocalAddress, RemoteAddress; - PTDI_CONNECTION_INFORMATION AddressFrom, ConnectInfo; + PTDI_CONNECTION_INFORMATION AddressFrom, ConnectCallInfo, ConnectReturnInfo; AFD_TDI_OBJECT AddressFile, Connection; - AFD_IN_FLIGHT_REQUEST ConnectIrp, ListenIrp, ReceiveIrp, SendIrp; + AFD_IN_FLIGHT_REQUEST ConnectIrp, ListenIrp, ReceiveIrp, SendIrp, DisconnectIrp; AFD_DATA_WINDOW Send, Recv; KMUTEX Mutex; PKEVENT EventSelect; DWORD EventSelectTriggers; + DWORD EventSelectDisabled; UNICODE_STRING TdiDeviceName; PVOID Context; DWORD PollState; @@ -300,14 +310,18 @@ PAFD_HANDLE LockHandles( PAFD_HANDLE HandleArray, UINT HandleCount ); VOID UnlockHandles( PAFD_HANDLE HandleArray, UINT HandleCount ); PVOID LockRequest( PIRP Irp, PIO_STACK_LOCATION IrpSp ); VOID UnlockRequest( PIRP Irp, PIO_STACK_LOCATION IrpSp ); +PVOID GetLockedData( PIRP Irp, PIO_STACK_LOCATION IrpSp ); +NTSTATUS LeaveIrpUntilLater( PAFD_FCB FCB, PIRP Irp, UINT Function ); +NTSTATUS QueueUserModeIrp(PAFD_FCB FCB, PIRP Irp, UINT Function); /* main.c */ VOID OskitDumpBuffer( PCHAR Buffer, UINT Len ); -NTSTATUS LeaveIrpUntilLater( PAFD_FCB FCB, PIRP Irp, UINT Function ); VOID DestroySocket( PAFD_FCB FCB ); VOID NTAPI AfdCancelHandler(PDEVICE_OBJECT DeviceObject, PIRP Irp); +VOID RetryDisconnectCompletion(PAFD_FCB FCB); +BOOLEAN CheckUnlockExtraBuffers(PAFD_FCB FCB, PIO_STACK_LOCATION IrpSp); /* read.c */ @@ -360,6 +374,9 @@ NTSTATUS TdiAssociateAddressFile( HANDLE AddressHandle, PFILE_OBJECT ConnectionObject); +NTSTATUS TdiDisassociateAddressFile( + PFILE_OBJECT ConnectionObject); + NTSTATUS TdiListen ( PIRP *Irp, PFILE_OBJECT ConnectionObject, diff --git a/drivers/network/afd/include/tdi_proto.h b/drivers/network/afd/include/tdi_proto.h index a70c810e697..277cf736bbb 100644 --- a/drivers/network/afd/include/tdi_proto.h +++ b/drivers/network/afd/include/tdi_proto.h @@ -16,7 +16,8 @@ NTSTATUS TdiCloseDevice(HANDLE Handle, PFILE_OBJECT FileObject); NTSTATUS TdiDisconnect -( PFILE_OBJECT TransportObject, +( PIRP *Irp, + PFILE_OBJECT TransportObject, PLARGE_INTEGER Time, USHORT Flags, PIO_STATUS_BLOCK Iosb, diff --git a/drivers/network/afd/include/tdiconn.h b/drivers/network/afd/include/tdiconn.h index 54f83fc722a..1eb94a33d4c 100644 --- a/drivers/network/afd/include/tdiconn.h +++ b/drivers/network/afd/include/tdiconn.h @@ -7,6 +7,7 @@ typedef VOID *PTDI_CONNECTION_INFO_PAIR; PTRANSPORT_ADDRESS TaCopyTransportAddress( PTRANSPORT_ADDRESS OtherAddress ); +PTRANSPORT_ADDRESS TaBuildNullTransportAddress(UINT AddressType); UINT TaLengthOfAddress( PTA_ADDRESS Addr ); UINT TaLengthOfTransportAddress( PTRANSPORT_ADDRESS Addr ); VOID TaCopyAddressInPlace( PTA_ADDRESS Target, PTA_ADDRESS Source ); @@ -19,12 +20,7 @@ NTSTATUS TdiBuildConnectionInfoInPlace ( PTDI_CONNECTION_INFORMATION ConnInfo, PTRANSPORT_ADDRESS Name ); NTSTATUS TdiBuildConnectionInfo ( PTDI_CONNECTION_INFORMATION *ConnectionInfo, PTRANSPORT_ADDRESS Name ); -NTSTATUS TdiBuildNullConnectionInfoToPlace +NTSTATUS TdiBuildNullConnectionInfoInPlace ( PTDI_CONNECTION_INFORMATION ConnInfo, ULONG Type ); NTSTATUS TdiBuildNullConnectionInfo ( PTDI_CONNECTION_INFORMATION *ConnectionInfo, ULONG Type ); -NTSTATUS TdiBuildConnectionInfoPair -( PTDI_CONNECTION_INFO_PAIR ConnectionInfo, - PTRANSPORT_ADDRESS From, - PTRANSPORT_ADDRESS To ); -PTA_ADDRESS TdiGetRemoteAddress( PTDI_CONNECTION_INFORMATION TdiConn ); diff --git a/drivers/network/dd/ne2000/CMakeLists.txt b/drivers/network/dd/ne2000/CMakeLists.txt index f11ebe95a9b..32c2d8b01af 100644 --- a/drivers/network/dd/ne2000/CMakeLists.txt +++ b/drivers/network/dd/ne2000/CMakeLists.txt @@ -7,8 +7,7 @@ list(APPEND SOURCE ne2000.rc) add_library(ne2000 SHARED ${SOURCE}) - +add_pch(ne2000 include/ne2000.h) set_module_type(ne2000 kernelmodedriver) add_importlibs(ne2000 ndis ntoskrnl hal) - add_cd_file(TARGET ne2000 DESTINATION reactos/system32/drivers FOR all) diff --git a/drivers/network/dd/ne2000/include/ne2000.h b/drivers/network/dd/ne2000/include/ne2000.h index 4c4e28bdbcd..3acb69bfa7d 100644 --- a/drivers/network/dd/ne2000/include/ne2000.h +++ b/drivers/network/dd/ne2000/include/ne2000.h @@ -5,8 +5,6 @@ * PURPOSE: NE2000 driver definitions */ -#pragma once - #define NDIS_MINIPORT_DRIVER 1 #define NDIS_LEGACY_MINIPORT 1 #define NDIS51_MINIPORT 1 diff --git a/drivers/network/dd/ne2000/ne2000.rbuild b/drivers/network/dd/ne2000/ne2000.rbuild index d3b5e17405b..f6a7ec4b0ad 100644 --- a/drivers/network/dd/ne2000/ne2000.rbuild +++ b/drivers/network/dd/ne2000/ne2000.rbuild @@ -9,5 +9,8 @@ 8390.c main.c + + ne2000.h + ne2000.rc diff --git a/drivers/network/dd/ne2000/ne2000/8390.c b/drivers/network/dd/ne2000/ne2000/8390.c index 03adcab94bf..3ef4f911d6b 100644 --- a/drivers/network/dd/ne2000/ne2000/8390.c +++ b/drivers/network/dd/ne2000/ne2000/8390.c @@ -8,7 +8,6 @@ * CSH 27/08-2000 Created */ #include -#include /* Null-terminated array of ports to probe. This is "semi-risky" (Don Becker). */ ULONG_PTR ProbeAddressList[] = { 0x280, 0x300, 0x320, 0x340, 0x360, 0x380, 0 }; diff --git a/drivers/network/dd/ne2000/ne2000/main.c b/drivers/network/dd/ne2000/ne2000/main.c index 626b5763d99..09cf47386ac 100644 --- a/drivers/network/dd/ne2000/ne2000/main.c +++ b/drivers/network/dd/ne2000/ne2000/main.c @@ -8,7 +8,6 @@ * CSH 27/08-2000 Created */ #include -#include NTSTATUS NTAPI diff --git a/drivers/network/dd/pcnet/CMakeLists.txt b/drivers/network/dd/pcnet/CMakeLists.txt index 7235782f5e0..b1a513667e8 100644 --- a/drivers/network/dd/pcnet/CMakeLists.txt +++ b/drivers/network/dd/pcnet/CMakeLists.txt @@ -11,8 +11,7 @@ list(APPEND SOURCE pcnet.rc) add_library(pcnet SHARED ${SOURCE}) - +add_pch(pcnet pcnet.h) set_module_type(pcnet kernelmodedriver) add_importlibs(pcnet ndis ntoskrnl hal) - add_cd_file(TARGET pcnet DESTINATION reactos/system32/drivers FOR all) diff --git a/drivers/network/dd/pcnet/pcnet.c b/drivers/network/dd/pcnet/pcnet.c index 6aca85bbbf2..457794fdadd 100644 --- a/drivers/network/dd/pcnet/pcnet.c +++ b/drivers/network/dd/pcnet/pcnet.c @@ -38,9 +38,6 @@ * - this assumes a 32-bit machine */ -#include -#include "pci.h" -#include "pcnethw.h" #include "pcnet.h" #define NDEBUG @@ -148,7 +145,7 @@ MiniportHandleInterrupt( Descriptor->FLAGS |= RD_OWN; Adapter->CurrentReceiveDescriptorIndex++; - Adapter->CurrentReceiveDescriptorIndex %= NUMBER_OF_BUFFERS; + Adapter->CurrentReceiveDescriptorIndex %= Adapter->BufferCount; Adapter->Statistics.RcvGoodFrames++; } @@ -204,7 +201,7 @@ MiniportHandleInterrupt( } Adapter->CurrentTransmitStartIndex++; - Adapter->CurrentTransmitStartIndex %= NUMBER_OF_BUFFERS; + Adapter->CurrentTransmitStartIndex %= Adapter->BufferCount; Adapter->Statistics.XmtGoodFrames++; } @@ -249,16 +246,14 @@ MiQueryCard( if(Status != 4) { Status = NDIS_STATUS_FAILURE; - DPRINT("NdisReadPciSlotInformation failed\n"); - BREAKPOINT; + DPRINT1("NdisReadPciSlotInformation failed\n"); return Status; } if(buf32 != PCI_ID) { Status = NDIS_STATUS_ADAPTER_NOT_FOUND; - DPRINT("card in slot isn't our: 0x%x\n", 0, buf32); - BREAKPOINT; + DPRINT1("card in slot isn't our: 0x%x\n", 0, buf32); return Status; } @@ -272,14 +267,13 @@ MiQueryCard( if(Status != 4) { Status = NDIS_STATUS_FAILURE; - DPRINT("NdisReadPciSlotInformation failed\n"); - BREAKPOINT; + DPRINT1("NdisReadPciSlotInformation failed\n"); return Status; } if(!buf32) { - DPRINT("No base i/o address set\n"); + DPRINT1("No base i/o address set\n"); return NDIS_STATUS_FAILURE; } @@ -294,7 +288,6 @@ MiQueryCard( { Status = NDIS_STATUS_FAILURE; DPRINT1("NdisReadPciSlotInformation failed\n"); - BREAKPOINT; return Status; } @@ -304,6 +297,60 @@ MiQueryCard( return NDIS_STATUS_SUCCESS; } +static VOID +MiFreeSharedMemory( + PADAPTER Adapter) +/* + * FUNCTION: Free all allocated shared memory + * ARGUMENTS: + * Adapter: pointer to the miniport's adapter struct + */ +{ + NDIS_PHYSICAL_ADDRESS PhysicalAddress; + + PhysicalAddress.u.HighPart = 0; + + if(Adapter->InitializationBlockVirt) + { + PhysicalAddress.u.LowPart = (ULONG)Adapter->InitializationBlockPhys; + NdisMFreeSharedMemory(Adapter->MiniportAdapterHandle, Adapter->InitializationBlockLength, + FALSE, Adapter->InitializationBlockVirt, PhysicalAddress); + Adapter->InitializationBlockVirt = NULL; + } + + if(Adapter->TransmitDescriptorRingVirt) + { + PhysicalAddress.u.LowPart = (ULONG)Adapter->TransmitDescriptorRingPhys; + NdisMFreeSharedMemory(Adapter->MiniportAdapterHandle, Adapter->TransmitDescriptorRingLength, + FALSE, Adapter->TransmitDescriptorRingVirt, PhysicalAddress); + Adapter->TransmitDescriptorRingVirt = NULL; + } + + if(Adapter->ReceiveDescriptorRingVirt) + { + PhysicalAddress.u.LowPart = (ULONG)Adapter->ReceiveDescriptorRingPhys; + NdisMFreeSharedMemory(Adapter->MiniportAdapterHandle, Adapter->ReceiveDescriptorRingLength, + FALSE, Adapter->ReceiveDescriptorRingVirt, PhysicalAddress); + Adapter->ReceiveDescriptorRingVirt = NULL; + } + + if(Adapter->TransmitBufferPtrVirt) + { + PhysicalAddress.u.LowPart = (ULONG)Adapter->TransmitBufferPtrPhys; + NdisMFreeSharedMemory(Adapter->MiniportAdapterHandle, Adapter->TransmitBufferLength, + TRUE, Adapter->TransmitBufferPtrVirt, PhysicalAddress); + Adapter->TransmitBufferPtrVirt = NULL; + } + + if(Adapter->ReceiveBufferPtrVirt) + { + PhysicalAddress.u.LowPart = (ULONG)Adapter->ReceiveBufferPtrPhys; + NdisMFreeSharedMemory(Adapter->MiniportAdapterHandle, Adapter->ReceiveBufferLength, + TRUE, Adapter->ReceiveBufferPtrVirt, PhysicalAddress); + Adapter->ReceiveBufferPtrVirt = NULL; + } +} + static NDIS_STATUS MiAllocateSharedMemory( PADAPTER Adapter) @@ -320,114 +367,133 @@ MiAllocateSharedMemory( PRECEIVE_DESCRIPTOR ReceiveDescriptor; NDIS_PHYSICAL_ADDRESS PhysicalAddress; ULONG i; + ULONG BufferCount = NUMBER_OF_BUFFERS; + ULONG LogBufferCount = LOG_NUMBER_OF_BUFFERS; - /* allocate the initialization block */ - Adapter->InitializationBlockLength = sizeof(INITIALIZATION_BLOCK); - NdisMAllocateSharedMemory(Adapter->MiniportAdapterHandle, Adapter->InitializationBlockLength, - FALSE, (PVOID *)&Adapter->InitializationBlockVirt, &PhysicalAddress); - if(!Adapter->InitializationBlockVirt) - { - DPRINT1("insufficient resources\n"); - BREAKPOINT; + while (BufferCount != 0) + { + /* allocate the initialization block (we have this in the loop so we can use MiFreeSharedMemory) */ + Adapter->InitializationBlockLength = sizeof(INITIALIZATION_BLOCK); + NdisMAllocateSharedMemory(Adapter->MiniportAdapterHandle, Adapter->InitializationBlockLength, + FALSE, (PVOID *)&Adapter->InitializationBlockVirt, &PhysicalAddress); + if(!Adapter->InitializationBlockVirt) + { + /* Buffer backoff won't help us here */ + DPRINT1("insufficient resources\n"); + return NDIS_STATUS_RESOURCES; + } + + if(((ULONG)Adapter->InitializationBlockVirt & 0x00000003) != 0) + { + DPRINT1("address 0x%x not dword-aligned\n", Adapter->InitializationBlockVirt); + return NDIS_STATUS_RESOURCES; + } + + Adapter->InitializationBlockPhys = (PINITIALIZATION_BLOCK)NdisGetPhysicalAddressLow(PhysicalAddress); + + /* allocate the transport descriptor ring */ + Adapter->TransmitDescriptorRingLength = sizeof(TRANSMIT_DESCRIPTOR) * BufferCount; + NdisMAllocateSharedMemory(Adapter->MiniportAdapterHandle, Adapter->TransmitDescriptorRingLength, + FALSE, (PVOID *)&Adapter->TransmitDescriptorRingVirt, &PhysicalAddress); + if (!Adapter->TransmitDescriptorRingVirt) + { + DPRINT1("Backing off buffer count by %d buffers due to allocation failure\n", (BufferCount >> 1)); + BufferCount = BufferCount >> 1; + LogBufferCount--; + MiFreeSharedMemory(Adapter); + continue; + } + + if (((ULONG)Adapter->TransmitDescriptorRingVirt & 0x00000003) != 0) + { + DPRINT1("address 0x%x not dword-aligned\n", Adapter->TransmitDescriptorRingVirt); + return NDIS_STATUS_RESOURCES; + } + + Adapter->TransmitDescriptorRingPhys = (PTRANSMIT_DESCRIPTOR)NdisGetPhysicalAddressLow(PhysicalAddress); + RtlZeroMemory(Adapter->TransmitDescriptorRingVirt, sizeof(TRANSMIT_DESCRIPTOR) * BufferCount); + + /* allocate the receive descriptor ring */ + Adapter->ReceiveDescriptorRingLength = sizeof(RECEIVE_DESCRIPTOR) * BufferCount; + NdisMAllocateSharedMemory(Adapter->MiniportAdapterHandle, Adapter->ReceiveDescriptorRingLength, + FALSE, (PVOID *)&Adapter->ReceiveDescriptorRingVirt, &PhysicalAddress); + if (!Adapter->ReceiveDescriptorRingVirt) + { + DPRINT1("Backing off buffer count by %d buffers due to allocation failure\n", (BufferCount >> 1)); + BufferCount = BufferCount >> 1; + LogBufferCount--; + MiFreeSharedMemory(Adapter); + continue; + } + + if (((ULONG)Adapter->ReceiveDescriptorRingVirt & 0x00000003) != 0) + { + DPRINT1("address 0x%x not dword-aligned\n", Adapter->ReceiveDescriptorRingVirt); + return NDIS_STATUS_RESOURCES; + } + + Adapter->ReceiveDescriptorRingPhys = (PRECEIVE_DESCRIPTOR)NdisGetPhysicalAddressLow(PhysicalAddress); + RtlZeroMemory(Adapter->ReceiveDescriptorRingVirt, sizeof(RECEIVE_DESCRIPTOR) * BufferCount); + + /* allocate transmit buffers */ + Adapter->TransmitBufferLength = BUFFER_SIZE * BufferCount; + NdisMAllocateSharedMemory(Adapter->MiniportAdapterHandle, Adapter->TransmitBufferLength, + TRUE, (PVOID *)&Adapter->TransmitBufferPtrVirt, &PhysicalAddress); + if(!Adapter->TransmitBufferPtrVirt) + { + DPRINT1("Backing off buffer count by %d buffers due to allocation failure\n", (BufferCount >> 1)); + BufferCount = BufferCount >> 1; + LogBufferCount--; + MiFreeSharedMemory(Adapter); + continue; + } + + if (((ULONG)Adapter->TransmitBufferPtrVirt & 0x00000003) != 0) + { + DPRINT1("address 0x%x not dword-aligned\n", Adapter->TransmitBufferPtrVirt); + return NDIS_STATUS_RESOURCES; + } + + Adapter->TransmitBufferPtrPhys = (PCHAR)NdisGetPhysicalAddressLow(PhysicalAddress); + RtlZeroMemory(Adapter->TransmitBufferPtrVirt, BUFFER_SIZE * BufferCount); + + /* allocate receive buffers */ + Adapter->ReceiveBufferLength = BUFFER_SIZE * BufferCount; + NdisMAllocateSharedMemory(Adapter->MiniportAdapterHandle, Adapter->ReceiveBufferLength, + TRUE, (PVOID *)&Adapter->ReceiveBufferPtrVirt, &PhysicalAddress); + if(!Adapter->ReceiveBufferPtrVirt) + { + DPRINT1("Backing off buffer count by %d buffers due to allocation failure\n", (BufferCount >> 1)); + BufferCount = BufferCount >> 1; + LogBufferCount--; + MiFreeSharedMemory(Adapter); + continue; + } + + if (((ULONG)Adapter->ReceiveBufferPtrVirt & 0x00000003) != 0) + { + DPRINT1("address 0x%x not dword-aligned\n", Adapter->ReceiveBufferPtrVirt); + return NDIS_STATUS_RESOURCES; + } + + Adapter->ReceiveBufferPtrPhys = (PCHAR)NdisGetPhysicalAddressLow(PhysicalAddress); + RtlZeroMemory(Adapter->ReceiveBufferPtrVirt, BUFFER_SIZE * BufferCount); + + break; + } + + if (!BufferCount) + { + DPRINT1("Failed to allocate adapter buffers\n"); return NDIS_STATUS_RESOURCES; - } + } - if(((ULONG)Adapter->InitializationBlockVirt & 0x00000003) != 0) - { - DPRINT("address 0x%x not dword-aligned\n", Adapter->InitializationBlockVirt); - BREAKPOINT; - return NDIS_STATUS_RESOURCES; - } - - Adapter->InitializationBlockPhys = (PINITIALIZATION_BLOCK)NdisGetPhysicalAddressLow(PhysicalAddress); - - /* allocate the transport descriptor ring */ - Adapter->TransmitDescriptorRingLength = sizeof(TRANSMIT_DESCRIPTOR) * NUMBER_OF_BUFFERS; - NdisMAllocateSharedMemory(Adapter->MiniportAdapterHandle, Adapter->TransmitDescriptorRingLength, - FALSE, (PVOID *)&Adapter->TransmitDescriptorRingVirt, &PhysicalAddress); - if(!Adapter->TransmitDescriptorRingVirt) - { - DPRINT1("insufficient resources\n"); - BREAKPOINT; - return NDIS_STATUS_RESOURCES; - } - - if(((ULONG)Adapter->TransmitDescriptorRingVirt & 0x00000003) != 0) - { - DPRINT("address 0x%x not dword-aligned\n", Adapter->TransmitDescriptorRingVirt); - BREAKPOINT; - return NDIS_STATUS_RESOURCES; - } - - Adapter->TransmitDescriptorRingPhys = (PTRANSMIT_DESCRIPTOR)NdisGetPhysicalAddressLow(PhysicalAddress); - RtlZeroMemory(Adapter->TransmitDescriptorRingVirt, sizeof(TRANSMIT_DESCRIPTOR) * NUMBER_OF_BUFFERS); - - /* allocate the receive descriptor ring */ - Adapter->ReceiveDescriptorRingLength = sizeof(RECEIVE_DESCRIPTOR) * NUMBER_OF_BUFFERS; - NdisMAllocateSharedMemory(Adapter->MiniportAdapterHandle, Adapter->ReceiveDescriptorRingLength, - FALSE, (PVOID *)&Adapter->ReceiveDescriptorRingVirt, &PhysicalAddress); - if(!Adapter->ReceiveDescriptorRingVirt) - { - DPRINT1("insufficient resources\n"); - BREAKPOINT; - return NDIS_STATUS_RESOURCES; - } - - if(((ULONG)Adapter->ReceiveDescriptorRingVirt & 0x00000003) != 0) - { - DPRINT("address 0x%x not dword-aligned\n", Adapter->ReceiveDescriptorRingVirt); - BREAKPOINT; - return NDIS_STATUS_RESOURCES; - } - - Adapter->ReceiveDescriptorRingPhys = (PRECEIVE_DESCRIPTOR)NdisGetPhysicalAddressLow(PhysicalAddress); - RtlZeroMemory(Adapter->ReceiveDescriptorRingVirt, sizeof(RECEIVE_DESCRIPTOR) * NUMBER_OF_BUFFERS); - - /* allocate transmit buffers */ - Adapter->TransmitBufferLength = BUFFER_SIZE * NUMBER_OF_BUFFERS; - NdisMAllocateSharedMemory(Adapter->MiniportAdapterHandle, Adapter->TransmitBufferLength, - FALSE, (PVOID *)&Adapter->TransmitBufferPtrVirt, &PhysicalAddress); - if(!Adapter->TransmitBufferPtrVirt) - { - DPRINT1("insufficient resources\n"); - BREAKPOINT; - return NDIS_STATUS_RESOURCES; - } - - if(((ULONG)Adapter->TransmitBufferPtrVirt & 0x00000003) != 0) - { - DPRINT("address 0x%x not dword-aligned\n", Adapter->TransmitBufferPtrVirt); - BREAKPOINT; - return NDIS_STATUS_RESOURCES; - } - - Adapter->TransmitBufferPtrPhys = (PCHAR)NdisGetPhysicalAddressLow(PhysicalAddress); - RtlZeroMemory(Adapter->TransmitBufferPtrVirt, BUFFER_SIZE * NUMBER_OF_BUFFERS); - - /* allocate receive buffers */ - Adapter->ReceiveBufferLength = BUFFER_SIZE * NUMBER_OF_BUFFERS; - NdisMAllocateSharedMemory(Adapter->MiniportAdapterHandle, Adapter->ReceiveBufferLength, - FALSE, (PVOID *)&Adapter->ReceiveBufferPtrVirt, &PhysicalAddress); - if(!Adapter->ReceiveBufferPtrVirt) - { - DPRINT1("insufficient resources\n"); - BREAKPOINT; - return NDIS_STATUS_RESOURCES; - } - - if(((ULONG)Adapter->ReceiveBufferPtrVirt & 0x00000003) != 0) - { - DPRINT("address 0x%x not dword-aligned\n", Adapter->ReceiveBufferPtrVirt); - BREAKPOINT; - return NDIS_STATUS_RESOURCES; - } - - Adapter->ReceiveBufferPtrPhys = (PCHAR)NdisGetPhysicalAddressLow(PhysicalAddress); - RtlZeroMemory(Adapter->ReceiveBufferPtrVirt, BUFFER_SIZE * NUMBER_OF_BUFFERS); + Adapter->BufferCount = BufferCount; + Adapter->LogBufferCount = LogBufferCount; /* initialize tx descriptors */ TransmitDescriptor = Adapter->TransmitDescriptorRingVirt; - for(i = 0; i < NUMBER_OF_BUFFERS; i++) + for(i = 0; i < BufferCount; i++) { (TransmitDescriptor+i)->TBADR = (ULONG)Adapter->TransmitBufferPtrPhys + i * BUFFER_SIZE; (TransmitDescriptor+i)->BCNT = 0xf000 | -BUFFER_SIZE; /* 2's compliment + set top 4 bits */ @@ -438,7 +504,7 @@ MiAllocateSharedMemory( /* initialize rx */ ReceiveDescriptor = Adapter->ReceiveDescriptorRingVirt; - for(i = 0; i < NUMBER_OF_BUFFERS; i++) + for(i = 0; i < BufferCount; i++) { (ReceiveDescriptor+i)->RBADR = (ULONG)Adapter->ReceiveBufferPtrPhys + i * BUFFER_SIZE; (ReceiveDescriptor+i)->BCNT = 0xf000 | -BUFFER_SIZE; /* 2's compliment + set top 4 bits */ @@ -477,61 +543,12 @@ MiPrepareInitializationBlock( /* set up receive ring */ DPRINT("Receive ring physical address: 0x%x\n", Adapter->ReceiveDescriptorRingPhys); Adapter->InitializationBlockVirt->RDRA = (ULONG)Adapter->ReceiveDescriptorRingPhys; - Adapter->InitializationBlockVirt->RLEN = (LOG_NUMBER_OF_BUFFERS << 4) & 0xf0; + Adapter->InitializationBlockVirt->RLEN = (Adapter->LogBufferCount << 4) & 0xf0; /* set up transmit ring */ DPRINT("Transmit ring physical address: 0x%x\n", Adapter->TransmitDescriptorRingPhys); Adapter->InitializationBlockVirt->TDRA = (ULONG)Adapter->TransmitDescriptorRingPhys; - Adapter->InitializationBlockVirt->TLEN = (LOG_NUMBER_OF_BUFFERS << 4) & 0xf0; -} - -static VOID -MiFreeSharedMemory( - PADAPTER Adapter) -/* - * FUNCTION: Free all allocated shared memory - * ARGUMENTS: - * Adapter: pointer to the miniport's adapter struct - */ -{ - NDIS_PHYSICAL_ADDRESS PhysicalAddress; - - PhysicalAddress.u.HighPart = 0; - - if(Adapter->InitializationBlockVirt) - { - PhysicalAddress.u.LowPart = (ULONG)Adapter->InitializationBlockPhys; - NdisMFreeSharedMemory(Adapter->MiniportAdapterHandle, Adapter->InitializationBlockLength, - FALSE, Adapter->InitializationBlockVirt, PhysicalAddress); - } - - if(Adapter->TransmitDescriptorRingVirt) - { - PhysicalAddress.u.LowPart = (ULONG)Adapter->TransmitDescriptorRingPhys; - NdisMFreeSharedMemory(Adapter->MiniportAdapterHandle, Adapter->TransmitDescriptorRingLength, - FALSE, Adapter->TransmitDescriptorRingVirt, PhysicalAddress); - } - - if(Adapter->ReceiveDescriptorRingVirt) - { - PhysicalAddress.u.LowPart = (ULONG)Adapter->ReceiveDescriptorRingPhys; - NdisMFreeSharedMemory(Adapter->MiniportAdapterHandle, Adapter->ReceiveDescriptorRingLength, - FALSE, Adapter->ReceiveDescriptorRingVirt, PhysicalAddress); - } - - if(Adapter->TransmitBufferPtrVirt) - { - PhysicalAddress.u.LowPart = (ULONG)Adapter->TransmitBufferPtrPhys; - NdisMFreeSharedMemory(Adapter->MiniportAdapterHandle, Adapter->TransmitBufferLength, - FALSE, Adapter->TransmitBufferPtrVirt, PhysicalAddress); - } - - if(Adapter->ReceiveBufferPtrVirt) - { - PhysicalAddress.u.LowPart = (ULONG)Adapter->ReceiveBufferPtrPhys; - NdisMFreeSharedMemory(Adapter->MiniportAdapterHandle, Adapter->ReceiveBufferLength, - FALSE, Adapter->ReceiveBufferPtrVirt, PhysicalAddress); - } + Adapter->InitializationBlockVirt->TLEN = (Adapter->LogBufferCount << 4) & 0xf0; } static BOOLEAN @@ -861,7 +878,7 @@ MiniportInitialize( UINT i = 0; PADAPTER Adapter = 0; NDIS_STATUS Status = NDIS_STATUS_FAILURE; - BOOLEAN InterruptRegistered = FALSE; + BOOLEAN InterruptRegistered = FALSE, MapRegistersAllocated = FALSE; NDIS_HANDLE ConfigurationHandle; UINT *RegNetworkAddress = 0; UINT RegNetworkAddressLength = 0; @@ -877,7 +894,6 @@ MiniportInitialize( { Status = NDIS_STATUS_UNSUPPORTED_MEDIA; DPRINT1("unsupported media\n"); - BREAKPOINT; *OpenErrorStatus = Status; return Status; } @@ -890,7 +906,6 @@ MiniportInitialize( { Status = NDIS_STATUS_RESOURCES; DPRINT1("Insufficient resources\n"); - BREAKPOINT; *OpenErrorStatus = Status; return Status; } @@ -910,7 +925,6 @@ MiniportInitialize( { DPRINT1("MiQueryCard failed\n"); Status = NDIS_STATUS_ADAPTER_NOT_FOUND; - BREAKPOINT; break; } @@ -920,7 +934,6 @@ MiniportInitialize( if(Status != NDIS_STATUS_SUCCESS) { DPRINT1("NdisMRegisterIoPortRange failed: 0x%x\n", Status); - BREAKPOINT break; } @@ -930,17 +943,17 @@ MiniportInitialize( if(Status != NDIS_STATUS_SUCCESS) { DPRINT1("NdisMAllocateMapRegisters failed: 0x%x\n", Status); - BREAKPOINT break; } + MapRegistersAllocated = TRUE; + /* set up the interrupt */ Status = NdisMRegisterInterrupt(&Adapter->InterruptObject, Adapter->MiniportAdapterHandle, Adapter->InterruptVector, Adapter->InterruptVector, TRUE, TRUE, NdisInterruptLevelSensitive); if(Status != NDIS_STATUS_SUCCESS) { - DPRINT("NdisMRegisterInterrupt failed: 0x%x\n", Status); - BREAKPOINT + DPRINT1("NdisMRegisterInterrupt failed: 0x%x\n", Status); break; } @@ -951,8 +964,7 @@ MiniportInitialize( if(Status != NDIS_STATUS_SUCCESS) { Status = NDIS_STATUS_RESOURCES; - DPRINT("MiAllocateSharedMemory failed", Status); - BREAKPOINT + DPRINT1("MiAllocateSharedMemory failed\n", Status); break; } @@ -993,7 +1005,10 @@ MiniportInitialize( { DPRINT("Error; freeing stuff\n"); - NdisMFreeMapRegisters(Adapter->MiniportAdapterHandle); /* doesn't hurt to free if we never alloc'd? */ + MiFreeSharedMemory(Adapter); + + if(MapRegistersAllocated) + NdisMFreeMapRegisters(Adapter->MiniportAdapterHandle); if(Adapter->PortOffset) NdisMDeregisterIoPortRange(Adapter->MiniportAdapterHandle, Adapter->IoBaseAddress, NUMBER_OF_PORTS, (PVOID)Adapter->PortOffset); @@ -1001,8 +1016,6 @@ MiniportInitialize( if(InterruptRegistered) NdisMDeregisterInterrupt(&Adapter->InterruptObject); - MiFreeSharedMemory(Adapter); - NdisFreeMemory(Adapter, 0, 0); } @@ -1157,7 +1170,7 @@ MiniportSend( /* Check if we have free entry in our circular buffer. */ if ((Adapter->CurrentTransmitEndIndex + 1 == Adapter->CurrentTransmitStartIndex) || - (Adapter->CurrentTransmitEndIndex == NUMBER_OF_BUFFERS - 1 && + (Adapter->CurrentTransmitEndIndex == Adapter->BufferCount - 1 && Adapter->CurrentTransmitStartIndex == 0)) { DPRINT1("No free space in circular buffer\n"); @@ -1202,7 +1215,7 @@ MiniportSend( #endif Adapter->CurrentTransmitEndIndex++; - Adapter->CurrentTransmitEndIndex %= NUMBER_OF_BUFFERS; + Adapter->CurrentTransmitEndIndex %= Adapter->BufferCount; Desc->FLAGS = TD1_OWN | TD1_STP | TD1_ENP; Desc->BCNT = 0xf000 | -TotalPacketLength; diff --git a/drivers/network/dd/pcnet/pcnet.h b/drivers/network/dd/pcnet/pcnet.h index 1a23ba53ec6..4dc6a8a5cee 100644 --- a/drivers/network/dd/pcnet/pcnet.h +++ b/drivers/network/dd/pcnet/pcnet.h @@ -25,7 +25,9 @@ * - this assumes 32-bit physical addresses */ -#pragma once +#include +#include "pci.h" +#include "pcnethw.h" /* statistics struct */ typedef struct _ADAPTER_STATS @@ -95,6 +97,10 @@ typedef struct _ADAPTER PCHAR ReceiveBufferPtrVirt; PCHAR ReceiveBufferPtrPhys; + /* buffer count */ + ULONG BufferCount; + ULONG LogBufferCount; + ADAPTER_STATS Statistics; } ADAPTER, *PADAPTER; @@ -151,11 +157,5 @@ MiGetMediaDuplex(PADAPTER Adapter); /* Maximum number of interrupts handled per call to MiniportHandleInterrupt */ #define INTERRUPT_LIMIT 10 -#if DBG -#define BREAKPOINT DbgBreakPoint(); -#else -#define BREAKPOINT -#endif - /* memory pool tag */ #define PCNET_TAG 'tNcP' diff --git a/drivers/network/dd/pcnet/pcnet.rbuild b/drivers/network/dd/pcnet/pcnet.rbuild index b2683c87a0b..17e4de4af6e 100644 --- a/drivers/network/dd/pcnet/pcnet.rbuild +++ b/drivers/network/dd/pcnet/pcnet.rbuild @@ -12,4 +12,5 @@ pcnet.c requests.c pcnet.rc + pcnet.h diff --git a/drivers/network/dd/pcnet/requests.c b/drivers/network/dd/pcnet/requests.c index 43ad68f0518..79faee5d14e 100644 --- a/drivers/network/dd/pcnet/requests.c +++ b/drivers/network/dd/pcnet/requests.c @@ -33,8 +33,6 @@ * necessary. */ -#include -#include "pcnethw.h" #include "pcnet.h" #define NDEBUG diff --git a/drivers/network/ndis/CMakeLists.txt b/drivers/network/ndis/CMakeLists.txt index 60b7bcc52f1..f548a1b17d9 100644 --- a/drivers/network/ndis/CMakeLists.txt +++ b/drivers/network/ndis/CMakeLists.txt @@ -35,12 +35,12 @@ list(APPEND SOURCE ndis.rc ${CMAKE_CURRENT_BINARY_DIR}/ndis.def) -add_library(ndis SHARED ${CMAKE_CURRENT_BINARY_DIR}/ndis_ndissys.h.gch ${SOURCE}) +add_library(ndis SHARED ${SOURCE}) set_module_type(ndis kernelmodedriver) add_importlibs(ndis ntoskrnl hal) -add_pch(ndis ${CMAKE_CURRENT_SOURCE_DIR}/include/ndissys.h ${SOURCE}) +add_pch(ndis include/ndissys.h) add_cd_file(TARGET ndis DESTINATION reactos/system32/drivers FOR all) add_importlib_target(ndis.spec) diff --git a/drivers/network/ndis/include/ndissys.h b/drivers/network/ndis/include/ndissys.h index 10c6a26ede4..4eedf3dacd5 100644 --- a/drivers/network/ndis/include/ndissys.h +++ b/drivers/network/ndis/include/ndissys.h @@ -21,6 +21,7 @@ #include "miniport.h" #include "protocol.h" +#include "efilter.h" #include "buffer.h" /* Exported functions */ diff --git a/drivers/network/ndis/ndis/50stubs.c b/drivers/network/ndis/ndis/50stubs.c index ece754100e3..1a7588d9e29 100644 --- a/drivers/network/ndis/ndis/50stubs.c +++ b/drivers/network/ndis/ndis/50stubs.c @@ -523,26 +523,3 @@ NdisPacketPoolUsage( return 0; } - - -/* - * @unimplemented - */ -VOID -EXPORT -NdisMDeregisterIoPortRange( - IN NDIS_HANDLE MiniportAdapterHandle, - IN UINT InitialPort, - IN UINT NumberOfPorts, - IN PVOID PortOffset) -/* - * FUNCTION: Releases a register mapping to I/O ports - * ARGUMENTS: - * MiniportAdapterHandle = Specifies handle input to MiniportInitialize - * InitialPort = Bus-relative base port address of a range to be mapped - * NumberOfPorts = Specifies number of ports to be mapped - * PortOffset = Pointer to mapped base port address - */ -{ - UNIMPLEMENTED -} diff --git a/drivers/network/ndis/ndis/efilter.c b/drivers/network/ndis/ndis/efilter.c index 0a4194dff32..bbde5bdc7be 100644 --- a/drivers/network/ndis/ndis/efilter.c +++ b/drivers/network/ndis/ndis/efilter.c @@ -10,7 +10,6 @@ */ #include "ndissys.h" -#include "efilter.h" BOOLEAN NTAPI diff --git a/drivers/network/ndis/ndis/io.c b/drivers/network/ndis/ndis/io.c index 0f809bf2890..76f6421f310 100644 --- a/drivers/network/ndis/ndis/io.c +++ b/drivers/network/ndis/ndis/io.c @@ -898,6 +898,51 @@ NdisMRegisterIoPortRange( return NDIS_STATUS_SUCCESS; } +/* + * @implemented + */ +VOID +EXPORT +NdisMDeregisterIoPortRange(IN NDIS_HANDLE MiniportAdapterHandle, + IN UINT InitialPort, + IN UINT NumberOfPorts, + IN PVOID PortOffset) +/* + * FUNCTION: Releases a register mapping to I/O ports + * ARGUMENTS: + * MiniportAdapterHandle = Specifies handle input to MiniportInitialize + * InitialPort = Bus-relative base port address of a range to be mapped + * NumberOfPorts = Specifies number of ports to be mapped + * PortOffset = Pointer to mapped base port address + */ +{ + PLOGICAL_ADAPTER Adapter = (PLOGICAL_ADAPTER)MiniportAdapterHandle; + PHYSICAL_ADDRESS PortAddress = RtlConvertUlongToLargeInteger(InitialPort); + PHYSICAL_ADDRESS TranslatedAddress; + ULONG AddressSpace = 1; + + NDIS_DbgPrint(MAX_TRACE, ("Called - InitialPort 0x%x, NumberOfPorts 0x%x, Port Offset 0x%x\n", InitialPort, NumberOfPorts, PortOffset)); + + /* Translate the initial port again to find the address space of the translated address */ + if(!HalTranslateBusAddress(Adapter->NdisMiniportBlock.BusType, Adapter->NdisMiniportBlock.BusNumber, + PortAddress, &AddressSpace, &TranslatedAddress)) + { + NDIS_DbgPrint(MIN_TRACE, ("Unable to translate address\n")); + return; + } + + /* Make sure we got the same translation as last time */ + ASSERT(TranslatedAddress.QuadPart == (ULONG_PTR)PortOffset); + + /* Check if we're in memory space */ + if (!AddressSpace) + { + NDIS_DbgPrint(MAX_TRACE, ("Calling MmUnmapIoSpace\n")); + + /* Unmap the memory */ + MmUnmapIoSpace(PortOffset, NumberOfPorts); + } +} /* * @implemented diff --git a/drivers/network/ndis/ndis/miniport.c b/drivers/network/ndis/ndis/miniport.c index dd6227f2137..3353f69518a 100644 --- a/drivers/network/ndis/ndis/miniport.c +++ b/drivers/network/ndis/ndis/miniport.c @@ -12,9 +12,6 @@ */ #include "ndissys.h" -#include "efilter.h" - -#include /* * Define to 1 to get a debugger breakpoint at the end of NdisInitializeWrapper @@ -2218,48 +2215,54 @@ NdisIDispatchPnp( NDIS_DbgPrint(MIN_TRACE, ("Lower driver failed device start\n")); Irp->IoStatus.Status = Status; IoCompleteRequest(Irp, IO_NO_INCREMENT); - break; + return Status; case IRP_MN_STOP_DEVICE: - Status = NdisIForwardIrpAndWait(Adapter, Irp); - if (NT_SUCCESS(Status) && NT_SUCCESS(Irp->IoStatus.Status)) - { - Status = NdisIPnPStopDevice(DeviceObject, Irp); - } - else - NDIS_DbgPrint(MIN_TRACE, ("Lower driver failed device stop\n")); - Irp->IoStatus.Status = Status; - IoCompleteRequest(Irp, IO_NO_INCREMENT); + Status = NdisIPnPStopDevice(DeviceObject, Irp); + if (!NT_SUCCESS(Status)) + NDIS_DbgPrint(MIN_TRACE, ("WARNING: Ignoring halt device failure! Passing the IRP down anyway\n")); + Irp->IoStatus.Status = STATUS_SUCCESS; break; case IRP_MN_QUERY_REMOVE_DEVICE: case IRP_MN_QUERY_STOP_DEVICE: Status = NdisIPnPQueryStopDevice(DeviceObject, Irp); Irp->IoStatus.Status = Status; - IoCompleteRequest(Irp, IO_NO_INCREMENT); + if (Status != STATUS_SUCCESS) + { + IoCompleteRequest(Irp, IO_NO_INCREMENT); + NDIS_DbgPrint(MIN_TRACE, ("Failing miniport halt request\n")); + return Status; + } break; case IRP_MN_CANCEL_REMOVE_DEVICE: case IRP_MN_CANCEL_STOP_DEVICE: - Status = NdisIPnPCancelStopDevice(DeviceObject, Irp); + Status = NdisIForwardIrpAndWait(Adapter, Irp); + if (NT_SUCCESS(Status) && NT_SUCCESS(Irp->IoStatus.Status)) + { + Status = NdisIPnPCancelStopDevice(DeviceObject, Irp); + } + else + { + NDIS_DbgPrint(MIN_TRACE, ("Lower driver failed cancel stop/remove request\n")); + } Irp->IoStatus.Status = Status; IoCompleteRequest(Irp, IO_NO_INCREMENT); - break; + return Status; case IRP_MN_QUERY_PNP_DEVICE_STATE: Status = NDIS_STATUS_SUCCESS; Irp->IoStatus.Status = Status; Irp->IoStatus.Information |= Adapter->NdisMiniportBlock.PnPFlags; - IoCompleteRequest(Irp, IO_NO_INCREMENT); break; default: - IoSkipCurrentIrpStackLocation(Irp); - Status = IoCallDriver(Adapter->NdisMiniportBlock.NextDeviceObject, Irp); break; } - return Status; + IoSkipCurrentIrpStackLocation(Irp); + return IoCallDriver(Adapter->NdisMiniportBlock.NextDeviceObject, Irp); } diff --git a/drivers/network/ndis/ndis/protocol.c b/drivers/network/ndis/ndis/protocol.c index f41017b1035..b8b54eddcfd 100644 --- a/drivers/network/ndis/ndis/protocol.c +++ b/drivers/network/ndis/ndis/protocol.c @@ -11,7 +11,6 @@ */ #include "ndissys.h" -#include #define SERVICES_KEY L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\" #define LINKAGE_KEY L"\\Linkage" @@ -908,20 +907,22 @@ ndisBindMiniportsToProtocol(OUT PNDIS_STATUS Status, IN PPROTOCOL_BINDING Protoc */ OBJECT_ATTRIBUTES ObjectAttributes; UNICODE_STRING RegistryPath; - WCHAR *RegistryPathStr; + WCHAR *RegistryPathStr, *DataPtr = NULL; NTSTATUS NtStatus; - WCHAR *DataPtr; HANDLE DriverKeyHandle = NULL; PKEY_VALUE_PARTIAL_INFORMATION KeyInformation = NULL; PNDIS_PROTOCOL_CHARACTERISTICS ProtocolCharacteristics = &Protocol->Chars; + UNICODE_STRING ValueName; + ULONG ResultLength; + PLIST_ENTRY CurrentEntry = NULL; RegistryPathStr = ExAllocatePoolWithTag(PagedPool, sizeof(SERVICES_KEY) + ProtocolCharacteristics->Name.Length + sizeof(LINKAGE_KEY), NDIS_TAG + __LINE__); if(!RegistryPathStr) - { + { NDIS_DbgPrint(MIN_TRACE, ("Insufficient resources.\n")); *Status = NDIS_STATUS_RESOURCES; return; - } + } wcscpy(RegistryPathStr, SERVICES_KEY); wcsncat(RegistryPathStr, ((WCHAR *)ProtocolCharacteristics->Name.Buffer), ProtocolCharacteristics->Name.Length / sizeof(WCHAR)); @@ -936,130 +937,165 @@ ndisBindMiniportsToProtocol(OUT PNDIS_STATUS Status, IN PPROTOCOL_BINDING Protoc ExFreePool(RegistryPathStr); - if(!NT_SUCCESS(NtStatus)) - { - NDIS_DbgPrint(MIN_TRACE, ("Unable to open protocol configuration\n")); - *Status = NDIS_STATUS_FAILURE; - return; - } - - NDIS_DbgPrint(MAX_TRACE, ("Successfully opened the registry configuration\n")); - - { - UNICODE_STRING ValueName; - ULONG ResultLength; - - RtlInitUnicodeString(&ValueName, L"Bind"); - - NtStatus = ZwQueryValueKey(DriverKeyHandle, &ValueName, KeyValuePartialInformation, NULL, 0, &ResultLength); - if(NtStatus != STATUS_BUFFER_OVERFLOW && NtStatus != STATUS_BUFFER_TOO_SMALL && NtStatus != STATUS_SUCCESS) - { - NDIS_DbgPrint(MIN_TRACE, ("Unable to query the Bind value for size\n")); - ZwClose(DriverKeyHandle); - *Status = NDIS_STATUS_FAILURE; - return; - } - - KeyInformation = ExAllocatePoolWithTag(PagedPool, sizeof(KEY_VALUE_PARTIAL_INFORMATION) + ResultLength, NDIS_TAG + __LINE__); - if(!KeyInformation) - { - NDIS_DbgPrint(MIN_TRACE, ("Insufficient resources.\n")); - ZwClose(DriverKeyHandle); - *Status = NDIS_STATUS_FAILURE; - return; - } - - NtStatus = ZwQueryValueKey(DriverKeyHandle, &ValueName, KeyValuePartialInformation, KeyInformation, - sizeof(KEY_VALUE_PARTIAL_INFORMATION) + ResultLength, &ResultLength); - - ZwClose(DriverKeyHandle); - - if(!NT_SUCCESS(NtStatus)) - { - NDIS_DbgPrint(MIN_TRACE, ("Unable to query the Bind value\n")); - ExFreePool(KeyInformation); - *Status = NDIS_STATUS_FAILURE; - return; - } - } - - /* Assume success for now */ - *Status = NDIS_STATUS_SUCCESS; - - for (DataPtr = (WCHAR *)KeyInformation->Data; - *DataPtr != 0; - DataPtr += wcslen(DataPtr) + 1) + if(NT_SUCCESS(NtStatus)) { - /* BindContext is for tracking pending binding operations */ - VOID *BindContext = 0; - NDIS_STRING DeviceName; - NDIS_STRING RegistryPath; - WCHAR *RegistryPathStr = NULL; - ULONG PathLength = 0; + NDIS_DbgPrint(MAX_TRACE, ("Successfully opened the registry configuration\n")); - RtlInitUnicodeString(&DeviceName, DataPtr); /* we know this is 0-term */ + RtlInitUnicodeString(&ValueName, L"Bind"); - /* Make sure the adapter has started */ - if (!MiniLocateDevice(&DeviceName)) - { - /* It wasn't in the global miniport list, so skip the bind entry */ - continue; - } - - /* Make sure this device isn't already bound to this protocol */ - if (LocateAdapterBindingByName(Protocol, &DeviceName)) - { - /* It was already in this protocol's bound adapter list, so skip the bind entry */ - continue; - } - - /* - * RegistryPath should be: - * \Registry\Machine\System\CurrentControlSet\Services\Nic1\Parameters\Tcpip - * - * This is constructed as follows: - * SERVICES_KEY + extracted device name + Protocol name from characteristics - */ - - PathLength = sizeof(SERVICES_KEY) + /* \Registry\Machine\System\CurrentControlSet\Services\ */ - wcslen( DataPtr + 8 ) * sizeof(WCHAR) + /* Adapter1 (extracted from \Device\Adapter1) */ - sizeof(PARAMETERS_KEY) + /* \Parameters\ */ - ProtocolCharacteristics->Name.Length + sizeof(WCHAR); /* Tcpip */ - - RegistryPathStr = ExAllocatePool(PagedPool, PathLength); - if(!RegistryPathStr) + NtStatus = ZwQueryValueKey(DriverKeyHandle, &ValueName, KeyValuePartialInformation, NULL, 0, &ResultLength); + if(NtStatus != STATUS_BUFFER_OVERFLOW && NtStatus != STATUS_BUFFER_TOO_SMALL && NtStatus != STATUS_SUCCESS) { - NDIS_DbgPrint(MIN_TRACE, ("insufficient resources.\n")); - ExFreePool(KeyInformation); - *Status = NDIS_STATUS_RESOURCES; - return; + NDIS_DbgPrint(MIN_TRACE, ("Unable to query the Bind value for size\n")); + ZwClose(DriverKeyHandle); } - - wcscpy(RegistryPathStr, SERVICES_KEY); - wcscat(RegistryPathStr, DataPtr + 8 ); - wcscat(RegistryPathStr, PARAMETERS_KEY); - wcsncat(RegistryPathStr, ProtocolCharacteristics->Name.Buffer, ProtocolCharacteristics->Name.Length / sizeof(WCHAR) ); - - RegistryPathStr[PathLength/sizeof(WCHAR) - 1] = 0; - - RtlInitUnicodeString(&RegistryPath, RegistryPathStr); - - NDIS_DbgPrint(MAX_TRACE, ("Calling protocol's BindAdapter handler with DeviceName %wZ and RegistryPath %wZ\n", - &DeviceName, &RegistryPath)); - + else { - BIND_HANDLER BindHandler = ProtocolCharacteristics->BindAdapterHandler; - if(BindHandler) - { - BindHandler(Status, BindContext, &DeviceName, &RegistryPath, 0); - NDIS_DbgPrint(MIN_TRACE, ("%wZ's BindAdapter handler returned 0x%x for %wZ\n", &ProtocolCharacteristics->Name, *Status, &DeviceName)); - } - else - NDIS_DbgPrint(MIN_TRACE, ("No protocol bind handler specified\n")); + KeyInformation = ExAllocatePoolWithTag(PagedPool, sizeof(KEY_VALUE_PARTIAL_INFORMATION) + ResultLength, NDIS_TAG + __LINE__); + if(!KeyInformation) + { + NDIS_DbgPrint(MIN_TRACE, ("Insufficient resources.\n")); + ZwClose(DriverKeyHandle); + NtStatus = STATUS_NO_MEMORY; + } + else + { + NtStatus = ZwQueryValueKey(DriverKeyHandle, &ValueName, KeyValuePartialInformation, KeyInformation, + sizeof(KEY_VALUE_PARTIAL_INFORMATION) + ResultLength, &ResultLength); + + ZwClose(DriverKeyHandle); + + if(!NT_SUCCESS(NtStatus)) + { + NDIS_DbgPrint(MIN_TRACE, ("Unable to query the Bind value\n")); + ExFreePool(KeyInformation); + KeyInformation = NULL; + } + } } } - ExFreePool(KeyInformation); + if (!NT_SUCCESS(NtStatus)) + { + NDIS_DbgPrint(MIN_TRACE, ("Performing global bind for protocol '%wZ'\n", &ProtocolCharacteristics->Name)); + KeyInformation = NULL; + + CurrentEntry = AdapterListHead.Flink; + } + else + { + NDIS_DbgPrint(MIN_TRACE, ("Performing standard bind for protocol '%wZ'\n", &ProtocolCharacteristics->Name)); + + DataPtr = (WCHAR*)KeyInformation->Data; + } + + /* Assume success for now */ + *Status = NDIS_STATUS_SUCCESS; + + while (TRUE) + { + /* BindContext is for tracking pending binding operations */ + VOID *BindContext = 0; + NDIS_STRING DeviceName; + NDIS_STRING RegistryPath; + WCHAR *RegistryPathStr = NULL; + ULONG PathLength = 0; + PLOGICAL_ADAPTER Adapter; + + if (KeyInformation) + { + /* Parse the REG_MULTI_SZ entry for device names */ + if (!(*DataPtr)) + break; + + RtlInitUnicodeString(&DeviceName, DataPtr); + } + else + { + /* Use the device name from the global adapter list */ + if (CurrentEntry == &AdapterListHead) + break; + + Adapter = CONTAINING_RECORD(CurrentEntry, LOGICAL_ADAPTER, ListEntry); + + DeviceName = Adapter->NdisMiniportBlock.MiniportName; + } + + /* Make sure the adapter has started */ + if (!MiniLocateDevice(&DeviceName)) + { + /* It wasn't in the global miniport list, so skip the bind entry */ + goto next; + } + + /* Make sure this device isn't already bound to this protocol */ + if (LocateAdapterBindingByName(Protocol, &DeviceName)) + { + /* It was already in this protocol's bound adapter list, so skip the bind entry */ + goto next; + } + + /* + * RegistryPath should be: + * \Registry\Machine\System\CurrentControlSet\Services\Nic1\Parameters\Tcpip + * + * This is constructed as follows: + * SERVICES_KEY + extracted device name + Protocol name from characteristics + */ + + PathLength = sizeof(SERVICES_KEY) + /* \Registry\Machine\System\CurrentControlSet\Services\ */ + wcslen( DeviceName.Buffer + 8 ) * sizeof(WCHAR) + /* Adapter1 (extracted from \Device\Adapter1) */ + sizeof(PARAMETERS_KEY) + /* \Parameters\ */ + ProtocolCharacteristics->Name.Length + sizeof(WCHAR); /* Tcpip */ + + RegistryPathStr = ExAllocatePool(PagedPool, PathLength); + if(!RegistryPathStr) + { + NDIS_DbgPrint(MIN_TRACE, ("insufficient resources.\n")); + *Status = NDIS_STATUS_RESOURCES; + break; + } + + wcscpy(RegistryPathStr, SERVICES_KEY); + wcscat(RegistryPathStr, DeviceName.Buffer + 8 ); + wcscat(RegistryPathStr, PARAMETERS_KEY); + wcsncat(RegistryPathStr, ProtocolCharacteristics->Name.Buffer, ProtocolCharacteristics->Name.Length / sizeof(WCHAR) ); + + RegistryPathStr[PathLength/sizeof(WCHAR) - 1] = 0; + + RtlInitUnicodeString(&RegistryPath, RegistryPathStr); + + NDIS_DbgPrint(MAX_TRACE, ("Calling protocol's BindAdapter handler with DeviceName %wZ and RegistryPath %wZ\n", + &DeviceName, &RegistryPath)); + + { + BIND_HANDLER BindHandler = ProtocolCharacteristics->BindAdapterHandler; + if(BindHandler) + { + BindHandler(Status, BindContext, &DeviceName, &RegistryPath, 0); + NDIS_DbgPrint(MIN_TRACE, ("%wZ's BindAdapter handler returned 0x%x for %wZ\n", &ProtocolCharacteristics->Name, *Status, &DeviceName)); + } + else + NDIS_DbgPrint(MIN_TRACE, ("No protocol bind handler specified\n")); + } + + next: + if (KeyInformation) + { + /* Advance to the next adapter in the REG_MULTI_SZ */ + DataPtr += (DeviceName.Length / sizeof(WCHAR)) + 1; + } + else + { + /* Advance to the next adapter in the global list */ + CurrentEntry = CurrentEntry->Flink; + } + } + + if (KeyInformation) + { + ExFreePool(KeyInformation); + } } /* diff --git a/drivers/network/tcpip/CMakeLists.txt b/drivers/network/tcpip/CMakeLists.txt index e86a0d7fcec..30dac485c31 100644 --- a/drivers/network/tcpip/CMakeLists.txt +++ b/drivers/network/tcpip/CMakeLists.txt @@ -1,7 +1,8 @@ include_directories( BEFORE include - ${REACTOS_SOURCE_DIR}/lib/drivers/oskittcp/include) + ${REACTOS_SOURCE_DIR}/lib/drivers/lwip/src/include + ${REACTOS_SOURCE_DIR}/lib/drivers/lwip/src/include/ipv4) add_definitions( -DNDIS40 @@ -26,17 +27,17 @@ list(APPEND SOURCE tcpip.rc ${CMAKE_CURRENT_BINARY_DIR}/tcpip.def) -add_library(tcpip SHARED ${CMAKE_CURRENT_BINARY_DIR}/tcpip_precomp.h.gch ${SOURCE}) +add_library(tcpip SHARED ${SOURCE}) target_link_libraries(tcpip ip - oskittcp + lwip ${PSEH_LIB} chew) set_module_type(tcpip kernelmodedriver) add_importlibs(tcpip ndis ntoskrnl hal) -add_pch(tcpip ${CMAKE_CURRENT_SOURCE_DIR}/include/precomp.h ${SOURCE}) +add_pch(tcpip include/precomp.h) add_cd_file(TARGET tcpip DESTINATION reactos/system32/drivers FOR all) diff --git a/drivers/network/tcpip/include/precomp.h b/drivers/network/tcpip/include/precomp.h index f37046d128e..bd3ef374172 100644 --- a/drivers/network/tcpip/include/precomp.h +++ b/drivers/network/tcpip/include/precomp.h @@ -29,8 +29,8 @@ #include #include #include -#include #include #include #include #include +#include \ No newline at end of file diff --git a/drivers/network/tcpip/include/tcp.h b/drivers/network/tcpip/include/tcp.h index 637900a5424..ce6f84bb341 100644 --- a/drivers/network/tcpip/include/tcp.h +++ b/drivers/network/tcpip/include/tcp.h @@ -24,15 +24,6 @@ typedef struct TCPv4_HEADER { USHORT Urgent; /* Pointer to urgent data */ } TCPv4_HEADER, *PTCPv4_HEADER; -/* TCPv4 header flags */ -#define TCP_URG 0x20 -#define TCP_ACK 0x10 -#define TCP_PSH 0x08 -#define TCP_RST 0x04 -#define TCP_SYN 0x02 -#define TCP_FIN 0x01 - - #define TCPOPT_END_OF_LIST 0x0 #define TCPOPT_NO_OPERATION 0x1 #define TCPOPT_MAX_SEG_SIZE 0x2 @@ -79,6 +70,19 @@ typedef struct _CLIENT_DATA { /* Delay variance factor */ #define TCP_BETA_RETRANSMISSION_TIMEOUT(x)(((x)*16)/10) /* 1.6 */ +#define SEL_CONNECT 1 +#define SEL_FIN 2 +#define SEL_RST 4 +#define SEL_ABRT 8 +#define SEL_READ 16 +#define SEL_WRITE 32 +#define SEL_ACCEPT 64 +#define SEL_OOB 128 +#define SEL_ERROR 256 +#define SEL_FINOUT 512 + +#define FREAD 0x0001 +#define FWRITE 0x0002 /* Datagram/segment send request flags */ @@ -93,9 +97,8 @@ extern LONG TCP_IPIdentification; extern CLIENT_DATA ClientInfo; /* accept.c */ -NTSTATUS TCPServiceListeningSocket( PCONNECTION_ENDPOINT Listener, - PCONNECTION_ENDPOINT Connection, - PTDI_REQUEST_KERNEL Request ); +NTSTATUS TCPCheckPeerForAccept(PVOID Context, + PTDI_REQUEST_KERNEL Request); NTSTATUS TCPListen( PCONNECTION_ENDPOINT Connection, UINT Backlog ); BOOLEAN TCPAbortListenForSocket( PCONNECTION_ENDPOINT Listener, PCONNECTION_ENDPOINT Connection ); @@ -138,6 +141,7 @@ NTSTATUS TCPConnect( NTSTATUS TCPDisconnect( PCONNECTION_ENDPOINT Connection, UINT Flags, + PLARGE_INTEGER Timeout, PTDI_CONNECTION_INFORMATION ConnInfo, PTDI_CONNECTION_INFORMATION ReturnInfo, PTCP_COMPLETION_ROUTINE Complete, @@ -163,11 +167,11 @@ NTSTATUS TCPSendData( NTSTATUS TCPClose( PCONNECTION_ENDPOINT Connection ); -NTSTATUS TCPTranslateError( int OskitError ); +NTSTATUS TCPTranslateError( const INT8 err ); -UINT TCPAllocatePort( UINT HintPort ); +UINT TCPAllocatePort( const UINT HintPort ); -VOID TCPFreePort( UINT Port ); +VOID TCPFreePort( const UINT Port ); NTSTATUS TCPGetSockAddress ( PCONNECTION_ENDPOINT Connection, @@ -181,3 +185,29 @@ NTSTATUS TCPShutdown( VOID); BOOLEAN TCPRemoveIRP( PCONNECTION_ENDPOINT Connection, PIRP Irp ); + +VOID +TCPUpdateInterfaceLinkStatus(PIP_INTERFACE IF); + +VOID +TCPUpdateInterfaceIPInformation(PIP_INTERFACE IF); + +VOID +FlushListenQueue(PCONNECTION_ENDPOINT Connection, const NTSTATUS Status); + +VOID +FlushConnectQueue(PCONNECTION_ENDPOINT Connection, const NTSTATUS Status); + +VOID +FlushReceiveQueue(PCONNECTION_ENDPOINT Connection, const NTSTATUS Status, const BOOLEAN interlocked); + +VOID +FlushSendQueue(PCONNECTION_ENDPOINT Connection, const NTSTATUS Status, const BOOLEAN interlocked); + +VOID +FlushShutdownQueue(PCONNECTION_ENDPOINT Connection, const NTSTATUS Status, const BOOLEAN interlocked); + +VOID +FlushAllQueues(PCONNECTION_ENDPOINT Connection, NTSTATUS Status); + +VOID CompleteBucket(PCONNECTION_ENDPOINT Connection, PTDI_BUCKET Bucket, const BOOLEAN Synchronous); diff --git a/drivers/network/tcpip/include/tcpip.h b/drivers/network/tcpip/include/tcpip.h index 563e662f602..9b077841cfd 100644 --- a/drivers/network/tcpip/include/tcpip.h +++ b/drivers/network/tcpip/include/tcpip.h @@ -135,19 +135,9 @@ struct in_addr #define s_impno S_un.S_un_b.s_b4 #define s_lh S_un.S_un_b.s_b3 }; -struct sockaddr_in -{ - short sin_family; - u_short sin_port; - struct in_addr sin_addr; - char sin_zero[8]; -}; -typedef struct sockaddr_in SOCKADDR_IN; -struct sockaddr -{ - u_short sa_family; - char sa_data[14]; -}; + +#define __LWIP_INET_H__ +#include "lwip/sockets.h" /* Sufficient information to manage the entity list */ typedef struct { diff --git a/drivers/network/tcpip/include/titypes.h b/drivers/network/tcpip/include/titypes.h index 5400010db5e..7bc8ce380f2 100644 --- a/drivers/network/tcpip/include/titypes.h +++ b/drivers/network/tcpip/include/titypes.h @@ -252,6 +252,7 @@ typedef struct _TDI_BUCKET { (TCB) in TCP terminology. The FileObject->FsContext2 field holds a pointer to this structure */ typedef struct _CONNECTION_ENDPOINT { + PVOID SocketContext; /* Context for lower layer (MUST be first member in struct) */ LIST_ENTRY ListEntry; /* Entry on list */ LONG RefCount; /* Reference count */ OBJECT_FREE_ROUTINE Free; /* Routine to use to free resources for the object */ @@ -259,17 +260,25 @@ typedef struct _CONNECTION_ENDPOINT { KIRQL OldIrql; /* The old irql is stored here for use in HandleSignalledConnection */ PVOID ClientContext; /* Pointer to client context information */ PADDRESS_FILE AddressFile; /* Associated address file object (NULL if none) */ - PVOID SocketContext; /* Context for lower layer */ /* Requests */ LIST_ENTRY ConnectRequest; /* Queued connect rqueusts */ LIST_ENTRY ListenRequest; /* Queued listen requests */ LIST_ENTRY ReceiveRequest; /* Queued receive requests */ LIST_ENTRY SendRequest; /* Queued send requests */ - LIST_ENTRY CompletionQueue;/* Completed requests to finish */ + LIST_ENTRY ShutdownRequest;/* Queued shutdown requests */ - /* Signals */ - UINT SignalState; /* Active signals from oskit */ + LIST_ENTRY PacketQueue; /* Queued received packets waiting to be processed */ + + /* Disconnect Timer */ + KTIMER DisconnectTimer; + KDPC DisconnectDpc; + + /* Socket state */ + BOOLEAN SendShutdown; + BOOLEAN ReceiveShutdown; + + struct _CONNECTION_ENDPOINT *Next; /* Next connection in address file list */ } CONNECTION_ENDPOINT, *PCONNECTION_ENDPOINT; diff --git a/drivers/network/tcpip/tcpip.rbuild b/drivers/network/tcpip/tcpip.rbuild index f3c6114e568..698254de4d9 100644 --- a/drivers/network/tcpip/tcpip.rbuild +++ b/drivers/network/tcpip/tcpip.rbuild @@ -3,11 +3,12 @@ include - include + src/include + src/include/ipv4 ip - oskittcp + lwip ndis pseh chew diff --git a/drivers/network/tcpip/tcpip/dispatch.c b/drivers/network/tcpip/tcpip/dispatch.c index f216ed5f678..65e0f96f52c 100644 --- a/drivers/network/tcpip/tcpip/dispatch.c +++ b/drivers/network/tcpip/tcpip/dispatch.c @@ -10,8 +10,6 @@ */ #include "precomp.h" -#include - NTSTATUS IRPFinish( PIRP Irp, NTSTATUS Status ) { KIRQL OldIrql; @@ -122,6 +120,7 @@ VOID NTAPI DispCancelRequest( PTRANSPORT_CONTEXT TranContext; PFILE_OBJECT FileObject; UCHAR MinorFunction; + PCONNECTION_ENDPOINT Connection; BOOLEAN DequeuedIrp = TRUE; IoReleaseCancelSpinLock(Irp->CancelIrql); @@ -171,6 +170,19 @@ VOID NTAPI DispCancelRequest( case TDI_CONNECT: DequeuedIrp = TCPRemoveIRP(TranContext->Handle.ConnectionContext, Irp); break; + + case TDI_DISCONNECT: + Connection = (PCONNECTION_ENDPOINT)TranContext->Handle.ConnectionContext; + + DequeuedIrp = TCPRemoveIRP(TranContext->Handle.ConnectionContext, Irp); + if (DequeuedIrp) + { + if (KeCancelTimer(&Connection->DisconnectTimer)) + { + DereferenceObject(Connection); + } + } + break; default: TI_DbgPrint(MIN_TRACE, ("Unknown IRP. MinorFunction (0x%X).\n", MinorFunction)); @@ -259,7 +271,7 @@ NTSTATUS DispTdiAssociateAddress( PTDI_REQUEST_KERNEL_ASSOCIATE Parameters; PTRANSPORT_CONTEXT TranContext; PIO_STACK_LOCATION IrpSp; - PCONNECTION_ENDPOINT Connection; + PCONNECTION_ENDPOINT Connection, LastConnection; PFILE_OBJECT FileObject; PADDRESS_FILE AddrFile = NULL; NTSTATUS Status; @@ -340,15 +352,22 @@ NTSTATUS DispTdiAssociateAddress( /* Add connection endpoint to the address file */ ReferenceObject(Connection); - AddrFile->Connection = Connection; + if (AddrFile->Connection == NULL) + AddrFile->Connection = Connection; + else + { + LastConnection = AddrFile->Connection; + while (LastConnection->Next != NULL) + LastConnection = LastConnection->Next; + LastConnection->Next = Connection; + } - /* FIXME: Maybe do this in DispTdiDisassociateAddress() instead? */ ObDereferenceObject(FileObject); UnlockObjectFromDpcLevel(AddrFile); UnlockObject(Connection, OldIrql); - return Status; + return STATUS_SUCCESS; } @@ -428,7 +447,6 @@ NTSTATUS DispTdiDisassociateAddress( PCONNECTION_ENDPOINT Connection; PTRANSPORT_CONTEXT TranContext; PIO_STACK_LOCATION IrpSp; - KIRQL OldIrql; TI_DbgPrint(DEBUG_IRP, ("Called.\n")); @@ -448,27 +466,7 @@ NTSTATUS DispTdiDisassociateAddress( return STATUS_INVALID_PARAMETER; } - LockObject(Connection, &OldIrql); - - if (!Connection->AddressFile) { - UnlockObject(Connection, OldIrql); - TI_DbgPrint(MID_TRACE, ("No address file is asscociated.\n")); - return STATUS_INVALID_PARAMETER; - } - - LockObjectAtDpcLevel(Connection->AddressFile); - - /* Remove this connection from the address file */ - DereferenceObject(Connection->AddressFile->Connection); - Connection->AddressFile->Connection = NULL; - - UnlockObjectFromDpcLevel(Connection->AddressFile); - - /* Remove the address file from this connection */ - DereferenceObject(Connection->AddressFile); - Connection->AddressFile = NULL; - - UnlockObject(Connection, OldIrql); + /* NO-OP because we need the address to deallocate the port when the connection closes */ return STATUS_SUCCESS; } @@ -510,14 +508,22 @@ NTSTATUS DispTdiDisconnect( Status = STATUS_INVALID_PARAMETER; goto done; } + + Status = DispPrepareIrpForCancel + (TranContext->Handle.ConnectionContext, + Irp, + (PDRIVER_CANCEL)DispCancelRequest); - Status = TCPDisconnect( - TranContext->Handle.ConnectionContext, - DisReq->RequestFlags, - DisReq->RequestConnectionInformation, - DisReq->ReturnConnectionInformation, - DispDataRequestComplete, - Irp ); + if (NT_SUCCESS(Status)) + { + Status = TCPDisconnect(TranContext->Handle.ConnectionContext, + DisReq->RequestFlags, + DisReq->RequestSpecific, + DisReq->RequestConnectionInformation, + DisReq->ReturnConnectionInformation, + DispDataRequestComplete, + Irp); + } done: if (Status != STATUS_PENDING) { @@ -705,10 +711,16 @@ NTSTATUS DispTdiQueryInformation( case TDI_CONNECTION_FILE: Endpoint = (PCONNECTION_ENDPOINT)TranContext->Handle.ConnectionContext; + + Address->TAAddressCount = 1; + Address->Address[0].AddressLength = TDI_ADDRESS_LENGTH_IP; + Address->Address[0].AddressType = TDI_ADDRESS_TYPE_IP; + Address->Address[0].Address[0].sin_port = Endpoint->AddressFile->Port; + Address->Address[0].Address[0].in_addr = Endpoint->AddressFile->Address.Address.IPv4Address; RtlZeroMemory( &Address->Address[0].Address[0].sin_zero, sizeof(Address->Address[0].Address[0].sin_zero)); - return TCPGetSockAddress( Endpoint, (PTRANSPORT_ADDRESS)Address, FALSE ); + return STATUS_SUCCESS; default: TI_DbgPrint(MIN_TRACE, ("Invalid transport context\n")); @@ -718,51 +730,45 @@ NTSTATUS DispTdiQueryInformation( case TDI_QUERY_CONNECTION_INFO: { - PTDI_CONNECTION_INFORMATION AddressInfo; - PADDRESS_FILE AddrFile; - PCONNECTION_ENDPOINT Endpoint = NULL; + PTDI_CONNECTION_INFO ConnectionInfo; + PCONNECTION_ENDPOINT Endpoint; - if (MmGetMdlByteCount(Irp->MdlAddress) < - (FIELD_OFFSET(TDI_CONNECTION_INFORMATION, RemoteAddress) + - sizeof(PVOID))) { - TI_DbgPrint(MID_TRACE, ("MDL buffer too small (ptr).\n")); + if (MmGetMdlByteCount(Irp->MdlAddress) < sizeof(*ConnectionInfo)) { + TI_DbgPrint(MID_TRACE, ("MDL buffer too small.\n")); return STATUS_BUFFER_TOO_SMALL; } - AddressInfo = (PTDI_CONNECTION_INFORMATION) + ConnectionInfo = (PTDI_CONNECTION_INFO) MmGetSystemAddressForMdl(Irp->MdlAddress); switch ((ULONG_PTR)IrpSp->FileObject->FsContext2) { - case TDI_TRANSPORT_ADDRESS_FILE: - AddrFile = (PADDRESS_FILE)TranContext->Handle.AddressHandle; - Endpoint = AddrFile ? AddrFile->Connection : NULL; - break; - case TDI_CONNECTION_FILE: Endpoint = (PCONNECTION_ENDPOINT)TranContext->Handle.ConnectionContext; - break; + RtlZeroMemory(ConnectionInfo, sizeof(*ConnectionInfo)); + return STATUS_SUCCESS; default: TI_DbgPrint(MIN_TRACE, ("Invalid transport context\n")); return STATUS_INVALID_PARAMETER; } - - if (!Endpoint) { - TI_DbgPrint(MID_TRACE, ("No connection object.\n")); - return STATUS_INVALID_PARAMETER; - } - - return TCPGetSockAddress( Endpoint, AddressInfo->RemoteAddress, TRUE ); } case TDI_QUERY_MAX_DATAGRAM_INFO: { - PTDI_MAX_DATAGRAM_INFO MaxDatagramInfo = MmGetSystemAddressForMdl(Irp->MdlAddress); + PTDI_MAX_DATAGRAM_INFO MaxDatagramInfo; + + if (MmGetMdlByteCount(Irp->MdlAddress) < sizeof(*MaxDatagramInfo)) { + TI_DbgPrint(MID_TRACE, ("MDL buffer too small.\n")); + return STATUS_BUFFER_TOO_SMALL; + } + + MaxDatagramInfo = (PTDI_MAX_DATAGRAM_INFO) + MmGetSystemAddressForMdl(Irp->MdlAddress); - MaxDatagramInfo->MaxDatagramSize = 0xFFFF; + MaxDatagramInfo->MaxDatagramSize = 0xFFFF; - return STATUS_SUCCESS; + return STATUS_SUCCESS; } } diff --git a/drivers/network/tcpip/tcpip/fileobjs.c b/drivers/network/tcpip/tcpip/fileobjs.c index 98cc4062d0d..e47f700d42f 100644 --- a/drivers/network/tcpip/tcpip/fileobjs.c +++ b/drivers/network/tcpip/tcpip/fileobjs.c @@ -161,6 +161,9 @@ VOID AddrFileFree( TI_DbgPrint(MID_TRACE, ("Called.\n")); + /* We should not be associated with a connection here */ + ASSERT(!AddrFile->Connection); + /* Remove address file from the global list */ TcpipAcquireSpinLock(&AddressFileListLock, &OldIrql); RemoveEntryList(&AddrFile->ListEntry); @@ -191,7 +194,10 @@ VOID AddrFileFree( /* Protocol specific handling */ switch (AddrFile->Protocol) { case IPPROTO_TCP: - TCPFreePort( AddrFile->Port ); + if (AddrFile->Port) + { + TCPFreePort(AddrFile->Port); + } break; case IPPROTO_UDP: @@ -274,15 +280,37 @@ NTSTATUS FileOpenAddress( /* Protocol specific handling */ switch (Protocol) { case IPPROTO_TCP: - AddrFile->Port = - TCPAllocatePort(Address->Address[0].Address[0].sin_port); - - if ((Address->Address[0].Address[0].sin_port && - AddrFile->Port != Address->Address[0].Address[0].sin_port) || - AddrFile->Port == 0xffff) + if (Address->Address[0].Address[0].sin_port) { - ExFreePoolWithTag(AddrFile, ADDR_FILE_TAG); - return STATUS_ADDRESS_ALREADY_EXISTS; + /* The client specified an explicit port so we force a bind to this */ + AddrFile->Port = TCPAllocatePort(Address->Address[0].Address[0].sin_port); + + /* Check for bind success */ + if (AddrFile->Port == 0xffff) + { + ExFreePoolWithTag(AddrFile, ADDR_FILE_TAG); + return STATUS_ADDRESS_ALREADY_EXISTS; + } + + /* Sanity check */ + ASSERT(Address->Address[0].Address[0].sin_port == AddrFile->Port); + } + else if (!AddrIsUnspecified(&AddrFile->Address)) + { + /* The client is trying to bind to a local address so allocate a port now too */ + AddrFile->Port = TCPAllocatePort(0); + + /* Check for bind success */ + if (AddrFile->Port == 0xffff) + { + ExFreePoolWithTag(AddrFile, ADDR_FILE_TAG); + return STATUS_ADDRESS_ALREADY_EXISTS; + } + } + else + { + /* The client wants an unspecified port with an unspecified address so we wait to see what the TCP library gives us */ + AddrFile->Port = 0; } AddEntity(CO_TL_ENTITY, AddrFile, CO_TL_TCP); @@ -377,17 +405,13 @@ NTSTATUS FileCloseAddress( if (!Request->Handle.AddressHandle) return STATUS_INVALID_PARAMETER; LockObject(AddrFile, &OldIrql); - /* We have to close this connection because we started it */ + + /* We have to close this listener because we started it */ if( AddrFile->Listener ) { - AddrFile->Listener->AddressFile = NULL; TCPClose( AddrFile->Listener ); } - if( AddrFile->Connection ) - { - AddrFile->Connection->AddressFile = NULL; - DereferenceObject( AddrFile->Connection ); - } + UnlockObject(AddrFile, OldIrql); DereferenceObject(AddrFile); diff --git a/drivers/network/tcpip/tcpip/info.c b/drivers/network/tcpip/tcpip/info.c index 4e11d9aa122..6970615e610 100644 --- a/drivers/network/tcpip/tcpip/info.c +++ b/drivers/network/tcpip/tcpip/info.c @@ -10,7 +10,6 @@ #include "precomp.h" #include -#include VOID AddEntity(ULONG EntityType, PVOID Context, ULONG Flags) { diff --git a/drivers/network/tcpip/tcpip/main.c b/drivers/network/tcpip/tcpip/main.c index ced3628e5d0..034b9df2d0b 100644 --- a/drivers/network/tcpip/tcpip/main.c +++ b/drivers/network/tcpip/tcpip/main.c @@ -105,144 +105,161 @@ NTSTATUS TiCreateFileObject( PDEVICE_OBJECT DeviceObject, PIRP Irp) { - PFILE_FULL_EA_INFORMATION EaInfo; - PTRANSPORT_CONTEXT Context; - PIO_STACK_LOCATION IrpSp; - PTA_IP_ADDRESS Address; - TDI_REQUEST Request; - PVOID ClientContext; - NTSTATUS Status; - ULONG Protocol; + PFILE_FULL_EA_INFORMATION EaInfo; + PTRANSPORT_CONTEXT Context; + PIO_STACK_LOCATION IrpSp; + PTA_IP_ADDRESS Address; + TDI_REQUEST Request; + PVOID ClientContext; + NTSTATUS Status; + ULONG Protocol; - TI_DbgPrint(DEBUG_IRP, ("Called. DeviceObject is at (0x%X), IRP is at (0x%X).\n", DeviceObject, Irp)); + TI_DbgPrint(DEBUG_IRP, ("Called. DeviceObject is at (0x%X), IRP is at (0x%X).\n", DeviceObject, Irp)); - EaInfo = Irp->AssociatedIrp.SystemBuffer; + EaInfo = Irp->AssociatedIrp.SystemBuffer; - /* Parameter check */ - /* No EA information means that we're opening for SET/QUERY_INFORMATION - * style calls. */ + /* Parameter check */ + /* No EA information means that we're opening for SET/QUERY_INFORMATION + * style calls. */ - /* Allocate resources here. We release them again if something failed */ - Context = ExAllocatePoolWithTag(NonPagedPool, sizeof(TRANSPORT_CONTEXT), - TRANS_CONTEXT_TAG); - if (!Context) { - TI_DbgPrint(MIN_TRACE, ("Insufficient resources.\n")); - return STATUS_INSUFFICIENT_RESOURCES; - } - - Context->CancelIrps = FALSE; - - IrpSp = IoGetCurrentIrpStackLocation(Irp); - IrpSp->FileObject->FsContext = Context; - Request.RequestContext = Irp; - - /* Branch to the right handler */ - if (EaInfo && - (EaInfo->EaNameLength == TDI_TRANSPORT_ADDRESS_LENGTH) && - (RtlCompareMemory - (&EaInfo->EaName, TdiTransportAddress, - TDI_TRANSPORT_ADDRESS_LENGTH) == TDI_TRANSPORT_ADDRESS_LENGTH)) { - /* This is a request to open an address */ - - - /* XXX This should probably be done in IoCreateFile() */ - /* Parameter checks */ - - Address = (PTA_IP_ADDRESS)(EaInfo->EaName + EaInfo->EaNameLength + 1); //0-term - - if ((EaInfo->EaValueLength < sizeof(TA_IP_ADDRESS)) || - (Address->TAAddressCount != 1) || - (Address->Address[0].AddressLength < TDI_ADDRESS_LENGTH_IP) || - (Address->Address[0].AddressType != TDI_ADDRESS_TYPE_IP)) { - TI_DbgPrint(MIN_TRACE, ("Parameters are invalid:\n")); - TI_DbgPrint(MIN_TRACE, ("AddressCount: %d\n", Address->TAAddressCount)); - if( Address->TAAddressCount == 1 ) { - TI_DbgPrint(MIN_TRACE, ("AddressLength: %\n", - Address->Address[0].AddressLength)); - TI_DbgPrint(MIN_TRACE, ("AddressType: %\n", - Address->Address[0].AddressType)); - } - ExFreePoolWithTag(Context, TRANS_CONTEXT_TAG); - return STATUS_INVALID_PARAMETER; + /* Allocate resources here. We release them again if something failed */ + Context = ExAllocatePoolWithTag(NonPagedPool, sizeof(TRANSPORT_CONTEXT), + TRANS_CONTEXT_TAG); + if (!Context) + { + TI_DbgPrint(MIN_TRACE, ("Insufficient resources.\n")); + return STATUS_INSUFFICIENT_RESOURCES; } - /* Open address file object */ + Context->CancelIrps = FALSE; - /* Protocol depends on device object so find the protocol */ - if (DeviceObject == TCPDeviceObject) - Protocol = IPPROTO_TCP; - else if (DeviceObject == UDPDeviceObject) - Protocol = IPPROTO_UDP; - else if (DeviceObject == IPDeviceObject) - Protocol = IPPROTO_RAW; - else if (DeviceObject == RawIPDeviceObject) { - Status = TiGetProtocolNumber(&IrpSp->FileObject->FileName, &Protocol); - if (!NT_SUCCESS(Status)) { - TI_DbgPrint(MIN_TRACE, ("Raw IP protocol number is invalid.\n")); + IrpSp = IoGetCurrentIrpStackLocation(Irp); + IrpSp->FileObject->FsContext = Context; + Request.RequestContext = Irp; + + /* Branch to the right handler */ + if (EaInfo && + (EaInfo->EaNameLength == TDI_TRANSPORT_ADDRESS_LENGTH) && + (RtlCompareMemory(&EaInfo->EaName, TdiTransportAddress, + TDI_TRANSPORT_ADDRESS_LENGTH) == TDI_TRANSPORT_ADDRESS_LENGTH)) + { + /* This is a request to open an address */ + + + /* XXX This should probably be done in IoCreateFile() */ + /* Parameter checks */ + + Address = (PTA_IP_ADDRESS)(EaInfo->EaName + EaInfo->EaNameLength + 1); //0-term + + if ((EaInfo->EaValueLength < sizeof(TA_IP_ADDRESS)) || + (Address->TAAddressCount != 1) || + (Address->Address[0].AddressLength < TDI_ADDRESS_LENGTH_IP) || + (Address->Address[0].AddressType != TDI_ADDRESS_TYPE_IP)) + { + TI_DbgPrint(MIN_TRACE, ("Parameters are invalid:\n")); + TI_DbgPrint(MIN_TRACE, ("AddressCount: %d\n", Address->TAAddressCount)); + if( Address->TAAddressCount == 1 ) + { + TI_DbgPrint(MIN_TRACE, ("AddressLength: %\n", + Address->Address[0].AddressLength)); + TI_DbgPrint(MIN_TRACE, ("AddressType: %\n", + Address->Address[0].AddressType)); + } + + ExFreePoolWithTag(Context, TRANS_CONTEXT_TAG); + return STATUS_INVALID_PARAMETER; + } + + /* Open address file object */ + + /* Protocol depends on device object so find the protocol */ + if (DeviceObject == TCPDeviceObject) + Protocol = IPPROTO_TCP; + else if (DeviceObject == UDPDeviceObject) + Protocol = IPPROTO_UDP; + else if (DeviceObject == IPDeviceObject) + Protocol = IPPROTO_RAW; + else if (DeviceObject == RawIPDeviceObject) + { + Status = TiGetProtocolNumber(&IrpSp->FileObject->FileName, &Protocol); + if (!NT_SUCCESS(Status)) + { + TI_DbgPrint(MIN_TRACE, ("Raw IP protocol number is invalid.\n")); + ExFreePoolWithTag(Context, TRANS_CONTEXT_TAG); + return STATUS_INVALID_PARAMETER; + } + } + else + { + TI_DbgPrint(MIN_TRACE, ("Invalid device object at (0x%X).\n", DeviceObject)); + ExFreePoolWithTag(Context, TRANS_CONTEXT_TAG); + return STATUS_INVALID_PARAMETER; + } + + Status = FileOpenAddress(&Request, Address, Protocol, NULL); + if (NT_SUCCESS(Status)) + { + IrpSp->FileObject->FsContext2 = (PVOID)TDI_TRANSPORT_ADDRESS_FILE; + Context->Handle.AddressHandle = Request.Handle.AddressHandle; + } + + } + else if (EaInfo && + (EaInfo->EaNameLength == TDI_CONNECTION_CONTEXT_LENGTH) && + (RtlCompareMemory + (&EaInfo->EaName, TdiConnectionContext, + TDI_CONNECTION_CONTEXT_LENGTH) == + TDI_CONNECTION_CONTEXT_LENGTH)) + { + /* This is a request to open a connection endpoint */ + + /* Parameter checks */ + + if (EaInfo->EaValueLength < sizeof(PVOID)) + { + TI_DbgPrint(MIN_TRACE, ("Parameters are invalid.\n")); + ExFreePoolWithTag(Context, TRANS_CONTEXT_TAG); + return STATUS_INVALID_PARAMETER; + } + + /* Can only do connection oriented communication using TCP */ + + if (DeviceObject != TCPDeviceObject) + { + TI_DbgPrint(MIN_TRACE, ("Bad device object.\n")); + ExFreePoolWithTag(Context, TRANS_CONTEXT_TAG); + return STATUS_INVALID_PARAMETER; + } + + ClientContext = *((PVOID*)(EaInfo->EaName + EaInfo->EaNameLength)); + + /* Open connection endpoint file object */ + + Status = FileOpenConnection(&Request, ClientContext); + if (NT_SUCCESS(Status)) + { + IrpSp->FileObject->FsContext2 = (PVOID)TDI_CONNECTION_FILE; + Context->Handle.ConnectionContext = Request.Handle.ConnectionContext; + } + } + else + { + /* This is a request to open a control connection */ + Status = FileOpenControlChannel(&Request); + if (NT_SUCCESS(Status)) + { + IrpSp->FileObject->FsContext2 = (PVOID)TDI_CONTROL_CHANNEL_FILE; + Context->Handle.ControlChannel = Request.Handle.ControlChannel; + } + } + + if (!NT_SUCCESS(Status)) ExFreePoolWithTag(Context, TRANS_CONTEXT_TAG); - return STATUS_INVALID_PARAMETER; - } - } else { - TI_DbgPrint(MIN_TRACE, ("Invalid device object at (0x%X).\n", DeviceObject)); - ExFreePoolWithTag(Context, TRANS_CONTEXT_TAG); - return STATUS_INVALID_PARAMETER; - } - Status = FileOpenAddress(&Request, Address, Protocol, NULL); - if (NT_SUCCESS(Status)) { - IrpSp->FileObject->FsContext2 = (PVOID)TDI_TRANSPORT_ADDRESS_FILE; - Context->Handle.AddressHandle = Request.Handle.AddressHandle; - } + TI_DbgPrint(DEBUG_IRP, ("Leaving. Status = (0x%X).\n", Status)); - } else if (EaInfo && - (EaInfo->EaNameLength == TDI_CONNECTION_CONTEXT_LENGTH) && - (RtlCompareMemory - (&EaInfo->EaName, TdiConnectionContext, - TDI_CONNECTION_CONTEXT_LENGTH) == - TDI_CONNECTION_CONTEXT_LENGTH)) { - /* This is a request to open a connection endpoint */ - - /* Parameter checks */ - - if (EaInfo->EaValueLength < sizeof(PVOID)) { - TI_DbgPrint(MIN_TRACE, ("Parameters are invalid.\n")); - ExFreePoolWithTag(Context, TRANS_CONTEXT_TAG); - return STATUS_INVALID_PARAMETER; - } - - /* Can only do connection oriented communication using TCP */ - - if (DeviceObject != TCPDeviceObject) { - TI_DbgPrint(MIN_TRACE, ("Bad device object.\n")); - ExFreePoolWithTag(Context, TRANS_CONTEXT_TAG); - return STATUS_INVALID_PARAMETER; - } - - ClientContext = *((PVOID*)(EaInfo->EaName + EaInfo->EaNameLength)); - - /* Open connection endpoint file object */ - - Status = FileOpenConnection(&Request, ClientContext); - if (NT_SUCCESS(Status)) { - IrpSp->FileObject->FsContext2 = (PVOID)TDI_CONNECTION_FILE; - Context->Handle.ConnectionContext = Request.Handle.ConnectionContext; - } - } else { - /* This is a request to open a control connection */ - Status = FileOpenControlChannel(&Request); - if (NT_SUCCESS(Status)) { - IrpSp->FileObject->FsContext2 = (PVOID)TDI_CONTROL_CHANNEL_FILE; - Context->Handle.ControlChannel = Request.Handle.ControlChannel; - } - } - - if (!NT_SUCCESS(Status)) - ExFreePoolWithTag(Context, TRANS_CONTEXT_TAG); - - TI_DbgPrint(DEBUG_IRP, ("Leaving. Status = (0x%X).\n", Status)); - - Irp->IoStatus.Status = Status; - return Status; + Irp->IoStatus.Status = Status; + return Status; } @@ -260,43 +277,44 @@ NTSTATUS TiCloseFileObject( PDEVICE_OBJECT DeviceObject, PIRP Irp) { - PIO_STACK_LOCATION IrpSp; - PTRANSPORT_CONTEXT Context; - TDI_REQUEST Request; - NTSTATUS Status; + PIO_STACK_LOCATION IrpSp; + PTRANSPORT_CONTEXT Context; + TDI_REQUEST Request; + NTSTATUS Status; - IrpSp = IoGetCurrentIrpStackLocation(Irp); - Context = IrpSp->FileObject->FsContext; - if (!Context) { - TI_DbgPrint(MIN_TRACE, ("Parameters are invalid.\n")); - return STATUS_INVALID_PARAMETER; - } + IrpSp = IoGetCurrentIrpStackLocation(Irp); + Context = IrpSp->FileObject->FsContext; + if (!Context) + { + TI_DbgPrint(MIN_TRACE, ("Parameters are invalid.\n")); + return STATUS_INVALID_PARAMETER; + } - switch ((ULONG_PTR)IrpSp->FileObject->FsContext2) { - case TDI_TRANSPORT_ADDRESS_FILE: - Request.Handle.AddressHandle = Context->Handle.AddressHandle; - Status = FileCloseAddress(&Request); - break; + switch ((ULONG_PTR)IrpSp->FileObject->FsContext2) + { + case TDI_TRANSPORT_ADDRESS_FILE: + Request.Handle.AddressHandle = Context->Handle.AddressHandle; + Status = FileCloseAddress(&Request); + break; - case TDI_CONNECTION_FILE: - Request.Handle.ConnectionContext = Context->Handle.ConnectionContext; - Status = FileCloseConnection(&Request); - break; + case TDI_CONNECTION_FILE: + Request.Handle.ConnectionContext = Context->Handle.ConnectionContext; + Status = FileCloseConnection(&Request); + break; - case TDI_CONTROL_CHANNEL_FILE: - Request.Handle.ControlChannel = Context->Handle.ControlChannel; - Status = FileCloseControlChannel(&Request); - break; + case TDI_CONTROL_CHANNEL_FILE: + Request.Handle.ControlChannel = Context->Handle.ControlChannel; + Status = FileCloseControlChannel(&Request); + break; - default: - DbgPrint("Unknown type %d\n", (ULONG_PTR)IrpSp->FileObject->FsContext2); - Status = STATUS_INVALID_PARAMETER; - break; - } + default: + Status = STATUS_INVALID_PARAMETER; + break; + } - Irp->IoStatus.Status = Status; + Irp->IoStatus.Status = Status; - return Irp->IoStatus.Status; + return Irp->IoStatus.Status; } @@ -360,7 +378,7 @@ TiDispatchInternal( IrpSp = IoGetCurrentIrpStackLocation(Irp); - TI_DbgPrint(DEBUG_IRP, ("Called. DeviceObject is at (0x%X), IRP is at (0x%X) MN (%d).\n", + TI_DbgPrint(DEBUG_IRP, ("[TCPIP, TiDispatchInternal] Called. DeviceObject is at (0x%X), IRP is at (0x%X) MN (%d).\n", DeviceObject, Irp, IrpSp->MinorFunction)); Irp->IoStatus.Status = STATUS_SUCCESS; @@ -435,7 +453,7 @@ TiDispatchInternal( Status = STATUS_INVALID_DEVICE_REQUEST; } - TI_DbgPrint(DEBUG_IRP, ("Leaving. Status = (0x%X).\n", Status)); + TI_DbgPrint(DEBUG_IRP, ("[TCPIP, TiDispatchInternal] Leaving. Status = (0x%X).\n", Status)); if( Complete ) IRPFinish( Irp, Status ); @@ -462,7 +480,7 @@ TiDispatch( IrpSp = IoGetCurrentIrpStackLocation(Irp); - TI_DbgPrint(DEBUG_IRP, ("Called. IRP is at (0x%X).\n", Irp)); + TI_DbgPrint(DEBUG_IRP, ("[TCPIP, TiDispatch] Called. IRP is at (0x%X).\n", Irp)); Irp->IoStatus.Information = 0; @@ -505,7 +523,7 @@ TiDispatch( } } - TI_DbgPrint(DEBUG_IRP, ("Leaving. Status = (0x%X).\n", Status)); + TI_DbgPrint(DEBUG_IRP, ("[TCPIP, TiDispatch] Leaving. Status = (0x%X).\n", Status)); return IRPFinish( Irp, Status ); } @@ -524,7 +542,7 @@ VOID NTAPI TiUnload( TcpipAcquireSpinLock(&AddressFileListLock, &OldIrql); if (!IsListEmpty(&AddressFileListHead)) { - TI_DbgPrint(MIN_TRACE, ("Open address file objects exists.\n")); + TI_DbgPrint(MIN_TRACE, ("[TCPIP, TiUnload] Called. Open address file objects exists.\n")); } TcpipReleaseSpinLock(&AddressFileListLock, OldIrql); #endif @@ -573,7 +591,7 @@ VOID NTAPI TiUnload( if (EntityList) ExFreePoolWithTag(EntityList, TDI_ENTITY_TAG); - TI_DbgPrint(MAX_TRACE, ("Leaving.\n")); + TI_DbgPrint(MAX_TRACE, ("[TCPIP, TiUnload] Leaving.\n")); } NTSTATUS NTAPI @@ -598,7 +616,7 @@ DriverEntry( NDIS_STATUS NdisStatus; LARGE_INTEGER DueTime; - TI_DbgPrint(MAX_TRACE, ("Called.\n")); + TI_DbgPrint(MAX_TRACE, ("[TCPIP, DriverEntry] Called\n")); /* TdiInitialize() ? */ @@ -662,14 +680,14 @@ DriverEntry( EntityMax = MAX_TDI_ENTITIES; /* Allocate NDIS packet descriptors */ - NdisAllocatePacketPool(&NdisStatus, &GlobalPacketPool, 100, sizeof(PACKET_CONTEXT)); + NdisAllocatePacketPoolEx(&NdisStatus, &GlobalPacketPool, 500, 1500, sizeof(PACKET_CONTEXT)); if (NdisStatus != NDIS_STATUS_SUCCESS) { TiUnload(DriverObject); return STATUS_INSUFFICIENT_RESOURCES; } /* Allocate NDIS buffer descriptors */ - NdisAllocateBufferPool(&NdisStatus, &GlobalBufferPool, 100); + NdisAllocateBufferPool(&NdisStatus, &GlobalBufferPool, 2000); if (NdisStatus != NDIS_STATUS_SUCCESS) { TiUnload(DriverObject); return STATUS_INSUFFICIENT_RESOURCES; @@ -759,6 +777,9 @@ DriverEntry( DueTime.QuadPart = -(LONGLONG)IP_TIMEOUT * 10000; KeSetTimerEx(&IPTimer, DueTime, IP_TIMEOUT, &IPTimeoutDpc); + TI_DbgPrint(MAX_TRACE, ("[TCPIP, DriverEntry] Finished\n")); + + return STATUS_SUCCESS; } diff --git a/drivers/network/tdi/CMakeLists.txt b/drivers/network/tdi/CMakeLists.txt index eeb5b468c0c..f8b6a74cf25 100644 --- a/drivers/network/tdi/CMakeLists.txt +++ b/drivers/network/tdi/CMakeLists.txt @@ -23,8 +23,7 @@ list(APPEND SOURCE ${CMAKE_CURRENT_BINARY_DIR}/tdi.def) add_library(tdi SHARED ${SOURCE}) - +add_pch(tdi precomp.h) set_module_type(tdi kernelmodedriver) add_importlibs(tdi ntoskrnl hal) - add_cd_file(TARGET tdi DESTINATION reactos/system32/drivers FOR all) diff --git a/drivers/network/tdi/cte/events.c b/drivers/network/tdi/cte/events.c index dd6aff158e3..26bf227d77f 100644 --- a/drivers/network/tdi/cte/events.c +++ b/drivers/network/tdi/cte/events.c @@ -8,7 +8,7 @@ /* INCLUDES *****************************************************************/ -#include +#include "precomp.h" typedef struct _CTEBLOCK_EVENT { diff --git a/drivers/network/tdi/cte/string.c b/drivers/network/tdi/cte/string.c index bd5aa52ac49..2f28750548e 100644 --- a/drivers/network/tdi/cte/string.c +++ b/drivers/network/tdi/cte/string.c @@ -1,7 +1,7 @@ /* $Id$ * */ -#include +#include "precomp.h" /* * @unimplemented diff --git a/drivers/network/tdi/cte/timer.c b/drivers/network/tdi/cte/timer.c index aa82dfe1455..979390e1557 100644 --- a/drivers/network/tdi/cte/timer.c +++ b/drivers/network/tdi/cte/timer.c @@ -8,7 +8,7 @@ /* INCLUDES *****************************************************************/ -#include +#include "precomp.h" /* FIXME: Move to a common header! */ struct _CTE_DELAYED_EVENT; diff --git a/drivers/network/tdi/misc/main.c b/drivers/network/tdi/misc/main.c index d66341c8dd9..bcbf6ed8cd3 100644 --- a/drivers/network/tdi/misc/main.c +++ b/drivers/network/tdi/misc/main.c @@ -2,7 +2,7 @@ * DESCRIPTION: Entry point for TDI.SYS * (c) Captain Obvious */ -#include +#include "precomp.h" extern LONG CteTimeIncrement; diff --git a/drivers/network/tdi/precomp.h b/drivers/network/tdi/precomp.h new file mode 100644 index 00000000000..00a2b729591 --- /dev/null +++ b/drivers/network/tdi/precomp.h @@ -0,0 +1,3 @@ +#include +#include +#include diff --git a/drivers/network/tdi/tdi.rbuild b/drivers/network/tdi/tdi.rbuild index 718077ffe9e..1e3572de0e3 100644 --- a/drivers/network/tdi/tdi.rbuild +++ b/drivers/network/tdi/tdi.rbuild @@ -20,4 +20,5 @@ obsolete.c stubs.c + precomp.h diff --git a/drivers/network/tdi/tdi/dereg.c b/drivers/network/tdi/tdi/dereg.c index 787b3e63c7e..4a7cfcc4ae9 100644 --- a/drivers/network/tdi/tdi/dereg.c +++ b/drivers/network/tdi/tdi/dereg.c @@ -1,5 +1,4 @@ -#include -#include +#include "precomp.h" /* De-/Register Action IDs for TdiDeRegister */ diff --git a/drivers/network/tdi/tdi/handler.c b/drivers/network/tdi/tdi/handler.c index 575edebe63e..fe24d0b1f5d 100644 --- a/drivers/network/tdi/tdi/handler.c +++ b/drivers/network/tdi/tdi/handler.c @@ -2,9 +2,7 @@ * * DESCRIPTION: Default TDI event handlers. */ -#include -#include - +#include "precomp.h" /* * ClientEventChainedReceiveDatagram diff --git a/drivers/network/tdi/tdi/obsolete.c b/drivers/network/tdi/tdi/obsolete.c index f2e143123cb..42c3935cea6 100644 --- a/drivers/network/tdi/tdi/obsolete.c +++ b/drivers/network/tdi/tdi/obsolete.c @@ -2,7 +2,7 @@ * */ -#include +#include "precomp.h" /* * @unimplemented @@ -10,7 +10,7 @@ VOID NTAPI TdiMapBuffer ( - ULONG Unknown0 + IN PMDL MdlChain ) { /* This function is absolete */ @@ -23,7 +23,7 @@ TdiMapBuffer ( VOID NTAPI TdiUnmapBuffer ( - ULONG Unknown0 + IN PMDL MdlChain ) { /* This function is obsolete */ diff --git a/drivers/network/tdi/tdi/stubs.c b/drivers/network/tdi/tdi/stubs.c index 0396d83d455..8af72d8bb85 100644 --- a/drivers/network/tdi/tdi/stubs.c +++ b/drivers/network/tdi/tdi/stubs.c @@ -2,8 +2,7 @@ /* $Id$ * */ -#include -#include +#include "precomp.h" /* * @unimplemented diff --git a/lib/host/directory.rbuild b/drivers/sac/directory.rbuild similarity index 60% rename from lib/host/directory.rbuild rename to drivers/sac/directory.rbuild index d39ecfa981f..cbcdcfd9011 100644 --- a/lib/host/directory.rbuild +++ b/drivers/sac/directory.rbuild @@ -1,7 +1,7 @@ - - - + + + diff --git a/drivers/sac/driver/chanmgr.c b/drivers/sac/driver/chanmgr.c new file mode 100644 index 00000000000..1a655d92c02 --- /dev/null +++ b/drivers/sac/driver/chanmgr.c @@ -0,0 +1,176 @@ +/* + * PROJECT: ReactOS Boot Loader + * LICENSE: BSD - See COPYING.ARM in the top level directory + * FILE: drivers/sac/driver/chanmgr.c + * PURPOSE: Driver for the Server Administration Console (SAC) for EMS + * PROGRAMMERS: ReactOS Portable Systems Group + */ + +/* INCLUDES *******************************************************************/ + +#include "sacdrv.h" + +/* GLOBALS ********************************************************************/ + +/* FUNCTIONS ******************************************************************/ + +NTSTATUS +ChanMgrInitialize( + VOID + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +ChanMgrGetChannelIndex( + IN PSAC_CHANNEL Channel, + IN PULONG ChannelIndex + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +ChanMgrReleaseChannel( + IN PSAC_CHANNEL Channel + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +ChanMgrGetByHandle( + IN PSAC_CHANNEL_ID ChannelId, + OUT PSAC_CHANNEL pChannel + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +ChanMgrGetByHandleAndFileObject( + IN PSAC_CHANNEL_ID ChannelId, + IN PFILE_OBJECT FileObject, + OUT PSAC_CHANNEL pChannel + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +ChanMgrGetChannelByName( + IN PWCHAR Name, + OUT PSAC_CHANNEL pChannel + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +ChanMgrGetByIndex( + IN ULONG TargetIndex, + IN PSAC_CHANNEL *TargetChannel + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +ChanMgrGetNextActiveChannel( + IN PSAC_CHANNEL CurrentChannel, + IN PULONG TargetIndex, + OUT PSAC_CHANNEL *TargetChannel + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +VOID +ChanMgrChannelDestroy( + IN PSAC_CHANNEL Channel + ) +{ + +} + +NTSTATUS +ChanMgrCloseChannel( + IN PSAC_CHANNEL Channel + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +ChanMgrReapChannel( + IN ULONG ChannelIndex + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +ChanMgrReapChannels( + VOID + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +ChanMgrGetChannelCount( + OUT PULONG ChannelCount + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +ChanMgrIsFull( + OUT PBOOLEAN IsFull + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +ChanMgrShutdown( + VOID + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +BOOLEAN +ChanMgrIsUniqueName( + IN PWCHAR ChannelName + ) +{ + return FALSE; +} + +NTSTATUS +ChanMgrGenerateUniqueCmdName( + IN PWCHAR ChannelName + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +ChanMgrCreateChannel( + OUT PSAC_CHANNEL *Channel, + IN PSAC_CHANNEL_ATTRIBUTES Attributes + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +ChanMgrCloseChannelsWithFileObject( + IN PFILE_OBJECT FileObject + ) +{ + return STATUS_NOT_IMPLEMENTED; +} diff --git a/drivers/sac/driver/channel.c b/drivers/sac/driver/channel.c new file mode 100644 index 00000000000..154097ebec0 --- /dev/null +++ b/drivers/sac/driver/channel.c @@ -0,0 +1,318 @@ +/* + * PROJECT: ReactOS Boot Loader + * LICENSE: BSD - See COPYING.ARM in the top level directory + * FILE: drivers/sac/driver/channel.c + * PURPOSE: Driver for the Server Administration Console (SAC) for EMS + * PROGRAMMERS: ReactOS Portable Systems Group + */ + +/* INCLUDES *******************************************************************/ + +#include "sacdrv.h" + +/* GLOBALS ********************************************************************/ + +/* FUNCTIONS ******************************************************************/ + +BOOLEAN +ChannelIsValidType( + IN SAC_CHANNEL_TYPE ChannelType + ) +{ + return ((ChannelType >= VtUtf8) && (ChannelType <= Raw)); +} + +BOOLEAN +ChannelIsEqual( + IN PSAC_CHANNEL Channel, + IN PSAC_CHANNEL_ID ChannelId + ) +{ + return IsEqualGUIDAligned( + &Channel->ChannelId.ChannelGuid, + &ChannelId->ChannelGuid); +} + +NTSTATUS +ChannelInitializeVTable( + IN PSAC_CHANNEL Channel + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +ChannelDereferenceHandles( + IN PSAC_CHANNEL Channel + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +ChannelDestroy( + IN PSAC_CHANNEL Channel + ) +{ + CHECK_PARAMETER(Channel); + + return ChannelDereferenceHandles(Channel); +} + +NTSTATUS +ChannelOWrite( + IN PSAC_CHANNEL Channel, + IN PWCHAR Buffer, + IN ULONG BufferSize + ) +{ + NTSTATUS Status; + + CHECK_PARAMETER3(BufferSize < SAC_OBUFFER_SIZE); + + ChannelLockOBuffer(Channel); + + Status = Channel->OBufferWrite(Channel, Buffer, BufferSize); + + ChannelUnlockOBuffer(Channel); + + return Status; +} + +NTSTATUS +ChannelOFlush( + IN PSAC_CHANNEL Channel + ) +{ + NTSTATUS Status; + + ChannelLockOBuffer(Channel); + + Status = Channel->OBufferFlush(Channel); + + ChannelUnlockOBuffer(Channel); + + return Status; +} + +NTSTATUS +ChannelIWrite( + IN PSAC_CHANNEL Channel, + IN PWCHAR Buffer, + IN ULONG BufferSize + ) +{ + NTSTATUS Status; + + ChannelLockIBuffer(Channel); + + Status = Channel->IBufferWrite(Channel, Buffer, BufferSize); + + ChannelUnlockIBuffer(Channel); + + return Status; +} + +ULONG +ChannelIRead( + IN PSAC_CHANNEL Channel, + PWCHAR Buffer, + ULONG BufferSize, + OUT PULONG ResultBufferSize + ) +{ + NTSTATUS Status; + + ChannelLockIBuffer(Channel); + + Status = Channel->IBufferRead(Channel, Buffer, BufferSize, ResultBufferSize); + + ChannelUnlockIBuffer(Channel); + + return Status; +} + +NTSTATUS +ChannelIReadLast( + IN PSAC_CHANNEL Channel + ) +{ + NTSTATUS Status; + + ChannelLockIBuffer(Channel); + + Status = Channel->IBufferReadLast(Channel); + + ChannelUnlockIBuffer(Channel); + + return Status; +} + +ULONG +ChannelIBufferLength( + IN PSAC_CHANNEL Channel + ) +{ + NTSTATUS Length; + + ChannelLockOBuffer(Channel); + + Length = Channel->IBufferLength(Channel); + + ChannelUnlockOBuffer(Channel); + + return Length; +} + +NTSTATUS +ChannelGetName( + IN PSAC_CHANNEL Channel, + OUT PWCHAR *Name + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +ChannelSetName( + IN PSAC_CHANNEL Channel, + IN PWCHAR Name + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +ChannelGetDescription( + IN PSAC_CHANNEL Channel, + OUT PWCHAR *Description + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +ChannelSetDescription( + IN PSAC_CHANNEL Channel, + IN PWCHAR Description + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +ChannelSetStatus( + IN PSAC_CHANNEL Channel, + IN SAC_CHANNEL_STATUS ChannelStatus + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +ChannelGetStatus( + IN PSAC_CHANNEL Channel, + OUT PSAC_CHANNEL_STATUS ChannelStatus + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +ChannelGetApplicationType( + IN PSAC_CHANNEL Channel, + OUT PGUID ApplicationType + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +NTAPI +ChannelSetLockEvent( + IN PSAC_CHANNEL Channel + ) +{ + NTSTATUS Status; + + ChannelSetEvent(Channel, LockEvent); + + return Status; +} + +NTSTATUS +NTAPI +ChannelSetRedrawEvent( + IN PSAC_CHANNEL Channel + ) +{ + NTSTATUS Status; + + ChannelSetEvent(Channel, RedrawEvent); + + return Status; +} + +NTSTATUS +ChannelClearRedrawEvent( + IN PSAC_CHANNEL Channel + ) +{ + NTSTATUS Status; + + ChannelClearEvent(Channel, RedrawEvent); + + return Status; +} + +NTSTATUS +ChannelHasRedrawEvent( + IN PSAC_CHANNEL Channel, + OUT PBOOLEAN Present + ) +{ + CHECK_PARAMETER1(Channel); + CHECK_PARAMETER2(Present); + + *Present = Channel->Flags & SAC_CHANNEL_FLAG_REDRAW_EVENT; + + return STATUS_SUCCESS; +} + +BOOLEAN +ChannelIsActive( + IN PSAC_CHANNEL Channel + ) +{ + SAC_CHANNEL_STATUS ChannelStatus; + + if (!NT_SUCCESS(ChannelGetStatus(Channel, &ChannelStatus))) return FALSE; + + return (ChannelStatus == Active); +} + +BOOLEAN +ChannelIsClosed( + IN PSAC_CHANNEL Channel + ) +{ + return FALSE; +} + +NTSTATUS +ChannelCreate( + IN PSAC_CHANNEL Channel, + IN PSAC_CHANNEL_ATTRIBUTES Attributes, + IN SAC_CHANNEL_ID ChannelId + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +ChannelClose( + IN PSAC_CHANNEL Channel + ) +{ + return STATUS_NOT_IMPLEMENTED; +} diff --git a/drivers/sac/driver/cmdchan.c b/drivers/sac/driver/cmdchan.c new file mode 100644 index 00000000000..de6e2953f2f --- /dev/null +++ b/drivers/sac/driver/cmdchan.c @@ -0,0 +1,60 @@ +/* + * PROJECT: ReactOS Boot Loader + * LICENSE: BSD - See COPYING.ARM in the top level directory + * FILE: drivers/sac/driver/cmdchan.c + * PURPOSE: Driver for the Server Administration Console (SAC) for EMS + * PROGRAMMERS: ReactOS Portable Systems Group + */ + +/* INCLUDES *******************************************************************/ + +#include "sacdrv.h" + +/* GLOBALS ********************************************************************/ + +/* FUNCTIONS ******************************************************************/ + +NTSTATUS +CmdChannelCreate( + IN PSAC_CHANNEL Channel + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +CmdChannelDestroy( + IN PSAC_CHANNEL Channel + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +CmdChannelOWrite( + IN PSAC_CHANNEL Channel, + IN PWCHAR String, + IN ULONG Size + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +CmdChannelOFlush( + IN PSAC_CHANNEL Channel + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +CmdChannelORead( + IN PSAC_CHANNEL Channel, + IN PCHAR Buffer, + IN ULONG BufferSize, + OUT PULONG ByteCount + ) +{ + return STATUS_NOT_IMPLEMENTED; +} diff --git a/drivers/sac/driver/concmd.c b/drivers/sac/driver/concmd.c new file mode 100644 index 00000000000..42b87ca2795 --- /dev/null +++ b/drivers/sac/driver/concmd.c @@ -0,0 +1,243 @@ +/* + * PROJECT: ReactOS Boot Loader + * LICENSE: BSD - See COPYING.ARM in the top level directory + * FILE: drivers/sac/driver/concmd.c + * PURPOSE: Driver for the Server Administration Console (SAC) for EMS + * PROGRAMMERS: ReactOS Portable Systems Group + */ + +/* INCLUDES *******************************************************************/ + +#include "sacdrv.h" + +/* GLOBALS ********************************************************************/ + +/* FUNCTIONS ******************************************************************/ + +NTSTATUS +GetTListInfo( + IN PVOID TListData, + IN ULONG InputSize, + IN ULONG TotalSize + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +VOID +PrintTListInfo( + IN PVOID TListData + ) +{ + +} + +VOID +PutMore( + OUT PBOOLEAN ScreenFull + ) +{ + +} + +BOOLEAN +RetrieveIpAddressFromString( + IN PWCHAR IpString, + OUT PULONG IpAddress + ) +{ + return FALSE; +} + +NTSTATUS +CallQueryIPIOCTL( + IN HANDLE DriverHandle, + IN PVOID DriverObject, + IN HANDLE WaitEvent, + IN PIO_STATUS_BLOCK IoStatusBlock, + IN PVOID InputBuffer, + IN ULONG InputBufferLength, + IN PVOID OutputBuffer, + IN ULONG OutputBufferLength, + IN BOOLEAN PrintMessage, + OUT PBOOLEAN MessagePrinted + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +VOID +DoFullInfoCommand( + VOID + ) +{ + +} + +VOID +DoPagingCommand( + VOID + ) +{ + +} + +VOID +DoSetTimeCommand( + IN PCHAR InputTime + ) +{ + +} + +VOID +DoKillCommand( + IN PCHAR KillString + ) +{ + +} + +VOID +DoLowerPriorityCommand( + IN PCHAR PrioString + ) +{ + +} + +VOID +DoRaisePriorityCommand( + IN PCHAR PrioString + ) +{ + +} + +VOID +DoLimitMemoryCommand( + IN PCHAR LimitString + ) +{ + +} + +VOID +DoRebootCommand( + IN BOOLEAN Reboot + ) +{ + +} + +VOID +DoCrashCommand( + VOID + ) +{ + +} + +VOID +DoMachineInformationCommand( + VOID + ) +{ + +} + +NTSTATUS +DoChannelListCommand( + VOID + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +DoChannelCloseByNameCommand( + IN PCHAR Count + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +DoChannelCloseByIndexCommand( + IN ULONG ChannelIndex + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +DoChannelSwitchByNameCommand( + IN PCHAR Count + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +DoChannelSwitchByIndexCommand( + IN ULONG ChannelIndex + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +VOID +DoChannelCommand( + IN PCHAR ChannelString + ) +{ + +} + +VOID +DoCmdCommand( + VOID + ) +{ + +} + +VOID +DoLockCommand( + VOID + ) +{ + +} + +VOID +DoHelpCommand( + VOID + ) +{ + +} + +VOID +DoGetNetInfo( + IN BOOLEAN DoPrint + ) +{ + +} + +VOID +DoSetIpAddressCommand( + IN PCHAR IpString + ) +{ + +} + +VOID +DoTlistCommand( + VOID + ) +{ + +} \ No newline at end of file diff --git a/drivers/sac/driver/conmgr.c b/drivers/sac/driver/conmgr.c new file mode 100644 index 00000000000..a01819394af --- /dev/null +++ b/drivers/sac/driver/conmgr.c @@ -0,0 +1,191 @@ +/* + * PROJECT: ReactOS Boot Loader + * LICENSE: BSD - See COPYING.ARM in the top level directory + * FILE: drivers/sac/driver/conmgr.c + * PURPOSE: Driver for the Server Administration Console (SAC) for EMS + * PROGRAMMERS: ReactOS Portable Systems Group + */ + +/* INCLUDES *******************************************************************/ + +#include "sacdrv.h" + +/* GLOBALS ********************************************************************/ + +/* FUNCTIONS ******************************************************************/ + +NTSTATUS +ConMgrShutdown( + VOID) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +ConMgrDisplayFastChannelSwitchingInterface( + IN PSAC_CHANNEL Channel + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +ConMgrSetCurrentChannel( + IN PSAC_CHANNEL Channel + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +ConMgrDisplayCurrentChannel( + VOID + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +ConMgrAdvanceCurrentChannel( + VOID + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +BOOLEAN +ConMgrIsWriteEnabled( + IN PSAC_CHANNEL Channel + ) +{ + return FALSE; +} + +VOID +SacPutString( + IN PWCHAR String + ) +{ + +} + +BOOLEAN +SacPutSimpleMessage( + IN ULONG MessageIndex + ) +{ + return FALSE; +} + +NTSTATUS +ConMgrChannelOWrite( + IN PSAC_CHANNEL Channel, + IN PVOID WriteBuffer + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +ConMgrGetChannelCloseMessage( + IN PSAC_CHANNEL Channel, + IN NTSTATUS CloseStatus, + OUT PWCHAR OutputBuffer + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +ConMgrWriteData( + IN PSAC_CHANNEL Channel, + IN PVOID Buffer, + IN ULONG BufferLength + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +ConMgrFlushData( + IN PSAC_CHANNEL Channel + ) +{ + return FALSE; +} + +BOOLEAN +ConMgrIsSacChannel( + IN PSAC_CHANNEL Channel + ) +{ + return FALSE; +} + +NTSTATUS +ConMgrInitialize( + VOID + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +ConMgrResetCurrentChannel( + IN BOOLEAN KeepChannel + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +VOID +ConMgrProcessInputLine( + VOID + ) +{ + +} + +VOID +ConMgrEventMessage( + IN PWCHAR EventMessage, + IN BOOLEAN LockHeld + ) +{ + +} + +BOOLEAN +ConMgrSimpleEventMessage( + IN ULONG MessageIndex, + IN BOOLEAN LockHeld + ) +{ + return FALSE; +} + +NTSTATUS +ConMgrChannelClose( + IN PSAC_CHANNEL Channel + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +ConMgrHandleEvent( + IN ULONG EventCode, + IN PSAC_CHANNEL Channel, + OUT PVOID Data + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +VOID +ConMgrWorkerProcessEvents( + IN PSAC_CHANNEL Channel + ) +{ + +} diff --git a/drivers/sac/driver/data.c b/drivers/sac/driver/data.c new file mode 100644 index 00000000000..42ebd90662d --- /dev/null +++ b/drivers/sac/driver/data.c @@ -0,0 +1,58 @@ +/* + * PROJECT: ReactOS Boot Loader + * LICENSE: BSD - See COPYING.ARM in the top level directory + * FILE: drivers/sac/driver/data.c + * PURPOSE: Driver for the Server Administration Console (SAC) for EMS + * PROGRAMMERS: ReactOS Portable Systems Group + */ + +/* INCLUDES *******************************************************************/ + +#include "sacdrv.h" + +/* GLOBALS ********************************************************************/ + +ULONG SACDebug; + +/* FUNCTIONS ******************************************************************/ + +VOID +FreeGlobalData( + VOID + ) +{ + +} + +VOID +FreeDeviceData( + IN PDEVICE_OBJECT DeviceObject + ) +{ + +} + +NTSTATUS +WorkerThreadStartUp( + IN PVOID Context + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +BOOLEAN +InitializeDeviceData( + IN PDEVICE_OBJECT DeviceObject + ) +{ + return FALSE; +} + +BOOLEAN +InitializeGlobalData( + IN PUNICODE_STRING RegistryPath, + IN PDRIVER_OBJECT DriverObject + ) +{ + return FALSE; +} diff --git a/drivers/sac/driver/dispatch.c b/drivers/sac/driver/dispatch.c new file mode 100644 index 00000000000..58ffaca4115 --- /dev/null +++ b/drivers/sac/driver/dispatch.c @@ -0,0 +1,88 @@ +/* + * PROJECT: ReactOS Boot Loader + * LICENSE: BSD - See COPYING.ARM in the top level directory + * FILE: drivers/sac/driver/dispatch.c + * PURPOSE: Driver for the Server Administration Console (SAC) for EMS + * PROGRAMMERS: ReactOS Portable Systems Group + */ + +/* INCLUDES *******************************************************************/ + +#include "sacdrv.h" + +/* GLOBALS ********************************************************************/ + +/* FUNCTIONS ******************************************************************/ + +NTSTATUS +NTAPI +DispatchDeviceControl( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +DispatchShutdownControl( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +DispatchCreate( + IN PSAC_DEVICE_EXTENSION DeviceExtension, + IN PIRP Irp + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +DispatchClose( + IN PSAC_DEVICE_EXTENSION DeviceExtension, + IN PIRP Irp + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +Dispatch( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +WorkerProcessEvents( + IN PSAC_CHANNEL Channel + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +VOID +TimerDpcRoutine( + IN PKDPC Dpc, + IN PVOID DeferredContext, + IN PVOID SystemArgument1, + IN PVOID SystemArgument2 + ) +{ + +} + +VOID +UnloadHandler( + IN PDRIVER_OBJECT DriverObject + ) +{ + +} diff --git a/drivers/sac/driver/init.c b/drivers/sac/driver/init.c new file mode 100644 index 00000000000..0542d1091da --- /dev/null +++ b/drivers/sac/driver/init.c @@ -0,0 +1,94 @@ +/* + * PROJECT: ReactOS Boot Loader + * LICENSE: BSD - See COPYING.ARM in the top level directory + * FILE: drivers/sac/driver/init.c + * PURPOSE: Driver for the Server Administration Console (SAC) for EMS + * PROGRAMMERS: ReactOS Portable Systems Group + */ + +/* INCLUDES *******************************************************************/ + +#include "sacdrv.h" + +/* GLOBALS ********************************************************************/ + +/* FUNCTIONS ******************************************************************/ + +NTSTATUS +NTAPI +DriverEntry( + IN PDRIVER_OBJECT DriverObject, + IN PUNICODE_STRING RegistryPath + ) +{ + HEADLESS_RSP_QUERY_INFO HeadlessInformation; + ULONG InfoSize; + NTSTATUS Status; + UNICODE_STRING DriverName; + PDEVICE_OBJECT DeviceObject; + PSAC_DEVICE_EXTENSION DeviceExtension; + PAGED_CODE(); + + SAC_DBG(SAC_DBG_ENTRY_EXIT, "Entering.\n"); + + HeadlessDispatch( + HeadlessCmdQueryInformation, + NULL, + 0, + &HeadlessInformation, + &InfoSize + ); + if ((HeadlessInformation.Serial.TerminalType != HeadlessUndefinedPortType) && + ((HeadlessInformation.Serial.TerminalType != HeadlessSerialPort) || + (HeadlessInformation.Serial.TerminalAttached))) + { + RtlInitUnicodeString(&DriverName, L"\\Device\\SAC"); + + Status = IoCreateDevice( + DriverObject, + sizeof(SAC_DEVICE_EXTENSION), + &DriverName, + FILE_DEVICE_UNKNOWN, + FILE_DEVICE_SECURE_OPEN, + FALSE, + &DeviceObject + ); + if (NT_SUCCESS(Status)) + { + DeviceExtension = DeviceObject->DeviceExtension; + DeviceExtension->Initialized = FALSE; + + RtlFillMemoryUlong( + DriverObject->MajorFunction, + sizeof(DriverObject->MajorFunction) / sizeof(PVOID), + (ULONG_PTR)Dispatch); + DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = + DispatchDeviceControl; + DriverObject->MajorFunction[IRP_MJ_SHUTDOWN] = + DispatchShutdownControl; + DriverObject->FastIoDispatch = NULL; + DriverObject->DriverUnload = UnloadHandler; + + if (InitializeGlobalData(RegistryPath, DriverObject)) + { + if (InitializeDeviceData(DeviceObject)) + { + IoRegisterShutdownNotification(DeviceObject); + return Status; + } + } + + Status = STATUS_INSUFFICIENT_RESOURCES; + } + else + { + SAC_DBG(SAC_DBG_INIT, "unable to create device object: %X\n", Status); + } + + FreeGlobalData(); + SAC_DBG(SAC_DBG_ENTRY_EXIT, "Exiting with status 0x%x\n", Status); + return Status; + } + + return STATUS_PORT_DISCONNECTED; +} diff --git a/drivers/sac/driver/memory.c b/drivers/sac/driver/memory.c new file mode 100644 index 00000000000..fb77febccf6 --- /dev/null +++ b/drivers/sac/driver/memory.c @@ -0,0 +1,306 @@ +/* + * PROJECT: ReactOS Boot Loader + * LICENSE: BSD - See COPYING.ARM in the top level directory + * FILE: drivers/sac/driver/memory.c + * PURPOSE: Driver for the Server Administration Console (SAC) for EMS + * PROGRAMMERS: ReactOS Portable Systems Group + */ + +/* INCLUDES *******************************************************************/ + +#include "sacdrv.h" + +/* GLOBALS ********************************************************************/ + +LONG TotalFrees, TotalBytesFreed, TotalAllocations, TotalBytesAllocated; +KSPIN_LOCK MemoryLock; +PSAC_MEMORY_LIST GlobalMemoryList; + +/* FUNCTIONS ******************************************************************/ + +BOOLEAN +InitializeMemoryManagement(VOID) +{ + PSAC_MEMORY_ENTRY Entry; + + SAC_DBG(SAC_DBG_ENTRY_EXIT, "Entering\n"); + + GlobalMemoryList = ExAllocatePoolWithTagPriority( + NonPagedPool, + SAC_MEMORY_LIST_SIZE, + INITIAL_BLOCK_TAG, + HighPoolPriority); + if (GlobalMemoryList) + { + KeInitializeSpinLock(&MemoryLock); + + GlobalMemoryList->Signature = GLOBAL_MEMORY_SIGNATURE; + GlobalMemoryList->LocalDescriptor = + (PSAC_MEMORY_ENTRY)(GlobalMemoryList + 1); + GlobalMemoryList->Size = SAC_MEMORY_LIST_SIZE - sizeof(SAC_MEMORY_LIST); + + Entry = GlobalMemoryList->LocalDescriptor; + Entry->Signature = LOCAL_MEMORY_SIGNATURE; + Entry->Tag = FREE_POOL_TAG; + Entry->Size = GlobalMemoryList->Size - sizeof(SAC_MEMORY_ENTRY); + + SAC_DBG(SAC_DBG_ENTRY_EXIT, "Exiting with TRUE.\n"); + return TRUE; + } + + SAC_DBG(SAC_DBG_ENTRY_EXIT, "Exiting with FALSE. No pool.\n"); + return FALSE; +} + +VOID +FreeMemoryManagement( + VOID + ) +{ + PSAC_MEMORY_LIST Next; + KIRQL OldIrql; + + SAC_DBG(SAC_DBG_ENTRY_EXIT, "Entering\n"); + + KeAcquireSpinLock(&MemoryLock, &OldIrql); + while (GlobalMemoryList) + { + ASSERT(GlobalMemoryList->Signature == GLOBAL_MEMORY_SIGNATURE); + + KeReleaseSpinLock(&MemoryLock, OldIrql); + + Next = GlobalMemoryList->Next; + + ExFreePoolWithTag(GlobalMemoryList, 0); + + KeAcquireSpinLock(&MemoryLock, &OldIrql); + GlobalMemoryList = Next; + } + + KeReleaseSpinLock(&MemoryLock, OldIrql); + SAC_DBG(SAC_DBG_ENTRY_EXIT, "Exiting\n"); +} + +PVOID +MyAllocatePool( + IN SIZE_T PoolSize, + IN ULONG Tag, + IN PCHAR File, + IN ULONG Line + ) +{ + KIRQL OldIrql; + PSAC_MEMORY_LIST GlobalDescriptor, NewDescriptor; + PSAC_MEMORY_ENTRY LocalDescriptor, NextDescriptor; + ULONG GlobalSize, ActualSize; + PVOID Buffer; + + ASSERT("Tag != FREE_POOL_TAG"); + + SAC_DBG(SAC_DBG_MM, "Entering.\n"); + + OldIrql = KfAcquireSpinLock(&MemoryLock); + PoolSize = ALIGN_UP(PoolSize, ULONGLONG); + + GlobalDescriptor = GlobalMemoryList; + KeAcquireSpinLock(&MemoryLock, &OldIrql); + while (GlobalDescriptor) + { + ASSERT(GlobalMemoryList->Signature == GLOBAL_MEMORY_SIGNATURE); + + LocalDescriptor = GlobalDescriptor->LocalDescriptor; + + GlobalSize = GlobalDescriptor->Size; + while (GlobalSize) + { + ASSERT(LocalDescriptor->Signature == LOCAL_MEMORY_SIGNATURE); + + if ((LocalDescriptor->Tag == FREE_POOL_TAG) && + (LocalDescriptor->Size >= PoolSize)) + { + break; + } + + GlobalSize -= (LocalDescriptor->Size + sizeof(SAC_MEMORY_ENTRY)); + + LocalDescriptor = + (PSAC_MEMORY_ENTRY)((ULONG_PTR)LocalDescriptor + + LocalDescriptor->Size + + sizeof(SAC_MEMORY_ENTRY)); + } + + GlobalDescriptor = GlobalDescriptor->Next; + } + + if (!GlobalDescriptor) + { + KeReleaseSpinLock(&MemoryLock, OldIrql); + + ActualSize = min( + PAGE_SIZE, + PoolSize + sizeof(SAC_MEMORY_ENTRY) + sizeof(SAC_MEMORY_LIST)); + + SAC_DBG(SAC_DBG_MM, "Allocating new space.\n"); + + NewDescriptor = ExAllocatePoolWithTagPriority( + 0, + ActualSize, + ALLOC_BLOCK_TAG, + HighPoolPriority); + if (!NewDescriptor) + { + SAC_DBG(SAC_DBG_MM, "No more memory, returning NULL.\n"); + return NULL; + } + + KeAcquireSpinLock(&MemoryLock, &OldIrql); + + NewDescriptor->Signature = GLOBAL_MEMORY_SIGNATURE; + NewDescriptor->LocalDescriptor = (PSAC_MEMORY_ENTRY)(NewDescriptor + 1); + NewDescriptor->Size = ActualSize - 16; + NewDescriptor->Next = GlobalMemoryList; + + GlobalMemoryList = NewDescriptor; + + LocalDescriptor = NewDescriptor->LocalDescriptor; + LocalDescriptor->Signature = LOCAL_MEMORY_SIGNATURE; + LocalDescriptor->Tag = FREE_POOL_TAG; + LocalDescriptor->Size = + GlobalMemoryList->Size - sizeof(SAC_MEMORY_ENTRY); + } + + SAC_DBG(SAC_DBG_MM, "Found a good sized block.\n"); + ASSERT(LocalDescriptor->Tag == FREE_POOL_TAG); + ASSERT(LocalDescriptor->Signature == LOCAL_MEMORY_SIGNATURE); + + if (LocalDescriptor->Size > (PoolSize + sizeof(SAC_MEMORY_ENTRY))) + { + NextDescriptor = + (PSAC_MEMORY_ENTRY)((ULONG_PTR)LocalDescriptor + + PoolSize + + sizeof(SAC_MEMORY_ENTRY)); + if (NextDescriptor->Tag == FREE_POOL_TAG) + { + NextDescriptor->Tag = FREE_POOL_TAG; + NextDescriptor->Signature = LOCAL_MEMORY_SIGNATURE; + NextDescriptor->Size = + (LocalDescriptor->Size - PoolSize - sizeof(SAC_MEMORY_ENTRY)); + + LocalDescriptor->Size = PoolSize; + } + } + + LocalDescriptor->Tag = Tag; + KeReleaseSpinLock(&MemoryLock, OldIrql); + + InterlockedIncrement(&TotalAllocations); + InterlockedExchangeAdd(&TotalBytesAllocated, LocalDescriptor->Size); + SAC_DBG(1, "Returning block 0x%X.\n", LocalDescriptor); + + Buffer = LocalDescriptor + 1; + RtlZeroMemory(Buffer, PoolSize); + return Buffer; +} + +VOID +MyFreePool( + IN PVOID *Block + ) +{ + PSAC_MEMORY_ENTRY LocalDescriptor, NextDescriptor; + PSAC_MEMORY_ENTRY ThisDescriptor, FoundDescriptor; + ULONG GlobalSize, LocalSize; + PSAC_MEMORY_LIST GlobalDescriptor; + KIRQL OldIrql; + + LocalDescriptor = (PVOID)((ULONG_PTR)(*Block) - sizeof(SAC_MEMORY_ENTRY)); + + SAC_DBG(SAC_DBG_MM, "Entering with block 0x%X.\n", LocalDescriptor); + + ASSERT(LocalDescriptor->Size > 0); + ASSERT(LocalDescriptor->Signature == LOCAL_MEMORY_SIGNATURE); + + InterlockedIncrement(&TotalFrees); + + InterlockedExchangeAdd(&TotalBytesFreed, LocalDescriptor->Size); + + GlobalDescriptor = GlobalMemoryList; + KeAcquireSpinLock(&MemoryLock, &OldIrql); + while (GlobalDescriptor) + { + ASSERT(GlobalMemoryList->Signature == GLOBAL_MEMORY_SIGNATURE); + + FoundDescriptor = NULL; + + ThisDescriptor = GlobalDescriptor->LocalDescriptor; + + GlobalSize = GlobalDescriptor->Size; + while (GlobalSize) + { + ASSERT(ThisDescriptor->Signature == LOCAL_MEMORY_SIGNATURE); + + if (ThisDescriptor == LocalDescriptor) break; + + GlobalSize -= (ThisDescriptor->Size + sizeof(SAC_MEMORY_ENTRY)); + + ThisDescriptor = + (PSAC_MEMORY_ENTRY)((ULONG_PTR)ThisDescriptor + + ThisDescriptor->Size + + sizeof(SAC_MEMORY_ENTRY)); + } + + if (ThisDescriptor == LocalDescriptor) break; + + GlobalDescriptor = GlobalDescriptor->Next; + } + + if (!GlobalDescriptor) + { + KeReleaseSpinLock(&MemoryLock, OldIrql); + SAC_DBG(SAC_DBG_MM, "Could not find block.\n"); + return; + } + + ASSERT(ThisDescriptor->Signature == LOCAL_MEMORY_SIGNATURE); + + if (LocalDescriptor->Tag == FREE_POOL_TAG) + { + KeReleaseSpinLock(&MemoryLock, OldIrql); + SAC_DBG(SAC_DBG_MM, "Attempted to free something twice.\n"); + return; + } + + LocalSize = LocalDescriptor->Size; + LocalDescriptor->Tag = FREE_POOL_TAG; + + if (GlobalSize > (LocalSize + sizeof(SAC_MEMORY_ENTRY))) + { + NextDescriptor = + (PSAC_MEMORY_ENTRY)((ULONG_PTR)LocalDescriptor + + LocalSize + + sizeof(SAC_MEMORY_ENTRY)); + if (NextDescriptor->Tag == FREE_POOL_TAG) + { + NextDescriptor->Tag = 0; + NextDescriptor->Signature = 0; + + LocalDescriptor->Size += + (NextDescriptor->Size + sizeof(SAC_MEMORY_ENTRY)); + } + } + + if ((FoundDescriptor) && (FoundDescriptor->Tag == FREE_POOL_TAG)) + { + LocalDescriptor->Signature = 0; + LocalDescriptor->Tag = 0; + + FoundDescriptor->Size += + (LocalDescriptor->Size + sizeof(SAC_MEMORY_ENTRY)); + } + + KeReleaseSpinLock(&MemoryLock, OldIrql); + *Block = NULL; + + SAC_DBG(SAC_DBG_MM, "exiting.\n"); + return; +} diff --git a/drivers/sac/driver/rawchan.c b/drivers/sac/driver/rawchan.c new file mode 100644 index 00000000000..6a38bd0a97c --- /dev/null +++ b/drivers/sac/driver/rawchan.c @@ -0,0 +1,143 @@ +/* + * PROJECT: ReactOS Boot Loader + * LICENSE: BSD - See COPYING.ARM in the top level directory + * FILE: drivers/sac/driver/rawchan.c + * PURPOSE: Driver for the Server Administration Console (SAC) for EMS + * PROGRAMMERS: ReactOS Portable Systems Group + */ + +/* INCLUDES *******************************************************************/ + +#include "sacdrv.h" + +/* GLOBALS ********************************************************************/ + +/* FUNCTIONS ******************************************************************/ + +NTSTATUS +RawChannelCreate( + IN PSAC_CHANNEL Channel + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +RawChannelDestroy( + IN PSAC_CHANNEL Channel + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +RawChannelORead( + IN PSAC_CHANNEL Channel, + IN PCHAR Buffer, + IN ULONG BufferSize, + OUT PULONG ByteCount + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +RawChannelOEcho( + IN PSAC_CHANNEL Channel, + IN PWCHAR String, + IN ULONG Length + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +RawChannelOWrite2( + IN PSAC_CHANNEL Channel, + IN PCHAR String, + IN ULONG Size + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +RawChannelOFlush( + IN PSAC_CHANNEL Channel + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +ULONG +RawChannelGetIBufferIndex( + IN PSAC_CHANNEL Channel + ) +{ + return 0; +} + +VOID +RawChannelSetIBufferIndex( + IN PSAC_CHANNEL Channel, + IN ULONG BufferIndex + ) +{ + +} + +NTSTATUS +RawChannelOWrite( + IN PSAC_CHANNEL Channel, + IN PWCHAR String, + IN ULONG Length + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +RawChannelIRead( + IN PSAC_CHANNEL Channel, + IN PCHAR Buffer, + IN ULONG BufferSize, + IN PULONG ReturnBufferSize + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +RawChannelIBufferIsFull( + IN PSAC_CHANNEL Channel, + PBOOLEAN BufferStatus + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +ULONG +RawChannelIBufferLength( + IN PSAC_CHANNEL Channel + ) +{ + return 0; +} + +CHAR +RawChannelIReadLast( + IN PSAC_CHANNEL Channel + ) +{ + return 0; +} + +NTSTATUS +RawChannelIWrite( + IN PSAC_CHANNEL Channel, + IN PCHAR Buffer, + IN ULONG BufferSize + ) +{ + return STATUS_NOT_IMPLEMENTED; +} diff --git a/drivers/sac/driver/sacdrv.h b/drivers/sac/driver/sacdrv.h new file mode 100644 index 00000000000..0936712eb61 --- /dev/null +++ b/drivers/sac/driver/sacdrv.h @@ -0,0 +1,390 @@ +/* + * PROJECT: ReactOS Boot Loader + * LICENSE: BSD - See COPYING.ARM in the top level directory + * FILE: drivers/sac/driver/sacdrv.h + * PURPOSE: Header for the Server Administration Console (SAC) for EMS + * PROGRAMMERS: ReactOS Portable Systems Group + */ + +/* INCLUDES *******************************************************************/ +#include +#include + +#define SAC_DBG_ENTRY_EXIT 0x01 +#define SAC_DBG_INIT 0x04 +#define SAC_DBG_MM 0x1000 + +#define SAC_DBG(x, ...) \ + if (SACDebug & x) \ + { \ + DbgPrint("SAC %s: ", __FUNCTION__); \ + DbgPrint(__VA_ARGS__); \ + } + +#define CHECK_PARAMETER_WITH_STATUS(Parameter, Status) \ +{ \ + ASSERT((Parameter)); \ + if (!Parameter) \ + { \ + return Status; \ + } \ +} +#define CHECK_PARAMETER(x) \ + CHECK_PARAMETER_WITH_STATUS(x, STATUS_INVALID_PARAMETER) +#define CHECK_PARAMETER1(x) \ + CHECK_PARAMETER_WITH_STATUS(x, STATUS_INVALID_PARAMETER_1) +#define CHECK_PARAMETER2(x) \ + CHECK_PARAMETER_WITH_STATUS(x, STATUS_INVALID_PARAMETER_2) +#define CHECK_PARAMETER3(x) \ + CHECK_PARAMETER_WITH_STATUS(x, STATUS_INVALID_PARAMETER_3) +#define CHECK_ALLOCATION(x) \ + CHECK_PARAMETER_WITH_STATUS(x, STATUS_OUT_OF_MEMORY) + +#define SacAllocatePool(Length, Tag) \ + MyAllocatePool(Length, Tag, __FILE__, __LINE__) + +#define ChannelLock(Channel, x) \ +{ \ + KeWaitForSingleObject( \ + &(Channel)->x.Lock, \ + Executive, \ + KernelMode, \ + FALSE, \ + NULL); \ + ASSERT((Channel)->x.RefCount == 0); \ + InterlockedIncrement(&(Channel)->x.RefCount); \ +} + +#define ChannelUnlock(Channel, x) \ +{ \ + ASSERT((Channel)->x.RefCount == 1); \ + InterlockedDecrement(&(Channel)->x.RefCount); \ + KeReleaseSemaphore( \ + &(Channel)->x.Lock, \ + SEMAPHORE_INCREMENT, \ + 1, \ + FALSE); \ +} + +#define ChannelLockOBuffer(Channel) ChannelLock(Channel, ChannelOBufferLock); +#define ChannelUnlockOBuffer(Channel) ChannelUnlock(Channel, ChannelOBufferLock); +#define ChannelLockIBuffer(Channel) ChannelLock(Channel, ChannelIBufferLock); +#define ChannelUnlockIBuffer(Channel) ChannelUnlock(Channel, ChannelIBufferLock); +#define ChannelLockAttributes(Channel) ChannelLock(Channel, ChannelAttributesLock); +#define ChannelUnlockAttributes(Channel) ChannelUnlock(Channel, ChannelAttributesLock); + +#define ChannelInitializeEvent(Channel, Attributes, x) \ +{ \ + PVOID Object, WaitObject; \ + if (Attributes->x) \ + { \ + if (!VerifyEventWaitable(Attributes->x, &Object, &WaitObject)) \ + { \ + goto FailChannel; \ + } \ + Channel->x = Attributes->x; \ + Channel->x##ObjectBody = Object; \ + Channel->x##WaitObjectBody = WaitObject; \ + } \ +} + +#define ChannelSetEvent(Channel, x) \ +{ \ + ASSERT(Channel->x); \ + ASSERT(Channel->x##ObjectBody); \ + ASSERT(Channel->x##WaitObjectBody); \ + if (Channel->x) \ + { \ + KeSetEvent(Channel->x, EVENT_INCREMENT, FALSE); \ + Status = STATUS_SUCCESS; \ + } \ + else \ + { \ + Status = STATUS_UNSUCCESSFUL; \ + } \ +} + +#define ChannelClearEvent(Channel, x) \ +{ \ + ASSERT(Channel->x); \ + ASSERT(Channel->x##ObjectBody); \ + ASSERT(Channel->x##WaitObjectBody); \ + if (Channel->x) \ + { \ + KeClearEvent(Channel->x); \ + Status = STATUS_SUCCESS; \ + } \ + else \ + { \ + Status = STATUS_UNSUCCESSFUL; \ + } \ +} + +//Rcp? - sacdrv.sys - SAC Driver (Headless) +//RcpA - sacdrv.sys - Internal memory mgr alloc block +//RcpI - sacdrv.sys - Internal memory mgr initial heap block +//RcpS - sacdrv.sys - Security related block +#define GENERIC_TAG '?pcR' +#define ALLOC_BLOCK_TAG 'ApcR' +#define INITIAL_BLOCK_TAG 'IpcR' +#define SECURITY_BLOCK_TAG 'SpcR' +#define FREE_POOL_TAG 'FpcR' + +#define LOCAL_MEMORY_SIGNATURE 'SSEL' +#define GLOBAL_MEMORY_SIGNATURE 'DAEH' + +#define SAC_MEMORY_LIST_SIZE (1 * 1024 * 1024) + +#define SAC_OBUFFER_SIZE (2 * 1024) + +#define SAC_CHANNEL_FLAG_CLOSE_EVENT 0x2 +#define SAC_CHANNEL_FLAG_HAS_NEW_DATA_EVENT 0x4 +#define SAC_CHANNEL_FLAG_LOCK_EVENT 0x8 +#define SAC_CHANNEL_FLAG_REDRAW_EVENT 0x10 + +typedef struct _SAC_MEMORY_ENTRY +{ + ULONG Signature; + ULONG Tag; + ULONG Size; +} SAC_MEMORY_ENTRY, *PSAC_MEMORY_ENTRY; + +typedef struct _SAC_MEMORY_LIST +{ + ULONG Signature; + PSAC_MEMORY_ENTRY LocalDescriptor; + ULONG Size; + struct _SAC_MEMORY_LIST* Next; +} SAC_MEMORY_LIST, *PSAC_MEMORY_LIST; + +typedef enum _SAC_CHANNEL_TYPE +{ + VtUtf8, + Cmd, + Raw +} SAC_CHANNEL_TYPE; + +typedef enum _SAC_CHANNEL_STATUS +{ + Inactive, + Active +} SAC_CHANNEL_STATUS, *PSAC_CHANNEL_STATUS; + +typedef struct _SAC_CHANNEL_ID +{ + GUID ChannelGuid; + ULONG ChannelId; +} SAC_CHANNEL_ID, *PSAC_CHANNEL_ID; + +typedef struct _SAC_CHANNEL_LOCK +{ + LONG RefCount; + KSEMAPHORE Lock; +} SAC_CHANNEL_LOCK, *PSAC_CHANNEL_LOCK; + +struct _SAC_CHANNEL; + +typedef +NTSTATUS +(*PSAC_CHANNEL_CREATE)( + IN struct _SAC_CHANNEL* Channel + ); + +typedef +NTSTATUS +(*PSAC_CHANNEL_DESTROY)( + IN struct _SAC_CHANNEL* Channel + ); + +typedef +NTSTATUS +(*PSAC_CHANNEL_OREAD)( + IN struct _SAC_CHANNEL* Channel, + IN PCHAR Buffer, + IN ULONG BufferSize, + OUT PULONG ByteCount + ); + +typedef +NTSTATUS +(*PSAC_CHANNEL_OECHO)( + IN struct _SAC_CHANNEL* Channel, + IN PWCHAR String, + IN ULONG Length + ); + +typedef +NTSTATUS +(*PSAC_CHANNEL_OFLUSH)( + IN struct _SAC_CHANNEL* Channel + ); + +typedef +NTSTATUS +(*PSAC_CHANNEL_OWRITE)( + IN struct _SAC_CHANNEL* Channel, + IN PWCHAR String, + IN ULONG Length + ); + +typedef +NTSTATUS +(*PSAC_CHANNEL_IREAD)( + IN struct _SAC_CHANNEL* Channel, + IN PWCHAR Buffer, + IN ULONG BufferSize, + IN PULONG ReturnBufferSize + ); + +typedef +NTSTATUS +(*PSAC_CHANNEL_IBUFFER_FULL)( + IN struct _SAC_CHANNEL* Channel, + OUT PBOOLEAN BufferStatus + ); + +typedef +NTSTATUS +(*PSAC_CHANNEL_IBUFFER_LENGTH)( + IN struct _SAC_CHANNEL* Channel + ); + +typedef +CHAR +(*PSAC_CHANNEL_IREAD_LAST)( + IN struct _SAC_CHANNEL* Channel + ); + +typedef +NTSTATUS +(*PSAC_CHANNEL_IWRITE)( + IN struct _SAC_CHANNEL* Channel, + IN PCHAR Buffer, + IN ULONG BufferSize + ); + +typedef struct _SAC_CHANNEL +{ + ULONG Index; + SAC_CHANNEL_ID ChannelId; + HANDLE CloseEvent; + PVOID CloseEventObjectBody; + PKEVENT CloseEventWaitObjectBody; + HANDLE HasNewDataEvent; + PVOID HasNewDataEventObjectBody; + PKEVENT HasNewDataEventWaitObjectBody; + HANDLE LockEvent; + PVOID LockEventObjectBody; + PKEVENT LockEventWaitObjectBody; + HANDLE RedrawEvent; + PVOID RedrawEventObjectBody; + PKEVENT RedrawEventWaitObjectBody; + PFILE_OBJECT FileObject; + SAC_CHANNEL_TYPE ChannelType; + SAC_CHANNEL_STATUS ChannelStatus; + WCHAR NameBuffer[64 + 1]; + WCHAR DescriptionBuffer[256 + 1]; + ULONG Flags; + GUID ApplicationType; + BOOLEAN WriteEnabled; + ULONG IBufferIndex; + PVOID IBuffer; + BOOLEAN ChannelHasNewIBufferData; + UCHAR CursorRow; + UCHAR CursorCol; + UCHAR CursorY; + UCHAR CursorX; + UCHAR CursorVisible; + PVOID OBuffer; + ULONG OBufferIndex; + ULONG OBufferFirstGoodIndex; + BOOLEAN ChannelHasNewOBufferData; + PSAC_CHANNEL_CREATE ChannelCreate; + PSAC_CHANNEL_DESTROY ChannelDestroy; + PSAC_CHANNEL_OFLUSH OBufferFlush; + PSAC_CHANNEL_OECHO OBufferEcho; + PSAC_CHANNEL_OWRITE OBufferWrite; + PSAC_CHANNEL_OREAD OBufferRead; + PSAC_CHANNEL_OWRITE IBufferWrite; + PSAC_CHANNEL_IREAD IBufferRead; + PSAC_CHANNEL_IREAD_LAST IBufferReadLast; + PSAC_CHANNEL_IBUFFER_FULL IBufferIsFull; + PSAC_CHANNEL_IBUFFER_LENGTH IBufferLength; + SAC_CHANNEL_LOCK ChannelAttributeLock; + SAC_CHANNEL_LOCK ChannelOBufferLock; + SAC_CHANNEL_LOCK ChannelIBufferLock; +} SAC_CHANNEL, *PSAC_CHANNEL; + +typedef struct _SAC_DEVICE_EXTENSION +{ + PDEVICE_OBJECT DeviceObject; + BOOLEAN Initialized; + BOOLEAN Rundown; + BOOLEAN PriorityFail; + KPRIORITY PriorityBoost; + PEPROCESS Process; + KSPIN_LOCK Lock; + KEVENT RundownEvent; + KEVENT Event; + HANDLE WorkerThreadHandle; + KEVENT WorkerThreadEvent; + KTIMER Timer; + KDPC Dpc; + LIST_ENTRY List; +} SAC_DEVICE_EXTENSION, *PSAC_DEVICE_EXTENSION; + +typedef struct _SAC_CHANNEL_ATTRIBUTES +{ + SAC_CHANNEL_TYPE ChannelType; + WCHAR NameBuffer[64 + 1]; + WCHAR DescriptionBuffer[256 + 1]; + ULONG Flag; + PKEVENT CloseEvent; + PKEVENT HasNewDataEvent; + PKEVENT LockEvent; + PKEVENT RedrawEvent; + GUID ChannelId; +} SAC_CHANNEL_ATTRIBUTES, *PSAC_CHANNEL_ATTRIBUTES; + +NTSTATUS +Dispatch( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp +); + +NTSTATUS +NTAPI +DispatchDeviceControl( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp +); + +NTSTATUS +DispatchShutdownControl( + IN PDEVICE_OBJECT DeviceObject, + IN PIRP Irp +); + +VOID +UnloadHandler( + IN PDRIVER_OBJECT DriverObject +); + +VOID +FreeGlobalData( + VOID +); + +BOOLEAN +InitializeDeviceData( + IN PDEVICE_OBJECT DeviceObject +); + +BOOLEAN +InitializeGlobalData( + IN PUNICODE_STRING RegistryPath, + IN PDRIVER_OBJECT DriverObject +); + +extern ULONG SACDebug; + diff --git a/drivers/sac/driver/sacdrv.rbuild b/drivers/sac/driver/sacdrv.rbuild new file mode 100644 index 00000000000..8357c1d440c --- /dev/null +++ b/drivers/sac/driver/sacdrv.rbuild @@ -0,0 +1,29 @@ + + + + + . + ntoskrnl + hal + sacmsg + + + -mrtd + -fno-builtin + + + sacdrv.h + chanmgr.c + channel.c + cmdchan.c + concmd.c + conmgr.c + data.c + dispatch.c + init.c + memory.c + rawchan.c + util.c + vtutf8chan.c + sacdrv.rc + diff --git a/drivers/sac/driver/sacdrv.rc b/drivers/sac/driver/sacdrv.rc new file mode 100644 index 00000000000..ceb819a9005 --- /dev/null +++ b/drivers/sac/driver/sacdrv.rc @@ -0,0 +1,25 @@ +/* + * PROJECT: ReactOS Boot Loader + * LICENSE: BSD - See COPYING.ARM in the top level directory + * FILE: drivers/base/sac/driver/sacdrv.rc + * PURPOSE: Resource File for EMS SAC Driver + * PROGRAMMERS: ReactOS Portable Systems Group + */ +#include +#include + +// +// Version Data +// +#define VER_FILETYPE VFT_DRV +#define VER_FILESUBTYPE VFT2_DRV_SYSTEM +#define VER_FILEDESCRIPTION_STR "Windows SAC Driver" +#define VER_INTERNALNAME_STR "sacdrv.sys" +#define VER_ORIGINALFILENAME_STR "sacdrv.sys" +#define VER_LANGNEUTRAL +#include "common.ver" + +// +// Bug Codes and Bitmaps +// +#include "sacmsg.rc" diff --git a/drivers/sac/driver/util.c b/drivers/sac/driver/util.c new file mode 100644 index 00000000000..b40f058c592 --- /dev/null +++ b/drivers/sac/driver/util.c @@ -0,0 +1,239 @@ +/* + * PROJECT: ReactOS Boot Loader + * LICENSE: BSD - See COPYING.ARM in the top level directory + * FILE: drivers/sac/driver/util.c + * PURPOSE: Driver for the Server Administration Console (SAC) for EMS + * PROGRAMMERS: ReactOS Portable Systems Group + */ + +/* INCLUDES *******************************************************************/ + +#include "sacdrv.h" + +/* GLOBALS ********************************************************************/ + +/* FUNCTIONS ******************************************************************/ + +ULONG +ConvertAnsiToUnicode( + IN PWCHAR pwch, + IN PCHAR pch, + IN ULONG length + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +BOOLEAN +IsCmdEventRegistrationProcess( + IN PFILE_OBJECT FileObject + ) +{ + return FALSE; +} + +VOID +InitializeCmdEventInfo( + VOID + ) +{ + +} + +BOOLEAN +VerifyEventWaitable( + IN PVOID Object, + OUT PVOID *WaitObject, + OUT PVOID *ActualWaitObject + ) +{ + return FALSE; +} + +NTSTATUS +InvokeUserModeService( + VOID + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +VOID +SacFormatMessage( + IN PWCHAR FormattedString, + IN PWCHAR MessageString, + IN ULONG MessageSize + ) +{ + +} + +NTSTATUS +TearDownGlobalMessageTable( + VOID + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +PWCHAR +GetMessage( + IN ULONG MessageIndex + ) +{ + return NULL; +} + +BOOLEAN +SacTranslateUtf8ToUnicode( + IN CHAR Utf8Char, + IN PCHAR UnicodeBuffer, + OUT PCHAR Utf8Value + ) +{ + return FALSE; +} + +BOOLEAN +SacTranslateUnicodeToUtf8( + IN PWCHAR SourceBuffer, + IN ULONG SourceBufferLength, + OUT PCHAR DestinationBuffer, + IN ULONG DestinationBufferSize, + IN ULONG UTF8Count, + OUT PULONG ProcessedCount + ) +{ + return FALSE; +} + +NTSTATUS +GetRegistryValueBuffer( + IN PCWSTR KeyName, + IN PWCHAR ValueName, + IN PKEY_VALUE_PARTIAL_INFORMATION ValueBuffer + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +SetRegistryValue( + IN PCWSTR KeyName, + IN PWCHAR ValueName, + IN ULONG Type, + IN PVOID Data, + IN ULONG DataSize + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +CopyRegistryValueData( + IN PVOID Dest, + IN PKEY_VALUE_PARTIAL_INFORMATION ValueBuffer + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +TranslateMachineInformationText( + IN PWCHAR Buffer) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +TranslateMachineInformationXML( + IN PWCHAR Buffer, + IN PWCHAR ExtraData + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +RegisterBlueScreenMachineInformation( + VOID + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +VOID +FreeMachineInformation( + VOID + ) +{ + +} + +NTSTATUS +SerialBufferGetChar( + OUT PCHAR Char + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +GetCommandConsoleLaunchingPermission( + OUT PBOOLEAN Permission + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +ImposeSacCmdServiceStartTypePolicy( + VOID + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +CopyAndInsertStringAtInterval( + IN PWCHAR SourceStr, + IN ULONG Interval, + IN PWCHAR InsertStr, + OUT PWCHAR pDestStr + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +ULONG +GetMessageLineCount( + IN ULONG MessageIndex + ) +{ + return 0; +} + +NTSTATUS +RegisterSacCmdEvent( + IN PVOID Object, + IN PKEVENT SetupCmdEvent[] + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +UnregisterSacCmdEvent( + IN PFILE_OBJECT FileObject + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +UTF8EncodeAndSend( + IN PWCHAR String + ) +{ + return STATUS_NOT_IMPLEMENTED; +} diff --git a/drivers/sac/driver/vtutf8chan.c b/drivers/sac/driver/vtutf8chan.c new file mode 100644 index 00000000000..26f80d8b448 --- /dev/null +++ b/drivers/sac/driver/vtutf8chan.c @@ -0,0 +1,181 @@ +/* + * PROJECT: ReactOS Boot Loader + * LICENSE: BSD - See COPYING.ARM in the top level directory + * FILE: drivers/sac/driver/vtutf8chan.c + * PURPOSE: Driver for the Server Administration Console (SAC) for EMS + * PROGRAMMERS: ReactOS Portable Systems Group + */ + +/* INCLUDES *******************************************************************/ + +#include "sacdrv.h" + +/* GLOBALS ********************************************************************/ + +/* FUNCTIONS ******************************************************************/ + +NTSTATUS +VTUTF8ChannelCreate( + IN PSAC_CHANNEL Channel + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +VTUTF8ChannelDestroy( + IN PSAC_CHANNEL Channel + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +VTUTF8ChannelORead( + IN PSAC_CHANNEL Channel, + IN PCHAR Buffer, + IN ULONG BufferSize, + OUT PULONG ByteCount + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +VTUTF8ChannelOEcho( + IN PSAC_CHANNEL Channel, + IN PWCHAR String, + IN ULONG Size + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +BOOLEAN +VTUTF8ChannelScanForNumber( + IN PWCHAR String, + OUT PULONG Number + ) +{ + return FALSE; +} + +NTSTATUS +VTUTF8ChannelAnsiDispatch( + IN NTSTATUS Status, + IN ULONG AnsiCode, + IN PWCHAR Data, + IN ULONG Length + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +VTUTF8ChannelProcessAttributes( + IN PSAC_CHANNEL Channel, + IN UCHAR Attribute + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +ULONG +VTUTF8ChannelGetIBufferIndex( + IN PSAC_CHANNEL Channel + ) +{ + return 0; +} + +VOID +VTUTF8ChannelSetIBufferIndex( + IN PSAC_CHANNEL Channel, + IN ULONG BufferIndex + ) +{ + +} + +NTSTATUS +VTUTF8ChannelConsumeEscapeSequence( + IN PSAC_CHANNEL Channel, + IN PWCHAR String + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +VTUTF8ChannelOFlush( + IN PSAC_CHANNEL Channel + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +VTUTF8ChannelIRead( + IN PSAC_CHANNEL Channel, + IN PCHAR Buffer, + IN ULONG BufferSize, + IN PULONG ReturnBufferSize + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +VTUTF8ChannelIBufferIsFull( + IN PSAC_CHANNEL Channel, + OUT PBOOLEAN BufferStatus + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +WCHAR +VTUTF8ChannelIReadLast( + IN PSAC_CHANNEL Channel + ) +{ + return 0; +} + +ULONG +VTUTF8ChannelIBufferLength( + IN PSAC_CHANNEL Channel + ) +{ + return 0; +} + +NTSTATUS +VTUTF8ChannelOWrite2( + IN PSAC_CHANNEL Channel, + IN PWCHAR String, + IN ULONG Size + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +VTUTF8ChannelIWrite( + IN PSAC_CHANNEL Channel, + IN PCHAR Buffer, + IN ULONG BufferSize + ) +{ + return STATUS_NOT_IMPLEMENTED; +} + +NTSTATUS +VTUTF8ChannelOWrite( + IN PSAC_CHANNEL Channel, + IN PWCHAR String, + IN ULONG Length + ) +{ + return STATUS_NOT_IMPLEMENTED; +} diff --git a/drivers/serial/serenum/CMakeLists.txt b/drivers/serial/serenum/CMakeLists.txt index c31039222fe..770a652e00d 100644 --- a/drivers/serial/serenum/CMakeLists.txt +++ b/drivers/serial/serenum/CMakeLists.txt @@ -7,7 +7,7 @@ add_library(serenum SHARED serenum.c serenum.rc) +add_pch(serenum serenum.h) set_module_type(serenum kernelmodedriver) add_importlibs(serenum ntoskrnl hal) - add_cd_file(TARGET serenum DESTINATION reactos/system32/drivers FOR all) diff --git a/drivers/serial/serenum/misc.c b/drivers/serial/serenum/misc.c index c3a9d1b144d..033bd8b893f 100644 --- a/drivers/serial/serenum/misc.c +++ b/drivers/serial/serenum/misc.c @@ -8,7 +8,6 @@ */ #include "serenum.h" -#include static IO_COMPLETION_ROUTINE ForwardIrpAndWaitCompletion; diff --git a/drivers/serial/serenum/serenum.h b/drivers/serial/serenum/serenum.h index 481442361a8..0601b44a0ce 100644 --- a/drivers/serial/serenum/serenum.h +++ b/drivers/serial/serenum/serenum.h @@ -11,6 +11,7 @@ #include #include #include +#include #include typedef enum diff --git a/drivers/serial/serenum/serenum.rbuild b/drivers/serial/serenum/serenum.rbuild index 00eafb1cd4c..72ac9aa10e8 100644 --- a/drivers/serial/serenum/serenum.rbuild +++ b/drivers/serial/serenum/serenum.rbuild @@ -9,4 +9,5 @@ pdo.c serenum.c serenum.rc + serenum.h diff --git a/drivers/serial/serial/CMakeLists.txt b/drivers/serial/serial/CMakeLists.txt index 68ec42d9b40..6bea2c8c9c7 100644 --- a/drivers/serial/serial/CMakeLists.txt +++ b/drivers/serial/serial/CMakeLists.txt @@ -14,7 +14,7 @@ add_library(serial SHARED serial.c serial.rc) +add_pch(serial serial.h) set_module_type(serial kernelmodedriver) add_importlibs(serial ntoskrnl hal) - add_cd_file(TARGET serial DESTINATION reactos/system32/drivers FOR all) diff --git a/drivers/serial/serial/pnp.c b/drivers/serial/serial/pnp.c index 8578c22da98..8ecabdc3cbd 100644 --- a/drivers/serial/serial/pnp.c +++ b/drivers/serial/serial/pnp.c @@ -24,8 +24,6 @@ SerialAddDeviceInternal( NTSTATUS Status; WCHAR DeviceNameBuffer[32]; UNICODE_STRING DeviceName; - static ULONG DeviceNumber = 0; - static ULONG ComPortNumber = 1; TRACE_(SERIAL, "SerialAddDeviceInternal()\n"); @@ -33,7 +31,7 @@ SerialAddDeviceInternal( ASSERT(Pdo); /* Create new device object */ - swprintf(DeviceNameBuffer, L"\\Device\\Serial%lu", DeviceNumber); + swprintf(DeviceNameBuffer, L"\\Device\\Serial%lu", IoGetConfigurationInformation()->SerialCount); RtlInitUnicodeString(&DeviceName, DeviceNameBuffer); Status = IoCreateDevice(DriverObject, sizeof(SERIAL_DEVICE_EXTENSION), @@ -59,9 +57,9 @@ SerialAddDeviceInternal( goto ByeBye; } - DeviceExtension->SerialPortNumber = DeviceNumber++; + DeviceExtension->SerialPortNumber = IoGetConfigurationInformation()->SerialCount++; if (pComPortNumber == NULL) - DeviceExtension->ComPort = ComPortNumber++; + DeviceExtension->ComPort = DeviceExtension->SerialPortNumber + 1; else DeviceExtension->ComPort = *pComPortNumber; DeviceExtension->Pdo = Pdo; diff --git a/drivers/serial/serial/serial.rbuild b/drivers/serial/serial/serial.rbuild index 84c8288e07d..a3783cb82de 100644 --- a/drivers/serial/serial/serial.rbuild +++ b/drivers/serial/serial/serial.rbuild @@ -16,4 +16,5 @@ rw.c serial.c serial.rc + serial.h diff --git a/drivers/setup/blue/CMakeLists.txt b/drivers/setup/blue/CMakeLists.txt index ae3c8f674be..a965797d46a 100644 --- a/drivers/setup/blue/CMakeLists.txt +++ b/drivers/setup/blue/CMakeLists.txt @@ -3,7 +3,7 @@ include_directories(${REACTOS_SOURCE_DIR}/include/reactos/drivers) add_library(blue SHARED blue.c font.c blue.rc) +add_pch(blue blue.h) set_module_type(blue kernelmodedriver) add_importlibs(blue ntoskrnl hal) - add_cd_file(TARGET blue DESTINATION reactos/system32/drivers NO_CAB FOR all) diff --git a/drivers/setup/blue/blue.c b/drivers/setup/blue/blue.c index aab1cb03d97..f7a71f7d4a6 100644 --- a/drivers/setup/blue/blue.c +++ b/drivers/setup/blue/blue.c @@ -10,14 +10,6 @@ /* INCLUDES ******************************************************************/ -#include -#include -#define WINBASEAPI -typedef struct _SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES, *PSECURITY_ATTRIBUTES; - -#include -#include -#include //#include #include "blue.h" diff --git a/drivers/setup/blue/blue.h b/drivers/setup/blue/blue.h index 49be79abab7..988031c2b26 100644 --- a/drivers/setup/blue/blue.h +++ b/drivers/setup/blue/blue.h @@ -8,6 +8,15 @@ /* DEFINITIONS ***************************************************************/ +#include +#include + +typedef struct _SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES, *PSECURITY_ATTRIBUTES; +#include + +#include +#include + #include #include #include diff --git a/drivers/setup/blue/blue.rbuild b/drivers/setup/blue/blue.rbuild index 075a2997f7c..f24a08dde6b 100644 --- a/drivers/setup/blue/blue.rbuild +++ b/drivers/setup/blue/blue.rbuild @@ -8,4 +8,5 @@ blue.c font.c blue.rc + blue.h diff --git a/drivers/storage/class/cdrom/CMakeLists.txt b/drivers/storage/class/cdrom/CMakeLists.txt index 3a21ad923b3..af0557833a7 100644 --- a/drivers/storage/class/cdrom/CMakeLists.txt +++ b/drivers/storage/class/cdrom/CMakeLists.txt @@ -10,4 +10,5 @@ add_importlibs(cdrom ntoskrnl hal) +add_pch(cdrom precomp.h) add_cd_file(TARGET cdrom DESTINATION reactos/system32/drivers NO_CAB FOR all) diff --git a/drivers/storage/class/cdrom/cdrom.c b/drivers/storage/class/cdrom/cdrom.c index 12531ba3a4d..bc2f259b576 100644 --- a/drivers/storage/class/cdrom/cdrom.c +++ b/drivers/storage/class/cdrom/cdrom.c @@ -6,13 +6,7 @@ * PROGRAMMERS: Based on a source code sample from Microsoft NT4 DDK */ -#include -#include -#include -#include -#include -#include -#include +#include "precomp.h" //#define NDEBUG #include diff --git a/drivers/storage/class/cdrom/cdrom.rbuild b/drivers/storage/class/cdrom/cdrom.rbuild index 3735a15ce93..f6da7477886 100644 --- a/drivers/storage/class/cdrom/cdrom.rbuild +++ b/drivers/storage/class/cdrom/cdrom.rbuild @@ -10,4 +10,5 @@ cdrom.c findscsi.c cdrom.rc + precomp.h diff --git a/drivers/storage/class/cdrom/findscsi.c b/drivers/storage/class/cdrom/findscsi.c index 3df16216c91..6b0cab655be 100644 --- a/drivers/storage/class/cdrom/findscsi.c +++ b/drivers/storage/class/cdrom/findscsi.c @@ -6,13 +6,7 @@ * PROGRAMMERS: Based on a source code sample from Microsoft NT4 DDK */ -#include -#include -#include -#include -#include -#include -#include +#include "precomp.h" //#define NDEBUG #include diff --git a/drivers/storage/class/cdrom/precomp.h b/drivers/storage/class/cdrom/precomp.h new file mode 100644 index 00000000000..e1d5878ae1e --- /dev/null +++ b/drivers/storage/class/cdrom/precomp.h @@ -0,0 +1,7 @@ +#include +#include +#include +#include +#include +#include +#include diff --git a/drivers/storage/classpnp/CMakeLists.txt b/drivers/storage/classpnp/CMakeLists.txt index 2c7c15e1e4d..1d5672b34b6 100644 --- a/drivers/storage/classpnp/CMakeLists.txt +++ b/drivers/storage/classpnp/CMakeLists.txt @@ -38,9 +38,8 @@ list(APPEND SOURCE ${CMAKE_CURRENT_BINARY_DIR}/class.def) add_library(classpnp SHARED ${SOURCE}) +add_pch(classpnp classp.h) target_link_libraries(classpnp ${PSEH_LIB} libcntpr) - set_module_type(classpnp kernelmodedriver) add_importlibs(classpnp hal ntoskrnl) - add_cd_file(TARGET classpnp DESTINATION reactos/system32/drivers NO_CAB FOR all) diff --git a/drivers/storage/classpnp/classp.h b/drivers/storage/classpnp/classp.h index 43dc218a309..a7298324694 100644 --- a/drivers/storage/classpnp/classp.h +++ b/drivers/storage/classpnp/classp.h @@ -25,7 +25,6 @@ Revision History: --*/ - #include #include #include @@ -42,6 +41,8 @@ Revision History: #include #include +#include "wmistr.h" + extern CLASSPNP_SCAN_FOR_SPECIAL_INFO ClassBadItems[]; extern GUID ClassGuidQueryRegInfoEx; diff --git a/drivers/storage/classpnp/classpnp.rbuild b/drivers/storage/classpnp/classpnp.rbuild index 92f982e5034..2eb4afddd2b 100644 --- a/drivers/storage/classpnp/classpnp.rbuild +++ b/drivers/storage/classpnp/classpnp.rbuild @@ -34,4 +34,5 @@ obsolete.c debug.c class.rc + classp.h diff --git a/drivers/storage/classpnp/classwmi.c b/drivers/storage/classpnp/classwmi.c index bbd43a6999d..1589c599d20 100644 --- a/drivers/storage/classpnp/classwmi.c +++ b/drivers/storage/classpnp/classwmi.c @@ -21,17 +21,7 @@ Revision History: --*/ -#include "stddef.h" -#include "ntddk.h" -#include "scsi.h" - -#include "classpnp.h" - -#include "mountdev.h" - -#include - -#include "wmistr.h" +#include "classp.h" NTSTATUS ClassSystemControl( diff --git a/drivers/storage/classpnp/dictlib.c b/drivers/storage/classpnp/dictlib.c index 310b227e0f0..2ae614d6930 100644 --- a/drivers/storage/classpnp/dictlib.c +++ b/drivers/storage/classpnp/dictlib.c @@ -23,8 +23,7 @@ Revision History: --*/ -#include -#include +#include "classp.h" #define DICTIONARY_SIGNATURE 'dsig' diff --git a/drivers/storage/classpnp/power.c b/drivers/storage/classpnp/power.c index 26d4d0172c2..aae10d7279d 100644 --- a/drivers/storage/classpnp/power.c +++ b/drivers/storage/classpnp/power.c @@ -21,13 +21,8 @@ Revision History: --*/ -#include "stddef.h" -#include "ntddk.h" -#include "scsi.h" #include "classp.h" -#include - #define CLASS_TAG_POWER 'WLcS' NTSTATUS diff --git a/drivers/storage/fdc/CMakeLists.txt b/drivers/storage/fdc/CMakeLists.txt new file mode 100644 index 00000000000..fc6b28e7a12 --- /dev/null +++ b/drivers/storage/fdc/CMakeLists.txt @@ -0,0 +1,2 @@ + +add_subdirectory(fdc) diff --git a/drivers/storage/fdc/directory.rbuild b/drivers/storage/fdc/directory.rbuild new file mode 100644 index 00000000000..f270c6bb0bb --- /dev/null +++ b/drivers/storage/fdc/directory.rbuild @@ -0,0 +1,7 @@ + + + + + + + diff --git a/drivers/storage/fdc/fdc/CMakeLists.txt b/drivers/storage/fdc/fdc/CMakeLists.txt new file mode 100644 index 00000000000..51d6893438b --- /dev/null +++ b/drivers/storage/fdc/fdc/CMakeLists.txt @@ -0,0 +1,11 @@ + +add_library(fdc SHARED + fdc.c + fdo.c + pdo.c + fdc.rc) + +set_module_type(fdc kernelmodedriver) +add_importlibs(fdc hal ntoskrnl) + +add_cd_file(TARGET fdc DESTINATION reactos/system32/drivers NO_CAB FOR all) diff --git a/drivers/storage/fdc/fdc/SOURCES b/drivers/storage/fdc/fdc/SOURCES new file mode 100644 index 00000000000..7f4ef12c9a0 --- /dev/null +++ b/drivers/storage/fdc/fdc/SOURCES @@ -0,0 +1,5 @@ +TARGETNAME=fdc +TARGETTYPE=DRIVER +TARGETPATH=obj +SOURCES= fdc.c fdo.c pdo.c +MSC_WARNING_LEVEL=/W3 /WX diff --git a/drivers/storage/fdc/fdc/fdc.rbuild b/drivers/storage/fdc/fdc/fdc.rbuild new file mode 100644 index 00000000000..5a63730dc45 --- /dev/null +++ b/drivers/storage/fdc/fdc/fdc.rbuild @@ -0,0 +1,12 @@ + + + + + . + ntoskrnl + hal + fdc.c + fdo.c + pdo.c + fdc.rc + diff --git a/drivers/storage/floppy/CMakeLists.txt b/drivers/storage/floppy/CMakeLists.txt index 6a2954f1806..8222c16d9af 100644 --- a/drivers/storage/floppy/CMakeLists.txt +++ b/drivers/storage/floppy/CMakeLists.txt @@ -8,8 +8,7 @@ add_library(floppy SHARED floppy.rc) target_link_libraries(floppy csq) - +add_pch(floppy precomp.h) set_module_type(floppy kernelmodedriver) add_importlibs(floppy hal ntoskrnl) - add_cd_file(TARGET floppy DESTINATION reactos/system32/drivers NO_CAB FOR all) diff --git a/drivers/storage/floppy/csqrtns.c b/drivers/storage/floppy/csqrtns.c index e6b84257b03..f50b1a51a11 100644 --- a/drivers/storage/floppy/csqrtns.c +++ b/drivers/storage/floppy/csqrtns.c @@ -38,11 +38,7 @@ * that my lock choice is a spin lock. */ -#include -#include - -#include "floppy.h" -#include "csqrtns.h" +#include "precomp.h" /* Global CSQ struct that the CSQ functions initialize and use */ IO_CSQ Csq; diff --git a/drivers/storage/floppy/csqrtns.h b/drivers/storage/floppy/csqrtns.h index af6193faa1c..2c3d507f333 100644 --- a/drivers/storage/floppy/csqrtns.h +++ b/drivers/storage/floppy/csqrtns.h @@ -24,11 +24,7 @@ * 15-Feb-2004 vizzini - Created */ -#ifdef _MSC_VER #include -#else -#include -#endif /* * CSQ Stuff diff --git a/drivers/storage/floppy/floppy.c b/drivers/storage/floppy/floppy.c index 24e74400e0a..857a95b98c8 100644 --- a/drivers/storage/floppy/floppy.c +++ b/drivers/storage/floppy/floppy.c @@ -40,14 +40,7 @@ * TODO: Media detection based on sector 1 */ -#include -#include - -#include "floppy.h" -#include "hardware.h" -#include "csqrtns.h" -#include "ioctl.h" -#include "readwrite.h" +#include "precomp.h" /* * Global controller info structures. Each controller gets one. Since the system @@ -1189,7 +1182,7 @@ DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath) return STATUS_INSUFFICIENT_RESOURCES; } - if(ObReferenceObjectByHandle(ThreadHandle, STANDARD_RIGHTS_ALL, NULL, KernelMode, &QueueThreadObject, NULL) != STATUS_SUCCESS) + if(ObReferenceObjectByHandle(ThreadHandle, STANDARD_RIGHTS_ALL, PsThreadType, KernelMode, &QueueThreadObject, NULL) != STATUS_SUCCESS) { WARN_(FLOPPY, "Unable to reference returned thread handle; failing init\n"); return STATUS_UNSUCCESSFUL; diff --git a/drivers/storage/floppy/floppy.rbuild b/drivers/storage/floppy/floppy.rbuild index 41bd2d39b1c..2e4aca6f2fa 100644 --- a/drivers/storage/floppy/floppy.rbuild +++ b/drivers/storage/floppy/floppy.rbuild @@ -12,4 +12,5 @@ ioctl.c readwrite.c floppy.rc + precomp.h diff --git a/drivers/storage/floppy/hardware.c b/drivers/storage/floppy/hardware.c index b0780759240..2b22ec9630d 100644 --- a/drivers/storage/floppy/hardware.c +++ b/drivers/storage/floppy/hardware.c @@ -47,11 +47,7 @@ * I prefer bit fields, but they break endianness. */ -#include -#include - -#include "floppy.h" -#include "hardware.h" +#include "precomp.h" /* * Hardware Support Routines @@ -452,7 +448,10 @@ HwRecalibrateResult(PCONTROLLER_INFO ControllerInfo) /* Is the equipment check flag set? Could be no disk in drive... */ if((Buffer[0] & SR0_EQUIPMENT_CHECK) == SR0_EQUIPMENT_CHECK) - INFO_(FLOPPY, "HwRecalibrateResult: Seeked to track 0 successfully, but EC is set; returning STATUS_SUCCESS anyway\n"); + { + WARN_(FLOPPY, "HwRecalibrateResult: Seeked to track 0 successfully, but EC is set; returning failure\n"); + return STATUS_UNSUCCESSFUL; + } return STATUS_SUCCESS; } diff --git a/drivers/storage/floppy/ioctl.c b/drivers/storage/floppy/ioctl.c index d172a4dfab3..1cb84322f67 100644 --- a/drivers/storage/floppy/ioctl.c +++ b/drivers/storage/floppy/ioctl.c @@ -31,13 +31,7 @@ * TODO: Implement format */ -#include -#include - -#include "floppy.h" -#include "hardware.h" -#include "csqrtns.h" -#include "ioctl.h" +#include "precomp.h" NTSTATUS NTAPI @@ -126,7 +120,7 @@ DeviceIoctlPassive(PDRIVE_INFO DriveInfo, PIRP Irp) * Therefore if we see one below in the switch, we can return STATUS_SUCCESS * immediately. */ - if(DriveInfo->DeviceObject->Flags & DO_VERIFY_VOLUME && !(DriveInfo->DeviceObject->Flags & SL_OVERRIDE_VERIFY_VOLUME)) + if(DriveInfo->DeviceObject->Flags & DO_VERIFY_VOLUME && !(Stack->Flags & SL_OVERRIDE_VERIFY_VOLUME)) { INFO_(FLOPPY, "DeviceIoctl(): completing with STATUS_VERIFY_REQUIRED\n"); Irp->IoStatus.Status = STATUS_VERIFY_REQUIRED; diff --git a/drivers/storage/floppy/precomp.h b/drivers/storage/floppy/precomp.h new file mode 100644 index 00000000000..c7238f804af --- /dev/null +++ b/drivers/storage/floppy/precomp.h @@ -0,0 +1,9 @@ +#include +#include + +#include "floppy.h" +#include "csqrtns.h" +#include "hardware.h" +#include "csqrtns.h" +#include "ioctl.h" +#include "readwrite.h" diff --git a/drivers/storage/floppy/readwrite.c b/drivers/storage/floppy/readwrite.c index 49030d3c14d..bafc2916c80 100644 --- a/drivers/storage/floppy/readwrite.c +++ b/drivers/storage/floppy/readwrite.c @@ -52,13 +52,7 @@ * TODO: Figure out specify timings */ -#include -#include - -#include "floppy.h" -#include "csqrtns.h" -#include "hardware.h" -#include "readwrite.h" +#include "precomp.h" static IO_ALLOCATION_ACTION NTAPI @@ -454,7 +448,7 @@ ReadWritePassive(PDRIVE_INFO DriveInfo, PIRP Irp) * Check to see if the volume needs to be verified. If so, * we can get out of here quickly. */ - if(DeviceObject->Flags & DO_VERIFY_VOLUME && !(DeviceObject->Flags & SL_OVERRIDE_VERIFY_VOLUME)) + if(DeviceObject->Flags & DO_VERIFY_VOLUME && !(Stack->Flags & SL_OVERRIDE_VERIFY_VOLUME)) { INFO_(FLOPPY, "ReadWritePassive(): DO_VERIFY_VOLUME set; Completing with STATUS_VERIFY_REQUIRED\n"); Irp->IoStatus.Status = STATUS_VERIFY_REQUIRED; diff --git a/drivers/storage/ide/pciide/CMakeLists.txt b/drivers/storage/ide/pciide/CMakeLists.txt index 064c861fc24..89efccdf7c4 100644 --- a/drivers/storage/ide/pciide/CMakeLists.txt +++ b/drivers/storage/ide/pciide/CMakeLists.txt @@ -4,4 +4,4 @@ add_library(pciide SHARED pciide.c pciide.rc) set_module_type(pciide kernelmodedriver) add_importlibs(pciide pciidex ntoskrnl) -add_cd_file(TARGET pciide DESTINATION reactos/system32/drivers FOR all) +add_cd_file(TARGET pciide DESTINATION reactos/system32/drivers NO_CAB FOR all) diff --git a/drivers/storage/ide/pciide/pciide.rbuild b/drivers/storage/ide/pciide/pciide.rbuild index d224b744ea5..58e385ba3a5 100644 --- a/drivers/storage/ide/pciide/pciide.rbuild +++ b/drivers/storage/ide/pciide/pciide.rbuild @@ -1,6 +1,7 @@ + pciidex ntoskrnl pciide.c diff --git a/drivers/storage/ide/pciidex/CMakeLists.txt b/drivers/storage/ide/pciidex/CMakeLists.txt index c81b63163c6..15d9e173a7c 100644 --- a/drivers/storage/ide/pciidex/CMakeLists.txt +++ b/drivers/storage/ide/pciidex/CMakeLists.txt @@ -11,9 +11,8 @@ list(APPEND SOURCE ${CMAKE_CURRENT_BINARY_DIR}/pciidex.def) add_library(pciidex SHARED ${SOURCE}) - +add_pch(pciidex pciidex.h) set_module_type(pciidex kernelmodedriver) add_importlibs(pciidex ntoskrnl) - -add_cd_file(TARGET pciidex DESTINATION reactos/system32/drivers FOR all) +add_cd_file(TARGET pciidex DESTINATION reactos/system32/drivers NO_CAB FOR all) add_importlib_target(pciidex.spec) diff --git a/drivers/storage/ide/pciidex/fdo.c b/drivers/storage/ide/pciidex/fdo.c index ff140e1d19e..497842fd09e 100644 --- a/drivers/storage/ide/pciidex/fdo.c +++ b/drivers/storage/ide/pciidex/fdo.c @@ -402,7 +402,7 @@ PciIdeXFdoPnpDispatch( { ULONG MinorFunction; PIO_STACK_LOCATION Stack; - ULONG_PTR Information = 0; + ULONG_PTR Information = Irp->IoStatus.Information; NTSTATUS Status; Stack = IoGetCurrentIrpStackLocation(Irp); @@ -419,6 +419,12 @@ PciIdeXFdoPnpDispatch( Status = PciIdeXFdoStartDevice(DeviceObject, Irp); break; } + case IRP_MN_QUERY_REMOVE_DEVICE: /* 0x01 */ + { + DPRINT("IRP_MJ_PNP / IRP_MN_QUERY_REMOVE_DEVICE\n"); + Status = STATUS_UNSUCCESSFUL; + break; + } case IRP_MN_QUERY_DEVICE_RELATIONS: /* 0x07 */ { switch (Stack->Parameters.QueryDeviceRelations.Type) @@ -441,6 +447,13 @@ PciIdeXFdoPnpDispatch( } break; } + case IRP_MN_QUERY_PNP_DEVICE_STATE: /* 0x14 */ + { + DPRINT("IRP_MJ_PNP / IRP_MN_QUERY_PNP_DEVICE_STATE\n"); + Information |= PNP_DEVICE_NOT_DISABLEABLE; + Status = STATUS_SUCCESS; + break; + } case IRP_MN_FILTER_RESOURCE_REQUIREMENTS: /* 0x0d */ { DPRINT("IRP_MJ_PNP / IRP_MN_FILTER_RESOURCE_REQUIREMENTS\n"); diff --git a/drivers/storage/ide/pciidex/miniport.c b/drivers/storage/ide/pciidex/miniport.c index a2ffc84302d..1eed359de9a 100644 --- a/drivers/storage/ide/pciidex/miniport.c +++ b/drivers/storage/ide/pciidex/miniport.c @@ -34,7 +34,6 @@ PciIdeXForwardOrIgnore( else { DPRINT1("PDO stub for major function 0x%lx\n", MajorFunction); - ASSERT(FALSE); Status = STATUS_NOT_SUPPORTED; } Irp->IoStatus.Information = 0; diff --git a/drivers/storage/ide/pciidex/pciidex.rbuild b/drivers/storage/ide/pciidex/pciidex.rbuild index 9a4e01aff82..3039577f6a3 100644 --- a/drivers/storage/ide/pciidex/pciidex.rbuild +++ b/drivers/storage/ide/pciidex/pciidex.rbuild @@ -1,6 +1,7 @@ + ntoskrnl fdo.c @@ -9,4 +10,5 @@ pciidex.c pdo.c pciidex.rc + pciidex.h diff --git a/drivers/storage/ide/pciidex/pdo.c b/drivers/storage/ide/pciidex/pdo.c index c580077a78c..f79b00a5315 100644 --- a/drivers/storage/ide/pciidex/pdo.c +++ b/drivers/storage/ide/pciidex/pdo.c @@ -360,7 +360,7 @@ PciIdeXPdoPnpDispatch( { ULONG MinorFunction; PIO_STACK_LOCATION Stack; - ULONG_PTR Information = 0; + ULONG_PTR Information = Irp->IoStatus.Information; NTSTATUS Status; Stack = IoGetCurrentIrpStackLocation(Irp); @@ -404,6 +404,12 @@ PciIdeXPdoPnpDispatch( Status = STATUS_SUCCESS; break; } + case IRP_MN_QUERY_REMOVE_DEVICE: /* 0x01 */ + { + DPRINT("IRP_MJ_PNP / IRP_MN_QUERY_REMOVE_DEVICE\n"); + Status = STATUS_UNSUCCESSFUL; + break; + } case IRP_MN_QUERY_DEVICE_RELATIONS: /* 0x07 */ { switch (Stack->Parameters.QueryDeviceRelations.Type) @@ -441,7 +447,7 @@ PciIdeXPdoPnpDispatch( DeviceCapabilities->DockDevice = FALSE; DeviceCapabilities->UniqueID = FALSE; DeviceCapabilities->SilentInstall = FALSE; - DeviceCapabilities->RawDeviceOK = TRUE; + DeviceCapabilities->RawDeviceOK = FALSE; DeviceCapabilities->SurpriseRemovalOK = TRUE; DeviceCapabilities->HardwareDisabled = FALSE; /* FIXME */ //DeviceCapabilities->NoDisplayInUI = FALSE; /* FIXME */ @@ -485,6 +491,13 @@ PciIdeXPdoPnpDispatch( Status = PciIdeXPdoQueryId(DeviceObject, Irp, &Information); break; } + case IRP_MN_QUERY_PNP_DEVICE_STATE: /* 0x14 */ + { + DPRINT("IRP_MJ_PNP / IRP_MN_QUERY_PNP_DEVICE_STATE\n"); + Information |= PNP_DEVICE_NOT_DISABLEABLE; + Status = STATUS_SUCCESS; + break; + } case IRP_MN_QUERY_BUS_INFORMATION: /* 0x15 */ { PPNP_BUS_INFORMATION BusInfo; diff --git a/drivers/storage/ide/uniata/CMakeLists.txt b/drivers/storage/ide/uniata/CMakeLists.txt index 8052d7f0035..ab0e3ddb08e 100644 --- a/drivers/storage/ide/uniata/CMakeLists.txt +++ b/drivers/storage/ide/uniata/CMakeLists.txt @@ -1,5 +1,9 @@ -include_directories(inc) +include_directories( + BEFORE ${CMAKE_CURRENT_SOURCE_DIR} + inc) + +#add_definitions(-D_DEBUG) set_cpp() set_rc_compiler() @@ -15,7 +19,7 @@ add_library(uniata SHARED idedma.rc ros_glue/ros_glue.cpp) +add_pch(uniata stdafx.h) set_module_type(uniata kernelmodedriver) add_importlibs(uniata scsiport ntoskrnl hal) - -add_cd_file(TARGET uniata DESTINATION reactos/system32/drivers NO_CAB FOR all) \ No newline at end of file +add_cd_file(TARGET uniata DESTINATION reactos/system32/drivers NO_CAB FOR all) diff --git a/drivers/storage/ide/uniata/config.h b/drivers/storage/ide/uniata/config.h index 687cd46e60d..690acd4b0cd 100644 --- a/drivers/storage/ide/uniata/config.h +++ b/drivers/storage/ide/uniata/config.h @@ -129,15 +129,11 @@ #define DEF_I64(x) (x##I64) /* ReactOS-specific defines */ - #ifdef USE_REACTOS_DDK - #else //USE_REACTOS_DDK #define DDKAPI __stdcall #define DDKFASTAPI __fastcall #define DDKCDECLAPI _cdecl - #endif //DDKAPI - #define DECLSPEC_NAKED __declspec(naked) #endif //__GNUC__ diff --git a/drivers/storage/ide/uniata/id_sata.cpp b/drivers/storage/ide/uniata/id_sata.cpp index 0e45b30888d..a48d6e0630b 100644 --- a/drivers/storage/ide/uniata/id_sata.cpp +++ b/drivers/storage/ide/uniata/id_sata.cpp @@ -243,6 +243,7 @@ UniataSataEvent( } // end UniataSataEvent() ULONG +NTAPI UniataSataReadPort4( IN PHW_CHANNEL chan, IN ULONG io_port_ndx, @@ -311,6 +312,7 @@ UniataSataReadPort4( } // end UniataSataReadPort4() VOID +NTAPI UniataSataWritePort4( IN PHW_CHANNEL chan, IN ULONG io_port_ndx, diff --git a/drivers/storage/ide/uniata/uniata.rbuild b/drivers/storage/ide/uniata/uniata.rbuild index af1ad6b324b..db297574935 100644 --- a/drivers/storage/ide/uniata/uniata.rbuild +++ b/drivers/storage/ide/uniata/uniata.rbuild @@ -24,4 +24,6 @@ ros_glue.cpp + + stdafx.h diff --git a/drivers/storage/scsiport/CMakeLists.txt b/drivers/storage/scsiport/CMakeLists.txt index 2be2a018591..fd8dafb4956 100644 --- a/drivers/storage/scsiport/CMakeLists.txt +++ b/drivers/storage/scsiport/CMakeLists.txt @@ -8,10 +8,8 @@ list(APPEND SOURCE ${CMAKE_CURRENT_BINARY_DIR}/scsiport.def) add_library(scsiport SHARED ${SOURCE}) - +add_pch(scsiport precomp.h) set_module_type(scsiport kernelmodedriver) - add_importlibs(scsiport ntoskrnl hal) add_importlib_target(scsiport.spec) - add_cd_file(TARGET scsiport DESTINATION reactos/system32/drivers NO_CAB FOR all) diff --git a/drivers/storage/scsiport/precomp.h b/drivers/storage/scsiport/precomp.h new file mode 100644 index 00000000000..8cfb69e8948 --- /dev/null +++ b/drivers/storage/scsiport/precomp.h @@ -0,0 +1,10 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +#include "scsiport_int.h" diff --git a/drivers/storage/scsiport/scsiport.c b/drivers/storage/scsiport/scsiport.c index 566df4fdc8b..6010772740a 100644 --- a/drivers/storage/scsiport/scsiport.c +++ b/drivers/storage/scsiport/scsiport.c @@ -27,22 +27,13 @@ /* INCLUDES *****************************************************************/ -#include -#include -#include -#include -#include -#include -#include -#include +#include "precomp.h" #ifndef NDEBUG #define NDEBUG #endif #include -#include "scsiport_int.h" - ULONG InternalDebugLevel = 0x00; #undef ScsiPortMoveMemory diff --git a/drivers/storage/scsiport/scsiport.rbuild b/drivers/storage/scsiport/scsiport.rbuild index d56de33941a..60fec05485d 100644 --- a/drivers/storage/scsiport/scsiport.rbuild +++ b/drivers/storage/scsiport/scsiport.rbuild @@ -10,4 +10,5 @@ scsiport.c stubs.c scsiport.rc + precomp.h diff --git a/drivers/storage/scsiport/stubs.c b/drivers/storage/scsiport/stubs.c index 28070bc6e42..ac84daeb902 100644 --- a/drivers/storage/scsiport/stubs.c +++ b/drivers/storage/scsiport/stubs.c @@ -8,8 +8,7 @@ /* INCLUDES *****************************************************************/ -#include -#include +#include "precomp.h" #define NDEBUG #include @@ -249,7 +248,7 @@ VOID NTAPI ScsiPortWriteRegisterUchar( IN PUCHAR Register, - IN ULONG Value) + IN UCHAR Value) { WRITE_REGISTER_UCHAR(Register, Value); } diff --git a/drivers/usb/CMakeLists.txt b/drivers/usb/CMakeLists.txt index 291a4290b86..a7eb481921d 100644 --- a/drivers/usb/CMakeLists.txt +++ b/drivers/usb/CMakeLists.txt @@ -1,5 +1,5 @@ -add_subdirectory(nt4compat) +#add_subdirectory(nt4compat) add_subdirectory(usbd) #add_subdirectory(usbehci) The USB branch has usbehci_new #add_subdirectory(usbhub) Compiles, just skipped in trunk diff --git a/drivers/usb/directory.rbuild b/drivers/usb/directory.rbuild index e81eb8b291a..04b926b50fd 100644 --- a/drivers/usb/directory.rbuild +++ b/drivers/usb/directory.rbuild @@ -1,9 +1,9 @@ - + diff --git a/drivers/usb/nt4compat/usbdriver/CMakeLists.txt b/drivers/usb/nt4compat/usbdriver/CMakeLists.txt index fcf92117880..2bf1365a6ee 100644 --- a/drivers/usb/nt4compat/usbdriver/CMakeLists.txt +++ b/drivers/usb/nt4compat/usbdriver/CMakeLists.txt @@ -25,11 +25,11 @@ list(APPEND SOURCE keyboard.c usbdriver.rc) -add_library(usbdriver SHARED ${CMAKE_CURRENT_BINARY_DIR}/usbdriver_usbdriver.h.gch ${SOURCE}) +add_library(usbdriver SHARED ${SOURCE}) set_module_type(usbdriver kernelmodedriver) add_importlibs(usbdriver ntoskrnl hal) -add_pch(usbdriver ${CMAKE_CURRENT_SOURCE_DIR}/usbdriver.h ${SOURCE}) +add_pch(usbdriver usbdriver.h) add_cd_file(TARGET usbdriver DESTINATION reactos/system32/drivers FOR all) diff --git a/drivers/video/displays/framebuf/CMakeLists.txt b/drivers/video/displays/framebuf/CMakeLists.txt index 2e7a143f0f7..dd9db6f11b9 100644 --- a/drivers/video/displays/framebuf/CMakeLists.txt +++ b/drivers/video/displays/framebuf/CMakeLists.txt @@ -10,6 +10,7 @@ add_library(framebuf SHARED framebuf.rc ${CMAKE_CURRENT_BINARY_DIR}/framebuf.def) +add_pch(framebuf framebuf.h) set_entrypoint(framebuf DrvEnableDriver@12) set_subsystem(framebuf native) set_image_base(framebuf 0x00010000) diff --git a/drivers/video/displays/framebuf/framebuf.h b/drivers/video/displays/framebuf/framebuf.h index 7f222c8ce84..dec91fac2d4 100644 --- a/drivers/video/displays/framebuf/framebuf.h +++ b/drivers/video/displays/framebuf/framebuf.h @@ -18,8 +18,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#pragma once - #include #include #include diff --git a/drivers/video/displays/framebuf/framebuf.rbuild b/drivers/video/displays/framebuf/framebuf.rbuild index 5dcb2f06832..2ac987ecf90 100644 --- a/drivers/video/displays/framebuf/framebuf.rbuild +++ b/drivers/video/displays/framebuf/framebuf.rbuild @@ -10,4 +10,5 @@ screen.c surface.c framebuf.rc + framebuf.h diff --git a/drivers/video/displays/framebuf_new/CMakeLists.txt b/drivers/video/displays/framebuf_new/CMakeLists.txt index d78771398ae..8e7a39748f2 100644 --- a/drivers/video/displays/framebuf_new/CMakeLists.txt +++ b/drivers/video/displays/framebuf_new/CMakeLists.txt @@ -10,7 +10,7 @@ list(APPEND SOURCE framebuf_new.rc ${CMAKE_CURRENT_BINARY_DIR}/framebuf_new.def) -add_library(framebuf_new SHARED ${CMAKE_CURRENT_BINARY_DIR}/framebuf_new_driver.h.gch ${SOURCE}) +add_library(framebuf_new SHARED ${SOURCE}) if(ARCH MATCHES i386) if(MSVC) @@ -27,5 +27,5 @@ set_image_base(framebuf_new 0x00010000) target_link_libraries(framebuf_new libcntpr) add_importlibs(framebuf_new win32k) -add_pch(framebuf_new ${CMAKE_CURRENT_SOURCE_DIR}/driver.h ${SOURCE}) +add_pch(framebuf_new driver.h) add_dependencies(framebuf_new psdk bugcodes) diff --git a/drivers/video/displays/framebuf_new/driver.h b/drivers/video/displays/framebuf_new/driver.h index e9e617190c0..64ebbbc51a4 100644 --- a/drivers/video/displays/framebuf_new/driver.h +++ b/drivers/video/displays/framebuf_new/driver.h @@ -10,6 +10,7 @@ //#define DBG 1 #include "stddef.h" #include +#include #include "windef.h" #include "wingdi.h" #include "winddi.h" diff --git a/drivers/video/displays/vga/CMakeLists.txt b/drivers/video/displays/vga/CMakeLists.txt index fa24aed85b1..ddbb639f701 100644 --- a/drivers/video/displays/vga/CMakeLists.txt +++ b/drivers/video/displays/vga/CMakeLists.txt @@ -18,7 +18,7 @@ add_library(vgaddi SHARED set_entrypoint(vgaddi DrvEnableDriver@12) set_subsystem(vgaddi native) set_image_base(vgaddi 0x00010000) - +add_pch(vgaddi vgaddi.h) add_importlibs(vgaddi win32k) target_link_libraries(vgaddi libcntpr) add_dependencies(vgaddi psdk bugcodes) diff --git a/drivers/video/displays/vga/vgaddi.h b/drivers/video/displays/vga/vgaddi.h index 980965da696..8988746c1ad 100644 --- a/drivers/video/displays/vga/vgaddi.h +++ b/drivers/video/displays/vga/vgaddi.h @@ -1,5 +1,3 @@ -#pragma once - #define _WINBASE_ #define _WINDOWS_H #include diff --git a/drivers/video/displays/vga/vgaddi.rbuild b/drivers/video/displays/vga/vgaddi.rbuild index 35479f8657e..b17c7bbaa57 100644 --- a/drivers/video/displays/vga/vgaddi.rbuild +++ b/drivers/video/displays/vga/vgaddi.rbuild @@ -21,4 +21,5 @@ vgavideo.c vgaddi.rc + vgaddi.h diff --git a/drivers/video/font/bmfd/CMakeLists.txt b/drivers/video/font/bmfd/CMakeLists.txt index 9645669efeb..5380e79adf5 100644 --- a/drivers/video/font/bmfd/CMakeLists.txt +++ b/drivers/video/font/bmfd/CMakeLists.txt @@ -4,11 +4,10 @@ add_library(bmfd SHARED font.c glyph.c) +add_pch(bmfd bmfd.h) set_entrypoint(bmfd BmfdEnableDriver@12) set_subsystem(bmfd native) set_image_base(bmfd 0x00010000) - target_link_libraries(bmfd libcntpr) - add_importlibs(bmfd win32k) add_dependencies(bmfd psdk bugcodes) diff --git a/drivers/video/font/bmfd/bmfd.rbuild b/drivers/video/font/bmfd/bmfd.rbuild index 2f424df95b8..9cc52f47a94 100644 --- a/drivers/video/font/bmfd/bmfd.rbuild +++ b/drivers/video/font/bmfd/bmfd.rbuild @@ -6,4 +6,5 @@ enable.c font.c glyph.c + bmfd.h diff --git a/drivers/video/font/ftfd/CMakeLists.txt b/drivers/video/font/ftfd/CMakeLists.txt index 72458f71082..c2e66436c6c 100644 --- a/drivers/video/font/ftfd/CMakeLists.txt +++ b/drivers/video/font/ftfd/CMakeLists.txt @@ -19,6 +19,7 @@ target_link_libraries(ftfd freetype libcntpr) +add_pch(ftfd ftfd.h) add_importlibs(ftfd win32k) add_dependencies(ftfd psdk) add_cd_file(TARGET ftfd DESTINATION reactos/system32 FOR all) diff --git a/drivers/video/font/ftfd/ftfd.h b/drivers/video/font/ftfd/ftfd.h index 61efcd86c1a..7fdeb6373b1 100644 --- a/drivers/video/font/ftfd/ftfd.h +++ b/drivers/video/font/ftfd/ftfd.h @@ -50,7 +50,7 @@ typedef struct /** Function prototypes *******************************************************/ ULONG -DbgPrint(IN PCHAR Format, IN ...); +DbgPrint(IN PCCH Format, IN ...); DHPDEV APIENTRY diff --git a/drivers/video/font/ftfd/ftfd.rbuild b/drivers/video/font/ftfd/ftfd.rbuild index 34d822af2a7..2cd06863b84 100644 --- a/drivers/video/font/ftfd/ftfd.rbuild +++ b/drivers/video/font/ftfd/ftfd.rbuild @@ -10,4 +10,5 @@ glyph.c rosglue.c sprintf.c + ftfd.h diff --git a/drivers/video/font/ftfd/rosglue.c b/drivers/video/font/ftfd/rosglue.c index 484fa6f3963..6a8c025a230 100644 --- a/drivers/video/font/ftfd/rosglue.c +++ b/drivers/video/font/ftfd/rosglue.c @@ -8,11 +8,7 @@ * NOTES: */ -#include -#include -#include -#include -#include +#include "ftfd.h" #define NDEBUG #include diff --git a/drivers/video/font/ftfd/sprintf.c b/drivers/video/font/ftfd/sprintf.c index 60bac91e684..39b8153a0bb 100644 --- a/drivers/video/font/ftfd/sprintf.c +++ b/drivers/video/font/ftfd/sprintf.c @@ -17,11 +17,7 @@ * Wirzenius wrote this portably, Torvalds fucked it up :-) */ -#define WIN32_NO_STATUS -#include #include -#include -#include #define ZEROPAD 1 /* pad with zero */ #define SIGN 2 /* unsigned/signed long */ diff --git a/drivers/video/miniport/vbe/CMakeLists.txt b/drivers/video/miniport/vbe/CMakeLists.txt index 590db9a20d6..7f0b42724b0 100644 --- a/drivers/video/miniport/vbe/CMakeLists.txt +++ b/drivers/video/miniport/vbe/CMakeLists.txt @@ -6,7 +6,6 @@ add_library(vbemp SHARED set_module_type(vbemp kernelmodedriver) add_importlibs(vbemp videoprt) - +add_pch(vbemp vbemp.h) target_link_libraries(vbemp libcntpr) - add_cd_file(TARGET vbemp DESTINATION reactos/system32/drivers FOR all) diff --git a/drivers/video/miniport/vbe/vbemp.h b/drivers/video/miniport/vbe/vbemp.h index 34807b2f978..1e9e3a3ee29 100644 --- a/drivers/video/miniport/vbe/vbemp.h +++ b/drivers/video/miniport/vbe/vbemp.h @@ -18,8 +18,6 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#pragma once - /* INCLUDES *******************************************************************/ #include "ntdef.h" diff --git a/drivers/video/miniport/vbe/vbemp.rbuild b/drivers/video/miniport/vbe/vbemp.rbuild index 8462a19f536..7d378e50c12 100644 --- a/drivers/video/miniport/vbe/vbemp.rbuild +++ b/drivers/video/miniport/vbe/vbemp.rbuild @@ -6,4 +6,5 @@ edid.c vbemp.c vbemp.rc + vbemp.h diff --git a/drivers/video/miniport/vga/CMakeLists.txt b/drivers/video/miniport/vga/CMakeLists.txt index 52fe270c1d8..841879b3652 100644 --- a/drivers/video/miniport/vga/CMakeLists.txt +++ b/drivers/video/miniport/vga/CMakeLists.txt @@ -4,10 +4,10 @@ list(APPEND SOURCE vgamp.c vgamp.rc) -add_library(vgamp SHARED ${CMAKE_CURRENT_BINARY_DIR}/vgamp_vgamp.h.gch ${SOURCE}) +add_library(vgamp SHARED ${SOURCE}) set_module_type(vgamp kernelmodedriver) add_importlibs(vgamp videoprt) -add_pch(vgamp ${CMAKE_CURRENT_SOURCE_DIR}/vgamp.h ${SOURCE}) +add_pch(vgamp vgamp.h) add_cd_file(TARGET vgamp DESTINATION reactos/system32/drivers FOR all) diff --git a/drivers/video/miniport/vga_new/CMakeLists.txt b/drivers/video/miniport/vga_new/CMakeLists.txt index dba2632b9dc..3580a9cb701 100644 --- a/drivers/video/miniport/vga_new/CMakeLists.txt +++ b/drivers/video/miniport/vga_new/CMakeLists.txt @@ -7,7 +7,7 @@ list(APPEND SOURCE vbe.c vga.rc) -add_library(vga SHARED ${CMAKE_CURRENT_BINARY_DIR}/vga_vga.h.gch ${SOURCE}) +add_library(vga SHARED ${SOURCE}) target_link_libraries(vga libcntpr) @@ -20,6 +20,6 @@ endif() set_module_type(vga kernelmodedriver) add_importlibs(vga videoprt) -add_pch(vga ${CMAKE_CURRENT_SOURCE_DIR}/vga.h ${SOURCE}) +add_pch(vga vga.h) add_cd_file(TARGET vga DESTINATION reactos/system32/drivers FOR all) diff --git a/drivers/video/miniport/vmx_svga/CMakeLists.txt b/drivers/video/miniport/vmx_svga/CMakeLists.txt index 056fe513f51..3f97a72c218 100644 --- a/drivers/video/miniport/vmx_svga/CMakeLists.txt +++ b/drivers/video/miniport/vmx_svga/CMakeLists.txt @@ -1,9 +1,9 @@ list(APPEND SOURCE vmx_svga.c vmx_svga.rc) -add_library(vmx_svga SHARED ${CMAKE_CURRENT_BINARY_DIR}/vmx_svga_precomp.h.gch ${SOURCE}) +add_library(vmx_svga SHARED ${SOURCE}) set_module_type(vmx_svga kernelmodedriver) add_importlibs(vmx_svga ntoskrnl videoprt) -add_pch(vmx_svga ${CMAKE_CURRENT_SOURCE_DIR}/precomp.h ${SOURCE}) +add_pch(vmx_svga precomp.h) diff --git a/drivers/video/videoprt/CMakeLists.txt b/drivers/video/videoprt/CMakeLists.txt index 2485ada6020..1eea498eb64 100644 --- a/drivers/video/videoprt/CMakeLists.txt +++ b/drivers/video/videoprt/CMakeLists.txt @@ -23,11 +23,11 @@ list(APPEND SOURCE videoprt.rc ${CMAKE_CURRENT_BINARY_DIR}/videoprt.def) -add_library(videoprt SHARED ${CMAKE_CURRENT_BINARY_DIR}/videoprt_videoprt.h.gch ${SOURCE}) +add_library(videoprt SHARED ${SOURCE}) set_module_type(videoprt kernelmodedriver) add_importlibs(videoprt ntoskrnl hal) -add_pch(videoprt ${CMAKE_CURRENT_SOURCE_DIR}/videoprt.h ${SOURCE}) +add_pch(videoprt videoprt.h) add_cd_file(TARGET videoprt DESTINATION reactos/system32/drivers FOR all) add_importlib_target(videoprt.spec) diff --git a/drivers/video/videoprt/agp.c b/drivers/video/videoprt/agp.c index 768e6d92f0a..54bef7da872 100644 --- a/drivers/video/videoprt/agp.c +++ b/drivers/video/videoprt/agp.c @@ -20,8 +20,6 @@ */ #include "videoprt.h" -#include -#include /* PRIVATE FUNCTIONS **********************************************************/ @@ -29,7 +27,7 @@ NTSTATUS IopInitiatePnpIrp( PDEVICE_OBJECT DeviceObject, PIO_STATUS_BLOCK IoStatusBlock, - ULONG MinorFunction, + UCHAR MinorFunction, PIO_STACK_LOCATION Stack OPTIONAL) { PDEVICE_OBJECT TopDeviceObject; @@ -56,8 +54,8 @@ IopInitiatePnpIrp( IoStatusBlock); /* PNP IRPs are always initialized with a status code of - STATUS_NOT_IMPLEMENTED */ - Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED; + STATUS_NOT_SUPPORTED */ + Irp->IoStatus.Status = STATUS_NOT_SUPPORTED; Irp->IoStatus.Information = 0; IrpSp = IoGetNextIrpStackLocation(Irp); diff --git a/drivers/video/videoprt/dma.c b/drivers/video/videoprt/dma.c index e35f63b9ecf..bc344aeb287 100644 --- a/drivers/video/videoprt/dma.c +++ b/drivers/video/videoprt/dma.c @@ -203,8 +203,7 @@ VideoPortFreeCommonBuffer(IN PVOID HwDeviceExtension, ASSERT(VpDmaAdapter->Adapter != NULL); ASSERT(VpDmaAdapter->MapRegisters != 0); - return VideoPortReleaseCommonBuffer(HwDeviceExtension, (PVP_DMA_ADAPTER)VpDmaAdapter, Length, LogicalAddress, VirtualAddress, CacheEnabled); - + VideoPortReleaseCommonBuffer(HwDeviceExtension, (PVP_DMA_ADAPTER)VpDmaAdapter, Length, LogicalAddress, VirtualAddress, CacheEnabled); } /* diff --git a/drivers/video/videoprt/int10.c b/drivers/video/videoprt/int10.c index 2b287133084..36c14dc43cb 100644 --- a/drivers/video/videoprt/int10.c +++ b/drivers/video/videoprt/int10.c @@ -60,8 +60,8 @@ IntInt10AllocateBuffer( return ERROR_NOT_ENOUGH_MEMORY; } - *Seg = (ULONG)MemoryAddress >> 4; - *Off = (ULONG)MemoryAddress & 0xF; + *Seg = (USHORT)((ULONG)MemoryAddress >> 4); + *Off = (USHORT)((ULONG)MemoryAddress & 0xF); INFO_(VIDEOPRT, "- Segment: %x\n", (ULONG)MemoryAddress >> 4); INFO_(VIDEOPRT, "- Offset: %x\n", (ULONG)MemoryAddress & 0xF); @@ -182,8 +182,8 @@ IntInt10CallBios( BiosArguments->Esi = BiosContext.Esi; BiosArguments->Edi = BiosContext.Edi; BiosArguments->Ebp = BiosContext.Ebp; - BiosArguments->SegDs = BiosContext.SegDs; - BiosArguments->SegEs = BiosContext.SegEs; + BiosArguments->SegDs = (USHORT)BiosContext.SegDs; + BiosArguments->SegEs = (USHORT)BiosContext.SegEs; /* Detach and return status */ IntDetachFromCSRSS(&CallingProcess, &ApcState); diff --git a/drivers/video/videoprt/interrupt.c b/drivers/video/videoprt/interrupt.c index 64d41e425f8..961e6ea9929 100644 --- a/drivers/video/videoprt/interrupt.c +++ b/drivers/video/videoprt/interrupt.c @@ -125,7 +125,7 @@ VideoPortEnableInterrupt(IN PVOID HwDeviceExtension) } /* Re-enable the interrupt and return */ - InterruptValid = HalEnableSystemInterrupt(DeviceExtension->InterruptVector, + InterruptValid = HalEnableSystemInterrupt((UCHAR)DeviceExtension->InterruptVector, 0, DeviceExtension->InterruptLevel); @@ -162,7 +162,7 @@ VideoPortDisableInterrupt(IN PVOID HwDeviceExtension) } /* Disable the interrupt and return */ - HalDisableSystemInterrupt(DeviceExtension->InterruptVector, + HalDisableSystemInterrupt((UCHAR)DeviceExtension->InterruptVector, 0); return NO_ERROR; #else diff --git a/drivers/video/videoprt/resource.c b/drivers/video/videoprt/resource.c index 1e4162de0c3..b83ca1fb950 100644 --- a/drivers/video/videoprt/resource.c +++ b/drivers/video/videoprt/resource.c @@ -79,7 +79,7 @@ IntVideoPortMapMemory( IN PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension, IN PHYSICAL_ADDRESS IoAddress, IN ULONG NumberOfUchars, - IN UCHAR InIoSpace, + IN ULONG InIoSpace, IN HANDLE ProcessHandle, OUT VP_STATUS *Status) { diff --git a/drivers/video/videoprt/stubs.c b/drivers/video/videoprt/stubs.c index 5e557f09cfc..4745869b42f 100644 --- a/drivers/video/videoprt/stubs.c +++ b/drivers/video/videoprt/stubs.c @@ -21,7 +21,6 @@ #include "videoprt.h" -#include VP_STATUS NTAPI diff --git a/drivers/video/videoprt/videoprt.c b/drivers/video/videoprt/videoprt.c index 2fe1870ad53..f90801d986a 100644 --- a/drivers/video/videoprt/videoprt.c +++ b/drivers/video/videoprt/videoprt.c @@ -21,7 +21,6 @@ #include "videoprt.h" -#include /* GLOBAL VARIABLES ***********************************************************/ diff --git a/drivers/video/videoprt/videoprt.h b/drivers/video/videoprt/videoprt.h index eb2b8eee111..e89d7a1e1f2 100644 --- a/drivers/video/videoprt/videoprt.h +++ b/drivers/video/videoprt/videoprt.h @@ -23,16 +23,22 @@ #define VIDEOPRT_H #include -#include + +#include +#include +#include +#include +#include +#include + #define __BROKEN__ #include #include -#include #include -#include -#include #include #include +#include +#include #include @@ -116,7 +122,7 @@ NTSTATUS IopInitiatePnpIrp( PDEVICE_OBJECT DeviceObject, PIO_STATUS_BLOCK IoStatusBlock, - ULONG MinorFunction, + UCHAR MinorFunction, PIO_STACK_LOCATION Stack OPTIONAL); NTSTATUS NTAPI diff --git a/drivers/wdm/audio/backpln/audio_test/audio_test.c b/drivers/wdm/audio/backpln/audio_test/audio_test.c index 6c2ab8d8451..92b7f6514ac 100644 --- a/drivers/wdm/audio/backpln/audio_test/audio_test.c +++ b/drivers/wdm/audio/backpln/audio_test/audio_test.c @@ -4,26 +4,17 @@ #define _KSDDK_ #include -#include #include #include #include -#include -#include +#include #include #include "interface.h" - #define _2pi 6.283185307179586476925286766559 - - -#include - - GUID CategoryGuid = {STATIC_KSCATEGORY_AUDIO}; - const GUID KSPROPSETID_Pin = {0x8C134960L, 0x51AD, 0x11CF, {0x87, 0x8A, 0x94, 0xF8, 0x01, 0xC1, 0x00, 0x00}}; const GUID KSPROPSETID_Connection = {0x1D58C920L, 0xAC9B, 0x11CF, {0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00}}; const GUID KSPROPSETID_Sysaudio = {0xCBE3FAA0L, 0xCC75, 0x11D0, {0xB4, 0x65, 0x00, 0x00, 0x1A, 0x18, 0x18, 0xE6}}; @@ -34,7 +25,6 @@ const GUID KSDATAFORMAT_TYPE_AUDIO = {0x73647561L, 0x0000, 0x0010, const GUID KSDATAFORMAT_SUBTYPE_PCM = {0x00000001L, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}}; const GUID KSDATAFORMAT_SPECIFIER_WAVEFORMATEX = {0x05589f81L, 0xc356, 0x11ce, {0xbf, 0x01, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a}}; - VOID TestKs() { diff --git a/drivers/wdm/audio/backpln/portcls/CMakeLists.txt b/drivers/wdm/audio/backpln/portcls/CMakeLists.txt index ce2bc4d3dd3..0b5df286848 100644 --- a/drivers/wdm/audio/backpln/portcls/CMakeLists.txt +++ b/drivers/wdm/audio/backpln/portcls/CMakeLists.txt @@ -63,11 +63,10 @@ else() set_target_properties(portcls PROPERTIES COMPILE_FLAGS "-fno-exceptions -fno-rtti") endif(MSVC) +add_pch(portcls private.hpp) set_entrypoint(portcls 0) set_image_base(portcls 0x00010000) set_subsystem(portcls native) set_target_properties(portcls PROPERTIES SUFFIX ".sys") - add_importlibs(portcls ntoskrnl ks drmk hal) - add_cd_file(TARGET portcls DESTINATION reactos/system32/drivers FOR all) \ No newline at end of file diff --git a/drivers/wdm/audio/backpln/portcls/portcls.rbuild b/drivers/wdm/audio/backpln/portcls/portcls.rbuild index 9b008b652d3..e453f59a355 100644 --- a/drivers/wdm/audio/backpln/portcls/portcls.rbuild +++ b/drivers/wdm/audio/backpln/portcls/portcls.rbuild @@ -62,4 +62,5 @@ unregister.cpp version.cpp portcls.rc + private.hpp diff --git a/drivers/wdm/audio/drm/drmk/CMakeLists.txt b/drivers/wdm/audio/drm/drmk/CMakeLists.txt index 20bd61a8eee..eb70b994869 100644 --- a/drivers/wdm/audio/drm/drmk/CMakeLists.txt +++ b/drivers/wdm/audio/drm/drmk/CMakeLists.txt @@ -11,19 +11,17 @@ list(APPEND SOURCE add_library(drmk SHARED ${SOURCE}) if(NOT MSVC) - set_module_type(drmk kernelmodedriver) + set_module_type(drmk kernelmodedriver) else() - set_target_properties(drmk PROPERTIES SUFFIX ".sys") - set_subsystem(drmk native) + set_target_properties(drmk PROPERTIES SUFFIX ".sys") + set_subsystem(drmk native) set_image_base(drmk 0x00010000) add_linkerflag(drmk "/DRIVER") add_dependencies(drmk bugcodes) - target_link_libraries(drmk msvcsup) - add_dependencies(drmk psdk) + add_dependencies(drmk psdk) endif() set_entrypoint(drmk 0) add_importlibs(drmk ntoskrnl) add_importlib_target(drmk.spec) - add_cd_file(TARGET drmk DESTINATION reactos/system32/drivers FOR all) diff --git a/drivers/wdm/audio/filters/kmixer/CMakeLists.txt b/drivers/wdm/audio/filters/kmixer/CMakeLists.txt index 36da734090c..f49556df0cd 100644 --- a/drivers/wdm/audio/filters/kmixer/CMakeLists.txt +++ b/drivers/wdm/audio/filters/kmixer/CMakeLists.txt @@ -12,6 +12,6 @@ target_link_libraries(kmixer libcntpr libsamplerate) +add_pch(kmixer kmixer.h) add_importlibs(kmixer ntoskrnl ks hal) - -add_cd_file(TARGET kmixer DESTINATION reactos/system32/drivers FOR all) \ No newline at end of file +add_cd_file(TARGET kmixer DESTINATION reactos/system32/drivers FOR all) diff --git a/drivers/wdm/audio/filters/kmixer/kmixer.h b/drivers/wdm/audio/filters/kmixer/kmixer.h index 18c82c191a4..0564aa65ae5 100644 --- a/drivers/wdm/audio/filters/kmixer/kmixer.h +++ b/drivers/wdm/audio/filters/kmixer/kmixer.h @@ -1,5 +1,3 @@ -#pragma once - #include #include #include diff --git a/drivers/wdm/audio/filters/kmixer/kmixer.rbuild b/drivers/wdm/audio/filters/kmixer/kmixer.rbuild index d5fcf8c3906..28691cf68a6 100644 --- a/drivers/wdm/audio/filters/kmixer/kmixer.rbuild +++ b/drivers/wdm/audio/filters/kmixer/kmixer.rbuild @@ -11,4 +11,5 @@ kmixer.c filter.c pin.c + kmixer.h diff --git a/drivers/wdm/audio/legacy/wdmaud/CMakeLists.txt b/drivers/wdm/audio/legacy/wdmaud/CMakeLists.txt index ca4a76661a6..da13de3726f 100644 --- a/drivers/wdm/audio/legacy/wdmaud/CMakeLists.txt +++ b/drivers/wdm/audio/legacy/wdmaud/CMakeLists.txt @@ -20,7 +20,6 @@ target_link_libraries(wdmaud libcntpr ${PSEH_LIB}) +add_pch(wdmaud wdmaud.h) add_importlibs(wdmaud ntoskrnl ks hal) - - add_cd_file(TARGET wdmaud DESTINATION reactos/system32/drivers FOR all) \ No newline at end of file diff --git a/drivers/wdm/audio/legacy/wdmaud/wdmaud.h b/drivers/wdm/audio/legacy/wdmaud/wdmaud.h index c322c3fc8a9..d1d2bccd359 100644 --- a/drivers/wdm/audio/legacy/wdmaud/wdmaud.h +++ b/drivers/wdm/audio/legacy/wdmaud/wdmaud.h @@ -1,5 +1,3 @@ -#pragma once - #include #include #include diff --git a/drivers/wdm/audio/legacy/wdmaud/wdmaud.rbuild b/drivers/wdm/audio/legacy/wdmaud/wdmaud.rbuild index 62bd101e562..20e4724853c 100644 --- a/drivers/wdm/audio/legacy/wdmaud/wdmaud.rbuild +++ b/drivers/wdm/audio/legacy/wdmaud/wdmaud.rbuild @@ -17,4 +17,5 @@ mmixer.c sup.c wdmaud.rc + wdmaud.h diff --git a/drivers/wdm/audio/sysaudio/CMakeLists.txt b/drivers/wdm/audio/sysaudio/CMakeLists.txt index 078f19d1c63..94d57b651df 100644 --- a/drivers/wdm/audio/sysaudio/CMakeLists.txt +++ b/drivers/wdm/audio/sysaudio/CMakeLists.txt @@ -9,10 +9,8 @@ add_library(sysaudio SHARED pin.c sysaudio.rc) +add_pch(sysaudio sysaudio.h) set_module_type(sysaudio kernelmodedriver) - target_link_libraries(sysaudio libcntpr) - add_importlibs(sysaudio ntoskrnl ks hal) - -add_cd_file(TARGET sysaudio DESTINATION reactos/system32/drivers FOR all) \ No newline at end of file +add_cd_file(TARGET sysaudio DESTINATION reactos/system32/drivers FOR all) diff --git a/drivers/wdm/audio/sysaudio/sysaudio.h b/drivers/wdm/audio/sysaudio/sysaudio.h index bd8aea38d83..c65bf551b17 100644 --- a/drivers/wdm/audio/sysaudio/sysaudio.h +++ b/drivers/wdm/audio/sysaudio/sysaudio.h @@ -1,5 +1,3 @@ -#pragma once - #include #include #include diff --git a/drivers/wdm/audio/sysaudio/sysaudio.rbuild b/drivers/wdm/audio/sysaudio/sysaudio.rbuild index 5f69af6effa..098fb849005 100644 --- a/drivers/wdm/audio/sysaudio/sysaudio.rbuild +++ b/drivers/wdm/audio/sysaudio/sysaudio.rbuild @@ -13,4 +13,5 @@ main.c pin.c sysaudio.rc + sysaudio.h diff --git a/drivers/wmi/CMakeLists.txt b/drivers/wmi/CMakeLists.txt index 0ca4443efe6..c00a650c931 100644 --- a/drivers/wmi/CMakeLists.txt +++ b/drivers/wmi/CMakeLists.txt @@ -9,20 +9,18 @@ list(APPEND SOURCE add_library(wmilib SHARED ${SOURCE}) if(NOT MSVC) - set_module_type(wmilib kernelmodedriver) + set_module_type(wmilib kernelmodedriver) else() - set_target_properties(wmilib PROPERTIES SUFFIX ".sys") - set_subsystem(wmilib native) + set_target_properties(wmilib PROPERTIES SUFFIX ".sys") + set_subsystem(wmilib native) set_image_base(wmilib 0x00010000) add_linkerflag(wmilib "/DRIVER") add_dependencies(wmilib bugcodes) - target_link_libraries(wmilib msvcsup) - add_dependencies(wmilib psdk) + add_dependencies(wmilib psdk) endif() set_entrypoint(wmilib 0) set_target_properties(wmilib PROPERTIES SUFFIX ".sys") add_importlibs(wmilib ntoskrnl) add_importlib_target(wmilib.spec) - add_cd_file(TARGET wmilib DESTINATION reactos/system32/drivers FOR all) diff --git a/hal/halx86/CMakeLists.txt b/hal/halx86/CMakeLists.txt index ebada96c389..a533fec2adf 100644 --- a/hal/halx86/CMakeLists.txt +++ b/hal/halx86/CMakeLists.txt @@ -47,6 +47,8 @@ list(APPEND HAL_GENERIC_ACPI_SOURCE generic/legacy/bus/pcibus.c) if(ARCH MATCHES i386) + list(APPEND HAL_GENERIC_ACPI_SOURCE + generic/halinit.c) list(APPEND HAL_GENERIC_UP_SOURCE generic/spinlock.c @@ -82,7 +84,6 @@ if(ARCH MATCHES i386) spec2def(hal.dll ../hal.spec) list(APPEND HAL_SOURCE - ${CMAKE_CURRENT_BINARY_DIR}/hal_hal.h.gch ${HAL_GENERIC_SOURCE} ${HAL_GENERIC_PCAT_SOURCE} ${HAL_GENERIC_UP_SOURCE} @@ -92,7 +93,7 @@ if(ARCH MATCHES i386) # hal add_library(hal SHARED ${HAL_SOURCE}) - add_pch(hal ${CMAKE_CURRENT_SOURCE_DIR}/include/hal.h ${HAL_SOURCE}) + add_pch(hal include/hal.h) add_dependencies(hal psdk bugcodes) set_entrypoint(hal HalInitSystem@8) @@ -103,6 +104,24 @@ if(ARCH MATCHES i386) add_cd_file(TARGET hal DESTINATION reactos/system32 NO_CAB FOR all) + # hal acpi + spec2def(halacpi.dll ../hal.spec halacpi) + add_library(halacpi SHARED + ${HAL_GENERIC_SOURCE} + ${HAL_GENERIC_ACPI_SOURCE} + ${HAL_GENERIC_UP_SOURCE} + up/halinit_up.c + up/halup.rc + ${CMAKE_CURRENT_BINARY_DIR}/halacpi.def) + add_dependencies(halacpi psdk bugcodes) + set_entrypoint(halacpi HalInitSystem@8) + set_subsystem(halacpi native) + set_image_base(halacpi 0x00010000) + add_importlibs(halacpi ntoskrnl) + target_link_libraries(halacpi libcntpr) + set_property(TARGET halacpi PROPERTY COMPILE_DEFINITIONS CONFIG_ACPI) + add_cd_file(TARGET halacpi DESTINATION reactos/system32 NO_CAB FOR all) + # mini_hal add_library(mini_hal ${MINI_HAL_SOURCE}) set_property(TARGET mini_hal PROPERTY COMPILE_DEFINITIONS "_BLDR_;_MINIHAL_") diff --git a/hal/halx86/generic/acpi/halacpi.c b/hal/halx86/generic/acpi/halacpi.c index 22d3c9b6a72..4f8642edf86 100644 --- a/hal/halx86/generic/acpi/halacpi.c +++ b/hal/halx86/generic/acpi/halacpi.c @@ -166,6 +166,7 @@ HalpAcpiGetTableFromBios(IN PLOADER_PARAMETER_BLOCK LoaderBlock, if (Fadt) { /* Grab the DSDT address and assume 2 pages */ + PhysicalAddress.HighPart = 0; PhysicalAddress.LowPart = Fadt->dsdt; TableLength = 2 * PAGE_SIZE; @@ -263,6 +264,7 @@ HalpAcpiGetTableFromBios(IN PLOADER_PARAMETER_BLOCK LoaderBlock, { /* Read the 32-bit physical address */ PhysicalAddress.LowPart = Rsdt->Tables[CurrentEntry]; + PhysicalAddress.HighPart = 0; } else { @@ -420,7 +422,7 @@ HalpAcpiGetTable(IN PLOADER_PARAMETER_BLOCK LoaderBlock, else { /* Phase 1, use Mm */ - MmUnmapIoSpace(TableAddress, PageCount << 12); + MmUnmapIoSpace(TableAddress, PageCount << PAGE_SHIFT); } /* Cache the bios copy */ @@ -603,6 +605,7 @@ HalpAcpiFindRsdtPhase0(IN PLOADER_PARAMETER_BLOCK LoaderBlock, PageCount = BYTES_TO_PAGES(NodeLength); /* Allocate the memory */ + PhysicalAddress.HighPart = 0; PhysicalAddress.LowPart = HalpAllocPhysicalMemory(LoaderBlock, 0x1000000, PageCount, @@ -652,12 +655,13 @@ HalpAcpiTableCacheInit(IN PLOADER_PARAMETER_BLOCK LoaderBlock) /* Find the RSDT */ Status = HalpAcpiFindRsdtPhase0(LoaderBlock, &AcpiMultiNode); if (!NT_SUCCESS(Status)) return Status; + + PhysicalAddress.QuadPart = AcpiMultiNode->RsdtAddress.QuadPart; /* Map the RSDT */ if (LoaderBlock) { /* Phase0: Use HAL Heap to map the RSDT, we assume it's about 2 pages */ - PhysicalAddress.QuadPart = AcpiMultiNode->RsdtAddress.QuadPart; MappedAddress = HalpMapPhysicalMemory64(PhysicalAddress, 2); } else @@ -998,7 +1002,7 @@ HalpQueryAcpiResourceRequirements(OUT PIO_RESOURCE_REQUIREMENTS_LIST *Requiremen else { /* Fail */ - ExFreePoolWithTag(RequirementsList, 0); + ExFreePoolWithTag(RequirementsList, ' laH'); Status = STATUS_NO_SUCH_DEVICE; } } diff --git a/hal/halx86/generic/acpi/halpnpdd.c b/hal/halx86/generic/acpi/halpnpdd.c index 8617b20f1fc..db72aaff8c6 100644 --- a/hal/halx86/generic/acpi/halpnpdd.c +++ b/hal/halx86/generic/acpi/halpnpdd.c @@ -84,7 +84,7 @@ HalpAddDevice(IN PDRIVER_OBJECT DriverObject, FdoExtension->FunctionalDeviceObject = DeviceObject; /* FDO is done initializing */ - DeviceObject->Flags &= DO_DEVICE_INITIALIZING; + DeviceObject->Flags &= ~DO_DEVICE_INITIALIZING; /* Attach to the physical device object (the bus) */ AttachedDevice = IoAttachDeviceToDeviceStack(DeviceObject, TargetDevice); @@ -126,17 +126,20 @@ HalpAddDevice(IN PDRIVER_OBJECT DriverObject, if (!Wdrt) { /* None exists, there is nothing to do more */ - PdoDeviceObject->Flags &= DO_DEVICE_INITIALIZING; + PdoDeviceObject->Flags &= ~DO_DEVICE_INITIALIZING; FdoExtension->ChildPdoList = PdoExtension; } else { /* FIXME: TODO */ DPRINT1("You have an ACPI Watchdog. That's great! You should be proud ;-)\n"); - PdoDeviceObject->Flags &= DO_DEVICE_INITIALIZING; + PdoDeviceObject->Flags &= ~DO_DEVICE_INITIALIZING; FdoExtension->ChildPdoList = PdoExtension; } + /* Invalidate device relations since we added a new device */ + IoInvalidateDeviceRelations(TargetDevice, BusRelations); + /* Return status */ DPRINT1("Device added %lx\n", Status); return Status; @@ -193,7 +196,7 @@ HalpQueryDeviceRelations(IN PDEVICE_OBJECT DeviceObject, FdoRelations = ExAllocatePoolWithTag(PagedPool, FIELD_OFFSET(DEVICE_RELATIONS, Objects) + - 4 * PdoCount, + sizeof(PDEVICE_OBJECT) * PdoCount, ' laH'); if (!FdoRelations) return STATUS_INSUFFICIENT_RESOURCES; @@ -217,7 +220,7 @@ HalpQueryDeviceRelations(IN PDEVICE_OBJECT DeviceObject, } /* Free existing structure */ - ExFreePoolWithTag(*DeviceRelations, 0); + ExFreePool(*DeviceRelations); } /* Now check if we have a PDO list */ @@ -356,7 +359,7 @@ HalpQueryResources(IN PDEVICE_OBJECT DeviceObject, { /* Fail, no memory */ Status = STATUS_INSUFFICIENT_RESOURCES; - ExFreePoolWithTag(RequirementsList, 0); + ExFreePoolWithTag(RequirementsList, ' laH'); return Status; } @@ -369,43 +372,40 @@ HalpQueryResources(IN PDEVICE_OBJECT DeviceObject, ResourceList->List[0].InterfaceType = PNPBus; ResourceList->List[0].PartialResourceList.Version = 1; ResourceList->List[0].PartialResourceList.Revision = 1; - ResourceList->List[0].PartialResourceList.Count = 1; + ResourceList->List[0].PartialResourceList.Count = 0; /* Setup the first descriptor */ PartialDesc = ResourceList->List[0].PartialResourceList.PartialDescriptors; - PartialDesc->Type = CmResourceTypeInterrupt; /* Find the requirement descriptor for the SCI */ for (i = 0; i < RequirementsList->List[0].Count; i++) { /* Get this descriptor */ Descriptor = &RequirementsList->List[0].Descriptors[i]; - if (Descriptor->Type == CmResourceTypeInterrupt) break; - Descriptor = NULL; + if (Descriptor->Type == CmResourceTypeInterrupt) + { + /* Copy requirements descriptor into resource descriptor */ + PartialDesc->Type = CmResourceTypeInterrupt; + PartialDesc->ShareDisposition = Descriptor->ShareDisposition; + PartialDesc->Flags = Descriptor->Flags; + ASSERT(Descriptor->u.Interrupt.MinimumVector == + Descriptor->u.Interrupt.MaximumVector); + PartialDesc->u.Interrupt.Vector = Descriptor->u.Interrupt.MinimumVector; + PartialDesc->u.Interrupt.Level = Descriptor->u.Interrupt.MinimumVector; + PartialDesc->u.Interrupt.Affinity = 0xFFFFFFFF; + + ResourceList->List[0].PartialResourceList.Count++; + + break; + } } - - /* Make sure we found the descriptor */ - if (Descriptor) - { - /* Copy requirements descriptor into resource descriptor */ - PartialDesc->ShareDisposition = Descriptor->ShareDisposition; - PartialDesc->Flags = Descriptor->Flags; - ASSERT(Descriptor->u.Interrupt.MinimumVector == - Descriptor->u.Interrupt.MaximumVector); - PartialDesc->u.Interrupt.Vector = Descriptor->u.Interrupt.MinimumVector; - PartialDesc->u.Interrupt.Level = Descriptor->u.Interrupt.MinimumVector; - PartialDesc->u.Interrupt.Affinity = 0xFFFFFFFF; - - /* Return resources and success */ - *Resources = ResourceList; - ExFreePoolWithTag(RequirementsList, 0); - return STATUS_SUCCESS; - } - - /* Free memory and fail */ - ExFreePoolWithTag(RequirementsList, 0); - ExFreePoolWithTag(ResourceList, 0); - Status = STATUS_NOT_FOUND; + + /* Return resources and success */ + *Resources = ResourceList; + + ExFreePoolWithTag(RequirementsList, ' laH'); + + return STATUS_SUCCESS; } else if (DeviceExtension->PdoType == WdPdo) { @@ -417,9 +417,6 @@ HalpQueryResources(IN PDEVICE_OBJECT DeviceObject, /* This shouldn't happen */ return STATUS_UNSUCCESSFUL; } - - /* Return the status */ - return Status; } NTSTATUS @@ -428,14 +425,13 @@ HalpQueryResourceRequirements(IN PDEVICE_OBJECT DeviceObject, OUT PIO_RESOURCE_REQUIREMENTS_LIST *Requirements) { PPDO_EXTENSION DeviceExtension = DeviceObject->DeviceExtension; - NTSTATUS Status; PAGED_CODE(); /* Only the ACPI PDO has requirements */ if (DeviceExtension->PdoType == AcpiPdo) { /* Query ACPI requirements */ - Status = HalpQueryAcpiResourceRequirements(Requirements); + return HalpQueryAcpiResourceRequirements(Requirements); } else if (DeviceExtension->PdoType == WdPdo) { @@ -447,9 +443,6 @@ HalpQueryResourceRequirements(IN PDEVICE_OBJECT DeviceObject, /* This shouldn't happen */ return STATUS_UNSUCCESSFUL; } - - /* Return the status */ - return Status; } NTSTATUS @@ -460,9 +453,10 @@ HalpQueryIdPdo(IN PDEVICE_OBJECT DeviceObject, { PPDO_EXTENSION PdoExtension; PDO_TYPE PdoType; - PWCHAR Id; + PWCHAR CurrentId; + WCHAR Id[100]; NTSTATUS Status; - ULONG Length; + ULONG Length = 0; PWCHAR Buffer; /* Get the PDO type */ @@ -479,29 +473,39 @@ HalpQueryIdPdo(IN PDEVICE_OBJECT DeviceObject, /* What kind of PDO is this? */ if (PdoType == AcpiPdo) { - /* PCI ID */ - Id = L"ACPI_HAL\\PNP0C08"; + /* ACPI ID */ + CurrentId = L"ACPI_HAL\\PNP0C08"; + RtlCopyMemory(Id, CurrentId, (wcslen(CurrentId) * sizeof(WCHAR)) + sizeof(UNICODE_NULL)); + Length += (wcslen(CurrentId) * sizeof(WCHAR)) + sizeof(UNICODE_NULL); + + CurrentId = L"*PNP0C08"; + RtlCopyMemory(&Id[wcslen(Id) + 1], CurrentId, (wcslen(CurrentId) * sizeof(WCHAR)) + sizeof(UNICODE_NULL)); + Length += (wcslen(CurrentId) * sizeof(WCHAR)) + sizeof(UNICODE_NULL); } else if (PdoType == WdPdo) { /* WatchDog ID */ - Id = L"ACPI_HAL\\PNP0C18"; + CurrentId = L"ACPI_HAL\\PNP0C18"; + RtlCopyMemory(Id, CurrentId, (wcslen(CurrentId) * sizeof(WCHAR)) + sizeof(UNICODE_NULL)); + Length += (wcslen(CurrentId) * sizeof(WCHAR)) + sizeof(UNICODE_NULL); + + CurrentId = L"*PNP0C18"; + RtlCopyMemory(&Id[wcslen(Id) + 1], CurrentId, (wcslen(CurrentId) * sizeof(WCHAR)) + sizeof(UNICODE_NULL)); + Length += (wcslen(CurrentId) * sizeof(WCHAR)) + sizeof(UNICODE_NULL); } else { /* Unknown */ return STATUS_NOT_SUPPORTED; } - - /* Static length */ - Length = 32; break; case BusQueryInstanceID: - - /* And our instance ID */ - Id = L"0"; - Length = sizeof(L"0") + sizeof(UNICODE_NULL); + + /* Instance ID */ + CurrentId = L"0"; + RtlCopyMemory(Id, CurrentId, (wcslen(CurrentId) * sizeof(WCHAR)) + sizeof(UNICODE_NULL)); + Length += (wcslen(CurrentId) * sizeof(WCHAR)) + sizeof(UNICODE_NULL); break; case BusQueryCompatibleIDs: @@ -510,6 +514,7 @@ HalpQueryIdPdo(IN PDEVICE_OBJECT DeviceObject, /* We don't support anything else */ return STATUS_NOT_SUPPORTED; } + /* Allocate the buffer */ Buffer = ExAllocatePoolWithTag(PagedPool, @@ -556,14 +561,12 @@ HalpQueryIdFdo(IN PDEVICE_OBJECT DeviceObject, /* This is our hardware ID */ Id = HalHardwareIdString; - Length = wcslen(HalHardwareIdString) + sizeof(UNICODE_NULL); break; case BusQueryInstanceID: /* And our instance ID */ Id = L"0"; - Length = sizeof(L"0") + sizeof(UNICODE_NULL); break; default: @@ -572,6 +575,9 @@ HalpQueryIdFdo(IN PDEVICE_OBJECT DeviceObject, return STATUS_NOT_SUPPORTED; } + /* Calculate the length */ + Length = (wcslen(Id) * sizeof(WCHAR)) + sizeof(UNICODE_NULL); + /* Allocate the buffer */ Buffer = ExAllocatePoolWithTag(PagedPool, Length + sizeof(UNICODE_NULL), @@ -812,7 +818,6 @@ HalpDispatchPower(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) { DbgPrint("HAL: PnP Driver Power!\n"); - while (TRUE); return STATUS_SUCCESS; } diff --git a/hal/halx86/generic/i386/systimer.S b/hal/halx86/generic/i386/systimer.S index 8534f88a204..7a24e90cf75 100644 --- a/hal/halx86/generic/i386/systimer.S +++ b/hal/halx86/generic/i386/systimer.S @@ -62,7 +62,7 @@ _HalpCalibrateStallExecution@0: sub esp, 12 /* Save EFLAGS and kill interrupts */ - pushf + pushfd cli /* Get the current interrupt mask on the PICs */ diff --git a/hal/halx86/generic/i386/trap.S b/hal/halx86/generic/i386/trap.S index 8a4f4538144..d0e1c6cf1b5 100644 --- a/hal/halx86/generic/i386/trap.S +++ b/hal/halx86/generic/i386/trap.S @@ -24,7 +24,7 @@ PUBLIC @HalpExitToV86@4 @HalpExitToV86@4: /* Point esp to the iret frame and return */ lea esp, [ecx + KTRAP_FRAME_EIP] - iret + iretd /* Here starts the real mode code */ .code16 diff --git a/hal/halx86/generic/legacy/bus/bushndlr.c b/hal/halx86/generic/legacy/bus/bushndlr.c index 2ab551c610e..31ea9d592dc 100644 --- a/hal/halx86/generic/legacy/bus/bushndlr.c +++ b/hal/halx86/generic/legacy/bus/bushndlr.c @@ -36,7 +36,7 @@ HalpAllocateArray(IN ULONG ArraySize) /* Allocate the array */ Array = ExAllocatePoolWithTag(NonPagedPool, Size, - 'BusH'); + TAG_BUS_HANDLER); if (!Array) KeBugCheckEx(HAL_MEMORY_ALLOCATION, Size, 0, (ULONG_PTR)__FILE__, __LINE__); /* Initialize it */ @@ -263,7 +263,7 @@ HaliRegisterBusHandler(IN INTERFACE_TYPE InterfaceType, /* Allocate the bus handler */ Bus = ExAllocatePoolWithTag(NonPagedPool, sizeof(HAL_BUS_HANDLER) + ExtraData, - 'HsuB'); + TAG_BUS_HANDLER); if (!Bus) return STATUS_INSUFFICIENT_RESOURCES; /* Return the handler */ @@ -404,11 +404,11 @@ HaliRegisterBusHandler(IN INTERFACE_TYPE InterfaceType, //MmUnlockPagableImageSection(CodeHandle); /* Free all allocations */ - if (Bus) ExFreePool(Bus); - if (InterfaceArray) ExFreePool(InterfaceArray); - if (InterfaceBusNumberArray) ExFreePool(InterfaceBusNumberArray); - if (ConfigArray) ExFreePool(ConfigArray); - if (ConfigBusNumberArray) ExFreePool(ConfigBusNumberArray); + if (Bus) ExFreePoolWithTag(Bus, TAG_BUS_HANDLER); + if (InterfaceArray) ExFreePoolWithTag(InterfaceArray, TAG_BUS_HANDLER); + if (InterfaceBusNumberArray) ExFreePoolWithTag(InterfaceBusNumberArray, TAG_BUS_HANDLER); + if (ConfigArray) ExFreePoolWithTag(ConfigArray, TAG_BUS_HANDLER); + if (ConfigBusNumberArray) ExFreePoolWithTag(ConfigBusNumberArray, TAG_BUS_HANDLER); /* And we're done */ return Status; diff --git a/hal/halx86/generic/legacy/bus/pcibus.c b/hal/halx86/generic/legacy/bus/pcibus.c index ddb05cacf43..a2485ac328b 100644 --- a/hal/halx86/generic/legacy/bus/pcibus.c +++ b/hal/halx86/generic/legacy/bus/pcibus.c @@ -572,7 +572,7 @@ HalpGetISAFixedPCIIrq(IN PBUS_HANDLER BusHandler, if (PciData.VendorID == PCI_INVALID_VENDORID) return STATUS_UNSUCCESSFUL; /* Allocate the supported range structure */ - *Range = ExAllocatePoolWithTag(PagedPool, sizeof(SUPPORTED_RANGE), 'Hal '); + *Range = ExAllocatePoolWithTag(PagedPool, sizeof(SUPPORTED_RANGE), TAG_HAL); if (!*Range) return STATUS_INSUFFICIENT_RESOURCES; /* Set it up */ @@ -766,7 +766,7 @@ HalpAssignPCISlotResources(IN PBUS_HANDLER BusHandler, PagedPool, sizeof(CM_RESOURCE_LIST) + (ResourceCount - 1) * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR), - ' laH'); + TAG_HAL); if (NULL == *AllocatedResources) return STATUS_NO_MEMORY; @@ -1015,7 +1015,7 @@ HalpQueryPciRegistryInfo(VOID) sizeof(PCI_REGISTRY_INFO_INTERNAL) + (KeyInformation.Values * sizeof(PCI_CARD_DESCRIPTOR)), - ' laH'); + TAG_HAL); if (PciRegistryInfo) { /* Get the first card descriptor entry */ @@ -1069,7 +1069,7 @@ HalpQueryPciRegistryInfo(VOID) /* Just allocate the basic structure then */ PciRegistryInfo = ExAllocatePoolWithTag(NonPagedPool, sizeof(PCI_REGISTRY_INFO_INTERNAL), - ' laH'); + TAG_HAL); if (!PciRegistryInfo) return NULL; } @@ -1119,7 +1119,7 @@ HalpInitializePciStubs(VOID) MaxPciBusNumber = PciRegistryInfo->NoBuses - 1; /* Free the info structure */ - ExFreePool(PciRegistryInfo); + ExFreePoolWithTag(PciRegistryInfo, TAG_HAL); } /* Initialize the PCI lock */ diff --git a/hal/halx86/generic/legacy/bussupp.c b/hal/halx86/generic/legacy/bussupp.c index 013b8564d79..76aca8c098a 100644 --- a/hal/halx86/generic/legacy/bussupp.c +++ b/hal/halx86/generic/legacy/bussupp.c @@ -1096,7 +1096,7 @@ HalpInitializePciBus(VOID) HalpGetNMICrashFlag(); /* Free the registry data */ - ExFreePool(PciRegistryInfo); + ExFreePoolWithTag(PciRegistryInfo, TAG_HAL); /* Tell PnP if this hard supports correct decoding */ HalpMarkChipsetDecode(ExtendedAddressDecoding); @@ -1256,7 +1256,7 @@ HaliTranslateBusAddress(IN INTERFACE_TYPE InterfaceType, Handler = HalReferenceHandlerForBus(InterfaceType, BusNumber); if (!(Handler) || !(Handler->TranslateBusAddress)) { - DPRINT1("No translator!\n"); + DPRINT1("No translator Interface: %x, Bus: %x, Handler: %x!\n", InterfaceType, BusNumber, Handler); return FALSE; } diff --git a/hal/halx86/generic/misc.c b/hal/halx86/generic/misc.c index 2ddd18599e1..41386b93e60 100644 --- a/hal/halx86/generic/misc.c +++ b/hal/halx86/generic/misc.c @@ -62,6 +62,7 @@ HalpMarkAcpiHal(VOID) UNICODE_STRING KeyString; HANDLE KeyHandle; HANDLE Handle; + ULONG Value = HalDisableFirmwareMapper ? 1 : 0; /* Open the control set key */ RtlInitUnicodeString(&KeyString, @@ -88,8 +89,8 @@ HalpMarkAcpiHal(VOID) &KeyString, 0, REG_DWORD, - &HalDisableFirmwareMapper, - sizeof(HalDisableFirmwareMapper)); + &Value, + sizeof(Value)); /* Close subkey */ ZwClose(KeyHandle); diff --git a/hal/halx86/generic/spinlock.c b/hal/halx86/generic/spinlock.c index 1aab8d5a314..c397bf09598 100644 --- a/hal/halx86/generic/spinlock.c +++ b/hal/halx86/generic/spinlock.c @@ -188,6 +188,10 @@ KeTryToAcquireQueuedSpinLockRaiseToSynch(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber, /* Simply raise to synch */ KeRaiseIrql(SYNCH_LEVEL, OldIrql); + /* Add an explicit memory barrier to prevent the compiler from reordering + memory accesses across the borders of spinlocks */ + KeMemoryBarrierWithoutFence(); + /* Always return true on UP Machines */ return TRUE; } @@ -208,6 +212,10 @@ KeTryToAcquireQueuedSpinLock(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber, /* Simply raise to dispatch */ KeRaiseIrql(DISPATCH_LEVEL, OldIrql); + /* Add an explicit memory barrier to prevent the compiler from reordering + memory accesses across the borders of spinlocks */ + KeMemoryBarrierWithoutFence(); + /* Always return true on UP Machines */ return TRUE; } diff --git a/hal/halx86/include/hal.h b/hal/halx86/include/hal.h index 33aaa83b763..124d716b95f 100644 --- a/hal/halx86/include/hal.h +++ b/hal/halx86/include/hal.h @@ -27,7 +27,13 @@ #include #include #include -#include + +#include +#include +#include +#include +#include +#include /* Internal shared PCI and ACPI header */ #include @@ -45,6 +51,9 @@ #include "internal/i386/intrin_i.h" #endif +#define TAG_HAL ' laH' +#define TAG_BUS_HANDLER 'BusH' + /* Internal HAL Headers */ #include "apic.h" #include "bus.h" diff --git a/hal/halx86/include/halp.h b/hal/halx86/include/halp.h index c7b921fb75c..6db35ab056d 100644 --- a/hal/halx86/include/halp.h +++ b/hal/halx86/include/halp.h @@ -11,8 +11,8 @@ #define PAGE_UNLOCKED_FUNCTION PLACE_IN_SECTION("pagepo") #else #define INIT_FUNCTION -#define PAGE_LOCKED_FUNCTION -#define PAGE_UNLOCKED_FUNCTION +#define PAGE_LOCKED_FUNCTION +#define PAGE_UNLOCKED_FUNCTION #endif #ifdef _MSC_VER @@ -158,7 +158,7 @@ typedef enum _TIMER_CHANNELS typedef union _TIMER_CONTROL_PORT_REGISTER { - struct + struct { UCHAR BcdMode:1; TIMER_OPERATING_MODES OperatingMode:3; @@ -178,7 +178,7 @@ typedef union _TIMER_CONTROL_PORT_REGISTER #define SYSTEM_CONTROL_PORT_B 0x61 typedef union _SYSTEM_CONTROL_PORT_B_REGISTER { - struct + struct { UCHAR Timer2GateToSpeaker:1; UCHAR SpeakerDataEnable:1; @@ -269,12 +269,12 @@ typedef enum _I8259_EOI_MODE // typedef union _I8259_ICW1 { - struct + struct { UCHAR NeedIcw4:1; - I8259_ICW1_OPERATING_MODE OperatingMode:1; - I8259_ICW1_INTERVAL Interval:1; - I8259_ICW1_INTERRUPT_MODE InterruptMode:1; + UCHAR OperatingMode:1; + UCHAR Interval:1; + UCHAR InterruptMode:1; UCHAR Init:1; UCHAR InterruptVectorAddress:3; }; @@ -283,7 +283,7 @@ typedef union _I8259_ICW1 typedef union _I8259_ICW2 { - struct + struct { UCHAR Sbz:3; UCHAR InterruptVector:5; @@ -295,7 +295,7 @@ typedef union _I8259_ICW3 { union { - struct + struct { UCHAR SlaveIrq0:1; UCHAR SlaveIrq1:1; @@ -306,7 +306,7 @@ typedef union _I8259_ICW3 UCHAR SlaveIrq6:1; UCHAR SlaveIrq7:1; }; - struct + struct { UCHAR SlaveId:3; UCHAR Reserved:5; @@ -317,11 +317,11 @@ typedef union _I8259_ICW3 typedef union _I8259_ICW4 { - struct + struct { - I8259_ICW4_SYSTEM_MODE SystemMode:1; - I8259_ICW4_EOI_MODE EoiMode:1; - I8259_ICW4_BUFFERED_MODE BufferedMode:2; + UCHAR SystemMode:1; + UCHAR EoiMode:1; + UCHAR BufferedMode:2; UCHAR SpecialFullyNestedMode:1; UCHAR Reserved:3; }; @@ -334,7 +334,7 @@ typedef union _I8259_OCW2 { UCHAR IrqNumber:3; UCHAR Sbz:2; - I8259_EOI_MODE EoiMode:3; + UCHAR EoiMode:3; }; UCHAR Bits; } I8259_OCW2, *PI8259_OCW2; @@ -343,7 +343,7 @@ typedef union _I8259_OCW3 { struct { - I8259_READ_REQUEST ReadRequest:2; + UCHAR ReadRequest:2; UCHAR PollCommand:1; UCHAR Sbo:1; UCHAR Sbz:1; @@ -423,7 +423,7 @@ typedef struct _PIC_MASK UCHAR Slave; }; USHORT Both; - }; + }; } PIC_MASK, *PPIC_MASK; typedef @@ -527,7 +527,7 @@ HalpHardwareInterruptLevel( // #define HalAddressToPde(x) (PHARDWARE_PTE)MiAddressToPde(x) #define HalAddressToPte(x) (PHARDWARE_PTE)MiAddressToPte(x) - + typedef struct _IDTUsageFlags { UCHAR Flags; @@ -740,7 +740,7 @@ HalpAllocPhysicalMemory( IN ULONG PageCount, IN BOOLEAN Aligned ); - + PVOID NTAPI HalpMapPhysicalMemory64( @@ -748,13 +748,13 @@ HalpMapPhysicalMemory64( IN ULONG PageCount ); -NTSTATUS +NTSTATUS NTAPI HalpOpenRegistryKey( IN PHANDLE KeyHandle, IN HANDLE RootKey, IN PUNICODE_STRING KeyName, - IN ACCESS_MASK DesiredAccess, + IN ACCESS_MASK DesiredAccess, IN BOOLEAN Create ); diff --git a/importlibs/libcoldname.a b/importlibs/libcoldname.a new file mode 100644 index 00000000000..2a0f7cf0277 Binary files /dev/null and b/importlibs/libcoldname.a differ diff --git a/importlibs/oldnames.lib b/importlibs/oldnames.lib new file mode 100644 index 00000000000..00ffabe14d0 Binary files /dev/null and b/importlibs/oldnames.lib differ diff --git a/include/asm/CMakeLists.txt b/include/asm/CMakeLists.txt index 32f70eb9393..3de03de2817 100644 --- a/include/asm/CMakeLists.txt +++ b/include/asm/CMakeLists.txt @@ -16,10 +16,12 @@ elseif(ARCH MATCHES amd64) set(_filename ksamd64) endif() +get_target_property(genincdata_dll genincdata LOCATION) + add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_filename}.inc - COMMAND native-geninc ${CMAKE_CURRENT_BINARY_DIR}/genincdata.dll ${CMAKE_CURRENT_BINARY_DIR}/${_filename}.inc ${OPT_MS} - DEPENDS genincdata) + COMMAND native-geninc ${genincdata_dll} ${CMAKE_CURRENT_BINARY_DIR}/${_filename}.inc ${OPT_MS} + DEPENDS genincdata native-geninc) add_custom_target(asm DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_filename}.inc) diff --git a/include/asm/asm.inc b/include/asm/asm.inc index be640020053..db0acdb525e 100644 --- a/include/asm/asm.inc +++ b/include/asm/asm.inc @@ -32,30 +32,37 @@ rip = 0 /* To avoid reverse syntax we provide a new macro .PROC, replacing PROC... */ .PROC MACRO name - name PROC FRAME - _name: + _&name PROC ENDM +#define FUNC .PROC /* ... and .ENDP, replacing ENDP */ .ENDP MACRO name - name ENDP + _&name ENDP +ENDM +#define ENDFUNC .ENDP + +/* check http://msdn.microsoft.com/en-us/library/9c9k076y%28VS.80%29.aspx + and http://msdn.microsoft.com/en-us/library/ms679352%28VS.85%29.aspx */ +FPO MACRO cdwLocals, cdwParams, cbProlog, cbRegs, fUseBP, cbFrame + .FPO (cdwLocals, cdwParams, cbProlog, cbRegs, fUseBP, cbFrame) ENDM /* MASM doesn't have an ASCII macro */ -.ASCII MACRO text +.ASCII MACRO text:VARARG + DB text +ENDM +.ascii MACRO text:VARARG DB text ENDM /* MASM doesn't have an ASCIZ macro */ -.ASCIZ MACRO text - DB text, 0 +.ASCIZ MACRO text:VARARG + DB text + DB 0 ENDM - -#define lgdt lgdt fword ptr ds: - -#define lidt lidt fword ptr ds: - -ljmp MACRO segment, offset +.asciz MACRO text:VARARG + DB text DB 0 ENDM @@ -70,11 +77,12 @@ ENDM .code16 MACRO ASSUME nothing - .text16 SEGMENT use16 + .text SEGMENT use16 + .586P ENDM .endcode16 MACRO - .text16 ENDS + .text ENDS ENDM .bss MACRO @@ -115,13 +123,12 @@ ENDM .fill MACRO count, size, value REPEAT count - if (size == 1) + if (size EQ 1) DB value - elseif (size == 2) + elseif (size EQ 2) DW value - elseif (size == 4) + elseif (size EQ 4) DD value - else endif ENDM ENDM @@ -145,9 +152,23 @@ ENDM UNIMPLEMENTED MACRO name ENDM +absolute MACRO address + __absolute__address__ = address +ENDM + +resb MACRO name, size + name = __absolute__address__ + __absolute__address__ = __absolute__address__ + size +ENDM + + /* We need this to distinguish repeat from macros */ #define ENDR ENDM +#define CR 13 +#define LF 10 +#define NUL 0 + #else /***********************************************************************/ /* Force intel syntax */ @@ -168,7 +189,7 @@ ENDM /* To avoid reverse syntax we provide a new macro .PROC, replacing PROC... */ .macro .PROC name .func \name - \name: + _\name: .cfi_startproc .equ cfa_current_offset, -8 .endm @@ -221,6 +242,12 @@ ENDM .text .endm +/* check http://msdn.microsoft.com/en-us/library/9c9k076y%28VS.80%29.aspx + and http://msdn.microsoft.com/en-us/library/ms679352%28VS.85%29.aspx */ +.macro FPO cdwLocals, cdwParams, cbProlog, cbRegs, fUseBP, cbFrame + /* dummy */ +.endm + /* Macros for x64 stack unwind OPs */ .macro .allocstack size @@ -263,6 +290,15 @@ code = 1 .macro .endprolog .endm +.macro absolute address + __absolute__address__ = \address +ENDM + +.macro resb name, size + \name = __absolute__address__ + __absolute__address__ = __absolute__address__ + \size +ENDM + .macro UNIMPLEMENTED2 file, line, func jmp 3f @@ -286,4 +322,15 @@ code = 1 #define else .else #define elseif .elseif +#define CR "\r" +#define LF "\n" +#define NUL "\0" + #endif + +/* Common definitions for FPO macro + see http://msdn.microsoft.com/en-us/library/ms679352%28VS.85%29.aspx */ +#define FRAME_FPO 0 +#define FRAME_TRAP 1 +#define FRAME_TSS 2 +#define FRAME_NONFPO 3 diff --git a/include/asm/syscalls.inc b/include/asm/syscalls.inc index 260ab129461..85ef7a447a7 100644 --- a/include/asm/syscalls.inc +++ b/include/asm/syscalls.inc @@ -11,7 +11,7 @@ ENDM MACRO(STUBCODE_K, SyscallId, StackBytes) mov eax, SyscallId lea edx, [esp + 4] - pushf + pushfd push KGDT_R0_CODE call _KiSystemService ret StackBytes @@ -71,24 +71,42 @@ MACRO(MAKE_LABEL, Name, Stackbytes) PUBLIC _&Name&@&Stackbytes _&Name&@&Stackbytes: ENDM +MACRO(START_PROC, Name, Stackbytes) + PUBLIC _&Name&@&Stackbytes + .PROC &Name&@&Stackbytes + FPO 0, 0, 0, 0, 0, FRAME_FPO +ENDM +MACRO(END_PROC, Name, Stackbytes) + .ENDP &Name&@&Stackbytes +ENDM #else MACRO(MAKE_LABEL, Name, Stackbytes) PUBLIC &Name &Name: ENDM +MACRO(START_PROC, Name, Stackbytes) + PUBLIC &Name + .PROC &Name + FPO 0, 0, 0, 0, 0, FRAME_FPO +ENDM +MACRO(END_PROC, Name, Stackbytes) + .ENDP &Name +ENDM #endif MACRO(STUB_U, Name, ArgCount) Stackbytes = 4 * &ArgCount MAKE_LABEL Zw&Name, %Stackbytes - MAKE_LABEL Nt&Name, %Stackbytes + START_PROC Nt&Name, %Stackbytes STUBCODE_U SyscallId, %Stackbytes + END_PROC Nt&Name, %Stackbytes SyscallId = SyscallId + 1 ENDM MACRO(STUB_K, Name, ArgCount) Stackbytes = 4 * &ArgCount - MAKE_LABEL Zw&Name, %Stackbytes + START_PROC Zw&Name, %Stackbytes STUBCODE_K SyscallId, %Stackbytes + END_PROC Zw&Name, %Stackbytes SyscallId = SyscallId + 1 ENDM diff --git a/include/crt/crtdefs.h b/include/crt/crtdefs.h index 832769e12d4..e43972ec9aa 100644 --- a/include/crt/crtdefs.h +++ b/include/crt/crtdefs.h @@ -52,7 +52,7 @@ #ifndef _CRTIMP #ifdef CRTDLL /* Defined for ntdll, crtdll, msvcrt, etc */ - #define _CRTIMP __declspec(dllexport) + #define _CRTIMP #elif defined(_DLL) #define _CRTIMP __declspec(dllimport) #else /* !CRTDLL && !_DLL */ diff --git a/include/crt/excpt.h b/include/crt/excpt.h index d0d3ef077de..456e20c3cde 100644 --- a/include/crt/excpt.h +++ b/include/crt/excpt.h @@ -44,18 +44,17 @@ typedef enum _EXCEPTION_DISPOSITION _CRTIMP EXCEPTION_DISPOSITION __cdecl __C_specific_handler (struct _EXCEPTION_RECORD *_ExceptionRecord,void *_EstablisherFrame,struct _CONTEXT *_ContextRecord,struct _DISPATCHER_CONTEXT *_DispatcherContext); #endif -#ifdef _MSC_VER // HACK!!! +#ifdef _MSC_VER #define GetExceptionCode _exception_code #define exception_code _exception_code #define GetExceptionInformation (struct _EXCEPTION_POINTERS *)_exception_info #define exception_info (struct _EXCEPTION_POINTERS *)_exception_info #define AbnormalTermination _abnormal_termination #define abnormal_termination _abnormal_termination -#endif - unsigned long __cdecl _exception_code(void); void *__cdecl _exception_info(void); int __cdecl _abnormal_termination(void); +#endif #define EXCEPTION_EXECUTE_HANDLER 1 #define EXCEPTION_CONTINUE_SEARCH 0 diff --git a/include/crt/mingw32/intrin_x86.h b/include/crt/mingw32/intrin_x86.h index a92f2b307ef..36c1005e2bb 100644 --- a/include/crt/mingw32/intrin_x86.h +++ b/include/crt/mingw32/intrin_x86.h @@ -81,24 +81,6 @@ extern "C" { /*** Memory barriers ***/ -#ifdef _x86_64 -__INTRIN_INLINE void __faststorefence(void) -{ - long local; - __asm__ __volatile__("lock; orl $0, %0;" : : "m"(local)); -} -#endif - -__INTRIN_INLINE void _mm_lfence(void) -{ - __asm__ __volatile__("lfence"); -} - -__INTRIN_INLINE void _mm_sfence(void) -{ - __asm__ __volatile__("sfence"); -} - __INTRIN_INLINE void _ReadWriteBarrier(void) { __asm__ __volatile__("" : : : "memory"); @@ -108,6 +90,34 @@ __INTRIN_INLINE void _ReadWriteBarrier(void) #define _ReadBarrier _ReadWriteBarrier #define _WriteBarrier _ReadWriteBarrier +__INTRIN_INLINE void _mm_mfence(void) +{ + __asm__ __volatile__("mfence" : : : "memory"); +} + +__INTRIN_INLINE void _mm_lfence(void) +{ + _ReadBarrier(); + __asm__ __volatile__("lfence"); + _ReadBarrier(); +} + +__INTRIN_INLINE void _mm_sfence(void) +{ + _WriteBarrier(); + __asm__ __volatile__("sfence"); + _WriteBarrier(); +} + +#ifdef _x86_64 +__INTRIN_INLINE void __faststorefence(void) +{ + long local; + __asm__ __volatile__("lock; orl $0, %0;" : : "m"(local)); +} +#endif + + /*** Atomic operations ***/ #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) > 40100 @@ -911,7 +921,7 @@ __INTRIN_INLINE unsigned int _rotr(unsigned int value, int shift) __INTRIN_INLINE unsigned char _rotr8(unsigned char value, unsigned char shift) { unsigned char retval; - __asm__("rorb %b[shift], %b[retval]" : [retval] "=rm" (retval) : "[retval]" (value), [shift] "Nc" (shift)); + __asm__("rorb %b[shift], %b[retval]" : [retval] "=qm" (retval) : "[retval]" (value), [shift] "Nc" (shift)); return retval; } @@ -1438,7 +1448,7 @@ __INTRIN_INLINE void __writedr(unsigned reg, unsigned int value) __INTRIN_INLINE void __invlpg(void * const Address) { - __asm__("invlpg %[Address]" : : [Address] "m" (*((unsigned char *)(Address)))); + __asm__("invlpg %[Address]" : : [Address] "m" (*((unsigned char *)(Address))) : "memory"); } @@ -1482,7 +1492,7 @@ __INTRIN_INLINE unsigned long __segmentlimit(const unsigned long a) __INTRIN_INLINE void __wbinvd(void) { - __asm__ __volatile__("wbinvd"); + __asm__ __volatile__("wbinvd" : : : "memory"); } __INTRIN_INLINE void __lidt(void *Source) @@ -1497,7 +1507,7 @@ __INTRIN_INLINE void __sidt(void *Destination) __INTRIN_INLINE void _mm_pause(void) { - __asm__ __volatile__("pause"); + __asm__ __volatile__("pause" : : : "memory"); } #ifdef __cplusplus diff --git a/include/crt/msc/intrin.h b/include/crt/msc/intrin.h index ed53695d093..85e9b4216c6 100644 --- a/include/crt/msc/intrin.h +++ b/include/crt/msc/intrin.h @@ -13,14 +13,25 @@ void * _AddressOfReturnAddress(void); unsigned int __getcallerseflags(void); #pragma intrinsic(__getcallerseflags) -/*** Atomic operations ***/ +/*** Memory barriers ***/ void _ReadWriteBarrier(void); #pragma intrinsic(_ReadWriteBarrier) void _ReadBarrier(void); #pragma intrinsic(_ReadBarrier) void _WriteBarrier(void); #pragma intrinsic(_WriteBarrier) +void _mm_mfence(void); +#pragma intrinsic(_mm_mfence) +void _mm_lfence(void); +#pragma intrinsic(_mm_lfence) +void _mm_sfence(void); +#pragma intrinsic(_mm_sfence) +#ifdef _M_AMD64 +void __faststorefence(void); +#pragma intrinsic(__faststorefence) +#endif +/*** Atomic operations ***/ long _InterlockedCompareExchange(volatile long * const Destination, const long Exchange, const long Comperand); #pragma intrinsic(_InterlockedCompareExchange) long _InterlockedExchange(volatile long * const Target, const long Value); @@ -297,6 +308,25 @@ void __writedr(unsigned reg, unsigned int value); void __invlpg(void * const Address); #pragma intrinsic(__invlpg) +#ifdef _M_IX86 +// This intrinsic is broken and generates wrong opcodes, +// when optimization is enabled! +#pragma warning(push) +#pragma warning(disable:4711) +void __forceinline __invlpg_fixed(void * const Address) +{ + _ReadWriteBarrier(); + __asm + { + mov eax, Address + invlpg [eax] + } + _ReadWriteBarrier(); +} +#pragma warning(pop) +#define __invlpg __invlpg_fixed +#endif + /*** System operations ***/ unsigned __int64 __readmsr(const int reg); #pragma intrinsic(__readmsr) diff --git a/include/ddk/msports.h b/include/ddk/msports.h index fdaf2def9d9..02b812e0e64 100644 --- a/include/ddk/msports.h +++ b/include/ddk/msports.h @@ -9,9 +9,19 @@ DECLARE_HANDLE(HCOMDB); typedef HCOMDB *PHCOMDB; #define HCOMDB_INVALID_HANDLE_VALUE ((HCOMDB)INVALID_HANDLE_VALUE) +/* Limits for ComDBResizeDatabase NewSize */ #define COMDB_MIN_PORTS_ARBITRATED 256 #define COMDB_MAX_PORTS_ARBITRATED 4096 +/* ReportType flags for ComDBGetCurrentPortUsage */ +#define CDB_REPORT_BITS 0x0 +#define CDB_REPORT_BYTES 0x1 + +LONG +WINAPI +ComDBClaimNextFreePort(IN HCOMDB hComDB, + OUT LPDWORD ComNumber); + LONG WINAPI ComDBClaimPort(IN HCOMDB hComDB, @@ -28,7 +38,7 @@ WINAPI ComDBGetCurrentPortUsage(IN HCOMDB hComDB, OUT PBYTE Buffer, IN DWORD BufferSize, - IN ULONG ReportType, + IN DWORD ReportType, OUT LPDWORD MaxPortsReported); LONG diff --git a/include/ddk/ntddk.h b/include/ddk/ntddk.h index be27ea014af..ef36b07e91d 100644 --- a/include/ddk/ntddk.h +++ b/include/ddk/ntddk.h @@ -2690,26 +2690,30 @@ typedef enum _RTL_GENERIC_COMPARE_RESULTS { struct _RTL_AVL_TABLE; typedef RTL_GENERIC_COMPARE_RESULTS -(NTAPI *PRTL_AVL_COMPARE_ROUTINE) ( +(NTAPI RTL_AVL_COMPARE_ROUTINE) ( IN struct _RTL_AVL_TABLE *Table, IN PVOID FirstStruct, IN PVOID SecondStruct); +typedef RTL_AVL_COMPARE_ROUTINE *PRTL_AVL_COMPARE_ROUTINE; typedef PVOID -(NTAPI *PRTL_AVL_ALLOCATE_ROUTINE) ( +(NTAPI RTL_AVL_ALLOCATE_ROUTINE) ( IN struct _RTL_AVL_TABLE *Table, IN CLONG ByteSize); +typedef RTL_AVL_ALLOCATE_ROUTINE *PRTL_AVL_ALLOCATE_ROUTINE; typedef VOID -(NTAPI *PRTL_AVL_FREE_ROUTINE) ( +(NTAPI RTL_AVL_FREE_ROUTINE) ( IN struct _RTL_AVL_TABLE *Table, IN PVOID Buffer); +typedef RTL_AVL_FREE_ROUTINE *PRTL_AVL_FREE_ROUTINE; typedef NTSTATUS -(NTAPI *PRTL_AVL_MATCH_FUNCTION) ( +(NTAPI RTL_AVL_MATCH_FUNCTION) ( IN struct _RTL_AVL_TABLE *Table, IN PVOID UserData, IN PVOID MatchData); +typedef RTL_AVL_MATCH_FUNCTION *PRTL_AVL_MATCH_FUNCTION; typedef struct _RTL_BALANCED_LINKS { struct _RTL_BALANCED_LINKS *Parent; @@ -2733,32 +2737,35 @@ typedef struct _RTL_AVL_TABLE { PVOID TableContext; } RTL_AVL_TABLE, *PRTL_AVL_TABLE; -#ifndef RTL_USE_AVL_TABLES - -struct _RTL_GENERIC_TABLE; - -typedef RTL_GENERIC_COMPARE_RESULTS -(NTAPI *PRTL_GENERIC_COMPARE_ROUTINE) ( - IN struct _RTL_GENERIC_TABLE *Table, - IN PVOID FirstStruct, - IN PVOID SecondStruct); - -typedef PVOID -(NTAPI *PRTL_GENERIC_ALLOCATE_ROUTINE) ( - IN struct _RTL_GENERIC_TABLE *Table, - IN CLONG ByteSize); - -typedef VOID -(NTAPI *PRTL_GENERIC_FREE_ROUTINE) ( - IN struct _RTL_GENERIC_TABLE *Table, - IN PVOID Buffer); - typedef struct _RTL_SPLAY_LINKS { struct _RTL_SPLAY_LINKS *Parent; struct _RTL_SPLAY_LINKS *LeftChild; struct _RTL_SPLAY_LINKS *RightChild; } RTL_SPLAY_LINKS, *PRTL_SPLAY_LINKS; +#ifndef RTL_USE_AVL_TABLES + +struct _RTL_GENERIC_TABLE; + +typedef RTL_GENERIC_COMPARE_RESULTS +(NTAPI RTL_GENERIC_COMPARE_ROUTINE) ( + IN struct _RTL_GENERIC_TABLE *Table, + IN PVOID FirstStruct, + IN PVOID SecondStruct); +typedef RTL_GENERIC_COMPARE_ROUTINE *PRTL_GENERIC_COMPARE_ROUTINE; + +typedef PVOID +(NTAPI RTL_GENERIC_ALLOCATE_ROUTINE) ( + IN struct _RTL_GENERIC_TABLE *Table, + IN CLONG ByteSize); +typedef RTL_GENERIC_ALLOCATE_ROUTINE *PRTL_GENERIC_ALLOCATE_ROUTINE; + +typedef VOID +(NTAPI RTL_GENERIC_FREE_ROUTINE) ( + IN struct _RTL_GENERIC_TABLE *Table, + IN PVOID Buffer); +typedef RTL_GENERIC_FREE_ROUTINE *PRTL_GENERIC_FREE_ROUTINE; + typedef struct _RTL_GENERIC_TABLE { PRTL_SPLAY_LINKS TableRoot; LIST_ENTRY InsertOrderList; @@ -2775,23 +2782,23 @@ typedef struct _RTL_GENERIC_TABLE { #ifdef RTL_USE_AVL_TABLES +#undef RTL_GENERIC_COMPARE_ROUTINE #undef PRTL_GENERIC_COMPARE_ROUTINE -#undef RTL_GENERIC_COMPARE_ROUTINE +#undef RTL_GENERIC_ALLOCATE_ROUTINE #undef PRTL_GENERIC_ALLOCATE_ROUTINE -#undef RTL_GENERIC_ALLOCATE_ROUTINE +#undef RTL_GENERIC_FREE_ROUTINE #undef PRTL_GENERIC_FREE_ROUTINE -#undef RTL_GENERIC_FREE_ROUTINE -#undef RTL_GENERIC_TABLE +#undef RTL_GENERIC_TABLE #undef PRTL_GENERIC_TABLE -#define PRTL_GENERIC_COMPARE_ROUTINE PRTL_AVL_COMPARE_ROUTINE -#define RTL_GENERIC_COMPARE_ROUTINE RTL_AVL_COMPARE_ROUTINE -#define PRTL_GENERIC_ALLOCATE_ROUTINE PRTL_AVL_ALLOCATE_ROUTINE -#define RTL_GENERIC_ALLOCATE_ROUTINE RTL_AVL_ALLOCATE_ROUTINE -#define PRTL_GENERIC_FREE_ROUTINE PRTL_AVL_FREE_ROUTINE -#define RTL_GENERIC_FREE_ROUTINE RTL_AVL_FREE_ROUTINE -#define RTL_GENERIC_TABLE RTL_AVL_TABLE -#define PRTL_GENERIC_TABLE PRTL_AVL_TABLE +#define RTL_GENERIC_COMPARE_ROUTINE RTL_AVL_COMPARE_ROUTINE +#define PRTL_GENERIC_COMPARE_ROUTINE PRTL_AVL_COMPARE_ROUTINE +#define RTL_GENERIC_ALLOCATE_ROUTINE RTL_AVL_ALLOCATE_ROUTINE +#define PRTL_GENERIC_ALLOCATE_ROUTINE PRTL_AVL_ALLOCATE_ROUTINE +#define RTL_GENERIC_FREE_ROUTINE RTL_AVL_FREE_ROUTINE +#define PRTL_GENERIC_FREE_ROUTINE PRTL_AVL_FREE_ROUTINE +#define RTL_GENERIC_TABLE RTL_AVL_TABLE +#define PRTL_GENERIC_TABLE PRTL_AVL_TABLE #endif /* RTL_USE_AVL_TABLES */ @@ -5600,8 +5607,8 @@ NTSTATUS NTAPI ZwDisplayString( IN PUNICODE_STRING String); - -NTSYSAPI + +NTSYSCALLAPI NTSTATUS NTAPI ZwPowerInformation( diff --git a/include/ddk/ntifs.h b/include/ddk/ntifs.h index a82cd79053a..3bf4a1c25c5 100644 --- a/include/ddk/ntifs.h +++ b/include/ddk/ntifs.h @@ -7344,7 +7344,7 @@ FsRtlAddBaseMcbEntry( IN LONGLONG SectorCount); NTKERNELAPI -VOID +BOOLEAN NTAPI FsRtlRemoveBaseMcbEntry( IN PBASE_MCB Mcb, @@ -9615,7 +9615,7 @@ ZwFlushBuffersFile( #if (VER_PRODUCTBUILD >= 2195) -NTSYSAPI +NTSYSCALLAPI NTSTATUS NTAPI ZwInitiatePowerAction ( diff --git a/include/ddk/ntimage.h b/include/ddk/ntimage.h index 2dac14a3053..b512a71d7cf 100644 --- a/include/ddk/ntimage.h +++ b/include/ddk/ntimage.h @@ -419,6 +419,12 @@ typedef PIMAGE_NT_HEADERS32 PIMAGE_NT_HEADERS; #define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER 0x2000 #define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE 0x8000 +// +// Loader Flags +// +#define IMAGE_LOADER_FLAGS_COMPLUS 0x00000001 +#define IMAGE_LOADER_FLAGS_SYSTEM_GLOBAL 0x01000000 + // // Directory Entry Specifiers // diff --git a/include/ddk/srb.h b/include/ddk/srb.h index cddc8295e17..e4cefc1636e 100644 --- a/include/ddk/srb.h +++ b/include/ddk/srb.h @@ -883,7 +883,7 @@ VOID NTAPI ScsiPortWriteRegisterUchar( IN PUCHAR Register, - IN ULONG Value); + IN UCHAR Value); SCSIPORTAPI VOID diff --git a/include/ddk/wdm.h b/include/ddk/wdm.h index 842849fec08..18c1be79f02 100644 --- a/include/ddk/wdm.h +++ b/include/ddk/wdm.h @@ -170,7 +170,7 @@ typedef struct _DMA_ADAPTER *PADAPTER_OBJECT; #elif defined(_WDM_INCLUDED_) typedef struct _DMA_ADAPTER *PADAPTER_OBJECT; #else -typedef struct _ADAPTER_OBJECT *PADAPTER_OBJECT; +typedef struct _ADAPTER_OBJECT *PADAPTER_OBJECT; #endif #ifndef DEFINE_GUIDEX @@ -191,7 +191,7 @@ typedef struct _ADAPTER_OBJECT *PADAPTER_OBJECT; #ifdef __cplusplus inline int IsEqualGUIDAligned(REFGUID guid1, REFGUID guid2) { - return ( (*(PLONGLONG)(&guid1) == *(PLONGLONG)(&guid2)) && + return ( (*(PLONGLONG)(&guid1) == *(PLONGLONG)(&guid2)) && (*((PLONGLONG)(&guid1) + 1) == *((PLONGLONG)(&guid2) + 1)) ); } #else @@ -1204,11 +1204,12 @@ typedef enum _KSPIN_LOCK_QUEUE_NUMBER { #endif /* defined(_AMD64_) */ typedef VOID -(NTAPI *PKDEFERRED_ROUTINE)( +(NTAPI KDEFERRED_ROUTINE)( IN struct _KDPC *Dpc, IN PVOID DeferredContext OPTIONAL, IN PVOID SystemArgument1 OPTIONAL, IN PVOID SystemArgument2 OPTIONAL); +typedef KDEFERRED_ROUTINE *PKDEFERRED_ROUTINE; typedef enum _KDPC_IMPORTANCE { LowImportance, @@ -7718,6 +7719,8 @@ KeMemoryBarrier(VOID) #endif } +#define KeMemoryBarrierWithoutFence() _ReadWriteBarrier() + NTHALAPI KIRQL NTAPI @@ -7875,6 +7878,21 @@ typedef XSAVE_FORMAT XMM_SAVE_AREA32, *PXMM_SAVE_AREA32; #define KeGetDcacheFillSize() 1L #define YieldProcessor _mm_pause +#define FastFence __faststorefence +#define LoadFence _mm_lfence +#define MemoryFence _mm_mfence +#define StoreFence _mm_sfence +#define LFENCE_ACQUIRE() LoadFence() + +FORCEINLINE +VOID +KeMemoryBarrier(VOID) +{ + FastFence(); + LFENCE_ACQUIRE(); +} + +#define KeMemoryBarrierWithoutFence() _ReadWriteBarrier() FORCEINLINE KIRQL @@ -13290,14 +13308,14 @@ ExInterlockedFlushSList( #if defined(_WIN2K_COMPAT_SLIST_USAGE) && defined(_X86_) NTKERNELAPI -PSINGLE_LIST_ENTRY +PSINGLE_LIST_ENTRY FASTCALL ExInterlockedPopEntrySList( IN PSLIST_HEADER ListHead, IN PKSPIN_LOCK Lock); NTKERNELAPI -PSINGLE_LIST_ENTRY +PSINGLE_LIST_ENTRY FASTCALL ExInterlockedPushEntrySList( IN PSLIST_HEADER ListHead, diff --git a/include/dxsdk/CMakeLists.txt b/include/dxsdk/CMakeLists.txt index 98789cdc56a..9a842b81c13 100644 --- a/include/dxsdk/CMakeLists.txt +++ b/include/dxsdk/CMakeLists.txt @@ -1,4 +1,6 @@ +include_directories(${REACTOS_SOURCE_DIR}/include/psdk) + list(APPEND SOURCE amstream.idl amvideo.idl diff --git a/include/host/config.h b/include/host/config.h index 0a30629b42c..6c4180fdede 100644 --- a/include/host/config.h +++ b/include/host/config.h @@ -1,8 +1,6 @@ /* include/config.h. Generated by configure. */ /* include/config.h.in. Generated from configure.ac by autoheader. */ -#include "reactos/buildno.h" - #define __WINE_CONFIG_H #define HAVE_SPAWNVP 1 @@ -125,7 +123,7 @@ #define PACKAGE_TARNAME "ReactOS" /* Define to the version of this package. */ -#define PACKAGE_VERSION KERNEL_VERSION_STR +#define PACKAGE_VERSION "" /* Define to the full name and version of this package. */ #define PACKAGE_STRING PACKAGE_NAME " " PACKAGE_VERSION diff --git a/include/host/nls.h b/include/host/nls.h index d9f79136c74..837651a9568 100644 --- a/include/host/nls.h +++ b/include/host/nls.h @@ -9,7 +9,7 @@ #ifndef _HOST_NLS_H #define _HOST_NLS_H -#include +#include typedef DWORD LCID; @@ -20,118 +20,393 @@ typedef DWORD LCID; #define CP_UTF8 65001 -#define LANG_AFRIKAANS 0x36 -#define LANG_ALBANIAN 0x1c -#define LANG_ARABIC 0x01 -#define LANG_ARMENIAN 0x2b -#define LANG_ASSAMESE 0x4d -#define LANG_AZERI 0x2c -#define LANG_BASQUE 0x2d -#define LANG_BELARUSIAN 0x23 -#define LANG_BENGALI 0x45 -#define LANG_BULGARIAN 0x02 -#define LANG_CATALAN 0x03 -#define LANG_CHINESE 0x04 -#define LANG_CROATIAN 0x1a -#define LANG_CZECH 0x05 -#define LANG_DANISH 0x06 -#define LANG_DIVEHI 0x65 -#define LANG_DUTCH 0x13 -#define LANG_ENGLISH 0x09 -#define LANG_ESTONIAN 0x25 -#define LANG_FAEROESE 0x38 -#define LANG_FARSI 0x29 -#define LANG_FINNISH 0x0b -#define LANG_FRENCH 0x0c -#define LANG_GALICIAN 0x56 -#define LANG_GEORGIAN 0x37 -#define LANG_GERMAN 0x07 -#define LANG_GREEK 0x08 -#define LANG_GUJARATI 0x47 -#define LANG_HEBREW 0x0d -#define LANG_HINDI 0x39 -#define LANG_HUNGARIAN 0x0e -#define LANG_ICELANDIC 0x0f -#define LANG_INDONESIAN 0x21 -#define LANG_IRISH 0x3c -#define LANG_ITALIAN 0x10 -#define LANG_JAPANESE 0x11 -#define LANG_KANNADA 0x4b -#define LANG_KASHMIRI 0x60 -#define LANG_KAZAK 0x3f -#define LANG_KONKANI 0x57 -#define LANG_KOREAN 0x12 -#define LANG_KYRGYZ 0x40 -#define LANG_LATVIAN 0x26 -#define LANG_LITHUANIAN 0x27 -#define LANG_MACEDONIAN 0x2f -#define LANG_MANIPURI 0x58 -#define LANG_MALAY 0x3e -#define LANG_MALAYALAM 0x4c -#define LANG_MARATHI 0x4e -#define LANG_MONGOLIAN 0x50 -#define LANG_NEPALI 0x61 -#define LANG_NEUTRAL 0x00 -#define LANG_NORWEGIAN 0x14 -#define LANG_ORIYA 0x48 -#define LANG_POLISH 0x15 -#define LANG_PORTUGUESE 0x16 -#define LANG_PUNJABI 0x46 -#define LANG_ROMANIAN 0x18 -#define LANG_ROMANSH 0x17 -#define LANG_RUSSIAN 0x19 -#define LANG_SAMI 0x3b -#define LANG_SANSKRIT 0x4f -#define LANG_SERBIAN 0x1a -#define LANG_SINDHI 0x59 -#define LANG_SLOVAK 0x1b -#define LANG_SLOVENIAN 0x24 -#define LANG_SPANISH 0x0a -#define LANG_SWAHILI 0x41 -#define LANG_SWEDISH 0x1d -#define LANG_SYRIAC 0x5a -#define LANG_TAJIK 0x28 -#define LANG_TAMIL 0x49 -#define LANG_TATAR 0x44 -#define LANG_TELUGU 0x4a -#define LANG_THAI 0x1e -#define LANG_TURKISH 0x1f -#define LANG_UKRAINIAN 0x22 -#define LANG_URDU 0x20 -#define LANG_UZBEK 0x43 -#define LANG_VIETNAMESE 0x2a +#define LANG_NEUTRAL 0x00 +#define LANG_INVARIANT 0x7f + +#define LANG_AFRIKAANS 0x36 +#define LANG_ALBANIAN 0x1c +#define LANG_ALSATIAN 0x84 +#define LANG_AMHARIC 0x5e +#define LANG_ARABIC 0x01 +#define LANG_ARMENIAN 0x2b +#define LANG_ASSAMESE 0x4d +#define LANG_AZERI 0x2c +#define LANG_BASHKIR 0x6d +#define LANG_BASQUE 0x2d +#define LANG_BELARUSIAN 0x23 +#define LANG_BENGALI 0x45 +#define LANG_BOSNIAN 0x1a +#define LANG_BOSNIAN_NEUTRAL 0x781a +#define LANG_BRETON 0x7e +#define LANG_BULGARIAN 0x02 +#define LANG_CATALAN 0x03 +#define LANG_CHINESE 0x04 +#define LANG_CHINESE_SIMPLIFIED 0x0004 +#define LANG_CHINESE_TRADITIONAL 0x7c04 +#define LANG_CORSICAN 0x83 +#define LANG_CROATIAN 0x1a +#define LANG_CZECH 0x05 +#define LANG_DANISH 0x06 +#define LANG_DARI 0x8c +#define LANG_DIVEHI 0x65 +#define LANG_DUTCH 0x13 +#define LANG_ENGLISH 0x09 +#define LANG_ESTONIAN 0x25 +#define LANG_FAEROESE 0x38 +#define LANG_FARSI LANG_PERSIAN +#define LANG_FILIPINO 0x64 +#define LANG_FINNISH 0x0b +#define LANG_FRENCH 0x0c +#define LANG_FRISIAN 0x62 +#define LANG_GALICIAN 0x56 +#define LANG_GEORGIAN 0x37 +#define LANG_GERMAN 0x07 +#define LANG_GREEK 0x08 +#define LANG_GREENLANDIC 0x6f +#define LANG_GUJARATI 0x47 +#define LANG_HAUSA 0x68 +#define LANG_HEBREW 0x0d +#define LANG_HINDI 0x39 +#define LANG_HUNGARIAN 0x0e +#define LANG_ICELANDIC 0x0f +#define LANG_IGBO 0x70 +#define LANG_INDONESIAN 0x21 +#define LANG_INUKTITUT 0x5d +#define LANG_IRISH 0x3c +#define LANG_ITALIAN 0x10 +#define LANG_JAPANESE 0x11 +#define LANG_KANNADA 0x4b +#define LANG_KASHMIRI 0x60 +#define LANG_KAZAK 0x3f +#define LANG_KHMER 0x53 +#define LANG_KICHE 0x86 +#define LANG_KINYARWANDA 0x87 +#define LANG_KONKANI 0x57 +#define LANG_KOREAN 0x12 +#define LANG_KYRGYZ 0x40 +#define LANG_LAO 0x54 +#define LANG_LATVIAN 0x26 +#define LANG_LITHUANIAN 0x27 +#define LANG_LOWER_SORBIAN 0x2e +#define LANG_LUXEMBOURGISH 0x6e +#define LANG_MACEDONIAN 0x2f +#define LANG_MALAY 0x3e +#define LANG_MALAYALAM 0x4c +#define LANG_MALTESE 0x3a +#define LANG_MANIPURI 0x58 +#define LANG_MAORI 0x81 +#define LANG_MAPUDUNGUN 0x7a +#define LANG_MARATHI 0x4e +#define LANG_MOHAWK 0x7c +#define LANG_MONGOLIAN 0x50 +#define LANG_NEPALI 0x61 +#define LANG_NORWEGIAN 0x14 +#define LANG_OCCITAN 0x82 +#define LANG_ORIYA 0x48 +#define LANG_PASHTO 0x63 +#define LANG_PERSIAN 0x29 +#define LANG_POLISH 0x15 +#define LANG_PORTUGUESE 0x16 +#define LANG_PUNJABI 0x46 +#define LANG_QUECHUA 0x6b +#define LANG_ROMANIAN 0x18 +#define LANG_ROMANSH 0x17 +#define LANG_RUSSIAN 0x19 +#define LANG_SAMI 0x3b +#define LANG_SANSKRIT 0x4f +#define LANG_SERBIAN 0x1a +#define LANG_SERBIAN_NEUTRAL 0x7c1a +#define LANG_SINDHI 0x59 +#define LANG_SINHALESE 0x5b +#define LANG_SLOVAK 0x1b +#define LANG_SLOVENIAN 0x24 +#define LANG_SOTHO 0x6c +#define LANG_SPANISH 0x0a +#define LANG_SWAHILI 0x41 +#define LANG_SWEDISH 0x1d +#define LANG_SYRIAC 0x5a +#define LANG_TAJIK 0x28 +#define LANG_TAMAZIGHT 0x5f +#define LANG_TAMIL 0x49 +#define LANG_TATAR 0x44 +#define LANG_TELUGU 0x4a +#define LANG_THAI 0x1e +#define LANG_TIBETAN 0x51 +#define LANG_TIGRIGNA 0x73 +#define LANG_TSWANA 0x32 +#define LANG_TURKISH 0x1f +#define LANG_TURKMEN 0x42 +#define LANG_UIGHUR 0x80 +#define LANG_UKRAINIAN 0x22 +#define LANG_UPPER_SORBIAN 0x2e +#define LANG_URDU 0x20 +#define LANG_UZBEK 0x43 +#define LANG_VIETNAMESE 0x2a +#define LANG_WELSH 0x52 +#define LANG_WOLOF 0x88 +#define LANG_XHOSA 0x34 +#define LANG_YAKUT 0x85 +#define LANG_YI 0x78 +#define LANG_YORUBA 0x6a +#define LANG_ZULU 0x35 + +/* These are documented by the MSDN but are missing from the Windows header */ +#define LANG_MALAGASY 0x8d + +/* FIXME: these are not defined anywhere */ +#define LANG_SUTU 0x30 +#define LANG_TSONGA 0x31 +#define LANG_VENDA 0x33 /* non standard; keep the number high enough (but < 0xff) */ -#define LANG_ESPERANTO 0x8f -#define LANG_WALON 0x90 -#define LANG_CORNISH 0x91 -#define LANG_WELSH 0x92 -#define LANG_BRETON 0x93 +#define LANG_ESPERANTO 0x8f +#define LANG_WALON 0x90 +#define LANG_CORNISH 0x91 +#define LANG_GAELIC 0x94 -/* FIXME: these are not in the Windows header */ -#define LANG_GAELIC 0x94 -#define LANG_MALTESE 0x3a -#define LANG_RHAETO_ROMANCE 0x17 -#define LANG_SAAMI 0x3b -#define LANG_SORBIAN 0x2e -#define LANG_LOWER_SORBIAN 0x2e -#define LANG_UPPER_SORBIAN 0x2e -#define LANG_SUTU 0x30 -#define LANG_TSONGA 0x31 -#define LANG_TSWANA 0x32 -#define LANG_VENDA 0x33 -#define LANG_XHOSA 0x34 -#define LANG_ZULU 0x35 +/* Sublanguage definitions */ +#define SUBLANG_NEUTRAL 0x00 /* language neutral */ +#define SUBLANG_DEFAULT 0x01 /* user default */ +#define SUBLANG_SYS_DEFAULT 0x02 /* system default */ +#define SUBLANG_CUSTOM_DEFAULT 0x03 +#define SUBLANG_CUSTOM_UNSPECIFIED 0x04 +#define SUBLANG_UI_CUSTOM_DEFAULT 0x05 -/* Sublanguages */ -#define SUBLANG_AZERI_CYRILLIC 0x02 -#define SUBLANG_CHINESE_SINGAPORE 0x04 -#define SUBLANG_CHINESE_SIMPLIFIED 0x02 -#define SUBLANG_DEFAULT 0x01 -#define SUBLANG_NEUTRAL 0x00 -#define SUBLANG_NORWEGIAN_NYNORSK 0x02 -#define SUBLANG_SERBIAN_CYRILLIC 0x03 -#define SUBLANG_UZBEK_CYRILLIC 0x02 -#define SUBLANG_ENGLISH_US 0x01 +#define SUBLANG_AFRIKAANS_SOUTH_AFRICA 0x01 +#define SUBLANG_ALBANIAN_ALBANIA 0x01 +#define SUBLANG_ALSATIAN_FRANCE 0x01 +#define SUBLANG_AMHARIC_ETHIOPIA 0x01 +#define SUBLANG_ARABIC_SAUDI_ARABIA 0x01 +#define SUBLANG_ARABIC_IRAQ 0x02 +#define SUBLANG_ARABIC_EGYPT 0x03 +#define SUBLANG_ARABIC_LIBYA 0x04 +#define SUBLANG_ARABIC_ALGERIA 0x05 +#define SUBLANG_ARABIC_MOROCCO 0x06 +#define SUBLANG_ARABIC_TUNISIA 0x07 +#define SUBLANG_ARABIC_OMAN 0x08 +#define SUBLANG_ARABIC_YEMEN 0x09 +#define SUBLANG_ARABIC_SYRIA 0x0a +#define SUBLANG_ARABIC_JORDAN 0x0b +#define SUBLANG_ARABIC_LEBANON 0x0c +#define SUBLANG_ARABIC_KUWAIT 0x0d +#define SUBLANG_ARABIC_UAE 0x0e +#define SUBLANG_ARABIC_BAHRAIN 0x0f +#define SUBLANG_ARABIC_QATAR 0x10 +#define SUBLANG_ARMENIAN_ARMENIA 0x01 +#define SUBLANG_ASSAMESE_INDIA 0x01 +#define SUBLANG_AZERI_LATIN 0x01 +#define SUBLANG_AZERI_CYRILLIC 0x02 +#define SUBLANG_BASHKIR_RUSSIA 0x01 +#define SUBLANG_BASQUE_BASQUE 0x01 +#define SUBLANG_BELARUSIAN_BELARUS 0x01 +#define SUBLANG_BENGALI_INDIA 0x01 +#define SUBLANG_BENGALI_BANGLADESH 0x02 +#define SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_LATIN 0x05 +#define SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_CYRILLIC 0x08 +#define SUBLANG_BRETON_FRANCE 0x01 +#define SUBLANG_BULGARIAN_BULGARIA 0x01 +#define SUBLANG_CATALAN_CATALAN 0x01 +#define SUBLANG_CHINESE_TRADITIONAL 0x01 +#define SUBLANG_CHINESE_SIMPLIFIED 0x02 +#define SUBLANG_CHINESE_HONGKONG 0x03 +#define SUBLANG_CHINESE_SINGAPORE 0x04 +#define SUBLANG_CHINESE_MACAU 0x05 +#define SUBLANG_CORSICAN_FRANCE 0x01 +#define SUBLANG_CROATIAN_CROATIA 0x01 +#define SUBLANG_CROATIAN_BOSNIA_HERZEGOVINA_LATIN 0x04 +#define SUBLANG_CZECH_CZECH_REPUBLIC 0x01 +#define SUBLANG_DANISH_DENMARK 0x01 +#define SUBLANG_DARI_AFGHANISTAN 0x01 +#define SUBLANG_DIVEHI_MALDIVES 0x01 +#define SUBLANG_DUTCH 0x01 +#define SUBLANG_DUTCH_BELGIAN 0x02 +#define SUBLANG_ENGLISH_US 0x01 +#define SUBLANG_ENGLISH_UK 0x02 +#define SUBLANG_ENGLISH_AUS 0x03 +#define SUBLANG_ENGLISH_CAN 0x04 +#define SUBLANG_ENGLISH_NZ 0x05 +#define SUBLANG_ENGLISH_EIRE 0x06 +#define SUBLANG_ENGLISH_SOUTH_AFRICA 0x07 +#define SUBLANG_ENGLISH_JAMAICA 0x08 +#define SUBLANG_ENGLISH_CARIBBEAN 0x09 +#define SUBLANG_ENGLISH_BELIZE 0x0a +#define SUBLANG_ENGLISH_TRINIDAD 0x0b +#define SUBLANG_ENGLISH_ZIMBABWE 0x0c +#define SUBLANG_ENGLISH_PHILIPPINES 0x0d +#define SUBLANG_ENGLISH_INDIA 0x10 +#define SUBLANG_ENGLISH_MALAYSIA 0x11 +#define SUBLANG_ENGLISH_SINGAPORE 0x12 +#define SUBLANG_ESTONIAN_ESTONIA 0x01 +#define SUBLANG_FAEROESE_FAROE_ISLANDS 0x01 +#define SUBLANG_FILIPINO_PHILIPPINES 0x01 +#define SUBLANG_FINNISH_FINLAND 0x01 +#define SUBLANG_FRENCH 0x01 +#define SUBLANG_FRENCH_BELGIAN 0x02 +#define SUBLANG_FRENCH_CANADIAN 0x03 +#define SUBLANG_FRENCH_SWISS 0x04 +#define SUBLANG_FRENCH_LUXEMBOURG 0x05 +#define SUBLANG_FRENCH_MONACO 0x06 +#define SUBLANG_FRISIAN_NETHERLANDS 0x01 +#define SUBLANG_GALICIAN_GALICIAN 0x01 +#define SUBLANG_GEORGIAN_GEORGIA 0x01 +#define SUBLANG_GERMAN 0x01 +#define SUBLANG_GERMAN_SWISS 0x02 +#define SUBLANG_GERMAN_AUSTRIAN 0x03 +#define SUBLANG_GERMAN_LUXEMBOURG 0x04 +#define SUBLANG_GERMAN_LIECHTENSTEIN 0x05 +#define SUBLANG_GREEK_GREECE 0x01 +#define SUBLANG_GREENLANDIC_GREENLAND 0x01 +#define SUBLANG_GUJARATI_INDIA 0x01 +#define SUBLANG_HAUSA_NIGERIA_LATIN 0x01 +#define SUBLANG_HEBREW_ISRAEL 0x01 +#define SUBLANG_HINDI_INDIA 0x01 +#define SUBLANG_HUNGARIAN_HUNGARY 0x01 +#define SUBLANG_ICELANDIC_ICELAND 0x01 +#define SUBLANG_IGBO_NIGERIA 0x01 +#define SUBLANG_INDONESIAN_INDONESIA 0x01 +#define SUBLANG_INUKTITUT_CANADA 0x01 +#define SUBLANG_INUKTITUT_CANADA_LATIN 0x02 +#define SUBLANG_IRISH_IRELAND 0x02 +#define SUBLANG_ITALIAN 0x01 +#define SUBLANG_ITALIAN_SWISS 0x02 +#define SUBLANG_JAPANESE_JAPAN 0x01 +#define SUBLANG_KANNADA_INDIA 0x01 +#define SUBLANG_KASHMIRI_SASIA 0x02 +#define SUBLANG_KASHMIRI_INDIA 0x02 +#define SUBLANG_KAZAK_KAZAKHSTAN 0x01 +#define SUBLANG_KHMER_CAMBODIA 0x01 +#define SUBLANG_KICHE_GUATEMALA 0x01 +#define SUBLANG_KINYARWANDA_RWANDA 0X01 +#define SUBLANG_KONKANI_INDIA 0x01 +#define SUBLANG_KOREAN 0x01 +#define SUBLANG_KYRGYZ_KYRGYZSTAN 0x01 +#define SUBLANG_LAO_LAO 0x01 +#define SUBLANG_LATVIAN_LATVIA 0x01 +#define SUBLANG_LITHUANIAN_LITHUANIA 0x01 +#define SUBLANG_LOWER_SORBIAN_GERMANY 0x02 +#define SUBLANG_LUXEMBOURGISH_LUXEMBOURG 0x01 +#define SUBLANG_MACEDONIAN_MACEDONIA 0x01 +#define SUBLANG_MALAY_MALAYSIA 0x01 +#define SUBLANG_MALAY_BRUNEI_DARUSSALAM 0x02 +#define SUBLANG_MALAYALAM_INDIA 0x01 +#define SUBLANG_MALTESE_MALTA 0x01 +#define SUBLANG_MAORI_NEW_ZEALAND 0x01 +#define SUBLANG_MAPUDUNGUN_CHILE 0x01 +#define SUBLANG_MARATHI_INDIA 0x01 +#define SUBLANG_MOHAWK_MOHAWK 0x01 +#define SUBLANG_MONGOLIAN_CYRILLIC_MONGOLIA 0x01 +#define SUBLANG_MONGOLIAN_PRC 0x02 +#define SUBLANG_NEPALI_INDIA 0x02 +#define SUBLANG_NEPALI_NEPAL 0x01 +#define SUBLANG_NORWEGIAN_BOKMAL 0x01 +#define SUBLANG_NORWEGIAN_NYNORSK 0x02 +#define SUBLANG_OCCITAN_FRANCE 0x01 +#define SUBLANG_ORIYA_INDIA 0x01 +#define SUBLANG_PASHTO_AFGHANISTAN 0x01 +#define SUBLANG_PERSIAN_IRAN 0x01 +#define SUBLANG_POLISH_POLAND 0x01 +#define SUBLANG_PORTUGUESE 0x02 +#define SUBLANG_PORTUGUESE_BRAZILIAN 0x01 +#define SUBLANG_PUNJABI_INDIA 0x01 +#define SUBLANG_QUECHUA_BOLIVIA 0x01 +#define SUBLANG_QUECHUA_ECUADOR 0x02 +#define SUBLANG_QUECHUA_PERU 0x03 +#define SUBLANG_ROMANIAN_ROMANIA 0x01 +#define SUBLANG_ROMANSH_SWITZERLAND 0x01 +#define SUBLANG_RUSSIAN_RUSSIA 0x01 +#define SUBLANG_SAMI_NORTHERN_NORWAY 0x01 +#define SUBLANG_SAMI_NORTHERN_SWEDEN 0x02 +#define SUBLANG_SAMI_NORTHERN_FINLAND 0x03 +#define SUBLANG_SAMI_LULE_NORWAY 0x04 +#define SUBLANG_SAMI_LULE_SWEDEN 0x05 +#define SUBLANG_SAMI_SOUTHERN_NORWAY 0x06 +#define SUBLANG_SAMI_SOUTHERN_SWEDEN 0x07 +#define SUBLANG_SAMI_SKOLT_FINLAND 0x08 +#define SUBLANG_SAMI_INARI_FINLAND 0x09 +#define SUBLANG_SANSKRIT_INDIA 0x01 +#define SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_LATIN 0x06 +#define SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_CYRILLIC 0x07 +#define SUBLANG_SERBIAN_CROATIA 0x01 +#define SUBLANG_SERBIAN_LATIN 0x02 +#define SUBLANG_SERBIAN_CYRILLIC 0x03 +#define SUBLANG_SINDHI_AFGHANISTAN 0x02 +#define SUBLANG_SINHALESE_SRI_LANKA 0x01 +#define SUBLANG_SLOVAK_SLOVAKIA 0x01 +#define SUBLANG_SLOVENIAN_SLOVENIA 0x01 +#define SUBLANG_SOTHO_NORTHERN_SOUTH_AFRICA 0x01 +#define SUBLANG_SPANISH 0x01 +#define SUBLANG_SPANISH_MEXICAN 0x02 +#define SUBLANG_SPANISH_MODERN 0x03 +#define SUBLANG_SPANISH_GUATEMALA 0x04 +#define SUBLANG_SPANISH_COSTA_RICA 0x05 +#define SUBLANG_SPANISH_PANAMA 0x06 +#define SUBLANG_SPANISH_DOMINICAN_REPUBLIC 0x07 +#define SUBLANG_SPANISH_VENEZUELA 0x08 +#define SUBLANG_SPANISH_COLOMBIA 0x09 +#define SUBLANG_SPANISH_PERU 0x0a +#define SUBLANG_SPANISH_ARGENTINA 0x0b +#define SUBLANG_SPANISH_ECUADOR 0x0c +#define SUBLANG_SPANISH_CHILE 0x0d +#define SUBLANG_SPANISH_URUGUAY 0x0e +#define SUBLANG_SPANISH_PARAGUAY 0x0f +#define SUBLANG_SPANISH_BOLIVIA 0x10 +#define SUBLANG_SPANISH_EL_SALVADOR 0x11 +#define SUBLANG_SPANISH_HONDURAS 0x12 +#define SUBLANG_SPANISH_NICARAGUA 0x13 +#define SUBLANG_SPANISH_PUERTO_RICO 0x14 +#define SUBLANG_SPANISH_US 0x15 +#define SUBLANG_SWAHILI_KENYA 0x01 +#define SUBLANG_SWEDISH 0x01 +#define SUBLANG_SWEDISH_FINLAND 0x02 +#define SUBLANG_SYRIAC_SYRIA 0x01 +#define SUBLANG_TAJIK_TAJIKISTAN 0x01 +#define SUBLANG_TAMAZIGHT_ALGERIA_LATIN 0x02 +#define SUBLANG_TAMIL_INDIA 0x01 +#define SUBLANG_TATAR_RUSSIA 0x01 +#define SUBLANG_TELUGU_INDIA 0x01 +#define SUBLANG_THAI_THAILAND 0x01 +#define SUBLANG_TIBETAN_PRC 0x01 +#define SUBLANG_TIBETAN_BHUTAN 0x02 +#define SUBLANG_TIGRIGNA_ERITREA 0x02 +#define SUBLANG_TSWANA_SOUTH_AFRICA 0x01 +#define SUBLANG_TURKISH_TURKEY 0x01 +#define SUBLANG_TURKMEN_TURKMENISTAN 0x01 +#define SUBLANG_UIGHUR_PRC 0x01 +#define SUBLANG_UKRAINIAN_UKRAINE 0x01 +#define SUBLANG_UPPER_SORBIAN_GERMANY 0x01 +#define SUBLANG_URDU_PAKISTAN 0x01 +#define SUBLANG_URDU_INDIA 0x02 +#define SUBLANG_UZBEK_LATIN 0x01 +#define SUBLANG_UZBEK_CYRILLIC 0x02 +#define SUBLANG_VIETNAMESE_VIETNAM 0x01 +#define SUBLANG_WELSH_UNITED_KINGDOM 0x01 +#define SUBLANG_WOLOF_SENEGAL 0x01 +#define SUBLANG_XHOSA_SOUTH_AFRICA 0x01 +#define SUBLANG_YAKUT_RUSSIA 0x01 +#define SUBLANG_YI_PRC 0x01 +#define SUBLANG_YORUBA_NIGERIA 0x01 +#define SUBLANG_ZULU_SOUTH_AFRICA 0x01 + +/* These are documented by the MSDN but are missing from the Windows header */ +#define SUBLANG_ENGLISH_IRELAND SUBLANG_ENGLISH_EIRE +#define SUBLANG_HAUSA_NIGERIA SUBLANG_HAUSA_NIGERIA_LATIN +#define SUBLANG_LAO_LAO_PDR SUBLANG_LAO_LAO +#define SUBLANG_LITHUANIAN SUBLANG_LITHUANIAN_LITHUANIA +#define SUBLANG_PORTUGUESE_PORTUGAL SUBLANG_PORTUGUESE +#define SUBLANG_SWAHILI SUBLANG_SWAHILI_KENYA +#define SUBLANG_SWEDISH_SWEDEN SUBLANG_SWEDISH +#define SUBLANG_SYRIAC SUBLANG_SYRIAC_SYRIA + +/* FIXME: these are not defined anywhere */ +#define SUBLANG_DUTCH_SURINAM 0x03 +#define SUBLANG_ROMANIAN SUBLANG_ROMANIAN_ROMANIA +#define SUBLANG_ROMANIAN_MOLDAVIA 0x02 +#define SUBLANG_RUSSIAN SUBLANG_RUSSIAN_RUSSIA +#define SUBLANG_RUSSIAN_MOLDAVIA 0x02 +#define SUBLANG_CROATIAN SUBLANG_CROATIAN_CROATIA +#define SUBLANG_LITHUANIAN_CLASSIC 0x02 +#define SUBLANG_GAELIC 0x01 +#define SUBLANG_GAELIC_SCOTTISH 0x02 +#define SUBLANG_GAELIC_MANX 0x03 #endif diff --git a/include/host/typedefs.h b/include/host/typedefs.h index 07146c48220..6bbe25f8633 100644 --- a/include/host/typedefs.h +++ b/include/host/typedefs.h @@ -70,7 +70,7 @@ typedef WORD LANGID; #define MAXUSHORT USHRT_MAX /* Widely used structures */ -#include +#include typedef struct _RTL_BITMAP { ULONG SizeOfBitMap; @@ -112,7 +112,7 @@ typedef struct _UNICODE_STRING USHORT MaximumLength; PWSTR Buffer; } UNICODE_STRING, *PUNICODE_STRING; -#include +#include /* List Functions */ static __inline @@ -170,7 +170,7 @@ RemoveEntryList( { PLIST_ENTRY OldFlink; PLIST_ENTRY OldBlink; - + OldFlink = Entry->Flink; OldBlink = Entry->Blink; OldFlink->Blink = OldBlink; @@ -185,7 +185,7 @@ RemoveHeadList( { PLIST_ENTRY Flink; PLIST_ENTRY Entry; - + Entry = ListHead->Flink; Flink = Entry->Flink; ListHead->Flink = Flink; @@ -200,7 +200,7 @@ RemoveTailList( { PLIST_ENTRY Blink; PLIST_ENTRY Entry; - + Entry = ListHead->Blink; Blink = Entry->Blink; ListHead->Blink = Blink; diff --git a/include/host/wcsfuncs.h b/include/host/wcsfuncs.h deleted file mode 100644 index c07679aa34a..00000000000 --- a/include/host/wcsfuncs.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - PROJECT: ReactOS - LICENSE: GPL v2 or any later version - FILE: include/host/wcsfuncs.h - PURPOSE: Header for the "host_wcsfuncs" static library - COPYRIGHT: Copyright 2008 Colin Finck -*/ - -#ifndef _HOST_WCSFUNCS_H -#define _HOST_WCSFUNCS_H - -#ifdef USE_HOST_WCSFUNCS - /* Function prototypes */ - -#else - /* Map str*W functions to wcs* function */ - - #define isspaceW iswspace - #define strchrW wcschr - #define strcmpiW _wcsicmp - #define strcpyW wcscpy - #define strlenW wcslen - #define strncmpW wcsncmp - #define strtolW wcstol - #define strtoulW wcstoul - -#endif - -#endif diff --git a/include/host/wine/unicode.h b/include/host/wine/unicode.h new file mode 100644 index 00000000000..f553f64a444 --- /dev/null +++ b/include/host/wine/unicode.h @@ -0,0 +1,325 @@ +/* + * Wine internal Unicode definitions + * + * Copyright 2000 Alexandre Julliard + * + * 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 __WINE_WINE_UNICODE_H +#define __WINE_WINE_UNICODE_H + +#include +#include +#include + +// Definitions copied from +// We only want to include host headers, so we define them manually +#define C1_UPPER 1 +#define C1_LOWER 2 +#define C1_DIGIT 4 +#define C1_SPACE 8 +#define C1_PUNCT 16 +#define C1_CNTRL 32 +#define C1_BLANK 64 +#define C1_XDIGIT 128 +#define C1_ALPHA 256 +#define MB_COMPOSITE 2 +#define MB_ERR_INVALID_CHARS 8 +#define MB_USEGLYPHCHARS 0x04 +#define WC_COMPOSITECHECK 512 +#define WC_DISCARDNS 16 +#define WC_DEFAULTCHAR 64 +#define WC_NO_BEST_FIT_CHARS 1024 +#define WC_ERR_INVALID_CHARS 0x0080 + +#ifdef __WINE_WINE_TEST_H +#error This file should not be used in Wine tests +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef WINE_UNICODE_API +#define WINE_UNICODE_API +#endif + +#ifndef WINE_UNICODE_INLINE +#define WINE_UNICODE_INLINE static inline +#endif + +/* code page info common to SBCS and DBCS */ +struct cp_info +{ + unsigned int codepage; /* codepage id */ + unsigned int char_size; /* char size (1 or 2 bytes) */ + WCHAR def_char; /* default char value (can be double-byte) */ + WCHAR def_unicode_char; /* default Unicode char value */ + const char *name; /* code page name */ +}; + +struct sbcs_table +{ + struct cp_info info; + const WCHAR *cp2uni; /* code page -> Unicode map */ + const WCHAR *cp2uni_glyphs; /* code page -> Unicode map with glyph chars */ + const unsigned char *uni2cp_low; /* Unicode -> code page map */ + const unsigned short *uni2cp_high; +}; + +struct dbcs_table +{ + struct cp_info info; + const WCHAR *cp2uni; /* code page -> Unicode map */ + const unsigned char *cp2uni_leadbytes; + const unsigned short *uni2cp_low; /* Unicode -> code page map */ + const unsigned short *uni2cp_high; + unsigned char lead_bytes[12]; /* lead bytes ranges */ +}; + +union cptable +{ + struct cp_info info; + struct sbcs_table sbcs; + struct dbcs_table dbcs; +}; + +extern const union cptable *wine_cp_get_table( unsigned int codepage ); +extern const union cptable *wine_cp_enum_table( unsigned int index ); + +extern int wine_cp_mbstowcs( const union cptable *table, int flags, + const char *src, int srclen, + WCHAR *dst, int dstlen ); +extern int wine_cp_wcstombs( const union cptable *table, int flags, + const WCHAR *src, int srclen, + char *dst, int dstlen, const char *defchar, int *used ); +extern int wine_cpsymbol_mbstowcs( const char *src, int srclen, WCHAR *dst, int dstlen ); +extern int wine_cpsymbol_wcstombs( const WCHAR *src, int srclen, char *dst, int dstlen ); +extern int wine_utf8_mbstowcs( int flags, const char *src, int srclen, WCHAR *dst, int dstlen ); +extern int wine_utf8_wcstombs( int flags, const WCHAR *src, int srclen, char *dst, int dstlen ); + +extern int wine_compare_string( int flags, const WCHAR *str1, int len1, const WCHAR *str2, int len2 ); +extern int wine_get_sortkey( int flags, const WCHAR *src, int srclen, char *dst, int dstlen ); +extern int wine_fold_string( int flags, const WCHAR *src, int srclen , WCHAR *dst, int dstlen ); + +extern int strcmpiW( const WCHAR *str1, const WCHAR *str2 ); +extern int strncmpiW( const WCHAR *str1, const WCHAR *str2, int n ); +extern int memicmpW( const WCHAR *str1, const WCHAR *str2, int n ); +extern WCHAR *strstrW( const WCHAR *str, const WCHAR *sub ); +extern long int strtolW( const WCHAR *nptr, WCHAR **endptr, int base ); +extern unsigned long int strtoulW( const WCHAR *nptr, WCHAR **endptr, int base ); +extern int sprintfW( WCHAR *str, const WCHAR *format, ... ); +extern int snprintfW( WCHAR *str, size_t len, const WCHAR *format, ... ); +extern int vsprintfW( WCHAR *str, const WCHAR *format, va_list valist ); +extern int vsnprintfW( WCHAR *str, size_t len, const WCHAR *format, va_list valist ); + +WINE_UNICODE_INLINE int wine_is_dbcs_leadbyte( const union cptable *table, unsigned char ch ) +{ + return (table->info.char_size == 2) && (table->dbcs.cp2uni_leadbytes[ch]); +} + +WINE_UNICODE_INLINE WCHAR tolowerW( WCHAR ch ) +{ + extern WINE_UNICODE_API const WCHAR wine_casemap_lower[]; + return ch + wine_casemap_lower[wine_casemap_lower[ch >> 8] + (ch & 0xff)]; +} + +WINE_UNICODE_INLINE WCHAR toupperW( WCHAR ch ) +{ + extern WINE_UNICODE_API const WCHAR wine_casemap_upper[]; + return ch + wine_casemap_upper[wine_casemap_upper[ch >> 8] + (ch & 0xff)]; +} + +/* the character type contains the C1_* flags in the low 12 bits */ +/* and the C2_* type in the high 4 bits */ +WINE_UNICODE_INLINE unsigned short get_char_typeW( WCHAR ch ) +{ + extern WINE_UNICODE_API const unsigned short wine_wctype_table[]; + return wine_wctype_table[wine_wctype_table[ch >> 8] + (ch & 0xff)]; +} + +WINE_UNICODE_INLINE int iscntrlW( WCHAR wc ) +{ + return get_char_typeW(wc) & C1_CNTRL; +} + +WINE_UNICODE_INLINE int ispunctW( WCHAR wc ) +{ + return get_char_typeW(wc) & C1_PUNCT; +} + +WINE_UNICODE_INLINE int isspaceW( WCHAR wc ) +{ + return get_char_typeW(wc) & C1_SPACE; +} + +WINE_UNICODE_INLINE int isdigitW( WCHAR wc ) +{ + return get_char_typeW(wc) & C1_DIGIT; +} + +WINE_UNICODE_INLINE int isxdigitW( WCHAR wc ) +{ + return get_char_typeW(wc) & C1_XDIGIT; +} + +WINE_UNICODE_INLINE int islowerW( WCHAR wc ) +{ + return get_char_typeW(wc) & C1_LOWER; +} + +WINE_UNICODE_INLINE int isupperW( WCHAR wc ) +{ + return get_char_typeW(wc) & C1_UPPER; +} + +WINE_UNICODE_INLINE int isalnumW( WCHAR wc ) +{ + return get_char_typeW(wc) & (C1_ALPHA|C1_DIGIT|C1_LOWER|C1_UPPER); +} + +WINE_UNICODE_INLINE int isalphaW( WCHAR wc ) +{ + return get_char_typeW(wc) & (C1_ALPHA|C1_LOWER|C1_UPPER); +} + +WINE_UNICODE_INLINE int isgraphW( WCHAR wc ) +{ + return get_char_typeW(wc) & (C1_ALPHA|C1_PUNCT|C1_DIGIT|C1_LOWER|C1_UPPER); +} + +WINE_UNICODE_INLINE int isprintW( WCHAR wc ) +{ + return get_char_typeW(wc) & (C1_ALPHA|C1_BLANK|C1_PUNCT|C1_DIGIT|C1_LOWER|C1_UPPER); +} + +/* some useful string manipulation routines */ + +WINE_UNICODE_INLINE unsigned int strlenW( const WCHAR *str ) +{ + const WCHAR *s = str; + while (*s) s++; + return (unsigned int)(s - str); +} + +WINE_UNICODE_INLINE WCHAR *strcpyW( WCHAR *dst, const WCHAR *src ) +{ + WCHAR *p = dst; + while ((*p++ = *src++)); + return dst; +} + +/* strncpy doesn't do what you think, don't use it */ +#define strncpyW(d,s,n) error do_not_use_strncpyW_use_lstrcpynW_or_memcpy_instead + +WINE_UNICODE_INLINE int strcmpW( const WCHAR *str1, const WCHAR *str2 ) +{ + while (*str1 && (*str1 == *str2)) { str1++; str2++; } + return *str1 - *str2; +} + +WINE_UNICODE_INLINE int strncmpW( const WCHAR *str1, const WCHAR *str2, int n ) +{ + if (n <= 0) return 0; + while ((--n > 0) && *str1 && (*str1 == *str2)) { str1++; str2++; } + return *str1 - *str2; +} + +WINE_UNICODE_INLINE WCHAR *strcatW( WCHAR *dst, const WCHAR *src ) +{ + strcpyW( dst + strlenW(dst), src ); + return dst; +} + +WINE_UNICODE_INLINE WCHAR *strchrW( const WCHAR *str, WCHAR ch ) +{ + do { if (*str == ch) return (WCHAR *)(ULONG_PTR)str; } while (*str++); + return NULL; +} + +WINE_UNICODE_INLINE WCHAR *strrchrW( const WCHAR *str, WCHAR ch ) +{ + WCHAR *ret = NULL; + do { if (*str == ch) ret = (WCHAR *)(ULONG_PTR)str; } while (*str++); + return ret; +} + +WINE_UNICODE_INLINE WCHAR *strpbrkW( const WCHAR *str, const WCHAR *accept ) +{ + for ( ; *str; str++) if (strchrW( accept, *str )) return (WCHAR *)(ULONG_PTR)str; + return NULL; +} + +WINE_UNICODE_INLINE size_t strspnW( const WCHAR *str, const WCHAR *accept ) +{ + const WCHAR *ptr; + for (ptr = str; *ptr; ptr++) if (!strchrW( accept, *ptr )) break; + return ptr - str; +} + +WINE_UNICODE_INLINE size_t strcspnW( const WCHAR *str, const WCHAR *reject ) +{ + const WCHAR *ptr; + for (ptr = str; *ptr; ptr++) if (strchrW( reject, *ptr )) break; + return ptr - str; +} + +WINE_UNICODE_INLINE WCHAR *strlwrW( WCHAR *str ) +{ + WCHAR *ret = str; + while ((*str = tolowerW(*str))) str++; + return ret; +} + +WINE_UNICODE_INLINE WCHAR *struprW( WCHAR *str ) +{ + WCHAR *ret = str; + while ((*str = toupperW(*str))) str++; + return ret; +} + +WINE_UNICODE_INLINE WCHAR *memchrW( const WCHAR *ptr, WCHAR ch, size_t n ) +{ + const WCHAR *end; + for (end = ptr + n; ptr < end; ptr++) if (*ptr == ch) return (WCHAR *)(ULONG_PTR)ptr; + return NULL; +} + +WINE_UNICODE_INLINE WCHAR *memrchrW( const WCHAR *ptr, WCHAR ch, size_t n ) +{ + const WCHAR *end; + WCHAR *ret = NULL; + for (end = ptr + n; ptr < end; ptr++) if (*ptr == ch) ret = (WCHAR *)(ULONG_PTR)ptr; + return ret; +} + +WINE_UNICODE_INLINE long int atolW( const WCHAR *str ) +{ + return strtolW( str, (WCHAR **)0, 10 ); +} + +WINE_UNICODE_INLINE int atoiW( const WCHAR *str ) +{ + return (int)atolW( str ); +} + +#undef WINE_UNICODE_INLINE + +#ifdef __cplusplus +} +#endif + +#endif /* __WINE_WINE_UNICODE_H */ diff --git a/include/host/wine/wpp.h b/include/host/wine/wpp.h index 10b71e0c785..2d284f154f0 100644 --- a/include/host/wine/wpp.h +++ b/include/host/wine/wpp.h @@ -22,15 +22,41 @@ #define __WINE_WPP_H #include +#include -extern void wpp_add_define( const char *name, const char *value ); +struct wpp_callbacks +{ + /* I/O callbacks */ + + /* Looks for a file to include, returning the path where it is found */ + /* parent_name is the directory of the parent source file (for local + * includes), includepath is an array of additional include paths */ + char *(*lookup)( const char *filename, const char *parent_name, + char **include_path, int include_path_count ); + /* Opens an include file */ + /* The type param is true if it is a local ("...") include */ + void *(*open)( const char *filename, int type ); + /* Closes a previously opened file */ + void (*close)( void *file ); + /* Reads buffer from the input */ + int (*read)( void *file, char *buffer, unsigned int len ); + /* Writes buffer to the output */ + void (*write)( const char *buffer, unsigned int len ); + + /* Error callbacks */ + void (*error)( const char *file, int line, int col, const char *near, const char *msg, va_list ap ); + void (*warning)( const char *file, int line, int col, const char *near, const char *msg, va_list ap ); +}; + +/* Return value == 0 means successful execution */ +extern int wpp_add_define( const char *name, const char *value ); extern void wpp_del_define( const char *name ); -extern void wpp_add_cmdline_define( const char *value ); +extern int wpp_add_cmdline_define( const char *value ); extern void wpp_set_debug( int lex_debug, int parser_debug, int msg_debug ); extern void wpp_set_pedantic( int on ); -extern void wpp_add_include_path( const char *path ); +extern int wpp_add_include_path( const char *path ); extern char *wpp_find_include( const char *name, const char *parent_name ); extern int wpp_parse( const char *input, FILE *output ); -extern int wpp_parse_temp( const char *input, const char *output_base, char **output_name ); +extern void wpp_set_callbacks( const struct wpp_callbacks *callbacks ); #endif /* __WINE_WPP_H */ diff --git a/include/ndk/amd64/ketypes.h b/include/ndk/amd64/ketypes.h index 9a9ee6f39cc..06f9f70fd73 100644 --- a/include/ndk/amd64/ketypes.h +++ b/include/ndk/amd64/ketypes.h @@ -945,6 +945,7 @@ typedef struct _KSWITCH_FRAME ULONG64 Return; } KSWITCH_FRAME, *PKSWITCH_FRAME; +#if 0 typedef struct _KTIMER_TABLE_ENTRY { ULONG_PTR Lock; @@ -957,6 +958,7 @@ typedef struct _KTIMER_TABLE KTIMER* TimerExpiry[64]; KTIMER_TABLE_ENTRY TimerEntries[256]; } KTIMER_TABLE, *PKTIMER_TABLE; +#endif // // Inline function to get current KPRCB diff --git a/include/ndk/cmtypes.h b/include/ndk/cmtypes.h index 36840f6a140..cff31f86f6b 100644 --- a/include/ndk/cmtypes.h +++ b/include/ndk/cmtypes.h @@ -110,6 +110,12 @@ typedef enum _CM_SHARE_DISPOSITION #define CM_RESOURCE_DMA_TYPE_B 0x0020 #define CM_RESOURCE_DMA_TYPE_F 0x0040 +// +// Interrupt Resource Descriptor Flags +// +#define CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE 0x0000 +#define CM_RESOURCE_INTERRUPT_LATCHED 0x0001 + // // NtInitializeRegistry Flags // diff --git a/include/ndk/exfuncs.h b/include/ndk/exfuncs.h index 0d40a3fd0d4..bca62309f97 100644 --- a/include/ndk/exfuncs.h +++ b/include/ndk/exfuncs.h @@ -114,30 +114,17 @@ ExEnumHandleTable( ); // -// Resource Functions +// HardError Functions // -PVOID +NTSTATUS NTAPI -ExEnterCriticalRegionAndAcquireResourceExclusive( - IN PERESOURCE Resource -); - -PVOID -NTAPI -ExEnterCriticalRegionAndAcquireResourceShared( - IN PERESOURCE Resource -); - -PVOID -NTAPI -ExEnterCriticalRegionAndAcquireSharedWaitForExclusive( - IN PERESOURCE Resource -); - -VOID -FASTCALL -ExReleaseResourceAndLeaveCriticalRegion( - IN PERESOURCE Resource +ExRaiseHardError( + IN NTSTATUS ErrorStatus, + IN ULONG NumberOfParameters, + IN ULONG UnicodeStringParameterMask, + IN PULONG_PTR Parameters, + IN ULONG ValidResponseOptions, + OUT PULONG Response ); #endif diff --git a/include/ndk/extypes.h b/include/ndk/extypes.h index 79669029b68..19dd221a074 100644 --- a/include/ndk/extypes.h +++ b/include/ndk/extypes.h @@ -175,7 +175,9 @@ typedef enum _HARDERROR_RESPONSE_OPTION OptionRetryCancel, OptionYesNo, OptionYesNoCancel, - OptionShutdownSystem + OptionShutdownSystem, + OptionOkNoWait, + OptionCancelTryContinue } HARDERROR_RESPONSE_OPTION, *PHARDERROR_RESPONSE_OPTION; typedef enum _HARDERROR_RESPONSE diff --git a/include/ndk/kefuncs.h b/include/ndk/kefuncs.h index 78f6b16dec9..4888006a86e 100644 --- a/include/ndk/kefuncs.h +++ b/include/ndk/kefuncs.h @@ -126,6 +126,13 @@ KeAcquireQueuedSpinLockRaiseToSynch( IN KSPIN_LOCK_QUEUE_NUMBER LockNumber ); +BOOLEAN +FASTCALL +KeTryToAcquireQueuedSpinLockRaiseToSynch( + IN KSPIN_LOCK_QUEUE_NUMBER LockNumber, + IN PKIRQL OldIrql +); + VOID FASTCALL KeAcquireInStackQueuedSpinLockRaiseToSynch( diff --git a/include/ndk/ldrtypes.h b/include/ndk/ldrtypes.h index 8887a040b07..84ff1370352 100644 --- a/include/ndk/ldrtypes.h +++ b/include/ndk/ldrtypes.h @@ -61,18 +61,30 @@ Author: // // Dll Characteristics for LdrLoadDll // -#define LDR_IGNORE_CODE_AUTHZ_LEVEL 0x00001000 +#define LDR_IGNORE_CODE_AUTHZ_LEVEL 0x00001000 // // LdrAddRef Flags // -#define LDR_PIN_MODULE 0x00000001 +#define LDR_ADDREF_DLL_PIN 0x00000001 // // LdrLockLoaderLock Flags // -#define LDR_LOCK_LOADER_LOCK_FLAG_RAISE_ON_ERRORS 0x00000001 -#define LDR_LOCK_LOADER_LOCK_FLAG_TRY_ONLY 0x00000002 +#define LDR_LOCK_LOADER_LOCK_FLAG_RAISE_ON_ERRORS 0x00000001 +#define LDR_LOCK_LOADER_LOCK_FLAG_TRY_ONLY 0x00000002 + +// +// LdrUnlockLoaderLock Flags +// +#define LDR_UNLOCK_LOADER_LOCK_FLAG_RAISE_ON_ERRORS 0x00000001 + +// +// LdrGetDllHandleEx Flags +// +#define LDR_GET_DLL_HANDLE_EX_UNCHANGED_REFCOUNT 0x00000001 +#define LDR_GET_DLL_HANDLE_EX_PIN 0x00000002 + #define LDR_LOCK_LOADER_LOCK_DISPOSITION_INVALID 0 #define LDR_LOCK_LOADER_LOCK_DISPOSITION_LOCK_ACQUIRED 1 @@ -205,4 +217,14 @@ typedef struct _ALT_RESOURCE_MODULE typedef VOID (NTAPI LDR_ENUM_CALLBACK)(IN PLDR_DATA_TABLE_ENTRY ModuleInformation, IN PVOID Parameter, OUT BOOLEAN *Stop); typedef LDR_ENUM_CALLBACK *PLDR_ENUM_CALLBACK; +// +// DLL Main Routine +// +typedef BOOLEAN +(NTAPI *PDLL_INIT_ROUTINE)( + IN PVOID DllHandle, + IN ULONG Reason, + IN PCONTEXT Context OPTIONAL +); + #endif diff --git a/include/ndk/lpctypes.h b/include/ndk/lpctypes.h index 44419618d5d..2f869a8d9e9 100644 --- a/include/ndk/lpctypes.h +++ b/include/ndk/lpctypes.h @@ -209,8 +209,11 @@ typedef struct _LPCP_PORT_OBJECT SECURITY_CLIENT_CONTEXT StaticSecurity; LIST_ENTRY LpcReplyChainHead; LIST_ENTRY LpcDataInfoChainHead; - PEPROCESS ServerProcess; - PEPROCESS MappingProcess; + union + { + PEPROCESS ServerProcess; + PEPROCESS MappingProcess; + }; ULONG MaxMessageLength; ULONG MaxConnectionInfoLength; ULONG Flags; diff --git a/include/ndk/mmtypes.h b/include/ndk/mmtypes.h index f7c553446db..1c1f4409706 100644 --- a/include/ndk/mmtypes.h +++ b/include/ndk/mmtypes.h @@ -342,7 +342,7 @@ typedef struct _MMPTE { union { - ULONG Long; + ULONG_PTR Long; HARDWARE_PTE Flush; MMPTE_HARDWARE Hard; MMPTE_PROTOTYPE Proto; @@ -704,7 +704,7 @@ typedef struct _MMVAD // // Long VAD used in section and private allocations // -typedef struct _MMVAD_LONG +typedef struct _MMVAD_LONG { union { diff --git a/include/ndk/obtypes.h b/include/ndk/obtypes.h index fbef4f5a5cb..281d5a723e1 100644 --- a/include/ndk/obtypes.h +++ b/include/ndk/obtypes.h @@ -236,7 +236,7 @@ typedef NTSTATUS IN KPROCESSOR_MODE AccessMode ); -typedef NTSTATUS +typedef BOOLEAN (NTAPI *OB_OKAYTOCLOSE_METHOD)( IN PEPROCESS Process OPTIONAL, IN PVOID Object, diff --git a/include/ndk/pofuncs.h b/include/ndk/pofuncs.h index 44bf815896f..a1e677f3b4d 100644 --- a/include/ndk/pofuncs.h +++ b/include/ndk/pofuncs.h @@ -18,6 +18,7 @@ Author: #ifndef _POFUNCS_H #define _POFUNCS_H +#ifndef _PO_DDK_ // // Dependencies @@ -57,28 +58,80 @@ NtSetSystemPowerState( IN ULONG Flags ); -NTSYSAPI +NTSYSCALLAPI +NTSTATUS +NTAPI +NtGetDevicePowerState( + IN HANDLE Device, + IN PDEVICE_POWER_STATE PowerState +); + +NTSYSCALLAPI +NTSTATUS +NTAPI +NtRequestWakeupLatency( + IN LATENCY_TIME latency +); + +NTSYSCALLAPI +BOOLEAN +NTAPI +NtIsSystemResumeAutomatic(VOID); + +NTSYSCALLAPI +NTSTATUS +NTAPI +NtSetThreadExecutionState( + IN EXECUTION_STATE esFlags, + OUT EXECUTION_STATE *PreviousFlags +); + +NTSYSCALLAPI +NTSTATUS +NTAPI +NtInitiatePowerAction( + IN POWER_ACTION SystemAction, + IN SYSTEM_POWER_STATE MinSystemState, + IN ULONG Flags, + IN BOOLEAN Asynchronous +); + +NTSYSCALLAPI +NTSTATUS +NTAPI +NtRequestDeviceWakeup( + IN HANDLE Device +); + +NTSYSCALLAPI +NTSTATUS +NTAPI +NtCancelDeviceWakeupRequest( + IN HANDLE Device +); +#endif +NTSYSCALLAPI NTSTATUS NTAPI ZwInitiatePowerAction( - POWER_ACTION SystemAction, - SYSTEM_POWER_STATE MinSystemState, - ULONG Flags, - BOOLEAN Asynchronous + IN POWER_ACTION SystemAction, + IN SYSTEM_POWER_STATE MinSystemState, + IN ULONG Flags, + IN BOOLEAN Asynchronous ); -NTSYSAPI +NTSYSCALLAPI NTSTATUS NTAPI ZwPowerInformation( - POWER_INFORMATION_LEVEL PowerInformationLevel, - PVOID InputBuffer, - ULONG InputBufferLength, - PVOID OutputBuffer, - ULONG OutputBufferLength + IN POWER_INFORMATION_LEVEL PowerInformationLevel, + IN PVOID InputBuffer OPTIONAL, + IN ULONG InputBufferLength, + OUT PVOID OutputBuffer OPTIONAL, + IN ULONG OutputBufferLength ); -NTSYSAPI +NTSYSCALLAPI NTSTATUS NTAPI ZwSetSystemPowerState( diff --git a/include/ndk/pstypes.h b/include/ndk/pstypes.h index 414e2dcbec1..d0f2fecc982 100644 --- a/include/ndk/pstypes.h +++ b/include/ndk/pstypes.h @@ -117,7 +117,6 @@ Author: #define PSP_LONG_QUANTUMS 16 #ifndef NTOS_MODE_USER - // // Thread Access Types // @@ -149,6 +148,7 @@ Author: #define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | \ SYNCHRONIZE | \ 0xFFF) +#endif // // Thread Base Priorities @@ -162,7 +162,6 @@ Author: // TLS Slots // #define TLS_MINIMUM_AVAILABLE 64 -#endif // // Job Access Types @@ -194,7 +193,6 @@ Author: #define JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK 0x1000 #define JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE 0x2000 - // // Cross Thread Flags // @@ -223,9 +221,7 @@ Author: #define STA_LPC_EXIT_THREAD_CALLED_BIT 0x2 #define STA_ADDRESS_SPACE_OWNER_BIT 0x4 #define STA_OWNS_WORKING_SET_BITS 0x1F8 -#endif -#define TLS_EXPANSION_SLOTS 1024 // // Process Flags // @@ -261,8 +257,22 @@ Author: // Vista Process Flags // #define PSF2_PROTECTED_BIT 0x800 +#endif + +// +// TLS/FLS Defines +// +#define TLS_EXPANSION_SLOTS 1024 #ifdef NTOS_MODE_USER +// +// Thread Native Base Priorities +// +#define LOW_PRIORITY 0 +#define LOW_REALTIME_PRIORITY 16 +#define HIGH_PRIORITY 31 +#define MAXIMUM_PRIORITY 32 + // // Current Process/Thread built-in 'special' handles // diff --git a/include/ndk/rtlfuncs.h b/include/ndk/rtlfuncs.h index 6807128b626..6b185beae0f 100644 --- a/include/ndk/rtlfuncs.h +++ b/include/ndk/rtlfuncs.h @@ -172,6 +172,17 @@ RtlInitEmptyUnicodeString(OUT PUNICODE_STRING UnicodeString, UnicodeString->Buffer = Buffer; } +FORCEINLINE +VOID +RtlInitEmptyAnsiString(OUT PANSI_STRING AnsiString, + IN PSTR Buffer, + IN USHORT BufferSize) +{ + AnsiString->Length = 0; + AnsiString->MaximumLength = BufferSize; + AnsiString->Buffer = Buffer; +} + // // LUID Macros // @@ -233,6 +244,107 @@ RtlConvertUlongToLuid(ULONG Ulong) // // RTL Splay Tree Functions // +#ifndef RTL_USE_AVL_TABLES + +NTSYSAPI +VOID +NTAPI +RtlInitializeGenericTable( + OUT PRTL_GENERIC_TABLE Table, + IN PRTL_GENERIC_COMPARE_ROUTINE CompareRoutine, + IN PRTL_GENERIC_ALLOCATE_ROUTINE AllocateRoutine, + IN PRTL_GENERIC_FREE_ROUTINE FreeRoutine, + IN PVOID TableContext OPTIONAL +); + +NTSYSAPI +PVOID +NTAPI +RtlInsertElementGenericTable( + IN PRTL_GENERIC_TABLE Table, + IN PVOID Buffer, + IN CLONG BufferSize, + OUT PBOOLEAN NewElement OPTIONAL +); + +NTSYSAPI +PVOID +NTAPI +RtlInsertElementGenericTableFull( + IN PRTL_GENERIC_TABLE Table, + IN PVOID Buffer, + IN CLONG BufferSize, + OUT PBOOLEAN NewElement OPTIONAL, + IN PVOID NodeOrParent, + IN TABLE_SEARCH_RESULT SearchResult +); + +NTSYSAPI +BOOLEAN +NTAPI +RtlDeleteElementGenericTable( + IN PRTL_GENERIC_TABLE Table, + IN PVOID Buffer +); + +NTSYSAPI +PVOID +NTAPI +RtlLookupElementGenericTable( + IN PRTL_GENERIC_TABLE Table, + IN PVOID Buffer +); + +NTSYSAPI +PVOID +NTAPI +RtlLookupElementGenericTableFull( + IN PRTL_GENERIC_TABLE Table, + IN PVOID Buffer, + OUT PVOID *NodeOrParent, + OUT TABLE_SEARCH_RESULT *SearchResult +); + +NTSYSAPI +PVOID +NTAPI +RtlEnumerateGenericTable( + IN PRTL_GENERIC_TABLE Table, + IN BOOLEAN Restart +); + +NTSYSAPI +PVOID +NTAPI +RtlEnumerateGenericTableWithoutSplaying( + IN PRTL_GENERIC_TABLE Table, + IN OUT PVOID *RestartKey +); + +NTSYSAPI +PVOID +NTAPI +RtlGetElementGenericTable( + IN PRTL_GENERIC_TABLE Table, + IN ULONG I +); + +NTSYSAPI +ULONG +NTAPI +RtlNumberGenericTableElements( + IN PRTL_GENERIC_TABLE Table +); + +NTSYSAPI +BOOLEAN +NTAPI +RtlIsGenericTableEmpty( + IN PRTL_GENERIC_TABLE Table +); + +#endif /* !RTL_USE_AVL_TABLES */ + NTSYSAPI PRTL_SPLAY_LINKS NTAPI @@ -243,7 +355,8 @@ RtlSplay( NTSYSAPI PRTL_SPLAY_LINKS NTAPI -RtlDelete(IN PRTL_SPLAY_LINKS Links +RtlDelete( + IN PRTL_SPLAY_LINKS Links ); NTSYSAPI @@ -328,7 +441,7 @@ RtlRealPredecessor( _SplayParent->RightChild = _SplayChild; \ _SplayChild->Parent = _SplayParent; \ } - + // // RTL AVL Tree Functions // @@ -450,8 +563,24 @@ NTAPI RtlIsGenericTableEmptyAvl( IN PRTL_AVL_TABLE Table ); - -#endif + +#ifdef RTL_USE_AVL_TABLES + +#define RtlInitializeGenericTable RtlInitializeGenericTableAvl +#define RtlInsertElementGenericTable RtlInsertElementGenericTableAvl +#define RtlInsertElementGenericTableFull RtlInsertElementGenericTableFullAvl +#define RtlDeleteElementGenericTable RtlDeleteElementGenericTableAvl +#define RtlLookupElementGenericTable RtlLookupElementGenericTableAvl +#define RtlLookupElementGenericTableFull RtlLookupElementGenericTableFullAvl +#define RtlEnumerateGenericTable RtlEnumerateGenericTableAvl +#define RtlEnumerateGenericTableWithoutSplaying RtlEnumerateGenericTableWithoutSplayingAvl +#define RtlGetElementGenericTable RtlGetElementGenericTableAvl +#define RtlNumberGenericTableElements RtlNumberGenericTableElementsAvl +#define RtlIsGenericTableEmpty RtlIsGenericTableEmptyAvl + +#endif /* RTL_USE_AVL_TABLES */ + +#endif /* NTOS_MODE_USER */ // // Error and Exception Functions @@ -1868,6 +1997,19 @@ RtlFillMemoryUlong( IN ULONG Fill ); +NTSYSAPI +SIZE_T +NTAPI +RtlCompareMemoryUlong( + IN PVOID Source, + IN SIZE_T Length, + IN ULONG Pattern +); + +#define RtlCopyBytes RtlCopyMemory +#define RtlFillBytes RtlFillMemory +#define RtlZeroBytes RtlZeroMemory + #endif NTSYSAPI @@ -2323,7 +2465,7 @@ RtlDetermineDosPathNameType_U( ); NTSYSAPI -ULONG +RTL_PATH_TYPE NTAPI RtlDetermineDosPathNameType_Ustr( IN PCUNICODE_STRING Path @@ -2348,7 +2490,7 @@ RtlDosPathNameToNtPathName_U( IN PCWSTR DosPathName, OUT PUNICODE_STRING NtPathName, OUT PCWSTR *NtFileNamePart, - OUT CURDIR *DirectoryInfo + OUT PRTL_RELATIVE_NAME_U DirectoryInfo ); NTSYSAPI @@ -2379,18 +2521,6 @@ RtlGetFullPathName_U( OUT PWSTR *ShortName ); -NTSYSAPI -ULONG -NTAPI -RtlGetFullPathName_Ustr( - IN PUNICODE_STRING FileName, - IN ULONG Size, - IN PWSTR Buffer, - OUT PWSTR *ShortName, - OUT PBOOLEAN InvalidName, - OUT RTL_PATH_TYPE *PathType -); - NTSYSAPI ULONG NTAPI @@ -2424,6 +2554,12 @@ RtlQueryEnvironmentVariable_U( PUNICODE_STRING Value ); +VOID +NTAPI +RtlReleaseRelativeName( + IN PRTL_RELATIVE_NAME_U RelativeName +); + NTSYSAPI NTSTATUS NTAPI @@ -2800,7 +2936,7 @@ NTAPI RtlInitializeRangeList( IN OUT PRTL_RANGE_LIST RangeList ); - + NTSYSAPI VOID NTAPI @@ -3052,12 +3188,21 @@ LdrRelocateImageWithBias( // Activation Context Functions // #ifdef NTOS_MODE_USER +NTSYSAPI +NTSTATUS +NTAPI +RtlActivateActivationContextEx( + IN ULONG Flags, + IN PTEB Teb, + IN PVOID Context, + IN PULONG_PTR Cookie +); NTSYSAPI NTSTATUS NTAPI RtlActivateActivationContext( - IN ULONG Unknown, + IN ULONG Flags, IN HANDLE Handle, OUT PULONG_PTR Cookie ); @@ -3069,7 +3214,6 @@ RtlAddRefActivationContext( PVOID Context ); - NTSYSAPI PRTL_ACTIVATION_CONTEXT_STACK_FRAME FASTCALL @@ -3550,6 +3694,15 @@ RtlUnlockBootStatusData( ); #endif +#ifdef NTOS_MODE_USER +NTSYSAPI +NTSTATUS +NTAPI +RtlGUIDFromString( + IN PUNICODE_STRING GuidString, + OUT GUID *Guid); +#endif + #ifdef __cplusplus } #endif diff --git a/include/ndk/rtltypes.h b/include/ndk/rtltypes.h index 3b932372ca9..5f9a99d94ee 100644 --- a/include/ndk/rtltypes.h +++ b/include/ndk/rtltypes.h @@ -244,6 +244,11 @@ C_ASSERT(HEAP_CREATE_VALID_MASK == 0x0007F0FF); // #define RTL_FIND_CHAR_IN_UNICODE_STRING_CASE_INSENSITIVE 4 +// +// RtlImageNtHeaderEx Flags +// +#define RTL_IMAGE_NT_HEADER_EX_FLAG_NO_RANGE_CHECK 0x00000001 + // // Codepages // @@ -251,6 +256,11 @@ C_ASSERT(HEAP_CREATE_VALID_MASK == 0x0007F0FF); #define NLS_MB_OEM_CODE_PAGE_TAG NlsMbOemCodePageTag #define NLS_OEM_LEAD_BYTE_INFO NlsOemLeadByteInfo +// +// Activation Contexts +// +#define INVALID_ACTIVATION_CONTEXT (PVOID)0xFFFFFFFF + // // C++ CONST casting // @@ -286,13 +296,13 @@ C_ASSERT(HEAP_CREATE_VALID_MASK == 0x0007F0FF); #define RTL_INIT_OBJECT_ATTRIBUTES(n, a) \ RTL_CONSTANT_OBJECT_ATTRIBUTES(n, a) -#else +#else /* NTOS_MODE_USER */ // // Message Resource Flag // #define MESSAGE_RESOURCE_UNICODE 0x0001 -#endif +#endif /* !NTOS_MODE_USER */ #define MAXIMUM_LEADBYTES 12 // @@ -340,7 +350,7 @@ extern BOOLEAN NTSYSAPI NLS_MB_OEM_CODE_PAGE_TAG; (__SOURCE_STRING__) \ } -#endif +#endif /* NTOS_MODE_USER */ #ifdef NTOS_MODE_USER @@ -362,7 +372,7 @@ typedef enum _RTL_GENERIC_COMPARE_RESULTS GenericEqual } RTL_GENERIC_COMPARE_RESULTS; -#endif +#endif /* NTOS_MODE_USER */ // // RTL Path Types @@ -415,7 +425,7 @@ typedef VOID IN PVOID Context ); -#else +#else /* !NTOS_MODE_USER */ // // Handler during regular RTL Exceptions @@ -452,7 +462,7 @@ extern const PRTL_ALLOCATE_STRING_ROUTINE RtlAllocateStringRoutine; extern const PRTL_FREE_STRING_ROUTINE RtlFreeStringRoutine; extern const PRTL_REALLOCATE_STRING_ROUTINE RtlReallocateStringRoutine; -#endif +#endif /* NTOS_MODE_USER */ // // Callback for RTL Heap Enumeration @@ -487,52 +497,76 @@ struct _RTL_RANGE; // // Routines and callbacks for the RTL AVL/Generic Table package // -#if defined(NTOS_MODE_USER) || (!defined(NTOS_MODE_USER) && !defined(_NTIFS_)) +#ifdef NTOS_MODE_USER typedef NTSTATUS -(NTAPI *PRTL_AVL_MATCH_FUNCTION)( +(NTAPI RTL_AVL_MATCH_FUNCTION)( struct _RTL_AVL_TABLE *Table, PVOID UserData, PVOID MatchData ); +typedef RTL_AVL_MATCH_FUNCTION *PRTL_AVL_MATCH_FUNCTION; typedef RTL_GENERIC_COMPARE_RESULTS -(NTAPI *PRTL_AVL_COMPARE_ROUTINE) ( +(NTAPI RTL_AVL_COMPARE_ROUTINE) ( struct _RTL_AVL_TABLE *Table, PVOID FirstStruct, PVOID SecondStruct ); +typedef RTL_AVL_COMPARE_ROUTINE *PRTL_AVL_COMPARE_ROUTINE; typedef RTL_GENERIC_COMPARE_RESULTS -(NTAPI *PRTL_GENERIC_COMPARE_ROUTINE) ( +(NTAPI RTL_GENERIC_COMPARE_ROUTINE) ( struct _RTL_GENERIC_TABLE *Table, PVOID FirstStruct, PVOID SecondStruct ); +typedef RTL_GENERIC_COMPARE_ROUTINE *PRTL_GENERIC_COMPARE_ROUTINE; typedef PVOID -(NTAPI *PRTL_GENERIC_ALLOCATE_ROUTINE) ( +(NTAPI RTL_GENERIC_ALLOCATE_ROUTINE) ( struct _RTL_GENERIC_TABLE *Table, CLONG ByteSize ); - -typedef VOID -(NTAPI *PRTL_GENERIC_FREE_ROUTINE) ( - struct _RTL_GENERIC_TABLE *Table, - PVOID Buffer -); +typedef RTL_GENERIC_ALLOCATE_ROUTINE *PRTL_GENERIC_ALLOCATE_ROUTINE; typedef PVOID -(NTAPI *PRTL_AVL_ALLOCATE_ROUTINE) ( +(NTAPI RTL_AVL_ALLOCATE_ROUTINE) ( struct _RTL_AVL_TABLE *Table, CLONG ByteSize ); +typedef RTL_AVL_ALLOCATE_ROUTINE *PRTL_AVL_ALLOCATE_ROUTINE; typedef VOID -(NTAPI *PRTL_AVL_FREE_ROUTINE) ( +(NTAPI RTL_GENERIC_FREE_ROUTINE) ( + struct _RTL_GENERIC_TABLE *Table, + PVOID Buffer +); +typedef RTL_GENERIC_FREE_ROUTINE *PRTL_GENERIC_FREE_ROUTINE; + +typedef VOID +(NTAPI RTL_AVL_FREE_ROUTINE) ( struct _RTL_AVL_TABLE *Table, PVOID Buffer ); -#endif +typedef RTL_AVL_FREE_ROUTINE *PRTL_AVL_FREE_ROUTINE; + +#ifdef RTL_USE_AVL_TABLES +#undef RTL_GENERIC_COMPARE_ROUTINE +#undef PRTL_GENERIC_COMPARE_ROUTINE +#undef RTL_GENERIC_ALLOCATE_ROUTINE +#undef PRTL_GENERIC_ALLOCATE_ROUTINE +#undef RTL_GENERIC_FREE_ROUTINE +#undef PRTL_GENERIC_FREE_ROUTINE + +#define RTL_GENERIC_COMPARE_ROUTINE RTL_AVL_COMPARE_ROUTINE +#define PRTL_GENERIC_COMPARE_ROUTINE PRTL_AVL_COMPARE_ROUTINE +#define RTL_GENERIC_ALLOCATE_ROUTINE RTL_AVL_ALLOCATE_ROUTINE +#define PRTL_GENERIC_ALLOCATE_ROUTINE PRTL_AVL_ALLOCATE_ROUTINE +#define RTL_GENERIC_FREE_ROUTINE RTL_AVL_FREE_ROUTINE +#define PRTL_GENERIC_FREE_ROUTINE PRTL_AVL_FREE_ROUTINE +#endif /* RTL_USE_AVL_TABLES */ + +#endif /* NTOS_MODE_USER */ // // RTL Query Registry callback @@ -649,6 +683,7 @@ typedef struct _RTL_BALANCED_LINKS // // RTL Avl/Generic Tables // +#ifndef RTL_USE_AVL_TABLES typedef struct _RTL_GENERIC_TABLE { PRTL_SPLAY_LINKS TableRoot; @@ -661,6 +696,7 @@ typedef struct _RTL_GENERIC_TABLE PRTL_GENERIC_FREE_ROUTINE FreeRoutine; PVOID TableContext; } RTL_GENERIC_TABLE, *PRTL_GENERIC_TABLE; +#endif /* !RTL_USE_AVL_TABLES */ typedef struct _RTL_AVL_TABLE { @@ -677,6 +713,14 @@ typedef struct _RTL_AVL_TABLE PVOID TableContext; } RTL_AVL_TABLE, *PRTL_AVL_TABLE; +#ifdef RTL_USE_AVL_TABLES +#undef RTL_GENERIC_TABLE +#undef PRTL_GENERIC_TABLE + +#define RTL_GENERIC_TABLE RTL_AVL_TABLE +#define PRTL_GENERIC_TABLE PRTL_AVL_TABLE +#endif /* RTL_USE_AVL_TABLES */ + // // RTL Compression Buffer // @@ -753,20 +797,28 @@ typedef struct _RTL_ACTIVATION_CONTEXT_STACK_FRAME struct _RTL_ACTIVATION_CONTEXT_STACK_FRAME *Previous; PACTIVATION_CONTEXT ActivationContext; ULONG Flags; -} RTL_ACTIVATION_CONTEXT_STACK_FRAME, - *PRTL_ACTIVATION_CONTEXT_STACK_FRAME; +} RTL_ACTIVATION_CONTEXT_STACK_FRAME, *PRTL_ACTIVATION_CONTEXT_STACK_FRAME; + +typedef struct _RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_BASIC +{ + SIZE_T Size; + ULONG Format; + RTL_ACTIVATION_CONTEXT_STACK_FRAME Frame; +} RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_BASIC, *PRTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_BASIC; typedef struct _RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED { - ULONG Size; + SIZE_T Size; ULONG Format; RTL_ACTIVATION_CONTEXT_STACK_FRAME Frame; PVOID Extra1; PVOID Extra2; PVOID Extra3; PVOID Extra4; -} RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED, - *PRTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED; +} RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED, *PRTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED; + +typedef RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED RTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME; +typedef PRTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED PRTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME; #if (NTDDI_VERSION >= NTDDI_WS03) typedef struct _ACTIVATION_CONTEXT_STACK @@ -776,8 +828,7 @@ typedef struct _ACTIVATION_CONTEXT_STACK ULONG Flags; ULONG NextCookieSequenceNumber; ULONG StackId; -} ACTIVATION_CONTEXT_STACK, - *PACTIVATION_CONTEXT_STACK; +} ACTIVATION_CONTEXT_STACK, *PACTIVATION_CONTEXT_STACK; #else typedef struct _ACTIVATION_CONTEXT_STACK { @@ -788,7 +839,7 @@ typedef struct _ACTIVATION_CONTEXT_STACK } ACTIVATION_CONTEXT_STACK, *PACTIVATION_CONTEXT_STACK; #endif -#endif +#endif /* NTOS_MODE_USER */ // // ACE Structure @@ -1012,6 +1063,14 @@ typedef struct _CURDIR HANDLE Handle; } CURDIR, *PCURDIR; +typedef struct _RTLP_CURDIR_REF *PRTLP_CURDIR_REF; +typedef struct _RTL_RELATIVE_NAME_U +{ + UNICODE_STRING RelativeName; + HANDLE ContainingDirectory; + PRTLP_CURDIR_REF CurDirRef; +} RTL_RELATIVE_NAME_U, *PRTL_RELATIVE_NAME_U; + typedef struct _RTL_DRIVE_LETTER_CURDIR { USHORT Flags; @@ -1066,7 +1125,7 @@ typedef struct _RTL_CRITICAL_SECTION ULONG_PTR SpinCount; } RTL_CRITICAL_SECTION, *PRTL_CRITICAL_SECTION; -#endif +#endif /* !NTOS_MODE_USER */ // // RTL Private Heap Structures @@ -1235,7 +1294,7 @@ typedef struct _TIME_ZONE_INFORMATION SYSTEMTIME DaylightDate; LONG DaylightBias; } TIME_ZONE_INFORMATION, *PTIME_ZONE_INFORMATION, *LPTIME_ZONE_INFORMATION; -#endif +#endif /* !_WINBASE_ */ // // Native version of Timezone Structure @@ -1329,5 +1388,5 @@ typedef struct _MESSAGE_RESOURCE_DATA MESSAGE_RESOURCE_BLOCK Blocks[ANYSIZE_ARRAY]; } MESSAGE_RESOURCE_DATA, *PMESSAGE_RESOURCE_DATA; -#endif -#endif +#endif /* !NTOS_MODE_USER */ +#endif /* !_RTLTYPES_H */ diff --git a/include/psdk/CMakeLists.txt b/include/psdk/CMakeLists.txt index 199c00a94aa..668f03c51e5 100644 --- a/include/psdk/CMakeLists.txt +++ b/include/psdk/CMakeLists.txt @@ -1,4 +1,8 @@ +add_definitions(-D_MIDL_USE_GUIDDEF_) + +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) + list(APPEND SOURCE # access.idl activaut.idl @@ -113,3 +117,6 @@ add_idl_headers(psdk ${SOURCE}) add_typelib(stdole2 stdole2.idl) add_iid_library(wuguid wuapi.idl) +add_iid_library(xml_uuids msxml2.idl) + +generate_idl_iids(wincodec.idl) diff --git a/include/psdk/basetsd.h b/include/psdk/basetsd.h index a1130e09647..62b9e9943e4 100644 --- a/include/psdk/basetsd.h +++ b/include/psdk/basetsd.h @@ -77,10 +77,18 @@ #if defined(_WIN64) #define __int3264 __int64 +typedef __int64 SHANDLE_PTR; +typedef unsigned __int64 HANDLE_PTR; +typedef unsigned int UHALF_PTR, *PUHALF_PTR; +typedef int HALF_PTR, *PHALF_PTR; #define ADDRESS_TAG_BIT 0x40000000000UI64 #else /* !_WIN64 */ #define __int3264 __int32 #define ADDRESS_TAG_BIT 0x80000000UL +typedef unsigned short UHALF_PTR, *PUHALF_PTR; +typedef short HALF_PTR, *PHALF_PTR; +typedef long SHANDLE_PTR; +typedef unsigned long HANDLE_PTR; #define HandleToUlong( h ) ((ULONG)(ULONG_PTR)(h) ) #define HandleToLong( h ) ((LONG)(LONG_PTR) (h) ) #define ULongToHandle( h) ((HANDLE)(ULONG_PTR) (h)) @@ -134,9 +142,6 @@ typedef __int64 INT_PTR, *PINT_PTR; typedef unsigned __int64 UINT_PTR, *PUINT_PTR; typedef __int64 LONG_PTR, *PLONG_PTR; typedef unsigned __int64 ULONG_PTR, *PULONG_PTR; -typedef unsigned __int64 HANDLE_PTR; -typedef unsigned int UHALF_PTR, *PUHALF_PTR; -typedef int HALF_PTR, *PHALF_PTR; #if !defined(__midl) && !defined(__WIDL__) static inline unsigned long HandleToUlong(const void* h ) @@ -183,14 +188,6 @@ typedef unsigned long UINT_PTR, *PUINT_PTR; typedef unsigned long ULONG_PTR, *PULONG_PTR; #endif -typedef unsigned short UHALF_PTR, *PUHALF_PTR; -typedef short HALF_PTR, *PHALF_PTR; - -#ifndef HANDLE_PTR_DEFINED -#define HANDLE_PTR_DEFINED - typedef unsigned long HANDLE_PTR; -#endif - #endif /* !_WIN64 */ typedef ULONG_PTR SIZE_T, *PSIZE_T; diff --git a/include/psdk/exdisp.idl b/include/psdk/exdisp.idl index 54dd1df9961..9343ee9b37c 100644 --- a/include/psdk/exdisp.idl +++ b/include/psdk/exdisp.idl @@ -224,7 +224,7 @@ interface IWebBrowserApp : IWebBrowser [id(302)] HRESULT PutProperty([in] BSTR Property, [in] VARIANT vtValue); [id(303)] HRESULT GetProperty([in] BSTR Property, [out, retval] VARIANT *pvtValue); [id(0), propget] HRESULT Name([out, retval] BSTR* Name); - [id(DISPID_HWND), propget] HRESULT HWND([out, retval] long *pHWND); + [id(DISPID_HWND), propget] HRESULT HWND([out, retval] SHANDLE_PTR *pHWND); [id(400), propget] HRESULT FullName([out, retval] BSTR* FullName); [id(401), propget] HRESULT Path([out, retval] BSTR* Path); [id(402), propget] HRESULT Visible([out, retval] VARIANT_BOOL* pBool); diff --git a/include/psdk/msxml2.idl b/include/psdk/msxml2.idl index d91ba4761a7..ee145aaabc2 100644 --- a/include/psdk/msxml2.idl +++ b/include/psdk/msxml2.idl @@ -107,9 +107,9 @@ interface ISchemaNotation; cpp_quote("#define DOMDocument DOMDocument2") cpp_quote("#define CLSID_DOMDocument CLSID_DOMDocument2") -cpp_quote("#ifndef __WIDL_XMLDOM_H") -typedef enum tagDOMNodeType -{ +cpp_quote("#if !defined(__WIDL_XMLDOM_H) && !defined(__xmldom_h__)") +typedef enum tagDOMNodeType +{ NODE_INVALID = 0, NODE_ELEMENT = 1, NODE_ATTRIBUTE = 2, diff --git a/include/psdk/msxml6.idl b/include/psdk/msxml6.idl index 45cef98825f..e045cd8cccc 100644 --- a/include/psdk/msxml6.idl +++ b/include/psdk/msxml6.idl @@ -113,7 +113,7 @@ interface ISchemaNotation; cpp_quote("#define DOMDocument DOMDocument2") cpp_quote("#define CLSID_DOMDocument CLSID_DOMDocument2") -cpp_quote("#ifndef __WIDL_XMLDOM_H") +cpp_quote("#if !defined(__WIDL_XMLDOM_H) && !defined(__xmldom_h__)") typedef enum tagDOMNodeType { NODE_INVALID = 0, diff --git a/include/psdk/ntdef.h b/include/psdk/ntdef.h index 634294a33d4..8b578a9a827 100644 --- a/include/psdk/ntdef.h +++ b/include/psdk/ntdef.h @@ -460,6 +460,8 @@ typedef struct _UNICODE_STRING { } UNICODE_STRING, *PUNICODE_STRING; typedef const UNICODE_STRING* PCUNICODE_STRING; #define UNICODE_NULL ((WCHAR)0) +#define UNICODE_STRING_MAX_BYTES ((USHORT) 65534) +#define UNICODE_STRING_MAX_CHARS (32767) typedef struct _CSTRING { USHORT Length; diff --git a/include/psdk/ntsecapi.h b/include/psdk/ntsecapi.h index 27127a29106..b092038bf4f 100644 --- a/include/psdk/ntsecapi.h +++ b/include/psdk/ntsecapi.h @@ -141,11 +141,11 @@ extern "C" { #define SCESTATUS_NO_MAPPING 18L #define SCESTATUS_TRUST_FAIL 19L -#if !defined(_NTDEF_) +#if !defined(_NTDEF_) && !defined(__WINE_WINTERNL_H) typedef LONG NTSTATUS, *PNTSTATUS; #endif -#if defined (_NTDEF_) +#if defined (_NTDEF_) || defined(__WINE_WINTERNL_H) typedef UNICODE_STRING LSA_UNICODE_STRING, *PLSA_UNICODE_STRING; typedef STRING LSA_STRING, *PLSA_STRING; typedef OBJECT_ATTRIBUTES LSA_OBJECT_ATTRIBUTES, *PLSA_OBJECT_ATTRIBUTES; diff --git a/include/psdk/propkeydef.h b/include/psdk/propkeydef.h index 2a796eaf3c4..85b29647caa 100644 --- a/include/psdk/propkeydef.h +++ b/include/psdk/propkeydef.h @@ -58,6 +58,8 @@ #ifndef _PROPERTYKEY_EQUALITY_OPERATORS_ #define _PROPERTYKEY_EQUALITY_OPERATORS_ #ifdef __cplusplus +extern "C++" +{ inline bool operator==(REFPROPERTYKEY guidOne, REFPROPERTYKEY guidOther) { return IsEqualPropertyKey(guidOne, guidOther); @@ -66,5 +68,6 @@ inline bool operator!=(REFPROPERTYKEY guidOne, REFPROPERTYKEY guidOther) { return !(guidOne == guidOther); } +} //extern "C++" #endif #endif diff --git a/include/psdk/rpcdce.h b/include/psdk/rpcdce.h index 439f16483aa..63ac592dd91 100644 --- a/include/psdk/rpcdce.h +++ b/include/psdk/rpcdce.h @@ -279,6 +279,18 @@ typedef struct _RPC_SECURITY_QOS_V2_A } u; } RPC_SECURITY_QOS_V2_A, *PRPC_SECURITY_QOS_V2_A; +typedef struct _RPC_PROTSEQ_VECTORA +{ + unsigned int Count; + unsigned char __RPC_FAR * Protseq[1]; +} RPC_PROTSEQ_VECTORA; + +typedef struct _RPC_PROTSEQ_VECTORW +{ + unsigned int Count; + unsigned short __RPC_FAR * Protseq[1]; +} RPC_PROTSEQ_VECTORW; + #define _SEC_WINNT_AUTH_IDENTITY WINELIB_NAME_AW(_SEC_WINNT_AUTH_IDENTITY_) #define SEC_WINNT_AUTH_IDENTITY WINELIB_NAME_AW(SEC_WINNT_AUTH_IDENTITY_) #define PSEC_WINNT_AUTH_IDENTITY WINELIB_NAME_AW(PSEC_WINNT_AUTH_IDENTITY_) @@ -291,6 +303,16 @@ typedef struct _RPC_SECURITY_QOS_V2_A #define PRPC_SECURITY_QOS_V2 WINELIB_NAME_AW(PRPC_SECURITY_QOS_V2_) #define _RPC_SECURITY_QOS_V2 WINELIB_NAME_AW(_RPC_SECURITY_QOS_V2_) +#define RPC_PROTSEQ_VECTOR WINELIB_NAME_AW(RPC_PROTSEQ_VECTOR) +#define _RPC_PROTSEQ_VECTOR WINELIB_NAME_AW(_RPC_PROTSEQ_VECTOR) + +typedef int +(__RPC_API * RPC_MGMT_AUTHORIZATION_FN) ( + IN RPC_BINDING_HANDLE ClientBinding, + IN unsigned long RequestedMgmtOperation, + OUT RPC_STATUS __RPC_FAR * Status + ); + /* SEC_WINNT_AUTH Flags */ #define SEC_WINNT_AUTH_IDENTITY_ANSI 0x1 #define SEC_WINNT_AUTH_IDENTITY_UNICODE 0x2 diff --git a/include/psdk/setupapi.h b/include/psdk/setupapi.h index 066d78d477e..e8bec8c3e43 100644 --- a/include/psdk/setupapi.h +++ b/include/psdk/setupapi.h @@ -522,8 +522,13 @@ extern "C" { #define SPDRP_EXCLUSIVE 26 #define SPDRP_CHARACTERISTICS 27 #define SPDRP_ADDRESS 28 -#define SPDRP_UI_NUMBER_DESC_FORMAT 30 -#define SPDRP_MAXIMUM_PROPERTY 31 +#define SPDRP_UI_NUMBER_DESC_FORMAT 29 +#define SPDRP_DEVICE_POWER_DATA 30 +#define SPDRP_REMOVAL_POLICY 31 +#define SPDRP_REMOVAL_POLICY_HW_DEFAULT 32 +#define SPDRP_REMOVAL_POLICY_OVERRIDE 33 +#define SPDRP_INSTALL_STATE 34 +#define SPDRP_MAXIMUM_PROPERTY 35 #define SPDSL_IGNORE_DISK 1 #define SPDSL_DISALLOW_NEGATIVE_ADJUST 2 diff --git a/include/psdk/shlwapi.h b/include/psdk/shlwapi.h index 079b97e54c3..23fef8f37c8 100644 --- a/include/psdk/shlwapi.h +++ b/include/psdk/shlwapi.h @@ -319,6 +319,8 @@ BOOL WINAPI AssocIsDangerous(LPCWSTR); #endif /* NO_SHLWAPI_REG */ +HRESULT WINAPI IUnknown_SetSite(IUnknown *punk, IUnknown *punkSite); +HRESULT WINAPI IUnknown_QueryService(IUnknown *punk, REFGUID guidService, REFIID riid, void **ppvOut); /* Path functions */ #ifndef NO_SHLWAPI_PATH diff --git a/include/psdk/urlmon.idl b/include/psdk/urlmon.idl index d2a46a08cc2..2ea4063a7d9 100644 --- a/include/psdk/urlmon.idl +++ b/include/psdk/urlmon.idl @@ -1511,13 +1511,27 @@ typedef enum _tagINTERNETFEATURELIST FEATURE_DISABLE_TELNET_PROTOCOL, FEATURE_FEEDS, FEATURE_BLOCK_INPUT_PROMPTS, - FEATURE_DOMSTORAGE, - FEATURE_XDOMAINREQUEST, - FEATURE_DATAURI, - FEATURE_AJAX_CONNECTIONSERVICES, FEATURE_ENTRY_COUNT } INTERNETFEATURELIST; +cpp_quote("#define SET_FEATURE_ON_THREAD 0x00000001") +cpp_quote("#define SET_FEATURE_ON_PROCESS 0x00000002") +cpp_quote("#define SET_FEATURE_IN_REGISTRY 0x00000004") +cpp_quote("#define SET_FEATURE_ON_THREAD_LOCALMACHINE 0x00000008") +cpp_quote("#define SET_FEATURE_ON_THREAD_INTRANET 0x00000010") +cpp_quote("#define SET_FEATURE_ON_THREAD_TRUSTED 0x00000020") +cpp_quote("#define SET_FEATURE_ON_THREAD_INTERNET 0x00000040") +cpp_quote("#define SET_FEATURE_ON_THREAD_RESTRICTED 0x00000080") + +cpp_quote("#define GET_FEATURE_FROM_THREAD 0x00000001") +cpp_quote("#define GET_FEATURE_FROM_PROCESS 0x00000002") +cpp_quote("#define GET_FEATURE_FROM_REGISTRY 0x00000004") +cpp_quote("#define GET_FEATURE_FROM_THREAD_LOCALMACHINE 0x00000008") +cpp_quote("#define GET_FEATURE_FROM_THREAD_INTRANET 0x00000010") +cpp_quote("#define GET_FEATURE_FROM_THREAD_TRUSTED 0x00000020") +cpp_quote("#define GET_FEATURE_FROM_THREAD_INTERNET 0x00000040") +cpp_quote("#define GET_FEATURE_FROM_THREAD_RESTRICTED 0x00000080") + typedef struct _tagPROTOCOLFILTERDATA { DWORD cbSize; IInternetProtocolSink *pProtocolSink; @@ -1839,16 +1853,16 @@ cpp_quote("HRESULT WINAPI CreateIUriBuilder(IUri*,DWORD,DWORD_PTR,IUriBuilder**) ] interface IUriBuilderFactory : IUnknown { - HRESULT CreateInitializedIUriBuilder( - [in] DWORD dwFlags, - [in] DWORD_PTR dwReserved, - [out] IUriBuilder **ppIUriBuilder); - HRESULT CreateIUriBuilder( [in] DWORD dwFlags, [in] DWORD_PTR dwReserved, [out] IUriBuilder **ppIUriBuilder); -}; + + HRESULT CreateInitializedIUriBuilder( + [in] DWORD dwFlags, + [in] DWORD_PTR dwReserved, + [out] IUriBuilder **ppIUriBuilder); +} /***************************************************************************** * IInternetProtocolEx interface @@ -1964,6 +1978,7 @@ cpp_quote("HRESULT WINAPI CoInternetParseIUri(IUri*,PARSEACTION,DWORD,LPWSTR,DWO cpp_quote("HRESULT WINAPI CoInternetQueryInfo(LPCWSTR,QUERYOPTION,DWORD,LPVOID,DWORD,DWORD*,DWORD);") cpp_quote("HRESULT WINAPI CoInternetSetFeatureEnabled(INTERNETFEATURELIST,DWORD,BOOL);") cpp_quote("HRESULT WINAPI CoInternetGetSecurityUrl(LPCWSTR,LPWSTR*,PSUACTION,DWORD);") +cpp_quote("HRESULT WINAPI CoInternetGetSecurityUrlEx(IUri*,IUri**,PSUACTION,DWORD_PTR);") cpp_quote("HRESULT WINAPI CreateFormatEnumerator(UINT,FORMATETC*,IEnumFORMATETC**);") cpp_quote("HRESULT WINAPI GetSoftwareUpdateInfo( LPCWSTR szDistUnit, LPSOFTDISTINFO psdi);") cpp_quote("HRESULT WINAPI FaultInIEFeature(HWND,uCLSSPEC*,QUERYCONTEXT*,DWORD);") diff --git a/include/psdk/winbase.h b/include/psdk/winbase.h index 9049f50d2a2..12509445483 100644 --- a/include/psdk/winbase.h +++ b/include/psdk/winbase.h @@ -222,6 +222,7 @@ extern "C" { #define SETRTS 3 #define SETXOFF 1 #define SETXON 2 +#define RESETDEV 7 #define SETBREAK 8 #define CLRBREAK 9 #define STILL_ACTIVE 0x103 diff --git a/include/psdk/windows.h b/include/psdk/windows.h index 569b693abf8..323964cd918 100644 --- a/include/psdk/windows.h +++ b/include/psdk/windows.h @@ -52,21 +52,11 @@ #include #include #include -#ifndef _WINNLS_H #include -#endif -#ifndef _WINVER_H #include -#endif -#ifndef _WINNETWK_H #include -#endif -#ifndef _WINREG_H #include -#endif -#ifndef _WINSVC_H #include -#endif #ifndef WIN32_LEAN_AND_MEAN #include diff --git a/include/psdk/winhttp.h b/include/psdk/winhttp.h index 17fc38a8f02..68bec0a433d 100644 --- a/include/psdk/winhttp.h +++ b/include/psdk/winhttp.h @@ -429,6 +429,11 @@ typedef int INTERNET_SCHEME, *LPINTERNET_SCHEME; #define WINHTTP_CALLBACK_STATUS_FLAG_CERT_WRONG_USAGE 0x00000040 #define WINHTTP_CALLBACK_STATUS_FLAG_SECURITY_CHANNEL_ERROR 0x80000000 +#define WINHTTP_FLAG_SECURE_PROTOCOL_SSL2 0x00000008 +#define WINHTTP_FLAG_SECURE_PROTOCOL_SSL3 0x00000020 +#define WINHTTP_FLAG_SECURE_PROTOCOL_TLS1 0x00000080 +#define WINHTTP_FLAG_SECURE_PROTOCOL_ALL (WINHTTP_FLAG_SECURE_PROTOCOL_SSL2 | WINHTTP_FLAG_SECURE_PROTOCOL_SSL3 | WINHTTP_FLAG_SECURE_PROTOCOL_TLS1) + #define WINHTTP_AUTH_SCHEME_BASIC 0x00000001 #define WINHTTP_AUTH_SCHEME_NTLM 0x00000002 #define WINHTTP_AUTH_SCHEME_PASSPORT 0x00000004 diff --git a/include/psdk/wininet.h b/include/psdk/wininet.h index a0ec4082d12..ce09821218a 100644 --- a/include/psdk/wininet.h +++ b/include/psdk/wininet.h @@ -591,9 +591,13 @@ BOOLAPI InternetUnlockRequestFile(HANDLE); #define INTERNET_OPTION_CODEPAGE_PATH 100 #define INTERNET_OPTION_CODEPAGE_EXTRA 101 #define INTERNET_OPTION_IDN 102 +#define INTERNET_OPTION_MAX_CONNS_PER_PROXY 103 +#define INTERNET_OPTION_SUPPRESS_SERVER_AUTH 104 +#define INTERNET_OPTION_SERVER_CERT_CHAIN_CONTEXT 105 + #define INTERNET_FIRST_OPTION INTERNET_OPTION_CALLBACK -#define INTERNET_LAST_OPTION INTERNET_OPTION_DATAFILE_EXT +#define INTERNET_LAST_OPTION INTERNET_OPTION_SERVER_CERT_CHAIN_CONTEXT #define INTERNET_PRIORITY_FOREGROUND 1000 #define INTERNET_HANDLE_TYPE_INTERNET 1 @@ -1442,6 +1446,7 @@ INTERNETAPI DWORD WINAPI PrivacyGetZonePreferenceW(DWORD,DWORD,LPDWORD,LPWSTR,LP #define ERROR_INTERNET_RETRY_DIALOG (INTERNET_ERROR_BASE + 50) #define ERROR_INTERNET_HTTPS_HTTP_SUBMIT_REDIR (INTERNET_ERROR_BASE + 52) #define ERROR_INTERNET_INSERT_CDROM (INTERNET_ERROR_BASE + 53) +#define ERROR_INTERNET_FORTEZZA_LOGIN_NEEDED (INTERNET_ERROR_BASE + 54) #define ERROR_INTERNET_SEC_CERT_ERRORS (INTERNET_ERROR_BASE + 55) #define ERROR_INTERNET_SEC_CERT_NO_REV (INTERNET_ERROR_BASE + 56) #define ERROR_INTERNET_SEC_CERT_REV_FAILED (INTERNET_ERROR_BASE + 57) @@ -1655,6 +1660,16 @@ BOOLAPI DeleteUrlCacheEntryA(LPCSTR); BOOLAPI DeleteUrlCacheEntryW(LPCWSTR); #define DeleteUrlCacheEntry WINELIB_NAME_AW(DeleteUrlCacheEntry) +/* FCS_ flags and FreeUrlCacheSpace are no longer documented */ +#define FCS_PERCENT_CACHE_SPACE 0 /* guessed value */ +#define FCS_PERCENT_DISK_SPACE 1 /* guessed value */ +#define FCS_ABSOLUTE_SIZE 2 /* guessed value */ + +BOOLAPI FreeUrlCacheSpaceA(LPCSTR ,DWORD ,DWORD); +BOOLAPI FreeUrlCacheSpaceW(LPCWSTR ,DWORD ,DWORD); +#define FreeUrlCacheSpace WINELIB_NAME_AW(FreeUrlCacheSpace) + + INTERNETAPI DWORD WINAPI InternetDialA(HWND ,LPSTR ,DWORD ,DWORD_PTR* ,DWORD); INTERNETAPI DWORD WINAPI InternetDialW(HWND ,LPWSTR ,DWORD ,DWORD_PTR* ,DWORD); #define InternetDial WINELIB_NAME_AW(InternetDial) diff --git a/include/psdk/winineti.h b/include/psdk/winineti.h index 27efa50a42b..6419204ecca 100644 --- a/include/psdk/winineti.h +++ b/include/psdk/winineti.h @@ -46,15 +46,15 @@ typedef struct _INTERNET_CACHE_CONFIG_INFOA BOOL fPerUser; DWORD dwSyncMode; DWORD dwNumCachePaths; - union + __C89_NAMELESS union { - struct + __C89_NAMELESS struct { CHAR CachePath[MAX_PATH]; DWORD dwCacheSize; - } DUMMYSTRUCTNAME; + } __C89_NAMELESSSTRUCTNAME; INTERNET_CACHE_CONFIG_PATH_ENTRYA CachePaths[ANYSIZE_ARRAY]; - } DUMYUNIONNAME; + } __C89_NAMELESSUNIONNAME; DWORD dwNormalUsage; DWORD dwExemptUsage; } INTERNET_CACHE_CONFIG_INFOA, *LPINTERNET_CACHE_CONFIG_INFOA; @@ -68,15 +68,15 @@ typedef struct _INTERNET_CACHE_CONFIG_INFOW BOOL fPerUser; DWORD dwSyncMode; DWORD dwNumCachePaths; - union + __C89_NAMELESS union { - struct + __C89_NAMELESS struct { WCHAR CachePath[MAX_PATH]; DWORD dwCacheSize; - } DUMMYSTRUCTNAME; + } __C89_NAMELESSSTRUCTNAME; INTERNET_CACHE_CONFIG_PATH_ENTRYW CachePaths[ANYSIZE_ARRAY]; - } ; + } __C89_NAMELESSUNIONNAME; DWORD dwNormalUsage; DWORD dwExemptUsage; } INTERNET_CACHE_CONFIG_INFOW, *LPINTERNET_CACHE_CONFIG_INFOW; @@ -84,6 +84,26 @@ typedef struct _INTERNET_CACHE_CONFIG_INFOW DECL_WINELIB_TYPE_AW(INTERNET_CACHE_CONFIG_INFO) DECL_WINELIB_TYPE_AW(LPINTERNET_CACHE_CONFIG_INFO) +typedef enum { + WININET_SYNC_MODE_NEVER = 0, + WININET_SYNC_MODE_ON_EXPIRY, + WININET_SYNC_MODE_ONCE_PER_SESSION, + WININET_SYNC_MODE_ALWAYS, + WININET_SYNC_MODE_AUTOMATIC, + WININET_SYNC_MODE_DEFAULT = WININET_SYNC_MODE_AUTOMATIC +} WININET_SYNC_MODE; + +/* Flags for GetUrlCacheConfigInfoA/W and SetUrlCacheConfigInfoA/W */ +#define CACHE_CONFIG_FORCE_CLEANUP_FC 0x00000020 +#define CACHE_CONFIG_DISK_CACHE_PATHS_FC 0x00000040 +#define CACHE_CONFIG_SYNC_MODE_FC 0x00000080 +#define CACHE_CONFIG_CONTENT_PATHS_FC 0x00000100 +#define CACHE_CONFIG_COOKIES_PATHS_FC 0x00000200 +#define CACHE_CONFIG_HISTORY_PATHS_FC 0x00000400 +#define CACHE_CONFIG_QUOTA_FC 0x00000800 +#define CACHE_CONFIG_USER_MODE_FC 0x00001000 +#define CACHE_CONFIG_CONTENT_USAGE_FC 0x00002000 +#define CACHE_CONFIG_STICKY_CONTENT_USAGE_FC 0x00004000 #ifdef __cplusplus extern "C" { diff --git a/include/psdk/winnetwk.h b/include/psdk/winnetwk.h index c391472adce..d489da8b01a 100644 --- a/include/psdk/winnetwk.h +++ b/include/psdk/winnetwk.h @@ -1,5 +1,5 @@ -#ifndef _WINNETWK_H -#define _WINNETWK_H +#ifndef _WINNETWK_ +#define _WINNETWK_ #ifdef __cplusplus extern "C" { diff --git a/include/psdk/winnls.h b/include/psdk/winnls.h index 7677e3ad96b..42822203bd9 100644 --- a/include/psdk/winnls.h +++ b/include/psdk/winnls.h @@ -1,5 +1,5 @@ -#ifndef _WINNLS_H -#define _WINNLS_H +#ifndef _WINNLS_ +#define _WINNLS_ #ifdef __cplusplus extern "C" { diff --git a/include/psdk/winnt.h b/include/psdk/winnt.h index 8dfdfbfabb4..25ff67708ec 100644 --- a/include/psdk/winnt.h +++ b/include/psdk/winnt.h @@ -284,6 +284,8 @@ typedef LONGLONG USN; #endif #define ANSI_NULL ((CHAR)0) #define UNICODE_NULL ((WCHAR)0) +#define UNICODE_STRING_MAX_BYTES ((USHORT) 65534) +#define UNICODE_STRING_MAX_CHARS (32767) typedef BYTE BOOLEAN,*PBOOLEAN; #endif typedef BYTE FCHAR; @@ -311,6 +313,22 @@ typedef DWORD FLONG; #define ERROR_SEVERITY_INFORMATIONAL 0x40000000 #define ERROR_SEVERITY_WARNING 0x80000000 #define ERROR_SEVERITY_ERROR 0xC0000000 + +#ifdef __cplusplus +#define DEFINE_ENUM_FLAG_OPERATORS(ENUMTYPE) \ +extern "C++" { \ + inline ENUMTYPE operator | (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a)|((int)b)); } \ + inline ENUMTYPE operator |= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) |= ((int)b)); } \ + inline ENUMTYPE operator & (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a)&((int)b)); } \ + inline ENUMTYPE operator &= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) &= ((int)b)); } \ + inline ENUMTYPE operator ~ (ENUMTYPE a) { return (ENUMTYPE)(~((int)a)); } \ + inline ENUMTYPE operator ^ (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a)^((int)b)); } \ + inline ENUMTYPE operator ^= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) ^= ((int)b)); } \ +} +#else +#define DEFINE_ENUM_FLAG_OPERATORS(ENUMTYPE) /* */ +#endif + /* also in ddk/ntifs.h */ #define COMPRESSION_FORMAT_NONE (0x0000) #define COMPRESSION_FORMAT_DEFAULT (0x0001) @@ -3300,6 +3318,21 @@ typedef struct _QUOTA_LIMITS { SIZE_T PagefileLimit; LARGE_INTEGER TimeLimit; } QUOTA_LIMITS,*PQUOTA_LIMITS; + +typedef struct _QUOTA_LIMITS_EX { + SIZE_T PagedPoolLimit; + SIZE_T NonPagedPoolLimit; + SIZE_T MinimumWorkingSetSize; + SIZE_T MaximumWorkingSetSize; + SIZE_T PagefileLimit; + LARGE_INTEGER TimeLimit; + SIZE_T Reserved1; + SIZE_T Reserved2; + SIZE_T Reserved3; + SIZE_T Reserved4; + ULONG Flags; + ULONG Reserved5; +} QUOTA_LIMITS_EX, *PQUOTA_LIMITS_EX; typedef struct _IO_COUNTERS { ULONGLONG ReadOperationCount; diff --git a/include/psdk/winreg.h b/include/psdk/winreg.h index 32f9ceb101f..92999ca7e4c 100644 --- a/include/psdk/winreg.h +++ b/include/psdk/winreg.h @@ -1,5 +1,5 @@ -#ifndef _WINREG_H -#define _WINREG_H +#ifndef _WINREG_ +#define _WINREG_ #ifdef __cplusplus extern "C" { diff --git a/include/psdk/winsvc.h b/include/psdk/winsvc.h index 389f951f54c..8a66503beee 100644 --- a/include/psdk/winsvc.h +++ b/include/psdk/winsvc.h @@ -1,5 +1,5 @@ -#ifndef _WINSVC_H -#define _WINSVC_H +#ifndef _WINSVC_ +#define _WINSVC_ #ifdef __cplusplus extern "C" { diff --git a/include/psdk/winternl.h b/include/psdk/winternl.h index af8b46d7e91..e52dee810bb 100644 --- a/include/psdk/winternl.h +++ b/include/psdk/winternl.h @@ -32,7 +32,7 @@ extern "C" { * Fundamental types and data structures */ -typedef LONG NTSTATUS; +typedef LONG NTSTATUS, *PNTSTATUS; typedef CONST char *PCSZ; diff --git a/include/psdk/winver.h b/include/psdk/winver.h index af93d6ebbb8..56b9fa8c8f3 100644 --- a/include/psdk/winver.h +++ b/include/psdk/winver.h @@ -1,5 +1,5 @@ -#ifndef _WINVER_H -#define _WINVER_H +#ifndef VER_H +#define VER_H #ifdef __cplusplus extern "C" { diff --git a/include/reactos/asm.inc b/include/reactos/asm.inc index 45c9068abf4..a99ecfb7074 100644 --- a/include/reactos/asm.inc +++ b/include/reactos/asm.inc @@ -41,6 +41,12 @@ ENDM name ENDP ENDM +/* check http://msdn.microsoft.com/en-us/library/9c9k076y%28VS.80%29.aspx + and http://msdn.microsoft.com/en-us/library/ms679352%28VS.85%29.aspx */ +FPO MACRO cdwLocals, cdwParams, cbProlog, cbRegs, fUseBP, cbFrame + .FPO (cdwLocals, cdwParams, cbProlog, cbRegs, fUseBP, cbFrame) +ENDM + /* MASM doesn't have an ASCII macro */ .ASCII MACRO text DB text @@ -143,7 +149,7 @@ ENDM /* To avoid reverse syntax we provide a new macro .PROC, replacing PROC... */ .macro .PROC name .func \name - \name: + _\name: .cfi_startproc .equ cfa_current_offset, -8 .endm @@ -192,6 +198,12 @@ ENDM .text .endm +/* check http://msdn.microsoft.com/en-us/library/9c9k076y%28VS.80%29.aspx + and http://msdn.microsoft.com/en-us/library/ms679352%28VS.85%29.aspx */ +.macro FPO cdwLocals, cdwParams, cbProlog, cbRegs, fUseBP, cbFrame + /* dummy */ +.endm + /* Macros for x64 stack unwind OPs */ .macro .allocstack size @@ -259,4 +271,11 @@ code = 1 #endif +/* Common definitions for FPO macro + see http://msdn.microsoft.com/en-us/library/ms679352%28VS.85%29.aspx */ +#define FRAME_FPO 0 +#define FRAME_TRAP 1 +#define FRAME_TSS 2 +#define FRAME_NONFPO 3 + #endif /* _ASM_INC_ */ diff --git a/include/reactos/idl/CMakeLists.txt b/include/reactos/idl/CMakeLists.txt deleted file mode 100644 index dd71249adce..00000000000 --- a/include/reactos/idl/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ - -include_directories(.) - -add_rpc_library(eventlogrpc eventlogrpc.idl) -add_rpc_library(lsarpc lsa.idl) -add_rpc_library(svcctlrpc svcctl.idl) -add_rpc_library(wlansvcrpc wlansvc.idl) - -remove_definitions(-D_WIN32_WINNT=0x502) -add_definitions(-D_WIN32_WINNT=0x600) - -add_rpc_library(pnprpc pnp.idl) diff --git a/include/reactos/idl/eventlogrpc.idl b/include/reactos/idl/eventlogrpc.idl index e5cdbd3459d..72dea26cfae 100644 --- a/include/reactos/idl/eventlogrpc.idl +++ b/include/reactos/idl/eventlogrpc.idl @@ -30,7 +30,8 @@ typedef struct _RPC_CLIENT_ID { [ uuid(82273FDC-E32A-18C3-3F78-827929DC23EA), version(0.0), - pointer_default(unique) + pointer_default(unique), + endpoint("ncacn_np:[\\pipe\\EventLog]") #ifndef __midl ,explicit_handle #endif @@ -190,24 +191,15 @@ interface eventlog /* Function 19 */ NTSTATUS ElfrRegisterClusterSvc( -#ifndef __midl - [in] handle_t BindingHandle -#endif - ); /* FIXME */ + [in] handle_t BindingHandle); /* Function 20 */ NTSTATUS ElfrDeregisterClusterSvc( -#ifndef __midl - [in] handle_t BindingHandle -#endif - ); /* FIXME */ + [in] handle_t BindingHandle); /* Function 21 */ NTSTATUS ElfrWriteClusterEvents( -#ifndef __midl - [in] handle_t BindingHandle -#endif - ); /* FIXME */ + [in] handle_t BindingHandle); /* Function 22 */ NTSTATUS ElfrGetLogInformation( diff --git a/include/reactos/idl/lsa.idl b/include/reactos/idl/lsa.idl index 2a9aba6e8cb..93295bbbc39 100644 --- a/include/reactos/idl/lsa.idl +++ b/include/reactos/idl/lsa.idl @@ -584,7 +584,8 @@ cpp_quote("#endif") [ uuid(12345778-1234-abcd-ef00-0123456789ab), version(0.0), - pointer_default(unique) + pointer_default(unique), + endpoint("ncacn_np:[\\pipe\\lsarpc]") #ifndef __midl ,explicit_handle #endif diff --git a/include/reactos/idl/pnp.idl b/include/reactos/idl/pnp.idl index b776e6d4a78..62473d6dadb 100644 --- a/include/reactos/idl/pnp.idl +++ b/include/reactos/idl/pnp.idl @@ -252,7 +252,8 @@ typedef struct _DEVPROPKEY { [ uuid (8D9F4E40-A03D-11CE-8F69-08003E30051B), version(1.0), - pointer_default(unique) + pointer_default(unique), + endpoint("ncacn_np:[\\pipe\\plugplay]") #ifndef __midl ,explicit_handle #endif @@ -467,7 +468,7 @@ interface pnp /* Function 27 */ DWORD PNP_SetClassRegProp( [in] handle_t hBinding, - [in, string, ref] LPWSTR *pszClassGuid, + [in, string, ref] LPWSTR pszClassGuid, [in] DWORD ulProperty, [in] DWORD ulDataType, [in, size_is(ulLength)] BYTE *Buffer, diff --git a/include/reactos/idl/svcctl.idl b/include/reactos/idl/svcctl.idl index 4966d17954c..2febd675415 100644 --- a/include/reactos/idl/svcctl.idl +++ b/include/reactos/idl/svcctl.idl @@ -297,7 +297,8 @@ typedef struct _STRING_PTRSW { [ uuid(367abb81-9844-35f1-ad32-98f038001003), version(2.0), - pointer_default(unique) + pointer_default(unique), + endpoint("ncacn_np:[\\pipe\\ntsvcs]") ] interface svcctl { diff --git a/include/reactos/ks386.inc b/include/reactos/ks386.inc index a4272847a9f..f3791133cca 100644 --- a/include/reactos/ks386.inc +++ b/include/reactos/ks386.inc @@ -456,6 +456,7 @@ TeInstrumentation = 0xf2c TeGdiBatchCount = 0xf70 TeGuaranteedStackBytes = 0xf78 TeFlsData = 0xfb4 +TeSafeThunkCall = 0xfb8 ThreadEnvironmentBlockLength = 0xfbc /* TIME_FIELDS */ diff --git a/include/reactos/libs/libmpg123/optimize.h b/include/reactos/libs/libmpg123/optimize.h index 620c3ad7daa..99f132ccba9 100644 --- a/include/reactos/libs/libmpg123/optimize.h +++ b/include/reactos/libs/libmpg123/optimize.h @@ -58,7 +58,11 @@ enum optcla decclass(const enum optdec); /* this is included in mpg123.h, which includes config.h */ #ifdef CCALIGN +#ifdef _MSC_VER +#define ALIGNED(a) __declspec(align(a)) +#else #define ALIGNED(a) __attribute__((aligned(a))) +#endif #else #define ALIGNED(a) #endif diff --git a/include/reactos/mc/mc.rbuild b/include/reactos/mc/mc.rbuild index 28c70f0a5fe..bcd153e6021 100644 --- a/include/reactos/mc/mc.rbuild +++ b/include/reactos/mc/mc.rbuild @@ -24,4 +24,8 @@ ntiologc.mc + + + sacmsg.mc + \ No newline at end of file diff --git a/include/reactos/mc/ntstatus.mc b/include/reactos/mc/ntstatus.mc index 9fe190409ea..4b26f193780 100644 --- a/include/reactos/mc/ntstatus.mc +++ b/include/reactos/mc/ntstatus.mc @@ -411,6 +411,26 @@ Language=English One of the files containing the system's Registry data had to be recovered by use of a log or alternate copy. The recovery was successful. +. +MessageId=0xa +Severity=Informational +Facility=System +SymbolicName=STATUS_FT_READ_RECOVERY_FROM_BACKUP +Language=English +{Redundant Read} +To satisfy a read request, the Windows NT fault-tolerant file system successfully read the requested data from a redundant copy. +This was done because the file system encountered a failure on a member of the fault-tolerant volume but was unable to reassign the failing area of the device. + +. +MessageId=0xb +Severity=Informational +Facility=System +SymbolicName=STATUS_FT_WRITE_RECOVERY +Language=English +{Redundant Write} +To satisfy a write request, the Windows NT fault-tolerant file system successfully wrote a redundant copy of the information. +This was done because the file system encountered a failure on a member of the fault-tolerant volume but was unable to reassign the failing area of the device. + . MessageId=0xc Severity=Informational @@ -421,6 +441,33 @@ Language=English A serial I/O operation completed because the time-out period expired. (The IOCTL_SERIAL_XOFF_COUNTER had not reached zero.) +. +MessageId=0xd +Severity=Informational +Facility=System +SymbolicName=STATUS_NULL_LM_PASSWORD +Language=English +{Password Too Complex} +The Windows password is too complex to be converted to a LAN Manager password. The LAN Manager password that returned is a NULL string. + +. +MessageId=0xe +Severity=Informational +Facility=System +SymbolicName=STATUS_IMAGE_MACHINE_TYPE_MISMATCH +Language=English +{Machine Type Mismatch} +The image file %hs is valid, but is for a machine type other than the current machine. + +. +MessageId=0xf +Severity=Informational +Facility=System +SymbolicName=STATUS_RECEIVE_PARTIAL +Language=English +{Partial Data Received} +The network transport returned partial data to its client. The remaining data will be sent later. + . MessageId=0x10 Severity=Informational @@ -1715,6 +1762,24 @@ SymbolicName=STATUS_INVALID_SECURITY_DESCR Language=English Indicates the SECURITY_DESCRIPTOR structure is not valid. +. +MessageId=0x7a +Severity=Error +Facility=System +SymbolicName=STATUS_PROCEDURE_NOT_FOUND +Language=English +Indicates the specified procedure address cannot be found in the DLL. + +. +MessageId=0x7b +Severity=Error +Facility=System +SymbolicName=STATUS_INVALID_IMAGE_FORMAT +Language=English +{Bad Image} +%hs is either not designed for ReactOS or it contains an error. +Try reinstalling the application using the original installation media or contact the software vendor for support. + . MessageId=0x7c Severity=Error diff --git a/include/reactos/mc/sacmsg.mc b/include/reactos/mc/sacmsg.mc new file mode 100644 index 00000000000..dce4a07f41f --- /dev/null +++ b/include/reactos/mc/sacmsg.mc @@ -0,0 +1,707 @@ +MessageId=1 +SymbolicName=SACDRV_1 +Language=English +Computer is booting, SAC started and initialized.\n\nUse the \"ch -?\" command for information about using channels.\nUse the \"?\" command for general help. +. + +MessageId=2 +SymbolicName=SACDRV_2 +Language=English + +. + +MessageId=3 +SymbolicName=SACDRV_3 +Language=English +SAC>%0 +. + +MessageId=4 +SymbolicName=SACDRV_4 +Language=English +The SAC is unavailable, it was directly unloaded. +. + +MessageId=5 +SymbolicName=SACDRV_5 +Language=English +The SAC will become unavailable soon. The computer is shutting down.\n +. + +MessageId=6 +SymbolicName=SACDRV_6 +Language=English +A parameter was incorrect or missing. Try the 'help' command for more details. +. + +MessageId=7 +SymbolicName=SACDRV_7 +Language=English +Thread information is now ON. +. + +MessageId=8 +SymbolicName=SACDRV_8 +Language=English +Thread information is now OFF. +. + +MessageId=9 +SymbolicName=SACDRV_9 +Language=English +Paging is now ON. +. + +MessageId=10 +SymbolicName=SACDRV_10 +Language=English +Paging is now OFF. +. + +MessageId=11 +SymbolicName=SACDRV_11 +Language=English +Paging is now OFF. +. + +MessageId=12 +SymbolicName=SACDRV_12 +Language=English +d Dump the current kernel log. +. + +MessageId=13 +SymbolicName=SACDRV_13 +Language=English +f Toggle detailed or abbreviated tlist info. +. + +MessageId=14 +SymbolicName=SACDRV_14 +Language=English +? or help Display this list. +. + +MessageId=15 +SymbolicName=SACDRV_15 +Language=English +i List all IP network numbers and their IP addresses. +. + +MessageId=16 +SymbolicName=SACDRV_16 +Language=English +i <#> Set IP addr., subnet and gateway. +. + +MessageId=18 +SymbolicName=SACDRV_18 +Language=English +k Kill the given process. +. + +MessageId=19 +SymbolicName=SACDRV_19 +Language=English +l Lower the priority of a process to the lowest possible. +. + +MessageId=20 +SymbolicName=SACDRV_20 +Language=English +m Limit the memory usage of a process to . +. + +MessageId=21 +SymbolicName=SACDRV_21 +Language=English +p Toggle paging the display. +. + +MessageId=22 +SymbolicName=SACDRV_22 +Language=English +r Raise the priority of a process by one. +. + +MessageId=23 +SymbolicName=SACDRV_23 +Language=English +s Display the current time and date (24 hour clock used). +. + +MessageId=24 +SymbolicName=SACDRV_24 +Language=English +s mm/dd/yyyy hh:mm Set the current time and date (24 hour clock used). +. + +MessageId=25 +SymbolicName=SACDRV_25 +Language=English +t Tlist. +. + +MessageId=27 +SymbolicName=SACDRV_27 +Language=English +restart Restart the system immediately. +. + +MessageId=28 +SymbolicName=SACDRV_28 +Language=English +shutdown Shutdown the system immediately. +. + +MessageId=29 +SymbolicName=SACDRV_29 +Language=English +crashdump Crash the system. You must have crash dump enabled. +. + +MessageId=31 +SymbolicName=SACDRV_31 +Language=English +id Display the computer identification information. +. + +MessageId=32 +SymbolicName=SACDRV_32 +Language=English +lock Lock access to Command Prompt channels. +. + +MessageId=48 +SymbolicName=SACDRV_48 +Language=English +Failed with status 0x%%X. +. + +MessageId=49 +SymbolicName=SACDRV_49 +Language=English +Date: %%02d/%%02d/%%02d Time (GMT): %%02d:%%02d:%%02d:%%04d +. + +MessageId=50 +SymbolicName=SACDRV_50 +Language=English +SAC could not retrieve the IP Address. +. + +MessageId=51 +SymbolicName=SACDRV_51 +Language=English +SAC could not clear the existing IP Address. +. + +MessageId=52 +SymbolicName=SACDRV_52 +Language=English +SAC could not set the IP Address. +. + +MessageId=54 +SymbolicName=SACDRV_54 +Language=English +SAC successfully set the IP Address, subnet mask, and gateway. +. + +MessageId=55 +SymbolicName=SACDRV_55 +Language=English +SAC failed to terminate the process. +. + +MessageId=56 +SymbolicName=SACDRV_56 +Language=English +SAC successfully terminated the process. +. + +MessageId=57 +SymbolicName=SACDRV_57 +Language=English +SAC failed to lower the process priority. +. + +MessageId=58 +SymbolicName=SACDRV_58 +Language=English +SAC successfully lowered the process priority. +. + +MessageId=59 +SymbolicName=SACDRV_59 +Language=English +SAC failed to raise the process priority. +. + +MessageId=60 +SymbolicName=SACDRV_60 +Language=English +SAC successfully raised the process priority. +. + +MessageId=61 +SymbolicName=SACDRV_61 +Language=English +SAC failed to limit the available process memory. +. + +MessageId=62 +SymbolicName=SACDRV_62 +Language=English +SAC successfully limited the available process memory. +. + +MessageId=63 +SymbolicName=SACDRV_63 +Language=English +SAC cannot raise the priority of a process that was not previously lowered. +. + +MessageId=64 +SymbolicName=SACDRV_64 +Language=English +SAC cannot raise the process priority any higher. +. + +MessageId=65 +SymbolicName=SACDRV_65 +Language=English +SAC failed to shutdown the system. +. + +MessageId=66 +SymbolicName=SACDRV_66 +Language=English +SAC failed to restart the system. +. + +MessageId=67 +SymbolicName=SACDRV_67 +Language=English +SAC failed to crashdump the system. +. + +MessageId=68 +SymbolicName=SACDRV_68 +Language=English +SAC failed to retrieve the task list. +. + +MessageId=69 +SymbolicName=SACDRV_69 +Language=English +memory: %%4ld kb uptime:%%3ld %%2ld:%%02ld:%%02ld.%%03ld\n\n +. + +MessageId=70 +SymbolicName=SACDRV_70 +Language=English +No pagefile in use. +. + +MessageId=71 +SymbolicName=SACDRV_71 +Language=English +PageFile: %%wZ +. + +MessageId=72 +SymbolicName=SACDRV_72 +Language=English + Current Size: %%6ld kb Total Used: %%6ld kb Peak Used %%6ld kb +. + +MessageId=73 +SymbolicName=SACDRV_73 +Language=English +\n Memory:%%7ldK Avail:%%7ldK TotalWs:%%7ldK InRam Kernel:%%5ldK P:%%5ldK +. + +MessageId=74 +SymbolicName=SACDRV_74 +Language=English + Commit:%%7ldK/%%7ldK Limit:%%7ldK Peak:%%7ldK Pool N:%%5ldK P:%%5ldK +. + +MessageId=75 +SymbolicName=SACDRV_75 +Language=English + User Time Kernel Time Ws Faults Commit Pri Hnd Thd Pid Name +. + +MessageId=76 +SymbolicName=SACDRV_76 +Language=English + %%6ld %%8ld File Cache +. + +MessageId=77 +SymbolicName=SACDRV_77 +Language=English +%%3ld:%%02ld:%%02ld.%%03ld %%3ld:%%02ld:%%02ld.%%03ld%%6ld %%8ld %%7ld %%2ld %%4ld %%3ld %%4ld %%wZ +. + +MessageId=78 +SymbolicName=SACDRV_78 +Language=English +%%3ld:%%02ld:%%02ld.%%03ld %%3ld:%%02ld:%%02ld.%%03ld +. + +MessageId=79 +SymbolicName=SACDRV_79 +Language=English +pid:%%3lx pri:%%2ld Hnd:%%5ld Pf:%%7ld Ws:%%7ldK %%wZ +. + +MessageId=80 +SymbolicName=SACDRV_80 +Language=English + tid pri Ctx Swtch StrtAddr User Time Kernel Time State +. + +MessageId=81 +SymbolicName=SACDRV_81 +Language=English + %%3lx %%2ld %%9ld %%p %%2ld:%%02ld:%%02ld.%%03ld %%2ld:%%02ld:%%02ld.%%03ld %%s%%s +. + +MessageId=82 +SymbolicName=SACDRV_82 +Language=English +----Press for more---- +. + +MessageId=83 +SymbolicName=SACDRV_83 +Language=English +SAC is retrieving IP Addresses... +. + +MessageId=84 +SymbolicName=SACDRV_84 +Language=English +Could not retrieve IP Address(es). +. + +MessageId=85 +SymbolicName=SACDRV_85 +Language=English +There are no IP Addresses available. +. + +MessageId=86 +SymbolicName=SACDRV_86 +Language=English +Net: %%d, Ip=%%d.%%d.%%d.%%d Subnet=%%d.%%d.%%d.%%d Gateway=%%d.%%d.%%d.%%d +. + +MessageId=87 +SymbolicName=SACDRV_87 +Language=English +Date: %%02d/%%02d/%%02d Time (GMT): %%02d:%%02d +. + +MessageId=88 +SymbolicName=SACDRV_88 +Language=English +The year is restricted from 1980 to 2099. +. + +MessageId=89 +SymbolicName=SACDRV_89 +Language=English +That process has been killed and is being cleaned up by the system. +. + +MessageId=90 +SymbolicName=SACDRV_90 +Language=English +A duplicate process id is being cleaned up by the system. Try the \ncommand again in a few seconds. +. + +MessageId=92 +SymbolicName=SACDRV_92 +Language=English + Computer Name: %%ws +. + +MessageId=93 +SymbolicName=SACDRV_93 +Language=English + Computer GUID: %%ws +. + +MessageId=94 +SymbolicName=SACDRV_94 +Language=English + Processor Architecture: %%ws +. + +MessageId=95 +SymbolicName=SACDRV_95 +Language=English + Build Number: %%ws +. + +MessageId=96 +SymbolicName=SACDRV_96 +Language=English + Product: %%ws +. + +MessageId=97 +SymbolicName=SACDRV_97 +Language=English + Applied Service Pack: %%ws +. + +MessageId=98 +SymbolicName=SACDRV_98 +Language=English +None%0 +. + +MessageId=99 +SymbolicName=SACDRV_99 +Language=English + Version Number: %%ws +. + +MessageId=100 +SymbolicName=SACDRV_100 +Language=English +Windows Server 2003 Datacenter Edition%0 +. + +MessageId=101 +SymbolicName=SACDRV_101 +Language=English +Windows Server 2003 Embedded%0 +. + +MessageId=102 +SymbolicName=SACDRV_102 +Language=English +Windows Server 2003 Enterprise Edition%0 +. + +MessageId=103 +SymbolicName=SACDRV_103 +Language=English +Windows Server 2003%0 +. + +MessageId=104 +SymbolicName=SACDRV_104 +Language=English +Computer identification information is unavailable. +. + +MessageId=105 +SymbolicName=SACDRV_105 +Language=English +Unrecognized command. Try the 'help' command for more details. +. + +MessageId=106 +SymbolicName=SACDRV_106 +Language=English +Error: The SAC channel cannot be closed. +. + +MessageId=107 +SymbolicName=SACDRV_107 +Language=English +Error: Could not find a channel with that name. +. + +MessageId=108 +SymbolicName=SACDRV_108 +Language=English +Channel List\n \n(Use \"ch -?\" for information on using channels)\n\n# Status Channel Name +. + +MessageId=109 +SymbolicName=SACDRV_109 +Language=English +EVENT: A new channel has been created. Use \"ch -?\" for channel help.\nChannel: %%s +. + +MessageId=110 +SymbolicName=SACDRV_110 +Language=English +EVENT: A channel has been closed.\nChannel: %%s +. + +MessageId=111 +SymbolicName=SACDRV_111 +Language=English +Name: %%s\nDescription: %%s\nType: %%s\nChannel GUID: %%08lx-%%04x-%%04x-%%02x%%02x-%%02x%%02x%%02x%%02x%%02x%%02x\nApplication Type GUID: %%08lx-%%04x-%%04x-%%02x%%02x-%%02x%%02x%%02x%%02x%%02x%%02x\n\nPress for next channel.\nPress 0 to return to the SAC channel.\nUse any other key to view this channel.\n +. + +MessageId=112 +SymbolicName=SACDRV_112 +Language=English +ch Channel management commands. Use ch -? for more help. +. + +MessageId=113 +SymbolicName=SACDRV_113 +Language=English + Time since last reboot: %%d:%%02d:%%02d +. + +MessageId=114 +SymbolicName=SACDRV_114 +Language=English +SAC preparing to restart the system. +. + +MessageId=115 +SymbolicName=SACDRV_115 +Language=English +SAC preparing to shutdown the system. +. + +MessageId=116 +SymbolicName=SACDRV_116 +Language=English +Error! Failed to remove channel! \n\nPlease contact your system administrator.\n +. + +MessageId=119 +SymbolicName=SACDRV_119 +Language=English +cmd Create a Command Prompt channel. +. + +MessageId=120 +SymbolicName=SACDRV_120 +Language=English +Timeout: Unable to launch a Command Prompt. The service responsible for \n launching Command Prompt channels has timed out. This may be \n because the service is malfunctioning or is unresponsive. +. + +MessageId=121 +SymbolicName=SACDRV_121 +Language=English +The Command Prompt session was successfully launched. +. + +MessageId=128 +SymbolicName=SACDRV_128 +Language=English +Error: The SAC Command Console session failed to be created. +. + +MessageId=131 +SymbolicName=SACDRV_131 +Language=English +Error: Unable to launch a Command Prompt. The service responsible for launching\n Command Prompt channels has not yet registered. This may be because the\n service is not yet started, is disabled by the administrator, is\n malfunctioning or is unresponsive. +. + +MessageId=132 +SymbolicName=SACDRV_132 +Language=English +EVENT: The CMD command is now available. +. + +MessageId=133 +SymbolicName=SACDRV_133 +Language=English +EVENT: The CMD command is unavailable. +. + +MessageId=134 +SymbolicName=SACDRV_134 +Language=English +EVENT: An attempt was made to close a channel but failed.\nChannel: %%s +. + +MessageId=135 +SymbolicName=SACDRV_135 +Language=English +EVENT: An attempt to close a channel failed because it is already closed.\nChannel: %%s +. + +MessageId=136 +SymbolicName=SACDRV_136 +Language=English +Channel management commands:\n\nch List all channels.\n\nStatus Legend: (AB)\nA: Channel operational status\n 'A' = Channel is active.\n 'I' = Channel is inactive.\nB: Channel Type\n 'V' = VT-UTF8 emulation.\n 'R' = Raw - no emulation.\n\nch -si <#> Switch to a channel by its number.\nch -sn Switch to a channel by its name.\nch -ci <#> Close a channel by its number.\nch -cn Close a channel by its name.\n\nPress to select a channel.\nPress 0 to return to the SAC channel. +. + +MessageId=137 +SymbolicName=SACDRV_137 +Language=English +Error: There is no channel present at the specified index. +. + +MessageId=144 +SymbolicName=SACDRV_144 +Language=English +SAC%0 +. + +MessageId=145 +SymbolicName=SACDRV_145 +Language=English +Special Administration Console%0 +. + +MessageId=146 +SymbolicName=SACDRV_146 +Language=English +Command Prompt%0 +. + +MessageId=147 +SymbolicName=SACDRV_147 +Language=English +Locked access to all Command Prompt channels. +. + +MessageId=148 +SymbolicName=SACDRV_148 +Language=English +Launching of Command Prompt channels is disabled. +. + +MessageId=149 +SymbolicName=SACDRV_149 +Language=English +The specified subnet mask is invalid. +. + +MessageId=150 +SymbolicName=SACDRV_150 +Language=English +Error, missing network interface number. +. + +MessageId=151 +SymbolicName=SACDRV_151 +Language=English +The specified IP address is invalid. +. + +MessageId=152 +SymbolicName=SACDRV_152 +Language=English +The specified gateway IP address is invalid. +. + +MessageId=153 +SymbolicName=SACDRV_153 +Language=English +not yet initialized%0 +. + +MessageId=154 +SymbolicName=SACDRV_154 +Language=English +The maximum number of channels has been reached. +. diff --git a/include/reactos/msvchelper.h b/include/reactos/msvchelper.h deleted file mode 100644 index bbd7627ff31..00000000000 --- a/include/reactos/msvchelper.h +++ /dev/null @@ -1,32 +0,0 @@ - -// -#ifdef _M_IX86 -void __stdcall wined3d_mutex_lock(void); -void __stdcall wined3d_mutex_unlock(void); -void* __stdcall WineDirect3DCreate(unsigned int dxVersion,void *parent); - -void __inline wined3d_mutex_lock_inline(void) -{ - wined3d_mutex_lock(); -} - -void __inline wined3d_mutex_unlock_inline(void) -{ - wined3d_mutex_unlock(); -} - -__inline -struct IWineD3D* WineDirect3DCreate_inline(unsigned int dxVersion,void *parent) -{ - return WineDirect3DCreate(dxVersion, parent); -} - -#define wined3d_mutex_lock wined3d_mutex_lock_inline -#define wined3d_mutex_unlock wined3d_mutex_unlock_inline -#define WineDirect3DCreate WineDirect3DCreate_inline - -#endif /* _M_IX86 */ - - - - diff --git a/include/reactos/rossym.h b/include/reactos/rossym.h index 4bdf02f0e5f..0c6c9d98f39 100644 --- a/include/reactos/rossym.h +++ b/include/reactos/rossym.h @@ -12,6 +12,10 @@ #define ROSSYM_SECTION_NAME ".rossym" +#ifdef __cplusplus +extern "C" { +#endif + typedef struct _ROSSYM_HEADER { unsigned long SymbolsOffset; unsigned long SymbolsLength; @@ -26,11 +30,84 @@ typedef struct _ROSSYM_ENTRY { ULONG SourceLine; } ROSSYM_ENTRY, *PROSSYM_ENTRY; +enum _ROSSYM_REGNAME { + ROSSYM_X86_EAX = 0, + ROSSYM_X86_ECX, + ROSSYM_X86_EDX, + ROSSYM_X86_EBX, + ROSSYM_X86_ESP, + ROSSYM_X86_EBP, + ROSSYM_X86_ESI, + ROSSYM_X86_EDI, + + ROSSYM_X64_RAX = 0, + ROSSYM_X64_RDX, + ROSSYM_X64_RCX, + ROSSYM_X64_RBX, + ROSSYM_X64_RSI, + ROSSYM_X64_RDI, + ROSSYM_X64_RBP, + ROSSYM_X64_RSP, + Rossym_X64_R8, + ROSSYM_X64_R9, + ROSSYM_X64_R10, + ROSSYM_X64_R11, + ROSSYM_X64_R12, + ROSSYM_X64_R13, + ROSSYM_X64_R14, + ROSSYM_X64_R15 +}; + +typedef struct _ROSSYM_REGISTERS { + ULONGLONG Registers[32]; +} ROSSYM_REGISTERS, *PROSSYM_REGISTERS; + +typedef struct _ROSSYM_PARAMETER { + ULONGLONG Value; + char *ValueName; +} ROSSYM_PARAMETER, *PROSSYM_PARAMETER; + +typedef enum _ROSSYM_LINEINFO_FLAGS { + ROSSYM_LINEINFO_HAS_REGISTERS = 1 +} ROSSYM_LINEINFO_FLAGS; + +typedef enum _ROSSYM_LINEINFO_TYPE { + ROSSYM_LINEINFO_UNKNOWN, + ROSSYM_LINEINFO_NARROW_STRING, + ROSSYM_LINEINFO_WIDE_STRING, + ROSSYM_LINEINFO_ANSI_STRING, + ROSSYM_LINEINFO_UNICODE_STRING, + ROSSYM_LINEINFO_HANDLE +} ROSSYM_LINEINFO_STRINGTYPE; + +typedef struct _ROSSYM_LINEINFO { + ROSSYM_LINEINFO_FLAGS Flags; + ULONG LineNumber; + char *FileName; + char *FunctionName; + ROSSYM_REGISTERS Registers; + ULONG NumParams; + ROSSYM_PARAMETER Parameters[16]; +} ROSSYM_LINEINFO, *PROSSYM_LINEINFO; + +typedef struct _ROSSYM_AGGREGATE_MEMBER { + PCHAR Name, Type; + ULONG BaseOffset, Size; + ULONG FirstBit, Bits; + ULONG TypeId; +} ROSSYM_AGGREGATE_MEMBER, *PROSSYM_AGGREGATE_MEMBER; + +typedef struct _ROSSYM_AGGREGATE { + ULONG NumElements; + PROSSYM_AGGREGATE_MEMBER Elements; +} ROSSYM_AGGREGATE, *PROSSYM_AGGREGATE; + typedef struct _ROSSYM_CALLBACKS { PVOID (*AllocMemProc)(ULONG_PTR Size); VOID (*FreeMemProc)(PVOID Area); BOOLEAN (*ReadFileProc)(PVOID FileContext, PVOID Buffer, ULONG Size); BOOLEAN (*SeekFileProc)(PVOID FileContext, ULONG_PTR Position); + BOOLEAN (*MemGetProc)(PVOID FileContext, ULONG_PTR *Target, PVOID SourceMem, ULONG Size); } ROSSYM_CALLBACKS, *PROSSYM_CALLBACKS; #ifdef __ROS_CMAKE__ @@ -46,7 +123,9 @@ typedef struct _ROSSYM_INFO *PROSSYM_INFO; #endif VOID RosSymInit(PROSSYM_CALLBACKS Callbacks); +#ifndef __ROS_CMAKE__ VOID RosSymInitKernelMode(VOID); +#endif VOID RosSymInitUserMode(VOID); BOOLEAN RosSymCreateFromRaw(PVOID RawData, ULONG_PTR DataSize, @@ -56,12 +135,26 @@ BOOLEAN RosSymCreateFromMem(PVOID ImageStart, ULONG_PTR ImageSize, BOOLEAN RosSymCreateFromFile(PVOID FileContext, PROSSYM_INFO *RosSymInfo); ULONG RosSymGetRawDataLength(PROSSYM_INFO RosSymInfo); VOID RosSymGetRawData(PROSSYM_INFO RosSymInfo, PVOID RawData); +#ifdef __ROS_CMAKE__ +BOOLEAN RosSymGetAddressInformation(PROSSYM_INFO RosSymInfo, + ULONG_PTR RelativeAddress, + PROSSYM_LINEINFO RosSymLineInfo); +#else BOOLEAN RosSymGetAddressInformation(PROSSYM_INFO RosSymInfo, ULONG_PTR RelativeAddress, ULONG *LineNumber, char *FileName, char *FunctionName); +#endif +VOID RosSymFreeInfo(PROSSYM_LINEINFO RosSymLineInfo); VOID RosSymDelete(PROSSYM_INFO RosSymInfo); +BOOLEAN +RosSymAggregate(PROSSYM_INFO RosSymInfo, PCHAR Type, PROSSYM_AGGREGATE Aggregate); +VOID RosSymFreeAggregate(PROSSYM_AGGREGATE Aggregate); + +#ifdef __cplusplus +} +#endif #endif /* REACTOS_ROSSYM_H_INCLUDED */ diff --git a/include/reactos/subsys/csrss/csrss.h b/include/reactos/subsys/csrss/csrss.h index 4c9f44fd43c..e8c37bbaba7 100644 --- a/include/reactos/subsys/csrss/csrss.h +++ b/include/reactos/subsys/csrss/csrss.h @@ -692,6 +692,75 @@ typedef struct _CSR_API_MESSAGE } Data; } CSR_API_MESSAGE, *PCSR_API_MESSAGE; +typedef struct _NLS_USER_INFO +{ + WCHAR iCountry[80]; + WCHAR sCountry[80]; + WCHAR sList[80]; + WCHAR iMeasure[80]; + WCHAR iPaperSize[80]; + WCHAR sDecimal[80]; + WCHAR sThousand[80]; + WCHAR sGrouping[80]; + WCHAR iDigits[80]; + WCHAR iLZero[80]; + WCHAR iNegNumber[80]; + WCHAR sNativeDigits[80]; + WCHAR iDigitSubstitution[80]; + WCHAR sCurrency[80]; + WCHAR sMonDecSep[80]; + WCHAR sMonThouSep[80]; + WCHAR sMonGrouping[80]; + WCHAR iCurrDigits[80]; + WCHAR iCurrency[80]; + WCHAR iNegCurr[80]; + WCHAR sPosSign[80]; + WCHAR sNegSign[80]; + WCHAR sTimeFormat[80]; + WCHAR s1159[80]; + WCHAR s2359[80]; + WCHAR sShortDate[80]; + WCHAR sYearMonth[80]; + WCHAR sLongDate[80]; + WCHAR iCalType[80]; + WCHAR iFirstDay[80]; + WCHAR iFirstWeek[80]; + WCHAR sLocale[80]; + WCHAR sLocaleName[85]; + LCID UserLocaleId; + LUID InteractiveUserLuid; + CHAR InteractiveUserSid[68]; // SECURITY_MAX_SID_SIZE to make ros happy + ULONG ulCacheUpdateCount; +} NLS_USER_INFO, *PNLS_USER_INFO; + + +typedef struct _BASE_STATIC_SERVER_DATA +{ + UNICODE_STRING WindowsDirectory; + UNICODE_STRING WindowsSystemDirectory; + UNICODE_STRING NamedObjectDirectory; + USHORT WindowsMajorVersion; + USHORT WindowsMinorVersion; + USHORT BuildNumber; + USHORT CSDNumber; + USHORT RCNumber; + WCHAR CSDVersion[128]; + SYSTEM_BASIC_INFORMATION SysInfo; + SYSTEM_TIMEOFDAY_INFORMATION TimeOfDay; + PVOID IniFileMapping; + NLS_USER_INFO NlsUserInfo; + BOOLEAN DefaultSeparateVDM; + BOOLEAN IsWowTaskReady; + UNICODE_STRING WindowsSys32x86Directory; + BOOLEAN fTermsrvAppInstallMode; + TIME_ZONE_INFORMATION tziTermsrvClientTimeZone; + KSYSTEM_TIME ktTermsrvClientBias; + ULONG TermsrvClientTimeZoneId; + BOOLEAN LUIDDeviceMapsEnabled; + ULONG TermsrvClientTimeZoneChangeNum; +} BASE_STATIC_SERVER_DATA, *PBASE_STATIC_SERVER_DATA; + + /* Types used in the new CSR. Temporarly here for proper compile of NTDLL */ #define CSR_SRV_SERVER 0 diff --git a/include/reactos/undocuser.h b/include/reactos/undocuser.h index 0fe8a816c1a..9209b29d848 100644 --- a/include/reactos/undocuser.h +++ b/include/reactos/undocuser.h @@ -82,6 +82,9 @@ #define LN_LOCK_WORKSTATION 0x5 #define LN_UNLOCK_WORKSTATION 0x6 #define LN_MESSAGE_BEEP 0x9 +#define LN_START_SCREENSAVE 0xA + +#define STARTF_SCRNSAVER 0x80000000 #define CW_USEDEFAULT16 ((short)0x8000) diff --git a/include/reactos/version.cmake b/include/reactos/version.cmake index f82bd5c3d84..57b156d7573 100644 --- a/include/reactos/version.cmake +++ b/include/reactos/version.cmake @@ -17,6 +17,7 @@ macro(inttohex INTVALUE OUTPUT_VARIABLE) endmacro() macro(converttohex INTVALUE OUTPUT_VARIABLE) + set(${OUTPUT_VARIABLE} "") set(REMAINING ${INTVALUE}) while(REMAINING) math(EXPR REMAINDER "${REMAINING}%16") diff --git a/include/reactos/version.rc b/include/reactos/version.rc index 9dca3cf6252..8f11454e5a0 100644 --- a/include/reactos/version.rc +++ b/include/reactos/version.rc @@ -20,7 +20,7 @@ #define REACTOS_DEFAULT_STR_COMPANY_NAME "ReactOS Development Team\0" #define REACTOS_DEFAULT_STR_DESCRIPTION "ReactOS Core Component\0" #define REACTOS_DEFAULT_STR_INTERNAL_NAME "\0" -#define REACTOS_DEFAULT_STR_LEGAL_COPYRIGHT "Copyright 1998-" COPYRIGHT_YEAR " ReactOS Team\0" +#define REACTOS_DEFAULT_STR_LEGAL_COPYRIGHT "Copyright 1998-"COPYRIGHT_YEAR" ReactOS Team\0" #define REACTOS_DEFAULT_STR_PRODUCT_NAME "ReactOS Operating System\0" /* Set defaults for everything, unless overridden */ diff --git a/include/reactos/win32k/ntgdibad.h b/include/reactos/win32k/ntgdibad.h index 3bbc3338c7e..1539ef5b8c8 100644 --- a/include/reactos/win32k/ntgdibad.h +++ b/include/reactos/win32k/ntgdibad.h @@ -111,19 +111,6 @@ NtGdiSetWindowOrgEx ( LPPOINT Point ); -/* Use SetDIBitsToDevice in gdi32. */ -INT -APIENTRY -NtGdiSetDIBits ( - HDC hDC, - HBITMAP hBitmap, - UINT StartScan, - UINT ScanLines, - CONST VOID * Bits, - CONST BITMAPINFO * bmi, - UINT ColorUse - ); - #endif /* WIN32K_NTGDI_BAD_INCLUDED */ diff --git a/include/reactos/win32k/ntuser.h b/include/reactos/win32k/ntuser.h index 432390a5fc7..2cb5987f4a0 100644 --- a/include/reactos/win32k/ntuser.h +++ b/include/reactos/win32k/ntuser.h @@ -3146,12 +3146,6 @@ NtUserBuildMenuItemList( ULONG nBufSize, DWORD Reserved); - -/* Should be done in usermode and use NtUserGetCPD. */ -ULONG_PTR -NTAPI -NtUserGetClassLong(HWND hWnd, INT Offset, BOOL Ansi); - UINT NTAPI NtUserGetMenuDefaultItem( @@ -3159,11 +3153,6 @@ NtUserGetMenuDefaultItem( UINT fByPos, UINT gmdiFlags); -BOOL -NTAPI -NtUserGetLastInputInfo( - PLASTINPUTINFO plii); - BOOL NTAPI NtUserGetMinMaxInfo( diff --git a/include/reactos/wine/CMakeLists.txt b/include/reactos/wine/CMakeLists.txt index d74cd51349e..f7bc58c49e7 100644 --- a/include/reactos/wine/CMakeLists.txt +++ b/include/reactos/wine/CMakeLists.txt @@ -1,9 +1,4 @@ -add_idl_headers(wineheaders itss.idl wined3d.idl) -add_idl_headers(winesdk epm.idl irot.idl) +add_idl_headers(wineheaders itss.idl) -add_rpc_library(epmrpc epm.idl) -add_rpc_library(irotrpc irot.idl) - -add_iid_library(wined3d_guid wined3d.idl) add_iid_library(itss_guid itss.idl) \ No newline at end of file diff --git a/include/reactos/wine/_alloca.h b/include/reactos/wine/_alloca.h deleted file mode 100644 index 265fecfb54f..00000000000 --- a/include/reactos/wine/_alloca.h +++ /dev/null @@ -1,2 +0,0 @@ - -#include diff --git a/include/reactos/wine/alloca.h b/include/reactos/wine/alloca.h new file mode 100644 index 00000000000..72972026fb8 --- /dev/null +++ b/include/reactos/wine/alloca.h @@ -0,0 +1,8 @@ + +#ifdef _MSC_VER +#include +#define alloca _alloca +#else +#include_next +#endif + diff --git a/include/reactos/wine/config.h b/include/reactos/wine/config.h index fb5f73814bb..40a6d559f0f 100644 --- a/include/reactos/wine/config.h +++ b/include/reactos/wine/config.h @@ -1014,11 +1014,15 @@ #define __ASM_CFI(str) str /* Define to a macro to define an assembly function */ +#ifndef _MSC_VER #ifndef NO_UNDERSCORE_PREFIX #define __ASM_DEFINE_FUNC(name,suffix,code) asm(".text\n\t.align 4\n\t.globl _" #name suffix "\n\t.def _" #name suffix "; .scl 2; .type 32; .endef\n_" #name suffix ":\n\t.cfi_startproc\n\t" code "\n\t.cfi_endproc"); #else #define __ASM_DEFINE_FUNC(name,suffix,code) asm(".text\n\t.align 4\n\t.globl " #name suffix "\n\t.def " #name suffix "; .scl 2; .type 32; .endef\n" #name suffix ":\n\t.cfi_startproc\n\t" code "\n\t.cfi_endproc"); #endif +#else +#define __ASM_DEFINE_FUNC(name,suffix,code) +#endif /* Define to a macro to generate an assembly function directive */ #define __ASM_FUNC(name) ".def " __ASM_NAME(name) "; .scl 2; .type 32; .endef" @@ -1039,7 +1043,9 @@ /* Define to a macro to generate an assembly function with stdcall calling convention */ +#ifndef _MSC_VER #define __ASM_STDCALL_FUNC(name,args,code) __ASM_DEFINE_FUNC(name,__ASM_STDCALL(args),code) +#endif /* Define to empty if `const' does not conform to ANSI C. */ /* #undef const */ diff --git a/include/reactos/wine/_math.h b/include/reactos/wine/math.h similarity index 100% rename from include/reactos/wine/_math.h rename to include/reactos/wine/math.h diff --git a/include/reactos/wine/port.h b/include/reactos/wine/port.h index 62e64e77379..0b253172ff5 100644 --- a/include/reactos/wine/port.h +++ b/include/reactos/wine/port.h @@ -57,19 +57,19 @@ # endif #endif -#ifndef HAVE_MODE_T +#if !defined(HAVE_MODE_T) && !defined(_MODE_T) typedef int mode_t; #endif -#ifndef HAVE_OFF_T +#if !defined(HAVE_OFF_T) && !defined(_OFF_T) typedef long off_t; #endif -#ifndef HAVE_PID_T +#if !defined(HAVE_PID_T) && !defined(_PID_T) typedef int pid_t; #endif -#ifndef HAVE_SIZE_T +#if !defined(HAVE_SIZE_T) && !defined(_SIZE_T) typedef unsigned int size_t; #endif -#ifndef HAVE_SSIZE_T +#if !defined(HAVE_SSIZE_T) && !defined(_SSIZE_T) typedef int ssize_t; #endif //#ifndef HAVE_SOCKLEN_T @@ -172,6 +172,8 @@ struct statfs; "\tnop\n" \ "\t.section \".text\",#alloc,#execinstr\n" ); } \ static void func(void) +#elif defined(_M_AMD64) +#pragma message("You must define the DECL_GLOBAL_CONSTRUCTOR macro for amd64") #else # error You must define the DECL_GLOBAL_CONSTRUCTOR macro for your platform #endif @@ -315,6 +317,17 @@ extern int spawnvp(int mode, const char *cmdname, const char * const argv[]); #endif /* __i386___ && __GNUC__ */ +#if defined(_MSC_VER) +__forceinline +int +ffs(int mask) +{ + long index; + if (_BitScanForward(&index, mask) == 0) return 0; + return index; +} +#endif + #else /* NO_LIBWINE_PORT */ #define __WINE_NOT_PORTABLE(func) func##_is_not_portable func##_is_not_portable diff --git a/include/reactos/wine/test.h b/include/reactos/wine/test.h index fdf3c886ec5..eb45ad653b1 100644 --- a/include/reactos/wine/test.h +++ b/include/reactos/wine/test.h @@ -488,7 +488,7 @@ const char *wine_dbgstr_wn( const WCHAR *str, int n ) case '\\': *dst++ = '\\'; *dst++ = '\\'; break; default: if (c >= ' ' && c <= 126) - *dst++ = c; + *dst++ = (char)c; else { *dst++ = '\\'; @@ -610,4 +610,7 @@ int main( int argc, char **argv ) #endif /* STANDALONE */ +// hack for ntdll winetest (this is defined in excpt.h) +#undef exception_info + #endif /* __WINE_WINE_TEST_H */ diff --git a/include/reactos/wine/unicode.h b/include/reactos/wine/unicode.h index 9e301888e41..1c742610d04 100644 --- a/include/reactos/wine/unicode.h +++ b/include/reactos/wine/unicode.h @@ -1,5 +1,12 @@ -#ifndef _WINE_UNICODE_H -#define _WINE_UNICODE_H +/* + * PROJECT: ReactOS + * LICENSE: LGPL v2.1 or any later version + * PURPOSE: Map Wine's Unicode functions to native wcs* functions wherever possible + * AUTHORS: ? + */ + +#ifndef __WINE_WINE_UNICODE_H +#define __WINE_WINE_UNICODE_H #include #include @@ -9,6 +16,14 @@ #include #include +#ifndef WINE_UNICODE_API +#define WINE_UNICODE_API +#endif + +#ifndef WINE_UNICODE_INLINE +#define WINE_UNICODE_INLINE static inline +#endif + #define memicmpW(s1,s2,n) _wcsnicmp((const wchar_t *)(s1),(const wchar_t *)(s2),(n)) #define strlenW(s) wcslen((const wchar_t *)(s)) #define strcpyW(d,s) wcscpy((wchar_t *)(d),(const wchar_t *)(s)) @@ -25,6 +40,7 @@ #define strncmpiW(s1,s2,n) _wcsnicmp((const wchar_t *)(s1),(const wchar_t *)(s2),(n)) #define strtoulW(s1,s2,b) wcstoul((const wchar_t *)(s1),(wchar_t **)(s2),(b)) #define strspnW(str, accept) wcsspn((const wchar_t *)(str), (const wchar_t *)(accept)) +#define strpbrkW(str, accept) wcspbrk((const wchar_t *)(str), (const wchar_t *)(accept)) #define tolowerW(n) towlower((n)) #define toupperW(n) towupper((n)) #define islowerW(n) iswlower((n)) @@ -45,28 +61,6 @@ #define vsnprintfW _vsnwprintf #define isprintW iswprint -#ifndef WINE_UNICODE_API -# if defined(_MSC_VER) -# define WINE_UNICODE_API __declspec(dllimport) -# else -# define WINE_UNICODE_API __attribute__((dllimport)) -# endif -#endif - -#ifndef __VALIST -#ifdef __GNUC__ -#define __VALIST __gnuc_va_list -#else -#define __VALIST char* -#endif -#endif /* defined __VALIST */ - -static __inline WCHAR *strpbrkW( const WCHAR *str, const WCHAR *accept ) -{ - for ( ; *str; str++) if (strchrW( accept, *str )) return (WCHAR *)str; - return NULL; -} - static __inline WCHAR *memchrW( const WCHAR *ptr, WCHAR ch, size_t n ) { const WCHAR *end; diff --git a/include/reactos/wine/wined3d.h b/include/reactos/wine/wined3d.h new file mode 100644 index 00000000000..ed269f006e9 --- /dev/null +++ b/include/reactos/wine/wined3d.h @@ -0,0 +1,2547 @@ +/* + * Copyright 2002-2003 The wine-d3d team + * Copyright 2002-2003 Jason Edmeades + * Copyright 2002-2003 Raphael Junqueira + * Copyright 2005 Oliver Stieber + * Copyright 2006 Stefan Dösinger + * Copyright 2006 Stefan Dösinger for CodeWeavers + * Copyright 2007 Henri Verbeet + * Copyright 2008 Henri Verbeet for CodeWeavers + * + * 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 __WINE_WINED3D_H +#define __WINE_WINED3D_H + +#define WINED3D_OK S_OK + +#define _FACWINED3D 0x876 +#define MAKE_WINED3DSTATUS(code) MAKE_HRESULT(0, _FACWINED3D, code) +#define WINED3DOK_NOAUTOGEN MAKE_WINED3DSTATUS(2159) + +#define MAKE_WINED3DHRESULT(code) MAKE_HRESULT(1, _FACWINED3D, code) +#define WINED3DERR_WRONGTEXTUREFORMAT MAKE_WINED3DHRESULT(2072) +#define WINED3DERR_UNSUPPORTEDCOLOROPERATION MAKE_WINED3DHRESULT(2073) +#define WINED3DERR_UNSUPPORTEDCOLORARG MAKE_WINED3DHRESULT(2074) +#define WINED3DERR_UNSUPPORTEDALPHAOPERATION MAKE_WINED3DHRESULT(2075) +#define WINED3DERR_UNSUPPORTEDALPHAARG MAKE_WINED3DHRESULT(2076) +#define WINED3DERR_TOOMANYOPERATIONS MAKE_WINED3DHRESULT(2077) +#define WINED3DERR_CONFLICTINGTEXTUREFILTER MAKE_WINED3DHRESULT(2078) +#define WINED3DERR_UNSUPPORTEDFACTORVALUE MAKE_WINED3DHRESULT(2079) +#define WINED3DERR_CONFLICTINGRENDERSTATE MAKE_WINED3DHRESULT(2081) +#define WINED3DERR_UNSUPPORTEDTEXTUREFILTER MAKE_WINED3DHRESULT(2082) +#define WINED3DERR_CONFLICTINGTEXTUREPALETTE MAKE_WINED3DHRESULT(2086) +#define WINED3DERR_DRIVERINTERNALERROR MAKE_WINED3DHRESULT(2087) +#define WINED3DERR_NOTFOUND MAKE_WINED3DHRESULT(2150) +#define WINED3DERR_MOREDATA MAKE_WINED3DHRESULT(2151) +#define WINED3DERR_DEVICELOST MAKE_WINED3DHRESULT(2152) +#define WINED3DERR_DEVICENOTRESET MAKE_WINED3DHRESULT(2153) +#define WINED3DERR_NOTAVAILABLE MAKE_WINED3DHRESULT(2154) +#define WINED3DERR_OUTOFVIDEOMEMORY MAKE_WINED3DHRESULT(380) +#define WINED3DERR_INVALIDDEVICE MAKE_WINED3DHRESULT(2155) +#define WINED3DERR_INVALIDCALL MAKE_WINED3DHRESULT(2156) +#define WINED3DERR_DRIVERINVALIDCALL MAKE_WINED3DHRESULT(2157) +#define WINED3DERR_WASSTILLDRAWING MAKE_WINED3DHRESULT(540) +#define WINEDDERR_NOTAOVERLAYSURFACE MAKE_WINED3DHRESULT(580) +#define WINEDDERR_NOTLOCKED MAKE_WINED3DHRESULT(584) +#define WINEDDERR_NODC MAKE_WINED3DHRESULT(586) +#define WINEDDERR_DCALREADYCREATED MAKE_WINED3DHRESULT(620) +#define WINEDDERR_NOTFLIPPABLE MAKE_WINED3DHRESULT(582) +#define WINEDDERR_SURFACEBUSY MAKE_WINED3DHRESULT(430) +#define WINEDDERR_INVALIDRECT MAKE_WINED3DHRESULT(150) +#define WINEDDERR_NOCLIPLIST MAKE_WINED3DHRESULT(205) +#define WINEDDERR_OVERLAYNOTVISIBLE MAKE_WINED3DHRESULT(577) + +typedef DWORD WINED3DCOLOR; + +typedef enum _WINED3DLIGHTTYPE +{ + WINED3DLIGHT_POINT = 1, + WINED3DLIGHT_SPOT = 2, + WINED3DLIGHT_DIRECTIONAL = 3, + WINED3DLIGHT_PARALLELPOINT = 4, /* D3D7 */ + WINED3DLIGHT_GLSPOT = 5, /* D3D7 */ + WINED3DLIGHT_FORCE_DWORD = 0x7fffffff +} WINED3DLIGHTTYPE; + +typedef enum _WINED3DPRIMITIVETYPE +{ + WINED3DPT_UNDEFINED = 0, + WINED3DPT_POINTLIST = 1, + WINED3DPT_LINELIST = 2, + WINED3DPT_LINESTRIP = 3, + WINED3DPT_TRIANGLELIST = 4, + WINED3DPT_TRIANGLESTRIP = 5, + WINED3DPT_TRIANGLEFAN = 6, + WINED3DPT_LINELIST_ADJ = 10, + WINED3DPT_LINESTRIP_ADJ = 11, + WINED3DPT_TRIANGLELIST_ADJ = 12, + WINED3DPT_TRIANGLESTRIP_ADJ = 13, + WINED3DPT_FORCE_DWORD = 0x7fffffff +} WINED3DPRIMITIVETYPE; + +typedef enum _WINED3DDEVTYPE +{ + WINED3DDEVTYPE_HAL = 1, + WINED3DDEVTYPE_REF = 2, + WINED3DDEVTYPE_SW = 3, + WINED3DDEVTYPE_NULLREF = 4, + WINED3DDEVTYPE_FORCE_DWORD = 0xffffffff +} WINED3DDEVTYPE; + +typedef enum _WINED3DDEGREETYPE +{ + WINED3DDEGREE_LINEAR = 1, + WINED3DDEGREE_QUADRATIC = 2, + WINED3DDEGREE_CUBIC = 3, + WINED3DDEGREE_QUINTIC = 5, + WINED3DDEGREE_FORCE_DWORD = 0x7fffffff +} WINED3DDEGREETYPE; + +#define WINEMAKEFOURCC(ch0, ch1, ch2, ch3) \ + ((DWORD)(BYTE)(ch0) | ((DWORD)(BYTE)(ch1) << 8) | \ + ((DWORD)(BYTE)(ch2) << 16) | ((DWORD)(BYTE)(ch3) << 24)) + +enum wined3d_format_id +{ + WINED3DFMT_UNKNOWN, + WINED3DFMT_B8G8R8_UNORM, + WINED3DFMT_B5G5R5X1_UNORM, + WINED3DFMT_B4G4R4A4_UNORM, + WINED3DFMT_B2G3R3_UNORM, + WINED3DFMT_B2G3R3A8_UNORM, + WINED3DFMT_B4G4R4X4_UNORM, + WINED3DFMT_R8G8B8X8_UNORM, + WINED3DFMT_B10G10R10A2_UNORM, + WINED3DFMT_P8_UINT_A8_UNORM, + WINED3DFMT_P8_UINT, + WINED3DFMT_L8_UNORM, + WINED3DFMT_L8A8_UNORM, + WINED3DFMT_L4A4_UNORM, + WINED3DFMT_R5G5_SNORM_L6_UNORM, + WINED3DFMT_R8G8_SNORM_L8X8_UNORM, + WINED3DFMT_R10G11B11_SNORM, + WINED3DFMT_R10G10B10_SNORM_A2_UNORM, + WINED3DFMT_D16_LOCKABLE, + WINED3DFMT_D32_UNORM, + WINED3DFMT_S1_UINT_D15_UNORM, + WINED3DFMT_X8D24_UNORM, + WINED3DFMT_S4X4_UINT_D24_UNORM, + WINED3DFMT_L16_UNORM, + WINED3DFMT_S8_UINT_D24_FLOAT, + WINED3DFMT_VERTEXDATA, + WINED3DFMT_R8G8_SNORM_Cx, + WINED3DFMT_R32G32B32A32_TYPELESS, + WINED3DFMT_R32G32B32A32_FLOAT, + WINED3DFMT_R32G32B32A32_UINT, + WINED3DFMT_R32G32B32A32_SINT, + WINED3DFMT_R32G32B32_TYPELESS, + WINED3DFMT_R32G32B32_FLOAT, + WINED3DFMT_R32G32B32_UINT, + WINED3DFMT_R32G32B32_SINT, + WINED3DFMT_R16G16B16A16_TYPELESS, + WINED3DFMT_R16G16B16A16_FLOAT, + WINED3DFMT_R16G16B16A16_UNORM, + WINED3DFMT_R16G16B16A16_UINT, + WINED3DFMT_R16G16B16A16_SNORM, + WINED3DFMT_R16G16B16A16_SINT, + WINED3DFMT_R32G32_TYPELESS, + WINED3DFMT_R32G32_FLOAT, + WINED3DFMT_R32G32_UINT, + WINED3DFMT_R32G32_SINT, + WINED3DFMT_R32G8X24_TYPELESS, + WINED3DFMT_D32_FLOAT_S8X24_UINT, + WINED3DFMT_R32_FLOAT_X8X24_TYPELESS, + WINED3DFMT_X32_TYPELESS_G8X24_UINT, + WINED3DFMT_R10G10B10A2_TYPELESS, + WINED3DFMT_R10G10B10A2_UNORM, + WINED3DFMT_R10G10B10A2_UINT, + WINED3DFMT_R10G10B10A2_SNORM, + WINED3DFMT_R11G11B10_FLOAT, + WINED3DFMT_R8G8B8A8_TYPELESS, + WINED3DFMT_R8G8B8A8_UNORM, + WINED3DFMT_R8G8B8A8_UNORM_SRGB, + WINED3DFMT_R8G8B8A8_UINT, + WINED3DFMT_R8G8B8A8_SNORM, + WINED3DFMT_R8G8B8A8_SINT, + WINED3DFMT_R16G16_TYPELESS, + WINED3DFMT_R16G16_FLOAT, + WINED3DFMT_R16G16_UNORM, + WINED3DFMT_R16G16_UINT, + WINED3DFMT_R16G16_SNORM, + WINED3DFMT_R16G16_SINT, + WINED3DFMT_R32_TYPELESS, + WINED3DFMT_D32_FLOAT, + WINED3DFMT_R32_FLOAT, + WINED3DFMT_R32_UINT, + WINED3DFMT_R32_SINT, + WINED3DFMT_R24G8_TYPELESS, + WINED3DFMT_D24_UNORM_S8_UINT, + WINED3DFMT_R24_UNORM_X8_TYPELESS, + WINED3DFMT_X24_TYPELESS_G8_UINT, + WINED3DFMT_R8G8_TYPELESS, + WINED3DFMT_R8G8_UNORM, + WINED3DFMT_R8G8_UINT, + WINED3DFMT_R8G8_SNORM, + WINED3DFMT_R8G8_SINT, + WINED3DFMT_R16_TYPELESS, + WINED3DFMT_R16_FLOAT, + WINED3DFMT_D16_UNORM, + WINED3DFMT_R16_UNORM, + WINED3DFMT_R16_UINT, + WINED3DFMT_R16_SNORM, + WINED3DFMT_R16_SINT, + WINED3DFMT_R8_TYPELESS, + WINED3DFMT_R8_UNORM, + WINED3DFMT_R8_UINT, + WINED3DFMT_R8_SNORM, + WINED3DFMT_R8_SINT, + WINED3DFMT_A8_UNORM, + WINED3DFMT_R1_UNORM, + WINED3DFMT_R9G9B9E5_SHAREDEXP, + WINED3DFMT_R8G8_B8G8_UNORM, + WINED3DFMT_G8R8_G8B8_UNORM, + WINED3DFMT_BC1_TYPELESS, + WINED3DFMT_BC1_UNORM, + WINED3DFMT_BC1_UNORM_SRGB, + WINED3DFMT_BC2_TYPELESS, + WINED3DFMT_BC2_UNORM, + WINED3DFMT_BC2_UNORM_SRGB, + WINED3DFMT_BC3_TYPELESS, + WINED3DFMT_BC3_UNORM, + WINED3DFMT_BC3_UNORM_SRGB, + WINED3DFMT_BC4_TYPELESS, + WINED3DFMT_BC4_UNORM, + WINED3DFMT_BC4_SNORM, + WINED3DFMT_BC5_TYPELESS, + WINED3DFMT_BC5_UNORM, + WINED3DFMT_BC5_SNORM, + WINED3DFMT_B5G6R5_UNORM, + WINED3DFMT_B5G5R5A1_UNORM, + WINED3DFMT_B8G8R8A8_UNORM, + WINED3DFMT_B8G8R8X8_UNORM, + /* FOURCC formats. */ + WINED3DFMT_UYVY = WINEMAKEFOURCC('U','Y','V','Y'), + WINED3DFMT_YUY2 = WINEMAKEFOURCC('Y','U','Y','2'), + WINED3DFMT_YV12 = WINEMAKEFOURCC('Y','V','1','2'), + WINED3DFMT_DXT1 = WINEMAKEFOURCC('D','X','T','1'), + WINED3DFMT_DXT2 = WINEMAKEFOURCC('D','X','T','2'), + WINED3DFMT_DXT3 = WINEMAKEFOURCC('D','X','T','3'), + WINED3DFMT_DXT4 = WINEMAKEFOURCC('D','X','T','4'), + WINED3DFMT_DXT5 = WINEMAKEFOURCC('D','X','T','5'), + WINED3DFMT_MULTI2_ARGB8 = WINEMAKEFOURCC('M','E','T','1'), + WINED3DFMT_G8R8_G8B8 = WINEMAKEFOURCC('G','R','G','B'), + WINED3DFMT_R8G8_B8G8 = WINEMAKEFOURCC('R','G','B','G'), + WINED3DFMT_ATI2N = WINEMAKEFOURCC('A','T','I','2'), + WINED3DFMT_INST = WINEMAKEFOURCC('I','N','S','T'), + WINED3DFMT_NVDB = WINEMAKEFOURCC('N','V','D','B'), + WINED3DFMT_NVHU = WINEMAKEFOURCC('N','V','H','U'), + WINED3DFMT_NVHS = WINEMAKEFOURCC('N','V','H','S'), + WINED3DFMT_INTZ = WINEMAKEFOURCC('I','N','T','Z'), + WINED3DFMT_NULL = WINEMAKEFOURCC('N','U','L','L'), + + WINED3DFMT_FORCE_DWORD = 0xffffffff +}; + +typedef enum _WINED3DRENDERSTATETYPE +{ + WINED3DRS_ANTIALIAS = 2, /* d3d7 */ + WINED3DRS_TEXTUREPERSPECTIVE = 4, /* d3d7 */ + WINED3DRS_WRAPU = 5, /* d3d7 */ + WINED3DRS_WRAPV = 6, /* d3d7 */ + WINED3DRS_ZENABLE = 7, + WINED3DRS_FILLMODE = 8, + WINED3DRS_SHADEMODE = 9, + WINED3DRS_LINEPATTERN = 10, /* d3d7, d3d8 */ + WINED3DRS_MONOENABLE = 11, /* d3d7 */ + WINED3DRS_ROP2 = 12, /* d3d7 */ + WINED3DRS_PLANEMASK = 13, /* d3d7 */ + WINED3DRS_ZWRITEENABLE = 14, + WINED3DRS_ALPHATESTENABLE = 15, + WINED3DRS_LASTPIXEL = 16, + WINED3DRS_SRCBLEND = 19, + WINED3DRS_DESTBLEND = 20, + WINED3DRS_CULLMODE = 22, + WINED3DRS_ZFUNC = 23, + WINED3DRS_ALPHAREF = 24, + WINED3DRS_ALPHAFUNC = 25, + WINED3DRS_DITHERENABLE = 26, + WINED3DRS_ALPHABLENDENABLE = 27, + WINED3DRS_FOGENABLE = 28, + WINED3DRS_SPECULARENABLE = 29, + WINED3DRS_ZVISIBLE = 30, /* d3d7, d3d8 */ + WINED3DRS_SUBPIXEL = 31, /* d3d7 */ + WINED3DRS_SUBPIXELX = 32, /* d3d7 */ + WINED3DRS_STIPPLEDALPHA = 33, /* d3d7 */ + WINED3DRS_FOGCOLOR = 34, + WINED3DRS_FOGTABLEMODE = 35, + WINED3DRS_FOGSTART = 36, + WINED3DRS_FOGEND = 37, + WINED3DRS_FOGDENSITY = 38, + WINED3DRS_STIPPLEENABLE = 39, /* d3d7 */ + WINED3DRS_EDGEANTIALIAS = 40, /* d3d7, d3d8 */ + WINED3DRS_COLORKEYENABLE = 41, /* d3d7 */ + WINED3DRS_MIPMAPLODBIAS = 46, /* d3d7 */ + WINED3DRS_RANGEFOGENABLE = 48, + WINED3DRS_ANISOTROPY = 49, /* d3d7 */ + WINED3DRS_FLUSHBATCH = 50, /* d3d7 */ + WINED3DRS_TRANSLUCENTSORTINDEPENDENT = 51, /* d3d7 */ + WINED3DRS_STENCILENABLE = 52, + WINED3DRS_STENCILFAIL = 53, + WINED3DRS_STENCILZFAIL = 54, + WINED3DRS_STENCILPASS = 55, + WINED3DRS_STENCILFUNC = 56, + WINED3DRS_STENCILREF = 57, + WINED3DRS_STENCILMASK = 58, + WINED3DRS_STENCILWRITEMASK = 59, + WINED3DRS_TEXTUREFACTOR = 60, + WINED3DRS_WRAP0 = 128, + WINED3DRS_WRAP1 = 129, + WINED3DRS_WRAP2 = 130, + WINED3DRS_WRAP3 = 131, + WINED3DRS_WRAP4 = 132, + WINED3DRS_WRAP5 = 133, + WINED3DRS_WRAP6 = 134, + WINED3DRS_WRAP7 = 135, + WINED3DRS_CLIPPING = 136, + WINED3DRS_LIGHTING = 137, + WINED3DRS_EXTENTS = 138, /* d3d7 */ + WINED3DRS_AMBIENT = 139, + WINED3DRS_FOGVERTEXMODE = 140, + WINED3DRS_COLORVERTEX = 141, + WINED3DRS_LOCALVIEWER = 142, + WINED3DRS_NORMALIZENORMALS = 143, + WINED3DRS_COLORKEYBLENDENABLE = 144, /* d3d7 */ + WINED3DRS_DIFFUSEMATERIALSOURCE = 145, + WINED3DRS_SPECULARMATERIALSOURCE = 146, + WINED3DRS_AMBIENTMATERIALSOURCE = 147, + WINED3DRS_EMISSIVEMATERIALSOURCE = 148, + WINED3DRS_VERTEXBLEND = 151, + WINED3DRS_CLIPPLANEENABLE = 152, + WINED3DRS_SOFTWAREVERTEXPROCESSING = 153, /* d3d8 */ + WINED3DRS_POINTSIZE = 154, + WINED3DRS_POINTSIZE_MIN = 155, + WINED3DRS_POINTSPRITEENABLE = 156, + WINED3DRS_POINTSCALEENABLE = 157, + WINED3DRS_POINTSCALE_A = 158, + WINED3DRS_POINTSCALE_B = 159, + WINED3DRS_POINTSCALE_C = 160, + WINED3DRS_MULTISAMPLEANTIALIAS = 161, + WINED3DRS_MULTISAMPLEMASK = 162, + WINED3DRS_PATCHEDGESTYLE = 163, + WINED3DRS_PATCHSEGMENTS = 164, /* d3d8 */ + WINED3DRS_DEBUGMONITORTOKEN = 165, + WINED3DRS_POINTSIZE_MAX = 166, + WINED3DRS_INDEXEDVERTEXBLENDENABLE = 167, + WINED3DRS_COLORWRITEENABLE = 168, + WINED3DRS_TWEENFACTOR = 170, + WINED3DRS_BLENDOP = 171, + WINED3DRS_POSITIONDEGREE = 172, + WINED3DRS_NORMALDEGREE = 173, + WINED3DRS_SCISSORTESTENABLE = 174, + WINED3DRS_SLOPESCALEDEPTHBIAS = 175, + WINED3DRS_ANTIALIASEDLINEENABLE = 176, + WINED3DRS_MINTESSELLATIONLEVEL = 178, + WINED3DRS_MAXTESSELLATIONLEVEL = 179, + WINED3DRS_ADAPTIVETESS_X = 180, + WINED3DRS_ADAPTIVETESS_Y = 181, + WINED3DRS_ADAPTIVETESS_Z = 182, + WINED3DRS_ADAPTIVETESS_W = 183, + WINED3DRS_ENABLEADAPTIVETESSELLATION = 184, + WINED3DRS_TWOSIDEDSTENCILMODE = 185, + WINED3DRS_CCW_STENCILFAIL = 186, + WINED3DRS_CCW_STENCILZFAIL = 187, + WINED3DRS_CCW_STENCILPASS = 188, + WINED3DRS_CCW_STENCILFUNC = 189, + WINED3DRS_COLORWRITEENABLE1 = 190, + WINED3DRS_COLORWRITEENABLE2 = 191, + WINED3DRS_COLORWRITEENABLE3 = 192, + WINED3DRS_BLENDFACTOR = 193, + WINED3DRS_SRGBWRITEENABLE = 194, + WINED3DRS_DEPTHBIAS = 195, + WINED3DRS_WRAP8 = 198, + WINED3DRS_WRAP9 = 199, + WINED3DRS_WRAP10 = 200, + WINED3DRS_WRAP11 = 201, + WINED3DRS_WRAP12 = 202, + WINED3DRS_WRAP13 = 203, + WINED3DRS_WRAP14 = 204, + WINED3DRS_WRAP15 = 205, + WINED3DRS_SEPARATEALPHABLENDENABLE = 206, + WINED3DRS_SRCBLENDALPHA = 207, + WINED3DRS_DESTBLENDALPHA = 208, + WINED3DRS_BLENDOPALPHA = 209, + WINED3DRS_FORCE_DWORD = 0x7fffffff +} WINED3DRENDERSTATETYPE; +#define WINEHIGHEST_RENDER_STATE WINED3DRS_BLENDOPALPHA + +typedef enum _WINED3DBLEND +{ + WINED3DBLEND_ZERO = 1, + WINED3DBLEND_ONE = 2, + WINED3DBLEND_SRCCOLOR = 3, + WINED3DBLEND_INVSRCCOLOR = 4, + WINED3DBLEND_SRCALPHA = 5, + WINED3DBLEND_INVSRCALPHA = 6, + WINED3DBLEND_DESTALPHA = 7, + WINED3DBLEND_INVDESTALPHA = 8, + WINED3DBLEND_DESTCOLOR = 9, + WINED3DBLEND_INVDESTCOLOR = 10, + WINED3DBLEND_SRCALPHASAT = 11, + WINED3DBLEND_BOTHSRCALPHA = 12, + WINED3DBLEND_BOTHINVSRCALPHA = 13, + WINED3DBLEND_BLENDFACTOR = 14, + WINED3DBLEND_INVBLENDFACTOR = 15, + WINED3DBLEND_FORCE_DWORD = 0x7fffffff +} WINED3DBLEND; + +typedef enum _WINED3DBLENDOP +{ + WINED3DBLENDOP_ADD = 1, + WINED3DBLENDOP_SUBTRACT = 2, + WINED3DBLENDOP_REVSUBTRACT = 3, + WINED3DBLENDOP_MIN = 4, + WINED3DBLENDOP_MAX = 5, + WINED3DBLENDOP_FORCE_DWORD = 0x7fffffff +} WINED3DBLENDOP; + +typedef enum _WINED3DVERTEXBLENDFLAGS +{ + WINED3DVBF_DISABLE = 0, + WINED3DVBF_1WEIGHTS = 1, + WINED3DVBF_2WEIGHTS = 2, + WINED3DVBF_3WEIGHTS = 3, + WINED3DVBF_TWEENING = 255, + WINED3DVBF_0WEIGHTS = 256 +} WINED3DVERTEXBLENDFLAGS; + +typedef enum _WINED3DCMPFUNC +{ + WINED3DCMP_NEVER = 1, + WINED3DCMP_LESS = 2, + WINED3DCMP_EQUAL = 3, + WINED3DCMP_LESSEQUAL = 4, + WINED3DCMP_GREATER = 5, + WINED3DCMP_NOTEQUAL = 6, + WINED3DCMP_GREATEREQUAL = 7, + WINED3DCMP_ALWAYS = 8, + WINED3DCMP_FORCE_DWORD = 0x7fffffff +} WINED3DCMPFUNC; + +typedef enum _WINED3DZBUFFERTYPE +{ + WINED3DZB_FALSE = 0, + WINED3DZB_TRUE = 1, + WINED3DZB_USEW = 2, + WINED3DZB_FORCE_DWORD = 0x7fffffff +} WINED3DZBUFFERTYPE; + +typedef enum _WINED3DFOGMODE +{ + WINED3DFOG_NONE = 0, + WINED3DFOG_EXP = 1, + WINED3DFOG_EXP2 = 2, + WINED3DFOG_LINEAR = 3, + WINED3DFOG_FORCE_DWORD = 0x7fffffff +} WINED3DFOGMODE; + +typedef enum _WINED3DSHADEMODE +{ + WINED3DSHADE_FLAT = 1, + WINED3DSHADE_GOURAUD = 2, + WINED3DSHADE_PHONG = 3, + WINED3DSHADE_FORCE_DWORD = 0x7fffffff +} WINED3DSHADEMODE; + +typedef enum _WINED3DFILLMODE +{ + WINED3DFILL_POINT = 1, + WINED3DFILL_WIREFRAME = 2, + WINED3DFILL_SOLID = 3, + WINED3DFILL_FORCE_DWORD = 0x7fffffff +} WINED3DFILLMODE; + +typedef enum _WINED3DCULL +{ + WINED3DCULL_NONE = 1, + WINED3DCULL_CW = 2, + WINED3DCULL_CCW = 3, + WINED3DCULL_FORCE_DWORD = 0x7fffffff +} WINED3DCULL; + +typedef enum _WINED3DSTENCILOP +{ + WINED3DSTENCILOP_KEEP = 1, + WINED3DSTENCILOP_ZERO = 2, + WINED3DSTENCILOP_REPLACE = 3, + WINED3DSTENCILOP_INCRSAT = 4, + WINED3DSTENCILOP_DECRSAT = 5, + WINED3DSTENCILOP_INVERT = 6, + WINED3DSTENCILOP_INCR = 7, + WINED3DSTENCILOP_DECR = 8, + WINED3DSTENCILOP_FORCE_DWORD = 0x7fffffff +} WINED3DSTENCILOP; + +typedef enum _WINED3DMATERIALCOLORSOURCE +{ + WINED3DMCS_MATERIAL = 0, + WINED3DMCS_COLOR1 = 1, + WINED3DMCS_COLOR2 = 2, + WINED3DMCS_FORCE_DWORD = 0x7fffffff +} WINED3DMATERIALCOLORSOURCE; + +typedef enum _WINED3DPATCHEDGESTYLE +{ + WINED3DPATCHEDGE_DISCRETE = 0, + WINED3DPATCHEDGE_CONTINUOUS = 1, + WINED3DPATCHEDGE_FORCE_DWORD = 0x7fffffff +} WINED3DPATCHEDGESTYLE; + +typedef enum _WINED3DBACKBUFFER_TYPE +{ + WINED3DBACKBUFFER_TYPE_MONO = 0, + WINED3DBACKBUFFER_TYPE_LEFT = 1, + WINED3DBACKBUFFER_TYPE_RIGHT = 2, + WINED3DBACKBUFFER_TYPE_FORCE_DWORD = 0x7fffffff +} WINED3DBACKBUFFER_TYPE; + +typedef enum _WINED3DSWAPEFFECT +{ + WINED3DSWAPEFFECT_DISCARD = 1, + WINED3DSWAPEFFECT_FLIP = 2, + WINED3DSWAPEFFECT_COPY = 3, + WINED3DSWAPEFFECT_COPY_VSYNC = 4, + WINED3DSWAPEFFECT_FORCE_DWORD = 0xffffffff +} WINED3DSWAPEFFECT; + +typedef enum _WINED3DSAMPLERSTATETYPE +{ + WINED3DSAMP_ADDRESSU = 1, + WINED3DSAMP_ADDRESSV = 2, + WINED3DSAMP_ADDRESSW = 3, + WINED3DSAMP_BORDERCOLOR = 4, + WINED3DSAMP_MAGFILTER = 5, + WINED3DSAMP_MINFILTER = 6, + WINED3DSAMP_MIPFILTER = 7, + WINED3DSAMP_MIPMAPLODBIAS = 8, + WINED3DSAMP_MAXMIPLEVEL = 9, + WINED3DSAMP_MAXANISOTROPY = 10, + WINED3DSAMP_SRGBTEXTURE = 11, + WINED3DSAMP_ELEMENTINDEX = 12, + WINED3DSAMP_DMAPOFFSET = 13, + WINED3DSAMP_FORCE_DWORD = 0x7fffffff, +} WINED3DSAMPLERSTATETYPE; +#define WINED3D_HIGHEST_SAMPLER_STATE WINED3DSAMP_DMAPOFFSET + +typedef enum _WINED3DMULTISAMPLE_TYPE +{ + WINED3DMULTISAMPLE_NONE = 0, + WINED3DMULTISAMPLE_NONMASKABLE = 1, + WINED3DMULTISAMPLE_2_SAMPLES = 2, + WINED3DMULTISAMPLE_3_SAMPLES = 3, + WINED3DMULTISAMPLE_4_SAMPLES = 4, + WINED3DMULTISAMPLE_5_SAMPLES = 5, + WINED3DMULTISAMPLE_6_SAMPLES = 6, + WINED3DMULTISAMPLE_7_SAMPLES = 7, + WINED3DMULTISAMPLE_8_SAMPLES = 8, + WINED3DMULTISAMPLE_9_SAMPLES = 9, + WINED3DMULTISAMPLE_10_SAMPLES = 10, + WINED3DMULTISAMPLE_11_SAMPLES = 11, + WINED3DMULTISAMPLE_12_SAMPLES = 12, + WINED3DMULTISAMPLE_13_SAMPLES = 13, + WINED3DMULTISAMPLE_14_SAMPLES = 14, + WINED3DMULTISAMPLE_15_SAMPLES = 15, + WINED3DMULTISAMPLE_16_SAMPLES = 16, + WINED3DMULTISAMPLE_FORCE_DWORD = 0xffffffff +} WINED3DMULTISAMPLE_TYPE; + +typedef enum _WINED3DTEXTURESTAGESTATETYPE +{ + WINED3DTSS_COLOROP = 0, + WINED3DTSS_COLORARG1 = 1, + WINED3DTSS_COLORARG2 = 2, + WINED3DTSS_ALPHAOP = 3, + WINED3DTSS_ALPHAARG1 = 4, + WINED3DTSS_ALPHAARG2 = 5, + WINED3DTSS_BUMPENVMAT00 = 6, + WINED3DTSS_BUMPENVMAT01 = 7, + WINED3DTSS_BUMPENVMAT10 = 8, + WINED3DTSS_BUMPENVMAT11 = 9, + WINED3DTSS_TEXCOORDINDEX = 10, + WINED3DTSS_BUMPENVLSCALE = 11, + WINED3DTSS_BUMPENVLOFFSET = 12, + WINED3DTSS_TEXTURETRANSFORMFLAGS = 13, + WINED3DTSS_COLORARG0 = 14, + WINED3DTSS_ALPHAARG0 = 15, + WINED3DTSS_RESULTARG = 16, + WINED3DTSS_CONSTANT = 17, + WINED3DTSS_FORCE_DWORD = 0x7fffffff +} WINED3DTEXTURESTAGESTATETYPE; +#define WINED3D_HIGHEST_TEXTURE_STATE WINED3DTSS_CONSTANT + +typedef enum _WINED3DTEXTURETRANSFORMFLAGS +{ + WINED3DTTFF_DISABLE = 0, + WINED3DTTFF_COUNT1 = 1, + WINED3DTTFF_COUNT2 = 2, + WINED3DTTFF_COUNT3 = 3, + WINED3DTTFF_COUNT4 = 4, + WINED3DTTFF_PROJECTED = 256, + WINED3DTTFF_FORCE_DWORD = 0x7fffffff +} WINED3DTEXTURETRANSFORMFLAGS; + +typedef enum _WINED3DTEXTUREOP +{ + WINED3DTOP_DISABLE = 1, + WINED3DTOP_SELECTARG1 = 2, + WINED3DTOP_SELECTARG2 = 3, + WINED3DTOP_MODULATE = 4, + WINED3DTOP_MODULATE2X = 5, + WINED3DTOP_MODULATE4X = 6, + WINED3DTOP_ADD = 7, + WINED3DTOP_ADDSIGNED = 8, + WINED3DTOP_ADDSIGNED2X = 9, + WINED3DTOP_SUBTRACT = 10, + WINED3DTOP_ADDSMOOTH = 11, + WINED3DTOP_BLENDDIFFUSEALPHA = 12, + WINED3DTOP_BLENDTEXTUREALPHA = 13, + WINED3DTOP_BLENDFACTORALPHA = 14, + WINED3DTOP_BLENDTEXTUREALPHAPM = 15, + WINED3DTOP_BLENDCURRENTALPHA = 16, + WINED3DTOP_PREMODULATE = 17, + WINED3DTOP_MODULATEALPHA_ADDCOLOR = 18, + WINED3DTOP_MODULATECOLOR_ADDALPHA = 19, + WINED3DTOP_MODULATEINVALPHA_ADDCOLOR = 20, + WINED3DTOP_MODULATEINVCOLOR_ADDALPHA = 21, + WINED3DTOP_BUMPENVMAP = 22, + WINED3DTOP_BUMPENVMAPLUMINANCE = 23, + WINED3DTOP_DOTPRODUCT3 = 24, + WINED3DTOP_MULTIPLYADD = 25, + WINED3DTOP_LERP = 26, + WINED3DTOP_FORCE_DWORD = 0x7fffffff, +} WINED3DTEXTUREOP; + +typedef enum _WINED3DTEXTUREADDRESS +{ + WINED3DTADDRESS_WRAP = 1, + WINED3DTADDRESS_MIRROR = 2, + WINED3DTADDRESS_CLAMP = 3, + WINED3DTADDRESS_BORDER = 4, + WINED3DTADDRESS_MIRRORONCE = 5, + WINED3DTADDRESS_FORCE_DWORD = 0x7fffffff +} WINED3DTEXTUREADDRESS; + +typedef enum _WINED3DTRANSFORMSTATETYPE +{ + WINED3DTS_VIEW = 2, + WINED3DTS_PROJECTION = 3, + WINED3DTS_TEXTURE0 = 16, + WINED3DTS_TEXTURE1 = 17, + WINED3DTS_TEXTURE2 = 18, + WINED3DTS_TEXTURE3 = 19, + WINED3DTS_TEXTURE4 = 20, + WINED3DTS_TEXTURE5 = 21, + WINED3DTS_TEXTURE6 = 22, + WINED3DTS_TEXTURE7 = 23, + WINED3DTS_WORLD = 256, /*WINED3DTS_WORLDMATRIX(0)*/ + WINED3DTS_WORLD1 = 257, + WINED3DTS_WORLD2 = 258, + WINED3DTS_WORLD3 = 259, + WINED3DTS_FORCE_DWORD = 0x7fffffff +} WINED3DTRANSFORMSTATETYPE; + +#define WINED3DTS_WORLDMATRIX(index) (WINED3DTRANSFORMSTATETYPE)(index + 256) + +typedef enum _WINED3DBASISTYPE +{ + WINED3DBASIS_BEZIER = 0, + WINED3DBASIS_BSPLINE = 1, + WINED3DBASIS_INTERPOLATE = 2, + WINED3DBASIS_FORCE_DWORD = 0x7fffffff +} WINED3DBASISTYPE; + +typedef enum _WINED3DCUBEMAP_FACES +{ + WINED3DCUBEMAP_FACE_POSITIVE_X = 0, + WINED3DCUBEMAP_FACE_NEGATIVE_X = 1, + WINED3DCUBEMAP_FACE_POSITIVE_Y = 2, + WINED3DCUBEMAP_FACE_NEGATIVE_Y = 3, + WINED3DCUBEMAP_FACE_POSITIVE_Z = 4, + WINED3DCUBEMAP_FACE_NEGATIVE_Z = 5, + WINED3DCUBEMAP_FACE_FORCE_DWORD = 0xffffffff +} WINED3DCUBEMAP_FACES; + +typedef enum _WINED3DTEXTUREFILTERTYPE +{ + WINED3DTEXF_NONE = 0, + WINED3DTEXF_POINT = 1, + WINED3DTEXF_LINEAR = 2, + WINED3DTEXF_ANISOTROPIC = 3, + WINED3DTEXF_FLATCUBIC = 4, + WINED3DTEXF_GAUSSIANCUBIC = 5, + WINED3DTEXF_PYRAMIDALQUAD = 6, + WINED3DTEXF_GAUSSIANQUAD = 7, + WINED3DTEXF_FORCE_DWORD = 0x7fffffff +} WINED3DTEXTUREFILTERTYPE; + +typedef enum _WINED3DRESOURCETYPE +{ + WINED3DRTYPE_SURFACE = 1, + WINED3DRTYPE_VOLUME = 2, + WINED3DRTYPE_TEXTURE = 3, + WINED3DRTYPE_VOLUMETEXTURE = 4, + WINED3DRTYPE_CUBETEXTURE = 5, + WINED3DRTYPE_BUFFER = 6, + WINED3DRTYPE_FORCE_DWORD = 0x7fffffff +} WINED3DRESOURCETYPE; +#define WINED3DRTYPECOUNT WINED3DRTYPE_BUFFER + +typedef enum _WINED3DPOOL +{ + WINED3DPOOL_DEFAULT = 0, + WINED3DPOOL_MANAGED = 1, + WINED3DPOOL_SYSTEMMEM = 2, + WINED3DPOOL_SCRATCH = 3, + WINED3DPOOL_FORCE_DWORD = 0x7fffffff +} WINED3DPOOL; + +typedef enum _WINED3DQUERYTYPE +{ + WINED3DQUERYTYPE_VCACHE = 4, + WINED3DQUERYTYPE_RESOURCEMANAGER = 5, + WINED3DQUERYTYPE_VERTEXSTATS = 6, + WINED3DQUERYTYPE_EVENT = 8, + WINED3DQUERYTYPE_OCCLUSION = 9, + WINED3DQUERYTYPE_TIMESTAMP = 10, + WINED3DQUERYTYPE_TIMESTAMPDISJOINT = 11, + WINED3DQUERYTYPE_TIMESTAMPFREQ = 12, + WINED3DQUERYTYPE_PIPELINETIMINGS = 13, + WINED3DQUERYTYPE_INTERFACETIMINGS = 14, + WINED3DQUERYTYPE_VERTEXTIMINGS = 15, + WINED3DQUERYTYPE_PIXELTIMINGS = 16, + WINED3DQUERYTYPE_BANDWIDTHTIMINGS = 17, + WINED3DQUERYTYPE_CACHEUTILIZATION = 18 +} WINED3DQUERYTYPE; + +#define WINED3DISSUE_BEGIN (1 << 1) +#define WINED3DISSUE_END (1 << 0) +#define WINED3DGETDATA_FLUSH (1 << 0) + +typedef enum _WINED3DSTATEBLOCKTYPE +{ + WINED3DSBT_INIT = 0, + WINED3DSBT_ALL = 1, + WINED3DSBT_PIXELSTATE = 2, + WINED3DSBT_VERTEXSTATE = 3, + WINED3DSBT_RECORDED = 4, /* WineD3D private */ + WINED3DSBT_FORCE_DWORD = 0xffffffff +} WINED3DSTATEBLOCKTYPE; + +typedef enum _WINED3DDECLMETHOD +{ + WINED3DDECLMETHOD_DEFAULT = 0, + WINED3DDECLMETHOD_PARTIALU = 1, + WINED3DDECLMETHOD_PARTIALV = 2, + WINED3DDECLMETHOD_CROSSUV = 3, + WINED3DDECLMETHOD_UV = 4, + WINED3DDECLMETHOD_LOOKUP = 5, + WINED3DDECLMETHOD_LOOKUPPRESAMPLED = 6 +} WINED3DDECLMETHOD; + +typedef enum _WINED3DDECLUSAGE +{ + WINED3DDECLUSAGE_POSITION = 0, + WINED3DDECLUSAGE_BLENDWEIGHT = 1, + WINED3DDECLUSAGE_BLENDINDICES = 2, + WINED3DDECLUSAGE_NORMAL = 3, + WINED3DDECLUSAGE_PSIZE = 4, + WINED3DDECLUSAGE_TEXCOORD = 5, + WINED3DDECLUSAGE_TANGENT = 6, + WINED3DDECLUSAGE_BINORMAL = 7, + WINED3DDECLUSAGE_TESSFACTOR = 8, + WINED3DDECLUSAGE_POSITIONT = 9, + WINED3DDECLUSAGE_COLOR = 10, + WINED3DDECLUSAGE_FOG = 11, + WINED3DDECLUSAGE_DEPTH = 12, + WINED3DDECLUSAGE_SAMPLE = 13 +} WINED3DDECLUSAGE; + +typedef enum _WINED3DSURFTYPE +{ + SURFACE_UNKNOWN = 0, /* Default / Unknown surface type */ + SURFACE_OPENGL, /* OpenGL surface: Renders using libGL, needed for 3D */ + SURFACE_GDI, /* User surface. No 3D, DirectDraw rendering with GDI */ +} WINED3DSURFTYPE; + +enum wined3d_sysval_semantic +{ + WINED3D_SV_DEPTH = 0xffffffff, + WINED3D_SV_TARGET0 = 0, + WINED3D_SV_TARGET1 = 1, + WINED3D_SV_TARGET2 = 2, + WINED3D_SV_TARGET3 = 3, + WINED3D_SV_TARGET4 = 4, + WINED3D_SV_TARGET5 = 5, + WINED3D_SV_TARGET6 = 6, + WINED3D_SV_TARGET7 = 7, +}; + +#define WINED3DCOLORWRITEENABLE_RED (1 << 0) +#define WINED3DCOLORWRITEENABLE_GREEN (1 << 1) +#define WINED3DCOLORWRITEENABLE_BLUE (1 << 2) +#define WINED3DCOLORWRITEENABLE_ALPHA (1 << 3) + +#define WINED3DADAPTER_DEFAULT 0 +#define WINED3DENUM_NO_WHQL_LEVEL 2 +#define WINED3DPRESENT_BACK_BUFFER_MAX 3 + +#define WINED3DTSS_TCI_PASSTHRU 0x00000 +#define WINED3DTSS_TCI_CAMERASPACENORMAL 0x10000 +#define WINED3DTSS_TCI_CAMERASPACEPOSITION 0x20000 +#define WINED3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR 0x30000 +#define WINED3DTSS_TCI_SPHEREMAP 0x40000 + +#define WINED3DTA_SELECTMASK 0x0000000f +#define WINED3DTA_DIFFUSE 0x00000000 +#define WINED3DTA_CURRENT 0x00000001 +#define WINED3DTA_TEXTURE 0x00000002 +#define WINED3DTA_TFACTOR 0x00000003 +#define WINED3DTA_SPECULAR 0x00000004 +#define WINED3DTA_TEMP 0x00000005 +#define WINED3DTA_CONSTANT 0x00000006 +#define WINED3DTA_COMPLEMENT 0x00000010 +#define WINED3DTA_ALPHAREPLICATE 0x00000020 + +#define WINED3DPRESENTFLAG_LOCKABLE_BACKBUFFER 0x00000001 +#define WINED3DPRESENTFLAG_DISCARD_DEPTHSTENCIL 0x00000002 +#define WINED3DPRESENTFLAG_DEVICECLIP 0x00000004 +#define WINED3DPRESENTFLAG_VIDEO 0x00000010 +#define WINED3DPRESENTFLAG_NOAUTOROTATE 0x00000020 +#define WINED3DPRESENTFLAG_UNPRUNEDMODE 0x00000040 + +#define WINED3DDP_MAXTEXCOORD 8 + +#define WINED3DUSAGE_RENDERTARGET 0x00000001 +#define WINED3DUSAGE_DEPTHSTENCIL 0x00000002 +#define WINED3DUSAGE_WRITEONLY 0x00000008 +#define WINED3DUSAGE_SOFTWAREPROCESSING 0x00000010 +#define WINED3DUSAGE_DONOTCLIP 0x00000020 +#define WINED3DUSAGE_POINTS 0x00000040 +#define WINED3DUSAGE_RTPATCHES 0x00000080 +#define WINED3DUSAGE_NPATCHES 0x00000100 +#define WINED3DUSAGE_DYNAMIC 0x00000200 +#define WINED3DUSAGE_AUTOGENMIPMAP 0x00000400 +#define WINED3DUSAGE_DMAP 0x00004000 +#define WINED3DUSAGE_MASK 0x00004fff +#define WINED3DUSAGE_STATICDECL 0x40000000 +#define WINED3DUSAGE_OVERLAY 0x80000000 + +#define WINED3DUSAGE_QUERY_LEGACYBUMPMAP 0x00008000 +#define WINED3DUSAGE_QUERY_FILTER 0x00020000 +#define WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING 0x00080000 +#define WINED3DUSAGE_QUERY_SRGBREAD 0x00010000 +#define WINED3DUSAGE_QUERY_SRGBWRITE 0x00040000 +#define WINED3DUSAGE_QUERY_VERTEXTEXTURE 0x00100000 +#define WINED3DUSAGE_QUERY_WRAPANDMIP 0x00200000 +#define WINED3DUSAGE_QUERY_MASK 0x003f8000 + +#define WINED3DLOCK_READONLY 0x0010 +#define WINED3DLOCK_NOSYSLOCK 0x0800 +#define WINED3DLOCK_NOOVERWRITE 0x1000 +#define WINED3DLOCK_DISCARD 0x2000 +#define WINED3DLOCK_DONOTWAIT 0x4000 +#define WINED3DLOCK_NO_DIRTY_UPDATE 0x8000 + +#define WINED3DPRESENT_RATE_DEFAULT 0x00000000 + +#define WINED3DPRESENT_INTERVAL_DEFAULT 0x00000000 +#define WINED3DPRESENT_INTERVAL_ONE 0x00000001 +#define WINED3DPRESENT_INTERVAL_TWO 0x00000002 +#define WINED3DPRESENT_INTERVAL_THREE 0x00000004 +#define WINED3DPRESENT_INTERVAL_FOUR 0x00000008 +#define WINED3DPRESENT_INTERVAL_IMMEDIATE 0x80000000 + +#define WINED3DMAXUSERCLIPPLANES 32 +#define WINED3DCLIPPLANE0 (1 << 0) +#define WINED3DCLIPPLANE1 (1 << 1) +#define WINED3DCLIPPLANE2 (1 << 2) +#define WINED3DCLIPPLANE3 (1 << 3) +#define WINED3DCLIPPLANE4 (1 << 4) +#define WINED3DCLIPPLANE5 (1 << 5) + +/* FVF (Flexible Vertex Format) codes */ +#define WINED3DFVF_RESERVED0 0x0001 +#define WINED3DFVF_POSITION_MASK 0x400e +#define WINED3DFVF_XYZ 0x0002 +#define WINED3DFVF_XYZRHW 0x0004 +#define WINED3DFVF_XYZB1 0x0006 +#define WINED3DFVF_XYZB2 0x0008 +#define WINED3DFVF_XYZB3 0x000a +#define WINED3DFVF_XYZB4 0x000c +#define WINED3DFVF_XYZB5 0x000e +#define WINED3DFVF_XYZW 0x4002 +#define WINED3DFVF_NORMAL 0x0010 +#define WINED3DFVF_PSIZE 0x0020 +#define WINED3DFVF_DIFFUSE 0x0040 +#define WINED3DFVF_SPECULAR 0x0080 +#define WINED3DFVF_TEXCOUNT_MASK 0x0f00 +#define WINED3DFVF_TEXCOUNT_SHIFT 8 +#define WINED3DFVF_TEX0 0x0000 +#define WINED3DFVF_TEX1 0x0100 +#define WINED3DFVF_TEX2 0x0200 +#define WINED3DFVF_TEX3 0x0300 +#define WINED3DFVF_TEX4 0x0400 +#define WINED3DFVF_TEX5 0x0500 +#define WINED3DFVF_TEX6 0x0600 +#define WINED3DFVF_TEX7 0x0700 +#define WINED3DFVF_TEX8 0x0800 +#define WINED3DFVF_LASTBETA_UBYTE4 0x1000 +#define WINED3DFVF_LASTBETA_D3DCOLOR 0x8000 +#define WINED3DFVF_RESERVED2 0x6000 + +#define WINED3DFVF_TEXTUREFORMAT1 3 +#define WINED3DFVF_TEXTUREFORMAT2 0 +#define WINED3DFVF_TEXTUREFORMAT3 1 +#define WINED3DFVF_TEXTUREFORMAT4 2 +#define WINED3DFVF_TEXCOORDSIZE1(idx) (WINED3DFVF_TEXTUREFORMAT1 << (idx * 2 + 16)) +#define WINED3DFVF_TEXCOORDSIZE2(idx) (WINED3DFVF_TEXTUREFORMAT2 << (idx * 2 + 16)) +#define WINED3DFVF_TEXCOORDSIZE3(idx) (WINED3DFVF_TEXTUREFORMAT3 << (idx * 2 + 16)) +#define WINED3DFVF_TEXCOORDSIZE4(idx) (WINED3DFVF_TEXTUREFORMAT4 << (idx * 2 + 16)) + +/* Clear flags */ +#define WINED3DCLEAR_TARGET 0x00000001 +#define WINED3DCLEAR_ZBUFFER 0x00000002 +#define WINED3DCLEAR_STENCIL 0x00000004 + +/* Stream source flags */ +#define WINED3DSTREAMSOURCE_INDEXEDDATA (1 << 30) +#define WINED3DSTREAMSOURCE_INSTANCEDATA (2 << 30) + +/* SetPrivateData flags */ +#define WINED3DSPD_IUNKNOWN 0x00000001 + +/* IWineD3D::CreateDevice behaviour flags */ +#define WINED3DCREATE_FPU_PRESERVE 0x00000002 +#define WINED3DCREATE_PUREDEVICE 0x00000010 +#define WINED3DCREATE_SOFTWARE_VERTEXPROCESSING 0x00000020 +#define WINED3DCREATE_HARDWARE_VERTEXPROCESSING 0x00000040 +#define WINED3DCREATE_MIXED_VERTEXPROCESSING 0x00000080 +#define WINED3DCREATE_DISABLE_DRIVER_MANAGEMENT 0x00000100 +#define WINED3DCREATE_ADAPTERGROUP_DEVICE 0x00000200 + +/* VTF defines */ +#define WINED3DDMAPSAMPLER 0x100 +#define WINED3DVERTEXTEXTURESAMPLER0 (WINED3DDMAPSAMPLER + 1) +#define WINED3DVERTEXTEXTURESAMPLER1 (WINED3DDMAPSAMPLER + 2) +#define WINED3DVERTEXTEXTURESAMPLER2 (WINED3DDMAPSAMPLER + 3) +#define WINED3DVERTEXTEXTURESAMPLER3 (WINED3DDMAPSAMPLER + 4) + +#define WINED3DCAPS3_ALPHA_FULLSCREEN_FLIP_OR_DISCARD 0x00000020 +#define WINED3DCAPS3_LINEAR_TO_SRGB_PRESENTATION 0x00000080 +#define WINED3DCAPS3_COPY_TO_VIDMEM 0x00000100 +#define WINED3DCAPS3_COPY_TO_SYSTEMMEM 0x00000200 +#define WINED3DCAPS3_RESERVED 0x8000001f + +#define WINED3DDEVCAPS2_STREAMOFFSET 0x00000001 +#define WINED3DDEVCAPS2_DMAPNPATCH 0x00000002 +#define WINED3DDEVCAPS2_ADAPTIVETESSRTPATCH 0x00000004 +#define WINED3DDEVCAPS2_ADAPTIVETESSNPATCH 0x00000008 +#define WINED3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES 0x00000010 +#define WINED3DDEVCAPS2_PRESAMPLEDDMAPNPATCH 0x00000020 +#define WINED3DDEVCAPS2_VERTEXELEMENTSCANSHARESTREAMOFFSET 0x00000040 + +#define WINED3DDTCAPS_UBYTE4 0x00000001 +#define WINED3DDTCAPS_UBYTE4N 0x00000002 +#define WINED3DDTCAPS_SHORT2N 0x00000004 +#define WINED3DDTCAPS_SHORT4N 0x00000008 +#define WINED3DDTCAPS_USHORT2N 0x00000010 +#define WINED3DDTCAPS_USHORT4N 0x00000020 +#define WINED3DDTCAPS_UDEC3 0x00000040 +#define WINED3DDTCAPS_DEC3N 0x00000080 +#define WINED3DDTCAPS_FLOAT16_2 0x00000100 +#define WINED3DDTCAPS_FLOAT16_4 0x00000200 + +#define WINED3DFVFCAPS_TEXCOORDCOUNTMASK 0x0000ffff +#define WINED3DFVFCAPS_DONOTSTRIPELEMENTS 0x00080000 +#define WINED3DFVFCAPS_PSIZE 0x00100000 + +#define WINED3DLINECAPS_TEXTURE 0x00000001 +#define WINED3DLINECAPS_ZTEST 0x00000002 +#define WINED3DLINECAPS_BLEND 0x00000004 +#define WINED3DLINECAPS_ALPHACMP 0x00000008 +#define WINED3DLINECAPS_FOG 0x00000010 +#define WINED3DLINECAPS_ANTIALIAS 0x00000020 + +#define WINED3DMAX30SHADERINSTRUCTIONS 32768 +#define WINED3DMIN30SHADERINSTRUCTIONS 512 + +#define WINED3DPBLENDCAPS_ZERO 0x00000001 +#define WINED3DPBLENDCAPS_ONE 0x00000002 +#define WINED3DPBLENDCAPS_SRCCOLOR 0x00000004 +#define WINED3DPBLENDCAPS_INVSRCCOLOR 0x00000008 +#define WINED3DPBLENDCAPS_SRCALPHA 0x00000010 +#define WINED3DPBLENDCAPS_INVSRCALPHA 0x00000020 +#define WINED3DPBLENDCAPS_DESTALPHA 0x00000040 +#define WINED3DPBLENDCAPS_INVDESTALPHA 0x00000080 +#define WINED3DPBLENDCAPS_DESTCOLOR 0x00000100 +#define WINED3DPBLENDCAPS_INVDESTCOLOR 0x00000200 +#define WINED3DPBLENDCAPS_SRCALPHASAT 0x00000400 +#define WINED3DPBLENDCAPS_BOTHSRCALPHA 0x00000800 +#define WINED3DPBLENDCAPS_BOTHINVSRCALPHA 0x00001000 +#define WINED3DPBLENDCAPS_BLENDFACTOR 0x00002000 + +#define WINED3DPCMPCAPS_NEVER 0x00000001 +#define WINED3DPCMPCAPS_LESS 0x00000002 +#define WINED3DPCMPCAPS_EQUAL 0x00000004 +#define WINED3DPCMPCAPS_LESSEQUAL 0x00000008 +#define WINED3DPCMPCAPS_GREATER 0x00000010 +#define WINED3DPCMPCAPS_NOTEQUAL 0x00000020 +#define WINED3DPCMPCAPS_GREATEREQUAL 0x00000040 +#define WINED3DPCMPCAPS_ALWAYS 0x00000080 + +#define WINED3DPMISCCAPS_MASKZ 0x00000002 +#define WINED3DPMISCCAPS_LINEPATTERNREP 0x00000004 +#define WINED3DPMISCCAPS_CULLNONE 0x00000010 +#define WINED3DPMISCCAPS_CULLCW 0x00000020 +#define WINED3DPMISCCAPS_CULLCCW 0x00000040 +#define WINED3DPMISCCAPS_COLORWRITEENABLE 0x00000080 +#define WINED3DPMISCCAPS_CLIPPLANESCALEDPOINTS 0x00000100 +#define WINED3DPMISCCAPS_CLIPTLVERTS 0x00000200 +#define WINED3DPMISCCAPS_TSSARGTEMP 0x00000400 +#define WINED3DPMISCCAPS_BLENDOP 0x00000800 +#define WINED3DPMISCCAPS_NULLREFERENCE 0x00001000 +#define WINED3DPMISCCAPS_INDEPENDENTWRITEMASKS 0x00004000 +#define WINED3DPMISCCAPS_PERSTAGECONSTANT 0x00008000 +#define WINED3DPMISCCAPS_FOGANDSPECULARALPHA 0x00010000 +#define WINED3DPMISCCAPS_SEPARATEALPHABLEND 0x00020000 +#define WINED3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS 0x00040000 +#define WINED3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING 0x00080000 +#define WINED3DPMISCCAPS_FOGVERTEXCLAMPED 0x00100000 + +#define WINED3DPS20_MAX_DYNAMICFLOWCONTROLDEPTH 24 +#define WINED3DPS20_MIN_DYNAMICFLOWCONTROLDEPTH 0 +#define WINED3DPS20_MAX_NUMTEMPS 32 +#define WINED3DPS20_MIN_NUMTEMPS 12 +#define WINED3DPS20_MAX_STATICFLOWCONTROLDEPTH 4 +#define WINED3DPS20_MIN_STATICFLOWCONTROLDEPTH 0 +#define WINED3DPS20_MAX_NUMINSTRUCTIONSLOTS 512 +#define WINED3DPS20_MIN_NUMINSTRUCTIONSLOTS 96 + +#define WINED3DPS20CAPS_ARBITRARYSWIZZLE 0x00000001 +#define WINED3DPS20CAPS_GRADIENTINSTRUCTIONS 0x00000002 +#define WINED3DPS20CAPS_PREDICATION 0x00000004 +#define WINED3DPS20CAPS_NODEPENDENTREADLIMIT 0x00000008 +#define WINED3DPS20CAPS_NOTEXINSTRUCTIONLIMIT 0x00000010 + +#define WINED3DPTADDRESSCAPS_WRAP 0x00000001 +#define WINED3DPTADDRESSCAPS_MIRROR 0x00000002 +#define WINED3DPTADDRESSCAPS_CLAMP 0x00000004 +#define WINED3DPTADDRESSCAPS_BORDER 0x00000008 +#define WINED3DPTADDRESSCAPS_INDEPENDENTUV 0x00000010 +#define WINED3DPTADDRESSCAPS_MIRRORONCE 0x00000020 + +#define WINED3DSTENCILCAPS_KEEP 0x00000001 +#define WINED3DSTENCILCAPS_ZERO 0x00000002 +#define WINED3DSTENCILCAPS_REPLACE 0x00000004 +#define WINED3DSTENCILCAPS_INCRSAT 0x00000008 +#define WINED3DSTENCILCAPS_DECRSAT 0x00000010 +#define WINED3DSTENCILCAPS_INVERT 0x00000020 +#define WINED3DSTENCILCAPS_INCR 0x00000040 +#define WINED3DSTENCILCAPS_DECR 0x00000080 +#define WINED3DSTENCILCAPS_TWOSIDED 0x00000100 + +#define WINED3DTEXOPCAPS_DISABLE 0x00000001 +#define WINED3DTEXOPCAPS_SELECTARG1 0x00000002 +#define WINED3DTEXOPCAPS_SELECTARG2 0x00000004 +#define WINED3DTEXOPCAPS_MODULATE 0x00000008 +#define WINED3DTEXOPCAPS_MODULATE2X 0x00000010 +#define WINED3DTEXOPCAPS_MODULATE4X 0x00000020 +#define WINED3DTEXOPCAPS_ADD 0x00000040 +#define WINED3DTEXOPCAPS_ADDSIGNED 0x00000080 +#define WINED3DTEXOPCAPS_ADDSIGNED2X 0x00000100 +#define WINED3DTEXOPCAPS_SUBTRACT 0x00000200 +#define WINED3DTEXOPCAPS_ADDSMOOTH 0x00000400 +#define WINED3DTEXOPCAPS_BLENDDIFFUSEALPHA 0x00000800 +#define WINED3DTEXOPCAPS_BLENDTEXTUREALPHA 0x00001000 +#define WINED3DTEXOPCAPS_BLENDFACTORALPHA 0x00002000 +#define WINED3DTEXOPCAPS_BLENDTEXTUREALPHAPM 0x00004000 +#define WINED3DTEXOPCAPS_BLENDCURRENTALPHA 0x00008000 +#define WINED3DTEXOPCAPS_PREMODULATE 0x00010000 +#define WINED3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR 0x00020000 +#define WINED3DTEXOPCAPS_MODULATECOLOR_ADDALPHA 0x00040000 +#define WINED3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR 0x00080000 +#define WINED3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA 0x00100000 +#define WINED3DTEXOPCAPS_BUMPENVMAP 0x00200000 +#define WINED3DTEXOPCAPS_BUMPENVMAPLUMINANCE 0x00400000 +#define WINED3DTEXOPCAPS_DOTPRODUCT3 0x00800000 +#define WINED3DTEXOPCAPS_MULTIPLYADD 0x01000000 +#define WINED3DTEXOPCAPS_LERP 0x02000000 + +#define WINED3DVS20_MAX_DYNAMICFLOWCONTROLDEPTH 24 +#define WINED3DVS20_MIN_DYNAMICFLOWCONTROLDEPTH 0 +#define WINED3DVS20_MAX_NUMTEMPS 32 +#define WINED3DVS20_MIN_NUMTEMPS 12 +#define WINED3DVS20_MAX_STATICFLOWCONTROLDEPTH 4 +#define WINED3DVS20_MIN_STATICFLOWCONTROLDEPTH 1 + +#define WINED3DVS20CAPS_PREDICATION 0x00000001 + +#define WINED3DCAPS2_NO2DDURING3DSCENE 0x00000002 +#define WINED3DCAPS2_FULLSCREENGAMMA 0x00020000 +#define WINED3DCAPS2_CANRENDERWINDOWED 0x00080000 +#define WINED3DCAPS2_CANCALIBRATEGAMMA 0x00100000 +#define WINED3DCAPS2_RESERVED 0x02000000 +#define WINED3DCAPS2_CANMANAGERESOURCE 0x10000000 +#define WINED3DCAPS2_DYNAMICTEXTURES 0x20000000 +#define WINED3DCAPS2_CANAUTOGENMIPMAP 0x40000000 + +#define WINED3DPRASTERCAPS_DITHER 0x00000001 +#define WINED3DPRASTERCAPS_ROP2 0x00000002 +#define WINED3DPRASTERCAPS_XOR 0x00000004 +#define WINED3DPRASTERCAPS_PAT 0x00000008 +#define WINED3DPRASTERCAPS_ZTEST 0x00000010 +#define WINED3DPRASTERCAPS_SUBPIXEL 0x00000020 +#define WINED3DPRASTERCAPS_SUBPIXELX 0x00000040 +#define WINED3DPRASTERCAPS_FOGVERTEX 0x00000080 +#define WINED3DPRASTERCAPS_FOGTABLE 0x00000100 +#define WINED3DPRASTERCAPS_STIPPLE 0x00000200 +#define WINED3DPRASTERCAPS_ANTIALIASSORTDEPENDENT 0x00000400 +#define WINED3DPRASTERCAPS_ANTIALIASSORTINDEPENDENT 0x00000800 +#define WINED3DPRASTERCAPS_ANTIALIASEDGES 0x00001000 +#define WINED3DPRASTERCAPS_MIPMAPLODBIAS 0x00002000 +#define WINED3DPRASTERCAPS_ZBIAS 0x00004000 +#define WINED3DPRASTERCAPS_ZBUFFERLESSHSR 0x00008000 +#define WINED3DPRASTERCAPS_FOGRANGE 0x00010000 +#define WINED3DPRASTERCAPS_ANISOTROPY 0x00020000 +#define WINED3DPRASTERCAPS_WBUFFER 0x00040000 +#define WINED3DPRASTERCAPS_TRANSLUCENTSORTINDEPENDENT 0x00080000 +#define WINED3DPRASTERCAPS_WFOG 0x00100000 +#define WINED3DPRASTERCAPS_ZFOG 0x00200000 +#define WINED3DPRASTERCAPS_COLORPERSPECTIVE 0x00400000 +#define WINED3DPRASTERCAPS_SCISSORTEST 0x01000000 +#define WINED3DPRASTERCAPS_SLOPESCALEDEPTHBIAS 0x02000000 +#define WINED3DPRASTERCAPS_DEPTHBIAS 0x04000000 +#define WINED3DPRASTERCAPS_MULTISAMPLE_TOGGLE 0x08000000 + +#define WINED3DPSHADECAPS_COLORFLATMONO 0x00000001 +#define WINED3DPSHADECAPS_COLORFLATRGB 0x00000002 +#define WINED3DPSHADECAPS_COLORGOURAUDMONO 0x00000004 +#define WINED3DPSHADECAPS_COLORGOURAUDRGB 0x00000008 +#define WINED3DPSHADECAPS_COLORPHONGMONO 0x00000010 +#define WINED3DPSHADECAPS_COLORPHONGRGB 0x00000020 +#define WINED3DPSHADECAPS_SPECULARFLATMONO 0x00000040 +#define WINED3DPSHADECAPS_SPECULARFLATRGB 0x00000080 +#define WINED3DPSHADECAPS_SPECULARGOURAUDMONO 0x00000100 +#define WINED3DPSHADECAPS_SPECULARGOURAUDRGB 0x00000200 +#define WINED3DPSHADECAPS_SPECULARPHONGMONO 0x00000400 +#define WINED3DPSHADECAPS_SPECULARPHONGRGB 0x00000800 +#define WINED3DPSHADECAPS_ALPHAFLATBLEND 0x00001000 +#define WINED3DPSHADECAPS_ALPHAFLATSTIPPLED 0x00002000 +#define WINED3DPSHADECAPS_ALPHAGOURAUDBLEND 0x00004000 +#define WINED3DPSHADECAPS_ALPHAGOURAUDSTIPPLED 0x00008000 +#define WINED3DPSHADECAPS_ALPHAPHONGBLEND 0x00010000 +#define WINED3DPSHADECAPS_ALPHAPHONGSTIPPLED 0x00020000 +#define WINED3DPSHADECAPS_FOGFLAT 0x00040000 +#define WINED3DPSHADECAPS_FOGGOURAUD 0x00080000 +#define WINED3DPSHADECAPS_FOGPHONG 0x00100000 + +#define WINED3DPTEXTURECAPS_PERSPECTIVE 0x00000001 +#define WINED3DPTEXTURECAPS_POW2 0x00000002 +#define WINED3DPTEXTURECAPS_ALPHA 0x00000004 +#define WINED3DPTEXTURECAPS_TRANSPARENCY 0x00000008 +#define WINED3DPTEXTURECAPS_BORDER 0x00000010 +#define WINED3DPTEXTURECAPS_SQUAREONLY 0x00000020 +#define WINED3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE 0x00000040 +#define WINED3DPTEXTURECAPS_ALPHAPALETTE 0x00000080 +#define WINED3DPTEXTURECAPS_NONPOW2CONDITIONAL 0x00000100 +#define WINED3DPTEXTURECAPS_PROJECTED 0x00000400 +#define WINED3DPTEXTURECAPS_CUBEMAP 0x00000800 +#define WINED3DPTEXTURECAPS_COLORKEYBLEND 0x00001000 +#define WINED3DPTEXTURECAPS_VOLUMEMAP 0x00002000 +#define WINED3DPTEXTURECAPS_MIPMAP 0x00004000 +#define WINED3DPTEXTURECAPS_MIPVOLUMEMAP 0x00008000 +#define WINED3DPTEXTURECAPS_MIPCUBEMAP 0x00010000 +#define WINED3DPTEXTURECAPS_CUBEMAP_POW2 0x00020000 +#define WINED3DPTEXTURECAPS_VOLUMEMAP_POW2 0x00040000 +#define WINED3DPTEXTURECAPS_NOPROJECTEDBUMPENV 0x00200000 + +#define WINED3DPTFILTERCAPS_NEAREST 0x00000001 +#define WINED3DPTFILTERCAPS_LINEAR 0x00000002 +#define WINED3DPTFILTERCAPS_MIPNEAREST 0x00000004 +#define WINED3DPTFILTERCAPS_MIPLINEAR 0x00000008 +#define WINED3DPTFILTERCAPS_LINEARMIPNEAREST 0x00000010 +#define WINED3DPTFILTERCAPS_LINEARMIPLINEAR 0x00000020 +#define WINED3DPTFILTERCAPS_MINFPOINT 0x00000100 +#define WINED3DPTFILTERCAPS_MINFLINEAR 0x00000200 +#define WINED3DPTFILTERCAPS_MINFANISOTROPIC 0x00000400 +#define WINED3DPTFILTERCAPS_MIPFPOINT 0x00010000 +#define WINED3DPTFILTERCAPS_MIPFLINEAR 0x00020000 +#define WINED3DPTFILTERCAPS_MAGFPOINT 0x01000000 +#define WINED3DPTFILTERCAPS_MAGFLINEAR 0x02000000 +#define WINED3DPTFILTERCAPS_MAGFANISOTROPIC 0x04000000 +#define WINED3DPTFILTERCAPS_MAGFPYRAMIDALQUAD 0x08000000 +#define WINED3DPTFILTERCAPS_MAGFGAUSSIANQUAD 0x10000000 + +#define WINED3DVTXPCAPS_TEXGEN 0x00000001 +#define WINED3DVTXPCAPS_MATERIALSOURCE7 0x00000002 +#define WINED3DVTXPCAPS_VERTEXFOG 0x00000004 +#define WINED3DVTXPCAPS_DIRECTIONALLIGHTS 0x00000008 +#define WINED3DVTXPCAPS_POSITIONALLIGHTS 0x00000010 +#define WINED3DVTXPCAPS_LOCALVIEWER 0x00000020 +#define WINED3DVTXPCAPS_TWEENING 0x00000040 +#define WINED3DVTXPCAPS_TEXGEN_SPHEREMAP 0x00000100 +#define WINED3DVTXPCAPS_NO_TEXGEN_NONLOCALVIEWER 0x00000200 + +#define WINED3DCURSORCAPS_COLOR 0x00000001 +#define WINED3DCURSORCAPS_LOWRES 0x00000002 + +#define WINED3DDEVCAPS_FLOATTLVERTEX 0x00000001 +#define WINED3DDEVCAPS_SORTINCREASINGZ 0x00000002 +#define WINED3DDEVCAPS_SORTDECREASINGZ 0X00000004 +#define WINED3DDEVCAPS_SORTEXACT 0x00000008 +#define WINED3DDEVCAPS_EXECUTESYSTEMMEMORY 0x00000010 +#define WINED3DDEVCAPS_EXECUTEVIDEOMEMORY 0x00000020 +#define WINED3DDEVCAPS_TLVERTEXSYSTEMMEMORY 0x00000040 +#define WINED3DDEVCAPS_TLVERTEXVIDEOMEMORY 0x00000080 +#define WINED3DDEVCAPS_TEXTURESYSTEMMEMORY 0x00000100 +#define WINED3DDEVCAPS_TEXTUREVIDEOMEMORY 0x00000200 +#define WINED3DDEVCAPS_DRAWPRIMTLVERTEX 0x00000400 +#define WINED3DDEVCAPS_CANRENDERAFTERFLIP 0x00000800 +#define WINED3DDEVCAPS_TEXTURENONLOCALVIDMEM 0x00001000 +#define WINED3DDEVCAPS_DRAWPRIMITIVES2 0x00002000 +#define WINED3DDEVCAPS_SEPARATETEXTUREMEMORIES 0x00004000 +#define WINED3DDEVCAPS_DRAWPRIMITIVES2EX 0x00008000 +#define WINED3DDEVCAPS_HWTRANSFORMANDLIGHT 0x00010000 +#define WINED3DDEVCAPS_CANBLTSYSTONONLOCAL 0x00020000 +#define WINED3DDEVCAPS_HWRASTERIZATION 0x00080000 +#define WINED3DDEVCAPS_PUREDEVICE 0x00100000 +#define WINED3DDEVCAPS_QUINTICRTPATCHES 0x00200000 +#define WINED3DDEVCAPS_RTPATCHES 0x00400000 +#define WINED3DDEVCAPS_RTPATCHHANDLEZERO 0x00800000 +#define WINED3DDEVCAPS_NPATCHES 0x01000000 + +/* dwDDFX */ +/* arithmetic stretching along y axis */ +#define WINEDDBLTFX_ARITHSTRETCHY 0x00000001 +/* mirror on y axis */ +#define WINEDDBLTFX_MIRRORLEFTRIGHT 0x00000002 +/* mirror on x axis */ +#define WINEDDBLTFX_MIRRORUPDOWN 0x00000004 +/* do not tear */ +#define WINEDDBLTFX_NOTEARING 0x00000008 +/* 180 degrees clockwise rotation */ +#define WINEDDBLTFX_ROTATE180 0x00000010 +/* 270 degrees clockwise rotation */ +#define WINEDDBLTFX_ROTATE270 0x00000020 +/* 90 degrees clockwise rotation */ +#define WINEDDBLTFX_ROTATE90 0x00000040 +/* dwZBufferLow and dwZBufferHigh specify limits to the copied Z values */ +#define WINEDDBLTFX_ZBUFFERRANGE 0x00000080 +/* add dwZBufferBaseDest to every source z value before compare */ +#define WINEDDBLTFX_ZBUFFERBASEDEST 0x00000100 + +/* dwFlags for Blt* */ +#define WINEDDBLT_ALPHADEST 0x00000001 +#define WINEDDBLT_ALPHADESTCONSTOVERRIDE 0x00000002 +#define WINEDDBLT_ALPHADESTNEG 0x00000004 +#define WINEDDBLT_ALPHADESTSURFACEOVERRIDE 0x00000008 +#define WINEDDBLT_ALPHAEDGEBLEND 0x00000010 +#define WINEDDBLT_ALPHASRC 0x00000020 +#define WINEDDBLT_ALPHASRCCONSTOVERRIDE 0x00000040 +#define WINEDDBLT_ALPHASRCNEG 0x00000080 +#define WINEDDBLT_ALPHASRCSURFACEOVERRIDE 0x00000100 +#define WINEDDBLT_ASYNC 0x00000200 +#define WINEDDBLT_COLORFILL 0x00000400 +#define WINEDDBLT_DDFX 0x00000800 +#define WINEDDBLT_DDROPS 0x00001000 +#define WINEDDBLT_KEYDEST 0x00002000 +#define WINEDDBLT_KEYDESTOVERRIDE 0x00004000 +#define WINEDDBLT_KEYSRC 0x00008000 +#define WINEDDBLT_KEYSRCOVERRIDE 0x00010000 +#define WINEDDBLT_ROP 0x00020000 +#define WINEDDBLT_ROTATIONANGLE 0x00040000 +#define WINEDDBLT_ZBUFFER 0x00080000 +#define WINEDDBLT_ZBUFFERDESTCONSTOVERRIDE 0x00100000 +#define WINEDDBLT_ZBUFFERDESTOVERRIDE 0x00200000 +#define WINEDDBLT_ZBUFFERSRCCONSTOVERRIDE 0x00400000 +#define WINEDDBLT_ZBUFFERSRCOVERRIDE 0x00800000 +#define WINEDDBLT_WAIT 0x01000000 +#define WINEDDBLT_DEPTHFILL 0x02000000 +#define WINEDDBLT_DONOTWAIT 0x08000000 + +/* dwTrans for BltFast */ +#define WINEDDBLTFAST_NOCOLORKEY 0x00000000 +#define WINEDDBLTFAST_SRCCOLORKEY 0x00000001 +#define WINEDDBLTFAST_DESTCOLORKEY 0x00000002 +#define WINEDDBLTFAST_WAIT 0x00000010 +#define WINEDDBLTFAST_DONOTWAIT 0x00000020 + +/* DDSURFACEDESC.dwFlags */ +#define WINEDDSD_CAPS 0x00000001 +#define WINEDDSD_HEIGHT 0x00000002 +#define WINEDDSD_WIDTH 0x00000004 +#define WINEDDSD_PITCH 0x00000008 +#define WINEDDSD_BACKBUFFERCOUNT 0x00000020 +#define WINEDDSD_ZBUFFERBITDEPTH 0x00000040 +#define WINEDDSD_ALPHABITDEPTH 0x00000080 +#define WINEDDSD_LPSURFACE 0x00000800 +#define WINEDDSD_PIXELFORMAT 0x00001000 +#define WINEDDSD_CKDESTOVERLAY 0x00002000 +#define WINEDDSD_CKDESTBLT 0x00004000 +#define WINEDDSD_CKSRCOVERLAY 0x00008000 +#define WINEDDSD_CKSRCBLT 0x00010000 +#define WINEDDSD_MIPMAPCOUNT 0x00020000 +#define WINEDDSD_REFRESHRATE 0x00040000 +#define WINEDDSD_LINEARSIZE 0x00080000 +#define WINEDDSD_TEXTURESTAGE 0x00100000 +#define WINEDDSD_FVF 0x00200000 +#define WINEDDSD_SRCVBHANDLE 0x00400000 +#define WINEDDSD_ALL 0x007ff9ee + +/* Set/Get Colour Key Flags */ +#define WINEDDCKEY_COLORSPACE 0x00000001 /* Struct is single colour space */ +#define WINEDDCKEY_DESTBLT 0x00000002 /* To be used as dest for blt */ +#define WINEDDCKEY_DESTOVERLAY 0x00000004 /* To be used as dest for CK overlays */ +#define WINEDDCKEY_SRCBLT 0x00000008 /* To be used as src for blt */ +#define WINEDDCKEY_SRCOVERLAY 0x00000010 /* To be used as src for CK overlays */ + +/* dwFlags for GetBltStatus */ +#define WINEDDGBS_CANBLT 0x00000001 +#define WINEDDGBS_ISBLTDONE 0x00000002 + +/* dwFlags for GetFlipStatus */ +#define WINEDDGFS_CANFLIP 0x00000001 +#define WINEDDGFS_ISFLIPDONE 0x00000002 + +/* dwFlags for Flip */ +#define WINEDDFLIP_WAIT 0x00000001 +#define WINEDDFLIP_EVEN 0x00000002 /* only valid for overlay */ +#define WINEDDFLIP_ODD 0x00000004 /* only valid for overlay */ +#define WINEDDFLIP_NOVSYNC 0x00000008 +#define WINEDDFLIP_STEREO 0x00000010 +#define WINEDDFLIP_DONOTWAIT 0x00000020 +#define WINEDDFLIP_INTERVAL2 0x02000000 +#define WINEDDFLIP_INTERVAL3 0x03000000 +#define WINEDDFLIP_INTERVAL4 0x04000000 + +#define WINEDDOVER_ALPHADEST 0x00000001 +#define WINEDDOVER_ALPHADESTCONSTOVERRIDE 0x00000002 +#define WINEDDOVER_ALPHADESTNEG 0x00000004 +#define WINEDDOVER_ALPHADESTSURFACEOVERRIDE 0x00000008 +#define WINEDDOVER_ALPHAEDGEBLEND 0x00000010 +#define WINEDDOVER_ALPHASRC 0x00000020 +#define WINEDDOVER_ALPHASRCCONSTOVERRIDE 0x00000040 +#define WINEDDOVER_ALPHASRCNEG 0x00000080 +#define WINEDDOVER_ALPHASRCSURFACEOVERRIDE 0x00000100 +#define WINEDDOVER_HIDE 0x00000200 +#define WINEDDOVER_KEYDEST 0x00000400 +#define WINEDDOVER_KEYDESTOVERRIDE 0x00000800 +#define WINEDDOVER_KEYSRC 0x00001000 +#define WINEDDOVER_KEYSRCOVERRIDE 0x00002000 +#define WINEDDOVER_SHOW 0x00004000 +#define WINEDDOVER_ADDDIRTYRECT 0x00008000 +#define WINEDDOVER_REFRESHDIRTYRECTS 0x00010000 +#define WINEDDOVER_REFRESHALL 0x00020000 +#define WINEDDOVER_DDFX 0x00080000 +#define WINEDDOVER_AUTOFLIP 0x00100000 +#define WINEDDOVER_BOB 0x00200000 +#define WINEDDOVER_OVERRIDEBOBWEAVE 0x00400000 +#define WINEDDOVER_INTERLEAVED 0x00800000 + +/* DirectDraw Caps */ +#define WINEDDSCAPS_RESERVED1 0x00000001 +#define WINEDDSCAPS_ALPHA 0x00000002 +#define WINEDDSCAPS_BACKBUFFER 0x00000004 +#define WINEDDSCAPS_COMPLEX 0x00000008 +#define WINEDDSCAPS_FLIP 0x00000010 +#define WINEDDSCAPS_FRONTBUFFER 0x00000020 +#define WINEDDSCAPS_OFFSCREENPLAIN 0x00000040 +#define WINEDDSCAPS_OVERLAY 0x00000080 +#define WINEDDSCAPS_PALETTE 0x00000100 +#define WINEDDSCAPS_PRIMARYSURFACE 0x00000200 +#define WINEDDSCAPS_PRIMARYSURFACELEFT 0x00000400 +#define WINEDDSCAPS_SYSTEMMEMORY 0x00000800 +#define WINEDDSCAPS_TEXTURE 0x00001000 +#define WINEDDSCAPS_3DDEVICE 0x00002000 +#define WINEDDSCAPS_VIDEOMEMORY 0x00004000 +#define WINEDDSCAPS_VISIBLE 0x00008000 +#define WINEDDSCAPS_WRITEONLY 0x00010000 +#define WINEDDSCAPS_ZBUFFER 0x00020000 +#define WINEDDSCAPS_OWNDC 0x00040000 +#define WINEDDSCAPS_LIVEVIDEO 0x00080000 +#define WINEDDSCAPS_HWCODEC 0x00100000 +#define WINEDDSCAPS_MODEX 0x00200000 +#define WINEDDSCAPS_MIPMAP 0x00400000 +#define WINEDDSCAPS_RESERVED2 0x00800000 +#define WINEDDSCAPS_ALLOCONLOAD 0x04000000 +#define WINEDDSCAPS_VIDEOPORT 0x08000000 +#define WINEDDSCAPS_LOCALVIDMEM 0x10000000 +#define WINEDDSCAPS_NONLOCALVIDMEM 0x20000000 +#define WINEDDSCAPS_STANDARDVGAMODE 0x40000000 +#define WINEDDSCAPS_OPTIMIZED 0x80000000 + +#define WINEDDCKEYCAPS_DESTBLT 0x00000001 +#define WINEDDCKEYCAPS_DESTBLTCLRSPACE 0x00000002 +#define WINEDDCKEYCAPS_DESTBLTCLRSPACEYUV 0x00000004 +#define WINEDDCKEYCAPS_DESTBLTYUV 0x00000008 +#define WINEDDCKEYCAPS_DESTOVERLAY 0x00000010 +#define WINEDDCKEYCAPS_DESTOVERLAYCLRSPACE 0x00000020 +#define WINEDDCKEYCAPS_DESTOVERLAYCLRSPACEYUV 0x00000040 +#define WINEDDCKEYCAPS_DESTOVERLAYONEACTIVE 0x00000080 +#define WINEDDCKEYCAPS_DESTOVERLAYYUV 0x00000100 +#define WINEDDCKEYCAPS_SRCBLT 0x00000200 +#define WINEDDCKEYCAPS_SRCBLTCLRSPACE 0x00000400 +#define WINEDDCKEYCAPS_SRCBLTCLRSPACEYUV 0x00000800 +#define WINEDDCKEYCAPS_SRCBLTYUV 0x00001000 +#define WINEDDCKEYCAPS_SRCOVERLAY 0x00002000 +#define WINEDDCKEYCAPS_SRCOVERLAYCLRSPACE 0x00004000 +#define WINEDDCKEYCAPS_SRCOVERLAYCLRSPACEYUV 0x00008000 +#define WINEDDCKEYCAPS_SRCOVERLAYONEACTIVE 0x00010000 +#define WINEDDCKEYCAPS_SRCOVERLAYYUV 0x00020000 +#define WINEDDCKEYCAPS_NOCOSTOVERLAY 0x00040000 + +#define WINEDDFXCAPS_BLTALPHA 0x00000001 +#define WINEDDFXCAPS_OVERLAYALPHA 0x00000004 +#define WINEDDFXCAPS_BLTARITHSTRETCHYN 0x00000010 +#define WINEDDFXCAPS_BLTARITHSTRETCHY 0x00000020 +#define WINEDDFXCAPS_BLTMIRRORLEFTRIGHT 0x00000040 +#define WINEDDFXCAPS_BLTMIRRORUPDOWN 0x00000080 +#define WINEDDFXCAPS_BLTROTATION 0x00000100 +#define WINEDDFXCAPS_BLTROTATION90 0x00000200 +#define WINEDDFXCAPS_BLTSHRINKX 0x00000400 +#define WINEDDFXCAPS_BLTSHRINKXN 0x00000800 +#define WINEDDFXCAPS_BLTSHRINKY 0x00001000 +#define WINEDDFXCAPS_BLTSHRINKYN 0x00002000 +#define WINEDDFXCAPS_BLTSTRETCHX 0x00004000 +#define WINEDDFXCAPS_BLTSTRETCHXN 0x00008000 +#define WINEDDFXCAPS_BLTSTRETCHY 0x00010000 +#define WINEDDFXCAPS_BLTSTRETCHYN 0x00020000 +#define WINEDDFXCAPS_OVERLAYARITHSTRETCHY 0x00040000 +#define WINEDDFXCAPS_OVERLAYARITHSTRETCHYN 0x00000008 +#define WINEDDFXCAPS_OVERLAYSHRINKX 0x00080000 +#define WINEDDFXCAPS_OVERLAYSHRINKXN 0x00100000 +#define WINEDDFXCAPS_OVERLAYSHRINKY 0x00200000 +#define WINEDDFXCAPS_OVERLAYSHRINKYN 0x00400000 +#define WINEDDFXCAPS_OVERLAYSTRETCHX 0x00800000 +#define WINEDDFXCAPS_OVERLAYSTRETCHXN 0x01000000 +#define WINEDDFXCAPS_OVERLAYSTRETCHY 0x02000000 +#define WINEDDFXCAPS_OVERLAYSTRETCHYN 0x04000000 +#define WINEDDFXCAPS_OVERLAYMIRRORLEFTRIGHT 0x08000000 +#define WINEDDFXCAPS_OVERLAYMIRRORUPDOWN 0x10000000 + +#define WINEDDCAPS_3D 0x00000001 +#define WINEDDCAPS_ALIGNBOUNDARYDEST 0x00000002 +#define WINEDDCAPS_ALIGNSIZEDEST 0x00000004 +#define WINEDDCAPS_ALIGNBOUNDARYSRC 0x00000008 +#define WINEDDCAPS_ALIGNSIZESRC 0x00000010 +#define WINEDDCAPS_ALIGNSTRIDE 0x00000020 +#define WINEDDCAPS_BLT 0x00000040 +#define WINEDDCAPS_BLTQUEUE 0x00000080 +#define WINEDDCAPS_BLTFOURCC 0x00000100 +#define WINEDDCAPS_BLTSTRETCH 0x00000200 +#define WINEDDCAPS_GDI 0x00000400 +#define WINEDDCAPS_OVERLAY 0x00000800 +#define WINEDDCAPS_OVERLAYCANTCLIP 0x00001000 +#define WINEDDCAPS_OVERLAYFOURCC 0x00002000 +#define WINEDDCAPS_OVERLAYSTRETCH 0x00004000 +#define WINEDDCAPS_PALETTE 0x00008000 +#define WINEDDCAPS_PALETTEVSYNC 0x00010000 +#define WINEDDCAPS_READSCANLINE 0x00020000 +#define WINEDDCAPS_STEREOVIEW 0x00040000 +#define WINEDDCAPS_VBI 0x00080000 +#define WINEDDCAPS_ZBLTS 0x00100000 +#define WINEDDCAPS_ZOVERLAYS 0x00200000 +#define WINEDDCAPS_COLORKEY 0x00400000 +#define WINEDDCAPS_ALPHA 0x00800000 +#define WINEDDCAPS_COLORKEYHWASSIST 0x01000000 +#define WINEDDCAPS_NOHARDWARE 0x02000000 +#define WINEDDCAPS_BLTCOLORFILL 0x04000000 +#define WINEDDCAPS_BANKSWITCHED 0x08000000 +#define WINEDDCAPS_BLTDEPTHFILL 0x10000000 +#define WINEDDCAPS_CANCLIP 0x20000000 +#define WINEDDCAPS_CANCLIPSTRETCHED 0x40000000 +#define WINEDDCAPS_CANBLTSYSMEM 0x80000000 + +#define WINEDDCAPS2_CERTIFIED 0x00000001 +#define WINEDDCAPS2_NO2DDURING3DSCENE 0x00000002 +#define WINEDDCAPS2_VIDEOPORT 0x00000004 +#define WINEDDCAPS2_AUTOFLIPOVERLAY 0x00000008 +#define WINEDDCAPS2_CANBOBINTERLEAVED 0x00000010 +#define WINEDDCAPS2_CANBOBNONINTERLEAVED 0x00000020 +#define WINEDDCAPS2_COLORCONTROLOVERLAY 0x00000040 +#define WINEDDCAPS2_COLORCONTROLPRIMARY 0x00000080 +#define WINEDDCAPS2_CANDROPZ16BIT 0x00000100 +#define WINEDDCAPS2_NONLOCALVIDMEM 0x00000200 +#define WINEDDCAPS2_NONLOCALVIDMEMCAPS 0x00000400 +#define WINEDDCAPS2_NOPAGELOCKREQUIRED 0x00000800 +#define WINEDDCAPS2_WIDESURFACES 0x00001000 +#define WINEDDCAPS2_CANFLIPODDEVEN 0x00002000 +#define WINEDDCAPS2_CANBOBHARDWARE 0x00004000 +#define WINEDDCAPS2_COPYFOURCC 0x00008000 +#define WINEDDCAPS2_PRIMARYGAMMA 0x00020000 +#define WINEDDCAPS2_CANRENDERWINDOWED 0x00080000 +#define WINEDDCAPS2_CANCALIBRATEGAMMA 0x00100000 +#define WINEDDCAPS2_FLIPINTERVAL 0x00200000 +#define WINEDDCAPS2_FLIPNOVSYNC 0x00400000 +#define WINEDDCAPS2_CANMANAGETEXTURE 0x00800000 +#define WINEDDCAPS2_TEXMANINNONLOCALVIDMEM 0x01000000 +#define WINEDDCAPS2_STEREO 0x02000000 +#define WINEDDCAPS2_SYSTONONLOCAL_AS_SYSTOLOCAL 0x04000000 + +/* DDCAPS.d */ +#define WINEDDPCAPS_4BIT 0x00000001 +#define WINEDDPCAPS_8BITENTRIES 0x00000002 +#define WINEDDPCAPS_8BIT 0x00000004 +#define WINEDDPCAPS_INITIALIZE 0x00000008 +#define WINEDDPCAPS_PRIMARYSURFACE 0x00000010 +#define WINEDDPCAPS_PRIMARYSURFACELEFT 0x00000020 +#define WINEDDPCAPS_ALLOW256 0x00000040 +#define WINEDDPCAPS_VSYNC 0x00000080 +#define WINEDDPCAPS_1BIT 0x00000100 +#define WINEDDPCAPS_2BIT 0x00000200 +#define WINEDDPCAPS_ALPHA 0x00000400 + +typedef struct _WINED3DDISPLAYMODE +{ + UINT Width; + UINT Height; + UINT RefreshRate; + enum wined3d_format_id Format; +} WINED3DDISPLAYMODE; + +typedef struct _WINED3DCOLORVALUE +{ + float r; + float g; + float b; + float a; +} WINED3DCOLORVALUE; + +typedef struct _WINED3DVECTOR +{ + float x; + float y; + float z; +} WINED3DVECTOR; + +typedef struct _WINED3DMATRIX +{ + union + { + struct + { + float _11, _12, _13, _14; + float _21, _22, _23, _24; + float _31, _32, _33, _34; + float _41, _42, _43, _44; + } DUMMYSTRUCTNAME; + float m[4][4]; + } DUMMYUNIONNAME; +} WINED3DMATRIX; + +typedef struct _WINED3DLIGHT +{ + WINED3DLIGHTTYPE Type; + WINED3DCOLORVALUE Diffuse; + WINED3DCOLORVALUE Specular; + WINED3DCOLORVALUE Ambient; + WINED3DVECTOR Position; + WINED3DVECTOR Direction; + float Range; + float Falloff; + float Attenuation0; + float Attenuation1; + float Attenuation2; + float Theta; + float Phi; +} WINED3DLIGHT; + +typedef struct _WINED3DMATERIAL +{ + WINED3DCOLORVALUE Diffuse; + WINED3DCOLORVALUE Ambient; + WINED3DCOLORVALUE Specular; + WINED3DCOLORVALUE Emissive; + float Power; +} WINED3DMATERIAL; + +typedef struct _WINED3DVIEWPORT +{ + DWORD X; + DWORD Y; + DWORD Width; + DWORD Height; + float MinZ; + float MaxZ; +} WINED3DVIEWPORT; + +typedef struct _WINED3DGAMMARAMP +{ + WORD red[256]; + WORD green[256]; + WORD blue[256]; +} WINED3DGAMMARAMP; + +typedef struct _WINED3DLINEPATTERN +{ + WORD wRepeatFactor; + WORD wLinePattern; +} WINED3DLINEPATTERN; + +typedef struct _WINEDD3DRECTPATCH_INFO +{ + UINT StartVertexOffsetWidth; + UINT StartVertexOffsetHeight; + UINT Width; + UINT Height; + UINT Stride; + WINED3DBASISTYPE Basis; + WINED3DDEGREETYPE Degree; +} WINED3DRECTPATCH_INFO; + +typedef struct _WINED3DTRIPATCH_INFO +{ + UINT StartVertexOffset; + UINT NumVertices; + WINED3DBASISTYPE Basis; + WINED3DDEGREETYPE Degree; +} WINED3DTRIPATCH_INFO; + +typedef struct _WINED3DADAPTER_IDENTIFIER +{ + char *driver; + UINT driver_size; + char *description; + UINT description_size; + char *device_name; + UINT device_name_size; + LARGE_INTEGER driver_version; + DWORD vendor_id; + DWORD device_id; + DWORD subsystem_id; + DWORD revision; + GUID device_identifier; + DWORD whql_level; + LUID adapter_luid; + SIZE_T video_memory; +} WINED3DADAPTER_IDENTIFIER; + +typedef struct _WINED3DPRESENT_PARAMETERS +{ + UINT BackBufferWidth; + UINT BackBufferHeight; + enum wined3d_format_id BackBufferFormat; + UINT BackBufferCount; + WINED3DMULTISAMPLE_TYPE MultiSampleType; + DWORD MultiSampleQuality; + WINED3DSWAPEFFECT SwapEffect; + HWND hDeviceWindow; + BOOL Windowed; + BOOL EnableAutoDepthStencil; + enum wined3d_format_id AutoDepthStencilFormat; + DWORD Flags; + UINT FullScreen_RefreshRateInHz; + UINT PresentationInterval; + BOOL AutoRestoreDisplayMode; +} WINED3DPRESENT_PARAMETERS; + +struct wined3d_resource_desc +{ + WINED3DRESOURCETYPE resource_type; + enum wined3d_format_id format; + WINED3DMULTISAMPLE_TYPE multisample_type; + UINT multisample_quality; + DWORD usage; + WINED3DPOOL pool; + UINT width; + UINT height; + UINT depth; + UINT size; +}; + +typedef struct _WINED3DCLIPSTATUS +{ + DWORD ClipUnion; + DWORD ClipIntersection; +} WINED3DCLIPSTATUS; + +typedef struct _WINED3DVERTEXELEMENT +{ + enum wined3d_format_id format; + WORD input_slot; + WORD offset; + UINT output_slot; /* D3D 8 & 10 */ + BYTE method; + BYTE usage; + BYTE usage_idx; +} WINED3DVERTEXELEMENT; + +typedef struct _WINED3DDEVICE_CREATION_PARAMETERS +{ + UINT AdapterOrdinal; + WINED3DDEVTYPE DeviceType; + HWND hFocusWindow; + DWORD BehaviorFlags; +} WINED3DDEVICE_CREATION_PARAMETERS; + +typedef struct _WINED3DDEVINFO_BANDWIDTHTIMINGS +{ + float MaxBandwidthUtilized; + float FrontEndUploadMemoryUtilizedPercent; + float VertexRateUtilizedPercent; + float TriangleSetupRateUtilizedPercent; + float FillRateUtilizedPercent; +} WINED3DDEVINFO_BANDWIDTHTIMINGS; + +typedef struct _WINED3DDEVINFO_CACHEUTILIZATION +{ + float TextureCacheHitRate; + float PostTransformVertexCacheHitRate; +} WINED3DDEVINFO_CACHEUTILIZATION; + +typedef struct _WINED3DDEVINFO_INTERFACETIMINGS +{ + float WaitingForGPUToUseApplicationResourceTimePercent; + float WaitingForGPUToAcceptMoreCommandsTimePercent; + float WaitingForGPUToStayWithinLatencyTimePercent; + float WaitingForGPUExclusiveResourceTimePercent; + float WaitingForGPUOtherTimePercent; +} WINED3DDEVINFO_INTERFACETIMINGS; + +typedef struct _WINED3DDEVINFO_PIPELINETIMINGS +{ + float VertexProcessingTimePercent; + float PixelProcessingTimePercent; + float OtherGPUProcessingTimePercent; + float GPUIdleTimePercent; +} WINED3DDEVINFO_PIPELINETIMINGS; + +typedef struct _WINED3DDEVINFO_STAGETIMINGS +{ + float MemoryProcessingPercent; + float ComputationProcessingPercent; +} WINED3DDEVINFO_STAGETIMINGS; + +typedef struct _WINED3DRASTER_STATUS +{ + BOOL InVBlank; + UINT ScanLine; +} WINED3DRASTER_STATUS; + +typedef struct WINED3DRESOURCESTATS +{ + BOOL bThrashing; + DWORD ApproxBytesDownloaded; + DWORD NumEvicts; + DWORD NumVidCreates; + DWORD LastPri; + DWORD NumUsed; + DWORD NumUsedInVidMem; + DWORD WorkingSet; + DWORD WorkingSetBytes; + DWORD TotalManaged; + DWORD TotalBytes; +} WINED3DRESOURCESTATS; + +typedef struct _WINED3DDEVINFO_RESOURCEMANAGER +{ + WINED3DRESOURCESTATS stats[WINED3DRTYPECOUNT]; +} WINED3DDEVINFO_RESOURCEMANAGER; + +typedef struct _WINED3DDEVINFO_VERTEXSTATS +{ + DWORD NumRenderedTriangles; + DWORD NumExtraClippingTriangles; +} WINED3DDEVINFO_VERTEXSTATS; + +typedef struct _WINED3DLOCKED_RECT +{ + INT Pitch; + void *pBits; +} WINED3DLOCKED_RECT; + +typedef struct _WINED3DLOCKED_BOX +{ + INT RowPitch; + INT SlicePitch; + void *pBits; +} WINED3DLOCKED_BOX; + +typedef struct _WINED3DBOX +{ + UINT Left; + UINT Top; + UINT Right; + UINT Bottom; + UINT Front; + UINT Back; +} WINED3DBOX; + +/*Vertex cache optimization hints.*/ +typedef struct WINED3DDEVINFO_VCACHE +{ + DWORD Pattern; /* Must be a 4 char code FOURCC (e.g. CACH) */ + DWORD OptMethod; /* 0 to get the longest strips, 1 vertex cache */ + DWORD CacheSize; /* Cache size to use (only valid if OptMethod==1) */ + DWORD MagicNumber; /* Internal for deciding when to restart strips, + non user modifiable (only valid if OptMethod==1) */ +} WINED3DDEVINFO_VCACHE; + +typedef struct WineDirect3DStridedData +{ + enum wined3d_format_id format; /* Format of the data */ + const BYTE *lpData; /* Pointer to start of data */ + DWORD dwStride; /* Stride between occurrences of this data */ +} WineDirect3DStridedData; + +typedef struct WineDirect3DVertexStridedData +{ + WineDirect3DStridedData position; + WineDirect3DStridedData normal; + WineDirect3DStridedData diffuse; + WineDirect3DStridedData specular; + WineDirect3DStridedData texCoords[WINED3DDP_MAXTEXCOORD]; + BOOL position_transformed; +} WineDirect3DVertexStridedData; + +typedef struct _WINED3DVSHADERCAPS2_0 +{ + DWORD Caps; + INT DynamicFlowControlDepth; + INT NumTemps; + INT StaticFlowControlDepth; +} WINED3DVSHADERCAPS2_0; + +typedef struct _WINED3DPSHADERCAPS2_0 +{ + DWORD Caps; + INT DynamicFlowControlDepth; + INT NumTemps; + INT StaticFlowControlDepth; + INT NumInstructionSlots; +} WINED3DPSHADERCAPS2_0; + +typedef struct _WINEDDCAPS +{ + DWORD Caps; + DWORD Caps2; + DWORD CKeyCaps; + DWORD FXCaps; + DWORD FXAlphaCaps; + DWORD PalCaps; + DWORD SVCaps; + DWORD SVBCaps; + DWORD SVBCKeyCaps; + DWORD SVBFXCaps; + DWORD VSBCaps; + DWORD VSBCKeyCaps; + DWORD VSBFXCaps; + DWORD SSBCaps; + DWORD SSBCKeyCaps; + DWORD SSBFXCaps; + DWORD ddsCaps; + DWORD StrideAlign; +} WINEDDCAPS; + +typedef struct _WINED3DCAPS +{ + WINED3DDEVTYPE DeviceType; + UINT AdapterOrdinal; + + DWORD Caps; + DWORD Caps2; + DWORD Caps3; + DWORD PresentationIntervals; + + DWORD CursorCaps; + DWORD DevCaps; + DWORD PrimitiveMiscCaps; + DWORD RasterCaps; + DWORD ZCmpCaps; + DWORD SrcBlendCaps; + DWORD DestBlendCaps; + DWORD AlphaCmpCaps; + DWORD ShadeCaps; + DWORD TextureCaps; + DWORD TextureFilterCaps; + DWORD CubeTextureFilterCaps; + DWORD VolumeTextureFilterCaps; + DWORD TextureAddressCaps; + DWORD VolumeTextureAddressCaps; + DWORD LineCaps; + + DWORD MaxTextureWidth; + DWORD MaxTextureHeight; + DWORD MaxVolumeExtent; + DWORD MaxTextureRepeat; + DWORD MaxTextureAspectRatio; + DWORD MaxAnisotropy; + float MaxVertexW; + + float GuardBandLeft; + float GuardBandTop; + float GuardBandRight; + float GuardBandBottom; + + float ExtentsAdjust; + DWORD StencilCaps; + + DWORD FVFCaps; + DWORD TextureOpCaps; + DWORD MaxTextureBlendStages; + DWORD MaxSimultaneousTextures; + + DWORD VertexProcessingCaps; + DWORD MaxActiveLights; + DWORD MaxUserClipPlanes; + DWORD MaxVertexBlendMatrices; + DWORD MaxVertexBlendMatrixIndex; + + float MaxPointSize; + + DWORD MaxPrimitiveCount; + DWORD MaxVertexIndex; + DWORD MaxStreams; + DWORD MaxStreamStride; + + DWORD VertexShaderVersion; + DWORD MaxVertexShaderConst; + + DWORD PixelShaderVersion; + float PixelShader1xMaxValue; + + /* DX 9 */ + DWORD DevCaps2; + + float MaxNpatchTessellationLevel; + DWORD Reserved5; /* undocumented */ + + UINT MasterAdapterOrdinal; + UINT AdapterOrdinalInGroup; + UINT NumberOfAdaptersInGroup; + DWORD DeclTypes; + DWORD NumSimultaneousRTs; + DWORD StretchRectFilterCaps; + WINED3DVSHADERCAPS2_0 VS20Caps; + WINED3DPSHADERCAPS2_0 PS20Caps; + DWORD VertexTextureFilterCaps; + DWORD MaxVShaderInstructionsExecuted; + DWORD MaxPShaderInstructionsExecuted; + DWORD MaxVertexShader30InstructionSlots; + DWORD MaxPixelShader30InstructionSlots; + DWORD Reserved2; /* Not in the microsoft headers but documented */ + DWORD Reserved3; + + WINEDDCAPS DirectDrawCaps; +} WINED3DCAPS; + +/* DirectDraw types */ + +typedef struct _WINEDDCOLORKEY +{ + DWORD dwColorSpaceLowValue; /* low boundary of color space that is to + * be treated as Color Key, inclusive */ + DWORD dwColorSpaceHighValue; /* high boundary of color space that is + * to be treated as Color Key, inclusive */ +} WINEDDCOLORKEY,*LPWINEDDCOLORKEY; + +typedef struct _WINEDDBLTFX +{ + DWORD dwSize; /* size of structure */ + DWORD dwDDFX; /* FX operations */ + DWORD dwROP; /* Win32 raster operations */ + DWORD dwDDROP; /* Raster operations new for DirectDraw */ + DWORD dwRotationAngle; /* Rotation angle for blt */ + DWORD dwZBufferOpCode; /* ZBuffer compares */ + DWORD dwZBufferLow; /* Low limit of Z buffer */ + DWORD dwZBufferHigh; /* High limit of Z buffer */ + DWORD dwZBufferBaseDest; /* Destination base value */ + DWORD dwZDestConstBitDepth; /* Bit depth used to specify Z constant for destination */ + union + { + DWORD dwZDestConst; /* Constant to use as Z buffer for dest */ + struct wined3d_surface *lpDDSZBufferDest; /* Surface to use as Z buffer for dest */ + } DUMMYUNIONNAME1; + DWORD dwZSrcConstBitDepth; /* Bit depth used to specify Z constant for source */ + union + { + DWORD dwZSrcConst; /* Constant to use as Z buffer for src */ + struct wined3d_surface *lpDDSZBufferSrc; /* Surface to use as Z buffer for src */ + } DUMMYUNIONNAME2; + DWORD dwAlphaEdgeBlendBitDepth; /* Bit depth used to specify constant for alpha edge blend */ + DWORD dwAlphaEdgeBlend; /* Alpha for edge blending */ + DWORD dwReserved; + DWORD dwAlphaDestConstBitDepth; /* Bit depth used to specify alpha constant for destination */ + union + { + DWORD dwAlphaDestConst; /* Constant to use as Alpha Channel */ + struct wined3d_surface *lpDDSAlphaDest; /* Surface to use as Alpha Channel */ + } DUMMYUNIONNAME3; + DWORD dwAlphaSrcConstBitDepth; /* Bit depth used to specify alpha constant for source */ + union + { + DWORD dwAlphaSrcConst; /* Constant to use as Alpha Channel */ + struct wined3d_surface *lpDDSAlphaSrc; /* Surface to use as Alpha Channel */ + } DUMMYUNIONNAME4; + union + { + DWORD dwFillColor; /* color in RGB or Palettized */ + DWORD dwFillDepth; /* depth value for z-buffer */ + DWORD dwFillPixel; /* pixel val for RGBA or RGBZ */ + struct wined3d_surface *lpDDSPattern; /* Surface to use as pattern */ + } DUMMYUNIONNAME5; + WINEDDCOLORKEY ddckDestColorkey; /* DestColorkey override */ + WINEDDCOLORKEY ddckSrcColorkey; /* SrcColorkey override */ +} WINEDDBLTFX,*LPWINEDDBLTFX; + +typedef struct _WINEDDOVERLAYFX +{ + DWORD dwSize; /* size of structure */ + DWORD dwAlphaEdgeBlendBitDepth; /* Bit depth used to specify constant for alpha edge blend */ + DWORD dwAlphaEdgeBlend; /* Constant to use as alpha for edge blend */ + DWORD dwReserved; + DWORD dwAlphaDestConstBitDepth; /* Bit depth used to specify alpha constant for destination */ + union + { + DWORD dwAlphaDestConst; /* Constant to use as alpha channel for dest */ + struct wined3d_surface *lpDDSAlphaDest; /* Surface to use as alpha channel for dest */ + } DUMMYUNIONNAME1; + DWORD dwAlphaSrcConstBitDepth; /* Bit depth used to specify alpha constant for source */ + union + { + DWORD dwAlphaSrcConst; /* Constant to use as alpha channel for src */ + struct wined3d_surface *lpDDSAlphaSrc; /* Surface to use as alpha channel for src */ + } DUMMYUNIONNAME2; + WINEDDCOLORKEY dckDestColorkey; /* DestColorkey override */ + WINEDDCOLORKEY dckSrcColorkey; /* SrcColorkey override */ + DWORD dwDDFX; /* Overlay FX */ + DWORD dwFlags; /* flags */ +} WINEDDOVERLAYFX; + +struct wined3d_buffer_desc +{ + UINT byte_width; + DWORD usage; + UINT bind_flags; + UINT cpu_access_flags; + UINT misc_flags; +}; + +struct wined3d_shader_signature_element +{ + const char *semantic_name; + UINT semantic_idx; + enum wined3d_sysval_semantic sysval_semantic; + DWORD component_type; + UINT register_idx; + DWORD mask; +}; + +struct wined3d_shader_signature +{ + UINT element_count; + struct wined3d_shader_signature_element *elements; + char *string_data; +}; + +struct wined3d_parent_ops +{ + void (__stdcall *wined3d_object_destroyed)(void *parent); +}; + +struct wined3d; +struct wined3d_buffer; +struct wined3d_clipper; +struct wined3d_device; +struct wined3d_palette; +struct wined3d_query; +struct wined3d_rendertarget_view; +struct wined3d_resource; +struct wined3d_shader; +struct wined3d_stateblock; +struct wined3d_surface; +struct wined3d_swapchain; +struct wined3d_texture; +struct wined3d_vertex_declaration; +struct wined3d_volume; + +struct wined3d_device_parent +{ + const struct wined3d_device_parent_ops *ops; +}; + +struct wined3d_device_parent_ops +{ + void (__cdecl *wined3d_device_created)(struct wined3d_device_parent *device_parent, struct wined3d_device *device); + HRESULT (__cdecl *create_surface)(struct wined3d_device_parent *device_parent, void *container_parent, + UINT width, UINT height, enum wined3d_format_id format_id, DWORD usage, WINED3DPOOL pool, + UINT level, WINED3DCUBEMAP_FACES face, struct wined3d_surface **surface); + HRESULT (__cdecl *create_rendertarget)(struct wined3d_device_parent *device_parent, void *container_parent, + UINT width, UINT height, enum wined3d_format_id format_id, WINED3DMULTISAMPLE_TYPE multisample_type, + DWORD multisample_quality, BOOL lockable, struct wined3d_surface **surface); + HRESULT (__cdecl *create_depth_stencil)(struct wined3d_device_parent *device_parent, + UINT width, UINT height, enum wined3d_format_id format_id, WINED3DMULTISAMPLE_TYPE multisample_type, + DWORD multisample_quality, BOOL discard, struct wined3d_surface **surface); + HRESULT (__cdecl *create_volume)(struct wined3d_device_parent *device_parent, void *container_parent, + UINT width, UINT height, UINT depth, enum wined3d_format_id format_id, WINED3DPOOL pool, DWORD usage, + struct wined3d_volume **volume); + HRESULT (__cdecl *create_swapchain)(struct wined3d_device_parent *device_parent, + WINED3DPRESENT_PARAMETERS *present_parameters, struct wined3d_swapchain **swapchain); +}; + +typedef HRESULT (__stdcall *D3DCB_ENUMRESOURCES)(struct wined3d_resource *resource, void *pData); + +void __stdcall wined3d_mutex_lock(void); +void __stdcall wined3d_mutex_unlock(void); + +HRESULT __cdecl wined3d_check_depth_stencil_match(const struct wined3d *wined3d, UINT adapter_idx, + WINED3DDEVTYPE device_type, enum wined3d_format_id adapter_format_id, + enum wined3d_format_id render_target_format_id, enum wined3d_format_id depth_stencil_format_id); +HRESULT __cdecl wined3d_check_device_format(const struct wined3d *wined3d, UINT adaper_idx, + WINED3DDEVTYPE device_type, enum wined3d_format_id adapter_format_id, DWORD usage, + WINED3DRESOURCETYPE resource_type, enum wined3d_format_id check_format_id, + WINED3DSURFTYPE surface_type); +HRESULT __cdecl wined3d_check_device_format_conversion(const struct wined3d *wined3d, UINT adapter_idx, + WINED3DDEVTYPE device_type, enum wined3d_format_id source_format_id, + enum wined3d_format_id target_format_id); +HRESULT __cdecl wined3d_check_device_multisample_type(const struct wined3d *wined3d, UINT adapter_idx, + WINED3DDEVTYPE device_type, enum wined3d_format_id surface_format_id, BOOL windowed, + WINED3DMULTISAMPLE_TYPE multisample_type, DWORD *quality_levels); +HRESULT __cdecl wined3d_check_device_type(const struct wined3d *wined3d, UINT adapter_idx, + WINED3DDEVTYPE device_type, enum wined3d_format_id display_format_id, + enum wined3d_format_id backbuffer_format_id, BOOL windowed); +struct wined3d * __cdecl wined3d_create(UINT dxVersion, void *parent); +ULONG __cdecl wined3d_decref(struct wined3d *wined3d); +HRESULT __cdecl wined3d_enum_adapter_modes(const struct wined3d *wined3d, UINT adapter_idx, + enum wined3d_format_id format_id, UINT mode_idx, WINED3DDISPLAYMODE *mode); +UINT __cdecl wined3d_get_adapter_count(const struct wined3d *wined3d); +HRESULT __cdecl wined3d_get_adapter_display_mode(const struct wined3d *wined3d, UINT adapter_idx, + WINED3DDISPLAYMODE *mode); +HRESULT __cdecl wined3d_get_adapter_identifier(const struct wined3d *wined3d, UINT adapter_idx, + DWORD flags, WINED3DADAPTER_IDENTIFIER *identifier); +UINT __cdecl wined3d_get_adapter_mode_count(const struct wined3d *wined3d, + UINT adapter_idx, enum wined3d_format_id format_id); +HMONITOR __cdecl wined3d_get_adapter_monitor(const struct wined3d *wined3d, UINT adapter_idx); +HRESULT __cdecl wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapter_idx, + WINED3DDEVTYPE device_type, WINED3DCAPS *caps); +void * __cdecl wined3d_get_parent(const struct wined3d *wined3d); +ULONG __cdecl wined3d_incref(struct wined3d *wined3d); +HRESULT __cdecl wined3d_register_software_device(struct wined3d *wined3d, void *init_function); + +HRESULT __cdecl wined3d_buffer_create(struct wined3d_device *device, struct wined3d_buffer_desc *desc, + const void *data, void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_buffer **buffer); +HRESULT __cdecl wined3d_buffer_create_ib(struct wined3d_device *device, UINT length, DWORD usage, WINED3DPOOL pool, + void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_buffer **buffer); +HRESULT __cdecl wined3d_buffer_create_vb(struct wined3d_device *device, UINT length, DWORD usage, WINED3DPOOL pool, + void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_buffer **buffer); +ULONG __cdecl wined3d_buffer_decref(struct wined3d_buffer *buffer); +HRESULT __cdecl wined3d_buffer_free_private_data(struct wined3d_buffer *buffer, REFGUID guid); +void * __cdecl wined3d_buffer_get_parent(const struct wined3d_buffer *buffer); +DWORD __cdecl wined3d_buffer_get_priority(const struct wined3d_buffer *buffer); +HRESULT __cdecl wined3d_buffer_get_private_data(const struct wined3d_buffer *buffer, + REFGUID guid, void *data, DWORD *data_size); +struct wined3d_resource * __cdecl wined3d_buffer_get_resource(struct wined3d_buffer *buffer); +ULONG __cdecl wined3d_buffer_incref(struct wined3d_buffer *buffer); +HRESULT __cdecl wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UINT size, BYTE **data, DWORD flags); +void __cdecl wined3d_buffer_preload(struct wined3d_buffer *buffer); +DWORD __cdecl wined3d_buffer_set_priority(struct wined3d_buffer *buffer, DWORD new_priority); +HRESULT __cdecl wined3d_buffer_set_private_data(struct wined3d_buffer *buffer, + REFGUID guid, const void *data, DWORD data_size, DWORD flags); +void __cdecl wined3d_buffer_unmap(struct wined3d_buffer *buffer); + +struct wined3d_clipper * __cdecl wined3d_clipper_create(void); +ULONG __cdecl wined3d_clipper_decref(struct wined3d_clipper *clipper); +HRESULT __cdecl wined3d_clipper_get_clip_list(const struct wined3d_clipper *clipper, + const RECT *rect, RGNDATA *clip_list, DWORD *clip_list_size); +HRESULT __cdecl wined3d_clipper_get_window(const struct wined3d_clipper *clipper, HWND *hwnd); +ULONG __cdecl wined3d_clipper_incref(struct wined3d_clipper *clipper); +HRESULT __cdecl wined3d_clipper_is_clip_list_changed(const struct wined3d_clipper *clipper, BOOL *changed); +HRESULT __cdecl wined3d_clipper_set_clip_list(struct wined3d_clipper *clipper, const RGNDATA *clip_list, DWORD flags); +HRESULT __cdecl wined3d_clipper_set_window(struct wined3d_clipper *clipper, DWORD flags, HWND hwnd); + +HRESULT __cdecl wined3d_device_acquire_focus_window(struct wined3d_device *device, HWND window); +HRESULT __cdecl wined3d_device_begin_scene(struct wined3d_device *device); +HRESULT __cdecl wined3d_device_begin_stateblock(struct wined3d_device *device); +HRESULT __cdecl wined3d_device_clear(struct wined3d_device *device, DWORD rect_count, const RECT *rects, DWORD flags, + WINED3DCOLOR color, float z, DWORD stencil); +void __cdecl wined3d_device_clear_rendertarget_view(struct wined3d_device *device, + struct wined3d_rendertarget_view *rendertarget_view, const WINED3DCOLORVALUE *color); +HRESULT __cdecl wined3d_device_color_fill(struct wined3d_device *device, struct wined3d_surface *surface, + const RECT *rect, const WINED3DCOLORVALUE *color); +HRESULT __cdecl wined3d_device_create(struct wined3d *wined3d, UINT adapter_idx, + WINED3DDEVTYPE device_type, HWND focus_window, DWORD behaviour_flags, + struct wined3d_device_parent *device_parent, struct wined3d_device **device); +ULONG __cdecl wined3d_device_decref(struct wined3d_device *device); +HRESULT __cdecl wined3d_device_delete_patch(struct wined3d_device *device, UINT handle); +HRESULT __cdecl wined3d_device_draw_indexed_primitive(struct wined3d_device *device, UINT start_idx, UINT index_count); +HRESULT __cdecl wined3d_device_draw_indexed_primitive_strided(struct wined3d_device *device, UINT index_count, + const WineDirect3DVertexStridedData *strided_data, UINT vertex_count, const void *index_data, + enum wined3d_format_id index_data_format_id); +HRESULT __cdecl wined3d_device_draw_indexed_primitive_up(struct wined3d_device *device, + UINT index_count, const void *index_data, enum wined3d_format_id index_data_format_id, + const void *stream_data, UINT stream_stride); +HRESULT __cdecl wined3d_device_draw_primitive(struct wined3d_device *device, UINT start_vertex, UINT vertex_count); +HRESULT __cdecl wined3d_device_draw_primitive_strided(struct wined3d_device *device, + UINT vertex_count, const WineDirect3DVertexStridedData *strided_data); +HRESULT __cdecl wined3d_device_draw_primitive_up(struct wined3d_device *device, + UINT vertex_count, const void *stream_data, UINT stream_stride); +HRESULT __cdecl wined3d_device_draw_rect_patch(struct wined3d_device *device, UINT handle, + const float *num_segs, const WINED3DRECTPATCH_INFO *rect_patch_info); +HRESULT __cdecl wined3d_device_draw_tri_patch(struct wined3d_device *device, UINT handle, + const float *num_segs, const WINED3DTRIPATCH_INFO *tri_patch_info); +HRESULT __cdecl wined3d_device_end_scene(struct wined3d_device *device); +HRESULT __cdecl wined3d_device_end_stateblock(struct wined3d_device *device, struct wined3d_stateblock **stateblock); +HRESULT __cdecl wined3d_device_enum_resources(struct wined3d_device *device, D3DCB_ENUMRESOURCES callback, void *data); +HRESULT __cdecl wined3d_device_evict_managed_resources(struct wined3d_device *device); +UINT __cdecl wined3d_device_get_available_texture_mem(struct wined3d_device *device); +HRESULT __cdecl wined3d_device_get_back_buffer(struct wined3d_device *device, UINT swapchain_idx, + UINT backbuffer_idx, WINED3DBACKBUFFER_TYPE backbuffer_type, struct wined3d_surface **backbuffer); +INT __cdecl wined3d_device_get_base_vertex_index(struct wined3d_device *device); +HRESULT __cdecl wined3d_device_get_clip_plane(struct wined3d_device *device, UINT plane_idx, float *plane); +HRESULT __cdecl wined3d_device_get_clip_status(struct wined3d_device *device, WINED3DCLIPSTATUS *clip_status); +HRESULT __cdecl wined3d_device_get_creation_parameters(struct wined3d_device *device, + WINED3DDEVICE_CREATION_PARAMETERS *creation_parameters); +HRESULT __cdecl wined3d_device_get_current_texture_palette(struct wined3d_device *device, UINT *palette_idx); +HRESULT __cdecl wined3d_device_get_depth_stencil(struct wined3d_device *device, + struct wined3d_surface **depth_stencil); +HRESULT __cdecl wined3d_device_get_device_caps(struct wined3d_device *device, WINED3DCAPS *caps); +HRESULT __cdecl wined3d_device_get_display_mode(struct wined3d_device *device, + UINT swapchain_idx, WINED3DDISPLAYMODE *mode); +HRESULT __cdecl wined3d_device_get_front_buffer_data(struct wined3d_device *device, + UINT swapchain_idx, struct wined3d_surface *dst_surface); +void __cdecl wined3d_device_get_gamma_ramp(struct wined3d_device *device, UINT swapchain_idx, WINED3DGAMMARAMP *ramp); +HRESULT __cdecl wined3d_device_get_index_buffer(struct wined3d_device *device, struct wined3d_buffer **index_buffer); +HRESULT __cdecl wined3d_device_get_light(struct wined3d_device *device, UINT light_idx, WINED3DLIGHT *light); +HRESULT __cdecl wined3d_device_get_light_enable(struct wined3d_device *device, UINT light_idx, BOOL *enable); +HRESULT __cdecl wined3d_device_get_material(struct wined3d_device *device, WINED3DMATERIAL *material); +float __cdecl wined3d_device_get_npatch_mode(struct wined3d_device *device); +HRESULT __cdecl wined3d_device_get_palette_entries(struct wined3d_device *device, + UINT palette_idx, PALETTEENTRY *entries); +struct wined3d_shader * __cdecl wined3d_device_get_pixel_shader(struct wined3d_device *device); +void __cdecl wined3d_device_get_primitive_type(struct wined3d_device *device, WINED3DPRIMITIVETYPE *primitive_topology); +HRESULT __cdecl wined3d_device_get_ps_consts_b(struct wined3d_device *device, + UINT start_register, BOOL *constants, UINT bool_count); +HRESULT __cdecl wined3d_device_get_ps_consts_f(struct wined3d_device *device, + UINT start_register, float *constants, UINT vector4f_count); +HRESULT __cdecl wined3d_device_get_ps_consts_i(struct wined3d_device *device, + UINT start_register, int *constants, UINT vector4i_count); +HRESULT __cdecl wined3d_device_get_raster_status(struct wined3d_device *device, + UINT swapchain_idx, WINED3DRASTER_STATUS *raster_status); +HRESULT __cdecl wined3d_device_get_render_state(struct wined3d_device *device, + WINED3DRENDERSTATETYPE state, DWORD *value); +HRESULT __cdecl wined3d_device_get_render_target(struct wined3d_device *device, + UINT render_target_idx, struct wined3d_surface **render_target); +HRESULT __cdecl wined3d_device_get_sampler_state(struct wined3d_device *device, + UINT sampler_idx, WINED3DSAMPLERSTATETYPE state, DWORD *value); +HRESULT __cdecl wined3d_device_get_scissor_rect(struct wined3d_device *device, RECT *rect); +BOOL __cdecl wined3d_device_get_software_vertex_processing(struct wined3d_device *device); +HRESULT __cdecl wined3d_device_get_stream_source(struct wined3d_device *device, + UINT stream_idx, struct wined3d_buffer **buffer, UINT *offset, UINT *stride); +HRESULT __cdecl wined3d_device_get_stream_source_freq(struct wined3d_device *device, UINT stream_idx, UINT *divider); +HRESULT __cdecl wined3d_device_get_surface_from_dc(struct wined3d_device *device, + HDC dc, struct wined3d_surface **surface); +HRESULT __cdecl wined3d_device_get_swapchain(struct wined3d_device *device, + UINT swapchain_idx, struct wined3d_swapchain **swapchain); +UINT __cdecl wined3d_device_get_swapchain_count(struct wined3d_device *device); +HRESULT __cdecl wined3d_device_get_texture(struct wined3d_device *device, + UINT stage, struct wined3d_texture **texture); +HRESULT __cdecl wined3d_device_get_texture_stage_state(struct wined3d_device *device, + UINT stage, WINED3DTEXTURESTAGESTATETYPE state, DWORD *value); +HRESULT __cdecl wined3d_device_get_transform(struct wined3d_device *device, + WINED3DTRANSFORMSTATETYPE state, WINED3DMATRIX *matrix); +HRESULT __cdecl wined3d_device_get_vertex_declaration(struct wined3d_device *device, + struct wined3d_vertex_declaration **declaration); +struct wined3d_shader * __cdecl wined3d_device_get_vertex_shader(struct wined3d_device *device); +HRESULT __cdecl wined3d_device_get_viewport(struct wined3d_device *device, WINED3DVIEWPORT *viewport); +HRESULT __cdecl wined3d_device_get_vs_consts_b(struct wined3d_device *device, + UINT start_register, BOOL *constants, UINT bool_count); +HRESULT __cdecl wined3d_device_get_vs_consts_f(struct wined3d_device *device, + UINT start_register, float *constants, UINT vector4f_count); +HRESULT __cdecl wined3d_device_get_vs_consts_i(struct wined3d_device *device, + UINT start_register, int *constants, UINT vector4i_count); +HRESULT __cdecl wined3d_device_get_wined3d(struct wined3d_device *device, struct wined3d **d3d); +ULONG __cdecl wined3d_device_incref(struct wined3d_device *device); +HRESULT __cdecl wined3d_device_init_3d(struct wined3d_device *device, WINED3DPRESENT_PARAMETERS *present_parameters); +HRESULT __cdecl wined3d_device_init_gdi(struct wined3d_device *device, WINED3DPRESENT_PARAMETERS *present_parameters); +HRESULT __cdecl wined3d_device_multiply_transform(struct wined3d_device *device, + WINED3DTRANSFORMSTATETYPE state, const WINED3DMATRIX *matrix); +HRESULT __cdecl wined3d_device_present(struct wined3d_device *device, const RECT *src_rect, + const RECT *dst_rect, HWND dst_window_override, const RGNDATA *dirty_region); +HRESULT __cdecl wined3d_device_process_vertices(struct wined3d_device *device, + UINT src_start_idx, UINT dst_idx, UINT vertex_count, struct wined3d_buffer *dst_buffer, + struct wined3d_vertex_declaration *declaration, DWORD flags, DWORD dst_fvf); +void __cdecl wined3d_device_release_focus_window(struct wined3d_device *device); +HRESULT __cdecl wined3d_device_reset(struct wined3d_device *device, WINED3DPRESENT_PARAMETERS *present_parameters); +void __cdecl wined3d_device_restore_fullscreen_window(struct wined3d_device *device, HWND window); +HRESULT __cdecl wined3d_device_set_base_vertex_index(struct wined3d_device *device, INT base_index); +HRESULT __cdecl wined3d_device_set_clip_plane(struct wined3d_device *device, UINT plane_idx, const float *plane); +HRESULT __cdecl wined3d_device_set_clip_status(struct wined3d_device *device, const WINED3DCLIPSTATUS *clip_status); +HRESULT __cdecl wined3d_device_set_current_texture_palette(struct wined3d_device *device, UINT palette_idx); +void __cdecl wined3d_device_set_cursor_position(struct wined3d_device *device, + int x_screen_space, int y_screen_space, DWORD flags); +HRESULT __cdecl wined3d_device_set_cursor_properties(struct wined3d_device *device, + UINT x_hotspot, UINT y_hotspot, struct wined3d_surface *cursor_surface); +HRESULT __cdecl wined3d_device_set_depth_stencil(struct wined3d_device *device, struct wined3d_surface *depth_stencil); +HRESULT __cdecl wined3d_device_set_dialog_box_mode(struct wined3d_device *device, BOOL enable_dialogs); +HRESULT __cdecl wined3d_device_set_display_mode(struct wined3d_device *device, + UINT swapchain_idx, const WINED3DDISPLAYMODE *mode); +void __cdecl wined3d_device_set_gamma_ramp(struct wined3d_device *device, + UINT swapchain_idx, DWORD flags, const WINED3DGAMMARAMP *ramp); +HRESULT __cdecl wined3d_device_set_index_buffer(struct wined3d_device *device, + struct wined3d_buffer *index_buffer, enum wined3d_format_id format_id); +HRESULT __cdecl wined3d_device_set_light(struct wined3d_device *device, UINT light_idx, const WINED3DLIGHT *light); +HRESULT __cdecl wined3d_device_set_light_enable(struct wined3d_device *device, UINT light_idx, BOOL enable); +HRESULT __cdecl wined3d_device_set_material(struct wined3d_device *device, const WINED3DMATERIAL *material); +void __cdecl wined3d_device_set_multithreaded(struct wined3d_device *device); +HRESULT __cdecl wined3d_device_set_npatch_mode(struct wined3d_device *device, float segments); +HRESULT __cdecl wined3d_device_set_palette_entries(struct wined3d_device *device, + UINT palette_idx, const PALETTEENTRY *entries); +HRESULT __cdecl wined3d_device_set_pixel_shader(struct wined3d_device *device, struct wined3d_shader *shader); +void __cdecl wined3d_device_set_primitive_type(struct wined3d_device *device, WINED3DPRIMITIVETYPE primitive_topology); +HRESULT __cdecl wined3d_device_set_ps_consts_b(struct wined3d_device *device, + UINT start_register, const BOOL *constants, UINT bool_count); +HRESULT __cdecl wined3d_device_set_ps_consts_f(struct wined3d_device *device, + UINT start_register, const float *constants, UINT vector4f_count); +HRESULT __cdecl wined3d_device_set_ps_consts_i(struct wined3d_device *device, + UINT start_register, const int *constants, UINT vector4i_count); +HRESULT __cdecl wined3d_device_set_render_state(struct wined3d_device *device, + WINED3DRENDERSTATETYPE state, DWORD value); +HRESULT __cdecl wined3d_device_set_render_target(struct wined3d_device *device, + UINT render_target_idx, struct wined3d_surface *render_target, BOOL set_viewport); +HRESULT __cdecl wined3d_device_set_sampler_state(struct wined3d_device *device, + UINT sampler_idx, WINED3DSAMPLERSTATETYPE state, DWORD value); +HRESULT __cdecl wined3d_device_set_scissor_rect(struct wined3d_device *device, const RECT *rect); +HRESULT __cdecl wined3d_device_set_software_vertex_processing(struct wined3d_device *device, BOOL software); +HRESULT __cdecl wined3d_device_set_stream_source(struct wined3d_device *device, + UINT stream_idx, struct wined3d_buffer *buffer, UINT offset, UINT stride); +HRESULT __cdecl wined3d_device_set_stream_source_freq(struct wined3d_device *device, UINT stream_idx, UINT divider); +HRESULT __cdecl wined3d_device_set_texture(struct wined3d_device *device, UINT stage, struct wined3d_texture *texture); +HRESULT __cdecl wined3d_device_set_texture_stage_state(struct wined3d_device *device, + UINT stage, WINED3DTEXTURESTAGESTATETYPE state, DWORD value); +HRESULT __cdecl wined3d_device_set_transform(struct wined3d_device *device, + WINED3DTRANSFORMSTATETYPE state, const WINED3DMATRIX *matrix); +HRESULT __cdecl wined3d_device_set_vertex_declaration(struct wined3d_device *device, + struct wined3d_vertex_declaration *declaration); +HRESULT __cdecl wined3d_device_set_vertex_shader(struct wined3d_device *device, struct wined3d_shader *shader); +HRESULT __cdecl wined3d_device_set_viewport(struct wined3d_device *device, const WINED3DVIEWPORT *viewport); +HRESULT __cdecl wined3d_device_set_vs_consts_b(struct wined3d_device *device, + UINT start_register, const BOOL *constants, UINT bool_count); +HRESULT __cdecl wined3d_device_set_vs_consts_f(struct wined3d_device *device, + UINT start_register, const float *constants, UINT vector4f_count); +HRESULT __cdecl wined3d_device_set_vs_consts_i(struct wined3d_device *device, + UINT start_register, const int *constants, UINT vector4i_count); +void __cdecl wined3d_device_setup_fullscreen_window(struct wined3d_device *device, HWND window, UINT w, UINT h); +BOOL __cdecl wined3d_device_show_cursor(struct wined3d_device *device, BOOL show); +HRESULT __cdecl wined3d_device_uninit_3d(struct wined3d_device *device); +HRESULT __cdecl wined3d_device_uninit_gdi(struct wined3d_device *device); +HRESULT __cdecl wined3d_device_update_surface(struct wined3d_device *device, struct wined3d_surface *src_surface, + const RECT *src_rect, struct wined3d_surface *dst_surface, const POINT *dst_point); +HRESULT __cdecl wined3d_device_update_texture(struct wined3d_device *device, + struct wined3d_texture *src_texture, struct wined3d_texture *dst_texture); +HRESULT __cdecl wined3d_device_validate_device(struct wined3d_device *device, DWORD *num_passes); + +HRESULT __cdecl wined3d_palette_create(struct wined3d_device *device, DWORD flags, + const PALETTEENTRY *entries, void *parent, struct wined3d_palette **palette); +ULONG __cdecl wined3d_palette_decref(struct wined3d_palette *palette); +HRESULT __cdecl wined3d_palette_get_entries(const struct wined3d_palette *palette, + DWORD flags, DWORD start, DWORD count, PALETTEENTRY *entries); +DWORD __cdecl wined3d_palette_get_flags(const struct wined3d_palette *palette); +void * __cdecl wined3d_palette_get_parent(const struct wined3d_palette *palette); +ULONG __cdecl wined3d_palette_incref(struct wined3d_palette *palette); +HRESULT __cdecl wined3d_palette_set_entries(struct wined3d_palette *palette, + DWORD flags, DWORD start, DWORD count, const PALETTEENTRY *entries); + +HRESULT __cdecl wined3d_query_create(struct wined3d_device *device, + WINED3DQUERYTYPE type, struct wined3d_query **query); +ULONG __cdecl wined3d_query_decref(struct wined3d_query *query); +HRESULT __cdecl wined3d_query_get_data(struct wined3d_query *query, void *data, UINT data_size, DWORD flags); +UINT __cdecl wined3d_query_get_data_size(const struct wined3d_query *query); +WINED3DQUERYTYPE __cdecl wined3d_query_get_type(const struct wined3d_query *query); +ULONG __cdecl wined3d_query_incref(struct wined3d_query *query); +HRESULT __cdecl wined3d_query_issue(struct wined3d_query *query, DWORD flags); + +void __cdecl wined3d_resource_get_desc(const struct wined3d_resource *resource, + struct wined3d_resource_desc *desc); +void * __cdecl wined3d_resource_get_parent(const struct wined3d_resource *resource); + +HRESULT __cdecl wined3d_rendertarget_view_create(struct wined3d_resource *resource, + void *parent, struct wined3d_rendertarget_view **rendertarget_view); +ULONG __cdecl wined3d_rendertarget_view_decref(struct wined3d_rendertarget_view *view); +void * __cdecl wined3d_rendertarget_view_get_parent(const struct wined3d_rendertarget_view *view); +struct wined3d_resource * __cdecl wined3d_rendertarget_view_get_resource(const struct wined3d_rendertarget_view *view); +ULONG __cdecl wined3d_rendertarget_view_incref(struct wined3d_rendertarget_view *view); + +HRESULT __cdecl wined3d_shader_create_gs(struct wined3d_device *device, const DWORD *byte_code, + const struct wined3d_shader_signature *output_signature, void *parent, + const struct wined3d_parent_ops *parent_ops, struct wined3d_shader **shader); +HRESULT __cdecl wined3d_shader_create_ps(struct wined3d_device *device, const DWORD *byte_code, + const struct wined3d_shader_signature *output_signature, void *parent, + const struct wined3d_parent_ops *parent_ops, struct wined3d_shader **shader); +HRESULT __cdecl wined3d_shader_create_vs(struct wined3d_device *device, const DWORD *byte_code, + const struct wined3d_shader_signature *output_signature, void *parent, + const struct wined3d_parent_ops *parent_ops, struct wined3d_shader **shader); +ULONG __cdecl wined3d_shader_decref(struct wined3d_shader *shader); +HRESULT __cdecl wined3d_shader_get_byte_code(const struct wined3d_shader *shader, + void *byte_code, UINT *byte_code_size); +void * __cdecl wined3d_shader_get_parent(const struct wined3d_shader *shader); +ULONG __cdecl wined3d_shader_incref(struct wined3d_shader *shader); +HRESULT __cdecl wined3d_shader_set_local_constants_float(struct wined3d_shader *shader, + UINT start_idx, const float *src_data, UINT vector4f_count); + +HRESULT __cdecl wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock); +HRESULT __cdecl wined3d_stateblock_capture(struct wined3d_stateblock *stateblock); +HRESULT __cdecl wined3d_stateblock_create(struct wined3d_device *device, + WINED3DSTATEBLOCKTYPE type, struct wined3d_stateblock **stateblock); +ULONG __cdecl wined3d_stateblock_decref(struct wined3d_stateblock *stateblock); +ULONG __cdecl wined3d_stateblock_incref(struct wined3d_stateblock *stateblock); + +HRESULT __cdecl wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst_rect, + struct wined3d_surface *src_surface, const RECT *src_rect, DWORD flags, + const WINEDDBLTFX *blt_fx, WINED3DTEXTUREFILTERTYPE filter); +HRESULT __cdecl wined3d_surface_bltfast(struct wined3d_surface *dst_surface, DWORD dst_x, DWORD dst_y, + struct wined3d_surface *src_surface, const RECT *src_rect, DWORD trans); +HRESULT __cdecl wined3d_surface_create(struct wined3d_device *device, UINT width, UINT height, + enum wined3d_format_id format_id, BOOL lockable, BOOL discard, UINT level, DWORD usage, WINED3DPOOL pool, + WINED3DMULTISAMPLE_TYPE multisample_type, DWORD multisample_quality, WINED3DSURFTYPE surface_type, + void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_surface **surface); +ULONG __cdecl wined3d_surface_decref(struct wined3d_surface *surface); +HRESULT __cdecl wined3d_surface_flip(struct wined3d_surface *surface, struct wined3d_surface *override, DWORD flags); +HRESULT __cdecl wined3d_surface_free_private_data(struct wined3d_surface *surface, REFGUID guid); +HRESULT __cdecl wined3d_surface_get_blt_status(const struct wined3d_surface *surface, DWORD flags); +struct wined3d_clipper * __cdecl wined3d_surface_get_clipper(const struct wined3d_surface *surface); +HRESULT __cdecl wined3d_surface_get_flip_status(const struct wined3d_surface *surface, DWORD flags); +HRESULT __cdecl wined3d_surface_get_overlay_position(const struct wined3d_surface *surface, LONG *x, LONG *y); +struct wined3d_palette * __cdecl wined3d_surface_get_palette(const struct wined3d_surface *surface); +void * __cdecl wined3d_surface_get_parent(const struct wined3d_surface *surface); +DWORD __cdecl wined3d_surface_get_pitch(const struct wined3d_surface *surface); +DWORD __cdecl wined3d_surface_get_priority(const struct wined3d_surface *surface); +HRESULT __cdecl wined3d_surface_get_private_data(const struct wined3d_surface *surface, + REFGUID guid, void *data, DWORD *data_size); +struct wined3d_resource * __cdecl wined3d_surface_get_resource(struct wined3d_surface *surface); +HRESULT __cdecl wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc); +ULONG __cdecl wined3d_surface_incref(struct wined3d_surface *surface); +HRESULT __cdecl wined3d_surface_is_lost(const struct wined3d_surface *surface); +HRESULT __cdecl wined3d_surface_map(struct wined3d_surface *surface, + WINED3DLOCKED_RECT *locked_rect, const RECT *rect, DWORD flags); +void __cdecl wined3d_surface_preload(struct wined3d_surface *surface); +HRESULT __cdecl wined3d_surface_releasedc(struct wined3d_surface *surface, HDC dc); +HRESULT __cdecl wined3d_surface_restore(struct wined3d_surface *surface); +HRESULT __cdecl wined3d_surface_set_clipper(struct wined3d_surface *surface, struct wined3d_clipper *clipper); +HRESULT __cdecl wined3d_surface_set_color_key(struct wined3d_surface *surface, + DWORD flags, const WINEDDCOLORKEY *color_key); +HRESULT __cdecl wined3d_surface_set_format(struct wined3d_surface *surface, enum wined3d_format_id format_id); +HRESULT __cdecl wined3d_surface_set_mem(struct wined3d_surface *surface, void *mem); +HRESULT __cdecl wined3d_surface_set_overlay_position(struct wined3d_surface *surface, LONG x, LONG y); +HRESULT __cdecl wined3d_surface_set_palette(struct wined3d_surface *surface, struct wined3d_palette *palette); +DWORD __cdecl wined3d_surface_set_priority(struct wined3d_surface *surface, DWORD new_priority); +HRESULT __cdecl wined3d_surface_set_private_data(struct wined3d_surface *surface, + REFGUID guid, const void *data, DWORD data_size, DWORD flags); +HRESULT __cdecl wined3d_surface_unmap(struct wined3d_surface *surface); +HRESULT __cdecl wined3d_surface_update_overlay(struct wined3d_surface *surface, const RECT *src_rect, + struct wined3d_surface *dst_surface, const RECT *dst_rect, DWORD flags, const WINEDDOVERLAYFX *fx); +HRESULT __cdecl wined3d_surface_update_overlay_z_order(struct wined3d_surface *surface, + DWORD flags, struct wined3d_surface *ref); + +HRESULT __cdecl wined3d_swapchain_create(struct wined3d_device *device, + WINED3DPRESENT_PARAMETERS *present_parameters, WINED3DSURFTYPE surface_type, void *parent, + const struct wined3d_parent_ops *parent_ops, struct wined3d_swapchain **swapchain); +ULONG __cdecl wined3d_swapchain_decref(struct wined3d_swapchain *swapchain); +HRESULT __cdecl wined3d_swapchain_get_back_buffer(const struct wined3d_swapchain *swapchain, + UINT backbuffer_idx, WINED3DBACKBUFFER_TYPE backbuffer_type, struct wined3d_surface **backbuffer); +struct wined3d_device * __cdecl wined3d_swapchain_get_device(const struct wined3d_swapchain *swapchain); +HRESULT __cdecl wined3d_swapchain_get_display_mode(const struct wined3d_swapchain *swapchain, + WINED3DDISPLAYMODE *mode); +HRESULT __cdecl wined3d_swapchain_get_front_buffer_data(const struct wined3d_swapchain *swapchain, + struct wined3d_surface *dst_surface); +HRESULT __cdecl wined3d_swapchain_get_gamma_ramp(const struct wined3d_swapchain *swapchain, + WINED3DGAMMARAMP *ramp); +void * __cdecl wined3d_swapchain_get_parent(const struct wined3d_swapchain *swapchain); +HRESULT __cdecl wined3d_swapchain_get_present_parameters(const struct wined3d_swapchain *swapchain, + WINED3DPRESENT_PARAMETERS *present_parameters); +HRESULT __cdecl wined3d_swapchain_get_raster_status(const struct wined3d_swapchain *swapchain, + WINED3DRASTER_STATUS *raster_status); +ULONG __cdecl wined3d_swapchain_incref(struct wined3d_swapchain *swapchain); +HRESULT __cdecl wined3d_swapchain_present(struct wined3d_swapchain *swapchain, + const RECT *src_rect, const RECT *dst_rect, HWND dst_window_override, + const RGNDATA *dirty_region, DWORD flags); +HRESULT __cdecl wined3d_swapchain_set_gamma_ramp(const struct wined3d_swapchain *swapchain, + DWORD flags, const WINED3DGAMMARAMP *ramp); +HRESULT __cdecl wined3d_swapchain_set_window(struct wined3d_swapchain *swapchain, HWND window); + +HRESULT __cdecl wined3d_texture_add_dirty_region(struct wined3d_texture *texture, + UINT layer, const WINED3DBOX *dirty_region); +HRESULT __cdecl wined3d_texture_create_2d(struct wined3d_device *device, UINT width, UINT height, + UINT level_count, DWORD usage, enum wined3d_format_id format_id, WINED3DPOOL pool, void *parent, + const struct wined3d_parent_ops *parent_ops, struct wined3d_texture **texture); +HRESULT __cdecl wined3d_texture_create_3d(struct wined3d_device *device, UINT width, UINT height, UINT depth, + UINT level_count, DWORD usage, enum wined3d_format_id format_id, WINED3DPOOL pool, void *parent, + const struct wined3d_parent_ops *parent_ops, struct wined3d_texture **texture); +HRESULT __cdecl wined3d_texture_create_cube(struct wined3d_device *device, UINT edge_length, + UINT level_count, DWORD usage, enum wined3d_format_id format_id, WINED3DPOOL pool, void *parent, + const struct wined3d_parent_ops *parent_ops, struct wined3d_texture **texture); +ULONG __cdecl wined3d_texture_decref(struct wined3d_texture *texture); +HRESULT __cdecl wined3d_texture_free_private_data(struct wined3d_texture *texture, REFGUID guid); +void __cdecl wined3d_texture_generate_mipmaps(struct wined3d_texture *texture); +WINED3DTEXTUREFILTERTYPE __cdecl wined3d_texture_get_autogen_filter_type(const struct wined3d_texture *texture); +DWORD __cdecl wined3d_texture_get_level_count(const struct wined3d_texture *texture); +DWORD __cdecl wined3d_texture_get_lod(const struct wined3d_texture *texture); +void * __cdecl wined3d_texture_get_parent(const struct wined3d_texture *texture); +DWORD __cdecl wined3d_texture_get_priority(const struct wined3d_texture *texture); +HRESULT __cdecl wined3d_texture_get_private_data(const struct wined3d_texture *texture, + REFGUID guid, void *data, DWORD *data_size); +struct wined3d_resource * __cdecl wined3d_texture_get_sub_resource(struct wined3d_texture *texture, + UINT sub_resource_idx); +WINED3DRESOURCETYPE __cdecl wined3d_texture_get_type(const struct wined3d_texture *texture); +ULONG __cdecl wined3d_texture_incref(struct wined3d_texture *texture); +void __cdecl wined3d_texture_preload(struct wined3d_texture *texture); +HRESULT __cdecl wined3d_texture_set_autogen_filter_type(struct wined3d_texture *texture, + WINED3DTEXTUREFILTERTYPE filter_type); +DWORD __cdecl wined3d_texture_set_lod(struct wined3d_texture *texture, DWORD lod); +DWORD __cdecl wined3d_texture_set_priority(struct wined3d_texture *texture, DWORD priority); +HRESULT __cdecl wined3d_texture_set_private_data(struct wined3d_texture *texture, + REFGUID guid, const void *data, DWORD data_size, DWORD flags); + +HRESULT __cdecl wined3d_vertex_declaration_create(struct wined3d_device *device, + const WINED3DVERTEXELEMENT *elements, UINT element_count, void *parent, + const struct wined3d_parent_ops *parent_ops, struct wined3d_vertex_declaration **declaration); +HRESULT __cdecl wined3d_vertex_declaration_create_from_fvf(struct wined3d_device *device, + DWORD fvf, void *parent, const struct wined3d_parent_ops *parent_ops, + struct wined3d_vertex_declaration **declaration); +ULONG __cdecl wined3d_vertex_declaration_decref(struct wined3d_vertex_declaration *declaration); +void * __cdecl wined3d_vertex_declaration_get_parent(const struct wined3d_vertex_declaration *declaration); +ULONG __cdecl wined3d_vertex_declaration_incref(struct wined3d_vertex_declaration *declaration); + +HRESULT __cdecl wined3d_volume_create(struct wined3d_device *device, UINT width, UINT height, UINT depth, + DWORD usage, enum wined3d_format_id format_id, WINED3DPOOL pool, void *parent, + const struct wined3d_parent_ops *parent_ops, struct wined3d_volume **volume); +ULONG __cdecl wined3d_volume_decref(struct wined3d_volume *volume); +HRESULT __cdecl wined3d_volume_free_private_data(struct wined3d_volume *volume, REFGUID guid); +struct wined3d_volume * __cdecl wined3d_volume_from_resource(struct wined3d_resource *resource); +void * __cdecl wined3d_volume_get_parent(const struct wined3d_volume *volume); +DWORD __cdecl wined3d_volume_get_priority(const struct wined3d_volume *volume); +HRESULT __cdecl wined3d_volume_get_private_data(const struct wined3d_volume *volume, + REFGUID guid, void *data, DWORD *data_size); +struct wined3d_resource * __cdecl wined3d_volume_get_resource(struct wined3d_volume *volume); +ULONG __cdecl wined3d_volume_incref(struct wined3d_volume *volume); +HRESULT __cdecl wined3d_volume_map(struct wined3d_volume *volume, + WINED3DLOCKED_BOX *locked_box, const WINED3DBOX *box, DWORD flags); +void __cdecl wined3d_volume_preload(struct wined3d_volume *volume); +DWORD __cdecl wined3d_volume_set_priority(struct wined3d_volume *volume, DWORD new_priority); +HRESULT __cdecl wined3d_volume_set_private_data(struct wined3d_volume *volume, + REFGUID guid, const void *data, DWORD data_size, DWORD flags); +HRESULT __cdecl wined3d_volume_unmap(struct wined3d_volume *volume); + +#endif /* __WINE_WINED3D_H */ diff --git a/include/reactos/wine/wined3d.idl b/include/reactos/wine/wined3d.idl deleted file mode 100644 index 99f29763b72..00000000000 --- a/include/reactos/wine/wined3d.idl +++ /dev/null @@ -1,3388 +0,0 @@ -/* - * Copyright 2002-2003 The wine-d3d team - * Copyright 2002-2003 Jason Edmeades - * Copyright 2002-2003 Raphael Junqueira - * Copyright 2005 Oliver Stieber - * Copyright 2006 Stefan Dösinger - * Copyright 2006 Stefan Dösinger for CodeWeavers - * Copyright 2007 Henri Verbeet - * Copyright 2008 Henri Verbeet for CodeWeavers - * - * 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 - */ - -import "unknwn.idl"; - -cpp_quote("#if 0") -typedef HANDLE HMONITOR; - -typedef struct _RGNDATAHEADER -{ - DWORD dwSize; - DWORD iType; - DWORD nCount; - DWORD nRgnSize; - RECT rcBound; -} RGNDATAHEADER; - -typedef struct _RGNDATA -{ - RGNDATAHEADER rdh; - char Buffer[1]; -} RGNDATA; - -typedef struct _LUID -{ - DWORD LowPart; - LONG HighPart; -} LUID, *PLUID; -cpp_quote("#endif") - -cpp_quote("#define WINED3D_OK S_OK") - -const UINT _FACWINED3D = 0x876; -cpp_quote("#define MAKE_WINED3DSTATUS(code) MAKE_HRESULT(0, _FACWINED3D, code)") -cpp_quote("#define WINED3DOK_NOAUTOGEN MAKE_WINED3DSTATUS(2159)") - -cpp_quote("#define MAKE_WINED3DHRESULT(code) MAKE_HRESULT(1, _FACWINED3D, code)") -cpp_quote("#define WINED3DERR_WRONGTEXTUREFORMAT MAKE_WINED3DHRESULT(2072)") -cpp_quote("#define WINED3DERR_UNSUPPORTEDCOLOROPERATION MAKE_WINED3DHRESULT(2073)") -cpp_quote("#define WINED3DERR_UNSUPPORTEDCOLORARG MAKE_WINED3DHRESULT(2074)") -cpp_quote("#define WINED3DERR_UNSUPPORTEDALPHAOPERATION MAKE_WINED3DHRESULT(2075)") -cpp_quote("#define WINED3DERR_UNSUPPORTEDALPHAARG MAKE_WINED3DHRESULT(2076)") -cpp_quote("#define WINED3DERR_TOOMANYOPERATIONS MAKE_WINED3DHRESULT(2077)") -cpp_quote("#define WINED3DERR_CONFLICTINGTEXTUREFILTER MAKE_WINED3DHRESULT(2078)") -cpp_quote("#define WINED3DERR_UNSUPPORTEDFACTORVALUE MAKE_WINED3DHRESULT(2079)") -cpp_quote("#define WINED3DERR_CONFLICTINGRENDERSTATE MAKE_WINED3DHRESULT(2081)") -cpp_quote("#define WINED3DERR_UNSUPPORTEDTEXTUREFILTER MAKE_WINED3DHRESULT(2082)") -cpp_quote("#define WINED3DERR_CONFLICTINGTEXTUREPALETTE MAKE_WINED3DHRESULT(2086)") -cpp_quote("#define WINED3DERR_DRIVERINTERNALERROR MAKE_WINED3DHRESULT(2087)") -cpp_quote("#define WINED3DERR_NOTFOUND MAKE_WINED3DHRESULT(2150)") -cpp_quote("#define WINED3DERR_MOREDATA MAKE_WINED3DHRESULT(2151)") -cpp_quote("#define WINED3DERR_DEVICELOST MAKE_WINED3DHRESULT(2152)") -cpp_quote("#define WINED3DERR_DEVICENOTRESET MAKE_WINED3DHRESULT(2153)") -cpp_quote("#define WINED3DERR_NOTAVAILABLE MAKE_WINED3DHRESULT(2154)") -cpp_quote("#define WINED3DERR_OUTOFVIDEOMEMORY MAKE_WINED3DHRESULT(380)") -cpp_quote("#define WINED3DERR_INVALIDDEVICE MAKE_WINED3DHRESULT(2155)") -cpp_quote("#define WINED3DERR_INVALIDCALL MAKE_WINED3DHRESULT(2156)") -cpp_quote("#define WINED3DERR_DRIVERINVALIDCALL MAKE_WINED3DHRESULT(2157)") -cpp_quote("#define WINED3DERR_WASSTILLDRAWING MAKE_WINED3DHRESULT(540)") -cpp_quote("#define WINEDDERR_NOTAOVERLAYSURFACE MAKE_WINED3DHRESULT(580)") -cpp_quote("#define WINEDDERR_NOTLOCKED MAKE_WINED3DHRESULT(584)") -cpp_quote("#define WINEDDERR_NODC MAKE_WINED3DHRESULT(586)") -cpp_quote("#define WINEDDERR_DCALREADYCREATED MAKE_WINED3DHRESULT(620)") -cpp_quote("#define WINEDDERR_NOTFLIPPABLE MAKE_WINED3DHRESULT(582)") -cpp_quote("#define WINEDDERR_SURFACEBUSY MAKE_WINED3DHRESULT(430)") -cpp_quote("#define WINEDDERR_INVALIDRECT MAKE_WINED3DHRESULT(150)") -cpp_quote("#define WINEDDERR_NOCLIPLIST MAKE_WINED3DHRESULT(205)") -cpp_quote("#define WINEDDERR_OVERLAYNOTVISIBLE MAKE_WINED3DHRESULT(577)") - -typedef DWORD WINED3DCOLOR; - -typedef enum _WINED3DLIGHTTYPE -{ - WINED3DLIGHT_POINT = 1, - WINED3DLIGHT_SPOT = 2, - WINED3DLIGHT_DIRECTIONAL = 3, - WINED3DLIGHT_PARALLELPOINT = 4, /* D3D7 */ - WINED3DLIGHT_GLSPOT = 5, /* D3D7 */ - WINED3DLIGHT_FORCE_DWORD = 0x7fffffff -} WINED3DLIGHTTYPE; - -typedef enum _WINED3DPRIMITIVETYPE -{ - WINED3DPT_UNDEFINED = 0, - WINED3DPT_POINTLIST = 1, - WINED3DPT_LINELIST = 2, - WINED3DPT_LINESTRIP = 3, - WINED3DPT_TRIANGLELIST = 4, - WINED3DPT_TRIANGLESTRIP = 5, - WINED3DPT_TRIANGLEFAN = 6, - WINED3DPT_LINELIST_ADJ = 10, - WINED3DPT_LINESTRIP_ADJ = 11, - WINED3DPT_TRIANGLELIST_ADJ = 12, - WINED3DPT_TRIANGLESTRIP_ADJ = 13, - WINED3DPT_FORCE_DWORD = 0x7fffffff -} WINED3DPRIMITIVETYPE; - -typedef enum _WINED3DDEVTYPE -{ - WINED3DDEVTYPE_HAL = 1, - WINED3DDEVTYPE_REF = 2, - WINED3DDEVTYPE_SW = 3, - WINED3DDEVTYPE_NULLREF = 4, - WINED3DDEVTYPE_FORCE_DWORD = 0xffffffff -} WINED3DDEVTYPE; - -typedef enum _WINED3DDEGREETYPE -{ - WINED3DDEGREE_LINEAR = 1, - WINED3DDEGREE_QUADRATIC = 2, - WINED3DDEGREE_CUBIC = 3, - WINED3DDEGREE_QUINTIC = 5, - WINED3DDEGREE_FORCE_DWORD = 0x7fffffff -} WINED3DDEGREETYPE; - -enum wined3d_format_id -{ - WINED3DFMT_UNKNOWN, - WINED3DFMT_B8G8R8_UNORM, - WINED3DFMT_B5G5R5X1_UNORM, - WINED3DFMT_B4G4R4A4_UNORM, - WINED3DFMT_B2G3R3_UNORM, - WINED3DFMT_B2G3R3A8_UNORM, - WINED3DFMT_B4G4R4X4_UNORM, - WINED3DFMT_R8G8B8X8_UNORM, - WINED3DFMT_B10G10R10A2_UNORM, - WINED3DFMT_P8_UINT_A8_UNORM, - WINED3DFMT_P8_UINT, - WINED3DFMT_L8_UNORM, - WINED3DFMT_L8A8_UNORM, - WINED3DFMT_L4A4_UNORM, - WINED3DFMT_R5G5_SNORM_L6_UNORM, - WINED3DFMT_R8G8_SNORM_L8X8_UNORM, - WINED3DFMT_R10G11B11_SNORM, - WINED3DFMT_R10G10B10_SNORM_A2_UNORM, - WINED3DFMT_D16_LOCKABLE, - WINED3DFMT_D32_UNORM, - WINED3DFMT_S1_UINT_D15_UNORM, - WINED3DFMT_X8D24_UNORM, - WINED3DFMT_S4X4_UINT_D24_UNORM, - WINED3DFMT_L16_UNORM, - WINED3DFMT_S8_UINT_D24_FLOAT, - WINED3DFMT_VERTEXDATA, - WINED3DFMT_R8G8_SNORM_Cx, - WINED3DFMT_R32G32B32A32_TYPELESS, - WINED3DFMT_R32G32B32A32_FLOAT, - WINED3DFMT_R32G32B32A32_UINT, - WINED3DFMT_R32G32B32A32_SINT, - WINED3DFMT_R32G32B32_TYPELESS, - WINED3DFMT_R32G32B32_FLOAT, - WINED3DFMT_R32G32B32_UINT, - WINED3DFMT_R32G32B32_SINT, - WINED3DFMT_R16G16B16A16_TYPELESS, - WINED3DFMT_R16G16B16A16_FLOAT, - WINED3DFMT_R16G16B16A16_UNORM, - WINED3DFMT_R16G16B16A16_UINT, - WINED3DFMT_R16G16B16A16_SNORM, - WINED3DFMT_R16G16B16A16_SINT, - WINED3DFMT_R32G32_TYPELESS, - WINED3DFMT_R32G32_FLOAT, - WINED3DFMT_R32G32_UINT, - WINED3DFMT_R32G32_SINT, - WINED3DFMT_R32G8X24_TYPELESS, - WINED3DFMT_D32_FLOAT_S8X24_UINT, - WINED3DFMT_R32_FLOAT_X8X24_TYPELESS, - WINED3DFMT_X32_TYPELESS_G8X24_UINT, - WINED3DFMT_R10G10B10A2_TYPELESS, - WINED3DFMT_R10G10B10A2_UNORM, - WINED3DFMT_R10G10B10A2_UINT, - WINED3DFMT_R10G10B10A2_SNORM, - WINED3DFMT_R11G11B10_FLOAT, - WINED3DFMT_R8G8B8A8_TYPELESS, - WINED3DFMT_R8G8B8A8_UNORM, - WINED3DFMT_R8G8B8A8_UNORM_SRGB, - WINED3DFMT_R8G8B8A8_UINT, - WINED3DFMT_R8G8B8A8_SNORM, - WINED3DFMT_R8G8B8A8_SINT, - WINED3DFMT_R16G16_TYPELESS, - WINED3DFMT_R16G16_FLOAT, - WINED3DFMT_R16G16_UNORM, - WINED3DFMT_R16G16_UINT, - WINED3DFMT_R16G16_SNORM, - WINED3DFMT_R16G16_SINT, - WINED3DFMT_R32_TYPELESS, - WINED3DFMT_D32_FLOAT, - WINED3DFMT_R32_FLOAT, - WINED3DFMT_R32_UINT, - WINED3DFMT_R32_SINT, - WINED3DFMT_R24G8_TYPELESS, - WINED3DFMT_D24_UNORM_S8_UINT, - WINED3DFMT_R24_UNORM_X8_TYPELESS, - WINED3DFMT_X24_TYPELESS_G8_UINT, - WINED3DFMT_R8G8_TYPELESS, - WINED3DFMT_R8G8_UNORM, - WINED3DFMT_R8G8_UINT, - WINED3DFMT_R8G8_SNORM, - WINED3DFMT_R8G8_SINT, - WINED3DFMT_R16_TYPELESS, - WINED3DFMT_R16_FLOAT, - WINED3DFMT_D16_UNORM, - WINED3DFMT_R16_UNORM, - WINED3DFMT_R16_UINT, - WINED3DFMT_R16_SNORM, - WINED3DFMT_R16_SINT, - WINED3DFMT_R8_TYPELESS, - WINED3DFMT_R8_UNORM, - WINED3DFMT_R8_UINT, - WINED3DFMT_R8_SNORM, - WINED3DFMT_R8_SINT, - WINED3DFMT_A8_UNORM, - WINED3DFMT_R1_UNORM, - WINED3DFMT_R9G9B9E5_SHAREDEXP, - WINED3DFMT_R8G8_B8G8_UNORM, - WINED3DFMT_G8R8_G8B8_UNORM, - WINED3DFMT_BC1_TYPELESS, - WINED3DFMT_BC1_UNORM, - WINED3DFMT_BC1_UNORM_SRGB, - WINED3DFMT_BC2_TYPELESS, - WINED3DFMT_BC2_UNORM, - WINED3DFMT_BC2_UNORM_SRGB, - WINED3DFMT_BC3_TYPELESS, - WINED3DFMT_BC3_UNORM, - WINED3DFMT_BC3_UNORM_SRGB, - WINED3DFMT_BC4_TYPELESS, - WINED3DFMT_BC4_UNORM, - WINED3DFMT_BC4_SNORM, - WINED3DFMT_BC5_TYPELESS, - WINED3DFMT_BC5_UNORM, - WINED3DFMT_BC5_SNORM, - WINED3DFMT_B5G6R5_UNORM, - WINED3DFMT_B5G5R5A1_UNORM, - WINED3DFMT_B8G8R8A8_UNORM, - WINED3DFMT_B8G8R8X8_UNORM, - /* FOURCC formats. */ - WINED3DFMT_UYVY = 0x59565955, /* UYVY */ - WINED3DFMT_YUY2 = 0x32595559, /* YUY2 */ - WINED3DFMT_YV12 = 0x32315659, /* YV12 */ - WINED3DFMT_DXT1 = 0x31545844, /* DXT1 */ - WINED3DFMT_DXT2 = 0x32545844, /* DXT2 */ - WINED3DFMT_DXT3 = 0x33545844, /* DXT3 */ - WINED3DFMT_DXT4 = 0x34545844, /* DXT4 */ - WINED3DFMT_DXT5 = 0x35545844, /* DXT5 */ - WINED3DFMT_MULTI2_ARGB8 = 0x3154454d, /* MET1 */ - WINED3DFMT_G8R8_G8B8 = 0x42475247, /* GRGB */ - WINED3DFMT_R8G8_B8G8 = 0x47424752, /* RGBG */ - WINED3DFMT_ATI2N = 0x32495441, /* ATI2 */ - WINED3DFMT_INST = 0x54534e49, /* INST */ - WINED3DFMT_NVDB = 0x4244564e, /* NVDB */ - WINED3DFMT_NVHU = 0x5548564e, /* NVHU */ - WINED3DFMT_NVHS = 0x5348564e, /* NVHS */ - - WINED3DFMT_FORCE_DWORD = 0xffffffff -}; - -typedef enum _WINED3DRENDERSTATETYPE -{ - WINED3DRS_ANTIALIAS = 2, /* d3d7 */ - WINED3DRS_TEXTUREPERSPECTIVE = 4, /* d3d7 */ - WINED3DRS_WRAPU = 5, /* d3d7 */ - WINED3DRS_WRAPV = 6, /* d3d7 */ - WINED3DRS_ZENABLE = 7, - WINED3DRS_FILLMODE = 8, - WINED3DRS_SHADEMODE = 9, - WINED3DRS_LINEPATTERN = 10, /* d3d7, d3d8 */ - WINED3DRS_MONOENABLE = 11, /* d3d7 */ - WINED3DRS_ROP2 = 12, /* d3d7 */ - WINED3DRS_PLANEMASK = 13, /* d3d7 */ - WINED3DRS_ZWRITEENABLE = 14, - WINED3DRS_ALPHATESTENABLE = 15, - WINED3DRS_LASTPIXEL = 16, - WINED3DRS_SRCBLEND = 19, - WINED3DRS_DESTBLEND = 20, - WINED3DRS_CULLMODE = 22, - WINED3DRS_ZFUNC = 23, - WINED3DRS_ALPHAREF = 24, - WINED3DRS_ALPHAFUNC = 25, - WINED3DRS_DITHERENABLE = 26, - WINED3DRS_ALPHABLENDENABLE = 27, - WINED3DRS_FOGENABLE = 28, - WINED3DRS_SPECULARENABLE = 29, - WINED3DRS_ZVISIBLE = 30, /* d3d7, d3d8 */ - WINED3DRS_SUBPIXEL = 31, /* d3d7 */ - WINED3DRS_SUBPIXELX = 32, /* d3d7 */ - WINED3DRS_STIPPLEDALPHA = 33, /* d3d7 */ - WINED3DRS_FOGCOLOR = 34, - WINED3DRS_FOGTABLEMODE = 35, - WINED3DRS_FOGSTART = 36, - WINED3DRS_FOGEND = 37, - WINED3DRS_FOGDENSITY = 38, - WINED3DRS_STIPPLEENABLE = 39, /* d3d7 */ - WINED3DRS_EDGEANTIALIAS = 40, /* d3d7, d3d8 */ - WINED3DRS_COLORKEYENABLE = 41, /* d3d7 */ - WINED3DRS_MIPMAPLODBIAS = 46, /* d3d7 */ - WINED3DRS_ZBIAS = 47, /* d3d7, d3d8 */ - WINED3DRS_RANGEFOGENABLE = 48, - WINED3DRS_ANISOTROPY = 49, /* d3d7 */ - WINED3DRS_FLUSHBATCH = 50, /* d3d7 */ - WINED3DRS_TRANSLUCENTSORTINDEPENDENT = 51, /* d3d7 */ - WINED3DRS_STENCILENABLE = 52, - WINED3DRS_STENCILFAIL = 53, - WINED3DRS_STENCILZFAIL = 54, - WINED3DRS_STENCILPASS = 55, - WINED3DRS_STENCILFUNC = 56, - WINED3DRS_STENCILREF = 57, - WINED3DRS_STENCILMASK = 58, - WINED3DRS_STENCILWRITEMASK = 59, - WINED3DRS_TEXTUREFACTOR = 60, - WINED3DRS_WRAP0 = 128, - WINED3DRS_WRAP1 = 129, - WINED3DRS_WRAP2 = 130, - WINED3DRS_WRAP3 = 131, - WINED3DRS_WRAP4 = 132, - WINED3DRS_WRAP5 = 133, - WINED3DRS_WRAP6 = 134, - WINED3DRS_WRAP7 = 135, - WINED3DRS_CLIPPING = 136, - WINED3DRS_LIGHTING = 137, - WINED3DRS_EXTENTS = 138, /* d3d7 */ - WINED3DRS_AMBIENT = 139, - WINED3DRS_FOGVERTEXMODE = 140, - WINED3DRS_COLORVERTEX = 141, - WINED3DRS_LOCALVIEWER = 142, - WINED3DRS_NORMALIZENORMALS = 143, - WINED3DRS_COLORKEYBLENDENABLE = 144, /* d3d7 */ - WINED3DRS_DIFFUSEMATERIALSOURCE = 145, - WINED3DRS_SPECULARMATERIALSOURCE = 146, - WINED3DRS_AMBIENTMATERIALSOURCE = 147, - WINED3DRS_EMISSIVEMATERIALSOURCE = 148, - WINED3DRS_VERTEXBLEND = 151, - WINED3DRS_CLIPPLANEENABLE = 152, - WINED3DRS_SOFTWAREVERTEXPROCESSING = 153, /* d3d8 */ - WINED3DRS_POINTSIZE = 154, - WINED3DRS_POINTSIZE_MIN = 155, - WINED3DRS_POINTSPRITEENABLE = 156, - WINED3DRS_POINTSCALEENABLE = 157, - WINED3DRS_POINTSCALE_A = 158, - WINED3DRS_POINTSCALE_B = 159, - WINED3DRS_POINTSCALE_C = 160, - WINED3DRS_MULTISAMPLEANTIALIAS = 161, - WINED3DRS_MULTISAMPLEMASK = 162, - WINED3DRS_PATCHEDGESTYLE = 163, - WINED3DRS_PATCHSEGMENTS = 164, /* d3d8 */ - WINED3DRS_DEBUGMONITORTOKEN = 165, - WINED3DRS_POINTSIZE_MAX = 166, - WINED3DRS_INDEXEDVERTEXBLENDENABLE = 167, - WINED3DRS_COLORWRITEENABLE = 168, - WINED3DRS_TWEENFACTOR = 170, - WINED3DRS_BLENDOP = 171, - WINED3DRS_POSITIONDEGREE = 172, - WINED3DRS_NORMALDEGREE = 173, - WINED3DRS_SCISSORTESTENABLE = 174, - WINED3DRS_SLOPESCALEDEPTHBIAS = 175, - WINED3DRS_ANTIALIASEDLINEENABLE = 176, - WINED3DRS_MINTESSELLATIONLEVEL = 178, - WINED3DRS_MAXTESSELLATIONLEVEL = 179, - WINED3DRS_ADAPTIVETESS_X = 180, - WINED3DRS_ADAPTIVETESS_Y = 181, - WINED3DRS_ADAPTIVETESS_Z = 182, - WINED3DRS_ADAPTIVETESS_W = 183, - WINED3DRS_ENABLEADAPTIVETESSELLATION = 184, - WINED3DRS_TWOSIDEDSTENCILMODE = 185, - WINED3DRS_CCW_STENCILFAIL = 186, - WINED3DRS_CCW_STENCILZFAIL = 187, - WINED3DRS_CCW_STENCILPASS = 188, - WINED3DRS_CCW_STENCILFUNC = 189, - WINED3DRS_COLORWRITEENABLE1 = 190, - WINED3DRS_COLORWRITEENABLE2 = 191, - WINED3DRS_COLORWRITEENABLE3 = 192, - WINED3DRS_BLENDFACTOR = 193, - WINED3DRS_SRGBWRITEENABLE = 194, - WINED3DRS_DEPTHBIAS = 195, - WINED3DRS_WRAP8 = 198, - WINED3DRS_WRAP9 = 199, - WINED3DRS_WRAP10 = 200, - WINED3DRS_WRAP11 = 201, - WINED3DRS_WRAP12 = 202, - WINED3DRS_WRAP13 = 203, - WINED3DRS_WRAP14 = 204, - WINED3DRS_WRAP15 = 205, - WINED3DRS_SEPARATEALPHABLENDENABLE = 206, - WINED3DRS_SRCBLENDALPHA = 207, - WINED3DRS_DESTBLENDALPHA = 208, - WINED3DRS_BLENDOPALPHA = 209, - WINED3DRS_FORCE_DWORD = 0x7fffffff -} WINED3DRENDERSTATETYPE; -const UINT WINEHIGHEST_RENDER_STATE = WINED3DRS_BLENDOPALPHA; - -typedef enum _WINED3DBLEND -{ - WINED3DBLEND_ZERO = 1, - WINED3DBLEND_ONE = 2, - WINED3DBLEND_SRCCOLOR = 3, - WINED3DBLEND_INVSRCCOLOR = 4, - WINED3DBLEND_SRCALPHA = 5, - WINED3DBLEND_INVSRCALPHA = 6, - WINED3DBLEND_DESTALPHA = 7, - WINED3DBLEND_INVDESTALPHA = 8, - WINED3DBLEND_DESTCOLOR = 9, - WINED3DBLEND_INVDESTCOLOR = 10, - WINED3DBLEND_SRCALPHASAT = 11, - WINED3DBLEND_BOTHSRCALPHA = 12, - WINED3DBLEND_BOTHINVSRCALPHA = 13, - WINED3DBLEND_BLENDFACTOR = 14, - WINED3DBLEND_INVBLENDFACTOR = 15, - WINED3DBLEND_FORCE_DWORD = 0x7fffffff -} WINED3DBLEND; - -typedef enum _WINED3DBLENDOP -{ - WINED3DBLENDOP_ADD = 1, - WINED3DBLENDOP_SUBTRACT = 2, - WINED3DBLENDOP_REVSUBTRACT = 3, - WINED3DBLENDOP_MIN = 4, - WINED3DBLENDOP_MAX = 5, - WINED3DBLENDOP_FORCE_DWORD = 0x7fffffff -} WINED3DBLENDOP; - -typedef enum _WINED3DVERTEXBLENDFLAGS -{ - WINED3DVBF_DISABLE = 0, - WINED3DVBF_1WEIGHTS = 1, - WINED3DVBF_2WEIGHTS = 2, - WINED3DVBF_3WEIGHTS = 3, - WINED3DVBF_TWEENING = 255, - WINED3DVBF_0WEIGHTS = 256 -} WINED3DVERTEXBLENDFLAGS; - -typedef enum _WINED3DCMPFUNC -{ - WINED3DCMP_NEVER = 1, - WINED3DCMP_LESS = 2, - WINED3DCMP_EQUAL = 3, - WINED3DCMP_LESSEQUAL = 4, - WINED3DCMP_GREATER = 5, - WINED3DCMP_NOTEQUAL = 6, - WINED3DCMP_GREATEREQUAL = 7, - WINED3DCMP_ALWAYS = 8, - WINED3DCMP_FORCE_DWORD = 0x7fffffff -} WINED3DCMPFUNC; - -typedef enum _WINED3DZBUFFERTYPE -{ - WINED3DZB_FALSE = 0, - WINED3DZB_TRUE = 1, - WINED3DZB_USEW = 2, - WINED3DZB_FORCE_DWORD = 0x7fffffff -} WINED3DZBUFFERTYPE; - -typedef enum _WINED3DFOGMODE -{ - WINED3DFOG_NONE = 0, - WINED3DFOG_EXP = 1, - WINED3DFOG_EXP2 = 2, - WINED3DFOG_LINEAR = 3, - WINED3DFOG_FORCE_DWORD = 0x7fffffff -} WINED3DFOGMODE; - -typedef enum _WINED3DSHADEMODE -{ - WINED3DSHADE_FLAT = 1, - WINED3DSHADE_GOURAUD = 2, - WINED3DSHADE_PHONG = 3, - WINED3DSHADE_FORCE_DWORD = 0x7fffffff -} WINED3DSHADEMODE; - -typedef enum _WINED3DFILLMODE -{ - WINED3DFILL_POINT = 1, - WINED3DFILL_WIREFRAME = 2, - WINED3DFILL_SOLID = 3, - WINED3DFILL_FORCE_DWORD = 0x7fffffff -} WINED3DFILLMODE; - -typedef enum _WINED3DCULL -{ - WINED3DCULL_NONE = 1, - WINED3DCULL_CW = 2, - WINED3DCULL_CCW = 3, - WINED3DCULL_FORCE_DWORD = 0x7fffffff -} WINED3DCULL; - -typedef enum _WINED3DSTENCILOP -{ - WINED3DSTENCILOP_KEEP = 1, - WINED3DSTENCILOP_ZERO = 2, - WINED3DSTENCILOP_REPLACE = 3, - WINED3DSTENCILOP_INCRSAT = 4, - WINED3DSTENCILOP_DECRSAT = 5, - WINED3DSTENCILOP_INVERT = 6, - WINED3DSTENCILOP_INCR = 7, - WINED3DSTENCILOP_DECR = 8, - WINED3DSTENCILOP_FORCE_DWORD = 0x7fffffff -} WINED3DSTENCILOP; - -typedef enum _WINED3DMATERIALCOLORSOURCE -{ - WINED3DMCS_MATERIAL = 0, - WINED3DMCS_COLOR1 = 1, - WINED3DMCS_COLOR2 = 2, - WINED3DMCS_FORCE_DWORD = 0x7fffffff -} WINED3DMATERIALCOLORSOURCE; - -typedef enum _WINED3DPATCHEDGESTYLE -{ - WINED3DPATCHEDGE_DISCRETE = 0, - WINED3DPATCHEDGE_CONTINUOUS = 1, - WINED3DPATCHEDGE_FORCE_DWORD = 0x7fffffff -} WINED3DPATCHEDGESTYLE; - -typedef enum _WINED3DBACKBUFFER_TYPE -{ - WINED3DBACKBUFFER_TYPE_MONO = 0, - WINED3DBACKBUFFER_TYPE_LEFT = 1, - WINED3DBACKBUFFER_TYPE_RIGHT = 2, - WINED3DBACKBUFFER_TYPE_FORCE_DWORD = 0x7fffffff -} WINED3DBACKBUFFER_TYPE; - -typedef enum _WINED3DSWAPEFFECT -{ - WINED3DSWAPEFFECT_DISCARD = 1, - WINED3DSWAPEFFECT_FLIP = 2, - WINED3DSWAPEFFECT_COPY = 3, - WINED3DSWAPEFFECT_COPY_VSYNC = 4, - WINED3DSWAPEFFECT_FORCE_DWORD = 0xffffffff -} WINED3DSWAPEFFECT; - -typedef enum _WINED3DSAMPLERSTATETYPE -{ - WINED3DSAMP_ADDRESSU = 1, - WINED3DSAMP_ADDRESSV = 2, - WINED3DSAMP_ADDRESSW = 3, - WINED3DSAMP_BORDERCOLOR = 4, - WINED3DSAMP_MAGFILTER = 5, - WINED3DSAMP_MINFILTER = 6, - WINED3DSAMP_MIPFILTER = 7, - WINED3DSAMP_MIPMAPLODBIAS = 8, - WINED3DSAMP_MAXMIPLEVEL = 9, - WINED3DSAMP_MAXANISOTROPY = 10, - WINED3DSAMP_SRGBTEXTURE = 11, - WINED3DSAMP_ELEMENTINDEX = 12, - WINED3DSAMP_DMAPOFFSET = 13, - WINED3DSAMP_FORCE_DWORD = 0x7fffffff, -} WINED3DSAMPLERSTATETYPE; -const UINT WINED3D_HIGHEST_SAMPLER_STATE = WINED3DSAMP_DMAPOFFSET; - -typedef enum _WINED3DMULTISAMPLE_TYPE -{ - WINED3DMULTISAMPLE_NONE = 0, - WINED3DMULTISAMPLE_NONMASKABLE = 1, - WINED3DMULTISAMPLE_2_SAMPLES = 2, - WINED3DMULTISAMPLE_3_SAMPLES = 3, - WINED3DMULTISAMPLE_4_SAMPLES = 4, - WINED3DMULTISAMPLE_5_SAMPLES = 5, - WINED3DMULTISAMPLE_6_SAMPLES = 6, - WINED3DMULTISAMPLE_7_SAMPLES = 7, - WINED3DMULTISAMPLE_8_SAMPLES = 8, - WINED3DMULTISAMPLE_9_SAMPLES = 9, - WINED3DMULTISAMPLE_10_SAMPLES = 10, - WINED3DMULTISAMPLE_11_SAMPLES = 11, - WINED3DMULTISAMPLE_12_SAMPLES = 12, - WINED3DMULTISAMPLE_13_SAMPLES = 13, - WINED3DMULTISAMPLE_14_SAMPLES = 14, - WINED3DMULTISAMPLE_15_SAMPLES = 15, - WINED3DMULTISAMPLE_16_SAMPLES = 16, - WINED3DMULTISAMPLE_FORCE_DWORD = 0xffffffff -} WINED3DMULTISAMPLE_TYPE; - -typedef enum _WINED3DTEXTURESTAGESTATETYPE -{ - WINED3DTSS_COLOROP = 0, - WINED3DTSS_COLORARG1 = 1, - WINED3DTSS_COLORARG2 = 2, - WINED3DTSS_ALPHAOP = 3, - WINED3DTSS_ALPHAARG1 = 4, - WINED3DTSS_ALPHAARG2 = 5, - WINED3DTSS_BUMPENVMAT00 = 6, - WINED3DTSS_BUMPENVMAT01 = 7, - WINED3DTSS_BUMPENVMAT10 = 8, - WINED3DTSS_BUMPENVMAT11 = 9, - WINED3DTSS_TEXCOORDINDEX = 10, - WINED3DTSS_BUMPENVLSCALE = 11, - WINED3DTSS_BUMPENVLOFFSET = 12, - WINED3DTSS_TEXTURETRANSFORMFLAGS = 13, - WINED3DTSS_COLORARG0 = 14, - WINED3DTSS_ALPHAARG0 = 15, - WINED3DTSS_RESULTARG = 16, - WINED3DTSS_CONSTANT = 17, - WINED3DTSS_FORCE_DWORD = 0x7fffffff -} WINED3DTEXTURESTAGESTATETYPE; -const UINT WINED3D_HIGHEST_TEXTURE_STATE = WINED3DTSS_CONSTANT; - -typedef enum _WINED3DTEXTURETRANSFORMFLAGS -{ - WINED3DTTFF_DISABLE = 0, - WINED3DTTFF_COUNT1 = 1, - WINED3DTTFF_COUNT2 = 2, - WINED3DTTFF_COUNT3 = 3, - WINED3DTTFF_COUNT4 = 4, - WINED3DTTFF_PROJECTED = 256, - WINED3DTTFF_FORCE_DWORD = 0x7fffffff -} WINED3DTEXTURETRANSFORMFLAGS; - -typedef enum _WINED3DTEXTUREOP -{ - WINED3DTOP_DISABLE = 1, - WINED3DTOP_SELECTARG1 = 2, - WINED3DTOP_SELECTARG2 = 3, - WINED3DTOP_MODULATE = 4, - WINED3DTOP_MODULATE2X = 5, - WINED3DTOP_MODULATE4X = 6, - WINED3DTOP_ADD = 7, - WINED3DTOP_ADDSIGNED = 8, - WINED3DTOP_ADDSIGNED2X = 9, - WINED3DTOP_SUBTRACT = 10, - WINED3DTOP_ADDSMOOTH = 11, - WINED3DTOP_BLENDDIFFUSEALPHA = 12, - WINED3DTOP_BLENDTEXTUREALPHA = 13, - WINED3DTOP_BLENDFACTORALPHA = 14, - WINED3DTOP_BLENDTEXTUREALPHAPM = 15, - WINED3DTOP_BLENDCURRENTALPHA = 16, - WINED3DTOP_PREMODULATE = 17, - WINED3DTOP_MODULATEALPHA_ADDCOLOR = 18, - WINED3DTOP_MODULATECOLOR_ADDALPHA = 19, - WINED3DTOP_MODULATEINVALPHA_ADDCOLOR = 20, - WINED3DTOP_MODULATEINVCOLOR_ADDALPHA = 21, - WINED3DTOP_BUMPENVMAP = 22, - WINED3DTOP_BUMPENVMAPLUMINANCE = 23, - WINED3DTOP_DOTPRODUCT3 = 24, - WINED3DTOP_MULTIPLYADD = 25, - WINED3DTOP_LERP = 26, - WINED3DTOP_FORCE_DWORD = 0x7fffffff, -} WINED3DTEXTUREOP; - -typedef enum _WINED3DTEXTUREADDRESS -{ - WINED3DTADDRESS_WRAP = 1, - WINED3DTADDRESS_MIRROR = 2, - WINED3DTADDRESS_CLAMP = 3, - WINED3DTADDRESS_BORDER = 4, - WINED3DTADDRESS_MIRRORONCE = 5, - WINED3DTADDRESS_FORCE_DWORD = 0x7fffffff -} WINED3DTEXTUREADDRESS; - -typedef enum _WINED3DTRANSFORMSTATETYPE -{ - WINED3DTS_VIEW = 2, - WINED3DTS_PROJECTION = 3, - WINED3DTS_TEXTURE0 = 16, - WINED3DTS_TEXTURE1 = 17, - WINED3DTS_TEXTURE2 = 18, - WINED3DTS_TEXTURE3 = 19, - WINED3DTS_TEXTURE4 = 20, - WINED3DTS_TEXTURE5 = 21, - WINED3DTS_TEXTURE6 = 22, - WINED3DTS_TEXTURE7 = 23, - WINED3DTS_WORLD = 256, /*WINED3DTS_WORLDMATRIX(0)*/ - WINED3DTS_WORLD1 = 257, - WINED3DTS_WORLD2 = 258, - WINED3DTS_WORLD3 = 259, - WINED3DTS_FORCE_DWORD = 0x7fffffff -} WINED3DTRANSFORMSTATETYPE; -cpp_quote("#define WINED3DTS_WORLDMATRIX(index) (WINED3DTRANSFORMSTATETYPE)(index + 256)") - -typedef enum _WINED3DBASISTYPE -{ - WINED3DBASIS_BEZIER = 0, - WINED3DBASIS_BSPLINE = 1, - WINED3DBASIS_INTERPOLATE = 2, - WINED3DBASIS_FORCE_DWORD = 0x7fffffff -} WINED3DBASISTYPE; - -typedef enum _WINED3DCUBEMAP_FACES -{ - WINED3DCUBEMAP_FACE_POSITIVE_X = 0, - WINED3DCUBEMAP_FACE_NEGATIVE_X = 1, - WINED3DCUBEMAP_FACE_POSITIVE_Y = 2, - WINED3DCUBEMAP_FACE_NEGATIVE_Y = 3, - WINED3DCUBEMAP_FACE_POSITIVE_Z = 4, - WINED3DCUBEMAP_FACE_NEGATIVE_Z = 5, - WINED3DCUBEMAP_FACE_FORCE_DWORD = 0xffffffff -} WINED3DCUBEMAP_FACES; - -typedef enum _WINED3DTEXTUREFILTERTYPE -{ - WINED3DTEXF_NONE = 0, - WINED3DTEXF_POINT = 1, - WINED3DTEXF_LINEAR = 2, - WINED3DTEXF_ANISOTROPIC = 3, - WINED3DTEXF_FLATCUBIC = 4, - WINED3DTEXF_GAUSSIANCUBIC = 5, - WINED3DTEXF_PYRAMIDALQUAD = 6, - WINED3DTEXF_GAUSSIANQUAD = 7, - WINED3DTEXF_FORCE_DWORD = 0x7fffffff -} WINED3DTEXTUREFILTERTYPE; - -typedef enum _WINED3DRESOURCETYPE -{ - WINED3DRTYPE_SURFACE = 1, - WINED3DRTYPE_VOLUME = 2, - WINED3DRTYPE_TEXTURE = 3, - WINED3DRTYPE_VOLUMETEXTURE = 4, - WINED3DRTYPE_CUBETEXTURE = 5, - WINED3DRTYPE_BUFFER = 6, - WINED3DRTYPE_FORCE_DWORD = 0x7fffffff -} WINED3DRESOURCETYPE; -const UINT WINED3DRTYPECOUNT = WINED3DRTYPE_BUFFER + 1; - -typedef enum _WINED3DPOOL -{ - WINED3DPOOL_DEFAULT = 0, - WINED3DPOOL_MANAGED = 1, - WINED3DPOOL_SYSTEMMEM = 2, - WINED3DPOOL_SCRATCH = 3, - WINED3DPOOL_FORCE_DWORD = 0x7fffffff -} WINED3DPOOL; - -typedef enum _WINED3DQUERYTYPE -{ - WINED3DQUERYTYPE_VCACHE = 4, - WINED3DQUERYTYPE_RESOURCEMANAGER = 5, - WINED3DQUERYTYPE_VERTEXSTATS = 6, - WINED3DQUERYTYPE_EVENT = 8, - WINED3DQUERYTYPE_OCCLUSION = 9, - WINED3DQUERYTYPE_TIMESTAMP = 10, - WINED3DQUERYTYPE_TIMESTAMPDISJOINT = 11, - WINED3DQUERYTYPE_TIMESTAMPFREQ = 12, - WINED3DQUERYTYPE_PIPELINETIMINGS = 13, - WINED3DQUERYTYPE_INTERFACETIMINGS = 14, - WINED3DQUERYTYPE_VERTEXTIMINGS = 15, - WINED3DQUERYTYPE_PIXELTIMINGS = 16, - WINED3DQUERYTYPE_BANDWIDTHTIMINGS = 17, - WINED3DQUERYTYPE_CACHEUTILIZATION = 18 -} WINED3DQUERYTYPE; - -const UINT WINED3DISSUE_BEGIN = (1 << 1); -const UINT WINED3DISSUE_END = (1 << 0); -const UINT WINED3DGETDATA_FLUSH = (1 << 0); - -typedef enum _WINED3DSTATEBLOCKTYPE -{ - WINED3DSBT_INIT = 0, - WINED3DSBT_ALL = 1, - WINED3DSBT_PIXELSTATE = 2, - WINED3DSBT_VERTEXSTATE = 3, - WINED3DSBT_RECORDED = 4, /* WineD3D private */ - WINED3DSBT_FORCE_DWORD = 0xffffffff -} WINED3DSTATEBLOCKTYPE; - -typedef enum _WINED3DDECLMETHOD -{ - WINED3DDECLMETHOD_DEFAULT = 0, - WINED3DDECLMETHOD_PARTIALU = 1, - WINED3DDECLMETHOD_PARTIALV = 2, - WINED3DDECLMETHOD_CROSSUV = 3, - WINED3DDECLMETHOD_UV = 4, - WINED3DDECLMETHOD_LOOKUP = 5, - WINED3DDECLMETHOD_LOOKUPPRESAMPLED = 6 -} WINED3DDECLMETHOD; - -typedef enum _WINED3DDECLUSAGE -{ - WINED3DDECLUSAGE_POSITION = 0, - WINED3DDECLUSAGE_BLENDWEIGHT = 1, - WINED3DDECLUSAGE_BLENDINDICES = 2, - WINED3DDECLUSAGE_NORMAL = 3, - WINED3DDECLUSAGE_PSIZE = 4, - WINED3DDECLUSAGE_TEXCOORD = 5, - WINED3DDECLUSAGE_TANGENT = 6, - WINED3DDECLUSAGE_BINORMAL = 7, - WINED3DDECLUSAGE_TESSFACTOR = 8, - WINED3DDECLUSAGE_POSITIONT = 9, - WINED3DDECLUSAGE_COLOR = 10, - WINED3DDECLUSAGE_FOG = 11, - WINED3DDECLUSAGE_DEPTH = 12, - WINED3DDECLUSAGE_SAMPLE = 13 -} WINED3DDECLUSAGE; - -typedef enum _WINED3DSURFTYPE -{ - SURFACE_UNKNOWN = 0, /* Default / Unknown surface type */ - SURFACE_OPENGL, /* OpenGL surface: Renders using libGL, needed for 3D */ - SURFACE_GDI, /* User surface. No 3D, DirectDraw rendering with GDI */ -} WINED3DSURFTYPE; - -enum wined3d_sysval_semantic -{ - WINED3D_SV_DEPTH = 0xffffffff, - WINED3D_SV_TARGET0 = 0, - WINED3D_SV_TARGET1 = 1, - WINED3D_SV_TARGET2 = 2, - WINED3D_SV_TARGET3 = 3, - WINED3D_SV_TARGET4 = 4, - WINED3D_SV_TARGET5 = 5, - WINED3D_SV_TARGET6 = 6, - WINED3D_SV_TARGET7 = 7, -}; - -const UINT WINED3DCOLORWRITEENABLE_RED = (1<<0); -const UINT WINED3DCOLORWRITEENABLE_GREEN = (1<<1); -const UINT WINED3DCOLORWRITEENABLE_BLUE = (1<<2); -const UINT WINED3DCOLORWRITEENABLE_ALPHA = (1<<3); - -const UINT WINED3DADAPTER_DEFAULT = 0; -const UINT WINED3DENUM_NO_WHQL_LEVEL = 2; -const UINT WINED3DPRESENT_BACK_BUFFER_MAX = 3; - -const UINT WINED3DTSS_TCI_PASSTHRU = 0x00000; -const UINT WINED3DTSS_TCI_CAMERASPACENORMAL = 0x10000; -const UINT WINED3DTSS_TCI_CAMERASPACEPOSITION = 0x20000; -const UINT WINED3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR = 0x30000; -const UINT WINED3DTSS_TCI_SPHEREMAP = 0x40000; - -const UINT WINED3DTA_SELECTMASK = 0x0000000f; -const UINT WINED3DTA_DIFFUSE = 0x00000000; -const UINT WINED3DTA_CURRENT = 0x00000001; -const UINT WINED3DTA_TEXTURE = 0x00000002; -const UINT WINED3DTA_TFACTOR = 0x00000003; -const UINT WINED3DTA_SPECULAR = 0x00000004; -const UINT WINED3DTA_TEMP = 0x00000005; -const UINT WINED3DTA_CONSTANT = 0x00000006; -const UINT WINED3DTA_COMPLEMENT = 0x00000010; -const UINT WINED3DTA_ALPHAREPLICATE = 0x00000020; - -const UINT WINED3DPRESENTFLAG_LOCKABLE_BACKBUFFER = 0x00000001; -const UINT WINED3DPRESENTFLAG_DISCARD_DEPTHSTENCIL = 0x00000002; -const UINT WINED3DPRESENTFLAG_DEVICECLIP = 0x00000004; -const UINT WINED3DPRESENTFLAG_VIDEO = 0x00000010; -const UINT WINED3DPRESENTFLAG_NOAUTOROTATE = 0x00000020; -const UINT WINED3DPRESENTFLAG_UNPRUNEDMODE = 0x00000040; - -const UINT WINED3DDP_MAXTEXCOORD = 8; - -const UINT WINED3DUSAGE_RENDERTARGET = 0x00000001; -const UINT WINED3DUSAGE_DEPTHSTENCIL = 0x00000002; -const UINT WINED3DUSAGE_WRITEONLY = 0x00000008; -const UINT WINED3DUSAGE_SOFTWAREPROCESSING = 0x00000010; -const UINT WINED3DUSAGE_DONOTCLIP = 0x00000020; -const UINT WINED3DUSAGE_POINTS = 0x00000040; -const UINT WINED3DUSAGE_RTPATCHES = 0x00000080; -const UINT WINED3DUSAGE_NPATCHES = 0x00000100; -const UINT WINED3DUSAGE_DYNAMIC = 0x00000200; -const UINT WINED3DUSAGE_AUTOGENMIPMAP = 0x00000400; -const UINT WINED3DUSAGE_DMAP = 0x00004000; -const UINT WINED3DUSAGE_MASK = 0x00004fff; -const UINT WINED3DUSAGE_STATICDECL = 0x40000000; -const UINT WINED3DUSAGE_OVERLAY = 0x80000000; - -const UINT WINED3DUSAGE_QUERY_LEGACYBUMPMAP = 0x00008000; -const UINT WINED3DUSAGE_QUERY_FILTER = 0x00020000; -const UINT WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING = 0x00080000; -const UINT WINED3DUSAGE_QUERY_SRGBREAD = 0x00010000; -const UINT WINED3DUSAGE_QUERY_SRGBWRITE = 0x00040000; -const UINT WINED3DUSAGE_QUERY_VERTEXTEXTURE = 0x00100000; -const UINT WINED3DUSAGE_QUERY_WRAPANDMIP = 0x00200000; -const UINT WINED3DUSAGE_QUERY_MASK = 0x003f8000; - -const UINT WINED3DLOCK_READONLY = 0x0010; -const UINT WINED3DLOCK_NOSYSLOCK = 0x0800; -const UINT WINED3DLOCK_NOOVERWRITE = 0x1000; -const UINT WINED3DLOCK_DISCARD = 0x2000; -const UINT WINED3DLOCK_DONOTWAIT = 0x4000; -const UINT WINED3DLOCK_NO_DIRTY_UPDATE = 0x8000; - -const UINT WINED3DPRESENT_RATE_DEFAULT = 0x000000000; - -const UINT WINED3DPRESENT_INTERVAL_DEFAULT = 0x00000000; -const UINT WINED3DPRESENT_INTERVAL_ONE = 0x00000001; -const UINT WINED3DPRESENT_INTERVAL_TWO = 0x00000002; -const UINT WINED3DPRESENT_INTERVAL_THREE = 0x00000004; -const UINT WINED3DPRESENT_INTERVAL_FOUR = 0x00000008; -const UINT WINED3DPRESENT_INTERVAL_IMMEDIATE = 0x80000000; - -const UINT WINED3DMAXUSERCLIPPLANES = 32; -const UINT WINED3DCLIPPLANE0 = (1 << 0); -const UINT WINED3DCLIPPLANE1 = (1 << 1); -const UINT WINED3DCLIPPLANE2 = (1 << 2); -const UINT WINED3DCLIPPLANE3 = (1 << 3); -const UINT WINED3DCLIPPLANE4 = (1 << 4); -const UINT WINED3DCLIPPLANE5 = (1 << 5); - -/* FVF (Flexible Vertex Format) codes */ -const UINT WINED3DFVF_RESERVED0 = 0x0001; -const UINT WINED3DFVF_POSITION_MASK = 0x400e; -const UINT WINED3DFVF_XYZ = 0x0002; -const UINT WINED3DFVF_XYZRHW = 0x0004; -const UINT WINED3DFVF_XYZB1 = 0x0006; -const UINT WINED3DFVF_XYZB2 = 0x0008; -const UINT WINED3DFVF_XYZB3 = 0x000a; -const UINT WINED3DFVF_XYZB4 = 0x000c; -const UINT WINED3DFVF_XYZB5 = 0x000e; -const UINT WINED3DFVF_XYZW = 0x4002; -const UINT WINED3DFVF_NORMAL = 0x0010; -const UINT WINED3DFVF_PSIZE = 0x0020; -const UINT WINED3DFVF_DIFFUSE = 0x0040; -const UINT WINED3DFVF_SPECULAR = 0x0080; -const UINT WINED3DFVF_TEXCOUNT_MASK = 0x0f00; -const UINT WINED3DFVF_TEXCOUNT_SHIFT = 8; -const UINT WINED3DFVF_TEX0 = 0x0000; -const UINT WINED3DFVF_TEX1 = 0x0100; -const UINT WINED3DFVF_TEX2 = 0x0200; -const UINT WINED3DFVF_TEX3 = 0x0300; -const UINT WINED3DFVF_TEX4 = 0x0400; -const UINT WINED3DFVF_TEX5 = 0x0500; -const UINT WINED3DFVF_TEX6 = 0x0600; -const UINT WINED3DFVF_TEX7 = 0x0700; -const UINT WINED3DFVF_TEX8 = 0x0800; -const UINT WINED3DFVF_LASTBETA_UBYTE4 = 0x1000; -const UINT WINED3DFVF_LASTBETA_D3DCOLOR = 0x8000; -const UINT WINED3DFVF_RESERVED2 = 0x6000; - -const UINT WINED3DFVF_TEXTUREFORMAT1 = 3; -const UINT WINED3DFVF_TEXTUREFORMAT2 = 0; -const UINT WINED3DFVF_TEXTUREFORMAT3 = 1; -const UINT WINED3DFVF_TEXTUREFORMAT4 = 2; -cpp_quote("#define WINED3DFVF_TEXCOORDSIZE1(CoordIndex) (WINED3DFVF_TEXTUREFORMAT1 << (CoordIndex*2 + 16))") -cpp_quote("#define WINED3DFVF_TEXCOORDSIZE2(CoordIndex) (WINED3DFVF_TEXTUREFORMAT2)") -cpp_quote("#define WINED3DFVF_TEXCOORDSIZE3(CoordIndex) (WINED3DFVF_TEXTUREFORMAT3 << (CoordIndex*2 + 16))") -cpp_quote("#define WINED3DFVF_TEXCOORDSIZE4(CoordIndex) (WINED3DFVF_TEXTUREFORMAT4 << (CoordIndex*2 + 16))") - -/* Clear flags */ -const UINT WINED3DCLEAR_TARGET = 0x00000001; -const UINT WINED3DCLEAR_ZBUFFER = 0x00000002; -const UINT WINED3DCLEAR_STENCIL = 0x00000004; - -/* Stream source flags */ -const UINT WINED3DSTREAMSOURCE_INDEXEDDATA = (1 << 30); -const UINT WINED3DSTREAMSOURCE_INSTANCEDATA = (2 << 30); - -/* SetPrivateData flags */ -const UINT WINED3DSPD_IUNKNOWN = 0x00000001; - -/* IWineD3D::CreateDevice behaviour flags */ -const UINT WINED3DCREATE_FPU_PRESERVE = 0x00000002; -const UINT WINED3DCREATE_PUREDEVICE = 0x00000010; -const UINT WINED3DCREATE_SOFTWARE_VERTEXPROCESSING = 0x00000020; -const UINT WINED3DCREATE_HARDWARE_VERTEXPROCESSING = 0x00000040; -const UINT WINED3DCREATE_MIXED_VERTEXPROCESSING = 0x00000080; -const UINT WINED3DCREATE_DISABLE_DRIVER_MANAGEMENT = 0x00000100; -const UINT WINED3DCREATE_ADAPTERGROUP_DEVICE = 0x00000200; - -/* VTF defines */ -const UINT WINED3DDMAPSAMPLER = 0x100; -const UINT WINED3DVERTEXTEXTURESAMPLER0 = (WINED3DDMAPSAMPLER + 1); -const UINT WINED3DVERTEXTEXTURESAMPLER1 = (WINED3DDMAPSAMPLER + 2); -const UINT WINED3DVERTEXTEXTURESAMPLER2 = (WINED3DDMAPSAMPLER + 3); -const UINT WINED3DVERTEXTEXTURESAMPLER3 = (WINED3DDMAPSAMPLER + 4); - -const UINT WINED3DCAPS3_ALPHA_FULLSCREEN_FLIP_OR_DISCARD = 0x00000020; -const UINT WINED3DCAPS3_LINEAR_TO_SRGB_PRESENTATION = 0x00000080; -const UINT WINED3DCAPS3_COPY_TO_VIDMEM = 0x00000100; -const UINT WINED3DCAPS3_COPY_TO_SYSTEMMEM = 0x00000200; -const UINT WINED3DCAPS3_RESERVED = 0x8000001f; - -const UINT WINED3DDEVCAPS2_STREAMOFFSET = 0x00000001; -const UINT WINED3DDEVCAPS2_DMAPNPATCH = 0x00000002; -const UINT WINED3DDEVCAPS2_ADAPTIVETESSRTPATCH = 0x00000004; -const UINT WINED3DDEVCAPS2_ADAPTIVETESSNPATCH = 0x00000008; -const UINT WINED3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES = 0x00000010; -const UINT WINED3DDEVCAPS2_PRESAMPLEDDMAPNPATCH = 0x00000020; -const UINT WINED3DDEVCAPS2_VERTEXELEMENTSCANSHARESTREAMOFFSET = 0x00000040; - -const UINT WINED3DDTCAPS_UBYTE4 = 0x00000001; -const UINT WINED3DDTCAPS_UBYTE4N = 0x00000002; -const UINT WINED3DDTCAPS_SHORT2N = 0x00000004; -const UINT WINED3DDTCAPS_SHORT4N = 0x00000008; -const UINT WINED3DDTCAPS_USHORT2N = 0x00000010; -const UINT WINED3DDTCAPS_USHORT4N = 0x00000020; -const UINT WINED3DDTCAPS_UDEC3 = 0x00000040; -const UINT WINED3DDTCAPS_DEC3N = 0x00000080; -const UINT WINED3DDTCAPS_FLOAT16_2 = 0x00000100; -const UINT WINED3DDTCAPS_FLOAT16_4 = 0x00000200; - -const UINT WINED3DFVFCAPS_TEXCOORDCOUNTMASK = 0x0000ffff; -const UINT WINED3DFVFCAPS_DONOTSTRIPELEMENTS = 0x00080000; -const UINT WINED3DFVFCAPS_PSIZE = 0x00100000; - -const UINT WINED3DLINECAPS_TEXTURE = 0x00000001; -const UINT WINED3DLINECAPS_ZTEST = 0x00000002; -const UINT WINED3DLINECAPS_BLEND = 0x00000004; -const UINT WINED3DLINECAPS_ALPHACMP = 0x00000008; -const UINT WINED3DLINECAPS_FOG = 0x00000010; -const UINT WINED3DLINECAPS_ANTIALIAS = 0x00000020; - -const UINT WINED3DMAX30SHADERINSTRUCTIONS = 32768; -const UINT WINED3DMIN30SHADERINSTRUCTIONS = 512; - -const UINT WINED3DPBLENDCAPS_ZERO = 0x00000001; -const UINT WINED3DPBLENDCAPS_ONE = 0x00000002; -const UINT WINED3DPBLENDCAPS_SRCCOLOR = 0x00000004; -const UINT WINED3DPBLENDCAPS_INVSRCCOLOR = 0x00000008; -const UINT WINED3DPBLENDCAPS_SRCALPHA = 0x00000010; -const UINT WINED3DPBLENDCAPS_INVSRCALPHA = 0x00000020; -const UINT WINED3DPBLENDCAPS_DESTALPHA = 0x00000040; -const UINT WINED3DPBLENDCAPS_INVDESTALPHA = 0x00000080; -const UINT WINED3DPBLENDCAPS_DESTCOLOR = 0x00000100; -const UINT WINED3DPBLENDCAPS_INVDESTCOLOR = 0x00000200; -const UINT WINED3DPBLENDCAPS_SRCALPHASAT = 0x00000400; -const UINT WINED3DPBLENDCAPS_BOTHSRCALPHA = 0x00000800; -const UINT WINED3DPBLENDCAPS_BOTHINVSRCALPHA = 0x00001000; -const UINT WINED3DPBLENDCAPS_BLENDFACTOR = 0x00002000; - -const UINT WINED3DPCMPCAPS_NEVER = 0x00000001; -const UINT WINED3DPCMPCAPS_LESS = 0x00000002; -const UINT WINED3DPCMPCAPS_EQUAL = 0x00000004; -const UINT WINED3DPCMPCAPS_LESSEQUAL = 0x00000008; -const UINT WINED3DPCMPCAPS_GREATER = 0x00000010; -const UINT WINED3DPCMPCAPS_NOTEQUAL = 0x00000020; -const UINT WINED3DPCMPCAPS_GREATEREQUAL = 0x00000040; -const UINT WINED3DPCMPCAPS_ALWAYS = 0x00000080; - -const UINT WINED3DPMISCCAPS_MASKZ = 0x00000002; -const UINT WINED3DPMISCCAPS_LINEPATTERNREP = 0x00000004; -const UINT WINED3DPMISCCAPS_CULLNONE = 0x00000010; -const UINT WINED3DPMISCCAPS_CULLCW = 0x00000020; -const UINT WINED3DPMISCCAPS_CULLCCW = 0x00000040; -const UINT WINED3DPMISCCAPS_COLORWRITEENABLE = 0x00000080; -const UINT WINED3DPMISCCAPS_CLIPPLANESCALEDPOINTS = 0x00000100; -const UINT WINED3DPMISCCAPS_CLIPTLVERTS = 0x00000200; -const UINT WINED3DPMISCCAPS_TSSARGTEMP = 0x00000400; -const UINT WINED3DPMISCCAPS_BLENDOP = 0x00000800; -const UINT WINED3DPMISCCAPS_NULLREFERENCE = 0x00001000; -const UINT WINED3DPMISCCAPS_INDEPENDENTWRITEMASKS = 0x00004000; -const UINT WINED3DPMISCCAPS_PERSTAGECONSTANT = 0x00008000; -const UINT WINED3DPMISCCAPS_FOGANDSPECULARALPHA = 0x00010000; -const UINT WINED3DPMISCCAPS_SEPARATEALPHABLEND = 0x00020000; -const UINT WINED3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS = 0x00040000; -const UINT WINED3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING = 0x00080000; -const UINT WINED3DPMISCCAPS_FOGVERTEXCLAMPED = 0x00100000; - -const UINT WINED3DPS20_MAX_DYNAMICFLOWCONTROLDEPTH = 24; -const UINT WINED3DPS20_MIN_DYNAMICFLOWCONTROLDEPTH = 0; -const UINT WINED3DPS20_MAX_NUMTEMPS = 32; -const UINT WINED3DPS20_MIN_NUMTEMPS = 12; -const UINT WINED3DPS20_MAX_STATICFLOWCONTROLDEPTH = 4; -const UINT WINED3DPS20_MIN_STATICFLOWCONTROLDEPTH = 0; -const UINT WINED3DPS20_MAX_NUMINSTRUCTIONSLOTS = 512; -const UINT WINED3DPS20_MIN_NUMINSTRUCTIONSLOTS = 96; - -const UINT WINED3DPS20CAPS_ARBITRARYSWIZZLE = 0x00000001; -const UINT WINED3DPS20CAPS_GRADIENTINSTRUCTIONS = 0x00000002; -const UINT WINED3DPS20CAPS_PREDICATION = 0x00000004; -const UINT WINED3DPS20CAPS_NODEPENDENTREADLIMIT = 0x00000008; -const UINT WINED3DPS20CAPS_NOTEXINSTRUCTIONLIMIT = 0x00000010; - -const UINT WINED3DPTADDRESSCAPS_WRAP = 0x00000001; -const UINT WINED3DPTADDRESSCAPS_MIRROR = 0x00000002; -const UINT WINED3DPTADDRESSCAPS_CLAMP = 0x00000004; -const UINT WINED3DPTADDRESSCAPS_BORDER = 0x00000008; -const UINT WINED3DPTADDRESSCAPS_INDEPENDENTUV = 0x00000010; -const UINT WINED3DPTADDRESSCAPS_MIRRORONCE = 0x00000020; - -const UINT WINED3DSTENCILCAPS_KEEP = 0x00000001; -const UINT WINED3DSTENCILCAPS_ZERO = 0x00000002; -const UINT WINED3DSTENCILCAPS_REPLACE = 0x00000004; -const UINT WINED3DSTENCILCAPS_INCRSAT = 0x00000008; -const UINT WINED3DSTENCILCAPS_DECRSAT = 0x00000010; -const UINT WINED3DSTENCILCAPS_INVERT = 0x00000020; -const UINT WINED3DSTENCILCAPS_INCR = 0x00000040; -const UINT WINED3DSTENCILCAPS_DECR = 0x00000080; -const UINT WINED3DSTENCILCAPS_TWOSIDED = 0x00000100; - -const UINT WINED3DTEXOPCAPS_DISABLE = 0x00000001; -const UINT WINED3DTEXOPCAPS_SELECTARG1 = 0x00000002; -const UINT WINED3DTEXOPCAPS_SELECTARG2 = 0x00000004; -const UINT WINED3DTEXOPCAPS_MODULATE = 0x00000008; -const UINT WINED3DTEXOPCAPS_MODULATE2X = 0x00000010; -const UINT WINED3DTEXOPCAPS_MODULATE4X = 0x00000020; -const UINT WINED3DTEXOPCAPS_ADD = 0x00000040; -const UINT WINED3DTEXOPCAPS_ADDSIGNED = 0x00000080; -const UINT WINED3DTEXOPCAPS_ADDSIGNED2X = 0x00000100; -const UINT WINED3DTEXOPCAPS_SUBTRACT = 0x00000200; -const UINT WINED3DTEXOPCAPS_ADDSMOOTH = 0x00000400; -const UINT WINED3DTEXOPCAPS_BLENDDIFFUSEALPHA = 0x00000800; -const UINT WINED3DTEXOPCAPS_BLENDTEXTUREALPHA = 0x00001000; -const UINT WINED3DTEXOPCAPS_BLENDFACTORALPHA = 0x00002000; -const UINT WINED3DTEXOPCAPS_BLENDTEXTUREALPHAPM = 0x00004000; -const UINT WINED3DTEXOPCAPS_BLENDCURRENTALPHA = 0x00008000; -const UINT WINED3DTEXOPCAPS_PREMODULATE = 0x00010000; -const UINT WINED3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR = 0x00020000; -const UINT WINED3DTEXOPCAPS_MODULATECOLOR_ADDALPHA = 0x00040000; -const UINT WINED3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR = 0x00080000; -const UINT WINED3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA = 0x00100000; -const UINT WINED3DTEXOPCAPS_BUMPENVMAP = 0x00200000; -const UINT WINED3DTEXOPCAPS_BUMPENVMAPLUMINANCE = 0x00400000; -const UINT WINED3DTEXOPCAPS_DOTPRODUCT3 = 0x00800000; -const UINT WINED3DTEXOPCAPS_MULTIPLYADD = 0x01000000; -const UINT WINED3DTEXOPCAPS_LERP = 0x02000000; - -const UINT WINED3DVS20_MAX_DYNAMICFLOWCONTROLDEPTH = 24; -const UINT WINED3DVS20_MIN_DYNAMICFLOWCONTROLDEPTH = 0; -const UINT WINED3DVS20_MAX_NUMTEMPS = 32; -const UINT WINED3DVS20_MIN_NUMTEMPS = 12; -const UINT WINED3DVS20_MAX_STATICFLOWCONTROLDEPTH = 4; -const UINT WINED3DVS20_MIN_STATICFLOWCONTROLDEPTH = 1; - -const UINT WINED3DVS20CAPS_PREDICATION = 0x00000001; - -const UINT WINED3DCAPS2_NO2DDURING3DSCENE = 0x00000002; -const UINT WINED3DCAPS2_FULLSCREENGAMMA = 0x00020000; -const UINT WINED3DCAPS2_CANRENDERWINDOWED = 0x00080000; -const UINT WINED3DCAPS2_CANCALIBRATEGAMMA = 0x00100000; -const UINT WINED3DCAPS2_RESERVED = 0x02000000; -const UINT WINED3DCAPS2_CANMANAGERESOURCE = 0x10000000; -const UINT WINED3DCAPS2_DYNAMICTEXTURES = 0x20000000; -const UINT WINED3DCAPS2_CANAUTOGENMIPMAP = 0x40000000; - -const UINT WINED3DPRASTERCAPS_DITHER = 0x00000001; -const UINT WINED3DPRASTERCAPS_ROP2 = 0x00000002; -const UINT WINED3DPRASTERCAPS_XOR = 0x00000004; -const UINT WINED3DPRASTERCAPS_PAT = 0x00000008; -const UINT WINED3DPRASTERCAPS_ZTEST = 0x00000010; -const UINT WINED3DPRASTERCAPS_SUBPIXEL = 0x00000020; -const UINT WINED3DPRASTERCAPS_SUBPIXELX = 0x00000040; -const UINT WINED3DPRASTERCAPS_FOGVERTEX = 0x00000080; -const UINT WINED3DPRASTERCAPS_FOGTABLE = 0x00000100; -const UINT WINED3DPRASTERCAPS_STIPPLE = 0x00000200; -const UINT WINED3DPRASTERCAPS_ANTIALIASSORTDEPENDENT = 0x00000400; -const UINT WINED3DPRASTERCAPS_ANTIALIASSORTINDEPENDENT = 0x00000800; -const UINT WINED3DPRASTERCAPS_ANTIALIASEDGES = 0x00001000; -const UINT WINED3DPRASTERCAPS_MIPMAPLODBIAS = 0x00002000; -const UINT WINED3DPRASTERCAPS_ZBIAS = 0x00004000; -const UINT WINED3DPRASTERCAPS_ZBUFFERLESSHSR = 0x00008000; -const UINT WINED3DPRASTERCAPS_FOGRANGE = 0x00010000; -const UINT WINED3DPRASTERCAPS_ANISOTROPY = 0x00020000; -const UINT WINED3DPRASTERCAPS_WBUFFER = 0x00040000; -const UINT WINED3DPRASTERCAPS_TRANSLUCENTSORTINDEPENDENT = 0x00080000; -const UINT WINED3DPRASTERCAPS_WFOG = 0x00100000; -const UINT WINED3DPRASTERCAPS_ZFOG = 0x00200000; -const UINT WINED3DPRASTERCAPS_COLORPERSPECTIVE = 0x00400000; -const UINT WINED3DPRASTERCAPS_SCISSORTEST = 0x01000000; -const UINT WINED3DPRASTERCAPS_SLOPESCALEDEPTHBIAS = 0x02000000; -const UINT WINED3DPRASTERCAPS_DEPTHBIAS = 0x04000000; -const UINT WINED3DPRASTERCAPS_MULTISAMPLE_TOGGLE = 0x08000000; - -const UINT WINED3DPSHADECAPS_COLORFLATMONO = 0x00000001; -const UINT WINED3DPSHADECAPS_COLORFLATRGB = 0x00000002; -const UINT WINED3DPSHADECAPS_COLORGOURAUDMONO = 0x00000004; -const UINT WINED3DPSHADECAPS_COLORGOURAUDRGB = 0x00000008; -const UINT WINED3DPSHADECAPS_COLORPHONGMONO = 0x00000010; -const UINT WINED3DPSHADECAPS_COLORPHONGRGB = 0x00000020; -const UINT WINED3DPSHADECAPS_SPECULARFLATMONO = 0x00000040; -const UINT WINED3DPSHADECAPS_SPECULARFLATRGB = 0x00000080; -const UINT WINED3DPSHADECAPS_SPECULARGOURAUDMONO = 0x00000100; -const UINT WINED3DPSHADECAPS_SPECULARGOURAUDRGB = 0x00000200; -const UINT WINED3DPSHADECAPS_SPECULARPHONGMONO = 0x00000400; -const UINT WINED3DPSHADECAPS_SPECULARPHONGRGB = 0x00000800; -const UINT WINED3DPSHADECAPS_ALPHAFLATBLEND = 0x00001000; -const UINT WINED3DPSHADECAPS_ALPHAFLATSTIPPLED = 0x00002000; -const UINT WINED3DPSHADECAPS_ALPHAGOURAUDBLEND = 0x00004000; -const UINT WINED3DPSHADECAPS_ALPHAGOURAUDSTIPPLED = 0x00008000; -const UINT WINED3DPSHADECAPS_ALPHAPHONGBLEND = 0x00010000; -const UINT WINED3DPSHADECAPS_ALPHAPHONGSTIPPLED = 0x00020000; -const UINT WINED3DPSHADECAPS_FOGFLAT = 0x00040000; -const UINT WINED3DPSHADECAPS_FOGGOURAUD = 0x00080000; -const UINT WINED3DPSHADECAPS_FOGPHONG = 0x00100000; - -const UINT WINED3DPTEXTURECAPS_PERSPECTIVE = 0x00000001; -const UINT WINED3DPTEXTURECAPS_POW2 = 0x00000002; -const UINT WINED3DPTEXTURECAPS_ALPHA = 0x00000004; -const UINT WINED3DPTEXTURECAPS_TRANSPARENCY = 0x00000008; -const UINT WINED3DPTEXTURECAPS_BORDER = 0x00000010; -const UINT WINED3DPTEXTURECAPS_SQUAREONLY = 0x00000020; -const UINT WINED3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE = 0x00000040; -const UINT WINED3DPTEXTURECAPS_ALPHAPALETTE = 0x00000080; -const UINT WINED3DPTEXTURECAPS_NONPOW2CONDITIONAL = 0x00000100; -const UINT WINED3DPTEXTURECAPS_PROJECTED = 0x00000400; -const UINT WINED3DPTEXTURECAPS_CUBEMAP = 0x00000800; -const UINT WINED3DPTEXTURECAPS_COLORKEYBLEND = 0x00001000; -const UINT WINED3DPTEXTURECAPS_VOLUMEMAP = 0x00002000; -const UINT WINED3DPTEXTURECAPS_MIPMAP = 0x00004000; -const UINT WINED3DPTEXTURECAPS_MIPVOLUMEMAP = 0x00008000; -const UINT WINED3DPTEXTURECAPS_MIPCUBEMAP = 0x00010000; -const UINT WINED3DPTEXTURECAPS_CUBEMAP_POW2 = 0x00020000; -const UINT WINED3DPTEXTURECAPS_VOLUMEMAP_POW2 = 0x00040000; -const UINT WINED3DPTEXTURECAPS_NOPROJECTEDBUMPENV = 0x00200000; - -const UINT WINED3DPTFILTERCAPS_NEAREST = 0x00000001; -const UINT WINED3DPTFILTERCAPS_LINEAR = 0x00000002; -const UINT WINED3DPTFILTERCAPS_MIPNEAREST = 0x00000004; -const UINT WINED3DPTFILTERCAPS_MIPLINEAR = 0x00000008; -const UINT WINED3DPTFILTERCAPS_LINEARMIPNEAREST = 0x00000010; -const UINT WINED3DPTFILTERCAPS_LINEARMIPLINEAR = 0x00000020; -const UINT WINED3DPTFILTERCAPS_MINFPOINT = 0x00000100; -const UINT WINED3DPTFILTERCAPS_MINFLINEAR = 0x00000200; -const UINT WINED3DPTFILTERCAPS_MINFANISOTROPIC = 0x00000400; -const UINT WINED3DPTFILTERCAPS_MIPFPOINT = 0x00010000; -const UINT WINED3DPTFILTERCAPS_MIPFLINEAR = 0x00020000; -const UINT WINED3DPTFILTERCAPS_MAGFPOINT = 0x01000000; -const UINT WINED3DPTFILTERCAPS_MAGFLINEAR = 0x02000000; -const UINT WINED3DPTFILTERCAPS_MAGFANISOTROPIC = 0x04000000; -const UINT WINED3DPTFILTERCAPS_MAGFPYRAMIDALQUAD = 0x08000000; -const UINT WINED3DPTFILTERCAPS_MAGFGAUSSIANQUAD = 0x10000000; - -const UINT WINED3DVTXPCAPS_TEXGEN = 0x00000001; -const UINT WINED3DVTXPCAPS_MATERIALSOURCE7 = 0x00000002; -const UINT WINED3DVTXPCAPS_VERTEXFOG = 0x00000004; -const UINT WINED3DVTXPCAPS_DIRECTIONALLIGHTS = 0x00000008; -const UINT WINED3DVTXPCAPS_POSITIONALLIGHTS = 0x00000010; -const UINT WINED3DVTXPCAPS_LOCALVIEWER = 0x00000020; -const UINT WINED3DVTXPCAPS_TWEENING = 0x00000040; -const UINT WINED3DVTXPCAPS_TEXGEN_SPHEREMAP = 0x00000100; -const UINT WINED3DVTXPCAPS_NO_TEXGEN_NONLOCALVIEWER = 0x00000200; - -const UINT WINED3DCURSORCAPS_COLOR = 0x00000001; -const UINT WINED3DCURSORCAPS_LOWRES = 0x00000002; - -const UINT WINED3DDEVCAPS_FLOATTLVERTEX = 0x00000001; -const UINT WINED3DDEVCAPS_SORTINCREASINGZ = 0x00000002; -const UINT WINED3DDEVCAPS_SORTDECREASINGZ = 0X00000004; -const UINT WINED3DDEVCAPS_SORTEXACT = 0x00000008; -const UINT WINED3DDEVCAPS_EXECUTESYSTEMMEMORY = 0x00000010; -const UINT WINED3DDEVCAPS_EXECUTEVIDEOMEMORY = 0x00000020; -const UINT WINED3DDEVCAPS_TLVERTEXSYSTEMMEMORY = 0x00000040; -const UINT WINED3DDEVCAPS_TLVERTEXVIDEOMEMORY = 0x00000080; -const UINT WINED3DDEVCAPS_TEXTURESYSTEMMEMORY = 0x00000100; -const UINT WINED3DDEVCAPS_TEXTUREVIDEOMEMORY = 0x00000200; -const UINT WINED3DDEVCAPS_DRAWPRIMTLVERTEX = 0x00000400; -const UINT WINED3DDEVCAPS_CANRENDERAFTERFLIP = 0x00000800; -const UINT WINED3DDEVCAPS_TEXTURENONLOCALVIDMEM = 0x00001000; -const UINT WINED3DDEVCAPS_DRAWPRIMITIVES2 = 0x00002000; -const UINT WINED3DDEVCAPS_SEPARATETEXTUREMEMORIES = 0x00004000; -const UINT WINED3DDEVCAPS_DRAWPRIMITIVES2EX = 0x00008000; -const UINT WINED3DDEVCAPS_HWTRANSFORMANDLIGHT = 0x00010000; -const UINT WINED3DDEVCAPS_CANBLTSYSTONONLOCAL = 0x00020000; -const UINT WINED3DDEVCAPS_HWRASTERIZATION = 0x00080000; -const UINT WINED3DDEVCAPS_PUREDEVICE = 0x00100000; -const UINT WINED3DDEVCAPS_QUINTICRTPATCHES = 0x00200000; -const UINT WINED3DDEVCAPS_RTPATCHES = 0x00400000; -const UINT WINED3DDEVCAPS_RTPATCHHANDLEZERO = 0x00800000; -const UINT WINED3DDEVCAPS_NPATCHES = 0x01000000; - -/* dwDDFX */ -/* arithmetic stretching along y axis */ -const UINT WINEDDBLTFX_ARITHSTRETCHY = 0x00000001; -/* mirror on y axis */ -const UINT WINEDDBLTFX_MIRRORLEFTRIGHT = 0x00000002; -/* mirror on x axis */ -const UINT WINEDDBLTFX_MIRRORUPDOWN = 0x00000004; -/* do not tear */ -const UINT WINEDDBLTFX_NOTEARING = 0x00000008; -/* 180 degrees clockwise rotation */ -const UINT WINEDDBLTFX_ROTATE180 = 0x00000010; -/* 270 degrees clockwise rotation */ -const UINT WINEDDBLTFX_ROTATE270 = 0x00000020; -/* 90 degrees clockwise rotation */ -const UINT WINEDDBLTFX_ROTATE90 = 0x00000040; -/* dwZBufferLow and dwZBufferHigh specify limits to the copied Z values */ -const UINT WINEDDBLTFX_ZBUFFERRANGE = 0x00000080; -/* add dwZBufferBaseDest to every source z value before compare */ -const UINT WINEDDBLTFX_ZBUFFERBASEDEST = 0x00000100; - -/* dwFlags for Blt* */ -const UINT WINEDDBLT_ALPHADEST = 0x00000001; -const UINT WINEDDBLT_ALPHADESTCONSTOVERRIDE = 0x00000002; -const UINT WINEDDBLT_ALPHADESTNEG = 0x00000004; -const UINT WINEDDBLT_ALPHADESTSURFACEOVERRIDE = 0x00000008; -const UINT WINEDDBLT_ALPHAEDGEBLEND = 0x00000010; -const UINT WINEDDBLT_ALPHASRC = 0x00000020; -const UINT WINEDDBLT_ALPHASRCCONSTOVERRIDE = 0x00000040; -const UINT WINEDDBLT_ALPHASRCNEG = 0x00000080; -const UINT WINEDDBLT_ALPHASRCSURFACEOVERRIDE = 0x00000100; -const UINT WINEDDBLT_ASYNC = 0x00000200; -const UINT WINEDDBLT_COLORFILL = 0x00000400; -const UINT WINEDDBLT_DDFX = 0x00000800; -const UINT WINEDDBLT_DDROPS = 0x00001000; -const UINT WINEDDBLT_KEYDEST = 0x00002000; -const UINT WINEDDBLT_KEYDESTOVERRIDE = 0x00004000; -const UINT WINEDDBLT_KEYSRC = 0x00008000; -const UINT WINEDDBLT_KEYSRCOVERRIDE = 0x00010000; -const UINT WINEDDBLT_ROP = 0x00020000; -const UINT WINEDDBLT_ROTATIONANGLE = 0x00040000; -const UINT WINEDDBLT_ZBUFFER = 0x00080000; -const UINT WINEDDBLT_ZBUFFERDESTCONSTOVERRIDE = 0x00100000; -const UINT WINEDDBLT_ZBUFFERDESTOVERRIDE = 0x00200000; -const UINT WINEDDBLT_ZBUFFERSRCCONSTOVERRIDE = 0x00400000; -const UINT WINEDDBLT_ZBUFFERSRCOVERRIDE = 0x00800000; -const UINT WINEDDBLT_WAIT = 0x01000000; -const UINT WINEDDBLT_DEPTHFILL = 0x02000000; -const UINT WINEDDBLT_DONOTWAIT = 0x08000000; - -/* dwTrans for BltFast */ -const UINT WINEDDBLTFAST_NOCOLORKEY = 0x00000000; -const UINT WINEDDBLTFAST_SRCCOLORKEY = 0x00000001; -const UINT WINEDDBLTFAST_DESTCOLORKEY = 0x00000002; -const UINT WINEDDBLTFAST_WAIT = 0x00000010; -const UINT WINEDDBLTFAST_DONOTWAIT = 0x00000020; - -/* DDSURFACEDESC.dwFlags */ -const UINT WINEDDSD_CAPS = 0x00000001; -const UINT WINEDDSD_HEIGHT = 0x00000002; -const UINT WINEDDSD_WIDTH = 0x00000004; -const UINT WINEDDSD_PITCH = 0x00000008; -const UINT WINEDDSD_BACKBUFFERCOUNT = 0x00000020; -const UINT WINEDDSD_ZBUFFERBITDEPTH = 0x00000040; -const UINT WINEDDSD_ALPHABITDEPTH = 0x00000080; -const UINT WINEDDSD_LPSURFACE = 0x00000800; -const UINT WINEDDSD_PIXELFORMAT = 0x00001000; -const UINT WINEDDSD_CKDESTOVERLAY = 0x00002000; -const UINT WINEDDSD_CKDESTBLT = 0x00004000; -const UINT WINEDDSD_CKSRCOVERLAY = 0x00008000; -const UINT WINEDDSD_CKSRCBLT = 0x00010000; -const UINT WINEDDSD_MIPMAPCOUNT = 0x00020000; -const UINT WINEDDSD_REFRESHRATE = 0x00040000; -const UINT WINEDDSD_LINEARSIZE = 0x00080000; -const UINT WINEDDSD_TEXTURESTAGE = 0x00100000; -const UINT WINEDDSD_FVF = 0x00200000; -const UINT WINEDDSD_SRCVBHANDLE = 0x00400000; -const UINT WINEDDSD_ALL = 0x007ff9ee; - -/* Set/Get Colour Key Flags */ -const UINT WINEDDCKEY_COLORSPACE = 0x00000001; /* Struct is single colour space */ -const UINT WINEDDCKEY_DESTBLT = 0x00000002; /* To be used as dest for blt */ -const UINT WINEDDCKEY_DESTOVERLAY = 0x00000004; /* To be used as dest for CK overlays */ -const UINT WINEDDCKEY_SRCBLT = 0x00000008; /* To be used as src for blt */ -const UINT WINEDDCKEY_SRCOVERLAY = 0x00000010; /* To be used as src for CK overlays */ - -/* dwFlags for GetBltStatus */ -const UINT WINEDDGBS_CANBLT = 0x00000001; -const UINT WINEDDGBS_ISBLTDONE = 0x00000002; - -/* dwFlags for GetFlipStatus */ -const UINT WINEDDGFS_CANFLIP = 0x00000001; -const UINT WINEDDGFS_ISFLIPDONE = 0x00000002; - -/* dwFlags for Flip */ -const UINT WINEDDFLIP_WAIT = 0x00000001; -const UINT WINEDDFLIP_EVEN = 0x00000002; /* only valid for overlay */ -const UINT WINEDDFLIP_ODD = 0x00000004; /* only valid for overlay */ -const UINT WINEDDFLIP_NOVSYNC = 0x00000008; -const UINT WINEDDFLIP_STEREO = 0x00000010; -const UINT WINEDDFLIP_DONOTWAIT = 0x00000020; -const UINT WINEDDFLIP_INTERVAL2 = 0x02000000; -const UINT WINEDDFLIP_INTERVAL3 = 0x03000000; -const UINT WINEDDFLIP_INTERVAL4 = 0x04000000; - -const UINT WINEDDOVER_ALPHADEST = 0x00000001; -const UINT WINEDDOVER_ALPHADESTCONSTOVERRIDE = 0x00000002; -const UINT WINEDDOVER_ALPHADESTNEG = 0x00000004; -const UINT WINEDDOVER_ALPHADESTSURFACEOVERRIDE = 0x00000008; -const UINT WINEDDOVER_ALPHAEDGEBLEND = 0x00000010; -const UINT WINEDDOVER_ALPHASRC = 0x00000020; -const UINT WINEDDOVER_ALPHASRCCONSTOVERRIDE = 0x00000040; -const UINT WINEDDOVER_ALPHASRCNEG = 0x00000080; -const UINT WINEDDOVER_ALPHASRCSURFACEOVERRIDE = 0x00000100; -const UINT WINEDDOVER_HIDE = 0x00000200; -const UINT WINEDDOVER_KEYDEST = 0x00000400; -const UINT WINEDDOVER_KEYDESTOVERRIDE = 0x00000800; -const UINT WINEDDOVER_KEYSRC = 0x00001000; -const UINT WINEDDOVER_KEYSRCOVERRIDE = 0x00002000; -const UINT WINEDDOVER_SHOW = 0x00004000; -const UINT WINEDDOVER_ADDDIRTYRECT = 0x00008000; -const UINT WINEDDOVER_REFRESHDIRTYRECTS = 0x00010000; -const UINT WINEDDOVER_REFRESHALL = 0x00020000; -const UINT WINEDDOVER_DDFX = 0x00080000; -const UINT WINEDDOVER_AUTOFLIP = 0x00100000; -const UINT WINEDDOVER_BOB = 0x00200000; -const UINT WINEDDOVER_OVERRIDEBOBWEAVE = 0x00400000; -const UINT WINEDDOVER_INTERLEAVED = 0x00800000; - -/* DirectDraw Caps */ -const UINT WINEDDSCAPS_RESERVED1 = 0x00000001; -const UINT WINEDDSCAPS_ALPHA = 0x00000002; -const UINT WINEDDSCAPS_BACKBUFFER = 0x00000004; -const UINT WINEDDSCAPS_COMPLEX = 0x00000008; -const UINT WINEDDSCAPS_FLIP = 0x00000010; -const UINT WINEDDSCAPS_FRONTBUFFER = 0x00000020; -const UINT WINEDDSCAPS_OFFSCREENPLAIN = 0x00000040; -const UINT WINEDDSCAPS_OVERLAY = 0x00000080; -const UINT WINEDDSCAPS_PALETTE = 0x00000100; -const UINT WINEDDSCAPS_PRIMARYSURFACE = 0x00000200; -const UINT WINEDDSCAPS_PRIMARYSURFACELEFT = 0x00000400; -const UINT WINEDDSCAPS_SYSTEMMEMORY = 0x00000800; -const UINT WINEDDSCAPS_TEXTURE = 0x00001000; -const UINT WINEDDSCAPS_3DDEVICE = 0x00002000; -const UINT WINEDDSCAPS_VIDEOMEMORY = 0x00004000; -const UINT WINEDDSCAPS_VISIBLE = 0x00008000; -const UINT WINEDDSCAPS_WRITEONLY = 0x00010000; -const UINT WINEDDSCAPS_ZBUFFER = 0x00020000; -const UINT WINEDDSCAPS_OWNDC = 0x00040000; -const UINT WINEDDSCAPS_LIVEVIDEO = 0x00080000; -const UINT WINEDDSCAPS_HWCODEC = 0x00100000; -const UINT WINEDDSCAPS_MODEX = 0x00200000; -const UINT WINEDDSCAPS_MIPMAP = 0x00400000; -const UINT WINEDDSCAPS_RESERVED2 = 0x00800000; -const UINT WINEDDSCAPS_ALLOCONLOAD = 0x04000000; -const UINT WINEDDSCAPS_VIDEOPORT = 0x08000000; -const UINT WINEDDSCAPS_LOCALVIDMEM = 0x10000000; -const UINT WINEDDSCAPS_NONLOCALVIDMEM = 0x20000000; -const UINT WINEDDSCAPS_STANDARDVGAMODE = 0x40000000; -const UINT WINEDDSCAPS_OPTIMIZED = 0x80000000; - -const UINT WINEDDCKEYCAPS_DESTBLT = 0x00000001; -const UINT WINEDDCKEYCAPS_DESTBLTCLRSPACE = 0x00000002; -const UINT WINEDDCKEYCAPS_DESTBLTCLRSPACEYUV = 0x00000004; -const UINT WINEDDCKEYCAPS_DESTBLTYUV = 0x00000008; -const UINT WINEDDCKEYCAPS_DESTOVERLAY = 0x00000010; -const UINT WINEDDCKEYCAPS_DESTOVERLAYCLRSPACE = 0x00000020; -const UINT WINEDDCKEYCAPS_DESTOVERLAYCLRSPACEYUV = 0x00000040; -const UINT WINEDDCKEYCAPS_DESTOVERLAYONEACTIVE = 0x00000080; -const UINT WINEDDCKEYCAPS_DESTOVERLAYYUV = 0x00000100; -const UINT WINEDDCKEYCAPS_SRCBLT = 0x00000200; -const UINT WINEDDCKEYCAPS_SRCBLTCLRSPACE = 0x00000400; -const UINT WINEDDCKEYCAPS_SRCBLTCLRSPACEYUV = 0x00000800; -const UINT WINEDDCKEYCAPS_SRCBLTYUV = 0x00001000; -const UINT WINEDDCKEYCAPS_SRCOVERLAY = 0x00002000; -const UINT WINEDDCKEYCAPS_SRCOVERLAYCLRSPACE = 0x00004000; -const UINT WINEDDCKEYCAPS_SRCOVERLAYCLRSPACEYUV = 0x00008000; -const UINT WINEDDCKEYCAPS_SRCOVERLAYONEACTIVE = 0x00010000; -const UINT WINEDDCKEYCAPS_SRCOVERLAYYUV = 0x00020000; -const UINT WINEDDCKEYCAPS_NOCOSTOVERLAY = 0x00040000; - -const UINT WINEDDFXCAPS_BLTALPHA = 0x00000001; -const UINT WINEDDFXCAPS_OVERLAYALPHA = 0x00000004; -const UINT WINEDDFXCAPS_BLTARITHSTRETCHYN = 0x00000010; -const UINT WINEDDFXCAPS_BLTARITHSTRETCHY = 0x00000020; -const UINT WINEDDFXCAPS_BLTMIRRORLEFTRIGHT = 0x00000040; -const UINT WINEDDFXCAPS_BLTMIRRORUPDOWN = 0x00000080; -const UINT WINEDDFXCAPS_BLTROTATION = 0x00000100; -const UINT WINEDDFXCAPS_BLTROTATION90 = 0x00000200; -const UINT WINEDDFXCAPS_BLTSHRINKX = 0x00000400; -const UINT WINEDDFXCAPS_BLTSHRINKXN = 0x00000800; -const UINT WINEDDFXCAPS_BLTSHRINKY = 0x00001000; -const UINT WINEDDFXCAPS_BLTSHRINKYN = 0x00002000; -const UINT WINEDDFXCAPS_BLTSTRETCHX = 0x00004000; -const UINT WINEDDFXCAPS_BLTSTRETCHXN = 0x00008000; -const UINT WINEDDFXCAPS_BLTSTRETCHY = 0x00010000; -const UINT WINEDDFXCAPS_BLTSTRETCHYN = 0x00020000; -const UINT WINEDDFXCAPS_OVERLAYARITHSTRETCHY = 0x00040000; -const UINT WINEDDFXCAPS_OVERLAYARITHSTRETCHYN = 0x00000008; -const UINT WINEDDFXCAPS_OVERLAYSHRINKX = 0x00080000; -const UINT WINEDDFXCAPS_OVERLAYSHRINKXN = 0x00100000; -const UINT WINEDDFXCAPS_OVERLAYSHRINKY = 0x00200000; -const UINT WINEDDFXCAPS_OVERLAYSHRINKYN = 0x00400000; -const UINT WINEDDFXCAPS_OVERLAYSTRETCHX = 0x00800000; -const UINT WINEDDFXCAPS_OVERLAYSTRETCHXN = 0x01000000; -const UINT WINEDDFXCAPS_OVERLAYSTRETCHY = 0x02000000; -const UINT WINEDDFXCAPS_OVERLAYSTRETCHYN = 0x04000000; -const UINT WINEDDFXCAPS_OVERLAYMIRRORLEFTRIGHT = 0x08000000; -const UINT WINEDDFXCAPS_OVERLAYMIRRORUPDOWN = 0x10000000; - -const UINT WINEDDCAPS_3D = 0x00000001; -const UINT WINEDDCAPS_ALIGNBOUNDARYDEST = 0x00000002; -const UINT WINEDDCAPS_ALIGNSIZEDEST = 0x00000004; -const UINT WINEDDCAPS_ALIGNBOUNDARYSRC = 0x00000008; -const UINT WINEDDCAPS_ALIGNSIZESRC = 0x00000010; -const UINT WINEDDCAPS_ALIGNSTRIDE = 0x00000020; -const UINT WINEDDCAPS_BLT = 0x00000040; -const UINT WINEDDCAPS_BLTQUEUE = 0x00000080; -const UINT WINEDDCAPS_BLTFOURCC = 0x00000100; -const UINT WINEDDCAPS_BLTSTRETCH = 0x00000200; -const UINT WINEDDCAPS_GDI = 0x00000400; -const UINT WINEDDCAPS_OVERLAY = 0x00000800; -const UINT WINEDDCAPS_OVERLAYCANTCLIP = 0x00001000; -const UINT WINEDDCAPS_OVERLAYFOURCC = 0x00002000; -const UINT WINEDDCAPS_OVERLAYSTRETCH = 0x00004000; -const UINT WINEDDCAPS_PALETTE = 0x00008000; -const UINT WINEDDCAPS_PALETTEVSYNC = 0x00010000; -const UINT WINEDDCAPS_READSCANLINE = 0x00020000; -const UINT WINEDDCAPS_STEREOVIEW = 0x00040000; -const UINT WINEDDCAPS_VBI = 0x00080000; -const UINT WINEDDCAPS_ZBLTS = 0x00100000; -const UINT WINEDDCAPS_ZOVERLAYS = 0x00200000; -const UINT WINEDDCAPS_COLORKEY = 0x00400000; -const UINT WINEDDCAPS_ALPHA = 0x00800000; -const UINT WINEDDCAPS_COLORKEYHWASSIST = 0x01000000; -const UINT WINEDDCAPS_NOHARDWARE = 0x02000000; -const UINT WINEDDCAPS_BLTCOLORFILL = 0x04000000; -const UINT WINEDDCAPS_BANKSWITCHED = 0x08000000; -const UINT WINEDDCAPS_BLTDEPTHFILL = 0x10000000; -const UINT WINEDDCAPS_CANCLIP = 0x20000000; -const UINT WINEDDCAPS_CANCLIPSTRETCHED = 0x40000000; -const UINT WINEDDCAPS_CANBLTSYSMEM = 0x80000000; - -const UINT WINEDDCAPS2_CERTIFIED = 0x00000001; -const UINT WINEDDCAPS2_NO2DDURING3DSCENE = 0x00000002; -const UINT WINEDDCAPS2_VIDEOPORT = 0x00000004; -const UINT WINEDDCAPS2_AUTOFLIPOVERLAY = 0x00000008; -const UINT WINEDDCAPS2_CANBOBINTERLEAVED = 0x00000010; -const UINT WINEDDCAPS2_CANBOBNONINTERLEAVED = 0x00000020; -const UINT WINEDDCAPS2_COLORCONTROLOVERLAY = 0x00000040; -const UINT WINEDDCAPS2_COLORCONTROLPRIMARY = 0x00000080; -const UINT WINEDDCAPS2_CANDROPZ16BIT = 0x00000100; -const UINT WINEDDCAPS2_NONLOCALVIDMEM = 0x00000200; -const UINT WINEDDCAPS2_NONLOCALVIDMEMCAPS = 0x00000400; -const UINT WINEDDCAPS2_NOPAGELOCKREQUIRED = 0x00000800; -const UINT WINEDDCAPS2_WIDESURFACES = 0x00001000; -const UINT WINEDDCAPS2_CANFLIPODDEVEN = 0x00002000; -const UINT WINEDDCAPS2_CANBOBHARDWARE = 0x00004000; -const UINT WINEDDCAPS2_COPYFOURCC = 0x00008000; -const UINT WINEDDCAPS2_PRIMARYGAMMA = 0x00020000; -const UINT WINEDDCAPS2_CANRENDERWINDOWED = 0x00080000; -const UINT WINEDDCAPS2_CANCALIBRATEGAMMA = 0x00100000; -const UINT WINEDDCAPS2_FLIPINTERVAL = 0x00200000; -const UINT WINEDDCAPS2_FLIPNOVSYNC = 0x00400000; -const UINT WINEDDCAPS2_CANMANAGETEXTURE = 0x00800000; -const UINT WINEDDCAPS2_TEXMANINNONLOCALVIDMEM = 0x01000000; -const UINT WINEDDCAPS2_STEREO = 0x02000000; -const UINT WINEDDCAPS2_SYSTONONLOCAL_AS_SYSTOLOCAL = 0x04000000; - -/* DDCAPS.d */ -const UINT WINEDDPCAPS_4BIT = 0x00000001; -const UINT WINEDDPCAPS_8BITENTRIES = 0x00000002; -const UINT WINEDDPCAPS_8BIT = 0x00000004; -const UINT WINEDDPCAPS_INITIALIZE = 0x00000008; -const UINT WINEDDPCAPS_PRIMARYSURFACE = 0x00000010; -const UINT WINEDDPCAPS_PRIMARYSURFACELEFT = 0x00000020; -const UINT WINEDDPCAPS_ALLOW256 = 0x00000040; -const UINT WINEDDPCAPS_VSYNC = 0x00000080; -const UINT WINEDDPCAPS_1BIT = 0x00000100; -const UINT WINEDDPCAPS_2BIT = 0x00000200; -const UINT WINEDDPCAPS_ALPHA = 0x00000400; - -typedef struct _WINED3DDISPLAYMODE -{ - UINT Width; - UINT Height; - UINT RefreshRate; - enum wined3d_format_id Format; -} WINED3DDISPLAYMODE; - -typedef struct _WINED3DCOLORVALUE -{ - float r; - float g; - float b; - float a; -} WINED3DCOLORVALUE; - -typedef struct _WINED3DVECTOR -{ - float x; - float y; - float z; -} WINED3DVECTOR; - -typedef struct _WINED3DMATRIX -{ - union - { - struct - { - float _11, _12, _13, _14; - float _21, _22, _23, _24; - float _31, _32, _33, _34; - float _41, _42, _43, _44; - } DUMMYSTRUCTNAME; - float m[4][4]; - } DUMMYUNIONNAME; -} WINED3DMATRIX; - -typedef struct _WINED3DLIGHT -{ - WINED3DLIGHTTYPE Type; - WINED3DCOLORVALUE Diffuse; - WINED3DCOLORVALUE Specular; - WINED3DCOLORVALUE Ambient; - WINED3DVECTOR Position; - WINED3DVECTOR Direction; - float Range; - float Falloff; - float Attenuation0; - float Attenuation1; - float Attenuation2; - float Theta; - float Phi; -} WINED3DLIGHT; - -typedef struct _WINED3DMATERIAL -{ - WINED3DCOLORVALUE Diffuse; - WINED3DCOLORVALUE Ambient; - WINED3DCOLORVALUE Specular; - WINED3DCOLORVALUE Emissive; - float Power; -} WINED3DMATERIAL; - -typedef struct _WINED3DVIEWPORT -{ - DWORD X; - DWORD Y; - DWORD Width; - DWORD Height; - float MinZ; - float MaxZ; -} WINED3DVIEWPORT; - -typedef struct _WINED3DGAMMARAMP -{ - WORD red[256]; - WORD green[256]; - WORD blue[256]; -} WINED3DGAMMARAMP; - -typedef struct _WINED3DLINEPATTERN -{ - WORD wRepeatFactor; - WORD wLinePattern; -} WINED3DLINEPATTERN; - -typedef struct _WINEDD3DRECTPATCH_INFO -{ - UINT StartVertexOffsetWidth; - UINT StartVertexOffsetHeight; - UINT Width; - UINT Height; - UINT Stride; - WINED3DBASISTYPE Basis; - WINED3DDEGREETYPE Degree; -} WINED3DRECTPATCH_INFO; - -typedef struct _WINED3DTRIPATCH_INFO -{ - UINT StartVertexOffset; - UINT NumVertices; - WINED3DBASISTYPE Basis; - WINED3DDEGREETYPE Degree; -} WINED3DTRIPATCH_INFO; - -typedef struct _WINED3DADAPTER_IDENTIFIER -{ - char *driver; - UINT driver_size; - char *description; - UINT description_size; - char *device_name; - UINT device_name_size; - LARGE_INTEGER driver_version; - DWORD vendor_id; - DWORD device_id; - DWORD subsystem_id; - DWORD revision; - GUID device_identifier; - DWORD whql_level; - LUID adapter_luid; - SIZE_T video_memory; -} WINED3DADAPTER_IDENTIFIER; - -typedef struct _WINED3DPRESENT_PARAMETERS -{ - UINT BackBufferWidth; - UINT BackBufferHeight; - enum wined3d_format_id BackBufferFormat; - UINT BackBufferCount; - WINED3DMULTISAMPLE_TYPE MultiSampleType; - DWORD MultiSampleQuality; - WINED3DSWAPEFFECT SwapEffect; - HWND hDeviceWindow; - BOOL Windowed; - BOOL EnableAutoDepthStencil; - enum wined3d_format_id AutoDepthStencilFormat; - DWORD Flags; - UINT FullScreen_RefreshRateInHz; - UINT PresentationInterval; - BOOL AutoRestoreDisplayMode; -} WINED3DPRESENT_PARAMETERS; - -typedef struct _WINED3DSURFACE_DESC -{ - enum wined3d_format_id format; - WINED3DRESOURCETYPE resource_type; - DWORD usage; - WINED3DPOOL pool; - UINT size; - WINED3DMULTISAMPLE_TYPE multisample_type; - DWORD multisample_quality; - UINT width; - UINT height; -} WINED3DSURFACE_DESC; - -typedef struct _WINED3DVOLUME_DESC -{ - enum wined3d_format_id Format; - WINED3DRESOURCETYPE Type; - DWORD Usage; - WINED3DPOOL Pool; - UINT Size; - UINT Width; - UINT Height; - UINT Depth; -} WINED3DVOLUME_DESC; - -typedef struct _WINED3DCLIPSTATUS -{ - DWORD ClipUnion; - DWORD ClipIntersection; -} WINED3DCLIPSTATUS; - -typedef struct _WINED3DVERTEXELEMENT -{ - enum wined3d_format_id format; - WORD input_slot; - WORD offset; - UINT output_slot; /* D3D 8 & 10 */ - BYTE method; - BYTE usage; - BYTE usage_idx; -} WINED3DVERTEXELEMENT; - -typedef struct _WINED3DDEVICE_CREATION_PARAMETERS -{ - UINT AdapterOrdinal; - WINED3DDEVTYPE DeviceType; - HWND hFocusWindow; - DWORD BehaviorFlags; -} WINED3DDEVICE_CREATION_PARAMETERS; - -typedef struct _WINED3DDEVINFO_BANDWIDTHTIMINGS -{ - float MaxBandwidthUtilized; - float FrontEndUploadMemoryUtilizedPercent; - float VertexRateUtilizedPercent; - float TriangleSetupRateUtilizedPercent; - float FillRateUtilizedPercent; -} WINED3DDEVINFO_BANDWIDTHTIMINGS; - -typedef struct _WINED3DDEVINFO_CACHEUTILIZATION -{ - float TextureCacheHitRate; - float PostTransformVertexCacheHitRate; -} WINED3DDEVINFO_CACHEUTILIZATION; - -typedef struct _WINED3DDEVINFO_INTERFACETIMINGS -{ - float WaitingForGPUToUseApplicationResourceTimePercent; - float WaitingForGPUToAcceptMoreCommandsTimePercent; - float WaitingForGPUToStayWithinLatencyTimePercent; - float WaitingForGPUExclusiveResourceTimePercent; - float WaitingForGPUOtherTimePercent; -} WINED3DDEVINFO_INTERFACETIMINGS; - -typedef struct _WINED3DDEVINFO_PIPELINETIMINGS -{ - float VertexProcessingTimePercent; - float PixelProcessingTimePercent; - float OtherGPUProcessingTimePercent; - float GPUIdleTimePercent; -} WINED3DDEVINFO_PIPELINETIMINGS; - -typedef struct _WINED3DDEVINFO_STAGETIMINGS -{ - float MemoryProcessingPercent; - float ComputationProcessingPercent; -} WINED3DDEVINFO_STAGETIMINGS; - -typedef struct _WINED3DRASTER_STATUS -{ - BOOL InVBlank; - UINT ScanLine; -} WINED3DRASTER_STATUS; - -typedef struct WINED3DRESOURCESTATS -{ - BOOL bThrashing; - DWORD ApproxBytesDownloaded; - DWORD NumEvicts; - DWORD NumVidCreates; - DWORD LastPri; - DWORD NumUsed; - DWORD NumUsedInVidMem; - DWORD WorkingSet; - DWORD WorkingSetBytes; - DWORD TotalManaged; - DWORD TotalBytes; -} WINED3DRESOURCESTATS; - -typedef struct _WINED3DDEVINFO_RESOURCEMANAGER -{ - WINED3DRESOURCESTATS stats[WINED3DRTYPECOUNT]; -} WINED3DDEVINFO_RESOURCEMANAGER; - -typedef struct _WINED3DDEVINFO_VERTEXSTATS -{ - DWORD NumRenderedTriangles; - DWORD NumExtraClippingTriangles; -} WINED3DDEVINFO_VERTEXSTATS; - -typedef struct _WINED3DLOCKED_RECT -{ - INT Pitch; - void *pBits; -} WINED3DLOCKED_RECT; - -typedef struct _WINED3DLOCKED_BOX -{ - INT RowPitch; - INT SlicePitch; - void *pBits; -} WINED3DLOCKED_BOX; - -typedef struct _WINED3DBOX -{ - UINT Left; - UINT Top; - UINT Right; - UINT Bottom; - UINT Front; - UINT Back; -} WINED3DBOX; - -/*Vertex cache optimization hints.*/ -typedef struct WINED3DDEVINFO_VCACHE -{ - DWORD Pattern; /* Must be a 4 char code FOURCC (e.g. CACH) */ - DWORD OptMethod; /* 0 to get the longest strips, 1 vertex cache */ - DWORD CacheSize; /* Cache size to use (only valid if OptMethod==1) */ - DWORD MagicNumber; /* Internal for deciding when to restart strips, - non user modifiable (only valid if OptMethod==1) */ -} WINED3DDEVINFO_VCACHE; - -typedef struct _WINED3DBUFFER_DESC -{ - WINED3DRESOURCETYPE Type; - DWORD Usage; - WINED3DPOOL Pool; - UINT Size; -} WINED3DBUFFER_DESC; - -typedef struct WineDirect3DStridedData -{ - enum wined3d_format_id format; /* Format of the data */ - const BYTE *lpData; /* Pointer to start of data */ - DWORD dwStride; /* Stride between occurrences of this data */ -} WineDirect3DStridedData; - -typedef struct WineDirect3DVertexStridedData -{ - WineDirect3DStridedData position; - WineDirect3DStridedData normal; - WineDirect3DStridedData diffuse; - WineDirect3DStridedData specular; - WineDirect3DStridedData texCoords[WINED3DDP_MAXTEXCOORD]; - BOOL position_transformed; -} WineDirect3DVertexStridedData; - -typedef struct _WINED3DVSHADERCAPS2_0 -{ - DWORD Caps; - INT DynamicFlowControlDepth; - INT NumTemps; - INT StaticFlowControlDepth; -} WINED3DVSHADERCAPS2_0; - -typedef struct _WINED3DPSHADERCAPS2_0 -{ - DWORD Caps; - INT DynamicFlowControlDepth; - INT NumTemps; - INT StaticFlowControlDepth; - INT NumInstructionSlots; -} WINED3DPSHADERCAPS2_0; - -typedef struct _WINEDDCAPS -{ - DWORD Caps; - DWORD Caps2; - DWORD CKeyCaps; - DWORD FXCaps; - DWORD FXAlphaCaps; - DWORD PalCaps; - DWORD SVCaps; - DWORD SVBCaps; - DWORD SVBCKeyCaps; - DWORD SVBFXCaps; - DWORD VSBCaps; - DWORD VSBCKeyCaps; - DWORD VSBFXCaps; - DWORD SSBCaps; - DWORD SSBCKeyCaps; - DWORD SSBFXCaps; - DWORD ddsCaps; - DWORD StrideAlign; -} WINEDDCAPS; - -typedef struct _WINED3DCAPS -{ - WINED3DDEVTYPE DeviceType; - UINT AdapterOrdinal; - - DWORD Caps; - DWORD Caps2; - DWORD Caps3; - DWORD PresentationIntervals; - - DWORD CursorCaps; - DWORD DevCaps; - DWORD PrimitiveMiscCaps; - DWORD RasterCaps; - DWORD ZCmpCaps; - DWORD SrcBlendCaps; - DWORD DestBlendCaps; - DWORD AlphaCmpCaps; - DWORD ShadeCaps; - DWORD TextureCaps; - DWORD TextureFilterCaps; - DWORD CubeTextureFilterCaps; - DWORD VolumeTextureFilterCaps; - DWORD TextureAddressCaps; - DWORD VolumeTextureAddressCaps; - DWORD LineCaps; - - DWORD MaxTextureWidth; - DWORD MaxTextureHeight; - DWORD MaxVolumeExtent; - DWORD MaxTextureRepeat; - DWORD MaxTextureAspectRatio; - DWORD MaxAnisotropy; - float MaxVertexW; - - float GuardBandLeft; - float GuardBandTop; - float GuardBandRight; - float GuardBandBottom; - - float ExtentsAdjust; - DWORD StencilCaps; - - DWORD FVFCaps; - DWORD TextureOpCaps; - DWORD MaxTextureBlendStages; - DWORD MaxSimultaneousTextures; - - DWORD VertexProcessingCaps; - DWORD MaxActiveLights; - DWORD MaxUserClipPlanes; - DWORD MaxVertexBlendMatrices; - DWORD MaxVertexBlendMatrixIndex; - - float MaxPointSize; - - DWORD MaxPrimitiveCount; - DWORD MaxVertexIndex; - DWORD MaxStreams; - DWORD MaxStreamStride; - - DWORD VertexShaderVersion; - DWORD MaxVertexShaderConst; - - DWORD PixelShaderVersion; - float PixelShader1xMaxValue; - - /* DX 9 */ - DWORD DevCaps2; - - float MaxNpatchTessellationLevel; - DWORD Reserved5; /* undocumented */ - - UINT MasterAdapterOrdinal; - UINT AdapterOrdinalInGroup; - UINT NumberOfAdaptersInGroup; - DWORD DeclTypes; - DWORD NumSimultaneousRTs; - DWORD StretchRectFilterCaps; - WINED3DVSHADERCAPS2_0 VS20Caps; - WINED3DPSHADERCAPS2_0 PS20Caps; - DWORD VertexTextureFilterCaps; - DWORD MaxVShaderInstructionsExecuted; - DWORD MaxPShaderInstructionsExecuted; - DWORD MaxVertexShader30InstructionSlots; - DWORD MaxPixelShader30InstructionSlots; - DWORD Reserved2; /* Not in the microsoft headers but documented */ - DWORD Reserved3; - - WINEDDCAPS DirectDrawCaps; -} WINED3DCAPS; - -/* DirectDraw types */ - -typedef struct _WINEDDCOLORKEY -{ - DWORD dwColorSpaceLowValue; /* low boundary of color space that is to - * be treated as Color Key, inclusive */ - DWORD dwColorSpaceHighValue; /* high boundary of color space that is - * to be treated as Color Key, inclusive */ -} WINEDDCOLORKEY,*LPWINEDDCOLORKEY; - -typedef struct _WINEDDBLTFX -{ - DWORD dwSize; /* size of structure */ - DWORD dwDDFX; /* FX operations */ - DWORD dwROP; /* Win32 raster operations */ - DWORD dwDDROP; /* Raster operations new for DirectDraw */ - DWORD dwRotationAngle; /* Rotation angle for blt */ - DWORD dwZBufferOpCode; /* ZBuffer compares */ - DWORD dwZBufferLow; /* Low limit of Z buffer */ - DWORD dwZBufferHigh; /* High limit of Z buffer */ - DWORD dwZBufferBaseDest; /* Destination base value */ - DWORD dwZDestConstBitDepth; /* Bit depth used to specify Z constant for destination */ - union - { - DWORD dwZDestConst; /* Constant to use as Z buffer for dest */ - struct IWineD3DSurface *lpDDSZBufferDest; /* Surface to use as Z buffer for dest */ - } DUMMYUNIONNAME1; - DWORD dwZSrcConstBitDepth; /* Bit depth used to specify Z constant for source */ - union - { - DWORD dwZSrcConst; /* Constant to use as Z buffer for src */ - struct IWineD3DSurface *lpDDSZBufferSrc; /* Surface to use as Z buffer for src */ - } DUMMYUNIONNAME2; - DWORD dwAlphaEdgeBlendBitDepth; /* Bit depth used to specify constant for alpha edge blend */ - DWORD dwAlphaEdgeBlend; /* Alpha for edge blending */ - DWORD dwReserved; - DWORD dwAlphaDestConstBitDepth; /* Bit depth used to specify alpha constant for destination */ - union - { - DWORD dwAlphaDestConst; /* Constant to use as Alpha Channel */ - struct IWineD3DSurface *lpDDSAlphaDest; /* Surface to use as Alpha Channel */ - } DUMMYUNIONNAME3; - DWORD dwAlphaSrcConstBitDepth; /* Bit depth used to specify alpha constant for source */ - union - { - DWORD dwAlphaSrcConst; /* Constant to use as Alpha Channel */ - struct IWineD3DSurface *lpDDSAlphaSrc; /* Surface to use as Alpha Channel */ - } DUMMYUNIONNAME4; - union - { - DWORD dwFillColor; /* color in RGB or Palettized */ - DWORD dwFillDepth; /* depth value for z-buffer */ - DWORD dwFillPixel; /* pixel val for RGBA or RGBZ */ - struct IWineD3DSurface *lpDDSPattern; /* Surface to use as pattern */ - } DUMMYUNIONNAME5; - WINEDDCOLORKEY ddckDestColorkey; /* DestColorkey override */ - WINEDDCOLORKEY ddckSrcColorkey; /* SrcColorkey override */ -} WINEDDBLTFX,*LPWINEDDBLTFX; - -typedef struct _WINEDDOVERLAYFX -{ - DWORD dwSize; /* size of structure */ - DWORD dwAlphaEdgeBlendBitDepth; /* Bit depth used to specify constant for alpha edge blend */ - DWORD dwAlphaEdgeBlend; /* Constant to use as alpha for edge blend */ - DWORD dwReserved; - DWORD dwAlphaDestConstBitDepth; /* Bit depth used to specify alpha constant for destination */ - union - { - DWORD dwAlphaDestConst; /* Constant to use as alpha channel for dest */ - struct IWineD3DSurface *lpDDSAlphaDest; /* Surface to use as alpha channel for dest */ - } DUMMYUNIONNAME1; - DWORD dwAlphaSrcConstBitDepth; /* Bit depth used to specify alpha constant for source */ - union - { - DWORD dwAlphaSrcConst; /* Constant to use as alpha channel for src */ - struct IWineD3DSurface *lpDDSAlphaSrc; /* Surface to use as alpha channel for src */ - } DUMMYUNIONNAME2; - WINEDDCOLORKEY dckDestColorkey; /* DestColorkey override */ - WINEDDCOLORKEY dckSrcColorkey; /* SrcColorkey override */ - DWORD dwDDFX; /* Overlay FX */ - DWORD dwFlags; /* flags */ -} WINEDDOVERLAYFX; - -struct wined3d_buffer_desc -{ - UINT byte_width; - DWORD usage; - UINT bind_flags; - UINT cpu_access_flags; - UINT misc_flags; -}; - -struct wined3d_shader_signature_element -{ - const char *semantic_name; - UINT semantic_idx; - enum wined3d_sysval_semantic sysval_semantic; - DWORD component_type; - UINT register_idx; - DWORD mask; -}; - -struct wined3d_shader_signature -{ - UINT element_count; - struct wined3d_shader_signature_element *elements; - char *string_data; -}; - -struct wined3d_parent_ops -{ - void (__stdcall *wined3d_object_destroyed)(void *parent); -}; - -interface IWineD3DResource; -interface IWineD3DSurface; -interface IWineD3DVolume; -interface IWineD3DSwapChain; -interface IWineD3DDevice; - -[ - object, - local, - uuid(aeb62dfc-bdcb-4f02-9519-1eeea00c15cd) -] -interface IWineD3DDeviceParent : IUnknown -{ - void WineD3DDeviceCreated( - [in] IWineD3DDevice *device - ); - - HRESULT CreateSurface( - [in] IUnknown *superior, - [in] UINT width, - [in] UINT height, - [in] enum wined3d_format_id format_id, - [in] DWORD usage, - [in] WINED3DPOOL pool, - [in] UINT level, - [in] WINED3DCUBEMAP_FACES face, - [out] IWineD3DSurface **surface - ); - - HRESULT CreateRenderTarget( - [in] IUnknown *superior, - [in] UINT width, - [in] UINT height, - [in] enum wined3d_format_id format_id, - [in] WINED3DMULTISAMPLE_TYPE multisample_type, - [in] DWORD multisample_quality, - [in] BOOL lockable, - [out] IWineD3DSurface **surface - ); - - HRESULT CreateDepthStencilSurface( - [in] UINT width, - [in] UINT height, - [in] enum wined3d_format_id format_id, - [in] WINED3DMULTISAMPLE_TYPE multisample_type, - [in] DWORD multisample_quality, - [in] BOOL discard, - [out] IWineD3DSurface **surface - ); - - HRESULT CreateVolume( - [in] IUnknown *superior, - [in] UINT width, - [in] UINT height, - [in] UINT depth, - [in] enum wined3d_format_id format_id, - [in] WINED3DPOOL pool, - [in] DWORD usage, - [out] IWineD3DVolume **volume - ); - - HRESULT CreateSwapChain( - [in, out] WINED3DPRESENT_PARAMETERS *present_parameters, - [out] IWineD3DSwapChain **swapchain - ); -} -typedef ULONG (__stdcall *D3DCB_DESTROYSWAPCHAINFN)(IWineD3DSwapChain *pSwapChain); -typedef HRESULT (__stdcall *D3DCB_ENUMRESOURCES)(IWineD3DResource *resource, void *pData); - -[ - object, - local, - uuid(46799311-8e0e-40ce-b2ec-ddb99f18fcb4) -] -interface IWineD3DBase : IUnknown -{ - void *GetParent( - ); -} - -[ - object, - local, - uuid(108f9c44-6f30-11d9-c687-00046142c14f) -] -interface IWineD3D : IWineD3DBase -{ - UINT GetAdapterCount( - ); - HRESULT RegisterSoftwareDevice( - [in] void *pInitializeFunction - ); - HMONITOR GetAdapterMonitor( - [in] UINT adapter_idx - ); - UINT GetAdapterModeCount( - [in] UINT adapter_idx, - [in] enum wined3d_format_id format_id - ); - HRESULT EnumAdapterModes( - [in] UINT adapter_idx, - [in] enum wined3d_format_id format_id, - [in] UINT mode_idx, - [out] WINED3DDISPLAYMODE *mode - ); - HRESULT GetAdapterDisplayMode( - [in] UINT adapter_idx, - [out] WINED3DDISPLAYMODE *mode - ); - HRESULT GetAdapterIdentifier( - [in] UINT adapter_idx, - [in] DWORD flags, - [out] WINED3DADAPTER_IDENTIFIER *identifier - ); - HRESULT CheckDeviceMultiSampleType( - [in] UINT adapter_idx, - [in] WINED3DDEVTYPE device_type, - [in] enum wined3d_format_id surface_format_id, - [in] BOOL windowed, - [in] WINED3DMULTISAMPLE_TYPE multisample_type, - [out] DWORD *quality_levels - ); - HRESULT CheckDepthStencilMatch( - [in] UINT adapter_idx, - [in] WINED3DDEVTYPE device_type, - [in] enum wined3d_format_id adapter_format_id, - [in] enum wined3d_format_id render_target_format_id, - [in] enum wined3d_format_id depth_stencil_format_id - ); - HRESULT CheckDeviceType( - [in] UINT adapter_idx, - [in] WINED3DDEVTYPE device_type, - [in] enum wined3d_format_id display_format_id, - [in] enum wined3d_format_id backbuffer_format_id, - [in] BOOL windowed - ); - HRESULT CheckDeviceFormat( - [in] UINT adaper_idx, - [in] WINED3DDEVTYPE device_type, - [in] enum wined3d_format_id adapter_format_id, - [in] DWORD usage, - [in] WINED3DRESOURCETYPE resource_type, - [in] enum wined3d_format_id check_format, - [in] WINED3DSURFTYPE surface_type - ); - HRESULT CheckDeviceFormatConversion( - [in] UINT adapter_idx, - [in] WINED3DDEVTYPE device_type, - [in] enum wined3d_format_id source_format_id, - [in] enum wined3d_format_id target_format_id - ); - HRESULT GetDeviceCaps( - [in] UINT adapter_idx, - [in] WINED3DDEVTYPE device_type, - [out] WINED3DCAPS *caps - ); - HRESULT CreateDevice( - [in] UINT adapter_idx, - [in] WINED3DDEVTYPE device_type, - [in] HWND focus_window, - [in] DWORD behaviour_flags, - [in] IWineD3DDeviceParent *device_parent, - [out] IWineD3DDevice **device - ); -} - -[ - object, - local, - uuid(1f3bfb34-6f30-11d9-c687-00046142c14f) -] -interface IWineD3DResource : IWineD3DBase -{ - HRESULT SetPrivateData( - [in] REFGUID guid, - [in] const void *data, - [in] DWORD data_size, - [in] DWORD flags - ); - HRESULT GetPrivateData( - [in] REFGUID guid, - [out] void *data, - [in, out] DWORD *data_size - ); - HRESULT FreePrivateData( - [in] REFGUID guid - ); - DWORD SetPriority( - [in] DWORD new_priority - ); - DWORD GetPriority( - ); - void PreLoad( - ); - void UnLoad( - ); - WINED3DRESOURCETYPE GetType( - ); -} - -[ - object, - local, - uuid(f7d8abf4-fb93-43e4-9c96-4618cf9b3cbc) -] -interface IWineD3DRendertargetView : IWineD3DBase -{ - HRESULT GetResource( - [out] IWineD3DResource **resource - ); -} - -[ - object, - local, - uuid(f756720c-32b9-4439-b5a3-1d6c97037d9e) -] -interface IWineD3DPalette : IWineD3DBase -{ - HRESULT GetEntries( - [in] DWORD flags, - [in] DWORD start, - [in] DWORD count, - [out] PALETTEENTRY *entries - ); - HRESULT GetCaps( - [out] DWORD *caps - ); - HRESULT SetEntries( - [in] DWORD flags, - [in] DWORD start, - [in] DWORD count, - [in] const PALETTEENTRY *entries - ); -} - -[ - object, - local, - uuid(8f2bceb1-d338-488c-ab7f-0ec980bf5d2d) -] -interface IWineD3DClipper : IUnknown -{ - HRESULT GetClipList( - [in] const RECT *rect, - [out] RGNDATA *clip_list, - [in, out] DWORD *clip_list_size - ); - HRESULT GetHWnd( - [out] HWND *hwnd - ); - HRESULT IsClipListChanged( - [out] BOOL *changed - ); - HRESULT SetClipList( - [in] const RGNDATA *clip_list, - [in] DWORD flags - ); - HRESULT SetHWnd( - [in] DWORD flags, - [in] HWND hwnd - ); -} - -[ - object, - local, - uuid(37cd5526-6f30-11d9-c687-00046142c14f) -] -interface IWineD3DSurface : IWineD3DResource -{ - void GetDesc( - [out] WINED3DSURFACE_DESC *desc - ); - HRESULT LockRect( - [out] WINED3DLOCKED_RECT *locked_rect, - [in] const RECT *rect, - [in] DWORD flags - ); - HRESULT UnlockRect( - ); - HRESULT GetDC( - [out] HDC *dc - ); - HRESULT ReleaseDC( - [in] HDC dc - ); - HRESULT Flip( - [in] IWineD3DSurface *override, - [in] DWORD flags - ); - HRESULT Blt( - [in] const RECT *dst_rect, - [in] IWineD3DSurface *src_surface, - [in] const RECT *src_rect, - [in] DWORD flags, - [in] const WINEDDBLTFX *blt_fx, - [in] WINED3DTEXTUREFILTERTYPE filter - ); - HRESULT GetBltStatus( - [in] DWORD flags - ); - HRESULT GetFlipStatus( - [in] DWORD flags - ); - HRESULT IsLost( - ); - HRESULT Restore( - ); - HRESULT BltFast( - [in] DWORD dst_x, - [in] DWORD dst_y, - [in] IWineD3DSurface *src_surface, - [in] const RECT *src_rect, - [in] DWORD trans - ); - HRESULT GetPalette( - [out] IWineD3DPalette **palette - ); - HRESULT SetPalette( - [in] IWineD3DPalette *palette - ); - HRESULT RealizePalette( - ); - HRESULT SetColorKey( - [in] DWORD flags, - [in] const WINEDDCOLORKEY *color_key - ); - DWORD GetPitch( - ); - HRESULT SetMem( - [in] void *mem - ); - HRESULT SetOverlayPosition( - [in] LONG x, - [in] LONG y - ); - HRESULT GetOverlayPosition( - [out] LONG *x, - [out] LONG *y - ); - HRESULT UpdateOverlayZOrder( - [in] DWORD flags, - [in] IWineD3DSurface *ref - ); - HRESULT UpdateOverlay( - [in] const RECT *src_rect, - [in] IWineD3DSurface *dst_surface, - [in] const RECT *dst_rect, - [in] DWORD flags, - [in] const WINEDDOVERLAYFX *fx - ); - HRESULT SetClipper( - [in] IWineD3DClipper *clipper - ); - HRESULT GetClipper( - [out] IWineD3DClipper **clipper - ); - HRESULT LoadTexture( - [in] BOOL srgb_mode - ); - void BindTexture( - [in] BOOL srgb - ); - const void *GetData( - ); - HRESULT SetFormat( - [in] enum wined3d_format_id format_id - ); - HRESULT PrivateSetup( - ); - WINED3DSURFTYPE GetImplType( - ); - HRESULT DrawOverlay( - ); -} - -[ - object, - local, - uuid(24769ed8-6f30-11d9-c687-00046142c14f) -] -interface IWineD3DVolume : IWineD3DResource -{ - void GetDesc( - [out] WINED3DVOLUME_DESC *desc - ); - HRESULT LockBox( - [out] WINED3DLOCKED_BOX *locked_box, - [in] const WINED3DBOX *box, - [in] DWORD flags - ); - HRESULT UnlockBox( - ); - HRESULT LoadTexture( - [in] int gl_level, - [in] BOOL srgb_mode - ); -} - -[ - object, - local, - uuid(3c2aebf6-6f30-11d9-c687-00046142c14f) -] -interface IWineD3DBaseTexture : IWineD3DResource -{ - DWORD SetLOD( - [in] DWORD new_lod - ); - DWORD GetLOD( - ); - DWORD GetLevelCount( - ); - HRESULT SetAutoGenFilterType( - WINED3DTEXTUREFILTERTYPE filter_type - ); - WINED3DTEXTUREFILTERTYPE GetAutoGenFilterType( - ); - void GenerateMipSubLevels( - ); - BOOL SetDirty( - BOOL dirty - ); - BOOL GetDirty( - ); - HRESULT BindTexture( - [in] BOOL srgb - ); - BOOL IsCondNP2( - ); -} - -[ - object, - local, - uuid(3e72cc1c-6f30-11d9-c687-00046142c14f) -] -interface IWineD3DTexture : IWineD3DBaseTexture -{ - HRESULT GetLevelDesc( - [in] UINT level, - [out] WINED3DSURFACE_DESC *desc - ); - HRESULT GetSurfaceLevel( - [in] UINT level, - [out] IWineD3DSurface **surface - ); - HRESULT LockRect( - [in] UINT level, - [out] WINED3DLOCKED_RECT *locked_rect, - [in] const RECT *rect, - [in] DWORD flags - ); - HRESULT UnlockRect( - [in] UINT level - ); - HRESULT AddDirtyRect( - [in] const RECT *dirty_rect - ); -} - -[ - object, - local, - uuid(41752900-6f30-11d9-c687-00046142c14f) -] -interface IWineD3DCubeTexture : IWineD3DBaseTexture -{ - HRESULT GetLevelDesc( - [in] UINT level, - [out] WINED3DSURFACE_DESC *desc - ); - HRESULT GetCubeMapSurface( - [in] WINED3DCUBEMAP_FACES face, - [in] UINT level, - [out] IWineD3DSurface **surface - ); - HRESULT LockRect( - [in] WINED3DCUBEMAP_FACES face, - [in] UINT level, - [out] WINED3DLOCKED_RECT *locked_rect, - [in] const RECT *rect, - [in] DWORD flags - ); - HRESULT UnlockRect( - [in] WINED3DCUBEMAP_FACES face, - [in] UINT level - ); - HRESULT AddDirtyRect( - [in] WINED3DCUBEMAP_FACES face, - [in] const RECT *dirty_rect - ); -} - -[ - object, - local, - uuid(7b39470c-6f30-11d9-c687-00046142c14f) -] -interface IWineD3DVolumeTexture : IWineD3DBaseTexture -{ - HRESULT GetLevelDesc( - [in] UINT level, - [out] WINED3DVOLUME_DESC *desc - ); - HRESULT GetVolumeLevel( - [in] UINT level, - [out] IWineD3DVolume **volume - ); - HRESULT LockBox( - [in] UINT level, - [out] WINED3DLOCKED_BOX *locked_box, - [in] const WINED3DBOX *box, - [in] DWORD flags - ); - HRESULT UnlockBox( - [in] UINT level - ); - HRESULT AddDirtyBox( - [in] const WINED3DBOX *dirty_box - ); -} - -[ - object, - local, - uuid(7cd55be6-6f30-11d9-c687-00046142c14f) -] -interface IWineD3DVertexDeclaration : IWineD3DBase -{ -} - -[ - object, - local, - uuid(83b073ce-6f30-11d9-c687-00046142c14f) -] -interface IWineD3DStateBlock : IUnknown -{ - HRESULT Capture( - ); - HRESULT Apply( - ); -} - -[ - object, - local, - uuid(905ddbac-6f30-11d9-c687-00046142c14f) -] -interface IWineD3DQuery : IUnknown -{ - HRESULT GetData( - [out] void *data, - [in] DWORD data_size, - [in] DWORD flags - ); - DWORD GetDataSize( - ); - WINED3DQUERYTYPE GetType( - ); - HRESULT Issue( - DWORD flags - ); -} - -[ - object, - local, - uuid(34d01b10-6f30-11d9-c687-00046142c14f) -] -interface IWineD3DSwapChain : IWineD3DBase -{ - void Destroy( - ); - HRESULT GetDevice( - [out] IWineD3DDevice **device - ); - HRESULT Present( - [in] const RECT *src_rect, - [in] const RECT *dst_rect, - [in] HWND dst_window_override, - [in] const RGNDATA *dirty_region, - [in] DWORD flags - ); - HRESULT SetDestWindowOverride( - [in] HWND window - ); - HRESULT GetFrontBufferData( - [in] IWineD3DSurface *dst_surface - ); - HRESULT GetBackBuffer( - [in] UINT backbuffer_idx, - [in] WINED3DBACKBUFFER_TYPE backbuffer_type, - [out] IWineD3DSurface **backbuffer - ); - HRESULT GetRasterStatus( - [out] WINED3DRASTER_STATUS *raster_status - ); - HRESULT GetDisplayMode( - [out] WINED3DDISPLAYMODE *mode - ); - HRESULT GetPresentParameters( - [out] WINED3DPRESENT_PARAMETERS *present_parameters - ); - HRESULT SetGammaRamp( - [in] DWORD flags, - [in] const WINED3DGAMMARAMP *ramp - ); - HRESULT GetGammaRamp( - [out] WINED3DGAMMARAMP *ramp - ); -} - -[ - object, - local, - uuid(b3f028e8-1a40-4ab3-9292-5bf6cfd80209) -] -interface IWineD3DBuffer : IWineD3DResource -{ - HRESULT Map( - [in] UINT offset, - [in] UINT size, - [out] BYTE **data, - [in] DWORD flags - ); - HRESULT Unmap( - ); - void GetDesc( - [out] WINED3DBUFFER_DESC *desc - ); -} - -[ - object, - local, - uuid(eac93065-a4df-446f-86a1-9ef2bca40a3c) -] -interface IWineD3DBaseShader : IWineD3DBase -{ - HRESULT GetFunction( - [out] void *data, - [in, out] UINT *data_size - ); -} - -[ - object, - local, - uuid(7f7a2b60-6f30-11d9-c687-00046142c14f) -] -interface IWineD3DVertexShader : IWineD3DBaseShader -{ - HRESULT SetLocalConstantsF( - [in] UINT start_idx, - [in] const float *src_data, - [in] UINT vector4f_count - ); -} - -[ - object, - local, - uuid(8276c113-388b-49d1-ad8b-c9dd8bcbabcd) -] -interface IWineD3DGeometryShader : IWineD3DBaseShader -{ -} - -[ - object, - local, - uuid(818503da-6f30-11d9-c687-00046142c14f) -] -interface IWineD3DPixelShader : IWineD3DBaseShader -{ -} - -[ - object, - local, - uuid(6d10a2ce-09d0-4a53-a427-11388f9f8ca5) -] -interface IWineD3DDevice : IUnknown -{ - HRESULT CreateBuffer( - [in] struct wined3d_buffer_desc *desc, - [in] const void *data, - [in] void *parent, - [in] const struct wined3d_parent_ops *parent_ops, - [out] IWineD3DBuffer **buffer - ); - HRESULT CreateVertexBuffer( - [in] UINT length, - [in] DWORD usage, - [in] WINED3DPOOL pool, - [in] void *parent, - [in] const struct wined3d_parent_ops *parent_ops, - [out] IWineD3DBuffer **vertex_buffer - ); - HRESULT CreateIndexBuffer( - [in] UINT length, - [in] DWORD usage, - [in] WINED3DPOOL pool, - [in] void *parent, - [in] const struct wined3d_parent_ops *parent_ops, - [out] IWineD3DBuffer **index_buffer - ); - HRESULT CreateStateBlock( - [in] WINED3DSTATEBLOCKTYPE type, - [out] IWineD3DStateBlock **stateblock - ); - HRESULT CreateSurface( - [in] UINT width, - [in] UINT height, - [in] enum wined3d_format_id format_id, - [in] BOOL lockable, - [in] BOOL discard, - [in] UINT level, - [in] DWORD usage, - [in] WINED3DPOOL pool, - [in] WINED3DMULTISAMPLE_TYPE multisample_type, - [in] DWORD multisample_quality, - [in] WINED3DSURFTYPE surface_type, - [in] void *parent, - [in] const struct wined3d_parent_ops *parent_ops, - [out] IWineD3DSurface **surface - ); - HRESULT CreateRendertargetView( - [in] IWineD3DResource *resource, - [in] void *parent, - [out] IWineD3DRendertargetView **rendertarget_view - ); - HRESULT CreateTexture( - [in] UINT width, - [in] UINT height, - [in] UINT levels, - [in] DWORD usage, - [in] enum wined3d_format_id format_id, - [in] WINED3DPOOL pool, - [in] void *parent, - [in] const struct wined3d_parent_ops *parent_ops, - [out] IWineD3DTexture **texture - ); - HRESULT CreateVolumeTexture( - [in] UINT width, - [in] UINT height, - [in] UINT depth, - [in] UINT levels, - [in] DWORD usage, - [in] enum wined3d_format_id format_id, - [in] WINED3DPOOL pool, - [in] void *parent, - [in] const struct wined3d_parent_ops *parent_ops, - [out] IWineD3DVolumeTexture **texture - ); - HRESULT CreateVolume( - [in] UINT width, - [in] UINT height, - [in] UINT depth, - [in] DWORD usage, - [in] enum wined3d_format_id format_id, - [in] WINED3DPOOL pool, - [in] void *parent, - [in] const struct wined3d_parent_ops *parent_ops, - [out] IWineD3DVolume **volume - ); - HRESULT CreateCubeTexture( - [in] UINT edge_length, - [in] UINT levels, - [in] DWORD usage, - [in] enum wined3d_format_id format_id, - [in] WINED3DPOOL pool, - [in] void *parent, - [in] const struct wined3d_parent_ops *parent_ops, - [out] IWineD3DCubeTexture **texture - ); - HRESULT CreateQuery( - [in] WINED3DQUERYTYPE type, - [out] IWineD3DQuery **query - ); - HRESULT CreateSwapChain( - [in] WINED3DPRESENT_PARAMETERS *present_parameters, - [in] WINED3DSURFTYPE surface_type, - [in] void *parent, - [out] IWineD3DSwapChain **swapchain - ); - HRESULT CreateVertexDeclaration( - [in] const WINED3DVERTEXELEMENT *elements, - [in] UINT element_count, - [in] void *parent, - [in] const struct wined3d_parent_ops *parent_ops, - [out] IWineD3DVertexDeclaration **declaration - ); - HRESULT CreateVertexDeclarationFromFVF( - [in] DWORD fvf, - [in] void *parent, - [in] const struct wined3d_parent_ops *parent_ops, - [out] IWineD3DVertexDeclaration **declaration - ); - HRESULT CreateVertexShader( - [in] const DWORD *function, - [in] const struct wined3d_shader_signature *output_signature, - [in] void *parent, - [in] const struct wined3d_parent_ops *parent_ops, - [out] IWineD3DVertexShader **shader - ); - HRESULT CreateGeometryShader( - [in] const DWORD *byte_code, - [in] const struct wined3d_shader_signature *output_signature, - [in] void *parent, - [in] const struct wined3d_parent_ops *parent_ops, - [out] IWineD3DGeometryShader **shader - ); - HRESULT CreatePixelShader( - [in] const DWORD *function, - [in] const struct wined3d_shader_signature *output_signature, - [in] void *parent, - [in] const struct wined3d_parent_ops *parent_ops, - [out] IWineD3DPixelShader **shader - ); - HRESULT CreatePalette( - [in] DWORD flags, - [in] const PALETTEENTRY *palette_entry, - [in] void *parent, - [out] IWineD3DPalette **palette - ); - HRESULT Init3D( - [in] WINED3DPRESENT_PARAMETERS *present_parameters - ); - HRESULT InitGDI( - [in] WINED3DPRESENT_PARAMETERS *present_parameters - ); - HRESULT Uninit3D( - [in] D3DCB_DESTROYSWAPCHAINFN destroy_swapchain_callback - ); - HRESULT UninitGDI( - [in] D3DCB_DESTROYSWAPCHAINFN destroy_swapchain_callback - ); - void SetMultithreaded( - ); - HRESULT EvictManagedResources( - ); - UINT GetAvailableTextureMem( - ); - HRESULT GetBackBuffer( - [in] UINT swapchain_idx, - [in] UINT backbuffer_idx, - [in] WINED3DBACKBUFFER_TYPE backbuffer_type, - [out] IWineD3DSurface **backbuffer - ); - HRESULT GetCreationParameters( - [out] WINED3DDEVICE_CREATION_PARAMETERS *creation_parameters - ); - HRESULT GetDeviceCaps( - [out] WINED3DCAPS *caps - ); - HRESULT GetDirect3D( - [out] IWineD3D** d3d - ); - HRESULT GetDisplayMode( - [in] UINT swapchain_idx, - [out] WINED3DDISPLAYMODE *mode - ); - HRESULT SetDisplayMode( - [in] UINT swapchain_idx, - [in] const WINED3DDISPLAYMODE *mode - ); - UINT GetNumberOfSwapChains( - ); - HRESULT GetRasterStatus( - [in] UINT swapchain_idx, - [out] WINED3DRASTER_STATUS *raster_status - ); - HRESULT GetSwapChain( - [in] UINT swapchain_idx, - [out] IWineD3DSwapChain **swapchain - ); - HRESULT Reset( - [in] WINED3DPRESENT_PARAMETERS *present_parameters - ); - HRESULT SetDialogBoxMode( - [in] BOOL enable_dialogs - ); - HRESULT SetCursorProperties( - [in] UINT x_hotspot, - [in] UINT y_hotspot, - [in] IWineD3DSurface *cursor_surface - ); - void SetCursorPosition( - [in] int x_screen_space, - [in] int y_screen_space, - [in] DWORD flags - ); - BOOL ShowCursor( - [in] BOOL show - ); - HRESULT SetClipPlane( - [in] DWORD plane_idx, - [in] const float *plane - ); - HRESULT GetClipPlane( - [in] DWORD plane_idx, - [out] float *plane - ); - HRESULT SetClipStatus( - [in] const WINED3DCLIPSTATUS *clip_status - ); - HRESULT GetClipStatus( - [out] WINED3DCLIPSTATUS *clip_status - ); - HRESULT SetCurrentTexturePalette( - [in] UINT palette_number - ); - HRESULT GetCurrentTexturePalette( - [out] UINT *palette_number - ); - HRESULT SetDepthStencilSurface( - [in] IWineD3DSurface *depth_stencil - ); - HRESULT GetDepthStencilSurface( - [out] IWineD3DSurface **depth_stencil - ); - void SetGammaRamp( - [in] UINT swapchain_idx, - [in] DWORD flags, - [in] const WINED3DGAMMARAMP *ramp - ); - void GetGammaRamp( - [in] UINT swapchain_idx, - [out] WINED3DGAMMARAMP *ramp - ); - HRESULT SetIndexBuffer( - [in] IWineD3DBuffer *index_buffer, - [in] enum wined3d_format_id format_id - ); - HRESULT GetIndexBuffer( - [out] IWineD3DBuffer **index_buffer - ); - HRESULT SetBaseVertexIndex( - [in] INT base_index - ); - HRESULT GetBaseVertexIndex( - [out] INT *base_index - ); - HRESULT SetLight( - [in] DWORD light_idx, - [in] const WINED3DLIGHT *light - ); - HRESULT GetLight( - [in] DWORD light_idx, - [out] WINED3DLIGHT *light - ); - HRESULT SetLightEnable( - [in] DWORD light_idx, - [in] BOOL enable - ); - HRESULT GetLightEnable( - [in] DWORD light_idx, - [out] BOOL *enable - ); - HRESULT SetMaterial( - [in] const WINED3DMATERIAL *material - ); - HRESULT GetMaterial( - [out] WINED3DMATERIAL *material - ); - HRESULT SetNPatchMode( - [in] float segments - ); - float GetNPatchMode( - ); - HRESULT SetPaletteEntries( - [in] UINT palette_number, - [in] const PALETTEENTRY *entries - ); - HRESULT GetPaletteEntries( - [in] UINT palette_number, - [out] PALETTEENTRY *entries - ); - HRESULT SetPixelShader( - [in] IWineD3DPixelShader *shader - ); - IWineD3DPixelShader *GetPixelShader( - ); - HRESULT SetPixelShaderConstantB( - [in] UINT start_register, - [in] const BOOL *constants, - [in] UINT bool_count - ); - HRESULT GetPixelShaderConstantB( - [in] UINT start_register, - [out] BOOL *constants, - [in] UINT bool_count - ); - HRESULT SetPixelShaderConstantI( - [in] UINT start_register, - [in] const int *constants, - [in] UINT vector4i_count - ); - HRESULT GetPixelShaderConstantI( - [in] UINT start_register, - [out] int *constants, - [in] UINT vector4i_count - ); - HRESULT SetPixelShaderConstantF( - [in] UINT start_register, - [in] const float *constants, - [in] UINT vector4f_count - ); - HRESULT GetPixelShaderConstantF( - [in] UINT start_register, - [out] float *constants, - [in] UINT vector4f_count - ); - HRESULT SetRenderState( - [in] WINED3DRENDERSTATETYPE state, - [in] DWORD value - ); - HRESULT GetRenderState( - [in] WINED3DRENDERSTATETYPE state, - [out] DWORD *value - ); - HRESULT SetRenderTarget( - [in] DWORD render_target_idx, - [in] IWineD3DSurface *render_target, - [in] BOOL set_viewport - ); - HRESULT GetRenderTarget( - [in] DWORD render_target_idx, - [out] IWineD3DSurface **render_target - ); - HRESULT SetSamplerState( - [in] DWORD sampler_idx, - [in] WINED3DSAMPLERSTATETYPE state, - [in] DWORD value - ); - HRESULT GetSamplerState( - [in] DWORD sampler_idx, - [in] WINED3DSAMPLERSTATETYPE state, - [out] DWORD *value - ); - HRESULT SetScissorRect( - [in] const RECT *rect - ); - HRESULT GetScissorRect( - [out] RECT *rect - ); - HRESULT SetSoftwareVertexProcessing( - [in] BOOL software - ); - BOOL GetSoftwareVertexProcessing( - ); - HRESULT SetStreamSource( - [in] UINT stream_idx, - [in] IWineD3DBuffer *buffer, - [in] UINT offset, - [in] UINT stride - ); - HRESULT GetStreamSource( - [in] UINT stream_idx, - [out] IWineD3DBuffer **buffer, - [out] UINT *offset, - [out] UINT *stride - ); - HRESULT SetStreamSourceFreq( - [in] UINT stream_idx, - [in] UINT divider - ); - HRESULT GetStreamSourceFreq( - [in] UINT stream_idx, - [out] UINT *divider - ); - HRESULT SetTexture( - [in] DWORD stage, - [in] IWineD3DBaseTexture *texture - ); - HRESULT GetTexture( - [in] DWORD stage, - [out] IWineD3DBaseTexture **texture - ); - HRESULT SetTextureStageState( - [in] DWORD stage, - [in] WINED3DTEXTURESTAGESTATETYPE state, - [in] DWORD value - ); - HRESULT GetTextureStageState( - [in] DWORD stage, - [in] WINED3DTEXTURESTAGESTATETYPE state, - [out] DWORD *value - ); - HRESULT SetTransform( - [in] WINED3DTRANSFORMSTATETYPE state, - [in] const WINED3DMATRIX *matrix - ); - HRESULT GetTransform( - [in] WINED3DTRANSFORMSTATETYPE state, - [out] WINED3DMATRIX *matrix - ); - HRESULT SetVertexDeclaration( - [in] IWineD3DVertexDeclaration *declaration - ); - HRESULT GetVertexDeclaration( - [out] IWineD3DVertexDeclaration **declaration - ); - HRESULT SetVertexShader( - [in] IWineD3DVertexShader *shader - ); - IWineD3DVertexShader *GetVertexShader( - ); - HRESULT SetVertexShaderConstantB( - [in] UINT start_register, - [in] const BOOL *constants, - [in] UINT bool_count - ); - HRESULT GetVertexShaderConstantB( - [in] UINT start_register, - [out] BOOL *constants, - [in] UINT bool_count - ); - HRESULT SetVertexShaderConstantI( - [in] UINT start_register, - [in] const int *constants, - [in] UINT vector4i_count - ); - HRESULT GetVertexShaderConstantI( - [in] UINT start_register, - [out] int *constants, - [in] UINT vector4i_count - ); - HRESULT SetVertexShaderConstantF( - [in] UINT start_register, - [in] const float *constants, - [in] UINT vector4f_count - ); - HRESULT GetVertexShaderConstantF( - [in] UINT start_register, - [out] float *constants, - [in] UINT vector4f_count - ); - HRESULT SetViewport( - [in] const WINED3DVIEWPORT *viewport - ); - HRESULT GetViewport( - [out] WINED3DVIEWPORT *viewport - ); - HRESULT MultiplyTransform( - [in] WINED3DTRANSFORMSTATETYPE state, - [in] const WINED3DMATRIX *matrix - ); - HRESULT ValidateDevice( - [out] DWORD *num_passes - ); - HRESULT ProcessVertices( - [in] UINT src_start_idx, - [in] UINT dst_idx, - [in] UINT vertex_count, - [in] IWineD3DBuffer *dest_buffer, - [in] IWineD3DVertexDeclaration *declaration, - [in] DWORD flags, - [in] DWORD DestFVF - ); - HRESULT BeginStateBlock( - ); - HRESULT EndStateBlock( - [out] IWineD3DStateBlock **stateblock - ); - HRESULT BeginScene( - ); - HRESULT EndScene( - ); - HRESULT Present( - [in] const RECT *src_rect, - [in] const RECT *dst_rect, - [in] HWND dst_window_override, - [in] const RGNDATA *dirty_region - ); - HRESULT Clear( - [in] DWORD rect_count, - [in] const RECT *rects, - [in] DWORD flags, - [in] WINED3DCOLOR color, - [in] float z, - [in] DWORD stencil - ); - void ClearRendertargetView( - [in] IWineD3DRendertargetView *rendertarget_view, - [in] const WINED3DCOLORVALUE *color - ); - void SetPrimitiveType( - [in] WINED3DPRIMITIVETYPE primitive_topology - ); - void GetPrimitiveType( - [out] WINED3DPRIMITIVETYPE *primitive_topology - ); - HRESULT DrawPrimitive( - [in] UINT start_vertex, - [in] UINT vertex_count - ); - HRESULT DrawIndexedPrimitive( - [in] UINT start_idx, - [in] UINT index_count - ); - HRESULT DrawPrimitiveUP( - [in] UINT vertex_count, - [in] const void *stream_data, - [in] UINT stream_stride - ); - HRESULT DrawIndexedPrimitiveUP( - [in] UINT index_count, - [in] const void *index_data, - [in] enum wined3d_format_id index_data_format_id, - [in] const void *stream_data, - [in] UINT stream_stride - ); - HRESULT DrawPrimitiveStrided( - [in] UINT vertex_count, - [in] const WineDirect3DVertexStridedData *strided_data - ); - HRESULT DrawIndexedPrimitiveStrided( - [in] UINT index_count, - [in] const WineDirect3DVertexStridedData *strided_data, - [in] UINT vertex_count, - [in] const void *index_data, - [in] enum wined3d_format_id index_data_format_id - ); - HRESULT DrawRectPatch( - [in] UINT handle, - [in] const float *num_segs, - [in] const WINED3DRECTPATCH_INFO *rect_patch_info - ); - HRESULT DrawTriPatch( - [in] UINT handle, - [in] const float *num_segs, - [in] const WINED3DTRIPATCH_INFO *tri_patch_info - ); - HRESULT DeletePatch( - [in] UINT handle - ); - HRESULT ColorFill( - [in] IWineD3DSurface *surface, - [in] const RECT *rect, - [in] const WINED3DCOLORVALUE *color - ); - HRESULT UpdateTexture( - [in] IWineD3DBaseTexture *src_texture, - [in] IWineD3DBaseTexture *dst_texture - ); - HRESULT UpdateSurface( - [in] IWineD3DSurface *src_surface, - [in] const RECT *src_rect, - [in] IWineD3DSurface *dst_surface, - [in] const POINT *dst_point - ); - HRESULT GetFrontBufferData( - [in] UINT swapchain_idx, - [in] IWineD3DSurface *dst_surface - ); - HRESULT EnumResources( - [in] D3DCB_ENUMRESOURCES callback, - [in] void *data - ); - HRESULT GetSurfaceFromDC( - [in] HDC dc, - [out] IWineD3DSurface **surface - ); - HRESULT AcquireFocusWindow( - [in] HWND window - ); - void ReleaseFocusWindow( - ); -} - -#ifdef __midl -IWineD3D * __stdcall WineDirect3DCreate(UINT dxVersion, void *parent); -IWineD3DClipper * __stdcall WineDirect3DCreateClipper(void); -void __stdcall wined3d_mutex_lock(void); -void __stdcall wined3d_mutex_unlock(void); -#else -IWineD3D *WineDirect3DCreate(UINT dxVersion, void *parent); -IWineD3DClipper *WineDirect3DCreateClipper(void); -void wined3d_mutex_lock(void); -void wined3d_mutex_unlock(void); -#endif - diff --git a/include/reactos/wine/wineheaders.rbuild b/include/reactos/wine/wineheaders.rbuild index e299181b900..8b9a00e3855 100644 --- a/include/reactos/wine/wineheaders.rbuild +++ b/include/reactos/wine/wineheaders.rbuild @@ -2,5 +2,4 @@ itss.idl - wined3d.idl diff --git a/include/xdk/amd64/ke.h b/include/xdk/amd64/ke.h index f63add4d7b6..3eaee6fd400 100644 --- a/include/xdk/amd64/ke.h +++ b/include/xdk/amd64/ke.h @@ -45,6 +45,22 @@ typedef XSAVE_FORMAT XMM_SAVE_AREA32, *PXMM_SAVE_AREA32; #define KeGetDcacheFillSize() 1L #define YieldProcessor _mm_pause +#define FastFence __faststorefence +#define LoadFence _mm_lfence +#define MemoryFence _mm_mfence +#define StoreFence _mm_sfence +#define LFENCE_ACQUIRE() LoadFence() + +FORCEINLINE +VOID +KeMemoryBarrier(VOID) +{ + // FIXME: Do we really need lfence after the __faststorefence ? + FastFence(); + LFENCE_ACQUIRE(); +} + +#define KeMemoryBarrierWithoutFence() _ReadWriteBarrier() FORCEINLINE KIRQL diff --git a/include/xdk/exfuncs.h b/include/xdk/exfuncs.h index 433909c0af2..4c3dd7dc890 100644 --- a/include/xdk/exfuncs.h +++ b/include/xdk/exfuncs.h @@ -131,14 +131,14 @@ ExInterlockedFlushSList( #if defined(_WIN2K_COMPAT_SLIST_USAGE) && defined(_X86_) NTKERNELAPI -PSINGLE_LIST_ENTRY +PSINGLE_LIST_ENTRY FASTCALL ExInterlockedPopEntrySList( IN PSLIST_HEADER ListHead, IN PKSPIN_LOCK Lock); NTKERNELAPI -PSINGLE_LIST_ENTRY +PSINGLE_LIST_ENTRY FASTCALL ExInterlockedPushEntrySList( IN PSLIST_HEADER ListHead, diff --git a/include/xdk/kefuncs.h b/include/xdk/kefuncs.h index a61f28617ba..7574f4c0b6d 100644 --- a/include/xdk/kefuncs.h +++ b/include/xdk/kefuncs.h @@ -161,7 +161,7 @@ KeQuerySystemTime( OUT PLARGE_INTEGER CurrentTime); #endif /* !_M_AMD64 */ -#if !defined(_X86_) +#if !defined(_X86_) && !defined(_M_ARM) NTKERNELAPI KIRQL NTAPI diff --git a/include/xdk/ketypes.h b/include/xdk/ketypes.h index 86046749953..1d06cc87593 100644 --- a/include/xdk/ketypes.h +++ b/include/xdk/ketypes.h @@ -640,11 +640,12 @@ typedef enum _KSPIN_LOCK_QUEUE_NUMBER { #endif /* defined(_AMD64_) */ typedef VOID -(NTAPI *PKDEFERRED_ROUTINE)( +(NTAPI KDEFERRED_ROUTINE)( IN struct _KDPC *Dpc, IN PVOID DeferredContext OPTIONAL, IN PVOID SystemArgument1 OPTIONAL, IN PVOID SystemArgument2 OPTIONAL); +typedef KDEFERRED_ROUTINE *PKDEFERRED_ROUTINE; typedef enum _KDPC_IMPORTANCE { LowImportance, @@ -1017,7 +1018,7 @@ typedef VOID typedef enum _TIMER_SET_INFORMATION_CLASS { TimerSetCoalescableTimer, - MaxTimerInfoClass + MaxTimerInfoClass } TIMER_SET_INFORMATION_CLASS; #if (NTDDI_VERSION >= NTDDI_WIN7) diff --git a/include/xdk/mmfuncs.h b/include/xdk/mmfuncs.h index f3a0cea81c2..02902e33eab 100644 --- a/include/xdk/mmfuncs.h +++ b/include/xdk/mmfuncs.h @@ -118,6 +118,7 @@ $if (_WDMDDK_) ((PVOID) ((PCHAR) ((_Mdl)->StartVa) + (_Mdl)->ByteOffset)) #define MmGetProcedureAddress(Address) (Address) +#define MmLockPagableCodeSection(Address) MmLockPagableDataSection(Address) /* PVOID MmGetSystemAddressForMdl( * IN PMDL Mdl); diff --git a/include/xdk/rtltypes.h b/include/xdk/rtltypes.h index 797382cb1f0..abe3d1235e0 100644 --- a/include/xdk/rtltypes.h +++ b/include/xdk/rtltypes.h @@ -246,26 +246,30 @@ typedef enum _RTL_GENERIC_COMPARE_RESULTS { struct _RTL_AVL_TABLE; typedef RTL_GENERIC_COMPARE_RESULTS -(NTAPI *PRTL_AVL_COMPARE_ROUTINE) ( +(NTAPI RTL_AVL_COMPARE_ROUTINE) ( IN struct _RTL_AVL_TABLE *Table, IN PVOID FirstStruct, IN PVOID SecondStruct); +typedef RTL_AVL_COMPARE_ROUTINE *PRTL_AVL_COMPARE_ROUTINE; typedef PVOID -(NTAPI *PRTL_AVL_ALLOCATE_ROUTINE) ( +(NTAPI RTL_AVL_ALLOCATE_ROUTINE) ( IN struct _RTL_AVL_TABLE *Table, IN CLONG ByteSize); +typedef RTL_AVL_ALLOCATE_ROUTINE *PRTL_AVL_ALLOCATE_ROUTINE; typedef VOID -(NTAPI *PRTL_AVL_FREE_ROUTINE) ( +(NTAPI RTL_AVL_FREE_ROUTINE) ( IN struct _RTL_AVL_TABLE *Table, IN PVOID Buffer); +typedef RTL_AVL_FREE_ROUTINE *PRTL_AVL_FREE_ROUTINE; typedef NTSTATUS -(NTAPI *PRTL_AVL_MATCH_FUNCTION) ( +(NTAPI RTL_AVL_MATCH_FUNCTION) ( IN struct _RTL_AVL_TABLE *Table, IN PVOID UserData, IN PVOID MatchData); +typedef RTL_AVL_MATCH_FUNCTION *PRTL_AVL_MATCH_FUNCTION; typedef struct _RTL_BALANCED_LINKS { struct _RTL_BALANCED_LINKS *Parent; @@ -289,32 +293,35 @@ typedef struct _RTL_AVL_TABLE { PVOID TableContext; } RTL_AVL_TABLE, *PRTL_AVL_TABLE; -#ifndef RTL_USE_AVL_TABLES - -struct _RTL_GENERIC_TABLE; - -typedef RTL_GENERIC_COMPARE_RESULTS -(NTAPI *PRTL_GENERIC_COMPARE_ROUTINE) ( - IN struct _RTL_GENERIC_TABLE *Table, - IN PVOID FirstStruct, - IN PVOID SecondStruct); - -typedef PVOID -(NTAPI *PRTL_GENERIC_ALLOCATE_ROUTINE) ( - IN struct _RTL_GENERIC_TABLE *Table, - IN CLONG ByteSize); - -typedef VOID -(NTAPI *PRTL_GENERIC_FREE_ROUTINE) ( - IN struct _RTL_GENERIC_TABLE *Table, - IN PVOID Buffer); - typedef struct _RTL_SPLAY_LINKS { struct _RTL_SPLAY_LINKS *Parent; struct _RTL_SPLAY_LINKS *LeftChild; struct _RTL_SPLAY_LINKS *RightChild; } RTL_SPLAY_LINKS, *PRTL_SPLAY_LINKS; +#ifndef RTL_USE_AVL_TABLES + +struct _RTL_GENERIC_TABLE; + +typedef RTL_GENERIC_COMPARE_RESULTS +(NTAPI RTL_GENERIC_COMPARE_ROUTINE) ( + IN struct _RTL_GENERIC_TABLE *Table, + IN PVOID FirstStruct, + IN PVOID SecondStruct); +typedef RTL_GENERIC_COMPARE_ROUTINE *PRTL_GENERIC_COMPARE_ROUTINE; + +typedef PVOID +(NTAPI RTL_GENERIC_ALLOCATE_ROUTINE) ( + IN struct _RTL_GENERIC_TABLE *Table, + IN CLONG ByteSize); +typedef RTL_GENERIC_ALLOCATE_ROUTINE *PRTL_GENERIC_ALLOCATE_ROUTINE; + +typedef VOID +(NTAPI RTL_GENERIC_FREE_ROUTINE) ( + IN struct _RTL_GENERIC_TABLE *Table, + IN PVOID Buffer); +typedef RTL_GENERIC_FREE_ROUTINE *PRTL_GENERIC_FREE_ROUTINE; + typedef struct _RTL_GENERIC_TABLE { PRTL_SPLAY_LINKS TableRoot; LIST_ENTRY InsertOrderList; @@ -331,23 +338,23 @@ typedef struct _RTL_GENERIC_TABLE { #ifdef RTL_USE_AVL_TABLES +#undef RTL_GENERIC_COMPARE_ROUTINE #undef PRTL_GENERIC_COMPARE_ROUTINE -#undef RTL_GENERIC_COMPARE_ROUTINE +#undef RTL_GENERIC_ALLOCATE_ROUTINE #undef PRTL_GENERIC_ALLOCATE_ROUTINE -#undef RTL_GENERIC_ALLOCATE_ROUTINE +#undef RTL_GENERIC_FREE_ROUTINE #undef PRTL_GENERIC_FREE_ROUTINE -#undef RTL_GENERIC_FREE_ROUTINE -#undef RTL_GENERIC_TABLE +#undef RTL_GENERIC_TABLE #undef PRTL_GENERIC_TABLE -#define PRTL_GENERIC_COMPARE_ROUTINE PRTL_AVL_COMPARE_ROUTINE -#define RTL_GENERIC_COMPARE_ROUTINE RTL_AVL_COMPARE_ROUTINE -#define PRTL_GENERIC_ALLOCATE_ROUTINE PRTL_AVL_ALLOCATE_ROUTINE -#define RTL_GENERIC_ALLOCATE_ROUTINE RTL_AVL_ALLOCATE_ROUTINE -#define PRTL_GENERIC_FREE_ROUTINE PRTL_AVL_FREE_ROUTINE -#define RTL_GENERIC_FREE_ROUTINE RTL_AVL_FREE_ROUTINE -#define RTL_GENERIC_TABLE RTL_AVL_TABLE -#define PRTL_GENERIC_TABLE PRTL_AVL_TABLE +#define RTL_GENERIC_COMPARE_ROUTINE RTL_AVL_COMPARE_ROUTINE +#define PRTL_GENERIC_COMPARE_ROUTINE PRTL_AVL_COMPARE_ROUTINE +#define RTL_GENERIC_ALLOCATE_ROUTINE RTL_AVL_ALLOCATE_ROUTINE +#define PRTL_GENERIC_ALLOCATE_ROUTINE PRTL_AVL_ALLOCATE_ROUTINE +#define RTL_GENERIC_FREE_ROUTINE RTL_AVL_FREE_ROUTINE +#define PRTL_GENERIC_FREE_ROUTINE PRTL_AVL_FREE_ROUTINE +#define RTL_GENERIC_TABLE RTL_AVL_TABLE +#define PRTL_GENERIC_TABLE PRTL_AVL_TABLE #endif /* RTL_USE_AVL_TABLES */ diff --git a/include/xdk/wdm.template.h b/include/xdk/wdm.template.h index 19fc2f237a8..94e21e6c96d 100644 --- a/include/xdk/wdm.template.h +++ b/include/xdk/wdm.template.h @@ -170,7 +170,7 @@ typedef struct _DMA_ADAPTER *PADAPTER_OBJECT; #elif defined(_WDM_INCLUDED_) typedef struct _DMA_ADAPTER *PADAPTER_OBJECT; #else -typedef struct _ADAPTER_OBJECT *PADAPTER_OBJECT; +typedef struct _ADAPTER_OBJECT *PADAPTER_OBJECT; #endif #ifndef DEFINE_GUIDEX @@ -191,7 +191,7 @@ typedef struct _ADAPTER_OBJECT *PADAPTER_OBJECT; #ifdef __cplusplus inline int IsEqualGUIDAligned(REFGUID guid1, REFGUID guid2) { - return ( (*(PLONGLONG)(&guid1) == *(PLONGLONG)(&guid2)) && + return ( (*(PLONGLONG)(&guid1) == *(PLONGLONG)(&guid2)) && (*((PLONGLONG)(&guid1) + 1) == *((PLONGLONG)(&guid2) + 1)) ); } #else diff --git a/include/xdk/x86/ke.h b/include/xdk/x86/ke.h index 96743803284..003d560044a 100644 --- a/include/xdk/x86/ke.h +++ b/include/xdk/x86/ke.h @@ -59,6 +59,8 @@ KeMemoryBarrier(VOID) #endif } +#define KeMemoryBarrierWithoutFence() _ReadWriteBarrier() + NTHALAPI KIRQL NTAPI diff --git a/lib/3rdparty/bzip2/CMakeLists.txt b/lib/3rdparty/bzip2/CMakeLists.txt index ee76113cfc4..a3624108d97 100644 --- a/lib/3rdparty/bzip2/CMakeLists.txt +++ b/lib/3rdparty/bzip2/CMakeLists.txt @@ -16,5 +16,6 @@ add_library(bzip2 SHARED ${SOURCE}) set_module_type(bzip2 kernelmodedriver) add_importlibs(bzip2 ntoskrnl) +target_link_libraries(bzip2 libcntpr) set_target_properties(bzip2 PROPERTIES OUTPUT_NAME "unbzip2") diff --git a/lib/3rdparty/freetype/CMakeLists.txt b/lib/3rdparty/freetype/CMakeLists.txt index 578f46dc8e0..35ad946b1e2 100644 --- a/lib/3rdparty/freetype/CMakeLists.txt +++ b/lib/3rdparty/freetype/CMakeLists.txt @@ -1,8 +1,7 @@ add_definitions( -D__NTDRIVER__ - -DFT2_BUILD_LIBRARY - -DTT_CONFIG_OPTION_BYTECODE_INTERPRETER) + -DFT2_BUILD_LIBRARY) include_directories(include) diff --git a/lib/3rdparty/fullfat/CMakeLists.txt b/lib/3rdparty/fullfat/CMakeLists.txt index 657abdd3bb4..a25ae581a36 100644 --- a/lib/3rdparty/fullfat/CMakeLists.txt +++ b/lib/3rdparty/fullfat/CMakeLists.txt @@ -18,3 +18,5 @@ list(APPEND SOURCE ff_time.c) add_library(fullfat ${SOURCE}) + +add_dependencies(fullfat bugcodes) diff --git a/lib/3rdparty/libsamplerate/CMakeLists.txt b/lib/3rdparty/libsamplerate/CMakeLists.txt index d1864e1f763..136ae5c8668 100644 --- a/lib/3rdparty/libsamplerate/CMakeLists.txt +++ b/lib/3rdparty/libsamplerate/CMakeLists.txt @@ -6,4 +6,4 @@ list(APPEND SOURCE src_zoh.c) add_library(libsamplerate ${SOURCE}) -add_dependencies(libsamplerate psdk) \ No newline at end of file +add_dependencies(libsamplerate psdk) diff --git a/lib/3rdparty/libsamplerate/src_linear.c b/lib/3rdparty/libsamplerate/src_linear.c index f97ba45db22..ab483bc4450 100644 --- a/lib/3rdparty/libsamplerate/src_linear.c +++ b/lib/3rdparty/libsamplerate/src_linear.c @@ -30,6 +30,9 @@ #include "float_cast.h" #include "common.h" +#include +#include + static int linear_vari_process (SRC_PRIVATE *psrc, SRC_DATA *data) ; static void linear_reset (SRC_PRIVATE *psrc) ; @@ -107,8 +110,8 @@ linear_vari_process (SRC_PRIVATE *psrc, SRC_DATA *data) src_ratio = psrc->last_ratio + priv->out_gen * (data->src_ratio - psrc->last_ratio) / priv->out_count ; if (SRC_DEBUG && priv->in_used < priv->channels && input_index < 1.0) - { printf ("Whoops!!!! in_used : %ld channels : %d input_index : %f\n", priv->in_used, priv->channels, input_index) ; - exit (1) ; + { DPRINT1 ("Whoops!!!! in_used : %ld channels : %d input_index : %f\n", priv->in_used, priv->channels, input_index) ; + ASSERT (0) ; } ; for (ch = 0 ; ch < priv->channels ; ch++) diff --git a/lib/3rdparty/libwine/CMakeLists.txt b/lib/3rdparty/libwine/CMakeLists.txt index 1a243a2da2a..6450dd2b03b 100644 --- a/lib/3rdparty/libwine/CMakeLists.txt +++ b/lib/3rdparty/libwine/CMakeLists.txt @@ -6,7 +6,8 @@ list(APPEND SOURCE config.c debug_ros.c loader.c - string.c) +# string.c implements _stricmp, already shipped with crt +) add_library(wine ${SOURCE}) diff --git a/lib/3rdparty/libwine/libwine.rbuild b/lib/3rdparty/libwine/libwine.rbuild index 3b139cf79ca..d95c7c2b9bb 100644 --- a/lib/3rdparty/libwine/libwine.rbuild +++ b/lib/3rdparty/libwine/libwine.rbuild @@ -7,7 +7,7 @@ config.c debug_ros.c loader.c - string.c + include/reactos/wine diff --git a/lib/3rdparty/libxml2/CMakeLists.txt b/lib/3rdparty/libxml2/CMakeLists.txt index e8c3ea20a95..39ed9e74ab1 100644 --- a/lib/3rdparty/libxml2/CMakeLists.txt +++ b/lib/3rdparty/libxml2/CMakeLists.txt @@ -1,7 +1,5 @@ -include_directories( - . - include) +include_directories(include) add_definitions( -D__MINGW32__ diff --git a/lib/3rdparty/mingw/tlssup.c b/lib/3rdparty/mingw/tlssup.c index 1c32d0d62a6..70fdc6ba224 100644 --- a/lib/3rdparty/mingw/tlssup.c +++ b/lib/3rdparty/mingw/tlssup.c @@ -99,6 +99,7 @@ BOOL WINAPI __dyn_tls_init (HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved) { _PVFV *pfunc; + uintptr_t ps; #ifndef _WIN64 if (_winmajor < 4) @@ -135,8 +136,11 @@ __dyn_tls_init (HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved) return TRUE; } - for (pfunc = &__xd_a + 1; pfunc != &__xd_z; ++pfunc) + ps = (uintptr_t) &__xd_a; + ps += sizeof (uintptr_t); + for ( ; ps != (uintptr_t) &__xd_z; ps += sizeof (uintptr_t)) { + pfunc = (_PVFV *) ps; if (*pfunc != NULL) (*pfunc)(); } diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 6cfd4567c4a..e0064c0b596 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -24,7 +24,6 @@ add_subdirectory(tdilib) else() -add_subdirectory(host/wcsfuncs) add_subdirectory(3rdparty/zlib) endif() diff --git a/lib/atl/atlcom.h b/lib/atl/atlcom.h index cc0b8737ca8..f4a13e5540c 100644 --- a/lib/atl/atlcom.h +++ b/lib/atl/atlcom.h @@ -321,7 +321,7 @@ public: \ typedef x _ComMapClass; \ HRESULT _InternalQueryInterface(REFIID iid, void **ppvObject) \ { \ - return InternalQueryInterface(this, _GetEntries(), iid, ppvObject); \ + return this->InternalQueryInterface(this, _GetEntries(), iid, ppvObject); \ } \ const static ATL::_ATL_INTMAP_ENTRY *WINAPI _GetEntries() \ { \ diff --git a/lib/atl/atlwin.h b/lib/atl/atlwin.h index 3d4b344018e..fa5550e38c8 100644 --- a/lib/atl/atlwin.h +++ b/lib/atl/atlwin.h @@ -24,7 +24,7 @@ #define GCCU(x) x __attribute__((unused)) #define Unused(x) #else -#define GCCU(x) +#define GCCU(x) (x) #define Unused(x) (x); #endif // __GNUC__ diff --git a/lib/cmlib/CMakeLists.txt b/lib/cmlib/CMakeLists.txt index 0de4e4de151..707707b28a2 100644 --- a/lib/cmlib/CMakeLists.txt +++ b/lib/cmlib/CMakeLists.txt @@ -15,9 +15,9 @@ list(APPEND SOURCE if(CMAKE_CROSSCOMPILING) add_library(cmlib ${SOURCE}) add_dependencies(cmlib bugcodes) + add_pch(cmlib cmlib.h) else() add_definitions( - -DWINE_UNICODE_API= -D__NO_CTYPE_INLINES -DCMLIB_HOST) add_library(cmlibhost ${SOURCE}) diff --git a/lib/cmlib/cmdata.h b/lib/cmlib/cmdata.h index 61629c6398a..bce6e2aa80f 100644 --- a/lib/cmlib/cmdata.h +++ b/lib/cmlib/cmdata.h @@ -46,11 +46,7 @@ // #define VALUE_COMP_NAME 0x0001 -#ifdef CMLIB_HOST -#include -#else #include -#endif // // For memory-mapped Hives @@ -154,11 +150,7 @@ typedef struct _CM_KEY_SECURITY UCHAR Data[ANYSIZE_ARRAY]; } CM_KEY_SECURITY, *PCM_KEY_SECURITY; -#ifdef CMLIB_HOST -#include -#else #include -#endif // // Generic Index Entry diff --git a/lib/cmlib/cmlib.h b/lib/cmlib/cmlib.h index e472fd35c4f..5a4abbfeff9 100644 --- a/lib/cmlib/cmlib.h +++ b/lib/cmlib/cmlib.h @@ -5,16 +5,13 @@ * Copyright 2001 - 2005 Eric Kohl */ -#pragma once - // // Debug support switch // #define _CMLIB_DEBUG_ 1 #ifdef CMLIB_HOST - #include - #include + #include #include #include @@ -69,9 +66,6 @@ #define PWORK_QUEUE_ITEM PVOID #define EX_PUSH_LOCK PULONG_PTR - /* For */ - #define USE_HOST_WCSFUNCS - #define CMLTRACE(x, ...) #else // @@ -89,12 +83,14 @@ #endif #include - #undef DECLSPEC_IMPORT - #define DECLSPEC_IMPORT #include + + /* Prevent inclusion of Windows headers through */ + #define _WINDEF_ + #define _WINBASE_ + #define _WINNLS_ #endif -#include // // These define the Debug Masks Supported @@ -121,6 +117,7 @@ #define CMAPI NTAPI +#include #include #include "hivedata.h" #include "cmdata.h" @@ -311,8 +308,8 @@ CmCreateRootNode( VOID CMAPI CmPrepareHive( PHHIVE RegistryHive); - - + + BOOLEAN CMAPI HvTrackCellRef( diff --git a/lib/cmlib/cmlib.rbuild b/lib/cmlib/cmlib.rbuild index ab81a0256a2..889ec2f3e4c 100644 --- a/lib/cmlib/cmlib.rbuild +++ b/lib/cmlib/cmlib.rbuild @@ -12,10 +12,9 @@ hiveinit.c hivesum.c hivewrt.c + cmlib.h - " " - . diff --git a/lib/cmlib/hivedata.h b/lib/cmlib/hivedata.h index 7bd8845048d..b15c92636cf 100644 --- a/lib/cmlib/hivedata.h +++ b/lib/cmlib/hivedata.h @@ -100,11 +100,7 @@ typedef enum Volatile = 1 } HSTORAGE_TYPE; -#ifdef CMLIB_HOST -#include -#else #include -#endif /** * @name HBASE_BLOCK @@ -188,11 +184,7 @@ typedef struct _HCELL LONG Size; } HCELL, *PHCELL; -#ifdef CMLIB_HOST -#include -#else #include -#endif struct _HHIVE; diff --git a/lib/dnslib/CMakeLists.txt b/lib/dnslib/CMakeLists.txt index f726f758e17..eae9061928a 100644 --- a/lib/dnslib/CMakeLists.txt +++ b/lib/dnslib/CMakeLists.txt @@ -23,4 +23,5 @@ list(APPEND SOURCE utf8.c) add_library(dnslib ${SOURCE}) -add_dependencies(dnslib psdk) \ No newline at end of file +add_pch(dnslib inc/precomp.h) +add_dependencies(dnslib psdk) diff --git a/lib/dnslib/dnslib.rbuild b/lib/dnslib/dnslib.rbuild index 6186055c04f..c3862364894 100644 --- a/lib/dnslib/dnslib.rbuild +++ b/lib/dnslib/dnslib.rbuild @@ -19,4 +19,7 @@ string.c table.c utf8.c + + precomp.h + diff --git a/lib/drivers/CMakeLists.txt b/lib/drivers/CMakeLists.txt index 72024e812df..1d1e3812b84 100644 --- a/lib/drivers/CMakeLists.txt +++ b/lib/drivers/CMakeLists.txt @@ -2,5 +2,5 @@ add_subdirectory(chew) add_subdirectory(csq) add_subdirectory(ip) -add_subdirectory(oskittcp) +add_subdirectory(lwip) add_subdirectory(sound) diff --git a/lib/drivers/directory.rbuild b/lib/drivers/directory.rbuild index 3f84d4447ea..2c0c011058a 100644 --- a/lib/drivers/directory.rbuild +++ b/lib/drivers/directory.rbuild @@ -7,8 +7,8 @@ - - + + diff --git a/lib/drivers/ip/CMakeLists.txt b/lib/drivers/ip/CMakeLists.txt index fbdb2d1b099..eb480c75804 100644 --- a/lib/drivers/ip/CMakeLists.txt +++ b/lib/drivers/ip/CMakeLists.txt @@ -3,7 +3,8 @@ add_definitions(-D__NTDRIVER__) include_directories( BEFORE ${REACTOS_SOURCE_DIR}/drivers/network/tcpip/include - ${REACTOS_SOURCE_DIR}/lib/drivers/oskittcp/include) + ${REACTOS_SOURCE_DIR}/lib/drivers/lwip/src/include + ${REACTOS_SOURCE_DIR}/lib/drivers/lwip/src/include/ipv4) if(ARCH MATCHES i386) list(APPEND SOURCE network/i386/checksum.S) @@ -32,4 +33,5 @@ list(APPEND SOURCE transport/udp/udp.c) add_library(ip ${SOURCE}) +add_pch(ip precomp.h) add_dependencies(ip bugcodes) diff --git a/lib/drivers/ip/ip.rbuild b/lib/drivers/ip/ip.rbuild index 6a3e5500c30..3eea383a897 100644 --- a/lib/drivers/ip/ip.rbuild +++ b/lib/drivers/ip/ip.rbuild @@ -3,7 +3,8 @@ include - include + src/include + src/include/ipv4 @@ -41,4 +42,5 @@ udp.c + precomp.h diff --git a/lib/drivers/ip/network/icmp.c b/lib/drivers/ip/network/icmp.c index 4f1ee993ec0..708381ff4bf 100644 --- a/lib/drivers/ip/network/icmp.c +++ b/lib/drivers/ip/network/icmp.c @@ -228,6 +228,8 @@ NTSTATUS ICMPSendDatagram( FreeNdisPacket(Packet.NdisPacket); return Status; } + + *DataUsed = DataSize; TI_DbgPrint(MID_TRACE,("Leaving\n")); diff --git a/lib/drivers/ip/network/ip.c b/lib/drivers/ip/network/ip.c index e0b969f7ee0..72998e5c663 100644 --- a/lib/drivers/ip/network/ip.c +++ b/lib/drivers/ip/network/ip.c @@ -10,6 +10,9 @@ #include "precomp.h" +#define __LWIP_INET_H__ +#include "lwip/netifapi.h" + LIST_ENTRY InterfaceListHead; KSPIN_LOCK InterfaceListLock; @@ -21,6 +24,12 @@ BOOLEAN IpWorkItemQueued = FALSE; IP_PROTOCOL_HANDLER ProtocolTable[IP_PROTOCOL_TABLE_SIZE]; +VOID +TCPRegisterInterface(PIP_INTERFACE IF); + +VOID +TCPUnregisterInterface(PIP_INTERFACE IF); + VOID DontFreePacket( PVOID Object) /* @@ -174,13 +183,14 @@ PIP_INTERFACE IPCreateInterface( TcpipInitializeSpinLock(&IF->Lock); - IF->TCPContext = ExAllocatePoolWithTag - ( NonPagedPool, sizeof(OSK_IFADDR) + 3 * sizeof( struct sockaddr_in ), - OSKITTCP_CONTEXT_TAG ); + IF->TCPContext = ExAllocatePool + ( NonPagedPool, sizeof(struct netif)); if (!IF->TCPContext) { ExFreePoolWithTag(IF, IP_INTERFACE_TAG); return NULL; } + + TCPRegisterInterface(IF); #ifdef __NTDRIVER__ InsertTDIInterfaceEntity( IF ); @@ -203,8 +213,10 @@ VOID IPDestroyInterface( #ifdef __NTDRIVER__ RemoveTDIInterfaceEntity( IF ); #endif + + TCPUnregisterInterface(IF); - ExFreePoolWithTag(IF->TCPContext, OSKITTCP_CONTEXT_TAG); + ExFreePool(IF->TCPContext); ExFreePoolWithTag(IF, IP_INTERFACE_TAG); } @@ -231,6 +243,8 @@ VOID IPAddInterfaceRoute( PIP_INTERFACE IF ) { * other computers */ if (IF != Loopback) ARPTransmit(NULL, NULL, IF); + + TCPUpdateInterfaceIPInformation(IF); } BOOLEAN IPRegisterInterface( @@ -265,6 +279,11 @@ BOOLEAN IPRegisterInterface( IF->Index = ChosenIndex; + if (!AddrIsUnspecified(&IF->Unicast)) + { + IPAddInterfaceRoute(IF); + } + /* Add interface to the global interface list */ TcpipInterlockedInsertTailList(&InterfaceListHead, &IF->ListEntry, diff --git a/lib/drivers/ip/network/loopback.c b/lib/drivers/ip/network/loopback.c index 18054bcf50e..489f23f7722 100644 --- a/lib/drivers/ip/network/loopback.c +++ b/lib/drivers/ip/network/loopback.c @@ -125,7 +125,6 @@ NDIS_STATUS LoopRegisterAdapter( AddrInitIPv4(&Loopback->Broadcast, LOOPBACK_BCASTADDR_IPv4); IPRegisterInterface(Loopback); - IPAddInterfaceRoute(Loopback); TI_DbgPrint(MAX_TRACE, ("Leaving.\n")); diff --git a/lib/drivers/ip/network/receive.c b/lib/drivers/ip/network/receive.c index a7908ef6460..47520685c58 100644 --- a/lib/drivers/ip/network/receive.c +++ b/lib/drivers/ip/network/receive.c @@ -293,6 +293,9 @@ VOID ProcessFragment( TI_DbgPrint(DEBUG_IP, ("Continueing assembly.\n")); /* We have a reassembly structure */ TcpipAcquireSpinLock(&IPDR->Lock, &OldIrql); + + /* Reset the timeout since we received a fragment */ + IPDR->TimeoutCount = 0; } else { TI_DbgPrint(DEBUG_IP, ("Starting new assembly.\n")); diff --git a/lib/drivers/ip/network/routines.c b/lib/drivers/ip/network/routines.c index 44aa2761076..db32eee6207 100644 --- a/lib/drivers/ip/network/routines.c +++ b/lib/drivers/ip/network/routines.c @@ -54,79 +54,6 @@ static VOID DisplayIPHeader( ((IPHeader->DstAddr >> 16) & 0xFF), ((IPHeader->DstAddr >> 24) & 0xFF)); } -static VOID DisplayTCPHeader( - PCHAR Header, - UINT Length) -{ - /* FIXME: IPv4 only */ - PIPv4_HEADER IPHeader = (PIPv4_HEADER)Header; - PTCPv4_HEADER TCPHeader; - - if (IPHeader->Protocol != IPPROTO_TCP) { - DbgPrint("This is not a TCP datagram. Protocol is %d\n", IPHeader->Protocol); - return; - } - - TCPHeader = (PTCPv4_HEADER)((PCHAR)IPHeader + (IPHeader->VerIHL & 0x0F) * 4); - - DbgPrint("TCP header:\n"); - DbgPrint(" SourcePort: %d\n", WN2H(TCPHeader->SourcePort)); - DbgPrint(" DestinationPort: %d\n", WN2H(TCPHeader->DestinationPort)); - DbgPrint(" SequenceNumber: 0x%x\n", DN2H(TCPHeader->SequenceNumber)); - DbgPrint(" AckNumber: 0x%x\n", DN2H(TCPHeader->AckNumber)); - DbgPrint(" DataOffset: 0x%x (0x%x) 32-bit words\n", TCPHeader->DataOffset, TCPHeader->DataOffset >> 4); - DbgPrint(" Flags: 0x%x (0x%x)\n", TCPHeader->Flags, TCPHeader->Flags & 0x3F); - if ((TCPHeader->Flags & TCP_URG) > 0) DbgPrint(" TCP_URG - Urgent Pointer field significant\n"); - if ((TCPHeader->Flags & TCP_ACK) > 0) DbgPrint(" TCP_ACK - Acknowledgement field significant\n"); - if ((TCPHeader->Flags & TCP_PSH) > 0) DbgPrint(" TCP_PSH - Push Function\n"); - if ((TCPHeader->Flags & TCP_RST) > 0) DbgPrint(" TCP_RST - Reset the connection\n"); - if ((TCPHeader->Flags & TCP_SYN) > 0) DbgPrint(" TCP_SYN - Synchronize sequence numbers\n"); - if ((TCPHeader->Flags & TCP_FIN) > 0) DbgPrint(" TCP_FIN - No more data from sender\n"); - DbgPrint(" Window: 0x%x\n", WN2H(TCPHeader->Window)); - DbgPrint(" Checksum: 0x%x\n", WN2H(TCPHeader->Checksum)); - DbgPrint(" Urgent: 0x%x\n", WN2H(TCPHeader->Urgent)); -} - - -VOID DisplayTCPPacket( - PIP_PACKET IPPacket) -{ - UINT Length; - PCHAR Buffer; - - if ((DbgQueryDebugFilterState(DPFLTR_TCPIP_ID, DEBUG_PBUFFER | DPFLTR_MASK) != TRUE) || - (DbgQueryDebugFilterState(DPFLTR_TCPIP_ID, DEBUG_TCP | DPFLTR_MASK) != TRUE)) { - return; - } - - if (!IPPacket) { - TI_DbgPrint(MIN_TRACE, ("Cannot display null packet.\n")); - return; - } - - DisplayIPPacket(IPPacket); - - TI_DbgPrint(MIN_TRACE, ("IPPacket is at (0x%X).\n", IPPacket)); - TI_DbgPrint(MIN_TRACE, ("Header buffer is at (0x%X).\n", IPPacket->Header)); - TI_DbgPrint(MIN_TRACE, ("Header size is (%d).\n", IPPacket->HeaderSize)); - TI_DbgPrint(MIN_TRACE, ("TotalSize (%d).\n", IPPacket->TotalSize)); - TI_DbgPrint(MIN_TRACE, ("ContigSize (%d).\n", IPPacket->ContigSize)); - TI_DbgPrint(MIN_TRACE, ("NdisPacket (0x%X).\n", IPPacket->NdisPacket)); - - if (IPPacket->NdisPacket) { - NdisQueryPacket(IPPacket->NdisPacket, NULL, NULL, NULL, &Length); - Buffer = ExAllocatePool(NonPagedPool, Length); - if (Buffer) { - Length = CopyPacketToBuffer(Buffer, IPPacket->NdisPacket, 0, Length); - DisplayTCPHeader(Buffer, Length); - ExFreePool(Buffer); - } - } else { - Buffer = IPPacket->Header; - Length = IPPacket->ContigSize; - DisplayTCPHeader(Buffer, Length); - } -} #endif VOID DisplayIPPacket( diff --git a/lib/drivers/ip/precomp.h b/lib/drivers/ip/precomp.h new file mode 100644 index 00000000000..f80c7de2b4c --- /dev/null +++ b/lib/drivers/ip/precomp.h @@ -0,0 +1,36 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include diff --git a/lib/drivers/ip/transport/datagram/datagram.c b/lib/drivers/ip/transport/datagram/datagram.c index 53dd6331ea9..1a44bfd9750 100644 --- a/lib/drivers/ip/transport/datagram/datagram.c +++ b/lib/drivers/ip/transport/datagram/datagram.c @@ -135,16 +135,15 @@ VOID DGDeliverData( RTAIPAddress = (PTA_IP_ADDRESS)Current->ReturnInfo->RemoteAddress; RTAIPAddress->TAAddressCount = 1; RTAIPAddress->Address->AddressType = TDI_ADDRESS_TYPE_IP; + RTAIPAddress->Address->AddressLength = TDI_ADDRESS_LENGTH_IP; RTAIPAddress->Address->Address->sin_port = SrcPort; + RTAIPAddress->Address->Address->in_addr = SrcAddress->Address.IPv4Address; + RtlZeroMemory(RTAIPAddress->Address->Address->sin_zero, 8); TI_DbgPrint(MAX_TRACE, ("(A: %08x) Addr %08x Port %04x\n", RTAIPAddress, SrcAddress->Address.IPv4Address, SrcPort)); - RtlCopyMemory( &RTAIPAddress->Address->Address->in_addr, - &SrcAddress->Address.IPv4Address, - sizeof(SrcAddress->Address.IPv4Address) ); - ReferenceObject(AddrFile); UnlockObject(AddrFile, OldIrql); diff --git a/lib/drivers/ip/transport/rawip/rawip.c b/lib/drivers/ip/transport/rawip/rawip.c index 6b441e42935..e36f7a57bb4 100644 --- a/lib/drivers/ip/transport/rawip/rawip.c +++ b/lib/drivers/ip/transport/rawip/rawip.c @@ -261,6 +261,8 @@ NTSTATUS RawIPSendDatagram( FreeNdisPacket(Packet.NdisPacket); return Status; } + + *DataUsed = DataSize; TI_DbgPrint(MID_TRACE,("Leaving\n")); diff --git a/lib/drivers/ip/transport/tcp/accept.c b/lib/drivers/ip/transport/tcp/accept.c index b300fa350bb..ab47b9da101 100644 --- a/lib/drivers/ip/transport/tcp/accept.c +++ b/lib/drivers/ip/transport/tcp/accept.c @@ -10,101 +10,100 @@ #include "precomp.h" -/* Listener->Lock MUST be acquired */ -NTSTATUS TCPServiceListeningSocket( PCONNECTION_ENDPOINT Listener, - PCONNECTION_ENDPOINT Connection, - PTDI_REQUEST_KERNEL Request ) { +#include "rosip.h" + +extern NPAGED_LOOKASIDE_LIST TdiBucketLookasideList; + +NTSTATUS TCPCheckPeerForAccept(PVOID Context, + PTDI_REQUEST_KERNEL Request) +{ + struct tcp_pcb *newpcb = (struct tcp_pcb*)Context; NTSTATUS Status; - SOCKADDR_IN OutAddr; - OSK_UINT OutAddrLen; - PTA_IP_ADDRESS RequestAddressReturn; PTDI_CONNECTION_INFORMATION WhoIsConnecting; + PTA_IP_ADDRESS RemoteAddress; + struct ip_addr ipaddr; + + if (Request->RequestFlags & TDI_QUERY_ACCEPT) + DbgPrint("TDI_QUERY_ACCEPT NOT SUPPORTED!!!\n"); - /* Unpack TDI info -- We need the return connection information - * struct to return the address so it can be filtered if needed - * by WSAAccept -- The returned address will be passed on to - * userland after we complete this irp */ - WhoIsConnecting = (PTDI_CONNECTION_INFORMATION) - Request->ReturnConnectionInformation; - - Status = TCPTranslateError - ( OskitTCPAccept( Listener->SocketContext, - &Connection->SocketContext, - Connection, - &OutAddr, - sizeof(OutAddr), - &OutAddrLen, - Request->RequestFlags & TDI_QUERY_ACCEPT ? 0 : 1 ) ); - - TI_DbgPrint(DEBUG_TCP,("Status %x\n", Status)); - - if( NT_SUCCESS(Status) && Status != STATUS_PENDING ) { - RequestAddressReturn = WhoIsConnecting->RemoteAddress; - - TI_DbgPrint(DEBUG_TCP,("Copying address to %x (Who %x)\n", - RequestAddressReturn, WhoIsConnecting)); - - RequestAddressReturn->TAAddressCount = 1; - RequestAddressReturn->Address[0].AddressLength = OutAddrLen; - - /* BSD uses the first byte of the sockaddr struct as a length. - * Since windows doesn't do that we strip it */ - RequestAddressReturn->Address[0].AddressType = - (OutAddr.sin_family >> 8) & 0xff; - - RtlCopyMemory( &RequestAddressReturn->Address[0].Address, - ((PCHAR)&OutAddr) + sizeof(USHORT), - sizeof(RequestAddressReturn->Address[0].Address[0]) ); - - TI_DbgPrint(DEBUG_TCP,("Done copying\n")); - } - - TI_DbgPrint(DEBUG_TCP,("Status %x\n", Status)); - + WhoIsConnecting = (PTDI_CONNECTION_INFORMATION)Request->ReturnConnectionInformation; + RemoteAddress = (PTA_IP_ADDRESS)WhoIsConnecting->RemoteAddress; + + RemoteAddress->TAAddressCount = 1; + RemoteAddress->Address[0].AddressLength = TDI_ADDRESS_LENGTH_IP; + RemoteAddress->Address[0].AddressType = TDI_ADDRESS_TYPE_IP; + + Status = TCPTranslateError(LibTCPGetPeerName(newpcb, + &ipaddr, + &RemoteAddress->Address[0].Address[0].sin_port)); + + RemoteAddress->Address[0].Address[0].in_addr = ipaddr.addr; + return Status; } /* This listen is on a socket we keep as internal. That socket has the same * lifetime as the address file */ -NTSTATUS TCPListen( PCONNECTION_ENDPOINT Connection, UINT Backlog ) { +NTSTATUS TCPListen(PCONNECTION_ENDPOINT Connection, UINT Backlog) +{ NTSTATUS Status = STATUS_SUCCESS; - SOCKADDR_IN AddressToBind; + struct ip_addr AddressToBind; KIRQL OldIrql; + TA_IP_ADDRESS LocalAddress; ASSERT(Connection); - ASSERT_KM_POINTER(Connection->AddressFile); LockObject(Connection, &OldIrql); - TI_DbgPrint(DEBUG_TCP,("TCPListen started\n")); + ASSERT_KM_POINTER(Connection->AddressFile); - TI_DbgPrint(DEBUG_TCP,("Connection->SocketContext %x\n", - Connection->SocketContext)); + TI_DbgPrint(DEBUG_TCP,("[IP, TCPListen] Called\n")); - AddressToBind.sin_family = AF_INET; - memcpy( &AddressToBind.sin_addr, - &Connection->AddressFile->Address.Address.IPv4Address, - sizeof(AddressToBind.sin_addr) ); - AddressToBind.sin_port = Connection->AddressFile->Port; + TI_DbgPrint(DEBUG_TCP, ("Connection->SocketContext %x\n", + Connection->SocketContext)); + + AddressToBind.addr = Connection->AddressFile->Address.Address.IPv4Address; - TI_DbgPrint(DEBUG_TCP,("AddressToBind - %x:%x\n", AddressToBind.sin_addr, AddressToBind.sin_port)); - - Status = TCPTranslateError( OskitTCPBind( Connection->SocketContext, - &AddressToBind, - sizeof(AddressToBind) ) ); + Status = TCPTranslateError(LibTCPBind(Connection, + &AddressToBind, + Connection->AddressFile->Port)); if (NT_SUCCESS(Status)) - Status = TCPTranslateError( OskitTCPListen( Connection->SocketContext, Backlog ) ); + { + /* Check if we had an unspecified port */ + if (!Connection->AddressFile->Port) + { + /* We did, so we need to copy back the port */ + Status = TCPGetSockAddress(Connection, (PTRANSPORT_ADDRESS)&LocalAddress, FALSE); + if (NT_SUCCESS(Status)) + { + /* Allocate the port in the port bitmap */ + Connection->AddressFile->Port = TCPAllocatePort(LocalAddress.Address[0].Address[0].sin_port); + + /* This should never fail */ + ASSERT(Connection->AddressFile->Port != 0xFFFF); + } + } + } + + if (NT_SUCCESS(Status)) + { + Connection->SocketContext = LibTCPListen(Connection, Backlog); + if (!Connection->SocketContext) + Status = STATUS_UNSUCCESSFUL; + } UnlockObject(Connection, OldIrql); - TI_DbgPrint(DEBUG_TCP,("TCPListen finished %x\n", Status)); + TI_DbgPrint(DEBUG_TCP,("[IP, TCPListen] Leaving. Status = %x\n", Status)); return Status; } -BOOLEAN TCPAbortListenForSocket( PCONNECTION_ENDPOINT Listener, - PCONNECTION_ENDPOINT Connection ) { +BOOLEAN TCPAbortListenForSocket +( PCONNECTION_ENDPOINT Listener, + PCONNECTION_ENDPOINT Connection) +{ PLIST_ENTRY ListEntry; PTDI_BUCKET Bucket; KIRQL OldIrql; @@ -113,18 +112,20 @@ BOOLEAN TCPAbortListenForSocket( PCONNECTION_ENDPOINT Listener, LockObject(Listener, &OldIrql); ListEntry = Listener->ListenRequest.Flink; - while ( ListEntry != &Listener->ListenRequest ) { - Bucket = CONTAINING_RECORD(ListEntry, TDI_BUCKET, Entry); + while (ListEntry != &Listener->ListenRequest) + { + Bucket = CONTAINING_RECORD(ListEntry, TDI_BUCKET, Entry); - if( Bucket->AssociatedEndpoint == Connection ) { - DereferenceObject(Bucket->AssociatedEndpoint); - RemoveEntryList( &Bucket->Entry ); - ExFreePoolWithTag( Bucket, TDI_BUCKET_TAG ); - Found = TRUE; - break; - } + if (Bucket->AssociatedEndpoint == Connection) + { + DereferenceObject(Bucket->AssociatedEndpoint); + RemoveEntryList( &Bucket->Entry ); + ExFreeToNPagedLookasideList(&TdiBucketLookasideList, Bucket); + Found = TRUE; + break; + } - ListEntry = ListEntry->Flink; + ListEntry = ListEntry->Flink; } UnlockObject(Listener, OldIrql); @@ -142,29 +143,24 @@ NTSTATUS TCPAccept ( PTDI_REQUEST Request, PTDI_BUCKET Bucket; KIRQL OldIrql; - TI_DbgPrint(DEBUG_TCP,("TCPAccept started\n")); - LockObject(Listener, &OldIrql); - Status = TCPServiceListeningSocket( Listener, Connection, - (PTDI_REQUEST_KERNEL)Request ); + Bucket = ExAllocateFromNPagedLookasideList(&TdiBucketLookasideList); + + if (Bucket) + { + Bucket->AssociatedEndpoint = Connection; + ReferenceObject(Bucket->AssociatedEndpoint); - if( Status == STATUS_PENDING ) { - Bucket = ExAllocatePoolWithTag( NonPagedPool, sizeof(*Bucket), - TDI_BUCKET_TAG ); - - if( Bucket ) { - ReferenceObject(Connection); - Bucket->AssociatedEndpoint = Connection; - Bucket->Request.RequestNotifyObject = Complete; - Bucket->Request.RequestContext = Context; - InsertTailList( &Listener->ListenRequest, &Bucket->Entry ); - } else - Status = STATUS_NO_MEMORY; + Bucket->Request.RequestNotifyObject = Complete; + Bucket->Request.RequestContext = Context; + InsertTailList( &Listener->ListenRequest, &Bucket->Entry ); + Status = STATUS_PENDING; } + else + Status = STATUS_NO_MEMORY; UnlockObject(Listener, OldIrql); - TI_DbgPrint(DEBUG_TCP,("TCPAccept finished %x\n", Status)); return Status; } diff --git a/lib/drivers/ip/transport/tcp/event.c b/lib/drivers/ip/transport/tcp/event.c index 4534da39c05..e9c6605eb5c 100644 --- a/lib/drivers/ip/transport/tcp/event.c +++ b/lib/drivers/ip/transport/tcp/event.c @@ -2,248 +2,516 @@ * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS TCP/IP protocol driver * FILE: transport/tcp/event.c - * PURPOSE: Transmission Control Protocol -- Events from oskittcp - * PROGRAMMERS: Art Yerkes - * REVISIONS: - * CSH 01/08-2000 Created + * PURPOSE: Transmission Control Protocol + * PROGRAMMERS: Cameron Gutman (cameron.gutman@reactos.org) */ #include "precomp.h" -int TCPSocketState(void *ClientData, - void *WhichSocket, - void *WhichConnection, - OSK_UINT NewState ) { - PCONNECTION_ENDPOINT Connection = WhichConnection; +#include "lwip/err.h" +#include "lwip/sys.h" +#include "lwip/pbuf.h" +#include "lwip/tcp.h" +#include "lwip/api.h" - TI_DbgPrint(DEBUG_TCP,("Connection: %x Flags: %c%c%c%c%c\n", - Connection, - NewState & SEL_CONNECT ? 'C' : 'c', - NewState & SEL_READ ? 'R' : 'r', - NewState & SEL_FIN ? 'F' : 'f', - NewState & SEL_ACCEPT ? 'A' : 'a', - NewState & SEL_WRITE ? 'W' : 'w')); +#include "rosip.h" - /* If this socket is missing its socket context, that means that it - * has been created as a new connection in sonewconn but not accepted - * yet. We can safely ignore event notifications on these sockets. - * Once they are accepted, they will get a socket context and we will - * be able to process them. - */ - if (!Connection) - return 0; +static const char * const tcp_state_str[] = { + "CLOSED", + "LISTEN", + "SYN_SENT", + "SYN_RCVD", + "ESTABLISHED", + "FIN_WAIT_1", + "FIN_WAIT_2", + "CLOSE_WAIT", + "CLOSING", + "LAST_ACK", + "TIME_WAIT" +}; - TI_DbgPrint(DEBUG_TCP,("Called: NewState %x (Conn %x) (Change %x)\n", - NewState, Connection, - Connection->SignalState ^ NewState, - NewState)); +extern NPAGED_LOOKASIDE_LIST TdiBucketLookasideList; - Connection->SignalState = NewState; +static +VOID +BucketCompletionWorker(PVOID Context) +{ + PTDI_BUCKET Bucket = (PTDI_BUCKET)Context; + PTCP_COMPLETION_ROUTINE Complete; + + Complete = (PTCP_COMPLETION_ROUTINE)Bucket->Request.RequestNotifyObject; + + Complete(Bucket->Request.RequestContext, Bucket->Status, Bucket->Information); + + DereferenceObject(Bucket->AssociatedEndpoint); - HandleSignalledConnection(Connection); - - return 0; + ExFreeToNPagedLookasideList(&TdiBucketLookasideList, Bucket); } -void TCPPacketSendComplete( PVOID Context, - PNDIS_PACKET NdisPacket, - NDIS_STATUS NdisStatus ) { - TI_DbgPrint(DEBUG_TCP,("called %x\n", NdisPacket)); - FreeNdisPacket(NdisPacket); - TI_DbgPrint(DEBUG_TCP,("done\n")); -} - -#define STRINGIFY(x) #x - -int TCPPacketSend(void *ClientData, OSK_PCHAR data, OSK_UINT len ) { - NDIS_STATUS NdisStatus; - PNEIGHBOR_CACHE_ENTRY NCE; - IP_PACKET Packet = { 0 }; - IP_ADDRESS RemoteAddress, LocalAddress; - PIPv4_HEADER Header; - - if( *data == 0x45 ) { /* IPv4 */ - Header = (PIPv4_HEADER)data; - LocalAddress.Type = IP_ADDRESS_V4; - LocalAddress.Address.IPv4Address = Header->SrcAddr; - RemoteAddress.Type = IP_ADDRESS_V4; - RemoteAddress.Address.IPv4Address = Header->DstAddr; - } else { - TI_DbgPrint(MIN_TRACE,("Outgoing packet is not IPv4\n")); - OskitDumpBuffer( data, len ); - return OSK_EINVAL; - } - - if(!(NCE = RouteGetRouteToDestination( &RemoteAddress ))) { - TI_DbgPrint(MIN_TRACE,("Unable to get route to %s\n", A2S(&RemoteAddress))); - return OSK_EADDRNOTAVAIL; - } - - NdisStatus = AllocatePacketWithBuffer( &Packet.NdisPacket, NULL, len ); - - if (NdisStatus != NDIS_STATUS_SUCCESS) { - TI_DbgPrint(DEBUG_TCP, ("Error from NDIS: %08x\n", NdisStatus)); - return OSK_ENOBUFS; - } - - GetDataPtr( Packet.NdisPacket, 0, - (PCHAR *)&Packet.Header, &Packet.ContigSize ); - - RtlCopyMemory( Packet.Header, data, len ); - - Packet.HeaderSize = sizeof(IPv4_HEADER); - Packet.TotalSize = len; - Packet.SrcAddr = LocalAddress; - Packet.DstAddr = RemoteAddress; - - if (!NT_SUCCESS(IPSendDatagram( &Packet, NCE, TCPPacketSendComplete, NULL ))) +VOID +CompleteBucket(PCONNECTION_ENDPOINT Connection, PTDI_BUCKET Bucket, const BOOLEAN Synchronous) +{ + ReferenceObject(Connection); + Bucket->AssociatedEndpoint = Connection; + if (Synchronous) { - FreeNdisPacket(Packet.NdisPacket); - return OSK_EINVAL; + BucketCompletionWorker(Bucket); + } + else + { + ChewCreate(BucketCompletionWorker, Bucket); } - - return 0; } -/* Memory management routines - * - * By far the most requests for memory are either for 128 or 2049 byte blocks, - * so we want to satisfy those from lookaside lists. Unfortunately, the - * TCPFree() function doesn't pass the size of the block to be freed, so we - * need to keep track of it ourselves. We do it by prepending each block with - * 4 bytes, indicating if this is a 'L'arge (2049), 'S'mall (128) or 'O'ther - * block. - */ - -/* Set to some non-zero value to get a profile of memory allocation sizes */ -#define MEM_PROFILE 0 - -#define SMALL_SIZE 128 -#define LARGE_SIZE 2049 - -#define SIGNATURE_LARGE 'LLLL' -#define SIGNATURE_SMALL 'SSSS' -#define SIGNATURE_OTHER 'OOOO' -static NPAGED_LOOKASIDE_LIST LargeLookasideList; -static NPAGED_LOOKASIDE_LIST SmallLookasideList; - -NTSTATUS -TCPMemStartup( void ) +VOID +FlushReceiveQueue(PCONNECTION_ENDPOINT Connection, const NTSTATUS Status, const BOOLEAN interlocked) { - ExInitializeNPagedLookasideList( &LargeLookasideList, - NULL, - NULL, - 0, - LARGE_SIZE + sizeof( ULONG ), - OSK_LARGE_TAG, - 0 ); - ExInitializeNPagedLookasideList( &SmallLookasideList, - NULL, - NULL, - 0, - SMALL_SIZE + sizeof( ULONG ), - OSK_SMALL_TAG, - 0 ); + PTDI_BUCKET Bucket; + PLIST_ENTRY Entry; + + ReferenceObject(Connection); + + if (interlocked) + { + while ((Entry = ExInterlockedRemoveHeadList(&Connection->ReceiveRequest, &Connection->Lock))) + { + Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry ); + + TI_DbgPrint(DEBUG_TCP, + ("Completing Receive request: %x %x\n", + Bucket->Request, Status)); + + Bucket->Status = Status; + Bucket->Information = 0; + + CompleteBucket(Connection, Bucket, FALSE); + } + } + else + { + while (!IsListEmpty(&Connection->ReceiveRequest)) + { + Entry = RemoveHeadList(&Connection->ReceiveRequest); + + Bucket = CONTAINING_RECORD(Entry, TDI_BUCKET, Entry); + + Bucket->Information = 0; + Bucket->Status = Status; + + CompleteBucket(Connection, Bucket, FALSE); + } + } - return STATUS_SUCCESS; + DereferenceObject(Connection); } -void *TCPMalloc( void *ClientData, - OSK_UINT Bytes, OSK_PCHAR File, OSK_UINT Line ) { - void *v; - ULONG Signature; +VOID +FlushSendQueue(PCONNECTION_ENDPOINT Connection, const NTSTATUS Status, const BOOLEAN interlocked) +{ + PTDI_BUCKET Bucket; + PLIST_ENTRY Entry; + + ReferenceObject(Connection); -#if 0 != MEM_PROFILE - static OSK_UINT *Sizes = NULL, *Counts = NULL, ArrayAllocated = 0; - static OSK_UINT ArrayUsed = 0, AllocationCount = 0; - OSK_UINT i, NewSize, *NewArray; - int Found; - - Found = 0; - for ( i = 0; i < ArrayUsed && ! Found; i++ ) { - Found = ( Sizes[i] == Bytes ); - if ( Found ) { - Counts[i]++; - } - } - if ( ! Found ) { - if ( ArrayAllocated <= ArrayUsed ) { - NewSize = ( 0 == ArrayAllocated ? 16 : 2 * ArrayAllocated ); - NewArray = exAllocatePool( NonPagedPool, 2 * NewSize * sizeof( OSK_UINT ) ); - if ( NULL != NewArray ) { - if ( 0 != ArrayAllocated ) { - memcpy( NewArray, Sizes, - ArrayAllocated * sizeof( OSK_UINT ) ); - exFreePool( Sizes ); - memcpy( NewArray + NewSize, Counts, - ArrayAllocated * sizeof( OSK_UINT ) ); - exFreePool( Counts ); - } - Sizes = NewArray; - Counts = NewArray + NewSize; - ArrayAllocated = NewSize; - } else if ( 0 != ArrayAllocated ) { - exFreePool( Sizes ); - exFreePool( Counts ); - ArrayAllocated = 0; + if (interlocked) + { + while ((Entry = ExInterlockedRemoveHeadList(&Connection->SendRequest, &Connection->Lock))) + { + Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry ); + + TI_DbgPrint(DEBUG_TCP, + ("Completing Send request: %x %x\n", + Bucket->Request, Status)); + + Bucket->Status = Status; + Bucket->Information = 0; + + CompleteBucket(Connection, Bucket, FALSE); } } - if ( ArrayUsed < ArrayAllocated ) { - Sizes[ArrayUsed] = Bytes; - Counts[ArrayUsed] = 1; - ArrayUsed++; - } + else + { + while (!IsListEmpty(&Connection->SendRequest)) + { + Entry = RemoveHeadList(&Connection->SendRequest); + + Bucket = CONTAINING_RECORD(Entry, TDI_BUCKET, Entry); + + Bucket->Information = 0; + Bucket->Status = Status; + + CompleteBucket(Connection, Bucket, FALSE); + } } - if ( 0 == (++AllocationCount % MEM_PROFILE) ) { - TI_DbgPrint(DEBUG_TCP, ("Memory allocation size profile:\n")); - for ( i = 0; i < ArrayUsed; i++ ) { + DereferenceObject(Connection); +} + +VOID +FlushShutdownQueue(PCONNECTION_ENDPOINT Connection, const NTSTATUS Status, const BOOLEAN interlocked) +{ + PTDI_BUCKET Bucket; + PLIST_ENTRY Entry; + + ReferenceObject(Connection); + + if (interlocked) + { + while ((Entry = ExInterlockedRemoveHeadList(&Connection->ShutdownRequest, &Connection->Lock))) + { + Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry ); + + Bucket->Status = Status; + Bucket->Information = 0; + + CompleteBucket(Connection, Bucket, FALSE); + } + } + else + { + while (!IsListEmpty(&Connection->ShutdownRequest)) + { + Entry = RemoveHeadList(&Connection->ShutdownRequest); + + Bucket = CONTAINING_RECORD(Entry, TDI_BUCKET, Entry); + + Bucket->Information = 0; + Bucket->Status = Status; + + CompleteBucket(Connection, Bucket, FALSE); + } + } + + DereferenceObject(Connection); +} + +VOID +FlushConnectQueue(PCONNECTION_ENDPOINT Connection, const NTSTATUS Status) +{ + PTDI_BUCKET Bucket; + PLIST_ENTRY Entry; + + ReferenceObject(Connection); + + while ((Entry = ExInterlockedRemoveHeadList(&Connection->ConnectRequest, &Connection->Lock))) + { + Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry ); + + Bucket->Status = Status; + Bucket->Information = 0; + + CompleteBucket(Connection, Bucket, FALSE); + } + + DereferenceObject(Connection); +} + +VOID +FlushListenQueue(PCONNECTION_ENDPOINT Connection, const NTSTATUS Status) +{ + PTDI_BUCKET Bucket; + PLIST_ENTRY Entry; + + ReferenceObject(Connection); + + while ((Entry = ExInterlockedRemoveHeadList(&Connection->ListenRequest, &Connection->Lock))) + { + Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry ); + + Bucket->Status = Status; + Bucket->Information = 0; + + DereferenceObject(Bucket->AssociatedEndpoint); + CompleteBucket(Connection, Bucket, FALSE); + } + + DereferenceObject(Connection); +} + +VOID +FlushAllQueues(PCONNECTION_ENDPOINT Connection, NTSTATUS Status) +{ + ReferenceObject(Connection); + + // flush receive queue + FlushReceiveQueue(Connection, Status, TRUE); + + /* We completed the reads successfully but we need to return failure now */ + if (Status == STATUS_SUCCESS) + { + Status = STATUS_FILE_CLOSED; + } + + // flush listen queue + FlushListenQueue(Connection, Status); + + // flush send queue + FlushSendQueue(Connection, Status, TRUE); + + // flush connect queue + FlushConnectQueue(Connection, Status); + + // flush shutdown queue + FlushShutdownQueue(Connection, Status, TRUE); + + DereferenceObject(Connection); +} + +VOID +TCPFinEventHandler(void *arg, const err_t err) +{ + PCONNECTION_ENDPOINT Connection = (PCONNECTION_ENDPOINT)arg, LastConnection; + const NTSTATUS Status = TCPTranslateError(err); + KIRQL OldIrql; + + ASSERT(Connection->AddressFile); + + /* Check if this was a partial socket closure */ + if (err == ERR_OK && Connection->SocketContext) + { + /* Just flush the receive queue and get out of here */ + FlushReceiveQueue(Connection, STATUS_SUCCESS, TRUE); + } + else + { + /* First off all, remove the PCB pointer */ + Connection->SocketContext = NULL; + + /* Complete all outstanding requests now */ + FlushAllQueues(Connection, Status); + + LockObject(Connection, &OldIrql); + + LockObjectAtDpcLevel(Connection->AddressFile); + + /* Unlink this connection from the address file */ + if (Connection->AddressFile->Connection == Connection) + { + Connection->AddressFile->Connection = Connection->Next; + DereferenceObject(Connection); + } + else if (Connection->AddressFile->Listener == Connection) + { + Connection->AddressFile->Listener = NULL; + DereferenceObject(Connection); + } + else + { + LastConnection = Connection->AddressFile->Connection; + while (LastConnection->Next != Connection && LastConnection->Next != NULL) + LastConnection = LastConnection->Next; + if (LastConnection->Next == Connection) + { + LastConnection->Next = Connection->Next; + DereferenceObject(Connection); + } + } + + UnlockObjectFromDpcLevel(Connection->AddressFile); + + /* Remove the address file from this connection */ + DereferenceObject(Connection->AddressFile); + Connection->AddressFile = NULL; + + UnlockObject(Connection, OldIrql); + } +} + +VOID +TCPAcceptEventHandler(void *arg, PTCP_PCB newpcb) +{ + PCONNECTION_ENDPOINT Connection = (PCONNECTION_ENDPOINT)arg; + PTDI_BUCKET Bucket; + PLIST_ENTRY Entry; + PIRP Irp; + NTSTATUS Status; + KIRQL OldIrql; + + ReferenceObject(Connection); + + while ((Entry = ExInterlockedRemoveHeadList(&Connection->ListenRequest, &Connection->Lock))) + { + PIO_STACK_LOCATION IrpSp; + + Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry ); + + Irp = Bucket->Request.RequestContext; + IrpSp = IoGetCurrentIrpStackLocation( Irp ); + + TI_DbgPrint(DEBUG_TCP,("[IP, TCPAcceptEventHandler] Getting the socket\n")); + + Status = TCPCheckPeerForAccept(newpcb, + (PTDI_REQUEST_KERNEL)&IrpSp->Parameters); + + TI_DbgPrint(DEBUG_TCP,("Socket: Status: %x\n", Status)); + + Bucket->Status = Status; + Bucket->Information = 0; + + if (Status == STATUS_SUCCESS) + { + LockObject(Bucket->AssociatedEndpoint, &OldIrql); + + /* sanity assert...this should never be in anything else but a CLOSED state */ + ASSERT( ((PTCP_PCB)Bucket->AssociatedEndpoint->SocketContext)->state == CLOSED ); + + /* free socket context created in FileOpenConnection, as we're using a new one */ + LibTCPClose(Bucket->AssociatedEndpoint, TRUE, FALSE); + + /* free previously created socket context (we don't use it, we use newpcb) */ + Bucket->AssociatedEndpoint->SocketContext = newpcb; + + LibTCPAccept(newpcb, (PTCP_PCB)Connection->SocketContext, Bucket->AssociatedEndpoint); + + UnlockObject(Bucket->AssociatedEndpoint, OldIrql); + } + + DereferenceObject(Bucket->AssociatedEndpoint); + + CompleteBucket(Connection, Bucket, FALSE); + } + + DereferenceObject(Connection); +} + +VOID +TCPSendEventHandler(void *arg, u16_t space) +{ + PCONNECTION_ENDPOINT Connection = (PCONNECTION_ENDPOINT)arg; + PTDI_BUCKET Bucket; + PLIST_ENTRY Entry; + PIRP Irp; + NTSTATUS Status; + PMDL Mdl; + + ReferenceObject(Connection); + + while ((Entry = ExInterlockedRemoveHeadList(&Connection->SendRequest, &Connection->Lock))) + { + UINT SendLen = 0; + PVOID SendBuffer = 0; + + Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry ); + + Irp = Bucket->Request.RequestContext; + Mdl = Irp->MdlAddress; + TI_DbgPrint(DEBUG_TCP, - ("Size %4u Count %5u\n", Sizes[i], Counts[i])); - } - TI_DbgPrint(DEBUG_TCP, ("End of memory allocation size profile\n")); - } -#endif /* MEM_PROFILE */ - - if ( SMALL_SIZE == Bytes ) { - v = ExAllocateFromNPagedLookasideList( &SmallLookasideList ); - Signature = SIGNATURE_SMALL; - } else if ( LARGE_SIZE == Bytes ) { - v = ExAllocateFromNPagedLookasideList( &LargeLookasideList ); - Signature = SIGNATURE_LARGE; - } else { - v = ExAllocatePoolWithTag( NonPagedPool, Bytes + sizeof(ULONG), - OSK_OTHER_TAG ); - Signature = SIGNATURE_OTHER; - } - if( v ) { - *((ULONG *) v) = Signature; - v = (void *)((char *) v + sizeof(ULONG)); + ("Getting the user buffer from %x\n", Mdl)); + + NdisQueryBuffer( Mdl, &SendBuffer, &SendLen ); + + TI_DbgPrint(DEBUG_TCP, + ("Writing %d bytes to %x\n", SendLen, SendBuffer)); + + TI_DbgPrint(DEBUG_TCP, ("Connection: %x\n", Connection)); + TI_DbgPrint + (DEBUG_TCP, + ("Connection->SocketContext: %x\n", + Connection->SocketContext)); + + Status = TCPTranslateError(LibTCPSend(Connection, + SendBuffer, + SendLen, TRUE)); + + TI_DbgPrint(DEBUG_TCP,("TCP Bytes: %d\n", SendLen)); + + if( Status == STATUS_PENDING ) + { + ExInterlockedInsertHeadList(&Connection->SendRequest, + &Bucket->Entry, + &Connection->Lock); + break; + } + else + { + TI_DbgPrint(DEBUG_TCP, + ("Completing Send request: %x %x\n", + Bucket->Request, Status)); + + Bucket->Status = Status; + Bucket->Information = (Bucket->Status == STATUS_SUCCESS) ? SendLen : 0; + + CompleteBucket(Connection, Bucket, FALSE); + } } - return v; + // If we completed all outstanding send requests then finish all pending shutdown requests, + // cancel the timer and dereference the connection + if (IsListEmpty(&Connection->SendRequest)) + { + FlushShutdownQueue(Connection, STATUS_SUCCESS, FALSE); + + if (KeCancelTimer(&Connection->DisconnectTimer)) + { + DereferenceObject(Connection); + } + } + + DereferenceObject(Connection); } -void TCPFree( void *ClientData, - void *data, OSK_PCHAR File, OSK_UINT Line ) { - ULONG Signature; - - data = (void *)((char *) data - sizeof(ULONG)); - Signature = *((ULONG *) data); - if ( SIGNATURE_SMALL == Signature ) { - ExFreeToNPagedLookasideList( &SmallLookasideList, data ); - } else if ( SIGNATURE_LARGE == Signature ) { - ExFreeToNPagedLookasideList( &LargeLookasideList, data ); - } else if ( SIGNATURE_OTHER == Signature ) { - ExFreePoolWithTag( data, OSK_OTHER_TAG ); - } else { - ASSERT( FALSE ); - } -} - -void -TCPMemShutdown( void ) +VOID +TCPRecvEventHandler(void *arg) { - ExDeleteNPagedLookasideList( &SmallLookasideList ); - ExDeleteNPagedLookasideList( &LargeLookasideList ); + PCONNECTION_ENDPOINT Connection = (PCONNECTION_ENDPOINT)arg; + PTDI_BUCKET Bucket; + PLIST_ENTRY Entry; + PIRP Irp; + PMDL Mdl; + UINT Received; + UINT RecvLen; + PUCHAR RecvBuffer; + NTSTATUS Status; + + ReferenceObject(Connection); + + while ((Entry = ExInterlockedRemoveHeadList(&Connection->ReceiveRequest, &Connection->Lock))) + { + Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry ); + + Irp = Bucket->Request.RequestContext; + Mdl = Irp->MdlAddress; + + NdisQueryBuffer( Mdl, &RecvBuffer, &RecvLen ); + + Status = LibTCPGetDataFromConnectionQueue(Connection, RecvBuffer, RecvLen, &Received); + if (Status == STATUS_PENDING) + { + ExInterlockedInsertHeadList(&Connection->ReceiveRequest, + &Bucket->Entry, + &Connection->Lock); + break; + } + + Bucket->Status = Status; + Bucket->Information = Received; + + CompleteBucket(Connection, Bucket, FALSE); + } + + DereferenceObject(Connection); +} + +VOID +TCPConnectEventHandler(void *arg, err_t err) +{ + PCONNECTION_ENDPOINT Connection = (PCONNECTION_ENDPOINT)arg; + PTDI_BUCKET Bucket; + PLIST_ENTRY Entry; + + ReferenceObject(Connection); + + while ((Entry = ExInterlockedRemoveHeadList(&Connection->ConnectRequest, &Connection->Lock))) + { + + Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry ); + + Bucket->Status = TCPTranslateError(err); + Bucket->Information = 0; + + CompleteBucket(Connection, Bucket, FALSE); + } + + DereferenceObject(Connection); } diff --git a/lib/drivers/ip/transport/tcp/if.c b/lib/drivers/ip/transport/tcp/if.c index c12bc45e918..16b340a88f8 100644 --- a/lib/drivers/ip/transport/tcp/if.c +++ b/lib/drivers/ip/transport/tcp/if.c @@ -1,117 +1,168 @@ -/* - * Copyright (c) 1997-1998 University of Utah and the Flux Group. - * All rights reserved. - * - * This file is part of the Flux OSKit. The OSKit is free software, also known - * as "open source;" you can redistribute it and/or modify it under the terms - * of the GNU General Public License (GPL), version 2, as published by the Free - * Software Foundation (FSF). To explore alternate licensing terms, contact - * the University of Utah at csl-dist@cs.utah.edu or +1-801-585-3271. - * - * The OSKit 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 GPL for more details. You should have - * received a copy of the GPL along with the OSKit; see the file COPYING. If - * not, write to the FSF, 59 Temple Place #330, Boston, MA 02111-1307, USA. - */ #include "precomp.h" -int if_index = 0; -struct ifaddr **ifnet_addrs; +#include "lwip/pbuf.h" +#include "lwip/netifapi.h" +#include "lwip/ip.h" +#include "lwip/api.h" +#include "lwip/tcpip.h" -int ifqmaxlen = OSK_IFQ_MAXLEN; -struct ifnet *ifnet; - -/* - * Network interface utility routines. - * - * Routines with ifa_ifwith* names take sockaddr *'s as - * parameters. - */ - -POSK_IFADDR TCPGetInterfaceData( PIP_INTERFACE IF ) { - NTSTATUS Status; - POSK_IFADDR ifaddr = IF->TCPContext; - struct sockaddr_in *addr_in; - struct sockaddr_in *dstaddr_in; - struct sockaddr_in *netmask_in; - ASSERT(ifaddr); - - RtlZeroMemory(ifaddr, sizeof(OSK_IFADDR) + 3 * sizeof( struct sockaddr_in )); - - addr_in = (struct sockaddr_in *)&ifaddr[1]; - dstaddr_in = (struct sockaddr_in *)&addr_in[1]; - netmask_in = (struct sockaddr_in *)&dstaddr_in[1]; - - TI_DbgPrint(DEBUG_TCPIF,("Called\n")); - - ifaddr->ifa_addr = (struct sockaddr *)addr_in; - Status = GetInterfaceIPv4Address( IF, - ADE_UNICAST, - (PULONG)&addr_in->sin_addr.s_addr ); - - ASSERT(NT_SUCCESS(Status)); - - ifaddr->ifa_dstaddr = (struct sockaddr *)dstaddr_in; - Status = GetInterfaceIPv4Address(IF, - ADE_POINTOPOINT, - (PULONG)&dstaddr_in->sin_addr.s_addr ); - - ASSERT(NT_SUCCESS(Status)); - - ifaddr->ifa_netmask = (struct sockaddr *)netmask_in; - Status = GetInterfaceIPv4Address(IF, - ADE_ADDRMASK, - (PULONG)&netmask_in->sin_addr.s_addr ); - - ASSERT(NT_SUCCESS(Status)); - - TI_DbgPrint(DEBUG_TCPIF,("interface %x : addr %x\n", - IF, addr_in->sin_addr.s_addr)); - - ifaddr->ifa_flags = 0; - ifaddr->ifa_refcnt = 0; /* Anachronistic */ - ifaddr->ifa_metric = 1; /* We can get it like in ninfo.c, if we want */ - ifaddr->ifa_mtu = IF->MTU; - - TI_DbgPrint(DEBUG_TCPIF,("Leaving\n")); - - return ifaddr; +void TCPPacketSendComplete(PVOID Context, PNDIS_PACKET NdisPacket, NDIS_STATUS NdisStatus) +{ + FreeNdisPacket(NdisPacket); } -POSK_IFADDR TCPFindInterface( void *ClientData, - OSK_UINT AddrType, - OSK_UINT FindType, - OSK_SOCKADDR *ReqAddr, - OSK_IFADDR *Interface ) { +err_t +TCPSendDataCallback(struct netif *netif, struct pbuf *p, struct ip_addr *dest) +{ + NDIS_STATUS NdisStatus; PNEIGHBOR_CACHE_ENTRY NCE; - IP_ADDRESS Destination; - struct sockaddr_in *addr_in = (struct sockaddr_in *)ReqAddr; - POSK_IFADDR InterfaceData; - - TI_DbgPrint(DEBUG_TCPIF,("called for type %d\n", FindType)); - - if( !ReqAddr ) { - TI_DbgPrint(DEBUG_TCPIF,("no addr or no ifaddr (%x)\n", ReqAddr)); - return NULL; + IP_PACKET Packet = { 0 }; + IP_ADDRESS RemoteAddress, LocalAddress; + PIPv4_HEADER Header; + UINT i; + struct pbuf *p1; + + /* The caller frees the pbuf struct */ + + if (((*(u8_t*)p->payload) & 0xF0) == 0x40) + { + Header = p->payload; + + LocalAddress.Type = IP_ADDRESS_V4; + LocalAddress.Address.IPv4Address = Header->SrcAddr; + + RemoteAddress.Type = IP_ADDRESS_V4; + RemoteAddress.Address.IPv4Address = Header->DstAddr; + } + else + { + return ERR_IF; } - Destination.Type = IP_ADDRESS_V4; - Destination.Address.IPv4Address = addr_in->sin_addr.s_addr; - - TI_DbgPrint(DEBUG_TCPIF,("Address is %x\n", addr_in->sin_addr.s_addr)); - - NCE = RouteGetRouteToDestination(&Destination); - if (!NCE) return NULL; - - InterfaceData = TCPGetInterfaceData(NCE->Interface); - - addr_in = (struct sockaddr_in *) - InterfaceData->ifa_addr; - - TI_DbgPrint(DEBUG_TCPIF,("returning addr %x\n", addr_in->sin_addr.s_addr)); - - return InterfaceData; + if (!(NCE = RouteGetRouteToDestination(&RemoteAddress))) + { + return ERR_RTE; + } + + NdisStatus = AllocatePacketWithBuffer(&Packet.NdisPacket, NULL, p->tot_len); + if (NdisStatus != NDIS_STATUS_SUCCESS) + { + return ERR_MEM; + } + + GetDataPtr(Packet.NdisPacket, 0, (PCHAR*)&Packet.Header, &Packet.ContigSize); + + for (i = 0, p1 = p; i < p->tot_len; i += p1->len, p1 = p1->next) + { + ASSERT(p1); + RtlCopyMemory(((PUCHAR)Packet.Header) + i, p1->payload, p1->len); + } + + Packet.HeaderSize = sizeof(IPv4_HEADER); + Packet.TotalSize = p->tot_len; + Packet.SrcAddr = LocalAddress; + Packet.DstAddr = RemoteAddress; + + if (!NT_SUCCESS(IPSendDatagram(&Packet, NCE, TCPPacketSendComplete, NULL))) + { + FreeNdisPacket(Packet.NdisPacket); + return ERR_IF; + } + + return 0; } +VOID +TCPUpdateInterfaceLinkStatus(PIP_INTERFACE IF) +{ +#if 0 + ULONG OperationalStatus; + + GetInterfaceConnectionStatus(IF, &OperationalStatus); + + if (OperationalStatus == MIB_IF_OPER_STATUS_OPERATIONAL) + netif_set_link_up(IF->TCPContext); + else + netif_set_link_down(IF->TCPContext); +#endif +} + +err_t +TCPInterfaceInit(struct netif *netif) +{ + PIP_INTERFACE IF = netif->state; + + netif->hwaddr_len = IF->AddressLength; + RtlCopyMemory(netif->hwaddr, IF->Address, netif->hwaddr_len); + + netif->output = TCPSendDataCallback; + netif->mtu = IF->MTU; + + netif->name[0] = 'e'; + netif->name[1] = 'n'; + + netif->flags |= NETIF_FLAG_BROADCAST; + + TCPUpdateInterfaceLinkStatus(IF); + + TCPUpdateInterfaceIPInformation(IF); + + return 0; +} + +VOID +TCPRegisterInterface(PIP_INTERFACE IF) +{ + struct ip_addr ipaddr; + struct ip_addr netmask; + struct ip_addr gw; + + gw.addr = 0; + ipaddr.addr = 0; + netmask.addr = 0; + + IF->TCPContext = netif_add(IF->TCPContext, + &ipaddr, + &netmask, + &gw, + IF, + TCPInterfaceInit, + tcpip_input); +} + +VOID +TCPUnregisterInterface(PIP_INTERFACE IF) +{ + netif_remove(IF->TCPContext); +} + +VOID +TCPUpdateInterfaceIPInformation(PIP_INTERFACE IF) +{ + struct ip_addr ipaddr; + struct ip_addr netmask; + struct ip_addr gw; + + gw.addr = 0; + + GetInterfaceIPv4Address(IF, + ADE_UNICAST, + (PULONG)&ipaddr.addr); + + GetInterfaceIPv4Address(IF, + ADE_ADDRMASK, + (PULONG)&netmask.addr); + + netif_set_addr(IF->TCPContext, &ipaddr, &netmask, &gw); + + if (ipaddr.addr != 0) + { + netif_set_up(IF->TCPContext); + netif_set_default(IF->TCPContext); + } + else + { + netif_set_down(IF->TCPContext); + } +} diff --git a/lib/drivers/ip/transport/tcp/tcp.c b/lib/drivers/ip/transport/tcp/tcp.c index e980f6b1e15..1cae50620ee 100644 --- a/lib/drivers/ip/transport/tcp/tcp.c +++ b/lib/drivers/ip/transport/tcp/tcp.c @@ -14,234 +14,65 @@ LONG TCP_IPIdentification = 0; static BOOLEAN TCPInitialized = FALSE; -static NPAGED_LOOKASIDE_LIST TCPSegmentList; PORT_SET TCPPorts; -CLIENT_DATA ClientInfo; -VOID HandleSignalledConnection(PCONNECTION_ENDPOINT Connection) +#include "lwip/pbuf.h" +#include "lwip/ip.h" +#include "lwip/init.h" +#include "lwip/arch.h" + +#include "rosip.h" + +NPAGED_LOOKASIDE_LIST TdiBucketLookasideList; + +VOID NTAPI +DisconnectTimeoutDpc(PKDPC Dpc, + PVOID DeferredContext, + PVOID SystemArgument1, + PVOID SystemArgument2) { - PTDI_BUCKET Bucket; - PLIST_ENTRY Entry; - NTSTATUS Status; - PIRP Irp; - PMDL Mdl; - KIRQL OldIrql; - PTCP_COMPLETION_ROUTINE Complete; - - if (ClientInfo.Unlocked) - LockObjectAtDpcLevel(Connection); - - TI_DbgPrint(MID_TRACE,("Handling signalled state on %x (%x)\n", - Connection, Connection->SocketContext)); - - /* Things that can happen when we try the initial connection */ - if( Connection->SignalState & (SEL_CONNECT | SEL_FIN) ) { - while (!IsListEmpty(&Connection->ConnectRequest)) { - Entry = RemoveHeadList( &Connection->ConnectRequest ); - - Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry ); - - Bucket->Status = (Connection->SignalState & SEL_CONNECT) ? STATUS_SUCCESS : STATUS_CANCELLED; - Bucket->Information = 0; - - InsertTailList(&Connection->CompletionQueue, &Bucket->Entry); - } - } - - if( Connection->SignalState & (SEL_ACCEPT | SEL_FIN) ) { - /* Handle readable on a listening socket -- - * TODO: Implement filtering - */ - TI_DbgPrint(DEBUG_TCP,("Accepting new connection on %x (Queue: %s)\n", - Connection, - IsListEmpty(&Connection->ListenRequest) ? - "empty" : "nonempty")); - - while (!IsListEmpty(&Connection->ListenRequest)) { - PIO_STACK_LOCATION IrpSp; - - Entry = RemoveHeadList( &Connection->ListenRequest ); - - Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry ); - - Irp = Bucket->Request.RequestContext; - IrpSp = IoGetCurrentIrpStackLocation( Irp ); - - TI_DbgPrint(DEBUG_TCP,("Getting the socket\n")); - - Status = TCPServiceListeningSocket - ( Connection->AddressFile->Listener, - Bucket->AssociatedEndpoint, - (PTDI_REQUEST_KERNEL)&IrpSp->Parameters ); - - TI_DbgPrint(DEBUG_TCP,("Socket: Status: %x\n")); - - if( Status == STATUS_PENDING && !(Connection->SignalState & SEL_FIN) ) { - InsertHeadList( &Connection->ListenRequest, &Bucket->Entry ); - break; - } else { - Bucket->Status = (Status == STATUS_PENDING) ? STATUS_CANCELLED : Status; - Bucket->Information = 0; - DereferenceObject(Bucket->AssociatedEndpoint); - - InsertTailList(&Connection->CompletionQueue, &Bucket->Entry); - } - } - } - - /* Things that happen after we're connected */ - if( Connection->SignalState & (SEL_READ | SEL_FIN) ) { - TI_DbgPrint(DEBUG_TCP,("Readable: irp list %s\n", - IsListEmpty(&Connection->ReceiveRequest) ? - "empty" : "nonempty")); - - while (!IsListEmpty(&Connection->ReceiveRequest)) { - OSK_UINT RecvLen = 0, Received = 0; - PVOID RecvBuffer = 0; - - Entry = RemoveHeadList( &Connection->ReceiveRequest ); - - Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry ); - - Irp = Bucket->Request.RequestContext; - Mdl = Irp->MdlAddress; - - TI_DbgPrint(DEBUG_TCP, - ("Getting the user buffer from %x\n", Mdl)); - - NdisQueryBuffer( Mdl, &RecvBuffer, &RecvLen ); - - TI_DbgPrint(DEBUG_TCP, - ("Reading %d bytes to %x\n", RecvLen, RecvBuffer)); - - TI_DbgPrint(DEBUG_TCP, ("Connection: %x\n", Connection)); - TI_DbgPrint - (DEBUG_TCP, - ("Connection->SocketContext: %x\n", - Connection->SocketContext)); - TI_DbgPrint(DEBUG_TCP, ("RecvBuffer: %x\n", RecvBuffer)); - - Status = TCPTranslateError - ( OskitTCPRecv( Connection->SocketContext, - RecvBuffer, - RecvLen, - &Received, - 0 ) ); - - TI_DbgPrint(DEBUG_TCP,("TCP Bytes: %d\n", Received)); - - if( Status == STATUS_PENDING && !(Connection->SignalState & SEL_FIN) ) { - InsertHeadList( &Connection->ReceiveRequest, &Bucket->Entry ); - break; - } else { - TI_DbgPrint(DEBUG_TCP, - ("Completing Receive request: %x %x\n", - Bucket->Request, Status)); - - Bucket->Status = (Status == STATUS_PENDING) ? STATUS_CANCELLED : Status; - Bucket->Information = (Bucket->Status == STATUS_SUCCESS) ? Received : 0; - - InsertTailList(&Connection->CompletionQueue, &Bucket->Entry); - } - } - } - if( Connection->SignalState & (SEL_WRITE | SEL_FIN) ) { - TI_DbgPrint(DEBUG_TCP,("Writeable: irp list %s\n", - IsListEmpty(&Connection->SendRequest) ? - "empty" : "nonempty")); - - while (!IsListEmpty(&Connection->SendRequest)) { - OSK_UINT SendLen = 0, Sent = 0; - PVOID SendBuffer = 0; - - Entry = RemoveHeadList( &Connection->SendRequest ); - - Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry ); - - Irp = Bucket->Request.RequestContext; - Mdl = Irp->MdlAddress; - - TI_DbgPrint(DEBUG_TCP, - ("Getting the user buffer from %x\n", Mdl)); - - NdisQueryBuffer( Mdl, &SendBuffer, &SendLen ); - - TI_DbgPrint(DEBUG_TCP, - ("Writing %d bytes to %x\n", SendLen, SendBuffer)); - - TI_DbgPrint(DEBUG_TCP, ("Connection: %x\n", Connection)); - TI_DbgPrint - (DEBUG_TCP, - ("Connection->SocketContext: %x\n", - Connection->SocketContext)); - - Status = TCPTranslateError - ( OskitTCPSend( Connection->SocketContext, - SendBuffer, - SendLen, - &Sent, - 0 ) ); - - TI_DbgPrint(DEBUG_TCP,("TCP Bytes: %d\n", Sent)); - - if( Status == STATUS_PENDING && !(Connection->SignalState & SEL_FIN) ) { - InsertHeadList( &Connection->SendRequest, &Bucket->Entry ); - break; - } else { - TI_DbgPrint(DEBUG_TCP, - ("Completing Send request: %x %x\n", - Bucket->Request, Status)); - - Bucket->Status = (Status == STATUS_PENDING) ? STATUS_CANCELLED : Status; - Bucket->Information = (Bucket->Status == STATUS_SUCCESS) ? Sent : 0; - - InsertTailList(&Connection->CompletionQueue, &Bucket->Entry); - } - } - } - - ReferenceObject(Connection); - if (ClientInfo.Unlocked) - { - UnlockObjectFromDpcLevel(Connection); - KeReleaseSpinLock(&ClientInfo.Lock, ClientInfo.OldIrql); - } - else - { - UnlockObject(Connection, Connection->OldIrql); - } - - while ((Entry = ExInterlockedRemoveHeadList(&Connection->CompletionQueue, - &Connection->Lock))) - { - Bucket = CONTAINING_RECORD(Entry, TDI_BUCKET, Entry); - Complete = Bucket->Request.RequestNotifyObject; - - Complete(Bucket->Request.RequestContext, Bucket->Status, Bucket->Information); - - ExFreePoolWithTag(Bucket, TDI_BUCKET_TAG); - } - - if (!ClientInfo.Unlocked) - { - LockObject(Connection, &OldIrql); - } - else - { - KeAcquireSpinLock(&ClientInfo.Lock, &ClientInfo.OldIrql); - } - DereferenceObject(Connection); - - /* If the socket is dead, remove the reference we added for oskit */ - if (Connection->SignalState & SEL_FIN) - { - Connection->SocketContext = NULL; - DereferenceObject(Connection); - } + PCONNECTION_ENDPOINT Connection = (PCONNECTION_ENDPOINT)DeferredContext; + PLIST_ENTRY Entry; + PTDI_BUCKET Bucket; + NTSTATUS Status; + + LockObjectAtDpcLevel(Connection); + + /* We timed out waiting for pending sends so force it to shutdown */ + Status = TCPTranslateError(LibTCPShutdown(Connection, 0, 1)); + + while (!IsListEmpty(&Connection->SendRequest)) + { + Entry = RemoveHeadList(&Connection->SendRequest); + + Bucket = CONTAINING_RECORD(Entry, TDI_BUCKET, Entry); + + Bucket->Information = 0; + Bucket->Status = STATUS_FILE_CLOSED; + + CompleteBucket(Connection, Bucket, FALSE); + } + + while (!IsListEmpty(&Connection->ShutdownRequest)) + { + Entry = RemoveHeadList( &Connection->ShutdownRequest ); + + Bucket = CONTAINING_RECORD( Entry, TDI_BUCKET, Entry ); + + Bucket->Status = STATUS_TIMEOUT; + Bucket->Information = 0; + + CompleteBucket(Connection, Bucket, FALSE); + } + + UnlockObjectFromDpcLevel(Connection); + + DereferenceObject(Connection); } -VOID ConnectionFree(PVOID Object) { - PCONNECTION_ENDPOINT Connection = Object; +VOID ConnectionFree(PVOID Object) +{ + PCONNECTION_ENDPOINT Connection = (PCONNECTION_ENDPOINT)Object; KIRQL OldIrql; TI_DbgPrint(DEBUG_TCP, ("Freeing TCP Endpoint\n")); @@ -253,10 +84,11 @@ VOID ConnectionFree(PVOID Object) { ExFreePoolWithTag( Connection, CONN_ENDPT_TAG ); } -PCONNECTION_ENDPOINT TCPAllocateConnectionEndpoint( PVOID ClientContext ) { - PCONNECTION_ENDPOINT Connection = - ExAllocatePoolWithTag(NonPagedPool, sizeof(CONNECTION_ENDPOINT), - CONN_ENDPT_TAG); +PCONNECTION_ENDPOINT TCPAllocateConnectionEndpoint( PVOID ClientContext ) +{ + PCONNECTION_ENDPOINT Connection = (PCONNECTION_ENDPOINT) + ExAllocatePoolWithTag(NonPagedPool, sizeof(CONNECTION_ENDPOINT), CONN_ENDPT_TAG); + if (!Connection) return Connection; @@ -270,13 +102,17 @@ PCONNECTION_ENDPOINT TCPAllocateConnectionEndpoint( PVOID ClientContext ) { InitializeListHead(&Connection->ListenRequest); InitializeListHead(&Connection->ReceiveRequest); InitializeListHead(&Connection->SendRequest); - InitializeListHead(&Connection->CompletionQueue); + InitializeListHead(&Connection->ShutdownRequest); + InitializeListHead(&Connection->PacketQueue); + + /* Initialize disconnect timer */ + KeInitializeTimer(&Connection->DisconnectTimer); + KeInitializeDpc(&Connection->DisconnectDpc, DisconnectTimeoutDpc, Connection); /* Save client context pointer */ Connection->ClientContext = ClientContext; - /* Add an extra reference for oskit */ - Connection->RefCount = 2; + Connection->RefCount = 1; Connection->Free = ConnectionFree; /* Add connection endpoint to global list */ @@ -288,32 +124,50 @@ PCONNECTION_ENDPOINT TCPAllocateConnectionEndpoint( PVOID ClientContext ) { } NTSTATUS TCPSocket( PCONNECTION_ENDPOINT Connection, - UINT Family, UINT Type, UINT Proto ) { + UINT Family, UINT Type, UINT Proto ) +{ NTSTATUS Status; KIRQL OldIrql; LockObject(Connection, &OldIrql); - TI_DbgPrint(DEBUG_TCP,("Called: Connection %x, Family %d, Type %d, " - "Proto %d\n", - Connection, Family, Type, Proto)); + TI_DbgPrint(DEBUG_TCP,("[IP, TCPSocket] Called: Connection %x, Family %d, Type %d, " + "Proto %d, sizeof(CONNECTION_ENDPOINT) = %d\n", + Connection, Family, Type, Proto, sizeof(CONNECTION_ENDPOINT))); - Status = TCPTranslateError( OskitTCPSocket( Connection, - &Connection->SocketContext, - Family, - Type, - Proto ) ); - - ASSERT_KM_POINTER(Connection->SocketContext); - - TI_DbgPrint(DEBUG_TCP,("Connection->SocketContext %x\n", - Connection->SocketContext)); + Connection->SocketContext = LibTCPSocket(Connection); + if (Connection->SocketContext) + Status = STATUS_SUCCESS; + else + Status = STATUS_INSUFFICIENT_RESOURCES; UnlockObject(Connection, OldIrql); + TI_DbgPrint(DEBUG_TCP,("[IP, TCPSocket] Leaving. Status = 0x%x\n", Status)); + return Status; } +NTSTATUS TCPClose( PCONNECTION_ENDPOINT Connection ) +{ + KIRQL OldIrql; + PVOID Socket; + + LockObject(Connection, &OldIrql); + + Socket = Connection->SocketContext; + + FlushAllQueues(Connection, STATUS_CANCELLED); + + LibTCPClose(Connection, FALSE, TRUE); + + UnlockObject(Connection, OldIrql); + + DereferenceObject(Connection); + + return STATUS_SUCCESS; +} + VOID TCPReceive(PIP_INTERFACE Interface, PIP_PACKET IPPacket) /* * FUNCTION: Receives and queues TCP data @@ -323,110 +177,11 @@ VOID TCPReceive(PIP_INTERFACE Interface, PIP_PACKET IPPacket) * This is the low level interface for receiving TCP data */ { - KIRQL OldIrql; - - TI_DbgPrint(DEBUG_TCP,("Sending packet %d (%d) to oskit\n", + TI_DbgPrint(DEBUG_TCP,("Sending packet %d (%d) to lwIP\n", IPPacket->TotalSize, IPPacket->HeaderSize)); - - KeAcquireSpinLock(&ClientInfo.Lock, &OldIrql); - ClientInfo.Unlocked = TRUE; - ClientInfo.OldIrql = OldIrql; - - OskitTCPReceiveDatagram( IPPacket->Header, - IPPacket->TotalSize, - IPPacket->HeaderSize ); - - ClientInfo.Unlocked = FALSE; - KeReleaseSpinLock(&ClientInfo.Lock, OldIrql); -} - -/* event.c */ -int TCPSocketState( void *ClientData, - void *WhichSocket, - void *WhichConnection, - OSK_UINT NewState ); - -int TCPPacketSend( void *ClientData, - OSK_PCHAR Data, - OSK_UINT Len ); - -POSK_IFADDR TCPFindInterface( void *ClientData, - OSK_UINT AddrType, - OSK_UINT FindType, - OSK_SOCKADDR *ReqAddr ); - -NTSTATUS TCPMemStartup( void ); -void *TCPMalloc( void *ClientData, - OSK_UINT bytes, OSK_PCHAR file, OSK_UINT line ); -void TCPFree( void *ClientData, - void *data, OSK_PCHAR file, OSK_UINT line ); -void TCPMemShutdown( void ); - -OSKITTCP_EVENT_HANDLERS EventHandlers = { - NULL, /* Client Data */ - TCPSocketState, /* SocketState */ - TCPPacketSend, /* PacketSend */ - TCPFindInterface, /* FindInterface */ - TCPMalloc, /* Malloc */ - TCPFree, /* Free */ - NULL, /* Sleep */ - NULL, /* Wakeup */ -}; - -static KEVENT TimerLoopEvent; -static HANDLE TimerThreadHandle; - -/* - * We are running 2 timers here, one with a 200ms interval (fast) and the other - * with a 500ms interval (slow). So we need to time out at 200, 400, 500, 600, - * 800, 1000 and process the "fast" events at 200, 400, 600, 800, 1000 and the - * "slow" events at 500 and 1000. - */ -static VOID NTAPI -TimerThread(PVOID Context) -{ - LARGE_INTEGER Timeout; - NTSTATUS Status; - unsigned Current, NextFast, NextSlow, Next; - - Current = 0; - Next = 0; - NextFast = 0; - NextSlow = 0; - while ( 1 ) { - if (Next == NextFast) { - NextFast += 2; - } - if (Next == NextSlow) { - NextSlow += 5; - } - Next = min(NextFast, NextSlow); - Timeout.QuadPart = (LONGLONG) (Next - Current) * -1000000; /* 100 ms */ - Status = KeWaitForSingleObject(&TimerLoopEvent, Executive, KernelMode, - FALSE, &Timeout); - if (Status != STATUS_TIMEOUT) { - PsTerminateSystemThread(Status); - } - - TimerOskitTCP( Next == NextFast, Next == NextSlow ); - - Current = Next; - if (10 <= Current) { - Current = 0; - Next = 0; - NextFast = 0; - NextSlow = 0; - } - } -} - -static VOID -StartTimer(VOID) -{ - KeInitializeEvent(&TimerLoopEvent, NotificationEvent, FALSE); - PsCreateSystemThread(&TimerThreadHandle, THREAD_ALL_ACCESS, 0, 0, 0, - TimerThread, NULL); + + LibIPInsertPacket(Interface->TCPContext, IPPacket->Header, IPPacket->TotalSize); } NTSTATUS TCPStartup(VOID) @@ -438,37 +193,26 @@ NTSTATUS TCPStartup(VOID) { NTSTATUS Status; - Status = TCPMemStartup(); - if ( ! NT_SUCCESS(Status) ) { - return Status; - } - Status = PortsStartup( &TCPPorts, 1, 0xfffe ); - if( !NT_SUCCESS(Status) ) { - TCPMemShutdown(); + if (!NT_SUCCESS(Status)) + { return Status; } - KeInitializeSpinLock(&ClientInfo.Lock); - ClientInfo.Unlocked = FALSE; - - RegisterOskitTCPEventHandlers( &EventHandlers ); - InitOskitTCP(); - + ExInitializeNPagedLookasideList(&TdiBucketLookasideList, + NULL, + NULL, + 0, + sizeof(TDI_BUCKET), + TDI_BUCKET_TAG, + 0); + + /* Initialize our IP library */ + LibIPInitialize(); + /* Register this protocol with IP layer */ IPRegisterProtocol(IPPROTO_TCP, TCPReceive); - - ExInitializeNPagedLookasideList( - &TCPSegmentList, /* Lookaside list */ - NULL, /* Allocate routine */ - NULL, /* Free routine */ - 0, /* Flags */ - sizeof(TCP_SEGMENT), /* Size of each entry */ - 'SPCT', /* Tag */ - 0); /* Depth */ - - StartTimer(); - + TCPInitialized = TRUE; return STATUS_SUCCESS; @@ -482,59 +226,54 @@ NTSTATUS TCPShutdown(VOID) * Status of operation */ { - LARGE_INTEGER WaitForThread; - if (!TCPInitialized) return STATUS_SUCCESS; - WaitForThread.QuadPart = -2500000; /* 250 ms */ - KeSetEvent(&TimerLoopEvent, IO_NO_INCREMENT, FALSE); - ZwWaitForSingleObject(TimerThreadHandle, FALSE, &WaitForThread); + ExDeleteNPagedLookasideList(&TdiBucketLookasideList); + + LibIPShutdown(); /* Deregister this protocol with IP layer */ IPRegisterProtocol(IPPROTO_TCP, NULL); - ExDeleteNPagedLookasideList(&TCPSegmentList); - TCPInitialized = FALSE; - DeinitOskitTCP(); - PortsShutdown( &TCPPorts ); - TCPMemShutdown(); - return STATUS_SUCCESS; } -NTSTATUS TCPTranslateError( int OskitError ) { +NTSTATUS TCPTranslateError(const err_t err) +{ NTSTATUS Status; - switch( OskitError ) { - case 0: Status = STATUS_SUCCESS; break; - case OSK_EADDRNOTAVAIL: Status = STATUS_INVALID_ADDRESS; break; - case OSK_EADDRINUSE: Status = STATUS_ADDRESS_ALREADY_EXISTS; break; - case OSK_EAFNOSUPPORT: Status = STATUS_INVALID_CONNECTION; break; - case OSK_ECONNREFUSED: Status = STATUS_REMOTE_NOT_LISTENING; break; - case OSK_ECONNRESET: Status = STATUS_REMOTE_DISCONNECT; break; - case OSK_ECONNABORTED: Status = STATUS_LOCAL_DISCONNECT; break; - case OSK_EWOULDBLOCK: - case OSK_EINPROGRESS: Status = STATUS_PENDING; break; - case OSK_EINVAL: Status = STATUS_INVALID_PARAMETER; break; - case OSK_ENOMEM: - case OSK_ENOBUFS: Status = STATUS_INSUFFICIENT_RESOURCES; break; - case OSK_ESHUTDOWN: Status = STATUS_FILE_CLOSED; break; - case OSK_EMSGSIZE: Status = STATUS_BUFFER_TOO_SMALL; break; - case OSK_ETIMEDOUT: Status = STATUS_TIMEOUT; break; - case OSK_ENETUNREACH: Status = STATUS_NETWORK_UNREACHABLE; break; - case OSK_EFAULT: Status = STATUS_ACCESS_VIOLATION; break; - default: - DbgPrint("OskitTCP returned unhandled error code: %d\n", OskitError); - Status = STATUS_INVALID_CONNECTION; - break; + switch (err) + { + case ERR_OK: Status = STATUS_SUCCESS; return Status; //0 + case ERR_MEM: Status = STATUS_INSUFFICIENT_RESOURCES; break; //-1 + case ERR_BUF: Status = STATUS_BUFFER_TOO_SMALL; break; //-2 + case ERR_TIMEOUT: Status = STATUS_TIMEOUT; break; // -3 + case ERR_RTE: Status = STATUS_NETWORK_UNREACHABLE; break; //-4 + case ERR_INPROGRESS: Status = STATUS_PENDING; return Status; //-5 + case ERR_VAL: Status = STATUS_INVALID_PARAMETER; break; //-6 + case ERR_WOULDBLOCK: Status = STATUS_CANT_WAIT; break; //-7 + case ERR_USE: Status = STATUS_ADDRESS_ALREADY_EXISTS; break; //-8 + case ERR_ISCONN: Status = STATUS_UNSUCCESSFUL; break; //-9 (FIXME) + case ERR_ABRT: Status = STATUS_LOCAL_DISCONNECT; break; //-10 + case ERR_RST: Status = STATUS_REMOTE_DISCONNECT; break; //-11 + case ERR_CLSD: Status = STATUS_FILE_CLOSED; break; //-12 + case ERR_CONN: Status = STATUS_INVALID_CONNECTION; break; //-13 + case ERR_ARG: Status = STATUS_INVALID_PARAMETER; break; //-14 + case ERR_IF: Status = STATUS_UNEXPECTED_NETWORK_ERROR; break; //-15 + default: + DbgPrint("Invalid error value: %d\n", err); + ASSERT(FALSE); + Status = STATUS_UNSUCCESSFUL; + break; } + + DbgPrint("TCP operation failed: 0x%x (%d)\n", Status, err); - TI_DbgPrint(DEBUG_TCP,("Error %d -> %x\n", OskitError, Status)); return Status; } @@ -543,23 +282,26 @@ NTSTATUS TCPConnect PTDI_CONNECTION_INFORMATION ConnInfo, PTDI_CONNECTION_INFORMATION ReturnInfo, PTCP_COMPLETION_ROUTINE Complete, - PVOID Context ) { + PVOID Context ) +{ NTSTATUS Status; - SOCKADDR_IN AddressToConnect = { 0 }, AddressToBind = { 0 }; + struct ip_addr bindaddr, connaddr; IP_ADDRESS RemoteAddress; USHORT RemotePort; + TA_IP_ADDRESS LocalAddress; PTDI_BUCKET Bucket; PNEIGHBOR_CACHE_ENTRY NCE; KIRQL OldIrql; - TI_DbgPrint(DEBUG_TCP,("TCPConnect: Called\n")); + TI_DbgPrint(DEBUG_TCP,("[IP, TCPConnect] Called\n")); Status = AddrBuildAddress ((PTRANSPORT_ADDRESS)ConnInfo->RemoteAddress, &RemoteAddress, &RemotePort); - if (!NT_SUCCESS(Status)) { + if (!NT_SUCCESS(Status)) + { TI_DbgPrint(DEBUG_TCP, ("Could not AddrBuildAddress in TCPConnect\n")); return Status; } @@ -570,9 +312,6 @@ NTSTATUS TCPConnect RemoteAddress.Address.IPv4Address, RemotePort)); - AddressToConnect.sin_family = AF_INET; - AddressToBind = AddressToConnect; - LockObject(Connection, &OldIrql); if (!Connection->AddressFile) @@ -589,131 +328,148 @@ NTSTATUS TCPConnect return STATUS_NETWORK_UNREACHABLE; } - AddressToBind.sin_addr.s_addr = NCE->Interface->Unicast.Address.IPv4Address; + bindaddr.addr = NCE->Interface->Unicast.Address.IPv4Address; } else { - AddressToBind.sin_addr.s_addr = Connection->AddressFile->Address.Address.IPv4Address; + bindaddr.addr = Connection->AddressFile->Address.Address.IPv4Address; } - Status = TCPTranslateError - ( OskitTCPBind( Connection->SocketContext, - &AddressToBind, - sizeof(AddressToBind) ) ); - - if (NT_SUCCESS(Status)) { - memcpy( &AddressToConnect.sin_addr, - &RemoteAddress.Address.IPv4Address, - sizeof(AddressToConnect.sin_addr) ); - AddressToConnect.sin_port = RemotePort; - - Status = TCPTranslateError - ( OskitTCPConnect( Connection->SocketContext, - &AddressToConnect, - sizeof(AddressToConnect) ) ); - - if (Status == STATUS_PENDING) + Status = TCPTranslateError(LibTCPBind(Connection, + &bindaddr, + Connection->AddressFile->Port)); + + if (NT_SUCCESS(Status)) + { + /* Check if we had an unspecified port */ + if (!Connection->AddressFile->Port) { - Bucket = ExAllocatePoolWithTag( NonPagedPool, sizeof(*Bucket), TDI_BUCKET_TAG ); - if( !Bucket ) + /* We did, so we need to copy back the port */ + Status = TCPGetSockAddress(Connection, (PTRANSPORT_ADDRESS)&LocalAddress, FALSE); + if (NT_SUCCESS(Status)) { - UnlockObject(Connection, OldIrql); - return STATUS_NO_MEMORY; + /* Allocate the port in the port bitmap */ + Connection->AddressFile->Port = TCPAllocatePort(LocalAddress.Address[0].Address[0].sin_port); + + /* This should never fail */ + ASSERT(Connection->AddressFile->Port != 0xFFFF); + } + } + + if (NT_SUCCESS(Status)) + { + connaddr.addr = RemoteAddress.Address.IPv4Address; + + Bucket = ExAllocateFromNPagedLookasideList(&TdiBucketLookasideList); + if (!Bucket) + { + UnlockObject(Connection, OldIrql); + return STATUS_NO_MEMORY; } Bucket->Request.RequestNotifyObject = (PVOID)Complete; Bucket->Request.RequestContext = Context; InsertTailList( &Connection->ConnectRequest, &Bucket->Entry ); + + Status = TCPTranslateError(LibTCPConnect(Connection, + &connaddr, + RemotePort)); } } UnlockObject(Connection, OldIrql); + TI_DbgPrint(DEBUG_TCP,("[IP, TCPConnect] Leaving. Status = 0x%x\n", Status)); + return Status; } NTSTATUS TCPDisconnect ( PCONNECTION_ENDPOINT Connection, UINT Flags, + PLARGE_INTEGER Timeout, PTDI_CONNECTION_INFORMATION ConnInfo, PTDI_CONNECTION_INFORMATION ReturnInfo, PTCP_COMPLETION_ROUTINE Complete, - PVOID Context ) { - NTSTATUS Status = STATUS_INVALID_PARAMETER; - KIRQL OldIrql; - - TI_DbgPrint(DEBUG_TCP,("started\n")); - - LockObject(Connection, &OldIrql); - - if (Flags & TDI_DISCONNECT_RELEASE) - Status = TCPTranslateError(OskitTCPDisconnect(Connection->SocketContext)); - - if ((Flags & TDI_DISCONNECT_ABORT) || !Flags) - Status = TCPTranslateError(OskitTCPShutdown(Connection->SocketContext, FWRITE | FREAD)); - - UnlockObject(Connection, OldIrql); - - TI_DbgPrint(DEBUG_TCP,("finished %x\n", Status)); - - return Status; -} - -NTSTATUS TCPClose -( PCONNECTION_ENDPOINT Connection ) + PVOID Context ) { + NTSTATUS Status = STATUS_INVALID_PARAMETER; + PTDI_BUCKET Bucket; KIRQL OldIrql; - NTSTATUS Status; - PVOID Socket; - PADDRESS_FILE AddressFile = NULL; - PCONNECTION_ENDPOINT AddressConnection = NULL; + LARGE_INTEGER ActualTimeout; + + TI_DbgPrint(DEBUG_TCP,("[IP, TCPDisconnect] Called\n")); LockObject(Connection, &OldIrql); - Socket = Connection->SocketContext; - Connection->SocketContext = NULL; - /* Don't try to close again if the other side closed us already */ - if (Socket) + if (Connection->SocketContext) { - /* We need to close here otherwise oskit will never indicate - * SEL_FIN and we will never fully close the connection */ - Status = TCPTranslateError( OskitTCPClose( Socket ) ); + if (Flags & TDI_DISCONNECT_RELEASE) + { + if (IsListEmpty(&Connection->SendRequest)) + { + Status = TCPTranslateError(LibTCPShutdown(Connection, 0, 1)); + } + else if (Timeout && Timeout->QuadPart == 0) + { + FlushSendQueue(Connection, STATUS_FILE_CLOSED, FALSE); + TCPTranslateError(LibTCPShutdown(Connection, 0, 1)); + Status = STATUS_TIMEOUT; + } + else + { + /* Use the timeout specified or 1 second if none was specified */ + if (Timeout) + { + ActualTimeout = *Timeout; + } + else + { + ActualTimeout.QuadPart = -1000000; + } - if (!NT_SUCCESS(Status)) - { - Connection->SocketContext = Socket; - UnlockObject(Connection, OldIrql); - return Status; - } + /* We couldn't complete the request now because we need to wait for outstanding I/O */ + Bucket = ExAllocateFromNPagedLookasideList(&TdiBucketLookasideList); + if (!Bucket) + { + UnlockObject(Connection, OldIrql); + return STATUS_NO_MEMORY; + } + + Bucket->Request.RequestNotifyObject = (PVOID)Complete; + Bucket->Request.RequestContext = Context; + + InsertTailList(&Connection->ShutdownRequest, &Bucket->Entry); + + ReferenceObject(Connection); + if (KeCancelTimer(&Connection->DisconnectTimer)) + { + DereferenceObject(Connection); + } + KeSetTimer(&Connection->DisconnectTimer, ActualTimeout, &Connection->DisconnectDpc); + + Status = STATUS_PENDING; + } + } + + if ((Flags & TDI_DISCONNECT_ABORT) || !Flags) + { + FlushReceiveQueue(Connection, STATUS_FILE_CLOSED, FALSE); + FlushSendQueue(Connection, STATUS_FILE_CLOSED, FALSE); + FlushShutdownQueue(Connection, STATUS_FILE_CLOSED, FALSE); + Status = TCPTranslateError(LibTCPShutdown(Connection, 1, 1)); + } } else { - /* We are already closed by the other end so return success */ - Status = STATUS_SUCCESS; - } - - if (Connection->AddressFile) - { - LockObjectAtDpcLevel(Connection->AddressFile); - if (Connection->AddressFile->Connection == Connection) - { - AddressConnection = Connection->AddressFile->Connection; - Connection->AddressFile->Connection = NULL; - } - UnlockObjectFromDpcLevel(Connection->AddressFile); - - AddressFile = Connection->AddressFile; - Connection->AddressFile = NULL; + /* We already got closed by the other side so just return success */ + Status = STATUS_SUCCESS; } UnlockObject(Connection, OldIrql); - DereferenceObject(Connection); - if (AddressConnection) - DereferenceObject(AddressConnection); - if (AddressFile) - DereferenceObject(AddressFile); + TI_DbgPrint(DEBUG_TCP,("[IP, TCPDisconnect] Leaving. Status = 0x%x\n", Status)); return Status; } @@ -725,56 +481,44 @@ NTSTATUS TCPReceiveData PULONG BytesReceived, ULONG ReceiveFlags, PTCP_COMPLETION_ROUTINE Complete, - PVOID Context ) { - PVOID DataBuffer; - UINT DataLen, Received = 0; - NTSTATUS Status; + PVOID Context ) +{ PTDI_BUCKET Bucket; - KIRQL OldIrql; + PUCHAR DataBuffer; + UINT DataLen, Received; + NTSTATUS Status; - TI_DbgPrint(DEBUG_TCP,("Called for %d bytes (on socket %x)\n", + TI_DbgPrint(DEBUG_TCP,("[IP, TCPReceiveData] Called for %d bytes (on socket %x)\n", ReceiveLength, Connection->SocketContext)); - NdisQueryBuffer( Buffer, &DataBuffer, &DataLen ); + NdisQueryBuffer(Buffer, &DataBuffer, &DataLen); - TI_DbgPrint(DEBUG_TCP,("TCP>|< Got an MDL %x (%x:%d)\n", Buffer, DataBuffer, DataLen)); + Status = LibTCPGetDataFromConnectionQueue(Connection, DataBuffer, DataLen, &Received); - LockObject(Connection, &OldIrql); + if (Status == STATUS_PENDING) + { + Bucket = ExAllocateFromNPagedLookasideList(&TdiBucketLookasideList); + if (!Bucket) + { + TI_DbgPrint(DEBUG_TCP,("[IP, TCPReceiveData] Failed to allocate bucket\n")); - Status = TCPTranslateError - ( OskitTCPRecv - ( Connection->SocketContext, - DataBuffer, - DataLen, - &Received, - ReceiveFlags ) ); - - TI_DbgPrint(DEBUG_TCP,("OskitTCPReceive: %x, %d\n", Status, Received)); - - /* Keep this request around ... there was no data yet */ - if( Status == STATUS_PENDING ) { - /* Freed in TCPSocketState */ - Bucket = ExAllocatePoolWithTag( NonPagedPool, sizeof(*Bucket), TDI_BUCKET_TAG ); - if( !Bucket ) { - TI_DbgPrint(DEBUG_TCP,("Failed to allocate bucket\n")); - UnlockObject(Connection, OldIrql); return STATUS_NO_MEMORY; } - + Bucket->Request.RequestNotifyObject = Complete; Bucket->Request.RequestContext = Context; - *BytesReceived = 0; - InsertTailList( &Connection->ReceiveRequest, &Bucket->Entry ); - TI_DbgPrint(DEBUG_TCP,("Queued read irp\n")); - } else { - TI_DbgPrint(DEBUG_TCP,("Got status %x, bytes %d\n", Status, Received)); - *BytesReceived = Received; + ExInterlockedInsertTailList( &Connection->ReceiveRequest, &Bucket->Entry, &Connection->Lock ); + TI_DbgPrint(DEBUG_TCP,("[IP, TCPReceiveData] Queued read irp\n")); + + TI_DbgPrint(DEBUG_TCP,("[IP, TCPReceiveData] Leaving. Status = STATUS_PENDING\n")); + + (*BytesReceived) = 0; + } + else + { + (*BytesReceived) = Received; } - - UnlockObject(Connection, OldIrql); - - TI_DbgPrint(DEBUG_TCP,("Status %x\n", Status)); return Status; } @@ -786,35 +530,37 @@ NTSTATUS TCPSendData PULONG BytesSent, ULONG Flags, PTCP_COMPLETION_ROUTINE Complete, - PVOID Context ) { - UINT Sent = 0; + PVOID Context ) +{ NTSTATUS Status; PTDI_BUCKET Bucket; KIRQL OldIrql; LockObject(Connection, &OldIrql); - TI_DbgPrint(DEBUG_TCP,("Called for %d bytes (on socket %x)\n", + TI_DbgPrint(DEBUG_TCP,("[IP, TCPSendData] Called for %d bytes (on socket %x)\n", SendLength, Connection->SocketContext)); - TI_DbgPrint(DEBUG_TCP,("Connection = %x\n", Connection)); - TI_DbgPrint(DEBUG_TCP,("Connection->SocketContext = %x\n", + TI_DbgPrint(DEBUG_TCP,("[IP, TCPSendData] Connection = %x\n", Connection)); + TI_DbgPrint(DEBUG_TCP,("[IP, TCPSendData] Connection->SocketContext = %x\n", Connection->SocketContext)); - Status = TCPTranslateError - ( OskitTCPSend( Connection->SocketContext, - (OSK_PCHAR)BufferData, SendLength, - &Sent, 0 ) ); - - TI_DbgPrint(DEBUG_TCP,("OskitTCPSend: %x, %d\n", Status, Sent)); + Status = TCPTranslateError(LibTCPSend(Connection, + BufferData, + SendLength, + FALSE)); + + TI_DbgPrint(DEBUG_TCP,("[IP, TCPSendData] Send: %x, %d\n", Status, SendLength)); /* Keep this request around ... there was no data yet */ - if( Status == STATUS_PENDING ) { + if (Status == STATUS_PENDING) + { /* Freed in TCPSocketState */ - Bucket = ExAllocatePoolWithTag( NonPagedPool, sizeof(*Bucket), TDI_BUCKET_TAG ); - if( !Bucket ) { + Bucket = ExAllocateFromNPagedLookasideList(&TdiBucketLookasideList); + if (!Bucket) + { UnlockObject(Connection, OldIrql); - TI_DbgPrint(DEBUG_TCP,("Failed to allocate bucket\n")); + TI_DbgPrint(DEBUG_TCP,("[IP, TCPSendData] Failed to allocate bucket\n")); return STATUS_NO_MEMORY; } @@ -823,67 +569,88 @@ NTSTATUS TCPSendData *BytesSent = 0; InsertTailList( &Connection->SendRequest, &Bucket->Entry ); - TI_DbgPrint(DEBUG_TCP,("Queued write irp\n")); - } else { - TI_DbgPrint(DEBUG_TCP,("Got status %x, bytes %d\n", Status, Sent)); - *BytesSent = Sent; + TI_DbgPrint(DEBUG_TCP,("[IP, TCPSendData] Queued write irp\n")); + } + else if (Status == STATUS_SUCCESS) + { + *BytesSent = SendLength; + } + else + { + *BytesSent = 0; } UnlockObject(Connection, OldIrql); - TI_DbgPrint(DEBUG_TCP,("Status %x\n", Status)); + TI_DbgPrint(DEBUG_TCP, ("[IP, TCPSendData] Leaving. Status = %x\n", Status)); return Status; } -UINT TCPAllocatePort( UINT HintPort ) { - if( HintPort ) { - if( AllocatePort( &TCPPorts, HintPort ) ) return HintPort; - else { - TI_DbgPrint - (MID_TRACE,("We got a hint port but couldn't allocate it\n")); +UINT TCPAllocatePort(const UINT HintPort) +{ + if (HintPort) + { + if (AllocatePort(&TCPPorts, HintPort)) + return HintPort; + else + { + TI_DbgPrint(MID_TRACE,("We got a hint port but couldn't allocate it\n")); return (UINT)-1; } - } else return AllocatePortFromRange( &TCPPorts, 1024, 5000 ); + } + else + return AllocatePortFromRange( &TCPPorts, 1024, 5000 ); } -VOID TCPFreePort( UINT Port ) { - DeallocatePort( &TCPPorts, Port ); +VOID TCPFreePort(const UINT Port) +{ + DeallocatePort(&TCPPorts, Port); } NTSTATUS TCPGetSockAddress ( PCONNECTION_ENDPOINT Connection, PTRANSPORT_ADDRESS Address, - BOOLEAN GetRemote ) { - OSK_UINT LocalAddress, RemoteAddress; - OSK_UI16 LocalPort, RemotePort; + BOOLEAN GetRemote ) +{ PTA_IP_ADDRESS AddressIP = (PTA_IP_ADDRESS)Address; + struct ip_addr ipaddr; NTSTATUS Status; KIRQL OldIrql; - - LockObject(Connection, &OldIrql); - - Status = TCPTranslateError(OskitTCPGetAddress(Connection->SocketContext, - &LocalAddress, &LocalPort, - &RemoteAddress, &RemotePort)); - - UnlockObject(Connection, OldIrql); - - if (!NT_SUCCESS(Status)) - return Status; - + AddressIP->TAAddressCount = 1; AddressIP->Address[0].AddressLength = TDI_ADDRESS_LENGTH_IP; AddressIP->Address[0].AddressType = TDI_ADDRESS_TYPE_IP; - AddressIP->Address[0].Address[0].sin_port = GetRemote ? RemotePort : LocalPort; - AddressIP->Address[0].Address[0].in_addr = GetRemote ? RemoteAddress : LocalAddress; + + LockObject(Connection, &OldIrql); + + if (GetRemote) + { + Status = TCPTranslateError(LibTCPGetPeerName(Connection->SocketContext, + &ipaddr, + &AddressIP->Address[0].Address[0].sin_port)); + } + else + { + Status = TCPTranslateError(LibTCPGetHostName(Connection->SocketContext, + &ipaddr, + &AddressIP->Address[0].Address[0].sin_port)); + } + + UnlockObject(Connection, OldIrql); + + AddressIP->Address[0].Address[0].in_addr = ipaddr.addr; + + RtlZeroMemory(&AddressIP->Address[0].Address[0].sin_zero, + sizeof(AddressIP->Address[0].Address[0].sin_zero)); return Status; } -BOOLEAN TCPRemoveIRP( PCONNECTION_ENDPOINT Endpoint, PIRP Irp ) { +BOOLEAN TCPRemoveIRP( PCONNECTION_ENDPOINT Endpoint, PIRP Irp ) +{ PLIST_ENTRY Entry; - PLIST_ENTRY ListHead[4]; + PLIST_ENTRY ListHead[5]; KIRQL OldIrql; PTDI_BUCKET Bucket; UINT i = 0; @@ -893,10 +660,11 @@ BOOLEAN TCPRemoveIRP( PCONNECTION_ENDPOINT Endpoint, PIRP Irp ) { ListHead[1] = &Endpoint->ReceiveRequest; ListHead[2] = &Endpoint->ConnectRequest; ListHead[3] = &Endpoint->ListenRequest; + ListHead[4] = &Endpoint->ShutdownRequest; LockObject(Endpoint, &OldIrql); - for( i = 0; i < 4; i++ ) + for( i = 0; i < 5; i++ ) { for( Entry = ListHead[i]->Flink; Entry != ListHead[i]; @@ -906,7 +674,7 @@ BOOLEAN TCPRemoveIRP( PCONNECTION_ENDPOINT Endpoint, PIRP Irp ) { if( Bucket->Request.RequestContext == Irp ) { RemoveEntryList( &Bucket->Entry ); - ExFreePoolWithTag( Bucket, TDI_BUCKET_TAG ); + ExFreeToNPagedLookasideList(&TdiBucketLookasideList, Bucket); Found = TRUE; break; } diff --git a/lib/drivers/ip/transport/udp/udp.c b/lib/drivers/ip/transport/udp/udp.c index 0dcf7b2cb5b..5547323ae42 100644 --- a/lib/drivers/ip/transport/udp/udp.c +++ b/lib/drivers/ip/transport/udp/udp.c @@ -234,6 +234,8 @@ NTSTATUS UDPSendDatagram( FreeNdisPacket(Packet.NdisPacket); return Status; } + + *DataUsed = DataSize; return STATUS_SUCCESS; } diff --git a/lib/drivers/lwip/CHANGELOG b/lib/drivers/lwip/CHANGELOG new file mode 100644 index 00000000000..d0e15f2a3ea --- /dev/null +++ b/lib/drivers/lwip/CHANGELOG @@ -0,0 +1,2908 @@ +FUTURE + + * TODO: The lwIP source code makes some invalid assumptions on processor + word-length, storage sizes and alignment. See the mailing lists for + problems with exoteric (/DSP) architectures showing these problems. + We still have to fix some of these issues neatly. + +HISTORY + +(CVS HEAD) + + * [Enter new changes just after this line - do not remove this line] + + ++ New features: + + 2010-07-12: Simon Goldschmidt (patch by Stephane Lesage) + * ip.c, udp.c/.h, pbuf.h, sockets.c: task #10495: Added support for + IP_MULTICAST_LOOP at socket- and raw-API level. + + 2010-06-16: Simon Goldschmidt + * ip.c: Added an optional define (LWIP_IP_ACCEPT_UDP_PORT) that can allow + link-layer-addressed UDP traffic to be received while a netif is down (just + like DHCP during configuration) + + 2010-05-22: Simon Goldschmidt + * many many files: bug #27352: removed packing from ip_addr_t, the packed + version is now only used in protocol headers. Added global storage for + current src/dest IP address while in input functions. + + 2010-05-16: Simon Goldschmidt + * def.h: task #10391: Add preprocessor-macros for compile-time htonl + calculation (and use them throughout the stack where applicable) + + 2010-05-16: Simon Goldschmidt + * opt.h, memp_std.h, memp.c, ppp_oe.h/.c: PPPoE now uses its own MEMP pool + instead of the heap (moved struct pppoe_softc from ppp_oe.c to ppp_oe.h) + + 2010-05-16: Simon Goldschmidt + * opt.h, memp_std.h, dns.h/.c: DNS_LOCAL_HOSTLIST_IS_DYNAMIC uses its own + MEMP pool instead of the heap + + 2010-05-13: Simon Goldschmidt + * tcp.c, udp.c: task #6995: Implement SO_REUSEADDR (correctly), added + new option SO_REUSE_RXTOALL to pass received UDP broadcast/multicast + packets to more than one pcb. + + 2010-05-02: Simon Goldschmidt + * netbuf.h/.c, sockets.c, api_msg.c: use checksum-on-copy for sending + UDP data for LWIP_NETIF_TX_SINGLE_PBUF==1 + + 2010-04-30: Simon Goldschmidt + * udp.h/.c, pbuf.h/.c: task #6849: added udp_send(_to/_if) functions that + take a precalculated checksum, added pbuf_fill_chksum() to copy data + into a pbuf and at the same time calculating the checksum for that data + + 2010-04-29: Simon Goldschmidt + * ip_addr.h, etharp.h/.c, autoip.c: Create overridable macros for copying + 2-byte-aligned IP addresses and MAC addresses + + 2010-04-28: Patch by Bill Auerbach + * ip.c: Inline generating IP checksum to save a function call + + 2010-04-14: Simon Goldschmidt + * tcpip.h/.c, timers.c: Added an overridable define to get informed when the + tcpip_thread processes messages or timeouts to implement a watchdog. + + 2010-03-28: Simon Goldschmidt + * ip_frag.c: create a new (contiguous) PBUF_RAM for every outgoing + fragment if LWIP_NETIF_TX_SINGLE_PBUF==1 + + 2010-03-27: Simon Goldschmidt + * etharp.c: Speedup TX by moving code from find_entry to etharp_output/ + etharp_query to prevent unnecessary function calls (inspired by + patch #7135). + + 2010-03-20: Simon Goldschmidt + * opt.h, tcpip.c/.h: Added an option to disable tcpip_(un)timeout code + since the linker cannot do this automatically to save space. + + 2010-03-20: Simon Goldschmidt + * opt.h, etharp.c/.h: Added support for static ARP table entries + + 2010-03-14: Simon Goldschmidt + * tcp_impl.h, tcp_out.c, inet_chksum.h/.c: task #6849: Calculate checksum + when creating TCP segments, not when (re-)transmitting them. + + 2010-03-07: Simon Goldschmidt + * sockets.c: bug #28775 (select/event_callback: only check select_cb_list + on change) plus use SYS_LIGHTWEIGHT_PROT to protect the select code. + This should speed up receiving data on sockets as the select code in + event_callback is only executed when select is waiting. + + 2010-03-06: Simon Goldschmidt + * tcp_out.c: task #7013 (Create option to have all packets delivered to + netif->output in one piece): Always copy to try to create single pbufs + in tcp_write. + + 2010-03-06: Simon Goldschmidt + * api.h, api_lib.c, sockets.c: task #10167 (sockets: speed up TCP recv + by not allocating a netbuf): added function netconn_recv_tcp_pbuf() + for tcp netconns to receive pbufs, not netbufs; use that function + for tcp sockets. + + 2010-03-05: Jakob Ole Stoklundsen / Simon Goldschmidt + * opt.h, tcp.h, tcp_impl.h, tcp.c, tcp_in.c, tcp_out.c: task #7040: + Work on tcp_enqueue: Don't waste memory when chaining segments, + added option TCP_OVERSIZE to prevent creating many small pbufs when + calling tcp_write with many small blocks of data. Instead, pbufs are + allocated larger than needed and the space is used for later calls to + tcp_write. + + 2010-02-21: Simon Goldschmidt + * stats.c/.h: Added const char* name to mem- and memp-stats for easier + debugging. + + 2010-02-21: Simon Goldschmidt + * tcp.h (and usages), added tcp_impl.h: Splitted API and internal + implementation of tcp to make API usage cleare to application programmers + + 2010-02-14: Simon Goldschmidt/Stephane Lesage + * ip_addr.h: Improved some defines working on ip addresses, added faster + macro to copy addresses that cannot be NULL + + 2010-02-13: Simon Goldschmidt + * api.h, api_lib.c, api_msg.c, sockets.c: task #7865 (implement non- + blocking send operation) + + 2010-02-12: Simon Goldschmidt + * sockets.c/.h: Added a minimal version of posix fctl() to have a + standardised way to set O_NONBLOCK for nonblocking sockets. + + 2010-02-12: Simon Goldschmidt + * dhcp.c/.h, autoip.c/.h: task #10139 (Prefer statically allocated + memory): added autoip_set_struct() and dhcp_set_struct() to let autoip + and dhcp work with user-allocated structs instead of callin mem_malloc + + 2010-02-12: Simon Goldschmidt/Jeff Barber + * tcp.c/h: patch #6865 (SO_REUSEADDR for TCP): if pcb.so_options has + SOF_REUSEADDR set, allow binding to endpoint in TIME_WAIT + + 2010-02-12: Simon Goldschmidt + * sys layer: task #10139 (Prefer statically allocated memory): converted + mbox and semaphore functions to take pointers to sys_mbox_t/sys_sem_t; + converted sys_mbox_new/sys_sem_new to take pointers and return err_t; + task #7212: Add Mutex concept in sys_arch (define LWIP_COMPAT_MUTEX + to let sys.h use binary semaphores instead of mutexes - as before) + + 2010-02-09: Simon Goldschmidt (Simon Kallweit) + * timers.c/.h: Added function sys_restart_timeouts() from patch #7085 + (Restart system timeout handling) + + 2010-02-09: Simon Goldschmidt + * netif.c/.h, removed loopif.c/.h: task #10153 (Integrate loopif into + netif.c) - loopif does not have to be created by the port any more, + just define LWIP_HAVE_LOOPIF to 1. + + 2010-02-08: Simon Goldschmidt + * inet.h, ip_addr.c/.h: Added reentrant versions of inet_ntoa/ipaddr_ntoa + inet_ntoa_r/ipaddr_ntoa_r + + 2010-02-08: Simon Goldschmidt + * netif.h: Added netif_s/get_igmp_mac_filter() macros + + 2010-02-05: Simon Goldschmidt + * netif.h: Added function-like macros to get/set the hostname on a netif + + 2010-02-04: Simon Goldschmidt + * nearly every file: Replaced struct ip_addr by typedef ip_addr_t to + make changing the actual implementation behind the typedef easier. + + 2010-02-01: Simon Goldschmidt + * opt.h, memp_std.h, dns.h, netdb.c, memp.c: Let netdb use a memp pool + for allocating memory when getaddrinfo() is called. + + 2010-01-31: Simon Goldschmidt + * dhcp.h, dhcp.c: Reworked the code that parses DHCP options: parse + them once instead of parsing for every option. This also removes + the need for mem_malloc from dhcp_recv and makes it possible to + correctly retrieve the BOOTP file. + + 2010-01-30: simon Goldschmidt + * sockets.c: Use SYS_LIGHTWEIGHT_PROT instead of a semaphore to protect + the sockets array. + + 2010-01-29: Simon Goldschmidt (patch by Laura Garrett) + * api.h, api_msg.c, sockets.c: Added except set support in select + (patch #6860) + + 2010-01-29: Simon Goldschmidt (patch by Laura Garrett) + * api.h, sockets.h, err.h, api_lib.c, api_msg.c, sockets.c, err.c: + Add non-blocking support for connect (partly from patch #6860), + plus many cleanups in socket & netconn API. + + 2010-01-27: Simon Goldschmidt + * opt.h, tcp.h, init.c, api_msg.c: Added TCP_SNDQUEUELOWAT corresponding + to TCP_SNDLOWAT and added tcp_sndqueuelen() - this fixes bug #28605 + + 2010-01-26: Simon Goldschmidt + * snmp: Use memp pools for snmp instead of the heap; added 4 new pools. + + 2010-01-14: Simon Goldschmidt + * ppp.c/.h: Fixed bug #27856: PPP: Set netif link- and status-callback + by adding ppp_set_netif_statuscallback()/ppp_set_netif_linkcallback() + + 2010-01-13: Simon Goldschmidt + * mem.c: The heap now may be moved to user-defined memory by defining + LWIP_RAM_HEAP_POINTER as a void pointer to that memory's address + (patch #6966 and bug #26133) + + 2010-01-10: Simon Goldschmidt (Bill Auerbach) + * opt.h, memp.c: patch #6822 (Add option to place memory pools in + separate arrays) + + 2010-01-10: Simon Goldschmidt + * init.c, igmp.c: patch #6463 (IGMP - Adding Random Delay): added define + LWIP_RAND() for lwip-wide randomization (to be defined in cc.h) + + 2009-12-31: Simon Goldschmidt + * tcpip.c, init.c, memp.c, sys.c, memp_std.h, sys.h, tcpip.h + added timers.c/.h: Separated timer implementation from semaphore/mbox + implementation, moved timer implementation to timers.c/.h, timers are + now only called from tcpip_thread or by explicitly checking them. + (TASK#7235) + + 2009-12-27: Simon Goldschmidt + * opt.h, etharp.h/.c, init.c, tcpip.c: Added an additional option + LWIP_ETHERNET to support ethernet without ARP (necessary for pure PPPoE) + + + ++ Bugfixes: + + 2010-07-16: Kieran Mansley + * msg_in.c: Fixed SNMP ASN constant defines to not use ! operator + + 2010-07-10: Simon Goldschmidt + * ip.c: Fixed bug #30402: CHECKSUM_GEN_IP_INLINE does not add IP options + + 2010-06-30: Simon Goldschmidt + * api_msg.c: fixed bug #30300 (shutdown parameter was not initialized in + netconn_delete) + + 2010-06-28: Kieran Mansley + * timers.c remove unportable printing of C function pointers + + 2010-06-24: Simon Goldschmidt + * init.c, timers.c/.h, opt.h, memp_std.h: From patch #7221: added flag + NO_SYS_NO_TIMERS to drop timer support for NO_SYS==1 for easier upgrading + + 2010-06-24: Simon Goldschmidt + * api(_lib).c/.h, api_msg.c/.h, sockets.c/.h: Fixed bug #10088: Correctly + implemented shutdown at socket level. + + 2010-06-21: Simon Goldschmidt + * pbuf.c/.h, ip_frag.c/.h, opt.h, memp_std.h: Fixed bug #29361 (ip_frag has + problems with zero-copy DMA MACs) by adding custom pbufs and implementing + custom pbufs that reference other (original) pbufs. Additionally set + IP_FRAG_USES_STATIC_BUF=0 as default to be on the safe side. + + 2010-06-15: Simon Goldschmidt + * dhcp.c: Fixed bug #29970: DHCP endian issue parsing option responses + + 2010-06-14: Simon Goldschmidt + * autoip.c: Fixed bug #30039: AutoIP does not reuse previous addresses + + 2010-06-12: Simon Goldschmidt + * dhcp.c: Fixed bug #30038: dhcp_network_changed doesn't reset AUTOIP coop + state + + 2010-05-17: Simon Goldschmidt + * netdb.c: Correctly NULL-terminate h_addr_list + + 2010-05-16: Simon Goldschmidt + * def.h/.c: changed the semantics of LWIP_PREFIX_BYTEORDER_FUNCS to prevent + "symbol already defined" i.e. when linking to winsock + + 2010-05-05: Simon Goldschmidt + * def.h, timers.c: Fixed bug #29769 (sys_check_timeouts: sys_now() may + overflow) + + 2010-04-21: Simon Goldschmidt + * api_msg.c: Fixed bug #29617 (sometime cause stall on delete listening + connection) + + 2010-03-28: Luca Ceresoli + * ip_addr.c/.h: patch #7143: Add a few missing const qualifiers + + 2010-03-27: Luca Ceresoli + * mib2.c: patch #7130: remove meaningless const qualifiers + + 2010-03-26: Simon Goldschmidt + * tcp_out.c: Make LWIP_NETIF_TX_SINGLE_PBUF work for TCP, too + + 2010-03-26: Simon Goldschmidt + * various files: Fixed compiling with different options disabled (TCP/UDP), + triggered by bug #29345; don't allocate acceptmbox if LWIP_TCP is disabled + + 2010-03-25: Simon Goldschmidt + * sockets.c: Fixed bug #29332: lwip_select() processes readset incorrectly + + 2010-03-25: Simon Goldschmidt + * tcp_in.c, test_tcp_oos.c: Fixed bug #29080: Correctly handle remote side + overrunning our rcv_wnd in ooseq case. + + 2010-03-22: Simon Goldschmidt + * tcp.c: tcp_listen() did not copy the pcb's prio. + + 2010-03-19: Simon Goldschmidt + * snmp_msg.c: Fixed bug #29256: SNMP Trap address was not correctly set + + 2010-03-14: Simon Goldschmidt + * opt.h, etharp.h: Fixed bug #29148 (Incorrect PBUF_POOL_BUFSIZE for ports + where ETH_PAD_SIZE > 0) by moving definition of ETH_PAD_SIZE to opt.h + and basing PBUF_LINK_HLEN on it. + + 2010-03-08: Simon Goldschmidt + * netif.c, ipv4/ip.c: task #10241 (AutoIP: don't break existing connections + when assiging routable address): when checking incoming packets and + aborting existing connection on address change, filter out link-local + addresses. + + 2010-03-06: Simon Goldschmidt + * sockets.c: Fixed LWIP_NETIF_TX_SINGLE_PBUF for LWIP_TCPIP_CORE_LOCKING + + 2010-03-06: Simon Goldschmidt + * ipv4/ip.c: Don't try to forward link-local addresses + + 2010-03-06: Simon Goldschmidt + * etharp.c: Fixed bug #29087: etharp: don't send packets for LinkLocal- + addresses to gw + + 2010-03-05: Simon Goldschmidt + * dhcp.c: Fixed bug #29072: Correctly set ciaddr based on message-type + and state. + + 2010-03-05: Simon Goldschmidt + * api_msg.c: Correctly set TCP_WRITE_FLAG_MORE when netconn_write is split + into multiple calls to tcp_write. + + 2010-02-21: Simon Goldschmidt + * opt.h, mem.h, dns.c: task #10140: Remove DNS_USES_STATIC_BUF (keep + the implementation of DNS_USES_STATIC_BUF==1) + + 2010-02-20: Simon Goldschmidt + * tcp.h, tcp.c, tcp_in.c, tcp_out.c: Task #10088: Correctly implement + close() vs. shutdown(). Now the application does not get any more + recv callbacks after calling tcp_close(). Added tcp_shutdown(). + + 2010-02-19: Simon Goldschmidt + * mem.c/.h, pbuf.c: Renamed mem_realloc() to mem_trim() to prevent + confusion with realloc() + + 2010-02-15: Simon Goldschmidt/Stephane Lesage + * netif.c/.h: Link status does not depend on LWIP_NETIF_LINK_CALLBACK + (fixes bug #28899) + + 2010-02-14: Simon Goldschmidt + * netif.c: Fixed bug #28877 (Duplicate ARP gratuitous packet with + LWIP_NETIF_LINK_CALLBACK set on) by only sending if both link- and + admin-status of a netif are up + + 2010-02-14: Simon Goldschmidt + * opt.h: Disable ETHARP_TRUST_IP_MAC by default since it slows down packet + reception and is not really necessary + + 2010-02-14: Simon Goldschmidt + * etharp.c/.h: Fixed ARP input processing: only add a new entry if a + request was directed as us (RFC 826, Packet Reception), otherwise + only update existing entries; internalized some functions + + 2010-02-14: Simon Goldschmidt + * netif.h, etharp.c, tcpip.c: Fixed bug #28183 (ARP and TCP/IP cannot be + disabled on netif used for PPPoE) by adding a new netif flag + (NETIF_FLAG_ETHERNET) that tells the stack the device is an ethernet + device but prevents usage of ARP (so that ethernet_input can be used + for PPPoE). + + 2010-02-12: Simon Goldschmidt + * netif.c: netif_set_link_up/down: only do something if the link state + actually changes + + 2010-02-12: Simon Goldschmidt/Stephane Lesage + * api_msg.c: Fixed bug #28865 (Cannot close socket/netconn in non-blocking + connect) + + 2010-02-12: Simon Goldschmidt + * mem.h: Fixed bug #28866 (mem_realloc function defined in mem.h) + + 2010-02-09: Simon Goldschmidt + * api_lib.c, api_msg.c, sockets.c, api.h, api_msg.h: Fixed bug #22110 + (recv() makes receive window update for data that wasn't received by + application) + + 2010-02-09: Simon Goldschmidt/Stephane Lesage + * sockets.c: Fixed bug #28853 (lwip_recvfrom() returns 0 on receive time-out + or any netconn_recv() error) + + 2010-02-09: Simon Goldschmidt + * ppp.c: task #10154 (PPP: Update snmp in/out counters for tx/rx packets) + + 2010-02-09: Simon Goldschmidt + * netif.c: For loopback packets, adjust the stats- and snmp-counters + for the loopback netif. + + 2010-02-08: Simon Goldschmidt + * igmp.c/.h, ip.h: Moved most defines from igmp.h to igmp.c for clarity + since they are not used anywhere else. + + 2010-02-08: Simon Goldschmidt (Stphane Lesage) + * igmp.c, igmp.h, stats.c, stats.h: Improved IGMP stats + (patch from bug #28798) + + 2010-02-08: Simon Goldschmidt (Stphane Lesage) + * igmp.c: Fixed bug #28798 (Error in "Max Response Time" processing) and + another bug when LWIP_RAND() returns zero. + + 2010-02-04: Simon Goldschmidt + * nearly every file: Use macros defined in ip_addr.h (some of them new) + to work with IP addresses (preparation for bug #27352 - Change ip_addr + from struct to typedef (u32_t) - and better code). + + 2010-01-31: Simon Goldschmidt + * netif.c: Don't call the link-callback from netif_set_up/down() since + this invalidly retriggers DHCP. + + 2010-01-29: Simon Goldschmidt + * ip_addr.h, inet.h, def.h, inet.c, def.c, more: Cleanly separate the + portability file inet.h and its contents from the stack: moved htonX- + functions to def.h (and the new def.c - they are not ipv4 dependent), + let inet.h depend on ip_addr.h and not the other way round. + This fixes bug #28732. + + 2010-01-28: Kieran Mansley + * tcp.c: Ensure ssthresh >= 2*MSS + + 2010-01-27: Simon Goldschmidt + * tcp.h, tcp.c, tcp_in.c: Fixed bug #27871: Calling tcp_abort() in recv + callback can lead to accessing unallocated memory. As a consequence, + ERR_ABRT means the application has called tcp_abort()! + + 2010-01-25: Simon Goldschmidt + * snmp_structs.h, msg_in.c: Partly fixed bug #22070 (MIB_OBJECT_WRITE_ONLY + not implemented in SNMP): write-only or not-accessible are still + returned by getnext (though not by get) + + 2010-01-24: Simon Goldschmidt + * snmp: Renamed the private mib node from 'private' to 'mib_private' to + not use reserved C/C++ keywords + + 2010-01-23: Simon Goldschmidt + * sockets.c: Fixed bug #28716: select() returns 0 after waiting for less + than 1 ms + + 2010-01-21: Simon Goldschmidt + * tcp.c, api_msg.c: Fixed bug #28651 (tcp_connect: no callbacks called + if tcp_enqueue fails) both in raw- and netconn-API + + 2010-01-19: Simon Goldschmidt + * api_msg.c: Fixed bug #27316: netconn: Possible deadlock in err_tcp + + 2010-01-18: Iordan Neshev/Simon Goldschmidt + * src/netif/ppp: reorganised PPP sourcecode to 2.3.11 including some + bugfix backports from 2.4.x. + + 2010-01-18: Simon Goldschmidt + * mem.c: Fixed bug #28679: mem_realloc calculates mem_stats wrong + + 2010-01-17: Simon Goldschmidt + * api_lib.c, api_msg.c, (api_msg.h, api.h, sockets.c, tcpip.c): + task #10102: "netconn: clean up conn->err threading issues" by adding + error return value to struct api_msg_msg + + 2010-01-17: Simon Goldschmidt + * api.h, api_lib.c, sockets.c: Changed netconn_recv() and netconn_accept() + to return err_t (bugs #27709 and #28087) + + 2010-01-14: Simon Goldschmidt + * ...: Use typedef for function prototypes throughout the stack. + + 2010-01-13: Simon Goldschmidt + * api_msg.h/.c, api_lib.c: Fixed bug #26672 (close connection when receive + window = 0) by correctly draining recvmbox/acceptmbox + + 2010-01-11: Simon Goldschmidt + * pap.c: Fixed bug #13315 (PPP PAP authentication can result in + erroneous callbacks) by copying the code from recent pppd + + 2010-01-10: Simon Goldschmidt + * raw.c: Fixed bug #28506 (raw_bind should filter received packets) + + 2010-01-10: Simon Goldschmidt + * tcp.h/.c: bug #28127 (remove call to tcp_output() from tcp_ack(_now)()) + + 2010-01-08: Simon Goldschmidt + * sockets.c: Fixed bug #28519 (lwip_recvfrom bug with len > 65535) + + 2010-01-08: Simon Goldschmidt + * dns.c: Copy hostname for DNS_LOCAL_HOSTLIST_IS_DYNAMIC==1 since string + passed to dns_local_addhost() might be volatile + + 2010-01-07: Simon Goldschmidt + * timers.c, tcp.h: Call tcp_timer_needed() with NO_SYS==1, too + + 2010-01-06: Simon Goldschmidt + * netdb.h: Fixed bug #28496: missing include guards in netdb.h + + 2009-12-31: Simon Goldschmidt + * many ppp files: Reorganised PPP source code from ucip structure to pppd + structure to easily compare our code against the pppd code (around v2.3.1) + + 2009-12-27: Simon Goldschmidt + * tcp_in.c: Another fix for bug #28241 (ooseq processing) and adapted + unit test + + +(STABLE-1.3.2) + + ++ New features: + + 2009-10-27 Simon Goldschmidt/Stephan Lesage + * netifapi.c/.h: Added netifapi_netif_set_addr() + + 2009-10-07 Simon Goldschmidt/Fabian Koch + * api_msg.c, netbuf.c/.h, opt.h: patch #6888: Patch for UDP Netbufs to + support dest-addr and dest-port (optional: LWIP_NETBUF_RECVINFO) + + 2009-08-26 Simon Goldschmidt/Simon Kallweit + * slipif.c/.h: bug #26397: SLIP polling support + + 2009-08-25 Simon Goldschmidt + * opt.h, etharp.h/.c: task #9033: Support IEEE 802.1q tagged frame (VLAN), + New configuration options ETHARP_SUPPORT_VLAN and ETHARP_VLAN_CHECK. + + 2009-08-25 Simon Goldschmidt + * ip_addr.h, netdb.c: patch #6900: added define ip_ntoa(struct ip_addr*) + + 2009-08-24 Jakob Stoklund Olesen + * autoip.c, dhcp.c, netif.c: patch #6725: Teach AutoIP and DHCP to respond + to netif_set_link_up(). + + 2009-08-23 Simon Goldschmidt + * tcp.h/.c: Added function tcp_debug_state_str() to convert a tcp state + to a human-readable string. + + ++ Bugfixes: + + 2009-12-24: Kieran Mansley + * tcp_in.c Apply patches from Oleg Tyshev to improve OOS processing + (BUG#28241) + + 2009-12-06: Simon Goldschmidt + * ppp.h/.c: Fixed bug #27079 (Yet another leak in PPP): outpacket_buf can + be statically allocated (like in ucip) + + 2009-12-04: Simon Goldschmidt (patch by Ioardan Neshev) + * pap.c: patch #6969: PPP: missing PAP authentication UNTIMEOUT + + 2009-12-03: Simon Goldschmidt + * tcp.h, tcp_in.c, tcp_out.c: Fixed bug #28106: dup ack for fast retransmit + could have non-zero length + + 2009-12-02: Simon Goldschmidt + * tcp_in.c: Fixed bug #27904: TCP sends too many ACKs: delay resetting + tcp_input_pcb until after calling the pcb's callbacks + + 2009-11-29: Simon Goldschmidt + * tcp_in.c: Fixed bug #28054: Two segments with FIN flag on the out-of- + sequence queue, also fixed PBUF_POOL leak in the out-of-sequence code + + 2009-11-29: Simon Goldschmidt + * pbuf.c: Fixed bug #28064: pbuf_alloc(PBUF_POOL) is not thread-safe by + queueing a call into tcpip_thread to free ooseq-bufs if the pool is empty + + 2009-11-26: Simon Goldschmidt + * tcp.h: Fixed bug #28098: Nagle can prevent fast retransmit from sending + segment + + 2009-11-26: Simon Goldschmidt + * tcp.h, sockets.c: Fixed bug #28099: API required to disable Nagle + algorithm at PCB level + + 2009-11-22: Simon Goldschmidt + * tcp_out.c: Fixed bug #27905: FIN isn't combined with data on unsent + + 2009-11-22: Simon Goldschmidt (suggested by Bill Auerbach) + * tcp.c: tcp_alloc: prevent increasing stats.err for MEMP_TCP_PCB when + reusing time-wait pcb + + 2009-11-20: Simon Goldschmidt (patch by Albert Bartel) + * sockets.c: Fixed bug #28062: Data received directly after accepting + does not wake up select + + 2009-11-11: Simon Goldschmidt + * netdb.h: Fixed bug #27994: incorrect define for freeaddrinfo(addrinfo) + + 2009-10-30: Simon Goldschmidt + * opt.h: Increased default value for TCP_MSS to 536, updated default + value for TCP_WND to 4*TCP_MSS to keep delayed ACK working. + + 2009-10-28: Kieran Mansley + * tcp_in.c, tcp_out.c, tcp.h: re-work the fast retransmission code + to follow algorithm from TCP/IP Illustrated + + 2009-10-27: Kieran Mansley + * tcp_in.c: fix BUG#27445: grow cwnd with every duplicate ACK + + 2009-10-25: Simon Goldschmidt + * tcp.h: bug-fix in the TCP_EVENT_RECV macro (has to call tcp_recved if + pcb->recv is NULL to keep rcv_wnd correct) + + 2009-10-25: Simon Goldschmidt + * tcp_in.c: Fixed bug #26251: RST process in TIME_WAIT TCP state + + 2009-10-23: Simon Goldschmidt (David Empson) + * tcp.c: Fixed bug #27783: Silly window avoidance for small window sizes + + 2009-10-21: Simon Goldschmidt + * tcp_in.c: Fixed bug #27215: TCP sent() callback gives leading and + trailing 1 byte len (SYN/FIN) + + 2009-10-21: Simon Goldschmidt + * tcp_out.c: Fixed bug #27315: zero window probe and FIN + + 2009-10-19: Simon Goldschmidt + * dhcp.c/.h: Minor code simplification (don't store received pbuf, change + conditional code to assert where applicable), check pbuf length before + testing for valid reply + + 2009-10-19: Simon Goldschmidt + * dhcp.c: Removed most calls to udp_connect since they aren't necessary + when using udp_sendto_if() - always stay connected to IP_ADDR_ANY. + + 2009-10-16: Simon Goldschmidt + * ip.c: Fixed bug #27390: Source IP check in ip_input() causes it to drop + valid DHCP packets -> allow 0.0.0.0 as source address when LWIP_DHCP is + enabled + + 2009-10-15: Simon Goldschmidt (Oleg Tyshev) + * tcp_in.c: Fixed bug #27329: dupacks by unidirectional data transmit + + 2009-10-15: Simon Goldschmidt + * api_lib.c: Fixed bug #27709: conn->err race condition on netconn_recv() + timeout + + 2009-10-15: Simon Goldschmidt + * autoip.c: Fixed bug #27704: autoip starts with wrong address + LWIP_AUTOIP_CREATE_SEED_ADDR() returned address in host byte order instead + of network byte order + + 2009-10-11 Simon Goldschmidt (Jrg Kesten) + * tcp_out.c: Fixed bug #27504: tcp_enqueue wrongly concatenates segments + which are not consecutive when retransmitting unacked segments + + 2009-10-09 Simon Goldschmidt + * opt.h: Fixed default values of some stats to only be enabled if used + Fixes bug #27338: sys_stats is defined when NO_SYS = 1 + + 2009-08-30 Simon Goldschmidt + * ip.c: Fixed bug bug #27345: "ip_frag() does not use the LWIP_NETIF_LOOPBACK + function" by checking for loopback before calling ip_frag + + 2009-08-25 Simon Goldschmidt + * dhcp.c: fixed invalid dependency to etharp_query if DHCP_DOES_ARP_CHECK==0 + + 2009-08-23 Simon Goldschmidt + * ppp.c: bug #27078: Possible memory leak in pppInit() + + 2009-08-23 Simon Goldschmidt + * netdb.c, dns.c: bug #26657: DNS, if host name is "localhost", result + is error. + + 2009-08-23 Simon Goldschmidt + * opt.h, init.c: bug #26649: TCP fails when TCP_MSS > TCP_SND_BUF + Fixed wrong parenthesis, added check in init.c + + 2009-08-23 Simon Goldschmidt + * ppp.c: bug #27266: wait-state debug message in pppMain occurs every ms + + 2009-08-23 Simon Goldschmidt + * many ppp files: bug #27267: Added include to string.h where needed + + 2009-08-23 Simon Goldschmidt + * tcp.h: patch #6843: tcp.h macro optimization patch (for little endian) + + +(STABLE-1.3.1) + + ++ New features: + + 2009-05-10 Simon Goldschmidt + * opt.h, sockets.c, pbuf.c, netbuf.h, pbuf.h: task #7013: Added option + LWIP_NETIF_TX_SINGLE_PBUF to try to create transmit packets from only + one pbuf to help MACs that don't support scatter-gather DMA. + + 2009-05-09 Simon Goldschmidt + * icmp.h, icmp.c: Shrinked ICMP code, added option to NOT check icoming + ECHO pbuf for size (just use it): LWIP_ICMP_ECHO_CHECK_INPUT_PBUF_LEN + + 2009-05-05 Simon Goldschmidt, Jakob Stoklund Olesen + * ip.h, ip.c: Added ip_current_netif() & ip_current_header() to receive + extended info about the currently received packet. + + 2009-04-27 Simon Goldschmidt + * sys.h: Made SYS_LIGHTWEIGHT_PROT and sys_now() work with NO_SYS=1 + + 2009-04-25 Simon Goldschmidt + * mem.c, opt.h: Added option MEM_USE_POOLS_TRY_BIGGER_POOL to try the next + bigger malloc pool if one is empty (only usable with MEM_USE_POOLS). + + 2009-04-21 Simon Goldschmidt + * dns.c, init.c, dns.h, opt.h: task #7507, patch #6786: DNS supports static + hosts table. New configuration options DNS_LOCAL_HOSTLIST and + DNS_LOCAL_HOSTLIST_IS_DYNAMIC. Also, DNS_LOOKUP_LOCAL_EXTERN() can be defined + as an external function for lookup. + + 2009-04-15 Simon Goldschmidt + * dhcp.c: patch #6763: Global DHCP XID can be redefined to something more unique + + 2009-03-31 Kieran Mansley + * tcp.c, tcp_out.c, tcp_in.c, sys.h, tcp.h, opts.h: add support for + TCP timestamp options, off by default. Rework tcp_enqueue() to + take option flags rather than specified option data + + 2009-02-18 Simon Goldschmidt + * cc.h: Added printf formatter for size_t: SZT_F + + 2009-02-16 Simon Goldschmidt (patch by Rishi Khan) + * icmp.c, opt.h: patch #6539: (configurable) response to broadcast- and multicast + pings + + 2009-02-12 Simon Goldschmidt + * init.h: Added LWIP_VERSION to get the current version of the stack + + 2009-02-11 Simon Goldschmidt (suggested by Gottfried Spitaler) + * opt.h, memp.h/.c: added MEMP_MEM_MALLOC to use mem_malloc/mem_free instead + of the pool allocator (can save code size with MEM_LIBC_MALLOC if libc-malloc + is otherwise used) + + 2009-01-28 Jonathan Larmour (suggested by Bill Bauerbach) + * ipv4/inet_chksum.c, ipv4/lwip/inet_chksum.h: inet_chksum_pseudo_partial() + is only used by UDPLITE at present, so conditionalise it. + + 2008-12-03 Simon Goldschmidt (base on patch from Luca Ceresoli) + * autoip.c: checked in (slightly modified) patch #6683: Customizable AUTOIP + "seed" address. This should reduce AUTOIP conflicts if + LWIP_AUTOIP_CREATE_SEED_ADDR is overridden. + + 2008-10-02 Jonathan Larmour and Rishi Khan + * sockets.c (lwip_accept): Return EWOULDBLOCK if would block on non-blocking + socket. + + 2008-06-30 Simon Goldschmidt + * mem.c, opt.h, stats.h: fixed bug #21433: Calling mem_free/pbuf_free from + interrupt context isn't safe: LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT allows + mem_free to run between mem_malloc iterations. Added illegal counter for + mem stats. + + 2008-06-27 Simon Goldschmidt + * stats.h/.c, some other files: patch #6483: stats module improvement: + Added defines to display each module's statistic individually, added stats + defines for MEM, MEMP and SYS modules, removed (unused) rexmit counter. + + 2008-06-17 Simon Goldschmidt + * err.h: patch #6459: Made err_t overridable to use a more efficient type + (define LWIP_ERR_T in cc.h) + + 2008-06-17 Simon Goldschmidt + * slipif.c: patch #6480: Added a configuration option for slipif for symmetry + to loopif + + 2008-06-17 Simon Goldschmidt (patch by Luca Ceresoli) + * netif.c, loopif.c, ip.c, netif.h, loopif.h, opt.h: Checked in slightly + modified version of patch # 6370: Moved loopif code to netif.c so that + loopback traffic is supported on all netifs (all local IPs). + Added option to limit loopback packets for each netifs. + + + ++ Bugfixes: + 2009-08-12 Kieran Mansley + * tcp_in.c, tcp.c: Fix bug #27209: handle trimming of segments when + out of window or out of order properly + + 2009-08-12 Kieran Mansley + * tcp_in.c: Fix bug #27199: use snd_wl2 instead of snd_wl1 + + 2009-07-28 Simon Goldschmidt + * mem.h: Fixed bug #27105: "realloc() cannot replace mem_realloc()"s + + 2009-07-27 Kieran Mansley + * api.h api_msg.h netdb.h sockets.h: add missing #include directives + + 2009-07-09 Kieran Mansley + * api_msg.c, sockets.c, api.h: BUG23240 use signed counters for + recv_avail and don't increment counters until message successfully + sent to mbox + + 2009-06-25 Kieran Mansley + * api_msg.c api.h: BUG26722: initialise netconn write variables + in netconn_alloc + + 2009-06-25 Kieran Mansley + * tcp.h: BUG26879: set ret value in TCP_EVENT macros when function is not set + + 2009-06-25 Kieran Mansley + * tcp.c, tcp_in.c, tcp_out.c, tcp.h: BUG26301 and BUG26267: correct + simultaneous close behaviour, and make snd_nxt have the same meaning + as in the RFCs. + + 2009-05-12 Simon Goldschmidt + * etharp.h, etharp.c, netif.c: fixed bug #26507: "Gratuitous ARP depends on + arp_table / uses etharp_query" by adding etharp_gratuitous() + + 2009-05-12 Simon Goldschmidt + * ip.h, ip.c, igmp.c: bug #26487: Added ip_output_if_opt that can add IP options + to the IP header (used by igmp_ip_output_if) + + 2009-05-06 Simon Goldschmidt + * inet_chksum.c: On little endian architectures, use LWIP_PLATFORM_HTONS (if + defined) for SWAP_BYTES_IN_WORD to speed up checksumming. + + 2009-05-05 Simon Goldschmidt + * sockets.c: bug #26405: Prematurely released semaphore causes lwip_select() + to crash + + 2009-05-04 Simon Goldschmidt + * init.c: snmp was not initialized in lwip_init() + + 2009-05-04 Frdric Bernon + * dhcp.c, netbios.c: Changes if IP_SOF_BROADCAST is enabled. + + 2009-05-03 Simon Goldschmidt + * tcp.h: bug #26349: Nagle algorithm doesn't send although segment is full + (and unsent->next == NULL) + + 2009-05-02 Simon Goldschmidt + * tcpip.h, tcpip.c: fixed tcpip_untimeout (does not need the time, broken after + 1.3.0 in CVS only) - fixes compilation of ppp_oe.c + + 2009-05-02 Simon Goldschmidt + * msg_in.c: fixed bug #25636: SNMPSET value is ignored for integer fields + + 2009-05-01 Simon Goldschmidt + * pap.c: bug #21680: PPP upap_rauthnak() drops legal NAK packets + + 2009-05-01 Simon Goldschmidt + * ppp.c: bug #24228: Memory corruption with PPP and DHCP + + 2009-04-29 Frdric Bernon + * raw.c, udp.c, init.c, opt.h, ip.h, sockets.h: bug #26309: Implement the + SO(F)_BROADCAST filter for all API layers. Avoid the unindented reception + of broadcast packets even when this option wasn't set. Port maintainers + which want to enable this filter have to set IP_SOF_BROADCAST=1 in opt.h. + If you want this option also filter broadcast on recv operations, you also + have to set IP_SOF_BROADCAST_RECV=1 in opt.h. + + 2009-04-28 Simon Goldschmidt, Jakob Stoklund Olesen + * dhcp.c: patch #6721, bugs #25575, #25576: Some small fixes to DHCP and + DHCP/AUTOIP cooperation + + 2009-04-25 Simon Goldschmidt, Oleg Tyshev + * tcp_out.c: bug #24212: Deadlocked tcp_retransmit due to exceeded pcb->cwnd + Fixed by sorting the unsent and unacked queues (segments are inserted at the + right place in tcp_output and tcp_rexmit). + + 2009-04-25 Simon Goldschmidt + * memp.c, mem.c, memp.h, mem_std.h: bug #26213 "Problem with memory allocation + when debugging": memp_sizes contained the wrong sizes (including sanity + regions); memp pools for MEM_USE_POOLS were too small + + 2009-04-24 Simon Goldschmidt, Frdric Bernon + * inet.c: patch #6765: Fix a small problem with the last changes (incorrect + behavior, with with ip address string not ended by a '\0', a space or a + end of line) + + 2009-04-19 Simon Goldschmidt + * rawapi.txt: Fixed bug #26069: Corrected documentation: if tcp_connect fails, + pcb->err is called, not pcb->connected (with an error code). + + 2009-04-19 Simon Goldschmidt + * tcp_out.c: Fixed bug #26236: "TCP options (timestamp) don't work with + no-copy-tcpwrite": deallocate option data, only concat segments with same flags + + 2009-04-19 Simon Goldschmidt + * tcp_out.c: Fixed bug #25094: "Zero-length pbuf" (options are now allocated + in the header pbuf, not the data pbuf) + + 2009-04-18 Simon Goldschmidt + * api_msg.c: fixed bug #25695: Segmentation fault in do_writemore() + + 2009-04-15 Simon Goldschmidt + * sockets.c: tried to fix bug #23559: lwip_recvfrom problem with tcp + + 2009-04-15 Simon Goldschmidt + * dhcp.c: task #9192: mem_free of dhcp->options_in and dhcp->msg_in + + 2009-04-15 Simon Goldschmidt + * ip.c, ip6.c, tcp_out.c, ip.h: patch #6808: Add a utility function + ip_hinted_output() (for smaller code mainly) + + 2009-04-15 Simon Goldschmidt + * inet.c: patch #6765: Supporting new line characters in inet_aton() + + 2009-04-15 Simon Goldschmidt + * dhcp.c: patch #6764: DHCP rebind and renew did not send hostnam option; + Converted constant OPTION_MAX_MSG_SIZE to netif->mtu, check if netif->mtu + is big enough in dhcp_start + + 2009-04-15 Simon Goldschmidt + * netbuf.c: bug #26027: netbuf_chain resulted in pbuf memory leak + + 2009-04-15 Simon Goldschmidt + * sockets.c, ppp.c: bug #25763: corrected 4 occurrences of SMEMCPY to MEMCPY + + 2009-04-15 Simon Goldschmidt + * sockets.c: bug #26121: set_errno can be overridden + + 2009-04-09 Kieran Mansley (patch from Luca Ceresoli ) + * init.c, opt.h: Patch#6774 TCP_QUEUE_OOSEQ breaks compilation when + LWIP_TCP==0 + + 2009-04-09 Kieran Mansley (patch from Roy Lee ) + * tcp.h: Patch#6802 Add do-while-clauses to those function like + macros in tcp.h + + 2009-03-31 Kieran Mansley + * tcp.c, tcp_in.c, tcp_out.c, tcp.h, opt.h: Rework the way window + updates are calculated and sent (BUG20515) + + * tcp_in.c: cope with SYN packets received during established states, + and retransmission of initial SYN. + + * tcp_out.c: set push bit correctly when tcp segments are merged + + 2009-03-27 Kieran Mansley + * tcp_out.c set window correctly on probes (correcting change made + yesterday) + + 2009-03-26 Kieran Mansley + * tcp.c, tcp_in.c, tcp.h: add tcp_abandon() to cope with dropping + connections where no reset required (bug #25622) + + * tcp_out.c: set TCP_ACK flag on keepalive and zero window probes + (bug #20779) + + 2009-02-18 Simon Goldschmidt (Jonathan Larmour and Bill Auerbach) + * ip_frag.c: patch #6528: the buffer used for IP_FRAG_USES_STATIC_BUF could be + too small depending on MEM_ALIGNMENT + + 2009-02-16 Simon Goldschmidt + * sockets.h/.c, api_*.h/.c: fixed arguments of socket functions to match the standard; + converted size argument of netconn_write to 'size_t' + + 2009-02-16 Simon Goldschmidt + * tcp.h, tcp.c: fixed bug #24440: TCP connection close problem on 64-bit host + by moving accept callback function pointer to TCP_PCB_COMMON + + 2009-02-12 Simon Goldschmidt + * dhcp.c: fixed bug #25345 (DHCPDECLINE is sent with "Maximum message size" + option) + + 2009-02-11 Simon Goldschmidt + * dhcp.c: fixed bug #24480 (releasing old udp_pdb and pbuf in dhcp_start) + + 2009-02-11 Simon Goldschmidt + * opt.h, api_msg.c: added configurable default valud for netconn->recv_bufsize: + RECV_BUFSIZE_DEFAULT (fixes bug #23726: pbuf pool exhaustion on slow recv()) + + 2009-02-10 Simon Goldschmidt + * tcp.c: fixed bug #25467: Listen backlog is not reset on timeout in SYN_RCVD: + Accepts_pending is decrease on a corresponding listen pcb when a connection + in state SYN_RCVD is close. + + 2009-01-28 Jonathan Larmour + * pbuf.c: reclaim pbufs from TCP out-of-sequence segments if we run + out of pool pbufs. + + 2008-12-19 Simon Goldschmidt + * many files: patch #6699: fixed some warnings on platform where sizeof(int) == 2 + + 2008-12-10 Tamas Somogyi, Frdric Bernon + * sockets.c: fixed bug #25051: lwip_recvfrom problem with udp: fromaddr and + port uses deleted netbuf. + + 2008-10-18 Simon Goldschmidt + * tcp_in.c: fixed bug ##24596: Vulnerability on faulty TCP options length + in tcp_parseopt + + 2008-10-15 Simon Goldschmidt + * ip_frag.c: fixed bug #24517: IP reassembly crashes on unaligned IP headers + by packing the struct ip_reass_helper. + + 2008-10-03 David Woodhouse, Jonathan Larmour + * etharp.c (etharp_arp_input): Fix type aliasing problem copying ip address. + + 2008-10-02 Jonathan Larmour + * dns.c: Hard-code structure sizes, to avoid issues on some compilers where + padding is included. + + 2008-09-30 Jonathan Larmour + * sockets.c (lwip_accept): check addr isn't NULL. If it's valid, do an + assertion check that addrlen isn't NULL. + + 2008-09-30 Jonathan Larmour + * tcp.c: Fix bug #24227, wrong error message in tcp_bind. + + 2008-08-26 Simon Goldschmidt + * inet.h, ip_addr.h: fixed bug #24132: Cross-dependency between ip_addr.h and + inet.h -> moved declaration of struct in_addr from ip_addr.h to inet.h + + 2008-08-14 Simon Goldschmidt + * api_msg.c: fixed bug #23847: do_close_internal references freed memory (when + tcp_close returns != ERR_OK) + + 2008-07-08 Frdric Bernon + * stats.h: Fix some build bugs introduced with patch #6483 (missing some parameters + in macros, mainly if MEM_STATS=0 and MEMP_STATS=0). + + 2008-06-24 Jonathan Larmour + * tcp_in.c: Fix for bug #23693 as suggested by Art R. Ensure cseg is unused + if tcp_seg_copy fails. + + 2008-06-17 Simon Goldschmidt + * inet_chksum.c: Checked in some ideas of patch #6460 (loop optimizations) + and created defines for swapping bytes and folding u32 to u16. + + 2008-05-30 Kieran Mansley + * tcp_in.c Remove redundant "if" statement, and use real rcv_wnd + rather than rcv_ann_wnd when deciding if packets are in-window. + Contributed by + + 2008-05-30 Kieran Mansley + * mem.h: Fix BUG#23254. Change macro definition of mem_* to allow + passing as function pointers when MEM_LIBC_MALLOC is defined. + + 2008-05-09 Jonathan Larmour + * err.h, err.c, sockets.c: Fix bug #23119: Reorder timeout error code to + stop it being treated as a fatal error. + + 2008-04-15 Simon Goldschmidt + * dhcp.c: fixed bug #22804: dhcp_stop doesn't clear NETIF_FLAG_DHCP + (flag now cleared) + + 2008-03-27 Simon Goldschmidt + * mem.c, tcpip.c, tcpip.h, opt.h: fixed bug #21433 (Calling mem_free/pbuf_free + from interrupt context isn't safe): set LWIP_USE_HEAP_FROM_INTERRUPT to 1 + in lwipopts.h or use pbuf_free_callback(p)/mem_free_callback(m) to free pbufs + or heap memory from interrupt context + + 2008-03-26 Simon Goldschmidt + * tcp_in.c, tcp.c: fixed bug #22249: division by zero could occur if a remote + host sent a zero mss as TCP option. + + +(STABLE-1.3.0) + + ++ New features: + + 2008-03-10 Jonathan Larmour + * inet_chksum.c: Allow choice of one of the sample algorithms to be + made from lwipopts.h. Fix comment on how to override LWIP_CHKSUM. + + 2008-01-22 Frdric Bernon + * tcp.c, tcp_in.c, tcp.h, opt.h: Rename LWIP_CALCULATE_EFF_SEND_MSS in + TCP_CALCULATE_EFF_SEND_MSS to have coherent TCP options names. + + 2008-01-14 Frdric Bernon + * rawapi.txt, api_msg.c, tcp.c, tcp_in.c, tcp.h: changes for task #7675 "Enable + to refuse data on a TCP_EVENT_RECV call". Important, behavior changes for the + tcp_recv callback (see rawapi.txt). + + 2008-01-14 Frdric Bernon, Marc Chaland + * ip.c: Integrate patch #6369" ip_input : checking before realloc". + + 2008-01-12 Frdric Bernon + * tcpip.h, tcpip.c, api.h, api_lib.c, api_msg.c, sockets.c: replace the field + netconn::sem per netconn::op_completed like suggested for the task #7490 + "Add return value to sys_mbox_post". + + 2008-01-12 Frdric Bernon + * api_msg.c, opt.h: replace DEFAULT_RECVMBOX_SIZE per DEFAULT_TCP_RECVMBOX_SIZE, + DEFAULT_UDP_RECVMBOX_SIZE and DEFAULT_RAW_RECVMBOX_SIZE (to optimize queues + sizes), like suggested for the task #7490 "Add return value to sys_mbox_post". + + 2008-01-10 Frdric Bernon + * tcpip.h, tcpip.c: add tcpip_callback_with_block function for the task #7490 + "Add return value to sys_mbox_post". tcpip_callback is always defined as + "blocking" ("block" parameter = 1). + + 2008-01-10 Frdric Bernon + * tcpip.h, tcpip.c, api.h, api_lib.c, api_msg.c, sockets.c: replace the field + netconn::mbox (sys_mbox_t) per netconn::sem (sys_sem_t) for the task #7490 + "Add return value to sys_mbox_post". + + 2008-01-05 Frdric Bernon + * sys_arch.txt, api.h, api_lib.c, api_msg.h, api_msg.c, tcpip.c, sys.h, opt.h: + Introduce changes for task #7490 "Add return value to sys_mbox_post" with some + modifications in the sys_mbox api: sys_mbox_new take a "size" parameters which + indicate the number of pointers query by the mailbox. There is three defines + in opt.h to indicate sizes for tcpip::mbox, netconn::recvmbox, and for the + netconn::acceptmbox. Port maintainers, you can decide to just add this new + parameter in your implementation, but to ignore it to keep the previous behavior. + The new sys_mbox_trypost function return a value to know if the mailbox is + full or if the message is posted. Take a look to sys_arch.txt for more details. + This new function is used in tcpip_input (so, can be called in an interrupt + context since the function is not blocking), and in recv_udp and recv_raw. + + 2008-01-04 Frdric Bernon, Simon Goldschmidt, Jonathan Larmour + * rawapi.txt, api.h, api_lib.c, api_msg.h, api_msg.c, sockets.c, tcp.h, tcp.c, + tcp_in.c, init.c, opt.h: rename backlog options with TCP_ prefix, limit the + "backlog" parameter in an u8_t, 0 is interpreted as "smallest queue", add + documentation in the rawapi.txt file. + + 2007-12-31 Kieran Mansley (based on patch from Per-Henrik Lundbolm) + * tcp.c, tcp_in.c, tcp_out.c, tcp.h: Add TCP persist timer + + 2007-12-31 Frdric Bernon, Luca Ceresoli + * autoip.c, etharp.c: ip_addr.h: Integrate patch #6348: "Broadcast ARP packets + in autoip". The change in etharp_raw could be removed, since all calls to + etharp_raw use ethbroadcast for the "ethdst_addr" parameter. But it could be + wrong in the future. + + 2007-12-30 Frdric Bernon, Tom Evans + * ip.c: Fix bug #21846 "LwIP doesn't appear to perform any IP Source Address + Filtering" reported by Tom Evans. + + 2007-12-21 Frdric Bernon, Simon Goldschmidt, Jonathan Larmour + * tcp.h, opt.h, api.h, api_msg.h, tcp.c, tcp_in.c, api_lib.c, api_msg.c, + sockets.c, init.c: task #7252: Implement TCP listen backlog: Warning: raw API + applications have to call 'tcp_accepted(pcb)' in their accept callback to + keep accepting new connections. + + 2007-12-13 Frdric Bernon + * api_msg.c, err.h, err.c, sockets.c, dns.c, dns.h: replace "enum dns_result" + by err_t type. Add a new err_t code "ERR_INPROGRESS". + + 2007-12-12 Frdric Bernon + * dns.h, dns.c, opt.h: move DNS options to the "right" place. Most visibles + are the one which have ram usage. + + 2007-12-05 Frdric Bernon + * netdb.c: add a LWIP_DNS_API_HOSTENT_STORAGE option to decide to use a static + set of variables (=0) or a local one (=1). In this last case, your port should + provide a function "struct hostent* sys_thread_hostent( struct hostent* h)" + which have to do a copy of "h" and return a pointer ont the "per-thread" copy. + + 2007-12-03 Simon Goldschmidt + * ip.c: ip_input: check if a packet is for inp first before checking all other + netifs on netif_list (speeds up packet receiving in most cases) + + 2007-11-30 Simon Goldschmidt + * udp.c, raw.c: task #7497: Sort lists (pcb, netif, ...) for faster access + UDP: move a (connected) pcb selected for input to the front of the list of + pcbs so that it is found faster next time. Same for RAW pcbs that have eaten + a packet. + + 2007-11-28 Simon Goldschmidt + * etharp.c, stats.c, stats.h, opt.h: Introduced ETHARP_STATS + + 2007-11-25 Simon Goldschmidt + * dhcp.c: dhcp_unfold_reply() uses pbuf_copy_partial instead of its own copy + algorithm. + + 2007-11-24 Simon Goldschmidt + * netdb.h, netdb.c, sockets.h/.c: Moved lwip_gethostbyname from sockets.c + to the new file netdb.c; included lwip_getaddrinfo. + + 2007-11-21 Simon Goldschmidt + * tcp.h, opt.h, tcp.c, tcp_in.c: implemented calculating the effective send-mss + based on the MTU of the netif used to send. Enabled by default. Disable by + setting LWIP_CALCULATE_EFF_SEND_MSS to 0. This fixes bug #21492. + + 2007-11-19 Frdric Bernon + * api_msg.c, dns.h, dns.c: Implement DNS_DOES_NAME_CHECK option (check if name + received match the name query), implement DNS_USES_STATIC_BUF (the place where + copy dns payload to parse the response), return an error if there is no place + for a new query, and fix some minor problems. + + 2007-11-16 Simon Goldschmidt + * new files: ipv4/inet.c, ipv4/inet_chksum.c, ipv6/inet6.c + removed files: core/inet.c, core/inet6.c + Moved inet files into ipv4/ipv6 directory; splitted inet.c/inet.h into + inet and chksum part; changed includes in all lwIP files as appropriate + + 2007-11-16 Simon Goldschmidt + * api.h, api_msg.h, api_lib.c, api_msg.c, socket.h, socket.c: Added sequential + dns resolver function for netconn api (netconn_gethostbyname) and socket api + (gethostbyname/gethostbyname_r). + + 2007-11-15 Jim Pettinato, Frdric Bernon + * opt.h, init.c, tcpip.c, dhcp.c, dns.h, dns.c: add DNS client for simple name + requests with RAW api interface. Initialization is done in lwip_init() with + build time options. DNS timer is added in tcpip_thread context. DHCP can set + DNS server ip addresses when options are received. You need to set LWIP_DNS=1 + in your lwipopts.h file (LWIP_DNS=0 in opt.h). DNS_DEBUG can be set to get + some traces with LWIP_DEBUGF. Sanity check have been added. There is a "todo" + list with points to improve. + + 2007-11-06 Simon Goldschmidt + * opt.h, mib2.c: Patch #6215: added ifAdminStatus write support (if explicitly + enabled by defining SNMP_SAFE_REQUESTS to 0); added code to check link status + for ifOperStatus if LWIP_NETIF_LINK_CALLBACK is defined. + + 2007-11-06 Simon Goldschmidt + * api.h, api_msg.h and dependent files: Task #7410: Removed the need to include + core header files in api.h (ip/tcp/udp/raw.h) to hide the internal + implementation from netconn api applications. + + 2007-11-03 Frdric Bernon + * api.h, api_lib.c, api_msg.c, sockets.c, opt.h: add SO_RCVBUF option for UDP & + RAW netconn. You need to set LWIP_SO_RCVBUF=1 in your lwipopts.h (it's disabled + by default). Netconn API users can use the netconn_recv_bufsize macro to access + it. This is a first release which have to be improve for TCP. Note it used the + netconn::recv_avail which need to be more "thread-safe" (note there is already + the problem for FIONREAD with lwip_ioctl/ioctlsocket). + + 2007-11-01 Frdric Bernon, Marc Chaland + * sockets.h, sockets.c, api.h, api_lib.c, api_msg.h, api_msg.c, tcp.h, tcp_out.c: + Integrate "patch #6250 : MSG_MORE flag for send". MSG_MORE is used at socket api + layer, NETCONN_MORE at netconn api layer, and TCP_WRITE_FLAG_MORE at raw api + layer. This option enable to delayed TCP PUSH flag on multiple "write" calls. + Note that previous "copy" parameter for "write" APIs is now called "apiflags". + + 2007-10-24 Frdric Bernon + * api.h, api_lib.c, api_msg.c: Add macro API_EVENT in the same spirit than + TCP_EVENT_xxx macros to get a code more readable. It could also help to remove + some code (like we have talk in "patch #5919 : Create compile switch to remove + select code"), but it could be done later. + + 2007-10-08 Simon Goldschmidt + * many files: Changed initialization: many init functions are not needed any + more since we now rely on the compiler initializing global and static + variables to zero! + + 2007-10-06 Simon Goldschmidt + * ip_frag.c, memp.c, mib2.c, ip_frag.h, memp_std.h, opt.h: Changed IP_REASSEMBLY + to enqueue the received pbufs so that multiple packets can be reassembled + simultaneously and no static reassembly buffer is needed. + + 2007-10-05 Simon Goldschmidt + * tcpip.c, etharp.h, etharp.c: moved ethernet_input from tcpip.c to etharp.c so + all netifs (or ports) can use it. + + 2007-10-05 Frdric Bernon + * netifapi.h, netifapi.c: add function netifapi_netif_set_default. Change the + common function to reduce a little bit the footprint (for all functions using + only the "netif" parameter). + + 2007-10-03 Frdric Bernon + * netifapi.h, netifapi.c: add functions netifapi_netif_set_up, netifapi_netif_set_down, + netifapi_autoip_start and netifapi_autoip_stop. Use a common function to reduce + a little bit the footprint (for all functions using only the "netif" parameter). + + 2007-09-15 Frdric Bernon + * udp.h, udp.c, sockets.c: Changes for "#20503 IGMP Improvement". Add IP_MULTICAST_IF + option in socket API, and a new field "multicast_ip" in "struct udp_pcb" (for + netconn and raw API users), only if LWIP_IGMP=1. Add getsockopt processing for + IP_MULTICAST_TTL and IP_MULTICAST_IF. + + 2007-09-10 Frdric Bernon + * snmp.h, mib2.c: enable to remove SNMP timer (which consumne several cycles + even when it's not necessary). snmp_agent.txt tell to call snmp_inc_sysuptime() + each 10ms (but, it's intrusive if you use sys_timeout feature). Now, you can + decide to call snmp_add_sysuptime(100) each 1000ms (which is bigger "step", but + call to a lower frequency). Or, you can decide to not call snmp_inc_sysuptime() + or snmp_add_sysuptime(), and to define the SNMP_GET_SYSUPTIME(sysuptime) macro. + This one is undefined by default in mib2.c. SNMP_GET_SYSUPTIME is called inside + snmp_get_sysuptime(u32_t *value), and enable to change "sysuptime" value only + when it's queried (any direct call to "sysuptime" is changed by a call to + snmp_get_sysuptime). + + 2007-09-09 Frdric Bernon, Bill Florac + * igmp.h, igmp.c, netif.h, netif.c, ip.c: To enable to have interfaces with IGMP, + and others without it, there is a new NETIF_FLAG_IGMP flag to set in netif->flags + if you want IGMP on an interface. igmp_stop() is now called inside netif_remove(). + igmp_report_groups() is now called inside netif_set_link_up() (need to have + LWIP_NETIF_LINK_CALLBACK=1) to resend reports once the link is up (avoid to wait + the next query message to receive the matching multicast streams). + + 2007-09-08 Frdric Bernon + * sockets.c, ip.h, api.h, tcp.h: declare a "struct ip_pcb" which only contains + IP_PCB. Add in the netconn's "pcb" union a "struct ip_pcb *ip;" (no size change). + Use this new field to access to common pcb fields (ttl, tos, so_options, etc...). + Enable to access to these fields with LWIP_TCP=0. + + 2007-09-05 Frdric Bernon + * udp.c, ipv4/icmp.c, ipv4/ip.c, ipv6/icmp.c, ipv6/ip6.c, ipv4/icmp.h, + ipv6/icmp.h, opt.h: Integrate "task #7272 : LWIP_ICMP option". The new option + LWIP_ICMP enable/disable ICMP module inside the IP stack (enable per default). + Be careful, disabling ICMP make your product non-compliant to RFC1122, but + help to reduce footprint, and to reduce "visibility" on the Internet. + + 2007-09-05 Frdric Bernon, Bill Florac + * opt.h, sys.h, tcpip.c, slipif.c, ppp.c, sys_arch.txt: Change parameters list + for sys_thread_new (see "task #7252 : Create sys_thread_new_ex()"). Two new + parameters have to be provided: a task name, and a task stack size. For this + one, since it's platform dependant, you could define the best one for you in + your lwipopts.h. For port maintainers, you can just add these new parameters + in your sys_arch.c file, and but it's not mandatory, use them in your OS + specific functions. + + 2007-09-05 Frdric Bernon + * inet.c, autoip.c, msg_in.c, msg_out.c, init.c: Move some build time checkings + inside init.c for task #7142 "Sanity check user-configurable values". + + 2007-09-04 Frdric Bernon, Bill Florac + * igmp.h, igmp.c, memp_std.h, memp.c, init.c, opt.h: Replace mem_malloc call by + memp_malloc, and use a new MEMP_NUM_IGMP_GROUP option (see opt.h to define the + value). It will avoid potential fragmentation problems, use a counter to know + how many times a group is used on an netif, and free it when all applications + leave it. MEMP_NUM_IGMP_GROUP got 8 as default value (and init.c got a sanity + check if LWIP_IGMP!=0). + + 2007-09-03 Frdric Bernon + * igmp.h, igmp.c, sockets.c, api_msg.c: Changes for "#20503 IGMP Improvement". + Initialize igmp_mac_filter to NULL in netif_add (this field should be set in + the netif's "init" function). Use the "imr_interface" field (for socket layer) + and/or the "interface" field (for netconn layer), for join/leave operations. + The igmp_join/leavegroup first parameter change from a netif to an ipaddr. + This field could be a netif's ipaddr, or "any" (same meaning than ip_addr_isany). + + 2007-08-30 Frdric Bernon + * Add netbuf.h, netbuf.c, Change api.h, api_lib.c: #7249 "Split netbuf functions + from api/api_lib". Now netbuf API is independant of netconn, and can be used + with other API (application based on raw API, or future "socket2" API). Ports + maintainers just have to add src/api/netbuf.c in their makefile/projects. + + 2007-08-30 Frdric Bernon, Jonathan Larmour + * init.c: Add first version of lwip_sanity_check for task #7142 "Sanity check + user-configurable values". + + 2007-08-29 Frdric Bernon + * igmp.h, igmp.c, tcpip.c, init.c, netif.c: change igmp_init and add igmp_start. + igmp_start is call inside netif_add. Now, igmp initialization is in the same + spirit than the others modules. Modify some IGMP debug traces. + + 2007-08-29 Frdric Bernon + * Add init.h, init.c, Change opt.h, tcpip.c: Task #7213 "Add a lwip_init function" + Add lwip_init function to regroup all modules initializations, and to provide + a place to add code for task #7142 "Sanity check user-configurable values". + Ports maintainers should remove direct initializations calls from their code, + and add init.c in their makefiles. Note that lwip_init() function is called + inside tcpip_init, but can also be used by raw api users since all calls are + disabled when matching options are disabled. Also note that their is new options + in opt.h, you should configure in your lwipopts.h (they are enabled per default). + + 2007-08-26 Marc Boucher + * api_msg.c: do_close_internal(): Reset the callbacks and arg (conn) to NULL + since they can under certain circumstances be called with an invalid conn + pointer after the connection has been closed (and conn has been freed). + + 2007-08-25 Frdric Bernon (Artem Migaev's Patch) + * netif.h, netif.c: Integrate "patch #6163 : Function to check if link layer is up". + Add a netif_is_link_up() function if LWIP_NETIF_LINK_CALLBACK option is set. + + 2007-08-22 Frdric Bernon + * netif.h, netif.c, opt.h: Rename LWIP_NETIF_CALLBACK in LWIP_NETIF_STATUS_CALLBACK + to be coherent with new LWIP_NETIF_LINK_CALLBACK option before next release. + + 2007-08-22 Frdric Bernon + * tcpip.h, tcpip.c, ethernetif.c, opt.h: remove options ETHARP_TCPIP_INPUT & + ETHARP_TCPIP_ETHINPUT, now, only "ethinput" code is supported, even if the + name is tcpip_input (we keep the name of 1.2.0 function). + + 2007-08-17 Jared Grubb + * memp_std.h, memp.h, memp.c, mem.c, stats.c: (Task #7136) Centralize mempool + settings into new memp_std.h and optional user file lwippools.h. This adds + more dynamic mempools, and allows the user to create an arbitrary number of + mempools for mem_malloc. + + 2007-08-16 Marc Boucher + * api_msg.c: Initialize newconn->state to NETCONN_NONE in accept_function; + otherwise it was left to NETCONN_CLOSE and sent_tcp() could prematurely + close the connection. + + 2007-08-16 Marc Boucher + * sockets.c: lwip_accept(): check netconn_peer() error return. + + 2007-08-16 Marc Boucher + * mem.c, mem.h: Added mem_calloc(). + + 2007-08-16 Marc Boucher + * tcpip.c, tcpip.h memp.c, memp.h: Added distinct memp (MEMP_TCPIP_MSG_INPKT) + for input packets to prevent floods from consuming all of MEMP_TCPIP_MSG + and starving other message types. + Renamed MEMP_TCPIP_MSG to MEMP_TCPIP_MSG_API + + 2007-08-16 Marc Boucher + * pbuf.c, pbuf.h, etharp.c, tcp_in.c, sockets.c: Split pbuf flags in pbuf + type and flgs (later renamed to flags). + Use enum pbuf_flag as pbuf_type. Renumber PBUF_FLAG_*. + Improved lwip_recvfrom(). TCP push now propagated. + + 2007-08-16 Marc Boucher + * ethernetif.c, contrib/ports/various: ethbroadcast now a shared global + provided by etharp. + + 2007-08-16 Marc Boucher + * ppp_oe.c ppp_oe.h, auth.c chap.c fsm.c lcp.c ppp.c ppp.h, + etharp.c ethernetif.c, etharp.h, opt.h tcpip.h, tcpip.c: + Added PPPoE support and various PPP improvements. + + 2007-07-25 Simon Goldschmidt + * api_lib.c, ip_frag.c, pbuf.c, api.h, pbuf.h: Introduced pbuf_copy_partial, + making netbuf_copy_partial use this function. + + 2007-07-25 Simon Goldschmidt + * tcp_in.c: Fix bug #20506: Slow start / initial congestion window starts with + 2 * mss (instead of 1 * mss previously) to comply with some newer RFCs and + other stacks. + + 2007-07-13 Jared Grubb (integrated by Frdric Bernon) + * opt.h, netif.h, netif.c, ethernetif.c: Add new configuration option to add + a link callback in the netif struct, and functions to handle it. Be carefull + for port maintainers to add the NETIF_FLAG_LINK_UP flag (like in ethernetif.c) + if you want to be sure to be compatible with future changes... + + 2007-06-30 Frdric Bernon + * sockets.h, sockets.c: Implement MSG_PEEK flag for recv/recvfrom functions. + + 2007-06-21 Simon Goldschmidt + * etharp.h, etharp.c: Combined etharp_request with etharp_raw for both + LWIP_AUTOIP =0 and =1 to remove redundant code. + + 2007-06-21 Simon Goldschmidt + * mem.c, memp.c, mem.h, memp.h, opt.h: task #6863: Introduced the option + MEM_USE_POOLS to use 4 pools with different sized elements instead of a + heap. This both prevents memory fragmentation and gives a higher speed + at the cost of more memory consumption. Turned off by default. + + 2007-06-21 Simon Goldschmidt + * api_lib.c, api_msg.c, api.h, api_msg.h: Converted the length argument of + netconn_write (and therefore also api_msg_msg.msg.w.len) from u16_t into + int to be able to send a bigger buffer than 64K with one time (mainly + used from lwip_send). + + 2007-06-21 Simon Goldschmidt + * tcp.h, api_msg.c: Moved the nagle algorithm from netconn_write/do_write + into a define (tcp_output_nagle) in tcp.h to provide it to raw api users, too. + + 2007-06-21 Simon Goldschmidt + * api.h, api_lib.c, api_msg.c: Fixed bug #20021: Moved sendbuf-processing in + netconn_write from api_lib.c to api_msg.c to also prevent multiple context- + changes on low memory or empty send-buffer. + + 2007-06-18 Simon Goldschmidt + * etharp.c, etharp.h: Changed etharp to use a defined hardware address length + of 6 to avoid loading netif->hwaddr_len every time (since this file is only + used for ethernet and struct eth_addr already had a defined length of 6). + + 2007-06-17 Simon Goldschmidt + * sockets.c, sockets.h: Implemented socket options SO_NO_CHECK for UDP sockets + to disable UDP checksum generation on transmit. + + 2007-06-13 Frdric Bernon, Simon Goldschmidt + * debug.h, api_msg.c: change LWIP_ERROR to use it to check errors like invalid + pointers or parameters, and let the possibility to redefined it in cc.h. Use + this macro to check "conn" parameter in api_msg.c functions. + + 2007-06-11 Simon Goldschmidt + * sockets.c, sockets.h: Added UDP lite support for sockets + + 2007-06-10 Simon Goldschmidt + * udp.h, opt.h, api_msg.c, ip.c, udp.c: Included switch LWIP_UDPLITE (enabled + by default) to switch off UDP-Lite support if not needed (reduces udp.c code + size) + + 2007-06-09 Dominik Spies (integrated by Frdric Bernon) + * autoip.h, autoip.c, dhcp.h, dhcp.c, netif.h, netif.c, etharp.h, etharp.c, opt.h: + AutoIP implementation available for IPv4, with new options LWIP_AUTOIP and + LWIP_DHCP_AUTOIP_COOP if you want to cooperate with DHCP. Some tips to adapt + (see TODO mark in the source code). + + 2007-06-09 Simon Goldschmidt + * etharp.h, etharp.c, ethernetif.c: Modified order of parameters for + etharp_output() to match netif->output so etharp_output() can be used + directly as netif->output to save one function call. + + 2007-06-08 Simon Goldschmidt + * netif.h, ethernetif.c, slipif.c, loopif.c: Added define + NETIF_INIT_SNMP(netif, type, speed) to initialize per-netif snmp variables, + added initialization of those to ethernetif, slipif and loopif. + + 2007-05-18 Simon Goldschmidt + * opt.h, ip_frag.c, ip_frag.h, ip.c: Added option IP_FRAG_USES_STATIC_BUF + (defaulting to off for now) that can be set to 0 to send fragmented + packets by passing PBUF_REFs down the stack. + + 2007-05-23 Frdric Bernon + * api_lib.c: Implement SO_RCVTIMEO for accept and recv on TCP + connections, such present in patch #5959. + + 2007-05-23 Frdric Bernon + * api.h, api_lib.c, api_msg.c, sockets.c: group the different NETCONN_UDPxxx + code in only one part... + + 2007-05-18 Simon Goldschmidt + * opt.h, memp.h, memp.c: Added option MEMP_OVERFLOW_CHECK to check for memp + elements to overflow. This is achieved by adding some bytes before and after + each pool element (increasing their size, of course), filling them with a + prominent value and checking them on freeing the element. + Set it to 2 to also check every element in every pool each time memp_malloc() + or memp_free() is called (slower but more helpful). + + 2007-05-10 Simon Goldschmidt + * opt.h, memp.h, memp.c, pbuf.c (see task #6831): use a new memp pool for + PBUF_POOL pbufs instead of the old pool implementation in pbuf.c to reduce + code size. + + 2007-05-11 Frdric Bernon + * sockets.c, api_lib.c, api_msg.h, api_msg.c, netifapi.h, netifapi.c, tcpip.c: + Include a function pointer instead of a table index in the message to reduce + footprint. Disable some part of lwip_send and lwip_sendto if some options are + not set (LWIP_TCP, LWIP_UDP, LWIP_RAW). + + 2007-05-10 Simon Goldschmidt + * *.h (except netif/ppp/*.h): Included patch #5448: include '#ifdef __cplusplus + \ extern "C" {' in all header files. Now you can write your application using + the lwIP stack in C++ and simply #include the core files. Note I have left + out the netif/ppp/*h header files for now, since I don't know which files are + included by applications and which are for internal use only. + + 2007-05-09 Simon Goldschmidt + * opt.h, *.c/*.h: Included patch #5920: Create define to override C-library + memcpy. 2 Defines are created: MEMCPY() for normal memcpy, SMEMCPY() for + situations where some compilers might inline the copy and save a function + call. Also replaced all calls to memcpy() with calls to (S)MEMCPY(). + + 2007-05-08 Simon Goldschmidt + * mem.h: If MEM_LIBC_MALLOC==1, allow the defines (e.g. mem_malloc() -> malloc()) + to be overriden in case the C-library malloc implementation is not protected + against concurrent access. + + 2007-05-04 Simon Goldschmidt (Atte Kojo) + * etharp.c: Introduced fast one-entry-cache to speed up ARP lookup when sending + multiple packets to the same host. + + 2007-05-04 Frdric Bernon, Jonathan Larmour + * sockets.c, api.h, api_lib.c, api_msg.h, api_msg.c: Fix bug #19162 "lwip_sento: a possible + to corrupt remote addr/port connection state". Reduce problems "not enought memory" with + netbuf (if we receive lot of datagrams). Improve lwip_sendto (only one exchange between + sockets api and api_msg which run in tcpip_thread context). Add netconn_sento function. + Warning, if you directly access to "fromaddr" & "fromport" field from netbuf struct, + these fields are now renamed "addr" & "port". + + 2007-04-11 Jonathan Larmour + * sys.h, api_lib.c: Provide new sys_mbox_tryfetch function. Require ports to provide new + sys_arch_mbox_tryfetch function to get a message if one is there, otherwise return + with SYS_MBOX_EMPTY. sys_arch_mbox_tryfetch can be implemented as a function-like macro + by the port in sys_arch.h if desired. + + 2007-04-06 Frdric Bernon, Simon Goldschmidt + * opt.h, tcpip.h, tcpip.c, netifapi.h, netifapi.c: New configuration option LWIP_NETIF_API + allow to use thread-safe functions to add/remove netif in list, and to start/stop dhcp + clients, using new functions from netifapi.h. Disable as default (no port change to do). + + 2007-04-05 Frdric Bernon + * sockets.c: remplace ENOBUFS errors on alloc_socket by ENFILE to be more BSD compliant. + + 2007-04-04 Simon Goldschmidt + * arch.h, api_msg.c, dhcp.c, msg_in.c, sockets.c: Introduced #define LWIP_UNUSED_ARG(x) + use this for and architecture-independent form to tell the compiler you intentionally + are not using this variable. Can be overriden in cc.h. + + 2007-03-28 Frdric Bernon + * opt.h, netif.h, dhcp.h, dhcp.c: New configuration option LWIP_NETIF_HOSTNAME allow to + define a hostname in netif struct (this is just a pointer, so, you can use a hardcoded + string, point on one of your's ethernetif field, or alloc a string you will free yourself). + It will be used by DHCP to register a client hostname, but can also be use when you call + snmp_set_sysname. + + 2007-03-28 Frdric Bernon + * netif.h, netif.c: A new NETIF_FLAG_ETHARP flag is defined in netif.h, to allow to + initialize a network interface's flag with. It tell this interface is an ethernet + device, and we can use ARP with it to do a "gratuitous ARP" (RFC 3220 "IP Mobility + Support for IPv4" section 4.6) when interface is "up" with netif_set_up(). + + 2007-03-26 Frdric Bernon, Jonathan Larmour + * opt.h, tcpip.c: New configuration option LWIP_ARP allow to disable ARP init at build + time if you only use PPP or SLIP. The default is enable. Note we don't have to call + etharp_init in your port's initilization sequence if you use tcpip.c, because this call + is done in tcpip_init function. + + 2007-03-22 Frdric Bernon + * stats.h, stats.c, msg_in.c: Stats counters can be change to u32_t if necessary with the + new option LWIP_STATS_LARGE. If you need this option, define LWIP_STATS_LARGE to 1 in + your lwipopts.h. More, unused counters are not defined in the stats structs, and not + display by stats_display(). Note that some options (SYS_STATS and RAW_STATS) are defined + but never used. Fix msg_in.c with the correct #if test for a stat display. + + 2007-03-21 Kieran Mansley + * netif.c, netif.h: Apply patch#4197 with some changes (originator: rireland@hmgsl.com). + Provides callback on netif up/down state change. + + 2007-03-11 Frdric Bernon, Mace Gael, Steve Reynolds + * sockets.h, sockets.c, api.h, api_lib.c, api_msg.h, api_msg.c, igmp.h, igmp.c, + ip.c, netif.h, tcpip.c, opt.h: + New configuration option LWIP_IGMP to enable IGMP processing. Based on only one + filter per all network interfaces. Declare a new function in netif to enable to + control the MAC filter (to reduce lwIP traffic processing). + + 2007-03-11 Frdric Bernon + * tcp.h, tcp.c, sockets.c, tcp_out.c, tcp_in.c, opt.h: Keepalive values can + be configured at run time with LWIP_TCP_KEEPALIVE, but don't change this + unless you know what you're doing (default are RFC1122 compliant). Note + that TCP_KEEPIDLE and TCP_KEEPINTVL have to be set in seconds. + + 2007-03-08 Frdric Bernon + * tcp.h: Keepalive values can be configured at compile time, but don't change + this unless you know what you're doing (default are RFC1122 compliant). + + 2007-03-08 Frdric Bernon + * sockets.c, api.h, api_lib.c, tcpip.c, sys.h, sys.c, err.c, opt.h: + Implement LWIP_SO_RCVTIMEO configuration option to enable/disable SO_RCVTIMEO + on UDP sockets/netconn. + + 2007-03-08 Simon Goldschmidt + * snmp_msg.h, msg_in.c: SNMP UDP ports can be configured at compile time. + + 2007-03-06 Frdric Bernon + * api.h, api_lib.c, sockets.h, sockets.c, tcpip.c, sys.h, sys.c, err.h: + Implement SO_RCVTIMEO on UDP sockets/netconn. + + 2007-02-28 Kieran Mansley (based on patch from Simon Goldschmidt) + * api_lib.c, tcpip.c, memp.c, memp.h: make API msg structs allocated + on the stack and remove the API msg type from memp + + 2007-02-26 Jonathan Larmour (based on patch from Simon Goldschmidt) + * sockets.h, sockets.c: Move socket initialization to new + lwip_socket_init() function. + NOTE: this changes the API with ports. Ports will have to be + updated to call lwip_socket_init() now. + + 2007-02-26 Jonathan Larmour (based on patch from Simon Goldschmidt) + * api_lib.c: Use memcpy in netbuf_copy_partial. + + + ++ Bug fixes: + + 2008-03-17 Frdric Bernon, Ed Kerekes + * igmp.h, igmp.c: Fix bug #22613 "IGMP iphdr problem" (could have + some problems to fill the IP header on some targets, use now the + ip.h macros to do it). + + 2008-03-13 Frdric Bernon + * sockets.c: Fix bug #22435 "lwip_recvfrom with TCP break;". Using + (lwip_)recvfrom with valid "from" and "fromlen" parameters, on a + TCP connection caused a crash. Note that using (lwip_)recvfrom + like this is a bit slow and that using (lwip)getpeername is the + good lwip way to do it (so, using recv is faster on tcp sockets). + + 2008-03-12 Frdric Bernon, Jonathan Larmour + * api_msg.c, contrib/apps/ping.c: Fix bug #22530 "api_msg.c's + recv_raw() does not consume data", and the ping sample (with + LWIP_SOCKET=1, the code did the wrong supposition that lwip_recvfrom + returned the IP payload, without the IP header). + + 2008-03-04 Jonathan Larmour + * mem.c, stats.c, mem.h: apply patch #6414 to avoid compiler errors + and/or warnings on some systems where mem_size_t and size_t differ. + * pbuf.c, ppp.c: Fix warnings on some systems with mem_malloc. + + 2008-03-04 Kieran Mansley (contributions by others) + * Numerous small compiler error/warning fixes from contributions to + mailing list after 1.3.0 release candidate made. + + 2008-01-25 Cui hengbin (integrated by Frdric Bernon) + * dns.c: Fix bug #22108 "DNS problem" caused by unaligned structures. + + 2008-01-15 Kieran Mansley + * tcp_out.c: BUG20511. Modify persist timer to start when we are + prevented from sending by a small send window, not just a zero + send window. + + 2008-01-09 Jonathan Larmour + * opt.h, ip.c: Rename IP_OPTIONS define to IP_OPTIONS_ALLOWED to avoid + conflict with Linux system headers. + + 2008-01-06 Jonathan Larmour + * dhcp.c: fix bug #19927: "DHCP NACK problem" by clearing any existing set IP + address entirely on receiving a DHCPNAK, and restarting discovery. + + 2007-12-21 Simon Goldschmidt + * sys.h, api_lib.c, api_msg.c, sockets.c: fix bug #21698: "netconn->recv_avail + is not protected" by using new macros for interlocked access to modify/test + netconn->recv_avail. + + 2007-12-20 Kieran Mansley (based on patch from Oleg Tyshev) + * tcp_in.c: fix bug# 21535 (nrtx not reset correctly in SYN_SENT state) + + 2007-12-20 Kieran Mansley (based on patch from Per-Henrik Lundbolm) + * tcp.c, tcp_in.c, tcp_out.c, tcp.h: fix bug #20199 (better handling + of silly window avoidance and prevent lwIP from shrinking the window) + + 2007-12-04 Simon Goldschmidt + * tcp.c, tcp_in.c: fix bug #21699 (segment leak in ooseq processing when last + data packet was lost): add assert that all segment lists are empty in + tcp_pcb_remove before setting pcb to CLOSED state; don't directly set CLOSED + state from LAST_ACK in tcp_process + + 2007-12-02 Simon Goldschmidt + * sockets.h: fix bug #21654: exclude definition of struct timeval from #ifndef FD_SET + If including for system-struct timeval, LWIP_TIMEVAL_PRIVATE now + has to be set to 0 in lwipopts.h + + 2007-12-02 Simon Goldschmidt + * api_msg.c, api_lib.c: fix bug #21656 (recvmbox problem in netconn API): always + allocate a recvmbox in netconn_new_with_proto_and_callback. For a tcp-listen + netconn, this recvmbox is later freed and a new mbox is allocated for acceptmbox. + This is a fix for thread-safety and allocates all items needed for a netconn + when the netconn is created. + + 2007-11-30 Simon Goldschmidt + * udp.c: first attempt to fix bug #21655 (DHCP doesn't work reliably with multiple + netifs): if LWIP_DHCP is enabled, UDP packets to DHCP_CLIENT_PORT are passed + to netif->dhcp->pcb only (if that exists) and not to any other pcb for the same + port (only solution to let UDP pcbs 'bind' to a netif instead of an IP address) + + 2007-11-27 Simon Goldschmidt + * ip.c: fixed bug #21643 (udp_send/raw_send don't fail if netif is down) by + letting ip_route only use netifs that are up. + + 2007-11-27 Simon Goldschmidt + * err.h, api_lib.c, api_msg.c, sockets.c: Changed error handling: ERR_MEM, ERR_BUF + and ERR_RTE are seen as non-fatal, all other errors are fatal. netconns and + sockets block most operations once they have seen a fatal error. + + 2007-11-27 Simon Goldschmidt + * udp.h, udp.c, dhcp.c: Implemented new function udp_sendto_if which takes the + netif to send as an argument (to be able to send on netifs that are down). + + 2007-11-26 Simon Goldschmidt + * tcp_in.c: Fixed bug #21582: pcb->acked accounting can be wrong when ACKs + arrive out-of-order + + 2007-11-21 Simon Goldschmidt + * tcp.h, tcp_out.c, api_msg.c: Fixed bug #20287: tcp_output_nagle sends too early + Fixed the nagle algorithm; nagle now also works for all raw API applications + and has to be explicitly disabled with 'tcp_pcb->flags |= TF_NODELAY' + + 2007-11-12 Frdric Bernon + * sockets.c, api.h, api_lib.c, api_msg.h, api_msg.c: Fixed bug #20900. Now, most + of the netconn_peer and netconn_addr processing is done inside tcpip_thread + context in do_getaddr. + + 2007-11-10 Simon Goldschmidt + * etharp.c: Fixed bug: assert fired when MEMP_ARP_QUEUE was empty (which can + happen any time). Now the packet simply isn't enqueued when out of memory. + + 2007-11-01 Simon Goldschmidt + * tcp.c, tcp_in.c: Fixed bug #21494: The send mss (pcb->mss) is set to 536 (or + TCP_MSS if that is smaller) as long as no MSS option is received from the + remote host. + + 2007-11-01 Simon Goldschmidt + * tcp.h, tcp.c, tcp_in.c: Fixed bug #21491: The MSS option sent (with SYN) + is now based on TCP_MSS instead of pcb->mss (on passive open now effectively + sending our configured TCP_MSS instead of the one received). + + 2007-11-01 Simon Goldschmidt + * tcp_in.c: Fixed bug #21181: On active open, the initial congestion window was + calculated based on the configured TCP_MSS, not on the MSS option received + with SYN+ACK. + + 2007-10-09 Simon Goldschmidt + * udp.c, inet.c, inet.h: Fixed UDPLite: send: Checksum was always generated too + short and also was generated wrong if checksum coverage != tot_len; + receive: checksum was calculated wrong if checksum coverage != tot_len + + 2007-10-08 Simon Goldschmidt + * mem.c: lfree was not updated in mem_realloc! + + 2007-10-07 Frdric Bernon + * sockets.c, api.h, api_lib.c: First step to fix "bug #20900 : Potential + crash error problem with netconn_peer & netconn_addr". VERY IMPORTANT: + this change cause an API breakage for netconn_addr, since a parameter + type change. Any compiler should cause an error without any changes in + yours netconn_peer calls (so, it can't be a "silent change"). It also + reduce a little bit the footprint for socket layer (lwip_getpeername & + lwip_getsockname use now a common lwip_getaddrname function since + netconn_peer & netconn_addr have the same parameters). + + 2007-09-20 Simon Goldschmidt + * tcp.c: Fixed bug #21080 (tcp_bind without check pcbs in TIME_WAIT state) + by checking tcp_tw_pcbs also + + 2007-09-19 Simon Goldschmidt + * icmp.c: Fixed bug #21107 (didn't reset IP TTL in ICMP echo replies) + + 2007-09-15 Mike Kleshov + * mem.c: Fixed bug #21077 (inaccuracy in calculation of lwip_stat.mem.used) + + 2007-09-06 Frdric Bernon + * several-files: replace some #include "arch/cc.h" by "lwip/arch.h", or simply remove + it as long as "lwip/opt.h" is included before (this one include "lwip/debug.h" which + already include "lwip/arch.h"). Like that, default defines are provided by "lwip/arch.h" + if they are not defined in cc.h, in the same spirit than "lwip/opt.h" for lwipopts.h. + + 2007-08-30 Frdric Bernon + * igmp.h, igmp.c: Some changes to remove some redundant code, add some traces, + and fix some coding style. + + 2007-08-28 Frdric Bernon + * tcpip.c: Fix TCPIP_MSG_INPKT processing: now, tcpip_input can be used for any + kind of packets. These packets are considered like Ethernet packets (payload + pointing to ethhdr) if the netif got the NETIF_FLAG_ETHARP flag. Else, packets + are considered like IP packets (payload pointing to iphdr). + + 2007-08-27 Frdric Bernon + * api.h, api_lib.c, api_msg.c: First fix for "bug #20900 : Potential crash error + problem with netconn_peer & netconn_addr". Introduce NETCONN_LISTEN netconn_state + and remove obsolete ones (NETCONN_RECV & NETCONN_ACCEPT). + + 2007-08-24 Kieran Mansley + * inet.c Modify (acc >> 16) test to ((acc >> 16) != 0) to help buggy + compiler (Paradigm C++) + + 2007-08-09 Frdric Bernon, Bill Florac + * stats.h, stats.c, igmp.h, igmp.c, opt.h: Fix for bug #20503 : IGMP Improvement. + Introduce IGMP_STATS to centralize statistics management. + + 2007-08-09 Frdric Bernon, Bill Florac + * udp.c: Fix for bug #20503 : IGMP Improvement. Enable to receive a multicast + packet on a udp pcb binded on an netif's IP address, and not on "any". + + 2007-08-09 Frdric Bernon, Bill Florac + * igmp.h, igmp.c, ip.c: Fix minor changes from bug #20503 : IGMP Improvement. + This is mainly on using lookup/lookfor, and some coding styles... + + 2007-07-26 Frdric Bernon (and "thedoctor") + * igmp.c: Fix bug #20595 to accept IGMPv3 "Query" messages. + + 2007-07-25 Simon Goldschmidt + * api_msg.c, tcp.c: Another fix for bug #20021: by not returning an error if + tcp_output fails in tcp_close, the code in do_close_internal gets simpler + (tcp_output is called again later from tcp timers). + + 2007-07-25 Simon Goldschmidt + * ip_frag.c: Fixed bug #20429: use the new pbuf_copy_partial instead of the old + copy_from_pbuf, which illegally modified the given pbuf. + + 2007-07-25 Simon Goldschmidt + * tcp_out.c: tcp_enqueue: pcb->snd_queuelen didn't work for chaine PBUF_RAMs: + changed snd_queuelen++ to snd_queuelen += pbuf_clen(p). + + 2007-07-24 Simon Goldschmidt + * api_msg.c, tcp.c: Fix bug #20480: Check the pcb passed to tcp_listen() for the + correct state (must be CLOSED). + + 2007-07-13 Thomas Taranowski (commited by Jared Grubb) + * memp.c: Fix bug #20478: memp_malloc returned NULL+MEMP_SIZE on failed + allocation. It now returns NULL. + + 2007-07-13 Frdric Bernon + * api_msg.c: Fix bug #20318: api_msg "recv" callbacks don't call pbuf_free in + all error cases. + + 2007-07-13 Frdric Bernon + * api_msg.c: Fix bug #20315: possible memory leak problem if tcp_listen failed, + because current code doesn't follow rawapi.txt documentation. + + 2007-07-13 Kieran Mansley + * src/core/tcp_in.c Apply patch#5741 from Oleg Tyshev to fix bug in + out of sequence processing of received packets + + 2007-07-03 Simon Goldschmidt + * nearly-all-files: Added assertions where PBUF_RAM pbufs are used and an + assumption is made that this pbuf is in one piece (i.e. not chained). These + assumptions clash with the possibility of converting to fully pool-based + pbuf implementations, where PBUF_RAM pbufs might be chained. + + 2007-07-03 Simon Goldschmidt + * api.h, api_lib.c, api_msg.c: Final fix for bug #20021 and some other problems + when closing tcp netconns: removed conn->sem, less context switches when + closing, both netconn_close and netconn_delete should safely close tcp + connections. + + 2007-07-02 Simon Goldschmidt + * ipv4/ip.h, ipv6/ip.h, opt.h, netif.h, etharp.h, ipv4/ip.c, netif.c, raw.c, + tcp_out.c, udp.c, etharp.c: Added option LWIP_NETIF_HWADDRHINT (default=off) + to cache ARP table indices with each pcb instead of single-entry cache for + the complete stack. + + 2007-07-02 Simon Goldschmidt + * tcp.h, tcp.c, tcp_in.c, tcp_out.c: Added some ASSERTS and casts to prevent + warnings when assigning to smaller types. + + 2007-06-28 Simon Goldschmidt + * tcp_out.c: Added check to prevent tcp_pcb->snd_queuelen from overflowing. + + 2007-06-28 Simon Goldschmidt + * tcp.h: Fixed bug #20287: Fixed nagle algorithm (sending was done too early if + a segment contained chained pbufs) + + 2007-06-28 Frdric Bernon + * autoip.c: replace most of rand() calls by a macro LWIP_AUTOIP_RAND which compute + a "pseudo-random" value based on netif's MAC and some autoip fields. It's always + possible to define this macro in your own lwipopts.h to always use C library's + rand(). Note that autoip_create_rand_addr doesn't use this macro. + + 2007-06-28 Frdric Bernon + * netifapi.h, netifapi.c, tcpip.h, tcpip.c: Update code to handle the option + LWIP_TCPIP_CORE_LOCKING, and do some changes to be coherent with last modifications + in api_lib/api_msg (use pointers and not type with table, etc...) + + 2007-06-26 Simon Goldschmidt + * udp.h: Fixed bug #20259: struct udp_hdr was lacking the packin defines. + + 2007-06-25 Simon Goldschmidt + * udp.c: Fixed bug #20253: icmp_dest_unreach was called with a wrong p->payload + for udp packets with no matching pcb. + + 2007-06-25 Simon Goldschmidt + * udp.c: Fixed bug #20220: UDP PCB search in udp_input(): a non-local match + could get udp input packets if the remote side matched. + + 2007-06-13 Simon Goldschmidt + * netif.c: Fixed bug #20180 (TCP pcbs listening on IP_ADDR_ANY could get + changed in netif_set_ipaddr if previous netif->ip_addr.addr was 0. + + 2007-06-13 Simon Goldschmidt + * api_msg.c: pcb_new sets conn->err if protocol is not implemented + -> netconn_new_..() does not allocate a new connection for unsupported + protocols. + + 2007-06-13 Frdric Bernon, Simon Goldschmidt + * api_lib.c: change return expression in netconn_addr and netconn_peer, because + conn->err was reset to ERR_OK without any reasons (and error was lost)... + + 2007-06-13 Frdric Bernon, Matthias Weisser + * opt.h, mem.h, mem.c, memp.c, pbuf.c, ip_frag.c, vj.c: Fix bug #20162. Rename + MEM_ALIGN in LWIP_MEM_ALIGN and MEM_ALIGN_SIZE in LWIP_MEM_ALIGN_SIZE to avoid + some macro names collision with some OS macros. + + 2007-06-11 Simon Goldschmidt + * udp.c: UDP Lite: corrected the use of chksum_len (based on RFC3828: if it's 0, + create checksum over the complete packet. On RX, if it's < 8 (and not 0), + discard the packet. Also removed the duplicate 'udphdr->chksum = 0' for both + UDP & UDP Lite. + + 2007-06-11 Srinivas Gollakota & Oleg Tyshev + * tcp_out.c: Fix for bug #20075 : "A problem with keep-alive timer and TCP flags" + where TCP flags wasn't initialized in tcp_keepalive. + + 2007-06-03 Simon Goldschmidt + * udp.c: udp_input(): Input pbuf was not freed if pcb had no recv function + registered, p->payload was modified without modifying p->len if sending + icmp_dest_unreach() (had no negative effect but was definitively wrong). + + 2007-06-03 Simon Goldschmidt + * icmp.c: Corrected bug #19937: For responding to an icmp echo request, icmp + re-used the input pbuf even if that didn't have enough space to include the + link headers. Now the space is tested and a new pbuf is allocated for the + echo response packet if the echo request pbuf isn't big enough. + + 2007-06-01 Simon Goldschmidt + * sockets.c: Checked in patch #5914: Moved sockopt processing into tcpip_thread. + + 2007-05-23 Frdric Bernon + * api_lib.c, sockets.c: Fixed bug #5958 for netconn_listen (acceptmbox only + allocated by do_listen if success) and netconn_accept errors handling. In + most of api_lib functions, we replace some errors checkings like "if (conn==NULL)" + by ASSERT, except for netconn_delete. + + 2007-05-23 Frdric Bernon + * api_lib.c: Fixed bug #5957 "Safe-thread problem inside netconn_recv" to return + an error code if it's impossible to fetch a pbuf on a TCP connection (and not + directly close the recvmbox). + + 2007-05-22 Simon Goldschmidt + * tcp.c: Fixed bug #1895 (tcp_bind not correct) by introducing a list of + bound but unconnected (and non-listening) tcp_pcbs. + + 2007-05-22 Frdric Bernon + * sys.h, sys.c, api_lib.c, tcpip.c: remove sys_mbox_fetch_timeout() (was only + used for LWIP_SO_RCVTIMEO option) and use sys_arch_mbox_fetch() instead of + sys_mbox_fetch() in api files. Now, users SHOULD NOT use internal lwIP features + like "sys_timeout" in their application threads. + + 2007-05-22 Frdric Bernon + * api.h, api_lib.c, api_msg.h, api_msg.c: change the struct api_msg_msg to see + which parameters are used by which do_xxx function, and to avoid "misusing" + parameters (patch #5938). + + 2007-05-22 Simon Goldschmidt + * api_lib.c, api_msg.c, raw.c, api.h, api_msg.h, raw.h: Included patch #5938: + changed raw_pcb.protocol from u16_t to u8_t since for IPv4 and IPv6, proto + is only 8 bits wide. This affects the api, as there, the protocol was + u16_t, too. + + 2007-05-18 Simon Goldschmidt + * memp.c: addition to patch #5913: smaller pointer was returned but + memp_memory was the same size -> did not save memory. + + 2007-05-16 Simon Goldschmidt + * loopif.c, slipif.c: Fix bug #19729: free pbuf if netif->input() returns + != ERR_OK. + + 2007-05-16 Simon Goldschmidt + * api_msg.c, udp.c: If a udp_pcb has a local_ip set, check if it is the same + as the one of the netif used for sending to prevent sending from old + addresses after a netif address gets changed (partly fixes bug #3168). + + 2007-05-16 Frdric Bernon + * tcpip.c, igmp.h, igmp.c: Fixed bug "#19800 : IGMP: igmp_tick() will not work + with NO_SYS=1". Note that igmp_init is always in tcpip_thread (and not in + tcpip_init) because we have to be sure that network interfaces are already + added (mac filter is updated only in igmp_init for the moment). + + 2007-05-16 Simon Goldschmidt + * mem.c, memp.c: Removed semaphores from memp, changed sys_sem_wait calls + into sys_arch_sem_wait calls to prevent timers from running while waiting + for the heap. This fixes bug #19167. + + 2007-05-13 Simon Goldschmidt + * tcp.h, sockets.h, sockets.c: Fixed bug from patch #5865 by moving the defines + for socket options (lwip_set/-getsockopt) used with level IPPROTO_TCP from + tcp.h to sockets.h. + + 2007-05-07 Simon Goldschmidt + * mem.c: Another attempt to fix bug #17922. + + 2007-05-04 Simon Goldschmidt + * pbuf.c, pbuf.h, etharp.c: Further update to ARP queueing: Changed pbuf_copy() + implementation so that it can be reused (don't allocate the target + pbuf inside pbuf_copy()). + + 2007-05-04 Simon Goldschmidt + * memp.c: checked in patch #5913: in memp_malloc() we can return memp as mem + to save a little RAM (next pointer of memp is not used while not in pool). + + 2007-05-03 "maq" + * sockets.c: Fix ioctl FIONREAD when some data remains from last recv. + (patch #3574). + + 2007-04-23 Simon Goldschmidt + * loopif.c, loopif.h, opt.h, src/netif/FILES: fix bug #2595: "loopif results + in NULL reference for incoming TCP packets". Loopif has to be configured + (using LWIP_LOOPIF_MULTITHREADING) to directly call netif->input() + (multithreading environments, e.g. netif->input() = tcpip_input()) or + putting packets on a list that is fed to the stack by calling loopif_poll() + (single-thread / NO_SYS / polling environment where e.g. + netif->input() = ip_input). + + 2007-04-17 Jonathan Larmour + * pbuf.c: Use s32_t in pbuf_realloc(), as an s16_t can't reliably hold + the difference between two u16_t's. + * sockets.h: FD_SETSIZE needs to match number of sockets, which is + MEMP_NUM_NETCONN in sockets.c right now. + + 2007-04-12 Jonathan Larmour + * icmp.c: Reset IP header TTL in ICMP ECHO responses (bug #19580). + + 2007-04-12 Kieran Mansley + * tcp.c, tcp_in.c, tcp_out.c, tcp.h: Modify way the retransmission + timer is reset to fix bug#19434, with help from Oleg Tyshev. + + 2007-04-11 Simon Goldschmidt + * etharp.c, pbuf.c, pbuf.h: 3rd fix for bug #11400 (arp-queuing): More pbufs than + previously thought need to be copied (everything but PBUF_ROM!). Cleaned up + pbuf.c: removed functions no needed any more (by etharp). + + 2007-04-11 Kieran Mansley + * inet.c, ip_addr.h, sockets.h, sys.h, tcp.h: Apply patch #5745: Fix + "Constant is long" warnings with 16bit compilers. Contributed by + avatar@mmlab.cse.yzu.edu.tw + + 2007-04-05 Frdric Bernon, Jonathan Larmour + * api_msg.c: Fix bug #16830: "err_tcp() posts to connection mailbox when no pend on + the mailbox is active". Now, the post is only done during a connect, and do_send, + do_write and do_join_leave_group don't do anything if a previous error was signaled. + + 2007-04-03 Frdric Bernon + * ip.c: Don't set the IP_DF ("Don't fragment") flag in the IP header in IP output + packets. See patch #5834. + + 2007-03-30 Frdric Bernon + * api_msg.c: add a "pcb_new" helper function to avoid redundant code, and to add + missing pcb allocations checking (in do_bind, and for each raw_new). Fix style. + + 2007-03-30 Frdric Bernon + * most of files: prefix all debug.h define with "LWIP_" to avoid any conflict with + others environment defines (these were too "generic"). + + 2007-03-28 Frdric Bernon + * api.h, api_lib.c, sockets.c: netbuf_ref doesn't check its internal pbuf_alloc call + result and can cause a crash. lwip_send now check netbuf_ref result. + + 2007-03-28 Simon Goldschmidt + * sockets.c Remove "#include " from sockets.c to avoid multiple + definition of macros (in errno.h and lwip/arch.h) if LWIP_PROVIDE_ERRNO is + defined. This is the way it should have been already (looking at + doc/sys_arch.txt) + + 2007-03-28 Kieran Mansley + * opt.h Change default PBUF_POOL_BUFSIZE (again) to accomodate default MSS + + IP and TCP headers *and* physical link headers + + 2007-03-26 Frdric Bernon (based on patch from Dmitry Potapov) + * api_lib.c: patch for netconn_write(), fixes a possible race condition which cause + to send some garbage. It is not a definitive solution, but the patch does solve + the problem for most cases. + + 2007-03-22 Frdric Bernon + * api_msg.h, api_msg.c: Remove obsolete API_MSG_ACCEPT and do_accept (never used). + + 2007-03-22 Frdric Bernon + * api_lib.c: somes resources couldn't be freed if there was errors during + netconn_new_with_proto_and_callback. + + 2007-03-22 Frdric Bernon + * ethernetif.c: update netif->input calls to check return value. In older ports, + it's a good idea to upgrade them, even if before, there could be another problem + (access to an uninitialized mailbox). + + 2007-03-21 Simon Goldschmidt + * sockets.c: fixed bug #5067 (essentialy a signed/unsigned warning fixed + by casting to unsigned). + + 2007-03-21 Frdric Bernon + * api_lib.c, api_msg.c, tcpip.c: integrate sys_mbox_fetch(conn->mbox, NULL) calls from + api_lib.c to tcpip.c's tcpip_apimsg(). Now, use a local variable and not a + dynamic one from memp to send tcpip_msg to tcpip_thread in a synchrone call. + Free tcpip_msg from tcpip_apimsg is not done in tcpip_thread. This give a + faster and more reliable communication between api_lib and tcpip. + + 2007-03-21 Frdric Bernon + * opt.h: Add LWIP_NETIF_CALLBACK (to avoid compiler warning) and set it to 0. + + 2007-03-21 Frdric Bernon + * api_msg.c, igmp.c, igmp.h: Fix C++ style comments + + 2007-03-21 Kieran Mansley + * opt.h Change default PBUF_POOL_BUFSIZE to accomodate default MSS + + IP and TCP headers + + 2007-03-21 Kieran Mansley + * Fix all uses of pbuf_header to check the return value. In some + cases just assert if it fails as I'm not sure how to fix them, but + this is no worse than before when they would carry on regardless + of the failure. + + 2007-03-21 Kieran Mansley + * sockets.c, igmp.c, igmp.h, memp.h: Fix C++ style comments and + comment out missing header include in icmp.c + + 2007-03-20 Frdric Bernon + * memp.h, stats.c: Fix stats_display function where memp_names table wasn't + synchronized with memp.h. + + 2007-03-20 Frdric Bernon + * tcpip.c: Initialize tcpip's mbox, and verify if initialized in tcpip_input, + tcpip_ethinput, tcpip_callback, tcpip_apimsg, to fix a init problem with + network interfaces. Also fix a compiler warning. + + 2007-03-20 Kieran Mansley + * udp.c: Only try and use pbuf_header() to make space for headers if + not a ROM or REF pbuf. + + 2007-03-19 Frdric Bernon + * api_msg.h, api_msg.c, tcpip.h, tcpip.c: Add return types to tcpip_apimsg() + and api_msg_post(). + + 2007-03-19 Frdric Bernon + * Remove unimplemented "memp_realloc" function from memp.h. + + 2007-03-11 Simon Goldschmidt + * pbuf.c: checked in patch #5796: pbuf_alloc: len field claculation caused + memory corruption. + + 2007-03-11 Simon Goldschmidt (based on patch from Dmitry Potapov) + * api_lib.c, sockets.c, api.h, api_msg.h, sockets.h: Fixed bug #19251 + (missing `const' qualifier in socket functions), to get more compatible to + standard POSIX sockets. + + 2007-03-11 Frdric Bernon (based on patch from Dmitry Potapov) + * sockets.c: Add asserts inside bind, connect and sendto to check input + parameters. Remove excessive set_errno() calls after get_socket(), because + errno is set inside of get_socket(). Move last sock_set_errno() inside + lwip_close. + + 2007-03-09 Simon Goldschmidt + * memp.c: Fixed bug #11400: New etharp queueing introduced bug: memp_memory + was allocated too small. + + 2007-03-06 Simon Goldschmidt + * tcpip.c: Initialize dhcp timers in tcpip_thread (if LWIP_DHCP) to protect + the stack from concurrent access. + + 2007-03-06 Frdric Bernon, Dmitry Potapov + * tcpip.c, ip_frag.c, ethernetif.c: Fix some build problems, and a redundancy + call to "lwip_stats.link.recv++;" in low_level_input() & ethernetif_input(). + + 2007-03-06 Simon Goldschmidt + * ip_frag.c, ip_frag.h: Reduce code size: don't include code in those files + if IP_FRAG == 0 and IP_REASSEMBLY == 0 + + 2007-03-06 Frdric Bernon, Simon Goldschmidt + * opt.h, ip_frag.h, tcpip.h, tcpip.c, ethernetif.c: add new configuration + option named ETHARP_TCPIP_ETHINPUT, which enable the new tcpip_ethinput. + Allow to do ARP processing for incoming packets inside tcpip_thread + (protecting ARP layer against concurrent access). You can also disable + old code using tcp_input with new define ETHARP_TCPIP_INPUT set to 0. + Older ports have to use tcpip_ethinput. + + 2007-03-06 Simon Goldschmidt (based on patch from Dmitry Potapov) + * err.h, err.c: fixed compiler warning "initialization dircards qualifiers + from pointer target type" + + 2007-03-05 Frdric Bernon + * opt.h, sockets.h: add new configuration options (LWIP_POSIX_SOCKETS_IO_NAMES, + ETHARP_TRUST_IP_MAC, review SO_REUSE) + + 2007-03-04 Frdric Bernon + * api_msg.c: Remove some compiler warnings : parameter "pcb" was never + referenced. + + 2007-03-04 Frdric Bernon + * api_lib.c: Fix "[patch #5764] api_lib.c cleanup: after patch #5687" (from + Dmitry Potapov). + The api_msg struct stay on the stack (not moved to netconn struct). + + 2007-03-04 Simon Goldschmidt (based on patch from Dmitry Potapov) + * pbuf.c: Fix BUG#19168 - pbuf_free can cause deadlock (if + SYS_LIGHTWEIGHT_PROT=1 & freeing PBUF_RAM when mem_sem is not available) + Also fixed cast warning in pbuf_alloc() + + 2007-03-04 Simon Goldschmidt + * etharp.c, etharp.h, memp.c, memp.h, opt.h: Fix BUG#11400 - don't corrupt + existing pbuf chain when enqueuing multiple pbufs to a pending ARP request + + 2007-03-03 Frdric Bernon + * udp.c: remove obsolete line "static struct udp_pcb *pcb_cache = NULL;" + It is static, and never used in udp.c except udp_init(). + + 2007-03-02 Simon Goldschmidt + * tcpip.c: Moved call to ip_init(), udp_init() and tcp_init() from + tcpip_thread() to tcpip_init(). This way, raw API connections can be + initialized before tcpip_thread is running (e.g. before OS is started) + + 2007-03-02 Frdric Bernon + * rawapi.txt: Fix documentation mismatch with etharp.h about etharp_tmr's call + interval. + + 2007-02-28 Kieran Mansley + * pbuf.c: Fix BUG#17645 - ensure pbuf payload pointer is not moved + outside the region of the pbuf by pbuf_header() + + 2007-02-28 Kieran Mansley + * sockets.c: Fix BUG#19161 - ensure milliseconds timeout is non-zero + when supplied timeout is also non-zero + +(STABLE-1.2.0) + + 2006-12-05 Leon Woestenberg + * CHANGELOG: Mention STABLE-1.2.0 release. + + ++ New features: + + 2006-12-01 Christiaan Simons + * mem.h, opt.h: Added MEM_LIBC_MALLOC option. + Note this is a workaround. Currently I have no other options left. + + 2006-10-26 Christiaan Simons (accepted patch by Jonathan Larmour) + * ipv4/ip_frag.c: rename MAX_MTU to IP_FRAG_MAX_MTU and move define + to include/lwip/opt.h. + * ipv4/lwip/ip_frag.h: Remove unused IP_REASS_INTERVAL. + Move IP_REASS_MAXAGE and IP_REASS_BUFSIZE to include/lwip/opt.h. + * opt.h: Add above new options. + + 2006-08-18 Christiaan Simons + * tcp_{in,out}.c: added SNMP counters. + * ipv4/ip.c: added SNMP counters. + * ipv4/ip_frag.c: added SNMP counters. + + 2006-08-08 Christiaan Simons + * etharp.{c,h}: added etharp_find_addr() to read + (stable) ethernet/IP address pair from ARP table + + 2006-07-14 Christiaan Simons + * mib_structs.c: added + * include/lwip/snmp_structs.h: added + * netif.{c,h}, netif/ethernetif.c: added SNMP statistics to netif struct + + 2006-07-06 Christiaan Simons + * snmp/asn1_{enc,dec}.c added + * snmp/mib2.c added + * snmp/msg_{in,out}.c added + * include/lwip/snmp_asn1.h added + * include/lwip/snmp_msg.h added + * doc/snmp_agent.txt added + + 2006-03-29 Christiaan Simons + * inet.c, inet.h: Added platform byteswap support. + Added LWIP_PLATFORM_BYTESWAP define (defaults to 0) and + optional LWIP_PLATFORM_HTONS(), LWIP_PLATFORM_HTONL() macros. + + ++ Bug fixes: + + 2006-11-30 Christiaan Simons + * dhcp.c: Fixed false triggers of request_timeout. + + 2006-11-28 Christiaan Simons + * netif.c: In netif_add() fixed missing clear of ip_addr, netmask, gw and flags. + + 2006-10-11 Christiaan Simons + * api_lib.c etharp.c, ip.c, memp.c, stats.c, sys.{c,h} tcp.h: + Partially accepted patch #5449 for ANSI C compatibility / build fixes. + * ipv4/lwip/ip.h ipv6/lwip/ip.h: Corrected UDP-Lite protocol + identifier from 170 to 136 (bug #17574). + + 2006-10-10 Christiaan Simons + * api_msg.c: Fixed Nagle algorithm as reported by Bob Grice. + + 2006-08-17 Christiaan Simons + * udp.c: Fixed bug #17200, added check for broadcast + destinations for PCBs bound to a unicast address. + + 2006-08-07 Christiaan Simons + * api_msg.c: Flushing TCP output in do_close() (bug #15926). + + 2006-06-27 Christiaan Simons + * api_msg.c: Applied patch for cold case (bug #11135). + In accept_function() ensure newconn->callback is always initialized. + + 2006-06-15 Christiaan Simons + * mem.h: added MEM_SIZE_F alias to fix an ancient cold case (bug #1748), + facilitate printing of mem_size_t and u16_t statistics. + + 2006-06-14 Christiaan Simons + * api_msg.c: Applied patch #5146 to handle allocation failures + in accept() by Kevin Lawson. + + 2006-05-26 Christiaan Simons + * api_lib.c: Removed conn->sem creation and destruction + from netconn_write() and added sys_sem_new to netconn_new_*. + +(STABLE-1_1_1) + + 2006-03-03 Christiaan Simons + * ipv4/ip_frag.c: Added bound-checking assertions on ip_reassbitmap + access and added pbuf_alloc() return value checks. + + 2006-01-01 Leon Woestenberg + * tcp_{in,out}.c, tcp_out.c: Removed 'even sndbuf' fix in TCP, which is + now handled by the checksum routine properly. + + 2006-02-27 Leon Woestenberg + * pbuf.c: Fix alignment; pbuf_init() would not work unless + pbuf_pool_memory[] was properly aligned. (Patch by Curt McDowell.) + + 2005-12-20 Leon Woestenberg + * tcp.c: Remove PCBs which stay in LAST_ACK state too long. Patch + submitted by Mitrani Hiroshi. + + 2005-12-15 Christiaan Simons + * inet.c: Disabled the added summing routine to preserve code space. + + 2005-12-14 Leon Woestenberg + * tcp_in.c: Duplicate FIN ACK race condition fix by Kelvin Lawson. + Added Curt McDowell's optimized checksumming routine for future + inclusion. Need to create test case for unaliged, aligned, odd, + even length combination of cases on various endianess machines. + + 2005-12-09 Christiaan Simons + * inet.c: Rewrote standard checksum routine in proper portable C. + + 2005-11-25 Christiaan Simons + * udp.c tcp.c: Removed SO_REUSE hack. Should reside in socket code only. + * *.c: introduced cc.h LWIP_DEBUG formatters matching the u16_t, s16_t, + u32_t, s32_t typedefs. This solves most debug word-length assumes. + + 2005-07-17 Leon Woestenberg + * inet.c: Fixed unaligned 16-bit access in the standard checksum + routine by Peter Jolasson. + * slipif.c: Fixed implementation assumption of single-pbuf datagrams. + + 2005-02-04 Leon Woestenberg + * tcp_out.c: Fixed uninitialized 'queue' referenced in memerr branch. + * tcp_{out|in}.c: Applied patch fixing unaligned access. + + 2005-01-04 Leon Woestenberg + * pbuf.c: Fixed missing semicolon after LWIP_DEBUG statement. + + 2005-01-03 Leon Woestenberg + * udp.c: UDP pcb->recv() was called even when it was NULL. + +(STABLE-1_1_0) + + 2004-12-28 Leon Woestenberg + * etharp.*: Disabled multiple packets on the ARP queue. + This clashes with TCP queueing. + + 2004-11-28 Leon Woestenberg + * etharp.*: Fixed race condition from ARP request to ARP timeout. + Halved the ARP period, doubled the period counts. + ETHARP_MAX_PENDING now should be at least 2. This prevents + the counter from reaching 0 right away (which would allow + too little time for ARP responses to be received). + + 2004-11-25 Leon Woestenberg + * dhcp.c: Decline messages were not multicast but unicast. + * etharp.c: ETHARP_CREATE is renamed to ETHARP_TRY_HARD. + Do not try hard to insert arbitrary packet's source address, + etharp_ip_input() now calls etharp_update() without ETHARP_TRY_HARD. + etharp_query() now always DOES call ETHARP_TRY_HARD so that users + querying an address will see it appear in the cache (DHCP could + suffer from this when a server invalidly gave an in-use address.) + * ipv4/ip_addr.h: Renamed ip_addr_maskcmp() to _netcmp() as we are + comparing network addresses (identifiers), not the network masks + themselves. + * ipv4/ip_addr.c: ip_addr_isbroadcast() now checks that the given + IP address actually belongs to the network of the given interface. + + 2004-11-24 Kieran Mansley + * tcp.c: Increment pcb->snd_buf when ACK is received in SYN_SENT state. + +(STABLE-1_1_0-RC1) + + 2004-10-16 Kieran Mansley + * tcp.c: Add code to tcp_recved() to send an ACK (window update) immediately, + even if one is already pending, if the rcv_wnd is above a threshold + (currently TCP_WND/2). This avoids waiting for a timer to expire to send a + delayed ACK in order to open the window if the stack is only receiving data. + + 2004-09-12 Kieran Mansley + * tcp*.*: Retransmit time-out handling improvement by Sam Jansen. + + 2004-08-20 Tony Mountifield + * etharp.c: Make sure the first pbuf queued on an ARP entry + is properly ref counted. + + 2004-07-27 Tony Mountifield + * debug.h: Added (int) cast in LWIP_DEBUGF() to avoid compiler + warnings about comparison. + * pbuf.c: Stopped compiler complaining of empty if statement + when LWIP_DEBUGF() empty. Closed an unclosed comment. + * tcp.c: Stopped compiler complaining of empty if statement + when LWIP_DEBUGF() empty. + * ip.h Corrected IPH_TOS() macro: returns a byte, so doesn't need htons(). + * inet.c: Added a couple of casts to quiet the compiler. + No need to test isascii(c) before isdigit(c) or isxdigit(c). + + 2004-07-22 Tony Mountifield + * inet.c: Made data types consistent in inet_ntoa(). + Added casts for return values of checksum routines, to pacify compiler. + * ip_frag.c, tcp_out.c, sockets.c, pbuf.c + Small corrections to some debugging statements, to pacify compiler. + + 2004-07-21 Tony Mountifield + * etharp.c: Removed spurious semicolon and added missing end-of-comment. + * ethernetif.c Updated low_level_output() to match prototype for + netif->linkoutput and changed low_level_input() similarly for consistency. + * api_msg.c: Changed recv_raw() from int to u8_t, to match prototype + of raw_recv() in raw.h and so avoid compiler error. + * sockets.c: Added trivial (int) cast to keep compiler happier. + * ip.c, netif.c Changed debug statements to use the tidier ip4_addrN() macros. + +(STABLE-1_0_0) + + ++ Changes: + + 2004-07-05 Leon Woestenberg + * sockets.*: Restructured LWIP_PRIVATE_TIMEVAL. Make sure + your cc.h file defines this either 1 or 0. If non-defined, + defaults to 1. + * .c: Added and includes where used. + * etharp.c: Made some array indices unsigned. + + 2004-06-27 Leon Woestenberg + * netif.*: Added netif_set_up()/down(). + * dhcp.c: Changes to restart program flow. + + 2004-05-07 Leon Woestenberg + * etharp.c: In find_entry(), instead of a list traversal per candidate, do a + single-pass lookup for different candidates. Should exploit locality. + + 2004-04-29 Leon Woestenberg + * tcp*.c: Cleaned up source comment documentation for Doxygen processing. + * opt.h: ETHARP_ALWAYS_INSERT option removed to comply with ARP RFC. + * etharp.c: update_arp_entry() only adds new ARP entries when adviced to by + the caller. This deprecates the ETHARP_ALWAYS_INSERT overrule option. + + ++ Bug fixes: + + 2004-04-27 Leon Woestenberg + * etharp.c: Applied patch of bug #8708 by Toni Mountifield with a solution + suggested by Timmy Brolin. Fix for 32-bit processors that cannot access + non-aligned 32-bit words, such as soms 32-bit TCP/IP header fields. Fix + is to prefix the 14-bit Ethernet headers with two padding bytes. + + 2004-04-23 Leon Woestenberg + * ip_addr.c: Fix in the ip_addr_isbroadcast() check. + * etharp.c: Fixed the case where the packet that initiates the ARP request + is not queued, and gets lost. Fixed the case where the packets destination + address is already known; we now always queue the packet and perform an ARP + request. + +(STABLE-0_7_0) + + ++ Bug fixes: + + * Fixed TCP bug for SYN_SENT to ESTABLISHED state transition. + * Fixed TCP bug in dequeueing of FIN from out of order segment queue. + * Fixed two possible NULL references in rare cases. + +(STABLE-0_6_6) + + ++ Bug fixes: + + * Fixed DHCP which did not include the IP address in DECLINE messages. + + ++ Changes: + + * etharp.c has been hauled over a bit. + +(STABLE-0_6_5) + + ++ Bug fixes: + + * Fixed TCP bug induced by bad window resizing with unidirectional TCP traffic. + * Packets sent from ARP queue had invalid source hardware address. + + ++ Changes: + + * Pass-by ARP requests do now update the cache. + + ++ New features: + + * No longer dependent on ctype.h. + * New socket options. + * Raw IP pcb support. + +(STABLE-0_6_4) + + ++ Bug fixes: + + * Some debug formatters and casts fixed. + * Numereous fixes in PPP. + + ++ Changes: + + * DEBUGF now is LWIP_DEBUGF + * pbuf_dechain() has been re-enabled. + * Mentioned the changed use of CVS branches in README. + +(STABLE-0_6_3) + + ++ Bug fixes: + + * Fixed pool pbuf memory leak in pbuf_alloc(). + Occured if not enough PBUF_POOL pbufs for a packet pbuf chain. + Reported by Savin Zlobec. + + * PBUF_POOL chains had their tot_len field not set for non-first + pbufs. Fixed in pbuf_alloc(). + + ++ New features: + + * Added PPP stack contributed by Marc Boucher + + ++ Changes: + + * Now drops short packets for ICMP/UDP/TCP protocols. More robust. + + * ARP queueuing now queues the latest packet instead of the first. + This is the RFC recommended behaviour, but can be overridden in + lwipopts.h. + +(0.6.2) + + ++ Bugfixes: + + * TCP has been fixed to deal with the new use of the pbuf->ref + counter. + + * DHCP dhcp_inform() crash bug fixed. + + ++ Changes: + + * Removed pbuf_pool_free_cache and pbuf_pool_alloc_cache. Also removed + pbuf_refresh(). This has sped up pbuf pool operations considerably. + Implemented by David Haas. + +(0.6.1) + + ++ New features: + + * The packet buffer implementation has been enhanced to support + zero-copy and copy-on-demand for packet buffers which have their + payloads in application-managed memory. + Implemented by David Haas. + + Use PBUF_REF to make a pbuf refer to RAM. lwIP will use zero-copy + if an outgoing packet can be directly sent on the link, or perform + a copy-on-demand when necessary. + + The application can safely assume the packet is sent, and the RAM + is available to the application directly after calling udp_send() + or similar function. + + ++ Bugfixes: + + * ARP_QUEUEING should now correctly work for all cases, including + PBUF_REF. + Implemented by Leon Woestenberg. + + ++ Changes: + + * IP_ADDR_ANY is no longer a NULL pointer. Instead, it is a pointer + to a '0.0.0.0' IP address. + + * The packet buffer implementation is changed. The pbuf->ref counter + meaning has changed, and several pbuf functions have been + adapted accordingly. + + * netif drivers have to be changed to set the hardware address length field + that must be initialized correctly by the driver (hint: 6 for Ethernet MAC). + See the contrib/ports/c16x cs8900 driver as a driver example. + + * netif's have a dhcp field that must be initialized to NULL by the driver. + See the contrib/ports/c16x cs8900 driver as a driver example. + +(0.5.x) This file has been unmaintained up to 0.6.1. All changes are + logged in CVS but have not been explained here. + +(0.5.3) Changes since version 0.5.2 + + ++ Bugfixes: + + * memp_malloc(MEMP_API_MSG) could fail with multiple application + threads because it wasn't protected by semaphores. + + ++ Other changes: + + * struct ip_addr now packed. + + * The name of the time variable in arp.c has been changed to ctime + to avoid conflicts with the time() function. + +(0.5.2) Changes since version 0.5.1 + + ++ New features: + + * A new TCP function, tcp_tmr(), now handles both TCP timers. + + ++ Bugfixes: + + * A bug in tcp_parseopt() could cause the stack to hang because of a + malformed TCP option. + + * The address of new connections in the accept() function in the BSD + socket library was not handled correctly. + + * pbuf_dechain() did not update the ->tot_len field of the tail. + + * Aborted TCP connections were not handled correctly in all + situations. + + ++ Other changes: + + * All protocol header structs are now packed. + + * The ->len field in the tcp_seg structure now counts the actual + amount of data, and does not add one for SYN and FIN segments. + +(0.5.1) Changes since version 0.5.0 + + ++ New features: + + * Possible to run as a user process under Linux. + + * Preliminary support for cross platform packed structs. + + * ARP timer now implemented. + + ++ Bugfixes: + + * TCP output queue length was badly initialized when opening + connections. + + * TCP delayed ACKs were not sent correctly. + + * Explicit initialization of BSS segment variables. + + * read() in BSD socket library could drop data. + + * Problems with memory alignment. + + * Situations when all TCP buffers were used could lead to + starvation. + + * TCP MSS option wasn't parsed correctly. + + * Problems with UDP checksum calculation. + + * IP multicast address tests had endianess problems. + + * ARP requests had wrong destination hardware address. + + ++ Other changes: + + * struct eth_addr changed from u16_t[3] array to u8_t[6]. + + * A ->linkoutput() member was added to struct netif. + + * TCP and UDP ->dest_* struct members where changed to ->remote_*. + + * ntoh* macros are now null definitions for big endian CPUs. + +(0.5.0) Changes since version 0.4.2 + + ++ New features: + + * Redesigned operating system emulation layer to make porting easier. + + * Better control over TCP output buffers. + + * Documenation added. + + ++ Bugfixes: + + * Locking issues in buffer management. + + * Bugfixes in the sequential API. + + * IP forwarding could cause memory leakage. This has been fixed. + + ++ Other changes: + + * Directory structure somewhat changed; the core/ tree has been + collapsed. + +(0.4.2) Changes since version 0.4.1 + + ++ New features: + + * Experimental ARP implementation added. + + * Skeleton Ethernet driver added. + + * Experimental BSD socket API library added. + + ++ Bugfixes: + + * In very intense situations, memory leakage could occur. This has + been fixed. + + ++ Other changes: + + * Variables named "data" and "code" have been renamed in order to + avoid name conflicts in certain compilers. + + * Variable++ have in appliciable cases been translated to ++variable + since some compilers generate better code in the latter case. + +(0.4.1) Changes since version 0.4 + + ++ New features: + + * TCP: Connection attempts time out earlier than data + transmissions. Nagle algorithm implemented. Push flag set on the + last segment in a burst. + + * UDP: experimental support for UDP-Lite extensions. + + ++ Bugfixes: + + * TCP: out of order segments were in some cases handled incorrectly, + and this has now been fixed. Delayed acknowledgements was broken + in 0.4, has now been fixed. Binding to an address that is in use + now results in an error. Reset connections sometimes hung an + application; this has been fixed. + + * Checksum calculation sometimes failed for chained pbufs with odd + lengths. This has been fixed. + + * API: a lot of bug fixes in the API. The UDP API has been improved + and tested. Error reporting and handling has been + improved. Logical flaws and race conditions for incoming TCP + connections has been found and removed. + + * Memory manager: alignment issues. Reallocating memory sometimes + failed, this has been fixed. + + * Generic library: bcopy was flawed and has been fixed. + + ++ Other changes: + + * API: all datatypes has been changed from generic ones such as + ints, to specified ones such as u16_t. Functions that return + errors now have the correct type (err_t). + + * General: A lot of code cleaned up and debugging code removed. Many + portability issues have been fixed. + + * The license was changed; the advertising clause was removed. + + * C64 port added. + + * Thanks: Huge thanks go to Dagan Galarneau, Horst Garnetzke, Petri + Kosunen, Mikael Caleres, and Frits Wilmink for reporting and + fixing bugs! + +(0.4) Changes since version 0.3.1 + + * Memory management has been radically changed; instead of + allocating memory from a shared heap, memory for objects that are + rapidly allocated and deallocated is now kept in pools. Allocation + and deallocation from those memory pools is very fast. The shared + heap is still present but is used less frequently. + + * The memory, memory pool, and packet buffer subsystems now support + 4-, 2-, or 1-byte alignment. + + * "Out of memory" situations are handled in a more robust way. + + * Stack usage has been reduced. + + * Easier configuration of lwIP parameters such as memory usage, + TTLs, statistics gathering, etc. All configuration parameters are + now kept in a single header file "lwipopts.h". + + * The directory structure has been changed slightly so that all + architecture specific files are kept under the src/arch + hierarchy. + + * Error propagation has been improved, both in the protocol modules + and in the API. + + * The code for the RTXC architecture has been implemented, tested + and put to use. + + * Bugs have been found and corrected in the TCP, UDP, IP, API, and + the Internet checksum modules. + + * Bugs related to porting between a 32-bit and a 16-bit architecture + have been found and corrected. + + * The license has been changed slightly to conform more with the + original BSD license, including the advertisement clause. + +(0.3.1) Changes since version 0.3 + + * Fix of a fatal bug in the buffer management. Pbufs with allocated + RAM never returned the RAM when the pbuf was deallocated. + + * TCP congestion control, window updates and retransmissions did not + work correctly. This has now been fixed. + + * Bugfixes in the API. + +(0.3) Changes since version 0.2 + + * New and improved directory structure. All include files are now + kept in a dedicated include/ directory. + + * The API now has proper error handling. A new function, + netconn_err(), now returns an error code for the connection in + case of errors. + + * Improvements in the memory management subsystem. The system now + keeps a pointer to the lowest free memory block. A new function, + mem_malloc2() tries to allocate memory once, and if it fails tries + to free some memory and retry the allocation. + + * Much testing has been done with limited memory + configurations. lwIP now does a better job when overloaded. + + * Some bugfixes and improvements to the buffer (pbuf) subsystem. + + * Many bugfixes in the TCP code: + + - Fixed a bug in tcp_close(). + + - The TCP receive window was incorrectly closed when out of + sequence segments was received. This has been fixed. + + - Connections are now timed-out of the FIN-WAIT-2 state. + + - The initial congestion window could in some cases be too + large. This has been fixed. + + - The retransmission queue could in some cases be screwed up. This + has been fixed. + + - TCP RST flag now handled correctly. + + - Out of sequence data was in some cases never delivered to the + application. This has been fixed. + + - Retransmitted segments now contain the correct acknowledgment + number and advertised window. + + - TCP retransmission timeout backoffs are not correctly computed + (ala BSD). After a number of retransmissions, TCP now gives up + the connection. + + * TCP connections now are kept on three lists, one for active + connections, one for listening connections, and one for + connections that are in TIME-WAIT. This greatly speeds up the fast + timeout processing for sending delayed ACKs. + + * TCP now provides proper feedback to the application when a + connection has been successfully set up. + + * More comments have been added to the code. The code has also been + somewhat cleaned up. + +(0.2) Initial public release. diff --git a/lib/drivers/lwip/CMakeLists.txt b/lib/drivers/lwip/CMakeLists.txt new file mode 100644 index 00000000000..e7e0e28cbb7 --- /dev/null +++ b/lib/drivers/lwip/CMakeLists.txt @@ -0,0 +1,60 @@ +include_directories( + BEFORE include + ${REACTOS_SOURCE_DIR}/drivers/network/tcpip/include + ${REACTOS_SOURCE_DIR}/lib/drivers/lwip/src/include + ${REACTOS_SOURCE_DIR}/lib/drivers/lwip/src/include/ipv4) + +include_directories( + src/include + src/include/ipv4) + +list(APPEND SOURCE + src/rosip.c + src/rostcp.c + src/rosmem.c + src/sys_arch.c + src/api/api_lib.c + src/api/api_msg.c + src/api/err.c + src/api/netbuf.c + src/api/netdb.c + src/api/netifapi.c + src/api/sockets.c + src/api/tcpip.c + src/core/def.c + src/core/dhcp.c + src/core/dns.c + src/core/init.c + src/core/mem.c + src/core/memp.c + src/core/netif.c + src/core/pbuf.c + src/core/raw.c + src/core/stats.c + src/core/sys.c + src/core/tcp_in.c + src/core/tcp_out.c + src/core/tcp.c + src/core/timers.c + src/core/udp.c + src/core/ipv4/autoip.c + src/core/ipv4/icmp.c + src/core/ipv4/igmp.c + src/core/ipv4/inet_chksum.c + src/core/ipv4/inet.c + src/core/ipv4/ip.c + src/core/ipv4/ip_addr.c + src/core/ipv4/ip_frag.c + #src/core/ipv6/icmp6.c + #src/core/ipv6/inet6.c + #src/core/ipv6/ip6_addr.c + #src/core/ipv6/ip6.c + src/core/snmp/asn1_dec.c + src/core/snmp/asn1_enc.c + src/core/snmp/mib_structs.c + src/core/snmp/mib2.c + src/core/snmp/msg_in.c + src/core/snmp/msg_out.c) + +add_library(lwip ${SOURCE}) +add_dependencies(lwip bugcodes) diff --git a/lib/drivers/lwip/COPYING b/lib/drivers/lwip/COPYING new file mode 100644 index 00000000000..e23898b5e8f --- /dev/null +++ b/lib/drivers/lwip/COPYING @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2001, 2002 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ + + diff --git a/lib/drivers/lwip/FILES b/lib/drivers/lwip/FILES new file mode 100644 index 00000000000..66253196f92 --- /dev/null +++ b/lib/drivers/lwip/FILES @@ -0,0 +1,4 @@ +src/ - The source code for the lwIP TCP/IP stack. +doc/ - The documentation for lwIP. + +See also the FILES file in each subdirectory. diff --git a/lib/drivers/lwip/README b/lib/drivers/lwip/README new file mode 100644 index 00000000000..a62cc4f38c8 --- /dev/null +++ b/lib/drivers/lwip/README @@ -0,0 +1,89 @@ +INTRODUCTION + +lwIP is a small independent implementation of the TCP/IP protocol +suite that has been developed by Adam Dunkels at the Computer and +Networks Architectures (CNA) lab at the Swedish Institute of Computer +Science (SICS). + +The focus of the lwIP TCP/IP implementation is to reduce the RAM usage +while still having a full scale TCP. This making lwIP suitable for use +in embedded systems with tens of kilobytes of free RAM and room for +around 40 kilobytes of code ROM. + +FEATURES + + * IP (Internet Protocol) including packet forwarding over multiple network + interfaces + * ICMP (Internet Control Message Protocol) for network maintenance and debugging + * IGMP (Internet Group Management Protocol) for multicast traffic management + * UDP (User Datagram Protocol) including experimental UDP-lite extensions + * TCP (Transmission Control Protocol) with congestion control, RTT estimation + and fast recovery/fast retransmit + * Specialized raw/native API for enhanced performance + * Optional Berkeley-like socket API + * DNS (Domain names resolver) + * SNMP (Simple Network Management Protocol) + * DHCP (Dynamic Host Configuration Protocol) + * AUTOIP (for IPv4, conform with RFC 3927) + * PPP (Point-to-Point Protocol) + * ARP (Address Resolution Protocol) for Ethernet + +LICENSE + +lwIP is freely available under a BSD license. + +DEVELOPMENT + +lwIP has grown into an excellent TCP/IP stack for embedded devices, +and developers using the stack often submit bug fixes, improvements, +and additions to the stack to further increase its usefulness. + +Development of lwIP is hosted on Savannah, a central point for +software development, maintenance and distribution. Everyone can +help improve lwIP by use of Savannah's interface, CVS and the +mailing list. A core team of developers will commit changes to the +CVS source tree. + +The lwIP TCP/IP stack is maintained in the 'lwip' CVS module and +contributions (such as platform ports) are in the 'contrib' module. + +See doc/savannah.txt for details on CVS server access for users and +developers. + +Last night's CVS tar ball can be downloaded from: + http://savannah.gnu.org/cvs.backups/lwip.tar.gz [CHANGED - NEEDS FIXING] + +The current CVS trees are web-browsable: + http://savannah.nongnu.org/cgi-bin/viewcvs/lwip/lwip/ + http://savannah.nongnu.org/cgi-bin/viewcvs/lwip/contrib/ + +Submit patches and bugs via the lwIP project page: + http://savannah.nongnu.org/projects/lwip/ + + +DOCUMENTATION + +The original out-dated homepage of lwIP and Adam Dunkels' papers on +lwIP are at the official lwIP home page: + http://www.sics.se/~adam/lwip/ + +Self documentation of the source code is regularly extracted from the +current CVS sources and is available from this web page: + http://www.nongnu.org/lwip/ + +There is now a constantly growin wiki about lwIP at + http://lwip.wikia.com/wiki/LwIP_Wiki + +Also, there are mailing lists you can subscribe at + http://savannah.nongnu.org/mail/?group=lwip +plus searchable archives: + http://lists.nongnu.org/archive/html/lwip-users/ + http://lists.nongnu.org/archive/html/lwip-devel/ + +Reading Adam's papers, the files in docs/, browsing the source code +documentation and browsing the mailing list archives is a good way to +become familiar with the design of lwIP. + +Adam Dunkels +Leon Woestenberg + diff --git a/lib/drivers/lwip/UPGRADING b/lib/drivers/lwip/UPGRADING new file mode 100644 index 00000000000..215ad88d1e3 --- /dev/null +++ b/lib/drivers/lwip/UPGRADING @@ -0,0 +1,139 @@ +This file lists major changes between release versions that require +ports or applications to be changed. Use it to update a port or an +application written for an older version of lwIP to correctly work +with newer versions. + + +(CVS HEAD) + + * [Enter new changes just after this line - do not remove this line] + + ++ Application changes: + + * Replaced struct ip_addr by typedef ip_addr_t (struct ip_addr is kept for + compatibility to old applications, but will be removed in the future). + + * Renamed mem_realloc() to mem_trim() to prevent confusion with realloc() + + +++ Raw API: + * Changed the semantics of tcp_close() (since it was rather a + shutdown before): Now the application does *NOT* get any calls to the recv + callback (aside from NULL/closed) after calling tcp_close() + + * When calling tcp_abort() from a raw API TCP callback function, + make sure you return ERR_ABRT to prevent accessing unallocated memory. + (ERR_ABRT now means the applicaiton has called tcp_abort!) + + +++ Netconn API: + * Changed netconn_receive() and netconn_accept() to return + err_t, not a pointer to new data/netconn. + + +++ Socket API: + * LWIP_SO_RCVTIMEO: when accept() or recv() time out, they + now set errno to EWOULDBLOCK/EAGAIN, not ETIMEDOUT. + + * Added a minimal version of posix fctl() to have a + standardised way to set O_NONBLOCK for nonblocking sockets. + + +++ all APIs: + * correctly implemented SO(F)_REUSEADDR + + ++ Port changes + + +++ new files: + + * Added 4 new files: def.c, timers.c, timers.h, tcp_impl.h: + + * Moved stack-internal parts of tcp.h to tcp_impl.h, tcp.h now only contains + the actual application programmer's API + + * Separated timer implementation from sys.h/.c, moved to timers.h/.c; + Added timer implementation for NO_SYS==1, set NO_SYS_NO_TIMERS==1 if you + still want to use your own timer implementation for NO_SYS==0 (as before). + + +++ sys layer: + + * Converted mbox- and semaphore-functions to take pointers to sys_mbox_t/ + sys_sem_t; + + * Converted sys_mbox_new/sys_sem_new to take pointers and return err_t; + + * Added Mutex concept in sys_arch (define LWIP_COMPAT_MUTEX to let sys.h use + binary semaphores instead of mutexes - as before) + + +++ new options: + + * Don't waste memory when chaining segments, added option TCP_OVERSIZE to + prevent creating many small pbufs when calling tcp_write with many small + blocks of data. Instead, pbufs are allocated larger than needed and the + space is used for later calls to tcp_write. + + * Added LWIP_NETIF_TX_SINGLE_PBUF to always copy to try to create single pbufs + in tcp_write/udp_send. + + * Added an additional option LWIP_ETHERNET to support ethernet without ARP + (necessary for pure PPPoE) + + * Add MEMP_SEPARATE_POOLS to place memory pools in separate arrays. This may + be used to place these pools into user-defined memory by using external + declaration. + + * Added TCP_SNDQUEUELOWAT corresponding to TCP_SNDLOWAT + + +++ new pools: + + * Netdb uses a memp pool for allocating memory when getaddrinfo() is called, + so MEMP_NUM_NETDB has to be set accordingly. + + * DNS_LOCAL_HOSTLIST_IS_DYNAMIC uses a memp pool instead of the heap, so + MEMP_NUM_LOCALHOSTLIST has to be set accordingly. + + * Snmp-agent uses a memp pools instead of the heap, so MEMP_NUM_SNMP_* have + to be set accordingly. + + * PPPoE uses a MEMP pool instead of the heap, so MEMP_NUM_PPPOE_INTERFACES + has to be set accordingly + + * Integrated loopif into netif.c - loopif does not have to be created by the + port any more, just define LWIP_HAVE_LOOPIF to 1. + + * Added define LWIP_RAND() for lwip-wide randomization (needs to be defined + in cc.h, e.g. used by igmp) + + * Added printf-formatter X8_F to printf u8_t as hex + + * The heap now may be moved to user-defined memory by defining + LWIP_RAM_HEAP_POINTER as a void pointer to that memory's address + + * added autoip_set_struct() and dhcp_set_struct() to let autoip and dhcp work + with user-allocated structs instead of calling mem_malloc + + * Added const char* name to mem- and memp-stats for easier debugging. + + * Calculate the TCP/UDP checksum while copying to only fetch data once: + Define LWIP_CHKSUM_COPY to a memcpy-like function that returns the checksum + + * Added SO_REUSE_RXTOALL to pass received UDP broadcast/multicast packets to + more than one pcb. + + ++ Major bugfixes/improvements + + * Implemented tcp_shutdown() to only shut down one end of a connection + * Implemented shutdown() at socket- and netconn-level + * Added errorset support to select() + improved select speed overhead + * Merged pppd to v2.3.11 (including some backported bugfixes from 2.4.x) + * Added timer implementation for NO_SYS==1 (may be disabled with NO_SYS_NO_TIMERS==1 + * Use macros defined in ip_addr.h to work with IP addresses + * Implemented many nonblocking socket/netconn functions + * Fixed ARP input processing: only add a new entry if a request was directed as us + * mem_realloc() to mem_trim() to prevent confusion with realloc() + * Some improvements for AutoIP (don't route/forward link-local addresses, don't break + existing connections when assigning a routable address) + * Correctly handle remote side overrunning our rcv_wnd in ooseq case + * Removed packing from ip_addr_t, the packed version is now only used in protocol headers + * Corrected PBUF_POOL_BUFSIZE for ports where ETH_PAD_SIZE > 0 + * Added support for static ARP table entries + +(STABLE-1.3.2) + + * initial version of this file diff --git a/lib/drivers/lwip/doc/FILES b/lib/drivers/lwip/doc/FILES new file mode 100644 index 00000000000..05d356f4f9e --- /dev/null +++ b/lib/drivers/lwip/doc/FILES @@ -0,0 +1,6 @@ +savannah.txt - How to obtain the current development source code. +contrib.txt - How to contribute to lwIP as a developer. +rawapi.txt - The documentation for the core API of lwIP. + Also provides an overview about the other APIs and multithreading. +snmp_agent.txt - The documentation for the lwIP SNMP agent. +sys_arch.txt - The documentation for a system abstraction layer of lwIP. diff --git a/lib/drivers/lwip/doc/contrib.txt b/lib/drivers/lwip/doc/contrib.txt new file mode 100644 index 00000000000..39596fca335 --- /dev/null +++ b/lib/drivers/lwip/doc/contrib.txt @@ -0,0 +1,63 @@ +1 Introduction + +This document describes some guidelines for people participating +in lwIP development. + +2 How to contribute to lwIP + +Here is a short list of suggestions to anybody working with lwIP and +trying to contribute bug reports, fixes, enhancements, platform ports etc. +First of all as you may already know lwIP is a volunteer project so feedback +to fixes or questions might often come late. Hopefully the bug and patch tracking +features of Savannah help us not lose users' input. + +2.1 Source code style: + +1. do not use tabs. +2. indentation is two spaces per level (i.e. per tab). +3. end debug messages with a trailing newline (\n). +4. one space between keyword and opening bracket. +5. no space between function and opening bracket. +6. one space and no newline before opening curly braces of a block. +7. closing curly brace on a single line. +8. spaces surrounding assignment and comparisons. +9. don't initialize static and/or global variables to zero, the compiler takes care of that. +10. use current source code style as further reference. + +2.2 Source code documentation style: + +1. JavaDoc compliant and Doxygen compatible. +2. Function documentation above functions in .c files, not .h files. + (This forces you to synchronize documentation and implementation.) +3. Use current documentation style as further reference. + +2.3 Bug reports and patches: + +1. Make sure you are reporting bugs or send patches against the latest + sources. (From the latest release and/or the current CVS sources.) +2. If you think you found a bug make sure it's not already filed in the + bugtracker at Savannah. +3. If you have a fix put the patch on Savannah. If it is a patch that affects + both core and arch specific stuff please separate them so that the core can + be applied separately while leaving the other patch 'open'. The prefered way + is to NOT touch archs you can't test and let maintainers take care of them. + This is a good way to see if they are used at all - the same goes for unix + netifs except tapif. +4. Do not file a bug and post a fix to it to the patch area. Either a bug report + or a patch will be enough. + If you correct an existing bug then attach the patch to the bug rather than creating a new entry in the patch area. +5. Trivial patches (compiler warning, indentation and spelling fixes or anything obvious which takes a line or two) + can go to the lwip-users list. This is still the fastest way of interaction and the list is not so crowded + as to allow for loss of fixes. Putting bugs on Savannah and subsequently closing them is too much an overhead + for reporting a compiler warning fix. +6. Patches should be specific to a single change or to related changes.Do not mix bugfixes with spelling and other + trivial fixes unless the bugfix is trivial too.Do not reorganize code and rename identifiers in the same patch you + change behaviour if not necessary.A patch is easier to read and understand if it's to the point and short than + if it's not to the point and long :) so the chances for it to be applied are greater. + +2.4 Platform porters: + +1. If you have ported lwIP to a platform (an OS, a uC/processor or a combination of these) and + you think it could benefit others[1] you might want discuss this on the mailing list. You + can also ask for CVS access to submit and maintain your port in the contrib CVS module. + \ No newline at end of file diff --git a/lib/drivers/lwip/doc/rawapi.txt b/lib/drivers/lwip/doc/rawapi.txt new file mode 100644 index 00000000000..65f82bc5d19 --- /dev/null +++ b/lib/drivers/lwip/doc/rawapi.txt @@ -0,0 +1,504 @@ +Raw TCP/IP interface for lwIP + +Authors: Adam Dunkels, Leon Woestenberg, Christiaan Simons + +lwIP provides three Application Program's Interfaces (APIs) for programs +to use for communication with the TCP/IP code: +* low-level "core" / "callback" or "raw" API. +* higher-level "sequential" API. +* BSD-style socket API. + +The sequential API provides a way for ordinary, sequential, programs +to use the lwIP stack. It is quite similar to the BSD socket API. The +model of execution is based on the blocking open-read-write-close +paradigm. Since the TCP/IP stack is event based by nature, the TCP/IP +code and the application program must reside in different execution +contexts (threads). + +The socket API is a compatibility API for existing applications, +currently it is built on top of the sequential API. It is meant to +provide all functions needed to run socket API applications running +on other platforms (e.g. unix / windows etc.). However, due to limitations +in the specification of this API, there might be incompatibilities +that require small modifications of existing programs. + +** Threading + +lwIP started targeting single-threaded environments. When adding multi- +threading support, instead of making the core thread-safe, another +approach was chosen: there is one main thread running the lwIP core +(also known as the "tcpip_thread"). The raw API may only be used from +this thread! Application threads using the sequential- or socket API +communicate with this main thread through message passing. + + As such, the list of functions that may be called from + other threads or an ISR is very limited! Only functions + from these API header files are thread-safe: + - api.h + - netbuf.h + - netdb.h + - netifapi.h + - sockets.h + - sys.h + + Additionaly, memory (de-)allocation functions may be + called from multiple threads (not ISR!) with NO_SYS=0 + since they are protected by SYS_LIGHTWEIGHT_PROT and/or + semaphores. + + Only since 1.3.0, if SYS_LIGHTWEIGHT_PROT is set to 1 + and LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT is set to 1, + pbuf_free() may also be called from another thread or + an ISR (since only then, mem_free - for PBUF_RAM - may + be called from an ISR: otherwise, the HEAP is only + protected by semaphores). + + +** The remainder of this document discusses the "raw" API. ** + +The raw TCP/IP interface allows the application program to integrate +better with the TCP/IP code. Program execution is event based by +having callback functions being called from within the TCP/IP +code. The TCP/IP code and the application program both run in the same +thread. The sequential API has a much higher overhead and is not very +well suited for small systems since it forces a multithreaded paradigm +on the application. + +The raw TCP/IP interface is not only faster in terms of code execution +time but is also less memory intensive. The drawback is that program +development is somewhat harder and application programs written for +the raw TCP/IP interface are more difficult to understand. Still, this +is the preferred way of writing applications that should be small in +code size and memory usage. + +Both APIs can be used simultaneously by different application +programs. In fact, the sequential API is implemented as an application +program using the raw TCP/IP interface. + +--- Callbacks + +Program execution is driven by callbacks. Each callback is an ordinary +C function that is called from within the TCP/IP code. Every callback +function is passed the current TCP or UDP connection state as an +argument. Also, in order to be able to keep program specific state, +the callback functions are called with a program specified argument +that is independent of the TCP/IP state. + +The function for setting the application connection state is: + +- void tcp_arg(struct tcp_pcb *pcb, void *arg) + + Specifies the program specific state that should be passed to all + other callback functions. The "pcb" argument is the current TCP + connection control block, and the "arg" argument is the argument + that will be passed to the callbacks. + + +--- TCP connection setup + +The functions used for setting up connections is similar to that of +the sequential API and of the BSD socket API. A new TCP connection +identifier (i.e., a protocol control block - PCB) is created with the +tcp_new() function. This PCB can then be either set to listen for new +incoming connections or be explicitly connected to another host. + +- struct tcp_pcb *tcp_new(void) + + Creates a new connection identifier (PCB). If memory is not + available for creating the new pcb, NULL is returned. + +- err_t tcp_bind(struct tcp_pcb *pcb, struct ip_addr *ipaddr, + u16_t port) + + Binds the pcb to a local IP address and port number. The IP address + can be specified as IP_ADDR_ANY in order to bind the connection to + all local IP addresses. + + If another connection is bound to the same port, the function will + return ERR_USE, otherwise ERR_OK is returned. + +- struct tcp_pcb *tcp_listen(struct tcp_pcb *pcb) + + Commands a pcb to start listening for incoming connections. When an + incoming connection is accepted, the function specified with the + tcp_accept() function will be called. The pcb will have to be bound + to a local port with the tcp_bind() function. + + The tcp_listen() function returns a new connection identifier, and + the one passed as an argument to the function will be + deallocated. The reason for this behavior is that less memory is + needed for a connection that is listening, so tcp_listen() will + reclaim the memory needed for the original connection and allocate a + new smaller memory block for the listening connection. + + tcp_listen() may return NULL if no memory was available for the + listening connection. If so, the memory associated with the pcb + passed as an argument to tcp_listen() will not be deallocated. + +- struct tcp_pcb *tcp_listen_with_backlog(struct tcp_pcb *pcb, u8_t backlog) + + Same as tcp_listen, but limits the number of outstanding connections + in the listen queue to the value specified by the backlog argument. + To use it, your need to set TCP_LISTEN_BACKLOG=1 in your lwipopts.h. + +- void tcp_accepted(struct tcp_pcb *pcb) + + Inform lwIP that an incoming connection has been accepted. This would + usually be called from the accept callback. This allows lwIP to perform + housekeeping tasks, such as allowing further incoming connections to be + queued in the listen backlog. + +- void tcp_accept(struct tcp_pcb *pcb, + err_t (* accept)(void *arg, struct tcp_pcb *newpcb, + err_t err)) + + Specified the callback function that should be called when a new + connection arrives on a listening connection. + +- err_t tcp_connect(struct tcp_pcb *pcb, struct ip_addr *ipaddr, + u16_t port, err_t (* connected)(void *arg, + struct tcp_pcb *tpcb, + err_t err)); + + Sets up the pcb to connect to the remote host and sends the + initial SYN segment which opens the connection. + + The tcp_connect() function returns immediately; it does not wait for + the connection to be properly setup. Instead, it will call the + function specified as the fourth argument (the "connected" argument) + when the connection is established. If the connection could not be + properly established, either because the other host refused the + connection or because the other host didn't answer, the "err" + callback function of this pcb (registered with tcp_err, see below) + will be called. + + The tcp_connect() function can return ERR_MEM if no memory is + available for enqueueing the SYN segment. If the SYN indeed was + enqueued successfully, the tcp_connect() function returns ERR_OK. + + +--- Sending TCP data + +TCP data is sent by enqueueing the data with a call to +tcp_write(). When the data is successfully transmitted to the remote +host, the application will be notified with a call to a specified +callback function. + +- err_t tcp_write(struct tcp_pcb *pcb, void *dataptr, u16_t len, + u8_t copy) + + Enqueues the data pointed to by the argument dataptr. The length of + the data is passed as the len parameter. The copy argument is either + 0 or 1 and indicates whether the new memory should be allocated for + the data to be copied into. If the argument is 0, no new memory + should be allocated and the data should only be referenced by + pointer. + + The tcp_write() function will fail and return ERR_MEM if the length + of the data exceeds the current send buffer size or if the length of + the queue of outgoing segment is larger than the upper limit defined + in lwipopts.h. The number of bytes available in the output queue can + be retrieved with the tcp_sndbuf() function. + + The proper way to use this function is to call the function with at + most tcp_sndbuf() bytes of data. If the function returns ERR_MEM, + the application should wait until some of the currently enqueued + data has been successfully received by the other host and try again. + +- void tcp_sent(struct tcp_pcb *pcb, + err_t (* sent)(void *arg, struct tcp_pcb *tpcb, + u16_t len)) + + Specifies the callback function that should be called when data has + successfully been received (i.e., acknowledged) by the remote + host. The len argument passed to the callback function gives the + amount bytes that was acknowledged by the last acknowledgment. + + +--- Receiving TCP data + +TCP data reception is callback based - an application specified +callback function is called when new data arrives. When the +application has taken the data, it has to call the tcp_recved() +function to indicate that TCP can advertise increase the receive +window. + +- void tcp_recv(struct tcp_pcb *pcb, + err_t (* recv)(void *arg, struct tcp_pcb *tpcb, + struct pbuf *p, err_t err)) + + Sets the callback function that will be called when new data + arrives. The callback function will be passed a NULL pbuf to + indicate that the remote host has closed the connection. If + there are no errors and the callback function is to return + ERR_OK, then it must free the pbuf. Otherwise, it must not + free the pbuf so that lwIP core code can store it. + +- void tcp_recved(struct tcp_pcb *pcb, u16_t len) + + Must be called when the application has received the data. The len + argument indicates the length of the received data. + + +--- Application polling + +When a connection is idle (i.e., no data is either transmitted or +received), lwIP will repeatedly poll the application by calling a +specified callback function. This can be used either as a watchdog +timer for killing connections that have stayed idle for too long, or +as a method of waiting for memory to become available. For instance, +if a call to tcp_write() has failed because memory wasn't available, +the application may use the polling functionality to call tcp_write() +again when the connection has been idle for a while. + +- void tcp_poll(struct tcp_pcb *pcb, u8_t interval, + err_t (* poll)(void *arg, struct tcp_pcb *tpcb)) + + Specifies the polling interval and the callback function that should + be called to poll the application. The interval is specified in + number of TCP coarse grained timer shots, which typically occurs + twice a second. An interval of 10 means that the application would + be polled every 5 seconds. + + +--- Closing and aborting connections + +- err_t tcp_close(struct tcp_pcb *pcb) + + Closes the connection. The function may return ERR_MEM if no memory + was available for closing the connection. If so, the application + should wait and try again either by using the acknowledgment + callback or the polling functionality. If the close succeeds, the + function returns ERR_OK. + + The pcb is deallocated by the TCP code after a call to tcp_close(). + +- void tcp_abort(struct tcp_pcb *pcb) + + Aborts the connection by sending a RST (reset) segment to the remote + host. The pcb is deallocated. This function never fails. + + ATTENTION: When calling this from one of the TCP callbacks, make + sure you always return ERR_ABRT (and never return ERR_ABRT otherwise + or you will risk accessing deallocated memory or memory leaks! + + +If a connection is aborted because of an error, the application is +alerted of this event by the err callback. Errors that might abort a +connection are when there is a shortage of memory. The callback +function to be called is set using the tcp_err() function. + +- void tcp_err(struct tcp_pcb *pcb, void (* err)(void *arg, + err_t err)) + + The error callback function does not get the pcb passed to it as a + parameter since the pcb may already have been deallocated. + + +--- Lower layer TCP interface + +TCP provides a simple interface to the lower layers of the +system. During system initialization, the function tcp_init() has +to be called before any other TCP function is called. When the system +is running, the two timer functions tcp_fasttmr() and tcp_slowtmr() +must be called with regular intervals. The tcp_fasttmr() should be +called every TCP_FAST_INTERVAL milliseconds (defined in tcp.h) and +tcp_slowtmr() should be called every TCP_SLOW_INTERVAL milliseconds. + + +--- UDP interface + +The UDP interface is similar to that of TCP, but due to the lower +level of complexity of UDP, the interface is significantly simpler. + +- struct udp_pcb *udp_new(void) + + Creates a new UDP pcb which can be used for UDP communication. The + pcb is not active until it has either been bound to a local address + or connected to a remote address. + +- void udp_remove(struct udp_pcb *pcb) + + Removes and deallocates the pcb. + +- err_t udp_bind(struct udp_pcb *pcb, struct ip_addr *ipaddr, + u16_t port) + + Binds the pcb to a local address. The IP-address argument "ipaddr" + can be IP_ADDR_ANY to indicate that it should listen to any local IP + address. The function currently always return ERR_OK. + +- err_t udp_connect(struct udp_pcb *pcb, struct ip_addr *ipaddr, + u16_t port) + + Sets the remote end of the pcb. This function does not generate any + network traffic, but only set the remote address of the pcb. + +- err_t udp_disconnect(struct udp_pcb *pcb) + + Remove the remote end of the pcb. This function does not generate + any network traffic, but only removes the remote address of the pcb. + +- err_t udp_send(struct udp_pcb *pcb, struct pbuf *p) + + Sends the pbuf p. The pbuf is not deallocated. + +- void udp_recv(struct udp_pcb *pcb, + void (* recv)(void *arg, struct udp_pcb *upcb, + struct pbuf *p, + struct ip_addr *addr, + u16_t port), + void *recv_arg) + + Specifies a callback function that should be called when a UDP + datagram is received. + + +--- System initalization + +A truly complete and generic sequence for initializing the lwip stack +cannot be given because it depends on the build configuration (lwipopts.h) +and additional initializations for your runtime environment (e.g. timers). + +We can give you some idea on how to proceed when using the raw API. +We assume a configuration using a single Ethernet netif and the +UDP and TCP transport layers, IPv4 and the DHCP client. + +Call these functions in the order of appearance: + +- stats_init() + + Clears the structure where runtime statistics are gathered. + +- sys_init() + + Not of much use since we set the NO_SYS 1 option in lwipopts.h, + to be called for easy configuration changes. + +- mem_init() + + Initializes the dynamic memory heap defined by MEM_SIZE. + +- memp_init() + + Initializes the memory pools defined by MEMP_NUM_x. + +- pbuf_init() + + Initializes the pbuf memory pool defined by PBUF_POOL_SIZE. + +- etharp_init() + + Initializes the ARP table and queue. + Note: you must call etharp_tmr at a ARP_TMR_INTERVAL (5 seconds) regular interval + after this initialization. + +- ip_init() + + Doesn't do much, it should be called to handle future changes. + +- udp_init() + + Clears the UDP PCB list. + +- tcp_init() + + Clears the TCP PCB list and clears some internal TCP timers. + Note: you must call tcp_fasttmr() and tcp_slowtmr() at the + predefined regular intervals after this initialization. + +- netif_add(struct netif *netif, struct ip_addr *ipaddr, + struct ip_addr *netmask, struct ip_addr *gw, + void *state, err_t (* init)(struct netif *netif), + err_t (* input)(struct pbuf *p, struct netif *netif)) + + Adds your network interface to the netif_list. Allocate a struct + netif and pass a pointer to this structure as the first argument. + Give pointers to cleared ip_addr structures when using DHCP, + or fill them with sane numbers otherwise. The state pointer may be NULL. + + The init function pointer must point to a initialization function for + your ethernet netif interface. The following code illustrates it's use. + + err_t netif_if_init(struct netif *netif) + { + u8_t i; + + for(i = 0; i < ETHARP_HWADDR_LEN; i++) netif->hwaddr[i] = some_eth_addr[i]; + init_my_eth_device(); + return ERR_OK; + } + + For ethernet drivers, the input function pointer must point to the lwip + function ethernet_input() declared in "netif/etharp.h". Other drivers + must use ip_input() declared in "lwip/ip.h". + +- netif_set_default(struct netif *netif) + + Registers the default network interface. + +- netif_set_up(struct netif *netif) + + When the netif is fully configured this function must be called. + +- dhcp_start(struct netif *netif) + + Creates a new DHCP client for this interface on the first call. + Note: you must call dhcp_fine_tmr() and dhcp_coarse_tmr() at + the predefined regular intervals after starting the client. + + You can peek in the netif->dhcp struct for the actual DHCP status. + + +--- Optimalization hints + +The first thing you want to optimize is the lwip_standard_checksum() +routine from src/core/inet.c. You can override this standard +function with the #define LWIP_CHKSUM . + +There are C examples given in inet.c or you might want to +craft an assembly function for this. RFC1071 is a good +introduction to this subject. + +Other significant improvements can be made by supplying +assembly or inline replacements for htons() and htonl() +if you're using a little-endian architecture. +#define LWIP_PLATFORM_BYTESWAP 1 +#define LWIP_PLATFORM_HTONS(x) +#define LWIP_PLATFORM_HTONL(x) + +Check your network interface driver if it reads at +a higher speed than the maximum wire-speed. If the +hardware isn't serviced frequently and fast enough +buffer overflows are likely to occur. + +E.g. when using the cs8900 driver, call cs8900if_service(ethif) +as frequently as possible. When using an RTOS let the cs8900 interrupt +wake a high priority task that services your driver using a binary +semaphore or event flag. Some drivers might allow additional tuning +to match your application and network. + +For a production release it is recommended to set LWIP_STATS to 0. +Note that speed performance isn't influenced much by simply setting +high values to the memory options. + +For more optimization hints take a look at the lwIP wiki. + +--- Zero-copy MACs + +To achieve zero-copy on transmit, the data passed to the raw API must +remain unchanged until sent. Because the send- (or write-)functions return +when the packets have been enqueued for sending, data must be kept stable +after that, too. + +This implies that PBUF_RAM/PBUF_POOL pbufs passed to raw-API send functions +must *not* be reused by the application unless their ref-count is 1. + +For no-copy pbufs (PBUF_ROM/PBUF_REF), data must be kept unchanged, too, +but the stack/driver will/must copy PBUF_REF'ed data when enqueueing, while +PBUF_ROM-pbufs are just enqueued (as ROM-data is expected to never change). + +Also, data passed to tcp_write without the copy-flag must not be changed! + +Therefore, be careful which type of PBUF you use and if you copy TCP data +or not! diff --git a/lib/drivers/lwip/doc/savannah.txt b/lib/drivers/lwip/doc/savannah.txt new file mode 100644 index 00000000000..409905b10c6 --- /dev/null +++ b/lib/drivers/lwip/doc/savannah.txt @@ -0,0 +1,135 @@ +Daily Use Guide for using Savannah for lwIP + +Table of Contents: + +1 - Obtaining lwIP from the CVS repository +2 - Committers/developers CVS access using SSH (to be written) +3 - Merging from DEVEL branch to main trunk (stable branch) +4 - How to release lwIP + + + +1 Obtaining lwIP from the CVS repository +---------------------------------------- + +To perform an anonymous CVS checkout of the main trunk (this is where +bug fixes and incremental enhancements occur), do this: + +cvs -z3 -d:pserver:anonymous@cvs.sv.gnu.org:/sources/lwip checkout lwip + +Or, obtain a stable branch (updated with bug fixes only) as follows: +cvs -z3 -d:pserver:anonymous@cvs.sv.gnu.org:/sources/lwip checkout \ + -r STABLE-0_7 -d lwip-0.7 lwip + +Or, obtain a specific (fixed) release as follows: +cvs -z3 -d:pserver:anonymous@cvs.sv.gnu.org:/sources/lwip checkout \ + -r STABLE-0_7_0 -d lwip-0.7.0 lwip + +3 Committers/developers CVS access using SSH +-------------------------------------------- + +The Savannah server uses SSH (Secure Shell) protocol 2 authentication and encryption. +As such, CVS commits to the server occur through a SSH tunnel for project members. +To create a SSH2 key pair in UNIX-like environments, do this: + +ssh-keygen -t dsa + +Under Windows, a recommended SSH client is "PuTTY", freely available with good +documentation and a graphic user interface. Use its key generator. + +Now paste the id_dsa.pub contents into your Savannah account public key list. Wait +a while so that Savannah can update its configuration (This can take minutes). + +Try to login using SSH: + +ssh -v your_login@cvs.sv.gnu.org + +If it tells you: + +Authenticating with public key "your_key_name"... +Server refused to allocate pty + +then you could login; Savannah refuses to give you a shell - which is OK, as we +are allowed to use SSH for CVS only. Now, you should be able to do this: + +export CVS_RSH=ssh +cvs -z3 -d:ext:your_login@cvs.sv.gnu.org:/sources/lwip co lwip + +after which you can edit your local files with bug fixes or new features and +commit them. Make sure you know what you are doing when using CVS to make +changes on the repository. If in doubt, ask on the lwip-members mailing list. + +(If SSH asks about authenticity of the host, you can check the key + fingerprint against http://savannah.nongnu.org/cvs/?group=lwip) + + +3 Merging from DEVEL branch to main trunk (stable) +-------------------------------------------------- + +Merging is a delicate process in CVS and requires the +following disciplined steps in order to prevent conflicts +in the future. Conflicts can be hard to solve! + +Merging from branch A to branch B requires that the A branch +has a tag indicating the previous merger. This tag is called +'merged_from_A_to_B'. After merging, the tag is moved in the +A branch to remember this merger for future merge actions. + +IMPORTANT: AFTER COMMITTING A SUCCESFUL MERGE IN THE +REPOSITORY, THE TAG MUST BE SET ON THE SOURCE BRANCH OF THE +MERGE ACTION (REPLACING EXISTING TAGS WITH THE SAME NAME). + +Merge all changes in DEVEL since our last merge to main: + +In the working copy of the main trunk: +cvs update -P -jmerged_from_DEVEL_to_main -jDEVEL + +(This will apply the changes between 'merged_from_DEVEL_to_main' +and 'DEVEL' to your work set of files) + +We can now commit the merge result. +cvs commit -R -m "Merged from DEVEL to main." + +If this worked out OK, we now move the tag in the DEVEL branch +to this merge point, so we can use this point for future merges: + +cvs rtag -F -r DEVEL merged_from_DEVEL_to_main lwip + +4 How to release lwIP +--------------------- + +First, checkout a clean copy of the branch to be released. Tag this set with +tag name "STABLE-0_6_3". (I use release number 0.6.3 throughout this example). + +Login CVS using pserver authentication, then export a clean copy of the +tagged tree. Export is similar to a checkout, except that the CVS metadata +is not created locally. + +export CVS_RSH=ssh +cvs -z3 -d:pserver:anonymous@cvs.sv.gnu.org:/sources/lwip checkout \ + -r STABLE-0_6_3 -d lwip-0.6.3 lwip + +Archive this directory using tar, gzip'd, bzip2'd and zip'd. + +tar czvf lwip-0.6.3.tar.gz lwip-0.6.3 +tar cjvf lwip-0.6.3.tar.bz2 lwip-0.6.3 +zip -r lwip-0.6.3.zip lwip-0.6.3 + +Now, sign the archives with a detached GPG binary signature as follows: + +gpg -b lwip-0.6.3.tar.gz +gpg -b lwip-0.6.3.tar.bz2 +gpg -b lwip-0.6.3.zip + +Upload these files using anonymous FTP: +ncftp ftp://savannah.gnu.org/incoming/savannah/lwip + +ncftp>mput *0.6.3.* + +Additionally, you may post a news item on Savannah, like this: + +A new 0.6.3 release is now available here: +http://savannah.nongnu.org/files/?group=lwip&highlight=0.6.3 + +You will have to submit this via the user News interface, then approve +this via the Administrator News interface. \ No newline at end of file diff --git a/lib/drivers/lwip/doc/snmp_agent.txt b/lib/drivers/lwip/doc/snmp_agent.txt new file mode 100644 index 00000000000..2653230f4d2 --- /dev/null +++ b/lib/drivers/lwip/doc/snmp_agent.txt @@ -0,0 +1,181 @@ +SNMPv1 agent for lwIP + +Author: Christiaan Simons + +This is a brief introduction how to use and configure the SNMP agent. +Note the agent uses the raw-API UDP interface so you may also want to +read rawapi.txt to gain a better understanding of the SNMP message handling. + +0 Agent Capabilities +==================== + +SNMPv1 per RFC1157 + This is an old(er) standard but is still widely supported. + For SNMPv2c and v3 have a greater complexity and need many + more lines of code. IMHO this breaks the idea of "lightweight IP". + + Note the S in SNMP stands for "Simple". Note that "Simple" is + relative. SNMP is simple compared to the complex ISO network + management protocols CMIP (Common Management Information Protocol) + and CMOT (CMip Over Tcp). + +MIB II per RFC1213 + The standard lwIP stack management information base. + This is a required MIB, so this is always enabled. + When builing lwIP without TCP, the mib-2.tcp group is omitted. + The groups EGP, CMOT and transmission are disabled by default. + + Most mib-2 objects are not writable except: + sysName, sysLocation, sysContact, snmpEnableAuthenTraps. + Writing to or changing the ARP and IP address and route + tables is not possible. + + Note lwIP has a very limited notion of IP routing. It currently + doen't have a route table and doesn't have a notion of the U,G,H flags. + Instead lwIP uses the interface list with only one default interface + acting as a single gateway interface (G) for the default route. + + The agent returns a "virtual table" with the default route 0.0.0.0 + for the default interface and network routes (no H) for each + network interface in the netif_list. + All routes are considered to be up (U). + +Loading additional MIBs + MIBs can only be added in compile-time, not in run-time. + There is no MIB compiler thus additional MIBs must be hand coded. + +Large SNMP message support + The packet decoding and encoding routines are designed + to use pbuf-chains. Larger payloads than the minimum + SNMP requirement of 484 octets are supported if the + PBUF_POOL_SIZE and IP_REASS_BUFSIZE are set to match your + local requirement. + +1 Building the Agent +==================== + +First of all you'll need to add the following define +to your local lwipopts.h: + +#define LWIP_SNMP 1 + +and add the source files in lwip/src/core/snmp +and some snmp headers in lwip/src/include/lwip to your makefile. + +Note you'll might need to adapt you network driver to update +the mib2 variables for your interface. + +2 Running the Agent +=================== + +The following function calls must be made in your program to +actually get the SNMP agent running. + +Before starting the agent you should supply pointers +to non-volatile memory for sysContact, sysLocation, +and snmpEnableAuthenTraps. You can do this by calling + +snmp_set_syscontact() +snmp_set_syslocation() +snmp_set_snmpenableauthentraps() + +Additionally you may want to set + +snmp_set_sysdescr() +snmp_set_sysobjid() (if you have a private MIB) +snmp_set_sysname() + +Also before starting the agent you need to setup +one or more trap destinations using these calls: + +snmp_trap_dst_enable(); +snmp_trap_dst_ip_set(); + +In the lwIP initialisation sequence call snmp_init() just after +the call to udp_init(). + +Exactly every 10 msec the SNMP uptime timestamp must be updated with +snmp_inc_sysuptime(). You should call this from a timer interrupt +or a timer signal handler depending on your runtime environment. + +An alternative way to update the SNMP uptime timestamp is to do a call like +snmp_add_sysuptime(100) each 1000ms (which is bigger "step", but call to +a lower frequency). Another one is to not call snmp_inc_sysuptime() or +snmp_add_sysuptime(), and to define the SNMP_GET_SYSUPTIME(sysuptime) macro. +This one is undefined by default in mib2.c. SNMP_GET_SYSUPTIME is called inside +snmp_get_sysuptime(u32_t *value), and enable to change "sysuptime" value only +when it's queried (any function which need "sysuptime" have to call +snmp_get_sysuptime). + + +3 Private MIBs +============== + +If want to extend the agent with your own private MIB you'll need to +add the following define to your local lwipopts.h: + +#define SNMP_PRIVATE_MIB 1 + +You must provide the private_mib.h and associated files yourself. +Note we don't have a "MIB compiler" that generates C source from a MIB, +so you're required to do some serious coding if you enable this! + +Note the lwIP enterprise ID (26381) is assigned to the lwIP project, +ALL OBJECT IDENTIFIERS LIVING UNDER THIS ID ARE ASSIGNED BY THE lwIP +MAINTAINERS! + +If you need to create your own private MIB you'll need +to apply for your own enterprise ID with IANA: http://www.iana.org/numbers.html + +You can set it by passing a struct snmp_obj_id to the agent +using snmp_set_sysobjid(&my_object_id), just before snmp_init(). + +Note the object identifiers for thes MIB-2 and your private MIB +tree must be kept in sorted ascending (lexicographical) order. +This to ensure correct getnext operation. + +An example for a private MIB is part of the "minimal Unix" project: +contrib/ports/unix/proj/minimal/lwip_prvmib.c + +The next chapter gives a more detailed description of the +MIB-2 tree and the optional private MIB. + +4 The Gory Details +================== + +4.0 Object identifiers and the MIB tree. + +We have three distinct parts for all object identifiers: + +The prefix + .iso.org.dod.internet + +the middle part + .mgmt.mib-2.ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaPhysAddress + +and the index part + .1.192.168.0.1 + +Objects located above the .internet hierarchy aren't supported. +Currently only the .mgmt sub-tree is available and +when the SNMP_PRIVATE_MIB is enabled the .private tree +becomes available too. + +Object identifiers from incoming requests are checked +for a matching prefix, middle part and index part +or are expanded(*) for GetNext requests with short +or inexisting names in the request. +(* we call this "expansion" but this also +resembles the "auto-completion" operation) + +The middle part is usually located in ROM (const) +to preserve precious RAM on small microcontrollers. +However RAM location is possible for a dynamically +changing private tree. + +The index part is handled by functions which in +turn use dynamically allocated index trees from RAM. +These trees are updated by e.g. the etharp code +when new entries are made or removed form the ARP cache. + +/** @todo more gory details */ diff --git a/lib/drivers/lwip/doc/sys_arch.txt b/lib/drivers/lwip/doc/sys_arch.txt new file mode 100644 index 00000000000..66310a91e48 --- /dev/null +++ b/lib/drivers/lwip/doc/sys_arch.txt @@ -0,0 +1,228 @@ +sys_arch interface for lwIP 0.6++ + +Author: Adam Dunkels + +The operating system emulation layer provides a common interface +between the lwIP code and the underlying operating system kernel. The +general idea is that porting lwIP to new architectures requires only +small changes to a few header files and a new sys_arch +implementation. It is also possible to do a sys_arch implementation +that does not rely on any underlying operating system. + +The sys_arch provides semaphores and mailboxes to lwIP. For the full +lwIP functionality, multiple threads support can be implemented in the +sys_arch, but this is not required for the basic lwIP +functionality. Previous versions of lwIP required the sys_arch to +implement timer scheduling as well but as of lwIP 0.5 this is +implemented in a higher layer. + +In addition to the source file providing the functionality of sys_arch, +the OS emulation layer must provide several header files defining +macros used throughout lwip. The files required and the macros they +must define are listed below the sys_arch description. + +Semaphores can be either counting or binary - lwIP works with both +kinds. Mailboxes are used for message passing and can be implemented +either as a queue which allows multiple messages to be posted to a +mailbox, or as a rendez-vous point where only one message can be +posted at a time. lwIP works with both kinds, but the former type will +be more efficient. A message in a mailbox is just a pointer, nothing +more. + +Semaphores are represented by the type "sys_sem_t" which is typedef'd +in the sys_arch.h file. Mailboxes are equivalently represented by the +type "sys_mbox_t". lwIP does not place any restrictions on how +sys_sem_t or sys_mbox_t are represented internally. + +The following functions must be implemented by the sys_arch: + +- void sys_init(void) + + Is called to initialize the sys_arch layer. + +- sys_sem_t sys_sem_new(u8_t count) + + Creates and returns a new semaphore. The "count" argument specifies + the initial state of the semaphore. + +- void sys_sem_free(sys_sem_t sem) + + Deallocates a semaphore. + +- void sys_sem_signal(sys_sem_t sem) + + Signals a semaphore. + +- u32_t sys_arch_sem_wait(sys_sem_t sem, u32_t timeout) + + Blocks the thread while waiting for the semaphore to be + signaled. If the "timeout" argument is non-zero, the thread should + only be blocked for the specified time (measured in + milliseconds). If the "timeout" argument is zero, the thread should be + blocked until the semaphore is signalled. + + If the timeout argument is non-zero, the return value is the number of + milliseconds spent waiting for the semaphore to be signaled. If the + semaphore wasn't signaled within the specified time, the return value is + SYS_ARCH_TIMEOUT. If the thread didn't have to wait for the semaphore + (i.e., it was already signaled), the function may return zero. + + Notice that lwIP implements a function with a similar name, + sys_sem_wait(), that uses the sys_arch_sem_wait() function. + +- sys_mbox_t sys_mbox_new(int size) + + Creates an empty mailbox for maximum "size" elements. Elements stored + in mailboxes are pointers. You have to define macros "_MBOX_SIZE" + in your lwipopts.h, or ignore this parameter in your implementation + and use a default size. + +- void sys_mbox_free(sys_mbox_t mbox) + + Deallocates a mailbox. If there are messages still present in the + mailbox when the mailbox is deallocated, it is an indication of a + programming error in lwIP and the developer should be notified. + +- void sys_mbox_post(sys_mbox_t mbox, void *msg) + + Posts the "msg" to the mailbox. This function have to block until + the "msg" is really posted. + +- err_t sys_mbox_trypost(sys_mbox_t mbox, void *msg) + + Try to post the "msg" to the mailbox. Returns ERR_MEM if this one + is full, else, ERR_OK if the "msg" is posted. + +- u32_t sys_arch_mbox_fetch(sys_mbox_t mbox, void **msg, u32_t timeout) + + Blocks the thread until a message arrives in the mailbox, but does + not block the thread longer than "timeout" milliseconds (similar to + the sys_arch_sem_wait() function). If "timeout" is 0, the thread should + be blocked until a message arrives. The "msg" argument is a result + parameter that is set by the function (i.e., by doing "*msg = + ptr"). The "msg" parameter maybe NULL to indicate that the message + should be dropped. + + The return values are the same as for the sys_arch_sem_wait() function: + Number of milliseconds spent waiting or SYS_ARCH_TIMEOUT if there was a + timeout. + + Note that a function with a similar name, sys_mbox_fetch(), is + implemented by lwIP. + +- u32_t sys_arch_mbox_tryfetch(sys_mbox_t mbox, void **msg) + + This is similar to sys_arch_mbox_fetch, however if a message is not + present in the mailbox, it immediately returns with the code + SYS_MBOX_EMPTY. On success 0 is returned. + + To allow for efficient implementations, this can be defined as a + function-like macro in sys_arch.h instead of a normal function. For + example, a naive implementation could be: + #define sys_arch_mbox_tryfetch(mbox,msg) \ + sys_arch_mbox_fetch(mbox,msg,1) + although this would introduce unnecessary delays. + +- struct sys_timeouts *sys_arch_timeouts(void) + + Returns a pointer to the per-thread sys_timeouts structure. In lwIP, + each thread has a list of timeouts which is repressented as a linked + list of sys_timeout structures. The sys_timeouts structure holds a + pointer to a linked list of timeouts. This function is called by + the lwIP timeout scheduler and must not return a NULL value. + + In a single thread sys_arch implementation, this function will + simply return a pointer to a global sys_timeouts variable stored in + the sys_arch module. + +If threads are supported by the underlying operating system and if +such functionality is needed in lwIP, the following function will have +to be implemented as well: + +- sys_thread_t sys_thread_new(char *name, void (* thread)(void *arg), void *arg, int stacksize, int prio) + + Starts a new thread named "name" with priority "prio" that will begin its + execution in the function "thread()". The "arg" argument will be passed as an + argument to the thread() function. The stack size to used for this thread is + the "stacksize" parameter. The id of the new thread is returned. Both the id + and the priority are system dependent. + +- sys_prot_t sys_arch_protect(void) + + This optional function does a "fast" critical region protection and returns + the previous protection level. This function is only called during very short + critical regions. An embedded system which supports ISR-based drivers might + want to implement this function by disabling interrupts. Task-based systems + might want to implement this by using a mutex or disabling tasking. This + function should support recursive calls from the same task or interrupt. In + other words, sys_arch_protect() could be called while already protected. In + that case the return value indicates that it is already protected. + + sys_arch_protect() is only required if your port is supporting an operating + system. + +- void sys_arch_unprotect(sys_prot_t pval) + + This optional function does a "fast" set of critical region protection to the + value specified by pval. See the documentation for sys_arch_protect() for + more information. This function is only required if your port is supporting + an operating system. + +Note: + +Be carefull with using mem_malloc() in sys_arch. When malloc() refers to +mem_malloc() you can run into a circular function call problem. In mem.c +mem_init() tries to allcate a semaphore using mem_malloc, which of course +can't be performed when sys_arch uses mem_malloc. + +------------------------------------------------------------------------------- +Additional files required for the "OS support" emulation layer: +------------------------------------------------------------------------------- + +cc.h - Architecture environment, some compiler specific, some + environment specific (probably should move env stuff + to sys_arch.h.) + + Typedefs for the types used by lwip - + u8_t, s8_t, u16_t, s16_t, u32_t, s32_t, mem_ptr_t + + Compiler hints for packing lwip's structures - + PACK_STRUCT_FIELD(x) + PACK_STRUCT_STRUCT + PACK_STRUCT_BEGIN + PACK_STRUCT_END + + Platform specific diagnostic output - + LWIP_PLATFORM_DIAG(x) - non-fatal, print a message. + LWIP_PLATFORM_ASSERT(x) - fatal, print message and abandon execution. + Portability defines for printf formatters: + U16_F, S16_F, X16_F, U32_F, S32_F, X32_F, SZT_F + + "lightweight" synchronization mechanisms - + SYS_ARCH_DECL_PROTECT(x) - declare a protection state variable. + SYS_ARCH_PROTECT(x) - enter protection mode. + SYS_ARCH_UNPROTECT(x) - leave protection mode. + + If the compiler does not provide memset() this file must include a + definition of it, or include a file which defines it. + + This file must either include a system-local which defines + the standard *nix error codes, or it should #define LWIP_PROVIDE_ERRNO + to make lwip/arch.h define the codes which are used throughout. + + +perf.h - Architecture specific performance measurement. + Measurement calls made throughout lwip, these can be defined to nothing. + PERF_START - start measuring something. + PERF_STOP(x) - stop measuring something, and record the result. + +sys_arch.h - Tied to sys_arch.c + + Arch dependent types for the following objects: + sys_sem_t, sys_mbox_t, sys_thread_t, + And, optionally: + sys_prot_t + + Defines to set vars of sys_mbox_t and sys_sem_t to NULL. + SYS_MBOX_NULL NULL + SYS_SEM_NULL NULL diff --git a/lib/drivers/lwip/lwip.rbuild b/lib/drivers/lwip/lwip.rbuild new file mode 100755 index 00000000000..7059ccdbf6c --- /dev/null +++ b/lib/drivers/lwip/lwip.rbuild @@ -0,0 +1,65 @@ + + + + src/include + src/include/ipv4 + include + + rosip.c + rostcp.c + rosmem.c + sys_arch.c + + api_lib.c + api_msg.c + err.c + netbuf.c + netdb.c + netifapi.c + sockets.c + tcpip.c + + + def.c + dhcp.c + dns.c + init.c + mem.c + memp.c + netif.c + pbuf.c + raw.c + stats.c + sys.c + tcp_in.c + tcp_out.c + tcp.c + timers.c + udp.c + + autoip.c + icmp.c + igmp.c + inet_chksum.c + inet.c + ip.c + ip_addr.c + ip_frag.c + + + + asn1_dec.c + asn1_enc.c + mib_structs.c + mib2.c + msg_in.c + msg_out.c + + + + diff --git a/lib/drivers/lwip/src/FILES b/lib/drivers/lwip/src/FILES new file mode 100644 index 00000000000..952aeabb49d --- /dev/null +++ b/lib/drivers/lwip/src/FILES @@ -0,0 +1,13 @@ +api/ - The code for the high-level wrapper API. Not needed if + you use the lowel-level call-back/raw API. + +core/ - The core of the TPC/IP stack; protocol implementations, + memory and buffer management, and the low-level raw API. + +include/ - lwIP include files. + +netif/ - Generic network interface device drivers are kept here, + as well as the ARP module. + +For more information on the various subdirectories, check the FILES +file in each directory. diff --git a/lib/drivers/lwip/src/api/api_lib.c b/lib/drivers/lwip/src/api/api_lib.c new file mode 100644 index 00000000000..b1a9e5253d8 --- /dev/null +++ b/lib/drivers/lwip/src/api/api_lib.c @@ -0,0 +1,740 @@ +/** + * @file + * Sequential API External module + * + */ + +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ + +/* This is the part of the API that is linked with + the application */ + +#include "lwip/opt.h" + +#if LWIP_NETCONN /* don't build if not configured for use in lwipopts.h */ + +#include "lwip/api.h" +#include "lwip/tcpip.h" +#include "lwip/memp.h" + +#include "lwip/ip.h" +#include "lwip/raw.h" +#include "lwip/udp.h" +#include "lwip/tcp.h" + +#include + +/** + * Create a new netconn (of a specific type) that has a callback function. + * The corresponding pcb is also created. + * + * @param t the type of 'connection' to create (@see enum netconn_type) + * @param proto the IP protocol for RAW IP pcbs + * @param callback a function to call on status changes (RX available, TX'ed) + * @return a newly allocated struct netconn or + * NULL on memory error + */ +struct netconn* +netconn_new_with_proto_and_callback(enum netconn_type t, u8_t proto, netconn_callback callback) +{ + struct netconn *conn; + struct api_msg msg; + + conn = netconn_alloc(t, callback); + if (conn != NULL) { + msg.function = do_newconn; + msg.msg.msg.n.proto = proto; + msg.msg.conn = conn; + if (TCPIP_APIMSG(&msg) != ERR_OK) { + LWIP_ASSERT("freeing conn without freeing pcb", conn->pcb.tcp == NULL); + LWIP_ASSERT("conn has no op_completed", sys_sem_valid(&conn->op_completed)); + LWIP_ASSERT("conn has no recvmbox", sys_mbox_valid(&conn->recvmbox)); +#if LWIP_TCP + LWIP_ASSERT("conn->acceptmbox shouldn't exist", !sys_mbox_valid(&conn->acceptmbox)); +#endif /* LWIP_TCP */ + sys_sem_free(&conn->op_completed); + sys_mbox_free(&conn->recvmbox); + memp_free(MEMP_NETCONN, conn); + return NULL; + } + } + return conn; +} + +/** + * Close a netconn 'connection' and free its resources. + * UDP and RAW connection are completely closed, TCP pcbs might still be in a waitstate + * after this returns. + * + * @param conn the netconn to delete + * @return ERR_OK if the connection was deleted + */ +err_t +netconn_delete(struct netconn *conn) +{ + struct api_msg msg; + + /* No ASSERT here because possible to get a (conn == NULL) if we got an accept error */ + if (conn == NULL) { + return ERR_OK; + } + + msg.function = do_delconn; + msg.msg.conn = conn; + tcpip_apimsg(&msg); + + netconn_free(conn); + + /* don't care for return value of do_delconn since it only calls void functions */ + + return ERR_OK; +} + +/** + * Get the local or remote IP address and port of a netconn. + * For RAW netconns, this returns the protocol instead of a port! + * + * @param conn the netconn to query + * @param addr a pointer to which to save the IP address + * @param port a pointer to which to save the port (or protocol for RAW) + * @param local 1 to get the local IP address, 0 to get the remote one + * @return ERR_CONN for invalid connections + * ERR_OK if the information was retrieved + */ +err_t +netconn_getaddr(struct netconn *conn, ip_addr_t *addr, u16_t *port, u8_t local) +{ + struct api_msg msg; + err_t err; + + LWIP_ERROR("netconn_getaddr: invalid conn", (conn != NULL), return ERR_ARG;); + LWIP_ERROR("netconn_getaddr: invalid addr", (addr != NULL), return ERR_ARG;); + LWIP_ERROR("netconn_getaddr: invalid port", (port != NULL), return ERR_ARG;); + + msg.function = do_getaddr; + msg.msg.conn = conn; + msg.msg.msg.ad.ipaddr = addr; + msg.msg.msg.ad.port = port; + msg.msg.msg.ad.local = local; + err = TCPIP_APIMSG(&msg); + + NETCONN_SET_SAFE_ERR(conn, err); + return err; +} + +/** + * Bind a netconn to a specific local IP address and port. + * Binding one netconn twice might not always be checked correctly! + * + * @param conn the netconn to bind + * @param addr the local IP address to bind the netconn to (use IP_ADDR_ANY + * to bind to all addresses) + * @param port the local port to bind the netconn to (not used for RAW) + * @return ERR_OK if bound, any other err_t on failure + */ +err_t +netconn_bind(struct netconn *conn, ip_addr_t *addr, u16_t port) +{ + struct api_msg msg; + err_t err; + + LWIP_ERROR("netconn_bind: invalid conn", (conn != NULL), return ERR_ARG;); + + msg.function = do_bind; + msg.msg.conn = conn; + msg.msg.msg.bc.ipaddr = addr; + msg.msg.msg.bc.port = port; + err = TCPIP_APIMSG(&msg); + + NETCONN_SET_SAFE_ERR(conn, err); + return err; +} + +/** + * Connect a netconn to a specific remote IP address and port. + * + * @param conn the netconn to connect + * @param addr the remote IP address to connect to + * @param port the remote port to connect to (no used for RAW) + * @return ERR_OK if connected, return value of tcp_/udp_/raw_connect otherwise + */ +err_t +netconn_connect(struct netconn *conn, ip_addr_t *addr, u16_t port) +{ + struct api_msg msg; + err_t err; + + LWIP_ERROR("netconn_connect: invalid conn", (conn != NULL), return ERR_ARG;); + + msg.function = do_connect; + msg.msg.conn = conn; + msg.msg.msg.bc.ipaddr = addr; + msg.msg.msg.bc.port = port; + /* This is the only function which need to not block tcpip_thread */ + err = tcpip_apimsg(&msg); + + NETCONN_SET_SAFE_ERR(conn, err); + return err; +} + +/** + * Disconnect a netconn from its current peer (only valid for UDP netconns). + * + * @param conn the netconn to disconnect + * @return TODO: return value is not set here... + */ +err_t +netconn_disconnect(struct netconn *conn) +{ + struct api_msg msg; + err_t err; + + LWIP_ERROR("netconn_disconnect: invalid conn", (conn != NULL), return ERR_ARG;); + + msg.function = do_disconnect; + msg.msg.conn = conn; + err = TCPIP_APIMSG(&msg); + + NETCONN_SET_SAFE_ERR(conn, err); + return err; +} + +/** + * Set a TCP netconn into listen mode + * + * @param conn the tcp netconn to set to listen mode + * @param backlog the listen backlog, only used if TCP_LISTEN_BACKLOG==1 + * @return ERR_OK if the netconn was set to listen (UDP and RAW netconns + * don't return any error (yet?)) + */ +err_t +netconn_listen_with_backlog(struct netconn *conn, u8_t backlog) +{ +#if LWIP_TCP + struct api_msg msg; + err_t err; + + /* This does no harm. If TCP_LISTEN_BACKLOG is off, backlog is unused. */ + LWIP_UNUSED_ARG(backlog); + + LWIP_ERROR("netconn_listen: invalid conn", (conn != NULL), return ERR_ARG;); + + msg.function = do_listen; + msg.msg.conn = conn; +#if TCP_LISTEN_BACKLOG + msg.msg.msg.lb.backlog = backlog; +#endif /* TCP_LISTEN_BACKLOG */ + err = TCPIP_APIMSG(&msg); + + NETCONN_SET_SAFE_ERR(conn, err); + return err; +#else /* LWIP_TCP */ + LWIP_UNUSED_ARG(conn); + LWIP_UNUSED_ARG(backlog); + return ERR_ARG; +#endif /* LWIP_TCP */ +} + +/** + * Accept a new connection on a TCP listening netconn. + * + * @param conn the TCP listen netconn + * @param new_conn pointer where the new connection is stored + * @return ERR_OK if a new connection has been received or an error + * code otherwise + */ +err_t +netconn_accept(struct netconn *conn, struct netconn **new_conn) +{ +#if LWIP_TCP + struct netconn *newconn; + err_t err; +#if TCP_LISTEN_BACKLOG + struct api_msg msg; +#endif /* TCP_LISTEN_BACKLOG */ + + LWIP_ERROR("netconn_accept: invalid pointer", (new_conn != NULL), return ERR_ARG;); + *new_conn = NULL; + LWIP_ERROR("netconn_accept: invalid conn", (conn != NULL), return ERR_ARG;); + LWIP_ERROR("netconn_accept: invalid acceptmbox", sys_mbox_valid(&conn->acceptmbox), return ERR_ARG;); + + err = conn->last_err; + if (ERR_IS_FATAL(err)) { + /* don't recv on fatal errors: this might block the application task + waiting on acceptmbox forever! */ + return err; + } + +#if LWIP_SO_RCVTIMEO + if (sys_arch_mbox_fetch(&conn->acceptmbox, (void **)&newconn, conn->recv_timeout) == SYS_ARCH_TIMEOUT) { + NETCONN_SET_SAFE_ERR(conn, ERR_TIMEOUT); + return ERR_TIMEOUT; + } +#else + sys_arch_mbox_fetch(&conn->acceptmbox, (void **)&newconn, 0); +#endif /* LWIP_SO_RCVTIMEO*/ + /* Register event with callback */ + API_EVENT(conn, NETCONN_EVT_RCVMINUS, 0); + + if (newconn == NULL) { + /* connection has been aborted */ + NETCONN_SET_SAFE_ERR(conn, ERR_ABRT); + return ERR_ABRT; + } +#if TCP_LISTEN_BACKLOG + /* Let the stack know that we have accepted the connection. */ + msg.function = do_recv; + msg.msg.conn = conn; + /* don't care for the return value of do_recv */ + TCPIP_APIMSG(&msg); +#endif /* TCP_LISTEN_BACKLOG */ + + *new_conn = newconn; + /* don't set conn->last_err: it's only ERR_OK, anyway */ + return ERR_OK; +#else /* LWIP_TCP */ + LWIP_UNUSED_ARG(conn); + LWIP_UNUSED_ARG(new_conn); + return ERR_ARG; +#endif /* LWIP_TCP */ +} + +/** + * Receive data: actual implementation that doesn't care whether pbuf or netbuf + * is received + * + * @param conn the netconn from which to receive data + * @param new_buf pointer where a new pbuf/netbuf is stored when received data + * @return ERR_OK if data has been received, an error code otherwise (timeout, + * memory error or another error) + */ +static err_t +netconn_recv_data(struct netconn *conn, void **new_buf) +{ + void *buf = NULL; + u16_t len; + err_t err; +#if LWIP_TCP + struct api_msg msg; +#endif /* LWIP_TCP */ + + LWIP_ERROR("netconn_recv: invalid pointer", (new_buf != NULL), return ERR_ARG;); + *new_buf = NULL; + LWIP_ERROR("netconn_recv: invalid conn", (conn != NULL), return ERR_ARG;); + LWIP_ERROR("netconn_accept: invalid recvmbox", sys_mbox_valid(&conn->recvmbox), return ERR_CONN;); + + err = conn->last_err; + if (ERR_IS_FATAL(err)) { + /* don't recv on fatal errors: this might block the application task + waiting on recvmbox forever! */ + /* @todo: this does not allow us to fetch data that has been put into recvmbox + before the fatal error occurred - is that a problem? */ + return err; + } + +#if LWIP_SO_RCVTIMEO + if (sys_arch_mbox_fetch(&conn->recvmbox, &buf, conn->recv_timeout) == SYS_ARCH_TIMEOUT) { + NETCONN_SET_SAFE_ERR(conn, ERR_TIMEOUT); + return ERR_TIMEOUT; + } +#else + sys_arch_mbox_fetch(&conn->recvmbox, &buf, 0); +#endif /* LWIP_SO_RCVTIMEO*/ + +#if LWIP_TCP + if (conn->type == NETCONN_TCP) { + if (!netconn_get_noautorecved(conn) || (buf == NULL)) { + /* Let the stack know that we have taken the data. */ + /* TODO: Speedup: Don't block and wait for the answer here + (to prevent multiple thread-switches). */ + msg.function = do_recv; + msg.msg.conn = conn; + if (buf != NULL) { + msg.msg.msg.r.len = ((struct pbuf *)buf)->tot_len; + } else { + msg.msg.msg.r.len = 1; + } + /* don't care for the return value of do_recv */ + TCPIP_APIMSG(&msg); + } + + /* If we are closed, we indicate that we no longer wish to use the socket */ + if (buf == NULL) { + API_EVENT(conn, NETCONN_EVT_RCVMINUS, 0); + /* Avoid to lose any previous error code */ + NETCONN_SET_SAFE_ERR(conn, ERR_CLSD); + return ERR_CLSD; + } + len = ((struct pbuf *)buf)->tot_len; + } +#endif /* LWIP_TCP */ +#if LWIP_TCP && (LWIP_UDP || LWIP_RAW) + else +#endif /* LWIP_TCP && (LWIP_UDP || LWIP_RAW) */ +#if (LWIP_UDP || LWIP_RAW) + { + LWIP_ASSERT("buf != NULL", buf != NULL); + len = netbuf_len((struct netbuf *)buf); + } +#endif /* (LWIP_UDP || LWIP_RAW) */ + +#if LWIP_SO_RCVBUF + SYS_ARCH_DEC(conn->recv_avail, len); +#endif /* LWIP_SO_RCVBUF */ + /* Register event with callback */ + API_EVENT(conn, NETCONN_EVT_RCVMINUS, len); + + LWIP_DEBUGF(API_LIB_DEBUG, ("netconn_recv_data: received %p, len=%"U16_F"\n", buf, len)); + + *new_buf = buf; + /* don't set conn->last_err: it's only ERR_OK, anyway */ + return ERR_OK; +} + +/** + * Receive data (in form of a pbuf) from a TCP netconn + * + * @param conn the netconn from which to receive data + * @param new_buf pointer where a new pbuf is stored when received data + * @return ERR_OK if data has been received, an error code otherwise (timeout, + * memory error or another error) + * ERR_ARG if conn is not a TCP netconn + */ +err_t +netconn_recv_tcp_pbuf(struct netconn *conn, struct pbuf **new_buf) +{ + LWIP_ERROR("netconn_recv: invalid conn", (conn != NULL) && + netconn_type(conn) == NETCONN_TCP, return ERR_ARG;); + + return netconn_recv_data(conn, (void **)new_buf); +} + +/** + * Receive data (in form of a netbuf containing a packet buffer) from a netconn + * + * @param conn the netconn from which to receive data + * @param new_buf pointer where a new netbuf is stored when received data + * @return ERR_OK if data has been received, an error code otherwise (timeout, + * memory error or another error) + */ +err_t +netconn_recv(struct netconn *conn, struct netbuf **new_buf) +{ +#if LWIP_TCP + struct netbuf *buf = NULL; + err_t err; +#endif /* LWIP_TCP */ + + LWIP_ERROR("netconn_recv: invalid pointer", (new_buf != NULL), return ERR_ARG;); + *new_buf = NULL; + LWIP_ERROR("netconn_recv: invalid conn", (conn != NULL), return ERR_ARG;); + LWIP_ERROR("netconn_accept: invalid recvmbox", sys_mbox_valid(&conn->recvmbox), return ERR_CONN;); + +#if LWIP_TCP + if (conn->type == NETCONN_TCP) { + struct pbuf *p = NULL; + /* This is not a listening netconn, since recvmbox is set */ + + buf = (struct netbuf *)memp_malloc(MEMP_NETBUF); + if (buf == NULL) { + NETCONN_SET_SAFE_ERR(conn, ERR_MEM); + return ERR_MEM; + } + + err = netconn_recv_data(conn, (void **)&p); + if (err != ERR_OK) { + memp_free(MEMP_NETBUF, buf); + return err; + } + LWIP_ASSERT("p != NULL", p != NULL); + + buf->p = p; + buf->ptr = p; + buf->port = 0; + ip_addr_set_any(&buf->addr); + *new_buf = buf; + /* don't set conn->last_err: it's only ERR_OK, anyway */ + return ERR_OK; + } else +#endif /* LWIP_TCP */ + { +#if (LWIP_UDP || LWIP_RAW) + return netconn_recv_data(conn, (void **)new_buf); +#endif /* (LWIP_UDP || LWIP_RAW) */ + } +} + +/** + * TCP: update the receive window: by calling this, the application + * tells the stack that it has processed data and is able to accept + * new data. + * ATTENTION: use with care, this is mainly used for sockets! + * Can only be used when calling netconn_set_noautorecved(conn, 1) before. + * + * @param conn the netconn for which to update the receive window + * @param length amount of data processed (ATTENTION: this must be accurate!) + */ +void +netconn_recved(struct netconn *conn, u32_t length) +{ +#if LWIP_TCP + if ((conn != NULL) && (conn->type == NETCONN_TCP) && + (netconn_get_noautorecved(conn))) { + struct api_msg msg; + /* Let the stack know that we have taken the data. */ + /* TODO: Speedup: Don't block and wait for the answer here + (to prevent multiple thread-switches). */ + msg.function = do_recv; + msg.msg.conn = conn; + msg.msg.msg.r.len = length; + /* don't care for the return value of do_recv */ + TCPIP_APIMSG(&msg); + } +#else /* LWIP_TCP */ + LWIP_UNUSED_ARG(conn); + LWIP_UNUSED_ARG(length); +#endif /* LWIP_TCP */ +} + +/** + * Send data (in form of a netbuf) to a specific remote IP address and port. + * Only to be used for UDP and RAW netconns (not TCP). + * + * @param conn the netconn over which to send data + * @param buf a netbuf containing the data to send + * @param addr the remote IP address to which to send the data + * @param port the remote port to which to send the data + * @return ERR_OK if data was sent, any other err_t on error + */ +err_t +netconn_sendto(struct netconn *conn, struct netbuf *buf, ip_addr_t *addr, u16_t port) +{ + if (buf != NULL) { + ip_addr_set(&buf->addr, addr); + buf->port = port; + return netconn_send(conn, buf); + } + return ERR_VAL; +} + +/** + * Send data over a UDP or RAW netconn (that is already connected). + * + * @param conn the UDP or RAW netconn over which to send data + * @param buf a netbuf containing the data to send + * @return ERR_OK if data was sent, any other err_t on error + */ +err_t +netconn_send(struct netconn *conn, struct netbuf *buf) +{ + struct api_msg msg; + err_t err; + + LWIP_ERROR("netconn_send: invalid conn", (conn != NULL), return ERR_ARG;); + + LWIP_DEBUGF(API_LIB_DEBUG, ("netconn_send: sending %"U16_F" bytes\n", buf->p->tot_len)); + msg.function = do_send; + msg.msg.conn = conn; + msg.msg.msg.b = buf; + err = TCPIP_APIMSG(&msg); + + NETCONN_SET_SAFE_ERR(conn, err); + return err; +} + +/** + * Send data over a TCP netconn. + * + * @param conn the TCP netconn over which to send data + * @param dataptr pointer to the application buffer that contains the data to send + * @param size size of the application data to send + * @param apiflags combination of following flags : + * - NETCONN_COPY: data will be copied into memory belonging to the stack + * - NETCONN_MORE: for TCP connection, PSH flag will be set on last segment sent + * - NETCONN_DONTBLOCK: only write the data if all dat can be written at once + * @return ERR_OK if data was sent, any other err_t on error + */ +err_t +netconn_write(struct netconn *conn, const void *dataptr, size_t size, u8_t apiflags) +{ + struct api_msg msg; + err_t err; + + LWIP_ERROR("netconn_write: invalid conn", (conn != NULL), return ERR_ARG;); + LWIP_ERROR("netconn_write: invalid conn->type", (conn->type == NETCONN_TCP), return ERR_VAL;); + if (size == 0) { + return ERR_OK; + } + + /* @todo: for non-blocking write, check if 'size' would ever fit into + snd_queue or snd_buf */ + msg.function = do_write; + msg.msg.conn = conn; + msg.msg.msg.w.dataptr = dataptr; + msg.msg.msg.w.apiflags = apiflags; + msg.msg.msg.w.len = size; + /* For locking the core: this _can_ be delayed on low memory/low send buffer, + but if it is, this is done inside api_msg.c:do_write(), so we can use the + non-blocking version here. */ + err = TCPIP_APIMSG(&msg); + + NETCONN_SET_SAFE_ERR(conn, err); + return err; +} + +/** + * Close ot shutdown a TCP netconn (doesn't delete it). + * + * @param conn the TCP netconn to close or shutdown + * @param how fully close or only shutdown one side? + * @return ERR_OK if the netconn was closed, any other err_t on error + */ +static err_t +netconn_close_shutdown(struct netconn *conn, u8_t how) +{ + struct api_msg msg; + err_t err; + + LWIP_ERROR("netconn_close: invalid conn", (conn != NULL), return ERR_ARG;); + + msg.function = do_close; + msg.msg.conn = conn; + /* shutting down both ends is the same as closing */ + msg.msg.msg.sd.shut = how; + /* because of the LWIP_TCPIP_CORE_LOCKING implementation of do_close, + don't use TCPIP_APIMSG here */ + err = tcpip_apimsg(&msg); + + NETCONN_SET_SAFE_ERR(conn, err); + return err; +} + +/** + * Close a TCP netconn (doesn't delete it). + * + * @param conn the TCP netconn to close + * @return ERR_OK if the netconn was closed, any other err_t on error + */ +err_t +netconn_close(struct netconn *conn) +{ + /* shutting down both ends is the same as closing */ + return netconn_close_shutdown(conn, NETCONN_SHUT_RDWR); +} + +/** + * Shut down one or both sides of a TCP netconn (doesn't delete it). + * + * @param conn the TCP netconn to shut down + * @return ERR_OK if the netconn was closed, any other err_t on error + */ +err_t +netconn_shutdown(struct netconn *conn, u8_t shut_rx, u8_t shut_tx) +{ + return netconn_close_shutdown(conn, (shut_rx ? NETCONN_SHUT_RD : 0) | (shut_tx ? NETCONN_SHUT_WR : 0)); +} + +#if LWIP_IGMP +/** + * Join multicast groups for UDP netconns. + * + * @param conn the UDP netconn for which to change multicast addresses + * @param multiaddr IP address of the multicast group to join or leave + * @param netif_addr the IP address of the network interface on which to send + * the igmp message + * @param join_or_leave flag whether to send a join- or leave-message + * @return ERR_OK if the action was taken, any err_t on error + */ +err_t +netconn_join_leave_group(struct netconn *conn, + ip_addr_t *multiaddr, + ip_addr_t *netif_addr, + enum netconn_igmp join_or_leave) +{ + struct api_msg msg; + err_t err; + + LWIP_ERROR("netconn_join_leave_group: invalid conn", (conn != NULL), return ERR_ARG;); + + msg.function = do_join_leave_group; + msg.msg.conn = conn; + msg.msg.msg.jl.multiaddr = multiaddr; + msg.msg.msg.jl.netif_addr = netif_addr; + msg.msg.msg.jl.join_or_leave = join_or_leave; + err = TCPIP_APIMSG(&msg); + + NETCONN_SET_SAFE_ERR(conn, err); + return err; +} +#endif /* LWIP_IGMP */ + +#if LWIP_DNS +/** + * Execute a DNS query, only one IP address is returned + * + * @param name a string representation of the DNS host name to query + * @param addr a preallocated ip_addr_t where to store the resolved IP address + * @return ERR_OK: resolving succeeded + * ERR_MEM: memory error, try again later + * ERR_ARG: dns client not initialized or invalid hostname + * ERR_VAL: dns server response was invalid + */ +err_t +netconn_gethostbyname(const char *name, ip_addr_t *addr) +{ + struct dns_api_msg msg; + err_t err; + sys_sem_t sem; + + LWIP_ERROR("netconn_gethostbyname: invalid name", (name != NULL), return ERR_ARG;); + LWIP_ERROR("netconn_gethostbyname: invalid addr", (addr != NULL), return ERR_ARG;); + + err = sys_sem_new(&sem, 0); + if (err != ERR_OK) { + return err; + } + + msg.name = name; + msg.addr = addr; + msg.err = &err; + msg.sem = &sem; + + tcpip_callback(do_gethostbyname, &msg); + sys_sem_wait(&sem); + sys_sem_free(&sem); + + return err; +} +#endif /* LWIP_DNS*/ + +#endif /* LWIP_NETCONN */ diff --git a/lib/drivers/lwip/src/api/api_msg.c b/lib/drivers/lwip/src/api/api_msg.c new file mode 100644 index 00000000000..448f96dda0a --- /dev/null +++ b/lib/drivers/lwip/src/api/api_msg.c @@ -0,0 +1,1535 @@ +/** + * @file + * Sequential API Internal module + * + */ + +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ + +#include "lwip/opt.h" + +#if LWIP_NETCONN /* don't build if not configured for use in lwipopts.h */ + +#include "lwip/api_msg.h" + +#include "lwip/ip.h" +#include "lwip/udp.h" +#include "lwip/tcp.h" +#include "lwip/raw.h" + +#include "lwip/memp.h" +#include "lwip/tcpip.h" +#include "lwip/igmp.h" +#include "lwip/dns.h" + +#include + +#define SET_NONBLOCKING_CONNECT(conn, val) do { if(val) { \ + (conn)->flags |= NETCONN_FLAG_IN_NONBLOCKING_CONNECT; \ +} else { \ + (conn)->flags &= ~ NETCONN_FLAG_IN_NONBLOCKING_CONNECT; }} while(0) +#define IN_NONBLOCKING_CONNECT(conn) (((conn)->flags & NETCONN_FLAG_IN_NONBLOCKING_CONNECT) != 0) + +/* forward declarations */ +#if LWIP_TCP +static err_t do_writemore(struct netconn *conn); +static void do_close_internal(struct netconn *conn); +#endif + +#if LWIP_RAW +/** + * Receive callback function for RAW netconns. + * Doesn't 'eat' the packet, only references it and sends it to + * conn->recvmbox + * + * @see raw.h (struct raw_pcb.recv) for parameters and return value + */ +static u8_t +recv_raw(void *arg, struct raw_pcb *pcb, struct pbuf *p, + ip_addr_t *addr) +{ + struct pbuf *q; + struct netbuf *buf; + struct netconn *conn; + + LWIP_UNUSED_ARG(addr); + conn = (struct netconn *)arg; + + if ((conn != NULL) && sys_mbox_valid(&conn->recvmbox)) { +#if LWIP_SO_RCVBUF + int recv_avail; + SYS_ARCH_GET(conn->recv_avail, recv_avail); + if ((recv_avail + (int)(p->tot_len)) > conn->recv_bufsize) { + return 0; + } +#endif /* LWIP_SO_RCVBUF */ + /* copy the whole packet into new pbufs */ + q = pbuf_alloc(PBUF_RAW, p->tot_len, PBUF_RAM); + if(q != NULL) { + if (pbuf_copy(q, p) != ERR_OK) { + pbuf_free(q); + q = NULL; + } + } + + if (q != NULL) { + u16_t len; + buf = (struct netbuf *)memp_malloc(MEMP_NETBUF); + if (buf == NULL) { + pbuf_free(q); + return 0; + } + + buf->p = q; + buf->ptr = q; + ip_addr_copy(buf->addr, *ip_current_src_addr()); + buf->port = pcb->protocol; + + len = q->tot_len; + if (sys_mbox_trypost(&conn->recvmbox, buf) != ERR_OK) { + netbuf_delete(buf); + return 0; + } else { +#if LWIP_SO_RCVBUF + SYS_ARCH_INC(conn->recv_avail, len); +#endif /* LWIP_SO_RCVBUF */ + /* Register event with callback */ + API_EVENT(conn, NETCONN_EVT_RCVPLUS, len); + } + } + } + + return 0; /* do not eat the packet */ +} +#endif /* LWIP_RAW*/ + +#if LWIP_UDP +/** + * Receive callback function for UDP netconns. + * Posts the packet to conn->recvmbox or deletes it on memory error. + * + * @see udp.h (struct udp_pcb.recv) for parameters + */ +static void +recv_udp(void *arg, struct udp_pcb *pcb, struct pbuf *p, + ip_addr_t *addr, u16_t port) +{ + struct netbuf *buf; + struct netconn *conn; + u16_t len; +#if LWIP_SO_RCVBUF + int recv_avail; +#endif /* LWIP_SO_RCVBUF */ + + LWIP_UNUSED_ARG(pcb); /* only used for asserts... */ + LWIP_ASSERT("recv_udp must have a pcb argument", pcb != NULL); + LWIP_ASSERT("recv_udp must have an argument", arg != NULL); + conn = (struct netconn *)arg; + LWIP_ASSERT("recv_udp: recv for wrong pcb!", conn->pcb.udp == pcb); + +#if LWIP_SO_RCVBUF + SYS_ARCH_GET(conn->recv_avail, recv_avail); + if ((conn == NULL) || !sys_mbox_valid(&conn->recvmbox) || + ((recv_avail + (int)(p->tot_len)) > conn->recv_bufsize)) { +#else /* LWIP_SO_RCVBUF */ + if ((conn == NULL) || !sys_mbox_valid(&conn->recvmbox)) { +#endif /* LWIP_SO_RCVBUF */ + pbuf_free(p); + return; + } + + buf = (struct netbuf *)memp_malloc(MEMP_NETBUF); + if (buf == NULL) { + pbuf_free(p); + return; + } else { + buf->p = p; + buf->ptr = p; + ip_addr_set(&buf->addr, addr); + buf->port = port; +#if LWIP_NETBUF_RECVINFO + { + const struct ip_hdr* iphdr = ip_current_header(); + /* get the UDP header - always in the first pbuf, ensured by udp_input */ + const struct udp_hdr* udphdr = (void*)(((char*)iphdr) + IPH_LEN(iphdr)); +#if LWIP_CHECKSUM_ON_COPY + buf->flags = NETBUF_FLAG_DESTADDR; +#endif /* LWIP_CHECKSUM_ON_COPY */ + ip_addr_set(&buf->toaddr, ip_current_dest_addr()); + buf->toport_chksum = udphdr->dest; + } +#endif /* LWIP_NETBUF_RECVINFO */ + } + + len = p->tot_len; + if (sys_mbox_trypost(&conn->recvmbox, buf) != ERR_OK) { + netbuf_delete(buf); + return; + } else { +#if LWIP_SO_RCVBUF + SYS_ARCH_INC(conn->recv_avail, len); +#endif /* LWIP_SO_RCVBUF */ + /* Register event with callback */ + API_EVENT(conn, NETCONN_EVT_RCVPLUS, len); + } +} +#endif /* LWIP_UDP */ + +#if LWIP_TCP +/** + * Receive callback function for TCP netconns. + * Posts the packet to conn->recvmbox, but doesn't delete it on errors. + * + * @see tcp.h (struct tcp_pcb.recv) for parameters and return value + */ +static err_t +recv_tcp(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err) +{ + struct netconn *conn; + u16_t len; + + LWIP_UNUSED_ARG(pcb); + LWIP_ASSERT("recv_tcp must have a pcb argument", pcb != NULL); + LWIP_ASSERT("recv_tcp must have an argument", arg != NULL); + conn = (struct netconn *)arg; + LWIP_ASSERT("recv_tcp: recv for wrong pcb!", conn->pcb.tcp == pcb); + + if (conn == NULL) { + return ERR_VAL; + } + if (!sys_mbox_valid(&conn->recvmbox)) { + /* recvmbox already deleted */ + if (p != NULL) { + tcp_recved(pcb, p->tot_len); + pbuf_free(p); + } + return ERR_OK; + } + /* Unlike for UDP or RAW pcbs, don't check for available space + using recv_avail since that could break the connection + (data is already ACKed) */ + + /* don't overwrite fatal errors! */ + NETCONN_SET_SAFE_ERR(conn, err); + + if (p != NULL) { + len = p->tot_len; + } else { + len = 0; + } + + if (sys_mbox_trypost(&conn->recvmbox, p) != ERR_OK) { + /* don't deallocate p: it is presented to us later again from tcp_fasttmr! */ + return ERR_MEM; + } else { +#if LWIP_SO_RCVBUF + SYS_ARCH_INC(conn->recv_avail, len); +#endif /* LWIP_SO_RCVBUF */ + /* Register event with callback */ + API_EVENT(conn, NETCONN_EVT_RCVPLUS, len); + } + + return ERR_OK; +} + +/** + * Poll callback function for TCP netconns. + * Wakes up an application thread that waits for a connection to close + * or data to be sent. The application thread then takes the + * appropriate action to go on. + * + * Signals the conn->sem. + * netconn_close waits for conn->sem if closing failed. + * + * @see tcp.h (struct tcp_pcb.poll) for parameters and return value + */ +static err_t +poll_tcp(void *arg, struct tcp_pcb *pcb) +{ + struct netconn *conn = (struct netconn *)arg; + + LWIP_UNUSED_ARG(pcb); + LWIP_ASSERT("conn != NULL", (conn != NULL)); + + if (conn->state == NETCONN_WRITE) { + do_writemore(conn); + } else if (conn->state == NETCONN_CLOSE) { + do_close_internal(conn); + } + /* @todo: implement connect timeout here? */ + + /* Did a nonblocking write fail before? Then check available write-space. */ + if (conn->flags & NETCONN_FLAG_CHECK_WRITESPACE) { + /* If the queued byte- or pbuf-count drops below the configured low-water limit, + let select mark this pcb as writable again. */ + if ((conn->pcb.tcp != NULL) && (tcp_sndbuf(conn->pcb.tcp) > TCP_SNDLOWAT) && + (tcp_sndqueuelen(conn->pcb.tcp) < TCP_SNDQUEUELOWAT)) { + conn->flags &= ~NETCONN_FLAG_CHECK_WRITESPACE; + API_EVENT(conn, NETCONN_EVT_SENDPLUS, 0); + } + } + + return ERR_OK; +} + +/** + * Sent callback function for TCP netconns. + * Signals the conn->sem and calls API_EVENT. + * netconn_write waits for conn->sem if send buffer is low. + * + * @see tcp.h (struct tcp_pcb.sent) for parameters and return value + */ +static err_t +sent_tcp(void *arg, struct tcp_pcb *pcb, u16_t len) +{ + struct netconn *conn = (struct netconn *)arg; + + LWIP_UNUSED_ARG(pcb); + LWIP_ASSERT("conn != NULL", (conn != NULL)); + + if (conn->state == NETCONN_WRITE) { + do_writemore(conn); + } else if (conn->state == NETCONN_CLOSE) { + do_close_internal(conn); + } + + if (conn) { + /* If the queued byte- or pbuf-count drops below the configured low-water limit, + let select mark this pcb as writable again. */ + if ((conn->pcb.tcp != NULL) && (tcp_sndbuf(conn->pcb.tcp) > TCP_SNDLOWAT) && + (tcp_sndqueuelen(conn->pcb.tcp) < TCP_SNDQUEUELOWAT)) { + conn->flags &= ~NETCONN_FLAG_CHECK_WRITESPACE; + API_EVENT(conn, NETCONN_EVT_SENDPLUS, len); + } + } + + return ERR_OK; +} + +/** + * Error callback function for TCP netconns. + * Signals conn->sem, posts to all conn mboxes and calls API_EVENT. + * The application thread has then to decide what to do. + * + * @see tcp.h (struct tcp_pcb.err) for parameters + */ +static void +err_tcp(void *arg, err_t err) +{ + struct netconn *conn; + enum netconn_state old_state; + SYS_ARCH_DECL_PROTECT(lev); + + conn = (struct netconn *)arg; + LWIP_ASSERT("conn != NULL", (conn != NULL)); + + conn->pcb.tcp = NULL; + + /* no check since this is always fatal! */ + SYS_ARCH_PROTECT(lev); + conn->last_err = err; + SYS_ARCH_UNPROTECT(lev); + + /* reset conn->state now before waking up other threads */ + old_state = conn->state; + conn->state = NETCONN_NONE; + + /* Notify the user layer about a connection error. Used to signal + select. */ + API_EVENT(conn, NETCONN_EVT_ERROR, 0); + /* Try to release selects pending on 'read' or 'write', too. + They will get an error if they actually try to read or write. */ + API_EVENT(conn, NETCONN_EVT_RCVPLUS, 0); + API_EVENT(conn, NETCONN_EVT_SENDPLUS, 0); + + /* pass NULL-message to recvmbox to wake up pending recv */ + if (sys_mbox_valid(&conn->recvmbox)) { + /* use trypost to prevent deadlock */ + sys_mbox_trypost(&conn->recvmbox, NULL); + } + /* pass NULL-message to acceptmbox to wake up pending accept */ + if (sys_mbox_valid(&conn->acceptmbox)) { + /* use trypost to preven deadlock */ + sys_mbox_trypost(&conn->acceptmbox, NULL); + } + + if ((old_state == NETCONN_WRITE) || (old_state == NETCONN_CLOSE) || + (old_state == NETCONN_CONNECT)) { + /* calling do_writemore/do_close_internal is not necessary + since the pcb has already been deleted! */ + int was_nonblocking_connect = IN_NONBLOCKING_CONNECT(conn); + SET_NONBLOCKING_CONNECT(conn, 0); + + if (!was_nonblocking_connect) { + /* set error return code */ + LWIP_ASSERT("conn->current_msg != NULL", conn->current_msg != NULL); + conn->current_msg->err = err; + conn->current_msg = NULL; + /* wake up the waiting task */ + sys_sem_signal(&conn->op_completed); + } + } else { + LWIP_ASSERT("conn->current_msg == NULL", conn->current_msg == NULL); + } +} + +/** + * Setup a tcp_pcb with the correct callback function pointers + * and their arguments. + * + * @param conn the TCP netconn to setup + */ +static void +setup_tcp(struct netconn *conn) +{ + struct tcp_pcb *pcb; + + pcb = conn->pcb.tcp; + tcp_arg(pcb, conn); + tcp_recv(pcb, recv_tcp); + tcp_sent(pcb, sent_tcp); + tcp_poll(pcb, poll_tcp, 4); + tcp_err(pcb, err_tcp); +} + +/** + * Accept callback function for TCP netconns. + * Allocates a new netconn and posts that to conn->acceptmbox. + * + * @see tcp.h (struct tcp_pcb_listen.accept) for parameters and return value + */ +static err_t +accept_function(void *arg, struct tcp_pcb *newpcb, err_t err) +{ + struct netconn *newconn; + struct netconn *conn = (struct netconn *)arg; + + LWIP_DEBUGF(API_MSG_DEBUG, ("accept_function: newpcb->tate: %s\n", tcp_debug_state_str(newpcb->state))); + + if (!sys_mbox_valid(&conn->acceptmbox)) { + LWIP_DEBUGF(API_MSG_DEBUG, ("accept_function: acceptmbox already deleted\n")); + return ERR_VAL; + } + + /* We have to set the callback here even though + * the new socket is unknown. conn->socket is marked as -1. */ + newconn = netconn_alloc(conn->type, conn->callback); + if (newconn == NULL) { + return ERR_MEM; + } + newconn->pcb.tcp = newpcb; + setup_tcp(newconn); + /* no protection: when creating the pcb, the netconn is not yet known + to the application thread */ + newconn->last_err = err; + + if (sys_mbox_trypost(&conn->acceptmbox, newconn) != ERR_OK) { + /* When returning != ERR_OK, the pcb is aborted in tcp_process(), + so do nothing here! */ + newconn->pcb.tcp = NULL; + /* no need to drain since we know the recvmbox is empty. */ + sys_mbox_free(&newconn->recvmbox); + sys_mbox_set_invalid(&newconn->recvmbox); + netconn_free(newconn); + return ERR_MEM; + } else { + /* Register event with callback */ + API_EVENT(conn, NETCONN_EVT_RCVPLUS, 0); + } + + return ERR_OK; +} +#endif /* LWIP_TCP */ + +/** + * Create a new pcb of a specific type. + * Called from do_newconn(). + * + * @param msg the api_msg_msg describing the connection type + * @return msg->conn->err, but the return value is currently ignored + */ +static void +pcb_new(struct api_msg_msg *msg) +{ + LWIP_ASSERT("pcb_new: pcb already allocated", msg->conn->pcb.tcp == NULL); + + /* Allocate a PCB for this connection */ + switch(NETCONNTYPE_GROUP(msg->conn->type)) { +#if LWIP_RAW + case NETCONN_RAW: + msg->conn->pcb.raw = raw_new(msg->msg.n.proto); + if(msg->conn->pcb.raw == NULL) { + msg->err = ERR_MEM; + break; + } + raw_recv(msg->conn->pcb.raw, recv_raw, msg->conn); + break; +#endif /* LWIP_RAW */ +#if LWIP_UDP + case NETCONN_UDP: + msg->conn->pcb.udp = udp_new(); + if(msg->conn->pcb.udp == NULL) { + msg->err = ERR_MEM; + break; + } +#if LWIP_UDPLITE + if (msg->conn->type==NETCONN_UDPLITE) { + udp_setflags(msg->conn->pcb.udp, UDP_FLAGS_UDPLITE); + } +#endif /* LWIP_UDPLITE */ + if (msg->conn->type==NETCONN_UDPNOCHKSUM) { + udp_setflags(msg->conn->pcb.udp, UDP_FLAGS_NOCHKSUM); + } + udp_recv(msg->conn->pcb.udp, recv_udp, msg->conn); + break; +#endif /* LWIP_UDP */ +#if LWIP_TCP + case NETCONN_TCP: + msg->conn->pcb.tcp = tcp_new(); + if(msg->conn->pcb.tcp == NULL) { + msg->err = ERR_MEM; + break; + } + setup_tcp(msg->conn); + break; +#endif /* LWIP_TCP */ + default: + /* Unsupported netconn type, e.g. protocol disabled */ + msg->err = ERR_VAL; + break; + } +} + +/** + * Create a new pcb of a specific type inside a netconn. + * Called from netconn_new_with_proto_and_callback. + * + * @param msg the api_msg_msg describing the connection type + */ +void +do_newconn(struct api_msg_msg *msg) +{ + msg->err = ERR_OK; + if(msg->conn->pcb.tcp == NULL) { + pcb_new(msg); + } + /* Else? This "new" connection already has a PCB allocated. */ + /* Is this an error condition? Should it be deleted? */ + /* We currently just are happy and return. */ + + TCPIP_APIMSG_ACK(msg); +} + +/** + * Create a new netconn (of a specific type) that has a callback function. + * The corresponding pcb is NOT created! + * + * @param t the type of 'connection' to create (@see enum netconn_type) + * @param proto the IP protocol for RAW IP pcbs + * @param callback a function to call on status changes (RX available, TX'ed) + * @return a newly allocated struct netconn or + * NULL on memory error + */ +struct netconn* +netconn_alloc(enum netconn_type t, netconn_callback callback) +{ + struct netconn *conn; + int size; + + conn = (struct netconn *)memp_malloc(MEMP_NETCONN); + if (conn == NULL) { + return NULL; + } + + conn->last_err = ERR_OK; + conn->type = t; + conn->pcb.tcp = NULL; + +#if (DEFAULT_RAW_RECVMBOX_SIZE == DEFAULT_UDP_RECVMBOX_SIZE) && \ + (DEFAULT_RAW_RECVMBOX_SIZE == DEFAULT_TCP_RECVMBOX_SIZE) + size = DEFAULT_RAW_RECVMBOX_SIZE; +#else + switch(NETCONNTYPE_GROUP(t)) { +#if LWIP_RAW + case NETCONN_RAW: + size = DEFAULT_RAW_RECVMBOX_SIZE; + break; +#endif /* LWIP_RAW */ +#if LWIP_UDP + case NETCONN_UDP: + size = DEFAULT_UDP_RECVMBOX_SIZE; + break; +#endif /* LWIP_UDP */ +#if LWIP_TCP + case NETCONN_TCP: + size = DEFAULT_TCP_RECVMBOX_SIZE; + break; +#endif /* LWIP_TCP */ + default: + LWIP_ASSERT("netconn_alloc: undefined netconn_type", 0); + break; + } +#endif + + if (sys_sem_new(&conn->op_completed, 0) != ERR_OK) { + memp_free(MEMP_NETCONN, conn); + return NULL; + } + if (sys_mbox_new(&conn->recvmbox, size) != ERR_OK) { + sys_sem_free(&conn->op_completed); + memp_free(MEMP_NETCONN, conn); + return NULL; + } + +#if LWIP_TCP + sys_mbox_set_invalid(&conn->acceptmbox); +#endif + conn->state = NETCONN_NONE; +#if LWIP_SOCKET + /* initialize socket to -1 since 0 is a valid socket */ + conn->socket = -1; +#endif /* LWIP_SOCKET */ + conn->callback = callback; +#if LWIP_TCP + conn->current_msg = NULL; + conn->write_offset = 0; +#endif /* LWIP_TCP */ +#if LWIP_SO_RCVTIMEO + conn->recv_timeout = 0; +#endif /* LWIP_SO_RCVTIMEO */ +#if LWIP_SO_RCVBUF + conn->recv_bufsize = RECV_BUFSIZE_DEFAULT; + conn->recv_avail = 0; +#endif /* LWIP_SO_RCVBUF */ + conn->flags = 0; + return conn; +} + +/** + * Delete a netconn and all its resources. + * The pcb is NOT freed (since we might not be in the right thread context do this). + * + * @param conn the netconn to free + */ +void +netconn_free(struct netconn *conn) +{ + LWIP_ASSERT("PCB must be deallocated outside this function", conn->pcb.tcp == NULL); + LWIP_ASSERT("recvmbox must be deallocated before calling this function", + !sys_mbox_valid(&conn->recvmbox)); +#if LWIP_TCP + LWIP_ASSERT("acceptmbox must be deallocated before calling this function", + !sys_mbox_valid(&conn->acceptmbox)); +#endif /* LWIP_TCP */ + + sys_sem_free(&conn->op_completed); + sys_sem_set_invalid(&conn->op_completed); + + memp_free(MEMP_NETCONN, conn); +} + +/** + * Delete rcvmbox and acceptmbox of a netconn and free the left-over data in + * these mboxes + * + * @param conn the netconn to free + * @bytes_drained bytes drained from recvmbox + * @accepts_drained pending connections drained from acceptmbox + */ +static void +netconn_drain(struct netconn *conn) +{ + void *mem; +#if LWIP_TCP + struct pbuf *p; +#endif /* LWIP_TCP */ + + /* This runs in tcpip_thread, so we don't need to lock against rx packets */ + + /* Delete and drain the recvmbox. */ + if (sys_mbox_valid(&conn->recvmbox)) { + while (sys_mbox_tryfetch(&conn->recvmbox, &mem) != SYS_MBOX_EMPTY) { +#if LWIP_TCP + if (conn->type == NETCONN_TCP) { + if(mem != NULL) { + p = (struct pbuf*)mem; + /* pcb might be set to NULL already by err_tcp() */ + if (conn->pcb.tcp != NULL) { + tcp_recved(conn->pcb.tcp, p->tot_len); + } + pbuf_free(p); + } + } else +#endif /* LWIP_TCP */ + { + netbuf_delete((struct netbuf *)mem); + } + } + sys_mbox_free(&conn->recvmbox); + sys_mbox_set_invalid(&conn->recvmbox); + } + + /* Delete and drain the acceptmbox. */ +#if LWIP_TCP + if (sys_mbox_valid(&conn->acceptmbox)) { + while (sys_mbox_tryfetch(&conn->acceptmbox, &mem) != SYS_MBOX_EMPTY) { + struct netconn *newconn = (struct netconn *)mem; + /* Only tcp pcbs have an acceptmbox, so no need to check conn->type */ + /* pcb might be set to NULL already by err_tcp() */ + if (conn->pcb.tcp != NULL) { + tcp_accepted(conn->pcb.tcp); + } + /* drain recvmbox */ + netconn_drain(newconn); + if (newconn->pcb.tcp != NULL) { + tcp_abort(newconn->pcb.tcp); + newconn->pcb.tcp = NULL; + } + netconn_free(newconn); + } + sys_mbox_free(&conn->acceptmbox); + sys_mbox_set_invalid(&conn->acceptmbox); + } +#endif /* LWIP_TCP */ +} + +#if LWIP_TCP +/** + * Internal helper function to close a TCP netconn: since this sometimes + * doesn't work at the first attempt, this function is called from multiple + * places. + * + * @param conn the TCP netconn to close + */ +static void +do_close_internal(struct netconn *conn) +{ + err_t err; + u8_t shut, shut_rx, shut_tx, close; + + LWIP_ASSERT("invalid conn", (conn != NULL)); + LWIP_ASSERT("this is for tcp netconns only", (conn->type == NETCONN_TCP)); + LWIP_ASSERT("conn must be in state NETCONN_CLOSE", (conn->state == NETCONN_CLOSE)); + LWIP_ASSERT("pcb already closed", (conn->pcb.tcp != NULL)); + LWIP_ASSERT("conn->current_msg != NULL", conn->current_msg != NULL); + + shut = conn->current_msg->msg.sd.shut; + shut_rx = shut & NETCONN_SHUT_RD; + shut_tx = shut & NETCONN_SHUT_WR; + /* shutting down both ends is the same as closing */ + close = shut == NETCONN_SHUT_RDWR; + + /* Set back some callback pointers */ + if (close) { + tcp_arg(conn->pcb.tcp, NULL); + } + if (conn->pcb.tcp->state == LISTEN) { + tcp_accept(conn->pcb.tcp, NULL); + } else { + /* some callbacks have to be reset if tcp_close is not successful */ + if (shut_rx) { + tcp_recv(conn->pcb.tcp, NULL); + tcp_accept(conn->pcb.tcp, NULL); + } + if (shut_tx) { + tcp_sent(conn->pcb.tcp, NULL); + } + if (close) { + tcp_poll(conn->pcb.tcp, NULL, 4); + tcp_err(conn->pcb.tcp, NULL); + } + } + /* Try to close the connection */ + if (shut == NETCONN_SHUT_RDWR) { + err = tcp_close(conn->pcb.tcp); + } else { + err = tcp_shutdown(conn->pcb.tcp, shut & NETCONN_SHUT_RD, shut & NETCONN_SHUT_WR); + } + if (err == ERR_OK) { + /* Closing succeeded */ + conn->current_msg->err = ERR_OK; + conn->current_msg = NULL; + conn->state = NETCONN_NONE; + /* Set back some callback pointers as conn is going away */ + conn->pcb.tcp = NULL; + /* Trigger select() in socket layer. Make sure everybody notices activity + on the connection, error first! */ + if (close) { + API_EVENT(conn, NETCONN_EVT_ERROR, 0); + } + if (shut_rx) { + API_EVENT(conn, NETCONN_EVT_RCVPLUS, 0); + } + if (shut_tx) { + API_EVENT(conn, NETCONN_EVT_SENDPLUS, 0); + } + /* wake up the application task */ + sys_sem_signal(&conn->op_completed); + } else { + /* Closing failed, restore some of the callbacks */ + /* Closing of listen pcb will never fail! */ + LWIP_ASSERT("Closing a listen pcb may not fail!", (conn->pcb.tcp->state != LISTEN)); + tcp_sent(conn->pcb.tcp, sent_tcp); + tcp_poll(conn->pcb.tcp, poll_tcp, 4); + tcp_err(conn->pcb.tcp, err_tcp); + tcp_arg(conn->pcb.tcp, conn); + /* don't restore recv callback: we don't want to receive any more data */ + } + /* If closing didn't succeed, we get called again either + from poll_tcp or from sent_tcp */ +} +#endif /* LWIP_TCP */ + +/** + * Delete the pcb inside a netconn. + * Called from netconn_delete. + * + * @param msg the api_msg_msg pointing to the connection + */ +void +do_delconn(struct api_msg_msg *msg) +{ + /* @todo TCP: abort running write/connect? */ + if ((msg->conn->state != NETCONN_NONE) && + (msg->conn->state != NETCONN_LISTEN) && + (msg->conn->state != NETCONN_CONNECT)) { + /* this only happens for TCP netconns */ + LWIP_ASSERT("msg->conn->type == NETCONN_TCP", msg->conn->type == NETCONN_TCP); + msg->err = ERR_INPROGRESS; + } else { + LWIP_ASSERT("blocking connect in progress", + (msg->conn->state != NETCONN_CONNECT) || IN_NONBLOCKING_CONNECT(msg->conn)); + /* Drain and delete mboxes */ + netconn_drain(msg->conn); + + if (msg->conn->pcb.tcp != NULL) { + + switch (NETCONNTYPE_GROUP(msg->conn->type)) { +#if LWIP_RAW + case NETCONN_RAW: + raw_remove(msg->conn->pcb.raw); + break; +#endif /* LWIP_RAW */ +#if LWIP_UDP + case NETCONN_UDP: + msg->conn->pcb.udp->recv_arg = NULL; + udp_remove(msg->conn->pcb.udp); + break; +#endif /* LWIP_UDP */ +#if LWIP_TCP + case NETCONN_TCP: + LWIP_ASSERT("already writing or closing", msg->conn->current_msg == NULL && + msg->conn->write_offset == 0); + msg->conn->state = NETCONN_CLOSE; + msg->msg.sd.shut = NETCONN_SHUT_RDWR; + msg->conn->current_msg = msg; + do_close_internal(msg->conn); + /* API_EVENT is called inside do_close_internal, before releasing + the application thread, so we can return at this point! */ + return; +#endif /* LWIP_TCP */ + default: + break; + } + msg->conn->pcb.tcp = NULL; + } + /* tcp netconns don't come here! */ + + /* @todo: this lets select make the socket readable and writable, + which is wrong! errfd instead? */ + API_EVENT(msg->conn, NETCONN_EVT_RCVPLUS, 0); + API_EVENT(msg->conn, NETCONN_EVT_SENDPLUS, 0); + } + if (sys_sem_valid(&msg->conn->op_completed)) { + sys_sem_signal(&msg->conn->op_completed); + } +} + +/** + * Bind a pcb contained in a netconn + * Called from netconn_bind. + * + * @param msg the api_msg_msg pointing to the connection and containing + * the IP address and port to bind to + */ +void +do_bind(struct api_msg_msg *msg) +{ + if (ERR_IS_FATAL(msg->conn->last_err)) { + msg->err = msg->conn->last_err; + } else { + msg->err = ERR_VAL; + if (msg->conn->pcb.tcp != NULL) { + switch (NETCONNTYPE_GROUP(msg->conn->type)) { +#if LWIP_RAW + case NETCONN_RAW: + msg->err = raw_bind(msg->conn->pcb.raw, msg->msg.bc.ipaddr); + break; +#endif /* LWIP_RAW */ +#if LWIP_UDP + case NETCONN_UDP: + msg->err = udp_bind(msg->conn->pcb.udp, msg->msg.bc.ipaddr, msg->msg.bc.port); + break; +#endif /* LWIP_UDP */ +#if LWIP_TCP + case NETCONN_TCP: + msg->err = tcp_bind(msg->conn->pcb.tcp, msg->msg.bc.ipaddr, msg->msg.bc.port); + break; +#endif /* LWIP_TCP */ + default: + break; + } + } + } + TCPIP_APIMSG_ACK(msg); +} + +#if LWIP_TCP +/** + * TCP callback function if a connection (opened by tcp_connect/do_connect) has + * been established (or reset by the remote host). + * + * @see tcp.h (struct tcp_pcb.connected) for parameters and return values + */ +static err_t +do_connected(void *arg, struct tcp_pcb *pcb, err_t err) +{ + struct netconn *conn; + int was_blocking; + + LWIP_UNUSED_ARG(pcb); + + conn = (struct netconn *)arg; + + if (conn == NULL) { + return ERR_VAL; + } + + LWIP_ASSERT("conn->state == NETCONN_CONNECT", conn->state == NETCONN_CONNECT); + LWIP_ASSERT("(conn->current_msg != NULL) || conn->in_non_blocking_connect", + (conn->current_msg != NULL) || IN_NONBLOCKING_CONNECT(conn)); + + if (conn->current_msg != NULL) { + conn->current_msg->err = err; + } + if ((conn->type == NETCONN_TCP) && (err == ERR_OK)) { + setup_tcp(conn); + } + was_blocking = !IN_NONBLOCKING_CONNECT(conn); + SET_NONBLOCKING_CONNECT(conn, 0); + conn->current_msg = NULL; + conn->state = NETCONN_NONE; + if (!was_blocking) { + NETCONN_SET_SAFE_ERR(conn, ERR_OK); + } + API_EVENT(conn, NETCONN_EVT_SENDPLUS, 0); + + if (was_blocking) { + sys_sem_signal(&conn->op_completed); + } + return ERR_OK; +} +#endif /* LWIP_TCP */ + +/** + * Connect a pcb contained inside a netconn + * Called from netconn_connect. + * + * @param msg the api_msg_msg pointing to the connection and containing + * the IP address and port to connect to + */ +void +do_connect(struct api_msg_msg *msg) +{ + if (msg->conn->pcb.tcp == NULL) { + /* This may happen when calling netconn_connect() a second time */ + msg->err = ERR_CLSD; + } else { + switch (NETCONNTYPE_GROUP(msg->conn->type)) { +#if LWIP_RAW + case NETCONN_RAW: + msg->err = raw_connect(msg->conn->pcb.raw, msg->msg.bc.ipaddr); + break; +#endif /* LWIP_RAW */ +#if LWIP_UDP + case NETCONN_UDP: + msg->err = udp_connect(msg->conn->pcb.udp, msg->msg.bc.ipaddr, msg->msg.bc.port); + break; +#endif /* LWIP_UDP */ +#if LWIP_TCP + case NETCONN_TCP: + /* Prevent connect while doing any other action. */ + if (msg->conn->state != NETCONN_NONE) { + msg->err = ERR_ISCONN; + } else { + setup_tcp(msg->conn); + msg->err = tcp_connect(msg->conn->pcb.tcp, msg->msg.bc.ipaddr, + msg->msg.bc.port, do_connected); + if (msg->err == ERR_OK) { + u8_t non_blocking = netconn_is_nonblocking(msg->conn); + msg->conn->state = NETCONN_CONNECT; + SET_NONBLOCKING_CONNECT(msg->conn, non_blocking); + if (non_blocking) { + msg->err = ERR_INPROGRESS; + } else { + msg->conn->current_msg = msg; + /* sys_sem_signal() is called from do_connected (or err_tcp()), + * when the connection is established! */ + return; + } + } + } + break; +#endif /* LWIP_TCP */ + default: + LWIP_ERROR("Invalid netconn type", 0, do{ msg->err = ERR_VAL; }while(0)); + break; + } + } + sys_sem_signal(&msg->conn->op_completed); +} + +/** + * Connect a pcb contained inside a netconn + * Only used for UDP netconns. + * Called from netconn_disconnect. + * + * @param msg the api_msg_msg pointing to the connection to disconnect + */ +void +do_disconnect(struct api_msg_msg *msg) +{ +#if LWIP_UDP + if (NETCONNTYPE_GROUP(msg->conn->type) == NETCONN_UDP) { + udp_disconnect(msg->conn->pcb.udp); + msg->err = ERR_OK; + } else +#endif /* LWIP_UDP */ + { + msg->err = ERR_VAL; + } + TCPIP_APIMSG_ACK(msg); +} + +#if LWIP_TCP +/** + * Set a TCP pcb contained in a netconn into listen mode + * Called from netconn_listen. + * + * @param msg the api_msg_msg pointing to the connection + */ +void +do_listen(struct api_msg_msg *msg) +{ + if (ERR_IS_FATAL(msg->conn->last_err)) { + msg->err = msg->conn->last_err; + } else { + msg->err = ERR_CONN; + if (msg->conn->pcb.tcp != NULL) { + if (msg->conn->type == NETCONN_TCP) { + if (msg->conn->state == NETCONN_NONE) { +#if TCP_LISTEN_BACKLOG + struct tcp_pcb* lpcb = tcp_listen_with_backlog(msg->conn->pcb.tcp, msg->msg.lb.backlog); +#else /* TCP_LISTEN_BACKLOG */ + struct tcp_pcb* lpcb = tcp_listen(msg->conn->pcb.tcp); +#endif /* TCP_LISTEN_BACKLOG */ + if (lpcb == NULL) { + /* in this case, the old pcb is still allocated */ + msg->err = ERR_MEM; + } else { + /* delete the recvmbox and allocate the acceptmbox */ + if (sys_mbox_valid(&msg->conn->recvmbox)) { + /** @todo: should we drain the recvmbox here? */ + sys_mbox_free(&msg->conn->recvmbox); + sys_mbox_set_invalid(&msg->conn->recvmbox); + } + msg->err = ERR_OK; + if (!sys_mbox_valid(&msg->conn->acceptmbox)) { + msg->err = sys_mbox_new(&msg->conn->acceptmbox, DEFAULT_ACCEPTMBOX_SIZE); + } + if (msg->err == ERR_OK) { + msg->conn->state = NETCONN_LISTEN; + msg->conn->pcb.tcp = lpcb; + tcp_arg(msg->conn->pcb.tcp, msg->conn); + tcp_accept(msg->conn->pcb.tcp, accept_function); + } else { + /* since the old pcb is already deallocated, free lpcb now */ + tcp_close(lpcb); + msg->conn->pcb.tcp = NULL; + } + } + } + } + } + } + TCPIP_APIMSG_ACK(msg); +} +#endif /* LWIP_TCP */ + +/** + * Send some data on a RAW or UDP pcb contained in a netconn + * Called from netconn_send + * + * @param msg the api_msg_msg pointing to the connection + */ +void +do_send(struct api_msg_msg *msg) +{ + if (ERR_IS_FATAL(msg->conn->last_err)) { + msg->err = msg->conn->last_err; + } else { + msg->err = ERR_CONN; + if (msg->conn->pcb.tcp != NULL) { + switch (NETCONNTYPE_GROUP(msg->conn->type)) { +#if LWIP_RAW + case NETCONN_RAW: + if (ip_addr_isany(&msg->msg.b->addr)) { + msg->err = raw_send(msg->conn->pcb.raw, msg->msg.b->p); + } else { + msg->err = raw_sendto(msg->conn->pcb.raw, msg->msg.b->p, &msg->msg.b->addr); + } + break; +#endif +#if LWIP_UDP + case NETCONN_UDP: +#if LWIP_CHECKSUM_ON_COPY + if (ip_addr_isany(&msg->msg.b->addr)) { + msg->err = udp_send_chksum(msg->conn->pcb.udp, msg->msg.b->p, + msg->msg.b->flags & NETBUF_FLAG_CHKSUM, msg->msg.b->toport_chksum); + } else { + msg->err = udp_sendto_chksum(msg->conn->pcb.udp, msg->msg.b->p, + &msg->msg.b->addr, msg->msg.b->port, + msg->msg.b->flags & NETBUF_FLAG_CHKSUM, msg->msg.b->toport_chksum); + } +#else /* LWIP_CHECKSUM_ON_COPY */ + if (ip_addr_isany(&msg->msg.b->addr)) { + msg->err = udp_send(msg->conn->pcb.udp, msg->msg.b->p); + } else { + msg->err = udp_sendto(msg->conn->pcb.udp, msg->msg.b->p, &msg->msg.b->addr, msg->msg.b->port); + } +#endif /* LWIP_CHECKSUM_ON_COPY */ + break; +#endif /* LWIP_UDP */ + default: + break; + } + } + } + TCPIP_APIMSG_ACK(msg); +} + +#if LWIP_TCP +/** + * Indicate data has been received from a TCP pcb contained in a netconn + * Called from netconn_recv + * + * @param msg the api_msg_msg pointing to the connection + */ +void +do_recv(struct api_msg_msg *msg) +{ + msg->err = ERR_OK; + if (msg->conn->pcb.tcp != NULL) { + if (msg->conn->type == NETCONN_TCP) { +#if TCP_LISTEN_BACKLOG + if (msg->conn->pcb.tcp->state == LISTEN) { + tcp_accepted(msg->conn->pcb.tcp); + } else +#endif /* TCP_LISTEN_BACKLOG */ + { + u32_t remaining = msg->msg.r.len; + do { + u16_t recved = (remaining > 0xffff) ? 0xffff : (u16_t)remaining; + tcp_recved(msg->conn->pcb.tcp, recved); + remaining -= recved; + }while(remaining != 0); + } + } + } + TCPIP_APIMSG_ACK(msg); +} + +/** + * See if more data needs to be written from a previous call to netconn_write. + * Called initially from do_write. If the first call can't send all data + * (because of low memory or empty send-buffer), this function is called again + * from sent_tcp() or poll_tcp() to send more data. If all data is sent, the + * blocking application thread (waiting in netconn_write) is released. + * + * @param conn netconn (that is currently in state NETCONN_WRITE) to process + * @return ERR_OK + * ERR_MEM if LWIP_TCPIP_CORE_LOCKING=1 and sending hasn't yet finished + */ +static err_t +do_writemore(struct netconn *conn) +{ + err_t err = ERR_OK; + void *dataptr; + u16_t len, available; + u8_t write_finished = 0; + size_t diff; + u8_t dontblock = netconn_is_nonblocking(conn) || + (conn->current_msg->msg.w.apiflags & NETCONN_DONTBLOCK); + u8_t apiflags = conn->current_msg->msg.w.apiflags; + + LWIP_ASSERT("conn != NULL", conn != NULL); + LWIP_ASSERT("conn->state == NETCONN_WRITE", (conn->state == NETCONN_WRITE)); + LWIP_ASSERT("conn->current_msg != NULL", conn->current_msg != NULL); + LWIP_ASSERT("conn->pcb.tcp != NULL", conn->pcb.tcp != NULL); + LWIP_ASSERT("conn->write_offset < conn->current_msg->msg.w.len", + conn->write_offset < conn->current_msg->msg.w.len); + + dataptr = (u8_t*)conn->current_msg->msg.w.dataptr + conn->write_offset; + diff = conn->current_msg->msg.w.len - conn->write_offset; + if (diff > 0xffffUL) { /* max_u16_t */ + len = 0xffff; +#if LWIP_TCPIP_CORE_LOCKING + conn->flags |= NETCONN_FLAG_WRITE_DELAYED; +#endif + apiflags |= TCP_WRITE_FLAG_MORE; + } else { + len = (u16_t)diff; + } + available = tcp_sndbuf(conn->pcb.tcp); + if (available < len) { + /* don't try to write more than sendbuf */ + len = available; +#if LWIP_TCPIP_CORE_LOCKING + conn->flags |= NETCONN_FLAG_WRITE_DELAYED; +#endif + apiflags |= TCP_WRITE_FLAG_MORE; + } + if (dontblock && (len < conn->current_msg->msg.w.len)) { + /* failed to send all data at once -> nonblocking write not possible */ + err = ERR_MEM; + } + if (err == ERR_OK) { + LWIP_ASSERT("do_writemore: invalid length!", ((conn->write_offset + len) <= conn->current_msg->msg.w.len)); + err = tcp_write(conn->pcb.tcp, dataptr, len, apiflags); + } + if (dontblock && (err == ERR_MEM)) { + /* nonblocking write failed */ + write_finished = 1; + err = ERR_WOULDBLOCK; + /* let poll_tcp check writable space to mark the pcb + writable again */ + conn->flags |= NETCONN_FLAG_CHECK_WRITESPACE; + /* let select mark this pcb as non-writable. */ + API_EVENT(conn, NETCONN_EVT_SENDMINUS, len); + } else { + /* if OK or memory error, check available space */ + if (((err == ERR_OK) || (err == ERR_MEM)) && + ((tcp_sndbuf(conn->pcb.tcp) <= TCP_SNDLOWAT) || + (tcp_sndqueuelen(conn->pcb.tcp) >= TCP_SNDQUEUELOWAT))) { + /* The queued byte- or pbuf-count exceeds the configured low-water limit, + let select mark this pcb as non-writable. */ + API_EVENT(conn, NETCONN_EVT_SENDMINUS, len); + } + + if (err == ERR_OK) { + conn->write_offset += len; + if (conn->write_offset == conn->current_msg->msg.w.len) { + /* everything was written */ + write_finished = 1; + conn->write_offset = 0; + } + tcp_output(conn->pcb.tcp); + } else if (err == ERR_MEM) { + /* If ERR_MEM, we wait for sent_tcp or poll_tcp to be called + we do NOT return to the application thread, since ERR_MEM is + only a temporary error! */ + + /* tcp_write returned ERR_MEM, try tcp_output anyway */ + tcp_output(conn->pcb.tcp); + + #if LWIP_TCPIP_CORE_LOCKING + conn->flags |= NETCONN_FLAG_WRITE_DELAYED; + #endif + } else { + /* On errors != ERR_MEM, we don't try writing any more but return + the error to the application thread. */ + write_finished = 1; + } + } + + if (write_finished) { + /* everything was written: set back connection state + and back to application task */ + conn->current_msg->err = err; + conn->current_msg = NULL; + conn->state = NETCONN_NONE; +#if LWIP_TCPIP_CORE_LOCKING + if ((conn->flags & NETCONN_FLAG_WRITE_DELAYED) != 0) +#endif + { + sys_sem_signal(&conn->op_completed); + } + } +#if LWIP_TCPIP_CORE_LOCKING + else + return ERR_MEM; +#endif + return ERR_OK; +} +#endif /* LWIP_TCP */ + +/** + * Send some data on a TCP pcb contained in a netconn + * Called from netconn_write + * + * @param msg the api_msg_msg pointing to the connection + */ +void +do_write(struct api_msg_msg *msg) +{ + if (ERR_IS_FATAL(msg->conn->last_err)) { + msg->err = msg->conn->last_err; + } else { + if (msg->conn->type == NETCONN_TCP) { +#if LWIP_TCP + if (msg->conn->state != NETCONN_NONE) { + /* netconn is connecting, closing or in blocking write */ + msg->err = ERR_INPROGRESS; + } else if (msg->conn->pcb.tcp != NULL) { + msg->conn->state = NETCONN_WRITE; + /* set all the variables used by do_writemore */ + LWIP_ASSERT("already writing or closing", msg->conn->current_msg == NULL && + msg->conn->write_offset == 0); + LWIP_ASSERT("msg->msg.w.len != 0", msg->msg.w.len != 0); + msg->conn->current_msg = msg; + msg->conn->write_offset = 0; +#if LWIP_TCPIP_CORE_LOCKING + msg->conn->flags &= ~NETCONN_FLAG_WRITE_DELAYED; + if (do_writemore(msg->conn) != ERR_OK) { + LWIP_ASSERT("state!", msg->conn->state == NETCONN_WRITE); + UNLOCK_TCPIP_CORE(); + sys_arch_sem_wait(&msg->conn->op_completed, 0); + LOCK_TCPIP_CORE(); + LWIP_ASSERT("state!", msg->conn->state == NETCONN_NONE); + } +#else /* LWIP_TCPIP_CORE_LOCKING */ + do_writemore(msg->conn); +#endif /* LWIP_TCPIP_CORE_LOCKING */ + /* for both cases: if do_writemore was called, don't ACK the APIMSG + since do_writemore ACKs it! */ + return; + } else { + msg->err = ERR_CONN; + } +#else /* LWIP_TCP */ + msg->err = ERR_VAL; +#endif /* LWIP_TCP */ +#if (LWIP_UDP || LWIP_RAW) + } else { + msg->err = ERR_VAL; +#endif /* (LWIP_UDP || LWIP_RAW) */ + } + } + TCPIP_APIMSG_ACK(msg); +} + +/** + * Return a connection's local or remote address + * Called from netconn_getaddr + * + * @param msg the api_msg_msg pointing to the connection + */ +void +do_getaddr(struct api_msg_msg *msg) +{ + if (msg->conn->pcb.ip != NULL) { + *(msg->msg.ad.ipaddr) = (msg->msg.ad.local ? msg->conn->pcb.ip->local_ip : + msg->conn->pcb.ip->remote_ip); + + msg->err = ERR_OK; + switch (NETCONNTYPE_GROUP(msg->conn->type)) { +#if LWIP_RAW + case NETCONN_RAW: + if (msg->msg.ad.local) { + *(msg->msg.ad.port) = msg->conn->pcb.raw->protocol; + } else { + /* return an error as connecting is only a helper for upper layers */ + msg->err = ERR_CONN; + } + break; +#endif /* LWIP_RAW */ +#if LWIP_UDP + case NETCONN_UDP: + if (msg->msg.ad.local) { + *(msg->msg.ad.port) = msg->conn->pcb.udp->local_port; + } else { + if ((msg->conn->pcb.udp->flags & UDP_FLAGS_CONNECTED) == 0) { + msg->err = ERR_CONN; + } else { + *(msg->msg.ad.port) = msg->conn->pcb.udp->remote_port; + } + } + break; +#endif /* LWIP_UDP */ +#if LWIP_TCP + case NETCONN_TCP: + *(msg->msg.ad.port) = (msg->msg.ad.local?msg->conn->pcb.tcp->local_port:msg->conn->pcb.tcp->remote_port); + break; +#endif /* LWIP_TCP */ + default: + LWIP_ASSERT("invalid netconn_type", 0); + break; + } + } else { + msg->err = ERR_CONN; + } + TCPIP_APIMSG_ACK(msg); +} + +/** + * Close a TCP pcb contained in a netconn + * Called from netconn_close + * + * @param msg the api_msg_msg pointing to the connection + */ +void +do_close(struct api_msg_msg *msg) +{ +#if LWIP_TCP + /* @todo: abort running write/connect? */ + if ((msg->conn->state != NETCONN_NONE) && (msg->conn->state != NETCONN_LISTEN)) { + /* this only happens for TCP netconns */ + LWIP_ASSERT("msg->conn->type == NETCONN_TCP", msg->conn->type == NETCONN_TCP); + msg->err = ERR_INPROGRESS; + } else if ((msg->conn->pcb.tcp != NULL) && (msg->conn->type == NETCONN_TCP)) { + if ((msg->msg.sd.shut != NETCONN_SHUT_RDWR) && (msg->conn->state == NETCONN_LISTEN)) { + /* LISTEN doesn't support half shutdown */ + msg->err = ERR_CONN; + } else { + if (msg->msg.sd.shut & NETCONN_SHUT_RD) { + /* Drain and delete mboxes */ + netconn_drain(msg->conn); + } + LWIP_ASSERT("already writing or closing", msg->conn->current_msg == NULL && + msg->conn->write_offset == 0); + msg->conn->state = NETCONN_CLOSE; + msg->conn->current_msg = msg; + do_close_internal(msg->conn); + /* for tcp netconns, do_close_internal ACKs the message */ + return; + } + } else +#endif /* LWIP_TCP */ + { + msg->err = ERR_VAL; + } + sys_sem_signal(&msg->conn->op_completed); +} + +#if LWIP_IGMP +/** + * Join multicast groups for UDP netconns. + * Called from netconn_join_leave_group + * + * @param msg the api_msg_msg pointing to the connection + */ +void +do_join_leave_group(struct api_msg_msg *msg) +{ + if (ERR_IS_FATAL(msg->conn->last_err)) { + msg->err = msg->conn->last_err; + } else { + if (msg->conn->pcb.tcp != NULL) { + if (NETCONNTYPE_GROUP(msg->conn->type) == NETCONN_UDP) { +#if LWIP_UDP + if (msg->msg.jl.join_or_leave == NETCONN_JOIN) { + msg->err = igmp_joingroup(msg->msg.jl.netif_addr, msg->msg.jl.multiaddr); + } else { + msg->err = igmp_leavegroup(msg->msg.jl.netif_addr, msg->msg.jl.multiaddr); + } +#endif /* LWIP_UDP */ +#if (LWIP_TCP || LWIP_RAW) + } else { + msg->err = ERR_VAL; +#endif /* (LWIP_TCP || LWIP_RAW) */ + } + } else { + msg->err = ERR_CONN; + } + } + TCPIP_APIMSG_ACK(msg); +} +#endif /* LWIP_IGMP */ + +#if LWIP_DNS +/** + * Callback function that is called when DNS name is resolved + * (or on timeout). A waiting application thread is waked up by + * signaling the semaphore. + */ +static void +do_dns_found(const char *name, ip_addr_t *ipaddr, void *arg) +{ + struct dns_api_msg *msg = (struct dns_api_msg*)arg; + + LWIP_ASSERT("DNS response for wrong host name", strcmp(msg->name, name) == 0); + LWIP_UNUSED_ARG(name); + + if (ipaddr == NULL) { + /* timeout or memory error */ + *msg->err = ERR_VAL; + } else { + /* address was resolved */ + *msg->err = ERR_OK; + *msg->addr = *ipaddr; + } + /* wake up the application task waiting in netconn_gethostbyname */ + sys_sem_signal(msg->sem); +} + +/** + * Execute a DNS query + * Called from netconn_gethostbyname + * + * @param arg the dns_api_msg pointing to the query + */ +void +do_gethostbyname(void *arg) +{ + struct dns_api_msg *msg = (struct dns_api_msg*)arg; + + *msg->err = dns_gethostbyname(msg->name, msg->addr, do_dns_found, msg); + if (*msg->err != ERR_INPROGRESS) { + /* on error or immediate success, wake up the application + * task waiting in netconn_gethostbyname */ + sys_sem_signal(msg->sem); + } +} +#endif /* LWIP_DNS */ + +#endif /* LWIP_NETCONN */ diff --git a/lib/drivers/lwip/src/api/err.c b/lib/drivers/lwip/src/api/err.c new file mode 100644 index 00000000000..92fa8b7dba1 --- /dev/null +++ b/lib/drivers/lwip/src/api/err.c @@ -0,0 +1,75 @@ +/** + * @file + * Error Management module + * + */ + +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ + +#include "lwip/err.h" + +#ifdef LWIP_DEBUG + +static const char *err_strerr[] = { + "Ok.", /* ERR_OK 0 */ + "Out of memory error.", /* ERR_MEM -1 */ + "Buffer error.", /* ERR_BUF -2 */ + "Timeout.", /* ERR_TIMEOUT -3 */ + "Routing problem.", /* ERR_RTE -4 */ + "Operation in progress.", /* ERR_INPROGRESS -5 */ + "Illegal value.", /* ERR_VAL -6 */ + "Operation would block.", /* ERR_WOULDBLOCK -7 */ + "Address in use.", /* ERR_USE -8 */ + "Already connected.", /* ERR_ISCONN -9 */ + "Connection aborted.", /* ERR_ABRT -10 */ + "Connection reset.", /* ERR_RST -11 */ + "Connection closed.", /* ERR_CLSD -12 */ + "Not connected.", /* ERR_CONN -13 */ + "Illegal argument.", /* ERR_ARG -14 */ + "Low-level netif error.", /* ERR_IF -15 */ +}; + +/** + * Convert an lwip internal error to a string representation. + * + * @param err an lwip internal err_t + * @return a string representation for err + */ +const char * +lwip_strerr(err_t err) +{ + return err_strerr[-err]; + +} + +#endif /* LWIP_DEBUG */ diff --git a/lib/drivers/lwip/src/api/netbuf.c b/lib/drivers/lwip/src/api/netbuf.c new file mode 100644 index 00000000000..9390c9ee983 --- /dev/null +++ b/lib/drivers/lwip/src/api/netbuf.c @@ -0,0 +1,245 @@ +/** + * @file + * Network buffer management + * + */ + +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ + +#include "lwip/opt.h" + +#if LWIP_NETCONN /* don't build if not configured for use in lwipopts.h */ + +#include "lwip/netbuf.h" +#include "lwip/memp.h" + +#include + +/** + * Create (allocate) and initialize a new netbuf. + * The netbuf doesn't yet contain a packet buffer! + * + * @return a pointer to a new netbuf + * NULL on lack of memory + */ +struct +netbuf *netbuf_new(void) +{ + struct netbuf *buf; + + buf = (struct netbuf *)memp_malloc(MEMP_NETBUF); + if (buf != NULL) { + buf->p = NULL; + buf->ptr = NULL; + ip_addr_set_any(&buf->addr); + buf->port = 0; +#if LWIP_NETBUF_RECVINFO || LWIP_CHECKSUM_ON_COPY +#if LWIP_CHECKSUM_ON_COPY + buf->flags = 0; +#endif /* LWIP_CHECKSUM_ON_COPY */ + buf->toport_chksum = 0; +#if LWIP_NETBUF_RECVINFO + ip_addr_set_any(&buf->toaddr); +#endif /* LWIP_NETBUF_RECVINFO */ +#endif /* LWIP_NETBUF_RECVINFO || LWIP_CHECKSUM_ON_COPY */ + return buf; + } else { + return NULL; + } +} + +/** + * Deallocate a netbuf allocated by netbuf_new(). + * + * @param buf pointer to a netbuf allocated by netbuf_new() + */ +void +netbuf_delete(struct netbuf *buf) +{ + if (buf != NULL) { + if (buf->p != NULL) { + pbuf_free(buf->p); + buf->p = buf->ptr = NULL; + } + memp_free(MEMP_NETBUF, buf); + } +} + +/** + * Allocate memory for a packet buffer for a given netbuf. + * + * @param buf the netbuf for which to allocate a packet buffer + * @param size the size of the packet buffer to allocate + * @return pointer to the allocated memory + * NULL if no memory could be allocated + */ +void * +netbuf_alloc(struct netbuf *buf, u16_t size) +{ + LWIP_ERROR("netbuf_alloc: invalid buf", (buf != NULL), return NULL;); + + /* Deallocate any previously allocated memory. */ + if (buf->p != NULL) { + pbuf_free(buf->p); + } + buf->p = pbuf_alloc(PBUF_TRANSPORT, size, PBUF_RAM); + if (buf->p == NULL) { + return NULL; + } + LWIP_ASSERT("check that first pbuf can hold size", + (buf->p->len >= size)); + buf->ptr = buf->p; + return buf->p->payload; +} + +/** + * Free the packet buffer included in a netbuf + * + * @param buf pointer to the netbuf which contains the packet buffer to free + */ +void +netbuf_free(struct netbuf *buf) +{ + LWIP_ERROR("netbuf_free: invalid buf", (buf != NULL), return;); + if (buf->p != NULL) { + pbuf_free(buf->p); + } + buf->p = buf->ptr = NULL; +} + +/** + * Let a netbuf reference existing (non-volatile) data. + * + * @param buf netbuf which should reference the data + * @param dataptr pointer to the data to reference + * @param size size of the data + * @return ERR_OK if data is referenced + * ERR_MEM if data couldn't be referenced due to lack of memory + */ +err_t +netbuf_ref(struct netbuf *buf, const void *dataptr, u16_t size) +{ + LWIP_ERROR("netbuf_ref: invalid buf", (buf != NULL), return ERR_ARG;); + if (buf->p != NULL) { + pbuf_free(buf->p); + } + buf->p = pbuf_alloc(PBUF_TRANSPORT, 0, PBUF_REF); + if (buf->p == NULL) { + buf->ptr = NULL; + return ERR_MEM; + } + buf->p->payload = (void*)dataptr; + buf->p->len = buf->p->tot_len = size; + buf->ptr = buf->p; + return ERR_OK; +} + +/** + * Chain one netbuf to another (@see pbuf_chain) + * + * @param head the first netbuf + * @param tail netbuf to chain after head, freed by this function, may not be reference after returning + */ +void +netbuf_chain(struct netbuf *head, struct netbuf *tail) +{ + LWIP_ERROR("netbuf_ref: invalid head", (head != NULL), return;); + LWIP_ERROR("netbuf_chain: invalid tail", (tail != NULL), return;); + pbuf_cat(head->p, tail->p); + head->ptr = head->p; + memp_free(MEMP_NETBUF, tail); +} + +/** + * Get the data pointer and length of the data inside a netbuf. + * + * @param buf netbuf to get the data from + * @param dataptr pointer to a void pointer where to store the data pointer + * @param len pointer to an u16_t where the length of the data is stored + * @return ERR_OK if the information was retreived, + * ERR_BUF on error. + */ +err_t +netbuf_data(struct netbuf *buf, void **dataptr, u16_t *len) +{ + LWIP_ERROR("netbuf_data: invalid buf", (buf != NULL), return ERR_ARG;); + LWIP_ERROR("netbuf_data: invalid dataptr", (dataptr != NULL), return ERR_ARG;); + LWIP_ERROR("netbuf_data: invalid len", (len != NULL), return ERR_ARG;); + + if (buf->ptr == NULL) { + return ERR_BUF; + } + *dataptr = buf->ptr->payload; + *len = buf->ptr->len; + return ERR_OK; +} + +/** + * Move the current data pointer of a packet buffer contained in a netbuf + * to the next part. + * The packet buffer itself is not modified. + * + * @param buf the netbuf to modify + * @return -1 if there is no next part + * 1 if moved to the next part but now there is no next part + * 0 if moved to the next part and there are still more parts + */ +s8_t +netbuf_next(struct netbuf *buf) +{ + LWIP_ERROR("netbuf_free: invalid buf", (buf != NULL), return -1;); + if (buf->ptr->next == NULL) { + return -1; + } + buf->ptr = buf->ptr->next; + if (buf->ptr->next == NULL) { + return 1; + } + return 0; +} + +/** + * Move the current data pointer of a packet buffer contained in a netbuf + * to the beginning of the packet. + * The packet buffer itself is not modified. + * + * @param buf the netbuf to modify + */ +void +netbuf_first(struct netbuf *buf) +{ + LWIP_ERROR("netbuf_free: invalid buf", (buf != NULL), return;); + buf->ptr = buf->p; +} + +#endif /* LWIP_NETCONN */ diff --git a/lib/drivers/lwip/src/api/netdb.c b/lib/drivers/lwip/src/api/netdb.c new file mode 100644 index 00000000000..a7e4e06bca2 --- /dev/null +++ b/lib/drivers/lwip/src/api/netdb.c @@ -0,0 +1,352 @@ +/** + * @file + * API functions for name resolving + * + */ + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Simon Goldschmidt + * + */ + +#include "lwip/netdb.h" + +#if LWIP_DNS && LWIP_SOCKET + +#include "lwip/err.h" +#include "lwip/mem.h" +#include "lwip/memp.h" +#include "lwip/ip_addr.h" +#include "lwip/api.h" +#include "lwip/dns.h" + +#include +#include + +/** helper struct for gethostbyname_r to access the char* buffer */ +struct gethostbyname_r_helper { + ip_addr_t *addrs; + ip_addr_t addr; + char *aliases; +}; + +/** h_errno is exported in netdb.h for access by applications. */ +#if LWIP_DNS_API_DECLARE_H_ERRNO +int h_errno; +#endif /* LWIP_DNS_API_DECLARE_H_ERRNO */ + +/** define "hostent" variables storage: 0 if we use a static (but unprotected) + * set of variables for lwip_gethostbyname, 1 if we use a local storage */ +#ifndef LWIP_DNS_API_HOSTENT_STORAGE +#define LWIP_DNS_API_HOSTENT_STORAGE 0 +#endif + +/** define "hostent" variables storage */ +#if LWIP_DNS_API_HOSTENT_STORAGE +#define HOSTENT_STORAGE +#else +#define HOSTENT_STORAGE static +#endif /* LWIP_DNS_API_STATIC_HOSTENT */ + +/** + * Returns an entry containing addresses of address family AF_INET + * for the host with name name. + * Due to dns_gethostbyname limitations, only one address is returned. + * + * @param name the hostname to resolve + * @return an entry containing addresses of address family AF_INET + * for the host with name name + */ +struct hostent* +lwip_gethostbyname(const char *name) +{ + err_t err; + ip_addr_t addr; + + /* buffer variables for lwip_gethostbyname() */ + HOSTENT_STORAGE struct hostent s_hostent; + HOSTENT_STORAGE char *s_aliases; + HOSTENT_STORAGE ip_addr_t s_hostent_addr; + HOSTENT_STORAGE ip_addr_t *s_phostent_addr[2]; + + /* query host IP address */ + err = netconn_gethostbyname(name, &addr); + if (err != ERR_OK) { + LWIP_DEBUGF(DNS_DEBUG, ("lwip_gethostbyname(%s) failed, err=%d\n", name, err)); + h_errno = HOST_NOT_FOUND; + return NULL; + } + + /* fill hostent */ + s_hostent_addr = addr; + s_phostent_addr[0] = &s_hostent_addr; + s_phostent_addr[1] = NULL; + s_hostent.h_name = (char*)name; + s_hostent.h_aliases = &s_aliases; + s_hostent.h_addrtype = AF_INET; + s_hostent.h_length = sizeof(ip_addr_t); + s_hostent.h_addr_list = (char**)&s_phostent_addr; + +#if DNS_DEBUG + /* dump hostent */ + LWIP_DEBUGF(DNS_DEBUG, ("hostent.h_name == %s\n", s_hostent.h_name)); + LWIP_DEBUGF(DNS_DEBUG, ("hostent.h_aliases == %p\n", s_hostent.h_aliases)); + if (s_hostent.h_aliases != NULL) { + u8_t idx; + for ( idx=0; s_hostent.h_aliases[idx]; idx++) { + LWIP_DEBUGF(DNS_DEBUG, ("hostent.h_aliases[%i]-> == %p\n", idx, s_hostent.h_aliases[idx])); + LWIP_DEBUGF(DNS_DEBUG, ("hostent.h_aliases[%i]-> == %s\n", idx, s_hostent.h_aliases[idx])); + } + } + LWIP_DEBUGF(DNS_DEBUG, ("hostent.h_addrtype == %d\n", s_hostent.h_addrtype)); + LWIP_DEBUGF(DNS_DEBUG, ("hostent.h_length == %d\n", s_hostent.h_length)); + LWIP_DEBUGF(DNS_DEBUG, ("hostent.h_addr_list == %p\n", s_hostent.h_addr_list)); + if (s_hostent.h_addr_list != NULL) { + u8_t idx; + for ( idx=0; s_hostent.h_addr_list[idx]; idx++) { + LWIP_DEBUGF(DNS_DEBUG, ("hostent.h_addr_list[%i] == %p\n", idx, s_hostent.h_addr_list[idx])); + LWIP_DEBUGF(DNS_DEBUG, ("hostent.h_addr_list[%i]-> == %s\n", idx, ip_ntoa((ip_addr_t*)s_hostent.h_addr_list[idx]))); + } + } +#endif /* DNS_DEBUG */ + +#if LWIP_DNS_API_HOSTENT_STORAGE + /* this function should return the "per-thread" hostent after copy from s_hostent */ + return sys_thread_hostent(&s_hostent); +#else + return &s_hostent; +#endif /* LWIP_DNS_API_HOSTENT_STORAGE */ +} + +/** + * Thread-safe variant of lwip_gethostbyname: instead of using a static + * buffer, this function takes buffer and errno pointers as arguments + * and uses these for the result. + * + * @param name the hostname to resolve + * @param ret pre-allocated struct where to store the result + * @param buf pre-allocated buffer where to store additional data + * @param buflen the size of buf + * @param result pointer to a hostent pointer that is set to ret on success + * and set to zero on error + * @param h_errnop pointer to an int where to store errors (instead of modifying + * the global h_errno) + * @return 0 on success, non-zero on error, additional error information + * is stored in *h_errnop instead of h_errno to be thread-safe + */ +int +lwip_gethostbyname_r(const char *name, struct hostent *ret, char *buf, + size_t buflen, struct hostent **result, int *h_errnop) +{ + err_t err; + struct gethostbyname_r_helper *h; + char *hostname; + size_t namelen; + int lh_errno; + + if (h_errnop == NULL) { + /* ensure h_errnop is never NULL */ + h_errnop = &lh_errno; + } + + if (result == NULL) { + /* not all arguments given */ + *h_errnop = EINVAL; + return -1; + } + /* first thing to do: set *result to nothing */ + *result = NULL; + if ((name == NULL) || (ret == NULL) || (buf == 0)) { + /* not all arguments given */ + *h_errnop = EINVAL; + return -1; + } + + namelen = strlen(name); + if (buflen < (sizeof(struct gethostbyname_r_helper) + namelen + 1 + (MEM_ALIGNMENT - 1))) { + /* buf can't hold the data needed + a copy of name */ + *h_errnop = ERANGE; + return -1; + } + + h = (struct gethostbyname_r_helper*)LWIP_MEM_ALIGN(buf); + hostname = ((char*)h) + sizeof(struct gethostbyname_r_helper); + + /* query host IP address */ + err = netconn_gethostbyname(name, &(h->addr)); + if (err != ERR_OK) { + LWIP_DEBUGF(DNS_DEBUG, ("lwip_gethostbyname(%s) failed, err=%d\n", name, err)); + *h_errnop = ENSRNOTFOUND; + return -1; + } + + /* copy the hostname into buf */ + MEMCPY(hostname, name, namelen); + hostname[namelen] = 0; + + /* fill hostent */ + h->addrs = &(h->addr); + h->aliases = NULL; + ret->h_name = (char*)hostname; + ret->h_aliases = &(h->aliases); + ret->h_addrtype = AF_INET; + ret->h_length = sizeof(ip_addr_t); + ret->h_addr_list = (char**)&(h->addrs); + + /* set result != NULL */ + *result = ret; + + /* return success */ + return 0; +} + +/** + * Frees one or more addrinfo structures returned by getaddrinfo(), along with + * any additional storage associated with those structures. If the ai_next field + * of the structure is not null, the entire list of structures is freed. + * + * @param ai struct addrinfo to free + */ +void +lwip_freeaddrinfo(struct addrinfo *ai) +{ + struct addrinfo *next; + + while (ai != NULL) { + next = ai->ai_next; + memp_free(MEMP_NETDB, ai); + ai = next; + } +} + +/** + * Translates the name of a service location (for example, a host name) and/or + * a service name and returns a set of socket addresses and associated + * information to be used in creating a socket with which to address the + * specified service. + * Memory for the result is allocated internally and must be freed by calling + * lwip_freeaddrinfo()! + * + * Due to a limitation in dns_gethostbyname, only the first address of a + * host is returned. + * Also, service names are not supported (only port numbers)! + * + * @param nodename descriptive name or address string of the host + * (may be NULL -> local address) + * @param servname port number as string of NULL + * @param hints structure containing input values that set socktype and protocol + * @param res pointer to a pointer where to store the result (set to NULL on failure) + * @return 0 on success, non-zero on failure + */ +int +lwip_getaddrinfo(const char *nodename, const char *servname, + const struct addrinfo *hints, struct addrinfo **res) +{ + err_t err; + ip_addr_t addr; + struct addrinfo *ai; + struct sockaddr_in *sa = NULL; + int port_nr = 0; + size_t total_size; + size_t namelen = 0; + + if (res == NULL) { + return EAI_FAIL; + } + *res = NULL; + if ((nodename == NULL) && (servname == NULL)) { + return EAI_NONAME; + } + + if (servname != NULL) { + /* service name specified: convert to port number + * @todo?: currently, only ASCII integers (port numbers) are supported! */ + port_nr = atoi(servname); + if ((port_nr <= 0) || (port_nr > 0xffff)) { + return EAI_SERVICE; + } + } + + if (nodename != NULL) { + /* service location specified, try to resolve */ + err = netconn_gethostbyname(nodename, &addr); + if (err != ERR_OK) { + return EAI_FAIL; + } + } else { + /* service location specified, use loopback address */ + ip_addr_set_loopback(&addr); + } + + total_size = sizeof(struct addrinfo) + sizeof(struct sockaddr_in); + if (nodename != NULL) { + namelen = strlen(nodename); + LWIP_ASSERT("namelen is too long", (namelen + 1) <= (mem_size_t)-1); + total_size += namelen + 1; + } + /* If this fails, please report to lwip-devel! :-) */ + LWIP_ASSERT("total_size <= NETDB_ELEM_SIZE: please report this!", + total_size <= NETDB_ELEM_SIZE); + ai = (struct addrinfo *)memp_malloc(MEMP_NETDB); + if (ai == NULL) { + goto memerr; + } + memset(ai, 0, total_size); + sa = (struct sockaddr_in*)((u8_t*)ai + sizeof(struct addrinfo)); + /* set up sockaddr */ + inet_addr_from_ipaddr(&sa->sin_addr, &addr); + sa->sin_family = AF_INET; + sa->sin_len = sizeof(struct sockaddr_in); + sa->sin_port = htons((u16_t)port_nr); + + /* set up addrinfo */ + ai->ai_family = AF_INET; + if (hints != NULL) { + /* copy socktype & protocol from hints if specified */ + ai->ai_socktype = hints->ai_socktype; + ai->ai_protocol = hints->ai_protocol; + } + if (nodename != NULL) { + /* copy nodename to canonname if specified */ + ai->ai_canonname = ((char*)ai + sizeof(struct addrinfo) + sizeof(struct sockaddr_in)); + MEMCPY(ai->ai_canonname, nodename, namelen); + ai->ai_canonname[namelen] = 0; + } + ai->ai_addrlen = sizeof(struct sockaddr_in); + ai->ai_addr = (struct sockaddr*)sa; + + *res = ai; + + return 0; +memerr: + if (ai != NULL) { + memp_free(MEMP_NETDB, ai); + } + return EAI_MEMORY; +} + +#endif /* LWIP_DNS && LWIP_SOCKET */ diff --git a/lib/drivers/lwip/src/api/netifapi.c b/lib/drivers/lwip/src/api/netifapi.c new file mode 100644 index 00000000000..43e47203a9a --- /dev/null +++ b/lib/drivers/lwip/src/api/netifapi.c @@ -0,0 +1,160 @@ +/** + * @file + * Network Interface Sequential API module + * + */ + +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + */ + +#include "lwip/opt.h" + +#if LWIP_NETIF_API /* don't build if not configured for use in lwipopts.h */ + +#include "lwip/netifapi.h" +#include "lwip/tcpip.h" + +/** + * Call netif_add() inside the tcpip_thread context. + */ +void +do_netifapi_netif_add(struct netifapi_msg_msg *msg) +{ + if (!netif_add( msg->netif, + msg->msg.add.ipaddr, + msg->msg.add.netmask, + msg->msg.add.gw, + msg->msg.add.state, + msg->msg.add.init, + msg->msg.add.input)) { + msg->err = ERR_IF; + } else { + msg->err = ERR_OK; + } + TCPIP_NETIFAPI_ACK(msg); +} + +/** + * Call netif_set_addr() inside the tcpip_thread context. + */ +void +do_netifapi_netif_set_addr(struct netifapi_msg_msg *msg) +{ + netif_set_addr( msg->netif, + msg->msg.add.ipaddr, + msg->msg.add.netmask, + msg->msg.add.gw); + msg->err = ERR_OK; + TCPIP_NETIFAPI_ACK(msg); +} + +/** + * Call the "errtfunc" (or the "voidfunc" if "errtfunc" is NULL) inside the + * tcpip_thread context. + */ +void +do_netifapi_netif_common(struct netifapi_msg_msg *msg) +{ + if (msg->msg.common.errtfunc != NULL) { + msg->err = msg->msg.common.errtfunc(msg->netif); + } else { + msg->err = ERR_OK; + msg->msg.common.voidfunc(msg->netif); + } + TCPIP_NETIFAPI_ACK(msg); +} + +/** + * Call netif_add() in a thread-safe way by running that function inside the + * tcpip_thread context. + * + * @note for params @see netif_add() + */ +err_t +netifapi_netif_add(struct netif *netif, + ip_addr_t *ipaddr, + ip_addr_t *netmask, + ip_addr_t *gw, + void *state, + netif_init_fn init, + netif_input_fn input) +{ + struct netifapi_msg msg; + msg.function = do_netifapi_netif_add; + msg.msg.netif = netif; + msg.msg.msg.add.ipaddr = ipaddr; + msg.msg.msg.add.netmask = netmask; + msg.msg.msg.add.gw = gw; + msg.msg.msg.add.state = state; + msg.msg.msg.add.init = init; + msg.msg.msg.add.input = input; + TCPIP_NETIFAPI(&msg); + return msg.msg.err; +} + +/** + * Call netif_set_addr() in a thread-safe way by running that function inside the + * tcpip_thread context. + * + * @note for params @see netif_set_addr() + */ +err_t +netifapi_netif_set_addr(struct netif *netif, + ip_addr_t *ipaddr, + ip_addr_t *netmask, + ip_addr_t *gw) +{ + struct netifapi_msg msg; + msg.function = do_netifapi_netif_set_addr; + msg.msg.netif = netif; + msg.msg.msg.add.ipaddr = ipaddr; + msg.msg.msg.add.netmask = netmask; + msg.msg.msg.add.gw = gw; + TCPIP_NETIFAPI(&msg); + return msg.msg.err; +} + +/** + * call the "errtfunc" (or the "voidfunc" if "errtfunc" is NULL) in a thread-safe + * way by running that function inside the tcpip_thread context. + * + * @note use only for functions where there is only "netif" parameter. + */ +err_t +netifapi_netif_common(struct netif *netif, netifapi_void_fn voidfunc, + netifapi_errt_fn errtfunc) +{ + struct netifapi_msg msg; + msg.function = do_netifapi_netif_common; + msg.msg.netif = netif; + msg.msg.msg.common.voidfunc = voidfunc; + msg.msg.msg.common.errtfunc = errtfunc; + TCPIP_NETIFAPI(&msg); + return msg.msg.err; +} + +#endif /* LWIP_NETIF_API */ diff --git a/lib/drivers/lwip/src/api/sockets.c b/lib/drivers/lwip/src/api/sockets.c new file mode 100644 index 00000000000..e36012ce43b --- /dev/null +++ b/lib/drivers/lwip/src/api/sockets.c @@ -0,0 +1,2347 @@ +/** + * @file + * Sockets BSD-Like API module + * + */ + +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + * Improved by Marc Boucher and David Haas + * + */ + +#include "lwip/opt.h" + +#if LWIP_SOCKET /* don't build if not configured for use in lwipopts.h */ + +#include "lwip/sockets.h" +#include "lwip/api.h" +#include "lwip/sys.h" +#include "lwip/igmp.h" +#include "lwip/inet.h" +#include "lwip/tcp.h" +#include "lwip/raw.h" +#include "lwip/udp.h" +#include "lwip/tcpip.h" +#include "lwip/pbuf.h" +#if LWIP_CHECKSUM_ON_COPY +#include "lwip/inet_chksum.h" +#endif + +#include + +#define NUM_SOCKETS MEMP_NUM_NETCONN + +/** Contains all internal pointers and states used for a socket */ +struct lwip_sock { + /** sockets currently are built on netconns, each socket has one netconn */ + struct netconn *conn; + /** data that was left from the previous read */ + void *lastdata; + /** offset in the data that was left from the previous read */ + u16_t lastoffset; + /** number of times data was received, set by event_callback(), + tested by the receive and select functions */ + s16_t rcvevent; + /** number of times data was ACKed (free send buffer), set by event_callback(), + tested by select */ + u16_t sendevent; + /** error happened for this socket, set by event_callback(), tested by select */ + u16_t errevent; + /** last error that occurred on this socket */ + int err; + /** counter of how many threads are waiting for this socket using select */ + int select_waiting; +}; + +/** Description for a task waiting in select */ +struct lwip_select_cb { + /** Pointer to the next waiting task */ + struct lwip_select_cb *next; + /** Pointer to the previous waiting task */ + struct lwip_select_cb *prev; + /** readset passed to select */ + fd_set *readset; + /** writeset passed to select */ + fd_set *writeset; + /** unimplemented: exceptset passed to select */ + fd_set *exceptset; + /** don't signal the same semaphore twice: set to 1 when signalled */ + int sem_signalled; + /** semaphore to wake up a task waiting for select */ + sys_sem_t sem; +}; + +/** This struct is used to pass data to the set/getsockopt_internal + * functions running in tcpip_thread context (only a void* is allowed) */ +struct lwip_setgetsockopt_data { + /** socket struct for which to change options */ + struct lwip_sock *sock; +#ifdef LWIP_DEBUG + /** socket index for which to change options */ + int s; +#endif /* LWIP_DEBUG */ + /** level of the option to process */ + int level; + /** name of the option to process */ + int optname; + /** set: value to set the option to + * get: value of the option is stored here */ + void *optval; + /** size of *optval */ + socklen_t *optlen; + /** if an error occures, it is temporarily stored here */ + err_t err; +}; + +/** The global array of available sockets */ +static struct lwip_sock sockets[NUM_SOCKETS]; +/** The global list of tasks waiting for select */ +static struct lwip_select_cb *select_cb_list; +/** This counter is increased from lwip_select when the list is chagned + and checked in event_callback to see if it has changed. */ +static volatile int select_cb_ctr; + +/** Table to quickly map an lwIP error (err_t) to a socket error + * by using -err as an index */ +static const int err_to_errno_table[] = { + 0, /* ERR_OK 0 No error, everything OK. */ + ENOMEM, /* ERR_MEM -1 Out of memory error. */ + ENOBUFS, /* ERR_BUF -2 Buffer error. */ + EWOULDBLOCK, /* ERR_TIMEOUT -3 Timeout */ + EHOSTUNREACH, /* ERR_RTE -4 Routing problem. */ + EINPROGRESS, /* ERR_INPROGRESS -5 Operation in progress */ + EINVAL, /* ERR_VAL -6 Illegal value. */ + EWOULDBLOCK, /* ERR_WOULDBLOCK -7 Operation would block. */ + EADDRINUSE, /* ERR_USE -8 Address in use. */ + EALREADY, /* ERR_ISCONN -9 Already connected. */ + ECONNABORTED, /* ERR_ABRT -10 Connection aborted. */ + ECONNRESET, /* ERR_RST -11 Connection reset. */ + ENOTCONN, /* ERR_CLSD -12 Connection closed. */ + ENOTCONN, /* ERR_CONN -13 Not connected. */ + EIO, /* ERR_ARG -14 Illegal argument. */ + -1, /* ERR_IF -15 Low-level netif error */ +}; + +#define ERR_TO_ERRNO_TABLE_SIZE \ + (sizeof(err_to_errno_table)/sizeof(err_to_errno_table[0])) + +#define err_to_errno(err) \ + ((unsigned)(-(err)) < ERR_TO_ERRNO_TABLE_SIZE ? \ + err_to_errno_table[-(err)] : EIO) + +#ifdef ERRNO +#ifndef set_errno +#define set_errno(err) errno = (err) +#endif +#else /* ERRNO */ +#define set_errno(err) +#endif /* ERRNO */ + +#define sock_set_errno(sk, e) do { \ + sk->err = (e); \ + set_errno(sk->err); \ +} while (0) + +/* Forward delcaration of some functions */ +static void event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len); +static void lwip_getsockopt_internal(void *arg); +static void lwip_setsockopt_internal(void *arg); + +/** + * Initialize this module. This function has to be called before any other + * functions in this module! + */ +void +lwip_socket_init(void) +{ +} + +/** + * Map a externally used socket index to the internal socket representation. + * + * @param s externally used socket index + * @return struct lwip_sock for the socket or NULL if not found + */ +static struct lwip_sock * +get_socket(int s) +{ + struct lwip_sock *sock; + + if ((s < 0) || (s >= NUM_SOCKETS)) { + LWIP_DEBUGF(SOCKETS_DEBUG, ("get_socket(%d): invalid\n", s)); + set_errno(EBADF); + return NULL; + } + + sock = &sockets[s]; + + if (!sock->conn) { + LWIP_DEBUGF(SOCKETS_DEBUG, ("get_socket(%d): not active\n", s)); + set_errno(EBADF); + return NULL; + } + + return sock; +} + +/** + * Same as get_socket but doesn't set errno + * + * @param s externally used socket index + * @return struct lwip_sock for the socket or NULL if not found + */ +static struct lwip_sock * +tryget_socket(int s) +{ + if ((s < 0) || (s >= NUM_SOCKETS)) { + return NULL; + } + if (!sockets[s].conn) { + return NULL; + } + return &sockets[s]; +} + +/** + * Allocate a new socket for a given netconn. + * + * @param newconn the netconn for which to allocate a socket + * @param accepted 1 if socket has been created by accept(), + * 0 if socket has been created by socket() + * @return the index of the new socket; -1 on error + */ +static int +alloc_socket(struct netconn *newconn, int accepted) +{ + int i; + SYS_ARCH_DECL_PROTECT(lev); + + /* allocate a new socket identifier */ + for (i = 0; i < NUM_SOCKETS; ++i) { + /* Protect socket array */ + SYS_ARCH_PROTECT(lev); + if (!sockets[i].conn) { + sockets[i].conn = newconn; + /* The socket is not yet known to anyone, so no need to protect + after having marked it as used. */ + SYS_ARCH_UNPROTECT(lev); + sockets[i].lastdata = NULL; + sockets[i].lastoffset = 0; + sockets[i].rcvevent = 0; + /* TCP sendbuf is empty, but the socket is not yet writable until connected + * (unless it has been created by accept()). */ + sockets[i].sendevent = (newconn->type == NETCONN_TCP ? (accepted != 0) : 1); + sockets[i].errevent = 0; + sockets[i].err = 0; + sockets[i].select_waiting = 0; + return i; + } + SYS_ARCH_UNPROTECT(lev); + } + return -1; +} + +/** Free a socket. The socket's netconn must have been + * delete before! + * + * @param sock the socket to free + * @param is_tcp != 0 for TCP sockets, used to free lastdata + */ +static void +free_socket(struct lwip_sock *sock, int is_tcp) +{ + void *lastdata; + SYS_ARCH_DECL_PROTECT(lev); + + lastdata = sock->lastdata; + sock->lastdata = NULL; + sock->lastoffset = 0; + sock->err = 0; + + /* Protect socket array */ + SYS_ARCH_PROTECT(lev); + sock->conn = NULL; + SYS_ARCH_UNPROTECT(lev); + /* don't use 'sock' after this line, as another task might have allocated it */ + + if (lastdata != NULL) { + if (is_tcp) { + pbuf_free((struct pbuf *)lastdata); + } else { + netbuf_delete((struct netbuf *)lastdata); + } + } +} + +/* Below this, the well-known socket functions are implemented. + * Use google.com or opengroup.org to get a good description :-) + * + * Exceptions are documented! + */ + +int +lwip_accept(int s, struct sockaddr *addr, socklen_t *addrlen) +{ + struct lwip_sock *sock, *nsock; + struct netconn *newconn; + ip_addr_t naddr; + u16_t port; + int newsock; + struct sockaddr_in sin; + err_t err; + SYS_ARCH_DECL_PROTECT(lev); + + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_accept(%d)...\n", s)); + sock = get_socket(s); + if (!sock) { + return -1; + } + + if (netconn_is_nonblocking(sock->conn) && (sock->rcvevent <= 0)) { + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_accept(%d): returning EWOULDBLOCK\n", s)); + sock_set_errno(sock, EWOULDBLOCK); + return -1; + } + + /* wait for a new connection */ + err = netconn_accept(sock->conn, &newconn); + if (err != ERR_OK) { + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_accept(%d): netconn_acept failed, err=%d\n", s, err)); + sock_set_errno(sock, err_to_errno(err)); + return -1; + } + LWIP_ASSERT("newconn != NULL", newconn != NULL); + /* Prevent automatic window updates, we do this on our own! */ + netconn_set_noautorecved(newconn, 1); + + /* get the IP address and port of the remote host */ + err = netconn_peer(newconn, &naddr, &port); + if (err != ERR_OK) { + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_accept(%d): netconn_peer failed, err=%d\n", s, err)); + netconn_delete(newconn); + sock_set_errno(sock, err_to_errno(err)); + return -1; + } + + /* Note that POSIX only requires us to check addr is non-NULL. addrlen must + * not be NULL if addr is valid. + */ + if (NULL != addr) { + LWIP_ASSERT("addr valid but addrlen NULL", addrlen != NULL); + memset(&sin, 0, sizeof(sin)); + sin.sin_len = sizeof(sin); + sin.sin_family = AF_INET; + sin.sin_port = htons(port); + inet_addr_from_ipaddr(&sin.sin_addr, &naddr); + + if (*addrlen > sizeof(sin)) + *addrlen = sizeof(sin); + + MEMCPY(addr, &sin, *addrlen); + } + + newsock = alloc_socket(newconn, 1); + if (newsock == -1) { + netconn_delete(newconn); + sock_set_errno(sock, ENFILE); + return -1; + } + LWIP_ASSERT("invalid socket index", (newsock >= 0) && (newsock < NUM_SOCKETS)); + LWIP_ASSERT("newconn->callback == event_callback", newconn->callback == event_callback); + nsock = &sockets[newsock]; + + /* See event_callback: If data comes in right away after an accept, even + * though the server task might not have created a new socket yet. + * In that case, newconn->socket is counted down (newconn->socket--), + * so nsock->rcvevent is >= 1 here! + */ + SYS_ARCH_PROTECT(lev); + nsock->rcvevent += (s16_t)(-1 - newconn->socket); + newconn->socket = newsock; + SYS_ARCH_UNPROTECT(lev); + + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_accept(%d) returning new sock=%d addr=", s, newsock)); + ip_addr_debug_print(SOCKETS_DEBUG, &naddr); + LWIP_DEBUGF(SOCKETS_DEBUG, (" port=%"U16_F"\n", port)); + + sock_set_errno(sock, 0); + return newsock; +} + +int +lwip_bind(int s, const struct sockaddr *name, socklen_t namelen) +{ + struct lwip_sock *sock; + ip_addr_t local_addr; + u16_t local_port; + err_t err; + const struct sockaddr_in *name_in; + + sock = get_socket(s); + if (!sock) { + return -1; + } + + /* check size, familiy and alignment of 'name' */ + LWIP_ERROR("lwip_bind: invalid address", ((namelen == sizeof(struct sockaddr_in)) && + ((name->sa_family) == AF_INET) && ((((mem_ptr_t)name) % 4) == 0)), + sock_set_errno(sock, err_to_errno(ERR_ARG)); return -1;); + name_in = (const struct sockaddr_in *)(void*)name; + + inet_addr_to_ipaddr(&local_addr, &name_in->sin_addr); + local_port = name_in->sin_port; + + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_bind(%d, addr=", s)); + ip_addr_debug_print(SOCKETS_DEBUG, &local_addr); + LWIP_DEBUGF(SOCKETS_DEBUG, (" port=%"U16_F")\n", ntohs(local_port))); + + err = netconn_bind(sock->conn, &local_addr, ntohs(local_port)); + + if (err != ERR_OK) { + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_bind(%d) failed, err=%d\n", s, err)); + sock_set_errno(sock, err_to_errno(err)); + return -1; + } + + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_bind(%d) succeeded\n", s)); + sock_set_errno(sock, 0); + return 0; +} + +int +lwip_close(int s) +{ + struct lwip_sock *sock; + int is_tcp = 0; + + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_close(%d)\n", s)); + + sock = get_socket(s); + if (!sock) { + return -1; + } + + if(sock->conn != NULL) { + is_tcp = netconn_type(sock->conn) == NETCONN_TCP; + } else { + LWIP_ASSERT("sock->lastdata == NULL", sock->lastdata == NULL); + } + + netconn_delete(sock->conn); + + free_socket(sock, is_tcp); + set_errno(0); + return 0; +} + +int +lwip_connect(int s, const struct sockaddr *name, socklen_t namelen) +{ + struct lwip_sock *sock; + err_t err; + const struct sockaddr_in *name_in; + + sock = get_socket(s); + if (!sock) { + return -1; + } + + /* check size, familiy and alignment of 'name' */ + LWIP_ERROR("lwip_connect: invalid address", ((namelen == sizeof(struct sockaddr_in)) && + ((name->sa_family) == AF_INET) && ((((mem_ptr_t)name) % 4) == 0)), + sock_set_errno(sock, err_to_errno(ERR_ARG)); return -1;); + name_in = (const struct sockaddr_in *)(void*)name; + + if (name_in->sin_family == AF_UNSPEC) { + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_connect(%d, AF_UNSPEC)\n", s)); + err = netconn_disconnect(sock->conn); + } else { + ip_addr_t remote_addr; + u16_t remote_port; + + inet_addr_to_ipaddr(&remote_addr, &name_in->sin_addr); + remote_port = name_in->sin_port; + + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_connect(%d, addr=", s)); + ip_addr_debug_print(SOCKETS_DEBUG, &remote_addr); + LWIP_DEBUGF(SOCKETS_DEBUG, (" port=%"U16_F")\n", ntohs(remote_port))); + + err = netconn_connect(sock->conn, &remote_addr, ntohs(remote_port)); + } + + if (err != ERR_OK) { + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_connect(%d) failed, err=%d\n", s, err)); + sock_set_errno(sock, err_to_errno(err)); + return -1; + } + + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_connect(%d) succeeded\n", s)); + sock_set_errno(sock, 0); + return 0; +} + +/** + * Set a socket into listen mode. + * The socket may not have been used for another connection previously. + * + * @param s the socket to set to listening mode + * @param backlog (ATTENTION: needs TCP_LISTEN_BACKLOG=1) + * @return 0 on success, non-zero on failure + */ +int +lwip_listen(int s, int backlog) +{ + struct lwip_sock *sock; + err_t err; + + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_listen(%d, backlog=%d)\n", s, backlog)); + + sock = get_socket(s); + if (!sock) { + return -1; + } + + /* limit the "backlog" parameter to fit in an u8_t */ + backlog = LWIP_MIN(LWIP_MAX(backlog, 0), 0xff); + + err = netconn_listen_with_backlog(sock->conn, (u8_t)backlog); + + if (err != ERR_OK) { + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_listen(%d) failed, err=%d\n", s, err)); + sock_set_errno(sock, err_to_errno(err)); + return -1; + } + + sock_set_errno(sock, 0); + return 0; +} + +int +lwip_recvfrom(int s, void *mem, size_t len, int flags, + struct sockaddr *from, socklen_t *fromlen) +{ + struct lwip_sock *sock; + void *buf = NULL; + struct pbuf *p; + u16_t buflen, copylen; + int off = 0; + ip_addr_t *addr; + u16_t port; + u8_t done = 0; + err_t err; + + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_recvfrom(%d, %p, %"SZT_F", 0x%x, ..)\n", s, mem, len, flags)); + sock = get_socket(s); + if (!sock) { + return -1; + } + + do { + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_recvfrom: top while sock->lastdata=%p\n", sock->lastdata)); + /* Check if there is data left from the last recv operation. */ + if (sock->lastdata) { + buf = sock->lastdata; + } else { + /* If this is non-blocking call, then check first */ + if (((flags & MSG_DONTWAIT) || netconn_is_nonblocking(sock->conn)) && + (sock->rcvevent <= 0)) { + if (off > 0) { + /* update receive window */ + netconn_recved(sock->conn, (u32_t)off); + /* already received data, return that */ + sock_set_errno(sock, 0); + return off; + } + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_recvfrom(%d): returning EWOULDBLOCK\n", s)); + sock_set_errno(sock, EWOULDBLOCK); + return -1; + } + + /* No data was left from the previous operation, so we try to get + some from the network. */ + if (netconn_type(sock->conn) == NETCONN_TCP) { + err = netconn_recv_tcp_pbuf(sock->conn, (struct pbuf **)&buf); + } else { + err = netconn_recv(sock->conn, (struct netbuf **)&buf); + } + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_recvfrom: netconn_recv err=%d, netbuf=%p\n", + err, buf)); + + if (err != ERR_OK) { + if (off > 0) { + /* update receive window */ + netconn_recved(sock->conn, (u32_t)off); + /* already received data, return that */ + sock_set_errno(sock, 0); + return off; + } + /* We should really do some error checking here. */ + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_recvfrom(%d): buf == NULL, error is \"%s\"!\n", + s, lwip_strerr(err))); + sock_set_errno(sock, err_to_errno(err)); + if (err == ERR_CLSD) { + return 0; + } else { + return -1; + } + } + LWIP_ASSERT("buf != NULL", buf != NULL); + sock->lastdata = buf; + } + + if (netconn_type(sock->conn) == NETCONN_TCP) { + p = (struct pbuf *)buf; + } else { + p = ((struct netbuf *)buf)->p; + } + buflen = p->tot_len; + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_recvfrom: buflen=%"U16_F" len=%"SZT_F" off=%d sock->lastoffset=%"U16_F"\n", + buflen, len, off, sock->lastoffset)); + + buflen -= sock->lastoffset; + + if (len > buflen) { + copylen = buflen; + } else { + copylen = (u16_t)len; + } + + /* copy the contents of the received buffer into + the supplied memory pointer mem */ + pbuf_copy_partial(p, (u8_t*)mem + off, copylen, sock->lastoffset); + + off += copylen; + + if (netconn_type(sock->conn) == NETCONN_TCP) { + LWIP_ASSERT("invalid copylen, len would underflow", len >= copylen); + len -= copylen; + if ( (len <= 0) || + (p->flags & PBUF_FLAG_PUSH) || + (sock->rcvevent <= 0) || + ((flags & MSG_PEEK)!=0)) { + done = 1; + } + } else { + done = 1; + } + + /* Check to see from where the data was.*/ + if (done) { + ip_addr_t fromaddr; + if (from && fromlen) { + struct sockaddr_in sin; + + if (netconn_type(sock->conn) == NETCONN_TCP) { + addr = &fromaddr; + netconn_getaddr(sock->conn, addr, &port, 0); + } else { + addr = netbuf_fromaddr((struct netbuf *)buf); + port = netbuf_fromport((struct netbuf *)buf); + } + + memset(&sin, 0, sizeof(sin)); + sin.sin_len = sizeof(sin); + sin.sin_family = AF_INET; + sin.sin_port = htons(port); + inet_addr_from_ipaddr(&sin.sin_addr, addr); + + if (*fromlen > sizeof(sin)) { + *fromlen = sizeof(sin); + } + + MEMCPY(from, &sin, *fromlen); + + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_recvfrom(%d): addr=", s)); + ip_addr_debug_print(SOCKETS_DEBUG, addr); + LWIP_DEBUGF(SOCKETS_DEBUG, (" port=%"U16_F" len=%d\n", port, off)); + } else { +#if SOCKETS_DEBUG + if (netconn_type(sock->conn) == NETCONN_TCP) { + addr = &fromaddr; + netconn_getaddr(sock->conn, addr, &port, 0); + } else { + addr = netbuf_fromaddr((struct netbuf *)buf); + port = netbuf_fromport((struct netbuf *)buf); + } + + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_recvfrom(%d): addr=", s)); + ip_addr_debug_print(SOCKETS_DEBUG, addr); + LWIP_DEBUGF(SOCKETS_DEBUG, (" port=%"U16_F" len=%d\n", port, off)); +#endif /* SOCKETS_DEBUG */ + } + } + + /* If we don't peek the incoming message... */ + if ((flags & MSG_PEEK) == 0) { + /* If this is a TCP socket, check if there is data left in the + buffer. If so, it should be saved in the sock structure for next + time around. */ + if ((netconn_type(sock->conn) == NETCONN_TCP) && (buflen - copylen > 0)) { + sock->lastdata = buf; + sock->lastoffset += copylen; + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_recvfrom: lastdata now netbuf=%p\n", buf)); + } else { + sock->lastdata = NULL; + sock->lastoffset = 0; + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_recvfrom: deleting netbuf=%p\n", buf)); + if (netconn_type(sock->conn) == NETCONN_TCP) { + pbuf_free((struct pbuf *)buf); + } else { + netbuf_delete((struct netbuf *)buf); + } + } + } + } while (!done); + + if (off > 0) { + /* update receive window */ + netconn_recved(sock->conn, (u32_t)off); + } + sock_set_errno(sock, 0); + return off; +} + +int +lwip_read(int s, void *mem, size_t len) +{ + return lwip_recvfrom(s, mem, len, 0, NULL, NULL); +} + +int +lwip_recv(int s, void *mem, size_t len, int flags) +{ + return lwip_recvfrom(s, mem, len, flags, NULL, NULL); +} + +int +lwip_send(int s, const void *data, size_t size, int flags) +{ + struct lwip_sock *sock; + err_t err; + u8_t write_flags; + + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_send(%d, data=%p, size=%"SZT_F", flags=0x%x)\n", + s, data, size, flags)); + + sock = get_socket(s); + if (!sock) { + return -1; + } + + if (sock->conn->type != NETCONN_TCP) { +#if (LWIP_UDP || LWIP_RAW) + return lwip_sendto(s, data, size, flags, NULL, 0); +#else /* (LWIP_UDP || LWIP_RAW) */ + sock_set_errno(sock, err_to_errno(ERR_ARG)); + return -1; +#endif /* (LWIP_UDP || LWIP_RAW) */ + } + + if ((flags & MSG_DONTWAIT) || netconn_is_nonblocking(sock->conn)) { + if ((size > TCP_SND_BUF) || ((size / TCP_MSS) > TCP_SND_QUEUELEN)) { + /* too much data to ever send nonblocking! */ + sock_set_errno(sock, EMSGSIZE); + return -1; + } + } + + write_flags = NETCONN_COPY | + ((flags & MSG_MORE) ? NETCONN_MORE : 0) | + ((flags & MSG_DONTWAIT) ? NETCONN_DONTBLOCK : 0); + err = netconn_write(sock->conn, data, size, write_flags); + + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_send(%d) err=%d size=%"SZT_F"\n", s, err, size)); + sock_set_errno(sock, err_to_errno(err)); + return (err == ERR_OK ? (int)size : -1); +} + +int +lwip_sendto(int s, const void *data, size_t size, int flags, + const struct sockaddr *to, socklen_t tolen) +{ + struct lwip_sock *sock; + err_t err; + u16_t short_size; + const struct sockaddr_in *to_in; + u16_t remote_port; +#if !LWIP_TCPIP_CORE_LOCKING + struct netbuf buf; +#endif + + sock = get_socket(s); + if (!sock) { + return -1; + } + + if (sock->conn->type == NETCONN_TCP) { +#if LWIP_TCP + return lwip_send(s, data, size, flags); +#else /* LWIP_TCP */ + LWIP_UNUSED_ARG(flags); + sock_set_errno(sock, err_to_errno(ERR_ARG)); + return -1; +#endif /* LWIP_TCP */ + } + + /* @todo: split into multiple sendto's? */ + LWIP_ASSERT("lwip_sendto: size must fit in u16_t", size <= 0xffff); + short_size = (u16_t)size; + LWIP_ERROR("lwip_sendto: invalid address", (((to == NULL) && (tolen == 0)) || + ((tolen == sizeof(struct sockaddr_in)) && + ((to->sa_family) == AF_INET) && ((((mem_ptr_t)to) % 4) == 0))), + sock_set_errno(sock, err_to_errno(ERR_ARG)); return -1;); + to_in = (const struct sockaddr_in *)(void*)to; + +#if LWIP_TCPIP_CORE_LOCKING + /* Should only be consider like a sample or a simple way to experiment this option (no check of "to" field...) */ + { + struct pbuf* p; + ip_addr_t *remote_addr; + +#if LWIP_NETIF_TX_SINGLE_PBUF + p = pbuf_alloc(PBUF_TRANSPORT, short_size, PBUF_RAM); + if (p != NULL) { +#if LWIP_CHECKSUM_ON_COPY + u16_t chksum = 0; + if (sock->conn->type != NETCONN_RAW) { + chksum = LWIP_CHKSUM_COPY(p->payload, data, short_size); + } else +#endif /* LWIP_CHECKSUM_ON_COPY */ + MEMCPY(p->payload, data, size); +#else /* LWIP_NETIF_TX_SINGLE_PBUF */ + p = pbuf_alloc(PBUF_TRANSPORT, short_size, PBUF_REF); + if (p != NULL) { + p->payload = (void*)data; +#endif /* LWIP_NETIF_TX_SINGLE_PBUF */ + + if (to_in != NULL) { + inet_addr_to_ipaddr_p(remote_addr, &to_in->sin_addr); + remote_port = ntohs(to_in->sin_port); + } else { + remote_addr = &sock->conn->pcb.raw->remote_ip; + if (sock->conn->type == NETCONN_RAW) { + remote_port = 0; + } else { + remote_port = sock->conn->pcb.udp->remote_port; + } + } + + LOCK_TCPIP_CORE(); + if (sock->conn->type == NETCONN_RAW) { + err = sock->conn->last_err = raw_sendto(sock->conn->pcb.raw, p, remote_addr); + } else { +#if LWIP_UDP +#if LWIP_CHECKSUM_ON_COPY && LWIP_NETIF_TX_SINGLE_PBUF + err = sock->conn->last_err = udp_sendto_chksum(sock->conn->pcb.udp, p, + remote_addr, remote_port, 1, chksum); +#else /* LWIP_CHECKSUM_ON_COPY && LWIP_NETIF_TX_SINGLE_PBUF */ + err = sock->conn->last_err = udp_sendto(sock->conn->pcb.udp, p, + remote_addr, remote_port); +#endif /* LWIP_CHECKSUM_ON_COPY && LWIP_NETIF_TX_SINGLE_PBUF */ +#else /* LWIP_UDP */ + err = ERR_ARG; +#endif /* LWIP_UDP */ + } + UNLOCK_TCPIP_CORE(); + + pbuf_free(p); + } else { + err = ERR_MEM; + } + } +#else /* LWIP_TCPIP_CORE_LOCKING */ + /* initialize a buffer */ + buf.p = buf.ptr = NULL; +#if LWIP_CHECKSUM_ON_COPY + buf.flags = 0; +#endif /* LWIP_CHECKSUM_ON_COPY */ + if (to) { + inet_addr_to_ipaddr(&buf.addr, &to_in->sin_addr); + remote_port = ntohs(to_in->sin_port); + netbuf_fromport(&buf) = remote_port; + } else { + remote_port = 0; + ip_addr_set_any(&buf.addr); + netbuf_fromport(&buf) = 0; + } + + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_sendto(%d, data=%p, short_size=%"U16_F", flags=0x%x to=", + s, data, short_size, flags)); + ip_addr_debug_print(SOCKETS_DEBUG, &buf.addr); + LWIP_DEBUGF(SOCKETS_DEBUG, (" port=%"U16_F"\n", remote_port)); + + /* make the buffer point to the data that should be sent */ +#if LWIP_NETIF_TX_SINGLE_PBUF + /* Allocate a new netbuf and copy the data into it. */ + if (netbuf_alloc(&buf, short_size) == NULL) { + err = ERR_MEM; + } else { +#if LWIP_CHECKSUM_ON_COPY + if (sock->conn->type != NETCONN_RAW) { + u16_t chksum = LWIP_CHKSUM_COPY(buf.p->payload, data, short_size); + netbuf_set_chksum(&buf, chksum); + err = ERR_OK; + } else +#endif /* LWIP_CHECKSUM_ON_COPY */ + { + err = netbuf_take(&buf, data, short_size); + } + } +#else /* LWIP_NETIF_TX_SINGLE_PBUF */ + err = netbuf_ref(&buf, data, short_size); +#endif /* LWIP_NETIF_TX_SINGLE_PBUF */ + if (err == ERR_OK) { + /* send the data */ + err = netconn_send(sock->conn, &buf); + } + + /* deallocated the buffer */ + netbuf_free(&buf); +#endif /* LWIP_TCPIP_CORE_LOCKING */ + sock_set_errno(sock, err_to_errno(err)); + return (err == ERR_OK ? short_size : -1); +} + +int +lwip_socket(int domain, int type, int protocol) +{ + struct netconn *conn; + int i; + + LWIP_UNUSED_ARG(domain); + + /* create a netconn */ + switch (type) { + case SOCK_RAW: + conn = netconn_new_with_proto_and_callback(NETCONN_RAW, (u8_t)protocol, event_callback); + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_socket(%s, SOCK_RAW, %d) = ", + domain == PF_INET ? "PF_INET" : "UNKNOWN", protocol)); + break; + case SOCK_DGRAM: + conn = netconn_new_with_callback( (protocol == IPPROTO_UDPLITE) ? + NETCONN_UDPLITE : NETCONN_UDP, event_callback); + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_socket(%s, SOCK_DGRAM, %d) = ", + domain == PF_INET ? "PF_INET" : "UNKNOWN", protocol)); + break; + case SOCK_STREAM: + conn = netconn_new_with_callback(NETCONN_TCP, event_callback); + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_socket(%s, SOCK_STREAM, %d) = ", + domain == PF_INET ? "PF_INET" : "UNKNOWN", protocol)); + if (conn != NULL) { + /* Prevent automatic window updates, we do this on our own! */ + netconn_set_noautorecved(conn, 1); + } + break; + default: + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_socket(%d, %d/UNKNOWN, %d) = -1\n", + domain, type, protocol)); + set_errno(EINVAL); + return -1; + } + + if (!conn) { + LWIP_DEBUGF(SOCKETS_DEBUG, ("-1 / ENOBUFS (could not create netconn)\n")); + set_errno(ENOBUFS); + return -1; + } + + i = alloc_socket(conn, 0); + + if (i == -1) { + netconn_delete(conn); + set_errno(ENFILE); + return -1; + } + conn->socket = i; + LWIP_DEBUGF(SOCKETS_DEBUG, ("%d\n", i)); + set_errno(0); + return i; +} + +int +lwip_write(int s, const void *data, size_t size) +{ + return lwip_send(s, data, size, 0); +} + +/** + * Go through the readset and writeset lists and see which socket of the sockets + * set in the sets has events. On return, readset, writeset and exceptset have + * the sockets enabled that had events. + * + * exceptset is not used for now!!! + * + * @param maxfdp1 the highest socket index in the sets + * @param readset_in: set of sockets to check for read events + * @param writeset_in: set of sockets to check for write events + * @param exceptset_in: set of sockets to check for error events + * @param readset_out: set of sockets that had read events + * @param writeset_out: set of sockets that had write events + * @param exceptset_out: set os sockets that had error events + * @return number of sockets that had events (read/write/exception) (>= 0) + */ +static int +lwip_selscan(int maxfdp1, fd_set *readset_in, fd_set *writeset_in, fd_set *exceptset_in, + fd_set *readset_out, fd_set *writeset_out, fd_set *exceptset_out) +{ + int i, nready = 0; + fd_set lreadset, lwriteset, lexceptset; + struct lwip_sock *sock; + SYS_ARCH_DECL_PROTECT(lev); + + FD_ZERO(&lreadset); + FD_ZERO(&lwriteset); + FD_ZERO(&lexceptset); + + /* Go through each socket in each list to count number of sockets which + currently match */ + for(i = 0; i < maxfdp1; i++) { + void* lastdata = NULL; + s16_t rcvevent = 0; + u16_t sendevent = 0; + u16_t errevent = 0; + /* First get the socket's status (protected)... */ + SYS_ARCH_PROTECT(lev); + sock = tryget_socket(i); + if (sock != NULL) { + lastdata = sock->lastdata; + rcvevent = sock->rcvevent; + sendevent = sock->sendevent; + errevent = sock->errevent; + } + SYS_ARCH_UNPROTECT(lev); + /* ... then examine it: */ + /* See if netconn of this socket is ready for read */ + if (readset_in && FD_ISSET(i, readset_in) && ((lastdata != NULL) || (rcvevent > 0))) { + FD_SET(i, &lreadset); + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_selscan: fd=%d ready for reading\n", i)); + nready++; + } + /* See if netconn of this socket is ready for write */ + if (writeset_in && FD_ISSET(i, writeset_in) && (sendevent != 0)) { + FD_SET(i, &lwriteset); + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_selscan: fd=%d ready for writing\n", i)); + nready++; + } + /* See if netconn of this socket had an error */ + if (exceptset_in && FD_ISSET(i, exceptset_in) && (errevent != 0)) { + FD_SET(i, &lexceptset); + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_selscan: fd=%d ready for exception\n", i)); + nready++; + } + } + /* copy local sets to the ones provided as arguments */ + *readset_out = lreadset; + *writeset_out = lwriteset; + *exceptset_out = lexceptset; + + LWIP_ASSERT("nready >= 0", nready >= 0); + return nready; +} + +/** + * Processing exceptset is not yet implemented. + */ +int +lwip_select(int maxfdp1, fd_set *readset, fd_set *writeset, fd_set *exceptset, + struct timeval *timeout) +{ + u32_t waitres = 0; + int nready; + fd_set lreadset, lwriteset, lexceptset; + u32_t msectimeout; + struct lwip_select_cb select_cb; + err_t err; + int i; + SYS_ARCH_DECL_PROTECT(lev); + + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_select(%d, %p, %p, %p, tvsec=%"S32_F" tvusec=%"S32_F")\n", + maxfdp1, (void *)readset, (void *) writeset, (void *) exceptset, + timeout ? (s32_t)timeout->tv_sec : (s32_t)-1, + timeout ? (s32_t)timeout->tv_usec : (s32_t)-1)); + + /* Go through each socket in each list to count number of sockets which + currently match */ + nready = lwip_selscan(maxfdp1, readset, writeset, exceptset, &lreadset, &lwriteset, &lexceptset); + + /* If we don't have any current events, then suspend if we are supposed to */ + if (!nready) { + if (timeout && timeout->tv_sec == 0 && timeout->tv_usec == 0) { + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_select: no timeout, returning 0\n")); + /* This is OK as the local fdsets are empty and nready is zero, + or we would have returned earlier. */ + goto return_copy_fdsets; + } + + /* None ready: add our semaphore to list: + We don't actually need any dynamic memory. Our entry on the + list is only valid while we are in this function, so it's ok + to use local variables. */ + + select_cb.next = NULL; + select_cb.prev = NULL; + select_cb.readset = readset; + select_cb.writeset = writeset; + select_cb.exceptset = exceptset; + select_cb.sem_signalled = 0; + err = sys_sem_new(&select_cb.sem, 0); + if (err != ERR_OK) { + /* failed to create semaphore */ + set_errno(ENOMEM); + return -1; + } + + /* Protect the select_cb_list */ + SYS_ARCH_PROTECT(lev); + + /* Put this select_cb on top of list */ + select_cb.next = select_cb_list; + if (select_cb_list != NULL) { + select_cb_list->prev = &select_cb; + } + select_cb_list = &select_cb; + /* Increasing this counter tells even_callback that the list has changed. */ + select_cb_ctr++; + + /* Now we can safely unprotect */ + SYS_ARCH_UNPROTECT(lev); + + /* Increase select_waiting for each socket we are interested in */ + for(i = 0; i < maxfdp1; i++) { + if ((readset && FD_ISSET(i, readset)) || + (writeset && FD_ISSET(i, writeset)) || + (exceptset && FD_ISSET(i, exceptset))) { + struct lwip_sock *sock = tryget_socket(i); + LWIP_ASSERT("sock != NULL", sock != NULL); + SYS_ARCH_PROTECT(lev); + sock->select_waiting++; + LWIP_ASSERT("sock->select_waiting > 0", sock->select_waiting > 0); + SYS_ARCH_UNPROTECT(lev); + } + } + + /* Call lwip_selscan again: there could have been events between + the last scan (whithout us on the list) and putting us on the list! */ + nready = lwip_selscan(maxfdp1, readset, writeset, exceptset, &lreadset, &lwriteset, &lexceptset); + if (!nready) { + /* Still none ready, just wait to be woken */ + if (timeout == 0) { + /* Wait forever */ + msectimeout = 0; + } else { + msectimeout = ((timeout->tv_sec * 1000) + ((timeout->tv_usec + 500)/1000)); + if (msectimeout == 0) { + /* Wait 1ms at least (0 means wait forever) */ + msectimeout = 1; + } + } + + waitres = sys_arch_sem_wait(&select_cb.sem, msectimeout); + } + /* Increase select_waiting for each socket we are interested in */ + for(i = 0; i < maxfdp1; i++) { + if ((readset && FD_ISSET(i, readset)) || + (writeset && FD_ISSET(i, writeset)) || + (exceptset && FD_ISSET(i, exceptset))) { + struct lwip_sock *sock = tryget_socket(i); + LWIP_ASSERT("sock != NULL", sock != NULL); + SYS_ARCH_PROTECT(lev); + sock->select_waiting--; + LWIP_ASSERT("sock->select_waiting >= 0", sock->select_waiting >= 0); + SYS_ARCH_UNPROTECT(lev); + } + } + /* Take us off the list */ + SYS_ARCH_PROTECT(lev); + if (select_cb.next != NULL) { + select_cb.next->prev = select_cb.prev; + } + if (select_cb_list == &select_cb) { + LWIP_ASSERT("select_cb.prev == NULL", select_cb.prev == NULL); + select_cb_list = select_cb.next; + } else { + LWIP_ASSERT("select_cb.prev != NULL", select_cb.prev != NULL); + select_cb.prev->next = select_cb.next; + } + /* Increasing this counter tells even_callback that the list has changed. */ + select_cb_ctr++; + SYS_ARCH_UNPROTECT(lev); + + sys_sem_free(&select_cb.sem); + if (waitres == SYS_ARCH_TIMEOUT) { + /* Timeout */ + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_select: timeout expired\n")); + /* This is OK as the local fdsets are empty and nready is zero, + or we would have returned earlier. */ + goto return_copy_fdsets; + } + + /* See what's set */ + nready = lwip_selscan(maxfdp1, readset, writeset, exceptset, &lreadset, &lwriteset, &lexceptset); + } + + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_select: nready=%d\n", nready)); +return_copy_fdsets: + set_errno(0); + if (readset) { + *readset = lreadset; + } + if (writeset) { + *writeset = lwriteset; + } + if (exceptset) { + *exceptset = lexceptset; + } + + + return nready; +} + +/** + * Callback registered in the netconn layer for each socket-netconn. + * Processes recvevent (data available) and wakes up tasks waiting for select. + */ +static void +event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len) +{ + int s; + struct lwip_sock *sock; + struct lwip_select_cb *scb; + int last_select_cb_ctr; + SYS_ARCH_DECL_PROTECT(lev); + + LWIP_UNUSED_ARG(len); + + /* Get socket */ + if (conn) { + s = conn->socket; + if (s < 0) { + /* Data comes in right away after an accept, even though + * the server task might not have created a new socket yet. + * Just count down (or up) if that's the case and we + * will use the data later. Note that only receive events + * can happen before the new socket is set up. */ + SYS_ARCH_PROTECT(lev); + if (conn->socket < 0) { + if (evt == NETCONN_EVT_RCVPLUS) { + conn->socket--; + } + SYS_ARCH_UNPROTECT(lev); + return; + } + s = conn->socket; + SYS_ARCH_UNPROTECT(lev); + } + + sock = get_socket(s); + if (!sock) { + return; + } + } else { + return; + } + + SYS_ARCH_PROTECT(lev); + /* Set event as required */ + switch (evt) { + case NETCONN_EVT_RCVPLUS: + sock->rcvevent++; + break; + case NETCONN_EVT_RCVMINUS: + sock->rcvevent--; + break; + case NETCONN_EVT_SENDPLUS: + sock->sendevent = 1; + break; + case NETCONN_EVT_SENDMINUS: + sock->sendevent = 0; + break; + case NETCONN_EVT_ERROR: + sock->errevent = 1; + break; + default: + LWIP_ASSERT("unknown event", 0); + break; + } + + if (sock->select_waiting == 0) { + /* noone is waiting for this socket, no need to check select_cb_list */ + SYS_ARCH_UNPROTECT(lev); + return; + } + + /* Now decide if anyone is waiting for this socket */ + /* NOTE: This code goes through the select_cb_list list multiple times + ONLY IF a select was actually waiting. We go through the list the number + of waiting select calls + 1. This list is expected to be small. */ + + /* At this point, SYS_ARCH is still protected! */ +again: + for (scb = select_cb_list; scb != NULL; scb = scb->next) { + if (scb->sem_signalled == 0) { + /* semaphore not signalled yet */ + int do_signal = 0; + /* Test this select call for our socket */ + if (sock->rcvevent > 0) { + if (scb->readset && FD_ISSET(s, scb->readset)) { + do_signal = 1; + } + } + if (sock->sendevent != 0) { + if (!do_signal && scb->writeset && FD_ISSET(s, scb->writeset)) { + do_signal = 1; + } + } + if (sock->errevent != 0) { + if (!do_signal && scb->exceptset && FD_ISSET(s, scb->exceptset)) { + do_signal = 1; + } + } + if (do_signal) { + scb->sem_signalled = 1; + /* Don't call SYS_ARCH_UNPROTECT() before signaling the semaphore, as this might + lead to the select thread taking itself off the list, invalidagin the semaphore. */ + sys_sem_signal(&scb->sem); + } + } + /* unlock interrupts with each step */ + last_select_cb_ctr = select_cb_ctr; + SYS_ARCH_UNPROTECT(lev); + /* this makes sure interrupt protection time is short */ + SYS_ARCH_PROTECT(lev); + if (last_select_cb_ctr != select_cb_ctr) { + /* someone has changed select_cb_list, restart at the beginning */ + goto again; + } + } + SYS_ARCH_UNPROTECT(lev); +} + +/** + * Unimplemented: Close one end of a full-duplex connection. + * Currently, the full connection is closed. + */ +int +lwip_shutdown(int s, int how) +{ + struct lwip_sock *sock; + err_t err; + u8_t shut_rx = 0, shut_tx = 0; + + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_shutdown(%d, how=%d)\n", s, how)); + + sock = get_socket(s); + if (!sock) { + return -1; + } + + if (sock->conn != NULL) { + if (netconn_type(sock->conn) != NETCONN_TCP) { + sock_set_errno(sock, EOPNOTSUPP); + return EOPNOTSUPP; + } + } else { + sock_set_errno(sock, ENOTCONN); + return ENOTCONN; + } + + if (how == SHUT_RD) { + shut_rx = 1; + } else if (how == SHUT_WR) { + shut_tx = 1; + } else if(how == SHUT_RDWR) { + shut_rx = 1; + shut_tx = 1; + } else { + sock_set_errno(sock, EINVAL); + return EINVAL; + } + err = netconn_shutdown(sock->conn, shut_rx, shut_tx); + + sock_set_errno(sock, err_to_errno(err)); + return (err == ERR_OK ? 0 : -1); +} + +static int +lwip_getaddrname(int s, struct sockaddr *name, socklen_t *namelen, u8_t local) +{ + struct lwip_sock *sock; + struct sockaddr_in sin; + ip_addr_t naddr; + + sock = get_socket(s); + if (!sock) { + return -1; + } + + memset(&sin, 0, sizeof(sin)); + sin.sin_len = sizeof(sin); + sin.sin_family = AF_INET; + + /* get the IP address and port */ + netconn_getaddr(sock->conn, &naddr, &sin.sin_port, local); + + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getaddrname(%d, addr=", s)); + ip_addr_debug_print(SOCKETS_DEBUG, &naddr); + LWIP_DEBUGF(SOCKETS_DEBUG, (" port=%"U16_F")\n", sin.sin_port)); + + sin.sin_port = htons(sin.sin_port); + inet_addr_from_ipaddr(&sin.sin_addr, &naddr); + + if (*namelen > sizeof(sin)) { + *namelen = sizeof(sin); + } + + MEMCPY(name, &sin, *namelen); + sock_set_errno(sock, 0); + return 0; +} + +int +lwip_getpeername(int s, struct sockaddr *name, socklen_t *namelen) +{ + return lwip_getaddrname(s, name, namelen, 0); +} + +int +lwip_getsockname(int s, struct sockaddr *name, socklen_t *namelen) +{ + return lwip_getaddrname(s, name, namelen, 1); +} + +int +lwip_getsockopt(int s, int level, int optname, void *optval, socklen_t *optlen) +{ + err_t err = ERR_OK; + struct lwip_sock *sock = get_socket(s); + struct lwip_setgetsockopt_data data; + + if (!sock) { + return -1; + } + + if ((NULL == optval) || (NULL == optlen)) { + sock_set_errno(sock, EFAULT); + return -1; + } + + /* Do length and type checks for the various options first, to keep it readable. */ + switch (level) { + +/* Level: SOL_SOCKET */ + case SOL_SOCKET: + switch (optname) { + + case SO_ACCEPTCONN: + case SO_BROADCAST: + /* UNIMPL case SO_DEBUG: */ + /* UNIMPL case SO_DONTROUTE: */ + case SO_ERROR: + case SO_KEEPALIVE: + /* UNIMPL case SO_CONTIMEO: */ + /* UNIMPL case SO_SNDTIMEO: */ +#if LWIP_SO_RCVTIMEO + case SO_RCVTIMEO: +#endif /* LWIP_SO_RCVTIMEO */ +#if LWIP_SO_RCVBUF + case SO_RCVBUF: +#endif /* LWIP_SO_RCVBUF */ + /* UNIMPL case SO_OOBINLINE: */ + /* UNIMPL case SO_SNDBUF: */ + /* UNIMPL case SO_RCVLOWAT: */ + /* UNIMPL case SO_SNDLOWAT: */ +#if SO_REUSE + case SO_REUSEADDR: + case SO_REUSEPORT: +#endif /* SO_REUSE */ + case SO_TYPE: + /* UNIMPL case SO_USELOOPBACK: */ + if (*optlen < sizeof(int)) { + err = EINVAL; + } + break; + + case SO_NO_CHECK: + if (*optlen < sizeof(int)) { + err = EINVAL; + } +#if LWIP_UDP + if ((sock->conn->type != NETCONN_UDP) || + ((udp_flags(sock->conn->pcb.udp) & UDP_FLAGS_UDPLITE) != 0)) { + /* this flag is only available for UDP, not for UDP lite */ + err = EAFNOSUPPORT; + } +#endif /* LWIP_UDP */ + break; + + default: + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getsockopt(%d, SOL_SOCKET, UNIMPL: optname=0x%x, ..)\n", + s, optname)); + err = ENOPROTOOPT; + } /* switch (optname) */ + break; + +/* Level: IPPROTO_IP */ + case IPPROTO_IP: + switch (optname) { + /* UNIMPL case IP_HDRINCL: */ + /* UNIMPL case IP_RCVDSTADDR: */ + /* UNIMPL case IP_RCVIF: */ + case IP_TTL: + case IP_TOS: + if (*optlen < sizeof(int)) { + err = EINVAL; + } + break; +#if LWIP_IGMP + case IP_MULTICAST_TTL: + if (*optlen < sizeof(u8_t)) { + err = EINVAL; + } + break; + case IP_MULTICAST_IF: + if (*optlen < sizeof(struct in_addr)) { + err = EINVAL; + } + break; + case IP_MULTICAST_LOOP: + if (*optlen < sizeof(u8_t)) { + err = EINVAL; + } + if (NETCONNTYPE_GROUP(sock->conn->type) != NETCONN_UDP) { + err = EAFNOSUPPORT; + } + break; +#endif /* LWIP_IGMP */ + + default: + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getsockopt(%d, IPPROTO_IP, UNIMPL: optname=0x%x, ..)\n", + s, optname)); + err = ENOPROTOOPT; + } /* switch (optname) */ + break; + +#if LWIP_TCP +/* Level: IPPROTO_TCP */ + case IPPROTO_TCP: + if (*optlen < sizeof(int)) { + err = EINVAL; + break; + } + + /* If this is no TCP socket, ignore any options. */ + if (sock->conn->type != NETCONN_TCP) + return 0; + + switch (optname) { + case TCP_NODELAY: + case TCP_KEEPALIVE: +#if LWIP_TCP_KEEPALIVE + case TCP_KEEPIDLE: + case TCP_KEEPINTVL: + case TCP_KEEPCNT: +#endif /* LWIP_TCP_KEEPALIVE */ + break; + + default: + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getsockopt(%d, IPPROTO_TCP, UNIMPL: optname=0x%x, ..)\n", + s, optname)); + err = ENOPROTOOPT; + } /* switch (optname) */ + break; +#endif /* LWIP_TCP */ +#if LWIP_UDP && LWIP_UDPLITE +/* Level: IPPROTO_UDPLITE */ + case IPPROTO_UDPLITE: + if (*optlen < sizeof(int)) { + err = EINVAL; + break; + } + + /* If this is no UDP lite socket, ignore any options. */ + if (sock->conn->type != NETCONN_UDPLITE) { + return 0; + } + + switch (optname) { + case UDPLITE_SEND_CSCOV: + case UDPLITE_RECV_CSCOV: + break; + + default: + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getsockopt(%d, IPPROTO_UDPLITE, UNIMPL: optname=0x%x, ..)\n", + s, optname)); + err = ENOPROTOOPT; + } /* switch (optname) */ + break; +#endif /* LWIP_UDP && LWIP_UDPLITE*/ +/* UNDEFINED LEVEL */ + default: + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getsockopt(%d, level=0x%x, UNIMPL: optname=0x%x, ..)\n", + s, level, optname)); + err = ENOPROTOOPT; + } /* switch */ + + + if (err != ERR_OK) { + sock_set_errno(sock, err); + return -1; + } + + /* Now do the actual option processing */ + data.sock = sock; +#ifdef LWIP_DEBUG + data.s = s; +#endif /* LWIP_DEBUG */ + data.level = level; + data.optname = optname; + data.optval = optval; + data.optlen = optlen; + data.err = err; + tcpip_callback(lwip_getsockopt_internal, &data); + sys_arch_sem_wait(&sock->conn->op_completed, 0); + /* maybe lwip_getsockopt_internal has changed err */ + err = data.err; + + sock_set_errno(sock, err); + return err ? -1 : 0; +} + +static void +lwip_getsockopt_internal(void *arg) +{ + struct lwip_sock *sock; +#ifdef LWIP_DEBUG + int s; +#endif /* LWIP_DEBUG */ + int level, optname; + void *optval; + struct lwip_setgetsockopt_data *data; + + LWIP_ASSERT("arg != NULL", arg != NULL); + + data = (struct lwip_setgetsockopt_data*)arg; + sock = data->sock; +#ifdef LWIP_DEBUG + s = data->s; +#endif /* LWIP_DEBUG */ + level = data->level; + optname = data->optname; + optval = data->optval; + + switch (level) { + +/* Level: SOL_SOCKET */ + case SOL_SOCKET: + switch (optname) { + + /* The option flags */ + case SO_ACCEPTCONN: + case SO_BROADCAST: + /* UNIMPL case SO_DEBUG: */ + /* UNIMPL case SO_DONTROUTE: */ + case SO_KEEPALIVE: + /* UNIMPL case SO_OOBINCLUDE: */ +#if SO_REUSE + case SO_REUSEADDR: + case SO_REUSEPORT: +#endif /* SO_REUSE */ + /*case SO_USELOOPBACK: UNIMPL */ + *(int*)optval = sock->conn->pcb.ip->so_options & optname; + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getsockopt(%d, SOL_SOCKET, optname=0x%x, ..) = %s\n", + s, optname, (*(int*)optval?"on":"off"))); + break; + + case SO_TYPE: + switch (NETCONNTYPE_GROUP(sock->conn->type)) { + case NETCONN_RAW: + *(int*)optval = SOCK_RAW; + break; + case NETCONN_TCP: + *(int*)optval = SOCK_STREAM; + break; + case NETCONN_UDP: + *(int*)optval = SOCK_DGRAM; + break; + default: /* unrecognized socket type */ + *(int*)optval = sock->conn->type; + LWIP_DEBUGF(SOCKETS_DEBUG, + ("lwip_getsockopt(%d, SOL_SOCKET, SO_TYPE): unrecognized socket type %d\n", + s, *(int *)optval)); + } /* switch (sock->conn->type) */ + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getsockopt(%d, SOL_SOCKET, SO_TYPE) = %d\n", + s, *(int *)optval)); + break; + + case SO_ERROR: + /* only overwrite ERR_OK or tempoary errors */ + if ((sock->err == 0) || (sock->err == EINPROGRESS)) { + sock_set_errno(sock, err_to_errno(sock->conn->last_err)); + } + *(int *)optval = sock->err; + sock->err = 0; + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getsockopt(%d, SOL_SOCKET, SO_ERROR) = %d\n", + s, *(int *)optval)); + break; + +#if LWIP_SO_RCVTIMEO + case SO_RCVTIMEO: + *(int *)optval = netconn_get_recvtimeout(sock->conn); + break; +#endif /* LWIP_SO_RCVTIMEO */ +#if LWIP_SO_RCVBUF + case SO_RCVBUF: + *(int *)optval = netconn_get_recvbufsize(sock->conn); + break; +#endif /* LWIP_SO_RCVBUF */ +#if LWIP_UDP + case SO_NO_CHECK: + *(int*)optval = (udp_flags(sock->conn->pcb.udp) & UDP_FLAGS_NOCHKSUM) ? 1 : 0; + break; +#endif /* LWIP_UDP*/ + default: + LWIP_ASSERT("unhandled optname", 0); + break; + } /* switch (optname) */ + break; + +/* Level: IPPROTO_IP */ + case IPPROTO_IP: + switch (optname) { + case IP_TTL: + *(int*)optval = sock->conn->pcb.ip->ttl; + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getsockopt(%d, IPPROTO_IP, IP_TTL) = %d\n", + s, *(int *)optval)); + break; + case IP_TOS: + *(int*)optval = sock->conn->pcb.ip->tos; + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getsockopt(%d, IPPROTO_IP, IP_TOS) = %d\n", + s, *(int *)optval)); + break; +#if LWIP_IGMP + case IP_MULTICAST_TTL: + *(u8_t*)optval = sock->conn->pcb.ip->ttl; + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getsockopt(%d, IPPROTO_IP, IP_MULTICAST_TTL) = %d\n", + s, *(int *)optval)); + break; + case IP_MULTICAST_IF: + inet_addr_from_ipaddr((struct in_addr*)optval, &sock->conn->pcb.udp->multicast_ip); + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getsockopt(%d, IPPROTO_IP, IP_MULTICAST_IF) = 0x%"X32_F"\n", + s, *(u32_t *)optval)); + break; + case IP_MULTICAST_LOOP: + if ((sock->conn->pcb.udp->flags & UDP_FLAGS_MULTICAST_LOOP) != 0) { + *(u8_t*)optval = 1; + } else { + *(u8_t*)optval = 0; + } + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getsockopt(%d, IPPROTO_IP, IP_MULTICAST_LOOP) = %d\n", + s, *(int *)optval)); + break; +#endif /* LWIP_IGMP */ + default: + LWIP_ASSERT("unhandled optname", 0); + break; + } /* switch (optname) */ + break; + +#if LWIP_TCP +/* Level: IPPROTO_TCP */ + case IPPROTO_TCP: + switch (optname) { + case TCP_NODELAY: + *(int*)optval = tcp_nagle_disabled(sock->conn->pcb.tcp); + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getsockopt(%d, IPPROTO_TCP, TCP_NODELAY) = %s\n", + s, (*(int*)optval)?"on":"off") ); + break; + case TCP_KEEPALIVE: + *(int*)optval = (int)sock->conn->pcb.tcp->keep_idle; + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getsockopt(%d, IPPROTO_IP, TCP_KEEPALIVE) = %d\n", + s, *(int *)optval)); + break; + +#if LWIP_TCP_KEEPALIVE + case TCP_KEEPIDLE: + *(int*)optval = (int)(sock->conn->pcb.tcp->keep_idle/1000); + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getsockopt(%d, IPPROTO_IP, TCP_KEEPIDLE) = %d\n", + s, *(int *)optval)); + break; + case TCP_KEEPINTVL: + *(int*)optval = (int)(sock->conn->pcb.tcp->keep_intvl/1000); + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getsockopt(%d, IPPROTO_IP, TCP_KEEPINTVL) = %d\n", + s, *(int *)optval)); + break; + case TCP_KEEPCNT: + *(int*)optval = (int)sock->conn->pcb.tcp->keep_cnt; + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getsockopt(%d, IPPROTO_IP, TCP_KEEPCNT) = %d\n", + s, *(int *)optval)); + break; +#endif /* LWIP_TCP_KEEPALIVE */ + default: + LWIP_ASSERT("unhandled optname", 0); + break; + } /* switch (optname) */ + break; +#endif /* LWIP_TCP */ +#if LWIP_UDP && LWIP_UDPLITE + /* Level: IPPROTO_UDPLITE */ + case IPPROTO_UDPLITE: + switch (optname) { + case UDPLITE_SEND_CSCOV: + *(int*)optval = sock->conn->pcb.udp->chksum_len_tx; + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getsockopt(%d, IPPROTO_UDPLITE, UDPLITE_SEND_CSCOV) = %d\n", + s, (*(int*)optval)) ); + break; + case UDPLITE_RECV_CSCOV: + *(int*)optval = sock->conn->pcb.udp->chksum_len_rx; + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getsockopt(%d, IPPROTO_UDPLITE, UDPLITE_RECV_CSCOV) = %d\n", + s, (*(int*)optval)) ); + break; + default: + LWIP_ASSERT("unhandled optname", 0); + break; + } /* switch (optname) */ + break; +#endif /* LWIP_UDP */ + default: + LWIP_ASSERT("unhandled level", 0); + break; + } /* switch (level) */ + sys_sem_signal(&sock->conn->op_completed); +} + +int +lwip_setsockopt(int s, int level, int optname, const void *optval, socklen_t optlen) +{ + struct lwip_sock *sock = get_socket(s); + err_t err = ERR_OK; + struct lwip_setgetsockopt_data data; + + if (!sock) { + return -1; + } + + if (NULL == optval) { + sock_set_errno(sock, EFAULT); + return -1; + } + + /* Do length and type checks for the various options first, to keep it readable. */ + switch (level) { + +/* Level: SOL_SOCKET */ + case SOL_SOCKET: + switch (optname) { + + case SO_BROADCAST: + /* UNIMPL case SO_DEBUG: */ + /* UNIMPL case SO_DONTROUTE: */ + case SO_KEEPALIVE: + /* UNIMPL case case SO_CONTIMEO: */ + /* UNIMPL case case SO_SNDTIMEO: */ +#if LWIP_SO_RCVTIMEO + case SO_RCVTIMEO: +#endif /* LWIP_SO_RCVTIMEO */ +#if LWIP_SO_RCVBUF + case SO_RCVBUF: +#endif /* LWIP_SO_RCVBUF */ + /* UNIMPL case SO_OOBINLINE: */ + /* UNIMPL case SO_SNDBUF: */ + /* UNIMPL case SO_RCVLOWAT: */ + /* UNIMPL case SO_SNDLOWAT: */ +#if SO_REUSE + case SO_REUSEADDR: + case SO_REUSEPORT: +#endif /* SO_REUSE */ + /* UNIMPL case SO_USELOOPBACK: */ + if (optlen < sizeof(int)) { + err = EINVAL; + } + break; + case SO_NO_CHECK: + if (optlen < sizeof(int)) { + err = EINVAL; + } +#if LWIP_UDP + if ((sock->conn->type != NETCONN_UDP) || + ((udp_flags(sock->conn->pcb.udp) & UDP_FLAGS_UDPLITE) != 0)) { + /* this flag is only available for UDP, not for UDP lite */ + err = EAFNOSUPPORT; + } +#endif /* LWIP_UDP */ + break; + default: + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_setsockopt(%d, SOL_SOCKET, UNIMPL: optname=0x%x, ..)\n", + s, optname)); + err = ENOPROTOOPT; + } /* switch (optname) */ + break; + +/* Level: IPPROTO_IP */ + case IPPROTO_IP: + switch (optname) { + /* UNIMPL case IP_HDRINCL: */ + /* UNIMPL case IP_RCVDSTADDR: */ + /* UNIMPL case IP_RCVIF: */ + case IP_TTL: + case IP_TOS: + if (optlen < sizeof(int)) { + err = EINVAL; + } + break; +#if LWIP_IGMP + case IP_MULTICAST_TTL: + if (optlen < sizeof(u8_t)) { + err = EINVAL; + } + if (NETCONNTYPE_GROUP(sock->conn->type) != NETCONN_UDP) { + err = EAFNOSUPPORT; + } + break; + case IP_MULTICAST_IF: + if (optlen < sizeof(struct in_addr)) { + err = EINVAL; + } + if (NETCONNTYPE_GROUP(sock->conn->type) != NETCONN_UDP) { + err = EAFNOSUPPORT; + } + break; + case IP_MULTICAST_LOOP: + if (optlen < sizeof(u8_t)) { + err = EINVAL; + } + if (NETCONNTYPE_GROUP(sock->conn->type) != NETCONN_UDP) { + err = EAFNOSUPPORT; + } + break; + case IP_ADD_MEMBERSHIP: + case IP_DROP_MEMBERSHIP: + if (optlen < sizeof(struct ip_mreq)) { + err = EINVAL; + } + if (NETCONNTYPE_GROUP(sock->conn->type) != NETCONN_UDP) { + err = EAFNOSUPPORT; + } + break; +#endif /* LWIP_IGMP */ + default: + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_setsockopt(%d, IPPROTO_IP, UNIMPL: optname=0x%x, ..)\n", + s, optname)); + err = ENOPROTOOPT; + } /* switch (optname) */ + break; + +#if LWIP_TCP +/* Level: IPPROTO_TCP */ + case IPPROTO_TCP: + if (optlen < sizeof(int)) { + err = EINVAL; + break; + } + + /* If this is no TCP socket, ignore any options. */ + if (sock->conn->type != NETCONN_TCP) + return 0; + + switch (optname) { + case TCP_NODELAY: + case TCP_KEEPALIVE: +#if LWIP_TCP_KEEPALIVE + case TCP_KEEPIDLE: + case TCP_KEEPINTVL: + case TCP_KEEPCNT: +#endif /* LWIP_TCP_KEEPALIVE */ + break; + + default: + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_setsockopt(%d, IPPROTO_TCP, UNIMPL: optname=0x%x, ..)\n", + s, optname)); + err = ENOPROTOOPT; + } /* switch (optname) */ + break; +#endif /* LWIP_TCP */ +#if LWIP_UDP && LWIP_UDPLITE +/* Level: IPPROTO_UDPLITE */ + case IPPROTO_UDPLITE: + if (optlen < sizeof(int)) { + err = EINVAL; + break; + } + + /* If this is no UDP lite socket, ignore any options. */ + if (sock->conn->type != NETCONN_UDPLITE) + return 0; + + switch (optname) { + case UDPLITE_SEND_CSCOV: + case UDPLITE_RECV_CSCOV: + break; + + default: + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_setsockopt(%d, IPPROTO_UDPLITE, UNIMPL: optname=0x%x, ..)\n", + s, optname)); + err = ENOPROTOOPT; + } /* switch (optname) */ + break; +#endif /* LWIP_UDP && LWIP_UDPLITE */ +/* UNDEFINED LEVEL */ + default: + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_setsockopt(%d, level=0x%x, UNIMPL: optname=0x%x, ..)\n", + s, level, optname)); + err = ENOPROTOOPT; + } /* switch (level) */ + + + if (err != ERR_OK) { + sock_set_errno(sock, err); + return -1; + } + + + /* Now do the actual option processing */ + data.sock = sock; +#ifdef LWIP_DEBUG + data.s = s; +#endif /* LWIP_DEBUG */ + data.level = level; + data.optname = optname; + data.optval = (void*)optval; + data.optlen = &optlen; + data.err = err; + tcpip_callback(lwip_setsockopt_internal, &data); + sys_arch_sem_wait(&sock->conn->op_completed, 0); + /* maybe lwip_setsockopt_internal has changed err */ + err = data.err; + + sock_set_errno(sock, err); + return err ? -1 : 0; +} + +static void +lwip_setsockopt_internal(void *arg) +{ + struct lwip_sock *sock; +#ifdef LWIP_DEBUG + int s; +#endif /* LWIP_DEBUG */ + int level, optname; + const void *optval; + struct lwip_setgetsockopt_data *data; + + LWIP_ASSERT("arg != NULL", arg != NULL); + + data = (struct lwip_setgetsockopt_data*)arg; + sock = data->sock; +#ifdef LWIP_DEBUG + s = data->s; +#endif /* LWIP_DEBUG */ + level = data->level; + optname = data->optname; + optval = data->optval; + + switch (level) { + +/* Level: SOL_SOCKET */ + case SOL_SOCKET: + switch (optname) { + + /* The option flags */ + case SO_BROADCAST: + /* UNIMPL case SO_DEBUG: */ + /* UNIMPL case SO_DONTROUTE: */ + case SO_KEEPALIVE: + /* UNIMPL case SO_OOBINCLUDE: */ +#if SO_REUSE + case SO_REUSEADDR: + case SO_REUSEPORT: +#endif /* SO_REUSE */ + /* UNIMPL case SO_USELOOPBACK: */ + if (*(int*)optval) { + sock->conn->pcb.ip->so_options |= optname; + } else { + sock->conn->pcb.ip->so_options &= ~optname; + } + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_setsockopt(%d, SOL_SOCKET, optname=0x%x, ..) -> %s\n", + s, optname, (*(int*)optval?"on":"off"))); + break; +#if LWIP_SO_RCVTIMEO + case SO_RCVTIMEO: + netconn_set_recvtimeout(sock->conn, *(int*)optval); + break; +#endif /* LWIP_SO_RCVTIMEO */ +#if LWIP_SO_RCVBUF + case SO_RCVBUF: + netconn_set_recvbufsize(sock->conn, *(int*)optval); + break; +#endif /* LWIP_SO_RCVBUF */ +#if LWIP_UDP + case SO_NO_CHECK: + if (*(int*)optval) { + udp_setflags(sock->conn->pcb.udp, udp_flags(sock->conn->pcb.udp) | UDP_FLAGS_NOCHKSUM); + } else { + udp_setflags(sock->conn->pcb.udp, udp_flags(sock->conn->pcb.udp) & ~UDP_FLAGS_NOCHKSUM); + } + break; +#endif /* LWIP_UDP */ + default: + LWIP_ASSERT("unhandled optname", 0); + break; + } /* switch (optname) */ + break; + +/* Level: IPPROTO_IP */ + case IPPROTO_IP: + switch (optname) { + case IP_TTL: + sock->conn->pcb.ip->ttl = (u8_t)(*(int*)optval); + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_setsockopt(%d, IPPROTO_IP, IP_TTL, ..) -> %d\n", + s, sock->conn->pcb.ip->ttl)); + break; + case IP_TOS: + sock->conn->pcb.ip->tos = (u8_t)(*(int*)optval); + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_setsockopt(%d, IPPROTO_IP, IP_TOS, ..)-> %d\n", + s, sock->conn->pcb.ip->tos)); + break; +#if LWIP_IGMP + case IP_MULTICAST_TTL: + sock->conn->pcb.udp->ttl = (u8_t)(*(u8_t*)optval); + break; + case IP_MULTICAST_IF: + inet_addr_to_ipaddr(&sock->conn->pcb.udp->multicast_ip, (struct in_addr*)optval); + break; + case IP_MULTICAST_LOOP: + if (*(u8_t*)optval) { + udp_setflags(sock->conn->pcb.udp, udp_flags(sock->conn->pcb.udp) | UDP_FLAGS_MULTICAST_LOOP); + } else { + udp_setflags(sock->conn->pcb.udp, udp_flags(sock->conn->pcb.udp) & ~UDP_FLAGS_MULTICAST_LOOP); + } + break; + case IP_ADD_MEMBERSHIP: + case IP_DROP_MEMBERSHIP: + { + /* If this is a TCP or a RAW socket, ignore these options. */ + struct ip_mreq *imr = (struct ip_mreq *)optval; + ip_addr_t if_addr; + ip_addr_t multi_addr; + inet_addr_to_ipaddr(&if_addr, &imr->imr_interface); + inet_addr_to_ipaddr(&multi_addr, &imr->imr_multiaddr); + if(optname == IP_ADD_MEMBERSHIP){ + data->err = igmp_joingroup(&if_addr, &multi_addr); + } else { + data->err = igmp_leavegroup(&if_addr, &multi_addr); + } + if(data->err != ERR_OK) { + data->err = EADDRNOTAVAIL; + } + } + break; +#endif /* LWIP_IGMP */ + default: + LWIP_ASSERT("unhandled optname", 0); + break; + } /* switch (optname) */ + break; + +#if LWIP_TCP +/* Level: IPPROTO_TCP */ + case IPPROTO_TCP: + switch (optname) { + case TCP_NODELAY: + if (*(int*)optval) { + tcp_nagle_disable(sock->conn->pcb.tcp); + } else { + tcp_nagle_enable(sock->conn->pcb.tcp); + } + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_setsockopt(%d, IPPROTO_TCP, TCP_NODELAY) -> %s\n", + s, (*(int *)optval)?"on":"off") ); + break; + case TCP_KEEPALIVE: + sock->conn->pcb.tcp->keep_idle = (u32_t)(*(int*)optval); + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_setsockopt(%d, IPPROTO_TCP, TCP_KEEPALIVE) -> %"U32_F"\n", + s, sock->conn->pcb.tcp->keep_idle)); + break; + +#if LWIP_TCP_KEEPALIVE + case TCP_KEEPIDLE: + sock->conn->pcb.tcp->keep_idle = 1000*(u32_t)(*(int*)optval); + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_setsockopt(%d, IPPROTO_TCP, TCP_KEEPIDLE) -> %"U32_F"\n", + s, sock->conn->pcb.tcp->keep_idle)); + break; + case TCP_KEEPINTVL: + sock->conn->pcb.tcp->keep_intvl = 1000*(u32_t)(*(int*)optval); + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_setsockopt(%d, IPPROTO_TCP, TCP_KEEPINTVL) -> %"U32_F"\n", + s, sock->conn->pcb.tcp->keep_intvl)); + break; + case TCP_KEEPCNT: + sock->conn->pcb.tcp->keep_cnt = (u32_t)(*(int*)optval); + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_setsockopt(%d, IPPROTO_TCP, TCP_KEEPCNT) -> %"U32_F"\n", + s, sock->conn->pcb.tcp->keep_cnt)); + break; +#endif /* LWIP_TCP_KEEPALIVE */ + default: + LWIP_ASSERT("unhandled optname", 0); + break; + } /* switch (optname) */ + break; +#endif /* LWIP_TCP*/ +#if LWIP_UDP && LWIP_UDPLITE + /* Level: IPPROTO_UDPLITE */ + case IPPROTO_UDPLITE: + switch (optname) { + case UDPLITE_SEND_CSCOV: + if ((*(int*)optval != 0) && ((*(int*)optval < 8)) || (*(int*)optval > 0xffff)) { + /* don't allow illegal values! */ + sock->conn->pcb.udp->chksum_len_tx = 8; + } else { + sock->conn->pcb.udp->chksum_len_tx = (u16_t)*(int*)optval; + } + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_setsockopt(%d, IPPROTO_UDPLITE, UDPLITE_SEND_CSCOV) -> %d\n", + s, (*(int*)optval)) ); + break; + case UDPLITE_RECV_CSCOV: + if ((*(int*)optval != 0) && ((*(int*)optval < 8)) || (*(int*)optval > 0xffff)) { + /* don't allow illegal values! */ + sock->conn->pcb.udp->chksum_len_rx = 8; + } else { + sock->conn->pcb.udp->chksum_len_rx = (u16_t)*(int*)optval; + } + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_setsockopt(%d, IPPROTO_UDPLITE, UDPLITE_RECV_CSCOV) -> %d\n", + s, (*(int*)optval)) ); + break; + default: + LWIP_ASSERT("unhandled optname", 0); + break; + } /* switch (optname) */ + break; +#endif /* LWIP_UDP */ + default: + LWIP_ASSERT("unhandled level", 0); + break; + } /* switch (level) */ + sys_sem_signal(&sock->conn->op_completed); +} + +int +lwip_ioctl(int s, long cmd, void *argp) +{ + struct lwip_sock *sock = get_socket(s); + u8_t val; +#if LWIP_SO_RCVBUF + u16_t buflen = 0; + s16_t recv_avail; +#endif /* LWIP_SO_RCVBUF */ + + if (!sock) { + return -1; + } + + switch (cmd) { +#if LWIP_SO_RCVBUF + case FIONREAD: + if (!argp) { + sock_set_errno(sock, EINVAL); + return -1; + } + + SYS_ARCH_GET(sock->conn->recv_avail, recv_avail); + if (recv_avail < 0) { + recv_avail = 0; + } + *((u16_t*)argp) = (u16_t)recv_avail; + + /* Check if there is data left from the last recv operation. /maq 041215 */ + if (sock->lastdata) { + struct pbuf *p = (struct pbuf *)sock->lastdata; + if (netconn_type(sock->conn) != NETCONN_TCP) { + p = ((struct netbuf *)p)->p; + } + buflen = p->tot_len; + buflen -= sock->lastoffset; + + *((u16_t*)argp) += buflen; + } + + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_ioctl(%d, FIONREAD, %p) = %"U16_F"\n", s, argp, *((u16_t*)argp))); + sock_set_errno(sock, 0); + return 0; +#endif /* LWIP_SO_RCVBUF */ + + case FIONBIO: + val = 0; + if (argp && *(u32_t*)argp) { + val = 1; + } + netconn_set_nonblocking(sock->conn, val); + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_ioctl(%d, FIONBIO, %d)\n", s, val)); + sock_set_errno(sock, 0); + return 0; + + default: + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_ioctl(%d, UNIMPL: 0x%lx, %p)\n", s, cmd, argp)); + sock_set_errno(sock, ENOSYS); /* not yet implemented */ + return -1; + } /* switch (cmd) */ +} + +/** A minimal implementation of fcntl. + * Currently only the commands F_GETFL and F_SETFL are implemented. + * Only the flag O_NONBLOCK is implemented. + */ +int +lwip_fcntl(int s, int cmd, int val) +{ + struct lwip_sock *sock = get_socket(s); + int ret = -1; + + if (!sock || !sock->conn) { + return -1; + } + + switch (cmd) { + case F_GETFL: + ret = netconn_is_nonblocking(sock->conn) ? O_NONBLOCK : 0; + break; + case F_SETFL: + if ((val & ~O_NONBLOCK) == 0) { + /* only O_NONBLOCK, all other bits are zero */ + netconn_set_nonblocking(sock->conn, val & O_NONBLOCK); + ret = 0; + } + break; + default: + LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_fcntl(%d, UNIMPL: %d, %d)\n", s, cmd, val)); + break; + } + return ret; +} + +#endif /* LWIP_SOCKET */ diff --git a/lib/drivers/lwip/src/api/tcpip.c b/lib/drivers/lwip/src/api/tcpip.c new file mode 100644 index 00000000000..857e7d9bd64 --- /dev/null +++ b/lib/drivers/lwip/src/api/tcpip.c @@ -0,0 +1,460 @@ +/** + * @file + * Sequential API Main thread module + * + */ + +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ + +#include "lwip/opt.h" + +#if !NO_SYS /* don't build if not configured for use in lwipopts.h */ + +#include "lwip/sys.h" +#include "lwip/memp.h" +#include "lwip/mem.h" +#include "lwip/pbuf.h" +#include "lwip/tcpip.h" +#include "lwip/init.h" +#include "netif/etharp.h" +#include "netif/ppp_oe.h" + +/* global variables */ +static tcpip_init_done_fn tcpip_init_done; +static void *tcpip_init_done_arg; +static sys_mbox_t mbox; + +#if LWIP_TCPIP_CORE_LOCKING +/** The global semaphore to lock the stack. */ +sys_mutex_t lock_tcpip_core; +#endif /* LWIP_TCPIP_CORE_LOCKING */ + + +/** + * The main lwIP thread. This thread has exclusive access to lwIP core functions + * (unless access to them is not locked). Other threads communicate with this + * thread using message boxes. + * + * It also starts all the timers to make sure they are running in the right + * thread context. + * + * @param arg unused argument + */ +static void +tcpip_thread(void *arg) +{ + struct tcpip_msg *msg; + LWIP_UNUSED_ARG(arg); + + if (tcpip_init_done != NULL) { + tcpip_init_done(tcpip_init_done_arg); + } + + LOCK_TCPIP_CORE(); + while (1) { /* MAIN Loop */ + UNLOCK_TCPIP_CORE(); + LWIP_TCPIP_THREAD_ALIVE(); + /* wait for a message, timeouts are processed while waiting */ + sys_timeouts_mbox_fetch(&mbox, (void **)&msg); + LOCK_TCPIP_CORE(); + switch (msg->type) { +#if LWIP_NETCONN + case TCPIP_MSG_API: + LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: API message %p\n", (void *)msg)); + msg->msg.apimsg->function(&(msg->msg.apimsg->msg)); + break; +#endif /* LWIP_NETCONN */ + +#if !LWIP_TCPIP_CORE_LOCKING_INPUT + case TCPIP_MSG_INPKT: + LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: PACKET %p\n", (void *)msg)); +#if LWIP_ETHERNET + if (msg->msg.inp.netif->flags & (NETIF_FLAG_ETHARP | NETIF_FLAG_ETHERNET)) { + ethernet_input(msg->msg.inp.p, msg->msg.inp.netif); + } else +#endif /* LWIP_ETHERNET */ + { + ip_input(msg->msg.inp.p, msg->msg.inp.netif); + } + memp_free(MEMP_TCPIP_MSG_INPKT, msg); + break; +#endif /* LWIP_TCPIP_CORE_LOCKING_INPUT */ + +#if LWIP_NETIF_API + case TCPIP_MSG_NETIFAPI: + LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: Netif API message %p\n", (void *)msg)); + msg->msg.netifapimsg->function(&(msg->msg.netifapimsg->msg)); + break; +#endif /* LWIP_NETIF_API */ + + case TCPIP_MSG_CALLBACK: + LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: CALLBACK %p\n", (void *)msg)); + msg->msg.cb.function(msg->msg.cb.ctx); + memp_free(MEMP_TCPIP_MSG_API, msg); + break; + +#if LWIP_TCPIP_TIMEOUT + case TCPIP_MSG_TIMEOUT: + LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: TIMEOUT %p\n", (void *)msg)); + sys_timeout(msg->msg.tmo.msecs, msg->msg.tmo.h, msg->msg.tmo.arg); + memp_free(MEMP_TCPIP_MSG_API, msg); + break; + case TCPIP_MSG_UNTIMEOUT: + LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: UNTIMEOUT %p\n", (void *)msg)); + sys_untimeout(msg->msg.tmo.h, msg->msg.tmo.arg); + memp_free(MEMP_TCPIP_MSG_API, msg); + break; +#endif /* LWIP_TCPIP_TIMEOUT */ + + default: + LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: invalid message: %d\n", msg->type)); + LWIP_ASSERT("tcpip_thread: invalid message", 0); + break; + } + } +} + +/** + * Pass a received packet to tcpip_thread for input processing + * + * @param p the received packet, p->payload pointing to the Ethernet header or + * to an IP header (if inp doesn't have NETIF_FLAG_ETHARP or + * NETIF_FLAG_ETHERNET flags) + * @param inp the network interface on which the packet was received + */ +err_t +tcpip_input(struct pbuf *p, struct netif *inp) +{ +#if LWIP_TCPIP_CORE_LOCKING_INPUT + err_t ret; + LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_input: PACKET %p/%p\n", (void *)p, (void *)inp)); + LOCK_TCPIP_CORE(); +#if LWIP_ETHERNET + if (inp->flags & (NETIF_FLAG_ETHARP | NETIF_FLAG_ETHERNET)) { + ret = ethernet_input(p, inp); + } else +#endif /* LWIP_ETHERNET */ + { + ret = ip_input(p, inp); + } + UNLOCK_TCPIP_CORE(); + return ret; +#else /* LWIP_TCPIP_CORE_LOCKING_INPUT */ + struct tcpip_msg *msg; + + if (sys_mbox_valid(&mbox)) { + msg = (struct tcpip_msg *)memp_malloc(MEMP_TCPIP_MSG_INPKT); + if (msg == NULL) { + return ERR_MEM; + } + + msg->type = TCPIP_MSG_INPKT; + msg->msg.inp.p = p; + msg->msg.inp.netif = inp; + if (sys_mbox_trypost(&mbox, msg) != ERR_OK) { + memp_free(MEMP_TCPIP_MSG_INPKT, msg); + return ERR_MEM; + } + return ERR_OK; + } + return ERR_VAL; +#endif /* LWIP_TCPIP_CORE_LOCKING_INPUT */ +} + +/** + * Call a specific function in the thread context of + * tcpip_thread for easy access synchronization. + * A function called in that way may access lwIP core code + * without fearing concurrent access. + * + * @param f the function to call + * @param ctx parameter passed to f + * @param block 1 to block until the request is posted, 0 to non-blocking mode + * @return ERR_OK if the function was called, another err_t if not + */ +err_t +tcpip_callback_with_block(tcpip_callback_fn function, void *ctx, u8_t block) +{ + struct tcpip_msg *msg; + + if (sys_mbox_valid(&mbox)) { + msg = (struct tcpip_msg *)memp_malloc(MEMP_TCPIP_MSG_API); + if (msg == NULL) { + return ERR_MEM; + } + + msg->type = TCPIP_MSG_CALLBACK; + msg->msg.cb.function = function; + msg->msg.cb.ctx = ctx; + if (block) { + sys_mbox_post(&mbox, msg); + } else { + if (sys_mbox_trypost(&mbox, msg) != ERR_OK) { + memp_free(MEMP_TCPIP_MSG_API, msg); + return ERR_MEM; + } + } + return ERR_OK; + } + return ERR_VAL; +} + +#if LWIP_TCPIP_TIMEOUT +/** + * call sys_timeout in tcpip_thread + * + * @param msec time in milliseconds for timeout + * @param h function to be called on timeout + * @param arg argument to pass to timeout function h + * @return ERR_MEM on memory error, ERR_OK otherwise + */ +err_t +tcpip_timeout(u32_t msecs, sys_timeout_handler h, void *arg) +{ + struct tcpip_msg *msg; + + if (sys_mbox_valid(&mbox)) { + msg = (struct tcpip_msg *)memp_malloc(MEMP_TCPIP_MSG_API); + if (msg == NULL) { + return ERR_MEM; + } + + msg->type = TCPIP_MSG_TIMEOUT; + msg->msg.tmo.msecs = msecs; + msg->msg.tmo.h = h; + msg->msg.tmo.arg = arg; + sys_mbox_post(&mbox, msg); + return ERR_OK; + } + return ERR_VAL; +} + +/** + * call sys_untimeout in tcpip_thread + * + * @param msec time in milliseconds for timeout + * @param h function to be called on timeout + * @param arg argument to pass to timeout function h + * @return ERR_MEM on memory error, ERR_OK otherwise + */ +err_t +tcpip_untimeout(sys_timeout_handler h, void *arg) +{ + struct tcpip_msg *msg; + + if (sys_mbox_valid(&mbox)) { + msg = (struct tcpip_msg *)memp_malloc(MEMP_TCPIP_MSG_API); + if (msg == NULL) { + return ERR_MEM; + } + + msg->type = TCPIP_MSG_UNTIMEOUT; + msg->msg.tmo.h = h; + msg->msg.tmo.arg = arg; + sys_mbox_post(&mbox, msg); + return ERR_OK; + } + return ERR_VAL; +} +#endif /* LWIP_TCPIP_TIMEOUT */ + +#if LWIP_NETCONN +/** + * Call the lower part of a netconn_* function + * This function is then running in the thread context + * of tcpip_thread and has exclusive access to lwIP core code. + * + * @param apimsg a struct containing the function to call and its parameters + * @return ERR_OK if the function was called, another err_t if not + */ +err_t +tcpip_apimsg(struct api_msg *apimsg) +{ + struct tcpip_msg msg; +#ifdef LWIP_DEBUG + /* catch functions that don't set err */ + apimsg->msg.err = ERR_VAL; +#endif + + if (sys_mbox_valid(&mbox)) { + msg.type = TCPIP_MSG_API; + msg.msg.apimsg = apimsg; + sys_mbox_post(&mbox, &msg); + sys_arch_sem_wait(&apimsg->msg.conn->op_completed, 0); + return apimsg->msg.err; + } + return ERR_VAL; +} + +#if LWIP_TCPIP_CORE_LOCKING +/** + * Call the lower part of a netconn_* function + * This function has exclusive access to lwIP core code by locking it + * before the function is called. + * + * @param apimsg a struct containing the function to call and its parameters + * @return ERR_OK (only for compatibility fo tcpip_apimsg()) + */ +err_t +tcpip_apimsg_lock(struct api_msg *apimsg) +{ +#ifdef LWIP_DEBUG + /* catch functions that don't set err */ + apimsg->msg.err = ERR_VAL; +#endif + + LOCK_TCPIP_CORE(); + apimsg->function(&(apimsg->msg)); + UNLOCK_TCPIP_CORE(); + return apimsg->msg.err; + +} +#endif /* LWIP_TCPIP_CORE_LOCKING */ +#endif /* LWIP_NETCONN */ + +#if LWIP_NETIF_API +#if !LWIP_TCPIP_CORE_LOCKING +/** + * Much like tcpip_apimsg, but calls the lower part of a netifapi_* + * function. + * + * @param netifapimsg a struct containing the function to call and its parameters + * @return error code given back by the function that was called + */ +err_t +tcpip_netifapi(struct netifapi_msg* netifapimsg) +{ + struct tcpip_msg msg; + + if (sys_mbox_valid(&mbox)) { + err_t err = sys_sem_new(&netifapimsg->msg.sem, 0); + if (err != ERR_OK) { + netifapimsg->msg.err = err; + return err; + } + + msg.type = TCPIP_MSG_NETIFAPI; + msg.msg.netifapimsg = netifapimsg; + sys_mbox_post(&mbox, &msg); + sys_sem_wait(&netifapimsg->msg.sem); + sys_sem_free(&netifapimsg->msg.sem); + return netifapimsg->msg.err; + } + return ERR_VAL; +} +#else /* !LWIP_TCPIP_CORE_LOCKING */ +/** + * Call the lower part of a netifapi_* function + * This function has exclusive access to lwIP core code by locking it + * before the function is called. + * + * @param netifapimsg a struct containing the function to call and its parameters + * @return ERR_OK (only for compatibility fo tcpip_netifapi()) + */ +err_t +tcpip_netifapi_lock(struct netifapi_msg* netifapimsg) +{ + LOCK_TCPIP_CORE(); + netifapimsg->function(&(netifapimsg->msg)); + UNLOCK_TCPIP_CORE(); + return netifapimsg->msg.err; +} +#endif /* !LWIP_TCPIP_CORE_LOCKING */ +#endif /* LWIP_NETIF_API */ + +/** + * Initialize this module: + * - initialize all sub modules + * - start the tcpip_thread + * + * @param initfunc a function to call when tcpip_thread is running and finished initializing + * @param arg argument to pass to initfunc + */ +void +tcpip_init(tcpip_init_done_fn initfunc, void *arg) +{ + lwip_init(); + + tcpip_init_done = initfunc; + tcpip_init_done_arg = arg; + if(sys_mbox_new(&mbox, TCPIP_MBOX_SIZE) != ERR_OK) { + LWIP_ASSERT("failed to create tcpip_thread mbox", 0); + } +#if LWIP_TCPIP_CORE_LOCKING + if(sys_mutex_new(&lock_tcpip_core) != ERR_OK) { + LWIP_ASSERT("failed to create lock_tcpip_core", 0); + } +#endif /* LWIP_TCPIP_CORE_LOCKING */ + + sys_thread_new(TCPIP_THREAD_NAME, tcpip_thread, NULL, TCPIP_THREAD_STACKSIZE, TCPIP_THREAD_PRIO); +} + +/** + * Simple callback function used with tcpip_callback to free a pbuf + * (pbuf_free has a wrong signature for tcpip_callback) + * + * @param p The pbuf (chain) to be dereferenced. + */ +static void +pbuf_free_int(void *p) +{ + struct pbuf *q = (struct pbuf *)p; + pbuf_free(q); +} + +/** + * A simple wrapper function that allows you to free a pbuf from interrupt context. + * + * @param p The pbuf (chain) to be dereferenced. + * @return ERR_OK if callback could be enqueued, an err_t if not + */ +err_t +pbuf_free_callback(struct pbuf *p) +{ + return tcpip_callback_with_block(pbuf_free_int, p, 0); +} + +/** + * A simple wrapper function that allows you to free heap memory from + * interrupt context. + * + * @param m the heap memory to free + * @return ERR_OK if callback could be enqueued, an err_t if not + */ +err_t +mem_free_callback(void *m) +{ + return tcpip_callback_with_block(mem_free, m, 0); +} + +#endif /* !NO_SYS */ diff --git a/lib/drivers/lwip/src/core/def.c b/lib/drivers/lwip/src/core/def.c new file mode 100644 index 00000000000..352b55241a5 --- /dev/null +++ b/lib/drivers/lwip/src/core/def.c @@ -0,0 +1,108 @@ +/** + * @file + * Common functions used throughout the stack. + * + */ + +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Simon Goldschmidt + * + */ + +#include "lwip/opt.h" +#include "lwip/def.h" + +/** + * These are reference implementations of the byte swapping functions. + * Again with the aim of being simple, correct and fully portable. + * Byte swapping is the second thing you would want to optimize. You will + * need to port it to your architecture and in your cc.h: + * + * #define LWIP_PLATFORM_BYTESWAP 1 + * #define LWIP_PLATFORM_HTONS(x) + * #define LWIP_PLATFORM_HTONL(x) + * + * Note ntohs() and ntohl() are merely references to the htonx counterparts. + */ + +#if (LWIP_PLATFORM_BYTESWAP == 0) && (BYTE_ORDER == LITTLE_ENDIAN) + +/** + * Convert an u16_t from host- to network byte order. + * + * @param n u16_t in host byte order + * @return n in network byte order + */ +u16_t +lwip_htons(u16_t n) +{ + return ((n & 0xff) << 8) | ((n & 0xff00) >> 8); +} + +/** + * Convert an u16_t from network- to host byte order. + * + * @param n u16_t in network byte order + * @return n in host byte order + */ +u16_t +lwip_ntohs(u16_t n) +{ + return lwip_htons(n); +} + +/** + * Convert an u32_t from host- to network byte order. + * + * @param n u32_t in host byte order + * @return n in network byte order + */ +u32_t +lwip_htonl(u32_t n) +{ + return ((n & 0xff) << 24) | + ((n & 0xff00) << 8) | + ((n & 0xff0000UL) >> 8) | + ((n & 0xff000000UL) >> 24); +} + +/** + * Convert an u32_t from network- to host byte order. + * + * @param n u32_t in network byte order + * @return n in host byte order + */ +u32_t +lwip_ntohl(u32_t n) +{ + return lwip_htonl(n); +} + +#endif /* (LWIP_PLATFORM_BYTESWAP == 0) && (BYTE_ORDER == LITTLE_ENDIAN) */ diff --git a/lib/drivers/lwip/src/core/dhcp.c b/lib/drivers/lwip/src/core/dhcp.c new file mode 100644 index 00000000000..81b4be271e9 --- /dev/null +++ b/lib/drivers/lwip/src/core/dhcp.c @@ -0,0 +1,1745 @@ +/** + * @file + * Dynamic Host Configuration Protocol client + * + */ + +/* + * + * Copyright (c) 2001-2004 Leon Woestenberg + * Copyright (c) 2001-2004 Axon Digital Design B.V., The Netherlands. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is a contribution to the lwIP TCP/IP stack. + * The Swedish Institute of Computer Science and Adam Dunkels + * are specifically granted permission to redistribute this + * source code. + * + * Author: Leon Woestenberg + * + * This is a DHCP client for the lwIP TCP/IP stack. It aims to conform + * with RFC 2131 and RFC 2132. + * + * TODO: + * - Support for interfaces other than Ethernet (SLIP, PPP, ...) + * + * Please coordinate changes and requests with Leon Woestenberg + * + * + * Integration with your code: + * + * In lwip/dhcp.h + * #define DHCP_COARSE_TIMER_SECS (recommended 60 which is a minute) + * #define DHCP_FINE_TIMER_MSECS (recommended 500 which equals TCP coarse timer) + * + * Then have your application call dhcp_coarse_tmr() and + * dhcp_fine_tmr() on the defined intervals. + * + * dhcp_start(struct netif *netif); + * starts a DHCP client instance which configures the interface by + * obtaining an IP address lease and maintaining it. + * + * Use dhcp_release(netif) to end the lease and use dhcp_stop(netif) + * to remove the DHCP client. + * + */ + +#include "lwip/opt.h" + +#if LWIP_DHCP /* don't build if not configured for use in lwipopts.h */ + +#include "lwip/stats.h" +#include "lwip/mem.h" +#include "lwip/udp.h" +#include "lwip/ip_addr.h" +#include "lwip/netif.h" +#include "lwip/def.h" +#include "lwip/sys.h" +#include "lwip/dhcp.h" +#include "lwip/autoip.h" +#include "lwip/dns.h" +#include "netif/etharp.h" + +#include + +/** Default for DHCP_GLOBAL_XID is 0xABCD0000 + * This can be changed by defining DHCP_GLOBAL_XID and DHCP_GLOBAL_XID_HEADER, e.g. + * #define DHCP_GLOBAL_XID_HEADER "stdlib.h" + * #define DHCP_GLOBAL_XID rand() + */ +#ifdef DHCP_GLOBAL_XID_HEADER +#include DHCP_GLOBAL_XID_HEADER /* include optional starting XID generation prototypes */ +#endif + +/** DHCP_OPTION_MAX_MSG_SIZE is set to the MTU + * MTU is checked to be big enough in dhcp_start */ +#define DHCP_MAX_MSG_LEN(netif) (netif->mtu) +#define DHCP_MAX_MSG_LEN_MIN_REQUIRED 576 +/** Minimum length for reply before packet is parsed */ +#define DHCP_MIN_REPLY_LEN 44 + +#define REBOOT_TRIES 2 + +/** Option handling: options are parsed in dhcp_parse_reply + * and saved in an array where other functions can load them from. + * This might be moved into the struct dhcp (not necessarily since + * lwIP is single-threaded and the array is only used while in recv + * callback). */ +#define DHCP_OPTION_IDX_OVERLOAD 0 +#define DHCP_OPTION_IDX_MSG_TYPE 1 +#define DHCP_OPTION_IDX_SERVER_ID 2 +#define DHCP_OPTION_IDX_LEASE_TIME 3 +#define DHCP_OPTION_IDX_T1 4 +#define DHCP_OPTION_IDX_T2 5 +#define DHCP_OPTION_IDX_SUBNET_MASK 6 +#define DHCP_OPTION_IDX_ROUTER 7 +#define DHCP_OPTION_IDX_DNS_SERVER 8 +#define DHCP_OPTION_IDX_MAX (DHCP_OPTION_IDX_DNS_SERVER + DNS_MAX_SERVERS) + +/** Holds the decoded option values, only valid while in dhcp_recv. + @todo: move this into struct dhcp? */ +u32_t dhcp_rx_options_val[DHCP_OPTION_IDX_MAX]; +/** Holds a flag which option was received and is contained in dhcp_rx_options_val, + only valid while in dhcp_recv. + @todo: move this into struct dhcp? */ +u8_t dhcp_rx_options_given[DHCP_OPTION_IDX_MAX]; + +#define dhcp_option_given(dhcp, idx) (dhcp_rx_options_given[idx] != 0) +#define dhcp_got_option(dhcp, idx) (dhcp_rx_options_given[idx] = 1) +#define dhcp_clear_option(dhcp, idx) (dhcp_rx_options_given[idx] = 0) +#define dhcp_clear_all_options(dhcp) (memset(dhcp_rx_options_given, 0, sizeof(dhcp_rx_options_given))) +#define dhcp_get_option_value(dhcp, idx) (dhcp_rx_options_val[idx]) +#define dhcp_set_option_value(dhcp, idx, val) (dhcp_rx_options_val[idx] = (val)) + + +/* DHCP client state machine functions */ +static err_t dhcp_discover(struct netif *netif); +static err_t dhcp_select(struct netif *netif); +static void dhcp_bind(struct netif *netif); +#if DHCP_DOES_ARP_CHECK +static err_t dhcp_decline(struct netif *netif); +#endif /* DHCP_DOES_ARP_CHECK */ +static err_t dhcp_rebind(struct netif *netif); +static err_t dhcp_reboot(struct netif *netif); +static void dhcp_set_state(struct dhcp *dhcp, u8_t new_state); + +/* receive, unfold, parse and free incoming messages */ +static void dhcp_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p, ip_addr_t *addr, u16_t port); + +/* set the DHCP timers */ +static void dhcp_timeout(struct netif *netif); +static void dhcp_t1_timeout(struct netif *netif); +static void dhcp_t2_timeout(struct netif *netif); + +/* build outgoing messages */ +/* create a DHCP message, fill in common headers */ +static err_t dhcp_create_msg(struct netif *netif, struct dhcp *dhcp, u8_t message_type); +/* free a DHCP request */ +static void dhcp_delete_msg(struct dhcp *dhcp); +/* add a DHCP option (type, then length in bytes) */ +static void dhcp_option(struct dhcp *dhcp, u8_t option_type, u8_t option_len); +/* add option values */ +static void dhcp_option_byte(struct dhcp *dhcp, u8_t value); +static void dhcp_option_short(struct dhcp *dhcp, u16_t value); +static void dhcp_option_long(struct dhcp *dhcp, u32_t value); +/* always add the DHCP options trailer to end and pad */ +static void dhcp_option_trailer(struct dhcp *dhcp); + +/** + * Back-off the DHCP client (because of a received NAK response). + * + * Back-off the DHCP client because of a received NAK. Receiving a + * NAK means the client asked for something non-sensible, for + * example when it tries to renew a lease obtained on another network. + * + * We clear any existing set IP address and restart DHCP negotiation + * afresh (as per RFC2131 3.2.3). + * + * @param netif the netif under DHCP control + */ +static void +dhcp_handle_nak(struct netif *netif) +{ + struct dhcp *dhcp = netif->dhcp; + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_handle_nak(netif=%p) %c%c%"U16_F"\n", + (void*)netif, netif->name[0], netif->name[1], (u16_t)netif->num)); + /* Set the interface down since the address must no longer be used, as per RFC2131 */ + netif_set_down(netif); + /* remove IP address from interface */ + netif_set_ipaddr(netif, IP_ADDR_ANY); + netif_set_gw(netif, IP_ADDR_ANY); + netif_set_netmask(netif, IP_ADDR_ANY); + /* Change to a defined state */ + dhcp_set_state(dhcp, DHCP_BACKING_OFF); + /* We can immediately restart discovery */ + dhcp_discover(netif); +} + +#if DHCP_DOES_ARP_CHECK +/** + * Checks if the offered IP address is already in use. + * + * It does so by sending an ARP request for the offered address and + * entering CHECKING state. If no ARP reply is received within a small + * interval, the address is assumed to be free for use by us. + * + * @param netif the netif under DHCP control + */ +static void +dhcp_check(struct netif *netif) +{ + struct dhcp *dhcp = netif->dhcp; + err_t result; + u16_t msecs; + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_check(netif=%p) %c%c\n", (void *)netif, (s16_t)netif->name[0], + (s16_t)netif->name[1])); + dhcp_set_state(dhcp, DHCP_CHECKING); + /* create an ARP query for the offered IP address, expecting that no host + responds, as the IP address should not be in use. */ + result = etharp_query(netif, &dhcp->offered_ip_addr, NULL); + if (result != ERR_OK) { + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_LEVEL_WARNING, ("dhcp_check: could not perform ARP query\n")); + } + dhcp->tries++; + msecs = 500; + dhcp->request_timeout = (msecs + DHCP_FINE_TIMER_MSECS - 1) / DHCP_FINE_TIMER_MSECS; + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("dhcp_check(): set request timeout %"U16_F" msecs\n", msecs)); +} +#endif /* DHCP_DOES_ARP_CHECK */ + +/** + * Remember the configuration offered by a DHCP server. + * + * @param netif the netif under DHCP control + */ +static void +dhcp_handle_offer(struct netif *netif) +{ + struct dhcp *dhcp = netif->dhcp; + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_handle_offer(netif=%p) %c%c%"U16_F"\n", + (void*)netif, netif->name[0], netif->name[1], (u16_t)netif->num)); + /* obtain the server address */ + if (dhcp_option_given(dhcp, DHCP_OPTION_IDX_SERVER_ID)) { + ip4_addr_set_u32(&dhcp->server_ip_addr, htonl(dhcp_get_option_value(dhcp, DHCP_OPTION_IDX_SERVER_ID))); + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_STATE, ("dhcp_handle_offer(): server 0x%08"X32_F"\n", + ip4_addr_get_u32(&dhcp->server_ip_addr))); + /* remember offered address */ + ip_addr_copy(dhcp->offered_ip_addr, dhcp->msg_in->yiaddr); + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_STATE, ("dhcp_handle_offer(): offer for 0x%08"X32_F"\n", + ip4_addr_get_u32(&dhcp->offered_ip_addr))); + + dhcp_select(netif); + } else { + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_LEVEL_SERIOUS, + ("dhcp_handle_offer(netif=%p) did not get server ID!\n", (void*)netif)); + } +} + +/** + * Select a DHCP server offer out of all offers. + * + * Simply select the first offer received. + * + * @param netif the netif under DHCP control + * @return lwIP specific error (see error.h) + */ +static err_t +dhcp_select(struct netif *netif) +{ + struct dhcp *dhcp = netif->dhcp; + err_t result; + u16_t msecs; + + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_select(netif=%p) %c%c%"U16_F"\n", (void*)netif, netif->name[0], netif->name[1], (u16_t)netif->num)); + dhcp_set_state(dhcp, DHCP_REQUESTING); + + /* create and initialize the DHCP message header */ + result = dhcp_create_msg(netif, dhcp, DHCP_REQUEST); + if (result == ERR_OK) { + dhcp_option(dhcp, DHCP_OPTION_MAX_MSG_SIZE, DHCP_OPTION_MAX_MSG_SIZE_LEN); + dhcp_option_short(dhcp, DHCP_MAX_MSG_LEN(netif)); + + /* MUST request the offered IP address */ + dhcp_option(dhcp, DHCP_OPTION_REQUESTED_IP, 4); + dhcp_option_long(dhcp, ntohl(ip4_addr_get_u32(&dhcp->offered_ip_addr))); + + dhcp_option(dhcp, DHCP_OPTION_SERVER_ID, 4); + dhcp_option_long(dhcp, ntohl(ip4_addr_get_u32(&dhcp->server_ip_addr))); + + dhcp_option(dhcp, DHCP_OPTION_PARAMETER_REQUEST_LIST, 4/*num options*/); + dhcp_option_byte(dhcp, DHCP_OPTION_SUBNET_MASK); + dhcp_option_byte(dhcp, DHCP_OPTION_ROUTER); + dhcp_option_byte(dhcp, DHCP_OPTION_BROADCAST); + dhcp_option_byte(dhcp, DHCP_OPTION_DNS_SERVER); + +#if LWIP_NETIF_HOSTNAME + if (netif->hostname != NULL) { + const char *p = (const char*)netif->hostname; + u8_t namelen = (u8_t)strlen(p); + if (namelen > 0) { + LWIP_ASSERT("DHCP: hostname is too long!", namelen < 255); + dhcp_option(dhcp, DHCP_OPTION_HOSTNAME, namelen); + while (*p) { + dhcp_option_byte(dhcp, *p++); + } + } + } +#endif /* LWIP_NETIF_HOSTNAME */ + + dhcp_option_trailer(dhcp); + /* shrink the pbuf to the actual content length */ + pbuf_realloc(dhcp->p_out, sizeof(struct dhcp_msg) - DHCP_OPTIONS_LEN + dhcp->options_out_len); + + /* send broadcast to any DHCP server */ + udp_sendto_if(dhcp->pcb, dhcp->p_out, IP_ADDR_BROADCAST, DHCP_SERVER_PORT, netif); + dhcp_delete_msg(dhcp); + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("dhcp_select: REQUESTING\n")); + } else { + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_LEVEL_WARNING, ("dhcp_select: could not allocate DHCP request\n")); + } + dhcp->tries++; + msecs = (dhcp->tries < 6 ? 1 << dhcp->tries : 60) * 1000; + dhcp->request_timeout = (msecs + DHCP_FINE_TIMER_MSECS - 1) / DHCP_FINE_TIMER_MSECS; + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_STATE, ("dhcp_select(): set request timeout %"U16_F" msecs\n", msecs)); + return result; +} + +/** + * The DHCP timer that checks for lease renewal/rebind timeouts. + */ +void +dhcp_coarse_tmr() +{ + struct netif *netif = netif_list; + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_coarse_tmr()\n")); + /* iterate through all network interfaces */ + while (netif != NULL) { + /* only act on DHCP configured interfaces */ + if (netif->dhcp != NULL) { + /* timer is active (non zero), and triggers (zeroes) now? */ + if (netif->dhcp->t2_timeout-- == 1) { + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("dhcp_coarse_tmr(): t2 timeout\n")); + /* this clients' rebind timeout triggered */ + dhcp_t2_timeout(netif); + /* timer is active (non zero), and triggers (zeroes) now */ + } else if (netif->dhcp->t1_timeout-- == 1) { + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("dhcp_coarse_tmr(): t1 timeout\n")); + /* this clients' renewal timeout triggered */ + dhcp_t1_timeout(netif); + } + } + /* proceed to next netif */ + netif = netif->next; + } +} + +/** + * DHCP transaction timeout handling + * + * A DHCP server is expected to respond within a short period of time. + * This timer checks whether an outstanding DHCP request is timed out. + */ +void +dhcp_fine_tmr() +{ + struct netif *netif = netif_list; + /* loop through netif's */ + while (netif != NULL) { + /* only act on DHCP configured interfaces */ + if (netif->dhcp != NULL) { + /* timer is active (non zero), and is about to trigger now */ + if (netif->dhcp->request_timeout > 1) { + netif->dhcp->request_timeout--; + } + else if (netif->dhcp->request_timeout == 1) { + netif->dhcp->request_timeout--; + /* { netif->dhcp->request_timeout == 0 } */ + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("dhcp_fine_tmr(): request timeout\n")); + /* this client's request timeout triggered */ + dhcp_timeout(netif); + } + } + /* proceed to next network interface */ + netif = netif->next; + } +} + +/** + * A DHCP negotiation transaction, or ARP request, has timed out. + * + * The timer that was started with the DHCP or ARP request has + * timed out, indicating no response was received in time. + * + * @param netif the netif under DHCP control + */ +static void +dhcp_timeout(struct netif *netif) +{ + struct dhcp *dhcp = netif->dhcp; + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_timeout()\n")); + /* back-off period has passed, or server selection timed out */ + if ((dhcp->state == DHCP_BACKING_OFF) || (dhcp->state == DHCP_SELECTING)) { + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_timeout(): restarting discovery\n")); + dhcp_discover(netif); + /* receiving the requested lease timed out */ + } else if (dhcp->state == DHCP_REQUESTING) { + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("dhcp_timeout(): REQUESTING, DHCP request timed out\n")); + if (dhcp->tries <= 5) { + dhcp_select(netif); + } else { + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("dhcp_timeout(): REQUESTING, releasing, restarting\n")); + dhcp_release(netif); + dhcp_discover(netif); + } +#if DHCP_DOES_ARP_CHECK + /* received no ARP reply for the offered address (which is good) */ + } else if (dhcp->state == DHCP_CHECKING) { + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("dhcp_timeout(): CHECKING, ARP request timed out\n")); + if (dhcp->tries <= 1) { + dhcp_check(netif); + /* no ARP replies on the offered address, + looks like the IP address is indeed free */ + } else { + /* bind the interface to the offered address */ + dhcp_bind(netif); + } +#endif /* DHCP_DOES_ARP_CHECK */ + } + /* did not get response to renew request? */ + else if (dhcp->state == DHCP_RENEWING) { + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("dhcp_timeout(): RENEWING, DHCP request timed out\n")); + /* just retry renewal */ + /* note that the rebind timer will eventually time-out if renew does not work */ + dhcp_renew(netif); + /* did not get response to rebind request? */ + } else if (dhcp->state == DHCP_REBINDING) { + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("dhcp_timeout(): REBINDING, DHCP request timed out\n")); + if (dhcp->tries <= 8) { + dhcp_rebind(netif); + } else { + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("dhcp_timeout(): RELEASING, DISCOVERING\n")); + dhcp_release(netif); + dhcp_discover(netif); + } + } else if (dhcp->state == DHCP_REBOOTING) { + if (dhcp->tries < REBOOT_TRIES) { + dhcp_reboot(netif); + } else { + dhcp_discover(netif); + } + } +} + +/** + * The renewal period has timed out. + * + * @param netif the netif under DHCP control + */ +static void +dhcp_t1_timeout(struct netif *netif) +{ + struct dhcp *dhcp = netif->dhcp; + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_STATE, ("dhcp_t1_timeout()\n")); + if ((dhcp->state == DHCP_REQUESTING) || (dhcp->state == DHCP_BOUND) || + (dhcp->state == DHCP_RENEWING)) { + /* just retry to renew - note that the rebind timer (t2) will + * eventually time-out if renew tries fail. */ + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, + ("dhcp_t1_timeout(): must renew\n")); + /* This slightly different to RFC2131: DHCPREQUEST will be sent from state + DHCP_RENEWING, not DHCP_BOUND */ + dhcp_renew(netif); + } +} + +/** + * The rebind period has timed out. + * + * @param netif the netif under DHCP control + */ +static void +dhcp_t2_timeout(struct netif *netif) +{ + struct dhcp *dhcp = netif->dhcp; + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("dhcp_t2_timeout()\n")); + if ((dhcp->state == DHCP_REQUESTING) || (dhcp->state == DHCP_BOUND) || + (dhcp->state == DHCP_RENEWING)) { + /* just retry to rebind */ + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, + ("dhcp_t2_timeout(): must rebind\n")); + /* This slightly different to RFC2131: DHCPREQUEST will be sent from state + DHCP_REBINDING, not DHCP_BOUND */ + dhcp_rebind(netif); + } +} + +/** + * Handle a DHCP ACK packet + * + * @param netif the netif under DHCP control + */ +static void +dhcp_handle_ack(struct netif *netif) +{ + struct dhcp *dhcp = netif->dhcp; +#if LWIP_DNS + u8_t n; +#endif /* LWIP_DNS */ + + /* clear options we might not get from the ACK */ + ip_addr_set_zero(&dhcp->offered_sn_mask); + ip_addr_set_zero(&dhcp->offered_gw_addr); +#if LWIP_DHCP_BOOTP_FILE + ip_addr_set_zero(&dhcp->offered_si_addr); +#endif /* LWIP_DHCP_BOOTP_FILE */ + + /* lease time given? */ + if (dhcp_option_given(dhcp, DHCP_OPTION_IDX_LEASE_TIME)) { + /* remember offered lease time */ + dhcp->offered_t0_lease = dhcp_get_option_value(dhcp, DHCP_OPTION_IDX_LEASE_TIME); + } + /* renewal period given? */ + if (dhcp_option_given(dhcp, DHCP_OPTION_IDX_T1)) { + /* remember given renewal period */ + dhcp->offered_t1_renew = dhcp_get_option_value(dhcp, DHCP_OPTION_IDX_T1); + } else { + /* calculate safe periods for renewal */ + dhcp->offered_t1_renew = dhcp->offered_t0_lease / 2; + } + + /* renewal period given? */ + if (dhcp_option_given(dhcp, DHCP_OPTION_IDX_T2)) { + /* remember given rebind period */ + dhcp->offered_t2_rebind = dhcp_get_option_value(dhcp, DHCP_OPTION_IDX_T2); + } else { + /* calculate safe periods for rebinding */ + dhcp->offered_t2_rebind = dhcp->offered_t0_lease; + } + + /* (y)our internet address */ + ip_addr_copy(dhcp->offered_ip_addr, dhcp->msg_in->yiaddr); + +#if LWIP_DHCP_BOOTP_FILE + /* copy boot server address, + boot file name copied in dhcp_parse_reply if not overloaded */ + ip_addr_copy(dhcp->offered_si_addr, dhcp->msg_in->siaddr); +#endif /* LWIP_DHCP_BOOTP_FILE */ + + /* subnet mask given? */ + if (dhcp_option_given(dhcp, DHCP_OPTION_IDX_SUBNET_MASK)) { + /* remember given subnet mask */ + ip4_addr_set_u32(&dhcp->offered_sn_mask, htonl(dhcp_get_option_value(dhcp, DHCP_OPTION_IDX_SUBNET_MASK))); + dhcp->subnet_mask_given = 1; + } else { + dhcp->subnet_mask_given = 0; + } + + /* gateway router */ + if (dhcp_option_given(dhcp, DHCP_OPTION_IDX_ROUTER)) { + ip4_addr_set_u32(&dhcp->offered_gw_addr, htonl(dhcp_get_option_value(dhcp, DHCP_OPTION_IDX_ROUTER))); + } + +#if LWIP_DNS + /* DNS servers */ + n = 0; + while(dhcp_option_given(dhcp, DHCP_OPTION_IDX_DNS_SERVER + n) && (n < DNS_MAX_SERVERS)) { + ip_addr_t dns_addr; + ip4_addr_set_u32(&dns_addr, htonl(dhcp_get_option_value(dhcp, DHCP_OPTION_IDX_DNS_SERVER + n))); + dns_setserver(n, &dns_addr); + n++; + } +#endif /* LWIP_DNS */ +} + +/** Set a statically allocated struct dhcp to work with. + * Using this prevents dhcp_start to allocate it using mem_malloc. + * + * @param netif the netif for which to set the struct dhcp + * @param dhcp (uninitialised) dhcp struct allocated by the application + */ +void +dhcp_set_struct(struct netif *netif, struct dhcp *dhcp) +{ + LWIP_ASSERT("netif != NULL", netif != NULL); + LWIP_ASSERT("dhcp != NULL", dhcp != NULL); + LWIP_ASSERT("netif already has a struct dhcp set", netif->dhcp == NULL); + + /* clear data structure */ + memset(dhcp, 0, sizeof(struct dhcp)); + /* dhcp_set_state(&dhcp, DHCP_OFF); */ + netif->dhcp = dhcp; +} + +/** Removes a struct dhcp from a netif. + * + * ATTENTION: Only use this when not using dhcp_set_struct() to allocate the + * struct dhcp since the memory is passed back to the heap. + * + * @param netif the netif from which to remove the struct dhcp + */ +void dhcp_cleanup(struct netif *netif) +{ + LWIP_ASSERT("netif != NULL", netif != NULL); + + if (netif->dhcp != NULL) { + mem_free(netif->dhcp); + netif->dhcp = NULL; + } +} + +/** + * Start DHCP negotiation for a network interface. + * + * If no DHCP client instance was attached to this interface, + * a new client is created first. If a DHCP client instance + * was already present, it restarts negotiation. + * + * @param netif The lwIP network interface + * @return lwIP error code + * - ERR_OK - No error + * - ERR_MEM - Out of memory + */ +err_t +dhcp_start(struct netif *netif) +{ + struct dhcp *dhcp; + err_t result = ERR_OK; + + LWIP_ERROR("netif != NULL", (netif != NULL), return ERR_ARG;); + dhcp = netif->dhcp; + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("dhcp_start(netif=%p) %c%c%"U16_F"\n", (void*)netif, netif->name[0], netif->name[1], (u16_t)netif->num)); + /* Remove the flag that says this netif is handled by DHCP, + it is set when we succeeded starting. */ + netif->flags &= ~NETIF_FLAG_DHCP; + + /* check hwtype of the netif */ + if ((netif->flags & NETIF_FLAG_ETHARP) == 0) { + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_start(): No ETHARP netif\n")); + return ERR_ARG; + } + + /* check MTU of the netif */ + if (netif->mtu < DHCP_MAX_MSG_LEN_MIN_REQUIRED) { + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_start(): Cannot use this netif with DHCP: MTU is too small\n")); + return ERR_MEM; + } + + /* no DHCP client attached yet? */ + if (dhcp == NULL) { + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_start(): starting new DHCP client\n")); + dhcp = (struct dhcp *)mem_malloc(sizeof(struct dhcp)); + if (dhcp == NULL) { + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_start(): could not allocate dhcp\n")); + return ERR_MEM; + } + /* store this dhcp client in the netif */ + netif->dhcp = dhcp; + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_start(): allocated dhcp")); + /* already has DHCP client attached */ + } else { + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("dhcp_start(): restarting DHCP configuration\n")); + if (dhcp->pcb != NULL) { + udp_remove(dhcp->pcb); + } + LWIP_ASSERT("pbuf p_out wasn't freed", dhcp->p_out == NULL); + LWIP_ASSERT("reply wasn't freed", dhcp->msg_in == NULL ); + } + + /* clear data structure */ + memset(dhcp, 0, sizeof(struct dhcp)); + /* dhcp_set_state(&dhcp, DHCP_OFF); */ + /* allocate UDP PCB */ + dhcp->pcb = udp_new(); + if (dhcp->pcb == NULL) { + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_start(): could not obtain pcb\n")); + return ERR_MEM; + } + dhcp->pcb->so_options |= SOF_BROADCAST; + /* set up local and remote port for the pcb */ + udp_bind(dhcp->pcb, IP_ADDR_ANY, DHCP_CLIENT_PORT); + udp_connect(dhcp->pcb, IP_ADDR_ANY, DHCP_SERVER_PORT); + /* set up the recv callback and argument */ + udp_recv(dhcp->pcb, dhcp_recv, netif); + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_start(): starting DHCP configuration\n")); + /* (re)start the DHCP negotiation */ + result = dhcp_discover(netif); + if (result != ERR_OK) { + /* free resources allocated above */ + dhcp_stop(netif); + return ERR_MEM; + } + /* Set the flag that says this netif is handled by DHCP. */ + netif->flags |= NETIF_FLAG_DHCP; + return result; +} + +/** + * Inform a DHCP server of our manual configuration. + * + * This informs DHCP servers of our fixed IP address configuration + * by sending an INFORM message. It does not involve DHCP address + * configuration, it is just here to be nice to the network. + * + * @param netif The lwIP network interface + */ +void +dhcp_inform(struct netif *netif) +{ + struct dhcp dhcp; + err_t result = ERR_OK; + struct udp_pcb *pcb; + + LWIP_ERROR("netif != NULL", (netif != NULL), return;); + + memset(&dhcp, 0, sizeof(struct dhcp)); + dhcp_set_state(&dhcp, DHCP_INFORM); + + if ((netif->dhcp != NULL) && (netif->dhcp->pcb != NULL)) { + /* re-use existing pcb */ + pcb = netif->dhcp->pcb; + } else { + pcb = udp_new(); + if (pcb == NULL) { + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_LEVEL_SERIOUS, ("dhcp_inform(): could not obtain pcb")); + return; + } + dhcp.pcb = pcb; + dhcp.pcb->so_options |= SOF_BROADCAST; + udp_bind(dhcp.pcb, IP_ADDR_ANY, DHCP_CLIENT_PORT); + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_inform(): created new udp pcb\n")); + } + /* create and initialize the DHCP message header */ + result = dhcp_create_msg(netif, &dhcp, DHCP_INFORM); + if (result == ERR_OK) { + dhcp_option(&dhcp, DHCP_OPTION_MAX_MSG_SIZE, DHCP_OPTION_MAX_MSG_SIZE_LEN); + dhcp_option_short(&dhcp, DHCP_MAX_MSG_LEN(netif)); + + dhcp_option_trailer(&dhcp); + + pbuf_realloc(dhcp.p_out, sizeof(struct dhcp_msg) - DHCP_OPTIONS_LEN + dhcp.options_out_len); + + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("dhcp_inform: INFORMING\n")); + udp_sendto_if(pcb, dhcp.p_out, IP_ADDR_BROADCAST, DHCP_SERVER_PORT, netif); + dhcp_delete_msg(&dhcp); + } else { + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_LEVEL_SERIOUS, ("dhcp_inform: could not allocate DHCP request\n")); + } + + if (dhcp.pcb != NULL) { + /* otherwise, the existing pcb was used */ + udp_remove(dhcp.pcb); + } +} + +/** Handle a possible change in the network configuration. + * + * This enters the REBOOTING state to verify that the currently bound + * address is still valid. + */ +void +dhcp_network_changed(struct netif *netif) +{ + struct dhcp *dhcp = netif->dhcp; + if (!dhcp) + return; + switch (dhcp->state) { + case DHCP_REBINDING: + case DHCP_RENEWING: + case DHCP_BOUND: + case DHCP_REBOOTING: + netif_set_down(netif); + dhcp->tries = 0; + dhcp_reboot(netif); + break; + case DHCP_OFF: + /* stay off */ + break; + default: + dhcp->tries = 0; +#if LWIP_DHCP_AUTOIP_COOP + if(dhcp->autoip_coop_state == DHCP_AUTOIP_COOP_STATE_ON) { + autoip_stop(netif); + dhcp->autoip_coop_state = DHCP_AUTOIP_COOP_STATE_OFF; + } +#endif /* LWIP_DHCP_AUTOIP_COOP */ + dhcp_discover(netif); + break; + } +} + +#if DHCP_DOES_ARP_CHECK +/** + * Match an ARP reply with the offered IP address. + * + * @param netif the network interface on which the reply was received + * @param addr The IP address we received a reply from + */ +void dhcp_arp_reply(struct netif *netif, ip_addr_t *addr) +{ + LWIP_ERROR("netif != NULL", (netif != NULL), return;); + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_arp_reply()\n")); + /* is a DHCP client doing an ARP check? */ + if ((netif->dhcp != NULL) && (netif->dhcp->state == DHCP_CHECKING)) { + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("dhcp_arp_reply(): CHECKING, arp reply for 0x%08"X32_F"\n", + ip4_addr_get_u32(addr))); + /* did a host respond with the address we + were offered by the DHCP server? */ + if (ip_addr_cmp(addr, &netif->dhcp->offered_ip_addr)) { + /* we will not accept the offered address */ + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE | LWIP_DBG_LEVEL_WARNING, + ("dhcp_arp_reply(): arp reply matched with offered address, declining\n")); + dhcp_decline(netif); + } + } +} + +/** + * Decline an offered lease. + * + * Tell the DHCP server we do not accept the offered address. + * One reason to decline the lease is when we find out the address + * is already in use by another host (through ARP). + * + * @param netif the netif under DHCP control + */ +static err_t +dhcp_decline(struct netif *netif) +{ + struct dhcp *dhcp = netif->dhcp; + err_t result = ERR_OK; + u16_t msecs; + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_decline()\n")); + dhcp_set_state(dhcp, DHCP_BACKING_OFF); + /* create and initialize the DHCP message header */ + result = dhcp_create_msg(netif, dhcp, DHCP_DECLINE); + if (result == ERR_OK) { + dhcp_option(dhcp, DHCP_OPTION_REQUESTED_IP, 4); + dhcp_option_long(dhcp, ntohl(ip4_addr_get_u32(&dhcp->offered_ip_addr))); + + dhcp_option_trailer(dhcp); + /* resize pbuf to reflect true size of options */ + pbuf_realloc(dhcp->p_out, sizeof(struct dhcp_msg) - DHCP_OPTIONS_LEN + dhcp->options_out_len); + + /* per section 4.4.4, broadcast DECLINE messages */ + udp_sendto_if(dhcp->pcb, dhcp->p_out, IP_ADDR_BROADCAST, DHCP_SERVER_PORT, netif); + dhcp_delete_msg(dhcp); + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("dhcp_decline: BACKING OFF\n")); + } else { + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_LEVEL_SERIOUS, + ("dhcp_decline: could not allocate DHCP request\n")); + } + dhcp->tries++; + msecs = 10*1000; + dhcp->request_timeout = (msecs + DHCP_FINE_TIMER_MSECS - 1) / DHCP_FINE_TIMER_MSECS; + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_decline(): set request timeout %"U16_F" msecs\n", msecs)); + return result; +} +#endif /* DHCP_DOES_ARP_CHECK */ + + +/** + * Start the DHCP process, discover a DHCP server. + * + * @param netif the netif under DHCP control + */ +static err_t +dhcp_discover(struct netif *netif) +{ + struct dhcp *dhcp = netif->dhcp; + err_t result = ERR_OK; + u16_t msecs; + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_discover()\n")); + ip_addr_set_any(&dhcp->offered_ip_addr); + dhcp_set_state(dhcp, DHCP_SELECTING); + /* create and initialize the DHCP message header */ + result = dhcp_create_msg(netif, dhcp, DHCP_DISCOVER); + if (result == ERR_OK) { + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_discover: making request\n")); + + dhcp_option(dhcp, DHCP_OPTION_MAX_MSG_SIZE, DHCP_OPTION_MAX_MSG_SIZE_LEN); + dhcp_option_short(dhcp, DHCP_MAX_MSG_LEN(netif)); + + dhcp_option(dhcp, DHCP_OPTION_PARAMETER_REQUEST_LIST, 4/*num options*/); + dhcp_option_byte(dhcp, DHCP_OPTION_SUBNET_MASK); + dhcp_option_byte(dhcp, DHCP_OPTION_ROUTER); + dhcp_option_byte(dhcp, DHCP_OPTION_BROADCAST); + dhcp_option_byte(dhcp, DHCP_OPTION_DNS_SERVER); + + dhcp_option_trailer(dhcp); + + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_discover: realloc()ing\n")); + pbuf_realloc(dhcp->p_out, sizeof(struct dhcp_msg) - DHCP_OPTIONS_LEN + dhcp->options_out_len); + + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_discover: sendto(DISCOVER, IP_ADDR_BROADCAST, DHCP_SERVER_PORT)\n")); + udp_sendto_if(dhcp->pcb, dhcp->p_out, IP_ADDR_BROADCAST, DHCP_SERVER_PORT, netif); + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_discover: deleting()ing\n")); + dhcp_delete_msg(dhcp); + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("dhcp_discover: SELECTING\n")); + } else { + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_LEVEL_SERIOUS, ("dhcp_discover: could not allocate DHCP request\n")); + } + dhcp->tries++; +#if LWIP_DHCP_AUTOIP_COOP + if(dhcp->tries >= LWIP_DHCP_AUTOIP_COOP_TRIES && dhcp->autoip_coop_state == DHCP_AUTOIP_COOP_STATE_OFF) { + dhcp->autoip_coop_state = DHCP_AUTOIP_COOP_STATE_ON; + autoip_start(netif); + } +#endif /* LWIP_DHCP_AUTOIP_COOP */ + msecs = (dhcp->tries < 6 ? 1 << dhcp->tries : 60) * 1000; + dhcp->request_timeout = (msecs + DHCP_FINE_TIMER_MSECS - 1) / DHCP_FINE_TIMER_MSECS; + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("dhcp_discover(): set request timeout %"U16_F" msecs\n", msecs)); + return result; +} + + +/** + * Bind the interface to the offered IP address. + * + * @param netif network interface to bind to the offered address + */ +static void +dhcp_bind(struct netif *netif) +{ + u32_t timeout; + struct dhcp *dhcp; + ip_addr_t sn_mask, gw_addr; + LWIP_ERROR("dhcp_bind: netif != NULL", (netif != NULL), return;); + dhcp = netif->dhcp; + LWIP_ERROR("dhcp_bind: dhcp != NULL", (dhcp != NULL), return;); + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_bind(netif=%p) %c%c%"U16_F"\n", (void*)netif, netif->name[0], netif->name[1], (u16_t)netif->num)); + + /* temporary DHCP lease? */ + if (dhcp->offered_t1_renew != 0xffffffffUL) { + /* set renewal period timer */ + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_bind(): t1 renewal timer %"U32_F" secs\n", dhcp->offered_t1_renew)); + timeout = (dhcp->offered_t1_renew + DHCP_COARSE_TIMER_SECS / 2) / DHCP_COARSE_TIMER_SECS; + if(timeout > 0xffff) { + timeout = 0xffff; + } + dhcp->t1_timeout = (u16_t)timeout; + if (dhcp->t1_timeout == 0) { + dhcp->t1_timeout = 1; + } + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("dhcp_bind(): set request timeout %"U32_F" msecs\n", dhcp->offered_t1_renew*1000)); + } + /* set renewal period timer */ + if (dhcp->offered_t2_rebind != 0xffffffffUL) { + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_bind(): t2 rebind timer %"U32_F" secs\n", dhcp->offered_t2_rebind)); + timeout = (dhcp->offered_t2_rebind + DHCP_COARSE_TIMER_SECS / 2) / DHCP_COARSE_TIMER_SECS; + if(timeout > 0xffff) { + timeout = 0xffff; + } + dhcp->t2_timeout = (u16_t)timeout; + if (dhcp->t2_timeout == 0) { + dhcp->t2_timeout = 1; + } + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("dhcp_bind(): set request timeout %"U32_F" msecs\n", dhcp->offered_t2_rebind*1000)); + } + + if (dhcp->subnet_mask_given) { + /* copy offered network mask */ + ip_addr_copy(sn_mask, dhcp->offered_sn_mask); + } else { + /* subnet mask not given, choose a safe subnet mask given the network class */ + u8_t first_octet = ip4_addr1(&dhcp->offered_ip_addr); + if (first_octet <= 127) { + ip4_addr_set_u32(&sn_mask, PP_HTONL(0xff000000UL)); + } else if (first_octet >= 192) { + ip4_addr_set_u32(&sn_mask, PP_HTONL(0xffffff00UL)); + } else { + ip4_addr_set_u32(&sn_mask, PP_HTONL(0xffff0000UL)); + } + } + + ip_addr_copy(gw_addr, dhcp->offered_gw_addr); + /* gateway address not given? */ + if (ip_addr_isany(&gw_addr)) { + /* copy network address */ + ip_addr_get_network(&gw_addr, &dhcp->offered_ip_addr, &sn_mask); + /* use first host address on network as gateway */ + ip4_addr_set_u32(&gw_addr, ip4_addr_get_u32(&gw_addr) | PP_HTONL(0x00000001UL)); + } + +#if LWIP_DHCP_AUTOIP_COOP + if(dhcp->autoip_coop_state == DHCP_AUTOIP_COOP_STATE_ON) { + autoip_stop(netif); + dhcp->autoip_coop_state = DHCP_AUTOIP_COOP_STATE_OFF; + } +#endif /* LWIP_DHCP_AUTOIP_COOP */ + + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_STATE, ("dhcp_bind(): IP: 0x%08"X32_F"\n", + ip4_addr_get_u32(&dhcp->offered_ip_addr))); + netif_set_ipaddr(netif, &dhcp->offered_ip_addr); + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_STATE, ("dhcp_bind(): SN: 0x%08"X32_F"\n", + ip4_addr_get_u32(&sn_mask))); + netif_set_netmask(netif, &sn_mask); + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_STATE, ("dhcp_bind(): GW: 0x%08"X32_F"\n", + ip4_addr_get_u32(&gw_addr))); + netif_set_gw(netif, &gw_addr); + /* bring the interface up */ + netif_set_up(netif); + /* netif is now bound to DHCP leased address */ + dhcp_set_state(dhcp, DHCP_BOUND); +} + +/** + * Renew an existing DHCP lease at the involved DHCP server. + * + * @param netif network interface which must renew its lease + */ +err_t +dhcp_renew(struct netif *netif) +{ + struct dhcp *dhcp = netif->dhcp; + err_t result; + u16_t msecs; + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_renew()\n")); + dhcp_set_state(dhcp, DHCP_RENEWING); + + /* create and initialize the DHCP message header */ + result = dhcp_create_msg(netif, dhcp, DHCP_REQUEST); + if (result == ERR_OK) { + dhcp_option(dhcp, DHCP_OPTION_MAX_MSG_SIZE, DHCP_OPTION_MAX_MSG_SIZE_LEN); + dhcp_option_short(dhcp, DHCP_MAX_MSG_LEN(netif)); + +#if LWIP_NETIF_HOSTNAME + if (netif->hostname != NULL) { + const char *p = (const char*)netif->hostname; + u8_t namelen = (u8_t)strlen(p); + if (namelen > 0) { + LWIP_ASSERT("DHCP: hostname is too long!", namelen < 255); + dhcp_option(dhcp, DHCP_OPTION_HOSTNAME, namelen); + while (*p) { + dhcp_option_byte(dhcp, *p++); + } + } + } +#endif /* LWIP_NETIF_HOSTNAME */ + +#if 0 + dhcp_option(dhcp, DHCP_OPTION_REQUESTED_IP, 4); + dhcp_option_long(dhcp, ntohl(dhcp->offered_ip_addr.addr)); +#endif + +#if 0 + dhcp_option(dhcp, DHCP_OPTION_SERVER_ID, 4); + dhcp_option_long(dhcp, ntohl(dhcp->server_ip_addr.addr)); +#endif + /* append DHCP message trailer */ + dhcp_option_trailer(dhcp); + + pbuf_realloc(dhcp->p_out, sizeof(struct dhcp_msg) - DHCP_OPTIONS_LEN + dhcp->options_out_len); + + udp_sendto_if(dhcp->pcb, dhcp->p_out, &dhcp->server_ip_addr, DHCP_SERVER_PORT, netif); + dhcp_delete_msg(dhcp); + + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("dhcp_renew: RENEWING\n")); + } else { + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_LEVEL_SERIOUS, ("dhcp_renew: could not allocate DHCP request\n")); + } + dhcp->tries++; + /* back-off on retries, but to a maximum of 20 seconds */ + msecs = dhcp->tries < 10 ? dhcp->tries * 2000 : 20 * 1000; + dhcp->request_timeout = (msecs + DHCP_FINE_TIMER_MSECS - 1) / DHCP_FINE_TIMER_MSECS; + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("dhcp_renew(): set request timeout %"U16_F" msecs\n", msecs)); + return result; +} + +/** + * Rebind with a DHCP server for an existing DHCP lease. + * + * @param netif network interface which must rebind with a DHCP server + */ +static err_t +dhcp_rebind(struct netif *netif) +{ + struct dhcp *dhcp = netif->dhcp; + err_t result; + u16_t msecs; + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("dhcp_rebind()\n")); + dhcp_set_state(dhcp, DHCP_REBINDING); + + /* create and initialize the DHCP message header */ + result = dhcp_create_msg(netif, dhcp, DHCP_REQUEST); + if (result == ERR_OK) { + dhcp_option(dhcp, DHCP_OPTION_MAX_MSG_SIZE, DHCP_OPTION_MAX_MSG_SIZE_LEN); + dhcp_option_short(dhcp, DHCP_MAX_MSG_LEN(netif)); + +#if LWIP_NETIF_HOSTNAME + if (netif->hostname != NULL) { + const char *p = (const char*)netif->hostname; + u8_t namelen = (u8_t)strlen(p); + if (namelen > 0) { + LWIP_ASSERT("DHCP: hostname is too long!", namelen < 255); + dhcp_option(dhcp, DHCP_OPTION_HOSTNAME, namelen); + while (*p) { + dhcp_option_byte(dhcp, *p++); + } + } + } +#endif /* LWIP_NETIF_HOSTNAME */ + +#if 0 + dhcp_option(dhcp, DHCP_OPTION_REQUESTED_IP, 4); + dhcp_option_long(dhcp, ntohl(dhcp->offered_ip_addr.addr)); + + dhcp_option(dhcp, DHCP_OPTION_SERVER_ID, 4); + dhcp_option_long(dhcp, ntohl(dhcp->server_ip_addr.addr)); +#endif + + dhcp_option_trailer(dhcp); + + pbuf_realloc(dhcp->p_out, sizeof(struct dhcp_msg) - DHCP_OPTIONS_LEN + dhcp->options_out_len); + + /* broadcast to server */ + udp_sendto_if(dhcp->pcb, dhcp->p_out, IP_ADDR_BROADCAST, DHCP_SERVER_PORT, netif); + dhcp_delete_msg(dhcp); + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("dhcp_rebind: REBINDING\n")); + } else { + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_LEVEL_SERIOUS, ("dhcp_rebind: could not allocate DHCP request\n")); + } + dhcp->tries++; + msecs = dhcp->tries < 10 ? dhcp->tries * 1000 : 10 * 1000; + dhcp->request_timeout = (msecs + DHCP_FINE_TIMER_MSECS - 1) / DHCP_FINE_TIMER_MSECS; + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("dhcp_rebind(): set request timeout %"U16_F" msecs\n", msecs)); + return result; +} + +/** + * Enter REBOOTING state to verify an existing lease + * + * @param netif network interface which must reboot + */ +static err_t +dhcp_reboot(struct netif *netif) +{ + struct dhcp *dhcp = netif->dhcp; + err_t result; + u16_t msecs; + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("dhcp_reboot()\n")); + dhcp_set_state(dhcp, DHCP_REBOOTING); + + /* create and initialize the DHCP message header */ + result = dhcp_create_msg(netif, dhcp, DHCP_REQUEST); + if (result == ERR_OK) { + dhcp_option(dhcp, DHCP_OPTION_MAX_MSG_SIZE, DHCP_OPTION_MAX_MSG_SIZE_LEN); + dhcp_option_short(dhcp, 576); + + dhcp_option(dhcp, DHCP_OPTION_REQUESTED_IP, 4); + dhcp_option_long(dhcp, ntohl(ip4_addr_get_u32(&dhcp->offered_ip_addr))); + + dhcp_option_trailer(dhcp); + + pbuf_realloc(dhcp->p_out, sizeof(struct dhcp_msg) - DHCP_OPTIONS_LEN + dhcp->options_out_len); + + /* broadcast to server */ + udp_sendto_if(dhcp->pcb, dhcp->p_out, IP_ADDR_BROADCAST, DHCP_SERVER_PORT, netif); + dhcp_delete_msg(dhcp); + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("dhcp_reboot: REBOOTING\n")); + } else { + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_LEVEL_SERIOUS, ("dhcp_reboot: could not allocate DHCP request\n")); + } + dhcp->tries++; + msecs = dhcp->tries < 10 ? dhcp->tries * 1000 : 10 * 1000; + dhcp->request_timeout = (msecs + DHCP_FINE_TIMER_MSECS - 1) / DHCP_FINE_TIMER_MSECS; + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("dhcp_reboot(): set request timeout %"U16_F" msecs\n", msecs)); + return result; +} + + +/** + * Release a DHCP lease. + * + * @param netif network interface which must release its lease + */ +err_t +dhcp_release(struct netif *netif) +{ + struct dhcp *dhcp = netif->dhcp; + err_t result; + u16_t msecs; + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_release()\n")); + + /* idle DHCP client */ + dhcp_set_state(dhcp, DHCP_OFF); + /* clean old DHCP offer */ + ip_addr_set_zero(&dhcp->server_ip_addr); + ip_addr_set_zero(&dhcp->offered_ip_addr); + ip_addr_set_zero(&dhcp->offered_sn_mask); + ip_addr_set_zero(&dhcp->offered_gw_addr); +#if LWIP_DHCP_BOOTP_FILE + ip_addr_set_zero(&dhcp->offered_si_addr); +#endif /* LWIP_DHCP_BOOTP_FILE */ + dhcp->offered_t0_lease = dhcp->offered_t1_renew = dhcp->offered_t2_rebind = 0; + + /* create and initialize the DHCP message header */ + result = dhcp_create_msg(netif, dhcp, DHCP_RELEASE); + if (result == ERR_OK) { + dhcp_option_trailer(dhcp); + + pbuf_realloc(dhcp->p_out, sizeof(struct dhcp_msg) - DHCP_OPTIONS_LEN + dhcp->options_out_len); + + udp_sendto_if(dhcp->pcb, dhcp->p_out, &dhcp->server_ip_addr, DHCP_SERVER_PORT, netif); + dhcp_delete_msg(dhcp); + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("dhcp_release: RELEASED, DHCP_OFF\n")); + } else { + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_LEVEL_SERIOUS, ("dhcp_release: could not allocate DHCP request\n")); + } + dhcp->tries++; + msecs = dhcp->tries < 10 ? dhcp->tries * 1000 : 10 * 1000; + dhcp->request_timeout = (msecs + DHCP_FINE_TIMER_MSECS - 1) / DHCP_FINE_TIMER_MSECS; + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("dhcp_release(): set request timeout %"U16_F" msecs\n", msecs)); + /* bring the interface down */ + netif_set_down(netif); + /* remove IP address from interface */ + netif_set_ipaddr(netif, IP_ADDR_ANY); + netif_set_gw(netif, IP_ADDR_ANY); + netif_set_netmask(netif, IP_ADDR_ANY); + + return result; +} + +/** + * Remove the DHCP client from the interface. + * + * @param netif The network interface to stop DHCP on + */ +void +dhcp_stop(struct netif *netif) +{ + struct dhcp *dhcp; + LWIP_ERROR("dhcp_stop: netif != NULL", (netif != NULL), return;); + dhcp = netif->dhcp; + /* Remove the flag that says this netif is handled by DHCP. */ + netif->flags &= ~NETIF_FLAG_DHCP; + + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_stop()\n")); + /* netif is DHCP configured? */ + if (dhcp != NULL) { +#if LWIP_DHCP_AUTOIP_COOP + if(dhcp->autoip_coop_state == DHCP_AUTOIP_COOP_STATE_ON) { + autoip_stop(netif); + dhcp->autoip_coop_state = DHCP_AUTOIP_COOP_STATE_OFF; + } +#endif /* LWIP_DHCP_AUTOIP_COOP */ + + if (dhcp->pcb != NULL) { + udp_remove(dhcp->pcb); + dhcp->pcb = NULL; + } + LWIP_ASSERT("reply wasn't freed", dhcp->msg_in == NULL); + dhcp_set_state(dhcp, DHCP_OFF); + } +} + +/* + * Set the DHCP state of a DHCP client. + * + * If the state changed, reset the number of tries. + */ +static void +dhcp_set_state(struct dhcp *dhcp, u8_t new_state) +{ + if (new_state != dhcp->state) { + dhcp->state = new_state; + dhcp->tries = 0; + dhcp->request_timeout = 0; + } +} + +/* + * Concatenate an option type and length field to the outgoing + * DHCP message. + * + */ +static void +dhcp_option(struct dhcp *dhcp, u8_t option_type, u8_t option_len) +{ + LWIP_ASSERT("dhcp_option: dhcp->options_out_len + 2 + option_len <= DHCP_OPTIONS_LEN", dhcp->options_out_len + 2U + option_len <= DHCP_OPTIONS_LEN); + dhcp->msg_out->options[dhcp->options_out_len++] = option_type; + dhcp->msg_out->options[dhcp->options_out_len++] = option_len; +} +/* + * Concatenate a single byte to the outgoing DHCP message. + * + */ +static void +dhcp_option_byte(struct dhcp *dhcp, u8_t value) +{ + LWIP_ASSERT("dhcp_option_byte: dhcp->options_out_len < DHCP_OPTIONS_LEN", dhcp->options_out_len < DHCP_OPTIONS_LEN); + dhcp->msg_out->options[dhcp->options_out_len++] = value; +} + +static void +dhcp_option_short(struct dhcp *dhcp, u16_t value) +{ + LWIP_ASSERT("dhcp_option_short: dhcp->options_out_len + 2 <= DHCP_OPTIONS_LEN", dhcp->options_out_len + 2U <= DHCP_OPTIONS_LEN); + dhcp->msg_out->options[dhcp->options_out_len++] = (u8_t)((value & 0xff00U) >> 8); + dhcp->msg_out->options[dhcp->options_out_len++] = (u8_t) (value & 0x00ffU); +} + +static void +dhcp_option_long(struct dhcp *dhcp, u32_t value) +{ + LWIP_ASSERT("dhcp_option_long: dhcp->options_out_len + 4 <= DHCP_OPTIONS_LEN", dhcp->options_out_len + 4U <= DHCP_OPTIONS_LEN); + dhcp->msg_out->options[dhcp->options_out_len++] = (u8_t)((value & 0xff000000UL) >> 24); + dhcp->msg_out->options[dhcp->options_out_len++] = (u8_t)((value & 0x00ff0000UL) >> 16); + dhcp->msg_out->options[dhcp->options_out_len++] = (u8_t)((value & 0x0000ff00UL) >> 8); + dhcp->msg_out->options[dhcp->options_out_len++] = (u8_t)((value & 0x000000ffUL)); +} + +/** + * Extract the DHCP message and the DHCP options. + * + * Extract the DHCP message and the DHCP options, each into a contiguous + * piece of memory. As a DHCP message is variable sized by its options, + * and also allows overriding some fields for options, the easy approach + * is to first unfold the options into a conitguous piece of memory, and + * use that further on. + * + */ +static err_t +dhcp_parse_reply(struct dhcp *dhcp, struct pbuf *p) +{ + u8_t *options; + u16_t offset; + u16_t offset_max; + u16_t options_idx; + u16_t options_idx_max; + struct pbuf *q; + int parse_file_as_options = 0; + int parse_sname_as_options = 0; + + /* clear received options */ + dhcp_clear_all_options(dhcp); + /* check that beginning of dhcp_msg (up to and including chaddr) is in first pbuf */ + if (p->len < DHCP_SNAME_OFS) { + return ERR_BUF; + } + dhcp->msg_in = (struct dhcp_msg *)p->payload; +#if LWIP_DHCP_BOOTP_FILE + /* clear boot file name */ + dhcp->boot_file_name[0] = 0; +#endif /* LWIP_DHCP_BOOTP_FILE */ + + /* parse options */ + + /* start with options field */ + options_idx = DHCP_OPTIONS_OFS; + /* parse options to the end of the received packet */ + options_idx_max = p->tot_len; +again: + q = p; + while((q != NULL) && (options_idx >= q->len)) { + options_idx -= q->len; + options_idx_max -= q->len; + q = q->next; + } + if (q == NULL) { + return ERR_BUF; + } + offset = options_idx; + offset_max = options_idx_max; + options = (u8_t*)q->payload; + /* at least 1 byte to read and no end marker, then at least 3 bytes to read? */ + while((q != NULL) && (options[offset] != DHCP_OPTION_END) && (offset < offset_max)) { + u8_t op = options[offset]; + u8_t len; + u8_t decode_len = 0; + int decode_idx = -1; + u16_t val_offset = offset + 2; + /* len byte might be in the next pbuf */ + if (offset + 1 < q->len) { + len = options[offset + 1]; + } else { + len = (q->next != NULL ? ((u8_t*)q->next->payload)[0] : 0); + } + /* LWIP_DEBUGF(DHCP_DEBUG, ("msg_offset=%"U16_F", q->len=%"U16_F, msg_offset, q->len)); */ + decode_len = len; + switch(op) { + /* case(DHCP_OPTION_END): handled above */ + case(DHCP_OPTION_PAD): + /* special option: no len encoded */ + decode_len = len = 0; + /* will be increased below */ + offset--; + break; + case(DHCP_OPTION_SUBNET_MASK): + LWIP_ASSERT("len == 4", len == 4); + decode_idx = DHCP_OPTION_IDX_SUBNET_MASK; + break; + case(DHCP_OPTION_ROUTER): + decode_len = 4; /* only copy the first given router */ + LWIP_ASSERT("len >= decode_len", len >= decode_len); + decode_idx = DHCP_OPTION_IDX_ROUTER; + break; + case(DHCP_OPTION_DNS_SERVER): + /* special case: there might be more than one server */ + LWIP_ASSERT("len % 4 == 0", len % 4 == 0); + /* limit number of DNS servers */ + decode_len = LWIP_MIN(len, 4 * DNS_MAX_SERVERS); + LWIP_ASSERT("len >= decode_len", len >= decode_len); + decode_idx = DHCP_OPTION_IDX_DNS_SERVER; + break; + case(DHCP_OPTION_LEASE_TIME): + LWIP_ASSERT("len == 4", len == 4); + decode_idx = DHCP_OPTION_IDX_LEASE_TIME; + break; + case(DHCP_OPTION_OVERLOAD): + LWIP_ASSERT("len == 1", len == 1); + decode_idx = DHCP_OPTION_IDX_OVERLOAD; + break; + case(DHCP_OPTION_MESSAGE_TYPE): + LWIP_ASSERT("len == 1", len == 1); + decode_idx = DHCP_OPTION_IDX_MSG_TYPE; + break; + case(DHCP_OPTION_SERVER_ID): + LWIP_ASSERT("len == 4", len == 4); + decode_idx = DHCP_OPTION_IDX_SERVER_ID; + break; + case(DHCP_OPTION_T1): + LWIP_ASSERT("len == 4", len == 4); + decode_idx = DHCP_OPTION_IDX_T1; + break; + case(DHCP_OPTION_T2): + LWIP_ASSERT("len == 4", len == 4); + decode_idx = DHCP_OPTION_IDX_T2; + break; + default: + decode_len = 0; + LWIP_DEBUGF(DHCP_DEBUG, ("skipping option %"U16_F" in options\n", op)); + break; + } + offset += len + 2; + if (decode_len > 0) { + u32_t value = 0; + u16_t copy_len; +decode_next: + LWIP_ASSERT("check decode_idx", decode_idx >= 0 && decode_idx < DHCP_OPTION_IDX_MAX); + LWIP_ASSERT("option already decoded", !dhcp_option_given(dhcp, decode_idx)); + copy_len = LWIP_MIN(decode_len, 4); + pbuf_copy_partial(q, &value, copy_len, val_offset); + if (decode_len > 4) { + /* decode more than one u32_t */ + LWIP_ASSERT("decode_len % 4 == 0", decode_len % 4 == 0); + dhcp_got_option(dhcp, decode_idx); + dhcp_set_option_value(dhcp, decode_idx, htonl(value)); + decode_len -= 4; + val_offset += 4; + decode_idx++; + goto decode_next; + } else if (decode_len == 4) { + value = ntohl(value); + } else { + LWIP_ASSERT("invalid decode_len", decode_len == 1); + value = ((u8_t*)&value)[0]; + } + dhcp_got_option(dhcp, decode_idx); + dhcp_set_option_value(dhcp, decode_idx, value); + } + if (offset >= q->len) { + offset -= q->len; + offset_max -= q->len; + q = q->next; + options = (u8_t*)q->payload; + } + } + /* is this an overloaded message? */ + if (dhcp_option_given(dhcp, DHCP_OPTION_IDX_OVERLOAD)) { + u32_t overload = dhcp_get_option_value(dhcp, DHCP_OPTION_IDX_OVERLOAD); + dhcp_clear_option(dhcp, DHCP_OPTION_IDX_OVERLOAD); + if (overload == DHCP_OVERLOAD_FILE) { + parse_file_as_options = 1; + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("overloaded file field\n")); + } else if (overload == DHCP_OVERLOAD_SNAME) { + parse_sname_as_options = 1; + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("overloaded sname field\n")); + } else if (overload == DHCP_OVERLOAD_SNAME_FILE) { + parse_sname_as_options = 1; + parse_file_as_options = 1; + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("overloaded sname and file field\n")); + } else { + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("invalid overload option: %d\n", (int)overload)); + } +#if LWIP_DHCP_BOOTP_FILE + if (!parse_file_as_options) { + /* only do this for ACK messages */ + if (dhcp_option_given(dhcp, DHCP_OPTION_IDX_MSG_TYPE) && + (dhcp_get_option_value(dhcp, DHCP_OPTION_IDX_MSG_TYPE) == DHCP_ACK)) + /* copy bootp file name, don't care for sname (server hostname) */ + pbuf_copy_partial(p, dhcp->boot_file_name, DHCP_FILE_LEN-1, DHCP_FILE_OFS); + /* make sure the string is really NULL-terminated */ + dhcp->boot_file_name[DHCP_FILE_LEN-1] = 0; + } +#endif /* LWIP_DHCP_BOOTP_FILE */ + } + if (parse_file_as_options) { + /* if both are overloaded, parse file first and then sname (RFC 2131 ch. 4.1) */ + parse_file_as_options = 0; + options_idx = DHCP_FILE_OFS; + options_idx_max = DHCP_FILE_OFS + DHCP_FILE_LEN; + goto again; + } else if (parse_sname_as_options) { + parse_sname_as_options = 0; + options_idx = DHCP_SNAME_OFS; + options_idx_max = DHCP_SNAME_OFS + DHCP_SNAME_LEN; + goto again; + } + return ERR_OK; +} + +/** + * If an incoming DHCP message is in response to us, then trigger the state machine + */ +static void +dhcp_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p, ip_addr_t *addr, u16_t port) +{ + struct netif *netif = (struct netif *)arg; + struct dhcp *dhcp = netif->dhcp; + struct dhcp_msg *reply_msg = (struct dhcp_msg *)p->payload; + u8_t msg_type; + u8_t i; + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_recv(pbuf = %p) from DHCP server %"U16_F".%"U16_F".%"U16_F".%"U16_F" port %"U16_F"\n", (void*)p, + ip4_addr1_16(addr), ip4_addr2_16(addr), ip4_addr3_16(addr), ip4_addr4_16(addr), port)); + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("pbuf->len = %"U16_F"\n", p->len)); + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("pbuf->tot_len = %"U16_F"\n", p->tot_len)); + /* prevent warnings about unused arguments */ + LWIP_UNUSED_ARG(pcb); + LWIP_UNUSED_ARG(addr); + LWIP_UNUSED_ARG(port); + + LWIP_ASSERT("reply wasn't freed", dhcp->msg_in == NULL); + + if (p->len < DHCP_MIN_REPLY_LEN) { + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_LEVEL_WARNING, ("DHCP reply message or pbuf too short\n")); + goto free_pbuf_and_return; + } + + if (reply_msg->op != DHCP_BOOTREPLY) { + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_LEVEL_WARNING, ("not a DHCP reply message, but type %"U16_F"\n", (u16_t)reply_msg->op)); + goto free_pbuf_and_return; + } + /* iterate through hardware address and match against DHCP message */ + for (i = 0; i < netif->hwaddr_len; i++) { + if (netif->hwaddr[i] != reply_msg->chaddr[i]) { + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_LEVEL_WARNING, + ("netif->hwaddr[%"U16_F"]==%02"X16_F" != reply_msg->chaddr[%"U16_F"]==%02"X16_F"\n", + (u16_t)i, (u16_t)netif->hwaddr[i], (u16_t)i, (u16_t)reply_msg->chaddr[i])); + goto free_pbuf_and_return; + } + } + /* match transaction ID against what we expected */ + if (ntohl(reply_msg->xid) != dhcp->xid) { + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_LEVEL_WARNING, + ("transaction id mismatch reply_msg->xid(%"X32_F")!=dhcp->xid(%"X32_F")\n",ntohl(reply_msg->xid),dhcp->xid)); + goto free_pbuf_and_return; + } + /* option fields could be unfold? */ + if (dhcp_parse_reply(dhcp, p) != ERR_OK) { + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_LEVEL_SERIOUS, + ("problem unfolding DHCP message - too short on memory?\n")); + goto free_pbuf_and_return; + } + + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("searching DHCP_OPTION_MESSAGE_TYPE\n")); + /* obtain pointer to DHCP message type */ + if (!dhcp_option_given(dhcp, DHCP_OPTION_IDX_MSG_TYPE)) { + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_LEVEL_WARNING, ("DHCP_OPTION_MESSAGE_TYPE option not found\n")); + goto free_pbuf_and_return; + } + + /* read DHCP message type */ + msg_type = (u8_t)dhcp_get_option_value(dhcp, DHCP_OPTION_IDX_MSG_TYPE); + /* message type is DHCP ACK? */ + if (msg_type == DHCP_ACK) { + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("DHCP_ACK received\n")); + /* in requesting state? */ + if (dhcp->state == DHCP_REQUESTING) { + dhcp_handle_ack(netif); +#if DHCP_DOES_ARP_CHECK + /* check if the acknowledged lease address is already in use */ + dhcp_check(netif); +#else + /* bind interface to the acknowledged lease address */ + dhcp_bind(netif); +#endif + } + /* already bound to the given lease address? */ + else if ((dhcp->state == DHCP_REBOOTING) || (dhcp->state == DHCP_REBINDING) || (dhcp->state == DHCP_RENEWING)) { + dhcp_bind(netif); + } + } + /* received a DHCP_NAK in appropriate state? */ + else if ((msg_type == DHCP_NAK) && + ((dhcp->state == DHCP_REBOOTING) || (dhcp->state == DHCP_REQUESTING) || + (dhcp->state == DHCP_REBINDING) || (dhcp->state == DHCP_RENEWING ))) { + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("DHCP_NAK received\n")); + dhcp_handle_nak(netif); + } + /* received a DHCP_OFFER in DHCP_SELECTING state? */ + else if ((msg_type == DHCP_OFFER) && (dhcp->state == DHCP_SELECTING)) { + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("DHCP_OFFER received in DHCP_SELECTING state\n")); + dhcp->request_timeout = 0; + /* remember offered lease */ + dhcp_handle_offer(netif); + } +free_pbuf_and_return: + dhcp->msg_in = NULL; + pbuf_free(p); +} + +/** + * Create a DHCP request, fill in common headers + * + * @param netif the netif under DHCP control + * @param dhcp dhcp control struct + * @param message_type message type of the request + */ +static err_t +dhcp_create_msg(struct netif *netif, struct dhcp *dhcp, u8_t message_type) +{ + u16_t i; +#ifndef DHCP_GLOBAL_XID + /** default global transaction identifier starting value (easy to match + * with a packet analyser). We simply increment for each new request. + * Predefine DHCP_GLOBAL_XID to a better value or a function call to generate one + * at runtime, any supporting function prototypes can be defined in DHCP_GLOBAL_XID_HEADER */ + static u32_t xid = 0xABCD0000; +#else + static u32_t xid; + static u8_t xid_initialised = 0; + if (!xid_initialised) { + xid = DHCP_GLOBAL_XID; + xid_initialised = !xid_initialised; + } +#endif + LWIP_ERROR("dhcp_create_msg: netif != NULL", (netif != NULL), return ERR_ARG;); + LWIP_ERROR("dhcp_create_msg: dhcp != NULL", (dhcp != NULL), return ERR_VAL;); + LWIP_ASSERT("dhcp_create_msg: dhcp->p_out == NULL", dhcp->p_out == NULL); + LWIP_ASSERT("dhcp_create_msg: dhcp->msg_out == NULL", dhcp->msg_out == NULL); + dhcp->p_out = pbuf_alloc(PBUF_TRANSPORT, sizeof(struct dhcp_msg), PBUF_RAM); + if (dhcp->p_out == NULL) { + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_LEVEL_SERIOUS, + ("dhcp_create_msg(): could not allocate pbuf\n")); + return ERR_MEM; + } + LWIP_ASSERT("dhcp_create_msg: check that first pbuf can hold struct dhcp_msg", + (dhcp->p_out->len >= sizeof(struct dhcp_msg))); + + /* reuse transaction identifier in retransmissions */ + if (dhcp->tries == 0) { + xid++; + } + dhcp->xid = xid; + LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, + ("transaction id xid(%"X32_F")\n", xid)); + + dhcp->msg_out = (struct dhcp_msg *)dhcp->p_out->payload; + + dhcp->msg_out->op = DHCP_BOOTREQUEST; + /* TODO: make link layer independent */ + dhcp->msg_out->htype = DHCP_HTYPE_ETH; + dhcp->msg_out->hlen = netif->hwaddr_len; + dhcp->msg_out->hops = 0; + dhcp->msg_out->xid = htonl(dhcp->xid); + dhcp->msg_out->secs = 0; + /* we don't need the broadcast flag since we can receive unicast traffic + before being fully configured! */ + dhcp->msg_out->flags = 0; + ip_addr_set_zero(&dhcp->msg_out->ciaddr); + /* set ciaddr to netif->ip_addr based on message_type and state */ + if ((message_type == DHCP_INFORM) || (message_type == DHCP_DECLINE) || + ((message_type == DHCP_REQUEST) && /* DHCP_BOUND not used for sending! */ + ((dhcp->state==DHCP_RENEWING) || dhcp->state==DHCP_REBINDING))) { + ip_addr_copy(dhcp->msg_out->ciaddr, netif->ip_addr); + } + ip_addr_set_zero(&dhcp->msg_out->yiaddr); + ip_addr_set_zero(&dhcp->msg_out->siaddr); + ip_addr_set_zero(&dhcp->msg_out->giaddr); + for (i = 0; i < DHCP_CHADDR_LEN; i++) { + /* copy netif hardware address, pad with zeroes */ + dhcp->msg_out->chaddr[i] = (i < netif->hwaddr_len) ? netif->hwaddr[i] : 0/* pad byte*/; + } + for (i = 0; i < DHCP_SNAME_LEN; i++) { + dhcp->msg_out->sname[i] = 0; + } + for (i = 0; i < DHCP_FILE_LEN; i++) { + dhcp->msg_out->file[i] = 0; + } + dhcp->msg_out->cookie = PP_HTONL(DHCP_MAGIC_COOKIE); + dhcp->options_out_len = 0; + /* fill options field with an incrementing array (for debugging purposes) */ + for (i = 0; i < DHCP_OPTIONS_LEN; i++) { + dhcp->msg_out->options[i] = (u8_t)i; /* for debugging only, no matter if truncated */ + } + /* Add option MESSAGE_TYPE */ + dhcp_option(dhcp, DHCP_OPTION_MESSAGE_TYPE, DHCP_OPTION_MESSAGE_TYPE_LEN); + dhcp_option_byte(dhcp, message_type); + return ERR_OK; +} + +/** + * Free previously allocated memory used to send a DHCP request. + * + * @param dhcp the dhcp struct to free the request from + */ +static void +dhcp_delete_msg(struct dhcp *dhcp) +{ + LWIP_ERROR("dhcp_delete_msg: dhcp != NULL", (dhcp != NULL), return;); + LWIP_ASSERT("dhcp_delete_msg: dhcp->p_out != NULL", dhcp->p_out != NULL); + LWIP_ASSERT("dhcp_delete_msg: dhcp->msg_out != NULL", dhcp->msg_out != NULL); + if (dhcp->p_out != NULL) { + pbuf_free(dhcp->p_out); + } + dhcp->p_out = NULL; + dhcp->msg_out = NULL; +} + +/** + * Add a DHCP message trailer + * + * Adds the END option to the DHCP message, and if + * necessary, up to three padding bytes. + * + * @param dhcp DHCP state structure + */ +static void +dhcp_option_trailer(struct dhcp *dhcp) +{ + LWIP_ERROR("dhcp_option_trailer: dhcp != NULL", (dhcp != NULL), return;); + LWIP_ASSERT("dhcp_option_trailer: dhcp->msg_out != NULL\n", dhcp->msg_out != NULL); + LWIP_ASSERT("dhcp_option_trailer: dhcp->options_out_len < DHCP_OPTIONS_LEN\n", dhcp->options_out_len < DHCP_OPTIONS_LEN); + dhcp->msg_out->options[dhcp->options_out_len++] = DHCP_OPTION_END; + /* packet is too small, or not 4 byte aligned? */ + while ((dhcp->options_out_len < DHCP_MIN_OPTIONS_LEN) || (dhcp->options_out_len & 3)) { + /* LWIP_DEBUGF(DHCP_DEBUG,("dhcp_option_trailer:dhcp->options_out_len=%"U16_F", DHCP_OPTIONS_LEN=%"U16_F, dhcp->options_out_len, DHCP_OPTIONS_LEN)); */ + LWIP_ASSERT("dhcp_option_trailer: dhcp->options_out_len < DHCP_OPTIONS_LEN\n", dhcp->options_out_len < DHCP_OPTIONS_LEN); + /* add a fill/padding byte */ + dhcp->msg_out->options[dhcp->options_out_len++] = 0; + } +} + +#endif /* LWIP_DHCP */ diff --git a/lib/drivers/lwip/src/core/dns.c b/lib/drivers/lwip/src/core/dns.c new file mode 100644 index 00000000000..d63361226f2 --- /dev/null +++ b/lib/drivers/lwip/src/core/dns.c @@ -0,0 +1,970 @@ +/** + * @file + * DNS - host name to IP address resolver. + * + */ + +/** + + * This file implements a DNS host name to IP address resolver. + + * Port to lwIP from uIP + * by Jim Pettinato April 2007 + + * uIP version Copyright (c) 2002-2003, Adam Dunkels. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * DNS.C + * + * The lwIP DNS resolver functions are used to lookup a host name and + * map it to a numerical IP address. It maintains a list of resolved + * hostnames that can be queried with the dns_lookup() function. + * New hostnames can be resolved using the dns_query() function. + * + * The lwIP version of the resolver also adds a non-blocking version of + * gethostbyname() that will work with a raw API application. This function + * checks for an IP address string first and converts it if it is valid. + * gethostbyname() then does a dns_lookup() to see if the name is + * already in the table. If so, the IP is returned. If not, a query is + * issued and the function returns with a ERR_INPROGRESS status. The app + * using the dns client must then go into a waiting state. + * + * Once a hostname has been resolved (or found to be non-existent), + * the resolver code calls a specified callback function (which + * must be implemented by the module that uses the resolver). + */ + +/*----------------------------------------------------------------------------- + * RFC 1035 - Domain names - implementation and specification + * RFC 2181 - Clarifications to the DNS Specification + *----------------------------------------------------------------------------*/ + +/** @todo: define good default values (rfc compliance) */ +/** @todo: improve answer parsing, more checkings... */ +/** @todo: check RFC1035 - 7.3. Processing responses */ + +/*----------------------------------------------------------------------------- + * Includes + *----------------------------------------------------------------------------*/ + +#include "lwip/opt.h" + +#if LWIP_DNS /* don't build if not configured for use in lwipopts.h */ + +#include "lwip/udp.h" +#include "lwip/mem.h" +#include "lwip/memp.h" +#include "lwip/dns.h" + +#include + +/** DNS server IP address */ +#ifndef DNS_SERVER_ADDRESS +#define DNS_SERVER_ADDRESS(ipaddr) (ip4_addr_set_u32(ipaddr, ipaddr_addr("208.67.222.222"))) /* resolver1.opendns.com */ +#endif + +/** DNS server port address */ +#ifndef DNS_SERVER_PORT +#define DNS_SERVER_PORT 53 +#endif + +/** DNS maximum number of retries when asking for a name, before "timeout". */ +#ifndef DNS_MAX_RETRIES +#define DNS_MAX_RETRIES 4 +#endif + +/** DNS resource record max. TTL (one week as default) */ +#ifndef DNS_MAX_TTL +#define DNS_MAX_TTL 604800 +#endif + +/* DNS protocol flags */ +#define DNS_FLAG1_RESPONSE 0x80 +#define DNS_FLAG1_OPCODE_STATUS 0x10 +#define DNS_FLAG1_OPCODE_INVERSE 0x08 +#define DNS_FLAG1_OPCODE_STANDARD 0x00 +#define DNS_FLAG1_AUTHORATIVE 0x04 +#define DNS_FLAG1_TRUNC 0x02 +#define DNS_FLAG1_RD 0x01 +#define DNS_FLAG2_RA 0x80 +#define DNS_FLAG2_ERR_MASK 0x0f +#define DNS_FLAG2_ERR_NONE 0x00 +#define DNS_FLAG2_ERR_NAME 0x03 + +/* DNS protocol states */ +#define DNS_STATE_UNUSED 0 +#define DNS_STATE_NEW 1 +#define DNS_STATE_ASKING 2 +#define DNS_STATE_DONE 3 + +#ifdef PACK_STRUCT_USE_INCLUDES +# include "arch/bpstruct.h" +#endif +PACK_STRUCT_BEGIN +/** DNS message header */ +struct dns_hdr { + PACK_STRUCT_FIELD(u16_t id); + PACK_STRUCT_FIELD(u8_t flags1); + PACK_STRUCT_FIELD(u8_t flags2); + PACK_STRUCT_FIELD(u16_t numquestions); + PACK_STRUCT_FIELD(u16_t numanswers); + PACK_STRUCT_FIELD(u16_t numauthrr); + PACK_STRUCT_FIELD(u16_t numextrarr); +} PACK_STRUCT_STRUCT; +PACK_STRUCT_END +#ifdef PACK_STRUCT_USE_INCLUDES +# include "arch/epstruct.h" +#endif +#define SIZEOF_DNS_HDR 12 + +/** DNS query message structure. + No packing needed: only used locally on the stack. */ +struct dns_query { + /* DNS query record starts with either a domain name or a pointer + to a name already present somewhere in the packet. */ + u16_t type; + u16_t cls; +}; +#define SIZEOF_DNS_QUERY 4 + +/** DNS answer message structure. + No packing needed: only used locally on the stack. */ +struct dns_answer { + /* DNS answer record starts with either a domain name or a pointer + to a name already present somewhere in the packet. */ + u16_t type; + u16_t cls; + u32_t ttl; + u16_t len; +}; +#define SIZEOF_DNS_ANSWER 10 + +/** DNS table entry */ +struct dns_table_entry { + u8_t state; + u8_t numdns; + u8_t tmr; + u8_t retries; + u8_t seqno; + u8_t err; + u32_t ttl; + char name[DNS_MAX_NAME_LENGTH]; + ip_addr_t ipaddr; + /* pointer to callback on DNS query done */ + dns_found_callback found; + void *arg; +}; + +#if DNS_LOCAL_HOSTLIST + +#if DNS_LOCAL_HOSTLIST_IS_DYNAMIC +/** Local host-list. For hostnames in this list, no + * external name resolution is performed */ +static struct local_hostlist_entry *local_hostlist_dynamic; +#else /* DNS_LOCAL_HOSTLIST_IS_DYNAMIC */ + +/** Defining this allows the local_hostlist_static to be placed in a different + * linker section (e.g. FLASH) */ +#ifndef DNS_LOCAL_HOSTLIST_STORAGE_PRE +#define DNS_LOCAL_HOSTLIST_STORAGE_PRE static +#endif /* DNS_LOCAL_HOSTLIST_STORAGE_PRE */ +/** Defining this allows the local_hostlist_static to be placed in a different + * linker section (e.g. FLASH) */ +#ifndef DNS_LOCAL_HOSTLIST_STORAGE_POST +#define DNS_LOCAL_HOSTLIST_STORAGE_POST +#endif /* DNS_LOCAL_HOSTLIST_STORAGE_POST */ +DNS_LOCAL_HOSTLIST_STORAGE_PRE struct local_hostlist_entry local_hostlist_static[] + DNS_LOCAL_HOSTLIST_STORAGE_POST = DNS_LOCAL_HOSTLIST_INIT; + +#endif /* DNS_LOCAL_HOSTLIST_IS_DYNAMIC */ + +static void dns_init_local(); +#endif /* DNS_LOCAL_HOSTLIST */ + + +/* forward declarations */ +static void dns_recv(void *s, struct udp_pcb *pcb, struct pbuf *p, ip_addr_t *addr, u16_t port); +static void dns_check_entries(void); + +/*----------------------------------------------------------------------------- + * Globales + *----------------------------------------------------------------------------*/ + +/* DNS variables */ +static struct udp_pcb *dns_pcb; +static u8_t dns_seqno; +static struct dns_table_entry dns_table[DNS_TABLE_SIZE]; +static ip_addr_t dns_servers[DNS_MAX_SERVERS]; +/** Contiguous buffer for processing responses */ +static u8_t dns_payload_buffer[LWIP_MEM_ALIGN_BUFFER(DNS_MSG_SIZE)]; +static u8_t* dns_payload; + +/** + * Initialize the resolver: set up the UDP pcb and configure the default server + * (DNS_SERVER_ADDRESS). + */ +void +dns_init() +{ + ip_addr_t dnsserver; + + dns_payload = (u8_t *)LWIP_MEM_ALIGN(dns_payload_buffer); + + /* initialize default DNS server address */ + DNS_SERVER_ADDRESS(&dnsserver); + + LWIP_DEBUGF(DNS_DEBUG, ("dns_init: initializing\n")); + + /* if dns client not yet initialized... */ + if (dns_pcb == NULL) { + dns_pcb = udp_new(); + + if (dns_pcb != NULL) { + /* initialize DNS table not needed (initialized to zero since it is a + * global variable) */ + LWIP_ASSERT("For implicit initialization to work, DNS_STATE_UNUSED needs to be 0", + DNS_STATE_UNUSED == 0); + + /* initialize DNS client */ + udp_bind(dns_pcb, IP_ADDR_ANY, 0); + udp_recv(dns_pcb, dns_recv, NULL); + + /* initialize default DNS primary server */ + dns_setserver(0, &dnsserver); + } + } +#if DNS_LOCAL_HOSTLIST + dns_init_local(); +#endif +} + +/** + * Initialize one of the DNS servers. + * + * @param numdns the index of the DNS server to set must be < DNS_MAX_SERVERS + * @param dnsserver IP address of the DNS server to set + */ +void +dns_setserver(u8_t numdns, ip_addr_t *dnsserver) +{ + if ((numdns < DNS_MAX_SERVERS) && (dns_pcb != NULL) && + (dnsserver != NULL) && !ip_addr_isany(dnsserver)) { + dns_servers[numdns] = (*dnsserver); + } +} + +/** + * Obtain one of the currently configured DNS server. + * + * @param numdns the index of the DNS server + * @return IP address of the indexed DNS server or "ip_addr_any" if the DNS + * server has not been configured. + */ +ip_addr_t +dns_getserver(u8_t numdns) +{ + if (numdns < DNS_MAX_SERVERS) { + return dns_servers[numdns]; + } else { + return *IP_ADDR_ANY; + } +} + +/** + * The DNS resolver client timer - handle retries and timeouts and should + * be called every DNS_TMR_INTERVAL milliseconds (every second by default). + */ +void +dns_tmr(void) +{ + if (dns_pcb != NULL) { + LWIP_DEBUGF(DNS_DEBUG, ("dns_tmr: dns_check_entries\n")); + dns_check_entries(); + } +} + +#if DNS_LOCAL_HOSTLIST +static void +dns_init_local() +{ +#if DNS_LOCAL_HOSTLIST_IS_DYNAMIC && defined(DNS_LOCAL_HOSTLIST_INIT) + int i; + struct local_hostlist_entry *entry; + /* Dynamic: copy entries from DNS_LOCAL_HOSTLIST_INIT to list */ + struct local_hostlist_entry local_hostlist_init[] = DNS_LOCAL_HOSTLIST_INIT; + size_t namelen; + for (i = 0; i < sizeof(local_hostlist_init) / sizeof(struct local_hostlist_entry); i++) { + struct local_hostlist_entry *init_entry = &local_hostlist_init[i]; + LWIP_ASSERT("invalid host name (NULL)", init_entry->name != NULL); + namelen = strlen(init_entry->name); + LWIP_ASSERT("namelen <= DNS_LOCAL_HOSTLIST_MAX_NAMELEN", namelen <= DNS_LOCAL_HOSTLIST_MAX_NAMELEN); + entry = (struct local_hostlist_entry *)memp_malloc(MEMP_LOCALHOSTLIST); + LWIP_ASSERT("mem-error in dns_init_local", entry != NULL); + if (entry != NULL) { + entry->name = (char*)entry + sizeof(struct local_hostlist_entry); + MEMCPY((char*)entry->name, init_entry->name, namelen); + ((char*)entry->name)[namelen] = 0; + entry->addr = init_entry->addr; + entry->next = local_hostlist_dynamic; + local_hostlist_dynamic = entry; + } + } +#endif /* DNS_LOCAL_HOSTLIST_IS_DYNAMIC && defined(DNS_LOCAL_HOSTLIST_INIT) */ +} + +/** + * Scans the local host-list for a hostname. + * + * @param hostname Hostname to look for in the local host-list + * @return The first IP address for the hostname in the local host-list or + * IPADDR_NONE if not found. + */ +static u32_t +dns_lookup_local(const char *hostname) +{ +#if DNS_LOCAL_HOSTLIST_IS_DYNAMIC + struct local_hostlist_entry *entry = local_hostlist_dynamic; + while(entry != NULL) { + if(strcmp(entry->name, hostname) == 0) { + return ip4_addr_get_u32(&entry->addr); + } + entry = entry->next; + } +#else /* DNS_LOCAL_HOSTLIST_IS_DYNAMIC */ + int i; + for (i = 0; i < sizeof(local_hostlist_static) / sizeof(struct local_hostlist_entry); i++) { + if(strcmp(local_hostlist_static[i].name, hostname) == 0) { + return ip4_addr_get_u32(&local_hostlist_static[i].addr); + } + } +#endif /* DNS_LOCAL_HOSTLIST_IS_DYNAMIC */ + return IPADDR_NONE; +} + +#if DNS_LOCAL_HOSTLIST_IS_DYNAMIC +/** Remove all entries from the local host-list for a specific hostname + * and/or IP addess + * + * @param hostname hostname for which entries shall be removed from the local + * host-list + * @param addr address for which entries shall be removed from the local host-list + * @return the number of removed entries + */ +int +dns_local_removehost(const char *hostname, const ip_addr_t *addr) +{ + int removed = 0; + struct local_hostlist_entry *entry = local_hostlist_dynamic; + struct local_hostlist_entry *last_entry = NULL; + while (entry != NULL) { + if (((hostname == NULL) || !strcmp(entry->name, hostname)) && + ((addr == NULL) || ip_addr_cmp(&entry->addr, addr))) { + struct local_hostlist_entry *free_entry; + if (last_entry != NULL) { + last_entry->next = entry->next; + } else { + local_hostlist_dynamic = entry->next; + } + free_entry = entry; + entry = entry->next; + memp_free(MEMP_LOCALHOSTLIST, free_entry); + removed++; + } else { + last_entry = entry; + entry = entry->next; + } + } + return removed; +} + +/** + * Add a hostname/IP address pair to the local host-list. + * Duplicates are not checked. + * + * @param hostname hostname of the new entry + * @param addr IP address of the new entry + * @return ERR_OK if succeeded or ERR_MEM on memory error + */ +err_t +dns_local_addhost(const char *hostname, const ip_addr_t *addr) +{ + struct local_hostlist_entry *entry; + size_t namelen; + LWIP_ASSERT("invalid host name (NULL)", hostname != NULL); + namelen = strlen(hostname); + LWIP_ASSERT("namelen <= DNS_LOCAL_HOSTLIST_MAX_NAMELEN", namelen <= DNS_LOCAL_HOSTLIST_MAX_NAMELEN); + entry = (struct local_hostlist_entry *)memp_malloc(MEMP_LOCALHOSTLIST); + if (entry == NULL) { + return ERR_MEM; + } + entry->name = (char*)entry + sizeof(struct local_hostlist_entry); + MEMCPY((char*)entry->name, hostname, namelen); + ((char*)entry->name)[namelen] = 0; + ip_addr_copy(entry->addr, *addr); + entry->next = local_hostlist_dynamic; + local_hostlist_dynamic = entry; + return ERR_OK; +} +#endif /* DNS_LOCAL_HOSTLIST_IS_DYNAMIC*/ +#endif /* DNS_LOCAL_HOSTLIST */ + +/** + * Look up a hostname in the array of known hostnames. + * + * @note This function only looks in the internal array of known + * hostnames, it does not send out a query for the hostname if none + * was found. The function dns_enqueue() can be used to send a query + * for a hostname. + * + * @param name the hostname to look up + * @return the hostname's IP address, as u32_t (instead of ip_addr_t to + * better check for failure: != IPADDR_NONE) or IPADDR_NONE if the hostname + * was not found in the cached dns_table. + */ +static u32_t +dns_lookup(const char *name) +{ + u8_t i; +#if DNS_LOCAL_HOSTLIST || defined(DNS_LOOKUP_LOCAL_EXTERN) + u32_t addr; +#endif /* DNS_LOCAL_HOSTLIST || defined(DNS_LOOKUP_LOCAL_EXTERN) */ +#if DNS_LOCAL_HOSTLIST + if ((addr = dns_lookup_local(name)) != IPADDR_NONE) { + return addr; + } +#endif /* DNS_LOCAL_HOSTLIST */ +#ifdef DNS_LOOKUP_LOCAL_EXTERN + if((addr = DNS_LOOKUP_LOCAL_EXTERN(name)) != IPADDR_NONE) { + return addr; + } +#endif /* DNS_LOOKUP_LOCAL_EXTERN */ + + /* Walk through name list, return entry if found. If not, return NULL. */ + for (i = 0; i < DNS_TABLE_SIZE; ++i) { + if ((dns_table[i].state == DNS_STATE_DONE) && + (strcmp(name, dns_table[i].name) == 0)) { + LWIP_DEBUGF(DNS_DEBUG, ("dns_lookup: \"%s\": found = ", name)); + ip_addr_debug_print(DNS_DEBUG, &(dns_table[i].ipaddr)); + LWIP_DEBUGF(DNS_DEBUG, ("\n")); + return ip4_addr_get_u32(&dns_table[i].ipaddr); + } + } + + return IPADDR_NONE; +} + +#if DNS_DOES_NAME_CHECK +/** + * Compare the "dotted" name "query" with the encoded name "response" + * to make sure an answer from the DNS server matches the current dns_table + * entry (otherwise, answers might arrive late for hostname not on the list + * any more). + * + * @param query hostname (not encoded) from the dns_table + * @param response encoded hostname in the DNS response + * @return 0: names equal; 1: names differ + */ +static u8_t +dns_compare_name(unsigned char *query, unsigned char *response) +{ + unsigned char n; + + do { + n = *response++; + /** @see RFC 1035 - 4.1.4. Message compression */ + if ((n & 0xc0) == 0xc0) { + /* Compressed name */ + break; + } else { + /* Not compressed name */ + while (n > 0) { + if ((*query) != (*response)) { + return 1; + } + ++response; + ++query; + --n; + }; + ++query; + } + } while (*response != 0); + + return 0; +} +#endif /* DNS_DOES_NAME_CHECK */ + +/** + * Walk through a compact encoded DNS name and return the end of the name. + * + * @param query encoded DNS name in the DNS server response + * @return end of the name + */ +static unsigned char * +dns_parse_name(unsigned char *query) +{ + unsigned char n; + + do { + n = *query++; + /** @see RFC 1035 - 4.1.4. Message compression */ + if ((n & 0xc0) == 0xc0) { + /* Compressed name */ + break; + } else { + /* Not compressed name */ + while (n > 0) { + ++query; + --n; + }; + } + } while (*query != 0); + + return query + 1; +} + +/** + * Send a DNS query packet. + * + * @param numdns index of the DNS server in the dns_servers table + * @param name hostname to query + * @param id index of the hostname in dns_table, used as transaction ID in the + * DNS query packet + * @return ERR_OK if packet is sent; an err_t indicating the problem otherwise + */ +static err_t +dns_send(u8_t numdns, const char* name, u8_t id) +{ + err_t err; + struct dns_hdr *hdr; + struct dns_query qry; + struct pbuf *p; + char *query, *nptr; + const char *pHostname; + u8_t n; + + LWIP_DEBUGF(DNS_DEBUG, ("dns_send: dns_servers[%"U16_F"] \"%s\": request\n", + (u16_t)(numdns), name)); + LWIP_ASSERT("dns server out of array", numdns < DNS_MAX_SERVERS); + LWIP_ASSERT("dns server has no IP address set", !ip_addr_isany(&dns_servers[numdns])); + + /* if here, we have either a new query or a retry on a previous query to process */ + p = pbuf_alloc(PBUF_TRANSPORT, SIZEOF_DNS_HDR + DNS_MAX_NAME_LENGTH + + SIZEOF_DNS_QUERY, PBUF_RAM); + if (p != NULL) { + LWIP_ASSERT("pbuf must be in one piece", p->next == NULL); + /* fill dns header */ + hdr = (struct dns_hdr*)p->payload; + memset(hdr, 0, SIZEOF_DNS_HDR); + hdr->id = htons(id); + hdr->flags1 = DNS_FLAG1_RD; + hdr->numquestions = PP_HTONS(1); + query = (char*)hdr + SIZEOF_DNS_HDR; + pHostname = name; + --pHostname; + + /* convert hostname into suitable query format. */ + do { + ++pHostname; + nptr = query; + ++query; + for(n = 0; *pHostname != '.' && *pHostname != 0; ++pHostname) { + *query = *pHostname; + ++query; + ++n; + } + *nptr = n; + } while(*pHostname != 0); + *query++='\0'; + + /* fill dns query */ + qry.type = PP_HTONS(DNS_RRTYPE_A); + qry.cls = PP_HTONS(DNS_RRCLASS_IN); + SMEMCPY(query, &qry, SIZEOF_DNS_QUERY); + + /* resize pbuf to the exact dns query */ + pbuf_realloc(p, (u16_t)((query + SIZEOF_DNS_QUERY) - ((char*)(p->payload)))); + + /* connect to the server for faster receiving */ + udp_connect(dns_pcb, &dns_servers[numdns], DNS_SERVER_PORT); + /* send dns packet */ + err = udp_sendto(dns_pcb, p, &dns_servers[numdns], DNS_SERVER_PORT); + + /* free pbuf */ + pbuf_free(p); + } else { + err = ERR_MEM; + } + + return err; +} + +/** + * dns_check_entry() - see if pEntry has not yet been queried and, if so, sends out a query. + * Check an entry in the dns_table: + * - send out query for new entries + * - retry old pending entries on timeout (also with different servers) + * - remove completed entries from the table if their TTL has expired + * + * @param i index of the dns_table entry to check + */ +static void +dns_check_entry(u8_t i) +{ + err_t err; + struct dns_table_entry *pEntry = &dns_table[i]; + + LWIP_ASSERT("array index out of bounds", i < DNS_TABLE_SIZE); + + switch(pEntry->state) { + + case DNS_STATE_NEW: { + /* initialize new entry */ + pEntry->state = DNS_STATE_ASKING; + pEntry->numdns = 0; + pEntry->tmr = 1; + pEntry->retries = 0; + + /* send DNS packet for this entry */ + err = dns_send(pEntry->numdns, pEntry->name, i); + if (err != ERR_OK) { + LWIP_DEBUGF(DNS_DEBUG | LWIP_DBG_LEVEL_WARNING, + ("dns_send returned error: %s\n", lwip_strerr(err))); + } + break; + } + + case DNS_STATE_ASKING: { + if (--pEntry->tmr == 0) { + if (++pEntry->retries == DNS_MAX_RETRIES) { + if ((pEntry->numdns+1numdns+1])) { + /* change of server */ + pEntry->numdns++; + pEntry->tmr = 1; + pEntry->retries = 0; + break; + } else { + LWIP_DEBUGF(DNS_DEBUG, ("dns_check_entry: \"%s\": timeout\n", pEntry->name)); + /* call specified callback function if provided */ + if (pEntry->found) + (*pEntry->found)(pEntry->name, NULL, pEntry->arg); + /* flush this entry */ + pEntry->state = DNS_STATE_UNUSED; + pEntry->found = NULL; + break; + } + } + + /* wait longer for the next retry */ + pEntry->tmr = pEntry->retries; + + /* send DNS packet for this entry */ + err = dns_send(pEntry->numdns, pEntry->name, i); + if (err != ERR_OK) { + LWIP_DEBUGF(DNS_DEBUG | LWIP_DBG_LEVEL_WARNING, + ("dns_send returned error: %s\n", lwip_strerr(err))); + } + } + break; + } + + case DNS_STATE_DONE: { + /* if the time to live is nul */ + if (--pEntry->ttl == 0) { + LWIP_DEBUGF(DNS_DEBUG, ("dns_check_entry: \"%s\": flush\n", pEntry->name)); + /* flush this entry */ + pEntry->state = DNS_STATE_UNUSED; + pEntry->found = NULL; + } + break; + } + case DNS_STATE_UNUSED: + /* nothing to do */ + break; + default: + LWIP_ASSERT("unknown dns_table entry state:", 0); + break; + } +} + +/** + * Call dns_check_entry for each entry in dns_table - check all entries. + */ +static void +dns_check_entries(void) +{ + u8_t i; + + for (i = 0; i < DNS_TABLE_SIZE; ++i) { + dns_check_entry(i); + } +} + +/** + * Receive input function for DNS response packets arriving for the dns UDP pcb. + * + * @params see udp.h + */ +static void +dns_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p, ip_addr_t *addr, u16_t port) +{ + u16_t i; + char *pHostname; + struct dns_hdr *hdr; + struct dns_answer ans; + struct dns_table_entry *pEntry; + u16_t nquestions, nanswers; + + LWIP_UNUSED_ARG(arg); + LWIP_UNUSED_ARG(pcb); + LWIP_UNUSED_ARG(addr); + LWIP_UNUSED_ARG(port); + + /* is the dns message too big ? */ + if (p->tot_len > DNS_MSG_SIZE) { + LWIP_DEBUGF(DNS_DEBUG, ("dns_recv: pbuf too big\n")); + /* free pbuf and return */ + goto memerr; + } + + /* is the dns message big enough ? */ + if (p->tot_len < (SIZEOF_DNS_HDR + SIZEOF_DNS_QUERY + SIZEOF_DNS_ANSWER)) { + LWIP_DEBUGF(DNS_DEBUG, ("dns_recv: pbuf too small\n")); + /* free pbuf and return */ + goto memerr; + } + + /* copy dns payload inside static buffer for processing */ + if (pbuf_copy_partial(p, dns_payload, p->tot_len, 0) == p->tot_len) { + /* The ID in the DNS header should be our entry into the name table. */ + hdr = (struct dns_hdr*)dns_payload; + i = htons(hdr->id); + if (i < DNS_TABLE_SIZE) { + pEntry = &dns_table[i]; + if(pEntry->state == DNS_STATE_ASKING) { + /* This entry is now completed. */ + pEntry->state = DNS_STATE_DONE; + pEntry->err = hdr->flags2 & DNS_FLAG2_ERR_MASK; + + /* We only care about the question(s) and the answers. The authrr + and the extrarr are simply discarded. */ + nquestions = htons(hdr->numquestions); + nanswers = htons(hdr->numanswers); + + /* Check for error. If so, call callback to inform. */ + if (((hdr->flags1 & DNS_FLAG1_RESPONSE) == 0) || (pEntry->err != 0) || (nquestions != 1)) { + LWIP_DEBUGF(DNS_DEBUG, ("dns_recv: \"%s\": error in flags\n", pEntry->name)); + /* call callback to indicate error, clean up memory and return */ + goto responseerr; + } + +#if DNS_DOES_NAME_CHECK + /* Check if the name in the "question" part match with the name in the entry. */ + if (dns_compare_name((unsigned char *)(pEntry->name), (unsigned char *)dns_payload + SIZEOF_DNS_HDR) != 0) { + LWIP_DEBUGF(DNS_DEBUG, ("dns_recv: \"%s\": response not match to query\n", pEntry->name)); + /* call callback to indicate error, clean up memory and return */ + goto responseerr; + } +#endif /* DNS_DOES_NAME_CHECK */ + + /* Skip the name in the "question" part */ + pHostname = (char *) dns_parse_name((unsigned char *)dns_payload + SIZEOF_DNS_HDR) + SIZEOF_DNS_QUERY; + + while (nanswers > 0) { + /* skip answer resource record's host name */ + pHostname = (char *) dns_parse_name((unsigned char *)pHostname); + + /* Check for IP address type and Internet class. Others are discarded. */ + SMEMCPY(&ans, pHostname, SIZEOF_DNS_ANSWER); + if((ans.type == PP_HTONS(DNS_RRTYPE_A)) && (ans.cls == PP_HTONS(DNS_RRCLASS_IN)) && + (ans.len == PP_HTONS(sizeof(ip_addr_t))) ) { + /* read the answer resource record's TTL, and maximize it if needed */ + pEntry->ttl = ntohl(ans.ttl); + if (pEntry->ttl > DNS_MAX_TTL) { + pEntry->ttl = DNS_MAX_TTL; + } + /* read the IP address after answer resource record's header */ + SMEMCPY(&(pEntry->ipaddr), (pHostname+SIZEOF_DNS_ANSWER), sizeof(ip_addr_t)); + LWIP_DEBUGF(DNS_DEBUG, ("dns_recv: \"%s\": response = ", pEntry->name)); + ip_addr_debug_print(DNS_DEBUG, (&(pEntry->ipaddr))); + LWIP_DEBUGF(DNS_DEBUG, ("\n")); + /* call specified callback function if provided */ + if (pEntry->found) { + (*pEntry->found)(pEntry->name, &pEntry->ipaddr, pEntry->arg); + } + /* deallocate memory and return */ + goto memerr; + } else { + pHostname = pHostname + SIZEOF_DNS_ANSWER + htons(ans.len); + } + --nanswers; + } + LWIP_DEBUGF(DNS_DEBUG, ("dns_recv: \"%s\": error in response\n", pEntry->name)); + /* call callback to indicate error, clean up memory and return */ + goto responseerr; + } + } + } + + /* deallocate memory and return */ + goto memerr; + +responseerr: + /* ERROR: call specified callback function with NULL as name to indicate an error */ + if (pEntry->found) { + (*pEntry->found)(pEntry->name, NULL, pEntry->arg); + } + /* flush this entry */ + pEntry->state = DNS_STATE_UNUSED; + pEntry->found = NULL; + +memerr: + /* free pbuf */ + pbuf_free(p); + return; +} + +/** + * Queues a new hostname to resolve and sends out a DNS query for that hostname + * + * @param name the hostname that is to be queried + * @param found a callback founction to be called on success, failure or timeout + * @param callback_arg argument to pass to the callback function + * @return @return a err_t return code. + */ +static err_t +dns_enqueue(const char *name, dns_found_callback found, void *callback_arg) +{ + u8_t i; + u8_t lseq, lseqi; + struct dns_table_entry *pEntry = NULL; + size_t namelen; + + /* search an unused entry, or the oldest one */ + lseq = lseqi = 0; + for (i = 0; i < DNS_TABLE_SIZE; ++i) { + pEntry = &dns_table[i]; + /* is it an unused entry ? */ + if (pEntry->state == DNS_STATE_UNUSED) + break; + + /* check if this is the oldest completed entry */ + if (pEntry->state == DNS_STATE_DONE) { + if ((dns_seqno - pEntry->seqno) > lseq) { + lseq = dns_seqno - pEntry->seqno; + lseqi = i; + } + } + } + + /* if we don't have found an unused entry, use the oldest completed one */ + if (i == DNS_TABLE_SIZE) { + if ((lseqi >= DNS_TABLE_SIZE) || (dns_table[lseqi].state != DNS_STATE_DONE)) { + /* no entry can't be used now, table is full */ + LWIP_DEBUGF(DNS_DEBUG, ("dns_enqueue: \"%s\": DNS entries table is full\n", name)); + return ERR_MEM; + } else { + /* use the oldest completed one */ + i = lseqi; + pEntry = &dns_table[i]; + } + } + + /* use this entry */ + LWIP_DEBUGF(DNS_DEBUG, ("dns_enqueue: \"%s\": use DNS entry %"U16_F"\n", name, (u16_t)(i))); + + /* fill the entry */ + pEntry->state = DNS_STATE_NEW; + pEntry->seqno = dns_seqno++; + pEntry->found = found; + pEntry->arg = callback_arg; + namelen = LWIP_MIN(strlen(name), DNS_MAX_NAME_LENGTH-1); + MEMCPY(pEntry->name, name, namelen); + pEntry->name[namelen] = 0; + + /* force to send query without waiting timer */ + dns_check_entry(i); + + /* dns query is enqueued */ + return ERR_INPROGRESS; +} + +/** + * Resolve a hostname (string) into an IP address. + * NON-BLOCKING callback version for use with raw API!!! + * + * Returns immediately with one of err_t return codes: + * - ERR_OK if hostname is a valid IP address string or the host + * name is already in the local names table. + * - ERR_INPROGRESS enqueue a request to be sent to the DNS server + * for resolution if no errors are present. + * - ERR_ARG: dns client not initialized or invalid hostname + * + * @param hostname the hostname that is to be queried + * @param addr pointer to a ip_addr_t where to store the address if it is already + * cached in the dns_table (only valid if ERR_OK is returned!) + * @param found a callback function to be called on success, failure or timeout (only if + * ERR_INPROGRESS is returned!) + * @param callback_arg argument to pass to the callback function + * @return a err_t return code. + */ +err_t +dns_gethostbyname(const char *hostname, ip_addr_t *addr, dns_found_callback found, + void *callback_arg) +{ + u32_t ipaddr; + /* not initialized or no valid server yet, or invalid addr pointer + * or invalid hostname or invalid hostname length */ + if ((dns_pcb == NULL) || (addr == NULL) || + (!hostname) || (!hostname[0]) || + (strlen(hostname) >= DNS_MAX_NAME_LENGTH)) { + return ERR_ARG; + } + +#if LWIP_HAVE_LOOPIF + if (strcmp(hostname, "localhost")==0) { + ip_addr_set_loopback(addr); + return ERR_OK; + } +#endif /* LWIP_HAVE_LOOPIF */ + + /* host name already in octet notation? set ip addr and return ERR_OK */ + ipaddr = ipaddr_addr(hostname); + if (ipaddr == IPADDR_NONE) { + /* already have this address cached? */ + ipaddr = dns_lookup(hostname); + } + if (ipaddr != IPADDR_NONE) { + ip4_addr_set_u32(addr, ipaddr); + return ERR_OK; + } + + /* queue query with specified callback */ + return dns_enqueue(hostname, found, callback_arg); +} + +#endif /* LWIP_DNS */ diff --git a/lib/drivers/lwip/src/core/init.c b/lib/drivers/lwip/src/core/init.c new file mode 100644 index 00000000000..bf5c79da0d6 --- /dev/null +++ b/lib/drivers/lwip/src/core/init.c @@ -0,0 +1,306 @@ +/** + * @file + * Modules initialization + * + */ + +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ + +#include "lwip/opt.h" + +#include "lwip/init.h" +#include "lwip/stats.h" +#include "lwip/sys.h" +#include "lwip/mem.h" +#include "lwip/memp.h" +#include "lwip/pbuf.h" +#include "lwip/netif.h" +#include "lwip/sockets.h" +#include "lwip/ip.h" +#include "lwip/raw.h" +#include "lwip/udp.h" +#include "lwip/tcp_impl.h" +#include "lwip/snmp_msg.h" +#include "lwip/autoip.h" +#include "lwip/igmp.h" +#include "lwip/dns.h" +#include "lwip/timers.h" +#include "netif/etharp.h" + +/* Compile-time sanity checks for configuration errors. + * These can be done independently of LWIP_DEBUG, without penalty. + */ +#ifndef BYTE_ORDER + #error "BYTE_ORDER is not defined, you have to define it in your cc.h" +#endif +#if (!IP_SOF_BROADCAST && IP_SOF_BROADCAST_RECV) + #error "If you want to use broadcast filter per pcb on recv operations, you have to define IP_SOF_BROADCAST=1 in your lwipopts.h" +#endif +#if (!LWIP_ARP && ARP_QUEUEING) + #error "If you want to use ARP Queueing, you have to define LWIP_ARP=1 in your lwipopts.h" +#endif +#if (!LWIP_UDP && LWIP_UDPLITE) + #error "If you want to use UDP Lite, you have to define LWIP_UDP=1 in your lwipopts.h" +#endif +#if (!LWIP_UDP && LWIP_SNMP) + #error "If you want to use SNMP, you have to define LWIP_UDP=1 in your lwipopts.h" +#endif +#if (!LWIP_UDP && LWIP_DHCP) + #error "If you want to use DHCP, you have to define LWIP_UDP=1 in your lwipopts.h" +#endif +#if (!LWIP_UDP && LWIP_IGMP) + #error "If you want to use IGMP, you have to define LWIP_UDP=1 in your lwipopts.h" +#endif +#if (!LWIP_UDP && LWIP_SNMP) + #error "If you want to use SNMP, you have to define LWIP_UDP=1 in your lwipopts.h" +#endif +#if (!LWIP_UDP && LWIP_DNS) + #error "If you want to use DNS, you have to define LWIP_UDP=1 in your lwipopts.h" +#endif +#if (LWIP_ARP && ARP_QUEUEING && (MEMP_NUM_ARP_QUEUE<=0)) + #error "If you want to use ARP Queueing, you have to define MEMP_NUM_ARP_QUEUE>=1 in your lwipopts.h" +#endif +#if (LWIP_RAW && (MEMP_NUM_RAW_PCB<=0)) + #error "If you want to use RAW, you have to define MEMP_NUM_RAW_PCB>=1 in your lwipopts.h" +#endif +#if (LWIP_UDP && (MEMP_NUM_UDP_PCB<=0)) + #error "If you want to use UDP, you have to define MEMP_NUM_UDP_PCB>=1 in your lwipopts.h" +#endif +#if (LWIP_TCP && (MEMP_NUM_TCP_PCB<=0)) + #error "If you want to use TCP, you have to define MEMP_NUM_TCP_PCB>=1 in your lwipopts.h" +#endif +#if (LWIP_TCP && (TCP_WND > 0xffff)) + #error "If you want to use TCP, TCP_WND must fit in an u16_t, so, you have to reduce it in your lwipopts.h" +#endif +#if (LWIP_TCP && (TCP_SND_QUEUELEN > 0xffff)) + #error "If you want to use TCP, TCP_SND_QUEUELEN must fit in an u16_t, so, you have to reduce it in your lwipopts.h" +#endif +#if (LWIP_TCP && (TCP_SND_QUEUELEN < 2)) + #error "TCP_SND_QUEUELEN must be at least 2 for no-copy TCP writes to work" +#endif +#if (LWIP_TCP && ((TCP_MAXRTX > 12) || (TCP_SYNMAXRTX > 12))) + #error "If you want to use TCP, TCP_MAXRTX and TCP_SYNMAXRTX must less or equal to 12 (due to tcp_backoff table), so, you have to reduce them in your lwipopts.h" +#endif +#if (LWIP_TCP && TCP_LISTEN_BACKLOG && (TCP_DEFAULT_LISTEN_BACKLOG < 0) || (TCP_DEFAULT_LISTEN_BACKLOG > 0xff)) + #error "If you want to use TCP backlog, TCP_DEFAULT_LISTEN_BACKLOG must fit into an u8_t" +#endif +#if (LWIP_IGMP && (MEMP_NUM_IGMP_GROUP<=1)) + #error "If you want to use IGMP, you have to define MEMP_NUM_IGMP_GROUP>1 in your lwipopts.h" +#endif +#if (LWIP_NETIF_API && (NO_SYS==1)) + #error "If you want to use NETIF API, you have to define NO_SYS=0 in your lwipopts.h" +#endif +#if ((LWIP_SOCKET || LWIP_NETCONN) && (NO_SYS==1)) + #error "If you want to use Sequential API, you have to define NO_SYS=0 in your lwipopts.h" +#endif +#if ((LWIP_NETCONN || LWIP_SOCKET) && (MEMP_NUM_TCPIP_MSG_API<=0)) + #error "If you want to use Sequential API, you have to define MEMP_NUM_TCPIP_MSG_API>=1 in your lwipopts.h" +#endif +#if (!LWIP_NETCONN && LWIP_SOCKET) + #error "If you want to use Socket API, you have to define LWIP_NETCONN=1 in your lwipopts.h" +#endif +#if (((!LWIP_DHCP) || (!LWIP_AUTOIP)) && LWIP_DHCP_AUTOIP_COOP) + #error "If you want to use DHCP/AUTOIP cooperation mode, you have to define LWIP_DHCP=1 and LWIP_AUTOIP=1 in your lwipopts.h" +#endif +#if (((!LWIP_DHCP) || (!LWIP_ARP)) && DHCP_DOES_ARP_CHECK) + #error "If you want to use DHCP ARP checking, you have to define LWIP_DHCP=1 and LWIP_ARP=1 in your lwipopts.h" +#endif +#if (!LWIP_ARP && LWIP_AUTOIP) + #error "If you want to use AUTOIP, you have to define LWIP_ARP=1 in your lwipopts.h" +#endif +#if (LWIP_SNMP && (SNMP_CONCURRENT_REQUESTS<=0)) + #error "If you want to use SNMP, you have to define SNMP_CONCURRENT_REQUESTS>=1 in your lwipopts.h" +#endif +#if (LWIP_SNMP && (SNMP_TRAP_DESTINATIONS<=0)) + #error "If you want to use SNMP, you have to define SNMP_TRAP_DESTINATIONS>=1 in your lwipopts.h" +#endif +#if (LWIP_TCP && ((LWIP_EVENT_API && LWIP_CALLBACK_API) || (!LWIP_EVENT_API && !LWIP_CALLBACK_API))) + #error "One and exactly one of LWIP_EVENT_API and LWIP_CALLBACK_API has to be enabled in your lwipopts.h" +#endif +/* There must be sufficient timeouts, taking into account requirements of the subsystems. */ +#if LWIP_TIMERS && (MEMP_NUM_SYS_TIMEOUT < (LWIP_TCP + IP_REASSEMBLY + LWIP_ARP + (2*LWIP_DHCP) + LWIP_AUTOIP + LWIP_IGMP + LWIP_DNS + PPP_SUPPORT)) + #error "MEMP_NUM_SYS_TIMEOUT is too low to accomodate all required timeouts" +#endif +#if (IP_REASSEMBLY && (MEMP_NUM_REASSDATA > IP_REASS_MAX_PBUFS)) + #error "MEMP_NUM_REASSDATA > IP_REASS_MAX_PBUFS doesn't make sense since each struct ip_reassdata must hold 2 pbufs at least!" +#endif +#if (MEM_LIBC_MALLOC && MEM_USE_POOLS) + #error "MEM_LIBC_MALLOC and MEM_USE_POOLS may not both be simultaneously enabled in your lwipopts.h" +#endif +#if (MEM_USE_POOLS && !MEMP_USE_CUSTOM_POOLS) + #error "MEM_USE_POOLS requires custom pools (MEMP_USE_CUSTOM_POOLS) to be enabled in your lwipopts.h" +#endif +#if (PBUF_POOL_BUFSIZE <= MEM_ALIGNMENT) + #error "PBUF_POOL_BUFSIZE must be greater than MEM_ALIGNMENT or the offset may take the full first pbuf" +#endif +#if (TCP_QUEUE_OOSEQ && !LWIP_TCP) + #error "TCP_QUEUE_OOSEQ requires LWIP_TCP" +#endif +#if (DNS_LOCAL_HOSTLIST && !DNS_LOCAL_HOSTLIST_IS_DYNAMIC && !(defined(DNS_LOCAL_HOSTLIST_INIT))) + #error "you have to define define DNS_LOCAL_HOSTLIST_INIT {{'host1', 0x123}, {'host2', 0x234}} to initialize DNS_LOCAL_HOSTLIST" +#endif +#if PPP_SUPPORT && !PPPOS_SUPPORT & !PPPOE_SUPPORT + #error "PPP_SUPPORT needs either PPPOS_SUPPORT or PPPOE_SUPPORT turned on" +#endif +#if !LWIP_ETHERNET && (LWIP_ARP || PPPOE_SUPPORT) + #error "LWIP_ETHERNET needs to be turned on for LWIP_ARP or PPPOE_SUPPORT" +#endif +#if LWIP_IGMP && !defined(LWIP_RAND) + #error "When using IGMP, LWIP_RAND() needs to be defined to a random-function returning an u32_t random value" +#endif +#if LWIP_TCPIP_CORE_LOCKING_INPUT && !LWIP_TCPIP_CORE_LOCKING + #error "When using LWIP_TCPIP_CORE_LOCKING_INPUT, LWIP_TCPIP_CORE_LOCKING must be enabled, too" +#endif +#if LWIP_TCP && LWIP_NETIF_TX_SINGLE_PBUF && !TCP_OVERSIZE + #error "LWIP_NETIF_TX_SINGLE_PBUF needs TCP_OVERSIZE enabled to create single-pbuf TCP packets" +#endif +#if IP_FRAG && IP_FRAG_USES_STATIC_BUF && LWIP_NETIF_TX_SINGLE_PBUF + #error "LWIP_NETIF_TX_SINGLE_PBUF does not work with IP_FRAG_USES_STATIC_BUF==1 as that creates pbuf queues" +#endif + + +/* Compile-time checks for deprecated options. + */ +#ifdef MEMP_NUM_TCPIP_MSG + #error "MEMP_NUM_TCPIP_MSG option is deprecated. Remove it from your lwipopts.h." +#endif +#ifdef MEMP_NUM_API_MSG + #error "MEMP_NUM_API_MSG option is deprecated. Remove it from your lwipopts.h." +#endif +#ifdef TCP_REXMIT_DEBUG + #error "TCP_REXMIT_DEBUG option is deprecated. Remove it from your lwipopts.h." +#endif +#ifdef RAW_STATS + #error "RAW_STATS option is deprecated. Remove it from your lwipopts.h." +#endif +#ifdef ETHARP_QUEUE_FIRST + #error "ETHARP_QUEUE_FIRST option is deprecated. Remove it from your lwipopts.h." +#endif +#ifdef ETHARP_ALWAYS_INSERT + #error "ETHARP_ALWAYS_INSERT option is deprecated. Remove it from your lwipopts.h." +#endif + +#ifdef LWIP_DEBUG +static void +lwip_sanity_check(void) +{ + /* Warnings */ +#if LWIP_NETCONN + if (MEMP_NUM_NETCONN > (MEMP_NUM_TCP_PCB+MEMP_NUM_TCP_PCB_LISTEN+MEMP_NUM_UDP_PCB+MEMP_NUM_RAW_PCB)) + LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: MEMP_NUM_NETCONN should be less than the sum of MEMP_NUM_{TCP,RAW,UDP}_PCB+MEMP_NUM_TCP_PCB_LISTEN\n")); +#endif /* LWIP_NETCONN */ +#if LWIP_TCP + if (MEMP_NUM_TCP_SEG < TCP_SND_QUEUELEN) + LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: MEMP_NUM_TCP_SEG should be at least as big as TCP_SND_QUEUELEN\n")); + if (TCP_SND_BUF < 2 * TCP_MSS) + LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: TCP_SND_BUF must be at least as much as (2 * TCP_MSS) for things to work smoothly\n")); + if (TCP_SND_QUEUELEN < (2 * (TCP_SND_BUF/TCP_MSS))) + LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: TCP_SND_QUEUELEN must be at least as much as (2 * TCP_SND_BUF/TCP_MSS) for things to work\n")); + if (TCP_SNDLOWAT >= TCP_SND_BUF) + LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: TCP_SNDLOWAT must be less than TCP_SND_BUF.\n")); + if (TCP_SNDQUEUELOWAT >= TCP_SND_QUEUELEN) + LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: TCP_SNDQUEUELOWAT must be less than TCP_SND_QUEUELEN.\n")); + if (TCP_WND > (PBUF_POOL_SIZE*PBUF_POOL_BUFSIZE)) + LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: TCP_WND is larger than space provided by PBUF_POOL_SIZE*PBUF_POOL_BUFSIZE\n")); + if (TCP_WND < TCP_MSS) + LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: TCP_WND is smaller than MSS\n")); +#endif /* LWIP_TCP */ +#if LWIP_SOCKET + /* Check that the SO_* socket options and SOF_* lwIP-internal flags match */ + if (SO_ACCEPTCONN != SOF_ACCEPTCONN) + LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: SO_ACCEPTCONN != SOF_ACCEPTCONN\n")); + if (SO_REUSEADDR != SOF_REUSEADDR) + LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: SO_REUSEADDR != SOF_REUSEADDR\n")); + if (SO_KEEPALIVE != SOF_KEEPALIVE) + LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: SO_KEEPALIVE != SOF_KEEPALIVE\n")); + if (SO_BROADCAST != SOF_BROADCAST) + LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: SO_BROADCAST != SOF_BROADCAST\n")); + if (SO_LINGER != SOF_LINGER) + LWIP_PLATFORM_DIAG(("lwip_sanity_check: WARNING: SO_LINGER != SOF_LINGER\n")); +#endif /* LWIP_SOCKET */ +} +#else /* LWIP_DEBUG */ +#define lwip_sanity_check() +#endif /* LWIP_DEBUG */ + +/** + * Perform Sanity check of user-configurable values, and initialize all modules. + */ +void +lwip_init(void) +{ + /* Sanity check user-configurable values */ + lwip_sanity_check(); + + /* Modules initialization */ + stats_init(); +#if !NO_SYS + sys_init(); +#endif /* !NO_SYS */ + mem_init(); + memp_init(); + pbuf_init(); + netif_init(); +#if LWIP_SOCKET + lwip_socket_init(); +#endif /* LWIP_SOCKET */ + ip_init(); +#if LWIP_ARP + etharp_init(); +#endif /* LWIP_ARP */ +#if LWIP_RAW + raw_init(); +#endif /* LWIP_RAW */ +#if LWIP_UDP + udp_init(); +#endif /* LWIP_UDP */ +#if LWIP_TCP + tcp_init(); +#endif /* LWIP_TCP */ +#if LWIP_SNMP + snmp_init(); +#endif /* LWIP_SNMP */ +#if LWIP_AUTOIP + autoip_init(); +#endif /* LWIP_AUTOIP */ +#if LWIP_IGMP + igmp_init(); +#endif /* LWIP_IGMP */ +#if LWIP_DNS + dns_init(); +#endif /* LWIP_DNS */ + +#if LWIP_TIMERS + sys_timeouts_init(); +#endif /* LWIP_TIMERS */ +} diff --git a/lib/drivers/lwip/src/core/ipv4/autoip.c b/lib/drivers/lwip/src/core/ipv4/autoip.c new file mode 100644 index 00000000000..92bb4591f1a --- /dev/null +++ b/lib/drivers/lwip/src/core/ipv4/autoip.c @@ -0,0 +1,536 @@ +/** + * @file + * AutoIP Automatic LinkLocal IP Configuration + * + */ + +/* + * + * Copyright (c) 2007 Dominik Spies + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * Author: Dominik Spies + * + * This is a AutoIP implementation for the lwIP TCP/IP stack. It aims to conform + * with RFC 3927. + * + * + * Please coordinate changes and requests with Dominik Spies + * + */ + +/******************************************************************************* + * USAGE: + * + * define LWIP_AUTOIP 1 in your lwipopts.h + * + * If you don't use tcpip.c (so, don't call, you don't call tcpip_init): + * - First, call autoip_init(). + * - call autoip_tmr() all AUTOIP_TMR_INTERVAL msces, + * that should be defined in autoip.h. + * I recommend a value of 100. The value must divide 1000 with a remainder almost 0. + * Possible values are 1000, 500, 333, 250, 200, 166, 142, 125, 111, 100 .... + * + * Without DHCP: + * - Call autoip_start() after netif_add(). + * + * With DHCP: + * - define LWIP_DHCP_AUTOIP_COOP 1 in your lwipopts.h. + * - Configure your DHCP Client. + * + */ + +#include "lwip/opt.h" + +#if LWIP_AUTOIP /* don't build if not configured for use in lwipopts.h */ + +#include "lwip/mem.h" +#include "lwip/udp.h" +#include "lwip/ip_addr.h" +#include "lwip/netif.h" +#include "lwip/autoip.h" +#include "netif/etharp.h" + +#include +#include + +/* 169.254.0.0 */ +#define AUTOIP_NET 0xA9FE0000 +/* 169.254.1.0 */ +#define AUTOIP_RANGE_START (AUTOIP_NET | 0x0100) +/* 169.254.254.255 */ +#define AUTOIP_RANGE_END (AUTOIP_NET | 0xFEFF) + + +/** Pseudo random macro based on netif informations. + * You could use "rand()" from the C Library if you define LWIP_AUTOIP_RAND in lwipopts.h */ +#ifndef LWIP_AUTOIP_RAND +#define LWIP_AUTOIP_RAND(netif) ( (((u32_t)((netif->hwaddr[5]) & 0xff) << 24) | \ + ((u32_t)((netif->hwaddr[3]) & 0xff) << 16) | \ + ((u32_t)((netif->hwaddr[2]) & 0xff) << 8) | \ + ((u32_t)((netif->hwaddr[4]) & 0xff))) + \ + (netif->autoip?netif->autoip->tried_llipaddr:0)) +#endif /* LWIP_AUTOIP_RAND */ + +/** + * Macro that generates the initial IP address to be tried by AUTOIP. + * If you want to override this, define it to something else in lwipopts.h. + */ +#ifndef LWIP_AUTOIP_CREATE_SEED_ADDR +#define LWIP_AUTOIP_CREATE_SEED_ADDR(netif) \ + htonl(AUTOIP_RANGE_START + ((u32_t)(((u8_t)(netif->hwaddr[4])) | \ + ((u32_t)((u8_t)(netif->hwaddr[5]))) << 8))) +#endif /* LWIP_AUTOIP_CREATE_SEED_ADDR */ + +/* static functions */ +static void autoip_handle_arp_conflict(struct netif *netif); + +/* creates a pseudo random LL IP-Address for a network interface */ +static void autoip_create_addr(struct netif *netif, ip_addr_t *ipaddr); + +/* sends an ARP probe */ +static err_t autoip_arp_probe(struct netif *netif); + +/* sends an ARP announce */ +static err_t autoip_arp_announce(struct netif *netif); + +/* configure interface for use with current LL IP-Address */ +static err_t autoip_bind(struct netif *netif); + +/* start sending probes for llipaddr */ +static void autoip_start_probing(struct netif *netif); + +/** + * Initialize this module + */ +void +autoip_init(void) +{ + LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE, ("autoip_init()\n")); +} + +/** Set a statically allocated struct autoip to work with. + * Using this prevents autoip_start to allocate it using mem_malloc. + * + * @param netif the netif for which to set the struct autoip + * @param dhcp (uninitialised) dhcp struct allocated by the application + */ +void +autoip_set_struct(struct netif *netif, struct autoip *autoip) +{ + LWIP_ASSERT("netif != NULL", netif != NULL); + LWIP_ASSERT("autoip != NULL", autoip != NULL); + LWIP_ASSERT("netif already has a struct autoip set", netif->autoip == NULL); + + /* clear data structure */ + memset(autoip, 0, sizeof(struct autoip)); + /* autoip->state = AUTOIP_STATE_OFF; */ + netif->autoip = autoip; +} + +/** Restart AutoIP client and check the next address (conflict detected) + * + * @param netif The netif under AutoIP control + */ +static void +autoip_restart(struct netif *netif) +{ + netif->autoip->tried_llipaddr++; + autoip_start(netif); +} + +/** + * Handle a IP address conflict after an ARP conflict detection + */ +static void +autoip_handle_arp_conflict(struct netif *netif) +{ + /* Somehow detect if we are defending or retreating */ + unsigned char defend = 1; /* tbd */ + + if(defend) { + if(netif->autoip->lastconflict > 0) { + /* retreat, there was a conflicting ARP in the last + * DEFEND_INTERVAL seconds + */ + LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, + ("autoip_handle_arp_conflict(): we are defending, but in DEFEND_INTERVAL, retreating\n")); + + /* TODO: close all TCP sessions */ + autoip_restart(netif); + } else { + LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, + ("autoip_handle_arp_conflict(): we are defend, send ARP Announce\n")); + autoip_arp_announce(netif); + netif->autoip->lastconflict = DEFEND_INTERVAL * AUTOIP_TICKS_PER_SECOND; + } + } else { + LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, + ("autoip_handle_arp_conflict(): we do not defend, retreating\n")); + /* TODO: close all TCP sessions */ + autoip_restart(netif); + } +} + +/** + * Create an IP-Address out of range 169.254.1.0 to 169.254.254.255 + * + * @param netif network interface on which create the IP-Address + * @param ipaddr ip address to initialize + */ +static void +autoip_create_addr(struct netif *netif, ip_addr_t *ipaddr) +{ + /* Here we create an IP-Address out of range 169.254.1.0 to 169.254.254.255 + * compliant to RFC 3927 Section 2.1 + * We have 254 * 256 possibilities */ + + u32_t addr = ntohl(LWIP_AUTOIP_CREATE_SEED_ADDR(netif)); + addr += netif->autoip->tried_llipaddr; + addr = AUTOIP_NET | (addr & 0xffff); + /* Now, 169.254.0.0 <= addr <= 169.254.255.255 */ + + if (addr < AUTOIP_RANGE_START) { + addr += AUTOIP_RANGE_END - AUTOIP_RANGE_START + 1; + } + if (addr > AUTOIP_RANGE_END) { + addr -= AUTOIP_RANGE_END - AUTOIP_RANGE_START + 1; + } + LWIP_ASSERT("AUTOIP address not in range", (addr >= AUTOIP_RANGE_START) && + (addr <= AUTOIP_RANGE_END)); + ip4_addr_set_u32(ipaddr, htonl(addr)); + + LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, + ("autoip_create_addr(): tried_llipaddr=%"U16_F", %"U16_F".%"U16_F".%"U16_F".%"U16_F"\n", + (u16_t)(netif->autoip->tried_llipaddr), ip4_addr1_16(ipaddr), ip4_addr2_16(ipaddr), + ip4_addr3_16(ipaddr), ip4_addr4_16(ipaddr))); +} + +/** + * Sends an ARP probe from a network interface + * + * @param netif network interface used to send the probe + */ +static err_t +autoip_arp_probe(struct netif *netif) +{ + return etharp_raw(netif, (struct eth_addr *)netif->hwaddr, ðbroadcast, + (struct eth_addr *)netif->hwaddr, IP_ADDR_ANY, ðzero, + &netif->autoip->llipaddr, ARP_REQUEST); +} + +/** + * Sends an ARP announce from a network interface + * + * @param netif network interface used to send the announce + */ +static err_t +autoip_arp_announce(struct netif *netif) +{ + return etharp_raw(netif, (struct eth_addr *)netif->hwaddr, ðbroadcast, + (struct eth_addr *)netif->hwaddr, &netif->autoip->llipaddr, ðzero, + &netif->autoip->llipaddr, ARP_REQUEST); +} + +/** + * Configure interface for use with current LL IP-Address + * + * @param netif network interface to configure with current LL IP-Address + */ +static err_t +autoip_bind(struct netif *netif) +{ + struct autoip *autoip = netif->autoip; + ip_addr_t sn_mask, gw_addr; + + LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE, + ("autoip_bind(netif=%p) %c%c%"U16_F" %"U16_F".%"U16_F".%"U16_F".%"U16_F"\n", + (void*)netif, netif->name[0], netif->name[1], (u16_t)netif->num, + ip4_addr1_16(&autoip->llipaddr), ip4_addr2_16(&autoip->llipaddr), + ip4_addr3_16(&autoip->llipaddr), ip4_addr4_16(&autoip->llipaddr))); + + IP4_ADDR(&sn_mask, 255, 255, 0, 0); + IP4_ADDR(&gw_addr, 0, 0, 0, 0); + + netif_set_ipaddr(netif, &autoip->llipaddr); + netif_set_netmask(netif, &sn_mask); + netif_set_gw(netif, &gw_addr); + + /* bring the interface up */ + netif_set_up(netif); + + return ERR_OK; +} + +/** + * Start AutoIP client + * + * @param netif network interface on which start the AutoIP client + */ +err_t +autoip_start(struct netif *netif) +{ + struct autoip *autoip = netif->autoip; + err_t result = ERR_OK; + + if(netif_is_up(netif)) { + netif_set_down(netif); + } + + /* Set IP-Address, Netmask and Gateway to 0 to make sure that + * ARP Packets are formed correctly + */ + ip_addr_set_zero(&netif->ip_addr); + ip_addr_set_zero(&netif->netmask); + ip_addr_set_zero(&netif->gw); + + LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, + ("autoip_start(netif=%p) %c%c%"U16_F"\n", (void*)netif, netif->name[0], + netif->name[1], (u16_t)netif->num)); + if(autoip == NULL) { + /* no AutoIP client attached yet? */ + LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE, + ("autoip_start(): starting new AUTOIP client\n")); + autoip = (struct autoip *)mem_malloc(sizeof(struct autoip)); + if(autoip == NULL) { + LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE, + ("autoip_start(): could not allocate autoip\n")); + return ERR_MEM; + } + memset(autoip, 0, sizeof(struct autoip)); + /* store this AutoIP client in the netif */ + netif->autoip = autoip; + LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE, ("autoip_start(): allocated autoip")); + } else { + autoip->state = AUTOIP_STATE_OFF; + autoip->ttw = 0; + autoip->sent_num = 0; + ip_addr_set_zero(&autoip->llipaddr); + autoip->lastconflict = 0; + } + + autoip_create_addr(netif, &(autoip->llipaddr)); + autoip_start_probing(netif); + + return result; +} + +static void +autoip_start_probing(struct netif *netif) +{ + struct autoip *autoip = netif->autoip; + + autoip->state = AUTOIP_STATE_PROBING; + autoip->sent_num = 0; + LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, + ("autoip_start_probing(): changing state to PROBING: %"U16_F".%"U16_F".%"U16_F".%"U16_F"\n", + ip4_addr1_16(&netif->autoip->llipaddr), ip4_addr2_16(&netif->autoip->llipaddr), + ip4_addr3_16(&netif->autoip->llipaddr), ip4_addr4_16(&netif->autoip->llipaddr))); + + /* time to wait to first probe, this is randomly + * choosen out of 0 to PROBE_WAIT seconds. + * compliant to RFC 3927 Section 2.2.1 + */ + autoip->ttw = (u16_t)(LWIP_AUTOIP_RAND(netif) % (PROBE_WAIT * AUTOIP_TICKS_PER_SECOND)); + + /* + * if we tried more then MAX_CONFLICTS we must limit our rate for + * accquiring and probing address + * compliant to RFC 3927 Section 2.2.1 + */ + if(autoip->tried_llipaddr > MAX_CONFLICTS) { + autoip->ttw = RATE_LIMIT_INTERVAL * AUTOIP_TICKS_PER_SECOND; + } +} + +/** + * Handle a possible change in the network configuration. + * + * If there is an AutoIP address configured, take the interface down + * and begin probing with the same address. + */ +void +autoip_network_changed(struct netif *netif) +{ + if (netif->autoip && netif->autoip->state != AUTOIP_STATE_OFF) { + netif_set_down(netif); + autoip_start_probing(netif); + } +} + +/** + * Stop AutoIP client + * + * @param netif network interface on which stop the AutoIP client + */ +err_t +autoip_stop(struct netif *netif) +{ + netif->autoip->state = AUTOIP_STATE_OFF; + netif_set_down(netif); + return ERR_OK; +} + +/** + * Has to be called in loop every AUTOIP_TMR_INTERVAL milliseconds + */ +void +autoip_tmr() +{ + struct netif *netif = netif_list; + /* loop through netif's */ + while (netif != NULL) { + /* only act on AutoIP configured interfaces */ + if (netif->autoip != NULL) { + if(netif->autoip->lastconflict > 0) { + netif->autoip->lastconflict--; + } + + LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE, + ("autoip_tmr() AutoIP-State: %"U16_F", ttw=%"U16_F"\n", + (u16_t)(netif->autoip->state), netif->autoip->ttw)); + + switch(netif->autoip->state) { + case AUTOIP_STATE_PROBING: + if(netif->autoip->ttw > 0) { + netif->autoip->ttw--; + } else { + if(netif->autoip->sent_num >= PROBE_NUM) { + netif->autoip->state = AUTOIP_STATE_ANNOUNCING; + netif->autoip->sent_num = 0; + netif->autoip->ttw = ANNOUNCE_WAIT * AUTOIP_TICKS_PER_SECOND; + LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, + ("autoip_tmr(): changing state to ANNOUNCING: %"U16_F".%"U16_F".%"U16_F".%"U16_F"\n", + ip4_addr1_16(&netif->autoip->llipaddr), ip4_addr2_16(&netif->autoip->llipaddr), + ip4_addr3_16(&netif->autoip->llipaddr), ip4_addr4_16(&netif->autoip->llipaddr))); + } else { + autoip_arp_probe(netif); + LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE, + ("autoip_tmr() PROBING Sent Probe\n")); + netif->autoip->sent_num++; + /* calculate time to wait to next probe */ + netif->autoip->ttw = (u16_t)((LWIP_AUTOIP_RAND(netif) % + ((PROBE_MAX - PROBE_MIN) * AUTOIP_TICKS_PER_SECOND) ) + + PROBE_MIN * AUTOIP_TICKS_PER_SECOND); + } + } + break; + + case AUTOIP_STATE_ANNOUNCING: + if(netif->autoip->ttw > 0) { + netif->autoip->ttw--; + } else { + if(netif->autoip->sent_num == 0) { + /* We are here the first time, so we waited ANNOUNCE_WAIT seconds + * Now we can bind to an IP address and use it. + * + * autoip_bind calls netif_set_up. This triggers a gratuitous ARP + * which counts as an announcement. + */ + autoip_bind(netif); + } else { + autoip_arp_announce(netif); + LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE, + ("autoip_tmr() ANNOUNCING Sent Announce\n")); + } + netif->autoip->ttw = ANNOUNCE_INTERVAL * AUTOIP_TICKS_PER_SECOND; + netif->autoip->sent_num++; + + if(netif->autoip->sent_num >= ANNOUNCE_NUM) { + netif->autoip->state = AUTOIP_STATE_BOUND; + netif->autoip->sent_num = 0; + netif->autoip->ttw = 0; + LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, + ("autoip_tmr(): changing state to BOUND: %"U16_F".%"U16_F".%"U16_F".%"U16_F"\n", + ip4_addr1_16(&netif->autoip->llipaddr), ip4_addr2_16(&netif->autoip->llipaddr), + ip4_addr3_16(&netif->autoip->llipaddr), ip4_addr4_16(&netif->autoip->llipaddr))); + } + } + break; + } + } + /* proceed to next network interface */ + netif = netif->next; + } +} + +/** + * Handles every incoming ARP Packet, called by etharp_arp_input. + * + * @param netif network interface to use for autoip processing + * @param hdr Incoming ARP packet + */ +void +autoip_arp_reply(struct netif *netif, struct etharp_hdr *hdr) +{ + LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE, ("autoip_arp_reply()\n")); + if ((netif->autoip != NULL) && (netif->autoip->state != AUTOIP_STATE_OFF)) { + /* when ip.src == llipaddr && hw.src != netif->hwaddr + * + * when probing ip.dst == llipaddr && hw.src != netif->hwaddr + * we have a conflict and must solve it + */ + ip_addr_t sipaddr, dipaddr; + struct eth_addr netifaddr; + ETHADDR16_COPY(netifaddr.addr, netif->hwaddr); + + /* Copy struct ip_addr2 to aligned ip_addr, to support compilers without + * structure packing (not using structure copy which breaks strict-aliasing rules). + */ + IPADDR2_COPY(&sipaddr, &hdr->sipaddr); + IPADDR2_COPY(&dipaddr, &hdr->dipaddr); + + if ((netif->autoip->state == AUTOIP_STATE_PROBING) || + ((netif->autoip->state == AUTOIP_STATE_ANNOUNCING) && + (netif->autoip->sent_num == 0))) { + /* RFC 3927 Section 2.2.1: + * from beginning to after ANNOUNCE_WAIT + * seconds we have a conflict if + * ip.src == llipaddr OR + * ip.dst == llipaddr && hw.src != own hwaddr + */ + if ((ip_addr_cmp(&sipaddr, &netif->autoip->llipaddr)) || + (ip_addr_cmp(&dipaddr, &netif->autoip->llipaddr) && + !eth_addr_cmp(&netifaddr, &hdr->shwaddr))) { + LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE | LWIP_DBG_LEVEL_WARNING, + ("autoip_arp_reply(): Probe Conflict detected\n")); + autoip_restart(netif); + } + } else { + /* RFC 3927 Section 2.5: + * in any state we have a conflict if + * ip.src == llipaddr && hw.src != own hwaddr + */ + if (ip_addr_cmp(&sipaddr, &netif->autoip->llipaddr) && + !eth_addr_cmp(&netifaddr, &hdr->shwaddr)) { + LWIP_DEBUGF(AUTOIP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE | LWIP_DBG_LEVEL_WARNING, + ("autoip_arp_reply(): Conflicting ARP-Packet detected\n")); + autoip_handle_arp_conflict(netif); + } + } + } +} + +#endif /* LWIP_AUTOIP */ diff --git a/lib/drivers/lwip/src/core/ipv4/icmp.c b/lib/drivers/lwip/src/core/ipv4/icmp.c new file mode 100644 index 00000000000..32902a522ca --- /dev/null +++ b/lib/drivers/lwip/src/core/ipv4/icmp.c @@ -0,0 +1,335 @@ +/** + * @file + * ICMP - Internet Control Message Protocol + * + */ + +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ + +/* Some ICMP messages should be passed to the transport protocols. This + is not implemented. */ + +#include "lwip/opt.h" + +#if LWIP_ICMP /* don't build if not configured for use in lwipopts.h */ + +#include "lwip/icmp.h" +#include "lwip/inet_chksum.h" +#include "lwip/ip.h" +#include "lwip/def.h" +#include "lwip/stats.h" +#include "lwip/snmp.h" + +#include + +/** Small optimization: set to 0 if incoming PBUF_POOL pbuf always can be + * used to modify and send a response packet (and to 1 if this is not the case, + * e.g. when link header is stripped of when receiving) */ +#ifndef LWIP_ICMP_ECHO_CHECK_INPUT_PBUF_LEN +#define LWIP_ICMP_ECHO_CHECK_INPUT_PBUF_LEN 1 +#endif /* LWIP_ICMP_ECHO_CHECK_INPUT_PBUF_LEN */ + +/* The amount of data from the original packet to return in a dest-unreachable */ +#define ICMP_DEST_UNREACH_DATASIZE 8 + +static void icmp_send_response(struct pbuf *p, u8_t type, u8_t code); + +/** + * Processes ICMP input packets, called from ip_input(). + * + * Currently only processes icmp echo requests and sends + * out the echo response. + * + * @param p the icmp echo request packet, p->payload pointing to the ip header + * @param inp the netif on which this packet was received + */ +void +icmp_input(struct pbuf *p, struct netif *inp) +{ + u8_t type; +#ifdef LWIP_DEBUG + u8_t code; +#endif /* LWIP_DEBUG */ + struct icmp_echo_hdr *iecho; + struct ip_hdr *iphdr; + s16_t hlen; + + ICMP_STATS_INC(icmp.recv); + snmp_inc_icmpinmsgs(); + + + iphdr = (struct ip_hdr *)p->payload; + hlen = IPH_HL(iphdr) * 4; + if (pbuf_header(p, -hlen) || (p->tot_len < sizeof(u16_t)*2)) { + LWIP_DEBUGF(ICMP_DEBUG, ("icmp_input: short ICMP (%"U16_F" bytes) received\n", p->tot_len)); + goto lenerr; + } + + type = *((u8_t *)p->payload); +#ifdef LWIP_DEBUG + code = *(((u8_t *)p->payload)+1); +#endif /* LWIP_DEBUG */ + switch (type) { + case ICMP_ER: + /* This is OK, echo reply might have been parsed by a raw PCB + (as obviously, an echo request has been sent, too). */ + break; + case ICMP_ECHO: +#if !LWIP_MULTICAST_PING || !LWIP_BROADCAST_PING + { + int accepted = 1; +#if !LWIP_MULTICAST_PING + /* multicast destination address? */ + if (ip_addr_ismulticast(¤t_iphdr_dest)) { + accepted = 0; + } +#endif /* LWIP_MULTICAST_PING */ +#if !LWIP_BROADCAST_PING + /* broadcast destination address? */ + if (ip_addr_isbroadcast(¤t_iphdr_dest, inp)) { + accepted = 0; + } +#endif /* LWIP_BROADCAST_PING */ + /* broadcast or multicast destination address not acceptd? */ + if (!accepted) { + LWIP_DEBUGF(ICMP_DEBUG, ("icmp_input: Not echoing to multicast or broadcast pings\n")); + ICMP_STATS_INC(icmp.err); + pbuf_free(p); + return; + } + } +#endif /* !LWIP_MULTICAST_PING || !LWIP_BROADCAST_PING */ + LWIP_DEBUGF(ICMP_DEBUG, ("icmp_input: ping\n")); + if (p->tot_len < sizeof(struct icmp_echo_hdr)) { + LWIP_DEBUGF(ICMP_DEBUG, ("icmp_input: bad ICMP echo received\n")); + goto lenerr; + } + if (inet_chksum_pbuf(p) != 0) { + LWIP_DEBUGF(ICMP_DEBUG, ("icmp_input: checksum failed for received ICMP echo\n")); + pbuf_free(p); + ICMP_STATS_INC(icmp.chkerr); + snmp_inc_icmpinerrors(); + return; + } +#if LWIP_ICMP_ECHO_CHECK_INPUT_PBUF_LEN + if (pbuf_header(p, (PBUF_IP_HLEN + PBUF_LINK_HLEN))) { + /* p is not big enough to contain link headers + * allocate a new one and copy p into it + */ + struct pbuf *r; + /* switch p->payload to ip header */ + if (pbuf_header(p, hlen)) { + LWIP_ASSERT("icmp_input: moving p->payload to ip header failed\n", 0); + goto memerr; + } + /* allocate new packet buffer with space for link headers */ + r = pbuf_alloc(PBUF_LINK, p->tot_len, PBUF_RAM); + if (r == NULL) { + LWIP_DEBUGF(ICMP_DEBUG, ("icmp_input: allocating new pbuf failed\n")); + goto memerr; + } + LWIP_ASSERT("check that first pbuf can hold struct the ICMP header", + (r->len >= hlen + sizeof(struct icmp_echo_hdr))); + /* copy the whole packet including ip header */ + if (pbuf_copy(r, p) != ERR_OK) { + LWIP_ASSERT("icmp_input: copying to new pbuf failed\n", 0); + goto memerr; + } + iphdr = (struct ip_hdr *)r->payload; + /* switch r->payload back to icmp header */ + if (pbuf_header(r, -hlen)) { + LWIP_ASSERT("icmp_input: restoring original p->payload failed\n", 0); + goto memerr; + } + /* free the original p */ + pbuf_free(p); + /* we now have an identical copy of p that has room for link headers */ + p = r; + } else { + /* restore p->payload to point to icmp header */ + if (pbuf_header(p, -(s16_t)(PBUF_IP_HLEN + PBUF_LINK_HLEN))) { + LWIP_ASSERT("icmp_input: restoring original p->payload failed\n", 0); + goto memerr; + } + } +#endif /* LWIP_ICMP_ECHO_CHECK_INPUT_PBUF_LEN */ + /* At this point, all checks are OK. */ + /* We generate an answer by switching the dest and src ip addresses, + * setting the icmp type to ECHO_RESPONSE and updating the checksum. */ + iecho = (struct icmp_echo_hdr *)p->payload; + ip_addr_copy(iphdr->src, *ip_current_dest_addr()); + ip_addr_copy(iphdr->dest, *ip_current_src_addr()); + ICMPH_TYPE_SET(iecho, ICMP_ER); + /* adjust the checksum */ + if (iecho->chksum >= PP_HTONS(0xffffU - (ICMP_ECHO << 8))) { + iecho->chksum += PP_HTONS(ICMP_ECHO << 8) + 1; + } else { + iecho->chksum += PP_HTONS(ICMP_ECHO << 8); + } + + /* Set the correct TTL and recalculate the header checksum. */ + IPH_TTL_SET(iphdr, ICMP_TTL); + IPH_CHKSUM_SET(iphdr, 0); +#if CHECKSUM_GEN_IP + IPH_CHKSUM_SET(iphdr, inet_chksum(iphdr, IP_HLEN)); +#endif /* CHECKSUM_GEN_IP */ + + ICMP_STATS_INC(icmp.xmit); + /* increase number of messages attempted to send */ + snmp_inc_icmpoutmsgs(); + /* increase number of echo replies attempted to send */ + snmp_inc_icmpoutechoreps(); + + if(pbuf_header(p, hlen)) { + LWIP_ASSERT("Can't move over header in packet", 0); + } else { + err_t ret; + /* send an ICMP packet, src addr is the dest addr of the curren packet */ + ret = ip_output_if(p, ip_current_dest_addr(), IP_HDRINCL, + ICMP_TTL, 0, IP_PROTO_ICMP, inp); + if (ret != ERR_OK) { + LWIP_DEBUGF(ICMP_DEBUG, ("icmp_input: ip_output_if returned an error: %c.\n", ret)); + } + } + break; + default: + LWIP_DEBUGF(ICMP_DEBUG, ("icmp_input: ICMP type %"S16_F" code %"S16_F" not supported.\n", + (s16_t)type, (s16_t)code)); + ICMP_STATS_INC(icmp.proterr); + ICMP_STATS_INC(icmp.drop); + } + pbuf_free(p); + return; +lenerr: + pbuf_free(p); + ICMP_STATS_INC(icmp.lenerr); + snmp_inc_icmpinerrors(); + return; +#if LWIP_ICMP_ECHO_CHECK_INPUT_PBUF_LEN +memerr: + pbuf_free(p); + ICMP_STATS_INC(icmp.err); + snmp_inc_icmpinerrors(); + return; +#endif /* LWIP_ICMP_ECHO_CHECK_INPUT_PBUF_LEN */ +} + +/** + * Send an icmp 'destination unreachable' packet, called from ip_input() if + * the transport layer protocol is unknown and from udp_input() if the local + * port is not bound. + * + * @param p the input packet for which the 'unreachable' should be sent, + * p->payload pointing to the IP header + * @param t type of the 'unreachable' packet + */ +void +icmp_dest_unreach(struct pbuf *p, enum icmp_dur_type t) +{ + icmp_send_response(p, ICMP_DUR, t); +} + +#if IP_FORWARD || IP_REASSEMBLY +/** + * Send a 'time exceeded' packet, called from ip_forward() if TTL is 0. + * + * @param p the input packet for which the 'time exceeded' should be sent, + * p->payload pointing to the IP header + * @param t type of the 'time exceeded' packet + */ +void +icmp_time_exceeded(struct pbuf *p, enum icmp_te_type t) +{ + icmp_send_response(p, ICMP_TE, t); +} + +#endif /* IP_FORWARD || IP_REASSEMBLY */ + +/** + * Send an icmp packet in response to an incoming packet. + * + * @param p the input packet for which the 'unreachable' should be sent, + * p->payload pointing to the IP header + * @param type Type of the ICMP header + * @param code Code of the ICMP header + */ +static void +icmp_send_response(struct pbuf *p, u8_t type, u8_t code) +{ + struct pbuf *q; + struct ip_hdr *iphdr; + /* we can use the echo header here */ + struct icmp_echo_hdr *icmphdr; + ip_addr_t iphdr_src; + + /* ICMP header + IP header + 8 bytes of data */ + q = pbuf_alloc(PBUF_IP, sizeof(struct icmp_echo_hdr) + IP_HLEN + ICMP_DEST_UNREACH_DATASIZE, + PBUF_RAM); + if (q == NULL) { + LWIP_DEBUGF(ICMP_DEBUG, ("icmp_time_exceeded: failed to allocate pbuf for ICMP packet.\n")); + return; + } + LWIP_ASSERT("check that first pbuf can hold icmp message", + (q->len >= (sizeof(struct icmp_echo_hdr) + IP_HLEN + ICMP_DEST_UNREACH_DATASIZE))); + + iphdr = (struct ip_hdr *)p->payload; + LWIP_DEBUGF(ICMP_DEBUG, ("icmp_time_exceeded from ")); + ip_addr_debug_print(ICMP_DEBUG, &(iphdr->src)); + LWIP_DEBUGF(ICMP_DEBUG, (" to ")); + ip_addr_debug_print(ICMP_DEBUG, &(iphdr->dest)); + LWIP_DEBUGF(ICMP_DEBUG, ("\n")); + + icmphdr = (struct icmp_echo_hdr *)q->payload; + icmphdr->type = type; + icmphdr->code = code; + icmphdr->id = 0; + icmphdr->seqno = 0; + + /* copy fields from original packet */ + SMEMCPY((u8_t *)q->payload + sizeof(struct icmp_echo_hdr), (u8_t *)p->payload, + IP_HLEN + ICMP_DEST_UNREACH_DATASIZE); + + /* calculate checksum */ + icmphdr->chksum = 0; + icmphdr->chksum = inet_chksum(icmphdr, q->len); + ICMP_STATS_INC(icmp.xmit); + /* increase number of messages attempted to send */ + snmp_inc_icmpoutmsgs(); + /* increase number of destination unreachable messages attempted to send */ + snmp_inc_icmpouttimeexcds(); + ip_addr_copy(iphdr_src, iphdr->src); + ip_output(q, NULL, &iphdr_src, ICMP_TTL, 0, IP_PROTO_ICMP); + pbuf_free(q); +} + +#endif /* LWIP_ICMP */ diff --git a/lib/drivers/lwip/src/core/ipv4/igmp.c b/lib/drivers/lwip/src/core/ipv4/igmp.c new file mode 100644 index 00000000000..4e4405e16f9 --- /dev/null +++ b/lib/drivers/lwip/src/core/ipv4/igmp.c @@ -0,0 +1,817 @@ +/** + * @file + * IGMP - Internet Group Management Protocol + * + */ + +/* + * Copyright (c) 2002 CITEL Technologies Ltd. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of CITEL Technologies Ltd nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY CITEL TECHNOLOGIES AND CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL CITEL TECHNOLOGIES OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This file is a contribution to the lwIP TCP/IP stack. + * The Swedish Institute of Computer Science and Adam Dunkels + * are specifically granted permission to redistribute this + * source code. +*/ + +/*------------------------------------------------------------- +Note 1) +Although the rfc requires V1 AND V2 capability +we will only support v2 since now V1 is very old (August 1989) +V1 can be added if required + +a debug print and statistic have been implemented to +show this up. +------------------------------------------------------------- +------------------------------------------------------------- +Note 2) +A query for a specific group address (as opposed to ALLHOSTS) +has now been implemented as I am unsure if it is required + +a debug print and statistic have been implemented to +show this up. +------------------------------------------------------------- +------------------------------------------------------------- +Note 3) +The router alert rfc 2113 is implemented in outgoing packets +but not checked rigorously incoming +------------------------------------------------------------- +Steve Reynolds +------------------------------------------------------------*/ + +/*----------------------------------------------------------------------------- + * RFC 988 - Host extensions for IP multicasting - V0 + * RFC 1054 - Host extensions for IP multicasting - + * RFC 1112 - Host extensions for IP multicasting - V1 + * RFC 2236 - Internet Group Management Protocol, Version 2 - V2 <- this code is based on this RFC (it's the "de facto" standard) + * RFC 3376 - Internet Group Management Protocol, Version 3 - V3 + * RFC 4604 - Using Internet Group Management Protocol Version 3... - V3+ + * RFC 2113 - IP Router Alert Option - + *----------------------------------------------------------------------------*/ + +/*----------------------------------------------------------------------------- + * Includes + *----------------------------------------------------------------------------*/ + +#include "lwip/opt.h" + +#if LWIP_IGMP /* don't build if not configured for use in lwipopts.h */ + +#include "lwip/igmp.h" +#include "lwip/debug.h" +#include "lwip/def.h" +#include "lwip/mem.h" +#include "lwip/ip.h" +#include "lwip/inet_chksum.h" +#include "lwip/netif.h" +#include "lwip/icmp.h" +#include "lwip/udp.h" +#include "lwip/tcp.h" +#include "lwip/stats.h" + +#include "string.h" + +/* + * IGMP constants + */ +#define IGMP_TTL 1 +#define IGMP_MINLEN 8 +#define ROUTER_ALERT 0x9404U +#define ROUTER_ALERTLEN 4 + +/* + * IGMP message types, including version number. + */ +#define IGMP_MEMB_QUERY 0x11 /* Membership query */ +#define IGMP_V1_MEMB_REPORT 0x12 /* Ver. 1 membership report */ +#define IGMP_V2_MEMB_REPORT 0x16 /* Ver. 2 membership report */ +#define IGMP_LEAVE_GROUP 0x17 /* Leave-group message */ + +/* Group membership states */ +#define IGMP_GROUP_NON_MEMBER 0 +#define IGMP_GROUP_DELAYING_MEMBER 1 +#define IGMP_GROUP_IDLE_MEMBER 2 + +/** + * IGMP packet format. + */ +#ifdef PACK_STRUCT_USE_INCLUDES +# include "arch/bpstruct.h" +#endif +PACK_STRUCT_BEGIN +struct igmp_msg { + PACK_STRUCT_FIELD(u8_t igmp_msgtype); + PACK_STRUCT_FIELD(u8_t igmp_maxresp); + PACK_STRUCT_FIELD(u16_t igmp_checksum); + PACK_STRUCT_FIELD(ip_addr_p_t igmp_group_address); +} PACK_STRUCT_STRUCT; +PACK_STRUCT_END +#ifdef PACK_STRUCT_USE_INCLUDES +# include "arch/epstruct.h" +#endif + + +static struct igmp_group *igmp_lookup_group(struct netif *ifp, ip_addr_t *addr); +static err_t igmp_remove_group(struct igmp_group *group); +static void igmp_timeout( struct igmp_group *group); +static void igmp_start_timer(struct igmp_group *group, u8_t max_time); +static void igmp_stop_timer(struct igmp_group *group); +static void igmp_delaying_member(struct igmp_group *group, u8_t maxresp); +static err_t igmp_ip_output_if(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest, struct netif *netif); +static void igmp_send(struct igmp_group *group, u8_t type); + + +static struct igmp_group* igmp_group_list; +static ip_addr_t allsystems; +static ip_addr_t allrouters; + + +/** + * Initialize the IGMP module + */ +void +igmp_init(void) +{ + LWIP_DEBUGF(IGMP_DEBUG, ("igmp_init: initializing\n")); + + IP4_ADDR(&allsystems, 224, 0, 0, 1); + IP4_ADDR(&allrouters, 224, 0, 0, 2); +} + +#ifdef LWIP_DEBUG +/** + * Dump global IGMP groups list + */ +void +igmp_dump_group_list() +{ + struct igmp_group *group = igmp_group_list; + + while (group != NULL) { + LWIP_DEBUGF(IGMP_DEBUG, ("igmp_dump_group_list: [%"U32_F"] ", (u32_t)(group->group_state))); + ip_addr_debug_print(IGMP_DEBUG, &group->group_address); + LWIP_DEBUGF(IGMP_DEBUG, (" on if %p\n", group->netif)); + group = group->next; + } + LWIP_DEBUGF(IGMP_DEBUG, ("\n")); +} +#else +#define igmp_dump_group_list() +#endif /* LWIP_DEBUG */ + +/** + * Start IGMP processing on interface + * + * @param netif network interface on which start IGMP processing + */ +err_t +igmp_start(struct netif *netif) +{ + struct igmp_group* group; + + LWIP_DEBUGF(IGMP_DEBUG, ("igmp_start: starting IGMP processing on if %p\n", netif)); + + group = igmp_lookup_group(netif, &allsystems); + + if (group != NULL) { + group->group_state = IGMP_GROUP_IDLE_MEMBER; + group->use++; + + /* Allow the igmp messages at the MAC level */ + if (netif->igmp_mac_filter != NULL) { + LWIP_DEBUGF(IGMP_DEBUG, ("igmp_start: igmp_mac_filter(ADD ")); + ip_addr_debug_print(IGMP_DEBUG, &allsystems); + LWIP_DEBUGF(IGMP_DEBUG, (") on if %p\n", netif)); + netif->igmp_mac_filter(netif, &allsystems, IGMP_ADD_MAC_FILTER); + } + + return ERR_OK; + } + + return ERR_MEM; +} + +/** + * Stop IGMP processing on interface + * + * @param netif network interface on which stop IGMP processing + */ +err_t +igmp_stop(struct netif *netif) +{ + struct igmp_group *group = igmp_group_list; + struct igmp_group *prev = NULL; + struct igmp_group *next; + + /* look for groups joined on this interface further down the list */ + while (group != NULL) { + next = group->next; + /* is it a group joined on this interface? */ + if (group->netif == netif) { + /* is it the first group of the list? */ + if (group == igmp_group_list) { + igmp_group_list = next; + } + /* is there a "previous" group defined? */ + if (prev != NULL) { + prev->next = next; + } + /* disable the group at the MAC level */ + if (netif->igmp_mac_filter != NULL) { + LWIP_DEBUGF(IGMP_DEBUG, ("igmp_stop: igmp_mac_filter(DEL ")); + ip_addr_debug_print(IGMP_DEBUG, &group->group_address); + LWIP_DEBUGF(IGMP_DEBUG, (") on if %p\n", netif)); + netif->igmp_mac_filter(netif, &(group->group_address), IGMP_DEL_MAC_FILTER); + } + /* free group */ + memp_free(MEMP_IGMP_GROUP, group); + } else { + /* change the "previous" */ + prev = group; + } + /* move to "next" */ + group = next; + } + return ERR_OK; +} + +/** + * Report IGMP memberships for this interface + * + * @param netif network interface on which report IGMP memberships + */ +void +igmp_report_groups(struct netif *netif) +{ + struct igmp_group *group = igmp_group_list; + + LWIP_DEBUGF(IGMP_DEBUG, ("igmp_report_groups: sending IGMP reports on if %p\n", netif)); + + while (group != NULL) { + if (group->netif == netif) { + igmp_delaying_member(group, IGMP_JOIN_DELAYING_MEMBER_TMR); + } + group = group->next; + } +} + +/** + * Search for a group in the global igmp_group_list + * + * @param ifp the network interface for which to look + * @param addr the group ip address to search for + * @return a struct igmp_group* if the group has been found, + * NULL if the group wasn't found. + */ +struct igmp_group * +igmp_lookfor_group(struct netif *ifp, ip_addr_t *addr) +{ + struct igmp_group *group = igmp_group_list; + + while (group != NULL) { + if ((group->netif == ifp) && (ip_addr_cmp(&(group->group_address), addr))) { + return group; + } + group = group->next; + } + + /* to be clearer, we return NULL here instead of + * 'group' (which is also NULL at this point). + */ + return NULL; +} + +/** + * Search for a specific igmp group and create a new one if not found- + * + * @param ifp the network interface for which to look + * @param addr the group ip address to search + * @return a struct igmp_group*, + * NULL on memory error. + */ +struct igmp_group * +igmp_lookup_group(struct netif *ifp, ip_addr_t *addr) +{ + struct igmp_group *group = igmp_group_list; + + /* Search if the group already exists */ + group = igmp_lookfor_group(ifp, addr); + if (group != NULL) { + /* Group already exists. */ + return group; + } + + /* Group doesn't exist yet, create a new one */ + group = (struct igmp_group *)memp_malloc(MEMP_IGMP_GROUP); + if (group != NULL) { + group->netif = ifp; + ip_addr_set(&(group->group_address), addr); + group->timer = 0; /* Not running */ + group->group_state = IGMP_GROUP_NON_MEMBER; + group->last_reporter_flag = 0; + group->use = 0; + group->next = igmp_group_list; + + igmp_group_list = group; + } + + LWIP_DEBUGF(IGMP_DEBUG, ("igmp_lookup_group: %sallocated a new group with address ", (group?"":"impossible to "))); + ip_addr_debug_print(IGMP_DEBUG, addr); + LWIP_DEBUGF(IGMP_DEBUG, (" on if %p\n", ifp)); + + return group; +} + +/** + * Remove a group in the global igmp_group_list + * + * @param group the group to remove from the global igmp_group_list + * @return ERR_OK if group was removed from the list, an err_t otherwise + */ +static err_t +igmp_remove_group(struct igmp_group *group) +{ + err_t err = ERR_OK; + + /* Is it the first group? */ + if (igmp_group_list == group) { + igmp_group_list = group->next; + } else { + /* look for group further down the list */ + struct igmp_group *tmpGroup; + for (tmpGroup = igmp_group_list; tmpGroup != NULL; tmpGroup = tmpGroup->next) { + if (tmpGroup->next == group) { + tmpGroup->next = group->next; + break; + } + } + /* Group not found in the global igmp_group_list */ + if (tmpGroup == NULL) + err = ERR_ARG; + } + /* free group */ + memp_free(MEMP_IGMP_GROUP, group); + + return err; +} + +/** + * Called from ip_input() if a new IGMP packet is received. + * + * @param p received igmp packet, p->payload pointing to the ip header + * @param inp network interface on which the packet was received + * @param dest destination ip address of the igmp packet + */ +void +igmp_input(struct pbuf *p, struct netif *inp, ip_addr_t *dest) +{ + struct ip_hdr * iphdr; + struct igmp_msg* igmp; + struct igmp_group* group; + struct igmp_group* groupref; + + IGMP_STATS_INC(igmp.recv); + + /* Note that the length CAN be greater than 8 but only 8 are used - All are included in the checksum */ + iphdr = (struct ip_hdr *)p->payload; + if (pbuf_header(p, -(s16_t)(IPH_HL(iphdr) * 4)) || (p->len < IGMP_MINLEN)) { + pbuf_free(p); + IGMP_STATS_INC(igmp.lenerr); + LWIP_DEBUGF(IGMP_DEBUG, ("igmp_input: length error\n")); + return; + } + + LWIP_DEBUGF(IGMP_DEBUG, ("igmp_input: message from ")); + ip_addr_debug_print(IGMP_DEBUG, &(iphdr->src)); + LWIP_DEBUGF(IGMP_DEBUG, (" to address ")); + ip_addr_debug_print(IGMP_DEBUG, &(iphdr->dest)); + LWIP_DEBUGF(IGMP_DEBUG, (" on if %p\n", inp)); + + /* Now calculate and check the checksum */ + igmp = (struct igmp_msg *)p->payload; + if (inet_chksum(igmp, p->len)) { + pbuf_free(p); + IGMP_STATS_INC(igmp.chkerr); + LWIP_DEBUGF(IGMP_DEBUG, ("igmp_input: checksum error\n")); + return; + } + + /* Packet is ok so find an existing group */ + group = igmp_lookfor_group(inp, dest); /* use the destination IP address of incoming packet */ + + /* If group can be found or create... */ + if (!group) { + pbuf_free(p); + IGMP_STATS_INC(igmp.drop); + LWIP_DEBUGF(IGMP_DEBUG, ("igmp_input: IGMP frame not for us\n")); + return; + } + + /* NOW ACT ON THE INCOMING MESSAGE TYPE... */ + switch (igmp->igmp_msgtype) { + case IGMP_MEMB_QUERY: { + /* IGMP_MEMB_QUERY to the "all systems" address ? */ + if ((ip_addr_cmp(dest, &allsystems)) && ip_addr_isany(&igmp->igmp_group_address)) { + /* THIS IS THE GENERAL QUERY */ + LWIP_DEBUGF(IGMP_DEBUG, ("igmp_input: General IGMP_MEMB_QUERY on \"ALL SYSTEMS\" address (224.0.0.1) [igmp_maxresp=%i]\n", (int)(igmp->igmp_maxresp))); + + if (igmp->igmp_maxresp == 0) { + IGMP_STATS_INC(igmp.rx_v1); + LWIP_DEBUGF(IGMP_DEBUG, ("igmp_input: got an all hosts query with time== 0 - this is V1 and not implemented - treat as v2\n")); + igmp->igmp_maxresp = IGMP_V1_DELAYING_MEMBER_TMR; + } else { + IGMP_STATS_INC(igmp.rx_general); + } + + groupref = igmp_group_list; + while (groupref) { + /* Do not send messages on the all systems group address! */ + if ((groupref->netif == inp) && (!(ip_addr_cmp(&(groupref->group_address), &allsystems)))) { + igmp_delaying_member(groupref, igmp->igmp_maxresp); + } + groupref = groupref->next; + } + } else { + /* IGMP_MEMB_QUERY to a specific group ? */ + if (!ip_addr_isany(&igmp->igmp_group_address)) { + LWIP_DEBUGF(IGMP_DEBUG, ("igmp_input: IGMP_MEMB_QUERY to a specific group ")); + ip_addr_debug_print(IGMP_DEBUG, &igmp->igmp_group_address); + if (ip_addr_cmp(dest, &allsystems)) { + ip_addr_t groupaddr; + LWIP_DEBUGF(IGMP_DEBUG, (" using \"ALL SYSTEMS\" address (224.0.0.1) [igmp_maxresp=%i]\n", (int)(igmp->igmp_maxresp))); + /* we first need to re-look for the group since we used dest last time */ + ip_addr_copy(groupaddr, igmp->igmp_group_address); + group = igmp_lookfor_group(inp, &groupaddr); + } else { + LWIP_DEBUGF(IGMP_DEBUG, (" with the group address as destination [igmp_maxresp=%i]\n", (int)(igmp->igmp_maxresp))); + } + + if (group != NULL) { + IGMP_STATS_INC(igmp.rx_group); + igmp_delaying_member(group, igmp->igmp_maxresp); + } else { + IGMP_STATS_INC(igmp.drop); + } + } else { + IGMP_STATS_INC(igmp.proterr); + } + } + break; + } + case IGMP_V2_MEMB_REPORT: { + LWIP_DEBUGF(IGMP_DEBUG, ("igmp_input: IGMP_V2_MEMB_REPORT\n")); + IGMP_STATS_INC(igmp.rx_report); + if (group->group_state == IGMP_GROUP_DELAYING_MEMBER) { + /* This is on a specific group we have already looked up */ + group->timer = 0; /* stopped */ + group->group_state = IGMP_GROUP_IDLE_MEMBER; + group->last_reporter_flag = 0; + } + break; + } + default: { + LWIP_DEBUGF(IGMP_DEBUG, ("igmp_input: unexpected msg %d in state %d on group %p on if %p\n", + igmp->igmp_msgtype, group->group_state, &group, group->netif)); + IGMP_STATS_INC(igmp.proterr); + break; + } + } + + pbuf_free(p); + return; +} + +/** + * Join a group on one network interface. + * + * @param ifaddr ip address of the network interface which should join a new group + * @param groupaddr the ip address of the group which to join + * @return ERR_OK if group was joined on the netif(s), an err_t otherwise + */ +err_t +igmp_joingroup(ip_addr_t *ifaddr, ip_addr_t *groupaddr) +{ + err_t err = ERR_VAL; /* no matching interface */ + struct igmp_group *group; + struct netif *netif; + + /* make sure it is multicast address */ + LWIP_ERROR("igmp_joingroup: attempt to join non-multicast address", ip_addr_ismulticast(groupaddr), return ERR_VAL;); + LWIP_ERROR("igmp_joingroup: attempt to join allsystems address", (!ip_addr_cmp(groupaddr, &allsystems)), return ERR_VAL;); + + /* loop through netif's */ + netif = netif_list; + while (netif != NULL) { + /* Should we join this interface ? */ + if ((netif->flags & NETIF_FLAG_IGMP) && ((ip_addr_isany(ifaddr) || ip_addr_cmp(&(netif->ip_addr), ifaddr)))) { + /* find group or create a new one if not found */ + group = igmp_lookup_group(netif, groupaddr); + + if (group != NULL) { + /* This should create a new group, check the state to make sure */ + if (group->group_state != IGMP_GROUP_NON_MEMBER) { + LWIP_DEBUGF(IGMP_DEBUG, ("igmp_joingroup: join to group not in state IGMP_GROUP_NON_MEMBER\n")); + } else { + /* OK - it was new group */ + LWIP_DEBUGF(IGMP_DEBUG, ("igmp_joingroup: join to new group: ")); + ip_addr_debug_print(IGMP_DEBUG, groupaddr); + LWIP_DEBUGF(IGMP_DEBUG, ("\n")); + + /* If first use of the group, allow the group at the MAC level */ + if ((group->use==0) && (netif->igmp_mac_filter != NULL)) { + LWIP_DEBUGF(IGMP_DEBUG, ("igmp_joingroup: igmp_mac_filter(ADD ")); + ip_addr_debug_print(IGMP_DEBUG, groupaddr); + LWIP_DEBUGF(IGMP_DEBUG, (") on if %p\n", netif)); + netif->igmp_mac_filter(netif, groupaddr, IGMP_ADD_MAC_FILTER); + } + + IGMP_STATS_INC(igmp.tx_join); + igmp_send(group, IGMP_V2_MEMB_REPORT); + + igmp_start_timer(group, IGMP_JOIN_DELAYING_MEMBER_TMR); + + /* Need to work out where this timer comes from */ + group->group_state = IGMP_GROUP_DELAYING_MEMBER; + } + /* Increment group use */ + group->use++; + /* Join on this interface */ + err = ERR_OK; + } else { + /* Return an error even if some network interfaces are joined */ + /** @todo undo any other netif already joined */ + LWIP_DEBUGF(IGMP_DEBUG, ("igmp_joingroup: Not enought memory to join to group\n")); + return ERR_MEM; + } + } + /* proceed to next network interface */ + netif = netif->next; + } + + return err; +} + +/** + * Leave a group on one network interface. + * + * @param ifaddr ip address of the network interface which should leave a group + * @param groupaddr the ip address of the group which to leave + * @return ERR_OK if group was left on the netif(s), an err_t otherwise + */ +err_t +igmp_leavegroup(ip_addr_t *ifaddr, ip_addr_t *groupaddr) +{ + err_t err = ERR_VAL; /* no matching interface */ + struct igmp_group *group; + struct netif *netif; + + /* make sure it is multicast address */ + LWIP_ERROR("igmp_leavegroup: attempt to leave non-multicast address", ip_addr_ismulticast(groupaddr), return ERR_VAL;); + LWIP_ERROR("igmp_leavegroup: attempt to leave allsystems address", (!ip_addr_cmp(groupaddr, &allsystems)), return ERR_VAL;); + + /* loop through netif's */ + netif = netif_list; + while (netif != NULL) { + /* Should we leave this interface ? */ + if ((netif->flags & NETIF_FLAG_IGMP) && ((ip_addr_isany(ifaddr) || ip_addr_cmp(&(netif->ip_addr), ifaddr)))) { + /* find group */ + group = igmp_lookfor_group(netif, groupaddr); + + if (group != NULL) { + /* Only send a leave if the flag is set according to the state diagram */ + LWIP_DEBUGF(IGMP_DEBUG, ("igmp_leavegroup: Leaving group: ")); + ip_addr_debug_print(IGMP_DEBUG, groupaddr); + LWIP_DEBUGF(IGMP_DEBUG, ("\n")); + + /* If there is no other use of the group */ + if (group->use <= 1) { + /* If we are the last reporter for this group */ + if (group->last_reporter_flag) { + LWIP_DEBUGF(IGMP_DEBUG, ("igmp_leavegroup: sending leaving group\n")); + IGMP_STATS_INC(igmp.tx_leave); + igmp_send(group, IGMP_LEAVE_GROUP); + } + + /* Disable the group at the MAC level */ + if (netif->igmp_mac_filter != NULL) { + LWIP_DEBUGF(IGMP_DEBUG, ("igmp_leavegroup: igmp_mac_filter(DEL ")); + ip_addr_debug_print(IGMP_DEBUG, groupaddr); + LWIP_DEBUGF(IGMP_DEBUG, (") on if %p\n", netif)); + netif->igmp_mac_filter(netif, groupaddr, IGMP_DEL_MAC_FILTER); + } + + LWIP_DEBUGF(IGMP_DEBUG, ("igmp_leavegroup: remove group: ")); + ip_addr_debug_print(IGMP_DEBUG, groupaddr); + LWIP_DEBUGF(IGMP_DEBUG, ("\n")); + + /* Free the group */ + igmp_remove_group(group); + } else { + /* Decrement group use */ + group->use--; + } + /* Leave on this interface */ + err = ERR_OK; + } else { + /* It's not a fatal error on "leavegroup" */ + LWIP_DEBUGF(IGMP_DEBUG, ("igmp_leavegroup: not member of group\n")); + } + } + /* proceed to next network interface */ + netif = netif->next; + } + + return err; +} + +/** + * The igmp timer function (both for NO_SYS=1 and =0) + * Should be called every IGMP_TMR_INTERVAL milliseconds (100 ms is default). + */ +void +igmp_tmr(void) +{ + struct igmp_group *group = igmp_group_list; + + while (group != NULL) { + if (group->timer > 0) { + group->timer--; + if (group->timer == 0) { + igmp_timeout(group); + } + } + group = group->next; + } +} + +/** + * Called if a timeout for one group is reached. + * Sends a report for this group. + * + * @param group an igmp_group for which a timeout is reached + */ +static void +igmp_timeout(struct igmp_group *group) +{ + /* If the state is IGMP_GROUP_DELAYING_MEMBER then we send a report for this group */ + if (group->group_state == IGMP_GROUP_DELAYING_MEMBER) { + LWIP_DEBUGF(IGMP_DEBUG, ("igmp_timeout: report membership for group with address ")); + ip_addr_debug_print(IGMP_DEBUG, &(group->group_address)); + LWIP_DEBUGF(IGMP_DEBUG, (" on if %p\n", group->netif)); + + IGMP_STATS_INC(igmp.tx_report); + igmp_send(group, IGMP_V2_MEMB_REPORT); + } +} + +/** + * Start a timer for an igmp group + * + * @param group the igmp_group for which to start a timer + * @param max_time the time in multiples of IGMP_TMR_INTERVAL (decrease with + * every call to igmp_tmr()) + */ +static void +igmp_start_timer(struct igmp_group *group, u8_t max_time) +{ + /* ensure the input value is > 0 */ + if (max_time == 0) { + max_time = 1; + } + /* ensure the random value is > 0 */ + group->timer = (LWIP_RAND() % (max_time - 1)) + 1; +} + +/** + * Stop a timer for an igmp_group + * + * @param group the igmp_group for which to stop the timer + */ +static void +igmp_stop_timer(struct igmp_group *group) +{ + group->timer = 0; +} + +/** + * Delaying membership report for a group if necessary + * + * @param group the igmp_group for which "delaying" membership report + * @param maxresp query delay + */ +static void +igmp_delaying_member(struct igmp_group *group, u8_t maxresp) +{ + if ((group->group_state == IGMP_GROUP_IDLE_MEMBER) || + ((group->group_state == IGMP_GROUP_DELAYING_MEMBER) && + ((group->timer == 0) || (maxresp < group->timer)))) { + igmp_start_timer(group, maxresp); + group->group_state = IGMP_GROUP_DELAYING_MEMBER; + } +} + + +/** + * Sends an IP packet on a network interface. This function constructs the IP header + * and calculates the IP header checksum. If the source IP address is NULL, + * the IP address of the outgoing network interface is filled in as source address. + * + * @param p the packet to send (p->payload points to the data, e.g. next + protocol header; if dest == IP_HDRINCL, p already includes an IP + header and p->payload points to that IP header) + * @param src the source IP address to send from (if src == IP_ADDR_ANY, the + * IP address of the netif used to send is used as source address) + * @param dest the destination IP address to send the packet to + * @param ttl the TTL value to be set in the IP header + * @param proto the PROTOCOL to be set in the IP header + * @param netif the netif on which to send this packet + * @return ERR_OK if the packet was sent OK + * ERR_BUF if p doesn't have enough space for IP/LINK headers + * returns errors returned by netif->output + */ +static err_t +igmp_ip_output_if(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest, struct netif *netif) +{ + /* This is the "router alert" option */ + u16_t ra[2]; + ra[0] = PP_HTONS(ROUTER_ALERT); + ra[1] = 0x0000; /* Router shall examine packet */ + IGMP_STATS_INC(igmp.xmit); + return ip_output_if_opt(p, src, dest, IGMP_TTL, 0, IP_PROTO_IGMP, netif, ra, ROUTER_ALERTLEN); +} + +/** + * Send an igmp packet to a specific group. + * + * @param group the group to which to send the packet + * @param type the type of igmp packet to send + */ +static void +igmp_send(struct igmp_group *group, u8_t type) +{ + struct pbuf* p = NULL; + struct igmp_msg* igmp = NULL; + ip_addr_t src = *IP_ADDR_ANY; + ip_addr_t* dest = NULL; + + /* IP header + "router alert" option + IGMP header */ + p = pbuf_alloc(PBUF_TRANSPORT, IGMP_MINLEN, PBUF_RAM); + + if (p) { + igmp = (struct igmp_msg *)p->payload; + LWIP_ASSERT("igmp_send: check that first pbuf can hold struct igmp_msg", + (p->len >= sizeof(struct igmp_msg))); + ip_addr_copy(src, group->netif->ip_addr); + + if (type == IGMP_V2_MEMB_REPORT) { + dest = &(group->group_address); + ip_addr_copy(igmp->igmp_group_address, group->group_address); + group->last_reporter_flag = 1; /* Remember we were the last to report */ + } else { + if (type == IGMP_LEAVE_GROUP) { + dest = &allrouters; + ip_addr_copy(igmp->igmp_group_address, group->group_address); + } + } + + if ((type == IGMP_V2_MEMB_REPORT) || (type == IGMP_LEAVE_GROUP)) { + igmp->igmp_msgtype = type; + igmp->igmp_maxresp = 0; + igmp->igmp_checksum = 0; + igmp->igmp_checksum = inet_chksum(igmp, IGMP_MINLEN); + + igmp_ip_output_if(p, &src, dest, group->netif); + } + + pbuf_free(p); + } else { + LWIP_DEBUGF(IGMP_DEBUG, ("igmp_send: not enough memory for igmp_send\n")); + IGMP_STATS_INC(igmp.memerr); + } +} + +#endif /* LWIP_IGMP */ diff --git a/lib/drivers/lwip/src/core/ipv4/inet.c b/lib/drivers/lwip/src/core/ipv4/inet.c new file mode 100644 index 00000000000..e283a576604 --- /dev/null +++ b/lib/drivers/lwip/src/core/ipv4/inet.c @@ -0,0 +1,42 @@ +/** + * @file + * Functions common to all TCP/IPv4 modules, such as the byte order functions. + * + */ + +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ + +#include "lwip/opt.h" + +#include "lwip/inet.h" + diff --git a/lib/drivers/lwip/src/core/ipv4/inet_chksum.c b/lib/drivers/lwip/src/core/ipv4/inet_chksum.c new file mode 100644 index 00000000000..960252f64f1 --- /dev/null +++ b/lib/drivers/lwip/src/core/ipv4/inet_chksum.c @@ -0,0 +1,450 @@ +/** + * @file + * Incluse internet checksum functions. + * + */ + +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ + +#include "lwip/opt.h" + +#include "lwip/inet_chksum.h" +#include "lwip/def.h" + +#include +#include + +/* These are some reference implementations of the checksum algorithm, with the + * aim of being simple, correct and fully portable. Checksumming is the + * first thing you would want to optimize for your platform. If you create + * your own version, link it in and in your cc.h put: + * + * #define LWIP_CHKSUM + * + * Or you can select from the implementations below by defining + * LWIP_CHKSUM_ALGORITHM to 1, 2 or 3. + */ + +#ifndef LWIP_CHKSUM +# define LWIP_CHKSUM lwip_standard_chksum +# ifndef LWIP_CHKSUM_ALGORITHM +# define LWIP_CHKSUM_ALGORITHM 2 +# endif +#endif +/* If none set: */ +#ifndef LWIP_CHKSUM_ALGORITHM +# define LWIP_CHKSUM_ALGORITHM 0 +#endif + +#if (LWIP_CHKSUM_ALGORITHM == 1) /* Version #1 */ +/** + * lwip checksum + * + * @param dataptr points to start of data to be summed at any boundary + * @param len length of data to be summed + * @return host order (!) lwip checksum (non-inverted Internet sum) + * + * @note accumulator size limits summable length to 64k + * @note host endianess is irrelevant (p3 RFC1071) + */ +static u16_t +lwip_standard_chksum(void *dataptr, u16_t len) +{ + u32_t acc; + u16_t src; + u8_t *octetptr; + + acc = 0; + /* dataptr may be at odd or even addresses */ + octetptr = (u8_t*)dataptr; + while (len > 1) { + /* declare first octet as most significant + thus assume network order, ignoring host order */ + src = (*octetptr) << 8; + octetptr++; + /* declare second octet as least significant */ + src |= (*octetptr); + octetptr++; + acc += src; + len -= 2; + } + if (len > 0) { + /* accumulate remaining octet */ + src = (*octetptr) << 8; + acc += src; + } + /* add deferred carry bits */ + acc = (acc >> 16) + (acc & 0x0000ffffUL); + if ((acc & 0xffff0000UL) != 0) { + acc = (acc >> 16) + (acc & 0x0000ffffUL); + } + /* This maybe a little confusing: reorder sum using htons() + instead of ntohs() since it has a little less call overhead. + The caller must invert bits for Internet sum ! */ + return htons((u16_t)acc); +} +#endif + +#if (LWIP_CHKSUM_ALGORITHM == 2) /* Alternative version #2 */ +/* + * Curt McDowell + * Broadcom Corp. + * csm@broadcom.com + * + * IP checksum two bytes at a time with support for + * unaligned buffer. + * Works for len up to and including 0x20000. + * by Curt McDowell, Broadcom Corp. 12/08/2005 + * + * @param dataptr points to start of data to be summed at any boundary + * @param len length of data to be summed + * @return host order (!) lwip checksum (non-inverted Internet sum) + */ + +static u16_t +lwip_standard_chksum(void *dataptr, int len) +{ + u8_t *pb = (u8_t *)dataptr; + u16_t *ps, t = 0; + u32_t sum = 0; + int odd = ((mem_ptr_t)pb & 1); + + /* Get aligned to u16_t */ + if (odd && len > 0) { + ((u8_t *)&t)[1] = *pb++; + len--; + } + + /* Add the bulk of the data */ + ps = (u16_t *)(void *)pb; + while (len > 1) { + sum += *ps++; + len -= 2; + } + + /* Consume left-over byte, if any */ + if (len > 0) { + ((u8_t *)&t)[0] = *(u8_t *)ps; + } + + /* Add end bytes */ + sum += t; + + /* Fold 32-bit sum to 16 bits + calling this twice is propably faster than if statements... */ + sum = FOLD_U32T(sum); + sum = FOLD_U32T(sum); + + /* Swap if alignment was odd */ + if (odd) { + sum = SWAP_BYTES_IN_WORD(sum); + } + + return (u16_t)sum; +} +#endif + +#if (LWIP_CHKSUM_ALGORITHM == 3) /* Alternative version #3 */ +/** + * An optimized checksum routine. Basically, it uses loop-unrolling on + * the checksum loop, treating the head and tail bytes specially, whereas + * the inner loop acts on 8 bytes at a time. + * + * @arg start of buffer to be checksummed. May be an odd byte address. + * @len number of bytes in the buffer to be checksummed. + * @return host order (!) lwip checksum (non-inverted Internet sum) + * + * by Curt McDowell, Broadcom Corp. December 8th, 2005 + */ + +static u16_t +lwip_standard_chksum(void *dataptr, int len) +{ + u8_t *pb = (u8_t *)dataptr; + u16_t *ps, t = 0; + u32_t *pl; + u32_t sum = 0, tmp; + /* starts at odd byte address? */ + int odd = ((mem_ptr_t)pb & 1); + + if (odd && len > 0) { + ((u8_t *)&t)[1] = *pb++; + len--; + } + + ps = (u16_t *)pb; + + if (((mem_ptr_t)ps & 3) && len > 1) { + sum += *ps++; + len -= 2; + } + + pl = (u32_t *)ps; + + while (len > 7) { + tmp = sum + *pl++; /* ping */ + if (tmp < sum) { + tmp++; /* add back carry */ + } + + sum = tmp + *pl++; /* pong */ + if (sum < tmp) { + sum++; /* add back carry */ + } + + len -= 8; + } + + /* make room in upper bits */ + sum = FOLD_U32T(sum); + + ps = (u16_t *)pl; + + /* 16-bit aligned word remaining? */ + while (len > 1) { + sum += *ps++; + len -= 2; + } + + /* dangling tail byte remaining? */ + if (len > 0) { /* include odd byte */ + ((u8_t *)&t)[0] = *(u8_t *)ps; + } + + sum += t; /* add end bytes */ + + /* Fold 32-bit sum to 16 bits + calling this twice is propably faster than if statements... */ + sum = FOLD_U32T(sum); + sum = FOLD_U32T(sum); + + if (odd) { + sum = SWAP_BYTES_IN_WORD(sum); + } + + return (u16_t)sum; +} +#endif + +/* inet_chksum_pseudo: + * + * Calculates the pseudo Internet checksum used by TCP and UDP for a pbuf chain. + * IP addresses are expected to be in network byte order. + * + * @param p chain of pbufs over that a checksum should be calculated (ip data part) + * @param src source ip address (used for checksum of pseudo header) + * @param dst destination ip address (used for checksum of pseudo header) + * @param proto ip protocol (used for checksum of pseudo header) + * @param proto_len length of the ip data part (used for checksum of pseudo header) + * @return checksum (as u16_t) to be saved directly in the protocol header + */ +u16_t +inet_chksum_pseudo(struct pbuf *p, + ip_addr_t *src, ip_addr_t *dest, + u8_t proto, u16_t proto_len) +{ + u32_t acc; + u32_t addr; + struct pbuf *q; + u8_t swapped; + + acc = 0; + swapped = 0; + /* iterate through all pbuf in chain */ + for(q = p; q != NULL; q = q->next) { + LWIP_DEBUGF(INET_DEBUG, ("inet_chksum_pseudo(): checksumming pbuf %p (has next %p) \n", + (void *)q, (void *)q->next)); + acc += LWIP_CHKSUM(q->payload, q->len); + /*LWIP_DEBUGF(INET_DEBUG, ("inet_chksum_pseudo(): unwrapped lwip_chksum()=%"X32_F" \n", acc));*/ + /* just executing this next line is probably faster that the if statement needed + to check whether we really need to execute it, and does no harm */ + acc = FOLD_U32T(acc); + if (q->len % 2 != 0) { + swapped = 1 - swapped; + acc = SWAP_BYTES_IN_WORD(acc); + } + /*LWIP_DEBUGF(INET_DEBUG, ("inet_chksum_pseudo(): wrapped lwip_chksum()=%"X32_F" \n", acc));*/ + } + + if (swapped) { + acc = SWAP_BYTES_IN_WORD(acc); + } + addr = ip4_addr_get_u32(src); + acc += (addr & 0xffffUL); + acc += ((addr >> 16) & 0xffffUL); + addr = ip4_addr_get_u32(dest); + acc += (addr & 0xffffUL); + acc += ((addr >> 16) & 0xffffUL); + acc += (u32_t)htons((u16_t)proto); + acc += (u32_t)htons(proto_len); + + /* Fold 32-bit sum to 16 bits + calling this twice is propably faster than if statements... */ + acc = FOLD_U32T(acc); + acc = FOLD_U32T(acc); + LWIP_DEBUGF(INET_DEBUG, ("inet_chksum_pseudo(): pbuf chain lwip_chksum()=%"X32_F"\n", acc)); + return (u16_t)~(acc & 0xffffUL); +} + +/* inet_chksum_pseudo: + * + * Calculates the pseudo Internet checksum used by TCP and UDP for a pbuf chain. + * IP addresses are expected to be in network byte order. + * + * @param p chain of pbufs over that a checksum should be calculated (ip data part) + * @param src source ip address (used for checksum of pseudo header) + * @param dst destination ip address (used for checksum of pseudo header) + * @param proto ip protocol (used for checksum of pseudo header) + * @param proto_len length of the ip data part (used for checksum of pseudo header) + * @return checksum (as u16_t) to be saved directly in the protocol header + */ +u16_t +inet_chksum_pseudo_partial(struct pbuf *p, + ip_addr_t *src, ip_addr_t *dest, + u8_t proto, u16_t proto_len, u16_t chksum_len) +{ + u32_t acc; + u32_t addr; + struct pbuf *q; + u8_t swapped; + u16_t chklen; + + acc = 0; + swapped = 0; + /* iterate through all pbuf in chain */ + for(q = p; (q != NULL) && (chksum_len > 0); q = q->next) { + LWIP_DEBUGF(INET_DEBUG, ("inet_chksum_pseudo(): checksumming pbuf %p (has next %p) \n", + (void *)q, (void *)q->next)); + chklen = q->len; + if (chklen > chksum_len) { + chklen = chksum_len; + } + acc += LWIP_CHKSUM(q->payload, chklen); + chksum_len -= chklen; + LWIP_ASSERT("delete me", chksum_len < 0x7fff); + /*LWIP_DEBUGF(INET_DEBUG, ("inet_chksum_pseudo(): unwrapped lwip_chksum()=%"X32_F" \n", acc));*/ + /* fold the upper bit down */ + acc = FOLD_U32T(acc); + if (q->len % 2 != 0) { + swapped = 1 - swapped; + acc = SWAP_BYTES_IN_WORD(acc); + } + /*LWIP_DEBUGF(INET_DEBUG, ("inet_chksum_pseudo(): wrapped lwip_chksum()=%"X32_F" \n", acc));*/ + } + + if (swapped) { + acc = SWAP_BYTES_IN_WORD(acc); + } + addr = ip4_addr_get_u32(src); + acc += (addr & 0xffffUL); + acc += ((addr >> 16) & 0xffffUL); + addr = ip4_addr_get_u32(dest); + acc += (addr & 0xffffUL); + acc += ((addr >> 16) & 0xffffUL); + acc += (u32_t)htons((u16_t)proto); + acc += (u32_t)htons(proto_len); + + /* Fold 32-bit sum to 16 bits + calling this twice is propably faster than if statements... */ + acc = FOLD_U32T(acc); + acc = FOLD_U32T(acc); + LWIP_DEBUGF(INET_DEBUG, ("inet_chksum_pseudo(): pbuf chain lwip_chksum()=%"X32_F"\n", acc)); + return (u16_t)~(acc & 0xffffUL); +} + +/* inet_chksum: + * + * Calculates the Internet checksum over a portion of memory. Used primarily for IP + * and ICMP. + * + * @param dataptr start of the buffer to calculate the checksum (no alignment needed) + * @param len length of the buffer to calculate the checksum + * @return checksum (as u16_t) to be saved directly in the protocol header + */ + +u16_t +inet_chksum(void *dataptr, u16_t len) +{ + return ~LWIP_CHKSUM(dataptr, len); +} + +/** + * Calculate a checksum over a chain of pbufs (without pseudo-header, much like + * inet_chksum only pbufs are used). + * + * @param p pbuf chain over that the checksum should be calculated + * @return checksum (as u16_t) to be saved directly in the protocol header + */ +u16_t +inet_chksum_pbuf(struct pbuf *p) +{ + u32_t acc; + struct pbuf *q; + u8_t swapped; + + acc = 0; + swapped = 0; + for(q = p; q != NULL; q = q->next) { + acc += LWIP_CHKSUM(q->payload, q->len); + acc = FOLD_U32T(acc); + if (q->len % 2 != 0) { + swapped = 1 - swapped; + acc = SWAP_BYTES_IN_WORD(acc); + } + } + + if (swapped) { + acc = SWAP_BYTES_IN_WORD(acc); + } + return (u16_t)~(acc & 0xffffUL); +} + +/* These are some implementations for LWIP_CHKSUM_COPY, which copies data + * like MEMCPY but generates a checksum at the same time. Since this is a + * performance-sensitive function, you might want to create your own version + * in assembly targeted at your hardware by defining it in lwipopts.h: + * #define LWIP_CHKSUM_COPY(dst, src, len) your_chksum_copy(dst, src, len) + */ + +#if (LWIP_CHKSUM_COPY_ALGORITHM == 1) /* Version #1 */ +/** Safe but slow: first call MEMCPY, then call LWIP_CHKSUM. + * For architectures with big caches, data might still be in cache when + * generating the checksum after copying. + */ +u16_t +lwip_chksum_copy(void *dst, const void *src, u16_t len) +{ + MEMCPY(dst, src, len); + return LWIP_CHKSUM(dst, len); +} +#endif /* (LWIP_CHKSUM_COPY_ALGORITHM == 1) */ diff --git a/lib/drivers/lwip/src/core/ipv4/ip.c b/lib/drivers/lwip/src/core/ipv4/ip.c new file mode 100644 index 00000000000..6f248716b63 --- /dev/null +++ b/lib/drivers/lwip/src/core/ipv4/ip.c @@ -0,0 +1,857 @@ +/** + * @file + * This is the IPv4 layer implementation for incoming and outgoing IP traffic. + * + * @see ip_frag.c + * + */ + +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ + +#include "lwip/opt.h" +#include "lwip/ip.h" +#include "lwip/def.h" +#include "lwip/mem.h" +#include "lwip/ip_frag.h" +#include "lwip/inet_chksum.h" +#include "lwip/netif.h" +#include "lwip/icmp.h" +#include "lwip/igmp.h" +#include "lwip/raw.h" +#include "lwip/udp.h" +#include "lwip/tcp_impl.h" +#include "lwip/snmp.h" +#include "lwip/dhcp.h" +#include "lwip/autoip.h" +#include "lwip/stats.h" +#include "arch/perf.h" + +#include + +/** Set this to 0 in the rare case of wanting to call an extra function to + * generate the IP checksum (in contrast to calculating it on-the-fly). */ +#ifndef LWIP_INLINE_IP_CHKSUM +#define LWIP_INLINE_IP_CHKSUM 1 +#endif +#if LWIP_INLINE_IP_CHKSUM && CHECKSUM_GEN_IP +#define CHECKSUM_GEN_IP_INLINE 1 +#else +#define CHECKSUM_GEN_IP_INLINE 0 +#endif + +#if LWIP_DHCP || defined(LWIP_IP_ACCEPT_UDP_PORT) +#define IP_ACCEPT_LINK_LAYER_ADDRESSING 1 + +/** Some defines for DHCP to let link-layer-addressed packets through while the + * netif is down. + * To use this in your own application/protocol, define LWIP_IP_ACCEPT_UDP_PORT + * to return 1 if the port is accepted and 0 if the port is not accepted. + */ +#if LWIP_DHCP && defined(LWIP_IP_ACCEPT_UDP_PORT) +/* accept DHCP client port and custom port */ +#define IP_ACCEPT_LINK_LAYER_ADDRESSED_PORT(port) (((port) == PP_NTOHS(DHCP_CLIENT_PORT)) \ + || (LWIP_IP_ACCEPT_UDP_PORT(port))) +#elif defined(LWIP_IP_ACCEPT_UDP_PORT) /* LWIP_DHCP && defined(LWIP_IP_ACCEPT_UDP_PORT) */ +/* accept custom port only */ +#define IP_ACCEPT_LINK_LAYER_ADDRESSED_PORT(port) (LWIP_IP_ACCEPT_UDP_PORT(dst_port)) +#else /* LWIP_DHCP && defined(LWIP_IP_ACCEPT_UDP_PORT) */ +/* accept DHCP client port only */ +#define IP_ACCEPT_LINK_LAYER_ADDRESSED_PORT(port) ((port) == PP_NTOHS(DHCP_CLIENT_PORT)) +#endif /* LWIP_DHCP && defined(LWIP_IP_ACCEPT_UDP_PORT) */ + +#else /* LWIP_DHCP */ +#define IP_ACCEPT_LINK_LAYER_ADDRESSING 0 +#endif /* LWIP_DHCP */ + +/** + * The interface that provided the packet for the current callback + * invocation. + */ +struct netif *current_netif; + +/** + * Header of the input packet currently being processed. + */ +const struct ip_hdr *current_header; +/** Source IP address of current_header */ +ip_addr_t current_iphdr_src; +/** Destination IP address of current_header */ +ip_addr_t current_iphdr_dest; + +/** The IP header ID of the next outgoing IP packet */ +static u16_t ip_id; + +/** + * Finds the appropriate network interface for a given IP address. It + * searches the list of network interfaces linearly. A match is found + * if the masked IP address of the network interface equals the masked + * IP address given to the function. + * + * @param dest the destination IP address for which to find the route + * @return the netif on which to send to reach dest + */ +struct netif * +ip_route(ip_addr_t *dest) +{ + struct netif *netif; + + /* iterate through netifs */ + for(netif = netif_list; netif != NULL; netif = netif->next) { + /* network mask matches? */ + if (netif_is_up(netif)) { + if (ip_addr_netcmp(dest, &(netif->ip_addr), &(netif->netmask))) { + /* return netif on which to forward IP packet */ + return netif; + } + } + } + if ((netif_default == NULL) || (!netif_is_up(netif_default))) { + LWIP_DEBUGF(IP_DEBUG | LWIP_DBG_LEVEL_SERIOUS, ("ip_route: No route to %"U16_F".%"U16_F".%"U16_F".%"U16_F"\n", + ip4_addr1_16(dest), ip4_addr2_16(dest), ip4_addr3_16(dest), ip4_addr4_16(dest))); + IP_STATS_INC(ip.rterr); + snmp_inc_ipoutnoroutes(); + return NULL; + } + /* no matching netif found, use default netif */ + return netif_default; +} + +#if IP_FORWARD +/** + * Forwards an IP packet. It finds an appropriate route for the + * packet, decrements the TTL value of the packet, adjusts the + * checksum and outputs the packet on the appropriate interface. + * + * @param p the packet to forward (p->payload points to IP header) + * @param iphdr the IP header of the input packet + * @param inp the netif on which this packet was received + */ +static void +ip_forward(struct pbuf *p, struct ip_hdr *iphdr, struct netif *inp) +{ + struct netif *netif; + + PERF_START; + + /* RFC3927 2.7: do not forward link-local addresses */ + if (ip_addr_islinklocal(¤t_iphdr_dest)) { + LWIP_DEBUGF(IP_DEBUG, ("ip_forward: not forwarding LLA %"U16_F".%"U16_F".%"U16_F".%"U16_F"\n", + ip4_addr1_16(¤t_iphdr_dest), ip4_addr2_16(¤t_iphdr_dest), + ip4_addr3_16(¤t_iphdr_dest), ip4_addr4_16(¤t_iphdr_dest))); + goto return_noroute; + } + + /* Find network interface where to forward this IP packet to. */ + netif = ip_route(¤t_iphdr_dest); + if (netif == NULL) { + LWIP_DEBUGF(IP_DEBUG, ("ip_forward: no forwarding route for %"U16_F".%"U16_F".%"U16_F".%"U16_F" found\n", + ip4_addr1_16(¤t_iphdr_dest), ip4_addr2_16(¤t_iphdr_dest), + ip4_addr3_16(¤t_iphdr_dest), ip4_addr4_16(¤t_iphdr_dest))); + goto return_noroute; + } + /* Do not forward packets onto the same network interface on which + * they arrived. */ + if (netif == inp) { + LWIP_DEBUGF(IP_DEBUG, ("ip_forward: not bouncing packets back on incoming interface.\n")); + goto return_noroute; + } + + /* decrement TTL */ + IPH_TTL_SET(iphdr, IPH_TTL(iphdr) - 1); + /* send ICMP if TTL == 0 */ + if (IPH_TTL(iphdr) == 0) { + snmp_inc_ipinhdrerrors(); +#if LWIP_ICMP + /* Don't send ICMP messages in response to ICMP messages */ + if (IPH_PROTO(iphdr) != IP_PROTO_ICMP) { + icmp_time_exceeded(p, ICMP_TE_TTL); + } +#endif /* LWIP_ICMP */ + return; + } + + /* Incrementally update the IP checksum. */ + if (IPH_CHKSUM(iphdr) >= PP_HTONS(0xffffU - 0x100)) { + IPH_CHKSUM_SET(iphdr, IPH_CHKSUM(iphdr) + PP_HTONS(0x100) + 1); + } else { + IPH_CHKSUM_SET(iphdr, IPH_CHKSUM(iphdr) + PP_HTONS(0x100)); + } + + LWIP_DEBUGF(IP_DEBUG, ("ip_forward: forwarding packet to %"U16_F".%"U16_F".%"U16_F".%"U16_F"\n", + ip4_addr1_16(¤t_iphdr_dest), ip4_addr2_16(¤t_iphdr_dest), + ip4_addr3_16(¤t_iphdr_dest), ip4_addr4_16(¤t_iphdr_dest))); + + IP_STATS_INC(ip.fw); + IP_STATS_INC(ip.xmit); + snmp_inc_ipforwdatagrams(); + + PERF_STOP("ip_forward"); + /* transmit pbuf on chosen interface */ + netif->output(netif, p, ¤t_iphdr_dest); + return; +return_noroute: + snmp_inc_ipoutnoroutes(); +} +#endif /* IP_FORWARD */ + +/** + * This function is called by the network interface device driver when + * an IP packet is received. The function does the basic checks of the + * IP header such as packet size being at least larger than the header + * size etc. If the packet was not destined for us, the packet is + * forwarded (using ip_forward). The IP checksum is always checked. + * + * Finally, the packet is sent to the upper layer protocol input function. + * + * @param p the received IP packet (p->payload points to IP header) + * @param inp the netif on which this packet was received + * @return ERR_OK if the packet was processed (could return ERR_* if it wasn't + * processed, but currently always returns ERR_OK) + */ +err_t +ip_input(struct pbuf *p, struct netif *inp) +{ + struct ip_hdr *iphdr; + struct netif *netif; + u16_t iphdr_hlen; + u16_t iphdr_len; +#if IP_ACCEPT_LINK_LAYER_ADDRESSING + int check_ip_src=1; +#endif /* IP_ACCEPT_LINK_LAYER_ADDRESSING */ + + IP_STATS_INC(ip.recv); + snmp_inc_ipinreceives(); + + /* identify the IP header */ + iphdr = (struct ip_hdr *)p->payload; + if (IPH_V(iphdr) != 4) { + LWIP_DEBUGF(IP_DEBUG | LWIP_DBG_LEVEL_WARNING, ("IP packet dropped due to bad version number %"U16_F"\n", IPH_V(iphdr))); + ip_debug_print(p); + pbuf_free(p); + IP_STATS_INC(ip.err); + IP_STATS_INC(ip.drop); + snmp_inc_ipinhdrerrors(); + return ERR_OK; + } + + /* obtain IP header length in number of 32-bit words */ + iphdr_hlen = IPH_HL(iphdr); + /* calculate IP header length in bytes */ + iphdr_hlen *= 4; + /* obtain ip length in bytes */ + iphdr_len = ntohs(IPH_LEN(iphdr)); + + /* header length exceeds first pbuf length, or ip length exceeds total pbuf length? */ + if ((iphdr_hlen > p->len) || (iphdr_len > p->tot_len)) { + if (iphdr_hlen > p->len) { + LWIP_DEBUGF(IP_DEBUG | LWIP_DBG_LEVEL_SERIOUS, + ("IP header (len %"U16_F") does not fit in first pbuf (len %"U16_F"), IP packet dropped.\n", + iphdr_hlen, p->len)); + } + if (iphdr_len > p->tot_len) { + LWIP_DEBUGF(IP_DEBUG | LWIP_DBG_LEVEL_SERIOUS, + ("IP (len %"U16_F") is longer than pbuf (len %"U16_F"), IP packet dropped.\n", + iphdr_len, p->tot_len)); + } + /* free (drop) packet pbufs */ + pbuf_free(p); + IP_STATS_INC(ip.lenerr); + IP_STATS_INC(ip.drop); + snmp_inc_ipindiscards(); + return ERR_OK; + } + + /* verify checksum */ +#if CHECKSUM_CHECK_IP + if (inet_chksum(iphdr, iphdr_hlen) != 0) { + + LWIP_DEBUGF(IP_DEBUG | LWIP_DBG_LEVEL_SERIOUS, + ("Checksum (0x%"X16_F") failed, IP packet dropped.\n", inet_chksum(iphdr, iphdr_hlen))); + ip_debug_print(p); + pbuf_free(p); + IP_STATS_INC(ip.chkerr); + IP_STATS_INC(ip.drop); + snmp_inc_ipinhdrerrors(); + return ERR_OK; + } +#endif + + /* Trim pbuf. This should have been done at the netif layer, + * but we'll do it anyway just to be sure that its done. */ + pbuf_realloc(p, iphdr_len); + + /* copy IP addresses to aligned ip_addr_t */ + ip_addr_copy(current_iphdr_dest, iphdr->dest); + ip_addr_copy(current_iphdr_src, iphdr->src); + + /* match packet against an interface, i.e. is this packet for us? */ +#if LWIP_IGMP + if (ip_addr_ismulticast(¤t_iphdr_dest)) { + if ((inp->flags & NETIF_FLAG_IGMP) && (igmp_lookfor_group(inp, ¤t_iphdr_dest))) { + netif = inp; + } else { + netif = NULL; + } + } else +#endif /* LWIP_IGMP */ + { + /* start trying with inp. if that's not acceptable, start walking the + list of configured netifs. + 'first' is used as a boolean to mark whether we started walking the list */ + int first = 1; + netif = inp; + do { + LWIP_DEBUGF(IP_DEBUG, ("ip_input: iphdr->dest 0x%"X32_F" netif->ip_addr 0x%"X32_F" (0x%"X32_F", 0x%"X32_F", 0x%"X32_F")\n", + ip4_addr_get_u32(&iphdr->dest), ip4_addr_get_u32(&netif->ip_addr), + ip4_addr_get_u32(&iphdr->dest) & ip4_addr_get_u32(&netif->netmask), + ip4_addr_get_u32(&netif->ip_addr) & ip4_addr_get_u32(&netif->netmask), + ip4_addr_get_u32(&iphdr->dest) & ~ip4_addr_get_u32(&netif->netmask))); + + /* interface is up and configured? */ + if ((netif_is_up(netif)) && (!ip_addr_isany(&(netif->ip_addr)))) { + /* unicast to this interface address? */ + if (ip_addr_cmp(¤t_iphdr_dest, &(netif->ip_addr)) || + /* or broadcast on this interface network address? */ + ip_addr_isbroadcast(¤t_iphdr_dest, netif)) { + LWIP_DEBUGF(IP_DEBUG, ("ip_input: packet accepted on interface %c%c\n", + netif->name[0], netif->name[1])); + /* break out of for loop */ + break; + } +#if LWIP_AUTOIP + /* connections to link-local addresses must persist after changing + the netif's address (RFC3927 ch. 1.9) */ + if ((netif->autoip != NULL) && + ip_addr_cmp(¤t_iphdr_dest, &(netif->autoip->llipaddr))) { + LWIP_DEBUGF(IP_DEBUG, ("ip_input: LLA packet accepted on interface %c%c\n", + netif->name[0], netif->name[1])); + /* break out of for loop */ + break; + } +#endif /* LWIP_AUTOIP */ + } + if (first) { + first = 0; + netif = netif_list; + } else { + netif = netif->next; + } + if (netif == inp) { + netif = netif->next; + } + } while(netif != NULL); + } + +#if IP_ACCEPT_LINK_LAYER_ADDRESSING + /* Pass DHCP messages regardless of destination address. DHCP traffic is addressed + * using link layer addressing (such as Ethernet MAC) so we must not filter on IP. + * According to RFC 1542 section 3.1.1, referred by RFC 2131). + * + * If you want to accept private broadcast communication while a netif is down, + * define LWIP_IP_ACCEPT_UDP_PORT(dst_port), e.g.: + * + * #define LWIP_IP_ACCEPT_UDP_PORT(dst_port) ((dst_port) == PP_NTOHS(12345)) + */ + if (netif == NULL) { + /* remote port is DHCP server? */ + if (IPH_PROTO(iphdr) == IP_PROTO_UDP) { + struct udp_hdr *udphdr = (struct udp_hdr *)((u8_t *)iphdr + iphdr_hlen); + LWIP_DEBUGF(IP_DEBUG | LWIP_DBG_TRACE, ("ip_input: UDP packet to DHCP client port %"U16_F"\n", + ntohs(udphdr->dest))); + if (IP_ACCEPT_LINK_LAYER_ADDRESSED_PORT(udphdr->dest)) { + LWIP_DEBUGF(IP_DEBUG | LWIP_DBG_TRACE, ("ip_input: DHCP packet accepted.\n")); + netif = inp; + check_ip_src = 0; + } + } + } +#endif /* IP_ACCEPT_LINK_LAYER_ADDRESSING */ + + /* broadcast or multicast packet source address? Compliant with RFC 1122: 3.2.1.3 */ +#if IP_ACCEPT_LINK_LAYER_ADDRESSING + /* DHCP servers need 0.0.0.0 to be allowed as source address (RFC 1.1.2.2: 3.2.1.3/a) */ + if (check_ip_src && !ip_addr_isany(¤t_iphdr_src)) +#endif /* IP_ACCEPT_LINK_LAYER_ADDRESSING */ + { if ((ip_addr_isbroadcast(¤t_iphdr_src, inp)) || + (ip_addr_ismulticast(¤t_iphdr_src))) { + /* packet source is not valid */ + LWIP_DEBUGF(IP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_LEVEL_WARNING, ("ip_input: packet source is not valid.\n")); + /* free (drop) packet pbufs */ + pbuf_free(p); + IP_STATS_INC(ip.drop); + snmp_inc_ipinaddrerrors(); + snmp_inc_ipindiscards(); + return ERR_OK; + } + } + + /* packet not for us? */ + if (netif == NULL) { + /* packet not for us, route or discard */ + LWIP_DEBUGF(IP_DEBUG | LWIP_DBG_TRACE, ("ip_input: packet not for us.\n")); +#if IP_FORWARD + /* non-broadcast packet? */ + if (!ip_addr_isbroadcast(¤t_iphdr_dest, inp)) { + /* try to forward IP packet on (other) interfaces */ + ip_forward(p, iphdr, inp); + } else +#endif /* IP_FORWARD */ + { + snmp_inc_ipinaddrerrors(); + snmp_inc_ipindiscards(); + } + pbuf_free(p); + return ERR_OK; + } + /* packet consists of multiple fragments? */ + if ((IPH_OFFSET(iphdr) & PP_HTONS(IP_OFFMASK | IP_MF)) != 0) { +#if IP_REASSEMBLY /* packet fragment reassembly code present? */ + LWIP_DEBUGF(IP_DEBUG, ("IP packet is a fragment (id=0x%04"X16_F" tot_len=%"U16_F" len=%"U16_F" MF=%"U16_F" offset=%"U16_F"), calling ip_reass()\n", + ntohs(IPH_ID(iphdr)), p->tot_len, ntohs(IPH_LEN(iphdr)), !!(IPH_OFFSET(iphdr) & PP_HTONS(IP_MF)), (ntohs(IPH_OFFSET(iphdr)) & IP_OFFMASK)*8)); + /* reassemble the packet*/ + p = ip_reass(p); + /* packet not fully reassembled yet? */ + if (p == NULL) { + return ERR_OK; + } + iphdr = (struct ip_hdr *)p->payload; +#else /* IP_REASSEMBLY == 0, no packet fragment reassembly code present */ + pbuf_free(p); + LWIP_DEBUGF(IP_DEBUG | LWIP_DBG_LEVEL_SERIOUS, ("IP packet dropped since it was fragmented (0x%"X16_F") (while IP_REASSEMBLY == 0).\n", + ntohs(IPH_OFFSET(iphdr)))); + IP_STATS_INC(ip.opterr); + IP_STATS_INC(ip.drop); + /* unsupported protocol feature */ + snmp_inc_ipinunknownprotos(); + return ERR_OK; +#endif /* IP_REASSEMBLY */ + } + +#if IP_OPTIONS_ALLOWED == 0 /* no support for IP options in the IP header? */ + +#if LWIP_IGMP + /* there is an extra "router alert" option in IGMP messages which we allow for but do not police */ + if((iphdr_hlen > IP_HLEN) && (IPH_PROTO(iphdr) != IP_PROTO_IGMP)) { +#else + if (iphdr_hlen > IP_HLEN) { +#endif /* LWIP_IGMP */ + LWIP_DEBUGF(IP_DEBUG | LWIP_DBG_LEVEL_SERIOUS, ("IP packet dropped since there were IP options (while IP_OPTIONS_ALLOWED == 0).\n")); + pbuf_free(p); + IP_STATS_INC(ip.opterr); + IP_STATS_INC(ip.drop); + /* unsupported protocol feature */ + snmp_inc_ipinunknownprotos(); + return ERR_OK; + } +#endif /* IP_OPTIONS_ALLOWED == 0 */ + + /* send to upper layers */ + LWIP_DEBUGF(IP_DEBUG, ("ip_input: \n")); + ip_debug_print(p); + LWIP_DEBUGF(IP_DEBUG, ("ip_input: p->len %"U16_F" p->tot_len %"U16_F"\n", p->len, p->tot_len)); + + current_netif = inp; + current_header = iphdr; + +#if LWIP_RAW + /* raw input did not eat the packet? */ + if (raw_input(p, inp) == 0) +#endif /* LWIP_RAW */ + { + + switch (IPH_PROTO(iphdr)) { +#if LWIP_UDP + case IP_PROTO_UDP: +#if LWIP_UDPLITE + case IP_PROTO_UDPLITE: +#endif /* LWIP_UDPLITE */ + snmp_inc_ipindelivers(); + udp_input(p, inp); + break; +#endif /* LWIP_UDP */ +#if LWIP_TCP + case IP_PROTO_TCP: + snmp_inc_ipindelivers(); + tcp_input(p, inp); + break; +#endif /* LWIP_TCP */ +#if LWIP_ICMP + case IP_PROTO_ICMP: + snmp_inc_ipindelivers(); + icmp_input(p, inp); + break; +#endif /* LWIP_ICMP */ +#if LWIP_IGMP + case IP_PROTO_IGMP: + igmp_input(p, inp, ¤t_iphdr_dest); + break; +#endif /* LWIP_IGMP */ + default: +#if LWIP_ICMP + /* send ICMP destination protocol unreachable unless is was a broadcast */ + if (!ip_addr_isbroadcast(¤t_iphdr_dest, inp) && + !ip_addr_ismulticast(¤t_iphdr_dest)) { + p->payload = iphdr; + icmp_dest_unreach(p, ICMP_DUR_PROTO); + } +#endif /* LWIP_ICMP */ + pbuf_free(p); + + LWIP_DEBUGF(IP_DEBUG | LWIP_DBG_LEVEL_SERIOUS, ("Unsupported transport protocol %"U16_F"\n", IPH_PROTO(iphdr))); + + IP_STATS_INC(ip.proterr); + IP_STATS_INC(ip.drop); + snmp_inc_ipinunknownprotos(); + } + } + + current_netif = NULL; + current_header = NULL; + ip_addr_set_any(¤t_iphdr_src); + ip_addr_set_any(¤t_iphdr_dest); + + return ERR_OK; +} + +/** + * Sends an IP packet on a network interface. This function constructs + * the IP header and calculates the IP header checksum. If the source + * IP address is NULL, the IP address of the outgoing network + * interface is filled in as source address. + * If the destination IP address is IP_HDRINCL, p is assumed to already + * include an IP header and p->payload points to it instead of the data. + * + * @param p the packet to send (p->payload points to the data, e.g. next + protocol header; if dest == IP_HDRINCL, p already includes an IP + header and p->payload points to that IP header) + * @param src the source IP address to send from (if src == IP_ADDR_ANY, the + * IP address of the netif used to send is used as source address) + * @param dest the destination IP address to send the packet to + * @param ttl the TTL value to be set in the IP header + * @param tos the TOS value to be set in the IP header + * @param proto the PROTOCOL to be set in the IP header + * @param netif the netif on which to send this packet + * @return ERR_OK if the packet was sent OK + * ERR_BUF if p doesn't have enough space for IP/LINK headers + * returns errors returned by netif->output + * + * @note ip_id: RFC791 "some host may be able to simply use + * unique identifiers independent of destination" + */ +err_t +ip_output_if(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest, + u8_t ttl, u8_t tos, + u8_t proto, struct netif *netif) +{ +#if IP_OPTIONS_SEND + return ip_output_if_opt(p, src, dest, ttl, tos, proto, netif, NULL, 0); +} + +/** + * Same as ip_output_if() but with the possibility to include IP options: + * + * @ param ip_options pointer to the IP options, copied into the IP header + * @ param optlen length of ip_options + */ +err_t ip_output_if_opt(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest, + u8_t ttl, u8_t tos, u8_t proto, struct netif *netif, void *ip_options, + u16_t optlen) +{ +#endif /* IP_OPTIONS_SEND */ + struct ip_hdr *iphdr; + ip_addr_t dest_addr; +#if CHECKSUM_GEN_IP_INLINE + u32_t chk_sum = 0; +#endif /* CHECKSUM_GEN_IP_INLINE */ + + /* pbufs passed to IP must have a ref-count of 1 as their payload pointer + gets altered as the packet is passed down the stack */ + LWIP_ASSERT("p->ref == 1", p->ref == 1); + + snmp_inc_ipoutrequests(); + + /* Should the IP header be generated or is it already included in p? */ + if (dest != IP_HDRINCL) { + u16_t ip_hlen = IP_HLEN; +#if IP_OPTIONS_SEND + u16_t optlen_aligned = 0; + if (optlen != 0) { +#if CHECKSUM_GEN_IP_INLINE + int i; +#endif /* CHECKSUM_GEN_IP_INLINE */ + /* round up to a multiple of 4 */ + optlen_aligned = ((optlen + 3) & ~3); + ip_hlen += optlen_aligned; + /* First write in the IP options */ + if (pbuf_header(p, optlen_aligned)) { + LWIP_DEBUGF(IP_DEBUG | LWIP_DBG_LEVEL_SERIOUS, ("ip_output_if_opt: not enough room for IP options in pbuf\n")); + IP_STATS_INC(ip.err); + snmp_inc_ipoutdiscards(); + return ERR_BUF; + } + MEMCPY(p->payload, ip_options, optlen); + if (optlen < optlen_aligned) { + /* zero the remaining bytes */ + memset(((char*)p->payload) + optlen, 0, optlen_aligned - optlen); + } +#if CHECKSUM_GEN_IP_INLINE + for (i = 0; i < optlen_aligned/2; i++) { + chk_sum += ((u16_t*)p->payload)[i]; + } +#endif /* CHECKSUM_GEN_IP_INLINE */ + } +#endif /* IP_OPTIONS_SEND */ + /* generate IP header */ + if (pbuf_header(p, IP_HLEN)) { + LWIP_DEBUGF(IP_DEBUG | LWIP_DBG_LEVEL_SERIOUS, ("ip_output: not enough room for IP header in pbuf\n")); + + IP_STATS_INC(ip.err); + snmp_inc_ipoutdiscards(); + return ERR_BUF; + } + + iphdr = (struct ip_hdr *)p->payload; + LWIP_ASSERT("check that first pbuf can hold struct ip_hdr", + (p->len >= sizeof(struct ip_hdr))); + + IPH_TTL_SET(iphdr, ttl); + IPH_PROTO_SET(iphdr, proto); +#if CHECKSUM_GEN_IP_INLINE + chk_sum += LWIP_MAKE_U16(proto, ttl); +#endif /* CHECKSUM_GEN_IP_INLINE */ + + /* dest cannot be NULL here */ + ip_addr_copy(iphdr->dest, *dest); +#if CHECKSUM_GEN_IP_INLINE + chk_sum += ip4_addr_get_u32(&iphdr->dest) & 0xFFFF; + chk_sum += ip4_addr_get_u32(&iphdr->dest) >> 16; +#endif /* CHECKSUM_GEN_IP_INLINE */ + + IPH_VHLTOS_SET(iphdr, 4, ip_hlen / 4, tos); +#if CHECKSUM_GEN_IP_INLINE + chk_sum += iphdr->_v_hl_tos; +#endif /* CHECKSUM_GEN_IP_INLINE */ + IPH_LEN_SET(iphdr, htons(p->tot_len)); +#if CHECKSUM_GEN_IP_INLINE + chk_sum += iphdr->_len; +#endif /* CHECKSUM_GEN_IP_INLINE */ + IPH_OFFSET_SET(iphdr, 0); + IPH_ID_SET(iphdr, htons(ip_id)); +#if CHECKSUM_GEN_IP_INLINE + chk_sum += iphdr->_id; +#endif /* CHECKSUM_GEN_IP_INLINE */ + ++ip_id; + + if (ip_addr_isany(src)) { + ip_addr_copy(iphdr->src, netif->ip_addr); + } else { + /* src cannot be NULL here */ + ip_addr_copy(iphdr->src, *src); + } + +#if CHECKSUM_GEN_IP_INLINE + chk_sum += ip4_addr_get_u32(&iphdr->src) & 0xFFFF; + chk_sum += ip4_addr_get_u32(&iphdr->src) >> 16; + chk_sum = (chk_sum >> 16) + (chk_sum & 0xFFFF); + chk_sum = (chk_sum >> 16) + chk_sum; + chk_sum = ~chk_sum; + iphdr->_chksum = chk_sum; /* network order */ +#else /* CHECKSUM_GEN_IP_INLINE */ + IPH_CHKSUM_SET(iphdr, 0); +#if CHECKSUM_GEN_IP + IPH_CHKSUM_SET(iphdr, inet_chksum(iphdr, ip_hlen)); +#endif +#endif /* CHECKSUM_GEN_IP_INLINE */ + } else { + /* IP header already included in p */ + iphdr = (struct ip_hdr *)p->payload; + ip_addr_copy(dest_addr, iphdr->dest); + dest = &dest_addr; + } + + IP_STATS_INC(ip.xmit); + + LWIP_DEBUGF(IP_DEBUG, ("ip_output_if: %c%c%"U16_F"\n", netif->name[0], netif->name[1], netif->num)); + ip_debug_print(p); + +#if ENABLE_LOOPBACK + if (ip_addr_cmp(dest, &netif->ip_addr)) { + /* Packet to self, enqueue it for loopback */ + LWIP_DEBUGF(IP_DEBUG, ("netif_loop_output()")); + return netif_loop_output(netif, p, dest); + } +#if LWIP_IGMP + if ((p->flags & PBUF_FLAG_MCASTLOOP) != 0) { + netif_loop_output(netif, p, dest); + } +#endif /* LWIP_IGMP */ +#endif /* ENABLE_LOOPBACK */ +#if IP_FRAG + /* don't fragment if interface has mtu set to 0 [loopif] */ + if (netif->mtu && (p->tot_len > netif->mtu)) { + return ip_frag(p, netif, dest); + } +#endif /* IP_FRAG */ + + LWIP_DEBUGF(IP_DEBUG, ("netif->output()")); + return netif->output(netif, p, dest); +} + +/** + * Simple interface to ip_output_if. It finds the outgoing network + * interface and calls upon ip_output_if to do the actual work. + * + * @param p the packet to send (p->payload points to the data, e.g. next + protocol header; if dest == IP_HDRINCL, p already includes an IP + header and p->payload points to that IP header) + * @param src the source IP address to send from (if src == IP_ADDR_ANY, the + * IP address of the netif used to send is used as source address) + * @param dest the destination IP address to send the packet to + * @param ttl the TTL value to be set in the IP header + * @param tos the TOS value to be set in the IP header + * @param proto the PROTOCOL to be set in the IP header + * + * @return ERR_RTE if no route is found + * see ip_output_if() for more return values + */ +err_t +ip_output(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest, + u8_t ttl, u8_t tos, u8_t proto) +{ + struct netif *netif; + + /* pbufs passed to IP must have a ref-count of 1 as their payload pointer + gets altered as the packet is passed down the stack */ + LWIP_ASSERT("p->ref == 1", p->ref == 1); + + if ((netif = ip_route(dest)) == NULL) { + LWIP_DEBUGF(IP_DEBUG, ("ip_output: No route to %"U16_F".%"U16_F".%"U16_F".%"U16_F"\n", + ip4_addr1_16(dest), ip4_addr2_16(dest), ip4_addr3_16(dest), ip4_addr4_16(dest))); + IP_STATS_INC(ip.rterr); + return ERR_RTE; + } + + return ip_output_if(p, src, dest, ttl, tos, proto, netif); +} + +#if LWIP_NETIF_HWADDRHINT +/** Like ip_output, but takes and addr_hint pointer that is passed on to netif->addr_hint + * before calling ip_output_if. + * + * @param p the packet to send (p->payload points to the data, e.g. next + protocol header; if dest == IP_HDRINCL, p already includes an IP + header and p->payload points to that IP header) + * @param src the source IP address to send from (if src == IP_ADDR_ANY, the + * IP address of the netif used to send is used as source address) + * @param dest the destination IP address to send the packet to + * @param ttl the TTL value to be set in the IP header + * @param tos the TOS value to be set in the IP header + * @param proto the PROTOCOL to be set in the IP header + * @param addr_hint address hint pointer set to netif->addr_hint before + * calling ip_output_if() + * + * @return ERR_RTE if no route is found + * see ip_output_if() for more return values + */ +err_t +ip_output_hinted(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest, + u8_t ttl, u8_t tos, u8_t proto, u8_t *addr_hint) +{ + struct netif *netif; + err_t err; + + /* pbufs passed to IP must have a ref-count of 1 as their payload pointer + gets altered as the packet is passed down the stack */ + LWIP_ASSERT("p->ref == 1", p->ref == 1); + + if ((netif = ip_route(dest)) == NULL) { + LWIP_DEBUGF(IP_DEBUG, ("ip_output: No route to %"U16_F".%"U16_F".%"U16_F".%"U16_F"\n", + ip4_addr1_16(dest), ip4_addr2_16(dest), ip4_addr3_16(dest), ip4_addr4_16(dest))); + IP_STATS_INC(ip.rterr); + return ERR_RTE; + } + + netif->addr_hint = addr_hint; + err = ip_output_if(p, src, dest, ttl, tos, proto, netif); + netif->addr_hint = NULL; + + return err; +} +#endif /* LWIP_NETIF_HWADDRHINT*/ + +#if IP_DEBUG +/* Print an IP header by using LWIP_DEBUGF + * @param p an IP packet, p->payload pointing to the IP header + */ +void +ip_debug_print(struct pbuf *p) +{ + struct ip_hdr *iphdr = (struct ip_hdr *)p->payload; + u8_t *payload; + + payload = (u8_t *)iphdr + IP_HLEN; + + LWIP_DEBUGF(IP_DEBUG, ("IP header:\n")); + LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n")); + LWIP_DEBUGF(IP_DEBUG, ("|%2"S16_F" |%2"S16_F" | 0x%02"X16_F" | %5"U16_F" | (v, hl, tos, len)\n", + IPH_V(iphdr), + IPH_HL(iphdr), + IPH_TOS(iphdr), + ntohs(IPH_LEN(iphdr)))); + LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n")); + LWIP_DEBUGF(IP_DEBUG, ("| %5"U16_F" |%"U16_F"%"U16_F"%"U16_F"| %4"U16_F" | (id, flags, offset)\n", + ntohs(IPH_ID(iphdr)), + ntohs(IPH_OFFSET(iphdr)) >> 15 & 1, + ntohs(IPH_OFFSET(iphdr)) >> 14 & 1, + ntohs(IPH_OFFSET(iphdr)) >> 13 & 1, + ntohs(IPH_OFFSET(iphdr)) & IP_OFFMASK)); + LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n")); + LWIP_DEBUGF(IP_DEBUG, ("| %3"U16_F" | %3"U16_F" | 0x%04"X16_F" | (ttl, proto, chksum)\n", + IPH_TTL(iphdr), + IPH_PROTO(iphdr), + ntohs(IPH_CHKSUM(iphdr)))); + LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n")); + LWIP_DEBUGF(IP_DEBUG, ("| %3"U16_F" | %3"U16_F" | %3"U16_F" | %3"U16_F" | (src)\n", + ip4_addr1_16(&iphdr->src), + ip4_addr2_16(&iphdr->src), + ip4_addr3_16(&iphdr->src), + ip4_addr4_16(&iphdr->src))); + LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n")); + LWIP_DEBUGF(IP_DEBUG, ("| %3"U16_F" | %3"U16_F" | %3"U16_F" | %3"U16_F" | (dest)\n", + ip4_addr1_16(&iphdr->dest), + ip4_addr2_16(&iphdr->dest), + ip4_addr3_16(&iphdr->dest), + ip4_addr4_16(&iphdr->dest))); + LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n")); +} +#endif /* IP_DEBUG */ diff --git a/lib/drivers/lwip/src/core/ipv4/ip_addr.c b/lib/drivers/lwip/src/core/ipv4/ip_addr.c new file mode 100644 index 00000000000..8f633ff2310 --- /dev/null +++ b/lib/drivers/lwip/src/core/ipv4/ip_addr.c @@ -0,0 +1,312 @@ +/** + * @file + * This is the IPv4 address tools implementation. + * + */ + +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ + +#include "lwip/opt.h" +#include "lwip/ip_addr.h" +#include "lwip/netif.h" + +/* used by IP_ADDR_ANY and IP_ADDR_BROADCAST in ip_addr.h */ +const ip_addr_t ip_addr_any = { IPADDR_ANY }; +const ip_addr_t ip_addr_broadcast = { IPADDR_BROADCAST }; + +/** + * Determine if an address is a broadcast address on a network interface + * + * @param addr address to be checked + * @param netif the network interface against which the address is checked + * @return returns non-zero if the address is a broadcast address + */ +u8_t +ip4_addr_isbroadcast(u32_t addr, const struct netif *netif) +{ + ip_addr_t ipaddr; + ip4_addr_set_u32(&ipaddr, addr); + + /* all ones (broadcast) or all zeroes (old skool broadcast) */ + if ((~addr == IPADDR_ANY) || + (addr == IPADDR_ANY)) { + return 1; + /* no broadcast support on this network interface? */ + } else if ((netif->flags & NETIF_FLAG_BROADCAST) == 0) { + /* the given address cannot be a broadcast address + * nor can we check against any broadcast addresses */ + return 0; + /* address matches network interface address exactly? => no broadcast */ + } else if (addr == ip4_addr_get_u32(&netif->ip_addr)) { + return 0; + /* on the same (sub) network... */ + } else if (ip_addr_netcmp(&ipaddr, &(netif->ip_addr), &(netif->netmask)) + /* ...and host identifier bits are all ones? =>... */ + && ((addr & ~ip4_addr_get_u32(&netif->netmask)) == + (IPADDR_BROADCAST & ~ip4_addr_get_u32(&netif->netmask)))) { + /* => network broadcast address */ + return 1; + } else { + return 0; + } +} + +/** Checks if a netmask is valid (starting with ones, then only zeros) + * + * @param netmask the IPv4 netmask to check (in network byte order!) + * @return 1 if the netmask is valid, 0 if it is not + */ +u8_t +ip4_addr_netmask_valid(u32_t netmask) +{ + u32_t mask; + u32_t nm_hostorder = lwip_htonl(netmask); + + /* first, check for the first zero */ + for (mask = 1UL << 31 ; mask != 0; mask >>= 1) { + if ((nm_hostorder & mask) == 0) { + break; + } + } + /* then check that there is no one */ + for (; mask != 0; mask >>= 1) { + if ((nm_hostorder & mask) != 0) { + /* there is a one after the first zero -> invalid */ + return 0; + } + } + /* no one after the first zero -> valid */ + return 1; +} + +/* Here for now until needed in other places in lwIP */ +#ifndef isprint +#define in_range(c, lo, up) ((u8_t)c >= lo && (u8_t)c <= up) +#define isprint(c) in_range(c, 0x20, 0x7f) +#define isdigit(c) in_range(c, '0', '9') +#define isxdigit(c) (isdigit(c) || in_range(c, 'a', 'f') || in_range(c, 'A', 'F')) +#define islower(c) in_range(c, 'a', 'z') +#define isspace(c) (c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\t' || c == '\v') +#endif + +/** + * Ascii internet address interpretation routine. + * The value returned is in network order. + * + * @param cp IP address in ascii represenation (e.g. "127.0.0.1") + * @return ip address in network order + */ +u32_t +ipaddr_addr(const char *cp) +{ + ip_addr_t val; + + if (ipaddr_aton(cp, &val)) { + return ip4_addr_get_u32(&val); + } + return (IPADDR_NONE); +} + +/** + * Check whether "cp" is a valid ascii representation + * of an Internet address and convert to a binary address. + * Returns 1 if the address is valid, 0 if not. + * This replaces inet_addr, the return value from which + * cannot distinguish between failure and a local broadcast address. + * + * @param cp IP address in ascii represenation (e.g. "127.0.0.1") + * @param addr pointer to which to save the ip address in network order + * @return 1 if cp could be converted to addr, 0 on failure + */ +int +ipaddr_aton(const char *cp, ip_addr_t *addr) +{ + u32_t val; + u8_t base; + char c; + u32_t parts[4]; + u32_t *pp = parts; + + c = *cp; + for (;;) { + /* + * Collect number up to ``.''. + * Values are specified as for C: + * 0x=hex, 0=octal, 1-9=decimal. + */ + if (!isdigit(c)) + return (0); + val = 0; + base = 10; + if (c == '0') { + c = *++cp; + if (c == 'x' || c == 'X') { + base = 16; + c = *++cp; + } else + base = 8; + } + for (;;) { + if (isdigit(c)) { + val = (val * base) + (int)(c - '0'); + c = *++cp; + } else if (base == 16 && isxdigit(c)) { + val = (val << 4) | (int)(c + 10 - (islower(c) ? 'a' : 'A')); + c = *++cp; + } else + break; + } + if (c == '.') { + /* + * Internet format: + * a.b.c.d + * a.b.c (with c treated as 16 bits) + * a.b (with b treated as 24 bits) + */ + if (pp >= parts + 3) { + return (0); + } + *pp++ = val; + c = *++cp; + } else + break; + } + /* + * Check for trailing characters. + */ + if (c != '\0' && !isspace(c)) { + return (0); + } + /* + * Concoct the address according to + * the number of parts specified. + */ + switch (pp - parts + 1) { + + case 0: + return (0); /* initial nondigit */ + + case 1: /* a -- 32 bits */ + break; + + case 2: /* a.b -- 8.24 bits */ + if (val > 0xffffffUL) { + return (0); + } + val |= parts[0] << 24; + break; + + case 3: /* a.b.c -- 8.8.16 bits */ + if (val > 0xffff) { + return (0); + } + val |= (parts[0] << 24) | (parts[1] << 16); + break; + + case 4: /* a.b.c.d -- 8.8.8.8 bits */ + if (val > 0xff) { + return (0); + } + val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8); + break; + default: + LWIP_ASSERT("unhandled", 0); + break; + } + if (addr) { + ip4_addr_set_u32(addr, htonl(val)); + } + return (1); +} + +/** + * Convert numeric IP address into decimal dotted ASCII representation. + * returns ptr to static buffer; not reentrant! + * + * @param addr ip address in network order to convert + * @return pointer to a global static (!) buffer that holds the ASCII + * represenation of addr + */ +char * +ipaddr_ntoa(const ip_addr_t *addr) +{ + static char str[16]; + return ipaddr_ntoa_r(addr, str, 16); +} + +/** + * Same as ipaddr_ntoa, but reentrant since a user-supplied buffer is used. + * + * @param addr ip address in network order to convert + * @param buf target buffer where the string is stored + * @param buflen length of buf + * @return either pointer to buf which now holds the ASCII + * representation of addr or NULL if buf was too small + */ +char *ipaddr_ntoa_r(const ip_addr_t *addr, char *buf, int buflen) +{ + u32_t s_addr; + char inv[3]; + char *rp; + u8_t *ap; + u8_t rem; + u8_t n; + u8_t i; + int len = 0; + + s_addr = ip4_addr_get_u32(addr); + + rp = buf; + ap = (u8_t *)&s_addr; + for(n = 0; n < 4; n++) { + i = 0; + do { + rem = *ap % (u8_t)10; + *ap /= (u8_t)10; + inv[i++] = '0' + rem; + } while(*ap); + while(i--) { + if (len++ >= buflen) { + return NULL; + } + *rp++ = inv[i]; + } + if (len++ >= buflen) { + return NULL; + } + *rp++ = '.'; + ap++; + } + *--rp = 0; + return buf; +} diff --git a/lib/drivers/lwip/src/core/ipv4/ip_frag.c b/lib/drivers/lwip/src/core/ipv4/ip_frag.c new file mode 100644 index 00000000000..8d184345dff --- /dev/null +++ b/lib/drivers/lwip/src/core/ipv4/ip_frag.c @@ -0,0 +1,863 @@ +/** + * @file + * This is the IPv4 packet segmentation and reassembly implementation. + * + */ + +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Jani Monoses + * Simon Goldschmidt + * original reassembly code by Adam Dunkels + * + */ + +#include "lwip/opt.h" +#include "lwip/ip_frag.h" +#include "lwip/def.h" +#include "lwip/inet_chksum.h" +#include "lwip/netif.h" +#include "lwip/snmp.h" +#include "lwip/stats.h" +#include "lwip/icmp.h" + +#include + +#if IP_REASSEMBLY +/** + * The IP reassembly code currently has the following limitations: + * - IP header options are not supported + * - fragments must not overlap (e.g. due to different routes), + * currently, overlapping or duplicate fragments are thrown away + * if IP_REASS_CHECK_OVERLAP=1 (the default)! + * + * @todo: work with IP header options + */ + +/** Setting this to 0, you can turn off checking the fragments for overlapping + * regions. The code gets a little smaller. Only use this if you know that + * overlapping won't occur on your network! */ +#ifndef IP_REASS_CHECK_OVERLAP +#define IP_REASS_CHECK_OVERLAP 1 +#endif /* IP_REASS_CHECK_OVERLAP */ + +/** Set to 0 to prevent freeing the oldest datagram when the reassembly buffer is + * full (IP_REASS_MAX_PBUFS pbufs are enqueued). The code gets a little smaller. + * Datagrams will be freed by timeout only. Especially useful when MEMP_NUM_REASSDATA + * is set to 1, so one datagram can be reassembled at a time, only. */ +#ifndef IP_REASS_FREE_OLDEST +#define IP_REASS_FREE_OLDEST 1 +#endif /* IP_REASS_FREE_OLDEST */ + +#define IP_REASS_FLAG_LASTFRAG 0x01 + +/** This is a helper struct which holds the starting + * offset and the ending offset of this fragment to + * easily chain the fragments. + * It has the same packing requirements as the IP header, since it replaces + * the IP header in memory in incoming fragments (after copying it) to keep + * track of the various fragments. (-> If the IP header doesn't need packing, + * this struct doesn't need packing, too.) + */ +#ifdef PACK_STRUCT_USE_INCLUDES +# include "arch/bpstruct.h" +#endif +PACK_STRUCT_BEGIN +struct ip_reass_helper { + PACK_STRUCT_FIELD(struct pbuf *next_pbuf); + PACK_STRUCT_FIELD(u16_t start); + PACK_STRUCT_FIELD(u16_t end); +} PACK_STRUCT_STRUCT; +PACK_STRUCT_END +#ifdef PACK_STRUCT_USE_INCLUDES +# include "arch/epstruct.h" +#endif + +#define IP_ADDRESSES_AND_ID_MATCH(iphdrA, iphdrB) \ + (ip_addr_cmp(&(iphdrA)->src, &(iphdrB)->src) && \ + ip_addr_cmp(&(iphdrA)->dest, &(iphdrB)->dest) && \ + IPH_ID(iphdrA) == IPH_ID(iphdrB)) ? 1 : 0 + +/* global variables */ +static struct ip_reassdata *reassdatagrams; +static u16_t ip_reass_pbufcount; + +/* function prototypes */ +static void ip_reass_dequeue_datagram(struct ip_reassdata *ipr, struct ip_reassdata *prev); +static int ip_reass_free_complete_datagram(struct ip_reassdata *ipr, struct ip_reassdata *prev); + +/** + * Reassembly timer base function + * for both NO_SYS == 0 and 1 (!). + * + * Should be called every 1000 msec (defined by IP_TMR_INTERVAL). + */ +void +ip_reass_tmr(void) +{ + struct ip_reassdata *r, *prev = NULL; + + r = reassdatagrams; + while (r != NULL) { + /* Decrement the timer. Once it reaches 0, + * clean up the incomplete fragment assembly */ + if (r->timer > 0) { + r->timer--; + LWIP_DEBUGF(IP_REASS_DEBUG, ("ip_reass_tmr: timer dec %"U16_F"\n",(u16_t)r->timer)); + prev = r; + r = r->next; + } else { + /* reassembly timed out */ + struct ip_reassdata *tmp; + LWIP_DEBUGF(IP_REASS_DEBUG, ("ip_reass_tmr: timer timed out\n")); + tmp = r; + /* get the next pointer before freeing */ + r = r->next; + /* free the helper struct and all enqueued pbufs */ + ip_reass_free_complete_datagram(tmp, prev); + } + } +} + +/** + * Free a datagram (struct ip_reassdata) and all its pbufs. + * Updates the total count of enqueued pbufs (ip_reass_pbufcount), + * SNMP counters and sends an ICMP time exceeded packet. + * + * @param ipr datagram to free + * @param prev the previous datagram in the linked list + * @return the number of pbufs freed + */ +static int +ip_reass_free_complete_datagram(struct ip_reassdata *ipr, struct ip_reassdata *prev) +{ + u16_t pbufs_freed = 0; + u8_t clen; + struct pbuf *p; + struct ip_reass_helper *iprh; + + LWIP_ASSERT("prev != ipr", prev != ipr); + if (prev != NULL) { + LWIP_ASSERT("prev->next == ipr", prev->next == ipr); + } + + snmp_inc_ipreasmfails(); +#if LWIP_ICMP + iprh = (struct ip_reass_helper *)ipr->p->payload; + if (iprh->start == 0) { + /* The first fragment was received, send ICMP time exceeded. */ + /* First, de-queue the first pbuf from r->p. */ + p = ipr->p; + ipr->p = iprh->next_pbuf; + /* Then, copy the original header into it. */ + SMEMCPY(p->payload, &ipr->iphdr, IP_HLEN); + icmp_time_exceeded(p, ICMP_TE_FRAG); + clen = pbuf_clen(p); + LWIP_ASSERT("pbufs_freed + clen <= 0xffff", pbufs_freed + clen <= 0xffff); + pbufs_freed += clen; + pbuf_free(p); + } +#endif /* LWIP_ICMP */ + + /* First, free all received pbufs. The individual pbufs need to be released + separately as they have not yet been chained */ + p = ipr->p; + while (p != NULL) { + struct pbuf *pcur; + iprh = (struct ip_reass_helper *)p->payload; + pcur = p; + /* get the next pointer before freeing */ + p = iprh->next_pbuf; + clen = pbuf_clen(pcur); + LWIP_ASSERT("pbufs_freed + clen <= 0xffff", pbufs_freed + clen <= 0xffff); + pbufs_freed += clen; + pbuf_free(pcur); + } + /* Then, unchain the struct ip_reassdata from the list and free it. */ + ip_reass_dequeue_datagram(ipr, prev); + LWIP_ASSERT("ip_reass_pbufcount >= clen", ip_reass_pbufcount >= pbufs_freed); + ip_reass_pbufcount -= pbufs_freed; + + return pbufs_freed; +} + +#if IP_REASS_FREE_OLDEST +/** + * Free the oldest datagram to make room for enqueueing new fragments. + * The datagram 'fraghdr' belongs to is not freed! + * + * @param fraghdr IP header of the current fragment + * @param pbufs_needed number of pbufs needed to enqueue + * (used for freeing other datagrams if not enough space) + * @return the number of pbufs freed + */ +static int +ip_reass_remove_oldest_datagram(struct ip_hdr *fraghdr, int pbufs_needed) +{ + /* @todo Can't we simply remove the last datagram in the + * linked list behind reassdatagrams? + */ + struct ip_reassdata *r, *oldest, *prev; + int pbufs_freed = 0, pbufs_freed_current; + int other_datagrams; + + /* Free datagrams until being allowed to enqueue 'pbufs_needed' pbufs, + * but don't free the datagram that 'fraghdr' belongs to! */ + do { + oldest = NULL; + prev = NULL; + other_datagrams = 0; + r = reassdatagrams; + while (r != NULL) { + if (!IP_ADDRESSES_AND_ID_MATCH(&r->iphdr, fraghdr)) { + /* Not the same datagram as fraghdr */ + other_datagrams++; + if (oldest == NULL) { + oldest = r; + } else if (r->timer <= oldest->timer) { + /* older than the previous oldest */ + oldest = r; + } + } + if (r->next != NULL) { + prev = r; + } + r = r->next; + } + if (oldest != NULL) { + pbufs_freed_current = ip_reass_free_complete_datagram(oldest, prev); + pbufs_freed += pbufs_freed_current; + } + } while ((pbufs_freed < pbufs_needed) && (other_datagrams > 1)); + return pbufs_freed; +} +#endif /* IP_REASS_FREE_OLDEST */ + +/** + * Enqueues a new fragment into the fragment queue + * @param fraghdr points to the new fragments IP hdr + * @param clen number of pbufs needed to enqueue (used for freeing other datagrams if not enough space) + * @return A pointer to the queue location into which the fragment was enqueued + */ +static struct ip_reassdata* +ip_reass_enqueue_new_datagram(struct ip_hdr *fraghdr, int clen) +{ + struct ip_reassdata* ipr; + /* No matching previous fragment found, allocate a new reassdata struct */ + ipr = (struct ip_reassdata *)memp_malloc(MEMP_REASSDATA); + if (ipr == NULL) { +#if IP_REASS_FREE_OLDEST + if (ip_reass_remove_oldest_datagram(fraghdr, clen) >= clen) { + ipr = (struct ip_reassdata *)memp_malloc(MEMP_REASSDATA); + } + if (ipr == NULL) +#endif /* IP_REASS_FREE_OLDEST */ + { + IPFRAG_STATS_INC(ip_frag.memerr); + LWIP_DEBUGF(IP_REASS_DEBUG,("Failed to alloc reassdata struct\n")); + return NULL; + } + } + memset(ipr, 0, sizeof(struct ip_reassdata)); + ipr->timer = IP_REASS_MAXAGE; + + /* enqueue the new structure to the front of the list */ + ipr->next = reassdatagrams; + reassdatagrams = ipr; + /* copy the ip header for later tests and input */ + /* @todo: no ip options supported? */ + SMEMCPY(&(ipr->iphdr), fraghdr, IP_HLEN); + return ipr; +} + +/** + * Dequeues a datagram from the datagram queue. Doesn't deallocate the pbufs. + * @param ipr points to the queue entry to dequeue + */ +static void +ip_reass_dequeue_datagram(struct ip_reassdata *ipr, struct ip_reassdata *prev) +{ + + /* dequeue the reass struct */ + if (reassdatagrams == ipr) { + /* it was the first in the list */ + reassdatagrams = ipr->next; + } else { + /* it wasn't the first, so it must have a valid 'prev' */ + LWIP_ASSERT("sanity check linked list", prev != NULL); + prev->next = ipr->next; + } + + /* now we can free the ip_reass struct */ + memp_free(MEMP_REASSDATA, ipr); +} + +/** + * Chain a new pbuf into the pbuf list that composes the datagram. The pbuf list + * will grow over time as new pbufs are rx. + * Also checks that the datagram passes basic continuity checks (if the last + * fragment was received at least once). + * @param root_p points to the 'root' pbuf for the current datagram being assembled. + * @param new_p points to the pbuf for the current fragment + * @return 0 if invalid, >0 otherwise + */ +static int +ip_reass_chain_frag_into_datagram_and_validate(struct ip_reassdata *ipr, struct pbuf *new_p) +{ + struct ip_reass_helper *iprh, *iprh_tmp, *iprh_prev=NULL; + struct pbuf *q; + u16_t offset,len; + struct ip_hdr *fraghdr; + int valid = 1; + + /* Extract length and fragment offset from current fragment */ + fraghdr = (struct ip_hdr*)new_p->payload; + len = ntohs(IPH_LEN(fraghdr)) - IPH_HL(fraghdr) * 4; + offset = (ntohs(IPH_OFFSET(fraghdr)) & IP_OFFMASK) * 8; + + /* overwrite the fragment's ip header from the pbuf with our helper struct, + * and setup the embedded helper structure. */ + /* make sure the struct ip_reass_helper fits into the IP header */ + LWIP_ASSERT("sizeof(struct ip_reass_helper) <= IP_HLEN", + sizeof(struct ip_reass_helper) <= IP_HLEN); + iprh = (struct ip_reass_helper*)new_p->payload; + iprh->next_pbuf = NULL; + iprh->start = offset; + iprh->end = offset + len; + + /* Iterate through until we either get to the end of the list (append), + * or we find on with a larger offset (insert). */ + for (q = ipr->p; q != NULL;) { + iprh_tmp = (struct ip_reass_helper*)q->payload; + if (iprh->start < iprh_tmp->start) { + /* the new pbuf should be inserted before this */ + iprh->next_pbuf = q; + if (iprh_prev != NULL) { + /* not the fragment with the lowest offset */ +#if IP_REASS_CHECK_OVERLAP + if ((iprh->start < iprh_prev->end) || (iprh->end > iprh_tmp->start)) { + /* fragment overlaps with previous or following, throw away */ + goto freepbuf; + } +#endif /* IP_REASS_CHECK_OVERLAP */ + iprh_prev->next_pbuf = new_p; + } else { + /* fragment with the lowest offset */ + ipr->p = new_p; + } + break; + } else if(iprh->start == iprh_tmp->start) { + /* received the same datagram twice: no need to keep the datagram */ + goto freepbuf; +#if IP_REASS_CHECK_OVERLAP + } else if(iprh->start < iprh_tmp->end) { + /* overlap: no need to keep the new datagram */ + goto freepbuf; +#endif /* IP_REASS_CHECK_OVERLAP */ + } else { + /* Check if the fragments received so far have no wholes. */ + if (iprh_prev != NULL) { + if (iprh_prev->end != iprh_tmp->start) { + /* There is a fragment missing between the current + * and the previous fragment */ + valid = 0; + } + } + } + q = iprh_tmp->next_pbuf; + iprh_prev = iprh_tmp; + } + + /* If q is NULL, then we made it to the end of the list. Determine what to do now */ + if (q == NULL) { + if (iprh_prev != NULL) { + /* this is (for now), the fragment with the highest offset: + * chain it to the last fragment */ +#if IP_REASS_CHECK_OVERLAP + LWIP_ASSERT("check fragments don't overlap", iprh_prev->end <= iprh->start); +#endif /* IP_REASS_CHECK_OVERLAP */ + iprh_prev->next_pbuf = new_p; + if (iprh_prev->end != iprh->start) { + valid = 0; + } + } else { +#if IP_REASS_CHECK_OVERLAP + LWIP_ASSERT("no previous fragment, this must be the first fragment!", + ipr->p == NULL); +#endif /* IP_REASS_CHECK_OVERLAP */ + /* this is the first fragment we ever received for this ip datagram */ + ipr->p = new_p; + } + } + + /* At this point, the validation part begins: */ + /* If we already received the last fragment */ + if ((ipr->flags & IP_REASS_FLAG_LASTFRAG) != 0) { + /* and had no wholes so far */ + if (valid) { + /* then check if the rest of the fragments is here */ + /* Check if the queue starts with the first datagram */ + if (((struct ip_reass_helper*)ipr->p->payload)->start != 0) { + valid = 0; + } else { + /* and check that there are no wholes after this datagram */ + iprh_prev = iprh; + q = iprh->next_pbuf; + while (q != NULL) { + iprh = (struct ip_reass_helper*)q->payload; + if (iprh_prev->end != iprh->start) { + valid = 0; + break; + } + iprh_prev = iprh; + q = iprh->next_pbuf; + } + /* if still valid, all fragments are received + * (because to the MF==0 already arrived */ + if (valid) { + LWIP_ASSERT("sanity check", ipr->p != NULL); + LWIP_ASSERT("sanity check", + ((struct ip_reass_helper*)ipr->p->payload) != iprh); + LWIP_ASSERT("validate_datagram:next_pbuf!=NULL", + iprh->next_pbuf == NULL); + LWIP_ASSERT("validate_datagram:datagram end!=datagram len", + iprh->end == ipr->datagram_len); + } + } + } + /* If valid is 0 here, there are some fragments missing in the middle + * (since MF == 0 has already arrived). Such datagrams simply time out if + * no more fragments are received... */ + return valid; + } + /* If we come here, not all fragments were received, yet! */ + return 0; /* not yet valid! */ +#if IP_REASS_CHECK_OVERLAP +freepbuf: + ip_reass_pbufcount -= pbuf_clen(new_p); + pbuf_free(new_p); + return 0; +#endif /* IP_REASS_CHECK_OVERLAP */ +} + +/** + * Reassembles incoming IP fragments into an IP datagram. + * + * @param p points to a pbuf chain of the fragment + * @return NULL if reassembly is incomplete, ? otherwise + */ +struct pbuf * +ip_reass(struct pbuf *p) +{ + struct pbuf *r; + struct ip_hdr *fraghdr; + struct ip_reassdata *ipr; + struct ip_reass_helper *iprh; + u16_t offset, len; + u8_t clen; + struct ip_reassdata *ipr_prev = NULL; + + IPFRAG_STATS_INC(ip_frag.recv); + snmp_inc_ipreasmreqds(); + + fraghdr = (struct ip_hdr*)p->payload; + + if ((IPH_HL(fraghdr) * 4) != IP_HLEN) { + LWIP_DEBUGF(IP_REASS_DEBUG,("ip_reass: IP options currently not supported!\n")); + IPFRAG_STATS_INC(ip_frag.err); + goto nullreturn; + } + + offset = (ntohs(IPH_OFFSET(fraghdr)) & IP_OFFMASK) * 8; + len = ntohs(IPH_LEN(fraghdr)) - IPH_HL(fraghdr) * 4; + + /* Check if we are allowed to enqueue more datagrams. */ + clen = pbuf_clen(p); + if ((ip_reass_pbufcount + clen) > IP_REASS_MAX_PBUFS) { +#if IP_REASS_FREE_OLDEST + if (!ip_reass_remove_oldest_datagram(fraghdr, clen) || + ((ip_reass_pbufcount + clen) > IP_REASS_MAX_PBUFS)) +#endif /* IP_REASS_FREE_OLDEST */ + { + /* No datagram could be freed and still too many pbufs enqueued */ + LWIP_DEBUGF(IP_REASS_DEBUG,("ip_reass: Overflow condition: pbufct=%d, clen=%d, MAX=%d\n", + ip_reass_pbufcount, clen, IP_REASS_MAX_PBUFS)); + IPFRAG_STATS_INC(ip_frag.memerr); + /* @todo: send ICMP time exceeded here? */ + /* drop this pbuf */ + goto nullreturn; + } + } + + /* Look for the datagram the fragment belongs to in the current datagram queue, + * remembering the previous in the queue for later dequeueing. */ + for (ipr = reassdatagrams; ipr != NULL; ipr = ipr->next) { + /* Check if the incoming fragment matches the one currently present + in the reassembly buffer. If so, we proceed with copying the + fragment into the buffer. */ + if (IP_ADDRESSES_AND_ID_MATCH(&ipr->iphdr, fraghdr)) { + LWIP_DEBUGF(IP_REASS_DEBUG, ("ip_reass: matching previous fragment ID=%"X16_F"\n", + ntohs(IPH_ID(fraghdr)))); + IPFRAG_STATS_INC(ip_frag.cachehit); + break; + } + ipr_prev = ipr; + } + + if (ipr == NULL) { + /* Enqueue a new datagram into the datagram queue */ + ipr = ip_reass_enqueue_new_datagram(fraghdr, clen); + /* Bail if unable to enqueue */ + if(ipr == NULL) { + goto nullreturn; + } + } else { + if (((ntohs(IPH_OFFSET(fraghdr)) & IP_OFFMASK) == 0) && + ((ntohs(IPH_OFFSET(&ipr->iphdr)) & IP_OFFMASK) != 0)) { + /* ipr->iphdr is not the header from the first fragment, but fraghdr is + * -> copy fraghdr into ipr->iphdr since we want to have the header + * of the first fragment (for ICMP time exceeded and later, for copying + * all options, if supported)*/ + SMEMCPY(&ipr->iphdr, fraghdr, IP_HLEN); + } + } + /* Track the current number of pbufs current 'in-flight', in order to limit + the number of fragments that may be enqueued at any one time */ + ip_reass_pbufcount += clen; + + /* At this point, we have either created a new entry or pointing + * to an existing one */ + + /* check for 'no more fragments', and update queue entry*/ + if ((IPH_OFFSET(fraghdr) & PP_NTOHS(IP_MF)) == 0) { + ipr->flags |= IP_REASS_FLAG_LASTFRAG; + ipr->datagram_len = offset + len; + LWIP_DEBUGF(IP_REASS_DEBUG, + ("ip_reass: last fragment seen, total len %"S16_F"\n", + ipr->datagram_len)); + } + /* find the right place to insert this pbuf */ + /* @todo: trim pbufs if fragments are overlapping */ + if (ip_reass_chain_frag_into_datagram_and_validate(ipr, p)) { + /* the totally last fragment (flag more fragments = 0) was received at least + * once AND all fragments are received */ + ipr->datagram_len += IP_HLEN; + + /* save the second pbuf before copying the header over the pointer */ + r = ((struct ip_reass_helper*)ipr->p->payload)->next_pbuf; + + /* copy the original ip header back to the first pbuf */ + fraghdr = (struct ip_hdr*)(ipr->p->payload); + SMEMCPY(fraghdr, &ipr->iphdr, IP_HLEN); + IPH_LEN_SET(fraghdr, htons(ipr->datagram_len)); + IPH_OFFSET_SET(fraghdr, 0); + IPH_CHKSUM_SET(fraghdr, 0); + /* @todo: do we need to set calculate the correct checksum? */ + IPH_CHKSUM_SET(fraghdr, inet_chksum(fraghdr, IP_HLEN)); + + p = ipr->p; + + /* chain together the pbufs contained within the reass_data list. */ + while(r != NULL) { + iprh = (struct ip_reass_helper*)r->payload; + + /* hide the ip header for every succeding fragment */ + pbuf_header(r, -IP_HLEN); + pbuf_cat(p, r); + r = iprh->next_pbuf; + } + /* release the sources allocate for the fragment queue entry */ + ip_reass_dequeue_datagram(ipr, ipr_prev); + + /* and adjust the number of pbufs currently queued for reassembly. */ + ip_reass_pbufcount -= pbuf_clen(p); + + /* Return the pbuf chain */ + return p; + } + /* the datagram is not (yet?) reassembled completely */ + LWIP_DEBUGF(IP_REASS_DEBUG,("ip_reass_pbufcount: %d out\n", ip_reass_pbufcount)); + return NULL; + +nullreturn: + LWIP_DEBUGF(IP_REASS_DEBUG,("ip_reass: nullreturn\n")); + IPFRAG_STATS_INC(ip_frag.drop); + pbuf_free(p); + return NULL; +} +#endif /* IP_REASSEMBLY */ + +#if IP_FRAG +#if IP_FRAG_USES_STATIC_BUF +static u8_t buf[LWIP_MEM_ALIGN_SIZE(IP_FRAG_MAX_MTU + MEM_ALIGNMENT - 1)]; +#else /* IP_FRAG_USES_STATIC_BUF */ + +#if !LWIP_NETIF_TX_SINGLE_PBUF +/** Allocate a new struct pbuf_custom_ref */ +static struct pbuf_custom_ref* +ip_frag_alloc_pbuf_custom_ref(void) +{ + return (struct pbuf_custom_ref*)memp_malloc(MEMP_FRAG_PBUF); +} + +/** Free a struct pbuf_custom_ref */ +static void +ip_frag_free_pbuf_custom_ref(struct pbuf_custom_ref* p) +{ + LWIP_ASSERT("p != NULL", p != NULL); + memp_free(MEMP_FRAG_PBUF, p); +} + +/** Free-callback function to free a 'struct pbuf_custom_ref', called by + * pbuf_free. */ +static void +ipfrag_free_pbuf_custom(struct pbuf *p) +{ + struct pbuf_custom_ref *pcr = (struct pbuf_custom_ref*)p; + LWIP_ASSERT("pcr != NULL", pcr != NULL); + LWIP_ASSERT("pcr == p", (void*)pcr == (void*)p); + if (pcr->original != NULL) { + pbuf_free(pcr->original); + } + ip_frag_free_pbuf_custom_ref(pcr); +} +#endif /* !LWIP_NETIF_TX_SINGLE_PBUF */ +#endif /* IP_FRAG_USES_STATIC_BUF */ + +/** + * Fragment an IP datagram if too large for the netif. + * + * Chop the datagram in MTU sized chunks and send them in order + * by using a fixed size static memory buffer (PBUF_REF) or + * point PBUF_REFs into p (depending on IP_FRAG_USES_STATIC_BUF). + * + * @param p ip packet to send + * @param netif the netif on which to send + * @param dest destination ip address to which to send + * + * @return ERR_OK if sent successfully, err_t otherwise + */ +err_t +ip_frag(struct pbuf *p, struct netif *netif, ip_addr_t *dest) +{ + struct pbuf *rambuf; +#if IP_FRAG_USES_STATIC_BUF + struct pbuf *header; +#else +#if !LWIP_NETIF_TX_SINGLE_PBUF + struct pbuf *newpbuf; +#endif + struct ip_hdr *original_iphdr; +#endif + struct ip_hdr *iphdr; + u16_t nfb; + u16_t left, cop; + u16_t mtu = netif->mtu; + u16_t ofo, omf; + u16_t last; + u16_t poff = IP_HLEN; + u16_t tmp; +#if !IP_FRAG_USES_STATIC_BUF && !LWIP_NETIF_TX_SINGLE_PBUF + u16_t newpbuflen = 0; + u16_t left_to_copy; +#endif + + /* Get a RAM based MTU sized pbuf */ +#if IP_FRAG_USES_STATIC_BUF + /* When using a static buffer, we use a PBUF_REF, which we will + * use to reference the packet (without link header). + * Layer and length is irrelevant. + */ + rambuf = pbuf_alloc(PBUF_LINK, 0, PBUF_REF); + if (rambuf == NULL) { + LWIP_DEBUGF(IP_REASS_DEBUG, ("ip_frag: pbuf_alloc(PBUF_LINK, 0, PBUF_REF) failed\n")); + return ERR_MEM; + } + rambuf->tot_len = rambuf->len = mtu; + rambuf->payload = LWIP_MEM_ALIGN((void *)buf); + + /* Copy the IP header in it */ + iphdr = (struct ip_hdr *)rambuf->payload; + SMEMCPY(iphdr, p->payload, IP_HLEN); +#else /* IP_FRAG_USES_STATIC_BUF */ + original_iphdr = (struct ip_hdr *)p->payload; + iphdr = original_iphdr; +#endif /* IP_FRAG_USES_STATIC_BUF */ + + /* Save original offset */ + tmp = ntohs(IPH_OFFSET(iphdr)); + ofo = tmp & IP_OFFMASK; + omf = tmp & IP_MF; + + left = p->tot_len - IP_HLEN; + + nfb = (mtu - IP_HLEN) / 8; + + while (left) { + last = (left <= mtu - IP_HLEN); + + /* Set new offset and MF flag */ + tmp = omf | (IP_OFFMASK & (ofo)); + if (!last) { + tmp = tmp | IP_MF; + } + + /* Fill this fragment */ + cop = last ? left : nfb * 8; + +#if IP_FRAG_USES_STATIC_BUF + poff += pbuf_copy_partial(p, (u8_t*)iphdr + IP_HLEN, cop, poff); +#else /* IP_FRAG_USES_STATIC_BUF */ +#if LWIP_NETIF_TX_SINGLE_PBUF + rambuf = pbuf_alloc(PBUF_IP, cop, PBUF_RAM); + if (rambuf == NULL) { + return ERR_MEM; + } + LWIP_ASSERT("this needs a pbuf in one piece!", + (rambuf->len == rambuf->tot_len) && (rambuf->next == NULL)); + poff += pbuf_copy_partial(p, rambuf->payload, cop, poff); + /* make room for the IP header */ + if(pbuf_header(rambuf, IP_HLEN)) { + pbuf_free(rambuf); + return ERR_MEM; + } + /* fill in the IP header */ + SMEMCPY(rambuf->payload, original_iphdr, IP_HLEN); + iphdr = rambuf->payload; +#else /* LWIP_NETIF_TX_SINGLE_PBUF */ + /* When not using a static buffer, create a chain of pbufs. + * The first will be a PBUF_RAM holding the link and IP header. + * The rest will be PBUF_REFs mirroring the pbuf chain to be fragged, + * but limited to the size of an mtu. + */ + rambuf = pbuf_alloc(PBUF_LINK, IP_HLEN, PBUF_RAM); + if (rambuf == NULL) { + return ERR_MEM; + } + LWIP_ASSERT("this needs a pbuf in one piece!", + (p->len >= (IP_HLEN))); + SMEMCPY(rambuf->payload, original_iphdr, IP_HLEN); + iphdr = (struct ip_hdr *)rambuf->payload; + + /* Can just adjust p directly for needed offset. */ + p->payload = (u8_t *)p->payload + poff; + p->len -= poff; + + left_to_copy = cop; + while (left_to_copy) { + struct pbuf_custom_ref *pcr; + newpbuflen = (left_to_copy < p->len) ? left_to_copy : p->len; + /* Is this pbuf already empty? */ + if (!newpbuflen) { + p = p->next; + continue; + } + pcr = ip_frag_alloc_pbuf_custom_ref(); + if (pcr == NULL) { + pbuf_free(rambuf); + return ERR_MEM; + } + /* Mirror this pbuf, although we might not need all of it. */ + newpbuf = pbuf_alloced_custom(PBUF_RAW, newpbuflen, PBUF_REF, &pcr->pc, p->payload, newpbuflen); + if (newpbuf == NULL) { + ip_frag_free_pbuf_custom_ref(pcr); + pbuf_free(rambuf); + return ERR_MEM; + } + pbuf_ref(p); + pcr->original = p; + pcr->pc.custom_free_function = ipfrag_free_pbuf_custom; + + /* Add it to end of rambuf's chain, but using pbuf_cat, not pbuf_chain + * so that it is removed when pbuf_dechain is later called on rambuf. + */ + pbuf_cat(rambuf, newpbuf); + left_to_copy -= newpbuflen; + if (left_to_copy) { + p = p->next; + } + } + poff = newpbuflen; +#endif /* LWIP_NETIF_TX_SINGLE_PBUF */ +#endif /* IP_FRAG_USES_STATIC_BUF */ + + /* Correct header */ + IPH_OFFSET_SET(iphdr, htons(tmp)); + IPH_LEN_SET(iphdr, htons(cop + IP_HLEN)); + IPH_CHKSUM_SET(iphdr, 0); + IPH_CHKSUM_SET(iphdr, inet_chksum(iphdr, IP_HLEN)); + +#if IP_FRAG_USES_STATIC_BUF + if (last) { + pbuf_realloc(rambuf, left + IP_HLEN); + } + + /* This part is ugly: we alloc a RAM based pbuf for + * the link level header for each chunk and then + * free it.A PBUF_ROM style pbuf for which pbuf_header + * worked would make things simpler. + */ + header = pbuf_alloc(PBUF_LINK, 0, PBUF_RAM); + if (header != NULL) { + pbuf_chain(header, rambuf); + netif->output(netif, header, dest); + IPFRAG_STATS_INC(ip_frag.xmit); + snmp_inc_ipfragcreates(); + pbuf_free(header); + } else { + LWIP_DEBUGF(IP_REASS_DEBUG, ("ip_frag: pbuf_alloc() for header failed\n")); + pbuf_free(rambuf); + return ERR_MEM; + } +#else /* IP_FRAG_USES_STATIC_BUF */ + /* No need for separate header pbuf - we allowed room for it in rambuf + * when allocated. + */ + netif->output(netif, rambuf, dest); + IPFRAG_STATS_INC(ip_frag.xmit); + + /* Unfortunately we can't reuse rambuf - the hardware may still be + * using the buffer. Instead we free it (and the ensuing chain) and + * recreate it next time round the loop. If we're lucky the hardware + * will have already sent the packet, the free will really free, and + * there will be zero memory penalty. + */ + + pbuf_free(rambuf); +#endif /* IP_FRAG_USES_STATIC_BUF */ + left -= cop; + ofo += nfb; + } +#if IP_FRAG_USES_STATIC_BUF + pbuf_free(rambuf); +#endif /* IP_FRAG_USES_STATIC_BUF */ + snmp_inc_ipfragoks(); + return ERR_OK; +} +#endif /* IP_FRAG */ diff --git a/lib/drivers/lwip/src/core/ipv6/README b/lib/drivers/lwip/src/core/ipv6/README new file mode 100644 index 00000000000..362000486e4 --- /dev/null +++ b/lib/drivers/lwip/src/core/ipv6/README @@ -0,0 +1 @@ +IPv6 support in lwIP is very experimental. diff --git a/lib/drivers/lwip/src/core/ipv6/icmp6.c b/lib/drivers/lwip/src/core/ipv6/icmp6.c new file mode 100644 index 00000000000..4fcc8955110 --- /dev/null +++ b/lib/drivers/lwip/src/core/ipv6/icmp6.c @@ -0,0 +1,179 @@ +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ + +/* Some ICMP messages should be passed to the transport protocols. This + is not implemented. */ + +#include "lwip/opt.h" + +#if LWIP_ICMP /* don't build if not configured for use in lwipopts.h */ + +#include "lwip/icmp.h" +#include "lwip/inet.h" +#include "lwip/ip.h" +#include "lwip/def.h" +#include "lwip/stats.h" + +void +icmp_input(struct pbuf *p, struct netif *inp) +{ + u8_t type; + struct icmp_echo_hdr *iecho; + struct ip_hdr *iphdr; + struct ip_addr tmpaddr; + + ICMP_STATS_INC(icmp.recv); + + /* TODO: check length before accessing payload! */ + + type = ((u8_t *)p->payload)[0]; + + switch (type) { + case ICMP6_ECHO: + LWIP_DEBUGF(ICMP_DEBUG, ("icmp_input: ping\n")); + + if (p->tot_len < sizeof(struct icmp_echo_hdr)) { + LWIP_DEBUGF(ICMP_DEBUG, ("icmp_input: bad ICMP echo received\n")); + + pbuf_free(p); + ICMP_STATS_INC(icmp.lenerr); + return; + } + iecho = p->payload; + iphdr = (struct ip_hdr *)((u8_t *)p->payload - IP_HLEN); + if (inet_chksum_pbuf(p) != 0) { + LWIP_DEBUGF(ICMP_DEBUG, ("icmp_input: checksum failed for received ICMP echo (%"X16_F")\n", inet_chksum_pseudo(p, &(iphdr->src), &(iphdr->dest), IP_PROTO_ICMP, p->tot_len))); + ICMP_STATS_INC(icmp.chkerr); + /* return;*/ + } + LWIP_DEBUGF(ICMP_DEBUG, ("icmp: p->len %"S16_F" p->tot_len %"S16_F"\n", p->len, p->tot_len)); + ip_addr_set(&tmpaddr, &(iphdr->src)); + ip_addr_set(&(iphdr->src), &(iphdr->dest)); + ip_addr_set(&(iphdr->dest), &tmpaddr); + iecho->type = ICMP6_ER; + /* adjust the checksum */ + if (iecho->chksum >= htons(0xffff - (ICMP6_ECHO << 8))) { + iecho->chksum += htons(ICMP6_ECHO << 8) + 1; + } else { + iecho->chksum += htons(ICMP6_ECHO << 8); + } + LWIP_DEBUGF(ICMP_DEBUG, ("icmp_input: checksum failed for received ICMP echo (%"X16_F")\n", inet_chksum_pseudo(p, &(iphdr->src), &(iphdr->dest), IP_PROTO_ICMP, p->tot_len))); + ICMP_STATS_INC(icmp.xmit); + + /* LWIP_DEBUGF("icmp: p->len %"U16_F" p->tot_len %"U16_F"\n", p->len, p->tot_len);*/ + ip_output_if (p, &(iphdr->src), IP_HDRINCL, + iphdr->hoplim, IP_PROTO_ICMP, inp); + break; + default: + LWIP_DEBUGF(ICMP_DEBUG, ("icmp_input: ICMP type %"S16_F" not supported.\n", (s16_t)type)); + ICMP_STATS_INC(icmp.proterr); + ICMP_STATS_INC(icmp.drop); + } + + pbuf_free(p); +} + +void +icmp_dest_unreach(struct pbuf *p, enum icmp_dur_type t) +{ + struct pbuf *q; + struct ip_hdr *iphdr; + struct icmp_dur_hdr *idur; + + /* @todo: can this be PBUF_LINK instead of PBUF_IP? */ + q = pbuf_alloc(PBUF_IP, 8 + IP_HLEN + 8, PBUF_RAM); + /* ICMP header + IP header + 8 bytes of data */ + if (q == NULL) { + LWIP_DEBUGF(ICMP_DEBUG, ("icmp_dest_unreach: failed to allocate pbuf for ICMP packet.\n")); + pbuf_free(p); + return; + } + LWIP_ASSERT("check that first pbuf can hold icmp message", + (q->len >= (8 + IP_HLEN + 8))); + + iphdr = p->payload; + + idur = q->payload; + idur->type = (u8_t)ICMP6_DUR; + idur->icode = (u8_t)t; + + SMEMCPY((u8_t *)q->payload + 8, p->payload, IP_HLEN + 8); + + /* calculate checksum */ + idur->chksum = 0; + idur->chksum = inet_chksum(idur, q->len); + ICMP_STATS_INC(icmp.xmit); + + ip_output(q, NULL, + (struct ip_addr *)&(iphdr->src), ICMP_TTL, IP_PROTO_ICMP); + pbuf_free(q); +} + +void +icmp_time_exceeded(struct pbuf *p, enum icmp_te_type t) +{ + struct pbuf *q; + struct ip_hdr *iphdr; + struct icmp_te_hdr *tehdr; + + LWIP_DEBUGF(ICMP_DEBUG, ("icmp_time_exceeded\n")); + + /* @todo: can this be PBUF_LINK instead of PBUF_IP? */ + q = pbuf_alloc(PBUF_IP, 8 + IP_HLEN + 8, PBUF_RAM); + /* ICMP header + IP header + 8 bytes of data */ + if (q == NULL) { + LWIP_DEBUGF(ICMP_DEBUG, ("icmp_dest_unreach: failed to allocate pbuf for ICMP packet.\n")); + pbuf_free(p); + return; + } + LWIP_ASSERT("check that first pbuf can hold icmp message", + (q->len >= (8 + IP_HLEN + 8))); + + iphdr = p->payload; + + tehdr = q->payload; + tehdr->type = (u8_t)ICMP6_TE; + tehdr->icode = (u8_t)t; + + /* copy fields from original packet */ + SMEMCPY((u8_t *)q->payload + 8, (u8_t *)p->payload, IP_HLEN + 8); + + /* calculate checksum */ + tehdr->chksum = 0; + tehdr->chksum = inet_chksum(tehdr, q->len); + ICMP_STATS_INC(icmp.xmit); + ip_output(q, NULL, + (struct ip_addr *)&(iphdr->src), ICMP_TTL, IP_PROTO_ICMP); + pbuf_free(q); +} + +#endif /* LWIP_ICMP */ diff --git a/lib/drivers/lwip/src/core/ipv6/inet6.c b/lib/drivers/lwip/src/core/ipv6/inet6.c new file mode 100644 index 00000000000..c3de85c0930 --- /dev/null +++ b/lib/drivers/lwip/src/core/ipv6/inet6.c @@ -0,0 +1,163 @@ +/** + * @file + * Functions common to all TCP/IPv6 modules, such as the Internet checksum and the + * byte order functions. + * + */ + +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ + +#include "lwip/opt.h" + +#include "lwip/def.h" +#include "lwip/inet.h" + +/* chksum: + * + * Sums up all 16 bit words in a memory portion. Also includes any odd byte. + * This function is used by the other checksum functions. + * + * For now, this is not optimized. Must be optimized for the particular processor + * arcitecture on which it is to run. Preferebly coded in assembler. + */ + +static u32_t +chksum(void *dataptr, u16_t len) +{ + u16_t *sdataptr = dataptr; + u32_t acc; + + + for(acc = 0; len > 1; len -= 2) { + acc += *sdataptr++; + } + + /* add up any odd byte */ + if (len == 1) { + acc += htons((u16_t)(*(u8_t *)dataptr) << 8); + } + + return acc; + +} + +/* inet_chksum_pseudo: + * + * Calculates the pseudo Internet checksum used by TCP and UDP for a pbuf chain. + */ + +u16_t +inet_chksum_pseudo(struct pbuf *p, + struct ip_addr *src, struct ip_addr *dest, + u8_t proto, u32_t proto_len) +{ + u32_t acc; + struct pbuf *q; + u8_t swapped, i; + + acc = 0; + swapped = 0; + for(q = p; q != NULL; q = q->next) { + acc += chksum(q->payload, q->len); + while (acc >> 16) { + acc = (acc & 0xffff) + (acc >> 16); + } + if (q->len % 2 != 0) { + swapped = 1 - swapped; + acc = ((acc & 0xff) << 8) | ((acc & 0xff00) >> 8); + } + } + + if (swapped) { + acc = ((acc & 0xff) << 8) | ((acc & 0xff00) >> 8); + } + + for(i = 0; i < 8; i++) { + acc += ((u16_t *)src->addr)[i] & 0xffff; + acc += ((u16_t *)dest->addr)[i] & 0xffff; + while (acc >> 16) { + acc = (acc & 0xffff) + (acc >> 16); + } + } + acc += (u16_t)htons((u16_t)proto); + acc += ((u16_t *)&proto_len)[0] & 0xffff; + acc += ((u16_t *)&proto_len)[1] & 0xffff; + + while (acc >> 16) { + acc = (acc & 0xffff) + (acc >> 16); + } + return ~(acc & 0xffff); +} + +/* inet_chksum: + * + * Calculates the Internet checksum over a portion of memory. Used primarely for IP + * and ICMP. + */ + +u16_t +inet_chksum(void *dataptr, u16_t len) +{ + u32_t acc, sum; + + acc = chksum(dataptr, len); + sum = (acc & 0xffff) + (acc >> 16); + sum += (sum >> 16); + return ~(sum & 0xffff); +} + +u16_t +inet_chksum_pbuf(struct pbuf *p) +{ + u32_t acc; + struct pbuf *q; + u8_t swapped; + + acc = 0; + swapped = 0; + for(q = p; q != NULL; q = q->next) { + acc += chksum(q->payload, q->len); + while (acc >> 16) { + acc = (acc & 0xffff) + (acc >> 16); + } + if (q->len % 2 != 0) { + swapped = 1 - swapped; + acc = (acc & 0xff << 8) | (acc & 0xff00 >> 8); + } + } + + if (swapped) { + acc = ((acc & 0xff) << 8) | ((acc & 0xff00) >> 8); + } + return ~(acc & 0xffff); +} diff --git a/lib/drivers/lwip/src/core/ipv6/ip6.c b/lib/drivers/lwip/src/core/ipv6/ip6.c new file mode 100644 index 00000000000..b945fc5d35d --- /dev/null +++ b/lib/drivers/lwip/src/core/ipv6/ip6.c @@ -0,0 +1,397 @@ +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ + + + +/* ip.c + * + * This is the code for the IP layer for IPv6. + * + */ + + +#include "lwip/opt.h" + +#include "lwip/def.h" +#include "lwip/mem.h" +#include "lwip/ip.h" +#include "lwip/inet.h" +#include "lwip/netif.h" +#include "lwip/icmp.h" +#include "lwip/udp.h" +#include "lwip/tcp_impl.h" + +#include "lwip/stats.h" + +#include "arch/perf.h" + +/* ip_init: + * + * Initializes the IP layer. + */ + +void +ip_init(void) +{ +} + +/* ip_route: + * + * Finds the appropriate network interface for a given IP address. It searches the + * list of network interfaces linearly. A match is found if the masked IP address of + * the network interface equals the masked IP address given to the function. + */ + +struct netif * +ip_route(struct ip_addr *dest) +{ + struct netif *netif; + + for(netif = netif_list; netif != NULL; netif = netif->next) { + if (ip_addr_netcmp(dest, &(netif->ip_addr), &(netif->netmask))) { + return netif; + } + } + + return netif_default; +} + +/* ip_forward: + * + * Forwards an IP packet. It finds an appropriate route for the packet, decrements + * the TTL value of the packet, adjusts the checksum and outputs the packet on the + * appropriate interface. + */ + +static void +ip_forward(struct pbuf *p, struct ip_hdr *iphdr) +{ + struct netif *netif; + + PERF_START; + + if ((netif = ip_route((struct ip_addr *)&(iphdr->dest))) == NULL) { + + LWIP_DEBUGF(IP_DEBUG, ("ip_input: no forwarding route found for ")); +#if IP_DEBUG + ip_addr_debug_print(IP_DEBUG, ((struct ip_addr *)&(iphdr->dest))); +#endif /* IP_DEBUG */ + LWIP_DEBUGF(IP_DEBUG, ("\n")); + pbuf_free(p); + return; + } + /* Decrement TTL and send ICMP if ttl == 0. */ + if (--iphdr->hoplim == 0) { +#if LWIP_ICMP + /* Don't send ICMP messages in response to ICMP messages */ + if (iphdr->nexthdr != IP_PROTO_ICMP) { + icmp_time_exceeded(p, ICMP_TE_TTL); + } +#endif /* LWIP_ICMP */ + pbuf_free(p); + return; + } + + /* Incremental update of the IP checksum. */ + /* if (iphdr->chksum >= htons(0xffff - 0x100)) { + iphdr->chksum += htons(0x100) + 1; + } else { + iphdr->chksum += htons(0x100); + }*/ + + + LWIP_DEBUGF(IP_DEBUG, ("ip_forward: forwarding packet to ")); +#if IP_DEBUG + ip_addr_debug_print(IP_DEBUG, ((struct ip_addr *)&(iphdr->dest))); +#endif /* IP_DEBUG */ + LWIP_DEBUGF(IP_DEBUG, ("\n")); + + IP_STATS_INC(ip.fw); + IP_STATS_INC(ip.xmit); + + PERF_STOP("ip_forward"); + + netif->output(netif, p, (struct ip_addr *)&(iphdr->dest)); +} + +/* ip_input: + * + * This function is called by the network interface device driver when an IP packet is + * received. The function does the basic checks of the IP header such as packet size + * being at least larger than the header size etc. If the packet was not destined for + * us, the packet is forwarded (using ip_forward). The IP checksum is always checked. + * + * Finally, the packet is sent to the upper layer protocol input function. + */ + +void +ip_input(struct pbuf *p, struct netif *inp) { + struct ip_hdr *iphdr; + struct netif *netif; + + + PERF_START; + +#if IP_DEBUG + ip_debug_print(p); +#endif /* IP_DEBUG */ + + + IP_STATS_INC(ip.recv); + + /* identify the IP header */ + iphdr = p->payload; + + + if (iphdr->v != 6) { + LWIP_DEBUGF(IP_DEBUG, ("IP packet dropped due to bad version number\n")); +#if IP_DEBUG + ip_debug_print(p); +#endif /* IP_DEBUG */ + pbuf_free(p); + IP_STATS_INC(ip.err); + IP_STATS_INC(ip.drop); + return; + } + + /* is this packet for us? */ + for(netif = netif_list; netif != NULL; netif = netif->next) { +#if IP_DEBUG + LWIP_DEBUGF(IP_DEBUG, ("ip_input: iphdr->dest ")); + ip_addr_debug_print(IP_DEBUG, ((struct ip_addr *)&(iphdr->dest))); + LWIP_DEBUGF(IP_DEBUG, ("netif->ip_addr ")); + ip_addr_debug_print(IP_DEBUG, ((struct ip_addr *)&(iphdr->dest))); + LWIP_DEBUGF(IP_DEBUG, ("\n")); +#endif /* IP_DEBUG */ + if (ip_addr_cmp(&(iphdr->dest), &(netif->ip_addr))) { + break; + } + } + + + if (netif == NULL) { + /* packet not for us, route or discard */ +#if IP_FORWARD + ip_forward(p, iphdr); +#endif + pbuf_free(p); + return; + } + + pbuf_realloc(p, IP_HLEN + ntohs(iphdr->len)); + + /* send to upper layers */ +#if IP_DEBUG + /* LWIP_DEBUGF("ip_input: \n"); + ip_debug_print(p); + LWIP_DEBUGF("ip_input: p->len %"U16_F" p->tot_len %"U16_F"\n", p->len, p->tot_len);*/ +#endif /* IP_DEBUG */ + + if(pbuf_header(p, -IP_HLEN)) { + LWIP_ASSERT("Can't move over header in packet", 0); + return; + } + + switch (iphdr->nexthdr) { + case IP_PROTO_UDP: + udp_input(p, inp); + break; + case IP_PROTO_TCP: + tcp_input(p, inp); + break; +#if LWIP_ICMP + case IP_PROTO_ICMP: + icmp_input(p, inp); + break; +#endif /* LWIP_ICMP */ + default: +#if LWIP_ICMP + /* send ICMP destination protocol unreachable */ + icmp_dest_unreach(p, ICMP_DUR_PROTO); +#endif /* LWIP_ICMP */ + pbuf_free(p); + LWIP_DEBUGF(IP_DEBUG, ("Unsupported transport protocol %"U16_F"\n", + iphdr->nexthdr)); + + IP_STATS_INC(ip.proterr); + IP_STATS_INC(ip.drop); + } + PERF_STOP("ip_input"); +} + + +/* ip_output_if: + * + * Sends an IP packet on a network interface. This function constructs the IP header + * and calculates the IP header checksum. If the source IP address is NULL, + * the IP address of the outgoing network interface is filled in as source address. + */ + +err_t +ip_output_if (struct pbuf *p, struct ip_addr *src, struct ip_addr *dest, + u8_t ttl, + u8_t proto, struct netif *netif) +{ + struct ip_hdr *iphdr; + + PERF_START; + + LWIP_DEBUGF(IP_DEBUG, ("len %"U16_F" tot_len %"U16_F"\n", p->len, p->tot_len)); + if (pbuf_header(p, IP_HLEN)) { + LWIP_DEBUGF(IP_DEBUG, ("ip_output: not enough room for IP header in pbuf\n")); + IP_STATS_INC(ip.err); + + return ERR_BUF; + } + LWIP_DEBUGF(IP_DEBUG, ("len %"U16_F" tot_len %"U16_F"\n", p->len, p->tot_len)); + + iphdr = p->payload; + + + if (dest != IP_HDRINCL) { + LWIP_DEBUGF(IP_DEBUG, ("!IP_HDRLINCL\n")); + iphdr->hoplim = ttl; + iphdr->nexthdr = proto; + iphdr->len = htons(p->tot_len - IP_HLEN); + ip_addr_set(&(iphdr->dest), dest); + + iphdr->v = 6; + + if (ip_addr_isany(src)) { + ip_addr_set(&(iphdr->src), &(netif->ip_addr)); + } else { + ip_addr_set(&(iphdr->src), src); + } + + } else { + dest = &(iphdr->dest); + } + + IP_STATS_INC(ip.xmit); + + LWIP_DEBUGF(IP_DEBUG, ("ip_output_if: %c%c (len %"U16_F")\n", netif->name[0], netif->name[1], p->tot_len)); +#if IP_DEBUG + ip_debug_print(p); +#endif /* IP_DEBUG */ + + PERF_STOP("ip_output_if"); + return netif->output(netif, p, dest); +} + +/* ip_output: + * + * Simple interface to ip_output_if. It finds the outgoing network interface and + * calls upon ip_output_if to do the actual work. + */ + +err_t +ip_output(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest, + u8_t ttl, u8_t proto) +{ + struct netif *netif; + if ((netif = ip_route(dest)) == NULL) { + LWIP_DEBUGF(IP_DEBUG, ("ip_output: No route to 0x%"X32_F"\n", dest->addr)); + IP_STATS_INC(ip.rterr); + return ERR_RTE; + } + + return ip_output_if (p, src, dest, ttl, proto, netif); +} + +#if LWIP_NETIF_HWADDRHINT +err_t +ip_output_hinted(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest, + u8_t ttl, u8_t tos, u8_t proto, u8_t *addr_hint) +{ + struct netif *netif; + err_t err; + + if ((netif = ip_route(dest)) == NULL) { + LWIP_DEBUGF(IP_DEBUG, ("ip_output: No route to 0x%"X32_F"\n", dest->addr)); + IP_STATS_INC(ip.rterr); + return ERR_RTE; + } + + netif->addr_hint = addr_hint; + err = ip_output_if(p, src, dest, ttl, tos, proto, netif); + netif->addr_hint = NULL; + + return err; +} +#endif /* LWIP_NETIF_HWADDRHINT*/ + +#if IP_DEBUG +void +ip_debug_print(struct pbuf *p) +{ + struct ip_hdr *iphdr = p->payload; + + LWIP_DEBUGF(IP_DEBUG, ("IP header:\n")); + LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n")); + LWIP_DEBUGF(IP_DEBUG, ("|%2"S16_F" | %"X16_F"%"X16_F" | %"X16_F"%"X16_F" | (v, traffic class, flow label)\n", + iphdr->v, + iphdr->tclass1, iphdr->tclass2, + iphdr->flow1, iphdr->flow2)); + LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n")); + LWIP_DEBUGF(IP_DEBUG, ("| %5"U16_F" | %2"U16_F" | %2"U16_F" | (len, nexthdr, hoplim)\n", + ntohs(iphdr->len), + iphdr->nexthdr, + iphdr->hoplim)); + LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n")); + LWIP_DEBUGF(IP_DEBUG, ("| %4"X32_F" | %4"X32_F" | (src)\n", + (ntohl(iphdr->src.addr[0]) >> 16) & 0xffff, + ntohl(iphdr->src.addr[0]) & 0xffff)); + LWIP_DEBUGF(IP_DEBUG, ("| %4"X32_F" | %4"X32_F" | (src)\n", + (ntohl(iphdr->src.addr[1]) >> 16) & 0xffff, + ntohl(iphdr->src.addr[1]) & 0xffff)); + LWIP_DEBUGF(IP_DEBUG, ("| %4"X32_F" | %4"X32_F" | (src)\n", + (ntohl(iphdr->src.addr[2]) >> 16) & 0xffff, + ntohl(iphdr->src.addr[2]) & 0xffff)); + LWIP_DEBUGF(IP_DEBUG, ("| %4"X32_F" | %4"X32_F" | (src)\n", + (ntohl(iphdr->src.addr[3]) >> 16) & 0xffff, + ntohl(iphdr->src.addr[3]) & 0xffff)); + LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n")); + LWIP_DEBUGF(IP_DEBUG, ("| %4"X32_F" | %4"X32_F" | (dest)\n", + (ntohl(iphdr->dest.addr[0]) >> 16) & 0xffff, + ntohl(iphdr->dest.addr[0]) & 0xffff)); + LWIP_DEBUGF(IP_DEBUG, ("| %4"X32_F" | %4"X32_F" | (dest)\n", + (ntohl(iphdr->dest.addr[1]) >> 16) & 0xffff, + ntohl(iphdr->dest.addr[1]) & 0xffff)); + LWIP_DEBUGF(IP_DEBUG, ("| %4"X32_F" | %4"X32_F" | (dest)\n", + (ntohl(iphdr->dest.addr[2]) >> 16) & 0xffff, + ntohl(iphdr->dest.addr[2]) & 0xffff)); + LWIP_DEBUGF(IP_DEBUG, ("| %4"X32_F" | %4"X32_F" | (dest)\n", + (ntohl(iphdr->dest.addr[3]) >> 16) & 0xffff, + ntohl(iphdr->dest.addr[3]) & 0xffff)); + LWIP_DEBUGF(IP_DEBUG, ("+-------------------------------+\n")); +} +#endif /* IP_DEBUG */ diff --git a/lib/drivers/lwip/src/core/ipv6/ip6_addr.c b/lib/drivers/lwip/src/core/ipv6/ip6_addr.c new file mode 100644 index 00000000000..2da6cea4276 --- /dev/null +++ b/lib/drivers/lwip/src/core/ipv6/ip6_addr.c @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ + +#include "lwip/opt.h" +#include "lwip/ip_addr.h" +#include "lwip/inet.h" + +u8_t +ip_addr_netcmp(struct ip_addr *addr1, struct ip_addr *addr2, + struct ip_addr *mask) +{ + return((addr1->addr[0] & mask->addr[0]) == (addr2->addr[0] & mask->addr[0]) && + (addr1->addr[1] & mask->addr[1]) == (addr2->addr[1] & mask->addr[1]) && + (addr1->addr[2] & mask->addr[2]) == (addr2->addr[2] & mask->addr[2]) && + (addr1->addr[3] & mask->addr[3]) == (addr2->addr[3] & mask->addr[3])); + +} + +u8_t +ip_addr_cmp(struct ip_addr *addr1, struct ip_addr *addr2) +{ + return(addr1->addr[0] == addr2->addr[0] && + addr1->addr[1] == addr2->addr[1] && + addr1->addr[2] == addr2->addr[2] && + addr1->addr[3] == addr2->addr[3]); +} + +void +ip_addr_set(struct ip_addr *dest, struct ip_addr *src) +{ + SMEMCPY(dest, src, sizeof(struct ip_addr)); + /* dest->addr[0] = src->addr[0]; + dest->addr[1] = src->addr[1]; + dest->addr[2] = src->addr[2]; + dest->addr[3] = src->addr[3];*/ +} + +u8_t +ip_addr_isany(struct ip_addr *addr) +{ + if (addr == NULL) return 1; + return((addr->addr[0] | addr->addr[1] | addr->addr[2] | addr->addr[3]) == 0); +} diff --git a/lib/drivers/lwip/src/core/mem.c b/lib/drivers/lwip/src/core/mem.c new file mode 100644 index 00000000000..98375553b9e --- /dev/null +++ b/lib/drivers/lwip/src/core/mem.c @@ -0,0 +1,642 @@ +/** + * @file + * Dynamic memory manager + * + * This is a lightweight replacement for the standard C library malloc(). + * + * If you want to use the standard C library malloc() instead, define + * MEM_LIBC_MALLOC to 1 in your lwipopts.h + * + * To let mem_malloc() use pools (prevents fragmentation and is much faster than + * a heap but might waste some memory), define MEM_USE_POOLS to 1, define + * MEM_USE_CUSTOM_POOLS to 1 and create a file "lwippools.h" that includes a list + * of pools like this (more pools can be added between _START and _END): + * + * Define three pools with sizes 256, 512, and 1512 bytes + * LWIP_MALLOC_MEMPOOL_START + * LWIP_MALLOC_MEMPOOL(20, 256) + * LWIP_MALLOC_MEMPOOL(10, 512) + * LWIP_MALLOC_MEMPOOL(5, 1512) + * LWIP_MALLOC_MEMPOOL_END + */ + +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * Simon Goldschmidt + * + */ + +#include "lwip/opt.h" + +#if !MEM_LIBC_MALLOC /* don't build if not configured for use in lwipopts.h */ + +#include "lwip/def.h" +#include "lwip/mem.h" +#include "lwip/sys.h" +#include "lwip/stats.h" +#include "lwip/err.h" + +#include + +#if MEM_USE_POOLS +/* lwIP head implemented with different sized pools */ + +/** + * Allocate memory: determine the smallest pool that is big enough + * to contain an element of 'size' and get an element from that pool. + * + * @param size the size in bytes of the memory needed + * @return a pointer to the allocated memory or NULL if the pool is empty + */ +void * +mem_malloc(mem_size_t size) +{ + struct memp_malloc_helper *element; + memp_t poolnr; + mem_size_t required_size = size + sizeof(struct memp_malloc_helper); + + for (poolnr = MEMP_POOL_FIRST; poolnr <= MEMP_POOL_LAST; poolnr = (memp_t)(poolnr + 1)) { +#if MEM_USE_POOLS_TRY_BIGGER_POOL +again: +#endif /* MEM_USE_POOLS_TRY_BIGGER_POOL */ + /* is this pool big enough to hold an element of the required size + plus a struct memp_malloc_helper that saves the pool this element came from? */ + if (required_size <= memp_sizes[poolnr]) { + break; + } + } + if (poolnr > MEMP_POOL_LAST) { + LWIP_ASSERT("mem_malloc(): no pool is that big!", 0); + return NULL; + } + element = (struct memp_malloc_helper*)memp_malloc(poolnr); + if (element == NULL) { + /* No need to DEBUGF or ASSERT: This error is already + taken care of in memp.c */ +#if MEM_USE_POOLS_TRY_BIGGER_POOL + /** Try a bigger pool if this one is empty! */ + if (poolnr < MEMP_POOL_LAST) { + poolnr++; + goto again; + } +#endif /* MEM_USE_POOLS_TRY_BIGGER_POOL */ + return NULL; + } + + /* save the pool number this element came from */ + element->poolnr = poolnr; + /* and return a pointer to the memory directly after the struct memp_malloc_helper */ + element++; + + return element; +} + +/** + * Free memory previously allocated by mem_malloc. Loads the pool number + * and calls memp_free with that pool number to put the element back into + * its pool + * + * @param rmem the memory element to free + */ +void +mem_free(void *rmem) +{ + struct memp_malloc_helper *hmem = (struct memp_malloc_helper*)rmem; + + LWIP_ASSERT("rmem != NULL", (rmem != NULL)); + LWIP_ASSERT("rmem == MEM_ALIGN(rmem)", (rmem == LWIP_MEM_ALIGN(rmem))); + + /* get the original struct memp_malloc_helper */ + hmem--; + + LWIP_ASSERT("hmem != NULL", (hmem != NULL)); + LWIP_ASSERT("hmem == MEM_ALIGN(hmem)", (hmem == LWIP_MEM_ALIGN(hmem))); + LWIP_ASSERT("hmem->poolnr < MEMP_MAX", (hmem->poolnr < MEMP_MAX)); + + /* and put it in the pool we saved earlier */ + memp_free(hmem->poolnr, hmem); +} + +#else /* MEM_USE_POOLS */ +/* lwIP replacement for your libc malloc() */ + +/** + * The heap is made up as a list of structs of this type. + * This does not have to be aligned since for getting its size, + * we only use the macro SIZEOF_STRUCT_MEM, which automatically alignes. + */ +struct mem { + /** index (-> ram[next]) of the next struct */ + mem_size_t next; + /** index (-> ram[prev]) of the previous struct */ + mem_size_t prev; + /** 1: this area is used; 0: this area is unused */ + u8_t used; +}; + +/** All allocated blocks will be MIN_SIZE bytes big, at least! + * MIN_SIZE can be overridden to suit your needs. Smaller values save space, + * larger values could prevent too small blocks to fragment the RAM too much. */ +#ifndef MIN_SIZE +#define MIN_SIZE 12 +#endif /* MIN_SIZE */ +/* some alignment macros: we define them here for better source code layout */ +#define MIN_SIZE_ALIGNED LWIP_MEM_ALIGN_SIZE(MIN_SIZE) +#define SIZEOF_STRUCT_MEM LWIP_MEM_ALIGN_SIZE(sizeof(struct mem)) +#define MEM_SIZE_ALIGNED LWIP_MEM_ALIGN_SIZE(MEM_SIZE) + +/** If you want to relocate the heap to external memory, simply define + * LWIP_RAM_HEAP_POINTER as a void-pointer to that location. + * If so, make sure the memory at that location is big enough (see below on + * how that space is calculated). */ +#ifndef LWIP_RAM_HEAP_POINTER +/** the heap. we need one struct mem at the end and some room for alignment */ +u8_t ram_heap[MEM_SIZE_ALIGNED + (2*SIZEOF_STRUCT_MEM) + MEM_ALIGNMENT]; +#define LWIP_RAM_HEAP_POINTER ram_heap +#endif /* LWIP_RAM_HEAP_POINTER */ + +/** pointer to the heap (ram_heap): for alignment, ram is now a pointer instead of an array */ +static u8_t *ram; +/** the last entry, always unused! */ +static struct mem *ram_end; +/** pointer to the lowest free block, this is used for faster search */ +static struct mem *lfree; + +/** concurrent access protection */ +static sys_mutex_t mem_mutex; + +#if LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT + +static volatile u8_t mem_free_count; + +/* Allow mem_free from other (e.g. interrupt) context */ +#define LWIP_MEM_FREE_DECL_PROTECT() SYS_ARCH_DECL_PROTECT(lev_free) +#define LWIP_MEM_FREE_PROTECT() SYS_ARCH_PROTECT(lev_free) +#define LWIP_MEM_FREE_UNPROTECT() SYS_ARCH_UNPROTECT(lev_free) +#define LWIP_MEM_ALLOC_DECL_PROTECT() SYS_ARCH_DECL_PROTECT(lev_alloc) +#define LWIP_MEM_ALLOC_PROTECT() SYS_ARCH_PROTECT(lev_alloc) +#define LWIP_MEM_ALLOC_UNPROTECT() SYS_ARCH_UNPROTECT(lev_alloc) + +#else /* LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT */ + +/* Protect the heap only by using a semaphore */ +#define LWIP_MEM_FREE_DECL_PROTECT() +#define LWIP_MEM_FREE_PROTECT() sys_mutex_lock(&mem_mutex) +#define LWIP_MEM_FREE_UNPROTECT() sys_mutex_unlock(&mem_mutex) +/* mem_malloc is protected using semaphore AND LWIP_MEM_ALLOC_PROTECT */ +#define LWIP_MEM_ALLOC_DECL_PROTECT() +#define LWIP_MEM_ALLOC_PROTECT() +#define LWIP_MEM_ALLOC_UNPROTECT() + +#endif /* LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT */ + + +/** + * "Plug holes" by combining adjacent empty struct mems. + * After this function is through, there should not exist + * one empty struct mem pointing to another empty struct mem. + * + * @param mem this points to a struct mem which just has been freed + * @internal this function is only called by mem_free() and mem_trim() + * + * This assumes access to the heap is protected by the calling function + * already. + */ +static void +plug_holes(struct mem *mem) +{ + struct mem *nmem; + struct mem *pmem; + + LWIP_ASSERT("plug_holes: mem >= ram", (u8_t *)mem >= ram); + LWIP_ASSERT("plug_holes: mem < ram_end", (u8_t *)mem < (u8_t *)ram_end); + LWIP_ASSERT("plug_holes: mem->used == 0", mem->used == 0); + + /* plug hole forward */ + LWIP_ASSERT("plug_holes: mem->next <= MEM_SIZE_ALIGNED", mem->next <= MEM_SIZE_ALIGNED); + + nmem = (struct mem *)(void *)&ram[mem->next]; + if (mem != nmem && nmem->used == 0 && (u8_t *)nmem != (u8_t *)ram_end) { + /* if mem->next is unused and not end of ram, combine mem and mem->next */ + if (lfree == nmem) { + lfree = mem; + } + mem->next = nmem->next; + ((struct mem *)(void *)&ram[nmem->next])->prev = (mem_size_t)((u8_t *)mem - ram); + } + + /* plug hole backward */ + pmem = (struct mem *)(void *)&ram[mem->prev]; + if (pmem != mem && pmem->used == 0) { + /* if mem->prev is unused, combine mem and mem->prev */ + if (lfree == mem) { + lfree = pmem; + } + pmem->next = mem->next; + ((struct mem *)(void *)&ram[mem->next])->prev = (mem_size_t)((u8_t *)pmem - ram); + } +} + +/** + * Zero the heap and initialize start, end and lowest-free + */ +void +mem_init(void) +{ + struct mem *mem; + + LWIP_ASSERT("Sanity check alignment", + (SIZEOF_STRUCT_MEM & (MEM_ALIGNMENT-1)) == 0); + + /* align the heap */ + ram = (u8_t *)LWIP_MEM_ALIGN(LWIP_RAM_HEAP_POINTER); + /* initialize the start of the heap */ + mem = (struct mem *)(void *)ram; + mem->next = MEM_SIZE_ALIGNED; + mem->prev = 0; + mem->used = 0; + /* initialize the end of the heap */ + ram_end = (struct mem *)(void *)&ram[MEM_SIZE_ALIGNED]; + ram_end->used = 1; + ram_end->next = MEM_SIZE_ALIGNED; + ram_end->prev = MEM_SIZE_ALIGNED; + + /* initialize the lowest-free pointer to the start of the heap */ + lfree = (struct mem *)(void *)ram; + + MEM_STATS_AVAIL(avail, MEM_SIZE_ALIGNED); + + if(sys_mutex_new(&mem_mutex) != ERR_OK) { + LWIP_ASSERT("failed to create mem_mutex", 0); + } +} + +/** + * Put a struct mem back on the heap + * + * @param rmem is the data portion of a struct mem as returned by a previous + * call to mem_malloc() + */ +void +mem_free(void *rmem) +{ + struct mem *mem; + LWIP_MEM_FREE_DECL_PROTECT(); + + if (rmem == NULL) { + LWIP_DEBUGF(MEM_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_LEVEL_SERIOUS, ("mem_free(p == NULL) was called.\n")); + return; + } + LWIP_ASSERT("mem_free: sanity check alignment", (((mem_ptr_t)rmem) & (MEM_ALIGNMENT-1)) == 0); + + LWIP_ASSERT("mem_free: legal memory", (u8_t *)rmem >= (u8_t *)ram && + (u8_t *)rmem < (u8_t *)ram_end); + + if ((u8_t *)rmem < (u8_t *)ram || (u8_t *)rmem >= (u8_t *)ram_end) { + SYS_ARCH_DECL_PROTECT(lev); + LWIP_DEBUGF(MEM_DEBUG | LWIP_DBG_LEVEL_SEVERE, ("mem_free: illegal memory\n")); + /* protect mem stats from concurrent access */ + SYS_ARCH_PROTECT(lev); + MEM_STATS_INC(illegal); + SYS_ARCH_UNPROTECT(lev); + return; + } + /* protect the heap from concurrent access */ + LWIP_MEM_FREE_PROTECT(); + /* Get the corresponding struct mem ... */ + mem = (struct mem *)(void *)((u8_t *)rmem - SIZEOF_STRUCT_MEM); + /* ... which has to be in a used state ... */ + LWIP_ASSERT("mem_free: mem->used", mem->used); + /* ... and is now unused. */ + mem->used = 0; + + if (mem < lfree) { + /* the newly freed struct is now the lowest */ + lfree = mem; + } + + MEM_STATS_DEC_USED(used, mem->next - (mem_size_t)(((u8_t *)mem - ram))); + + /* finally, see if prev or next are free also */ + plug_holes(mem); +#if LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT + mem_free_count = 1; +#endif /* LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT */ + LWIP_MEM_FREE_UNPROTECT(); +} + +/** + * Shrink memory returned by mem_malloc(). + * + * @param rmem pointer to memory allocated by mem_malloc the is to be shrinked + * @param newsize required size after shrinking (needs to be smaller than or + * equal to the previous size) + * @return for compatibility reasons: is always == rmem, at the moment + * or NULL if newsize is > old size, in which case rmem is NOT touched + * or freed! + */ +void * +mem_trim(void *rmem, mem_size_t newsize) +{ + mem_size_t size; + mem_size_t ptr, ptr2; + struct mem *mem, *mem2; + /* use the FREE_PROTECT here: it protects with sem OR SYS_ARCH_PROTECT */ + LWIP_MEM_FREE_DECL_PROTECT(); + + /* Expand the size of the allocated memory region so that we can + adjust for alignment. */ + newsize = LWIP_MEM_ALIGN_SIZE(newsize); + + if(newsize < MIN_SIZE_ALIGNED) { + /* every data block must be at least MIN_SIZE_ALIGNED long */ + newsize = MIN_SIZE_ALIGNED; + } + + if (newsize > MEM_SIZE_ALIGNED) { + return NULL; + } + + LWIP_ASSERT("mem_trim: legal memory", (u8_t *)rmem >= (u8_t *)ram && + (u8_t *)rmem < (u8_t *)ram_end); + + if ((u8_t *)rmem < (u8_t *)ram || (u8_t *)rmem >= (u8_t *)ram_end) { + SYS_ARCH_DECL_PROTECT(lev); + LWIP_DEBUGF(MEM_DEBUG | LWIP_DBG_LEVEL_SEVERE, ("mem_trim: illegal memory\n")); + /* protect mem stats from concurrent access */ + SYS_ARCH_PROTECT(lev); + MEM_STATS_INC(illegal); + SYS_ARCH_UNPROTECT(lev); + return rmem; + } + /* Get the corresponding struct mem ... */ + mem = (struct mem *)(void *)((u8_t *)rmem - SIZEOF_STRUCT_MEM); + /* ... and its offset pointer */ + ptr = (mem_size_t)((u8_t *)mem - ram); + + size = mem->next - ptr - SIZEOF_STRUCT_MEM; + LWIP_ASSERT("mem_trim can only shrink memory", newsize <= size); + if (newsize > size) { + /* not supported */ + return NULL; + } + if (newsize == size) { + /* No change in size, simply return */ + return rmem; + } + + /* protect the heap from concurrent access */ + LWIP_MEM_FREE_PROTECT(); + + mem2 = (struct mem *)(void *)&ram[mem->next]; + if(mem2->used == 0) { + /* The next struct is unused, we can simply move it at little */ + mem_size_t next; + /* remember the old next pointer */ + next = mem2->next; + /* create new struct mem which is moved directly after the shrinked mem */ + ptr2 = ptr + SIZEOF_STRUCT_MEM + newsize; + if (lfree == mem2) { + lfree = (struct mem *)(void *)&ram[ptr2]; + } + mem2 = (struct mem *)(void *)&ram[ptr2]; + mem2->used = 0; + /* restore the next pointer */ + mem2->next = next; + /* link it back to mem */ + mem2->prev = ptr; + /* link mem to it */ + mem->next = ptr2; + /* last thing to restore linked list: as we have moved mem2, + * let 'mem2->next->prev' point to mem2 again. but only if mem2->next is not + * the end of the heap */ + if (mem2->next != MEM_SIZE_ALIGNED) { + ((struct mem *)(void *)&ram[mem2->next])->prev = ptr2; + } + MEM_STATS_DEC_USED(used, (size - newsize)); + /* no need to plug holes, we've already done that */ + } else if (newsize + SIZEOF_STRUCT_MEM + MIN_SIZE_ALIGNED <= size) { + /* Next struct is used but there's room for another struct mem with + * at least MIN_SIZE_ALIGNED of data. + * Old size ('size') must be big enough to contain at least 'newsize' plus a struct mem + * ('SIZEOF_STRUCT_MEM') with some data ('MIN_SIZE_ALIGNED'). + * @todo we could leave out MIN_SIZE_ALIGNED. We would create an empty + * region that couldn't hold data, but when mem->next gets freed, + * the 2 regions would be combined, resulting in more free memory */ + ptr2 = ptr + SIZEOF_STRUCT_MEM + newsize; + mem2 = (struct mem *)(void *)&ram[ptr2]; + if (mem2 < lfree) { + lfree = mem2; + } + mem2->used = 0; + mem2->next = mem->next; + mem2->prev = ptr; + mem->next = ptr2; + if (mem2->next != MEM_SIZE_ALIGNED) { + ((struct mem *)(void *)&ram[mem2->next])->prev = ptr2; + } + MEM_STATS_DEC_USED(used, (size - newsize)); + /* the original mem->next is used, so no need to plug holes! */ + } + /* else { + next struct mem is used but size between mem and mem2 is not big enough + to create another struct mem + -> don't do anyhting. + -> the remaining space stays unused since it is too small + } */ +#if LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT + mem_free_count = 1; +#endif /* LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT */ + LWIP_MEM_FREE_UNPROTECT(); + return rmem; +} + +/** + * Adam's mem_malloc() plus solution for bug #17922 + * Allocate a block of memory with a minimum of 'size' bytes. + * + * @param size is the minimum size of the requested block in bytes. + * @return pointer to allocated memory or NULL if no free memory was found. + * + * Note that the returned value will always be aligned (as defined by MEM_ALIGNMENT). + */ +void * +mem_malloc(mem_size_t size) +{ + mem_size_t ptr, ptr2; + struct mem *mem, *mem2; +#if LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT + u8_t local_mem_free_count = 0; +#endif /* LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT */ + LWIP_MEM_ALLOC_DECL_PROTECT(); + + if (size == 0) { + return NULL; + } + + /* Expand the size of the allocated memory region so that we can + adjust for alignment. */ + size = LWIP_MEM_ALIGN_SIZE(size); + + if(size < MIN_SIZE_ALIGNED) { + /* every data block must be at least MIN_SIZE_ALIGNED long */ + size = MIN_SIZE_ALIGNED; + } + + if (size > MEM_SIZE_ALIGNED) { + return NULL; + } + + /* protect the heap from concurrent access */ + sys_mutex_lock(&mem_mutex); + LWIP_MEM_ALLOC_PROTECT(); +#if LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT + /* run as long as a mem_free disturbed mem_malloc */ + do { + local_mem_free_count = 0; +#endif /* LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT */ + + /* Scan through the heap searching for a free block that is big enough, + * beginning with the lowest free block. + */ + for (ptr = (mem_size_t)((u8_t *)lfree - ram); ptr < MEM_SIZE_ALIGNED - size; + ptr = ((struct mem *)(void *)&ram[ptr])->next) { + mem = (struct mem *)(void *)&ram[ptr]; +#if LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT + mem_free_count = 0; + LWIP_MEM_ALLOC_UNPROTECT(); + /* allow mem_free to run */ + LWIP_MEM_ALLOC_PROTECT(); + if (mem_free_count != 0) { + local_mem_free_count = mem_free_count; + } + mem_free_count = 0; +#endif /* LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT */ + + if ((!mem->used) && + (mem->next - (ptr + SIZEOF_STRUCT_MEM)) >= size) { + /* mem is not used and at least perfect fit is possible: + * mem->next - (ptr + SIZEOF_STRUCT_MEM) gives us the 'user data size' of mem */ + + if (mem->next - (ptr + SIZEOF_STRUCT_MEM) >= (size + SIZEOF_STRUCT_MEM + MIN_SIZE_ALIGNED)) { + /* (in addition to the above, we test if another struct mem (SIZEOF_STRUCT_MEM) containing + * at least MIN_SIZE_ALIGNED of data also fits in the 'user data space' of 'mem') + * -> split large block, create empty remainder, + * remainder must be large enough to contain MIN_SIZE_ALIGNED data: if + * mem->next - (ptr + (2*SIZEOF_STRUCT_MEM)) == size, + * struct mem would fit in but no data between mem2 and mem2->next + * @todo we could leave out MIN_SIZE_ALIGNED. We would create an empty + * region that couldn't hold data, but when mem->next gets freed, + * the 2 regions would be combined, resulting in more free memory + */ + ptr2 = ptr + SIZEOF_STRUCT_MEM + size; + /* create mem2 struct */ + mem2 = (struct mem *)(void *)&ram[ptr2]; + mem2->used = 0; + mem2->next = mem->next; + mem2->prev = ptr; + /* and insert it between mem and mem->next */ + mem->next = ptr2; + mem->used = 1; + + if (mem2->next != MEM_SIZE_ALIGNED) { + ((struct mem *)(void *)&ram[mem2->next])->prev = ptr2; + } + MEM_STATS_INC_USED(used, (size + SIZEOF_STRUCT_MEM)); + } else { + /* (a mem2 struct does no fit into the user data space of mem and mem->next will always + * be used at this point: if not we have 2 unused structs in a row, plug_holes should have + * take care of this). + * -> near fit or excact fit: do not split, no mem2 creation + * also can't move mem->next directly behind mem, since mem->next + * will always be used at this point! + */ + mem->used = 1; + MEM_STATS_INC_USED(used, mem->next - (mem_size_t)((u8_t *)mem - ram)); + } + + if (mem == lfree) { + /* Find next free block after mem and update lowest free pointer */ + while (lfree->used && lfree != ram_end) { + LWIP_MEM_ALLOC_UNPROTECT(); + /* prevent high interrupt latency... */ + LWIP_MEM_ALLOC_PROTECT(); + lfree = (struct mem *)(void *)&ram[lfree->next]; + } + LWIP_ASSERT("mem_malloc: !lfree->used", ((lfree == ram_end) || (!lfree->used))); + } + LWIP_MEM_ALLOC_UNPROTECT(); + sys_mutex_unlock(&mem_mutex); + LWIP_ASSERT("mem_malloc: allocated memory not above ram_end.", + (mem_ptr_t)mem + SIZEOF_STRUCT_MEM + size <= (mem_ptr_t)ram_end); + LWIP_ASSERT("mem_malloc: allocated memory properly aligned.", + ((mem_ptr_t)mem + SIZEOF_STRUCT_MEM) % MEM_ALIGNMENT == 0); + LWIP_ASSERT("mem_malloc: sanity check alignment", + (((mem_ptr_t)mem) & (MEM_ALIGNMENT-1)) == 0); + + return (u8_t *)mem + SIZEOF_STRUCT_MEM; + } + } +#if LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT + /* if we got interrupted by a mem_free, try again */ + } while(local_mem_free_count != 0); +#endif /* LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT */ + LWIP_DEBUGF(MEM_DEBUG | LWIP_DBG_LEVEL_SERIOUS, ("mem_malloc: could not allocate %"S16_F" bytes\n", (s16_t)size)); + MEM_STATS_INC(err); + LWIP_MEM_ALLOC_UNPROTECT(); + sys_mutex_unlock(&mem_mutex); + return NULL; +} + +#endif /* MEM_USE_POOLS */ +/** + * Contiguously allocates enough space for count objects that are size bytes + * of memory each and returns a pointer to the allocated memory. + * + * The allocated memory is filled with bytes of value zero. + * + * @param count number of objects to allocate + * @param size size of the objects to allocate + * @return pointer to allocated memory / NULL pointer if there is an error + */ +void *mem_calloc(mem_size_t count, mem_size_t size) +{ + void *p; + + /* allocate 'count' objects of size 'size' */ + p = mem_malloc(count * size); + if (p) { + /* zero the memory */ + memset(p, 0, count * size); + } + return p; +} + +#endif /* !MEM_LIBC_MALLOC */ diff --git a/lib/drivers/lwip/src/core/memp.c b/lib/drivers/lwip/src/core/memp.c new file mode 100644 index 00000000000..4da879a57b4 --- /dev/null +++ b/lib/drivers/lwip/src/core/memp.c @@ -0,0 +1,469 @@ +/** + * @file + * Dynamic pool memory manager + * + * lwIP has dedicated pools for many structures (netconn, protocol control blocks, + * packet buffers, ...). All these pools are managed here. + */ + +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ + +#include "lwip/opt.h" + +#include "lwip/memp.h" +#include "lwip/pbuf.h" +#include "lwip/udp.h" +#include "lwip/raw.h" +#include "lwip/tcp_impl.h" +#include "lwip/igmp.h" +#include "lwip/api.h" +#include "lwip/api_msg.h" +#include "lwip/tcpip.h" +#include "lwip/sys.h" +#include "lwip/timers.h" +#include "lwip/stats.h" +#include "netif/etharp.h" +#include "lwip/ip_frag.h" +#include "lwip/snmp_structs.h" +#include "lwip/snmp_msg.h" +#include "lwip/dns.h" +#include "netif/ppp_oe.h" + +#include + +#if !MEMP_MEM_MALLOC /* don't build if not configured for use in lwipopts.h */ + +struct memp { + struct memp *next; +#if MEMP_OVERFLOW_CHECK + const char *file; + int line; +#endif /* MEMP_OVERFLOW_CHECK */ +}; + +#if MEMP_OVERFLOW_CHECK +/* if MEMP_OVERFLOW_CHECK is turned on, we reserve some bytes at the beginning + * and at the end of each element, initialize them as 0xcd and check + * them later. */ +/* If MEMP_OVERFLOW_CHECK is >= 2, on every call to memp_malloc or memp_free, + * every single element in each pool is checked! + * This is VERY SLOW but also very helpful. */ +/* MEMP_SANITY_REGION_BEFORE and MEMP_SANITY_REGION_AFTER can be overridden in + * lwipopts.h to change the amount reserved for checking. */ +#ifndef MEMP_SANITY_REGION_BEFORE +#define MEMP_SANITY_REGION_BEFORE 16 +#endif /* MEMP_SANITY_REGION_BEFORE*/ +#if MEMP_SANITY_REGION_BEFORE > 0 +#define MEMP_SANITY_REGION_BEFORE_ALIGNED LWIP_MEM_ALIGN_SIZE(MEMP_SANITY_REGION_BEFORE) +#else +#define MEMP_SANITY_REGION_BEFORE_ALIGNED 0 +#endif /* MEMP_SANITY_REGION_BEFORE*/ +#ifndef MEMP_SANITY_REGION_AFTER +#define MEMP_SANITY_REGION_AFTER 16 +#endif /* MEMP_SANITY_REGION_AFTER*/ +#if MEMP_SANITY_REGION_AFTER > 0 +#define MEMP_SANITY_REGION_AFTER_ALIGNED LWIP_MEM_ALIGN_SIZE(MEMP_SANITY_REGION_AFTER) +#else +#define MEMP_SANITY_REGION_AFTER_ALIGNED 0 +#endif /* MEMP_SANITY_REGION_AFTER*/ + +/* MEMP_SIZE: save space for struct memp and for sanity check */ +#define MEMP_SIZE (LWIP_MEM_ALIGN_SIZE(sizeof(struct memp)) + MEMP_SANITY_REGION_BEFORE_ALIGNED) +#define MEMP_ALIGN_SIZE(x) (LWIP_MEM_ALIGN_SIZE(x) + MEMP_SANITY_REGION_AFTER_ALIGNED) + +#else /* MEMP_OVERFLOW_CHECK */ + +/* No sanity checks + * We don't need to preserve the struct memp while not allocated, so we + * can save a little space and set MEMP_SIZE to 0. + */ +#define MEMP_SIZE 0 +#define MEMP_ALIGN_SIZE(x) (LWIP_MEM_ALIGN_SIZE(x)) + +#endif /* MEMP_OVERFLOW_CHECK */ + +/** This array holds the first free element of each pool. + * Elements form a linked list. */ +static struct memp *memp_tab[MEMP_MAX]; + +#else /* MEMP_MEM_MALLOC */ + +#define MEMP_ALIGN_SIZE(x) (LWIP_MEM_ALIGN_SIZE(x)) + +#endif /* MEMP_MEM_MALLOC */ + +/** This array holds the element sizes of each pool. */ +#if !MEM_USE_POOLS && !MEMP_MEM_MALLOC +static +#endif +const u16_t memp_sizes[MEMP_MAX] = { +#define LWIP_MEMPOOL(name,num,size,desc) LWIP_MEM_ALIGN_SIZE(size), +#include "lwip/memp_std.h" +}; + +#if !MEMP_MEM_MALLOC /* don't build if not configured for use in lwipopts.h */ + +/** This array holds the number of elements in each pool. */ +static const u16_t memp_num[MEMP_MAX] = { +#define LWIP_MEMPOOL(name,num,size,desc) (num), +#include "lwip/memp_std.h" +}; + +/** This array holds a textual description of each pool. */ +#ifdef LWIP_DEBUG +static const char *memp_desc[MEMP_MAX] = { +#define LWIP_MEMPOOL(name,num,size,desc) (desc), +#include "lwip/memp_std.h" +}; +#endif /* LWIP_DEBUG */ + +#if MEMP_SEPARATE_POOLS + +/** This creates each memory pool. These are named memp_memory_XXX_base (where + * XXX is the name of the pool defined in memp_std.h). + * To relocate a pool, declare it as extern in cc.h. Example for GCC: + * extern u8_t __attribute__((section(".onchip_mem"))) memp_memory_UDP_PCB_base[]; + */ +#define LWIP_MEMPOOL(name,num,size,desc) u8_t memp_memory_ ## name ## _base \ + [((num) * (MEMP_SIZE + MEMP_ALIGN_SIZE(size)))]; +#include "lwip/memp_std.h" + +/** This array holds the base of each memory pool. */ +static u8_t *const memp_bases[] = { +#define LWIP_MEMPOOL(name,num,size,desc) memp_memory_ ## name ## _base, +#include "lwip/memp_std.h" +}; + +#else /* MEMP_SEPARATE_POOLS */ + +/** This is the actual memory used by the pools (all pools in one big block). */ +static u8_t memp_memory[MEM_ALIGNMENT - 1 +#define LWIP_MEMPOOL(name,num,size,desc) + ( (num) * (MEMP_SIZE + MEMP_ALIGN_SIZE(size) ) ) +#include "lwip/memp_std.h" +]; + +#endif /* MEMP_SEPARATE_POOLS */ + +#if MEMP_SANITY_CHECK +/** + * Check that memp-lists don't form a circle + */ +static int +memp_sanity(void) +{ + s16_t i, c; + struct memp *m, *n; + + for (i = 0; i < MEMP_MAX; i++) { + for (m = memp_tab[i]; m != NULL; m = m->next) { + c = 1; + for (n = memp_tab[i]; n != NULL; n = n->next) { + if (n == m && --c < 0) { + return 0; + } + } + } + } + return 1; +} +#endif /* MEMP_SANITY_CHECK*/ +#if MEMP_OVERFLOW_CHECK +#if defined(LWIP_DEBUG) && MEMP_STATS +static const char * memp_overflow_names[] = { +#define LWIP_MEMPOOL(name,num,size,desc) "/"desc, +#include "lwip/memp_std.h" + }; +#endif + +/** + * Check if a memp element was victim of an overflow + * (e.g. the restricted area after it has been altered) + * + * @param p the memp element to check + * @param memp_type the pool p comes from + */ +static void +memp_overflow_check_element_overflow(struct memp *p, u16_t memp_type) +{ + u16_t k; + u8_t *m; +#if MEMP_SANITY_REGION_AFTER_ALIGNED > 0 + m = (u8_t*)p + MEMP_SIZE + memp_sizes[memp_type]; + for (k = 0; k < MEMP_SANITY_REGION_AFTER_ALIGNED; k++) { + if (m[k] != 0xcd) { + char errstr[128] = "detected memp overflow in pool "; + char digit[] = "0"; + if(memp_type >= 10) { + digit[0] = '0' + (memp_type/10); + strcat(errstr, digit); + } + digit[0] = '0' + (memp_type%10); + strcat(errstr, digit); +#if defined(LWIP_DEBUG) && MEMP_STATS + strcat(errstr, memp_overflow_names[memp_type]); +#endif + LWIP_ASSERT(errstr, 0); + } + } +#endif +} + +/** + * Check if a memp element was victim of an underflow + * (e.g. the restricted area before it has been altered) + * + * @param p the memp element to check + * @param memp_type the pool p comes from + */ +static void +memp_overflow_check_element_underflow(struct memp *p, u16_t memp_type) +{ + u16_t k; + u8_t *m; +#if MEMP_SANITY_REGION_BEFORE_ALIGNED > 0 + m = (u8_t*)p + MEMP_SIZE - MEMP_SANITY_REGION_BEFORE_ALIGNED; + for (k = 0; k < MEMP_SANITY_REGION_BEFORE_ALIGNED; k++) { + if (m[k] != 0xcd) { + char errstr[128] = "detected memp underflow in pool "; + char digit[] = "0"; + if(memp_type >= 10) { + digit[0] = '0' + (memp_type/10); + strcat(errstr, digit); + } + digit[0] = '0' + (memp_type%10); + strcat(errstr, digit); +#if defined(LWIP_DEBUG) && MEMP_STATS + strcat(errstr, memp_overflow_names[memp_type]); +#endif + LWIP_ASSERT(errstr, 0); + } + } +#endif +} + +/** + * Do an overflow check for all elements in every pool. + * + * @see memp_overflow_check_element for a description of the check + */ +static void +memp_overflow_check_all(void) +{ + u16_t i, j; + struct memp *p; + + p = (struct memp *)LWIP_MEM_ALIGN(memp_memory); + for (i = 0; i < MEMP_MAX; ++i) { + p = p; + for (j = 0; j < memp_num[i]; ++j) { + memp_overflow_check_element_overflow(p, i); + p = (struct memp*)((u8_t*)p + MEMP_SIZE + memp_sizes[i] + MEMP_SANITY_REGION_AFTER_ALIGNED); + } + } + p = (struct memp *)LWIP_MEM_ALIGN(memp_memory); + for (i = 0; i < MEMP_MAX; ++i) { + p = p; + for (j = 0; j < memp_num[i]; ++j) { + memp_overflow_check_element_underflow(p, i); + p = (struct memp*)((u8_t*)p + MEMP_SIZE + memp_sizes[i] + MEMP_SANITY_REGION_AFTER_ALIGNED); + } + } +} + +/** + * Initialize the restricted areas of all memp elements in every pool. + */ +static void +memp_overflow_init(void) +{ + u16_t i, j; + struct memp *p; + u8_t *m; + + p = (struct memp *)LWIP_MEM_ALIGN(memp_memory); + for (i = 0; i < MEMP_MAX; ++i) { + p = p; + for (j = 0; j < memp_num[i]; ++j) { +#if MEMP_SANITY_REGION_BEFORE_ALIGNED > 0 + m = (u8_t*)p + MEMP_SIZE - MEMP_SANITY_REGION_BEFORE_ALIGNED; + memset(m, 0xcd, MEMP_SANITY_REGION_BEFORE_ALIGNED); +#endif +#if MEMP_SANITY_REGION_AFTER_ALIGNED > 0 + m = (u8_t*)p + MEMP_SIZE + memp_sizes[i]; + memset(m, 0xcd, MEMP_SANITY_REGION_AFTER_ALIGNED); +#endif + p = (struct memp*)((u8_t*)p + MEMP_SIZE + memp_sizes[i] + MEMP_SANITY_REGION_AFTER_ALIGNED); + } + } +} +#endif /* MEMP_OVERFLOW_CHECK */ + +/** + * Initialize this module. + * + * Carves out memp_memory into linked lists for each pool-type. + */ +void +memp_init(void) +{ + struct memp *memp; + u16_t i, j; + + for (i = 0; i < MEMP_MAX; ++i) { + MEMP_STATS_AVAIL(used, i, 0); + MEMP_STATS_AVAIL(max, i, 0); + MEMP_STATS_AVAIL(err, i, 0); + MEMP_STATS_AVAIL(avail, i, memp_num[i]); + } + +#if !MEMP_SEPARATE_POOLS + memp = (struct memp *)LWIP_MEM_ALIGN(memp_memory); +#endif /* !MEMP_SEPARATE_POOLS */ + /* for every pool: */ + for (i = 0; i < MEMP_MAX; ++i) { + memp_tab[i] = NULL; +#if MEMP_SEPARATE_POOLS + memp = (struct memp*)memp_bases[i]; +#endif /* MEMP_SEPARATE_POOLS */ + /* create a linked list of memp elements */ + for (j = 0; j < memp_num[i]; ++j) { + memp->next = memp_tab[i]; + memp_tab[i] = memp; + memp = (struct memp *)(void *)((u8_t *)memp + MEMP_SIZE + memp_sizes[i] +#if MEMP_OVERFLOW_CHECK + + MEMP_SANITY_REGION_AFTER_ALIGNED +#endif + ); + } + } +#if MEMP_OVERFLOW_CHECK + memp_overflow_init(); + /* check everything a first time to see if it worked */ + memp_overflow_check_all(); +#endif /* MEMP_OVERFLOW_CHECK */ +} + +/** + * Get an element from a specific pool. + * + * @param type the pool to get an element from + * + * the debug version has two more parameters: + * @param file file name calling this function + * @param line number of line where this function is called + * + * @return a pointer to the allocated memory or a NULL pointer on error + */ +void * +#if !MEMP_OVERFLOW_CHECK +memp_malloc(memp_t type) +#else +memp_malloc_fn(memp_t type, const char* file, const int line) +#endif +{ + struct memp *memp; + SYS_ARCH_DECL_PROTECT(old_level); + + LWIP_ERROR("memp_malloc: type < MEMP_MAX", (type < MEMP_MAX), return NULL;); + + SYS_ARCH_PROTECT(old_level); +#if MEMP_OVERFLOW_CHECK >= 2 + memp_overflow_check_all(); +#endif /* MEMP_OVERFLOW_CHECK >= 2 */ + + memp = memp_tab[type]; + + if (memp != NULL) { + memp_tab[type] = memp->next; +#if MEMP_OVERFLOW_CHECK + memp->next = NULL; + memp->file = file; + memp->line = line; +#endif /* MEMP_OVERFLOW_CHECK */ + MEMP_STATS_INC_USED(used, type); + LWIP_ASSERT("memp_malloc: memp properly aligned", + ((mem_ptr_t)memp % MEM_ALIGNMENT) == 0); + memp = (struct memp*)(void *)((u8_t*)memp + MEMP_SIZE); + } else { + LWIP_DEBUGF(MEMP_DEBUG | LWIP_DBG_LEVEL_SERIOUS, ("memp_malloc: out of memory in pool %s\n", memp_desc[type])); + MEMP_STATS_INC(err, type); + } + + SYS_ARCH_UNPROTECT(old_level); + + return memp; +} + +/** + * Put an element back into its pool. + * + * @param type the pool where to put mem + * @param mem the memp element to free + */ +void +memp_free(memp_t type, void *mem) +{ + struct memp *memp; + SYS_ARCH_DECL_PROTECT(old_level); + + if (mem == NULL) { + return; + } + LWIP_ASSERT("memp_free: mem properly aligned", + ((mem_ptr_t)mem % MEM_ALIGNMENT) == 0); + + memp = (struct memp *)(void *)((u8_t*)mem - MEMP_SIZE); + + SYS_ARCH_PROTECT(old_level); +#if MEMP_OVERFLOW_CHECK +#if MEMP_OVERFLOW_CHECK >= 2 + memp_overflow_check_all(); +#else + memp_overflow_check_element_overflow(memp, type); + memp_overflow_check_element_underflow(memp, type); +#endif /* MEMP_OVERFLOW_CHECK >= 2 */ +#endif /* MEMP_OVERFLOW_CHECK */ + + MEMP_STATS_DEC(used, type); + + memp->next = memp_tab[type]; + memp_tab[type] = memp; + +#if MEMP_SANITY_CHECK + LWIP_ASSERT("memp sanity", memp_sanity()); +#endif /* MEMP_SANITY_CHECK */ + + SYS_ARCH_UNPROTECT(old_level); +} + +#endif /* MEMP_MEM_MALLOC */ diff --git a/lib/drivers/lwip/src/core/netif.c b/lib/drivers/lwip/src/core/netif.c new file mode 100644 index 00000000000..f190b1f2e03 --- /dev/null +++ b/lib/drivers/lwip/src/core/netif.c @@ -0,0 +1,752 @@ +/** + * @file + * lwIP network interface abstraction + * + */ + +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ + +#include "lwip/opt.h" + +#include "lwip/def.h" +#include "lwip/ip_addr.h" +#include "lwip/netif.h" +#include "lwip/tcp_impl.h" +#include "lwip/snmp.h" +#include "lwip/igmp.h" +#include "netif/etharp.h" +#include "lwip/stats.h" +#if ENABLE_LOOPBACK +#include "lwip/sys.h" +#if LWIP_NETIF_LOOPBACK_MULTITHREADING +#include "lwip/tcpip.h" +#endif /* LWIP_NETIF_LOOPBACK_MULTITHREADING */ +#endif /* ENABLE_LOOPBACK */ + +#if LWIP_AUTOIP +#include "lwip/autoip.h" +#endif /* LWIP_AUTOIP */ +#if LWIP_DHCP +#include "lwip/dhcp.h" +#endif /* LWIP_DHCP */ + +#if LWIP_NETIF_STATUS_CALLBACK +#define NETIF_STATUS_CALLBACK(n) do{ if (n->status_callback) { (n->status_callback)(n); }}while(0) +#else +#define NETIF_STATUS_CALLBACK(n) +#endif /* LWIP_NETIF_STATUS_CALLBACK */ + +#if LWIP_NETIF_LINK_CALLBACK +#define NETIF_LINK_CALLBACK(n) do{ if (n->link_callback) { (n->link_callback)(n); }}while(0) +#else +#define NETIF_LINK_CALLBACK(n) +#endif /* LWIP_NETIF_LINK_CALLBACK */ + +struct netif *netif_list; +struct netif *netif_default; + +#if LWIP_HAVE_LOOPIF +static struct netif loop_netif; + +/** + * Initialize a lwip network interface structure for a loopback interface + * + * @param netif the lwip network interface structure for this loopif + * @return ERR_OK if the loopif is initialized + * ERR_MEM if private data couldn't be allocated + */ +static err_t +netif_loopif_init(struct netif *netif) +{ + /* initialize the snmp variables and counters inside the struct netif + * ifSpeed: no assumption can be made! + */ + NETIF_INIT_SNMP(netif, snmp_ifType_softwareLoopback, 0); + + netif->name[0] = 'l'; + netif->name[1] = 'o'; + netif->output = netif_loop_output; + return ERR_OK; +} +#endif /* LWIP_HAVE_LOOPIF */ + +void +netif_init(void) +{ +#if LWIP_HAVE_LOOPIF + ip_addr_t loop_ipaddr, loop_netmask, loop_gw; + IP4_ADDR(&loop_gw, 127,0,0,1); + IP4_ADDR(&loop_ipaddr, 127,0,0,1); + IP4_ADDR(&loop_netmask, 255,0,0,0); + +#if NO_SYS + netif_add(&loop_netif, &loop_ipaddr, &loop_netmask, &loop_gw, NULL, netif_loopif_init, ip_input); +#else /* NO_SYS */ + netif_add(&loop_netif, &loop_ipaddr, &loop_netmask, &loop_gw, NULL, netif_loopif_init, tcpip_input); +#endif /* NO_SYS */ + netif_set_up(&loop_netif); + +#endif /* LWIP_HAVE_LOOPIF */ +} + +/** + * Add a network interface to the list of lwIP netifs. + * + * @param netif a pre-allocated netif structure + * @param ipaddr IP address for the new netif + * @param netmask network mask for the new netif + * @param gw default gateway IP address for the new netif + * @param state opaque data passed to the new netif + * @param init callback function that initializes the interface + * @param input callback function that is called to pass + * ingress packets up in the protocol layer stack. + * + * @return netif, or NULL if failed. + */ +struct netif * +netif_add(struct netif *netif, ip_addr_t *ipaddr, ip_addr_t *netmask, + ip_addr_t *gw, void *state, netif_init_fn init, netif_input_fn input) +{ + static u8_t netifnum = 0; + + LWIP_ASSERT("No init function given", init != NULL); + + /* reset new interface configuration state */ + ip_addr_set_zero(&netif->ip_addr); + ip_addr_set_zero(&netif->netmask); + ip_addr_set_zero(&netif->gw); + netif->flags = 0; +#if LWIP_DHCP + /* netif not under DHCP control by default */ + netif->dhcp = NULL; +#endif /* LWIP_DHCP */ +#if LWIP_AUTOIP + /* netif not under AutoIP control by default */ + netif->autoip = NULL; +#endif /* LWIP_AUTOIP */ +#if LWIP_NETIF_STATUS_CALLBACK + netif->status_callback = NULL; +#endif /* LWIP_NETIF_STATUS_CALLBACK */ +#if LWIP_NETIF_LINK_CALLBACK + netif->link_callback = NULL; +#endif /* LWIP_NETIF_LINK_CALLBACK */ +#if LWIP_IGMP + netif->igmp_mac_filter = NULL; +#endif /* LWIP_IGMP */ +#if ENABLE_LOOPBACK + netif->loop_first = NULL; + netif->loop_last = NULL; +#endif /* ENABLE_LOOPBACK */ + + /* remember netif specific state information data */ + netif->state = state; + netif->num = netifnum++; + netif->input = input; +#if LWIP_NETIF_HWADDRHINT + netif->addr_hint = NULL; +#endif /* LWIP_NETIF_HWADDRHINT*/ +#if ENABLE_LOOPBACK && LWIP_LOOPBACK_MAX_PBUFS + netif->loop_cnt_current = 0; +#endif /* ENABLE_LOOPBACK && LWIP_LOOPBACK_MAX_PBUFS */ + + netif_set_addr(netif, ipaddr, netmask, gw); + + /* call user specified initialization function for netif */ + if (init(netif) != ERR_OK) { + return NULL; + } + + /* add this netif to the list */ + netif->next = netif_list; + netif_list = netif; + snmp_inc_iflist(); + +#if LWIP_IGMP + /* start IGMP processing */ + if (netif->flags & NETIF_FLAG_IGMP) { + igmp_start(netif); + } +#endif /* LWIP_IGMP */ + + LWIP_DEBUGF(NETIF_DEBUG, ("netif: added interface %c%c IP addr ", + netif->name[0], netif->name[1])); + ip_addr_debug_print(NETIF_DEBUG, ipaddr); + LWIP_DEBUGF(NETIF_DEBUG, (" netmask ")); + ip_addr_debug_print(NETIF_DEBUG, netmask); + LWIP_DEBUGF(NETIF_DEBUG, (" gw ")); + ip_addr_debug_print(NETIF_DEBUG, gw); + LWIP_DEBUGF(NETIF_DEBUG, ("\n")); + return netif; +} + +/** + * Change IP address configuration for a network interface (including netmask + * and default gateway). + * + * @param netif the network interface to change + * @param ipaddr the new IP address + * @param netmask the new netmask + * @param gw the new default gateway + */ +void +netif_set_addr(struct netif *netif, ip_addr_t *ipaddr, ip_addr_t *netmask, + ip_addr_t *gw) +{ + netif_set_ipaddr(netif, ipaddr); + netif_set_netmask(netif, netmask); + netif_set_gw(netif, gw); +} + +/** + * Remove a network interface from the list of lwIP netifs. + * + * @param netif the network interface to remove + */ +void +netif_remove(struct netif *netif) +{ + if (netif == NULL) { + return; + } + +#if LWIP_IGMP + /* stop IGMP processing */ + if (netif->flags & NETIF_FLAG_IGMP) { + igmp_stop(netif); + } +#endif /* LWIP_IGMP */ + if (netif_is_up(netif)) { + /* set netif down before removing (call callback function) */ + netif_set_down(netif); + } + + snmp_delete_ipaddridx_tree(netif); + + /* is it the first netif? */ + if (netif_list == netif) { + netif_list = netif->next; + } else { + /* look for netif further down the list */ + struct netif * tmpNetif; + for (tmpNetif = netif_list; tmpNetif != NULL; tmpNetif = tmpNetif->next) { + if (tmpNetif->next == netif) { + tmpNetif->next = netif->next; + break; + } + } + if (tmpNetif == NULL) + return; /* we didn't find any netif today */ + } + snmp_dec_iflist(); + /* this netif is default? */ + if (netif_default == netif) { + /* reset default netif */ + netif_set_default(NULL); + } + LWIP_DEBUGF( NETIF_DEBUG, ("netif_remove: removed netif\n") ); +} + +/** + * Find a network interface by searching for its name + * + * @param name the name of the netif (like netif->name) plus concatenated number + * in ascii representation (e.g. 'en0') + */ +struct netif * +netif_find(char *name) +{ + struct netif *netif; + u8_t num; + + if (name == NULL) { + return NULL; + } + + num = name[2] - '0'; + + for(netif = netif_list; netif != NULL; netif = netif->next) { + if (num == netif->num && + name[0] == netif->name[0] && + name[1] == netif->name[1]) { + LWIP_DEBUGF(NETIF_DEBUG, ("netif_find: found %c%c\n", name[0], name[1])); + return netif; + } + } + LWIP_DEBUGF(NETIF_DEBUG, ("netif_find: didn't find %c%c\n", name[0], name[1])); + return NULL; +} + +/** + * Change the IP address of a network interface + * + * @param netif the network interface to change + * @param ipaddr the new IP address + * + * @note call netif_set_addr() if you also want to change netmask and + * default gateway + */ +void +netif_set_ipaddr(struct netif *netif, ip_addr_t *ipaddr) +{ + /* TODO: Handling of obsolete pcbs */ + /* See: http://mail.gnu.org/archive/html/lwip-users/2003-03/msg00118.html */ +#if LWIP_TCP + struct tcp_pcb *pcb; + struct tcp_pcb_listen *lpcb; + + /* address is actually being changed? */ + if ((ip_addr_cmp(ipaddr, &(netif->ip_addr))) == 0) { + /* extern struct tcp_pcb *tcp_active_pcbs; defined by tcp.h */ + LWIP_DEBUGF(NETIF_DEBUG | LWIP_DBG_STATE, ("netif_set_ipaddr: netif address being changed\n")); + pcb = tcp_active_pcbs; + while (pcb != NULL) { + /* PCB bound to current local interface address? */ + if (ip_addr_cmp(&(pcb->local_ip), &(netif->ip_addr)) +#if LWIP_AUTOIP + /* connections to link-local addresses must persist (RFC3927 ch. 1.9) */ + && !ip_addr_islinklocal(&(pcb->local_ip)) +#endif /* LWIP_AUTOIP */ + ) { + /* this connection must be aborted */ + struct tcp_pcb *next = pcb->next; + LWIP_DEBUGF(NETIF_DEBUG | LWIP_DBG_STATE, ("netif_set_ipaddr: aborting TCP pcb %p\n", (void *)pcb)); + tcp_abort(pcb); + pcb = next; + } else { + pcb = pcb->next; + } + } + for (lpcb = tcp_listen_pcbs.listen_pcbs; lpcb != NULL; lpcb = lpcb->next) { + /* PCB bound to current local interface address? */ + if ((!(ip_addr_isany(&(lpcb->local_ip)))) && + (ip_addr_cmp(&(lpcb->local_ip), &(netif->ip_addr)))) { + /* The PCB is listening to the old ipaddr and + * is set to listen to the new one instead */ + ip_addr_set(&(lpcb->local_ip), ipaddr); + } + } + } +#endif + snmp_delete_ipaddridx_tree(netif); + snmp_delete_iprteidx_tree(0,netif); + /* set new IP address to netif */ + ip_addr_set(&(netif->ip_addr), ipaddr); + snmp_insert_ipaddridx_tree(netif); + snmp_insert_iprteidx_tree(0,netif); + + LWIP_DEBUGF(NETIF_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("netif: IP address of interface %c%c set to %"U16_F".%"U16_F".%"U16_F".%"U16_F"\n", + netif->name[0], netif->name[1], + ip4_addr1_16(&netif->ip_addr), + ip4_addr2_16(&netif->ip_addr), + ip4_addr3_16(&netif->ip_addr), + ip4_addr4_16(&netif->ip_addr))); +} + +/** + * Change the default gateway for a network interface + * + * @param netif the network interface to change + * @param gw the new default gateway + * + * @note call netif_set_addr() if you also want to change ip address and netmask + */ +void +netif_set_gw(struct netif *netif, ip_addr_t *gw) +{ + ip_addr_set(&(netif->gw), gw); + LWIP_DEBUGF(NETIF_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("netif: GW address of interface %c%c set to %"U16_F".%"U16_F".%"U16_F".%"U16_F"\n", + netif->name[0], netif->name[1], + ip4_addr1_16(&netif->gw), + ip4_addr2_16(&netif->gw), + ip4_addr3_16(&netif->gw), + ip4_addr4_16(&netif->gw))); +} + +/** + * Change the netmask of a network interface + * + * @param netif the network interface to change + * @param netmask the new netmask + * + * @note call netif_set_addr() if you also want to change ip address and + * default gateway + */ +void +netif_set_netmask(struct netif *netif, ip_addr_t *netmask) +{ + snmp_delete_iprteidx_tree(0, netif); + /* set new netmask to netif */ + ip_addr_set(&(netif->netmask), netmask); + snmp_insert_iprteidx_tree(0, netif); + LWIP_DEBUGF(NETIF_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, ("netif: netmask of interface %c%c set to %"U16_F".%"U16_F".%"U16_F".%"U16_F"\n", + netif->name[0], netif->name[1], + ip4_addr1_16(&netif->netmask), + ip4_addr2_16(&netif->netmask), + ip4_addr3_16(&netif->netmask), + ip4_addr4_16(&netif->netmask))); +} + +/** + * Set a network interface as the default network interface + * (used to output all packets for which no specific route is found) + * + * @param netif the default network interface + */ +void +netif_set_default(struct netif *netif) +{ + if (netif == NULL) { + /* remove default route */ + snmp_delete_iprteidx_tree(1, netif); + } else { + /* install default route */ + snmp_insert_iprteidx_tree(1, netif); + } + netif_default = netif; + LWIP_DEBUGF(NETIF_DEBUG, ("netif: setting default interface %c%c\n", + netif ? netif->name[0] : '\'', netif ? netif->name[1] : '\'')); +} + +/** + * Bring an interface up, available for processing + * traffic. + * + * @note: Enabling DHCP on a down interface will make it come + * up once configured. + * + * @see dhcp_start() + */ +void netif_set_up(struct netif *netif) +{ + if (!(netif->flags & NETIF_FLAG_UP)) { + netif->flags |= NETIF_FLAG_UP; + +#if LWIP_SNMP + snmp_get_sysuptime(&netif->ts); +#endif /* LWIP_SNMP */ + + NETIF_STATUS_CALLBACK(netif); + + if (netif->flags & NETIF_FLAG_LINK_UP) { +#if LWIP_ARP + /* For Ethernet network interfaces, we would like to send a "gratuitous ARP" */ + if (netif->flags & (NETIF_FLAG_ETHARP)) { + etharp_gratuitous(netif); + } +#endif /* LWIP_ARP */ + +#if LWIP_IGMP + /* resend IGMP memberships */ + if (netif->flags & NETIF_FLAG_IGMP) { + igmp_report_groups( netif); + } +#endif /* LWIP_IGMP */ + } + } +} + +/** + * Bring an interface down, disabling any traffic processing. + * + * @note: Enabling DHCP on a down interface will make it come + * up once configured. + * + * @see dhcp_start() + */ +void netif_set_down(struct netif *netif) +{ + if (netif->flags & NETIF_FLAG_UP) { + netif->flags &= ~NETIF_FLAG_UP; +#if LWIP_SNMP + snmp_get_sysuptime(&netif->ts); +#endif + + NETIF_STATUS_CALLBACK(netif); + } +} + +#if LWIP_NETIF_STATUS_CALLBACK +/** + * Set callback to be called when interface is brought up/down + */ +void netif_set_status_callback(struct netif *netif, netif_status_callback_fn status_callback) +{ + if (netif) { + netif->status_callback = status_callback; + } +} +#endif /* LWIP_NETIF_STATUS_CALLBACK */ + +/** + * Called by a driver when its link goes up + */ +void netif_set_link_up(struct netif *netif ) +{ + if (!(netif->flags & NETIF_FLAG_LINK_UP)) { + netif->flags |= NETIF_FLAG_LINK_UP; + +#if LWIP_DHCP + if (netif->dhcp) { + dhcp_network_changed(netif); + } +#endif /* LWIP_DHCP */ + +#if LWIP_AUTOIP + if (netif->autoip) { + autoip_network_changed(netif); + } +#endif /* LWIP_AUTOIP */ + + if (netif->flags & NETIF_FLAG_UP) { +#if LWIP_ARP + /* For Ethernet network interfaces, we would like to send a "gratuitous ARP" */ + if (netif->flags & NETIF_FLAG_ETHARP) { + etharp_gratuitous(netif); + } +#endif /* LWIP_ARP */ + +#if LWIP_IGMP + /* resend IGMP memberships */ + if (netif->flags & NETIF_FLAG_IGMP) { + igmp_report_groups( netif); + } +#endif /* LWIP_IGMP */ + } + NETIF_LINK_CALLBACK(netif); + } +} + +/** + * Called by a driver when its link goes down + */ +void netif_set_link_down(struct netif *netif ) +{ + if (netif->flags & NETIF_FLAG_LINK_UP) { + netif->flags &= ~NETIF_FLAG_LINK_UP; + NETIF_LINK_CALLBACK(netif); + } +} + +#if LWIP_NETIF_LINK_CALLBACK +/** + * Set callback to be called when link is brought up/down + */ +void netif_set_link_callback(struct netif *netif, netif_status_callback_fn link_callback) +{ + if (netif) { + netif->link_callback = link_callback; + } +} +#endif /* LWIP_NETIF_LINK_CALLBACK */ + +#if ENABLE_LOOPBACK +/** + * Send an IP packet to be received on the same netif (loopif-like). + * The pbuf is simply copied and handed back to netif->input. + * In multithreaded mode, this is done directly since netif->input must put + * the packet on a queue. + * In callback mode, the packet is put on an internal queue and is fed to + * netif->input by netif_poll(). + * + * @param netif the lwip network interface structure + * @param p the (IP) packet to 'send' + * @param ipaddr the ip address to send the packet to (not used) + * @return ERR_OK if the packet has been sent + * ERR_MEM if the pbuf used to copy the packet couldn't be allocated + */ +err_t +netif_loop_output(struct netif *netif, struct pbuf *p, + ip_addr_t *ipaddr) +{ + struct pbuf *r; + err_t err; + struct pbuf *last; +#if LWIP_LOOPBACK_MAX_PBUFS + u8_t clen = 0; +#endif /* LWIP_LOOPBACK_MAX_PBUFS */ + /* If we have a loopif, SNMP counters are adjusted for it, + * if not they are adjusted for 'netif'. */ +#if LWIP_SNMP +#if LWIP_HAVE_LOOPIF + struct netif *stats_if = &loop_netif; +#else /* LWIP_HAVE_LOOPIF */ + struct netif *stats_if = netif; +#endif /* LWIP_HAVE_LOOPIF */ +#endif /* LWIP_SNMP */ + SYS_ARCH_DECL_PROTECT(lev); + LWIP_UNUSED_ARG(ipaddr); + + /* Allocate a new pbuf */ + r = pbuf_alloc(PBUF_LINK, p->tot_len, PBUF_RAM); + if (r == NULL) { + LINK_STATS_INC(link.memerr); + LINK_STATS_INC(link.drop); + snmp_inc_ifoutdiscards(stats_if); + return ERR_MEM; + } +#if LWIP_LOOPBACK_MAX_PBUFS + clen = pbuf_clen(r); + /* check for overflow or too many pbuf on queue */ + if(((netif->loop_cnt_current + clen) < netif->loop_cnt_current) || + ((netif->loop_cnt_current + clen) > LWIP_LOOPBACK_MAX_PBUFS)) { + pbuf_free(r); + LINK_STATS_INC(link.memerr); + LINK_STATS_INC(link.drop); + snmp_inc_ifoutdiscards(stats_if); + return ERR_MEM; + } + netif->loop_cnt_current += clen; +#endif /* LWIP_LOOPBACK_MAX_PBUFS */ + + /* Copy the whole pbuf queue p into the single pbuf r */ + if ((err = pbuf_copy(r, p)) != ERR_OK) { + pbuf_free(r); + LINK_STATS_INC(link.memerr); + LINK_STATS_INC(link.drop); + snmp_inc_ifoutdiscards(stats_if); + return err; + } + + /* Put the packet on a linked list which gets emptied through calling + netif_poll(). */ + + /* let last point to the last pbuf in chain r */ + for (last = r; last->next != NULL; last = last->next); + + SYS_ARCH_PROTECT(lev); + if(netif->loop_first != NULL) { + LWIP_ASSERT("if first != NULL, last must also be != NULL", netif->loop_last != NULL); + netif->loop_last->next = r; + netif->loop_last = last; + } else { + netif->loop_first = r; + netif->loop_last = last; + } + SYS_ARCH_UNPROTECT(lev); + + LINK_STATS_INC(link.xmit); + snmp_add_ifoutoctets(stats_if, p->tot_len); + snmp_inc_ifoutucastpkts(stats_if); + +#if LWIP_NETIF_LOOPBACK_MULTITHREADING + /* For multithreading environment, schedule a call to netif_poll */ + tcpip_callback((tcpip_callback_fn)netif_poll, netif); +#endif /* LWIP_NETIF_LOOPBACK_MULTITHREADING */ + + return ERR_OK; +} + +/** + * Call netif_poll() in the main loop of your application. This is to prevent + * reentering non-reentrant functions like tcp_input(). Packets passed to + * netif_loop_output() are put on a list that is passed to netif->input() by + * netif_poll(). + */ +void +netif_poll(struct netif *netif) +{ + struct pbuf *in; + /* If we have a loopif, SNMP counters are adjusted for it, + * if not they are adjusted for 'netif'. */ +#if LWIP_SNMP +#if LWIP_HAVE_LOOPIF + struct netif *stats_if = &loop_netif; +#else /* LWIP_HAVE_LOOPIF */ + struct netif *stats_if = netif; +#endif /* LWIP_HAVE_LOOPIF */ +#endif /* LWIP_SNMP */ + SYS_ARCH_DECL_PROTECT(lev); + + do { + /* Get a packet from the list. With SYS_LIGHTWEIGHT_PROT=1, this is protected */ + SYS_ARCH_PROTECT(lev); + in = netif->loop_first; + if (in != NULL) { + struct pbuf *in_end = in; +#if LWIP_LOOPBACK_MAX_PBUFS + u8_t clen = pbuf_clen(in); + /* adjust the number of pbufs on queue */ + LWIP_ASSERT("netif->loop_cnt_current underflow", + ((netif->loop_cnt_current - clen) < netif->loop_cnt_current)); + netif->loop_cnt_current -= clen; +#endif /* LWIP_LOOPBACK_MAX_PBUFS */ + while (in_end->len != in_end->tot_len) { + LWIP_ASSERT("bogus pbuf: len != tot_len but next == NULL!", in_end->next != NULL); + in_end = in_end->next; + } + /* 'in_end' now points to the last pbuf from 'in' */ + if (in_end == netif->loop_last) { + /* this was the last pbuf in the list */ + netif->loop_first = netif->loop_last = NULL; + } else { + /* pop the pbuf off the list */ + netif->loop_first = in_end->next; + LWIP_ASSERT("should not be null since first != last!", netif->loop_first != NULL); + } + /* De-queue the pbuf from its successors on the 'loop_' list. */ + in_end->next = NULL; + } + SYS_ARCH_UNPROTECT(lev); + + if (in != NULL) { + LINK_STATS_INC(link.recv); + snmp_add_ifinoctets(stats_if, in->tot_len); + snmp_inc_ifinucastpkts(stats_if); + /* loopback packets are always IP packets! */ + if (ip_input(in, netif) != ERR_OK) { + pbuf_free(in); + } + /* Don't reference the packet any more! */ + in = NULL; + } + /* go on while there is a packet on the list */ + } while (netif->loop_first != NULL); +} + +#if !LWIP_NETIF_LOOPBACK_MULTITHREADING +/** + * Calls netif_poll() for every netif on the netif_list. + */ +void +netif_poll_all(void) +{ + struct netif *netif = netif_list; + /* loop through netifs */ + while (netif != NULL) { + netif_poll(netif); + /* proceed to next network interface */ + netif = netif->next; + } +} +#endif /* !LWIP_NETIF_LOOPBACK_MULTITHREADING */ +#endif /* ENABLE_LOOPBACK */ diff --git a/lib/drivers/lwip/src/core/pbuf.c b/lib/drivers/lwip/src/core/pbuf.c new file mode 100644 index 00000000000..dd9ff64eef9 --- /dev/null +++ b/lib/drivers/lwip/src/core/pbuf.c @@ -0,0 +1,1156 @@ +/** + * @file + * Packet buffer management + * + * Packets are built from the pbuf data structure. It supports dynamic + * memory allocation for packet contents or can reference externally + * managed packet contents both in RAM and ROM. Quick allocation for + * incoming packets is provided through pools with fixed sized pbufs. + * + * A packet may span over multiple pbufs, chained as a singly linked + * list. This is called a "pbuf chain". + * + * Multiple packets may be queued, also using this singly linked list. + * This is called a "packet queue". + * + * So, a packet queue consists of one or more pbuf chains, each of + * which consist of one or more pbufs. CURRENTLY, PACKET QUEUES ARE + * NOT SUPPORTED!!! Use helper structs to queue multiple packets. + * + * The differences between a pbuf chain and a packet queue are very + * precise but subtle. + * + * The last pbuf of a packet has a ->tot_len field that equals the + * ->len field. It can be found by traversing the list. If the last + * pbuf of a packet has a ->next field other than NULL, more packets + * are on the queue. + * + * Therefore, looping through a pbuf of a single packet, has an + * loop end condition (tot_len == p->len), NOT (next == NULL). + */ + +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ + +#include "lwip/opt.h" + +#include "lwip/stats.h" +#include "lwip/def.h" +#include "lwip/mem.h" +#include "lwip/memp.h" +#include "lwip/pbuf.h" +#include "lwip/sys.h" +#include "arch/perf.h" +#if TCP_QUEUE_OOSEQ +#include "lwip/tcp_impl.h" +#endif +#if LWIP_CHECKSUM_ON_COPY +#include "lwip/inet_chksum.h" +#endif + +#include + +#define SIZEOF_STRUCT_PBUF LWIP_MEM_ALIGN_SIZE(sizeof(struct pbuf)) +/* Since the pool is created in memp, PBUF_POOL_BUFSIZE will be automatically + aligned there. Therefore, PBUF_POOL_BUFSIZE_ALIGNED can be used here. */ +#define PBUF_POOL_BUFSIZE_ALIGNED LWIP_MEM_ALIGN_SIZE(PBUF_POOL_BUFSIZE) + +#if !LWIP_TCP || !TCP_QUEUE_OOSEQ || NO_SYS +#define PBUF_POOL_IS_EMPTY() +#else /* !LWIP_TCP || !TCP_QUEUE_OOSEQ || NO_SYS */ +/** Define this to 0 to prevent freeing ooseq pbufs when the PBUF_POOL is empty */ +#ifndef PBUF_POOL_FREE_OOSEQ +#define PBUF_POOL_FREE_OOSEQ 1 +#endif /* PBUF_POOL_FREE_OOSEQ */ + +#if PBUF_POOL_FREE_OOSEQ +#include "lwip/tcpip.h" +#define PBUF_POOL_IS_EMPTY() pbuf_pool_is_empty() +static u8_t pbuf_free_ooseq_queued; +/** + * Attempt to reclaim some memory from queued out-of-sequence TCP segments + * if we run out of pool pbufs. It's better to give priority to new packets + * if we're running out. + * + * This must be done in the correct thread context therefore this function + * can only be used with NO_SYS=0 and through tcpip_callback. + */ +static void +pbuf_free_ooseq(void* arg) +{ + struct tcp_pcb* pcb; + SYS_ARCH_DECL_PROTECT(old_level); + LWIP_UNUSED_ARG(arg); + + SYS_ARCH_PROTECT(old_level); + pbuf_free_ooseq_queued = 0; + SYS_ARCH_UNPROTECT(old_level); + + for (pcb = tcp_active_pcbs; NULL != pcb; pcb = pcb->next) { + if (NULL != pcb->ooseq) { + /** Free the ooseq pbufs of one PCB only */ + LWIP_DEBUGF(PBUF_DEBUG | LWIP_DBG_TRACE, ("pbuf_free_ooseq: freeing out-of-sequence pbufs\n")); + tcp_segs_free(pcb->ooseq); + pcb->ooseq = NULL; + return; + } + } +} + +/** Queue a call to pbuf_free_ooseq if not already queued. */ +static void +pbuf_pool_is_empty(void) +{ + u8_t queued; + SYS_ARCH_DECL_PROTECT(old_level); + + SYS_ARCH_PROTECT(old_level); + queued = pbuf_free_ooseq_queued; + pbuf_free_ooseq_queued = 1; + SYS_ARCH_UNPROTECT(old_level); + + if(!queued) { + /* queue a call to pbuf_free_ooseq if not already queued */ + if(tcpip_callback_with_block(pbuf_free_ooseq, NULL, 0) != ERR_OK) { + SYS_ARCH_PROTECT(old_level); + pbuf_free_ooseq_queued = 0; + SYS_ARCH_UNPROTECT(old_level); + } + } +} +#endif /* PBUF_POOL_FREE_OOSEQ */ +#endif /* !LWIP_TCP || !TCP_QUEUE_OOSEQ || NO_SYS */ + +/** + * Allocates a pbuf of the given type (possibly a chain for PBUF_POOL type). + * + * The actual memory allocated for the pbuf is determined by the + * layer at which the pbuf is allocated and the requested size + * (from the size parameter). + * + * @param layer flag to define header size + * @param length size of the pbuf's payload + * @param type this parameter decides how and where the pbuf + * should be allocated as follows: + * + * - PBUF_RAM: buffer memory for pbuf is allocated as one large + * chunk. This includes protocol headers as well. + * - PBUF_ROM: no buffer memory is allocated for the pbuf, even for + * protocol headers. Additional headers must be prepended + * by allocating another pbuf and chain in to the front of + * the ROM pbuf. It is assumed that the memory used is really + * similar to ROM in that it is immutable and will not be + * changed. Memory which is dynamic should generally not + * be attached to PBUF_ROM pbufs. Use PBUF_REF instead. + * - PBUF_REF: no buffer memory is allocated for the pbuf, even for + * protocol headers. It is assumed that the pbuf is only + * being used in a single thread. If the pbuf gets queued, + * then pbuf_take should be called to copy the buffer. + * - PBUF_POOL: the pbuf is allocated as a pbuf chain, with pbufs from + * the pbuf pool that is allocated during pbuf_init(). + * + * @return the allocated pbuf. If multiple pbufs where allocated, this + * is the first pbuf of a pbuf chain. + */ +struct pbuf * +pbuf_alloc(pbuf_layer layer, u16_t length, pbuf_type type) +{ + struct pbuf *p, *q, *r; + u16_t offset; + s32_t rem_len; /* remaining length */ + LWIP_DEBUGF(PBUF_DEBUG | LWIP_DBG_TRACE, ("pbuf_alloc(length=%"U16_F")\n", length)); + + /* determine header offset */ + offset = 0; + switch (layer) { + case PBUF_TRANSPORT: + /* add room for transport (often TCP) layer header */ + offset += PBUF_TRANSPORT_HLEN; + /* FALLTHROUGH */ + case PBUF_IP: + /* add room for IP layer header */ + offset += PBUF_IP_HLEN; + /* FALLTHROUGH */ + case PBUF_LINK: + /* add room for link layer header */ + offset += PBUF_LINK_HLEN; + break; + case PBUF_RAW: + break; + default: + LWIP_ASSERT("pbuf_alloc: bad pbuf layer", 0); + return NULL; + } + + switch (type) { + case PBUF_POOL: + /* allocate head of pbuf chain into p */ + p = (struct pbuf *)memp_malloc(MEMP_PBUF_POOL); + LWIP_DEBUGF(PBUF_DEBUG | LWIP_DBG_TRACE, ("pbuf_alloc: allocated pbuf %p\n", (void *)p)); + if (p == NULL) { + PBUF_POOL_IS_EMPTY(); + return NULL; + } + p->type = type; + p->next = NULL; + + /* make the payload pointer point 'offset' bytes into pbuf data memory */ + p->payload = LWIP_MEM_ALIGN((void *)((u8_t *)p + (SIZEOF_STRUCT_PBUF + offset))); + LWIP_ASSERT("pbuf_alloc: pbuf p->payload properly aligned", + ((mem_ptr_t)p->payload % MEM_ALIGNMENT) == 0); + /* the total length of the pbuf chain is the requested size */ + p->tot_len = length; + /* set the length of the first pbuf in the chain */ + p->len = LWIP_MIN(length, PBUF_POOL_BUFSIZE_ALIGNED - LWIP_MEM_ALIGN_SIZE(offset)); + LWIP_ASSERT("check p->payload + p->len does not overflow pbuf", + ((u8_t*)p->payload + p->len <= + (u8_t*)p + SIZEOF_STRUCT_PBUF + PBUF_POOL_BUFSIZE_ALIGNED)); + LWIP_ASSERT("PBUF_POOL_BUFSIZE must be bigger than MEM_ALIGNMENT", + (PBUF_POOL_BUFSIZE_ALIGNED - LWIP_MEM_ALIGN_SIZE(offset)) > 0 ); + /* set reference count (needed here in case we fail) */ + p->ref = 1; + + /* now allocate the tail of the pbuf chain */ + + /* remember first pbuf for linkage in next iteration */ + r = p; + /* remaining length to be allocated */ + rem_len = length - p->len; + /* any remaining pbufs to be allocated? */ + while (rem_len > 0) { + q = (struct pbuf *)memp_malloc(MEMP_PBUF_POOL); + if (q == NULL) { + PBUF_POOL_IS_EMPTY(); + /* free chain so far allocated */ + pbuf_free(p); + /* bail out unsuccesfully */ + return NULL; + } + q->type = type; + q->flags = 0; + q->next = NULL; + /* make previous pbuf point to this pbuf */ + r->next = q; + /* set total length of this pbuf and next in chain */ + LWIP_ASSERT("rem_len < max_u16_t", rem_len < 0xffff); + q->tot_len = (u16_t)rem_len; + /* this pbuf length is pool size, unless smaller sized tail */ + q->len = LWIP_MIN((u16_t)rem_len, PBUF_POOL_BUFSIZE_ALIGNED); + q->payload = (void *)((u8_t *)q + SIZEOF_STRUCT_PBUF); + LWIP_ASSERT("pbuf_alloc: pbuf q->payload properly aligned", + ((mem_ptr_t)q->payload % MEM_ALIGNMENT) == 0); + LWIP_ASSERT("check p->payload + p->len does not overflow pbuf", + ((u8_t*)p->payload + p->len <= + (u8_t*)p + SIZEOF_STRUCT_PBUF + PBUF_POOL_BUFSIZE_ALIGNED)); + q->ref = 1; + /* calculate remaining length to be allocated */ + rem_len -= q->len; + /* remember this pbuf for linkage in next iteration */ + r = q; + } + /* end of chain */ + /*r->next = NULL;*/ + + break; + case PBUF_RAM: + /* If pbuf is to be allocated in RAM, allocate memory for it. */ + p = (struct pbuf*)mem_malloc(LWIP_MEM_ALIGN_SIZE(SIZEOF_STRUCT_PBUF + offset) + LWIP_MEM_ALIGN_SIZE(length)); + if (p == NULL) { + return NULL; + } + /* Set up internal structure of the pbuf. */ + p->payload = LWIP_MEM_ALIGN((void *)((u8_t *)p + SIZEOF_STRUCT_PBUF + offset)); + p->len = p->tot_len = length; + p->next = NULL; + p->type = type; + + LWIP_ASSERT("pbuf_alloc: pbuf->payload properly aligned", + ((mem_ptr_t)p->payload % MEM_ALIGNMENT) == 0); + break; + /* pbuf references existing (non-volatile static constant) ROM payload? */ + case PBUF_ROM: + /* pbuf references existing (externally allocated) RAM payload? */ + case PBUF_REF: + /* only allocate memory for the pbuf structure */ + p = (struct pbuf *)memp_malloc(MEMP_PBUF); + if (p == NULL) { + LWIP_DEBUGF(PBUF_DEBUG | LWIP_DBG_LEVEL_SERIOUS, + ("pbuf_alloc: Could not allocate MEMP_PBUF for PBUF_%s.\n", + (type == PBUF_ROM) ? "ROM" : "REF")); + return NULL; + } + /* caller must set this field properly, afterwards */ + p->payload = NULL; + p->len = p->tot_len = length; + p->next = NULL; + p->type = type; + break; + default: + LWIP_ASSERT("pbuf_alloc: erroneous type", 0); + return NULL; + } + /* set reference count */ + p->ref = 1; + /* set flags */ + p->flags = 0; + LWIP_DEBUGF(PBUF_DEBUG | LWIP_DBG_TRACE, ("pbuf_alloc(length=%"U16_F") == %p\n", length, (void *)p)); + return p; +} + +#if LWIP_SUPPORT_CUSTOM_PBUF +/** Initialize a custom pbuf (already allocated). + * + * @param layer flag to define header size + * @param length size of the pbuf's payload + * @param type type of the pbuf (only used to treat the pbuf accordingly, as + * this function allocates no memory) + * @param p pointer to the custom pbuf to initialize (already allocated) + * @param payload_mem pointer to the buffer that is used for payload and headers, + * must be at least big enough to hold 'length' plus the header size, + * may be NULL if set later + * @param payload_mem_len the size of the 'payload_mem' buffer, must be at least + * big enough to hold 'length' plus the header size + */ +struct pbuf* +pbuf_alloced_custom(pbuf_layer l, u16_t length, pbuf_type type, struct pbuf_custom *p, + void *payload_mem, u16_t payload_mem_len) +{ + u16_t offset; + LWIP_DEBUGF(PBUF_DEBUG | LWIP_DBG_TRACE, ("pbuf_alloced_custom(length=%"U16_F")\n", length)); + + /* determine header offset */ + offset = 0; + switch (l) { + case PBUF_TRANSPORT: + /* add room for transport (often TCP) layer header */ + offset += PBUF_TRANSPORT_HLEN; + /* FALLTHROUGH */ + case PBUF_IP: + /* add room for IP layer header */ + offset += PBUF_IP_HLEN; + /* FALLTHROUGH */ + case PBUF_LINK: + /* add room for link layer header */ + offset += PBUF_LINK_HLEN; + break; + case PBUF_RAW: + break; + default: + LWIP_ASSERT("pbuf_alloced_custom: bad pbuf layer", 0); + return NULL; + } + + if (LWIP_MEM_ALIGN_SIZE(offset) + length < payload_mem_len) { + LWIP_DEBUGF(PBUF_DEBUG | LWIP_DBG_LEVEL_WARNING, ("pbuf_alloced_custom(length=%"U16_F") buffer too short\n", length)); + return NULL; + } + + p->pbuf.next = NULL; + if (payload_mem != NULL) { + p->pbuf.payload = LWIP_MEM_ALIGN((void *)((u8_t *)payload_mem + offset)); + } else { + p->pbuf.payload = NULL; + } + p->pbuf.flags = PBUF_FLAG_IS_CUSTOM; + p->pbuf.len = p->pbuf.tot_len = length; + p->pbuf.type = type; + p->pbuf.ref = 1; + return &p->pbuf; +} +#endif /* LWIP_SUPPORT_CUSTOM_PBUF */ + +/** + * Shrink a pbuf chain to a desired length. + * + * @param p pbuf to shrink. + * @param new_len desired new length of pbuf chain + * + * Depending on the desired length, the first few pbufs in a chain might + * be skipped and left unchanged. The new last pbuf in the chain will be + * resized, and any remaining pbufs will be freed. + * + * @note If the pbuf is ROM/REF, only the ->tot_len and ->len fields are adjusted. + * @note May not be called on a packet queue. + * + * @note Despite its name, pbuf_realloc cannot grow the size of a pbuf (chain). + */ +void +pbuf_realloc(struct pbuf *p, u16_t new_len) +{ + struct pbuf *q; + u16_t rem_len; /* remaining length */ + s32_t grow; + + LWIP_ASSERT("pbuf_realloc: p != NULL", p != NULL); + LWIP_ASSERT("pbuf_realloc: sane p->type", p->type == PBUF_POOL || + p->type == PBUF_ROM || + p->type == PBUF_RAM || + p->type == PBUF_REF); + + /* desired length larger than current length? */ + if (new_len >= p->tot_len) { + /* enlarging not yet supported */ + return; + } + + /* the pbuf chain grows by (new_len - p->tot_len) bytes + * (which may be negative in case of shrinking) */ + grow = new_len - p->tot_len; + + /* first, step over any pbufs that should remain in the chain */ + rem_len = new_len; + q = p; + /* should this pbuf be kept? */ + while (rem_len > q->len) { + /* decrease remaining length by pbuf length */ + rem_len -= q->len; + /* decrease total length indicator */ + LWIP_ASSERT("grow < max_u16_t", grow < 0xffff); + q->tot_len += (u16_t)grow; + /* proceed to next pbuf in chain */ + q = q->next; + LWIP_ASSERT("pbuf_realloc: q != NULL", q != NULL); + } + /* we have now reached the new last pbuf (in q) */ + /* rem_len == desired length for pbuf q */ + + /* shrink allocated memory for PBUF_RAM */ + /* (other types merely adjust their length fields */ + if ((q->type == PBUF_RAM) && (rem_len != q->len)) { + /* reallocate and adjust the length of the pbuf that will be split */ + q = (struct pbuf *)mem_trim(q, (u16_t)((u8_t *)q->payload - (u8_t *)q) + rem_len); + LWIP_ASSERT("mem_trim returned q == NULL", q != NULL); + } + /* adjust length fields for new last pbuf */ + q->len = rem_len; + q->tot_len = q->len; + + /* any remaining pbufs in chain? */ + if (q->next != NULL) { + /* free remaining pbufs in chain */ + pbuf_free(q->next); + } + /* q is last packet in chain */ + q->next = NULL; + +} + +/** + * Adjusts the payload pointer to hide or reveal headers in the payload. + * + * Adjusts the ->payload pointer so that space for a header + * (dis)appears in the pbuf payload. + * + * The ->payload, ->tot_len and ->len fields are adjusted. + * + * @param p pbuf to change the header size. + * @param header_size_increment Number of bytes to increment header size which + * increases the size of the pbuf. New space is on the front. + * (Using a negative value decreases the header size.) + * If hdr_size_inc is 0, this function does nothing and returns succesful. + * + * PBUF_ROM and PBUF_REF type buffers cannot have their sizes increased, so + * the call will fail. A check is made that the increase in header size does + * not move the payload pointer in front of the start of the buffer. + * @return non-zero on failure, zero on success. + * + */ +u8_t +pbuf_header(struct pbuf *p, s16_t header_size_increment) +{ + u16_t type; + void *payload; + u16_t increment_magnitude; + + LWIP_ASSERT("p != NULL", p != NULL); + if ((header_size_increment == 0) || (p == NULL)) { + return 0; + } + + if (header_size_increment < 0){ + increment_magnitude = -header_size_increment; + /* Check that we aren't going to move off the end of the pbuf */ + LWIP_ERROR("increment_magnitude <= p->len", (increment_magnitude <= p->len), return 1;); + } else { + increment_magnitude = header_size_increment; +#if 0 + /* Can't assert these as some callers speculatively call + pbuf_header() to see if it's OK. Will return 1 below instead. */ + /* Check that we've got the correct type of pbuf to work with */ + LWIP_ASSERT("p->type == PBUF_RAM || p->type == PBUF_POOL", + p->type == PBUF_RAM || p->type == PBUF_POOL); + /* Check that we aren't going to move off the beginning of the pbuf */ + LWIP_ASSERT("p->payload - increment_magnitude >= p + SIZEOF_STRUCT_PBUF", + (u8_t *)p->payload - increment_magnitude >= (u8_t *)p + SIZEOF_STRUCT_PBUF); +#endif + } + + type = p->type; + /* remember current payload pointer */ + payload = p->payload; + + /* pbuf types containing payloads? */ + if (type == PBUF_RAM || type == PBUF_POOL) { + /* set new payload pointer */ + p->payload = (u8_t *)p->payload - header_size_increment; + /* boundary check fails? */ + if ((u8_t *)p->payload < (u8_t *)p + SIZEOF_STRUCT_PBUF) { + LWIP_DEBUGF( PBUF_DEBUG | LWIP_DBG_LEVEL_SERIOUS, + ("pbuf_header: failed as %p < %p (not enough space for new header size)\n", + (void *)p->payload, (void *)(p + 1))); + /* restore old payload pointer */ + p->payload = payload; + /* bail out unsuccesfully */ + return 1; + } + /* pbuf types refering to external payloads? */ + } else if (type == PBUF_REF || type == PBUF_ROM) { + /* hide a header in the payload? */ + if ((header_size_increment < 0) && (increment_magnitude <= p->len)) { + /* increase payload pointer */ + p->payload = (u8_t *)p->payload - header_size_increment; + } else { + /* cannot expand payload to front (yet!) + * bail out unsuccesfully */ + return 1; + } + } else { + /* Unknown type */ + LWIP_ASSERT("bad pbuf type", 0); + return 1; + } + /* modify pbuf length fields */ + p->len += header_size_increment; + p->tot_len += header_size_increment; + + LWIP_DEBUGF(PBUF_DEBUG | LWIP_DBG_TRACE, ("pbuf_header: old %p new %p (%"S16_F")\n", + (void *)payload, (void *)p->payload, header_size_increment)); + + return 0; +} + +/** + * Dereference a pbuf chain or queue and deallocate any no-longer-used + * pbufs at the head of this chain or queue. + * + * Decrements the pbuf reference count. If it reaches zero, the pbuf is + * deallocated. + * + * For a pbuf chain, this is repeated for each pbuf in the chain, + * up to the first pbuf which has a non-zero reference count after + * decrementing. So, when all reference counts are one, the whole + * chain is free'd. + * + * @param p The pbuf (chain) to be dereferenced. + * + * @return the number of pbufs that were de-allocated + * from the head of the chain. + * + * @note MUST NOT be called on a packet queue (Not verified to work yet). + * @note the reference counter of a pbuf equals the number of pointers + * that refer to the pbuf (or into the pbuf). + * + * @internal examples: + * + * Assuming existing chains a->b->c with the following reference + * counts, calling pbuf_free(a) results in: + * + * 1->2->3 becomes ...1->3 + * 3->3->3 becomes 2->3->3 + * 1->1->2 becomes ......1 + * 2->1->1 becomes 1->1->1 + * 1->1->1 becomes ....... + * + */ +u8_t +pbuf_free(struct pbuf *p) +{ + u16_t type; + struct pbuf *q; + u8_t count; + + if (p == NULL) { + LWIP_ASSERT("p != NULL", p != NULL); + /* if assertions are disabled, proceed with debug output */ + LWIP_DEBUGF(PBUF_DEBUG | LWIP_DBG_LEVEL_SERIOUS, + ("pbuf_free(p == NULL) was called.\n")); + return 0; + } + LWIP_DEBUGF(PBUF_DEBUG | LWIP_DBG_TRACE, ("pbuf_free(%p)\n", (void *)p)); + + PERF_START; + + LWIP_ASSERT("pbuf_free: sane type", + p->type == PBUF_RAM || p->type == PBUF_ROM || + p->type == PBUF_REF || p->type == PBUF_POOL); + + count = 0; + /* de-allocate all consecutive pbufs from the head of the chain that + * obtain a zero reference count after decrementing*/ + while (p != NULL) { + u16_t ref; + SYS_ARCH_DECL_PROTECT(old_level); + /* Since decrementing ref cannot be guaranteed to be a single machine operation + * we must protect it. We put the new ref into a local variable to prevent + * further protection. */ + SYS_ARCH_PROTECT(old_level); + /* all pbufs in a chain are referenced at least once */ + LWIP_ASSERT("pbuf_free: p->ref > 0", p->ref > 0); + /* decrease reference count (number of pointers to pbuf) */ + ref = --(p->ref); + SYS_ARCH_UNPROTECT(old_level); + /* this pbuf is no longer referenced to? */ + if (ref == 0) { + /* remember next pbuf in chain for next iteration */ + q = p->next; + LWIP_DEBUGF( PBUF_DEBUG | LWIP_DBG_TRACE, ("pbuf_free: deallocating %p\n", (void *)p)); + type = p->type; +#if LWIP_SUPPORT_CUSTOM_PBUF + /* is this a custom pbuf? */ + if ((p->flags & PBUF_FLAG_IS_CUSTOM) != 0) { + struct pbuf_custom *pc = (struct pbuf_custom*)p; + LWIP_ASSERT("pc->custom_free_function != NULL", pc->custom_free_function != NULL); + pc->custom_free_function(p); + } else +#endif /* LWIP_SUPPORT_CUSTOM_PBUF */ + { + /* is this a pbuf from the pool? */ + if (type == PBUF_POOL) { + memp_free(MEMP_PBUF_POOL, p); + /* is this a ROM or RAM referencing pbuf? */ + } else if (type == PBUF_ROM || type == PBUF_REF) { + memp_free(MEMP_PBUF, p); + /* type == PBUF_RAM */ + } else { + mem_free(p); + } + } + count++; + /* proceed to next pbuf */ + p = q; + /* p->ref > 0, this pbuf is still referenced to */ + /* (and so the remaining pbufs in chain as well) */ + } else { + LWIP_DEBUGF( PBUF_DEBUG | LWIP_DBG_TRACE, ("pbuf_free: %p has ref %"U16_F", ending here.\n", (void *)p, ref)); + /* stop walking through the chain */ + p = NULL; + } + } + PERF_STOP("pbuf_free"); + /* return number of de-allocated pbufs */ + return count; +} + +/** + * Count number of pbufs in a chain + * + * @param p first pbuf of chain + * @return the number of pbufs in a chain + */ + +u8_t +pbuf_clen(struct pbuf *p) +{ + u8_t len; + + len = 0; + while (p != NULL) { + ++len; + p = p->next; + } + return len; +} + +/** + * Increment the reference count of the pbuf. + * + * @param p pbuf to increase reference counter of + * + */ +void +pbuf_ref(struct pbuf *p) +{ + SYS_ARCH_DECL_PROTECT(old_level); + /* pbuf given? */ + if (p != NULL) { + SYS_ARCH_PROTECT(old_level); + ++(p->ref); + SYS_ARCH_UNPROTECT(old_level); + } +} + +/** + * Concatenate two pbufs (each may be a pbuf chain) and take over + * the caller's reference of the tail pbuf. + * + * @note The caller MAY NOT reference the tail pbuf afterwards. + * Use pbuf_chain() for that purpose. + * + * @see pbuf_chain() + */ + +void +pbuf_cat(struct pbuf *h, struct pbuf *t) +{ + struct pbuf *p; + + LWIP_ERROR("(h != NULL) && (t != NULL) (programmer violates API)", + ((h != NULL) && (t != NULL)), return;); + + /* proceed to last pbuf of chain */ + for (p = h; p->next != NULL; p = p->next) { + /* add total length of second chain to all totals of first chain */ + p->tot_len += t->tot_len; + } + /* { p is last pbuf of first h chain, p->next == NULL } */ + LWIP_ASSERT("p->tot_len == p->len (of last pbuf in chain)", p->tot_len == p->len); + LWIP_ASSERT("p->next == NULL", p->next == NULL); + /* add total length of second chain to last pbuf total of first chain */ + p->tot_len += t->tot_len; + /* chain last pbuf of head (p) with first of tail (t) */ + p->next = t; + /* p->next now references t, but the caller will drop its reference to t, + * so netto there is no change to the reference count of t. + */ +} + +/** + * Chain two pbufs (or pbuf chains) together. + * + * The caller MUST call pbuf_free(t) once it has stopped + * using it. Use pbuf_cat() instead if you no longer use t. + * + * @param h head pbuf (chain) + * @param t tail pbuf (chain) + * @note The pbufs MUST belong to the same packet. + * @note MAY NOT be called on a packet queue. + * + * The ->tot_len fields of all pbufs of the head chain are adjusted. + * The ->next field of the last pbuf of the head chain is adjusted. + * The ->ref field of the first pbuf of the tail chain is adjusted. + * + */ +void +pbuf_chain(struct pbuf *h, struct pbuf *t) +{ + pbuf_cat(h, t); + /* t is now referenced by h */ + pbuf_ref(t); + LWIP_DEBUGF(PBUF_DEBUG | LWIP_DBG_TRACE, ("pbuf_chain: %p references %p\n", (void *)h, (void *)t)); +} + +/** + * Dechains the first pbuf from its succeeding pbufs in the chain. + * + * Makes p->tot_len field equal to p->len. + * @param p pbuf to dechain + * @return remainder of the pbuf chain, or NULL if it was de-allocated. + * @note May not be called on a packet queue. + */ +struct pbuf * +pbuf_dechain(struct pbuf *p) +{ + struct pbuf *q; + u8_t tail_gone = 1; + /* tail */ + q = p->next; + /* pbuf has successor in chain? */ + if (q != NULL) { + /* assert tot_len invariant: (p->tot_len == p->len + (p->next? p->next->tot_len: 0) */ + LWIP_ASSERT("p->tot_len == p->len + q->tot_len", q->tot_len == p->tot_len - p->len); + /* enforce invariant if assertion is disabled */ + q->tot_len = p->tot_len - p->len; + /* decouple pbuf from remainder */ + p->next = NULL; + /* total length of pbuf p is its own length only */ + p->tot_len = p->len; + /* q is no longer referenced by p, free it */ + LWIP_DEBUGF(PBUF_DEBUG | LWIP_DBG_TRACE, ("pbuf_dechain: unreferencing %p\n", (void *)q)); + tail_gone = pbuf_free(q); + if (tail_gone > 0) { + LWIP_DEBUGF(PBUF_DEBUG | LWIP_DBG_TRACE, + ("pbuf_dechain: deallocated %p (as it is no longer referenced)\n", (void *)q)); + } + /* return remaining tail or NULL if deallocated */ + } + /* assert tot_len invariant: (p->tot_len == p->len + (p->next? p->next->tot_len: 0) */ + LWIP_ASSERT("p->tot_len == p->len", p->tot_len == p->len); + return ((tail_gone > 0) ? NULL : q); +} + +/** + * + * Create PBUF_RAM copies of pbufs. + * + * Used to queue packets on behalf of the lwIP stack, such as + * ARP based queueing. + * + * @note You MUST explicitly use p = pbuf_take(p); + * + * @note Only one packet is copied, no packet queue! + * + * @param p_to pbuf destination of the copy + * @param p_from pbuf source of the copy + * + * @return ERR_OK if pbuf was copied + * ERR_ARG if one of the pbufs is NULL or p_to is not big + * enough to hold p_from + */ +err_t +pbuf_copy(struct pbuf *p_to, struct pbuf *p_from) +{ + u16_t offset_to=0, offset_from=0, len; + + LWIP_DEBUGF(PBUF_DEBUG | LWIP_DBG_TRACE, ("pbuf_copy(%p, %p)\n", + (void*)p_to, (void*)p_from)); + + /* is the target big enough to hold the source? */ + LWIP_ERROR("pbuf_copy: target not big enough to hold source", ((p_to != NULL) && + (p_from != NULL) && (p_to->tot_len >= p_from->tot_len)), return ERR_ARG;); + + /* iterate through pbuf chain */ + do + { + LWIP_ASSERT("p_to != NULL", p_to != NULL); + /* copy one part of the original chain */ + if ((p_to->len - offset_to) >= (p_from->len - offset_from)) { + /* complete current p_from fits into current p_to */ + len = p_from->len - offset_from; + } else { + /* current p_from does not fit into current p_to */ + len = p_to->len - offset_to; + } + MEMCPY((u8_t*)p_to->payload + offset_to, (u8_t*)p_from->payload + offset_from, len); + offset_to += len; + offset_from += len; + LWIP_ASSERT("offset_to <= p_to->len", offset_to <= p_to->len); + if (offset_to == p_to->len) { + /* on to next p_to (if any) */ + offset_to = 0; + p_to = p_to->next; + } + LWIP_ASSERT("offset_from <= p_from->len", offset_from <= p_from->len); + if (offset_from >= p_from->len) { + /* on to next p_from (if any) */ + offset_from = 0; + p_from = p_from->next; + } + + if((p_from != NULL) && (p_from->len == p_from->tot_len)) { + /* don't copy more than one packet! */ + LWIP_ERROR("pbuf_copy() does not allow packet queues!\n", + (p_from->next == NULL), return ERR_VAL;); + } + if((p_to != NULL) && (p_to->len == p_to->tot_len)) { + /* don't copy more than one packet! */ + LWIP_ERROR("pbuf_copy() does not allow packet queues!\n", + (p_to->next == NULL), return ERR_VAL;); + } + } while (p_from); + LWIP_DEBUGF(PBUF_DEBUG | LWIP_DBG_TRACE, ("pbuf_copy: end of chain reached.\n")); + return ERR_OK; +} + +/** + * Copy (part of) the contents of a packet buffer + * to an application supplied buffer. + * + * @param buf the pbuf from which to copy data + * @param dataptr the application supplied buffer + * @param len length of data to copy (dataptr must be big enough). No more + * than buf->tot_len will be copied, irrespective of len + * @param offset offset into the packet buffer from where to begin copying len bytes + * @return the number of bytes copied, or 0 on failure + */ +u16_t +pbuf_copy_partial(struct pbuf *buf, void *dataptr, u16_t len, u16_t offset) +{ + struct pbuf *p; + u16_t left; + u16_t buf_copy_len; + u16_t copied_total = 0; + + LWIP_ERROR("pbuf_copy_partial: invalid buf", (buf != NULL), return 0;); + LWIP_ERROR("pbuf_copy_partial: invalid dataptr", (dataptr != NULL), return 0;); + + left = 0; + + if((buf == NULL) || (dataptr == NULL)) { + return 0; + } + + /* Note some systems use byte copy if dataptr or one of the pbuf payload pointers are unaligned. */ + for(p = buf; len != 0 && p != NULL; p = p->next) { + if ((offset != 0) && (offset >= p->len)) { + /* don't copy from this buffer -> on to the next */ + offset -= p->len; + } else { + /* copy from this buffer. maybe only partially. */ + buf_copy_len = p->len - offset; + if (buf_copy_len > len) + buf_copy_len = len; + /* copy the necessary parts of the buffer */ + MEMCPY(&((char*)dataptr)[left], &((char*)p->payload)[offset], buf_copy_len); + copied_total += buf_copy_len; + left += buf_copy_len; + len -= buf_copy_len; + offset = 0; + } + } + return copied_total; +} + +/** + * Copy application supplied data into a pbuf. + * This function can only be used to copy the equivalent of buf->tot_len data. + * + * @param buf pbuf to fill with data + * @param dataptr application supplied data buffer + * @param len length of the application supplied data buffer + * + * @return ERR_OK if successful, ERR_MEM if the pbuf is not big enough + */ +err_t +pbuf_take(struct pbuf *buf, const void *dataptr, u16_t len) +{ + struct pbuf *p; + u16_t buf_copy_len; + u16_t total_copy_len = len; + u16_t copied_total = 0; + + LWIP_ERROR("pbuf_take: invalid buf", (buf != NULL), return 0;); + LWIP_ERROR("pbuf_take: invalid dataptr", (dataptr != NULL), return 0;); + + if ((buf == NULL) || (dataptr == NULL) || (buf->tot_len < len)) { + return ERR_ARG; + } + + /* Note some systems use byte copy if dataptr or one of the pbuf payload pointers are unaligned. */ + for(p = buf; total_copy_len != 0; p = p->next) { + LWIP_ASSERT("pbuf_take: invalid pbuf", p != NULL); + buf_copy_len = total_copy_len; + if (buf_copy_len > p->len) { + /* this pbuf cannot hold all remaining data */ + buf_copy_len = p->len; + } + /* copy the necessary parts of the buffer */ + MEMCPY(p->payload, &((char*)dataptr)[copied_total], buf_copy_len); + total_copy_len -= buf_copy_len; + copied_total += buf_copy_len; + } + LWIP_ASSERT("did not copy all data", total_copy_len == 0 && copied_total == len); + return ERR_OK; +} + +/** + * Creates a single pbuf out of a queue of pbufs. + * + * @remark: Either the source pbuf 'p' is freed by this function or the original + * pbuf 'p' is returned, therefore the caller has to check the result! + * + * @param p the source pbuf + * @param layer pbuf_layer of the new pbuf + * + * @return a new, single pbuf (p->next is NULL) + * or the old pbuf if allocation fails + */ +struct pbuf* +pbuf_coalesce(struct pbuf *p, pbuf_layer layer) +{ + struct pbuf *q; + err_t err; + if (p->next == NULL) { + return p; + } + q = pbuf_alloc(layer, p->tot_len, PBUF_RAM); + if (q == NULL) { + /* @todo: what do we do now? */ + return p; + } + err = pbuf_copy(q, p); + LWIP_ASSERT("pbuf_copy failed", err == ERR_OK); + pbuf_free(p); + return q; +} + +#if LWIP_CHECKSUM_ON_COPY +/** + * Copies data into a single pbuf (*not* into a pbuf queue!) and updates + * the checksum while copying + * + * @param p the pbuf to copy data into + * @param start_offset offset of p->payload where to copy the data to + * @param dataptr data to copy into the pbuf + * @param len length of data to copy into the pbuf + * @param chksum pointer to the checksum which is updated + * @return ERR_OK if successful, another error if the data does not fit + * within the (first) pbuf (no pbuf queues!) + */ +err_t +pbuf_fill_chksum(struct pbuf *p, u16_t start_offset, const void *dataptr, + u16_t len, u16_t *chksum) +{ + u32_t acc; + u16_t copy_chksum; + char *dst_ptr; + LWIP_ASSERT("p != NULL", p != NULL); + LWIP_ASSERT("dataptr != NULL", dataptr != NULL); + LWIP_ASSERT("chksum != NULL", chksum != NULL); + LWIP_ASSERT("len != 0", len != 0); + + if ((start_offset >= p->len) || (start_offset + len > p->len)) { + return ERR_ARG; + } + + dst_ptr = ((char*)p->payload) + start_offset; + copy_chksum = LWIP_CHKSUM_COPY(dst_ptr, dataptr, len); + if ((start_offset & 1) != 0) { + copy_chksum = SWAP_BYTES_IN_WORD(copy_chksum); + } + acc = *chksum; + acc += copy_chksum; + *chksum = FOLD_U32T(acc); + return ERR_OK; +} +#endif /* LWIP_CHECKSUM_ON_COPY */ + + /** Get one byte from the specified position in a pbuf + * WARNING: returns zero for offset >= p->tot_len + * + * @param p pbuf to parse + * @param offset offset into p of the byte to return + * @return byte at an offset into p OR ZERO IF 'offset' >= p->tot_len + */ +u8_t +pbuf_get_at(struct pbuf* p, u16_t offset) +{ + u16_t copy_from = offset; + struct pbuf* q = p; + + /* get the correct pbuf */ + while ((q != NULL) && (q->len <= copy_from)) { + copy_from -= q->len; + q = q->next; + } + /* return requested data if pbuf is OK */ + if ((q != NULL) && (q->len > copy_from)) { + return ((u8_t*)q->payload)[copy_from]; + } + return 0; +} + +/** Compare pbuf contents at specified offset with memory s2, both of length n + * + * @param p pbuf to compare + * @param offset offset into p at wich to start comparing + * @param s2 buffer to compare + * @param n length of buffer to compare + * @return zero if equal, nonzero otherwise + * (0xffff if p is too short, diffoffset+1 otherwise) + */ +u16_t +pbuf_memcmp(struct pbuf* p, u16_t offset, const void* s2, u16_t n) +{ + u16_t start = offset; + struct pbuf* q = p; + + /* get the correct pbuf */ + while ((q != NULL) && (q->len <= start)) { + start -= q->len; + q = q->next; + } + /* return requested data if pbuf is OK */ + if ((q != NULL) && (q->len > start)) { + u16_t i; + for(i = 0; i < n; i++) { + u8_t a = pbuf_get_at(q, start + i); + u8_t b = ((u8_t*)s2)[i]; + if (a != b) { + return i+1; + } + } + return 0; + } + return 0xffff; +} + +/** Find occurrence of mem (with length mem_len) in pbuf p, starting at offset + * start_offset. + * + * @param p pbuf to search, maximum length is 0xFFFE since 0xFFFF is used as + * return value 'not found' + * @param mem search for the contents of this buffer + * @param mem_len length of 'mem' + * @param start_offset offset into p at which to start searching + * @return 0xFFFF if substr was not found in p or the index where it was found + */ +u16_t +pbuf_memfind(struct pbuf* p, const void* mem, u16_t mem_len, u16_t start_offset) +{ + u16_t i; + u16_t max = p->tot_len - mem_len; + if (p->tot_len >= mem_len + start_offset) { + for(i = start_offset; i <= max; ) { + u16_t plus = pbuf_memcmp(p, i, mem, mem_len); + if (plus == 0) { + return i; + } else { + i += plus; + } + } + } + return 0xFFFF; +} + +/** Find occurrence of substr with length substr_len in pbuf p, start at offset + * start_offset + * WARNING: in contrast to strstr(), this one does not stop at the first \0 in + * the pbuf/source string! + * + * @param p pbuf to search, maximum length is 0xFFFE since 0xFFFF is used as + * return value 'not found' + * @param substr string to search for in p, maximum length is 0xFFFE + * @return 0xFFFF if substr was not found in p or the index where it was found + */ +u16_t +pbuf_strstr(struct pbuf* p, const char* substr) +{ + size_t substr_len; + if ((substr == NULL) || (substr[0] == 0) || (p->tot_len == 0xFFFF)) { + return 0xFFFF; + } + substr_len = strlen(substr); + if (substr_len >= 0xFFFF) { + return 0xFFFF; + } + return pbuf_memfind(p, substr, (u16_t)substr_len, 0); +} diff --git a/lib/drivers/lwip/src/core/raw.c b/lib/drivers/lwip/src/core/raw.c new file mode 100644 index 00000000000..9fcb100316d --- /dev/null +++ b/lib/drivers/lwip/src/core/raw.c @@ -0,0 +1,354 @@ +/** + * @file + * Implementation of raw protocol PCBs for low-level handling of + * different types of protocols besides (or overriding) those + * already available in lwIP. + * + */ + +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ + +#include "lwip/opt.h" + +#if LWIP_RAW /* don't build if not configured for use in lwipopts.h */ + +#include "lwip/def.h" +#include "lwip/memp.h" +#include "lwip/ip_addr.h" +#include "lwip/netif.h" +#include "lwip/raw.h" +#include "lwip/stats.h" +#include "arch/perf.h" + +#include + +/** The list of RAW PCBs */ +static struct raw_pcb *raw_pcbs; + +/** + * Determine if in incoming IP packet is covered by a RAW PCB + * and if so, pass it to a user-provided receive callback function. + * + * Given an incoming IP datagram (as a chain of pbufs) this function + * finds a corresponding RAW PCB and calls the corresponding receive + * callback function. + * + * @param p pbuf to be demultiplexed to a RAW PCB. + * @param inp network interface on which the datagram was received. + * @return - 1 if the packet has been eaten by a RAW PCB receive + * callback function. The caller MAY NOT not reference the + * packet any longer, and MAY NOT call pbuf_free(). + * @return - 0 if packet is not eaten (pbuf is still referenced by the + * caller). + * + */ +u8_t +raw_input(struct pbuf *p, struct netif *inp) +{ + struct raw_pcb *pcb, *prev; + struct ip_hdr *iphdr; + s16_t proto; + u8_t eaten = 0; + + LWIP_UNUSED_ARG(inp); + + iphdr = (struct ip_hdr *)p->payload; + proto = IPH_PROTO(iphdr); + + prev = NULL; + pcb = raw_pcbs; + /* loop through all raw pcbs until the packet is eaten by one */ + /* this allows multiple pcbs to match against the packet by design */ + while ((eaten == 0) && (pcb != NULL)) { + if ((pcb->protocol == proto) && + (ip_addr_isany(&pcb->local_ip) || + ip_addr_cmp(&(pcb->local_ip), ¤t_iphdr_dest))) { +#if IP_SOF_BROADCAST_RECV + /* broadcast filter? */ + if ((pcb->so_options & SOF_BROADCAST) || !ip_addr_isbroadcast(¤t_iphdr_dest, inp)) +#endif /* IP_SOF_BROADCAST_RECV */ + { + /* receive callback function available? */ + if (pcb->recv != NULL) { + /* the receive callback function did not eat the packet? */ + if (pcb->recv(pcb->recv_arg, pcb, p, ip_current_src_addr()) != 0) { + /* receive function ate the packet */ + p = NULL; + eaten = 1; + if (prev != NULL) { + /* move the pcb to the front of raw_pcbs so that is + found faster next time */ + prev->next = pcb->next; + pcb->next = raw_pcbs; + raw_pcbs = pcb; + } + } + } + /* no receive callback function was set for this raw PCB */ + } + /* drop the packet */ + } + prev = pcb; + pcb = pcb->next; + } + return eaten; +} + +/** + * Bind a RAW PCB. + * + * @param pcb RAW PCB to be bound with a local address ipaddr. + * @param ipaddr local IP address to bind with. Use IP_ADDR_ANY to + * bind to all local interfaces. + * + * @return lwIP error code. + * - ERR_OK. Successful. No error occured. + * - ERR_USE. The specified IP address is already bound to by + * another RAW PCB. + * + * @see raw_disconnect() + */ +err_t +raw_bind(struct raw_pcb *pcb, ip_addr_t *ipaddr) +{ + ip_addr_set(&pcb->local_ip, ipaddr); + return ERR_OK; +} + +/** + * Connect an RAW PCB. This function is required by upper layers + * of lwip. Using the raw api you could use raw_sendto() instead + * + * This will associate the RAW PCB with the remote address. + * + * @param pcb RAW PCB to be connected with remote address ipaddr and port. + * @param ipaddr remote IP address to connect with. + * + * @return lwIP error code + * + * @see raw_disconnect() and raw_sendto() + */ +err_t +raw_connect(struct raw_pcb *pcb, ip_addr_t *ipaddr) +{ + ip_addr_set(&pcb->remote_ip, ipaddr); + return ERR_OK; +} + + +/** + * Set the callback function for received packets that match the + * raw PCB's protocol and binding. + * + * The callback function MUST either + * - eat the packet by calling pbuf_free() and returning non-zero. The + * packet will not be passed to other raw PCBs or other protocol layers. + * - not free the packet, and return zero. The packet will be matched + * against further PCBs and/or forwarded to another protocol layers. + * + * @return non-zero if the packet was free()d, zero if the packet remains + * available for others. + */ +void +raw_recv(struct raw_pcb *pcb, raw_recv_fn recv, void *recv_arg) +{ + /* remember recv() callback and user data */ + pcb->recv = recv; + pcb->recv_arg = recv_arg; +} + +/** + * Send the raw IP packet to the given address. Note that actually you cannot + * modify the IP headers (this is inconsistent with the receive callback where + * you actually get the IP headers), you can only specify the IP payload here. + * It requires some more changes in lwIP. (there will be a raw_send() function + * then.) + * + * @param pcb the raw pcb which to send + * @param p the IP payload to send + * @param ipaddr the destination address of the IP packet + * + */ +err_t +raw_sendto(struct raw_pcb *pcb, struct pbuf *p, ip_addr_t *ipaddr) +{ + err_t err; + struct netif *netif; + ip_addr_t *src_ip; + struct pbuf *q; /* q will be sent down the stack */ + + LWIP_DEBUGF(RAW_DEBUG | LWIP_DBG_TRACE, ("raw_sendto\n")); + + /* not enough space to add an IP header to first pbuf in given p chain? */ + if (pbuf_header(p, IP_HLEN)) { + /* allocate header in new pbuf */ + q = pbuf_alloc(PBUF_IP, 0, PBUF_RAM); + /* new header pbuf could not be allocated? */ + if (q == NULL) { + LWIP_DEBUGF(RAW_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_LEVEL_SERIOUS, ("raw_sendto: could not allocate header\n")); + return ERR_MEM; + } + if (p->tot_len != 0) { + /* chain header q in front of given pbuf p */ + pbuf_chain(q, p); + } + /* { first pbuf q points to header pbuf } */ + LWIP_DEBUGF(RAW_DEBUG, ("raw_sendto: added header pbuf %p before given pbuf %p\n", (void *)q, (void *)p)); + } else { + /* first pbuf q equals given pbuf */ + q = p; + if(pbuf_header(q, -IP_HLEN)) { + LWIP_ASSERT("Can't restore header we just removed!", 0); + return ERR_MEM; + } + } + + if ((netif = ip_route(ipaddr)) == NULL) { + LWIP_DEBUGF(RAW_DEBUG | LWIP_DBG_LEVEL_WARNING, ("raw_sendto: No route to %"U16_F".%"U16_F".%"U16_F".%"U16_F"\n", + ip4_addr1_16(ipaddr), ip4_addr2_16(ipaddr), ip4_addr3_16(ipaddr), ip4_addr4_16(ipaddr))); + /* free any temporary header pbuf allocated by pbuf_header() */ + if (q != p) { + pbuf_free(q); + } + return ERR_RTE; + } + +#if IP_SOF_BROADCAST + /* broadcast filter? */ + if (((pcb->so_options & SOF_BROADCAST) == 0) && ip_addr_isbroadcast(ipaddr, netif)) { + LWIP_DEBUGF(RAW_DEBUG | LWIP_DBG_LEVEL_WARNING, ("raw_sendto: SOF_BROADCAST not enabled on pcb %p\n", (void *)pcb)); + /* free any temporary header pbuf allocated by pbuf_header() */ + if (q != p) { + pbuf_free(q); + } + return ERR_VAL; + } +#endif /* IP_SOF_BROADCAST */ + + if (ip_addr_isany(&pcb->local_ip)) { + /* use outgoing network interface IP address as source address */ + src_ip = &(netif->ip_addr); + } else { + /* use RAW PCB local IP address as source address */ + src_ip = &(pcb->local_ip); + } + +#if LWIP_NETIF_HWADDRHINT + netif->addr_hint = &(pcb->addr_hint); +#endif /* LWIP_NETIF_HWADDRHINT*/ + err = ip_output_if (q, src_ip, ipaddr, pcb->ttl, pcb->tos, pcb->protocol, netif); +#if LWIP_NETIF_HWADDRHINT + netif->addr_hint = NULL; +#endif /* LWIP_NETIF_HWADDRHINT*/ + + /* did we chain a header earlier? */ + if (q != p) { + /* free the header */ + pbuf_free(q); + } + return err; +} + +/** + * Send the raw IP packet to the address given by raw_connect() + * + * @param pcb the raw pcb which to send + * @param p the IP payload to send + * + */ +err_t +raw_send(struct raw_pcb *pcb, struct pbuf *p) +{ + return raw_sendto(pcb, p, &pcb->remote_ip); +} + +/** + * Remove an RAW PCB. + * + * @param pcb RAW PCB to be removed. The PCB is removed from the list of + * RAW PCB's and the data structure is freed from memory. + * + * @see raw_new() + */ +void +raw_remove(struct raw_pcb *pcb) +{ + struct raw_pcb *pcb2; + /* pcb to be removed is first in list? */ + if (raw_pcbs == pcb) { + /* make list start at 2nd pcb */ + raw_pcbs = raw_pcbs->next; + /* pcb not 1st in list */ + } else { + for(pcb2 = raw_pcbs; pcb2 != NULL; pcb2 = pcb2->next) { + /* find pcb in raw_pcbs list */ + if (pcb2->next != NULL && pcb2->next == pcb) { + /* remove pcb from list */ + pcb2->next = pcb->next; + } + } + } + memp_free(MEMP_RAW_PCB, pcb); +} + +/** + * Create a RAW PCB. + * + * @return The RAW PCB which was created. NULL if the PCB data structure + * could not be allocated. + * + * @param proto the protocol number of the IPs payload (e.g. IP_PROTO_ICMP) + * + * @see raw_remove() + */ +struct raw_pcb * +raw_new(u8_t proto) +{ + struct raw_pcb *pcb; + + LWIP_DEBUGF(RAW_DEBUG | LWIP_DBG_TRACE, ("raw_new\n")); + + pcb = (struct raw_pcb *)memp_malloc(MEMP_RAW_PCB); + /* could allocate RAW PCB? */ + if (pcb != NULL) { + /* initialize PCB to all zeroes */ + memset(pcb, 0, sizeof(struct raw_pcb)); + pcb->protocol = proto; + pcb->ttl = RAW_TTL; + pcb->next = raw_pcbs; + raw_pcbs = pcb; + } + return pcb; +} + +#endif /* LWIP_RAW */ diff --git a/lib/drivers/lwip/src/core/snmp/asn1_dec.c b/lib/drivers/lwip/src/core/snmp/asn1_dec.c new file mode 100644 index 00000000000..1d5658207a1 --- /dev/null +++ b/lib/drivers/lwip/src/core/snmp/asn1_dec.c @@ -0,0 +1,657 @@ +/** + * @file + * Abstract Syntax Notation One (ISO 8824, 8825) decoding + * + * @todo not optimised (yet), favor correctness over speed, favor speed over size + */ + +/* + * Copyright (c) 2006 Axon Digital Design B.V., The Netherlands. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * Author: Christiaan Simons + */ + +#include "lwip/opt.h" + +#if LWIP_SNMP /* don't build if not configured for use in lwipopts.h */ + +#include "lwip/snmp_asn1.h" + +/** + * Retrieves type field from incoming pbuf chain. + * + * @param p points to a pbuf holding an ASN1 coded type field + * @param ofs points to the offset within the pbuf chain of the ASN1 coded type field + * @param type return ASN1 type + * @return ERR_OK if successfull, ERR_ARG if we can't (or won't) decode + */ +err_t +snmp_asn1_dec_type(struct pbuf *p, u16_t ofs, u8_t *type) +{ + u16_t plen, base; + u8_t *msg_ptr; + + plen = 0; + while (p != NULL) + { + base = plen; + plen += p->len; + if (ofs < plen) + { + msg_ptr = (u8_t*)p->payload; + msg_ptr += ofs - base; + *type = *msg_ptr; + return ERR_OK; + } + p = p->next; + } + /* p == NULL, ofs >= plen */ + return ERR_ARG; +} + +/** + * Decodes length field from incoming pbuf chain into host length. + * + * @param p points to a pbuf holding an ASN1 coded length + * @param ofs points to the offset within the pbuf chain of the ASN1 coded length + * @param octets_used returns number of octets used by the length code + * @param length return host order length, upto 64k + * @return ERR_OK if successfull, ERR_ARG if we can't (or won't) decode + */ +err_t +snmp_asn1_dec_length(struct pbuf *p, u16_t ofs, u8_t *octets_used, u16_t *length) +{ + u16_t plen, base; + u8_t *msg_ptr; + + plen = 0; + while (p != NULL) + { + base = plen; + plen += p->len; + if (ofs < plen) + { + msg_ptr = (u8_t*)p->payload; + msg_ptr += ofs - base; + + if (*msg_ptr < 0x80) + { + /* primitive definite length format */ + *octets_used = 1; + *length = *msg_ptr; + return ERR_OK; + } + else if (*msg_ptr == 0x80) + { + /* constructed indefinite length format, termination with two zero octets */ + u8_t zeros; + u8_t i; + + *length = 0; + zeros = 0; + while (zeros != 2) + { + i = 2; + while (i > 0) + { + i--; + (*length) += 1; + ofs += 1; + if (ofs >= plen) + { + /* next octet in next pbuf */ + p = p->next; + if (p == NULL) { return ERR_ARG; } + msg_ptr = (u8_t*)p->payload; + plen += p->len; + } + else + { + /* next octet in same pbuf */ + msg_ptr++; + } + if (*msg_ptr == 0) + { + zeros++; + if (zeros == 2) + { + /* stop while (i > 0) */ + i = 0; + } + } + else + { + zeros = 0; + } + } + } + *octets_used = 1; + return ERR_OK; + } + else if (*msg_ptr == 0x81) + { + /* constructed definite length format, one octet */ + ofs += 1; + if (ofs >= plen) + { + /* next octet in next pbuf */ + p = p->next; + if (p == NULL) { return ERR_ARG; } + msg_ptr = (u8_t*)p->payload; + } + else + { + /* next octet in same pbuf */ + msg_ptr++; + } + *length = *msg_ptr; + *octets_used = 2; + return ERR_OK; + } + else if (*msg_ptr == 0x82) + { + u8_t i; + + /* constructed definite length format, two octets */ + i = 2; + while (i > 0) + { + i--; + ofs += 1; + if (ofs >= plen) + { + /* next octet in next pbuf */ + p = p->next; + if (p == NULL) { return ERR_ARG; } + msg_ptr = (u8_t*)p->payload; + plen += p->len; + } + else + { + /* next octet in same pbuf */ + msg_ptr++; + } + if (i == 0) + { + /* least significant length octet */ + *length |= *msg_ptr; + } + else + { + /* most significant length octet */ + *length = (*msg_ptr) << 8; + } + } + *octets_used = 3; + return ERR_OK; + } + else + { + /* constructed definite length format 3..127 octets, this is too big (>64k) */ + /** @todo: do we need to accept inefficient codings with many leading zero's? */ + *octets_used = 1 + ((*msg_ptr) & 0x7f); + return ERR_ARG; + } + } + p = p->next; + } + + /* p == NULL, ofs >= plen */ + return ERR_ARG; +} + +/** + * Decodes positive integer (counter, gauge, timeticks) into u32_t. + * + * @param p points to a pbuf holding an ASN1 coded integer + * @param ofs points to the offset within the pbuf chain of the ASN1 coded integer + * @param len length of the coded integer field + * @param value return host order integer + * @return ERR_OK if successfull, ERR_ARG if we can't (or won't) decode + * + * @note ASN coded integers are _always_ signed. E.g. +0xFFFF is coded + * as 0x00,0xFF,0xFF. Note the leading sign octet. A positive value + * of 0xFFFFFFFF is preceded with 0x00 and the length is 5 octets!! + */ +err_t +snmp_asn1_dec_u32t(struct pbuf *p, u16_t ofs, u16_t len, u32_t *value) +{ + u16_t plen, base; + u8_t *msg_ptr; + + plen = 0; + while (p != NULL) + { + base = plen; + plen += p->len; + if (ofs < plen) + { + msg_ptr = (u8_t*)p->payload; + msg_ptr += ofs - base; + if ((len > 0) && (len < 6)) + { + /* start from zero */ + *value = 0; + if (*msg_ptr & 0x80) + { + /* negative, expecting zero sign bit! */ + return ERR_ARG; + } + else + { + /* positive */ + if ((len > 1) && (*msg_ptr == 0)) + { + /* skip leading "sign byte" octet 0x00 */ + len--; + ofs += 1; + if (ofs >= plen) + { + /* next octet in next pbuf */ + p = p->next; + if (p == NULL) { return ERR_ARG; } + msg_ptr = (u8_t*)p->payload; + plen += p->len; + } + else + { + /* next octet in same pbuf */ + msg_ptr++; + } + } + } + /* OR octets with value */ + while (len > 1) + { + len--; + *value |= *msg_ptr; + *value <<= 8; + ofs += 1; + if (ofs >= plen) + { + /* next octet in next pbuf */ + p = p->next; + if (p == NULL) { return ERR_ARG; } + msg_ptr = (u8_t*)p->payload; + plen += p->len; + } + else + { + /* next octet in same pbuf */ + msg_ptr++; + } + } + *value |= *msg_ptr; + return ERR_OK; + } + else + { + return ERR_ARG; + } + } + p = p->next; + } + /* p == NULL, ofs >= plen */ + return ERR_ARG; +} + +/** + * Decodes integer into s32_t. + * + * @param p points to a pbuf holding an ASN1 coded integer + * @param ofs points to the offset within the pbuf chain of the ASN1 coded integer + * @param len length of the coded integer field + * @param value return host order integer + * @return ERR_OK if successfull, ERR_ARG if we can't (or won't) decode + * + * @note ASN coded integers are _always_ signed! + */ +err_t +snmp_asn1_dec_s32t(struct pbuf *p, u16_t ofs, u16_t len, s32_t *value) +{ + u16_t plen, base; + u8_t *msg_ptr; +#if BYTE_ORDER == LITTLE_ENDIAN + u8_t *lsb_ptr = (u8_t*)value; +#endif +#if BYTE_ORDER == BIG_ENDIAN + u8_t *lsb_ptr = (u8_t*)value + sizeof(s32_t) - 1; +#endif + u8_t sign; + + plen = 0; + while (p != NULL) + { + base = plen; + plen += p->len; + if (ofs < plen) + { + msg_ptr = (u8_t*)p->payload; + msg_ptr += ofs - base; + if ((len > 0) && (len < 5)) + { + if (*msg_ptr & 0x80) + { + /* negative, start from -1 */ + *value = -1; + sign = 1; + } + else + { + /* positive, start from 0 */ + *value = 0; + sign = 0; + } + /* OR/AND octets with value */ + while (len > 1) + { + len--; + if (sign) + { + *lsb_ptr &= *msg_ptr; + *value <<= 8; + *lsb_ptr |= 255; + } + else + { + *lsb_ptr |= *msg_ptr; + *value <<= 8; + } + ofs += 1; + if (ofs >= plen) + { + /* next octet in next pbuf */ + p = p->next; + if (p == NULL) { return ERR_ARG; } + msg_ptr = (u8_t*)p->payload; + plen += p->len; + } + else + { + /* next octet in same pbuf */ + msg_ptr++; + } + } + if (sign) + { + *lsb_ptr &= *msg_ptr; + } + else + { + *lsb_ptr |= *msg_ptr; + } + return ERR_OK; + } + else + { + return ERR_ARG; + } + } + p = p->next; + } + /* p == NULL, ofs >= plen */ + return ERR_ARG; +} + +/** + * Decodes object identifier from incoming message into array of s32_t. + * + * @param p points to a pbuf holding an ASN1 coded object identifier + * @param ofs points to the offset within the pbuf chain of the ASN1 coded object identifier + * @param len length of the coded object identifier + * @param oid return object identifier struct + * @return ERR_OK if successfull, ERR_ARG if we can't (or won't) decode + */ +err_t +snmp_asn1_dec_oid(struct pbuf *p, u16_t ofs, u16_t len, struct snmp_obj_id *oid) +{ + u16_t plen, base; + u8_t *msg_ptr; + s32_t *oid_ptr; + + plen = 0; + while (p != NULL) + { + base = plen; + plen += p->len; + if (ofs < plen) + { + msg_ptr = (u8_t*)p->payload; + msg_ptr += ofs - base; + + oid->len = 0; + oid_ptr = &oid->id[0]; + if (len > 0) + { + /* first compressed octet */ + if (*msg_ptr == 0x2B) + { + /* (most) common case 1.3 (iso.org) */ + *oid_ptr = 1; + oid_ptr++; + *oid_ptr = 3; + oid_ptr++; + } + else if (*msg_ptr < 40) + { + *oid_ptr = 0; + oid_ptr++; + *oid_ptr = *msg_ptr; + oid_ptr++; + } + else if (*msg_ptr < 80) + { + *oid_ptr = 1; + oid_ptr++; + *oid_ptr = (*msg_ptr) - 40; + oid_ptr++; + } + else + { + *oid_ptr = 2; + oid_ptr++; + *oid_ptr = (*msg_ptr) - 80; + oid_ptr++; + } + oid->len = 2; + } + else + { + /* accepting zero length identifiers e.g. for + getnext operation. uncommon but valid */ + return ERR_OK; + } + len--; + if (len > 0) + { + ofs += 1; + if (ofs >= plen) + { + /* next octet in next pbuf */ + p = p->next; + if (p == NULL) { return ERR_ARG; } + msg_ptr = (u8_t*)p->payload; + plen += p->len; + } + else + { + /* next octet in same pbuf */ + msg_ptr++; + } + } + while ((len > 0) && (oid->len < LWIP_SNMP_OBJ_ID_LEN)) + { + /* sub-identifier uses multiple octets */ + if (*msg_ptr & 0x80) + { + s32_t sub_id = 0; + + while ((*msg_ptr & 0x80) && (len > 1)) + { + len--; + sub_id = (sub_id << 7) + (*msg_ptr & ~0x80); + ofs += 1; + if (ofs >= plen) + { + /* next octet in next pbuf */ + p = p->next; + if (p == NULL) { return ERR_ARG; } + msg_ptr = (u8_t*)p->payload; + plen += p->len; + } + else + { + /* next octet in same pbuf */ + msg_ptr++; + } + } + if (!(*msg_ptr & 0x80) && (len > 0)) + { + /* last octet sub-identifier */ + len--; + sub_id = (sub_id << 7) + *msg_ptr; + *oid_ptr = sub_id; + } + } + else + { + /* !(*msg_ptr & 0x80) sub-identifier uses single octet */ + len--; + *oid_ptr = *msg_ptr; + } + if (len > 0) + { + /* remaining oid bytes available ... */ + ofs += 1; + if (ofs >= plen) + { + /* next octet in next pbuf */ + p = p->next; + if (p == NULL) { return ERR_ARG; } + msg_ptr = (u8_t*)p->payload; + plen += p->len; + } + else + { + /* next octet in same pbuf */ + msg_ptr++; + } + } + oid_ptr++; + oid->len++; + } + if (len == 0) + { + /* len == 0, end of oid */ + return ERR_OK; + } + else + { + /* len > 0, oid->len == LWIP_SNMP_OBJ_ID_LEN or malformed encoding */ + return ERR_ARG; + } + + } + p = p->next; + } + /* p == NULL, ofs >= plen */ + return ERR_ARG; +} + +/** + * Decodes (copies) raw data (ip-addresses, octet strings, opaque encoding) + * from incoming message into array. + * + * @param p points to a pbuf holding an ASN1 coded raw data + * @param ofs points to the offset within the pbuf chain of the ASN1 coded raw data + * @param len length of the coded raw data (zero is valid, e.g. empty string!) + * @param raw_len length of the raw return value + * @param raw return raw bytes + * @return ERR_OK if successfull, ERR_ARG if we can't (or won't) decode + */ +err_t +snmp_asn1_dec_raw(struct pbuf *p, u16_t ofs, u16_t len, u16_t raw_len, u8_t *raw) +{ + u16_t plen, base; + u8_t *msg_ptr; + + if (len > 0) + { + plen = 0; + while (p != NULL) + { + base = plen; + plen += p->len; + if (ofs < plen) + { + msg_ptr = (u8_t*)p->payload; + msg_ptr += ofs - base; + if (raw_len >= len) + { + while (len > 1) + { + /* copy len - 1 octets */ + len--; + *raw = *msg_ptr; + raw++; + ofs += 1; + if (ofs >= plen) + { + /* next octet in next pbuf */ + p = p->next; + if (p == NULL) { return ERR_ARG; } + msg_ptr = (u8_t*)p->payload; + plen += p->len; + } + else + { + /* next octet in same pbuf */ + msg_ptr++; + } + } + /* copy last octet */ + *raw = *msg_ptr; + return ERR_OK; + } + else + { + /* raw_len < len, not enough dst space */ + return ERR_ARG; + } + } + p = p->next; + } + /* p == NULL, ofs >= plen */ + return ERR_ARG; + } + else + { + /* len == 0, empty string */ + return ERR_OK; + } +} + +#endif /* LWIP_SNMP */ diff --git a/lib/drivers/lwip/src/core/snmp/asn1_enc.c b/lib/drivers/lwip/src/core/snmp/asn1_enc.c new file mode 100644 index 00000000000..64dfc5f6ead --- /dev/null +++ b/lib/drivers/lwip/src/core/snmp/asn1_enc.c @@ -0,0 +1,611 @@ +/** + * @file + * Abstract Syntax Notation One (ISO 8824, 8825) encoding + * + * @todo not optimised (yet), favor correctness over speed, favor speed over size + */ + +/* + * Copyright (c) 2006 Axon Digital Design B.V., The Netherlands. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * Author: Christiaan Simons + */ + +#include "lwip/opt.h" + +#if LWIP_SNMP /* don't build if not configured for use in lwipopts.h */ + +#include "lwip/snmp_asn1.h" + +/** + * Returns octet count for length. + * + * @param length + * @param octets_needed points to the return value + */ +void +snmp_asn1_enc_length_cnt(u16_t length, u8_t *octets_needed) +{ + if (length < 0x80U) + { + *octets_needed = 1; + } + else if (length < 0x100U) + { + *octets_needed = 2; + } + else + { + *octets_needed = 3; + } +} + +/** + * Returns octet count for an u32_t. + * + * @param value + * @param octets_needed points to the return value + * + * @note ASN coded integers are _always_ signed. E.g. +0xFFFF is coded + * as 0x00,0xFF,0xFF. Note the leading sign octet. A positive value + * of 0xFFFFFFFF is preceded with 0x00 and the length is 5 octets!! + */ +void +snmp_asn1_enc_u32t_cnt(u32_t value, u16_t *octets_needed) +{ + if (value < 0x80UL) + { + *octets_needed = 1; + } + else if (value < 0x8000UL) + { + *octets_needed = 2; + } + else if (value < 0x800000UL) + { + *octets_needed = 3; + } + else if (value < 0x80000000UL) + { + *octets_needed = 4; + } + else + { + *octets_needed = 5; + } +} + +/** + * Returns octet count for an s32_t. + * + * @param value + * @param octets_needed points to the return value + * + * @note ASN coded integers are _always_ signed. + */ +void +snmp_asn1_enc_s32t_cnt(s32_t value, u16_t *octets_needed) +{ + if (value < 0) + { + value = ~value; + } + if (value < 0x80L) + { + *octets_needed = 1; + } + else if (value < 0x8000L) + { + *octets_needed = 2; + } + else if (value < 0x800000L) + { + *octets_needed = 3; + } + else + { + *octets_needed = 4; + } +} + +/** + * Returns octet count for an object identifier. + * + * @param ident_len object identifier array length + * @param ident points to object identifier array + * @param octets_needed points to the return value + */ +void +snmp_asn1_enc_oid_cnt(u8_t ident_len, s32_t *ident, u16_t *octets_needed) +{ + s32_t sub_id; + u8_t cnt; + + cnt = 0; + if (ident_len > 1) + { + /* compressed prefix in one octet */ + cnt++; + ident_len -= 2; + ident += 2; + } + while(ident_len > 0) + { + ident_len--; + sub_id = *ident; + + sub_id >>= 7; + cnt++; + while(sub_id > 0) + { + sub_id >>= 7; + cnt++; + } + ident++; + } + *octets_needed = cnt; +} + +/** + * Encodes ASN type field into a pbuf chained ASN1 msg. + * + * @param p points to output pbuf to encode value into + * @param ofs points to the offset within the pbuf chain + * @param type input ASN1 type + * @return ERR_OK if successfull, ERR_ARG if we can't (or won't) encode + */ +err_t +snmp_asn1_enc_type(struct pbuf *p, u16_t ofs, u8_t type) +{ + u16_t plen, base; + u8_t *msg_ptr; + + plen = 0; + while (p != NULL) + { + base = plen; + plen += p->len; + if (ofs < plen) + { + msg_ptr = (u8_t*)p->payload; + msg_ptr += ofs - base; + *msg_ptr = type; + return ERR_OK; + } + p = p->next; + } + /* p == NULL, ofs >= plen */ + return ERR_ARG; +} + +/** + * Encodes host order length field into a pbuf chained ASN1 msg. + * + * @param p points to output pbuf to encode length into + * @param ofs points to the offset within the pbuf chain + * @param length is the host order length to be encoded + * @return ERR_OK if successfull, ERR_ARG if we can't (or won't) encode + */ +err_t +snmp_asn1_enc_length(struct pbuf *p, u16_t ofs, u16_t length) +{ + u16_t plen, base; + u8_t *msg_ptr; + + plen = 0; + while (p != NULL) + { + base = plen; + plen += p->len; + if (ofs < plen) + { + msg_ptr = (u8_t*)p->payload; + msg_ptr += ofs - base; + + if (length < 0x80) + { + *msg_ptr = (u8_t)length; + return ERR_OK; + } + else if (length < 0x100) + { + *msg_ptr = 0x81; + ofs += 1; + if (ofs >= plen) + { + /* next octet in next pbuf */ + p = p->next; + if (p == NULL) { return ERR_ARG; } + msg_ptr = (u8_t*)p->payload; + } + else + { + /* next octet in same pbuf */ + msg_ptr++; + } + *msg_ptr = (u8_t)length; + return ERR_OK; + } + else + { + u8_t i; + + /* length >= 0x100 && length <= 0xFFFF */ + *msg_ptr = 0x82; + i = 2; + while (i > 0) + { + i--; + ofs += 1; + if (ofs >= plen) + { + /* next octet in next pbuf */ + p = p->next; + if (p == NULL) { return ERR_ARG; } + msg_ptr = (u8_t*)p->payload; + plen += p->len; + } + else + { + /* next octet in same pbuf */ + msg_ptr++; + } + if (i == 0) + { + /* least significant length octet */ + *msg_ptr = (u8_t)length; + } + else + { + /* most significant length octet */ + *msg_ptr = (u8_t)(length >> 8); + } + } + return ERR_OK; + } + } + p = p->next; + } + /* p == NULL, ofs >= plen */ + return ERR_ARG; +} + +/** + * Encodes u32_t (counter, gauge, timeticks) into a pbuf chained ASN1 msg. + * + * @param p points to output pbuf to encode value into + * @param ofs points to the offset within the pbuf chain + * @param octets_needed encoding length (from snmp_asn1_enc_u32t_cnt()) + * @param value is the host order u32_t value to be encoded + * @return ERR_OK if successfull, ERR_ARG if we can't (or won't) encode + * + * @see snmp_asn1_enc_u32t_cnt() + */ +err_t +snmp_asn1_enc_u32t(struct pbuf *p, u16_t ofs, u16_t octets_needed, u32_t value) +{ + u16_t plen, base; + u8_t *msg_ptr; + + plen = 0; + while (p != NULL) + { + base = plen; + plen += p->len; + if (ofs < plen) + { + msg_ptr = (u8_t*)p->payload; + msg_ptr += ofs - base; + + if (octets_needed == 5) + { + /* not enough bits in 'value' add leading 0x00 */ + octets_needed--; + *msg_ptr = 0x00; + ofs += 1; + if (ofs >= plen) + { + /* next octet in next pbuf */ + p = p->next; + if (p == NULL) { return ERR_ARG; } + msg_ptr = (u8_t*)p->payload; + plen += p->len; + } + else + { + /* next octet in same pbuf */ + msg_ptr++; + } + } + while (octets_needed > 1) + { + octets_needed--; + *msg_ptr = (u8_t)(value >> (octets_needed << 3)); + ofs += 1; + if (ofs >= plen) + { + /* next octet in next pbuf */ + p = p->next; + if (p == NULL) { return ERR_ARG; } + msg_ptr = (u8_t*)p->payload; + plen += p->len; + } + else + { + /* next octet in same pbuf */ + msg_ptr++; + } + } + /* (only) one least significant octet */ + *msg_ptr = (u8_t)value; + return ERR_OK; + } + p = p->next; + } + /* p == NULL, ofs >= plen */ + return ERR_ARG; +} + +/** + * Encodes s32_t integer into a pbuf chained ASN1 msg. + * + * @param p points to output pbuf to encode value into + * @param ofs points to the offset within the pbuf chain + * @param octets_needed encoding length (from snmp_asn1_enc_s32t_cnt()) + * @param value is the host order s32_t value to be encoded + * @return ERR_OK if successfull, ERR_ARG if we can't (or won't) encode + * + * @see snmp_asn1_enc_s32t_cnt() + */ +err_t +snmp_asn1_enc_s32t(struct pbuf *p, u16_t ofs, u16_t octets_needed, s32_t value) +{ + u16_t plen, base; + u8_t *msg_ptr; + + plen = 0; + while (p != NULL) + { + base = plen; + plen += p->len; + if (ofs < plen) + { + msg_ptr = (u8_t*)p->payload; + msg_ptr += ofs - base; + + while (octets_needed > 1) + { + octets_needed--; + *msg_ptr = (u8_t)(value >> (octets_needed << 3)); + ofs += 1; + if (ofs >= plen) + { + /* next octet in next pbuf */ + p = p->next; + if (p == NULL) { return ERR_ARG; } + msg_ptr = (u8_t*)p->payload; + plen += p->len; + } + else + { + /* next octet in same pbuf */ + msg_ptr++; + } + } + /* (only) one least significant octet */ + *msg_ptr = (u8_t)value; + return ERR_OK; + } + p = p->next; + } + /* p == NULL, ofs >= plen */ + return ERR_ARG; +} + +/** + * Encodes object identifier into a pbuf chained ASN1 msg. + * + * @param p points to output pbuf to encode oid into + * @param ofs points to the offset within the pbuf chain + * @param ident_len object identifier array length + * @param ident points to object identifier array + * @return ERR_OK if successfull, ERR_ARG if we can't (or won't) encode + */ +err_t +snmp_asn1_enc_oid(struct pbuf *p, u16_t ofs, u8_t ident_len, s32_t *ident) +{ + u16_t plen, base; + u8_t *msg_ptr; + + plen = 0; + while (p != NULL) + { + base = plen; + plen += p->len; + if (ofs < plen) + { + msg_ptr = (u8_t*)p->payload; + msg_ptr += ofs - base; + + if (ident_len > 1) + { + if ((ident[0] == 1) && (ident[1] == 3)) + { + /* compressed (most common) prefix .iso.org */ + *msg_ptr = 0x2b; + } + else + { + /* calculate prefix */ + *msg_ptr = (u8_t)((ident[0] * 40) + ident[1]); + } + ofs += 1; + if (ofs >= plen) + { + /* next octet in next pbuf */ + p = p->next; + if (p == NULL) { return ERR_ARG; } + msg_ptr = (u8_t*)p->payload; + plen += p->len; + } + else + { + /* next octet in same pbuf */ + msg_ptr++; + } + ident_len -= 2; + ident += 2; + } + else + { +/* @bug: allow empty varbinds for symmetry (we must decode them for getnext), allow partial compression?? */ + /* ident_len <= 1, at least we need zeroDotZero (0.0) (ident_len == 2) */ + return ERR_ARG; + } + while (ident_len > 0) + { + s32_t sub_id; + u8_t shift, tail; + + ident_len--; + sub_id = *ident; + tail = 0; + shift = 28; + while(shift > 0) + { + u8_t code; + + code = (u8_t)(sub_id >> shift); + if ((code != 0) || (tail != 0)) + { + tail = 1; + *msg_ptr = code | 0x80; + ofs += 1; + if (ofs >= plen) + { + /* next octet in next pbuf */ + p = p->next; + if (p == NULL) { return ERR_ARG; } + msg_ptr = (u8_t*)p->payload; + plen += p->len; + } + else + { + /* next octet in same pbuf */ + msg_ptr++; + } + } + shift -= 7; + } + *msg_ptr = (u8_t)sub_id & 0x7F; + if (ident_len > 0) + { + ofs += 1; + if (ofs >= plen) + { + /* next octet in next pbuf */ + p = p->next; + if (p == NULL) { return ERR_ARG; } + msg_ptr = (u8_t*)p->payload; + plen += p->len; + } + else + { + /* next octet in same pbuf */ + msg_ptr++; + } + } + /* proceed to next sub-identifier */ + ident++; + } + return ERR_OK; + } + p = p->next; + } + /* p == NULL, ofs >= plen */ + return ERR_ARG; +} + +/** + * Encodes raw data (octet string, opaque) into a pbuf chained ASN1 msg. + * + * @param p points to output pbuf to encode raw data into + * @param ofs points to the offset within the pbuf chain + * @param raw_len raw data length + * @param raw points raw data + * @return ERR_OK if successfull, ERR_ARG if we can't (or won't) encode + */ +err_t +snmp_asn1_enc_raw(struct pbuf *p, u16_t ofs, u16_t raw_len, u8_t *raw) +{ + u16_t plen, base; + u8_t *msg_ptr; + + plen = 0; + while (p != NULL) + { + base = plen; + plen += p->len; + if (ofs < plen) + { + msg_ptr = (u8_t*)p->payload; + msg_ptr += ofs - base; + + while (raw_len > 1) + { + /* copy raw_len - 1 octets */ + raw_len--; + *msg_ptr = *raw; + raw++; + ofs += 1; + if (ofs >= plen) + { + /* next octet in next pbuf */ + p = p->next; + if (p == NULL) { return ERR_ARG; } + msg_ptr = (u8_t*)p->payload; + plen += p->len; + } + else + { + /* next octet in same pbuf */ + msg_ptr++; + } + } + if (raw_len > 0) + { + /* copy last or single octet */ + *msg_ptr = *raw; + } + return ERR_OK; + } + p = p->next; + } + /* p == NULL, ofs >= plen */ + return ERR_ARG; +} + +#endif /* LWIP_SNMP */ diff --git a/lib/drivers/lwip/src/core/snmp/mib2.c b/lib/drivers/lwip/src/core/snmp/mib2.c new file mode 100644 index 00000000000..29decd306f3 --- /dev/null +++ b/lib/drivers/lwip/src/core/snmp/mib2.c @@ -0,0 +1,4146 @@ +/** + * @file + * Management Information Base II (RFC1213) objects and functions. + * + * @note the object identifiers for this MIB-2 and private MIB tree + * must be kept in sorted ascending order. This to ensure correct getnext operation. + */ + +/* + * Copyright (c) 2006 Axon Digital Design B.V., The Netherlands. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * Author: Christiaan Simons + */ + +#include "lwip/opt.h" + +#if LWIP_SNMP /* don't build if not configured for use in lwipopts.h */ + +#include "lwip/snmp.h" +#include "lwip/netif.h" +#include "lwip/ip.h" +#include "lwip/ip_frag.h" +#include "lwip/mem.h" +#include "lwip/tcp_impl.h" +#include "lwip/udp.h" +#include "lwip/snmp_asn1.h" +#include "lwip/snmp_structs.h" +#include "lwip/sys.h" +#include "netif/etharp.h" + +/** + * IANA assigned enterprise ID for lwIP is 26381 + * @see http://www.iana.org/assignments/enterprise-numbers + * + * @note this enterprise ID is assigned to the lwIP project, + * all object identifiers living under this ID are assigned + * by the lwIP maintainers (contact Christiaan Simons)! + * @note don't change this define, use snmp_set_sysobjid() + * + * If you need to create your own private MIB you'll need + * to apply for your own enterprise ID with IANA: + * http://www.iana.org/numbers.html + */ +#define SNMP_ENTERPRISE_ID 26381 +#define SNMP_SYSOBJID_LEN 7 +#define SNMP_SYSOBJID {1, 3, 6, 1, 4, 1, SNMP_ENTERPRISE_ID} + +#ifndef SNMP_SYSSERVICES +#define SNMP_SYSSERVICES ((1 << 6) | (1 << 3) | ((IP_FORWARD) << 2)) +#endif + +#ifndef SNMP_GET_SYSUPTIME +#define SNMP_GET_SYSUPTIME(sysuptime) +#endif + +static void system_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od); +static void system_get_value(struct obj_def *od, u16_t len, void *value); +static u8_t system_set_test(struct obj_def *od, u16_t len, void *value); +static void system_set_value(struct obj_def *od, u16_t len, void *value); +static void interfaces_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od); +static void interfaces_get_value(struct obj_def *od, u16_t len, void *value); +static void ifentry_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od); +static void ifentry_get_value(struct obj_def *od, u16_t len, void *value); +#if !SNMP_SAFE_REQUESTS +static u8_t ifentry_set_test (struct obj_def *od, u16_t len, void *value); +static void ifentry_set_value (struct obj_def *od, u16_t len, void *value); +#endif /* SNMP_SAFE_REQUESTS */ +static void atentry_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od); +static void atentry_get_value(struct obj_def *od, u16_t len, void *value); +static void ip_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od); +static void ip_get_value(struct obj_def *od, u16_t len, void *value); +static u8_t ip_set_test(struct obj_def *od, u16_t len, void *value); +static void ip_addrentry_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od); +static void ip_addrentry_get_value(struct obj_def *od, u16_t len, void *value); +static void ip_rteentry_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od); +static void ip_rteentry_get_value(struct obj_def *od, u16_t len, void *value); +static void ip_ntomentry_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od); +static void ip_ntomentry_get_value(struct obj_def *od, u16_t len, void *value); +static void icmp_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od); +static void icmp_get_value(struct obj_def *od, u16_t len, void *value); +#if LWIP_TCP +static void tcp_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od); +static void tcp_get_value(struct obj_def *od, u16_t len, void *value); +#ifdef THIS_SEEMS_UNUSED +static void tcpconnentry_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od); +static void tcpconnentry_get_value(struct obj_def *od, u16_t len, void *value); +#endif +#endif +static void udp_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od); +static void udp_get_value(struct obj_def *od, u16_t len, void *value); +static void udpentry_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od); +static void udpentry_get_value(struct obj_def *od, u16_t len, void *value); +static void snmp_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od); +static void snmp_get_value(struct obj_def *od, u16_t len, void *value); +static u8_t snmp_set_test(struct obj_def *od, u16_t len, void *value); +static void snmp_set_value(struct obj_def *od, u16_t len, void *value); + + +/* snmp .1.3.6.1.2.1.11 */ +const mib_scalar_node snmp_scalar = { + &snmp_get_object_def, + &snmp_get_value, + &snmp_set_test, + &snmp_set_value, + MIB_NODE_SC, + 0 +}; +const s32_t snmp_ids[28] = { + 1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 24, 25, 26, 27, 28, 29, 30 +}; +struct mib_node* const snmp_nodes[28] = { + (struct mib_node*)&snmp_scalar, (struct mib_node*)&snmp_scalar, + (struct mib_node*)&snmp_scalar, (struct mib_node*)&snmp_scalar, + (struct mib_node*)&snmp_scalar, (struct mib_node*)&snmp_scalar, + (struct mib_node*)&snmp_scalar, (struct mib_node*)&snmp_scalar, + (struct mib_node*)&snmp_scalar, (struct mib_node*)&snmp_scalar, + (struct mib_node*)&snmp_scalar, (struct mib_node*)&snmp_scalar, + (struct mib_node*)&snmp_scalar, (struct mib_node*)&snmp_scalar, + (struct mib_node*)&snmp_scalar, (struct mib_node*)&snmp_scalar, + (struct mib_node*)&snmp_scalar, (struct mib_node*)&snmp_scalar, + (struct mib_node*)&snmp_scalar, (struct mib_node*)&snmp_scalar, + (struct mib_node*)&snmp_scalar, (struct mib_node*)&snmp_scalar, + (struct mib_node*)&snmp_scalar, (struct mib_node*)&snmp_scalar, + (struct mib_node*)&snmp_scalar, (struct mib_node*)&snmp_scalar, + (struct mib_node*)&snmp_scalar, (struct mib_node*)&snmp_scalar +}; +const struct mib_array_node snmp = { + &noleafs_get_object_def, + &noleafs_get_value, + &noleafs_set_test, + &noleafs_set_value, + MIB_NODE_AR, + 28, + snmp_ids, + snmp_nodes +}; + +/* dot3 and EtherLike MIB not planned. (transmission .1.3.6.1.2.1.10) */ +/* historical (some say hysterical). (cmot .1.3.6.1.2.1.9) */ +/* lwIP has no EGP, thus may not implement it. (egp .1.3.6.1.2.1.8) */ + +/* udp .1.3.6.1.2.1.7 */ +/** index root node for udpTable */ +struct mib_list_rootnode udp_root = { + &noleafs_get_object_def, + &noleafs_get_value, + &noleafs_set_test, + &noleafs_set_value, + MIB_NODE_LR, + 0, + NULL, + NULL, + 0 +}; +const s32_t udpentry_ids[2] = { 1, 2 }; +struct mib_node* const udpentry_nodes[2] = { + (struct mib_node*)&udp_root, (struct mib_node*)&udp_root, +}; +const struct mib_array_node udpentry = { + &noleafs_get_object_def, + &noleafs_get_value, + &noleafs_set_test, + &noleafs_set_value, + MIB_NODE_AR, + 2, + udpentry_ids, + udpentry_nodes +}; + +s32_t udptable_id = 1; +struct mib_node* udptable_node = (struct mib_node*)&udpentry; +struct mib_ram_array_node udptable = { + &noleafs_get_object_def, + &noleafs_get_value, + &noleafs_set_test, + &noleafs_set_value, + MIB_NODE_RA, + 0, + &udptable_id, + &udptable_node +}; + +const mib_scalar_node udp_scalar = { + &udp_get_object_def, + &udp_get_value, + &noleafs_set_test, + &noleafs_set_value, + MIB_NODE_SC, + 0 +}; +const s32_t udp_ids[5] = { 1, 2, 3, 4, 5 }; +struct mib_node* const udp_nodes[5] = { + (struct mib_node*)&udp_scalar, (struct mib_node*)&udp_scalar, + (struct mib_node*)&udp_scalar, (struct mib_node*)&udp_scalar, + (struct mib_node*)&udptable +}; +const struct mib_array_node udp = { + &noleafs_get_object_def, + &noleafs_get_value, + &noleafs_set_test, + &noleafs_set_value, + MIB_NODE_AR, + 5, + udp_ids, + udp_nodes +}; + +/* tcp .1.3.6.1.2.1.6 */ +#if LWIP_TCP +/* only if the TCP protocol is available may implement this group */ +/** index root node for tcpConnTable */ +struct mib_list_rootnode tcpconntree_root = { + &noleafs_get_object_def, + &noleafs_get_value, + &noleafs_set_test, + &noleafs_set_value, + MIB_NODE_LR, + 0, + NULL, + NULL, + 0 +}; +const s32_t tcpconnentry_ids[5] = { 1, 2, 3, 4, 5 }; +struct mib_node* const tcpconnentry_nodes[5] = { + (struct mib_node*)&tcpconntree_root, (struct mib_node*)&tcpconntree_root, + (struct mib_node*)&tcpconntree_root, (struct mib_node*)&tcpconntree_root, + (struct mib_node*)&tcpconntree_root +}; +const struct mib_array_node tcpconnentry = { + &noleafs_get_object_def, + &noleafs_get_value, + &noleafs_set_test, + &noleafs_set_value, + MIB_NODE_AR, + 5, + tcpconnentry_ids, + tcpconnentry_nodes +}; + +s32_t tcpconntable_id = 1; +struct mib_node* tcpconntable_node = (struct mib_node*)&tcpconnentry; +struct mib_ram_array_node tcpconntable = { + &noleafs_get_object_def, + &noleafs_get_value, + &noleafs_set_test, + &noleafs_set_value, + MIB_NODE_RA, +/** @todo update maxlength when inserting / deleting from table + 0 when table is empty, 1 when more than one entry */ + 0, + &tcpconntable_id, + &tcpconntable_node +}; + +const mib_scalar_node tcp_scalar = { + &tcp_get_object_def, + &tcp_get_value, + &noleafs_set_test, + &noleafs_set_value, + MIB_NODE_SC, + 0 +}; +const s32_t tcp_ids[15] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; +struct mib_node* const tcp_nodes[15] = { + (struct mib_node*)&tcp_scalar, (struct mib_node*)&tcp_scalar, + (struct mib_node*)&tcp_scalar, (struct mib_node*)&tcp_scalar, + (struct mib_node*)&tcp_scalar, (struct mib_node*)&tcp_scalar, + (struct mib_node*)&tcp_scalar, (struct mib_node*)&tcp_scalar, + (struct mib_node*)&tcp_scalar, (struct mib_node*)&tcp_scalar, + (struct mib_node*)&tcp_scalar, (struct mib_node*)&tcp_scalar, + (struct mib_node*)&tcpconntable, (struct mib_node*)&tcp_scalar, + (struct mib_node*)&tcp_scalar +}; +const struct mib_array_node tcp = { + &noleafs_get_object_def, + &noleafs_get_value, + &noleafs_set_test, + &noleafs_set_value, + MIB_NODE_AR, + 15, + tcp_ids, + tcp_nodes +}; +#endif + +/* icmp .1.3.6.1.2.1.5 */ +const mib_scalar_node icmp_scalar = { + &icmp_get_object_def, + &icmp_get_value, + &noleafs_set_test, + &noleafs_set_value, + MIB_NODE_SC, + 0 +}; +const s32_t icmp_ids[26] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 }; +struct mib_node* const icmp_nodes[26] = { + (struct mib_node*)&icmp_scalar, (struct mib_node*)&icmp_scalar, + (struct mib_node*)&icmp_scalar, (struct mib_node*)&icmp_scalar, + (struct mib_node*)&icmp_scalar, (struct mib_node*)&icmp_scalar, + (struct mib_node*)&icmp_scalar, (struct mib_node*)&icmp_scalar, + (struct mib_node*)&icmp_scalar, (struct mib_node*)&icmp_scalar, + (struct mib_node*)&icmp_scalar, (struct mib_node*)&icmp_scalar, + (struct mib_node*)&icmp_scalar, (struct mib_node*)&icmp_scalar, + (struct mib_node*)&icmp_scalar, (struct mib_node*)&icmp_scalar, + (struct mib_node*)&icmp_scalar, (struct mib_node*)&icmp_scalar, + (struct mib_node*)&icmp_scalar, (struct mib_node*)&icmp_scalar, + (struct mib_node*)&icmp_scalar, (struct mib_node*)&icmp_scalar, + (struct mib_node*)&icmp_scalar, (struct mib_node*)&icmp_scalar, + (struct mib_node*)&icmp_scalar, (struct mib_node*)&icmp_scalar +}; +const struct mib_array_node icmp = { + &noleafs_get_object_def, + &noleafs_get_value, + &noleafs_set_test, + &noleafs_set_value, + MIB_NODE_AR, + 26, + icmp_ids, + icmp_nodes +}; + +/** index root node for ipNetToMediaTable */ +struct mib_list_rootnode ipntomtree_root = { + &noleafs_get_object_def, + &noleafs_get_value, + &noleafs_set_test, + &noleafs_set_value, + MIB_NODE_LR, + 0, + NULL, + NULL, + 0 +}; +const s32_t ipntomentry_ids[4] = { 1, 2, 3, 4 }; +struct mib_node* const ipntomentry_nodes[4] = { + (struct mib_node*)&ipntomtree_root, (struct mib_node*)&ipntomtree_root, + (struct mib_node*)&ipntomtree_root, (struct mib_node*)&ipntomtree_root +}; +const struct mib_array_node ipntomentry = { + &noleafs_get_object_def, + &noleafs_get_value, + &noleafs_set_test, + &noleafs_set_value, + MIB_NODE_AR, + 4, + ipntomentry_ids, + ipntomentry_nodes +}; + +s32_t ipntomtable_id = 1; +struct mib_node* ipntomtable_node = (struct mib_node*)&ipntomentry; +struct mib_ram_array_node ipntomtable = { + &noleafs_get_object_def, + &noleafs_get_value, + &noleafs_set_test, + &noleafs_set_value, + MIB_NODE_RA, + 0, + &ipntomtable_id, + &ipntomtable_node +}; + +/** index root node for ipRouteTable */ +struct mib_list_rootnode iprtetree_root = { + &noleafs_get_object_def, + &noleafs_get_value, + &noleafs_set_test, + &noleafs_set_value, + MIB_NODE_LR, + 0, + NULL, + NULL, + 0 +}; +const s32_t iprteentry_ids[13] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 }; +struct mib_node* const iprteentry_nodes[13] = { + (struct mib_node*)&iprtetree_root, (struct mib_node*)&iprtetree_root, + (struct mib_node*)&iprtetree_root, (struct mib_node*)&iprtetree_root, + (struct mib_node*)&iprtetree_root, (struct mib_node*)&iprtetree_root, + (struct mib_node*)&iprtetree_root, (struct mib_node*)&iprtetree_root, + (struct mib_node*)&iprtetree_root, (struct mib_node*)&iprtetree_root, + (struct mib_node*)&iprtetree_root, (struct mib_node*)&iprtetree_root, + (struct mib_node*)&iprtetree_root +}; +const struct mib_array_node iprteentry = { + &noleafs_get_object_def, + &noleafs_get_value, + &noleafs_set_test, + &noleafs_set_value, + MIB_NODE_AR, + 13, + iprteentry_ids, + iprteentry_nodes +}; + +s32_t iprtetable_id = 1; +struct mib_node* iprtetable_node = (struct mib_node*)&iprteentry; +struct mib_ram_array_node iprtetable = { + &noleafs_get_object_def, + &noleafs_get_value, + &noleafs_set_test, + &noleafs_set_value, + MIB_NODE_RA, + 0, + &iprtetable_id, + &iprtetable_node +}; + +/** index root node for ipAddrTable */ +struct mib_list_rootnode ipaddrtree_root = { + &noleafs_get_object_def, + &noleafs_get_value, + &noleafs_set_test, + &noleafs_set_value, + MIB_NODE_LR, + 0, + NULL, + NULL, + 0 +}; +const s32_t ipaddrentry_ids[5] = { 1, 2, 3, 4, 5 }; +struct mib_node* const ipaddrentry_nodes[5] = { + (struct mib_node*)&ipaddrtree_root, + (struct mib_node*)&ipaddrtree_root, + (struct mib_node*)&ipaddrtree_root, + (struct mib_node*)&ipaddrtree_root, + (struct mib_node*)&ipaddrtree_root +}; +const struct mib_array_node ipaddrentry = { + &noleafs_get_object_def, + &noleafs_get_value, + &noleafs_set_test, + &noleafs_set_value, + MIB_NODE_AR, + 5, + ipaddrentry_ids, + ipaddrentry_nodes +}; + +s32_t ipaddrtable_id = 1; +struct mib_node* ipaddrtable_node = (struct mib_node*)&ipaddrentry; +struct mib_ram_array_node ipaddrtable = { + &noleafs_get_object_def, + &noleafs_get_value, + &noleafs_set_test, + &noleafs_set_value, + MIB_NODE_RA, + 0, + &ipaddrtable_id, + &ipaddrtable_node +}; + +/* ip .1.3.6.1.2.1.4 */ +const mib_scalar_node ip_scalar = { + &ip_get_object_def, + &ip_get_value, + &ip_set_test, + &noleafs_set_value, + MIB_NODE_SC, + 0 +}; +const s32_t ip_ids[23] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 }; +struct mib_node* const ip_nodes[23] = { + (struct mib_node*)&ip_scalar, (struct mib_node*)&ip_scalar, + (struct mib_node*)&ip_scalar, (struct mib_node*)&ip_scalar, + (struct mib_node*)&ip_scalar, (struct mib_node*)&ip_scalar, + (struct mib_node*)&ip_scalar, (struct mib_node*)&ip_scalar, + (struct mib_node*)&ip_scalar, (struct mib_node*)&ip_scalar, + (struct mib_node*)&ip_scalar, (struct mib_node*)&ip_scalar, + (struct mib_node*)&ip_scalar, (struct mib_node*)&ip_scalar, + (struct mib_node*)&ip_scalar, (struct mib_node*)&ip_scalar, + (struct mib_node*)&ip_scalar, (struct mib_node*)&ip_scalar, + (struct mib_node*)&ip_scalar, (struct mib_node*)&ipaddrtable, + (struct mib_node*)&iprtetable, (struct mib_node*)&ipntomtable, + (struct mib_node*)&ip_scalar +}; +const struct mib_array_node mib2_ip = { + &noleafs_get_object_def, + &noleafs_get_value, + &noleafs_set_test, + &noleafs_set_value, + MIB_NODE_AR, + 23, + ip_ids, + ip_nodes +}; + +/** index root node for atTable */ +struct mib_list_rootnode arptree_root = { + &noleafs_get_object_def, + &noleafs_get_value, + &noleafs_set_test, + &noleafs_set_value, + MIB_NODE_LR, + 0, + NULL, + NULL, + 0 +}; +const s32_t atentry_ids[3] = { 1, 2, 3 }; +struct mib_node* const atentry_nodes[3] = { + (struct mib_node*)&arptree_root, + (struct mib_node*)&arptree_root, + (struct mib_node*)&arptree_root +}; +const struct mib_array_node atentry = { + &noleafs_get_object_def, + &noleafs_get_value, + &noleafs_set_test, + &noleafs_set_value, + MIB_NODE_AR, + 3, + atentry_ids, + atentry_nodes +}; + +const s32_t attable_id = 1; +struct mib_node* const attable_node = (struct mib_node*)&atentry; +const struct mib_array_node attable = { + &noleafs_get_object_def, + &noleafs_get_value, + &noleafs_set_test, + &noleafs_set_value, + MIB_NODE_AR, + 1, + &attable_id, + &attable_node +}; + +/* at .1.3.6.1.2.1.3 */ +s32_t at_id = 1; +struct mib_node* mib2_at_node = (struct mib_node*)&attable; +struct mib_ram_array_node at = { + &noleafs_get_object_def, + &noleafs_get_value, + &noleafs_set_test, + &noleafs_set_value, + MIB_NODE_RA, + 0, + &at_id, + &mib2_at_node +}; + +/** index root node for ifTable */ +struct mib_list_rootnode iflist_root = { + &ifentry_get_object_def, + &ifentry_get_value, +#if SNMP_SAFE_REQUESTS + &noleafs_set_test, + &noleafs_set_value, +#else /* SNMP_SAFE_REQUESTS */ + &ifentry_set_test, + &ifentry_set_value, +#endif /* SNMP_SAFE_REQUESTS */ + MIB_NODE_LR, + 0, + NULL, + NULL, + 0 +}; +const s32_t ifentry_ids[22] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22 }; +struct mib_node* const ifentry_nodes[22] = { + (struct mib_node*)&iflist_root, (struct mib_node*)&iflist_root, + (struct mib_node*)&iflist_root, (struct mib_node*)&iflist_root, + (struct mib_node*)&iflist_root, (struct mib_node*)&iflist_root, + (struct mib_node*)&iflist_root, (struct mib_node*)&iflist_root, + (struct mib_node*)&iflist_root, (struct mib_node*)&iflist_root, + (struct mib_node*)&iflist_root, (struct mib_node*)&iflist_root, + (struct mib_node*)&iflist_root, (struct mib_node*)&iflist_root, + (struct mib_node*)&iflist_root, (struct mib_node*)&iflist_root, + (struct mib_node*)&iflist_root, (struct mib_node*)&iflist_root, + (struct mib_node*)&iflist_root, (struct mib_node*)&iflist_root, + (struct mib_node*)&iflist_root, (struct mib_node*)&iflist_root +}; +const struct mib_array_node ifentry = { + &noleafs_get_object_def, + &noleafs_get_value, + &noleafs_set_test, + &noleafs_set_value, + MIB_NODE_AR, + 22, + ifentry_ids, + ifentry_nodes +}; + +s32_t iftable_id = 1; +struct mib_node* iftable_node = (struct mib_node*)&ifentry; +struct mib_ram_array_node iftable = { + &noleafs_get_object_def, + &noleafs_get_value, + &noleafs_set_test, + &noleafs_set_value, + MIB_NODE_RA, + 0, + &iftable_id, + &iftable_node +}; + +/* interfaces .1.3.6.1.2.1.2 */ +const mib_scalar_node interfaces_scalar = { + &interfaces_get_object_def, + &interfaces_get_value, + &noleafs_set_test, + &noleafs_set_value, + MIB_NODE_SC, + 0 +}; +const s32_t interfaces_ids[2] = { 1, 2 }; +struct mib_node* const interfaces_nodes[2] = { + (struct mib_node*)&interfaces_scalar, (struct mib_node*)&iftable +}; +const struct mib_array_node interfaces = { + &noleafs_get_object_def, + &noleafs_get_value, + &noleafs_set_test, + &noleafs_set_value, + MIB_NODE_AR, + 2, + interfaces_ids, + interfaces_nodes +}; + + +/* 0 1 2 3 4 5 6 */ +/* system .1.3.6.1.2.1.1 */ +const mib_scalar_node sys_tem_scalar = { + &system_get_object_def, + &system_get_value, + &system_set_test, + &system_set_value, + MIB_NODE_SC, + 0 +}; +const s32_t sys_tem_ids[7] = { 1, 2, 3, 4, 5, 6, 7 }; +struct mib_node* const sys_tem_nodes[7] = { + (struct mib_node*)&sys_tem_scalar, (struct mib_node*)&sys_tem_scalar, + (struct mib_node*)&sys_tem_scalar, (struct mib_node*)&sys_tem_scalar, + (struct mib_node*)&sys_tem_scalar, (struct mib_node*)&sys_tem_scalar, + (struct mib_node*)&sys_tem_scalar +}; +/* work around name issue with 'sys_tem', some compiler(s?) seem to reserve 'system' */ +const struct mib_array_node sys_tem = { + &noleafs_get_object_def, + &noleafs_get_value, + &noleafs_set_test, + &noleafs_set_value, + MIB_NODE_AR, + 7, + sys_tem_ids, + sys_tem_nodes +}; + +/* mib-2 .1.3.6.1.2.1 */ +#if LWIP_TCP +#define MIB2_GROUPS 8 +#else +#define MIB2_GROUPS 7 +#endif +const s32_t mib2_ids[MIB2_GROUPS] = +{ + 1, + 2, + 3, + 4, + 5, +#if LWIP_TCP + 6, +#endif + 7, + 11 +}; +struct mib_node* const mib2_nodes[MIB2_GROUPS] = { + (struct mib_node*)&sys_tem, + (struct mib_node*)&interfaces, + (struct mib_node*)&at, + (struct mib_node*)&mib2_ip, + (struct mib_node*)&icmp, +#if LWIP_TCP + (struct mib_node*)&tcp, +#endif + (struct mib_node*)&udp, + (struct mib_node*)&snmp +}; + +const struct mib_array_node mib2 = { + &noleafs_get_object_def, + &noleafs_get_value, + &noleafs_set_test, + &noleafs_set_value, + MIB_NODE_AR, + MIB2_GROUPS, + mib2_ids, + mib2_nodes +}; + +/* mgmt .1.3.6.1.2 */ +const s32_t mgmt_ids[1] = { 1 }; +struct mib_node* const mgmt_nodes[1] = { (struct mib_node*)&mib2 }; +const struct mib_array_node mgmt = { + &noleafs_get_object_def, + &noleafs_get_value, + &noleafs_set_test, + &noleafs_set_value, + MIB_NODE_AR, + 1, + mgmt_ids, + mgmt_nodes +}; + +/* internet .1.3.6.1 */ +#if SNMP_PRIVATE_MIB +/* When using a private MIB, you have to create a file 'private_mib.h' that contains + * a 'struct mib_array_node mib_private' which contains your MIB. */ +s32_t internet_ids[2] = { 2, 4 }; +struct mib_node* const internet_nodes[2] = { (struct mib_node*)&mgmt, (struct mib_node*)&mib_private }; +const struct mib_array_node internet = { + &noleafs_get_object_def, + &noleafs_get_value, + &noleafs_set_test, + &noleafs_set_value, + MIB_NODE_AR, + 2, + internet_ids, + internet_nodes +}; +#else +const s32_t internet_ids[1] = { 2 }; +struct mib_node* const internet_nodes[1] = { (struct mib_node*)&mgmt }; +const struct mib_array_node internet = { + &noleafs_get_object_def, + &noleafs_get_value, + &noleafs_set_test, + &noleafs_set_value, + MIB_NODE_AR, + 1, + internet_ids, + internet_nodes +}; +#endif + +/** mib-2.system.sysObjectID */ +static struct snmp_obj_id sysobjid = {SNMP_SYSOBJID_LEN, SNMP_SYSOBJID}; +/** enterprise ID for generic TRAPs, .iso.org.dod.internet.mgmt.mib-2.snmp */ +static struct snmp_obj_id snmpgrp_id = {7,{1,3,6,1,2,1,11}}; +/** mib-2.system.sysServices */ +static const s32_t sysservices = SNMP_SYSSERVICES; + +/** mib-2.system.sysDescr */ +static const u8_t sysdescr_len_default = 4; +static const u8_t sysdescr_default[] = "lwIP"; +static u8_t* sysdescr_len_ptr = (u8_t*)&sysdescr_len_default; +static u8_t* sysdescr_ptr = (u8_t*)&sysdescr_default[0]; +/** mib-2.system.sysContact */ +static const u8_t syscontact_len_default = 0; +static const u8_t syscontact_default[] = ""; +static u8_t* syscontact_len_ptr = (u8_t*)&syscontact_len_default; +static u8_t* syscontact_ptr = (u8_t*)&syscontact_default[0]; +/** mib-2.system.sysName */ +static const u8_t sysname_len_default = 8; +static const u8_t sysname_default[] = "FQDN-unk"; +static u8_t* sysname_len_ptr = (u8_t*)&sysname_len_default; +static u8_t* sysname_ptr = (u8_t*)&sysname_default[0]; +/** mib-2.system.sysLocation */ +static const u8_t syslocation_len_default = 0; +static const u8_t syslocation_default[] = ""; +static u8_t* syslocation_len_ptr = (u8_t*)&syslocation_len_default; +static u8_t* syslocation_ptr = (u8_t*)&syslocation_default[0]; +/** mib-2.snmp.snmpEnableAuthenTraps */ +static const u8_t snmpenableauthentraps_default = 2; /* disabled */ +static u8_t* snmpenableauthentraps_ptr = (u8_t*)&snmpenableauthentraps_default; + +/** mib-2.interfaces.ifTable.ifEntry.ifSpecific (zeroDotZero) */ +static const struct snmp_obj_id ifspecific = {2, {0, 0}}; +/** mib-2.ip.ipRouteTable.ipRouteEntry.ipRouteInfo (zeroDotZero) */ +static const struct snmp_obj_id iprouteinfo = {2, {0, 0}}; + + + +/* mib-2.system counter(s) */ +static u32_t sysuptime = 0; + +/* mib-2.ip counter(s) */ +static u32_t ipinreceives = 0, + ipinhdrerrors = 0, + ipinaddrerrors = 0, + ipforwdatagrams = 0, + ipinunknownprotos = 0, + ipindiscards = 0, + ipindelivers = 0, + ipoutrequests = 0, + ipoutdiscards = 0, + ipoutnoroutes = 0, + ipreasmreqds = 0, + ipreasmoks = 0, + ipreasmfails = 0, + ipfragoks = 0, + ipfragfails = 0, + ipfragcreates = 0, + iproutingdiscards = 0; +/* mib-2.icmp counter(s) */ +static u32_t icmpinmsgs = 0, + icmpinerrors = 0, + icmpindestunreachs = 0, + icmpintimeexcds = 0, + icmpinparmprobs = 0, + icmpinsrcquenchs = 0, + icmpinredirects = 0, + icmpinechos = 0, + icmpinechoreps = 0, + icmpintimestamps = 0, + icmpintimestampreps = 0, + icmpinaddrmasks = 0, + icmpinaddrmaskreps = 0, + icmpoutmsgs = 0, + icmpouterrors = 0, + icmpoutdestunreachs = 0, + icmpouttimeexcds = 0, + icmpoutparmprobs = 0, + icmpoutsrcquenchs = 0, + icmpoutredirects = 0, + icmpoutechos = 0, + icmpoutechoreps = 0, + icmpouttimestamps = 0, + icmpouttimestampreps = 0, + icmpoutaddrmasks = 0, + icmpoutaddrmaskreps = 0; +/* mib-2.tcp counter(s) */ +static u32_t tcpactiveopens = 0, + tcppassiveopens = 0, + tcpattemptfails = 0, + tcpestabresets = 0, + tcpinsegs = 0, + tcpoutsegs = 0, + tcpretranssegs = 0, + tcpinerrs = 0, + tcpoutrsts = 0; +/* mib-2.udp counter(s) */ +static u32_t udpindatagrams = 0, + udpnoports = 0, + udpinerrors = 0, + udpoutdatagrams = 0; +/* mib-2.snmp counter(s) */ +static u32_t snmpinpkts = 0, + snmpoutpkts = 0, + snmpinbadversions = 0, + snmpinbadcommunitynames = 0, + snmpinbadcommunityuses = 0, + snmpinasnparseerrs = 0, + snmpintoobigs = 0, + snmpinnosuchnames = 0, + snmpinbadvalues = 0, + snmpinreadonlys = 0, + snmpingenerrs = 0, + snmpintotalreqvars = 0, + snmpintotalsetvars = 0, + snmpingetrequests = 0, + snmpingetnexts = 0, + snmpinsetrequests = 0, + snmpingetresponses = 0, + snmpintraps = 0, + snmpouttoobigs = 0, + snmpoutnosuchnames = 0, + snmpoutbadvalues = 0, + snmpoutgenerrs = 0, + snmpoutgetrequests = 0, + snmpoutgetnexts = 0, + snmpoutsetrequests = 0, + snmpoutgetresponses = 0, + snmpouttraps = 0; + + + +/* prototypes of the following functions are in lwip/src/include/lwip/snmp.h */ +/** + * Copy octet string. + * + * @param dst points to destination + * @param src points to source + * @param n number of octets to copy. + */ +static void ocstrncpy(u8_t *dst, u8_t *src, u16_t n) +{ + u16_t i = n; + while (i > 0) { + i--; + *dst++ = *src++; + } +} + +/** + * Copy object identifier (s32_t) array. + * + * @param dst points to destination + * @param src points to source + * @param n number of sub identifiers to copy. + */ +void objectidncpy(s32_t *dst, s32_t *src, u8_t n) +{ + u8_t i = n; + while(i > 0) { + i--; + *dst++ = *src++; + } +} + +/** + * Initializes sysDescr pointers. + * + * @param str if non-NULL then copy str pointer + * @param len points to string length, excluding zero terminator + */ +void snmp_set_sysdesr(u8_t *str, u8_t *len) +{ + if (str != NULL) + { + sysdescr_ptr = str; + sysdescr_len_ptr = len; + } +} + +void snmp_get_sysobjid_ptr(struct snmp_obj_id **oid) +{ + *oid = &sysobjid; +} + +/** + * Initializes sysObjectID value. + * + * @param oid points to stuct snmp_obj_id to copy + */ +void snmp_set_sysobjid(struct snmp_obj_id *oid) +{ + sysobjid = *oid; +} + +/** + * Must be called at regular 10 msec interval from a timer interrupt + * or signal handler depending on your runtime environment. + */ +void snmp_inc_sysuptime(void) +{ + sysuptime++; +} + +void snmp_add_sysuptime(u32_t value) +{ + sysuptime+=value; +} + +void snmp_get_sysuptime(u32_t *value) +{ + SNMP_GET_SYSUPTIME(sysuptime); + *value = sysuptime; +} + +/** + * Initializes sysContact pointers, + * e.g. ptrs to non-volatile memory external to lwIP. + * + * @param ocstr if non-NULL then copy str pointer + * @param ocstrlen points to string length, excluding zero terminator + */ +void snmp_set_syscontact(u8_t *ocstr, u8_t *ocstrlen) +{ + if (ocstr != NULL) + { + syscontact_ptr = ocstr; + syscontact_len_ptr = ocstrlen; + } +} + +/** + * Initializes sysName pointers, + * e.g. ptrs to non-volatile memory external to lwIP. + * + * @param ocstr if non-NULL then copy str pointer + * @param ocstrlen points to string length, excluding zero terminator + */ +void snmp_set_sysname(u8_t *ocstr, u8_t *ocstrlen) +{ + if (ocstr != NULL) + { + sysname_ptr = ocstr; + sysname_len_ptr = ocstrlen; + } +} + +/** + * Initializes sysLocation pointers, + * e.g. ptrs to non-volatile memory external to lwIP. + * + * @param ocstr if non-NULL then copy str pointer + * @param ocstrlen points to string length, excluding zero terminator + */ +void snmp_set_syslocation(u8_t *ocstr, u8_t *ocstrlen) +{ + if (ocstr != NULL) + { + syslocation_ptr = ocstr; + syslocation_len_ptr = ocstrlen; + } +} + + +void snmp_add_ifinoctets(struct netif *ni, u32_t value) +{ + ni->ifinoctets += value; +} + +void snmp_inc_ifinucastpkts(struct netif *ni) +{ + (ni->ifinucastpkts)++; +} + +void snmp_inc_ifinnucastpkts(struct netif *ni) +{ + (ni->ifinnucastpkts)++; +} + +void snmp_inc_ifindiscards(struct netif *ni) +{ + (ni->ifindiscards)++; +} + +void snmp_add_ifoutoctets(struct netif *ni, u32_t value) +{ + ni->ifoutoctets += value; +} + +void snmp_inc_ifoutucastpkts(struct netif *ni) +{ + (ni->ifoutucastpkts)++; +} + +void snmp_inc_ifoutnucastpkts(struct netif *ni) +{ + (ni->ifoutnucastpkts)++; +} + +void snmp_inc_ifoutdiscards(struct netif *ni) +{ + (ni->ifoutdiscards)++; +} + +void snmp_inc_iflist(void) +{ + struct mib_list_node *if_node = NULL; + + snmp_mib_node_insert(&iflist_root, iflist_root.count + 1, &if_node); + /* enable getnext traversal on filled table */ + iftable.maxlength = 1; +} + +void snmp_dec_iflist(void) +{ + snmp_mib_node_delete(&iflist_root, iflist_root.tail); + /* disable getnext traversal on empty table */ + if(iflist_root.count == 0) iftable.maxlength = 0; +} + +/** + * Inserts ARP table indexes (.xIfIndex.xNetAddress) + * into arp table index trees (both atTable and ipNetToMediaTable). + */ +void snmp_insert_arpidx_tree(struct netif *ni, ip_addr_t *ip) +{ + struct mib_list_rootnode *at_rn; + struct mib_list_node *at_node; + s32_t arpidx[5]; + u8_t level, tree; + + LWIP_ASSERT("ni != NULL", ni != NULL); + snmp_netiftoifindex(ni, &arpidx[0]); + snmp_iptooid(ip, &arpidx[1]); + + for (tree = 0; tree < 2; tree++) + { + if (tree == 0) + { + at_rn = &arptree_root; + } + else + { + at_rn = &ipntomtree_root; + } + for (level = 0; level < 5; level++) + { + at_node = NULL; + snmp_mib_node_insert(at_rn, arpidx[level], &at_node); + if ((level != 4) && (at_node != NULL)) + { + if (at_node->nptr == NULL) + { + at_rn = snmp_mib_lrn_alloc(); + at_node->nptr = (struct mib_node*)at_rn; + if (at_rn != NULL) + { + if (level == 3) + { + if (tree == 0) + { + at_rn->get_object_def = atentry_get_object_def; + at_rn->get_value = atentry_get_value; + } + else + { + at_rn->get_object_def = ip_ntomentry_get_object_def; + at_rn->get_value = ip_ntomentry_get_value; + } + at_rn->set_test = noleafs_set_test; + at_rn->set_value = noleafs_set_value; + } + } + else + { + /* at_rn == NULL, malloc failure */ + LWIP_DEBUGF(SNMP_MIB_DEBUG,("snmp_insert_arpidx_tree() insert failed, mem full")); + break; + } + } + else + { + at_rn = (struct mib_list_rootnode*)at_node->nptr; + } + } + } + } + /* enable getnext traversal on filled tables */ + at.maxlength = 1; + ipntomtable.maxlength = 1; +} + +/** + * Removes ARP table indexes (.xIfIndex.xNetAddress) + * from arp table index trees. + */ +void snmp_delete_arpidx_tree(struct netif *ni, ip_addr_t *ip) +{ + struct mib_list_rootnode *at_rn, *next, *del_rn[5]; + struct mib_list_node *at_n, *del_n[5]; + s32_t arpidx[5]; + u8_t fc, tree, level, del_cnt; + + snmp_netiftoifindex(ni, &arpidx[0]); + snmp_iptooid(ip, &arpidx[1]); + + for (tree = 0; tree < 2; tree++) + { + /* mark nodes for deletion */ + if (tree == 0) + { + at_rn = &arptree_root; + } + else + { + at_rn = &ipntomtree_root; + } + level = 0; + del_cnt = 0; + while ((level < 5) && (at_rn != NULL)) + { + fc = snmp_mib_node_find(at_rn, arpidx[level], &at_n); + if (fc == 0) + { + /* arpidx[level] does not exist */ + del_cnt = 0; + at_rn = NULL; + } + else if (fc == 1) + { + del_rn[del_cnt] = at_rn; + del_n[del_cnt] = at_n; + del_cnt++; + at_rn = (struct mib_list_rootnode*)(at_n->nptr); + } + else if (fc == 2) + { + /* reset delete (2 or more childs) */ + del_cnt = 0; + at_rn = (struct mib_list_rootnode*)(at_n->nptr); + } + level++; + } + /* delete marked index nodes */ + while (del_cnt > 0) + { + del_cnt--; + + at_rn = del_rn[del_cnt]; + at_n = del_n[del_cnt]; + + next = snmp_mib_node_delete(at_rn, at_n); + if (next != NULL) + { + LWIP_ASSERT("next_count == 0",next->count == 0); + snmp_mib_lrn_free(next); + } + } + } + /* disable getnext traversal on empty tables */ + if(arptree_root.count == 0) at.maxlength = 0; + if(ipntomtree_root.count == 0) ipntomtable.maxlength = 0; +} + +void snmp_inc_ipinreceives(void) +{ + ipinreceives++; +} + +void snmp_inc_ipinhdrerrors(void) +{ + ipinhdrerrors++; +} + +void snmp_inc_ipinaddrerrors(void) +{ + ipinaddrerrors++; +} + +void snmp_inc_ipforwdatagrams(void) +{ + ipforwdatagrams++; +} + +void snmp_inc_ipinunknownprotos(void) +{ + ipinunknownprotos++; +} + +void snmp_inc_ipindiscards(void) +{ + ipindiscards++; +} + +void snmp_inc_ipindelivers(void) +{ + ipindelivers++; +} + +void snmp_inc_ipoutrequests(void) +{ + ipoutrequests++; +} + +void snmp_inc_ipoutdiscards(void) +{ + ipoutdiscards++; +} + +void snmp_inc_ipoutnoroutes(void) +{ + ipoutnoroutes++; +} + +void snmp_inc_ipreasmreqds(void) +{ + ipreasmreqds++; +} + +void snmp_inc_ipreasmoks(void) +{ + ipreasmoks++; +} + +void snmp_inc_ipreasmfails(void) +{ + ipreasmfails++; +} + +void snmp_inc_ipfragoks(void) +{ + ipfragoks++; +} + +void snmp_inc_ipfragfails(void) +{ + ipfragfails++; +} + +void snmp_inc_ipfragcreates(void) +{ + ipfragcreates++; +} + +void snmp_inc_iproutingdiscards(void) +{ + iproutingdiscards++; +} + +/** + * Inserts ipAddrTable indexes (.ipAdEntAddr) + * into index tree. + */ +void snmp_insert_ipaddridx_tree(struct netif *ni) +{ + struct mib_list_rootnode *ipa_rn; + struct mib_list_node *ipa_node; + s32_t ipaddridx[4]; + u8_t level; + + LWIP_ASSERT("ni != NULL", ni != NULL); + snmp_iptooid(&ni->ip_addr, &ipaddridx[0]); + + level = 0; + ipa_rn = &ipaddrtree_root; + while (level < 4) + { + ipa_node = NULL; + snmp_mib_node_insert(ipa_rn, ipaddridx[level], &ipa_node); + if ((level != 3) && (ipa_node != NULL)) + { + if (ipa_node->nptr == NULL) + { + ipa_rn = snmp_mib_lrn_alloc(); + ipa_node->nptr = (struct mib_node*)ipa_rn; + if (ipa_rn != NULL) + { + if (level == 2) + { + ipa_rn->get_object_def = ip_addrentry_get_object_def; + ipa_rn->get_value = ip_addrentry_get_value; + ipa_rn->set_test = noleafs_set_test; + ipa_rn->set_value = noleafs_set_value; + } + } + else + { + /* ipa_rn == NULL, malloc failure */ + LWIP_DEBUGF(SNMP_MIB_DEBUG,("snmp_insert_ipaddridx_tree() insert failed, mem full")); + break; + } + } + else + { + ipa_rn = (struct mib_list_rootnode*)ipa_node->nptr; + } + } + level++; + } + /* enable getnext traversal on filled table */ + ipaddrtable.maxlength = 1; +} + +/** + * Removes ipAddrTable indexes (.ipAdEntAddr) + * from index tree. + */ +void snmp_delete_ipaddridx_tree(struct netif *ni) +{ + struct mib_list_rootnode *ipa_rn, *next, *del_rn[4]; + struct mib_list_node *ipa_n, *del_n[4]; + s32_t ipaddridx[4]; + u8_t fc, level, del_cnt; + + LWIP_ASSERT("ni != NULL", ni != NULL); + snmp_iptooid(&ni->ip_addr, &ipaddridx[0]); + + /* mark nodes for deletion */ + level = 0; + del_cnt = 0; + ipa_rn = &ipaddrtree_root; + while ((level < 4) && (ipa_rn != NULL)) + { + fc = snmp_mib_node_find(ipa_rn, ipaddridx[level], &ipa_n); + if (fc == 0) + { + /* ipaddridx[level] does not exist */ + del_cnt = 0; + ipa_rn = NULL; + } + else if (fc == 1) + { + del_rn[del_cnt] = ipa_rn; + del_n[del_cnt] = ipa_n; + del_cnt++; + ipa_rn = (struct mib_list_rootnode*)(ipa_n->nptr); + } + else if (fc == 2) + { + /* reset delete (2 or more childs) */ + del_cnt = 0; + ipa_rn = (struct mib_list_rootnode*)(ipa_n->nptr); + } + level++; + } + /* delete marked index nodes */ + while (del_cnt > 0) + { + del_cnt--; + + ipa_rn = del_rn[del_cnt]; + ipa_n = del_n[del_cnt]; + + next = snmp_mib_node_delete(ipa_rn, ipa_n); + if (next != NULL) + { + LWIP_ASSERT("next_count == 0",next->count == 0); + snmp_mib_lrn_free(next); + } + } + /* disable getnext traversal on empty table */ + if (ipaddrtree_root.count == 0) ipaddrtable.maxlength = 0; +} + +/** + * Inserts ipRouteTable indexes (.ipRouteDest) + * into index tree. + * + * @param dflt non-zero for the default rte, zero for network rte + * @param ni points to network interface for this rte + * + * @todo record sysuptime for _this_ route when it is installed + * (needed for ipRouteAge) in the netif. + */ +void snmp_insert_iprteidx_tree(u8_t dflt, struct netif *ni) +{ + u8_t insert = 0; + ip_addr_t dst; + + if (dflt != 0) + { + /* the default route 0.0.0.0 */ + ip_addr_set_any(&dst); + insert = 1; + } + else + { + /* route to the network address */ + ip_addr_get_network(&dst, &ni->ip_addr, &ni->netmask); + /* exclude 0.0.0.0 network (reserved for default rte) */ + if (!ip_addr_isany(&dst)) { + insert = 1; + } + } + if (insert) + { + struct mib_list_rootnode *iprte_rn; + struct mib_list_node *iprte_node; + s32_t iprteidx[4]; + u8_t level; + + snmp_iptooid(&dst, &iprteidx[0]); + level = 0; + iprte_rn = &iprtetree_root; + while (level < 4) + { + iprte_node = NULL; + snmp_mib_node_insert(iprte_rn, iprteidx[level], &iprte_node); + if ((level != 3) && (iprte_node != NULL)) + { + if (iprte_node->nptr == NULL) + { + iprte_rn = snmp_mib_lrn_alloc(); + iprte_node->nptr = (struct mib_node*)iprte_rn; + if (iprte_rn != NULL) + { + if (level == 2) + { + iprte_rn->get_object_def = ip_rteentry_get_object_def; + iprte_rn->get_value = ip_rteentry_get_value; + iprte_rn->set_test = noleafs_set_test; + iprte_rn->set_value = noleafs_set_value; + } + } + else + { + /* iprte_rn == NULL, malloc failure */ + LWIP_DEBUGF(SNMP_MIB_DEBUG,("snmp_insert_iprteidx_tree() insert failed, mem full")); + break; + } + } + else + { + iprte_rn = (struct mib_list_rootnode*)iprte_node->nptr; + } + } + level++; + } + } + /* enable getnext traversal on filled table */ + iprtetable.maxlength = 1; +} + +/** + * Removes ipRouteTable indexes (.ipRouteDest) + * from index tree. + * + * @param dflt non-zero for the default rte, zero for network rte + * @param ni points to network interface for this rte or NULL + * for default route to be removed. + */ +void snmp_delete_iprteidx_tree(u8_t dflt, struct netif *ni) +{ + u8_t del = 0; + ip_addr_t dst; + + if (dflt != 0) + { + /* the default route 0.0.0.0 */ + ip_addr_set_any(&dst); + del = 1; + } + else + { + /* route to the network address */ + ip_addr_get_network(&dst, &ni->ip_addr, &ni->netmask); + /* exclude 0.0.0.0 network (reserved for default rte) */ + if (!ip_addr_isany(&dst)) { + del = 1; + } + } + if (del) + { + struct mib_list_rootnode *iprte_rn, *next, *del_rn[4]; + struct mib_list_node *iprte_n, *del_n[4]; + s32_t iprteidx[4]; + u8_t fc, level, del_cnt; + + snmp_iptooid(&dst, &iprteidx[0]); + /* mark nodes for deletion */ + level = 0; + del_cnt = 0; + iprte_rn = &iprtetree_root; + while ((level < 4) && (iprte_rn != NULL)) + { + fc = snmp_mib_node_find(iprte_rn, iprteidx[level], &iprte_n); + if (fc == 0) + { + /* iprteidx[level] does not exist */ + del_cnt = 0; + iprte_rn = NULL; + } + else if (fc == 1) + { + del_rn[del_cnt] = iprte_rn; + del_n[del_cnt] = iprte_n; + del_cnt++; + iprte_rn = (struct mib_list_rootnode*)(iprte_n->nptr); + } + else if (fc == 2) + { + /* reset delete (2 or more childs) */ + del_cnt = 0; + iprte_rn = (struct mib_list_rootnode*)(iprte_n->nptr); + } + level++; + } + /* delete marked index nodes */ + while (del_cnt > 0) + { + del_cnt--; + + iprte_rn = del_rn[del_cnt]; + iprte_n = del_n[del_cnt]; + + next = snmp_mib_node_delete(iprte_rn, iprte_n); + if (next != NULL) + { + LWIP_ASSERT("next_count == 0",next->count == 0); + snmp_mib_lrn_free(next); + } + } + } + /* disable getnext traversal on empty table */ + if (iprtetree_root.count == 0) iprtetable.maxlength = 0; +} + + +void snmp_inc_icmpinmsgs(void) +{ + icmpinmsgs++; +} + +void snmp_inc_icmpinerrors(void) +{ + icmpinerrors++; +} + +void snmp_inc_icmpindestunreachs(void) +{ + icmpindestunreachs++; +} + +void snmp_inc_icmpintimeexcds(void) +{ + icmpintimeexcds++; +} + +void snmp_inc_icmpinparmprobs(void) +{ + icmpinparmprobs++; +} + +void snmp_inc_icmpinsrcquenchs(void) +{ + icmpinsrcquenchs++; +} + +void snmp_inc_icmpinredirects(void) +{ + icmpinredirects++; +} + +void snmp_inc_icmpinechos(void) +{ + icmpinechos++; +} + +void snmp_inc_icmpinechoreps(void) +{ + icmpinechoreps++; +} + +void snmp_inc_icmpintimestamps(void) +{ + icmpintimestamps++; +} + +void snmp_inc_icmpintimestampreps(void) +{ + icmpintimestampreps++; +} + +void snmp_inc_icmpinaddrmasks(void) +{ + icmpinaddrmasks++; +} + +void snmp_inc_icmpinaddrmaskreps(void) +{ + icmpinaddrmaskreps++; +} + +void snmp_inc_icmpoutmsgs(void) +{ + icmpoutmsgs++; +} + +void snmp_inc_icmpouterrors(void) +{ + icmpouterrors++; +} + +void snmp_inc_icmpoutdestunreachs(void) +{ + icmpoutdestunreachs++; +} + +void snmp_inc_icmpouttimeexcds(void) +{ + icmpouttimeexcds++; +} + +void snmp_inc_icmpoutparmprobs(void) +{ + icmpoutparmprobs++; +} + +void snmp_inc_icmpoutsrcquenchs(void) +{ + icmpoutsrcquenchs++; +} + +void snmp_inc_icmpoutredirects(void) +{ + icmpoutredirects++; +} + +void snmp_inc_icmpoutechos(void) +{ + icmpoutechos++; +} + +void snmp_inc_icmpoutechoreps(void) +{ + icmpoutechoreps++; +} + +void snmp_inc_icmpouttimestamps(void) +{ + icmpouttimestamps++; +} + +void snmp_inc_icmpouttimestampreps(void) +{ + icmpouttimestampreps++; +} + +void snmp_inc_icmpoutaddrmasks(void) +{ + icmpoutaddrmasks++; +} + +void snmp_inc_icmpoutaddrmaskreps(void) +{ + icmpoutaddrmaskreps++; +} + +void snmp_inc_tcpactiveopens(void) +{ + tcpactiveopens++; +} + +void snmp_inc_tcppassiveopens(void) +{ + tcppassiveopens++; +} + +void snmp_inc_tcpattemptfails(void) +{ + tcpattemptfails++; +} + +void snmp_inc_tcpestabresets(void) +{ + tcpestabresets++; +} + +void snmp_inc_tcpinsegs(void) +{ + tcpinsegs++; +} + +void snmp_inc_tcpoutsegs(void) +{ + tcpoutsegs++; +} + +void snmp_inc_tcpretranssegs(void) +{ + tcpretranssegs++; +} + +void snmp_inc_tcpinerrs(void) +{ + tcpinerrs++; +} + +void snmp_inc_tcpoutrsts(void) +{ + tcpoutrsts++; +} + +void snmp_inc_udpindatagrams(void) +{ + udpindatagrams++; +} + +void snmp_inc_udpnoports(void) +{ + udpnoports++; +} + +void snmp_inc_udpinerrors(void) +{ + udpinerrors++; +} + +void snmp_inc_udpoutdatagrams(void) +{ + udpoutdatagrams++; +} + +/** + * Inserts udpTable indexes (.udpLocalAddress.udpLocalPort) + * into index tree. + */ +void snmp_insert_udpidx_tree(struct udp_pcb *pcb) +{ + struct mib_list_rootnode *udp_rn; + struct mib_list_node *udp_node; + s32_t udpidx[5]; + u8_t level; + + LWIP_ASSERT("pcb != NULL", pcb != NULL); + snmp_iptooid(&pcb->local_ip, &udpidx[0]); + udpidx[4] = pcb->local_port; + + udp_rn = &udp_root; + for (level = 0; level < 5; level++) + { + udp_node = NULL; + snmp_mib_node_insert(udp_rn, udpidx[level], &udp_node); + if ((level != 4) && (udp_node != NULL)) + { + if (udp_node->nptr == NULL) + { + udp_rn = snmp_mib_lrn_alloc(); + udp_node->nptr = (struct mib_node*)udp_rn; + if (udp_rn != NULL) + { + if (level == 3) + { + udp_rn->get_object_def = udpentry_get_object_def; + udp_rn->get_value = udpentry_get_value; + udp_rn->set_test = noleafs_set_test; + udp_rn->set_value = noleafs_set_value; + } + } + else + { + /* udp_rn == NULL, malloc failure */ + LWIP_DEBUGF(SNMP_MIB_DEBUG,("snmp_insert_udpidx_tree() insert failed, mem full")); + break; + } + } + else + { + udp_rn = (struct mib_list_rootnode*)udp_node->nptr; + } + } + } + udptable.maxlength = 1; +} + +/** + * Removes udpTable indexes (.udpLocalAddress.udpLocalPort) + * from index tree. + */ +void snmp_delete_udpidx_tree(struct udp_pcb *pcb) +{ + struct udp_pcb *npcb; + struct mib_list_rootnode *udp_rn, *next, *del_rn[5]; + struct mib_list_node *udp_n, *del_n[5]; + s32_t udpidx[5]; + u8_t bindings, fc, level, del_cnt; + + LWIP_ASSERT("pcb != NULL", pcb != NULL); + snmp_iptooid(&pcb->local_ip, &udpidx[0]); + udpidx[4] = pcb->local_port; + + /* count PCBs for a given binding + (e.g. when reusing ports or for temp output PCBs) */ + bindings = 0; + npcb = udp_pcbs; + while ((npcb != NULL)) + { + if (ip_addr_cmp(&npcb->local_ip, &pcb->local_ip) && + (npcb->local_port == udpidx[4])) + { + bindings++; + } + npcb = npcb->next; + } + if (bindings == 1) + { + /* selectively remove */ + /* mark nodes for deletion */ + level = 0; + del_cnt = 0; + udp_rn = &udp_root; + while ((level < 5) && (udp_rn != NULL)) + { + fc = snmp_mib_node_find(udp_rn, udpidx[level], &udp_n); + if (fc == 0) + { + /* udpidx[level] does not exist */ + del_cnt = 0; + udp_rn = NULL; + } + else if (fc == 1) + { + del_rn[del_cnt] = udp_rn; + del_n[del_cnt] = udp_n; + del_cnt++; + udp_rn = (struct mib_list_rootnode*)(udp_n->nptr); + } + else if (fc == 2) + { + /* reset delete (2 or more childs) */ + del_cnt = 0; + udp_rn = (struct mib_list_rootnode*)(udp_n->nptr); + } + level++; + } + /* delete marked index nodes */ + while (del_cnt > 0) + { + del_cnt--; + + udp_rn = del_rn[del_cnt]; + udp_n = del_n[del_cnt]; + + next = snmp_mib_node_delete(udp_rn, udp_n); + if (next != NULL) + { + LWIP_ASSERT("next_count == 0",next->count == 0); + snmp_mib_lrn_free(next); + } + } + } + /* disable getnext traversal on empty table */ + if (udp_root.count == 0) udptable.maxlength = 0; +} + + +void snmp_inc_snmpinpkts(void) +{ + snmpinpkts++; +} + +void snmp_inc_snmpoutpkts(void) +{ + snmpoutpkts++; +} + +void snmp_inc_snmpinbadversions(void) +{ + snmpinbadversions++; +} + +void snmp_inc_snmpinbadcommunitynames(void) +{ + snmpinbadcommunitynames++; +} + +void snmp_inc_snmpinbadcommunityuses(void) +{ + snmpinbadcommunityuses++; +} + +void snmp_inc_snmpinasnparseerrs(void) +{ + snmpinasnparseerrs++; +} + +void snmp_inc_snmpintoobigs(void) +{ + snmpintoobigs++; +} + +void snmp_inc_snmpinnosuchnames(void) +{ + snmpinnosuchnames++; +} + +void snmp_inc_snmpinbadvalues(void) +{ + snmpinbadvalues++; +} + +void snmp_inc_snmpinreadonlys(void) +{ + snmpinreadonlys++; +} + +void snmp_inc_snmpingenerrs(void) +{ + snmpingenerrs++; +} + +void snmp_add_snmpintotalreqvars(u8_t value) +{ + snmpintotalreqvars += value; +} + +void snmp_add_snmpintotalsetvars(u8_t value) +{ + snmpintotalsetvars += value; +} + +void snmp_inc_snmpingetrequests(void) +{ + snmpingetrequests++; +} + +void snmp_inc_snmpingetnexts(void) +{ + snmpingetnexts++; +} + +void snmp_inc_snmpinsetrequests(void) +{ + snmpinsetrequests++; +} + +void snmp_inc_snmpingetresponses(void) +{ + snmpingetresponses++; +} + +void snmp_inc_snmpintraps(void) +{ + snmpintraps++; +} + +void snmp_inc_snmpouttoobigs(void) +{ + snmpouttoobigs++; +} + +void snmp_inc_snmpoutnosuchnames(void) +{ + snmpoutnosuchnames++; +} + +void snmp_inc_snmpoutbadvalues(void) +{ + snmpoutbadvalues++; +} + +void snmp_inc_snmpoutgenerrs(void) +{ + snmpoutgenerrs++; +} + +void snmp_inc_snmpoutgetrequests(void) +{ + snmpoutgetrequests++; +} + +void snmp_inc_snmpoutgetnexts(void) +{ + snmpoutgetnexts++; +} + +void snmp_inc_snmpoutsetrequests(void) +{ + snmpoutsetrequests++; +} + +void snmp_inc_snmpoutgetresponses(void) +{ + snmpoutgetresponses++; +} + +void snmp_inc_snmpouttraps(void) +{ + snmpouttraps++; +} + +void snmp_get_snmpgrpid_ptr(struct snmp_obj_id **oid) +{ + *oid = &snmpgrp_id; +} + +void snmp_set_snmpenableauthentraps(u8_t *value) +{ + if (value != NULL) + { + snmpenableauthentraps_ptr = value; + } +} + +void snmp_get_snmpenableauthentraps(u8_t *value) +{ + *value = *snmpenableauthentraps_ptr; +} + +void +noleafs_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od) +{ + LWIP_UNUSED_ARG(ident_len); + LWIP_UNUSED_ARG(ident); + od->instance = MIB_OBJECT_NONE; +} + +void +noleafs_get_value(struct obj_def *od, u16_t len, void *value) +{ + LWIP_UNUSED_ARG(od); + LWIP_UNUSED_ARG(len); + LWIP_UNUSED_ARG(value); +} + +u8_t +noleafs_set_test(struct obj_def *od, u16_t len, void *value) +{ + LWIP_UNUSED_ARG(od); + LWIP_UNUSED_ARG(len); + LWIP_UNUSED_ARG(value); + /* can't set */ + return 0; +} + +void +noleafs_set_value(struct obj_def *od, u16_t len, void *value) +{ + LWIP_UNUSED_ARG(od); + LWIP_UNUSED_ARG(len); + LWIP_UNUSED_ARG(value); +} + + +/** + * Returns systems object definitions. + * + * @param ident_len the address length (2) + * @param ident points to objectname.0 (object id trailer) + * @param od points to object definition. + */ +static void +system_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od) +{ + u8_t id; + + /* return to object name, adding index depth (1) */ + ident_len += 1; + ident -= 1; + if (ident_len == 2) + { + od->id_inst_len = ident_len; + od->id_inst_ptr = ident; + + LWIP_ASSERT("invalid id", (ident[0] >= 0) && (ident[0] <= 0xff)); + id = (u8_t)ident[0]; + LWIP_DEBUGF(SNMP_MIB_DEBUG,("get_object_def system.%"U16_F".0\n",(u16_t)id)); + switch (id) + { + case 1: /* sysDescr */ + od->instance = MIB_OBJECT_SCALAR; + od->access = MIB_OBJECT_READ_ONLY; + od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OC_STR); + od->v_len = *sysdescr_len_ptr; + break; + case 2: /* sysObjectID */ + od->instance = MIB_OBJECT_SCALAR; + od->access = MIB_OBJECT_READ_ONLY; + od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OBJ_ID); + od->v_len = sysobjid.len * sizeof(s32_t); + break; + case 3: /* sysUpTime */ + od->instance = MIB_OBJECT_SCALAR; + od->access = MIB_OBJECT_READ_ONLY; + od->asn_type = (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_TIMETICKS); + od->v_len = sizeof(u32_t); + break; + case 4: /* sysContact */ + od->instance = MIB_OBJECT_SCALAR; + od->access = MIB_OBJECT_READ_WRITE; + od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OC_STR); + od->v_len = *syscontact_len_ptr; + break; + case 5: /* sysName */ + od->instance = MIB_OBJECT_SCALAR; + od->access = MIB_OBJECT_READ_WRITE; + od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OC_STR); + od->v_len = *sysname_len_ptr; + break; + case 6: /* sysLocation */ + od->instance = MIB_OBJECT_SCALAR; + od->access = MIB_OBJECT_READ_WRITE; + od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OC_STR); + od->v_len = *syslocation_len_ptr; + break; + case 7: /* sysServices */ + od->instance = MIB_OBJECT_SCALAR; + od->access = MIB_OBJECT_READ_ONLY; + od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG); + od->v_len = sizeof(s32_t); + break; + default: + LWIP_DEBUGF(SNMP_MIB_DEBUG,("system_get_object_def: no such object\n")); + od->instance = MIB_OBJECT_NONE; + break; + }; + } + else + { + LWIP_DEBUGF(SNMP_MIB_DEBUG,("system_get_object_def: no scalar\n")); + od->instance = MIB_OBJECT_NONE; + } +} + +/** + * Returns system object value. + * + * @param ident_len the address length (2) + * @param ident points to objectname.0 (object id trailer) + * @param len return value space (in bytes) + * @param value points to (varbind) space to copy value into. + */ +static void +system_get_value(struct obj_def *od, u16_t len, void *value) +{ + u8_t id; + + LWIP_ASSERT("invalid id", (od->id_inst_ptr[0] >= 0) && (od->id_inst_ptr[0] <= 0xff)); + id = (u8_t)od->id_inst_ptr[0]; + switch (id) + { + case 1: /* sysDescr */ + ocstrncpy((u8_t*)value, sysdescr_ptr, len); + break; + case 2: /* sysObjectID */ + objectidncpy((s32_t*)value, (s32_t*)sysobjid.id, (u8_t)(len / sizeof(s32_t))); + break; + case 3: /* sysUpTime */ + { + snmp_get_sysuptime((u32_t*)value); + } + break; + case 4: /* sysContact */ + ocstrncpy((u8_t*)value, syscontact_ptr, len); + break; + case 5: /* sysName */ + ocstrncpy((u8_t*)value, sysname_ptr, len); + break; + case 6: /* sysLocation */ + ocstrncpy((u8_t*)value, syslocation_ptr, len); + break; + case 7: /* sysServices */ + { + s32_t *sint_ptr = (s32_t*)value; + *sint_ptr = sysservices; + } + break; + }; +} + +static u8_t +system_set_test(struct obj_def *od, u16_t len, void *value) +{ + u8_t id, set_ok; + + LWIP_UNUSED_ARG(value); + set_ok = 0; + LWIP_ASSERT("invalid id", (od->id_inst_ptr[0] >= 0) && (od->id_inst_ptr[0] <= 0xff)); + id = (u8_t)od->id_inst_ptr[0]; + switch (id) + { + case 4: /* sysContact */ + if ((syscontact_ptr != syscontact_default) && + (len <= 255)) + { + set_ok = 1; + } + break; + case 5: /* sysName */ + if ((sysname_ptr != sysname_default) && + (len <= 255)) + { + set_ok = 1; + } + break; + case 6: /* sysLocation */ + if ((syslocation_ptr != syslocation_default) && + (len <= 255)) + { + set_ok = 1; + } + break; + }; + return set_ok; +} + +static void +system_set_value(struct obj_def *od, u16_t len, void *value) +{ + u8_t id; + + LWIP_ASSERT("invalid len", len <= 0xff); + LWIP_ASSERT("invalid id", (od->id_inst_ptr[0] >= 0) && (od->id_inst_ptr[0] <= 0xff)); + id = (u8_t)od->id_inst_ptr[0]; + switch (id) + { + case 4: /* sysContact */ + ocstrncpy(syscontact_ptr, (u8_t*)value, len); + *syscontact_len_ptr = (u8_t)len; + break; + case 5: /* sysName */ + ocstrncpy(sysname_ptr, (u8_t*)value, len); + *sysname_len_ptr = (u8_t)len; + break; + case 6: /* sysLocation */ + ocstrncpy(syslocation_ptr, (u8_t*)value, len); + *syslocation_len_ptr = (u8_t)len; + break; + }; +} + +/** + * Returns interfaces.ifnumber object definition. + * + * @param ident_len the address length (2) + * @param ident points to objectname.index + * @param od points to object definition. + */ +static void +interfaces_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od) +{ + /* return to object name, adding index depth (1) */ + ident_len += 1; + ident -= 1; + if (ident_len == 2) + { + od->id_inst_len = ident_len; + od->id_inst_ptr = ident; + + od->instance = MIB_OBJECT_SCALAR; + od->access = MIB_OBJECT_READ_ONLY; + od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG); + od->v_len = sizeof(s32_t); + } + else + { + LWIP_DEBUGF(SNMP_MIB_DEBUG,("interfaces_get_object_def: no scalar\n")); + od->instance = MIB_OBJECT_NONE; + } +} + +/** + * Returns interfaces.ifnumber object value. + * + * @param ident_len the address length (2) + * @param ident points to objectname.0 (object id trailer) + * @param len return value space (in bytes) + * @param value points to (varbind) space to copy value into. + */ +static void +interfaces_get_value(struct obj_def *od, u16_t len, void *value) +{ + LWIP_UNUSED_ARG(len); + if (od->id_inst_ptr[0] == 1) + { + s32_t *sint_ptr = (s32_t*)value; + *sint_ptr = iflist_root.count; + } +} + +/** + * Returns ifentry object definitions. + * + * @param ident_len the address length (2) + * @param ident points to objectname.index + * @param od points to object definition. + */ +static void +ifentry_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od) +{ + u8_t id; + + /* return to object name, adding index depth (1) */ + ident_len += 1; + ident -= 1; + if (ident_len == 2) + { + od->id_inst_len = ident_len; + od->id_inst_ptr = ident; + + LWIP_ASSERT("invalid id", (ident[0] >= 0) && (ident[0] <= 0xff)); + id = (u8_t)ident[0]; + LWIP_DEBUGF(SNMP_MIB_DEBUG,("get_object_def ifentry.%"U16_F"\n",(u16_t)id)); + switch (id) + { + case 1: /* ifIndex */ + case 3: /* ifType */ + case 4: /* ifMtu */ + case 8: /* ifOperStatus */ + od->instance = MIB_OBJECT_TAB; + od->access = MIB_OBJECT_READ_ONLY; + od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG); + od->v_len = sizeof(s32_t); + break; + case 2: /* ifDescr */ + od->instance = MIB_OBJECT_TAB; + od->access = MIB_OBJECT_READ_ONLY; + od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OC_STR); + /** @todo this should be some sort of sizeof(struct netif.name) */ + od->v_len = 2; + break; + case 5: /* ifSpeed */ + case 21: /* ifOutQLen */ + od->instance = MIB_OBJECT_TAB; + od->access = MIB_OBJECT_READ_ONLY; + od->asn_type = (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_GAUGE); + od->v_len = sizeof(u32_t); + break; + case 6: /* ifPhysAddress */ + { + struct netif *netif; + + snmp_ifindextonetif(ident[1], &netif); + od->instance = MIB_OBJECT_TAB; + od->access = MIB_OBJECT_READ_ONLY; + od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OC_STR); + od->v_len = netif->hwaddr_len; + } + break; + case 7: /* ifAdminStatus */ + od->instance = MIB_OBJECT_TAB; + od->access = MIB_OBJECT_READ_WRITE; + od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG); + od->v_len = sizeof(s32_t); + break; + case 9: /* ifLastChange */ + od->instance = MIB_OBJECT_TAB; + od->access = MIB_OBJECT_READ_ONLY; + od->asn_type = (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_TIMETICKS); + od->v_len = sizeof(u32_t); + break; + case 10: /* ifInOctets */ + case 11: /* ifInUcastPkts */ + case 12: /* ifInNUcastPkts */ + case 13: /* ifInDiscarts */ + case 14: /* ifInErrors */ + case 15: /* ifInUnkownProtos */ + case 16: /* ifOutOctets */ + case 17: /* ifOutUcastPkts */ + case 18: /* ifOutNUcastPkts */ + case 19: /* ifOutDiscarts */ + case 20: /* ifOutErrors */ + od->instance = MIB_OBJECT_TAB; + od->access = MIB_OBJECT_READ_ONLY; + od->asn_type = (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_COUNTER); + od->v_len = sizeof(u32_t); + break; + case 22: /* ifSpecific */ + /** @note returning zeroDotZero (0.0) no media specific MIB support */ + od->instance = MIB_OBJECT_TAB; + od->access = MIB_OBJECT_READ_ONLY; + od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OBJ_ID); + od->v_len = ifspecific.len * sizeof(s32_t); + break; + default: + LWIP_DEBUGF(SNMP_MIB_DEBUG,("ifentry_get_object_def: no such object\n")); + od->instance = MIB_OBJECT_NONE; + break; + }; + } + else + { + LWIP_DEBUGF(SNMP_MIB_DEBUG,("ifentry_get_object_def: no scalar\n")); + od->instance = MIB_OBJECT_NONE; + } +} + +/** + * Returns ifentry object value. + * + * @param ident_len the address length (2) + * @param ident points to objectname.0 (object id trailer) + * @param len return value space (in bytes) + * @param value points to (varbind) space to copy value into. + */ +static void +ifentry_get_value(struct obj_def *od, u16_t len, void *value) +{ + struct netif *netif; + u8_t id; + + snmp_ifindextonetif(od->id_inst_ptr[1], &netif); + LWIP_ASSERT("invalid id", (od->id_inst_ptr[0] >= 0) && (od->id_inst_ptr[0] <= 0xff)); + id = (u8_t)od->id_inst_ptr[0]; + switch (id) + { + case 1: /* ifIndex */ + { + s32_t *sint_ptr = (s32_t*)value; + *sint_ptr = od->id_inst_ptr[1]; + } + break; + case 2: /* ifDescr */ + ocstrncpy((u8_t*)value, (u8_t*)netif->name, len); + break; + case 3: /* ifType */ + { + s32_t *sint_ptr = (s32_t*)value; + *sint_ptr = netif->link_type; + } + break; + case 4: /* ifMtu */ + { + s32_t *sint_ptr = (s32_t*)value; + *sint_ptr = netif->mtu; + } + break; + case 5: /* ifSpeed */ + { + u32_t *uint_ptr = (u32_t*)value; + *uint_ptr = netif->link_speed; + } + break; + case 6: /* ifPhysAddress */ + ocstrncpy((u8_t*)value, netif->hwaddr, len); + break; + case 7: /* ifAdminStatus */ + { + s32_t *sint_ptr = (s32_t*)value; + if (netif_is_up(netif)) + { + if (netif_is_link_up(netif)) + { + *sint_ptr = 1; /* up */ + } + else + { + *sint_ptr = 7; /* lowerLayerDown */ + } + } + else + { + *sint_ptr = 2; /* down */ + } + } + break; + case 8: /* ifOperStatus */ + { + s32_t *sint_ptr = (s32_t*)value; + if (netif_is_up(netif)) + { + *sint_ptr = 1; + } + else + { + *sint_ptr = 2; + } + } + break; + case 9: /* ifLastChange */ + { + u32_t *uint_ptr = (u32_t*)value; + *uint_ptr = netif->ts; + } + break; + case 10: /* ifInOctets */ + { + u32_t *uint_ptr = (u32_t*)value; + *uint_ptr = netif->ifinoctets; + } + break; + case 11: /* ifInUcastPkts */ + { + u32_t *uint_ptr = (u32_t*)value; + *uint_ptr = netif->ifinucastpkts; + } + break; + case 12: /* ifInNUcastPkts */ + { + u32_t *uint_ptr = (u32_t*)value; + *uint_ptr = netif->ifinnucastpkts; + } + break; + case 13: /* ifInDiscarts */ + { + u32_t *uint_ptr = (u32_t*)value; + *uint_ptr = netif->ifindiscards; + } + break; + case 14: /* ifInErrors */ + case 15: /* ifInUnkownProtos */ + /** @todo add these counters! */ + { + u32_t *uint_ptr = (u32_t*)value; + *uint_ptr = 0; + } + break; + case 16: /* ifOutOctets */ + { + u32_t *uint_ptr = (u32_t*)value; + *uint_ptr = netif->ifoutoctets; + } + break; + case 17: /* ifOutUcastPkts */ + { + u32_t *uint_ptr = (u32_t*)value; + *uint_ptr = netif->ifoutucastpkts; + } + break; + case 18: /* ifOutNUcastPkts */ + { + u32_t *uint_ptr = (u32_t*)value; + *uint_ptr = netif->ifoutnucastpkts; + } + break; + case 19: /* ifOutDiscarts */ + { + u32_t *uint_ptr = (u32_t*)value; + *uint_ptr = netif->ifoutdiscards; + } + break; + case 20: /* ifOutErrors */ + /** @todo add this counter! */ + { + u32_t *uint_ptr = (u32_t*)value; + *uint_ptr = 0; + } + break; + case 21: /* ifOutQLen */ + /** @todo figure out if this must be 0 (no queue) or 1? */ + { + u32_t *uint_ptr = (u32_t*)value; + *uint_ptr = 0; + } + break; + case 22: /* ifSpecific */ + objectidncpy((s32_t*)value, (s32_t*)ifspecific.id, (u8_t)(len / sizeof(s32_t))); + break; + }; +} + +#if !SNMP_SAFE_REQUESTS +static u8_t +ifentry_set_test(struct obj_def *od, u16_t len, void *value) +{ + struct netif *netif; + u8_t id, set_ok; + LWIP_UNUSED_ARG(len); + + set_ok = 0; + snmp_ifindextonetif(od->id_inst_ptr[1], &netif); + id = (u8_t)od->id_inst_ptr[0]; + switch (id) + { + case 7: /* ifAdminStatus */ + { + s32_t *sint_ptr = (s32_t*)value; + if (*sint_ptr == 1 || *sint_ptr == 2) + set_ok = 1; + } + break; + } + return set_ok; +} + +static void +ifentry_set_value(struct obj_def *od, u16_t len, void *value) +{ + struct netif *netif; + u8_t id; + LWIP_UNUSED_ARG(len); + + snmp_ifindextonetif(od->id_inst_ptr[1], &netif); + id = (u8_t)od->id_inst_ptr[0]; + switch (id) + { + case 7: /* ifAdminStatus */ + { + s32_t *sint_ptr = (s32_t*)value; + if (*sint_ptr == 1) + { + netif_set_up(netif); + } + else if (*sint_ptr == 2) + { + netif_set_down(netif); + } + } + break; + } +} +#endif /* SNMP_SAFE_REQUESTS */ + +/** + * Returns atentry object definitions. + * + * @param ident_len the address length (6) + * @param ident points to objectname.atifindex.atnetaddress + * @param od points to object definition. + */ +static void +atentry_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od) +{ + /* return to object name, adding index depth (5) */ + ident_len += 5; + ident -= 5; + + if (ident_len == 6) + { + od->id_inst_len = ident_len; + od->id_inst_ptr = ident; + + switch (ident[0]) + { + case 1: /* atIfIndex */ + od->instance = MIB_OBJECT_TAB; + od->access = MIB_OBJECT_READ_WRITE; + od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG); + od->v_len = sizeof(s32_t); + break; + case 2: /* atPhysAddress */ + od->instance = MIB_OBJECT_TAB; + od->access = MIB_OBJECT_READ_WRITE; + od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OC_STR); + od->v_len = 6; /** @todo try to use netif::hwaddr_len */ + break; + case 3: /* atNetAddress */ + od->instance = MIB_OBJECT_TAB; + od->access = MIB_OBJECT_READ_WRITE; + od->asn_type = (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_IPADDR); + od->v_len = 4; + break; + default: + LWIP_DEBUGF(SNMP_MIB_DEBUG,("atentry_get_object_def: no such object\n")); + od->instance = MIB_OBJECT_NONE; + break; + } + } + else + { + LWIP_DEBUGF(SNMP_MIB_DEBUG,("atentry_get_object_def: no scalar\n")); + od->instance = MIB_OBJECT_NONE; + } +} + +static void +atentry_get_value(struct obj_def *od, u16_t len, void *value) +{ +#if LWIP_ARP + u8_t id; + struct eth_addr* ethaddr_ret; + ip_addr_t* ipaddr_ret; +#endif /* LWIP_ARP */ + ip_addr_t ip; + struct netif *netif; + + LWIP_UNUSED_ARG(len); + LWIP_UNUSED_ARG(value);/* if !LWIP_ARP */ + + snmp_ifindextonetif(od->id_inst_ptr[1], &netif); + snmp_oidtoip(&od->id_inst_ptr[2], &ip); + +#if LWIP_ARP /** @todo implement a netif_find_addr */ + if (etharp_find_addr(netif, &ip, ðaddr_ret, &ipaddr_ret) > -1) + { + LWIP_ASSERT("invalid id", (od->id_inst_ptr[0] >= 0) && (od->id_inst_ptr[0] <= 0xff)); + id = (u8_t)od->id_inst_ptr[0]; + switch (id) + { + case 1: /* atIfIndex */ + { + s32_t *sint_ptr = (s32_t*)value; + *sint_ptr = od->id_inst_ptr[1]; + } + break; + case 2: /* atPhysAddress */ + { + struct eth_addr *dst = (struct eth_addr*)value; + + *dst = *ethaddr_ret; + } + break; + case 3: /* atNetAddress */ + { + ip_addr_t *dst = (ip_addr_t*)value; + + *dst = *ipaddr_ret; + } + break; + } + } +#endif /* LWIP_ARP */ +} + +static void +ip_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od) +{ + u8_t id; + + /* return to object name, adding index depth (1) */ + ident_len += 1; + ident -= 1; + if (ident_len == 2) + { + od->id_inst_len = ident_len; + od->id_inst_ptr = ident; + + LWIP_ASSERT("invalid id", (ident[0] >= 0) && (ident[0] <= 0xff)); + id = (u8_t)ident[0]; + LWIP_DEBUGF(SNMP_MIB_DEBUG,("get_object_def ip.%"U16_F".0\n",(u16_t)id)); + switch (id) + { + case 1: /* ipForwarding */ + case 2: /* ipDefaultTTL */ + od->instance = MIB_OBJECT_SCALAR; + od->access = MIB_OBJECT_READ_WRITE; + od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG); + od->v_len = sizeof(s32_t); + break; + case 3: /* ipInReceives */ + case 4: /* ipInHdrErrors */ + case 5: /* ipInAddrErrors */ + case 6: /* ipForwDatagrams */ + case 7: /* ipInUnknownProtos */ + case 8: /* ipInDiscards */ + case 9: /* ipInDelivers */ + case 10: /* ipOutRequests */ + case 11: /* ipOutDiscards */ + case 12: /* ipOutNoRoutes */ + case 14: /* ipReasmReqds */ + case 15: /* ipReasmOKs */ + case 16: /* ipReasmFails */ + case 17: /* ipFragOKs */ + case 18: /* ipFragFails */ + case 19: /* ipFragCreates */ + case 23: /* ipRoutingDiscards */ + od->instance = MIB_OBJECT_SCALAR; + od->access = MIB_OBJECT_READ_ONLY; + od->asn_type = (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_COUNTER); + od->v_len = sizeof(u32_t); + break; + case 13: /* ipReasmTimeout */ + od->instance = MIB_OBJECT_SCALAR; + od->access = MIB_OBJECT_READ_ONLY; + od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG); + od->v_len = sizeof(s32_t); + break; + default: + LWIP_DEBUGF(SNMP_MIB_DEBUG,("ip_get_object_def: no such object\n")); + od->instance = MIB_OBJECT_NONE; + break; + }; + } + else + { + LWIP_DEBUGF(SNMP_MIB_DEBUG,("ip_get_object_def: no scalar\n")); + od->instance = MIB_OBJECT_NONE; + } +} + +static void +ip_get_value(struct obj_def *od, u16_t len, void *value) +{ + u8_t id; + + LWIP_UNUSED_ARG(len); + LWIP_ASSERT("invalid id", (od->id_inst_ptr[0] >= 0) && (od->id_inst_ptr[0] <= 0xff)); + id = (u8_t)od->id_inst_ptr[0]; + switch (id) + { + case 1: /* ipForwarding */ + { + s32_t *sint_ptr = (s32_t*)value; +#if IP_FORWARD + /* forwarding */ + *sint_ptr = 1; +#else + /* not-forwarding */ + *sint_ptr = 2; +#endif + } + break; + case 2: /* ipDefaultTTL */ + { + s32_t *sint_ptr = (s32_t*)value; + *sint_ptr = IP_DEFAULT_TTL; + } + break; + case 3: /* ipInReceives */ + { + u32_t *uint_ptr = (u32_t*)value; + *uint_ptr = ipinreceives; + } + break; + case 4: /* ipInHdrErrors */ + { + u32_t *uint_ptr = (u32_t*)value; + *uint_ptr = ipinhdrerrors; + } + break; + case 5: /* ipInAddrErrors */ + { + u32_t *uint_ptr = (u32_t*)value; + *uint_ptr = ipinaddrerrors; + } + break; + case 6: /* ipForwDatagrams */ + { + u32_t *uint_ptr = (u32_t*)value; + *uint_ptr = ipforwdatagrams; + } + break; + case 7: /* ipInUnknownProtos */ + { + u32_t *uint_ptr = (u32_t*)value; + *uint_ptr = ipinunknownprotos; + } + break; + case 8: /* ipInDiscards */ + { + u32_t *uint_ptr = (u32_t*)value; + *uint_ptr = ipindiscards; + } + break; + case 9: /* ipInDelivers */ + { + u32_t *uint_ptr = (u32_t*)value; + *uint_ptr = ipindelivers; + } + break; + case 10: /* ipOutRequests */ + { + u32_t *uint_ptr = (u32_t*)value; + *uint_ptr = ipoutrequests; + } + break; + case 11: /* ipOutDiscards */ + { + u32_t *uint_ptr = (u32_t*)value; + *uint_ptr = ipoutdiscards; + } + break; + case 12: /* ipOutNoRoutes */ + { + u32_t *uint_ptr = (u32_t*)value; + *uint_ptr = ipoutnoroutes; + } + break; + case 13: /* ipReasmTimeout */ + { + s32_t *sint_ptr = (s32_t*)value; +#if IP_REASSEMBLY + *sint_ptr = IP_REASS_MAXAGE; +#else + *sint_ptr = 0; +#endif + } + break; + case 14: /* ipReasmReqds */ + { + u32_t *uint_ptr = (u32_t*)value; + *uint_ptr = ipreasmreqds; + } + break; + case 15: /* ipReasmOKs */ + { + u32_t *uint_ptr = (u32_t*)value; + *uint_ptr = ipreasmoks; + } + break; + case 16: /* ipReasmFails */ + { + u32_t *uint_ptr = (u32_t*)value; + *uint_ptr = ipreasmfails; + } + break; + case 17: /* ipFragOKs */ + { + u32_t *uint_ptr = (u32_t*)value; + *uint_ptr = ipfragoks; + } + break; + case 18: /* ipFragFails */ + { + u32_t *uint_ptr = (u32_t*)value; + *uint_ptr = ipfragfails; + } + break; + case 19: /* ipFragCreates */ + { + u32_t *uint_ptr = (u32_t*)value; + *uint_ptr = ipfragcreates; + } + break; + case 23: /* ipRoutingDiscards */ + /** @todo can lwIP discard routes at all?? hardwire this to 0?? */ + { + u32_t *uint_ptr = (u32_t*)value; + *uint_ptr = iproutingdiscards; + } + break; + }; +} + +/** + * Test ip object value before setting. + * + * @param od is the object definition + * @param len return value space (in bytes) + * @param value points to (varbind) space to copy value from. + * + * @note we allow set if the value matches the hardwired value, + * otherwise return badvalue. + */ +static u8_t +ip_set_test(struct obj_def *od, u16_t len, void *value) +{ + u8_t id, set_ok; + s32_t *sint_ptr = (s32_t*)value; + + LWIP_UNUSED_ARG(len); + set_ok = 0; + LWIP_ASSERT("invalid id", (od->id_inst_ptr[0] >= 0) && (od->id_inst_ptr[0] <= 0xff)); + id = (u8_t)od->id_inst_ptr[0]; + switch (id) + { + case 1: /* ipForwarding */ +#if IP_FORWARD + /* forwarding */ + if (*sint_ptr == 1) +#else + /* not-forwarding */ + if (*sint_ptr == 2) +#endif + { + set_ok = 1; + } + break; + case 2: /* ipDefaultTTL */ + if (*sint_ptr == IP_DEFAULT_TTL) + { + set_ok = 1; + } + break; + }; + return set_ok; +} + +static void +ip_addrentry_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od) +{ + /* return to object name, adding index depth (4) */ + ident_len += 4; + ident -= 4; + + if (ident_len == 5) + { + u8_t id; + + od->id_inst_len = ident_len; + od->id_inst_ptr = ident; + + LWIP_ASSERT("invalid id", (ident[0] >= 0) && (ident[0] <= 0xff)); + id = (u8_t)ident[0]; + switch (id) + { + case 1: /* ipAdEntAddr */ + case 3: /* ipAdEntNetMask */ + od->instance = MIB_OBJECT_TAB; + od->access = MIB_OBJECT_READ_ONLY; + od->asn_type = (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_IPADDR); + od->v_len = 4; + break; + case 2: /* ipAdEntIfIndex */ + case 4: /* ipAdEntBcastAddr */ + case 5: /* ipAdEntReasmMaxSize */ + od->instance = MIB_OBJECT_TAB; + od->access = MIB_OBJECT_READ_ONLY; + od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG); + od->v_len = sizeof(s32_t); + break; + default: + LWIP_DEBUGF(SNMP_MIB_DEBUG,("ip_addrentry_get_object_def: no such object\n")); + od->instance = MIB_OBJECT_NONE; + break; + } + } + else + { + LWIP_DEBUGF(SNMP_MIB_DEBUG,("ip_addrentry_get_object_def: no scalar\n")); + od->instance = MIB_OBJECT_NONE; + } +} + +static void +ip_addrentry_get_value(struct obj_def *od, u16_t len, void *value) +{ + u8_t id; + u16_t ifidx; + ip_addr_t ip; + struct netif *netif = netif_list; + + LWIP_UNUSED_ARG(len); + snmp_oidtoip(&od->id_inst_ptr[1], &ip); + ifidx = 0; + while ((netif != NULL) && !ip_addr_cmp(&ip, &netif->ip_addr)) + { + netif = netif->next; + ifidx++; + } + + if (netif != NULL) + { + LWIP_ASSERT("invalid id", (od->id_inst_ptr[0] >= 0) && (od->id_inst_ptr[0] <= 0xff)); + id = (u8_t)od->id_inst_ptr[0]; + switch (id) + { + case 1: /* ipAdEntAddr */ + { + ip_addr_t *dst = (ip_addr_t*)value; + *dst = netif->ip_addr; + } + break; + case 2: /* ipAdEntIfIndex */ + { + s32_t *sint_ptr = (s32_t*)value; + *sint_ptr = ifidx + 1; + } + break; + case 3: /* ipAdEntNetMask */ + { + ip_addr_t *dst = (ip_addr_t*)value; + *dst = netif->netmask; + } + break; + case 4: /* ipAdEntBcastAddr */ + { + s32_t *sint_ptr = (s32_t*)value; + + /* lwIP oddity, there's no broadcast + address in the netif we can rely on */ + *sint_ptr = IPADDR_BROADCAST & 1; + } + break; + case 5: /* ipAdEntReasmMaxSize */ + { + s32_t *sint_ptr = (s32_t*)value; +#if IP_REASSEMBLY + /* @todo The theoretical maximum is IP_REASS_MAX_PBUFS * size of the pbufs, + * but only if receiving one fragmented packet at a time. + * The current solution is to calculate for 2 simultaneous packets... + */ + *sint_ptr = (IP_HLEN + ((IP_REASS_MAX_PBUFS/2) * + (PBUF_POOL_BUFSIZE - PBUF_LINK_HLEN - IP_HLEN))); +#else + /** @todo returning MTU would be a bad thing and + returning a wild guess like '576' isn't good either */ + *sint_ptr = 0; +#endif + } + break; + } + } +} + +/** + * @note + * lwIP IP routing is currently using the network addresses in netif_list. + * if no suitable network IP is found in netif_list, the default_netif is used. + */ +static void +ip_rteentry_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od) +{ + u8_t id; + + /* return to object name, adding index depth (4) */ + ident_len += 4; + ident -= 4; + + if (ident_len == 5) + { + od->id_inst_len = ident_len; + od->id_inst_ptr = ident; + + LWIP_ASSERT("invalid id", (ident[0] >= 0) && (ident[0] <= 0xff)); + id = (u8_t)ident[0]; + switch (id) + { + case 1: /* ipRouteDest */ + case 7: /* ipRouteNextHop */ + case 11: /* ipRouteMask */ + od->instance = MIB_OBJECT_TAB; + od->access = MIB_OBJECT_READ_WRITE; + od->asn_type = (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_IPADDR); + od->v_len = 4; + break; + case 2: /* ipRouteIfIndex */ + case 3: /* ipRouteMetric1 */ + case 4: /* ipRouteMetric2 */ + case 5: /* ipRouteMetric3 */ + case 6: /* ipRouteMetric4 */ + case 8: /* ipRouteType */ + case 10: /* ipRouteAge */ + case 12: /* ipRouteMetric5 */ + od->instance = MIB_OBJECT_TAB; + od->access = MIB_OBJECT_READ_WRITE; + od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG); + od->v_len = sizeof(s32_t); + break; + case 9: /* ipRouteProto */ + od->instance = MIB_OBJECT_TAB; + od->access = MIB_OBJECT_READ_ONLY; + od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG); + od->v_len = sizeof(s32_t); + break; + case 13: /* ipRouteInfo */ + /** @note returning zeroDotZero (0.0) no routing protocol specific MIB */ + od->instance = MIB_OBJECT_TAB; + od->access = MIB_OBJECT_READ_ONLY; + od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OBJ_ID); + od->v_len = iprouteinfo.len * sizeof(s32_t); + break; + default: + LWIP_DEBUGF(SNMP_MIB_DEBUG,("ip_rteentry_get_object_def: no such object\n")); + od->instance = MIB_OBJECT_NONE; + break; + } + } + else + { + LWIP_DEBUGF(SNMP_MIB_DEBUG,("ip_rteentry_get_object_def: no scalar\n")); + od->instance = MIB_OBJECT_NONE; + } +} + +static void +ip_rteentry_get_value(struct obj_def *od, u16_t len, void *value) +{ + struct netif *netif; + ip_addr_t dest; + s32_t *ident; + u8_t id; + + ident = od->id_inst_ptr; + snmp_oidtoip(&ident[1], &dest); + + if (ip_addr_isany(&dest)) + { + /* ip_route() uses default netif for default route */ + netif = netif_default; + } + else + { + /* not using ip_route(), need exact match! */ + netif = netif_list; + while ((netif != NULL) && + !ip_addr_netcmp(&dest, &(netif->ip_addr), &(netif->netmask)) ) + { + netif = netif->next; + } + } + if (netif != NULL) + { + LWIP_ASSERT("invalid id", (ident[0] >= 0) && (ident[0] <= 0xff)); + id = (u8_t)ident[0]; + switch (id) + { + case 1: /* ipRouteDest */ + { + ip_addr_t *dst = (ip_addr_t*)value; + + if (ip_addr_isany(&dest)) + { + /* default rte has 0.0.0.0 dest */ + ip_addr_set_zero(dst); + } + else + { + /* netifs have netaddress dest */ + ip_addr_get_network(dst, &netif->ip_addr, &netif->netmask); + } + } + break; + case 2: /* ipRouteIfIndex */ + { + s32_t *sint_ptr = (s32_t*)value; + + snmp_netiftoifindex(netif, sint_ptr); + } + break; + case 3: /* ipRouteMetric1 */ + { + s32_t *sint_ptr = (s32_t*)value; + + if (ip_addr_isany(&dest)) + { + /* default rte has metric 1 */ + *sint_ptr = 1; + } + else + { + /* other rtes have metric 0 */ + *sint_ptr = 0; + } + } + break; + case 4: /* ipRouteMetric2 */ + case 5: /* ipRouteMetric3 */ + case 6: /* ipRouteMetric4 */ + case 12: /* ipRouteMetric5 */ + { + s32_t *sint_ptr = (s32_t*)value; + /* not used */ + *sint_ptr = -1; + } + break; + case 7: /* ipRouteNextHop */ + { + ip_addr_t *dst = (ip_addr_t*)value; + + if (ip_addr_isany(&dest)) + { + /* default rte: gateway */ + *dst = netif->gw; + } + else + { + /* other rtes: netif ip_addr */ + *dst = netif->ip_addr; + } + } + break; + case 8: /* ipRouteType */ + { + s32_t *sint_ptr = (s32_t*)value; + + if (ip_addr_isany(&dest)) + { + /* default rte is indirect */ + *sint_ptr = 4; + } + else + { + /* other rtes are direct */ + *sint_ptr = 3; + } + } + break; + case 9: /* ipRouteProto */ + { + s32_t *sint_ptr = (s32_t*)value; + /* locally defined routes */ + *sint_ptr = 2; + } + break; + case 10: /* ipRouteAge */ + { + s32_t *sint_ptr = (s32_t*)value; + /** @todo (sysuptime - timestamp last change) / 100 + @see snmp_insert_iprteidx_tree() */ + *sint_ptr = 0; + } + break; + case 11: /* ipRouteMask */ + { + ip_addr_t *dst = (ip_addr_t*)value; + + if (ip_addr_isany(&dest)) + { + /* default rte use 0.0.0.0 mask */ + ip_addr_set_zero(dst); + } + else + { + /* other rtes use netmask */ + *dst = netif->netmask; + } + } + break; + case 13: /* ipRouteInfo */ + objectidncpy((s32_t*)value, (s32_t*)iprouteinfo.id, (u8_t)(len / sizeof(s32_t))); + break; + } + } +} + +static void +ip_ntomentry_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od) +{ + /* return to object name, adding index depth (5) */ + ident_len += 5; + ident -= 5; + + if (ident_len == 6) + { + u8_t id; + + od->id_inst_len = ident_len; + od->id_inst_ptr = ident; + + LWIP_ASSERT("invalid id", (ident[0] >= 0) && (ident[0] <= 0xff)); + id = (u8_t)ident[0]; + switch (id) + { + case 1: /* ipNetToMediaIfIndex */ + case 4: /* ipNetToMediaType */ + od->instance = MIB_OBJECT_TAB; + od->access = MIB_OBJECT_READ_WRITE; + od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG); + od->v_len = sizeof(s32_t); + break; + case 2: /* ipNetToMediaPhysAddress */ + od->instance = MIB_OBJECT_TAB; + od->access = MIB_OBJECT_READ_WRITE; + od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OC_STR); + od->v_len = 6; /** @todo try to use netif::hwaddr_len */ + break; + case 3: /* ipNetToMediaNetAddress */ + od->instance = MIB_OBJECT_TAB; + od->access = MIB_OBJECT_READ_WRITE; + od->asn_type = (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_IPADDR); + od->v_len = 4; + break; + default: + LWIP_DEBUGF(SNMP_MIB_DEBUG,("ip_ntomentry_get_object_def: no such object\n")); + od->instance = MIB_OBJECT_NONE; + break; + } + } + else + { + LWIP_DEBUGF(SNMP_MIB_DEBUG,("ip_ntomentry_get_object_def: no scalar\n")); + od->instance = MIB_OBJECT_NONE; + } +} + +static void +ip_ntomentry_get_value(struct obj_def *od, u16_t len, void *value) +{ +#if LWIP_ARP + u8_t id; + struct eth_addr* ethaddr_ret; + ip_addr_t* ipaddr_ret; +#endif /* LWIP_ARP */ + ip_addr_t ip; + struct netif *netif; + + LWIP_UNUSED_ARG(len); + LWIP_UNUSED_ARG(value);/* if !LWIP_ARP */ + + snmp_ifindextonetif(od->id_inst_ptr[1], &netif); + snmp_oidtoip(&od->id_inst_ptr[2], &ip); + +#if LWIP_ARP /** @todo implement a netif_find_addr */ + if (etharp_find_addr(netif, &ip, ðaddr_ret, &ipaddr_ret) > -1) + { + LWIP_ASSERT("invalid id", (od->id_inst_ptr[0] >= 0) && (od->id_inst_ptr[0] <= 0xff)); + id = (u8_t)od->id_inst_ptr[0]; + switch (id) + { + case 1: /* ipNetToMediaIfIndex */ + { + s32_t *sint_ptr = (s32_t*)value; + *sint_ptr = od->id_inst_ptr[1]; + } + break; + case 2: /* ipNetToMediaPhysAddress */ + { + struct eth_addr *dst = (struct eth_addr*)value; + + *dst = *ethaddr_ret; + } + break; + case 3: /* ipNetToMediaNetAddress */ + { + ip_addr_t *dst = (ip_addr_t*)value; + + *dst = *ipaddr_ret; + } + break; + case 4: /* ipNetToMediaType */ + { + s32_t *sint_ptr = (s32_t*)value; + /* dynamic (?) */ + *sint_ptr = 3; + } + break; + } + } +#endif /* LWIP_ARP */ +} + +static void +icmp_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od) +{ + /* return to object name, adding index depth (1) */ + ident_len += 1; + ident -= 1; + if ((ident_len == 2) && + (ident[0] > 0) && (ident[0] < 27)) + { + od->id_inst_len = ident_len; + od->id_inst_ptr = ident; + + od->instance = MIB_OBJECT_SCALAR; + od->access = MIB_OBJECT_READ_ONLY; + od->asn_type = (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_COUNTER); + od->v_len = sizeof(u32_t); + } + else + { + LWIP_DEBUGF(SNMP_MIB_DEBUG,("icmp_get_object_def: no scalar\n")); + od->instance = MIB_OBJECT_NONE; + } +} + +static void +icmp_get_value(struct obj_def *od, u16_t len, void *value) +{ + u32_t *uint_ptr = (u32_t*)value; + u8_t id; + + LWIP_UNUSED_ARG(len); + LWIP_ASSERT("invalid id", (od->id_inst_ptr[0] >= 0) && (od->id_inst_ptr[0] <= 0xff)); + id = (u8_t)od->id_inst_ptr[0]; + switch (id) + { + case 1: /* icmpInMsgs */ + *uint_ptr = icmpinmsgs; + break; + case 2: /* icmpInErrors */ + *uint_ptr = icmpinerrors; + break; + case 3: /* icmpInDestUnreachs */ + *uint_ptr = icmpindestunreachs; + break; + case 4: /* icmpInTimeExcds */ + *uint_ptr = icmpintimeexcds; + break; + case 5: /* icmpInParmProbs */ + *uint_ptr = icmpinparmprobs; + break; + case 6: /* icmpInSrcQuenchs */ + *uint_ptr = icmpinsrcquenchs; + break; + case 7: /* icmpInRedirects */ + *uint_ptr = icmpinredirects; + break; + case 8: /* icmpInEchos */ + *uint_ptr = icmpinechos; + break; + case 9: /* icmpInEchoReps */ + *uint_ptr = icmpinechoreps; + break; + case 10: /* icmpInTimestamps */ + *uint_ptr = icmpintimestamps; + break; + case 11: /* icmpInTimestampReps */ + *uint_ptr = icmpintimestampreps; + break; + case 12: /* icmpInAddrMasks */ + *uint_ptr = icmpinaddrmasks; + break; + case 13: /* icmpInAddrMaskReps */ + *uint_ptr = icmpinaddrmaskreps; + break; + case 14: /* icmpOutMsgs */ + *uint_ptr = icmpoutmsgs; + break; + case 15: /* icmpOutErrors */ + *uint_ptr = icmpouterrors; + break; + case 16: /* icmpOutDestUnreachs */ + *uint_ptr = icmpoutdestunreachs; + break; + case 17: /* icmpOutTimeExcds */ + *uint_ptr = icmpouttimeexcds; + break; + case 18: /* icmpOutParmProbs */ + *uint_ptr = icmpoutparmprobs; + break; + case 19: /* icmpOutSrcQuenchs */ + *uint_ptr = icmpoutsrcquenchs; + break; + case 20: /* icmpOutRedirects */ + *uint_ptr = icmpoutredirects; + break; + case 21: /* icmpOutEchos */ + *uint_ptr = icmpoutechos; + break; + case 22: /* icmpOutEchoReps */ + *uint_ptr = icmpoutechoreps; + break; + case 23: /* icmpOutTimestamps */ + *uint_ptr = icmpouttimestamps; + break; + case 24: /* icmpOutTimestampReps */ + *uint_ptr = icmpouttimestampreps; + break; + case 25: /* icmpOutAddrMasks */ + *uint_ptr = icmpoutaddrmasks; + break; + case 26: /* icmpOutAddrMaskReps */ + *uint_ptr = icmpoutaddrmaskreps; + break; + } +} + +#if LWIP_TCP +/** @todo tcp grp */ +static void +tcp_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od) +{ + u8_t id; + + /* return to object name, adding index depth (1) */ + ident_len += 1; + ident -= 1; + if (ident_len == 2) + { + od->id_inst_len = ident_len; + od->id_inst_ptr = ident; + + LWIP_ASSERT("invalid id", (ident[0] >= 0) && (ident[0] <= 0xff)); + id = (u8_t)ident[0]; + LWIP_DEBUGF(SNMP_MIB_DEBUG,("get_object_def tcp.%"U16_F".0\n",(u16_t)id)); + + switch (id) + { + case 1: /* tcpRtoAlgorithm */ + case 2: /* tcpRtoMin */ + case 3: /* tcpRtoMax */ + case 4: /* tcpMaxConn */ + od->instance = MIB_OBJECT_SCALAR; + od->access = MIB_OBJECT_READ_ONLY; + od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG); + od->v_len = sizeof(s32_t); + break; + case 5: /* tcpActiveOpens */ + case 6: /* tcpPassiveOpens */ + case 7: /* tcpAttemptFails */ + case 8: /* tcpEstabResets */ + case 10: /* tcpInSegs */ + case 11: /* tcpOutSegs */ + case 12: /* tcpRetransSegs */ + case 14: /* tcpInErrs */ + case 15: /* tcpOutRsts */ + od->instance = MIB_OBJECT_SCALAR; + od->access = MIB_OBJECT_READ_ONLY; + od->asn_type = (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_COUNTER); + od->v_len = sizeof(u32_t); + break; + case 9: /* tcpCurrEstab */ + od->instance = MIB_OBJECT_TAB; + od->access = MIB_OBJECT_READ_ONLY; + od->asn_type = (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_GAUGE); + od->v_len = sizeof(u32_t); + break; + default: + LWIP_DEBUGF(SNMP_MIB_DEBUG,("tcp_get_object_def: no such object\n")); + od->instance = MIB_OBJECT_NONE; + break; + }; + } + else + { + LWIP_DEBUGF(SNMP_MIB_DEBUG,("tcp_get_object_def: no scalar\n")); + od->instance = MIB_OBJECT_NONE; + } +} + +static void +tcp_get_value(struct obj_def *od, u16_t len, void *value) +{ + u32_t *uint_ptr = (u32_t*)value; + s32_t *sint_ptr = (s32_t*)value; + u8_t id; + + LWIP_UNUSED_ARG(len); + LWIP_ASSERT("invalid id", (od->id_inst_ptr[0] >= 0) && (od->id_inst_ptr[0] <= 0xff)); + id = (u8_t)od->id_inst_ptr[0]; + switch (id) + { + case 1: /* tcpRtoAlgorithm, vanj(4) */ + *sint_ptr = 4; + break; + case 2: /* tcpRtoMin */ + /* @todo not the actual value, a guess, + needs to be calculated */ + *sint_ptr = 1000; + break; + case 3: /* tcpRtoMax */ + /* @todo not the actual value, a guess, + needs to be calculated */ + *sint_ptr = 60000; + break; + case 4: /* tcpMaxConn */ + *sint_ptr = MEMP_NUM_TCP_PCB; + break; + case 5: /* tcpActiveOpens */ + *uint_ptr = tcpactiveopens; + break; + case 6: /* tcpPassiveOpens */ + *uint_ptr = tcppassiveopens; + break; + case 7: /* tcpAttemptFails */ + *uint_ptr = tcpattemptfails; + break; + case 8: /* tcpEstabResets */ + *uint_ptr = tcpestabresets; + break; + case 9: /* tcpCurrEstab */ + { + u16_t tcpcurrestab = 0; + struct tcp_pcb *pcb = tcp_active_pcbs; + while (pcb != NULL) + { + if ((pcb->state == ESTABLISHED) || + (pcb->state == CLOSE_WAIT)) + { + tcpcurrestab++; + } + pcb = pcb->next; + } + *uint_ptr = tcpcurrestab; + } + break; + case 10: /* tcpInSegs */ + *uint_ptr = tcpinsegs; + break; + case 11: /* tcpOutSegs */ + *uint_ptr = tcpoutsegs; + break; + case 12: /* tcpRetransSegs */ + *uint_ptr = tcpretranssegs; + break; + case 14: /* tcpInErrs */ + *uint_ptr = tcpinerrs; + break; + case 15: /* tcpOutRsts */ + *uint_ptr = tcpoutrsts; + break; + } +} +#ifdef THIS_SEEMS_UNUSED +static void +tcpconnentry_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od) +{ + /* return to object name, adding index depth (10) */ + ident_len += 10; + ident -= 10; + + if (ident_len == 11) + { + u8_t id; + + od->id_inst_len = ident_len; + od->id_inst_ptr = ident; + + id = ident[0]; + LWIP_DEBUGF(SNMP_MIB_DEBUG,("get_object_def tcp.%"U16_F".0\n",(u16_t)id)); + + switch (id) + { + case 1: /* tcpConnState */ + od->instance = MIB_OBJECT_TAB; + od->access = MIB_OBJECT_READ_WRITE; + od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG); + od->v_len = sizeof(s32_t); + break; + case 2: /* tcpConnLocalAddress */ + case 4: /* tcpConnRemAddress */ + od->instance = MIB_OBJECT_TAB; + od->access = MIB_OBJECT_READ_ONLY; + od->asn_type = (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_IPADDR); + od->v_len = 4; + break; + case 3: /* tcpConnLocalPort */ + case 5: /* tcpConnRemPort */ + od->instance = MIB_OBJECT_TAB; + od->access = MIB_OBJECT_READ_ONLY; + od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG); + od->v_len = sizeof(s32_t); + break; + default: + LWIP_DEBUGF(SNMP_MIB_DEBUG,("tcpconnentry_get_object_def: no such object\n")); + od->instance = MIB_OBJECT_NONE; + break; + }; + } + else + { + LWIP_DEBUGF(SNMP_MIB_DEBUG,("tcpconnentry_get_object_def: no such object\n")); + od->instance = MIB_OBJECT_NONE; + } +} + +static void +tcpconnentry_get_value(struct obj_def *od, u16_t len, void *value) +{ + ip_addr_t lip, rip; + u16_t lport, rport; + s32_t *ident; + + ident = od->id_inst_ptr; + snmp_oidtoip(&ident[1], &lip); + lport = ident[5]; + snmp_oidtoip(&ident[6], &rip); + rport = ident[10]; + + /** @todo find matching PCB */ +} +#endif /* if 0 */ +#endif + +static void +udp_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od) +{ + /* return to object name, adding index depth (1) */ + ident_len += 1; + ident -= 1; + if ((ident_len == 2) && + (ident[0] > 0) && (ident[0] < 6)) + { + od->id_inst_len = ident_len; + od->id_inst_ptr = ident; + + od->instance = MIB_OBJECT_SCALAR; + od->access = MIB_OBJECT_READ_ONLY; + od->asn_type = (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_COUNTER); + od->v_len = sizeof(u32_t); + } + else + { + LWIP_DEBUGF(SNMP_MIB_DEBUG,("udp_get_object_def: no scalar\n")); + od->instance = MIB_OBJECT_NONE; + } +} + +static void +udp_get_value(struct obj_def *od, u16_t len, void *value) +{ + u32_t *uint_ptr = (u32_t*)value; + u8_t id; + + LWIP_UNUSED_ARG(len); + LWIP_ASSERT("invalid id", (od->id_inst_ptr[0] >= 0) && (od->id_inst_ptr[0] <= 0xff)); + id = (u8_t)od->id_inst_ptr[0]; + switch (id) + { + case 1: /* udpInDatagrams */ + *uint_ptr = udpindatagrams; + break; + case 2: /* udpNoPorts */ + *uint_ptr = udpnoports; + break; + case 3: /* udpInErrors */ + *uint_ptr = udpinerrors; + break; + case 4: /* udpOutDatagrams */ + *uint_ptr = udpoutdatagrams; + break; + } +} + +static void +udpentry_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od) +{ + /* return to object name, adding index depth (5) */ + ident_len += 5; + ident -= 5; + + if (ident_len == 6) + { + od->id_inst_len = ident_len; + od->id_inst_ptr = ident; + + switch (ident[0]) + { + case 1: /* udpLocalAddress */ + od->instance = MIB_OBJECT_TAB; + od->access = MIB_OBJECT_READ_ONLY; + od->asn_type = (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_IPADDR); + od->v_len = 4; + break; + case 2: /* udpLocalPort */ + od->instance = MIB_OBJECT_TAB; + od->access = MIB_OBJECT_READ_ONLY; + od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG); + od->v_len = sizeof(s32_t); + break; + default: + LWIP_DEBUGF(SNMP_MIB_DEBUG,("udpentry_get_object_def: no such object\n")); + od->instance = MIB_OBJECT_NONE; + break; + } + } + else + { + LWIP_DEBUGF(SNMP_MIB_DEBUG,("udpentry_get_object_def: no scalar\n")); + od->instance = MIB_OBJECT_NONE; + } +} + +static void +udpentry_get_value(struct obj_def *od, u16_t len, void *value) +{ + u8_t id; + struct udp_pcb *pcb; + ip_addr_t ip; + u16_t port; + + LWIP_UNUSED_ARG(len); + snmp_oidtoip(&od->id_inst_ptr[1], &ip); + LWIP_ASSERT("invalid port", (od->id_inst_ptr[5] >= 0) && (od->id_inst_ptr[5] <= 0xffff)); + port = (u16_t)od->id_inst_ptr[5]; + + pcb = udp_pcbs; + while ((pcb != NULL) && + !(ip_addr_cmp(&pcb->local_ip, &ip) && + (pcb->local_port == port))) + { + pcb = pcb->next; + } + + if (pcb != NULL) + { + LWIP_ASSERT("invalid id", (od->id_inst_ptr[0] >= 0) && (od->id_inst_ptr[0] <= 0xff)); + id = (u8_t)od->id_inst_ptr[0]; + switch (id) + { + case 1: /* udpLocalAddress */ + { + ip_addr_t *dst = (ip_addr_t*)value; + *dst = pcb->local_ip; + } + break; + case 2: /* udpLocalPort */ + { + s32_t *sint_ptr = (s32_t*)value; + *sint_ptr = pcb->local_port; + } + break; + } + } +} + +static void +snmp_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od) +{ + /* return to object name, adding index depth (1) */ + ident_len += 1; + ident -= 1; + if (ident_len == 2) + { + u8_t id; + + od->id_inst_len = ident_len; + od->id_inst_ptr = ident; + + LWIP_ASSERT("invalid id", (ident[0] >= 0) && (ident[0] <= 0xff)); + id = (u8_t)ident[0]; + switch (id) + { + case 1: /* snmpInPkts */ + case 2: /* snmpOutPkts */ + case 3: /* snmpInBadVersions */ + case 4: /* snmpInBadCommunityNames */ + case 5: /* snmpInBadCommunityUses */ + case 6: /* snmpInASNParseErrs */ + case 8: /* snmpInTooBigs */ + case 9: /* snmpInNoSuchNames */ + case 10: /* snmpInBadValues */ + case 11: /* snmpInReadOnlys */ + case 12: /* snmpInGenErrs */ + case 13: /* snmpInTotalReqVars */ + case 14: /* snmpInTotalSetVars */ + case 15: /* snmpInGetRequests */ + case 16: /* snmpInGetNexts */ + case 17: /* snmpInSetRequests */ + case 18: /* snmpInGetResponses */ + case 19: /* snmpInTraps */ + case 20: /* snmpOutTooBigs */ + case 21: /* snmpOutNoSuchNames */ + case 22: /* snmpOutBadValues */ + case 24: /* snmpOutGenErrs */ + case 25: /* snmpOutGetRequests */ + case 26: /* snmpOutGetNexts */ + case 27: /* snmpOutSetRequests */ + case 28: /* snmpOutGetResponses */ + case 29: /* snmpOutTraps */ + od->instance = MIB_OBJECT_SCALAR; + od->access = MIB_OBJECT_READ_ONLY; + od->asn_type = (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_COUNTER); + od->v_len = sizeof(u32_t); + break; + case 30: /* snmpEnableAuthenTraps */ + od->instance = MIB_OBJECT_SCALAR; + od->access = MIB_OBJECT_READ_WRITE; + od->asn_type = (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG); + od->v_len = sizeof(s32_t); + break; + default: + LWIP_DEBUGF(SNMP_MIB_DEBUG,("snmp_get_object_def: no such object\n")); + od->instance = MIB_OBJECT_NONE; + break; + }; + } + else + { + LWIP_DEBUGF(SNMP_MIB_DEBUG,("snmp_get_object_def: no scalar\n")); + od->instance = MIB_OBJECT_NONE; + } +} + +static void +snmp_get_value(struct obj_def *od, u16_t len, void *value) +{ + u32_t *uint_ptr = (u32_t*)value; + u8_t id; + + LWIP_UNUSED_ARG(len); + LWIP_ASSERT("invalid id", (od->id_inst_ptr[0] >= 0) && (od->id_inst_ptr[0] <= 0xff)); + id = (u8_t)od->id_inst_ptr[0]; + switch (id) + { + case 1: /* snmpInPkts */ + *uint_ptr = snmpinpkts; + break; + case 2: /* snmpOutPkts */ + *uint_ptr = snmpoutpkts; + break; + case 3: /* snmpInBadVersions */ + *uint_ptr = snmpinbadversions; + break; + case 4: /* snmpInBadCommunityNames */ + *uint_ptr = snmpinbadcommunitynames; + break; + case 5: /* snmpInBadCommunityUses */ + *uint_ptr = snmpinbadcommunityuses; + break; + case 6: /* snmpInASNParseErrs */ + *uint_ptr = snmpinasnparseerrs; + break; + case 8: /* snmpInTooBigs */ + *uint_ptr = snmpintoobigs; + break; + case 9: /* snmpInNoSuchNames */ + *uint_ptr = snmpinnosuchnames; + break; + case 10: /* snmpInBadValues */ + *uint_ptr = snmpinbadvalues; + break; + case 11: /* snmpInReadOnlys */ + *uint_ptr = snmpinreadonlys; + break; + case 12: /* snmpInGenErrs */ + *uint_ptr = snmpingenerrs; + break; + case 13: /* snmpInTotalReqVars */ + *uint_ptr = snmpintotalreqvars; + break; + case 14: /* snmpInTotalSetVars */ + *uint_ptr = snmpintotalsetvars; + break; + case 15: /* snmpInGetRequests */ + *uint_ptr = snmpingetrequests; + break; + case 16: /* snmpInGetNexts */ + *uint_ptr = snmpingetnexts; + break; + case 17: /* snmpInSetRequests */ + *uint_ptr = snmpinsetrequests; + break; + case 18: /* snmpInGetResponses */ + *uint_ptr = snmpingetresponses; + break; + case 19: /* snmpInTraps */ + *uint_ptr = snmpintraps; + break; + case 20: /* snmpOutTooBigs */ + *uint_ptr = snmpouttoobigs; + break; + case 21: /* snmpOutNoSuchNames */ + *uint_ptr = snmpoutnosuchnames; + break; + case 22: /* snmpOutBadValues */ + *uint_ptr = snmpoutbadvalues; + break; + case 24: /* snmpOutGenErrs */ + *uint_ptr = snmpoutgenerrs; + break; + case 25: /* snmpOutGetRequests */ + *uint_ptr = snmpoutgetrequests; + break; + case 26: /* snmpOutGetNexts */ + *uint_ptr = snmpoutgetnexts; + break; + case 27: /* snmpOutSetRequests */ + *uint_ptr = snmpoutsetrequests; + break; + case 28: /* snmpOutGetResponses */ + *uint_ptr = snmpoutgetresponses; + break; + case 29: /* snmpOutTraps */ + *uint_ptr = snmpouttraps; + break; + case 30: /* snmpEnableAuthenTraps */ + *uint_ptr = *snmpenableauthentraps_ptr; + break; + }; +} + +/** + * Test snmp object value before setting. + * + * @param od is the object definition + * @param len return value space (in bytes) + * @param value points to (varbind) space to copy value from. + */ +static u8_t +snmp_set_test(struct obj_def *od, u16_t len, void *value) +{ + u8_t id, set_ok; + + LWIP_UNUSED_ARG(len); + set_ok = 0; + LWIP_ASSERT("invalid id", (od->id_inst_ptr[0] >= 0) && (od->id_inst_ptr[0] <= 0xff)); + id = (u8_t)od->id_inst_ptr[0]; + if (id == 30) + { + /* snmpEnableAuthenTraps */ + s32_t *sint_ptr = (s32_t*)value; + + if (snmpenableauthentraps_ptr != &snmpenableauthentraps_default) + { + /* we should have writable non-volatile mem here */ + if ((*sint_ptr == 1) || (*sint_ptr == 2)) + { + set_ok = 1; + } + } + else + { + /* const or hardwired value */ + if (*sint_ptr == snmpenableauthentraps_default) + { + set_ok = 1; + } + } + } + return set_ok; +} + +static void +snmp_set_value(struct obj_def *od, u16_t len, void *value) +{ + u8_t id; + + LWIP_UNUSED_ARG(len); + LWIP_ASSERT("invalid id", (od->id_inst_ptr[0] >= 0) && (od->id_inst_ptr[0] <= 0xff)); + id = (u8_t)od->id_inst_ptr[0]; + if (id == 30) + { + /* snmpEnableAuthenTraps */ + /* @todo @fixme: which kind of pointer is 'value'? s32_t or u8_t??? */ + u8_t *ptr = (u8_t*)value; + *snmpenableauthentraps_ptr = *ptr; + } +} + +#endif /* LWIP_SNMP */ diff --git a/lib/drivers/lwip/src/core/snmp/mib_structs.c b/lib/drivers/lwip/src/core/snmp/mib_structs.c new file mode 100644 index 00000000000..2f185cb4367 --- /dev/null +++ b/lib/drivers/lwip/src/core/snmp/mib_structs.c @@ -0,0 +1,1174 @@ +/** + * @file + * MIB tree access/construction functions. + */ + +/* + * Copyright (c) 2006 Axon Digital Design B.V., The Netherlands. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * Author: Christiaan Simons + */ + +#include "lwip/opt.h" + +#if LWIP_SNMP /* don't build if not configured for use in lwipopts.h */ + +#include "lwip/snmp_structs.h" +#include "lwip/memp.h" +#include "lwip/netif.h" + +/** .iso.org.dod.internet address prefix, @see snmp_iso_*() */ +const s32_t prefix[4] = {1, 3, 6, 1}; + +#define NODE_STACK_SIZE (LWIP_SNMP_OBJ_ID_LEN) +/** node stack entry (old news?) */ +struct nse +{ + /** right child */ + struct mib_node* r_ptr; + /** right child identifier */ + s32_t r_id; + /** right child next level */ + u8_t r_nl; +}; +static u8_t node_stack_cnt; +static struct nse node_stack[NODE_STACK_SIZE]; + +/** + * Pushes nse struct onto stack. + */ +static void +push_node(struct nse* node) +{ + LWIP_ASSERT("node_stack_cnt < NODE_STACK_SIZE",node_stack_cnt < NODE_STACK_SIZE); + LWIP_DEBUGF(SNMP_MIB_DEBUG,("push_node() node=%p id=%"S32_F"\n",(void*)(node->r_ptr),node->r_id)); + if (node_stack_cnt < NODE_STACK_SIZE) + { + node_stack[node_stack_cnt] = *node; + node_stack_cnt++; + } +} + +/** + * Pops nse struct from stack. + */ +static void +pop_node(struct nse* node) +{ + if (node_stack_cnt > 0) + { + node_stack_cnt--; + *node = node_stack[node_stack_cnt]; + } + LWIP_DEBUGF(SNMP_MIB_DEBUG,("pop_node() node=%p id=%"S32_F"\n",(void *)(node->r_ptr),node->r_id)); +} + +/** + * Conversion from ifIndex to lwIP netif + * @param ifindex is a s32_t object sub-identifier + * @param netif points to returned netif struct pointer + */ +void +snmp_ifindextonetif(s32_t ifindex, struct netif **netif) +{ + struct netif *nif = netif_list; + s32_t i, ifidx; + + ifidx = ifindex - 1; + i = 0; + while ((nif != NULL) && (i < ifidx)) + { + nif = nif->next; + i++; + } + *netif = nif; +} + +/** + * Conversion from lwIP netif to ifIndex + * @param netif points to a netif struct + * @param ifidx points to s32_t object sub-identifier + */ +void +snmp_netiftoifindex(struct netif *netif, s32_t *ifidx) +{ + struct netif *nif = netif_list; + u16_t i; + + i = 0; + while ((nif != NULL) && (nif != netif)) + { + nif = nif->next; + i++; + } + *ifidx = i+1; +} + +/** + * Conversion from oid to lwIP ip_addr + * @param ident points to s32_t ident[4] input + * @param ip points to output struct + */ +void +snmp_oidtoip(s32_t *ident, ip_addr_t *ip) +{ + IP4_ADDR(ip, ident[0], ident[1], ident[2], ident[3]); +} + +/** + * Conversion from lwIP ip_addr to oid + * @param ip points to input struct + * @param ident points to s32_t ident[4] output + */ +void +snmp_iptooid(ip_addr_t *ip, s32_t *ident) +{ + ident[0] = ip4_addr1(ip); + ident[1] = ip4_addr2(ip); + ident[2] = ip4_addr3(ip); + ident[3] = ip4_addr4(ip); +} + +struct mib_list_node * +snmp_mib_ln_alloc(s32_t id) +{ + struct mib_list_node *ln; + + ln = (struct mib_list_node *)memp_malloc(MEMP_SNMP_NODE); + if (ln != NULL) + { + ln->prev = NULL; + ln->next = NULL; + ln->objid = id; + ln->nptr = NULL; + } + return ln; +} + +void +snmp_mib_ln_free(struct mib_list_node *ln) +{ + memp_free(MEMP_SNMP_NODE, ln); +} + +struct mib_list_rootnode * +snmp_mib_lrn_alloc(void) +{ + struct mib_list_rootnode *lrn; + + lrn = (struct mib_list_rootnode*)memp_malloc(MEMP_SNMP_ROOTNODE); + if (lrn != NULL) + { + lrn->get_object_def = noleafs_get_object_def; + lrn->get_value = noleafs_get_value; + lrn->set_test = noleafs_set_test; + lrn->set_value = noleafs_set_value; + lrn->node_type = MIB_NODE_LR; + lrn->maxlength = 0; + lrn->head = NULL; + lrn->tail = NULL; + lrn->count = 0; + } + return lrn; +} + +void +snmp_mib_lrn_free(struct mib_list_rootnode *lrn) +{ + memp_free(MEMP_SNMP_ROOTNODE, lrn); +} + +/** + * Inserts node in idx list in a sorted + * (ascending order) fashion and + * allocates the node if needed. + * + * @param rn points to the root node + * @param objid is the object sub identifier + * @param insn points to a pointer to the inserted node + * used for constructing the tree. + * @return -1 if failed, 1 if inserted, 2 if present. + */ +s8_t +snmp_mib_node_insert(struct mib_list_rootnode *rn, s32_t objid, struct mib_list_node **insn) +{ + struct mib_list_node *nn; + s8_t insert; + + LWIP_ASSERT("rn != NULL",rn != NULL); + + /* -1 = malloc failure, 0 = not inserted, 1 = inserted, 2 = was present */ + insert = 0; + if (rn->head == NULL) + { + /* empty list, add first node */ + LWIP_DEBUGF(SNMP_MIB_DEBUG,("alloc empty list objid==%"S32_F"\n",objid)); + nn = snmp_mib_ln_alloc(objid); + if (nn != NULL) + { + rn->head = nn; + rn->tail = nn; + *insn = nn; + insert = 1; + } + else + { + insert = -1; + } + } + else + { + struct mib_list_node *n; + /* at least one node is present */ + n = rn->head; + while ((n != NULL) && (insert == 0)) + { + if (n->objid == objid) + { + /* node is already there */ + LWIP_DEBUGF(SNMP_MIB_DEBUG,("node already there objid==%"S32_F"\n",objid)); + *insn = n; + insert = 2; + } + else if (n->objid < objid) + { + if (n->next == NULL) + { + /* alloc and insert at the tail */ + LWIP_DEBUGF(SNMP_MIB_DEBUG,("alloc ins tail objid==%"S32_F"\n",objid)); + nn = snmp_mib_ln_alloc(objid); + if (nn != NULL) + { + nn->next = NULL; + nn->prev = n; + n->next = nn; + rn->tail = nn; + *insn = nn; + insert = 1; + } + else + { + /* insertion failure */ + insert = -1; + } + } + else + { + /* there's more to explore: traverse list */ + LWIP_DEBUGF(SNMP_MIB_DEBUG,("traverse list\n")); + n = n->next; + } + } + else + { + /* n->objid > objid */ + /* alloc and insert between n->prev and n */ + LWIP_DEBUGF(SNMP_MIB_DEBUG,("alloc ins n->prev, objid==%"S32_F", n\n",objid)); + nn = snmp_mib_ln_alloc(objid); + if (nn != NULL) + { + if (n->prev == NULL) + { + /* insert at the head */ + nn->next = n; + nn->prev = NULL; + rn->head = nn; + n->prev = nn; + } + else + { + /* insert in the middle */ + nn->next = n; + nn->prev = n->prev; + n->prev->next = nn; + n->prev = nn; + } + *insn = nn; + insert = 1; + } + else + { + /* insertion failure */ + insert = -1; + } + } + } + } + if (insert == 1) + { + rn->count += 1; + } + LWIP_ASSERT("insert != 0",insert != 0); + return insert; +} + +/** + * Finds node in idx list and returns deletion mark. + * + * @param rn points to the root node + * @param objid is the object sub identifier + * @param fn returns pointer to found node + * @return 0 if not found, 1 if deletable, + * 2 can't delete (2 or more children), 3 not a list_node + */ +s8_t +snmp_mib_node_find(struct mib_list_rootnode *rn, s32_t objid, struct mib_list_node **fn) +{ + s8_t fc; + struct mib_list_node *n; + + LWIP_ASSERT("rn != NULL",rn != NULL); + n = rn->head; + while ((n != NULL) && (n->objid != objid)) + { + n = n->next; + } + if (n == NULL) + { + fc = 0; + } + else if (n->nptr == NULL) + { + /* leaf, can delete node */ + fc = 1; + } + else + { + struct mib_list_rootnode *r; + + if (n->nptr->node_type == MIB_NODE_LR) + { + r = (struct mib_list_rootnode *)n->nptr; + if (r->count > 1) + { + /* can't delete node */ + fc = 2; + } + else + { + /* count <= 1, can delete node */ + fc = 1; + } + } + else + { + /* other node type */ + fc = 3; + } + } + *fn = n; + return fc; +} + +/** + * Removes node from idx list + * if it has a single child left. + * + * @param rn points to the root node + * @param n points to the node to delete + * @return the nptr to be freed by caller + */ +struct mib_list_rootnode * +snmp_mib_node_delete(struct mib_list_rootnode *rn, struct mib_list_node *n) +{ + struct mib_list_rootnode *next; + + LWIP_ASSERT("rn != NULL",rn != NULL); + LWIP_ASSERT("n != NULL",n != NULL); + + /* caller must remove this sub-tree */ + next = (struct mib_list_rootnode*)(n->nptr); + rn->count -= 1; + + if (n == rn->head) + { + rn->head = n->next; + if (n->next != NULL) + { + /* not last node, new list begin */ + n->next->prev = NULL; + } + } + else if (n == rn->tail) + { + rn->tail = n->prev; + if (n->prev != NULL) + { + /* not last node, new list end */ + n->prev->next = NULL; + } + } + else + { + /* node must be in the middle */ + n->prev->next = n->next; + n->next->prev = n->prev; + } + LWIP_DEBUGF(SNMP_MIB_DEBUG,("free list objid==%"S32_F"\n",n->objid)); + snmp_mib_ln_free(n); + if (rn->count == 0) + { + rn->head = NULL; + rn->tail = NULL; + } + return next; +} + + + +/** + * Searches tree for the supplied (scalar?) object identifier. + * + * @param node points to the root of the tree ('.internet') + * @param ident_len the length of the supplied object identifier + * @param ident points to the array of sub identifiers + * @param np points to the found object instance (return) + * @return pointer to the requested parent (!) node if success, NULL otherwise + */ +struct mib_node * +snmp_search_tree(struct mib_node *node, u8_t ident_len, s32_t *ident, struct snmp_name_ptr *np) +{ + u8_t node_type, ext_level; + + ext_level = 0; + LWIP_DEBUGF(SNMP_MIB_DEBUG,("node==%p *ident==%"S32_F"\n",(void*)node,*ident)); + while (node != NULL) + { + node_type = node->node_type; + if ((node_type == MIB_NODE_AR) || (node_type == MIB_NODE_RA)) + { + struct mib_array_node *an; + u16_t i; + + if (ident_len > 0) + { + /* array node (internal ROM or RAM, fixed length) */ + an = (struct mib_array_node *)node; + i = 0; + while ((i < an->maxlength) && (an->objid[i] != *ident)) + { + i++; + } + if (i < an->maxlength) + { + /* found it, if available proceed to child, otherwise inspect leaf */ + LWIP_DEBUGF(SNMP_MIB_DEBUG,("an->objid[%"U16_F"]==%"S32_F" *ident==%"S32_F"\n",i,an->objid[i],*ident)); + if (an->nptr[i] == NULL) + { + /* a scalar leaf OR table, + inspect remaining instance number / table index */ + np->ident_len = ident_len; + np->ident = ident; + return (struct mib_node*)an; + } + else + { + /* follow next child pointer */ + ident++; + ident_len--; + node = an->nptr[i]; + } + } + else + { + /* search failed, identifier mismatch (nosuchname) */ + LWIP_DEBUGF(SNMP_MIB_DEBUG,("an search failed *ident==%"S32_F"\n",*ident)); + return NULL; + } + } + else + { + /* search failed, short object identifier (nosuchname) */ + LWIP_DEBUGF(SNMP_MIB_DEBUG,("an search failed, short object identifier\n")); + return NULL; + } + } + else if(node_type == MIB_NODE_LR) + { + struct mib_list_rootnode *lrn; + struct mib_list_node *ln; + + if (ident_len > 0) + { + /* list root node (internal 'RAM', variable length) */ + lrn = (struct mib_list_rootnode *)node; + ln = lrn->head; + /* iterate over list, head to tail */ + while ((ln != NULL) && (ln->objid != *ident)) + { + ln = ln->next; + } + if (ln != NULL) + { + /* found it, proceed to child */; + LWIP_DEBUGF(SNMP_MIB_DEBUG,("ln->objid==%"S32_F" *ident==%"S32_F"\n",ln->objid,*ident)); + if (ln->nptr == NULL) + { + np->ident_len = ident_len; + np->ident = ident; + return (struct mib_node*)lrn; + } + else + { + /* follow next child pointer */ + ident_len--; + ident++; + node = ln->nptr; + } + } + else + { + /* search failed */ + LWIP_DEBUGF(SNMP_MIB_DEBUG,("ln search failed *ident==%"S32_F"\n",*ident)); + return NULL; + } + } + else + { + /* search failed, short object identifier (nosuchname) */ + LWIP_DEBUGF(SNMP_MIB_DEBUG,("ln search failed, short object identifier\n")); + return NULL; + } + } + else if(node_type == MIB_NODE_EX) + { + struct mib_external_node *en; + u16_t i, len; + + if (ident_len > 0) + { + /* external node (addressing and access via functions) */ + en = (struct mib_external_node *)node; + + i = 0; + len = en->level_length(en->addr_inf,ext_level); + while ((i < len) && (en->ident_cmp(en->addr_inf,ext_level,i,*ident) != 0)) + { + i++; + } + if (i < len) + { + s32_t debug_id; + + en->get_objid(en->addr_inf,ext_level,i,&debug_id); + LWIP_DEBUGF(SNMP_MIB_DEBUG,("en->objid==%"S32_F" *ident==%"S32_F"\n",debug_id,*ident)); + if ((ext_level + 1) == en->tree_levels) + { + np->ident_len = ident_len; + np->ident = ident; + return (struct mib_node*)en; + } + else + { + /* found it, proceed to child */ + ident_len--; + ident++; + ext_level++; + } + } + else + { + /* search failed */ + LWIP_DEBUGF(SNMP_MIB_DEBUG,("en search failed *ident==%"S32_F"\n",*ident)); + return NULL; + } + } + else + { + /* search failed, short object identifier (nosuchname) */ + LWIP_DEBUGF(SNMP_MIB_DEBUG,("en search failed, short object identifier\n")); + return NULL; + } + } + else if (node_type == MIB_NODE_SC) + { + mib_scalar_node *sn; + + sn = (mib_scalar_node *)node; + if ((ident_len == 1) && (*ident == 0)) + { + np->ident_len = ident_len; + np->ident = ident; + return (struct mib_node*)sn; + } + else + { + /* search failed, short object identifier (nosuchname) */ + LWIP_DEBUGF(SNMP_MIB_DEBUG,("search failed, invalid object identifier length\n")); + return NULL; + } + } + else + { + /* unknown node_type */ + LWIP_DEBUGF(SNMP_MIB_DEBUG,("search failed node_type %"U16_F" unkown\n",(u16_t)node_type)); + return NULL; + } + } + /* done, found nothing */ + LWIP_DEBUGF(SNMP_MIB_DEBUG,("search failed node==%p\n",(void*)node)); + return NULL; +} + +/** + * Test table for presence of at least one table entry. + */ +static u8_t +empty_table(struct mib_node *node) +{ + u8_t node_type; + u8_t empty = 0; + + if (node != NULL) + { + node_type = node->node_type; + if (node_type == MIB_NODE_LR) + { + struct mib_list_rootnode *lrn; + lrn = (struct mib_list_rootnode *)node; + if ((lrn->count == 0) || (lrn->head == NULL)) + { + empty = 1; + } + } + else if ((node_type == MIB_NODE_AR) || (node_type == MIB_NODE_RA)) + { + struct mib_array_node *an; + an = (struct mib_array_node *)node; + if ((an->maxlength == 0) || (an->nptr == NULL)) + { + empty = 1; + } + } + else if (node_type == MIB_NODE_EX) + { + struct mib_external_node *en; + en = (struct mib_external_node *)node; + if (en->tree_levels == 0) + { + empty = 1; + } + } + } + return empty; +} + +/** + * Tree expansion. + */ +struct mib_node * +snmp_expand_tree(struct mib_node *node, u8_t ident_len, s32_t *ident, struct snmp_obj_id *oidret) +{ + u8_t node_type, ext_level, climb_tree; + + ext_level = 0; + /* reset node stack */ + node_stack_cnt = 0; + while (node != NULL) + { + climb_tree = 0; + node_type = node->node_type; + if ((node_type == MIB_NODE_AR) || (node_type == MIB_NODE_RA)) + { + struct mib_array_node *an; + u16_t i; + + /* array node (internal ROM or RAM, fixed length) */ + an = (struct mib_array_node *)node; + if (ident_len > 0) + { + i = 0; + while ((i < an->maxlength) && (an->objid[i] < *ident)) + { + i++; + } + if (i < an->maxlength) + { + LWIP_DEBUGF(SNMP_MIB_DEBUG,("an->objid[%"U16_F"]==%"S32_F" *ident==%"S32_F"\n",i,an->objid[i],*ident)); + /* add identifier to oidret */ + oidret->id[oidret->len] = an->objid[i]; + (oidret->len)++; + + if (an->nptr[i] == NULL) + { + LWIP_DEBUGF(SNMP_MIB_DEBUG,("leaf node\n")); + /* leaf node (e.g. in a fixed size table) */ + if (an->objid[i] > *ident) + { + return (struct mib_node*)an; + } + else if ((i + 1) < an->maxlength) + { + /* an->objid[i] == *ident */ + (oidret->len)--; + oidret->id[oidret->len] = an->objid[i + 1]; + (oidret->len)++; + return (struct mib_node*)an; + } + else + { + /* (i + 1) == an->maxlength */ + (oidret->len)--; + climb_tree = 1; + } + } + else + { + u8_t j; + struct nse cur_node; + + LWIP_DEBUGF(SNMP_MIB_DEBUG,("non-leaf node\n")); + /* non-leaf, store right child ptr and id */ + LWIP_ASSERT("i < 0xff", i < 0xff); + j = (u8_t)i + 1; + while ((j < an->maxlength) && (empty_table(an->nptr[j]))) + { + j++; + } + if (j < an->maxlength) + { + cur_node.r_ptr = an->nptr[j]; + cur_node.r_id = an->objid[j]; + cur_node.r_nl = 0; + } + else + { + cur_node.r_ptr = NULL; + } + push_node(&cur_node); + if (an->objid[i] == *ident) + { + ident_len--; + ident++; + } + else + { + /* an->objid[i] < *ident */ + ident_len = 0; + } + /* follow next child pointer */ + node = an->nptr[i]; + } + } + else + { + /* i == an->maxlength */ + climb_tree = 1; + } + } + else + { + u8_t j; + /* ident_len == 0, complete with leftmost '.thing' */ + j = 0; + while ((j < an->maxlength) && empty_table(an->nptr[j])) + { + j++; + } + if (j < an->maxlength) + { + LWIP_DEBUGF(SNMP_MIB_DEBUG,("left an->objid[j]==%"S32_F"\n",an->objid[j])); + oidret->id[oidret->len] = an->objid[j]; + (oidret->len)++; + if (an->nptr[j] == NULL) + { + /* leaf node */ + return (struct mib_node*)an; + } + else + { + /* no leaf, continue */ + node = an->nptr[j]; + } + } + else + { + /* j == an->maxlength */ + climb_tree = 1; + } + } + } + else if(node_type == MIB_NODE_LR) + { + struct mib_list_rootnode *lrn; + struct mib_list_node *ln; + + /* list root node (internal 'RAM', variable length) */ + lrn = (struct mib_list_rootnode *)node; + if (ident_len > 0) + { + ln = lrn->head; + /* iterate over list, head to tail */ + while ((ln != NULL) && (ln->objid < *ident)) + { + ln = ln->next; + } + if (ln != NULL) + { + LWIP_DEBUGF(SNMP_MIB_DEBUG,("ln->objid==%"S32_F" *ident==%"S32_F"\n",ln->objid,*ident)); + oidret->id[oidret->len] = ln->objid; + (oidret->len)++; + if (ln->nptr == NULL) + { + /* leaf node */ + if (ln->objid > *ident) + { + return (struct mib_node*)lrn; + } + else if (ln->next != NULL) + { + /* ln->objid == *ident */ + (oidret->len)--; + oidret->id[oidret->len] = ln->next->objid; + (oidret->len)++; + return (struct mib_node*)lrn; + } + else + { + /* ln->next == NULL */ + (oidret->len)--; + climb_tree = 1; + } + } + else + { + struct mib_list_node *jn; + struct nse cur_node; + + /* non-leaf, store right child ptr and id */ + jn = ln->next; + while ((jn != NULL) && empty_table(jn->nptr)) + { + jn = jn->next; + } + if (jn != NULL) + { + cur_node.r_ptr = jn->nptr; + cur_node.r_id = jn->objid; + cur_node.r_nl = 0; + } + else + { + cur_node.r_ptr = NULL; + } + push_node(&cur_node); + if (ln->objid == *ident) + { + ident_len--; + ident++; + } + else + { + /* ln->objid < *ident */ + ident_len = 0; + } + /* follow next child pointer */ + node = ln->nptr; + } + + } + else + { + /* ln == NULL */ + climb_tree = 1; + } + } + else + { + struct mib_list_node *jn; + /* ident_len == 0, complete with leftmost '.thing' */ + jn = lrn->head; + while ((jn != NULL) && empty_table(jn->nptr)) + { + jn = jn->next; + } + if (jn != NULL) + { + LWIP_DEBUGF(SNMP_MIB_DEBUG,("left jn->objid==%"S32_F"\n",jn->objid)); + oidret->id[oidret->len] = jn->objid; + (oidret->len)++; + if (jn->nptr == NULL) + { + /* leaf node */ + LWIP_DEBUGF(SNMP_MIB_DEBUG,("jn->nptr == NULL\n")); + return (struct mib_node*)lrn; + } + else + { + /* no leaf, continue */ + node = jn->nptr; + } + } + else + { + /* jn == NULL */ + climb_tree = 1; + } + } + } + else if(node_type == MIB_NODE_EX) + { + struct mib_external_node *en; + s32_t ex_id; + + /* external node (addressing and access via functions) */ + en = (struct mib_external_node *)node; + if (ident_len > 0) + { + u16_t i, len; + + i = 0; + len = en->level_length(en->addr_inf,ext_level); + while ((i < len) && (en->ident_cmp(en->addr_inf,ext_level,i,*ident) < 0)) + { + i++; + } + if (i < len) + { + /* add identifier to oidret */ + en->get_objid(en->addr_inf,ext_level,i,&ex_id); + LWIP_DEBUGF(SNMP_MIB_DEBUG,("en->objid[%"U16_F"]==%"S32_F" *ident==%"S32_F"\n",i,ex_id,*ident)); + oidret->id[oidret->len] = ex_id; + (oidret->len)++; + + if ((ext_level + 1) == en->tree_levels) + { + LWIP_DEBUGF(SNMP_MIB_DEBUG,("leaf node\n")); + /* leaf node */ + if (ex_id > *ident) + { + return (struct mib_node*)en; + } + else if ((i + 1) < len) + { + /* ex_id == *ident */ + en->get_objid(en->addr_inf,ext_level,i + 1,&ex_id); + (oidret->len)--; + oidret->id[oidret->len] = ex_id; + (oidret->len)++; + return (struct mib_node*)en; + } + else + { + /* (i + 1) == len */ + (oidret->len)--; + climb_tree = 1; + } + } + else + { + u8_t j; + struct nse cur_node; + + LWIP_DEBUGF(SNMP_MIB_DEBUG,("non-leaf node\n")); + /* non-leaf, store right child ptr and id */ + LWIP_ASSERT("i < 0xff", i < 0xff); + j = (u8_t)i + 1; + if (j < len) + { + /* right node is the current external node */ + cur_node.r_ptr = node; + en->get_objid(en->addr_inf,ext_level,j,&cur_node.r_id); + cur_node.r_nl = ext_level + 1; + } + else + { + cur_node.r_ptr = NULL; + } + push_node(&cur_node); + if (en->ident_cmp(en->addr_inf,ext_level,i,*ident) == 0) + { + ident_len--; + ident++; + } + else + { + /* external id < *ident */ + ident_len = 0; + } + /* proceed to child */ + ext_level++; + } + } + else + { + /* i == len (en->level_len()) */ + climb_tree = 1; + } + } + else + { + /* ident_len == 0, complete with leftmost '.thing' */ + en->get_objid(en->addr_inf,ext_level,0,&ex_id); + LWIP_DEBUGF(SNMP_MIB_DEBUG,("left en->objid==%"S32_F"\n",ex_id)); + oidret->id[oidret->len] = ex_id; + (oidret->len)++; + if ((ext_level + 1) == en->tree_levels) + { + /* leaf node */ + LWIP_DEBUGF(SNMP_MIB_DEBUG,("(ext_level + 1) == en->tree_levels\n")); + return (struct mib_node*)en; + } + else + { + /* no leaf, proceed to child */ + ext_level++; + } + } + } + else if(node_type == MIB_NODE_SC) + { + mib_scalar_node *sn; + + /* scalar node */ + sn = (mib_scalar_node *)node; + if (ident_len > 0) + { + /* at .0 */ + climb_tree = 1; + } + else + { + /* ident_len == 0, complete object identifier */ + oidret->id[oidret->len] = 0; + (oidret->len)++; + /* leaf node */ + LWIP_DEBUGF(SNMP_MIB_DEBUG,("completed scalar leaf\n")); + return (struct mib_node*)sn; + } + } + else + { + /* unknown/unhandled node_type */ + LWIP_DEBUGF(SNMP_MIB_DEBUG,("expand failed node_type %"U16_F" unkown\n",(u16_t)node_type)); + return NULL; + } + + if (climb_tree) + { + struct nse child; + + /* find right child ptr */ + child.r_ptr = NULL; + child.r_id = 0; + child.r_nl = 0; + while ((node_stack_cnt > 0) && (child.r_ptr == NULL)) + { + pop_node(&child); + /* trim returned oid */ + (oidret->len)--; + } + if (child.r_ptr != NULL) + { + /* incoming ident is useless beyond this point */ + ident_len = 0; + oidret->id[oidret->len] = child.r_id; + oidret->len++; + node = child.r_ptr; + ext_level = child.r_nl; + } + else + { + /* tree ends here ... */ + LWIP_DEBUGF(SNMP_MIB_DEBUG,("expand failed, tree ends here\n")); + return NULL; + } + } + } + /* done, found nothing */ + LWIP_DEBUGF(SNMP_MIB_DEBUG,("expand failed node==%p\n",(void*)node)); + return NULL; +} + +/** + * Test object identifier for the iso.org.dod.internet prefix. + * + * @param ident_len the length of the supplied object identifier + * @param ident points to the array of sub identifiers + * @return 1 if it matches, 0 otherwise + */ +u8_t +snmp_iso_prefix_tst(u8_t ident_len, s32_t *ident) +{ + if ((ident_len > 3) && + (ident[0] == 1) && (ident[1] == 3) && + (ident[2] == 6) && (ident[3] == 1)) + { + return 1; + } + else + { + return 0; + } +} + +/** + * Expands object identifier to the iso.org.dod.internet + * prefix for use in getnext operation. + * + * @param ident_len the length of the supplied object identifier + * @param ident points to the array of sub identifiers + * @param oidret points to returned expanded object identifier + * @return 1 if it matches, 0 otherwise + * + * @note ident_len 0 is allowed, expanding to the first known object id!! + */ +u8_t +snmp_iso_prefix_expand(u8_t ident_len, s32_t *ident, struct snmp_obj_id *oidret) +{ + const s32_t *prefix_ptr; + s32_t *ret_ptr; + u8_t i; + + i = 0; + prefix_ptr = &prefix[0]; + ret_ptr = &oidret->id[0]; + ident_len = ((ident_len < 4)?ident_len:4); + while ((i < ident_len) && ((*ident) <= (*prefix_ptr))) + { + *ret_ptr++ = *prefix_ptr++; + ident++; + i++; + } + if (i == ident_len) + { + /* match, complete missing bits */ + while (i < 4) + { + *ret_ptr++ = *prefix_ptr++; + i++; + } + oidret->len = i; + return 1; + } + else + { + /* i != ident_len */ + return 0; + } +} + +#endif /* LWIP_SNMP */ diff --git a/lib/drivers/lwip/src/core/snmp/msg_in.c b/lib/drivers/lwip/src/core/snmp/msg_in.c new file mode 100644 index 00000000000..2dfb55b253a --- /dev/null +++ b/lib/drivers/lwip/src/core/snmp/msg_in.c @@ -0,0 +1,1437 @@ +/** + * @file + * SNMP input message processing (RFC1157). + */ + +/* + * Copyright (c) 2006 Axon Digital Design B.V., The Netherlands. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * Author: Christiaan Simons + */ + +#include "lwip/opt.h" + +#if LWIP_SNMP /* don't build if not configured for use in lwipopts.h */ + +#include "lwip/snmp.h" +#include "lwip/snmp_asn1.h" +#include "lwip/snmp_msg.h" +#include "lwip/snmp_structs.h" +#include "lwip/ip_addr.h" +#include "lwip/memp.h" +#include "lwip/udp.h" +#include "lwip/stats.h" + +#include + +/* public (non-static) constants */ +/** SNMP v1 == 0 */ +const s32_t snmp_version = 0; +/** default SNMP community string */ +const char snmp_publiccommunity[7] = "public"; + +/* statically allocated buffers for SNMP_CONCURRENT_REQUESTS */ +struct snmp_msg_pstat msg_input_list[SNMP_CONCURRENT_REQUESTS]; +/* UDP Protocol Control Block */ +struct udp_pcb *snmp1_pcb; + +static void snmp_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p, ip_addr_t *addr, u16_t port); +static err_t snmp_pdu_header_check(struct pbuf *p, u16_t ofs, u16_t pdu_len, u16_t *ofs_ret, struct snmp_msg_pstat *m_stat); +static err_t snmp_pdu_dec_varbindlist(struct pbuf *p, u16_t ofs, u16_t *ofs_ret, struct snmp_msg_pstat *m_stat); + + +/** + * Starts SNMP Agent. + * Allocates UDP pcb and binds it to IP_ADDR_ANY port 161. + */ +void +snmp_init(void) +{ + struct snmp_msg_pstat *msg_ps; + u8_t i; + + snmp1_pcb = udp_new(); + if (snmp1_pcb != NULL) + { + udp_recv(snmp1_pcb, snmp_recv, (void *)SNMP_IN_PORT); + udp_bind(snmp1_pcb, IP_ADDR_ANY, SNMP_IN_PORT); + } + msg_ps = &msg_input_list[0]; + for (i=0; istate = SNMP_MSG_EMPTY; + msg_ps->error_index = 0; + msg_ps->error_status = SNMP_ES_NOERROR; + msg_ps++; + } + trap_msg.pcb = snmp1_pcb; + +#ifdef SNMP_PRIVATE_MIB_INIT + /* If defined, rhis must be a function-like define to initialize the + * private MIB after the stack has been initialized. + * The private MIB can also be initialized in tcpip_callback (or after + * the stack is initialized), this define is only for convenience. */ + SNMP_PRIVATE_MIB_INIT(); +#endif /* SNMP_PRIVATE_MIB_INIT */ + + /* The coldstart trap will only be output + if our outgoing interface is up & configured */ + snmp_coldstart_trap(); +} + +static void +snmp_error_response(struct snmp_msg_pstat *msg_ps, u8_t error) +{ + snmp_varbind_list_free(&msg_ps->outvb); + msg_ps->outvb = msg_ps->invb; + msg_ps->invb.head = NULL; + msg_ps->invb.tail = NULL; + msg_ps->invb.count = 0; + msg_ps->error_status = error; + msg_ps->error_index = 1 + msg_ps->vb_idx; + snmp_send_response(msg_ps); + snmp_varbind_list_free(&msg_ps->outvb); + msg_ps->state = SNMP_MSG_EMPTY; +} + +static void +snmp_ok_response(struct snmp_msg_pstat *msg_ps) +{ + err_t err_ret; + + err_ret = snmp_send_response(msg_ps); + if (err_ret == ERR_MEM) + { + /* serious memory problem, can't return tooBig */ + } + else + { + LWIP_DEBUGF(SNMP_MSG_DEBUG, ("snmp_msg_event = %"S32_F"\n",msg_ps->error_status)); + } + /* free varbinds (if available) */ + snmp_varbind_list_free(&msg_ps->invb); + snmp_varbind_list_free(&msg_ps->outvb); + msg_ps->state = SNMP_MSG_EMPTY; +} + +/** + * Service an internal or external event for SNMP GET. + * + * @param request_id identifies requests from 0 to (SNMP_CONCURRENT_REQUESTS-1) + * @param msg_ps points to the assosicated message process state + */ +static void +snmp_msg_get_event(u8_t request_id, struct snmp_msg_pstat *msg_ps) +{ + LWIP_DEBUGF(SNMP_MSG_DEBUG, ("snmp_msg_get_event: msg_ps->state==%"U16_F"\n",(u16_t)msg_ps->state)); + + if (msg_ps->state == SNMP_MSG_EXTERNAL_GET_OBJDEF) + { + struct mib_external_node *en; + struct snmp_name_ptr np; + + /* get_object_def() answer*/ + en = msg_ps->ext_mib_node; + np = msg_ps->ext_name_ptr; + + /* translate answer into a known lifeform */ + en->get_object_def_a(request_id, np.ident_len, np.ident, &msg_ps->ext_object_def); + if ((msg_ps->ext_object_def.instance != MIB_OBJECT_NONE) && + (msg_ps->ext_object_def.access & MIB_ACCESS_READ)) + { + msg_ps->state = SNMP_MSG_EXTERNAL_GET_VALUE; + en->get_value_q(request_id, &msg_ps->ext_object_def); + } + else + { + en->get_object_def_pc(request_id, np.ident_len, np.ident); + /* search failed, object id points to unknown object (nosuchname) */ + snmp_error_response(msg_ps,SNMP_ES_NOSUCHNAME); + } + } + else if (msg_ps->state == SNMP_MSG_EXTERNAL_GET_VALUE) + { + struct mib_external_node *en; + struct snmp_varbind *vb; + + /* get_value() answer */ + en = msg_ps->ext_mib_node; + + /* allocate output varbind */ + vb = (struct snmp_varbind *)memp_malloc(MEMP_SNMP_VARBIND); + LWIP_ASSERT("vb != NULL",vb != NULL); + if (vb != NULL) + { + vb->next = NULL; + vb->prev = NULL; + + /* move name from invb to outvb */ + vb->ident = msg_ps->vb_ptr->ident; + vb->ident_len = msg_ps->vb_ptr->ident_len; + /* ensure this memory is refereced once only */ + msg_ps->vb_ptr->ident = NULL; + msg_ps->vb_ptr->ident_len = 0; + + vb->value_type = msg_ps->ext_object_def.asn_type; + LWIP_ASSERT("invalid length", msg_ps->ext_object_def.v_len <= 0xff); + vb->value_len = (u8_t)msg_ps->ext_object_def.v_len; + if (vb->value_len > 0) + { + LWIP_ASSERT("SNMP_MAX_OCTET_STRING_LEN is configured too low", vb->value_len <= SNMP_MAX_VALUE_SIZE); + vb->value = memp_malloc(MEMP_SNMP_VALUE); + LWIP_ASSERT("vb->value != NULL",vb->value != NULL); + if (vb->value != NULL) + { + en->get_value_a(request_id, &msg_ps->ext_object_def, vb->value_len, vb->value); + snmp_varbind_tail_add(&msg_ps->outvb, vb); + /* search again (if vb_idx < msg_ps->invb.count) */ + msg_ps->state = SNMP_MSG_SEARCH_OBJ; + msg_ps->vb_idx += 1; + } + else + { + en->get_value_pc(request_id, &msg_ps->ext_object_def); + LWIP_DEBUGF(SNMP_MSG_DEBUG, ("snmp_msg_event: no variable space\n")); + msg_ps->vb_ptr->ident = vb->ident; + msg_ps->vb_ptr->ident_len = vb->ident_len; + memp_free(MEMP_SNMP_VARBIND, vb); + snmp_error_response(msg_ps,SNMP_ES_TOOBIG); + } + } + else + { + /* vb->value_len == 0, empty value (e.g. empty string) */ + en->get_value_a(request_id, &msg_ps->ext_object_def, 0, NULL); + vb->value = NULL; + snmp_varbind_tail_add(&msg_ps->outvb, vb); + /* search again (if vb_idx < msg_ps->invb.count) */ + msg_ps->state = SNMP_MSG_SEARCH_OBJ; + msg_ps->vb_idx += 1; + } + } + else + { + en->get_value_pc(request_id, &msg_ps->ext_object_def); + LWIP_DEBUGF(SNMP_MSG_DEBUG, ("snmp_msg_event: no outvb space\n")); + snmp_error_response(msg_ps,SNMP_ES_TOOBIG); + } + } + + while ((msg_ps->state == SNMP_MSG_SEARCH_OBJ) && + (msg_ps->vb_idx < msg_ps->invb.count)) + { + struct mib_node *mn; + struct snmp_name_ptr np; + + if (msg_ps->vb_idx == 0) + { + msg_ps->vb_ptr = msg_ps->invb.head; + } + else + { + msg_ps->vb_ptr = msg_ps->vb_ptr->next; + } + /** test object identifier for .iso.org.dod.internet prefix */ + if (snmp_iso_prefix_tst(msg_ps->vb_ptr->ident_len, msg_ps->vb_ptr->ident)) + { + mn = snmp_search_tree((struct mib_node*)&internet, msg_ps->vb_ptr->ident_len - 4, + msg_ps->vb_ptr->ident + 4, &np); + if (mn != NULL) + { + if (mn->node_type == MIB_NODE_EX) + { + /* external object */ + struct mib_external_node *en = (struct mib_external_node*)mn; + + msg_ps->state = SNMP_MSG_EXTERNAL_GET_OBJDEF; + /* save en && args in msg_ps!! */ + msg_ps->ext_mib_node = en; + msg_ps->ext_name_ptr = np; + + en->get_object_def_q(en->addr_inf, request_id, np.ident_len, np.ident); + } + else + { + /* internal object */ + struct obj_def object_def; + + msg_ps->state = SNMP_MSG_INTERNAL_GET_OBJDEF; + mn->get_object_def(np.ident_len, np.ident, &object_def); + if ((object_def.instance != MIB_OBJECT_NONE) && + (object_def.access & MIB_ACCESS_READ)) + { + mn = mn; + } + else + { + /* search failed, object id points to unknown object (nosuchname) */ + mn = NULL; + } + if (mn != NULL) + { + struct snmp_varbind *vb; + + msg_ps->state = SNMP_MSG_INTERNAL_GET_VALUE; + /* allocate output varbind */ + vb = (struct snmp_varbind *)memp_malloc(MEMP_SNMP_VARBIND); + LWIP_ASSERT("vb != NULL",vb != NULL); + if (vb != NULL) + { + vb->next = NULL; + vb->prev = NULL; + + /* move name from invb to outvb */ + vb->ident = msg_ps->vb_ptr->ident; + vb->ident_len = msg_ps->vb_ptr->ident_len; + /* ensure this memory is refereced once only */ + msg_ps->vb_ptr->ident = NULL; + msg_ps->vb_ptr->ident_len = 0; + + vb->value_type = object_def.asn_type; + LWIP_ASSERT("invalid length", object_def.v_len <= 0xff); + vb->value_len = (u8_t)object_def.v_len; + if (vb->value_len > 0) + { + LWIP_ASSERT("SNMP_MAX_OCTET_STRING_LEN is configured too low", + vb->value_len <= SNMP_MAX_VALUE_SIZE); + vb->value = memp_malloc(MEMP_SNMP_VALUE); + LWIP_ASSERT("vb->value != NULL",vb->value != NULL); + if (vb->value != NULL) + { + mn->get_value(&object_def, vb->value_len, vb->value); + snmp_varbind_tail_add(&msg_ps->outvb, vb); + msg_ps->state = SNMP_MSG_SEARCH_OBJ; + msg_ps->vb_idx += 1; + } + else + { + LWIP_DEBUGF(SNMP_MSG_DEBUG, ("snmp_msg_event: couldn't allocate variable space\n")); + msg_ps->vb_ptr->ident = vb->ident; + msg_ps->vb_ptr->ident_len = vb->ident_len; + memp_free(MEMP_SNMP_VARBIND, vb); + snmp_error_response(msg_ps,SNMP_ES_TOOBIG); + } + } + else + { + /* vb->value_len == 0, empty value (e.g. empty string) */ + vb->value = NULL; + snmp_varbind_tail_add(&msg_ps->outvb, vb); + msg_ps->state = SNMP_MSG_SEARCH_OBJ; + msg_ps->vb_idx += 1; + } + } + else + { + LWIP_DEBUGF(SNMP_MSG_DEBUG, ("snmp_msg_event: couldn't allocate outvb space\n")); + snmp_error_response(msg_ps,SNMP_ES_TOOBIG); + } + } + } + } + } + else + { + mn = NULL; + } + if (mn == NULL) + { + /* mn == NULL, noSuchName */ + snmp_error_response(msg_ps,SNMP_ES_NOSUCHNAME); + } + } + if ((msg_ps->state == SNMP_MSG_SEARCH_OBJ) && + (msg_ps->vb_idx == msg_ps->invb.count)) + { + snmp_ok_response(msg_ps); + } +} + +/** + * Service an internal or external event for SNMP GETNEXT. + * + * @param request_id identifies requests from 0 to (SNMP_CONCURRENT_REQUESTS-1) + * @param msg_ps points to the assosicated message process state + */ +static void +snmp_msg_getnext_event(u8_t request_id, struct snmp_msg_pstat *msg_ps) +{ + LWIP_DEBUGF(SNMP_MSG_DEBUG, ("snmp_msg_getnext_event: msg_ps->state==%"U16_F"\n",(u16_t)msg_ps->state)); + + if (msg_ps->state == SNMP_MSG_EXTERNAL_GET_OBJDEF) + { + struct mib_external_node *en; + + /* get_object_def() answer*/ + en = msg_ps->ext_mib_node; + + /* translate answer into a known lifeform */ + en->get_object_def_a(request_id, 1, &msg_ps->ext_oid.id[msg_ps->ext_oid.len - 1], &msg_ps->ext_object_def); + if (msg_ps->ext_object_def.instance != MIB_OBJECT_NONE) + { + msg_ps->state = SNMP_MSG_EXTERNAL_GET_VALUE; + en->get_value_q(request_id, &msg_ps->ext_object_def); + } + else + { + en->get_object_def_pc(request_id, 1, &msg_ps->ext_oid.id[msg_ps->ext_oid.len - 1]); + /* search failed, object id points to unknown object (nosuchname) */ + snmp_error_response(msg_ps,SNMP_ES_NOSUCHNAME); + } + } + else if (msg_ps->state == SNMP_MSG_EXTERNAL_GET_VALUE) + { + struct mib_external_node *en; + struct snmp_varbind *vb; + + /* get_value() answer */ + en = msg_ps->ext_mib_node; + + LWIP_ASSERT("invalid length", msg_ps->ext_object_def.v_len <= 0xff); + vb = snmp_varbind_alloc(&msg_ps->ext_oid, + msg_ps->ext_object_def.asn_type, + (u8_t)msg_ps->ext_object_def.v_len); + if (vb != NULL) + { + en->get_value_a(request_id, &msg_ps->ext_object_def, vb->value_len, vb->value); + snmp_varbind_tail_add(&msg_ps->outvb, vb); + msg_ps->state = SNMP_MSG_SEARCH_OBJ; + msg_ps->vb_idx += 1; + } + else + { + en->get_value_pc(request_id, &msg_ps->ext_object_def); + LWIP_DEBUGF(SNMP_MSG_DEBUG, ("snmp_msg_getnext_event: couldn't allocate outvb space\n")); + snmp_error_response(msg_ps,SNMP_ES_TOOBIG); + } + } + + while ((msg_ps->state == SNMP_MSG_SEARCH_OBJ) && + (msg_ps->vb_idx < msg_ps->invb.count)) + { + struct mib_node *mn; + struct snmp_obj_id oid; + + if (msg_ps->vb_idx == 0) + { + msg_ps->vb_ptr = msg_ps->invb.head; + } + else + { + msg_ps->vb_ptr = msg_ps->vb_ptr->next; + } + if (snmp_iso_prefix_expand(msg_ps->vb_ptr->ident_len, msg_ps->vb_ptr->ident, &oid)) + { + if (msg_ps->vb_ptr->ident_len > 3) + { + /* can offset ident_len and ident */ + mn = snmp_expand_tree((struct mib_node*)&internet, + msg_ps->vb_ptr->ident_len - 4, + msg_ps->vb_ptr->ident + 4, &oid); + } + else + { + /* can't offset ident_len -4, ident + 4 */ + mn = snmp_expand_tree((struct mib_node*)&internet, 0, NULL, &oid); + } + } + else + { + mn = NULL; + } + if (mn != NULL) + { + if (mn->node_type == MIB_NODE_EX) + { + /* external object */ + struct mib_external_node *en = (struct mib_external_node*)mn; + + msg_ps->state = SNMP_MSG_EXTERNAL_GET_OBJDEF; + /* save en && args in msg_ps!! */ + msg_ps->ext_mib_node = en; + msg_ps->ext_oid = oid; + + en->get_object_def_q(en->addr_inf, request_id, 1, &oid.id[oid.len - 1]); + } + else + { + /* internal object */ + struct obj_def object_def; + struct snmp_varbind *vb; + + msg_ps->state = SNMP_MSG_INTERNAL_GET_OBJDEF; + mn->get_object_def(1, &oid.id[oid.len - 1], &object_def); + + LWIP_ASSERT("invalid length", object_def.v_len <= 0xff); + vb = snmp_varbind_alloc(&oid, object_def.asn_type, (u8_t)object_def.v_len); + if (vb != NULL) + { + msg_ps->state = SNMP_MSG_INTERNAL_GET_VALUE; + mn->get_value(&object_def, object_def.v_len, vb->value); + snmp_varbind_tail_add(&msg_ps->outvb, vb); + msg_ps->state = SNMP_MSG_SEARCH_OBJ; + msg_ps->vb_idx += 1; + } + else + { + LWIP_DEBUGF(SNMP_MSG_DEBUG, ("snmp_recv couldn't allocate outvb space\n")); + snmp_error_response(msg_ps,SNMP_ES_TOOBIG); + } + } + } + if (mn == NULL) + { + /* mn == NULL, noSuchName */ + snmp_error_response(msg_ps,SNMP_ES_NOSUCHNAME); + } + } + if ((msg_ps->state == SNMP_MSG_SEARCH_OBJ) && + (msg_ps->vb_idx == msg_ps->invb.count)) + { + snmp_ok_response(msg_ps); + } +} + +/** + * Service an internal or external event for SNMP SET. + * + * @param request_id identifies requests from 0 to (SNMP_CONCURRENT_REQUESTS-1) + * @param msg_ps points to the assosicated message process state + */ +static void +snmp_msg_set_event(u8_t request_id, struct snmp_msg_pstat *msg_ps) +{ + LWIP_DEBUGF(SNMP_MSG_DEBUG, ("snmp_msg_set_event: msg_ps->state==%"U16_F"\n",(u16_t)msg_ps->state)); + + if (msg_ps->state == SNMP_MSG_EXTERNAL_GET_OBJDEF) + { + struct mib_external_node *en; + struct snmp_name_ptr np; + + /* get_object_def() answer*/ + en = msg_ps->ext_mib_node; + np = msg_ps->ext_name_ptr; + + /* translate answer into a known lifeform */ + en->get_object_def_a(request_id, np.ident_len, np.ident, &msg_ps->ext_object_def); + if (msg_ps->ext_object_def.instance != MIB_OBJECT_NONE) + { + msg_ps->state = SNMP_MSG_EXTERNAL_SET_TEST; + en->set_test_q(request_id, &msg_ps->ext_object_def); + } + else + { + en->get_object_def_pc(request_id, np.ident_len, np.ident); + /* search failed, object id points to unknown object (nosuchname) */ + snmp_error_response(msg_ps,SNMP_ES_NOSUCHNAME); + } + } + else if (msg_ps->state == SNMP_MSG_EXTERNAL_SET_TEST) + { + struct mib_external_node *en; + + /* set_test() answer*/ + en = msg_ps->ext_mib_node; + + if (msg_ps->ext_object_def.access & MIB_ACCESS_WRITE) + { + if ((msg_ps->ext_object_def.asn_type == msg_ps->vb_ptr->value_type) && + (en->set_test_a(request_id,&msg_ps->ext_object_def, + msg_ps->vb_ptr->value_len,msg_ps->vb_ptr->value) != 0)) + { + msg_ps->state = SNMP_MSG_SEARCH_OBJ; + msg_ps->vb_idx += 1; + } + else + { + en->set_test_pc(request_id,&msg_ps->ext_object_def); + /* bad value */ + snmp_error_response(msg_ps,SNMP_ES_BADVALUE); + } + } + else + { + en->set_test_pc(request_id,&msg_ps->ext_object_def); + /* object not available for set */ + snmp_error_response(msg_ps,SNMP_ES_NOSUCHNAME); + } + } + else if (msg_ps->state == SNMP_MSG_EXTERNAL_GET_OBJDEF_S) + { + struct mib_external_node *en; + struct snmp_name_ptr np; + + /* get_object_def() answer*/ + en = msg_ps->ext_mib_node; + np = msg_ps->ext_name_ptr; + + /* translate answer into a known lifeform */ + en->get_object_def_a(request_id, np.ident_len, np.ident, &msg_ps->ext_object_def); + if (msg_ps->ext_object_def.instance != MIB_OBJECT_NONE) + { + msg_ps->state = SNMP_MSG_EXTERNAL_SET_VALUE; + en->set_value_q(request_id, &msg_ps->ext_object_def, + msg_ps->vb_ptr->value_len,msg_ps->vb_ptr->value); + } + else + { + en->get_object_def_pc(request_id, np.ident_len, np.ident); + /* set_value failed, object has disappeared for some odd reason?? */ + snmp_error_response(msg_ps,SNMP_ES_GENERROR); + } + } + else if (msg_ps->state == SNMP_MSG_EXTERNAL_SET_VALUE) + { + struct mib_external_node *en; + + /** set_value_a() */ + en = msg_ps->ext_mib_node; + en->set_value_a(request_id, &msg_ps->ext_object_def, + msg_ps->vb_ptr->value_len, msg_ps->vb_ptr->value); + + /** @todo use set_value_pc() if toobig */ + msg_ps->state = SNMP_MSG_INTERNAL_SET_VALUE; + msg_ps->vb_idx += 1; + } + + /* test all values before setting */ + while ((msg_ps->state == SNMP_MSG_SEARCH_OBJ) && + (msg_ps->vb_idx < msg_ps->invb.count)) + { + struct mib_node *mn; + struct snmp_name_ptr np; + + if (msg_ps->vb_idx == 0) + { + msg_ps->vb_ptr = msg_ps->invb.head; + } + else + { + msg_ps->vb_ptr = msg_ps->vb_ptr->next; + } + /** test object identifier for .iso.org.dod.internet prefix */ + if (snmp_iso_prefix_tst(msg_ps->vb_ptr->ident_len, msg_ps->vb_ptr->ident)) + { + mn = snmp_search_tree((struct mib_node*)&internet, msg_ps->vb_ptr->ident_len - 4, + msg_ps->vb_ptr->ident + 4, &np); + if (mn != NULL) + { + if (mn->node_type == MIB_NODE_EX) + { + /* external object */ + struct mib_external_node *en = (struct mib_external_node*)mn; + + msg_ps->state = SNMP_MSG_EXTERNAL_GET_OBJDEF; + /* save en && args in msg_ps!! */ + msg_ps->ext_mib_node = en; + msg_ps->ext_name_ptr = np; + + en->get_object_def_q(en->addr_inf, request_id, np.ident_len, np.ident); + } + else + { + /* internal object */ + struct obj_def object_def; + + msg_ps->state = SNMP_MSG_INTERNAL_GET_OBJDEF; + mn->get_object_def(np.ident_len, np.ident, &object_def); + if (object_def.instance != MIB_OBJECT_NONE) + { + mn = mn; + } + else + { + /* search failed, object id points to unknown object (nosuchname) */ + mn = NULL; + } + if (mn != NULL) + { + msg_ps->state = SNMP_MSG_INTERNAL_SET_TEST; + + if (object_def.access & MIB_ACCESS_WRITE) + { + if ((object_def.asn_type == msg_ps->vb_ptr->value_type) && + (mn->set_test(&object_def,msg_ps->vb_ptr->value_len,msg_ps->vb_ptr->value) != 0)) + { + msg_ps->state = SNMP_MSG_SEARCH_OBJ; + msg_ps->vb_idx += 1; + } + else + { + /* bad value */ + snmp_error_response(msg_ps,SNMP_ES_BADVALUE); + } + } + else + { + /* object not available for set */ + snmp_error_response(msg_ps,SNMP_ES_NOSUCHNAME); + } + } + } + } + } + else + { + mn = NULL; + } + if (mn == NULL) + { + /* mn == NULL, noSuchName */ + snmp_error_response(msg_ps,SNMP_ES_NOSUCHNAME); + } + } + + if ((msg_ps->state == SNMP_MSG_SEARCH_OBJ) && + (msg_ps->vb_idx == msg_ps->invb.count)) + { + msg_ps->vb_idx = 0; + msg_ps->state = SNMP_MSG_INTERNAL_SET_VALUE; + } + + /* set all values "atomically" (be as "atomic" as possible) */ + while ((msg_ps->state == SNMP_MSG_INTERNAL_SET_VALUE) && + (msg_ps->vb_idx < msg_ps->invb.count)) + { + struct mib_node *mn; + struct snmp_name_ptr np; + + if (msg_ps->vb_idx == 0) + { + msg_ps->vb_ptr = msg_ps->invb.head; + } + else + { + msg_ps->vb_ptr = msg_ps->vb_ptr->next; + } + /* skip iso prefix test, was done previously while settesting() */ + mn = snmp_search_tree((struct mib_node*)&internet, msg_ps->vb_ptr->ident_len - 4, + msg_ps->vb_ptr->ident + 4, &np); + /* check if object is still available + (e.g. external hot-plug thingy present?) */ + if (mn != NULL) + { + if (mn->node_type == MIB_NODE_EX) + { + /* external object */ + struct mib_external_node *en = (struct mib_external_node*)mn; + + msg_ps->state = SNMP_MSG_EXTERNAL_GET_OBJDEF_S; + /* save en && args in msg_ps!! */ + msg_ps->ext_mib_node = en; + msg_ps->ext_name_ptr = np; + + en->get_object_def_q(en->addr_inf, request_id, np.ident_len, np.ident); + } + else + { + /* internal object */ + struct obj_def object_def; + + msg_ps->state = SNMP_MSG_INTERNAL_GET_OBJDEF_S; + mn->get_object_def(np.ident_len, np.ident, &object_def); + msg_ps->state = SNMP_MSG_INTERNAL_SET_VALUE; + mn->set_value(&object_def,msg_ps->vb_ptr->value_len,msg_ps->vb_ptr->value); + msg_ps->vb_idx += 1; + } + } + } + if ((msg_ps->state == SNMP_MSG_INTERNAL_SET_VALUE) && + (msg_ps->vb_idx == msg_ps->invb.count)) + { + /* simply echo the input if we can set it + @todo do we need to return the actual value? + e.g. if value is silently modified or behaves sticky? */ + msg_ps->outvb = msg_ps->invb; + msg_ps->invb.head = NULL; + msg_ps->invb.tail = NULL; + msg_ps->invb.count = 0; + snmp_ok_response(msg_ps); + } +} + + +/** + * Handle one internal or external event. + * Called for one async event. (recv external/private answer) + * + * @param request_id identifies requests from 0 to (SNMP_CONCURRENT_REQUESTS-1) + */ +void +snmp_msg_event(u8_t request_id) +{ + struct snmp_msg_pstat *msg_ps; + + if (request_id < SNMP_CONCURRENT_REQUESTS) + { + msg_ps = &msg_input_list[request_id]; + if (msg_ps->rt == SNMP_ASN1_PDU_GET_NEXT_REQ) + { + snmp_msg_getnext_event(request_id, msg_ps); + } + else if (msg_ps->rt == SNMP_ASN1_PDU_GET_REQ) + { + snmp_msg_get_event(request_id, msg_ps); + } + else if(msg_ps->rt == SNMP_ASN1_PDU_SET_REQ) + { + snmp_msg_set_event(request_id, msg_ps); + } + } +} + + +/* lwIP UDP receive callback function */ +static void +snmp_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p, ip_addr_t *addr, u16_t port) +{ + struct snmp_msg_pstat *msg_ps; + u8_t req_idx; + err_t err_ret; + u16_t payload_len = p->tot_len; + u16_t payload_ofs = 0; + u16_t varbind_ofs = 0; + + /* suppress unused argument warning */ + LWIP_UNUSED_ARG(arg); + + /* traverse input message process list, look for SNMP_MSG_EMPTY */ + msg_ps = &msg_input_list[0]; + req_idx = 0; + while ((req_idx < SNMP_CONCURRENT_REQUESTS) && (msg_ps->state != SNMP_MSG_EMPTY)) + { + req_idx++; + msg_ps++; + } + if (req_idx == SNMP_CONCURRENT_REQUESTS) + { + /* exceeding number of concurrent requests */ + pbuf_free(p); + return; + } + + /* accepting request */ + snmp_inc_snmpinpkts(); + /* record used 'protocol control block' */ + msg_ps->pcb = pcb; + /* source address (network order) */ + msg_ps->sip = *addr; + /* source port (host order (lwIP oddity)) */ + msg_ps->sp = port; + + /* check total length, version, community, pdu type */ + err_ret = snmp_pdu_header_check(p, payload_ofs, payload_len, &varbind_ofs, msg_ps); + /* Only accept requests and requests without error (be robust) */ + /* Reject response and trap headers or error requests as input! */ + if ((err_ret != ERR_OK) || + ((msg_ps->rt != SNMP_ASN1_PDU_GET_REQ) && + (msg_ps->rt != SNMP_ASN1_PDU_GET_NEXT_REQ) && + (msg_ps->rt != SNMP_ASN1_PDU_SET_REQ)) || + ((msg_ps->error_status != SNMP_ES_NOERROR) || + (msg_ps->error_index != 0)) ) + { + /* header check failed drop request silently, do not return error! */ + pbuf_free(p); + LWIP_DEBUGF(SNMP_MSG_DEBUG, ("snmp_pdu_header_check() failed\n")); + return; + } + LWIP_DEBUGF(SNMP_MSG_DEBUG, ("snmp_recv ok, community %s\n", msg_ps->community)); + + /* Builds a list of variable bindings. Copy the varbinds from the pbuf + chain to glue them when these are divided over two or more pbuf's. */ + err_ret = snmp_pdu_dec_varbindlist(p, varbind_ofs, &varbind_ofs, msg_ps); + /* we've decoded the incoming message, release input msg now */ + pbuf_free(p); + if ((err_ret != ERR_OK) || (msg_ps->invb.count == 0)) + { + /* varbind-list decode failed, or varbind list empty. + drop request silently, do not return error! + (errors are only returned for a specific varbind failure) */ + LWIP_DEBUGF(SNMP_MSG_DEBUG, ("snmp_pdu_dec_varbindlist() failed\n")); + return; + } + + msg_ps->error_status = SNMP_ES_NOERROR; + msg_ps->error_index = 0; + /* find object for each variable binding */ + msg_ps->state = SNMP_MSG_SEARCH_OBJ; + /* first variable binding from list to inspect */ + msg_ps->vb_idx = 0; + + LWIP_DEBUGF(SNMP_MSG_DEBUG, ("snmp_recv varbind cnt=%"U16_F"\n",(u16_t)msg_ps->invb.count)); + + /* handle input event and as much objects as possible in one go */ + snmp_msg_event(req_idx); +} + +/** + * Checks and decodes incoming SNMP message header, logs header errors. + * + * @param p points to pbuf chain of SNMP message (UDP payload) + * @param ofs points to first octet of SNMP message + * @param pdu_len the length of the UDP payload + * @param ofs_ret returns the ofset of the variable bindings + * @param m_stat points to the current message request state return + * @return + * - ERR_OK SNMP header is sane and accepted + * - ERR_ARG SNMP header is either malformed or rejected + */ +static err_t +snmp_pdu_header_check(struct pbuf *p, u16_t ofs, u16_t pdu_len, u16_t *ofs_ret, struct snmp_msg_pstat *m_stat) +{ + err_t derr; + u16_t len, ofs_base; + u8_t len_octets; + u8_t type; + s32_t version; + + ofs_base = ofs; + snmp_asn1_dec_type(p, ofs, &type); + derr = snmp_asn1_dec_length(p, ofs+1, &len_octets, &len); + if ((derr != ERR_OK) || + (pdu_len != (1 + len_octets + len)) || + (type != (SNMP_ASN1_UNIV | SNMP_ASN1_CONSTR | SNMP_ASN1_SEQ))) + { + snmp_inc_snmpinasnparseerrs(); + return ERR_ARG; + } + ofs += (1 + len_octets); + snmp_asn1_dec_type(p, ofs, &type); + derr = snmp_asn1_dec_length(p, ofs+1, &len_octets, &len); + if ((derr != ERR_OK) || (type != (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG))) + { + /* can't decode or no integer (version) */ + snmp_inc_snmpinasnparseerrs(); + return ERR_ARG; + } + derr = snmp_asn1_dec_s32t(p, ofs + 1 + len_octets, len, &version); + if (derr != ERR_OK) + { + /* can't decode */ + snmp_inc_snmpinasnparseerrs(); + return ERR_ARG; + } + if (version != 0) + { + /* not version 1 */ + snmp_inc_snmpinbadversions(); + return ERR_ARG; + } + ofs += (1 + len_octets + len); + snmp_asn1_dec_type(p, ofs, &type); + derr = snmp_asn1_dec_length(p, ofs+1, &len_octets, &len); + if ((derr != ERR_OK) || (type != (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OC_STR))) + { + /* can't decode or no octet string (community) */ + snmp_inc_snmpinasnparseerrs(); + return ERR_ARG; + } + derr = snmp_asn1_dec_raw(p, ofs + 1 + len_octets, len, SNMP_COMMUNITY_STR_LEN, m_stat->community); + if (derr != ERR_OK) + { + snmp_inc_snmpinasnparseerrs(); + return ERR_ARG; + } + /* add zero terminator */ + len = ((len < (SNMP_COMMUNITY_STR_LEN))?(len):(SNMP_COMMUNITY_STR_LEN)); + m_stat->community[len] = 0; + m_stat->com_strlen = (u8_t)len; + if (strncmp(snmp_publiccommunity, (const char*)m_stat->community, SNMP_COMMUNITY_STR_LEN) != 0) + { + /** @todo: move this if we need to check more names */ + snmp_inc_snmpinbadcommunitynames(); + snmp_authfail_trap(); + return ERR_ARG; + } + ofs += (1 + len_octets + len); + snmp_asn1_dec_type(p, ofs, &type); + derr = snmp_asn1_dec_length(p, ofs+1, &len_octets, &len); + if (derr != ERR_OK) + { + snmp_inc_snmpinasnparseerrs(); + return ERR_ARG; + } + switch(type) + { + case (SNMP_ASN1_CONTXT | SNMP_ASN1_CONSTR | SNMP_ASN1_PDU_GET_REQ): + /* GetRequest PDU */ + snmp_inc_snmpingetrequests(); + derr = ERR_OK; + break; + case (SNMP_ASN1_CONTXT | SNMP_ASN1_CONSTR | SNMP_ASN1_PDU_GET_NEXT_REQ): + /* GetNextRequest PDU */ + snmp_inc_snmpingetnexts(); + derr = ERR_OK; + break; + case (SNMP_ASN1_CONTXT | SNMP_ASN1_CONSTR | SNMP_ASN1_PDU_GET_RESP): + /* GetResponse PDU */ + snmp_inc_snmpingetresponses(); + derr = ERR_ARG; + break; + case (SNMP_ASN1_CONTXT | SNMP_ASN1_CONSTR | SNMP_ASN1_PDU_SET_REQ): + /* SetRequest PDU */ + snmp_inc_snmpinsetrequests(); + derr = ERR_OK; + break; + case (SNMP_ASN1_CONTXT | SNMP_ASN1_CONSTR | SNMP_ASN1_PDU_TRAP): + /* Trap PDU */ + snmp_inc_snmpintraps(); + derr = ERR_ARG; + break; + default: + snmp_inc_snmpinasnparseerrs(); + derr = ERR_ARG; + break; + } + if (derr != ERR_OK) + { + /* unsupported input PDU for this agent (no parse error) */ + return ERR_ARG; + } + m_stat->rt = type & 0x1F; + ofs += (1 + len_octets); + if (len != (pdu_len - (ofs - ofs_base))) + { + /* decoded PDU length does not equal actual payload length */ + snmp_inc_snmpinasnparseerrs(); + return ERR_ARG; + } + snmp_asn1_dec_type(p, ofs, &type); + derr = snmp_asn1_dec_length(p, ofs+1, &len_octets, &len); + if ((derr != ERR_OK) || (type != (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG))) + { + /* can't decode or no integer (request ID) */ + snmp_inc_snmpinasnparseerrs(); + return ERR_ARG; + } + derr = snmp_asn1_dec_s32t(p, ofs + 1 + len_octets, len, &m_stat->rid); + if (derr != ERR_OK) + { + /* can't decode */ + snmp_inc_snmpinasnparseerrs(); + return ERR_ARG; + } + ofs += (1 + len_octets + len); + snmp_asn1_dec_type(p, ofs, &type); + derr = snmp_asn1_dec_length(p, ofs+1, &len_octets, &len); + if ((derr != ERR_OK) || (type != (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG))) + { + /* can't decode or no integer (error-status) */ + snmp_inc_snmpinasnparseerrs(); + return ERR_ARG; + } + /* must be noError (0) for incoming requests. + log errors for mib-2 completeness and for debug purposes */ + derr = snmp_asn1_dec_s32t(p, ofs + 1 + len_octets, len, &m_stat->error_status); + if (derr != ERR_OK) + { + /* can't decode */ + snmp_inc_snmpinasnparseerrs(); + return ERR_ARG; + } + switch (m_stat->error_status) + { + case SNMP_ES_TOOBIG: + snmp_inc_snmpintoobigs(); + break; + case SNMP_ES_NOSUCHNAME: + snmp_inc_snmpinnosuchnames(); + break; + case SNMP_ES_BADVALUE: + snmp_inc_snmpinbadvalues(); + break; + case SNMP_ES_READONLY: + snmp_inc_snmpinreadonlys(); + break; + case SNMP_ES_GENERROR: + snmp_inc_snmpingenerrs(); + break; + } + ofs += (1 + len_octets + len); + snmp_asn1_dec_type(p, ofs, &type); + derr = snmp_asn1_dec_length(p, ofs+1, &len_octets, &len); + if ((derr != ERR_OK) || (type != (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG))) + { + /* can't decode or no integer (error-index) */ + snmp_inc_snmpinasnparseerrs(); + return ERR_ARG; + } + /* must be 0 for incoming requests. + decode anyway to catch bad integers (and dirty tricks) */ + derr = snmp_asn1_dec_s32t(p, ofs + 1 + len_octets, len, &m_stat->error_index); + if (derr != ERR_OK) + { + /* can't decode */ + snmp_inc_snmpinasnparseerrs(); + return ERR_ARG; + } + ofs += (1 + len_octets + len); + *ofs_ret = ofs; + return ERR_OK; +} + +static err_t +snmp_pdu_dec_varbindlist(struct pbuf *p, u16_t ofs, u16_t *ofs_ret, struct snmp_msg_pstat *m_stat) +{ + err_t derr; + u16_t len, vb_len; + u8_t len_octets; + u8_t type; + + /* variable binding list */ + snmp_asn1_dec_type(p, ofs, &type); + derr = snmp_asn1_dec_length(p, ofs+1, &len_octets, &vb_len); + if ((derr != ERR_OK) || + (type != (SNMP_ASN1_UNIV | SNMP_ASN1_CONSTR | SNMP_ASN1_SEQ))) + { + snmp_inc_snmpinasnparseerrs(); + return ERR_ARG; + } + ofs += (1 + len_octets); + + /* start with empty list */ + m_stat->invb.count = 0; + m_stat->invb.head = NULL; + m_stat->invb.tail = NULL; + + while (vb_len > 0) + { + struct snmp_obj_id oid, oid_value; + struct snmp_varbind *vb; + + snmp_asn1_dec_type(p, ofs, &type); + derr = snmp_asn1_dec_length(p, ofs+1, &len_octets, &len); + if ((derr != ERR_OK) || + (type != (SNMP_ASN1_UNIV | SNMP_ASN1_CONSTR | SNMP_ASN1_SEQ)) || + (len == 0) || (len > vb_len)) + { + snmp_inc_snmpinasnparseerrs(); + /* free varbinds (if available) */ + snmp_varbind_list_free(&m_stat->invb); + return ERR_ARG; + } + ofs += (1 + len_octets); + vb_len -= (1 + len_octets); + + snmp_asn1_dec_type(p, ofs, &type); + derr = snmp_asn1_dec_length(p, ofs+1, &len_octets, &len); + if ((derr != ERR_OK) || (type != (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OBJ_ID))) + { + /* can't decode object name length */ + snmp_inc_snmpinasnparseerrs(); + /* free varbinds (if available) */ + snmp_varbind_list_free(&m_stat->invb); + return ERR_ARG; + } + derr = snmp_asn1_dec_oid(p, ofs + 1 + len_octets, len, &oid); + if (derr != ERR_OK) + { + /* can't decode object name */ + snmp_inc_snmpinasnparseerrs(); + /* free varbinds (if available) */ + snmp_varbind_list_free(&m_stat->invb); + return ERR_ARG; + } + ofs += (1 + len_octets + len); + vb_len -= (1 + len_octets + len); + + snmp_asn1_dec_type(p, ofs, &type); + derr = snmp_asn1_dec_length(p, ofs+1, &len_octets, &len); + if (derr != ERR_OK) + { + /* can't decode object value length */ + snmp_inc_snmpinasnparseerrs(); + /* free varbinds (if available) */ + snmp_varbind_list_free(&m_stat->invb); + return ERR_ARG; + } + + switch (type) + { + case (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG): + vb = snmp_varbind_alloc(&oid, type, sizeof(s32_t)); + if (vb != NULL) + { + s32_t *vptr = (s32_t*)vb->value; + + derr = snmp_asn1_dec_s32t(p, ofs + 1 + len_octets, len, vptr); + snmp_varbind_tail_add(&m_stat->invb, vb); + } + else + { + derr = ERR_ARG; + } + break; + case (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_COUNTER): + case (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_GAUGE): + case (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_TIMETICKS): + vb = snmp_varbind_alloc(&oid, type, sizeof(u32_t)); + if (vb != NULL) + { + u32_t *vptr = (u32_t*)vb->value; + + derr = snmp_asn1_dec_u32t(p, ofs + 1 + len_octets, len, vptr); + snmp_varbind_tail_add(&m_stat->invb, vb); + } + else + { + derr = ERR_ARG; + } + break; + case (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OC_STR): + case (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_OPAQUE): + LWIP_ASSERT("invalid length", len <= 0xff); + vb = snmp_varbind_alloc(&oid, type, (u8_t)len); + if (vb != NULL) + { + derr = snmp_asn1_dec_raw(p, ofs + 1 + len_octets, len, vb->value_len, (u8_t*)vb->value); + snmp_varbind_tail_add(&m_stat->invb, vb); + } + else + { + derr = ERR_ARG; + } + break; + case (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_NUL): + vb = snmp_varbind_alloc(&oid, type, 0); + if (vb != NULL) + { + snmp_varbind_tail_add(&m_stat->invb, vb); + derr = ERR_OK; + } + else + { + derr = ERR_ARG; + } + break; + case (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OBJ_ID): + derr = snmp_asn1_dec_oid(p, ofs + 1 + len_octets, len, &oid_value); + if (derr == ERR_OK) + { + vb = snmp_varbind_alloc(&oid, type, oid_value.len * sizeof(s32_t)); + if (vb != NULL) + { + u8_t i = oid_value.len; + s32_t *vptr = (s32_t*)vb->value; + + while(i > 0) + { + i--; + vptr[i] = oid_value.id[i]; + } + snmp_varbind_tail_add(&m_stat->invb, vb); + derr = ERR_OK; + } + else + { + derr = ERR_ARG; + } + } + break; + case (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_IPADDR): + if (len == 4) + { + /* must be exactly 4 octets! */ + vb = snmp_varbind_alloc(&oid, type, 4); + if (vb != NULL) + { + derr = snmp_asn1_dec_raw(p, ofs + 1 + len_octets, len, vb->value_len, (u8_t*)vb->value); + snmp_varbind_tail_add(&m_stat->invb, vb); + } + else + { + derr = ERR_ARG; + } + } + else + { + derr = ERR_ARG; + } + break; + default: + derr = ERR_ARG; + break; + } + if (derr != ERR_OK) + { + snmp_inc_snmpinasnparseerrs(); + /* free varbinds (if available) */ + snmp_varbind_list_free(&m_stat->invb); + return ERR_ARG; + } + ofs += (1 + len_octets + len); + vb_len -= (1 + len_octets + len); + } + + if (m_stat->rt == SNMP_ASN1_PDU_SET_REQ) + { + snmp_add_snmpintotalsetvars(m_stat->invb.count); + } + else + { + snmp_add_snmpintotalreqvars(m_stat->invb.count); + } + + *ofs_ret = ofs; + return ERR_OK; +} + +struct snmp_varbind* +snmp_varbind_alloc(struct snmp_obj_id *oid, u8_t type, u8_t len) +{ + struct snmp_varbind *vb; + + vb = (struct snmp_varbind *)memp_malloc(MEMP_SNMP_VARBIND); + LWIP_ASSERT("vb != NULL",vb != NULL); + if (vb != NULL) + { + u8_t i; + + vb->next = NULL; + vb->prev = NULL; + i = oid->len; + vb->ident_len = i; + if (i > 0) + { + LWIP_ASSERT("SNMP_MAX_TREE_DEPTH is configured too low", i <= SNMP_MAX_TREE_DEPTH); + /* allocate array of s32_t for our object identifier */ + vb->ident = (s32_t*)memp_malloc(MEMP_SNMP_VALUE); + LWIP_ASSERT("vb->ident != NULL",vb->ident != NULL); + if (vb->ident == NULL) + { + memp_free(MEMP_SNMP_VARBIND, vb); + return NULL; + } + while(i > 0) + { + i--; + vb->ident[i] = oid->id[i]; + } + } + else + { + /* i == 0, pass zero length object identifier */ + vb->ident = NULL; + } + vb->value_type = type; + vb->value_len = len; + if (len > 0) + { + LWIP_ASSERT("SNMP_MAX_OCTET_STRING_LEN is configured too low", vb->value_len <= SNMP_MAX_VALUE_SIZE); + /* allocate raw bytes for our object value */ + vb->value = memp_malloc(MEMP_SNMP_VALUE); + LWIP_ASSERT("vb->value != NULL",vb->value != NULL); + if (vb->value == NULL) + { + if (vb->ident != NULL) + { + memp_free(MEMP_SNMP_VALUE, vb->ident); + } + memp_free(MEMP_SNMP_VARBIND, vb); + return NULL; + } + } + else + { + /* ASN1_NUL type, or zero length ASN1_OC_STR */ + vb->value = NULL; + } + } + return vb; +} + +void +snmp_varbind_free(struct snmp_varbind *vb) +{ + if (vb->value != NULL ) + { + memp_free(MEMP_SNMP_VALUE, vb->value); + } + if (vb->ident != NULL ) + { + memp_free(MEMP_SNMP_VALUE, vb->ident); + } + memp_free(MEMP_SNMP_VARBIND, vb); +} + +void +snmp_varbind_list_free(struct snmp_varbind_root *root) +{ + struct snmp_varbind *vb, *prev; + + vb = root->tail; + while ( vb != NULL ) + { + prev = vb->prev; + snmp_varbind_free(vb); + vb = prev; + } + root->count = 0; + root->head = NULL; + root->tail = NULL; +} + +void +snmp_varbind_tail_add(struct snmp_varbind_root *root, struct snmp_varbind *vb) +{ + if (root->count == 0) + { + /* add first varbind to list */ + root->head = vb; + root->tail = vb; + } + else + { + /* add nth varbind to list tail */ + root->tail->next = vb; + vb->prev = root->tail; + root->tail = vb; + } + root->count += 1; +} + +struct snmp_varbind* +snmp_varbind_tail_remove(struct snmp_varbind_root *root) +{ + struct snmp_varbind* vb; + + if (root->count > 0) + { + /* remove tail varbind */ + vb = root->tail; + root->tail = vb->prev; + vb->prev->next = NULL; + root->count -= 1; + } + else + { + /* nothing to remove */ + vb = NULL; + } + return vb; +} + +#endif /* LWIP_SNMP */ diff --git a/lib/drivers/lwip/src/core/snmp/msg_out.c b/lib/drivers/lwip/src/core/snmp/msg_out.c new file mode 100644 index 00000000000..4778bee6f41 --- /dev/null +++ b/lib/drivers/lwip/src/core/snmp/msg_out.c @@ -0,0 +1,681 @@ +/** + * @file + * SNMP output message processing (RFC1157). + * + * Output responses and traps are build in two passes: + * + * Pass 0: iterate over the output message backwards to determine encoding lengths + * Pass 1: the actual forward encoding of internal form into ASN1 + * + * The single-pass encoding method described by Comer & Stevens + * requires extra buffer space and copying for reversal of the packet. + * The buffer requirement can be prohibitively large for big payloads + * (>= 484) therefore we use the two encoding passes. + */ + +/* + * Copyright (c) 2006 Axon Digital Design B.V., The Netherlands. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * Author: Christiaan Simons + */ + +#include "lwip/opt.h" + +#if LWIP_SNMP /* don't build if not configured for use in lwipopts.h */ + +#include "lwip/udp.h" +#include "lwip/netif.h" +#include "lwip/snmp.h" +#include "lwip/snmp_asn1.h" +#include "lwip/snmp_msg.h" + +struct snmp_trap_dst +{ + /* destination IP address in network order */ + ip_addr_t dip; + /* set to 0 when disabled, >0 when enabled */ + u8_t enable; +}; +struct snmp_trap_dst trap_dst[SNMP_TRAP_DESTINATIONS]; + +/** TRAP message structure */ +struct snmp_msg_trap trap_msg; + +static u16_t snmp_resp_header_sum(struct snmp_msg_pstat *m_stat, u16_t vb_len); +static u16_t snmp_trap_header_sum(struct snmp_msg_trap *m_trap, u16_t vb_len); +static u16_t snmp_varbind_list_sum(struct snmp_varbind_root *root); + +static u16_t snmp_resp_header_enc(struct snmp_msg_pstat *m_stat, struct pbuf *p); +static u16_t snmp_trap_header_enc(struct snmp_msg_trap *m_trap, struct pbuf *p); +static u16_t snmp_varbind_list_enc(struct snmp_varbind_root *root, struct pbuf *p, u16_t ofs); + +/** + * Sets enable switch for this trap destination. + * @param dst_idx index in 0 .. SNMP_TRAP_DESTINATIONS-1 + * @param enable switch if 0 destination is disabled >0 enabled. + */ +void +snmp_trap_dst_enable(u8_t dst_idx, u8_t enable) +{ + if (dst_idx < SNMP_TRAP_DESTINATIONS) + { + trap_dst[dst_idx].enable = enable; + } +} + +/** + * Sets IPv4 address for this trap destination. + * @param dst_idx index in 0 .. SNMP_TRAP_DESTINATIONS-1 + * @param dst IPv4 address in host order. + */ +void +snmp_trap_dst_ip_set(u8_t dst_idx, ip_addr_t *dst) +{ + if (dst_idx < SNMP_TRAP_DESTINATIONS) + { + ip_addr_set(&trap_dst[dst_idx].dip, dst); + } +} + +/** + * Sends a 'getresponse' message to the request originator. + * + * @param m_stat points to the current message request state source + * @return ERR_OK when success, ERR_MEM if we're out of memory + * + * @note the caller is responsible for filling in outvb in the m_stat + * and provide error-status and index (except for tooBig errors) ... + */ +err_t +snmp_send_response(struct snmp_msg_pstat *m_stat) +{ + struct snmp_varbind_root emptyvb = {NULL, NULL, 0, 0, 0}; + struct pbuf *p; + u16_t tot_len; + err_t err; + + /* pass 0, calculate length fields */ + tot_len = snmp_varbind_list_sum(&m_stat->outvb); + tot_len = snmp_resp_header_sum(m_stat, tot_len); + + /* try allocating pbuf(s) for complete response */ + p = pbuf_alloc(PBUF_TRANSPORT, tot_len, PBUF_POOL); + if (p == NULL) + { + LWIP_DEBUGF(SNMP_MSG_DEBUG, ("snmp_snd_response() tooBig\n")); + + /* can't construct reply, return error-status tooBig */ + m_stat->error_status = SNMP_ES_TOOBIG; + m_stat->error_index = 0; + /* pass 0, recalculate lengths, for empty varbind-list */ + tot_len = snmp_varbind_list_sum(&emptyvb); + tot_len = snmp_resp_header_sum(m_stat, tot_len); + /* retry allocation once for header and empty varbind-list */ + p = pbuf_alloc(PBUF_TRANSPORT, tot_len, PBUF_POOL); + } + if (p != NULL) + { + /* first pbuf alloc try or retry alloc success */ + u16_t ofs; + + LWIP_DEBUGF(SNMP_MSG_DEBUG, ("snmp_snd_response() p != NULL\n")); + + /* pass 1, size error, encode packet ino the pbuf(s) */ + ofs = snmp_resp_header_enc(m_stat, p); + if (m_stat->error_status == SNMP_ES_TOOBIG) + { + snmp_varbind_list_enc(&emptyvb, p, ofs); + } + else + { + snmp_varbind_list_enc(&m_stat->outvb, p, ofs); + } + + switch (m_stat->error_status) + { + case SNMP_ES_TOOBIG: + snmp_inc_snmpouttoobigs(); + break; + case SNMP_ES_NOSUCHNAME: + snmp_inc_snmpoutnosuchnames(); + break; + case SNMP_ES_BADVALUE: + snmp_inc_snmpoutbadvalues(); + break; + case SNMP_ES_GENERROR: + snmp_inc_snmpoutgenerrs(); + break; + } + snmp_inc_snmpoutgetresponses(); + snmp_inc_snmpoutpkts(); + + /** @todo do we need separate rx and tx pcbs for threaded case? */ + /** connect to the originating source */ + udp_connect(m_stat->pcb, &m_stat->sip, m_stat->sp); + err = udp_send(m_stat->pcb, p); + if (err == ERR_MEM) + { + /** @todo release some memory, retry and return tooBig? tooMuchHassle? */ + err = ERR_MEM; + } + else + { + err = ERR_OK; + } + /** disassociate remote address and port with this pcb */ + udp_disconnect(m_stat->pcb); + + pbuf_free(p); + LWIP_DEBUGF(SNMP_MSG_DEBUG, ("snmp_snd_response() done\n")); + return err; + } + else + { + /* first pbuf alloc try or retry alloc failed + very low on memory, couldn't return tooBig */ + return ERR_MEM; + } +} + + +/** + * Sends an generic or enterprise specific trap message. + * + * @param generic_trap is the trap code + * @param eoid points to enterprise object identifier + * @param specific_trap used for enterprise traps when generic_trap == 6 + * @return ERR_OK when success, ERR_MEM if we're out of memory + * + * @note the caller is responsible for filling in outvb in the trap_msg + * @note the use of the enterpise identifier field + * is per RFC1215. + * Use .iso.org.dod.internet.mgmt.mib-2.snmp for generic traps + * and .iso.org.dod.internet.private.enterprises.yourenterprise + * (sysObjectID) for specific traps. + */ +err_t +snmp_send_trap(s8_t generic_trap, struct snmp_obj_id *eoid, s32_t specific_trap) +{ + struct snmp_trap_dst *td; + struct netif *dst_if; + ip_addr_t dst_ip; + struct pbuf *p; + u16_t i,tot_len; + + for (i=0, td = &trap_dst[0]; ienable != 0) && !ip_addr_isany(&td->dip)) + { + /* network order trap destination */ + ip_addr_copy(trap_msg.dip, td->dip); + /* lookup current source address for this dst */ + dst_if = ip_route(&td->dip); + ip_addr_copy(dst_ip, dst_if->ip_addr); + /* @todo: what about IPv6? */ + trap_msg.sip_raw[0] = ip4_addr1(&dst_ip); + trap_msg.sip_raw[1] = ip4_addr2(&dst_ip); + trap_msg.sip_raw[2] = ip4_addr3(&dst_ip); + trap_msg.sip_raw[3] = ip4_addr4(&dst_ip); + trap_msg.gen_trap = generic_trap; + trap_msg.spc_trap = specific_trap; + if (generic_trap == SNMP_GENTRAP_ENTERPRISESPC) + { + /* enterprise-Specific trap */ + trap_msg.enterprise = eoid; + } + else + { + /* generic (MIB-II) trap */ + snmp_get_snmpgrpid_ptr(&trap_msg.enterprise); + } + snmp_get_sysuptime(&trap_msg.ts); + + /* pass 0, calculate length fields */ + tot_len = snmp_varbind_list_sum(&trap_msg.outvb); + tot_len = snmp_trap_header_sum(&trap_msg, tot_len); + + /* allocate pbuf(s) */ + p = pbuf_alloc(PBUF_TRANSPORT, tot_len, PBUF_POOL); + if (p != NULL) + { + u16_t ofs; + + /* pass 1, encode packet ino the pbuf(s) */ + ofs = snmp_trap_header_enc(&trap_msg, p); + snmp_varbind_list_enc(&trap_msg.outvb, p, ofs); + + snmp_inc_snmpouttraps(); + snmp_inc_snmpoutpkts(); + + /** send to the TRAP destination */ + udp_sendto(trap_msg.pcb, p, &trap_msg.dip, SNMP_TRAP_PORT); + + pbuf_free(p); + } + else + { + return ERR_MEM; + } + } + } + return ERR_OK; +} + +void +snmp_coldstart_trap(void) +{ + trap_msg.outvb.head = NULL; + trap_msg.outvb.tail = NULL; + trap_msg.outvb.count = 0; + snmp_send_trap(SNMP_GENTRAP_COLDSTART, NULL, 0); +} + +void +snmp_authfail_trap(void) +{ + u8_t enable; + snmp_get_snmpenableauthentraps(&enable); + if (enable == 1) + { + trap_msg.outvb.head = NULL; + trap_msg.outvb.tail = NULL; + trap_msg.outvb.count = 0; + snmp_send_trap(SNMP_GENTRAP_AUTHFAIL, NULL, 0); + } +} + +/** + * Sums response header field lengths from tail to head and + * returns resp_header_lengths for second encoding pass. + * + * @param vb_len varbind-list length + * @param rhl points to returned header lengths + * @return the required lenght for encoding the response header + */ +static u16_t +snmp_resp_header_sum(struct snmp_msg_pstat *m_stat, u16_t vb_len) +{ + u16_t tot_len; + struct snmp_resp_header_lengths *rhl; + + rhl = &m_stat->rhl; + tot_len = vb_len; + snmp_asn1_enc_s32t_cnt(m_stat->error_index, &rhl->erridxlen); + snmp_asn1_enc_length_cnt(rhl->erridxlen, &rhl->erridxlenlen); + tot_len += 1 + rhl->erridxlenlen + rhl->erridxlen; + + snmp_asn1_enc_s32t_cnt(m_stat->error_status, &rhl->errstatlen); + snmp_asn1_enc_length_cnt(rhl->errstatlen, &rhl->errstatlenlen); + tot_len += 1 + rhl->errstatlenlen + rhl->errstatlen; + + snmp_asn1_enc_s32t_cnt(m_stat->rid, &rhl->ridlen); + snmp_asn1_enc_length_cnt(rhl->ridlen, &rhl->ridlenlen); + tot_len += 1 + rhl->ridlenlen + rhl->ridlen; + + rhl->pdulen = tot_len; + snmp_asn1_enc_length_cnt(rhl->pdulen, &rhl->pdulenlen); + tot_len += 1 + rhl->pdulenlen; + + rhl->comlen = m_stat->com_strlen; + snmp_asn1_enc_length_cnt(rhl->comlen, &rhl->comlenlen); + tot_len += 1 + rhl->comlenlen + rhl->comlen; + + snmp_asn1_enc_s32t_cnt(snmp_version, &rhl->verlen); + snmp_asn1_enc_length_cnt(rhl->verlen, &rhl->verlenlen); + tot_len += 1 + rhl->verlen + rhl->verlenlen; + + rhl->seqlen = tot_len; + snmp_asn1_enc_length_cnt(rhl->seqlen, &rhl->seqlenlen); + tot_len += 1 + rhl->seqlenlen; + + return tot_len; +} + +/** + * Sums trap header field lengths from tail to head and + * returns trap_header_lengths for second encoding pass. + * + * @param vb_len varbind-list length + * @param thl points to returned header lengths + * @return the required lenght for encoding the trap header + */ +static u16_t +snmp_trap_header_sum(struct snmp_msg_trap *m_trap, u16_t vb_len) +{ + u16_t tot_len; + struct snmp_trap_header_lengths *thl; + + thl = &m_trap->thl; + tot_len = vb_len; + + snmp_asn1_enc_u32t_cnt(m_trap->ts, &thl->tslen); + snmp_asn1_enc_length_cnt(thl->tslen, &thl->tslenlen); + tot_len += 1 + thl->tslen + thl->tslenlen; + + snmp_asn1_enc_s32t_cnt(m_trap->spc_trap, &thl->strplen); + snmp_asn1_enc_length_cnt(thl->strplen, &thl->strplenlen); + tot_len += 1 + thl->strplen + thl->strplenlen; + + snmp_asn1_enc_s32t_cnt(m_trap->gen_trap, &thl->gtrplen); + snmp_asn1_enc_length_cnt(thl->gtrplen, &thl->gtrplenlen); + tot_len += 1 + thl->gtrplen + thl->gtrplenlen; + + thl->aaddrlen = 4; + snmp_asn1_enc_length_cnt(thl->aaddrlen, &thl->aaddrlenlen); + tot_len += 1 + thl->aaddrlen + thl->aaddrlenlen; + + snmp_asn1_enc_oid_cnt(m_trap->enterprise->len, &m_trap->enterprise->id[0], &thl->eidlen); + snmp_asn1_enc_length_cnt(thl->eidlen, &thl->eidlenlen); + tot_len += 1 + thl->eidlen + thl->eidlenlen; + + thl->pdulen = tot_len; + snmp_asn1_enc_length_cnt(thl->pdulen, &thl->pdulenlen); + tot_len += 1 + thl->pdulenlen; + + thl->comlen = sizeof(snmp_publiccommunity) - 1; + snmp_asn1_enc_length_cnt(thl->comlen, &thl->comlenlen); + tot_len += 1 + thl->comlenlen + thl->comlen; + + snmp_asn1_enc_s32t_cnt(snmp_version, &thl->verlen); + snmp_asn1_enc_length_cnt(thl->verlen, &thl->verlenlen); + tot_len += 1 + thl->verlen + thl->verlenlen; + + thl->seqlen = tot_len; + snmp_asn1_enc_length_cnt(thl->seqlen, &thl->seqlenlen); + tot_len += 1 + thl->seqlenlen; + + return tot_len; +} + +/** + * Sums varbind lengths from tail to head and + * annotates lengths in varbind for second encoding pass. + * + * @param root points to the root of the variable binding list + * @return the required lenght for encoding the variable bindings + */ +static u16_t +snmp_varbind_list_sum(struct snmp_varbind_root *root) +{ + struct snmp_varbind *vb; + u32_t *uint_ptr; + s32_t *sint_ptr; + u16_t tot_len; + + tot_len = 0; + vb = root->tail; + while ( vb != NULL ) + { + /* encoded value lenght depends on type */ + switch (vb->value_type) + { + case (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG): + sint_ptr = (s32_t*)vb->value; + snmp_asn1_enc_s32t_cnt(*sint_ptr, &vb->vlen); + break; + case (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_COUNTER): + case (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_GAUGE): + case (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_TIMETICKS): + uint_ptr = (u32_t*)vb->value; + snmp_asn1_enc_u32t_cnt(*uint_ptr, &vb->vlen); + break; + case (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OC_STR): + case (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_NUL): + case (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_IPADDR): + case (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_OPAQUE): + vb->vlen = vb->value_len; + break; + case (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OBJ_ID): + sint_ptr = (s32_t*)vb->value; + snmp_asn1_enc_oid_cnt(vb->value_len / sizeof(s32_t), sint_ptr, &vb->vlen); + break; + default: + /* unsupported type */ + vb->vlen = 0; + break; + }; + /* encoding length of value length field */ + snmp_asn1_enc_length_cnt(vb->vlen, &vb->vlenlen); + snmp_asn1_enc_oid_cnt(vb->ident_len, vb->ident, &vb->olen); + snmp_asn1_enc_length_cnt(vb->olen, &vb->olenlen); + + vb->seqlen = 1 + vb->vlenlen + vb->vlen; + vb->seqlen += 1 + vb->olenlen + vb->olen; + snmp_asn1_enc_length_cnt(vb->seqlen, &vb->seqlenlen); + + /* varbind seq */ + tot_len += 1 + vb->seqlenlen + vb->seqlen; + + vb = vb->prev; + } + + /* varbind-list seq */ + root->seqlen = tot_len; + snmp_asn1_enc_length_cnt(root->seqlen, &root->seqlenlen); + tot_len += 1 + root->seqlenlen; + + return tot_len; +} + +/** + * Encodes response header from head to tail. + */ +static u16_t +snmp_resp_header_enc(struct snmp_msg_pstat *m_stat, struct pbuf *p) +{ + u16_t ofs; + + ofs = 0; + snmp_asn1_enc_type(p, ofs, (SNMP_ASN1_UNIV | SNMP_ASN1_CONSTR | SNMP_ASN1_SEQ)); + ofs += 1; + snmp_asn1_enc_length(p, ofs, m_stat->rhl.seqlen); + ofs += m_stat->rhl.seqlenlen; + + snmp_asn1_enc_type(p, ofs, (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG)); + ofs += 1; + snmp_asn1_enc_length(p, ofs, m_stat->rhl.verlen); + ofs += m_stat->rhl.verlenlen; + snmp_asn1_enc_s32t(p, ofs, m_stat->rhl.verlen, snmp_version); + ofs += m_stat->rhl.verlen; + + snmp_asn1_enc_type(p, ofs, (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OC_STR)); + ofs += 1; + snmp_asn1_enc_length(p, ofs, m_stat->rhl.comlen); + ofs += m_stat->rhl.comlenlen; + snmp_asn1_enc_raw(p, ofs, m_stat->rhl.comlen, m_stat->community); + ofs += m_stat->rhl.comlen; + + snmp_asn1_enc_type(p, ofs, (SNMP_ASN1_CONTXT | SNMP_ASN1_CONSTR | SNMP_ASN1_PDU_GET_RESP)); + ofs += 1; + snmp_asn1_enc_length(p, ofs, m_stat->rhl.pdulen); + ofs += m_stat->rhl.pdulenlen; + + snmp_asn1_enc_type(p, ofs, (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG)); + ofs += 1; + snmp_asn1_enc_length(p, ofs, m_stat->rhl.ridlen); + ofs += m_stat->rhl.ridlenlen; + snmp_asn1_enc_s32t(p, ofs, m_stat->rhl.ridlen, m_stat->rid); + ofs += m_stat->rhl.ridlen; + + snmp_asn1_enc_type(p, ofs, (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG)); + ofs += 1; + snmp_asn1_enc_length(p, ofs, m_stat->rhl.errstatlen); + ofs += m_stat->rhl.errstatlenlen; + snmp_asn1_enc_s32t(p, ofs, m_stat->rhl.errstatlen, m_stat->error_status); + ofs += m_stat->rhl.errstatlen; + + snmp_asn1_enc_type(p, ofs, (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG)); + ofs += 1; + snmp_asn1_enc_length(p, ofs, m_stat->rhl.erridxlen); + ofs += m_stat->rhl.erridxlenlen; + snmp_asn1_enc_s32t(p, ofs, m_stat->rhl.erridxlen, m_stat->error_index); + ofs += m_stat->rhl.erridxlen; + + return ofs; +} + +/** + * Encodes trap header from head to tail. + */ +static u16_t +snmp_trap_header_enc(struct snmp_msg_trap *m_trap, struct pbuf *p) +{ + u16_t ofs; + + ofs = 0; + snmp_asn1_enc_type(p, ofs, (SNMP_ASN1_UNIV | SNMP_ASN1_CONSTR | SNMP_ASN1_SEQ)); + ofs += 1; + snmp_asn1_enc_length(p, ofs, m_trap->thl.seqlen); + ofs += m_trap->thl.seqlenlen; + + snmp_asn1_enc_type(p, ofs, (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG)); + ofs += 1; + snmp_asn1_enc_length(p, ofs, m_trap->thl.verlen); + ofs += m_trap->thl.verlenlen; + snmp_asn1_enc_s32t(p, ofs, m_trap->thl.verlen, snmp_version); + ofs += m_trap->thl.verlen; + + snmp_asn1_enc_type(p, ofs, (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OC_STR)); + ofs += 1; + snmp_asn1_enc_length(p, ofs, m_trap->thl.comlen); + ofs += m_trap->thl.comlenlen; + snmp_asn1_enc_raw(p, ofs, m_trap->thl.comlen, (u8_t *)&snmp_publiccommunity[0]); + ofs += m_trap->thl.comlen; + + snmp_asn1_enc_type(p, ofs, (SNMP_ASN1_CONTXT | SNMP_ASN1_CONSTR | SNMP_ASN1_PDU_TRAP)); + ofs += 1; + snmp_asn1_enc_length(p, ofs, m_trap->thl.pdulen); + ofs += m_trap->thl.pdulenlen; + + snmp_asn1_enc_type(p, ofs, (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OBJ_ID)); + ofs += 1; + snmp_asn1_enc_length(p, ofs, m_trap->thl.eidlen); + ofs += m_trap->thl.eidlenlen; + snmp_asn1_enc_oid(p, ofs, m_trap->enterprise->len, &m_trap->enterprise->id[0]); + ofs += m_trap->thl.eidlen; + + snmp_asn1_enc_type(p, ofs, (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_IPADDR)); + ofs += 1; + snmp_asn1_enc_length(p, ofs, m_trap->thl.aaddrlen); + ofs += m_trap->thl.aaddrlenlen; + snmp_asn1_enc_raw(p, ofs, m_trap->thl.aaddrlen, &m_trap->sip_raw[0]); + ofs += m_trap->thl.aaddrlen; + + snmp_asn1_enc_type(p, ofs, (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG)); + ofs += 1; + snmp_asn1_enc_length(p, ofs, m_trap->thl.gtrplen); + ofs += m_trap->thl.gtrplenlen; + snmp_asn1_enc_u32t(p, ofs, m_trap->thl.gtrplen, m_trap->gen_trap); + ofs += m_trap->thl.gtrplen; + + snmp_asn1_enc_type(p, ofs, (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG)); + ofs += 1; + snmp_asn1_enc_length(p, ofs, m_trap->thl.strplen); + ofs += m_trap->thl.strplenlen; + snmp_asn1_enc_u32t(p, ofs, m_trap->thl.strplen, m_trap->spc_trap); + ofs += m_trap->thl.strplen; + + snmp_asn1_enc_type(p, ofs, (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_TIMETICKS)); + ofs += 1; + snmp_asn1_enc_length(p, ofs, m_trap->thl.tslen); + ofs += m_trap->thl.tslenlen; + snmp_asn1_enc_u32t(p, ofs, m_trap->thl.tslen, m_trap->ts); + ofs += m_trap->thl.tslen; + + return ofs; +} + +/** + * Encodes varbind list from head to tail. + */ +static u16_t +snmp_varbind_list_enc(struct snmp_varbind_root *root, struct pbuf *p, u16_t ofs) +{ + struct snmp_varbind *vb; + s32_t *sint_ptr; + u32_t *uint_ptr; + u8_t *raw_ptr; + + snmp_asn1_enc_type(p, ofs, (SNMP_ASN1_UNIV | SNMP_ASN1_CONSTR | SNMP_ASN1_SEQ)); + ofs += 1; + snmp_asn1_enc_length(p, ofs, root->seqlen); + ofs += root->seqlenlen; + + vb = root->head; + while ( vb != NULL ) + { + snmp_asn1_enc_type(p, ofs, (SNMP_ASN1_UNIV | SNMP_ASN1_CONSTR | SNMP_ASN1_SEQ)); + ofs += 1; + snmp_asn1_enc_length(p, ofs, vb->seqlen); + ofs += vb->seqlenlen; + + snmp_asn1_enc_type(p, ofs, (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OBJ_ID)); + ofs += 1; + snmp_asn1_enc_length(p, ofs, vb->olen); + ofs += vb->olenlen; + snmp_asn1_enc_oid(p, ofs, vb->ident_len, &vb->ident[0]); + ofs += vb->olen; + + snmp_asn1_enc_type(p, ofs, vb->value_type); + ofs += 1; + snmp_asn1_enc_length(p, ofs, vb->vlen); + ofs += vb->vlenlen; + + switch (vb->value_type) + { + case (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_INTEG): + sint_ptr = (s32_t*)vb->value; + snmp_asn1_enc_s32t(p, ofs, vb->vlen, *sint_ptr); + break; + case (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_COUNTER): + case (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_GAUGE): + case (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_TIMETICKS): + uint_ptr = (u32_t*)vb->value; + snmp_asn1_enc_u32t(p, ofs, vb->vlen, *uint_ptr); + break; + case (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OC_STR): + case (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_IPADDR): + case (SNMP_ASN1_APPLIC | SNMP_ASN1_PRIMIT | SNMP_ASN1_OPAQUE): + raw_ptr = (u8_t*)vb->value; + snmp_asn1_enc_raw(p, ofs, vb->vlen, raw_ptr); + break; + case (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_NUL): + break; + case (SNMP_ASN1_UNIV | SNMP_ASN1_PRIMIT | SNMP_ASN1_OBJ_ID): + sint_ptr = (s32_t*)vb->value; + snmp_asn1_enc_oid(p, ofs, vb->value_len / sizeof(s32_t), sint_ptr); + break; + default: + /* unsupported type */ + break; + }; + ofs += vb->vlen; + vb = vb->next; + } + return ofs; +} + +#endif /* LWIP_SNMP */ diff --git a/lib/drivers/lwip/src/core/stats.c b/lib/drivers/lwip/src/core/stats.c new file mode 100644 index 00000000000..69f97d41fca --- /dev/null +++ b/lib/drivers/lwip/src/core/stats.c @@ -0,0 +1,176 @@ +/** + * @file + * Statistics module + * + */ + +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ + +#include "lwip/opt.h" + +#if LWIP_STATS /* don't build if not configured for use in lwipopts.h */ + +#include "lwip/def.h" +#include "lwip/stats.h" +#include "lwip/mem.h" + +#include + +struct stats_ lwip_stats; + +void stats_init(void) +{ +#ifdef LWIP_DEBUG +#if MEMP_STATS + const char * memp_names[] = { +#define LWIP_MEMPOOL(name,num,size,desc) desc, +#include "lwip/memp_std.h" + }; + int i; + for (i = 0; i < MEMP_MAX; i++) { + lwip_stats.memp[i].name = memp_names[i]; + } +#endif /* MEMP_STATS */ +#if MEM_STATS + lwip_stats.mem.name = "MEM"; +#endif /* MEM_STATS */ +#endif /* LWIP_DEBUG */ +} + +#if LWIP_STATS_DISPLAY +void +stats_display_proto(struct stats_proto *proto, char *name) +{ + LWIP_PLATFORM_DIAG(("\n%s\n\t", name)); + LWIP_PLATFORM_DIAG(("xmit: %"STAT_COUNTER_F"\n\t", proto->xmit)); + LWIP_PLATFORM_DIAG(("recv: %"STAT_COUNTER_F"\n\t", proto->recv)); + LWIP_PLATFORM_DIAG(("fw: %"STAT_COUNTER_F"\n\t", proto->fw)); + LWIP_PLATFORM_DIAG(("drop: %"STAT_COUNTER_F"\n\t", proto->drop)); + LWIP_PLATFORM_DIAG(("chkerr: %"STAT_COUNTER_F"\n\t", proto->chkerr)); + LWIP_PLATFORM_DIAG(("lenerr: %"STAT_COUNTER_F"\n\t", proto->lenerr)); + LWIP_PLATFORM_DIAG(("memerr: %"STAT_COUNTER_F"\n\t", proto->memerr)); + LWIP_PLATFORM_DIAG(("rterr: %"STAT_COUNTER_F"\n\t", proto->rterr)); + LWIP_PLATFORM_DIAG(("proterr: %"STAT_COUNTER_F"\n\t", proto->proterr)); + LWIP_PLATFORM_DIAG(("opterr: %"STAT_COUNTER_F"\n\t", proto->opterr)); + LWIP_PLATFORM_DIAG(("err: %"STAT_COUNTER_F"\n\t", proto->err)); + LWIP_PLATFORM_DIAG(("cachehit: %"STAT_COUNTER_F"\n", proto->cachehit)); +} + +#if IGMP_STATS +void +stats_display_igmp(struct stats_igmp *igmp) +{ + LWIP_PLATFORM_DIAG(("\nIGMP\n\t")); + LWIP_PLATFORM_DIAG(("xmit: %"STAT_COUNTER_F"\n\t", igmp->xmit)); + LWIP_PLATFORM_DIAG(("recv: %"STAT_COUNTER_F"\n\t", igmp->recv)); + LWIP_PLATFORM_DIAG(("drop: %"STAT_COUNTER_F"\n\t", igmp->drop)); + LWIP_PLATFORM_DIAG(("chkerr: %"STAT_COUNTER_F"\n\t", igmp->chkerr)); + LWIP_PLATFORM_DIAG(("lenerr: %"STAT_COUNTER_F"\n\t", igmp->lenerr)); + LWIP_PLATFORM_DIAG(("memerr: %"STAT_COUNTER_F"\n\t", igmp->memerr)); + LWIP_PLATFORM_DIAG(("proterr: %"STAT_COUNTER_F"\n\t", igmp->proterr)); + LWIP_PLATFORM_DIAG(("rx_v1: %"STAT_COUNTER_F"\n\t", igmp->rx_v1)); + LWIP_PLATFORM_DIAG(("rx_group: %"STAT_COUNTER_F"\n", igmp->rx_group)); + LWIP_PLATFORM_DIAG(("rx_general: %"STAT_COUNTER_F"\n", igmp->rx_general)); + LWIP_PLATFORM_DIAG(("rx_report: %"STAT_COUNTER_F"\n\t", igmp->rx_report)); + LWIP_PLATFORM_DIAG(("tx_join: %"STAT_COUNTER_F"\n\t", igmp->tx_join)); + LWIP_PLATFORM_DIAG(("tx_leave: %"STAT_COUNTER_F"\n\t", igmp->tx_leave)); + LWIP_PLATFORM_DIAG(("tx_report: %"STAT_COUNTER_F"\n\t", igmp->tx_report)); +} +#endif /* IGMP_STATS */ + +#if MEM_STATS || MEMP_STATS +void +stats_display_mem(struct stats_mem *mem, char *name) +{ + LWIP_PLATFORM_DIAG(("\nMEM %s\n\t", name)); + LWIP_PLATFORM_DIAG(("avail: %"U32_F"\n\t", (u32_t)mem->avail)); + LWIP_PLATFORM_DIAG(("used: %"U32_F"\n\t", (u32_t)mem->used)); + LWIP_PLATFORM_DIAG(("max: %"U32_F"\n\t", (u32_t)mem->max)); + LWIP_PLATFORM_DIAG(("err: %"U32_F"\n", (u32_t)mem->err)); +} + +#if MEMP_STATS +void +stats_display_memp(struct stats_mem *mem, int index) +{ + char * memp_names[] = { +#define LWIP_MEMPOOL(name,num,size,desc) desc, +#include "lwip/memp_std.h" + }; + if(index < MEMP_MAX) { + stats_display_mem(mem, memp_names[index]); + } +} +#endif /* MEMP_STATS */ +#endif /* MEM_STATS || MEMP_STATS */ + +#if SYS_STATS +void +stats_display_sys(struct stats_sys *sys) +{ + LWIP_PLATFORM_DIAG(("\nSYS\n\t")); + LWIP_PLATFORM_DIAG(("sem.used: %"U32_F"\n\t", (u32_t)sys->sem.used)); + LWIP_PLATFORM_DIAG(("sem.max: %"U32_F"\n\t", (u32_t)sys->sem.max)); + LWIP_PLATFORM_DIAG(("sem.err: %"U32_F"\n\t", (u32_t)sys->sem.err)); + LWIP_PLATFORM_DIAG(("mutex.used: %"U32_F"\n\t", (u32_t)sys->mutex.used)); + LWIP_PLATFORM_DIAG(("mutex.max: %"U32_F"\n\t", (u32_t)sys->mutex.max)); + LWIP_PLATFORM_DIAG(("mutex.err: %"U32_F"\n\t", (u32_t)sys->mutex.err)); + LWIP_PLATFORM_DIAG(("mbox.used: %"U32_F"\n\t", (u32_t)sys->mbox.used)); + LWIP_PLATFORM_DIAG(("mbox.max: %"U32_F"\n\t", (u32_t)sys->mbox.max)); + LWIP_PLATFORM_DIAG(("mbox.err: %"U32_F"\n\t", (u32_t)sys->mbox.err)); +} +#endif /* SYS_STATS */ + +void +stats_display(void) +{ + s16_t i; + + LINK_STATS_DISPLAY(); + ETHARP_STATS_DISPLAY(); + IPFRAG_STATS_DISPLAY(); + IP_STATS_DISPLAY(); + IGMP_STATS_DISPLAY(); + ICMP_STATS_DISPLAY(); + UDP_STATS_DISPLAY(); + TCP_STATS_DISPLAY(); + MEM_STATS_DISPLAY(); + for (i = 0; i < MEMP_MAX; i++) { + MEMP_STATS_DISPLAY(i); + } + SYS_STATS_DISPLAY(); +} +#endif /* LWIP_STATS_DISPLAY */ + +#endif /* LWIP_STATS */ + diff --git a/lib/drivers/lwip/src/core/sys.c b/lib/drivers/lwip/src/core/sys.c new file mode 100644 index 00000000000..d3a77deb289 --- /dev/null +++ b/lib/drivers/lwip/src/core/sys.c @@ -0,0 +1,66 @@ +/** + * @file + * lwIP Operating System abstraction + * + */ + +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ + +#include "lwip/opt.h" + +#include "lwip/sys.h" + +/* Most of the functions defined in sys.h must be implemented in the + * architecture-dependent file sys_arch.c */ + +#if !NO_SYS + +/** + * Sleep for some ms. Timeouts are NOT processed while sleeping. + * + * @param ms number of milliseconds to sleep + */ +void +sys_msleep(u32_t ms) +{ + if (ms > 0) { + sys_sem_t delaysem; + err_t err = sys_sem_new(&delaysem, 0); + if (err == ERR_OK) { + sys_arch_sem_wait(&delaysem, ms); + sys_sem_free(&delaysem); + } + } +} + +#endif /* !NO_SYS */ diff --git a/lib/drivers/lwip/src/core/tcp.c b/lib/drivers/lwip/src/core/tcp.c new file mode 100644 index 00000000000..c629bc4e8ac --- /dev/null +++ b/lib/drivers/lwip/src/core/tcp.c @@ -0,0 +1,1635 @@ +/** + * @file + * Transmission Control Protocol for IP + * + * This file contains common functions for the TCP implementation, such as functinos + * for manipulating the data structures and the TCP timer functions. TCP functions + * related to input and output is found in tcp_in.c and tcp_out.c respectively. + * + */ + +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ + +#include "lwip/opt.h" + +#if LWIP_TCP /* don't build if not configured for use in lwipopts.h */ + +#include "lwip/def.h" +#include "lwip/mem.h" +#include "lwip/memp.h" +#include "lwip/snmp.h" +#include "lwip/tcp.h" +#include "lwip/tcp_impl.h" +#include "lwip/debug.h" +#include "lwip/stats.h" + +#include + +const char * const tcp_state_str[] = { + "CLOSED", + "LISTEN", + "SYN_SENT", + "SYN_RCVD", + "ESTABLISHED", + "FIN_WAIT_1", + "FIN_WAIT_2", + "CLOSE_WAIT", + "CLOSING", + "LAST_ACK", + "TIME_WAIT" +}; + +/* Incremented every coarse grained timer shot (typically every 500 ms). */ +u32_t tcp_ticks; +const u8_t tcp_backoff[13] = + { 1, 2, 3, 4, 5, 6, 7, 7, 7, 7, 7, 7, 7}; + /* Times per slowtmr hits */ +const u8_t tcp_persist_backoff[7] = { 3, 6, 12, 24, 48, 96, 120 }; + +/* The TCP PCB lists. */ + +/** List of all TCP PCBs bound but not yet (connected || listening) */ +struct tcp_pcb *tcp_bound_pcbs; +/** List of all TCP PCBs in LISTEN state */ +union tcp_listen_pcbs_t tcp_listen_pcbs; +/** List of all TCP PCBs that are in a state in which + * they accept or send data. */ +struct tcp_pcb *tcp_active_pcbs; +/** List of all TCP PCBs in TIME-WAIT state */ +struct tcp_pcb *tcp_tw_pcbs; + +#define NUM_TCP_PCB_LISTS 4 +#define NUM_TCP_PCB_LISTS_NO_TIME_WAIT 3 +/** An array with all (non-temporary) PCB lists, mainly used for smaller code size */ +struct tcp_pcb ** const tcp_pcb_lists[] = {&tcp_listen_pcbs.pcbs, &tcp_bound_pcbs, + &tcp_active_pcbs, &tcp_tw_pcbs}; + +/** Only used for temporary storage. */ +struct tcp_pcb *tcp_tmp_pcb; + +/** Timer counter to handle calling slow-timer from tcp_tmr() */ +static u8_t tcp_timer; +static u16_t tcp_new_port(void); + +/** + * Called periodically to dispatch TCP timers. + * + */ +void +tcp_tmr(void) +{ + /* Call tcp_fasttmr() every 250 ms */ + tcp_fasttmr(); + + if (++tcp_timer & 1) { + /* Call tcp_tmr() every 500 ms, i.e., every other timer + tcp_tmr() is called. */ + tcp_slowtmr(); + } +} + +/** + * Closes the TX side of a connection held by the PCB. + * For tcp_close(), a RST is sent if the application didn't receive all data + * (tcp_recved() not called for all data passed to recv callback). + * + * Listening pcbs are freed and may not be referenced any more. + * Connection pcbs are freed if not yet connected and may not be referenced + * any more. If a connection is established (at least SYN received or in + * a closing state), the connection is closed, and put in a closing state. + * The pcb is then automatically freed in tcp_slowtmr(). It is therefore + * unsafe to reference it. + * + * @param pcb the tcp_pcb to close + * @return ERR_OK if connection has been closed + * another err_t if closing failed and pcb is not freed + */ +static err_t +tcp_close_shutdown(struct tcp_pcb *pcb, u8_t rst_on_unacked_data) +{ + err_t err; + + if (rst_on_unacked_data && (pcb->state != LISTEN)) { + if ((pcb->refused_data != NULL) || (pcb->rcv_wnd != TCP_WND)) { + /* Not all data received by application, send RST to tell the remote + side about this. */ + LWIP_ASSERT("pcb->flags & TF_RXCLOSED", pcb->flags & TF_RXCLOSED); + + /* don't call tcp_abort here: we must not deallocate the pcb since + that might not be expected when calling tcp_close */ + tcp_rst(pcb->snd_nxt, pcb->rcv_nxt, &pcb->local_ip, &pcb->remote_ip, + pcb->local_port, pcb->remote_port); + + tcp_pcb_purge(pcb); + + /* TODO: to which state do we move now? */ + + /* move to TIME_WAIT since we close actively */ + TCP_RMV(&tcp_active_pcbs, pcb); + pcb->state = TIME_WAIT; + TCP_REG(&tcp_tw_pcbs, pcb); + + return ERR_OK; + } + } + + switch (pcb->state) { + case CLOSED: + /* Closing a pcb in the CLOSED state might seem erroneous, + * however, it is in this state once allocated and as yet unused + * and the user needs some way to free it should the need arise. + * Calling tcp_close() with a pcb that has already been closed, (i.e. twice) + * or for a pcb that has been used and then entered the CLOSED state + * is erroneous, but this should never happen as the pcb has in those cases + * been freed, and so any remaining handles are bogus. */ + err = ERR_OK; + if (pcb->local_port != 0) { + TCP_RMV(&tcp_bound_pcbs, pcb); + } + memp_free(MEMP_TCP_PCB, pcb); + pcb = NULL; + break; + case LISTEN: + err = ERR_OK; + tcp_pcb_remove(&tcp_listen_pcbs.pcbs, pcb); + memp_free(MEMP_TCP_PCB_LISTEN, pcb); + pcb = NULL; + break; + case SYN_SENT: + err = ERR_OK; + tcp_pcb_remove(&tcp_active_pcbs, pcb); + memp_free(MEMP_TCP_PCB, pcb); + pcb = NULL; + snmp_inc_tcpattemptfails(); + break; + case SYN_RCVD: + err = tcp_send_fin(pcb); + if (err == ERR_OK) { + snmp_inc_tcpattemptfails(); + pcb->state = FIN_WAIT_1; + } + break; + case ESTABLISHED: + err = tcp_send_fin(pcb); + if (err == ERR_OK) { + snmp_inc_tcpestabresets(); + pcb->state = FIN_WAIT_1; + } + break; + case CLOSE_WAIT: + err = tcp_send_fin(pcb); + if (err == ERR_OK) { + snmp_inc_tcpestabresets(); + pcb->state = LAST_ACK; + } + break; + default: + /* Has already been closed, do nothing. */ + err = ERR_OK; + pcb = NULL; + break; + } + + if (pcb != NULL && err == ERR_OK) { + /* To ensure all data has been sent when tcp_close returns, we have + to make sure tcp_output doesn't fail. + Since we don't really have to ensure all data has been sent when tcp_close + returns (unsent data is sent from tcp timer functions, also), we don't care + for the return value of tcp_output for now. */ + /* @todo: When implementing SO_LINGER, this must be changed somehow: + If SOF_LINGER is set, the data should be sent and acked before close returns. + This can only be valid for sequential APIs, not for the raw API. */ + tcp_output(pcb); + } + return err; +} + +/** + * Closes the connection held by the PCB. + * + * Listening pcbs are freed and may not be referenced any more. + * Connection pcbs are freed if not yet connected and may not be referenced + * any more. If a connection is established (at least SYN received or in + * a closing state), the connection is closed, and put in a closing state. + * The pcb is then automatically freed in tcp_slowtmr(). It is therefore + * unsafe to reference it (unless an error is returned). + * + * @param pcb the tcp_pcb to close + * @return ERR_OK if connection has been closed + * another err_t if closing failed and pcb is not freed + */ +err_t +tcp_close(struct tcp_pcb *pcb) +{ +#if TCP_DEBUG + LWIP_DEBUGF(TCP_DEBUG, ("tcp_close: closing in ")); + tcp_debug_print_state(pcb->state); +#endif /* TCP_DEBUG */ + + if (pcb->state != LISTEN) { + /* Set a flag not to receive any more data... */ + pcb->flags |= TF_RXCLOSED; + } + /* ... and close */ + return tcp_close_shutdown(pcb, 1); +} + +/** + * Causes all or part of a full-duplex connection of this PCB to be shut down. + * This doesn't deallocate the PCB! + * + * @param pcb PCB to shutdown + * @param shut_rx shut down receive side if this is != 0 + * @param shut_tx shut down send side if this is != 0 + * @return ERR_OK if shutdown succeeded (or the PCB has already been shut down) + * another err_t on error. + */ +err_t +tcp_shutdown(struct tcp_pcb *pcb, int shut_rx, int shut_tx) +{ + if (pcb->state == LISTEN) { + return ERR_CONN; + } + if (shut_rx) { + /* shut down the receive side: free buffered data... */ + if (pcb->refused_data != NULL) { + pbuf_free(pcb->refused_data); + pcb->refused_data = NULL; + } + /* ... and set a flag not to receive any more data */ + pcb->flags |= TF_RXCLOSED; + } + if (shut_tx) { + /* This can't happen twice since if it succeeds, the pcb's state is changed. + Only close in these states as the others directly deallocate the PCB */ + switch (pcb->state) { + case SYN_RCVD: + case ESTABLISHED: + case CLOSE_WAIT: + return tcp_close_shutdown(pcb, 0); + default: + /* don't shut down other states */ + break; + } + } + /* @todo: return another err_t if not in correct state or already shut? */ + return ERR_OK; +} + +/** + * Abandons a connection and optionally sends a RST to the remote + * host. Deletes the local protocol control block. This is done when + * a connection is killed because of shortage of memory. + * + * @param pcb the tcp_pcb to abort + * @param reset boolean to indicate whether a reset should be sent + */ +void +tcp_abandon(struct tcp_pcb *pcb, int reset) +{ + u32_t seqno, ackno; + u16_t remote_port, local_port; + ip_addr_t remote_ip, local_ip; +#if LWIP_CALLBACK_API + tcp_err_fn errf; +#endif /* LWIP_CALLBACK_API */ + void *errf_arg; + + /* pcb->state LISTEN not allowed here */ + LWIP_ASSERT("don't call tcp_abort/tcp_abandon for listen-pcbs", + pcb->state != LISTEN); + /* Figure out on which TCP PCB list we are, and remove us. If we + are in an active state, call the receive function associated with + the PCB with a NULL argument, and send an RST to the remote end. */ + if (pcb->state == TIME_WAIT) { + tcp_pcb_remove(&tcp_tw_pcbs, pcb); + memp_free(MEMP_TCP_PCB, pcb); + } else { + seqno = pcb->snd_nxt; + ackno = pcb->rcv_nxt; + ip_addr_copy(local_ip, pcb->local_ip); + ip_addr_copy(remote_ip, pcb->remote_ip); + local_port = pcb->local_port; + remote_port = pcb->remote_port; +#if LWIP_CALLBACK_API + errf = pcb->errf; +#endif /* LWIP_CALLBACK_API */ + errf_arg = pcb->callback_arg; + tcp_pcb_remove(&tcp_active_pcbs, pcb); + if (pcb->unacked != NULL) { + tcp_segs_free(pcb->unacked); + } + if (pcb->unsent != NULL) { + tcp_segs_free(pcb->unsent); + } +#if TCP_QUEUE_OOSEQ + if (pcb->ooseq != NULL) { + tcp_segs_free(pcb->ooseq); + } +#endif /* TCP_QUEUE_OOSEQ */ + memp_free(MEMP_TCP_PCB, pcb); + TCP_EVENT_ERR(errf, errf_arg, ERR_ABRT); + if (reset) { + LWIP_DEBUGF(TCP_RST_DEBUG, ("tcp_abandon: sending RST\n")); + tcp_rst(seqno, ackno, &local_ip, &remote_ip, local_port, remote_port); + } + } +} + +/** + * Aborts the connection by sending a RST (reset) segment to the remote + * host. The pcb is deallocated. This function never fails. + * + * ATTENTION: When calling this from one of the TCP callbacks, make + * sure you always return ERR_ABRT (and never return ERR_ABRT otherwise + * or you will risk accessing deallocated memory or memory leaks! + * + * @param pcb the tcp pcb to abort + */ +void +tcp_abort(struct tcp_pcb *pcb) +{ + tcp_abandon(pcb, 1); +} + +/** + * Binds the connection to a local portnumber and IP address. If the + * IP address is not given (i.e., ipaddr == NULL), the IP address of + * the outgoing network interface is used instead. + * + * @param pcb the tcp_pcb to bind (no check is done whether this pcb is + * already bound!) + * @param ipaddr the local ip address to bind to (use IP_ADDR_ANY to bind + * to any local address + * @param port the local port to bind to + * @return ERR_USE if the port is already in use + * ERR_VAL if bind failed because the PCB is not in a valid state + * ERR_OK if bound + */ +err_t +tcp_bind(struct tcp_pcb *pcb, ip_addr_t *ipaddr, u16_t port) +{ + int i; + int max_pcb_list = NUM_TCP_PCB_LISTS; + struct tcp_pcb *cpcb; + + LWIP_ERROR("tcp_bind: can only bind in state CLOSED", pcb->state == CLOSED, return ERR_VAL); + +#if SO_REUSE + /* Unless the REUSEADDR flag is set, + we have to check the pcbs in TIME-WAIT state, also. + We do not dump TIME_WAIT pcb's; they can still be matched by incoming + packets using both local and remote IP addresses and ports to distinguish. + */ + if ((pcb->so_options & SOF_REUSEADDR) != 0) { + max_pcb_list = NUM_TCP_PCB_LISTS_NO_TIME_WAIT; + } +#endif /* SO_REUSE */ + + if (port == 0) { + port = tcp_new_port(); + } + + /* Check if the address already is in use (on all lists) */ + for (i = 0; i < max_pcb_list; i++) { + for(cpcb = *tcp_pcb_lists[i]; cpcb != NULL; cpcb = cpcb->next) { + if (cpcb->local_port == port) { +#if SO_REUSE + /* Omit checking for the same port if both pcbs have REUSEADDR set. + For SO_REUSEADDR, the duplicate-check for a 5-tuple is done in + tcp_connect. */ + if (((pcb->so_options & SOF_REUSEADDR) == 0) || + ((cpcb->so_options & SOF_REUSEADDR) == 0)) +#endif /* SO_REUSE */ + { + if (ip_addr_isany(&(cpcb->local_ip)) || + ip_addr_isany(ipaddr) || + ip_addr_cmp(&(cpcb->local_ip), ipaddr)) { + return ERR_USE; + } + } + } + } + } + + if (!ip_addr_isany(ipaddr)) { + pcb->local_ip = *ipaddr; + } + pcb->local_port = port; + TCP_REG(&tcp_bound_pcbs, pcb); + LWIP_DEBUGF(TCP_DEBUG, ("tcp_bind: bind to port %"U16_F"\n", port)); + return ERR_OK; +} +#if LWIP_CALLBACK_API +/** + * Default accept callback if no accept callback is specified by the user. + */ +static err_t +tcp_accept_null(void *arg, struct tcp_pcb *pcb, err_t err) +{ + LWIP_UNUSED_ARG(arg); + LWIP_UNUSED_ARG(pcb); + LWIP_UNUSED_ARG(err); + + return ERR_ABRT; +} +#endif /* LWIP_CALLBACK_API */ + +/** + * Set the state of the connection to be LISTEN, which means that it + * is able to accept incoming connections. The protocol control block + * is reallocated in order to consume less memory. Setting the + * connection to LISTEN is an irreversible process. + * + * @param pcb the original tcp_pcb + * @param backlog the incoming connections queue limit + * @return tcp_pcb used for listening, consumes less memory. + * + * @note The original tcp_pcb is freed. This function therefore has to be + * called like this: + * tpcb = tcp_listen(tpcb); + */ +struct tcp_pcb * +tcp_listen_with_backlog(struct tcp_pcb *pcb, u8_t backlog) +{ + struct tcp_pcb_listen *lpcb; + + LWIP_UNUSED_ARG(backlog); + LWIP_ERROR("tcp_listen: pcb already connected", pcb->state == CLOSED, return NULL); + + /* already listening? */ + if (pcb->state == LISTEN) { + return pcb; + } +#if SO_REUSE + if ((pcb->so_options & SOF_REUSEADDR) != 0) { + /* Since SOF_REUSEADDR allows reusing a local address before the pcb's usage + is declared (listen-/connection-pcb), we have to make sure now that + this port is only used once for every local IP. */ + for(lpcb = tcp_listen_pcbs.listen_pcbs; lpcb != NULL; lpcb = lpcb->next) { + if (lpcb->local_port == pcb->local_port) { + if (ip_addr_cmp(&lpcb->local_ip, &pcb->local_ip)) { + /* this address/port is already used */ + return NULL; + } + } + } + } +#endif /* SO_REUSE */ + lpcb = (struct tcp_pcb_listen *)memp_malloc(MEMP_TCP_PCB_LISTEN); + if (lpcb == NULL) { + return NULL; + } + lpcb->callback_arg = pcb->callback_arg; + lpcb->local_port = pcb->local_port; + lpcb->state = LISTEN; + lpcb->prio = pcb->prio; + lpcb->so_options = pcb->so_options; + lpcb->so_options |= SOF_ACCEPTCONN; + lpcb->ttl = pcb->ttl; + lpcb->tos = pcb->tos; + ip_addr_copy(lpcb->local_ip, pcb->local_ip); + if (pcb->local_port != 0) { + TCP_RMV(&tcp_bound_pcbs, pcb); + } + memp_free(MEMP_TCP_PCB, pcb); +#if LWIP_CALLBACK_API + lpcb->accept = tcp_accept_null; +#endif /* LWIP_CALLBACK_API */ +#if TCP_LISTEN_BACKLOG + lpcb->accepts_pending = 0; + lpcb->backlog = (backlog ? backlog : 1); +#endif /* TCP_LISTEN_BACKLOG */ + TCP_REG(&tcp_listen_pcbs.pcbs, (struct tcp_pcb *)lpcb); + return (struct tcp_pcb *)lpcb; +} + +/** + * Update the state that tracks the available window space to advertise. + * + * Returns how much extra window would be advertised if we sent an + * update now. + */ +u32_t tcp_update_rcv_ann_wnd(struct tcp_pcb *pcb) +{ + u32_t new_right_edge = pcb->rcv_nxt + pcb->rcv_wnd; + + if (TCP_SEQ_GEQ(new_right_edge, pcb->rcv_ann_right_edge + LWIP_MIN((TCP_WND / 2), pcb->mss))) { + /* we can advertise more window */ + pcb->rcv_ann_wnd = pcb->rcv_wnd; + return new_right_edge - pcb->rcv_ann_right_edge; + } else { + if (TCP_SEQ_GT(pcb->rcv_nxt, pcb->rcv_ann_right_edge)) { + /* Can happen due to other end sending out of advertised window, + * but within actual available (but not yet advertised) window */ + pcb->rcv_ann_wnd = 0; + } else { + /* keep the right edge of window constant */ + u32_t new_rcv_ann_wnd = pcb->rcv_ann_right_edge - pcb->rcv_nxt; + LWIP_ASSERT("new_rcv_ann_wnd <= 0xffff", new_rcv_ann_wnd <= 0xffff); + pcb->rcv_ann_wnd = (u16_t)new_rcv_ann_wnd; + } + return 0; + } +} + +/** + * This function should be called by the application when it has + * processed the data. The purpose is to advertise a larger window + * when the data has been processed. + * + * @param pcb the tcp_pcb for which data is read + * @param len the amount of bytes that have been read by the application + */ +void +tcp_recved(struct tcp_pcb *pcb, u16_t len) +{ + int wnd_inflation; + + LWIP_ASSERT("tcp_recved: len would wrap rcv_wnd\n", + len <= 0xffff - pcb->rcv_wnd ); + + pcb->rcv_wnd += len; + if (pcb->rcv_wnd > TCP_WND) { + pcb->rcv_wnd = TCP_WND; + } + + wnd_inflation = tcp_update_rcv_ann_wnd(pcb); + + /* If the change in the right edge of window is significant (default + * watermark is TCP_WND/4), then send an explicit update now. + * Otherwise wait for a packet to be sent in the normal course of + * events (or more window to be available later) */ + if (wnd_inflation >= TCP_WND_UPDATE_THRESHOLD) { + tcp_ack_now(pcb); + tcp_output(pcb); + } + + LWIP_DEBUGF(TCP_DEBUG, ("tcp_recved: recveived %"U16_F" bytes, wnd %"U16_F" (%"U16_F").\n", + len, pcb->rcv_wnd, TCP_WND - pcb->rcv_wnd)); +} + +/** + * A nastly hack featuring 'goto' statements that allocates a + * new TCP local port. + * + * @return a new (free) local TCP port number + */ +static u16_t +tcp_new_port(void) +{ + int i; + struct tcp_pcb *pcb; +#ifndef TCP_LOCAL_PORT_RANGE_START +/* From http://www.iana.org/assignments/port-numbers: + "The Dynamic and/or Private Ports are those from 49152 through 65535" */ +#define TCP_LOCAL_PORT_RANGE_START 0xc000 +#define TCP_LOCAL_PORT_RANGE_END 0xffff +#endif + static u16_t port = TCP_LOCAL_PORT_RANGE_START; + + again: + if (port++ >= TCP_LOCAL_PORT_RANGE_END) { + port = TCP_LOCAL_PORT_RANGE_START; + } + /* Check all PCB lists. */ + for (i = 0; i < NUM_TCP_PCB_LISTS; i++) { + for(pcb = *tcp_pcb_lists[i]; pcb != NULL; pcb = pcb->next) { + if (pcb->local_port == port) { + goto again; + } + } + } + return port; +} + +/** + * Connects to another host. The function given as the "connected" + * argument will be called when the connection has been established. + * + * @param pcb the tcp_pcb used to establish the connection + * @param ipaddr the remote ip address to connect to + * @param port the remote tcp port to connect to + * @param connected callback function to call when connected (or on error) + * @return ERR_VAL if invalid arguments are given + * ERR_OK if connect request has been sent + * other err_t values if connect request couldn't be sent + */ +err_t +tcp_connect(struct tcp_pcb *pcb, ip_addr_t *ipaddr, u16_t port, + tcp_connected_fn connected) +{ + err_t ret; + u32_t iss; + u16_t old_local_port; + + LWIP_ERROR("tcp_connect: can only connect from state CLOSED", pcb->state == CLOSED, return ERR_ISCONN); + + LWIP_DEBUGF(TCP_DEBUG, ("tcp_connect to port %"U16_F"\n", port)); + if (ipaddr != NULL) { + pcb->remote_ip = *ipaddr; + } else { + return ERR_VAL; + } + pcb->remote_port = port; + + /* check if we have a route to the remote host */ + if (ip_addr_isany(&(pcb->local_ip))) { + /* no local IP address set, yet. */ + struct netif *netif = ip_route(&(pcb->remote_ip)); + if (netif == NULL) { + /* Don't even try to send a SYN packet if we have no route + since that will fail. */ + return ERR_RTE; + } + /* Use the netif's IP address as local address. */ + ip_addr_copy(pcb->local_ip, netif->ip_addr); + } + + old_local_port = pcb->local_port; + if (pcb->local_port == 0) { + pcb->local_port = tcp_new_port(); + } +#if SO_REUSE + if ((pcb->so_options & SOF_REUSEADDR) != 0) { + /* Since SOF_REUSEADDR allows reusing a local address, we have to make sure + now that the 5-tuple is unique. */ + struct tcp_pcb *cpcb; + int i; + /* Don't check listen- and bound-PCBs, check active- and TIME-WAIT PCBs. */ + for (i = 2; i < NUM_TCP_PCB_LISTS; i++) { + for(cpcb = *tcp_pcb_lists[i]; cpcb != NULL; cpcb = cpcb->next) { + if ((cpcb->local_port == pcb->local_port) && + (cpcb->remote_port == port) && + ip_addr_cmp(&cpcb->local_ip, &pcb->local_ip) && + ip_addr_cmp(&cpcb->remote_ip, ipaddr)) { + /* linux returns EISCONN here, but ERR_USE should be OK for us */ + return ERR_USE; + } + } + } + } +#endif /* SO_REUSE */ + iss = tcp_next_iss(); + pcb->rcv_nxt = 0; + pcb->snd_nxt = iss; + pcb->lastack = iss - 1; + pcb->snd_lbb = iss - 1; + pcb->rcv_wnd = TCP_WND; + pcb->rcv_ann_wnd = TCP_WND; + pcb->rcv_ann_right_edge = pcb->rcv_nxt; + pcb->snd_wnd = TCP_WND; + /* As initial send MSS, we use TCP_MSS but limit it to 536. + The send MSS is updated when an MSS option is received. */ + pcb->mss = (TCP_MSS > 536) ? 536 : TCP_MSS; +#if TCP_CALCULATE_EFF_SEND_MSS + pcb->mss = tcp_eff_send_mss(pcb->mss, ipaddr); +#endif /* TCP_CALCULATE_EFF_SEND_MSS */ + pcb->cwnd = 1; + pcb->ssthresh = pcb->mss * 10; +#if LWIP_CALLBACK_API + pcb->connected = connected; +#else /* LWIP_CALLBACK_API */ + LWIP_UNUSED_ARG(connected); +#endif /* LWIP_CALLBACK_API */ + + /* Send a SYN together with the MSS option. */ + ret = tcp_enqueue_flags(pcb, TCP_SYN); + if (ret == ERR_OK) { + /* SYN segment was enqueued, changed the pcbs state now */ + pcb->state = SYN_SENT; + if (old_local_port != 0) { + TCP_RMV(&tcp_bound_pcbs, pcb); + } + TCP_REG(&tcp_active_pcbs, pcb); + snmp_inc_tcpactiveopens(); + + tcp_output(pcb); + } + return ret; +} + +/** + * Called every 500 ms and implements the retransmission timer and the timer that + * removes PCBs that have been in TIME-WAIT for enough time. It also increments + * various timers such as the inactivity timer in each PCB. + * + * Automatically called from tcp_tmr(). + */ +void +tcp_slowtmr(void) +{ + struct tcp_pcb *pcb, *prev; + u16_t eff_wnd; + u8_t pcb_remove; /* flag if a PCB should be removed */ + u8_t pcb_reset; /* flag if a RST should be sent when removing */ + err_t err; + + err = ERR_OK; + + ++tcp_ticks; + + /* Steps through all of the active PCBs. */ + prev = NULL; + pcb = tcp_active_pcbs; + if (pcb == NULL) { + LWIP_DEBUGF(TCP_DEBUG, ("tcp_slowtmr: no active pcbs\n")); + } + while (pcb != NULL) { + LWIP_DEBUGF(TCP_DEBUG, ("tcp_slowtmr: processing active pcb\n")); + LWIP_ASSERT("tcp_slowtmr: active pcb->state != CLOSED\n", pcb->state != CLOSED); + LWIP_ASSERT("tcp_slowtmr: active pcb->state != LISTEN\n", pcb->state != LISTEN); + LWIP_ASSERT("tcp_slowtmr: active pcb->state != TIME-WAIT\n", pcb->state != TIME_WAIT); + + pcb_remove = 0; + pcb_reset = 0; + + if (pcb->state == SYN_SENT && pcb->nrtx == TCP_SYNMAXRTX) { + ++pcb_remove; + LWIP_DEBUGF(TCP_DEBUG, ("tcp_slowtmr: max SYN retries reached\n")); + } + else if (pcb->nrtx == TCP_MAXRTX) { + ++pcb_remove; + LWIP_DEBUGF(TCP_DEBUG, ("tcp_slowtmr: max DATA retries reached\n")); + } else { + if (pcb->persist_backoff > 0) { + /* If snd_wnd is zero, use persist timer to send 1 byte probes + * instead of using the standard retransmission mechanism. */ + pcb->persist_cnt++; + if (pcb->persist_cnt >= tcp_persist_backoff[pcb->persist_backoff-1]) { + pcb->persist_cnt = 0; + if (pcb->persist_backoff < sizeof(tcp_persist_backoff)) { + pcb->persist_backoff++; + } + tcp_zero_window_probe(pcb); + } + } else { + /* Increase the retransmission timer if it is running */ + if(pcb->rtime >= 0) + ++pcb->rtime; + + if (pcb->unacked != NULL && pcb->rtime >= pcb->rto) { + /* Time for a retransmission. */ + LWIP_DEBUGF(TCP_RTO_DEBUG, ("tcp_slowtmr: rtime %"S16_F + " pcb->rto %"S16_F"\n", + pcb->rtime, pcb->rto)); + + /* Double retransmission time-out unless we are trying to + * connect to somebody (i.e., we are in SYN_SENT). */ + if (pcb->state != SYN_SENT) { + pcb->rto = ((pcb->sa >> 3) + pcb->sv) << tcp_backoff[pcb->nrtx]; + } + + /* Reset the retransmission timer. */ + pcb->rtime = 0; + + /* Reduce congestion window and ssthresh. */ + eff_wnd = LWIP_MIN(pcb->cwnd, pcb->snd_wnd); + pcb->ssthresh = eff_wnd >> 1; + if (pcb->ssthresh < (pcb->mss << 1)) { + pcb->ssthresh = (pcb->mss << 1); + } + pcb->cwnd = pcb->mss; + LWIP_DEBUGF(TCP_CWND_DEBUG, ("tcp_slowtmr: cwnd %"U16_F + " ssthresh %"U16_F"\n", + pcb->cwnd, pcb->ssthresh)); + + /* The following needs to be called AFTER cwnd is set to one + mss - STJ */ + tcp_rexmit_rto(pcb); + } + } + } + /* Check if this PCB has stayed too long in FIN-WAIT-2 */ + if (pcb->state == FIN_WAIT_2) { + if ((u32_t)(tcp_ticks - pcb->tmr) > + TCP_FIN_WAIT_TIMEOUT / TCP_SLOW_INTERVAL) { + ++pcb_remove; + LWIP_DEBUGF(TCP_DEBUG, ("tcp_slowtmr: removing pcb stuck in FIN-WAIT-2\n")); + } + } + + /* Check if KEEPALIVE should be sent */ + if((pcb->so_options & SOF_KEEPALIVE) && + ((pcb->state == ESTABLISHED) || + (pcb->state == CLOSE_WAIT))) { +#if LWIP_TCP_KEEPALIVE + if((u32_t)(tcp_ticks - pcb->tmr) > + (pcb->keep_idle + (pcb->keep_cnt*pcb->keep_intvl)) + / TCP_SLOW_INTERVAL) +#else + if((u32_t)(tcp_ticks - pcb->tmr) > + (pcb->keep_idle + TCP_MAXIDLE) / TCP_SLOW_INTERVAL) +#endif /* LWIP_TCP_KEEPALIVE */ + { + LWIP_DEBUGF(TCP_DEBUG, ("tcp_slowtmr: KEEPALIVE timeout. Aborting connection to %"U16_F".%"U16_F".%"U16_F".%"U16_F".\n", + ip4_addr1_16(&pcb->remote_ip), ip4_addr2_16(&pcb->remote_ip), + ip4_addr3_16(&pcb->remote_ip), ip4_addr4_16(&pcb->remote_ip))); + + ++pcb_remove; + ++pcb_reset; + } +#if LWIP_TCP_KEEPALIVE + else if((u32_t)(tcp_ticks - pcb->tmr) > + (pcb->keep_idle + pcb->keep_cnt_sent * pcb->keep_intvl) + / TCP_SLOW_INTERVAL) +#else + else if((u32_t)(tcp_ticks - pcb->tmr) > + (pcb->keep_idle + pcb->keep_cnt_sent * TCP_KEEPINTVL_DEFAULT) + / TCP_SLOW_INTERVAL) +#endif /* LWIP_TCP_KEEPALIVE */ + { + tcp_keepalive(pcb); + pcb->keep_cnt_sent++; + } + } + + /* If this PCB has queued out of sequence data, but has been + inactive for too long, will drop the data (it will eventually + be retransmitted). */ +#if TCP_QUEUE_OOSEQ + if (pcb->ooseq != NULL && + (u32_t)tcp_ticks - pcb->tmr >= pcb->rto * TCP_OOSEQ_TIMEOUT) { + tcp_segs_free(pcb->ooseq); + pcb->ooseq = NULL; + LWIP_DEBUGF(TCP_CWND_DEBUG, ("tcp_slowtmr: dropping OOSEQ queued data\n")); + } +#endif /* TCP_QUEUE_OOSEQ */ + + /* Check if this PCB has stayed too long in SYN-RCVD */ + if (pcb->state == SYN_RCVD) { + if ((u32_t)(tcp_ticks - pcb->tmr) > + TCP_SYN_RCVD_TIMEOUT / TCP_SLOW_INTERVAL) { + ++pcb_remove; + LWIP_DEBUGF(TCP_DEBUG, ("tcp_slowtmr: removing pcb stuck in SYN-RCVD\n")); + } + } + + /* Check if this PCB has stayed too long in LAST-ACK */ + if (pcb->state == LAST_ACK) { + if ((u32_t)(tcp_ticks - pcb->tmr) > 2 * TCP_MSL / TCP_SLOW_INTERVAL) { + ++pcb_remove; + LWIP_DEBUGF(TCP_DEBUG, ("tcp_slowtmr: removing pcb stuck in LAST-ACK\n")); + } + } + + /* If the PCB should be removed, do it. */ + if (pcb_remove) { + struct tcp_pcb *pcb2; + tcp_pcb_purge(pcb); + /* Remove PCB from tcp_active_pcbs list. */ + if (prev != NULL) { + LWIP_ASSERT("tcp_slowtmr: middle tcp != tcp_active_pcbs", pcb != tcp_active_pcbs); + prev->next = pcb->next; + } else { + /* This PCB was the first. */ + LWIP_ASSERT("tcp_slowtmr: first pcb == tcp_active_pcbs", tcp_active_pcbs == pcb); + tcp_active_pcbs = pcb->next; + } + + TCP_EVENT_ERR(pcb->errf, pcb->callback_arg, ERR_ABRT); + if (pcb_reset) { + tcp_rst(pcb->snd_nxt, pcb->rcv_nxt, &pcb->local_ip, &pcb->remote_ip, + pcb->local_port, pcb->remote_port); + } + + pcb2 = pcb; + pcb = pcb->next; + memp_free(MEMP_TCP_PCB, pcb2); + } else { + /* get the 'next' element now and work with 'prev' below (in case of abort) */ + prev = pcb; + pcb = pcb->next; + + /* We check if we should poll the connection. */ + ++prev->polltmr; + if (prev->polltmr >= prev->pollinterval) { + prev->polltmr = 0; + LWIP_DEBUGF(TCP_DEBUG, ("tcp_slowtmr: polling application\n")); + TCP_EVENT_POLL(prev, err); + /* if err == ERR_ABRT, 'prev' is already deallocated */ + if (err == ERR_OK) { + tcp_output(prev); + } + } + } + } + + + /* Steps through all of the TIME-WAIT PCBs. */ + prev = NULL; + pcb = tcp_tw_pcbs; + while (pcb != NULL) { + LWIP_ASSERT("tcp_slowtmr: TIME-WAIT pcb->state == TIME-WAIT", pcb->state == TIME_WAIT); + pcb_remove = 0; + + /* Check if this PCB has stayed long enough in TIME-WAIT */ + if ((u32_t)(tcp_ticks - pcb->tmr) > 2 * TCP_MSL / TCP_SLOW_INTERVAL) { + ++pcb_remove; + } + + + + /* If the PCB should be removed, do it. */ + if (pcb_remove) { + struct tcp_pcb *pcb2; + tcp_pcb_purge(pcb); + /* Remove PCB from tcp_tw_pcbs list. */ + if (prev != NULL) { + LWIP_ASSERT("tcp_slowtmr: middle tcp != tcp_tw_pcbs", pcb != tcp_tw_pcbs); + prev->next = pcb->next; + } else { + /* This PCB was the first. */ + LWIP_ASSERT("tcp_slowtmr: first pcb == tcp_tw_pcbs", tcp_tw_pcbs == pcb); + tcp_tw_pcbs = pcb->next; + } + pcb2 = pcb; + pcb = pcb->next; + memp_free(MEMP_TCP_PCB, pcb2); + } else { + prev = pcb; + pcb = pcb->next; + } + } +} + +/** + * Is called every TCP_FAST_INTERVAL (250 ms) and process data previously + * "refused" by upper layer (application) and sends delayed ACKs. + * + * Automatically called from tcp_tmr(). + */ +void +tcp_fasttmr(void) +{ + struct tcp_pcb *pcb = tcp_active_pcbs; + + while(pcb != NULL) { + struct tcp_pcb *next = pcb->next; + /* If there is data which was previously "refused" by upper layer */ + if (pcb->refused_data != NULL) { + /* Notify again application with data previously received. */ + err_t err; + LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_fasttmr: notify kept packet\n")); + TCP_EVENT_RECV(pcb, pcb->refused_data, ERR_OK, err); + if (err == ERR_OK) { + pcb->refused_data = NULL; + } else if (err == ERR_ABRT) { + /* if err == ERR_ABRT, 'pcb' is already deallocated */ + pcb = NULL; + } + } + + /* send delayed ACKs */ + if (pcb && (pcb->flags & TF_ACK_DELAY)) { + LWIP_DEBUGF(TCP_DEBUG, ("tcp_fasttmr: delayed ACK\n")); + tcp_ack_now(pcb); + tcp_output(pcb); + pcb->flags &= ~(TF_ACK_DELAY | TF_ACK_NOW); + } + + pcb = next; + } +} + +/** + * Deallocates a list of TCP segments (tcp_seg structures). + * + * @param seg tcp_seg list of TCP segments to free + */ +void +tcp_segs_free(struct tcp_seg *seg) +{ + while (seg != NULL) { + struct tcp_seg *next = seg->next; + tcp_seg_free(seg); + seg = next; + } +} + +/** + * Frees a TCP segment (tcp_seg structure). + * + * @param seg single tcp_seg to free + */ +void +tcp_seg_free(struct tcp_seg *seg) +{ + if (seg != NULL) { + if (seg->p != NULL) { + pbuf_free(seg->p); +#if TCP_DEBUG + seg->p = NULL; +#endif /* TCP_DEBUG */ + } + memp_free(MEMP_TCP_SEG, seg); + } +} + +/** + * Sets the priority of a connection. + * + * @param pcb the tcp_pcb to manipulate + * @param prio new priority + */ +void +tcp_setprio(struct tcp_pcb *pcb, u8_t prio) +{ + pcb->prio = prio; +} + +#if TCP_QUEUE_OOSEQ +/** + * Returns a copy of the given TCP segment. + * The pbuf and data are not copied, only the pointers + * + * @param seg the old tcp_seg + * @return a copy of seg + */ +struct tcp_seg * +tcp_seg_copy(struct tcp_seg *seg) +{ + struct tcp_seg *cseg; + + cseg = (struct tcp_seg *)memp_malloc(MEMP_TCP_SEG); + if (cseg == NULL) { + return NULL; + } + SMEMCPY((u8_t *)cseg, (const u8_t *)seg, sizeof(struct tcp_seg)); + pbuf_ref(cseg->p); + return cseg; +} +#endif /* TCP_QUEUE_OOSEQ */ + +#if LWIP_CALLBACK_API +/** + * Default receive callback that is called if the user didn't register + * a recv callback for the pcb. + */ +err_t +tcp_recv_null(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err) +{ + LWIP_UNUSED_ARG(arg); + if (p != NULL) { + tcp_recved(pcb, p->tot_len); + pbuf_free(p); + } else if (err == ERR_OK) { + return tcp_close(pcb); + } + return ERR_OK; +} +#endif /* LWIP_CALLBACK_API */ + +/** + * Kills the oldest active connection that has lower priority than prio. + * + * @param prio minimum priority + */ +static void +tcp_kill_prio(u8_t prio) +{ + struct tcp_pcb *pcb, *inactive; + u32_t inactivity; + u8_t mprio; + + + mprio = TCP_PRIO_MAX; + + /* We kill the oldest active connection that has lower priority than prio. */ + inactivity = 0; + inactive = NULL; + for(pcb = tcp_active_pcbs; pcb != NULL; pcb = pcb->next) { + if (pcb->prio <= prio && + pcb->prio <= mprio && + (u32_t)(tcp_ticks - pcb->tmr) >= inactivity) { + inactivity = tcp_ticks - pcb->tmr; + inactive = pcb; + mprio = pcb->prio; + } + } + if (inactive != NULL) { + LWIP_DEBUGF(TCP_DEBUG, ("tcp_kill_prio: killing oldest PCB %p (%"S32_F")\n", + (void *)inactive, inactivity)); + tcp_abort(inactive); + } +} + +/** + * Kills the oldest connection that is in TIME_WAIT state. + * Called from tcp_alloc() if no more connections are available. + */ +static void +tcp_kill_timewait(void) +{ + struct tcp_pcb *pcb, *inactive; + u32_t inactivity; + + inactivity = 0; + inactive = NULL; + /* Go through the list of TIME_WAIT pcbs and get the oldest pcb. */ + for(pcb = tcp_tw_pcbs; pcb != NULL; pcb = pcb->next) { + if ((u32_t)(tcp_ticks - pcb->tmr) >= inactivity) { + inactivity = tcp_ticks - pcb->tmr; + inactive = pcb; + } + } + if (inactive != NULL) { + LWIP_DEBUGF(TCP_DEBUG, ("tcp_kill_timewait: killing oldest TIME-WAIT PCB %p (%"S32_F")\n", + (void *)inactive, inactivity)); + tcp_abort(inactive); + } +} + +/** + * Allocate a new tcp_pcb structure. + * + * @param prio priority for the new pcb + * @return a new tcp_pcb that initially is in state CLOSED + */ +struct tcp_pcb * +tcp_alloc(u8_t prio) +{ + struct tcp_pcb *pcb; + u32_t iss; + + pcb = (struct tcp_pcb *)memp_malloc(MEMP_TCP_PCB); + if (pcb == NULL) { + /* Try killing oldest connection in TIME-WAIT. */ + LWIP_DEBUGF(TCP_DEBUG, ("tcp_alloc: killing off oldest TIME-WAIT connection\n")); + tcp_kill_timewait(); + /* Try to allocate a tcp_pcb again. */ + pcb = (struct tcp_pcb *)memp_malloc(MEMP_TCP_PCB); + if (pcb == NULL) { + /* Try killing active connections with lower priority than the new one. */ + LWIP_DEBUGF(TCP_DEBUG, ("tcp_alloc: killing connection with prio lower than %d\n", prio)); + tcp_kill_prio(prio); + /* Try to allocate a tcp_pcb again. */ + pcb = (struct tcp_pcb *)memp_malloc(MEMP_TCP_PCB); + if (pcb != NULL) { + /* adjust err stats: memp_malloc failed twice before */ + MEMP_STATS_DEC(err, MEMP_TCP_PCB); + } + } + if (pcb != NULL) { + /* adjust err stats: timewait PCB was freed above */ + MEMP_STATS_DEC(err, MEMP_TCP_PCB); + } + } + if (pcb != NULL) { + memset(pcb, 0, sizeof(struct tcp_pcb)); + pcb->prio = prio; + pcb->snd_buf = TCP_SND_BUF; + pcb->snd_queuelen = 0; + pcb->rcv_wnd = TCP_WND; + pcb->rcv_ann_wnd = TCP_WND; + pcb->tos = 0; + pcb->ttl = TCP_TTL; + /* As initial send MSS, we use TCP_MSS but limit it to 536. + The send MSS is updated when an MSS option is received. */ + pcb->mss = (TCP_MSS > 536) ? 536 : TCP_MSS; + pcb->rto = 3000 / TCP_SLOW_INTERVAL; + pcb->sa = 0; + pcb->sv = 3000 / TCP_SLOW_INTERVAL; + pcb->rtime = -1; + pcb->cwnd = 1; + iss = tcp_next_iss(); + pcb->snd_wl2 = iss; + pcb->snd_nxt = iss; + pcb->lastack = iss; + pcb->snd_lbb = iss; + pcb->tmr = tcp_ticks; + + pcb->polltmr = 0; + +#if LWIP_CALLBACK_API + pcb->recv = tcp_recv_null; +#endif /* LWIP_CALLBACK_API */ + + /* Init KEEPALIVE timer */ + pcb->keep_idle = TCP_KEEPIDLE_DEFAULT; + +#if LWIP_TCP_KEEPALIVE + pcb->keep_intvl = TCP_KEEPINTVL_DEFAULT; + pcb->keep_cnt = TCP_KEEPCNT_DEFAULT; +#endif /* LWIP_TCP_KEEPALIVE */ + + pcb->keep_cnt_sent = 0; + } + return pcb; +} + +/** + * Creates a new TCP protocol control block but doesn't place it on + * any of the TCP PCB lists. + * The pcb is not put on any list until binding using tcp_bind(). + * + * @internal: Maybe there should be a idle TCP PCB list where these + * PCBs are put on. Port reservation using tcp_bind() is implemented but + * allocated pcbs that are not bound can't be killed automatically if wanting + * to allocate a pcb with higher prio (@see tcp_kill_prio()) + * + * @return a new tcp_pcb that initially is in state CLOSED + */ +struct tcp_pcb * +tcp_new(void) +{ + return tcp_alloc(TCP_PRIO_NORMAL); +} + +/** + * Used to specify the argument that should be passed callback + * functions. + * + * @param pcb tcp_pcb to set the callback argument + * @param arg void pointer argument to pass to callback functions + */ +void +tcp_arg(struct tcp_pcb *pcb, void *arg) +{ + pcb->callback_arg = arg; +} +#if LWIP_CALLBACK_API + +/** + * Used to specify the function that should be called when a TCP + * connection receives data. + * + * @param pcb tcp_pcb to set the recv callback + * @param recv callback function to call for this pcb when data is received + */ +void +tcp_recv(struct tcp_pcb *pcb, tcp_recv_fn recv) +{ + pcb->recv = recv; +} + +/** + * Used to specify the function that should be called when TCP data + * has been successfully delivered to the remote host. + * + * @param pcb tcp_pcb to set the sent callback + * @param sent callback function to call for this pcb when data is successfully sent + */ +void +tcp_sent(struct tcp_pcb *pcb, tcp_sent_fn sent) +{ + pcb->sent = sent; +} + +/** + * Used to specify the function that should be called when a fatal error + * has occured on the connection. + * + * @param pcb tcp_pcb to set the err callback + * @param err callback function to call for this pcb when a fatal error + * has occured on the connection + */ +void +tcp_err(struct tcp_pcb *pcb, tcp_err_fn err) +{ + pcb->errf = err; +} + +/** + * Used for specifying the function that should be called when a + * LISTENing connection has been connected to another host. + * + * @param pcb tcp_pcb to set the accept callback + * @param accept callback function to call for this pcb when LISTENing + * connection has been connected to another host + */ +void +tcp_accept(struct tcp_pcb *pcb, tcp_accept_fn accept) +{ + pcb->accept = accept; +} +#endif /* LWIP_CALLBACK_API */ + + +/** + * Used to specify the function that should be called periodically + * from TCP. The interval is specified in terms of the TCP coarse + * timer interval, which is called twice a second. + * + */ +void +tcp_poll(struct tcp_pcb *pcb, tcp_poll_fn poll, u8_t interval) +{ +#if LWIP_CALLBACK_API + pcb->poll = poll; +#else /* LWIP_CALLBACK_API */ + LWIP_UNUSED_ARG(poll); +#endif /* LWIP_CALLBACK_API */ + pcb->pollinterval = interval; +} + +/** + * Purges a TCP PCB. Removes any buffered data and frees the buffer memory + * (pcb->ooseq, pcb->unsent and pcb->unacked are freed). + * + * @param pcb tcp_pcb to purge. The pcb itself is not deallocated! + */ +void +tcp_pcb_purge(struct tcp_pcb *pcb) +{ + if (pcb->state != CLOSED && + pcb->state != TIME_WAIT && + pcb->state != LISTEN) { + + LWIP_DEBUGF(TCP_DEBUG, ("tcp_pcb_purge\n")); + +#if TCP_LISTEN_BACKLOG + if (pcb->state == SYN_RCVD) { + /* Need to find the corresponding listen_pcb and decrease its accepts_pending */ + struct tcp_pcb_listen *lpcb; + LWIP_ASSERT("tcp_pcb_purge: pcb->state == SYN_RCVD but tcp_listen_pcbs is NULL", + tcp_listen_pcbs.listen_pcbs != NULL); + for (lpcb = tcp_listen_pcbs.listen_pcbs; lpcb != NULL; lpcb = lpcb->next) { + if ((lpcb->local_port == pcb->local_port) && + (ip_addr_isany(&lpcb->local_ip) || + ip_addr_cmp(&pcb->local_ip, &lpcb->local_ip))) { + /* port and address of the listen pcb match the timed-out pcb */ + LWIP_ASSERT("tcp_pcb_purge: listen pcb does not have accepts pending", + lpcb->accepts_pending > 0); + lpcb->accepts_pending--; + break; + } + } + } +#endif /* TCP_LISTEN_BACKLOG */ + + + if (pcb->refused_data != NULL) { + LWIP_DEBUGF(TCP_DEBUG, ("tcp_pcb_purge: data left on ->refused_data\n")); + pbuf_free(pcb->refused_data); + pcb->refused_data = NULL; + } + if (pcb->unsent != NULL) { + LWIP_DEBUGF(TCP_DEBUG, ("tcp_pcb_purge: not all data sent\n")); + } + if (pcb->unacked != NULL) { + LWIP_DEBUGF(TCP_DEBUG, ("tcp_pcb_purge: data left on ->unacked\n")); + } +#if TCP_QUEUE_OOSEQ + if (pcb->ooseq != NULL) { + LWIP_DEBUGF(TCP_DEBUG, ("tcp_pcb_purge: data left on ->ooseq\n")); + } + tcp_segs_free(pcb->ooseq); + pcb->ooseq = NULL; +#endif /* TCP_QUEUE_OOSEQ */ + + /* Stop the retransmission timer as it will expect data on unacked + queue if it fires */ + pcb->rtime = -1; + + tcp_segs_free(pcb->unsent); + tcp_segs_free(pcb->unacked); + pcb->unacked = pcb->unsent = NULL; +#if TCP_OVERSIZE + pcb->unsent_oversize = 0; +#endif /* TCP_OVERSIZE */ + } +} + +/** + * Purges the PCB and removes it from a PCB list. Any delayed ACKs are sent first. + * + * @param pcblist PCB list to purge. + * @param pcb tcp_pcb to purge. The pcb itself is NOT deallocated! + */ +void +tcp_pcb_remove(struct tcp_pcb **pcblist, struct tcp_pcb *pcb) +{ + TCP_RMV(pcblist, pcb); + + tcp_pcb_purge(pcb); + + /* if there is an outstanding delayed ACKs, send it */ + if (pcb->state != TIME_WAIT && + pcb->state != LISTEN && + pcb->flags & TF_ACK_DELAY) { + pcb->flags |= TF_ACK_NOW; + tcp_output(pcb); + } + + if (pcb->state != LISTEN) { + LWIP_ASSERT("unsent segments leaking", pcb->unsent == NULL); + LWIP_ASSERT("unacked segments leaking", pcb->unacked == NULL); +#if TCP_QUEUE_OOSEQ + LWIP_ASSERT("ooseq segments leaking", pcb->ooseq == NULL); +#endif /* TCP_QUEUE_OOSEQ */ + } + + pcb->state = CLOSED; + + LWIP_ASSERT("tcp_pcb_remove: tcp_pcbs_sane()", tcp_pcbs_sane()); +} + +/** + * Calculates a new initial sequence number for new connections. + * + * @return u32_t pseudo random sequence number + */ +u32_t +tcp_next_iss(void) +{ + static u32_t iss = 6510; + + iss += tcp_ticks; /* XXX */ + return iss; +} + +#if TCP_CALCULATE_EFF_SEND_MSS +/** + * Calcluates the effective send mss that can be used for a specific IP address + * by using ip_route to determin the netif used to send to the address and + * calculating the minimum of TCP_MSS and that netif's mtu (if set). + */ +u16_t +tcp_eff_send_mss(u16_t sendmss, ip_addr_t *addr) +{ + u16_t mss_s; + struct netif *outif; + + outif = ip_route(addr); + if ((outif != NULL) && (outif->mtu != 0)) { + mss_s = outif->mtu - IP_HLEN - TCP_HLEN; + /* RFC 1122, chap 4.2.2.6: + * Eff.snd.MSS = min(SendMSS+20, MMS_S) - TCPhdrsize - IPoptionsize + * We correct for TCP options in tcp_write(), and don't support IP options. + */ + sendmss = LWIP_MIN(sendmss, mss_s); + } + return sendmss; +} +#endif /* TCP_CALCULATE_EFF_SEND_MSS */ + +const char* +tcp_debug_state_str(enum tcp_state s) +{ + return tcp_state_str[s]; +} + +#if TCP_DEBUG || TCP_INPUT_DEBUG || TCP_OUTPUT_DEBUG +/** + * Print a tcp header for debugging purposes. + * + * @param tcphdr pointer to a struct tcp_hdr + */ +void +tcp_debug_print(struct tcp_hdr *tcphdr) +{ + LWIP_DEBUGF(TCP_DEBUG, ("TCP header:\n")); + LWIP_DEBUGF(TCP_DEBUG, ("+-------------------------------+\n")); + LWIP_DEBUGF(TCP_DEBUG, ("| %5"U16_F" | %5"U16_F" | (src port, dest port)\n", + ntohs(tcphdr->src), ntohs(tcphdr->dest))); + LWIP_DEBUGF(TCP_DEBUG, ("+-------------------------------+\n")); + LWIP_DEBUGF(TCP_DEBUG, ("| %010"U32_F" | (seq no)\n", + ntohl(tcphdr->seqno))); + LWIP_DEBUGF(TCP_DEBUG, ("+-------------------------------+\n")); + LWIP_DEBUGF(TCP_DEBUG, ("| %010"U32_F" | (ack no)\n", + ntohl(tcphdr->ackno))); + LWIP_DEBUGF(TCP_DEBUG, ("+-------------------------------+\n")); + LWIP_DEBUGF(TCP_DEBUG, ("| %2"U16_F" | |%"U16_F"%"U16_F"%"U16_F"%"U16_F"%"U16_F"%"U16_F"| %5"U16_F" | (hdrlen, flags (", + TCPH_HDRLEN(tcphdr), + TCPH_FLAGS(tcphdr) >> 5 & 1, + TCPH_FLAGS(tcphdr) >> 4 & 1, + TCPH_FLAGS(tcphdr) >> 3 & 1, + TCPH_FLAGS(tcphdr) >> 2 & 1, + TCPH_FLAGS(tcphdr) >> 1 & 1, + TCPH_FLAGS(tcphdr) & 1, + ntohs(tcphdr->wnd))); + tcp_debug_print_flags(TCPH_FLAGS(tcphdr)); + LWIP_DEBUGF(TCP_DEBUG, ("), win)\n")); + LWIP_DEBUGF(TCP_DEBUG, ("+-------------------------------+\n")); + LWIP_DEBUGF(TCP_DEBUG, ("| 0x%04"X16_F" | %5"U16_F" | (chksum, urgp)\n", + ntohs(tcphdr->chksum), ntohs(tcphdr->urgp))); + LWIP_DEBUGF(TCP_DEBUG, ("+-------------------------------+\n")); +} + +/** + * Print a tcp state for debugging purposes. + * + * @param s enum tcp_state to print + */ +void +tcp_debug_print_state(enum tcp_state s) +{ + LWIP_DEBUGF(TCP_DEBUG, ("State: %s\n", tcp_state_str[s])); +} + +/** + * Print tcp flags for debugging purposes. + * + * @param flags tcp flags, all active flags are printed + */ +void +tcp_debug_print_flags(u8_t flags) +{ + if (flags & TCP_FIN) { + LWIP_DEBUGF(TCP_DEBUG, ("FIN ")); + } + if (flags & TCP_SYN) { + LWIP_DEBUGF(TCP_DEBUG, ("SYN ")); + } + if (flags & TCP_RST) { + LWIP_DEBUGF(TCP_DEBUG, ("RST ")); + } + if (flags & TCP_PSH) { + LWIP_DEBUGF(TCP_DEBUG, ("PSH ")); + } + if (flags & TCP_ACK) { + LWIP_DEBUGF(TCP_DEBUG, ("ACK ")); + } + if (flags & TCP_URG) { + LWIP_DEBUGF(TCP_DEBUG, ("URG ")); + } + if (flags & TCP_ECE) { + LWIP_DEBUGF(TCP_DEBUG, ("ECE ")); + } + if (flags & TCP_CWR) { + LWIP_DEBUGF(TCP_DEBUG, ("CWR ")); + } + LWIP_DEBUGF(TCP_DEBUG, ("\n")); +} + +/** + * Print all tcp_pcbs in every list for debugging purposes. + */ +void +tcp_debug_print_pcbs(void) +{ + struct tcp_pcb *pcb; + LWIP_DEBUGF(TCP_DEBUG, ("Active PCB states:\n")); + for(pcb = tcp_active_pcbs; pcb != NULL; pcb = pcb->next) { + LWIP_DEBUGF(TCP_DEBUG, ("Local port %"U16_F", foreign port %"U16_F" snd_nxt %"U32_F" rcv_nxt %"U32_F" ", + pcb->local_port, pcb->remote_port, + pcb->snd_nxt, pcb->rcv_nxt)); + tcp_debug_print_state(pcb->state); + } + LWIP_DEBUGF(TCP_DEBUG, ("Listen PCB states:\n")); + for(pcb = (struct tcp_pcb *)tcp_listen_pcbs.pcbs; pcb != NULL; pcb = pcb->next) { + LWIP_DEBUGF(TCP_DEBUG, ("Local port %"U16_F", foreign port %"U16_F" snd_nxt %"U32_F" rcv_nxt %"U32_F" ", + pcb->local_port, pcb->remote_port, + pcb->snd_nxt, pcb->rcv_nxt)); + tcp_debug_print_state(pcb->state); + } + LWIP_DEBUGF(TCP_DEBUG, ("TIME-WAIT PCB states:\n")); + for(pcb = tcp_tw_pcbs; pcb != NULL; pcb = pcb->next) { + LWIP_DEBUGF(TCP_DEBUG, ("Local port %"U16_F", foreign port %"U16_F" snd_nxt %"U32_F" rcv_nxt %"U32_F" ", + pcb->local_port, pcb->remote_port, + pcb->snd_nxt, pcb->rcv_nxt)); + tcp_debug_print_state(pcb->state); + } +} + +/** + * Check state consistency of the tcp_pcb lists. + */ +s16_t +tcp_pcbs_sane(void) +{ + struct tcp_pcb *pcb; + for(pcb = tcp_active_pcbs; pcb != NULL; pcb = pcb->next) { + LWIP_ASSERT("tcp_pcbs_sane: active pcb->state != CLOSED", pcb->state != CLOSED); + LWIP_ASSERT("tcp_pcbs_sane: active pcb->state != LISTEN", pcb->state != LISTEN); + LWIP_ASSERT("tcp_pcbs_sane: active pcb->state != TIME-WAIT", pcb->state != TIME_WAIT); + } + for(pcb = tcp_tw_pcbs; pcb != NULL; pcb = pcb->next) { + LWIP_ASSERT("tcp_pcbs_sane: tw pcb->state == TIME-WAIT", pcb->state == TIME_WAIT); + } + return 1; +} +#endif /* TCP_DEBUG */ + +#endif /* LWIP_TCP */ diff --git a/lib/drivers/lwip/src/core/tcp_in.c b/lib/drivers/lwip/src/core/tcp_in.c new file mode 100644 index 00000000000..e1bfe8874b0 --- /dev/null +++ b/lib/drivers/lwip/src/core/tcp_in.c @@ -0,0 +1,1585 @@ +/** + * @file + * Transmission Control Protocol, incoming traffic + * + * The input processing functions of the TCP layer. + * + * These functions are generally called in the order (ip_input() ->) + * tcp_input() -> * tcp_process() -> tcp_receive() (-> application). + * + */ + +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ + +#include "lwip/opt.h" + +#if LWIP_TCP /* don't build if not configured for use in lwipopts.h */ + +#include "lwip/tcp_impl.h" +#include "lwip/def.h" +#include "lwip/ip_addr.h" +#include "lwip/netif.h" +#include "lwip/mem.h" +#include "lwip/memp.h" +#include "lwip/inet_chksum.h" +#include "lwip/stats.h" +#include "lwip/snmp.h" +#include "arch/perf.h" + +/* These variables are global to all functions involved in the input + processing of TCP segments. They are set by the tcp_input() + function. */ +static struct tcp_seg inseg; +static struct tcp_hdr *tcphdr; +static struct ip_hdr *iphdr; +static u32_t seqno, ackno; +static u8_t flags; +static u16_t tcplen; + +static u8_t recv_flags; +static struct pbuf *recv_data; + +struct tcp_pcb *tcp_input_pcb; + +/* Forward declarations. */ +static err_t tcp_process(struct tcp_pcb *pcb); +static void tcp_receive(struct tcp_pcb *pcb); +static void tcp_parseopt(struct tcp_pcb *pcb); + +static err_t tcp_listen_input(struct tcp_pcb_listen *pcb); +static err_t tcp_timewait_input(struct tcp_pcb *pcb); + +static const char * const tcp_state_str[] = { + "CLOSED", + "LISTEN", + "SYN_SENT", + "SYN_RCVD", + "ESTABLISHED", + "FIN_WAIT_1", + "FIN_WAIT_2", + "CLOSE_WAIT", + "CLOSING", + "LAST_ACK", + "TIME_WAIT" +}; + +/** + * The initial input processing of TCP. It verifies the TCP header, demultiplexes + * the segment between the PCBs and passes it on to tcp_process(), which implements + * the TCP finite state machine. This function is called by the IP layer (in + * ip_input()). + * + * @param p received TCP segment to process (p->payload pointing to the IP header) + * @param inp network interface on which this segment was received + */ +void +tcp_input(struct pbuf *p, struct netif *inp) +{ + struct tcp_pcb *pcb, *prev; + struct tcp_pcb_listen *lpcb; +#if SO_REUSE + struct tcp_pcb *lpcb_prev = NULL; + struct tcp_pcb_listen *lpcb_any = NULL; +#endif /* SO_REUSE */ + u8_t hdrlen; + err_t err; + + PERF_START; + + TCP_STATS_INC(tcp.recv); + snmp_inc_tcpinsegs(); + + iphdr = (struct ip_hdr *)p->payload; + tcphdr = (struct tcp_hdr *)((u8_t *)p->payload + IPH_HL(iphdr) * 4); + +#if TCP_INPUT_DEBUG + tcp_debug_print(tcphdr); +#endif + + /* remove header from payload */ + if (pbuf_header(p, -((s16_t)(IPH_HL(iphdr) * 4))) || (p->tot_len < sizeof(struct tcp_hdr))) { + /* drop short packets */ + LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_input: short packet (%"U16_F" bytes) discarded\n", p->tot_len)); + TCP_STATS_INC(tcp.lenerr); + TCP_STATS_INC(tcp.drop); + snmp_inc_tcpinerrs(); + pbuf_free(p); + return; + } + + /* Don't even process incoming broadcasts/multicasts. */ + if (ip_addr_isbroadcast(¤t_iphdr_dest, inp) || + ip_addr_ismulticast(¤t_iphdr_dest)) { + TCP_STATS_INC(tcp.proterr); + TCP_STATS_INC(tcp.drop); + snmp_inc_tcpinerrs(); + pbuf_free(p); + return; + } + +#if CHECKSUM_CHECK_TCP + /* Verify TCP checksum. */ + if (inet_chksum_pseudo(p, ip_current_src_addr(), ip_current_dest_addr(), + IP_PROTO_TCP, p->tot_len) != 0) { + LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_input: packet discarded due to failing checksum 0x%04"X16_F"\n", + inet_chksum_pseudo(p, ip_current_src_addr(), ip_current_dest_addr(), + IP_PROTO_TCP, p->tot_len))); +#if TCP_DEBUG + tcp_debug_print(tcphdr); +#endif /* TCP_DEBUG */ + TCP_STATS_INC(tcp.chkerr); + TCP_STATS_INC(tcp.drop); + snmp_inc_tcpinerrs(); + pbuf_free(p); + return; + } +#endif + + /* Move the payload pointer in the pbuf so that it points to the + TCP data instead of the TCP header. */ + hdrlen = TCPH_HDRLEN(tcphdr); + if(pbuf_header(p, -(hdrlen * 4))){ + /* drop short packets */ + LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_input: short packet\n")); + TCP_STATS_INC(tcp.lenerr); + TCP_STATS_INC(tcp.drop); + snmp_inc_tcpinerrs(); + pbuf_free(p); + return; + } + + /* Convert fields in TCP header to host byte order. */ + tcphdr->src = ntohs(tcphdr->src); + tcphdr->dest = ntohs(tcphdr->dest); + seqno = tcphdr->seqno = ntohl(tcphdr->seqno); + ackno = tcphdr->ackno = ntohl(tcphdr->ackno); + tcphdr->wnd = ntohs(tcphdr->wnd); + + flags = TCPH_FLAGS(tcphdr); + tcplen = p->tot_len + ((flags & (TCP_FIN | TCP_SYN)) ? 1 : 0); + + /* Demultiplex an incoming segment. First, we check if it is destined + for an active connection. */ + prev = NULL; + + + for(pcb = tcp_active_pcbs; pcb != NULL; pcb = pcb->next) { + LWIP_ASSERT("tcp_input: active pcb->state != CLOSED", pcb->state != CLOSED); + LWIP_ASSERT("tcp_input: active pcb->state != TIME-WAIT", pcb->state != TIME_WAIT); + LWIP_ASSERT("tcp_input: active pcb->state != LISTEN", pcb->state != LISTEN); + if (pcb->remote_port == tcphdr->src && + pcb->local_port == tcphdr->dest && + ip_addr_cmp(&(pcb->remote_ip), ¤t_iphdr_src) && + ip_addr_cmp(&(pcb->local_ip), ¤t_iphdr_dest)) { + + /* Move this PCB to the front of the list so that subsequent + lookups will be faster (we exploit locality in TCP segment + arrivals). */ + LWIP_ASSERT("tcp_input: pcb->next != pcb (before cache)", pcb->next != pcb); + if (prev != NULL) { + prev->next = pcb->next; + pcb->next = tcp_active_pcbs; + tcp_active_pcbs = pcb; + } + LWIP_ASSERT("tcp_input: pcb->next != pcb (after cache)", pcb->next != pcb); + break; + } + prev = pcb; + } + + if (pcb == NULL) { + /* If it did not go to an active connection, we check the connections + in the TIME-WAIT state. */ + for(pcb = tcp_tw_pcbs; pcb != NULL; pcb = pcb->next) { + LWIP_ASSERT("tcp_input: TIME-WAIT pcb->state == TIME-WAIT", pcb->state == TIME_WAIT); + if (pcb->remote_port == tcphdr->src && + pcb->local_port == tcphdr->dest && + ip_addr_cmp(&(pcb->remote_ip), ¤t_iphdr_src) && + ip_addr_cmp(&(pcb->local_ip), ¤t_iphdr_dest)) { + /* We don't really care enough to move this PCB to the front + of the list since we are not very likely to receive that + many segments for connections in TIME-WAIT. */ + LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_input: packed for TIME_WAITing connection.\n")); + tcp_timewait_input(pcb); + pbuf_free(p); + return; + } + } + + /* Finally, if we still did not get a match, we check all PCBs that + are LISTENing for incoming connections. */ + prev = NULL; + for(lpcb = tcp_listen_pcbs.listen_pcbs; lpcb != NULL; lpcb = lpcb->next) { + if (lpcb->local_port == tcphdr->dest) { +#if SO_REUSE + if (ip_addr_cmp(&(lpcb->local_ip), ¤t_iphdr_dest)) { + /* found an exact match */ + break; + } else if(ip_addr_isany(&(lpcb->local_ip))) { + /* found an ANY-match */ + lpcb_any = lpcb; + lpcb_prev = prev; + } +#else /* SO_REUSE */ + if (ip_addr_cmp(&(lpcb->local_ip), ¤t_iphdr_dest) || + ip_addr_isany(&(lpcb->local_ip))) { + /* found a match */ + break; + } +#endif /* SO_REUSE */ + } + prev = (struct tcp_pcb *)lpcb; + } +#if SO_REUSE + /* first try specific local IP */ + if (lpcb == NULL) { + /* only pass to ANY if no specific local IP has been found */ + lpcb = lpcb_any; + prev = lpcb_prev; + } +#endif /* SO_REUSE */ + if (lpcb != NULL) { + /* Move this PCB to the front of the list so that subsequent + lookups will be faster (we exploit locality in TCP segment + arrivals). */ + if (prev != NULL) { + ((struct tcp_pcb_listen *)prev)->next = lpcb->next; + /* our successor is the remainder of the listening list */ + lpcb->next = tcp_listen_pcbs.listen_pcbs; + /* put this listening pcb at the head of the listening list */ + tcp_listen_pcbs.listen_pcbs = lpcb; + } + + LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_input: packed for LISTENing connection.\n")); + tcp_listen_input(lpcb); + pbuf_free(p); + return; + } + } + +#if TCP_INPUT_DEBUG + LWIP_DEBUGF(TCP_INPUT_DEBUG, ("+-+-+-+-+-+-+-+-+-+-+-+-+-+- tcp_input: flags ")); + tcp_debug_print_flags(TCPH_FLAGS(tcphdr)); + LWIP_DEBUGF(TCP_INPUT_DEBUG, ("-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n")); +#endif /* TCP_INPUT_DEBUG */ + + + if (pcb != NULL) { + /* The incoming segment belongs to a connection. */ +#if TCP_INPUT_DEBUG +#if TCP_DEBUG + tcp_debug_print_state(pcb->state); +#endif /* TCP_DEBUG */ +#endif /* TCP_INPUT_DEBUG */ + + /* Set up a tcp_seg structure. */ + inseg.next = NULL; + inseg.len = p->tot_len; + inseg.p = p; + inseg.tcphdr = tcphdr; + + recv_data = NULL; + recv_flags = 0; + + /* If there is data which was previously "refused" by upper layer */ + if (pcb->refused_data != NULL) { + /* Notify again application with data previously received. */ + LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_input: notify kept packet\n")); + TCP_EVENT_RECV(pcb, pcb->refused_data, ERR_OK, err); + if (err == ERR_OK) { + pcb->refused_data = NULL; + } else if ((err == ERR_ABRT) || (tcplen > 0)) { + /* if err == ERR_ABRT, 'pcb' is already deallocated */ + /* Drop incoming packets because pcb is "full" (only if the incoming + segment contains data). */ + LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_input: drop incoming packets, because pcb is \"full\"\n")); + TCP_STATS_INC(tcp.drop); + snmp_inc_tcpinerrs(); + pbuf_free(p); + return; + } + } + tcp_input_pcb = pcb; + err = tcp_process(pcb); + /* A return value of ERR_ABRT means that tcp_abort() was called + and that the pcb has been freed. If so, we don't do anything. */ + if (err != ERR_ABRT) { + if (recv_flags & TF_RESET) { + /* TF_RESET means that the connection was reset by the other + end. We then call the error callback to inform the + application that the connection is dead before we + deallocate the PCB. */ + TCP_EVENT_ERR(pcb->errf, pcb->callback_arg, ERR_RST); + tcp_pcb_remove(&tcp_active_pcbs, pcb); + memp_free(MEMP_TCP_PCB, pcb); + } else if (recv_flags & TF_CLOSED) { + /* The connection has been closed and we will deallocate the + PCB. */ + TCP_EVENT_CLOSED(pcb, err); + if (err == ERR_ABRT) { + goto aborted; + } + tcp_pcb_remove(&tcp_active_pcbs, pcb); + memp_free(MEMP_TCP_PCB, pcb); + } else { + err = ERR_OK; + /* If the application has registered a "sent" function to be + called when new send buffer space is available, we call it + now. */ + if (pcb->acked > 0) { + TCP_EVENT_SENT(pcb, pcb->acked, err); + if (err == ERR_ABRT) { + goto aborted; + } + } + + if (recv_data != NULL) { + LWIP_ASSERT("pcb->refused_data == NULL", pcb->refused_data == NULL); + if (pcb->flags & TF_RXCLOSED) { + /* received data although already closed -> abort (send RST) to + notify the remote host that not all data has been processed */ + pbuf_free(recv_data); + tcp_abort(pcb); + goto aborted; + } + if (flags & TCP_PSH) { + recv_data->flags |= PBUF_FLAG_PUSH; + } + + /* Notify application that data has been received. */ + TCP_EVENT_RECV(pcb, recv_data, ERR_OK, err); + if (err == ERR_ABRT) { + goto aborted; + } + + /* If the upper layer can't receive this data, store it */ + if (err != ERR_OK) { + pcb->refused_data = recv_data; + LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_input: keep incoming packet, because pcb is \"full\"\n")); + } + } + + /* If a FIN segment was received, we call the callback + function with a NULL buffer to indicate EOF. */ + if (recv_flags & TF_GOT_FIN) { + /* correct rcv_wnd as the application won't call tcp_recved() + for the FIN's seqno */ + if (pcb->rcv_wnd != TCP_WND) { + pcb->rcv_wnd++; + } + TCP_EVENT_CLOSED(pcb, err); + if (err == ERR_ABRT) { + goto aborted; + } + } + + tcp_input_pcb = NULL; + /* Try to send something out. */ + tcp_output(pcb); +#if TCP_INPUT_DEBUG +#if TCP_DEBUG + tcp_debug_print_state(pcb->state); +#endif /* TCP_DEBUG */ +#endif /* TCP_INPUT_DEBUG */ + } + } + /* Jump target if pcb has been aborted in a callback (by calling tcp_abort()). + Below this line, 'pcb' may not be dereferenced! */ +aborted: + tcp_input_pcb = NULL; + recv_data = NULL; + + /* give up our reference to inseg.p */ + if (inseg.p != NULL) + { + pbuf_free(inseg.p); + inseg.p = NULL; + } + } else { + + /* If no matching PCB was found, send a TCP RST (reset) to the + sender. */ + LWIP_DEBUGF(TCP_RST_DEBUG, ("tcp_input: no PCB match found, resetting.\n")); + if (!(TCPH_FLAGS(tcphdr) & TCP_RST)) { + TCP_STATS_INC(tcp.proterr); + TCP_STATS_INC(tcp.drop); + tcp_rst(ackno, seqno + tcplen, + ip_current_dest_addr(), ip_current_src_addr(), + tcphdr->dest, tcphdr->src); + } + pbuf_free(p); + } + + LWIP_ASSERT("tcp_input: tcp_pcbs_sane()", tcp_pcbs_sane()); + PERF_STOP("tcp_input"); +} + +/** + * Called by tcp_input() when a segment arrives for a listening + * connection (from tcp_input()). + * + * @param pcb the tcp_pcb_listen for which a segment arrived + * @return ERR_OK if the segment was processed + * another err_t on error + * + * @note the return value is not (yet?) used in tcp_input() + * @note the segment which arrived is saved in global variables, therefore only the pcb + * involved is passed as a parameter to this function + */ +static err_t +tcp_listen_input(struct tcp_pcb_listen *pcb) +{ + struct tcp_pcb *npcb; + err_t rc; + + /* In the LISTEN state, we check for incoming SYN segments, + creates a new PCB, and responds with a SYN|ACK. */ + if (flags & TCP_ACK) { + /* For incoming segments with the ACK flag set, respond with a + RST. */ + LWIP_DEBUGF(TCP_RST_DEBUG, ("tcp_listen_input: ACK in LISTEN, sending reset\n")); + tcp_rst(ackno + 1, seqno + tcplen, + ip_current_dest_addr(), ip_current_src_addr(), + tcphdr->dest, tcphdr->src); + } else if (flags & TCP_SYN) { + LWIP_DEBUGF(TCP_DEBUG, ("TCP connection request %"U16_F" -> %"U16_F".\n", tcphdr->src, tcphdr->dest)); +#if TCP_LISTEN_BACKLOG + if (pcb->accepts_pending >= pcb->backlog) { + LWIP_DEBUGF(TCP_DEBUG, ("tcp_listen_input: listen backlog exceeded for port %"U16_F"\n", tcphdr->dest)); + return ERR_ABRT; + } +#endif /* TCP_LISTEN_BACKLOG */ + npcb = tcp_alloc(pcb->prio); + /* If a new PCB could not be created (probably due to lack of memory), + we don't do anything, but rely on the sender will retransmit the + SYN at a time when we have more memory available. */ + if (npcb == NULL) { + LWIP_DEBUGF(TCP_DEBUG, ("tcp_listen_input: could not allocate PCB\n")); + TCP_STATS_INC(tcp.memerr); + return ERR_MEM; + } +#if TCP_LISTEN_BACKLOG + pcb->accepts_pending++; +#endif /* TCP_LISTEN_BACKLOG */ + /* Set up the new PCB. */ + ip_addr_copy(npcb->local_ip, current_iphdr_dest); + npcb->local_port = pcb->local_port; + ip_addr_copy(npcb->remote_ip, current_iphdr_src); + npcb->remote_port = tcphdr->src; + npcb->state = SYN_RCVD; + npcb->rcv_nxt = seqno + 1; + npcb->rcv_ann_right_edge = npcb->rcv_nxt; + npcb->snd_wnd = tcphdr->wnd; + npcb->ssthresh = npcb->snd_wnd; + npcb->snd_wl1 = seqno - 1;/* initialise to seqno-1 to force window update */ + npcb->callback_arg = pcb->callback_arg; +#if LWIP_CALLBACK_API + npcb->accept = pcb->accept; +#endif /* LWIP_CALLBACK_API */ + /* inherit socket options */ + npcb->so_options = pcb->so_options & SOF_INHERITED; + /* Register the new PCB so that we can begin receiving segments + for it. */ + TCP_REG(&tcp_active_pcbs, npcb); + + /* Parse any options in the SYN. */ + tcp_parseopt(npcb); +#if TCP_CALCULATE_EFF_SEND_MSS + npcb->mss = tcp_eff_send_mss(npcb->mss, &(npcb->remote_ip)); +#endif /* TCP_CALCULATE_EFF_SEND_MSS */ + + snmp_inc_tcppassiveopens(); + + /* Send a SYN|ACK together with the MSS option. */ + rc = tcp_enqueue_flags(npcb, TCP_SYN | TCP_ACK); + if (rc != ERR_OK) { + tcp_abandon(npcb, 0); + return rc; + } + return tcp_output(npcb); + } + return ERR_OK; +} + +/** + * Called by tcp_input() when a segment arrives for a connection in + * TIME_WAIT. + * + * @param pcb the tcp_pcb for which a segment arrived + * + * @note the segment which arrived is saved in global variables, therefore only the pcb + * involved is passed as a parameter to this function + */ +static err_t +tcp_timewait_input(struct tcp_pcb *pcb) +{ + /* RFC 1337: in TIME_WAIT, ignore RST and ACK FINs + any 'acceptable' segments */ + /* RFC 793 3.9 Event Processing - Segment Arrives: + * - first check sequence number - we skip that one in TIME_WAIT (always + * acceptable since we only send ACKs) + * - second check the RST bit (... return) */ + if (flags & TCP_RST) { + return ERR_OK; + } + /* - fourth, check the SYN bit, */ + if (flags & TCP_SYN) { + /* If an incoming segment is not acceptable, an acknowledgment + should be sent in reply */ + if (TCP_SEQ_BETWEEN(seqno, pcb->rcv_nxt, pcb->rcv_nxt+pcb->rcv_wnd)) { + /* If the SYN is in the window it is an error, send a reset */ + tcp_rst(ackno, seqno + tcplen, ip_current_dest_addr(), ip_current_src_addr(), + tcphdr->dest, tcphdr->src); + return ERR_OK; + } + } else if (flags & TCP_FIN) { + /* - eighth, check the FIN bit: Remain in the TIME-WAIT state. + Restart the 2 MSL time-wait timeout.*/ + pcb->tmr = tcp_ticks; + } + + if ((tcplen > 0)) { + /* Acknowledge data, FIN or out-of-window SYN */ + pcb->flags |= TF_ACK_NOW; + return tcp_output(pcb); + } + return ERR_OK; +} + +/** + * Implements the TCP state machine. Called by tcp_input. In some + * states tcp_receive() is called to receive data. The tcp_seg + * argument will be freed by the caller (tcp_input()) unless the + * recv_data pointer in the pcb is set. + * + * @param pcb the tcp_pcb for which a segment arrived + * + * @note the segment which arrived is saved in global variables, therefore only the pcb + * involved is passed as a parameter to this function + */ +static err_t +tcp_process(struct tcp_pcb *pcb) +{ + struct tcp_seg *rseg; + u8_t acceptable = 0; + err_t err; + + err = ERR_OK; + + /* Process incoming RST segments. */ + if (flags & TCP_RST) { + /* First, determine if the reset is acceptable. */ + if (pcb->state == SYN_SENT) { + if (ackno == pcb->snd_nxt) { + acceptable = 1; + } + } else { + if (TCP_SEQ_BETWEEN(seqno, pcb->rcv_nxt, + pcb->rcv_nxt+pcb->rcv_wnd)) { + acceptable = 1; + } + } + + if (acceptable) { + LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_process: Connection RESET\n")); + LWIP_ASSERT("tcp_input: pcb->state != CLOSED", pcb->state != CLOSED); + recv_flags |= TF_RESET; + pcb->flags &= ~TF_ACK_DELAY; + return ERR_RST; + } else { + LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_process: unacceptable reset seqno %"U32_F" rcv_nxt %"U32_F"\n", + seqno, pcb->rcv_nxt)); + LWIP_DEBUGF(TCP_DEBUG, ("tcp_process: unacceptable reset seqno %"U32_F" rcv_nxt %"U32_F"\n", + seqno, pcb->rcv_nxt)); + return ERR_OK; + } + } + + if ((flags & TCP_SYN) && (pcb->state != SYN_SENT && pcb->state != SYN_RCVD)) { + /* Cope with new connection attempt after remote end crashed */ + tcp_ack_now(pcb); + return ERR_OK; + } + + if ((pcb->flags & TF_RXCLOSED) == 0) { + /* Update the PCB (in)activity timer unless rx is closed (see tcp_shutdown) */ + pcb->tmr = tcp_ticks; + } + pcb->keep_cnt_sent = 0; + + tcp_parseopt(pcb); + + /* Do different things depending on the TCP state. */ + switch (pcb->state) { + case SYN_SENT: + LWIP_DEBUGF(TCP_INPUT_DEBUG, ("SYN-SENT: ackno %"U32_F" pcb->snd_nxt %"U32_F" unacked %"U32_F"\n", ackno, + pcb->snd_nxt, ntohl(pcb->unacked->tcphdr->seqno))); + /* received SYN ACK with expected sequence number? */ + if ((flags & TCP_ACK) && (flags & TCP_SYN) + && ackno == ntohl(pcb->unacked->tcphdr->seqno) + 1) { + pcb->snd_buf++; + pcb->rcv_nxt = seqno + 1; + pcb->rcv_ann_right_edge = pcb->rcv_nxt; + pcb->lastack = ackno; + pcb->snd_wnd = tcphdr->wnd; + pcb->snd_wl1 = seqno - 1; /* initialise to seqno - 1 to force window update */ + pcb->state = ESTABLISHED; + +#if TCP_CALCULATE_EFF_SEND_MSS + pcb->mss = tcp_eff_send_mss(pcb->mss, &(pcb->remote_ip)); +#endif /* TCP_CALCULATE_EFF_SEND_MSS */ + + /* Set ssthresh again after changing pcb->mss (already set in tcp_connect + * but for the default value of pcb->mss) */ + pcb->ssthresh = pcb->mss * 10; + + pcb->cwnd = ((pcb->cwnd == 1) ? (pcb->mss * 2) : pcb->mss); + LWIP_ASSERT("pcb->snd_queuelen > 0", (pcb->snd_queuelen > 0)); + --pcb->snd_queuelen; + LWIP_DEBUGF(TCP_QLEN_DEBUG, ("tcp_process: SYN-SENT --queuelen %"U16_F"\n", (u16_t)pcb->snd_queuelen)); + rseg = pcb->unacked; + pcb->unacked = rseg->next; + + /* If there's nothing left to acknowledge, stop the retransmit + timer, otherwise reset it to start again */ + if(pcb->unacked == NULL) + pcb->rtime = -1; + else { + pcb->rtime = 0; + pcb->nrtx = 0; + } + + tcp_seg_free(rseg); + + /* Call the user specified function to call when sucessfully + * connected. */ + TCP_EVENT_CONNECTED(pcb, ERR_OK, err); + if (err == ERR_ABRT) { + return ERR_ABRT; + } + tcp_ack_now(pcb); + } + /* received ACK? possibly a half-open connection */ + else if (flags & TCP_ACK) { + /* send a RST to bring the other side in a non-synchronized state. */ + tcp_rst(ackno, seqno + tcplen, ip_current_dest_addr(), ip_current_src_addr(), + tcphdr->dest, tcphdr->src); + } + break; + case SYN_RCVD: + if (flags & TCP_ACK) { + /* expected ACK number? */ + if (TCP_SEQ_BETWEEN(ackno, pcb->lastack+1, pcb->snd_nxt)) { + u16_t old_cwnd; + pcb->state = ESTABLISHED; + LWIP_DEBUGF(TCP_DEBUG, ("TCP connection established %"U16_F" -> %"U16_F".\n", inseg.tcphdr->src, inseg.tcphdr->dest)); +#if LWIP_CALLBACK_API + LWIP_ASSERT("pcb->accept != NULL", pcb->accept != NULL); +#endif + /* Call the accept function. */ + TCP_EVENT_ACCEPT(pcb, ERR_OK, err); + if (err != ERR_OK) { + /* If the accept function returns with an error, we abort + * the connection. */ + /* Already aborted? */ + if (err != ERR_ABRT) { + tcp_abort(pcb); + } + return ERR_ABRT; + } + old_cwnd = pcb->cwnd; + /* If there was any data contained within this ACK, + * we'd better pass it on to the application as well. */ + tcp_receive(pcb); + + /* Prevent ACK for SYN to generate a sent event */ + if (pcb->acked != 0) { + pcb->acked--; + } + + pcb->cwnd = ((old_cwnd == 1) ? (pcb->mss * 2) : pcb->mss); + + if (recv_flags & TF_GOT_FIN) { + tcp_ack_now(pcb); + pcb->state = CLOSE_WAIT; + } + } else { + /* incorrect ACK number, send RST */ + tcp_rst(ackno, seqno + tcplen, ip_current_dest_addr(), ip_current_src_addr(), + tcphdr->dest, tcphdr->src); + } + } else if ((flags & TCP_SYN) && (seqno == pcb->rcv_nxt - 1)) { + /* Looks like another copy of the SYN - retransmit our SYN-ACK */ + tcp_rexmit(pcb); + } + break; + case CLOSE_WAIT: + /* FALLTHROUGH */ + case ESTABLISHED: + tcp_receive(pcb); + if (recv_flags & TF_GOT_FIN) { /* passive close */ + tcp_ack_now(pcb); + pcb->state = CLOSE_WAIT; + } + break; + case FIN_WAIT_1: + tcp_receive(pcb); + if (recv_flags & TF_GOT_FIN) { + if ((flags & TCP_ACK) && (ackno == pcb->snd_nxt)) { + LWIP_DEBUGF(TCP_DEBUG, + ("TCP connection closed: FIN_WAIT_1 %"U16_F" -> %"U16_F".\n", inseg.tcphdr->src, inseg.tcphdr->dest)); + tcp_ack_now(pcb); + tcp_pcb_purge(pcb); + TCP_RMV(&tcp_active_pcbs, pcb); + pcb->state = TIME_WAIT; + TCP_REG(&tcp_tw_pcbs, pcb); + } else { + tcp_ack_now(pcb); + pcb->state = CLOSING; + } + } else if ((flags & TCP_ACK) && (ackno == pcb->snd_nxt)) { + pcb->state = FIN_WAIT_2; + } + break; + case FIN_WAIT_2: + tcp_receive(pcb); + if (recv_flags & TF_GOT_FIN) { + LWIP_DEBUGF(TCP_DEBUG, ("TCP connection closed: FIN_WAIT_2 %"U16_F" -> %"U16_F".\n", inseg.tcphdr->src, inseg.tcphdr->dest)); + tcp_ack_now(pcb); + tcp_pcb_purge(pcb); + TCP_RMV(&tcp_active_pcbs, pcb); + pcb->state = TIME_WAIT; + TCP_REG(&tcp_tw_pcbs, pcb); + } + break; + case CLOSING: + tcp_receive(pcb); + if (flags & TCP_ACK && ackno == pcb->snd_nxt) { + LWIP_DEBUGF(TCP_DEBUG, ("TCP connection closed: CLOSING %"U16_F" -> %"U16_F".\n", inseg.tcphdr->src, inseg.tcphdr->dest)); + tcp_pcb_purge(pcb); + TCP_RMV(&tcp_active_pcbs, pcb); + pcb->state = TIME_WAIT; + TCP_REG(&tcp_tw_pcbs, pcb); + } + break; + case LAST_ACK: + tcp_receive(pcb); + if (flags & TCP_ACK && ackno == pcb->snd_nxt) { + LWIP_DEBUGF(TCP_DEBUG, ("TCP connection closed: LAST_ACK %"U16_F" -> %"U16_F".\n", inseg.tcphdr->src, inseg.tcphdr->dest)); + /* bugfix #21699: don't set pcb->state to CLOSED here or we risk leaking segments */ + recv_flags |= TF_CLOSED; + } + break; + default: + break; + } + return ERR_OK; +} + +#if TCP_QUEUE_OOSEQ +/** + * Insert segment into the list (segments covered with new one will be deleted) + * + * Called from tcp_receive() + */ +static void +tcp_oos_insert_segment(struct tcp_seg *cseg, struct tcp_seg *next) +{ + struct tcp_seg *old_seg; + + if (TCPH_FLAGS(cseg->tcphdr) & TCP_FIN) { + /* received segment overlaps all following segments */ + tcp_segs_free(next); + next = NULL; + } + else { + /* delete some following segments + oos queue may have segments with FIN flag */ + while (next && + TCP_SEQ_GEQ((seqno + cseg->len), + (next->tcphdr->seqno + next->len))) { + /* cseg with FIN already processed */ + if (TCPH_FLAGS(next->tcphdr) & TCP_FIN) { + TCPH_SET_FLAG(cseg->tcphdr, TCP_FIN); + } + old_seg = next; + next = next->next; + tcp_seg_free(old_seg); + } + if (next && + TCP_SEQ_GT(seqno + cseg->len, next->tcphdr->seqno)) { + /* We need to trim the incoming segment. */ + cseg->len = (u16_t)(next->tcphdr->seqno - seqno); + pbuf_realloc(cseg->p, cseg->len); + } + } + cseg->next = next; +} +#endif /* TCP_QUEUE_OOSEQ */ + +/** + * Called by tcp_process. Checks if the given segment is an ACK for outstanding + * data, and if so frees the memory of the buffered data. Next, is places the + * segment on any of the receive queues (pcb->recved or pcb->ooseq). If the segment + * is buffered, the pbuf is referenced by pbuf_ref so that it will not be freed until + * i it has been removed from the buffer. + * + * If the incoming segment constitutes an ACK for a segment that was used for RTT + * estimation, the RTT is estimated here as well. + * + * Called from tcp_process(). + */ +static void +tcp_receive(struct tcp_pcb *pcb) +{ + struct tcp_seg *next; +#if TCP_QUEUE_OOSEQ + struct tcp_seg *prev, *cseg; +#endif /* TCP_QUEUE_OOSEQ */ + struct pbuf *p; + s32_t off; + s16_t m; + u32_t right_wnd_edge; + u16_t new_tot_len; + int found_dupack = 0; + + if (flags & TCP_ACK) { + right_wnd_edge = pcb->snd_wnd + pcb->snd_wl2; + + /* Update window. */ + if (TCP_SEQ_LT(pcb->snd_wl1, seqno) || + (pcb->snd_wl1 == seqno && TCP_SEQ_LT(pcb->snd_wl2, ackno)) || + (pcb->snd_wl2 == ackno && tcphdr->wnd > pcb->snd_wnd)) { + pcb->snd_wnd = tcphdr->wnd; + pcb->snd_wl1 = seqno; + pcb->snd_wl2 = ackno; + if (pcb->snd_wnd > 0 && pcb->persist_backoff > 0) { + pcb->persist_backoff = 0; + } + LWIP_DEBUGF(TCP_WND_DEBUG, ("tcp_receive: window update %"U16_F"\n", pcb->snd_wnd)); +#if TCP_WND_DEBUG + } else { + if (pcb->snd_wnd != tcphdr->wnd) { + LWIP_DEBUGF(TCP_WND_DEBUG, + ("tcp_receive: no window update lastack %"U32_F" ackno %" + U32_F" wl1 %"U32_F" seqno %"U32_F" wl2 %"U32_F"\n", + pcb->lastack, ackno, pcb->snd_wl1, seqno, pcb->snd_wl2)); + } +#endif /* TCP_WND_DEBUG */ + } + + /* (From Stevens TCP/IP Illustrated Vol II, p970.) Its only a + * duplicate ack if: + * 1) It doesn't ACK new data + * 2) length of received packet is zero (i.e. no payload) + * 3) the advertised window hasn't changed + * 4) There is outstanding unacknowledged data (retransmission timer running) + * 5) The ACK is == biggest ACK sequence number so far seen (snd_una) + * + * If it passes all five, should process as a dupack: + * a) dupacks < 3: do nothing + * b) dupacks == 3: fast retransmit + * c) dupacks > 3: increase cwnd + * + * If it only passes 1-3, should reset dupack counter (and add to + * stats, which we don't do in lwIP) + * + * If it only passes 1, should reset dupack counter + * + */ + + /* Clause 1 */ + if (TCP_SEQ_LEQ(ackno, pcb->lastack)) { + pcb->acked = 0; + /* Clause 2 */ + if (tcplen == 0) { + /* Clause 3 */ + if (pcb->snd_wl2 + pcb->snd_wnd == right_wnd_edge){ + /* Clause 4 */ + if (pcb->rtime >= 0) { + /* Clause 5 */ + if (pcb->lastack == ackno) { + found_dupack = 1; + if (pcb->dupacks + 1 > pcb->dupacks) + ++pcb->dupacks; + if (pcb->dupacks > 3) { + /* Inflate the congestion window, but not if it means that + the value overflows. */ + if ((u16_t)(pcb->cwnd + pcb->mss) > pcb->cwnd) { + pcb->cwnd += pcb->mss; + } + } else if (pcb->dupacks == 3) { + /* Do fast retransmit */ + tcp_rexmit_fast(pcb); + } + } + } + } + } + /* If Clause (1) or more is true, but not a duplicate ack, reset + * count of consecutive duplicate acks */ + if (!found_dupack) { + pcb->dupacks = 0; + } + } else if (TCP_SEQ_BETWEEN(ackno, pcb->lastack+1, pcb->snd_nxt)){ + /* We come here when the ACK acknowledges new data. */ + + /* Reset the "IN Fast Retransmit" flag, since we are no longer + in fast retransmit. Also reset the congestion window to the + slow start threshold. */ + if (pcb->flags & TF_INFR) { + pcb->flags &= ~TF_INFR; + pcb->cwnd = pcb->ssthresh; + } + + /* Reset the number of retransmissions. */ + pcb->nrtx = 0; + + /* Reset the retransmission time-out. */ + pcb->rto = (pcb->sa >> 3) + pcb->sv; + + /* Update the send buffer space. Diff between the two can never exceed 64K? */ + pcb->acked = (u16_t)(ackno - pcb->lastack); + + pcb->snd_buf += pcb->acked; + + /* Reset the fast retransmit variables. */ + pcb->dupacks = 0; + pcb->lastack = ackno; + + /* Update the congestion control variables (cwnd and + ssthresh). */ + if (pcb->state >= ESTABLISHED) { + if (pcb->cwnd < pcb->ssthresh) { + if ((u16_t)(pcb->cwnd + pcb->mss) > pcb->cwnd) { + pcb->cwnd += pcb->mss; + } + LWIP_DEBUGF(TCP_CWND_DEBUG, ("tcp_receive: slow start cwnd %"U16_F"\n", pcb->cwnd)); + } else { + u16_t new_cwnd = (pcb->cwnd + pcb->mss * pcb->mss / pcb->cwnd); + if (new_cwnd > pcb->cwnd) { + pcb->cwnd = new_cwnd; + } + LWIP_DEBUGF(TCP_CWND_DEBUG, ("tcp_receive: congestion avoidance cwnd %"U16_F"\n", pcb->cwnd)); + } + } + LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_receive: ACK for %"U32_F", unacked->seqno %"U32_F":%"U32_F"\n", + ackno, + pcb->unacked != NULL? + ntohl(pcb->unacked->tcphdr->seqno): 0, + pcb->unacked != NULL? + ntohl(pcb->unacked->tcphdr->seqno) + TCP_TCPLEN(pcb->unacked): 0)); + + /* Remove segment from the unacknowledged list if the incoming + ACK acknowlegdes them. */ + while (pcb->unacked != NULL && + TCP_SEQ_LEQ(ntohl(pcb->unacked->tcphdr->seqno) + + TCP_TCPLEN(pcb->unacked), ackno)) { + LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_receive: removing %"U32_F":%"U32_F" from pcb->unacked\n", + ntohl(pcb->unacked->tcphdr->seqno), + ntohl(pcb->unacked->tcphdr->seqno) + + TCP_TCPLEN(pcb->unacked))); + + next = pcb->unacked; + pcb->unacked = pcb->unacked->next; + + LWIP_DEBUGF(TCP_QLEN_DEBUG, ("tcp_receive: queuelen %"U16_F" ... ", (u16_t)pcb->snd_queuelen)); + LWIP_ASSERT("pcb->snd_queuelen >= pbuf_clen(next->p)", (pcb->snd_queuelen >= pbuf_clen(next->p))); + /* Prevent ACK for FIN to generate a sent event */ + if ((pcb->acked != 0) && ((TCPH_FLAGS(next->tcphdr) & TCP_FIN) != 0)) { + pcb->acked--; + } + + pcb->snd_queuelen -= pbuf_clen(next->p); + tcp_seg_free(next); + + LWIP_DEBUGF(TCP_QLEN_DEBUG, ("%"U16_F" (after freeing unacked)\n", (u16_t)pcb->snd_queuelen)); + if (pcb->snd_queuelen != 0) { + LWIP_ASSERT("tcp_receive: valid queue length", pcb->unacked != NULL || + pcb->unsent != NULL); + } + } + + /* If there's nothing left to acknowledge, stop the retransmit + timer, otherwise reset it to start again */ + if(pcb->unacked == NULL) + pcb->rtime = -1; + else + pcb->rtime = 0; + + pcb->polltmr = 0; + } else { + /* Fix bug bug #21582: out of sequence ACK, didn't really ack anything */ + pcb->acked = 0; + } + + /* We go through the ->unsent list to see if any of the segments + on the list are acknowledged by the ACK. This may seem + strange since an "unsent" segment shouldn't be acked. The + rationale is that lwIP puts all outstanding segments on the + ->unsent list after a retransmission, so these segments may + in fact have been sent once. */ + while (pcb->unsent != NULL && + TCP_SEQ_BETWEEN(ackno, ntohl(pcb->unsent->tcphdr->seqno) + + TCP_TCPLEN(pcb->unsent), pcb->snd_nxt)) { + LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_receive: removing %"U32_F":%"U32_F" from pcb->unsent\n", + ntohl(pcb->unsent->tcphdr->seqno), ntohl(pcb->unsent->tcphdr->seqno) + + TCP_TCPLEN(pcb->unsent))); + + next = pcb->unsent; + pcb->unsent = pcb->unsent->next; + LWIP_DEBUGF(TCP_QLEN_DEBUG, ("tcp_receive: queuelen %"U16_F" ... ", (u16_t)pcb->snd_queuelen)); + LWIP_ASSERT("pcb->snd_queuelen >= pbuf_clen(next->p)", (pcb->snd_queuelen >= pbuf_clen(next->p))); + /* Prevent ACK for FIN to generate a sent event */ + if ((pcb->acked != 0) && ((TCPH_FLAGS(next->tcphdr) & TCP_FIN) != 0)) { + pcb->acked--; + } + pcb->snd_queuelen -= pbuf_clen(next->p); + tcp_seg_free(next); + LWIP_DEBUGF(TCP_QLEN_DEBUG, ("%"U16_F" (after freeing unsent)\n", (u16_t)pcb->snd_queuelen)); + if (pcb->snd_queuelen != 0) { + LWIP_ASSERT("tcp_receive: valid queue length", + pcb->unacked != NULL || pcb->unsent != NULL); + } + } + /* End of ACK for new data processing. */ + + LWIP_DEBUGF(TCP_RTO_DEBUG, ("tcp_receive: pcb->rttest %"U32_F" rtseq %"U32_F" ackno %"U32_F"\n", + pcb->rttest, pcb->rtseq, ackno)); + + /* RTT estimation calculations. This is done by checking if the + incoming segment acknowledges the segment we use to take a + round-trip time measurement. */ + if (pcb->rttest && TCP_SEQ_LT(pcb->rtseq, ackno)) { + /* diff between this shouldn't exceed 32K since this are tcp timer ticks + and a round-trip shouldn't be that long... */ + m = (s16_t)(tcp_ticks - pcb->rttest); + + LWIP_DEBUGF(TCP_RTO_DEBUG, ("tcp_receive: experienced rtt %"U16_F" ticks (%"U16_F" msec).\n", + m, m * TCP_SLOW_INTERVAL)); + + /* This is taken directly from VJs original code in his paper */ + m = m - (pcb->sa >> 3); + pcb->sa += m; + if (m < 0) { + m = -m; + } + m = m - (pcb->sv >> 2); + pcb->sv += m; + pcb->rto = (pcb->sa >> 3) + pcb->sv; + + LWIP_DEBUGF(TCP_RTO_DEBUG, ("tcp_receive: RTO %"U16_F" (%"U16_F" milliseconds)\n", + pcb->rto, pcb->rto * TCP_SLOW_INTERVAL)); + + pcb->rttest = 0; + } + } + + /* If the incoming segment contains data, we must process it + further. */ + if (tcplen > 0) { + /* This code basically does three things: + + +) If the incoming segment contains data that is the next + in-sequence data, this data is passed to the application. This + might involve trimming the first edge of the data. The rcv_nxt + variable and the advertised window are adjusted. + + +) If the incoming segment has data that is above the next + sequence number expected (->rcv_nxt), the segment is placed on + the ->ooseq queue. This is done by finding the appropriate + place in the ->ooseq queue (which is ordered by sequence + number) and trim the segment in both ends if needed. An + immediate ACK is sent to indicate that we received an + out-of-sequence segment. + + +) Finally, we check if the first segment on the ->ooseq queue + now is in sequence (i.e., if rcv_nxt >= ooseq->seqno). If + rcv_nxt > ooseq->seqno, we must trim the first edge of the + segment on ->ooseq before we adjust rcv_nxt. The data in the + segments that are now on sequence are chained onto the + incoming segment so that we only need to call the application + once. + */ + + /* First, we check if we must trim the first edge. We have to do + this if the sequence number of the incoming segment is less + than rcv_nxt, and the sequence number plus the length of the + segment is larger than rcv_nxt. */ + /* if (TCP_SEQ_LT(seqno, pcb->rcv_nxt)){ + if (TCP_SEQ_LT(pcb->rcv_nxt, seqno + tcplen)) {*/ + if (TCP_SEQ_BETWEEN(pcb->rcv_nxt, seqno + 1, seqno + tcplen - 1)){ + /* Trimming the first edge is done by pushing the payload + pointer in the pbuf downwards. This is somewhat tricky since + we do not want to discard the full contents of the pbuf up to + the new starting point of the data since we have to keep the + TCP header which is present in the first pbuf in the chain. + + What is done is really quite a nasty hack: the first pbuf in + the pbuf chain is pointed to by inseg.p. Since we need to be + able to deallocate the whole pbuf, we cannot change this + inseg.p pointer to point to any of the later pbufs in the + chain. Instead, we point the ->payload pointer in the first + pbuf to data in one of the later pbufs. We also set the + inseg.data pointer to point to the right place. This way, the + ->p pointer will still point to the first pbuf, but the + ->p->payload pointer will point to data in another pbuf. + + After we are done with adjusting the pbuf pointers we must + adjust the ->data pointer in the seg and the segment + length.*/ + + off = pcb->rcv_nxt - seqno; + p = inseg.p; + LWIP_ASSERT("inseg.p != NULL", inseg.p); + LWIP_ASSERT("insane offset!", (off < 0x7fff)); + if (inseg.p->len < off) { + LWIP_ASSERT("pbuf too short!", (((s32_t)inseg.p->tot_len) >= off)); + new_tot_len = (u16_t)(inseg.p->tot_len - off); + while (p->len < off) { + off -= p->len; + /* KJM following line changed (with addition of new_tot_len var) + to fix bug #9076 + inseg.p->tot_len -= p->len; */ + p->tot_len = new_tot_len; + p->len = 0; + p = p->next; + } + if(pbuf_header(p, (s16_t)-off)) { + /* Do we need to cope with this failing? Assert for now */ + LWIP_ASSERT("pbuf_header failed", 0); + } + } else { + if(pbuf_header(inseg.p, (s16_t)-off)) { + /* Do we need to cope with this failing? Assert for now */ + LWIP_ASSERT("pbuf_header failed", 0); + } + } + inseg.len -= (u16_t)(pcb->rcv_nxt - seqno); + inseg.tcphdr->seqno = seqno = pcb->rcv_nxt; + } + else { + if (TCP_SEQ_LT(seqno, pcb->rcv_nxt)){ + /* the whole segment is < rcv_nxt */ + /* must be a duplicate of a packet that has already been correctly handled */ + + LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_receive: duplicate seqno %"U32_F"\n", seqno)); + tcp_ack_now(pcb); + } + } + + /* The sequence number must be within the window (above rcv_nxt + and below rcv_nxt + rcv_wnd) in order to be further + processed. */ + if (TCP_SEQ_BETWEEN(seqno, pcb->rcv_nxt, + pcb->rcv_nxt + pcb->rcv_wnd - 1)){ + if (pcb->rcv_nxt == seqno) { + /* The incoming segment is the next in sequence. We check if + we have to trim the end of the segment and update rcv_nxt + and pass the data to the application. */ + tcplen = TCP_TCPLEN(&inseg); + + if (tcplen > pcb->rcv_wnd) { + LWIP_DEBUGF(TCP_INPUT_DEBUG, + ("tcp_receive: other end overran receive window" + "seqno %"U32_F" len %"U16_F" right edge %"U32_F"\n", + seqno, tcplen, pcb->rcv_nxt + pcb->rcv_wnd)); + if (TCPH_FLAGS(inseg.tcphdr) & TCP_FIN) { + /* Must remove the FIN from the header as we're trimming + * that byte of sequence-space from the packet */ + TCPH_FLAGS_SET(inseg.tcphdr, TCPH_FLAGS(inseg.tcphdr) &~ TCP_FIN); + } + /* Adjust length of segment to fit in the window. */ + inseg.len = pcb->rcv_wnd; + if (TCPH_FLAGS(inseg.tcphdr) & TCP_SYN) { + inseg.len -= 1; + } + pbuf_realloc(inseg.p, inseg.len); + tcplen = TCP_TCPLEN(&inseg); + LWIP_ASSERT("tcp_receive: segment not trimmed correctly to rcv_wnd\n", + (seqno + tcplen) == (pcb->rcv_nxt + pcb->rcv_wnd)); + } +#if TCP_QUEUE_OOSEQ + /* Received in-sequence data, adjust ooseq data if: + - FIN has been received or + - inseq overlaps with ooseq */ + if (pcb->ooseq != NULL) { + if (TCPH_FLAGS(inseg.tcphdr) & TCP_FIN) { + LWIP_DEBUGF(TCP_INPUT_DEBUG, + ("tcp_receive: received in-order FIN, binning ooseq queue\n")); + /* Received in-order FIN means anything that was received + * out of order must now have been received in-order, so + * bin the ooseq queue */ + while (pcb->ooseq != NULL) { + struct tcp_seg *old_ooseq = pcb->ooseq; + pcb->ooseq = pcb->ooseq->next; + tcp_seg_free(old_ooseq); + } + } + else { + next = pcb->ooseq; + /* Remove all segments on ooseq that are covered by inseg already. + * FIN is copied from ooseq to inseg if present. */ + while (next && + TCP_SEQ_GEQ(seqno + tcplen, + next->tcphdr->seqno + next->len)) { + /* inseg cannot have FIN here (already processed above) */ + if (TCPH_FLAGS(next->tcphdr) & TCP_FIN && + (TCPH_FLAGS(inseg.tcphdr) & TCP_SYN) == 0) { + TCPH_SET_FLAG(inseg.tcphdr, TCP_FIN); + tcplen = TCP_TCPLEN(&inseg); + } + prev = next; + next = next->next; + tcp_seg_free(prev); + } + /* Now trim right side of inseg if it overlaps with the first + * segment on ooseq */ + if (next && + TCP_SEQ_GT(seqno + tcplen, + next->tcphdr->seqno)) { + /* inseg cannot have FIN here (already processed above) */ + inseg.len = (u16_t)(next->tcphdr->seqno - seqno); + if (TCPH_FLAGS(inseg.tcphdr) & TCP_SYN) { + inseg.len -= 1; + } + pbuf_realloc(inseg.p, inseg.len); + tcplen = TCP_TCPLEN(&inseg); + LWIP_ASSERT("tcp_receive: segment not trimmed correctly to ooseq queue\n", + (seqno + tcplen) == next->tcphdr->seqno); + } + pcb->ooseq = next; + } + } +#endif /* TCP_QUEUE_OOSEQ */ + + pcb->rcv_nxt = seqno + tcplen; + + /* Update the receiver's (our) window. */ + LWIP_ASSERT("tcp_receive: tcplen > rcv_wnd\n", pcb->rcv_wnd >= tcplen); + pcb->rcv_wnd -= tcplen; + + tcp_update_rcv_ann_wnd(pcb); + + /* If there is data in the segment, we make preparations to + pass this up to the application. The ->recv_data variable + is used for holding the pbuf that goes to the + application. The code for reassembling out-of-sequence data + chains its data on this pbuf as well. + + If the segment was a FIN, we set the TF_GOT_FIN flag that will + be used to indicate to the application that the remote side has + closed its end of the connection. */ + if (inseg.p->tot_len > 0) { + recv_data = inseg.p; + /* Since this pbuf now is the responsibility of the + application, we delete our reference to it so that we won't + (mistakingly) deallocate it. */ + inseg.p = NULL; + } + if (TCPH_FLAGS(inseg.tcphdr) & TCP_FIN) { + LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_receive: received FIN.\n")); + recv_flags |= TF_GOT_FIN; + } + +#if TCP_QUEUE_OOSEQ + /* We now check if we have segments on the ->ooseq queue that + are now in sequence. */ + while (pcb->ooseq != NULL && + pcb->ooseq->tcphdr->seqno == pcb->rcv_nxt) { + + cseg = pcb->ooseq; + seqno = pcb->ooseq->tcphdr->seqno; + + pcb->rcv_nxt += TCP_TCPLEN(cseg); + LWIP_ASSERT("tcp_receive: ooseq tcplen > rcv_wnd\n", + pcb->rcv_wnd >= TCP_TCPLEN(cseg)); + pcb->rcv_wnd -= TCP_TCPLEN(cseg); + + tcp_update_rcv_ann_wnd(pcb); + + if (cseg->p->tot_len > 0) { + /* Chain this pbuf onto the pbuf that we will pass to + the application. */ + if (recv_data) { + pbuf_cat(recv_data, cseg->p); + } else { + recv_data = cseg->p; + } + cseg->p = NULL; + } + if (TCPH_FLAGS(cseg->tcphdr) & TCP_FIN) { + LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_receive: dequeued FIN.\n")); + recv_flags |= TF_GOT_FIN; + if (pcb->state == ESTABLISHED) { /* force passive close or we can move to active close */ + pcb->state = CLOSE_WAIT; + } + } + + pcb->ooseq = cseg->next; + tcp_seg_free(cseg); + } +#endif /* TCP_QUEUE_OOSEQ */ + + + /* Acknowledge the segment(s). */ + tcp_ack(pcb); + + } else { + /* We get here if the incoming segment is out-of-sequence. */ + tcp_send_empty_ack(pcb); +#if TCP_QUEUE_OOSEQ + /* We queue the segment on the ->ooseq queue. */ + if (pcb->ooseq == NULL) { + pcb->ooseq = tcp_seg_copy(&inseg); + } else { + /* If the queue is not empty, we walk through the queue and + try to find a place where the sequence number of the + incoming segment is between the sequence numbers of the + previous and the next segment on the ->ooseq queue. That is + the place where we put the incoming segment. If needed, we + trim the second edges of the previous and the incoming + segment so that it will fit into the sequence. + + If the incoming segment has the same sequence number as a + segment on the ->ooseq queue, we discard the segment that + contains less data. */ + + prev = NULL; + for(next = pcb->ooseq; next != NULL; next = next->next) { + if (seqno == next->tcphdr->seqno) { + /* The sequence number of the incoming segment is the + same as the sequence number of the segment on + ->ooseq. We check the lengths to see which one to + discard. */ + if (inseg.len > next->len) { + /* The incoming segment is larger than the old + segment. We replace some segments with the new + one. */ + cseg = tcp_seg_copy(&inseg); + if (cseg != NULL) { + if (prev != NULL) { + prev->next = cseg; + } else { + pcb->ooseq = cseg; + } + tcp_oos_insert_segment(cseg, next); + } + break; + } else { + /* Either the lenghts are the same or the incoming + segment was smaller than the old one; in either + case, we ditch the incoming segment. */ + break; + } + } else { + if (prev == NULL) { + if (TCP_SEQ_LT(seqno, next->tcphdr->seqno)) { + /* The sequence number of the incoming segment is lower + than the sequence number of the first segment on the + queue. We put the incoming segment first on the + queue. */ + cseg = tcp_seg_copy(&inseg); + if (cseg != NULL) { + pcb->ooseq = cseg; + tcp_oos_insert_segment(cseg, next); + } + break; + } + } else { + /*if (TCP_SEQ_LT(prev->tcphdr->seqno, seqno) && + TCP_SEQ_LT(seqno, next->tcphdr->seqno)) {*/ + if (TCP_SEQ_BETWEEN(seqno, prev->tcphdr->seqno+1, next->tcphdr->seqno-1)) { + /* The sequence number of the incoming segment is in + between the sequence numbers of the previous and + the next segment on ->ooseq. We trim trim the previous + segment, delete next segments that included in received segment + and trim received, if needed. */ + cseg = tcp_seg_copy(&inseg); + if (cseg != NULL) { + if (TCP_SEQ_GT(prev->tcphdr->seqno + prev->len, seqno)) { + /* We need to trim the prev segment. */ + prev->len = (u16_t)(seqno - prev->tcphdr->seqno); + pbuf_realloc(prev->p, prev->len); + } + prev->next = cseg; + tcp_oos_insert_segment(cseg, next); + } + break; + } + } + /* If the "next" segment is the last segment on the + ooseq queue, we add the incoming segment to the end + of the list. */ + if (next->next == NULL && + TCP_SEQ_GT(seqno, next->tcphdr->seqno)) { + if (TCPH_FLAGS(next->tcphdr) & TCP_FIN) { + /* segment "next" already contains all data */ + break; + } + next->next = tcp_seg_copy(&inseg); + if (next->next != NULL) { + if (TCP_SEQ_GT(next->tcphdr->seqno + next->len, seqno)) { + /* We need to trim the last segment. */ + next->len = (u16_t)(seqno - next->tcphdr->seqno); + pbuf_realloc(next->p, next->len); + } + /* check if the remote side overruns our receive window */ + if ((u32_t)tcplen + seqno > pcb->rcv_nxt + (u32_t)pcb->rcv_wnd) { + LWIP_DEBUGF(TCP_INPUT_DEBUG, + ("tcp_receive: other end overran receive window" + "seqno %"U32_F" len %"U16_F" right edge %"U32_F"\n", + seqno, tcplen, pcb->rcv_nxt + pcb->rcv_wnd)); + if (TCPH_FLAGS(next->next->tcphdr) & TCP_FIN) { + /* Must remove the FIN from the header as we're trimming + * that byte of sequence-space from the packet */ + TCPH_FLAGS_SET(next->next->tcphdr, TCPH_FLAGS(next->next->tcphdr) &~ TCP_FIN); + } + /* Adjust length of segment to fit in the window. */ + next->next->len = pcb->rcv_nxt + pcb->rcv_wnd - seqno; + pbuf_realloc(next->next->p, next->next->len); + tcplen = TCP_TCPLEN(next->next); + LWIP_ASSERT("tcp_receive: segment not trimmed correctly to rcv_wnd\n", + (seqno + tcplen) == (pcb->rcv_nxt + pcb->rcv_wnd)); + } + } + break; + } + } + prev = next; + } + } +#endif /* TCP_QUEUE_OOSEQ */ + + } + } else { + /* The incoming segment is not withing the window. */ + tcp_send_empty_ack(pcb); + } + } else { + /* Segments with length 0 is taken care of here. Segments that + fall out of the window are ACKed. */ + /*if (TCP_SEQ_GT(pcb->rcv_nxt, seqno) || + TCP_SEQ_GEQ(seqno, pcb->rcv_nxt + pcb->rcv_wnd)) {*/ + if(!TCP_SEQ_BETWEEN(seqno, pcb->rcv_nxt, pcb->rcv_nxt + pcb->rcv_wnd-1)){ + tcp_ack_now(pcb); + } + } +} + +/** + * Parses the options contained in the incoming segment. + * + * Called from tcp_listen_input() and tcp_process(). + * Currently, only the MSS option is supported! + * + * @param pcb the tcp_pcb for which a segment arrived + */ +static void +tcp_parseopt(struct tcp_pcb *pcb) +{ + u16_t c, max_c; + u16_t mss; + u8_t *opts, opt; +#if LWIP_TCP_TIMESTAMPS + u32_t tsval; +#endif + + opts = (u8_t *)tcphdr + TCP_HLEN; + + /* Parse the TCP MSS option, if present. */ + if(TCPH_HDRLEN(tcphdr) > 0x5) { + max_c = (TCPH_HDRLEN(tcphdr) - 5) << 2; + for (c = 0; c < max_c; ) { + opt = opts[c]; + switch (opt) { + case 0x00: + /* End of options. */ + LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_parseopt: EOL\n")); + return; + case 0x01: + /* NOP option. */ + ++c; + LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_parseopt: NOP\n")); + break; + case 0x02: + LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_parseopt: MSS\n")); + if (opts[c + 1] != 0x04 || c + 0x04 > max_c) { + /* Bad length */ + LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_parseopt: bad length\n")); + return; + } + /* An MSS option with the right option length. */ + mss = (opts[c + 2] << 8) | opts[c + 3]; + /* Limit the mss to the configured TCP_MSS and prevent division by zero */ + pcb->mss = ((mss > TCP_MSS) || (mss == 0)) ? TCP_MSS : mss; + /* Advance to next option */ + c += 0x04; + break; +#if LWIP_TCP_TIMESTAMPS + case 0x08: + LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_parseopt: TS\n")); + if (opts[c + 1] != 0x0A || c + 0x0A > max_c) { + /* Bad length */ + LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_parseopt: bad length\n")); + return; + } + /* TCP timestamp option with valid length */ + tsval = (opts[c+2]) | (opts[c+3] << 8) | + (opts[c+4] << 16) | (opts[c+5] << 24); + if (flags & TCP_SYN) { + pcb->ts_recent = ntohl(tsval); + pcb->flags |= TF_TIMESTAMP; + } else if (TCP_SEQ_BETWEEN(pcb->ts_lastacksent, seqno, seqno+tcplen)) { + pcb->ts_recent = ntohl(tsval); + } + /* Advance to next option */ + c += 0x0A; + break; +#endif + default: + LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_parseopt: other\n")); + if (opts[c + 1] == 0) { + LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_parseopt: bad length\n")); + /* If the length field is zero, the options are malformed + and we don't process them further. */ + return; + } + /* All other options have a length field, so that we easily + can skip past them. */ + c += opts[c + 1]; + } + } + } +} + +#endif /* LWIP_TCP */ diff --git a/lib/drivers/lwip/src/core/tcp_out.c b/lib/drivers/lwip/src/core/tcp_out.c new file mode 100644 index 00000000000..83f7ec01583 --- /dev/null +++ b/lib/drivers/lwip/src/core/tcp_out.c @@ -0,0 +1,1469 @@ +/** + * @file + * Transmission Control Protocol, outgoing traffic + * + * The output functions of TCP. + * + */ + +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ + +#include "lwip/opt.h" + +#if LWIP_TCP /* don't build if not configured for use in lwipopts.h */ + +#include "lwip/tcp_impl.h" +#include "lwip/def.h" +#include "lwip/mem.h" +#include "lwip/memp.h" +#include "lwip/sys.h" +#include "lwip/ip_addr.h" +#include "lwip/netif.h" +#include "lwip/inet_chksum.h" +#include "lwip/stats.h" +#include "lwip/snmp.h" + +#include + +/* Define some copy-macros for checksum-on-copy so that the code looks + nicer by preventing too many ifdef's. */ +#if TCP_CHECKSUM_ON_COPY +#define TCP_DATA_COPY(dst, src, len, seg) do { \ + tcp_seg_add_chksum(LWIP_CHKSUM_COPY(dst, src, len), \ + len, &seg->chksum, &seg->chksum_swapped); \ + seg->flags |= TF_SEG_DATA_CHECKSUMMED; } while(0) +#define TCP_DATA_COPY2(dst, src, len, chksum, chksum_swapped) \ + tcp_seg_add_chksum(LWIP_CHKSUM_COPY(dst, src, len), len, chksum, chksum_swapped); +#else /* TCP_CHECKSUM_ON_COPY*/ +#define TCP_DATA_COPY(dst, src, len, seg) MEMCPY(dst, src, len) +#define TCP_DATA_COPY2(dst, src, len, chksum, chksum_swapped) MEMCPY(dst, src, len) +#endif /* TCP_CHECKSUM_ON_COPY*/ + +/** Define this to 1 for an extra check that the output checksum is valid + * (usefule when the checksum is generated by the application, not the stack) */ +#ifndef TCP_CHECKSUM_ON_COPY_SANITY_CHECK +#define TCP_CHECKSUM_ON_COPY_SANITY_CHECK 0 +#endif + +/* Forward declarations.*/ +static void tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb); + +/** Allocate a pbuf and create a tcphdr at p->payload, used for output + * functions other than the default tcp_output -> tcp_output_segment + * (e.g. tcp_send_empty_ack, etc.) + * + * @param pcb tcp pcb for which to send a packet (used to initialize tcp_hdr) + * @param optlen length of header-options + * @param datalen length of tcp data to reserve in pbuf + * @param seqno_be seqno in network byte order (big-endian) + * @return pbuf with p->payload being the tcp_hdr + */ +static struct pbuf * +tcp_output_alloc_header(struct tcp_pcb *pcb, u16_t optlen, u16_t datalen, + u32_t seqno_be /* already in network byte order */) +{ + struct tcp_hdr *tcphdr; + struct pbuf *p = pbuf_alloc(PBUF_IP, TCP_HLEN + optlen + datalen, PBUF_RAM); + if (p != NULL) { + LWIP_ASSERT("check that first pbuf can hold struct tcp_hdr", + (p->len >= TCP_HLEN + optlen)); + tcphdr = (struct tcp_hdr *)p->payload; + tcphdr->src = htons(pcb->local_port); + tcphdr->dest = htons(pcb->remote_port); + tcphdr->seqno = seqno_be; + tcphdr->ackno = htonl(pcb->rcv_nxt); + TCPH_HDRLEN_FLAGS_SET(tcphdr, (5 + optlen / 4), TCP_ACK); + tcphdr->wnd = htons(pcb->rcv_ann_wnd); + tcphdr->chksum = 0; + tcphdr->urgp = 0; + + /* If we're sending a packet, update the announced right window edge */ + pcb->rcv_ann_right_edge = pcb->rcv_nxt + pcb->rcv_ann_wnd; + } + return p; +} + +/** + * Called by tcp_close() to send a segment including FIN flag but not data. + * + * @param pcb the tcp_pcb over which to send a segment + * @return ERR_OK if sent, another err_t otherwise + */ +err_t +tcp_send_fin(struct tcp_pcb *pcb) +{ + /* first, try to add the fin to the last unsent segment */ + if (pcb->unsent != NULL) { + struct tcp_seg *last_unsent; + for (last_unsent = pcb->unsent; last_unsent->next != NULL; + last_unsent = last_unsent->next); + + if ((TCPH_FLAGS(last_unsent->tcphdr) & (TCP_SYN | TCP_FIN | TCP_RST)) == 0) { + /* no SYN/FIN/RST flag in the header, we can add the FIN flag */ + TCPH_SET_FLAG(last_unsent->tcphdr, TCP_FIN); + pcb->flags |= TF_FIN; + return ERR_OK; + } + } + /* no data, no length, flags, copy=1, no optdata */ + return tcp_enqueue_flags(pcb, TCP_FIN); +} + +/** + * Create a TCP segment with prefilled header. + * + * Called by tcp_write and tcp_enqueue_flags. + * + * @param pcb Protocol control block for the TCP connection. + * @param p pbuf that is used to hold the TCP header. + * @param flags TCP flags for header. + * @param seqno TCP sequence number of this packet + * @param optflags options to include in TCP header + * @return a new tcp_seg pointing to p, or NULL. + * The TCP header is filled in except ackno and wnd. + * p is freed on failure. + */ +static struct tcp_seg * +tcp_create_segment(struct tcp_pcb *pcb, struct pbuf *p, u8_t flags, u32_t seqno, u8_t optflags) +{ + struct tcp_seg *seg; + u8_t optlen = LWIP_TCP_OPT_LENGTH(optflags); + + if ((seg = (struct tcp_seg *)memp_malloc(MEMP_TCP_SEG)) == NULL) { + LWIP_DEBUGF(TCP_OUTPUT_DEBUG | 2, ("tcp_create_segment: no memory.\n")); + pbuf_free(p); + return NULL; + } + seg->flags = optflags; + seg->next = NULL; + seg->p = p; + seg->len = p->tot_len - optlen; +#if TCP_OVERSIZE_DBGCHECK + seg->oversize_left = 0; +#endif /* TCP_OVERSIZE_DBGCHECK */ +#if TCP_CHECKSUM_ON_COPY + seg->chksum = 0; + seg->chksum_swapped = 0; + /* check optflags */ + LWIP_ASSERT("invalid optflags passed: TF_SEG_DATA_CHECKSUMMED", + (optflags & TF_SEG_DATA_CHECKSUMMED) == 0); +#endif /* TCP_CHECKSUM_ON_COPY */ + + /* build TCP header */ + if (pbuf_header(p, TCP_HLEN)) { + LWIP_DEBUGF(TCP_OUTPUT_DEBUG | 2, ("tcp_create_segment: no room for TCP header in pbuf.\n")); + TCP_STATS_INC(tcp.err); + tcp_seg_free(seg); + return NULL; + } + seg->tcphdr = (struct tcp_hdr *)seg->p->payload; + seg->tcphdr->src = htons(pcb->local_port); + seg->tcphdr->dest = htons(pcb->remote_port); + seg->tcphdr->seqno = htonl(seqno); + /* ackno is set in tcp_output */ + TCPH_HDRLEN_FLAGS_SET(seg->tcphdr, (5 + optlen / 4), flags); + /* wnd and chksum are set in tcp_output */ + seg->tcphdr->urgp = 0; + return seg; +} + +/** + * Allocate a PBUF_RAM pbuf, perhaps with extra space at the end. + * + * This function is like pbuf_alloc(layer, length, PBUF_RAM) except + * there may be extra bytes available at the end. + * + * @param layer flag to define header size. + * @param length size of the pbuf's payload. + * @param max_length maximum usable size of payload+oversize. + * @param oversize pointer to a u16_t that will receive the number of usable tail bytes. + * @param pcb The TCP connection that willo enqueue the pbuf. + * @param apiflags API flags given to tcp_write. + * @param first_seg true when this pbuf will be used in the first enqueued segment. + * @param + */ +#if TCP_OVERSIZE +static struct pbuf * +tcp_pbuf_prealloc(pbuf_layer layer, u16_t length, u16_t max_length, + u16_t *oversize, struct tcp_pcb *pcb, u8_t apiflags, + u8_t first_seg) +{ + struct pbuf *p; + u16_t alloc = length; + +#if LWIP_NETIF_TX_SINGLE_PBUF + LWIP_UNUSED_ARG(max_length); + LWIP_UNUSED_ARG(pcb); + LWIP_UNUSED_ARG(apiflags); + LWIP_UNUSED_ARG(first_seg); + /* always create MSS-sized pbufs */ + alloc = TCP_MSS; +#else /* LWIP_NETIF_TX_SINGLE_PBUF */ + if (length < max_length) { + /* Should we allocate an oversized pbuf, or just the minimum + * length required? If tcp_write is going to be called again + * before this segment is transmitted, we want the oversized + * buffer. If the segment will be transmitted immediately, we can + * save memory by allocating only length. We use a simple + * heuristic based on the following information: + * + * Did the user set TCP_WRITE_FLAG_MORE? + * + * Will the Nagle algorithm defer transmission of this segment? + */ + if ((apiflags & TCP_WRITE_FLAG_MORE) || + (!(pcb->flags & TF_NODELAY) && + (!first_seg || + pcb->unsent != NULL || + pcb->unacked != NULL))) { + alloc = LWIP_MIN(max_length, LWIP_MEM_ALIGN_SIZE(length + TCP_OVERSIZE)); + } + } +#endif /* LWIP_NETIF_TX_SINGLE_PBUF */ + p = pbuf_alloc(layer, alloc, PBUF_RAM); + if (p == NULL) { + return NULL; + } + LWIP_ASSERT("need unchained pbuf", p->next == NULL); + *oversize = p->len - length; + /* trim p->len to the currently used size */ + p->len = p->tot_len = length; + return p; +} +#else /* TCP_OVERSIZE */ +#define tcp_pbuf_prealloc(layer, length, mx, os, pcb, api, fst) pbuf_alloc((layer), (length), PBUF_RAM) +#endif /* TCP_OVERSIZE */ + +#if TCP_CHECKSUM_ON_COPY +/** Add a checksum of newly added data to the segment */ +static void +tcp_seg_add_chksum(u16_t chksum, u16_t len, u16_t *seg_chksum, + u8_t *seg_chksum_swapped) +{ + u32_t helper; + /* add chksum to old chksum and fold to u16_t */ + helper = chksum + *seg_chksum; + chksum = FOLD_U32T(helper); + if ((len & 1) != 0) { + *seg_chksum_swapped = 1 - *seg_chksum_swapped; + chksum = SWAP_BYTES_IN_WORD(chksum); + } + *seg_chksum = chksum; +} +#endif /* TCP_CHECKSUM_ON_COPY */ + +/** Checks if tcp_write is allowed or not (checks state, snd_buf and snd_queuelen). + * + * @param pcb the tcp pcb to check for + * @param len length of data to send (checked agains snd_buf) + * @return ERR_OK if tcp_write is allowed to proceed, another err_t otherwise + */ +static err_t +tcp_write_checks(struct tcp_pcb *pcb, u16_t len) +{ + /* connection is in invalid state for data transmission? */ + if ((pcb->state != ESTABLISHED) && + (pcb->state != CLOSE_WAIT) && + (pcb->state != SYN_SENT) && + (pcb->state != SYN_RCVD)) { + LWIP_DEBUGF(TCP_OUTPUT_DEBUG | LWIP_DBG_STATE | LWIP_DBG_LEVEL_SEVERE, ("tcp_write() called in invalid state\n")); + return ERR_CONN; + } else if (len == 0) { + return ERR_OK; + } + + /* fail on too much data */ + if (len > pcb->snd_buf) { + LWIP_DEBUGF(TCP_OUTPUT_DEBUG | 3, ("tcp_write: too much data (len=%"U16_F" > snd_buf=%"U16_F")\n", + len, pcb->snd_buf)); + pcb->flags |= TF_NAGLEMEMERR; + return ERR_MEM; + } + + LWIP_DEBUGF(TCP_QLEN_DEBUG, ("tcp_write: queuelen: %"U16_F"\n", (u16_t)pcb->snd_queuelen)); + + /* If total number of pbufs on the unsent/unacked queues exceeds the + * configured maximum, return an error */ + /* check for configured max queuelen and possible overflow */ + if ((pcb->snd_queuelen >= TCP_SND_QUEUELEN) || (pcb->snd_queuelen > TCP_SNDQUEUELEN_OVERFLOW)) { + LWIP_DEBUGF(TCP_OUTPUT_DEBUG | 3, ("tcp_write: too long queue %"U16_F" (max %"U16_F")\n", + pcb->snd_queuelen, TCP_SND_QUEUELEN)); + TCP_STATS_INC(tcp.memerr); + pcb->flags |= TF_NAGLEMEMERR; + return ERR_MEM; + } + if (pcb->snd_queuelen != 0) { + LWIP_ASSERT("tcp_write: pbufs on queue => at least one queue non-empty", + pcb->unacked != NULL || pcb->unsent != NULL); + } else { + LWIP_ASSERT("tcp_write: no pbufs on queue => both queues empty", + pcb->unacked == NULL && pcb->unsent == NULL); + } + return ERR_OK; +} + +/** + * Write data for sending (but does not send it immediately). + * + * It waits in the expectation of more data being sent soon (as + * it can send them more efficiently by combining them together). + * To prompt the system to send data now, call tcp_output() after + * calling tcp_write(). + * + * @param pcb Protocol control block for the TCP connection to enqueue data for. + * @param arg Pointer to the data to be enqueued for sending. + * @param len Data length in bytes + * @param apiflags combination of following flags : + * - TCP_WRITE_FLAG_COPY (0x01) data will be copied into memory belonging to the stack + * - TCP_WRITE_FLAG_MORE (0x02) for TCP connection, PSH flag will be set on last segment sent, + * @return ERR_OK if enqueued, another err_t on error + */ +err_t +tcp_write(struct tcp_pcb *pcb, const void *arg, u16_t len, u8_t apiflags) +{ + struct pbuf *concat_p = NULL; + struct tcp_seg *last_unsent = NULL, *seg = NULL, *prev_seg = NULL, *queue = NULL; + u16_t pos = 0; /* position in 'arg' data */ + u16_t queuelen; + u8_t optlen = 0; + u8_t optflags = 0; +#if TCP_OVERSIZE + u16_t oversize = 0; + u16_t oversize_used = 0; +#endif /* TCP_OVERSIZE */ +#if TCP_CHECKSUM_ON_COPY + u16_t concat_chksum = 0; + u8_t concat_chksum_swapped = 0; + u16_t concat_chksummed = 0; +#endif /* TCP_CHECKSUM_ON_COPY */ + err_t err; + +#if LWIP_NETIF_TX_SINGLE_PBUF + /* Always copy to try to create single pbufs for TX */ + apiflags |= TCP_WRITE_FLAG_COPY; +#endif /* LWIP_NETIF_TX_SINGLE_PBUF */ + + LWIP_DEBUGF(TCP_OUTPUT_DEBUG, ("tcp_write(pcb=%p, data=%p, len=%"U16_F", apiflags=%"U16_F")\n", + (void *)pcb, arg, len, (u16_t)apiflags)); + LWIP_ERROR("tcp_write: arg == NULL (programmer violates API)", + arg != NULL, return ERR_ARG;); + + err = tcp_write_checks(pcb, len); + if (err != ERR_OK) { + return err; + } + queuelen = pcb->snd_queuelen; + +#if LWIP_TCP_TIMESTAMPS + if ((pcb->flags & TF_TIMESTAMP)) { + optflags = TF_SEG_OPTS_TS; + optlen = LWIP_TCP_OPT_LENGTH(TF_SEG_OPTS_TS); + } +#endif /* LWIP_TCP_TIMESTAMPS */ + + + /* + * TCP segmentation is done in three phases with increasing complexity: + * + * 1. Copy data directly into an oversized pbuf. + * 2. Chain a new pbuf to the end of pcb->unsent. + * 3. Create new segments. + * + * We may run out of memory at any point. In that case we must + * return ERR_MEM and not change anything in pcb. Therefore, all + * changes are recorded in local variables and committed at the end + * of the function. Some pcb fields are maintained in local copies: + * + * queuelen = pcb->snd_queuelen + * oversize = pcb->unsent_oversize + * + * These variables are set consistently by the phases: + * + * seg points to the last segment tampered with. + * + * pos records progress as data is segmented. + */ + + /* Find the tail of the unsent queue. */ + if (pcb->unsent != NULL) { + u16_t space; + u16_t unsent_optlen; + + /* @todo: this could be sped up by keeping last_unsent in the pcb */ + for (last_unsent = pcb->unsent; last_unsent->next != NULL; + last_unsent = last_unsent->next); + + /* Usable space at the end of the last unsent segment */ + unsent_optlen = LWIP_TCP_OPT_LENGTH(last_unsent->flags); + space = pcb->mss - (last_unsent->len + unsent_optlen); + + /* + * Phase 1: Copy data directly into an oversized pbuf. + * + * The number of bytes copied is recorded in the oversize_used + * variable. The actual copying is done at the bottom of the + * function. + */ +#if TCP_OVERSIZE +#if TCP_OVERSIZE_DBGCHECK + /* check that pcb->unsent_oversize matches last_unsent->unsent_oversize */ + LWIP_ASSERT("unsent_oversize mismatch (pcb vs. last_unsent)", + pcb->unsent_oversize == last_unsent->oversize_left); +#endif /* TCP_OVERSIZE_DBGCHECK */ + oversize = pcb->unsent_oversize; + if (oversize > 0) { + LWIP_ASSERT("inconsistent oversize vs. space", oversize_used <= space); + seg = last_unsent; + oversize_used = oversize < len ? oversize : len; + pos += oversize_used; + oversize -= oversize_used; + space -= oversize_used; + } + /* now we are either finished or oversize is zero */ + LWIP_ASSERT("inconsistend oversize vs. len", (oversize == 0) || (pos == len)); +#endif /* TCP_OVERSIZE */ + + /* + * Phase 2: Chain a new pbuf to the end of pcb->unsent. + * + * We don't extend segments containing SYN/FIN flags or options + * (len==0). The new pbuf is kept in concat_p and pbuf_cat'ed at + * the end. + */ + if ((pos < len) && (space > 0) && (last_unsent->len > 0)) { + u16_t seglen = space < len - pos ? space : len - pos; + seg = last_unsent; + + /* Create a pbuf with a copy or reference to seglen bytes. We + * can use PBUF_RAW here since the data appears in the middle of + * a segment. A header will never be prepended. */ + if (apiflags & TCP_WRITE_FLAG_COPY) { + /* Data is copied */ + if ((concat_p = tcp_pbuf_prealloc(PBUF_RAW, seglen, space, &oversize, pcb, apiflags, 1)) == NULL) { + LWIP_DEBUGF(TCP_OUTPUT_DEBUG | 2, + ("tcp_write : could not allocate memory for pbuf copy size %"U16_F"\n", + seglen)); + goto memerr; + } +#if TCP_OVERSIZE_DBGCHECK + last_unsent->oversize_left = oversize; +#endif /* TCP_OVERSIZE_DBGCHECK */ + TCP_DATA_COPY2(concat_p->payload, (u8_t*)arg + pos, seglen, &concat_chksum, &concat_chksum_swapped); +#if TCP_CHECKSUM_ON_COPY + concat_chksummed += seglen; +#endif /* TCP_CHECKSUM_ON_COPY */ + } else { + /* Data is not copied */ + if ((concat_p = pbuf_alloc(PBUF_RAW, seglen, PBUF_ROM)) == NULL) { + LWIP_DEBUGF(TCP_OUTPUT_DEBUG | 2, + ("tcp_write: could not allocate memory for zero-copy pbuf\n")); + goto memerr; + } +#if TCP_CHECKSUM_ON_COPY + /* calculate the checksum of nocopy-data */ + tcp_seg_add_chksum(~inet_chksum((u8_t*)arg + pos, seglen), seglen, + &concat_chksum, &concat_chksum_swapped); + concat_chksummed += seglen; +#endif /* TCP_CHECKSUM_ON_COPY */ + /* reference the non-volatile payload data */ + concat_p->payload = (u8_t*)arg + pos; + } + + pos += seglen; + queuelen += pbuf_clen(concat_p); + } + } else { +#if TCP_OVERSIZE + LWIP_ASSERT("unsent_oversize mismatch (pcb->unsent is NULL)", + pcb->unsent_oversize == 0); +#endif /* TCP_OVERSIZE */ + } + + /* + * Phase 3: Create new segments. + * + * The new segments are chained together in the local 'queue' + * variable, ready to be appended to pcb->unsent. + */ + while (pos < len) { + struct pbuf *p; + u16_t left = len - pos; + u16_t max_len = pcb->mss - optlen; + u16_t seglen = left > max_len ? max_len : left; +#if TCP_CHECKSUM_ON_COPY + u16_t chksum = 0; + u8_t chksum_swapped = 0; +#endif /* TCP_CHECKSUM_ON_COPY */ + + if (apiflags & TCP_WRITE_FLAG_COPY) { + /* If copy is set, memory should be allocated and data copied + * into pbuf */ + if ((p = tcp_pbuf_prealloc(PBUF_TRANSPORT, seglen + optlen, pcb->mss, &oversize, pcb, apiflags, queue == NULL)) == NULL) { + LWIP_DEBUGF(TCP_OUTPUT_DEBUG | 2, ("tcp_write : could not allocate memory for pbuf copy size %"U16_F"\n", seglen)); + goto memerr; + } + LWIP_ASSERT("tcp_write: check that first pbuf can hold the complete seglen", + (p->len >= seglen)); + TCP_DATA_COPY2((char *)p->payload + optlen, (u8_t*)arg + pos, seglen, &chksum, &chksum_swapped); + } else { + /* Copy is not set: First allocate a pbuf for holding the data. + * Since the referenced data is available at least until it is + * sent out on the link (as it has to be ACKed by the remote + * party) we can safely use PBUF_ROM instead of PBUF_REF here. + */ + struct pbuf *p2; +#if TCP_OVERSIZE + LWIP_ASSERT("oversize == 0", oversize == 0); +#endif /* TCP_OVERSIZE */ + if ((p2 = pbuf_alloc(PBUF_TRANSPORT, seglen, PBUF_ROM)) == NULL) { + LWIP_DEBUGF(TCP_OUTPUT_DEBUG | 2, ("tcp_write: could not allocate memory for zero-copy pbuf\n")); + goto memerr; + } +#if TCP_CHECKSUM_ON_COPY + /* calculate the checksum of nocopy-data */ + chksum = ~inet_chksum((u8_t*)arg + pos, seglen); +#endif /* TCP_CHECKSUM_ON_COPY */ + /* reference the non-volatile payload data */ + p2->payload = (u8_t*)arg + pos; + + /* Second, allocate a pbuf for the headers. */ + if ((p = pbuf_alloc(PBUF_TRANSPORT, optlen, PBUF_RAM)) == NULL) { + /* If allocation fails, we have to deallocate the data pbuf as + * well. */ + pbuf_free(p2); + LWIP_DEBUGF(TCP_OUTPUT_DEBUG | 2, ("tcp_write: could not allocate memory for header pbuf\n")); + goto memerr; + } + /* Concatenate the headers and data pbufs together. */ + pbuf_cat(p/*header*/, p2/*data*/); + } + + queuelen += pbuf_clen(p); + + /* Now that there are more segments queued, we check again if the + * length of the queue exceeds the configured maximum or + * overflows. */ + if ((queuelen > TCP_SND_QUEUELEN) || (queuelen > TCP_SNDQUEUELEN_OVERFLOW)) { + LWIP_DEBUGF(TCP_OUTPUT_DEBUG | 2, ("tcp_write: queue too long %"U16_F" (%"U16_F")\n", queuelen, TCP_SND_QUEUELEN)); + pbuf_free(p); + goto memerr; + } + + if ((seg = tcp_create_segment(pcb, p, 0, pcb->snd_lbb + pos, optflags)) == NULL) { + goto memerr; + } +#if TCP_OVERSIZE_DBGCHECK + seg->oversize_left = oversize; +#endif /* TCP_OVERSIZE_DBGCHECK */ +#if TCP_CHECKSUM_ON_COPY + seg->chksum = chksum; + seg->chksum_swapped = chksum_swapped; + seg->flags |= TF_SEG_DATA_CHECKSUMMED; +#endif /* TCP_CHECKSUM_ON_COPY */ + + /* first segment of to-be-queued data? */ + if (queue == NULL) { + queue = seg; + } else { + /* Attach the segment to the end of the queued segments */ + LWIP_ASSERT("prev_seg != NULL", prev_seg != NULL); + prev_seg->next = seg; + } + /* remember last segment of to-be-queued data for next iteration */ + prev_seg = seg; + + LWIP_DEBUGF(TCP_OUTPUT_DEBUG | LWIP_DBG_TRACE, ("tcp_write: queueing %"U32_F":%"U32_F"\n", + ntohl(seg->tcphdr->seqno), + ntohl(seg->tcphdr->seqno) + TCP_TCPLEN(seg))); + + pos += seglen; + } + + /* + * All three segmentation phases were successful. We can commit the + * transaction. + */ + + /* + * Phase 1: If data has been added to the preallocated tail of + * last_unsent, we update the length fields of the pbuf chain. + */ +#if TCP_OVERSIZE + if (oversize_used > 0) { + struct pbuf *p; + /* Bump tot_len of whole chain, len of tail */ + for (p = last_unsent->p; p; p = p->next) { + p->tot_len += oversize_used; + if (p->next == NULL) { + TCP_DATA_COPY((char *)p->payload + p->len, arg, oversize_used, last_unsent); + p->len += oversize_used; + } + } + last_unsent->len += oversize_used; +#if TCP_OVERSIZE_DBGCHECK + last_unsent->oversize_left -= oversize_used; +#endif /* TCP_OVERSIZE_DBGCHECK */ + } + pcb->unsent_oversize = oversize; +#endif /* TCP_OVERSIZE */ + + /* + * Phase 2: concat_p can be concatenated onto last_unsent->p + */ + if (concat_p != NULL) { + LWIP_ASSERT("tcp_write: cannot concatenate when pcb->unsent is empty", + (last_unsent != NULL)); + pbuf_cat(last_unsent->p, concat_p); + last_unsent->len += concat_p->tot_len; +#if TCP_CHECKSUM_ON_COPY + if (concat_chksummed) { + tcp_seg_add_chksum(concat_chksum, concat_chksummed, &last_unsent->chksum, + &last_unsent->chksum_swapped); + last_unsent->flags |= TF_SEG_DATA_CHECKSUMMED; + } +#endif /* TCP_CHECKSUM_ON_COPY */ + } + + /* + * Phase 3: Append queue to pcb->unsent. Queue may be NULL, but that + * is harmless + */ + if (last_unsent == NULL) { + pcb->unsent = queue; + } else { + last_unsent->next = queue; + } + + /* + * Finally update the pcb state. + */ + pcb->snd_lbb += len; + pcb->snd_buf -= len; + pcb->snd_queuelen = queuelen; + + LWIP_DEBUGF(TCP_QLEN_DEBUG, ("tcp_write: %"S16_F" (after enqueued)\n", + pcb->snd_queuelen)); + if (pcb->snd_queuelen != 0) { + LWIP_ASSERT("tcp_write: valid queue length", + pcb->unacked != NULL || pcb->unsent != NULL); + } + + /* Set the PSH flag in the last segment that we enqueued. */ + if (seg != NULL && seg->tcphdr != NULL && ((apiflags & TCP_WRITE_FLAG_MORE)==0)) { + TCPH_SET_FLAG(seg->tcphdr, TCP_PSH); + } + + return ERR_OK; +memerr: + pcb->flags |= TF_NAGLEMEMERR; + TCP_STATS_INC(tcp.memerr); + + if (concat_p != NULL) { + pbuf_free(concat_p); + } + if (queue != NULL) { + tcp_segs_free(queue); + } + if (pcb->snd_queuelen != 0) { + LWIP_ASSERT("tcp_write: valid queue length", pcb->unacked != NULL || + pcb->unsent != NULL); + } + LWIP_DEBUGF(TCP_QLEN_DEBUG | LWIP_DBG_STATE, ("tcp_write: %"S16_F" (with mem err)\n", pcb->snd_queuelen)); + return ERR_MEM; +} + +/** + * Enqueue TCP options for transmission. + * + * Called by tcp_connect(), tcp_listen_input(), and tcp_send_ctrl(). + * + * @param pcb Protocol control block for the TCP connection. + * @param flags TCP header flags to set in the outgoing segment. + * @param optdata pointer to TCP options, or NULL. + * @param optlen length of TCP options in bytes. + */ +err_t +tcp_enqueue_flags(struct tcp_pcb *pcb, u8_t flags) +{ + struct pbuf *p; + struct tcp_seg *seg; + u8_t optflags = 0; + u8_t optlen = 0; + + LWIP_DEBUGF(TCP_QLEN_DEBUG, ("tcp_enqueue_flags: queuelen: %"U16_F"\n", (u16_t)pcb->snd_queuelen)); + + LWIP_ASSERT("tcp_enqueue_flags: need either TCP_SYN or TCP_FIN in flags (programmer violates API)", + (flags & (TCP_SYN | TCP_FIN)) != 0); + + /* check for configured max queuelen and possible overflow */ + if ((pcb->snd_queuelen >= TCP_SND_QUEUELEN) || (pcb->snd_queuelen > TCP_SNDQUEUELEN_OVERFLOW)) { + LWIP_DEBUGF(TCP_OUTPUT_DEBUG | 3, ("tcp_enqueue_flags: too long queue %"U16_F" (max %"U16_F")\n", + pcb->snd_queuelen, TCP_SND_QUEUELEN)); + TCP_STATS_INC(tcp.memerr); + pcb->flags |= TF_NAGLEMEMERR; + return ERR_MEM; + } + + if (flags & TCP_SYN) { + optflags = TF_SEG_OPTS_MSS; + } +#if LWIP_TCP_TIMESTAMPS + if ((pcb->flags & TF_TIMESTAMP)) { + optflags |= TF_SEG_OPTS_TS; + } +#endif /* LWIP_TCP_TIMESTAMPS */ + optlen = LWIP_TCP_OPT_LENGTH(optflags); + + /* tcp_enqueue_flags is always called with either SYN or FIN in flags. + * We need one available snd_buf byte to do that. + * This means we can't send FIN while snd_buf==0. A better fix would be to + * not include SYN and FIN sequence numbers in the snd_buf count. */ + if (pcb->snd_buf == 0) { + LWIP_DEBUGF(TCP_OUTPUT_DEBUG | 3, ("tcp_enqueue_flags: no send buffer available\n")); + TCP_STATS_INC(tcp.memerr); + return ERR_MEM; + } + + /* Allocate pbuf with room for TCP header + options */ + if ((p = pbuf_alloc(PBUF_TRANSPORT, optlen, PBUF_RAM)) == NULL) { + pcb->flags |= TF_NAGLEMEMERR; + TCP_STATS_INC(tcp.memerr); + return ERR_MEM; + } + LWIP_ASSERT("tcp_enqueue_flags: check that first pbuf can hold optlen", + (p->len >= optlen)); + + /* Allocate memory for tcp_seg, and fill in fields. */ + if ((seg = tcp_create_segment(pcb, p, flags, pcb->snd_lbb, optflags)) == NULL) { + pcb->flags |= TF_NAGLEMEMERR; + TCP_STATS_INC(tcp.memerr); + return ERR_MEM; + } + LWIP_ASSERT("seg->tcphdr not aligned", ((mem_ptr_t)seg->tcphdr % MEM_ALIGNMENT) == 0); + LWIP_ASSERT("tcp_enqueue_flags: invalid segment length", seg->len == 0); + + LWIP_DEBUGF(TCP_OUTPUT_DEBUG | LWIP_DBG_TRACE, + ("tcp_enqueue_flags: queueing %"U32_F":%"U32_F" (0x%"X16_F")\n", + ntohl(seg->tcphdr->seqno), + ntohl(seg->tcphdr->seqno) + TCP_TCPLEN(seg), + (u16_t)flags)); + + /* Now append seg to pcb->unsent queue */ + if (pcb->unsent == NULL) { + pcb->unsent = seg; + } else { + struct tcp_seg *useg; + for (useg = pcb->unsent; useg->next != NULL; useg = useg->next); + useg->next = seg; + } +#if TCP_OVERSIZE + /* The new unsent tail has no space */ + pcb->unsent_oversize = 0; +#endif /* TCP_OVERSIZE */ + + /* SYN and FIN bump the sequence number */ + if ((flags & TCP_SYN) || (flags & TCP_FIN)) { + pcb->snd_lbb++; + /* optlen does not influence snd_buf */ + pcb->snd_buf--; + } + if (flags & TCP_FIN) { + pcb->flags |= TF_FIN; + } + + /* update number of segments on the queues */ + pcb->snd_queuelen += pbuf_clen(seg->p); + LWIP_DEBUGF(TCP_QLEN_DEBUG, ("tcp_enqueue_flags: %"S16_F" (after enqueued)\n", pcb->snd_queuelen)); + if (pcb->snd_queuelen != 0) { + LWIP_ASSERT("tcp_enqueue_flags: invalid queue length", + pcb->unacked != NULL || pcb->unsent != NULL); + } + + return ERR_OK; +} + + +#if LWIP_TCP_TIMESTAMPS +/* Build a timestamp option (12 bytes long) at the specified options pointer) + * + * @param pcb tcp_pcb + * @param opts option pointer where to store the timestamp option + */ +static void +tcp_build_timestamp_option(struct tcp_pcb *pcb, u32_t *opts) +{ + /* Pad with two NOP options to make everything nicely aligned */ + opts[0] = PP_HTONL(0x0101080A); + opts[1] = htonl(sys_now()); + opts[2] = htonl(pcb->ts_recent); +} +#endif + +/** Send an ACK without data. + * + * @param pcb Protocol control block for the TCP connection to send the ACK + */ +err_t +tcp_send_empty_ack(struct tcp_pcb *pcb) +{ + struct pbuf *p; + struct tcp_hdr *tcphdr; + u8_t optlen = 0; + +#if LWIP_TCP_TIMESTAMPS + if (pcb->flags & TF_TIMESTAMP) { + optlen = LWIP_TCP_OPT_LENGTH(TF_SEG_OPTS_TS); + } +#endif + + p = tcp_output_alloc_header(pcb, optlen, 0, htonl(pcb->snd_nxt)); + if (p == NULL) { + LWIP_DEBUGF(TCP_OUTPUT_DEBUG, ("tcp_output: (ACK) could not allocate pbuf\n")); + return ERR_BUF; + } + tcphdr = (struct tcp_hdr *)p->payload; + LWIP_DEBUGF(TCP_OUTPUT_DEBUG, + ("tcp_output: sending ACK for %"U32_F"\n", pcb->rcv_nxt)); + /* remove ACK flags from the PCB, as we send an empty ACK now */ + pcb->flags &= ~(TF_ACK_DELAY | TF_ACK_NOW); + + /* NB. MSS option is only sent on SYNs, so ignore it here */ +#if LWIP_TCP_TIMESTAMPS + pcb->ts_lastacksent = pcb->rcv_nxt; + + if (pcb->flags & TF_TIMESTAMP) { + tcp_build_timestamp_option(pcb, (u32_t *)(tcphdr + 1)); + } +#endif + +#if CHECKSUM_GEN_TCP + tcphdr->chksum = inet_chksum_pseudo(p, &(pcb->local_ip), &(pcb->remote_ip), + IP_PROTO_TCP, p->tot_len); +#endif +#if LWIP_NETIF_HWADDRHINT + ip_output_hinted(p, &(pcb->local_ip), &(pcb->remote_ip), pcb->ttl, pcb->tos, + IP_PROTO_TCP, &(pcb->addr_hint)); +#else /* LWIP_NETIF_HWADDRHINT*/ + ip_output(p, &(pcb->local_ip), &(pcb->remote_ip), pcb->ttl, pcb->tos, + IP_PROTO_TCP); +#endif /* LWIP_NETIF_HWADDRHINT*/ + pbuf_free(p); + + return ERR_OK; +} + +/** + * Find out what we can send and send it + * + * @param pcb Protocol control block for the TCP connection to send data + * @return ERR_OK if data has been sent or nothing to send + * another err_t on error + */ +err_t +tcp_output(struct tcp_pcb *pcb) +{ + struct tcp_seg *seg, *useg; + u32_t wnd, snd_nxt; +#if TCP_CWND_DEBUG + s16_t i = 0; +#endif /* TCP_CWND_DEBUG */ + + /* First, check if we are invoked by the TCP input processing + code. If so, we do not output anything. Instead, we rely on the + input processing code to call us when input processing is done + with. */ + if (tcp_input_pcb == pcb) { + return ERR_OK; + } + + wnd = LWIP_MIN(pcb->snd_wnd, pcb->cwnd); + + seg = pcb->unsent; + + /* If the TF_ACK_NOW flag is set and no data will be sent (either + * because the ->unsent queue is empty or because the window does + * not allow it), construct an empty ACK segment and send it. + * + * If data is to be sent, we will just piggyback the ACK (see below). + */ + if (pcb->flags & TF_ACK_NOW && + (seg == NULL || + ntohl(seg->tcphdr->seqno) - pcb->lastack + seg->len > wnd)) { + return tcp_send_empty_ack(pcb); + } + + /* useg should point to last segment on unacked queue */ + useg = pcb->unacked; + if (useg != NULL) { + for (; useg->next != NULL; useg = useg->next); + } + +#if TCP_OUTPUT_DEBUG + if (seg == NULL) { + LWIP_DEBUGF(TCP_OUTPUT_DEBUG, ("tcp_output: nothing to send (%p)\n", + (void*)pcb->unsent)); + } +#endif /* TCP_OUTPUT_DEBUG */ +#if TCP_CWND_DEBUG + if (seg == NULL) { + LWIP_DEBUGF(TCP_CWND_DEBUG, ("tcp_output: snd_wnd %"U16_F + ", cwnd %"U16_F", wnd %"U32_F + ", seg == NULL, ack %"U32_F"\n", + pcb->snd_wnd, pcb->cwnd, wnd, pcb->lastack)); + } else { + LWIP_DEBUGF(TCP_CWND_DEBUG, + ("tcp_output: snd_wnd %"U16_F", cwnd %"U16_F", wnd %"U32_F + ", effwnd %"U32_F", seq %"U32_F", ack %"U32_F"\n", + pcb->snd_wnd, pcb->cwnd, wnd, + ntohl(seg->tcphdr->seqno) - pcb->lastack + seg->len, + ntohl(seg->tcphdr->seqno), pcb->lastack)); + } +#endif /* TCP_CWND_DEBUG */ + /* data available and window allows it to be sent? */ + while (seg != NULL && + ntohl(seg->tcphdr->seqno) - pcb->lastack + seg->len <= wnd) { + LWIP_ASSERT("RST not expected here!", + (TCPH_FLAGS(seg->tcphdr) & TCP_RST) == 0); + /* Stop sending if the nagle algorithm would prevent it + * Don't stop: + * - if tcp_write had a memory error before (prevent delayed ACK timeout) or + * - if FIN was already enqueued for this PCB (SYN is always alone in a segment - + * either seg->next != NULL or pcb->unacked == NULL; + * RST is no sent using tcp_write/tcp_output. + */ + if((tcp_do_output_nagle(pcb) == 0) && + ((pcb->flags & (TF_NAGLEMEMERR | TF_FIN)) == 0)){ + break; + } +#if TCP_CWND_DEBUG + LWIP_DEBUGF(TCP_CWND_DEBUG, ("tcp_output: snd_wnd %"U16_F", cwnd %"U16_F", wnd %"U32_F", effwnd %"U32_F", seq %"U32_F", ack %"U32_F", i %"S16_F"\n", + pcb->snd_wnd, pcb->cwnd, wnd, + ntohl(seg->tcphdr->seqno) + seg->len - + pcb->lastack, + ntohl(seg->tcphdr->seqno), pcb->lastack, i)); + ++i; +#endif /* TCP_CWND_DEBUG */ + + pcb->unsent = seg->next; + + if (pcb->state != SYN_SENT) { + TCPH_SET_FLAG(seg->tcphdr, TCP_ACK); + pcb->flags &= ~(TF_ACK_DELAY | TF_ACK_NOW); + } + + tcp_output_segment(seg, pcb); + snd_nxt = ntohl(seg->tcphdr->seqno) + TCP_TCPLEN(seg); + if (TCP_SEQ_LT(pcb->snd_nxt, snd_nxt)) { + pcb->snd_nxt = snd_nxt; + } + /* put segment on unacknowledged list if length > 0 */ + if (TCP_TCPLEN(seg) > 0) { + seg->next = NULL; + /* unacked list is empty? */ + if (pcb->unacked == NULL) { + pcb->unacked = seg; + useg = seg; + /* unacked list is not empty? */ + } else { + /* In the case of fast retransmit, the packet should not go to the tail + * of the unacked queue, but rather somewhere before it. We need to check for + * this case. -STJ Jul 27, 2004 */ + if (TCP_SEQ_LT(ntohl(seg->tcphdr->seqno), ntohl(useg->tcphdr->seqno))) { + /* add segment to before tail of unacked list, keeping the list sorted */ + struct tcp_seg **cur_seg = &(pcb->unacked); + while (*cur_seg && + TCP_SEQ_LT(ntohl((*cur_seg)->tcphdr->seqno), ntohl(seg->tcphdr->seqno))) { + cur_seg = &((*cur_seg)->next ); + } + seg->next = (*cur_seg); + (*cur_seg) = seg; + } else { + /* add segment to tail of unacked list */ + useg->next = seg; + useg = useg->next; + } + } + /* do not queue empty segments on the unacked list */ + } else { + tcp_seg_free(seg); + } + seg = pcb->unsent; + } +#if TCP_OVERSIZE + if (pcb->unsent == NULL) { + /* last unsent has been removed, reset unsent_oversize */ + pcb->unsent_oversize = 0; + } +#endif /* TCP_OVERSIZE */ + + if (seg != NULL && pcb->persist_backoff == 0 && + ntohl(seg->tcphdr->seqno) - pcb->lastack + seg->len > pcb->snd_wnd) { + /* prepare for persist timer */ + pcb->persist_cnt = 0; + pcb->persist_backoff = 1; + } + + pcb->flags &= ~TF_NAGLEMEMERR; + return ERR_OK; +} + +/** + * Called by tcp_output() to actually send a TCP segment over IP. + * + * @param seg the tcp_seg to send + * @param pcb the tcp_pcb for the TCP connection used to send the segment + */ +static void +tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb) +{ + u16_t len; + struct netif *netif; + u32_t *opts; + + /** @bug Exclude retransmitted segments from this count. */ + snmp_inc_tcpoutsegs(); + + /* The TCP header has already been constructed, but the ackno and + wnd fields remain. */ + seg->tcphdr->ackno = htonl(pcb->rcv_nxt); + + /* advertise our receive window size in this TCP segment */ + seg->tcphdr->wnd = htons(pcb->rcv_ann_wnd); + + pcb->rcv_ann_right_edge = pcb->rcv_nxt + pcb->rcv_ann_wnd; + + /* Add any requested options. NB MSS option is only set on SYN + packets, so ignore it here */ + LWIP_ASSERT("seg->tcphdr not aligned", ((mem_ptr_t)seg->tcphdr % MEM_ALIGNMENT) == 0); + opts = (u32_t *)(void *)(seg->tcphdr + 1); + if (seg->flags & TF_SEG_OPTS_MSS) { + TCP_BUILD_MSS_OPTION(*opts); + opts += 1; + } +#if LWIP_TCP_TIMESTAMPS + pcb->ts_lastacksent = pcb->rcv_nxt; + + if (seg->flags & TF_SEG_OPTS_TS) { + tcp_build_timestamp_option(pcb, opts); + opts += 3; + } +#endif + + /* Set retransmission timer running if it is not currently enabled + This must be set before checking the route. */ + if (pcb->rtime == -1) { + pcb->rtime = 0; + } + + /* If we don't have a local IP address, we get one by + calling ip_route(). */ + if (ip_addr_isany(&(pcb->local_ip))) { + netif = ip_route(&(pcb->remote_ip)); + if (netif == NULL) { + return; + } + ip_addr_copy(pcb->local_ip, netif->ip_addr); + } + + if (pcb->rttest == 0) { + pcb->rttest = tcp_ticks; + pcb->rtseq = ntohl(seg->tcphdr->seqno); + + LWIP_DEBUGF(TCP_RTO_DEBUG, ("tcp_output_segment: rtseq %"U32_F"\n", pcb->rtseq)); + } + LWIP_DEBUGF(TCP_OUTPUT_DEBUG, ("tcp_output_segment: %"U32_F":%"U32_F"\n", + htonl(seg->tcphdr->seqno), htonl(seg->tcphdr->seqno) + + seg->len)); + + len = (u16_t)((u8_t *)seg->tcphdr - (u8_t *)seg->p->payload); + + seg->p->len -= len; + seg->p->tot_len -= len; + + seg->p->payload = seg->tcphdr; + + seg->tcphdr->chksum = 0; +#if CHECKSUM_GEN_TCP +#if TCP_CHECKSUM_ON_COPY + { + u32_t acc; +#if TCP_CHECKSUM_ON_COPY_SANITY_CHECK + u16_t chksum_slow = inet_chksum_pseudo(seg->p, &(pcb->local_ip), + &(pcb->remote_ip), + IP_PROTO_TCP, seg->p->tot_len); +#endif /* TCP_CHECKSUM_ON_COPY_SANITY_CHECK */ + if ((seg->flags & TF_SEG_DATA_CHECKSUMMED) == 0) { + LWIP_ASSERT("data included but not checksummed", + seg->p->tot_len == (TCPH_HDRLEN(seg->tcphdr) * 4)); + } + + /* rebuild TCP header checksum (TCP header changes for retransmissions!) */ + acc = inet_chksum_pseudo_partial(seg->p, &(pcb->local_ip), + &(pcb->remote_ip), + IP_PROTO_TCP, seg->p->tot_len, TCPH_HDRLEN(seg->tcphdr) * 4); + /* add payload checksum */ + if (seg->chksum_swapped) { + seg->chksum = SWAP_BYTES_IN_WORD(seg->chksum); + seg->chksum_swapped = 0; + } + acc += (u16_t)~(seg->chksum); + seg->tcphdr->chksum = FOLD_U32T(acc); +#if TCP_CHECKSUM_ON_COPY_SANITY_CHECK + if (chksum_slow != seg->tcphdr->chksum) { + LWIP_DEBUGF(TCP_DEBUG | LWIP_DBG_LEVEL_WARNING, + ("tcp_output_segment: calculated checksum is %"X16_F" instead of %"X16_F"\n", + seg->tcphdr->chksum, chksum_slow)); + seg->tcphdr->chksum = chksum_slow; + } +#endif /* TCP_CHECKSUM_ON_COPY_SANITY_CHECK */ + } +#else /* TCP_CHECKSUM_ON_COPY */ + seg->tcphdr->chksum = inet_chksum_pseudo(seg->p, &(pcb->local_ip), + &(pcb->remote_ip), + IP_PROTO_TCP, seg->p->tot_len); +#endif /* TCP_CHECKSUM_ON_COPY */ +#endif /* CHECKSUM_GEN_TCP */ + TCP_STATS_INC(tcp.xmit); + +#if LWIP_NETIF_HWADDRHINT + ip_output_hinted(seg->p, &(pcb->local_ip), &(pcb->remote_ip), pcb->ttl, pcb->tos, + IP_PROTO_TCP, &(pcb->addr_hint)); +#else /* LWIP_NETIF_HWADDRHINT*/ + ip_output(seg->p, &(pcb->local_ip), &(pcb->remote_ip), pcb->ttl, pcb->tos, + IP_PROTO_TCP); +#endif /* LWIP_NETIF_HWADDRHINT*/ +} + +/** + * Send a TCP RESET packet (empty segment with RST flag set) either to + * abort a connection or to show that there is no matching local connection + * for a received segment. + * + * Called by tcp_abort() (to abort a local connection), tcp_input() (if no + * matching local pcb was found), tcp_listen_input() (if incoming segment + * has ACK flag set) and tcp_process() (received segment in the wrong state) + * + * Since a RST segment is in most cases not sent for an active connection, + * tcp_rst() has a number of arguments that are taken from a tcp_pcb for + * most other segment output functions. + * + * @param seqno the sequence number to use for the outgoing segment + * @param ackno the acknowledge number to use for the outgoing segment + * @param local_ip the local IP address to send the segment from + * @param remote_ip the remote IP address to send the segment to + * @param local_port the local TCP port to send the segment from + * @param remote_port the remote TCP port to send the segment to + */ +void +tcp_rst(u32_t seqno, u32_t ackno, + ip_addr_t *local_ip, ip_addr_t *remote_ip, + u16_t local_port, u16_t remote_port) +{ + struct pbuf *p; + struct tcp_hdr *tcphdr; + p = pbuf_alloc(PBUF_IP, TCP_HLEN, PBUF_RAM); + if (p == NULL) { + LWIP_DEBUGF(TCP_DEBUG, ("tcp_rst: could not allocate memory for pbuf\n")); + return; + } + LWIP_ASSERT("check that first pbuf can hold struct tcp_hdr", + (p->len >= sizeof(struct tcp_hdr))); + + tcphdr = (struct tcp_hdr *)p->payload; + tcphdr->src = htons(local_port); + tcphdr->dest = htons(remote_port); + tcphdr->seqno = htonl(seqno); + tcphdr->ackno = htonl(ackno); + TCPH_HDRLEN_FLAGS_SET(tcphdr, TCP_HLEN/4, TCP_RST | TCP_ACK); + tcphdr->wnd = PP_HTONS(TCP_WND); + tcphdr->chksum = 0; + tcphdr->urgp = 0; + +#if CHECKSUM_GEN_TCP + tcphdr->chksum = inet_chksum_pseudo(p, local_ip, remote_ip, + IP_PROTO_TCP, p->tot_len); +#endif + TCP_STATS_INC(tcp.xmit); + snmp_inc_tcpoutrsts(); + /* Send output with hardcoded TTL since we have no access to the pcb */ + ip_output(p, local_ip, remote_ip, TCP_TTL, 0, IP_PROTO_TCP); + pbuf_free(p); + LWIP_DEBUGF(TCP_RST_DEBUG, ("tcp_rst: seqno %"U32_F" ackno %"U32_F".\n", seqno, ackno)); +} + +/** + * Requeue all unacked segments for retransmission + * + * Called by tcp_slowtmr() for slow retransmission. + * + * @param pcb the tcp_pcb for which to re-enqueue all unacked segments + */ +void +tcp_rexmit_rto(struct tcp_pcb *pcb) +{ + struct tcp_seg *seg; + + if (pcb->unacked == NULL) { + return; + } + + /* Move all unacked segments to the head of the unsent queue */ + for (seg = pcb->unacked; seg->next != NULL; seg = seg->next); + /* concatenate unsent queue after unacked queue */ + seg->next = pcb->unsent; + /* unsent queue is the concatenated queue (of unacked, unsent) */ + pcb->unsent = pcb->unacked; + /* unacked queue is now empty */ + pcb->unacked = NULL; + + /* increment number of retransmissions */ + ++pcb->nrtx; + + /* Don't take any RTT measurements after retransmitting. */ + pcb->rttest = 0; + + /* Do the actual retransmission */ + tcp_output(pcb); +} + +/** + * Requeue the first unacked segment for retransmission + * + * Called by tcp_receive() for fast retramsmit. + * + * @param pcb the tcp_pcb for which to retransmit the first unacked segment + */ +void +tcp_rexmit(struct tcp_pcb *pcb) +{ + struct tcp_seg *seg; + struct tcp_seg **cur_seg; + + if (pcb->unacked == NULL) { + return; + } + + /* Move the first unacked segment to the unsent queue */ + /* Keep the unsent queue sorted. */ + seg = pcb->unacked; + pcb->unacked = seg->next; + + cur_seg = &(pcb->unsent); + while (*cur_seg && + TCP_SEQ_LT(ntohl((*cur_seg)->tcphdr->seqno), ntohl(seg->tcphdr->seqno))) { + cur_seg = &((*cur_seg)->next ); + } + seg->next = *cur_seg; + *cur_seg = seg; + + ++pcb->nrtx; + + /* Don't take any rtt measurements after retransmitting. */ + pcb->rttest = 0; + + /* Do the actual retransmission. */ + snmp_inc_tcpretranssegs(); + /* No need to call tcp_output: we are always called from tcp_input() + and thus tcp_output directly returns. */ +} + + +/** + * Handle retransmission after three dupacks received + * + * @param pcb the tcp_pcb for which to retransmit the first unacked segment + */ +void +tcp_rexmit_fast(struct tcp_pcb *pcb) +{ + if (pcb->unacked != NULL && !(pcb->flags & TF_INFR)) { + /* This is fast retransmit. Retransmit the first unacked segment. */ + LWIP_DEBUGF(TCP_FR_DEBUG, + ("tcp_receive: dupacks %"U16_F" (%"U32_F + "), fast retransmit %"U32_F"\n", + (u16_t)pcb->dupacks, pcb->lastack, + ntohl(pcb->unacked->tcphdr->seqno))); + tcp_rexmit(pcb); + + /* Set ssthresh to half of the minimum of the current + * cwnd and the advertised window */ + if (pcb->cwnd > pcb->snd_wnd) { + pcb->ssthresh = pcb->snd_wnd / 2; + } else { + pcb->ssthresh = pcb->cwnd / 2; + } + + /* The minimum value for ssthresh should be 2 MSS */ + if (pcb->ssthresh < 2*pcb->mss) { + LWIP_DEBUGF(TCP_FR_DEBUG, + ("tcp_receive: The minimum value for ssthresh %"U16_F + " should be min 2 mss %"U16_F"...\n", + pcb->ssthresh, 2*pcb->mss)); + pcb->ssthresh = 2*pcb->mss; + } + + pcb->cwnd = pcb->ssthresh + 3 * pcb->mss; + pcb->flags |= TF_INFR; + } +} + + +/** + * Send keepalive packets to keep a connection active although + * no data is sent over it. + * + * Called by tcp_slowtmr() + * + * @param pcb the tcp_pcb for which to send a keepalive packet + */ +void +tcp_keepalive(struct tcp_pcb *pcb) +{ + struct pbuf *p; + struct tcp_hdr *tcphdr; + + LWIP_DEBUGF(TCP_DEBUG, ("tcp_keepalive: sending KEEPALIVE probe to %"U16_F".%"U16_F".%"U16_F".%"U16_F"\n", + ip4_addr1_16(&pcb->remote_ip), ip4_addr2_16(&pcb->remote_ip), + ip4_addr3_16(&pcb->remote_ip), ip4_addr4_16(&pcb->remote_ip))); + + LWIP_DEBUGF(TCP_DEBUG, ("tcp_keepalive: tcp_ticks %"U32_F" pcb->tmr %"U32_F" pcb->keep_cnt_sent %"U16_F"\n", + tcp_ticks, pcb->tmr, pcb->keep_cnt_sent)); + + p = tcp_output_alloc_header(pcb, 0, 0, htonl(pcb->snd_nxt - 1)); + if(p == NULL) { + LWIP_DEBUGF(TCP_DEBUG, + ("tcp_keepalive: could not allocate memory for pbuf\n")); + return; + } + tcphdr = (struct tcp_hdr *)p->payload; + +#if CHECKSUM_GEN_TCP + tcphdr->chksum = inet_chksum_pseudo(p, &pcb->local_ip, &pcb->remote_ip, + IP_PROTO_TCP, p->tot_len); +#endif + TCP_STATS_INC(tcp.xmit); + + /* Send output to IP */ +#if LWIP_NETIF_HWADDRHINT + ip_output_hinted(p, &pcb->local_ip, &pcb->remote_ip, pcb->ttl, 0, IP_PROTO_TCP, + &(pcb->addr_hint)); +#else /* LWIP_NETIF_HWADDRHINT*/ + ip_output(p, &pcb->local_ip, &pcb->remote_ip, pcb->ttl, 0, IP_PROTO_TCP); +#endif /* LWIP_NETIF_HWADDRHINT*/ + + pbuf_free(p); + + LWIP_DEBUGF(TCP_DEBUG, ("tcp_keepalive: seqno %"U32_F" ackno %"U32_F".\n", + pcb->snd_nxt - 1, pcb->rcv_nxt)); +} + + +/** + * Send persist timer zero-window probes to keep a connection active + * when a window update is lost. + * + * Called by tcp_slowtmr() + * + * @param pcb the tcp_pcb for which to send a zero-window probe packet + */ +void +tcp_zero_window_probe(struct tcp_pcb *pcb) +{ + struct pbuf *p; + struct tcp_hdr *tcphdr; + struct tcp_seg *seg; + u16_t len; + u8_t is_fin; + + LWIP_DEBUGF(TCP_DEBUG, + ("tcp_zero_window_probe: sending ZERO WINDOW probe to %" + U16_F".%"U16_F".%"U16_F".%"U16_F"\n", + ip4_addr1_16(&pcb->remote_ip), ip4_addr2_16(&pcb->remote_ip), + ip4_addr3_16(&pcb->remote_ip), ip4_addr4_16(&pcb->remote_ip))); + + LWIP_DEBUGF(TCP_DEBUG, + ("tcp_zero_window_probe: tcp_ticks %"U32_F + " pcb->tmr %"U32_F" pcb->keep_cnt_sent %"U16_F"\n", + tcp_ticks, pcb->tmr, pcb->keep_cnt_sent)); + + seg = pcb->unacked; + + if(seg == NULL) { + seg = pcb->unsent; + } + if(seg == NULL) { + return; + } + + is_fin = ((TCPH_FLAGS(seg->tcphdr) & TCP_FIN) != 0) && (seg->len == 0); + /* we want to send one seqno: either FIN or data (no options) */ + len = is_fin ? 0 : 1; + + p = tcp_output_alloc_header(pcb, 0, len, seg->tcphdr->seqno); + if(p == NULL) { + LWIP_DEBUGF(TCP_DEBUG, ("tcp_zero_window_probe: no memory for pbuf\n")); + return; + } + tcphdr = (struct tcp_hdr *)p->payload; + + if (is_fin) { + /* FIN segment, no data */ + TCPH_FLAGS_SET(tcphdr, TCP_ACK | TCP_FIN); + } else { + /* Data segment, copy in one byte from the head of the unacked queue */ + struct tcp_hdr *thdr = (struct tcp_hdr *)seg->p->payload; + char *d = ((char *)p->payload + TCP_HLEN); + pbuf_copy_partial(seg->p, d, 1, TCPH_HDRLEN(thdr) * 4); + } + +#if CHECKSUM_GEN_TCP + tcphdr->chksum = inet_chksum_pseudo(p, &pcb->local_ip, &pcb->remote_ip, + IP_PROTO_TCP, p->tot_len); +#endif + TCP_STATS_INC(tcp.xmit); + + /* Send output to IP */ +#if LWIP_NETIF_HWADDRHINT + ip_output_hinted(p, &pcb->local_ip, &pcb->remote_ip, pcb->ttl, 0, IP_PROTO_TCP, + &(pcb->addr_hint)); +#else /* LWIP_NETIF_HWADDRHINT*/ + ip_output(p, &pcb->local_ip, &pcb->remote_ip, pcb->ttl, 0, IP_PROTO_TCP); +#endif /* LWIP_NETIF_HWADDRHINT*/ + + pbuf_free(p); + + LWIP_DEBUGF(TCP_DEBUG, ("tcp_zero_window_probe: seqno %"U32_F + " ackno %"U32_F".\n", + pcb->snd_nxt - 1, pcb->rcv_nxt)); +} +#endif /* LWIP_TCP */ diff --git a/lib/drivers/lwip/src/core/timers.c b/lib/drivers/lwip/src/core/timers.c new file mode 100644 index 00000000000..f0e92ccebe7 --- /dev/null +++ b/lib/drivers/lwip/src/core/timers.c @@ -0,0 +1,482 @@ +/** + * @file + * Stack-internal timers implementation. + * This file includes timer callbacks for stack-internal timers as well as + * functions to set up or stop timers and check for expired timers. + * + */ + +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * Simon Goldschmidt + * + */ + +#include "lwip/opt.h" + +#include "lwip/timers.h" +#include "lwip/tcp_impl.h" + +#if LWIP_TIMERS + +#include "lwip/def.h" +#include "lwip/memp.h" +#include "lwip/tcpip.h" + +#include "lwip/ip_frag.h" +#include "netif/etharp.h" +#include "lwip/dhcp.h" +#include "lwip/autoip.h" +#include "lwip/igmp.h" +#include "lwip/dns.h" + + +/** The one and only timeout list */ +static struct sys_timeo *next_timeout; +#if NO_SYS +static u32_t timeouts_last_time; +#endif /* NO_SYS */ + +#if LWIP_TCP +/** global variable that shows if the tcp timer is currently scheduled or not */ +static int tcpip_tcp_timer_active; + +/** + * Timer callback function that calls tcp_tmr() and reschedules itself. + * + * @param arg unused argument + */ +static void +tcpip_tcp_timer(void *arg) +{ + LWIP_UNUSED_ARG(arg); + + /* call TCP timer handler */ + tcp_tmr(); + /* timer still needed? */ + if (tcp_active_pcbs || tcp_tw_pcbs) { + /* restart timer */ + sys_timeout(TCP_TMR_INTERVAL, tcpip_tcp_timer, NULL); + } else { + /* disable timer */ + tcpip_tcp_timer_active = 0; + } +} + +/** + * Called from TCP_REG when registering a new PCB: + * the reason is to have the TCP timer only running when + * there are active (or time-wait) PCBs. + */ +void +tcp_timer_needed(void) +{ + /* timer is off but needed again? */ + if (!tcpip_tcp_timer_active && (tcp_active_pcbs || tcp_tw_pcbs)) { + /* enable and start timer */ + tcpip_tcp_timer_active = 1; + sys_timeout(TCP_TMR_INTERVAL, tcpip_tcp_timer, NULL); + } +} +#endif /* LWIP_TCP */ + +#if IP_REASSEMBLY +/** + * Timer callback function that calls ip_reass_tmr() and reschedules itself. + * + * @param arg unused argument + */ +static void +ip_reass_timer(void *arg) +{ + LWIP_UNUSED_ARG(arg); + LWIP_DEBUGF(TIMERS_DEBUG, ("tcpip: ip_reass_tmr()\n")); + ip_reass_tmr(); + sys_timeout(IP_TMR_INTERVAL, ip_reass_timer, NULL); +} +#endif /* IP_REASSEMBLY */ + +#if LWIP_ARP +/** + * Timer callback function that calls etharp_tmr() and reschedules itself. + * + * @param arg unused argument + */ +static void +arp_timer(void *arg) +{ + LWIP_UNUSED_ARG(arg); + LWIP_DEBUGF(TIMERS_DEBUG, ("tcpip: etharp_tmr()\n")); + etharp_tmr(); + sys_timeout(ARP_TMR_INTERVAL, arp_timer, NULL); +} +#endif /* LWIP_ARP */ + +#if LWIP_DHCP +/** + * Timer callback function that calls dhcp_coarse_tmr() and reschedules itself. + * + * @param arg unused argument + */ +static void +dhcp_timer_coarse(void *arg) +{ + LWIP_UNUSED_ARG(arg); + LWIP_DEBUGF(TIMERS_DEBUG, ("tcpip: dhcp_coarse_tmr()\n")); + dhcp_coarse_tmr(); + sys_timeout(DHCP_COARSE_TIMER_MSECS, dhcp_timer_coarse, NULL); +} + +/** + * Timer callback function that calls dhcp_fine_tmr() and reschedules itself. + * + * @param arg unused argument + */ +static void +dhcp_timer_fine(void *arg) +{ + LWIP_UNUSED_ARG(arg); + LWIP_DEBUGF(TIMERS_DEBUG, ("tcpip: dhcp_fine_tmr()\n")); + dhcp_fine_tmr(); + sys_timeout(DHCP_FINE_TIMER_MSECS, dhcp_timer_fine, NULL); +} +#endif /* LWIP_DHCP */ + +#if LWIP_AUTOIP +/** + * Timer callback function that calls autoip_tmr() and reschedules itself. + * + * @param arg unused argument + */ +static void +autoip_timer(void *arg) +{ + LWIP_UNUSED_ARG(arg); + LWIP_DEBUGF(TIMERS_DEBUG, ("tcpip: autoip_tmr()\n")); + autoip_tmr(); + sys_timeout(AUTOIP_TMR_INTERVAL, autoip_timer, NULL); +} +#endif /* LWIP_AUTOIP */ + +#if LWIP_IGMP +/** + * Timer callback function that calls igmp_tmr() and reschedules itself. + * + * @param arg unused argument + */ +static void +igmp_timer(void *arg) +{ + LWIP_UNUSED_ARG(arg); + LWIP_DEBUGF(TIMERS_DEBUG, ("tcpip: igmp_tmr()\n")); + igmp_tmr(); + sys_timeout(IGMP_TMR_INTERVAL, igmp_timer, NULL); +} +#endif /* LWIP_IGMP */ + +#if LWIP_DNS +/** + * Timer callback function that calls dns_tmr() and reschedules itself. + * + * @param arg unused argument + */ +static void +dns_timer(void *arg) +{ + LWIP_UNUSED_ARG(arg); + LWIP_DEBUGF(TIMERS_DEBUG, ("tcpip: dns_tmr()\n")); + dns_tmr(); + sys_timeout(DNS_TMR_INTERVAL, dns_timer, NULL); +} +#endif /* LWIP_DNS */ + +/** Initialize this module */ +void sys_timeouts_init(void) +{ +#if IP_REASSEMBLY + sys_timeout(IP_TMR_INTERVAL, ip_reass_timer, NULL); +#endif /* IP_REASSEMBLY */ +#if LWIP_ARP + sys_timeout(ARP_TMR_INTERVAL, arp_timer, NULL); +#endif /* LWIP_ARP */ +#if LWIP_DHCP + sys_timeout(DHCP_COARSE_TIMER_MSECS, dhcp_timer_coarse, NULL); + sys_timeout(DHCP_FINE_TIMER_MSECS, dhcp_timer_fine, NULL); +#endif /* LWIP_DHCP */ +#if LWIP_AUTOIP + sys_timeout(AUTOIP_TMR_INTERVAL, autoip_timer, NULL); +#endif /* LWIP_AUTOIP */ +#if LWIP_IGMP + sys_timeout(IGMP_TMR_INTERVAL, igmp_timer, NULL); +#endif /* LWIP_IGMP */ +#if LWIP_DNS + sys_timeout(DNS_TMR_INTERVAL, dns_timer, NULL); +#endif /* LWIP_DNS */ + +#if NO_SYS + /* Initialise timestamp for sys_check_timeouts */ + timeouts_last_time = sys_now(); +#endif +} + +/** + * Create a one-shot timer (aka timeout). Timeouts are processed in the + * following cases: + * - while waiting for a message using sys_timeouts_mbox_fetch() + * - by calling sys_check_timeouts() (NO_SYS==1 only) + * + * @param msecs time in milliseconds after that the timer should expire + * @param handler callback function to call when msecs have elapsed + * @param arg argument to pass to the callback function + */ +#if LWIP_DEBUG_TIMERNAMES +void +sys_timeout_debug(u32_t msecs, sys_timeout_handler handler, void *arg, const char* handler_name) +#else /* LWIP_DEBUG_TIMERNAMES */ +void +sys_timeout(u32_t msecs, sys_timeout_handler handler, void *arg) +#endif /* LWIP_DEBUG_TIMERNAMES */ +{ + struct sys_timeo *timeout, *t; + + timeout = (struct sys_timeo *)memp_malloc(MEMP_SYS_TIMEOUT); + if (timeout == NULL) { + LWIP_ASSERT("sys_timeout: timeout != NULL, pool MEMP_SYS_TIMEOUT is empty", timeout != NULL); + return; + } + timeout->next = NULL; + timeout->h = handler; + timeout->arg = arg; + timeout->time = msecs; +#if LWIP_DEBUG_TIMERNAMES + timeout->handler_name = handler_name; + LWIP_DEBUGF(TIMERS_DEBUG, ("sys_timeout: %p msecs=%"U32_F" handler=%s arg=%p\n", + (void *)timeout, msecs, handler_name, (void *)arg)); +#endif /* LWIP_DEBUG_TIMERNAMES */ + + if (next_timeout == NULL) { + next_timeout = timeout; + return; + } + + if (next_timeout->time > msecs) { + next_timeout->time -= msecs; + timeout->next = next_timeout; + next_timeout = timeout; + } else { + for(t = next_timeout; t != NULL; t = t->next) { + timeout->time -= t->time; + if (t->next == NULL || t->next->time > timeout->time) { + if (t->next != NULL) { + t->next->time -= timeout->time; + } + timeout->next = t->next; + t->next = timeout; + break; + } + } + } +} + +/** + * Go through timeout list (for this task only) and remove the first matching + * entry, even though the timeout has not triggered yet. + * + * @note This function only works as expected if there is only one timeout + * calling 'handler' in the list of timeouts. + * + * @param handler callback function that would be called by the timeout + * @param arg callback argument that would be passed to handler +*/ +void +sys_untimeout(sys_timeout_handler handler, void *arg) +{ + struct sys_timeo *prev_t, *t; + + if (next_timeout == NULL) { + return; + } + + for (t = next_timeout, prev_t = NULL; t != NULL; prev_t = t, t = t->next) { + if ((t->h == handler) && (t->arg == arg)) { + /* We have a match */ + /* Unlink from previous in list */ + if (prev_t == NULL) { + next_timeout = t->next; + } else { + prev_t->next = t->next; + } + /* If not the last one, add time of this one back to next */ + if (t->next != NULL) { + t->next->time += t->time; + } + memp_free(MEMP_SYS_TIMEOUT, t); + return; + } + } + return; +} + +#if NO_SYS + +/** Handle timeouts for NO_SYS==1 (i.e. without using + * tcpip_thread/sys_timeouts_mbox_fetch(). Uses sys_now() to call timeout + * handler functions when timeouts expire. + * + * Must be called periodically from your main loop. + */ +void +sys_check_timeouts(void) +{ + struct sys_timeo *tmptimeout; + u32_t diff; + sys_timeout_handler handler; + void *arg; + int had_one; + u32_t now; + + now = sys_now(); + if (next_timeout) { + /* this cares for wraparounds */ + diff = LWIP_U32_DIFF(now, timeouts_last_time); + do + { + had_one = 0; + tmptimeout = next_timeout; + if (tmptimeout->time <= diff) { + /* timeout has expired */ + had_one = 1; + timeouts_last_time = now; + diff -= tmptimeout->time; + next_timeout = tmptimeout->next; + handler = tmptimeout->h; + arg = tmptimeout->arg; +#if LWIP_DEBUG_TIMERNAMES + if (handler != NULL) { + LWIP_DEBUGF(TIMERS_DEBUG, ("sct calling h=%s arg=%p\n", + tmptimeout->handler_name, arg)); + } +#endif /* LWIP_DEBUG_TIMERNAMES */ + memp_free(MEMP_SYS_TIMEOUT, tmptimeout); + if (handler != NULL) { + handler(arg); + } + } + /* repeat until all expired timers have been called */ + }while(had_one); + } +} + +/** Set back the timestamp of the last call to sys_check_timeouts() + * This is necessary if sys_check_timeouts() hasn't been called for a long + * time (e.g. while saving energy) to prevent all timer functions of that + * period being called. + */ +void +sys_restart_timeouts(void) +{ + timeouts_last_time = sys_now(); +} + +#else /* NO_SYS */ + +/** + * Wait (forever) for a message to arrive in an mbox. + * While waiting, timeouts are processed. + * + * @param mbox the mbox to fetch the message from + * @param msg the place to store the message + */ +void +sys_timeouts_mbox_fetch(sys_mbox_t *mbox, void **msg) +{ + u32_t time_needed; + struct sys_timeo *tmptimeout; + sys_timeout_handler handler; + void *arg; + + again: + if (!next_timeout) { + time_needed = sys_arch_mbox_fetch(mbox, msg, 0); + } else { + if (next_timeout->time > 0) { + time_needed = sys_arch_mbox_fetch(mbox, msg, next_timeout->time); + } else { + time_needed = SYS_ARCH_TIMEOUT; + } + + if (time_needed == SYS_ARCH_TIMEOUT) { + /* If time == SYS_ARCH_TIMEOUT, a timeout occured before a message + could be fetched. We should now call the timeout handler and + deallocate the memory allocated for the timeout. */ + tmptimeout = next_timeout; + next_timeout = tmptimeout->next; + handler = tmptimeout->h; + arg = tmptimeout->arg; +#if LWIP_DEBUG_TIMERNAMES + if (handler != NULL) { + LWIP_DEBUGF(TIMERS_DEBUG, ("stmf calling h=%s arg=%p\n", + tmptimeout->handler_name, arg)); + } +#endif /* LWIP_DEBUG_TIMERNAMES */ + memp_free(MEMP_SYS_TIMEOUT, tmptimeout); + if (handler != NULL) { + /* For LWIP_TCPIP_CORE_LOCKING, lock the core before calling the + timeout handler function. */ + LOCK_TCPIP_CORE(); + handler(arg); + UNLOCK_TCPIP_CORE(); + } + LWIP_TCPIP_THREAD_ALIVE(); + + /* We try again to fetch a message from the mbox. */ + goto again; + } else { + /* If time != SYS_ARCH_TIMEOUT, a message was received before the timeout + occured. The time variable is set to the number of + milliseconds we waited for the message. */ + if (time_needed < next_timeout->time) { + next_timeout->time -= time_needed; + } else { + next_timeout->time = 0; + } + } + } +} + +#endif /* NO_SYS */ + +#else /* LWIP_TIMERS */ +/* Satisfy the TCP code which calls this function */ +void +tcp_timer_needed(void) +{ +} +#endif /* LWIP_TIMERS */ diff --git a/lib/drivers/lwip/src/core/udp.c b/lib/drivers/lwip/src/core/udp.c new file mode 100644 index 00000000000..4596ba2b79e --- /dev/null +++ b/lib/drivers/lwip/src/core/udp.c @@ -0,0 +1,966 @@ +/** + * @file + * User Datagram Protocol module + * + */ + +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ + + +/* udp.c + * + * The code for the User Datagram Protocol UDP & UDPLite (RFC 3828). + * + */ + +/* @todo Check the use of '(struct udp_pcb).chksum_len_rx'! + */ + +#include "lwip/opt.h" + +#if LWIP_UDP /* don't build if not configured for use in lwipopts.h */ + +#include "lwip/udp.h" +#include "lwip/def.h" +#include "lwip/memp.h" +#include "lwip/inet_chksum.h" +#include "lwip/ip_addr.h" +#include "lwip/netif.h" +#include "lwip/icmp.h" +#include "lwip/stats.h" +#include "lwip/snmp.h" +#include "arch/perf.h" +#include "lwip/dhcp.h" + +#include + +/* The list of UDP PCBs */ +/* exported in udp.h (was static) */ +struct udp_pcb *udp_pcbs; + +/** + * Process an incoming UDP datagram. + * + * Given an incoming UDP datagram (as a chain of pbufs) this function + * finds a corresponding UDP PCB and hands over the pbuf to the pcbs + * recv function. If no pcb is found or the datagram is incorrect, the + * pbuf is freed. + * + * @param p pbuf to be demultiplexed to a UDP PCB. + * @param inp network interface on which the datagram was received. + * + */ +void +udp_input(struct pbuf *p, struct netif *inp) +{ + struct udp_hdr *udphdr; + struct udp_pcb *pcb, *prev; + struct udp_pcb *uncon_pcb; + struct ip_hdr *iphdr; + u16_t src, dest; + u8_t local_match; + u8_t broadcast; + + PERF_START; + + UDP_STATS_INC(udp.recv); + + iphdr = (struct ip_hdr *)p->payload; + + /* Check minimum length (IP header + UDP header) + * and move payload pointer to UDP header */ + if (p->tot_len < (IPH_HL(iphdr) * 4 + UDP_HLEN) || pbuf_header(p, -(s16_t)(IPH_HL(iphdr) * 4))) { + /* drop short packets */ + LWIP_DEBUGF(UDP_DEBUG, + ("udp_input: short UDP datagram (%"U16_F" bytes) discarded\n", p->tot_len)); + UDP_STATS_INC(udp.lenerr); + UDP_STATS_INC(udp.drop); + snmp_inc_udpinerrors(); + pbuf_free(p); + goto end; + } + + udphdr = (struct udp_hdr *)p->payload; + + /* is broadcast packet ? */ + broadcast = ip_addr_isbroadcast(¤t_iphdr_dest, inp); + + LWIP_DEBUGF(UDP_DEBUG, ("udp_input: received datagram of length %"U16_F"\n", p->tot_len)); + + /* convert src and dest ports to host byte order */ + src = ntohs(udphdr->src); + dest = ntohs(udphdr->dest); + + udp_debug_print(udphdr); + + /* print the UDP source and destination */ + LWIP_DEBUGF(UDP_DEBUG, + ("udp (%"U16_F".%"U16_F".%"U16_F".%"U16_F", %"U16_F") <-- " + "(%"U16_F".%"U16_F".%"U16_F".%"U16_F", %"U16_F")\n", + ip4_addr1_16(&iphdr->dest), ip4_addr2_16(&iphdr->dest), + ip4_addr3_16(&iphdr->dest), ip4_addr4_16(&iphdr->dest), ntohs(udphdr->dest), + ip4_addr1_16(&iphdr->src), ip4_addr2_16(&iphdr->src), + ip4_addr3_16(&iphdr->src), ip4_addr4_16(&iphdr->src), ntohs(udphdr->src))); + +#if LWIP_DHCP + pcb = NULL; + /* when LWIP_DHCP is active, packets to DHCP_CLIENT_PORT may only be processed by + the dhcp module, no other UDP pcb may use the local UDP port DHCP_CLIENT_PORT */ + if (dest == DHCP_CLIENT_PORT) { + /* all packets for DHCP_CLIENT_PORT not coming from DHCP_SERVER_PORT are dropped! */ + if (src == DHCP_SERVER_PORT) { + if ((inp->dhcp != NULL) && (inp->dhcp->pcb != NULL)) { + /* accept the packe if + (- broadcast or directed to us) -> DHCP is link-layer-addressed, local ip is always ANY! + - inp->dhcp->pcb->remote == ANY or iphdr->src */ + if ((ip_addr_isany(&inp->dhcp->pcb->remote_ip) || + ip_addr_cmp(&(inp->dhcp->pcb->remote_ip), ¤t_iphdr_src))) { + pcb = inp->dhcp->pcb; + } + } + } + } else +#endif /* LWIP_DHCP */ + { + prev = NULL; + local_match = 0; + uncon_pcb = NULL; + /* Iterate through the UDP pcb list for a matching pcb. + * 'Perfect match' pcbs (connected to the remote port & ip address) are + * preferred. If no perfect match is found, the first unconnected pcb that + * matches the local port and ip address gets the datagram. */ + for (pcb = udp_pcbs; pcb != NULL; pcb = pcb->next) { + local_match = 0; + /* print the PCB local and remote address */ + LWIP_DEBUGF(UDP_DEBUG, + ("pcb (%"U16_F".%"U16_F".%"U16_F".%"U16_F", %"U16_F") --- " + "(%"U16_F".%"U16_F".%"U16_F".%"U16_F", %"U16_F")\n", + ip4_addr1_16(&pcb->local_ip), ip4_addr2_16(&pcb->local_ip), + ip4_addr3_16(&pcb->local_ip), ip4_addr4_16(&pcb->local_ip), pcb->local_port, + ip4_addr1_16(&pcb->remote_ip), ip4_addr2_16(&pcb->remote_ip), + ip4_addr3_16(&pcb->remote_ip), ip4_addr4_16(&pcb->remote_ip), pcb->remote_port)); + + /* compare PCB local addr+port to UDP destination addr+port */ + if ((pcb->local_port == dest) && + ((!broadcast && ip_addr_isany(&pcb->local_ip)) || + ip_addr_cmp(&(pcb->local_ip), ¤t_iphdr_dest) || +#if LWIP_IGMP + ip_addr_ismulticast(¤t_iphdr_dest) || +#endif /* LWIP_IGMP */ +#if IP_SOF_BROADCAST_RECV + (broadcast && (pcb->so_options & SOF_BROADCAST)))) { +#else /* IP_SOF_BROADCAST_RECV */ + (broadcast))) { +#endif /* IP_SOF_BROADCAST_RECV */ + local_match = 1; + if ((uncon_pcb == NULL) && + ((pcb->flags & UDP_FLAGS_CONNECTED) == 0)) { + /* the first unconnected matching PCB */ + uncon_pcb = pcb; + } + } + /* compare PCB remote addr+port to UDP source addr+port */ + if ((local_match != 0) && + (pcb->remote_port == src) && + (ip_addr_isany(&pcb->remote_ip) || + ip_addr_cmp(&(pcb->remote_ip), ¤t_iphdr_src))) { + /* the first fully matching PCB */ + if (prev != NULL) { + /* move the pcb to the front of udp_pcbs so that is + found faster next time */ + prev->next = pcb->next; + pcb->next = udp_pcbs; + udp_pcbs = pcb; + } else { + UDP_STATS_INC(udp.cachehit); + } + break; + } + prev = pcb; + } + /* no fully matching pcb found? then look for an unconnected pcb */ + if (pcb == NULL) { + pcb = uncon_pcb; + } + } + + /* Check checksum if this is a match or if it was directed at us. */ + if (pcb != NULL || ip_addr_cmp(&inp->ip_addr, ¤t_iphdr_dest)) { + LWIP_DEBUGF(UDP_DEBUG | LWIP_DBG_TRACE, ("udp_input: calculating checksum\n")); +#if LWIP_UDPLITE + if (IPH_PROTO(iphdr) == IP_PROTO_UDPLITE) { + /* Do the UDP Lite checksum */ +#if CHECKSUM_CHECK_UDP + u16_t chklen = ntohs(udphdr->len); + if (chklen < sizeof(struct udp_hdr)) { + if (chklen == 0) { + /* For UDP-Lite, checksum length of 0 means checksum + over the complete packet (See RFC 3828 chap. 3.1) */ + chklen = p->tot_len; + } else { + /* At least the UDP-Lite header must be covered by the + checksum! (Again, see RFC 3828 chap. 3.1) */ + UDP_STATS_INC(udp.chkerr); + UDP_STATS_INC(udp.drop); + snmp_inc_udpinerrors(); + pbuf_free(p); + goto end; + } + } + if (inet_chksum_pseudo_partial(p, ¤t_iphdr_src, ¤t_iphdr_dest, + IP_PROTO_UDPLITE, p->tot_len, chklen) != 0) { + LWIP_DEBUGF(UDP_DEBUG | LWIP_DBG_LEVEL_SERIOUS, + ("udp_input: UDP Lite datagram discarded due to failing checksum\n")); + UDP_STATS_INC(udp.chkerr); + UDP_STATS_INC(udp.drop); + snmp_inc_udpinerrors(); + pbuf_free(p); + goto end; + } +#endif /* CHECKSUM_CHECK_UDP */ + } else +#endif /* LWIP_UDPLITE */ + { +#if CHECKSUM_CHECK_UDP + if (udphdr->chksum != 0) { + if (inet_chksum_pseudo(p, ip_current_src_addr(), ip_current_dest_addr(), + IP_PROTO_UDP, p->tot_len) != 0) { + LWIP_DEBUGF(UDP_DEBUG | LWIP_DBG_LEVEL_SERIOUS, + ("udp_input: UDP datagram discarded due to failing checksum\n")); + UDP_STATS_INC(udp.chkerr); + UDP_STATS_INC(udp.drop); + snmp_inc_udpinerrors(); + pbuf_free(p); + goto end; + } + } +#endif /* CHECKSUM_CHECK_UDP */ + } + if(pbuf_header(p, -UDP_HLEN)) { + /* Can we cope with this failing? Just assert for now */ + LWIP_ASSERT("pbuf_header failed\n", 0); + UDP_STATS_INC(udp.drop); + snmp_inc_udpinerrors(); + pbuf_free(p); + goto end; + } + if (pcb != NULL) { + snmp_inc_udpindatagrams(); +#if SO_REUSE && SO_REUSE_RXTOALL + if ((broadcast || ip_addr_ismulticast(¤t_iphdr_dest)) && + ((pcb->so_options & SOF_REUSEADDR) != 0)) { + /* pass broadcast- or multicast packets to all multicast pcbs + if SOF_REUSEADDR is set on the first match */ + struct udp_pcb *mpcb; + u8_t p_header_changed = 0; + for (mpcb = udp_pcbs; mpcb != NULL; mpcb = mpcb->next) { + if (mpcb != pcb) { + /* compare PCB local addr+port to UDP destination addr+port */ + if ((mpcb->local_port == dest) && + ((!broadcast && ip_addr_isany(&mpcb->local_ip)) || + ip_addr_cmp(&(mpcb->local_ip), ¤t_iphdr_dest) || +#if LWIP_IGMP + ip_addr_ismulticast(¤t_iphdr_dest) || +#endif /* LWIP_IGMP */ +#if IP_SOF_BROADCAST_RECV + (broadcast && (mpcb->so_options & SOF_BROADCAST)))) { +#else /* IP_SOF_BROADCAST_RECV */ + (broadcast))) { +#endif /* IP_SOF_BROADCAST_RECV */ + /* pass a copy of the packet to all local matches */ + if (mpcb->recv != NULL) { + struct pbuf *q; + /* for that, move payload to IP header again */ + if (p_header_changed == 0) { + pbuf_header(p, (s16_t)((IPH_HL(iphdr) * 4) + UDP_HLEN)); + p_header_changed = 1; + } + q = pbuf_alloc(PBUF_RAW, p->tot_len, PBUF_RAM); + if (q != NULL) { + err_t err = pbuf_copy(q, p); + if (err == ERR_OK) { + /* move payload to UDP data */ + pbuf_header(q, -(s16_t)((IPH_HL(iphdr) * 4) + UDP_HLEN)); + mpcb->recv(mpcb->recv_arg, mpcb, q, ip_current_src_addr(), src); + } + } + } + } + } + } + if (p_header_changed) { + /* and move payload to UDP data again */ + pbuf_header(p, -(s16_t)((IPH_HL(iphdr) * 4) + UDP_HLEN)); + } + } +#endif /* SO_REUSE && SO_REUSE_RXTOALL */ + /* callback */ + if (pcb->recv != NULL) { + /* now the recv function is responsible for freeing p */ + pcb->recv(pcb->recv_arg, pcb, p, ip_current_src_addr(), src); + } else { + /* no recv function registered? then we have to free the pbuf! */ + pbuf_free(p); + goto end; + } + } else { + LWIP_DEBUGF(UDP_DEBUG | LWIP_DBG_TRACE, ("udp_input: not for us.\n")); + +#if LWIP_ICMP + /* No match was found, send ICMP destination port unreachable unless + destination address was broadcast/multicast. */ + if (!broadcast && + !ip_addr_ismulticast(¤t_iphdr_dest)) { + /* move payload pointer back to ip header */ + pbuf_header(p, (IPH_HL(iphdr) * 4) + UDP_HLEN); + LWIP_ASSERT("p->payload == iphdr", (p->payload == iphdr)); + icmp_dest_unreach(p, ICMP_DUR_PORT); + } +#endif /* LWIP_ICMP */ + UDP_STATS_INC(udp.proterr); + UDP_STATS_INC(udp.drop); + snmp_inc_udpnoports(); + pbuf_free(p); + } + } else { + pbuf_free(p); + } +end: + PERF_STOP("udp_input"); +} + +/** + * Send data using UDP. + * + * @param pcb UDP PCB used to send the data. + * @param p chain of pbuf's to be sent. + * + * The datagram will be sent to the current remote_ip & remote_port + * stored in pcb. If the pcb is not bound to a port, it will + * automatically be bound to a random port. + * + * @return lwIP error code. + * - ERR_OK. Successful. No error occured. + * - ERR_MEM. Out of memory. + * - ERR_RTE. Could not find route to destination address. + * - More errors could be returned by lower protocol layers. + * + * @see udp_disconnect() udp_sendto() + */ +err_t +udp_send(struct udp_pcb *pcb, struct pbuf *p) +{ + /* send to the packet using remote ip and port stored in the pcb */ + return udp_sendto(pcb, p, &pcb->remote_ip, pcb->remote_port); +} + +#if LWIP_CHECKSUM_ON_COPY +/** Same as udp_send() but with checksum + */ +err_t +udp_send_chksum(struct udp_pcb *pcb, struct pbuf *p, + u8_t have_chksum, u16_t chksum) +{ + /* send to the packet using remote ip and port stored in the pcb */ + return udp_sendto_chksum(pcb, p, &pcb->remote_ip, pcb->remote_port, + have_chksum, chksum); +} +#endif /* LWIP_CHECKSUM_ON_COPY */ + +/** + * Send data to a specified address using UDP. + * + * @param pcb UDP PCB used to send the data. + * @param p chain of pbuf's to be sent. + * @param dst_ip Destination IP address. + * @param dst_port Destination UDP port. + * + * dst_ip & dst_port are expected to be in the same byte order as in the pcb. + * + * If the PCB already has a remote address association, it will + * be restored after the data is sent. + * + * @return lwIP error code (@see udp_send for possible error codes) + * + * @see udp_disconnect() udp_send() + */ +err_t +udp_sendto(struct udp_pcb *pcb, struct pbuf *p, + ip_addr_t *dst_ip, u16_t dst_port) +{ +#if LWIP_CHECKSUM_ON_COPY + return udp_sendto_chksum(pcb, p, dst_ip, dst_port, 0, 0); +} + +/** Same as udp_sendto(), but with checksum */ +err_t +udp_sendto_chksum(struct udp_pcb *pcb, struct pbuf *p, ip_addr_t *dst_ip, + u16_t dst_port, u8_t have_chksum, u16_t chksum) +{ +#endif /* LWIP_CHECKSUM_ON_COPY */ + struct netif *netif; + + LWIP_DEBUGF(UDP_DEBUG | LWIP_DBG_TRACE, ("udp_send\n")); + + /* find the outgoing network interface for this packet */ +#if LWIP_IGMP + netif = ip_route((ip_addr_ismulticast(dst_ip))?(&(pcb->multicast_ip)):(dst_ip)); +#else + netif = ip_route(dst_ip); +#endif /* LWIP_IGMP */ + + /* no outgoing network interface could be found? */ + if (netif == NULL) { + LWIP_DEBUGF(UDP_DEBUG | LWIP_DBG_LEVEL_SERIOUS, ("udp_send: No route to %"U16_F".%"U16_F".%"U16_F".%"U16_F"\n", + ip4_addr1_16(dst_ip), ip4_addr2_16(dst_ip), ip4_addr3_16(dst_ip), ip4_addr4_16(dst_ip))); + UDP_STATS_INC(udp.rterr); + return ERR_RTE; + } +#if LWIP_CHECKSUM_ON_COPY + return udp_sendto_if_chksum(pcb, p, dst_ip, dst_port, netif, have_chksum, chksum); +#else /* LWIP_CHECKSUM_ON_COPY */ + return udp_sendto_if(pcb, p, dst_ip, dst_port, netif); +#endif /* LWIP_CHECKSUM_ON_COPY */ +} + +/** + * Send data to a specified address using UDP. + * The netif used for sending can be specified. + * + * This function exists mainly for DHCP, to be able to send UDP packets + * on a netif that is still down. + * + * @param pcb UDP PCB used to send the data. + * @param p chain of pbuf's to be sent. + * @param dst_ip Destination IP address. + * @param dst_port Destination UDP port. + * @param netif the netif used for sending. + * + * dst_ip & dst_port are expected to be in the same byte order as in the pcb. + * + * @return lwIP error code (@see udp_send for possible error codes) + * + * @see udp_disconnect() udp_send() + */ +err_t +udp_sendto_if(struct udp_pcb *pcb, struct pbuf *p, + ip_addr_t *dst_ip, u16_t dst_port, struct netif *netif) +{ +#if LWIP_CHECKSUM_ON_COPY + return udp_sendto_if_chksum(pcb, p, dst_ip, dst_port, netif, 0, 0); +} + +/** Same as udp_sendto_if(), but with checksum */ +err_t +udp_sendto_if_chksum(struct udp_pcb *pcb, struct pbuf *p, ip_addr_t *dst_ip, + u16_t dst_port, struct netif *netif, u8_t have_chksum, + u16_t chksum) +{ +#endif /* LWIP_CHECKSUM_ON_COPY */ + struct udp_hdr *udphdr; + ip_addr_t *src_ip; + err_t err; + struct pbuf *q; /* q will be sent down the stack */ + +#if IP_SOF_BROADCAST + /* broadcast filter? */ + if ( ((pcb->so_options & SOF_BROADCAST) == 0) && ip_addr_isbroadcast(dst_ip, netif) ) { + LWIP_DEBUGF(UDP_DEBUG | LWIP_DBG_LEVEL_SERIOUS, + ("udp_sendto_if: SOF_BROADCAST not enabled on pcb %p\n", (void *)pcb)); + return ERR_VAL; + } +#endif /* IP_SOF_BROADCAST */ + + /* if the PCB is not yet bound to a port, bind it here */ + if (pcb->local_port == 0) { + LWIP_DEBUGF(UDP_DEBUG | LWIP_DBG_TRACE, ("udp_send: not yet bound to a port, binding now\n")); + err = udp_bind(pcb, &pcb->local_ip, pcb->local_port); + if (err != ERR_OK) { + LWIP_DEBUGF(UDP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_LEVEL_SERIOUS, ("udp_send: forced port bind failed\n")); + return err; + } + } + + /* not enough space to add an UDP header to first pbuf in given p chain? */ + if (pbuf_header(p, UDP_HLEN)) { + /* allocate header in a separate new pbuf */ + q = pbuf_alloc(PBUF_IP, UDP_HLEN, PBUF_RAM); + /* new header pbuf could not be allocated? */ + if (q == NULL) { + LWIP_DEBUGF(UDP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_LEVEL_SERIOUS, ("udp_send: could not allocate header\n")); + return ERR_MEM; + } + if (p->tot_len != 0) { + /* chain header q in front of given pbuf p (only if p contains data) */ + pbuf_chain(q, p); + } + /* first pbuf q points to header pbuf */ + LWIP_DEBUGF(UDP_DEBUG, + ("udp_send: added header pbuf %p before given pbuf %p\n", (void *)q, (void *)p)); + } else { + /* adding space for header within p succeeded */ + /* first pbuf q equals given pbuf */ + q = p; + LWIP_DEBUGF(UDP_DEBUG, ("udp_send: added header in given pbuf %p\n", (void *)p)); + } + LWIP_ASSERT("check that first pbuf can hold struct udp_hdr", + (q->len >= sizeof(struct udp_hdr))); + /* q now represents the packet to be sent */ + udphdr = (struct udp_hdr *)q->payload; + udphdr->src = htons(pcb->local_port); + udphdr->dest = htons(dst_port); + /* in UDP, 0 checksum means 'no checksum' */ + udphdr->chksum = 0x0000; + + /* Multicast Loop? */ +#if LWIP_IGMP + if (ip_addr_ismulticast(dst_ip) && ((pcb->flags & UDP_FLAGS_MULTICAST_LOOP) != 0)) { + q->flags |= PBUF_FLAG_MCASTLOOP; + } +#endif /* LWIP_IGMP */ + + + /* PCB local address is IP_ANY_ADDR? */ + if (ip_addr_isany(&pcb->local_ip)) { + /* use outgoing network interface IP address as source address */ + src_ip = &(netif->ip_addr); + } else { + /* check if UDP PCB local IP address is correct + * this could be an old address if netif->ip_addr has changed */ + if (!ip_addr_cmp(&(pcb->local_ip), &(netif->ip_addr))) { + /* local_ip doesn't match, drop the packet */ + if (q != p) { + /* free the header pbuf */ + pbuf_free(q); + q = NULL; + /* p is still referenced by the caller, and will live on */ + } + return ERR_VAL; + } + /* use UDP PCB local IP address as source address */ + src_ip = &(pcb->local_ip); + } + + LWIP_DEBUGF(UDP_DEBUG, ("udp_send: sending datagram of length %"U16_F"\n", q->tot_len)); + +#if LWIP_UDPLITE + /* UDP Lite protocol? */ + if (pcb->flags & UDP_FLAGS_UDPLITE) { + u16_t chklen, chklen_hdr; + LWIP_DEBUGF(UDP_DEBUG, ("udp_send: UDP LITE packet length %"U16_F"\n", q->tot_len)); + /* set UDP message length in UDP header */ + chklen_hdr = chklen = pcb->chksum_len_tx; + if ((chklen < sizeof(struct udp_hdr)) || (chklen > q->tot_len)) { + if (chklen != 0) { + LWIP_DEBUGF(UDP_DEBUG, ("udp_send: UDP LITE pcb->chksum_len is illegal: %"U16_F"\n", chklen)); + } + /* For UDP-Lite, checksum length of 0 means checksum + over the complete packet. (See RFC 3828 chap. 3.1) + At least the UDP-Lite header must be covered by the + checksum, therefore, if chksum_len has an illegal + value, we generate the checksum over the complete + packet to be safe. */ + chklen_hdr = 0; + chklen = q->tot_len; + } + udphdr->len = htons(chklen_hdr); + /* calculate checksum */ +#if CHECKSUM_GEN_UDP + udphdr->chksum = inet_chksum_pseudo_partial(q, src_ip, dst_ip, + IP_PROTO_UDPLITE, q->tot_len, +#if !LWIP_CHECKSUM_ON_COPY + chklen); +#else /* !LWIP_CHECKSUM_ON_COPY */ + (have_chksum ? UDP_HLEN : chklen)); + if (have_chksum) { + u32_t acc; + acc = udphdr->chksum + (u16_t)~(chksum); + udphdr->chksum = FOLD_U32T(acc); + } +#endif /* !LWIP_CHECKSUM_ON_COPY */ + + /* chksum zero must become 0xffff, as zero means 'no checksum' */ + if (udphdr->chksum == 0x0000) { + udphdr->chksum = 0xffff; + } +#endif /* CHECKSUM_GEN_UDP */ + /* output to IP */ + LWIP_DEBUGF(UDP_DEBUG, ("udp_send: ip_output_if (,,,,IP_PROTO_UDPLITE,)\n")); +#if LWIP_NETIF_HWADDRHINT + netif->addr_hint = &(pcb->addr_hint); +#endif /* LWIP_NETIF_HWADDRHINT*/ + err = ip_output_if(q, src_ip, dst_ip, pcb->ttl, pcb->tos, IP_PROTO_UDPLITE, netif); +#if LWIP_NETIF_HWADDRHINT + netif->addr_hint = NULL; +#endif /* LWIP_NETIF_HWADDRHINT*/ + } else +#endif /* LWIP_UDPLITE */ + { /* UDP */ + LWIP_DEBUGF(UDP_DEBUG, ("udp_send: UDP packet length %"U16_F"\n", q->tot_len)); + udphdr->len = htons(q->tot_len); + /* calculate checksum */ +#if CHECKSUM_GEN_UDP + if ((pcb->flags & UDP_FLAGS_NOCHKSUM) == 0) { + u16_t udpchksum; +#if LWIP_CHECKSUM_ON_COPY + if (have_chksum) { + u32_t acc; + udpchksum = inet_chksum_pseudo_partial(q, src_ip, dst_ip, IP_PROTO_UDP, + q->tot_len, UDP_HLEN); + acc = udpchksum + (u16_t)~(chksum); + udpchksum = FOLD_U32T(acc); + } else +#endif /* LWIP_CHECKSUM_ON_COPY */ + { + udpchksum = inet_chksum_pseudo(q, src_ip, dst_ip, IP_PROTO_UDP, q->tot_len); + } + + /* chksum zero must become 0xffff, as zero means 'no checksum' */ + if (udpchksum == 0x0000) { + udpchksum = 0xffff; + } + udphdr->chksum = udpchksum; + } +#endif /* CHECKSUM_GEN_UDP */ + LWIP_DEBUGF(UDP_DEBUG, ("udp_send: UDP checksum 0x%04"X16_F"\n", udphdr->chksum)); + LWIP_DEBUGF(UDP_DEBUG, ("udp_send: ip_output_if (,,,,IP_PROTO_UDP,)\n")); + /* output to IP */ +#if LWIP_NETIF_HWADDRHINT + netif->addr_hint = &(pcb->addr_hint); +#endif /* LWIP_NETIF_HWADDRHINT*/ + err = ip_output_if(q, src_ip, dst_ip, pcb->ttl, pcb->tos, IP_PROTO_UDP, netif); +#if LWIP_NETIF_HWADDRHINT + netif->addr_hint = NULL; +#endif /* LWIP_NETIF_HWADDRHINT*/ + } + /* TODO: must this be increased even if error occured? */ + snmp_inc_udpoutdatagrams(); + + /* did we chain a separate header pbuf earlier? */ + if (q != p) { + /* free the header pbuf */ + pbuf_free(q); + q = NULL; + /* p is still referenced by the caller, and will live on */ + } + + UDP_STATS_INC(udp.xmit); + return err; +} + +/** + * Bind an UDP PCB. + * + * @param pcb UDP PCB to be bound with a local address ipaddr and port. + * @param ipaddr local IP address to bind with. Use IP_ADDR_ANY to + * bind to all local interfaces. + * @param port local UDP port to bind with. Use 0 to automatically bind + * to a random port between UDP_LOCAL_PORT_RANGE_START and + * UDP_LOCAL_PORT_RANGE_END. + * + * ipaddr & port are expected to be in the same byte order as in the pcb. + * + * @return lwIP error code. + * - ERR_OK. Successful. No error occured. + * - ERR_USE. The specified ipaddr and port are already bound to by + * another UDP PCB. + * + * @see udp_disconnect() + */ +err_t +udp_bind(struct udp_pcb *pcb, ip_addr_t *ipaddr, u16_t port) +{ + struct udp_pcb *ipcb; + u8_t rebind; + + LWIP_DEBUGF(UDP_DEBUG | LWIP_DBG_TRACE, ("udp_bind(ipaddr = ")); + ip_addr_debug_print(UDP_DEBUG, ipaddr); + LWIP_DEBUGF(UDP_DEBUG | LWIP_DBG_TRACE, (", port = %"U16_F")\n", port)); + + rebind = 0; + /* Check for double bind and rebind of the same pcb */ + for (ipcb = udp_pcbs; ipcb != NULL; ipcb = ipcb->next) { + /* is this UDP PCB already on active list? */ + if (pcb == ipcb) { + /* pcb may occur at most once in active list */ + LWIP_ASSERT("rebind == 0", rebind == 0); + /* pcb already in list, just rebind */ + rebind = 1; + } + + /* By default, we don't allow to bind to a port that any other udp + PCB is alread bound to, unless *all* PCBs with that port have tha + REUSEADDR flag set. */ +#if SO_REUSE + else if (((pcb->so_options & SOF_REUSEADDR) == 0) && + ((ipcb->so_options & SOF_REUSEADDR) == 0)) { +#else /* SO_REUSE */ + /* port matches that of PCB in list and REUSEADDR not set -> reject */ + else { +#endif /* SO_REUSE */ + if ((ipcb->local_port == port) && + /* IP address matches, or one is IP_ADDR_ANY? */ + (ip_addr_isany(&(ipcb->local_ip)) || + ip_addr_isany(ipaddr) || + ip_addr_cmp(&(ipcb->local_ip), ipaddr))) { + /* other PCB already binds to this local IP and port */ + LWIP_DEBUGF(UDP_DEBUG, + ("udp_bind: local port %"U16_F" already bound by another pcb\n", port)); + return ERR_USE; + } + } + } + + ip_addr_set(&pcb->local_ip, ipaddr); + + /* no port specified? */ + if (port == 0) { +#ifndef UDP_LOCAL_PORT_RANGE_START +/* From http://www.iana.org/assignments/port-numbers: + "The Dynamic and/or Private Ports are those from 49152 through 65535" */ +#define UDP_LOCAL_PORT_RANGE_START 0xc000 +#define UDP_LOCAL_PORT_RANGE_END 0xffff +#endif + port = UDP_LOCAL_PORT_RANGE_START; + ipcb = udp_pcbs; + while ((ipcb != NULL) && (port != UDP_LOCAL_PORT_RANGE_END)) { + if (ipcb->local_port == port) { + /* port is already used by another udp_pcb */ + port++; + /* restart scanning all udp pcbs */ + ipcb = udp_pcbs; + } else { + /* go on with next udp pcb */ + ipcb = ipcb->next; + } + } + if (ipcb != NULL) { + /* no more ports available in local range */ + LWIP_DEBUGF(UDP_DEBUG, ("udp_bind: out of free UDP ports\n")); + return ERR_USE; + } + } + pcb->local_port = port; + snmp_insert_udpidx_tree(pcb); + /* pcb not active yet? */ + if (rebind == 0) { + /* place the PCB on the active list if not already there */ + pcb->next = udp_pcbs; + udp_pcbs = pcb; + } + LWIP_DEBUGF(UDP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, + ("udp_bind: bound to %"U16_F".%"U16_F".%"U16_F".%"U16_F", port %"U16_F"\n", + ip4_addr1_16(&pcb->local_ip), ip4_addr2_16(&pcb->local_ip), + ip4_addr3_16(&pcb->local_ip), ip4_addr4_16(&pcb->local_ip), + pcb->local_port)); + return ERR_OK; +} +/** + * Connect an UDP PCB. + * + * This will associate the UDP PCB with the remote address. + * + * @param pcb UDP PCB to be connected with remote address ipaddr and port. + * @param ipaddr remote IP address to connect with. + * @param port remote UDP port to connect with. + * + * @return lwIP error code + * + * ipaddr & port are expected to be in the same byte order as in the pcb. + * + * The udp pcb is bound to a random local port if not already bound. + * + * @see udp_disconnect() + */ +err_t +udp_connect(struct udp_pcb *pcb, ip_addr_t *ipaddr, u16_t port) +{ + struct udp_pcb *ipcb; + + if (pcb->local_port == 0) { + err_t err = udp_bind(pcb, &pcb->local_ip, pcb->local_port); + if (err != ERR_OK) { + return err; + } + } + + ip_addr_set(&pcb->remote_ip, ipaddr); + pcb->remote_port = port; + pcb->flags |= UDP_FLAGS_CONNECTED; +/** TODO: this functionality belongs in upper layers */ +#ifdef LWIP_UDP_TODO + /* Nail down local IP for netconn_addr()/getsockname() */ + if (ip_addr_isany(&pcb->local_ip) && !ip_addr_isany(&pcb->remote_ip)) { + struct netif *netif; + + if ((netif = ip_route(&(pcb->remote_ip))) == NULL) { + LWIP_DEBUGF(UDP_DEBUG, ("udp_connect: No route to 0x%lx\n", pcb->remote_ip.addr)); + UDP_STATS_INC(udp.rterr); + return ERR_RTE; + } + /** TODO: this will bind the udp pcb locally, to the interface which + is used to route output packets to the remote address. However, we + might want to accept incoming packets on any interface! */ + pcb->local_ip = netif->ip_addr; + } else if (ip_addr_isany(&pcb->remote_ip)) { + pcb->local_ip.addr = 0; + } +#endif + LWIP_DEBUGF(UDP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_STATE, + ("udp_connect: connected to %"U16_F".%"U16_F".%"U16_F".%"U16_F",port %"U16_F"\n", + ip4_addr1_16(&pcb->local_ip), ip4_addr2_16(&pcb->local_ip), + ip4_addr3_16(&pcb->local_ip), ip4_addr4_16(&pcb->local_ip), + pcb->local_port)); + + /* Insert UDP PCB into the list of active UDP PCBs. */ + for (ipcb = udp_pcbs; ipcb != NULL; ipcb = ipcb->next) { + if (pcb == ipcb) { + /* already on the list, just return */ + return ERR_OK; + } + } + /* PCB not yet on the list, add PCB now */ + pcb->next = udp_pcbs; + udp_pcbs = pcb; + return ERR_OK; +} + +/** + * Disconnect a UDP PCB + * + * @param pcb the udp pcb to disconnect. + */ +void +udp_disconnect(struct udp_pcb *pcb) +{ + /* reset remote address association */ + ip_addr_set_any(&pcb->remote_ip); + pcb->remote_port = 0; + /* mark PCB as unconnected */ + pcb->flags &= ~UDP_FLAGS_CONNECTED; +} + +/** + * Set a receive callback for a UDP PCB + * + * This callback will be called when receiving a datagram for the pcb. + * + * @param pcb the pcb for wich to set the recv callback + * @param recv function pointer of the callback function + * @param recv_arg additional argument to pass to the callback function + */ +void +udp_recv(struct udp_pcb *pcb, udp_recv_fn recv, void *recv_arg) +{ + /* remember recv() callback and user data */ + pcb->recv = recv; + pcb->recv_arg = recv_arg; +} + +/** + * Remove an UDP PCB. + * + * @param pcb UDP PCB to be removed. The PCB is removed from the list of + * UDP PCB's and the data structure is freed from memory. + * + * @see udp_new() + */ +void +udp_remove(struct udp_pcb *pcb) +{ + struct udp_pcb *pcb2; + + snmp_delete_udpidx_tree(pcb); + /* pcb to be removed is first in list? */ + if (udp_pcbs == pcb) { + /* make list start at 2nd pcb */ + udp_pcbs = udp_pcbs->next; + /* pcb not 1st in list */ + } else { + for (pcb2 = udp_pcbs; pcb2 != NULL; pcb2 = pcb2->next) { + /* find pcb in udp_pcbs list */ + if (pcb2->next != NULL && pcb2->next == pcb) { + /* remove pcb from list */ + pcb2->next = pcb->next; + } + } + } + memp_free(MEMP_UDP_PCB, pcb); +} + +/** + * Create a UDP PCB. + * + * @return The UDP PCB which was created. NULL if the PCB data structure + * could not be allocated. + * + * @see udp_remove() + */ +struct udp_pcb * +udp_new(void) +{ + struct udp_pcb *pcb; + pcb = (struct udp_pcb *)memp_malloc(MEMP_UDP_PCB); + /* could allocate UDP PCB? */ + if (pcb != NULL) { + /* UDP Lite: by initializing to all zeroes, chksum_len is set to 0 + * which means checksum is generated over the whole datagram per default + * (recommended as default by RFC 3828). */ + /* initialize PCB to all zeroes */ + memset(pcb, 0, sizeof(struct udp_pcb)); + pcb->ttl = UDP_TTL; + } + return pcb; +} + +#if UDP_DEBUG +/** + * Print UDP header information for debug purposes. + * + * @param udphdr pointer to the udp header in memory. + */ +void +udp_debug_print(struct udp_hdr *udphdr) +{ + LWIP_DEBUGF(UDP_DEBUG, ("UDP header:\n")); + LWIP_DEBUGF(UDP_DEBUG, ("+-------------------------------+\n")); + LWIP_DEBUGF(UDP_DEBUG, ("| %5"U16_F" | %5"U16_F" | (src port, dest port)\n", + ntohs(udphdr->src), ntohs(udphdr->dest))); + LWIP_DEBUGF(UDP_DEBUG, ("+-------------------------------+\n")); + LWIP_DEBUGF(UDP_DEBUG, ("| %5"U16_F" | 0x%04"X16_F" | (len, chksum)\n", + ntohs(udphdr->len), ntohs(udphdr->chksum))); + LWIP_DEBUGF(UDP_DEBUG, ("+-------------------------------+\n")); +} +#endif /* UDP_DEBUG */ + +#endif /* LWIP_UDP */ diff --git a/lib/drivers/lwip/src/include/arch/bpstruct.h b/lib/drivers/lwip/src/include/arch/bpstruct.h new file mode 100755 index 00000000000..1d81e3f7b89 --- /dev/null +++ b/lib/drivers/lwip/src/include/arch/bpstruct.h @@ -0,0 +1 @@ +#pragma pack(push,1) diff --git a/lib/drivers/lwip/src/include/arch/cc.h b/lib/drivers/lwip/src/include/arch/cc.h new file mode 100755 index 00000000000..c2581e9886b --- /dev/null +++ b/lib/drivers/lwip/src/include/arch/cc.h @@ -0,0 +1,59 @@ +/* ReactOS-Specific lwIP binding header - by Cameron Gutman */ + +#include + +/* ROS-specific mem defs */ +void * +malloc(size_t size); + +void * +calloc(size_t count, size_t size); + +void +free(void *mem); + +void * +realloc(void *mem, size_t size); + +#define mem_trim(_m_, _s_) realloc(_m_, _s_) + +/* Unsigned int types */ +typedef unsigned char u8_t; +typedef unsigned short u16_t; +typedef unsigned long u32_t; + +/* Signed int types */ +typedef signed char s8_t; +typedef signed short s16_t; +typedef signed long s32_t; + +/* Memory pointer */ +typedef u32_t mem_ptr_t; + +/* Printf/DPRINT formatters */ +#define U16_F "hu" +#define S16_F "hd" +#define X16_F "hx" +#define U32_F "lu" +#define S32_F "ld" +#define X32_F "lx" + +/* Endianness */ +#define BYTE_ORDER LITTLE_ENDIAN + +/* Checksum calculation algorithm choice */ +#define LWIP_CHKSUM_ALGORITHM 3 + +/* Diagnostics */ +#define LWIP_PLATFORM_DIAG(x) (DbgPrint x) +#define LWIP_PLATFORM_ASSERT(x) ASSERTMSG(x, FALSE) + +/* Synchronization */ +#define SYS_ARCH_DECL_PROTECT(lev) sys_prot_t (lev) +#define SYS_ARCH_PROTECT(lev) sys_arch_protect(&(lev)) +#define SYS_ARCH_UNPROTECT(lev) sys_arch_unprotect(lev) + +/* Compiler hints for packing structures */ +#define PACK_STRUCT_STRUCT +#define PACK_STRUCT_USE_INCLUDES + diff --git a/lib/drivers/lwip/src/include/arch/epstruct.h b/lib/drivers/lwip/src/include/arch/epstruct.h new file mode 100755 index 00000000000..65898b54bb5 --- /dev/null +++ b/lib/drivers/lwip/src/include/arch/epstruct.h @@ -0,0 +1 @@ +#pragma pack(pop) diff --git a/lib/drivers/lwip/src/include/arch/perf.h b/lib/drivers/lwip/src/include/arch/perf.h new file mode 100755 index 00000000000..3e00e34ec03 --- /dev/null +++ b/lib/drivers/lwip/src/include/arch/perf.h @@ -0,0 +1,4 @@ +/* ReactOS-Specific lwIP binding header - by Cameron Gutman */ + +#define PERF_START +#define PERF_STOP \ No newline at end of file diff --git a/lib/drivers/lwip/src/include/arch/sys_arch.h b/lib/drivers/lwip/src/include/arch/sys_arch.h new file mode 100755 index 00000000000..963d10a3d53 --- /dev/null +++ b/lib/drivers/lwip/src/include/arch/sys_arch.h @@ -0,0 +1,43 @@ +/* ReactOS-Specific lwIP binding header - by Cameron Gutman */ + +/* Implmentation specific structs */ +typedef struct _sys_sem_t +{ + KEVENT Event; + int Valid; +} sys_sem_t; + +typedef struct _sys_mbox_t +{ + KSPIN_LOCK Lock; + LIST_ENTRY ListHead; + KEVENT Event; + int Valid; +} sys_mbox_t; + +typedef KIRQL sys_prot_t; + +typedef u32_t sys_thread_t; + +typedef struct _LWIP_MESSAGE_CONTAINER +{ + PVOID Message; + LIST_ENTRY ListEntry; +} LWIP_MESSAGE_CONTAINER, *PLWIP_MESSAGE_CONTAINER; + +#define sys_jiffies() sys_now() + +/* NULL definitions */ +#define SYS_MBOX_NULL NULL +#define SYS_SEM_NULL NULL +#define SYS_ARCH_NULL NULL + +void +sys_arch_protect(sys_prot_t *lev); + +void +sys_arch_unprotect(sys_prot_t lev); + +void +sys_shutdown(void); + diff --git a/lib/drivers/lwip/src/include/ipv4/lwip/autoip.h b/lib/drivers/lwip/src/include/ipv4/lwip/autoip.h new file mode 100644 index 00000000000..23c264a1e04 --- /dev/null +++ b/lib/drivers/lwip/src/include/ipv4/lwip/autoip.h @@ -0,0 +1,119 @@ +/** + * @file + * + * AutoIP Automatic LinkLocal IP Configuration + */ + +/* + * + * Copyright (c) 2007 Dominik Spies + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * Author: Dominik Spies + * + * This is a AutoIP implementation for the lwIP TCP/IP stack. It aims to conform + * with RFC 3927. + * + * + * Please coordinate changes and requests with Dominik Spies + * + */ + +#ifndef __LWIP_AUTOIP_H__ +#define __LWIP_AUTOIP_H__ + +#include "lwip/opt.h" + +#if LWIP_AUTOIP /* don't build if not configured for use in lwipopts.h */ + +#include "lwip/netif.h" +#include "lwip/udp.h" +#include "netif/etharp.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* AutoIP Timing */ +#define AUTOIP_TMR_INTERVAL 100 +#define AUTOIP_TICKS_PER_SECOND (1000 / AUTOIP_TMR_INTERVAL) + +/* RFC 3927 Constants */ +#define PROBE_WAIT 1 /* second (initial random delay) */ +#define PROBE_MIN 1 /* second (minimum delay till repeated probe) */ +#define PROBE_MAX 2 /* seconds (maximum delay till repeated probe) */ +#define PROBE_NUM 3 /* (number of probe packets) */ +#define ANNOUNCE_NUM 2 /* (number of announcement packets) */ +#define ANNOUNCE_INTERVAL 2 /* seconds (time between announcement packets) */ +#define ANNOUNCE_WAIT 2 /* seconds (delay before announcing) */ +#define MAX_CONFLICTS 10 /* (max conflicts before rate limiting) */ +#define RATE_LIMIT_INTERVAL 60 /* seconds (delay between successive attempts) */ +#define DEFEND_INTERVAL 10 /* seconds (min. wait between defensive ARPs) */ + +/* AutoIP client states */ +#define AUTOIP_STATE_OFF 0 +#define AUTOIP_STATE_PROBING 1 +#define AUTOIP_STATE_ANNOUNCING 2 +#define AUTOIP_STATE_BOUND 3 + +struct autoip +{ + ip_addr_t llipaddr; /* the currently selected, probed, announced or used LL IP-Address */ + u8_t state; /* current AutoIP state machine state */ + u8_t sent_num; /* sent number of probes or announces, dependent on state */ + u16_t ttw; /* ticks to wait, tick is AUTOIP_TMR_INTERVAL long */ + u8_t lastconflict; /* ticks until a conflict can be solved by defending */ + u8_t tried_llipaddr; /* total number of probed/used Link Local IP-Addresses */ +}; + + +/** Init srand, has to be called before entering mainloop */ +void autoip_init(void); + +/** Set a struct autoip allocated by the application to work with */ +void autoip_set_struct(struct netif *netif, struct autoip *autoip); + +/** Start AutoIP client */ +err_t autoip_start(struct netif *netif); + +/** Stop AutoIP client */ +err_t autoip_stop(struct netif *netif); + +/** Handles every incoming ARP Packet, called by etharp_arp_input */ +void autoip_arp_reply(struct netif *netif, struct etharp_hdr *hdr); + +/** Has to be called in loop every AUTOIP_TMR_INTERVAL milliseconds */ +void autoip_tmr(void); + +/** Handle a possible change in the network configuration */ +void autoip_network_changed(struct netif *netif); + +#ifdef __cplusplus +} +#endif + +#endif /* LWIP_AUTOIP */ + +#endif /* __LWIP_AUTOIP_H__ */ diff --git a/lib/drivers/lwip/src/include/ipv4/lwip/icmp.h b/lib/drivers/lwip/src/include/ipv4/lwip/icmp.h new file mode 100644 index 00000000000..d47a7d8a2e2 --- /dev/null +++ b/lib/drivers/lwip/src/include/ipv4/lwip/icmp.h @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ +#ifndef __LWIP_ICMP_H__ +#define __LWIP_ICMP_H__ + +#include "lwip/opt.h" +#include "lwip/pbuf.h" +#include "lwip/ip_addr.h" +#include "lwip/netif.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define ICMP_ER 0 /* echo reply */ +#define ICMP_DUR 3 /* destination unreachable */ +#define ICMP_SQ 4 /* source quench */ +#define ICMP_RD 5 /* redirect */ +#define ICMP_ECHO 8 /* echo */ +#define ICMP_TE 11 /* time exceeded */ +#define ICMP_PP 12 /* parameter problem */ +#define ICMP_TS 13 /* timestamp */ +#define ICMP_TSR 14 /* timestamp reply */ +#define ICMP_IRQ 15 /* information request */ +#define ICMP_IR 16 /* information reply */ + +enum icmp_dur_type { + ICMP_DUR_NET = 0, /* net unreachable */ + ICMP_DUR_HOST = 1, /* host unreachable */ + ICMP_DUR_PROTO = 2, /* protocol unreachable */ + ICMP_DUR_PORT = 3, /* port unreachable */ + ICMP_DUR_FRAG = 4, /* fragmentation needed and DF set */ + ICMP_DUR_SR = 5 /* source route failed */ +}; + +enum icmp_te_type { + ICMP_TE_TTL = 0, /* time to live exceeded in transit */ + ICMP_TE_FRAG = 1 /* fragment reassembly time exceeded */ +}; + +#ifdef PACK_STRUCT_USE_INCLUDES +# include "arch/bpstruct.h" +#endif +/** This is the standard ICMP header only that the u32_t data + * is splitted to two u16_t like ICMP echo needs it. + * This header is also used for other ICMP types that do not + * use the data part. + */ +PACK_STRUCT_BEGIN +struct icmp_echo_hdr { + PACK_STRUCT_FIELD(u8_t type); + PACK_STRUCT_FIELD(u8_t code); + PACK_STRUCT_FIELD(u16_t chksum); + PACK_STRUCT_FIELD(u16_t id); + PACK_STRUCT_FIELD(u16_t seqno); +} PACK_STRUCT_STRUCT; +PACK_STRUCT_END +#ifdef PACK_STRUCT_USE_INCLUDES +# include "arch/epstruct.h" +#endif + +#define ICMPH_TYPE(hdr) ((hdr)->type) +#define ICMPH_CODE(hdr) ((hdr)->code) + +/** Combines type and code to an u16_t */ +#define ICMPH_TYPE_SET(hdr, t) ((hdr)->type = (t)) +#define ICMPH_CODE_SET(hdr, c) ((hdr)->code = (c)) + + +#if LWIP_ICMP /* don't build if not configured for use in lwipopts.h */ + +void icmp_input(struct pbuf *p, struct netif *inp); +void icmp_dest_unreach(struct pbuf *p, enum icmp_dur_type t); +void icmp_time_exceeded(struct pbuf *p, enum icmp_te_type t); + +#endif /* LWIP_ICMP */ + +#ifdef __cplusplus +} +#endif + +#endif /* __LWIP_ICMP_H__ */ diff --git a/lib/drivers/lwip/src/include/ipv4/lwip/igmp.h b/lib/drivers/lwip/src/include/ipv4/lwip/igmp.h new file mode 100644 index 00000000000..8aabac24817 --- /dev/null +++ b/lib/drivers/lwip/src/include/ipv4/lwip/igmp.h @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2002 CITEL Technologies Ltd. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of CITEL Technologies Ltd nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY CITEL TECHNOLOGIES AND CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL CITEL TECHNOLOGIES OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This file is a contribution to the lwIP TCP/IP stack. + * The Swedish Institute of Computer Science and Adam Dunkels + * are specifically granted permission to redistribute this + * source code. +*/ + +#ifndef __LWIP_IGMP_H__ +#define __LWIP_IGMP_H__ + +#include "lwip/opt.h" +#include "lwip/ip_addr.h" +#include "lwip/netif.h" +#include "lwip/pbuf.h" + +#if LWIP_IGMP /* don't build if not configured for use in lwipopts.h */ + +#ifdef __cplusplus +extern "C" { +#endif + + +/* IGMP timer */ +#define IGMP_TMR_INTERVAL 100 /* Milliseconds */ +#define IGMP_V1_DELAYING_MEMBER_TMR (1000/IGMP_TMR_INTERVAL) +#define IGMP_JOIN_DELAYING_MEMBER_TMR (500 /IGMP_TMR_INTERVAL) + +/* MAC Filter Actions, these are passed to a netif's + * igmp_mac_filter callback function. */ +#define IGMP_DEL_MAC_FILTER 0 +#define IGMP_ADD_MAC_FILTER 1 + + +/** + * igmp group structure - there is + * a list of groups for each interface + * these should really be linked from the interface, but + * if we keep them separate we will not affect the lwip original code + * too much + * + * There will be a group for the all systems group address but this + * will not run the state machine as it is used to kick off reports + * from all the other groups + */ +struct igmp_group { + /** next link */ + struct igmp_group *next; + /** interface on which the group is active */ + struct netif *netif; + /** multicast address */ + ip_addr_t group_address; + /** signifies we were the last person to report */ + u8_t last_reporter_flag; + /** current state of the group */ + u8_t group_state; + /** timer for reporting, negative is OFF */ + u16_t timer; + /** counter of simultaneous uses */ + u8_t use; +}; + +/* Prototypes */ +void igmp_init(void); +err_t igmp_start(struct netif *netif); +err_t igmp_stop(struct netif *netif); +void igmp_report_groups(struct netif *netif); +struct igmp_group *igmp_lookfor_group(struct netif *ifp, ip_addr_t *addr); +void igmp_input(struct pbuf *p, struct netif *inp, ip_addr_t *dest); +err_t igmp_joingroup(ip_addr_t *ifaddr, ip_addr_t *groupaddr); +err_t igmp_leavegroup(ip_addr_t *ifaddr, ip_addr_t *groupaddr); +void igmp_tmr(void); + +#ifdef __cplusplus +} +#endif + +#endif /* LWIP_IGMP */ + +#endif /* __LWIP_IGMP_H__ */ diff --git a/lib/drivers/lwip/src/include/ipv4/lwip/inet.h b/lib/drivers/lwip/src/include/ipv4/lwip/inet.h new file mode 100644 index 00000000000..7bff49b59e6 --- /dev/null +++ b/lib/drivers/lwip/src/include/ipv4/lwip/inet.h @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ +#ifndef __LWIP_INET_H__ +#define __LWIP_INET_H__ + +#include "lwip/opt.h" +#include "lwip/def.h" +#include "lwip/ip_addr.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** For compatibility with BSD code */ +struct in_addr { + u32_t s_addr; +}; + +/** 255.255.255.255 */ +#define INADDR_NONE IPADDR_NONE +/** 127.0.0.1 */ +#define INADDR_LOOPBACK IPADDR_LOOPBACK +/** 0.0.0.0 */ +#define INADDR_ANY IPADDR_ANY +/** 255.255.255.255 */ +#define INADDR_BROADCAST IPADDR_BROADCAST + +/* Definitions of the bits in an Internet address integer. + + On subnets, host and network parts are found according to + the subnet mask, not these masks. */ +#define IN_CLASSA(a) IP_CLASSA(a) +#define IN_CLASSA_NET IP_CLASSA_NET +#define IN_CLASSA_NSHIFT IP_CLASSA_NSHIFT +#define IN_CLASSA_HOST IP_CLASSA_HOST +#define IN_CLASSA_MAX IP_CLASSA_MAX + +#define IN_CLASSB(b) IP_CLASSB(b) +#define IN_CLASSB_NET IP_CLASSB_NET +#define IN_CLASSB_NSHIFT IP_CLASSB_NSHIFT +#define IN_CLASSB_HOST IP_CLASSB_HOST +#define IN_CLASSB_MAX IP_CLASSB_MAX + +#define IN_CLASSC(c) IP_CLASSC(c) +#define IN_CLASSC_NET IP_CLASSC_NET +#define IN_CLASSC_NSHIFT IP_CLASSC_NSHIFT +#define IN_CLASSC_HOST IP_CLASSC_HOST +#define IN_CLASSC_MAX IP_CLASSC_MAX + +#define IN_CLASSD(d) IP_CLASSD(d) +#define IN_CLASSD_NET IP_CLASSD_NET /* These ones aren't really */ +#define IN_CLASSD_NSHIFT IP_CLASSD_NSHIFT /* net and host fields, but */ +#define IN_CLASSD_HOST IP_CLASSD_HOST /* routing needn't know. */ +#define IN_CLASSD_MAX IP_CLASSD_MAX + +#define IN_MULTICAST(a) IP_MULTICAST(a) + +#define IN_EXPERIMENTAL(a) IP_EXPERIMENTAL(a) +#define IN_BADCLASS(a) IP_BADCLASS(a) + +#define IN_LOOPBACKNET IP_LOOPBACKNET + +#define inet_addr_from_ipaddr(target_inaddr, source_ipaddr) ((target_inaddr)->s_addr = ip4_addr_get_u32(source_ipaddr)) +#define inet_addr_to_ipaddr(target_ipaddr, source_inaddr) (ip4_addr_set_u32(target_ipaddr, (source_inaddr)->s_addr)) +/* ATTENTION: the next define only works because both s_addr and ip_addr_t are an u32_t effectively! */ +#define inet_addr_to_ipaddr_p(target_ipaddr_p, source_inaddr) ((target_ipaddr_p) = (ip_addr_t*)&((source_inaddr)->s_addr)) + +/* directly map this to the lwip internal functions */ +#define inet_addr(cp) ipaddr_addr(cp) +#define inet_aton(cp, addr) ipaddr_aton(cp, (ip_addr_t*)addr) +#define inet_ntoa(addr) ipaddr_ntoa((ip_addr_t*)&(addr)) +#define inet_ntoa_r(addr, buf, buflen) ipaddr_ntoa_r((ip_addr_t*)&(addr), buf, buflen) + +#ifdef __cplusplus +} +#endif + +#endif /* __LWIP_INET_H__ */ diff --git a/lib/drivers/lwip/src/include/ipv4/lwip/inet_chksum.h b/lib/drivers/lwip/src/include/ipv4/lwip/inet_chksum.h new file mode 100644 index 00000000000..79a2d90f2f7 --- /dev/null +++ b/lib/drivers/lwip/src/include/ipv4/lwip/inet_chksum.h @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ +#ifndef __LWIP_INET_CHKSUM_H__ +#define __LWIP_INET_CHKSUM_H__ + +#include "lwip/opt.h" + +#include "lwip/pbuf.h" +#include "lwip/ip_addr.h" + +/** Swap the bytes in an u16_t: much like htons() for little-endian */ +#ifndef SWAP_BYTES_IN_WORD +#if LWIP_PLATFORM_BYTESWAP && (BYTE_ORDER == LITTLE_ENDIAN) +/* little endian and PLATFORM_BYTESWAP defined */ +#define SWAP_BYTES_IN_WORD(w) LWIP_PLATFORM_HTONS(w) +#else /* LWIP_PLATFORM_BYTESWAP && (BYTE_ORDER == LITTLE_ENDIAN) */ +/* can't use htons on big endian (or PLATFORM_BYTESWAP not defined)... */ +#define SWAP_BYTES_IN_WORD(w) (((w) & 0xff) << 8) | (((w) & 0xff00) >> 8) +#endif /* LWIP_PLATFORM_BYTESWAP && (BYTE_ORDER == LITTLE_ENDIAN)*/ +#endif /* SWAP_BYTES_IN_WORD */ + +/** Split an u32_t in two u16_ts and add them up */ +#ifndef FOLD_U32T +#define FOLD_U32T(u) (((u) >> 16) + ((u) & 0x0000ffffUL)) +#endif + +#if LWIP_CHECKSUM_ON_COPY +/** Function-like macro: same as MEMCPY but returns the checksum of copied data + as u16_t */ +#ifndef LWIP_CHKSUM_COPY +#define LWIP_CHKSUM_COPY(dst, src, len) lwip_chksum_copy(dst, src, len) +#ifndef LWIP_CHKSUM_COPY_ALGORITHM +#define LWIP_CHKSUM_COPY_ALGORITHM 1 +#endif /* LWIP_CHKSUM_COPY_ALGORITHM */ +#endif /* LWIP_CHKSUM_COPY */ +#else /* LWIP_CHECKSUM_ON_COPY */ +#define LWIP_CHKSUM_COPY_ALGORITHM 0 +#endif /* LWIP_CHECKSUM_ON_COPY */ + +#ifdef __cplusplus +extern "C" { +#endif + +u16_t inet_chksum(void *dataptr, u16_t len); +u16_t inet_chksum_pbuf(struct pbuf *p); +u16_t inet_chksum_pseudo(struct pbuf *p, + ip_addr_t *src, ip_addr_t *dest, + u8_t proto, u16_t proto_len); +u16_t inet_chksum_pseudo_partial(struct pbuf *p, + ip_addr_t *src, ip_addr_t *dest, + u8_t proto, u16_t proto_len, u16_t chksum_len); +#if LWIP_CHKSUM_COPY_ALGORITHM +u16_t lwip_chksum_copy(void *dst, const void *src, u16_t len); +#endif /* LWIP_CHKSUM_COPY_ALGORITHM */ + +#ifdef __cplusplus +} +#endif + +#endif /* __LWIP_INET_H__ */ + diff --git a/lib/drivers/lwip/src/include/ipv4/lwip/ip.h b/lib/drivers/lwip/src/include/ipv4/lwip/ip.h new file mode 100644 index 00000000000..74f501d1ab4 --- /dev/null +++ b/lib/drivers/lwip/src/include/ipv4/lwip/ip.h @@ -0,0 +1,213 @@ +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ +#ifndef __LWIP_IP_H__ +#define __LWIP_IP_H__ + +#include "lwip/opt.h" + +#include "lwip/def.h" +#include "lwip/pbuf.h" +#include "lwip/ip_addr.h" +#include "lwip/err.h" +#include "lwip/netif.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** Currently, the function ip_output_if_opt() is only used with IGMP */ +#define IP_OPTIONS_SEND LWIP_IGMP + +#define IP_HLEN 20 + +#define IP_PROTO_ICMP 1 +#define IP_PROTO_IGMP 2 +#define IP_PROTO_UDP 17 +#define IP_PROTO_UDPLITE 136 +#define IP_PROTO_TCP 6 + +/* This is passed as the destination address to ip_output_if (not + to ip_output), meaning that an IP header already is constructed + in the pbuf. This is used when TCP retransmits. */ +#ifdef IP_HDRINCL +#undef IP_HDRINCL +#endif /* IP_HDRINCL */ +#define IP_HDRINCL NULL + +#if LWIP_NETIF_HWADDRHINT +#define IP_PCB_ADDRHINT ;u8_t addr_hint +#else +#define IP_PCB_ADDRHINT +#endif /* LWIP_NETIF_HWADDRHINT */ + +/* This is the common part of all PCB types. It needs to be at the + beginning of a PCB type definition. It is located here so that + changes to this common part are made in one location instead of + having to change all PCB structs. */ +#define IP_PCB \ + /* ip addresses in network byte order */ \ + ip_addr_t local_ip; \ + ip_addr_t remote_ip; \ + /* Socket options */ \ + u8_t so_options; \ + /* Type Of Service */ \ + u8_t tos; \ + /* Time To Live */ \ + u8_t ttl \ + /* link layer address resolution hint */ \ + IP_PCB_ADDRHINT + +struct ip_pcb { +/* Common members of all PCB types */ + IP_PCB; +}; + +/* + * Option flags per-socket. These are the same like SO_XXX. + */ +/*#define SOF_DEBUG (u8_t)0x01U Unimplemented: turn on debugging info recording */ +#define SOF_ACCEPTCONN (u8_t)0x02U /* socket has had listen() */ +#define SOF_REUSEADDR (u8_t)0x04U /* allow local address reuse */ +#define SOF_KEEPALIVE (u8_t)0x08U /* keep connections alive */ +/*#define SOF_DONTROUTE (u8_t)0x10U Unimplemented: just use interface addresses */ +#define SOF_BROADCAST (u8_t)0x20U /* permit to send and to receive broadcast messages (see IP_SOF_BROADCAST option) */ +/*#define SOF_USELOOPBACK (u8_t)0x40U Unimplemented: bypass hardware when possible */ +#define SOF_LINGER (u8_t)0x80U /* linger on close if data present */ +/*#define SOF_OOBINLINE (u16_t)0x0100U Unimplemented: leave received OOB data in line */ +/*#define SOF_REUSEPORT (u16_t)0x0200U Unimplemented: allow local address & port reuse */ + +/* These flags are inherited (e.g. from a listen-pcb to a connection-pcb): */ +#define SOF_INHERITED (SOF_REUSEADDR|SOF_KEEPALIVE|SOF_LINGER/*|SOF_DEBUG|SOF_DONTROUTE|SOF_OOBINLINE*/) + + +#ifdef PACK_STRUCT_USE_INCLUDES +# include "arch/bpstruct.h" +#endif +PACK_STRUCT_BEGIN +struct ip_hdr { + /* version / header length / type of service */ + PACK_STRUCT_FIELD(u16_t _v_hl_tos); + /* total length */ + PACK_STRUCT_FIELD(u16_t _len); + /* identification */ + PACK_STRUCT_FIELD(u16_t _id); + /* fragment offset field */ + PACK_STRUCT_FIELD(u16_t _offset); +#define IP_RF 0x8000U /* reserved fragment flag */ +#define IP_DF 0x4000U /* dont fragment flag */ +#define IP_MF 0x2000U /* more fragments flag */ +#define IP_OFFMASK 0x1fffU /* mask for fragmenting bits */ + /* time to live */ + PACK_STRUCT_FIELD(u8_t _ttl); + /* protocol*/ + PACK_STRUCT_FIELD(u8_t _proto); + /* checksum */ + PACK_STRUCT_FIELD(u16_t _chksum); + /* source and destination IP addresses */ + PACK_STRUCT_FIELD(ip_addr_p_t src); + PACK_STRUCT_FIELD(ip_addr_p_t dest); +} PACK_STRUCT_STRUCT; +PACK_STRUCT_END +#ifdef PACK_STRUCT_USE_INCLUDES +# include "arch/epstruct.h" +#endif + +#define IPH_V(hdr) (ntohs((hdr)->_v_hl_tos) >> 12) +#define IPH_HL(hdr) ((ntohs((hdr)->_v_hl_tos) >> 8) & 0x0f) +#define IPH_TOS(hdr) (ntohs((hdr)->_v_hl_tos) & 0xff) +#define IPH_LEN(hdr) ((hdr)->_len) +#define IPH_ID(hdr) ((hdr)->_id) +#define IPH_OFFSET(hdr) ((hdr)->_offset) +#define IPH_TTL(hdr) ((hdr)->_ttl) +#define IPH_PROTO(hdr) ((hdr)->_proto) +#define IPH_CHKSUM(hdr) ((hdr)->_chksum) + +#define IPH_VHLTOS_SET(hdr, v, hl, tos) (hdr)->_v_hl_tos = (htons(((v) << 12) | ((hl) << 8) | (tos))) +#define IPH_LEN_SET(hdr, len) (hdr)->_len = (len) +#define IPH_ID_SET(hdr, id) (hdr)->_id = (id) +#define IPH_OFFSET_SET(hdr, off) (hdr)->_offset = (off) +#define IPH_TTL_SET(hdr, ttl) (hdr)->_ttl = (u8_t)(ttl) +#define IPH_PROTO_SET(hdr, proto) (hdr)->_proto = (u8_t)(proto) +#define IPH_CHKSUM_SET(hdr, chksum) (hdr)->_chksum = (chksum) + +/** The interface that provided the packet for the current callback invocation. */ +extern struct netif *current_netif; +/** Header of the input packet currently being processed. */ +extern const struct ip_hdr *current_header; +/** Source IP address of current_header */ +extern ip_addr_t current_iphdr_src; +/** Destination IP address of current_header */ +extern ip_addr_t current_iphdr_dest; + +#define ip_init() /* Compatibility define, not init needed. */ +struct netif *ip_route(ip_addr_t *dest); +err_t ip_input(struct pbuf *p, struct netif *inp); +err_t ip_output(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest, + u8_t ttl, u8_t tos, u8_t proto); +err_t ip_output_if(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest, + u8_t ttl, u8_t tos, u8_t proto, + struct netif *netif); +#if LWIP_NETIF_HWADDRHINT +err_t ip_output_hinted(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest, + u8_t ttl, u8_t tos, u8_t proto, u8_t *addr_hint); +#endif /* LWIP_NETIF_HWADDRHINT */ +#if IP_OPTIONS_SEND +err_t ip_output_if_opt(struct pbuf *p, ip_addr_t *src, ip_addr_t *dest, + u8_t ttl, u8_t tos, u8_t proto, struct netif *netif, void *ip_options, + u16_t optlen); +#endif /* IP_OPTIONS_SEND */ +/** Get the interface that received the current packet. + * This function must only be called from a receive callback (udp_recv, + * raw_recv, tcp_accept). It will return NULL otherwise. */ +#define ip_current_netif() (current_netif) +/** Get the IP header of the current packet. + * This function must only be called from a receive callback (udp_recv, + * raw_recv, tcp_accept). It will return NULL otherwise. */ +#define ip_current_header() (current_header) +/** Source IP address of current_header */ +#define ip_current_src_addr() (¤t_iphdr_src) +/** Destination IP address of current_header */ +#define ip_current_dest_addr() (¤t_iphdr_dest) + +#if IP_DEBUG +void ip_debug_print(struct pbuf *p); +#else +#define ip_debug_print(p) +#endif /* IP_DEBUG */ + +#ifdef __cplusplus +} +#endif + +#endif /* __LWIP_IP_H__ */ + + diff --git a/lib/drivers/lwip/src/include/ipv4/lwip/ip_addr.h b/lib/drivers/lwip/src/include/ipv4/lwip/ip_addr.h new file mode 100644 index 00000000000..77f84e02cfc --- /dev/null +++ b/lib/drivers/lwip/src/include/ipv4/lwip/ip_addr.h @@ -0,0 +1,244 @@ +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ +#ifndef __LWIP_IP_ADDR_H__ +#define __LWIP_IP_ADDR_H__ + +#include "lwip/opt.h" +#include "lwip/def.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* This is the aligned version of ip_addr_t, + used as local variable, on the stack, etc. */ +struct ip_addr { + u32_t addr; +}; + +/* This is the packed version of ip_addr_t, + used in network headers that are itself packed */ +#ifdef PACK_STRUCT_USE_INCLUDES +# include "arch/bpstruct.h" +#endif +PACK_STRUCT_BEGIN +struct ip_addr_packed { + PACK_STRUCT_FIELD(u32_t addr); +} PACK_STRUCT_STRUCT; +PACK_STRUCT_END +#ifdef PACK_STRUCT_USE_INCLUDES +# include "arch/epstruct.h" +#endif + +/** ip_addr_t uses a struct for convenience only, so that the same defines can + * operate both on ip_addr_t as well as on ip_addr_p_t. */ +typedef struct ip_addr ip_addr_t; +typedef struct ip_addr_packed ip_addr_p_t; + +/* + * struct ipaddr2 is used in the definition of the ARP packet format in + * order to support compilers that don't have structure packing. + */ +#ifdef PACK_STRUCT_USE_INCLUDES +# include "arch/bpstruct.h" +#endif +PACK_STRUCT_BEGIN +struct ip_addr2 { + PACK_STRUCT_FIELD(u16_t addrw[2]); +} PACK_STRUCT_STRUCT; +PACK_STRUCT_END +#ifdef PACK_STRUCT_USE_INCLUDES +# include "arch/epstruct.h" +#endif + +/* Forward declaration to not include netif.h */ +struct netif; + +extern const ip_addr_t ip_addr_any; +extern const ip_addr_t ip_addr_broadcast; + +/** IP_ADDR_ can be used as a fixed IP address + * for the wildcard and the broadcast address + */ +#define IP_ADDR_ANY ((ip_addr_t *)&ip_addr_any) +#define IP_ADDR_BROADCAST ((ip_addr_t *)&ip_addr_broadcast) + +/** 255.255.255.255 */ +#define IPADDR_NONE ((u32_t)0xffffffffUL) +/** 127.0.0.1 */ +#define IPADDR_LOOPBACK ((u32_t)0x7f000001UL) +/** 0.0.0.0 */ +#define IPADDR_ANY ((u32_t)0x00000000UL) +/** 255.255.255.255 */ +#define IPADDR_BROADCAST ((u32_t)0xffffffffUL) + +/* Definitions of the bits in an Internet address integer. + + On subnets, host and network parts are found according to + the subnet mask, not these masks. */ +#define IP_CLASSA(a) ((((u32_t)(a)) & 0x80000000UL) == 0) +#define IP_CLASSA_NET 0xff000000 +#define IP_CLASSA_NSHIFT 24 +#define IP_CLASSA_HOST (0xffffffff & ~IP_CLASSA_NET) +#define IP_CLASSA_MAX 128 + +#define IP_CLASSB(a) ((((u32_t)(a)) & 0xc0000000UL) == 0x80000000UL) +#define IP_CLASSB_NET 0xffff0000 +#define IP_CLASSB_NSHIFT 16 +#define IP_CLASSB_HOST (0xffffffff & ~IP_CLASSB_NET) +#define IP_CLASSB_MAX 65536 + +#define IP_CLASSC(a) ((((u32_t)(a)) & 0xe0000000UL) == 0xc0000000UL) +#define IP_CLASSC_NET 0xffffff00 +#define IP_CLASSC_NSHIFT 8 +#define IP_CLASSC_HOST (0xffffffff & ~IP_CLASSC_NET) + +#define IP_CLASSD(a) (((u32_t)(a) & 0xf0000000UL) == 0xe0000000UL) +#define IP_CLASSD_NET 0xf0000000 /* These ones aren't really */ +#define IP_CLASSD_NSHIFT 28 /* net and host fields, but */ +#define IP_CLASSD_HOST 0x0fffffff /* routing needn't know. */ +#define IP_MULTICAST(a) IP_CLASSD(a) + +#define IP_EXPERIMENTAL(a) (((u32_t)(a) & 0xf0000000UL) == 0xf0000000UL) +#define IP_BADCLASS(a) (((u32_t)(a) & 0xf0000000UL) == 0xf0000000UL) + +#define IP_LOOPBACKNET 127 /* official! */ + + +#if BYTE_ORDER == BIG_ENDIAN +/** Set an IP address given by the four byte-parts */ +#define IP4_ADDR(ipaddr, a,b,c,d) \ + (ipaddr)->addr = ((u32_t)((a) & 0xff) << 24) | \ + ((u32_t)((b) & 0xff) << 16) | \ + ((u32_t)((c) & 0xff) << 8) | \ + (u32_t)((d) & 0xff) +#else +/** Set an IP address given by the four byte-parts. + Little-endian version that prevents the use of htonl. */ +#define IP4_ADDR(ipaddr, a,b,c,d) \ + (ipaddr)->addr = ((u32_t)((d) & 0xff) << 24) | \ + ((u32_t)((c) & 0xff) << 16) | \ + ((u32_t)((b) & 0xff) << 8) | \ + (u32_t)((a) & 0xff) +#endif + +/** MEMCPY-like copying of IP addresses where addresses are known to be + * 16-bit-aligned if the port is correctly configured (so a port could define + * this to copying 2 u16_t's) - no NULL-pointer-checking needed. */ +#ifndef IPADDR2_COPY +#define IPADDR2_COPY(dest, src) SMEMCPY(dest, src, sizeof(ip_addr_t)) +#endif + +/** Copy IP address - faster than ip_addr_set: no NULL check */ +#define ip_addr_copy(dest, src) ((dest).addr = (src).addr) +/** Safely copy one IP address to another (src may be NULL) */ +#define ip_addr_set(dest, src) ((dest)->addr = \ + ((src) == NULL ? 0 : \ + (src)->addr)) +/** Set complete address to zero */ +#define ip_addr_set_zero(ipaddr) ((ipaddr)->addr = 0) +/** Set address to IPADDR_ANY (no need for htonl()) */ +#define ip_addr_set_any(ipaddr) ((ipaddr)->addr = IPADDR_ANY) +/** Set address to loopback address */ +#define ip_addr_set_loopback(ipaddr) ((ipaddr)->addr = PP_HTONL(IPADDR_LOOPBACK)) +/** Safely copy one IP address to another and change byte order + * from host- to network-order. */ +#define ip_addr_set_hton(dest, src) ((dest)->addr = \ + ((src) == NULL ? 0:\ + htonl((src)->addr))) +/** IPv4 only: set the IP address given as an u32_t */ +#define ip4_addr_set_u32(dest_ipaddr, src_u32) ((dest_ipaddr)->addr = (src_u32)) +/** IPv4 only: get the IP address as an u32_t */ +#define ip4_addr_get_u32(src_ipaddr) ((src_ipaddr)->addr) + +/** Get the network address by combining host address with netmask */ +#define ip_addr_get_network(target, host, netmask) ((target)->addr = ((host)->addr) & ((netmask)->addr)) + +/** + * Determine if two address are on the same network. + * + * @arg addr1 IP address 1 + * @arg addr2 IP address 2 + * @arg mask network identifier mask + * @return !0 if the network identifiers of both address match + */ +#define ip_addr_netcmp(addr1, addr2, mask) (((addr1)->addr & \ + (mask)->addr) == \ + ((addr2)->addr & \ + (mask)->addr)) +#define ip_addr_cmp(addr1, addr2) ((addr1)->addr == (addr2)->addr) + +#define ip_addr_isany(addr1) ((addr1) == NULL || (addr1)->addr == IPADDR_ANY) + +#define ip_addr_isbroadcast(ipaddr, netif) ip4_addr_isbroadcast((ipaddr)->addr, (netif)) +u8_t ip4_addr_isbroadcast(u32_t addr, const struct netif *netif); + +#define ip_addr_netmask_valid(netmask) ip4_addr_netmask_valid((netmask)->addr) +u8_t ip4_addr_netmask_valid(u32_t netmask); + +#define ip_addr_ismulticast(addr1) (((addr1)->addr & PP_HTONL(0xf0000000UL)) == PP_HTONL(0xe0000000UL)) + +#define ip_addr_islinklocal(addr1) (((addr1)->addr & PP_HTONL(0xffff0000UL)) == PP_HTONL(0xa9fe0000UL)) + +#define ip_addr_debug_print(debug, ipaddr) \ + LWIP_DEBUGF(debug, ("%"U16_F".%"U16_F".%"U16_F".%"U16_F, \ + ipaddr != NULL ? ip4_addr1_16(ipaddr) : 0, \ + ipaddr != NULL ? ip4_addr2_16(ipaddr) : 0, \ + ipaddr != NULL ? ip4_addr3_16(ipaddr) : 0, \ + ipaddr != NULL ? ip4_addr4_16(ipaddr) : 0)) + +/* Get one byte from the 4-byte address */ +#define ip4_addr1(ipaddr) (((u8_t*)(ipaddr))[0]) +#define ip4_addr2(ipaddr) (((u8_t*)(ipaddr))[1]) +#define ip4_addr3(ipaddr) (((u8_t*)(ipaddr))[2]) +#define ip4_addr4(ipaddr) (((u8_t*)(ipaddr))[3]) +/* These are cast to u16_t, with the intent that they are often arguments + * to printf using the U16_F format from cc.h. */ +#define ip4_addr1_16(ipaddr) ((u16_t)ip4_addr1(ipaddr)) +#define ip4_addr2_16(ipaddr) ((u16_t)ip4_addr2(ipaddr)) +#define ip4_addr3_16(ipaddr) ((u16_t)ip4_addr3(ipaddr)) +#define ip4_addr4_16(ipaddr) ((u16_t)ip4_addr4(ipaddr)) + +/** For backwards compatibility */ +#define ip_ntoa(ipaddr) ipaddr_ntoa(ipaddr) + +u32_t ipaddr_addr(const char *cp); +int ipaddr_aton(const char *cp, ip_addr_t *addr); +/** returns ptr to static buffer; not reentrant! */ +char *ipaddr_ntoa(const ip_addr_t *addr); +char *ipaddr_ntoa_r(const ip_addr_t *addr, char *buf, int buflen); + +#ifdef __cplusplus +} +#endif + +#endif /* __LWIP_IP_ADDR_H__ */ diff --git a/lib/drivers/lwip/src/include/ipv4/lwip/ip_frag.h b/lib/drivers/lwip/src/include/ipv4/lwip/ip_frag.h new file mode 100644 index 00000000000..77b5eb1eef7 --- /dev/null +++ b/lib/drivers/lwip/src/include/ipv4/lwip/ip_frag.h @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Jani Monoses + * + */ + +#ifndef __LWIP_IP_FRAG_H__ +#define __LWIP_IP_FRAG_H__ + +#include "lwip/opt.h" +#include "lwip/err.h" +#include "lwip/pbuf.h" +#include "lwip/netif.h" +#include "lwip/ip_addr.h" +#include "lwip/ip.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#if IP_REASSEMBLY +/* The IP reassembly timer interval in milliseconds. */ +#define IP_TMR_INTERVAL 1000 + +/* IP reassembly helper struct. + * This is exported because memp needs to know the size. + */ +struct ip_reassdata { + struct ip_reassdata *next; + struct pbuf *p; + struct ip_hdr iphdr; + u16_t datagram_len; + u8_t flags; + u8_t timer; +}; + +void ip_reass_init(void); +void ip_reass_tmr(void); +struct pbuf * ip_reass(struct pbuf *p); +#endif /* IP_REASSEMBLY */ + +#if IP_FRAG +#if !IP_FRAG_USES_STATIC_BUF && !LWIP_NETIF_TX_SINGLE_PBUF +/** A custom pbuf that holds a reference to another pbuf, which is freed + * when this custom pbuf is freed. This is used to create a custom PBUF_REF + * that points into the original pbuf. */ +struct pbuf_custom_ref { + /** 'base class' */ + struct pbuf_custom pc; + /** pointer to the original pbuf that is referenced */ + struct pbuf *original; +}; +#endif /* !IP_FRAG_USES_STATIC_BUF && !LWIP_NETIF_TX_SINGLE_PBUF */ + +err_t ip_frag(struct pbuf *p, struct netif *netif, ip_addr_t *dest); +#endif /* IP_FRAG */ + +#ifdef __cplusplus +} +#endif + +#endif /* __LWIP_IP_FRAG_H__ */ diff --git a/lib/drivers/lwip/src/include/ipv6/lwip/icmp.h b/lib/drivers/lwip/src/include/ipv6/lwip/icmp.h new file mode 100644 index 00000000000..87e9ffd9640 --- /dev/null +++ b/lib/drivers/lwip/src/include/ipv6/lwip/icmp.h @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ +#ifndef __LWIP_ICMP_H__ +#define __LWIP_ICMP_H__ + +#include "lwip/opt.h" + +#if LWIP_ICMP /* don't build if not configured for use in lwipopts.h */ + +#include "lwip/pbuf.h" +#include "lwip/netif.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define ICMP6_DUR 1 +#define ICMP6_TE 3 +#define ICMP6_ECHO 128 /* echo */ +#define ICMP6_ER 129 /* echo reply */ + + +enum icmp_dur_type { + ICMP_DUR_NET = 0, /* net unreachable */ + ICMP_DUR_HOST = 1, /* host unreachable */ + ICMP_DUR_PROTO = 2, /* protocol unreachable */ + ICMP_DUR_PORT = 3, /* port unreachable */ + ICMP_DUR_FRAG = 4, /* fragmentation needed and DF set */ + ICMP_DUR_SR = 5 /* source route failed */ +}; + +enum icmp_te_type { + ICMP_TE_TTL = 0, /* time to live exceeded in transit */ + ICMP_TE_FRAG = 1 /* fragment reassembly time exceeded */ +}; + +void icmp_input(struct pbuf *p, struct netif *inp); + +void icmp_dest_unreach(struct pbuf *p, enum icmp_dur_type t); +void icmp_time_exceeded(struct pbuf *p, enum icmp_te_type t); + +struct icmp_echo_hdr { + u8_t type; + u8_t icode; + u16_t chksum; + u16_t id; + u16_t seqno; +}; + +struct icmp_dur_hdr { + u8_t type; + u8_t icode; + u16_t chksum; + u32_t unused; +}; + +struct icmp_te_hdr { + u8_t type; + u8_t icode; + u16_t chksum; + u32_t unused; +}; + +#ifdef __cplusplus +} +#endif + +#endif /* LWIP_ICMP */ + +#endif /* __LWIP_ICMP_H__ */ + diff --git a/lib/drivers/lwip/src/include/ipv6/lwip/inet.h b/lib/drivers/lwip/src/include/ipv6/lwip/inet.h new file mode 100644 index 00000000000..de1a0b63611 --- /dev/null +++ b/lib/drivers/lwip/src/include/ipv6/lwip/inet.h @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ +#ifndef __LWIP_INET_H__ +#define __LWIP_INET_H__ + +#include "lwip/opt.h" +#include "lwip/pbuf.h" +#include "lwip/ip_addr.h" + +#ifdef __cplusplus +extern "C" { +#endif + +u16_t inet_chksum(void *data, u16_t len); +u16_t inet_chksum_pbuf(struct pbuf *p); +u16_t inet_chksum_pseudo(struct pbuf *p, + struct ip_addr *src, struct ip_addr *dest, + u8_t proto, u32_t proto_len); + +u32_t inet_addr(const char *cp); +s8_t inet_aton(const char *cp, struct in_addr *addr); + +#ifndef _MACHINE_ENDIAN_H_ +#ifndef _NETINET_IN_H +#ifndef _LINUX_BYTEORDER_GENERIC_H +u16_t htons(u16_t n); +u16_t ntohs(u16_t n); +u32_t htonl(u32_t n); +u32_t ntohl(u32_t n); +#endif /* _LINUX_BYTEORDER_GENERIC_H */ +#endif /* _NETINET_IN_H */ +#endif /* _MACHINE_ENDIAN_H_ */ + +#ifdef __cplusplus +} +#endif + +#endif /* __LWIP_INET_H__ */ + diff --git a/lib/drivers/lwip/src/include/ipv6/lwip/ip.h b/lib/drivers/lwip/src/include/ipv6/lwip/ip.h new file mode 100644 index 00000000000..a01cfc65b3a --- /dev/null +++ b/lib/drivers/lwip/src/include/ipv6/lwip/ip.h @@ -0,0 +1,130 @@ +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ +#ifndef __LWIP_IP_H__ +#define __LWIP_IP_H__ + +#include "lwip/opt.h" +#include "lwip/def.h" +#include "lwip/pbuf.h" +#include "lwip/ip_addr.h" + +#include "lwip/err.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define IP_HLEN 40 + +#define IP_PROTO_ICMP 58 +#define IP_PROTO_UDP 17 +#define IP_PROTO_UDPLITE 136 +#define IP_PROTO_TCP 6 + +/* This is passed as the destination address to ip_output_if (not + to ip_output), meaning that an IP header already is constructed + in the pbuf. This is used when TCP retransmits. */ +#ifdef IP_HDRINCL +#undef IP_HDRINCL +#endif /* IP_HDRINCL */ +#define IP_HDRINCL NULL + +#if LWIP_NETIF_HWADDRHINT +#define IP_PCB_ADDRHINT ;u8_t addr_hint +#else +#define IP_PCB_ADDRHINT +#endif /* LWIP_NETIF_HWADDRHINT */ + +/* This is the common part of all PCB types. It needs to be at the + beginning of a PCB type definition. It is located here so that + changes to this common part are made in one location instead of + having to change all PCB structs. */ +#define IP_PCB struct ip_addr local_ip; \ + struct ip_addr remote_ip; \ + /* Socket options */ \ + u16_t so_options; \ + /* Type Of Service */ \ + u8_t tos; \ + /* Time To Live */ \ + u8_t ttl; \ + /* link layer address resolution hint */ \ + IP_PCB_ADDRHINT + + +/* The IPv6 header. */ +struct ip_hdr { +#if BYTE_ORDER == LITTLE_ENDIAN + u8_t tclass1:4, v:4; + u8_t flow1:4, tclass2:4; +#else + u8_t v:4, tclass1:4; + u8_t tclass2:8, flow1:4; +#endif + u16_t flow2; + u16_t len; /* payload length */ + u8_t nexthdr; /* next header */ + u8_t hoplim; /* hop limit (TTL) */ + struct ip_addr src, dest; /* source and destination IP addresses */ +}; + +#define IPH_PROTO(hdr) (iphdr->nexthdr) + +void ip_init(void); + +#include "lwip/netif.h" + +struct netif *ip_route(struct ip_addr *dest); + +void ip_input(struct pbuf *p, struct netif *inp); + +/* source and destination addresses in network byte order, please */ +err_t ip_output(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest, + u8_t ttl, u8_t proto); + +err_t ip_output_if(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest, + u8_t ttl, u8_t proto, + struct netif *netif); + +#define ip_current_netif() NULL +#define ip_current_header() NULL + +#if IP_DEBUG +void ip_debug_print(struct pbuf *p); +#endif /* IP_DEBUG */ + +#ifdef __cplusplus +} +#endif + +#endif /* __LWIP_IP_H__ */ + + diff --git a/lib/drivers/lwip/src/include/ipv6/lwip/ip_addr.h b/lib/drivers/lwip/src/include/ipv6/lwip/ip_addr.h new file mode 100644 index 00000000000..b2d8ae566d7 --- /dev/null +++ b/lib/drivers/lwip/src/include/ipv6/lwip/ip_addr.h @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ +#ifndef __LWIP_IP_ADDR_H__ +#define __LWIP_IP_ADDR_H__ + +#include "lwip/opt.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define IP_ADDR_ANY 0 + +#ifdef PACK_STRUCT_USE_INCLUDES +# include "arch/bpstruct.h" +#endif +PACK_STRUCT_BEGIN + struct ip_addr { + PACK_STRUCT_FIELD(u32_t addr[4]); +} PACK_STRUCT_STRUCT; +PACK_STRUCT_END +#ifdef PACK_STRUCT_USE_INCLUDES +# include "arch/epstruct.h" +#endif + +/* + * struct ipaddr2 is used in the definition of the ARP packet format in + * order to support compilers that don't have structure packing. + */ +#ifdef PACK_STRUCT_USE_INCLUDES +# include "arch/bpstruct.h" +#endif +PACK_STRUCT_BEGIN +struct ip_addr2 { + PACK_STRUCT_FIELD(u16_t addrw[2]); +} PACK_STRUCT_STRUCT; +PACK_STRUCT_END +#ifdef PACK_STRUCT_USE_INCLUDES +# include "arch/epstruct.h" +#endif + +#define IP6_ADDR(ipaddr, a,b,c,d,e,f,g,h) do { (ipaddr)->addr[0] = htonl((u32_t)((a & 0xffff) << 16) | (b & 0xffff)); \ + (ipaddr)->addr[1] = htonl(((c & 0xffff) << 16) | (d & 0xffff)); \ + (ipaddr)->addr[2] = htonl(((e & 0xffff) << 16) | (f & 0xffff)); \ + (ipaddr)->addr[3] = htonl(((g & 0xffff) << 16) | (h & 0xffff)); } while(0) + +u8_t ip_addr_netcmp(struct ip_addr *addr1, struct ip_addr *addr2, + struct ip_addr *mask); +u8_t ip_addr_cmp(struct ip_addr *addr1, struct ip_addr *addr2); +void ip_addr_set(struct ip_addr *dest, struct ip_addr *src); +u8_t ip_addr_isany(struct ip_addr *addr); + +#define ip_addr_debug_print(debug, ipaddr) \ + LWIP_DEBUGF(debug, ("%"X32_F":%"X32_F":%"X32_F":%"X32_F":%"X32_F":%"X32_F":%"X32_F":%"X32_F"\n", \ + (ntohl(ipaddr->addr[0]) >> 16) & 0xffff, \ + ntohl(ipaddr->addr[0]) & 0xffff, \ + (ntohl(ipaddr->addr[1]) >> 16) & 0xffff, \ + ntohl(ipaddr->addr[1]) & 0xffff, \ + (ntohl(ipaddr->addr[2]) >> 16) & 0xffff, \ + ntohl(ipaddr->addr[2]) & 0xffff, \ + (ntohl(ipaddr->addr[3]) >> 16) & 0xffff, \ + ntohl(ipaddr->addr[3]) & 0xffff)); + +#ifdef __cplusplus +} +#endif + +#endif /* __LWIP_IP_ADDR_H__ */ diff --git a/lib/drivers/lwip/src/include/lwip/api.h b/lib/drivers/lwip/src/include/lwip/api.h new file mode 100644 index 00000000000..91b9e5d2435 --- /dev/null +++ b/lib/drivers/lwip/src/include/lwip/api.h @@ -0,0 +1,284 @@ +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ +#ifndef __LWIP_API_H__ +#define __LWIP_API_H__ + +#include "lwip/opt.h" + +#if LWIP_NETCONN /* don't build if not configured for use in lwipopts.h */ + +#include /* for size_t */ + +#include "lwip/netbuf.h" +#include "lwip/sys.h" +#include "lwip/ip_addr.h" +#include "lwip/err.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Throughout this file, IP addresses and port numbers are expected to be in + * the same byte order as in the corresponding pcb. + */ + +/* Flags for netconn_write (u8_t) */ +#define NETCONN_NOFLAG 0x00 +#define NETCONN_NOCOPY 0x00 /* Only for source code compatibility */ +#define NETCONN_COPY 0x01 +#define NETCONN_MORE 0x02 +#define NETCONN_DONTBLOCK 0x04 + +/* Flags for struct netconn.flags (u8_t) */ +/** TCP: when data passed to netconn_write doesn't fit into the send buffer, + this temporarily stores whether to wake up the original application task + if data couldn't be sent in the first try. */ +#define NETCONN_FLAG_WRITE_DELAYED 0x01 +/** Should this netconn avoid blocking? */ +#define NETCONN_FLAG_NON_BLOCKING 0x02 +/** Was the last connect action a non-blocking one? */ +#define NETCONN_FLAG_IN_NONBLOCKING_CONNECT 0x04 +/** If this is set, a TCP netconn must call netconn_recved() to update + the TCP receive window (done automatically if not set). */ +#define NETCONN_FLAG_NO_AUTO_RECVED 0x08 +/** If a nonblocking write has been rejected before, poll_tcp needs to + check if the netconn is writable again */ +#define NETCONN_FLAG_CHECK_WRITESPACE 0x10 + + +/* Helpers to process several netconn_types by the same code */ +#define NETCONNTYPE_GROUP(t) (t&0xF0) +#define NETCONNTYPE_DATAGRAM(t) (t&0xE0) + +/** Protocol family and type of the netconn */ +enum netconn_type { + NETCONN_INVALID = 0, + /* NETCONN_TCP Group */ + NETCONN_TCP = 0x10, + /* NETCONN_UDP Group */ + NETCONN_UDP = 0x20, + NETCONN_UDPLITE = 0x21, + NETCONN_UDPNOCHKSUM= 0x22, + /* NETCONN_RAW Group */ + NETCONN_RAW = 0x40 +}; + +/** Current state of the netconn. Non-TCP netconns are always + * in state NETCONN_NONE! */ +enum netconn_state { + NETCONN_NONE, + NETCONN_WRITE, + NETCONN_LISTEN, + NETCONN_CONNECT, + NETCONN_CLOSE +}; + +/** Use to inform the callback function about changes */ +enum netconn_evt { + NETCONN_EVT_RCVPLUS, + NETCONN_EVT_RCVMINUS, + NETCONN_EVT_SENDPLUS, + NETCONN_EVT_SENDMINUS, + NETCONN_EVT_ERROR +}; + +#if LWIP_IGMP +/** Used for netconn_join_leave_group() */ +enum netconn_igmp { + NETCONN_JOIN, + NETCONN_LEAVE +}; +#endif /* LWIP_IGMP */ + +/* forward-declare some structs to avoid to include their headers */ +struct ip_pcb; +struct tcp_pcb; +struct udp_pcb; +struct raw_pcb; +struct netconn; +struct api_msg_msg; + +/** A callback prototype to inform about events for a netconn */ +typedef void (* netconn_callback)(struct netconn *, enum netconn_evt, u16_t len); + +/** A netconn descriptor */ +struct netconn { + /** type of the netconn (TCP, UDP or RAW) */ + enum netconn_type type; + /** current state of the netconn */ + enum netconn_state state; + /** the lwIP internal protocol control block */ + union { + struct ip_pcb *ip; + struct tcp_pcb *tcp; + struct udp_pcb *udp; + struct raw_pcb *raw; + } pcb; + /** the last error this netconn had */ + err_t last_err; + /** sem that is used to synchroneously execute functions in the core context */ + sys_sem_t op_completed; + /** mbox where received packets are stored until they are fetched + by the netconn application thread (can grow quite big) */ + sys_mbox_t recvmbox; +#if LWIP_TCP + /** mbox where new connections are stored until processed + by the application thread */ + sys_mbox_t acceptmbox; +#endif /* LWIP_TCP */ + /** only used for socket layer */ +#if LWIP_SOCKET + int socket; +#endif /* LWIP_SOCKET */ +#if LWIP_SO_RCVTIMEO + /** timeout to wait for new data to be received + (or connections to arrive for listening netconns) */ + int recv_timeout; +#endif /* LWIP_SO_RCVTIMEO */ +#if LWIP_SO_RCVBUF + /** maximum amount of bytes queued in recvmbox + not used for TCP: adjust TCP_WND instead! */ + int recv_bufsize; + /** number of bytes currently in recvmbox to be received, + tested against recv_bufsize to limit bytes on recvmbox + for UDP and RAW, used for FIONREAD */ + s16_t recv_avail; +#endif /* LWIP_SO_RCVBUF */ + /** flags holding more netconn-internal state, see NETCONN_FLAG_* defines */ + u8_t flags; +#if LWIP_TCP + /** TCP: when data passed to netconn_write doesn't fit into the send buffer, + this temporarily stores how much is already sent. */ + size_t write_offset; + /** TCP: when data passed to netconn_write doesn't fit into the send buffer, + this temporarily stores the message. + Also used during connect and close. */ + struct api_msg_msg *current_msg; +#endif /* LWIP_TCP */ + /** A callback function that is informed about events for this netconn */ + netconn_callback callback; +}; + +/** Register an Network connection event */ +#define API_EVENT(c,e,l) if (c->callback) { \ + (*c->callback)(c, e, l); \ + } + +/** Set conn->last_err to err but don't overwrite fatal errors */ +#define NETCONN_SET_SAFE_ERR(conn, err) do { \ + SYS_ARCH_DECL_PROTECT(lev); \ + SYS_ARCH_PROTECT(lev); \ + if (!ERR_IS_FATAL((conn)->last_err)) { \ + (conn)->last_err = err; \ + } \ + SYS_ARCH_UNPROTECT(lev); \ +} while(0); + +/* Network connection functions: */ +#define netconn_new(t) netconn_new_with_proto_and_callback(t, 0, NULL) +#define netconn_new_with_callback(t, c) netconn_new_with_proto_and_callback(t, 0, c) +struct +netconn *netconn_new_with_proto_and_callback(enum netconn_type t, u8_t proto, + netconn_callback callback); +err_t netconn_delete(struct netconn *conn); +/** Get the type of a netconn (as enum netconn_type). */ +#define netconn_type(conn) (conn->type) + +err_t netconn_getaddr(struct netconn *conn, ip_addr_t *addr, + u16_t *port, u8_t local); +#define netconn_peer(c,i,p) netconn_getaddr(c,i,p,0) +#define netconn_addr(c,i,p) netconn_getaddr(c,i,p,1) + +err_t netconn_bind(struct netconn *conn, ip_addr_t *addr, u16_t port); +err_t netconn_connect(struct netconn *conn, ip_addr_t *addr, u16_t port); +err_t netconn_disconnect (struct netconn *conn); +err_t netconn_listen_with_backlog(struct netconn *conn, u8_t backlog); +#define netconn_listen(conn) netconn_listen_with_backlog(conn, TCP_DEFAULT_LISTEN_BACKLOG) +err_t netconn_accept(struct netconn *conn, struct netconn **new_conn); +err_t netconn_recv(struct netconn *conn, struct netbuf **new_buf); +err_t netconn_recv_tcp_pbuf(struct netconn *conn, struct pbuf **new_buf); +void netconn_recved(struct netconn *conn, u32_t length); +err_t netconn_sendto(struct netconn *conn, struct netbuf *buf, + ip_addr_t *addr, u16_t port); +err_t netconn_send(struct netconn *conn, struct netbuf *buf); +err_t netconn_write(struct netconn *conn, const void *dataptr, size_t size, + u8_t apiflags); +err_t netconn_close(struct netconn *conn); +err_t netconn_shutdown(struct netconn *conn, u8_t shut_rx, u8_t shut_tx); + +#if LWIP_IGMP +err_t netconn_join_leave_group(struct netconn *conn, ip_addr_t *multiaddr, + ip_addr_t *netif_addr, enum netconn_igmp join_or_leave); +#endif /* LWIP_IGMP */ +#if LWIP_DNS +err_t netconn_gethostbyname(const char *name, ip_addr_t *addr); +#endif /* LWIP_DNS */ + +#define netconn_err(conn) ((conn)->last_err) +#define netconn_recv_bufsize(conn) ((conn)->recv_bufsize) + +/** Set the blocking status of netconn calls (@todo: write/send is missing) */ +#define netconn_set_nonblocking(conn, val) do { if(val) { \ + (conn)->flags |= NETCONN_FLAG_NON_BLOCKING; \ +} else { \ + (conn)->flags &= ~ NETCONN_FLAG_NON_BLOCKING; }} while(0) +/** Get the blocking status of netconn calls (@todo: write/send is missing) */ +#define netconn_is_nonblocking(conn) (((conn)->flags & NETCONN_FLAG_NON_BLOCKING) != 0) + +/** TCP: Set the no-auto-recved status of netconn calls (see NETCONN_FLAG_NO_AUTO_RECVED) */ +#define netconn_set_noautorecved(conn, val) do { if(val) { \ + (conn)->flags |= NETCONN_FLAG_NO_AUTO_RECVED; \ +} else { \ + (conn)->flags &= ~ NETCONN_FLAG_NO_AUTO_RECVED; }} while(0) +/** TCP: Get the no-auto-recved status of netconn calls (see NETCONN_FLAG_NO_AUTO_RECVED) */ +#define netconn_get_noautorecved(conn) (((conn)->flags & NETCONN_FLAG_NO_AUTO_RECVED) != 0) + +#if LWIP_SO_RCVTIMEO +/** Set the receive timeout in milliseconds */ +#define netconn_set_recvtimeout(conn, timeout) ((conn)->recv_timeout = (timeout)) +/** Get the receive timeout in milliseconds */ +#define netconn_get_recvtimeout(conn) ((conn)->recv_timeout) +#endif /* LWIP_SO_RCVTIMEO */ +#if LWIP_SO_RCVBUF +/** Set the receive buffer in bytes */ +#define netconn_set_recvbufsize(conn, recvbufsize) ((conn)->recv_bufsize = (recvbufsize)) +/** Get the receive buffer in bytes */ +#define netconn_get_recvbufsize(conn) ((conn)->recv_bufsize) +#endif /* LWIP_SO_RCVBUF*/ + +#ifdef __cplusplus +} +#endif + +#endif /* LWIP_NETCONN */ + +#endif /* __LWIP_API_H__ */ diff --git a/lib/drivers/lwip/src/include/lwip/api_msg.h b/lib/drivers/lwip/src/include/lwip/api_msg.h new file mode 100644 index 00000000000..f99d8c3b719 --- /dev/null +++ b/lib/drivers/lwip/src/include/lwip/api_msg.h @@ -0,0 +1,174 @@ +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ +#ifndef __LWIP_API_MSG_H__ +#define __LWIP_API_MSG_H__ + +#include "lwip/opt.h" + +#if LWIP_NETCONN /* don't build if not configured for use in lwipopts.h */ + +#include /* for size_t */ + +#include "lwip/ip_addr.h" +#include "lwip/err.h" +#include "lwip/sys.h" +#include "lwip/igmp.h" +#include "lwip/api.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* For the netconn API, these values are use as a bitmask! */ +#define NETCONN_SHUT_RD 1 +#define NETCONN_SHUT_WR 2 +#define NETCONN_SHUT_RDWR (NETCONN_SHUT_RD | NETCONN_SHUT_WR) + +/* IP addresses and port numbers are expected to be in + * the same byte order as in the corresponding pcb. + */ +/** This struct includes everything that is necessary to execute a function + for a netconn in another thread context (mainly used to process netconns + in the tcpip_thread context to be thread safe). */ +struct api_msg_msg { + /** The netconn which to process - always needed: it includes the semaphore + which is used to block the application thread until the function finished. */ + struct netconn *conn; + /** The return value of the function executed in tcpip_thread. */ + err_t err; + /** Depending on the executed function, one of these union members is used */ + union { + /** used for do_send */ + struct netbuf *b; + /** used for do_newconn */ + struct { + u8_t proto; + } n; + /** used for do_bind and do_connect */ + struct { + ip_addr_t *ipaddr; + u16_t port; + } bc; + /** used for do_getaddr */ + struct { + ip_addr_t *ipaddr; + u16_t *port; + u8_t local; + } ad; + /** used for do_write */ + struct { + const void *dataptr; + size_t len; + u8_t apiflags; + } w; + /** used for do_recv */ + struct { + u32_t len; + } r; + /** used for do_close (/shutdown) */ + struct { + u8_t shut; + } sd; +#if LWIP_IGMP + /** used for do_join_leave_group */ + struct { + ip_addr_t *multiaddr; + ip_addr_t *netif_addr; + enum netconn_igmp join_or_leave; + } jl; +#endif /* LWIP_IGMP */ +#if TCP_LISTEN_BACKLOG + struct { + u8_t backlog; + } lb; +#endif /* TCP_LISTEN_BACKLOG */ + } msg; +}; + +/** This struct contains a function to execute in another thread context and + a struct api_msg_msg that serves as an argument for this function. + This is passed to tcpip_apimsg to execute functions in tcpip_thread context. */ +struct api_msg { + /** function to execute in tcpip_thread context */ + void (* function)(struct api_msg_msg *msg); + /** arguments for this function */ + struct api_msg_msg msg; +}; + +#if LWIP_DNS +/** As do_gethostbyname requires more arguments but doesn't require a netconn, + it has its own struct (to avoid struct api_msg getting bigger than necessary). + do_gethostbyname must be called using tcpip_callback instead of tcpip_apimsg + (see netconn_gethostbyname). */ +struct dns_api_msg { + /** Hostname to query or dotted IP address string */ + const char *name; + /** Rhe resolved address is stored here */ + ip_addr_t *addr; + /** This semaphore is posted when the name is resolved, the application thread + should wait on it. */ + sys_sem_t *sem; + /** Errors are given back here */ + err_t *err; +}; +#endif /* LWIP_DNS */ + +void do_newconn ( struct api_msg_msg *msg); +void do_delconn ( struct api_msg_msg *msg); +void do_bind ( struct api_msg_msg *msg); +void do_connect ( struct api_msg_msg *msg); +void do_disconnect ( struct api_msg_msg *msg); +void do_listen ( struct api_msg_msg *msg); +void do_send ( struct api_msg_msg *msg); +void do_recv ( struct api_msg_msg *msg); +void do_write ( struct api_msg_msg *msg); +void do_getaddr ( struct api_msg_msg *msg); +void do_close ( struct api_msg_msg *msg); +void do_shutdown ( struct api_msg_msg *msg); +#if LWIP_IGMP +void do_join_leave_group( struct api_msg_msg *msg); +#endif /* LWIP_IGMP */ + +#if LWIP_DNS +void do_gethostbyname(void *arg); +#endif /* LWIP_DNS */ + +struct netconn* netconn_alloc(enum netconn_type t, netconn_callback callback); +void netconn_free(struct netconn *conn); + +#ifdef __cplusplus +} +#endif + +#endif /* LWIP_NETCONN */ + +#endif /* __LWIP_API_MSG_H__ */ diff --git a/lib/drivers/lwip/src/include/lwip/arch.h b/lib/drivers/lwip/src/include/lwip/arch.h new file mode 100644 index 00000000000..524af6be038 --- /dev/null +++ b/lib/drivers/lwip/src/include/lwip/arch.h @@ -0,0 +1,238 @@ +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ +#ifndef __LWIP_ARCH_H__ +#define __LWIP_ARCH_H__ + +#ifndef LITTLE_ENDIAN +#define LITTLE_ENDIAN 1234 +#endif + +#ifndef BIG_ENDIAN +#define BIG_ENDIAN 4321 +#endif + +#include "arch/cc.h" + +/** Temporary: define format string for size_t if not defined in cc.h */ +#ifndef SZT_F +#define SZT_F U32_F +#endif /* SZT_F */ +/** Temporary upgrade helper: define format string for u8_t as hex if not + defined in cc.h */ +#ifndef X8_F +#define X8_F "02x" +#endif /* X8_F */ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef PACK_STRUCT_BEGIN +#define PACK_STRUCT_BEGIN +#endif /* PACK_STRUCT_BEGIN */ + +#ifndef PACK_STRUCT_END +#define PACK_STRUCT_END +#endif /* PACK_STRUCT_END */ + +#ifndef PACK_STRUCT_FIELD +#define PACK_STRUCT_FIELD(x) x +#endif /* PACK_STRUCT_FIELD */ + + +#ifndef LWIP_UNUSED_ARG +#define LWIP_UNUSED_ARG(x) (void)x +#endif /* LWIP_UNUSED_ARG */ + + +#ifdef LWIP_PROVIDE_ERRNO + +#define EPERM 1 /* Operation not permitted */ +#define ENOENT 2 /* No such file or directory */ +#define ESRCH 3 /* No such process */ +#define EINTR 4 /* Interrupted system call */ +#define EIO 5 /* I/O error */ +#define ENXIO 6 /* No such device or address */ +#define E2BIG 7 /* Arg list too long */ +#define ENOEXEC 8 /* Exec format error */ +#define EBADF 9 /* Bad file number */ +#define ECHILD 10 /* No child processes */ +#define EAGAIN 11 /* Try again */ +#define ENOMEM 12 /* Out of memory */ +#define EACCES 13 /* Permission denied */ +#define EFAULT 14 /* Bad address */ +#define ENOTBLK 15 /* Block device required */ +#define EBUSY 16 /* Device or resource busy */ +#define EEXIST 17 /* File exists */ +#define EXDEV 18 /* Cross-device link */ +#define ENODEV 19 /* No such device */ +#define ENOTDIR 20 /* Not a directory */ +#define EISDIR 21 /* Is a directory */ +#define EINVAL 22 /* Invalid argument */ +#define ENFILE 23 /* File table overflow */ +#define EMFILE 24 /* Too many open files */ +#define ENOTTY 25 /* Not a typewriter */ +#define ETXTBSY 26 /* Text file busy */ +#define EFBIG 27 /* File too large */ +#define ENOSPC 28 /* No space left on device */ +#define ESPIPE 29 /* Illegal seek */ +#define EROFS 30 /* Read-only file system */ +#define EMLINK 31 /* Too many links */ +#define EPIPE 32 /* Broken pipe */ +#define EDOM 33 /* Math argument out of domain of func */ +#define ERANGE 34 /* Math result not representable */ +#define EDEADLK 35 /* Resource deadlock would occur */ +#define ENAMETOOLONG 36 /* File name too long */ +#define ENOLCK 37 /* No record locks available */ +#define ENOSYS 38 /* Function not implemented */ +#define ENOTEMPTY 39 /* Directory not empty */ +#define ELOOP 40 /* Too many symbolic links encountered */ +#define EWOULDBLOCK EAGAIN /* Operation would block */ +#define ENOMSG 42 /* No message of desired type */ +#define EIDRM 43 /* Identifier removed */ +#define ECHRNG 44 /* Channel number out of range */ +#define EL2NSYNC 45 /* Level 2 not synchronized */ +#define EL3HLT 46 /* Level 3 halted */ +#define EL3RST 47 /* Level 3 reset */ +#define ELNRNG 48 /* Link number out of range */ +#define EUNATCH 49 /* Protocol driver not attached */ +#define ENOCSI 50 /* No CSI structure available */ +#define EL2HLT 51 /* Level 2 halted */ +#define EBADE 52 /* Invalid exchange */ +#define EBADR 53 /* Invalid request descriptor */ +#define EXFULL 54 /* Exchange full */ +#define ENOANO 55 /* No anode */ +#define EBADRQC 56 /* Invalid request code */ +#define EBADSLT 57 /* Invalid slot */ + +#define EDEADLOCK EDEADLK + +#define EBFONT 59 /* Bad font file format */ +#define ENOSTR 60 /* Device not a stream */ +#define ENODATA 61 /* No data available */ +#define ETIME 62 /* Timer expired */ +#define ENOSR 63 /* Out of streams resources */ +#define ENONET 64 /* Machine is not on the network */ +#define ENOPKG 65 /* Package not installed */ +#define EREMOTE 66 /* Object is remote */ +#define ENOLINK 67 /* Link has been severed */ +#define EADV 68 /* Advertise error */ +#define ESRMNT 69 /* Srmount error */ +#define ECOMM 70 /* Communication error on send */ +#define EPROTO 71 /* Protocol error */ +#define EMULTIHOP 72 /* Multihop attempted */ +#define EDOTDOT 73 /* RFS specific error */ +#define EBADMSG 74 /* Not a data message */ +#define EOVERFLOW 75 /* Value too large for defined data type */ +#define ENOTUNIQ 76 /* Name not unique on network */ +#define EBADFD 77 /* File descriptor in bad state */ +#define EREMCHG 78 /* Remote address changed */ +#define ELIBACC 79 /* Can not access a needed shared library */ +#define ELIBBAD 80 /* Accessing a corrupted shared library */ +#define ELIBSCN 81 /* .lib section in a.out corrupted */ +#define ELIBMAX 82 /* Attempting to link in too many shared libraries */ +#define ELIBEXEC 83 /* Cannot exec a shared library directly */ +#define EILSEQ 84 /* Illegal byte sequence */ +#define ERESTART 85 /* Interrupted system call should be restarted */ +#define ESTRPIPE 86 /* Streams pipe error */ +#define EUSERS 87 /* Too many users */ +#define ENOTSOCK 88 /* Socket operation on non-socket */ +#define EDESTADDRREQ 89 /* Destination address required */ +#define EMSGSIZE 90 /* Message too long */ +#define EPROTOTYPE 91 /* Protocol wrong type for socket */ +#define ENOPROTOOPT 92 /* Protocol not available */ +#define EPROTONOSUPPORT 93 /* Protocol not supported */ +#define ESOCKTNOSUPPORT 94 /* Socket type not supported */ +#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */ +#define EPFNOSUPPORT 96 /* Protocol family not supported */ +#define EAFNOSUPPORT 97 /* Address family not supported by protocol */ +#define EADDRINUSE 98 /* Address already in use */ +#define EADDRNOTAVAIL 99 /* Cannot assign requested address */ +#define ENETDOWN 100 /* Network is down */ +#define ENETUNREACH 101 /* Network is unreachable */ +#define ENETRESET 102 /* Network dropped connection because of reset */ +#define ECONNABORTED 103 /* Software caused connection abort */ +#define ECONNRESET 104 /* Connection reset by peer */ +#define ENOBUFS 105 /* No buffer space available */ +#define EISCONN 106 /* Transport endpoint is already connected */ +#define ENOTCONN 107 /* Transport endpoint is not connected */ +#define ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */ +#define ETOOMANYREFS 109 /* Too many references: cannot splice */ +#define ETIMEDOUT 110 /* Connection timed out */ +#define ECONNREFUSED 111 /* Connection refused */ +#define EHOSTDOWN 112 /* Host is down */ +#define EHOSTUNREACH 113 /* No route to host */ +#define EALREADY 114 /* Operation already in progress */ +#define EINPROGRESS 115 /* Operation now in progress */ +#define ESTALE 116 /* Stale NFS file handle */ +#define EUCLEAN 117 /* Structure needs cleaning */ +#define ENOTNAM 118 /* Not a XENIX named type file */ +#define ENAVAIL 119 /* No XENIX semaphores available */ +#define EISNAM 120 /* Is a named type file */ +#define EREMOTEIO 121 /* Remote I/O error */ +#define EDQUOT 122 /* Quota exceeded */ + +#define ENOMEDIUM 123 /* No medium found */ +#define EMEDIUMTYPE 124 /* Wrong medium type */ + + +#define ENSROK 0 /* DNS server returned answer with no data */ +#define ENSRNODATA 160 /* DNS server returned answer with no data */ +#define ENSRFORMERR 161 /* DNS server claims query was misformatted */ +#define ENSRSERVFAIL 162 /* DNS server returned general failure */ +#define ENSRNOTFOUND 163 /* Domain name not found */ +#define ENSRNOTIMP 164 /* DNS server does not implement requested operation */ +#define ENSRREFUSED 165 /* DNS server refused query */ +#define ENSRBADQUERY 166 /* Misformatted DNS query */ +#define ENSRBADNAME 167 /* Misformatted domain name */ +#define ENSRBADFAMILY 168 /* Unsupported address family */ +#define ENSRBADRESP 169 /* Misformatted DNS reply */ +#define ENSRCONNREFUSED 170 /* Could not contact DNS servers */ +#define ENSRTIMEOUT 171 /* Timeout while contacting DNS servers */ +#define ENSROF 172 /* End of file */ +#define ENSRFILE 173 /* Error reading file */ +#define ENSRNOMEM 174 /* Out of memory */ +#define ENSRDESTRUCTION 175 /* Application terminated lookup */ +#define ENSRQUERYDOMAINTOOLONG 176 /* Domain name is too long */ +#define ENSRCNAMELOOP 177 /* Domain name is too long */ + +#ifndef errno +extern int errno; +#endif + +#endif /* LWIP_PROVIDE_ERRNO */ + +#ifdef __cplusplus +} +#endif + +#endif /* __LWIP_ARCH_H__ */ diff --git a/lib/drivers/lwip/src/include/lwip/debug.h b/lib/drivers/lwip/src/include/lwip/debug.h new file mode 100644 index 00000000000..d8359ea3a53 --- /dev/null +++ b/lib/drivers/lwip/src/include/lwip/debug.h @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ +#ifndef __LWIP_DEBUG_H__ +#define __LWIP_DEBUG_H__ + +#include "lwip/arch.h" + +/** lower two bits indicate debug level + * - 0 all + * - 1 warning + * - 2 serious + * - 3 severe + */ +#define LWIP_DBG_LEVEL_ALL 0x00 +#define LWIP_DBG_LEVEL_OFF LWIP_DBG_LEVEL_ALL /* compatibility define only */ +#define LWIP_DBG_LEVEL_WARNING 0x01 /* bad checksums, dropped packets, ... */ +#define LWIP_DBG_LEVEL_SERIOUS 0x02 /* memory allocation failures, ... */ +#define LWIP_DBG_LEVEL_SEVERE 0x03 +#define LWIP_DBG_MASK_LEVEL 0x03 + +/** flag for LWIP_DEBUGF to enable that debug message */ +#define LWIP_DBG_ON 0x80U +/** flag for LWIP_DEBUGF to disable that debug message */ +#define LWIP_DBG_OFF 0x00U + +/** flag for LWIP_DEBUGF indicating a tracing message (to follow program flow) */ +#define LWIP_DBG_TRACE 0x40U +/** flag for LWIP_DEBUGF indicating a state debug message (to follow module states) */ +#define LWIP_DBG_STATE 0x20U +/** flag for LWIP_DEBUGF indicating newly added code, not thoroughly tested yet */ +#define LWIP_DBG_FRESH 0x10U +/** flag for LWIP_DEBUGF to halt after printing this debug message */ +#define LWIP_DBG_HALT 0x08U + +#ifndef LWIP_NOASSERT +#define LWIP_ASSERT(message, assertion) do { if(!(assertion)) \ + LWIP_PLATFORM_ASSERT(message); } while(0) +#else /* LWIP_NOASSERT */ +#define LWIP_ASSERT(message, assertion) +#endif /* LWIP_NOASSERT */ + +/** if "expression" isn't true, then print "message" and execute "handler" expression */ +#ifndef LWIP_ERROR +#define LWIP_ERROR(message, expression, handler) do { if (!(expression)) { \ + LWIP_PLATFORM_ASSERT(message); handler;}} while(0) +#endif /* LWIP_ERROR */ + +#ifdef LWIP_DEBUG +/** print debug message only if debug message type is enabled... + * AND is of correct type AND is at least LWIP_DBG_LEVEL + */ +#define LWIP_DEBUGF(debug, message) do { \ + if ( \ + ((debug) & LWIP_DBG_ON) && \ + ((debug) & LWIP_DBG_TYPES_ON) && \ + ((s16_t)((debug) & LWIP_DBG_MASK_LEVEL) >= LWIP_DBG_MIN_LEVEL)) { \ + LWIP_PLATFORM_DIAG(message); \ + if ((debug) & LWIP_DBG_HALT) { \ + while(1); \ + } \ + } \ + } while(0) + +#else /* LWIP_DEBUG */ +#define LWIP_DEBUGF(debug, message) +#endif /* LWIP_DEBUG */ + +#endif /* __LWIP_DEBUG_H__ */ + diff --git a/lib/drivers/lwip/src/include/lwip/def.h b/lib/drivers/lwip/src/include/lwip/def.h new file mode 100644 index 00000000000..9b6de6a8b81 --- /dev/null +++ b/lib/drivers/lwip/src/include/lwip/def.h @@ -0,0 +1,127 @@ +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ +#ifndef __LWIP_DEF_H__ +#define __LWIP_DEF_H__ + +/* arch.h might define NULL already */ +#include "lwip/arch.h" +#include "lwip/opt.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define LWIP_MAX(x , y) (((x) > (y)) ? (x) : (y)) +#define LWIP_MIN(x , y) (((x) < (y)) ? (x) : (y)) + +#ifndef NULL +#define NULL ((void *)0) +#endif + +/** Get the absolute difference between 2 u32_t values (correcting overflows) + * 'a' is expected to be 'higher' (without overflow) than 'b'. */ +#define LWIP_U32_DIFF(a, b) (((a) >= (b)) ? ((a) - (b)) : (((a) + ((b) ^ 0xFFFFFFFF) + 1))) + +/* Endianess-optimized shifting of two u8_t to create one u16_t */ +#if BYTE_ORDER == LITTLE_ENDIAN +#define LWIP_MAKE_U16(a, b) ((a << 8) | b) +#else +#define LWIP_MAKE_U16(a, b) ((b << 8) | a) +#endif + +#ifndef LWIP_PLATFORM_BYTESWAP +#define LWIP_PLATFORM_BYTESWAP 0 +#endif + +#ifndef LWIP_PREFIX_BYTEORDER_FUNCS +/* workaround for naming collisions on some platforms */ + +#ifdef htons +#undef htons +#endif /* htons */ +#ifdef htonl +#undef htonl +#endif /* htonl */ +#ifdef ntohs +#undef ntohs +#endif /* ntohs */ +#ifdef ntohl +#undef ntohl +#endif /* ntohl */ + +#define htons(x) lwip_htons(x) +#define ntohs(x) lwip_ntohs(x) +#define htonl(x) lwip_htonl(x) +#define ntohl(x) lwip_ntohl(x) +#endif /* LWIP_PREFIX_BYTEORDER_FUNCS */ + +#if BYTE_ORDER == BIG_ENDIAN +#define lwip_htons(x) (x) +#define lwip_ntohs(x) (x) +#define lwip_htonl(x) (x) +#define lwip_ntohl(x) (x) +#define PP_HTONS(x) (x) +#define PP_NTOHS(x) (x) +#define PP_HTONL(x) (x) +#define PP_NTOHL(x) (x) +#else /* BYTE_ORDER != BIG_ENDIAN */ +#if LWIP_PLATFORM_BYTESWAP +#define lwip_htons(x) LWIP_PLATFORM_HTONS(x) +#define lwip_ntohs(x) LWIP_PLATFORM_HTONS(x) +#define lwip_htonl(x) LWIP_PLATFORM_HTONL(x) +#define lwip_ntohl(x) LWIP_PLATFORM_HTONL(x) +#else /* LWIP_PLATFORM_BYTESWAP */ +u16_t lwip_htons(u16_t x); +u16_t lwip_ntohs(u16_t x); +u32_t lwip_htonl(u32_t x); +u32_t lwip_ntohl(u32_t x); +#endif /* LWIP_PLATFORM_BYTESWAP */ + +/* These macros should be calculated by the preprocessor and are used + with compile-time constants only (so that there is no little-endian + overhead at runtime). */ +#define PP_HTONS(x) ((((x) & 0xff) << 8) | (((x) & 0xff00) >> 8)) +#define PP_NTOHS(x) PP_HTONS(x) +#define PP_HTONL(x) ((((x) & 0xff) << 24) | \ + (((x) & 0xff00) << 8) | \ + (((x) & 0xff0000UL) >> 8) | \ + (((x) & 0xff000000UL) >> 24)) +#define PP_NTOHL(x) PP_HTONL(x) + +#endif /* BYTE_ORDER == BIG_ENDIAN */ + +#ifdef __cplusplus +} +#endif + +#endif /* __LWIP_DEF_H__ */ + diff --git a/lib/drivers/lwip/src/include/lwip/dhcp.h b/lib/drivers/lwip/src/include/lwip/dhcp.h new file mode 100644 index 00000000000..32d93381d12 --- /dev/null +++ b/lib/drivers/lwip/src/include/lwip/dhcp.h @@ -0,0 +1,242 @@ +/** @file + */ + +#ifndef __LWIP_DHCP_H__ +#define __LWIP_DHCP_H__ + +#include "lwip/opt.h" + +#if LWIP_DHCP /* don't build if not configured for use in lwipopts.h */ + +#include "lwip/netif.h" +#include "lwip/udp.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** period (in seconds) of the application calling dhcp_coarse_tmr() */ +#define DHCP_COARSE_TIMER_SECS 60 +/** period (in milliseconds) of the application calling dhcp_coarse_tmr() */ +#define DHCP_COARSE_TIMER_MSECS (DHCP_COARSE_TIMER_SECS * 1000UL) +/** period (in milliseconds) of the application calling dhcp_fine_tmr() */ +#define DHCP_FINE_TIMER_MSECS 500 + +#define DHCP_CHADDR_LEN 16U +#define DHCP_SNAME_LEN 64U +#define DHCP_FILE_LEN 128U + +struct dhcp +{ + /** transaction identifier of last sent request */ + u32_t xid; + /** our connection to the DHCP server */ + struct udp_pcb *pcb; + /** incoming msg */ + struct dhcp_msg *msg_in; + /** current DHCP state machine state */ + u8_t state; + /** retries of current request */ + u8_t tries; +#if LWIP_DHCP_AUTOIP_COOP + u8_t autoip_coop_state; +#endif + u8_t subnet_mask_given; + + struct pbuf *p_out; /* pbuf of outcoming msg */ + struct dhcp_msg *msg_out; /* outgoing msg */ + u16_t options_out_len; /* outgoing msg options length */ + u16_t request_timeout; /* #ticks with period DHCP_FINE_TIMER_SECS for request timeout */ + u16_t t1_timeout; /* #ticks with period DHCP_COARSE_TIMER_SECS for renewal time */ + u16_t t2_timeout; /* #ticks with period DHCP_COARSE_TIMER_SECS for rebind time */ + ip_addr_t server_ip_addr; /* dhcp server address that offered this lease */ + ip_addr_t offered_ip_addr; + ip_addr_t offered_sn_mask; + ip_addr_t offered_gw_addr; + + u32_t offered_t0_lease; /* lease period (in seconds) */ + u32_t offered_t1_renew; /* recommended renew time (usually 50% of lease period) */ + u32_t offered_t2_rebind; /* recommended rebind time (usually 66% of lease period) */ + /* @todo: LWIP_DHCP_BOOTP_FILE configuration option? + integrate with possible TFTP-client for booting? */ +#if LWIP_DHCP_BOOTP_FILE + ip_addr_t offered_si_addr; + char boot_file_name[DHCP_FILE_LEN]; +#endif /* LWIP_DHCP_BOOTPFILE */ +}; + +/* MUST be compiled with "pack structs" or equivalent! */ +#ifdef PACK_STRUCT_USE_INCLUDES +# include "arch/bpstruct.h" +#endif +PACK_STRUCT_BEGIN +/** minimum set of fields of any DHCP message */ +struct dhcp_msg +{ + PACK_STRUCT_FIELD(u8_t op); + PACK_STRUCT_FIELD(u8_t htype); + PACK_STRUCT_FIELD(u8_t hlen); + PACK_STRUCT_FIELD(u8_t hops); + PACK_STRUCT_FIELD(u32_t xid); + PACK_STRUCT_FIELD(u16_t secs); + PACK_STRUCT_FIELD(u16_t flags); + PACK_STRUCT_FIELD(ip_addr_p_t ciaddr); + PACK_STRUCT_FIELD(ip_addr_p_t yiaddr); + PACK_STRUCT_FIELD(ip_addr_p_t siaddr); + PACK_STRUCT_FIELD(ip_addr_p_t giaddr); + PACK_STRUCT_FIELD(u8_t chaddr[DHCP_CHADDR_LEN]); + PACK_STRUCT_FIELD(u8_t sname[DHCP_SNAME_LEN]); + PACK_STRUCT_FIELD(u8_t file[DHCP_FILE_LEN]); + PACK_STRUCT_FIELD(u32_t cookie); +#define DHCP_MIN_OPTIONS_LEN 68U +/** make sure user does not configure this too small */ +#if ((defined(DHCP_OPTIONS_LEN)) && (DHCP_OPTIONS_LEN < DHCP_MIN_OPTIONS_LEN)) +# undef DHCP_OPTIONS_LEN +#endif +/** allow this to be configured in lwipopts.h, but not too small */ +#if (!defined(DHCP_OPTIONS_LEN)) +/** set this to be sufficient for your options in outgoing DHCP msgs */ +# define DHCP_OPTIONS_LEN DHCP_MIN_OPTIONS_LEN +#endif + PACK_STRUCT_FIELD(u8_t options[DHCP_OPTIONS_LEN]); +} PACK_STRUCT_STRUCT; +PACK_STRUCT_END +#ifdef PACK_STRUCT_USE_INCLUDES +# include "arch/epstruct.h" +#endif + +void dhcp_set_struct(struct netif *netif, struct dhcp *dhcp); +/** Remove a struct dhcp previously set to the netif using dhcp_set_struct() */ +#define dhcp_remove_struct(netif) do { (netif)->dhcp = NULL; } while(0) +void dhcp_cleanup(struct netif *netif); +/** start DHCP configuration */ +err_t dhcp_start(struct netif *netif); +/** enforce early lease renewal (not needed normally)*/ +err_t dhcp_renew(struct netif *netif); +/** release the DHCP lease, usually called before dhcp_stop()*/ +err_t dhcp_release(struct netif *netif); +/** stop DHCP configuration */ +void dhcp_stop(struct netif *netif); +/** inform server of our manual IP address */ +void dhcp_inform(struct netif *netif); +/** Handle a possible change in the network configuration */ +void dhcp_network_changed(struct netif *netif); + +/** if enabled, check whether the offered IP address is not in use, using ARP */ +#if DHCP_DOES_ARP_CHECK +void dhcp_arp_reply(struct netif *netif, ip_addr_t *addr); +#endif + +/** to be called every minute */ +void dhcp_coarse_tmr(void); +/** to be called every half second */ +void dhcp_fine_tmr(void); + +/** DHCP message item offsets and length */ +#define DHCP_OP_OFS 0 +#define DHCP_HTYPE_OFS 1 +#define DHCP_HLEN_OFS 2 +#define DHCP_HOPS_OFS 3 +#define DHCP_XID_OFS 4 +#define DHCP_SECS_OFS 8 +#define DHCP_FLAGS_OFS 10 +#define DHCP_CIADDR_OFS 12 +#define DHCP_YIADDR_OFS 16 +#define DHCP_SIADDR_OFS 20 +#define DHCP_GIADDR_OFS 24 +#define DHCP_CHADDR_OFS 28 +#define DHCP_SNAME_OFS 44 +#define DHCP_FILE_OFS 108 +#define DHCP_MSG_LEN 236 + +#define DHCP_COOKIE_OFS DHCP_MSG_LEN +#define DHCP_OPTIONS_OFS (DHCP_MSG_LEN + 4) + +#define DHCP_CLIENT_PORT 68 +#define DHCP_SERVER_PORT 67 + +/** DHCP client states */ +#define DHCP_OFF 0 +#define DHCP_REQUESTING 1 +#define DHCP_INIT 2 +#define DHCP_REBOOTING 3 +#define DHCP_REBINDING 4 +#define DHCP_RENEWING 5 +#define DHCP_SELECTING 6 +#define DHCP_INFORMING 7 +#define DHCP_CHECKING 8 +#define DHCP_PERMANENT 9 +#define DHCP_BOUND 10 +/** not yet implemented #define DHCP_RELEASING 11 */ +#define DHCP_BACKING_OFF 12 + +/** AUTOIP cooperatation flags */ +#define DHCP_AUTOIP_COOP_STATE_OFF 0 +#define DHCP_AUTOIP_COOP_STATE_ON 1 + +#define DHCP_BOOTREQUEST 1 +#define DHCP_BOOTREPLY 2 + +/** DHCP message types */ +#define DHCP_DISCOVER 1 +#define DHCP_OFFER 2 +#define DHCP_REQUEST 3 +#define DHCP_DECLINE 4 +#define DHCP_ACK 5 +#define DHCP_NAK 6 +#define DHCP_RELEASE 7 +#define DHCP_INFORM 8 + +/** DHCP hardware type, currently only ethernet is supported */ +#define DHCP_HTYPE_ETH 1 + +#define DHCP_MAGIC_COOKIE 0x63825363UL + +/* This is a list of options for BOOTP and DHCP, see RFC 2132 for descriptions */ + +/** BootP options */ +#define DHCP_OPTION_PAD 0 +#define DHCP_OPTION_SUBNET_MASK 1 /* RFC 2132 3.3 */ +#define DHCP_OPTION_ROUTER 3 +#define DHCP_OPTION_DNS_SERVER 6 +#define DHCP_OPTION_HOSTNAME 12 +#define DHCP_OPTION_IP_TTL 23 +#define DHCP_OPTION_MTU 26 +#define DHCP_OPTION_BROADCAST 28 +#define DHCP_OPTION_TCP_TTL 37 +#define DHCP_OPTION_END 255 + +/** DHCP options */ +#define DHCP_OPTION_REQUESTED_IP 50 /* RFC 2132 9.1, requested IP address */ +#define DHCP_OPTION_LEASE_TIME 51 /* RFC 2132 9.2, time in seconds, in 4 bytes */ +#define DHCP_OPTION_OVERLOAD 52 /* RFC2132 9.3, use file and/or sname field for options */ + +#define DHCP_OPTION_MESSAGE_TYPE 53 /* RFC 2132 9.6, important for DHCP */ +#define DHCP_OPTION_MESSAGE_TYPE_LEN 1 + +#define DHCP_OPTION_SERVER_ID 54 /* RFC 2132 9.7, server IP address */ +#define DHCP_OPTION_PARAMETER_REQUEST_LIST 55 /* RFC 2132 9.8, requested option types */ + +#define DHCP_OPTION_MAX_MSG_SIZE 57 /* RFC 2132 9.10, message size accepted >= 576 */ +#define DHCP_OPTION_MAX_MSG_SIZE_LEN 2 + +#define DHCP_OPTION_T1 58 /* T1 renewal time */ +#define DHCP_OPTION_T2 59 /* T2 rebinding time */ +#define DHCP_OPTION_US 60 +#define DHCP_OPTION_CLIENT_ID 61 +#define DHCP_OPTION_TFTP_SERVERNAME 66 +#define DHCP_OPTION_BOOTFILE 67 + +/** possible combinations of overloading the file and sname fields with options */ +#define DHCP_OVERLOAD_NONE 0 +#define DHCP_OVERLOAD_FILE 1 +#define DHCP_OVERLOAD_SNAME 2 +#define DHCP_OVERLOAD_SNAME_FILE 3 + +#ifdef __cplusplus +} +#endif + +#endif /* LWIP_DHCP */ + +#endif /*__LWIP_DHCP_H__*/ diff --git a/lib/drivers/lwip/src/include/lwip/dns.h b/lib/drivers/lwip/src/include/lwip/dns.h new file mode 100644 index 00000000000..6c7d9b07399 --- /dev/null +++ b/lib/drivers/lwip/src/include/lwip/dns.h @@ -0,0 +1,124 @@ +/** + * lwip DNS resolver header file. + + * Author: Jim Pettinato + * April 2007 + + * ported from uIP resolv.c Copyright (c) 2002-2003, Adam Dunkels. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __LWIP_DNS_H__ +#define __LWIP_DNS_H__ + +#include "lwip/opt.h" + +#if LWIP_DNS /* don't build if not configured for use in lwipopts.h */ + +#ifdef __cplusplus +extern "C" { +#endif + +/** DNS timer period */ +#define DNS_TMR_INTERVAL 1000 + +/** DNS field TYPE used for "Resource Records" */ +#define DNS_RRTYPE_A 1 /* a host address */ +#define DNS_RRTYPE_NS 2 /* an authoritative name server */ +#define DNS_RRTYPE_MD 3 /* a mail destination (Obsolete - use MX) */ +#define DNS_RRTYPE_MF 4 /* a mail forwarder (Obsolete - use MX) */ +#define DNS_RRTYPE_CNAME 5 /* the canonical name for an alias */ +#define DNS_RRTYPE_SOA 6 /* marks the start of a zone of authority */ +#define DNS_RRTYPE_MB 7 /* a mailbox domain name (EXPERIMENTAL) */ +#define DNS_RRTYPE_MG 8 /* a mail group member (EXPERIMENTAL) */ +#define DNS_RRTYPE_MR 9 /* a mail rename domain name (EXPERIMENTAL) */ +#define DNS_RRTYPE_NULL 10 /* a null RR (EXPERIMENTAL) */ +#define DNS_RRTYPE_WKS 11 /* a well known service description */ +#define DNS_RRTYPE_PTR 12 /* a domain name pointer */ +#define DNS_RRTYPE_HINFO 13 /* host information */ +#define DNS_RRTYPE_MINFO 14 /* mailbox or mail list information */ +#define DNS_RRTYPE_MX 15 /* mail exchange */ +#define DNS_RRTYPE_TXT 16 /* text strings */ + +/** DNS field CLASS used for "Resource Records" */ +#define DNS_RRCLASS_IN 1 /* the Internet */ +#define DNS_RRCLASS_CS 2 /* the CSNET class (Obsolete - used only for examples in some obsolete RFCs) */ +#define DNS_RRCLASS_CH 3 /* the CHAOS class */ +#define DNS_RRCLASS_HS 4 /* Hesiod [Dyer 87] */ +#define DNS_RRCLASS_FLUSH 0x800 /* Flush bit */ + +/* The size used for the next line is rather a hack, but it prevents including socket.h in all files + that include memp.h, and that would possibly break portability (since socket.h defines some types + and constants possibly already define by the OS). + Calculation rule: + sizeof(struct addrinfo) + sizeof(struct sockaddr_in) + DNS_MAX_NAME_LENGTH + 1 byte zero-termination */ +#define NETDB_ELEM_SIZE (32 + 16 + DNS_MAX_NAME_LENGTH + 1) + +#if DNS_LOCAL_HOSTLIST +/** struct used for local host-list */ +struct local_hostlist_entry { + /** static hostname */ + const char *name; + /** static host address in network byteorder */ + ip_addr_t addr; + struct local_hostlist_entry *next; +}; +#if DNS_LOCAL_HOSTLIST_IS_DYNAMIC +#ifndef DNS_LOCAL_HOSTLIST_MAX_NAMELEN +#define DNS_LOCAL_HOSTLIST_MAX_NAMELEN DNS_MAX_NAME_LENGTH +#endif +#define LOCALHOSTLIST_ELEM_SIZE ((sizeof(struct local_hostlist_entry) + DNS_LOCAL_HOSTLIST_MAX_NAMELEN + 1)) +#endif /* DNS_LOCAL_HOSTLIST_IS_DYNAMIC */ +#endif /* DNS_LOCAL_HOSTLIST */ + +/** Callback which is invoked when a hostname is found. + * A function of this type must be implemented by the application using the DNS resolver. + * @param name pointer to the name that was looked up. + * @param ipaddr pointer to an ip_addr_t containing the IP address of the hostname, + * or NULL if the name could not be found (or on any other error). + * @param callback_arg a user-specified callback argument passed to dns_gethostbyname +*/ +typedef void (*dns_found_callback)(const char *name, ip_addr_t *ipaddr, void *callback_arg); + +void dns_init(void); +void dns_tmr(void); +void dns_setserver(u8_t numdns, ip_addr_t *dnsserver); +ip_addr_t dns_getserver(u8_t numdns); +err_t dns_gethostbyname(const char *hostname, ip_addr_t *addr, + dns_found_callback found, void *callback_arg); + +#if DNS_LOCAL_HOSTLIST && DNS_LOCAL_HOSTLIST_IS_DYNAMIC +int dns_local_removehost(const char *hostname, const ip_addr_t *addr); +err_t dns_local_addhost(const char *hostname, const ip_addr_t *addr); +#endif /* DNS_LOCAL_HOSTLIST && DNS_LOCAL_HOSTLIST_IS_DYNAMIC */ + +#ifdef __cplusplus +} +#endif + +#endif /* LWIP_DNS */ + +#endif /* __LWIP_DNS_H__ */ diff --git a/lib/drivers/lwip/src/include/lwip/err.h b/lib/drivers/lwip/src/include/lwip/err.h new file mode 100644 index 00000000000..ac907729fcd --- /dev/null +++ b/lib/drivers/lwip/src/include/lwip/err.h @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ +#ifndef __LWIP_ERR_H__ +#define __LWIP_ERR_H__ + +#include "lwip/opt.h" +#include "lwip/arch.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** Define LWIP_ERR_T in cc.h if you want to use + * a different type for your platform (must be signed). */ +#ifdef LWIP_ERR_T +typedef LWIP_ERR_T err_t; +#else /* LWIP_ERR_T */ +typedef s8_t err_t; +#endif /* LWIP_ERR_T*/ + +/* Definitions for error constants. */ + +#define ERR_OK 0 /* No error, everything OK. */ +#define ERR_MEM -1 /* Out of memory error. */ +#define ERR_BUF -2 /* Buffer error. */ +#define ERR_TIMEOUT -3 /* Timeout. */ +#define ERR_RTE -4 /* Routing problem. */ +#define ERR_INPROGRESS -5 /* Operation in progress */ +#define ERR_VAL -6 /* Illegal value. */ +#define ERR_WOULDBLOCK -7 /* Operation would block. */ +#define ERR_USE -8 /* Address in use. */ +#define ERR_ISCONN -9 /* Already connected. */ + +#define ERR_IS_FATAL(e) ((e) < ERR_ISCONN) + +#define ERR_ABRT -10 /* Connection aborted. */ +#define ERR_RST -11 /* Connection reset. */ +#define ERR_CLSD -12 /* Connection closed. */ +#define ERR_CONN -13 /* Not connected. */ + +#define ERR_ARG -14 /* Illegal argument. */ + +#define ERR_IF -15 /* Low-level netif error */ + + +#ifdef LWIP_DEBUG +extern const char *lwip_strerr(err_t err); +#else +#define lwip_strerr(x) "" +#endif /* LWIP_DEBUG */ + +#ifdef __cplusplus +} +#endif + +#endif /* __LWIP_ERR_H__ */ diff --git a/lib/drivers/lwip/src/include/lwip/init.h b/lib/drivers/lwip/src/include/lwip/init.h new file mode 100644 index 00000000000..77dcdfc7757 --- /dev/null +++ b/lib/drivers/lwip/src/include/lwip/init.h @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ +#ifndef __LWIP_INIT_H__ +#define __LWIP_INIT_H__ + +#include "lwip/opt.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** X.x.x: Major version of the stack */ +#define LWIP_VERSION_MAJOR 1U +/** x.X.x: Minor version of the stack */ +#define LWIP_VERSION_MINOR 4U +/** x.x.X: Revision of the stack */ +#define LWIP_VERSION_REVISION 0U +/** For release candidates, this is set to 1..254 + * For official releases, this is set to 255 (LWIP_RC_RELEASE) + * For development versions (CVS), this is set to 0 (LWIP_RC_DEVELOPMENT) */ +#define LWIP_VERSION_RC 255U + +/** LWIP_VERSION_RC is set to LWIP_RC_RELEASE for official releases */ +#define LWIP_RC_RELEASE 255U +/** LWIP_VERSION_RC is set to LWIP_RC_DEVELOPMENT for CVS versions */ +#define LWIP_RC_DEVELOPMENT 0U + +#define LWIP_VERSION_IS_RELEASE (LWIP_VERSION_RC == LWIP_RC_RELEASE) +#define LWIP_VERSION_IS_DEVELOPMENT (LWIP_VERSION_RC == LWIP_RC_DEVELOPMENT) +#define LWIP_VERSION_IS_RC ((LWIP_VERSION_RC != LWIP_RC_RELEASE) && (LWIP_VERSION_RC != LWIP_RC_DEVELOPMENT)) + +/** Provides the version of the stack */ +#define LWIP_VERSION (LWIP_VERSION_MAJOR << 24 | LWIP_VERSION_MINOR << 16 | \ + LWIP_VERSION_REVISION << 8 | LWIP_VERSION_RC) + +/* Modules initialization */ +void lwip_init(void); + +#ifdef __cplusplus +} +#endif + +#endif /* __LWIP_INIT_H__ */ diff --git a/lib/drivers/lwip/src/include/lwip/mem.h b/lib/drivers/lwip/src/include/lwip/mem.h new file mode 100644 index 00000000000..9507c0aec41 --- /dev/null +++ b/lib/drivers/lwip/src/include/lwip/mem.h @@ -0,0 +1,122 @@ +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ +#ifndef __LWIP_MEM_H__ +#define __LWIP_MEM_H__ + +#include "lwip/opt.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#if MEM_LIBC_MALLOC + +#include /* for size_t */ + +typedef size_t mem_size_t; + +/* aliases for C library malloc() */ +#define mem_init() +/* in case C library malloc() needs extra protection, + * allow these defines to be overridden. + */ +#ifndef mem_free +#define mem_free free +#endif +#ifndef mem_malloc +#define mem_malloc malloc +#endif +#ifndef mem_calloc +#define mem_calloc calloc +#endif +/* Since there is no C library allocation function to shrink memory without + moving it, define this to nothing. */ +#ifndef mem_trim +#define mem_trim(mem, size) (mem) +#endif +#else /* MEM_LIBC_MALLOC */ + +/* MEM_SIZE would have to be aligned, but using 64000 here instead of + * 65535 leaves some room for alignment... + */ +#if MEM_SIZE > 64000L +typedef u32_t mem_size_t; +#define MEM_SIZE_F U32_F +#else +typedef u16_t mem_size_t; +#define MEM_SIZE_F U16_F +#endif /* MEM_SIZE > 64000 */ + +#if MEM_USE_POOLS +/** mem_init is not used when using pools instead of a heap */ +#define mem_init() +/** mem_trim is not used when using pools instead of a heap: + we can't free part of a pool element and don't want to copy the rest */ +#define mem_trim(mem, size) (mem) +#else /* MEM_USE_POOLS */ +/* lwIP alternative malloc */ +void mem_init(void); +void *mem_trim(void *mem, mem_size_t size); +#endif /* MEM_USE_POOLS */ +void *mem_malloc(mem_size_t size); +void *mem_calloc(mem_size_t count, mem_size_t size); +void mem_free(void *mem); +#endif /* MEM_LIBC_MALLOC */ + +/** Calculate memory size for an aligned buffer - returns the next highest + * multiple of MEM_ALIGNMENT (e.g. LWIP_MEM_ALIGN_SIZE(3) and + * LWIP_MEM_ALIGN_SIZE(4) will both yield 4 for MEM_ALIGNMENT == 4). + */ +#ifndef LWIP_MEM_ALIGN_SIZE +#define LWIP_MEM_ALIGN_SIZE(size) (((size) + MEM_ALIGNMENT - 1) & ~(MEM_ALIGNMENT-1)) +#endif + +/** Calculate safe memory size for an aligned buffer when using an unaligned + * type as storage. This includes a safety-margin on (MEM_ALIGNMENT - 1) at the + * start (e.g. if buffer is u8_t[] and actual data will be u32_t*) + */ +#ifndef LWIP_MEM_ALIGN_BUFFER +#define LWIP_MEM_ALIGN_BUFFER(size) (((size) + MEM_ALIGNMENT - 1)) +#endif + +/** Align a memory pointer to the alignment defined by MEM_ALIGNMENT + * so that ADDR % MEM_ALIGNMENT == 0 + */ +#ifndef LWIP_MEM_ALIGN +#define LWIP_MEM_ALIGN(addr) ((void *)(((mem_ptr_t)(addr) + MEM_ALIGNMENT - 1) & ~(mem_ptr_t)(MEM_ALIGNMENT-1))) +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __LWIP_MEM_H__ */ diff --git a/lib/drivers/lwip/src/include/lwip/memp.h b/lib/drivers/lwip/src/include/lwip/memp.h new file mode 100644 index 00000000000..f0d07399434 --- /dev/null +++ b/lib/drivers/lwip/src/include/lwip/memp.h @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ + +#ifndef __LWIP_MEMP_H__ +#define __LWIP_MEMP_H__ + +#include "lwip/opt.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Create the list of all memory pools managed by memp. MEMP_MAX represents a NULL pool at the end */ +typedef enum { +#define LWIP_MEMPOOL(name,num,size,desc) MEMP_##name, +#include "lwip/memp_std.h" + MEMP_MAX +} memp_t; + +#if MEM_USE_POOLS +/* Use a helper type to get the start and end of the user "memory pools" for mem_malloc */ +typedef enum { + /* Get the first (via: + MEMP_POOL_HELPER_START = ((u8_t) 1*MEMP_POOL_A + 0*MEMP_POOL_B + 0*MEMP_POOL_C + 0)*/ + MEMP_POOL_HELPER_FIRST = ((u8_t) +#define LWIP_MEMPOOL(name,num,size,desc) +#define LWIP_MALLOC_MEMPOOL_START 1 +#define LWIP_MALLOC_MEMPOOL(num, size) * MEMP_POOL_##size + 0 +#define LWIP_MALLOC_MEMPOOL_END +#include "lwip/memp_std.h" + ) , + /* Get the last (via: + MEMP_POOL_HELPER_END = ((u8_t) 0 + MEMP_POOL_A*0 + MEMP_POOL_B*0 + MEMP_POOL_C*1) */ + MEMP_POOL_HELPER_LAST = ((u8_t) +#define LWIP_MEMPOOL(name,num,size,desc) +#define LWIP_MALLOC_MEMPOOL_START +#define LWIP_MALLOC_MEMPOOL(num, size) 0 + MEMP_POOL_##size * +#define LWIP_MALLOC_MEMPOOL_END 1 +#include "lwip/memp_std.h" + ) +} memp_pool_helper_t; + +/* The actual start and stop values are here (cast them over) + We use this helper type and these defines so we can avoid using const memp_t values */ +#define MEMP_POOL_FIRST ((memp_t) MEMP_POOL_HELPER_FIRST) +#define MEMP_POOL_LAST ((memp_t) MEMP_POOL_HELPER_LAST) +#endif /* MEM_USE_POOLS */ + +#if MEMP_MEM_MALLOC || MEM_USE_POOLS +extern const u16_t memp_sizes[MEMP_MAX]; +#endif /* MEMP_MEM_MALLOC || MEM_USE_POOLS */ + +#if MEMP_MEM_MALLOC + +#include "mem.h" + +#define memp_init() +#define memp_malloc(type) mem_malloc(memp_sizes[type]) +#define memp_free(type, mem) mem_free(mem) + +#else /* MEMP_MEM_MALLOC */ + +#if MEM_USE_POOLS +/** This structure is used to save the pool one element came from. */ +struct memp_malloc_helper +{ + memp_t poolnr; +}; +#endif /* MEM_USE_POOLS */ + +void memp_init(void); + +#if MEMP_OVERFLOW_CHECK +void *memp_malloc_fn(memp_t type, const char* file, const int line); +#define memp_malloc(t) memp_malloc_fn((t), __FILE__, __LINE__) +#else +void *memp_malloc(memp_t type); +#endif +void memp_free(memp_t type, void *mem); + +#endif /* MEMP_MEM_MALLOC */ + +#ifdef __cplusplus +} +#endif + +#endif /* __LWIP_MEMP_H__ */ diff --git a/lib/drivers/lwip/src/include/lwip/memp_std.h b/lib/drivers/lwip/src/include/lwip/memp_std.h new file mode 100644 index 00000000000..6ce408fb02a --- /dev/null +++ b/lib/drivers/lwip/src/include/lwip/memp_std.h @@ -0,0 +1,122 @@ +/* + * SETUP: Make sure we define everything we will need. + * + * We have create three types of pools: + * 1) MEMPOOL - standard pools + * 2) MALLOC_MEMPOOL - to be used by mem_malloc in mem.c + * 3) PBUF_MEMPOOL - a mempool of pbuf's, so include space for the pbuf struct + * + * If the include'r doesn't require any special treatment of each of the types + * above, then will declare #2 & #3 to be just standard mempools. + */ +#ifndef LWIP_MALLOC_MEMPOOL +/* This treats "malloc pools" just like any other pool. + The pools are a little bigger to provide 'size' as the amount of user data. */ +#define LWIP_MALLOC_MEMPOOL(num, size) LWIP_MEMPOOL(POOL_##size, num, (size + sizeof(struct memp_malloc_helper)), "MALLOC_"#size) +#define LWIP_MALLOC_MEMPOOL_START +#define LWIP_MALLOC_MEMPOOL_END +#endif /* LWIP_MALLOC_MEMPOOL */ + +#ifndef LWIP_PBUF_MEMPOOL +/* This treats "pbuf pools" just like any other pool. + * Allocates buffers for a pbuf struct AND a payload size */ +#define LWIP_PBUF_MEMPOOL(name, num, payload, desc) LWIP_MEMPOOL(name, num, (MEMP_ALIGN_SIZE(sizeof(struct pbuf)) + MEMP_ALIGN_SIZE(payload)), desc) +#endif /* LWIP_PBUF_MEMPOOL */ + + +/* + * A list of internal pools used by LWIP. + * + * LWIP_MEMPOOL(pool_name, number_elements, element_size, pool_description) + * creates a pool name MEMP_pool_name. description is used in stats.c + */ +#if LWIP_RAW +LWIP_MEMPOOL(RAW_PCB, MEMP_NUM_RAW_PCB, sizeof(struct raw_pcb), "RAW_PCB") +#endif /* LWIP_RAW */ + +#if LWIP_UDP +LWIP_MEMPOOL(UDP_PCB, MEMP_NUM_UDP_PCB, sizeof(struct udp_pcb), "UDP_PCB") +#endif /* LWIP_UDP */ + +#if LWIP_TCP +LWIP_MEMPOOL(TCP_PCB, MEMP_NUM_TCP_PCB, sizeof(struct tcp_pcb), "TCP_PCB") +LWIP_MEMPOOL(TCP_PCB_LISTEN, MEMP_NUM_TCP_PCB_LISTEN, sizeof(struct tcp_pcb_listen), "TCP_PCB_LISTEN") +LWIP_MEMPOOL(TCP_SEG, MEMP_NUM_TCP_SEG, sizeof(struct tcp_seg), "TCP_SEG") +#endif /* LWIP_TCP */ + +#if IP_REASSEMBLY +LWIP_MEMPOOL(REASSDATA, MEMP_NUM_REASSDATA, sizeof(struct ip_reassdata), "REASSDATA") +#endif /* IP_REASSEMBLY */ +#if IP_FRAG && !IP_FRAG_USES_STATIC_BUF && !LWIP_NETIF_TX_SINGLE_PBUF +LWIP_MEMPOOL(FRAG_PBUF, MEMP_NUM_FRAG_PBUF, sizeof(struct pbuf_custom_ref),"FRAG_PBUF") +#endif /* IP_FRAG && !IP_FRAG_USES_STATIC_BUF && !LWIP_NETIF_TX_SINGLE_PBUF */ + +#if LWIP_NETCONN +LWIP_MEMPOOL(NETBUF, MEMP_NUM_NETBUF, sizeof(struct netbuf), "NETBUF") +LWIP_MEMPOOL(NETCONN, MEMP_NUM_NETCONN, sizeof(struct netconn), "NETCONN") +#endif /* LWIP_NETCONN */ + +#if NO_SYS==0 +LWIP_MEMPOOL(TCPIP_MSG_API, MEMP_NUM_TCPIP_MSG_API, sizeof(struct tcpip_msg), "TCPIP_MSG_API") +#if !LWIP_TCPIP_CORE_LOCKING_INPUT +LWIP_MEMPOOL(TCPIP_MSG_INPKT,MEMP_NUM_TCPIP_MSG_INPKT, sizeof(struct tcpip_msg), "TCPIP_MSG_INPKT") +#endif /* !LWIP_TCPIP_CORE_LOCKING_INPUT */ +#endif /* NO_SYS==0 */ + +#if ARP_QUEUEING +LWIP_MEMPOOL(ARP_QUEUE, MEMP_NUM_ARP_QUEUE, sizeof(struct etharp_q_entry), "ARP_QUEUE") +#endif /* ARP_QUEUEING */ + +#if LWIP_IGMP +LWIP_MEMPOOL(IGMP_GROUP, MEMP_NUM_IGMP_GROUP, sizeof(struct igmp_group), "IGMP_GROUP") +#endif /* LWIP_IGMP */ + +#if (!NO_SYS || (NO_SYS && !NO_SYS_NO_TIMERS)) /* LWIP_TIMERS */ +LWIP_MEMPOOL(SYS_TIMEOUT, MEMP_NUM_SYS_TIMEOUT, sizeof(struct sys_timeo), "SYS_TIMEOUT") +#endif /* LWIP_TIMERS */ + +#if LWIP_SNMP +LWIP_MEMPOOL(SNMP_ROOTNODE, MEMP_NUM_SNMP_ROOTNODE, sizeof(struct mib_list_rootnode), "SNMP_ROOTNODE") +LWIP_MEMPOOL(SNMP_NODE, MEMP_NUM_SNMP_NODE, sizeof(struct mib_list_node), "SNMP_NODE") +LWIP_MEMPOOL(SNMP_VARBIND, MEMP_NUM_SNMP_VARBIND, sizeof(struct snmp_varbind), "SNMP_VARBIND") +LWIP_MEMPOOL(SNMP_VALUE, MEMP_NUM_SNMP_VALUE, SNMP_MAX_VALUE_SIZE, "SNMP_VALUE") +#endif /* LWIP_SNMP */ +#if LWIP_DNS && LWIP_SOCKET +LWIP_MEMPOOL(NETDB, MEMP_NUM_NETDB, NETDB_ELEM_SIZE, "NETDB") +#endif /* LWIP_DNS && LWIP_SOCKET */ +#if LWIP_DNS && DNS_LOCAL_HOSTLIST && DNS_LOCAL_HOSTLIST_IS_DYNAMIC +LWIP_MEMPOOL(LOCALHOSTLIST, MEMP_NUM_LOCALHOSTLIST, LOCALHOSTLIST_ELEM_SIZE, "LOCALHOSTLIST") +#endif /* LWIP_DNS && DNS_LOCAL_HOSTLIST && DNS_LOCAL_HOSTLIST_IS_DYNAMIC */ +#if PPP_SUPPORT && PPPOE_SUPPORT +LWIP_MEMPOOL(PPPOE_IF, MEMP_NUM_PPPOE_INTERFACES, sizeof(struct pppoe_softc), "PPPOE_IF") +#endif /* PPP_SUPPORT && PPPOE_SUPPORT */ + +/* + * A list of pools of pbuf's used by LWIP. + * + * LWIP_PBUF_MEMPOOL(pool_name, number_elements, pbuf_payload_size, pool_description) + * creates a pool name MEMP_pool_name. description is used in stats.c + * This allocates enough space for the pbuf struct and a payload. + * (Example: pbuf_payload_size=0 allocates only size for the struct) + */ +LWIP_PBUF_MEMPOOL(PBUF, MEMP_NUM_PBUF, 0, "PBUF_REF/ROM") +LWIP_PBUF_MEMPOOL(PBUF_POOL, PBUF_POOL_SIZE, PBUF_POOL_BUFSIZE, "PBUF_POOL") + + +/* + * Allow for user-defined pools; this must be explicitly set in lwipopts.h + * since the default is to NOT look for lwippools.h + */ +#if MEMP_USE_CUSTOM_POOLS +#include "lwippools.h" +#endif /* MEMP_USE_CUSTOM_POOLS */ + +/* + * REQUIRED CLEANUP: Clear up so we don't get "multiply defined" error later + * (#undef is ignored for something that is not defined) + */ +#undef LWIP_MEMPOOL +#undef LWIP_MALLOC_MEMPOOL +#undef LWIP_MALLOC_MEMPOOL_START +#undef LWIP_MALLOC_MEMPOOL_END +#undef LWIP_PBUF_MEMPOOL diff --git a/lib/drivers/lwip/src/include/lwip/netbuf.h b/lib/drivers/lwip/src/include/lwip/netbuf.h new file mode 100644 index 00000000000..7d247d71b60 --- /dev/null +++ b/lib/drivers/lwip/src/include/lwip/netbuf.h @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ +#ifndef __LWIP_NETBUF_H__ +#define __LWIP_NETBUF_H__ + +#include "lwip/opt.h" +#include "lwip/pbuf.h" +#include "lwip/ip_addr.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** This netbuf has dest-addr/port set */ +#define NETBUF_FLAG_DESTADDR 0x01 +/** This netbuf includes a checksum */ +#define NETBUF_FLAG_CHKSUM 0x02 + +struct netbuf { + struct pbuf *p, *ptr; + ip_addr_t addr; + u16_t port; +#if LWIP_NETBUF_RECVINFO || LWIP_CHECKSUM_ON_COPY +#if LWIP_CHECKSUM_ON_COPY + u8_t flags; +#endif /* LWIP_CHECKSUM_ON_COPY */ + u16_t toport_chksum; +#if LWIP_NETBUF_RECVINFO + ip_addr_t toaddr; +#endif /* LWIP_NETBUF_RECVINFO */ +#endif /* LWIP_NETBUF_RECVINFO || LWIP_CHECKSUM_ON_COPY */ +}; + +/* Network buffer functions: */ +struct netbuf * netbuf_new (void); +void netbuf_delete (struct netbuf *buf); +void * netbuf_alloc (struct netbuf *buf, u16_t size); +void netbuf_free (struct netbuf *buf); +err_t netbuf_ref (struct netbuf *buf, + const void *dataptr, u16_t size); +void netbuf_chain (struct netbuf *head, + struct netbuf *tail); + +err_t netbuf_data (struct netbuf *buf, + void **dataptr, u16_t *len); +s8_t netbuf_next (struct netbuf *buf); +void netbuf_first (struct netbuf *buf); + + +#define netbuf_copy_partial(buf, dataptr, len, offset) \ + pbuf_copy_partial((buf)->p, (dataptr), (len), (offset)) +#define netbuf_copy(buf,dataptr,len) netbuf_copy_partial(buf, dataptr, len, 0) +#define netbuf_take(buf, dataptr, len) pbuf_take((buf)->p, dataptr, len) +#define netbuf_len(buf) ((buf)->p->tot_len) +#define netbuf_fromaddr(buf) (&((buf)->addr)) +#define netbuf_set_fromaddr(buf, fromaddr) ip_addr_set((&(buf)->addr), fromaddr) +#define netbuf_fromport(buf) ((buf)->port) +#if LWIP_NETBUF_RECVINFO +#define netbuf_destaddr(buf) (&((buf)->toaddr)) +#define netbuf_set_destaddr(buf, destaddr) ip_addr_set((&(buf)->addr), destaddr) +#define netbuf_destport(buf) (((buf)->flags & NETBUF_FLAG_DESTADDR) ? (buf)->toport_chksum : 0) +#endif /* LWIP_NETBUF_RECVINFO */ +#if LWIP_CHECKSUM_ON_COPY +#define netbuf_set_chksum(buf, chksum) do { (buf)->flags = NETBUF_FLAG_CHKSUM; \ + (buf)->toport_chksum = chksum; } while(0) +#endif /* LWIP_CHECKSUM_ON_COPY */ + +#ifdef __cplusplus +} +#endif + +#endif /* __LWIP_NETBUF_H__ */ diff --git a/lib/drivers/lwip/src/include/lwip/netdb.h b/lib/drivers/lwip/src/include/lwip/netdb.h new file mode 100644 index 00000000000..7587e2f2d16 --- /dev/null +++ b/lib/drivers/lwip/src/include/lwip/netdb.h @@ -0,0 +1,124 @@ +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Simon Goldschmidt + * + */ +#ifndef __LWIP_NETDB_H__ +#define __LWIP_NETDB_H__ + +#include "lwip/opt.h" + +#if LWIP_DNS && LWIP_SOCKET + +#include /* for size_t */ + +#include "lwip/inet.h" +#include "lwip/sockets.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* some rarely used options */ +#ifndef LWIP_DNS_API_DECLARE_H_ERRNO +#define LWIP_DNS_API_DECLARE_H_ERRNO 1 +#endif + +#ifndef LWIP_DNS_API_DEFINE_ERRORS +#define LWIP_DNS_API_DEFINE_ERRORS 1 +#endif + +#ifndef LWIP_DNS_API_DECLARE_STRUCTS +#define LWIP_DNS_API_DECLARE_STRUCTS 1 +#endif + +#if LWIP_DNS_API_DEFINE_ERRORS +/** Errors used by the DNS API functions, h_errno can be one of them */ +#define EAI_NONAME 200 +#define EAI_SERVICE 201 +#define EAI_FAIL 202 +#define EAI_MEMORY 203 + +#define HOST_NOT_FOUND 210 +#define NO_DATA 211 +#define NO_RECOVERY 212 +#define TRY_AGAIN 213 +#endif /* LWIP_DNS_API_DEFINE_ERRORS */ + +#if LWIP_DNS_API_DECLARE_STRUCTS +struct hostent { + char *h_name; /* Official name of the host. */ + char **h_aliases; /* A pointer to an array of pointers to alternative host names, + terminated by a null pointer. */ + int h_addrtype; /* Address type. */ + int h_length; /* The length, in bytes, of the address. */ + char **h_addr_list; /* A pointer to an array of pointers to network addresses (in + network byte order) for the host, terminated by a null pointer. */ +#define h_addr h_addr_list[0] /* for backward compatibility */ +}; + +struct addrinfo { + int ai_flags; /* Input flags. */ + int ai_family; /* Address family of socket. */ + int ai_socktype; /* Socket type. */ + int ai_protocol; /* Protocol of socket. */ + socklen_t ai_addrlen; /* Length of socket address. */ + struct sockaddr *ai_addr; /* Socket address of socket. */ + char *ai_canonname; /* Canonical name of service location. */ + struct addrinfo *ai_next; /* Pointer to next in list. */ +}; +#endif /* LWIP_DNS_API_DECLARE_STRUCTS */ + +#if LWIP_DNS_API_DECLARE_H_ERRNO +/* application accessable error code set by the DNS API functions */ +extern int h_errno; +#endif /* LWIP_DNS_API_DECLARE_H_ERRNO*/ + +struct hostent *lwip_gethostbyname(const char *name); +int lwip_gethostbyname_r(const char *name, struct hostent *ret, char *buf, + size_t buflen, struct hostent **result, int *h_errnop); +void lwip_freeaddrinfo(struct addrinfo *ai); +int lwip_getaddrinfo(const char *nodename, + const char *servname, + const struct addrinfo *hints, + struct addrinfo **res); + +#if LWIP_COMPAT_SOCKETS +#define gethostbyname(name) lwip_gethostbyname(name) +#define gethostbyname_r(name, ret, buf, buflen, result, h_errnop) \ + lwip_gethostbyname_r(name, ret, buf, buflen, result, h_errnop) +#define freeaddrinfo(addrinfo) lwip_freeaddrinfo(addrinfo) +#define getaddrinfo(nodname, servname, hints, res) \ + lwip_getaddrinfo(nodname, servname, hints, res) +#endif /* LWIP_COMPAT_SOCKETS */ + +#ifdef __cplusplus +} +#endif + +#endif /* LWIP_DNS && LWIP_SOCKET */ + +#endif /* __LWIP_NETDB_H__ */ diff --git a/lib/drivers/lwip/src/include/lwip/netif.h b/lib/drivers/lwip/src/include/lwip/netif.h new file mode 100644 index 00000000000..a8790b5f6a5 --- /dev/null +++ b/lib/drivers/lwip/src/include/lwip/netif.h @@ -0,0 +1,315 @@ +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ +#ifndef __LWIP_NETIF_H__ +#define __LWIP_NETIF_H__ + +#include "lwip/opt.h" + +#define ENABLE_LOOPBACK (LWIP_NETIF_LOOPBACK || LWIP_HAVE_LOOPIF) + +#include "lwip/err.h" + +#include "lwip/ip_addr.h" + +#include "lwip/def.h" +#include "lwip/pbuf.h" +#if LWIP_DHCP +struct dhcp; +#endif +#if LWIP_AUTOIP +struct autoip; +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* Throughout this file, IP addresses are expected to be in + * the same byte order as in IP_PCB. */ + +/** must be the maximum of all used hardware address lengths + across all types of interfaces in use */ +#define NETIF_MAX_HWADDR_LEN 6U + +/** Whether the network interface is 'up'. This is + * a software flag used to control whether this network + * interface is enabled and processes traffic. + * It is set by the startup code (for static IP configuration) or + * by dhcp/autoip when an address has been assigned. + */ +#define NETIF_FLAG_UP 0x01U +/** If set, the netif has broadcast capability. + * Set by the netif driver in its init function. */ +#define NETIF_FLAG_BROADCAST 0x02U +/** If set, the netif is one end of a point-to-point connection. + * Set by the netif driver in its init function. */ +#define NETIF_FLAG_POINTTOPOINT 0x04U +/** If set, the interface is configured using DHCP. + * Set by the DHCP code when starting or stopping DHCP. */ +#define NETIF_FLAG_DHCP 0x08U +/** If set, the interface has an active link + * (set by the network interface driver). + * Either set by the netif driver in its init function (if the link + * is up at that time) or at a later point once the link comes up + * (if link detection is supported by the hardware). */ +#define NETIF_FLAG_LINK_UP 0x10U +/** If set, the netif is an ethernet device using ARP. + * Set by the netif driver in its init function. + * Used to check input packet types and use of DHCP. */ +#define NETIF_FLAG_ETHARP 0x20U +/** If set, the netif is an ethernet device. It might not use + * ARP or TCP/IP if it is used for PPPoE only. + */ +#define NETIF_FLAG_ETHERNET 0x40U +/** If set, the netif has IGMP capability. + * Set by the netif driver in its init function. */ +#define NETIF_FLAG_IGMP 0x80U + +/** Function prototype for netif init functions. Set up flags and output/linkoutput + * callback functions in this function. + * + * @param netif The netif to initialize + */ +typedef err_t (*netif_init_fn)(struct netif *netif); +/** Function prototype for netif->input functions. This function is saved as 'input' + * callback function in the netif struct. Call it when a packet has been received. + * + * @param p The received packet, copied into a pbuf + * @param inp The netif which received the packet + */ +typedef err_t (*netif_input_fn)(struct pbuf *p, struct netif *inp); +/** Function prototype for netif->output functions. Called by lwIP when a packet + * shall be sent. For ethernet netif, set this to 'etharp_output' and set + * 'linkoutput'. + * + * @param netif The netif which shall send a packet + * @param p The packet to send (p->payload points to IP header) + * @param ipaddr The IP address to which the packet shall be sent + */ +typedef err_t (*netif_output_fn)(struct netif *netif, struct pbuf *p, + ip_addr_t *ipaddr); +/** Function prototype for netif->linkoutput functions. Only used for ethernet + * netifs. This function is called by ARP when a packet shall be sent. + * + * @param netif The netif which shall send a packet + * @param p The packet to send (raw ethernet packet) + */ +typedef err_t (*netif_linkoutput_fn)(struct netif *netif, struct pbuf *p); +/** Function prototype for netif status- or link-callback functions. */ +typedef void (*netif_status_callback_fn)(struct netif *netif); +/** Function prototype for netif igmp_mac_filter functions */ +typedef err_t (*netif_igmp_mac_filter_fn)(struct netif *netif, + ip_addr_t *group, u8_t action); + +/** Generic data structure used for all lwIP network interfaces. + * The following fields should be filled in by the initialization + * function for the device driver: hwaddr_len, hwaddr[], mtu, flags */ +struct netif { + /** pointer to next in linked list */ + struct netif *next; + + /** IP address configuration in network byte order */ + ip_addr_t ip_addr; + ip_addr_t netmask; + ip_addr_t gw; + + /** This function is called by the network device driver + * to pass a packet up the TCP/IP stack. */ + netif_input_fn input; + /** This function is called by the IP module when it wants + * to send a packet on the interface. This function typically + * first resolves the hardware address, then sends the packet. */ + netif_output_fn output; + /** This function is called by the ARP module when it wants + * to send a packet on the interface. This function outputs + * the pbuf as-is on the link medium. */ + netif_linkoutput_fn linkoutput; +#if LWIP_NETIF_STATUS_CALLBACK + /** This function is called when the netif state is set to up or down + */ + netif_status_callback_fn status_callback; +#endif /* LWIP_NETIF_STATUS_CALLBACK */ +#if LWIP_NETIF_LINK_CALLBACK + /** This function is called when the netif link is set to up or down + */ + netif_status_callback_fn link_callback; +#endif /* LWIP_NETIF_LINK_CALLBACK */ + /** This field can be set by the device driver and could point + * to state information for the device. */ + void *state; +#if LWIP_DHCP + /** the DHCP client state information for this netif */ + struct dhcp *dhcp; +#endif /* LWIP_DHCP */ +#if LWIP_AUTOIP + /** the AutoIP client state information for this netif */ + struct autoip *autoip; +#endif +#if LWIP_NETIF_HOSTNAME + /* the hostname for this netif, NULL is a valid value */ + char* hostname; +#endif /* LWIP_NETIF_HOSTNAME */ + /** maximum transfer unit (in bytes) */ + u16_t mtu; + /** number of bytes used in hwaddr */ + u8_t hwaddr_len; + /** link level hardware address of this interface */ + u8_t hwaddr[NETIF_MAX_HWADDR_LEN]; + /** flags (see NETIF_FLAG_ above) */ + u8_t flags; + /** descriptive abbreviation */ + char name[2]; + /** number of this interface */ + u8_t num; +#if LWIP_SNMP + /** link type (from "snmp_ifType" enum from snmp.h) */ + u8_t link_type; + /** (estimate) link speed */ + u32_t link_speed; + /** timestamp at last change made (up/down) */ + u32_t ts; + /** counters */ + u32_t ifinoctets; + u32_t ifinucastpkts; + u32_t ifinnucastpkts; + u32_t ifindiscards; + u32_t ifoutoctets; + u32_t ifoutucastpkts; + u32_t ifoutnucastpkts; + u32_t ifoutdiscards; +#endif /* LWIP_SNMP */ +#if LWIP_IGMP + /** This function could be called to add or delete a entry in the multicast + filter table of the ethernet MAC.*/ + netif_igmp_mac_filter_fn igmp_mac_filter; +#endif /* LWIP_IGMP */ +#if LWIP_NETIF_HWADDRHINT + u8_t *addr_hint; +#endif /* LWIP_NETIF_HWADDRHINT */ +#if ENABLE_LOOPBACK + /* List of packets to be queued for ourselves. */ + struct pbuf *loop_first; + struct pbuf *loop_last; +#if LWIP_LOOPBACK_MAX_PBUFS + u16_t loop_cnt_current; +#endif /* LWIP_LOOPBACK_MAX_PBUFS */ +#endif /* ENABLE_LOOPBACK */ +}; + +#if LWIP_SNMP +#define NETIF_INIT_SNMP(netif, type, speed) \ + /* use "snmp_ifType" enum from snmp.h for "type", snmp_ifType_ethernet_csmacd by example */ \ + (netif)->link_type = (type); \ + /* your link speed here (units: bits per second) */ \ + (netif)->link_speed = (speed); \ + (netif)->ts = 0; \ + (netif)->ifinoctets = 0; \ + (netif)->ifinucastpkts = 0; \ + (netif)->ifinnucastpkts = 0; \ + (netif)->ifindiscards = 0; \ + (netif)->ifoutoctets = 0; \ + (netif)->ifoutucastpkts = 0; \ + (netif)->ifoutnucastpkts = 0; \ + (netif)->ifoutdiscards = 0 +#else /* LWIP_SNMP */ +#define NETIF_INIT_SNMP(netif, type, speed) +#endif /* LWIP_SNMP */ + + +/** The list of network interfaces. */ +extern struct netif *netif_list; +/** The default network interface. */ +extern struct netif *netif_default; + +void netif_init(void); + +struct netif *netif_add(struct netif *netif, ip_addr_t *ipaddr, ip_addr_t *netmask, + ip_addr_t *gw, void *state, netif_init_fn init, netif_input_fn input); + +void +netif_set_addr(struct netif *netif, ip_addr_t *ipaddr, ip_addr_t *netmask, + ip_addr_t *gw); +void netif_remove(struct netif * netif); + +/* Returns a network interface given its name. The name is of the form + "et0", where the first two letters are the "name" field in the + netif structure, and the digit is in the num field in the same + structure. */ +struct netif *netif_find(char *name); + +void netif_set_default(struct netif *netif); + +void netif_set_ipaddr(struct netif *netif, ip_addr_t *ipaddr); +void netif_set_netmask(struct netif *netif, ip_addr_t *netmask); +void netif_set_gw(struct netif *netif, ip_addr_t *gw); + +void netif_set_up(struct netif *netif); +void netif_set_down(struct netif *netif); +/** Ask if an interface is up */ +#define netif_is_up(netif) (((netif)->flags & NETIF_FLAG_UP) ? (u8_t)1 : (u8_t)0) + +#if LWIP_NETIF_STATUS_CALLBACK +void netif_set_status_callback(struct netif *netif, netif_status_callback_fn status_callback); +#endif /* LWIP_NETIF_STATUS_CALLBACK */ + +void netif_set_link_up(struct netif *netif); +void netif_set_link_down(struct netif *netif); +/** Ask if a link is up */ +#define netif_is_link_up(netif) (((netif)->flags & NETIF_FLAG_LINK_UP) ? (u8_t)1 : (u8_t)0) + +#if LWIP_NETIF_LINK_CALLBACK +void netif_set_link_callback(struct netif *netif, netif_status_callback_fn link_callback); +#endif /* LWIP_NETIF_LINK_CALLBACK */ + +#if LWIP_NETIF_HOSTNAME +#define netif_set_hostname(netif, name) do { if((netif) != NULL) { (netif)->hostname = name; }}while(0) +#define netif_get_hostname(netif) (((netif) != NULL) ? ((netif)->hostname) : NULL) +#endif /* LWIP_NETIF_HOSTNAME */ + +#if LWIP_IGMP +#define netif_set_igmp_mac_filter(netif, function) do { if((netif) != NULL) { (netif)->igmp_mac_filter = function; }}while(0) +#define netif_get_igmp_mac_filter(netif) (((netif) != NULL) ? ((netif)->igmp_mac_filter) : NULL) +#endif /* LWIP_IGMP */ + +#if ENABLE_LOOPBACK +err_t netif_loop_output(struct netif *netif, struct pbuf *p, ip_addr_t *dest_ip); +void netif_poll(struct netif *netif); +#if !LWIP_NETIF_LOOPBACK_MULTITHREADING +void netif_poll_all(void); +#endif /* !LWIP_NETIF_LOOPBACK_MULTITHREADING */ +#endif /* ENABLE_LOOPBACK */ + +#ifdef __cplusplus +} +#endif + +#endif /* __LWIP_NETIF_H__ */ diff --git a/lib/drivers/lwip/src/include/lwip/netifapi.h b/lib/drivers/lwip/src/include/lwip/netifapi.h new file mode 100644 index 00000000000..33318efaf6c --- /dev/null +++ b/lib/drivers/lwip/src/include/lwip/netifapi.h @@ -0,0 +1,108 @@ +/* + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + */ + +#ifndef __LWIP_NETIFAPI_H__ +#define __LWIP_NETIFAPI_H__ + +#include "lwip/opt.h" + +#if LWIP_NETIF_API /* don't build if not configured for use in lwipopts.h */ + +#include "lwip/sys.h" +#include "lwip/netif.h" +#include "lwip/dhcp.h" +#include "lwip/autoip.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void (*netifapi_void_fn)(struct netif *netif); +typedef err_t (*netifapi_errt_fn)(struct netif *netif); + +struct netifapi_msg_msg { +#if !LWIP_TCPIP_CORE_LOCKING + sys_sem_t sem; +#endif /* !LWIP_TCPIP_CORE_LOCKING */ + err_t err; + struct netif *netif; + union { + struct { + ip_addr_t *ipaddr; + ip_addr_t *netmask; + ip_addr_t *gw; + void *state; + netif_init_fn init; + netif_input_fn input; + } add; + struct { + netifapi_void_fn voidfunc; + netifapi_errt_fn errtfunc; + } common; + } msg; +}; + +struct netifapi_msg { + void (* function)(struct netifapi_msg_msg *msg); + struct netifapi_msg_msg msg; +}; + + +/* API for application */ +err_t netifapi_netif_add ( struct netif *netif, + ip_addr_t *ipaddr, + ip_addr_t *netmask, + ip_addr_t *gw, + void *state, + netif_init_fn init, + netif_input_fn input); + +err_t netifapi_netif_set_addr ( struct netif *netif, + ip_addr_t *ipaddr, + ip_addr_t *netmask, + ip_addr_t *gw ); + +err_t netifapi_netif_common ( struct netif *netif, + netifapi_void_fn voidfunc, + netifapi_errt_fn errtfunc); + +#define netifapi_netif_remove(n) netifapi_netif_common(n, netif_remove, NULL) +#define netifapi_netif_set_up(n) netifapi_netif_common(n, netif_set_up, NULL) +#define netifapi_netif_set_down(n) netifapi_netif_common(n, netif_set_down, NULL) +#define netifapi_netif_set_default(n) netifapi_netif_common(n, netif_set_default, NULL) +#define netifapi_dhcp_start(n) netifapi_netif_common(n, NULL, dhcp_start) +#define netifapi_dhcp_stop(n) netifapi_netif_common(n, dhcp_stop, NULL) +#define netifapi_autoip_start(n) netifapi_netif_common(n, NULL, autoip_start) +#define netifapi_autoip_stop(n) netifapi_netif_common(n, NULL, autoip_stop) + +#ifdef __cplusplus +} +#endif + +#endif /* LWIP_NETIF_API */ + +#endif /* __LWIP_NETIFAPI_H__ */ diff --git a/lib/drivers/lwip/src/include/lwip/opt.h b/lib/drivers/lwip/src/include/lwip/opt.h new file mode 100644 index 00000000000..a1b876583f1 --- /dev/null +++ b/lib/drivers/lwip/src/include/lwip/opt.h @@ -0,0 +1,2043 @@ +/** + * @file + * + * lwIP Options Configuration + */ + +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ +#ifndef __LWIP_OPT_H__ +#define __LWIP_OPT_H__ + +/* + * Include user defined options first. Anything not defined in these files + * will be set to standard values. Override anything you dont like! + */ +#include "lwipopts.h" +#include "lwip/debug.h" + +/* + ----------------------------------------------- + ---------- Platform specific locking ---------- + ----------------------------------------------- +*/ + +/** + * SYS_LIGHTWEIGHT_PROT==1: if you want inter-task protection for certain + * critical regions during buffer allocation, deallocation and memory + * allocation and deallocation. + */ +#ifndef SYS_LIGHTWEIGHT_PROT +#define SYS_LIGHTWEIGHT_PROT 0 +#endif + +/** + * NO_SYS==1: Provides VERY minimal functionality. Otherwise, + * use lwIP facilities. + */ +#ifndef NO_SYS +#define NO_SYS 0 +#endif + +/** + * NO_SYS_NO_TIMERS==1: Drop support for sys_timeout when NO_SYS==1 + * Mainly for compatibility to old versions. + */ +#ifndef NO_SYS_NO_TIMERS +#define NO_SYS_NO_TIMERS 0 +#endif + +/** + * MEMCPY: override this if you have a faster implementation at hand than the + * one included in your C library + */ +#ifndef MEMCPY +#define MEMCPY(dst,src,len) memcpy(dst,src,len) +#endif + +/** + * SMEMCPY: override this with care! Some compilers (e.g. gcc) can inline a + * call to memcpy() if the length is known at compile time and is small. + */ +#ifndef SMEMCPY +#define SMEMCPY(dst,src,len) memcpy(dst,src,len) +#endif + +/* + ------------------------------------ + ---------- Memory options ---------- + ------------------------------------ +*/ +/** + * MEM_LIBC_MALLOC==1: Use malloc/free/realloc provided by your C-library + * instead of the lwip internal allocator. Can save code size if you + * already use it. + */ +#ifndef MEM_LIBC_MALLOC +#define MEM_LIBC_MALLOC 0 +#endif + +/** +* MEMP_MEM_MALLOC==1: Use mem_malloc/mem_free instead of the lwip pool allocator. +* Especially useful with MEM_LIBC_MALLOC but handle with care regarding execution +* speed and usage from interrupts! +*/ +#ifndef MEMP_MEM_MALLOC +#define MEMP_MEM_MALLOC 0 +#endif + +/** + * MEM_ALIGNMENT: should be set to the alignment of the CPU + * 4 byte alignment -> #define MEM_ALIGNMENT 4 + * 2 byte alignment -> #define MEM_ALIGNMENT 2 + */ +#ifndef MEM_ALIGNMENT +#define MEM_ALIGNMENT 1 +#endif + +/** + * MEM_SIZE: the size of the heap memory. If the application will send + * a lot of data that needs to be copied, this should be set high. + */ +#ifndef MEM_SIZE +#define MEM_SIZE 1600 +#endif + +/** + * MEMP_SEPARATE_POOLS: if defined to 1, each pool is placed in its own array. + * This can be used to individually change the location of each pool. + * Default is one big array for all pools + */ +#ifndef MEMP_SEPARATE_POOLS +#define MEMP_SEPARATE_POOLS 0 +#endif + +/** + * MEMP_OVERFLOW_CHECK: memp overflow protection reserves a configurable + * amount of bytes before and after each memp element in every pool and fills + * it with a prominent default value. + * MEMP_OVERFLOW_CHECK == 0 no checking + * MEMP_OVERFLOW_CHECK == 1 checks each element when it is freed + * MEMP_OVERFLOW_CHECK >= 2 checks each element in every pool every time + * memp_malloc() or memp_free() is called (useful but slow!) + */ +#ifndef MEMP_OVERFLOW_CHECK +#define MEMP_OVERFLOW_CHECK 0 +#endif + +/** + * MEMP_SANITY_CHECK==1: run a sanity check after each memp_free() to make + * sure that there are no cycles in the linked lists. + */ +#ifndef MEMP_SANITY_CHECK +#define MEMP_SANITY_CHECK 0 +#endif + +/** + * MEM_USE_POOLS==1: Use an alternative to malloc() by allocating from a set + * of memory pools of various sizes. When mem_malloc is called, an element of + * the smallest pool that can provide the length needed is returned. + * To use this, MEMP_USE_CUSTOM_POOLS also has to be enabled. + */ +#ifndef MEM_USE_POOLS +#define MEM_USE_POOLS 0 +#endif + +/** + * MEM_USE_POOLS_TRY_BIGGER_POOL==1: if one malloc-pool is empty, try the next + * bigger pool - WARNING: THIS MIGHT WASTE MEMORY but it can make a system more + * reliable. */ +#ifndef MEM_USE_POOLS_TRY_BIGGER_POOL +#define MEM_USE_POOLS_TRY_BIGGER_POOL 0 +#endif + +/** + * MEMP_USE_CUSTOM_POOLS==1: whether to include a user file lwippools.h + * that defines additional pools beyond the "standard" ones required + * by lwIP. If you set this to 1, you must have lwippools.h in your + * inlude path somewhere. + */ +#ifndef MEMP_USE_CUSTOM_POOLS +#define MEMP_USE_CUSTOM_POOLS 0 +#endif + +/** + * Set this to 1 if you want to free PBUF_RAM pbufs (or call mem_free()) from + * interrupt context (or another context that doesn't allow waiting for a + * semaphore). + * If set to 1, mem_malloc will be protected by a semaphore and SYS_ARCH_PROTECT, + * while mem_free will only use SYS_ARCH_PROTECT. mem_malloc SYS_ARCH_UNPROTECTs + * with each loop so that mem_free can run. + * + * ATTENTION: As you can see from the above description, this leads to dis-/ + * enabling interrupts often, which can be slow! Also, on low memory, mem_malloc + * can need longer. + * + * If you don't want that, at least for NO_SYS=0, you can still use the following + * functions to enqueue a deallocation call which then runs in the tcpip_thread + * context: + * - pbuf_free_callback(p); + * - mem_free_callback(m); + */ +#ifndef LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT +#define LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT 0 +#endif + +/* + ------------------------------------------------ + ---------- Internal Memory Pool Sizes ---------- + ------------------------------------------------ +*/ +/** + * MEMP_NUM_PBUF: the number of memp struct pbufs (used for PBUF_ROM and PBUF_REF). + * If the application sends a lot of data out of ROM (or other static memory), + * this should be set high. + */ +#ifndef MEMP_NUM_PBUF +#define MEMP_NUM_PBUF 16 +#endif + +/** + * MEMP_NUM_RAW_PCB: Number of raw connection PCBs + * (requires the LWIP_RAW option) + */ +#ifndef MEMP_NUM_RAW_PCB +#define MEMP_NUM_RAW_PCB 4 +#endif + +/** + * MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One + * per active UDP "connection". + * (requires the LWIP_UDP option) + */ +#ifndef MEMP_NUM_UDP_PCB +#define MEMP_NUM_UDP_PCB 4 +#endif + +/** + * MEMP_NUM_TCP_PCB: the number of simulatenously active TCP connections. + * (requires the LWIP_TCP option) + */ +#ifndef MEMP_NUM_TCP_PCB +#define MEMP_NUM_TCP_PCB 5 +#endif + +/** + * MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP connections. + * (requires the LWIP_TCP option) + */ +#ifndef MEMP_NUM_TCP_PCB_LISTEN +#define MEMP_NUM_TCP_PCB_LISTEN 8 +#endif + +/** + * MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP segments. + * (requires the LWIP_TCP option) + */ +#ifndef MEMP_NUM_TCP_SEG +#define MEMP_NUM_TCP_SEG 16 +#endif + +/** + * MEMP_NUM_REASSDATA: the number of IP packets simultaneously queued for + * reassembly (whole packets, not fragments!) + */ +#ifndef MEMP_NUM_REASSDATA +#define MEMP_NUM_REASSDATA 5 +#endif + +/** + * MEMP_NUM_FRAG_PBUF: the number of IP fragments simultaneously sent + * (fragments, not whole packets!). + * This is only used with IP_FRAG_USES_STATIC_BUF==0 and + * LWIP_NETIF_TX_SINGLE_PBUF==0 and only has to be > 1 with DMA-enabled MACs + * where the packet is not yet sent when netif->output returns. + */ +#ifndef MEMP_NUM_FRAG_PBUF +#define MEMP_NUM_FRAG_PBUF 15 +#endif + +/** + * MEMP_NUM_ARP_QUEUE: the number of simulateously queued outgoing + * packets (pbufs) that are waiting for an ARP request (to resolve + * their destination address) to finish. + * (requires the ARP_QUEUEING option) + */ +#ifndef MEMP_NUM_ARP_QUEUE +#define MEMP_NUM_ARP_QUEUE 30 +#endif + +/** + * MEMP_NUM_IGMP_GROUP: The number of multicast groups whose network interfaces + * can be members et the same time (one per netif - allsystems group -, plus one + * per netif membership). + * (requires the LWIP_IGMP option) + */ +#ifndef MEMP_NUM_IGMP_GROUP +#define MEMP_NUM_IGMP_GROUP 8 +#endif + +/** + * MEMP_NUM_SYS_TIMEOUT: the number of simulateously active timeouts. + * (requires NO_SYS==0) + */ +#ifndef MEMP_NUM_SYS_TIMEOUT +#define MEMP_NUM_SYS_TIMEOUT 3 +#endif + +/** + * MEMP_NUM_NETBUF: the number of struct netbufs. + * (only needed if you use the sequential API, like api_lib.c) + */ +#ifndef MEMP_NUM_NETBUF +#define MEMP_NUM_NETBUF 2 +#endif + +/** + * MEMP_NUM_NETCONN: the number of struct netconns. + * (only needed if you use the sequential API, like api_lib.c) + */ +#ifndef MEMP_NUM_NETCONN +#define MEMP_NUM_NETCONN 4 +#endif + +/** + * MEMP_NUM_TCPIP_MSG_API: the number of struct tcpip_msg, which are used + * for callback/timeout API communication. + * (only needed if you use tcpip.c) + */ +#ifndef MEMP_NUM_TCPIP_MSG_API +#define MEMP_NUM_TCPIP_MSG_API 8 +#endif + +/** + * MEMP_NUM_TCPIP_MSG_INPKT: the number of struct tcpip_msg, which are used + * for incoming packets. + * (only needed if you use tcpip.c) + */ +#ifndef MEMP_NUM_TCPIP_MSG_INPKT +#define MEMP_NUM_TCPIP_MSG_INPKT 8 +#endif + +/** + * MEMP_NUM_SNMP_NODE: the number of leafs in the SNMP tree. + */ +#ifndef MEMP_NUM_SNMP_NODE +#define MEMP_NUM_SNMP_NODE 50 +#endif + +/** + * MEMP_NUM_SNMP_ROOTNODE: the number of branches in the SNMP tree. + * Every branch has one leaf (MEMP_NUM_SNMP_NODE) at least! + */ +#ifndef MEMP_NUM_SNMP_ROOTNODE +#define MEMP_NUM_SNMP_ROOTNODE 30 +#endif + +/** + * MEMP_NUM_SNMP_VARBIND: the number of concurrent requests (does not have to + * be changed normally) - 2 of these are used per request (1 for input, + * 1 for output) + */ +#ifndef MEMP_NUM_SNMP_VARBIND +#define MEMP_NUM_SNMP_VARBIND 2 +#endif + +/** + * MEMP_NUM_SNMP_VALUE: the number of OID or values concurrently used + * (does not have to be changed normally) - 3 of these are used per request + * (1 for the value read and 2 for OIDs - input and output) + */ +#ifndef MEMP_NUM_SNMP_VALUE +#define MEMP_NUM_SNMP_VALUE 3 +#endif + +/** + * MEMP_NUM_NETDB: the number of concurrently running lwip_addrinfo() calls + * (before freeing the corresponding memory using lwip_freeaddrinfo()). + */ +#ifndef MEMP_NUM_NETDB +#define MEMP_NUM_NETDB 1 +#endif + +/** + * MEMP_NUM_LOCALHOSTLIST: the number of host entries in the local host list + * if DNS_LOCAL_HOSTLIST_IS_DYNAMIC==1. + */ +#ifndef MEMP_NUM_LOCALHOSTLIST +#define MEMP_NUM_LOCALHOSTLIST 1 +#endif + +/** + * MEMP_NUM_PPPOE_INTERFACES: the number of concurrently active PPPoE + * interfaces (only used with PPPOE_SUPPORT==1) + */ +#ifndef MEMP_NUM_PPPOE_INTERFACES +#define MEMP_NUM_PPPOE_INTERFACES 1 +#endif + +/** + * PBUF_POOL_SIZE: the number of buffers in the pbuf pool. + */ +#ifndef PBUF_POOL_SIZE +#define PBUF_POOL_SIZE 16 +#endif + +/* + --------------------------------- + ---------- ARP options ---------- + --------------------------------- +*/ +/** + * LWIP_ARP==1: Enable ARP functionality. + */ +#ifndef LWIP_ARP +#define LWIP_ARP 1 +#endif + +/** + * ARP_TABLE_SIZE: Number of active MAC-IP address pairs cached. + */ +#ifndef ARP_TABLE_SIZE +#define ARP_TABLE_SIZE 10 +#endif + +/** + * ARP_QUEUEING==1: Multiple outgoing packets are queued during hardware address + * resolution. By default, only the most recent packet is queued per IP address. + * This is sufficient for most protocols and mainly reduces TCP connection + * startup time. Set this to 1 if you know your application sends more than one + * packet in a row to an IP address that is not in the ARP cache. + */ +#ifndef ARP_QUEUEING +#define ARP_QUEUEING 0 +#endif + +/** + * ETHARP_TRUST_IP_MAC==1: Incoming IP packets cause the ARP table to be + * updated with the source MAC and IP addresses supplied in the packet. + * You may want to disable this if you do not trust LAN peers to have the + * correct addresses, or as a limited approach to attempt to handle + * spoofing. If disabled, lwIP will need to make a new ARP request if + * the peer is not already in the ARP table, adding a little latency. + * The peer *is* in the ARP table if it requested our address before. + * Also notice that this slows down input processing of every IP packet! + */ +#ifndef ETHARP_TRUST_IP_MAC +#define ETHARP_TRUST_IP_MAC 0 +#endif + +/** + * ETHARP_SUPPORT_VLAN==1: support receiving ethernet packets with VLAN header. + * Additionally, you can define ETHARP_VLAN_CHECK to an u16_t VLAN ID to check. + * If ETHARP_VLAN_CHECK is defined, only VLAN-traffic for this VLAN is accepted. + * If ETHARP_VLAN_CHECK is not defined, all traffic is accepted. + */ +#ifndef ETHARP_SUPPORT_VLAN +#define ETHARP_SUPPORT_VLAN 0 +#endif + +/** LWIP_ETHERNET==1: enable ethernet support for PPPoE even though ARP + * might be disabled + */ +#ifndef LWIP_ETHERNET +#define LWIP_ETHERNET (LWIP_ARP || PPPOE_SUPPORT) +#endif + +/** ETH_PAD_SIZE: number of bytes added before the ethernet header to ensure + * alignment of payload after that header. Since the header is 14 bytes long, + * without this padding e.g. addresses in the IP header will not be aligned + * on a 32-bit boundary, so setting this to 2 can speed up 32-bit-platforms. + */ +#ifndef ETH_PAD_SIZE +#define ETH_PAD_SIZE 0 +#endif + +/** ETHARP_SUPPORT_STATIC_ENTRIES==1: enable code to support static ARP table + * entries (using etharp_add_static_entry/etharp_remove_static_entry). + */ +#ifndef ETHARP_SUPPORT_STATIC_ENTRIES +#define ETHARP_SUPPORT_STATIC_ENTRIES 0 +#endif + + +/* + -------------------------------- + ---------- IP options ---------- + -------------------------------- +*/ +/** + * IP_FORWARD==1: Enables the ability to forward IP packets across network + * interfaces. If you are going to run lwIP on a device with only one network + * interface, define this to 0. + */ +#ifndef IP_FORWARD +#define IP_FORWARD 0 +#endif + +/** + * IP_OPTIONS_ALLOWED: Defines the behavior for IP options. + * IP_OPTIONS_ALLOWED==0: All packets with IP options are dropped. + * IP_OPTIONS_ALLOWED==1: IP options are allowed (but not parsed). + */ +#ifndef IP_OPTIONS_ALLOWED +#define IP_OPTIONS_ALLOWED 1 +#endif + +/** + * IP_REASSEMBLY==1: Reassemble incoming fragmented IP packets. Note that + * this option does not affect outgoing packet sizes, which can be controlled + * via IP_FRAG. + */ +#ifndef IP_REASSEMBLY +#define IP_REASSEMBLY 1 +#endif + +/** + * IP_FRAG==1: Fragment outgoing IP packets if their size exceeds MTU. Note + * that this option does not affect incoming packet sizes, which can be + * controlled via IP_REASSEMBLY. + */ +#ifndef IP_FRAG +#define IP_FRAG 1 +#endif + +/** + * IP_REASS_MAXAGE: Maximum time (in multiples of IP_TMR_INTERVAL - so seconds, normally) + * a fragmented IP packet waits for all fragments to arrive. If not all fragments arrived + * in this time, the whole packet is discarded. + */ +#ifndef IP_REASS_MAXAGE +#define IP_REASS_MAXAGE 3 +#endif + +/** + * IP_REASS_MAX_PBUFS: Total maximum amount of pbufs waiting to be reassembled. + * Since the received pbufs are enqueued, be sure to configure + * PBUF_POOL_SIZE > IP_REASS_MAX_PBUFS so that the stack is still able to receive + * packets even if the maximum amount of fragments is enqueued for reassembly! + */ +#ifndef IP_REASS_MAX_PBUFS +#define IP_REASS_MAX_PBUFS 10 +#endif + +/** + * IP_FRAG_USES_STATIC_BUF==1: Use a static MTU-sized buffer for IP + * fragmentation. Otherwise pbufs are allocated and reference the original + * packet data to be fragmented (or with LWIP_NETIF_TX_SINGLE_PBUF==1, + * new PBUF_RAM pbufs are used for fragments). + * ATTENTION: IP_FRAG_USES_STATIC_BUF==1 may not be used for DMA-enabled MACs! + */ +#ifndef IP_FRAG_USES_STATIC_BUF +#define IP_FRAG_USES_STATIC_BUF 0 +#endif + +/** + * IP_FRAG_MAX_MTU: Assumed max MTU on any interface for IP frag buffer + * (requires IP_FRAG_USES_STATIC_BUF==1) + */ +#if IP_FRAG_USES_STATIC_BUF && !defined(IP_FRAG_MAX_MTU) +#define IP_FRAG_MAX_MTU 1500 +#endif + +/** + * IP_DEFAULT_TTL: Default value for Time-To-Live used by transport layers. + */ +#ifndef IP_DEFAULT_TTL +#define IP_DEFAULT_TTL 255 +#endif + +/** + * IP_SOF_BROADCAST=1: Use the SOF_BROADCAST field to enable broadcast + * filter per pcb on udp and raw send operations. To enable broadcast filter + * on recv operations, you also have to set IP_SOF_BROADCAST_RECV=1. + */ +#ifndef IP_SOF_BROADCAST +#define IP_SOF_BROADCAST 0 +#endif + +/** + * IP_SOF_BROADCAST_RECV (requires IP_SOF_BROADCAST=1) enable the broadcast + * filter on recv operations. + */ +#ifndef IP_SOF_BROADCAST_RECV +#define IP_SOF_BROADCAST_RECV 0 +#endif + +/* + ---------------------------------- + ---------- ICMP options ---------- + ---------------------------------- +*/ +/** + * LWIP_ICMP==1: Enable ICMP module inside the IP stack. + * Be careful, disable that make your product non-compliant to RFC1122 + */ +#ifndef LWIP_ICMP +#define LWIP_ICMP 1 +#endif + +/** + * ICMP_TTL: Default value for Time-To-Live used by ICMP packets. + */ +#ifndef ICMP_TTL +#define ICMP_TTL (IP_DEFAULT_TTL) +#endif + +/** + * LWIP_BROADCAST_PING==1: respond to broadcast pings (default is unicast only) + */ +#ifndef LWIP_BROADCAST_PING +#define LWIP_BROADCAST_PING 0 +#endif + +/** + * LWIP_MULTICAST_PING==1: respond to multicast pings (default is unicast only) + */ +#ifndef LWIP_MULTICAST_PING +#define LWIP_MULTICAST_PING 0 +#endif + +/* + --------------------------------- + ---------- RAW options ---------- + --------------------------------- +*/ +/** + * LWIP_RAW==1: Enable application layer to hook into the IP layer itself. + */ +#ifndef LWIP_RAW +#define LWIP_RAW 1 +#endif + +/** + * LWIP_RAW==1: Enable application layer to hook into the IP layer itself. + */ +#ifndef RAW_TTL +#define RAW_TTL (IP_DEFAULT_TTL) +#endif + +/* + ---------------------------------- + ---------- DHCP options ---------- + ---------------------------------- +*/ +/** + * LWIP_DHCP==1: Enable DHCP module. + */ +#ifndef LWIP_DHCP +#define LWIP_DHCP 0 +#endif + +/** + * DHCP_DOES_ARP_CHECK==1: Do an ARP check on the offered address. + */ +#ifndef DHCP_DOES_ARP_CHECK +#define DHCP_DOES_ARP_CHECK ((LWIP_DHCP) && (LWIP_ARP)) +#endif + +/* + ------------------------------------ + ---------- AUTOIP options ---------- + ------------------------------------ +*/ +/** + * LWIP_AUTOIP==1: Enable AUTOIP module. + */ +#ifndef LWIP_AUTOIP +#define LWIP_AUTOIP 0 +#endif + +/** + * LWIP_DHCP_AUTOIP_COOP==1: Allow DHCP and AUTOIP to be both enabled on + * the same interface at the same time. + */ +#ifndef LWIP_DHCP_AUTOIP_COOP +#define LWIP_DHCP_AUTOIP_COOP 0 +#endif + +/** + * LWIP_DHCP_AUTOIP_COOP_TRIES: Set to the number of DHCP DISCOVER probes + * that should be sent before falling back on AUTOIP. This can be set + * as low as 1 to get an AutoIP address very quickly, but you should + * be prepared to handle a changing IP address when DHCP overrides + * AutoIP. + */ +#ifndef LWIP_DHCP_AUTOIP_COOP_TRIES +#define LWIP_DHCP_AUTOIP_COOP_TRIES 9 +#endif + +/* + ---------------------------------- + ---------- SNMP options ---------- + ---------------------------------- +*/ +/** + * LWIP_SNMP==1: Turn on SNMP module. UDP must be available for SNMP + * transport. + */ +#ifndef LWIP_SNMP +#define LWIP_SNMP 0 +#endif + +/** + * SNMP_CONCURRENT_REQUESTS: Number of concurrent requests the module will + * allow. At least one request buffer is required. + * Does not have to be changed unless external MIBs answer request asynchronously + */ +#ifndef SNMP_CONCURRENT_REQUESTS +#define SNMP_CONCURRENT_REQUESTS 1 +#endif + +/** + * SNMP_TRAP_DESTINATIONS: Number of trap destinations. At least one trap + * destination is required + */ +#ifndef SNMP_TRAP_DESTINATIONS +#define SNMP_TRAP_DESTINATIONS 1 +#endif + +/** + * SNMP_PRIVATE_MIB: + * When using a private MIB, you have to create a file 'private_mib.h' that contains + * a 'struct mib_array_node mib_private' which contains your MIB. + */ +#ifndef SNMP_PRIVATE_MIB +#define SNMP_PRIVATE_MIB 0 +#endif + +/** + * Only allow SNMP write actions that are 'safe' (e.g. disabeling netifs is not + * a safe action and disabled when SNMP_SAFE_REQUESTS = 1). + * Unsafe requests are disabled by default! + */ +#ifndef SNMP_SAFE_REQUESTS +#define SNMP_SAFE_REQUESTS 1 +#endif + +/** + * The maximum length of strings used. This affects the size of + * MEMP_SNMP_VALUE elements. + */ +#ifndef SNMP_MAX_OCTET_STRING_LEN +#define SNMP_MAX_OCTET_STRING_LEN 127 +#endif + +/** + * The maximum depth of the SNMP tree. + * With private MIBs enabled, this depends on your MIB! + * This affects the size of MEMP_SNMP_VALUE elements. + */ +#ifndef SNMP_MAX_TREE_DEPTH +#define SNMP_MAX_TREE_DEPTH 15 +#endif + +/** + * The size of the MEMP_SNMP_VALUE elements, normally calculated from + * SNMP_MAX_OCTET_STRING_LEN and SNMP_MAX_TREE_DEPTH. + */ +#ifndef SNMP_MAX_VALUE_SIZE +#define SNMP_MAX_VALUE_SIZE LWIP_MAX((SNMP_MAX_OCTET_STRING_LEN)+1, sizeof(s32_t)*(SNMP_MAX_TREE_DEPTH)) +#endif + +/* + ---------------------------------- + ---------- IGMP options ---------- + ---------------------------------- +*/ +/** + * LWIP_IGMP==1: Turn on IGMP module. + */ +#ifndef LWIP_IGMP +#define LWIP_IGMP 0 +#endif + +/* + ---------------------------------- + ---------- DNS options ----------- + ---------------------------------- +*/ +/** + * LWIP_DNS==1: Turn on DNS module. UDP must be available for DNS + * transport. + */ +#ifndef LWIP_DNS +#define LWIP_DNS 0 +#endif + +/** DNS maximum number of entries to maintain locally. */ +#ifndef DNS_TABLE_SIZE +#define DNS_TABLE_SIZE 4 +#endif + +/** DNS maximum host name length supported in the name table. */ +#ifndef DNS_MAX_NAME_LENGTH +#define DNS_MAX_NAME_LENGTH 256 +#endif + +/** The maximum of DNS servers */ +#ifndef DNS_MAX_SERVERS +#define DNS_MAX_SERVERS 2 +#endif + +/** DNS do a name checking between the query and the response. */ +#ifndef DNS_DOES_NAME_CHECK +#define DNS_DOES_NAME_CHECK 1 +#endif + +/** DNS message max. size. Default value is RFC compliant. */ +#ifndef DNS_MSG_SIZE +#define DNS_MSG_SIZE 512 +#endif + +/** DNS_LOCAL_HOSTLIST: Implements a local host-to-address list. If enabled, + * you have to define + * #define DNS_LOCAL_HOSTLIST_INIT {{"host1", 0x123}, {"host2", 0x234}} + * (an array of structs name/address, where address is an u32_t in network + * byte order). + * + * Instead, you can also use an external function: + * #define DNS_LOOKUP_LOCAL_EXTERN(x) extern u32_t my_lookup_function(const char *name) + * that returns the IP address or INADDR_NONE if not found. + */ +#ifndef DNS_LOCAL_HOSTLIST +#define DNS_LOCAL_HOSTLIST 0 +#endif /* DNS_LOCAL_HOSTLIST */ + +/** If this is turned on, the local host-list can be dynamically changed + * at runtime. */ +#ifndef DNS_LOCAL_HOSTLIST_IS_DYNAMIC +#define DNS_LOCAL_HOSTLIST_IS_DYNAMIC 0 +#endif /* DNS_LOCAL_HOSTLIST_IS_DYNAMIC */ + +/* + --------------------------------- + ---------- UDP options ---------- + --------------------------------- +*/ +/** + * LWIP_UDP==1: Turn on UDP. + */ +#ifndef LWIP_UDP +#define LWIP_UDP 1 +#endif + +/** + * LWIP_UDPLITE==1: Turn on UDP-Lite. (Requires LWIP_UDP) + */ +#ifndef LWIP_UDPLITE +#define LWIP_UDPLITE 0 +#endif + +/** + * UDP_TTL: Default Time-To-Live value. + */ +#ifndef UDP_TTL +#define UDP_TTL (IP_DEFAULT_TTL) +#endif + +/** + * LWIP_NETBUF_RECVINFO==1: append destination addr and port to every netbuf. + */ +#ifndef LWIP_NETBUF_RECVINFO +#define LWIP_NETBUF_RECVINFO 0 +#endif + +/* + --------------------------------- + ---------- TCP options ---------- + --------------------------------- +*/ +/** + * LWIP_TCP==1: Turn on TCP. + */ +#ifndef LWIP_TCP +#define LWIP_TCP 1 +#endif + +/** + * TCP_TTL: Default Time-To-Live value. + */ +#ifndef TCP_TTL +#define TCP_TTL (IP_DEFAULT_TTL) +#endif + +/** + * TCP_WND: The size of a TCP window. This must be at least + * (2 * TCP_MSS) for things to work well + */ +#ifndef TCP_WND +#define TCP_WND (4 * TCP_MSS) +#endif + +/** + * TCP_MAXRTX: Maximum number of retransmissions of data segments. + */ +#ifndef TCP_MAXRTX +#define TCP_MAXRTX 12 +#endif + +/** + * TCP_SYNMAXRTX: Maximum number of retransmissions of SYN segments. + */ +#ifndef TCP_SYNMAXRTX +#define TCP_SYNMAXRTX 6 +#endif + +/** + * TCP_QUEUE_OOSEQ==1: TCP will queue segments that arrive out of order. + * Define to 0 if your device is low on memory. + */ +#ifndef TCP_QUEUE_OOSEQ +#define TCP_QUEUE_OOSEQ (LWIP_TCP) +#endif + +/** + * TCP_MSS: TCP Maximum segment size. (default is 536, a conservative default, + * you might want to increase this.) + * For the receive side, this MSS is advertised to the remote side + * when opening a connection. For the transmit size, this MSS sets + * an upper limit on the MSS advertised by the remote host. + */ +#ifndef TCP_MSS +#define TCP_MSS 536 +#endif + +/** + * TCP_CALCULATE_EFF_SEND_MSS: "The maximum size of a segment that TCP really + * sends, the 'effective send MSS,' MUST be the smaller of the send MSS (which + * reflects the available reassembly buffer size at the remote host) and the + * largest size permitted by the IP layer" (RFC 1122) + * Setting this to 1 enables code that checks TCP_MSS against the MTU of the + * netif used for a connection and limits the MSS if it would be too big otherwise. + */ +#ifndef TCP_CALCULATE_EFF_SEND_MSS +#define TCP_CALCULATE_EFF_SEND_MSS 1 +#endif + + +/** + * TCP_SND_BUF: TCP sender buffer space (bytes). + */ +#ifndef TCP_SND_BUF +#define TCP_SND_BUF 256 +#endif + +/** + * TCP_SND_QUEUELEN: TCP sender buffer space (pbufs). This must be at least + * as much as (2 * TCP_SND_BUF/TCP_MSS) for things to work. + */ +#ifndef TCP_SND_QUEUELEN +#define TCP_SND_QUEUELEN ((4 * (TCP_SND_BUF) + (TCP_MSS - 1))/(TCP_MSS)) +#endif + +/** + * TCP_SNDLOWAT: TCP writable space (bytes). This must be less than + * TCP_SND_BUF. It is the amount of space which must be available in the + * TCP snd_buf for select to return writable (combined with TCP_SNDQUEUELOWAT). + */ +#ifndef TCP_SNDLOWAT +#define TCP_SNDLOWAT ((TCP_SND_BUF)/2) +#endif + +/** + * TCP_SNDQUEUELOWAT: TCP writable bufs (pbuf count). This must be grater + * than TCP_SND_QUEUELEN. If the number of pbufs queued on a pcb drops below + * this number, select returns writable (combined with TCP_SNDLOWAT). + */ +#ifndef TCP_SNDQUEUELOWAT +#define TCP_SNDQUEUELOWAT ((TCP_SND_QUEUELEN)/2) +#endif + +/** + * TCP_LISTEN_BACKLOG: Enable the backlog option for tcp listen pcb. + */ +#ifndef TCP_LISTEN_BACKLOG +#define TCP_LISTEN_BACKLOG 0 +#endif + +/** + * The maximum allowed backlog for TCP listen netconns. + * This backlog is used unless another is explicitly specified. + * 0xff is the maximum (u8_t). + */ +#ifndef TCP_DEFAULT_LISTEN_BACKLOG +#define TCP_DEFAULT_LISTEN_BACKLOG 0xff +#endif + +/** + * TCP_OVERSIZE: The maximum number of bytes that tcp_write may + * allocate ahead of time in an attempt to create shorter pbuf chains + * for transmission. The meaningful range is 0 to TCP_MSS. Some + * suggested values are: + * + * 0: Disable oversized allocation. Each tcp_write() allocates a new + pbuf (old behaviour). + * 1: Allocate size-aligned pbufs with minimal excess. Use this if your + * scatter-gather DMA requires aligned fragments. + * 128: Limit the pbuf/memory overhead to 20%. + * TCP_MSS: Try to create unfragmented TCP packets. + * TCP_MSS/4: Try to create 4 fragments or less per TCP packet. + */ +#ifndef TCP_OVERSIZE +#define TCP_OVERSIZE TCP_MSS +#endif + +/** + * LWIP_TCP_TIMESTAMPS==1: support the TCP timestamp option. + */ +#ifndef LWIP_TCP_TIMESTAMPS +#define LWIP_TCP_TIMESTAMPS 0 +#endif + +/** + * TCP_WND_UPDATE_THRESHOLD: difference in window to trigger an + * explicit window update + */ +#ifndef TCP_WND_UPDATE_THRESHOLD +#define TCP_WND_UPDATE_THRESHOLD (TCP_WND / 4) +#endif + +/** + * LWIP_EVENT_API and LWIP_CALLBACK_API: Only one of these should be set to 1. + * LWIP_EVENT_API==1: The user defines lwip_tcp_event() to receive all + * events (accept, sent, etc) that happen in the system. + * LWIP_CALLBACK_API==1: The PCB callback function is called directly + * for the event. + */ +#ifndef LWIP_EVENT_API +#define LWIP_EVENT_API 0 +#define LWIP_CALLBACK_API 1 +#else +#define LWIP_EVENT_API 1 +#define LWIP_CALLBACK_API 0 +#endif + + +/* + ---------------------------------- + ---------- Pbuf options ---------- + ---------------------------------- +*/ +/** + * PBUF_LINK_HLEN: the number of bytes that should be allocated for a + * link level header. The default is 14, the standard value for + * Ethernet. + */ +#ifndef PBUF_LINK_HLEN +#define PBUF_LINK_HLEN (14 + ETH_PAD_SIZE) +#endif + +/** + * PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. The default is + * designed to accomodate single full size TCP frame in one pbuf, including + * TCP_MSS, IP header, and link header. + */ +#ifndef PBUF_POOL_BUFSIZE +#define PBUF_POOL_BUFSIZE LWIP_MEM_ALIGN_SIZE(TCP_MSS+40+PBUF_LINK_HLEN) +#endif + +/* + ------------------------------------------------ + ---------- Network Interfaces options ---------- + ------------------------------------------------ +*/ +/** + * LWIP_NETIF_HOSTNAME==1: use DHCP_OPTION_HOSTNAME with netif's hostname + * field. + */ +#ifndef LWIP_NETIF_HOSTNAME +#define LWIP_NETIF_HOSTNAME 0 +#endif + +/** + * LWIP_NETIF_API==1: Support netif api (in netifapi.c) + */ +#ifndef LWIP_NETIF_API +#define LWIP_NETIF_API 0 +#endif + +/** + * LWIP_NETIF_STATUS_CALLBACK==1: Support a callback function whenever an interface + * changes its up/down status (i.e., due to DHCP IP acquistion) + */ +#ifndef LWIP_NETIF_STATUS_CALLBACK +#define LWIP_NETIF_STATUS_CALLBACK 0 +#endif + +/** + * LWIP_NETIF_LINK_CALLBACK==1: Support a callback function from an interface + * whenever the link changes (i.e., link down) + */ +#ifndef LWIP_NETIF_LINK_CALLBACK +#define LWIP_NETIF_LINK_CALLBACK 0 +#endif + +/** + * LWIP_NETIF_HWADDRHINT==1: Cache link-layer-address hints (e.g. table + * indices) in struct netif. TCP and UDP can make use of this to prevent + * scanning the ARP table for every sent packet. While this is faster for big + * ARP tables or many concurrent connections, it might be counterproductive + * if you have a tiny ARP table or if there never are concurrent connections. + */ +#ifndef LWIP_NETIF_HWADDRHINT +#define LWIP_NETIF_HWADDRHINT 0 +#endif + +/** + * LWIP_NETIF_LOOPBACK==1: Support sending packets with a destination IP + * address equal to the netif IP address, looping them back up the stack. + */ +#ifndef LWIP_NETIF_LOOPBACK +#define LWIP_NETIF_LOOPBACK 0 +#endif + +/** + * LWIP_LOOPBACK_MAX_PBUFS: Maximum number of pbufs on queue for loopback + * sending for each netif (0 = disabled) + */ +#ifndef LWIP_LOOPBACK_MAX_PBUFS +#define LWIP_LOOPBACK_MAX_PBUFS 0 +#endif + +/** + * LWIP_NETIF_LOOPBACK_MULTITHREADING: Indicates whether threading is enabled in + * the system, as netifs must change how they behave depending on this setting + * for the LWIP_NETIF_LOOPBACK option to work. + * Setting this is needed to avoid reentering non-reentrant functions like + * tcp_input(). + * LWIP_NETIF_LOOPBACK_MULTITHREADING==1: Indicates that the user is using a + * multithreaded environment like tcpip.c. In this case, netif->input() + * is called directly. + * LWIP_NETIF_LOOPBACK_MULTITHREADING==0: Indicates a polling (or NO_SYS) setup. + * The packets are put on a list and netif_poll() must be called in + * the main application loop. + */ +#ifndef LWIP_NETIF_LOOPBACK_MULTITHREADING +#define LWIP_NETIF_LOOPBACK_MULTITHREADING (!NO_SYS) +#endif + +/** + * LWIP_NETIF_TX_SINGLE_PBUF: if this is set to 1, lwIP tries to put all data + * to be sent into one single pbuf. This is for compatibility with DMA-enabled + * MACs that do not support scatter-gather. + * Beware that this might involve CPU-memcpy before transmitting that would not + * be needed without this flag! Use this only if you need to! + * + * @todo: TCP and IP-frag do not work with this, yet: + */ +#ifndef LWIP_NETIF_TX_SINGLE_PBUF +#define LWIP_NETIF_TX_SINGLE_PBUF 0 +#endif /* LWIP_NETIF_TX_SINGLE_PBUF */ + +/* + ------------------------------------ + ---------- LOOPIF options ---------- + ------------------------------------ +*/ +/** + * LWIP_HAVE_LOOPIF==1: Support loop interface (127.0.0.1) and loopif.c + */ +#ifndef LWIP_HAVE_LOOPIF +#define LWIP_HAVE_LOOPIF 0 +#endif + +/* + ------------------------------------ + ---------- SLIPIF options ---------- + ------------------------------------ +*/ +/** + * LWIP_HAVE_SLIPIF==1: Support slip interface and slipif.c + */ +#ifndef LWIP_HAVE_SLIPIF +#define LWIP_HAVE_SLIPIF 0 +#endif + +/* + ------------------------------------ + ---------- Thread options ---------- + ------------------------------------ +*/ +/** + * TCPIP_THREAD_NAME: The name assigned to the main tcpip thread. + */ +#ifndef TCPIP_THREAD_NAME +#define TCPIP_THREAD_NAME "tcpip_thread" +#endif + +/** + * TCPIP_THREAD_STACKSIZE: The stack size used by the main tcpip thread. + * The stack size value itself is platform-dependent, but is passed to + * sys_thread_new() when the thread is created. + */ +#ifndef TCPIP_THREAD_STACKSIZE +#define TCPIP_THREAD_STACKSIZE 0 +#endif + +/** + * TCPIP_THREAD_PRIO: The priority assigned to the main tcpip thread. + * The priority value itself is platform-dependent, but is passed to + * sys_thread_new() when the thread is created. + */ +#ifndef TCPIP_THREAD_PRIO +#define TCPIP_THREAD_PRIO 1 +#endif + +/** + * TCPIP_MBOX_SIZE: The mailbox size for the tcpip thread messages + * The queue size value itself is platform-dependent, but is passed to + * sys_mbox_new() when tcpip_init is called. + */ +#ifndef TCPIP_MBOX_SIZE +#define TCPIP_MBOX_SIZE 0 +#endif + +/** + * SLIPIF_THREAD_NAME: The name assigned to the slipif_loop thread. + */ +#ifndef SLIPIF_THREAD_NAME +#define SLIPIF_THREAD_NAME "slipif_loop" +#endif + +/** + * SLIP_THREAD_STACKSIZE: The stack size used by the slipif_loop thread. + * The stack size value itself is platform-dependent, but is passed to + * sys_thread_new() when the thread is created. + */ +#ifndef SLIPIF_THREAD_STACKSIZE +#define SLIPIF_THREAD_STACKSIZE 0 +#endif + +/** + * SLIPIF_THREAD_PRIO: The priority assigned to the slipif_loop thread. + * The priority value itself is platform-dependent, but is passed to + * sys_thread_new() when the thread is created. + */ +#ifndef SLIPIF_THREAD_PRIO +#define SLIPIF_THREAD_PRIO 1 +#endif + +/** + * PPP_THREAD_NAME: The name assigned to the pppInputThread. + */ +#ifndef PPP_THREAD_NAME +#define PPP_THREAD_NAME "pppInputThread" +#endif + +/** + * PPP_THREAD_STACKSIZE: The stack size used by the pppInputThread. + * The stack size value itself is platform-dependent, but is passed to + * sys_thread_new() when the thread is created. + */ +#ifndef PPP_THREAD_STACKSIZE +#define PPP_THREAD_STACKSIZE 0 +#endif + +/** + * PPP_THREAD_PRIO: The priority assigned to the pppInputThread. + * The priority value itself is platform-dependent, but is passed to + * sys_thread_new() when the thread is created. + */ +#ifndef PPP_THREAD_PRIO +#define PPP_THREAD_PRIO 1 +#endif + +/** + * DEFAULT_THREAD_NAME: The name assigned to any other lwIP thread. + */ +#ifndef DEFAULT_THREAD_NAME +#define DEFAULT_THREAD_NAME "lwIP" +#endif + +/** + * DEFAULT_THREAD_STACKSIZE: The stack size used by any other lwIP thread. + * The stack size value itself is platform-dependent, but is passed to + * sys_thread_new() when the thread is created. + */ +#ifndef DEFAULT_THREAD_STACKSIZE +#define DEFAULT_THREAD_STACKSIZE 0 +#endif + +/** + * DEFAULT_THREAD_PRIO: The priority assigned to any other lwIP thread. + * The priority value itself is platform-dependent, but is passed to + * sys_thread_new() when the thread is created. + */ +#ifndef DEFAULT_THREAD_PRIO +#define DEFAULT_THREAD_PRIO 1 +#endif + +/** + * DEFAULT_RAW_RECVMBOX_SIZE: The mailbox size for the incoming packets on a + * NETCONN_RAW. The queue size value itself is platform-dependent, but is passed + * to sys_mbox_new() when the recvmbox is created. + */ +#ifndef DEFAULT_RAW_RECVMBOX_SIZE +#define DEFAULT_RAW_RECVMBOX_SIZE 0 +#endif + +/** + * DEFAULT_UDP_RECVMBOX_SIZE: The mailbox size for the incoming packets on a + * NETCONN_UDP. The queue size value itself is platform-dependent, but is passed + * to sys_mbox_new() when the recvmbox is created. + */ +#ifndef DEFAULT_UDP_RECVMBOX_SIZE +#define DEFAULT_UDP_RECVMBOX_SIZE 0 +#endif + +/** + * DEFAULT_TCP_RECVMBOX_SIZE: The mailbox size for the incoming packets on a + * NETCONN_TCP. The queue size value itself is platform-dependent, but is passed + * to sys_mbox_new() when the recvmbox is created. + */ +#ifndef DEFAULT_TCP_RECVMBOX_SIZE +#define DEFAULT_TCP_RECVMBOX_SIZE 0 +#endif + +/** + * DEFAULT_ACCEPTMBOX_SIZE: The mailbox size for the incoming connections. + * The queue size value itself is platform-dependent, but is passed to + * sys_mbox_new() when the acceptmbox is created. + */ +#ifndef DEFAULT_ACCEPTMBOX_SIZE +#define DEFAULT_ACCEPTMBOX_SIZE 0 +#endif + +/* + ---------------------------------------------- + ---------- Sequential layer options ---------- + ---------------------------------------------- +*/ +/** + * LWIP_TCPIP_CORE_LOCKING: (EXPERIMENTAL!) + * Don't use it if you're not an active lwIP project member + */ +#ifndef LWIP_TCPIP_CORE_LOCKING +#define LWIP_TCPIP_CORE_LOCKING 0 +#endif + +/** + * LWIP_TCPIP_CORE_LOCKING_INPUT: (EXPERIMENTAL!) + * Don't use it if you're not an active lwIP project member + */ +#ifndef LWIP_TCPIP_CORE_LOCKING_INPUT +#define LWIP_TCPIP_CORE_LOCKING_INPUT 0 +#endif + +/** + * LWIP_NETCONN==1: Enable Netconn API (require to use api_lib.c) + */ +#ifndef LWIP_NETCONN +#define LWIP_NETCONN 1 +#endif + +/** LWIP_TCPIP_TIMEOUT==1: Enable tcpip_timeout/tcpip_untimeout tod create + * timers running in tcpip_thread from another thread. + */ +#ifndef LWIP_TCPIP_TIMEOUT +#define LWIP_TCPIP_TIMEOUT 1 +#endif + +/* + ------------------------------------ + ---------- Socket options ---------- + ------------------------------------ +*/ +/** + * LWIP_SOCKET==1: Enable Socket API (require to use sockets.c) + */ +#ifndef LWIP_SOCKET +#define LWIP_SOCKET 1 +#endif + +/** + * LWIP_COMPAT_SOCKETS==1: Enable BSD-style sockets functions names. + * (only used if you use sockets.c) + */ +#ifndef LWIP_COMPAT_SOCKETS +#define LWIP_COMPAT_SOCKETS 1 +#endif + +/** + * LWIP_POSIX_SOCKETS_IO_NAMES==1: Enable POSIX-style sockets functions names. + * Disable this option if you use a POSIX operating system that uses the same + * names (read, write & close). (only used if you use sockets.c) + */ +#ifndef LWIP_POSIX_SOCKETS_IO_NAMES +#define LWIP_POSIX_SOCKETS_IO_NAMES 1 +#endif + +/** + * LWIP_TCP_KEEPALIVE==1: Enable TCP_KEEPIDLE, TCP_KEEPINTVL and TCP_KEEPCNT + * options processing. Note that TCP_KEEPIDLE and TCP_KEEPINTVL have to be set + * in seconds. (does not require sockets.c, and will affect tcp.c) + */ +#ifndef LWIP_TCP_KEEPALIVE +#define LWIP_TCP_KEEPALIVE 0 +#endif + +/** + * LWIP_SO_RCVTIMEO==1: Enable SO_RCVTIMEO processing. + */ +#ifndef LWIP_SO_RCVTIMEO +#define LWIP_SO_RCVTIMEO 0 +#endif + +/** + * LWIP_SO_RCVBUF==1: Enable SO_RCVBUF processing. + */ +#ifndef LWIP_SO_RCVBUF +#define LWIP_SO_RCVBUF 0 +#endif + +/** + * If LWIP_SO_RCVBUF is used, this is the default value for recv_bufsize. + */ +#ifndef RECV_BUFSIZE_DEFAULT +#define RECV_BUFSIZE_DEFAULT INT_MAX +#endif + +/** + * SO_REUSE==1: Enable SO_REUSEADDR option. + */ +#ifndef SO_REUSE +#define SO_REUSE 0 +#endif + +/** + * SO_REUSE_RXTOALL==1: Pass a copy of incoming broadcast/multicast packets + * to all local matches if SO_REUSEADDR is turned on. + * WARNING: Adds a memcpy for every packet if passing to more than one pcb! + */ +#ifndef SO_REUSE_RXTOALL +#define SO_REUSE_RXTOALL 0 +#endif + +/* + ---------------------------------------- + ---------- Statistics options ---------- + ---------------------------------------- +*/ +/** + * LWIP_STATS==1: Enable statistics collection in lwip_stats. + */ +#ifndef LWIP_STATS +#define LWIP_STATS 1 +#endif + +#if LWIP_STATS + +/** + * LWIP_STATS_DISPLAY==1: Compile in the statistics output functions. + */ +#ifndef LWIP_STATS_DISPLAY +#define LWIP_STATS_DISPLAY 0 +#endif + +/** + * LINK_STATS==1: Enable link stats. + */ +#ifndef LINK_STATS +#define LINK_STATS 1 +#endif + +/** + * ETHARP_STATS==1: Enable etharp stats. + */ +#ifndef ETHARP_STATS +#define ETHARP_STATS (LWIP_ARP) +#endif + +/** + * IP_STATS==1: Enable IP stats. + */ +#ifndef IP_STATS +#define IP_STATS 1 +#endif + +/** + * IPFRAG_STATS==1: Enable IP fragmentation stats. Default is + * on if using either frag or reass. + */ +#ifndef IPFRAG_STATS +#define IPFRAG_STATS (IP_REASSEMBLY || IP_FRAG) +#endif + +/** + * ICMP_STATS==1: Enable ICMP stats. + */ +#ifndef ICMP_STATS +#define ICMP_STATS 1 +#endif + +/** + * IGMP_STATS==1: Enable IGMP stats. + */ +#ifndef IGMP_STATS +#define IGMP_STATS (LWIP_IGMP) +#endif + +/** + * UDP_STATS==1: Enable UDP stats. Default is on if + * UDP enabled, otherwise off. + */ +#ifndef UDP_STATS +#define UDP_STATS (LWIP_UDP) +#endif + +/** + * TCP_STATS==1: Enable TCP stats. Default is on if TCP + * enabled, otherwise off. + */ +#ifndef TCP_STATS +#define TCP_STATS (LWIP_TCP) +#endif + +/** + * MEM_STATS==1: Enable mem.c stats. + */ +#ifndef MEM_STATS +#define MEM_STATS ((MEM_LIBC_MALLOC == 0) && (MEM_USE_POOLS == 0)) +#endif + +/** + * MEMP_STATS==1: Enable memp.c pool stats. + */ +#ifndef MEMP_STATS +#define MEMP_STATS (MEMP_MEM_MALLOC == 0) +#endif + +/** + * SYS_STATS==1: Enable system stats (sem and mbox counts, etc). + */ +#ifndef SYS_STATS +#define SYS_STATS (NO_SYS == 0) +#endif + +#else + +#define LINK_STATS 0 +#define IP_STATS 0 +#define IPFRAG_STATS 0 +#define ICMP_STATS 0 +#define IGMP_STATS 0 +#define UDP_STATS 0 +#define TCP_STATS 0 +#define MEM_STATS 0 +#define MEMP_STATS 0 +#define SYS_STATS 0 +#define LWIP_STATS_DISPLAY 0 + +#endif /* LWIP_STATS */ + +/* + --------------------------------- + ---------- PPP options ---------- + --------------------------------- +*/ +/** + * PPP_SUPPORT==1: Enable PPP. + */ +#ifndef PPP_SUPPORT +#define PPP_SUPPORT 0 +#endif + +/** + * PPPOE_SUPPORT==1: Enable PPP Over Ethernet + */ +#ifndef PPPOE_SUPPORT +#define PPPOE_SUPPORT 0 +#endif + +/** + * PPPOS_SUPPORT==1: Enable PPP Over Serial + */ +#ifndef PPPOS_SUPPORT +#define PPPOS_SUPPORT PPP_SUPPORT +#endif + +#if PPP_SUPPORT + +/** + * NUM_PPP: Max PPP sessions. + */ +#ifndef NUM_PPP +#define NUM_PPP 1 +#endif + +/** + * PAP_SUPPORT==1: Support PAP. + */ +#ifndef PAP_SUPPORT +#define PAP_SUPPORT 0 +#endif + +/** + * CHAP_SUPPORT==1: Support CHAP. + */ +#ifndef CHAP_SUPPORT +#define CHAP_SUPPORT 0 +#endif + +/** + * MSCHAP_SUPPORT==1: Support MSCHAP. CURRENTLY NOT SUPPORTED! DO NOT SET! + */ +#ifndef MSCHAP_SUPPORT +#define MSCHAP_SUPPORT 0 +#endif + +/** + * CBCP_SUPPORT==1: Support CBCP. CURRENTLY NOT SUPPORTED! DO NOT SET! + */ +#ifndef CBCP_SUPPORT +#define CBCP_SUPPORT 0 +#endif + +/** + * CCP_SUPPORT==1: Support CCP. CURRENTLY NOT SUPPORTED! DO NOT SET! + */ +#ifndef CCP_SUPPORT +#define CCP_SUPPORT 0 +#endif + +/** + * VJ_SUPPORT==1: Support VJ header compression. + */ +#ifndef VJ_SUPPORT +#define VJ_SUPPORT 0 +#endif + +/** + * MD5_SUPPORT==1: Support MD5 (see also CHAP). + */ +#ifndef MD5_SUPPORT +#define MD5_SUPPORT 0 +#endif + +/* + * Timeouts + */ +#ifndef FSM_DEFTIMEOUT +#define FSM_DEFTIMEOUT 6 /* Timeout time in seconds */ +#endif + +#ifndef FSM_DEFMAXTERMREQS +#define FSM_DEFMAXTERMREQS 2 /* Maximum Terminate-Request transmissions */ +#endif + +#ifndef FSM_DEFMAXCONFREQS +#define FSM_DEFMAXCONFREQS 10 /* Maximum Configure-Request transmissions */ +#endif + +#ifndef FSM_DEFMAXNAKLOOPS +#define FSM_DEFMAXNAKLOOPS 5 /* Maximum number of nak loops */ +#endif + +#ifndef UPAP_DEFTIMEOUT +#define UPAP_DEFTIMEOUT 6 /* Timeout (seconds) for retransmitting req */ +#endif + +#ifndef UPAP_DEFREQTIME +#define UPAP_DEFREQTIME 30 /* Time to wait for auth-req from peer */ +#endif + +#ifndef CHAP_DEFTIMEOUT +#define CHAP_DEFTIMEOUT 6 /* Timeout time in seconds */ +#endif + +#ifndef CHAP_DEFTRANSMITS +#define CHAP_DEFTRANSMITS 10 /* max # times to send challenge */ +#endif + +/* Interval in seconds between keepalive echo requests, 0 to disable. */ +#ifndef LCP_ECHOINTERVAL +#define LCP_ECHOINTERVAL 0 +#endif + +/* Number of unanswered echo requests before failure. */ +#ifndef LCP_MAXECHOFAILS +#define LCP_MAXECHOFAILS 3 +#endif + +/* Max Xmit idle time (in jiffies) before resend flag char. */ +#ifndef PPP_MAXIDLEFLAG +#define PPP_MAXIDLEFLAG 100 +#endif + +/* + * Packet sizes + * + * Note - lcp shouldn't be allowed to negotiate stuff outside these + * limits. See lcp.h in the pppd directory. + * (XXX - these constants should simply be shared by lcp.c instead + * of living in lcp.h) + */ +#define PPP_MTU 1500 /* Default MTU (size of Info field) */ +#ifndef PPP_MAXMTU +/* #define PPP_MAXMTU 65535 - (PPP_HDRLEN + PPP_FCSLEN) */ +#define PPP_MAXMTU 1500 /* Largest MTU we allow */ +#endif +#define PPP_MINMTU 64 +#define PPP_MRU 1500 /* default MRU = max length of info field */ +#define PPP_MAXMRU 1500 /* Largest MRU we allow */ +#ifndef PPP_DEFMRU +#define PPP_DEFMRU 296 /* Try for this */ +#endif +#define PPP_MINMRU 128 /* No MRUs below this */ + +#ifndef MAXNAMELEN +#define MAXNAMELEN 256 /* max length of hostname or name for auth */ +#endif +#ifndef MAXSECRETLEN +#define MAXSECRETLEN 256 /* max length of password or secret */ +#endif + +#endif /* PPP_SUPPORT */ + +/* + -------------------------------------- + ---------- Checksum options ---------- + -------------------------------------- +*/ +/** + * CHECKSUM_GEN_IP==1: Generate checksums in software for outgoing IP packets. + */ +#ifndef CHECKSUM_GEN_IP +#define CHECKSUM_GEN_IP 1 +#endif + +/** + * CHECKSUM_GEN_UDP==1: Generate checksums in software for outgoing UDP packets. + */ +#ifndef CHECKSUM_GEN_UDP +#define CHECKSUM_GEN_UDP 1 +#endif + +/** + * CHECKSUM_GEN_TCP==1: Generate checksums in software for outgoing TCP packets. + */ +#ifndef CHECKSUM_GEN_TCP +#define CHECKSUM_GEN_TCP 1 +#endif + +/** + * CHECKSUM_CHECK_IP==1: Check checksums in software for incoming IP packets. + */ +#ifndef CHECKSUM_CHECK_IP +#define CHECKSUM_CHECK_IP 1 +#endif + +/** + * CHECKSUM_CHECK_UDP==1: Check checksums in software for incoming UDP packets. + */ +#ifndef CHECKSUM_CHECK_UDP +#define CHECKSUM_CHECK_UDP 1 +#endif + +/** + * CHECKSUM_CHECK_TCP==1: Check checksums in software for incoming TCP packets. + */ +#ifndef CHECKSUM_CHECK_TCP +#define CHECKSUM_CHECK_TCP 1 +#endif + +/** + * LWIP_CHECKSUM_ON_COPY==1: Calculate checksum when copying data from + * application buffers to pbufs. + */ +#ifndef LWIP_CHECKSUM_ON_COPY +#define LWIP_CHECKSUM_ON_COPY 0 +#endif + +/* + --------------------------------------- + ---------- Debugging options ---------- + --------------------------------------- +*/ +/** + * LWIP_DBG_MIN_LEVEL: After masking, the value of the debug is + * compared against this value. If it is smaller, then debugging + * messages are written. + */ +#ifndef LWIP_DBG_MIN_LEVEL +#define LWIP_DBG_MIN_LEVEL LWIP_DBG_LEVEL_ALL +#endif + +/** + * LWIP_DBG_TYPES_ON: A mask that can be used to globally enable/disable + * debug messages of certain types. + */ +#ifndef LWIP_DBG_TYPES_ON +#define LWIP_DBG_TYPES_ON LWIP_DBG_ON +#endif + +/** + * ETHARP_DEBUG: Enable debugging in etharp.c. + */ +#ifndef ETHARP_DEBUG +#define ETHARP_DEBUG LWIP_DBG_OFF +#endif + +/** + * NETIF_DEBUG: Enable debugging in netif.c. + */ +#ifndef NETIF_DEBUG +#define NETIF_DEBUG LWIP_DBG_OFF +#endif + +/** + * PBUF_DEBUG: Enable debugging in pbuf.c. + */ +#ifndef PBUF_DEBUG +#define PBUF_DEBUG LWIP_DBG_OFF +#endif + +/** + * API_LIB_DEBUG: Enable debugging in api_lib.c. + */ +#ifndef API_LIB_DEBUG +#define API_LIB_DEBUG LWIP_DBG_OFF +#endif + +/** + * API_MSG_DEBUG: Enable debugging in api_msg.c. + */ +#ifndef API_MSG_DEBUG +#define API_MSG_DEBUG LWIP_DBG_OFF +#endif + +/** + * SOCKETS_DEBUG: Enable debugging in sockets.c. + */ +#ifndef SOCKETS_DEBUG +#define SOCKETS_DEBUG LWIP_DBG_OFF +#endif + +/** + * ICMP_DEBUG: Enable debugging in icmp.c. + */ +#ifndef ICMP_DEBUG +#define ICMP_DEBUG LWIP_DBG_OFF +#endif + +/** + * IGMP_DEBUG: Enable debugging in igmp.c. + */ +#ifndef IGMP_DEBUG +#define IGMP_DEBUG LWIP_DBG_OFF +#endif + +/** + * INET_DEBUG: Enable debugging in inet.c. + */ +#ifndef INET_DEBUG +#define INET_DEBUG LWIP_DBG_OFF +#endif + +/** + * IP_DEBUG: Enable debugging for IP. + */ +#ifndef IP_DEBUG +#define IP_DEBUG LWIP_DBG_OFF +#endif + +/** + * IP_REASS_DEBUG: Enable debugging in ip_frag.c for both frag & reass. + */ +#ifndef IP_REASS_DEBUG +#define IP_REASS_DEBUG LWIP_DBG_OFF +#endif + +/** + * RAW_DEBUG: Enable debugging in raw.c. + */ +#ifndef RAW_DEBUG +#define RAW_DEBUG LWIP_DBG_OFF +#endif + +/** + * MEM_DEBUG: Enable debugging in mem.c. + */ +#ifndef MEM_DEBUG +#define MEM_DEBUG LWIP_DBG_OFF +#endif + +/** + * MEMP_DEBUG: Enable debugging in memp.c. + */ +#ifndef MEMP_DEBUG +#define MEMP_DEBUG LWIP_DBG_OFF +#endif + +/** + * SYS_DEBUG: Enable debugging in sys.c. + */ +#ifndef SYS_DEBUG +#define SYS_DEBUG LWIP_DBG_OFF +#endif + +/** + * TIMERS_DEBUG: Enable debugging in timers.c. + */ +#ifndef TIMERS_DEBUG +#define TIMERS_DEBUG LWIP_DBG_OFF +#endif + +/** + * TCP_DEBUG: Enable debugging for TCP. + */ +#ifndef TCP_DEBUG +#define TCP_DEBUG LWIP_DBG_OFF +#endif + +/** + * TCP_INPUT_DEBUG: Enable debugging in tcp_in.c for incoming debug. + */ +#ifndef TCP_INPUT_DEBUG +#define TCP_INPUT_DEBUG LWIP_DBG_OFF +#endif + +/** + * TCP_FR_DEBUG: Enable debugging in tcp_in.c for fast retransmit. + */ +#ifndef TCP_FR_DEBUG +#define TCP_FR_DEBUG LWIP_DBG_OFF +#endif + +/** + * TCP_RTO_DEBUG: Enable debugging in TCP for retransmit + * timeout. + */ +#ifndef TCP_RTO_DEBUG +#define TCP_RTO_DEBUG LWIP_DBG_OFF +#endif + +/** + * TCP_CWND_DEBUG: Enable debugging for TCP congestion window. + */ +#ifndef TCP_CWND_DEBUG +#define TCP_CWND_DEBUG LWIP_DBG_OFF +#endif + +/** + * TCP_WND_DEBUG: Enable debugging in tcp_in.c for window updating. + */ +#ifndef TCP_WND_DEBUG +#define TCP_WND_DEBUG LWIP_DBG_OFF +#endif + +/** + * TCP_OUTPUT_DEBUG: Enable debugging in tcp_out.c output functions. + */ +#ifndef TCP_OUTPUT_DEBUG +#define TCP_OUTPUT_DEBUG LWIP_DBG_OFF +#endif + +/** + * TCP_RST_DEBUG: Enable debugging for TCP with the RST message. + */ +#ifndef TCP_RST_DEBUG +#define TCP_RST_DEBUG LWIP_DBG_OFF +#endif + +/** + * TCP_QLEN_DEBUG: Enable debugging for TCP queue lengths. + */ +#ifndef TCP_QLEN_DEBUG +#define TCP_QLEN_DEBUG LWIP_DBG_OFF +#endif + +/** + * UDP_DEBUG: Enable debugging in UDP. + */ +#ifndef UDP_DEBUG +#define UDP_DEBUG LWIP_DBG_OFF +#endif + +/** + * TCPIP_DEBUG: Enable debugging in tcpip.c. + */ +#ifndef TCPIP_DEBUG +#define TCPIP_DEBUG LWIP_DBG_OFF +#endif + +/** + * PPP_DEBUG: Enable debugging for PPP. + */ +#ifndef PPP_DEBUG +#define PPP_DEBUG LWIP_DBG_OFF +#endif + +/** + * SLIP_DEBUG: Enable debugging in slipif.c. + */ +#ifndef SLIP_DEBUG +#define SLIP_DEBUG LWIP_DBG_OFF +#endif + +/** + * DHCP_DEBUG: Enable debugging in dhcp.c. + */ +#ifndef DHCP_DEBUG +#define DHCP_DEBUG LWIP_DBG_OFF +#endif + +/** + * AUTOIP_DEBUG: Enable debugging in autoip.c. + */ +#ifndef AUTOIP_DEBUG +#define AUTOIP_DEBUG LWIP_DBG_OFF +#endif + +/** + * SNMP_MSG_DEBUG: Enable debugging for SNMP messages. + */ +#ifndef SNMP_MSG_DEBUG +#define SNMP_MSG_DEBUG LWIP_DBG_OFF +#endif + +/** + * SNMP_MIB_DEBUG: Enable debugging for SNMP MIBs. + */ +#ifndef SNMP_MIB_DEBUG +#define SNMP_MIB_DEBUG LWIP_DBG_OFF +#endif + +/** + * DNS_DEBUG: Enable debugging for DNS. + */ +#ifndef DNS_DEBUG +#define DNS_DEBUG LWIP_DBG_OFF +#endif + +#endif /* __LWIP_OPT_H__ */ diff --git a/lib/drivers/lwip/src/include/lwip/pbuf.h b/lib/drivers/lwip/src/include/lwip/pbuf.h new file mode 100644 index 00000000000..3b1d608b9cb --- /dev/null +++ b/lib/drivers/lwip/src/include/lwip/pbuf.h @@ -0,0 +1,154 @@ +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ + +#ifndef __LWIP_PBUF_H__ +#define __LWIP_PBUF_H__ + +#include "lwip/opt.h" +#include "lwip/err.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** Currently, the pbuf_custom code is only needed for one specific configuration + * of IP_FRAG */ +#define LWIP_SUPPORT_CUSTOM_PBUF (IP_FRAG && !IP_FRAG_USES_STATIC_BUF && !LWIP_NETIF_TX_SINGLE_PBUF) + +#define PBUF_TRANSPORT_HLEN 20 +#define PBUF_IP_HLEN 20 + +typedef enum { + PBUF_TRANSPORT, + PBUF_IP, + PBUF_LINK, + PBUF_RAW +} pbuf_layer; + +typedef enum { + PBUF_RAM, /* pbuf data is stored in RAM */ + PBUF_ROM, /* pbuf data is stored in ROM */ + PBUF_REF, /* pbuf comes from the pbuf pool */ + PBUF_POOL /* pbuf payload refers to RAM */ +} pbuf_type; + + +/** indicates this packet's data should be immediately passed to the application */ +#define PBUF_FLAG_PUSH 0x01U +/** indicates this is a custom pbuf: pbuf_free and pbuf_header handle such a + a pbuf differently */ +#define PBUF_FLAG_IS_CUSTOM 0x02U +/** indicates this pbuf is UDP multicast to be looped back */ +#define PBUF_FLAG_MCASTLOOP 0x04U + +struct pbuf { + /** next pbuf in singly linked pbuf chain */ + struct pbuf *next; + + /** pointer to the actual data in the buffer */ + void *payload; + + /** + * total length of this buffer and all next buffers in chain + * belonging to the same packet. + * + * For non-queue packet chains this is the invariant: + * p->tot_len == p->len + (p->next? p->next->tot_len: 0) + */ + u16_t tot_len; + + /** length of this buffer */ + u16_t len; + + /** pbuf_type as u8_t instead of enum to save space */ + u8_t /*pbuf_type*/ type; + + /** misc flags */ + u8_t flags; + + /** + * the reference count always equals the number of pointers + * that refer to this pbuf. This can be pointers from an application, + * the stack itself, or pbuf->next pointers from a chain. + */ + u16_t ref; +}; + +#if LWIP_SUPPORT_CUSTOM_PBUF +/** Prototype for a function to free a custom pbuf */ +typedef void (*pbuf_free_custom_fn)(struct pbuf *p); + +/** A custom pbuf: like a pbuf, but following a function pointer to free it. */ +struct pbuf_custom { + /** The actual pbuf */ + struct pbuf pbuf; + /** This function is called when pbuf_free deallocates this pbuf(_custom) */ + pbuf_free_custom_fn custom_free_function; +}; +#endif /* LWIP_SUPPORT_CUSTOM_PBUF */ + +/* Initializes the pbuf module. This call is empty for now, but may not be in future. */ +#define pbuf_init() + +struct pbuf *pbuf_alloc(pbuf_layer l, u16_t length, pbuf_type type); +#if LWIP_SUPPORT_CUSTOM_PBUF +struct pbuf *pbuf_alloced_custom(pbuf_layer l, u16_t length, pbuf_type type, + struct pbuf_custom *p, void *payload_mem, + u16_t payload_mem_len); +#endif /* LWIP_SUPPORT_CUSTOM_PBUF */ +void pbuf_realloc(struct pbuf *p, u16_t size); +u8_t pbuf_header(struct pbuf *p, s16_t header_size); +void pbuf_ref(struct pbuf *p); +u8_t pbuf_free(struct pbuf *p); +u8_t pbuf_clen(struct pbuf *p); +void pbuf_cat(struct pbuf *head, struct pbuf *tail); +void pbuf_chain(struct pbuf *head, struct pbuf *tail); +struct pbuf *pbuf_dechain(struct pbuf *p); +err_t pbuf_copy(struct pbuf *p_to, struct pbuf *p_from); +u16_t pbuf_copy_partial(struct pbuf *p, void *dataptr, u16_t len, u16_t offset); +err_t pbuf_take(struct pbuf *buf, const void *dataptr, u16_t len); +struct pbuf *pbuf_coalesce(struct pbuf *p, pbuf_layer layer); +#if LWIP_CHECKSUM_ON_COPY +err_t pbuf_fill_chksum(struct pbuf *p, u16_t start_offset, const void *dataptr, + u16_t len, u16_t *chksum); +#endif /* LWIP_CHECKSUM_ON_COPY */ + +u8_t pbuf_get_at(struct pbuf* p, u16_t offset); +u16_t pbuf_memcmp(struct pbuf* p, u16_t offset, const void* s2, u16_t n); +u16_t pbuf_memfind(struct pbuf* p, const void* mem, u16_t mem_len, u16_t start_offset); +u16_t pbuf_strstr(struct pbuf* p, const char* substr); + +#ifdef __cplusplus +} +#endif + +#endif /* __LWIP_PBUF_H__ */ diff --git a/lib/drivers/lwip/src/include/lwip/raw.h b/lib/drivers/lwip/src/include/lwip/raw.h new file mode 100644 index 00000000000..17d0a1c5406 --- /dev/null +++ b/lib/drivers/lwip/src/include/lwip/raw.h @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ +#ifndef __LWIP_RAW_H__ +#define __LWIP_RAW_H__ + +#include "lwip/opt.h" + +#if LWIP_RAW /* don't build if not configured for use in lwipopts.h */ + +#include "lwip/pbuf.h" +#include "lwip/def.h" +#include "lwip/ip.h" +#include "lwip/ip_addr.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct raw_pcb; + +/** Function prototype for raw pcb receive callback functions. + * @param arg user supplied argument (raw_pcb.recv_arg) + * @param pcb the raw_pcb which received data + * @param p the packet buffer that was received + * @param addr the remote IP address from which the packet was received + * @return 1 if the packet was 'eaten' (aka. deleted), + * 0 if the packet lives on + * If returning 1, the callback is responsible for freeing the pbuf + * if it's not used any more. + */ +typedef u8_t (*raw_recv_fn)(void *arg, struct raw_pcb *pcb, struct pbuf *p, + ip_addr_t *addr); + +struct raw_pcb { + /* Common members of all PCB types */ + IP_PCB; + + struct raw_pcb *next; + + u8_t protocol; + + /** receive callback function */ + raw_recv_fn recv; + /* user-supplied argument for the recv callback */ + void *recv_arg; +}; + +/* The following functions is the application layer interface to the + RAW code. */ +struct raw_pcb * raw_new (u8_t proto); +void raw_remove (struct raw_pcb *pcb); +err_t raw_bind (struct raw_pcb *pcb, ip_addr_t *ipaddr); +err_t raw_connect (struct raw_pcb *pcb, ip_addr_t *ipaddr); + +void raw_recv (struct raw_pcb *pcb, raw_recv_fn recv, void *recv_arg); +err_t raw_sendto (struct raw_pcb *pcb, struct pbuf *p, ip_addr_t *ipaddr); +err_t raw_send (struct raw_pcb *pcb, struct pbuf *p); + +/* The following functions are the lower layer interface to RAW. */ +u8_t raw_input (struct pbuf *p, struct netif *inp); +#define raw_init() /* Compatibility define, not init needed. */ + +#ifdef __cplusplus +} +#endif + +#endif /* LWIP_RAW */ + +#endif /* __LWIP_RAW_H__ */ diff --git a/lib/drivers/lwip/src/include/lwip/sio.h b/lib/drivers/lwip/src/include/lwip/sio.h new file mode 100644 index 00000000000..28ae2f225d6 --- /dev/null +++ b/lib/drivers/lwip/src/include/lwip/sio.h @@ -0,0 +1,141 @@ +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + */ + +/* + * This is the interface to the platform specific serial IO module + * It needs to be implemented by those platforms which need SLIP or PPP + */ + +#ifndef __SIO_H__ +#define __SIO_H__ + +#include "lwip/arch.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* If you want to define sio_fd_t elsewhere or differently, + define this in your cc.h file. */ +#ifndef __sio_fd_t_defined +typedef void * sio_fd_t; +#endif + +/* The following functions can be defined to something else in your cc.h file + or be implemented in your custom sio.c file. */ + +#ifndef sio_open +/** + * Opens a serial device for communication. + * + * @param devnum device number + * @return handle to serial device if successful, NULL otherwise + */ +sio_fd_t sio_open(u8_t devnum); +#endif + +#ifndef sio_send +/** + * Sends a single character to the serial device. + * + * @param c character to send + * @param fd serial device handle + * + * @note This function will block until the character can be sent. + */ +void sio_send(u8_t c, sio_fd_t fd); +#endif + +#ifndef sio_recv +/** + * Receives a single character from the serial device. + * + * @param fd serial device handle + * + * @note This function will block until a character is received. + */ +u8_t sio_recv(sio_fd_t fd); +#endif + +#ifndef sio_read +/** + * Reads from the serial device. + * + * @param fd serial device handle + * @param data pointer to data buffer for receiving + * @param len maximum length (in bytes) of data to receive + * @return number of bytes actually received - may be 0 if aborted by sio_read_abort + * + * @note This function will block until data can be received. The blocking + * can be cancelled by calling sio_read_abort(). + */ +u32_t sio_read(sio_fd_t fd, u8_t *data, u32_t len); +#endif + +#ifndef sio_tryread +/** + * Tries to read from the serial device. Same as sio_read but returns + * immediately if no data is available and never blocks. + * + * @param fd serial device handle + * @param data pointer to data buffer for receiving + * @param len maximum length (in bytes) of data to receive + * @return number of bytes actually received + */ +u32_t sio_tryread(sio_fd_t fd, u8_t *data, u32_t len); +#endif + +#ifndef sio_write +/** + * Writes to the serial device. + * + * @param fd serial device handle + * @param data pointer to data to send + * @param len length (in bytes) of data to send + * @return number of bytes actually sent + * + * @note This function will block until all data can be sent. + */ +u32_t sio_write(sio_fd_t fd, u8_t *data, u32_t len); +#endif + +#ifndef sio_read_abort +/** + * Aborts a blocking sio_read() call. + * + * @param fd serial device handle + */ +void sio_read_abort(sio_fd_t fd); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __SIO_H__ */ diff --git a/lib/drivers/lwip/src/include/lwip/snmp.h b/lib/drivers/lwip/src/include/lwip/snmp.h new file mode 100644 index 00000000000..2ed043dd5f3 --- /dev/null +++ b/lib/drivers/lwip/src/include/lwip/snmp.h @@ -0,0 +1,367 @@ +/* + * Copyright (c) 2001, 2002 Leon Woestenberg + * Copyright (c) 2001, 2002 Axon Digital Design B.V., The Netherlands. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Leon Woestenberg + * + */ +#ifndef __LWIP_SNMP_H__ +#define __LWIP_SNMP_H__ + +#include "lwip/opt.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#include "lwip/ip_addr.h" + +struct udp_pcb; +struct netif; + +/** + * @see RFC1213, "MIB-II, 6. Definitions" + */ +enum snmp_ifType { + snmp_ifType_other=1, /* none of the following */ + snmp_ifType_regular1822, + snmp_ifType_hdh1822, + snmp_ifType_ddn_x25, + snmp_ifType_rfc877_x25, + snmp_ifType_ethernet_csmacd, + snmp_ifType_iso88023_csmacd, + snmp_ifType_iso88024_tokenBus, + snmp_ifType_iso88025_tokenRing, + snmp_ifType_iso88026_man, + snmp_ifType_starLan, + snmp_ifType_proteon_10Mbit, + snmp_ifType_proteon_80Mbit, + snmp_ifType_hyperchannel, + snmp_ifType_fddi, + snmp_ifType_lapb, + snmp_ifType_sdlc, + snmp_ifType_ds1, /* T-1 */ + snmp_ifType_e1, /* european equiv. of T-1 */ + snmp_ifType_basicISDN, + snmp_ifType_primaryISDN, /* proprietary serial */ + snmp_ifType_propPointToPointSerial, + snmp_ifType_ppp, + snmp_ifType_softwareLoopback, + snmp_ifType_eon, /* CLNP over IP [11] */ + snmp_ifType_ethernet_3Mbit, + snmp_ifType_nsip, /* XNS over IP */ + snmp_ifType_slip, /* generic SLIP */ + snmp_ifType_ultra, /* ULTRA technologies */ + snmp_ifType_ds3, /* T-3 */ + snmp_ifType_sip, /* SMDS */ + snmp_ifType_frame_relay +}; + +#if LWIP_SNMP /* don't build if not configured for use in lwipopts.h */ + +/** SNMP "sysuptime" Interval */ +#define SNMP_SYSUPTIME_INTERVAL 10 + +/** fixed maximum length for object identifier type */ +#define LWIP_SNMP_OBJ_ID_LEN 32 + +/** internal object identifier representation */ +struct snmp_obj_id +{ + u8_t len; + s32_t id[LWIP_SNMP_OBJ_ID_LEN]; +}; + +/* system */ +void snmp_set_sysdesr(u8_t* str, u8_t* len); +void snmp_set_sysobjid(struct snmp_obj_id *oid); +void snmp_get_sysobjid_ptr(struct snmp_obj_id **oid); +void snmp_inc_sysuptime(void); +void snmp_add_sysuptime(u32_t value); +void snmp_get_sysuptime(u32_t *value); +void snmp_set_syscontact(u8_t *ocstr, u8_t *ocstrlen); +void snmp_set_sysname(u8_t *ocstr, u8_t *ocstrlen); +void snmp_set_syslocation(u8_t *ocstr, u8_t *ocstrlen); + +/* network interface */ +void snmp_add_ifinoctets(struct netif *ni, u32_t value); +void snmp_inc_ifinucastpkts(struct netif *ni); +void snmp_inc_ifinnucastpkts(struct netif *ni); +void snmp_inc_ifindiscards(struct netif *ni); +void snmp_add_ifoutoctets(struct netif *ni, u32_t value); +void snmp_inc_ifoutucastpkts(struct netif *ni); +void snmp_inc_ifoutnucastpkts(struct netif *ni); +void snmp_inc_ifoutdiscards(struct netif *ni); +void snmp_inc_iflist(void); +void snmp_dec_iflist(void); + +/* ARP (for atTable and ipNetToMediaTable) */ +void snmp_insert_arpidx_tree(struct netif *ni, ip_addr_t *ip); +void snmp_delete_arpidx_tree(struct netif *ni, ip_addr_t *ip); + +/* IP */ +void snmp_inc_ipinreceives(void); +void snmp_inc_ipinhdrerrors(void); +void snmp_inc_ipinaddrerrors(void); +void snmp_inc_ipforwdatagrams(void); +void snmp_inc_ipinunknownprotos(void); +void snmp_inc_ipindiscards(void); +void snmp_inc_ipindelivers(void); +void snmp_inc_ipoutrequests(void); +void snmp_inc_ipoutdiscards(void); +void snmp_inc_ipoutnoroutes(void); +void snmp_inc_ipreasmreqds(void); +void snmp_inc_ipreasmoks(void); +void snmp_inc_ipreasmfails(void); +void snmp_inc_ipfragoks(void); +void snmp_inc_ipfragfails(void); +void snmp_inc_ipfragcreates(void); +void snmp_inc_iproutingdiscards(void); +void snmp_insert_ipaddridx_tree(struct netif *ni); +void snmp_delete_ipaddridx_tree(struct netif *ni); +void snmp_insert_iprteidx_tree(u8_t dflt, struct netif *ni); +void snmp_delete_iprteidx_tree(u8_t dflt, struct netif *ni); + +/* ICMP */ +void snmp_inc_icmpinmsgs(void); +void snmp_inc_icmpinerrors(void); +void snmp_inc_icmpindestunreachs(void); +void snmp_inc_icmpintimeexcds(void); +void snmp_inc_icmpinparmprobs(void); +void snmp_inc_icmpinsrcquenchs(void); +void snmp_inc_icmpinredirects(void); +void snmp_inc_icmpinechos(void); +void snmp_inc_icmpinechoreps(void); +void snmp_inc_icmpintimestamps(void); +void snmp_inc_icmpintimestampreps(void); +void snmp_inc_icmpinaddrmasks(void); +void snmp_inc_icmpinaddrmaskreps(void); +void snmp_inc_icmpoutmsgs(void); +void snmp_inc_icmpouterrors(void); +void snmp_inc_icmpoutdestunreachs(void); +void snmp_inc_icmpouttimeexcds(void); +void snmp_inc_icmpoutparmprobs(void); +void snmp_inc_icmpoutsrcquenchs(void); +void snmp_inc_icmpoutredirects(void); +void snmp_inc_icmpoutechos(void); +void snmp_inc_icmpoutechoreps(void); +void snmp_inc_icmpouttimestamps(void); +void snmp_inc_icmpouttimestampreps(void); +void snmp_inc_icmpoutaddrmasks(void); +void snmp_inc_icmpoutaddrmaskreps(void); + +/* TCP */ +void snmp_inc_tcpactiveopens(void); +void snmp_inc_tcppassiveopens(void); +void snmp_inc_tcpattemptfails(void); +void snmp_inc_tcpestabresets(void); +void snmp_inc_tcpinsegs(void); +void snmp_inc_tcpoutsegs(void); +void snmp_inc_tcpretranssegs(void); +void snmp_inc_tcpinerrs(void); +void snmp_inc_tcpoutrsts(void); + +/* UDP */ +void snmp_inc_udpindatagrams(void); +void snmp_inc_udpnoports(void); +void snmp_inc_udpinerrors(void); +void snmp_inc_udpoutdatagrams(void); +void snmp_insert_udpidx_tree(struct udp_pcb *pcb); +void snmp_delete_udpidx_tree(struct udp_pcb *pcb); + +/* SNMP */ +void snmp_inc_snmpinpkts(void); +void snmp_inc_snmpoutpkts(void); +void snmp_inc_snmpinbadversions(void); +void snmp_inc_snmpinbadcommunitynames(void); +void snmp_inc_snmpinbadcommunityuses(void); +void snmp_inc_snmpinasnparseerrs(void); +void snmp_inc_snmpintoobigs(void); +void snmp_inc_snmpinnosuchnames(void); +void snmp_inc_snmpinbadvalues(void); +void snmp_inc_snmpinreadonlys(void); +void snmp_inc_snmpingenerrs(void); +void snmp_add_snmpintotalreqvars(u8_t value); +void snmp_add_snmpintotalsetvars(u8_t value); +void snmp_inc_snmpingetrequests(void); +void snmp_inc_snmpingetnexts(void); +void snmp_inc_snmpinsetrequests(void); +void snmp_inc_snmpingetresponses(void); +void snmp_inc_snmpintraps(void); +void snmp_inc_snmpouttoobigs(void); +void snmp_inc_snmpoutnosuchnames(void); +void snmp_inc_snmpoutbadvalues(void); +void snmp_inc_snmpoutgenerrs(void); +void snmp_inc_snmpoutgetrequests(void); +void snmp_inc_snmpoutgetnexts(void); +void snmp_inc_snmpoutsetrequests(void); +void snmp_inc_snmpoutgetresponses(void); +void snmp_inc_snmpouttraps(void); +void snmp_get_snmpgrpid_ptr(struct snmp_obj_id **oid); +void snmp_set_snmpenableauthentraps(u8_t *value); +void snmp_get_snmpenableauthentraps(u8_t *value); + +/* LWIP_SNMP support not available */ +/* define everything to be empty */ +#else + +/* system */ +#define snmp_set_sysdesr(str, len) +#define snmp_set_sysobjid(oid); +#define snmp_get_sysobjid_ptr(oid) +#define snmp_inc_sysuptime() +#define snmp_add_sysuptime(value) +#define snmp_get_sysuptime(value) +#define snmp_set_syscontact(ocstr, ocstrlen); +#define snmp_set_sysname(ocstr, ocstrlen); +#define snmp_set_syslocation(ocstr, ocstrlen); + +/* network interface */ +#define snmp_add_ifinoctets(ni,value) +#define snmp_inc_ifinucastpkts(ni) +#define snmp_inc_ifinnucastpkts(ni) +#define snmp_inc_ifindiscards(ni) +#define snmp_add_ifoutoctets(ni,value) +#define snmp_inc_ifoutucastpkts(ni) +#define snmp_inc_ifoutnucastpkts(ni) +#define snmp_inc_ifoutdiscards(ni) +#define snmp_inc_iflist() +#define snmp_dec_iflist() + +/* ARP */ +#define snmp_insert_arpidx_tree(ni,ip) +#define snmp_delete_arpidx_tree(ni,ip) + +/* IP */ +#define snmp_inc_ipinreceives() +#define snmp_inc_ipinhdrerrors() +#define snmp_inc_ipinaddrerrors() +#define snmp_inc_ipforwdatagrams() +#define snmp_inc_ipinunknownprotos() +#define snmp_inc_ipindiscards() +#define snmp_inc_ipindelivers() +#define snmp_inc_ipoutrequests() +#define snmp_inc_ipoutdiscards() +#define snmp_inc_ipoutnoroutes() +#define snmp_inc_ipreasmreqds() +#define snmp_inc_ipreasmoks() +#define snmp_inc_ipreasmfails() +#define snmp_inc_ipfragoks() +#define snmp_inc_ipfragfails() +#define snmp_inc_ipfragcreates() +#define snmp_inc_iproutingdiscards() +#define snmp_insert_ipaddridx_tree(ni) +#define snmp_delete_ipaddridx_tree(ni) +#define snmp_insert_iprteidx_tree(dflt, ni) +#define snmp_delete_iprteidx_tree(dflt, ni) + +/* ICMP */ +#define snmp_inc_icmpinmsgs() +#define snmp_inc_icmpinerrors() +#define snmp_inc_icmpindestunreachs() +#define snmp_inc_icmpintimeexcds() +#define snmp_inc_icmpinparmprobs() +#define snmp_inc_icmpinsrcquenchs() +#define snmp_inc_icmpinredirects() +#define snmp_inc_icmpinechos() +#define snmp_inc_icmpinechoreps() +#define snmp_inc_icmpintimestamps() +#define snmp_inc_icmpintimestampreps() +#define snmp_inc_icmpinaddrmasks() +#define snmp_inc_icmpinaddrmaskreps() +#define snmp_inc_icmpoutmsgs() +#define snmp_inc_icmpouterrors() +#define snmp_inc_icmpoutdestunreachs() +#define snmp_inc_icmpouttimeexcds() +#define snmp_inc_icmpoutparmprobs() +#define snmp_inc_icmpoutsrcquenchs() +#define snmp_inc_icmpoutredirects() +#define snmp_inc_icmpoutechos() +#define snmp_inc_icmpoutechoreps() +#define snmp_inc_icmpouttimestamps() +#define snmp_inc_icmpouttimestampreps() +#define snmp_inc_icmpoutaddrmasks() +#define snmp_inc_icmpoutaddrmaskreps() +/* TCP */ +#define snmp_inc_tcpactiveopens() +#define snmp_inc_tcppassiveopens() +#define snmp_inc_tcpattemptfails() +#define snmp_inc_tcpestabresets() +#define snmp_inc_tcpinsegs() +#define snmp_inc_tcpoutsegs() +#define snmp_inc_tcpretranssegs() +#define snmp_inc_tcpinerrs() +#define snmp_inc_tcpoutrsts() + +/* UDP */ +#define snmp_inc_udpindatagrams() +#define snmp_inc_udpnoports() +#define snmp_inc_udpinerrors() +#define snmp_inc_udpoutdatagrams() +#define snmp_insert_udpidx_tree(pcb) +#define snmp_delete_udpidx_tree(pcb) + +/* SNMP */ +#define snmp_inc_snmpinpkts() +#define snmp_inc_snmpoutpkts() +#define snmp_inc_snmpinbadversions() +#define snmp_inc_snmpinbadcommunitynames() +#define snmp_inc_snmpinbadcommunityuses() +#define snmp_inc_snmpinasnparseerrs() +#define snmp_inc_snmpintoobigs() +#define snmp_inc_snmpinnosuchnames() +#define snmp_inc_snmpinbadvalues() +#define snmp_inc_snmpinreadonlys() +#define snmp_inc_snmpingenerrs() +#define snmp_add_snmpintotalreqvars(value) +#define snmp_add_snmpintotalsetvars(value) +#define snmp_inc_snmpingetrequests() +#define snmp_inc_snmpingetnexts() +#define snmp_inc_snmpinsetrequests() +#define snmp_inc_snmpingetresponses() +#define snmp_inc_snmpintraps() +#define snmp_inc_snmpouttoobigs() +#define snmp_inc_snmpoutnosuchnames() +#define snmp_inc_snmpoutbadvalues() +#define snmp_inc_snmpoutgenerrs() +#define snmp_inc_snmpoutgetrequests() +#define snmp_inc_snmpoutgetnexts() +#define snmp_inc_snmpoutsetrequests() +#define snmp_inc_snmpoutgetresponses() +#define snmp_inc_snmpouttraps() +#define snmp_get_snmpgrpid_ptr(oid) +#define snmp_set_snmpenableauthentraps(value) +#define snmp_get_snmpenableauthentraps(value) + +#endif /* LWIP_SNMP */ + +#ifdef __cplusplus +} +#endif + +#endif /* __LWIP_SNMP_H__ */ diff --git a/lib/drivers/lwip/src/include/lwip/snmp_asn1.h b/lib/drivers/lwip/src/include/lwip/snmp_asn1.h new file mode 100644 index 00000000000..605fa3f16c9 --- /dev/null +++ b/lib/drivers/lwip/src/include/lwip/snmp_asn1.h @@ -0,0 +1,101 @@ +/** + * @file + * Abstract Syntax Notation One (ISO 8824, 8825) codec. + */ + +/* + * Copyright (c) 2006 Axon Digital Design B.V., The Netherlands. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * Author: Christiaan Simons + */ + +#ifndef __LWIP_SNMP_ASN1_H__ +#define __LWIP_SNMP_ASN1_H__ + +#include "lwip/opt.h" +#include "lwip/err.h" +#include "lwip/pbuf.h" +#include "lwip/snmp.h" + +#if LWIP_SNMP + +#ifdef __cplusplus +extern "C" { +#endif + +#define SNMP_ASN1_UNIV (0) /* (!0x80 | !0x40) */ +#define SNMP_ASN1_APPLIC (0x40) /* (!0x80 | 0x40) */ +#define SNMP_ASN1_CONTXT (0x80) /* ( 0x80 | !0x40) */ + +#define SNMP_ASN1_CONSTR (0x20) /* ( 0x20) */ +#define SNMP_ASN1_PRIMIT (0) /* (!0x20) */ + +/* universal tags */ +#define SNMP_ASN1_INTEG 2 +#define SNMP_ASN1_OC_STR 4 +#define SNMP_ASN1_NUL 5 +#define SNMP_ASN1_OBJ_ID 6 +#define SNMP_ASN1_SEQ 16 + +/* application specific (SNMP) tags */ +#define SNMP_ASN1_IPADDR 0 /* octet string size(4) */ +#define SNMP_ASN1_COUNTER 1 /* u32_t */ +#define SNMP_ASN1_GAUGE 2 /* u32_t */ +#define SNMP_ASN1_TIMETICKS 3 /* u32_t */ +#define SNMP_ASN1_OPAQUE 4 /* octet string */ + +/* context specific (SNMP) tags */ +#define SNMP_ASN1_PDU_GET_REQ 0 +#define SNMP_ASN1_PDU_GET_NEXT_REQ 1 +#define SNMP_ASN1_PDU_GET_RESP 2 +#define SNMP_ASN1_PDU_SET_REQ 3 +#define SNMP_ASN1_PDU_TRAP 4 + +err_t snmp_asn1_dec_type(struct pbuf *p, u16_t ofs, u8_t *type); +err_t snmp_asn1_dec_length(struct pbuf *p, u16_t ofs, u8_t *octets_used, u16_t *length); +err_t snmp_asn1_dec_u32t(struct pbuf *p, u16_t ofs, u16_t len, u32_t *value); +err_t snmp_asn1_dec_s32t(struct pbuf *p, u16_t ofs, u16_t len, s32_t *value); +err_t snmp_asn1_dec_oid(struct pbuf *p, u16_t ofs, u16_t len, struct snmp_obj_id *oid); +err_t snmp_asn1_dec_raw(struct pbuf *p, u16_t ofs, u16_t len, u16_t raw_len, u8_t *raw); + +void snmp_asn1_enc_length_cnt(u16_t length, u8_t *octets_needed); +void snmp_asn1_enc_u32t_cnt(u32_t value, u16_t *octets_needed); +void snmp_asn1_enc_s32t_cnt(s32_t value, u16_t *octets_needed); +void snmp_asn1_enc_oid_cnt(u8_t ident_len, s32_t *ident, u16_t *octets_needed); +err_t snmp_asn1_enc_type(struct pbuf *p, u16_t ofs, u8_t type); +err_t snmp_asn1_enc_length(struct pbuf *p, u16_t ofs, u16_t length); +err_t snmp_asn1_enc_u32t(struct pbuf *p, u16_t ofs, u16_t octets_needed, u32_t value); +err_t snmp_asn1_enc_s32t(struct pbuf *p, u16_t ofs, u16_t octets_needed, s32_t value); +err_t snmp_asn1_enc_oid(struct pbuf *p, u16_t ofs, u8_t ident_len, s32_t *ident); +err_t snmp_asn1_enc_raw(struct pbuf *p, u16_t ofs, u16_t raw_len, u8_t *raw); + +#ifdef __cplusplus +} +#endif + +#endif /* LWIP_SNMP */ + +#endif /* __LWIP_SNMP_ASN1_H__ */ diff --git a/lib/drivers/lwip/src/include/lwip/snmp_msg.h b/lib/drivers/lwip/src/include/lwip/snmp_msg.h new file mode 100644 index 00000000000..1183e3a95b7 --- /dev/null +++ b/lib/drivers/lwip/src/include/lwip/snmp_msg.h @@ -0,0 +1,315 @@ +/** + * @file + * SNMP Agent message handling structures. + */ + +/* + * Copyright (c) 2006 Axon Digital Design B.V., The Netherlands. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * Author: Christiaan Simons + */ + +#ifndef __LWIP_SNMP_MSG_H__ +#define __LWIP_SNMP_MSG_H__ + +#include "lwip/opt.h" +#include "lwip/snmp.h" +#include "lwip/snmp_structs.h" +#include "lwip/ip_addr.h" +#include "lwip/err.h" + +#if LWIP_SNMP + +#if SNMP_PRIVATE_MIB +/* When using a private MIB, you have to create a file 'private_mib.h' that contains + * a 'struct mib_array_node mib_private' which contains your MIB. */ +#include "private_mib.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* The listen port of the SNMP agent. Clients have to make their requests to + this port. Most standard clients won't work if you change this! */ +#ifndef SNMP_IN_PORT +#define SNMP_IN_PORT 161 +#endif +/* The remote port the SNMP agent sends traps to. Most standard trap sinks won't + work if you change this! */ +#ifndef SNMP_TRAP_PORT +#define SNMP_TRAP_PORT 162 +#endif + +#define SNMP_ES_NOERROR 0 +#define SNMP_ES_TOOBIG 1 +#define SNMP_ES_NOSUCHNAME 2 +#define SNMP_ES_BADVALUE 3 +#define SNMP_ES_READONLY 4 +#define SNMP_ES_GENERROR 5 + +#define SNMP_GENTRAP_COLDSTART 0 +#define SNMP_GENTRAP_WARMSTART 1 +#define SNMP_GENTRAP_AUTHFAIL 4 +#define SNMP_GENTRAP_ENTERPRISESPC 6 + +struct snmp_varbind +{ + /* next pointer, NULL for last in list */ + struct snmp_varbind *next; + /* previous pointer, NULL for first in list */ + struct snmp_varbind *prev; + + /* object identifier length (in s32_t) */ + u8_t ident_len; + /* object identifier array */ + s32_t *ident; + + /* object value ASN1 type */ + u8_t value_type; + /* object value length (in u8_t) */ + u8_t value_len; + /* object value */ + void *value; + + /* encoding varbind seq length length */ + u8_t seqlenlen; + /* encoding object identifier length length */ + u8_t olenlen; + /* encoding object value length length */ + u8_t vlenlen; + /* encoding varbind seq length */ + u16_t seqlen; + /* encoding object identifier length */ + u16_t olen; + /* encoding object value length */ + u16_t vlen; +}; + +struct snmp_varbind_root +{ + struct snmp_varbind *head; + struct snmp_varbind *tail; + /* number of variable bindings in list */ + u8_t count; + /* encoding varbind-list seq length length */ + u8_t seqlenlen; + /* encoding varbind-list seq length */ + u16_t seqlen; +}; + +/** output response message header length fields */ +struct snmp_resp_header_lengths +{ + /* encoding error-index length length */ + u8_t erridxlenlen; + /* encoding error-status length length */ + u8_t errstatlenlen; + /* encoding request id length length */ + u8_t ridlenlen; + /* encoding pdu length length */ + u8_t pdulenlen; + /* encoding community length length */ + u8_t comlenlen; + /* encoding version length length */ + u8_t verlenlen; + /* encoding sequence length length */ + u8_t seqlenlen; + + /* encoding error-index length */ + u16_t erridxlen; + /* encoding error-status length */ + u16_t errstatlen; + /* encoding request id length */ + u16_t ridlen; + /* encoding pdu length */ + u16_t pdulen; + /* encoding community length */ + u16_t comlen; + /* encoding version length */ + u16_t verlen; + /* encoding sequence length */ + u16_t seqlen; +}; + +/** output response message header length fields */ +struct snmp_trap_header_lengths +{ + /* encoding timestamp length length */ + u8_t tslenlen; + /* encoding specific-trap length length */ + u8_t strplenlen; + /* encoding generic-trap length length */ + u8_t gtrplenlen; + /* encoding agent-addr length length */ + u8_t aaddrlenlen; + /* encoding enterprise-id length length */ + u8_t eidlenlen; + /* encoding pdu length length */ + u8_t pdulenlen; + /* encoding community length length */ + u8_t comlenlen; + /* encoding version length length */ + u8_t verlenlen; + /* encoding sequence length length */ + u8_t seqlenlen; + + /* encoding timestamp length */ + u16_t tslen; + /* encoding specific-trap length */ + u16_t strplen; + /* encoding generic-trap length */ + u16_t gtrplen; + /* encoding agent-addr length */ + u16_t aaddrlen; + /* encoding enterprise-id length */ + u16_t eidlen; + /* encoding pdu length */ + u16_t pdulen; + /* encoding community length */ + u16_t comlen; + /* encoding version length */ + u16_t verlen; + /* encoding sequence length */ + u16_t seqlen; +}; + +/* Accepting new SNMP messages. */ +#define SNMP_MSG_EMPTY 0 +/* Search for matching object for variable binding. */ +#define SNMP_MSG_SEARCH_OBJ 1 +/* Perform SNMP operation on in-memory object. + Pass-through states, for symmetry only. */ +#define SNMP_MSG_INTERNAL_GET_OBJDEF 2 +#define SNMP_MSG_INTERNAL_GET_VALUE 3 +#define SNMP_MSG_INTERNAL_SET_TEST 4 +#define SNMP_MSG_INTERNAL_GET_OBJDEF_S 5 +#define SNMP_MSG_INTERNAL_SET_VALUE 6 +/* Perform SNMP operation on object located externally. + In theory this could be used for building a proxy agent. + Practical use is for an enterprise spc. app. gateway. */ +#define SNMP_MSG_EXTERNAL_GET_OBJDEF 7 +#define SNMP_MSG_EXTERNAL_GET_VALUE 8 +#define SNMP_MSG_EXTERNAL_SET_TEST 9 +#define SNMP_MSG_EXTERNAL_GET_OBJDEF_S 10 +#define SNMP_MSG_EXTERNAL_SET_VALUE 11 + +#define SNMP_COMMUNITY_STR_LEN 64 +struct snmp_msg_pstat +{ + /* lwIP local port (161) binding */ + struct udp_pcb *pcb; + /* source IP address */ + ip_addr_t sip; + /* source UDP port */ + u16_t sp; + /* request type */ + u8_t rt; + /* request ID */ + s32_t rid; + /* error status */ + s32_t error_status; + /* error index */ + s32_t error_index; + /* community name (zero terminated) */ + u8_t community[SNMP_COMMUNITY_STR_LEN + 1]; + /* community string length (exclusive zero term) */ + u8_t com_strlen; + /* one out of MSG_EMPTY, MSG_DEMUX, MSG_INTERNAL, MSG_EXTERNAL_x */ + u8_t state; + /* saved arguments for MSG_EXTERNAL_x */ + struct mib_external_node *ext_mib_node; + struct snmp_name_ptr ext_name_ptr; + struct obj_def ext_object_def; + struct snmp_obj_id ext_oid; + /* index into input variable binding list */ + u8_t vb_idx; + /* ptr into input variable binding list */ + struct snmp_varbind *vb_ptr; + /* list of variable bindings from input */ + struct snmp_varbind_root invb; + /* list of variable bindings to output */ + struct snmp_varbind_root outvb; + /* output response lengths used in ASN encoding */ + struct snmp_resp_header_lengths rhl; +}; + +struct snmp_msg_trap +{ + /* lwIP local port (161) binding */ + struct udp_pcb *pcb; + /* destination IP address in network order */ + ip_addr_t dip; + + /* source enterprise ID (sysObjectID) */ + struct snmp_obj_id *enterprise; + /* source IP address, raw network order format */ + u8_t sip_raw[4]; + /* generic trap code */ + u32_t gen_trap; + /* specific trap code */ + u32_t spc_trap; + /* timestamp */ + u32_t ts; + /* list of variable bindings to output */ + struct snmp_varbind_root outvb; + /* output trap lengths used in ASN encoding */ + struct snmp_trap_header_lengths thl; +}; + +/** Agent Version constant, 0 = v1 oddity */ +extern const s32_t snmp_version; +/** Agent default "public" community string */ +extern const char snmp_publiccommunity[7]; + +extern struct snmp_msg_trap trap_msg; + +/** Agent setup, start listening to port 161. */ +void snmp_init(void); +void snmp_trap_dst_enable(u8_t dst_idx, u8_t enable); +void snmp_trap_dst_ip_set(u8_t dst_idx, ip_addr_t *dst); + +/** Varbind-list functions. */ +struct snmp_varbind* snmp_varbind_alloc(struct snmp_obj_id *oid, u8_t type, u8_t len); +void snmp_varbind_free(struct snmp_varbind *vb); +void snmp_varbind_list_free(struct snmp_varbind_root *root); +void snmp_varbind_tail_add(struct snmp_varbind_root *root, struct snmp_varbind *vb); +struct snmp_varbind* snmp_varbind_tail_remove(struct snmp_varbind_root *root); + +/** Handle an internal (recv) or external (private response) event. */ +void snmp_msg_event(u8_t request_id); +err_t snmp_send_response(struct snmp_msg_pstat *m_stat); +err_t snmp_send_trap(s8_t generic_trap, struct snmp_obj_id *eoid, s32_t specific_trap); +void snmp_coldstart_trap(void); +void snmp_authfail_trap(void); + +#ifdef __cplusplus +} +#endif + +#endif /* LWIP_SNMP */ + +#endif /* __LWIP_SNMP_MSG_H__ */ diff --git a/lib/drivers/lwip/src/include/lwip/snmp_structs.h b/lib/drivers/lwip/src/include/lwip/snmp_structs.h new file mode 100644 index 00000000000..0d3b46a928d --- /dev/null +++ b/lib/drivers/lwip/src/include/lwip/snmp_structs.h @@ -0,0 +1,268 @@ +/** + * @file + * Generic MIB tree structures. + * + * @todo namespace prefixes + */ + +/* + * Copyright (c) 2006 Axon Digital Design B.V., The Netherlands. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * Author: Christiaan Simons + */ + +#ifndef __LWIP_SNMP_STRUCTS_H__ +#define __LWIP_SNMP_STRUCTS_H__ + +#include "lwip/opt.h" + +#if LWIP_SNMP /* don't build if not configured for use in lwipopts.h */ + +#include "lwip/snmp.h" + +#if SNMP_PRIVATE_MIB +/* When using a private MIB, you have to create a file 'private_mib.h' that contains + * a 'struct mib_array_node mib_private' which contains your MIB. */ +#include "private_mib.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* MIB object instance */ +#define MIB_OBJECT_NONE 0 +#define MIB_OBJECT_SCALAR 1 +#define MIB_OBJECT_TAB 2 + +/* MIB access types */ +#define MIB_ACCESS_READ 1 +#define MIB_ACCESS_WRITE 2 + +/* MIB object access */ +#define MIB_OBJECT_READ_ONLY MIB_ACCESS_READ +#define MIB_OBJECT_READ_WRITE (MIB_ACCESS_READ | MIB_ACCESS_WRITE) +#define MIB_OBJECT_WRITE_ONLY MIB_ACCESS_WRITE +#define MIB_OBJECT_NOT_ACCESSIBLE 0 + +/** object definition returned by (get_object_def)() */ +struct obj_def +{ + /* MIB_OBJECT_NONE (0), MIB_OBJECT_SCALAR (1), MIB_OBJECT_TAB (2) */ + u8_t instance; + /* 0 read-only, 1 read-write, 2 write-only, 3 not-accessible */ + u8_t access; + /* ASN type for this object */ + u8_t asn_type; + /* value length (host length) */ + u16_t v_len; + /* length of instance part of supplied object identifier */ + u8_t id_inst_len; + /* instance part of supplied object identifier */ + s32_t *id_inst_ptr; +}; + +struct snmp_name_ptr +{ + u8_t ident_len; + s32_t *ident; +}; + +/** MIB const scalar (.0) node */ +#define MIB_NODE_SC 0x01 +/** MIB const array node */ +#define MIB_NODE_AR 0x02 +/** MIB array node (mem_malloced from RAM) */ +#define MIB_NODE_RA 0x03 +/** MIB list root node (mem_malloced from RAM) */ +#define MIB_NODE_LR 0x04 +/** MIB node for external objects */ +#define MIB_NODE_EX 0x05 + +/** node "base class" layout, the mandatory fields for a node */ +struct mib_node +{ + /** returns struct obj_def for the given object identifier */ + void (*get_object_def)(u8_t ident_len, s32_t *ident, struct obj_def *od); + /** returns object value for the given object identifier, + @note the caller must allocate at least len bytes for the value */ + void (*get_value)(struct obj_def *od, u16_t len, void *value); + /** tests length and/or range BEFORE setting */ + u8_t (*set_test)(struct obj_def *od, u16_t len, void *value); + /** sets object value, only to be called when set_test() */ + void (*set_value)(struct obj_def *od, u16_t len, void *value); + /** One out of MIB_NODE_AR, MIB_NODE_LR or MIB_NODE_EX */ + u8_t node_type; + /* array or max list length */ + u16_t maxlength; +}; + +/** derived node for scalars .0 index */ +typedef struct mib_node mib_scalar_node; + +/** derived node, points to a fixed size const array + of sub-identifiers plus a 'child' pointer */ +struct mib_array_node +{ + /* inherited "base class" members */ + void (*get_object_def)(u8_t ident_len, s32_t *ident, struct obj_def *od); + void (*get_value)(struct obj_def *od, u16_t len, void *value); + u8_t (*set_test)(struct obj_def *od, u16_t len, void *value); + void (*set_value)(struct obj_def *od, u16_t len, void *value); + + u8_t node_type; + u16_t maxlength; + + /* additional struct members */ + const s32_t *objid; + struct mib_node* const *nptr; +}; + +/** derived node, points to a fixed size mem_malloced array + of sub-identifiers plus a 'child' pointer */ +struct mib_ram_array_node +{ + /* inherited "base class" members */ + void (*get_object_def)(u8_t ident_len, s32_t *ident, struct obj_def *od); + void (*get_value)(struct obj_def *od, u16_t len, void *value); + u8_t (*set_test)(struct obj_def *od, u16_t len, void *value); + void (*set_value)(struct obj_def *od, u16_t len, void *value); + + u8_t node_type; + u16_t maxlength; + + /* aditional struct members */ + s32_t *objid; + struct mib_node **nptr; +}; + +struct mib_list_node +{ + struct mib_list_node *prev; + struct mib_list_node *next; + s32_t objid; + struct mib_node *nptr; +}; + +/** derived node, points to a doubly linked list + of sub-identifiers plus a 'child' pointer */ +struct mib_list_rootnode +{ + /* inherited "base class" members */ + void (*get_object_def)(u8_t ident_len, s32_t *ident, struct obj_def *od); + void (*get_value)(struct obj_def *od, u16_t len, void *value); + u8_t (*set_test)(struct obj_def *od, u16_t len, void *value); + void (*set_value)(struct obj_def *od, u16_t len, void *value); + + u8_t node_type; + u16_t maxlength; + + /* additional struct members */ + struct mib_list_node *head; + struct mib_list_node *tail; + /* counts list nodes in list */ + u16_t count; +}; + +/** derived node, has access functions for mib object in external memory or device + using 'tree_level' and 'idx', with a range 0 .. (level_length() - 1) */ +struct mib_external_node +{ + /* inherited "base class" members */ + void (*get_object_def)(u8_t ident_len, s32_t *ident, struct obj_def *od); + void (*get_value)(struct obj_def *od, u16_t len, void *value); + u8_t (*set_test)(struct obj_def *od, u16_t len, void *value); + void (*set_value)(struct obj_def *od, u16_t len, void *value); + + u8_t node_type; + u16_t maxlength; + + /* additional struct members */ + /** points to an external (in memory) record of some sort of addressing + information, passed to and interpreted by the funtions below */ + void* addr_inf; + /** tree levels under this node */ + u8_t tree_levels; + /** number of objects at this level */ + u16_t (*level_length)(void* addr_inf, u8_t level); + /** compares object sub identifier with external id + return zero when equal, nonzero when unequal */ + s32_t (*ident_cmp)(void* addr_inf, u8_t level, u16_t idx, s32_t sub_id); + void (*get_objid)(void* addr_inf, u8_t level, u16_t idx, s32_t *sub_id); + + /** async Questions */ + void (*get_object_def_q)(void* addr_inf, u8_t rid, u8_t ident_len, s32_t *ident); + void (*get_value_q)(u8_t rid, struct obj_def *od); + void (*set_test_q)(u8_t rid, struct obj_def *od); + void (*set_value_q)(u8_t rid, struct obj_def *od, u16_t len, void *value); + /** async Answers */ + void (*get_object_def_a)(u8_t rid, u8_t ident_len, s32_t *ident, struct obj_def *od); + void (*get_value_a)(u8_t rid, struct obj_def *od, u16_t len, void *value); + u8_t (*set_test_a)(u8_t rid, struct obj_def *od, u16_t len, void *value); + void (*set_value_a)(u8_t rid, struct obj_def *od, u16_t len, void *value); + /** async Panic Close (agent returns error reply, + e.g. used for external transaction cleanup) */ + void (*get_object_def_pc)(u8_t rid, u8_t ident_len, s32_t *ident); + void (*get_value_pc)(u8_t rid, struct obj_def *od); + void (*set_test_pc)(u8_t rid, struct obj_def *od); + void (*set_value_pc)(u8_t rid, struct obj_def *od); +}; + +/** export MIB tree from mib2.c */ +extern const struct mib_array_node internet; + +/** dummy function pointers for non-leaf MIB nodes from mib2.c */ +void noleafs_get_object_def(u8_t ident_len, s32_t *ident, struct obj_def *od); +void noleafs_get_value(struct obj_def *od, u16_t len, void *value); +u8_t noleafs_set_test(struct obj_def *od, u16_t len, void *value); +void noleafs_set_value(struct obj_def *od, u16_t len, void *value); + +void snmp_oidtoip(s32_t *ident, ip_addr_t *ip); +void snmp_iptooid(ip_addr_t *ip, s32_t *ident); +void snmp_ifindextonetif(s32_t ifindex, struct netif **netif); +void snmp_netiftoifindex(struct netif *netif, s32_t *ifidx); + +struct mib_list_node* snmp_mib_ln_alloc(s32_t id); +void snmp_mib_ln_free(struct mib_list_node *ln); +struct mib_list_rootnode* snmp_mib_lrn_alloc(void); +void snmp_mib_lrn_free(struct mib_list_rootnode *lrn); + +s8_t snmp_mib_node_insert(struct mib_list_rootnode *rn, s32_t objid, struct mib_list_node **insn); +s8_t snmp_mib_node_find(struct mib_list_rootnode *rn, s32_t objid, struct mib_list_node **fn); +struct mib_list_rootnode *snmp_mib_node_delete(struct mib_list_rootnode *rn, struct mib_list_node *n); + +struct mib_node* snmp_search_tree(struct mib_node *node, u8_t ident_len, s32_t *ident, struct snmp_name_ptr *np); +struct mib_node* snmp_expand_tree(struct mib_node *node, u8_t ident_len, s32_t *ident, struct snmp_obj_id *oidret); +u8_t snmp_iso_prefix_tst(u8_t ident_len, s32_t *ident); +u8_t snmp_iso_prefix_expand(u8_t ident_len, s32_t *ident, struct snmp_obj_id *oidret); + +#ifdef __cplusplus +} +#endif + +#endif /* LWIP_SNMP */ + +#endif /* __LWIP_SNMP_STRUCTS_H__ */ diff --git a/lib/drivers/lwip/src/include/lwip/sockets.h b/lib/drivers/lwip/src/include/lwip/sockets.h new file mode 100644 index 00000000000..3c8fed24e6e --- /dev/null +++ b/lib/drivers/lwip/src/include/lwip/sockets.h @@ -0,0 +1,376 @@ +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ + + +#ifndef __LWIP_SOCKETS_H__ +#define __LWIP_SOCKETS_H__ + +#include "lwip/opt.h" + +#if LWIP_SOCKET /* don't build if not configured for use in lwipopts.h */ + +#include /* for size_t */ + +#include "lwip/ip_addr.h" +#include "lwip/inet.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* members are in network byte order */ +struct sockaddr_in { + u8_t sin_len; + u8_t sin_family; + u16_t sin_port; + struct in_addr sin_addr; + char sin_zero[8]; +}; + +struct sockaddr { + u8_t sa_len; + u8_t sa_family; + char sa_data[14]; +}; + +#ifndef socklen_t +# define socklen_t u32_t +#endif + +/* Socket protocol types (TCP/UDP/RAW) */ +#define SOCK_STREAM 1 +#define SOCK_DGRAM 2 +#define SOCK_RAW 3 + +/* + * Option flags per-socket. These must match the SOF_ flags in ip.h (checked in init.c) + */ +#define SO_DEBUG 0x0001 /* Unimplemented: turn on debugging info recording */ +#define SO_ACCEPTCONN 0x0002 /* socket has had listen() */ +#define SO_REUSEADDR 0x0004 /* Allow local address reuse */ +#define SO_KEEPALIVE 0x0008 /* keep connections alive */ +#define SO_DONTROUTE 0x0010 /* Unimplemented: just use interface addresses */ +#define SO_BROADCAST 0x0020 /* permit to send and to receive broadcast messages (see IP_SOF_BROADCAST option) */ +#define SO_USELOOPBACK 0x0040 /* Unimplemented: bypass hardware when possible */ +#define SO_LINGER 0x0080 /* linger on close if data present */ +#define SO_OOBINLINE 0x0100 /* Unimplemented: leave received OOB data in line */ +#define SO_REUSEPORT 0x0200 /* Unimplemented: allow local address & port reuse */ + +#define SO_DONTLINGER ((int)(~SO_LINGER)) + +/* + * Additional options, not kept in so_options. + */ +#define SO_SNDBUF 0x1001 /* Unimplemented: send buffer size */ +#define SO_RCVBUF 0x1002 /* receive buffer size */ +#define SO_SNDLOWAT 0x1003 /* Unimplemented: send low-water mark */ +#define SO_RCVLOWAT 0x1004 /* Unimplemented: receive low-water mark */ +#define SO_SNDTIMEO 0x1005 /* Unimplemented: send timeout */ +#define SO_RCVTIMEO 0x1006 /* receive timeout */ +#define SO_ERROR 0x1007 /* get error status and clear */ +#define SO_TYPE 0x1008 /* get socket type */ +#define SO_CONTIMEO 0x1009 /* Unimplemented: connect timeout */ +#define SO_NO_CHECK 0x100a /* don't create UDP checksum */ + + +/* + * Structure used for manipulating linger option. + */ +struct linger { + int l_onoff; /* option on/off */ + int l_linger; /* linger time */ +}; + +/* + * Level number for (get/set)sockopt() to apply to socket itself. + */ +#define SOL_SOCKET 0xfff /* options for socket level */ + + +#define AF_UNSPEC 0 +#define AF_INET 2 +#define PF_INET AF_INET +#define PF_UNSPEC AF_UNSPEC + +#define IPPROTO_IP 0 +#define IPPROTO_TCP 6 +#define IPPROTO_UDP 17 +#define IPPROTO_UDPLITE 136 + +/* Flags we can use with send and recv. */ +#define MSG_PEEK 0x01 /* Peeks at an incoming message */ +#define MSG_WAITALL 0x02 /* Unimplemented: Requests that the function block until the full amount of data requested can be returned */ +#define MSG_OOB 0x04 /* Unimplemented: Requests out-of-band data. The significance and semantics of out-of-band data are protocol-specific */ +#define MSG_DONTWAIT 0x08 /* Nonblocking i/o for this operation only */ +#define MSG_MORE 0x10 /* Sender will send more */ + + +/* + * Options for level IPPROTO_IP + */ +#define IP_TOS 1 +#define IP_TTL 2 + +#if LWIP_TCP +/* + * Options for level IPPROTO_TCP + */ +#define TCP_NODELAY 0x01 /* don't delay send to coalesce packets */ +#define TCP_KEEPALIVE 0x02 /* send KEEPALIVE probes when idle for pcb->keep_idle milliseconds */ +#define TCP_KEEPIDLE 0x03 /* set pcb->keep_idle - Same as TCP_KEEPALIVE, but use seconds for get/setsockopt */ +#define TCP_KEEPINTVL 0x04 /* set pcb->keep_intvl - Use seconds for get/setsockopt */ +#define TCP_KEEPCNT 0x05 /* set pcb->keep_cnt - Use number of probes sent for get/setsockopt */ +#endif /* LWIP_TCP */ + +#if LWIP_UDP && LWIP_UDPLITE +/* + * Options for level IPPROTO_UDPLITE + */ +#define UDPLITE_SEND_CSCOV 0x01 /* sender checksum coverage */ +#define UDPLITE_RECV_CSCOV 0x02 /* minimal receiver checksum coverage */ +#endif /* LWIP_UDP && LWIP_UDPLITE*/ + + +#if LWIP_IGMP +/* + * Options and types for UDP multicast traffic handling + */ +#define IP_ADD_MEMBERSHIP 3 +#define IP_DROP_MEMBERSHIP 4 +#define IP_MULTICAST_TTL 5 +#define IP_MULTICAST_IF 6 +#define IP_MULTICAST_LOOP 7 + +typedef struct ip_mreq { + struct in_addr imr_multiaddr; /* IP multicast address of group */ + struct in_addr imr_interface; /* local IP address of interface */ +} ip_mreq; +#endif /* LWIP_IGMP */ + +/* + * The Type of Service provides an indication of the abstract + * parameters of the quality of service desired. These parameters are + * to be used to guide the selection of the actual service parameters + * when transmitting a datagram through a particular network. Several + * networks offer service precedence, which somehow treats high + * precedence traffic as more important than other traffic (generally + * by accepting only traffic above a certain precedence at time of high + * load). The major choice is a three way tradeoff between low-delay, + * high-reliability, and high-throughput. + * The use of the Delay, Throughput, and Reliability indications may + * increase the cost (in some sense) of the service. In many networks + * better performance for one of these parameters is coupled with worse + * performance on another. Except for very unusual cases at most two + * of these three indications should be set. + */ +#define IPTOS_TOS_MASK 0x1E +#define IPTOS_TOS(tos) ((tos) & IPTOS_TOS_MASK) +#define IPTOS_LOWDELAY 0x10 +#define IPTOS_THROUGHPUT 0x08 +#define IPTOS_RELIABILITY 0x04 +#define IPTOS_LOWCOST 0x02 +#define IPTOS_MINCOST IPTOS_LOWCOST + +/* + * The Network Control precedence designation is intended to be used + * within a network only. The actual use and control of that + * designation is up to each network. The Internetwork Control + * designation is intended for use by gateway control originators only. + * If the actual use of these precedence designations is of concern to + * a particular network, it is the responsibility of that network to + * control the access to, and use of, those precedence designations. + */ +#define IPTOS_PREC_MASK 0xe0 +#define IPTOS_PREC(tos) ((tos) & IPTOS_PREC_MASK) +#define IPTOS_PREC_NETCONTROL 0xe0 +#define IPTOS_PREC_INTERNETCONTROL 0xc0 +#define IPTOS_PREC_CRITIC_ECP 0xa0 +#define IPTOS_PREC_FLASHOVERRIDE 0x80 +#define IPTOS_PREC_FLASH 0x60 +#define IPTOS_PREC_IMMEDIATE 0x40 +#define IPTOS_PREC_PRIORITY 0x20 +#define IPTOS_PREC_ROUTINE 0x00 + + +/* + * Commands for ioctlsocket(), taken from the BSD file fcntl.h. + * lwip_ioctl only supports FIONREAD and FIONBIO, for now + * + * Ioctl's have the command encoded in the lower word, + * and the size of any in or out parameters in the upper + * word. The high 2 bits of the upper word are used + * to encode the in/out status of the parameter; for now + * we restrict parameters to at most 128 bytes. + */ +#if !defined(FIONREAD) || !defined(FIONBIO) +#define IOCPARM_MASK 0x7fU /* parameters must be < 128 bytes */ +#define IOC_VOID 0x20000000UL /* no parameters */ +#define IOC_OUT 0x40000000UL /* copy out parameters */ +#define IOC_IN 0x80000000UL /* copy in parameters */ +#define IOC_INOUT (IOC_IN|IOC_OUT) + /* 0x20000000 distinguishes new & + old ioctl's */ +#define _IO(x,y) (IOC_VOID|((x)<<8)|(y)) + +#define _IOR(x,y,t) (IOC_OUT|(((long)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y)) + +#define _IOW(x,y,t) (IOC_IN|(((long)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y)) +#endif /* !defined(FIONREAD) || !defined(FIONBIO) */ + +#ifndef FIONREAD +#define FIONREAD _IOR('f', 127, unsigned long) /* get # bytes to read */ +#endif +#ifndef FIONBIO +#define FIONBIO _IOW('f', 126, unsigned long) /* set/clear non-blocking i/o */ +#endif + +/* Socket I/O Controls: unimplemented */ +#ifndef SIOCSHIWAT +#define SIOCSHIWAT _IOW('s', 0, unsigned long) /* set high watermark */ +#define SIOCGHIWAT _IOR('s', 1, unsigned long) /* get high watermark */ +#define SIOCSLOWAT _IOW('s', 2, unsigned long) /* set low watermark */ +#define SIOCGLOWAT _IOR('s', 3, unsigned long) /* get low watermark */ +#define SIOCATMARK _IOR('s', 7, unsigned long) /* at oob mark? */ +#endif + +/* commands for fnctl */ +#ifndef F_GETFL +#define F_GETFL 3 +#endif +#ifndef F_SETFL +#define F_SETFL 4 +#endif + +/* File status flags and file access modes for fnctl, + these are bits in an int. */ +#ifndef O_NONBLOCK +#define O_NONBLOCK 1 /* nonblocking I/O */ +#endif +#ifndef O_NDELAY +#define O_NDELAY 1 /* same as O_NONBLOCK, for compatibility */ +#endif + +#ifndef SHUT_RD + #define SHUT_RD 0 + #define SHUT_WR 1 + #define SHUT_RDWR 2 +#endif + +/* FD_SET used for lwip_select */ +#ifndef FD_SET + #undef FD_SETSIZE + /* Make FD_SETSIZE match NUM_SOCKETS in socket.c */ + #define FD_SETSIZE MEMP_NUM_NETCONN + #define FD_SET(n, p) ((p)->fd_bits[(n)/8] |= (1 << ((n) & 7))) + #define FD_CLR(n, p) ((p)->fd_bits[(n)/8] &= ~(1 << ((n) & 7))) + #define FD_ISSET(n,p) ((p)->fd_bits[(n)/8] & (1 << ((n) & 7))) + #define FD_ZERO(p) memset((void*)(p),0,sizeof(*(p))) + + typedef struct fd_set { + unsigned char fd_bits [(FD_SETSIZE+7)/8]; + } fd_set; + +#endif /* FD_SET */ + +/** LWIP_TIMEVAL_PRIVATE: if you want to use the struct timeval provided + * by your system, set this to 0 and include in cc.h */ +#ifndef LWIP_TIMEVAL_PRIVATE +#define LWIP_TIMEVAL_PRIVATE 1 +#endif + +#if LWIP_TIMEVAL_PRIVATE +struct timeval { + long tv_sec; /* seconds */ + long tv_usec; /* and microseconds */ +}; +#endif /* LWIP_TIMEVAL_PRIVATE */ + +void lwip_socket_init(void); + +int lwip_accept(int s, struct sockaddr *addr, socklen_t *addrlen); +int lwip_bind(int s, const struct sockaddr *name, socklen_t namelen); +int lwip_shutdown(int s, int how); +int lwip_getpeername (int s, struct sockaddr *name, socklen_t *namelen); +int lwip_getsockname (int s, struct sockaddr *name, socklen_t *namelen); +int lwip_getsockopt (int s, int level, int optname, void *optval, socklen_t *optlen); +int lwip_setsockopt (int s, int level, int optname, const void *optval, socklen_t optlen); +int lwip_close(int s); +int lwip_connect(int s, const struct sockaddr *name, socklen_t namelen); +int lwip_listen(int s, int backlog); +int lwip_recv(int s, void *mem, size_t len, int flags); +int lwip_read(int s, void *mem, size_t len); +int lwip_recvfrom(int s, void *mem, size_t len, int flags, + struct sockaddr *from, socklen_t *fromlen); +int lwip_send(int s, const void *dataptr, size_t size, int flags); +int lwip_sendto(int s, const void *dataptr, size_t size, int flags, + const struct sockaddr *to, socklen_t tolen); +int lwip_socket(int domain, int type, int protocol); +int lwip_write(int s, const void *dataptr, size_t size); +int lwip_select(int maxfdp1, fd_set *readset, fd_set *writeset, fd_set *exceptset, + struct timeval *timeout); +int lwip_ioctl(int s, long cmd, void *argp); +int lwip_fcntl(int s, int cmd, int val); + +#if LWIP_COMPAT_SOCKETS +#define accept(a,b,c) lwip_accept(a,b,c) +#define bind(a,b,c) lwip_bind(a,b,c) +#define shutdown(a,b) lwip_shutdown(a,b) +#define closesocket(s) lwip_close(s) +#define connect(a,b,c) lwip_connect(a,b,c) +#define getsockname(a,b,c) lwip_getsockname(a,b,c) +#define getpeername(a,b,c) lwip_getpeername(a,b,c) +#define setsockopt(a,b,c,d,e) lwip_setsockopt(a,b,c,d,e) +#define getsockopt(a,b,c,d,e) lwip_getsockopt(a,b,c,d,e) +#define listen(a,b) lwip_listen(a,b) +#define recv(a,b,c,d) lwip_recv(a,b,c,d) +#define recvfrom(a,b,c,d,e,f) lwip_recvfrom(a,b,c,d,e,f) +#define send(a,b,c,d) lwip_send(a,b,c,d) +#define sendto(a,b,c,d,e,f) lwip_sendto(a,b,c,d,e,f) +#define socket(a,b,c) lwip_socket(a,b,c) +#define select(a,b,c,d,e) lwip_select(a,b,c,d,e) +#define ioctlsocket(a,b,c) lwip_ioctl(a,b,c) + +#if LWIP_POSIX_SOCKETS_IO_NAMES +#define read(a,b,c) lwip_read(a,b,c) +#define write(a,b,c) lwip_write(a,b,c) +#define close(s) lwip_close(s) +#endif /* LWIP_POSIX_SOCKETS_IO_NAMES */ + +#endif /* LWIP_COMPAT_SOCKETS */ + +#ifdef __cplusplus +} +#endif + +#endif /* LWIP_SOCKET */ + +#endif /* __LWIP_SOCKETS_H__ */ diff --git a/lib/drivers/lwip/src/include/lwip/stats.h b/lib/drivers/lwip/src/include/lwip/stats.h new file mode 100644 index 00000000000..015b7ce79d8 --- /dev/null +++ b/lib/drivers/lwip/src/include/lwip/stats.h @@ -0,0 +1,292 @@ +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ +#ifndef __LWIP_STATS_H__ +#define __LWIP_STATS_H__ + +#include "lwip/opt.h" + +#include "lwip/mem.h" +#include "lwip/memp.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#if LWIP_STATS + +#ifndef LWIP_STATS_LARGE +#define LWIP_STATS_LARGE 0 +#endif + +#if LWIP_STATS_LARGE +#define STAT_COUNTER u32_t +#define STAT_COUNTER_F U32_F +#else +#define STAT_COUNTER u16_t +#define STAT_COUNTER_F U16_F +#endif + +struct stats_proto { + STAT_COUNTER xmit; /* Transmitted packets. */ + STAT_COUNTER recv; /* Received packets. */ + STAT_COUNTER fw; /* Forwarded packets. */ + STAT_COUNTER drop; /* Dropped packets. */ + STAT_COUNTER chkerr; /* Checksum error. */ + STAT_COUNTER lenerr; /* Invalid length error. */ + STAT_COUNTER memerr; /* Out of memory error. */ + STAT_COUNTER rterr; /* Routing error. */ + STAT_COUNTER proterr; /* Protocol error. */ + STAT_COUNTER opterr; /* Error in options. */ + STAT_COUNTER err; /* Misc error. */ + STAT_COUNTER cachehit; +}; + +struct stats_igmp { + STAT_COUNTER xmit; /* Transmitted packets. */ + STAT_COUNTER recv; /* Received packets. */ + STAT_COUNTER drop; /* Dropped packets. */ + STAT_COUNTER chkerr; /* Checksum error. */ + STAT_COUNTER lenerr; /* Invalid length error. */ + STAT_COUNTER memerr; /* Out of memory error. */ + STAT_COUNTER proterr; /* Protocol error. */ + STAT_COUNTER rx_v1; /* Received v1 frames. */ + STAT_COUNTER rx_group; /* Received group-specific queries. */ + STAT_COUNTER rx_general; /* Received general queries. */ + STAT_COUNTER rx_report; /* Received reports. */ + STAT_COUNTER tx_join; /* Sent joins. */ + STAT_COUNTER tx_leave; /* Sent leaves. */ + STAT_COUNTER tx_report; /* Sent reports. */ +}; + +struct stats_mem { +#ifdef LWIP_DEBUG + const char *name; +#endif /* LWIP_DEBUG */ + mem_size_t avail; + mem_size_t used; + mem_size_t max; + STAT_COUNTER err; + STAT_COUNTER illegal; +}; + +struct stats_syselem { + STAT_COUNTER used; + STAT_COUNTER max; + STAT_COUNTER err; +}; + +struct stats_sys { + struct stats_syselem sem; + struct stats_syselem mutex; + struct stats_syselem mbox; +}; + +struct stats_ { +#if LINK_STATS + struct stats_proto link; +#endif +#if ETHARP_STATS + struct stats_proto etharp; +#endif +#if IPFRAG_STATS + struct stats_proto ip_frag; +#endif +#if IP_STATS + struct stats_proto ip; +#endif +#if ICMP_STATS + struct stats_proto icmp; +#endif +#if IGMP_STATS + struct stats_igmp igmp; +#endif +#if UDP_STATS + struct stats_proto udp; +#endif +#if TCP_STATS + struct stats_proto tcp; +#endif +#if MEM_STATS + struct stats_mem mem; +#endif +#if MEMP_STATS + struct stats_mem memp[MEMP_MAX]; +#endif +#if SYS_STATS + struct stats_sys sys; +#endif +}; + +extern struct stats_ lwip_stats; + +void stats_init(void); + +#define STATS_INC(x) ++lwip_stats.x +#define STATS_DEC(x) --lwip_stats.x +#define STATS_INC_USED(x, y) do { lwip_stats.x.used += y; \ + if (lwip_stats.x.max < lwip_stats.x.used) { \ + lwip_stats.x.max = lwip_stats.x.used; \ + } \ + } while(0) +#else /* LWIP_STATS */ +#define stats_init() +#define STATS_INC(x) +#define STATS_DEC(x) +#define STATS_INC_USED(x) +#endif /* LWIP_STATS */ + +#if TCP_STATS +#define TCP_STATS_INC(x) STATS_INC(x) +#define TCP_STATS_DISPLAY() stats_display_proto(&lwip_stats.tcp, "TCP") +#else +#define TCP_STATS_INC(x) +#define TCP_STATS_DISPLAY() +#endif + +#if UDP_STATS +#define UDP_STATS_INC(x) STATS_INC(x) +#define UDP_STATS_DISPLAY() stats_display_proto(&lwip_stats.udp, "UDP") +#else +#define UDP_STATS_INC(x) +#define UDP_STATS_DISPLAY() +#endif + +#if ICMP_STATS +#define ICMP_STATS_INC(x) STATS_INC(x) +#define ICMP_STATS_DISPLAY() stats_display_proto(&lwip_stats.icmp, "ICMP") +#else +#define ICMP_STATS_INC(x) +#define ICMP_STATS_DISPLAY() +#endif + +#if IGMP_STATS +#define IGMP_STATS_INC(x) STATS_INC(x) +#define IGMP_STATS_DISPLAY() stats_display_igmp(&lwip_stats.igmp) +#else +#define IGMP_STATS_INC(x) +#define IGMP_STATS_DISPLAY() +#endif + +#if IP_STATS +#define IP_STATS_INC(x) STATS_INC(x) +#define IP_STATS_DISPLAY() stats_display_proto(&lwip_stats.ip, "IP") +#else +#define IP_STATS_INC(x) +#define IP_STATS_DISPLAY() +#endif + +#if IPFRAG_STATS +#define IPFRAG_STATS_INC(x) STATS_INC(x) +#define IPFRAG_STATS_DISPLAY() stats_display_proto(&lwip_stats.ip_frag, "IP_FRAG") +#else +#define IPFRAG_STATS_INC(x) +#define IPFRAG_STATS_DISPLAY() +#endif + +#if ETHARP_STATS +#define ETHARP_STATS_INC(x) STATS_INC(x) +#define ETHARP_STATS_DISPLAY() stats_display_proto(&lwip_stats.etharp, "ETHARP") +#else +#define ETHARP_STATS_INC(x) +#define ETHARP_STATS_DISPLAY() +#endif + +#if LINK_STATS +#define LINK_STATS_INC(x) STATS_INC(x) +#define LINK_STATS_DISPLAY() stats_display_proto(&lwip_stats.link, "LINK") +#else +#define LINK_STATS_INC(x) +#define LINK_STATS_DISPLAY() +#endif + +#if MEM_STATS +#define MEM_STATS_AVAIL(x, y) lwip_stats.mem.x = y +#define MEM_STATS_INC(x) STATS_INC(mem.x) +#define MEM_STATS_INC_USED(x, y) STATS_INC_USED(mem, y) +#define MEM_STATS_DEC_USED(x, y) lwip_stats.mem.x -= y +#define MEM_STATS_DISPLAY() stats_display_mem(&lwip_stats.mem, "HEAP") +#else +#define MEM_STATS_AVAIL(x, y) +#define MEM_STATS_INC(x) +#define MEM_STATS_INC_USED(x, y) +#define MEM_STATS_DEC_USED(x, y) +#define MEM_STATS_DISPLAY() +#endif + +#if MEMP_STATS +#define MEMP_STATS_AVAIL(x, i, y) lwip_stats.memp[i].x = y +#define MEMP_STATS_INC(x, i) STATS_INC(memp[i].x) +#define MEMP_STATS_DEC(x, i) STATS_DEC(memp[i].x) +#define MEMP_STATS_INC_USED(x, i) STATS_INC_USED(memp[i], 1) +#define MEMP_STATS_DISPLAY(i) stats_display_memp(&lwip_stats.memp[i], i) +#else +#define MEMP_STATS_AVAIL(x, i, y) +#define MEMP_STATS_INC(x, i) +#define MEMP_STATS_DEC(x, i) +#define MEMP_STATS_INC_USED(x, i) +#define MEMP_STATS_DISPLAY(i) +#endif + +#if SYS_STATS +#define SYS_STATS_INC(x) STATS_INC(sys.x) +#define SYS_STATS_DEC(x) STATS_DEC(sys.x) +#define SYS_STATS_INC_USED(x) STATS_INC_USED(sys.x, 1) +#define SYS_STATS_DISPLAY() stats_display_sys(&lwip_stats.sys) +#else +#define SYS_STATS_INC(x) +#define SYS_STATS_DEC(x) +#define SYS_STATS_INC_USED(x) +#define SYS_STATS_DISPLAY() +#endif + +/* Display of statistics */ +#if LWIP_STATS_DISPLAY +void stats_display(void); +void stats_display_proto(struct stats_proto *proto, char *name); +void stats_display_igmp(struct stats_igmp *igmp); +void stats_display_mem(struct stats_mem *mem, char *name); +void stats_display_memp(struct stats_mem *mem, int index); +void stats_display_sys(struct stats_sys *sys); +#else /* LWIP_STATS_DISPLAY */ +#define stats_display() +#define stats_display_proto(proto, name) +#define stats_display_igmp(igmp) +#define stats_display_mem(mem, name) +#define stats_display_memp(mem, index) +#define stats_display_sys(sys) +#endif /* LWIP_STATS_DISPLAY */ + +#ifdef __cplusplus +} +#endif + +#endif /* __LWIP_STATS_H__ */ diff --git a/lib/drivers/lwip/src/include/lwip/sys.h b/lib/drivers/lwip/src/include/lwip/sys.h new file mode 100644 index 00000000000..9f62c7540e6 --- /dev/null +++ b/lib/drivers/lwip/src/include/lwip/sys.h @@ -0,0 +1,331 @@ +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ +#ifndef __LWIP_SYS_H__ +#define __LWIP_SYS_H__ + +#include "lwip/opt.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#if NO_SYS + +/* For a totally minimal and standalone system, we provide null + definitions of the sys_ functions. */ +typedef u8_t sys_sem_t; +typedef u8_t sys_mutex_t; +typedef u8_t sys_mbox_t; + +#define sys_sem_new(s, c) ERR_OK +#define sys_sem_signal(s) +#define sys_sem_wait(s) +#define sys_arch_sem_wait(s,t) +#define sys_sem_free(s) +#define sys_mutex_new(mu) ERR_OK +#define sys_mutex_lock(mu) +#define sys_mutex_unlock(mu) +#define sys_mutex_free(mu) +#define sys_mbox_new(m, s) ERR_OK +#define sys_mbox_fetch(m,d) +#define sys_mbox_tryfetch(m,d) +#define sys_mbox_post(m,d) +#define sys_mbox_trypost(m,d) +#define sys_mbox_free(m) + +#define sys_thread_new(n,t,a,s,p) + +#define sys_msleep(t) + +#else /* NO_SYS */ + +/** Return code for timeouts from sys_arch_mbox_fetch and sys_arch_sem_wait */ +#define SYS_ARCH_TIMEOUT 0xffffffffUL + +/** sys_mbox_tryfetch() returns SYS_MBOX_EMPTY if appropriate. + * For now we use the same magic value, but we allow this to change in future. + */ +#define SYS_MBOX_EMPTY SYS_ARCH_TIMEOUT + +#include "lwip/err.h" +#include "arch/sys_arch.h" + +/** Function prototype for thread functions */ +typedef void (*lwip_thread_fn)(void *arg); + +/* Function prototypes for functions to be implemented by platform ports + (in sys_arch.c) */ + +/* Mutex functions: */ + +/** Define LWIP_COMPAT_MUTEX if the port has no mutexes and binary semaphores + should be used instead */ +#if LWIP_COMPAT_MUTEX +/* for old ports that don't have mutexes: define them to binary semaphores */ +#define sys_mutex_t sys_sem_t +#define sys_mutex_new(mutex) sys_sem_new(mutex, 1) +#define sys_mutex_lock(mutex) sys_sem_wait(mutex) +#define sys_mutex_unlock(mutex) sys_sem_signal(mutex) +#define sys_mutex_free(mutex) sys_sem_free(mutex) +#define sys_mutex_valid(mutex) sys_sem_valid(mutex) +#define sys_mutex_set_invalid(mutex) sys_sem_set_invalid(mutex) + +#else /* LWIP_COMPAT_MUTEX */ + +/** Create a new mutex + * @param mutex pointer to the mutex to create + * @return a new mutex */ +err_t sys_mutex_new(sys_mutex_t *mutex); +/** Lock a mutex + * @param mutex the mutex to lock */ +void sys_mutex_lock(sys_mutex_t *mutex); +/** Unlock a mutex + * @param mutex the mutex to unlock */ +void sys_mutex_unlock(sys_mutex_t *mutex); +/** Delete a semaphore + * @param mutex the mutex to delete */ +void sys_mutex_free(sys_mutex_t *mutex); +#ifndef sys_mutex_valid +/** Check if a mutex is valid/allocated: return 1 for valid, 0 for invalid */ +int sys_mutex_valid(sys_mutex_t *mutex); +#endif +#ifndef sys_mutex_set_invalid +/** Set a mutex invalid so that sys_mutex_valid returns 0 */ +void sys_mutex_set_invalid(sys_mutex_t *mutex); +#endif +#endif /* LWIP_COMPAT_MUTEX */ + +/* Semaphore functions: */ + +/** Create a new semaphore + * @param sem pointer to the semaphore to create + * @param count initial count of the semaphore + * @return ERR_OK if successful, another err_t otherwise */ +err_t sys_sem_new(sys_sem_t *sem, u8_t count); +/** Signals a semaphore + * @param sem the semaphore to signal */ +void sys_sem_signal(sys_sem_t *sem); +/** Wait for a semaphore for the specified timeout + * @param sem the semaphore to wait for + * @param timeout timeout in milliseconds to wait (0 = wait forever) + * @return time (in milliseconds) waited for the semaphore + * or SYS_ARCH_TIMEOUT on timeout */ +u32_t sys_arch_sem_wait(sys_sem_t *sem, u32_t timeout); +/** Delete a semaphore + * @param sem semaphore to delete */ +void sys_sem_free(sys_sem_t *sem); +/** Wait for a semaphore - forever/no timeout */ +#define sys_sem_wait(sem) sys_arch_sem_wait(sem, 0) +#ifndef sys_sem_valid +/** Check if a sempahore is valid/allocated: return 1 for valid, 0 for invalid */ +int sys_sem_valid(sys_sem_t *sem); +#endif +#ifndef sys_sem_set_invalid +/** Set a semaphore invalid so that sys_sem_valid returns 0 */ +void sys_sem_set_invalid(sys_sem_t *sem); +#endif + +/* Time functions. */ +#ifndef sys_msleep +void sys_msleep(u32_t ms); /* only has a (close to) 1 jiffy resolution. */ +#endif + +/* Mailbox functions. */ + +/** Create a new mbox of specified size + * @param mbox pointer to the mbox to create + * @param size (miminum) number of messages in this mbox + * @return ERR_OK if successful, another err_t otherwise */ +err_t sys_mbox_new(sys_mbox_t *mbox, int size); +/** Post a message to an mbox - may not fail + * -> blocks if full, only used from tasks not from ISR + * @param mbox mbox to posts the message + * @param msg message to post (ATTENTION: can be NULL) */ +void sys_mbox_post(sys_mbox_t *mbox, void *msg); +/** Try to post a message to an mbox - may fail if full or ISR + * @param mbox mbox to posts the message + * @param msg message to post (ATTENTION: can be NULL) */ +err_t sys_mbox_trypost(sys_mbox_t *mbox, void *msg); +/** Wait for a new message to arrive in the mbox + * @param mbox mbox to get a message from + * @param msg pointer where the message is stored + * @param timeout maximum time (in milliseconds) to wait for a message + * @return time (in milliseconds) waited for a message, may be 0 if not waited + or SYS_ARCH_TIMEOUT on timeout + * The returned time has to be accurate to prevent timer jitter! */ +u32_t sys_arch_mbox_fetch(sys_mbox_t *mbox, void **msg, u32_t timeout); +/* Allow port to override with a macro, e.g. special timout for sys_arch_mbox_fetch() */ +#ifndef sys_arch_mbox_tryfetch +/** Wait for a new message to arrive in the mbox + * @param mbox mbox to get a message from + * @param msg pointer where the message is stored + * @param timeout maximum time (in milliseconds) to wait for a message + * @return 0 (milliseconds) if a message has been received + * or SYS_MBOX_EMPTY if the mailbox is empty */ +u32_t sys_arch_mbox_tryfetch(sys_mbox_t *mbox, void **msg); +#endif +/** For now, we map straight to sys_arch implementation. */ +#define sys_mbox_tryfetch(mbox, msg) sys_arch_mbox_tryfetch(mbox, msg) +/** Delete an mbox + * @param mbox mbox to delete */ +void sys_mbox_free(sys_mbox_t *mbox); +#define sys_mbox_fetch(mbox, msg) sys_arch_mbox_fetch(mbox, msg, 0) +#ifndef sys_mbox_valid +/** Check if an mbox is valid/allocated: return 1 for valid, 0 for invalid */ +int sys_mbox_valid(sys_mbox_t *mbox); +#endif +#ifndef sys_mbox_set_invalid +/** Set an mbox invalid so that sys_mbox_valid returns 0 */ +void sys_mbox_set_invalid(sys_mbox_t *mbox); +#endif + +/** The only thread function: + * Creates a new thread + * @param name human-readable name for the thread (used for debugging purposes) + * @param thread thread-function + * @param arg parameter passed to 'thread' + * @param stacksize stack size in bytes for the new thread (may be ignored by ports) + * @param prio priority of the new thread (may be ignored by ports) */ +sys_thread_t sys_thread_new(const char *name, lwip_thread_fn thread, void *arg, int stacksize, int prio); + +#endif /* NO_SYS */ + +/* sys_init() must be called before anthing else. */ +void sys_init(void); + +#ifndef sys_jiffies +/** Ticks/jiffies since power up. */ +u32_t sys_jiffies(void); +#endif + +/** Returns the current time in milliseconds, + * may be the same as sys_jiffies or at least based on it. */ +u32_t sys_now(void); + +/* Critical Region Protection */ +/* These functions must be implemented in the sys_arch.c file. + In some implementations they can provide a more light-weight protection + mechanism than using semaphores. Otherwise semaphores can be used for + implementation */ +#ifndef SYS_ARCH_PROTECT +/** SYS_LIGHTWEIGHT_PROT + * define SYS_LIGHTWEIGHT_PROT in lwipopts.h if you want inter-task protection + * for certain critical regions during buffer allocation, deallocation and memory + * allocation and deallocation. + */ +#if SYS_LIGHTWEIGHT_PROT + +/** SYS_ARCH_DECL_PROTECT + * declare a protection variable. This macro will default to defining a variable of + * type sys_prot_t. If a particular port needs a different implementation, then + * this macro may be defined in sys_arch.h. + */ +#define SYS_ARCH_DECL_PROTECT(lev) sys_prot_t lev +/** SYS_ARCH_PROTECT + * Perform a "fast" protect. This could be implemented by + * disabling interrupts for an embedded system or by using a semaphore or + * mutex. The implementation should allow calling SYS_ARCH_PROTECT when + * already protected. The old protection level is returned in the variable + * "lev". This macro will default to calling the sys_arch_protect() function + * which should be implemented in sys_arch.c. If a particular port needs a + * different implementation, then this macro may be defined in sys_arch.h + */ +#define SYS_ARCH_PROTECT(lev) lev = sys_arch_protect() +/** SYS_ARCH_UNPROTECT + * Perform a "fast" set of the protection level to "lev". This could be + * implemented by setting the interrupt level to "lev" within the MACRO or by + * using a semaphore or mutex. This macro will default to calling the + * sys_arch_unprotect() function which should be implemented in + * sys_arch.c. If a particular port needs a different implementation, then + * this macro may be defined in sys_arch.h + */ +#define SYS_ARCH_UNPROTECT(lev) sys_arch_unprotect(lev) +sys_prot_t sys_arch_protect(void); +void sys_arch_unprotect(sys_prot_t pval); + +#else + +#define SYS_ARCH_DECL_PROTECT(lev) +#define SYS_ARCH_PROTECT(lev) +#define SYS_ARCH_UNPROTECT(lev) + +#endif /* SYS_LIGHTWEIGHT_PROT */ + +#endif /* SYS_ARCH_PROTECT */ + +/* + * Macros to set/get and increase/decrease variables in a thread-safe way. + * Use these for accessing variable that are used from more than one thread. + */ + +#ifndef SYS_ARCH_INC +#define SYS_ARCH_INC(var, val) do { \ + SYS_ARCH_DECL_PROTECT(old_level); \ + SYS_ARCH_PROTECT(old_level); \ + var += val; \ + SYS_ARCH_UNPROTECT(old_level); \ + } while(0) +#endif /* SYS_ARCH_INC */ + +#ifndef SYS_ARCH_DEC +#define SYS_ARCH_DEC(var, val) do { \ + SYS_ARCH_DECL_PROTECT(old_level); \ + SYS_ARCH_PROTECT(old_level); \ + var -= val; \ + SYS_ARCH_UNPROTECT(old_level); \ + } while(0) +#endif /* SYS_ARCH_DEC */ + +#ifndef SYS_ARCH_GET +#define SYS_ARCH_GET(var, ret) do { \ + SYS_ARCH_DECL_PROTECT(old_level); \ + SYS_ARCH_PROTECT(old_level); \ + ret = var; \ + SYS_ARCH_UNPROTECT(old_level); \ + } while(0) +#endif /* SYS_ARCH_GET */ + +#ifndef SYS_ARCH_SET +#define SYS_ARCH_SET(var, val) do { \ + SYS_ARCH_DECL_PROTECT(old_level); \ + SYS_ARCH_PROTECT(old_level); \ + var = val; \ + SYS_ARCH_UNPROTECT(old_level); \ + } while(0) +#endif /* SYS_ARCH_SET */ + + +#ifdef __cplusplus +} +#endif + +#endif /* __LWIP_SYS_H__ */ diff --git a/lib/drivers/lwip/src/include/lwip/tcp.h b/lib/drivers/lwip/src/include/lwip/tcp.h new file mode 100644 index 00000000000..07dcd10e786 --- /dev/null +++ b/lib/drivers/lwip/src/include/lwip/tcp.h @@ -0,0 +1,377 @@ +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ +#ifndef __LWIP_TCP_H__ +#define __LWIP_TCP_H__ + +#include "lwip/opt.h" + +#if LWIP_TCP /* don't build if not configured for use in lwipopts.h */ + +#include "lwip/sys.h" +#include "lwip/mem.h" +#include "lwip/pbuf.h" +#include "lwip/ip.h" +#include "lwip/icmp.h" +#include "lwip/err.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct tcp_pcb; + +/** Function prototype for tcp accept callback functions. Called when a new + * connection can be accepted on a listening pcb. + * + * @param arg Additional argument to pass to the callback function (@see tcp_arg()) + * @param newpcb The new connection pcb + * @param err An error code if there has been an error accepting. + * Only return ERR_ABRT if you have called tcp_abort from within the + * callback function! + */ +typedef err_t (*tcp_accept_fn)(void *arg, struct tcp_pcb *newpcb, err_t err); + +/** Function prototype for tcp receive callback functions. Called when data has + * been received. + * + * @param arg Additional argument to pass to the callback function (@see tcp_arg()) + * @param tpcb The connection pcb which received data + * @param p The received data (or NULL when the connection has been closed!) + * @param err An error code if there has been an error receiving + * Only return ERR_ABRT if you have called tcp_abort from within the + * callback function! + */ +typedef err_t (*tcp_recv_fn)(void *arg, struct tcp_pcb *tpcb, + struct pbuf *p, err_t err); + +/** Function prototype for tcp sent callback functions. Called when sent data has + * been acknowledged by the remote side. Use it to free corresponding resources. + * This also means that the pcb has now space available to send new data. + * + * @param arg Additional argument to pass to the callback function (@see tcp_arg()) + * @param tpcb The connection pcb for which data has been acknowledged + * @param len The amount of bytes acknowledged + * @return ERR_OK: try to send some data by calling tcp_output + * Only return ERR_ABRT if you have called tcp_abort from within the + * callback function! + */ +typedef err_t (*tcp_sent_fn)(void *arg, struct tcp_pcb *tpcb, + u16_t len); + +/** Function prototype for tcp poll callback functions. Called periodically as + * specified by @see tcp_poll. + * + * @param arg Additional argument to pass to the callback function (@see tcp_arg()) + * @param tpcb tcp pcb + * @return ERR_OK: try to send some data by calling tcp_output + * Only return ERR_ABRT if you have called tcp_abort from within the + * callback function! + */ +typedef err_t (*tcp_poll_fn)(void *arg, struct tcp_pcb *tpcb); + +/** Function prototype for tcp error callback functions. Called when the pcb + * receives a RST or is unexpectedly closed for any other reason. + * + * @note The corresponding pcb is already freed when this callback is called! + * + * @param arg Additional argument to pass to the callback function (@see tcp_arg()) + * @param err Error code to indicate why the pcb has been closed + * ERR_ABRT: aborted through tcp_abort or by a TCP timer + * ERR_RST: the connection was reset by the remote host + */ +typedef void (*tcp_err_fn)(void *arg, err_t err); + +/** Function prototype for tcp connected callback functions. Called when a pcb + * is connected to the remote side after initiating a connection attempt by + * calling tcp_connect(). + * + * @param arg Additional argument to pass to the callback function (@see tcp_arg()) + * @param tpcb The connection pcb which is connected + * @param err An unused error code, always ERR_OK currently ;-) TODO! + * Only return ERR_ABRT if you have called tcp_abort from within the + * callback function! + * + * @note When a connection attempt fails, the error callback is currently called! + */ +typedef err_t (*tcp_connected_fn)(void *arg, struct tcp_pcb *tpcb, err_t err); + +enum tcp_state { + CLOSED = 0, + LISTEN = 1, + SYN_SENT = 2, + SYN_RCVD = 3, + ESTABLISHED = 4, + FIN_WAIT_1 = 5, + FIN_WAIT_2 = 6, + CLOSE_WAIT = 7, + CLOSING = 8, + LAST_ACK = 9, + TIME_WAIT = 10 +}; + +#if LWIP_CALLBACK_API + /* Function to call when a listener has been connected. + * @param arg user-supplied argument (tcp_pcb.callback_arg) + * @param pcb a new tcp_pcb that now is connected + * @param err an error argument (TODO: that is current always ERR_OK?) + * @return ERR_OK: accept the new connection, + * any other err_t abortsthe new connection + */ +#define DEF_ACCEPT_CALLBACK tcp_accept_fn accept; +#else /* LWIP_CALLBACK_API */ +#define DEF_ACCEPT_CALLBACK +#endif /* LWIP_CALLBACK_API */ + +/** + * members common to struct tcp_pcb and struct tcp_listen_pcb + */ +#define TCP_PCB_COMMON(type) \ + type *next; /* for the linked list */ \ + enum tcp_state state; /* TCP state */ \ + u8_t prio; \ + void *callback_arg; \ + /* the accept callback for listen- and normal pcbs, if LWIP_CALLBACK_API */ \ + DEF_ACCEPT_CALLBACK \ + /* ports are in host byte order */ \ + u16_t local_port + + +/* the TCP protocol control block */ +struct tcp_pcb { +/** common PCB members */ + IP_PCB; +/** protocol specific PCB members */ + TCP_PCB_COMMON(struct tcp_pcb); + + /* ports are in host byte order */ + u16_t remote_port; + + u8_t flags; +#define TF_ACK_DELAY ((u8_t)0x01U) /* Delayed ACK. */ +#define TF_ACK_NOW ((u8_t)0x02U) /* Immediate ACK. */ +#define TF_INFR ((u8_t)0x04U) /* In fast recovery. */ +#define TF_TIMESTAMP ((u8_t)0x08U) /* Timestamp option enabled */ +#define TF_RXCLOSED ((u8_t)0x10U) /* rx closed by tcp_shutdown */ +#define TF_FIN ((u8_t)0x20U) /* Connection was closed locally (FIN segment enqueued). */ +#define TF_NODELAY ((u8_t)0x40U) /* Disable Nagle algorithm */ +#define TF_NAGLEMEMERR ((u8_t)0x80U) /* nagle enabled, memerr, try to output to prevent delayed ACK to happen */ + + /* the rest of the fields are in host byte order + as we have to do some math with them */ + /* receiver variables */ + u32_t rcv_nxt; /* next seqno expected */ + u16_t rcv_wnd; /* receiver window available */ + u16_t rcv_ann_wnd; /* receiver window to announce */ + u32_t rcv_ann_right_edge; /* announced right edge of window */ + + /* Timers */ + u32_t tmr; + u8_t polltmr, pollinterval; + + /* Retransmission timer. */ + s16_t rtime; + + u16_t mss; /* maximum segment size */ + + /* RTT (round trip time) estimation variables */ + u32_t rttest; /* RTT estimate in 500ms ticks */ + u32_t rtseq; /* sequence number being timed */ + s16_t sa, sv; /* @todo document this */ + + s16_t rto; /* retransmission time-out */ + u8_t nrtx; /* number of retransmissions */ + + /* fast retransmit/recovery */ + u32_t lastack; /* Highest acknowledged seqno. */ + u8_t dupacks; + + /* congestion avoidance/control variables */ + u16_t cwnd; + u16_t ssthresh; + + /* sender variables */ + u32_t snd_nxt; /* next new seqno to be sent */ + u16_t snd_wnd; /* sender window */ + u32_t snd_wl1, snd_wl2; /* Sequence and acknowledgement numbers of last + window update. */ + u32_t snd_lbb; /* Sequence number of next byte to be buffered. */ + + u16_t acked; + + u16_t snd_buf; /* Available buffer space for sending (in bytes). */ +#define TCP_SNDQUEUELEN_OVERFLOW (0xffffU-3) + u16_t snd_queuelen; /* Available buffer space for sending (in tcp_segs). */ + +#if TCP_OVERSIZE + /* Extra bytes available at the end of the last pbuf in unsent. */ + u16_t unsent_oversize; +#endif /* TCP_OVERSIZE */ + + /* These are ordered by sequence number: */ + struct tcp_seg *unsent; /* Unsent (queued) segments. */ + struct tcp_seg *unacked; /* Sent but unacknowledged segments. */ +#if TCP_QUEUE_OOSEQ + struct tcp_seg *ooseq; /* Received out of sequence segments. */ +#endif /* TCP_QUEUE_OOSEQ */ + + struct pbuf *refused_data; /* Data previously received but not yet taken by upper layer */ + +#if LWIP_CALLBACK_API + /* Function to be called when more send buffer space is available. */ + tcp_sent_fn sent; + /* Function to be called when (in-sequence) data has arrived. */ + tcp_recv_fn recv; + /* Function to be called when a connection has been set up. */ + tcp_connected_fn connected; + /* Function which is called periodically. */ + tcp_poll_fn poll; + /* Function to be called whenever a fatal error occurs. */ + tcp_err_fn errf; +#endif /* LWIP_CALLBACK_API */ + +#if LWIP_TCP_TIMESTAMPS + u32_t ts_lastacksent; + u32_t ts_recent; +#endif /* LWIP_TCP_TIMESTAMPS */ + + /* idle time before KEEPALIVE is sent */ + u32_t keep_idle; +#if LWIP_TCP_KEEPALIVE + u32_t keep_intvl; + u32_t keep_cnt; +#endif /* LWIP_TCP_KEEPALIVE */ + + /* Persist timer counter */ + u32_t persist_cnt; + /* Persist timer back-off */ + u8_t persist_backoff; + + /* KEEPALIVE counter */ + u8_t keep_cnt_sent; +}; + +struct tcp_pcb_listen { +/* Common members of all PCB types */ + IP_PCB; +/* Protocol specific PCB members */ + TCP_PCB_COMMON(struct tcp_pcb_listen); + +#if TCP_LISTEN_BACKLOG + u8_t backlog; + u8_t accepts_pending; +#endif /* TCP_LISTEN_BACKLOG */ +}; + +#if LWIP_EVENT_API + +enum lwip_event { + LWIP_EVENT_ACCEPT, + LWIP_EVENT_SENT, + LWIP_EVENT_RECV, + LWIP_EVENT_CONNECTED, + LWIP_EVENT_POLL, + LWIP_EVENT_ERR +}; + +err_t lwip_tcp_event(void *arg, struct tcp_pcb *pcb, + enum lwip_event, + struct pbuf *p, + u16_t size, + err_t err); + +#endif /* LWIP_EVENT_API */ + +/* Application program's interface: */ +struct tcp_pcb * tcp_new (void); + +void tcp_arg (struct tcp_pcb *pcb, void *arg); +void tcp_accept (struct tcp_pcb *pcb, tcp_accept_fn accept); +void tcp_recv (struct tcp_pcb *pcb, tcp_recv_fn recv); +void tcp_sent (struct tcp_pcb *pcb, tcp_sent_fn sent); +void tcp_poll (struct tcp_pcb *pcb, tcp_poll_fn poll, u8_t interval); +void tcp_err (struct tcp_pcb *pcb, tcp_err_fn err); + +#define tcp_mss(pcb) (((pcb)->flags & TF_TIMESTAMP) ? ((pcb)->mss - 12) : (pcb)->mss) +#define tcp_sndbuf(pcb) ((pcb)->snd_buf) +#define tcp_sndqueuelen(pcb) ((pcb)->snd_queuelen) +#define tcp_nagle_disable(pcb) ((pcb)->flags |= TF_NODELAY) +#define tcp_nagle_enable(pcb) ((pcb)->flags &= ~TF_NODELAY) +#define tcp_nagle_disabled(pcb) (((pcb)->flags & TF_NODELAY) != 0) + +#if TCP_LISTEN_BACKLOG +#define tcp_accepted(pcb) do { \ + LWIP_ASSERT("pcb->state == LISTEN (called for wrong pcb?)", pcb->state == LISTEN); \ + (((struct tcp_pcb_listen *)(pcb))->accepts_pending--); } while(0) +#else /* TCP_LISTEN_BACKLOG */ +#define tcp_accepted(pcb) LWIP_ASSERT("pcb->state == LISTEN (called for wrong pcb?)", \ + pcb->state == LISTEN) +#endif /* TCP_LISTEN_BACKLOG */ + +void tcp_recved (struct tcp_pcb *pcb, u16_t len); +err_t tcp_bind (struct tcp_pcb *pcb, ip_addr_t *ipaddr, + u16_t port); +err_t tcp_connect (struct tcp_pcb *pcb, ip_addr_t *ipaddr, + u16_t port, tcp_connected_fn connected); + +struct tcp_pcb * tcp_listen_with_backlog(struct tcp_pcb *pcb, u8_t backlog); +#define tcp_listen(pcb) tcp_listen_with_backlog(pcb, TCP_DEFAULT_LISTEN_BACKLOG) + +void tcp_abort (struct tcp_pcb *pcb); +err_t tcp_close (struct tcp_pcb *pcb); +err_t tcp_shutdown(struct tcp_pcb *pcb, int shut_rx, int shut_tx); + +/* Flags for "apiflags" parameter in tcp_write */ +#define TCP_WRITE_FLAG_COPY 0x01 +#define TCP_WRITE_FLAG_MORE 0x02 + +err_t tcp_write (struct tcp_pcb *pcb, const void *dataptr, u16_t len, + u8_t apiflags); + +void tcp_setprio (struct tcp_pcb *pcb, u8_t prio); + +#define TCP_PRIO_MIN 1 +#define TCP_PRIO_NORMAL 64 +#define TCP_PRIO_MAX 127 + +err_t tcp_output (struct tcp_pcb *pcb); + + +const char* tcp_debug_state_str(enum tcp_state s); + + +#ifdef __cplusplus +} +#endif + +#endif /* LWIP_TCP */ + +#endif /* __LWIP_TCP_H__ */ diff --git a/lib/drivers/lwip/src/include/lwip/tcp_impl.h b/lib/drivers/lwip/src/include/lwip/tcp_impl.h new file mode 100644 index 00000000000..b4feec0da19 --- /dev/null +++ b/lib/drivers/lwip/src/include/lwip/tcp_impl.h @@ -0,0 +1,471 @@ +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ +#ifndef __LWIP_TCP_IMPL_H__ +#define __LWIP_TCP_IMPL_H__ + +#include "lwip/opt.h" + +#if LWIP_TCP /* don't build if not configured for use in lwipopts.h */ + +#include "lwip/tcp.h" +#include "lwip/sys.h" +#include "lwip/mem.h" +#include "lwip/pbuf.h" +#include "lwip/ip.h" +#include "lwip/icmp.h" +#include "lwip/err.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Functions for interfacing with TCP: */ + +/* Lower layer interface to TCP: */ +#define tcp_init() /* Compatibility define, no init needed. */ +void tcp_tmr (void); /* Must be called every + TCP_TMR_INTERVAL + ms. (Typically 250 ms). */ +/* It is also possible to call these two functions at the right + intervals (instead of calling tcp_tmr()). */ +void tcp_slowtmr (void); +void tcp_fasttmr (void); + + +/* Only used by IP to pass a TCP segment to TCP: */ +void tcp_input (struct pbuf *p, struct netif *inp); +/* Used within the TCP code only: */ +struct tcp_pcb * tcp_alloc (u8_t prio); +void tcp_abandon (struct tcp_pcb *pcb, int reset); +err_t tcp_send_empty_ack(struct tcp_pcb *pcb); +void tcp_rexmit (struct tcp_pcb *pcb); +void tcp_rexmit_rto (struct tcp_pcb *pcb); +void tcp_rexmit_fast (struct tcp_pcb *pcb); +u32_t tcp_update_rcv_ann_wnd(struct tcp_pcb *pcb); + +/** + * This is the Nagle algorithm: try to combine user data to send as few TCP + * segments as possible. Only send if + * - no previously transmitted data on the connection remains unacknowledged or + * - the TF_NODELAY flag is set (nagle algorithm turned off for this pcb) or + * - the only unsent segment is at least pcb->mss bytes long (or there is more + * than one unsent segment - with lwIP, this can happen although unsent->len < mss) + * - or if we are in fast-retransmit (TF_INFR) + */ +#define tcp_do_output_nagle(tpcb) ((((tpcb)->unacked == NULL) || \ + ((tpcb)->flags & (TF_NODELAY | TF_INFR)) || \ + (((tpcb)->unsent != NULL) && (((tpcb)->unsent->next != NULL) || \ + ((tpcb)->unsent->len >= (tpcb)->mss))) \ + ) ? 1 : 0) +#define tcp_output_nagle(tpcb) (tcp_do_output_nagle(tpcb) ? tcp_output(tpcb) : ERR_OK) + + +#define TCP_SEQ_LT(a,b) ((s32_t)((a)-(b)) < 0) +#define TCP_SEQ_LEQ(a,b) ((s32_t)((a)-(b)) <= 0) +#define TCP_SEQ_GT(a,b) ((s32_t)((a)-(b)) > 0) +#define TCP_SEQ_GEQ(a,b) ((s32_t)((a)-(b)) >= 0) +/* is b<=a<=c? */ +#if 0 /* see bug #10548 */ +#define TCP_SEQ_BETWEEN(a,b,c) ((c)-(b) >= (a)-(b)) +#endif +#define TCP_SEQ_BETWEEN(a,b,c) (TCP_SEQ_GEQ(a,b) && TCP_SEQ_LEQ(a,c)) +#define TCP_FIN 0x01U +#define TCP_SYN 0x02U +#define TCP_RST 0x04U +#define TCP_PSH 0x08U +#define TCP_ACK 0x10U +#define TCP_URG 0x20U +#define TCP_ECE 0x40U +#define TCP_CWR 0x80U + +#define TCP_FLAGS 0x3fU + +/* Length of the TCP header, excluding options. */ +#define TCP_HLEN 20 + +#ifndef TCP_TMR_INTERVAL +#define TCP_TMR_INTERVAL 250 /* The TCP timer interval in milliseconds. */ +#endif /* TCP_TMR_INTERVAL */ + +#ifndef TCP_FAST_INTERVAL +#define TCP_FAST_INTERVAL TCP_TMR_INTERVAL /* the fine grained timeout in milliseconds */ +#endif /* TCP_FAST_INTERVAL */ + +#ifndef TCP_SLOW_INTERVAL +#define TCP_SLOW_INTERVAL (2*TCP_TMR_INTERVAL) /* the coarse grained timeout in milliseconds */ +#endif /* TCP_SLOW_INTERVAL */ + +#define TCP_FIN_WAIT_TIMEOUT 20000 /* milliseconds */ +#define TCP_SYN_RCVD_TIMEOUT 20000 /* milliseconds */ + +#define TCP_OOSEQ_TIMEOUT 6U /* x RTO */ + +#ifndef TCP_MSL +#define TCP_MSL 60000UL /* The maximum segment lifetime in milliseconds */ +#endif + +/* Keepalive values, compliant with RFC 1122. Don't change this unless you know what you're doing */ +#ifndef TCP_KEEPIDLE_DEFAULT +#define TCP_KEEPIDLE_DEFAULT 7200000UL /* Default KEEPALIVE timer in milliseconds */ +#endif + +#ifndef TCP_KEEPINTVL_DEFAULT +#define TCP_KEEPINTVL_DEFAULT 75000UL /* Default Time between KEEPALIVE probes in milliseconds */ +#endif + +#ifndef TCP_KEEPCNT_DEFAULT +#define TCP_KEEPCNT_DEFAULT 9U /* Default Counter for KEEPALIVE probes */ +#endif + +#define TCP_MAXIDLE TCP_KEEPCNT_DEFAULT * TCP_KEEPINTVL_DEFAULT /* Maximum KEEPALIVE probe time */ + +/* Fields are (of course) in network byte order. + * Some fields are converted to host byte order in tcp_input(). + */ +#ifdef PACK_STRUCT_USE_INCLUDES +# include "arch/bpstruct.h" +#endif +PACK_STRUCT_BEGIN +struct tcp_hdr { + PACK_STRUCT_FIELD(u16_t src); + PACK_STRUCT_FIELD(u16_t dest); + PACK_STRUCT_FIELD(u32_t seqno); + PACK_STRUCT_FIELD(u32_t ackno); + PACK_STRUCT_FIELD(u16_t _hdrlen_rsvd_flags); + PACK_STRUCT_FIELD(u16_t wnd); + PACK_STRUCT_FIELD(u16_t chksum); + PACK_STRUCT_FIELD(u16_t urgp); +} PACK_STRUCT_STRUCT; +PACK_STRUCT_END +#ifdef PACK_STRUCT_USE_INCLUDES +# include "arch/epstruct.h" +#endif + +#define TCPH_OFFSET(phdr) (ntohs((phdr)->_hdrlen_rsvd_flags) >> 8) +#define TCPH_HDRLEN(phdr) (ntohs((phdr)->_hdrlen_rsvd_flags) >> 12) +#define TCPH_FLAGS(phdr) (ntohs((phdr)->_hdrlen_rsvd_flags) & TCP_FLAGS) + +#define TCPH_OFFSET_SET(phdr, offset) (phdr)->_hdrlen_rsvd_flags = htons(((offset) << 8) | TCPH_FLAGS(phdr)) +#define TCPH_HDRLEN_SET(phdr, len) (phdr)->_hdrlen_rsvd_flags = htons(((len) << 12) | TCPH_FLAGS(phdr)) +#define TCPH_FLAGS_SET(phdr, flags) (phdr)->_hdrlen_rsvd_flags = (((phdr)->_hdrlen_rsvd_flags & PP_HTONS((u16_t)(~(u16_t)(TCP_FLAGS)))) | htons(flags)) +#define TCPH_HDRLEN_FLAGS_SET(phdr, len, flags) (phdr)->_hdrlen_rsvd_flags = htons(((len) << 12) | (flags)) + +#define TCPH_SET_FLAG(phdr, flags ) (phdr)->_hdrlen_rsvd_flags = ((phdr)->_hdrlen_rsvd_flags | htons(flags)) +#define TCPH_UNSET_FLAG(phdr, flags) (phdr)->_hdrlen_rsvd_flags = htons(ntohs((phdr)->_hdrlen_rsvd_flags) | (TCPH_FLAGS(phdr) & ~(flags)) ) + +#define TCP_TCPLEN(seg) ((seg)->len + ((TCPH_FLAGS((seg)->tcphdr) & (TCP_FIN | TCP_SYN)) != 0)) + +/** Flags used on input processing, not on pcb->flags +*/ +#define TF_RESET (u8_t)0x08U /* Connection was reset. */ +#define TF_CLOSED (u8_t)0x10U /* Connection was sucessfully closed. */ +#define TF_GOT_FIN (u8_t)0x20U /* Connection was closed by the remote end. */ + + +#if LWIP_EVENT_API + +#define TCP_EVENT_ACCEPT(pcb,err,ret) ret = lwip_tcp_event((pcb)->callback_arg, (pcb),\ + LWIP_EVENT_ACCEPT, NULL, 0, err) +#define TCP_EVENT_SENT(pcb,space,ret) ret = lwip_tcp_event((pcb)->callback_arg, (pcb),\ + LWIP_EVENT_SENT, NULL, space, ERR_OK) +#define TCP_EVENT_RECV(pcb,p,err,ret) ret = lwip_tcp_event((pcb)->callback_arg, (pcb),\ + LWIP_EVENT_RECV, (p), 0, (err)) +#define TCP_EVENT_CLOSED(pcb,ret) ret = lwip_tcp_event((pcb)->callback_arg, (pcb),\ + LWIP_EVENT_RECV, NULL, 0, ERR_OK) +#define TCP_EVENT_CONNECTED(pcb,err,ret) ret = lwip_tcp_event((pcb)->callback_arg, (pcb),\ + LWIP_EVENT_CONNECTED, NULL, 0, (err)) +#define TCP_EVENT_POLL(pcb,ret) ret = lwip_tcp_event((pcb)->callback_arg, (pcb),\ + LWIP_EVENT_POLL, NULL, 0, ERR_OK) +#define TCP_EVENT_ERR(errf,arg,err) lwip_tcp_event((arg), NULL, \ + LWIP_EVENT_ERR, NULL, 0, (err)) + +#else /* LWIP_EVENT_API */ + +#define TCP_EVENT_ACCEPT(pcb,err,ret) \ + do { \ + if((pcb)->accept != NULL) \ + (ret) = (pcb)->accept((pcb)->callback_arg,(pcb),(err)); \ + else (ret) = ERR_ARG; \ + } while (0) + +#define TCP_EVENT_SENT(pcb,space,ret) \ + do { \ + if((pcb)->sent != NULL) \ + (ret) = (pcb)->sent((pcb)->callback_arg,(pcb),(space)); \ + else (ret) = ERR_OK; \ + } while (0) + +#define TCP_EVENT_RECV(pcb,p,err,ret) \ + do { \ + if((pcb)->recv != NULL) { \ + (ret) = (pcb)->recv((pcb)->callback_arg,(pcb),(p),(err));\ + } else { \ + (ret) = tcp_recv_null(NULL, (pcb), (p), (err)); \ + } \ + } while (0) + +#define TCP_EVENT_CLOSED(pcb,ret) \ + do { \ + if(((pcb)->recv != NULL)) { \ + (ret) = (pcb)->recv((pcb)->callback_arg,(pcb),NULL,ERR_OK);\ + } else { \ + (ret) = ERR_OK; \ + } \ + } while (0) + +#define TCP_EVENT_CONNECTED(pcb,err,ret) \ + do { \ + if((pcb)->connected != NULL) \ + (ret) = (pcb)->connected((pcb)->callback_arg,(pcb),(err)); \ + else (ret) = ERR_OK; \ + } while (0) + +#define TCP_EVENT_POLL(pcb,ret) \ + do { \ + if((pcb)->poll != NULL) \ + (ret) = (pcb)->poll((pcb)->callback_arg,(pcb)); \ + else (ret) = ERR_OK; \ + } while (0) + +#define TCP_EVENT_ERR(errf,arg,err) \ + do { \ + if((errf) != NULL) \ + (errf)((arg),(err)); \ + } while (0) + +#endif /* LWIP_EVENT_API */ + +/** Enabled extra-check for TCP_OVERSIZE if LWIP_DEBUG is enabled */ +#if TCP_OVERSIZE && defined(LWIP_DEBUG) +#define TCP_OVERSIZE_DBGCHECK 1 +#else +#define TCP_OVERSIZE_DBGCHECK 0 +#endif + +/** Don't generate checksum on copy if CHECKSUM_GEN_TCP is disabled */ +#define TCP_CHECKSUM_ON_COPY (LWIP_CHECKSUM_ON_COPY && CHECKSUM_GEN_TCP) + +/* This structure represents a TCP segment on the unsent, unacked and ooseq queues */ +struct tcp_seg { + struct tcp_seg *next; /* used when putting segements on a queue */ + struct pbuf *p; /* buffer containing data + TCP header */ + u16_t len; /* the TCP length of this segment */ +#if TCP_OVERSIZE_DBGCHECK + u16_t oversize_left; /* Extra bytes available at the end of the last + pbuf in unsent (used for asserting vs. + tcp_pcb.unsent_oversized only) */ +#endif /* TCP_OVERSIZE_DBGCHECK */ +#if TCP_CHECKSUM_ON_COPY + u16_t chksum; + u8_t chksum_swapped; +#endif /* TCP_CHECKSUM_ON_COPY */ + u8_t flags; +#define TF_SEG_OPTS_MSS (u8_t)0x01U /* Include MSS option. */ +#define TF_SEG_OPTS_TS (u8_t)0x02U /* Include timestamp option. */ +#define TF_SEG_DATA_CHECKSUMMED (u8_t)0x04U /* ALL data (not the header) is + checksummed into 'chksum' */ + struct tcp_hdr *tcphdr; /* the TCP header */ +}; + +#define LWIP_TCP_OPT_LENGTH(flags) \ + (flags & TF_SEG_OPTS_MSS ? 4 : 0) + \ + (flags & TF_SEG_OPTS_TS ? 12 : 0) + +/** This returns a TCP header option for MSS in an u32_t */ +#define TCP_BUILD_MSS_OPTION(x) (x) = PP_HTONL(((u32_t)2 << 24) | \ + ((u32_t)4 << 16) | \ + (((u32_t)TCP_MSS / 256) << 8) | \ + (TCP_MSS & 255)) + +/* Global variables: */ +extern struct tcp_pcb *tcp_input_pcb; +extern u32_t tcp_ticks; + +/* The TCP PCB lists. */ +union tcp_listen_pcbs_t { /* List of all TCP PCBs in LISTEN state. */ + struct tcp_pcb_listen *listen_pcbs; + struct tcp_pcb *pcbs; +}; +extern struct tcp_pcb *tcp_bound_pcbs; +extern union tcp_listen_pcbs_t tcp_listen_pcbs; +extern struct tcp_pcb *tcp_active_pcbs; /* List of all TCP PCBs that are in a + state in which they accept or send + data. */ +extern struct tcp_pcb *tcp_tw_pcbs; /* List of all TCP PCBs in TIME-WAIT. */ + +extern struct tcp_pcb *tcp_tmp_pcb; /* Only used for temporary storage. */ + +/* Axioms about the above lists: + 1) Every TCP PCB that is not CLOSED is in one of the lists. + 2) A PCB is only in one of the lists. + 3) All PCBs in the tcp_listen_pcbs list is in LISTEN state. + 4) All PCBs in the tcp_tw_pcbs list is in TIME-WAIT state. +*/ +/* Define two macros, TCP_REG and TCP_RMV that registers a TCP PCB + with a PCB list or removes a PCB from a list, respectively. */ +#ifndef TCP_DEBUG_PCB_LISTS +#define TCP_DEBUG_PCB_LISTS 0 +#endif +#if TCP_DEBUG_PCB_LISTS +#define TCP_REG(pcbs, npcb) do {\ + LWIP_DEBUGF(TCP_DEBUG, ("TCP_REG %p local port %d\n", (npcb), (npcb)->local_port)); \ + for(tcp_tmp_pcb = *(pcbs); \ + tcp_tmp_pcb != NULL; \ + tcp_tmp_pcb = tcp_tmp_pcb->next) { \ + LWIP_ASSERT("TCP_REG: already registered\n", tcp_tmp_pcb != (npcb)); \ + } \ + LWIP_ASSERT("TCP_REG: pcb->state != CLOSED", ((pcbs) == &tcp_bound_pcbs) || ((npcb)->state != CLOSED)); \ + (npcb)->next = *(pcbs); \ + LWIP_ASSERT("TCP_REG: npcb->next != npcb", (npcb)->next != (npcb)); \ + *(pcbs) = (npcb); \ + LWIP_ASSERT("TCP_RMV: tcp_pcbs sane", tcp_pcbs_sane()); \ + tcp_timer_needed(); \ + } while(0) +#define TCP_RMV(pcbs, npcb) do { \ + LWIP_ASSERT("TCP_RMV: pcbs != NULL", *(pcbs) != NULL); \ + LWIP_DEBUGF(TCP_DEBUG, ("TCP_RMV: removing %p from %p\n", (npcb), *(pcbs))); \ + if(*(pcbs) == (npcb)) { \ + *(pcbs) = (*pcbs)->next; \ + } else for(tcp_tmp_pcb = *(pcbs); tcp_tmp_pcb != NULL; tcp_tmp_pcb = tcp_tmp_pcb->next) { \ + if(tcp_tmp_pcb->next == (npcb)) { \ + tcp_tmp_pcb->next = (npcb)->next; \ + break; \ + } \ + } \ + (npcb)->next = NULL; \ + LWIP_ASSERT("TCP_RMV: tcp_pcbs sane", tcp_pcbs_sane()); \ + LWIP_DEBUGF(TCP_DEBUG, ("TCP_RMV: removed %p from %p\n", (npcb), *(pcbs))); \ + } while(0) + +#else /* LWIP_DEBUG */ + +#define TCP_REG(pcbs, npcb) \ + do { \ + (npcb)->next = *pcbs; \ + *(pcbs) = (npcb); \ + tcp_timer_needed(); \ + } while (0) + +#define TCP_RMV(pcbs, npcb) \ + do { \ + if(*(pcbs) == (npcb)) { \ + (*(pcbs)) = (*pcbs)->next; \ + } \ + else { \ + for(tcp_tmp_pcb = *pcbs; \ + tcp_tmp_pcb != NULL; \ + tcp_tmp_pcb = tcp_tmp_pcb->next) { \ + if(tcp_tmp_pcb->next == (npcb)) { \ + tcp_tmp_pcb->next = (npcb)->next; \ + break; \ + } \ + } \ + } \ + (npcb)->next = NULL; \ + } while(0) + +#endif /* LWIP_DEBUG */ + + +/* Internal functions: */ +struct tcp_pcb *tcp_pcb_copy(struct tcp_pcb *pcb); +void tcp_pcb_purge(struct tcp_pcb *pcb); +void tcp_pcb_remove(struct tcp_pcb **pcblist, struct tcp_pcb *pcb); + +void tcp_segs_free(struct tcp_seg *seg); +void tcp_seg_free(struct tcp_seg *seg); +struct tcp_seg *tcp_seg_copy(struct tcp_seg *seg); + +#define tcp_ack(pcb) \ + do { \ + if((pcb)->flags & TF_ACK_DELAY) { \ + (pcb)->flags &= ~TF_ACK_DELAY; \ + (pcb)->flags |= TF_ACK_NOW; \ + } \ + else { \ + (pcb)->flags |= TF_ACK_DELAY; \ + } \ + } while (0) + +#define tcp_ack_now(pcb) \ + do { \ + (pcb)->flags |= TF_ACK_NOW; \ + } while (0) + +err_t tcp_send_fin(struct tcp_pcb *pcb); +err_t tcp_enqueue_flags(struct tcp_pcb *pcb, u8_t flags); + +void tcp_rexmit_seg(struct tcp_pcb *pcb, struct tcp_seg *seg); + +void tcp_rst(u32_t seqno, u32_t ackno, + ip_addr_t *local_ip, ip_addr_t *remote_ip, + u16_t local_port, u16_t remote_port); + +u32_t tcp_next_iss(void); + +void tcp_keepalive(struct tcp_pcb *pcb); +void tcp_zero_window_probe(struct tcp_pcb *pcb); + +#if TCP_CALCULATE_EFF_SEND_MSS +u16_t tcp_eff_send_mss(u16_t sendmss, ip_addr_t *addr); +#endif /* TCP_CALCULATE_EFF_SEND_MSS */ + +#if LWIP_CALLBACK_API +err_t tcp_recv_null(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err); +#endif /* LWIP_CALLBACK_API */ + +#if TCP_DEBUG || TCP_INPUT_DEBUG || TCP_OUTPUT_DEBUG +void tcp_debug_print(struct tcp_hdr *tcphdr); +void tcp_debug_print_flags(u8_t flags); +void tcp_debug_print_state(enum tcp_state s); +void tcp_debug_print_pcbs(void); +s16_t tcp_pcbs_sane(void); +#else +# define tcp_debug_print(tcphdr) +# define tcp_debug_print_flags(flags) +# define tcp_debug_print_state(s) +# define tcp_debug_print_pcbs() +# define tcp_pcbs_sane() 1 +#endif /* TCP_DEBUG */ + +/** External function (implemented in timers.c), called when TCP detects + * that a timer is needed (i.e. active- or time-wait-pcb found). */ +void tcp_timer_needed(void); + + +#ifdef __cplusplus +} +#endif + +#endif /* LWIP_TCP */ + +#endif /* __LWIP_TCP_H__ */ diff --git a/lib/drivers/lwip/src/include/lwip/tcpip.h b/lib/drivers/lwip/src/include/lwip/tcpip.h new file mode 100644 index 00000000000..995ba8ad007 --- /dev/null +++ b/lib/drivers/lwip/src/include/lwip/tcpip.h @@ -0,0 +1,159 @@ +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ +#ifndef __LWIP_TCPIP_H__ +#define __LWIP_TCPIP_H__ + +#include "lwip/opt.h" + +#if !NO_SYS /* don't build if not configured for use in lwipopts.h */ + +#include "lwip/api_msg.h" +#include "lwip/netifapi.h" +#include "lwip/pbuf.h" +#include "lwip/api.h" +#include "lwip/sys.h" +#include "lwip/timers.h" +#include "lwip/netif.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** Define this to something that triggers a watchdog. This is called from + * tcpip_thread after processing a message. */ +#ifndef LWIP_TCPIP_THREAD_ALIVE +#define LWIP_TCPIP_THREAD_ALIVE() +#endif + +#if LWIP_TCPIP_CORE_LOCKING +/** The global semaphore to lock the stack. */ +extern sys_mutex_t lock_tcpip_core; +#define LOCK_TCPIP_CORE() sys_mutex_lock(&lock_tcpip_core) +#define UNLOCK_TCPIP_CORE() sys_mutex_unlock(&lock_tcpip_core) +#define TCPIP_APIMSG(m) tcpip_apimsg_lock(m) +#define TCPIP_APIMSG_ACK(m) +#define TCPIP_NETIFAPI(m) tcpip_netifapi_lock(m) +#define TCPIP_NETIFAPI_ACK(m) +#else /* LWIP_TCPIP_CORE_LOCKING */ +#define LOCK_TCPIP_CORE() +#define UNLOCK_TCPIP_CORE() +#define TCPIP_APIMSG(m) tcpip_apimsg(m) +#define TCPIP_APIMSG_ACK(m) sys_sem_signal(&m->conn->op_completed) +#define TCPIP_NETIFAPI(m) tcpip_netifapi(m) +#define TCPIP_NETIFAPI_ACK(m) sys_sem_signal(&m->sem) +#endif /* LWIP_TCPIP_CORE_LOCKING */ + +/** Function prototype for the init_done function passed to tcpip_init */ +typedef void (*tcpip_init_done_fn)(void *arg); +/** Function prototype for functions passed to tcpip_callback() */ +typedef void (*tcpip_callback_fn)(void *ctx); + +void tcpip_init(tcpip_init_done_fn tcpip_init_done, void *arg); + +#if LWIP_NETCONN +err_t tcpip_apimsg(struct api_msg *apimsg); +#if LWIP_TCPIP_CORE_LOCKING +err_t tcpip_apimsg_lock(struct api_msg *apimsg); +#endif /* LWIP_TCPIP_CORE_LOCKING */ +#endif /* LWIP_NETCONN */ + +err_t tcpip_input(struct pbuf *p, struct netif *inp); + +#if LWIP_NETIF_API +err_t tcpip_netifapi(struct netifapi_msg *netifapimsg); +#if LWIP_TCPIP_CORE_LOCKING +err_t tcpip_netifapi_lock(struct netifapi_msg *netifapimsg); +#endif /* LWIP_TCPIP_CORE_LOCKING */ +#endif /* LWIP_NETIF_API */ + +err_t tcpip_callback_with_block(tcpip_callback_fn function, void *ctx, u8_t block); +#define tcpip_callback(f, ctx) tcpip_callback_with_block(f, ctx, 1) + +/* free pbufs or heap memory from another context without blocking */ +err_t pbuf_free_callback(struct pbuf *p); +err_t mem_free_callback(void *m); + +#if LWIP_TCPIP_TIMEOUT +err_t tcpip_timeout(u32_t msecs, sys_timeout_handler h, void *arg); +err_t tcpip_untimeout(sys_timeout_handler h, void *arg); +#endif /* LWIP_TCPIP_TIMEOUT */ + +enum tcpip_msg_type { +#if LWIP_NETCONN + TCPIP_MSG_API, +#endif /* LWIP_NETCONN */ + TCPIP_MSG_INPKT, +#if LWIP_NETIF_API + TCPIP_MSG_NETIFAPI, +#endif /* LWIP_NETIF_API */ +#if LWIP_TCPIP_TIMEOUT + TCPIP_MSG_TIMEOUT, + TCPIP_MSG_UNTIMEOUT, +#endif /* LWIP_TCPIP_TIMEOUT */ + TCPIP_MSG_CALLBACK +}; + +struct tcpip_msg { + enum tcpip_msg_type type; + sys_sem_t *sem; + union { +#if LWIP_NETCONN + struct api_msg *apimsg; +#endif /* LWIP_NETCONN */ +#if LWIP_NETIF_API + struct netifapi_msg *netifapimsg; +#endif /* LWIP_NETIF_API */ + struct { + struct pbuf *p; + struct netif *netif; + } inp; + struct { + tcpip_callback_fn function; + void *ctx; + } cb; +#if LWIP_TCPIP_TIMEOUT + struct { + u32_t msecs; + sys_timeout_handler h; + void *arg; + } tmo; +#endif /* LWIP_TCPIP_TIMEOUT */ + } msg; +}; + +#ifdef __cplusplus +} +#endif + +#endif /* !NO_SYS */ + +#endif /* __LWIP_TCPIP_H__ */ diff --git a/lib/drivers/lwip/src/include/lwip/timers.h b/lib/drivers/lwip/src/include/lwip/timers.h new file mode 100644 index 00000000000..fb92b4b47c5 --- /dev/null +++ b/lib/drivers/lwip/src/include/lwip/timers.h @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * Simon Goldschmidt + * + */ +#ifndef __LWIP_TIMERS_H__ +#define __LWIP_TIMERS_H__ + +#include "lwip/opt.h" + +/* Timers are not supported when NO_SYS==1 and NO_SYS_NO_TIMERS==1 */ +#define LWIP_TIMERS (!NO_SYS || (NO_SYS && !NO_SYS_NO_TIMERS)) + +#if LWIP_TIMERS + +#include "lwip/err.h" +#include "lwip/sys.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef LWIP_DEBUG_TIMERNAMES +#ifdef LWIP_DEBUG +#define LWIP_DEBUG_TIMERNAMES SYS_DEBUG +#else /* LWIP_DEBUG */ +#define LWIP_DEBUG_TIMERNAMES 0 +#endif /* LWIP_DEBUG*/ +#endif + +/** Function prototype for a timeout callback function. Register such a function + * using sys_timeout(). + * + * @param arg Additional argument to pass to the function - set up by sys_timeout() + */ +typedef void (* sys_timeout_handler)(void *arg); + +struct sys_timeo { + struct sys_timeo *next; + u32_t time; + sys_timeout_handler h; + void *arg; +#if LWIP_DEBUG_TIMERNAMES + const char* handler_name; +#endif /* LWIP_DEBUG_TIMERNAMES */ +}; + +void sys_timeouts_init(void); + +#if LWIP_DEBUG_TIMERNAMES +void sys_timeout_debug(u32_t msecs, sys_timeout_handler handler, void *arg, const char* handler_name); +#define sys_timeout(msecs, handler, arg) sys_timeout_debug(msecs, handler, arg, #handler) +#else /* LWIP_DEBUG_TIMERNAMES */ +void sys_timeout(u32_t msecs, sys_timeout_handler handler, void *arg); +#endif /* LWIP_DEBUG_TIMERNAMES */ + +void sys_untimeout(sys_timeout_handler handler, void *arg); +#if NO_SYS +void sys_check_timeouts(void); +void sys_restart_timeouts(void); +#else /* NO_SYS */ +void sys_timeouts_mbox_fetch(sys_mbox_t *mbox, void **msg); +#endif /* NO_SYS */ + + +#ifdef __cplusplus +} +#endif + +#endif /* LWIP_TIMERS */ +#endif /* __LWIP_TIMERS_H__ */ diff --git a/lib/drivers/lwip/src/include/lwip/udp.h b/lib/drivers/lwip/src/include/lwip/udp.h new file mode 100644 index 00000000000..c98c1b3ec14 --- /dev/null +++ b/lib/drivers/lwip/src/include/lwip/udp.h @@ -0,0 +1,171 @@ +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ +#ifndef __LWIP_UDP_H__ +#define __LWIP_UDP_H__ + +#include "lwip/opt.h" + +#if LWIP_UDP /* don't build if not configured for use in lwipopts.h */ + +#include "lwip/pbuf.h" +#include "lwip/netif.h" +#include "lwip/ip_addr.h" +#include "lwip/ip.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define UDP_HLEN 8 + +/* Fields are (of course) in network byte order. */ +#ifdef PACK_STRUCT_USE_INCLUDES +# include "arch/bpstruct.h" +#endif +PACK_STRUCT_BEGIN +struct udp_hdr { + PACK_STRUCT_FIELD(u16_t src); + PACK_STRUCT_FIELD(u16_t dest); /* src/dest UDP ports */ + PACK_STRUCT_FIELD(u16_t len); + PACK_STRUCT_FIELD(u16_t chksum); +} PACK_STRUCT_STRUCT; +PACK_STRUCT_END +#ifdef PACK_STRUCT_USE_INCLUDES +# include "arch/epstruct.h" +#endif + +#define UDP_FLAGS_NOCHKSUM 0x01U +#define UDP_FLAGS_UDPLITE 0x02U +#define UDP_FLAGS_CONNECTED 0x04U +#define UDP_FLAGS_MULTICAST_LOOP 0x08U + +struct udp_pcb; + +/** Function prototype for udp pcb receive callback functions + * addr and port are in same byte order as in the pcb + * The callback is responsible for freeing the pbuf + * if it's not used any more. + * + * ATTENTION: Be aware that 'addr' points into the pbuf 'p' so freeing this pbuf + * makes 'addr' invalid, too. + * + * @param arg user supplied argument (udp_pcb.recv_arg) + * @param pcb the udp_pcb which received data + * @param p the packet buffer that was received + * @param addr the remote IP address from which the packet was received + * @param port the remote port from which the packet was received + */ +typedef void (*udp_recv_fn)(void *arg, struct udp_pcb *pcb, struct pbuf *p, + ip_addr_t *addr, u16_t port); + + +struct udp_pcb { +/* Common members of all PCB types */ + IP_PCB; + +/* Protocol specific PCB members */ + + struct udp_pcb *next; + + u8_t flags; + /** ports are in host byte order */ + u16_t local_port, remote_port; + +#if LWIP_IGMP + /** outgoing network interface for multicast packets */ + ip_addr_t multicast_ip; +#endif /* LWIP_IGMP */ + +#if LWIP_UDPLITE + /** used for UDP_LITE only */ + u16_t chksum_len_rx, chksum_len_tx; +#endif /* LWIP_UDPLITE */ + + /** receive callback function */ + udp_recv_fn recv; + /** user-supplied argument for the recv callback */ + void *recv_arg; +}; +/* udp_pcbs export for exernal reference (e.g. SNMP agent) */ +extern struct udp_pcb *udp_pcbs; + +/* The following functions is the application layer interface to the + UDP code. */ +struct udp_pcb * udp_new (void); +void udp_remove (struct udp_pcb *pcb); +err_t udp_bind (struct udp_pcb *pcb, ip_addr_t *ipaddr, + u16_t port); +err_t udp_connect (struct udp_pcb *pcb, ip_addr_t *ipaddr, + u16_t port); +void udp_disconnect (struct udp_pcb *pcb); +void udp_recv (struct udp_pcb *pcb, udp_recv_fn recv, + void *recv_arg); +err_t udp_sendto_if (struct udp_pcb *pcb, struct pbuf *p, + ip_addr_t *dst_ip, u16_t dst_port, + struct netif *netif); +err_t udp_sendto (struct udp_pcb *pcb, struct pbuf *p, + ip_addr_t *dst_ip, u16_t dst_port); +err_t udp_send (struct udp_pcb *pcb, struct pbuf *p); + +#if LWIP_CHECKSUM_ON_COPY +err_t udp_sendto_if_chksum(struct udp_pcb *pcb, struct pbuf *p, + ip_addr_t *dst_ip, u16_t dst_port, + struct netif *netif, u8_t have_chksum, + u16_t chksum); +err_t udp_sendto_chksum(struct udp_pcb *pcb, struct pbuf *p, + ip_addr_t *dst_ip, u16_t dst_port, + u8_t have_chksum, u16_t chksum); +err_t udp_send_chksum(struct udp_pcb *pcb, struct pbuf *p, + u8_t have_chksum, u16_t chksum); +#endif /* LWIP_CHECKSUM_ON_COPY */ + +#define udp_flags(pcb) ((pcb)->flags) +#define udp_setflags(pcb, f) ((pcb)->flags = (f)) + +/* The following functions are the lower layer interface to UDP. */ +void udp_input (struct pbuf *p, struct netif *inp); + +#define udp_init() /* Compatibility define, not init needed. */ + +#if UDP_DEBUG +void udp_debug_print(struct udp_hdr *udphdr); +#else +#define udp_debug_print(udphdr) +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* LWIP_UDP */ + +#endif /* __LWIP_UDP_H__ */ diff --git a/lib/drivers/lwip/src/include/lwipopts.h b/lib/drivers/lwip/src/include/lwipopts.h new file mode 100755 index 00000000000..56f9c93ca15 --- /dev/null +++ b/lib/drivers/lwip/src/include/lwipopts.h @@ -0,0 +1,202 @@ +/* + ------------------------------------ + ---------- Memory options ---------- + ------------------------------------ +*/ + +/* This combo allows us to implement malloc, free, and realloc ourselves */ +#define MEM_LIBC_MALLOC 1 +#define MEMP_MEM_MALLOC 1 + +/* Define LWIP_COMPAT_MUTEX if the port has no mutexes and binary semaphores + should be used instead */ +#define LWIP_COMPAT_MUTEX 1 + +#define MEM_ALIGNMENT 4 + +#define LWIP_ARP 0 + +#define ARP_QUEUEING 0 + +#define ETH_PAD_SIZE 2 + +#define IP_FORWARD 0 + +#define IP_REASS_MAX_PBUFS 0xFFFFFFFF + +#define IP_DEFAULT_TTL 128 + +#define IP_SOF_BROADCAST 1 + +#define IP_SOF_BROADCAST_RECV 1 + +#define LWIP_ICMP 0 + +#define LWIP_RAW 0 + +#define LWIP_DHCP 0 + +#define LWIP_AUTOIP 0 + +#define LWIP_SNMP 0 + +#define LWIP_IGMP 0 + +#define LWIP_DNS 0 + +#define LWIP_UDP 0 + +#define LWIP_UDPLITE 0 + +#define LWIP_TCP 1 + +#define TCP_QUEUE_OOSEQ 1 + +/* FIXME: These MSS and TCP Window definitions assume an MTU + * of 1500. We need to add some code to lwIP which would allow us + * to change these values based upon the interface we are + * using. Currently ReactOS only supports Ethernet so we're + * fine for now but it does need to be fixed later when we + * add support for other transport mediums */ +#define TCP_MSS 1460 + +#define TCP_WND (TCP_MSS * 6) + +#define TCP_SND_BUF TCP_WND + +#define TCP_MAXRTX 8 + +#define TCP_SYNMAXRTX 4 + +#define TCP_LISTEN_BACKLOG 1 + +#define LWIP_TCP_TIMESTAMPS 1 + +#define LWIP_CALLBACK_API 1 + +#define LWIP_NETIF_API 1 + +#define LWIP_SOCKET 0 + +#define LWIP_NETCONN 0 + +#define LWIP_NETIF_HWADDRHINT 0 + +#define LWIP_STATS 0 + +#define ICMP_STATS 0 + +#define PPP_SUPPORT 0 + +#define PPPOE_SUPPORT 0 + +#define PPPOS_SUPPORT 0 + +/* + --------------------------------------- + ---------- Debugging options ---------- + --------------------------------------- +*/ +/** + * LWIP_DBG_MIN_LEVEL: After masking, the value of the debug is + * compared against this value. If it is smaller, then debugging + * messages are written. + */ +#define LWIP_DBG_MIN_LEVEL LWIP_DBG_LEVEL_ALL + +/** + * LWIP_DBG_TYPES_ON: A mask that can be used to globally enable/disable + * debug messages of certain types. + */ +#define LWIP_DBG_TYPES_ON LWIP_DBG_ON + +/** + * NETIF_DEBUG: Enable debugging in netif.c. + */ +#define NETIF_DEBUG LWIP_DBG_OFF + +/** + * PBUF_DEBUG: Enable debugging in pbuf.c. + */ +#define PBUF_DEBUG LWIP_DBG_OFF + +/** + * INET_DEBUG: Enable debugging in inet.c. + */ +#define INET_DEBUG LWIP_DBG_OFF + +/** + * IP_DEBUG: Enable debugging for IP. + */ +#define IP_DEBUG LWIP_DBG_OFF + +/** + * IP_REASS_DEBUG: Enable debugging in ip_frag.c for both frag & reass. + */ +#define IP_REASS_DEBUG LWIP_DBG_OFF + +/** + * MEM_DEBUG: Enable debugging in mem.c. + */ +#define MEM_DEBUG LWIP_DBG_OFF + +/** + * MEMP_DEBUG: Enable debugging in memp.c. + */ +#define MEMP_DEBUG LWIP_DBG_OFF + +/** + * SYS_DEBUG: Enable debugging in sys.c. + */ +#define SYS_DEBUG LWIP_DBG_OFF + +/** + * TCP_DEBUG: Enable debugging for TCP. + */ +#define TCP_DEBUG LWIP_DBG_ON + +/** + * TCP_INPUT_DEBUG: Enable debugging in tcp_in.c for incoming debug. + */ +#define TCP_INPUT_DEBUG LWIP_DBG_OFF + +/** + * TCP_FR_DEBUG: Enable debugging in tcp_in.c for fast retransmit. + */ +#define TCP_FR_DEBUG LWIP_DBG_OFF + +/** + * TCP_RTO_DEBUG: Enable debugging in TCP for retransmit + * timeout. + */ +#define TCP_RTO_DEBUG LWIP_DBG_OFF + +/** + * TCP_CWND_DEBUG: Enable debugging for TCP congestion window. + */ +#define TCP_CWND_DEBUG LWIP_DBG_OFF + +/** + * TCP_WND_DEBUG: Enable debugging in tcp_in.c for window updating. + */ +#define TCP_WND_DEBUG LWIP_DBG_OFF + +/** + * TCP_OUTPUT_DEBUG: Enable debugging in tcp_out.c output functions. + */ +#define TCP_OUTPUT_DEBUG LWIP_DBG_OFF + +/** + * TCP_RST_DEBUG: Enable debugging for TCP with the RST message. + */ +#define TCP_RST_DEBUG LWIP_DBG_OFF + +/** + * TCP_QLEN_DEBUG: Enable debugging for TCP queue lengths. + */ +#define TCP_QLEN_DEBUG LWIP_DBG_OFF + +/** + * TCPIP_DEBUG: Enable debugging in tcpip.c. + */ +#define TCPIP_DEBUG LWIP_DBG_OFF \ No newline at end of file diff --git a/lib/drivers/lwip/src/include/netif/etharp.h b/lib/drivers/lwip/src/include/netif/etharp.h new file mode 100644 index 00000000000..691575fa130 --- /dev/null +++ b/lib/drivers/lwip/src/include/netif/etharp.h @@ -0,0 +1,221 @@ +/* + * Copyright (c) 2001-2003 Swedish Institute of Computer Science. + * Copyright (c) 2003-2004 Leon Woestenberg + * Copyright (c) 2003-2004 Axon Digital Design B.V., The Netherlands. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ + +#ifndef __NETIF_ETHARP_H__ +#define __NETIF_ETHARP_H__ + +#include "lwip/opt.h" + +#if LWIP_ARP || LWIP_ETHERNET /* don't build if not configured for use in lwipopts.h */ + +#include "lwip/pbuf.h" +#include "lwip/ip_addr.h" +#include "lwip/netif.h" +#include "lwip/ip.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef ETHARP_HWADDR_LEN +#define ETHARP_HWADDR_LEN 6 +#endif + +#ifdef PACK_STRUCT_USE_INCLUDES +# include "arch/bpstruct.h" +#endif +PACK_STRUCT_BEGIN +struct eth_addr { + PACK_STRUCT_FIELD(u8_t addr[ETHARP_HWADDR_LEN]); +} PACK_STRUCT_STRUCT; +PACK_STRUCT_END +#ifdef PACK_STRUCT_USE_INCLUDES +# include "arch/epstruct.h" +#endif + +#ifdef PACK_STRUCT_USE_INCLUDES +# include "arch/bpstruct.h" +#endif +PACK_STRUCT_BEGIN +/** Ethernet header */ +struct eth_hdr { +#if ETH_PAD_SIZE + PACK_STRUCT_FIELD(u8_t padding[ETH_PAD_SIZE]); +#endif + PACK_STRUCT_FIELD(struct eth_addr dest); + PACK_STRUCT_FIELD(struct eth_addr src); + PACK_STRUCT_FIELD(u16_t type); +} PACK_STRUCT_STRUCT; +PACK_STRUCT_END +#ifdef PACK_STRUCT_USE_INCLUDES +# include "arch/epstruct.h" +#endif + +#define SIZEOF_ETH_HDR (14 + ETH_PAD_SIZE) + +#if ETHARP_SUPPORT_VLAN + +#ifdef PACK_STRUCT_USE_INCLUDES +# include "arch/bpstruct.h" +#endif +PACK_STRUCT_BEGIN +/** VLAN header inserted between ethernet header and payload + * if 'type' in ethernet header is ETHTYPE_VLAN. + * See IEEE802.Q */ +struct eth_vlan_hdr { + PACK_STRUCT_FIELD(u16_t prio_vid); + PACK_STRUCT_FIELD(u16_t tpid); +} PACK_STRUCT_STRUCT; +PACK_STRUCT_END +#ifdef PACK_STRUCT_USE_INCLUDES +# include "arch/epstruct.h" +#endif + +#define SIZEOF_VLAN_HDR 4 +#define VLAN_ID(vlan_hdr) (htons((vlan_hdr)->prio_vid) & 0xFFF) + +#endif /* ETHARP_SUPPORT_VLAN */ + +#ifdef PACK_STRUCT_USE_INCLUDES +# include "arch/bpstruct.h" +#endif +PACK_STRUCT_BEGIN +/** the ARP message, see RFC 826 ("Packet format") */ +struct etharp_hdr { + PACK_STRUCT_FIELD(u16_t hwtype); + PACK_STRUCT_FIELD(u16_t proto); + PACK_STRUCT_FIELD(u8_t hwlen); + PACK_STRUCT_FIELD(u8_t protolen); + PACK_STRUCT_FIELD(u16_t opcode); + PACK_STRUCT_FIELD(struct eth_addr shwaddr); + PACK_STRUCT_FIELD(struct ip_addr2 sipaddr); + PACK_STRUCT_FIELD(struct eth_addr dhwaddr); + PACK_STRUCT_FIELD(struct ip_addr2 dipaddr); +} PACK_STRUCT_STRUCT; +PACK_STRUCT_END +#ifdef PACK_STRUCT_USE_INCLUDES +# include "arch/epstruct.h" +#endif + +#define SIZEOF_ETHARP_HDR 28 +#define SIZEOF_ETHARP_PACKET (SIZEOF_ETH_HDR + SIZEOF_ETHARP_HDR) + +/** 5 seconds period */ +#define ARP_TMR_INTERVAL 5000 + +#define ETHTYPE_ARP 0x0806U +#define ETHTYPE_IP 0x0800U +#define ETHTYPE_VLAN 0x8100U +#define ETHTYPE_PPPOEDISC 0x8863U /* PPP Over Ethernet Discovery Stage */ +#define ETHTYPE_PPPOE 0x8864U /* PPP Over Ethernet Session Stage */ + +/** MEMCPY-like macro to copy to/from struct eth_addr's that are local variables + * or known to be 32-bit aligned within the protocol header. */ +#ifndef ETHADDR32_COPY +#define ETHADDR32_COPY(src, dst) SMEMCPY(src, dst, ETHARP_HWADDR_LEN) +#endif + +/** MEMCPY-like macro to copy to/from struct eth_addr's that are no local + * variables and known to be 16-bit aligned within the protocol header. */ +#ifndef ETHADDR16_COPY +#define ETHADDR16_COPY(src, dst) SMEMCPY(src, dst, ETHARP_HWADDR_LEN) +#endif + +#if LWIP_ARP /* don't build if not configured for use in lwipopts.h */ + +/** ARP message types (opcodes) */ +#define ARP_REQUEST 1 +#define ARP_REPLY 2 + +/** Define this to 1 and define LWIP_ARP_FILTER_NETIF_FN(pbuf, netif, type) + * to a filter function that returns the correct netif when using multiple + * netifs on one hardware interface where the netif's low-level receive + * routine cannot decide for the correct netif (e.g. when mapping multiple + * IP addresses to one hardware interface). + */ +#ifndef LWIP_ARP_FILTER_NETIF +#define LWIP_ARP_FILTER_NETIF 0 +#endif + +#if ARP_QUEUEING +/** struct for queueing outgoing packets for unknown address + * defined here to be accessed by memp.h + */ +struct etharp_q_entry { + struct etharp_q_entry *next; + struct pbuf *p; +}; +#endif /* ARP_QUEUEING */ + +#define etharp_init() /* Compatibility define, not init needed. */ +void etharp_tmr(void); +s8_t etharp_find_addr(struct netif *netif, ip_addr_t *ipaddr, + struct eth_addr **eth_ret, ip_addr_t **ip_ret); +err_t etharp_output(struct netif *netif, struct pbuf *q, ip_addr_t *ipaddr); +err_t etharp_query(struct netif *netif, ip_addr_t *ipaddr, struct pbuf *q); +err_t etharp_request(struct netif *netif, ip_addr_t *ipaddr); +/** For Ethernet network interfaces, we might want to send "gratuitous ARP"; + * this is an ARP packet sent by a node in order to spontaneously cause other + * nodes to update an entry in their ARP cache. + * From RFC 3220 "IP Mobility Support for IPv4" section 4.6. */ +#define etharp_gratuitous(netif) etharp_request((netif), &(netif)->ip_addr) + +#if ETHARP_SUPPORT_STATIC_ENTRIES +err_t etharp_add_static_entry(ip_addr_t *ipaddr, struct eth_addr *ethaddr); +err_t etharp_remove_static_entry(ip_addr_t *ipaddr); +#endif /* ETHARP_SUPPORT_STATIC_ENTRIES */ + +#if LWIP_AUTOIP +err_t etharp_raw(struct netif *netif, const struct eth_addr *ethsrc_addr, + const struct eth_addr *ethdst_addr, + const struct eth_addr *hwsrc_addr, const ip_addr_t *ipsrc_addr, + const struct eth_addr *hwdst_addr, const ip_addr_t *ipdst_addr, + const u16_t opcode); +#endif /* LWIP_AUTOIP */ + +#endif /* LWIP_ARP */ + +err_t ethernet_input(struct pbuf *p, struct netif *netif); + +#define eth_addr_cmp(addr1, addr2) (memcmp((addr1)->addr, (addr2)->addr, ETHARP_HWADDR_LEN) == 0) + +extern const struct eth_addr ethbroadcast, ethzero; + +#endif /* LWIP_ARP || LWIP_ETHERNET */ + +#ifdef __cplusplus +} +#endif + +#endif /* __NETIF_ARP_H__ */ diff --git a/lib/drivers/lwip/src/include/netif/loopif.h b/lib/drivers/lwip/src/include/netif/loopif.h new file mode 100644 index 00000000000..304af4b39ab --- /dev/null +++ b/lib/drivers/lwip/src/include/netif/loopif.h @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ +#ifndef __NETIF_LOOPIF_H__ +#define __NETIF_LOOPIF_H__ + +#include "lwip/opt.h" +#include "lwip/netif.h" +#include "lwip/err.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#if !LWIP_NETIF_LOOPBACK_MULTITHREADING +#define loopif_poll netif_poll +#endif /* !LWIP_NETIF_LOOPBACK_MULTITHREADING */ + +err_t loopif_init(struct netif *netif); + +#ifdef __cplusplus +} +#endif + +#endif /* __NETIF_LOOPIF_H__ */ diff --git a/lib/drivers/lwip/src/include/netif/ppp_oe.h b/lib/drivers/lwip/src/include/netif/ppp_oe.h new file mode 100644 index 00000000000..e1cdfa51991 --- /dev/null +++ b/lib/drivers/lwip/src/include/netif/ppp_oe.h @@ -0,0 +1,190 @@ +/***************************************************************************** +* ppp_oe.h - PPP Over Ethernet implementation for lwIP. +* +* Copyright (c) 2006 by Marc Boucher, Services Informatiques (MBSI) inc. +* +* The authors hereby grant permission to use, copy, modify, distribute, +* and license this software and its documentation for any purpose, provided +* that existing copyright notices are retained in all copies and that this +* notice and the following disclaimer are included verbatim in any +* distributions. No written agreement, license, or royalty fee is required +* for any of the authorized uses. +* +* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +* IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +****************************************************************************** +* REVISION HISTORY +* +* 06-01-01 Marc Boucher +* Ported to lwIP. +*****************************************************************************/ + + + +/* based on NetBSD: if_pppoe.c,v 1.64 2006/01/31 23:50:15 martin Exp */ + +/*- + * Copyright (c) 2002 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Martin Husemann . + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef PPP_OE_H +#define PPP_OE_H + +#include "lwip/opt.h" + +#if PPPOE_SUPPORT > 0 + +#include "netif/etharp.h" + +#ifdef PACK_STRUCT_USE_INCLUDES +# include "arch/bpstruct.h" +#endif +PACK_STRUCT_BEGIN +struct pppoehdr { + PACK_STRUCT_FIELD(u8_t vertype); + PACK_STRUCT_FIELD(u8_t code); + PACK_STRUCT_FIELD(u16_t session); + PACK_STRUCT_FIELD(u16_t plen); +} PACK_STRUCT_STRUCT; +PACK_STRUCT_END +#ifdef PACK_STRUCT_USE_INCLUDES +# include "arch/epstruct.h" +#endif + +#ifdef PACK_STRUCT_USE_INCLUDES +# include "arch/bpstruct.h" +#endif +PACK_STRUCT_BEGIN +struct pppoetag { + PACK_STRUCT_FIELD(u16_t tag); + PACK_STRUCT_FIELD(u16_t len); +} PACK_STRUCT_STRUCT; +PACK_STRUCT_END +#ifdef PACK_STRUCT_USE_INCLUDES +# include "arch/epstruct.h" +#endif + + +#define PPPOE_STATE_INITIAL 0 +#define PPPOE_STATE_PADI_SENT 1 +#define PPPOE_STATE_PADR_SENT 2 +#define PPPOE_STATE_SESSION 3 +#define PPPOE_STATE_CLOSING 4 +/* passive */ +#define PPPOE_STATE_PADO_SENT 1 + +#define PPPOE_HEADERLEN sizeof(struct pppoehdr) +#define PPPOE_VERTYPE 0x11 /* VER=1, TYPE = 1 */ + +#define PPPOE_TAG_EOL 0x0000 /* end of list */ +#define PPPOE_TAG_SNAME 0x0101 /* service name */ +#define PPPOE_TAG_ACNAME 0x0102 /* access concentrator name */ +#define PPPOE_TAG_HUNIQUE 0x0103 /* host unique */ +#define PPPOE_TAG_ACCOOKIE 0x0104 /* AC cookie */ +#define PPPOE_TAG_VENDOR 0x0105 /* vendor specific */ +#define PPPOE_TAG_RELAYSID 0x0110 /* relay session id */ +#define PPPOE_TAG_SNAME_ERR 0x0201 /* service name error */ +#define PPPOE_TAG_ACSYS_ERR 0x0202 /* AC system error */ +#define PPPOE_TAG_GENERIC_ERR 0x0203 /* gerneric error */ + +#define PPPOE_CODE_PADI 0x09 /* Active Discovery Initiation */ +#define PPPOE_CODE_PADO 0x07 /* Active Discovery Offer */ +#define PPPOE_CODE_PADR 0x19 /* Active Discovery Request */ +#define PPPOE_CODE_PADS 0x65 /* Active Discovery Session confirmation */ +#define PPPOE_CODE_PADT 0xA7 /* Active Discovery Terminate */ + +#ifndef ETHERMTU +#define ETHERMTU 1500 +#endif + +/* two byte PPP protocol discriminator, then IP data */ +#define PPPOE_MAXMTU (ETHERMTU-PPPOE_HEADERLEN-2) + +#ifndef PPPOE_MAX_AC_COOKIE_LEN +#define PPPOE_MAX_AC_COOKIE_LEN 64 +#endif + +struct pppoe_softc { + struct pppoe_softc *next; + struct netif *sc_ethif; /* ethernet interface we are using */ + int sc_pd; /* ppp unit number */ + void (*sc_linkStatusCB)(int pd, int up); + + int sc_state; /* discovery phase or session connected */ + struct eth_addr sc_dest; /* hardware address of concentrator */ + u16_t sc_session; /* PPPoE session id */ + +#ifdef PPPOE_TODO + char *sc_service_name; /* if != NULL: requested name of service */ + char *sc_concentrator_name; /* if != NULL: requested concentrator id */ +#endif /* PPPOE_TODO */ + u8_t sc_ac_cookie[PPPOE_MAX_AC_COOKIE_LEN]; /* content of AC cookie we must echo back */ + size_t sc_ac_cookie_len; /* length of cookie data */ +#ifdef PPPOE_SERVER + u8_t *sc_hunique; /* content of host unique we must echo back */ + size_t sc_hunique_len; /* length of host unique */ +#endif + int sc_padi_retried; /* number of PADI retries already done */ + int sc_padr_retried; /* number of PADR retries already done */ +}; + + +#define pppoe_init() /* compatibility define, no initialization needed */ + +err_t pppoe_create(struct netif *ethif, int pd, void (*linkStatusCB)(int pd, int up), struct pppoe_softc **scptr); +err_t pppoe_destroy(struct netif *ifp); + +int pppoe_connect(struct pppoe_softc *sc); +void pppoe_disconnect(struct pppoe_softc *sc); + +void pppoe_disc_input(struct netif *netif, struct pbuf *p); +void pppoe_data_input(struct netif *netif, struct pbuf *p); + +err_t pppoe_xmit(struct pppoe_softc *sc, struct pbuf *pb); + +/** used in ppp.c */ +#define PPPOE_HDRLEN (sizeof(struct eth_hdr) + PPPOE_HEADERLEN) + +#endif /* PPPOE_SUPPORT */ + +#endif /* PPP_OE_H */ diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/machine/stdarg.h b/lib/drivers/lwip/src/include/netif/slipif.h similarity index 52% rename from lib/drivers/oskittcp/include/freebsd/src/sys/machine/stdarg.h rename to lib/drivers/lwip/src/include/netif/slipif.h index 3b091f59018..ccd03c8a16b 100644 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/machine/stdarg.h +++ b/lib/drivers/lwip/src/include/netif/slipif.h @@ -1,42 +1,51 @@ -/*- - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. +/* + * Copyright (c) 2001, Swedish Institute of Computer Science. + * All rights reserved. * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels * - * @(#)stdarg.h 8.1 (Berkeley) 6/10/93 */ +#ifndef __NETIF_SLIPIF_H__ +#define __NETIF_SLIPIF_H__ -#ifndef _STDARG_H_ -#define _STDARG_H_ +#include "lwip/netif.h" -/* Use psdk */ -#include +#ifdef __cplusplus +extern "C" { +#endif + +err_t slipif_init(struct netif * netif); +void slipif_poll(struct netif *netif); + +#ifdef __cplusplus +} +#endif + +#endif -#endif /* !_STDARG_H_ */ diff --git a/lib/drivers/lwip/src/include/rosip.h b/lib/drivers/lwip/src/include/rosip.h new file mode 100755 index 00000000000..b5e9b917782 --- /dev/null +++ b/lib/drivers/lwip/src/include/rosip.h @@ -0,0 +1,114 @@ +#ifndef _ROS_IP_H_ +#define _ROS_IP_H_ + +#include "lwip/tcp.h" +#include "lwip/pbuf.h" +#include "lwip/ip_addr.h" +#include "tcpip.h" + +#ifndef LWIP_TAG + #define LWIP_TAG 'PIwl' +#endif + +typedef struct tcp_pcb* PTCP_PCB; + +typedef struct _QUEUE_ENTRY +{ + struct pbuf *p; + LIST_ENTRY ListEntry; +} QUEUE_ENTRY, *PQUEUE_ENTRY; + +struct lwip_callback_msg +{ + /* Synchronization */ + KEVENT Event; + + /* Input */ + union { + struct { + PVOID Arg; + } Socket; + struct { + PCONNECTION_ENDPOINT Connection; + struct ip_addr *IpAddress; + u16_t Port; + } Bind; + struct { + PCONNECTION_ENDPOINT Connection; + u8_t Backlog; + } Listen; + struct { + PCONNECTION_ENDPOINT Connection; + void *Data; + u16_t DataLength; + } Send; + struct { + PCONNECTION_ENDPOINT Connection; + struct ip_addr *IpAddress; + u16_t Port; + } Connect; + struct { + PCONNECTION_ENDPOINT Connection; + int shut_rx; + int shut_tx; + } Shutdown; + struct { + PCONNECTION_ENDPOINT Connection; + int Callback; + } Close; + } Input; + + /* Output */ + union { + struct { + struct tcp_pcb *NewPcb; + } Socket; + struct { + err_t Error; + } Bind; + struct { + struct tcp_pcb *NewPcb; + } Listen; + struct { + err_t Error; + } Send; + struct { + err_t Error; + } Connect; + struct { + err_t Error; + } Shutdown; + struct { + err_t Error; + } Close; + } Output; +}; + +NTSTATUS LibTCPGetDataFromConnectionQueue(PCONNECTION_ENDPOINT Connection, PUCHAR RecvBuffer, UINT RecvLen, UINT *Received); + +/* External TCP event handlers */ +extern void TCPConnectEventHandler(void *arg, const err_t err); +extern void TCPAcceptEventHandler(void *arg, PTCP_PCB newpcb); +extern void TCPSendEventHandler(void *arg, const u16_t space); +extern void TCPFinEventHandler(void *arg, const err_t err); +extern void TCPRecvEventHandler(void *arg); + +/* TCP functions */ +PTCP_PCB LibTCPSocket(void *arg); +err_t LibTCPBind(PCONNECTION_ENDPOINT Connection, struct ip_addr *const ipaddr, const u16_t port); +PTCP_PCB LibTCPListen(PCONNECTION_ENDPOINT Connection, const u8_t backlog); +err_t LibTCPSend(PCONNECTION_ENDPOINT Connection, void *const dataptr, const u16_t len, const int safe); +err_t LibTCPConnect(PCONNECTION_ENDPOINT Connection, struct ip_addr *const ipaddr, const u16_t port); +err_t LibTCPShutdown(PCONNECTION_ENDPOINT Connection, const int shut_rx, const int shut_tx); +err_t LibTCPClose(PCONNECTION_ENDPOINT Connection, const int safe, const int callback); + +err_t LibTCPGetPeerName(PTCP_PCB pcb, struct ip_addr *const ipaddr, u16_t *const port); +err_t LibTCPGetHostName(PTCP_PCB pcb, struct ip_addr *const ipaddr, u16_t *const port); +void LibTCPAccept(PTCP_PCB pcb, struct tcp_pcb *listen_pcb, void *arg); + +/* IP functions */ +void LibIPInsertPacket(void *ifarg, const void *const data, const u32_t size); +void LibIPInitialize(void); +void LibIPShutdown(void); + +#endif \ No newline at end of file diff --git a/lib/drivers/lwip/src/netif/FILES b/lib/drivers/lwip/src/netif/FILES new file mode 100644 index 00000000000..099dbf3ec2b --- /dev/null +++ b/lib/drivers/lwip/src/netif/FILES @@ -0,0 +1,29 @@ +This directory contains generic network interface device drivers that +do not contain any hardware or architecture specific code. The files +are: + +etharp.c + Implements the ARP (Address Resolution Protocol) over + Ethernet. The code in this file should be used together with + Ethernet device drivers. Note that this module has been + largely made Ethernet independent so you should be able to + adapt this for other link layers (such as Firewire). + +ethernetif.c + An example of how an Ethernet device driver could look. This + file can be used as a "skeleton" for developing new Ethernet + network device drivers. It uses the etharp.c ARP code. + +loopif.c + A "loopback" network interface driver. It requires configuration + through the define LWIP_LOOPIF_MULTITHREADING (see opt.h). + +slipif.c + A generic implementation of the SLIP (Serial Line IP) + protocol. It requires a sio (serial I/O) module to work. + +ppp/ Point-to-Point Protocol stack + The PPP stack has been ported from ucip (http://ucip.sourceforge.net). + It matches quite well to pppd 2.3.1 (http://ppp.samba.org), although + compared to that, it has some modifications for embedded systems and + the source code has been reordered a bit. \ No newline at end of file diff --git a/lib/drivers/lwip/src/netif/etharp.c b/lib/drivers/lwip/src/netif/etharp.c new file mode 100644 index 00000000000..b60dadd0244 --- /dev/null +++ b/lib/drivers/lwip/src/netif/etharp.c @@ -0,0 +1,1318 @@ +/** + * @file + * Address Resolution Protocol module for IP over Ethernet + * + * Functionally, ARP is divided into two parts. The first maps an IP address + * to a physical address when sending a packet, and the second part answers + * requests from other machines for our physical address. + * + * This implementation complies with RFC 826 (Ethernet ARP). It supports + * Gratuitious ARP from RFC3220 (IP Mobility Support for IPv4) section 4.6 + * if an interface calls etharp_gratuitous(our_netif) upon address change. + */ + +/* + * Copyright (c) 2001-2003 Swedish Institute of Computer Science. + * Copyright (c) 2003-2004 Leon Woestenberg + * Copyright (c) 2003-2004 Axon Digital Design B.V., The Netherlands. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + */ + +#include "lwip/opt.h" + +#if LWIP_ARP || LWIP_ETHERNET + +#include "lwip/ip_addr.h" +#include "lwip/def.h" +#include "lwip/ip.h" +#include "lwip/stats.h" +#include "lwip/snmp.h" +#include "lwip/dhcp.h" +#include "lwip/autoip.h" +#include "netif/etharp.h" + +#if PPPOE_SUPPORT +#include "netif/ppp_oe.h" +#endif /* PPPOE_SUPPORT */ + +#include + +const struct eth_addr ethbroadcast = {{0xff,0xff,0xff,0xff,0xff,0xff}}; +const struct eth_addr ethzero = {{0,0,0,0,0,0}}; + +#if LWIP_ARP /* don't build if not configured for use in lwipopts.h */ + +/** the time an ARP entry stays valid after its last update, + * for ARP_TMR_INTERVAL = 5000, this is + * (240 * 5) seconds = 20 minutes. + */ +#define ARP_MAXAGE 240 +/** the time an ARP entry stays pending after first request, + * for ARP_TMR_INTERVAL = 5000, this is + * (2 * 5) seconds = 10 seconds. + * + * @internal Keep this number at least 2, otherwise it might + * run out instantly if the timeout occurs directly after a request. + */ +#define ARP_MAXPENDING 2 + +#define HWTYPE_ETHERNET 1 + +enum etharp_state { + ETHARP_STATE_EMPTY = 0, + ETHARP_STATE_PENDING, + ETHARP_STATE_STABLE +}; + +struct etharp_entry { +#if ARP_QUEUEING + /** Pointer to queue of pending outgoing packets on this ARP entry. */ + struct etharp_q_entry *q; +#else /* ARP_QUEUEING */ + /** Pointer to a single pending outgoing packet on this ARP entry. */ + struct pbuf *q; +#endif /* ARP_QUEUEING */ + ip_addr_t ipaddr; + struct eth_addr ethaddr; +#if LWIP_SNMP + struct netif *netif; +#endif /* LWIP_SNMP */ + u8_t state; + u8_t ctime; +#if ETHARP_SUPPORT_STATIC_ENTRIES + u8_t static_entry; +#endif /* ETHARP_SUPPORT_STATIC_ENTRIES */ +}; + +static struct etharp_entry arp_table[ARP_TABLE_SIZE]; + +#if !LWIP_NETIF_HWADDRHINT +static u8_t etharp_cached_entry; +#endif /* !LWIP_NETIF_HWADDRHINT */ + +/** Try hard to create a new entry - we want the IP address to appear in + the cache (even if this means removing an active entry or so). */ +#define ETHARP_FLAG_TRY_HARD 1 +#define ETHARP_FLAG_FIND_ONLY 2 +#define ETHARP_FLAG_STATIC_ENTRY 4 + +#if LWIP_NETIF_HWADDRHINT +#define ETHARP_SET_HINT(netif, hint) if (((netif) != NULL) && ((netif)->addr_hint != NULL)) \ + *((netif)->addr_hint) = (hint); +#else /* LWIP_NETIF_HWADDRHINT */ +#define ETHARP_SET_HINT(netif, hint) (etharp_cached_entry = (hint)) +#endif /* LWIP_NETIF_HWADDRHINT */ + +static err_t update_arp_entry(struct netif *netif, ip_addr_t *ipaddr, struct eth_addr *ethaddr, u8_t flags); + + +/* Some checks, instead of etharp_init(): */ +#if (LWIP_ARP && (ARP_TABLE_SIZE > 0x7f)) + #error "ARP_TABLE_SIZE must fit in an s8_t, you have to reduce it in your lwipopts.h" +#endif + + +#if ARP_QUEUEING +/** + * Free a complete queue of etharp entries + * + * @param q a qeueue of etharp_q_entry's to free + */ +static void +free_etharp_q(struct etharp_q_entry *q) +{ + struct etharp_q_entry *r; + LWIP_ASSERT("q != NULL", q != NULL); + LWIP_ASSERT("q->p != NULL", q->p != NULL); + while (q) { + r = q; + q = q->next; + LWIP_ASSERT("r->p != NULL", (r->p != NULL)); + pbuf_free(r->p); + memp_free(MEMP_ARP_QUEUE, r); + } +} +#else /* ARP_QUEUEING */ + +/** Compatibility define: free the queued pbuf */ +#define free_etharp_q(q) pbuf_free(q) + +#endif /* ARP_QUEUEING */ + +/** Clean up ARP table entries */ +static void +free_entry(int i) +{ + /* remove from SNMP ARP index tree */ + snmp_delete_arpidx_tree(arp_table[i].netif, &arp_table[i].ipaddr); + /* and empty packet queue */ + if (arp_table[i].q != NULL) { + /* remove all queued packets */ + LWIP_DEBUGF(ETHARP_DEBUG, ("etharp_timer: freeing entry %"U16_F", packet queue %p.\n", (u16_t)i, (void *)(arp_table[i].q))); + free_etharp_q(arp_table[i].q); + arp_table[i].q = NULL; + } + /* recycle entry for re-use */ + arp_table[i].state = ETHARP_STATE_EMPTY; +#if ETHARP_SUPPORT_STATIC_ENTRIES + arp_table[i].static_entry = 0; +#endif /* ETHARP_SUPPORT_STATIC_ENTRIES */ +#ifdef LWIP_DEBUG + /* for debugging, clean out the complete entry */ + arp_table[i].ctime = 0; +#if LWIP_SNMP + arp_table[i].netif = NULL; +#endif /* LWIP_SNMP */ + ip_addr_set_zero(&arp_table[i].ipaddr); + arp_table[i].ethaddr = ethzero; +#endif /* LWIP_DEBUG */ +} + +/** + * Clears expired entries in the ARP table. + * + * This function should be called every ETHARP_TMR_INTERVAL milliseconds (5 seconds), + * in order to expire entries in the ARP table. + */ +void +etharp_tmr(void) +{ + u8_t i; + + LWIP_DEBUGF(ETHARP_DEBUG, ("etharp_timer\n")); + /* remove expired entries from the ARP table */ + for (i = 0; i < ARP_TABLE_SIZE; ++i) { + u8_t state = arp_table[i].state; + if (state != ETHARP_STATE_EMPTY +#if ETHARP_SUPPORT_STATIC_ENTRIES + && (arp_table[i].static_entry == 0) +#endif /* ETHARP_SUPPORT_STATIC_ENTRIES */ + ) { + arp_table[i].ctime++; + if ((arp_table[i].ctime >= ARP_MAXAGE) || + ((arp_table[i].state == ETHARP_STATE_PENDING) && + (arp_table[i].ctime >= ARP_MAXPENDING))) { + /* pending or stable entry has become old! */ + LWIP_DEBUGF(ETHARP_DEBUG, ("etharp_timer: expired %s entry %"U16_F".\n", + arp_table[i].state == ETHARP_STATE_STABLE ? "stable" : "pending", (u16_t)i)); + /* clean up entries that have just been expired */ + free_entry(i); + } +#if ARP_QUEUEING + /* still pending entry? (not expired) */ + if (arp_table[i].state == ETHARP_STATE_PENDING) { + /* resend an ARP query here? */ + } +#endif /* ARP_QUEUEING */ + } + } +} + +/** + * Search the ARP table for a matching or new entry. + * + * If an IP address is given, return a pending or stable ARP entry that matches + * the address. If no match is found, create a new entry with this address set, + * but in state ETHARP_EMPTY. The caller must check and possibly change the + * state of the returned entry. + * + * If ipaddr is NULL, return a initialized new entry in state ETHARP_EMPTY. + * + * In all cases, attempt to create new entries from an empty entry. If no + * empty entries are available and ETHARP_FLAG_TRY_HARD flag is set, recycle + * old entries. Heuristic choose the least important entry for recycling. + * + * @param ipaddr IP address to find in ARP cache, or to add if not found. + * @param flags @see definition of ETHARP_FLAG_* + * @param netif netif related to this address (used for NETIF_HWADDRHINT) + * + * @return The ARP entry index that matched or is created, ERR_MEM if no + * entry is found or could be recycled. + */ +static s8_t +find_entry(ip_addr_t *ipaddr, u8_t flags) +{ + s8_t old_pending = ARP_TABLE_SIZE, old_stable = ARP_TABLE_SIZE; + s8_t empty = ARP_TABLE_SIZE; + u8_t i = 0, age_pending = 0, age_stable = 0; + /* oldest entry with packets on queue */ + s8_t old_queue = ARP_TABLE_SIZE; + /* its age */ + u8_t age_queue = 0; + + /** + * a) do a search through the cache, remember candidates + * b) select candidate entry + * c) create new entry + */ + + /* a) in a single search sweep, do all of this + * 1) remember the first empty entry (if any) + * 2) remember the oldest stable entry (if any) + * 3) remember the oldest pending entry without queued packets (if any) + * 4) remember the oldest pending entry with queued packets (if any) + * 5) search for a matching IP entry, either pending or stable + * until 5 matches, or all entries are searched for. + */ + + for (i = 0; i < ARP_TABLE_SIZE; ++i) { + u8_t state = arp_table[i].state; + /* no empty entry found yet and now we do find one? */ + if ((empty == ARP_TABLE_SIZE) && (state == ETHARP_STATE_EMPTY)) { + LWIP_DEBUGF(ETHARP_DEBUG, ("find_entry: found empty entry %"U16_F"\n", (u16_t)i)); + /* remember first empty entry */ + empty = i; + } else if (state != ETHARP_STATE_EMPTY) { + LWIP_ASSERT("state == ETHARP_STATE_PENDING || state == ETHARP_STATE_STABLE", + state == ETHARP_STATE_PENDING || state == ETHARP_STATE_STABLE); + /* if given, does IP address match IP address in ARP entry? */ + if (ipaddr && ip_addr_cmp(ipaddr, &arp_table[i].ipaddr)) { + LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("find_entry: found matching entry %"U16_F"\n", (u16_t)i)); + /* found exact IP address match, simply bail out */ + return i; + } + /* pending entry? */ + if (state == ETHARP_STATE_PENDING) { + /* pending with queued packets? */ + if (arp_table[i].q != NULL) { + if (arp_table[i].ctime >= age_queue) { + old_queue = i; + age_queue = arp_table[i].ctime; + } + } else + /* pending without queued packets? */ + { + if (arp_table[i].ctime >= age_pending) { + old_pending = i; + age_pending = arp_table[i].ctime; + } + } + /* stable entry? */ + } else if (state == ETHARP_STATE_STABLE) { +#if ETHARP_SUPPORT_STATIC_ENTRIES + /* don't record old_stable for static entries since they never expire */ + if (arp_table[i].static_entry == 0) +#endif /* ETHARP_SUPPORT_STATIC_ENTRIES */ + { + /* remember entry with oldest stable entry in oldest, its age in maxtime */ + if (arp_table[i].ctime >= age_stable) { + old_stable = i; + age_stable = arp_table[i].ctime; + } + } + } + } + } + /* { we have no match } => try to create a new entry */ + + /* don't create new entry, only search? */ + if (((flags & ETHARP_FLAG_FIND_ONLY) != 0) || + /* or no empty entry found and not allowed to recycle? */ + ((empty == ARP_TABLE_SIZE) && ((flags & ETHARP_FLAG_TRY_HARD) == 0))) { + LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("find_entry: no empty entry found and not allowed to recycle\n")); + return (s8_t)ERR_MEM; + } + + /* b) choose the least destructive entry to recycle: + * 1) empty entry + * 2) oldest stable entry + * 3) oldest pending entry without queued packets + * 4) oldest pending entry with queued packets + * + * { ETHARP_FLAG_TRY_HARD is set at this point } + */ + + /* 1) empty entry available? */ + if (empty < ARP_TABLE_SIZE) { + i = empty; + LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("find_entry: selecting empty entry %"U16_F"\n", (u16_t)i)); + } else { + /* 2) found recyclable stable entry? */ + if (old_stable < ARP_TABLE_SIZE) { + /* recycle oldest stable*/ + i = old_stable; + LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("find_entry: selecting oldest stable entry %"U16_F"\n", (u16_t)i)); + /* no queued packets should exist on stable entries */ + LWIP_ASSERT("arp_table[i].q == NULL", arp_table[i].q == NULL); + /* 3) found recyclable pending entry without queued packets? */ + } else if (old_pending < ARP_TABLE_SIZE) { + /* recycle oldest pending */ + i = old_pending; + LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("find_entry: selecting oldest pending entry %"U16_F" (without queue)\n", (u16_t)i)); + /* 4) found recyclable pending entry with queued packets? */ + } else if (old_queue < ARP_TABLE_SIZE) { + /* recycle oldest pending (queued packets are free in free_entry) */ + i = old_queue; + LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("find_entry: selecting oldest pending entry %"U16_F", freeing packet queue %p\n", (u16_t)i, (void *)(arp_table[i].q))); + /* no empty or recyclable entries found */ + } else { + LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("find_entry: no empty or recyclable entries found\n")); + return (s8_t)ERR_MEM; + } + + /* { empty or recyclable entry found } */ + LWIP_ASSERT("i < ARP_TABLE_SIZE", i < ARP_TABLE_SIZE); + free_entry(i); + } + + LWIP_ASSERT("i < ARP_TABLE_SIZE", i < ARP_TABLE_SIZE); + LWIP_ASSERT("arp_table[i].state == ETHARP_STATE_EMPTY", + arp_table[i].state == ETHARP_STATE_EMPTY); + + /* IP address given? */ + if (ipaddr != NULL) { + /* set IP address */ + ip_addr_copy(arp_table[i].ipaddr, *ipaddr); + } + arp_table[i].ctime = 0; +#if ETHARP_SUPPORT_STATIC_ENTRIES + arp_table[i].static_entry = 0; +#endif /* ETHARP_SUPPORT_STATIC_ENTRIES */ + return (err_t)i; +} + +/** + * Send an IP packet on the network using netif->linkoutput + * The ethernet header is filled in before sending. + * + * @params netif the lwIP network interface on which to send the packet + * @params p the packet to send, p->payload pointing to the (uninitialized) ethernet header + * @params src the source MAC address to be copied into the ethernet header + * @params dst the destination MAC address to be copied into the ethernet header + * @return ERR_OK if the packet was sent, any other err_t on failure + */ +static err_t +etharp_send_ip(struct netif *netif, struct pbuf *p, struct eth_addr *src, struct eth_addr *dst) +{ + struct eth_hdr *ethhdr = (struct eth_hdr *)p->payload; + + LWIP_ASSERT("netif->hwaddr_len must be the same as ETHARP_HWADDR_LEN for etharp!", + (netif->hwaddr_len == ETHARP_HWADDR_LEN)); + ETHADDR32_COPY(ðhdr->dest, dst); + ETHADDR16_COPY(ðhdr->src, src); + ethhdr->type = PP_HTONS(ETHTYPE_IP); + LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("etharp_send_ip: sending packet %p\n", (void *)p)); + /* send the packet */ + return netif->linkoutput(netif, p); +} + +/** + * Update (or insert) a IP/MAC address pair in the ARP cache. + * + * If a pending entry is resolved, any queued packets will be sent + * at this point. + * + * @param netif netif related to this entry (used for NETIF_ADDRHINT) + * @param ipaddr IP address of the inserted ARP entry. + * @param ethaddr Ethernet address of the inserted ARP entry. + * @param flags @see definition of ETHARP_FLAG_* + * + * @return + * - ERR_OK Succesfully updated ARP cache. + * - ERR_MEM If we could not add a new ARP entry when ETHARP_FLAG_TRY_HARD was set. + * - ERR_ARG Non-unicast address given, those will not appear in ARP cache. + * + * @see pbuf_free() + */ +static err_t +update_arp_entry(struct netif *netif, ip_addr_t *ipaddr, struct eth_addr *ethaddr, u8_t flags) +{ + s8_t i; + LWIP_ASSERT("netif->hwaddr_len == ETHARP_HWADDR_LEN", netif->hwaddr_len == ETHARP_HWADDR_LEN); + LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("update_arp_entry: %"U16_F".%"U16_F".%"U16_F".%"U16_F" - %02"X16_F":%02"X16_F":%02"X16_F":%02"X16_F":%02"X16_F":%02"X16_F"\n", + ip4_addr1_16(ipaddr), ip4_addr2_16(ipaddr), ip4_addr3_16(ipaddr), ip4_addr4_16(ipaddr), + ethaddr->addr[0], ethaddr->addr[1], ethaddr->addr[2], + ethaddr->addr[3], ethaddr->addr[4], ethaddr->addr[5])); + /* non-unicast address? */ + if (ip_addr_isany(ipaddr) || + ip_addr_isbroadcast(ipaddr, netif) || + ip_addr_ismulticast(ipaddr)) { + LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("update_arp_entry: will not add non-unicast IP address to ARP cache\n")); + return ERR_ARG; + } + /* find or create ARP entry */ + i = find_entry(ipaddr, flags); + /* bail out if no entry could be found */ + if (i < 0) { + return (err_t)i; + } + +#if ETHARP_SUPPORT_STATIC_ENTRIES + if (flags & ETHARP_FLAG_STATIC_ENTRY) { + /* record static type */ + arp_table[i].static_entry = 1; + } +#endif /* ETHARP_SUPPORT_STATIC_ENTRIES */ + + /* mark it stable */ + arp_table[i].state = ETHARP_STATE_STABLE; + +#if LWIP_SNMP + /* record network interface */ + arp_table[i].netif = netif; +#endif /* LWIP_SNMP */ + /* insert in SNMP ARP index tree */ + snmp_insert_arpidx_tree(netif, &arp_table[i].ipaddr); + + LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("update_arp_entry: updating stable entry %"S16_F"\n", (s16_t)i)); + /* update address */ + ETHADDR32_COPY(&arp_table[i].ethaddr, ethaddr); + /* reset time stamp */ + arp_table[i].ctime = 0; + /* this is where we will send out queued packets! */ +#if ARP_QUEUEING + while (arp_table[i].q != NULL) { + struct pbuf *p; + /* remember remainder of queue */ + struct etharp_q_entry *q = arp_table[i].q; + /* pop first item off the queue */ + arp_table[i].q = q->next; + /* get the packet pointer */ + p = q->p; + /* now queue entry can be freed */ + memp_free(MEMP_ARP_QUEUE, q); +#else /* ARP_QUEUEING */ + if (arp_table[i].q != NULL) { + struct pbuf *p = arp_table[i].q; + arp_table[i].q = NULL; +#endif /* ARP_QUEUEING */ + /* send the queued IP packet */ + etharp_send_ip(netif, p, (struct eth_addr*)(netif->hwaddr), ethaddr); + /* free the queued IP packet */ + pbuf_free(p); + } + return ERR_OK; +} + +#if ETHARP_SUPPORT_STATIC_ENTRIES +/** Add a new static entry to the ARP table. If an entry exists for the + * specified IP address, this entry is overwritten. + * If packets are queued for the specified IP address, they are sent out. + * + * @param ipaddr IP address for the new static entry + * @param ethaddr ethernet address for the new static entry + * @return @see return values of etharp_add_static_entry + */ +err_t +etharp_add_static_entry(ip_addr_t *ipaddr, struct eth_addr *ethaddr) +{ + struct netif *netif; + LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("etharp_add_static_entry: %"U16_F".%"U16_F".%"U16_F".%"U16_F" - %02"X16_F":%02"X16_F":%02"X16_F":%02"X16_F":%02"X16_F":%02"X16_F"\n", + ip4_addr1_16(ipaddr), ip4_addr2_16(ipaddr), ip4_addr3_16(ipaddr), ip4_addr4_16(ipaddr), + ethaddr->addr[0], ethaddr->addr[1], ethaddr->addr[2], + ethaddr->addr[3], ethaddr->addr[4], ethaddr->addr[5])); + + netif = ip_route(ipaddr); + if (netif == NULL) { + return ERR_RTE; + } + + return update_arp_entry(netif, ipaddr, ethaddr, ETHARP_FLAG_TRY_HARD | ETHARP_FLAG_STATIC_ENTRY); +} + +/** Remove a static entry from the ARP table previously added with a call to + * etharp_add_static_entry. + * + * @param ipaddr IP address of the static entry to remove + * @return ERR_OK: entry removed + * ERR_MEM: entry wasn't found + * ERR_ARG: entry wasn't a static entry but a dynamic one + */ +err_t +etharp_remove_static_entry(ip_addr_t *ipaddr) +{ + s8_t i; + LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("etharp_remove_static_entry: %"U16_F".%"U16_F".%"U16_F".%"U16_F"\n", + ip4_addr1_16(ipaddr), ip4_addr2_16(ipaddr), ip4_addr3_16(ipaddr), ip4_addr4_16(ipaddr))); + + /* find or create ARP entry */ + i = find_entry(ipaddr, ETHARP_FLAG_FIND_ONLY); + /* bail out if no entry could be found */ + if (i < 0) { + return (err_t)i; + } + + if ((arp_table[i].state != ETHARP_STATE_STABLE) || + (arp_table[i].static_entry == 0)) { + /* entry wasn't a static entry, cannot remove it */ + return ERR_ARG; + } + /* entry found, free it */ + free_entry(i); + return ERR_OK; +} +#endif /* ETHARP_SUPPORT_STATIC_ENTRIES */ + +/** + * Finds (stable) ethernet/IP address pair from ARP table + * using interface and IP address index. + * @note the addresses in the ARP table are in network order! + * + * @param netif points to interface index + * @param ipaddr points to the (network order) IP address index + * @param eth_ret points to return pointer + * @param ip_ret points to return pointer + * @return table index if found, -1 otherwise + */ +s8_t +etharp_find_addr(struct netif *netif, ip_addr_t *ipaddr, + struct eth_addr **eth_ret, ip_addr_t **ip_ret) +{ + s8_t i; + + LWIP_ASSERT("eth_ret != NULL && ip_ret != NULL", + eth_ret != NULL && ip_ret != NULL); + + LWIP_UNUSED_ARG(netif); + + i = find_entry(ipaddr, ETHARP_FLAG_FIND_ONLY); + if((i >= 0) && arp_table[i].state == ETHARP_STATE_STABLE) { + *eth_ret = &arp_table[i].ethaddr; + *ip_ret = &arp_table[i].ipaddr; + return i; + } + return -1; +} + +#if ETHARP_TRUST_IP_MAC +/** + * Updates the ARP table using the given IP packet. + * + * Uses the incoming IP packet's source address to update the + * ARP cache for the local network. The function does not alter + * or free the packet. This function must be called before the + * packet p is passed to the IP layer. + * + * @param netif The lwIP network interface on which the IP packet pbuf arrived. + * @param p The IP packet that arrived on netif. + * + * @return NULL + * + * @see pbuf_free() + */ +static void +etharp_ip_input(struct netif *netif, struct pbuf *p) +{ + struct eth_hdr *ethhdr; + struct ip_hdr *iphdr; + ip_addr_t iphdr_src; + LWIP_ERROR("netif != NULL", (netif != NULL), return;); + + /* Only insert an entry if the source IP address of the + incoming IP packet comes from a host on the local network. */ + ethhdr = (struct eth_hdr *)p->payload; + iphdr = (struct ip_hdr *)((u8_t*)ethhdr + SIZEOF_ETH_HDR); +#if ETHARP_SUPPORT_VLAN + if (ethhdr->type == PP_HTONS(ETHTYPE_VLAN)) { + iphdr = (struct ip_hdr *)((u8_t*)ethhdr + SIZEOF_ETH_HDR + SIZEOF_VLAN_HDR); + } +#endif /* ETHARP_SUPPORT_VLAN */ + + ip_addr_copy(iphdr_src, iphdr->src); + + /* source is not on the local network? */ + if (!ip_addr_netcmp(&iphdr_src, &(netif->ip_addr), &(netif->netmask))) { + /* do nothing */ + return; + } + + LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("etharp_ip_input: updating ETHARP table.\n")); + /* update the source IP address in the cache, if present */ + /* @todo We could use ETHARP_FLAG_TRY_HARD if we think we are going to talk + * back soon (for example, if the destination IP address is ours. */ + update_arp_entry(netif, &iphdr_src, &(ethhdr->src), ETHARP_FLAG_FIND_ONLY); +} +#endif /* ETHARP_TRUST_IP_MAC */ + +/** + * Responds to ARP requests to us. Upon ARP replies to us, add entry to cache + * send out queued IP packets. Updates cache with snooped address pairs. + * + * Should be called for incoming ARP packets. The pbuf in the argument + * is freed by this function. + * + * @param netif The lwIP network interface on which the ARP packet pbuf arrived. + * @param ethaddr Ethernet address of netif. + * @param p The ARP packet that arrived on netif. Is freed by this function. + * + * @return NULL + * + * @see pbuf_free() + */ +static void +etharp_arp_input(struct netif *netif, struct eth_addr *ethaddr, struct pbuf *p) +{ + struct etharp_hdr *hdr; + struct eth_hdr *ethhdr; + /* these are aligned properly, whereas the ARP header fields might not be */ + ip_addr_t sipaddr, dipaddr; + u8_t for_us; +#if LWIP_AUTOIP + const u8_t * ethdst_hwaddr; +#endif /* LWIP_AUTOIP */ + + LWIP_ERROR("netif != NULL", (netif != NULL), return;); + + /* drop short ARP packets: we have to check for p->len instead of p->tot_len here + since a struct etharp_hdr is pointed to p->payload, so it musn't be chained! */ + if (p->len < SIZEOF_ETHARP_PACKET) { + LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_LEVEL_WARNING, + ("etharp_arp_input: packet dropped, too short (%"S16_F"/%"S16_F")\n", p->tot_len, + (s16_t)SIZEOF_ETHARP_PACKET)); + ETHARP_STATS_INC(etharp.lenerr); + ETHARP_STATS_INC(etharp.drop); + pbuf_free(p); + return; + } + + ethhdr = (struct eth_hdr *)p->payload; + hdr = (struct etharp_hdr *)((u8_t*)ethhdr + SIZEOF_ETH_HDR); +#if ETHARP_SUPPORT_VLAN + if (ethhdr->type == PP_HTONS(ETHTYPE_VLAN)) { + hdr = (struct etharp_hdr *)(((u8_t*)ethhdr) + SIZEOF_ETH_HDR + SIZEOF_VLAN_HDR); + } +#endif /* ETHARP_SUPPORT_VLAN */ + + /* RFC 826 "Packet Reception": */ + if ((hdr->hwtype != PP_HTONS(HWTYPE_ETHERNET)) || + (hdr->hwlen != ETHARP_HWADDR_LEN) || + (hdr->protolen != sizeof(ip_addr_t)) || + (hdr->proto != PP_HTONS(ETHTYPE_IP))) { + LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_LEVEL_WARNING, + ("etharp_arp_input: packet dropped, wrong hw type, hwlen, proto, protolen or ethernet type (%"U16_F"/%"U16_F"/%"U16_F"/%"U16_F")\n", + hdr->hwtype, hdr->hwlen, hdr->proto, hdr->protolen)); + ETHARP_STATS_INC(etharp.proterr); + ETHARP_STATS_INC(etharp.drop); + pbuf_free(p); + return; + } + ETHARP_STATS_INC(etharp.recv); + +#if LWIP_AUTOIP + /* We have to check if a host already has configured our random + * created link local address and continously check if there is + * a host with this IP-address so we can detect collisions */ + autoip_arp_reply(netif, hdr); +#endif /* LWIP_AUTOIP */ + + /* Copy struct ip_addr2 to aligned ip_addr, to support compilers without + * structure packing (not using structure copy which breaks strict-aliasing rules). */ + IPADDR2_COPY(&sipaddr, &hdr->sipaddr); + IPADDR2_COPY(&dipaddr, &hdr->dipaddr); + + /* this interface is not configured? */ + if (ip_addr_isany(&netif->ip_addr)) { + for_us = 0; + } else { + /* ARP packet directed to us? */ + for_us = (u8_t)ip_addr_cmp(&dipaddr, &(netif->ip_addr)); + } + + /* ARP message directed to us? + -> add IP address in ARP cache; assume requester wants to talk to us, + can result in directly sending the queued packets for this host. + ARP message not directed to us? + -> update the source IP address in the cache, if present */ + update_arp_entry(netif, &sipaddr, &(hdr->shwaddr), + for_us ? ETHARP_FLAG_TRY_HARD : ETHARP_FLAG_FIND_ONLY); + + /* now act on the message itself */ + switch (hdr->opcode) { + /* ARP request? */ + case PP_HTONS(ARP_REQUEST): + /* ARP request. If it asked for our address, we send out a + * reply. In any case, we time-stamp any existing ARP entry, + * and possiby send out an IP packet that was queued on it. */ + + LWIP_DEBUGF (ETHARP_DEBUG | LWIP_DBG_TRACE, ("etharp_arp_input: incoming ARP request\n")); + /* ARP request for our address? */ + if (for_us) { + + LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("etharp_arp_input: replying to ARP request for our IP address\n")); + /* Re-use pbuf to send ARP reply. + Since we are re-using an existing pbuf, we can't call etharp_raw since + that would allocate a new pbuf. */ + hdr->opcode = htons(ARP_REPLY); + + IPADDR2_COPY(&hdr->dipaddr, &hdr->sipaddr); + IPADDR2_COPY(&hdr->sipaddr, &netif->ip_addr); + + LWIP_ASSERT("netif->hwaddr_len must be the same as ETHARP_HWADDR_LEN for etharp!", + (netif->hwaddr_len == ETHARP_HWADDR_LEN)); +#if LWIP_AUTOIP + /* If we are using Link-Local, all ARP packets that contain a Link-Local + * 'sender IP address' MUST be sent using link-layer broadcast instead of + * link-layer unicast. (See RFC3927 Section 2.5, last paragraph) */ + ethdst_hwaddr = ip_addr_islinklocal(&netif->ip_addr) ? (u8_t*)(ethbroadcast.addr) : hdr->shwaddr.addr; +#endif /* LWIP_AUTOIP */ + + ETHADDR16_COPY(&hdr->dhwaddr, &hdr->shwaddr); +#if LWIP_AUTOIP + ETHADDR16_COPY(ðhdr->dest, ethdst_hwaddr); +#else /* LWIP_AUTOIP */ + ETHADDR16_COPY(ðhdr->dest, &hdr->shwaddr); +#endif /* LWIP_AUTOIP */ + ETHADDR16_COPY(&hdr->shwaddr, ethaddr); + ETHADDR16_COPY(ðhdr->src, ethaddr); + + /* hwtype, hwaddr_len, proto, protolen and the type in the ethernet header + are already correct, we tested that before */ + + /* return ARP reply */ + netif->linkoutput(netif, p); + /* we are not configured? */ + } else if (ip_addr_isany(&netif->ip_addr)) { + /* { for_us == 0 and netif->ip_addr.addr == 0 } */ + LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("etharp_arp_input: we are unconfigured, ARP request ignored.\n")); + /* request was not directed to us */ + } else { + /* { for_us == 0 and netif->ip_addr.addr != 0 } */ + LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("etharp_arp_input: ARP request was not for us.\n")); + } + break; + case PP_HTONS(ARP_REPLY): + /* ARP reply. We already updated the ARP cache earlier. */ + LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("etharp_arp_input: incoming ARP reply\n")); +#if (LWIP_DHCP && DHCP_DOES_ARP_CHECK) + /* DHCP wants to know about ARP replies from any host with an + * IP address also offered to us by the DHCP server. We do not + * want to take a duplicate IP address on a single network. + * @todo How should we handle redundant (fail-over) interfaces? */ + dhcp_arp_reply(netif, &sipaddr); +#endif /* (LWIP_DHCP && DHCP_DOES_ARP_CHECK) */ + break; + default: + LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("etharp_arp_input: ARP unknown opcode type %"S16_F"\n", htons(hdr->opcode))); + ETHARP_STATS_INC(etharp.err); + break; + } + /* free ARP packet */ + pbuf_free(p); +} + +/** + * Resolve and fill-in Ethernet address header for outgoing IP packet. + * + * For IP multicast and broadcast, corresponding Ethernet addresses + * are selected and the packet is transmitted on the link. + * + * For unicast addresses, the packet is submitted to etharp_query(). In + * case the IP address is outside the local network, the IP address of + * the gateway is used. + * + * @param netif The lwIP network interface which the IP packet will be sent on. + * @param q The pbuf(s) containing the IP packet to be sent. + * @param ipaddr The IP address of the packet destination. + * + * @return + * - ERR_RTE No route to destination (no gateway to external networks), + * or the return type of either etharp_query() or etharp_send_ip(). + */ +err_t +etharp_output(struct netif *netif, struct pbuf *q, ip_addr_t *ipaddr) +{ + struct eth_addr *dest, mcastaddr; + + /* make room for Ethernet header - should not fail */ + if (pbuf_header(q, sizeof(struct eth_hdr)) != 0) { + /* bail out */ + LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_LEVEL_SERIOUS, + ("etharp_output: could not allocate room for header.\n")); + LINK_STATS_INC(link.lenerr); + return ERR_BUF; + } + + /* assume unresolved Ethernet address */ + dest = NULL; + /* Determine on destination hardware address. Broadcasts and multicasts + * are special, other IP addresses are looked up in the ARP table. */ + + /* broadcast destination IP address? */ + if (ip_addr_isbroadcast(ipaddr, netif)) { + /* broadcast on Ethernet also */ + dest = (struct eth_addr *)ðbroadcast; + /* multicast destination IP address? */ + } else if (ip_addr_ismulticast(ipaddr)) { + /* Hash IP multicast address to MAC address.*/ + mcastaddr.addr[0] = 0x01; + mcastaddr.addr[1] = 0x00; + mcastaddr.addr[2] = 0x5e; + mcastaddr.addr[3] = ip4_addr2(ipaddr) & 0x7f; + mcastaddr.addr[4] = ip4_addr3(ipaddr); + mcastaddr.addr[5] = ip4_addr4(ipaddr); + /* destination Ethernet address is multicast */ + dest = &mcastaddr; + /* unicast destination IP address? */ + } else { + /* outside local network? */ + if (!ip_addr_netcmp(ipaddr, &(netif->ip_addr), &(netif->netmask)) && + !ip_addr_islinklocal(ipaddr)) { +#if LWIP_AUTOIP + struct ip_hdr *iphdr = (struct ip_hdr*)((u8_t*)q->payload + + sizeof(struct eth_hdr)); + /* According to RFC 3297, chapter 2.6.2 (Forwarding Rules), a packet with + a link-local source address must always be "directly to its destination + on the same physical link. The host MUST NOT send the packet to any + router for forwarding". */ + if (!ip_addr_islinklocal(&iphdr->src)) +#endif /* LWIP_AUTOIP */ + { + /* interface has default gateway? */ + if (!ip_addr_isany(&netif->gw)) { + /* send to hardware address of default gateway IP address */ + ipaddr = &(netif->gw); + /* no default gateway available */ + } else { + /* no route to destination error (default gateway missing) */ + return ERR_RTE; + } + } + } +#if LWIP_NETIF_HWADDRHINT + if (netif->addr_hint != NULL) { + /* per-pcb cached entry was given */ + u8_t etharp_cached_entry = *(netif->addr_hint); + if (etharp_cached_entry < ARP_TABLE_SIZE) { +#endif /* LWIP_NETIF_HWADDRHINT */ + if ((arp_table[etharp_cached_entry].state == ETHARP_STATE_STABLE) && + (ip_addr_cmp(ipaddr, &arp_table[etharp_cached_entry].ipaddr))) { + /* the per-pcb-cached entry is stable and the right one! */ + ETHARP_STATS_INC(etharp.cachehit); + return etharp_send_ip(netif, q, (struct eth_addr*)(netif->hwaddr), + &arp_table[etharp_cached_entry].ethaddr); + } +#if LWIP_NETIF_HWADDRHINT + } + } +#endif /* LWIP_NETIF_HWADDRHINT */ + /* queue on destination Ethernet address belonging to ipaddr */ + return etharp_query(netif, ipaddr, q); + } + + /* continuation for multicast/broadcast destinations */ + /* obtain source Ethernet address of the given interface */ + /* send packet directly on the link */ + return etharp_send_ip(netif, q, (struct eth_addr*)(netif->hwaddr), dest); +} + +/** + * Send an ARP request for the given IP address and/or queue a packet. + * + * If the IP address was not yet in the cache, a pending ARP cache entry + * is added and an ARP request is sent for the given address. The packet + * is queued on this entry. + * + * If the IP address was already pending in the cache, a new ARP request + * is sent for the given address. The packet is queued on this entry. + * + * If the IP address was already stable in the cache, and a packet is + * given, it is directly sent and no ARP request is sent out. + * + * If the IP address was already stable in the cache, and no packet is + * given, an ARP request is sent out. + * + * @param netif The lwIP network interface on which ipaddr + * must be queried for. + * @param ipaddr The IP address to be resolved. + * @param q If non-NULL, a pbuf that must be delivered to the IP address. + * q is not freed by this function. + * + * @note q must only be ONE packet, not a packet queue! + * + * @return + * - ERR_BUF Could not make room for Ethernet header. + * - ERR_MEM Hardware address unknown, and no more ARP entries available + * to query for address or queue the packet. + * - ERR_MEM Could not queue packet due to memory shortage. + * - ERR_RTE No route to destination (no gateway to external networks). + * - ERR_ARG Non-unicast address given, those will not appear in ARP cache. + * + */ +err_t +etharp_query(struct netif *netif, ip_addr_t *ipaddr, struct pbuf *q) +{ + struct eth_addr * srcaddr = (struct eth_addr *)netif->hwaddr; + err_t result = ERR_MEM; + s8_t i; /* ARP entry index */ + + /* non-unicast address? */ + if (ip_addr_isbroadcast(ipaddr, netif) || + ip_addr_ismulticast(ipaddr) || + ip_addr_isany(ipaddr)) { + LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("etharp_query: will not add non-unicast IP address to ARP cache\n")); + return ERR_ARG; + } + + /* find entry in ARP cache, ask to create entry if queueing packet */ + i = find_entry(ipaddr, ETHARP_FLAG_TRY_HARD); + + /* could not find or create entry? */ + if (i < 0) { + LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("etharp_query: could not create ARP entry\n")); + if (q) { + LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("etharp_query: packet dropped\n")); + ETHARP_STATS_INC(etharp.memerr); + } + return (err_t)i; + } + + /* mark a fresh entry as pending (we just sent a request) */ + if (arp_table[i].state == ETHARP_STATE_EMPTY) { + arp_table[i].state = ETHARP_STATE_PENDING; + } + + /* { i is either a STABLE or (new or existing) PENDING entry } */ + LWIP_ASSERT("arp_table[i].state == PENDING or STABLE", + ((arp_table[i].state == ETHARP_STATE_PENDING) || + (arp_table[i].state == ETHARP_STATE_STABLE))); + + /* do we have a pending entry? or an implicit query request? */ + if ((arp_table[i].state == ETHARP_STATE_PENDING) || (q == NULL)) { + /* try to resolve it; send out ARP request */ + result = etharp_request(netif, ipaddr); + if (result != ERR_OK) { + /* ARP request couldn't be sent */ + /* We don't re-send arp request in etharp_tmr, but we still queue packets, + since this failure could be temporary, and the next packet calling + etharp_query again could lead to sending the queued packets. */ + } + if (q == NULL) { + return result; + } + } + + /* packet given? */ + LWIP_ASSERT("q != NULL", q != NULL); + /* stable entry? */ + if (arp_table[i].state == ETHARP_STATE_STABLE) { + /* we have a valid IP->Ethernet address mapping */ + ETHARP_SET_HINT(netif, i); + /* send the packet */ + result = etharp_send_ip(netif, q, srcaddr, &(arp_table[i].ethaddr)); + /* pending entry? (either just created or already pending */ + } else if (arp_table[i].state == ETHARP_STATE_PENDING) { + /* entry is still pending, queue the given packet 'q' */ + struct pbuf *p; + int copy_needed = 0; + /* IF q includes a PBUF_REF, PBUF_POOL or PBUF_RAM, we have no choice but + * to copy the whole queue into a new PBUF_RAM (see bug #11400) + * PBUF_ROMs can be left as they are, since ROM must not get changed. */ + p = q; + while (p) { + LWIP_ASSERT("no packet queues allowed!", (p->len != p->tot_len) || (p->next == 0)); + if(p->type != PBUF_ROM) { + copy_needed = 1; + break; + } + p = p->next; + } + if(copy_needed) { + /* copy the whole packet into new pbufs */ + p = pbuf_alloc(PBUF_RAW, p->tot_len, PBUF_RAM); + if(p != NULL) { + if (pbuf_copy(p, q) != ERR_OK) { + pbuf_free(p); + p = NULL; + } + } + } else { + /* referencing the old pbuf is enough */ + p = q; + pbuf_ref(p); + } + /* packet could be taken over? */ + if (p != NULL) { + /* queue packet ... */ +#if ARP_QUEUEING + struct etharp_q_entry *new_entry; + /* allocate a new arp queue entry */ + new_entry = (struct etharp_q_entry *)memp_malloc(MEMP_ARP_QUEUE); + if (new_entry != NULL) { + new_entry->next = 0; + new_entry->p = p; + if(arp_table[i].q != NULL) { + /* queue was already existent, append the new entry to the end */ + struct etharp_q_entry *r; + r = arp_table[i].q; + while (r->next != NULL) { + r = r->next; + } + r->next = new_entry; + } else { + /* queue did not exist, first item in queue */ + arp_table[i].q = new_entry; + } + LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("etharp_query: queued packet %p on ARP entry %"S16_F"\n", (void *)q, (s16_t)i)); + result = ERR_OK; + } else { + /* the pool MEMP_ARP_QUEUE is empty */ + pbuf_free(p); + LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("etharp_query: could not queue a copy of PBUF_REF packet %p (out of memory)\n", (void *)q)); + result = ERR_MEM; + } +#else /* ARP_QUEUEING */ + /* always queue one packet per ARP request only, freeing a previously queued packet */ + if (arp_table[i].q != NULL) { + LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("etharp_query: dropped previously queued packet %p for ARP entry %"S16_F"\n", (void *)q, (s16_t)i)); + pbuf_free(arp_table[i].q); + } + arp_table[i].q = p; + result = ERR_OK; + LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("etharp_query: queued packet %p on ARP entry %"S16_F"\n", (void *)q, (s16_t)i)); +#endif /* ARP_QUEUEING */ + } else { + ETHARP_STATS_INC(etharp.memerr); + LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("etharp_query: could not queue a copy of PBUF_REF packet %p (out of memory)\n", (void *)q)); + result = ERR_MEM; + } + } + return result; +} + +/** + * Send a raw ARP packet (opcode and all addresses can be modified) + * + * @param netif the lwip network interface on which to send the ARP packet + * @param ethsrc_addr the source MAC address for the ethernet header + * @param ethdst_addr the destination MAC address for the ethernet header + * @param hwsrc_addr the source MAC address for the ARP protocol header + * @param ipsrc_addr the source IP address for the ARP protocol header + * @param hwdst_addr the destination MAC address for the ARP protocol header + * @param ipdst_addr the destination IP address for the ARP protocol header + * @param opcode the type of the ARP packet + * @return ERR_OK if the ARP packet has been sent + * ERR_MEM if the ARP packet couldn't be allocated + * any other err_t on failure + */ +#if !LWIP_AUTOIP +static +#endif /* LWIP_AUTOIP */ +err_t +etharp_raw(struct netif *netif, const struct eth_addr *ethsrc_addr, + const struct eth_addr *ethdst_addr, + const struct eth_addr *hwsrc_addr, const ip_addr_t *ipsrc_addr, + const struct eth_addr *hwdst_addr, const ip_addr_t *ipdst_addr, + const u16_t opcode) +{ + struct pbuf *p; + err_t result = ERR_OK; + struct eth_hdr *ethhdr; + struct etharp_hdr *hdr; +#if LWIP_AUTOIP + const u8_t * ethdst_hwaddr; +#endif /* LWIP_AUTOIP */ + + /* allocate a pbuf for the outgoing ARP request packet */ + p = pbuf_alloc(PBUF_RAW, SIZEOF_ETHARP_PACKET, PBUF_RAM); + /* could allocate a pbuf for an ARP request? */ + if (p == NULL) { + LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE | LWIP_DBG_LEVEL_SERIOUS, + ("etharp_raw: could not allocate pbuf for ARP request.\n")); + ETHARP_STATS_INC(etharp.memerr); + return ERR_MEM; + } + LWIP_ASSERT("check that first pbuf can hold struct etharp_hdr", + (p->len >= SIZEOF_ETHARP_PACKET)); + + ethhdr = (struct eth_hdr *)p->payload; + hdr = (struct etharp_hdr *)((u8_t*)ethhdr + SIZEOF_ETH_HDR); + LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("etharp_raw: sending raw ARP packet.\n")); + hdr->opcode = htons(opcode); + + LWIP_ASSERT("netif->hwaddr_len must be the same as ETHARP_HWADDR_LEN for etharp!", + (netif->hwaddr_len == ETHARP_HWADDR_LEN)); +#if LWIP_AUTOIP + /* If we are using Link-Local, all ARP packets that contain a Link-Local + * 'sender IP address' MUST be sent using link-layer broadcast instead of + * link-layer unicast. (See RFC3927 Section 2.5, last paragraph) */ + ethdst_hwaddr = ip_addr_islinklocal(ipsrc_addr) ? (u8_t*)(ethbroadcast.addr) : ethdst_addr->addr; +#endif /* LWIP_AUTOIP */ + /* Write the ARP MAC-Addresses */ + ETHADDR16_COPY(&hdr->shwaddr, hwsrc_addr); + ETHADDR16_COPY(&hdr->dhwaddr, hwdst_addr); + /* Write the Ethernet MAC-Addresses */ +#if LWIP_AUTOIP + ETHADDR16_COPY(ðhdr->dest, ethdst_hwaddr); +#else /* LWIP_AUTOIP */ + ETHADDR16_COPY(ðhdr->dest, ethdst_addr); +#endif /* LWIP_AUTOIP */ + ETHADDR16_COPY(ðhdr->src, ethsrc_addr); + /* Copy struct ip_addr2 to aligned ip_addr, to support compilers without + * structure packing. */ + IPADDR2_COPY(&hdr->sipaddr, ipsrc_addr); + IPADDR2_COPY(&hdr->dipaddr, ipdst_addr); + + hdr->hwtype = PP_HTONS(HWTYPE_ETHERNET); + hdr->proto = PP_HTONS(ETHTYPE_IP); + /* set hwlen and protolen */ + hdr->hwlen = ETHARP_HWADDR_LEN; + hdr->protolen = sizeof(ip_addr_t); + + ethhdr->type = PP_HTONS(ETHTYPE_ARP); + /* send ARP query */ + result = netif->linkoutput(netif, p); + ETHARP_STATS_INC(etharp.xmit); + /* free ARP query packet */ + pbuf_free(p); + p = NULL; + /* could not allocate pbuf for ARP request */ + + return result; +} + +/** + * Send an ARP request packet asking for ipaddr. + * + * @param netif the lwip network interface on which to send the request + * @param ipaddr the IP address for which to ask + * @return ERR_OK if the request has been sent + * ERR_MEM if the ARP packet couldn't be allocated + * any other err_t on failure + */ +err_t +etharp_request(struct netif *netif, ip_addr_t *ipaddr) +{ + LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("etharp_request: sending ARP request.\n")); + return etharp_raw(netif, (struct eth_addr *)netif->hwaddr, ðbroadcast, + (struct eth_addr *)netif->hwaddr, &netif->ip_addr, ðzero, + ipaddr, ARP_REQUEST); +} +#endif /* LWIP_ARP */ + +/** + * Process received ethernet frames. Using this function instead of directly + * calling ip_input and passing ARP frames through etharp in ethernetif_input, + * the ARP cache is protected from concurrent access. + * + * @param p the recevied packet, p->payload pointing to the ethernet header + * @param netif the network interface on which the packet was received + */ +err_t +ethernet_input(struct pbuf *p, struct netif *netif) +{ + struct eth_hdr* ethhdr; + u16_t type; + s16_t ip_hdr_offset = SIZEOF_ETH_HDR; + + if (p->len <= SIZEOF_ETH_HDR) { + /* a packet with only an ethernet header (or less) is not valid for us */ + ETHARP_STATS_INC(etharp.proterr); + ETHARP_STATS_INC(etharp.drop); + goto free_and_return; + } + + /* points to packet payload, which starts with an Ethernet header */ + ethhdr = (struct eth_hdr *)p->payload; + LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, + ("ethernet_input: dest:%"X8_F":%"X8_F":%"X8_F":%"X8_F":%"X8_F":%"X8_F", src:%"X8_F":%"X8_F":%"X8_F":%"X8_F":%"X8_F":%"X8_F", type:%"X16_F"\n", + (unsigned)ethhdr->dest.addr[0], (unsigned)ethhdr->dest.addr[1], (unsigned)ethhdr->dest.addr[2], + (unsigned)ethhdr->dest.addr[3], (unsigned)ethhdr->dest.addr[4], (unsigned)ethhdr->dest.addr[5], + (unsigned)ethhdr->src.addr[0], (unsigned)ethhdr->src.addr[1], (unsigned)ethhdr->src.addr[2], + (unsigned)ethhdr->src.addr[3], (unsigned)ethhdr->src.addr[4], (unsigned)ethhdr->src.addr[5], + (unsigned)htons(ethhdr->type))); + + type = ethhdr->type; +#if ETHARP_SUPPORT_VLAN + if (type == PP_HTONS(ETHTYPE_VLAN)) { + struct eth_vlan_hdr *vlan = (struct eth_vlan_hdr*)(((char*)ethhdr) + SIZEOF_ETH_HDR); + if (p->len <= SIZEOF_ETH_HDR + SIZEOF_VLAN_HDR) { + /* a packet with only an ethernet/vlan header (or less) is not valid for us */ + ETHARP_STATS_INC(etharp.proterr); + ETHARP_STATS_INC(etharp.drop); + goto free_and_return; + } +#ifdef ETHARP_VLAN_CHECK /* if not, allow all VLANs */ + if (VLAN_ID(vlan) != ETHARP_VLAN_CHECK) { + /* silently ignore this packet: not for our VLAN */ + pbuf_free(p); + return ERR_OK; + } +#endif /* ETHARP_VLAN_CHECK */ + type = vlan->tpid; + ip_hdr_offset = SIZEOF_ETH_HDR + SIZEOF_VLAN_HDR; + } +#endif /* ETHARP_SUPPORT_VLAN */ + +#if LWIP_ARP_FILTER_NETIF + netif = LWIP_ARP_FILTER_NETIF_FN(p, netif, htons(type)); +#endif /* LWIP_ARP_FILTER_NETIF*/ + + switch (type) { +#if LWIP_ARP + /* IP packet? */ + case PP_HTONS(ETHTYPE_IP): + if (!(netif->flags & NETIF_FLAG_ETHARP)) { + goto free_and_return; + } +#if ETHARP_TRUST_IP_MAC + /* update ARP table */ + etharp_ip_input(netif, p); +#endif /* ETHARP_TRUST_IP_MAC */ + /* skip Ethernet header */ + if(pbuf_header(p, -ip_hdr_offset)) { + LWIP_ASSERT("Can't move over header in packet", 0); + goto free_and_return; + } else { + /* pass to IP layer */ + ip_input(p, netif); + } + break; + + case PP_HTONS(ETHTYPE_ARP): + if (!(netif->flags & NETIF_FLAG_ETHARP)) { + goto free_and_return; + } + /* pass p to ARP module */ + etharp_arp_input(netif, (struct eth_addr*)(netif->hwaddr), p); + break; +#endif /* LWIP_ARP */ +#if PPPOE_SUPPORT + case PP_HTONS(ETHTYPE_PPPOEDISC): /* PPP Over Ethernet Discovery Stage */ + pppoe_disc_input(netif, p); + break; + + case PP_HTONS(ETHTYPE_PPPOE): /* PPP Over Ethernet Session Stage */ + pppoe_data_input(netif, p); + break; +#endif /* PPPOE_SUPPORT */ + + default: + ETHARP_STATS_INC(etharp.proterr); + ETHARP_STATS_INC(etharp.drop); + goto free_and_return; + } + + /* This means the pbuf is freed or consumed, + so the caller doesn't have to free it again */ + return ERR_OK; + +free_and_return: + pbuf_free(p); + return ERR_OK; +} +#endif /* LWIP_ARP || LWIP_ETHERNET */ diff --git a/lib/drivers/lwip/src/netif/ethernetif.c b/lib/drivers/lwip/src/netif/ethernetif.c new file mode 100644 index 00000000000..a5b7d990b11 --- /dev/null +++ b/lib/drivers/lwip/src/netif/ethernetif.c @@ -0,0 +1,318 @@ +/** + * @file + * Ethernet Interface Skeleton + * + */ + +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ + +/* + * This file is a skeleton for developing Ethernet network interface + * drivers for lwIP. Add code to the low_level functions and do a + * search-and-replace for the word "ethernetif" to replace it with + * something that better describes your network interface. + */ + +#include "lwip/opt.h" + +#if 0 /* don't build, this is only a skeleton, see previous comment */ + +#include "lwip/def.h" +#include "lwip/mem.h" +#include "lwip/pbuf.h" +#include "lwip/sys.h" +#include +#include +#include "netif/etharp.h" +#include "netif/ppp_oe.h" + +/* Define those to better describe your network interface. */ +#define IFNAME0 'e' +#define IFNAME1 'n' + +/** + * Helper struct to hold private data used to operate your ethernet interface. + * Keeping the ethernet address of the MAC in this struct is not necessary + * as it is already kept in the struct netif. + * But this is only an example, anyway... + */ +struct ethernetif { + struct eth_addr *ethaddr; + /* Add whatever per-interface state that is needed here. */ +}; + +/* Forward declarations. */ +static void ethernetif_input(struct netif *netif); + +/** + * In this function, the hardware should be initialized. + * Called from ethernetif_init(). + * + * @param netif the already initialized lwip network interface structure + * for this ethernetif + */ +static void +low_level_init(struct netif *netif) +{ + struct ethernetif *ethernetif = netif->state; + + /* set MAC hardware address length */ + netif->hwaddr_len = ETHARP_HWADDR_LEN; + + /* set MAC hardware address */ + netif->hwaddr[0] = ; + ... + netif->hwaddr[5] = ; + + /* maximum transfer unit */ + netif->mtu = 1500; + + /* device capabilities */ + /* don't set NETIF_FLAG_ETHARP if this device is not an ethernet one */ + netif->flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP | NETIF_FLAG_LINK_UP; + + /* Do whatever else is needed to initialize interface. */ +} + +/** + * This function should do the actual transmission of the packet. The packet is + * contained in the pbuf that is passed to the function. This pbuf + * might be chained. + * + * @param netif the lwip network interface structure for this ethernetif + * @param p the MAC packet to send (e.g. IP packet including MAC addresses and type) + * @return ERR_OK if the packet could be sent + * an err_t value if the packet couldn't be sent + * + * @note Returning ERR_MEM here if a DMA queue of your MAC is full can lead to + * strange results. You might consider waiting for space in the DMA queue + * to become availale since the stack doesn't retry to send a packet + * dropped because of memory failure (except for the TCP timers). + */ + +static err_t +low_level_output(struct netif *netif, struct pbuf *p) +{ + struct ethernetif *ethernetif = netif->state; + struct pbuf *q; + + initiate transfer(); + +#if ETH_PAD_SIZE + pbuf_header(p, -ETH_PAD_SIZE); /* drop the padding word */ +#endif + + for(q = p; q != NULL; q = q->next) { + /* Send the data from the pbuf to the interface, one pbuf at a + time. The size of the data in each pbuf is kept in the ->len + variable. */ + send data from(q->payload, q->len); + } + + signal that packet should be sent(); + +#if ETH_PAD_SIZE + pbuf_header(p, ETH_PAD_SIZE); /* reclaim the padding word */ +#endif + + LINK_STATS_INC(link.xmit); + + return ERR_OK; +} + +/** + * Should allocate a pbuf and transfer the bytes of the incoming + * packet from the interface into the pbuf. + * + * @param netif the lwip network interface structure for this ethernetif + * @return a pbuf filled with the received packet (including MAC header) + * NULL on memory error + */ +static struct pbuf * +low_level_input(struct netif *netif) +{ + struct ethernetif *ethernetif = netif->state; + struct pbuf *p, *q; + u16_t len; + + /* Obtain the size of the packet and put it into the "len" + variable. */ + len = ; + +#if ETH_PAD_SIZE + len += ETH_PAD_SIZE; /* allow room for Ethernet padding */ +#endif + + /* We allocate a pbuf chain of pbufs from the pool. */ + p = pbuf_alloc(PBUF_RAW, len, PBUF_POOL); + + if (p != NULL) { + +#if ETH_PAD_SIZE + pbuf_header(p, -ETH_PAD_SIZE); /* drop the padding word */ +#endif + + /* We iterate over the pbuf chain until we have read the entire + * packet into the pbuf. */ + for(q = p; q != NULL; q = q->next) { + /* Read enough bytes to fill this pbuf in the chain. The + * available data in the pbuf is given by the q->len + * variable. + * This does not necessarily have to be a memcpy, you can also preallocate + * pbufs for a DMA-enabled MAC and after receiving truncate it to the + * actually received size. In this case, ensure the tot_len member of the + * pbuf is the sum of the chained pbuf len members. + */ + read data into(q->payload, q->len); + } + acknowledge that packet has been read(); + +#if ETH_PAD_SIZE + pbuf_header(p, ETH_PAD_SIZE); /* reclaim the padding word */ +#endif + + LINK_STATS_INC(link.recv); + } else { + drop packet(); + LINK_STATS_INC(link.memerr); + LINK_STATS_INC(link.drop); + } + + return p; +} + +/** + * This function should be called when a packet is ready to be read + * from the interface. It uses the function low_level_input() that + * should handle the actual reception of bytes from the network + * interface. Then the type of the received packet is determined and + * the appropriate input function is called. + * + * @param netif the lwip network interface structure for this ethernetif + */ +static void +ethernetif_input(struct netif *netif) +{ + struct ethernetif *ethernetif; + struct eth_hdr *ethhdr; + struct pbuf *p; + + ethernetif = netif->state; + + /* move received packet into a new pbuf */ + p = low_level_input(netif); + /* no packet could be read, silently ignore this */ + if (p == NULL) return; + /* points to packet payload, which starts with an Ethernet header */ + ethhdr = p->payload; + + switch (htons(ethhdr->type)) { + /* IP or ARP packet? */ + case ETHTYPE_IP: + case ETHTYPE_ARP: +#if PPPOE_SUPPORT + /* PPPoE packet? */ + case ETHTYPE_PPPOEDISC: + case ETHTYPE_PPPOE: +#endif /* PPPOE_SUPPORT */ + /* full packet send to tcpip_thread to process */ + if (netif->input(p, netif)!=ERR_OK) + { LWIP_DEBUGF(NETIF_DEBUG, ("ethernetif_input: IP input error\n")); + pbuf_free(p); + p = NULL; + } + break; + + default: + pbuf_free(p); + p = NULL; + break; + } +} + +/** + * Should be called at the beginning of the program to set up the + * network interface. It calls the function low_level_init() to do the + * actual setup of the hardware. + * + * This function should be passed as a parameter to netif_add(). + * + * @param netif the lwip network interface structure for this ethernetif + * @return ERR_OK if the loopif is initialized + * ERR_MEM if private data couldn't be allocated + * any other err_t on error + */ +err_t +ethernetif_init(struct netif *netif) +{ + struct ethernetif *ethernetif; + + LWIP_ASSERT("netif != NULL", (netif != NULL)); + + ethernetif = mem_malloc(sizeof(struct ethernetif)); + if (ethernetif == NULL) { + LWIP_DEBUGF(NETIF_DEBUG, ("ethernetif_init: out of memory\n")); + return ERR_MEM; + } + +#if LWIP_NETIF_HOSTNAME + /* Initialize interface hostname */ + netif->hostname = "lwip"; +#endif /* LWIP_NETIF_HOSTNAME */ + + /* + * Initialize the snmp variables and counters inside the struct netif. + * The last argument should be replaced with your link speed, in units + * of bits per second. + */ + NETIF_INIT_SNMP(netif, snmp_ifType_ethernet_csmacd, LINK_SPEED_OF_YOUR_NETIF_IN_BPS); + + netif->state = ethernetif; + netif->name[0] = IFNAME0; + netif->name[1] = IFNAME1; + /* We directly use etharp_output() here to save a function call. + * You can instead declare your own function an call etharp_output() + * from it if you have to do some checks before sending (e.g. if link + * is available...) */ + netif->output = etharp_output; + netif->linkoutput = low_level_output; + + ethernetif->ethaddr = (struct eth_addr *)&(netif->hwaddr[0]); + + /* initialize the hardware */ + low_level_init(netif); + + return ERR_OK; +} + +#endif /* 0 */ diff --git a/lib/drivers/lwip/src/netif/loopif.c b/lib/drivers/lwip/src/netif/loopif.c new file mode 100644 index 00000000000..1e1f28cf144 --- /dev/null +++ b/lib/drivers/lwip/src/netif/loopif.c @@ -0,0 +1,66 @@ +/** + * @file + * Loop Interface + * + */ + +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT + * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * This file is part of the lwIP TCP/IP stack. + * + * Author: Adam Dunkels + * + */ +#include "lwip/opt.h" + +#if LWIP_HAVE_LOOPIF + +#include "netif/loopif.h" +#include "lwip/snmp.h" + +/** + * Initialize a lwip network interface structure for a loopback interface + * + * @param netif the lwip network interface structure for this loopif + * @return ERR_OK if the loopif is initialized + * ERR_MEM if private data couldn't be allocated + */ +err_t +loopif_init(struct netif *netif) +{ + /* initialize the snmp variables and counters inside the struct netif + * ifSpeed: no assumption can be made! + */ + NETIF_INIT_SNMP(netif, snmp_ifType_softwareLoopback, 0); + + netif->name[0] = 'l'; + netif->name[1] = 'o'; + netif->output = netif_loop_output; + return ERR_OK; +} + +#endif /* LWIP_HAVE_LOOPIF */ diff --git a/lib/drivers/lwip/src/netif/ppp/auth.c b/lib/drivers/lwip/src/netif/ppp/auth.c new file mode 100644 index 00000000000..c3c49d22a25 --- /dev/null +++ b/lib/drivers/lwip/src/netif/ppp/auth.c @@ -0,0 +1,1334 @@ +/***************************************************************************** +* auth.c - Network Authentication and Phase Control program file. +* +* Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc. +* Copyright (c) 1997 by Global Election Systems Inc. All rights reserved. +* +* The authors hereby grant permission to use, copy, modify, distribute, +* and license this software and its documentation for any purpose, provided +* that existing copyright notices are retained in all copies and that this +* notice and the following disclaimer are included verbatim in any +* distributions. No written agreement, license, or royalty fee is required +* for any of the authorized uses. +* +* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +* IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +****************************************************************************** +* REVISION HISTORY +* +* 03-01-01 Marc Boucher +* Ported to lwIP. +* 97-12-08 Guy Lancaster , Global Election Systems Inc. +* Ported from public pppd code. +*****************************************************************************/ +/* + * auth.c - PPP authentication and phase control. + * + * Copyright (c) 1993 The Australian National University. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by the Australian National University. The name of the University + * may not be used to endorse or promote products derived from this + * software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * Copyright (c) 1989 Carnegie Mellon University. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by Carnegie Mellon University. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + +#include "lwip/opt.h" + +#if PPP_SUPPORT /* don't build if not configured for use in lwipopts.h */ + +#include "ppp.h" +#include "pppdebug.h" + +#include "fsm.h" +#include "lcp.h" +#include "pap.h" +#include "chap.h" +#include "auth.h" +#include "ipcp.h" + +#if CBCP_SUPPORT +#include "cbcp.h" +#endif /* CBCP_SUPPORT */ + +#include "lwip/inet.h" + +#include + +#if 0 /* UNUSED */ +/* Bits in scan_authfile return value */ +#define NONWILD_SERVER 1 +#define NONWILD_CLIENT 2 + +#define ISWILD(word) (word[0] == '*' && word[1] == 0) +#endif /* UNUSED */ + +#if PAP_SUPPORT || CHAP_SUPPORT +/* The name by which the peer authenticated itself to us. */ +static char peer_authname[MAXNAMELEN]; +#endif /* PAP_SUPPORT || CHAP_SUPPORT */ + +/* Records which authentication operations haven't completed yet. */ +static int auth_pending[NUM_PPP]; + +/* Set if we have successfully called plogin() */ +static int logged_in; + +/* Set if we have run the /etc/ppp/auth-up script. */ +static int did_authup; /* @todo, we don't need this in lwip*/ + +/* List of addresses which the peer may use. */ +static struct wordlist *addresses[NUM_PPP]; + +#if 0 /* UNUSED */ +/* Wordlist giving addresses which the peer may use + without authenticating itself. */ +static struct wordlist *noauth_addrs; + +/* Extra options to apply, from the secrets file entry for the peer. */ +static struct wordlist *extra_options; +#endif /* UNUSED */ + +/* Number of network protocols which we have opened. */ +static int num_np_open; + +/* Number of network protocols which have come up. */ +static int num_np_up; + +#if PAP_SUPPORT || CHAP_SUPPORT +/* Set if we got the contents of passwd[] from the pap-secrets file. */ +static int passwd_from_file; +#endif /* PAP_SUPPORT || CHAP_SUPPORT */ + +#if 0 /* UNUSED */ +/* Set if we require authentication only because we have a default route. */ +static bool default_auth; + +/* Hook to enable a plugin to control the idle time limit */ +int (*idle_time_hook) __P((struct ppp_idle *)) = NULL; + +/* Hook for a plugin to say whether we can possibly authenticate any peer */ +int (*pap_check_hook) __P((void)) = NULL; + +/* Hook for a plugin to check the PAP user and password */ +int (*pap_auth_hook) __P((char *user, char *passwd, char **msgp, + struct wordlist **paddrs, + struct wordlist **popts)) = NULL; + +/* Hook for a plugin to know about the PAP user logout */ +void (*pap_logout_hook) __P((void)) = NULL; + +/* Hook for a plugin to get the PAP password for authenticating us */ +int (*pap_passwd_hook) __P((char *user, char *passwd)) = NULL; + +/* + * This is used to ensure that we don't start an auth-up/down + * script while one is already running. + */ +enum script_state { + s_down, + s_up +}; + +static enum script_state auth_state = s_down; +static enum script_state auth_script_state = s_down; +static pid_t auth_script_pid = 0; + +/* + * Option variables. + * lwip: some of these are present in the ppp_settings structure + */ +bool uselogin = 0; /* Use /etc/passwd for checking PAP */ +bool cryptpap = 0; /* Passwords in pap-secrets are encrypted */ +bool refuse_pap = 0; /* Don't wanna auth. ourselves with PAP */ +bool refuse_chap = 0; /* Don't wanna auth. ourselves with CHAP */ +bool usehostname = 0; /* Use hostname for our_name */ +bool auth_required = 0; /* Always require authentication from peer */ +bool allow_any_ip = 0; /* Allow peer to use any IP address */ +bool explicit_remote = 0; /* User specified explicit remote name */ +char remote_name[MAXNAMELEN]; /* Peer's name for authentication */ + +#endif /* UNUSED */ + +/* Bits in auth_pending[] */ +#define PAP_WITHPEER 1 +#define PAP_PEER 2 +#define CHAP_WITHPEER 4 +#define CHAP_PEER 8 + +/* @todo, move this somewhere */ +/* Used for storing a sequence of words. Usually malloced. */ +struct wordlist { + struct wordlist *next; + char word[1]; +}; + + +extern char *crypt (const char *, const char *); + +/* Prototypes for procedures local to this file. */ + +static void network_phase (int); +static void check_idle (void *); +static void connect_time_expired (void *); +#if 0 +static int plogin (char *, char *, char **, int *); +#endif +static void plogout (void); +static int null_login (int); +static int get_pap_passwd (int, char *, char *); +static int have_pap_secret (void); +static int have_chap_secret (char *, char *, u32_t); +static int ip_addr_check (u32_t, struct wordlist *); + +#if 0 /* PAP_SUPPORT || CHAP_SUPPORT */ +static int scan_authfile (FILE *, char *, char *, char *, + struct wordlist **, struct wordlist **, + char *); +static void free_wordlist (struct wordlist *); +static void auth_script (char *); +static void auth_script_done (void *); +static void set_allowed_addrs (int unit, struct wordlist *addrs); +static int some_ip_ok (struct wordlist *); +static int setupapfile (char **); +static int privgroup (char **); +static int set_noauth_addr (char **); +static void check_access (FILE *, char *); +#endif /* 0 */ /* PAP_SUPPORT || CHAP_SUPPORT */ + +#if 0 /* UNUSED */ +/* + * Authentication-related options. + */ +option_t auth_options[] = { + { "require-pap", o_bool, &lcp_wantoptions[0].neg_upap, + "Require PAP authentication from peer", 1, &auth_required }, + { "+pap", o_bool, &lcp_wantoptions[0].neg_upap, + "Require PAP authentication from peer", 1, &auth_required }, + { "refuse-pap", o_bool, &refuse_pap, + "Don't agree to auth to peer with PAP", 1 }, + { "-pap", o_bool, &refuse_pap, + "Don't allow PAP authentication with peer", 1 }, + { "require-chap", o_bool, &lcp_wantoptions[0].neg_chap, + "Require CHAP authentication from peer", 1, &auth_required }, + { "+chap", o_bool, &lcp_wantoptions[0].neg_chap, + "Require CHAP authentication from peer", 1, &auth_required }, + { "refuse-chap", o_bool, &refuse_chap, + "Don't agree to auth to peer with CHAP", 1 }, + { "-chap", o_bool, &refuse_chap, + "Don't allow CHAP authentication with peer", 1 }, + { "name", o_string, our_name, + "Set local name for authentication", + OPT_PRIV|OPT_STATIC, NULL, MAXNAMELEN }, + { "user", o_string, user, + "Set name for auth with peer", OPT_STATIC, NULL, MAXNAMELEN }, + { "usehostname", o_bool, &usehostname, + "Must use hostname for authentication", 1 }, + { "remotename", o_string, remote_name, + "Set remote name for authentication", OPT_STATIC, + &explicit_remote, MAXNAMELEN }, + { "auth", o_bool, &auth_required, + "Require authentication from peer", 1 }, + { "noauth", o_bool, &auth_required, + "Don't require peer to authenticate", OPT_PRIV, &allow_any_ip }, + { "login", o_bool, &uselogin, + "Use system password database for PAP", 1 }, + { "papcrypt", o_bool, &cryptpap, + "PAP passwords are encrypted", 1 }, + { "+ua", o_special, (void *)setupapfile, + "Get PAP user and password from file" }, + { "password", o_string, passwd, + "Password for authenticating us to the peer", OPT_STATIC, + NULL, MAXSECRETLEN }, + { "privgroup", o_special, (void *)privgroup, + "Allow group members to use privileged options", OPT_PRIV }, + { "allow-ip", o_special, (void *)set_noauth_addr, + "Set IP address(es) which can be used without authentication", + OPT_PRIV }, + { NULL } +}; +#endif /* UNUSED */ +#if 0 /* UNUSED */ +/* + * setupapfile - specifies UPAP info for authenticating with peer. + */ +static int +setupapfile(char **argv) +{ + FILE * ufile; + int l; + + lcp_allowoptions[0].neg_upap = 1; + + /* open user info file */ + seteuid(getuid()); + ufile = fopen(*argv, "r"); + seteuid(0); + if (ufile == NULL) { + option_error("unable to open user login data file %s", *argv); + return 0; + } + check_access(ufile, *argv); + + /* get username */ + if (fgets(user, MAXNAMELEN - 1, ufile) == NULL + || fgets(passwd, MAXSECRETLEN - 1, ufile) == NULL){ + option_error("unable to read user login data file %s", *argv); + return 0; + } + fclose(ufile); + + /* get rid of newlines */ + l = strlen(user); + if (l > 0 && user[l-1] == '\n') + user[l-1] = 0; + l = strlen(passwd); + if (l > 0 && passwd[l-1] == '\n') + passwd[l-1] = 0; + + return (1); +} +#endif /* UNUSED */ + +#if 0 /* UNUSED */ +/* + * privgroup - allow members of the group to have privileged access. + */ +static int +privgroup(char **argv) +{ + struct group *g; + int i; + + g = getgrnam(*argv); + if (g == 0) { + option_error("group %s is unknown", *argv); + return 0; + } + for (i = 0; i < ngroups; ++i) { + if (groups[i] == g->gr_gid) { + privileged = 1; + break; + } + } + return 1; +} +#endif + +#if 0 /* UNUSED */ +/* + * set_noauth_addr - set address(es) that can be used without authentication. + * Equivalent to specifying an entry like `"" * "" addr' in pap-secrets. + */ +static int +set_noauth_addr(char **argv) +{ + char *addr = *argv; + int l = strlen(addr); + struct wordlist *wp; + + wp = (struct wordlist *) malloc(sizeof(struct wordlist) + l + 1); + if (wp == NULL) + novm("allow-ip argument"); + wp->word = (char *) (wp + 1); + wp->next = noauth_addrs; + BCOPY(addr, wp->word, l); + noauth_addrs = wp; + return 1; +} +#endif /* UNUSED */ + +/* + * An Open on LCP has requested a change from Dead to Establish phase. + * Do what's necessary to bring the physical layer up. + */ +void +link_required(int unit) +{ + LWIP_UNUSED_ARG(unit); + + AUTHDEBUG(LOG_INFO, ("link_required: %d\n", unit)); +} + +/* + * LCP has terminated the link; go to the Dead phase and take the + * physical layer down. + */ +void +link_terminated(int unit) +{ + AUTHDEBUG(LOG_INFO, ("link_terminated: %d\n", unit)); + if (lcp_phase[unit] == PHASE_DEAD) { + return; + } + if (logged_in) { + plogout(); + } + lcp_phase[unit] = PHASE_DEAD; + AUTHDEBUG(LOG_NOTICE, ("Connection terminated.\n")); + pppLinkTerminated(unit); +} + +/* + * LCP has gone down; it will either die or try to re-establish. + */ +void +link_down(int unit) +{ + int i; + struct protent *protp; + + AUTHDEBUG(LOG_INFO, ("link_down: %d\n", unit)); + + if (did_authup) { + /* XXX Do link down processing. */ + did_authup = 0; + } + for (i = 0; (protp = ppp_protocols[i]) != NULL; ++i) { + if (!protp->enabled_flag) { + continue; + } + if (protp->protocol != PPP_LCP && protp->lowerdown != NULL) { + (*protp->lowerdown)(unit); + } + if (protp->protocol < 0xC000 && protp->close != NULL) { + (*protp->close)(unit, "LCP down"); + } + } + num_np_open = 0; /* number of network protocols we have opened */ + num_np_up = 0; /* Number of network protocols which have come up */ + + if (lcp_phase[unit] != PHASE_DEAD) { + lcp_phase[unit] = PHASE_TERMINATE; + } + pppLinkDown(unit); +} + +/* + * The link is established. + * Proceed to the Dead, Authenticate or Network phase as appropriate. + */ +void +link_established(int unit) +{ + int auth; + int i; + struct protent *protp; + lcp_options *wo = &lcp_wantoptions[unit]; + lcp_options *go = &lcp_gotoptions[unit]; +#if PAP_SUPPORT || CHAP_SUPPORT + lcp_options *ho = &lcp_hisoptions[unit]; +#endif /* PAP_SUPPORT || CHAP_SUPPORT */ + + AUTHDEBUG(LOG_INFO, ("link_established: unit %d; Lowering up all protocols...\n", unit)); + /* + * Tell higher-level protocols that LCP is up. + */ + for (i = 0; (protp = ppp_protocols[i]) != NULL; ++i) { + if (protp->protocol != PPP_LCP && protp->enabled_flag && protp->lowerup != NULL) { + (*protp->lowerup)(unit); + } + } + if (ppp_settings.auth_required && !(go->neg_chap || go->neg_upap)) { + /* + * We wanted the peer to authenticate itself, and it refused: + * treat it as though it authenticated with PAP using a username + * of "" and a password of "". If that's not OK, boot it out. + */ + if (!wo->neg_upap || !null_login(unit)) { + AUTHDEBUG(LOG_WARNING, ("peer refused to authenticate\n")); + lcp_close(unit, "peer refused to authenticate"); + return; + } + } + + lcp_phase[unit] = PHASE_AUTHENTICATE; + auth = 0; +#if CHAP_SUPPORT + if (go->neg_chap) { + ChapAuthPeer(unit, ppp_settings.our_name, go->chap_mdtype); + auth |= CHAP_PEER; + } +#endif /* CHAP_SUPPORT */ +#if PAP_SUPPORT && CHAP_SUPPORT + else +#endif /* PAP_SUPPORT && CHAP_SUPPORT */ +#if PAP_SUPPORT + if (go->neg_upap) { + upap_authpeer(unit); + auth |= PAP_PEER; + } +#endif /* PAP_SUPPORT */ +#if CHAP_SUPPORT + if (ho->neg_chap) { + ChapAuthWithPeer(unit, ppp_settings.user, ho->chap_mdtype); + auth |= CHAP_WITHPEER; + } +#endif /* CHAP_SUPPORT */ +#if PAP_SUPPORT && CHAP_SUPPORT + else +#endif /* PAP_SUPPORT && CHAP_SUPPORT */ +#if PAP_SUPPORT + if (ho->neg_upap) { + if (ppp_settings.passwd[0] == 0) { + passwd_from_file = 1; + if (!get_pap_passwd(unit, ppp_settings.user, ppp_settings.passwd)) { + AUTHDEBUG(LOG_ERR, ("No secret found for PAP login\n")); + } + } + upap_authwithpeer(unit, ppp_settings.user, ppp_settings.passwd); + auth |= PAP_WITHPEER; + } +#endif /* PAP_SUPPORT */ + auth_pending[unit] = auth; + + if (!auth) { + network_phase(unit); + } +} + +/* + * Proceed to the network phase. + */ +static void +network_phase(int unit) +{ + int i; + struct protent *protp; + lcp_options *go = &lcp_gotoptions[unit]; + + /* + * If the peer had to authenticate, run the auth-up script now. + */ + if ((go->neg_chap || go->neg_upap) && !did_authup) { + /* XXX Do setup for peer authentication. */ + did_authup = 1; + } + +#if CBCP_SUPPORT + /* + * If we negotiated callback, do it now. + */ + if (go->neg_cbcp) { + lcp_phase[unit] = PHASE_CALLBACK; + (*cbcp_protent.open)(unit); + return; + } +#endif /* CBCP_SUPPORT */ + + lcp_phase[unit] = PHASE_NETWORK; + for (i = 0; (protp = ppp_protocols[i]) != NULL; ++i) { + if (protp->protocol < 0xC000 && protp->enabled_flag && protp->open != NULL) { + (*protp->open)(unit); + if (protp->protocol != PPP_CCP) { + ++num_np_open; + } + } + } + + if (num_np_open == 0) { + /* nothing to do */ + lcp_close(0, "No network protocols running"); + } +} +/* @todo: add void start_networks(void) here (pppd 2.3.11) */ + +/* + * The peer has failed to authenticate himself using `protocol'. + */ +void +auth_peer_fail(int unit, u16_t protocol) +{ + LWIP_UNUSED_ARG(protocol); + + AUTHDEBUG(LOG_INFO, ("auth_peer_fail: %d proto=%X\n", unit, protocol)); + /* + * Authentication failure: take the link down + */ + lcp_close(unit, "Authentication failed"); +} + + +#if PAP_SUPPORT || CHAP_SUPPORT +/* + * The peer has been successfully authenticated using `protocol'. + */ +void +auth_peer_success(int unit, u16_t protocol, char *name, int namelen) +{ + int pbit; + + AUTHDEBUG(LOG_INFO, ("auth_peer_success: %d proto=%X\n", unit, protocol)); + switch (protocol) { + case PPP_CHAP: + pbit = CHAP_PEER; + break; + case PPP_PAP: + pbit = PAP_PEER; + break; + default: + AUTHDEBUG(LOG_WARNING, ("auth_peer_success: unknown protocol %x\n", protocol)); + return; + } + + /* + * Save the authenticated name of the peer for later. + */ + if (namelen > (int)sizeof(peer_authname) - 1) { + namelen = sizeof(peer_authname) - 1; + } + BCOPY(name, peer_authname, namelen); + peer_authname[namelen] = 0; + + /* + * If there is no more authentication still to be done, + * proceed to the network (or callback) phase. + */ + if ((auth_pending[unit] &= ~pbit) == 0) { + network_phase(unit); + } +} + +/* + * We have failed to authenticate ourselves to the peer using `protocol'. + */ +void +auth_withpeer_fail(int unit, u16_t protocol) +{ + int errCode = PPPERR_AUTHFAIL; + + LWIP_UNUSED_ARG(protocol); + + AUTHDEBUG(LOG_INFO, ("auth_withpeer_fail: %d proto=%X\n", unit, protocol)); + if (passwd_from_file) { + BZERO(ppp_settings.passwd, MAXSECRETLEN); + } + + /* + * We've failed to authenticate ourselves to our peer. + * He'll probably take the link down, and there's not much + * we can do except wait for that. + */ + pppIOCtl(unit, PPPCTLS_ERRCODE, &errCode); + lcp_close(unit, "Failed to authenticate ourselves to peer"); +} + +/* + * We have successfully authenticated ourselves with the peer using `protocol'. + */ +void +auth_withpeer_success(int unit, u16_t protocol) +{ + int pbit; + + AUTHDEBUG(LOG_INFO, ("auth_withpeer_success: %d proto=%X\n", unit, protocol)); + switch (protocol) { + case PPP_CHAP: + pbit = CHAP_WITHPEER; + break; + case PPP_PAP: + if (passwd_from_file) { + BZERO(ppp_settings.passwd, MAXSECRETLEN); + } + pbit = PAP_WITHPEER; + break; + default: + AUTHDEBUG(LOG_WARNING, ("auth_peer_success: unknown protocol %x\n", protocol)); + pbit = 0; + } + + /* + * If there is no more authentication still being done, + * proceed to the network (or callback) phase. + */ + if ((auth_pending[unit] &= ~pbit) == 0) { + network_phase(unit); + } +} +#endif /* PAP_SUPPORT || CHAP_SUPPORT */ + + +/* + * np_up - a network protocol has come up. + */ +void +np_up(int unit, u16_t proto) +{ + LWIP_UNUSED_ARG(unit); + LWIP_UNUSED_ARG(proto); + + AUTHDEBUG(LOG_INFO, ("np_up: %d proto=%X\n", unit, proto)); + if (num_np_up == 0) { + AUTHDEBUG(LOG_INFO, ("np_up: maxconnect=%d idle_time_limit=%d\n",ppp_settings.maxconnect,ppp_settings.idle_time_limit)); + /* + * At this point we consider that the link has come up successfully. + */ + if (ppp_settings.idle_time_limit > 0) { + TIMEOUT(check_idle, NULL, ppp_settings.idle_time_limit); + } + + /* + * Set a timeout to close the connection once the maximum + * connect time has expired. + */ + if (ppp_settings.maxconnect > 0) { + TIMEOUT(connect_time_expired, 0, ppp_settings.maxconnect); + } + } + ++num_np_up; +} + +/* + * np_down - a network protocol has gone down. + */ +void +np_down(int unit, u16_t proto) +{ + LWIP_UNUSED_ARG(unit); + LWIP_UNUSED_ARG(proto); + + AUTHDEBUG(LOG_INFO, ("np_down: %d proto=%X\n", unit, proto)); + if (--num_np_up == 0 && ppp_settings.idle_time_limit > 0) { + UNTIMEOUT(check_idle, NULL); + } +} + +/* + * np_finished - a network protocol has finished using the link. + */ +void +np_finished(int unit, u16_t proto) +{ + LWIP_UNUSED_ARG(unit); + LWIP_UNUSED_ARG(proto); + + AUTHDEBUG(LOG_INFO, ("np_finished: %d proto=%X\n", unit, proto)); + if (--num_np_open <= 0) { + /* no further use for the link: shut up shop. */ + lcp_close(0, "No network protocols running"); + } +} + +/* + * check_idle - check whether the link has been idle for long + * enough that we can shut it down. + */ +static void +check_idle(void *arg) +{ + struct ppp_idle idle; + u_short itime; + + LWIP_UNUSED_ARG(arg); + if (!get_idle_time(0, &idle)) { + return; + } + itime = LWIP_MIN(idle.xmit_idle, idle.recv_idle); + if (itime >= ppp_settings.idle_time_limit) { + /* link is idle: shut it down. */ + AUTHDEBUG(LOG_INFO, ("Terminating connection due to lack of activity.\n")); + lcp_close(0, "Link inactive"); + } else { + TIMEOUT(check_idle, NULL, ppp_settings.idle_time_limit - itime); + } +} + +/* + * connect_time_expired - log a message and close the connection. + */ +static void +connect_time_expired(void *arg) +{ + LWIP_UNUSED_ARG(arg); + + AUTHDEBUG(LOG_INFO, ("Connect time expired\n")); + lcp_close(0, "Connect time expired"); /* Close connection */ +} + +#if 0 /* UNUSED */ +/* + * auth_check_options - called to check authentication options. + */ +void +auth_check_options(void) +{ + lcp_options *wo = &lcp_wantoptions[0]; + int can_auth; + ipcp_options *ipwo = &ipcp_wantoptions[0]; + u32_t remote; + + /* Default our_name to hostname, and user to our_name */ + if (ppp_settings.our_name[0] == 0 || ppp_settings.usehostname) { + strcpy(ppp_settings.our_name, ppp_settings.hostname); + } + + if (ppp_settings.user[0] == 0) { + strcpy(ppp_settings.user, ppp_settings.our_name); + } + + /* If authentication is required, ask peer for CHAP or PAP. */ + if (ppp_settings.auth_required && !wo->neg_chap && !wo->neg_upap) { + wo->neg_chap = 1; + wo->neg_upap = 1; + } + + /* + * Check whether we have appropriate secrets to use + * to authenticate the peer. + */ + can_auth = wo->neg_upap && have_pap_secret(); + if (!can_auth && wo->neg_chap) { + remote = ipwo->accept_remote? 0: ipwo->hisaddr; + can_auth = have_chap_secret(ppp_settings.remote_name, ppp_settings.our_name, remote); + } + + if (ppp_settings.auth_required && !can_auth) { + ppp_panic("No auth secret"); + } +} +#endif /* UNUSED */ + +/* + * auth_reset - called when LCP is starting negotiations to recheck + * authentication options, i.e. whether we have appropriate secrets + * to use for authenticating ourselves and/or the peer. + */ +void +auth_reset(int unit) +{ + lcp_options *go = &lcp_gotoptions[unit]; + lcp_options *ao = &lcp_allowoptions[0]; + ipcp_options *ipwo = &ipcp_wantoptions[0]; + u32_t remote; + + AUTHDEBUG(LOG_INFO, ("auth_reset: %d\n", unit)); + ao->neg_upap = !ppp_settings.refuse_pap && (ppp_settings.passwd[0] != 0 || get_pap_passwd(unit, NULL, NULL)); + ao->neg_chap = !ppp_settings.refuse_chap && ppp_settings.passwd[0] != 0 /*have_chap_secret(ppp_settings.user, ppp_settings.remote_name, (u32_t)0)*/; + + if (go->neg_upap && !have_pap_secret()) { + go->neg_upap = 0; + } + if (go->neg_chap) { + remote = ipwo->accept_remote? 0: ipwo->hisaddr; + if (!have_chap_secret(ppp_settings.remote_name, ppp_settings.our_name, remote)) { + go->neg_chap = 0; + } + } +} + +#if PAP_SUPPORT +/* + * check_passwd - Check the user name and passwd against the PAP secrets + * file. If requested, also check against the system password database, + * and login the user if OK. + * + * returns: + * UPAP_AUTHNAK: Authentication failed. + * UPAP_AUTHACK: Authentication succeeded. + * In either case, msg points to an appropriate message. + */ +u_char +check_passwd( int unit, char *auser, int userlen, char *apasswd, int passwdlen, char **msg, int *msglen) +{ +#if 1 /* XXX Assume all entries OK. */ + LWIP_UNUSED_ARG(unit); + LWIP_UNUSED_ARG(auser); + LWIP_UNUSED_ARG(userlen); + LWIP_UNUSED_ARG(apasswd); + LWIP_UNUSED_ARG(passwdlen); + LWIP_UNUSED_ARG(msglen); + *msg = (char *) 0; + return UPAP_AUTHACK; /* XXX Assume all entries OK. */ +#else + u_char ret = 0; + struct wordlist *addrs = NULL; + char passwd[256], user[256]; + char secret[MAXWORDLEN]; + static u_short attempts = 0; + + /* + * Make copies of apasswd and auser, then null-terminate them. + */ + BCOPY(apasswd, passwd, passwdlen); + passwd[passwdlen] = '\0'; + BCOPY(auser, user, userlen); + user[userlen] = '\0'; + *msg = (char *) 0; + + /* XXX Validate user name and password. */ + ret = UPAP_AUTHACK; /* XXX Assume all entries OK. */ + + if (ret == UPAP_AUTHNAK) { + if (*msg == (char *) 0) { + *msg = "Login incorrect"; + } + *msglen = strlen(*msg); + /* + * Frustrate passwd stealer programs. + * Allow 10 tries, but start backing off after 3 (stolen from login). + * On 10'th, drop the connection. + */ + if (attempts++ >= 10) { + AUTHDEBUG(LOG_WARNING, ("%d LOGIN FAILURES BY %s\n", attempts, user)); + /*ppp_panic("Excess Bad Logins");*/ + } + if (attempts > 3) { + /* @todo: this was sleep(), i.e. seconds, not milliseconds + * I don't think we really need this in lwIP - we would block tcpip_thread! + */ + /*sys_msleep((attempts - 3) * 5);*/ + } + if (addrs != NULL) { + free_wordlist(addrs); + } + } else { + attempts = 0; /* Reset count */ + if (*msg == (char *) 0) { + *msg = "Login ok"; + } + *msglen = strlen(*msg); + set_allowed_addrs(unit, addrs); + } + + BZERO(passwd, sizeof(passwd)); + BZERO(secret, sizeof(secret)); + + return ret; +#endif +} +#endif /* PAP_SUPPORT */ + +#if 0 /* UNUSED */ +/* + * This function is needed for PAM. + */ + +#ifdef USE_PAM + +/* lwip does not support PAM*/ + +#endif /* USE_PAM */ + +#endif /* UNUSED */ + + +#if 0 /* UNUSED */ +/* + * plogin - Check the user name and password against the system + * password database, and login the user if OK. + * + * returns: + * UPAP_AUTHNAK: Login failed. + * UPAP_AUTHACK: Login succeeded. + * In either case, msg points to an appropriate message. + */ +static int +plogin(char *user, char *passwd, char **msg, int *msglen) +{ + + LWIP_UNUSED_ARG(user); + LWIP_UNUSED_ARG(passwd); + LWIP_UNUSED_ARG(msg); + LWIP_UNUSED_ARG(msglen); + + + /* The new lines are here align the file when + * compared against the pppd 2.3.11 code */ + + + + + + + + + + + + + + + + + /* XXX Fail until we decide that we want to support logins. */ + return (UPAP_AUTHNAK); +} +#endif + + + +/* + * plogout - Logout the user. + */ +static void +plogout(void) +{ + logged_in = 0; +} + +/* + * null_login - Check if a username of "" and a password of "" are + * acceptable, and iff so, set the list of acceptable IP addresses + * and return 1. + */ +static int +null_login(int unit) +{ + LWIP_UNUSED_ARG(unit); + /* XXX Fail until we decide that we want to support logins. */ + return 0; +} + + +/* + * get_pap_passwd - get a password for authenticating ourselves with + * our peer using PAP. Returns 1 on success, 0 if no suitable password + * could be found. + */ +static int +get_pap_passwd(int unit, char *user, char *passwd) +{ + LWIP_UNUSED_ARG(unit); +/* normally we would reject PAP if no password is provided, + but this causes problems with some providers (like CHT in Taiwan) + who incorrectly request PAP and expect a bogus/empty password, so + always provide a default user/passwd of "none"/"none" + + @todo: This should be configured by the user, instead of being hardcoded here! +*/ + if(user) { + strcpy(user, "none"); + } + if(passwd) { + strcpy(passwd, "none"); + } + return 1; +} + +/* + * have_pap_secret - check whether we have a PAP file with any + * secrets that we could possibly use for authenticating the peer. + */ +static int +have_pap_secret(void) +{ + /* XXX Fail until we set up our passwords. */ + return 0; +} + +/* + * have_chap_secret - check whether we have a CHAP file with a + * secret that we could possibly use for authenticating `client' + * on `server'. Either can be the null string, meaning we don't + * know the identity yet. + */ +static int +have_chap_secret(char *client, char *server, u32_t remote) +{ + LWIP_UNUSED_ARG(client); + LWIP_UNUSED_ARG(server); + LWIP_UNUSED_ARG(remote); + + /* XXX Fail until we set up our passwords. */ + return 0; +} +#if CHAP_SUPPORT + +/* + * get_secret - open the CHAP secret file and return the secret + * for authenticating the given client on the given server. + * (We could be either client or server). + */ +int +get_secret(int unit, char *client, char *server, char *secret, int *secret_len, int save_addrs) +{ +#if 1 + int len; + struct wordlist *addrs; + + LWIP_UNUSED_ARG(unit); + LWIP_UNUSED_ARG(server); + LWIP_UNUSED_ARG(save_addrs); + + addrs = NULL; + + if(!client || !client[0] || strcmp(client, ppp_settings.user)) { + return 0; + } + + len = (int)strlen(ppp_settings.passwd); + if (len > MAXSECRETLEN) { + AUTHDEBUG(LOG_ERR, ("Secret for %s on %s is too long\n", client, server)); + len = MAXSECRETLEN; + } + + BCOPY(ppp_settings.passwd, secret, len); + *secret_len = len; + + return 1; +#else + int ret = 0, len; + struct wordlist *addrs; + char secbuf[MAXWORDLEN]; + + addrs = NULL; + secbuf[0] = 0; + + /* XXX Find secret. */ + if (ret < 0) { + return 0; + } + + if (save_addrs) { + set_allowed_addrs(unit, addrs); + } + + len = strlen(secbuf); + if (len > MAXSECRETLEN) { + AUTHDEBUG(LOG_ERR, ("Secret for %s on %s is too long\n", client, server)); + len = MAXSECRETLEN; + } + + BCOPY(secbuf, secret, len); + BZERO(secbuf, sizeof(secbuf)); + *secret_len = len; + + return 1; +#endif +} +#endif /* CHAP_SUPPORT */ + + +#if 0 /* PAP_SUPPORT || CHAP_SUPPORT */ +/* + * set_allowed_addrs() - set the list of allowed addresses. + */ +static void +set_allowed_addrs(int unit, struct wordlist *addrs) +{ + if (addresses[unit] != NULL) { + free_wordlist(addresses[unit]); + } + addresses[unit] = addrs; + +#if 0 + /* + * If there's only one authorized address we might as well + * ask our peer for that one right away + */ + if (addrs != NULL && addrs->next == NULL) { + char *p = addrs->word; + struct ipcp_options *wo = &ipcp_wantoptions[unit]; + u32_t a; + struct hostent *hp; + + if (wo->hisaddr == 0 && *p != '!' && *p != '-' && strchr(p, '/') == NULL) { + hp = gethostbyname(p); + if (hp != NULL && hp->h_addrtype == AF_INET) { + a = *(u32_t *)hp->h_addr; + } else { + a = inet_addr(p); + } + if (a != (u32_t) -1) { + wo->hisaddr = a; + } + } + } +#endif +} +#endif /* 0 */ /* PAP_SUPPORT || CHAP_SUPPORT */ + +/* + * auth_ip_addr - check whether the peer is authorized to use + * a given IP address. Returns 1 if authorized, 0 otherwise. + */ +int +auth_ip_addr(int unit, u32_t addr) +{ + return ip_addr_check(addr, addresses[unit]); +} + +static int /* @todo: integrate this funtion into auth_ip_addr()*/ +ip_addr_check(u32_t addr, struct wordlist *addrs) +{ + /* don't allow loopback or multicast address */ + if (bad_ip_adrs(addr)) { + return 0; + } + + if (addrs == NULL) { + return !ppp_settings.auth_required; /* no addresses authorized */ + } + + /* XXX All other addresses allowed. */ + return 1; +} + +/* + * bad_ip_adrs - return 1 if the IP address is one we don't want + * to use, such as an address in the loopback net or a multicast address. + * addr is in network byte order. + */ +int +bad_ip_adrs(u32_t addr) +{ + addr = ntohl(addr); + return (addr >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET + || IN_MULTICAST(addr) || IN_BADCLASS(addr); +} + +#if 0 /* UNUSED */ /* PAP_SUPPORT || CHAP_SUPPORT */ +/* + * some_ip_ok - check a wordlist to see if it authorizes any + * IP address(es). + */ +static int +some_ip_ok(struct wordlist *addrs) +{ + for (; addrs != 0; addrs = addrs->next) { + if (addrs->word[0] == '-') + break; + if (addrs->word[0] != '!') + return 1; /* some IP address is allowed */ + } + return 0; +} + +/* + * check_access - complain if a secret file has too-liberal permissions. + */ +static void +check_access(FILE *f, char *filename) +{ + struct stat sbuf; + + if (fstat(fileno(f), &sbuf) < 0) { + warn("cannot stat secret file %s: %m", filename); + } else if ((sbuf.st_mode & (S_IRWXG | S_IRWXO)) != 0) { + warn("Warning - secret file %s has world and/or group access", + filename); + } +} + + +/* + * scan_authfile - Scan an authorization file for a secret suitable + * for authenticating `client' on `server'. The return value is -1 + * if no secret is found, otherwise >= 0. The return value has + * NONWILD_CLIENT set if the secret didn't have "*" for the client, and + * NONWILD_SERVER set if the secret didn't have "*" for the server. + * Any following words on the line up to a "--" (i.e. address authorization + * info) are placed in a wordlist and returned in *addrs. Any + * following words (extra options) are placed in a wordlist and + * returned in *opts. + * We assume secret is NULL or points to MAXWORDLEN bytes of space. + */ +static int +scan_authfile(FILE *f, char *client, char *server, char *secret, struct wordlist **addrs, struct wordlist **opts, char *filename) +{ + /* We do not (currently) need this in lwip */ + return 0; /* dummy */ +} +/* + * free_wordlist - release memory allocated for a wordlist. + */ +static void +free_wordlist(struct wordlist *wp) +{ + struct wordlist *next; + + while (wp != NULL) { + next = wp->next; + free(wp); + wp = next; + } +} + +/* + * auth_script_done - called when the auth-up or auth-down script + * has finished. + */ +static void +auth_script_done(void *arg) +{ + auth_script_pid = 0; + switch (auth_script_state) { + case s_up: + if (auth_state == s_down) { + auth_script_state = s_down; + auth_script(_PATH_AUTHDOWN); + } + break; + case s_down: + if (auth_state == s_up) { + auth_script_state = s_up; + auth_script(_PATH_AUTHUP); + } + break; + } +} + +/* + * auth_script - execute a script with arguments + * interface-name peer-name real-user tty speed + */ +static void +auth_script(char *script) +{ + char strspeed[32]; + struct passwd *pw; + char struid[32]; + char *user_name; + char *argv[8]; + + if ((pw = getpwuid(getuid())) != NULL && pw->pw_name != NULL) + user_name = pw->pw_name; + else { + slprintf(struid, sizeof(struid), "%d", getuid()); + user_name = struid; + } + slprintf(strspeed, sizeof(strspeed), "%d", baud_rate); + + argv[0] = script; + argv[1] = ifname; + argv[2] = peer_authname; + argv[3] = user_name; + argv[4] = devnam; + argv[5] = strspeed; + argv[6] = NULL; + + auth_script_pid = run_program(script, argv, 0, auth_script_done, NULL); +} +#endif /* 0 */ /* PAP_SUPPORT || CHAP_SUPPORT */ +#endif /* PPP_SUPPORT */ diff --git a/lib/drivers/lwip/src/netif/ppp/auth.h b/lib/drivers/lwip/src/netif/ppp/auth.h new file mode 100644 index 00000000000..a8069ec4640 --- /dev/null +++ b/lib/drivers/lwip/src/netif/ppp/auth.h @@ -0,0 +1,111 @@ +/***************************************************************************** +* auth.h - PPP Authentication and phase control header file. +* +* Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc. +* portions Copyright (c) 1998 Global Election Systems Inc. +* +* The authors hereby grant permission to use, copy, modify, distribute, +* and license this software and its documentation for any purpose, provided +* that existing copyright notices are retained in all copies and that this +* notice and the following disclaimer are included verbatim in any +* distributions. No written agreement, license, or royalty fee is required +* for any of the authorized uses. +* +* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +* IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +****************************************************************************** +* REVISION HISTORY +* +* 03-01-01 Marc Boucher +* Ported to lwIP. +* 97-12-04 Guy Lancaster , Global Election Systems Inc. +* Original derived from BSD pppd.h. +*****************************************************************************/ +/* + * pppd.h - PPP daemon global declarations. + * + * Copyright (c) 1989 Carnegie Mellon University. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by Carnegie Mellon University. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + */ + +#ifndef AUTH_H +#define AUTH_H + +/*********************** +*** PUBLIC FUNCTIONS *** +***********************/ + +/* we are starting to use the link */ +void link_required (int); + +/* we are finished with the link */ +void link_terminated (int); + +/* the LCP layer has left the Opened state */ +void link_down (int); + +/* the link is up; authenticate now */ +void link_established (int); + +/* a network protocol has come up */ +void np_up (int, u16_t); + +/* a network protocol has gone down */ +void np_down (int, u16_t); + +/* a network protocol no longer needs link */ +void np_finished (int, u16_t); + +/* peer failed to authenticate itself */ +void auth_peer_fail (int, u16_t); + +/* peer successfully authenticated itself */ +void auth_peer_success (int, u16_t, char *, int); + +/* we failed to authenticate ourselves */ +void auth_withpeer_fail (int, u16_t); + +/* we successfully authenticated ourselves */ +void auth_withpeer_success (int, u16_t); + +/* check authentication options supplied */ +void auth_check_options (void); + +/* check what secrets we have */ +void auth_reset (int); + +/* Check peer-supplied username/password */ +u_char check_passwd (int, char *, int, char *, int, char **, int *); + +/* get "secret" for chap */ +int get_secret (int, char *, char *, char *, int *, int); + +/* check if IP address is authorized */ +int auth_ip_addr (int, u32_t); + +/* check if IP address is unreasonable */ +int bad_ip_adrs (u32_t); + +#endif /* AUTH_H */ diff --git a/lib/drivers/lwip/src/netif/ppp/chap.c b/lib/drivers/lwip/src/netif/ppp/chap.c new file mode 100644 index 00000000000..3a49ff8a5e4 --- /dev/null +++ b/lib/drivers/lwip/src/netif/ppp/chap.c @@ -0,0 +1,908 @@ +/*** WARNING - THIS HAS NEVER BEEN FINISHED ***/ +/***************************************************************************** +* chap.c - Network Challenge Handshake Authentication Protocol program file. +* +* Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc. +* portions Copyright (c) 1997 by Global Election Systems Inc. +* +* The authors hereby grant permission to use, copy, modify, distribute, +* and license this software and its documentation for any purpose, provided +* that existing copyright notices are retained in all copies and that this +* notice and the following disclaimer are included verbatim in any +* distributions. No written agreement, license, or royalty fee is required +* for any of the authorized uses. +* +* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +* IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +****************************************************************************** +* REVISION HISTORY +* +* 03-01-01 Marc Boucher +* Ported to lwIP. +* 97-12-04 Guy Lancaster , Global Election Systems Inc. +* Original based on BSD chap.c. +*****************************************************************************/ +/* + * chap.c - Challenge Handshake Authentication Protocol. + * + * Copyright (c) 1993 The Australian National University. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by the Australian National University. The name of the University + * may not be used to endorse or promote products derived from this + * software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * Copyright (c) 1991 Gregory M. Christy. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by Gregory M. Christy. The name of the author may not be used to + * endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + +#include "lwip/opt.h" + +#if PPP_SUPPORT /* don't build if not configured for use in lwipopts.h */ + +#if CHAP_SUPPORT /* don't build if not configured for use in lwipopts.h */ + +#include "ppp.h" +#include "pppdebug.h" + +#include "magic.h" +#include "randm.h" +#include "auth.h" +#include "md5.h" +#include "chap.h" +#include "chpms.h" + +#include + +#if 0 /* UNUSED */ +/* + * Command-line options. + */ +static option_t chap_option_list[] = { + { "chap-restart", o_int, &chap[0].timeouttime, + "Set timeout for CHAP" }, + { "chap-max-challenge", o_int, &chap[0].max_transmits, + "Set max #xmits for challenge" }, + { "chap-interval", o_int, &chap[0].chal_interval, + "Set interval for rechallenge" }, +#ifdef MSLANMAN + { "ms-lanman", o_bool, &ms_lanman, + "Use LanMan passwd when using MS-CHAP", 1 }, +#endif + { NULL } +}; +#endif /* UNUSED */ + +/* + * Protocol entry points. + */ +static void ChapInit (int); +static void ChapLowerUp (int); +static void ChapLowerDown (int); +static void ChapInput (int, u_char *, int); +static void ChapProtocolReject (int); +#if PPP_ADDITIONAL_CALLBACKS +static int ChapPrintPkt (u_char *, int, void (*) (void *, char *, ...), void *); +#endif + +struct protent chap_protent = { + PPP_CHAP, + ChapInit, + ChapInput, + ChapProtocolReject, + ChapLowerUp, + ChapLowerDown, + NULL, + NULL, +#if PPP_ADDITIONAL_CALLBACKS + ChapPrintPkt, + NULL, +#endif /* PPP_ADDITIONAL_CALLBACKS */ + 1, + "CHAP", +#if PPP_ADDITIONAL_CALLBACKS + NULL, + NULL, + NULL +#endif /* PPP_ADDITIONAL_CALLBACKS */ +}; + +chap_state chap[NUM_PPP]; /* CHAP state; one for each unit */ + +static void ChapChallengeTimeout (void *); +static void ChapResponseTimeout (void *); +static void ChapReceiveChallenge (chap_state *, u_char *, u_char, int); +static void ChapRechallenge (void *); +static void ChapReceiveResponse (chap_state *, u_char *, int, int); +static void ChapReceiveSuccess(chap_state *cstate, u_char *inp, u_char id, int len); +static void ChapReceiveFailure(chap_state *cstate, u_char *inp, u_char id, int len); +static void ChapSendStatus (chap_state *, int); +static void ChapSendChallenge (chap_state *); +static void ChapSendResponse (chap_state *); +static void ChapGenChallenge (chap_state *); + +/* + * ChapInit - Initialize a CHAP unit. + */ +static void +ChapInit(int unit) +{ + chap_state *cstate = &chap[unit]; + + BZERO(cstate, sizeof(*cstate)); + cstate->unit = unit; + cstate->clientstate = CHAPCS_INITIAL; + cstate->serverstate = CHAPSS_INITIAL; + cstate->timeouttime = CHAP_DEFTIMEOUT; + cstate->max_transmits = CHAP_DEFTRANSMITS; + /* random number generator is initialized in magic_init */ +} + + +/* + * ChapAuthWithPeer - Authenticate us with our peer (start client). + * + */ +void +ChapAuthWithPeer(int unit, char *our_name, u_char digest) +{ + chap_state *cstate = &chap[unit]; + + cstate->resp_name = our_name; + cstate->resp_type = digest; + + if (cstate->clientstate == CHAPCS_INITIAL || + cstate->clientstate == CHAPCS_PENDING) { + /* lower layer isn't up - wait until later */ + cstate->clientstate = CHAPCS_PENDING; + return; + } + + /* + * We get here as a result of LCP coming up. + * So even if CHAP was open before, we will + * have to re-authenticate ourselves. + */ + cstate->clientstate = CHAPCS_LISTEN; +} + + +/* + * ChapAuthPeer - Authenticate our peer (start server). + */ +void +ChapAuthPeer(int unit, char *our_name, u_char digest) +{ + chap_state *cstate = &chap[unit]; + + cstate->chal_name = our_name; + cstate->chal_type = digest; + + if (cstate->serverstate == CHAPSS_INITIAL || + cstate->serverstate == CHAPSS_PENDING) { + /* lower layer isn't up - wait until later */ + cstate->serverstate = CHAPSS_PENDING; + return; + } + + ChapGenChallenge(cstate); + ChapSendChallenge(cstate); /* crank it up dude! */ + cstate->serverstate = CHAPSS_INITIAL_CHAL; +} + + +/* + * ChapChallengeTimeout - Timeout expired on sending challenge. + */ +static void +ChapChallengeTimeout(void *arg) +{ + chap_state *cstate = (chap_state *) arg; + + /* if we aren't sending challenges, don't worry. then again we */ + /* probably shouldn't be here either */ + if (cstate->serverstate != CHAPSS_INITIAL_CHAL && + cstate->serverstate != CHAPSS_RECHALLENGE) { + return; + } + + if (cstate->chal_transmits >= cstate->max_transmits) { + /* give up on peer */ + CHAPDEBUG(LOG_ERR, ("Peer failed to respond to CHAP challenge\n")); + cstate->serverstate = CHAPSS_BADAUTH; + auth_peer_fail(cstate->unit, PPP_CHAP); + return; + } + + ChapSendChallenge(cstate); /* Re-send challenge */ +} + + +/* + * ChapResponseTimeout - Timeout expired on sending response. + */ +static void +ChapResponseTimeout(void *arg) +{ + chap_state *cstate = (chap_state *) arg; + + /* if we aren't sending a response, don't worry. */ + if (cstate->clientstate != CHAPCS_RESPONSE) { + return; + } + + ChapSendResponse(cstate); /* re-send response */ +} + + +/* + * ChapRechallenge - Time to challenge the peer again. + */ +static void +ChapRechallenge(void *arg) +{ + chap_state *cstate = (chap_state *) arg; + + /* if we aren't sending a response, don't worry. */ + if (cstate->serverstate != CHAPSS_OPEN) { + return; + } + + ChapGenChallenge(cstate); + ChapSendChallenge(cstate); + cstate->serverstate = CHAPSS_RECHALLENGE; +} + + +/* + * ChapLowerUp - The lower layer is up. + * + * Start up if we have pending requests. + */ +static void +ChapLowerUp(int unit) +{ + chap_state *cstate = &chap[unit]; + + if (cstate->clientstate == CHAPCS_INITIAL) { + cstate->clientstate = CHAPCS_CLOSED; + } else if (cstate->clientstate == CHAPCS_PENDING) { + cstate->clientstate = CHAPCS_LISTEN; + } + + if (cstate->serverstate == CHAPSS_INITIAL) { + cstate->serverstate = CHAPSS_CLOSED; + } else if (cstate->serverstate == CHAPSS_PENDING) { + ChapGenChallenge(cstate); + ChapSendChallenge(cstate); + cstate->serverstate = CHAPSS_INITIAL_CHAL; + } +} + + +/* + * ChapLowerDown - The lower layer is down. + * + * Cancel all timeouts. + */ +static void +ChapLowerDown(int unit) +{ + chap_state *cstate = &chap[unit]; + + /* Timeout(s) pending? Cancel if so. */ + if (cstate->serverstate == CHAPSS_INITIAL_CHAL || + cstate->serverstate == CHAPSS_RECHALLENGE) { + UNTIMEOUT(ChapChallengeTimeout, cstate); + } else if (cstate->serverstate == CHAPSS_OPEN + && cstate->chal_interval != 0) { + UNTIMEOUT(ChapRechallenge, cstate); + } + if (cstate->clientstate == CHAPCS_RESPONSE) { + UNTIMEOUT(ChapResponseTimeout, cstate); + } + cstate->clientstate = CHAPCS_INITIAL; + cstate->serverstate = CHAPSS_INITIAL; +} + + +/* + * ChapProtocolReject - Peer doesn't grok CHAP. + */ +static void +ChapProtocolReject(int unit) +{ + chap_state *cstate = &chap[unit]; + + if (cstate->serverstate != CHAPSS_INITIAL && + cstate->serverstate != CHAPSS_CLOSED) { + auth_peer_fail(unit, PPP_CHAP); + } + if (cstate->clientstate != CHAPCS_INITIAL && + cstate->clientstate != CHAPCS_CLOSED) { + auth_withpeer_fail(unit, PPP_CHAP); /* lwip: just sets the PPP error code on this unit to PPPERR_AUTHFAIL */ + } + ChapLowerDown(unit); /* shutdown chap */ +} + + +/* + * ChapInput - Input CHAP packet. + */ +static void +ChapInput(int unit, u_char *inpacket, int packet_len) +{ + chap_state *cstate = &chap[unit]; + u_char *inp; + u_char code, id; + int len; + + /* + * Parse header (code, id and length). + * If packet too short, drop it. + */ + inp = inpacket; + if (packet_len < CHAP_HEADERLEN) { + CHAPDEBUG(LOG_INFO, ("ChapInput: rcvd short header.\n")); + return; + } + GETCHAR(code, inp); + GETCHAR(id, inp); + GETSHORT(len, inp); + if (len < CHAP_HEADERLEN) { + CHAPDEBUG(LOG_INFO, ("ChapInput: rcvd illegal length.\n")); + return; + } + if (len > packet_len) { + CHAPDEBUG(LOG_INFO, ("ChapInput: rcvd short packet.\n")); + return; + } + len -= CHAP_HEADERLEN; + + /* + * Action depends on code (as in fact it usually does :-). + */ + switch (code) { + case CHAP_CHALLENGE: + ChapReceiveChallenge(cstate, inp, id, len); + break; + + case CHAP_RESPONSE: + ChapReceiveResponse(cstate, inp, id, len); + break; + + case CHAP_FAILURE: + ChapReceiveFailure(cstate, inp, id, len); + break; + + case CHAP_SUCCESS: + ChapReceiveSuccess(cstate, inp, id, len); + break; + + default: /* Need code reject? */ + CHAPDEBUG(LOG_WARNING, ("Unknown CHAP code (%d) received.\n", code)); + break; + } +} + + +/* + * ChapReceiveChallenge - Receive Challenge and send Response. + */ +static void +ChapReceiveChallenge(chap_state *cstate, u_char *inp, u_char id, int len) +{ + int rchallenge_len; + u_char *rchallenge; + int secret_len; + char secret[MAXSECRETLEN]; + char rhostname[256]; + MD5_CTX mdContext; + u_char hash[MD5_SIGNATURE_SIZE]; + + CHAPDEBUG(LOG_INFO, ("ChapReceiveChallenge: Rcvd id %d.\n", id)); + if (cstate->clientstate == CHAPCS_CLOSED || + cstate->clientstate == CHAPCS_PENDING) { + CHAPDEBUG(LOG_INFO, ("ChapReceiveChallenge: in state %d\n", + cstate->clientstate)); + return; + } + + if (len < 2) { + CHAPDEBUG(LOG_INFO, ("ChapReceiveChallenge: rcvd short packet.\n")); + return; + } + + GETCHAR(rchallenge_len, inp); + len -= sizeof (u_char) + rchallenge_len; /* now name field length */ + if (len < 0) { + CHAPDEBUG(LOG_INFO, ("ChapReceiveChallenge: rcvd short packet.\n")); + return; + } + rchallenge = inp; + INCPTR(rchallenge_len, inp); + + if (len >= (int)sizeof(rhostname)) { + len = sizeof(rhostname) - 1; + } + BCOPY(inp, rhostname, len); + rhostname[len] = '\000'; + + CHAPDEBUG(LOG_INFO, ("ChapReceiveChallenge: received name field '%s'\n", + rhostname)); + + /* Microsoft doesn't send their name back in the PPP packet */ + if (ppp_settings.remote_name[0] != 0 && (ppp_settings.explicit_remote || rhostname[0] == 0)) { + strncpy(rhostname, ppp_settings.remote_name, sizeof(rhostname)); + rhostname[sizeof(rhostname) - 1] = 0; + CHAPDEBUG(LOG_INFO, ("ChapReceiveChallenge: using '%s' as remote name\n", + rhostname)); + } + + /* get secret for authenticating ourselves with the specified host */ + if (!get_secret(cstate->unit, cstate->resp_name, rhostname, + secret, &secret_len, 0)) { + secret_len = 0; /* assume null secret if can't find one */ + CHAPDEBUG(LOG_WARNING, ("No CHAP secret found for authenticating us to %s\n", + rhostname)); + } + + /* cancel response send timeout if necessary */ + if (cstate->clientstate == CHAPCS_RESPONSE) { + UNTIMEOUT(ChapResponseTimeout, cstate); + } + + cstate->resp_id = id; + cstate->resp_transmits = 0; + + /* generate MD based on negotiated type */ + switch (cstate->resp_type) { + + case CHAP_DIGEST_MD5: + MD5Init(&mdContext); + MD5Update(&mdContext, &cstate->resp_id, 1); + MD5Update(&mdContext, (u_char*)secret, secret_len); + MD5Update(&mdContext, rchallenge, rchallenge_len); + MD5Final(hash, &mdContext); + BCOPY(hash, cstate->response, MD5_SIGNATURE_SIZE); + cstate->resp_length = MD5_SIGNATURE_SIZE; + break; + +#if MSCHAP_SUPPORT + case CHAP_MICROSOFT: + ChapMS(cstate, rchallenge, rchallenge_len, secret, secret_len); + break; +#endif + + default: + CHAPDEBUG(LOG_INFO, ("unknown digest type %d\n", cstate->resp_type)); + return; + } + + BZERO(secret, sizeof(secret)); + ChapSendResponse(cstate); +} + + +/* + * ChapReceiveResponse - Receive and process response. + */ +static void +ChapReceiveResponse(chap_state *cstate, u_char *inp, int id, int len) +{ + u_char *remmd, remmd_len; + int secret_len, old_state; + int code; + char rhostname[256]; + MD5_CTX mdContext; + char secret[MAXSECRETLEN]; + u_char hash[MD5_SIGNATURE_SIZE]; + + CHAPDEBUG(LOG_INFO, ("ChapReceiveResponse: Rcvd id %d.\n", id)); + + if (cstate->serverstate == CHAPSS_CLOSED || + cstate->serverstate == CHAPSS_PENDING) { + CHAPDEBUG(LOG_INFO, ("ChapReceiveResponse: in state %d\n", + cstate->serverstate)); + return; + } + + if (id != cstate->chal_id) { + return; /* doesn't match ID of last challenge */ + } + + /* + * If we have received a duplicate or bogus Response, + * we have to send the same answer (Success/Failure) + * as we did for the first Response we saw. + */ + if (cstate->serverstate == CHAPSS_OPEN) { + ChapSendStatus(cstate, CHAP_SUCCESS); + return; + } + if (cstate->serverstate == CHAPSS_BADAUTH) { + ChapSendStatus(cstate, CHAP_FAILURE); + return; + } + + if (len < 2) { + CHAPDEBUG(LOG_INFO, ("ChapReceiveResponse: rcvd short packet.\n")); + return; + } + GETCHAR(remmd_len, inp); /* get length of MD */ + remmd = inp; /* get pointer to MD */ + INCPTR(remmd_len, inp); + + len -= sizeof (u_char) + remmd_len; + if (len < 0) { + CHAPDEBUG(LOG_INFO, ("ChapReceiveResponse: rcvd short packet.\n")); + return; + } + + UNTIMEOUT(ChapChallengeTimeout, cstate); + + if (len >= (int)sizeof(rhostname)) { + len = sizeof(rhostname) - 1; + } + BCOPY(inp, rhostname, len); + rhostname[len] = '\000'; + + CHAPDEBUG(LOG_INFO, ("ChapReceiveResponse: received name field: %s\n", + rhostname)); + + /* + * Get secret for authenticating them with us, + * do the hash ourselves, and compare the result. + */ + code = CHAP_FAILURE; + if (!get_secret(cstate->unit, rhostname, cstate->chal_name, + secret, &secret_len, 1)) { + CHAPDEBUG(LOG_WARNING, ("No CHAP secret found for authenticating %s\n", + rhostname)); + } else { + /* generate MD based on negotiated type */ + switch (cstate->chal_type) { + + case CHAP_DIGEST_MD5: /* only MD5 is defined for now */ + if (remmd_len != MD5_SIGNATURE_SIZE) { + break; /* it's not even the right length */ + } + MD5Init(&mdContext); + MD5Update(&mdContext, &cstate->chal_id, 1); + MD5Update(&mdContext, (u_char*)secret, secret_len); + MD5Update(&mdContext, cstate->challenge, cstate->chal_len); + MD5Final(hash, &mdContext); + + /* compare local and remote MDs and send the appropriate status */ + if (memcmp (hash, remmd, MD5_SIGNATURE_SIZE) == 0) { + code = CHAP_SUCCESS; /* they are the same! */ + } + break; + + default: + CHAPDEBUG(LOG_INFO, ("unknown digest type %d\n", cstate->chal_type)); + } + } + + BZERO(secret, sizeof(secret)); + ChapSendStatus(cstate, code); + + if (code == CHAP_SUCCESS) { + old_state = cstate->serverstate; + cstate->serverstate = CHAPSS_OPEN; + if (old_state == CHAPSS_INITIAL_CHAL) { + auth_peer_success(cstate->unit, PPP_CHAP, rhostname, len); + } + if (cstate->chal_interval != 0) { + TIMEOUT(ChapRechallenge, cstate, cstate->chal_interval); + } + } else { + CHAPDEBUG(LOG_ERR, ("CHAP peer authentication failed\n")); + cstate->serverstate = CHAPSS_BADAUTH; + auth_peer_fail(cstate->unit, PPP_CHAP); + } +} + +/* + * ChapReceiveSuccess - Receive Success + */ +static void +ChapReceiveSuccess(chap_state *cstate, u_char *inp, u_char id, int len) +{ + LWIP_UNUSED_ARG(id); + LWIP_UNUSED_ARG(inp); + + CHAPDEBUG(LOG_INFO, ("ChapReceiveSuccess: Rcvd id %d.\n", id)); + + if (cstate->clientstate == CHAPCS_OPEN) { + /* presumably an answer to a duplicate response */ + return; + } + + if (cstate->clientstate != CHAPCS_RESPONSE) { + /* don't know what this is */ + CHAPDEBUG(LOG_INFO, ("ChapReceiveSuccess: in state %d\n", + cstate->clientstate)); + return; + } + + UNTIMEOUT(ChapResponseTimeout, cstate); + + /* + * Print message. + */ + if (len > 0) { + PRINTMSG(inp, len); + } + + cstate->clientstate = CHAPCS_OPEN; + + auth_withpeer_success(cstate->unit, PPP_CHAP); +} + + +/* + * ChapReceiveFailure - Receive failure. + */ +static void +ChapReceiveFailure(chap_state *cstate, u_char *inp, u_char id, int len) +{ + LWIP_UNUSED_ARG(id); + LWIP_UNUSED_ARG(inp); + + CHAPDEBUG(LOG_INFO, ("ChapReceiveFailure: Rcvd id %d.\n", id)); + + if (cstate->clientstate != CHAPCS_RESPONSE) { + /* don't know what this is */ + CHAPDEBUG(LOG_INFO, ("ChapReceiveFailure: in state %d\n", + cstate->clientstate)); + return; + } + + UNTIMEOUT(ChapResponseTimeout, cstate); + + /* + * Print message. + */ + if (len > 0) { + PRINTMSG(inp, len); + } + + CHAPDEBUG(LOG_ERR, ("CHAP authentication failed\n")); + auth_withpeer_fail(cstate->unit, PPP_CHAP); /* lwip: just sets the PPP error code on this unit to PPPERR_AUTHFAIL */ +} + + +/* + * ChapSendChallenge - Send an Authenticate challenge. + */ +static void +ChapSendChallenge(chap_state *cstate) +{ + u_char *outp; + int chal_len, name_len; + int outlen; + + chal_len = cstate->chal_len; + name_len = (int)strlen(cstate->chal_name); + outlen = CHAP_HEADERLEN + sizeof (u_char) + chal_len + name_len; + outp = outpacket_buf[cstate->unit]; + + MAKEHEADER(outp, PPP_CHAP); /* paste in a CHAP header */ + + PUTCHAR(CHAP_CHALLENGE, outp); + PUTCHAR(cstate->chal_id, outp); + PUTSHORT(outlen, outp); + + PUTCHAR(chal_len, outp); /* put length of challenge */ + BCOPY(cstate->challenge, outp, chal_len); + INCPTR(chal_len, outp); + + BCOPY(cstate->chal_name, outp, name_len); /* append hostname */ + + pppWrite(cstate->unit, outpacket_buf[cstate->unit], outlen + PPP_HDRLEN); + + CHAPDEBUG(LOG_INFO, ("ChapSendChallenge: Sent id %d.\n", cstate->chal_id)); + + TIMEOUT(ChapChallengeTimeout, cstate, cstate->timeouttime); + ++cstate->chal_transmits; +} + + +/* + * ChapSendStatus - Send a status response (ack or nak). + */ +static void +ChapSendStatus(chap_state *cstate, int code) +{ + u_char *outp; + int outlen, msglen; + char msg[256]; /* @todo: this can be a char*, no strcpy needed */ + + if (code == CHAP_SUCCESS) { + strcpy(msg, "Welcome!"); + } else { + strcpy(msg, "I don't like you. Go 'way."); + } + msglen = (int)strlen(msg); + + outlen = CHAP_HEADERLEN + msglen; + outp = outpacket_buf[cstate->unit]; + + MAKEHEADER(outp, PPP_CHAP); /* paste in a header */ + + PUTCHAR(code, outp); + PUTCHAR(cstate->chal_id, outp); + PUTSHORT(outlen, outp); + BCOPY(msg, outp, msglen); + pppWrite(cstate->unit, outpacket_buf[cstate->unit], outlen + PPP_HDRLEN); + + CHAPDEBUG(LOG_INFO, ("ChapSendStatus: Sent code %d, id %d.\n", code, + cstate->chal_id)); +} + +/* + * ChapGenChallenge is used to generate a pseudo-random challenge string of + * a pseudo-random length between min_len and max_len. The challenge + * string and its length are stored in *cstate, and various other fields of + * *cstate are initialized. + */ + +static void +ChapGenChallenge(chap_state *cstate) +{ + int chal_len; + u_char *ptr = cstate->challenge; + int i; + + /* pick a random challenge length between MIN_CHALLENGE_LENGTH and + MAX_CHALLENGE_LENGTH */ + chal_len = (unsigned) + ((((magic() >> 16) * + (MAX_CHALLENGE_LENGTH - MIN_CHALLENGE_LENGTH)) >> 16) + + MIN_CHALLENGE_LENGTH); + LWIP_ASSERT("chal_len <= 0xff", chal_len <= 0xffff); + cstate->chal_len = (u_char)chal_len; + cstate->chal_id = ++cstate->id; + cstate->chal_transmits = 0; + + /* generate a random string */ + for (i = 0; i < chal_len; i++ ) { + *ptr++ = (char) (magic() & 0xff); + } +} + +/* + * ChapSendResponse - send a response packet with values as specified + * in *cstate. + */ +/* ARGSUSED */ +static void +ChapSendResponse(chap_state *cstate) +{ + u_char *outp; + int outlen, md_len, name_len; + + md_len = cstate->resp_length; + name_len = (int)strlen(cstate->resp_name); + outlen = CHAP_HEADERLEN + sizeof (u_char) + md_len + name_len; + outp = outpacket_buf[cstate->unit]; + + MAKEHEADER(outp, PPP_CHAP); + + PUTCHAR(CHAP_RESPONSE, outp); /* we are a response */ + PUTCHAR(cstate->resp_id, outp); /* copy id from challenge packet */ + PUTSHORT(outlen, outp); /* packet length */ + + PUTCHAR(md_len, outp); /* length of MD */ + BCOPY(cstate->response, outp, md_len); /* copy MD to buffer */ + INCPTR(md_len, outp); + + BCOPY(cstate->resp_name, outp, name_len); /* append our name */ + + /* send the packet */ + pppWrite(cstate->unit, outpacket_buf[cstate->unit], outlen + PPP_HDRLEN); + + cstate->clientstate = CHAPCS_RESPONSE; + TIMEOUT(ChapResponseTimeout, cstate, cstate->timeouttime); + ++cstate->resp_transmits; +} + +#if PPP_ADDITIONAL_CALLBACKS +static char *ChapCodenames[] = { + "Challenge", "Response", "Success", "Failure" +}; +/* + * ChapPrintPkt - print the contents of a CHAP packet. + */ +static int +ChapPrintPkt( u_char *p, int plen, void (*printer) (void *, char *, ...), void *arg) +{ + int code, id, len; + int clen, nlen; + u_char x; + + if (plen < CHAP_HEADERLEN) { + return 0; + } + GETCHAR(code, p); + GETCHAR(id, p); + GETSHORT(len, p); + if (len < CHAP_HEADERLEN || len > plen) { + return 0; + } + + if (code >= 1 && code <= sizeof(ChapCodenames) / sizeof(char *)) { + printer(arg, " %s", ChapCodenames[code-1]); + } else { + printer(arg, " code=0x%x", code); + } + printer(arg, " id=0x%x", id); + len -= CHAP_HEADERLEN; + switch (code) { + case CHAP_CHALLENGE: + case CHAP_RESPONSE: + if (len < 1) { + break; + } + clen = p[0]; + if (len < clen + 1) { + break; + } + ++p; + nlen = len - clen - 1; + printer(arg, " <"); + for (; clen > 0; --clen) { + GETCHAR(x, p); + printer(arg, "%.2x", x); + } + printer(arg, ">, name = %.*Z", nlen, p); + break; + case CHAP_FAILURE: + case CHAP_SUCCESS: + printer(arg, " %.*Z", len, p); + break; + default: + for (clen = len; clen > 0; --clen) { + GETCHAR(x, p); + printer(arg, " %.2x", x); + } + } + + return len + CHAP_HEADERLEN; +} +#endif /* PPP_ADDITIONAL_CALLBACKS */ + +#endif /* CHAP_SUPPORT */ + +#endif /* PPP_SUPPORT */ diff --git a/lib/drivers/lwip/src/netif/ppp/chap.h b/lib/drivers/lwip/src/netif/ppp/chap.h new file mode 100644 index 00000000000..fedcab8da1a --- /dev/null +++ b/lib/drivers/lwip/src/netif/ppp/chap.h @@ -0,0 +1,150 @@ +/***************************************************************************** +* chap.h - Network Challenge Handshake Authentication Protocol header file. +* +* Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc. +* portions Copyright (c) 1998 Global Election Systems Inc. +* +* The authors hereby grant permission to use, copy, modify, distribute, +* and license this software and its documentation for any purpose, provided +* that existing copyright notices are retained in all copies and that this +* notice and the following disclaimer are included verbatim in any +* distributions. No written agreement, license, or royalty fee is required +* for any of the authorized uses. +* +* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +* IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +****************************************************************************** +* REVISION HISTORY +* +* 03-01-01 Marc Boucher +* Ported to lwIP. +* 97-12-03 Guy Lancaster , Global Election Systems Inc. +* Original built from BSD network code. +******************************************************************************/ +/* + * chap.h - Challenge Handshake Authentication Protocol definitions. + * + * Copyright (c) 1993 The Australian National University. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by the Australian National University. The name of the University + * may not be used to endorse or promote products derived from this + * software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * Copyright (c) 1991 Gregory M. Christy + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by the author. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * $Id: chap.h,v 1.6 2010/01/24 13:19:34 goldsimon Exp $ + */ + +#ifndef CHAP_H +#define CHAP_H + +/* Code + ID + length */ +#define CHAP_HEADERLEN 4 + +/* + * CHAP codes. + */ + +#define CHAP_DIGEST_MD5 5 /* use MD5 algorithm */ +#define MD5_SIGNATURE_SIZE 16 /* 16 bytes in a MD5 message digest */ +#define CHAP_MICROSOFT 0x80 /* use Microsoft-compatible alg. */ +#define MS_CHAP_RESPONSE_LEN 49 /* Response length for MS-CHAP */ + +#define CHAP_CHALLENGE 1 +#define CHAP_RESPONSE 2 +#define CHAP_SUCCESS 3 +#define CHAP_FAILURE 4 + +/* + * Challenge lengths (for challenges we send) and other limits. + */ +#define MIN_CHALLENGE_LENGTH 32 +#define MAX_CHALLENGE_LENGTH 64 +#define MAX_RESPONSE_LENGTH 64 /* sufficient for MD5 or MS-CHAP */ + +/* + * Each interface is described by a chap structure. + */ + +typedef struct chap_state { + int unit; /* Interface unit number */ + int clientstate; /* Client state */ + int serverstate; /* Server state */ + u_char challenge[MAX_CHALLENGE_LENGTH]; /* last challenge string sent */ + u_char chal_len; /* challenge length */ + u_char chal_id; /* ID of last challenge */ + u_char chal_type; /* hash algorithm for challenges */ + u_char id; /* Current id */ + char *chal_name; /* Our name to use with challenge */ + int chal_interval; /* Time until we challenge peer again */ + int timeouttime; /* Timeout time in seconds */ + int max_transmits; /* Maximum # of challenge transmissions */ + int chal_transmits; /* Number of transmissions of challenge */ + int resp_transmits; /* Number of transmissions of response */ + u_char response[MAX_RESPONSE_LENGTH]; /* Response to send */ + u_char resp_length; /* length of response */ + u_char resp_id; /* ID for response messages */ + u_char resp_type; /* hash algorithm for responses */ + char *resp_name; /* Our name to send with response */ +} chap_state; + + +/* + * Client (peer) states. + */ +#define CHAPCS_INITIAL 0 /* Lower layer down, not opened */ +#define CHAPCS_CLOSED 1 /* Lower layer up, not opened */ +#define CHAPCS_PENDING 2 /* Auth us to peer when lower up */ +#define CHAPCS_LISTEN 3 /* Listening for a challenge */ +#define CHAPCS_RESPONSE 4 /* Sent response, waiting for status */ +#define CHAPCS_OPEN 5 /* We've received Success */ + +/* + * Server (authenticator) states. + */ +#define CHAPSS_INITIAL 0 /* Lower layer down, not opened */ +#define CHAPSS_CLOSED 1 /* Lower layer up, not opened */ +#define CHAPSS_PENDING 2 /* Auth peer when lower up */ +#define CHAPSS_INITIAL_CHAL 3 /* We've sent the first challenge */ +#define CHAPSS_OPEN 4 /* We've sent a Success msg */ +#define CHAPSS_RECHALLENGE 5 /* We've sent another challenge */ +#define CHAPSS_BADAUTH 6 /* We've sent a Failure msg */ + +extern chap_state chap[]; + +void ChapAuthWithPeer (int, char *, u_char); +void ChapAuthPeer (int, char *, u_char); + +extern struct protent chap_protent; + +#endif /* CHAP_H */ diff --git a/lib/drivers/lwip/src/netif/ppp/chpms.c b/lib/drivers/lwip/src/netif/ppp/chpms.c new file mode 100644 index 00000000000..83acefcec6d --- /dev/null +++ b/lib/drivers/lwip/src/netif/ppp/chpms.c @@ -0,0 +1,396 @@ +/*** WARNING - THIS CODE HAS NOT BEEN FINISHED! ***/ +/*** The original PPPD code is written in a way to require either the UNIX DES + encryption functions encrypt(3) and setkey(3) or the DES library libdes. + Since both is not included in lwIP, MSCHAP currently does not work! */ +/***************************************************************************** +* chpms.c - Network MicroSoft Challenge Handshake Authentication Protocol program file. +* +* Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc. +* Copyright (c) 1997 by Global Election Systems Inc. All rights reserved. +* +* The authors hereby grant permission to use, copy, modify, distribute, +* and license this software and its documentation for any purpose, provided +* that existing copyright notices are retained in all copies and that this +* notice and the following disclaimer are included verbatim in any +* distributions. No written agreement, license, or royalty fee is required +* for any of the authorized uses. +* +* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +* IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +****************************************************************************** +* REVISION HISTORY +* +* 03-01-01 Marc Boucher +* Ported to lwIP. +* 97-12-08 Guy Lancaster , Global Election Systems Inc. +* Original based on BSD chap_ms.c. +*****************************************************************************/ +/* + * chap_ms.c - Microsoft MS-CHAP compatible implementation. + * + * Copyright (c) 1995 Eric Rosenquist, Strata Software Limited. + * http://www.strataware.com/ + * + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by Eric Rosenquist. The name of the author may not be used to + * endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + +/* + * Modifications by Lauri Pesonen / lpesonen@clinet.fi, april 1997 + * + * Implemented LANManager type password response to MS-CHAP challenges. + * Now pppd provides both NT style and LANMan style blocks, and the + * prefered is set by option "ms-lanman". Default is to use NT. + * The hash text (StdText) was taken from Win95 RASAPI32.DLL. + * + * You should also use DOMAIN\\USERNAME as described in README.MSCHAP80 + */ + +#define USE_CRYPT + +#include "lwip/opt.h" + +#if PPP_SUPPORT /* don't build if not configured for use in lwipopts.h */ + +#if MSCHAP_SUPPORT /* don't build if not configured for use in lwipopts.h */ + +#include "ppp.h" +#include "pppdebug.h" + +#include "md4.h" +#ifndef USE_CRYPT +#include "des.h" +#endif +#include "chap.h" +#include "chpms.h" + +#include + + +/*************************/ +/*** LOCAL DEFINITIONS ***/ +/*************************/ + + +/************************/ +/*** LOCAL DATA TYPES ***/ +/************************/ +typedef struct { + u_char LANManResp[24]; + u_char NTResp[24]; + u_char UseNT; /* If 1, ignore the LANMan response field */ +} MS_ChapResponse; +/* We use MS_CHAP_RESPONSE_LEN, rather than sizeof(MS_ChapResponse), + in case this struct gets padded. */ + + + +/***********************************/ +/*** LOCAL FUNCTION DECLARATIONS ***/ +/***********************************/ + +/* XXX Don't know what to do with these. */ +extern void setkey(const char *); +extern void encrypt(char *, int); + +static void DesEncrypt (u_char *, u_char *, u_char *); +static void MakeKey (u_char *, u_char *); + +#ifdef USE_CRYPT +static void Expand (u_char *, u_char *); +static void Collapse (u_char *, u_char *); +#endif + +static void ChallengeResponse( + u_char *challenge, /* IN 8 octets */ + u_char *pwHash, /* IN 16 octets */ + u_char *response /* OUT 24 octets */ +); +static void ChapMS_NT( + char *rchallenge, + int rchallenge_len, + char *secret, + int secret_len, + MS_ChapResponse *response +); +static u_char Get7Bits( + u_char *input, + int startBit +); + +static void +ChallengeResponse( u_char *challenge, /* IN 8 octets */ + u_char *pwHash, /* IN 16 octets */ + u_char *response /* OUT 24 octets */) +{ + u_char ZPasswordHash[21]; + + BZERO(ZPasswordHash, sizeof(ZPasswordHash)); + BCOPY(pwHash, ZPasswordHash, 16); + +#if 0 + log_packet(ZPasswordHash, sizeof(ZPasswordHash), "ChallengeResponse - ZPasswordHash", LOG_DEBUG); +#endif + + DesEncrypt(challenge, ZPasswordHash + 0, response + 0); + DesEncrypt(challenge, ZPasswordHash + 7, response + 8); + DesEncrypt(challenge, ZPasswordHash + 14, response + 16); + +#if 0 + log_packet(response, 24, "ChallengeResponse - response", LOG_DEBUG); +#endif +} + + +#ifdef USE_CRYPT +static void +DesEncrypt( u_char *clear, /* IN 8 octets */ + u_char *key, /* IN 7 octets */ + u_char *cipher /* OUT 8 octets */) +{ + u_char des_key[8]; + u_char crypt_key[66]; + u_char des_input[66]; + + MakeKey(key, des_key); + + Expand(des_key, crypt_key); + setkey((char*)crypt_key); + +#if 0 + CHAPDEBUG(LOG_INFO, ("DesEncrypt: 8 octet input : %02X%02X%02X%02X%02X%02X%02X%02X\n", + clear[0], clear[1], clear[2], clear[3], clear[4], clear[5], clear[6], clear[7])); +#endif + + Expand(clear, des_input); + encrypt((char*)des_input, 0); + Collapse(des_input, cipher); + +#if 0 + CHAPDEBUG(LOG_INFO, ("DesEncrypt: 8 octet output: %02X%02X%02X%02X%02X%02X%02X%02X\n", + cipher[0], cipher[1], cipher[2], cipher[3], cipher[4], cipher[5], cipher[6], cipher[7])); +#endif +} + +#else /* USE_CRYPT */ + +static void +DesEncrypt( u_char *clear, /* IN 8 octets */ + u_char *key, /* IN 7 octets */ + u_char *cipher /* OUT 8 octets */) +{ + des_cblock des_key; + des_key_schedule key_schedule; + + MakeKey(key, des_key); + + des_set_key(&des_key, key_schedule); + +#if 0 + CHAPDEBUG(LOG_INFO, ("DesEncrypt: 8 octet input : %02X%02X%02X%02X%02X%02X%02X%02X\n", + clear[0], clear[1], clear[2], clear[3], clear[4], clear[5], clear[6], clear[7])); +#endif + + des_ecb_encrypt((des_cblock *)clear, (des_cblock *)cipher, key_schedule, 1); + +#if 0 + CHAPDEBUG(LOG_INFO, ("DesEncrypt: 8 octet output: %02X%02X%02X%02X%02X%02X%02X%02X\n", + cipher[0], cipher[1], cipher[2], cipher[3], cipher[4], cipher[5], cipher[6], cipher[7])); +#endif +} + +#endif /* USE_CRYPT */ + + +static u_char +Get7Bits( u_char *input, int startBit) +{ + register unsigned int word; + + word = (unsigned)input[startBit / 8] << 8; + word |= (unsigned)input[startBit / 8 + 1]; + + word >>= 15 - (startBit % 8 + 7); + + return word & 0xFE; +} + +#ifdef USE_CRYPT + +/* in == 8-byte string (expanded version of the 56-bit key) + * out == 64-byte string where each byte is either 1 or 0 + * Note that the low-order "bit" is always ignored by by setkey() + */ +static void +Expand(u_char *in, u_char *out) +{ + int j, c; + int i; + + for(i = 0; i < 64; in++){ + c = *in; + for(j = 7; j >= 0; j--) { + *out++ = (c >> j) & 01; + } + i += 8; + } +} + +/* The inverse of Expand + */ +static void +Collapse(u_char *in, u_char *out) +{ + int j; + int i; + unsigned int c; + + for (i = 0; i < 64; i += 8, out++) { + c = 0; + for (j = 7; j >= 0; j--, in++) { + c |= *in << j; + } + *out = c & 0xff; + } +} +#endif + +static void +MakeKey( u_char *key, /* IN 56 bit DES key missing parity bits */ + u_char *des_key /* OUT 64 bit DES key with parity bits added */) +{ + des_key[0] = Get7Bits(key, 0); + des_key[1] = Get7Bits(key, 7); + des_key[2] = Get7Bits(key, 14); + des_key[3] = Get7Bits(key, 21); + des_key[4] = Get7Bits(key, 28); + des_key[5] = Get7Bits(key, 35); + des_key[6] = Get7Bits(key, 42); + des_key[7] = Get7Bits(key, 49); + +#ifndef USE_CRYPT + des_set_odd_parity((des_cblock *)des_key); +#endif + +#if 0 + CHAPDEBUG(LOG_INFO, ("MakeKey: 56-bit input : %02X%02X%02X%02X%02X%02X%02X\n", + key[0], key[1], key[2], key[3], key[4], key[5], key[6])); + CHAPDEBUG(LOG_INFO, ("MakeKey: 64-bit output: %02X%02X%02X%02X%02X%02X%02X%02X\n", + des_key[0], des_key[1], des_key[2], des_key[3], des_key[4], des_key[5], des_key[6], des_key[7])); +#endif +} + +static void +ChapMS_NT( char *rchallenge, + int rchallenge_len, + char *secret, + int secret_len, + MS_ChapResponse *response) +{ + int i; + MDstruct md4Context; + u_char unicodePassword[MAX_NT_PASSWORD * 2]; + static int low_byte_first = -1; + + LWIP_UNUSED_ARG(rchallenge_len); + + /* Initialize the Unicode version of the secret (== password). */ + /* This implicitly supports 8-bit ISO8859/1 characters. */ + BZERO(unicodePassword, sizeof(unicodePassword)); + for (i = 0; i < secret_len; i++) { + unicodePassword[i * 2] = (u_char)secret[i]; + } + MDbegin(&md4Context); + MDupdate(&md4Context, unicodePassword, secret_len * 2 * 8); /* Unicode is 2 bytes/char, *8 for bit count */ + + if (low_byte_first == -1) { + low_byte_first = (PP_HTONS((unsigned short int)1) != 1); + } + if (low_byte_first == 0) { + /* @todo: arg type - u_long* or u_int* ? */ + MDreverse((unsigned int*)&md4Context); /* sfb 961105 */ + } + + MDupdate(&md4Context, NULL, 0); /* Tell MD4 we're done */ + + ChallengeResponse((u_char*)rchallenge, (u_char*)md4Context.buffer, response->NTResp); +} + +#ifdef MSLANMAN +static u_char *StdText = (u_char *)"KGS!@#$%"; /* key from rasapi32.dll */ + +static void +ChapMS_LANMan( char *rchallenge, + int rchallenge_len, + char *secret, + int secret_len, + MS_ChapResponse *response) +{ + int i; + u_char UcasePassword[MAX_NT_PASSWORD]; /* max is actually 14 */ + u_char PasswordHash[16]; + + /* LANMan password is case insensitive */ + BZERO(UcasePassword, sizeof(UcasePassword)); + for (i = 0; i < secret_len; i++) { + UcasePassword[i] = (u_char)toupper(secret[i]); + } + DesEncrypt( StdText, UcasePassword + 0, PasswordHash + 0 ); + DesEncrypt( StdText, UcasePassword + 7, PasswordHash + 8 ); + ChallengeResponse(rchallenge, PasswordHash, response->LANManResp); +} +#endif + +void +ChapMS( chap_state *cstate, char *rchallenge, int rchallenge_len, char *secret, int secret_len) +{ + MS_ChapResponse response; +#ifdef MSLANMAN + extern int ms_lanman; +#endif + +#if 0 + CHAPDEBUG(LOG_INFO, ("ChapMS: secret is '%.*s'\n", secret_len, secret)); +#endif + BZERO(&response, sizeof(response)); + + /* Calculate both always */ + ChapMS_NT(rchallenge, rchallenge_len, secret, secret_len, &response); + +#ifdef MSLANMAN + ChapMS_LANMan(rchallenge, rchallenge_len, secret, secret_len, &response); + + /* prefered method is set by option */ + response.UseNT = !ms_lanman; +#else + response.UseNT = 1; +#endif + + BCOPY(&response, cstate->response, MS_CHAP_RESPONSE_LEN); + cstate->resp_length = MS_CHAP_RESPONSE_LEN; +} + +#endif /* MSCHAP_SUPPORT */ + +#endif /* PPP_SUPPORT */ diff --git a/lib/drivers/lwip/src/netif/ppp/chpms.h b/lib/drivers/lwip/src/netif/ppp/chpms.h new file mode 100644 index 00000000000..df070fb356b --- /dev/null +++ b/lib/drivers/lwip/src/netif/ppp/chpms.h @@ -0,0 +1,64 @@ +/***************************************************************************** +* chpms.h - Network Microsoft Challenge Handshake Protocol header file. +* +* Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc. +* portions Copyright (c) 1998 Global Election Systems Inc. +* +* The authors hereby grant permission to use, copy, modify, distribute, +* and license this software and its documentation for any purpose, provided +* that existing copyright notices are retained in all copies and that this +* notice and the following disclaimer are included verbatim in any +* distributions. No written agreement, license, or royalty fee is required +* for any of the authorized uses. +* +* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +* IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +****************************************************************************** +* REVISION HISTORY +* +* 03-01-01 Marc Boucher +* Ported to lwIP. +* 98-01-30 Guy Lancaster , Global Election Systems Inc. +* Original built from BSD network code. +******************************************************************************/ +/* + * chap.h - Challenge Handshake Authentication Protocol definitions. + * + * Copyright (c) 1995 Eric Rosenquist, Strata Software Limited. + * http://www.strataware.com/ + * + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by Eric Rosenquist. The name of the author may not be used to + * endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * $Id: chpms.h,v 1.5 2007/12/19 20:47:23 fbernon Exp $ + */ + +#ifndef CHPMS_H +#define CHPMS_H + +#define MAX_NT_PASSWORD 256 /* Maximum number of (Unicode) chars in an NT password */ + +void ChapMS (chap_state *, char *, int, char *, int); + +#endif /* CHPMS_H */ diff --git a/lib/drivers/lwip/src/netif/ppp/fsm.c b/lib/drivers/lwip/src/netif/ppp/fsm.c new file mode 100644 index 00000000000..2e73c5af8ff --- /dev/null +++ b/lib/drivers/lwip/src/netif/ppp/fsm.c @@ -0,0 +1,890 @@ +/***************************************************************************** +* fsm.c - Network Control Protocol Finite State Machine program file. +* +* Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc. +* portions Copyright (c) 1997 by Global Election Systems Inc. +* +* The authors hereby grant permission to use, copy, modify, distribute, +* and license this software and its documentation for any purpose, provided +* that existing copyright notices are retained in all copies and that this +* notice and the following disclaimer are included verbatim in any +* distributions. No written agreement, license, or royalty fee is required +* for any of the authorized uses. +* +* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +* IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +****************************************************************************** +* REVISION HISTORY +* +* 03-01-01 Marc Boucher +* Ported to lwIP. +* 97-12-01 Guy Lancaster , Global Election Systems Inc. +* Original based on BSD fsm.c. +*****************************************************************************/ +/* + * fsm.c - {Link, IP} Control Protocol Finite State Machine. + * + * Copyright (c) 1989 Carnegie Mellon University. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by Carnegie Mellon University. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + +/* + * TODO: + * Randomize fsm id on link/init. + * Deal with variable outgoing MTU. + */ + +#include "lwip/opt.h" + +#if PPP_SUPPORT /* don't build if not configured for use in lwipopts.h */ + +#include "ppp.h" +#include "pppdebug.h" + +#include "fsm.h" + +#include + +#if PPP_DEBUG +static const char *ppperr_strerr[] = { + "LS_INITIAL", /* LS_INITIAL 0 */ + "LS_STARTING", /* LS_STARTING 1 */ + "LS_CLOSED", /* LS_CLOSED 2 */ + "LS_STOPPED", /* LS_STOPPED 3 */ + "LS_CLOSING", /* LS_CLOSING 4 */ + "LS_STOPPING", /* LS_STOPPING 5 */ + "LS_REQSENT", /* LS_REQSENT 6 */ + "LS_ACKRCVD", /* LS_ACKRCVD 7 */ + "LS_ACKSENT", /* LS_ACKSENT 8 */ + "LS_OPENED" /* LS_OPENED 9 */ +}; +#endif /* PPP_DEBUG */ + +static void fsm_timeout (void *); +static void fsm_rconfreq (fsm *, u_char, u_char *, int); +static void fsm_rconfack (fsm *, int, u_char *, int); +static void fsm_rconfnakrej (fsm *, int, int, u_char *, int); +static void fsm_rtermreq (fsm *, int, u_char *, int); +static void fsm_rtermack (fsm *); +static void fsm_rcoderej (fsm *, u_char *, int); +static void fsm_sconfreq (fsm *, int); + +#define PROTO_NAME(f) ((f)->callbacks->proto_name) + +int peer_mru[NUM_PPP]; + + +/* + * fsm_init - Initialize fsm. + * + * Initialize fsm state. + */ +void +fsm_init(fsm *f) +{ + f->state = LS_INITIAL; + f->flags = 0; + f->id = 0; /* XXX Start with random id? */ + f->timeouttime = FSM_DEFTIMEOUT; + f->maxconfreqtransmits = FSM_DEFMAXCONFREQS; + f->maxtermtransmits = FSM_DEFMAXTERMREQS; + f->maxnakloops = FSM_DEFMAXNAKLOOPS; + f->term_reason_len = 0; +} + + +/* + * fsm_lowerup - The lower layer is up. + */ +void +fsm_lowerup(fsm *f) +{ + int oldState = f->state; + + LWIP_UNUSED_ARG(oldState); + + switch( f->state ) { + case LS_INITIAL: + f->state = LS_CLOSED; + break; + + case LS_STARTING: + if( f->flags & OPT_SILENT ) { + f->state = LS_STOPPED; + } else { + /* Send an initial configure-request */ + fsm_sconfreq(f, 0); + f->state = LS_REQSENT; + } + break; + + default: + FSMDEBUG(LOG_INFO, ("%s: Up event in state %d (%s)!\n", + PROTO_NAME(f), f->state, ppperr_strerr[f->state])); + } + + FSMDEBUG(LOG_INFO, ("%s: lowerup state %d (%s) -> %d (%s)\n", + PROTO_NAME(f), oldState, ppperr_strerr[oldState], f->state, ppperr_strerr[f->state])); +} + + +/* + * fsm_lowerdown - The lower layer is down. + * + * Cancel all timeouts and inform upper layers. + */ +void +fsm_lowerdown(fsm *f) +{ + int oldState = f->state; + + LWIP_UNUSED_ARG(oldState); + + switch( f->state ) { + case LS_CLOSED: + f->state = LS_INITIAL; + break; + + case LS_STOPPED: + f->state = LS_STARTING; + if( f->callbacks->starting ) { + (*f->callbacks->starting)(f); + } + break; + + case LS_CLOSING: + f->state = LS_INITIAL; + UNTIMEOUT(fsm_timeout, f); /* Cancel timeout */ + break; + + case LS_STOPPING: + case LS_REQSENT: + case LS_ACKRCVD: + case LS_ACKSENT: + f->state = LS_STARTING; + UNTIMEOUT(fsm_timeout, f); /* Cancel timeout */ + break; + + case LS_OPENED: + if( f->callbacks->down ) { + (*f->callbacks->down)(f); + } + f->state = LS_STARTING; + break; + + default: + FSMDEBUG(LOG_INFO, ("%s: Down event in state %d (%s)!\n", + PROTO_NAME(f), f->state, ppperr_strerr[f->state])); + } + + FSMDEBUG(LOG_INFO, ("%s: lowerdown state %d (%s) -> %d (%s)\n", + PROTO_NAME(f), oldState, ppperr_strerr[oldState], f->state, ppperr_strerr[f->state])); +} + + +/* + * fsm_open - Link is allowed to come up. + */ +void +fsm_open(fsm *f) +{ + int oldState = f->state; + + LWIP_UNUSED_ARG(oldState); + + switch( f->state ) { + case LS_INITIAL: + f->state = LS_STARTING; + if( f->callbacks->starting ) { + (*f->callbacks->starting)(f); + } + break; + + case LS_CLOSED: + if( f->flags & OPT_SILENT ) { + f->state = LS_STOPPED; + } else { + /* Send an initial configure-request */ + fsm_sconfreq(f, 0); + f->state = LS_REQSENT; + } + break; + + case LS_CLOSING: + f->state = LS_STOPPING; + /* fall through */ + case LS_STOPPED: + case LS_OPENED: + if( f->flags & OPT_RESTART ) { + fsm_lowerdown(f); + fsm_lowerup(f); + } + break; + } + + FSMDEBUG(LOG_INFO, ("%s: open state %d (%s) -> %d (%s)\n", + PROTO_NAME(f), oldState, ppperr_strerr[oldState], f->state, ppperr_strerr[f->state])); +} + +#if 0 /* backport pppd 2.4.4b1; */ +/* + * terminate_layer - Start process of shutting down the FSM + * + * Cancel any timeout running, notify upper layers we're done, and + * send a terminate-request message as configured. + */ +static void +terminate_layer(fsm *f, int nextstate) +{ + /* @todo */ +} +#endif + +/* + * fsm_close - Start closing connection. + * + * Cancel timeouts and either initiate close or possibly go directly to + * the LS_CLOSED state. + */ +void +fsm_close(fsm *f, char *reason) +{ + int oldState = f->state; + + LWIP_UNUSED_ARG(oldState); + + f->term_reason = reason; + f->term_reason_len = (reason == NULL ? 0 : (int)strlen(reason)); + switch( f->state ) { + case LS_STARTING: + f->state = LS_INITIAL; + break; + case LS_STOPPED: + f->state = LS_CLOSED; + break; + case LS_STOPPING: + f->state = LS_CLOSING; + break; + + case LS_REQSENT: + case LS_ACKRCVD: + case LS_ACKSENT: + case LS_OPENED: + if( f->state != LS_OPENED ) { + UNTIMEOUT(fsm_timeout, f); /* Cancel timeout */ + } else if( f->callbacks->down ) { + (*f->callbacks->down)(f); /* Inform upper layers we're down */ + } + /* Init restart counter, send Terminate-Request */ + f->retransmits = f->maxtermtransmits; + fsm_sdata(f, TERMREQ, f->reqid = ++f->id, + (u_char *) f->term_reason, f->term_reason_len); + TIMEOUT(fsm_timeout, f, f->timeouttime); + --f->retransmits; + + f->state = LS_CLOSING; + break; + } + + FSMDEBUG(LOG_INFO, ("%s: close reason=%s state %d (%s) -> %d (%s)\n", + PROTO_NAME(f), reason, oldState, ppperr_strerr[oldState], f->state, ppperr_strerr[f->state])); +} + + +/* + * fsm_timeout - Timeout expired. + */ +static void +fsm_timeout(void *arg) +{ + fsm *f = (fsm *) arg; + + switch (f->state) { + case LS_CLOSING: + case LS_STOPPING: + if( f->retransmits <= 0 ) { + FSMDEBUG(LOG_WARNING, ("%s: timeout sending Terminate-Request state=%d (%s)\n", + PROTO_NAME(f), f->state, ppperr_strerr[f->state])); + /* + * We've waited for an ack long enough. Peer probably heard us. + */ + f->state = (f->state == LS_CLOSING)? LS_CLOSED: LS_STOPPED; + if( f->callbacks->finished ) { + (*f->callbacks->finished)(f); + } + } else { + FSMDEBUG(LOG_WARNING, ("%s: timeout resending Terminate-Requests state=%d (%s)\n", + PROTO_NAME(f), f->state, ppperr_strerr[f->state])); + /* Send Terminate-Request */ + fsm_sdata(f, TERMREQ, f->reqid = ++f->id, + (u_char *) f->term_reason, f->term_reason_len); + TIMEOUT(fsm_timeout, f, f->timeouttime); + --f->retransmits; + } + break; + + case LS_REQSENT: + case LS_ACKRCVD: + case LS_ACKSENT: + if (f->retransmits <= 0) { + FSMDEBUG(LOG_WARNING, ("%s: timeout sending Config-Requests state=%d (%s)\n", + PROTO_NAME(f), f->state, ppperr_strerr[f->state])); + f->state = LS_STOPPED; + if( (f->flags & OPT_PASSIVE) == 0 && f->callbacks->finished ) { + (*f->callbacks->finished)(f); + } + } else { + FSMDEBUG(LOG_WARNING, ("%s: timeout resending Config-Request state=%d (%s)\n", + PROTO_NAME(f), f->state, ppperr_strerr[f->state])); + /* Retransmit the configure-request */ + if (f->callbacks->retransmit) { + (*f->callbacks->retransmit)(f); + } + fsm_sconfreq(f, 1); /* Re-send Configure-Request */ + if( f->state == LS_ACKRCVD ) { + f->state = LS_REQSENT; + } + } + break; + + default: + FSMDEBUG(LOG_INFO, ("%s: UNHANDLED timeout event in state %d (%s)!\n", + PROTO_NAME(f), f->state, ppperr_strerr[f->state])); + } +} + + +/* + * fsm_input - Input packet. + */ +void +fsm_input(fsm *f, u_char *inpacket, int l) +{ + u_char *inp = inpacket; + u_char code, id; + int len; + + /* + * Parse header (code, id and length). + * If packet too short, drop it. + */ + if (l < HEADERLEN) { + FSMDEBUG(LOG_WARNING, ("fsm_input(%x): Rcvd short header.\n", + f->protocol)); + return; + } + GETCHAR(code, inp); + GETCHAR(id, inp); + GETSHORT(len, inp); + if (len < HEADERLEN) { + FSMDEBUG(LOG_INFO, ("fsm_input(%x): Rcvd illegal length.\n", + f->protocol)); + return; + } + if (len > l) { + FSMDEBUG(LOG_INFO, ("fsm_input(%x): Rcvd short packet.\n", + f->protocol)); + return; + } + len -= HEADERLEN; /* subtract header length */ + + if( f->state == LS_INITIAL || f->state == LS_STARTING ) { + FSMDEBUG(LOG_INFO, ("fsm_input(%x): Rcvd packet in state %d (%s).\n", + f->protocol, f->state, ppperr_strerr[f->state])); + return; + } + FSMDEBUG(LOG_INFO, ("fsm_input(%s):%d,%d,%d\n", PROTO_NAME(f), code, id, l)); + /* + * Action depends on code. + */ + switch (code) { + case CONFREQ: + fsm_rconfreq(f, id, inp, len); + break; + + case CONFACK: + fsm_rconfack(f, id, inp, len); + break; + + case CONFNAK: + case CONFREJ: + fsm_rconfnakrej(f, code, id, inp, len); + break; + + case TERMREQ: + fsm_rtermreq(f, id, inp, len); + break; + + case TERMACK: + fsm_rtermack(f); + break; + + case CODEREJ: + fsm_rcoderej(f, inp, len); + break; + + default: + FSMDEBUG(LOG_INFO, ("fsm_input(%s): default: \n", PROTO_NAME(f))); + if( !f->callbacks->extcode || + !(*f->callbacks->extcode)(f, code, id, inp, len) ) { + fsm_sdata(f, CODEREJ, ++f->id, inpacket, len + HEADERLEN); + } + break; + } +} + + +/* + * fsm_rconfreq - Receive Configure-Request. + */ +static void +fsm_rconfreq(fsm *f, u_char id, u_char *inp, int len) +{ + int code, reject_if_disagree; + + FSMDEBUG(LOG_INFO, ("fsm_rconfreq(%s): Rcvd id %d state=%d (%s)\n", + PROTO_NAME(f), id, f->state, ppperr_strerr[f->state])); + switch( f->state ) { + case LS_CLOSED: + /* Go away, we're closed */ + fsm_sdata(f, TERMACK, id, NULL, 0); + return; + case LS_CLOSING: + case LS_STOPPING: + return; + + case LS_OPENED: + /* Go down and restart negotiation */ + if( f->callbacks->down ) { + (*f->callbacks->down)(f); /* Inform upper layers */ + } + fsm_sconfreq(f, 0); /* Send initial Configure-Request */ + break; + + case LS_STOPPED: + /* Negotiation started by our peer */ + fsm_sconfreq(f, 0); /* Send initial Configure-Request */ + f->state = LS_REQSENT; + break; + } + + /* + * Pass the requested configuration options + * to protocol-specific code for checking. + */ + if (f->callbacks->reqci) { /* Check CI */ + reject_if_disagree = (f->nakloops >= f->maxnakloops); + code = (*f->callbacks->reqci)(f, inp, &len, reject_if_disagree); + } else if (len) { + code = CONFREJ; /* Reject all CI */ + } else { + code = CONFACK; + } + + /* send the Ack, Nak or Rej to the peer */ + fsm_sdata(f, (u_char)code, id, inp, len); + + if (code == CONFACK) { + if (f->state == LS_ACKRCVD) { + UNTIMEOUT(fsm_timeout, f); /* Cancel timeout */ + f->state = LS_OPENED; + if (f->callbacks->up) { + (*f->callbacks->up)(f); /* Inform upper layers */ + } + } else { + f->state = LS_ACKSENT; + } + f->nakloops = 0; + } else { + /* we sent CONFACK or CONFREJ */ + if (f->state != LS_ACKRCVD) { + f->state = LS_REQSENT; + } + if( code == CONFNAK ) { + ++f->nakloops; + } + } +} + + +/* + * fsm_rconfack - Receive Configure-Ack. + */ +static void +fsm_rconfack(fsm *f, int id, u_char *inp, int len) +{ + FSMDEBUG(LOG_INFO, ("fsm_rconfack(%s): Rcvd id %d state=%d (%s)\n", + PROTO_NAME(f), id, f->state, ppperr_strerr[f->state])); + + if (id != f->reqid || f->seen_ack) { /* Expected id? */ + return; /* Nope, toss... */ + } + if( !(f->callbacks->ackci? (*f->callbacks->ackci)(f, inp, len): (len == 0)) ) { + /* Ack is bad - ignore it */ + FSMDEBUG(LOG_INFO, ("%s: received bad Ack (length %d)\n", + PROTO_NAME(f), len)); + return; + } + f->seen_ack = 1; + + switch (f->state) { + case LS_CLOSED: + case LS_STOPPED: + fsm_sdata(f, TERMACK, (u_char)id, NULL, 0); + break; + + case LS_REQSENT: + f->state = LS_ACKRCVD; + f->retransmits = f->maxconfreqtransmits; + break; + + case LS_ACKRCVD: + /* Huh? an extra valid Ack? oh well... */ + UNTIMEOUT(fsm_timeout, f); /* Cancel timeout */ + fsm_sconfreq(f, 0); + f->state = LS_REQSENT; + break; + + case LS_ACKSENT: + UNTIMEOUT(fsm_timeout, f); /* Cancel timeout */ + f->state = LS_OPENED; + f->retransmits = f->maxconfreqtransmits; + if (f->callbacks->up) { + (*f->callbacks->up)(f); /* Inform upper layers */ + } + break; + + case LS_OPENED: + /* Go down and restart negotiation */ + if (f->callbacks->down) { + (*f->callbacks->down)(f); /* Inform upper layers */ + } + fsm_sconfreq(f, 0); /* Send initial Configure-Request */ + f->state = LS_REQSENT; + break; + } +} + + +/* + * fsm_rconfnakrej - Receive Configure-Nak or Configure-Reject. + */ +static void +fsm_rconfnakrej(fsm *f, int code, int id, u_char *inp, int len) +{ + int (*proc) (fsm *, u_char *, int); + int ret; + + FSMDEBUG(LOG_INFO, ("fsm_rconfnakrej(%s): Rcvd id %d state=%d (%s)\n", + PROTO_NAME(f), id, f->state, ppperr_strerr[f->state])); + + if (id != f->reqid || f->seen_ack) { /* Expected id? */ + return; /* Nope, toss... */ + } + proc = (code == CONFNAK)? f->callbacks->nakci: f->callbacks->rejci; + if (!proc || !((ret = proc(f, inp, len)))) { + /* Nak/reject is bad - ignore it */ + FSMDEBUG(LOG_INFO, ("%s: received bad %s (length %d)\n", + PROTO_NAME(f), (code==CONFNAK? "Nak": "reject"), len)); + return; + } + f->seen_ack = 1; + + switch (f->state) { + case LS_CLOSED: + case LS_STOPPED: + fsm_sdata(f, TERMACK, (u_char)id, NULL, 0); + break; + + case LS_REQSENT: + case LS_ACKSENT: + /* They didn't agree to what we wanted - try another request */ + UNTIMEOUT(fsm_timeout, f); /* Cancel timeout */ + if (ret < 0) { + f->state = LS_STOPPED; /* kludge for stopping CCP */ + } else { + fsm_sconfreq(f, 0); /* Send Configure-Request */ + } + break; + + case LS_ACKRCVD: + /* Got a Nak/reject when we had already had an Ack?? oh well... */ + UNTIMEOUT(fsm_timeout, f); /* Cancel timeout */ + fsm_sconfreq(f, 0); + f->state = LS_REQSENT; + break; + + case LS_OPENED: + /* Go down and restart negotiation */ + if (f->callbacks->down) { + (*f->callbacks->down)(f); /* Inform upper layers */ + } + fsm_sconfreq(f, 0); /* Send initial Configure-Request */ + f->state = LS_REQSENT; + break; + } +} + + +/* + * fsm_rtermreq - Receive Terminate-Req. + */ +static void +fsm_rtermreq(fsm *f, int id, u_char *p, int len) +{ + LWIP_UNUSED_ARG(p); + + FSMDEBUG(LOG_INFO, ("fsm_rtermreq(%s): Rcvd id %d state=%d (%s)\n", + PROTO_NAME(f), id, f->state, ppperr_strerr[f->state])); + + switch (f->state) { + case LS_ACKRCVD: + case LS_ACKSENT: + f->state = LS_REQSENT; /* Start over but keep trying */ + break; + + case LS_OPENED: + if (len > 0) { + FSMDEBUG(LOG_INFO, ("%s terminated by peer (%p)\n", PROTO_NAME(f), p)); + } else { + FSMDEBUG(LOG_INFO, ("%s terminated by peer\n", PROTO_NAME(f))); + } + if (f->callbacks->down) { + (*f->callbacks->down)(f); /* Inform upper layers */ + } + f->retransmits = 0; + f->state = LS_STOPPING; + TIMEOUT(fsm_timeout, f, f->timeouttime); + break; + } + + fsm_sdata(f, TERMACK, (u_char)id, NULL, 0); +} + + +/* + * fsm_rtermack - Receive Terminate-Ack. + */ +static void +fsm_rtermack(fsm *f) +{ + FSMDEBUG(LOG_INFO, ("fsm_rtermack(%s): state=%d (%s)\n", + PROTO_NAME(f), f->state, ppperr_strerr[f->state])); + + switch (f->state) { + case LS_CLOSING: + UNTIMEOUT(fsm_timeout, f); + f->state = LS_CLOSED; + if( f->callbacks->finished ) { + (*f->callbacks->finished)(f); + } + break; + + case LS_STOPPING: + UNTIMEOUT(fsm_timeout, f); + f->state = LS_STOPPED; + if( f->callbacks->finished ) { + (*f->callbacks->finished)(f); + } + break; + + case LS_ACKRCVD: + f->state = LS_REQSENT; + break; + + case LS_OPENED: + if (f->callbacks->down) { + (*f->callbacks->down)(f); /* Inform upper layers */ + } + fsm_sconfreq(f, 0); + break; + default: + FSMDEBUG(LOG_INFO, ("fsm_rtermack(%s): UNHANDLED state=%d (%s)!!!\n", + PROTO_NAME(f), f->state, ppperr_strerr[f->state])); + } +} + + +/* + * fsm_rcoderej - Receive an Code-Reject. + */ +static void +fsm_rcoderej(fsm *f, u_char *inp, int len) +{ + u_char code, id; + + FSMDEBUG(LOG_INFO, ("fsm_rcoderej(%s): state=%d (%s)\n", + PROTO_NAME(f), f->state, ppperr_strerr[f->state])); + + if (len < HEADERLEN) { + FSMDEBUG(LOG_INFO, ("fsm_rcoderej: Rcvd short Code-Reject packet!\n")); + return; + } + GETCHAR(code, inp); + GETCHAR(id, inp); + FSMDEBUG(LOG_WARNING, ("%s: Rcvd Code-Reject for code %d, id %d\n", + PROTO_NAME(f), code, id)); + + if( f->state == LS_ACKRCVD ) { + f->state = LS_REQSENT; + } +} + + +/* + * fsm_protreject - Peer doesn't speak this protocol. + * + * Treat this as a catastrophic error (RXJ-). + */ +void +fsm_protreject(fsm *f) +{ + switch( f->state ) { + case LS_CLOSING: + UNTIMEOUT(fsm_timeout, f); /* Cancel timeout */ + /* fall through */ + case LS_CLOSED: + f->state = LS_CLOSED; + if( f->callbacks->finished ) { + (*f->callbacks->finished)(f); + } + break; + + case LS_STOPPING: + case LS_REQSENT: + case LS_ACKRCVD: + case LS_ACKSENT: + UNTIMEOUT(fsm_timeout, f); /* Cancel timeout */ + /* fall through */ + case LS_STOPPED: + f->state = LS_STOPPED; + if( f->callbacks->finished ) { + (*f->callbacks->finished)(f); + } + break; + + case LS_OPENED: + if( f->callbacks->down ) { + (*f->callbacks->down)(f); + } + /* Init restart counter, send Terminate-Request */ + f->retransmits = f->maxtermtransmits; + fsm_sdata(f, TERMREQ, f->reqid = ++f->id, + (u_char *) f->term_reason, f->term_reason_len); + TIMEOUT(fsm_timeout, f, f->timeouttime); + --f->retransmits; + + f->state = LS_STOPPING; + break; + + default: + FSMDEBUG(LOG_INFO, ("%s: Protocol-reject event in state %d (%s)!\n", + PROTO_NAME(f), f->state, ppperr_strerr[f->state])); + } +} + + +/* + * fsm_sconfreq - Send a Configure-Request. + */ +static void +fsm_sconfreq(fsm *f, int retransmit) +{ + u_char *outp; + int cilen; + + if( f->state != LS_REQSENT && f->state != LS_ACKRCVD && f->state != LS_ACKSENT ) { + /* Not currently negotiating - reset options */ + if( f->callbacks->resetci ) { + (*f->callbacks->resetci)(f); + } + f->nakloops = 0; + } + + if( !retransmit ) { + /* New request - reset retransmission counter, use new ID */ + f->retransmits = f->maxconfreqtransmits; + f->reqid = ++f->id; + } + + f->seen_ack = 0; + + /* + * Make up the request packet + */ + outp = outpacket_buf[f->unit] + PPP_HDRLEN + HEADERLEN; + if( f->callbacks->cilen && f->callbacks->addci ) { + cilen = (*f->callbacks->cilen)(f); + if( cilen > peer_mru[f->unit] - (int)HEADERLEN ) { + cilen = peer_mru[f->unit] - HEADERLEN; + } + if (f->callbacks->addci) { + (*f->callbacks->addci)(f, outp, &cilen); + } + } else { + cilen = 0; + } + + /* send the request to our peer */ + fsm_sdata(f, CONFREQ, f->reqid, outp, cilen); + + /* start the retransmit timer */ + --f->retransmits; + TIMEOUT(fsm_timeout, f, f->timeouttime); + + FSMDEBUG(LOG_INFO, ("%s: sending Configure-Request, id %d\n", + PROTO_NAME(f), f->reqid)); +} + + +/* + * fsm_sdata - Send some data. + * + * Used for all packets sent to our peer by this module. + */ +void +fsm_sdata( fsm *f, u_char code, u_char id, u_char *data, int datalen) +{ + u_char *outp; + int outlen; + + /* Adjust length to be smaller than MTU */ + outp = outpacket_buf[f->unit]; + if (datalen > peer_mru[f->unit] - (int)HEADERLEN) { + datalen = peer_mru[f->unit] - HEADERLEN; + } + if (datalen && data != outp + PPP_HDRLEN + HEADERLEN) { + BCOPY(data, outp + PPP_HDRLEN + HEADERLEN, datalen); + } + outlen = datalen + HEADERLEN; + MAKEHEADER(outp, f->protocol); + PUTCHAR(code, outp); + PUTCHAR(id, outp); + PUTSHORT(outlen, outp); + pppWrite(f->unit, outpacket_buf[f->unit], outlen + PPP_HDRLEN); + FSMDEBUG(LOG_INFO, ("fsm_sdata(%s): Sent code %d,%d,%d.\n", + PROTO_NAME(f), code, id, outlen)); +} + +#endif /* PPP_SUPPORT */ diff --git a/lib/drivers/lwip/src/netif/ppp/fsm.h b/lib/drivers/lwip/src/netif/ppp/fsm.h new file mode 100644 index 00000000000..8d41b5f511c --- /dev/null +++ b/lib/drivers/lwip/src/netif/ppp/fsm.h @@ -0,0 +1,157 @@ +/***************************************************************************** +* fsm.h - Network Control Protocol Finite State Machine header file. +* +* Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc. +* Copyright (c) 1997 Global Election Systems Inc. +* +* The authors hereby grant permission to use, copy, modify, distribute, +* and license this software and its documentation for any purpose, provided +* that existing copyright notices are retained in all copies and that this +* notice and the following disclaimer are included verbatim in any +* distributions. No written agreement, license, or royalty fee is required +* for any of the authorized uses. +* +* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +* IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +****************************************************************************** +* REVISION HISTORY +* +* 03-01-01 Marc Boucher +* Ported to lwIP. +* 97-11-05 Guy Lancaster , Global Election Systems Inc. +* Original based on BSD code. +*****************************************************************************/ +/* + * fsm.h - {Link, IP} Control Protocol Finite State Machine definitions. + * + * Copyright (c) 1989 Carnegie Mellon University. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by Carnegie Mellon University. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * $Id: fsm.h,v 1.5 2009/12/31 17:08:08 goldsimon Exp $ + */ + +#ifndef FSM_H +#define FSM_H + +/* + * LCP Packet header = Code, id, length. + */ +#define HEADERLEN (sizeof (u_char) + sizeof (u_char) + sizeof (u_short)) + + +/* + * CP (LCP, IPCP, etc.) codes. + */ +#define CONFREQ 1 /* Configuration Request */ +#define CONFACK 2 /* Configuration Ack */ +#define CONFNAK 3 /* Configuration Nak */ +#define CONFREJ 4 /* Configuration Reject */ +#define TERMREQ 5 /* Termination Request */ +#define TERMACK 6 /* Termination Ack */ +#define CODEREJ 7 /* Code Reject */ + + +/* + * Each FSM is described by an fsm structure and fsm callbacks. + */ +typedef struct fsm { + int unit; /* Interface unit number */ + u_short protocol; /* Data Link Layer Protocol field value */ + int state; /* State */ + int flags; /* Contains option bits */ + u_char id; /* Current id */ + u_char reqid; /* Current request id */ + u_char seen_ack; /* Have received valid Ack/Nak/Rej to Req */ + int timeouttime; /* Timeout time in milliseconds */ + int maxconfreqtransmits; /* Maximum Configure-Request transmissions */ + int retransmits; /* Number of retransmissions left */ + int maxtermtransmits; /* Maximum Terminate-Request transmissions */ + int nakloops; /* Number of nak loops since last ack */ + int maxnakloops; /* Maximum number of nak loops tolerated */ + struct fsm_callbacks* callbacks; /* Callback routines */ + char* term_reason; /* Reason for closing protocol */ + int term_reason_len; /* Length of term_reason */ +} fsm; + + +typedef struct fsm_callbacks { + void (*resetci)(fsm*); /* Reset our Configuration Information */ + int (*cilen)(fsm*); /* Length of our Configuration Information */ + void (*addci)(fsm*, u_char*, int*); /* Add our Configuration Information */ + int (*ackci)(fsm*, u_char*, int); /* ACK our Configuration Information */ + int (*nakci)(fsm*, u_char*, int); /* NAK our Configuration Information */ + int (*rejci)(fsm*, u_char*, int); /* Reject our Configuration Information */ + int (*reqci)(fsm*, u_char*, int*, int); /* Request peer's Configuration Information */ + void (*up)(fsm*); /* Called when fsm reaches LS_OPENED state */ + void (*down)(fsm*); /* Called when fsm leaves LS_OPENED state */ + void (*starting)(fsm*); /* Called when we want the lower layer */ + void (*finished)(fsm*); /* Called when we don't want the lower layer */ + void (*protreject)(int); /* Called when Protocol-Reject received */ + void (*retransmit)(fsm*); /* Retransmission is necessary */ + int (*extcode)(fsm*, int, u_char, u_char*, int); /* Called when unknown code received */ + char *proto_name; /* String name for protocol (for messages) */ +} fsm_callbacks; + + +/* + * Link states. + */ +#define LS_INITIAL 0 /* Down, hasn't been opened */ +#define LS_STARTING 1 /* Down, been opened */ +#define LS_CLOSED 2 /* Up, hasn't been opened */ +#define LS_STOPPED 3 /* Open, waiting for down event */ +#define LS_CLOSING 4 /* Terminating the connection, not open */ +#define LS_STOPPING 5 /* Terminating, but open */ +#define LS_REQSENT 6 /* We've sent a Config Request */ +#define LS_ACKRCVD 7 /* We've received a Config Ack */ +#define LS_ACKSENT 8 /* We've sent a Config Ack */ +#define LS_OPENED 9 /* Connection available */ + +/* + * Flags - indicate options controlling FSM operation + */ +#define OPT_PASSIVE 1 /* Don't die if we don't get a response */ +#define OPT_RESTART 2 /* Treat 2nd OPEN as DOWN, UP */ +#define OPT_SILENT 4 /* Wait for peer to speak first */ + + +/* + * Prototypes + */ +void fsm_init (fsm*); +void fsm_lowerup (fsm*); +void fsm_lowerdown (fsm*); +void fsm_open (fsm*); +void fsm_close (fsm*, char*); +void fsm_input (fsm*, u_char*, int); +void fsm_protreject (fsm*); +void fsm_sdata (fsm*, u_char, u_char, u_char*, int); + + +/* + * Variables + */ +extern int peer_mru[]; /* currently negotiated peer MRU (per unit) */ + +#endif /* FSM_H */ diff --git a/lib/drivers/lwip/src/netif/ppp/ipcp.c b/lib/drivers/lwip/src/netif/ppp/ipcp.c new file mode 100644 index 00000000000..461a600f85c --- /dev/null +++ b/lib/drivers/lwip/src/netif/ppp/ipcp.c @@ -0,0 +1,1411 @@ +/** In contrast to pppd 2.3.1, DNS support has been added, proxy-ARP and + dial-on-demand has been stripped. */ +/***************************************************************************** +* ipcp.c - Network PPP IP Control Protocol program file. +* +* Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc. +* portions Copyright (c) 1997 by Global Election Systems Inc. +* +* The authors hereby grant permission to use, copy, modify, distribute, +* and license this software and its documentation for any purpose, provided +* that existing copyright notices are retained in all copies and that this +* notice and the following disclaimer are included verbatim in any +* distributions. No written agreement, license, or royalty fee is required +* for any of the authorized uses. +* +* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +* IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +****************************************************************************** +* REVISION HISTORY +* +* 03-01-01 Marc Boucher +* Ported to lwIP. +* 97-12-08 Guy Lancaster , Global Election Systems Inc. +* Original. +*****************************************************************************/ +/* + * ipcp.c - PPP IP Control Protocol. + * + * Copyright (c) 1989 Carnegie Mellon University. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by Carnegie Mellon University. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + +#include "lwip/opt.h" + +#if PPP_SUPPORT /* don't build if not configured for use in lwipopts.h */ + +#include "ppp.h" +#include "pppdebug.h" + +#include "auth.h" +#include "fsm.h" +#include "vj.h" +#include "ipcp.h" + +#include "lwip/inet.h" + +#include + +/* #define OLD_CI_ADDRS 1 */ /* Support deprecated address negotiation. */ + +/* global vars */ +ipcp_options ipcp_wantoptions[NUM_PPP]; /* Options that we want to request */ +ipcp_options ipcp_gotoptions[NUM_PPP]; /* Options that peer ack'd */ +ipcp_options ipcp_allowoptions[NUM_PPP]; /* Options we allow peer to request */ +ipcp_options ipcp_hisoptions[NUM_PPP]; /* Options that we ack'd */ + +/* local vars */ +static int default_route_set[NUM_PPP]; /* Have set up a default route */ +static int cis_received[NUM_PPP]; /* # Conf-Reqs received */ + + +/* + * Callbacks for fsm code. (CI = Configuration Information) + */ +static void ipcp_resetci (fsm *); /* Reset our CI */ +static int ipcp_cilen (fsm *); /* Return length of our CI */ +static void ipcp_addci (fsm *, u_char *, int *); /* Add our CI */ +static int ipcp_ackci (fsm *, u_char *, int); /* Peer ack'd our CI */ +static int ipcp_nakci (fsm *, u_char *, int); /* Peer nak'd our CI */ +static int ipcp_rejci (fsm *, u_char *, int); /* Peer rej'd our CI */ +static int ipcp_reqci (fsm *, u_char *, int *, int); /* Rcv CI */ +static void ipcp_up (fsm *); /* We're UP */ +static void ipcp_down (fsm *); /* We're DOWN */ +#if PPP_ADDITIONAL_CALLBACKS +static void ipcp_script (fsm *, char *); /* Run an up/down script */ +#endif +static void ipcp_finished (fsm *); /* Don't need lower layer */ + + +fsm ipcp_fsm[NUM_PPP]; /* IPCP fsm structure */ + + +static fsm_callbacks ipcp_callbacks = { /* IPCP callback routines */ + ipcp_resetci, /* Reset our Configuration Information */ + ipcp_cilen, /* Length of our Configuration Information */ + ipcp_addci, /* Add our Configuration Information */ + ipcp_ackci, /* ACK our Configuration Information */ + ipcp_nakci, /* NAK our Configuration Information */ + ipcp_rejci, /* Reject our Configuration Information */ + ipcp_reqci, /* Request peer's Configuration Information */ + ipcp_up, /* Called when fsm reaches LS_OPENED state */ + ipcp_down, /* Called when fsm leaves LS_OPENED state */ + NULL, /* Called when we want the lower layer up */ + ipcp_finished, /* Called when we want the lower layer down */ + NULL, /* Called when Protocol-Reject received */ + NULL, /* Retransmission is necessary */ + NULL, /* Called to handle protocol-specific codes */ + "IPCP" /* String name of protocol */ +}; + +/* + * Protocol entry points from main code. + */ +static void ipcp_init (int); +static void ipcp_open (int); +static void ipcp_close (int, char *); +static void ipcp_lowerup (int); +static void ipcp_lowerdown (int); +static void ipcp_input (int, u_char *, int); +static void ipcp_protrej (int); + + +struct protent ipcp_protent = { + PPP_IPCP, + ipcp_init, + ipcp_input, + ipcp_protrej, + ipcp_lowerup, + ipcp_lowerdown, + ipcp_open, + ipcp_close, +#if PPP_ADDITIONAL_CALLBACKS + ipcp_printpkt, + NULL, +#endif /* PPP_ADDITIONAL_CALLBACKS */ + 1, + "IPCP", +#if PPP_ADDITIONAL_CALLBACKS + ip_check_options, + NULL, + ip_active_pkt +#endif /* PPP_ADDITIONAL_CALLBACKS */ +}; + +static void ipcp_clear_addrs (int); + +/* + * Lengths of configuration options. + */ +#define CILEN_VOID 2 +#define CILEN_COMPRESS 4 /* min length for compression protocol opt. */ +#define CILEN_VJ 6 /* length for RFC1332 Van-Jacobson opt. */ +#define CILEN_ADDR 6 /* new-style single address option */ +#define CILEN_ADDRS 10 /* old-style dual address option */ + + +#define CODENAME(x) ((x) == CONFACK ? "ACK" : \ + (x) == CONFNAK ? "NAK" : "REJ") + + +/* + * ipcp_init - Initialize IPCP. + */ +static void +ipcp_init(int unit) +{ + fsm *f = &ipcp_fsm[unit]; + ipcp_options *wo = &ipcp_wantoptions[unit]; + ipcp_options *ao = &ipcp_allowoptions[unit]; + + f->unit = unit; + f->protocol = PPP_IPCP; + f->callbacks = &ipcp_callbacks; + fsm_init(&ipcp_fsm[unit]); + + memset(wo, 0, sizeof(*wo)); + memset(ao, 0, sizeof(*ao)); + + wo->neg_addr = 1; + wo->ouraddr = 0; +#if VJ_SUPPORT + wo->neg_vj = 1; +#else /* VJ_SUPPORT */ + wo->neg_vj = 0; +#endif /* VJ_SUPPORT */ + wo->vj_protocol = IPCP_VJ_COMP; + wo->maxslotindex = MAX_SLOTS - 1; + wo->cflag = 0; + wo->default_route = 1; + + ao->neg_addr = 1; +#if VJ_SUPPORT + ao->neg_vj = 1; +#else /* VJ_SUPPORT */ + ao->neg_vj = 0; +#endif /* VJ_SUPPORT */ + ao->maxslotindex = MAX_SLOTS - 1; + ao->cflag = 1; + ao->default_route = 1; +} + + +/* + * ipcp_open - IPCP is allowed to come up. + */ +static void +ipcp_open(int unit) +{ + fsm_open(&ipcp_fsm[unit]); +} + + +/* + * ipcp_close - Take IPCP down. + */ +static void +ipcp_close(int unit, char *reason) +{ + fsm_close(&ipcp_fsm[unit], reason); +} + + +/* + * ipcp_lowerup - The lower layer is up. + */ +static void +ipcp_lowerup(int unit) +{ + fsm_lowerup(&ipcp_fsm[unit]); +} + + +/* + * ipcp_lowerdown - The lower layer is down. + */ +static void +ipcp_lowerdown(int unit) +{ + fsm_lowerdown(&ipcp_fsm[unit]); +} + + +/* + * ipcp_input - Input IPCP packet. + */ +static void +ipcp_input(int unit, u_char *p, int len) +{ + fsm_input(&ipcp_fsm[unit], p, len); +} + + +/* + * ipcp_protrej - A Protocol-Reject was received for IPCP. + * + * Pretend the lower layer went down, so we shut up. + */ +static void +ipcp_protrej(int unit) +{ + fsm_lowerdown(&ipcp_fsm[unit]); +} + + +/* + * ipcp_resetci - Reset our CI. + */ +static void +ipcp_resetci(fsm *f) +{ + ipcp_options *wo = &ipcp_wantoptions[f->unit]; + + wo->req_addr = wo->neg_addr && ipcp_allowoptions[f->unit].neg_addr; + if (wo->ouraddr == 0) { + wo->accept_local = 1; + } + if (wo->hisaddr == 0) { + wo->accept_remote = 1; + } + /* Request DNS addresses from the peer */ + wo->req_dns1 = ppp_settings.usepeerdns; + wo->req_dns2 = ppp_settings.usepeerdns; + ipcp_gotoptions[f->unit] = *wo; + cis_received[f->unit] = 0; +} + + +/* + * ipcp_cilen - Return length of our CI. + */ +static int +ipcp_cilen(fsm *f) +{ + ipcp_options *go = &ipcp_gotoptions[f->unit]; + ipcp_options *wo = &ipcp_wantoptions[f->unit]; + ipcp_options *ho = &ipcp_hisoptions[f->unit]; + +#define LENCIVJ(neg, old) (neg ? (old? CILEN_COMPRESS : CILEN_VJ) : 0) +#define LENCIADDR(neg, old) (neg ? (old? CILEN_ADDRS : CILEN_ADDR) : 0) +#define LENCIDNS(neg) (neg ? (CILEN_ADDR) : 0) + + /* + * First see if we want to change our options to the old + * forms because we have received old forms from the peer. + */ + if (wo->neg_addr && !go->neg_addr && !go->old_addrs) { + /* use the old style of address negotiation */ + go->neg_addr = 1; + go->old_addrs = 1; + } + if (wo->neg_vj && !go->neg_vj && !go->old_vj) { + /* try an older style of VJ negotiation */ + if (cis_received[f->unit] == 0) { + /* keep trying the new style until we see some CI from the peer */ + go->neg_vj = 1; + } else { + /* use the old style only if the peer did */ + if (ho->neg_vj && ho->old_vj) { + go->neg_vj = 1; + go->old_vj = 1; + go->vj_protocol = ho->vj_protocol; + } + } + } + + return (LENCIADDR(go->neg_addr, go->old_addrs) + + LENCIVJ(go->neg_vj, go->old_vj) + + LENCIDNS(go->req_dns1) + + LENCIDNS(go->req_dns2)); +} + + +/* + * ipcp_addci - Add our desired CIs to a packet. + */ +static void +ipcp_addci(fsm *f, u_char *ucp, int *lenp) +{ + ipcp_options *go = &ipcp_gotoptions[f->unit]; + int len = *lenp; + +#define ADDCIVJ(opt, neg, val, old, maxslotindex, cflag) \ + if (neg) { \ + int vjlen = old? CILEN_COMPRESS : CILEN_VJ; \ + if (len >= vjlen) { \ + PUTCHAR(opt, ucp); \ + PUTCHAR(vjlen, ucp); \ + PUTSHORT(val, ucp); \ + if (!old) { \ + PUTCHAR(maxslotindex, ucp); \ + PUTCHAR(cflag, ucp); \ + } \ + len -= vjlen; \ + } else { \ + neg = 0; \ + } \ + } + +#define ADDCIADDR(opt, neg, old, val1, val2) \ + if (neg) { \ + int addrlen = (old? CILEN_ADDRS: CILEN_ADDR); \ + if (len >= addrlen) { \ + u32_t l; \ + PUTCHAR(opt, ucp); \ + PUTCHAR(addrlen, ucp); \ + l = ntohl(val1); \ + PUTLONG(l, ucp); \ + if (old) { \ + l = ntohl(val2); \ + PUTLONG(l, ucp); \ + } \ + len -= addrlen; \ + } else { \ + neg = 0; \ + } \ + } + +#define ADDCIDNS(opt, neg, addr) \ + if (neg) { \ + if (len >= CILEN_ADDR) { \ + u32_t l; \ + PUTCHAR(opt, ucp); \ + PUTCHAR(CILEN_ADDR, ucp); \ + l = ntohl(addr); \ + PUTLONG(l, ucp); \ + len -= CILEN_ADDR; \ + } else { \ + neg = 0; \ + } \ + } + + ADDCIADDR((go->old_addrs? CI_ADDRS: CI_ADDR), go->neg_addr, + go->old_addrs, go->ouraddr, go->hisaddr); + + ADDCIVJ(CI_COMPRESSTYPE, go->neg_vj, go->vj_protocol, go->old_vj, + go->maxslotindex, go->cflag); + + ADDCIDNS(CI_MS_DNS1, go->req_dns1, go->dnsaddr[0]); + + ADDCIDNS(CI_MS_DNS2, go->req_dns2, go->dnsaddr[1]); + + *lenp -= len; +} + + +/* + * ipcp_ackci - Ack our CIs. + * + * Returns: + * 0 - Ack was bad. + * 1 - Ack was good. + */ +static int +ipcp_ackci(fsm *f, u_char *p, int len) +{ + ipcp_options *go = &ipcp_gotoptions[f->unit]; + u_short cilen, citype, cishort; + u32_t cilong; + u_char cimaxslotindex, cicflag; + + /* + * CIs must be in exactly the same order that we sent... + * Check packet length and CI length at each step. + * If we find any deviations, then this packet is bad. + */ + +#define ACKCIVJ(opt, neg, val, old, maxslotindex, cflag) \ + if (neg) { \ + int vjlen = old? CILEN_COMPRESS : CILEN_VJ; \ + if ((len -= vjlen) < 0) { \ + goto bad; \ + } \ + GETCHAR(citype, p); \ + GETCHAR(cilen, p); \ + if (cilen != vjlen || \ + citype != opt) { \ + goto bad; \ + } \ + GETSHORT(cishort, p); \ + if (cishort != val) { \ + goto bad; \ + } \ + if (!old) { \ + GETCHAR(cimaxslotindex, p); \ + if (cimaxslotindex != maxslotindex) { \ + goto bad; \ + } \ + GETCHAR(cicflag, p); \ + if (cicflag != cflag) { \ + goto bad; \ + } \ + } \ + } + +#define ACKCIADDR(opt, neg, old, val1, val2) \ + if (neg) { \ + int addrlen = (old? CILEN_ADDRS: CILEN_ADDR); \ + u32_t l; \ + if ((len -= addrlen) < 0) { \ + goto bad; \ + } \ + GETCHAR(citype, p); \ + GETCHAR(cilen, p); \ + if (cilen != addrlen || \ + citype != opt) { \ + goto bad; \ + } \ + GETLONG(l, p); \ + cilong = htonl(l); \ + if (val1 != cilong) { \ + goto bad; \ + } \ + if (old) { \ + GETLONG(l, p); \ + cilong = htonl(l); \ + if (val2 != cilong) { \ + goto bad; \ + } \ + } \ + } + +#define ACKCIDNS(opt, neg, addr) \ + if (neg) { \ + u32_t l; \ + if ((len -= CILEN_ADDR) < 0) { \ + goto bad; \ + } \ + GETCHAR(citype, p); \ + GETCHAR(cilen, p); \ + if (cilen != CILEN_ADDR || \ + citype != opt) { \ + goto bad; \ + } \ + GETLONG(l, p); \ + cilong = htonl(l); \ + if (addr != cilong) { \ + goto bad; \ + } \ + } + + ACKCIADDR((go->old_addrs? CI_ADDRS: CI_ADDR), go->neg_addr, + go->old_addrs, go->ouraddr, go->hisaddr); + + ACKCIVJ(CI_COMPRESSTYPE, go->neg_vj, go->vj_protocol, go->old_vj, + go->maxslotindex, go->cflag); + + ACKCIDNS(CI_MS_DNS1, go->req_dns1, go->dnsaddr[0]); + + ACKCIDNS(CI_MS_DNS2, go->req_dns2, go->dnsaddr[1]); + + /* + * If there are any remaining CIs, then this packet is bad. + */ + if (len != 0) { + goto bad; + } + return (1); + +bad: + IPCPDEBUG(LOG_INFO, ("ipcp_ackci: received bad Ack!\n")); + return (0); +} + +/* + * ipcp_nakci - Peer has sent a NAK for some of our CIs. + * This should not modify any state if the Nak is bad + * or if IPCP is in the LS_OPENED state. + * + * Returns: + * 0 - Nak was bad. + * 1 - Nak was good. + */ +static int +ipcp_nakci(fsm *f, u_char *p, int len) +{ + ipcp_options *go = &ipcp_gotoptions[f->unit]; + u_char cimaxslotindex, cicflag; + u_char citype, cilen, *next; + u_short cishort; + u32_t ciaddr1, ciaddr2, l, cidnsaddr; + ipcp_options no; /* options we've seen Naks for */ + ipcp_options try; /* options to request next time */ + + BZERO(&no, sizeof(no)); + try = *go; + + /* + * Any Nak'd CIs must be in exactly the same order that we sent. + * Check packet length and CI length at each step. + * If we find any deviations, then this packet is bad. + */ +#define NAKCIADDR(opt, neg, old, code) \ + if (go->neg && \ + len >= (cilen = (old? CILEN_ADDRS: CILEN_ADDR)) && \ + p[1] == cilen && \ + p[0] == opt) { \ + len -= cilen; \ + INCPTR(2, p); \ + GETLONG(l, p); \ + ciaddr1 = htonl(l); \ + if (old) { \ + GETLONG(l, p); \ + ciaddr2 = htonl(l); \ + no.old_addrs = 1; \ + } else { \ + ciaddr2 = 0; \ + } \ + no.neg = 1; \ + code \ + } + +#define NAKCIVJ(opt, neg, code) \ + if (go->neg && \ + ((cilen = p[1]) == CILEN_COMPRESS || cilen == CILEN_VJ) && \ + len >= cilen && \ + p[0] == opt) { \ + len -= cilen; \ + INCPTR(2, p); \ + GETSHORT(cishort, p); \ + no.neg = 1; \ + code \ + } + +#define NAKCIDNS(opt, neg, code) \ + if (go->neg && \ + ((cilen = p[1]) == CILEN_ADDR) && \ + len >= cilen && \ + p[0] == opt) { \ + len -= cilen; \ + INCPTR(2, p); \ + GETLONG(l, p); \ + cidnsaddr = htonl(l); \ + no.neg = 1; \ + code \ + } + + /* + * Accept the peer's idea of {our,his} address, if different + * from our idea, only if the accept_{local,remote} flag is set. + */ + NAKCIADDR((go->old_addrs? CI_ADDRS: CI_ADDR), neg_addr, go->old_addrs, + if (go->accept_local && ciaddr1) { /* Do we know our address? */ + try.ouraddr = ciaddr1; + IPCPDEBUG(LOG_INFO, ("local IP address %s\n", + inet_ntoa(ciaddr1))); + } + if (go->accept_remote && ciaddr2) { /* Does he know his? */ + try.hisaddr = ciaddr2; + IPCPDEBUG(LOG_INFO, ("remote IP address %s\n", + inet_ntoa(ciaddr2))); + } + ); + + /* + * Accept the peer's value of maxslotindex provided that it + * is less than what we asked for. Turn off slot-ID compression + * if the peer wants. Send old-style compress-type option if + * the peer wants. + */ + NAKCIVJ(CI_COMPRESSTYPE, neg_vj, + if (cilen == CILEN_VJ) { + GETCHAR(cimaxslotindex, p); + GETCHAR(cicflag, p); + if (cishort == IPCP_VJ_COMP) { + try.old_vj = 0; + if (cimaxslotindex < go->maxslotindex) { + try.maxslotindex = cimaxslotindex; + } + if (!cicflag) { + try.cflag = 0; + } + } else { + try.neg_vj = 0; + } + } else { + if (cishort == IPCP_VJ_COMP || cishort == IPCP_VJ_COMP_OLD) { + try.old_vj = 1; + try.vj_protocol = cishort; + } else { + try.neg_vj = 0; + } + } + ); + + NAKCIDNS(CI_MS_DNS1, req_dns1, + try.dnsaddr[0] = cidnsaddr; + IPCPDEBUG(LOG_INFO, ("primary DNS address %s\n", inet_ntoa(cidnsaddr))); + ); + + NAKCIDNS(CI_MS_DNS2, req_dns2, + try.dnsaddr[1] = cidnsaddr; + IPCPDEBUG(LOG_INFO, ("secondary DNS address %s\n", inet_ntoa(cidnsaddr))); + ); + + /* + * There may be remaining CIs, if the peer is requesting negotiation + * on an option that we didn't include in our request packet. + * If they want to negotiate about IP addresses, we comply. + * If they want us to ask for compression, we refuse. + */ + while (len > CILEN_VOID) { + GETCHAR(citype, p); + GETCHAR(cilen, p); + if( (len -= cilen) < 0 ) { + goto bad; + } + next = p + cilen - 2; + + switch (citype) { + case CI_COMPRESSTYPE: + if (go->neg_vj || no.neg_vj || + (cilen != CILEN_VJ && cilen != CILEN_COMPRESS)) { + goto bad; + } + no.neg_vj = 1; + break; + case CI_ADDRS: + if ((go->neg_addr && go->old_addrs) || no.old_addrs + || cilen != CILEN_ADDRS) { + goto bad; + } + try.neg_addr = 1; + try.old_addrs = 1; + GETLONG(l, p); + ciaddr1 = htonl(l); + if (ciaddr1 && go->accept_local) { + try.ouraddr = ciaddr1; + } + GETLONG(l, p); + ciaddr2 = htonl(l); + if (ciaddr2 && go->accept_remote) { + try.hisaddr = ciaddr2; + } + no.old_addrs = 1; + break; + case CI_ADDR: + if (go->neg_addr || no.neg_addr || cilen != CILEN_ADDR) { + goto bad; + } + try.old_addrs = 0; + GETLONG(l, p); + ciaddr1 = htonl(l); + if (ciaddr1 && go->accept_local) { + try.ouraddr = ciaddr1; + } + if (try.ouraddr != 0) { + try.neg_addr = 1; + } + no.neg_addr = 1; + break; + } + p = next; + } + + /* If there is still anything left, this packet is bad. */ + if (len != 0) { + goto bad; + } + + /* + * OK, the Nak is good. Now we can update state. + */ + if (f->state != LS_OPENED) { + *go = try; + } + + return 1; + +bad: + IPCPDEBUG(LOG_INFO, ("ipcp_nakci: received bad Nak!\n")); + return 0; +} + + +/* + * ipcp_rejci - Reject some of our CIs. + */ +static int +ipcp_rejci(fsm *f, u_char *p, int len) +{ + ipcp_options *go = &ipcp_gotoptions[f->unit]; + u_char cimaxslotindex, ciflag, cilen; + u_short cishort; + u32_t cilong; + ipcp_options try; /* options to request next time */ + + try = *go; + /* + * Any Rejected CIs must be in exactly the same order that we sent. + * Check packet length and CI length at each step. + * If we find any deviations, then this packet is bad. + */ +#define REJCIADDR(opt, neg, old, val1, val2) \ + if (go->neg && \ + len >= (cilen = old? CILEN_ADDRS: CILEN_ADDR) && \ + p[1] == cilen && \ + p[0] == opt) { \ + u32_t l; \ + len -= cilen; \ + INCPTR(2, p); \ + GETLONG(l, p); \ + cilong = htonl(l); \ + /* Check rejected value. */ \ + if (cilong != val1) { \ + goto bad; \ + } \ + if (old) { \ + GETLONG(l, p); \ + cilong = htonl(l); \ + /* Check rejected value. */ \ + if (cilong != val2) { \ + goto bad; \ + } \ + } \ + try.neg = 0; \ + } + +#define REJCIVJ(opt, neg, val, old, maxslot, cflag) \ + if (go->neg && \ + p[1] == (old? CILEN_COMPRESS : CILEN_VJ) && \ + len >= p[1] && \ + p[0] == opt) { \ + len -= p[1]; \ + INCPTR(2, p); \ + GETSHORT(cishort, p); \ + /* Check rejected value. */ \ + if (cishort != val) { \ + goto bad; \ + } \ + if (!old) { \ + GETCHAR(cimaxslotindex, p); \ + if (cimaxslotindex != maxslot) { \ + goto bad; \ + } \ + GETCHAR(ciflag, p); \ + if (ciflag != cflag) { \ + goto bad; \ + } \ + } \ + try.neg = 0; \ + } + +#define REJCIDNS(opt, neg, dnsaddr) \ + if (go->neg && \ + ((cilen = p[1]) == CILEN_ADDR) && \ + len >= cilen && \ + p[0] == opt) { \ + u32_t l; \ + len -= cilen; \ + INCPTR(2, p); \ + GETLONG(l, p); \ + cilong = htonl(l); \ + /* Check rejected value. */ \ + if (cilong != dnsaddr) { \ + goto bad; \ + } \ + try.neg = 0; \ + } + + REJCIADDR((go->old_addrs? CI_ADDRS: CI_ADDR), neg_addr, + go->old_addrs, go->ouraddr, go->hisaddr); + + REJCIVJ(CI_COMPRESSTYPE, neg_vj, go->vj_protocol, go->old_vj, + go->maxslotindex, go->cflag); + + REJCIDNS(CI_MS_DNS1, req_dns1, go->dnsaddr[0]); + + REJCIDNS(CI_MS_DNS2, req_dns2, go->dnsaddr[1]); + + /* + * If there are any remaining CIs, then this packet is bad. + */ + if (len != 0) { + goto bad; + } + /* + * Now we can update state. + */ + if (f->state != LS_OPENED) { + *go = try; + } + return 1; + +bad: + IPCPDEBUG(LOG_INFO, ("ipcp_rejci: received bad Reject!\n")); + return 0; +} + + +/* + * ipcp_reqci - Check the peer's requested CIs and send appropriate response. + * + * Returns: CONFACK, CONFNAK or CONFREJ and input packet modified + * appropriately. If reject_if_disagree is non-zero, doesn't return + * CONFNAK; returns CONFREJ if it can't return CONFACK. + */ +static int +ipcp_reqci(fsm *f, u_char *inp/* Requested CIs */,int *len/* Length of requested CIs */,int reject_if_disagree) +{ + ipcp_options *wo = &ipcp_wantoptions[f->unit]; + ipcp_options *ho = &ipcp_hisoptions[f->unit]; + ipcp_options *ao = &ipcp_allowoptions[f->unit]; +#ifdef OLD_CI_ADDRS + ipcp_options *go = &ipcp_gotoptions[f->unit]; +#endif + u_char *cip, *next; /* Pointer to current and next CIs */ + u_short cilen, citype; /* Parsed len, type */ + u_short cishort; /* Parsed short value */ + u32_t tl, ciaddr1; /* Parsed address values */ +#ifdef OLD_CI_ADDRS + u32_t ciaddr2; /* Parsed address values */ +#endif + int rc = CONFACK; /* Final packet return code */ + int orc; /* Individual option return code */ + u_char *p; /* Pointer to next char to parse */ + u_char *ucp = inp; /* Pointer to current output char */ + int l = *len; /* Length left */ + u_char maxslotindex, cflag; + int d; + + cis_received[f->unit] = 1; + + /* + * Reset all his options. + */ + BZERO(ho, sizeof(*ho)); + + /* + * Process all his options. + */ + next = inp; + while (l) { + orc = CONFACK; /* Assume success */ + cip = p = next; /* Remember begining of CI */ + if (l < 2 || /* Not enough data for CI header or */ + p[1] < 2 || /* CI length too small or */ + p[1] > l) { /* CI length too big? */ + IPCPDEBUG(LOG_INFO, ("ipcp_reqci: bad CI length!\n")); + orc = CONFREJ; /* Reject bad CI */ + cilen = (u_short)l;/* Reject till end of packet */ + l = 0; /* Don't loop again */ + goto endswitch; + } + GETCHAR(citype, p); /* Parse CI type */ + GETCHAR(cilen, p); /* Parse CI length */ + l -= cilen; /* Adjust remaining length */ + next += cilen; /* Step to next CI */ + + switch (citype) { /* Check CI type */ +#ifdef OLD_CI_ADDRS /* Need to save space... */ + case CI_ADDRS: + IPCPDEBUG(LOG_INFO, ("ipcp_reqci: received ADDRS\n")); + if (!ao->neg_addr || + cilen != CILEN_ADDRS) { /* Check CI length */ + orc = CONFREJ; /* Reject CI */ + break; + } + + /* + * If he has no address, or if we both have his address but + * disagree about it, then NAK it with our idea. + * In particular, if we don't know his address, but he does, + * then accept it. + */ + GETLONG(tl, p); /* Parse source address (his) */ + ciaddr1 = htonl(tl); + IPCPDEBUG(LOG_INFO, ("his addr %s\n", inet_ntoa(ciaddr1))); + if (ciaddr1 != wo->hisaddr + && (ciaddr1 == 0 || !wo->accept_remote)) { + orc = CONFNAK; + if (!reject_if_disagree) { + DECPTR(sizeof(u32_t), p); + tl = ntohl(wo->hisaddr); + PUTLONG(tl, p); + } + } else if (ciaddr1 == 0 && wo->hisaddr == 0) { + /* + * If neither we nor he knows his address, reject the option. + */ + orc = CONFREJ; + wo->req_addr = 0; /* don't NAK with 0.0.0.0 later */ + break; + } + + /* + * If he doesn't know our address, or if we both have our address + * but disagree about it, then NAK it with our idea. + */ + GETLONG(tl, p); /* Parse desination address (ours) */ + ciaddr2 = htonl(tl); + IPCPDEBUG(LOG_INFO, ("our addr %s\n", inet_ntoa(ciaddr2))); + if (ciaddr2 != wo->ouraddr) { + if (ciaddr2 == 0 || !wo->accept_local) { + orc = CONFNAK; + if (!reject_if_disagree) { + DECPTR(sizeof(u32_t), p); + tl = ntohl(wo->ouraddr); + PUTLONG(tl, p); + } + } else { + go->ouraddr = ciaddr2; /* accept peer's idea */ + } + } + + ho->neg_addr = 1; + ho->old_addrs = 1; + ho->hisaddr = ciaddr1; + ho->ouraddr = ciaddr2; + break; +#endif + + case CI_ADDR: + if (!ao->neg_addr) { + IPCPDEBUG(LOG_INFO, ("ipcp_reqci: Reject ADDR not allowed\n")); + orc = CONFREJ; /* Reject CI */ + break; + } else if (cilen != CILEN_ADDR) { /* Check CI length */ + IPCPDEBUG(LOG_INFO, ("ipcp_reqci: Reject ADDR bad len\n")); + orc = CONFREJ; /* Reject CI */ + break; + } + + /* + * If he has no address, or if we both have his address but + * disagree about it, then NAK it with our idea. + * In particular, if we don't know his address, but he does, + * then accept it. + */ + GETLONG(tl, p); /* Parse source address (his) */ + ciaddr1 = htonl(tl); + if (ciaddr1 != wo->hisaddr + && (ciaddr1 == 0 || !wo->accept_remote)) { + orc = CONFNAK; + if (!reject_if_disagree) { + DECPTR(sizeof(u32_t), p); + tl = ntohl(wo->hisaddr); + PUTLONG(tl, p); + } + IPCPDEBUG(LOG_INFO, ("ipcp_reqci: Nak ADDR %s\n", inet_ntoa(ciaddr1))); + } else if (ciaddr1 == 0 && wo->hisaddr == 0) { + /* + * Don't ACK an address of 0.0.0.0 - reject it instead. + */ + IPCPDEBUG(LOG_INFO, ("ipcp_reqci: Reject ADDR %s\n", inet_ntoa(ciaddr1))); + orc = CONFREJ; + wo->req_addr = 0; /* don't NAK with 0.0.0.0 later */ + break; + } + + ho->neg_addr = 1; + ho->hisaddr = ciaddr1; + IPCPDEBUG(LOG_INFO, ("ipcp_reqci: ADDR %s\n", inet_ntoa(ciaddr1))); + break; + + case CI_MS_DNS1: + case CI_MS_DNS2: + /* Microsoft primary or secondary DNS request */ + d = citype == CI_MS_DNS2; + + /* If we do not have a DNS address then we cannot send it */ + if (ao->dnsaddr[d] == 0 || + cilen != CILEN_ADDR) { /* Check CI length */ + IPCPDEBUG(LOG_INFO, ("ipcp_reqci: Rejecting DNS%d Request\n", d+1)); + orc = CONFREJ; /* Reject CI */ + break; + } + GETLONG(tl, p); + if (htonl(tl) != ao->dnsaddr[d]) { + IPCPDEBUG(LOG_INFO, ("ipcp_reqci: Naking DNS%d Request %s\n", + d+1, inet_ntoa(tl))); + DECPTR(sizeof(u32_t), p); + tl = ntohl(ao->dnsaddr[d]); + PUTLONG(tl, p); + orc = CONFNAK; + } + IPCPDEBUG(LOG_INFO, ("ipcp_reqci: received DNS%d Request\n", d+1)); + break; + + case CI_MS_WINS1: + case CI_MS_WINS2: + /* Microsoft primary or secondary WINS request */ + d = citype == CI_MS_WINS2; + IPCPDEBUG(LOG_INFO, ("ipcp_reqci: received WINS%d Request\n", d+1)); + + /* If we do not have a DNS address then we cannot send it */ + if (ao->winsaddr[d] == 0 || + cilen != CILEN_ADDR) { /* Check CI length */ + orc = CONFREJ; /* Reject CI */ + break; + } + GETLONG(tl, p); + if (htonl(tl) != ao->winsaddr[d]) { + DECPTR(sizeof(u32_t), p); + tl = ntohl(ao->winsaddr[d]); + PUTLONG(tl, p); + orc = CONFNAK; + } + break; + + case CI_COMPRESSTYPE: + if (!ao->neg_vj) { + IPCPDEBUG(LOG_INFO, ("ipcp_reqci: Rejecting COMPRESSTYPE not allowed\n")); + orc = CONFREJ; + break; + } else if (cilen != CILEN_VJ && cilen != CILEN_COMPRESS) { + IPCPDEBUG(LOG_INFO, ("ipcp_reqci: Rejecting COMPRESSTYPE len=%d\n", cilen)); + orc = CONFREJ; + break; + } + GETSHORT(cishort, p); + + if (!(cishort == IPCP_VJ_COMP || + (cishort == IPCP_VJ_COMP_OLD && cilen == CILEN_COMPRESS))) { + IPCPDEBUG(LOG_INFO, ("ipcp_reqci: Rejecting COMPRESSTYPE %d\n", cishort)); + orc = CONFREJ; + break; + } + + ho->neg_vj = 1; + ho->vj_protocol = cishort; + if (cilen == CILEN_VJ) { + GETCHAR(maxslotindex, p); + if (maxslotindex > ao->maxslotindex) { + IPCPDEBUG(LOG_INFO, ("ipcp_reqci: Naking VJ max slot %d\n", maxslotindex)); + orc = CONFNAK; + if (!reject_if_disagree) { + DECPTR(1, p); + PUTCHAR(ao->maxslotindex, p); + } + } + GETCHAR(cflag, p); + if (cflag && !ao->cflag) { + IPCPDEBUG(LOG_INFO, ("ipcp_reqci: Naking VJ cflag %d\n", cflag)); + orc = CONFNAK; + if (!reject_if_disagree) { + DECPTR(1, p); + PUTCHAR(wo->cflag, p); + } + } + ho->maxslotindex = maxslotindex; + ho->cflag = cflag; + } else { + ho->old_vj = 1; + ho->maxslotindex = MAX_SLOTS - 1; + ho->cflag = 1; + } + IPCPDEBUG(LOG_INFO, ( + "ipcp_reqci: received COMPRESSTYPE p=%d old=%d maxslot=%d cflag=%d\n", + ho->vj_protocol, ho->old_vj, ho->maxslotindex, ho->cflag)); + break; + + default: + IPCPDEBUG(LOG_INFO, ("ipcp_reqci: Rejecting unknown CI type %d\n", citype)); + orc = CONFREJ; + break; + } + +endswitch: + if (orc == CONFACK && /* Good CI */ + rc != CONFACK) { /* but prior CI wasnt? */ + continue; /* Don't send this one */ + } + + if (orc == CONFNAK) { /* Nak this CI? */ + if (reject_if_disagree) { /* Getting fed up with sending NAKs? */ + IPCPDEBUG(LOG_INFO, ("ipcp_reqci: Rejecting too many naks\n")); + orc = CONFREJ; /* Get tough if so */ + } else { + if (rc == CONFREJ) { /* Rejecting prior CI? */ + continue; /* Don't send this one */ + } + if (rc == CONFACK) { /* Ack'd all prior CIs? */ + rc = CONFNAK; /* Not anymore... */ + ucp = inp; /* Backup */ + } + } + } + + if (orc == CONFREJ && /* Reject this CI */ + rc != CONFREJ) { /* but no prior ones? */ + rc = CONFREJ; + ucp = inp; /* Backup */ + } + + /* Need to move CI? */ + if (ucp != cip) { + BCOPY(cip, ucp, cilen); /* Move it */ + } + + /* Update output pointer */ + INCPTR(cilen, ucp); + } + + /* + * If we aren't rejecting this packet, and we want to negotiate + * their address, and they didn't send their address, then we + * send a NAK with a CI_ADDR option appended. We assume the + * input buffer is long enough that we can append the extra + * option safely. + */ + if (rc != CONFREJ && !ho->neg_addr && + wo->req_addr && !reject_if_disagree) { + IPCPDEBUG(LOG_INFO, ("ipcp_reqci: Requesting peer address\n")); + if (rc == CONFACK) { + rc = CONFNAK; + ucp = inp; /* reset pointer */ + wo->req_addr = 0; /* don't ask again */ + } + PUTCHAR(CI_ADDR, ucp); + PUTCHAR(CILEN_ADDR, ucp); + tl = ntohl(wo->hisaddr); + PUTLONG(tl, ucp); + } + + *len = (int)(ucp - inp); /* Compute output length */ + IPCPDEBUG(LOG_INFO, ("ipcp_reqci: returning Configure-%s\n", CODENAME(rc))); + return (rc); /* Return final code */ +} + + +#if 0 +/* + * ip_check_options - check that any IP-related options are OK, + * and assign appropriate defaults. + */ +static void +ip_check_options(u_long localAddr) +{ + ipcp_options *wo = &ipcp_wantoptions[0]; + + /* + * Load our default IP address but allow the remote host to give us + * a new address. + */ + if (wo->ouraddr == 0 && !ppp_settings.disable_defaultip) { + wo->accept_local = 1; /* don't insist on this default value */ + wo->ouraddr = htonl(localAddr); + } +} +#endif + + +/* + * ipcp_up - IPCP has come UP. + * + * Configure the IP network interface appropriately and bring it up. + */ +static void +ipcp_up(fsm *f) +{ + u32_t mask; + ipcp_options *ho = &ipcp_hisoptions[f->unit]; + ipcp_options *go = &ipcp_gotoptions[f->unit]; + ipcp_options *wo = &ipcp_wantoptions[f->unit]; + + np_up(f->unit, PPP_IP); + IPCPDEBUG(LOG_INFO, ("ipcp: up\n")); + + /* + * We must have a non-zero IP address for both ends of the link. + */ + if (!ho->neg_addr) { + ho->hisaddr = wo->hisaddr; + } + + if (ho->hisaddr == 0) { + IPCPDEBUG(LOG_ERR, ("Could not determine remote IP address\n")); + ipcp_close(f->unit, "Could not determine remote IP address"); + return; + } + if (go->ouraddr == 0) { + IPCPDEBUG(LOG_ERR, ("Could not determine local IP address\n")); + ipcp_close(f->unit, "Could not determine local IP address"); + return; + } + + if (ppp_settings.usepeerdns && (go->dnsaddr[0] || go->dnsaddr[1])) { + /*pppGotDNSAddrs(go->dnsaddr[0], go->dnsaddr[1]);*/ + } + + /* + * Check that the peer is allowed to use the IP address it wants. + */ + if (!auth_ip_addr(f->unit, ho->hisaddr)) { + IPCPDEBUG(LOG_ERR, ("Peer is not authorized to use remote address %s\n", + inet_ntoa(ho->hisaddr))); + ipcp_close(f->unit, "Unauthorized remote IP address"); + return; + } + + /* set tcp compression */ + sifvjcomp(f->unit, ho->neg_vj, ho->cflag, ho->maxslotindex); + + /* + * Set IP addresses and (if specified) netmask. + */ + mask = GetMask(go->ouraddr); + + if (!sifaddr(f->unit, go->ouraddr, ho->hisaddr, mask, go->dnsaddr[0], go->dnsaddr[1])) { + IPCPDEBUG(LOG_WARNING, ("sifaddr failed\n")); + ipcp_close(f->unit, "Interface configuration failed"); + return; + } + + /* bring the interface up for IP */ + if (!sifup(f->unit)) { + IPCPDEBUG(LOG_WARNING, ("sifup failed\n")); + ipcp_close(f->unit, "Interface configuration failed"); + return; + } + + sifnpmode(f->unit, PPP_IP, NPMODE_PASS); + + /* assign a default route through the interface if required */ + if (ipcp_wantoptions[f->unit].default_route) { + if (sifdefaultroute(f->unit, go->ouraddr, ho->hisaddr)) { + default_route_set[f->unit] = 1; + } + } + + IPCPDEBUG(LOG_NOTICE, ("local IP address %s\n", inet_ntoa(go->ouraddr))); + IPCPDEBUG(LOG_NOTICE, ("remote IP address %s\n", inet_ntoa(ho->hisaddr))); + if (go->dnsaddr[0]) { + IPCPDEBUG(LOG_NOTICE, ("primary DNS address %s\n", inet_ntoa(go->dnsaddr[0]))); + } + if (go->dnsaddr[1]) { + IPCPDEBUG(LOG_NOTICE, ("secondary DNS address %s\n", inet_ntoa(go->dnsaddr[1]))); + } +} + + +/* + * ipcp_down - IPCP has gone DOWN. + * + * Take the IP network interface down, clear its addresses + * and delete routes through it. + */ +static void +ipcp_down(fsm *f) +{ + IPCPDEBUG(LOG_INFO, ("ipcp: down\n")); + np_down(f->unit, PPP_IP); + sifvjcomp(f->unit, 0, 0, 0); + + sifdown(f->unit); + ipcp_clear_addrs(f->unit); +} + + +/* + * ipcp_clear_addrs() - clear the interface addresses, routes, etc. + */ +static void +ipcp_clear_addrs(int unit) +{ + u32_t ouraddr, hisaddr; + + ouraddr = ipcp_gotoptions[unit].ouraddr; + hisaddr = ipcp_hisoptions[unit].hisaddr; + if (default_route_set[unit]) { + cifdefaultroute(unit, ouraddr, hisaddr); + default_route_set[unit] = 0; + } + cifaddr(unit, ouraddr, hisaddr); +} + + +/* + * ipcp_finished - possibly shut down the lower layers. + */ +static void +ipcp_finished(fsm *f) +{ + np_finished(f->unit, PPP_IP); +} + +#if PPP_ADDITIONAL_CALLBACKS +static int +ipcp_printpkt(u_char *p, int plen, void (*printer) (void *, char *, ...), void *arg) +{ + LWIP_UNUSED_ARG(p); + LWIP_UNUSED_ARG(plen); + LWIP_UNUSED_ARG(printer); + LWIP_UNUSED_ARG(arg); + return 0; +} + +/* + * ip_active_pkt - see if this IP packet is worth bringing the link up for. + * We don't bring the link up for IP fragments or for TCP FIN packets + * with no data. + */ +#define IP_HDRLEN 20 /* bytes */ +#define IP_OFFMASK 0x1fff +#define IPPROTO_TCP 6 +#define TCP_HDRLEN 20 +#define TH_FIN 0x01 + +/* + * We use these macros because the IP header may be at an odd address, + * and some compilers might use word loads to get th_off or ip_hl. + */ + +#define net_short(x) (((x)[0] << 8) + (x)[1]) +#define get_iphl(x) (((unsigned char *)(x))[0] & 0xF) +#define get_ipoff(x) net_short((unsigned char *)(x) + 6) +#define get_ipproto(x) (((unsigned char *)(x))[9]) +#define get_tcpoff(x) (((unsigned char *)(x))[12] >> 4) +#define get_tcpflags(x) (((unsigned char *)(x))[13]) + +static int +ip_active_pkt(u_char *pkt, int len) +{ + u_char *tcp; + int hlen; + + len -= PPP_HDRLEN; + pkt += PPP_HDRLEN; + if (len < IP_HDRLEN) { + return 0; + } + if ((get_ipoff(pkt) & IP_OFFMASK) != 0) { + return 0; + } + if (get_ipproto(pkt) != IPPROTO_TCP) { + return 1; + } + hlen = get_iphl(pkt) * 4; + if (len < hlen + TCP_HDRLEN) { + return 0; + } + tcp = pkt + hlen; + if ((get_tcpflags(tcp) & TH_FIN) != 0 && len == hlen + get_tcpoff(tcp) * 4) { + return 0; + } + return 1; +} +#endif /* PPP_ADDITIONAL_CALLBACKS */ + +#endif /* PPP_SUPPORT */ diff --git a/lib/drivers/lwip/src/netif/ppp/ipcp.h b/lib/drivers/lwip/src/netif/ppp/ipcp.h new file mode 100644 index 00000000000..de03f460ecb --- /dev/null +++ b/lib/drivers/lwip/src/netif/ppp/ipcp.h @@ -0,0 +1,106 @@ +/***************************************************************************** +* ipcp.h - PPP IP NCP: Internet Protocol Network Control Protocol header file. +* +* Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc. +* portions Copyright (c) 1997 Global Election Systems Inc. +* +* The authors hereby grant permission to use, copy, modify, distribute, +* and license this software and its documentation for any purpose, provided +* that existing copyright notices are retained in all copies and that this +* notice and the following disclaimer are included verbatim in any +* distributions. No written agreement, license, or royalty fee is required +* for any of the authorized uses. +* +* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +* IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +****************************************************************************** +* REVISION HISTORY +* +* 03-01-01 Marc Boucher +* Ported to lwIP. +* 97-12-04 Guy Lancaster , Global Election Systems Inc. +* Original derived from BSD codes. +*****************************************************************************/ +/* + * ipcp.h - IP Control Protocol definitions. + * + * Copyright (c) 1989 Carnegie Mellon University. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by Carnegie Mellon University. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * $Id: ipcp.h,v 1.4 2010/01/18 20:49:43 goldsimon Exp $ + */ + +#ifndef IPCP_H +#define IPCP_H + +/* + * Options. + */ +#define CI_ADDRS 1 /* IP Addresses */ +#define CI_COMPRESSTYPE 2 /* Compression Type */ +#define CI_ADDR 3 + +#define CI_MS_DNS1 129 /* Primary DNS value */ +#define CI_MS_WINS1 128 /* Primary WINS value */ +#define CI_MS_DNS2 131 /* Secondary DNS value */ +#define CI_MS_WINS2 130 /* Secondary WINS value */ + +#define IPCP_VJMODE_OLD 1 /* "old" mode (option # = 0x0037) */ +#define IPCP_VJMODE_RFC1172 2 /* "old-rfc"mode (option # = 0x002d) */ +#define IPCP_VJMODE_RFC1332 3 /* "new-rfc"mode (option # = 0x002d, */ + /* maxslot and slot number compression) */ + +#define IPCP_VJ_COMP 0x002d /* current value for VJ compression option */ +#define IPCP_VJ_COMP_OLD 0x0037 /* "old" (i.e, broken) value for VJ */ + /* compression option */ + +typedef struct ipcp_options { + u_int neg_addr : 1; /* Negotiate IP Address? */ + u_int old_addrs : 1; /* Use old (IP-Addresses) option? */ + u_int req_addr : 1; /* Ask peer to send IP address? */ + u_int default_route : 1; /* Assign default route through interface? */ + u_int proxy_arp : 1; /* Make proxy ARP entry for peer? */ + u_int neg_vj : 1; /* Van Jacobson Compression? */ + u_int old_vj : 1; /* use old (short) form of VJ option? */ + u_int accept_local : 1; /* accept peer's value for ouraddr */ + u_int accept_remote : 1; /* accept peer's value for hisaddr */ + u_int req_dns1 : 1; /* Ask peer to send primary DNS address? */ + u_int req_dns2 : 1; /* Ask peer to send secondary DNS address? */ + u_short vj_protocol; /* protocol value to use in VJ option */ + u_char maxslotindex; /* VJ slots - 1. */ + u_char cflag; /* VJ slot compression flag. */ + u32_t ouraddr, hisaddr; /* Addresses in NETWORK BYTE ORDER */ + u32_t dnsaddr[2]; /* Primary and secondary MS DNS entries */ + u32_t winsaddr[2]; /* Primary and secondary MS WINS entries */ +} ipcp_options; + +extern fsm ipcp_fsm[]; +extern ipcp_options ipcp_wantoptions[]; +extern ipcp_options ipcp_gotoptions[]; +extern ipcp_options ipcp_allowoptions[]; +extern ipcp_options ipcp_hisoptions[]; + +extern struct protent ipcp_protent; + +#endif /* IPCP_H */ diff --git a/lib/drivers/lwip/src/netif/ppp/lcp.c b/lib/drivers/lwip/src/netif/ppp/lcp.c new file mode 100644 index 00000000000..21c83ac4449 --- /dev/null +++ b/lib/drivers/lwip/src/netif/ppp/lcp.c @@ -0,0 +1,2066 @@ +/***************************************************************************** +* lcp.c - Network Link Control Protocol program file. +* +* Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc. +* portions Copyright (c) 1997 by Global Election Systems Inc. +* +* The authors hereby grant permission to use, copy, modify, distribute, +* and license this software and its documentation for any purpose, provided +* that existing copyright notices are retained in all copies and that this +* notice and the following disclaimer are included verbatim in any +* distributions. No written agreement, license, or royalty fee is required +* for any of the authorized uses. +* +* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +* IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +****************************************************************************** +* REVISION HISTORY +* +* 03-01-01 Marc Boucher +* Ported to lwIP. +* 97-12-01 Guy Lancaster , Global Election Systems Inc. +* Original. +*****************************************************************************/ + +/* + * lcp.c - PPP Link Control Protocol. + * + * Copyright (c) 1989 Carnegie Mellon University. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by Carnegie Mellon University. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + + +#include "lwip/opt.h" + +#if PPP_SUPPORT /* don't build if not configured for use in lwipopts.h */ + +#include "ppp.h" +#include "pppdebug.h" + +#include "fsm.h" +#include "chap.h" +#include "magic.h" +#include "auth.h" +#include "lcp.h" + +#include + +#if PPPOE_SUPPORT +#include "netif/ppp_oe.h" +#else +#define PPPOE_MAXMTU PPP_MAXMRU +#endif + +#if 0 /* UNUSED */ +/* + * LCP-related command-line options. + */ +int lcp_echo_interval = 0; /* Interval between LCP echo-requests */ +int lcp_echo_fails = 0; /* Tolerance to unanswered echo-requests */ +bool lax_recv = 0; /* accept control chars in asyncmap */ + +static int setescape (char **); + +static option_t lcp_option_list[] = { + /* LCP options */ + /* list stripped for simplicity */ + {NULL} +}; +#endif /* UNUSED */ + +/* options */ +LinkPhase lcp_phase[NUM_PPP]; /* Phase of link session (RFC 1661) */ +static u_int lcp_echo_interval = LCP_ECHOINTERVAL; /* Interval between LCP echo-requests */ +static u_int lcp_echo_fails = LCP_MAXECHOFAILS; /* Tolerance to unanswered echo-requests */ + +/* global vars */ +static fsm lcp_fsm[NUM_PPP]; /* LCP fsm structure (global)*/ +lcp_options lcp_wantoptions[NUM_PPP]; /* Options that we want to request */ +lcp_options lcp_gotoptions[NUM_PPP]; /* Options that peer ack'd */ +lcp_options lcp_allowoptions[NUM_PPP]; /* Options we allow peer to request */ +lcp_options lcp_hisoptions[NUM_PPP]; /* Options that we ack'd */ +ext_accm xmit_accm[NUM_PPP]; /* extended transmit ACCM */ + +static u32_t lcp_echos_pending = 0; /* Number of outstanding echo msgs */ +static u32_t lcp_echo_number = 0; /* ID number of next echo frame */ +static u32_t lcp_echo_timer_running = 0; /* TRUE if a timer is running */ + +/* @todo: do we really need such a large buffer? The typical 1500 bytes seem too much. */ +static u_char nak_buffer[PPP_MRU]; /* where we construct a nak packet */ + +/* + * Callbacks for fsm code. (CI = Configuration Information) + */ +static void lcp_resetci (fsm*); /* Reset our CI */ +static int lcp_cilen (fsm*); /* Return length of our CI */ +static void lcp_addci (fsm*, u_char*, int*); /* Add our CI to pkt */ +static int lcp_ackci (fsm*, u_char*, int); /* Peer ack'd our CI */ +static int lcp_nakci (fsm*, u_char*, int); /* Peer nak'd our CI */ +static int lcp_rejci (fsm*, u_char*, int); /* Peer rej'd our CI */ +static int lcp_reqci (fsm*, u_char*, int*, int); /* Rcv peer CI */ +static void lcp_up (fsm*); /* We're UP */ +static void lcp_down (fsm*); /* We're DOWN */ +static void lcp_starting (fsm*); /* We need lower layer up */ +static void lcp_finished (fsm*); /* We need lower layer down */ +static int lcp_extcode (fsm*, int, u_char, u_char*, int); +static void lcp_rprotrej (fsm*, u_char*, int); + +/* + * routines to send LCP echos to peer + */ + +static void lcp_echo_lowerup (int); +static void lcp_echo_lowerdown (int); +static void LcpEchoTimeout (void*); +static void lcp_received_echo_reply (fsm*, int, u_char*, int); +static void LcpSendEchoRequest (fsm*); +static void LcpLinkFailure (fsm*); +static void LcpEchoCheck (fsm*); + +static fsm_callbacks lcp_callbacks = { /* LCP callback routines */ + lcp_resetci, /* Reset our Configuration Information */ + lcp_cilen, /* Length of our Configuration Information */ + lcp_addci, /* Add our Configuration Information */ + lcp_ackci, /* ACK our Configuration Information */ + lcp_nakci, /* NAK our Configuration Information */ + lcp_rejci, /* Reject our Configuration Information */ + lcp_reqci, /* Request peer's Configuration Information */ + lcp_up, /* Called when fsm reaches LS_OPENED state */ + lcp_down, /* Called when fsm leaves LS_OPENED state */ + lcp_starting, /* Called when we want the lower layer up */ + lcp_finished, /* Called when we want the lower layer down */ + NULL, /* Called when Protocol-Reject received */ + NULL, /* Retransmission is necessary */ + lcp_extcode, /* Called to handle LCP-specific codes */ + "LCP" /* String name of protocol */ +}; + +/* + * Protocol entry points. + * Some of these are called directly. + */ + +static void lcp_input (int, u_char *, int); +static void lcp_protrej (int); + +struct protent lcp_protent = { + PPP_LCP, + lcp_init, + lcp_input, + lcp_protrej, + lcp_lowerup, + lcp_lowerdown, + lcp_open, + lcp_close, +#if PPP_ADDITIONAL_CALLBACKS + lcp_printpkt, + NULL, +#endif /* PPP_ADDITIONAL_CALLBACKS */ + 1, + "LCP", +#if PPP_ADDITIONAL_CALLBACKS + NULL, + NULL, + NULL +#endif /* PPP_ADDITIONAL_CALLBACKS */ +}; + +int lcp_loopbackfail = DEFLOOPBACKFAIL; + +/* + * Length of each type of configuration option (in octets) + */ +#define CILEN_VOID 2 +#define CILEN_CHAR 3 +#define CILEN_SHORT 4 /* CILEN_VOID + sizeof(short) */ +#define CILEN_CHAP 5 /* CILEN_VOID + sizeof(short) + 1 */ +#define CILEN_LONG 6 /* CILEN_VOID + sizeof(long) */ +#define CILEN_LQR 8 /* CILEN_VOID + sizeof(short) + sizeof(long) */ +#define CILEN_CBCP 3 + +#define CODENAME(x) ((x) == CONFACK ? "ACK" : (x) == CONFNAK ? "NAK" : "REJ") + +#if 0 /* UNUSED */ +/* + * setescape - add chars to the set we escape on transmission. + */ +static int +setescape(argv) + char **argv; +{ + int n, ret; + char *p, *endp; + + p = *argv; + ret = 1; + while (*p) { + n = strtol(p, &endp, 16); + if (p == endp) { + option_error("escape parameter contains invalid hex number '%s'", p); + return 0; + } + p = endp; + if (n < 0 || n == 0x5E || n > 0xFF) { + option_error("can't escape character 0x%x", n); + ret = 0; + } else + xmit_accm[0][n >> 5] |= 1 << (n & 0x1F); + while (*p == ',' || *p == ' ') + ++p; + } + return ret; +} +#endif /* UNUSED */ + +/* + * lcp_init - Initialize LCP. + */ +void +lcp_init(int unit) +{ + fsm *f = &lcp_fsm[unit]; + lcp_options *wo = &lcp_wantoptions[unit]; + lcp_options *ao = &lcp_allowoptions[unit]; + + f->unit = unit; + f->protocol = PPP_LCP; + f->callbacks = &lcp_callbacks; + + fsm_init(f); + + wo->passive = 0; + wo->silent = 0; + wo->restart = 0; /* Set to 1 in kernels or multi-line implementations */ + wo->neg_mru = 1; + wo->mru = PPP_DEFMRU; + wo->neg_asyncmap = 1; + wo->asyncmap = 0x00000000l; /* Assume don't need to escape any ctl chars. */ + wo->neg_chap = 0; /* Set to 1 on server */ + wo->neg_upap = 0; /* Set to 1 on server */ + wo->chap_mdtype = CHAP_DIGEST_MD5; + wo->neg_magicnumber = 1; + wo->neg_pcompression = 1; + wo->neg_accompression = 1; + wo->neg_lqr = 0; /* no LQR implementation yet */ + wo->neg_cbcp = 0; + + ao->neg_mru = 1; + ao->mru = PPP_MAXMRU; + ao->neg_asyncmap = 1; + ao->asyncmap = 0x00000000l; /* Assume don't need to escape any ctl chars. */ + ao->neg_chap = (CHAP_SUPPORT != 0); + ao->chap_mdtype = CHAP_DIGEST_MD5; + ao->neg_upap = (PAP_SUPPORT != 0); + ao->neg_magicnumber = 1; + ao->neg_pcompression = 1; + ao->neg_accompression = 1; + ao->neg_lqr = 0; /* no LQR implementation yet */ + ao->neg_cbcp = (CBCP_SUPPORT != 0); + + /* + * Set transmit escape for the flag and escape characters plus anything + * set for the allowable options. + */ + memset(xmit_accm[unit], 0, sizeof(xmit_accm[0])); + xmit_accm[unit][15] = 0x60; + xmit_accm[unit][0] = (u_char)((ao->asyncmap & 0xFF)); + xmit_accm[unit][1] = (u_char)((ao->asyncmap >> 8) & 0xFF); + xmit_accm[unit][2] = (u_char)((ao->asyncmap >> 16) & 0xFF); + xmit_accm[unit][3] = (u_char)((ao->asyncmap >> 24) & 0xFF); + LCPDEBUG(LOG_INFO, ("lcp_init: xmit_accm=%X %X %X %X\n", + xmit_accm[unit][0], + xmit_accm[unit][1], + xmit_accm[unit][2], + xmit_accm[unit][3])); + + lcp_phase[unit] = PHASE_INITIALIZE; +} + + +/* + * lcp_open - LCP is allowed to come up. + */ +void +lcp_open(int unit) +{ + fsm *f = &lcp_fsm[unit]; + lcp_options *wo = &lcp_wantoptions[unit]; + + f->flags = 0; + if (wo->passive) { + f->flags |= OPT_PASSIVE; + } + if (wo->silent) { + f->flags |= OPT_SILENT; + } + fsm_open(f); + + lcp_phase[unit] = PHASE_ESTABLISH; +} + + +/* + * lcp_close - Take LCP down. + */ +void +lcp_close(int unit, char *reason) +{ + fsm *f = &lcp_fsm[unit]; + + if (lcp_phase[unit] != PHASE_DEAD) { + lcp_phase[unit] = PHASE_TERMINATE; + } + if (f->state == LS_STOPPED && f->flags & (OPT_PASSIVE|OPT_SILENT)) { + /* + * This action is not strictly according to the FSM in RFC1548, + * but it does mean that the program terminates if you do an + * lcp_close() in passive/silent mode when a connection hasn't + * been established. + */ + f->state = LS_CLOSED; + lcp_finished(f); + } else { + fsm_close(f, reason); + } +} + + +/* + * lcp_lowerup - The lower layer is up. + */ +void +lcp_lowerup(int unit) +{ + lcp_options *wo = &lcp_wantoptions[unit]; + + /* + * Don't use A/C or protocol compression on transmission, + * but accept A/C and protocol compressed packets + * if we are going to ask for A/C and protocol compression. + */ + ppp_set_xaccm(unit, &xmit_accm[unit]); + ppp_send_config(unit, PPP_MRU, 0xffffffffl, 0, 0); + ppp_recv_config(unit, PPP_MRU, 0x00000000l, + wo->neg_pcompression, wo->neg_accompression); + peer_mru[unit] = PPP_MRU; + lcp_allowoptions[unit].asyncmap = (u_long)xmit_accm[unit][0] + | ((u_long)xmit_accm[unit][1] << 8) + | ((u_long)xmit_accm[unit][2] << 16) + | ((u_long)xmit_accm[unit][3] << 24); + LCPDEBUG(LOG_INFO, ("lcp_lowerup: asyncmap=%X %X %X %X\n", + xmit_accm[unit][3], + xmit_accm[unit][2], + xmit_accm[unit][1], + xmit_accm[unit][0])); + + fsm_lowerup(&lcp_fsm[unit]); +} + + +/* + * lcp_lowerdown - The lower layer is down. + */ +void +lcp_lowerdown(int unit) +{ + fsm_lowerdown(&lcp_fsm[unit]); +} + + +/* + * lcp_input - Input LCP packet. + */ +static void +lcp_input(int unit, u_char *p, int len) +{ + fsm *f = &lcp_fsm[unit]; + + fsm_input(f, p, len); +} + + +/* + * lcp_extcode - Handle a LCP-specific code. + */ +static int +lcp_extcode(fsm *f, int code, u_char id, u_char *inp, int len) +{ + u_char *magp; + + switch( code ){ + case PROTREJ: + lcp_rprotrej(f, inp, len); + break; + + case ECHOREQ: + if (f->state != LS_OPENED) { + break; + } + LCPDEBUG(LOG_INFO, ("lcp: Echo-Request, Rcvd id %d\n", id)); + magp = inp; + PUTLONG(lcp_gotoptions[f->unit].magicnumber, magp); + fsm_sdata(f, ECHOREP, id, inp, len); + break; + + case ECHOREP: + lcp_received_echo_reply(f, id, inp, len); + break; + + case DISCREQ: + break; + + default: + return 0; + } + return 1; +} + + +/* + * lcp_rprotrej - Receive an Protocol-Reject. + * + * Figure out which protocol is rejected and inform it. + */ +static void +lcp_rprotrej(fsm *f, u_char *inp, int len) +{ + int i; + struct protent *protp; + u_short prot; + + if (len < (int)sizeof (u_short)) { + LCPDEBUG(LOG_INFO, ("lcp_rprotrej: Rcvd short Protocol-Reject packet!\n")); + return; + } + + GETSHORT(prot, inp); + + LCPDEBUG(LOG_INFO, ("lcp_rprotrej: Rcvd Protocol-Reject packet for %x!\n", prot)); + + /* + * Protocol-Reject packets received in any state other than the LCP + * LS_OPENED state SHOULD be silently discarded. + */ + if( f->state != LS_OPENED ) { + LCPDEBUG(LOG_INFO, ("Protocol-Reject discarded: LCP in state %d\n", f->state)); + return; + } + + /* + * Upcall the proper Protocol-Reject routine. + */ + for (i = 0; (protp = ppp_protocols[i]) != NULL; ++i) { + if (protp->protocol == prot && protp->enabled_flag) { + (*protp->protrej)(f->unit); + return; + } + } + + LCPDEBUG(LOG_WARNING, ("Protocol-Reject for unsupported protocol 0x%x\n", prot)); +} + + +/* + * lcp_protrej - A Protocol-Reject was received. + */ +static void +lcp_protrej(int unit) +{ + LWIP_UNUSED_ARG(unit); + /* + * Can't reject LCP! + */ + LCPDEBUG(LOG_WARNING, ("lcp_protrej: Received Protocol-Reject for LCP!\n")); + fsm_protreject(&lcp_fsm[unit]); +} + + +/* + * lcp_sprotrej - Send a Protocol-Reject for some protocol. + */ +void +lcp_sprotrej(int unit, u_char *p, int len) +{ + /* + * Send back the protocol and the information field of the + * rejected packet. We only get here if LCP is in the LS_OPENED state. + */ + + fsm_sdata(&lcp_fsm[unit], PROTREJ, ++lcp_fsm[unit].id, p, len); +} + + +/* + * lcp_resetci - Reset our CI. + */ +static void +lcp_resetci(fsm *f) +{ + lcp_wantoptions[f->unit].magicnumber = magic(); + lcp_wantoptions[f->unit].numloops = 0; + lcp_gotoptions[f->unit] = lcp_wantoptions[f->unit]; + peer_mru[f->unit] = PPP_MRU; + auth_reset(f->unit); +} + + +/* + * lcp_cilen - Return length of our CI. + */ +static int +lcp_cilen(fsm *f) +{ + lcp_options *go = &lcp_gotoptions[f->unit]; + +#define LENCIVOID(neg) ((neg) ? CILEN_VOID : 0) +#define LENCICHAP(neg) ((neg) ? CILEN_CHAP : 0) +#define LENCISHORT(neg) ((neg) ? CILEN_SHORT : 0) +#define LENCILONG(neg) ((neg) ? CILEN_LONG : 0) +#define LENCILQR(neg) ((neg) ? CILEN_LQR: 0) +#define LENCICBCP(neg) ((neg) ? CILEN_CBCP: 0) + /* + * NB: we only ask for one of CHAP and UPAP, even if we will + * accept either. + */ + return (LENCISHORT(go->neg_mru && go->mru != PPP_DEFMRU) + + LENCILONG(go->neg_asyncmap && go->asyncmap != 0xFFFFFFFFl) + + LENCICHAP(go->neg_chap) + + LENCISHORT(!go->neg_chap && go->neg_upap) + + LENCILQR(go->neg_lqr) + + LENCICBCP(go->neg_cbcp) + + LENCILONG(go->neg_magicnumber) + + LENCIVOID(go->neg_pcompression) + + LENCIVOID(go->neg_accompression)); +} + + +/* + * lcp_addci - Add our desired CIs to a packet. + */ +static void +lcp_addci(fsm *f, u_char *ucp, int *lenp) +{ + lcp_options *go = &lcp_gotoptions[f->unit]; + u_char *start_ucp = ucp; + +#define ADDCIVOID(opt, neg) \ + if (neg) { \ + LCPDEBUG(LOG_INFO, ("lcp_addci: opt=%d\n", opt)); \ + PUTCHAR(opt, ucp); \ + PUTCHAR(CILEN_VOID, ucp); \ + } +#define ADDCISHORT(opt, neg, val) \ + if (neg) { \ + LCPDEBUG(LOG_INFO, ("lcp_addci: INT opt=%d %X\n", opt, val)); \ + PUTCHAR(opt, ucp); \ + PUTCHAR(CILEN_SHORT, ucp); \ + PUTSHORT(val, ucp); \ + } +#define ADDCICHAP(opt, neg, val, digest) \ + if (neg) { \ + LCPDEBUG(LOG_INFO, ("lcp_addci: CHAP opt=%d %X\n", opt, val)); \ + PUTCHAR(opt, ucp); \ + PUTCHAR(CILEN_CHAP, ucp); \ + PUTSHORT(val, ucp); \ + PUTCHAR(digest, ucp); \ + } +#define ADDCILONG(opt, neg, val) \ + if (neg) { \ + LCPDEBUG(LOG_INFO, ("lcp_addci: L opt=%d %lX\n", opt, val)); \ + PUTCHAR(opt, ucp); \ + PUTCHAR(CILEN_LONG, ucp); \ + PUTLONG(val, ucp); \ + } +#define ADDCILQR(opt, neg, val) \ + if (neg) { \ + LCPDEBUG(LOG_INFO, ("lcp_addci: LQR opt=%d %lX\n", opt, val)); \ + PUTCHAR(opt, ucp); \ + PUTCHAR(CILEN_LQR, ucp); \ + PUTSHORT(PPP_LQR, ucp); \ + PUTLONG(val, ucp); \ + } +#define ADDCICHAR(opt, neg, val) \ + if (neg) { \ + LCPDEBUG(LOG_INFO, ("lcp_addci: CHAR opt=%d %X '%z'\n", opt, val, val)); \ + PUTCHAR(opt, ucp); \ + PUTCHAR(CILEN_CHAR, ucp); \ + PUTCHAR(val, ucp); \ + } + + ADDCISHORT(CI_MRU, go->neg_mru && go->mru != PPP_DEFMRU, go->mru); + ADDCILONG(CI_ASYNCMAP, go->neg_asyncmap && go->asyncmap != 0xFFFFFFFFl, go->asyncmap); + ADDCICHAP(CI_AUTHTYPE, go->neg_chap, PPP_CHAP, go->chap_mdtype); + ADDCISHORT(CI_AUTHTYPE, !go->neg_chap && go->neg_upap, PPP_PAP); + ADDCILQR(CI_QUALITY, go->neg_lqr, go->lqr_period); + ADDCICHAR(CI_CALLBACK, go->neg_cbcp, CBCP_OPT); + ADDCILONG(CI_MAGICNUMBER, go->neg_magicnumber, go->magicnumber); + ADDCIVOID(CI_PCOMPRESSION, go->neg_pcompression); + ADDCIVOID(CI_ACCOMPRESSION, go->neg_accompression); + + if (ucp - start_ucp != *lenp) { + /* this should never happen, because peer_mtu should be 1500 */ + LCPDEBUG(LOG_ERR, ("Bug in lcp_addci: wrong length\n")); + } +} + + +/* + * lcp_ackci - Ack our CIs. + * This should not modify any state if the Ack is bad. + * + * Returns: + * 0 - Ack was bad. + * 1 - Ack was good. + */ +static int +lcp_ackci(fsm *f, u_char *p, int len) +{ + lcp_options *go = &lcp_gotoptions[f->unit]; + u_char cilen, citype, cichar; + u_short cishort; + u32_t cilong; + + /* + * CIs must be in exactly the same order that we sent. + * Check packet length and CI length at each step. + * If we find any deviations, then this packet is bad. + */ +#define ACKCIVOID(opt, neg) \ + if (neg) { \ + if ((len -= CILEN_VOID) < 0) \ + goto bad; \ + GETCHAR(citype, p); \ + GETCHAR(cilen, p); \ + if (cilen != CILEN_VOID || citype != opt) \ + goto bad; \ + } +#define ACKCISHORT(opt, neg, val) \ + if (neg) { \ + if ((len -= CILEN_SHORT) < 0) \ + goto bad; \ + GETCHAR(citype, p); \ + GETCHAR(cilen, p); \ + if (cilen != CILEN_SHORT || citype != opt) \ + goto bad; \ + GETSHORT(cishort, p); \ + if (cishort != val) \ + goto bad; \ + } +#define ACKCICHAR(opt, neg, val) \ + if (neg) { \ + if ((len -= CILEN_CHAR) < 0) \ + goto bad; \ + GETCHAR(citype, p); \ + GETCHAR(cilen, p); \ + if (cilen != CILEN_CHAR || citype != opt) \ + goto bad; \ + GETCHAR(cichar, p); \ + if (cichar != val) \ + goto bad; \ + } +#define ACKCICHAP(opt, neg, val, digest) \ + if (neg) { \ + if ((len -= CILEN_CHAP) < 0) \ + goto bad; \ + GETCHAR(citype, p); \ + GETCHAR(cilen, p); \ + if (cilen != CILEN_CHAP || citype != opt) \ + goto bad; \ + GETSHORT(cishort, p); \ + if (cishort != val) \ + goto bad; \ + GETCHAR(cichar, p); \ + if (cichar != digest) \ + goto bad; \ + } +#define ACKCILONG(opt, neg, val) \ + if (neg) { \ + if ((len -= CILEN_LONG) < 0) \ + goto bad; \ + GETCHAR(citype, p); \ + GETCHAR(cilen, p); \ + if (cilen != CILEN_LONG || citype != opt) \ + goto bad; \ + GETLONG(cilong, p); \ + if (cilong != val) \ + goto bad; \ + } +#define ACKCILQR(opt, neg, val) \ + if (neg) { \ + if ((len -= CILEN_LQR) < 0) \ + goto bad; \ + GETCHAR(citype, p); \ + GETCHAR(cilen, p); \ + if (cilen != CILEN_LQR || citype != opt) \ + goto bad; \ + GETSHORT(cishort, p); \ + if (cishort != PPP_LQR) \ + goto bad; \ + GETLONG(cilong, p); \ + if (cilong != val) \ + goto bad; \ + } + + ACKCISHORT(CI_MRU, go->neg_mru && go->mru != PPP_DEFMRU, go->mru); + ACKCILONG(CI_ASYNCMAP, go->neg_asyncmap && go->asyncmap != 0xFFFFFFFFl, go->asyncmap); + ACKCICHAP(CI_AUTHTYPE, go->neg_chap, PPP_CHAP, go->chap_mdtype); + ACKCISHORT(CI_AUTHTYPE, !go->neg_chap && go->neg_upap, PPP_PAP); + ACKCILQR(CI_QUALITY, go->neg_lqr, go->lqr_period); + ACKCICHAR(CI_CALLBACK, go->neg_cbcp, CBCP_OPT); + ACKCILONG(CI_MAGICNUMBER, go->neg_magicnumber, go->magicnumber); + ACKCIVOID(CI_PCOMPRESSION, go->neg_pcompression); + ACKCIVOID(CI_ACCOMPRESSION, go->neg_accompression); + + /* + * If there are any remaining CIs, then this packet is bad. + */ + if (len != 0) { + goto bad; + } + LCPDEBUG(LOG_INFO, ("lcp_acki: Ack\n")); + return (1); +bad: + LCPDEBUG(LOG_WARNING, ("lcp_acki: received bad Ack!\n")); + return (0); +} + + +/* + * lcp_nakci - Peer has sent a NAK for some of our CIs. + * This should not modify any state if the Nak is bad + * or if LCP is in the LS_OPENED state. + * + * Returns: + * 0 - Nak was bad. + * 1 - Nak was good. + */ +static int +lcp_nakci(fsm *f, u_char *p, int len) +{ + lcp_options *go = &lcp_gotoptions[f->unit]; + lcp_options *wo = &lcp_wantoptions[f->unit]; + u_char citype, cichar, *next; + u_short cishort; + u32_t cilong; + lcp_options no; /* options we've seen Naks for */ + lcp_options try; /* options to request next time */ + int looped_back = 0; + int cilen; + + BZERO(&no, sizeof(no)); + try = *go; + + /* + * Any Nak'd CIs must be in exactly the same order that we sent. + * Check packet length and CI length at each step. + * If we find any deviations, then this packet is bad. + */ +#define NAKCIVOID(opt, neg, code) \ + if (go->neg && \ + len >= CILEN_VOID && \ + p[1] == CILEN_VOID && \ + p[0] == opt) { \ + len -= CILEN_VOID; \ + INCPTR(CILEN_VOID, p); \ + no.neg = 1; \ + code \ + } +#define NAKCICHAP(opt, neg, code) \ + if (go->neg && \ + len >= CILEN_CHAP && \ + p[1] == CILEN_CHAP && \ + p[0] == opt) { \ + len -= CILEN_CHAP; \ + INCPTR(2, p); \ + GETSHORT(cishort, p); \ + GETCHAR(cichar, p); \ + no.neg = 1; \ + code \ + } +#define NAKCICHAR(opt, neg, code) \ + if (go->neg && \ + len >= CILEN_CHAR && \ + p[1] == CILEN_CHAR && \ + p[0] == opt) { \ + len -= CILEN_CHAR; \ + INCPTR(2, p); \ + GETCHAR(cichar, p); \ + no.neg = 1; \ + code \ + } +#define NAKCISHORT(opt, neg, code) \ + if (go->neg && \ + len >= CILEN_SHORT && \ + p[1] == CILEN_SHORT && \ + p[0] == opt) { \ + len -= CILEN_SHORT; \ + INCPTR(2, p); \ + GETSHORT(cishort, p); \ + no.neg = 1; \ + code \ + } +#define NAKCILONG(opt, neg, code) \ + if (go->neg && \ + len >= CILEN_LONG && \ + p[1] == CILEN_LONG && \ + p[0] == opt) { \ + len -= CILEN_LONG; \ + INCPTR(2, p); \ + GETLONG(cilong, p); \ + no.neg = 1; \ + code \ + } +#define NAKCILQR(opt, neg, code) \ + if (go->neg && \ + len >= CILEN_LQR && \ + p[1] == CILEN_LQR && \ + p[0] == opt) { \ + len -= CILEN_LQR; \ + INCPTR(2, p); \ + GETSHORT(cishort, p); \ + GETLONG(cilong, p); \ + no.neg = 1; \ + code \ + } + + /* + * We don't care if they want to send us smaller packets than + * we want. Therefore, accept any MRU less than what we asked for, + * but then ignore the new value when setting the MRU in the kernel. + * If they send us a bigger MRU than what we asked, accept it, up to + * the limit of the default MRU we'd get if we didn't negotiate. + */ + if (go->neg_mru && go->mru != PPP_DEFMRU) { + NAKCISHORT(CI_MRU, neg_mru, + if (cishort <= wo->mru || cishort < PPP_DEFMRU) { + try.mru = cishort; + } + ); + } + + /* + * Add any characters they want to our (receive-side) asyncmap. + */ + if (go->neg_asyncmap && go->asyncmap != 0xFFFFFFFFl) { + NAKCILONG(CI_ASYNCMAP, neg_asyncmap, + try.asyncmap = go->asyncmap | cilong; + ); + } + + /* + * If they've nak'd our authentication-protocol, check whether + * they are proposing a different protocol, or a different + * hash algorithm for CHAP. + */ + if ((go->neg_chap || go->neg_upap) + && len >= CILEN_SHORT + && p[0] == CI_AUTHTYPE && p[1] >= CILEN_SHORT && p[1] <= len) { + cilen = p[1]; + len -= cilen; + no.neg_chap = go->neg_chap; + no.neg_upap = go->neg_upap; + INCPTR(2, p); + GETSHORT(cishort, p); + if (cishort == PPP_PAP && cilen == CILEN_SHORT) { + /* + * If we were asking for CHAP, they obviously don't want to do it. + * If we weren't asking for CHAP, then we were asking for PAP, + * in which case this Nak is bad. + */ + if (!go->neg_chap) { + goto bad; + } + try.neg_chap = 0; + + } else if (cishort == PPP_CHAP && cilen == CILEN_CHAP) { + GETCHAR(cichar, p); + if (go->neg_chap) { + /* + * We were asking for CHAP/MD5; they must want a different + * algorithm. If they can't do MD5, we'll have to stop + * asking for CHAP. + */ + if (cichar != go->chap_mdtype) { + try.neg_chap = 0; + } + } else { + /* + * Stop asking for PAP if we were asking for it. + */ + try.neg_upap = 0; + } + + } else { + /* + * We don't recognize what they're suggesting. + * Stop asking for what we were asking for. + */ + if (go->neg_chap) { + try.neg_chap = 0; + } else { + try.neg_upap = 0; + } + p += cilen - CILEN_SHORT; + } + } + + /* + * If they can't cope with our link quality protocol, we'll have + * to stop asking for LQR. We haven't got any other protocol. + * If they Nak the reporting period, take their value XXX ? + */ + NAKCILQR(CI_QUALITY, neg_lqr, + if (cishort != PPP_LQR) { + try.neg_lqr = 0; + } else { + try.lqr_period = cilong; + } + ); + + /* + * Only implementing CBCP...not the rest of the callback options + */ + NAKCICHAR(CI_CALLBACK, neg_cbcp, + try.neg_cbcp = 0; + ); + + /* + * Check for a looped-back line. + */ + NAKCILONG(CI_MAGICNUMBER, neg_magicnumber, + try.magicnumber = magic(); + looped_back = 1; + ); + + /* + * Peer shouldn't send Nak for protocol compression or + * address/control compression requests; they should send + * a Reject instead. If they send a Nak, treat it as a Reject. + */ + NAKCIVOID(CI_PCOMPRESSION, neg_pcompression, + try.neg_pcompression = 0; + ); + NAKCIVOID(CI_ACCOMPRESSION, neg_accompression, + try.neg_accompression = 0; + ); + + /* + * There may be remaining CIs, if the peer is requesting negotiation + * on an option that we didn't include in our request packet. + * If we see an option that we requested, or one we've already seen + * in this packet, then this packet is bad. + * If we wanted to respond by starting to negotiate on the requested + * option(s), we could, but we don't, because except for the + * authentication type and quality protocol, if we are not negotiating + * an option, it is because we were told not to. + * For the authentication type, the Nak from the peer means + * `let me authenticate myself with you' which is a bit pointless. + * For the quality protocol, the Nak means `ask me to send you quality + * reports', but if we didn't ask for them, we don't want them. + * An option we don't recognize represents the peer asking to + * negotiate some option we don't support, so ignore it. + */ + while (len > CILEN_VOID) { + GETCHAR(citype, p); + GETCHAR(cilen, p); + if (cilen < CILEN_VOID || (len -= cilen) < 0) { + goto bad; + } + next = p + cilen - 2; + + switch (citype) { + case CI_MRU: + if ((go->neg_mru && go->mru != PPP_DEFMRU) + || no.neg_mru || cilen != CILEN_SHORT) { + goto bad; + } + GETSHORT(cishort, p); + if (cishort < PPP_DEFMRU) { + try.mru = cishort; + } + break; + case CI_ASYNCMAP: + if ((go->neg_asyncmap && go->asyncmap != 0xFFFFFFFFl) + || no.neg_asyncmap || cilen != CILEN_LONG) { + goto bad; + } + break; + case CI_AUTHTYPE: + if (go->neg_chap || no.neg_chap || go->neg_upap || no.neg_upap) { + goto bad; + } + break; + case CI_MAGICNUMBER: + if (go->neg_magicnumber || no.neg_magicnumber || + cilen != CILEN_LONG) { + goto bad; + } + break; + case CI_PCOMPRESSION: + if (go->neg_pcompression || no.neg_pcompression + || cilen != CILEN_VOID) { + goto bad; + } + break; + case CI_ACCOMPRESSION: + if (go->neg_accompression || no.neg_accompression + || cilen != CILEN_VOID) { + goto bad; + } + break; + case CI_QUALITY: + if (go->neg_lqr || no.neg_lqr || cilen != CILEN_LQR) { + goto bad; + } + break; + } + p = next; + } + + /* If there is still anything left, this packet is bad. */ + if (len != 0) { + goto bad; + } + + /* + * OK, the Nak is good. Now we can update state. + */ + if (f->state != LS_OPENED) { + if (looped_back) { + if (++try.numloops >= lcp_loopbackfail) { + LCPDEBUG(LOG_NOTICE, ("Serial line is looped back.\n")); + lcp_close(f->unit, "Loopback detected"); + } + } else { + try.numloops = 0; + } + *go = try; + } + + return 1; + +bad: + LCPDEBUG(LOG_WARNING, ("lcp_nakci: received bad Nak!\n")); + return 0; +} + + +/* + * lcp_rejci - Peer has Rejected some of our CIs. + * This should not modify any state if the Reject is bad + * or if LCP is in the LS_OPENED state. + * + * Returns: + * 0 - Reject was bad. + * 1 - Reject was good. + */ +static int +lcp_rejci(fsm *f, u_char *p, int len) +{ + lcp_options *go = &lcp_gotoptions[f->unit]; + u_char cichar; + u_short cishort; + u32_t cilong; + lcp_options try; /* options to request next time */ + + try = *go; + + /* + * Any Rejected CIs must be in exactly the same order that we sent. + * Check packet length and CI length at each step. + * If we find any deviations, then this packet is bad. + */ +#define REJCIVOID(opt, neg) \ + if (go->neg && \ + len >= CILEN_VOID && \ + p[1] == CILEN_VOID && \ + p[0] == opt) { \ + len -= CILEN_VOID; \ + INCPTR(CILEN_VOID, p); \ + try.neg = 0; \ + LCPDEBUG(LOG_INFO, ("lcp_rejci: void opt %d rejected\n", opt)); \ + } +#define REJCISHORT(opt, neg, val) \ + if (go->neg && \ + len >= CILEN_SHORT && \ + p[1] == CILEN_SHORT && \ + p[0] == opt) { \ + len -= CILEN_SHORT; \ + INCPTR(2, p); \ + GETSHORT(cishort, p); \ + /* Check rejected value. */ \ + if (cishort != val) { \ + goto bad; \ + } \ + try.neg = 0; \ + LCPDEBUG(LOG_INFO, ("lcp_rejci: short opt %d rejected\n", opt)); \ + } +#define REJCICHAP(opt, neg, val, digest) \ + if (go->neg && \ + len >= CILEN_CHAP && \ + p[1] == CILEN_CHAP && \ + p[0] == opt) { \ + len -= CILEN_CHAP; \ + INCPTR(2, p); \ + GETSHORT(cishort, p); \ + GETCHAR(cichar, p); \ + /* Check rejected value. */ \ + if (cishort != val || cichar != digest) { \ + goto bad; \ + } \ + try.neg = 0; \ + try.neg_upap = 0; \ + LCPDEBUG(LOG_INFO, ("lcp_rejci: chap opt %d rejected\n", opt)); \ + } +#define REJCILONG(opt, neg, val) \ + if (go->neg && \ + len >= CILEN_LONG && \ + p[1] == CILEN_LONG && \ + p[0] == opt) { \ + len -= CILEN_LONG; \ + INCPTR(2, p); \ + GETLONG(cilong, p); \ + /* Check rejected value. */ \ + if (cilong != val) { \ + goto bad; \ + } \ + try.neg = 0; \ + LCPDEBUG(LOG_INFO, ("lcp_rejci: long opt %d rejected\n", opt)); \ + } +#define REJCILQR(opt, neg, val) \ + if (go->neg && \ + len >= CILEN_LQR && \ + p[1] == CILEN_LQR && \ + p[0] == opt) { \ + len -= CILEN_LQR; \ + INCPTR(2, p); \ + GETSHORT(cishort, p); \ + GETLONG(cilong, p); \ + /* Check rejected value. */ \ + if (cishort != PPP_LQR || cilong != val) { \ + goto bad; \ + } \ + try.neg = 0; \ + LCPDEBUG(LOG_INFO, ("lcp_rejci: LQR opt %d rejected\n", opt)); \ + } +#define REJCICBCP(opt, neg, val) \ + if (go->neg && \ + len >= CILEN_CBCP && \ + p[1] == CILEN_CBCP && \ + p[0] == opt) { \ + len -= CILEN_CBCP; \ + INCPTR(2, p); \ + GETCHAR(cichar, p); \ + /* Check rejected value. */ \ + if (cichar != val) { \ + goto bad; \ + } \ + try.neg = 0; \ + LCPDEBUG(LOG_INFO, ("lcp_rejci: Callback opt %d rejected\n", opt)); \ + } + + REJCISHORT(CI_MRU, neg_mru, go->mru); + REJCILONG(CI_ASYNCMAP, neg_asyncmap, go->asyncmap); + REJCICHAP(CI_AUTHTYPE, neg_chap, PPP_CHAP, go->chap_mdtype); + if (!go->neg_chap) { + REJCISHORT(CI_AUTHTYPE, neg_upap, PPP_PAP); + } + REJCILQR(CI_QUALITY, neg_lqr, go->lqr_period); + REJCICBCP(CI_CALLBACK, neg_cbcp, CBCP_OPT); + REJCILONG(CI_MAGICNUMBER, neg_magicnumber, go->magicnumber); + REJCIVOID(CI_PCOMPRESSION, neg_pcompression); + REJCIVOID(CI_ACCOMPRESSION, neg_accompression); + + /* + * If there are any remaining CIs, then this packet is bad. + */ + if (len != 0) { + goto bad; + } + /* + * Now we can update state. + */ + if (f->state != LS_OPENED) { + *go = try; + } + return 1; + +bad: + LCPDEBUG(LOG_WARNING, ("lcp_rejci: received bad Reject!\n")); + return 0; +} + + +/* + * lcp_reqci - Check the peer's requested CIs and send appropriate response. + * + * Returns: CONFACK, CONFNAK or CONFREJ and input packet modified + * appropriately. If reject_if_disagree is non-zero, doesn't return + * CONFNAK; returns CONFREJ if it can't return CONFACK. + */ +static int +lcp_reqci(fsm *f, + u_char *inp, /* Requested CIs */ + int *lenp, /* Length of requested CIs */ + int reject_if_disagree) +{ + lcp_options *go = &lcp_gotoptions[f->unit]; + lcp_options *ho = &lcp_hisoptions[f->unit]; + lcp_options *ao = &lcp_allowoptions[f->unit]; + u_char *cip, *next; /* Pointer to current and next CIs */ + int cilen, citype; /* Parsed len, type */ + u_char cichar; /* Parsed char value */ + u_short cishort; /* Parsed short value */ + u32_t cilong; /* Parse long value */ + int rc = CONFACK; /* Final packet return code */ + int orc; /* Individual option return code */ + u_char *p; /* Pointer to next char to parse */ + u_char *rejp; /* Pointer to next char in reject frame */ + u_char *nakp; /* Pointer to next char in Nak frame */ + int l = *lenp; /* Length left */ +#if TRACELCP > 0 + char traceBuf[80]; + size_t traceNdx = 0; +#endif + + /* + * Reset all his options. + */ + BZERO(ho, sizeof(*ho)); + + /* + * Process all his options. + */ + next = inp; + nakp = nak_buffer; + rejp = inp; + while (l) { + orc = CONFACK; /* Assume success */ + cip = p = next; /* Remember begining of CI */ + if (l < 2 || /* Not enough data for CI header or */ + p[1] < 2 || /* CI length too small or */ + p[1] > l) { /* CI length too big? */ + LCPDEBUG(LOG_WARNING, ("lcp_reqci: bad CI length!\n")); + orc = CONFREJ; /* Reject bad CI */ + cilen = l; /* Reject till end of packet */ + l = 0; /* Don't loop again */ + citype = 0; + goto endswitch; + } + GETCHAR(citype, p); /* Parse CI type */ + GETCHAR(cilen, p); /* Parse CI length */ + l -= cilen; /* Adjust remaining length */ + next += cilen; /* Step to next CI */ + + switch (citype) { /* Check CI type */ + case CI_MRU: + if (!ao->neg_mru) { /* Allow option? */ + LCPDEBUG(LOG_INFO, ("lcp_reqci: Reject MRU - not allowed\n")); + orc = CONFREJ; /* Reject CI */ + break; + } else if (cilen != CILEN_SHORT) { /* Check CI length */ + LCPDEBUG(LOG_INFO, ("lcp_reqci: Reject MRU - bad length\n")); + orc = CONFREJ; /* Reject CI */ + break; + } + GETSHORT(cishort, p); /* Parse MRU */ + + /* + * He must be able to receive at least our minimum. + * No need to check a maximum. If he sends a large number, + * we'll just ignore it. + */ + if (cishort < PPP_MINMRU) { + LCPDEBUG(LOG_INFO, ("lcp_reqci: Nak - MRU too small\n")); + orc = CONFNAK; /* Nak CI */ + PUTCHAR(CI_MRU, nakp); + PUTCHAR(CILEN_SHORT, nakp); + PUTSHORT(PPP_MINMRU, nakp); /* Give him a hint */ + break; + } + ho->neg_mru = 1; /* Remember he sent MRU */ + ho->mru = cishort; /* And remember value */ +#if TRACELCP > 0 + snprintf(&traceBuf[traceNdx], sizeof(traceBuf), " MRU %d", cishort); + traceNdx = strlen(traceBuf); +#endif + break; + + case CI_ASYNCMAP: + if (!ao->neg_asyncmap) { + LCPDEBUG(LOG_INFO, ("lcp_reqci: Reject ASYNCMAP not allowed\n")); + orc = CONFREJ; + break; + } else if (cilen != CILEN_LONG) { + LCPDEBUG(LOG_INFO, ("lcp_reqci: Reject ASYNCMAP bad length\n")); + orc = CONFREJ; + break; + } + GETLONG(cilong, p); + + /* + * Asyncmap must have set at least the bits + * which are set in lcp_allowoptions[unit].asyncmap. + */ + if ((ao->asyncmap & ~cilong) != 0) { + LCPDEBUG(LOG_INFO, ("lcp_reqci: Nak ASYNCMAP %lX missing %lX\n", + cilong, ao->asyncmap)); + orc = CONFNAK; + PUTCHAR(CI_ASYNCMAP, nakp); + PUTCHAR(CILEN_LONG, nakp); + PUTLONG(ao->asyncmap | cilong, nakp); + break; + } + ho->neg_asyncmap = 1; + ho->asyncmap = cilong; +#if TRACELCP > 0 + snprintf(&traceBuf[traceNdx], sizeof(traceBuf), " ASYNCMAP=%lX", cilong); + traceNdx = strlen(traceBuf); +#endif + break; + + case CI_AUTHTYPE: + if (cilen < CILEN_SHORT) { + LCPDEBUG(LOG_INFO, ("lcp_reqci: Reject AUTHTYPE missing arg\n")); + orc = CONFREJ; + break; + } else if (!(ao->neg_upap || ao->neg_chap)) { + /* + * Reject the option if we're not willing to authenticate. + */ + LCPDEBUG(LOG_INFO, ("lcp_reqci: Reject AUTHTYPE not allowed\n")); + orc = CONFREJ; + break; + } + GETSHORT(cishort, p); + + /* + * Authtype must be UPAP or CHAP. + * + * Note: if both ao->neg_upap and ao->neg_chap are set, + * and the peer sends a Configure-Request with two + * authenticate-protocol requests, one for CHAP and one + * for UPAP, then we will reject the second request. + * Whether we end up doing CHAP or UPAP depends then on + * the ordering of the CIs in the peer's Configure-Request. + */ + + if (cishort == PPP_PAP) { + if (ho->neg_chap) { /* we've already accepted CHAP */ + LCPDEBUG(LOG_WARNING, ("lcp_reqci: Reject AUTHTYPE PAP already accepted\n")); + orc = CONFREJ; + break; + } else if (cilen != CILEN_SHORT) { + LCPDEBUG(LOG_WARNING, ("lcp_reqci: Reject AUTHTYPE PAP bad len\n")); + orc = CONFREJ; + break; + } + if (!ao->neg_upap) { /* we don't want to do PAP */ + LCPDEBUG(LOG_WARNING, ("lcp_reqci: Nak AUTHTYPE PAP not allowed\n")); + orc = CONFNAK; /* NAK it and suggest CHAP */ + PUTCHAR(CI_AUTHTYPE, nakp); + PUTCHAR(CILEN_CHAP, nakp); + PUTSHORT(PPP_CHAP, nakp); + PUTCHAR(ao->chap_mdtype, nakp); + break; + } + ho->neg_upap = 1; +#if TRACELCP > 0 + snprintf(&traceBuf[traceNdx], sizeof(traceBuf), " PAP (%X)", cishort); + traceNdx = strlen(traceBuf); +#endif + break; + } + if (cishort == PPP_CHAP) { + if (ho->neg_upap) { /* we've already accepted PAP */ + LCPDEBUG(LOG_WARNING, ("lcp_reqci: Reject AUTHTYPE CHAP accepted PAP\n")); + orc = CONFREJ; + break; + } else if (cilen != CILEN_CHAP) { + LCPDEBUG(LOG_WARNING, ("lcp_reqci: Reject AUTHTYPE CHAP bad len\n")); + orc = CONFREJ; + break; + } + if (!ao->neg_chap) { /* we don't want to do CHAP */ + LCPDEBUG(LOG_WARNING, ("lcp_reqci: Nak AUTHTYPE CHAP not allowed\n")); + orc = CONFNAK; /* NAK it and suggest PAP */ + PUTCHAR(CI_AUTHTYPE, nakp); + PUTCHAR(CILEN_SHORT, nakp); + PUTSHORT(PPP_PAP, nakp); + break; + } + GETCHAR(cichar, p); /* get digest type*/ + if (cichar != CHAP_DIGEST_MD5 +#if MSCHAP_SUPPORT + && cichar != CHAP_MICROSOFT +#endif + ) { + LCPDEBUG(LOG_WARNING, ("lcp_reqci: Nak AUTHTYPE CHAP digest=%d\n", (int)cichar)); + orc = CONFNAK; + PUTCHAR(CI_AUTHTYPE, nakp); + PUTCHAR(CILEN_CHAP, nakp); + PUTSHORT(PPP_CHAP, nakp); + PUTCHAR(ao->chap_mdtype, nakp); + break; + } +#if TRACELCP > 0 + snprintf(&traceBuf[traceNdx], sizeof(traceBuf), " CHAP %X,%d", cishort, (int)cichar); + traceNdx = strlen(traceBuf); +#endif + ho->chap_mdtype = cichar; /* save md type */ + ho->neg_chap = 1; + break; + } + + /* + * We don't recognize the protocol they're asking for. + * Nak it with something we're willing to do. + * (At this point we know ao->neg_upap || ao->neg_chap.) + */ + orc = CONFNAK; + PUTCHAR(CI_AUTHTYPE, nakp); + if (ao->neg_chap) { + LCPDEBUG(LOG_WARNING, ("lcp_reqci: Nak AUTHTYPE %d req CHAP\n", cishort)); + PUTCHAR(CILEN_CHAP, nakp); + PUTSHORT(PPP_CHAP, nakp); + PUTCHAR(ao->chap_mdtype, nakp); + } else { + LCPDEBUG(LOG_WARNING, ("lcp_reqci: Nak AUTHTYPE %d req PAP\n", cishort)); + PUTCHAR(CILEN_SHORT, nakp); + PUTSHORT(PPP_PAP, nakp); + } + break; + + case CI_QUALITY: + GETSHORT(cishort, p); + GETLONG(cilong, p); +#if TRACELCP > 0 + snprintf(&traceBuf[traceNdx], sizeof(traceBuf), " QUALITY (%x %x)", cishort, (unsigned int) cilong); + traceNdx = strlen(traceBuf); +#endif + + if (!ao->neg_lqr || + cilen != CILEN_LQR) { + orc = CONFREJ; + break; + } + + /* + * Check the protocol and the reporting period. + * XXX When should we Nak this, and what with? + */ + if (cishort != PPP_LQR) { + orc = CONFNAK; + PUTCHAR(CI_QUALITY, nakp); + PUTCHAR(CILEN_LQR, nakp); + PUTSHORT(PPP_LQR, nakp); + PUTLONG(ao->lqr_period, nakp); + break; + } + break; + + case CI_MAGICNUMBER: + if (!(ao->neg_magicnumber || go->neg_magicnumber) || + cilen != CILEN_LONG) { + orc = CONFREJ; + break; + } + GETLONG(cilong, p); +#if TRACELCP > 0 + snprintf(&traceBuf[traceNdx], sizeof(traceBuf), " MAGICNUMBER (%lX)", cilong); + traceNdx = strlen(traceBuf); +#endif + + /* + * He must have a different magic number. + */ + if (go->neg_magicnumber && + cilong == go->magicnumber) { + cilong = magic(); /* Don't put magic() inside macro! */ + orc = CONFNAK; + PUTCHAR(CI_MAGICNUMBER, nakp); + PUTCHAR(CILEN_LONG, nakp); + PUTLONG(cilong, nakp); + break; + } + ho->neg_magicnumber = 1; + ho->magicnumber = cilong; + break; + + + case CI_PCOMPRESSION: +#if TRACELCP > 0 + snprintf(&traceBuf[traceNdx], sizeof(traceBuf), " PCOMPRESSION"); + traceNdx = strlen(traceBuf); +#endif + if (!ao->neg_pcompression || + cilen != CILEN_VOID) { + orc = CONFREJ; + break; + } + ho->neg_pcompression = 1; + break; + + case CI_ACCOMPRESSION: +#if TRACELCP > 0 + snprintf(&traceBuf[traceNdx], sizeof(traceBuf), " ACCOMPRESSION"); + traceNdx = strlen(traceBuf); +#endif + if (!ao->neg_accompression || + cilen != CILEN_VOID) { + orc = CONFREJ; + break; + } + ho->neg_accompression = 1; + break; + + case CI_MRRU: +#if TRACELCP > 0 + snprintf(&traceBuf[traceNdx], sizeof(traceBuf), " CI_MRRU"); + traceNdx = strlen(traceBuf); +#endif + orc = CONFREJ; + break; + + case CI_SSNHF: +#if TRACELCP > 0 + snprintf(&traceBuf[traceNdx], sizeof(traceBuf), " CI_SSNHF"); + traceNdx = strlen(traceBuf); +#endif + orc = CONFREJ; + break; + + case CI_EPDISC: +#if TRACELCP > 0 + snprintf(&traceBuf[traceNdx], sizeof(traceBuf), " CI_EPDISC"); + traceNdx = strlen(traceBuf); +#endif + orc = CONFREJ; + break; + + default: +#if TRACELCP + snprintf(&traceBuf[traceNdx], sizeof(traceBuf), " unknown %d", citype); + traceNdx = strlen(traceBuf); +#endif + orc = CONFREJ; + break; + } + + endswitch: +#if TRACELCP + if (traceNdx >= 80 - 32) { + LCPDEBUG(LOG_INFO, ("lcp_reqci: rcvd%s\n", traceBuf)); + traceNdx = 0; + } +#endif + if (orc == CONFACK && /* Good CI */ + rc != CONFACK) { /* but prior CI wasnt? */ + continue; /* Don't send this one */ + } + + if (orc == CONFNAK) { /* Nak this CI? */ + if (reject_if_disagree /* Getting fed up with sending NAKs? */ + && citype != CI_MAGICNUMBER) { + orc = CONFREJ; /* Get tough if so */ + } else { + if (rc == CONFREJ) { /* Rejecting prior CI? */ + continue; /* Don't send this one */ + } + rc = CONFNAK; + } + } + if (orc == CONFREJ) { /* Reject this CI */ + rc = CONFREJ; + if (cip != rejp) { /* Need to move rejected CI? */ + BCOPY(cip, rejp, cilen); /* Move it */ + } + INCPTR(cilen, rejp); /* Update output pointer */ + } + } + + /* + * If we wanted to send additional NAKs (for unsent CIs), the + * code would go here. The extra NAKs would go at *nakp. + * At present there are no cases where we want to ask the + * peer to negotiate an option. + */ + + switch (rc) { + case CONFACK: + *lenp = (int)(next - inp); + break; + case CONFNAK: + /* + * Copy the Nak'd options from the nak_buffer to the caller's buffer. + */ + *lenp = (int)(nakp - nak_buffer); + BCOPY(nak_buffer, inp, *lenp); + break; + case CONFREJ: + *lenp = (int)(rejp - inp); + break; + } + +#if TRACELCP > 0 + if (traceNdx > 0) { + LCPDEBUG(LOG_INFO, ("lcp_reqci: %s\n", traceBuf)); + } +#endif + LCPDEBUG(LOG_INFO, ("lcp_reqci: returning CONF%s.\n", CODENAME(rc))); + return (rc); /* Return final code */ +} + + +/* + * lcp_up - LCP has come UP. + */ +static void +lcp_up(fsm *f) +{ + lcp_options *wo = &lcp_wantoptions[f->unit]; + lcp_options *ho = &lcp_hisoptions[f->unit]; + lcp_options *go = &lcp_gotoptions[f->unit]; + lcp_options *ao = &lcp_allowoptions[f->unit]; + + if (!go->neg_magicnumber) { + go->magicnumber = 0; + } + if (!ho->neg_magicnumber) { + ho->magicnumber = 0; + } + + /* + * Set our MTU to the smaller of the MTU we wanted and + * the MRU our peer wanted. If we negotiated an MRU, + * set our MRU to the larger of value we wanted and + * the value we got in the negotiation. + */ + ppp_send_config(f->unit, LWIP_MIN(ao->mru, (ho->neg_mru? ho->mru: PPP_MRU)), + (ho->neg_asyncmap? ho->asyncmap: 0xffffffffl), + ho->neg_pcompression, ho->neg_accompression); + /* + * If the asyncmap hasn't been negotiated, we really should + * set the receive asyncmap to ffffffff, but we set it to 0 + * for backwards contemptibility. + */ + ppp_recv_config(f->unit, (go->neg_mru? LWIP_MAX(wo->mru, go->mru): PPP_MRU), + (go->neg_asyncmap? go->asyncmap: 0x00000000), + go->neg_pcompression, go->neg_accompression); + + if (ho->neg_mru) { + peer_mru[f->unit] = ho->mru; + } + + lcp_echo_lowerup(f->unit); /* Enable echo messages */ + + link_established(f->unit); /* The link is up; authenticate now */ +} + + +/* + * lcp_down - LCP has gone DOWN. + * + * Alert other protocols. + */ +static void +lcp_down(fsm *f) +{ + lcp_options *go = &lcp_gotoptions[f->unit]; + + lcp_echo_lowerdown(f->unit); + + link_down(f->unit); + + ppp_send_config(f->unit, PPP_MRU, 0xffffffffl, 0, 0); + ppp_recv_config(f->unit, PPP_MRU, + (go->neg_asyncmap? go->asyncmap: 0x00000000), + go->neg_pcompression, go->neg_accompression); + peer_mru[f->unit] = PPP_MRU; +} + + +/* + * lcp_starting - LCP needs the lower layer up. + */ +static void +lcp_starting(fsm *f) +{ + link_required(f->unit); /* lwip: currently does nothing */ +} + + +/* + * lcp_finished - LCP has finished with the lower layer. + */ +static void +lcp_finished(fsm *f) +{ + link_terminated(f->unit); /* we are finished with the link */ +} + + +#if PPP_ADDITIONAL_CALLBACKS +/* + * print_string - print a readable representation of a string using + * printer. + */ +static void +print_string( char *p, int len, void (*printer) (void *, char *, ...), void *arg) +{ + int c; + + printer(arg, "\""); + for (; len > 0; --len) { + c = *p++; + if (' ' <= c && c <= '~') { + if (c == '\\' || c == '"') { + printer(arg, "\\"); + } + printer(arg, "%c", c); + } else { + switch (c) { + case '\n': + printer(arg, "\\n"); + break; + case '\r': + printer(arg, "\\r"); + break; + case '\t': + printer(arg, "\\t"); + break; + default: + printer(arg, "\\%.3o", c); + } + } + } + printer(arg, "\""); +} + + +/* + * lcp_printpkt - print the contents of an LCP packet. + */ +static char *lcp_codenames[] = { + "ConfReq", "ConfAck", "ConfNak", "ConfRej", + "TermReq", "TermAck", "CodeRej", "ProtRej", + "EchoReq", "EchoRep", "DiscReq" +}; + +static int +lcp_printpkt( u_char *p, int plen, void (*printer) (void *, char *, ...), void *arg) +{ + int code, id, len, olen; + u_char *pstart, *optend; + u_short cishort; + u32_t cilong; + + if (plen < HEADERLEN) { + return 0; + } + pstart = p; + GETCHAR(code, p); + GETCHAR(id, p); + GETSHORT(len, p); + if (len < HEADERLEN || len > plen) { + return 0; + } + + if (code >= 1 && code <= sizeof(lcp_codenames) / sizeof(char *)) { + printer(arg, " %s", lcp_codenames[code-1]); + } else { + printer(arg, " code=0x%x", code); + } + printer(arg, " id=0x%x", id); + len -= HEADERLEN; + switch (code) { + case CONFREQ: + case CONFACK: + case CONFNAK: + case CONFREJ: + /* print option list */ + while (len >= 2) { + GETCHAR(code, p); + GETCHAR(olen, p); + p -= 2; + if (olen < 2 || olen > len) { + break; + } + printer(arg, " <"); + len -= olen; + optend = p + olen; + switch (code) { + case CI_MRU: + if (olen == CILEN_SHORT) { + p += 2; + GETSHORT(cishort, p); + printer(arg, "mru %d", cishort); + } + break; + case CI_ASYNCMAP: + if (olen == CILEN_LONG) { + p += 2; + GETLONG(cilong, p); + printer(arg, "asyncmap 0x%lx", cilong); + } + break; + case CI_AUTHTYPE: + if (olen >= CILEN_SHORT) { + p += 2; + printer(arg, "auth "); + GETSHORT(cishort, p); + switch (cishort) { + case PPP_PAP: + printer(arg, "pap"); + break; + case PPP_CHAP: + printer(arg, "chap"); + break; + default: + printer(arg, "0x%x", cishort); + } + } + break; + case CI_QUALITY: + if (olen >= CILEN_SHORT) { + p += 2; + printer(arg, "quality "); + GETSHORT(cishort, p); + switch (cishort) { + case PPP_LQR: + printer(arg, "lqr"); + break; + default: + printer(arg, "0x%x", cishort); + } + } + break; + case CI_CALLBACK: + if (olen >= CILEN_CHAR) { + p += 2; + printer(arg, "callback "); + GETSHORT(cishort, p); + switch (cishort) { + case CBCP_OPT: + printer(arg, "CBCP"); + break; + default: + printer(arg, "0x%x", cishort); + } + } + break; + case CI_MAGICNUMBER: + if (olen == CILEN_LONG) { + p += 2; + GETLONG(cilong, p); + printer(arg, "magic 0x%x", cilong); + } + break; + case CI_PCOMPRESSION: + if (olen == CILEN_VOID) { + p += 2; + printer(arg, "pcomp"); + } + break; + case CI_ACCOMPRESSION: + if (olen == CILEN_VOID) { + p += 2; + printer(arg, "accomp"); + } + break; + } + while (p < optend) { + GETCHAR(code, p); + printer(arg, " %.2x", code); + } + printer(arg, ">"); + } + break; + + case TERMACK: + case TERMREQ: + if (len > 0 && *p >= ' ' && *p < 0x7f) { + printer(arg, " "); + print_string((char*)p, len, printer, arg); + p += len; + len = 0; + } + break; + + case ECHOREQ: + case ECHOREP: + case DISCREQ: + if (len >= 4) { + GETLONG(cilong, p); + printer(arg, " magic=0x%x", cilong); + p += 4; + len -= 4; + } + break; + } + + /* print the rest of the bytes in the packet */ + for (; len > 0; --len) { + GETCHAR(code, p); + printer(arg, " %.2x", code); + } + + return (int)(p - pstart); +} +#endif /* PPP_ADDITIONAL_CALLBACKS */ + +/* + * Time to shut down the link because there is nothing out there. + */ +static void +LcpLinkFailure (fsm *f) +{ + if (f->state == LS_OPENED) { + LCPDEBUG(LOG_INFO, ("No response to %d echo-requests\n", lcp_echos_pending)); + LCPDEBUG(LOG_NOTICE, ("Serial link appears to be disconnected.\n")); + lcp_close(f->unit, "Peer not responding"); + } +} + +/* + * Timer expired for the LCP echo requests from this process. + */ +static void +LcpEchoCheck (fsm *f) +{ + LcpSendEchoRequest (f); + + /* + * Start the timer for the next interval. + */ + LWIP_ASSERT("lcp_echo_timer_running == 0", lcp_echo_timer_running == 0); + + TIMEOUT (LcpEchoTimeout, f, lcp_echo_interval); + lcp_echo_timer_running = 1; +} + +/* + * LcpEchoTimeout - Timer expired on the LCP echo + */ +static void +LcpEchoTimeout (void *arg) +{ + if (lcp_echo_timer_running != 0) { + lcp_echo_timer_running = 0; + LcpEchoCheck ((fsm *) arg); + } +} + +/* + * LcpEchoReply - LCP has received a reply to the echo + */ +static void +lcp_received_echo_reply (fsm *f, int id, u_char *inp, int len) +{ + u32_t magic; + + LWIP_UNUSED_ARG(id); + + /* Check the magic number - don't count replies from ourselves. */ + if (len < 4) { + LCPDEBUG(LOG_WARNING, ("lcp: received short Echo-Reply, length %d\n", len)); + return; + } + GETLONG(magic, inp); + if (lcp_gotoptions[f->unit].neg_magicnumber && magic == lcp_gotoptions[f->unit].magicnumber) { + LCPDEBUG(LOG_WARNING, ("appear to have received our own echo-reply!\n")); + return; + } + + /* Reset the number of outstanding echo frames */ + lcp_echos_pending = 0; +} + +/* + * LcpSendEchoRequest - Send an echo request frame to the peer + */ +static void +LcpSendEchoRequest (fsm *f) +{ + u32_t lcp_magic; + u_char pkt[4], *pktp; + + /* + * Detect the failure of the peer at this point. + */ + if (lcp_echo_fails != 0) { + if (lcp_echos_pending >= lcp_echo_fails) { + LcpLinkFailure(f); + lcp_echos_pending = 0; + } + } + + /* + * Make and send the echo request frame. + */ + if (f->state == LS_OPENED) { + lcp_magic = lcp_gotoptions[f->unit].magicnumber; + pktp = pkt; + PUTLONG(lcp_magic, pktp); + fsm_sdata(f, ECHOREQ, (u_char)(lcp_echo_number++ & 0xFF), pkt, (int)(pktp - pkt)); + ++lcp_echos_pending; + } +} + +/* + * lcp_echo_lowerup - Start the timer for the LCP frame + */ + +static void +lcp_echo_lowerup (int unit) +{ + fsm *f = &lcp_fsm[unit]; + + /* Clear the parameters for generating echo frames */ + lcp_echos_pending = 0; + lcp_echo_number = 0; + lcp_echo_timer_running = 0; + + /* If a timeout interval is specified then start the timer */ + if (lcp_echo_interval != 0) { + LcpEchoCheck (f); + } +} + +/* + * lcp_echo_lowerdown - Stop the timer for the LCP frame + */ + +static void +lcp_echo_lowerdown (int unit) +{ + fsm *f = &lcp_fsm[unit]; + + if (lcp_echo_timer_running != 0) { + UNTIMEOUT (LcpEchoTimeout, f); + lcp_echo_timer_running = 0; + } +} + +#endif /* PPP_SUPPORT */ diff --git a/lib/drivers/lwip/src/netif/ppp/lcp.h b/lib/drivers/lwip/src/netif/ppp/lcp.h new file mode 100644 index 00000000000..b9201eeb50b --- /dev/null +++ b/lib/drivers/lwip/src/netif/ppp/lcp.h @@ -0,0 +1,151 @@ +/***************************************************************************** +* lcp.h - Network Link Control Protocol header file. +* +* Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc. +* portions Copyright (c) 1997 Global Election Systems Inc. +* +* The authors hereby grant permission to use, copy, modify, distribute, +* and license this software and its documentation for any purpose, provided +* that existing copyright notices are retained in all copies and that this +* notice and the following disclaimer are included verbatim in any +* distributions. No written agreement, license, or royalty fee is required +* for any of the authorized uses. +* +* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +* IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +****************************************************************************** +* REVISION HISTORY +* +* 03-01-01 Marc Boucher +* Ported to lwIP. +* 97-11-05 Guy Lancaster , Global Election Systems Inc. +* Original derived from BSD codes. +*****************************************************************************/ +/* + * lcp.h - Link Control Protocol definitions. + * + * Copyright (c) 1989 Carnegie Mellon University. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by Carnegie Mellon University. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * $Id: lcp.h,v 1.4 2010/01/18 20:49:43 goldsimon Exp $ + */ + +#ifndef LCP_H +#define LCP_H +/* + * Options. + */ +#define CI_MRU 1 /* Maximum Receive Unit */ +#define CI_ASYNCMAP 2 /* Async Control Character Map */ +#define CI_AUTHTYPE 3 /* Authentication Type */ +#define CI_QUALITY 4 /* Quality Protocol */ +#define CI_MAGICNUMBER 5 /* Magic Number */ +#define CI_PCOMPRESSION 7 /* Protocol Field Compression */ +#define CI_ACCOMPRESSION 8 /* Address/Control Field Compression */ +#define CI_CALLBACK 13 /* callback */ +#define CI_MRRU 17 /* max reconstructed receive unit; multilink */ +#define CI_SSNHF 18 /* short sequence numbers for multilink */ +#define CI_EPDISC 19 /* endpoint discriminator */ + +/* + * LCP-specific packet types (code numbers). + */ +#define PROTREJ 8 /* Protocol Reject */ +#define ECHOREQ 9 /* Echo Request */ +#define ECHOREP 10 /* Echo Reply */ +#define DISCREQ 11 /* Discard Request */ +#define CBCP_OPT 6 /* Use callback control protocol */ + +/* + * The state of options is described by an lcp_options structure. + */ +typedef struct lcp_options { + u_int passive : 1; /* Don't die if we don't get a response */ + u_int silent : 1; /* Wait for the other end to start first */ + u_int restart : 1; /* Restart vs. exit after close */ + u_int neg_mru : 1; /* Negotiate the MRU? */ + u_int neg_asyncmap : 1; /* Negotiate the async map? */ + u_int neg_upap : 1; /* Ask for UPAP authentication? */ + u_int neg_chap : 1; /* Ask for CHAP authentication? */ + u_int neg_magicnumber : 1; /* Ask for magic number? */ + u_int neg_pcompression : 1; /* HDLC Protocol Field Compression? */ + u_int neg_accompression : 1; /* HDLC Address/Control Field Compression? */ + u_int neg_lqr : 1; /* Negotiate use of Link Quality Reports */ + u_int neg_cbcp : 1; /* Negotiate use of CBCP */ +#ifdef PPP_MULTILINK + u_int neg_mrru : 1; /* Negotiate multilink MRRU */ + u_int neg_ssnhf : 1; /* Negotiate short sequence numbers */ + u_int neg_endpoint : 1; /* Negotiate endpoint discriminator */ +#endif + u_short mru; /* Value of MRU */ +#ifdef PPP_MULTILINK + u_short mrru; /* Value of MRRU, and multilink enable */ +#endif + u_char chap_mdtype; /* which MD type (hashing algorithm) */ + u32_t asyncmap; /* Value of async map */ + u32_t magicnumber; + int numloops; /* Number of loops during magic number neg. */ + u32_t lqr_period; /* Reporting period for LQR 1/100ths second */ +#ifdef PPP_MULTILINK + struct epdisc endpoint; /* endpoint discriminator */ +#endif +} lcp_options; + +/* + * Values for phase from BSD pppd.h based on RFC 1661. + */ +typedef enum { + PHASE_DEAD = 0, + PHASE_INITIALIZE, + PHASE_ESTABLISH, + PHASE_AUTHENTICATE, + PHASE_CALLBACK, + PHASE_NETWORK, + PHASE_TERMINATE +} LinkPhase; + + + +extern LinkPhase lcp_phase[NUM_PPP]; /* Phase of link session (RFC 1661) */ +extern lcp_options lcp_wantoptions[]; +extern lcp_options lcp_gotoptions[]; +extern lcp_options lcp_allowoptions[]; +extern lcp_options lcp_hisoptions[]; +extern ext_accm xmit_accm[]; + + +void lcp_init (int); +void lcp_open (int); +void lcp_close (int, char *); +void lcp_lowerup (int); +void lcp_lowerdown(int); +void lcp_sprotrej (int, u_char *, int); /* send protocol reject */ + +extern struct protent lcp_protent; + +/* Default number of times we receive our magic number from the peer + before deciding the link is looped-back. */ +#define DEFLOOPBACKFAIL 10 + +#endif /* LCP_H */ diff --git a/lib/drivers/lwip/src/netif/ppp/magic.c b/lib/drivers/lwip/src/netif/ppp/magic.c new file mode 100644 index 00000000000..3901330895a --- /dev/null +++ b/lib/drivers/lwip/src/netif/ppp/magic.c @@ -0,0 +1,80 @@ +/***************************************************************************** +* magic.c - Network Random Number Generator program file. +* +* Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc. +* portions Copyright (c) 1997 by Global Election Systems Inc. +* +* The authors hereby grant permission to use, copy, modify, distribute, +* and license this software and its documentation for any purpose, provided +* that existing copyright notices are retained in all copies and that this +* notice and the following disclaimer are included verbatim in any +* distributions. No written agreement, license, or royalty fee is required +* for any of the authorized uses. +* +* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +* IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +****************************************************************************** +* REVISION HISTORY +* +* 03-01-01 Marc Boucher +* Ported to lwIP. +* 97-12-04 Guy Lancaster , Global Election Systems Inc. +* Original based on BSD magic.c. +*****************************************************************************/ +/* + * magic.c - PPP Magic Number routines. + * + * Copyright (c) 1989 Carnegie Mellon University. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by Carnegie Mellon University. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + +#include "lwip/opt.h" + +#if PPP_SUPPORT + +#include "ppp.h" +#include "randm.h" +#include "magic.h" + + +/* + * magicInit - Initialize the magic number generator. + * + * Since we use another random number generator that has its own + * initialization, we do nothing here. + */ +void magicInit() +{ + return; +} + +/* + * magic - Returns the next magic number. + */ +u32_t magic() +{ + return avRandom(); +} + +#endif /* PPP_SUPPORT */ diff --git a/lib/drivers/lwip/src/netif/ppp/magic.h b/lib/drivers/lwip/src/netif/ppp/magic.h new file mode 100644 index 00000000000..eba70d20b00 --- /dev/null +++ b/lib/drivers/lwip/src/netif/ppp/magic.h @@ -0,0 +1,63 @@ +/***************************************************************************** +* magic.h - Network Random Number Generator header file. +* +* Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc. +* portions Copyright (c) 1997 Global Election Systems Inc. +* +* The authors hereby grant permission to use, copy, modify, distribute, +* and license this software and its documentation for any purpose, provided +* that existing copyright notices are retained in all copies and that this +* notice and the following disclaimer are included verbatim in any +* distributions. No written agreement, license, or royalty fee is required +* for any of the authorized uses. +* +* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +* IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +****************************************************************************** +* REVISION HISTORY +* +* 03-01-01 Marc Boucher +* Ported to lwIP. +* 97-12-04 Guy Lancaster , Global Election Systems Inc. +* Original derived from BSD codes. +*****************************************************************************/ +/* + * magic.h - PPP Magic Number definitions. + * + * Copyright (c) 1989 Carnegie Mellon University. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by Carnegie Mellon University. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * $Id: magic.h,v 1.3 2010/01/18 20:49:43 goldsimon Exp $ + */ + +#ifndef MAGIC_H +#define MAGIC_H + +/* Initialize the magic number generator */ +void magicInit(void); + +/* Returns the next magic number */ +u32_t magic(void); + +#endif /* MAGIC_H */ diff --git a/lib/drivers/lwip/src/netif/ppp/md5.c b/lib/drivers/lwip/src/netif/ppp/md5.c new file mode 100644 index 00000000000..3cb69e2b065 --- /dev/null +++ b/lib/drivers/lwip/src/netif/ppp/md5.c @@ -0,0 +1,320 @@ +/* + *********************************************************************** + ** md5.c -- the source code for MD5 routines ** + ** RSA Data Security, Inc. MD5 Message-Digest Algorithm ** + ** Created: 2/17/90 RLR ** + ** Revised: 1/91 SRD,AJ,BSK,JT Reference C ver., 7/10 constant corr. ** + *********************************************************************** + */ + +/* + *********************************************************************** + ** Copyright (C) 1990, RSA Data Security, Inc. All rights reserved. ** + ** ** + ** License to copy and use this software is granted provided that ** + ** it is identified as the "RSA Data Security, Inc. MD5 Message- ** + ** Digest Algorithm" in all material mentioning or referencing this ** + ** software or this function. ** + ** ** + ** License is also granted to make and use derivative works ** + ** provided that such works are identified as "derived from the RSA ** + ** Data Security, Inc. MD5 Message-Digest Algorithm" in all ** + ** material mentioning or referencing the derived work. ** + ** ** + ** RSA Data Security, Inc. makes no representations concerning ** + ** either the merchantability of this software or the suitability ** + ** of this software for any particular purpose. It is provided "as ** + ** is" without express or implied warranty of any kind. ** + ** ** + ** These notices must be retained in any copies of any part of this ** + ** documentation and/or software. ** + *********************************************************************** + */ + +#include "lwip/opt.h" + +#if PPP_SUPPORT /* don't build if not configured for use in lwipopts.h */ + +#if CHAP_SUPPORT || MD5_SUPPORT + +#include "ppp.h" +#include "pppdebug.h" + +#include "md5.h" + +#include + +/* + *********************************************************************** + ** Message-digest routines: ** + ** To form the message digest for a message M ** + ** (1) Initialize a context buffer mdContext using MD5Init ** + ** (2) Call MD5Update on mdContext and M ** + ** (3) Call MD5Final on mdContext ** + ** The message digest is now in mdContext->digest[0...15] ** + *********************************************************************** + */ + +/* forward declaration */ +static void Transform (u32_t *buf, u32_t *in); + +static unsigned char PADDING[64] = { + 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +/* F, G, H and I are basic MD5 functions */ +#define F(x, y, z) (((x) & (y)) | ((~x) & (z))) +#define G(x, y, z) (((x) & (z)) | ((y) & (~z))) +#define H(x, y, z) ((x) ^ (y) ^ (z)) +#define I(x, y, z) ((y) ^ ((x) | (~z))) + +/* ROTATE_LEFT rotates x left n bits */ +#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n)))) + +/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4 */ +/* Rotation is separate from addition to prevent recomputation */ +#define FF(a, b, c, d, x, s, ac) \ + {(a) += F ((b), (c), (d)) + (x) + (u32_t)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ + } +#define GG(a, b, c, d, x, s, ac) \ + {(a) += G ((b), (c), (d)) + (x) + (u32_t)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ + } +#define HH(a, b, c, d, x, s, ac) \ + {(a) += H ((b), (c), (d)) + (x) + (u32_t)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ + } +#define II(a, b, c, d, x, s, ac) \ + {(a) += I ((b), (c), (d)) + (x) + (u32_t)(ac); \ + (a) = ROTATE_LEFT ((a), (s)); \ + (a) += (b); \ + } + +#ifdef __STDC__ +#define UL(x) x##UL +#else +#ifdef WIN32 +#define UL(x) x##UL +#else +#define UL(x) x +#endif +#endif + +/* The routine MD5Init initializes the message-digest context + mdContext. All fields are set to zero. + */ +void +MD5Init (MD5_CTX *mdContext) +{ + mdContext->i[0] = mdContext->i[1] = (u32_t)0; + + /* Load magic initialization constants. */ + mdContext->buf[0] = (u32_t)0x67452301UL; + mdContext->buf[1] = (u32_t)0xefcdab89UL; + mdContext->buf[2] = (u32_t)0x98badcfeUL; + mdContext->buf[3] = (u32_t)0x10325476UL; +} + +/* The routine MD5Update updates the message-digest context to + account for the presence of each of the characters inBuf[0..inLen-1] + in the message whose digest is being computed. + */ +void +MD5Update(MD5_CTX *mdContext, unsigned char *inBuf, unsigned int inLen) +{ + u32_t in[16]; + int mdi; + unsigned int i, ii; + +#if 0 + PPPDEBUG(LOG_INFO, ("MD5Update: %u:%.*H\n", inLen, LWIP_MIN(inLen, 20) * 2, inBuf)); + PPPDEBUG(LOG_INFO, ("MD5Update: %u:%s\n", inLen, inBuf)); +#endif + + /* compute number of bytes mod 64 */ + mdi = (int)((mdContext->i[0] >> 3) & 0x3F); + + /* update number of bits */ + if ((mdContext->i[0] + ((u32_t)inLen << 3)) < mdContext->i[0]) { + mdContext->i[1]++; + } + mdContext->i[0] += ((u32_t)inLen << 3); + mdContext->i[1] += ((u32_t)inLen >> 29); + + while (inLen--) { + /* add new character to buffer, increment mdi */ + mdContext->in[mdi++] = *inBuf++; + + /* transform if necessary */ + if (mdi == 0x40) { + for (i = 0, ii = 0; i < 16; i++, ii += 4) { + in[i] = (((u32_t)mdContext->in[ii+3]) << 24) | + (((u32_t)mdContext->in[ii+2]) << 16) | + (((u32_t)mdContext->in[ii+1]) << 8) | + ((u32_t)mdContext->in[ii]); + } + Transform (mdContext->buf, in); + mdi = 0; + } + } +} + +/* The routine MD5Final terminates the message-digest computation and + ends with the desired message digest in mdContext->digest[0...15]. + */ +void +MD5Final (unsigned char hash[], MD5_CTX *mdContext) +{ + u32_t in[16]; + int mdi; + unsigned int i, ii; + unsigned int padLen; + + /* save number of bits */ + in[14] = mdContext->i[0]; + in[15] = mdContext->i[1]; + + /* compute number of bytes mod 64 */ + mdi = (int)((mdContext->i[0] >> 3) & 0x3F); + + /* pad out to 56 mod 64 */ + padLen = (mdi < 56) ? (56 - mdi) : (120 - mdi); + MD5Update (mdContext, PADDING, padLen); + + /* append length in bits and transform */ + for (i = 0, ii = 0; i < 14; i++, ii += 4) { + in[i] = (((u32_t)mdContext->in[ii+3]) << 24) | + (((u32_t)mdContext->in[ii+2]) << 16) | + (((u32_t)mdContext->in[ii+1]) << 8) | + ((u32_t)mdContext->in[ii]); + } + Transform (mdContext->buf, in); + + /* store buffer in digest */ + for (i = 0, ii = 0; i < 4; i++, ii += 4) { + mdContext->digest[ii] = (unsigned char)(mdContext->buf[i] & 0xFF); + mdContext->digest[ii+1] = + (unsigned char)((mdContext->buf[i] >> 8) & 0xFF); + mdContext->digest[ii+2] = + (unsigned char)((mdContext->buf[i] >> 16) & 0xFF); + mdContext->digest[ii+3] = + (unsigned char)((mdContext->buf[i] >> 24) & 0xFF); + } + SMEMCPY(hash, mdContext->digest, 16); +} + +/* Basic MD5 step. Transforms buf based on in. + */ +static void +Transform (u32_t *buf, u32_t *in) +{ + u32_t a = buf[0], b = buf[1], c = buf[2], d = buf[3]; + + /* Round 1 */ +#define S11 7 +#define S12 12 +#define S13 17 +#define S14 22 + FF ( a, b, c, d, in[ 0], S11, UL(3614090360)); /* 1 */ + FF ( d, a, b, c, in[ 1], S12, UL(3905402710)); /* 2 */ + FF ( c, d, a, b, in[ 2], S13, UL( 606105819)); /* 3 */ + FF ( b, c, d, a, in[ 3], S14, UL(3250441966)); /* 4 */ + FF ( a, b, c, d, in[ 4], S11, UL(4118548399)); /* 5 */ + FF ( d, a, b, c, in[ 5], S12, UL(1200080426)); /* 6 */ + FF ( c, d, a, b, in[ 6], S13, UL(2821735955)); /* 7 */ + FF ( b, c, d, a, in[ 7], S14, UL(4249261313)); /* 8 */ + FF ( a, b, c, d, in[ 8], S11, UL(1770035416)); /* 9 */ + FF ( d, a, b, c, in[ 9], S12, UL(2336552879)); /* 10 */ + FF ( c, d, a, b, in[10], S13, UL(4294925233)); /* 11 */ + FF ( b, c, d, a, in[11], S14, UL(2304563134)); /* 12 */ + FF ( a, b, c, d, in[12], S11, UL(1804603682)); /* 13 */ + FF ( d, a, b, c, in[13], S12, UL(4254626195)); /* 14 */ + FF ( c, d, a, b, in[14], S13, UL(2792965006)); /* 15 */ + FF ( b, c, d, a, in[15], S14, UL(1236535329)); /* 16 */ + + /* Round 2 */ +#define S21 5 +#define S22 9 +#define S23 14 +#define S24 20 + GG ( a, b, c, d, in[ 1], S21, UL(4129170786)); /* 17 */ + GG ( d, a, b, c, in[ 6], S22, UL(3225465664)); /* 18 */ + GG ( c, d, a, b, in[11], S23, UL( 643717713)); /* 19 */ + GG ( b, c, d, a, in[ 0], S24, UL(3921069994)); /* 20 */ + GG ( a, b, c, d, in[ 5], S21, UL(3593408605)); /* 21 */ + GG ( d, a, b, c, in[10], S22, UL( 38016083)); /* 22 */ + GG ( c, d, a, b, in[15], S23, UL(3634488961)); /* 23 */ + GG ( b, c, d, a, in[ 4], S24, UL(3889429448)); /* 24 */ + GG ( a, b, c, d, in[ 9], S21, UL( 568446438)); /* 25 */ + GG ( d, a, b, c, in[14], S22, UL(3275163606)); /* 26 */ + GG ( c, d, a, b, in[ 3], S23, UL(4107603335)); /* 27 */ + GG ( b, c, d, a, in[ 8], S24, UL(1163531501)); /* 28 */ + GG ( a, b, c, d, in[13], S21, UL(2850285829)); /* 29 */ + GG ( d, a, b, c, in[ 2], S22, UL(4243563512)); /* 30 */ + GG ( c, d, a, b, in[ 7], S23, UL(1735328473)); /* 31 */ + GG ( b, c, d, a, in[12], S24, UL(2368359562)); /* 32 */ + + /* Round 3 */ +#define S31 4 +#define S32 11 +#define S33 16 +#define S34 23 + HH ( a, b, c, d, in[ 5], S31, UL(4294588738)); /* 33 */ + HH ( d, a, b, c, in[ 8], S32, UL(2272392833)); /* 34 */ + HH ( c, d, a, b, in[11], S33, UL(1839030562)); /* 35 */ + HH ( b, c, d, a, in[14], S34, UL(4259657740)); /* 36 */ + HH ( a, b, c, d, in[ 1], S31, UL(2763975236)); /* 37 */ + HH ( d, a, b, c, in[ 4], S32, UL(1272893353)); /* 38 */ + HH ( c, d, a, b, in[ 7], S33, UL(4139469664)); /* 39 */ + HH ( b, c, d, a, in[10], S34, UL(3200236656)); /* 40 */ + HH ( a, b, c, d, in[13], S31, UL( 681279174)); /* 41 */ + HH ( d, a, b, c, in[ 0], S32, UL(3936430074)); /* 42 */ + HH ( c, d, a, b, in[ 3], S33, UL(3572445317)); /* 43 */ + HH ( b, c, d, a, in[ 6], S34, UL( 76029189)); /* 44 */ + HH ( a, b, c, d, in[ 9], S31, UL(3654602809)); /* 45 */ + HH ( d, a, b, c, in[12], S32, UL(3873151461)); /* 46 */ + HH ( c, d, a, b, in[15], S33, UL( 530742520)); /* 47 */ + HH ( b, c, d, a, in[ 2], S34, UL(3299628645)); /* 48 */ + + /* Round 4 */ +#define S41 6 +#define S42 10 +#define S43 15 +#define S44 21 + II ( a, b, c, d, in[ 0], S41, UL(4096336452)); /* 49 */ + II ( d, a, b, c, in[ 7], S42, UL(1126891415)); /* 50 */ + II ( c, d, a, b, in[14], S43, UL(2878612391)); /* 51 */ + II ( b, c, d, a, in[ 5], S44, UL(4237533241)); /* 52 */ + II ( a, b, c, d, in[12], S41, UL(1700485571)); /* 53 */ + II ( d, a, b, c, in[ 3], S42, UL(2399980690)); /* 54 */ + II ( c, d, a, b, in[10], S43, UL(4293915773)); /* 55 */ + II ( b, c, d, a, in[ 1], S44, UL(2240044497)); /* 56 */ + II ( a, b, c, d, in[ 8], S41, UL(1873313359)); /* 57 */ + II ( d, a, b, c, in[15], S42, UL(4264355552)); /* 58 */ + II ( c, d, a, b, in[ 6], S43, UL(2734768916)); /* 59 */ + II ( b, c, d, a, in[13], S44, UL(1309151649)); /* 60 */ + II ( a, b, c, d, in[ 4], S41, UL(4149444226)); /* 61 */ + II ( d, a, b, c, in[11], S42, UL(3174756917)); /* 62 */ + II ( c, d, a, b, in[ 2], S43, UL( 718787259)); /* 63 */ + II ( b, c, d, a, in[ 9], S44, UL(3951481745)); /* 64 */ + + buf[0] += a; + buf[1] += b; + buf[2] += c; + buf[3] += d; +} + +#endif /* CHAP_SUPPORT || MD5_SUPPORT */ + +#endif /* PPP_SUPPORT */ diff --git a/lib/drivers/lwip/src/netif/ppp/md5.h b/lib/drivers/lwip/src/netif/ppp/md5.h new file mode 100644 index 00000000000..e129533f386 --- /dev/null +++ b/lib/drivers/lwip/src/netif/ppp/md5.h @@ -0,0 +1,55 @@ +/* + *********************************************************************** + ** md5.h -- header file for implementation of MD5 ** + ** RSA Data Security, Inc. MD5 Message-Digest Algorithm ** + ** Created: 2/17/90 RLR ** + ** Revised: 12/27/90 SRD,AJ,BSK,JT Reference C version ** + ** Revised (for MD5): RLR 4/27/91 ** + ** -- G modified to have y&~z instead of y&z ** + ** -- FF, GG, HH modified to add in last register done ** + ** -- Access pattern: round 2 works mod 5, round 3 works mod 3 ** + ** -- distinct additive constant for each step ** + ** -- round 4 added, working mod 7 ** + *********************************************************************** + */ + +/* + *********************************************************************** + ** Copyright (C) 1990, RSA Data Security, Inc. All rights reserved. ** + ** ** + ** License to copy and use this software is granted provided that ** + ** it is identified as the "RSA Data Security, Inc. MD5 Message- ** + ** Digest Algorithm" in all material mentioning or referencing this ** + ** software or this function. ** + ** ** + ** License is also granted to make and use derivative works ** + ** provided that such works are identified as "derived from the RSA ** + ** Data Security, Inc. MD5 Message-Digest Algorithm" in all ** + ** material mentioning or referencing the derived work. ** + ** ** + ** RSA Data Security, Inc. makes no representations concerning ** + ** either the merchantability of this software or the suitability ** + ** of this software for any particular purpose. It is provided "as ** + ** is" without express or implied warranty of any kind. ** + ** ** + ** These notices must be retained in any copies of any part of this ** + ** documentation and/or software. ** + *********************************************************************** + */ + +#ifndef MD5_H +#define MD5_H + +/* Data structure for MD5 (Message-Digest) computation */ +typedef struct { + u32_t i[2]; /* number of _bits_ handled mod 2^64 */ + u32_t buf[4]; /* scratch buffer */ + unsigned char in[64]; /* input buffer */ + unsigned char digest[16]; /* actual digest after MD5Final call */ +} MD5_CTX; + +void MD5Init ( MD5_CTX *mdContext); +void MD5Update( MD5_CTX *mdContext, unsigned char *inBuf, unsigned int inLen); +void MD5Final ( unsigned char hash[], MD5_CTX *mdContext); + +#endif /* MD5_H */ diff --git a/lib/drivers/lwip/src/netif/ppp/pap.c b/lib/drivers/lwip/src/netif/ppp/pap.c new file mode 100644 index 00000000000..ac44e6464ce --- /dev/null +++ b/lib/drivers/lwip/src/netif/ppp/pap.c @@ -0,0 +1,628 @@ +/***************************************************************************** +* pap.c - Network Password Authentication Protocol program file. +* +* Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc. +* portions Copyright (c) 1997 by Global Election Systems Inc. +* +* The authors hereby grant permission to use, copy, modify, distribute, +* and license this software and its documentation for any purpose, provided +* that existing copyright notices are retained in all copies and that this +* notice and the following disclaimer are included verbatim in any +* distributions. No written agreement, license, or royalty fee is required +* for any of the authorized uses. +* +* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +* IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +****************************************************************************** +* REVISION HISTORY +* +* 03-01-01 Marc Boucher +* Ported to lwIP. +* 97-12-12 Guy Lancaster , Global Election Systems Inc. +* Original. +*****************************************************************************/ +/* + * upap.c - User/Password Authentication Protocol. + * + * Copyright (c) 1989 Carnegie Mellon University. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by Carnegie Mellon University. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + +#include "lwip/opt.h" + +#if PPP_SUPPORT /* don't build if not configured for use in lwipopts.h */ + +#if PAP_SUPPORT /* don't build if not configured for use in lwipopts.h */ + +#include "ppp.h" +#include "pppdebug.h" + +#include "auth.h" +#include "pap.h" + +#include + +#if 0 /* UNUSED */ +static bool hide_password = 1; + +/* + * Command-line options. + */ +static option_t pap_option_list[] = { + { "hide-password", o_bool, &hide_password, + "Don't output passwords to log", 1 }, + { "show-password", o_bool, &hide_password, + "Show password string in debug log messages", 0 }, + { "pap-restart", o_int, &upap[0].us_timeouttime, + "Set retransmit timeout for PAP" }, + { "pap-max-authreq", o_int, &upap[0].us_maxtransmits, + "Set max number of transmissions for auth-reqs" }, + { "pap-timeout", o_int, &upap[0].us_reqtimeout, + "Set time limit for peer PAP authentication" }, + { NULL } +}; +#endif + +/* + * Protocol entry points. + */ +static void upap_init (int); +static void upap_lowerup (int); +static void upap_lowerdown (int); +static void upap_input (int, u_char *, int); +static void upap_protrej (int); +#if PPP_ADDITIONAL_CALLBACKS +static int upap_printpkt (u_char *, int, void (*)(void *, char *, ...), void *); +#endif /* PPP_ADDITIONAL_CALLBACKS */ + +struct protent pap_protent = { + PPP_PAP, + upap_init, + upap_input, + upap_protrej, + upap_lowerup, + upap_lowerdown, + NULL, + NULL, +#if PPP_ADDITIONAL_CALLBACKS + upap_printpkt, + NULL, +#endif /* PPP_ADDITIONAL_CALLBACKS */ + 1, + "PAP", +#if PPP_ADDITIONAL_CALLBACKS + NULL, + NULL, + NULL +#endif /* PPP_ADDITIONAL_CALLBACKS */ +}; + +upap_state upap[NUM_PPP]; /* UPAP state; one for each unit */ + +static void upap_timeout (void *); +static void upap_reqtimeout(void *); +static void upap_rauthreq (upap_state *, u_char *, u_char, int); +static void upap_rauthack (upap_state *, u_char *, int, int); +static void upap_rauthnak (upap_state *, u_char *, int, int); +static void upap_sauthreq (upap_state *); +static void upap_sresp (upap_state *, u_char, u_char, char *, int); + + +/* + * upap_init - Initialize a UPAP unit. + */ +static void +upap_init(int unit) +{ + upap_state *u = &upap[unit]; + + UPAPDEBUG(LOG_INFO, ("upap_init: %d\n", unit)); + u->us_unit = unit; + u->us_user = NULL; + u->us_userlen = 0; + u->us_passwd = NULL; + u->us_passwdlen = 0; + u->us_clientstate = UPAPCS_INITIAL; + u->us_serverstate = UPAPSS_INITIAL; + u->us_id = 0; + u->us_timeouttime = UPAP_DEFTIMEOUT; + u->us_maxtransmits = 10; + u->us_reqtimeout = UPAP_DEFREQTIME; +} + +/* + * upap_authwithpeer - Authenticate us with our peer (start client). + * + * Set new state and send authenticate's. + */ +void +upap_authwithpeer(int unit, char *user, char *password) +{ + upap_state *u = &upap[unit]; + + UPAPDEBUG(LOG_INFO, ("upap_authwithpeer: %d user=%s password=%s s=%d\n", + unit, user, password, u->us_clientstate)); + + /* Save the username and password we're given */ + u->us_user = user; + u->us_userlen = (int)strlen(user); + u->us_passwd = password; + u->us_passwdlen = (int)strlen(password); + + u->us_transmits = 0; + + /* Lower layer up yet? */ + if (u->us_clientstate == UPAPCS_INITIAL || + u->us_clientstate == UPAPCS_PENDING) { + u->us_clientstate = UPAPCS_PENDING; + return; + } + + upap_sauthreq(u); /* Start protocol */ +} + + +/* + * upap_authpeer - Authenticate our peer (start server). + * + * Set new state. + */ +void +upap_authpeer(int unit) +{ + upap_state *u = &upap[unit]; + + /* Lower layer up yet? */ + if (u->us_serverstate == UPAPSS_INITIAL || + u->us_serverstate == UPAPSS_PENDING) { + u->us_serverstate = UPAPSS_PENDING; + return; + } + + u->us_serverstate = UPAPSS_LISTEN; + if (u->us_reqtimeout > 0) { + TIMEOUT(upap_reqtimeout, u, u->us_reqtimeout); + } +} + +/* + * upap_timeout - Retransmission timer for sending auth-reqs expired. + */ +static void +upap_timeout(void *arg) +{ + upap_state *u = (upap_state *) arg; + + UPAPDEBUG(LOG_INFO, ("upap_timeout: %d timeout %d expired s=%d\n", + u->us_unit, u->us_timeouttime, u->us_clientstate)); + + if (u->us_clientstate != UPAPCS_AUTHREQ) { + UPAPDEBUG(LOG_INFO, ("upap_timeout: not in AUTHREQ state!\n")); + return; + } + + if (u->us_transmits >= u->us_maxtransmits) { + /* give up in disgust */ + UPAPDEBUG(LOG_ERR, ("No response to PAP authenticate-requests\n")); + u->us_clientstate = UPAPCS_BADAUTH; + auth_withpeer_fail(u->us_unit, PPP_PAP); + return; + } + + upap_sauthreq(u); /* Send Authenticate-Request and set upap timeout*/ +} + + +/* + * upap_reqtimeout - Give up waiting for the peer to send an auth-req. + */ +static void +upap_reqtimeout(void *arg) +{ + upap_state *u = (upap_state *) arg; + + if (u->us_serverstate != UPAPSS_LISTEN) { + return; /* huh?? */ + } + + auth_peer_fail(u->us_unit, PPP_PAP); + u->us_serverstate = UPAPSS_BADAUTH; +} + + +/* + * upap_lowerup - The lower layer is up. + * + * Start authenticating if pending. + */ +static void +upap_lowerup(int unit) +{ + upap_state *u = &upap[unit]; + + UPAPDEBUG(LOG_INFO, ("upap_lowerup: init %d clientstate s=%d\n", unit, u->us_clientstate)); + + if (u->us_clientstate == UPAPCS_INITIAL) { + u->us_clientstate = UPAPCS_CLOSED; + } else if (u->us_clientstate == UPAPCS_PENDING) { + upap_sauthreq(u); /* send an auth-request */ + /* now client state is UPAPCS__AUTHREQ */ + } + + if (u->us_serverstate == UPAPSS_INITIAL) { + u->us_serverstate = UPAPSS_CLOSED; + } else if (u->us_serverstate == UPAPSS_PENDING) { + u->us_serverstate = UPAPSS_LISTEN; + if (u->us_reqtimeout > 0) { + TIMEOUT(upap_reqtimeout, u, u->us_reqtimeout); + } + } +} + + +/* + * upap_lowerdown - The lower layer is down. + * + * Cancel all timeouts. + */ +static void +upap_lowerdown(int unit) +{ + upap_state *u = &upap[unit]; + + UPAPDEBUG(LOG_INFO, ("upap_lowerdown: %d s=%d\n", unit, u->us_clientstate)); + + if (u->us_clientstate == UPAPCS_AUTHREQ) { /* Timeout pending? */ + UNTIMEOUT(upap_timeout, u); /* Cancel timeout */ + } + if (u->us_serverstate == UPAPSS_LISTEN && u->us_reqtimeout > 0) { + UNTIMEOUT(upap_reqtimeout, u); + } + + u->us_clientstate = UPAPCS_INITIAL; + u->us_serverstate = UPAPSS_INITIAL; +} + + +/* + * upap_protrej - Peer doesn't speak this protocol. + * + * This shouldn't happen. In any case, pretend lower layer went down. + */ +static void +upap_protrej(int unit) +{ + upap_state *u = &upap[unit]; + + if (u->us_clientstate == UPAPCS_AUTHREQ) { + UPAPDEBUG(LOG_ERR, ("PAP authentication failed due to protocol-reject\n")); + auth_withpeer_fail(unit, PPP_PAP); + } + if (u->us_serverstate == UPAPSS_LISTEN) { + UPAPDEBUG(LOG_ERR, ("PAP authentication of peer failed (protocol-reject)\n")); + auth_peer_fail(unit, PPP_PAP); + } + upap_lowerdown(unit); +} + + +/* + * upap_input - Input UPAP packet. + */ +static void +upap_input(int unit, u_char *inpacket, int l) +{ + upap_state *u = &upap[unit]; + u_char *inp; + u_char code, id; + int len; + + /* + * Parse header (code, id and length). + * If packet too short, drop it. + */ + inp = inpacket; + if (l < (int)UPAP_HEADERLEN) { + UPAPDEBUG(LOG_INFO, ("pap_input: rcvd short header.\n")); + return; + } + GETCHAR(code, inp); + GETCHAR(id, inp); + GETSHORT(len, inp); + if (len < (int)UPAP_HEADERLEN) { + UPAPDEBUG(LOG_INFO, ("pap_input: rcvd illegal length.\n")); + return; + } + if (len > l) { + UPAPDEBUG(LOG_INFO, ("pap_input: rcvd short packet.\n")); + return; + } + len -= UPAP_HEADERLEN; + + /* + * Action depends on code. + */ + switch (code) { + case UPAP_AUTHREQ: + upap_rauthreq(u, inp, id, len); + break; + + case UPAP_AUTHACK: + upap_rauthack(u, inp, id, len); + break; + + case UPAP_AUTHNAK: + upap_rauthnak(u, inp, id, len); + break; + + default: /* XXX Need code reject */ + UPAPDEBUG(LOG_INFO, ("pap_input: UNHANDLED default: code: %d, id: %d, len: %d.\n", code, id, len)); + break; + } +} + + +/* + * upap_rauth - Receive Authenticate. + */ +static void +upap_rauthreq(upap_state *u, u_char *inp, u_char id, int len) +{ + u_char ruserlen, rpasswdlen; + char *ruser, *rpasswd; + u_char retcode; + char *msg; + int msglen; + + UPAPDEBUG(LOG_INFO, ("pap_rauth: Rcvd id %d.\n", id)); + + if (u->us_serverstate < UPAPSS_LISTEN) { + return; + } + + /* + * If we receive a duplicate authenticate-request, we are + * supposed to return the same status as for the first request. + */ + if (u->us_serverstate == UPAPSS_OPEN) { + upap_sresp(u, UPAP_AUTHACK, id, "", 0); /* return auth-ack */ + return; + } + if (u->us_serverstate == UPAPSS_BADAUTH) { + upap_sresp(u, UPAP_AUTHNAK, id, "", 0); /* return auth-nak */ + return; + } + + /* + * Parse user/passwd. + */ + if (len < (int)sizeof (u_char)) { + UPAPDEBUG(LOG_INFO, ("pap_rauth: rcvd short packet.\n")); + return; + } + GETCHAR(ruserlen, inp); + len -= sizeof (u_char) + ruserlen + sizeof (u_char); + if (len < 0) { + UPAPDEBUG(LOG_INFO, ("pap_rauth: rcvd short packet.\n")); + return; + } + ruser = (char *) inp; + INCPTR(ruserlen, inp); + GETCHAR(rpasswdlen, inp); + if (len < rpasswdlen) { + UPAPDEBUG(LOG_INFO, ("pap_rauth: rcvd short packet.\n")); + return; + } + rpasswd = (char *) inp; + + /* + * Check the username and password given. + */ + retcode = check_passwd(u->us_unit, ruser, ruserlen, rpasswd, rpasswdlen, &msg, &msglen); + /* lwip: currently retcode is always UPAP_AUTHACK */ + BZERO(rpasswd, rpasswdlen); + + upap_sresp(u, retcode, id, msg, msglen); + + if (retcode == UPAP_AUTHACK) { + u->us_serverstate = UPAPSS_OPEN; + auth_peer_success(u->us_unit, PPP_PAP, ruser, ruserlen); + } else { + u->us_serverstate = UPAPSS_BADAUTH; + auth_peer_fail(u->us_unit, PPP_PAP); + } + + if (u->us_reqtimeout > 0) { + UNTIMEOUT(upap_reqtimeout, u); + } +} + + +/* + * upap_rauthack - Receive Authenticate-Ack. + */ +static void +upap_rauthack(upap_state *u, u_char *inp, int id, int len) +{ + u_char msglen; + char *msg; + + LWIP_UNUSED_ARG(id); + + UPAPDEBUG(LOG_INFO, ("pap_rauthack: Rcvd id %d s=%d\n", id, u->us_clientstate)); + + if (u->us_clientstate != UPAPCS_AUTHREQ) { /* XXX */ + UPAPDEBUG(LOG_INFO, ("pap_rauthack: us_clientstate != UPAPCS_AUTHREQ\n")); + return; + } + + /* + * Parse message. + */ + if (len < (int)sizeof (u_char)) { + UPAPDEBUG(LOG_INFO, ("pap_rauthack: ignoring missing msg-length.\n")); + } else { + GETCHAR(msglen, inp); + if (msglen > 0) { + len -= sizeof (u_char); + if (len < msglen) { + UPAPDEBUG(LOG_INFO, ("pap_rauthack: rcvd short packet.\n")); + return; + } + msg = (char *) inp; + PRINTMSG(msg, msglen); + } + } + UNTIMEOUT(upap_timeout, u); /* Cancel timeout */ + u->us_clientstate = UPAPCS_OPEN; + + auth_withpeer_success(u->us_unit, PPP_PAP); +} + + +/* + * upap_rauthnak - Receive Authenticate-Nak. + */ +static void +upap_rauthnak(upap_state *u, u_char *inp, int id, int len) +{ + u_char msglen; + char *msg; + + LWIP_UNUSED_ARG(id); + + UPAPDEBUG(LOG_INFO, ("pap_rauthnak: Rcvd id %d s=%d\n", id, u->us_clientstate)); + + if (u->us_clientstate != UPAPCS_AUTHREQ) { /* XXX */ + return; + } + + /* + * Parse message. + */ + if (len < sizeof (u_char)) { + UPAPDEBUG(LOG_INFO, ("pap_rauthnak: ignoring missing msg-length.\n")); + } else { + GETCHAR(msglen, inp); + if(msglen > 0) { + len -= sizeof (u_char); + if (len < msglen) { + UPAPDEBUG(LOG_INFO, ("pap_rauthnak: rcvd short packet.\n")); + return; + } + msg = (char *) inp; + PRINTMSG(msg, msglen); + } + } + + u->us_clientstate = UPAPCS_BADAUTH; + + UPAPDEBUG(LOG_ERR, ("PAP authentication failed\n")); + auth_withpeer_fail(u->us_unit, PPP_PAP); +} + + +/* + * upap_sauthreq - Send an Authenticate-Request. + */ +static void +upap_sauthreq(upap_state *u) +{ + u_char *outp; + int outlen; + + outlen = UPAP_HEADERLEN + 2 * sizeof (u_char) + + u->us_userlen + u->us_passwdlen; + outp = outpacket_buf[u->us_unit]; + + MAKEHEADER(outp, PPP_PAP); + + PUTCHAR(UPAP_AUTHREQ, outp); + PUTCHAR(++u->us_id, outp); + PUTSHORT(outlen, outp); + PUTCHAR(u->us_userlen, outp); + BCOPY(u->us_user, outp, u->us_userlen); + INCPTR(u->us_userlen, outp); + PUTCHAR(u->us_passwdlen, outp); + BCOPY(u->us_passwd, outp, u->us_passwdlen); + + pppWrite(u->us_unit, outpacket_buf[u->us_unit], outlen + PPP_HDRLEN); + + UPAPDEBUG(LOG_INFO, ("pap_sauth: Sent id %d\n", u->us_id)); + + TIMEOUT(upap_timeout, u, u->us_timeouttime); + ++u->us_transmits; + u->us_clientstate = UPAPCS_AUTHREQ; +} + + +/* + * upap_sresp - Send a response (ack or nak). + */ +static void +upap_sresp(upap_state *u, u_char code, u_char id, char *msg, int msglen) +{ + u_char *outp; + int outlen; + + outlen = UPAP_HEADERLEN + sizeof (u_char) + msglen; + outp = outpacket_buf[u->us_unit]; + MAKEHEADER(outp, PPP_PAP); + + PUTCHAR(code, outp); + PUTCHAR(id, outp); + PUTSHORT(outlen, outp); + PUTCHAR(msglen, outp); + BCOPY(msg, outp, msglen); + pppWrite(u->us_unit, outpacket_buf[u->us_unit], outlen + PPP_HDRLEN); + + UPAPDEBUG(LOG_INFO, ("pap_sresp: Sent code %d, id %d s=%d\n", code, id, u->us_clientstate)); +} + +#if PPP_ADDITIONAL_CALLBACKS +static char *upap_codenames[] = { + "AuthReq", "AuthAck", "AuthNak" +}; + +/* + * upap_printpkt - print the contents of a PAP packet. + */ +static int upap_printpkt( + u_char *p, + int plen, + void (*printer) (void *, char *, ...), + void *arg +) +{ + LWIP_UNUSED_ARG(p); + LWIP_UNUSED_ARG(plen); + LWIP_UNUSED_ARG(printer); + LWIP_UNUSED_ARG(arg); + return 0; +} +#endif /* PPP_ADDITIONAL_CALLBACKS */ + +#endif /* PAP_SUPPORT */ + +#endif /* PPP_SUPPORT */ diff --git a/lib/drivers/lwip/src/netif/ppp/pap.h b/lib/drivers/lwip/src/netif/ppp/pap.h new file mode 100644 index 00000000000..c99a2040196 --- /dev/null +++ b/lib/drivers/lwip/src/netif/ppp/pap.h @@ -0,0 +1,118 @@ +/***************************************************************************** +* pap.h - PPP Password Authentication Protocol header file. +* +* Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc. +* portions Copyright (c) 1997 Global Election Systems Inc. +* +* The authors hereby grant permission to use, copy, modify, distribute, +* and license this software and its documentation for any purpose, provided +* that existing copyright notices are retained in all copies and that this +* notice and the following disclaimer are included verbatim in any +* distributions. No written agreement, license, or royalty fee is required +* for any of the authorized uses. +* +* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +* IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +****************************************************************************** +* REVISION HISTORY +* +* 03-01-01 Marc Boucher +* Ported to lwIP. +* 97-12-04 Guy Lancaster , Global Election Systems Inc. +* Original derived from BSD codes. +*****************************************************************************/ +/* + * upap.h - User/Password Authentication Protocol definitions. + * + * Copyright (c) 1989 Carnegie Mellon University. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by Carnegie Mellon University. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + +#ifndef PAP_H +#define PAP_H + +#if PAP_SUPPORT /* don't build if not configured for use in lwipopts.h */ + +/* + * Packet header = Code, id, length. + */ +#define UPAP_HEADERLEN (sizeof (u_char) + sizeof (u_char) + sizeof (u_short)) + + +/* + * UPAP codes. + */ +#define UPAP_AUTHREQ 1 /* Authenticate-Request */ +#define UPAP_AUTHACK 2 /* Authenticate-Ack */ +#define UPAP_AUTHNAK 3 /* Authenticate-Nak */ + +/* + * Each interface is described by upap structure. + */ +typedef struct upap_state { + int us_unit; /* Interface unit number */ + const char *us_user; /* User */ + int us_userlen; /* User length */ + const char *us_passwd; /* Password */ + int us_passwdlen; /* Password length */ + int us_clientstate; /* Client state */ + int us_serverstate; /* Server state */ + u_char us_id; /* Current id */ + int us_timeouttime; /* Timeout (seconds) for auth-req retrans. */ + int us_transmits; /* Number of auth-reqs sent */ + int us_maxtransmits; /* Maximum number of auth-reqs to send */ + int us_reqtimeout; /* Time to wait for auth-req from peer */ +} upap_state; + +/* + * Client states. + */ +#define UPAPCS_INITIAL 0 /* Connection down */ +#define UPAPCS_CLOSED 1 /* Connection up, haven't requested auth */ +#define UPAPCS_PENDING 2 /* Connection down, have requested auth */ +#define UPAPCS_AUTHREQ 3 /* We've sent an Authenticate-Request */ +#define UPAPCS_OPEN 4 /* We've received an Ack */ +#define UPAPCS_BADAUTH 5 /* We've received a Nak */ + +/* + * Server states. + */ +#define UPAPSS_INITIAL 0 /* Connection down */ +#define UPAPSS_CLOSED 1 /* Connection up, haven't requested auth */ +#define UPAPSS_PENDING 2 /* Connection down, have requested auth */ +#define UPAPSS_LISTEN 3 /* Listening for an Authenticate */ +#define UPAPSS_OPEN 4 /* We've sent an Ack */ +#define UPAPSS_BADAUTH 5 /* We've sent a Nak */ + + +extern upap_state upap[]; + +void upap_authwithpeer (int, char *, char *); +void upap_authpeer (int); + +extern struct protent pap_protent; + +#endif /* PAP_SUPPORT */ + +#endif /* PAP_H */ diff --git a/lib/drivers/lwip/src/netif/ppp/ppp.c b/lib/drivers/lwip/src/netif/ppp/ppp.c new file mode 100644 index 00000000000..e9b433b0534 --- /dev/null +++ b/lib/drivers/lwip/src/netif/ppp/ppp.c @@ -0,0 +1,2020 @@ +/***************************************************************************** +* ppp.c - Network Point to Point Protocol program file. +* +* Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc. +* portions Copyright (c) 1997 by Global Election Systems Inc. +* +* The authors hereby grant permission to use, copy, modify, distribute, +* and license this software and its documentation for any purpose, provided +* that existing copyright notices are retained in all copies and that this +* notice and the following disclaimer are included verbatim in any +* distributions. No written agreement, license, or royalty fee is required +* for any of the authorized uses. +* +* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +* IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +****************************************************************************** +* REVISION HISTORY +* +* 03-01-01 Marc Boucher +* Ported to lwIP. +* 97-11-05 Guy Lancaster , Global Election Systems Inc. +* Original. +*****************************************************************************/ + +/* + * ppp_defs.h - PPP definitions. + * + * if_pppvar.h - private structures and declarations for PPP. + * + * Copyright (c) 1994 The Australian National University. + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation is hereby granted, provided that the above copyright + * notice appears in all copies. This software is provided without any + * warranty, express or implied. The Australian National University + * makes no representations about the suitability of this software for + * any purpose. + * + * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY + * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF + * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO + * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, + * OR MODIFICATIONS. + */ + +/* + * if_ppp.h - Point-to-Point Protocol definitions. + * + * Copyright (c) 1989 Carnegie Mellon University. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by Carnegie Mellon University. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + +#include "lwip/opt.h" + +#if PPP_SUPPORT /* don't build if not configured for use in lwipopts.h */ + +#include "lwip/ip.h" /* for ip_input() */ + +#include "ppp.h" +#include "pppdebug.h" + +#include "randm.h" +#include "fsm.h" +#if PAP_SUPPORT +#include "pap.h" +#endif /* PAP_SUPPORT */ +#if CHAP_SUPPORT +#include "chap.h" +#endif /* CHAP_SUPPORT */ +#include "ipcp.h" +#include "lcp.h" +#include "magic.h" +#include "auth.h" +#if VJ_SUPPORT +#include "vj.h" +#endif /* VJ_SUPPORT */ +#if PPPOE_SUPPORT +#include "netif/ppp_oe.h" +#endif /* PPPOE_SUPPORT */ + +#include "lwip/tcpip.h" +#include "lwip/api.h" +#include "lwip/snmp.h" + +#include + +/*************************/ +/*** LOCAL DEFINITIONS ***/ +/*************************/ + +/** PPP_INPROC_MULTITHREADED==1 call pppInput using tcpip_callback(). + * Set this to 0 if pppInProc is called inside tcpip_thread or with NO_SYS==1. + * Default is 1 for NO_SYS==0 (multithreaded) and 0 for NO_SYS==1 (single-threaded). + */ +#ifndef PPP_INPROC_MULTITHREADED +#define PPP_INPROC_MULTITHREADED (NO_SYS==0) +#endif + +/** PPP_INPROC_OWNTHREAD==1: start a dedicated RX thread per PPP session. + * Default is 0: call pppos_input() for received raw characters, charcater + * reception is up to the port */ +#ifndef PPP_INPROC_OWNTHREAD +#define PPP_INPROC_OWNTHREAD PPP_INPROC_MULTITHREADED +#endif + +#if PPP_INPROC_OWNTHREAD && !PPP_INPROC_MULTITHREADED + #error "PPP_INPROC_OWNTHREAD needs PPP_INPROC_MULTITHREADED==1" +#endif + +/* + * The basic PPP frame. + */ +#define PPP_ADDRESS(p) (((u_char *)(p))[0]) +#define PPP_CONTROL(p) (((u_char *)(p))[1]) +#define PPP_PROTOCOL(p) ((((u_char *)(p))[2] << 8) + ((u_char *)(p))[3]) + +/* PPP packet parser states. Current state indicates operation yet to be + * completed. */ +typedef enum { + PDIDLE = 0, /* Idle state - waiting. */ + PDSTART, /* Process start flag. */ + PDADDRESS, /* Process address field. */ + PDCONTROL, /* Process control field. */ + PDPROTOCOL1, /* Process protocol field 1. */ + PDPROTOCOL2, /* Process protocol field 2. */ + PDDATA /* Process data byte. */ +} PPPDevStates; + +#define ESCAPE_P(accm, c) ((accm)[(c) >> 3] & pppACCMMask[c & 0x07]) + +/************************/ +/*** LOCAL DATA TYPES ***/ +/************************/ + +/** RX buffer size: this may be configured smaller! */ +#ifndef PPPOS_RX_BUFSIZE +#define PPPOS_RX_BUFSIZE (PPP_MRU + PPP_HDRLEN) +#endif + +typedef struct PPPControlRx_s { + /** unit number / ppp descriptor */ + int pd; + /** the rx file descriptor */ + sio_fd_t fd; + /** receive buffer - encoded data is stored here */ + u_char rxbuf[PPPOS_RX_BUFSIZE]; + + /* The input packet. */ + struct pbuf *inHead, *inTail; + +#if PPPOS_SUPPORT + u16_t inProtocol; /* The input protocol code. */ + u16_t inFCS; /* Input Frame Check Sequence value. */ +#endif /* PPPOS_SUPPORT */ + PPPDevStates inState; /* The input process state. */ + char inEscaped; /* Escape next character. */ + ext_accm inACCM; /* Async-Ctl-Char-Map for input. */ +} PPPControlRx; + +/* + * PPP interface control block. + */ +typedef struct PPPControl_s { + PPPControlRx rx; + char openFlag; /* True when in use. */ +#if PPPOE_SUPPORT + struct netif *ethif; + struct pppoe_softc *pppoe_sc; +#endif /* PPPOE_SUPPORT */ + int if_up; /* True when the interface is up. */ + int errCode; /* Code indicating why interface is down. */ +#if PPPOS_SUPPORT + sio_fd_t fd; /* File device ID of port. */ +#endif /* PPPOS_SUPPORT */ + u16_t mtu; /* Peer's mru */ + int pcomp; /* Does peer accept protocol compression? */ + int accomp; /* Does peer accept addr/ctl compression? */ + u_long lastXMit; /* Time of last transmission. */ + ext_accm outACCM; /* Async-Ctl-Char-Map for output. */ +#if PPPOS_SUPPORT && VJ_SUPPORT + int vjEnabled; /* Flag indicating VJ compression enabled. */ + struct vjcompress vjComp; /* Van Jacobson compression header. */ +#endif /* PPPOS_SUPPORT && VJ_SUPPORT */ + + struct netif netif; + + struct ppp_addrs addrs; + + void (*linkStatusCB)(void *ctx, int errCode, void *arg); + void *linkStatusCtx; + +} PPPControl; + + +/* + * Ioctl definitions. + */ + +struct npioctl { + int protocol; /* PPP procotol, e.g. PPP_IP */ + enum NPmode mode; +}; + + + +/***********************************/ +/*** LOCAL FUNCTION DECLARATIONS ***/ +/***********************************/ +#if PPPOS_SUPPORT +#if PPP_INPROC_OWNTHREAD +static void pppInputThread(void *arg); +#endif /* PPP_INPROC_OWNTHREAD */ +static void pppDrop(PPPControlRx *pcrx); +static void pppInProc(PPPControlRx *pcrx, u_char *s, int l); +#endif /* PPPOS_SUPPORT */ + + +/******************************/ +/*** PUBLIC DATA STRUCTURES ***/ +/******************************/ +u_long subnetMask; + +static PPPControl pppControl[NUM_PPP]; /* The PPP interface control blocks. */ + +/* + * PPP Data Link Layer "protocol" table. + * One entry per supported protocol. + * The last entry must be NULL. + */ +struct protent *ppp_protocols[] = { + &lcp_protent, +#if PAP_SUPPORT + &pap_protent, +#endif /* PAP_SUPPORT */ +#if CHAP_SUPPORT + &chap_protent, +#endif /* CHAP_SUPPORT */ +#if CBCP_SUPPORT + &cbcp_protent, +#endif /* CBCP_SUPPORT */ + &ipcp_protent, +#if CCP_SUPPORT + &ccp_protent, +#endif /* CCP_SUPPORT */ + NULL +}; + + +/* + * Buffers for outgoing packets. This must be accessed only from the appropriate + * PPP task so that it doesn't need to be protected to avoid collisions. + */ +u_char outpacket_buf[NUM_PPP][PPP_MRU+PPP_HDRLEN]; + + +/*****************************/ +/*** LOCAL DATA STRUCTURES ***/ +/*****************************/ + +#if PPPOS_SUPPORT +/* + * FCS lookup table as calculated by genfcstab. + * @todo: smaller, slower implementation for lower memory footprint? + */ +static const u_short fcstab[256] = { + 0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf, + 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7, + 0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e, + 0x9cc9, 0x8d40, 0xbfdb, 0xae52, 0xdaed, 0xcb64, 0xf9ff, 0xe876, + 0x2102, 0x308b, 0x0210, 0x1399, 0x6726, 0x76af, 0x4434, 0x55bd, + 0xad4a, 0xbcc3, 0x8e58, 0x9fd1, 0xeb6e, 0xfae7, 0xc87c, 0xd9f5, + 0x3183, 0x200a, 0x1291, 0x0318, 0x77a7, 0x662e, 0x54b5, 0x453c, + 0xbdcb, 0xac42, 0x9ed9, 0x8f50, 0xfbef, 0xea66, 0xd8fd, 0xc974, + 0x4204, 0x538d, 0x6116, 0x709f, 0x0420, 0x15a9, 0x2732, 0x36bb, + 0xce4c, 0xdfc5, 0xed5e, 0xfcd7, 0x8868, 0x99e1, 0xab7a, 0xbaf3, + 0x5285, 0x430c, 0x7197, 0x601e, 0x14a1, 0x0528, 0x37b3, 0x263a, + 0xdecd, 0xcf44, 0xfddf, 0xec56, 0x98e9, 0x8960, 0xbbfb, 0xaa72, + 0x6306, 0x728f, 0x4014, 0x519d, 0x2522, 0x34ab, 0x0630, 0x17b9, + 0xef4e, 0xfec7, 0xcc5c, 0xddd5, 0xa96a, 0xb8e3, 0x8a78, 0x9bf1, + 0x7387, 0x620e, 0x5095, 0x411c, 0x35a3, 0x242a, 0x16b1, 0x0738, + 0xffcf, 0xee46, 0xdcdd, 0xcd54, 0xb9eb, 0xa862, 0x9af9, 0x8b70, + 0x8408, 0x9581, 0xa71a, 0xb693, 0xc22c, 0xd3a5, 0xe13e, 0xf0b7, + 0x0840, 0x19c9, 0x2b52, 0x3adb, 0x4e64, 0x5fed, 0x6d76, 0x7cff, + 0x9489, 0x8500, 0xb79b, 0xa612, 0xd2ad, 0xc324, 0xf1bf, 0xe036, + 0x18c1, 0x0948, 0x3bd3, 0x2a5a, 0x5ee5, 0x4f6c, 0x7df7, 0x6c7e, + 0xa50a, 0xb483, 0x8618, 0x9791, 0xe32e, 0xf2a7, 0xc03c, 0xd1b5, + 0x2942, 0x38cb, 0x0a50, 0x1bd9, 0x6f66, 0x7eef, 0x4c74, 0x5dfd, + 0xb58b, 0xa402, 0x9699, 0x8710, 0xf3af, 0xe226, 0xd0bd, 0xc134, + 0x39c3, 0x284a, 0x1ad1, 0x0b58, 0x7fe7, 0x6e6e, 0x5cf5, 0x4d7c, + 0xc60c, 0xd785, 0xe51e, 0xf497, 0x8028, 0x91a1, 0xa33a, 0xb2b3, + 0x4a44, 0x5bcd, 0x6956, 0x78df, 0x0c60, 0x1de9, 0x2f72, 0x3efb, + 0xd68d, 0xc704, 0xf59f, 0xe416, 0x90a9, 0x8120, 0xb3bb, 0xa232, + 0x5ac5, 0x4b4c, 0x79d7, 0x685e, 0x1ce1, 0x0d68, 0x3ff3, 0x2e7a, + 0xe70e, 0xf687, 0xc41c, 0xd595, 0xa12a, 0xb0a3, 0x8238, 0x93b1, + 0x6b46, 0x7acf, 0x4854, 0x59dd, 0x2d62, 0x3ceb, 0x0e70, 0x1ff9, + 0xf78f, 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330, + 0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78 +}; + +/* PPP's Asynchronous-Control-Character-Map. The mask array is used + * to select the specific bit for a character. */ +static u_char pppACCMMask[] = { + 0x01, + 0x02, + 0x04, + 0x08, + 0x10, + 0x20, + 0x40, + 0x80 +}; + +/** Wake up the task blocked in reading from serial line (if any) */ +static void +pppRecvWakeup(int pd) +{ + PPPDEBUG(LOG_DEBUG, ("pppRecvWakeup: unit %d\n", pd)); + if (pppControl[pd].openFlag != 0) { + sio_read_abort(pppControl[pd].fd); + } +} +#endif /* PPPOS_SUPPORT */ + +void +pppLinkTerminated(int pd) +{ + PPPDEBUG(LOG_DEBUG, ("pppLinkTerminated: unit %d\n", pd)); + +#if PPPOE_SUPPORT + if (pppControl[pd].ethif) { + pppoe_disconnect(pppControl[pd].pppoe_sc); + } else +#endif /* PPPOE_SUPPORT */ + { +#if PPPOS_SUPPORT + PPPControl* pc; + pppRecvWakeup(pd); + pc = &pppControl[pd]; + + PPPDEBUG(LOG_DEBUG, ("pppLinkTerminated: unit %d: linkStatusCB=%p errCode=%d\n", pd, pc->linkStatusCB, pc->errCode)); + if (pc->linkStatusCB) { + pc->linkStatusCB(pc->linkStatusCtx, pc->errCode ? pc->errCode : PPPERR_PROTOCOL, NULL); + } + + pc->openFlag = 0;/**/ +#endif /* PPPOS_SUPPORT */ + } + PPPDEBUG(LOG_DEBUG, ("pppLinkTerminated: finished.\n")); +} + +void +pppLinkDown(int pd) +{ + PPPDEBUG(LOG_DEBUG, ("pppLinkDown: unit %d\n", pd)); + +#if PPPOE_SUPPORT + if (pppControl[pd].ethif) { + pppoe_disconnect(pppControl[pd].pppoe_sc); + } else +#endif /* PPPOE_SUPPORT */ + { +#if PPPOS_SUPPORT + pppRecvWakeup(pd); +#endif /* PPPOS_SUPPORT */ + } +} + +/** Initiate LCP open request */ +static void +pppStart(int pd) +{ + PPPDEBUG(LOG_DEBUG, ("pppStart: unit %d\n", pd)); + lcp_lowerup(pd); + lcp_open(pd); /* Start protocol */ + PPPDEBUG(LOG_DEBUG, ("pppStart: finished\n")); +} + +/** LCP close request */ +static void +pppStop(int pd) +{ + PPPDEBUG(LOG_DEBUG, ("pppStop: unit %d\n", pd)); + lcp_close(pd, "User request"); +} + +/** Called when carrier/link is lost */ +static void +pppHup(int pd) +{ + PPPDEBUG(LOG_DEBUG, ("pppHupCB: unit %d\n", pd)); + lcp_lowerdown(pd); + link_terminated(pd); +} + +/***********************************/ +/*** PUBLIC FUNCTION DEFINITIONS ***/ +/***********************************/ +/* Initialize the PPP subsystem. */ + +struct ppp_settings ppp_settings; + +void +pppInit(void) +{ + struct protent *protp; + int i, j; + + memset(&ppp_settings, 0, sizeof(ppp_settings)); + ppp_settings.usepeerdns = 1; + pppSetAuth(PPPAUTHTYPE_NONE, NULL, NULL); + + magicInit(); + + subnetMask = PP_HTONL(0xffffff00UL); + + for (i = 0; i < NUM_PPP; i++) { + /* Initialize each protocol to the standard option set. */ + for (j = 0; (protp = ppp_protocols[j]) != NULL; ++j) { + (*protp->init)(i); + } + } +} + +void +pppSetAuth(enum pppAuthType authType, const char *user, const char *passwd) +{ + switch(authType) { + case PPPAUTHTYPE_NONE: + default: +#ifdef LWIP_PPP_STRICT_PAP_REJECT + ppp_settings.refuse_pap = 1; +#else /* LWIP_PPP_STRICT_PAP_REJECT */ + /* some providers request pap and accept an empty login/pw */ + ppp_settings.refuse_pap = 0; +#endif /* LWIP_PPP_STRICT_PAP_REJECT */ + ppp_settings.refuse_chap = 1; + break; + + case PPPAUTHTYPE_ANY: + /* Warning: Using PPPAUTHTYPE_ANY might have security consequences. + * RFC 1994 says: + * + * In practice, within or associated with each PPP server, there is a + * database which associates "user" names with authentication + * information ("secrets"). It is not anticipated that a particular + * named user would be authenticated by multiple methods. This would + * make the user vulnerable to attacks which negotiate the least secure + * method from among a set (such as PAP rather than CHAP). If the same + * secret was used, PAP would reveal the secret to be used later with + * CHAP. + * + * Instead, for each user name there should be an indication of exactly + * one method used to authenticate that user name. If a user needs to + * make use of different authentication methods under different + * circumstances, then distinct user names SHOULD be employed, each of + * which identifies exactly one authentication method. + * + */ + ppp_settings.refuse_pap = 0; + ppp_settings.refuse_chap = 0; + break; + + case PPPAUTHTYPE_PAP: + ppp_settings.refuse_pap = 0; + ppp_settings.refuse_chap = 1; + break; + + case PPPAUTHTYPE_CHAP: + ppp_settings.refuse_pap = 1; + ppp_settings.refuse_chap = 0; + break; + } + + if(user) { + strncpy(ppp_settings.user, user, sizeof(ppp_settings.user)-1); + ppp_settings.user[sizeof(ppp_settings.user)-1] = '\0'; + } else { + ppp_settings.user[0] = '\0'; + } + + if(passwd) { + strncpy(ppp_settings.passwd, passwd, sizeof(ppp_settings.passwd)-1); + ppp_settings.passwd[sizeof(ppp_settings.passwd)-1] = '\0'; + } else { + ppp_settings.passwd[0] = '\0'; + } +} + +#if PPPOS_SUPPORT +/** Open a new PPP connection using the given I/O device. + * This initializes the PPP control block but does not + * attempt to negotiate the LCP session. If this port + * connects to a modem, the modem connection must be + * established before calling this. + * Return a new PPP connection descriptor on success or + * an error code (negative) on failure. + * + * pppOpen() is directly defined to this function. + */ +int +pppOverSerialOpen(sio_fd_t fd, void (*linkStatusCB)(void *ctx, int errCode, void *arg), void *linkStatusCtx) +{ + PPPControl *pc; + int pd; + + if (linkStatusCB == NULL) { + /* PPP is single-threaded: without a callback, + * there is no way to know when the link is up. */ + return PPPERR_PARAM; + } + + /* Find a free PPP session descriptor. */ + for (pd = 0; pd < NUM_PPP && pppControl[pd].openFlag != 0; pd++); + + if (pd >= NUM_PPP) { + pd = PPPERR_OPEN; + } else { + pc = &pppControl[pd]; + /* @todo: is this correct or do I overwrite something? */ + memset(pc, 0, sizeof(PPPControl)); + pc->rx.pd = pd; + pc->rx.fd = fd; + + pc->openFlag = 1; + pc->fd = fd; + +#if VJ_SUPPORT + vj_compress_init(&pc->vjComp); +#endif /* VJ_SUPPORT */ + + /* + * Default the in and out accm so that escape and flag characters + * are always escaped. + */ + pc->rx.inACCM[15] = 0x60; /* no need to protect since RX is not running */ + pc->outACCM[15] = 0x60; + + pc->linkStatusCB = linkStatusCB; + pc->linkStatusCtx = linkStatusCtx; + + /* + * Start the connection and handle incoming events (packet or timeout). + */ + PPPDEBUG(LOG_INFO, ("pppOverSerialOpen: unit %d: Connecting\n", pd)); + pppStart(pd); +#if PPP_INPROC_OWNTHREAD + sys_thread_new(PPP_THREAD_NAME, pppInputThread, (void*)&pc->rx, PPP_THREAD_STACKSIZE, PPP_THREAD_PRIO); +#endif + } + + return pd; +} +#endif /* PPPOS_SUPPORT */ + +#if PPPOE_SUPPORT +static void pppOverEthernetLinkStatusCB(int pd, int up); + +void +pppOverEthernetClose(int pd) +{ + PPPControl* pc = &pppControl[pd]; + + /* *TJL* There's no lcp_deinit */ + lcp_close(pd, NULL); + + pppoe_destroy(&pc->netif); +} + +int pppOverEthernetOpen(struct netif *ethif, const char *service_name, const char *concentrator_name, void (*linkStatusCB)(void *ctx, int errCode, void *arg), void *linkStatusCtx) +{ + PPPControl *pc; + int pd; + + LWIP_UNUSED_ARG(service_name); + LWIP_UNUSED_ARG(concentrator_name); + + if (linkStatusCB == NULL) { + /* PPP is single-threaded: without a callback, + * there is no way to know when the link is up. */ + return PPPERR_PARAM; + } + + /* Find a free PPP session descriptor. Critical region? */ + for (pd = 0; pd < NUM_PPP && pppControl[pd].openFlag != 0; pd++); + if (pd >= NUM_PPP) { + pd = PPPERR_OPEN; + } else { + pc = &pppControl[pd]; + memset(pc, 0, sizeof(PPPControl)); + pc->openFlag = 1; + pc->ethif = ethif; + + pc->linkStatusCB = linkStatusCB; + pc->linkStatusCtx = linkStatusCtx; + + lcp_wantoptions[pd].mru = PPPOE_MAXMTU; + lcp_wantoptions[pd].neg_asyncmap = 0; + lcp_wantoptions[pd].neg_pcompression = 0; + lcp_wantoptions[pd].neg_accompression = 0; + + lcp_allowoptions[pd].mru = PPPOE_MAXMTU; + lcp_allowoptions[pd].neg_asyncmap = 0; + lcp_allowoptions[pd].neg_pcompression = 0; + lcp_allowoptions[pd].neg_accompression = 0; + + if(pppoe_create(ethif, pd, pppOverEthernetLinkStatusCB, &pc->pppoe_sc) != ERR_OK) { + pc->openFlag = 0; + return PPPERR_OPEN; + } + + pppoe_connect(pc->pppoe_sc); + } + + return pd; +} +#endif /* PPPOE_SUPPORT */ + + +/* Close a PPP connection and release the descriptor. + * Any outstanding packets in the queues are dropped. + * Return 0 on success, an error code on failure. */ +int +pppClose(int pd) +{ + PPPControl *pc = &pppControl[pd]; + int st = 0; + + PPPDEBUG(LOG_DEBUG, ("pppClose() called\n")); + + /* Disconnect */ +#if PPPOE_SUPPORT + if(pc->ethif) { + PPPDEBUG(LOG_DEBUG, ("pppClose: unit %d kill_link -> pppStop\n", pd)); + pc->errCode = PPPERR_USER; + /* This will leave us at PHASE_DEAD. */ + pppStop(pd); + } else +#endif /* PPPOE_SUPPORT */ + { +#if PPPOS_SUPPORT + PPPDEBUG(LOG_DEBUG, ("pppClose: unit %d kill_link -> pppStop\n", pd)); + pc->errCode = PPPERR_USER; + /* This will leave us at PHASE_DEAD. */ + pppStop(pd); + pppRecvWakeup(pd); +#endif /* PPPOS_SUPPORT */ + } + + return st; +} + +/* This function is called when carrier is lost on the PPP channel. */ +void +pppSigHUP(int pd) +{ + PPPDEBUG(LOG_DEBUG, ("pppSigHUP: unit %d sig_hup -> pppHupCB\n", pd)); + pppHup(pd); +} + +#if PPPOS_SUPPORT +static void +nPut(PPPControl *pc, struct pbuf *nb) +{ + struct pbuf *b; + int c; + + for(b = nb; b != NULL; b = b->next) { + if((c = sio_write(pc->fd, b->payload, b->len)) != b->len) { + PPPDEBUG(LOG_WARNING, + ("PPP nPut: incomplete sio_write(fd:%"SZT_F", len:%d, c: 0x%"X8_F") c = %d\n", (size_t)pc->fd, b->len, c, c)); + LINK_STATS_INC(link.err); + pc->lastXMit = 0; /* prepend PPP_FLAG to next packet */ + snmp_inc_ifoutdiscards(&pc->netif); + pbuf_free(nb); + return; + } + } + + snmp_add_ifoutoctets(&pc->netif, nb->tot_len); + snmp_inc_ifoutucastpkts(&pc->netif); + pbuf_free(nb); + LINK_STATS_INC(link.xmit); +} + +/* + * pppAppend - append given character to end of given pbuf. If outACCM + * is not NULL and the character needs to be escaped, do so. + * If pbuf is full, append another. + * Return the current pbuf. + */ +static struct pbuf * +pppAppend(u_char c, struct pbuf *nb, ext_accm *outACCM) +{ + struct pbuf *tb = nb; + + /* Make sure there is room for the character and an escape code. + * Sure we don't quite fill the buffer if the character doesn't + * get escaped but is one character worth complicating this? */ + /* Note: We assume no packet header. */ + if (nb && (PBUF_POOL_BUFSIZE - nb->len) < 2) { + tb = pbuf_alloc(PBUF_RAW, 0, PBUF_POOL); + if (tb) { + nb->next = tb; + } else { + LINK_STATS_INC(link.memerr); + } + nb = tb; + } + + if (nb) { + if (outACCM && ESCAPE_P(*outACCM, c)) { + *((u_char*)nb->payload + nb->len++) = PPP_ESCAPE; + *((u_char*)nb->payload + nb->len++) = c ^ PPP_TRANS; + } else { + *((u_char*)nb->payload + nb->len++) = c; + } + } + + return tb; +} +#endif /* PPPOS_SUPPORT */ + +#if PPPOE_SUPPORT +static err_t +pppifOutputOverEthernet(int pd, struct pbuf *p) +{ + PPPControl *pc = &pppControl[pd]; + struct pbuf *pb; + u_short protocol = PPP_IP; + int i=0; + u16_t tot_len; + + /* @todo: try to use pbuf_header() here! */ + pb = pbuf_alloc(PBUF_LINK, PPPOE_HDRLEN + sizeof(protocol), PBUF_RAM); + if(!pb) { + LINK_STATS_INC(link.memerr); + LINK_STATS_INC(link.proterr); + snmp_inc_ifoutdiscards(&pc->netif); + return ERR_MEM; + } + + pbuf_header(pb, -(s16_t)PPPOE_HDRLEN); + + pc->lastXMit = sys_jiffies(); + + if (!pc->pcomp || protocol > 0xFF) { + *((u_char*)pb->payload + i++) = (protocol >> 8) & 0xFF; + } + *((u_char*)pb->payload + i) = protocol & 0xFF; + + pbuf_chain(pb, p); + tot_len = pb->tot_len; + + if(pppoe_xmit(pc->pppoe_sc, pb) != ERR_OK) { + LINK_STATS_INC(link.err); + snmp_inc_ifoutdiscards(&pc->netif); + return PPPERR_DEVICE; + } + + snmp_add_ifoutoctets(&pc->netif, tot_len); + snmp_inc_ifoutucastpkts(&pc->netif); + LINK_STATS_INC(link.xmit); + return ERR_OK; +} +#endif /* PPPOE_SUPPORT */ + +/* Send a packet on the given connection. */ +static err_t +pppifOutput(struct netif *netif, struct pbuf *pb, ip_addr_t *ipaddr) +{ + int pd = (int)(size_t)netif->state; + PPPControl *pc = &pppControl[pd]; +#if PPPOS_SUPPORT + u_short protocol = PPP_IP; + u_int fcsOut = PPP_INITFCS; + struct pbuf *headMB = NULL, *tailMB = NULL, *p; + u_char c; +#endif /* PPPOS_SUPPORT */ + + LWIP_UNUSED_ARG(ipaddr); + + /* Validate parameters. */ + /* We let any protocol value go through - it can't hurt us + * and the peer will just drop it if it's not accepting it. */ + if (pd < 0 || pd >= NUM_PPP || !pc->openFlag || !pb) { + PPPDEBUG(LOG_WARNING, ("pppifOutput[%d]: bad parms prot=%d pb=%p\n", + pd, PPP_IP, pb)); + LINK_STATS_INC(link.opterr); + LINK_STATS_INC(link.drop); + snmp_inc_ifoutdiscards(netif); + return ERR_ARG; + } + + /* Check that the link is up. */ + if (lcp_phase[pd] == PHASE_DEAD) { + PPPDEBUG(LOG_ERR, ("pppifOutput[%d]: link not up\n", pd)); + LINK_STATS_INC(link.rterr); + LINK_STATS_INC(link.drop); + snmp_inc_ifoutdiscards(netif); + return ERR_RTE; + } + +#if PPPOE_SUPPORT + if(pc->ethif) { + return pppifOutputOverEthernet(pd, pb); + } +#endif /* PPPOE_SUPPORT */ + +#if PPPOS_SUPPORT + /* Grab an output buffer. */ + headMB = pbuf_alloc(PBUF_RAW, 0, PBUF_POOL); + if (headMB == NULL) { + PPPDEBUG(LOG_WARNING, ("pppifOutput[%d]: first alloc fail\n", pd)); + LINK_STATS_INC(link.memerr); + LINK_STATS_INC(link.drop); + snmp_inc_ifoutdiscards(netif); + return ERR_MEM; + } + +#if VJ_SUPPORT + /* + * Attempt Van Jacobson header compression if VJ is configured and + * this is an IP packet. + */ + if (protocol == PPP_IP && pc->vjEnabled) { + switch (vj_compress_tcp(&pc->vjComp, pb)) { + case TYPE_IP: + /* No change... + protocol = PPP_IP_PROTOCOL; */ + break; + case TYPE_COMPRESSED_TCP: + protocol = PPP_VJC_COMP; + break; + case TYPE_UNCOMPRESSED_TCP: + protocol = PPP_VJC_UNCOMP; + break; + default: + PPPDEBUG(LOG_WARNING, ("pppifOutput[%d]: bad IP packet\n", pd)); + LINK_STATS_INC(link.proterr); + LINK_STATS_INC(link.drop); + snmp_inc_ifoutdiscards(netif); + pbuf_free(headMB); + return ERR_VAL; + } + } +#endif /* VJ_SUPPORT */ + + tailMB = headMB; + + /* Build the PPP header. */ + if ((sys_jiffies() - pc->lastXMit) >= PPP_MAXIDLEFLAG) { + tailMB = pppAppend(PPP_FLAG, tailMB, NULL); + } + + pc->lastXMit = sys_jiffies(); + if (!pc->accomp) { + fcsOut = PPP_FCS(fcsOut, PPP_ALLSTATIONS); + tailMB = pppAppend(PPP_ALLSTATIONS, tailMB, &pc->outACCM); + fcsOut = PPP_FCS(fcsOut, PPP_UI); + tailMB = pppAppend(PPP_UI, tailMB, &pc->outACCM); + } + if (!pc->pcomp || protocol > 0xFF) { + c = (protocol >> 8) & 0xFF; + fcsOut = PPP_FCS(fcsOut, c); + tailMB = pppAppend(c, tailMB, &pc->outACCM); + } + c = protocol & 0xFF; + fcsOut = PPP_FCS(fcsOut, c); + tailMB = pppAppend(c, tailMB, &pc->outACCM); + + /* Load packet. */ + for(p = pb; p; p = p->next) { + int n; + u_char *sPtr; + + sPtr = (u_char*)p->payload; + n = p->len; + while (n-- > 0) { + c = *sPtr++; + + /* Update FCS before checking for special characters. */ + fcsOut = PPP_FCS(fcsOut, c); + + /* Copy to output buffer escaping special characters. */ + tailMB = pppAppend(c, tailMB, &pc->outACCM); + } + } + + /* Add FCS and trailing flag. */ + c = ~fcsOut & 0xFF; + tailMB = pppAppend(c, tailMB, &pc->outACCM); + c = (~fcsOut >> 8) & 0xFF; + tailMB = pppAppend(c, tailMB, &pc->outACCM); + tailMB = pppAppend(PPP_FLAG, tailMB, NULL); + + /* If we failed to complete the packet, throw it away. */ + if (!tailMB) { + PPPDEBUG(LOG_WARNING, + ("pppifOutput[%d]: Alloc err - dropping proto=%d\n", + pd, protocol)); + pbuf_free(headMB); + LINK_STATS_INC(link.memerr); + LINK_STATS_INC(link.drop); + snmp_inc_ifoutdiscards(netif); + return ERR_MEM; + } + + /* Send it. */ + PPPDEBUG(LOG_INFO, ("pppifOutput[%d]: proto=0x%"X16_F"\n", pd, protocol)); + + nPut(pc, headMB); +#endif /* PPPOS_SUPPORT */ + + return ERR_OK; +} + +/* Get and set parameters for the given connection. + * Return 0 on success, an error code on failure. */ +int +pppIOCtl(int pd, int cmd, void *arg) +{ + PPPControl *pc = &pppControl[pd]; + int st = 0; + + if (pd < 0 || pd >= NUM_PPP) { + st = PPPERR_PARAM; + } else { + switch(cmd) { + case PPPCTLG_UPSTATUS: /* Get the PPP up status. */ + if (arg) { + *(int *)arg = (int)(pc->if_up); + } else { + st = PPPERR_PARAM; + } + break; + case PPPCTLS_ERRCODE: /* Set the PPP error code. */ + if (arg) { + pc->errCode = *(int *)arg; + } else { + st = PPPERR_PARAM; + } + break; + case PPPCTLG_ERRCODE: /* Get the PPP error code. */ + if (arg) { + *(int *)arg = (int)(pc->errCode); + } else { + st = PPPERR_PARAM; + } + break; +#if PPPOS_SUPPORT + case PPPCTLG_FD: /* Get the fd associated with the ppp */ + if (arg) { + *(sio_fd_t *)arg = pc->fd; + } else { + st = PPPERR_PARAM; + } + break; +#endif /* PPPOS_SUPPORT */ + default: + st = PPPERR_PARAM; + break; + } + } + + return st; +} + +/* + * Return the Maximum Transmission Unit for the given PPP connection. + */ +u_short +pppMTU(int pd) +{ + PPPControl *pc = &pppControl[pd]; + u_short st; + + /* Validate parameters. */ + if (pd < 0 || pd >= NUM_PPP || !pc->openFlag) { + st = 0; + } else { + st = pc->mtu; + } + + return st; +} + +#if PPPOE_SUPPORT +int +pppWriteOverEthernet(int pd, const u_char *s, int n) +{ + PPPControl *pc = &pppControl[pd]; + struct pbuf *pb; + + /* skip address & flags */ + s += 2; + n -= 2; + + LWIP_ASSERT("PPPOE_HDRLEN + n <= 0xffff", PPPOE_HDRLEN + n <= 0xffff); + pb = pbuf_alloc(PBUF_LINK, (u16_t)(PPPOE_HDRLEN + n), PBUF_RAM); + if(!pb) { + LINK_STATS_INC(link.memerr); + LINK_STATS_INC(link.proterr); + snmp_inc_ifoutdiscards(&pc->netif); + return PPPERR_ALLOC; + } + + pbuf_header(pb, -(s16_t)PPPOE_HDRLEN); + + pc->lastXMit = sys_jiffies(); + + MEMCPY(pb->payload, s, n); + + if(pppoe_xmit(pc->pppoe_sc, pb) != ERR_OK) { + LINK_STATS_INC(link.err); + snmp_inc_ifoutdiscards(&pc->netif); + return PPPERR_DEVICE; + } + + snmp_add_ifoutoctets(&pc->netif, (u16_t)n); + snmp_inc_ifoutucastpkts(&pc->netif); + LINK_STATS_INC(link.xmit); + return PPPERR_NONE; +} +#endif /* PPPOE_SUPPORT */ + +/* + * Write n characters to a ppp link. + * RETURN: >= 0 Number of characters written + * -1 Failed to write to device + */ +int +pppWrite(int pd, const u_char *s, int n) +{ + PPPControl *pc = &pppControl[pd]; +#if PPPOS_SUPPORT + u_char c; + u_int fcsOut; + struct pbuf *headMB, *tailMB; +#endif /* PPPOS_SUPPORT */ + +#if PPPOE_SUPPORT + if(pc->ethif) { + return pppWriteOverEthernet(pd, s, n); + } +#endif /* PPPOE_SUPPORT */ + +#if PPPOS_SUPPORT + headMB = pbuf_alloc(PBUF_RAW, 0, PBUF_POOL); + if (headMB == NULL) { + LINK_STATS_INC(link.memerr); + LINK_STATS_INC(link.proterr); + snmp_inc_ifoutdiscards(&pc->netif); + return PPPERR_ALLOC; + } + + tailMB = headMB; + + /* If the link has been idle, we'll send a fresh flag character to + * flush any noise. */ + if ((sys_jiffies() - pc->lastXMit) >= PPP_MAXIDLEFLAG) { + tailMB = pppAppend(PPP_FLAG, tailMB, NULL); + } + pc->lastXMit = sys_jiffies(); + + fcsOut = PPP_INITFCS; + /* Load output buffer. */ + while (n-- > 0) { + c = *s++; + + /* Update FCS before checking for special characters. */ + fcsOut = PPP_FCS(fcsOut, c); + + /* Copy to output buffer escaping special characters. */ + tailMB = pppAppend(c, tailMB, &pc->outACCM); + } + + /* Add FCS and trailing flag. */ + c = ~fcsOut & 0xFF; + tailMB = pppAppend(c, tailMB, &pc->outACCM); + c = (~fcsOut >> 8) & 0xFF; + tailMB = pppAppend(c, tailMB, &pc->outACCM); + tailMB = pppAppend(PPP_FLAG, tailMB, NULL); + + /* If we failed to complete the packet, throw it away. + * Otherwise send it. */ + if (!tailMB) { + PPPDEBUG(LOG_WARNING, + ("pppWrite[%d]: Alloc err - dropping pbuf len=%d\n", pd, headMB->len)); + /*"pppWrite[%d]: Alloc err - dropping %d:%.*H", pd, headMB->len, LWIP_MIN(headMB->len * 2, 40), headMB->payload)); */ + pbuf_free(headMB); + LINK_STATS_INC(link.memerr); + LINK_STATS_INC(link.proterr); + snmp_inc_ifoutdiscards(&pc->netif); + return PPPERR_ALLOC; + } + + PPPDEBUG(LOG_INFO, ("pppWrite[%d]: len=%d\n", pd, headMB->len)); + /* "pppWrite[%d]: %d:%.*H", pd, headMB->len, LWIP_MIN(headMB->len * 2, 40), headMB->payload)); */ + nPut(pc, headMB); +#endif /* PPPOS_SUPPORT */ + + return PPPERR_NONE; +} + +/* + * ppp_send_config - configure the transmit characteristics of + * the ppp interface. + */ +void +ppp_send_config( int unit, u16_t mtu, u32_t asyncmap, int pcomp, int accomp) +{ + PPPControl *pc = &pppControl[unit]; + int i; + + pc->mtu = mtu; + pc->pcomp = pcomp; + pc->accomp = accomp; + + /* Load the ACCM bits for the 32 control codes. */ + for (i = 0; i < 32/8; i++) { + pc->outACCM[i] = (u_char)((asyncmap >> (8 * i)) & 0xFF); + } + PPPDEBUG(LOG_INFO, ("ppp_send_config[%d]: outACCM=%X %X %X %X\n", + unit, + pc->outACCM[0], pc->outACCM[1], pc->outACCM[2], pc->outACCM[3])); +} + + +/* + * ppp_set_xaccm - set the extended transmit ACCM for the interface. + */ +void +ppp_set_xaccm(int unit, ext_accm *accm) +{ + SMEMCPY(pppControl[unit].outACCM, accm, sizeof(ext_accm)); + PPPDEBUG(LOG_INFO, ("ppp_set_xaccm[%d]: outACCM=%X %X %X %X\n", + unit, + pppControl[unit].outACCM[0], + pppControl[unit].outACCM[1], + pppControl[unit].outACCM[2], + pppControl[unit].outACCM[3])); +} + + +/* + * ppp_recv_config - configure the receive-side characteristics of + * the ppp interface. + */ +void +ppp_recv_config( int unit, int mru, u32_t asyncmap, int pcomp, int accomp) +{ + PPPControl *pc = &pppControl[unit]; + int i; + SYS_ARCH_DECL_PROTECT(lev); + + LWIP_UNUSED_ARG(accomp); + LWIP_UNUSED_ARG(pcomp); + LWIP_UNUSED_ARG(mru); + + /* Load the ACCM bits for the 32 control codes. */ + SYS_ARCH_PROTECT(lev); + for (i = 0; i < 32 / 8; i++) { + /* @todo: does this work? ext_accm has been modified from pppd! */ + pc->rx.inACCM[i] = (u_char)(asyncmap >> (i * 8)); + } + SYS_ARCH_UNPROTECT(lev); + PPPDEBUG(LOG_INFO, ("ppp_recv_config[%d]: inACCM=%X %X %X %X\n", + unit, + pc->rx.inACCM[0], pc->rx.inACCM[1], pc->rx.inACCM[2], pc->rx.inACCM[3])); +} + +#if 0 +/* + * ccp_test - ask kernel whether a given compression method + * is acceptable for use. Returns 1 if the method and parameters + * are OK, 0 if the method is known but the parameters are not OK + * (e.g. code size should be reduced), or -1 if the method is unknown. + */ +int +ccp_test( int unit, int opt_len, int for_transmit, u_char *opt_ptr) +{ + return 0; /* XXX Currently no compression. */ +} + +/* + * ccp_flags_set - inform kernel about the current state of CCP. + */ +void +ccp_flags_set(int unit, int isopen, int isup) +{ + /* XXX */ +} + +/* + * ccp_fatal_error - returns 1 if decompression was disabled as a + * result of an error detected after decompression of a packet, + * 0 otherwise. This is necessary because of patent nonsense. + */ +int +ccp_fatal_error(int unit) +{ + /* XXX */ + return 0; +} +#endif + +/* + * get_idle_time - return how long the link has been idle. + */ +int +get_idle_time(int u, struct ppp_idle *ip) +{ + /* XXX */ + LWIP_UNUSED_ARG(u); + LWIP_UNUSED_ARG(ip); + + return 0; +} + + +/* + * Return user specified netmask, modified by any mask we might determine + * for address `addr' (in network byte order). + * Here we scan through the system's list of interfaces, looking for + * any non-point-to-point interfaces which might appear to be on the same + * network as `addr'. If we find any, we OR in their netmask to the + * user-specified netmask. + */ +u32_t +GetMask(u32_t addr) +{ + u32_t mask, nmask; + + htonl(addr); + if (IP_CLASSA(addr)) { /* determine network mask for address class */ + nmask = IP_CLASSA_NET; + } else if (IP_CLASSB(addr)) { + nmask = IP_CLASSB_NET; + } else { + nmask = IP_CLASSC_NET; + } + + /* class D nets are disallowed by bad_ip_adrs */ + mask = subnetMask | htonl(nmask); + + /* XXX + * Scan through the system's network interfaces. + * Get each netmask and OR them into our mask. + */ + + return mask; +} + +/* + * sifvjcomp - config tcp header compression + */ +int +sifvjcomp(int pd, int vjcomp, u8_t cidcomp, u8_t maxcid) +{ +#if PPPOS_SUPPORT && VJ_SUPPORT + PPPControl *pc = &pppControl[pd]; + + pc->vjEnabled = vjcomp; + pc->vjComp.compressSlot = cidcomp; + pc->vjComp.maxSlotIndex = maxcid; + PPPDEBUG(LOG_INFO, ("sifvjcomp: VJ compress enable=%d slot=%d max slot=%d\n", + vjcomp, cidcomp, maxcid)); +#else /* PPPOS_SUPPORT && VJ_SUPPORT */ + LWIP_UNUSED_ARG(pd); + LWIP_UNUSED_ARG(vjcomp); + LWIP_UNUSED_ARG(cidcomp); + LWIP_UNUSED_ARG(maxcid); +#endif /* PPPOS_SUPPORT && VJ_SUPPORT */ + + return 0; +} + +/* + * pppifNetifInit - netif init callback + */ +static err_t +pppifNetifInit(struct netif *netif) +{ + netif->name[0] = 'p'; + netif->name[1] = 'p'; + netif->output = pppifOutput; + netif->mtu = pppMTU((int)(size_t)netif->state); + netif->flags = NETIF_FLAG_POINTTOPOINT | NETIF_FLAG_LINK_UP; +#if LWIP_NETIF_HOSTNAME + /* @todo: Initialize interface hostname */ + /* netif_set_hostname(netif, "lwip"); */ +#endif /* LWIP_NETIF_HOSTNAME */ + return ERR_OK; +} + + +/* + * sifup - Config the interface up and enable IP packets to pass. + */ +int +sifup(int pd) +{ + PPPControl *pc = &pppControl[pd]; + int st = 1; + + if (pd < 0 || pd >= NUM_PPP || !pc->openFlag) { + st = 0; + PPPDEBUG(LOG_WARNING, ("sifup[%d]: bad parms\n", pd)); + } else { + netif_remove(&pc->netif); + if (netif_add(&pc->netif, &pc->addrs.our_ipaddr, &pc->addrs.netmask, + &pc->addrs.his_ipaddr, (void *)(size_t)pd, pppifNetifInit, ip_input)) { + netif_set_up(&pc->netif); + pc->if_up = 1; + pc->errCode = PPPERR_NONE; + + PPPDEBUG(LOG_DEBUG, ("sifup: unit %d: linkStatusCB=%p errCode=%d\n", pd, pc->linkStatusCB, pc->errCode)); + if (pc->linkStatusCB) { + pc->linkStatusCB(pc->linkStatusCtx, pc->errCode, &pc->addrs); + } + } else { + st = 0; + PPPDEBUG(LOG_ERR, ("sifup[%d]: netif_add failed\n", pd)); + } + } + + return st; +} + +/* + * sifnpmode - Set the mode for handling packets for a given NP. + */ +int +sifnpmode(int u, int proto, enum NPmode mode) +{ + LWIP_UNUSED_ARG(u); + LWIP_UNUSED_ARG(proto); + LWIP_UNUSED_ARG(mode); + return 0; +} + +/* + * sifdown - Config the interface down and disable IP. + */ +int +sifdown(int pd) +{ + PPPControl *pc = &pppControl[pd]; + int st = 1; + + if (pd < 0 || pd >= NUM_PPP || !pc->openFlag) { + st = 0; + PPPDEBUG(LOG_WARNING, ("sifdown[%d]: bad parms\n", pd)); + } else { + pc->if_up = 0; + /* make sure the netif status callback is called */ + netif_set_down(&pc->netif); + netif_remove(&pc->netif); + PPPDEBUG(LOG_DEBUG, ("sifdown: unit %d: linkStatusCB=%p errCode=%d\n", pd, pc->linkStatusCB, pc->errCode)); + if (pc->linkStatusCB) { + pc->linkStatusCB(pc->linkStatusCtx, PPPERR_CONNECT, NULL); + } + } + return st; +} + +/** + * sifaddr - Config the interface IP addresses and netmask. + * @param pd Interface unit ??? + * @param o Our IP address ??? + * @param h His IP address ??? + * @param m IP subnet mask ??? + * @param ns1 Primary DNS + * @param ns2 Secondary DNS + */ +int +sifaddr( int pd, u32_t o, u32_t h, u32_t m, u32_t ns1, u32_t ns2) +{ + PPPControl *pc = &pppControl[pd]; + int st = 1; + + if (pd < 0 || pd >= NUM_PPP || !pc->openFlag) { + st = 0; + PPPDEBUG(LOG_WARNING, ("sifup[%d]: bad parms\n", pd)); + } else { + SMEMCPY(&pc->addrs.our_ipaddr, &o, sizeof(o)); + SMEMCPY(&pc->addrs.his_ipaddr, &h, sizeof(h)); + SMEMCPY(&pc->addrs.netmask, &m, sizeof(m)); + SMEMCPY(&pc->addrs.dns1, &ns1, sizeof(ns1)); + SMEMCPY(&pc->addrs.dns2, &ns2, sizeof(ns2)); + } + return st; +} + +/** + * cifaddr - Clear the interface IP addresses, and delete routes + * through the interface if possible. + * @param pd Interface unit ??? + * @param o Our IP address ??? + * @param h IP broadcast address ??? + */ +int +cifaddr( int pd, u32_t o, u32_t h) +{ + PPPControl *pc = &pppControl[pd]; + int st = 1; + + LWIP_UNUSED_ARG(o); + LWIP_UNUSED_ARG(h); + if (pd < 0 || pd >= NUM_PPP || !pc->openFlag) { + st = 0; + PPPDEBUG(LOG_WARNING, ("sifup[%d]: bad parms\n", pd)); + } else { + IP4_ADDR(&pc->addrs.our_ipaddr, 0,0,0,0); + IP4_ADDR(&pc->addrs.his_ipaddr, 0,0,0,0); + IP4_ADDR(&pc->addrs.netmask, 255,255,255,0); + IP4_ADDR(&pc->addrs.dns1, 0,0,0,0); + IP4_ADDR(&pc->addrs.dns2, 0,0,0,0); + } + return st; +} + +/* + * sifdefaultroute - assign a default route through the address given. + */ +int +sifdefaultroute(int pd, u32_t l, u32_t g) +{ + PPPControl *pc = &pppControl[pd]; + int st = 1; + + LWIP_UNUSED_ARG(l); + LWIP_UNUSED_ARG(g); + + if (pd < 0 || pd >= NUM_PPP || !pc->openFlag) { + st = 0; + PPPDEBUG(LOG_WARNING, ("sifup[%d]: bad parms\n", pd)); + } else { + netif_set_default(&pc->netif); + } + + /* TODO: check how PPP handled the netMask, previously not set by ipSetDefault */ + + return st; +} + +/* + * cifdefaultroute - delete a default route through the address given. + */ +int +cifdefaultroute(int pd, u32_t l, u32_t g) +{ + PPPControl *pc = &pppControl[pd]; + int st = 1; + + LWIP_UNUSED_ARG(l); + LWIP_UNUSED_ARG(g); + + if (pd < 0 || pd >= NUM_PPP || !pc->openFlag) { + st = 0; + PPPDEBUG(LOG_WARNING, ("sifup[%d]: bad parms\n", pd)); + } else { + netif_set_default(NULL); + } + + return st; +} + +/**********************************/ +/*** LOCAL FUNCTION DEFINITIONS ***/ +/**********************************/ + +#if PPPOS_SUPPORT && PPP_INPROC_OWNTHREAD +/* The main PPP process function. This implements the state machine according + * to section 4 of RFC 1661: The Point-To-Point Protocol. */ +static void +pppInputThread(void *arg) +{ + int count; + PPPControlRx *pcrx = arg; + + while (lcp_phase[pcrx->pd] != PHASE_DEAD) { + count = sio_read(pcrx->fd, pcrx->rxbuf, PPPOS_RX_BUFSIZE); + if(count > 0) { + pppInProc(pcrx, pcrx->rxbuf, count); + } else { + /* nothing received, give other tasks a chance to run */ + sys_msleep(1); + } + } +} +#endif /* PPPOS_SUPPORT && PPP_INPROC_OWNTHREAD */ + +#if PPPOE_SUPPORT + +void +pppOverEthernetInitFailed(int pd) +{ + PPPControl* pc; + + pppHup(pd); + pppStop(pd); + + pc = &pppControl[pd]; + pppoe_destroy(&pc->netif); + pc->openFlag = 0; + + if(pc->linkStatusCB) { + pc->linkStatusCB(pc->linkStatusCtx, pc->errCode ? pc->errCode : PPPERR_PROTOCOL, NULL); + } +} + +static void +pppOverEthernetLinkStatusCB(int pd, int up) +{ + if(up) { + PPPDEBUG(LOG_INFO, ("pppOverEthernetLinkStatusCB: unit %d: Connecting\n", pd)); + pppStart(pd); + } else { + pppOverEthernetInitFailed(pd); + } +} +#endif /* PPPOE_SUPPORT */ + +struct pbuf * +pppSingleBuf(struct pbuf *p) +{ + struct pbuf *q, *b; + u_char *pl; + + if(p->tot_len == p->len) { + return p; + } + + q = pbuf_alloc(PBUF_RAW, p->tot_len, PBUF_RAM); + if(!q) { + PPPDEBUG(LOG_ERR, + ("pppSingleBuf: unable to alloc new buf (%d)\n", p->tot_len)); + return p; /* live dangerously */ + } + + for(b = p, pl = q->payload; b != NULL; b = b->next) { + MEMCPY(pl, b->payload, b->len); + pl += b->len; + } + + pbuf_free(p); + + return q; +} + +struct pppInputHeader { + int unit; + u16_t proto; +}; + +/* + * Pass the processed input packet to the appropriate handler. + * This function and all handlers run in the context of the tcpip_thread + */ +static void +pppInput(void *arg) +{ + struct pbuf *nb = (struct pbuf *)arg; + u16_t protocol; + int pd; + + pd = ((struct pppInputHeader *)nb->payload)->unit; + protocol = ((struct pppInputHeader *)nb->payload)->proto; + + if(pbuf_header(nb, -(int)sizeof(struct pppInputHeader))) { + LWIP_ASSERT("pbuf_header failed\n", 0); + goto drop; + } + + LINK_STATS_INC(link.recv); + snmp_inc_ifinucastpkts(&pppControl[pd].netif); + snmp_add_ifinoctets(&pppControl[pd].netif, nb->tot_len); + + /* + * Toss all non-LCP packets unless LCP is OPEN. + * Until we get past the authentication phase, toss all packets + * except LCP, LQR and authentication packets. + */ + if((lcp_phase[pd] <= PHASE_AUTHENTICATE) && (protocol != PPP_LCP)) { + if(!((protocol == PPP_LQR) || (protocol == PPP_PAP) || (protocol == PPP_CHAP)) || + (lcp_phase[pd] != PHASE_AUTHENTICATE)) { + PPPDEBUG(LOG_INFO, ("pppInput: discarding proto 0x%"X16_F" in phase %d\n", protocol, lcp_phase[pd])); + goto drop; + } + } + + switch(protocol) { + case PPP_VJC_COMP: /* VJ compressed TCP */ +#if PPPOS_SUPPORT && VJ_SUPPORT + PPPDEBUG(LOG_INFO, ("pppInput[%d]: vj_comp in pbuf len=%d\n", pd, nb->len)); + /* + * Clip off the VJ header and prepend the rebuilt TCP/IP header and + * pass the result to IP. + */ + if ((vj_uncompress_tcp(&nb, &pppControl[pd].vjComp) >= 0) && (pppControl[pd].netif.input)) { + pppControl[pd].netif.input(nb, &pppControl[pd].netif); + return; + } + /* Something's wrong so drop it. */ + PPPDEBUG(LOG_WARNING, ("pppInput[%d]: Dropping VJ compressed\n", pd)); +#else /* PPPOS_SUPPORT && VJ_SUPPORT */ + /* No handler for this protocol so drop the packet. */ + PPPDEBUG(LOG_INFO, ("pppInput[%d]: drop VJ Comp in %d:%s\n", pd, nb->len, nb->payload)); +#endif /* PPPOS_SUPPORT && VJ_SUPPORT */ + break; + + case PPP_VJC_UNCOMP: /* VJ uncompressed TCP */ +#if PPPOS_SUPPORT && VJ_SUPPORT + PPPDEBUG(LOG_INFO, ("pppInput[%d]: vj_un in pbuf len=%d\n", pd, nb->len)); + /* + * Process the TCP/IP header for VJ header compression and then pass + * the packet to IP. + */ + if ((vj_uncompress_uncomp(nb, &pppControl[pd].vjComp) >= 0) && pppControl[pd].netif.input) { + pppControl[pd].netif.input(nb, &pppControl[pd].netif); + return; + } + /* Something's wrong so drop it. */ + PPPDEBUG(LOG_WARNING, ("pppInput[%d]: Dropping VJ uncompressed\n", pd)); +#else /* PPPOS_SUPPORT && VJ_SUPPORT */ + /* No handler for this protocol so drop the packet. */ + PPPDEBUG(LOG_INFO, + ("pppInput[%d]: drop VJ UnComp in %d:.*H\n", + pd, nb->len, LWIP_MIN(nb->len * 2, 40), nb->payload)); +#endif /* PPPOS_SUPPORT && VJ_SUPPORT */ + break; + + case PPP_IP: /* Internet Protocol */ + PPPDEBUG(LOG_INFO, ("pppInput[%d]: ip in pbuf len=%d\n", pd, nb->len)); + if (pppControl[pd].netif.input) { + pppControl[pd].netif.input(nb, &pppControl[pd].netif); + return; + } + break; + + default: { + struct protent *protp; + int i; + + /* + * Upcall the proper protocol input routine. + */ + for (i = 0; (protp = ppp_protocols[i]) != NULL; ++i) { + if (protp->protocol == protocol && protp->enabled_flag) { + PPPDEBUG(LOG_INFO, ("pppInput[%d]: %s len=%d\n", pd, protp->name, nb->len)); + nb = pppSingleBuf(nb); + (*protp->input)(pd, nb->payload, nb->len); + PPPDEBUG(LOG_DETAIL, ("pppInput[%d]: packet processed\n", pd)); + goto out; + } + } + + /* No handler for this protocol so reject the packet. */ + PPPDEBUG(LOG_INFO, ("pppInput[%d]: rejecting unsupported proto 0x%"X16_F" len=%d\n", pd, protocol, nb->len)); + if (pbuf_header(nb, sizeof(protocol))) { + LWIP_ASSERT("pbuf_header failed\n", 0); + goto drop; + } +#if BYTE_ORDER == LITTLE_ENDIAN + protocol = htons(protocol); +#endif /* BYTE_ORDER == LITTLE_ENDIAN */ + SMEMCPY(nb->payload, &protocol, sizeof(protocol)); + lcp_sprotrej(pd, nb->payload, nb->len); + } + break; + } + +drop: + LINK_STATS_INC(link.drop); + snmp_inc_ifindiscards(&pppControl[pd].netif); + +out: + pbuf_free(nb); + return; +} + +#if PPPOS_SUPPORT +/* + * Drop the input packet. + */ +static void +pppDrop(PPPControlRx *pcrx) +{ + if (pcrx->inHead != NULL) { +#if 0 + PPPDEBUG(LOG_INFO, ("pppDrop: %d:%.*H\n", pcrx->inHead->len, min(60, pcrx->inHead->len * 2), pcrx->inHead->payload)); +#endif + PPPDEBUG(LOG_INFO, ("pppDrop: pbuf len=%d, addr %p\n", pcrx->inHead->len, (void*)pcrx->inHead)); + if (pcrx->inTail && (pcrx->inTail != pcrx->inHead)) { + pbuf_free(pcrx->inTail); + } + pbuf_free(pcrx->inHead); + pcrx->inHead = NULL; + pcrx->inTail = NULL; + } +#if VJ_SUPPORT + vj_uncompress_err(&pppControl[pcrx->pd].vjComp); +#endif /* VJ_SUPPORT */ + + LINK_STATS_INC(link.drop); + snmp_inc_ifindiscards(&pppControl[pcrx->pd].netif); +} + +/** Pass received raw characters to PPPoS to be decoded. This function is + * thread-safe and can be called from a dedicated RX-thread or from a main-loop. + * + * @param pd PPP descriptor index, returned by pppOpen() + * @param data received data + * @param len length of received data + */ +void +pppos_input(int pd, u_char* data, int len) +{ + pppInProc(&pppControl[pd].rx, data, len); +} + +/** + * Process a received octet string. + */ +static void +pppInProc(PPPControlRx *pcrx, u_char *s, int l) +{ + struct pbuf *nextNBuf; + u_char curChar; + u_char escaped; + SYS_ARCH_DECL_PROTECT(lev); + + PPPDEBUG(LOG_DEBUG, ("pppInProc[%d]: got %d bytes\n", pcrx->pd, l)); + while (l-- > 0) { + curChar = *s++; + + SYS_ARCH_PROTECT(lev); + escaped = ESCAPE_P(pcrx->inACCM, curChar); + SYS_ARCH_UNPROTECT(lev); + /* Handle special characters. */ + if (escaped) { + /* Check for escape sequences. */ + /* XXX Note that this does not handle an escaped 0x5d character which + * would appear as an escape character. Since this is an ASCII ']' + * and there is no reason that I know of to escape it, I won't complicate + * the code to handle this case. GLL */ + if (curChar == PPP_ESCAPE) { + pcrx->inEscaped = 1; + /* Check for the flag character. */ + } else if (curChar == PPP_FLAG) { + /* If this is just an extra flag character, ignore it. */ + if (pcrx->inState <= PDADDRESS) { + /* ignore it */; + /* If we haven't received the packet header, drop what has come in. */ + } else if (pcrx->inState < PDDATA) { + PPPDEBUG(LOG_WARNING, + ("pppInProc[%d]: Dropping incomplete packet %d\n", + pcrx->pd, pcrx->inState)); + LINK_STATS_INC(link.lenerr); + pppDrop(pcrx); + /* If the fcs is invalid, drop the packet. */ + } else if (pcrx->inFCS != PPP_GOODFCS) { + PPPDEBUG(LOG_INFO, + ("pppInProc[%d]: Dropping bad fcs 0x%"X16_F" proto=0x%"X16_F"\n", + pcrx->pd, pcrx->inFCS, pcrx->inProtocol)); + /* Note: If you get lots of these, check for UART frame errors or try different baud rate */ + LINK_STATS_INC(link.chkerr); + pppDrop(pcrx); + /* Otherwise it's a good packet so pass it on. */ + } else { + struct pbuf *inp; + /* Trim off the checksum. */ + if(pcrx->inTail->len >= 2) { + pcrx->inTail->len -= 2; + + pcrx->inTail->tot_len = pcrx->inTail->len; + if (pcrx->inTail != pcrx->inHead) { + pbuf_cat(pcrx->inHead, pcrx->inTail); + } + } else { + pcrx->inTail->tot_len = pcrx->inTail->len; + if (pcrx->inTail != pcrx->inHead) { + pbuf_cat(pcrx->inHead, pcrx->inTail); + } + + pbuf_realloc(pcrx->inHead, pcrx->inHead->tot_len - 2); + } + + /* Dispatch the packet thereby consuming it. */ + inp = pcrx->inHead; + /* Packet consumed, release our references. */ + pcrx->inHead = NULL; + pcrx->inTail = NULL; +#if PPP_INPROC_MULTITHREADED + if(tcpip_callback_with_block(pppInput, inp, 0) != ERR_OK) { + PPPDEBUG(LOG_ERR, ("pppInProc[%d]: tcpip_callback() failed, dropping packet\n", pcrx->pd)); + pbuf_free(inp); + LINK_STATS_INC(link.drop); + snmp_inc_ifindiscards(&pppControl[pcrx->pd].netif); + } +#else /* PPP_INPROC_MULTITHREADED */ + pppInput(inp); +#endif /* PPP_INPROC_MULTITHREADED */ + } + + /* Prepare for a new packet. */ + pcrx->inFCS = PPP_INITFCS; + pcrx->inState = PDADDRESS; + pcrx->inEscaped = 0; + /* Other characters are usually control characters that may have + * been inserted by the physical layer so here we just drop them. */ + } else { + PPPDEBUG(LOG_WARNING, + ("pppInProc[%d]: Dropping ACCM char <%d>\n", pcrx->pd, curChar)); + } + /* Process other characters. */ + } else { + /* Unencode escaped characters. */ + if (pcrx->inEscaped) { + pcrx->inEscaped = 0; + curChar ^= PPP_TRANS; + } + + /* Process character relative to current state. */ + switch(pcrx->inState) { + case PDIDLE: /* Idle state - waiting. */ + /* Drop the character if it's not 0xff + * we would have processed a flag character above. */ + if (curChar != PPP_ALLSTATIONS) { + break; + } + + /* Fall through */ + case PDSTART: /* Process start flag. */ + /* Prepare for a new packet. */ + pcrx->inFCS = PPP_INITFCS; + + /* Fall through */ + case PDADDRESS: /* Process address field. */ + if (curChar == PPP_ALLSTATIONS) { + pcrx->inState = PDCONTROL; + break; + } + /* Else assume compressed address and control fields so + * fall through to get the protocol... */ + case PDCONTROL: /* Process control field. */ + /* If we don't get a valid control code, restart. */ + if (curChar == PPP_UI) { + pcrx->inState = PDPROTOCOL1; + break; + } +#if 0 + else { + PPPDEBUG(LOG_WARNING, + ("pppInProc[%d]: Invalid control <%d>\n", pcrx->pd, curChar)); + pcrx->inState = PDSTART; + } +#endif + case PDPROTOCOL1: /* Process protocol field 1. */ + /* If the lower bit is set, this is the end of the protocol + * field. */ + if (curChar & 1) { + pcrx->inProtocol = curChar; + pcrx->inState = PDDATA; + } else { + pcrx->inProtocol = (u_int)curChar << 8; + pcrx->inState = PDPROTOCOL2; + } + break; + case PDPROTOCOL2: /* Process protocol field 2. */ + pcrx->inProtocol |= curChar; + pcrx->inState = PDDATA; + break; + case PDDATA: /* Process data byte. */ + /* Make space to receive processed data. */ + if (pcrx->inTail == NULL || pcrx->inTail->len == PBUF_POOL_BUFSIZE) { + if (pcrx->inTail != NULL) { + pcrx->inTail->tot_len = pcrx->inTail->len; + if (pcrx->inTail != pcrx->inHead) { + pbuf_cat(pcrx->inHead, pcrx->inTail); + /* give up the inTail reference now */ + pcrx->inTail = NULL; + } + } + /* If we haven't started a packet, we need a packet header. */ + nextNBuf = pbuf_alloc(PBUF_RAW, 0, PBUF_POOL); + if (nextNBuf == NULL) { + /* No free buffers. Drop the input packet and let the + * higher layers deal with it. Continue processing + * the received pbuf chain in case a new packet starts. */ + PPPDEBUG(LOG_ERR, ("pppInProc[%d]: NO FREE MBUFS!\n", pcrx->pd)); + LINK_STATS_INC(link.memerr); + pppDrop(pcrx); + pcrx->inState = PDSTART; /* Wait for flag sequence. */ + break; + } + if (pcrx->inHead == NULL) { + struct pppInputHeader *pih = nextNBuf->payload; + + pih->unit = pcrx->pd; + pih->proto = pcrx->inProtocol; + + nextNBuf->len += sizeof(*pih); + + pcrx->inHead = nextNBuf; + } + pcrx->inTail = nextNBuf; + } + /* Load character into buffer. */ + ((u_char*)pcrx->inTail->payload)[pcrx->inTail->len++] = curChar; + break; + } + + /* update the frame check sequence number. */ + pcrx->inFCS = PPP_FCS(pcrx->inFCS, curChar); + } + } /* while (l-- > 0), all bytes processed */ + + avRandomize(); +} +#endif /* PPPOS_SUPPORT */ + +#if PPPOE_SUPPORT +void +pppInProcOverEthernet(int pd, struct pbuf *pb) +{ + struct pppInputHeader *pih; + u16_t inProtocol; + + if(pb->len < sizeof(inProtocol)) { + PPPDEBUG(LOG_ERR, ("pppInProcOverEthernet: too small for protocol field\n")); + goto drop; + } + + inProtocol = (((u8_t *)pb->payload)[0] << 8) | ((u8_t*)pb->payload)[1]; + + /* make room for pppInputHeader - should not fail */ + if (pbuf_header(pb, sizeof(*pih) - sizeof(inProtocol)) != 0) { + PPPDEBUG(LOG_ERR, ("pppInProcOverEthernet: could not allocate room for header\n")); + goto drop; + } + + pih = pb->payload; + + pih->unit = pd; + pih->proto = inProtocol; + + /* Dispatch the packet thereby consuming it. */ + pppInput(pb); + return; + +drop: + LINK_STATS_INC(link.drop); + snmp_inc_ifindiscards(&pppControl[pd].netif); + pbuf_free(pb); + return; +} +#endif /* PPPOE_SUPPORT */ + +#if LWIP_NETIF_STATUS_CALLBACK +/** Set the status callback of a PPP's netif + * + * @param pd The PPP descriptor returned by pppOpen() + * @param status_callback pointer to the status callback function + * + * @see netif_set_status_callback + */ +void +ppp_set_netif_statuscallback(int pd, netif_status_callback_fn status_callback) +{ + netif_set_status_callback(&pppControl[pd].netif, status_callback); +} +#endif /* LWIP_NETIF_STATUS_CALLBACK */ + +#if LWIP_NETIF_LINK_CALLBACK +/** Set the link callback of a PPP's netif + * + * @param pd The PPP descriptor returned by pppOpen() + * @param link_callback pointer to the link callback function + * + * @see netif_set_link_callback + */ +void +ppp_set_netif_linkcallback(int pd, netif_status_callback_fn link_callback) +{ + netif_set_link_callback(&pppControl[pd].netif, link_callback); +} +#endif /* LWIP_NETIF_LINK_CALLBACK */ + +#endif /* PPP_SUPPORT */ diff --git a/lib/drivers/lwip/src/netif/ppp/ppp.h b/lib/drivers/lwip/src/netif/ppp/ppp.h new file mode 100644 index 00000000000..a72ac9576ba --- /dev/null +++ b/lib/drivers/lwip/src/netif/ppp/ppp.h @@ -0,0 +1,483 @@ +/***************************************************************************** +* ppp.h - Network Point to Point Protocol header file. +* +* Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc. +* portions Copyright (c) 1997 Global Election Systems Inc. +* +* The authors hereby grant permission to use, copy, modify, distribute, +* and license this software and its documentation for any purpose, provided +* that existing copyright notices are retained in all copies and that this +* notice and the following disclaimer are included verbatim in any +* distributions. No written agreement, license, or royalty fee is required +* for any of the authorized uses. +* +* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +* IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +****************************************************************************** +* REVISION HISTORY +* +* 03-01-01 Marc Boucher +* Ported to lwIP. +* 97-11-05 Guy Lancaster , Global Election Systems Inc. +* Original derived from BSD codes. +*****************************************************************************/ + +#ifndef PPP_H +#define PPP_H + +#include "lwip/opt.h" + +#if PPP_SUPPORT /* don't build if not configured for use in lwipopts.h */ + +#include "lwip/def.h" +#include "lwip/sio.h" +#include "lwip/stats.h" +#include "lwip/mem.h" +#include "lwip/netif.h" +#include "lwip/sys.h" +#include "lwip/timers.h" + +/** Some defines for code we skip compared to the original pppd. + * These are just here to minimise the use of the ugly "#if 0". */ +#define PPP_ADDITIONAL_CALLBACKS 0 + +/** Some error checks to test for unsupported code */ +#if CBCP_SUPPORT +#error "CBCP is not supported in lwIP PPP" +#endif +#if CCP_SUPPORT +#error "CCP is not supported in lwIP PPP" +#endif + +/* + * pppd.h - PPP daemon global declarations. + * + * Copyright (c) 1989 Carnegie Mellon University. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by Carnegie Mellon University. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + */ +/* + * ppp_defs.h - PPP definitions. + * + * Copyright (c) 1994 The Australian National University. + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation is hereby granted, provided that the above copyright + * notice appears in all copies. This software is provided without any + * warranty, express or implied. The Australian National University + * makes no representations about the suitability of this software for + * any purpose. + * + * IN NO EVENT SHALL THE AUSTRALIAN NATIONAL UNIVERSITY BE LIABLE TO ANY + * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES + * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF + * THE AUSTRALIAN NATIONAL UNIVERSITY HAVE BEEN ADVISED OF THE POSSIBILITY + * OF SUCH DAMAGE. + * + * THE AUSTRALIAN NATIONAL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS + * ON AN "AS IS" BASIS, AND THE AUSTRALIAN NATIONAL UNIVERSITY HAS NO + * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, + * OR MODIFICATIONS. + */ + +#define TIMEOUT(f, a, t) do { sys_untimeout((f), (a)); sys_timeout((t)*1000, (f), (a)); } while(0) +#define UNTIMEOUT(f, a) sys_untimeout((f), (a)) + + +#ifndef __u_char_defined + +/* Type definitions for BSD code. */ +typedef unsigned long u_long; +typedef unsigned int u_int; +typedef unsigned short u_short; +typedef unsigned char u_char; + +#endif + +/* + * Constants and structures defined by the internet system, + * Per RFC 790, September 1981, and numerous additions. + */ + +/* + * The basic PPP frame. + */ +#define PPP_HDRLEN 4 /* octets for standard ppp header */ +#define PPP_FCSLEN 2 /* octets for FCS */ + + +/* + * Significant octet values. + */ +#define PPP_ALLSTATIONS 0xff /* All-Stations broadcast address */ +#define PPP_UI 0x03 /* Unnumbered Information */ +#define PPP_FLAG 0x7e /* Flag Sequence */ +#define PPP_ESCAPE 0x7d /* Asynchronous Control Escape */ +#define PPP_TRANS 0x20 /* Asynchronous transparency modifier */ + +/* + * Protocol field values. + */ +#define PPP_IP 0x21 /* Internet Protocol */ +#define PPP_AT 0x29 /* AppleTalk Protocol */ +#define PPP_VJC_COMP 0x2d /* VJ compressed TCP */ +#define PPP_VJC_UNCOMP 0x2f /* VJ uncompressed TCP */ +#define PPP_COMP 0xfd /* compressed packet */ +#define PPP_IPCP 0x8021 /* IP Control Protocol */ +#define PPP_ATCP 0x8029 /* AppleTalk Control Protocol */ +#define PPP_CCP 0x80fd /* Compression Control Protocol */ +#define PPP_LCP 0xc021 /* Link Control Protocol */ +#define PPP_PAP 0xc023 /* Password Authentication Protocol */ +#define PPP_LQR 0xc025 /* Link Quality Report protocol */ +#define PPP_CHAP 0xc223 /* Cryptographic Handshake Auth. Protocol */ +#define PPP_CBCP 0xc029 /* Callback Control Protocol */ + +/* + * Values for FCS calculations. + */ +#define PPP_INITFCS 0xffff /* Initial FCS value */ +#define PPP_GOODFCS 0xf0b8 /* Good final FCS value */ +#define PPP_FCS(fcs, c) (((fcs) >> 8) ^ fcstab[((fcs) ^ (c)) & 0xff]) + +/* + * Extended asyncmap - allows any character to be escaped. + */ +typedef u_char ext_accm[32]; + +/* + * What to do with network protocol (NP) packets. + */ +enum NPmode { + NPMODE_PASS, /* pass the packet through */ + NPMODE_DROP, /* silently drop the packet */ + NPMODE_ERROR, /* return an error */ + NPMODE_QUEUE /* save it up for later. */ +}; + +/* + * Inline versions of get/put char/short/long. + * Pointer is advanced; we assume that both arguments + * are lvalues and will already be in registers. + * cp MUST be u_char *. + */ +#define GETCHAR(c, cp) { \ + (c) = *(cp)++; \ +} +#define PUTCHAR(c, cp) { \ + *(cp)++ = (u_char) (c); \ +} + + +#define GETSHORT(s, cp) { \ + (s) = *(cp); (cp)++; (s) <<= 8; \ + (s) |= *(cp); (cp)++; \ +} +#define PUTSHORT(s, cp) { \ + *(cp)++ = (u_char) ((s) >> 8); \ + *(cp)++ = (u_char) (s & 0xff); \ +} + +#define GETLONG(l, cp) { \ + (l) = *(cp); (cp)++; (l) <<= 8; \ + (l) |= *(cp); (cp)++; (l) <<= 8; \ + (l) |= *(cp); (cp)++; (l) <<= 8; \ + (l) |= *(cp); (cp)++; \ +} +#define PUTLONG(l, cp) { \ + *(cp)++ = (u_char) ((l) >> 24); \ + *(cp)++ = (u_char) ((l) >> 16); \ + *(cp)++ = (u_char) ((l) >> 8); \ + *(cp)++ = (u_char) (l); \ +} + + +#define INCPTR(n, cp) ((cp) += (n)) +#define DECPTR(n, cp) ((cp) -= (n)) + +#define BCMP(s0, s1, l) memcmp((u_char *)(s0), (u_char *)(s1), (l)) +#define BCOPY(s, d, l) MEMCPY((d), (s), (l)) +#define BZERO(s, n) memset(s, 0, n) + +#if PPP_DEBUG +#define PRINTMSG(m, l) { m[l] = '\0'; LWIP_DEBUGF(LOG_INFO, ("Remote message: %s\n", m)); } +#else /* PPP_DEBUG */ +#define PRINTMSG(m, l) +#endif /* PPP_DEBUG */ + +/* + * MAKEHEADER - Add PPP Header fields to a packet. + */ +#define MAKEHEADER(p, t) { \ + PUTCHAR(PPP_ALLSTATIONS, p); \ + PUTCHAR(PPP_UI, p); \ + PUTSHORT(t, p); } + +/************************* +*** PUBLIC DEFINITIONS *** +*************************/ + +/* Error codes. */ +#define PPPERR_NONE 0 /* No error. */ +#define PPPERR_PARAM -1 /* Invalid parameter. */ +#define PPPERR_OPEN -2 /* Unable to open PPP session. */ +#define PPPERR_DEVICE -3 /* Invalid I/O device for PPP. */ +#define PPPERR_ALLOC -4 /* Unable to allocate resources. */ +#define PPPERR_USER -5 /* User interrupt. */ +#define PPPERR_CONNECT -6 /* Connection lost. */ +#define PPPERR_AUTHFAIL -7 /* Failed authentication challenge. */ +#define PPPERR_PROTOCOL -8 /* Failed to meet protocol. */ + +/* + * PPP IOCTL commands. + */ +/* + * Get the up status - 0 for down, non-zero for up. The argument must + * point to an int. + */ +#define PPPCTLG_UPSTATUS 100 /* Get the up status - 0 down else up */ +#define PPPCTLS_ERRCODE 101 /* Set the error code */ +#define PPPCTLG_ERRCODE 102 /* Get the error code */ +#define PPPCTLG_FD 103 /* Get the fd associated with the ppp */ + +/************************ +*** PUBLIC DATA TYPES *** +************************/ + +/* + * The following struct gives the addresses of procedures to call + * for a particular protocol. + */ +struct protent { + u_short protocol; /* PPP protocol number */ + /* Initialization procedure */ + void (*init) (int unit); + /* Process a received packet */ + void (*input) (int unit, u_char *pkt, int len); + /* Process a received protocol-reject */ + void (*protrej) (int unit); + /* Lower layer has come up */ + void (*lowerup) (int unit); + /* Lower layer has gone down */ + void (*lowerdown) (int unit); + /* Open the protocol */ + void (*open) (int unit); + /* Close the protocol */ + void (*close) (int unit, char *reason); +#if PPP_ADDITIONAL_CALLBACKS + /* Print a packet in readable form */ + int (*printpkt) (u_char *pkt, int len, + void (*printer) (void *, char *, ...), + void *arg); + /* Process a received data packet */ + void (*datainput) (int unit, u_char *pkt, int len); +#endif /* PPP_ADDITIONAL_CALLBACKS */ + int enabled_flag; /* 0 if protocol is disabled */ + char *name; /* Text name of protocol */ +#if PPP_ADDITIONAL_CALLBACKS + /* Check requested options, assign defaults */ + void (*check_options) (u_long); + /* Configure interface for demand-dial */ + int (*demand_conf) (int unit); + /* Say whether to bring up link for this pkt */ + int (*active_pkt) (u_char *pkt, int len); +#endif /* PPP_ADDITIONAL_CALLBACKS */ +}; + +/* + * The following structure records the time in seconds since + * the last NP packet was sent or received. + */ +struct ppp_idle { + u_short xmit_idle; /* seconds since last NP packet sent */ + u_short recv_idle; /* seconds since last NP packet received */ +}; + +struct ppp_settings { + + u_int disable_defaultip : 1; /* Don't use hostname for default IP addrs */ + u_int auth_required : 1; /* Peer is required to authenticate */ + u_int explicit_remote : 1; /* remote_name specified with remotename opt */ + u_int refuse_pap : 1; /* Don't wanna auth. ourselves with PAP */ + u_int refuse_chap : 1; /* Don't wanna auth. ourselves with CHAP */ + u_int usehostname : 1; /* Use hostname for our_name */ + u_int usepeerdns : 1; /* Ask peer for DNS adds */ + + u_short idle_time_limit; /* Shut down link if idle for this long */ + int maxconnect; /* Maximum connect time (seconds) */ + + char user [MAXNAMELEN + 1]; /* Username for PAP */ + char passwd [MAXSECRETLEN + 1]; /* Password for PAP, secret for CHAP */ + char our_name [MAXNAMELEN + 1]; /* Our name for authentication purposes */ + char remote_name[MAXNAMELEN + 1]; /* Peer's name for authentication */ +}; + +struct ppp_addrs { + ip_addr_t our_ipaddr, his_ipaddr, netmask, dns1, dns2; +}; + +/***************************** +*** PUBLIC DATA STRUCTURES *** +*****************************/ + +/* Buffers for outgoing packets. */ +extern u_char outpacket_buf[NUM_PPP][PPP_MRU+PPP_HDRLEN]; + +extern struct ppp_settings ppp_settings; + +extern struct protent *ppp_protocols[]; /* Table of pointers to supported protocols */ + + +/*********************** +*** PUBLIC FUNCTIONS *** +***********************/ + +/* Initialize the PPP subsystem. */ +void pppInit(void); + +/* Warning: Using PPPAUTHTYPE_ANY might have security consequences. + * RFC 1994 says: + * + * In practice, within or associated with each PPP server, there is a + * database which associates "user" names with authentication + * information ("secrets"). It is not anticipated that a particular + * named user would be authenticated by multiple methods. This would + * make the user vulnerable to attacks which negotiate the least secure + * method from among a set (such as PAP rather than CHAP). If the same + * secret was used, PAP would reveal the secret to be used later with + * CHAP. + * + * Instead, for each user name there should be an indication of exactly + * one method used to authenticate that user name. If a user needs to + * make use of different authentication methods under different + * circumstances, then distinct user names SHOULD be employed, each of + * which identifies exactly one authentication method. + * + */ +enum pppAuthType { + PPPAUTHTYPE_NONE, + PPPAUTHTYPE_ANY, + PPPAUTHTYPE_PAP, + PPPAUTHTYPE_CHAP +}; + +void pppSetAuth(enum pppAuthType authType, const char *user, const char *passwd); + +/* + * Open a new PPP connection using the given serial I/O device. + * This initializes the PPP control block but does not + * attempt to negotiate the LCP session. + * Return a new PPP connection descriptor on success or + * an error code (negative) on failure. + */ +int pppOverSerialOpen(sio_fd_t fd, void (*linkStatusCB)(void *ctx, int errCode, void *arg), void *linkStatusCtx); + +/* + * Open a new PPP Over Ethernet (PPPOE) connection. + */ +int pppOverEthernetOpen(struct netif *ethif, const char *service_name, const char *concentrator_name, void (*linkStatusCB)(void *ctx, int errCode, void *arg), void *linkStatusCtx); + +/* for source code compatibility */ +#define pppOpen(fd,cb,ls) pppOverSerialOpen(fd,cb,ls) + +/* + * Close a PPP connection and release the descriptor. + * Any outstanding packets in the queues are dropped. + * Return 0 on success, an error code on failure. + */ +int pppClose(int pd); + +/* + * Indicate to the PPP process that the line has disconnected. + */ +void pppSigHUP(int pd); + +/* + * Get and set parameters for the given connection. + * Return 0 on success, an error code on failure. + */ +int pppIOCtl(int pd, int cmd, void *arg); + +/* + * Return the Maximum Transmission Unit for the given PPP connection. + */ +u_short pppMTU(int pd); + +/* + * Write n characters to a ppp link. + * RETURN: >= 0 Number of characters written, -1 Failed to write to device. + */ +int pppWrite(int pd, const u_char *s, int n); + +void pppInProcOverEthernet(int pd, struct pbuf *pb); + +struct pbuf *pppSingleBuf(struct pbuf *p); + +void pppLinkTerminated(int pd); + +void pppLinkDown(int pd); + +void pppos_input(int pd, u_char* data, int len); + +/* Configure i/f transmit parameters */ +void ppp_send_config (int, u16_t, u32_t, int, int); +/* Set extended transmit ACCM */ +void ppp_set_xaccm (int, ext_accm *); +/* Configure i/f receive parameters */ +void ppp_recv_config (int, int, u32_t, int, int); +/* Find out how long link has been idle */ +int get_idle_time (int, struct ppp_idle *); + +/* Configure VJ TCP header compression */ +int sifvjcomp (int, int, u8_t, u8_t); +/* Configure i/f down (for IP) */ +int sifup (int); +/* Set mode for handling packets for proto */ +int sifnpmode (int u, int proto, enum NPmode mode); +/* Configure i/f down (for IP) */ +int sifdown (int); +/* Configure IP addresses for i/f */ +int sifaddr (int, u32_t, u32_t, u32_t, u32_t, u32_t); +/* Reset i/f IP addresses */ +int cifaddr (int, u32_t, u32_t); +/* Create default route through i/f */ +int sifdefaultroute (int, u32_t, u32_t); +/* Delete default route through i/f */ +int cifdefaultroute (int, u32_t, u32_t); + +/* Get appropriate netmask for address */ +u32_t GetMask (u32_t); + +#if LWIP_NETIF_STATUS_CALLBACK +void ppp_set_netif_statuscallback(int pd, netif_status_callback_fn status_callback); +#endif /* LWIP_NETIF_STATUS_CALLBACK */ +#if LWIP_NETIF_LINK_CALLBACK +void ppp_set_netif_linkcallback(int pd, netif_status_callback_fn link_callback); +#endif /* LWIP_NETIF_LINK_CALLBACK */ + +#endif /* PPP_SUPPORT */ + +#endif /* PPP_H */ diff --git a/lib/drivers/lwip/src/netif/ppp/ppp_oe.c b/lib/drivers/lwip/src/netif/ppp/ppp_oe.c new file mode 100644 index 00000000000..040a0bc93c9 --- /dev/null +++ b/lib/drivers/lwip/src/netif/ppp/ppp_oe.c @@ -0,0 +1,1132 @@ +/***************************************************************************** +* ppp_oe.c - PPP Over Ethernet implementation for lwIP. +* +* Copyright (c) 2006 by Marc Boucher, Services Informatiques (MBSI) inc. +* +* The authors hereby grant permission to use, copy, modify, distribute, +* and license this software and its documentation for any purpose, provided +* that existing copyright notices are retained in all copies and that this +* notice and the following disclaimer are included verbatim in any +* distributions. No written agreement, license, or royalty fee is required +* for any of the authorized uses. +* +* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +* IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +****************************************************************************** +* REVISION HISTORY +* +* 06-01-01 Marc Boucher +* Ported to lwIP. +*****************************************************************************/ + + + +/* based on NetBSD: if_pppoe.c,v 1.64 2006/01/31 23:50:15 martin Exp */ + +/*- + * Copyright (c) 2002 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Martin Husemann . + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "lwip/opt.h" + +#if PPPOE_SUPPORT /* don't build if not configured for use in lwipopts.h */ + +#include "netif/ppp_oe.h" + +#include "ppp.h" +#include "pppdebug.h" + +#include "lwip/timers.h" +#include "lwip/memp.h" + +#include +#include + + +/* Add a 16 bit unsigned value to a buffer pointed to by PTR */ +#define PPPOE_ADD_16(PTR, VAL) \ + *(PTR)++ = (u8_t)((VAL) / 256); \ + *(PTR)++ = (u8_t)((VAL) % 256) + +/* Add a complete PPPoE header to the buffer pointed to by PTR */ +#define PPPOE_ADD_HEADER(PTR, CODE, SESS, LEN) \ + *(PTR)++ = PPPOE_VERTYPE; \ + *(PTR)++ = (CODE); \ + PPPOE_ADD_16(PTR, SESS); \ + PPPOE_ADD_16(PTR, LEN) + +#define PPPOE_DISC_TIMEOUT (5*1000) /* base for quick timeout calculation */ +#define PPPOE_SLOW_RETRY (60*1000) /* persistent retry interval */ +#define PPPOE_DISC_MAXPADI 4 /* retry PADI four times (quickly) */ +#define PPPOE_DISC_MAXPADR 2 /* retry PADR twice */ + +#ifdef PPPOE_SERVER +#error "PPPOE_SERVER is not yet supported under lwIP!" +/* from if_spppsubr.c */ +#define IFF_PASSIVE IFF_LINK0 /* wait passively for connection */ +#endif + +#ifndef PPPOE_ERRORSTRING_LEN +#define PPPOE_ERRORSTRING_LEN 64 +#endif +static char pppoe_error_tmp[PPPOE_ERRORSTRING_LEN]; + + +/* input routines */ +static void pppoe_dispatch_disc_pkt(struct netif *, struct pbuf *); + +/* management routines */ +static int pppoe_do_disconnect(struct pppoe_softc *); +static void pppoe_abort_connect(struct pppoe_softc *); +static void pppoe_clear_softc(struct pppoe_softc *, const char *); + +/* internal timeout handling */ +static void pppoe_timeout(void *); + +/* sending actual protocol controll packets */ +static err_t pppoe_send_padi(struct pppoe_softc *); +static err_t pppoe_send_padr(struct pppoe_softc *); +#ifdef PPPOE_SERVER +static err_t pppoe_send_pado(struct pppoe_softc *); +static err_t pppoe_send_pads(struct pppoe_softc *); +#endif +static err_t pppoe_send_padt(struct netif *, u_int, const u8_t *); + +/* internal helper functions */ +static struct pppoe_softc * pppoe_find_softc_by_session(u_int, struct netif *); +static struct pppoe_softc * pppoe_find_softc_by_hunique(u8_t *, size_t, struct netif *); + +/** linked list of created pppoe interfaces */ +static struct pppoe_softc *pppoe_softc_list; + +err_t +pppoe_create(struct netif *ethif, int pd, void (*linkStatusCB)(int pd, int up), struct pppoe_softc **scptr) +{ + struct pppoe_softc *sc; + + sc = (struct pppoe_softc *)memp_malloc(MEMP_PPPOE_IF); + if (sc == NULL) { + *scptr = NULL; + return ERR_MEM; + } + memset(sc, 0, sizeof(struct pppoe_softc)); + + /* changed to real address later */ + MEMCPY(&sc->sc_dest, ethbroadcast.addr, sizeof(sc->sc_dest)); + + sc->sc_pd = pd; + sc->sc_linkStatusCB = linkStatusCB; + sc->sc_ethif = ethif; + + /* put the new interface at the head of the list */ + sc->next = pppoe_softc_list; + pppoe_softc_list = sc; + + *scptr = sc; + + return ERR_OK; +} + +err_t +pppoe_destroy(struct netif *ifp) +{ + struct pppoe_softc *sc, *prev = NULL; + + for (sc = pppoe_softc_list; sc != NULL; prev = sc, sc = sc->next) { + if (sc->sc_ethif == ifp) { + break; + } + } + + if(!(sc && (sc->sc_ethif == ifp))) { + return ERR_IF; + } + + sys_untimeout(pppoe_timeout, sc); + if (prev == NULL) { + /* remove sc from the head of the list */ + pppoe_softc_list = sc->next; + } else { + /* remove sc from the list */ + prev->next = sc->next; + } + +#ifdef PPPOE_TODO + if (sc->sc_concentrator_name) { + mem_free(sc->sc_concentrator_name); + } + if (sc->sc_service_name) { + mem_free(sc->sc_service_name); + } +#endif /* PPPOE_TODO */ + memp_free(MEMP_PPPOE_IF, sc); + + return ERR_OK; +} + +/* + * Find the interface handling the specified session. + * Note: O(number of sessions open), this is a client-side only, mean + * and lean implementation, so number of open sessions typically should + * be 1. + */ +static struct pppoe_softc * +pppoe_find_softc_by_session(u_int session, struct netif *rcvif) +{ + struct pppoe_softc *sc; + + if (session == 0) { + return NULL; + } + + for (sc = pppoe_softc_list; sc != NULL; sc = sc->next) { + if (sc->sc_state == PPPOE_STATE_SESSION + && sc->sc_session == session) { + if (sc->sc_ethif == rcvif) { + return sc; + } else { + return NULL; + } + } + } + return NULL; +} + +/* Check host unique token passed and return appropriate softc pointer, + * or NULL if token is bogus. */ +static struct pppoe_softc * +pppoe_find_softc_by_hunique(u8_t *token, size_t len, struct netif *rcvif) +{ + struct pppoe_softc *sc, *t; + + if (pppoe_softc_list == NULL) { + return NULL; + } + + if (len != sizeof sc) { + return NULL; + } + MEMCPY(&t, token, len); + + for (sc = pppoe_softc_list; sc != NULL; sc = sc->next) { + if (sc == t) { + break; + } + } + + if (sc == NULL) { + PPPDEBUG(LOG_DEBUG, ("pppoe: alien host unique tag, no session found\n")); + return NULL; + } + + /* should be safe to access *sc now */ + if (sc->sc_state < PPPOE_STATE_PADI_SENT || sc->sc_state >= PPPOE_STATE_SESSION) { + printf("%c%c%"U16_F": host unique tag found, but it belongs to a connection in state %d\n", + sc->sc_ethif->name[0], sc->sc_ethif->name[1], sc->sc_ethif->num, sc->sc_state); + return NULL; + } + if (sc->sc_ethif != rcvif) { + printf("%c%c%"U16_F": wrong interface, not accepting host unique\n", + sc->sc_ethif->name[0], sc->sc_ethif->name[1], sc->sc_ethif->num); + return NULL; + } + return sc; +} + +static void +pppoe_linkstatus_up(struct pppoe_softc *sc) +{ + sc->sc_linkStatusCB(sc->sc_pd, 1); +} + +/* analyze and handle a single received packet while not in session state */ +static void +pppoe_dispatch_disc_pkt(struct netif *netif, struct pbuf *pb) +{ + u16_t tag, len; + u16_t session, plen; + struct pppoe_softc *sc; + const char *err_msg; + char devname[6]; + u8_t *ac_cookie; + u16_t ac_cookie_len; +#ifdef PPPOE_SERVER + u8_t *hunique; + size_t hunique_len; +#endif + struct pppoehdr *ph; + struct pppoetag pt; + int off, err, errortag; + struct eth_hdr *ethhdr; + + pb = pppSingleBuf(pb); + + strcpy(devname, "pppoe"); /* as long as we don't know which instance */ + err_msg = NULL; + errortag = 0; + if (pb->len < sizeof(*ethhdr)) { + goto done; + } + ethhdr = (struct eth_hdr *)pb->payload; + off = sizeof(*ethhdr); + + ac_cookie = NULL; + ac_cookie_len = 0; +#ifdef PPPOE_SERVER + hunique = NULL; + hunique_len = 0; +#endif + session = 0; + if (pb->len - off < PPPOE_HEADERLEN) { + printf("pppoe: packet too short: %d\n", pb->len); + goto done; + } + + ph = (struct pppoehdr *) (ethhdr + 1); + if (ph->vertype != PPPOE_VERTYPE) { + printf("pppoe: unknown version/type packet: 0x%x\n", ph->vertype); + goto done; + } + session = ntohs(ph->session); + plen = ntohs(ph->plen); + off += sizeof(*ph); + + if (plen + off > pb->len) { + printf("pppoe: packet content does not fit: data available = %d, packet size = %u\n", + pb->len - off, plen); + goto done; + } + if(pb->tot_len == pb->len) { + pb->tot_len = pb->len = (u16_t)off + plen; /* ignore trailing garbage */ + } + tag = 0; + len = 0; + sc = NULL; + while (off + sizeof(pt) <= pb->len) { + MEMCPY(&pt, (u8_t*)pb->payload + off, sizeof(pt)); + tag = ntohs(pt.tag); + len = ntohs(pt.len); + if (off + sizeof(pt) + len > pb->len) { + printf("pppoe: tag 0x%x len 0x%x is too long\n", tag, len); + goto done; + } + switch (tag) { + case PPPOE_TAG_EOL: + goto breakbreak; + case PPPOE_TAG_SNAME: + break; /* ignored */ + case PPPOE_TAG_ACNAME: + break; /* ignored */ + case PPPOE_TAG_HUNIQUE: + if (sc != NULL) { + break; + } +#ifdef PPPOE_SERVER + hunique = (u8_t*)pb->payload + off + sizeof(pt); + hunique_len = len; +#endif + sc = pppoe_find_softc_by_hunique((u8_t*)pb->payload + off + sizeof(pt), len, netif); + if (sc != NULL) { + snprintf(devname, sizeof(devname), "%c%c%"U16_F, sc->sc_ethif->name[0], sc->sc_ethif->name[1], sc->sc_ethif->num); + } + break; + case PPPOE_TAG_ACCOOKIE: + if (ac_cookie == NULL) { + ac_cookie = (u8_t*)pb->payload + off + sizeof(pt); + ac_cookie_len = len; + } + break; + case PPPOE_TAG_SNAME_ERR: + err_msg = "SERVICE NAME ERROR"; + errortag = 1; + break; + case PPPOE_TAG_ACSYS_ERR: + err_msg = "AC SYSTEM ERROR"; + errortag = 1; + break; + case PPPOE_TAG_GENERIC_ERR: + err_msg = "GENERIC ERROR"; + errortag = 1; + break; + } + if (err_msg) { + if (errortag && len) { + u16_t error_len = LWIP_MIN(len, sizeof(pppoe_error_tmp)-1); + strncpy(pppoe_error_tmp, (char*)pb->payload + off + sizeof(pt), error_len); + pppoe_error_tmp[error_len-1] = '\0'; + printf("%s: %s: %s\n", devname, err_msg, pppoe_error_tmp); + } else { + printf("%s: %s\n", devname, err_msg); + } + if (errortag) { + goto done; + } + } + off += sizeof(pt) + len; + } + +breakbreak:; + switch (ph->code) { + case PPPOE_CODE_PADI: +#ifdef PPPOE_SERVER + /* + * got service name, concentrator name, and/or host unique. + * ignore if we have no interfaces with IFF_PASSIVE|IFF_UP. + */ + if (LIST_EMPTY(&pppoe_softc_list)) { + goto done; + } + LIST_FOREACH(sc, &pppoe_softc_list, sc_list) { + if (!(sc->sc_sppp.pp_if.if_flags & IFF_UP)) { + continue; + } + if (!(sc->sc_sppp.pp_if.if_flags & IFF_PASSIVE)) { + continue; + } + if (sc->sc_state == PPPOE_STATE_INITIAL) { + break; + } + } + if (sc == NULL) { + /* printf("pppoe: free passive interface is not found\n"); */ + goto done; + } + if (hunique) { + if (sc->sc_hunique) { + mem_free(sc->sc_hunique); + } + sc->sc_hunique = mem_malloc(hunique_len); + if (sc->sc_hunique == NULL) { + goto done; + } + sc->sc_hunique_len = hunique_len; + MEMCPY(sc->sc_hunique, hunique, hunique_len); + } + MEMCPY(&sc->sc_dest, eh->ether_shost, sizeof sc->sc_dest); + sc->sc_state = PPPOE_STATE_PADO_SENT; + pppoe_send_pado(sc); + break; +#endif /* PPPOE_SERVER */ + case PPPOE_CODE_PADR: +#ifdef PPPOE_SERVER + /* + * get sc from ac_cookie if IFF_PASSIVE + */ + if (ac_cookie == NULL) { + /* be quiet if there is not a single pppoe instance */ + printf("pppoe: received PADR but not includes ac_cookie\n"); + goto done; + } + sc = pppoe_find_softc_by_hunique(ac_cookie, ac_cookie_len, netif); + if (sc == NULL) { + /* be quiet if there is not a single pppoe instance */ + if (!LIST_EMPTY(&pppoe_softc_list)) { + printf("pppoe: received PADR but could not find request for it\n"); + } + goto done; + } + if (sc->sc_state != PPPOE_STATE_PADO_SENT) { + printf("%c%c%"U16_F": received unexpected PADR\n", sc->sc_ethif->name[0], sc->sc_ethif->name[1], sc->sc_ethif->num); + goto done; + } + if (hunique) { + if (sc->sc_hunique) { + mem_free(sc->sc_hunique); + } + sc->sc_hunique = mem_malloc(hunique_len); + if (sc->sc_hunique == NULL) { + goto done; + } + sc->sc_hunique_len = hunique_len; + MEMCPY(sc->sc_hunique, hunique, hunique_len); + } + pppoe_send_pads(sc); + sc->sc_state = PPPOE_STATE_SESSION; + pppoe_linkstatus_up(sc); /* notify upper layers */ + break; +#else + /* ignore, we are no access concentrator */ + goto done; +#endif /* PPPOE_SERVER */ + case PPPOE_CODE_PADO: + if (sc == NULL) { + /* be quiet if there is not a single pppoe instance */ + if (pppoe_softc_list != NULL) { + printf("pppoe: received PADO but could not find request for it\n"); + } + goto done; + } + if (sc->sc_state != PPPOE_STATE_PADI_SENT) { + printf("%c%c%"U16_F": received unexpected PADO\n", sc->sc_ethif->name[0], sc->sc_ethif->name[1], sc->sc_ethif->num); + goto done; + } + if (ac_cookie) { + sc->sc_ac_cookie_len = ac_cookie_len; + MEMCPY(sc->sc_ac_cookie, ac_cookie, ac_cookie_len); + } + MEMCPY(&sc->sc_dest, ethhdr->src.addr, sizeof(sc->sc_dest.addr)); + sys_untimeout(pppoe_timeout, sc); + sc->sc_padr_retried = 0; + sc->sc_state = PPPOE_STATE_PADR_SENT; + if ((err = pppoe_send_padr(sc)) != 0) { + PPPDEBUG(LOG_DEBUG, ("pppoe: %c%c%"U16_F": failed to send PADR, error=%d\n", sc->sc_ethif->name[0], sc->sc_ethif->name[1], sc->sc_ethif->num, err)); + } + sys_timeout(PPPOE_DISC_TIMEOUT * (1 + sc->sc_padr_retried), pppoe_timeout, sc); + break; + case PPPOE_CODE_PADS: + if (sc == NULL) { + goto done; + } + sc->sc_session = session; + sys_untimeout(pppoe_timeout, sc); + PPPDEBUG(LOG_DEBUG, ("pppoe: %c%c%"U16_F": session 0x%x connected\n", sc->sc_ethif->name[0], sc->sc_ethif->name[1], sc->sc_ethif->num, session)); + sc->sc_state = PPPOE_STATE_SESSION; + pppoe_linkstatus_up(sc); /* notify upper layers */ + break; + case PPPOE_CODE_PADT: + if (sc == NULL) { + goto done; + } + pppoe_clear_softc(sc, "received PADT"); + break; + default: + if(sc) { + printf("%c%c%"U16_F": unknown code (0x%"X16_F") session = 0x%"X16_F"\n", + sc->sc_ethif->name[0], sc->sc_ethif->name[1], sc->sc_ethif->num, + (u16_t)ph->code, session); + } else { + printf("pppoe: unknown code (0x%"X16_F") session = 0x%"X16_F"\n", (u16_t)ph->code, session); + } + break; + } + +done: + pbuf_free(pb); + return; +} + +void +pppoe_disc_input(struct netif *netif, struct pbuf *p) +{ + /* avoid error messages if there is not a single pppoe instance */ + if (pppoe_softc_list != NULL) { + pppoe_dispatch_disc_pkt(netif, p); + } else { + pbuf_free(p); + } +} + +void +pppoe_data_input(struct netif *netif, struct pbuf *pb) +{ + u16_t session, plen; + struct pppoe_softc *sc; + struct pppoehdr *ph; +#ifdef PPPOE_TERM_UNKNOWN_SESSIONS + u8_t shost[ETHER_ADDR_LEN]; +#endif + +#ifdef PPPOE_TERM_UNKNOWN_SESSIONS + MEMCPY(shost, ((struct eth_hdr *)pb->payload)->src.addr, sizeof(shost)); +#endif + if (pbuf_header(pb, -(int)sizeof(struct eth_hdr)) != 0) { + /* bail out */ + PPPDEBUG(LOG_ERR, ("pppoe_data_input: pbuf_header failed\n")); + LINK_STATS_INC(link.lenerr); + goto drop; + } + + pb = pppSingleBuf (pb); + + if (pb->len <= PPPOE_HEADERLEN) { + printf("pppoe (data): dropping too short packet: %d bytes\n", pb->len); + goto drop; + } + + if (pb->len < sizeof(*ph)) { + printf("pppoe_data_input: could not get PPPoE header\n"); + goto drop; + } + ph = (struct pppoehdr *)pb->payload; + + if (ph->vertype != PPPOE_VERTYPE) { + printf("pppoe (data): unknown version/type packet: 0x%x\n", ph->vertype); + goto drop; + } + if (ph->code != 0) { + goto drop; + } + + session = ntohs(ph->session); + sc = pppoe_find_softc_by_session(session, netif); + if (sc == NULL) { +#ifdef PPPOE_TERM_UNKNOWN_SESSIONS + printf("pppoe: input for unknown session 0x%x, sending PADT\n", session); + pppoe_send_padt(netif, session, shost); +#endif + goto drop; + } + + plen = ntohs(ph->plen); + + if (pbuf_header(pb, -(int)(PPPOE_HEADERLEN)) != 0) { + /* bail out */ + PPPDEBUG(LOG_ERR, ("pppoe_data_input: pbuf_header PPPOE_HEADERLEN failed\n")); + LINK_STATS_INC(link.lenerr); + goto drop; + } + + PPPDEBUG(LOG_DEBUG, ("pppoe_data_input: %c%c%"U16_F": pkthdr.len=%d, pppoe.len=%d\n", + sc->sc_ethif->name[0], sc->sc_ethif->name[1], sc->sc_ethif->num, + pb->len, plen)); + + if (pb->len < plen) { + goto drop; + } + + pppInProcOverEthernet(sc->sc_pd, pb); + + return; + +drop: + pbuf_free(pb); +} + +static err_t +pppoe_output(struct pppoe_softc *sc, struct pbuf *pb) +{ + struct eth_hdr *ethhdr; + u16_t etype; + err_t res; + + if (!sc->sc_ethif) { + pbuf_free(pb); + return ERR_IF; + } + + ethhdr = (struct eth_hdr *)pb->payload; + etype = sc->sc_state == PPPOE_STATE_SESSION ? ETHTYPE_PPPOE : ETHTYPE_PPPOEDISC; + ethhdr->type = htons(etype); + MEMCPY(ethhdr->dest.addr, sc->sc_dest.addr, sizeof(ethhdr->dest.addr)); + MEMCPY(ethhdr->src.addr, ((struct eth_addr *)sc->sc_ethif->hwaddr)->addr, sizeof(ethhdr->src.addr)); + + PPPDEBUG(LOG_DEBUG, ("pppoe: %c%c%"U16_F" (%x) state=%d, session=0x%x output -> %02"X16_F":%02"X16_F":%02"X16_F":%02"X16_F":%02"X16_F":%02"X16_F", len=%d\n", + sc->sc_ethif->name[0], sc->sc_ethif->name[1], sc->sc_ethif->num, etype, + sc->sc_state, sc->sc_session, + sc->sc_dest.addr[0], sc->sc_dest.addr[1], sc->sc_dest.addr[2], sc->sc_dest.addr[3], sc->sc_dest.addr[4], sc->sc_dest.addr[5], + pb->tot_len)); + + res = sc->sc_ethif->linkoutput(sc->sc_ethif, pb); + + pbuf_free(pb); + + return res; +} + +static err_t +pppoe_send_padi(struct pppoe_softc *sc) +{ + struct pbuf *pb; + u8_t *p; + int len; +#ifdef PPPOE_TODO + int l1 = 0, l2 = 0; /* XXX: gcc */ +#endif /* PPPOE_TODO */ + + if (sc->sc_state >PPPOE_STATE_PADI_SENT) { + PPPDEBUG(LOG_ERR, ("ERROR: pppoe_send_padi in state %d", sc->sc_state)); + } + + /* calculate length of frame (excluding ethernet header + pppoe header) */ + len = 2 + 2 + 2 + 2 + sizeof sc; /* service name tag is required, host unique is send too */ +#ifdef PPPOE_TODO + if (sc->sc_service_name != NULL) { + l1 = (int)strlen(sc->sc_service_name); + len += l1; + } + if (sc->sc_concentrator_name != NULL) { + l2 = (int)strlen(sc->sc_concentrator_name); + len += 2 + 2 + l2; + } +#endif /* PPPOE_TODO */ + LWIP_ASSERT("sizeof(struct eth_hdr) + PPPOE_HEADERLEN + len <= 0xffff", + sizeof(struct eth_hdr) + PPPOE_HEADERLEN + len <= 0xffff); + + /* allocate a buffer */ + pb = pbuf_alloc(PBUF_LINK, (u16_t)(sizeof(struct eth_hdr) + PPPOE_HEADERLEN + len), PBUF_RAM); + if (!pb) { + return ERR_MEM; + } + LWIP_ASSERT("pb->tot_len == pb->len", pb->tot_len == pb->len); + + p = (u8_t*)pb->payload + sizeof (struct eth_hdr); + /* fill in pkt */ + PPPOE_ADD_HEADER(p, PPPOE_CODE_PADI, 0, (u16_t)len); + PPPOE_ADD_16(p, PPPOE_TAG_SNAME); +#ifdef PPPOE_TODO + if (sc->sc_service_name != NULL) { + PPPOE_ADD_16(p, l1); + MEMCPY(p, sc->sc_service_name, l1); + p += l1; + } else +#endif /* PPPOE_TODO */ + { + PPPOE_ADD_16(p, 0); + } +#ifdef PPPOE_TODO + if (sc->sc_concentrator_name != NULL) { + PPPOE_ADD_16(p, PPPOE_TAG_ACNAME); + PPPOE_ADD_16(p, l2); + MEMCPY(p, sc->sc_concentrator_name, l2); + p += l2; + } +#endif /* PPPOE_TODO */ + PPPOE_ADD_16(p, PPPOE_TAG_HUNIQUE); + PPPOE_ADD_16(p, sizeof(sc)); + MEMCPY(p, &sc, sizeof sc); + + /* send pkt */ + return pppoe_output(sc, pb); +} + +static void +pppoe_timeout(void *arg) +{ + int retry_wait, err; + struct pppoe_softc *sc = (struct pppoe_softc*)arg; + + PPPDEBUG(LOG_DEBUG, ("pppoe: %c%c%"U16_F": timeout\n", sc->sc_ethif->name[0], sc->sc_ethif->name[1], sc->sc_ethif->num)); + + switch (sc->sc_state) { + case PPPOE_STATE_PADI_SENT: + /* + * We have two basic ways of retrying: + * - Quick retry mode: try a few times in short sequence + * - Slow retry mode: we already had a connection successfully + * established and will try infinitely (without user + * intervention) + * We only enter slow retry mode if IFF_LINK1 (aka autodial) + * is not set. + */ + + /* initialize for quick retry mode */ + retry_wait = PPPOE_DISC_TIMEOUT * (1 + sc->sc_padi_retried); + + sc->sc_padi_retried++; + if (sc->sc_padi_retried >= PPPOE_DISC_MAXPADI) { +#if 0 + if ((sc->sc_sppp.pp_if.if_flags & IFF_LINK1) == 0) { + /* slow retry mode */ + retry_wait = PPPOE_SLOW_RETRY; + } else +#endif + { + pppoe_abort_connect(sc); + return; + } + } + if ((err = pppoe_send_padi(sc)) != 0) { + sc->sc_padi_retried--; + PPPDEBUG(LOG_DEBUG, ("pppoe: %c%c%"U16_F": failed to transmit PADI, error=%d\n", sc->sc_ethif->name[0], sc->sc_ethif->name[1], sc->sc_ethif->num, err)); + } + sys_timeout(retry_wait, pppoe_timeout, sc); + break; + + case PPPOE_STATE_PADR_SENT: + sc->sc_padr_retried++; + if (sc->sc_padr_retried >= PPPOE_DISC_MAXPADR) { + MEMCPY(&sc->sc_dest, ethbroadcast.addr, sizeof(sc->sc_dest)); + sc->sc_state = PPPOE_STATE_PADI_SENT; + sc->sc_padr_retried = 0; + if ((err = pppoe_send_padi(sc)) != 0) { + PPPDEBUG(LOG_DEBUG, ("pppoe: %c%c%"U16_F": failed to send PADI, error=%d\n", sc->sc_ethif->name[0], sc->sc_ethif->name[1], sc->sc_ethif->num, err)); + } + sys_timeout(PPPOE_DISC_TIMEOUT * (1 + sc->sc_padi_retried), pppoe_timeout, sc); + return; + } + if ((err = pppoe_send_padr(sc)) != 0) { + sc->sc_padr_retried--; + PPPDEBUG(LOG_DEBUG, ("pppoe: %c%c%"U16_F": failed to send PADR, error=%d\n", sc->sc_ethif->name[0], sc->sc_ethif->name[1], sc->sc_ethif->num, err)); + } + sys_timeout(PPPOE_DISC_TIMEOUT * (1 + sc->sc_padr_retried), pppoe_timeout, sc); + break; + case PPPOE_STATE_CLOSING: + pppoe_do_disconnect(sc); + break; + default: + return; /* all done, work in peace */ + } +} + +/* Start a connection (i.e. initiate discovery phase) */ +int +pppoe_connect(struct pppoe_softc *sc) +{ + int err; + + if (sc->sc_state != PPPOE_STATE_INITIAL) { + return EBUSY; + } + +#ifdef PPPOE_SERVER + /* wait PADI if IFF_PASSIVE */ + if ((sc->sc_sppp.pp_if.if_flags & IFF_PASSIVE)) { + return 0; + } +#endif + /* save state, in case we fail to send PADI */ + sc->sc_state = PPPOE_STATE_PADI_SENT; + sc->sc_padr_retried = 0; + err = pppoe_send_padi(sc); + PPPDEBUG(LOG_DEBUG, ("pppoe: %c%c%"U16_F": failed to send PADI, error=%d\n", sc->sc_ethif->name[0], sc->sc_ethif->name[1], sc->sc_ethif->num, err)); + sys_timeout(PPPOE_DISC_TIMEOUT, pppoe_timeout, sc); + return err; +} + +/* disconnect */ +void +pppoe_disconnect(struct pppoe_softc *sc) +{ + if (sc->sc_state < PPPOE_STATE_SESSION) { + return; + } + /* + * Do not call pppoe_disconnect here, the upper layer state + * machine gets confused by this. We must return from this + * function and defer disconnecting to the timeout handler. + */ + sc->sc_state = PPPOE_STATE_CLOSING; + sys_timeout(20, pppoe_timeout, sc); +} + +static int +pppoe_do_disconnect(struct pppoe_softc *sc) +{ + int err; + + if (sc->sc_state < PPPOE_STATE_SESSION) { + err = EBUSY; + } else { + PPPDEBUG(LOG_DEBUG, ("pppoe: %c%c%"U16_F": disconnecting\n", sc->sc_ethif->name[0], sc->sc_ethif->name[1], sc->sc_ethif->num)); + err = pppoe_send_padt(sc->sc_ethif, sc->sc_session, (const u8_t *)&sc->sc_dest); + } + + /* cleanup softc */ + sc->sc_state = PPPOE_STATE_INITIAL; + MEMCPY(&sc->sc_dest, ethbroadcast.addr, sizeof(sc->sc_dest)); + sc->sc_ac_cookie_len = 0; +#ifdef PPPOE_SERVER + if (sc->sc_hunique) { + mem_free(sc->sc_hunique); + sc->sc_hunique = NULL; + } + sc->sc_hunique_len = 0; +#endif + sc->sc_session = 0; + + sc->sc_linkStatusCB(sc->sc_pd, 0); /* notify upper layers */ + + return err; +} + +/* Connection attempt aborted */ +static void +pppoe_abort_connect(struct pppoe_softc *sc) +{ + printf("%c%c%"U16_F": could not establish connection\n", sc->sc_ethif->name[0], sc->sc_ethif->name[1], sc->sc_ethif->num); + sc->sc_state = PPPOE_STATE_CLOSING; + + sc->sc_linkStatusCB(sc->sc_pd, 0); /* notify upper layers */ + + /* clear connection state */ + MEMCPY(&sc->sc_dest, ethbroadcast.addr, sizeof(sc->sc_dest)); + sc->sc_state = PPPOE_STATE_INITIAL; +} + +/* Send a PADR packet */ +static err_t +pppoe_send_padr(struct pppoe_softc *sc) +{ + struct pbuf *pb; + u8_t *p; + size_t len; +#ifdef PPPOE_TODO + size_t l1 = 0; /* XXX: gcc */ +#endif /* PPPOE_TODO */ + + if (sc->sc_state != PPPOE_STATE_PADR_SENT) { + return ERR_CONN; + } + + len = 2 + 2 + 2 + 2 + sizeof(sc); /* service name, host unique */ +#ifdef PPPOE_TODO + if (sc->sc_service_name != NULL) { /* service name tag maybe empty */ + l1 = strlen(sc->sc_service_name); + len += l1; + } +#endif /* PPPOE_TODO */ + if (sc->sc_ac_cookie_len > 0) { + len += 2 + 2 + sc->sc_ac_cookie_len; /* AC cookie */ + } + LWIP_ASSERT("sizeof(struct eth_hdr) + PPPOE_HEADERLEN + len <= 0xffff", + sizeof(struct eth_hdr) + PPPOE_HEADERLEN + len <= 0xffff); + pb = pbuf_alloc(PBUF_LINK, (u16_t)(sizeof(struct eth_hdr) + PPPOE_HEADERLEN + len), PBUF_RAM); + if (!pb) { + return ERR_MEM; + } + LWIP_ASSERT("pb->tot_len == pb->len", pb->tot_len == pb->len); + p = (u8_t*)pb->payload + sizeof (struct eth_hdr); + PPPOE_ADD_HEADER(p, PPPOE_CODE_PADR, 0, len); + PPPOE_ADD_16(p, PPPOE_TAG_SNAME); +#ifdef PPPOE_TODO + if (sc->sc_service_name != NULL) { + PPPOE_ADD_16(p, l1); + MEMCPY(p, sc->sc_service_name, l1); + p += l1; + } else +#endif /* PPPOE_TODO */ + { + PPPOE_ADD_16(p, 0); + } + if (sc->sc_ac_cookie_len > 0) { + PPPOE_ADD_16(p, PPPOE_TAG_ACCOOKIE); + PPPOE_ADD_16(p, sc->sc_ac_cookie_len); + MEMCPY(p, sc->sc_ac_cookie, sc->sc_ac_cookie_len); + p += sc->sc_ac_cookie_len; + } + PPPOE_ADD_16(p, PPPOE_TAG_HUNIQUE); + PPPOE_ADD_16(p, sizeof(sc)); + MEMCPY(p, &sc, sizeof sc); + + return pppoe_output(sc, pb); +} + +/* send a PADT packet */ +static err_t +pppoe_send_padt(struct netif *outgoing_if, u_int session, const u8_t *dest) +{ + struct pbuf *pb; + struct eth_hdr *ethhdr; + err_t res; + u8_t *p; + + pb = pbuf_alloc(PBUF_LINK, sizeof(struct eth_hdr) + PPPOE_HEADERLEN, PBUF_RAM); + if (!pb) { + return ERR_MEM; + } + LWIP_ASSERT("pb->tot_len == pb->len", pb->tot_len == pb->len); + + ethhdr = (struct eth_hdr *)pb->payload; + ethhdr->type = PP_HTONS(ETHTYPE_PPPOEDISC); + MEMCPY(ethhdr->dest.addr, dest, sizeof(ethhdr->dest.addr)); + MEMCPY(ethhdr->src.addr, ((struct eth_addr *)outgoing_if->hwaddr)->addr, sizeof(ethhdr->src.addr)); + + p = (u8_t*)(ethhdr + 1); + PPPOE_ADD_HEADER(p, PPPOE_CODE_PADT, session, 0); + + res = outgoing_if->linkoutput(outgoing_if, pb); + + pbuf_free(pb); + + return res; +} + +#ifdef PPPOE_SERVER +static err_t +pppoe_send_pado(struct pppoe_softc *sc) +{ + struct pbuf *pb; + u8_t *p; + size_t len; + + if (sc->sc_state != PPPOE_STATE_PADO_SENT) { + return ERR_CONN; + } + + /* calc length */ + len = 0; + /* include ac_cookie */ + len += 2 + 2 + sizeof(sc); + /* include hunique */ + len += 2 + 2 + sc->sc_hunique_len; + pb = pbuf_alloc(PBUF_LINK, sizeof(struct eth_hdr) + PPPOE_HEADERLEN + len, PBUF_RAM); + if (!pb) { + return ERR_MEM; + } + LWIP_ASSERT("pb->tot_len == pb->len", pb->tot_len == pb->len); + p = (u8_t*)pb->payload + sizeof (struct eth_hdr); + PPPOE_ADD_HEADER(p, PPPOE_CODE_PADO, 0, len); + PPPOE_ADD_16(p, PPPOE_TAG_ACCOOKIE); + PPPOE_ADD_16(p, sizeof(sc)); + MEMCPY(p, &sc, sizeof(sc)); + p += sizeof(sc); + PPPOE_ADD_16(p, PPPOE_TAG_HUNIQUE); + PPPOE_ADD_16(p, sc->sc_hunique_len); + MEMCPY(p, sc->sc_hunique, sc->sc_hunique_len); + return pppoe_output(sc, pb); +} + +static err_t +pppoe_send_pads(struct pppoe_softc *sc) +{ + struct pbuf *pb; + u8_t *p; + size_t len, l1 = 0; /* XXX: gcc */ + + if (sc->sc_state != PPPOE_STATE_PADO_SENT) { + return ERR_CONN; + } + + sc->sc_session = mono_time.tv_sec % 0xff + 1; + /* calc length */ + len = 0; + /* include hunique */ + len += 2 + 2 + 2 + 2 + sc->sc_hunique_len; /* service name, host unique*/ + if (sc->sc_service_name != NULL) { /* service name tag maybe empty */ + l1 = strlen(sc->sc_service_name); + len += l1; + } + pb = pbuf_alloc(PBUF_LINK, sizeof(struct eth_hdr) + PPPOE_HEADERLEN + len, PBUF_RAM); + if (!pb) { + return ERR_MEM; + } + LWIP_ASSERT("pb->tot_len == pb->len", pb->tot_len == pb->len); + p = (u8_t*)pb->payload + sizeof (struct eth_hdr); + PPPOE_ADD_HEADER(p, PPPOE_CODE_PADS, sc->sc_session, len); + PPPOE_ADD_16(p, PPPOE_TAG_SNAME); + if (sc->sc_service_name != NULL) { + PPPOE_ADD_16(p, l1); + MEMCPY(p, sc->sc_service_name, l1); + p += l1; + } else { + PPPOE_ADD_16(p, 0); + } + PPPOE_ADD_16(p, PPPOE_TAG_HUNIQUE); + PPPOE_ADD_16(p, sc->sc_hunique_len); + MEMCPY(p, sc->sc_hunique, sc->sc_hunique_len); + return pppoe_output(sc, pb); +} +#endif + +err_t +pppoe_xmit(struct pppoe_softc *sc, struct pbuf *pb) +{ + u8_t *p; + size_t len; + + /* are we ready to process data yet? */ + if (sc->sc_state < PPPOE_STATE_SESSION) { + /*sppp_flush(&sc->sc_sppp.pp_if);*/ + pbuf_free(pb); + return ERR_CONN; + } + + len = pb->tot_len; + + /* make room for Ethernet header - should not fail */ + if (pbuf_header(pb, sizeof(struct eth_hdr) + PPPOE_HEADERLEN) != 0) { + /* bail out */ + PPPDEBUG(LOG_ERR, ("pppoe: %c%c%"U16_F": pppoe_xmit: could not allocate room for header\n", sc->sc_ethif->name[0], sc->sc_ethif->name[1], sc->sc_ethif->num)); + LINK_STATS_INC(link.lenerr); + pbuf_free(pb); + return ERR_BUF; + } + + p = (u8_t*)pb->payload + sizeof(struct eth_hdr); + PPPOE_ADD_HEADER(p, 0, sc->sc_session, len); + + return pppoe_output(sc, pb); +} + +#if 0 /*def PFIL_HOOKS*/ +static int +pppoe_ifattach_hook(void *arg, struct pbuf **mp, struct netif *ifp, int dir) +{ + struct pppoe_softc *sc; + int s; + + if (mp != (struct pbuf **)PFIL_IFNET_DETACH) { + return 0; + } + + LIST_FOREACH(sc, &pppoe_softc_list, sc_list) { + if (sc->sc_ethif != ifp) { + continue; + } + if (sc->sc_sppp.pp_if.if_flags & IFF_UP) { + sc->sc_sppp.pp_if.if_flags &= ~(IFF_UP|IFF_RUNNING); + printf("%c%c%"U16_F": ethernet interface detached, going down\n", + sc->sc_ethif->name[0], sc->sc_ethif->name[1], sc->sc_ethif->num); + } + sc->sc_ethif = NULL; + pppoe_clear_softc(sc, "ethernet interface detached"); + } + + return 0; +} +#endif + +static void +pppoe_clear_softc(struct pppoe_softc *sc, const char *message) +{ + LWIP_UNUSED_ARG(message); + + /* stop timer */ + sys_untimeout(pppoe_timeout, sc); + PPPDEBUG(LOG_DEBUG, ("pppoe: %c%c%"U16_F": session 0x%x terminated, %s\n", sc->sc_ethif->name[0], sc->sc_ethif->name[1], sc->sc_ethif->num, sc->sc_session, message)); + + /* fix our state */ + sc->sc_state = PPPOE_STATE_INITIAL; + + /* notify upper layers */ + sc->sc_linkStatusCB(sc->sc_pd, 0); + + /* clean up softc */ + MEMCPY(&sc->sc_dest, ethbroadcast.addr, sizeof(sc->sc_dest)); + sc->sc_ac_cookie_len = 0; + sc->sc_session = 0; +} + +#endif /* PPPOE_SUPPORT */ + diff --git a/lib/drivers/lwip/src/netif/ppp/pppdebug.h b/lib/drivers/lwip/src/netif/ppp/pppdebug.h new file mode 100644 index 00000000000..81349971db6 --- /dev/null +++ b/lib/drivers/lwip/src/netif/ppp/pppdebug.h @@ -0,0 +1,73 @@ +/***************************************************************************** +* pppdebug.h - System debugging utilities. +* +* Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc. +* portions Copyright (c) 1998 Global Election Systems Inc. +* portions Copyright (c) 2001 by Cognizant Pty Ltd. +* +* The authors hereby grant permission to use, copy, modify, distribute, +* and license this software and its documentation for any purpose, provided +* that existing copyright notices are retained in all copies and that this +* notice and the following disclaimer are included verbatim in any +* distributions. No written agreement, license, or royalty fee is required +* for any of the authorized uses. +* +* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +* IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +****************************************************************************** +* REVISION HISTORY (please don't use tabs!) +* +* 03-01-01 Marc Boucher +* Ported to lwIP. +* 98-07-29 Guy Lancaster , Global Election Systems Inc. +* Original. +* +***************************************************************************** +*/ +#ifndef PPPDEBUG_H +#define PPPDEBUG_H + +/* Trace levels. */ +#define LOG_CRITICAL (PPP_DEBUG | LWIP_DBG_LEVEL_SEVERE) +#define LOG_ERR (PPP_DEBUG | LWIP_DBG_LEVEL_SEVERE) +#define LOG_NOTICE (PPP_DEBUG | LWIP_DBG_LEVEL_WARNING) +#define LOG_WARNING (PPP_DEBUG | LWIP_DBG_LEVEL_WARNING) +#define LOG_INFO (PPP_DEBUG) +#define LOG_DETAIL (PPP_DEBUG) +#define LOG_DEBUG (PPP_DEBUG) + + +#define TRACELCP PPP_DEBUG + +#if PPP_DEBUG + +#define AUTHDEBUG(a, b) LWIP_DEBUGF(a, b) +#define IPCPDEBUG(a, b) LWIP_DEBUGF(a, b) +#define UPAPDEBUG(a, b) LWIP_DEBUGF(a, b) +#define LCPDEBUG(a, b) LWIP_DEBUGF(a, b) +#define FSMDEBUG(a, b) LWIP_DEBUGF(a, b) +#define CHAPDEBUG(a, b) LWIP_DEBUGF(a, b) +#define PPPDEBUG(a, b) LWIP_DEBUGF(a, b) + +#else /* PPP_DEBUG */ + +#define AUTHDEBUG(a, b) +#define IPCPDEBUG(a, b) +#define UPAPDEBUG(a, b) +#define LCPDEBUG(a, b) +#define FSMDEBUG(a, b) +#define CHAPDEBUG(a, b) +#define PPPDEBUG(a, b) + +#endif /* PPP_DEBUG */ + +#endif /* PPPDEBUG_H */ diff --git a/lib/drivers/lwip/src/netif/ppp/randm.c b/lib/drivers/lwip/src/netif/ppp/randm.c new file mode 100644 index 00000000000..2f35caf6a00 --- /dev/null +++ b/lib/drivers/lwip/src/netif/ppp/randm.c @@ -0,0 +1,249 @@ +/***************************************************************************** +* randm.c - Random number generator program file. +* +* Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc. +* Copyright (c) 1998 by Global Election Systems Inc. +* +* The authors hereby grant permission to use, copy, modify, distribute, +* and license this software and its documentation for any purpose, provided +* that existing copyright notices are retained in all copies and that this +* notice and the following disclaimer are included verbatim in any +* distributions. No written agreement, license, or royalty fee is required +* for any of the authorized uses. +* +* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +* IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +****************************************************************************** +* REVISION HISTORY +* +* 03-01-01 Marc Boucher +* Ported to lwIP. +* 98-06-03 Guy Lancaster , Global Election Systems Inc. +* Extracted from avos. +*****************************************************************************/ + +#include "lwip/opt.h" + +#if PPP_SUPPORT /* don't build if not configured for use in lwipopts.h */ + +#include "md5.h" +#include "randm.h" + +#include "ppp.h" +#include "pppdebug.h" + +#include + +#if MD5_SUPPORT /* this module depends on MD5 */ +#define RANDPOOLSZ 16 /* Bytes stored in the pool of randomness. */ + +/*****************************/ +/*** LOCAL DATA STRUCTURES ***/ +/*****************************/ +static char randPool[RANDPOOLSZ]; /* Pool of randomness. */ +static long randCount = 0; /* Pseudo-random incrementer */ + + +/***********************************/ +/*** PUBLIC FUNCTION DEFINITIONS ***/ +/***********************************/ +/* + * Initialize the random number generator. + * + * Since this is to be called on power up, we don't have much + * system randomess to work with. Here all we use is the + * real-time clock. We'll accumulate more randomness as soon + * as things start happening. + */ +void +avRandomInit() +{ + avChurnRand(NULL, 0); +} + +/* + * Churn the randomness pool on a random event. Call this early and often + * on random and semi-random system events to build randomness in time for + * usage. For randomly timed events, pass a null pointer and a zero length + * and this will use the system timer and other sources to add randomness. + * If new random data is available, pass a pointer to that and it will be + * included. + * + * Ref: Applied Cryptography 2nd Ed. by Bruce Schneier p. 427 + */ +void +avChurnRand(char *randData, u32_t randLen) +{ + MD5_CTX md5; + + /* LWIP_DEBUGF(LOG_INFO, ("churnRand: %u@%P\n", randLen, randData)); */ + MD5Init(&md5); + MD5Update(&md5, (u_char *)randPool, sizeof(randPool)); + if (randData) { + MD5Update(&md5, (u_char *)randData, randLen); + } else { + struct { + /* INCLUDE fields for any system sources of randomness */ + char foobar; + } sysData; + + /* Load sysData fields here. */ + MD5Update(&md5, (u_char *)&sysData, sizeof(sysData)); + } + MD5Final((u_char *)randPool, &md5); +/* LWIP_DEBUGF(LOG_INFO, ("churnRand: -> 0\n")); */ +} + +/* + * Use the random pool to generate random data. This degrades to pseudo + * random when used faster than randomness is supplied using churnRand(). + * Note: It's important that there be sufficient randomness in randPool + * before this is called for otherwise the range of the result may be + * narrow enough to make a search feasible. + * + * Ref: Applied Cryptography 2nd Ed. by Bruce Schneier p. 427 + * + * XXX Why does he not just call churnRand() for each block? Probably + * so that you don't ever publish the seed which could possibly help + * predict future values. + * XXX Why don't we preserve md5 between blocks and just update it with + * randCount each time? Probably there is a weakness but I wish that + * it was documented. + */ +void +avGenRand(char *buf, u32_t bufLen) +{ + MD5_CTX md5; + u_char tmp[16]; + u32_t n; + + while (bufLen > 0) { + n = LWIP_MIN(bufLen, RANDPOOLSZ); + MD5Init(&md5); + MD5Update(&md5, (u_char *)randPool, sizeof(randPool)); + MD5Update(&md5, (u_char *)&randCount, sizeof(randCount)); + MD5Final(tmp, &md5); + randCount++; + MEMCPY(buf, tmp, n); + buf += n; + bufLen -= n; + } +} + +/* + * Return a new random number. + */ +u32_t +avRandom() +{ + u32_t newRand; + + avGenRand((char *)&newRand, sizeof(newRand)); + + return newRand; +} + +#else /* MD5_SUPPORT */ + +/*****************************/ +/*** LOCAL DATA STRUCTURES ***/ +/*****************************/ +static int avRandomized = 0; /* Set when truely randomized. */ +static u32_t avRandomSeed = 0; /* Seed used for random number generation. */ + + +/***********************************/ +/*** PUBLIC FUNCTION DEFINITIONS ***/ +/***********************************/ +/* + * Initialize the random number generator. + * + * Here we attempt to compute a random number seed but even if + * it isn't random, we'll randomize it later. + * + * The current method uses the fields from the real time clock, + * the idle process counter, the millisecond counter, and the + * hardware timer tick counter. When this is invoked + * in startup(), then the idle counter and timer values may + * repeat after each boot and the real time clock may not be + * operational. Thus we call it again on the first random + * event. + */ +void +avRandomInit() +{ +#if 0 + /* Get a pointer into the last 4 bytes of clockBuf. */ + u32_t *lptr1 = (u32_t *)((char *)&clockBuf[3]); + + /* + * Initialize our seed using the real-time clock, the idle + * counter, the millisecond timer, and the hardware timer + * tick counter. The real-time clock and the hardware + * tick counter are the best sources of randomness but + * since the tick counter is only 16 bit (and truncated + * at that), the idle counter and millisecond timer + * (which may be small values) are added to help + * randomize the lower 16 bits of the seed. + */ + readClk(); + avRandomSeed += *(u32_t *)clockBuf + *lptr1 + OSIdleCtr + + ppp_mtime() + ((u32_t)TM1 << 16) + TM1; +#else + avRandomSeed += sys_jiffies(); /* XXX */ +#endif + + /* Initialize the Borland random number generator. */ + srand((unsigned)avRandomSeed); +} + +/* + * Randomize our random seed value. Here we use the fact that + * this function is called at *truely random* times by the polling + * and network functions. Here we only get 16 bits of new random + * value but we use the previous value to randomize the other 16 + * bits. + */ +void +avRandomize(void) +{ + static u32_t last_jiffies; + + if (!avRandomized) { + avRandomized = !0; + avRandomInit(); + /* The initialization function also updates the seed. */ + } else { + /* avRandomSeed += (avRandomSeed << 16) + TM1; */ + avRandomSeed += (sys_jiffies() - last_jiffies); /* XXX */ + } + last_jiffies = sys_jiffies(); +} + +/* + * Return a new random number. + * Here we use the Borland rand() function to supply a pseudo random + * number which we make truely random by combining it with our own + * seed which is randomized by truely random events. + * Thus the numbers will be truely random unless there have been no + * operator or network events in which case it will be pseudo random + * seeded by the real time clock. + */ +u32_t +avRandom() +{ + return ((((u32_t)rand() << 16) + rand()) + avRandomSeed); +} + +#endif /* MD5_SUPPORT */ + +#endif /* PPP_SUPPORT */ diff --git a/lib/drivers/lwip/src/netif/ppp/randm.h b/lib/drivers/lwip/src/netif/ppp/randm.h new file mode 100644 index 00000000000..a0984b0202e --- /dev/null +++ b/lib/drivers/lwip/src/netif/ppp/randm.h @@ -0,0 +1,81 @@ +/***************************************************************************** +* randm.h - Random number generator header file. +* +* Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc. +* Copyright (c) 1998 Global Election Systems Inc. +* +* The authors hereby grant permission to use, copy, modify, distribute, +* and license this software and its documentation for any purpose, provided +* that existing copyright notices are retained in all copies and that this +* notice and the following disclaimer are included verbatim in any +* distributions. No written agreement, license, or royalty fee is required +* for any of the authorized uses. +* +* THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS *AS IS* AND ANY EXPRESS OR +* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +* IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +****************************************************************************** +* REVISION HISTORY +* +* 03-01-01 Marc Boucher +* Ported to lwIP. +* 98-05-29 Guy Lancaster , Global Election Systems Inc. +* Extracted from avos. +*****************************************************************************/ + +#ifndef RANDM_H +#define RANDM_H + +/*********************** +*** PUBLIC FUNCTIONS *** +***********************/ +/* + * Initialize the random number generator. + */ +void avRandomInit(void); + +/* + * Churn the randomness pool on a random event. Call this early and often + * on random and semi-random system events to build randomness in time for + * usage. For randomly timed events, pass a null pointer and a zero length + * and this will use the system timer and other sources to add randomness. + * If new random data is available, pass a pointer to that and it will be + * included. + */ +void avChurnRand(char *randData, u32_t randLen); + +/* + * Randomize our random seed value. To be called for truely random events + * such as user operations and network traffic. + */ +#if MD5_SUPPORT +#define avRandomize() avChurnRand(NULL, 0) +#else /* MD5_SUPPORT */ +void avRandomize(void); +#endif /* MD5_SUPPORT */ + +/* + * Use the random pool to generate random data. This degrades to pseudo + * random when used faster than randomness is supplied using churnRand(). + * Thus it's important to make sure that the results of this are not + * published directly because one could predict the next result to at + * least some degree. Also, it's important to get a good seed before + * the first use. + */ +void avGenRand(char *buf, u32_t bufLen); + +/* + * Return a new random number. + */ +u32_t avRandom(void); + + +#endif /* RANDM_H */ diff --git a/lib/drivers/lwip/src/netif/ppp/vj.c b/lib/drivers/lwip/src/netif/ppp/vj.c new file mode 100644 index 00000000000..b7f2d54c627 --- /dev/null +++ b/lib/drivers/lwip/src/netif/ppp/vj.c @@ -0,0 +1,652 @@ +/* + * Routines to compress and uncompess tcp packets (for transmission + * over low speed serial lines. + * + * Copyright (c) 1989 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by the University of California, Berkeley. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * Van Jacobson (van@helios.ee.lbl.gov), Dec 31, 1989: + * Initial distribution. + * + * Modified June 1993 by Paul Mackerras, paulus@cs.anu.edu.au, + * so that the entire packet being decompressed doesn't have + * to be in contiguous memory (just the compressed header). + * + * Modified March 1998 by Guy Lancaster, glanca@gesn.com, + * for a 16 bit processor. + */ + +#include "lwip/opt.h" + +#if PPP_SUPPORT /* don't build if not configured for use in lwipopts.h */ + +#include "ppp.h" +#include "pppdebug.h" + +#include "vj.h" + +#include + +#if VJ_SUPPORT + +#if LINK_STATS +#define INCR(counter) ++comp->stats.counter +#else +#define INCR(counter) +#endif + +void +vj_compress_init(struct vjcompress *comp) +{ + register u_char i; + register struct cstate *tstate = comp->tstate; + +#if MAX_SLOTS == 0 + memset((char *)comp, 0, sizeof(*comp)); +#endif + comp->maxSlotIndex = MAX_SLOTS - 1; + comp->compressSlot = 0; /* Disable slot ID compression by default. */ + for (i = MAX_SLOTS - 1; i > 0; --i) { + tstate[i].cs_id = i; + tstate[i].cs_next = &tstate[i - 1]; + } + tstate[0].cs_next = &tstate[MAX_SLOTS - 1]; + tstate[0].cs_id = 0; + comp->last_cs = &tstate[0]; + comp->last_recv = 255; + comp->last_xmit = 255; + comp->flags = VJF_TOSS; +} + + +/* ENCODE encodes a number that is known to be non-zero. ENCODEZ + * checks for zero (since zero has to be encoded in the long, 3 byte + * form). + */ +#define ENCODE(n) { \ + if ((u_short)(n) >= 256) { \ + *cp++ = 0; \ + cp[1] = (u_char)(n); \ + cp[0] = (u_char)((n) >> 8); \ + cp += 2; \ + } else { \ + *cp++ = (u_char)(n); \ + } \ +} +#define ENCODEZ(n) { \ + if ((u_short)(n) >= 256 || (u_short)(n) == 0) { \ + *cp++ = 0; \ + cp[1] = (u_char)(n); \ + cp[0] = (u_char)((n) >> 8); \ + cp += 2; \ + } else { \ + *cp++ = (u_char)(n); \ + } \ +} + +#define DECODEL(f) { \ + if (*cp == 0) {\ + u32_t tmp = ntohl(f) + ((cp[1] << 8) | cp[2]); \ + (f) = htonl(tmp); \ + cp += 3; \ + } else { \ + u32_t tmp = ntohl(f) + (u32_t)*cp++; \ + (f) = htonl(tmp); \ + } \ +} + +#define DECODES(f) { \ + if (*cp == 0) {\ + u_short tmp = ntohs(f) + (((u_short)cp[1] << 8) | cp[2]); \ + (f) = htons(tmp); \ + cp += 3; \ + } else { \ + u_short tmp = ntohs(f) + (u_short)*cp++; \ + (f) = htons(tmp); \ + } \ +} + +#define DECODEU(f) { \ + if (*cp == 0) {\ + (f) = htons(((u_short)cp[1] << 8) | cp[2]); \ + cp += 3; \ + } else { \ + (f) = htons((u_short)*cp++); \ + } \ +} + +/* + * vj_compress_tcp - Attempt to do Van Jacobson header compression on a + * packet. This assumes that nb and comp are not null and that the first + * buffer of the chain contains a valid IP header. + * Return the VJ type code indicating whether or not the packet was + * compressed. + */ +u_int +vj_compress_tcp(struct vjcompress *comp, struct pbuf *pb) +{ + register struct ip_hdr *ip = (struct ip_hdr *)pb->payload; + register struct cstate *cs = comp->last_cs->cs_next; + register u_short hlen = IPH_HL(ip); + register struct tcp_hdr *oth; + register struct tcp_hdr *th; + register u_short deltaS, deltaA; + register u_long deltaL; + register u_int changes = 0; + u_char new_seq[16]; + register u_char *cp = new_seq; + + /* + * Check that the packet is IP proto TCP. + */ + if (IPH_PROTO(ip) != IP_PROTO_TCP) { + return (TYPE_IP); + } + + /* + * Bail if this is an IP fragment or if the TCP packet isn't + * `compressible' (i.e., ACK isn't set or some other control bit is + * set). + */ + if ((IPH_OFFSET(ip) & PP_HTONS(0x3fff)) || pb->tot_len < 40) { + return (TYPE_IP); + } + th = (struct tcp_hdr *)&((long *)ip)[hlen]; + if ((TCPH_FLAGS(th) & (TCP_SYN|TCP_FIN|TCP_RST|TCP_ACK)) != TCP_ACK) { + return (TYPE_IP); + } + /* + * Packet is compressible -- we're going to send either a + * COMPRESSED_TCP or UNCOMPRESSED_TCP packet. Either way we need + * to locate (or create) the connection state. Special case the + * most recently used connection since it's most likely to be used + * again & we don't have to do any reordering if it's used. + */ + INCR(vjs_packets); + if (!ip_addr_cmp(&ip->src, &cs->cs_ip.src) + || !ip_addr_cmp(&ip->dest, &cs->cs_ip.dest) + || *(long *)th != ((long *)&cs->cs_ip)[IPH_HL(&cs->cs_ip)]) { + /* + * Wasn't the first -- search for it. + * + * States are kept in a circularly linked list with + * last_cs pointing to the end of the list. The + * list is kept in lru order by moving a state to the + * head of the list whenever it is referenced. Since + * the list is short and, empirically, the connection + * we want is almost always near the front, we locate + * states via linear search. If we don't find a state + * for the datagram, the oldest state is (re-)used. + */ + register struct cstate *lcs; + register struct cstate *lastcs = comp->last_cs; + + do { + lcs = cs; cs = cs->cs_next; + INCR(vjs_searches); + if (ip_addr_cmp(&ip->src, &cs->cs_ip.src) + && ip_addr_cmp(&ip->dest, &cs->cs_ip.dest) + && *(long *)th == ((long *)&cs->cs_ip)[IPH_HL(&cs->cs_ip)]) { + goto found; + } + } while (cs != lastcs); + + /* + * Didn't find it -- re-use oldest cstate. Send an + * uncompressed packet that tells the other side what + * connection number we're using for this conversation. + * Note that since the state list is circular, the oldest + * state points to the newest and we only need to set + * last_cs to update the lru linkage. + */ + INCR(vjs_misses); + comp->last_cs = lcs; + hlen += TCPH_OFFSET(th); + hlen <<= 2; + /* Check that the IP/TCP headers are contained in the first buffer. */ + if (hlen > pb->len) { + return (TYPE_IP); + } + goto uncompressed; + + found: + /* + * Found it -- move to the front on the connection list. + */ + if (cs == lastcs) { + comp->last_cs = lcs; + } else { + lcs->cs_next = cs->cs_next; + cs->cs_next = lastcs->cs_next; + lastcs->cs_next = cs; + } + } + + oth = (struct tcp_hdr *)&((long *)&cs->cs_ip)[hlen]; + deltaS = hlen; + hlen += TCPH_OFFSET(th); + hlen <<= 2; + /* Check that the IP/TCP headers are contained in the first buffer. */ + if (hlen > pb->len) { + PPPDEBUG(LOG_INFO, ("vj_compress_tcp: header len %d spans buffers\n", hlen)); + return (TYPE_IP); + } + + /* + * Make sure that only what we expect to change changed. The first + * line of the `if' checks the IP protocol version, header length & + * type of service. The 2nd line checks the "Don't fragment" bit. + * The 3rd line checks the time-to-live and protocol (the protocol + * check is unnecessary but costless). The 4th line checks the TCP + * header length. The 5th line checks IP options, if any. The 6th + * line checks TCP options, if any. If any of these things are + * different between the previous & current datagram, we send the + * current datagram `uncompressed'. + */ + if (((u_short *)ip)[0] != ((u_short *)&cs->cs_ip)[0] + || ((u_short *)ip)[3] != ((u_short *)&cs->cs_ip)[3] + || ((u_short *)ip)[4] != ((u_short *)&cs->cs_ip)[4] + || TCPH_OFFSET(th) != TCPH_OFFSET(oth) + || (deltaS > 5 && BCMP(ip + 1, &cs->cs_ip + 1, (deltaS - 5) << 2)) + || (TCPH_OFFSET(th) > 5 && BCMP(th + 1, oth + 1, (TCPH_OFFSET(th) - 5) << 2))) { + goto uncompressed; + } + + /* + * Figure out which of the changing fields changed. The + * receiver expects changes in the order: urgent, window, + * ack, seq (the order minimizes the number of temporaries + * needed in this section of code). + */ + if (TCPH_FLAGS(th) & TCP_URG) { + deltaS = ntohs(th->urgp); + ENCODEZ(deltaS); + changes |= NEW_U; + } else if (th->urgp != oth->urgp) { + /* argh! URG not set but urp changed -- a sensible + * implementation should never do this but RFC793 + * doesn't prohibit the change so we have to deal + * with it. */ + goto uncompressed; + } + + if ((deltaS = (u_short)(ntohs(th->wnd) - ntohs(oth->wnd))) != 0) { + ENCODE(deltaS); + changes |= NEW_W; + } + + if ((deltaL = ntohl(th->ackno) - ntohl(oth->ackno)) != 0) { + if (deltaL > 0xffff) { + goto uncompressed; + } + deltaA = (u_short)deltaL; + ENCODE(deltaA); + changes |= NEW_A; + } + + if ((deltaL = ntohl(th->seqno) - ntohl(oth->seqno)) != 0) { + if (deltaL > 0xffff) { + goto uncompressed; + } + deltaS = (u_short)deltaL; + ENCODE(deltaS); + changes |= NEW_S; + } + + switch(changes) { + case 0: + /* + * Nothing changed. If this packet contains data and the + * last one didn't, this is probably a data packet following + * an ack (normal on an interactive connection) and we send + * it compressed. Otherwise it's probably a retransmit, + * retransmitted ack or window probe. Send it uncompressed + * in case the other side missed the compressed version. + */ + if (IPH_LEN(ip) != IPH_LEN(&cs->cs_ip) && + ntohs(IPH_LEN(&cs->cs_ip)) == hlen) { + break; + } + + /* (fall through) */ + + case SPECIAL_I: + case SPECIAL_D: + /* + * actual changes match one of our special case encodings -- + * send packet uncompressed. + */ + goto uncompressed; + + case NEW_S|NEW_A: + if (deltaS == deltaA && deltaS == ntohs(IPH_LEN(&cs->cs_ip)) - hlen) { + /* special case for echoed terminal traffic */ + changes = SPECIAL_I; + cp = new_seq; + } + break; + + case NEW_S: + if (deltaS == ntohs(IPH_LEN(&cs->cs_ip)) - hlen) { + /* special case for data xfer */ + changes = SPECIAL_D; + cp = new_seq; + } + break; + } + + deltaS = (u_short)(ntohs(IPH_ID(ip)) - ntohs(IPH_ID(&cs->cs_ip))); + if (deltaS != 1) { + ENCODEZ(deltaS); + changes |= NEW_I; + } + if (TCPH_FLAGS(th) & TCP_PSH) { + changes |= TCP_PUSH_BIT; + } + /* + * Grab the cksum before we overwrite it below. Then update our + * state with this packet's header. + */ + deltaA = ntohs(th->chksum); + BCOPY(ip, &cs->cs_ip, hlen); + + /* + * We want to use the original packet as our compressed packet. + * (cp - new_seq) is the number of bytes we need for compressed + * sequence numbers. In addition we need one byte for the change + * mask, one for the connection id and two for the tcp checksum. + * So, (cp - new_seq) + 4 bytes of header are needed. hlen is how + * many bytes of the original packet to toss so subtract the two to + * get the new packet size. + */ + deltaS = (u_short)(cp - new_seq); + if (!comp->compressSlot || comp->last_xmit != cs->cs_id) { + comp->last_xmit = cs->cs_id; + hlen -= deltaS + 4; + if(pbuf_header(pb, -hlen)){ + /* Can we cope with this failing? Just assert for now */ + LWIP_ASSERT("pbuf_header failed\n", 0); + } + cp = (u_char *)pb->payload; + *cp++ = (u_char)(changes | NEW_C); + *cp++ = cs->cs_id; + } else { + hlen -= deltaS + 3; + if(pbuf_header(pb, -hlen)) { + /* Can we cope with this failing? Just assert for now */ + LWIP_ASSERT("pbuf_header failed\n", 0); + } + cp = (u_char *)pb->payload; + *cp++ = (u_char)changes; + } + *cp++ = (u_char)(deltaA >> 8); + *cp++ = (u_char)deltaA; + BCOPY(new_seq, cp, deltaS); + INCR(vjs_compressed); + return (TYPE_COMPRESSED_TCP); + + /* + * Update connection state cs & send uncompressed packet (that is, + * a regular ip/tcp packet but with the 'conversation id' we hope + * to use on future compressed packets in the protocol field). + */ +uncompressed: + BCOPY(ip, &cs->cs_ip, hlen); + IPH_PROTO_SET(ip, cs->cs_id); + comp->last_xmit = cs->cs_id; + return (TYPE_UNCOMPRESSED_TCP); +} + +/* + * Called when we may have missed a packet. + */ +void +vj_uncompress_err(struct vjcompress *comp) +{ + comp->flags |= VJF_TOSS; + INCR(vjs_errorin); +} + +/* + * "Uncompress" a packet of type TYPE_UNCOMPRESSED_TCP. + * Return 0 on success, -1 on failure. + */ +int +vj_uncompress_uncomp(struct pbuf *nb, struct vjcompress *comp) +{ + register u_int hlen; + register struct cstate *cs; + register struct ip_hdr *ip; + + ip = (struct ip_hdr *)nb->payload; + hlen = IPH_HL(ip) << 2; + if (IPH_PROTO(ip) >= MAX_SLOTS + || hlen + sizeof(struct tcp_hdr) > nb->len + || (hlen += TCPH_OFFSET(((struct tcp_hdr *)&((char *)ip)[hlen])) << 2) + > nb->len + || hlen > MAX_HDR) { + PPPDEBUG(LOG_INFO, ("vj_uncompress_uncomp: bad cid=%d, hlen=%d buflen=%d\n", + IPH_PROTO(ip), hlen, nb->len)); + comp->flags |= VJF_TOSS; + INCR(vjs_errorin); + return -1; + } + cs = &comp->rstate[comp->last_recv = IPH_PROTO(ip)]; + comp->flags &=~ VJF_TOSS; + IPH_PROTO_SET(ip, IP_PROTO_TCP); + BCOPY(ip, &cs->cs_ip, hlen); + cs->cs_hlen = (u_short)hlen; + INCR(vjs_uncompressedin); + return 0; +} + +/* + * Uncompress a packet of type TYPE_COMPRESSED_TCP. + * The packet is composed of a buffer chain and the first buffer + * must contain an accurate chain length. + * The first buffer must include the entire compressed TCP/IP header. + * This procedure replaces the compressed header with the uncompressed + * header and returns the length of the VJ header. + */ +int +vj_uncompress_tcp(struct pbuf **nb, struct vjcompress *comp) +{ + u_char *cp; + struct tcp_hdr *th; + struct cstate *cs; + u_short *bp; + struct pbuf *n0 = *nb; + u32_t tmp; + u_int vjlen, hlen, changes; + + INCR(vjs_compressedin); + cp = (u_char *)n0->payload; + changes = *cp++; + if (changes & NEW_C) { + /* + * Make sure the state index is in range, then grab the state. + * If we have a good state index, clear the 'discard' flag. + */ + if (*cp >= MAX_SLOTS) { + PPPDEBUG(LOG_INFO, ("vj_uncompress_tcp: bad cid=%d\n", *cp)); + goto bad; + } + + comp->flags &=~ VJF_TOSS; + comp->last_recv = *cp++; + } else { + /* + * this packet has an implicit state index. If we've + * had a line error since the last time we got an + * explicit state index, we have to toss the packet. + */ + if (comp->flags & VJF_TOSS) { + PPPDEBUG(LOG_INFO, ("vj_uncompress_tcp: tossing\n")); + INCR(vjs_tossed); + return (-1); + } + } + cs = &comp->rstate[comp->last_recv]; + hlen = IPH_HL(&cs->cs_ip) << 2; + th = (struct tcp_hdr *)&((u_char *)&cs->cs_ip)[hlen]; + th->chksum = htons((*cp << 8) | cp[1]); + cp += 2; + if (changes & TCP_PUSH_BIT) { + TCPH_SET_FLAG(th, TCP_PSH); + } else { + TCPH_UNSET_FLAG(th, TCP_PSH); + } + + switch (changes & SPECIALS_MASK) { + case SPECIAL_I: + { + register u32_t i = ntohs(IPH_LEN(&cs->cs_ip)) - cs->cs_hlen; + /* some compilers can't nest inline assembler.. */ + tmp = ntohl(th->ackno) + i; + th->ackno = htonl(tmp); + tmp = ntohl(th->seqno) + i; + th->seqno = htonl(tmp); + } + break; + + case SPECIAL_D: + /* some compilers can't nest inline assembler.. */ + tmp = ntohl(th->seqno) + ntohs(IPH_LEN(&cs->cs_ip)) - cs->cs_hlen; + th->seqno = htonl(tmp); + break; + + default: + if (changes & NEW_U) { + TCPH_SET_FLAG(th, TCP_URG); + DECODEU(th->urgp); + } else { + TCPH_UNSET_FLAG(th, TCP_URG); + } + if (changes & NEW_W) { + DECODES(th->wnd); + } + if (changes & NEW_A) { + DECODEL(th->ackno); + } + if (changes & NEW_S) { + DECODEL(th->seqno); + } + break; + } + if (changes & NEW_I) { + DECODES(cs->cs_ip._id); + } else { + IPH_ID_SET(&cs->cs_ip, ntohs(IPH_ID(&cs->cs_ip)) + 1); + IPH_ID_SET(&cs->cs_ip, htons(IPH_ID(&cs->cs_ip))); + } + + /* + * At this point, cp points to the first byte of data in the + * packet. Fill in the IP total length and update the IP + * header checksum. + */ + vjlen = (u_short)(cp - (u_char*)n0->payload); + if (n0->len < vjlen) { + /* + * We must have dropped some characters (crc should detect + * this but the old slip framing won't) + */ + PPPDEBUG(LOG_INFO, ("vj_uncompress_tcp: head buffer %d too short %d\n", + n0->len, vjlen)); + goto bad; + } + +#if BYTE_ORDER == LITTLE_ENDIAN + tmp = n0->tot_len - vjlen + cs->cs_hlen; + IPH_LEN_SET(&cs->cs_ip, htons((u_short)tmp)); +#else + IPH_LEN_SET(&cs->cs_ip, htons(n0->tot_len - vjlen + cs->cs_hlen)); +#endif + + /* recompute the ip header checksum */ + bp = (u_short *) &cs->cs_ip; + IPH_CHKSUM_SET(&cs->cs_ip, 0); + for (tmp = 0; hlen > 0; hlen -= 2) { + tmp += *bp++; + } + tmp = (tmp & 0xffff) + (tmp >> 16); + tmp = (tmp & 0xffff) + (tmp >> 16); + IPH_CHKSUM_SET(&cs->cs_ip, (u_short)(~tmp)); + + /* Remove the compressed header and prepend the uncompressed header. */ + if(pbuf_header(n0, -((s16_t)(vjlen)))) { + /* Can we cope with this failing? Just assert for now */ + LWIP_ASSERT("pbuf_header failed\n", 0); + goto bad; + } + + if(LWIP_MEM_ALIGN(n0->payload) != n0->payload) { + struct pbuf *np, *q; + u8_t *bufptr; + + np = pbuf_alloc(PBUF_RAW, n0->len + cs->cs_hlen, PBUF_POOL); + if(!np) { + PPPDEBUG(LOG_WARNING, ("vj_uncompress_tcp: realign failed\n")); + goto bad; + } + + if(pbuf_header(np, -cs->cs_hlen)) { + /* Can we cope with this failing? Just assert for now */ + LWIP_ASSERT("pbuf_header failed\n", 0); + goto bad; + } + + bufptr = n0->payload; + for(q = np; q != NULL; q = q->next) { + MEMCPY(q->payload, bufptr, q->len); + bufptr += q->len; + } + + if(n0->next) { + pbuf_chain(np, n0->next); + pbuf_dechain(n0); + } + pbuf_free(n0); + n0 = np; + } + + if(pbuf_header(n0, cs->cs_hlen)) { + struct pbuf *np; + + LWIP_ASSERT("vj_uncompress_tcp: cs->cs_hlen <= PBUF_POOL_BUFSIZE", cs->cs_hlen <= PBUF_POOL_BUFSIZE); + np = pbuf_alloc(PBUF_RAW, cs->cs_hlen, PBUF_POOL); + if(!np) { + PPPDEBUG(LOG_WARNING, ("vj_uncompress_tcp: prepend failed\n")); + goto bad; + } + pbuf_cat(np, n0); + n0 = np; + } + LWIP_ASSERT("n0->len >= cs->cs_hlen", n0->len >= cs->cs_hlen); + MEMCPY(n0->payload, &cs->cs_ip, cs->cs_hlen); + + *nb = n0; + + return vjlen; + +bad: + comp->flags |= VJF_TOSS; + INCR(vjs_errorin); + return (-1); +} + +#endif /* VJ_SUPPORT */ + +#endif /* PPP_SUPPORT */ diff --git a/lib/drivers/lwip/src/netif/ppp/vj.h b/lib/drivers/lwip/src/netif/ppp/vj.h new file mode 100644 index 00000000000..fad1213646a --- /dev/null +++ b/lib/drivers/lwip/src/netif/ppp/vj.h @@ -0,0 +1,156 @@ +/* + * Definitions for tcp compression routines. + * + * $Id: vj.h,v 1.7 2010/02/22 17:52:09 goldsimon Exp $ + * + * Copyright (c) 1989 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by the University of California, Berkeley. The name of the + * University may not be used to endorse or promote products derived + * from this software without specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * Van Jacobson (van@helios.ee.lbl.gov), Dec 31, 1989: + * - Initial distribution. + */ + +#ifndef VJ_H +#define VJ_H + +#include "lwip/ip.h" +#include "lwip/tcp_impl.h" + +#define MAX_SLOTS 16 /* must be > 2 and < 256 */ +#define MAX_HDR 128 + +/* + * Compressed packet format: + * + * The first octet contains the packet type (top 3 bits), TCP + * 'push' bit, and flags that indicate which of the 4 TCP sequence + * numbers have changed (bottom 5 bits). The next octet is a + * conversation number that associates a saved IP/TCP header with + * the compressed packet. The next two octets are the TCP checksum + * from the original datagram. The next 0 to 15 octets are + * sequence number changes, one change per bit set in the header + * (there may be no changes and there are two special cases where + * the receiver implicitly knows what changed -- see below). + * + * There are 5 numbers which can change (they are always inserted + * in the following order): TCP urgent pointer, window, + * acknowlegement, sequence number and IP ID. (The urgent pointer + * is different from the others in that its value is sent, not the + * change in value.) Since typical use of SLIP links is biased + * toward small packets (see comments on MTU/MSS below), changes + * use a variable length coding with one octet for numbers in the + * range 1 - 255 and 3 octets (0, MSB, LSB) for numbers in the + * range 256 - 65535 or 0. (If the change in sequence number or + * ack is more than 65535, an uncompressed packet is sent.) + */ + +/* + * Packet types (must not conflict with IP protocol version) + * + * The top nibble of the first octet is the packet type. There are + * three possible types: IP (not proto TCP or tcp with one of the + * control flags set); uncompressed TCP (a normal IP/TCP packet but + * with the 8-bit protocol field replaced by an 8-bit connection id -- + * this type of packet syncs the sender & receiver); and compressed + * TCP (described above). + * + * LSB of 4-bit field is TCP "PUSH" bit (a worthless anachronism) and + * is logically part of the 4-bit "changes" field that follows. Top + * three bits are actual packet type. For backward compatibility + * and in the interest of conserving bits, numbers are chosen so the + * IP protocol version number (4) which normally appears in this nibble + * means "IP packet". + */ + +/* packet types */ +#define TYPE_IP 0x40 +#define TYPE_UNCOMPRESSED_TCP 0x70 +#define TYPE_COMPRESSED_TCP 0x80 +#define TYPE_ERROR 0x00 + +/* Bits in first octet of compressed packet */ +#define NEW_C 0x40 /* flag bits for what changed in a packet */ +#define NEW_I 0x20 +#define NEW_S 0x08 +#define NEW_A 0x04 +#define NEW_W 0x02 +#define NEW_U 0x01 + +/* reserved, special-case values of above */ +#define SPECIAL_I (NEW_S|NEW_W|NEW_U) /* echoed interactive traffic */ +#define SPECIAL_D (NEW_S|NEW_A|NEW_W|NEW_U) /* unidirectional data */ +#define SPECIALS_MASK (NEW_S|NEW_A|NEW_W|NEW_U) + +#define TCP_PUSH_BIT 0x10 + + +/* + * "state" data for each active tcp conversation on the wire. This is + * basically a copy of the entire IP/TCP header from the last packet + * we saw from the conversation together with a small identifier + * the transmit & receive ends of the line use to locate saved header. + */ +struct cstate { + struct cstate *cs_next; /* next most recently used state (xmit only) */ + u_short cs_hlen; /* size of hdr (receive only) */ + u_char cs_id; /* connection # associated with this state */ + u_char cs_filler; + union { + char csu_hdr[MAX_HDR]; + struct ip_hdr csu_ip; /* ip/tcp hdr from most recent packet */ + } vjcs_u; +}; +#define cs_ip vjcs_u.csu_ip +#define cs_hdr vjcs_u.csu_hdr + + +struct vjstat { + unsigned long vjs_packets; /* outbound packets */ + unsigned long vjs_compressed; /* outbound compressed packets */ + unsigned long vjs_searches; /* searches for connection state */ + unsigned long vjs_misses; /* times couldn't find conn. state */ + unsigned long vjs_uncompressedin; /* inbound uncompressed packets */ + unsigned long vjs_compressedin; /* inbound compressed packets */ + unsigned long vjs_errorin; /* inbound unknown type packets */ + unsigned long vjs_tossed; /* inbound packets tossed because of error */ +}; + +/* + * all the state data for one serial line (we need one of these per line). + */ +struct vjcompress { + struct cstate *last_cs; /* most recently used tstate */ + u_char last_recv; /* last rcvd conn. id */ + u_char last_xmit; /* last sent conn. id */ + u_short flags; + u_char maxSlotIndex; + u_char compressSlot; /* Flag indicating OK to compress slot ID. */ +#if LINK_STATS + struct vjstat stats; +#endif + struct cstate tstate[MAX_SLOTS]; /* xmit connection states */ + struct cstate rstate[MAX_SLOTS]; /* receive connection states */ +}; + +/* flag values */ +#define VJF_TOSS 1U /* tossing rcvd frames because of input err */ + +extern void vj_compress_init (struct vjcompress *comp); +extern u_int vj_compress_tcp (struct vjcompress *comp, struct pbuf *pb); +extern void vj_uncompress_err (struct vjcompress *comp); +extern int vj_uncompress_uncomp(struct pbuf *nb, struct vjcompress *comp); +extern int vj_uncompress_tcp (struct pbuf **nb, struct vjcompress *comp); + +#endif /* VJ_H */ diff --git a/lib/drivers/lwip/src/netif/ppp/vjbsdhdr.h b/lib/drivers/lwip/src/netif/ppp/vjbsdhdr.h new file mode 100644 index 00000000000..f46267614a1 --- /dev/null +++ b/lib/drivers/lwip/src/netif/ppp/vjbsdhdr.h @@ -0,0 +1,75 @@ +#ifndef VJBSDHDR_H +#define VJBSDHDR_H + +#include "lwip/tcp.h" + +/* + * Structure of an internet header, naked of options. + * + * We declare ip_len and ip_off to be short, rather than u_short + * pragmatically since otherwise unsigned comparisons can result + * against negative integers quite easily, and fail in subtle ways. + */ +PACK_STRUCT_BEGIN +struct ip +{ +#if defined(NO_CHAR_BITFIELDS) + u_char ip_hl_v; /* bug in GCC for mips means the bitfield stuff will sometimes break - so we use a char for both and get round it with macro's instead... */ +#else +#if BYTE_ORDER == LITTLE_ENDIAN + unsigned ip_hl:4, /* header length */ + ip_v :4; /* version */ +#elif BYTE_ORDER == BIG_ENDIAN + unsigned ip_v :4, /* version */ + ip_hl:4; /* header length */ +#else + COMPLAIN - NO BYTE ORDER SELECTED! +#endif +#endif + u_char ip_tos; /* type of service */ + u_short ip_len; /* total length */ + u_short ip_id; /* identification */ + u_short ip_off; /* fragment offset field */ +#define IP_DF 0x4000 /* dont fragment flag */ +#define IP_MF 0x2000 /* more fragments flag */ +#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */ + u_char ip_ttl; /* time to live */ + u_char ip_p; /* protocol */ + u_short ip_sum; /* checksum */ + struct in_addr ip_src,ip_dst; /* source and dest address */ +}; +PACK_STRUCT_END + +typedef u32_t tcp_seq; + +/* + * TCP header. + * Per RFC 793, September, 1981. + */ +PACK_STRUCT_BEGIN +struct tcphdr +{ + u_short th_sport; /* source port */ + u_short th_dport; /* destination port */ + tcp_seq th_seq; /* sequence number */ + tcp_seq th_ack; /* acknowledgement number */ +#if defined(NO_CHAR_BITFIELDS) + u_char th_x2_off; +#else +#if BYTE_ORDER == LITTLE_ENDIAN + unsigned th_x2 :4, /* (unused) */ + th_off:4; /* data offset */ +#endif +#if BYTE_ORDER == BIG_ENDIAN + unsigned th_off:4, /* data offset */ + th_x2 :4; /* (unused) */ +#endif +#endif + u_char th_flags; + u_short th_win; /* window */ + u_short th_sum; /* checksum */ + u_short th_urp; /* urgent pointer */ +}; +PACK_STRUCT_END + +#endif /* VJBSDHDR_H */ diff --git a/lib/drivers/lwip/src/netif/slipif.c b/lib/drivers/lwip/src/netif/slipif.c new file mode 100644 index 00000000000..c19333dd704 --- /dev/null +++ b/lib/drivers/lwip/src/netif/slipif.c @@ -0,0 +1,367 @@ +/** + * @file + * SLIP Interface + * + */ + +/* + * Copyright (c) 2001-2004 Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This file is built upon the file: src/arch/rtxc/netif/sioslip.c + * + * Author: Magnus Ivarsson + */ + +/* + * This is an arch independent SLIP netif. The specific serial hooks must be + * provided by another file. They are sio_open, sio_read/sio_tryread and sio_send + */ + +#include "netif/slipif.h" +#include "lwip/opt.h" + +#if LWIP_HAVE_SLIPIF + +#include "lwip/def.h" +#include "lwip/pbuf.h" +#include "lwip/sys.h" +#include "lwip/stats.h" +#include "lwip/snmp.h" +#include "lwip/sio.h" + +#define SLIP_BLOCK 1 +#define SLIP_DONTBLOCK 0 + +#define SLIP_END 0300 /* 0xC0 */ +#define SLIP_ESC 0333 /* 0xDB */ +#define SLIP_ESC_END 0334 /* 0xDC */ +#define SLIP_ESC_ESC 0335 /* 0xDD */ + +#define SLIP_MAX_SIZE 1500 + +enum slipif_recv_state { + SLIP_RECV_NORMAL, + SLIP_RECV_ESCAPE, +}; + +struct slipif_priv { + sio_fd_t sd; + /* q is the whole pbuf chain for a packet, p is the current pbuf in the chain */ + struct pbuf *p, *q; + enum slipif_recv_state state; + u16_t i, recved; +}; + +/** + * Send a pbuf doing the necessary SLIP encapsulation + * + * Uses the serial layer's sio_send() + * + * @param netif the lwip network interface structure for this slipif + * @param p the pbuf chaing packet to send + * @param ipaddr the ip address to send the packet to (not used for slipif) + * @return always returns ERR_OK since the serial layer does not provide return values + */ +err_t +slipif_output(struct netif *netif, struct pbuf *p, ip_addr_t *ipaddr) +{ + struct slipif_priv *priv; + struct pbuf *q; + u16_t i; + u8_t c; + + LWIP_ASSERT("netif != NULL", (netif != NULL)); + LWIP_ASSERT("netif->state != NULL", (netif->state != NULL)); + LWIP_ASSERT("p != NULL", (p != NULL)); + + LWIP_UNUSED_ARG(ipaddr); + + priv = netif->state; + + /* Send pbuf out on the serial I/O device. */ + sio_send(SLIP_END, priv->sd); + + for (q = p; q != NULL; q = q->next) { + for (i = 0; i < q->len; i++) { + c = ((u8_t *)q->payload)[i]; + switch (c) { + case SLIP_END: + sio_send(SLIP_ESC, priv->sd); + sio_send(SLIP_ESC_END, priv->sd); + break; + case SLIP_ESC: + sio_send(SLIP_ESC, priv->sd); + sio_send(SLIP_ESC_ESC, priv->sd); + break; + default: + sio_send(c, priv->sd); + break; + } + } + } + sio_send(SLIP_END, priv->sd); + return ERR_OK; +} + +/** + * Static function for easy use of blockig or non-blocking + * sio_read + * + * @param fd serial device handle + * @param data pointer to data buffer for receiving + * @param len maximum length (in bytes) of data to receive + * @param block if 1, call sio_read; if 0, call sio_tryread + * @return return value of sio_read of sio_tryread + */ +static u32_t +slip_sio_read(sio_fd_t fd, u8_t* data, u32_t len, u8_t block) +{ + if (block) { + return sio_read(fd, data, len); + } else { + return sio_tryread(fd, data, len); + } +} + +/** + * Handle the incoming SLIP stream character by character + * + * Poll the serial layer by calling sio_read() or sio_tryread(). + * + * @param netif the lwip network interface structure for this slipif + * @param block if 1, block until data is received; if 0, return when all data + * from the buffer is received (multiple calls to this function will + * return a complete packet, NULL is returned before - used for polling) + * @return The IP packet when SLIP_END is received + */ +static struct pbuf * +slipif_input(struct netif *netif, u8_t block) +{ + struct slipif_priv *priv; + u8_t c; + struct pbuf *t; + + LWIP_ASSERT("netif != NULL", (netif != NULL)); + LWIP_ASSERT("netif->state != NULL", (netif->state != NULL)); + + priv = netif->state; + + while (slip_sio_read(priv->sd, &c, 1, block) > 0) { + switch (priv->state) { + case SLIP_RECV_NORMAL: + switch (c) { + case SLIP_END: + if (priv->recved > 0) { + /* Received whole packet. */ + /* Trim the pbuf to the size of the received packet. */ + pbuf_realloc(priv->q, priv->recved); + + LINK_STATS_INC(link.recv); + + LWIP_DEBUGF(SLIP_DEBUG, ("slipif: Got packet\n")); + t = priv->q; + priv->p = priv->q = NULL; + priv->i = priv->recved = 0; + return t; + } + continue; + case SLIP_ESC: + priv->state = SLIP_RECV_ESCAPE; + continue; + } + break; + case SLIP_RECV_ESCAPE: + switch (c) { + case SLIP_ESC_END: + c = SLIP_END; + break; + case SLIP_ESC_ESC: + c = SLIP_ESC; + break; + } + priv->state = SLIP_RECV_NORMAL; + /* FALLTHROUGH */ + } + + /* byte received, packet not yet completely received */ + if (priv->p == NULL) { + /* allocate a new pbuf */ + LWIP_DEBUGF(SLIP_DEBUG, ("slipif_input: alloc\n")); + priv->p = pbuf_alloc(PBUF_LINK, (PBUF_POOL_BUFSIZE - PBUF_LINK_HLEN), PBUF_POOL); + + if (priv->p == NULL) { + LINK_STATS_INC(link.drop); + LWIP_DEBUGF(SLIP_DEBUG, ("slipif_input: no new pbuf! (DROP)\n")); + /* don't process any further since we got no pbuf to receive to */ + break; + } + + if (priv->q != NULL) { + /* 'chain' the pbuf to the existing chain */ + pbuf_cat(priv->q, priv->p); + } else { + /* p is the first pbuf in the chain */ + priv->q = priv->p; + } + } + + /* this automatically drops bytes if > SLIP_MAX_SIZE */ + if ((priv->p != NULL) && (priv->recved <= SLIP_MAX_SIZE)) { + ((u8_t *)priv->p->payload)[priv->i] = c; + priv->recved++; + priv->i++; + if (priv->i >= priv->p->len) { + /* on to the next pbuf */ + priv->i = 0; + if (priv->p->next != NULL && priv->p->next->len > 0) { + /* p is a chain, on to the next in the chain */ + priv->p = priv->p->next; + } else { + /* p is a single pbuf, set it to NULL so next time a new + * pbuf is allocated */ + priv->p = NULL; + } + } + } + } + + return NULL; +} + +#if !NO_SYS +/** + * The SLIP input thread. + * + * Feed the IP layer with incoming packets + * + * @param nf the lwip network interface structure for this slipif + */ +static void +slipif_loop_thread(void *nf) +{ + struct pbuf *p; + struct netif *netif = (struct netif *)nf; + + while (1) { + p = slipif_input(netif, SLIP_BLOCK); + if (p != NULL) { + if (netif->input(p, netif) != ERR_OK) { + pbuf_free(p); + p = NULL; + } + } + } +} +#endif /* !NO_SYS */ + +/** + * SLIP netif initialization + * + * Call the arch specific sio_open and remember + * the opened device in the state field of the netif. + * + * @param netif the lwip network interface structure for this slipif + * @return ERR_OK if serial line could be opened, + * ERR_MEM if no memory could be allocated, + * ERR_IF is serial line couldn't be opened + * + * @note netif->num must contain the number of the serial port to open + * (0 by default) + */ +err_t +slipif_init(struct netif *netif) +{ + struct slipif_priv *priv; + + LWIP_DEBUGF(SLIP_DEBUG, ("slipif_init: netif->num=%"U16_F"\n", (u16_t)netif->num)); + + /* Allocate private data */ + priv = mem_malloc(sizeof(struct slipif_priv)); + if (!priv) { + return ERR_MEM; + } + + netif->name[0] = 's'; + netif->name[1] = 'l'; + netif->output = slipif_output; + netif->mtu = SLIP_MAX_SIZE; + netif->flags |= NETIF_FLAG_POINTTOPOINT; + + /* Try to open the serial port (netif->num contains the port number). */ + priv->sd = sio_open(netif->num); + if (!priv->sd) { + /* Opening the serial port failed. */ + mem_free(priv); + return ERR_IF; + } + + /* Initialize private data */ + priv->p = NULL; + priv->q = NULL; + priv->state = SLIP_RECV_NORMAL; + priv->i = 0; + priv->recved = 0; + + netif->state = priv; + + /* initialize the snmp variables and counters inside the struct netif + * ifSpeed: no assumption can be made without knowing more about the + * serial line! + */ + NETIF_INIT_SNMP(netif, snmp_ifType_slip, 0); + + /* Create a thread to poll the serial line. */ + sys_thread_new(SLIPIF_THREAD_NAME, slipif_loop_thread, netif, + SLIPIF_THREAD_STACKSIZE, SLIPIF_THREAD_PRIO); + return ERR_OK; +} + +/** + * Polls the serial device and feeds the IP layer with incoming packets. + * + * @param netif The lwip network interface structure for this slipif + */ +void +slipif_poll(struct netif *netif) +{ + struct pbuf *p; + struct slipif_priv *priv; + + LWIP_ASSERT("netif != NULL", (netif != NULL)); + LWIP_ASSERT("netif->state != NULL", (netif->state != NULL)); + + priv = netif->state; + + while ((p = slipif_input(netif, SLIP_DONTBLOCK)) != NULL) { + if (netif->input(p, netif) != ERR_OK) { + pbuf_free(p); + } + } +} + +#endif /* LWIP_HAVE_SLIPIF */ diff --git a/lib/drivers/lwip/src/rosip.c b/lib/drivers/lwip/src/rosip.c new file mode 100755 index 00000000000..07100d268b9 --- /dev/null +++ b/lib/drivers/lwip/src/rosip.c @@ -0,0 +1,47 @@ +#include "lwip/sys.h" +#include "lwip/tcpip.h" + +#include "rosip.h" + +#include + +typedef struct netif* PNETIF; + +void +LibIPInsertPacket(void *ifarg, + const void *const data, + const u32_t size) +{ + struct pbuf *p, *p1; + u32_t i; + + ASSERT(ifarg); + ASSERT(data); + ASSERT(size > 0); + + p = pbuf_alloc(PBUF_TRANSPORT, size, PBUF_POOL); + if (p) + { + for (i = 0, p1 = p; i < size; i += p1->len, p1 = p1->next) + { + ASSERT(p1); + RtlCopyMemory(p1->payload, ((PUCHAR)data) + i, p1->len); + } + + ((PNETIF)ifarg)->input(p, (PNETIF)ifarg); + } +} + +void +LibIPInitialize(void) +{ + /* This completes asynchronously */ + tcpip_init(NULL, NULL); +} + +void +LibIPShutdown(void) +{ + /* This is synchronous */ + sys_shutdown(); +} \ No newline at end of file diff --git a/lib/drivers/lwip/src/rosmem.c b/lib/drivers/lwip/src/rosmem.c new file mode 100755 index 00000000000..4fdb84d3c8c --- /dev/null +++ b/lib/drivers/lwip/src/rosmem.c @@ -0,0 +1,39 @@ +#include "lwip/opt.h" + +#include "lwip/def.h" +#include "lwip/mem.h" + +#ifndef LWIP_TAG + #define LWIP_TAG 'PIwl' +#endif + +void * +malloc(mem_size_t size) +{ + return ExAllocatePoolWithTag(NonPagedPool, size, LWIP_TAG); +} + +void * +calloc(mem_size_t count, mem_size_t size) +{ + void *mem = malloc(count * size); + + if (!mem) return NULL; + + RtlZeroMemory(mem, count * size); + + return mem; +} + +void +free(void *mem) +{ + ExFreePoolWithTag(mem, LWIP_TAG); +} + +void * +realloc(void *mem, size_t size) +{ + free(mem); + return malloc(size); +} \ No newline at end of file diff --git a/lib/drivers/lwip/src/rostcp.c b/lib/drivers/lwip/src/rostcp.c new file mode 100755 index 00000000000..18de2824b20 --- /dev/null +++ b/lib/drivers/lwip/src/rostcp.c @@ -0,0 +1,743 @@ +#include "lwip/sys.h" +#include "lwip/tcpip.h" + +#include "rosip.h" + +#include + +static const char * const tcp_state_str[] = { + "CLOSED", + "LISTEN", + "SYN_SENT", + "SYN_RCVD", + "ESTABLISHED", + "FIN_WAIT_1", + "FIN_WAIT_2", + "CLOSE_WAIT", + "CLOSING", + "LAST_ACK", + "TIME_WAIT" +}; + +/* The way that lwIP does multi-threading is really not ideal for our purposes but + * we best go along with it unless we want another unstable TCP library. lwIP uses + * a thread called the "tcpip thread" which is the only one allowed to call raw API + * functions. Since this is the case, for each of our LibTCP* functions, we queue a request + * for a callback to "tcpip thread" which calls our LibTCP*Callback functions. Yes, this is + * a lot of unnecessary thread swapping and it could definitely be faster, but I don't want + * to going messing around in lwIP because I have no desire to create another mess like oskittcp */ + +extern KEVENT TerminationEvent; +extern NPAGED_LOOKASIDE_LIST MessageLookasideList; +extern NPAGED_LOOKASIDE_LIST QueueEntryLookasideList; + +static +void +LibTCPEmptyQueue(PCONNECTION_ENDPOINT Connection) +{ + PLIST_ENTRY Entry; + PQUEUE_ENTRY qp = NULL; + + ReferenceObject(Connection); + + while (!IsListEmpty(&Connection->PacketQueue)) + { + Entry = RemoveHeadList(&Connection->PacketQueue); + qp = CONTAINING_RECORD(Entry, QUEUE_ENTRY, ListEntry); + + /* We're in the tcpip thread here so this is safe */ + pbuf_free(qp->p); + + ExFreeToNPagedLookasideList(&QueueEntryLookasideList, qp); + } + + DereferenceObject(Connection); +} + +void LibTCPEnqueuePacket(PCONNECTION_ENDPOINT Connection, struct pbuf *p) +{ + PQUEUE_ENTRY qp; + + qp = (PQUEUE_ENTRY)ExAllocateFromNPagedLookasideList(&QueueEntryLookasideList); + qp->p = p; + + ExInterlockedInsertTailList(&Connection->PacketQueue, &qp->ListEntry, &Connection->Lock); +} + +PQUEUE_ENTRY LibTCPDequeuePacket(PCONNECTION_ENDPOINT Connection) +{ + PLIST_ENTRY Entry; + PQUEUE_ENTRY qp = NULL; + + if (IsListEmpty(&Connection->PacketQueue)) return NULL; + + Entry = RemoveHeadList(&Connection->PacketQueue); + + qp = CONTAINING_RECORD(Entry, QUEUE_ENTRY, ListEntry); + + return qp; +} + +NTSTATUS LibTCPGetDataFromConnectionQueue(PCONNECTION_ENDPOINT Connection, PUCHAR RecvBuffer, UINT RecvLen, UINT *Received) +{ + PQUEUE_ENTRY qp; + struct pbuf* p; + NTSTATUS Status = STATUS_PENDING; + UINT ReadLength, ExistingDataLength; + KIRQL OldIrql; + + (*Received) = 0; + + LockObject(Connection, &OldIrql); + + if (!IsListEmpty(&Connection->PacketQueue)) + { + while ((qp = LibTCPDequeuePacket(Connection)) != NULL) + { + p = qp->p; + ExistingDataLength = (*Received); + + Status = STATUS_SUCCESS; + + ReadLength = MIN(p->tot_len, RecvLen); + if (ReadLength != p->tot_len) + { + if (ExistingDataLength) + { + /* The packet was too big but we used some data already so give it another shot later */ + InsertHeadList(&Connection->PacketQueue, &qp->ListEntry); + break; + } + else + { + /* The packet is just too big to fit fully in our buffer, even when empty so + * return an informative status but still copy all the data we can fit. + */ + Status = STATUS_BUFFER_OVERFLOW; + } + } + + UnlockObject(Connection, OldIrql); + + /* Return to a lower IRQL because the receive buffer may be pageable memory */ + for (; (*Received) < ReadLength + ExistingDataLength; (*Received) += p->len, p = p->next) + { + RtlCopyMemory(RecvBuffer + (*Received), p->payload, p->len); + } + + LockObject(Connection, &OldIrql); + + RecvLen -= ReadLength; + + /* Use this special pbuf free callback function because we're outside tcpip thread */ + pbuf_free_callback(qp->p); + + ExFreeToNPagedLookasideList(&QueueEntryLookasideList, qp); + + if (!RecvLen) + break; + + if (Status != STATUS_SUCCESS) + break; + } + } + else + { + if (Connection->ReceiveShutdown) + Status = STATUS_SUCCESS; + else + Status = STATUS_PENDING; + } + + UnlockObject(Connection, OldIrql); + + return Status; +} + +static +BOOLEAN +WaitForEventSafely(PRKEVENT Event) +{ + PVOID WaitObjects[] = {Event, &TerminationEvent}; + + if (KeWaitForMultipleObjects(2, + WaitObjects, + WaitAny, + Executive, + KernelMode, + FALSE, + NULL, + NULL) == STATUS_WAIT_0) + { + /* Signalled by the caller's event */ + return TRUE; + } + else /* if KeWaitForMultipleObjects() == STATUS_WAIT_1 */ + { + /* Signalled by our termination event */ + return FALSE; + } +} + +static +err_t +InternalSendEventHandler(void *arg, PTCP_PCB pcb, const u16_t space) +{ + /* Make sure the socket didn't get closed */ + if (!arg) return ERR_OK; + + TCPSendEventHandler(arg, space); + + return ERR_OK; +} + +static +err_t +InternalRecvEventHandler(void *arg, PTCP_PCB pcb, struct pbuf *p, const err_t err) +{ + PCONNECTION_ENDPOINT Connection = arg; + u32_t len; + + /* Make sure the socket didn't get closed */ + if (!arg) + { + if (p) + pbuf_free(p); + + return ERR_OK; + } + + if (p) + { + LibTCPEnqueuePacket(Connection, p); + + tcp_recved(pcb, p->tot_len); + + TCPRecvEventHandler(arg); + } + else if (err == ERR_OK) + { + /* Complete pending reads with 0 bytes to indicate a graceful closure, + * but note that send is still possible in this state so we don't close the + * whole socket here (by calling tcp_close()) as that would violate TCP specs + */ + Connection->ReceiveShutdown = TRUE; + TCPFinEventHandler(arg, ERR_OK); + } + + return ERR_OK; +} + +static +err_t +InternalAcceptEventHandler(void *arg, PTCP_PCB newpcb, const err_t err) +{ + /* Make sure the socket didn't get closed */ + if (!arg) + return ERR_ABRT; + + TCPAcceptEventHandler(arg, newpcb); + + /* Set in LibTCPAccept (called from TCPAcceptEventHandler) */ + if (newpcb->callback_arg) + return ERR_OK; + else + return ERR_ABRT; +} + +static +err_t +InternalConnectEventHandler(void *arg, PTCP_PCB pcb, const err_t err) +{ + /* Make sure the socket didn't get closed */ + if (!arg) + return ERR_OK; + + TCPConnectEventHandler(arg, err); + + return ERR_OK; +} + +static +void +InternalErrorEventHandler(void *arg, const err_t err) +{ + /* Make sure the socket didn't get closed */ + if (!arg) return; + + TCPFinEventHandler(arg, err); +} + +static +void +LibTCPSocketCallback(void *arg) +{ + struct lwip_callback_msg *msg = arg; + + ASSERT(msg); + + msg->Output.Socket.NewPcb = tcp_new(); + + if (msg->Output.Socket.NewPcb) + { + tcp_arg(msg->Output.Socket.NewPcb, msg->Input.Socket.Arg); + tcp_err(msg->Output.Socket.NewPcb, InternalErrorEventHandler); + } + + KeSetEvent(&msg->Event, IO_NO_INCREMENT, FALSE); +} + +struct tcp_pcb * +LibTCPSocket(void *arg) +{ + struct lwip_callback_msg *msg = ExAllocateFromNPagedLookasideList(&MessageLookasideList); + struct tcp_pcb *ret; + + if (msg) + { + KeInitializeEvent(&msg->Event, NotificationEvent, FALSE); + msg->Input.Socket.Arg = arg; + + tcpip_callback_with_block(LibTCPSocketCallback, msg, 1); + + if (WaitForEventSafely(&msg->Event)) + ret = msg->Output.Socket.NewPcb; + else + ret = NULL; + + ExFreeToNPagedLookasideList(&MessageLookasideList, msg); + + return ret; + } + + return NULL; +} + +static +void +LibTCPBindCallback(void *arg) +{ + struct lwip_callback_msg *msg = arg; + + ASSERT(msg); + + if (!msg->Input.Bind.Connection->SocketContext) + { + msg->Output.Bind.Error = ERR_CLSD; + goto done; + } + + msg->Output.Bind.Error = tcp_bind((PTCP_PCB)msg->Input.Bind.Connection->SocketContext, + msg->Input.Bind.IpAddress, + ntohs(msg->Input.Bind.Port)); + +done: + KeSetEvent(&msg->Event, IO_NO_INCREMENT, FALSE); +} + +err_t +LibTCPBind(PCONNECTION_ENDPOINT Connection, struct ip_addr *const ipaddr, const u16_t port) +{ + struct lwip_callback_msg *msg; + err_t ret; + + msg = ExAllocateFromNPagedLookasideList(&MessageLookasideList); + if (msg) + { + KeInitializeEvent(&msg->Event, NotificationEvent, FALSE); + msg->Input.Bind.Connection = Connection; + msg->Input.Bind.IpAddress = ipaddr; + msg->Input.Bind.Port = port; + + tcpip_callback_with_block(LibTCPBindCallback, msg, 1); + + if (WaitForEventSafely(&msg->Event)) + ret = msg->Output.Bind.Error; + else + ret = ERR_CLSD; + + ExFreeToNPagedLookasideList(&MessageLookasideList, msg); + + return ret; + } + + return ERR_MEM; +} + +static +void +LibTCPListenCallback(void *arg) +{ + struct lwip_callback_msg *msg = arg; + + ASSERT(msg); + + if (!msg->Input.Listen.Connection->SocketContext) + { + msg->Output.Listen.NewPcb = NULL; + goto done; + } + + msg->Output.Listen.NewPcb = tcp_listen_with_backlog((PTCP_PCB)msg->Input.Listen.Connection->SocketContext, msg->Input.Listen.Backlog); + + if (msg->Output.Listen.NewPcb) + { + tcp_accept(msg->Output.Listen.NewPcb, InternalAcceptEventHandler); + } + +done: + KeSetEvent(&msg->Event, IO_NO_INCREMENT, FALSE); +} + +PTCP_PCB +LibTCPListen(PCONNECTION_ENDPOINT Connection, const u8_t backlog) +{ + struct lwip_callback_msg *msg; + PTCP_PCB ret; + + msg = ExAllocateFromNPagedLookasideList(&MessageLookasideList); + if (msg) + { + KeInitializeEvent(&msg->Event, NotificationEvent, FALSE); + msg->Input.Listen.Connection = Connection; + msg->Input.Listen.Backlog = backlog; + + tcpip_callback_with_block(LibTCPListenCallback, msg, 1); + + if (WaitForEventSafely(&msg->Event)) + ret = msg->Output.Listen.NewPcb; + else + ret = NULL; + + ExFreeToNPagedLookasideList(&MessageLookasideList, msg); + + return ret; + } + + return NULL; +} + +static +void +LibTCPSendCallback(void *arg) +{ + struct lwip_callback_msg *msg = arg; + + ASSERT(msg); + + if (!msg->Input.Send.Connection->SocketContext) + { + msg->Output.Send.Error = ERR_CLSD; + goto done; + } + + if (msg->Input.Send.Connection->SendShutdown) + { + msg->Output.Send.Error = ERR_CLSD; + goto done; + } + + msg->Output.Send.Error = tcp_write((PTCP_PCB)msg->Input.Send.Connection->SocketContext, + msg->Input.Send.Data, + msg->Input.Send.DataLength, + TCP_WRITE_FLAG_COPY); + if (msg->Output.Send.Error == ERR_MEM) + { + /* No buffer space so return pending */ + msg->Output.Send.Error = ERR_INPROGRESS; + } + else if (msg->Output.Send.Error == ERR_OK) + { + /* Queued successfully so try to send it */ + tcp_output((PTCP_PCB)msg->Input.Send.Connection->SocketContext); + } + +done: + KeSetEvent(&msg->Event, IO_NO_INCREMENT, FALSE); +} + +err_t +LibTCPSend(PCONNECTION_ENDPOINT Connection, void *const dataptr, const u16_t len, const int safe) +{ + err_t ret; + struct lwip_callback_msg *msg; + + msg = ExAllocateFromNPagedLookasideList(&MessageLookasideList); + if (msg) + { + KeInitializeEvent(&msg->Event, NotificationEvent, FALSE); + msg->Input.Send.Connection = Connection; + msg->Input.Send.Data = dataptr; + msg->Input.Send.DataLength = len; + + if (safe) + LibTCPSendCallback(msg); + else + tcpip_callback_with_block(LibTCPSendCallback, msg, 1); + + if (WaitForEventSafely(&msg->Event)) + ret = msg->Output.Send.Error; + else + ret = ERR_CLSD; + + ExFreeToNPagedLookasideList(&MessageLookasideList, msg); + + return ret; + } + + return ERR_MEM; +} + +static +void +LibTCPConnectCallback(void *arg) +{ + struct lwip_callback_msg *msg = arg; + err_t Error; + + ASSERT(arg); + + if (!msg->Input.Connect.Connection->SocketContext) + { + msg->Output.Connect.Error = ERR_CLSD; + goto done; + } + + tcp_recv((PTCP_PCB)msg->Input.Connect.Connection->SocketContext, InternalRecvEventHandler); + tcp_sent((PTCP_PCB)msg->Input.Connect.Connection->SocketContext, InternalSendEventHandler); + + Error = tcp_connect((PTCP_PCB)msg->Input.Connect.Connection->SocketContext, + msg->Input.Connect.IpAddress, ntohs(msg->Input.Connect.Port), + InternalConnectEventHandler); + + msg->Output.Connect.Error = Error == ERR_OK ? ERR_INPROGRESS : Error; + +done: + KeSetEvent(&msg->Event, IO_NO_INCREMENT, FALSE); +} + +err_t +LibTCPConnect(PCONNECTION_ENDPOINT Connection, struct ip_addr *const ipaddr, const u16_t port) +{ + struct lwip_callback_msg *msg; + err_t ret; + + msg = ExAllocateFromNPagedLookasideList(&MessageLookasideList); + if (msg) + { + KeInitializeEvent(&msg->Event, NotificationEvent, FALSE); + msg->Input.Connect.Connection = Connection; + msg->Input.Connect.IpAddress = ipaddr; + msg->Input.Connect.Port = port; + + tcpip_callback_with_block(LibTCPConnectCallback, msg, 1); + + if (WaitForEventSafely(&msg->Event)) + { + ret = msg->Output.Connect.Error; + } + else + ret = ERR_CLSD; + + ExFreeToNPagedLookasideList(&MessageLookasideList, msg); + + return ret; + } + + return ERR_MEM; +} + +static +void +LibTCPShutdownCallback(void *arg) +{ + struct lwip_callback_msg *msg = arg; + PTCP_PCB pcb = msg->Input.Shutdown.Connection->SocketContext; + + if (!msg->Input.Shutdown.Connection->SocketContext) + { + msg->Output.Shutdown.Error = ERR_CLSD; + goto done; + } + + if (pcb->state == CLOSE_WAIT) + { + /* This case actually results in a socket closure later (lwIP bug?) */ + msg->Input.Shutdown.Connection->SocketContext = NULL; + } + + msg->Output.Shutdown.Error = tcp_shutdown(pcb, msg->Input.Shutdown.shut_rx, msg->Input.Shutdown.shut_tx); + if (msg->Output.Shutdown.Error) + { + msg->Input.Shutdown.Connection->SocketContext = pcb; + } + else + { + if (msg->Input.Shutdown.shut_rx) + msg->Input.Shutdown.Connection->ReceiveShutdown = TRUE; + + if (msg->Input.Shutdown.shut_tx) + msg->Input.Shutdown.Connection->SendShutdown = TRUE; + } + +done: + KeSetEvent(&msg->Event, IO_NO_INCREMENT, FALSE); +} + +err_t +LibTCPShutdown(PCONNECTION_ENDPOINT Connection, const int shut_rx, const int shut_tx) +{ + struct lwip_callback_msg *msg; + err_t ret; + + msg = ExAllocateFromNPagedLookasideList(&MessageLookasideList); + if (msg) + { + KeInitializeEvent(&msg->Event, NotificationEvent, FALSE); + + msg->Input.Shutdown.Connection = Connection; + msg->Input.Shutdown.shut_rx = shut_rx; + msg->Input.Shutdown.shut_tx = shut_tx; + + tcpip_callback_with_block(LibTCPShutdownCallback, msg, 1); + + if (WaitForEventSafely(&msg->Event)) + ret = msg->Output.Shutdown.Error; + else + ret = ERR_CLSD; + + ExFreeToNPagedLookasideList(&MessageLookasideList, msg); + + return ret; + } + + return ERR_MEM; +} + +static +void +LibTCPCloseCallback(void *arg) +{ + struct lwip_callback_msg *msg = arg; + PTCP_PCB pcb = msg->Input.Close.Connection->SocketContext; + + /* Empty the queue even if we're already "closed" */ + LibTCPEmptyQueue(msg->Input.Close.Connection); + + if (!msg->Input.Close.Connection->SocketContext) + { + msg->Output.Close.Error = ERR_OK; + goto done; + } + + /* Clear the PCB pointer */ + msg->Input.Close.Connection->SocketContext = NULL; + + switch (pcb->state) + { + case CLOSED: + case LISTEN: + case SYN_SENT: + msg->Output.Close.Error = tcp_close(pcb); + + if (!msg->Output.Close.Error && msg->Input.Close.Callback) + TCPFinEventHandler(msg->Input.Close.Connection, ERR_OK); + break; + + default: + if (msg->Input.Close.Connection->SendShutdown && + msg->Input.Close.Connection->ReceiveShutdown) + { + /* Abort the connection */ + tcp_abort(pcb); + + /* Aborts always succeed */ + msg->Output.Close.Error = ERR_OK; + } + else + { + /* Start the graceful close process (or send RST for pending data) */ + msg->Output.Close.Error = tcp_close(pcb); + } + break; + } + + if (msg->Output.Close.Error) + { + /* Restore the PCB pointer */ + msg->Input.Close.Connection->SocketContext = pcb; + } + +done: + KeSetEvent(&msg->Event, IO_NO_INCREMENT, FALSE); +} + +err_t +LibTCPClose(PCONNECTION_ENDPOINT Connection, const int safe, const int callback) +{ + err_t ret; + struct lwip_callback_msg *msg; + + msg = ExAllocateFromNPagedLookasideList(&MessageLookasideList); + if (msg) + { + KeInitializeEvent(&msg->Event, NotificationEvent, FALSE); + + msg->Input.Close.Connection = Connection; + msg->Input.Close.Callback = callback; + + if (safe) + LibTCPCloseCallback(msg); + else + tcpip_callback_with_block(LibTCPCloseCallback, msg, 1); + + if (WaitForEventSafely(&msg->Event)) + ret = msg->Output.Close.Error; + else + ret = ERR_CLSD; + + ExFreeToNPagedLookasideList(&MessageLookasideList, msg); + + return ret; + } + + return ERR_MEM; +} + +void +LibTCPAccept(PTCP_PCB pcb, struct tcp_pcb *listen_pcb, void *arg) +{ + ASSERT(arg); + + tcp_arg(pcb, NULL); + tcp_recv(pcb, InternalRecvEventHandler); + tcp_sent(pcb, InternalSendEventHandler); + tcp_err(pcb, InternalErrorEventHandler); + tcp_arg(pcb, arg); + + tcp_accepted(listen_pcb); +} + +err_t +LibTCPGetHostName(PTCP_PCB pcb, struct ip_addr *const ipaddr, u16_t *const port) +{ + if (!pcb) + return ERR_CLSD; + + *ipaddr = pcb->local_ip; + *port = pcb->local_port; + + return ERR_OK; +} + +err_t +LibTCPGetPeerName(PTCP_PCB pcb, struct ip_addr * const ipaddr, u16_t * const port) +{ + if (!pcb) + return ERR_CLSD; + + *ipaddr = pcb->remote_ip; + *port = pcb->remote_port; + + return ERR_OK; +} diff --git a/lib/drivers/lwip/src/sys_arch.c b/lib/drivers/lwip/src/sys_arch.c new file mode 100755 index 00000000000..e6a79782db0 --- /dev/null +++ b/lib/drivers/lwip/src/sys_arch.c @@ -0,0 +1,364 @@ +#include "lwip/sys.h" + +#include "lwip/tcp.h" +#include "lwip/pbuf.h" +#include "lwip/err.h" + +#include "rosip.h" + +#include + +static LIST_ENTRY ThreadListHead; +static KSPIN_LOCK ThreadListLock; + +KEVENT TerminationEvent; +NPAGED_LOOKASIDE_LIST MessageLookasideList; +NPAGED_LOOKASIDE_LIST QueueEntryLookasideList; + +static LARGE_INTEGER StartTime; + +typedef struct _thread_t +{ + HANDLE Handle; + void (* ThreadFunction)(void *arg); + void *ThreadContext; + LIST_ENTRY ListEntry; +} *thread_t; + +u32_t sys_now(void) +{ + LARGE_INTEGER CurrentTime; + + KeQuerySystemTime(&CurrentTime); + + return (CurrentTime.QuadPart - StartTime.QuadPart) / 10000; +} + +void +sys_arch_protect(sys_prot_t *lev) +{ + /* Preempt the dispatcher */ + KeRaiseIrql(DISPATCH_LEVEL, lev); +} + +void +sys_arch_unprotect(sys_prot_t lev) +{ + KeLowerIrql(lev); +} + +err_t +sys_sem_new(sys_sem_t *sem, u8_t count) +{ + ASSERT(count == 0 || count == 1); + + /* It seems lwIP uses the semaphore implementation as either a completion event or a lock + * so I optimize for this case by using a synchronization event and setting its initial state + * to signalled for a lock and non-signalled for a completion event */ + + KeInitializeEvent(&sem->Event, SynchronizationEvent, count); + + sem->Valid = 1; + + return ERR_OK; +} + +int sys_sem_valid(sys_sem_t *sem) +{ + return sem->Valid; +} + +void sys_sem_set_invalid(sys_sem_t *sem) +{ + sem->Valid = 0; +} + +void +sys_sem_free(sys_sem_t* sem) +{ + /* No op (allocated in stack) */ + + sys_sem_set_invalid(sem); +} + +void +sys_sem_signal(sys_sem_t* sem) +{ + KeSetEvent(&sem->Event, IO_NO_INCREMENT, FALSE); +} + +u32_t +sys_arch_sem_wait(sys_sem_t* sem, u32_t timeout) +{ + LARGE_INTEGER LargeTimeout, PreWaitTime, PostWaitTime; + UINT64 TimeDiff; + NTSTATUS Status; + PVOID WaitObjects[] = {&sem->Event, &TerminationEvent}; + + LargeTimeout.QuadPart = Int32x32To64(timeout, -10000); + + KeQuerySystemTime(&PreWaitTime); + + Status = KeWaitForMultipleObjects(2, + WaitObjects, + WaitAny, + Executive, + KernelMode, + FALSE, + timeout != 0 ? &LargeTimeout : NULL, + NULL); + if (Status == STATUS_WAIT_0) + { + KeQuerySystemTime(&PostWaitTime); + TimeDiff = PostWaitTime.QuadPart - PreWaitTime.QuadPart; + TimeDiff /= 10000; + + return TimeDiff; + } + else if (Status == STATUS_WAIT_1) + { + /* DON'T remove ourselves from the thread list! */ + PsTerminateSystemThread(STATUS_SUCCESS); + + /* We should never get here! */ + ASSERT(FALSE); + + return 0; + } + + return SYS_ARCH_TIMEOUT; +} + +err_t +sys_mbox_new(sys_mbox_t *mbox, int size) +{ + KeInitializeSpinLock(&mbox->Lock); + + InitializeListHead(&mbox->ListHead); + + KeInitializeEvent(&mbox->Event, NotificationEvent, FALSE); + + mbox->Valid = 1; + + return ERR_OK; +} + +int sys_mbox_valid(sys_mbox_t *mbox) +{ + return mbox->Valid; +} + +void sys_mbox_set_invalid(sys_mbox_t *mbox) +{ + mbox->Valid = 0; +} + +void +sys_mbox_free(sys_mbox_t *mbox) +{ + ASSERT(IsListEmpty(&mbox->ListHead)); + + sys_mbox_set_invalid(mbox); +} + +void +sys_mbox_post(sys_mbox_t *mbox, void *msg) +{ + PLWIP_MESSAGE_CONTAINER Container; + + Container = ExAllocatePool(NonPagedPool, sizeof(*Container)); + ASSERT(Container); + + Container->Message = msg; + + ExInterlockedInsertTailList(&mbox->ListHead, + &Container->ListEntry, + &mbox->Lock); + + KeSetEvent(&mbox->Event, IO_NO_INCREMENT, FALSE); +} + +u32_t +sys_arch_mbox_fetch(sys_mbox_t *mbox, void **msg, u32_t timeout) +{ + LARGE_INTEGER LargeTimeout, PreWaitTime, PostWaitTime; + UINT64 TimeDiff; + NTSTATUS Status; + PVOID Message; + PLWIP_MESSAGE_CONTAINER Container; + PLIST_ENTRY Entry; + KIRQL OldIrql; + PVOID WaitObjects[] = {&mbox->Event, &TerminationEvent}; + + LargeTimeout.QuadPart = Int32x32To64(timeout, -10000); + + KeQuerySystemTime(&PreWaitTime); + + Status = KeWaitForMultipleObjects(2, + WaitObjects, + WaitAny, + Executive, + KernelMode, + FALSE, + timeout != 0 ? &LargeTimeout : NULL, + NULL); + + if (Status == STATUS_WAIT_0) + { + KeAcquireSpinLock(&mbox->Lock, &OldIrql); + Entry = RemoveHeadList(&mbox->ListHead); + ASSERT(Entry); + if (IsListEmpty(&mbox->ListHead)) + KeClearEvent(&mbox->Event); + KeReleaseSpinLock(&mbox->Lock, OldIrql); + + Container = CONTAINING_RECORD(Entry, LWIP_MESSAGE_CONTAINER, ListEntry); + Message = Container->Message; + ExFreePool(Container); + + if (msg) + *msg = Message; + + KeQuerySystemTime(&PostWaitTime); + TimeDiff = PostWaitTime.QuadPart - PreWaitTime.QuadPart; + TimeDiff /= 10000; + + return TimeDiff; + } + else if (Status == STATUS_WAIT_1) + { + /* DON'T remove ourselves from the thread list! */ + PsTerminateSystemThread(STATUS_SUCCESS); + + /* We should never get here! */ + ASSERT(FALSE); + + return 0; + } + + return SYS_ARCH_TIMEOUT; +} + +u32_t +sys_arch_mbox_tryfetch(sys_mbox_t *mbox, void **msg) +{ + if (sys_arch_mbox_fetch(mbox, msg, 1) != SYS_ARCH_TIMEOUT) + return 0; + else + return SYS_MBOX_EMPTY; +} + +err_t +sys_mbox_trypost(sys_mbox_t *mbox, void *msg) +{ + sys_mbox_post(mbox, msg); + + return ERR_OK; +} + +VOID +NTAPI +LwipThreadMain(PVOID Context) +{ + thread_t Container = (thread_t)Context; + KIRQL OldIrql; + + ExInterlockedInsertHeadList(&ThreadListHead, &Container->ListEntry, &ThreadListLock); + + Container->ThreadFunction(Container->ThreadContext); + + KeAcquireSpinLock(&ThreadListLock, &OldIrql); + RemoveEntryList(&Container->ListEntry); + KeReleaseSpinLock(&ThreadListLock, OldIrql); + + ExFreePool(Container); + + PsTerminateSystemThread(STATUS_SUCCESS); +} + +sys_thread_t +sys_thread_new(const char *name, lwip_thread_fn thread, void *arg, int stacksize, int prio) +{ + thread_t Container; + NTSTATUS Status; + + Container = ExAllocatePool(NonPagedPool, sizeof(*Container)); + if (!Container) + return 0; + + Container->ThreadFunction = thread; + Container->ThreadContext = arg; + + Status = PsCreateSystemThread(&Container->Handle, + THREAD_ALL_ACCESS, + NULL, + NULL, + NULL, + LwipThreadMain, + Container); + + if (!NT_SUCCESS(Status)) + { + ExFreePool(Container); + return 0; + } + + return 0; +} + +void +sys_init(void) +{ + KeInitializeSpinLock(&ThreadListLock); + InitializeListHead(&ThreadListHead); + + KeQuerySystemTime(&StartTime); + + KeInitializeEvent(&TerminationEvent, NotificationEvent, FALSE); + + ExInitializeNPagedLookasideList(&MessageLookasideList, + NULL, + NULL, + 0, + sizeof(struct lwip_callback_msg), + LWIP_TAG, + 0); + + ExInitializeNPagedLookasideList(&QueueEntryLookasideList, + NULL, + NULL, + 0, + sizeof(QUEUE_ENTRY), + LWIP_TAG, + 0); +} + +void +sys_shutdown(void) +{ + PLIST_ENTRY CurrentEntry; + thread_t Container; + + /* Set the termination event */ + KeSetEvent(&TerminationEvent, IO_NO_INCREMENT, FALSE); + + /* Loop through the thread list and wait for each to die */ + while ((CurrentEntry = ExInterlockedRemoveHeadList(&ThreadListHead, &ThreadListLock))) + { + Container = CONTAINING_RECORD(CurrentEntry, struct _thread_t, ListEntry); + + if (Container->ThreadFunction) + { + KeWaitForSingleObject(Container->Handle, + Executive, + KernelMode, + FALSE, + NULL); + + ZwClose(Container->Handle); + } + } + + ExDeleteNPagedLookasideList(&MessageLookasideList); + ExDeleteNPagedLookasideList(&QueueEntryLookasideList); +} diff --git a/lib/drivers/lwip/test/unit/lwip_check.h b/lib/drivers/lwip/test/unit/lwip_check.h new file mode 100644 index 00000000000..d8984a127c2 --- /dev/null +++ b/lib/drivers/lwip/test/unit/lwip_check.h @@ -0,0 +1,37 @@ +#ifndef __LWIP_CHECK_H__ +#define __LWIP_CHECK_H__ + +/* Common header file for lwIP unit tests using the check framework */ + +#include +#include +#include + +#define FAIL_RET() do { fail(); return; } while(0) +#define EXPECT(x) fail_unless(x) +#define EXPECT_RET(x) do { fail_unless(x); if(!(x)) { return; }} while(0) +#define EXPECT_RETX(x, y) do { fail_unless(x); if(!(x)) { return y; }} while(0) +#define EXPECT_RETNULL(x) EXPECT_RETX(x, NULL) + +/** typedef for a function returning a test suite */ +typedef Suite* (suite_getter_fn)(void); + +/** Create a test suite */ +static Suite* create_suite(const char* name, TFun *tests, size_t num_tests, SFun setup, SFun teardown) +{ + size_t i; + Suite *s = suite_create(name); + + for(i = 0; i < num_tests; i++) { + // Core test case + TCase *tc_core = tcase_create("Core"); + if ((setup != NULL) || (teardown != NULL)) { + tcase_add_checked_fixture(tc_core, setup, teardown); + } + tcase_add_test(tc_core, tests[i]); + suite_add_tcase(s, tc_core); + } + return s; +} + +#endif /* __LWIP_CHECK_H__ */ diff --git a/lib/drivers/lwip/test/unit/lwip_unittests.c b/lib/drivers/lwip/test/unit/lwip_unittests.c new file mode 100644 index 00000000000..2dbeb6d45a7 --- /dev/null +++ b/lib/drivers/lwip/test/unit/lwip_unittests.c @@ -0,0 +1,42 @@ +#include "lwip_check.h" + +#include "udp/test_udp.h" +#include "tcp/test_tcp.h" +#include "tcp/test_tcp_oos.h" + +#include "lwip/init.h" + + +int main() +{ + int number_failed; + SRunner *sr; + size_t i; + suite_getter_fn* suites[] = { + udp_suite, + tcp_suite, + tcp_oos_suite, + }; + size_t num = sizeof(suites)/sizeof(void*); + LWIP_ASSERT("No suites defined", num > 0); + + lwip_init(); + + sr = srunner_create((suites[0])()); + for(i = 1; i < num; i++) { + srunner_add_suite(sr, ((suite_getter_fn*)suites[i])()); + } + +#ifdef LWIP_UNITTESTS_NOFORK + srunner_set_fork_status(sr, CK_NOFORK); +#endif +#ifdef LWIP_UNITTESTS_FORK + srunner_set_fork_status(sr, CK_FORK); +#endif + + srunner_run_all(sr, CK_NORMAL); + number_failed = srunner_ntests_failed(sr); + srunner_free(sr); + return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; +} + diff --git a/lib/drivers/lwip/test/unit/tcp/tcp_helper.c b/lib/drivers/lwip/test/unit/tcp/tcp_helper.c new file mode 100644 index 00000000000..0957cbe42ee --- /dev/null +++ b/lib/drivers/lwip/test/unit/tcp/tcp_helper.c @@ -0,0 +1,196 @@ +#include "tcp_helper.h" + +#include "lwip/tcp.h" +#include "lwip/stats.h" +#include "lwip/pbuf.h" +#include "lwip/inet_chksum.h" + +#if !LWIP_STATS || !TCP_STATS || !MEMP_STATS +#error "This tests needs TCP- and MEMP-statistics enabled" +#endif + +/** Remove all pcbs on the given list. */ +static void +tcp_remove(struct tcp_pcb* pcb_list) +{ + struct tcp_pcb *pcb = pcb_list; + struct tcp_pcb *pcb2; + + while(pcb != NULL) { + pcb2 = pcb; + pcb = pcb->next; + tcp_abort(pcb2); + } +} + +/** Remove all pcbs on listen-, active- and time-wait-list (bound- isn't exported). */ +void +tcp_remove_all(void) +{ + //tcp_remove(tcp_bound_pcbs); + tcp_remove(tcp_listen_pcbs.pcbs); + tcp_remove(tcp_active_pcbs); + tcp_remove(tcp_tw_pcbs); + fail_unless(lwip_stats.memp[MEMP_TCP_PCB].used == 0); + fail_unless(lwip_stats.memp[MEMP_TCP_PCB_LISTEN].used == 0); + fail_unless(lwip_stats.memp[MEMP_TCP_SEG].used == 0); + fail_unless(lwip_stats.memp[MEMP_PBUF_POOL].used == 0); +} + +/** Create a TCP segment usable for passing to tcp_input + * - IP-addresses, ports, seqno and ackno are taken from pcb + * - seqno and ackno can be altered with an offset + */ +struct pbuf* +tcp_create_rx_segment(struct tcp_pcb* pcb, void* data, size_t data_len, u32_t seqno_offset, + u32_t ackno_offset, u8_t headerflags) +{ + return tcp_create_segment(&pcb->remote_ip, &pcb->local_ip, pcb->remote_port, pcb->local_port, + data, data_len, pcb->rcv_nxt + seqno_offset, pcb->snd_nxt + ackno_offset, headerflags); +} + +/** Create a TCP segment usable for passing to tcp_input */ +struct pbuf* +tcp_create_segment(struct ip_addr* src_ip, struct ip_addr* dst_ip, + u16_t src_port, u16_t dst_port, void* data, size_t data_len, + u32_t seqno, u32_t ackno, u8_t headerflags) +{ + struct pbuf* p; + struct ip_hdr* iphdr; + struct tcp_hdr* tcphdr; + u16_t pbuf_len = sizeof(struct ip_hdr) + sizeof(struct tcp_hdr) + data_len; + + p = pbuf_alloc(PBUF_RAW, pbuf_len, PBUF_POOL); + EXPECT_RETNULL(p != NULL); + EXPECT_RETNULL(p->next == NULL); + + memset(p->payload, 0, p->len); + + iphdr = p->payload; + /* fill IP header */ + iphdr->dest.addr = dst_ip->addr; + iphdr->src.addr = src_ip->addr; + IPH_VHLTOS_SET(iphdr, 4, IP_HLEN / 4, 0); + IPH_LEN_SET(iphdr, htons(p->tot_len)); + IPH_CHKSUM_SET(iphdr, inet_chksum(iphdr, IP_HLEN)); + + pbuf_header(p, -(s16_t)sizeof(struct ip_hdr)); + + tcphdr = p->payload; + tcphdr->src = htons(src_port); + tcphdr->dest = htons(dst_port); + tcphdr->seqno = htonl(seqno); + tcphdr->ackno = htonl(ackno); + TCPH_HDRLEN_SET(tcphdr, sizeof(struct tcp_hdr)/4); + TCPH_FLAGS_SET(tcphdr, headerflags); + tcphdr->wnd = htonl(TCP_WND); + + /* copy data */ + memcpy((char*)tcphdr + sizeof(struct tcp_hdr), data, data_len); + + /* calculate checksum */ + tcphdr->chksum = inet_chksum_pseudo(p, &(iphdr->src), &(iphdr->dest), + IP_PROTO_TCP, p->tot_len); + + pbuf_header(p, sizeof(struct ip_hdr)); + + return p; +} + +/** Safely bring a tcp_pcb into the requested state */ +void +tcp_set_state(struct tcp_pcb* pcb, enum tcp_state state, struct ip_addr* local_ip, + struct ip_addr* remote_ip, u16_t local_port, u16_t remote_port) +{ + /* @todo: are these all states? */ + /* @todo: remove from previous list */ + pcb->state = state; + if (state == ESTABLISHED) { + TCP_REG(&tcp_active_pcbs, pcb); + pcb->local_ip.addr = local_ip->addr; + pcb->local_port = local_port; + pcb->remote_ip.addr = remote_ip->addr; + pcb->remote_port = remote_port; + } else if(state == LISTEN) { + TCP_REG(&tcp_listen_pcbs.pcbs, pcb); + pcb->local_ip.addr = local_ip->addr; + pcb->local_port = local_port; + } else if(state == TIME_WAIT) { + TCP_REG(&tcp_tw_pcbs, pcb); + pcb->local_ip.addr = local_ip->addr; + pcb->local_port = local_port; + pcb->remote_ip.addr = remote_ip->addr; + pcb->remote_port = remote_port; + } else { + fail(); + } +} + +void +test_tcp_counters_err(void* arg, err_t err) +{ + struct test_tcp_counters* counters = arg; + EXPECT_RET(arg != NULL); + counters->err_calls++; + counters->last_err = err; +} + +static void +test_tcp_counters_check_rxdata(struct test_tcp_counters* counters, struct pbuf* p) +{ + struct pbuf* q; + u32_t i, received; + if(counters->expected_data == NULL) { + /* no data to compare */ + return; + } + EXPECT_RET(counters->recved_bytes + p->tot_len <= counters->expected_data_len); + received = counters->recved_bytes; + for(q = p; q != NULL; q = q->next) { + char *data = q->payload; + for(i = 0; i < q->len; i++) { + EXPECT_RET(data[i] == counters->expected_data[received]); + received++; + } + } + EXPECT(received == counters->recved_bytes + p->tot_len); +} + +err_t +test_tcp_counters_recv(void* arg, struct tcp_pcb* pcb, struct pbuf* p, err_t err) +{ + struct test_tcp_counters* counters = arg; + EXPECT_RETX(arg != NULL, ERR_OK); + EXPECT_RETX(pcb != NULL, ERR_OK); + EXPECT_RETX(err == ERR_OK, ERR_OK); + + if (p != NULL) { + if (counters->close_calls == 0) { + counters->recv_calls++; + test_tcp_counters_check_rxdata(counters, p); + counters->recved_bytes += p->tot_len; + } else { + counters->recv_calls_after_close++; + counters->recved_bytes_after_close += p->tot_len; + } + pbuf_free(p); + } else { + counters->close_calls++; + } + EXPECT(counters->recv_calls_after_close == 0 && counters->recved_bytes_after_close == 0); + return ERR_OK; +} + +/** Allocate a pcb and set up the test_tcp_counters_* callbacks */ +struct tcp_pcb* +test_tcp_new_counters_pcb(struct test_tcp_counters* counters) +{ + struct tcp_pcb* pcb = tcp_new(); + if (pcb != NULL) { + /* set up args and callbacks */ + tcp_arg(pcb, counters); + tcp_recv(pcb, test_tcp_counters_recv); + tcp_err(pcb, test_tcp_counters_err); + } + return pcb; +} diff --git a/lib/drivers/lwip/test/unit/tcp/tcp_helper.h b/lib/drivers/lwip/test/unit/tcp/tcp_helper.h new file mode 100644 index 00000000000..b61e0f0af3a --- /dev/null +++ b/lib/drivers/lwip/test/unit/tcp/tcp_helper.h @@ -0,0 +1,36 @@ +#ifndef __TCP_HELPER_H__ +#define __TCP_HELPER_H__ + +#include "../lwip_check.h" +#include "lwip/arch.h" +#include "lwip/tcp.h" + +/* counters used for test_tcp_counters_* callback functions */ +struct test_tcp_counters { + u32_t recv_calls; + u32_t recved_bytes; + u32_t recv_calls_after_close; + u32_t recved_bytes_after_close; + u32_t close_calls; + u32_t err_calls; + err_t last_err; + char* expected_data; + u32_t expected_data_len; +}; + +/* Helper functions */ +void tcp_remove_all(void); + +struct pbuf* tcp_create_segment(struct ip_addr* src_ip, struct ip_addr* dst_ip, + u16_t src_port, u16_t dst_port, void* data, size_t data_len, + u32_t seqno, u32_t ackno, u8_t headerflags); +struct pbuf* tcp_create_rx_segment(struct tcp_pcb* pcb, void* data, size_t data_len, + u32_t seqno_offset, u32_t ackno_offset, u8_t headerflags); +void tcp_set_state(struct tcp_pcb* pcb, enum tcp_state state, struct ip_addr* local_ip, + struct ip_addr* remote_ip, u16_t local_port, u16_t remote_port); +void test_tcp_counters_err(void* arg, err_t err); +err_t test_tcp_counters_recv(void* arg, struct tcp_pcb* pcb, struct pbuf* p, err_t err); + +struct tcp_pcb* test_tcp_new_counters_pcb(struct test_tcp_counters* counters); + +#endif diff --git a/lib/drivers/lwip/test/unit/tcp/test_tcp.c b/lib/drivers/lwip/test/unit/tcp/test_tcp.c new file mode 100644 index 00000000000..350cb0cb93d --- /dev/null +++ b/lib/drivers/lwip/test/unit/tcp/test_tcp.c @@ -0,0 +1,104 @@ +#include "test_tcp.h" + +#include "lwip/tcp.h" +#include "lwip/stats.h" +#include "tcp_helper.h" + +#if !LWIP_STATS || !TCP_STATS || !MEMP_STATS +#error "This tests needs TCP- and MEMP-statistics enabled" +#endif + +/* Setups/teardown functions */ + +static void +tcp_setup(void) +{ + tcp_remove_all(); +} + +static void +tcp_teardown(void) +{ + tcp_remove_all(); +} + + +/* Test functions */ + +/** Call tcp_new() and tcp_abort() and test memp stats */ +START_TEST(test_tcp_new_abort) +{ + struct tcp_pcb* pcb; + LWIP_UNUSED_ARG(_i); + + fail_unless(lwip_stats.memp[MEMP_TCP_PCB].used == 0); + + pcb = tcp_new(); + fail_unless(pcb != NULL); + if (pcb != NULL) { + fail_unless(lwip_stats.memp[MEMP_TCP_PCB].used == 1); + tcp_abort(pcb); + fail_unless(lwip_stats.memp[MEMP_TCP_PCB].used == 0); + } +} +END_TEST + +/** Create an ESTABLISHED pcb and check if receive callback is called */ +START_TEST(test_tcp_recv_inseq) +{ + struct test_tcp_counters counters; + struct tcp_pcb* pcb; + struct pbuf* p; + char data[] = {1, 2, 3, 4}; + struct ip_addr remote_ip, local_ip; + u16_t data_len; + u16_t remote_port = 0x100, local_port = 0x101; + struct netif netif; + LWIP_UNUSED_ARG(_i); + + /* initialize local vars */ + memset(&netif, 0, sizeof(netif)); + IP4_ADDR(&local_ip, 192, 168, 1, 1); + IP4_ADDR(&remote_ip, 192, 168, 1, 2); + data_len = sizeof(data); + /* initialize counter struct */ + memset(&counters, 0, sizeof(counters)); + counters.expected_data_len = data_len; + counters.expected_data = data; + + /* create and initialize the pcb */ + pcb = test_tcp_new_counters_pcb(&counters); + EXPECT_RET(pcb != NULL); + tcp_set_state(pcb, ESTABLISHED, &local_ip, &remote_ip, local_port, remote_port); + + /* create a segment */ + p = tcp_create_rx_segment(pcb, counters.expected_data, data_len, 0, 0, 0); + EXPECT(p != NULL); + if (p != NULL) { + /* pass the segment to tcp_input */ + tcp_input(p, &netif); + /* check if counters are as expected */ + EXPECT(counters.close_calls == 0); + EXPECT(counters.recv_calls == 1); + EXPECT(counters.recved_bytes == data_len); + EXPECT(counters.err_calls == 0); + } + + /* make sure the pcb is freed */ + EXPECT(lwip_stats.memp[MEMP_TCP_PCB].used == 1); + tcp_abort(pcb); + EXPECT(lwip_stats.memp[MEMP_TCP_PCB].used == 0); +} +END_TEST + + +/** Create the suite including all tests for this module */ +Suite * +tcp_suite(void) +{ + TFun tests[] = { + test_tcp_new_abort, + test_tcp_recv_inseq, + }; + return create_suite("TCP", tests, sizeof(tests)/sizeof(TFun), tcp_setup, tcp_teardown); +} diff --git a/lib/drivers/lwip/test/unit/tcp/test_tcp.h b/lib/drivers/lwip/test/unit/tcp/test_tcp.h new file mode 100644 index 00000000000..f1c4a463f39 --- /dev/null +++ b/lib/drivers/lwip/test/unit/tcp/test_tcp.h @@ -0,0 +1,8 @@ +#ifndef __TEST_TCP_H__ +#define __TEST_TCP_H__ + +#include "../lwip_check.h" + +Suite *tcp_suite(void); + +#endif diff --git a/lib/drivers/lwip/test/unit/tcp/test_tcp_oos.c b/lib/drivers/lwip/test/unit/tcp/test_tcp_oos.c new file mode 100644 index 00000000000..8e4c7f4d0e7 --- /dev/null +++ b/lib/drivers/lwip/test/unit/tcp/test_tcp_oos.c @@ -0,0 +1,433 @@ +#include "test_tcp_oos.h" + +#include "lwip/tcp.h" +#include "lwip/stats.h" +#include "tcp_helper.h" + +#if !LWIP_STATS || !TCP_STATS || !MEMP_STATS +#error "This tests needs TCP- and MEMP-statistics enabled" +#endif +#if !TCP_QUEUE_OOSEQ +#error "This tests needs TCP_QUEUE_OOSEQ enabled" +#endif + +/** CHECK_SEGMENTS_ON_OOSEQ: + * 1: check count, seqno and len of segments on pcb->ooseq (strict) + * 0: only check that bytes are received in correct order (less strict) */ +#define CHECK_SEGMENTS_ON_OOSEQ 1 + +#if CHECK_SEGMENTS_ON_OOSEQ +#define EXPECT_OOSEQ(x) EXPECT(x) +#else +#define EXPECT_OOSEQ(x) +#endif + +/* helper functions */ + +/** Get the numbers of segments on the ooseq list */ +static int tcp_oos_count(struct tcp_pcb* pcb) +{ + int num = 0; + struct tcp_seg* seg = pcb->ooseq; + while(seg != NULL) { + num++; + seg = seg->next; + } + return num; +} + +/** Get the seqno of a segment (by index) on the ooseq list + * + * @param pcb the pcb to check for ooseq segments + * @param seg_index index of the segment on the ooseq list + * @return seqno of the segment + */ +static u32_t +tcp_oos_seg_seqno(struct tcp_pcb* pcb, int seg_index) +{ + int num = 0; + struct tcp_seg* seg = pcb->ooseq; + + /* then check the actual segment */ + while(seg != NULL) { + if(num == seg_index) { + return seg->tcphdr->seqno; + } + num++; + seg = seg->next; + } + fail(); + return 0; +} + +/** Get the tcplen of a segment (by index) on the ooseq list + * + * @param pcb the pcb to check for ooseq segments + * @param seg_index index of the segment on the ooseq list + * @return tcplen of the segment + */ +static int +tcp_oos_seg_tcplen(struct tcp_pcb* pcb, int seg_index) +{ + int num = 0; + struct tcp_seg* seg = pcb->ooseq; + + /* then check the actual segment */ + while(seg != NULL) { + if(num == seg_index) { + return TCP_TCPLEN(seg); + } + num++; + seg = seg->next; + } + fail(); + return -1; +} + +/* Setup/teardown functions */ + +static void +tcp_oos_setup(void) +{ + tcp_remove_all(); +} + +static void +tcp_oos_teardown(void) +{ + tcp_remove_all(); +} + + + +/* Test functions */ + +/** create multiple segments and pass them to tcp_input in a wrong + * order to see if ooseq-caching works correctly + * FIN is received in out-of-sequence segments only */ +START_TEST(test_tcp_recv_ooseq_FIN_OOSEQ) +{ + struct test_tcp_counters counters; + struct tcp_pcb* pcb; + struct pbuf *p_8_9, *p_4_8, *p_4_10, *p_2_14, *p_fin, *pinseq; + char data[] = { + 1, 2, 3, 4, + 5, 6, 7, 8, + 9, 10, 11, 12, + 13, 14, 15, 16}; + struct ip_addr remote_ip, local_ip; + u16_t data_len; + u16_t remote_port = 0x100, local_port = 0x101; + struct netif netif; + LWIP_UNUSED_ARG(_i); + + /* initialize local vars */ + memset(&netif, 0, sizeof(netif)); + IP4_ADDR(&local_ip, 192, 168, 1, 1); + IP4_ADDR(&remote_ip, 192, 168, 1, 2); + data_len = sizeof(data); + /* initialize counter struct */ + memset(&counters, 0, sizeof(counters)); + counters.expected_data_len = data_len; + counters.expected_data = data; + + /* create and initialize the pcb */ + pcb = test_tcp_new_counters_pcb(&counters); + EXPECT_RET(pcb != NULL); + tcp_set_state(pcb, ESTABLISHED, &local_ip, &remote_ip, local_port, remote_port); + + /* create segments */ + /* pinseq is sent as last segment! */ + pinseq = tcp_create_rx_segment(pcb, &data[0], 4, 0, 0, TCP_ACK); + /* p1: 8 bytes before FIN */ + /* seqno: 8..16 */ + p_8_9 = tcp_create_rx_segment(pcb, &data[8], 8, 8, 0, TCP_ACK|TCP_FIN); + /* p2: 4 bytes before p1, including the first 4 bytes of p1 (partly duplicate) */ + /* seqno: 4..11 */ + p_4_8 = tcp_create_rx_segment(pcb, &data[4], 8, 4, 0, TCP_ACK); + /* p3: same as p2 but 2 bytes longer */ + /* seqno: 4..13 */ + p_4_10 = tcp_create_rx_segment(pcb, &data[4], 10, 4, 0, TCP_ACK); + /* p4: 14 bytes before FIN, includes data from p1 and p2, plus partly from pinseq */ + /* seqno: 2..15 */ + p_2_14 = tcp_create_rx_segment(pcb, &data[2], 14, 2, 0, TCP_ACK); + /* FIN, seqno 16 */ + p_fin = tcp_create_rx_segment(pcb, NULL, 0,16, 0, TCP_ACK|TCP_FIN); + EXPECT(pinseq != NULL); + EXPECT(p_8_9 != NULL); + EXPECT(p_4_8 != NULL); + EXPECT(p_4_10 != NULL); + EXPECT(p_2_14 != NULL); + EXPECT(p_fin != NULL); + if ((pinseq != NULL) && (p_8_9 != NULL) && (p_4_8 != NULL) && (p_4_10 != NULL) && (p_2_14 != NULL) && (p_fin != NULL)) { + /* pass the segment to tcp_input */ + tcp_input(p_8_9, &netif); + /* check if counters are as expected */ + EXPECT(counters.close_calls == 0); + EXPECT(counters.recv_calls == 0); + EXPECT(counters.recved_bytes == 0); + EXPECT(counters.err_calls == 0); + /* check ooseq queue */ + EXPECT_OOSEQ(tcp_oos_count(pcb) == 1); + EXPECT_OOSEQ(tcp_oos_seg_seqno(pcb, 0) == 8); + EXPECT_OOSEQ(tcp_oos_seg_tcplen(pcb, 0) == 9); /* includes FIN */ + + /* pass the segment to tcp_input */ + tcp_input(p_4_8, &netif); + /* check if counters are as expected */ + EXPECT(counters.close_calls == 0); + EXPECT(counters.recv_calls == 0); + EXPECT(counters.recved_bytes == 0); + EXPECT(counters.err_calls == 0); + /* check ooseq queue */ + EXPECT_OOSEQ(tcp_oos_count(pcb) == 2); + EXPECT_OOSEQ(tcp_oos_seg_seqno(pcb, 0) == 4); + EXPECT_OOSEQ(tcp_oos_seg_tcplen(pcb, 0) == 4); + EXPECT_OOSEQ(tcp_oos_seg_seqno(pcb, 1) == 8); + EXPECT_OOSEQ(tcp_oos_seg_tcplen(pcb, 1) == 9); /* includes FIN */ + + /* pass the segment to tcp_input */ + tcp_input(p_4_10, &netif); + /* check if counters are as expected */ + EXPECT(counters.close_calls == 0); + EXPECT(counters.recv_calls == 0); + EXPECT(counters.recved_bytes == 0); + EXPECT(counters.err_calls == 0); + /* ooseq queue: unchanged */ + EXPECT_OOSEQ(tcp_oos_count(pcb) == 2); + EXPECT_OOSEQ(tcp_oos_seg_seqno(pcb, 0) == 4); + EXPECT_OOSEQ(tcp_oos_seg_tcplen(pcb, 0) == 4); + EXPECT_OOSEQ(tcp_oos_seg_seqno(pcb, 1) == 8); + EXPECT_OOSEQ(tcp_oos_seg_tcplen(pcb, 1) == 9); /* includes FIN */ + + /* pass the segment to tcp_input */ + tcp_input(p_2_14, &netif); + /* check if counters are as expected */ + EXPECT(counters.close_calls == 0); + EXPECT(counters.recv_calls == 0); + EXPECT(counters.recved_bytes == 0); + EXPECT(counters.err_calls == 0); + /* check ooseq queue */ + EXPECT_OOSEQ(tcp_oos_count(pcb) == 2); + EXPECT_OOSEQ(tcp_oos_seg_seqno(pcb, 0) == 2); + EXPECT_OOSEQ(tcp_oos_seg_tcplen(pcb, 0) == 6); + EXPECT_OOSEQ(tcp_oos_seg_seqno(pcb, 1) == 8); + EXPECT_OOSEQ(tcp_oos_seg_tcplen(pcb, 1) == 9); /* includes FIN */ + + /* pass the segment to tcp_input */ + tcp_input(p_fin, &netif); + /* check if counters are as expected */ + EXPECT(counters.close_calls == 0); + EXPECT(counters.recv_calls == 0); + EXPECT(counters.recved_bytes == 0); + EXPECT(counters.err_calls == 0); + /* ooseq queue: unchanged */ + EXPECT_OOSEQ(tcp_oos_count(pcb) == 2); + EXPECT_OOSEQ(tcp_oos_seg_seqno(pcb, 0) == 2); + EXPECT_OOSEQ(tcp_oos_seg_tcplen(pcb, 0) == 6); + EXPECT_OOSEQ(tcp_oos_seg_seqno(pcb, 1) == 8); + EXPECT_OOSEQ(tcp_oos_seg_tcplen(pcb, 1) == 9); /* includes FIN */ + + /* pass the segment to tcp_input */ + tcp_input(pinseq, &netif); + /* check if counters are as expected */ + EXPECT(counters.close_calls == 1); + EXPECT(counters.recv_calls == 1); + EXPECT(counters.recved_bytes == data_len); + EXPECT(counters.err_calls == 0); + EXPECT(pcb->ooseq == NULL); + } + + /* make sure the pcb is freed */ + EXPECT(lwip_stats.memp[MEMP_TCP_PCB].used == 1); + tcp_abort(pcb); + EXPECT(lwip_stats.memp[MEMP_TCP_PCB].used == 0); +} +END_TEST + + +/** create multiple segments and pass them to tcp_input in a wrong + * order to see if ooseq-caching works correctly + * FIN is received IN-SEQUENCE at the end */ +START_TEST(test_tcp_recv_ooseq_FIN_INSEQ) +{ + struct test_tcp_counters counters; + struct tcp_pcb* pcb; + struct pbuf *p_1_2, *p_4_8, *p_3_11, *p_2_12, *p_15_1, *p_15_1a, *pinseq, *pinseqFIN; + char data[] = { + 1, 2, 3, 4, + 5, 6, 7, 8, + 9, 10, 11, 12, + 13, 14, 15, 16}; + struct ip_addr remote_ip, local_ip; + u16_t data_len; + u16_t remote_port = 0x100, local_port = 0x101; + struct netif netif; + LWIP_UNUSED_ARG(_i); + + /* initialize local vars */ + memset(&netif, 0, sizeof(netif)); + IP4_ADDR(&local_ip, 192, 168, 1, 1); + IP4_ADDR(&remote_ip, 192, 168, 1, 2); + data_len = sizeof(data); + /* initialize counter struct */ + memset(&counters, 0, sizeof(counters)); + counters.expected_data_len = data_len; + counters.expected_data = data; + + /* create and initialize the pcb */ + pcb = test_tcp_new_counters_pcb(&counters); + EXPECT_RET(pcb != NULL); + tcp_set_state(pcb, ESTABLISHED, &local_ip, &remote_ip, local_port, remote_port); + + /* create segments */ + /* p1: 7 bytes - 2 before FIN */ + /* seqno: 1..2 */ + p_1_2 = tcp_create_rx_segment(pcb, &data[1], 2, 1, 0, TCP_ACK); + /* p2: 4 bytes before p1, including the first 4 bytes of p1 (partly duplicate) */ + /* seqno: 4..11 */ + p_4_8 = tcp_create_rx_segment(pcb, &data[4], 8, 4, 0, TCP_ACK); + /* p3: same as p2 but 2 bytes longer and one byte more at the front */ + /* seqno: 3..13 */ + p_3_11 = tcp_create_rx_segment(pcb, &data[3], 11, 3, 0, TCP_ACK); + /* p4: 13 bytes - 2 before FIN - should be ignored as contained in p1 and p3 */ + /* seqno: 2..13 */ + p_2_12 = tcp_create_rx_segment(pcb, &data[2], 12, 2, 0, TCP_ACK); + /* pinseq is the first segment that is held back to create ooseq! */ + /* seqno: 0..3 */ + pinseq = tcp_create_rx_segment(pcb, &data[0], 4, 0, 0, TCP_ACK); + /* p5: last byte before FIN */ + /* seqno: 15 */ + p_15_1 = tcp_create_rx_segment(pcb, &data[15], 1, 15, 0, TCP_ACK); + /* p6: same as p5, should be ignored */ + p_15_1a= tcp_create_rx_segment(pcb, &data[15], 1, 15, 0, TCP_ACK); + /* pinseqFIN: last 2 bytes plus FIN */ + /* only segment containing seqno 14 and FIN */ + pinseqFIN = tcp_create_rx_segment(pcb, &data[14], 2, 14, 0, TCP_ACK|TCP_FIN); + EXPECT(pinseq != NULL); + EXPECT(p_1_2 != NULL); + EXPECT(p_4_8 != NULL); + EXPECT(p_3_11 != NULL); + EXPECT(p_2_12 != NULL); + EXPECT(p_15_1 != NULL); + EXPECT(p_15_1a != NULL); + EXPECT(pinseqFIN != NULL); + if ((pinseq != NULL) && (p_1_2 != NULL) && (p_4_8 != NULL) && (p_3_11 != NULL) && (p_2_12 != NULL) + && (p_15_1 != NULL) && (p_15_1a != NULL) && (pinseqFIN != NULL)) { + /* pass the segment to tcp_input */ + tcp_input(p_1_2, &netif); + /* check if counters are as expected */ + EXPECT(counters.close_calls == 0); + EXPECT(counters.recv_calls == 0); + EXPECT(counters.recved_bytes == 0); + EXPECT(counters.err_calls == 0); + /* check ooseq queue */ + EXPECT_OOSEQ(tcp_oos_count(pcb) == 1); + EXPECT_OOSEQ(tcp_oos_seg_seqno(pcb, 0) == 1); + EXPECT_OOSEQ(tcp_oos_seg_tcplen(pcb, 0) == 2); + + /* pass the segment to tcp_input */ + tcp_input(p_4_8, &netif); + /* check if counters are as expected */ + EXPECT(counters.close_calls == 0); + EXPECT(counters.recv_calls == 0); + EXPECT(counters.recved_bytes == 0); + EXPECT(counters.err_calls == 0); + /* check ooseq queue */ + EXPECT_OOSEQ(tcp_oos_count(pcb) == 2); + EXPECT_OOSEQ(tcp_oos_seg_seqno(pcb, 0) == 1); + EXPECT_OOSEQ(tcp_oos_seg_tcplen(pcb, 0) == 2); + EXPECT_OOSEQ(tcp_oos_seg_seqno(pcb, 1) == 4); + EXPECT_OOSEQ(tcp_oos_seg_tcplen(pcb, 1) == 8); + + /* pass the segment to tcp_input */ + tcp_input(p_3_11, &netif); + /* check if counters are as expected */ + EXPECT(counters.close_calls == 0); + EXPECT(counters.recv_calls == 0); + EXPECT(counters.recved_bytes == 0); + EXPECT(counters.err_calls == 0); + /* check ooseq queue */ + EXPECT_OOSEQ(tcp_oos_count(pcb) == 2); + EXPECT_OOSEQ(tcp_oos_seg_seqno(pcb, 0) == 1); + EXPECT_OOSEQ(tcp_oos_seg_tcplen(pcb, 0) == 2); + /* p_3_11 has removed p_4_8 from ooseq */ + EXPECT_OOSEQ(tcp_oos_seg_seqno(pcb, 1) == 3); + EXPECT_OOSEQ(tcp_oos_seg_tcplen(pcb, 1) == 11); + + /* pass the segment to tcp_input */ + tcp_input(p_2_12, &netif); + /* check if counters are as expected */ + EXPECT(counters.close_calls == 0); + EXPECT(counters.recv_calls == 0); + EXPECT(counters.recved_bytes == 0); + EXPECT(counters.err_calls == 0); + /* check ooseq queue */ + EXPECT_OOSEQ(tcp_oos_count(pcb) == 3); + EXPECT_OOSEQ(tcp_oos_seg_seqno(pcb, 0) == 1); + EXPECT_OOSEQ(tcp_oos_seg_tcplen(pcb, 0) == 1); + EXPECT_OOSEQ(tcp_oos_seg_seqno(pcb, 1) == 2); + EXPECT_OOSEQ(tcp_oos_seg_tcplen(pcb, 1) == 1); + EXPECT_OOSEQ(tcp_oos_seg_seqno(pcb, 2) == 3); + EXPECT_OOSEQ(tcp_oos_seg_tcplen(pcb, 2) == 11); + + /* pass the segment to tcp_input */ + tcp_input(pinseq, &netif); + /* check if counters are as expected */ + EXPECT(counters.close_calls == 0); + EXPECT(counters.recv_calls == 1); + EXPECT(counters.recved_bytes == 14); + EXPECT(counters.err_calls == 0); + EXPECT(pcb->ooseq == NULL); + + /* pass the segment to tcp_input */ + tcp_input(p_15_1, &netif); + /* check if counters are as expected */ + EXPECT(counters.close_calls == 0); + EXPECT(counters.recv_calls == 1); + EXPECT(counters.recved_bytes == 14); + EXPECT(counters.err_calls == 0); + /* check ooseq queue */ + EXPECT_OOSEQ(tcp_oos_count(pcb) == 1); + EXPECT_OOSEQ(tcp_oos_seg_seqno(pcb, 0) == 15); + EXPECT_OOSEQ(tcp_oos_seg_tcplen(pcb, 0) == 1); + + /* pass the segment to tcp_input */ + tcp_input(p_15_1a, &netif); + /* check if counters are as expected */ + EXPECT(counters.close_calls == 0); + EXPECT(counters.recv_calls == 1); + EXPECT(counters.recved_bytes == 14); + EXPECT(counters.err_calls == 0); + /* check ooseq queue: unchanged */ + EXPECT_OOSEQ(tcp_oos_count(pcb) == 1); + EXPECT_OOSEQ(tcp_oos_seg_seqno(pcb, 0) == 15); + EXPECT_OOSEQ(tcp_oos_seg_tcplen(pcb, 0) == 1); + + /* pass the segment to tcp_input */ + tcp_input(pinseqFIN, &netif); + /* check if counters are as expected */ + EXPECT(counters.close_calls == 1); + EXPECT(counters.recv_calls == 2); + EXPECT(counters.recved_bytes == data_len); + EXPECT(counters.err_calls == 0); + EXPECT(pcb->ooseq == NULL); + } + + /* make sure the pcb is freed */ + EXPECT(lwip_stats.memp[MEMP_TCP_PCB].used == 1); + tcp_abort(pcb); + EXPECT(lwip_stats.memp[MEMP_TCP_PCB].used == 0); +} +END_TEST + +/** Create the suite including all tests for this module */ +Suite * +tcp_oos_suite(void) +{ + TFun tests[] = { + test_tcp_recv_ooseq_FIN_OOSEQ, + test_tcp_recv_ooseq_FIN_INSEQ, + }; + return create_suite("TCP_OOS", tests, sizeof(tests)/sizeof(TFun), tcp_oos_setup, tcp_oos_teardown); +} diff --git a/lib/drivers/lwip/test/unit/tcp/test_tcp_oos.h b/lib/drivers/lwip/test/unit/tcp/test_tcp_oos.h new file mode 100644 index 00000000000..5e411f00945 --- /dev/null +++ b/lib/drivers/lwip/test/unit/tcp/test_tcp_oos.h @@ -0,0 +1,8 @@ +#ifndef __TEST_TCP_OOS_H__ +#define __TEST_TCP_OOS_H__ + +#include "../lwip_check.h" + +Suite *tcp_oos_suite(void); + +#endif diff --git a/lib/drivers/lwip/test/unit/udp/test_udp.c b/lib/drivers/lwip/test/unit/udp/test_udp.c new file mode 100644 index 00000000000..d9b407e03b0 --- /dev/null +++ b/lib/drivers/lwip/test/unit/udp/test_udp.c @@ -0,0 +1,80 @@ +#include "test_udp.h" + +#include "lwip/udp.h" +#include "lwip/stats.h" + +#if !LWIP_STATS || !UDP_STATS || !MEMP_STATS +#error "This tests needs UDP- and MEMP-statistics enabled" +#endif + +/* Helper functions */ +static void +udp_remove_all(void) +{ + struct udp_pcb *pcb = udp_pcbs; + struct udp_pcb *pcb2; + + while(pcb != NULL) { + pcb2 = pcb; + pcb = pcb->next; + udp_remove(pcb2); + } + fail_unless(lwip_stats.memp[MEMP_UDP_PCB].used == 0); +} + +/* Setups/teardown functions */ + +static void +udp_setup(void) +{ + udp_remove_all(); +} + +static void +udp_teardown(void) +{ + udp_remove_all(); +} + + +/* Test functions */ + +START_TEST(test_udp_new_remove) +{ + struct udp_pcb* pcb; + LWIP_UNUSED_ARG(_i); + + fail_unless(lwip_stats.memp[MEMP_UDP_PCB].used == 0); + + pcb = udp_new(); + fail_unless(pcb != NULL); + if (pcb != NULL) { + fail_unless(lwip_stats.memp[MEMP_UDP_PCB].used == 1); + udp_remove(pcb); + fail_unless(lwip_stats.memp[MEMP_UDP_PCB].used == 0); + } +} +END_TEST + +START_TEST(test_udp_remove) +{ + struct udp_pcb* pcb; + LWIP_UNUSED_ARG(_i); + + pcb = NULL; + //pcb = udp_new(); + //fail_unless(pcb != NULL); +} +END_TEST + + +/** Create the suite including all tests for this module */ +Suite * +udp_suite(void) +{ + TFun tests[] = { + test_udp_new_remove, + test_udp_remove + }; + return create_suite("UDP", tests, sizeof(tests)/sizeof(TFun), udp_setup, udp_teardown); +} diff --git a/lib/drivers/lwip/test/unit/udp/test_udp.h b/lib/drivers/lwip/test/unit/udp/test_udp.h new file mode 100644 index 00000000000..93353682407 --- /dev/null +++ b/lib/drivers/lwip/test/unit/udp/test_udp.h @@ -0,0 +1,8 @@ +#ifndef __TEST_UDP_H__ +#define __TEST_UDP_H__ + +#include "../lwip_check.h" + +Suite* udp_suite(void); + +#endif diff --git a/lib/drivers/oskittcp/CMakeLists.txt b/lib/drivers/oskittcp/CMakeLists.txt deleted file mode 100644 index 232dbd7cf2e..00000000000 --- a/lib/drivers/oskittcp/CMakeLists.txt +++ /dev/null @@ -1,51 +0,0 @@ - -include_directories( - BEFORE include/freebsd/src/sys - include/freebsd - include/freebsd/sys/include - include/freebsd/dev/include - include/freebsd/net/include - include) - -add_definitions( - -D__NTDRIVER__ - -DKERNEL - -DOSKIT) - -list(APPEND SOURCE - oskittcp/defaults.c - oskittcp/in.c - oskittcp/in_cksum.c - oskittcp/in_pcb.c - oskittcp/in_proto.c - oskittcp/in_rmx.c - oskittcp/inet_ntoa.c - oskittcp/interface.c - oskittcp/ip_input.c - oskittcp/ip_output.c - oskittcp/kern_clock.c - oskittcp/kern_subr.c - oskittcp/osenv.c - oskittcp/param.c - oskittcp/radix.c - oskittcp/random.c - oskittcp/raw_cb.c - oskittcp/raw_ip.c - oskittcp/raw_usrreq.c - oskittcp/route.c - oskittcp/rtsock.c - oskittcp/scanc.c - oskittcp/sleep.c - oskittcp/tcp_input.c - oskittcp/tcp_output.c - oskittcp/tcp_subr.c - oskittcp/tcp_usrreq.c - oskittcp/tcp_debug.c - oskittcp/tcp_timer.c - oskittcp/uipc_domain.c - oskittcp/uipc_mbuf.c - oskittcp/uipc_socket.c - oskittcp/uipc_socket2.c) - -add_library(oskittcp ${SOURCE}) -add_dependencies(oskittcp bugcodes) diff --git a/lib/drivers/oskittcp/README b/lib/drivers/oskittcp/README deleted file mode 100644 index a78d4e5bbf0..00000000000 --- a/lib/drivers/oskittcp/README +++ /dev/null @@ -1,5 +0,0 @@ -These files are originally from the freebsd TCP stack contained on oskit. -Only files relevent to TCP are here, along with assorted interfaces that -are needed to make them useful. Overall, I intend this to implement a -generic, standalone TCP library that can be used with any IP machinery -required. diff --git a/lib/drivers/oskittcp/include/freebsd/dev/include/vm/vm.h b/lib/drivers/oskittcp/include/freebsd/dev/include/vm/vm.h deleted file mode 100644 index e80e426226e..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/dev/include/vm/vm.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 1997-1998 University of Utah and the Flux Group. - * All rights reserved. - * - * This file is part of the Flux OSKit. The OSKit is free software, also known - * as "open source;" you can redistribute it and/or modify it under the terms - * of the GNU General Public License (GPL), version 2, as published by the Free - * Software Foundation (FSF). To explore alternate licensing terms, contact - * the University of Utah at csl-dist@cs.utah.edu or +1-801-585-3271. - * - * The OSKit 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 GPL for more details. You should have - * received a copy of the GPL along with the OSKit; see the file COPYING. If - * not, write to the FSF, 59 Temple Place #330, Boston, MA 02111-1307, USA. - */ -/* - * here's vm.h's primary purpose in life: - * - * define `vm_map_t' for the first arg to kmem_alloc() - */ -#ifndef _FAKE_VM_H -#define _FAKE_VM_H - -typedef void *vm_map_t; - -#include - -/* - * XXX This is used by syscons to compute the address of the video buffer. - * This definition means the driver will only work when kva == pa. - * The real solution would be to modify the driver to map the buffer explicitly. - */ -#define vtophys(va) va - -/* - * ip_icmp.c and possibly other files rely on vm/vm.h to get sys/proc ... - */ -#include -#include - -#endif /* _FAKE_VM_H */ diff --git a/lib/drivers/oskittcp/include/freebsd/dev/include/vm/vm_param.h b/lib/drivers/oskittcp/include/freebsd/dev/include/vm/vm_param.h deleted file mode 100644 index db7c44a00ef..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/dev/include/vm/vm_param.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 1997-1998 University of Utah and the Flux Group. - * All rights reserved. - * - * This file is part of the Flux OSKit. The OSKit is free software, also known - * as "open source;" you can redistribute it and/or modify it under the terms - * of the GNU General Public License (GPL), version 2, as published by the Free - * Software Foundation (FSF). To explore alternate licensing terms, contact - * the University of Utah at csl-dist@cs.utah.edu or +1-801-585-3271. - * - * The OSKit 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 GPL for more details. You should have - * received a copy of the GPL along with the OSKit; see the file COPYING. If - * not, write to the FSF, 59 Temple Place #330, Boston, MA 02111-1307, USA. - */ -#ifndef _VM_PARAM_ -#define _VM_PARAM_ - -#include - -typedef int boolean_t; - -#define TRUE 1 -#define FALSE 0 - -#endif /* _VM_PARAM_ */ diff --git a/lib/drivers/oskittcp/include/freebsd/net/include/arpa/inet.h b/lib/drivers/oskittcp/include/freebsd/net/include/arpa/inet.h deleted file mode 100644 index 4fea33645b6..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/net/include/arpa/inet.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 1983, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)inet.h 8.1 (Berkeley) 6/2/93 - */ - -#ifndef _ARPA_INET_H_ -#define _ARPA_INET_H_ - -/* External definitions for functions in inet(3) */ - -#include - -__BEGIN_DECLS -#ifndef _WINSOCKAPI_ -unsigned long inet_addr __P((const char *)); -#endif//_WINSOCKAPI_ -int inet_aton __P((const char *, struct in_addr *)); -unsigned long inet_lnaof __P((struct in_addr)); -struct in_addr inet_makeaddr __P((u_long , u_long)); -unsigned long inet_netof __P((struct in_addr)); -unsigned long inet_network __P((const char *)); -#ifndef _WINSOCKAPI_ -char *inet_ntoa __P((struct in_addr)); -#endif//_WINSOCKAPI_ -__END_DECLS - -#endif /* !_INET_H_ */ diff --git a/lib/drivers/oskittcp/include/freebsd/net/include/imp.h b/lib/drivers/oskittcp/include/freebsd/net/include/imp.h deleted file mode 100644 index ef8ea49c607..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/net/include/imp.h +++ /dev/null @@ -1 +0,0 @@ -#define NIMP 0 diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/machine/ansi.h b/lib/drivers/oskittcp/include/freebsd/src/sys/machine/ansi.h deleted file mode 100644 index 7d84a8237ef..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/machine/ansi.h +++ /dev/null @@ -1,96 +0,0 @@ -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)ansi.h 8.2 (Berkeley) 1/4/94 - */ - -#ifndef _MACHINE_ANSI_H_ -#define _MACHINE_ANSI_H_ - -/* - * Types which are fundamental to the implementation and must be declared - * in more than one standard header are defined here. Standard headers - * then use: - * #ifdef _BSD_SIZE_T_ - * typedef _BSD_SIZE_T_ size_t; - * #undef _BSD_SIZE_T_ - * #endif - */ -#define _BSD_CLOCK_T_ unsigned long /* clock() */ -#define _BSD_PTRDIFF_T_ int /* ptr1 - ptr2 */ -#ifndef _BSD_SIZE_T_ -#define _BSD_SIZE_T_ unsigned int /* sizeof() */ -#endif -#define _BSD_SSIZE_T_ int /* byte count or error */ -#define _BSD_TIME_T_ long /* time() */ - -/* - * Types which are fundamental to the implementation and must be used - * in more than one standard header although they are only declared in - * one (perhaps nonstandard) header are defined here. Standard headers - * use _BSD_XXX_T_ without undef'ing it. - */ -#define _BSD_OFF_T_ long long /* file offset */ -#define _BSD_PID_T_ long /* process [group] */ -#define _BSD_VA_LIST_ char * /* va_list */ - -/* - * Runes (wchar_t) is declared to be an ``int'' instead of the more natural - * ``unsigned long'' or ``long''. Two things are happening here. It is not - * unsigned so that EOF (-1) can be naturally assigned to it and used. Also, - * it looks like 10646 will be a 31 bit standard. This means that if your - * ints cannot hold 32 bits, you will be in trouble. The reason an int was - * chosen over a long is that the is*() and to*() routines take ints (says - * ANSI C), but they use _RUNE_T_ instead of int. By changing it here, you - * lose a bit of ANSI conformance, but your programs will still work. - * - * Note that _WCHAR_T_ and _RUNE_T_ must be of the same type. When wchar_t - * and rune_t are typedef'd, _WCHAR_T_ will be undef'd, but _RUNE_T remains - * defined for ctype.h. - */ -#define _BSD_WCHAR_T_ int /* wchar_t */ -#define _BSD_RUNE_T_ int /* rune_t */ - -/* - * Frequencies of the clock ticks reported by clock() and times(). They - * are the same as stathz for bogus historical reasons. They should be - * 1e6 because clock() and times() are implemented using getrusage() and - * there is no good reason why they should be less accurate. There is - * the bad reason that (broken) programs might not like clock_t or - * CLOCKS_PER_SEC being ``double'' (``unsigned long'' is not large enough - * to hold the required 24 hours worth of ticks if the frequency is - * 1000000ul, and ``unsigned long long'' would be nonstandard). - */ -#define _BSD_CLK_TCK_ 128 -#define _BSD_CLOCKS_PER_SEC_ 128 - -#endif /* !_MACHINE_ANSI_H_ */ diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/machine/cpufunc.h b/lib/drivers/oskittcp/include/freebsd/src/sys/machine/cpufunc.h deleted file mode 100644 index e4df9871935..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/machine/cpufunc.h +++ /dev/null @@ -1,457 +0,0 @@ -/*- - * Copyright (c) 1993 The Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -/* - * Functions to provide access to special i386 instructions. - */ - -#ifndef _MACHINE_CPUFUNC_H_ -#define _MACHINE_CPUFUNC_H_ - -#include -#include - -#include /* XXX belongs elsewhere */ - -#ifdef __GNUC__ - -#ifdef BDE_DEBUGGER -extern int bdb_exists; - -static __inline int -bdb(void) -{ - if (!bdb_exists) - return (0); - __asm __volatile("int $3"); - return (1); -} -#endif /* BDE_DEBUGGER */ - -static __inline void -disable_intr(void) -{ -#ifdef OSKIT - osenv_intr_disable(); -#else - __asm __volatile("cli" : : : "memory"); -#endif -} - -static __inline void -enable_intr(void) -{ -#ifdef OSKIT - osenv_intr_enable(); -#else - __asm __volatile("sti"); -#endif -} - -#define HAVE_INLINE_FFS - -static __inline int -ffs(int mask) -{ - int result; - /* - * bsfl turns out to be not all that slow on 486's. It can beaten - * using a binary search to reduce to 4 bits and then a table lookup, - * but only if the code is inlined and in the cache, and the code - * is quite large so inlining it probably busts the cache. - * - * Note that gcc-2's builtin ffs would be used if we didn't declare - * this inline or turn off the builtin. The builtin is faster but - * broken in gcc-2.4.5 and slower but working in gcc-2.5 and 2.6. - */ - __asm __volatile("testl %0,%0; je 1f; bsfl %0,%0; incl %0; 1:" - : "=r" (result) : "0" (mask)); - return (result); -} - -#if __GNUC__ < 2 - -#define inb(port) inbv(port) -#define outb(port, data) outbv(port, data) - -#else /* __GNUC >= 2 */ - -/* - * The following complications are to get around gcc not having a - * constraint letter for the range 0..255. We still put "d" in the - * constraint because "i" isn't a valid constraint when the port - * isn't constant. This only matters for -O0 because otherwise - * the non-working version gets optimized away. - * - * Use an expression-statement instead of a conditional expression - * because gcc-2.6.0 would promote the operands of the conditional - * and produce poor code for "if ((inb(var) & const1) == const2)". - */ -#define inb(port) ({ \ - u_char _data; \ - if (__builtin_constant_p((int) (port)) && (port) < 256ul) \ - _data = inbc(port); \ - else \ - _data = inbv(port); \ - _data; }) - -#define outb(port, data) \ - (__builtin_constant_p((int) (port)) && (port) < 256ul \ - ? outbc(port, data) : outbv(port, data)) - -static __inline u_char -inbc(u_int port) -{ - u_char data; - - __asm __volatile("inb %1,%0" : "=a" (data) : "id" ((u_short)(port))); - return (data); -} - -static __inline void -outbc(u_int port, u_char data) -{ - __asm __volatile("outb %0,%1" : : "a" (data), "id" ((u_short)(port))); -} - -#endif /* __GNUC <= 2 */ - -static __inline u_char -inbv(u_int port) -{ - u_char data; - /* - * We use %%dx and not %1 here because i/o is done at %dx and not at - * %edx, while gcc generates inferior code (movw instead of movl) - * if we tell it to load (u_short) port. - */ - __asm __volatile("inb %%dx,%0" : "=a" (data) : "d" (port)); - return (data); -} - -static __inline u_long -inl(u_int port) -{ - u_long data; - - __asm __volatile("inl %%dx,%0" : "=a" (data) : "d" (port)); - return (data); -} - -static __inline void -insb(u_int port, void *addr, size_t cnt) -{ - __asm __volatile("cld; rep; insb" - : : "d" (port), "D" (addr), "c" (cnt) - : "di", "cx", "memory"); -} - -static __inline void -insw(u_int port, void *addr, size_t cnt) -{ - __asm __volatile("cld; rep; insw" - : : "d" (port), "D" (addr), "c" (cnt) - : "di", "cx", "memory"); -} - -static __inline void -insl(u_int port, void *addr, size_t cnt) -{ - __asm __volatile("cld; rep; insl" - : : "d" (port), "D" (addr), "c" (cnt) - : "di", "cx", "memory"); -} - -static __inline u_short -inw(u_int port) -{ - u_short data; - - __asm __volatile("inw %%dx,%0" : "=a" (data) : "d" (port)); - return (data); -} - -static __inline unsigned -loadandclear(u_int *addr) -{ - u_int result; - - __asm __volatile("xorl %0,%0; xchgl %1,%0" - : "=&r" (result) : "m" (*addr)); - return (result); -} - -static __inline void -outbv(u_int port, u_char data) -{ - u_char al; - /* - * Use an unnecessary assignment to help gcc's register allocator. - * This make a large difference for gcc-1.40 and a tiny difference - * for gcc-2.6.0. For gcc-1.40, al had to be ``asm("ax")'' for - * best results. gcc-2.6.0 can't handle this. - */ - al = data; - __asm __volatile("outb %0,%%dx" : : "a" (al), "d" (port)); -} - -static __inline void -outl(u_int port, u_long data) -{ - /* - * outl() and outw() aren't used much so we haven't looked at - * possible micro-optimizations such as the unnecessary - * assignment for them. - */ - __asm __volatile("outl %0,%%dx" : : "a" (data), "d" (port)); -} - -static __inline void -outsb(u_int port, void *addr, size_t cnt) -{ - __asm __volatile("cld; rep; outsb" - : : "d" (port), "S" (addr), "c" (cnt) - : "si", "cx"); -} - -static __inline void -outsw(u_int port, void *addr, size_t cnt) -{ - __asm __volatile("cld; rep; outsw" - : : "d" (port), "S" (addr), "c" (cnt) - : "si", "cx"); -} - -static __inline void -outsl(u_int port, void *addr, size_t cnt) -{ - __asm __volatile("cld; rep; outsl" - : : "d" (port), "S" (addr), "c" (cnt) - : "si", "cx"); -} - -static __inline void -outw(u_int port, u_short data) -{ - __asm __volatile("outw %0,%%dx" : : "a" (data), "d" (port)); -} - -static __inline void -pmap_update(void) -{ - u_long temp; - /* - * This should be implemented as load_cr3(rcr3()) when load_cr3() - * is inlined. - */ - __asm __volatile("movl %%cr3, %0; movl %0, %%cr3" : "=r" (temp) - : : "memory"); -} - -static __inline u_long -rcr2(void) -{ - u_long data; - - __asm __volatile("movl %%cr2,%0" : "=r" (data)); - return (data); -} - -static __inline u_long -read_eflags(void) -{ - u_long ef; - - __asm __volatile("pushfl; popl %0" : "=r" (ef)); - return (ef); -} - -static __inline void -write_eflags(u_long ef) -{ - __asm __volatile("pushl %0; popfl" : : "r" (ef)); -} - -#else /* !__GNUC__ */ - -int bdb __P((void)); -void disable_intr __P((void)); -void enable_intr __P((void)); -u_char inb __P((u_int port)); -u_long inl __P((u_int port)); -void insb __P((u_int port, void *addr, size_t cnt)); -void insl __P((u_int port, void *addr, size_t cnt)); -void insw __P((u_int port, void *addr, size_t cnt)); -u_short inw __P((u_int port)); -u_int loadandclear __P((u_int *addr)); -void outb __P((u_int port, u_char data)); -void outl __P((u_int port, u_long data)); -void outsb __P((u_int port, void *addr, size_t cnt)); -void outsl __P((u_int port, void *addr, size_t cnt)); -void outsw __P((u_int port, void *addr, size_t cnt)); -void outw __P((u_int port, u_short data)); -void pmap_update __P((void)); -u_long read_eflags __P((void)); -u_long rcr2 __P((void)); -void write_eflags __P((u_long ef)); - -#endif /* __GNUC__ */ - -/* - * XXX queue stuff belongs elsewhere. - */ -struct quehead { - struct quehead *qh_link; - struct quehead *qh_rlink; -}; - -static __inline void -insque(void *a, void *b) -{ - struct quehead *element = (struct quehead *)a, - *head = (struct quehead *)b; - - element->qh_link = head->qh_link; - element->qh_rlink = head; - head->qh_link = element; - element->qh_link->qh_rlink = element; -} - -static __inline void -remque(void *a) -{ - struct quehead *element = (struct quehead *)a; - - element->qh_link->qh_rlink = element->qh_rlink; - element->qh_rlink->qh_link = element->qh_link; - element->qh_rlink = 0; -} - -/* - * XXX the following declarations document garbage in support.s. - * gcc hasn't needed _divsi* for years. - * bcopy[bwx]() was used by pccons but isn't used now. - */ -int __divsi3 __P((int factor1, int factor2)); -u_int __udivsi3 __P((u_int factor1, u_int factor2)); -void bcopyb __P((const void *from, void *to, size_t len)); -void bcopyw __P((const void *from, void *to, size_t len)); -void bcopyx __P((const void *from, void *to, size_t len, - int stride)); - -#if 0 -/* - * These functions in support.s are declared elsewhere. - */ -void bcopy __P((const void *from, void *to, size_t len)); -void blkclr __P((void *buf, size_t len)); -void bzero __P((void *buf, size_t len)); -int copyin __P((void *udaddr, void *kaddr, size_t len)); -int copyinstr __P((void *udaddr, void *kaddr, size_t len, - size_t *lencopied)); -int copyout __P((void *kaddr, void *udaddr, size_t len)); -int copystr __P((void *kfaddr, void *kdaddr, size_t len, - size_t *lencopied)); -int fubyte __P((void *base)); -int fuswintr __P((void *base)); -int fuibyte __P((void *base)); -int fuword __P((void *base)); -struct region_descriptor; -void lgdt __P((struct region_descriptor *rdp)); -void lidt __P((struct region_descriptor *rdp)); -void lldt __P((u_short sel)); -/* - * longjmp() and setjmp() are only used by ddb. They probably shouldn't - * shouldn't be supported in the kernel. - */ -#include -void longjmp __P((jmp_buf jb, int rv)); -void ovbcopy __P((const void *from, void *to, size_t len); -int setjmp __P((jmp_buf jb)); -struct soft_segment_descriptor; -union descriptor; -int ssdtosd __P((struct soft_segment_descriptor *ssdp, - union descriptor *sdp)); -int subyte __P((void *base, int byte)); -int suibyte __P((void *base, int byte)); -int suswintr __P((void *base, int word)); -int suword __P((void *base, int word)); - -/* - * These functions in support.s are declared elsewhere, but never used. - * A silly amount of effort went into copyoutstr(). It's not worth - * maintaining, since the string length is usually known so copyout - * works better, or is easy to find so copyout() can be used. - */ -int copyoutstr __P((void *kaddr, void *udaddr, size_t len, - size_t *lencopied)); -int fuiword __P((void *base)); -int suiword __P((void *base, int word)); - -/* - * These functions in support.s are also in libkern.a and are declared in - * libkern.h. - * ffs() is built in to gcc-2 and was buggy in gcc-2.4.5 so we may may the - * buggy version if we don't replace it by an inline. - */ -int bcmp __P((const void *b1, const void *b2, size_t length)); -int ffs __P((int mask)); -#endif /* 0 */ - -/* - * These variables and functions in support.s are used. - */ -extern u_int atdevbase; /* offset in virtual memory of ISA io mem */ - -void filli __P((int pat, void *base, size_t cnt)); -void fillw __P((int /*u_short*/ pat, void *base, size_t cnt)); -int fusword __P((void *base)); -void load_cr0 __P((u_long cr0)); -void load_cr3 __P((u_long cr3)); -void ltr __P((u_short sel)); -u_int rcr0 __P((void)); -u_long rcr3 __P((void)); -int rtcin __P((int val)); - -/* - * These functions are NOT in support.s and should be declared elsewhere. - */ -void Debugger __P((const char *msg)); -u_long kvtop __P((void *addr)); -typedef void alias_for_inthand_t __P((u_int cs, u_int ef, u_int esp, - u_int ss)); -void setidt __P((int idx, alias_for_inthand_t *func, int typ, - int dpl, int selec)); - -#endif /* !_MACHINE_CPUFUNC_H_ */ diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/machine/endian.h b/lib/drivers/oskittcp/include/freebsd/src/sys/machine/endian.h deleted file mode 100644 index 0aeb4ad5f19..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/machine/endian.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 1987, 1991 Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: @(#)endian.h 7.8 (Berkeley) 4/3/91 - */ - -#ifndef _MACHINE_ENDIAN_H_ -#define _MACHINE_ENDIAN_H_ 1 - -/* - * Define the order of 32-bit words in 64-bit words. - */ -#define _QUAD_HIGHWORD 1 -#define _QUAD_LOWWORD 0 - -/* - * Definitions for byte order, according to byte significance from low - * address to high. - */ -#define LITTLE_ENDIAN 1234 /* LSB first: i386, vax */ -#define BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */ -#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */ - -#define BYTE_ORDER LITTLE_ENDIAN - -#ifndef KERNEL -#include -#endif - -#define __byte_swap_long RtlUlongByteSwap -#define __byte_swap_word RtlUshortByteSwap - -/* - * Macros for network/external number representation conversion. - */ -#if BYTE_ORDER == BIG_ENDIAN && !defined(lint) -#define ntohl(x) (x) -#define ntohs(x) (x) -#define htonl(x) (x) -#define htons(x) (x) - -#define NTOHL(x) (x) -#define NTOHS(x) (x) -#define HTONL(x) (x) -#define HTONS(x) (x) - -#else - -#define ntohl __byte_swap_long -#define ntohs __byte_swap_word -#define htonl __byte_swap_long -#define htons __byte_swap_word - -#define NTOHL(x) (x) = ntohl((u_long)x) -#define NTOHS(x) (x) = ntohs((u_short)x) -#define HTONL(x) (x) = htonl((u_long)x) -#define HTONS(x) (x) = htons((u_short)x) -#endif -#endif /* _MACHINE_ENDIAN_H_ */ diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/machine/ipl.h b/lib/drivers/oskittcp/include/freebsd/src/sys/machine/ipl.h deleted file mode 100644 index f006d9551b6..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/machine/ipl.h +++ /dev/null @@ -1,41 +0,0 @@ -/*- - * Copyright (c) 1993 The Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -#ifndef _ISA_IPL_H_ -#define _ISA_IPL_H_ - -#define NHWI 16 /* number of h/w interrupts */ -#define HWI_MASK 0xffff /* bits corresponding to h/w interrupts */ - -#endif /* _ISA_IPL_H_ */ diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/machine/limits.h b/lib/drivers/oskittcp/include/freebsd/src/sys/machine/limits.h deleted file mode 100644 index 7d2beb7534c..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/machine/limits.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 1988, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)limits.h 8.3 (Berkeley) 1/4/94 - */ - -#ifndef _MACHINE_LIMITS_H_ -#define _MACHINE_LIMITS_H_ - -#define CHAR_BIT 8 /* number of bits in a char */ -#ifndef __REACTOS__ -#define MB_LEN_MAX 6 /* Allow 31 bit UTF2 */ -#endif - -/* - * According to ANSI (section 2.2.4.2), the values below must be usable by - * #if preprocessing directives. Additionally, the expression must have the - * same type as would an expression that is an object of the corresponding - * type converted according to the integral promotions. The subtraction for - * INT_MIN and LONG_MIN is so the value is not unsigned; 2147483648 is an - * unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2). - * These numbers work for pcc as well. The UINT_MAX and ULONG_MAX values - * are written as hex so that GCC will be quiet about large integer constants. - */ -#define SCHAR_MAX 127 /* min value for a signed char */ -#define SCHAR_MIN (-128) /* max value for a signed char */ - -#ifndef _MSC_VER -#define UCHAR_MAX 255 /* max value for an unsigned char */ -#endif//_MSC_VER -#ifndef __REACTOS__ -#define CHAR_MAX 127 /* max value for a char */ -#define CHAR_MIN (-128) /* min value for a char */ -#endif - -#ifndef SHRT_MAX -#define USHRT_MAX 65535 /* max value for an unsigned short */ -#define SHRT_MAX 32767 /* max value for a short */ -#define SHRT_MIN (-32768) /* min value for a short */ -#endif - -#ifndef INT_MAX -#define UINT_MAX 0xffffffff /* max value for an unsigned int */ -#define INT_MAX 2147483647 /* max value for an int */ -#define INT_MIN (-2147483647-1) /* min value for an int */ -#endif - -#ifndef LONG_MAX -#define ULONG_MAX 0xffffffff /* max value for an unsigned long */ -#define LONG_MAX 2147483647 /* max value for a long */ -#define LONG_MIN (-2147483647-1) /* min value for a long */ -#endif - -#if !defined(_ANSI_SOURCE) -#define SSIZE_MAX INT_MAX /* max value for a ssize_t */ - -#if !defined(_POSIX_SOURCE) -#define SIZE_T_MAX UINT_MAX /* max value for a size_t */ - -/* GCC requires that quad constants be written as expressions. */ -#define UQUAD_MAX ((u_quad_t)0-1) /* max value for a uquad_t */ - /* max value for a quad_t */ -#define QUAD_MAX ((quad_t)(UQUAD_MAX >> 1)) -#define QUAD_MIN (-QUAD_MAX-1) /* min value for a quad_t */ - -#endif /* !_POSIX_SOURCE */ -#endif /* !_ANSI_SOURCE */ - -#endif /* !_MACHINE_LIMITS_H_ */ diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/machine/param.h b/lib/drivers/oskittcp/include/freebsd/src/sys/machine/param.h deleted file mode 100644 index 3926e8d380b..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/machine/param.h +++ /dev/null @@ -1,161 +0,0 @@ -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * William Jolitz. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: @(#)param.h 5.8 (Berkeley) 6/28/91 - */ - -#ifndef _MACHINE_PARAM_H_ -#define _MACHINE_PARAM_H_ - -/* - * Machine dependent constants for Intel 386. - */ - -#define MACHINE "i386" -#define MID_MACHINE MID_I386 - -/* - * Round p (pointer or byte index) up to a correctly-aligned value - * for all data types (int, long, ...). The result is unsigned int - * and must be cast to any desired pointer type. - */ -#define ALIGNBYTES (sizeof(int) - 1) -#define ALIGN(p) (((unsigned)(p) + ALIGNBYTES) & ~ALIGNBYTES) - -#ifndef PAGE_SIZE -/* XXX PGSHIFT and PG_SHIFT are two names for the same thing */ -#define PGSHIFT 12 /* LOG2(NBPG) */ -#define PAGE_SHIFT 12 -#define NBPG (1 << PAGE_SHIFT) /* bytes/page */ -#define PAGE_SIZE (1 << PAGE_SHIFT) -#define PAGE_MASK (PAGE_SIZE-1) -#define PGOFSET (NBPG-1) /* byte offset into page */ -#define NPTEPG (NBPG/(sizeof (pt_entry_t))) -#endif - -/* XXX PDRSHIFT and PD_SHIFT are two names for the same thing */ -#define PDRSHIFT 22 /* LOG2(NBPDR) */ -#define NBPDR (1 << PDRSHIFT) /* bytes/page dir */ -#define PDROFSET (NBPDR-1) /* byte offset into page dir */ - -/* - * XXX This should really be KPTDPTDI << PDRSHIFT, but since KPTDPTDI is - * defined in pmap.h which is included after this we can't do that - * (YET!) - */ -#define BTOPKERNBASE (KERNBASE >> PGSHIFT) - -#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ -#define DEV_BSIZE (1 << DEV_BSHIFT) - -#define BLKDEV_IOSIZE 2048 -#define MAXPHYS (64 * 1024) /* max raw I/O transfer size */ - -#define CLSIZELOG2 0 -#define CLSIZE (1 << CLSIZELOG2) - -/* NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE */ -#define SSIZE 1 /* initial stack size/NBPG */ -#define SINCR 1 /* increment of stack/NBPG */ - -#define UPAGES 2 /* pages of u-area */ - -/* - * Constants related to network buffer management. - * MCLBYTES must be no larger than CLBYTES (the software page size), and, - * on machines that exchange pages of input or output buffers with mbuf - * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple - * of the hardware page size. - */ -#ifndef MSIZE -#define MSIZE 128 /* size of an mbuf */ -#endif /* MSIZE */ - -#ifndef MCLSHIFT -#define MCLSHIFT 11 /* convert bytes to m_buf clusters */ -#endif /* MCLSHIFT */ -#define MCLBYTES (1 << MCLSHIFT) /* size of an m_buf cluster */ -#define MCLOFSET (MCLBYTES - 1) /* offset within an m_buf cluster */ - -/* - * Some macros for units conversion - */ -/* Core clicks (4096 bytes) to segments and vice versa */ -#define ctos(x) (x) -#define stoc(x) (x) - -/* Core clicks (4096 bytes) to disk blocks */ -#define ctod(x) ((x)<<(PGSHIFT-DEV_BSHIFT)) -#define dtoc(x) ((x)>>(PGSHIFT-DEV_BSHIFT)) -#define dtob(x) ((x)<>PGSHIFT) - -/* - * This is messy and perhaps slow because `bytes' may be an off_t. We - * have to shift an unsigned type to avoid sign extension and we don't - * want to widen `bytes' unnecessarily. Assume that off_t is long long - * and daddr_t is unsigned long. - */ -#define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ - (sizeof (bytes) > sizeof(long) \ - ? (unsigned long)((unsigned long long)(bytes) >> DEV_BSHIFT) \ - : (unsigned long)((unsigned long)(bytes) >> DEV_BSHIFT)) -#define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ - ((unsigned long long)(db) << DEV_BSHIFT) - -/* - * Mach derived conversion macros - */ -#define trunc_page(x) ((unsigned)(x) & ~(NBPG-1)) -#define round_page(x) ((((unsigned)(x)) + NBPG - 1) & ~(NBPG-1)) - -#define atop(x) ((unsigned)(x) >> PG_SHIFT) -#define ptoa(x) ((unsigned)(x) << PG_SHIFT) - -#define i386_round_pdr(x) ((((unsigned)(x)) + NBPDR - 1) & ~(NBPDR-1)) -#define i386_trunc_pdr(x) ((unsigned)(x) & ~(NBPDR-1)) -#define i386_round_page(x) ((((unsigned)(x)) + NBPG - 1) & ~(NBPG-1)) -#define i386_trunc_page(x) ((unsigned)(x) & ~(NBPG-1)) -#define i386_btod(x) ((unsigned)(x) >> PDRSHIFT) -#define i386_dtob(x) ((unsigned)(x) << PDRSHIFT) -#define i386_btop(x) ((unsigned)(x) >> PGSHIFT) -#define i386_ptob(x) ((unsigned)(x) << PGSHIFT) - -#endif /* !_MACHINE_PARAM_H_ */ diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/machine/proc.h b/lib/drivers/oskittcp/include/freebsd/src/sys/machine/proc.h deleted file mode 100644 index 583b10e2bd9..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/machine/proc.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 1991 Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: @(#)proc.h 7.1 (Berkeley) 5/15/91 - */ - -#ifndef _MACHINE_PROC_H_ -#define _MACHINE_PROC_H_ 1 - -/* - * Machine-dependent part of the proc structure for i386. - */ -struct mdproc { - int md_flags; /* machine-dependent flags */ - int *md_regs; /* registers on current frame */ -}; - -/* md_flags */ -#define MDP_AST 0x0001 /* async trap pending */ -#endif /* _MACHINE_PROC_H_ */ diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/machine/signal.h b/lib/drivers/oskittcp/include/freebsd/src/sys/machine/signal.h deleted file mode 100644 index e1ede966902..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/machine/signal.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 1986, 1989, 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)signal.h 8.1 (Berkeley) 6/11/93 - */ - -#ifndef _I386_MACHINE_SIGNAL_H_ -#define _I386_MACHINE_SIGNAL_H_ - -/* - * Machine-dependent signal definitions - */ - -typedef int sig_atomic_t; - -#ifndef _POSIX_SOURCE -#include /* codes for SIGILL, SIGFPE */ -#endif - -/* - * Information pushed on stack when a signal is delivered. - * This is used by the kernel to restore state following - * execution of the signal handler. It is also made available - * to the handler to allow it to restore state properly if - * a non-standard exit is performed. - */ -struct sigcontext { - int sc_onstack; /* sigstack state to restore */ - int sc_mask; /* signal mask to restore */ - int sc_esp; /* machine state */ - int sc_ebp; - int sc_isp; - int sc_eip; - int sc_efl; - int sc_es; - int sc_ds; - int sc_cs; - int sc_ss; - int sc_edi; - int sc_esi; - int sc_ebx; - int sc_edx; - int sc_ecx; - int sc_eax; -# define sc_sp sc_esp -# define sc_fp sc_ebp -# define sc_pc sc_eip -# define sc_ps sc_efl -}; - -#endif diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/machine/spl.h b/lib/drivers/oskittcp/include/freebsd/src/sys/machine/spl.h deleted file mode 100644 index bb59490279e..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/machine/spl.h +++ /dev/null @@ -1,229 +0,0 @@ -/* - * Copyright (c) 1996-1999 University of Utah and the Flux Group. - * All rights reserved. - * - * This file is part of the Flux OSKit. The OSKit is free software, also known - * as "open source;" you can redistribute it and/or modify it under the terms - * of the GNU General Public License (GPL), version 2, as published by the Free - * Software Foundation (FSF). To explore alternate licensing terms, contact - * the University of Utah at csl-dist@cs.utah.edu or +1-801-585-3271. - * - * The OSKit 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 GPL for more details. You should have - * received a copy of the GPL along with the OSKit; see the file COPYING. If - * not, write to the FSF, 59 Temple Place #330, Boston, MA 02111-1307, USA. - */ -/*- - * Copyright (c) 1993 The Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -#ifndef _MACHINE_IPL_H_ -#define _MACHINE_IPL_H_ - -#include /* XXX "machine" means cpu for i386 */ - -/* - * Software interrupt bit numbers in priority order. The priority only - * determines which swi will be dispatched next; a higher priority swi - * may be dispatched when a nested h/w interrupt handler returns. - */ -#define SWI_TTY (NHWI + 0) -#define SWI_NET (NHWI + 1) -#define SWI_CLOCK 30 -#define SWI_AST 31 - -/* - * Corresponding interrupt-pending bits for ipending. - */ -#define SWI_TTY_PENDING (1 << SWI_TTY) -#define SWI_NET_PENDING (1 << SWI_NET) -#define SWI_CLOCK_PENDING (1 << SWI_CLOCK) -#define SWI_AST_PENDING (1 << SWI_AST) - -/* - * Corresponding interrupt-disable masks for cpl. The ordering is now by - * inclusion (where each mask is considered as a set of bits). Everything - * except SWI_AST_MASK includes SWI_CLOCK_MASK so that softclock() doesn't - * run while other swi handlers are running and timeout routines can call - * swi handlers. Everything includes SWI_AST_MASK so that AST's are masked - * until just before return to user mode. SWI_TTY_MASK includes SWI_NET_MASK - * in case tty interrupts are processed at splsofttty() for a tty that is in - * SLIP or PPP line discipline (this is weaker than merging net_imask with - * tty_imask in isa.c - splimp() must mask hard and soft tty interrupts, but - * spltty() apparently only needs to mask soft net interrupts). - */ -#define SWI_TTY_MASK (SWI_TTY_PENDING | SWI_CLOCK_MASK | SWI_NET_MASK) -#define SWI_NET_MASK (SWI_NET_PENDING | SWI_CLOCK_MASK) -#define SWI_CLOCK_MASK (SWI_CLOCK_PENDING | SWI_AST_MASK) -#define SWI_AST_MASK SWI_AST_PENDING -#define SWI_MASK (~HWI_MASK) - -#ifdef OSKIT -#include "osenv.h" - -extern unsigned oskit_freebsd_cpl; -extern unsigned oskit_freebsd_ipending; - -#define GENERIC_SPL(you_name_it) \ -static __inline int spl##you_name_it(void) \ -{ \ - int t; \ - osenv_intr_disable(); \ - t = oskit_freebsd_cpl; \ - oskit_freebsd_cpl = 1; \ - return t; \ -} - -GENERIC_SPL(imp) -GENERIC_SPL(net) -GENERIC_SPL(bio) -GENERIC_SPL(high) -GENERIC_SPL(clock) -GENERIC_SPL(tty) -GENERIC_SPL(softtty) -/* - * this is used to reduce the clock spl to a softclock spl before - * calling the softclock handler directly. It will never call splx! - */ -#define splsoftclock() 0 - -static __inline void splx(int x) -{ - if (x == 0) { - oskit_freebsd_cpl = 0; - osenv_intr_enable(); - } -} - -/* for code from NetBSD */ -#define spl0() splx(0) - -#define setsoftclock() (oskit_freebsd_ipending |= SWI_CLOCK_PENDING) -#define setsofttty() (oskit_freebsd_ipending |= SWI_TTY_PENDING) - -#define schedsofttty() (oskit_freebsd_ipending |= SWI_TTY_PENDING) - -/* - * functions to save and restore the current cpl - */ -static __inline void save_cpl(unsigned *x) -{ - *x = oskit_freebsd_cpl; -} - -static __inline void restore_cpl(unsigned x) -{ - oskit_freebsd_cpl = x; -} - -#else /* !OSKIT */ -#ifndef LOCORE - -extern unsigned bio_imask; /* group of interrupts masked with splbio() */ -extern unsigned cpl; /* current priority level mask */ -extern volatile unsigned idelayed; /* interrupts to become pending */ -extern volatile unsigned ipending; /* active interrupts masked by cpl */ -extern unsigned net_imask; /* group of interrupts masked with splimp() */ -extern unsigned stat_imask; /* interrupts masked with splstatclock() */ -extern unsigned tty_imask; /* group of interrupts masked with spltty() */ - -/* - * ipending has to be volatile so that it is read every time it is accessed - * in splx() and spl0(), but we don't want it to be read nonatomically when - * it is changed. Pretending that ipending is a plain int happens to give - * suitable atomic code for "ipending |= constant;". - */ -#define setdelayed() (*(unsigned *)&ipending |= loadandclear(&idelayed)) -#define setsoftast() (*(unsigned *)&ipending |= SWI_AST_PENDING) -#define setsoftclock() (*(unsigned *)&ipending |= SWI_CLOCK_PENDING) -#define setsoftnet() (*(unsigned *)&ipending |= SWI_NET_PENDING) -#define setsofttty() (*(unsigned *)&ipending |= SWI_TTY_PENDING) - -#define schedsofttty() (*(unsigned *)&idelayed |= SWI_TTY_PENDING) - -#ifdef _MSC_VER - -static int splhigh() { return 0; } -static int splimp() { return 0; } -static int splnet() { return 0; } -static int splx(x) { return 0; } -static int splclock() { return 0; } - -#elif defined(__GNUC__) - -void splz __P((void)); - -#define GENSPL(name, set_cpl) \ -static __inline int name(void) \ -{ \ - unsigned x; \ - \ - __asm __volatile("" : : : "memory"); \ - x = cpl; \ - set_cpl; \ - return (x); \ -} - -GENSPL(splbio, cpl |= bio_imask) -GENSPL(splclock, cpl = HWI_MASK | SWI_MASK) -GENSPL(splhigh, cpl = HWI_MASK | SWI_MASK) -GENSPL(splimp, cpl |= net_imask) -GENSPL(splnet, cpl |= SWI_NET_MASK) -GENSPL(splsoftclock, cpl = SWI_CLOCK_MASK) -GENSPL(splsofttty, cpl |= SWI_TTY_MASK) -GENSPL(splstatclock, cpl |= stat_imask) -GENSPL(spltty, cpl |= tty_imask) - -static __inline void -spl0(void) -{ - cpl = SWI_AST_MASK; - if (ipending & ~SWI_AST_MASK) - splz(); -} - -static __inline void -splx(int ipl) -{ - cpl = ipl; - if (ipending & ~ipl) - splz(); -} - -#endif /* __GNUC__ */ - -#endif /* !LOCORE */ -#endif /* !OSKIT */ - -#endif /* !_MACHINE_IPL_H_ */ diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/machine/trap.h b/lib/drivers/oskittcp/include/freebsd/src/sys/machine/trap.h deleted file mode 100644 index bd136824224..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/machine/trap.h +++ /dev/null @@ -1,95 +0,0 @@ -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * William Jolitz. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: @(#)trap.h 5.4 (Berkeley) 5/9/91 - */ - -#ifndef _MACHINE_TRAP_H_ -#define _MACHINE_TRAP_H_ - -/* - * Trap type values - * also known in trap.c for name strings - */ - -#define T_PRIVINFLT 1 /* privileged instruction */ -#define T_BPTFLT 3 /* breakpoint instruction */ -#define T_ARITHTRAP 6 /* arithmetic trap */ -#define T_ASTFLT 7 /* system forced exception */ -#define T_PROTFLT 9 /* protection fault */ -#define T_TRCTRAP 10 /* debug exception (sic) */ -#define T_PAGEFLT 12 /* page fault */ -#define T_ALIGNFLT 14 /* alignment fault */ - -#define T_DIVIDE 18 /* integer divide fault */ -#define T_NMI 19 /* non-maskable trap */ -#define T_OFLOW 20 /* overflow trap */ -#define T_BOUND 21 /* bound instruction fault */ -#define T_DNA 22 /* device not available fault */ -#define T_DOUBLEFLT 23 /* double fault */ -#define T_FPOPFLT 24 /* fp coprocessor operand fetch fault */ -#define T_TSSFLT 25 /* invalid tss fault */ -#define T_SEGNPFLT 26 /* segment not present fault */ -#define T_STKFLT 27 /* stack fault */ -#define T_RESERVED 28 /* reserved (unknown) */ - -/* XXX most of the following codes aren't used, but could be. */ - -/* definitions for */ -#define ILL_RESAD_FAULT T_RESADFLT -#define ILL_PRIVIN_FAULT T_PRIVINFLT -#define ILL_RESOP_FAULT T_RESOPFLT -#define ILL_ALIGN_FAULT T_ALIGNFLT -#define ILL_FPOP_FAULT T_FPOPFLT /* coprocessor operand fault */ - -/* codes for SIGFPE/ARITHTRAP */ -#define FPE_INTOVF_TRAP 0x1 /* integer overflow */ -#define FPE_INTDIV_TRAP 0x2 /* integer divide by zero */ -#define FPE_FLTDIV_TRAP 0x3 /* floating/decimal divide by zero */ -#define FPE_FLTOVF_TRAP 0x4 /* floating overflow */ -#define FPE_FLTUND_TRAP 0x5 /* floating underflow */ -#define FPE_FPU_NP_TRAP 0x6 /* floating point unit not present */ -#define FPE_SUBRNG_TRAP 0x7 /* subrange out of bounds */ - -/* codes for SIGBUS */ -#define BUS_PAGE_FAULT T_PAGEFLT /* page fault protection base */ -#define BUS_SEGNP_FAULT T_SEGNPFLT /* segment not present */ -#define BUS_STK_FAULT T_STKFLT /* stack segment */ -#define BUS_SEGM_FAULT T_RESERVED /* segment protection base */ - -/* Trap's coming from user mode */ -#define T_USER 0x100 - -#endif /* !_MACHINE_TRAP_H_ */ diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/machine/types.h b/lib/drivers/oskittcp/include/freebsd/src/sys/machine/types.h deleted file mode 100644 index 2e89ab66200..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/machine/types.h +++ /dev/null @@ -1,70 +0,0 @@ -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)types.h 8.3 (Berkeley) 1/5/94 - */ - -#ifndef _MACHTYPES_H_ -#define _MACHTYPES_H_ - -#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) -typedef struct _physadr { - int r[1]; -} *physadr; - -typedef struct label_t { - int val[6]; -} label_t; -#endif - -typedef unsigned long vm_offset_t; -typedef unsigned long vm_size_t; - -/* - * Basic integral types. Omit the typedef if - * not possible for a machine/compiler combination. - */ -typedef __signed char int8_t; -typedef unsigned char u_int8_t; -typedef short int16_t; -typedef unsigned short u_int16_t; -typedef int int32_t; -typedef unsigned int u_int32_t; -#ifdef _MSC_VER -typedef __int64 int64_t; -typedef unsigned __int64 u_int64_t; -#else -typedef long long int64_t; -typedef unsigned long long u_int64_t; -#endif - -#endif /* _MACHTYPES_H_ */ diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/machine/vmparam.h b/lib/drivers/oskittcp/include/freebsd/src/sys/machine/vmparam.h deleted file mode 100644 index d5944b3d62b..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/machine/vmparam.h +++ /dev/null @@ -1,136 +0,0 @@ -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * Copyright (c) 1994 John S. Dyson - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * William Jolitz. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: @(#)vmparam.h 5.9 (Berkeley) 5/12/91 - */ - - -#ifndef _MACHINE_VMPARAM_H_ -#define _MACHINE_VMPARAM_H_ 1 - -/* - * Machine dependent constants for 386. - */ - -/* - * Virtual memory related constants, all in bytes - */ -#define MAXTSIZ (16UL*1024*1024) /* max text size */ -#ifndef DFLDSIZ -#define DFLDSIZ (64UL*1024*1024) /* initial data size limit */ -#endif -#ifndef MAXDSIZ -#define MAXDSIZ (128UL*1024*1024) /* max data size */ -#endif -#ifndef DFLSSIZ -#define DFLSSIZ (8UL*1024*1024) /* initial stack size limit */ -#endif -#ifndef MAXSSIZ -#define MAXSSIZ (64UL*1024*1024) /* max stack size */ -#endif -#ifndef SGROWSIZ -#define SGROWSIZ (128UL*1024) /* amount to grow stack */ -#endif - -#define USRTEXT (1*NBPG) /* base of user text XXX bogus */ - -/* - * Default sizes of swap allocation chunks (see dmap.h). - * The actual values may be changed in vminit() based on MAXDSIZ. - * With MAXDSIZ of 16Mb and NDMAP of 38, dmmax will be 1024. - */ -#define DMMIN 32 /* smallest swap allocation */ -#define DMMAX 4096 /* largest potential swap allocation */ -#define DMTEXT 1024 /* swap allocation for text */ - -/* - * Sizes of the system and user portions of the system page table. - */ -#define SYSPTSIZE (2*NPTEPG) -#define USRPTSIZE (2*NPTEPG) - -/* - * Size of the Shared Memory Pages page table. - */ -#ifndef SHMMAXPGS -#define SHMMAXPGS 1024 /* XXX until we have more kmap space */ -#endif - -/* - * Size of User Raw I/O map - */ -#define USRIOSIZE 1024 - -/* - * The time for a process to be blocked before being very swappable. - * This is a number of seconds which the system takes as being a non-trivial - * amount of real time. You probably shouldn't change this; - * it is used in subtle ways (fractions and multiples of it are, that is, like - * half of a ``long time'', almost a long time, etc.) - * It is related to human patience and other factors which don't really - * change over time. - */ -#define MAXSLP 20 - -/* - * Mach derived constants - */ - -/* user/kernel map constants */ -#ifdef OSKIT -#define KERNBASE 0 /* XXX */ -#else -#define KERNBASE ((0x400-1-NKPDE)*(NBPG*NPTEPG)) -#endif - -#define VM_MIN_ADDRESS ((vm_offset_t)0) -#define VM_MAXUSER_ADDRESS ((vm_offset_t)KERNBASE - (NBPG*(NPTEPG+UPAGES))) -#define USRSTACK VM_MAXUSER_ADDRESS -#define UPT_MIN_ADDRESS ((vm_offset_t)KERNBASE - (NBPG*NPTEPG)) -#define UPT_MAX_ADDRESS ((vm_offset_t)KERNBASE - (NBPG*(NKPDE+2))) -#define VM_MAX_ADDRESS UPT_MAX_ADDRESS -#define VM_MIN_KERNEL_ADDRESS ((vm_offset_t)KERNBASE - (NBPG*(NKPDE+2))) -#define UPDT VM_MIN_KERNEL_ADDRESS -#define KPT_MIN_ADDRESS ((vm_offset_t)KERNBASE - NBPG*(NKPDE+1)) -#define KPT_MAX_ADDRESS ((vm_offset_t)KERNBASE - NBPG) -#define VM_MAX_KERNEL_ADDRESS ((vm_offset_t)KERNBASE + NKPDE*NBPG*NPTEPG) - -/* virtual sizes (bytes) for various kernel submaps */ -#define VM_KMEM_SIZE (32 * 1024 * 1024) -#define VM_PHYS_SIZE (USRIOSIZE*CLBYTES) - -#endif /* _MACHINE_VMPARAM_H_ */ diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/net/if.h b/lib/drivers/oskittcp/include/freebsd/src/sys/net/if.h deleted file mode 100644 index 39e524d15d8..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/net/if.h +++ /dev/null @@ -1,398 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1989, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)if.h 8.1 (Berkeley) 6/10/93 - * $\Id: if.h,v 1.18.4.1 1996/06/24 22:04:13 gpalmer Exp $ - */ - -#ifndef _NET_IF_H_ -#define _NET_IF_H_ - -/* - * Structures defining a network interface, providing a packet - * transport mechanism (ala level 0 of the PUP protocols). - * - * Each interface accepts output datagrams of a specified maximum - * length, and provides higher level routines with input datagrams - * received from its medium. - * - * Output occurs when the routine if_output is called, with three parameters: - * (*ifp->if_output)(ifp, m, dst, rt) - * Here m is the mbuf chain to be sent and dst is the destination address. - * The output routine encapsulates the supplied datagram if necessary, - * and then transmits it on its medium. - * - * On input, each interface unwraps the data received by it, and either - * places it on the input queue of a internetwork datagram routine - * and posts the associated software interrupt, or passes the datagram to a raw - * packet input routine. - * - * Routines exist for locating interfaces by their addresses - * or for locating a interface on a certain network, as well as more general - * routing and gateway routines maintaining information used to locate - * interfaces. These routines live in the files if.c and route.c - */ - -#include /* for struct sockaddr */ - -#ifndef _TIME_ /* XXX fast fix for SNMP, going away soon */ -#include -#endif - -#ifdef __STDC__ -/* - * Forward structure declarations for function prototypes [sic]. - */ -struct mbuf; -struct proc; -struct rtentry; -struct socket; -struct ether_header; -#endif -/* - * Structure describing information about an interface - * which may be of interest to management entities. - */ -/* - * Structure defining a queue for a network interface. - * - * (Would like to call this struct ``if'', but C isn't PL/1.) - */ - - struct if_data { -/* generic interface information */ - u_char ifi_type; /* ethernet, tokenring, etc */ - u_char ifi_physical; /* e.g., AUI, Thinnet, 10base-T, etc */ - u_char ifi_addrlen; /* media address length */ - u_char ifi_hdrlen; /* media header length */ - u_long ifi_mtu; /* maximum transmission unit */ - u_long ifi_metric; /* routing metric (external only) */ - u_long ifi_baudrate; /* linespeed */ -/* volatile statistics */ - u_long ifi_ipackets; /* packets received on interface */ - u_long ifi_ierrors; /* input errors on interface */ - u_long ifi_opackets; /* packets sent on interface */ - u_long ifi_oerrors; /* output errors on interface */ - u_long ifi_collisions; /* collisions on csma interfaces */ - u_long ifi_ibytes; /* total number of octets received */ - u_long ifi_obytes; /* total number of octets sent */ - u_long ifi_imcasts; /* packets received via multicast */ - u_long ifi_omcasts; /* packets sent via multicast */ - u_long ifi_iqdrops; /* dropped on input, this interface */ - u_long ifi_noproto; /* destined for unsupported protocol */ - struct timeval ifi_lastchange;/* time of last administrative change */ - }; - - -struct ifnet { - char *if_name; /* name, e.g. ``en'' or ``lo'' */ - struct ifnet *if_next; /* all struct ifnets are chained */ - struct ifaddr *if_addrlist; /* linked list of addresses per if */ - int if_pcount; /* number of promiscuous listeners */ - caddr_t if_bpf; /* packet filter structure */ - u_short if_index; /* numeric abbreviation for this if */ - short if_unit; /* sub-unit for lower level driver */ - short if_timer; /* time 'til if_watchdog called */ - short if_flags; /* up/down, broadcast, etc. */ - struct if_data if_data; -/* procedure handles */ - void (*if_init) /* init routine */ - __P((int)); - int (*if_output) /* output routine (enqueue) */ - __P((struct ifnet *, struct mbuf *, struct sockaddr *, - struct rtentry *)); - void (*if_start) /* initiate output routine */ - __P((struct ifnet *)); - int (*if_done) /* output complete routine */ - __P((struct ifnet *)); /* (XXX not used; fake prototype) */ - int (*if_ioctl) /* ioctl routine */ - __P((struct ifnet *, int, caddr_t)); - void (*if_reset) - __P((int)); /* new autoconfig will permit removal */ - void (*if_watchdog) /* timer routine */ - __P((int)); - struct ifqueue { - struct mbuf *ifq_head; - struct mbuf *ifq_tail; - int ifq_len; - int ifq_maxlen; - int ifq_drops; - } if_snd; /* output queue */ -}; -#define if_mtu if_data.ifi_mtu -#define if_type if_data.ifi_type -#define if_physical if_data.ifi_physical -#define if_addrlen if_data.ifi_addrlen -#define if_hdrlen if_data.ifi_hdrlen -#define if_metric if_data.ifi_metric -#define if_baudrate if_data.ifi_baudrate -#define if_ipackets if_data.ifi_ipackets -#define if_ierrors if_data.ifi_ierrors -#define if_opackets if_data.ifi_opackets -#define if_oerrors if_data.ifi_oerrors -#define if_collisions if_data.ifi_collisions -#define if_ibytes if_data.ifi_ibytes -#define if_obytes if_data.ifi_obytes -#define if_imcasts if_data.ifi_imcasts -#define if_omcasts if_data.ifi_omcasts -#define if_iqdrops if_data.ifi_iqdrops -#define if_noproto if_data.ifi_noproto -#define if_lastchange if_data.ifi_lastchange -#define if_rawoutput(if, m, sa) if_output(if, m, sa, (struct rtentry *)0) - -#define IFF_UP 0x1 /* interface is up */ -#define IFF_UNICAST 0x1 /* for our interface to reactos */ -#define IFF_BROADCAST 0x2 /* broadcast address valid */ -#define IFF_DEBUG 0x4 /* turn on debugging */ -#define IFF_LOOPBACK 0x8 /* is a loopback net */ -#define IFF_POINTOPOINT 0x10 /* interface is point-to-point link */ -#define IFF_NOTRAILERS 0x20 /* avoid use of trailers */ -#define IFF_RUNNING 0x40 /* resources allocated */ -#define IFF_NOARP 0x80 /* no address resolution protocol */ -#define IFF_PROMISC 0x100 /* receive all packets */ -#define IFF_ALLMULTI 0x200 /* receive all multicast packets */ -#define IFF_OACTIVE 0x400 /* transmission in progress */ -#define IFF_SIMPLEX 0x800 /* can't hear own transmissions */ -#define IFF_LINK0 0x1000 /* per link layer defined bit */ -#define IFF_LINK1 0x2000 /* per link layer defined bit */ -#define IFF_LINK2 0x4000 /* per link layer defined bit */ -#define IFF_ALTPHYS IFF_LINK2 /* use alternate physical connection */ -#define IFF_MULTICAST 0x8000 /* supports multicast */ - -/* flags set internally only: */ -#define IFF_CANTCHANGE \ - (IFF_BROADCAST|IFF_POINTOPOINT|IFF_RUNNING|IFF_OACTIVE|\ - IFF_SIMPLEX|IFF_MULTICAST|IFF_ALLMULTI) - - -/* - * These really don't belong here, but there's no other obviously appropriate - * location. - */ -#define IFP_AUI 0 -#define IFP_10BASE2 1 -#define IFP_10BASET 2 -/* etc. */ - -/* - * Output queues (ifp->if_snd) and internetwork datagram level (pup level 1) - * input routines have queues of messages stored on ifqueue structures - * (defined above). Entries are added to and deleted from these structures - * by these macros, which should be called with ipl raised to splimp(). - */ -#define IF_QFULL(ifq) ((ifq)->ifq_len >= (ifq)->ifq_maxlen) -#define IF_DROP(ifq) ((ifq)->ifq_drops++) -#define IF_ENQUEUE(ifq, m) { \ - (m)->m_nextpkt = 0; \ - if ((ifq)->ifq_tail == 0) \ - (ifq)->ifq_head = m; \ - else \ - (ifq)->ifq_tail->m_nextpkt = m; \ - (ifq)->ifq_tail = m; \ - (ifq)->ifq_len++; \ -} -#define IF_PREPEND(ifq, m) { \ - (m)->m_nextpkt = (ifq)->ifq_head; \ - if ((ifq)->ifq_tail == 0) \ - (ifq)->ifq_tail = (m); \ - (ifq)->ifq_head = (m); \ - (ifq)->ifq_len++; \ -} -#define IF_DEQUEUE(ifq, m) { \ - (m) = (ifq)->ifq_head; \ - if (m) { \ - if (((ifq)->ifq_head = (m)->m_nextpkt) == 0) \ - (ifq)->ifq_tail = 0; \ - (m)->m_nextpkt = 0; \ - (ifq)->ifq_len--; \ - } \ -} - -#define IFQ_MAXLEN 50 -#define IFNET_SLOWHZ 1 /* granularity is 1 second */ - -/* - * The ifaddr structure contains information about one address - * of an interface. They are maintained by the different address families, - * are allocated and attached when an address is set, and are linked - * together so all addresses for an interface can be located. - */ -#ifndef __REACTOS__ -struct ifaddr { - struct sockaddr *ifa_addr; /* address of interface */ - struct sockaddr *ifa_dstaddr; /* other end of p-to-p link */ -#define ifa_broadaddr ifa_dstaddr /* broadcast address interface */ - struct sockaddr *ifa_netmask; /* used to determine subnet */ - struct ifnet *ifa_ifp; /* back-pointer to interface */ - struct ifaddr *ifa_next; /* next address for interface */ - void (*ifa_rtrequest) /* check or clean routes (+ or -)'d */ - __P((int, struct rtentry *, struct sockaddr *)); - u_short ifa_flags; /* mostly rt_flags for cloning */ - short ifa_refcnt; /* extra to malloc for link info */ - int ifa_metric; /* cost of going out this interface */ -#ifdef notdef - struct rtentry *ifa_rt; /* XXXX for ROUTETOIF ????? */ -#endif -}; -#endif -#define IFA_ROUTE RTF_UP /* route installed */ - -/* - * Message format for use in obtaining information about interfaces - * from getkerninfo and the routing socket - */ -struct if_msghdr { - u_short ifm_msglen; /* to skip over non-understood messages */ - u_char ifm_version; /* future binary compatability */ - u_char ifm_type; /* message type */ - int ifm_addrs; /* like rtm_addrs */ - int ifm_flags; /* value of if_flags */ - u_short ifm_index; /* index for associated ifp */ - struct if_data ifm_data;/* statistics and other data about if */ -}; - -/* - * Message format for use in obtaining information about interface addresses - * from getkerninfo and the routing socket - */ -struct ifa_msghdr { - u_short ifam_msglen; /* to skip over non-understood messages */ - u_char ifam_version; /* future binary compatability */ - u_char ifam_type; /* message type */ - int ifam_addrs; /* like rtm_addrs */ - int ifam_flags; /* value of ifa_flags */ - u_short ifam_index; /* index for associated ifp */ - int ifam_metric; /* value of ifa_metric */ -}; - -/* - * Interface request structure used for socket - * ioctl's. All interface ioctl's must have parameter - * definitions which begin with ifr_name. The - * remainder may be interface specific. - */ -struct ifreq { -#define IFNAMSIZ 16 - char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */ - union { - struct sockaddr ifru_addr; - struct sockaddr ifru_dstaddr; - struct sockaddr ifru_broadaddr; - short ifru_flags; - int ifru_metric; - int ifru_mtu; - int ifru_phys; - caddr_t ifru_data; - } ifr_ifru; -#define ifr_addr ifr_ifru.ifru_addr /* address */ -#define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-to-p link */ -#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */ -#define ifr_flags ifr_ifru.ifru_flags /* flags */ -#define ifr_metric ifr_ifru.ifru_metric /* metric */ -#define ifr_mtu ifr_ifru.ifru_mtu /* mtu */ -#define ifr_phys ifr_ifru.ifru_phys /* physical wire */ -#define ifr_data ifr_ifru.ifru_data /* for use by interface */ -}; - -struct ifaliasreq { - char ifra_name[IFNAMSIZ]; /* if name, e.g. "en0" */ - struct sockaddr ifra_addr; - struct sockaddr ifra_broadaddr; - struct sockaddr ifra_mask; -}; - -/* - * Structure used in SIOCGIFCONF request. - * Used to retrieve interface configuration - * for machine (useful for programs which - * must know all networks accessible). - */ -struct ifconf { - int ifc_len; /* size of associated buffer */ - union { - caddr_t ifcu_buf; - struct ifreq *ifcu_req; - } ifc_ifcu; -#define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */ -#define ifc_req ifc_ifcu.ifcu_req /* array of structures returned */ -}; - -#include - -#ifdef KERNEL -#define IFAFREE(ifa) \ - if ((ifa)->ifa_refcnt <= 0) \ - ifafree(ifa); \ - else \ - (ifa)->ifa_refcnt--; - -extern struct ifnet *ifnet; -extern struct ifnet loif[]; - -void ether_ifattach __P((struct ifnet *)); -void ether_input __P((struct ifnet *, struct ether_header *, struct mbuf *)); -int ether_output __P((struct ifnet *, - struct mbuf *, struct sockaddr *, struct rtentry *)); -char *ether_sprintf __P((u_char *)); - -void if_attach __P((struct ifnet *)); -void if_down __P((struct ifnet *)); -void if_qflush __P((struct ifqueue *)); -void if_slowtimo __P((void *)); -void if_up __P((struct ifnet *)); -#ifdef vax -void ifubareset __P((int)); -#endif -int ifconf __P((int, caddr_t)); -/*void ifinit __P((void));*/ /* declared in systm.h for main() */ -int ifioctl __P((struct socket *, int, caddr_t, struct proc *)); -int ifpromisc __P((struct ifnet *, int)); -struct ifnet *ifunit __P((char *)); - -struct ifaddr *ifa_ifwithaddr __P((struct sockaddr *)); -struct ifaddr *ifa_ifwithaf __P((int)); -struct ifaddr *ifa_ifwithdstaddr __P((struct sockaddr *)); -struct ifaddr *ifa_ifwithnet __P((struct sockaddr *)); -struct ifaddr *ifa_ifwithroute __P((int, struct sockaddr *, - struct sockaddr *)); -struct ifaddr *ifaof_ifpforaddr __P((struct sockaddr *, struct ifnet *)); -void ifafree __P((struct ifaddr *)); -void link_rtrequest __P((int, struct rtentry *, struct sockaddr *)); - -int loioctl __P((struct ifnet *, int, caddr_t)); -void loopattach __P((void)); -int looutput __P((struct ifnet *, - struct mbuf *, struct sockaddr *, struct rtentry *)); -void lortrequest __P((int, struct rtentry *, struct sockaddr *)); -#endif /* KERNEL */ - -#endif /* !_NET_IF_H_ */ diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/net/if_arp.h b/lib/drivers/oskittcp/include/freebsd/src/sys/net/if_arp.h deleted file mode 100644 index acac0855c11..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/net/if_arp.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 1986, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)if_arp.h 8.1 (Berkeley) 6/10/93 - */ - -#ifndef _NET_IF_ARP_H_ -#define _NET_IF_ARP_H_ - -#include /* for struct sockaddr */ - -/* - * Address Resolution Protocol. - * - * See RFC 826 for protocol description. ARP packets are variable - * in size; the arphdr structure defines the fixed-length portion. - * Protocol type values are the same as those for 10 Mb/s Ethernet. - * It is followed by the variable-sized fields ar_sha, arp_spa, - * arp_tha and arp_tpa in that order, according to the lengths - * specified. Field names used correspond to RFC 826. - */ -struct arphdr { - u_short ar_hrd; /* format of hardware address */ -#define ARPHRD_ETHER 1 /* ethernet hardware format */ -#define ARPHRD_FRELAY 15 /* frame relay hardware format */ - u_short ar_pro; /* format of protocol address */ - u_char ar_hln; /* length of hardware address */ - u_char ar_pln; /* length of protocol address */ - u_short ar_op; /* one of: */ -#define ARPOP_REQUEST 1 /* request to resolve address */ -#define ARPOP_REPLY 2 /* response to previous request */ -#define ARPOP_REVREQUEST 3 /* request protocol address given hardware */ -#define ARPOP_REVREPLY 4 /* response giving protocol address */ -#define ARPOP_INVREQUEST 8 /* request to identify peer */ -#define ARPOP_INVREPLY 9 /* response identifying peer */ -/* - * The remaining fields are variable in size, - * according to the sizes above. - */ -#ifdef COMMENT_ONLY - u_char ar_sha[]; /* sender hardware address */ - u_char ar_spa[]; /* sender protocol address */ - u_char ar_tha[]; /* target hardware address */ - u_char ar_tpa[]; /* target protocol address */ -#endif -}; - -/* - * ARP ioctl request - */ -struct arpreq { - struct sockaddr arp_pa; /* protocol address */ - struct sockaddr arp_ha; /* hardware address */ - int arp_flags; /* flags */ -}; -/* arp_flags and at_flags field values */ -#define ATF_INUSE 0x01 /* entry in use */ -#define ATF_COM 0x02 /* completed entry (enaddr valid) */ -#define ATF_PERM 0x04 /* permanent entry */ -#define ATF_PUBL 0x08 /* publish entry (respond for other host) */ -#define ATF_USETRAILERS 0x10 /* has requested trailers */ - -#endif /* !_NET_IF_ARP_H_ */ diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/net/netisr.h b/lib/drivers/oskittcp/include/freebsd/src/sys/net/netisr.h deleted file mode 100644 index f212d63b8f4..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/net/netisr.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 1980, 1986, 1989, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)netisr.h 8.1 (Berkeley) 6/10/93 - */ - -#ifndef _NET_NETISR_H_ -#define _NET_NETISR_H_ - -/* - * The networking code runs off software interrupts. - * - * You can switch into the network by doing splnet() and return by splx(). - * The software interrupt level for the network is higher than the software - * level for the clock (so you can enter the network in routines called - * at timeout time). - */ -#if defined(vax) || defined(tahoe) -#define setsoftnet() mtpr(SIRR, 12) -#endif - -/* - * Each ``pup-level-1'' input queue has a bit in a ``netisr'' status - * word which is used to de-multiplex a single software - * interrupt used for scheduling the network code to calls - * on the lowest level routine of each protocol. - */ -#define NETISR_RAW 0 /* same as AF_UNSPEC */ -#define NETISR_IP 2 /* same as AF_INET */ -#define NETISR_IMP 3 /* same as AF_IMPLINK */ -#define NETISR_NS 6 /* same as AF_NS */ -#define NETISR_ISO 7 /* same as AF_ISO */ -#define NETISR_CCITT 10 /* same as AF_CCITT */ -#define NETISR_ARP 18 /* same as AF_LINK */ -#define NETISR_ISDN 26 /* same as AF_E164 */ - -#define schednetisr(anisr) { netisr |= 1<<(anisr); setsoftnet(); } - -#ifndef LOCORE -#ifdef KERNEL -extern volatile unsigned int netisr; /* scheduling bits for network */ - -typedef void netisr_t(void); - -struct netisrtab { - int nit_num; - netisr_t *nit_isr; -}; - -#define NETISR_SET(num, isr) \ - static struct netisrtab mod_nit = { num, isr }; \ - DATA_SET(netisr_set, mod_nit); - -#endif -#endif - -#endif diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/net/radix.h b/lib/drivers/oskittcp/include/freebsd/src/sys/net/radix.h deleted file mode 100644 index c37058b3cac..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/net/radix.h +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright (c) 1988, 1989, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)radix.h 8.2 (Berkeley) 10/31/94 - */ - -#ifndef _RADIX_H_ -#define _RADIX_H_ - -/* - * Radix search tree node layout. - */ - -struct radix_node { - struct radix_mask *rn_mklist; /* list of masks contained in subtree */ - struct radix_node *rn_p; /* parent */ - short rn_b; /* bit offset; -1-index(netmask) */ - char rn_bmask; /* node: mask for bit test*/ - u_char rn_flags; /* enumerated next */ -#define RNF_NORMAL 1 /* leaf contains normal route */ -#define RNF_ROOT 2 /* leaf is root leaf for tree */ -#define RNF_ACTIVE 4 /* This node is alive (for rtfree) */ - union { - struct { /* leaf only data: */ - caddr_t rn_Key; /* object of search */ - caddr_t rn_Mask; /* netmask, if present */ - struct radix_node *rn_Dupedkey; - } rn_leaf; - struct { /* node only data: */ - int rn_Off; /* where to start compare */ - struct radix_node *rn_L;/* progeny */ - struct radix_node *rn_R;/* progeny */ - } rn_node; - } rn_u; -#ifdef RN_DEBUG - int rn_info; - struct radix_node *rn_twin; - struct radix_node *rn_ybro; -#endif -}; - -#define rn_dupedkey rn_u.rn_leaf.rn_Dupedkey -#define rn_key rn_u.rn_leaf.rn_Key -#define rn_mask rn_u.rn_leaf.rn_Mask -#define rn_off rn_u.rn_node.rn_Off -#define rn_l rn_u.rn_node.rn_L -#define rn_r rn_u.rn_node.rn_R - -/* - * Annotations to tree concerning potential routes applying to subtrees. - */ - -extern struct radix_mask { - short rm_b; /* bit offset; -1-index(netmask) */ - char rm_unused; /* cf. rn_bmask */ - u_char rm_flags; /* cf. rn_flags */ - struct radix_mask *rm_mklist; /* more masks to try */ - union { - caddr_t rmu_mask; /* the mask */ - struct radix_node *rmu_leaf; /* for normal routes */ - } rm_rmu; - int rm_refs; /* # of references to this struct */ -} *rn_mkfreelist; - -#define rm_mask rm_rmu.rmu_mask -#define rm_leaf rm_rmu.rmu_leaf /* extra field would make 32 bytes */ - -#define MKGet(m) {\ - if (rn_mkfreelist) {\ - m = rn_mkfreelist; \ - rn_mkfreelist = (m)->rm_mklist; \ - } else \ - R_Malloc(m, struct radix_mask *, sizeof (*(m))); }\ - -#define MKFree(m) { (m)->rm_mklist = rn_mkfreelist; rn_mkfreelist = (m);} - -typedef int walktree_f_t __P((struct radix_node *, void *)); - -struct radix_node_head { - struct radix_node *rnh_treetop; - int rnh_addrsize; /* permit, but not require fixed keys */ - int rnh_pktsize; /* permit, but not require fixed keys */ - struct radix_node *(*rnh_addaddr) /* add based on sockaddr */ - __P((void *v, void *mask, - struct radix_node_head *head, struct radix_node nodes[])); - struct radix_node *(*rnh_addpkt) /* add based on packet hdr */ - __P((void *v, void *mask, - struct radix_node_head *head, struct radix_node nodes[])); - struct radix_node *(*rnh_deladdr) /* remove based on sockaddr */ - __P((void *v, void *mask, struct radix_node_head *head)); - struct radix_node *(*rnh_delpkt) /* remove based on packet hdr */ - __P((void *v, void *mask, struct radix_node_head *head)); - struct radix_node *(*rnh_matchaddr) /* locate based on sockaddr */ - __P((void *v, struct radix_node_head *head)); - struct radix_node *(*rnh_lookup) /* locate based on sockaddr */ - __P((void *v, void *mask, struct radix_node_head *head)); - struct radix_node *(*rnh_matchpkt) /* locate based on packet hdr */ - __P((void *v, struct radix_node_head *head)); - int (*rnh_walktree) /* traverse tree */ - __P((struct radix_node_head *head, walktree_f_t *f, void *w)); - int (*rnh_walktree_from) /* traverse tree below a */ - __P((struct radix_node_head *head, void *a, void *m, - walktree_f_t *f, void *w)); - void (*rnh_close) /* do something when the last ref drops */ - __P((struct radix_node *rn, struct radix_node_head *head)); - struct radix_node rnh_nodes[3]; /* empty tree for common case */ -}; - -#ifndef KERNEL -#define Bcmp(a, b, n) bcmp(((char *)(a)), ((char *)(b)), (n)) -#define Bcopy(a, b, n) bcopy(((char *)(a)), ((char *)(b)), (unsigned)(n)) -#define Bzero(p, n) bzero((char *)(p), (int)(n)); -#define R_Malloc(p, t, n) (p = (t) malloc((unsigned int)(n))) -#define Free(p) free((char *)p); -#else -#define Bcmp(a, b, n) bcmp(((caddr_t)(a)), ((caddr_t)(b)), (unsigned)(n)) -#define Bcopy(a, b, n) bcopy(((caddr_t)(a)), ((caddr_t)(b)), (unsigned)(n)) -#define Bzero(p, n) bzero((caddr_t)(p), (unsigned)(n)); -#define R_Malloc(p, t, n) (p = (t) malloc((unsigned long)(n), M_RTABLE, M_DONTWAIT)) -#define Free(p) free((caddr_t)p, M_RTABLE); -#endif /*KERNEL*/ - -extern struct radix_node_head *mask_rnhead; - -void rn_init __P((void)); -int rn_inithead __P((void **, int)); -int rn_refines __P((void *, void *)); -int rn_walktree __P((struct radix_node_head *, walktree_f_t *, void *)); -struct radix_node - *rn_addmask __P((void *, int, int)), - *rn_addroute __P((void *, void *, struct radix_node_head *, - struct radix_node [2])), - *rn_delete __P((void *, void *, struct radix_node_head *)), - *rn_insert __P((void *, struct radix_node_head *, int *, - struct radix_node [2])), - *rn_match __P((void *, struct radix_node_head *)), - *rn_newpair __P((void *, int, struct radix_node[2])), - *rn_search __P((void *, struct radix_node *)), - *rn_search_m __P((void *, struct radix_node *, void *)); - -#endif /* _RADIX_H_ */ diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/net/raw_cb.h b/lib/drivers/oskittcp/include/freebsd/src/sys/net/raw_cb.h deleted file mode 100644 index c1273190505..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/net/raw_cb.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 1980, 1986, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)raw_cb.h 8.1 (Berkeley) 6/10/93 - */ - -#ifndef _NET_RAW_CB_H_ -#define _NET_RAW_CB_H_ - -/* - * Raw protocol interface control block. Used - * to tie a socket to the generic raw interface. - */ -struct rawcb { - struct rawcb *rcb_next; /* doubly linked list */ - struct rawcb *rcb_prev; - struct socket *rcb_socket; /* back pointer to socket */ - struct sockaddr *rcb_faddr; /* destination address */ - struct sockaddr *rcb_laddr; /* socket's address */ - struct sockproto rcb_proto; /* protocol family, protocol */ -}; - -#define sotorawcb(so) ((struct rawcb *)(so)->so_pcb) - -/* - * Nominal space allocated to a raw socket. - */ -#define RAWSNDQ 8192 -#define RAWRCVQ 8192 - -#ifdef KERNEL -struct rawcb rawcb; /* head of list */ - -int raw_attach __P((struct socket *, int)); -void raw_ctlinput __P((int, struct sockaddr *)); -void raw_detach __P((struct rawcb *)); -void raw_disconnect __P((struct rawcb *)); -void raw_init __P((void)); -void raw_input __P((struct mbuf *, - struct sockproto *, struct sockaddr *, struct sockaddr *)); -int raw_usrreq __P((struct socket *, - int, struct mbuf *, struct mbuf *, struct mbuf *)); -#endif - -#endif diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/net/route.h b/lib/drivers/oskittcp/include/freebsd/src/sys/net/route.h deleted file mode 100644 index 3173211303f..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/net/route.h +++ /dev/null @@ -1,286 +0,0 @@ -/* - * Copyright (c) 1980, 1986, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)route.h 8.3 (Berkeley) 4/19/94 - */ - -#ifndef _NET_ROUTE_H_ -#define _NET_ROUTE_H_ - -/* - * Kernel resident routing tables. - * - * The routing tables are initialized when interface addresses - * are set by making entries for all directly connected interfaces. - */ - -/* - * A route consists of a destination address and a reference - * to a routing entry. These are often held by protocols - * in their control blocks, e.g. inpcb. - */ -struct route { - struct rtentry *ro_rt; - struct sockaddr ro_dst; -}; - -/* - * These numbers are used by reliable protocols for determining - * retransmission behavior and are included in the routing structure. - */ -struct rt_metrics { - u_long rmx_locks; /* Kernel must leave these values alone */ - u_long rmx_mtu; /* MTU for this path */ - u_long rmx_hopcount; /* max hops expected */ - u_long rmx_expire; /* lifetime for route, e.g. redirect */ - u_long rmx_recvpipe; /* inbound delay-bandwith product */ - u_long rmx_sendpipe; /* outbound delay-bandwith product */ - u_long rmx_ssthresh; /* outbound gateway buffer limit */ - u_long rmx_rtt; /* estimated round trip time */ - u_long rmx_rttvar; /* estimated rtt variance */ - u_long rmx_pksent; /* packets sent using this route */ - u_long rmx_filler[4]; /* will be used for T/TCP later */ -}; - -/* - * rmx_rtt and rmx_rttvar are stored as microseconds; - * RTTTOPRHZ(rtt) converts to a value suitable for use - * by a protocol slowtimo counter. - */ -#define RTM_RTTUNIT 1000000 /* units for rtt, rttvar, as units per sec */ -#define RTTTOPRHZ(r) ((r) / (RTM_RTTUNIT / PR_SLOWHZ)) - -/* - * XXX kernel function pointer `rt_output' is visible to applications. - */ -struct mbuf; - -/* - * We distinguish between routes to hosts and routes to networks, - * preferring the former if available. For each route we infer - * the interface to use from the gateway address supplied when - * the route was entered. Routes that forward packets through - * gateways are marked so that the output routines know to address the - * gateway rather than the ultimate destination. - */ -#ifndef RNF_NORMAL -#include -#endif -struct rtentry { - struct radix_node rt_nodes[2]; /* tree glue, and other values */ -#define rt_key(r) ((struct sockaddr *)((r)->rt_nodes->rn_key)) -#define rt_mask(r) ((struct sockaddr *)((r)->rt_nodes->rn_mask)) - struct sockaddr *rt_gateway; /* value */ - short rt_filler; /* was short flags field */ - short rt_refcnt; /* # held references */ - u_long rt_flags; /* up/down?, host/net */ - struct ifnet *rt_ifp; /* the answer: interface to use */ - struct ifaddr *rt_ifa; /* the answer: interface to use */ - struct sockaddr *rt_genmask; /* for generation of cloned routes */ - caddr_t rt_llinfo; /* pointer to link level info cache */ - struct rt_metrics rt_rmx; /* metrics used by rx'ing protocols */ - struct rtentry *rt_gwroute; /* implied entry for gatewayed routes */ - int (*rt_output) __P((struct rtentry *, struct mbuf *, - struct sockaddr *, int)); - /* output routine for this (rt,if) */ - struct rtentry *rt_parent; /* cloning parent of this route */ - void *rt_filler2; /* more filler */ -}; - -/* - * Following structure necessary for 4.3 compatibility; - * We should eventually move it to a compat file. - */ -struct ortentry { - u_long rt_hash; /* to speed lookups */ - struct sockaddr rt_dst; /* key */ - struct sockaddr rt_gateway; /* value */ - short rt_flags; /* up/down?, host/net */ - short rt_refcnt; /* # held references */ - u_long rt_use; /* raw # packets forwarded */ - struct ifnet *rt_ifp; /* the answer: interface to use */ -}; - -#define rt_use rt_rmx.rmx_pksent - -#define RTF_UP 0x1 /* route usable */ -#define RTF_GATEWAY 0x2 /* destination is a gateway */ -#define RTF_HOST 0x4 /* host entry (net otherwise) */ -#define RTF_REJECT 0x8 /* host or net unreachable */ -#define RTF_DYNAMIC 0x10 /* created dynamically (by redirect) */ -#define RTF_MODIFIED 0x20 /* modified dynamically (by redirect) */ -#define RTF_DONE 0x40 /* message confirmed */ -#define RTF_MASK 0x80 /* subnet mask present */ -#define RTF_CLONING 0x100 /* generate new routes on use */ -#define RTF_XRESOLVE 0x200 /* external daemon resolves name */ -#define RTF_LLINFO 0x400 /* generated by ARP or ESIS */ -#define RTF_STATIC 0x800 /* manually added */ -#define RTF_BLACKHOLE 0x1000 /* just discard pkts (during updates) */ -#define RTF_PROTO2 0x4000 /* protocol specific routing flag */ -#define RTF_PROTO1 0x8000 /* protocol specific routing flag */ - -#define RTF_PRCLONING 0x10000 /* protocol requires cloning */ -#define RTF_WASCLONED 0x20000 /* route generated through cloning */ -#define RTF_PROTO3 0x40000 /* protocol specific routing flag */ -#define RTF_CHAINDELETE 0x80000 /* chain is being deleted (internal) */ -#define RTF_PINNED 0x100000 /* future use */ - /* 0x200000 and up unassigned */ - -/* - * Routing statistics. - */ -struct rtstat { - short rts_badredirect; /* bogus redirect calls */ - short rts_dynamic; /* routes created by redirects */ - short rts_newgateway; /* routes modified by redirects */ - short rts_unreach; /* lookups which failed */ - short rts_wildcard; /* lookups satisfied by a wildcard */ -}; -/* - * Structures for routing messages. - */ -struct rt_msghdr { - u_short rtm_msglen; /* to skip over non-understood messages */ - u_char rtm_version; /* future binary compatibility */ - u_char rtm_type; /* message type */ - u_short rtm_index; /* index for associated ifp */ - int rtm_flags; /* flags, incl. kern & message, e.g. DONE */ - int rtm_addrs; /* bitmask identifying sockaddrs in msg */ - pid_t rtm_pid; /* identify sender */ - int rtm_seq; /* for sender to identify action */ - int rtm_errno; /* why failed */ - int rtm_use; /* from rtentry */ - u_long rtm_inits; /* which metrics we are initializing */ - struct rt_metrics rtm_rmx; /* metrics themselves */ -}; - -#define RTM_VERSION 5 /* Up the ante and ignore older versions */ - -#define RTM_ADD 0x1 /* Add Route */ -#define RTM_DELETE 0x2 /* Delete Route */ -#define RTM_CHANGE 0x3 /* Change Metrics or flags */ -#define RTM_GET 0x4 /* Report Metrics */ -#define RTM_LOSING 0x5 /* Kernel Suspects Partitioning */ -#define RTM_REDIRECT 0x6 /* Told to use different route */ -#define RTM_MISS 0x7 /* Lookup failed on this address */ -#define RTM_LOCK 0x8 /* fix specified metrics */ -#define RTM_OLDADD 0x9 /* caused by SIOCADDRT */ -#define RTM_OLDDEL 0xa /* caused by SIOCDELRT */ -#define RTM_RESOLVE 0xb /* req to resolve dst to LL addr */ -#define RTM_NEWADDR 0xc /* address being added to iface */ -#define RTM_DELADDR 0xd /* address being removed from iface */ -#define RTM_IFINFO 0xe /* iface going up/down etc. */ - -#define RTV_MTU 0x1 /* init or lock _mtu */ -#define RTV_HOPCOUNT 0x2 /* init or lock _hopcount */ -#define RTV_EXPIRE 0x4 /* init or lock _hopcount */ -#define RTV_RPIPE 0x8 /* init or lock _recvpipe */ -#define RTV_SPIPE 0x10 /* init or lock _sendpipe */ -#define RTV_SSTHRESH 0x20 /* init or lock _ssthresh */ -#define RTV_RTT 0x40 /* init or lock _rtt */ -#define RTV_RTTVAR 0x80 /* init or lock _rttvar */ - -/* - * Bitmask values for rtm_addr. - */ -#define RTA_DST 0x1 /* destination sockaddr present */ -#define RTA_GATEWAY 0x2 /* gateway sockaddr present */ -#define RTA_NETMASK 0x4 /* netmask sockaddr present */ -#define RTA_GENMASK 0x8 /* cloning mask sockaddr present */ -#define RTA_IFP 0x10 /* interface name sockaddr present */ -#define RTA_IFA 0x20 /* interface addr sockaddr present */ -#define RTA_AUTHOR 0x40 /* sockaddr for author of redirect */ -#define RTA_BRD 0x80 /* for NEWADDR, broadcast or p-p dest addr */ - -/* - * Index offsets for sockaddr array for alternate internal encoding. - */ -#define RTAX_DST 0 /* destination sockaddr present */ -#define RTAX_GATEWAY 1 /* gateway sockaddr present */ -#define RTAX_NETMASK 2 /* netmask sockaddr present */ -#define RTAX_GENMASK 3 /* cloning mask sockaddr present */ -#define RTAX_IFP 4 /* interface name sockaddr present */ -#define RTAX_IFA 5 /* interface addr sockaddr present */ -#define RTAX_AUTHOR 6 /* sockaddr for author of redirect */ -#define RTAX_BRD 7 /* for NEWADDR, broadcast or p-p dest addr */ -#define RTAX_MAX 8 /* size of array to allocate */ - -struct rt_addrinfo { - int rti_addrs; - struct sockaddr *rti_info[RTAX_MAX]; -}; - -struct route_cb { - int ip_count; - int ns_count; - int iso_count; - int any_count; -}; - -#ifdef KERNEL -#define RTFREE(rt) \ - if ((rt)->rt_refcnt <= 1) \ - rtfree(rt); \ - else \ - (rt)->rt_refcnt--; - -struct route_cb route_cb; -struct rtstat rtstat; -struct radix_node_head *rt_tables[AF_MAX+1]; - -void route_init __P((void)); -int route_output __P((struct mbuf *, struct socket *)); -int route_usrreq __P((struct socket *, - int, struct mbuf *, struct mbuf *, struct mbuf *)); -void rt_ifmsg __P((struct ifnet *)); -void rt_maskedcopy __P((struct sockaddr *, - struct sockaddr *, struct sockaddr *)); -void rt_missmsg __P((int, struct rt_addrinfo *, int, int)); -void rt_newaddrmsg __P((int, struct ifaddr *, int, struct rtentry *)); -int rt_setgate __P((struct rtentry *, - struct sockaddr *, struct sockaddr *)); -void rt_setmetrics __P((u_long, struct rt_metrics *, struct rt_metrics *)); -void rtable_init __P((void **)); -void rtalloc __P((struct route *)); -void rtalloc_ign __P((struct route *, unsigned long)); -struct rtentry * - rtalloc1 __P((struct sockaddr *, int, unsigned long)); -void rtfree __P((struct rtentry *)); -int rtinit __P((struct ifaddr *, int, int)); -int rtioctl __P((int, caddr_t, struct proc *)); -void rtredirect __P((struct sockaddr *, struct sockaddr *, - struct sockaddr *, int, struct sockaddr *, struct rtentry **)); -int rtrequest __P((int, struct sockaddr *, - struct sockaddr *, struct sockaddr *, int, struct rtentry **)); -#endif - -#endif diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/if_ether.h b/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/if_ether.h deleted file mode 100644 index 057878f9ca1..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/if_ether.h +++ /dev/null @@ -1,237 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)if_ether.h 8.1 (Berkeley) 6/10/93 - */ - -#ifndef _NETINET_IF_ETHER_H_ -#define _NETINET_IF_ETHER_H_ - -#include - -/* - * Structure of a 10Mb/s Ethernet header. - */ -struct ether_header { - u_char ether_dhost[6]; - u_char ether_shost[6]; - u_short ether_type; -}; - -/* - * Structure of a 48-bit Ethernet address. - */ -struct ether_addr { - u_char octet[6]; -}; - -#define ETHERTYPE_PUP 0x0200 /* PUP protocol */ -#define ETHERTYPE_IP 0x0800 /* IP protocol */ -#define ETHERTYPE_ARP 0x0806 /* Addr. resolution protocol */ -#define ETHERTYPE_REVARP 0x8035 /* reverse Addr. resolution protocol */ - -/* - * The ETHERTYPE_NTRAILER packet types starting at ETHERTYPE_TRAIL have - * (type-ETHERTYPE_TRAIL)*512 bytes of data followed - * by an ETHER type (as given above) and then the (variable-length) header. - */ -#define ETHERTYPE_TRAIL 0x1000 /* Trailer packet */ -#define ETHERTYPE_NTRAILER 16 - -#define ETHERMTU 1500 -#define ETHERMIN (60-14) - -#ifdef KERNEL -/* - * Macro to map an IP multicast address to an Ethernet multicast address. - * The high-order 25 bits of the Ethernet address are statically assigned, - * and the low-order 23 bits are taken from the low end of the IP address. - */ -#define ETHER_MAP_IP_MULTICAST(ipaddr, enaddr) \ - /* struct in_addr *ipaddr; */ \ - /* u_char enaddr[6]; */ \ -{ \ - (enaddr)[0] = 0x01; \ - (enaddr)[1] = 0x00; \ - (enaddr)[2] = 0x5e; \ - (enaddr)[3] = ((u_char *)ipaddr)[1] & 0x7f; \ - (enaddr)[4] = ((u_char *)ipaddr)[2]; \ - (enaddr)[5] = ((u_char *)ipaddr)[3]; \ -} -#endif - -/* - * Ethernet Address Resolution Protocol. - * - * See RFC 826 for protocol description. Structure below is adapted - * to resolving internet addresses. Field names used correspond to - * RFC 826. - */ -struct ether_arp { - struct arphdr ea_hdr; /* fixed-size header */ - u_char arp_sha[6]; /* sender hardware address */ - u_char arp_spa[4]; /* sender protocol address */ - u_char arp_tha[6]; /* target hardware address */ - u_char arp_tpa[4]; /* target protocol address */ -}; -#define arp_hrd ea_hdr.ar_hrd -#define arp_pro ea_hdr.ar_pro -#define arp_hln ea_hdr.ar_hln -#define arp_pln ea_hdr.ar_pln -#define arp_op ea_hdr.ar_op - - -/* - * Structure shared between the ethernet driver modules and - * the address resolution code. For example, each ec_softc or il_softc - * begins with this structure. - */ -struct arpcom { - struct ifnet ac_if; /* network-visible interface */ - u_char ac_enaddr[6]; /* ethernet hardware address */ - struct in_addr ac_ipaddr; /* copy of ip address- XXX */ - struct ether_multi *ac_multiaddrs; /* list of ether multicast addrs */ - int ac_multicnt; /* length of ac_multiaddrs list */ -}; - -struct llinfo_arp { - struct llinfo_arp *la_next; - struct llinfo_arp *la_prev; - struct rtentry *la_rt; - struct mbuf *la_hold; /* last packet until resolved/timeout */ - long la_asked; /* last time we QUERIED for this addr */ -#define la_timer la_rt->rt_rmx.rmx_expire /* deletion time in seconds */ -}; - -struct sockaddr_inarp { - u_char sin_len; - u_char sin_family; - u_short sin_port; - struct in_addr sin_addr; - struct in_addr sin_srcaddr; - u_short sin_tos; - u_short sin_other; -#define SIN_PROXY 1 -}; -/* - * IP and ethernet specific routing flags - */ -#define RTF_USETRAILERS RTF_PROTO1 /* use trailers */ -#define RTF_ANNOUNCE RTF_PROTO2 /* announce new arp entry */ - -#ifdef KERNEL -extern u_char etherbroadcastaddr[6]; -extern u_char ether_ipmulticast_min[6]; -extern u_char ether_ipmulticast_max[6]; -extern struct ifqueue arpintrq; - -struct llinfo_arp *arptnew __P((struct in_addr *)); -extern struct llinfo_arp llinfo_arp; /* head of the llinfo queue */ - -void arpwhohas __P((struct arpcom *, struct in_addr *)); -void arpintr __P((void)); -int arpresolve __P((struct arpcom *, struct rtentry *, struct mbuf *, - struct sockaddr *, u_char *, struct rtentry *)); -void arp_ifinit __P((struct arpcom *, struct ifaddr *)); - -int ether_addmulti __P((struct ifreq *, struct arpcom *)); -int ether_delmulti __P((struct ifreq *, struct arpcom *)); - -/* - * Ethernet multicast address structure. There is one of these for each - * multicast address or range of multicast addresses that we are supposed - * to listen to on a particular interface. They are kept in a linked list, - * rooted in the interface's arpcom structure. (This really has nothing to - * do with ARP, or with the Internet address family, but this appears to be - * the minimally-disrupting place to put it.) - */ -struct ether_multi { - u_char enm_addrlo[6]; /* low or only address of range */ - u_char enm_addrhi[6]; /* high or only address of range */ - struct arpcom *enm_ac; /* back pointer to arpcom */ - u_int enm_refcount; /* no. claims to this addr/range */ - struct ether_multi *enm_next; /* ptr to next ether_multi */ -}; - -/* - * Structure used by macros below to remember position when stepping through - * all of the ether_multi records. - */ -struct ether_multistep { - struct ether_multi *e_enm; -}; - -/* - * Macro for looking up the ether_multi record for a given range of Ethernet - * multicast addresses connected to a given arpcom structure. If no matching - * record is found, "enm" returns NULL. - */ -#define ETHER_LOOKUP_MULTI(addrlo, addrhi, ac, enm) \ - /* u_char addrlo[6]; */ \ - /* u_char addrhi[6]; */ \ - /* struct arpcom *ac; */ \ - /* struct ether_multi *enm; */ \ -{ \ - for ((enm) = (ac)->ac_multiaddrs; \ - (enm) != NULL && \ - (bcmp((enm)->enm_addrlo, (addrlo), 6) != 0 || \ - bcmp((enm)->enm_addrhi, (addrhi), 6) != 0); \ - (enm) = (enm)->enm_next); \ -} - -/* - * Macro to step through all of the ether_multi records, one at a time. - * The current position is remembered in "step", which the caller must - * provide. ETHER_FIRST_MULTI(), below, must be called to initialize "step" - * and get the first record. Both macros return a NULL "enm" when there - * are no remaining records. - */ -#define ETHER_NEXT_MULTI(step, enm) \ - /* struct ether_multistep step; */ \ - /* struct ether_multi *enm; */ \ -{ \ - if (((enm) = (step).e_enm) != NULL) \ - (step).e_enm = (enm)->enm_next; \ -} - -#define ETHER_FIRST_MULTI(step, ac, enm) \ - /* struct ether_multistep step; */ \ - /* struct arpcom *ac; */ \ - /* struct ether_multi *enm; */ \ -{ \ - (step).e_enm = (ac)->ac_multiaddrs; \ - ETHER_NEXT_MULTI((step), (enm)); \ -} - -#endif - -#endif diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/igmp_var.h b/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/igmp_var.h deleted file mode 100644 index fee5e431cd9..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/igmp_var.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 1988 Stephen Deering. - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Stephen Deering of Stanford University. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)igmp_var.h 8.1 (Berkeley) 7/19/93 - */ - -#ifndef _NETINET_IGMP_VAR_H_ -#define _NETINET_IGMP_VAR_H_ - -/* - * Internet Group Management Protocol (IGMP), - * implementation-specific definitions. - * - * Written by Steve Deering, Stanford, May 1988. - * - * MULTICAST Revisiob: 3.3.1.1 - */ - -struct igmpstat { - u_int igps_rcv_total; /* total IGMP messages received */ - u_int igps_rcv_tooshort; /* received with too few bytes */ - u_int igps_rcv_badsum; /* received with bad checksum */ - u_int igps_rcv_queries; /* received membership queries */ - u_int igps_rcv_badqueries; /* received invalid queries */ - u_int igps_rcv_reports; /* received membership reports */ - u_int igps_rcv_badreports; /* received invalid reports */ - u_int igps_rcv_ourreports; /* received reports for our groups */ - u_int igps_snd_reports; /* sent membership reports */ -}; - -#ifdef KERNEL -extern struct igmpstat igmpstat; - -#define IGMP_RANDOM_DELAY(X) (random() % (X) + 1) - -void igmp_init __P((void)); -void igmp_input __P((struct mbuf *, int)); -void igmp_joingroup __P((struct in_multi *)); -void igmp_leavegroup __P((struct in_multi *)); -void igmp_fasttimo __P((void)); -void igmp_slowtimo __P((void)); -int igmp_sysctl(int *, u_int, void *, size_t *, void *, size_t); -#endif - -/* - * Names for IGMP sysctl objects - */ -#define IGMPCTL_STATS 1 /* statistics (read-only) */ -#define IGMPCTL_MAXID 2 - -#define IGMPCTL_NAMES { \ - { 0, 0 }, \ - { "stats", CTLTYPE_STRUCT }, \ -} - -#endif - - diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/in.h b/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/in.h deleted file mode 100644 index 34e0b842316..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/in.h +++ /dev/null @@ -1,269 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)in.h 8.3 (Berkeley) 1/3/94 - */ - -#ifndef _NETINET_IN_H_ -#define _NETINET_IN_H_ - -/* - * Constants and structures defined by the internet system, - * Per RFC 790, September 1981, and numerous additions. - */ - -/* - * Protocols - */ -#define IPPROTO_IP 0 /* dummy for IP */ -#define IPPROTO_ICMP 1 /* control message protocol */ -#define IPPROTO_IGMP 2 /* group mgmt protocol */ -#define IPPROTO_GGP 3 /* gateway^2 (deprecated) */ -#define IPPROTO_IPIP 4 /* IP encapsulation in IP */ -#define IPPROTO_TCP 6 /* tcp */ -#define IPPROTO_EGP 8 /* exterior gateway protocol */ -#define IPPROTO_PUP 12 /* pup */ -#define IPPROTO_UDP 17 /* user datagram protocol */ -#define IPPROTO_IDP 22 /* xns idp */ -#define IPPROTO_TP 29 /* tp-4 w/ class negotiation */ -#define IPPROTO_RSVP 46 /* resource reservation */ -#define IPPROTO_EON 80 /* ISO cnlp */ -#define IPPROTO_ENCAP 98 /* encapsulation header */ - -#define IPPROTO_RAW 255 /* raw IP packet */ -#define IPPROTO_MAX 256 - - -/* - * Local port number conventions: - * Ports < IPPORT_RESERVED are reserved for - * privileged processes (e.g. root). - * Ports > IPPORT_USERRESERVED are reserved - * for servers, not necessarily privileged. - */ -#define IPPORT_RESERVED 1024 -#define IPPORT_USERRESERVED 5000 - -/* - * Internet address (a structure for historical reasons) - */ -#ifndef _WINSOCKAPI_ -struct in_addr { - u_long s_addr; -}; -#endif//_WINSOCKAPI_ - -/* - * Definitions of bits in internet address integers. - * On subnets, the decomposition of addresses to host and net parts - * is done according to subnet mask, not the masks here. - */ -#define IN_CLASSA(i) (((long)(i) & 0x80000000) == 0) -#define IN_CLASSA_NET 0xff000000 -#define IN_CLASSA_NSHIFT 24 -#define IN_CLASSA_HOST 0x00ffffff -#define IN_CLASSA_MAX 128 - -#define IN_CLASSB(i) (((long)(i) & 0xc0000000) == 0x80000000) -#define IN_CLASSB_NET 0xffff0000 -#define IN_CLASSB_NSHIFT 16 -#define IN_CLASSB_HOST 0x0000ffff -#define IN_CLASSB_MAX 65536 - -#define IN_CLASSC(i) (((long)(i) & 0xe0000000) == 0xc0000000) -#define IN_CLASSC_NET 0xffffff00 -#define IN_CLASSC_NSHIFT 8 -#define IN_CLASSC_HOST 0x000000ff - -#define IN_CLASSD(i) (((long)(i) & 0xf0000000) == 0xe0000000) -#define IN_CLASSD_NET 0xf0000000 /* These ones aren't really */ -#define IN_CLASSD_NSHIFT 28 /* net and host fields, but */ -#define IN_CLASSD_HOST 0x0fffffff /* routing needn't know. */ -#define IN_MULTICAST(i) IN_CLASSD(i) - -#define IN_EXPERIMENTAL(i) (((long)(i) & 0xf0000000) == 0xf0000000) -#define IN_BADCLASS(i) (((long)(i) & 0xf0000000) == 0xf0000000) - -#define INADDR_ANY (u_long)0x00000000 -#define INADDR_BROADCAST (u_long)0xffffffff /* must be masked */ -#ifndef KERNEL -#define INADDR_NONE 0xffffffff /* -1 return */ -#endif - -#define INADDR_UNSPEC_GROUP (u_long)0xe0000000 /* 224.0.0.0 */ -#define INADDR_ALLHOSTS_GROUP (u_long)0xe0000001 /* 224.0.0.1 */ -#define INADDR_MAX_LOCAL_GROUP (u_long)0xe00000ff /* 224.0.0.255 */ - -#define IN_LOOPBACKNET 127 /* official! */ - -/* - * Socket address, internet style. - */ -#ifdef _WINSOCKAPI_ -#define sockaddr_in bsd_sockaddr_in -#endif -struct sockaddr_in { - u_char sin_len; - u_char sin_family; - u_short sin_port; - struct in_addr sin_addr; - char sin_zero[8]; -}; - -/* - * Structure used to describe IP options. - * Used to store options internally, to pass them to a process, - * or to restore options retrieved earlier. - * The ip_dst is used for the first-hop gateway when using a source route - * (this gets put into the header proper). - */ -struct ip_opts { - struct in_addr ip_dst; /* first hop, 0 w/o src rt */ - char ip_opts[40]; /* actually variable in size */ -}; - -/* - * Options for use with [gs]etsockopt at the IP level. - * First word of comment is data type; bool is stored in int. - */ -#define IP_OPTIONS 1 /* buf/ip_opts; set/get IP options */ -#define IP_HDRINCL 2 /* int; header is included with data */ -#define IP_TOS 3 /* int; IP type of service and preced. */ -#define IP_TTL 4 /* int; IP time to live */ -#define IP_RECVOPTS 5 /* bool; receive all IP opts w/dgram */ -#define IP_RECVRETOPTS 6 /* bool; receive IP opts for response */ -#define IP_RECVDSTADDR 7 /* bool; receive IP dst addr w/dgram */ -#define IP_RETOPTS 8 /* ip_opts; set/get IP options */ -#define IP_MULTICAST_IF 9 /* u_char; set/get IP multicast i/f */ -#define IP_MULTICAST_TTL 10 /* u_char; set/get IP multicast ttl */ -#define IP_MULTICAST_LOOP 11 /* u_char; set/get IP multicast loopback */ -#define IP_ADD_MEMBERSHIP 12 /* ip_mreq; add an IP group membership */ -#define IP_DROP_MEMBERSHIP 13 /* ip_mreq; drop an IP group membership */ -#define IP_MULTICAST_VIF 14 /* set/get IP mcast virt. iface */ -#define IP_RSVP_ON 15 /* enable RSVP in kernel */ -#define IP_RSVP_OFF 16 /* disable RSVP in kernel */ -#define IP_RSVP_VIF_ON 17 /* set RSVP per-vif socket */ -#define IP_RSVP_VIF_OFF 18 /* unset RSVP per-vif socket */ - -/* - * Defaults and limits for options - */ -#define IP_DEFAULT_MULTICAST_TTL 1 /* normally limit m'casts to 1 hop */ -#define IP_DEFAULT_MULTICAST_LOOP 1 /* normally hear sends if a member */ -#define IP_MAX_MEMBERSHIPS 20 /* per socket */ - -/* - * Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP. - */ -struct ip_mreq { - struct in_addr imr_multiaddr; /* IP multicast address of group */ - struct in_addr imr_interface; /* local IP address of interface */ -}; - -/* - * Definitions for inet sysctl operations. - * - * Third level is protocol number. - * Fourth level is desired variable within that protocol. - */ -#define IPPROTO_MAXID (IPPROTO_IDP + 1) /* don't list to IPPROTO_MAX */ - -#define CTL_IPPROTO_NAMES { \ - { "ip", CTLTYPE_NODE }, \ - { "icmp", CTLTYPE_NODE }, \ - { "igmp", CTLTYPE_NODE }, \ - { "ggp", CTLTYPE_NODE }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { "tcp", CTLTYPE_NODE }, \ - { 0, 0 }, \ - { "egp", CTLTYPE_NODE }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { "pup", CTLTYPE_NODE }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { "udp", CTLTYPE_NODE }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { 0, 0 }, \ - { "idp", CTLTYPE_NODE }, \ -} - -/* - * Names for IP sysctl objects - */ -#define IPCTL_FORWARDING 1 /* act as router */ -#define IPCTL_SENDREDIRECTS 2 /* may send redirects when forwarding */ -#define IPCTL_DEFTTL 3 /* default TTL */ -#ifdef notyet -#define IPCTL_DEFMTU 4 /* default MTU */ -#define IPCTL_RTEXPIRE 5 /* cloned route expiration time */ -#define IPCTL_RTMINEXPIRE 6 /* min value for expiration time */ -#define IPCTL_RTMAXCACHE 7 /* trigger level for dynamic expire */ -#define IPCTL_SOURCEROUTE 8 /* may perform source routes */ -#define IPCTL_MAXID 9 -#endif - -#define IPCTL_NAMES { \ - { 0, 0 }, \ - { "forwarding", CTLTYPE_INT }, \ - { "redirect", CTLTYPE_INT }, \ - { "ttl", CTLTYPE_INT }, \ - { "mtu", CTLTYPE_INT }, \ - { "rtexpire", CTLTYPE_INT }, \ - { "rtminexpire", CTLTYPE_INT }, \ - { "rtmaxcache", CTLTYPE_INT }, \ - { "sourceroute", CTLTYPE_INT }, \ -} - - -#ifdef KERNEL -struct ifnet; struct mbuf; /* forward declarations for Standard C */ - -int in_broadcast __P((struct in_addr, struct ifnet *)); -int in_canforward __P((struct in_addr)); -int in_cksum __P((struct mbuf *, int)); -int in_localaddr __P((struct in_addr)); -u_long in_netof __P((struct in_addr)); -void in_socktrim __P((struct sockaddr_in *)); -#ifndef _WINSOCKAPI_ -char *inet_ntoa __P((struct in_addr)); /* in libkern */ -#endif//_WINSOCKAPI_ -#endif - -#endif - diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/in_pcb.h b/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/in_pcb.h deleted file mode 100644 index 2b8cba76e41..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/in_pcb.h +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)in_pcb.h 8.1 (Berkeley) 6/10/93 - */ - -#ifndef _NETINET_IN_PCB_H_ -#define _NETINET_IN_PCB_H_ - -/* - * Common structure pcb for internet protocol implementation. - * Here are stored pointers to local and foreign host table - * entries, local and foreign socket numbers, and pointers - * up (to a socket structure) and down (to a protocol-specific) - * control block. - */ -LIST_HEAD(inpcbhead, inpcb); - -struct inpcb { - LIST_ENTRY(inpcb) inp_list; /* list for all PCBs of this proto */ - LIST_ENTRY(inpcb) inp_hash; /* hash list */ - struct inpcbinfo *inp_pcbinfo; - struct in_addr inp_faddr; /* foreign host table entry */ - u_short inp_fport; /* foreign port */ - struct in_addr inp_laddr; /* local host table entry */ - u_short inp_lport; /* local port */ - struct socket *inp_socket; /* back pointer to socket */ - caddr_t inp_ppcb; /* pointer to per-protocol pcb */ - struct route inp_route; /* placeholder for routing entry */ - int inp_flags; /* generic IP/datagram flags */ - struct ip inp_ip; /* header prototype; should have more */ - struct mbuf *inp_options; /* IP options */ - struct ip_moptions *inp_moptions; /* IP multicast options */ -}; - -struct inpcbinfo { - struct inpcbhead *listhead; - struct inpcbhead *hashbase; - unsigned long hashsize; - unsigned short lastport; -}; - -/* flags in inp_flags: */ -#define INP_RECVOPTS 0x01 /* receive incoming IP options */ -#define INP_RECVRETOPTS 0x02 /* receive IP options for reply */ -#define INP_RECVDSTADDR 0x04 /* receive IP dst address */ -#define INP_CONTROLOPTS (INP_RECVOPTS|INP_RECVRETOPTS|INP_RECVDSTADDR) -#define INP_HDRINCL 0x08 /* user supplies entire IP header */ - -#define INPLOOKUP_WILDCARD 1 - -#define sotoinpcb(so) ((struct inpcb *)(so)->so_pcb) - -#ifdef KERNEL -void in_losing __P((struct inpcb *)); -int in_pcballoc __P((struct socket *, struct inpcbinfo *)); -int in_pcbbind __P((struct inpcb *, struct mbuf *)); -int in_pcbconnect __P((struct inpcb *, struct mbuf *)); -void in_pcbdetach __P((struct inpcb *)); -void in_pcbdisconnect __P((struct inpcb *)); -void in_pcbinshash __P((struct inpcb *)); -int in_pcbladdr __P((struct inpcb *, struct mbuf *, - struct sockaddr_in **)); -struct inpcb * - in_pcblookup __P((struct inpcbhead *, - struct in_addr, u_int, struct in_addr, u_int, int)); -struct inpcb * - in_pcblookuphash __P((struct inpcbinfo *, - struct in_addr, u_int, struct in_addr, u_int)); -void in_pcbnotify __P((struct inpcbhead *, struct sockaddr *, - u_int, struct in_addr, u_int, int, void (*)(struct inpcb *, int))); -void in_pcbrehash __P((struct inpcb *)); -void in_rtchange __P((struct inpcb *, int)); -void in_setpeeraddr __P((struct inpcb *, struct mbuf *)); -void in_setsockaddr __P((struct inpcb *, struct mbuf *)); -#endif - -#endif diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/in_systm.h b/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/in_systm.h deleted file mode 100644 index 6c75203f60c..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/in_systm.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)in_systm.h 8.1 (Berkeley) 6/10/93 - */ - -#ifndef _NETINET_IN_SYSTM_H_ -#define _NETINET_IN_SYSTM_H_ - -/* - * Miscellaneous internetwork - * definitions for kernel. - */ - -/* - * Network types. - * - * Internally the system keeps counters in the headers with the bytes - * swapped so that VAX instructions will work on them. It reverses - * the bytes before transmission at each protocol level. The n_ types - * represent the types with the bytes in ``high-ender'' order. - */ -typedef u_short n_short; /* short as received from the net */ -typedef u_long n_long; /* long as received from the net */ - -typedef u_long n_time; /* ms since 00:00 GMT, byte rev */ - -#ifdef KERNEL -n_time iptime __P((void)); -#endif - -#endif diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/in_var.h b/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/in_var.h deleted file mode 100644 index bb6c9cc5375..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/in_var.h +++ /dev/null @@ -1,233 +0,0 @@ -/* - * Copyright (c) 1985, 1986, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)in_var.h 8.1 (Berkeley) 6/10/93 - */ - -#ifndef _NETINET_IN_VAR_H_ -#define _NETINET_IN_VAR_H_ - -#include -/* - * Interface address, Internet version. One of these structures - * is allocated for each interface with an Internet address. - * The ifaddr structure contains the protocol-independent part - * of the structure and is assumed to be first. - */ -struct in_ifaddr { - struct ifaddr ia_ifa; /* protocol-independent info */ -#define ia_ifp ia_ifa.ifa_ifp -#define ia_flags ia_ifa.ifa_flags - /* ia_{,sub}net{,mask} in host order */ - u_long ia_net; /* network number of interface */ - u_long ia_netmask; /* mask of net part */ - u_long ia_subnet; /* subnet number, including net */ - u_long ia_subnetmask; /* mask of subnet part */ - struct in_addr ia_netbroadcast; /* to recognize net broadcasts */ - struct in_ifaddr *ia_next; /* next in list of internet addresses */ - struct sockaddr_in ia_addr; /* reserve space for interface name */ - struct sockaddr_in ia_dstaddr; /* reserve space for broadcast addr */ -#define ia_broadaddr ia_dstaddr - struct sockaddr_in ia_sockmask; /* reserve space for general netmask */ - LIST_HEAD(in_multihead, in_multi) ia_multiaddrs; - /* list of multicast addresses */ -}; - -struct in_aliasreq { - char ifra_name[IFNAMSIZ]; /* if name, e.g. "en0" */ - struct sockaddr_in ifra_addr; - struct sockaddr_in ifra_broadaddr; -#define ifra_dstaddr ifra_broadaddr - struct sockaddr_in ifra_mask; -}; -/* - * Given a pointer to an in_ifaddr (ifaddr), - * return a pointer to the addr as a sockaddr_in. - */ -#define IA_SIN(ia) (&(((struct in_ifaddr *)(ia))->ia_addr)) -#define IA_DSTSIN(ia) (&(((struct in_ifaddr *)(ia))->ia_dstaddr)) - -#define IN_LNAOF(in, ifa) \ - ((ntohl((in).s_addr) & ~((struct in_ifaddr *)(ifa)->ia_subnetmask)) - - -#ifdef KERNEL -extern struct in_ifaddr *in_ifaddr; -extern struct ifqueue ipintrq; /* ip packet input queue */ -extern struct in_addr zeroin_addr; -extern u_char inetctlerrmap[]; -extern int rtq_reallyold; /* XXX */ -extern int rtq_minreallyold; /* XXX */ -extern int rtq_toomany; /* XXX */ - -/* - * Macro for finding the interface (ifnet structure) corresponding to one - * of our IP addresses. - */ -#define INADDR_TO_IFP(addr, ifp) \ - /* struct in_addr addr; */ \ - /* struct ifnet *ifp; */ \ -{ \ - register struct in_ifaddr *ia; \ -\ - for (ia = in_ifaddr; \ - ia != NULL && ((ia->ia_ifp->if_flags & IFF_POINTOPOINT)? \ - IA_DSTSIN(ia):IA_SIN(ia))->sin_addr.s_addr != (addr).s_addr; \ - ia = ia->ia_next) \ - continue; \ - if (ia == NULL) \ - for (ia = in_ifaddr; \ - ia != NULL; \ - ia = ia->ia_next) \ - if (ia->ia_ifp->if_flags & IFF_POINTOPOINT && \ - IA_SIN(ia)->sin_addr.s_addr == (addr).s_addr) \ - break; \ - (ifp) = (ia == NULL) ? NULL : ia->ia_ifp; \ -} - -/* - * Macro for finding the internet address structure (in_ifaddr) corresponding - * to a given interface (ifnet structure). - */ -#define IFP_TO_IA(ifp, ia) \ - /* struct ifnet *ifp; */ \ - /* struct in_ifaddr *ia; */ \ -{ \ - for ((ia) = in_ifaddr; \ - (ia) != NULL && (ia)->ia_ifp != (ifp); \ - (ia) = (ia)->ia_next) \ - continue; \ -} -#endif - -/* - * This information should be part of the ifnet structure but we don't wish - * to change that - as it might break a number of things - */ - -struct router_info { - struct ifnet *ifp; - int type; /* type of router which is querier on this interface */ - int time; /* # of slow timeouts since last old query */ - struct router_info *next; -}; - -/* - * Internet multicast address structure. There is one of these for each IP - * multicast group to which this host belongs on a given network interface. - * They are kept in a linked list, rooted in the interface's in_ifaddr - * structure. - */ -struct in_multi { - LIST_ENTRY(in_multi) inm_entry; /* list glue */ - struct in_addr inm_addr; /* IP multicast address */ - struct ifnet *inm_ifp; /* back pointer to ifnet */ - struct in_ifaddr *inm_ia; /* back pointer to in_ifaddr */ - u_int inm_refcount; /* no. membership claims by sockets */ - u_int inm_timer; /* IGMP membership report timer */ - u_int inm_state; /* state of the membership */ - struct router_info *inm_rti; /* router info*/ -}; - -#ifdef KERNEL -/* - * Structure used by macros below to remember position when stepping through - * all of the in_multi records. - */ -struct in_multistep { - struct in_ifaddr *i_ia; - struct in_multi *i_inm; -}; - -/* - * Macro for looking up the in_multi record for a given IP multicast address - * on a given interface. If no matching record is found, "inm" returns NULL. - */ -#define IN_LOOKUP_MULTI(addr, ifp, inm) \ - /* struct in_addr addr; */ \ - /* struct ifnet *ifp; */ \ - /* struct in_multi *inm; */ \ -{ \ - register struct in_ifaddr *ia; \ -\ - IFP_TO_IA((ifp), ia); \ - if (ia == NULL) \ - (inm) = NULL; \ - else \ - for ((inm) = ia->ia_multiaddrs.lh_first; \ - (inm) != NULL && (inm)->inm_addr.s_addr != (addr).s_addr; \ - (inm) = inm->inm_entry.le_next) \ - continue; \ -} - -/* - * Macro to step through all of the in_multi records, one at a time. - * The current position is remembered in "step", which the caller must - * provide. IN_FIRST_MULTI(), below, must be called to initialize "step" - * and get the first record. Both macros return a NULL "inm" when there - * are no remaining records. - */ -#define IN_NEXT_MULTI(step, inm) \ - /* struct in_multistep step; */ \ - /* struct in_multi *inm; */ \ -{ \ - if (((inm) = (step).i_inm) != NULL) \ - (step).i_inm = (inm)->inm_entry.le_next; \ - else \ - while ((step).i_ia != NULL) { \ - (inm) = (step).i_ia->ia_multiaddrs.lh_first; \ - (step).i_ia = (step).i_ia->ia_next; \ - if ((inm) != NULL) { \ - (step).i_inm = (inm)->inm_entry.le_next; \ - break; \ - } \ - } \ -} - -#define IN_FIRST_MULTI(step, inm) \ - /* struct in_multistep step; */ \ - /* struct in_multi *inm; */ \ -{ \ - (step).i_ia = in_ifaddr; \ - (step).i_inm = NULL; \ - IN_NEXT_MULTI((step), (inm)); \ -} - -int in_ifinit __P((struct ifnet *, - struct in_ifaddr *, struct sockaddr_in *, int)); -struct in_multi *in_addmulti __P((struct in_addr *, struct ifnet *)); -void in_delmulti __P((struct in_multi *)); -void in_ifscrub __P((struct ifnet *, struct in_ifaddr *)); -int in_control __P((struct socket *, int, caddr_t, struct ifnet *)); - -#endif -#endif diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/ip.h b/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/ip.h deleted file mode 100644 index 6b216deceff..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/ip.h +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)ip.h 8.1 (Berkeley) 6/10/93 - */ - -#ifndef _NETINET_IP_H_ -#define _NETINET_IP_H_ - -/* - * Definitions for internet protocol version 4. - * Per RFC 791, September 1981. - */ -#define IPVERSION 4 - -/* - * Structure of an internet header, naked of options. - * - * We declare ip_len and ip_off to be short, rather than u_short - * pragmatically since otherwise unsigned comparisons can result - * against negative integers quite easily, and fail in subtle ways. - */ -struct ip { -#if BYTE_ORDER == LITTLE_ENDIAN - u_char ip_hl:4, /* header length */ - ip_v:4; /* version */ -#endif -#if BYTE_ORDER == BIG_ENDIAN - u_char ip_v:4, /* version */ - ip_hl:4; /* header length */ -#endif - u_char ip_tos; /* type of service */ - short ip_len; /* total length */ - u_short ip_id; /* identification */ - short ip_off; /* fragment offset field */ -#define IP_DF 0x4000 /* dont fragment flag */ -#define IP_MF 0x2000 /* more fragments flag */ -#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */ - u_char ip_ttl; /* time to live */ - u_char ip_p; /* protocol */ - u_short ip_sum; /* checksum */ - struct in_addr ip_src,ip_dst; /* source and dest address */ -}; - -#define IP_MAXPACKET 65535 /* maximum packet size */ - -/* - * Definitions for IP type of service (ip_tos) - */ -#define IPTOS_LOWDELAY 0x10 -#define IPTOS_THROUGHPUT 0x08 -#define IPTOS_RELIABILITY 0x04 -#define IPTOS_MINCOST 0x02 - -/* - * Definitions for IP precedence (also in ip_tos) (hopefully unused) - */ -#define IPTOS_PREC_NETCONTROL 0xe0 -#define IPTOS_PREC_INTERNETCONTROL 0xc0 -#define IPTOS_PREC_CRITIC_ECP 0xa0 -#define IPTOS_PREC_FLASHOVERRIDE 0x80 -#define IPTOS_PREC_FLASH 0x60 -#define IPTOS_PREC_IMMEDIATE 0x40 -#define IPTOS_PREC_PRIORITY 0x20 -#define IPTOS_PREC_ROUTINE 0x00 - -/* - * Definitions for options. - */ -#define IPOPT_COPIED(o) ((o)&0x80) -#define IPOPT_CLASS(o) ((o)&0x60) -#define IPOPT_NUMBER(o) ((o)&0x1f) - -#define IPOPT_CONTROL 0x00 -#define IPOPT_RESERVED1 0x20 -#define IPOPT_DEBMEAS 0x40 -#define IPOPT_RESERVED2 0x60 - -#define IPOPT_EOL 0 /* end of option list */ -#define IPOPT_NOP 1 /* no operation */ - -#define IPOPT_RR 7 /* record packet route */ -#define IPOPT_TS 68 /* timestamp */ -#define IPOPT_SECURITY 130 /* provide s,c,h,tcc */ -#define IPOPT_LSRR 131 /* loose source route */ -#define IPOPT_SATID 136 /* satnet id */ -#define IPOPT_SSRR 137 /* strict source route */ - -/* - * Offsets to fields in options other than EOL and NOP. - */ -#define IPOPT_OPTVAL 0 /* option ID */ -#define IPOPT_OLEN 1 /* option length */ -#define IPOPT_OFFSET 2 /* offset within option */ -#define IPOPT_MINOFF 4 /* min value of above */ - -/* - * Time stamp option structure. - */ -struct ip_timestamp { - u_char ipt_code; /* IPOPT_TS */ - u_char ipt_len; /* size of structure (variable) */ - u_char ipt_ptr; /* index of current entry */ -#if BYTE_ORDER == LITTLE_ENDIAN - u_char ipt_flg:4, /* flags, see below */ - ipt_oflw:4; /* overflow counter */ -#endif -#if BYTE_ORDER == BIG_ENDIAN - u_char ipt_oflw:4, /* overflow counter */ - ipt_flg:4; /* flags, see below */ -#endif - union ipt_timestamp { - n_long ipt_time[1]; - struct ipt_ta { - struct in_addr ipt_addr; - n_long ipt_time; - } ipt_ta[1]; - } ipt_timestamp; -}; - -/* flag bits for ipt_flg */ -#define IPOPT_TS_TSONLY 0 /* timestamps only */ -#define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */ -#define IPOPT_TS_PRESPEC 3 /* specified modules only */ - -/* bits for security (not byte swapped) */ -#define IPOPT_SECUR_UNCLASS 0x0000 -#define IPOPT_SECUR_CONFID 0xf135 -#define IPOPT_SECUR_EFTO 0x789a -#define IPOPT_SECUR_MMMM 0xbc4d -#define IPOPT_SECUR_RESTR 0xaf13 -#define IPOPT_SECUR_SECRET 0xd788 -#define IPOPT_SECUR_TOPSECRET 0x6bc5 - -/* - * Internet implementation parameters. - */ -#define MAXTTL 255 /* maximum time to live (seconds) */ -#define IPDEFTTL 64 /* default ttl, from RFC 1340 */ -#define IPFRAGTTL 60 /* time to live for frags, slowhz */ -#define IPTTLDEC 1 /* subtracted when forwarding */ - -#define IP_MSS 576 /* default maximum segment size */ - -#endif diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/ip_fw.h b/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/ip_fw.h deleted file mode 100644 index 432c876ab7e..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/ip_fw.h +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (c) 1993 Daniel Boulet - * Copyright (c) 1994 Ugen J.S.Antsilevich - * - * Redistribution and use in source forms, with and without modification, - * are permitted provided that this entire comment appears intact. - * - * Redistribution in binary form may occur without any restrictions. - * Obviously, it would be nice if you gave credit where credit is due - * but requiring it would be too onerous. - * - * This software is provided ``AS IS'' without any warranties of any kind. - * - */ - -/* - * Format of an IP firewall descriptor - * - * fw_src, fw_dst, fw_smsk, fw_dmsk are always stored in network byte order. - * fw_flg and fw_n*p are stored in host byte order (of course). - * Port numbers are stored in HOST byte order. - */ -#ifndef _IP_FW_H -#define _IP_FW_H - -struct ip_fw { - u_long fw_pcnt,fw_bcnt; /* Packet and byte counters */ - struct in_addr fw_src, fw_dst; /* Source and destination IP addr */ - struct in_addr fw_smsk, fw_dmsk; /* Mask for src and dest IP addr */ - union { - struct in_addr fu_via_ip; - struct { -#define FW_IFNLEN 6 /* To keep structure on 2^x boundary */ - char fu_via_name[FW_IFNLEN]; - short fu_via_unit; - } fu_via_if; - } fu_via_un; -#define fw_via_ip fu_via_un.fu_via_ip -#define fw_via_name fu_via_un.fu_via_if.fu_via_name -#define fw_via_unit fu_via_un.fu_via_if.fu_via_unit - u_short fw_number; - u_short fw_flg; /* Flags word */ - u_short fw_nsp, fw_ndp; /* N'of src ports and # of dst ports */ - /* in ports array (dst ports follow */ - /* src ports; max of 10 ports in all; */ - /* count of 0 means match all ports) */ -#define IP_FW_MAX_PORTS 10 /* A reasonable maximum */ - u_short fw_pts[IP_FW_MAX_PORTS]; /* Array of port numbers to match */ - u_char fw_ipopt,fw_ipnopt; /* IP options set/unset */ - u_char fw_tcpf,fw_tcpnf; /* TCP flags set/unset */ -#define IP_FW_ICMPTYPES_DIM (256 / (sizeof(unsigned) * 8)) - unsigned fw_icmptypes[IP_FW_ICMPTYPES_DIM]; /* ICMP types bitmap */ - long timestamp; /* timestamp (tv_sec) of last match */ -}; - -struct ip_fw_chain { - LIST_ENTRY(ip_fw_chain) chain; - struct ip_fw *rule; -}; - -/* - * Values for "flags" field . - */ - -#define IP_FW_F_ALL 0x0000 /* This is a universal packet rule */ -#define IP_FW_F_TCP 0x0001 /* This is a TCP packet rule */ -#define IP_FW_F_UDP 0x0002 /* This is a UDP packet rule */ -#define IP_FW_F_ICMP 0x0003 /* This is a ICMP packet rule */ -#define IP_FW_F_KIND 0x0003 /* Mask to isolate rule kind */ - -#define IP_FW_F_IN 0x0004 /* Inbound */ -#define IP_FW_F_OUT 0x0008 /* Outbound */ - -#define IP_FW_F_ACCEPT 0x0010 /* This is an accept rule */ -#define IP_FW_F_COUNT 0x0020 /* This is an accept rule */ -#define IP_FW_F_PRN 0x0040 /* Print if this rule matches */ -#define IP_FW_F_ICMPRPL 0x0080 /* Send back icmp unreachable packet */ - -#define IP_FW_F_SRNG 0x0100 /* The first two src ports are a min * - * and max range (stored in host byte * - * order). */ - -#define IP_FW_F_DRNG 0x0200 /* The first two dst ports are a min * - * and max range (stored in host byte * - * order). */ - -#define IP_FW_F_IFNAME 0x0400 /* Use interface name/unit (not IP) */ - -#define IP_FW_F_FRAG 0x0800 /* Fragment */ - -#define IP_FW_F_ICMPBIT 0x1000 /* ICMP type bitmap is valid */ - -#define IP_FW_F_IFUWILD 0x2000 /* Match all interface units */ - -#define IP_FW_F_MASK 0x3FFF /* All possible flag bits mask */ - -/* - * Definitions for IP option names. - */ -#define IP_FW_IPOPT_LSRR 0x01 -#define IP_FW_IPOPT_SSRR 0x02 -#define IP_FW_IPOPT_RR 0x04 -#define IP_FW_IPOPT_TS 0x08 - -/* - * Definitions for TCP flags. - */ -#define IP_FW_TCPF_FIN TH_FIN -#define IP_FW_TCPF_SYN TH_SYN -#define IP_FW_TCPF_RST TH_RST -#define IP_FW_TCPF_PSH TH_PUSH -#define IP_FW_TCPF_ACK TH_ACK -#define IP_FW_TCPF_URG TH_URG -#define IP_FW_TCPF_ESTAB 0x40 - -/* - * New IP firewall options for [gs]etsockopt at the RAW IP level. - */ -#define IP_FW_BASE_CTL 50 - -#define IP_FW_ADD (IP_FW_BASE_CTL+0) -#define IP_FW_DEL (IP_FW_BASE_CTL+1) -#define IP_FW_FLUSH (IP_FW_BASE_CTL+2) -#define IP_FW_ZERO (IP_FW_BASE_CTL+3) -#define IP_FW_GET (IP_FW_BASE_CTL+4) - -/* - * Main firewall chains definitions and global var's definitions. - */ -#ifdef KERNEL - -/* - * Function pointers. - */ -extern int (*ip_fw_chk_ptr)(struct mbuf *, struct ip *,struct ifnet *, int dir); -extern int (*ip_fw_ctl_ptr)(int,struct mbuf **); - -/* - * Function definitions. - */ -void ip_fw_init(void); - -#endif /* KERNEL */ - -#endif /* _IP_FW_H */ diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/ip_icmp.h b/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/ip_icmp.h deleted file mode 100644 index a4b49c36706..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/ip_icmp.h +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)ip_icmp.h 8.1 (Berkeley) 6/10/93 - */ - -#ifndef _NETINET_IP_ICMP_H_ -#define _NETINET_IP_ICMP_H_ - -/* - * Interface Control Message Protocol Definitions. - * Per RFC 792, September 1981. - */ - -/* - * Internal of an ICMP Router Advertisement - */ -struct icmp_ra_addr { - u_int32_t ira_addr; - u_int32_t ira_preference; -}; - -/* - * Structure of an icmp header. - */ -struct icmp { - u_char icmp_type; /* type of message, see below */ - u_char icmp_code; /* type sub code */ - u_short icmp_cksum; /* ones complement cksum of struct */ - union { - u_char ih_pptr; /* ICMP_PARAMPROB */ - struct in_addr ih_gwaddr; /* ICMP_REDIRECT */ - struct ih_idseq { - n_short icd_id; - n_short icd_seq; - } ih_idseq; - int ih_void; - - /* ICMP_UNREACH_NEEDFRAG -- Path MTU Discovery (RFC1191) */ - struct ih_pmtu { - n_short ipm_void; - n_short ipm_nextmtu; - } ih_pmtu; - - struct ih_rtradv { - u_char irt_num_addrs; - u_char irt_wpa; - u_int16_t irt_lifetime; - } ih_rtradv; - } icmp_hun; -#define icmp_pptr icmp_hun.ih_pptr -#define icmp_gwaddr icmp_hun.ih_gwaddr -#define icmp_id icmp_hun.ih_idseq.icd_id -#define icmp_seq icmp_hun.ih_idseq.icd_seq -#define icmp_void icmp_hun.ih_void -#define icmp_pmvoid icmp_hun.ih_pmtu.ipm_void -#define icmp_nextmtu icmp_hun.ih_pmtu.ipm_nextmtu -#define icmp_num_addrs icmp_hun.ih_rtradv.irt_num_addrs -#define icmp_wpa icmp_hun.ih_rtradv.irt_wpa -#define icmp_lifetime icmp_hun.ih_rtradv.irt_lifetime - union { - struct id_ts { - n_time its_otime; - n_time its_rtime; - n_time its_ttime; - } id_ts; - struct id_ip { - struct ip idi_ip; - /* options and then 64 bits of data */ - } id_ip; - struct icmp_ra_addr id_radv; - u_long id_mask; - char id_data[1]; - } icmp_dun; -#define icmp_otime icmp_dun.id_ts.its_otime -#define icmp_rtime icmp_dun.id_ts.its_rtime -#define icmp_ttime icmp_dun.id_ts.its_ttime -#define icmp_ip icmp_dun.id_ip.idi_ip -#define icmp_radv icmp_dun.id_radv -#define icmp_mask icmp_dun.id_mask -#define icmp_data icmp_dun.id_data -}; - -/* - * Lower bounds on packet lengths for various types. - * For the error advice packets must first insure that the - * packet is large enough to contain the returned ip header. - * Only then can we do the check to see if 64 bits of packet - * data have been returned, since we need to check the returned - * ip header length. - */ -#define ICMP_MINLEN 8 /* abs minimum */ -#define ICMP_TSLEN (8 + 3 * sizeof (n_time)) /* timestamp */ -#define ICMP_MASKLEN 12 /* address mask */ -#define ICMP_ADVLENMIN (8 + sizeof (struct ip) + 8) /* min */ -#define ICMP_ADVLEN(p) (8 + ((p)->icmp_ip.ip_hl << 2) + 8) - /* N.B.: must separately check that ip_hl >= 5 */ - -/* - * Definition of type and code field values. - */ -#define ICMP_ECHOREPLY 0 /* echo reply */ -#define ICMP_UNREACH 3 /* dest unreachable, codes: */ -#define ICMP_UNREACH_NET 0 /* bad net */ -#define ICMP_UNREACH_HOST 1 /* bad host */ -#define ICMP_UNREACH_PROTOCOL 2 /* bad protocol */ -#define ICMP_UNREACH_PORT 3 /* bad port */ -#define ICMP_UNREACH_NEEDFRAG 4 /* IP_DF caused drop */ -#define ICMP_UNREACH_SRCFAIL 5 /* src route failed */ -#define ICMP_UNREACH_NET_UNKNOWN 6 /* unknown net */ -#define ICMP_UNREACH_HOST_UNKNOWN 7 /* unknown host */ -#define ICMP_UNREACH_ISOLATED 8 /* src host isolated */ -#define ICMP_UNREACH_NET_PROHIB 9 /* prohibited access */ -#define ICMP_UNREACH_HOST_PROHIB 10 /* ditto */ -#define ICMP_UNREACH_TOSNET 11 /* bad tos for net */ -#define ICMP_UNREACH_TOSHOST 12 /* bad tos for host */ -#define ICMP_SOURCEQUENCH 4 /* packet lost, slow down */ -#define ICMP_REDIRECT 5 /* shorter route, codes: */ -#define ICMP_REDIRECT_NET 0 /* for network */ -#define ICMP_REDIRECT_HOST 1 /* for host */ -#define ICMP_REDIRECT_TOSNET 2 /* for tos and net */ -#define ICMP_REDIRECT_TOSHOST 3 /* for tos and host */ -#define ICMP_ECHO 8 /* echo service */ -#define ICMP_ROUTERADVERT 9 /* router advertisement */ -#define ICMP_ROUTERSOLICIT 10 /* router solicitation */ -#define ICMP_TIMXCEED 11 /* time exceeded, code: */ -#define ICMP_TIMXCEED_INTRANS 0 /* ttl==0 in transit */ -#define ICMP_TIMXCEED_REASS 1 /* ttl==0 in reass */ -#define ICMP_PARAMPROB 12 /* ip header bad */ -#define ICMP_PARAMPROB_OPTABSENT 1 /* req. opt. absent */ -#define ICMP_TSTAMP 13 /* timestamp request */ -#define ICMP_TSTAMPREPLY 14 /* timestamp reply */ -#define ICMP_IREQ 15 /* information request */ -#define ICMP_IREQREPLY 16 /* information reply */ -#define ICMP_MASKREQ 17 /* address mask request */ -#define ICMP_MASKREPLY 18 /* address mask reply */ - -#define ICMP_MAXTYPE 18 - -#define ICMP_INFOTYPE(type) \ - ((type) == ICMP_ECHOREPLY || (type) == ICMP_ECHO || \ - (type) == ICMP_ROUTERADVERT || (type) == ICMP_ROUTERSOLICIT || \ - (type) == ICMP_TSTAMP || (type) == ICMP_TSTAMPREPLY || \ - (type) == ICMP_IREQ || (type) == ICMP_IREQREPLY || \ - (type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY) - -#ifdef KERNEL -void icmp_error __P((struct mbuf *, int, int, n_long, struct ifnet *)); -void icmp_input __P((struct mbuf *, int)); -void icmp_reflect __P((struct mbuf *)); -void icmp_send __P((struct mbuf *, struct mbuf *)); -int icmp_sysctl __P((int *, u_int, void *, size_t *, void *, size_t)); -#endif - -#endif diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/ip_var.h b/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/ip_var.h deleted file mode 100644 index 4ac8063212f..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/ip_var.h +++ /dev/null @@ -1,210 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)ip_var.h 8.1 (Berkeley) 6/10/93 - */ - -#ifndef _NETINET_IP_VAR_H_ -#define _NETINET_IP_VAR_H_ - -/* - * Overlay for ip header used by other protocols (tcp, udp). - */ -struct ipovly { - caddr_t ih_next, ih_prev; /* for protocol sequence q's */ - u_char ih_x1; /* (unused) */ - u_char ih_pr; /* protocol */ - short ih_len; /* protocol length */ - struct in_addr ih_src; /* source internet address */ - struct in_addr ih_dst; /* destination internet address */ -}; - -/* - * Ip reassembly queue structure. Each fragment - * being reassembled is attached to one of these structures. - * They are timed out after ipq_ttl drops to 0, and may also - * be reclaimed if memory becomes tight. - */ -struct ipq { - struct ipq *next,*prev; /* to other reass headers */ - u_char ipq_ttl; /* time for reass q to live */ - u_char ipq_p; /* protocol of this fragment */ - u_short ipq_id; /* sequence id for reassembly */ - struct ipasfrag *ipq_next,*ipq_prev; - /* to ip headers of fragments */ - struct in_addr ipq_src,ipq_dst; -}; - -/* - * Ip header, when holding a fragment. - * - * Note: ipf_next must be at same offset as ipq_next above - */ -struct ipasfrag { -#if BYTE_ORDER == LITTLE_ENDIAN - u_char ip_hl:4, - ip_v:4; -#endif -#if BYTE_ORDER == BIG_ENDIAN - u_char ip_v:4, - ip_hl:4; -#endif - u_char ipf_mff; /* XXX overlays ip_tos: use low bit - * to avoid destroying tos; - * copied from (ip_off&IP_MF) */ - short ip_len; - u_short ip_id; - short ip_off; - u_char ip_ttl; - u_char ip_p; - u_short ip_sum; - struct ipasfrag *ipf_next; /* next fragment */ - struct ipasfrag *ipf_prev; /* previous fragment */ -}; - -/* - * Structure stored in mbuf in inpcb.ip_options - * and passed to ip_output when ip options are in use. - * The actual length of the options (including ipopt_dst) - * is in m_len. - */ -#define MAX_IPOPTLEN 40 - -struct ipoption { - struct in_addr ipopt_dst; /* first-hop dst if source routed */ - char ipopt_list[MAX_IPOPTLEN]; /* options proper */ -}; - -/* - * Structure attached to inpcb.ip_moptions and - * passed to ip_output when IP multicast options are in use. - */ -struct ip_moptions { - struct ifnet *imo_multicast_ifp; /* ifp for outgoing multicasts */ - u_char imo_multicast_ttl; /* TTL for outgoing multicasts */ - u_char imo_multicast_loop; /* 1 => hear sends if a member */ - u_short imo_num_memberships; /* no. memberships this socket */ - struct in_multi *imo_membership[IP_MAX_MEMBERSHIPS]; - u_long imo_multicast_vif; /* vif num outgoing multicasts */ -}; - -struct ipstat { - u_long ips_total; /* total packets received */ - u_long ips_badsum; /* checksum bad */ - u_long ips_tooshort; /* packet too short */ - u_long ips_toosmall; /* not enough data */ - u_long ips_badhlen; /* ip header length < data size */ - u_long ips_badlen; /* ip length < ip header length */ - u_long ips_fragments; /* fragments received */ - u_long ips_fragdropped; /* frags dropped (dups, out of space) */ - u_long ips_fragtimeout; /* fragments timed out */ - u_long ips_forward; /* packets forwarded */ - u_long ips_cantforward; /* packets rcvd for unreachable dest */ - u_long ips_redirectsent; /* packets forwarded on same net */ - u_long ips_noproto; /* unknown or unsupported protocol */ - u_long ips_delivered; /* datagrams delivered to upper level*/ - u_long ips_localout; /* total ip packets generated here */ - u_long ips_odropped; /* lost packets due to nobufs, etc. */ - u_long ips_reassembled; /* total packets reassembled ok */ - u_long ips_fragmented; /* datagrams sucessfully fragmented */ - u_long ips_ofragments; /* output fragments created */ - u_long ips_cantfrag; /* don't fragment flag was set, etc. */ - u_long ips_badoptions; /* error in option processing */ - u_long ips_noroute; /* packets discarded due to no route */ - u_long ips_badvers; /* ip version != 4 */ - u_long ips_rawout; /* total raw ip packets generated */ -}; - -#ifdef KERNEL -/* flags passed to ip_output as last parameter */ -#define IP_FORWARDING 0x1 /* most of ip header exists */ -#define IP_RAWOUTPUT 0x2 /* raw ip header exists */ -#define IP_ROUTETOIF SO_DONTROUTE /* bypass routing tables */ -#define IP_ALLOWBROADCAST SO_BROADCAST /* can send broadcast packets */ - -extern struct ipstat ipstat; -extern struct ipq ipq; /* ip reass. queue */ -extern u_short ip_id; /* ip packet ctr, for ids */ -extern int ip_defttl; /* default IP ttl */ -extern u_char ip_protox[]; -extern struct socket *ip_rsvpd; /* reservation protocol daemon */ -extern struct socket *ip_mrouter; /* multicast routing daemon */ -extern int (*legal_vif_num) __P((int)); -extern u_long (*ip_mcast_src) __P((int)); -extern int rsvp_on; - -int ip_ctloutput __P((int, struct socket *, int, int, struct mbuf **)); -void ip_deq __P((struct ipasfrag *)); -int ip_dooptions __P((struct mbuf *)); -void ip_drain __P((void)); -void ip_enq __P((struct ipasfrag *, struct ipasfrag *)); -void ip_forward __P((struct mbuf *, int)); -void ip_freef __P((struct ipq *)); -void ip_freemoptions __P((struct ip_moptions *)); -int ip_getmoptions __P((int, struct ip_moptions *, struct mbuf **)); -void ip_init __P((void)); -extern int (*ip_mforward) __P((struct ip *, struct ifnet *, struct mbuf *, - struct ip_moptions *)); -int ip_next_mtu __P((int, int)); -int ip_optcopy __P((struct ip *, struct ip *)); -int ip_output __P((struct mbuf *, struct mbuf *, struct route *, int, - struct ip_moptions *)); -int ip_pcbopts __P((struct mbuf **, struct mbuf *)); -struct ip * - ip_reass __P((struct ipasfrag *, struct ipq *)); -struct in_ifaddr * - ip_rtaddr __P((struct in_addr)); -int ip_setmoptions __P((int, struct ip_moptions **, struct mbuf *)); -void ip_slowtimo __P((void)); -struct mbuf * - ip_srcroute __P((void)); -void ip_stripoptions __P((struct mbuf *, struct mbuf *)); -int ip_sysctl __P((int *, u_int, void *, size_t *, void *, size_t)); -void ipintr __P((void)); -int rip_ctloutput __P((int, struct socket *, int, int, struct mbuf **)); -void rip_init __P((void)); -void rip_input __P((struct mbuf *)); -int rip_output __P((struct mbuf *, struct socket *, u_long)); -int rip_usrreq __P((struct socket *, - int, struct mbuf *, struct mbuf *, struct mbuf *)); -int ip_rsvp_init __P((struct socket *)); -int ip_rsvp_done __P((void)); -int ip_rsvp_vif_init __P((struct socket *, struct mbuf *)); -int ip_rsvp_vif_done __P((struct socket *, struct mbuf *)); -void ip_rsvp_force_done __P((struct socket *)); - -void rip_ip_input __P((struct mbuf *mm, - register struct socket *ip_mrouter, struct sockaddr *src)); - -#endif - -#endif diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/tcp.h b/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/tcp.h deleted file mode 100644 index 5b31bda2979..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/tcp.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)tcp.h 8.1 (Berkeley) 6/10/93 - */ - -#ifndef _NETINET_TCP_H_ -#define _NETINET_TCP_H_ - -typedef u_long tcp_seq; -typedef u_long tcp_cc; /* connection count per rfc1644 */ - -/* - * TCP header. - * Per RFC 793, September, 1981. - */ -struct tcphdr { - u_short th_sport; /* source port */ - u_short th_dport; /* destination port */ - tcp_seq th_seq; /* sequence number */ - tcp_seq th_ack; /* acknowledgement number */ -#if BYTE_ORDER == LITTLE_ENDIAN - u_char th_x2:4, /* (unused) */ - th_off:4; /* data offset */ -#endif -#if BYTE_ORDER == BIG_ENDIAN - u_char th_off:4, /* data offset */ - th_x2:4; /* (unused) */ -#endif - u_char th_flags; -#define TH_FIN 0x01 -#define TH_SYN 0x02 -#define TH_RST 0x04 -#define TH_PUSH 0x08 -#define TH_ACK 0x10 -#define TH_URG 0x20 -#define TH_FLAGS (TH_FIN|TH_SYN|TH_RST|TH_ACK|TH_URG) - - u_short th_win; /* window */ - u_short th_sum; /* checksum */ - u_short th_urp; /* urgent pointer */ -}; - -#define TCPOPT_EOL 0 -#define TCPOPT_NOP 1 -#define TCPOPT_MAXSEG 2 -#define TCPOLEN_MAXSEG 4 -#define TCPOPT_WINDOW 3 -#define TCPOLEN_WINDOW 3 -#define TCPOPT_SACK_PERMITTED 4 /* Experimental */ -#define TCPOLEN_SACK_PERMITTED 2 -#define TCPOPT_SACK 5 /* Experimental */ -#define TCPOPT_TIMESTAMP 8 -#define TCPOLEN_TIMESTAMP 10 -#define TCPOLEN_TSTAMP_APPA (TCPOLEN_TIMESTAMP+2) /* appendix A */ -#define TCPOPT_TSTAMP_HDR \ - (TCPOPT_NOP<<24|TCPOPT_NOP<<16|TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP) - -#define TCPOPT_CC 11 /* CC options: RFC-1644 */ -#define TCPOPT_CCNEW 12 -#define TCPOPT_CCECHO 13 -#define TCPOLEN_CC 6 -#define TCPOLEN_CC_APPA (TCPOLEN_CC+2) -#define TCPOPT_CC_HDR(ccopt) \ - (TCPOPT_NOP<<24|TCPOPT_NOP<<16|(ccopt)<<8|TCPOLEN_CC) - -/* - * Default maximum segment size for TCP. - * With an IP MSS of 576, this is 536, - * but 512 is probably more convenient. - * This should be defined as MIN(512, IP_MSS - sizeof (struct tcpiphdr)). - */ -#define TCP_MSS 512 - -#define TCP_MAXWIN 65535 /* largest value for (unscaled) window */ -#define TTCP_CLIENT_SND_WND 4096 /* dflt send window for T/TCP client */ - -#define TCP_MAX_WINSHIFT 14 /* maximum window shift */ - -#define TCP_MAXHLEN (0xf<<2) /* max length of header in bytes */ -#define TCP_MAXOLEN (TCP_MAXHLEN - sizeof(struct tcphdr)) - /* max space left for options */ - -/* - * User-settable options (used with setsockopt). - */ -#ifndef _WINSOCKAPI_ -#define TCP_NODELAY 0x01 /* don't delay send to coalesce packets */ -#endif/*_WINSOCKAPI_*/ -#define TCP_MAXSEG 0x02 /* set maximum segment size */ -#define TCP_NOPUSH 0x04 /* don't push last block of write */ -#define TCP_NOOPT 0x08 /* don't use TCP options */ - -#endif diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/tcp_debug.h b/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/tcp_debug.h deleted file mode 100644 index 5266eeb64f1..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/tcp_debug.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)tcp_debug.h 8.1 (Berkeley) 6/10/93 - */ - -#ifndef _NETINET_TCP_DEBUG_H_ -#define _NETINET_TCP_DEBUG_H_ - -struct tcp_debug { - n_time td_time; - short td_act; - short td_ostate; - caddr_t td_tcb; - struct tcpiphdr td_ti; - short td_req; - struct tcpcb td_cb; -}; - -#define TA_INPUT 0 -#define TA_OUTPUT 1 -#define TA_USER 2 -#define TA_RESPOND 3 -#define TA_DROP 4 - -#ifdef TANAMES -char *tanames[] = - { "input", "output", "user", "respond", "drop" }; -#endif - -#define TCP_NDEBUG 100 -struct tcp_debug tcp_debug[TCP_NDEBUG]; -int tcp_debx; - -#endif diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/tcp_fsm.h b/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/tcp_fsm.h deleted file mode 100644 index 5cbb3ec697b..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/tcp_fsm.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)tcp_fsm.h 8.1 (Berkeley) 6/10/93 - */ - -#ifndef _NETINET_TCP_FSM_H_ -#define _NETINET_TCP_FSM_H_ - -/* - * TCP FSM state definitions. - * Per RFC793, September, 1981. - */ - -#define TCP_NSTATES 11 - -#define TCPS_CLOSED 0 /* closed */ -#define TCPS_LISTEN 1 /* listening for connection */ -#define TCPS_SYN_SENT 2 /* active, have sent syn */ -#define TCPS_SYN_RECEIVED 3 /* have send and received syn */ -/* states < TCPS_ESTABLISHED are those where connections not established */ -#define TCPS_ESTABLISHED 4 /* established */ -#define TCPS_CLOSE_WAIT 5 /* rcvd fin, waiting for close */ -/* states > TCPS_CLOSE_WAIT are those where user has closed */ -#define TCPS_FIN_WAIT_1 6 /* have closed, sent fin */ -#define TCPS_CLOSING 7 /* closed xchd FIN; await FIN ACK */ -#define TCPS_LAST_ACK 8 /* had fin and close; await FIN ACK */ -/* states > TCPS_CLOSE_WAIT && < TCPS_FIN_WAIT_2 await ACK of FIN */ -#define TCPS_FIN_WAIT_2 9 /* have closed, fin is acked */ -#define TCPS_TIME_WAIT 10 /* in 2*msl quiet wait after close */ - -#define TCPS_HAVERCVDSYN(s) ((s) >= TCPS_SYN_RECEIVED) -#define TCPS_HAVEESTABLISHED(s) ((s) >= TCPS_ESTABLISHED) -#define TCPS_HAVERCVDFIN(s) ((s) >= TCPS_TIME_WAIT) - -#ifdef TCPOUTFLAGS -/* - * Flags used when sending segments in tcp_output. - * Basic flags (TH_RST,TH_ACK,TH_SYN,TH_FIN) are totally - * determined by state, with the proviso that TH_FIN is sent only - * if all data queued for output is included in the segment. - */ -u_char tcp_outflags[TCP_NSTATES] = { - TH_RST|TH_ACK, 0, TH_SYN, TH_SYN|TH_ACK, - TH_ACK, TH_ACK, - TH_FIN|TH_ACK, TH_FIN|TH_ACK, TH_FIN|TH_ACK, TH_ACK, TH_ACK, -}; -#endif - -#ifdef KPROF -int tcp_acounts[TCP_NSTATES][PRU_NREQ]; -#endif - -#ifdef TCPSTATES -char *tcpstates[] = { - "CLOSED", "LISTEN", "SYN_SENT", "SYN_RCVD", - "ESTABLISHED", "CLOSE_WAIT", "FIN_WAIT_1", "CLOSING", - "LAST_ACK", "FIN_WAIT_2", "TIME_WAIT", -}; -#endif - -#endif diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/tcp_seq.h b/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/tcp_seq.h deleted file mode 100644 index 9baf72e5e2f..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/tcp_seq.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)tcp_seq.h 8.1 (Berkeley) 6/10/93 - */ - -#ifndef _NETINET_TCP_SEQ_H_ -#define _NETINET_TCP_SEQ_H_ -/* - * TCP sequence numbers are 32 bit integers operated - * on with modular arithmetic. These macros can be - * used to compare such integers. - */ -#define SEQ_LT(a,b) ((int)((a)-(b)) < 0) -#define SEQ_LEQ(a,b) ((int)((a)-(b)) <= 0) -#define SEQ_GT(a,b) ((int)((a)-(b)) > 0) -#define SEQ_GEQ(a,b) ((int)((a)-(b)) >= 0) - -/* for modulo comparisons of timestamps */ -#define TSTMP_LT(a,b) ((int)((a)-(b)) < 0) -#define TSTMP_GEQ(a,b) ((int)((a)-(b)) >= 0) - -/* - * TCP connection counts are 32 bit integers operated - * on with modular arithmetic. These macros can be - * used to compare such integers. - */ -#define CC_LT(a,b) ((int)((a)-(b)) < 0) -#define CC_LEQ(a,b) ((int)((a)-(b)) <= 0) -#define CC_GT(a,b) ((int)((a)-(b)) > 0) -#define CC_GEQ(a,b) ((int)((a)-(b)) >= 0) - -/* Macro to increment a CC: skip 0 which has a special meaning */ -#define CC_INC(c) (++(c) == 0 ? ++(c) : (c)) - -/* - * Macros to initialize tcp sequence numbers for - * send and receive from initial send and receive - * sequence numbers. - */ -#define tcp_rcvseqinit(tp) \ - (tp)->rcv_adv = (tp)->rcv_nxt = (tp)->irs + 1 - -#define tcp_sendseqinit(tp) \ - (tp)->snd_una = (tp)->snd_nxt = (tp)->snd_max = (tp)->snd_up = \ - (tp)->iss - -#define TCP_ISSINCR (125*1024) /* increment for tcp_iss each second */ - -#define TCP_PAWS_IDLE (24 * 24 * 60 * 60 * PR_SLOWHZ) - /* timestamp wrap-around time */ - -#ifdef KERNEL -extern tcp_seq tcp_iss; /* tcp initial send seq # */ -extern tcp_cc tcp_ccgen; /* global connection count */ -#endif -#endif diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/tcp_timer.h b/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/tcp_timer.h deleted file mode 100644 index dd96dc9bf14..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/tcp_timer.h +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)tcp_timer.h 8.1 (Berkeley) 6/10/93 - */ - -#ifndef _NETINET_TCP_TIMER_H_ -#define _NETINET_TCP_TIMER_H_ - -/* - * Definitions of the TCP timers. These timers are counted - * down PR_SLOWHZ times a second. - */ -#define TCPT_NTIMERS 4 - -#define TCPT_REXMT 0 /* retransmit */ -#define TCPT_PERSIST 1 /* retransmit persistance */ -#define TCPT_KEEP 2 /* keep alive */ -#define TCPT_2MSL 3 /* 2*msl quiet time timer */ - -/* - * The TCPT_REXMT timer is used to force retransmissions. - * The TCP has the TCPT_REXMT timer set whenever segments - * have been sent for which ACKs are expected but not yet - * received. If an ACK is received which advances tp->snd_una, - * then the retransmit timer is cleared (if there are no more - * outstanding segments) or reset to the base value (if there - * are more ACKs expected). Whenever the retransmit timer goes off, - * we retransmit one unacknowledged segment, and do a backoff - * on the retransmit timer. - * - * The TCPT_PERSIST timer is used to keep window size information - * flowing even if the window goes shut. If all previous transmissions - * have been acknowledged (so that there are no retransmissions in progress), - * and the window is too small to bother sending anything, then we start - * the TCPT_PERSIST timer. When it expires, if the window is nonzero, - * we go to transmit state. Otherwise, at intervals send a single byte - * into the peer's window to force him to update our window information. - * We do this at most as often as TCPT_PERSMIN time intervals, - * but no more frequently than the current estimate of round-trip - * packet time. The TCPT_PERSIST timer is cleared whenever we receive - * a window update from the peer. - * - * The TCPT_KEEP timer is used to keep connections alive. If an - * connection is idle (no segments received) for TCPTV_KEEP_INIT amount of time, - * but not yet established, then we drop the connection. Once the connection - * is established, if the connection is idle for TCPTV_KEEP_IDLE time - * (and keepalives have been enabled on the socket), we begin to probe - * the connection. We force the peer to send us a segment by sending: - * - * This segment is (deliberately) outside the window, and should elicit - * an ack segment in response from the peer. If, despite the TCPT_KEEP - * initiated segments we cannot elicit a response from a peer in TCPT_MAXIDLE - * amount of time probing, then we drop the connection. - */ - -/* - * Time constants. - */ -#define TCPTV_MSL ( 30*PR_SLOWHZ) /* max seg lifetime (hah!) */ -#define TCPTV_SRTTBASE 0 /* base roundtrip time; - if 0, no idea yet */ -#define TCPTV_SRTTDFLT ( 3*PR_SLOWHZ) /* assumed RTT if no info */ - -#define TCPTV_PERSMIN ( 5*PR_SLOWHZ) /* retransmit persistance */ -#define TCPTV_PERSMAX ( 60*PR_SLOWHZ) /* maximum persist interval */ - -#define TCPTV_KEEP_INIT ( 75*PR_SLOWHZ) /* initial connect keep alive */ -#define TCPTV_KEEP_IDLE (120*60*PR_SLOWHZ) /* dflt time before probing */ -#define TCPTV_KEEPINTVL ( 75*PR_SLOWHZ) /* default probe interval */ -#define TCPTV_KEEPCNT 8 /* max probes before drop */ - -#define TCPTV_MIN ( 1*PR_SLOWHZ) /* minimum allowable value */ -#define TCPTV_REXMTMAX ( 64*PR_SLOWHZ) /* max allowable REXMT value */ - -#define TCPTV_TWTRUNC 8 /* RTO factor to truncate TW */ - -#define TCP_LINGERTIME 120 /* linger at most 2 minutes */ - -#define TCP_MAXRXTSHIFT 12 /* maximum retransmits */ - -#ifdef TCPTIMERS -char *tcptimers[] = - { "REXMT", "PERSIST", "KEEP", "2MSL" }; -#endif - -/* - * Force a time value to be in a certain range. - */ -#define TCPT_RANGESET(tv, value, tvmin, tvmax) { \ - (tv) = (value); \ - if ((u_long)(tv) < (u_long)(tvmin)) \ - (tv) = (tvmin); \ - else if ((u_long)(tv) > (u_long)(tvmax)) \ - (tv) = (tvmax); \ -} - -#ifdef KERNEL -extern int tcp_keepinit; /* time to establish connection */ -extern int tcp_keepidle; /* time before keepalive probes begin */ -extern int tcp_keepintvl; /* time between keepalive probes */ -extern int tcp_maxidle; /* time to drop after starting probes */ -extern int tcp_ttl; /* time to live for TCP segs */ -extern int tcp_backoff[]; -#endif - -#endif diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/tcp_var.h b/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/tcp_var.h deleted file mode 100644 index a7eb3e2ac42..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/tcp_var.h +++ /dev/null @@ -1,387 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1993, 1994 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)tcp_var.h 8.3 (Berkeley) 4/10/94 - */ - -#ifndef _NETINET_TCP_VAR_H_ -#define _NETINET_TCP_VAR_H_ -/* - * Kernel variables for tcp. - */ - -/* - * Tcp control block, one per tcp; fields: - */ -struct tcpcb { - struct tcpiphdr *seg_next; /* sequencing queue */ - struct tcpiphdr *seg_prev; - int t_state; /* state of this connection */ - int t_timer[TCPT_NTIMERS]; /* tcp timers */ - int t_rxtshift; /* log(2) of rexmt exp. backoff */ - int t_rxtcur; /* current retransmit value */ - int t_dupacks; /* consecutive dup acks recd */ - u_int t_maxseg; /* maximum segment size */ - u_int t_maxopd; /* mss plus options */ - int t_force; /* 1 if forcing out a byte */ - u_int t_flags; -#define TF_ACKNOW 0x0001 /* ack peer immediately */ -#define TF_DELACK 0x0002 /* ack, but try to delay it */ -#define TF_NODELAY 0x0004 /* don't delay packets to coalesce */ -#define TF_NOOPT 0x0008 /* don't use tcp options */ -#define TF_SENTFIN 0x0010 /* have sent FIN */ -#define TF_REQ_SCALE 0x0020 /* have/will request window scaling */ -#define TF_RCVD_SCALE 0x0040 /* other side has requested scaling */ -#define TF_REQ_TSTMP 0x0080 /* have/will request timestamps */ -#define TF_RCVD_TSTMP 0x0100 /* a timestamp was received in SYN */ -#define TF_SACK_PERMIT 0x0200 /* other side said I could SACK */ -#define TF_NEEDSYN 0x0400 /* send SYN (implicit state) */ -#define TF_NEEDFIN 0x0800 /* send FIN (implicit state) */ -#define TF_NOPUSH 0x1000 /* don't push */ -#define TF_REQ_CC 0x2000 /* have/will request CC */ -#define TF_RCVD_CC 0x4000 /* a CC was received in SYN */ -#define TF_SENDCCNEW 0x8000 /* send CCnew instead of CC in SYN */ - - struct tcpiphdr *t_template; /* skeletal packet for transmit */ - struct inpcb *t_inpcb; /* back pointer to internet pcb */ -/* - * The following fields are used as in the protocol specification. - * See RFC783, Dec. 1981, page 21. - */ -/* send sequence variables */ - tcp_seq snd_una; /* send unacknowledged */ - tcp_seq snd_nxt; /* send next */ - tcp_seq snd_up; /* send urgent pointer */ - tcp_seq snd_wl1; /* window update seg seq number */ - tcp_seq snd_wl2; /* window update seg ack number */ - tcp_seq iss; /* initial send sequence number */ - u_long snd_wnd; /* send window */ -/* receive sequence variables */ - u_long rcv_wnd; /* receive window */ - tcp_seq rcv_nxt; /* receive next */ - tcp_seq rcv_up; /* receive urgent pointer */ - tcp_seq irs; /* initial receive sequence number */ -/* - * Additional variables for this implementation. - */ -/* receive variables */ - tcp_seq rcv_adv; /* advertised window */ -/* retransmit variables */ - tcp_seq snd_max; /* highest sequence number sent; - * used to recognize retransmits - */ -/* congestion control (for slow start, source quench, retransmit after loss) */ - u_long snd_cwnd; /* congestion-controlled window */ - u_long snd_ssthresh; /* snd_cwnd size threshhold for - * for slow start exponential to - * linear switch - */ -/* - * transmit timing stuff. See below for scale of srtt and rttvar. - * "Variance" is actually smoothed difference. - */ - u_int t_idle; /* inactivity time */ - int t_rtt; /* round trip time */ - tcp_seq t_rtseq; /* sequence number being timed */ - int t_srtt; /* smoothed round-trip time */ - int t_rttvar; /* variance in round-trip time */ - u_int t_rttmin; /* minimum rtt allowed */ - u_long max_sndwnd; /* largest window peer has offered */ - -/* out-of-band data */ - char t_oobflags; /* have some */ - char t_iobc; /* input character */ -#define TCPOOB_HAVEDATA 0x01 -#define TCPOOB_HADDATA 0x02 - int t_softerror; /* possible error not yet reported */ - -/* RFC 1323 variables */ - u_char snd_scale; /* window scaling for send window */ - u_char rcv_scale; /* window scaling for recv window */ - u_char request_r_scale; /* pending window scaling */ - u_char requested_s_scale; - u_long ts_recent; /* timestamp echo data */ - u_long ts_recent_age; /* when last updated */ - tcp_seq last_ack_sent; -/* RFC 1644 variables */ - tcp_cc cc_send; /* send connection count */ - tcp_cc cc_recv; /* receive connection count */ - u_long t_duration; /* connection duration */ - -/* TUBA stuff */ - caddr_t t_tuba_pcb; /* next level down pcb for TCP over z */ -/* More RTT stuff */ - u_long t_rttupdated; /* number of times rtt sampled */ -}; - -/* - * Structure to hold TCP options that are only used during segment - * processing (in tcp_input), but not held in the tcpcb. - * It's basically used to reduce the number of parameters - * to tcp_dooptions. - */ -struct tcpopt { - u_long to_flag; /* which options are present */ -#define TOF_TS 0x0001 /* timestamp */ -#define TOF_CC 0x0002 /* CC and CCnew are exclusive */ -#define TOF_CCNEW 0x0004 -#define TOF_CCECHO 0x0008 - u_long to_tsval; - u_long to_tsecr; - tcp_cc to_cc; /* holds CC or CCnew */ - tcp_cc to_ccecho; -}; - -/* - * The TAO cache entry which is stored in the protocol family specific - * portion of the route metrics. - */ -struct rmxp_tao { - tcp_cc tao_cc; /* latest CC in valid SYN */ - tcp_cc tao_ccsent; /* latest CC sent to peer */ - u_short tao_mssopt; /* peer's cached MSS */ -#ifdef notyet - u_short tao_flags; /* cache status flags */ -#define TAOF_DONT 0x0001 /* peer doesn't understand rfc1644 */ -#define TAOF_OK 0x0002 /* peer does understand rfc1644 */ -#define TAOF_UNDEF 0 /* we don't know yet */ -#endif /* notyet */ -}; -#define rmx_taop(r) ((struct rmxp_tao *)(r).rmx_filler) - -#define intotcpcb(ip) ((struct tcpcb *)(ip)->inp_ppcb) -#define sototcpcb(so) (intotcpcb(sotoinpcb(so))) - -/* - * The smoothed round-trip time and estimated variance - * are stored as fixed point numbers scaled by the values below. - * For convenience, these scales are also used in smoothing the average - * (smoothed = (1/scale)sample + ((scale-1)/scale)smoothed). - * With these scales, srtt has 3 bits to the right of the binary point, - * and thus an "ALPHA" of 0.875. rttvar has 2 bits to the right of the - * binary point, and is smoothed with an ALPHA of 0.75. - */ -#define TCP_RTT_SCALE 8 /* multiplier for srtt; 3 bits frac. */ -#define TCP_RTT_SHIFT 3 /* shift for srtt; 3 bits frac. */ -#define TCP_RTTVAR_SCALE 4 /* multiplier for rttvar; 2 bits */ -#define TCP_RTTVAR_SHIFT 2 /* shift for rttvar; 2 bits */ - -/* - * The initial retransmission should happen at rtt + 4 * rttvar. - * Because of the way we do the smoothing, srtt and rttvar - * will each average +1/2 tick of bias. When we compute - * the retransmit timer, we want 1/2 tick of rounding and - * 1 extra tick because of +-1/2 tick uncertainty in the - * firing of the timer. The bias will give us exactly the - * 1.5 tick we need. But, because the bias is - * statistical, we have to test that we don't drop below - * the minimum feasible timer (which is 2 ticks). - * This macro assumes that the value of TCP_RTTVAR_SCALE - * is the same as the multiplier for rttvar. - */ -#define TCP_REXMTVAL(tp) \ - (((tp)->t_srtt >> TCP_RTT_SHIFT) + (tp)->t_rttvar) - -/* XXX - * We want to avoid doing m_pullup on incoming packets but that - * means avoiding dtom on the tcp reassembly code. That in turn means - * keeping an mbuf pointer in the reassembly queue (since we might - * have a cluster). As a quick hack, the source & destination - * port numbers (which are no longer needed once we've located the - * tcpcb) are overlayed with an mbuf pointer. - */ -#define REASS_MBUF(ti) (*(struct mbuf **)&((ti)->ti_t)) - -/* - * TCP statistics. - * Many of these should be kept per connection, - * but that's inconvenient at the moment. - */ -struct tcpstat { - u_long tcps_connattempt; /* connections initiated */ - u_long tcps_accepts; /* connections accepted */ - u_long tcps_connects; /* connections established */ - u_long tcps_drops; /* connections dropped */ - u_long tcps_conndrops; /* embryonic connections dropped */ - u_long tcps_closed; /* conn. closed (includes drops) */ - u_long tcps_segstimed; /* segs where we tried to get rtt */ - u_long tcps_rttupdated; /* times we succeeded */ - u_long tcps_delack; /* delayed acks sent */ - u_long tcps_timeoutdrop; /* conn. dropped in rxmt timeout */ - u_long tcps_rexmttimeo; /* retransmit timeouts */ - u_long tcps_persisttimeo; /* persist timeouts */ - u_long tcps_keeptimeo; /* keepalive timeouts */ - u_long tcps_keepprobe; /* keepalive probes sent */ - u_long tcps_keepdrops; /* connections dropped in keepalive */ - - u_long tcps_sndtotal; /* total packets sent */ - u_long tcps_sndpack; /* data packets sent */ - u_long tcps_sndbyte; /* data bytes sent */ - u_long tcps_sndrexmitpack; /* data packets retransmitted */ - u_long tcps_sndrexmitbyte; /* data bytes retransmitted */ - u_long tcps_sndacks; /* ack-only packets sent */ - u_long tcps_sndprobe; /* window probes sent */ - u_long tcps_sndurg; /* packets sent with URG only */ - u_long tcps_sndwinup; /* window update-only packets sent */ - u_long tcps_sndctrl; /* control (SYN|FIN|RST) packets sent */ - - u_long tcps_rcvtotal; /* total packets received */ - u_long tcps_rcvpack; /* packets received in sequence */ - u_long tcps_rcvbyte; /* bytes received in sequence */ - u_long tcps_rcvbadsum; /* packets received with ccksum errs */ - u_long tcps_rcvbadoff; /* packets received with bad offset */ - u_long tcps_rcvshort; /* packets received too short */ - u_long tcps_rcvduppack; /* duplicate-only packets received */ - u_long tcps_rcvdupbyte; /* duplicate-only bytes received */ - u_long tcps_rcvpartduppack; /* packets with some duplicate data */ - u_long tcps_rcvpartdupbyte; /* dup. bytes in part-dup. packets */ - u_long tcps_rcvoopack; /* out-of-order packets received */ - u_long tcps_rcvoobyte; /* out-of-order bytes received */ - u_long tcps_rcvpackafterwin; /* packets with data after window */ - u_long tcps_rcvbyteafterwin; /* bytes rcvd after window */ - u_long tcps_rcvafterclose; /* packets rcvd after "close" */ - u_long tcps_rcvwinprobe; /* rcvd window probe packets */ - u_long tcps_rcvdupack; /* rcvd duplicate acks */ - u_long tcps_rcvacktoomuch; /* rcvd acks for unsent data */ - u_long tcps_rcvackpack; /* rcvd ack packets */ - u_long tcps_rcvackbyte; /* bytes acked by rcvd acks */ - u_long tcps_rcvwinupd; /* rcvd window update packets */ - u_long tcps_pawsdrop; /* segments dropped due to PAWS */ - u_long tcps_predack; /* times hdr predict ok for acks */ - u_long tcps_preddat; /* times hdr predict ok for data pkts */ - u_long tcps_pcbcachemiss; - u_long tcps_cachedrtt; /* times cached RTT in route updated */ - u_long tcps_cachedrttvar; /* times cached rttvar updated */ - u_long tcps_cachedssthresh; /* times cached ssthresh updated */ - u_long tcps_usedrtt; /* times RTT initialized from route */ - u_long tcps_usedrttvar; /* times RTTVAR initialized from rt */ - u_long tcps_usedssthresh; /* times ssthresh initialized from rt*/ - u_long tcps_persistdrop; /* timeout in persist state */ - u_long tcps_badsyn; /* bogus SYN, e.g. premature ACK */ - u_long tcps_mturesent; /* resends due to MTU discovery */ - u_long tcps_listendrop; /* listen queue overflows */ -}; - -/* - * Names for TCP sysctl objects - */ -#define TCPCTL_DO_RFC1323 1 /* use RFC-1323 extensions */ -#define TCPCTL_DO_RFC1644 2 /* use RFC-1644 extensions */ -#define TCPCTL_MSSDFLT 3 /* MSS default */ -#define TCPCTL_STATS 4 /* statistics (read-only) */ -#define TCPCTL_RTTDFLT 5 /* default RTT estimate */ -#define TCPCTL_KEEPIDLE 6 /* keepalive idle timer */ -#define TCPCTL_KEEPINTVL 7 /* interval to send keepalives */ -#define TCPCTL_SENDSPACE 8 /* send buffer space */ -#define TCPCTL_RECVSPACE 9 /* receive buffer space */ -#define TCPCTL_KEEPINIT 10 /* interval to wait for established */ -#define TCPCTL_MAXID 11 - -#define TCPCTL_NAMES { \ - { 0, 0 }, \ - { "rfc1323", CTLTYPE_INT }, \ - { "rfc1644", CTLTYPE_INT }, \ - { "mssdflt", CTLTYPE_INT }, \ - { "stats", CTLTYPE_STRUCT }, \ - { "rttdflt", CTLTYPE_INT }, \ - { "keepidle", CTLTYPE_INT }, \ - { "keepintvl", CTLTYPE_INT }, \ - { "sendspace", CTLTYPE_INT }, \ - { "recvspace", CTLTYPE_INT }, \ - { "keepinit", CTLTYPE_INT }, \ -} - -#ifdef KERNEL -extern struct inpcbhead tcb; /* head of queue of active tcpcb's */ -extern struct inpcbinfo tcbinfo; -extern struct tcpstat tcpstat; /* tcp statistics */ -extern int tcp_do_rfc1323; /* XXX */ -extern int tcp_do_rfc1644; /* XXX */ -extern int tcp_mssdflt; /* XXX */ -extern u_long tcp_now; /* for RFC 1323 timestamps */ -extern int tcp_rttdflt; /* XXX */ -extern u_short tcp_lastport; /* last assigned port */ - -int tcp_attach __P((struct socket *)); -void tcp_canceltimers __P((struct tcpcb *)); -struct tcpcb * - tcp_close __P((struct tcpcb *)); -int tcp_connect __P((struct tcpcb *, struct mbuf *)); -void tcp_ctlinput __P((int, struct sockaddr *, struct ip *)); -int tcp_ctloutput __P((int, struct socket *, int, int, struct mbuf **)); -struct tcpcb * - tcp_disconnect __P((struct tcpcb *)); -struct tcpcb * - tcp_drop __P((struct tcpcb *, int)); -void tcp_dooptions __P((struct tcpcb *, - u_char *, int, struct tcpiphdr *, struct tcpopt *)); -void tcp_drain __P((void)); -void tcp_fasttimo __P((void)); -struct rmxp_tao * - tcp_gettaocache __P((struct inpcb *)); -void tcp_init __P((void)); -void tcp_input __P((struct mbuf *, int)); -void tcp_mss __P((struct tcpcb *, int)); -int tcp_mssopt __P((struct tcpcb *)); -void tcp_mtudisc __P((struct inpcb *, int)); -struct tcpcb * - tcp_newtcpcb __P((struct inpcb *)); -void tcp_notify __P((struct inpcb *, int)); -int tcp_output __P((struct tcpcb *)); -void tcp_pulloutofband __P((struct socket *, - struct tcpiphdr *, struct mbuf *)); -void tcp_quench __P((struct inpcb *, int)); -int tcp_reass __P((struct tcpcb *, struct tcpiphdr *, struct mbuf *)); -void tcp_respond __P((struct tcpcb *, - struct tcpiphdr *, struct mbuf *, u_long, u_long, int)); -struct rtentry * - tcp_rtlookup __P((struct inpcb *)); -void tcp_setpersist __P((struct tcpcb *)); -void tcp_slowtimo __P((void)); -int tcp_sysctl __P((int *, u_int, void *, size_t *, void *, size_t)); -struct tcpiphdr * - tcp_template __P((struct tcpcb *)); -struct tcpcb * - tcp_timers __P((struct tcpcb *, int)); -void tcp_trace __P((int, int, struct tcpcb *, struct tcpiphdr *, int)); -struct tcpcb * - tcp_usrclosed __P((struct tcpcb *)); -int tcp_usrreq __P((struct socket *, - int, struct mbuf *, struct mbuf *, struct mbuf *)); -void tcp_xmit_timer __P((struct tcpcb *, int)); - -extern u_long tcp_sendspace; -extern u_long tcp_recvspace; - -#endif /* KERNEL */ - -#endif /* _NETINET_TCP_VAR_H_ */ diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/tcpip.h b/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/tcpip.h deleted file mode 100644 index 45c115cf708..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/tcpip.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)tcpip.h 8.1 (Berkeley) 6/10/93 - */ - -#ifndef _NETINET_TCPIP_H_ -#define _NETINET_TCPIP_H_ - -/* - * Tcp+ip header, after ip options removed. - */ -struct tcpiphdr { - struct ipovly ti_i; /* overlaid ip structure */ - struct tcphdr ti_t; /* tcp header */ -}; -#ifdef notyet -/* - * Tcp+ip header, after ip options removed but including TCP options. - */ -struct full_tcpiphdr { - struct ipovly ti_i; /* overlaid ip structure */ - struct tcphdr ti_t; /* tcp header */ - char ti_o[TCP_MAXOLEN]; /* space for tcp options */ -}; -#endif /* notyet */ -#define ti_next ti_i.ih_next -#define ti_prev ti_i.ih_prev -#define ti_x1 ti_i.ih_x1 -#define ti_pr ti_i.ih_pr -#define ti_len ti_i.ih_len -#define ti_src ti_i.ih_src -#define ti_dst ti_i.ih_dst -#define ti_sport ti_t.th_sport -#define ti_dport ti_t.th_dport -#define ti_seq ti_t.th_seq -#define ti_ack ti_t.th_ack -#define ti_x2 ti_t.th_x2 -#define ti_off ti_t.th_off -#define ti_flags ti_t.th_flags -#define ti_win ti_t.th_win -#define ti_sum ti_t.th_sum -#define ti_urp ti_t.th_urp - -#endif diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/udp.h b/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/udp.h deleted file mode 100644 index b05e19b401d..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/udp.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)udp.h 8.1 (Berkeley) 6/10/93 - */ - -#ifndef _NETINET_UDP_H_ -#define _NETINET_UDP_H_ - -/* - * Udp protocol header. - * Per RFC 768, September, 1981. - */ -struct udphdr { - u_short uh_sport; /* source port */ - u_short uh_dport; /* destination port */ - short uh_ulen; /* udp length */ - u_short uh_sum; /* udp checksum */ -}; - -#endif diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/udp_var.h b/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/udp_var.h deleted file mode 100644 index fc808e51047..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/netinet/udp_var.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1989, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)udp_var.h 8.1 (Berkeley) 6/10/93 - */ - -#ifndef _NETINET_UDP_VAR_H_ -#define _NETINET_UDP_VAR_H_ - -/* - * UDP kernel structures and variables. - */ -struct udpiphdr { - struct ipovly ui_i; /* overlaid ip structure */ - struct udphdr ui_u; /* udp header */ -}; -#define ui_next ui_i.ih_next -#define ui_prev ui_i.ih_prev -#define ui_x1 ui_i.ih_x1 -#define ui_pr ui_i.ih_pr -#define ui_len ui_i.ih_len -#define ui_src ui_i.ih_src -#define ui_dst ui_i.ih_dst -#define ui_sport ui_u.uh_sport -#define ui_dport ui_u.uh_dport -#define ui_ulen ui_u.uh_ulen -#define ui_sum ui_u.uh_sum - -struct udpstat { - /* input statistics: */ - u_long udps_ipackets; /* total input packets */ - u_long udps_hdrops; /* packet shorter than header */ - u_long udps_badsum; /* checksum error */ - u_long udps_badlen; /* data length larger than packet */ - u_long udps_noport; /* no socket on port */ - u_long udps_noportbcast; /* of above, arrived as broadcast */ - u_long udps_fullsock; /* not delivered, input socket full */ - u_long udpps_pcbcachemiss; /* input packets missing pcb cache */ - u_long udpps_pcbhashmiss; /* input packets not for hashed pcb */ - /* output statistics: */ - u_long udps_opackets; /* total output packets */ -}; - -/* - * Names for UDP sysctl objects - */ -#define UDPCTL_CHECKSUM 1 /* checksum UDP packets */ -#define UDPCTL_STATS 2 /* statistics (read-only) */ -#define UDPCTL_MAXDGRAM 3 /* max datagram size */ -#define UDPCTL_RECVSPACE 4 /* default receive buffer space */ -#define UDPCTL_MAXID 5 - -#define UDPCTL_NAMES { \ - { 0, 0 }, \ - { "checksum", CTLTYPE_INT }, \ - { "stats", CTLTYPE_STRUCT }, \ - { "maxdgram", CTLTYPE_INT }, \ - { "recvspace", CTLTYPE_INT }, \ -} - -#ifdef KERNEL -extern struct inpcbhead udb; -extern struct inpcbinfo udbinfo; -extern struct udpstat udpstat; - -void udp_ctlinput __P((int, struct sockaddr *, struct ip *)); -void udp_init __P((void)); -void udp_input __P((struct mbuf *, int)); -int udp_output __P((struct inpcb *, - struct mbuf *, struct mbuf *, struct mbuf *)); -int udp_sysctl __P((int *, u_int, void *, size_t *, void *, size_t)); -int udp_usrreq __P((struct socket *, - int, struct mbuf *, struct mbuf *, struct mbuf *)); -#endif - -#endif diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/buf.h b/lib/drivers/oskittcp/include/freebsd/src/sys/sys/buf.h deleted file mode 100644 index 3523331430d..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/buf.h +++ /dev/null @@ -1,254 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1989, 1993 - * The Regents of the University of California. All rights reserved. - * (c) UNIX System Laboratories, Inc. - * All or some portions of this file are derived from material licensed - * to the University of California by American Telephone and Telegraph - * Co. or Unix System Laboratories, Inc. and are reproduced herein with - * the permission of UNIX System Laboratories, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)buf.h 8.7 (Berkeley) 1/21/94 - */ - -#ifndef _SYS_BUF_H_ -#define _SYS_BUF_H_ -#include - -#define NOLIST ((struct buf *)0x87654321) - -struct buf; - -struct iodone_chain { - long ic_prev_flags; - void (*ic_prev_iodone) __P((struct buf *)); - void *ic_prev_iodone_chain; - struct { - long ia_long; - void *ia_ptr; - } ic_args[5]; -}; - -/* - * The buffer header describes an I/O operation in the kernel. - */ -struct buf { - LIST_ENTRY(buf) b_hash; /* Hash chain. */ - LIST_ENTRY(buf) b_vnbufs; /* Buffer's associated vnode. */ - TAILQ_ENTRY(buf) b_freelist; /* Free list position if not active. */ - struct buf *b_actf, **b_actb; /* Device driver queue when active. */ - struct proc *b_proc; /* Associated proc; NULL if kernel. */ - volatile long b_flags; /* B_* flags. */ - int b_qindex; /* buffer queue index */ - int b_error; /* Errno value. */ - long b_bufsize; /* Allocated buffer size. */ - long b_bcount; /* Valid bytes in buffer. */ - long b_resid; /* Remaining I/O. */ - dev_t b_dev; /* Device associated with buffer. */ - struct { - caddr_t b_addr; /* Memory, superblocks, indirect etc. */ - } b_un; - void *b_saveaddr; /* Original b_addr for physio. */ - daddr_t b_lblkno; /* Logical block number. */ - daddr_t b_blkno; /* Underlying physical block number. */ - /* Function to call upon completion. */ - void (*b_iodone) __P((struct buf *)); - /* For nested b_iodone's. */ - struct iodone_chain *b_iodone_chain; - struct vnode *b_vp; /* Device vnode. */ - int b_pfcent; /* Center page when swapping cluster. */ - int b_dirtyoff; /* Offset in buffer of dirty region. */ - int b_dirtyend; /* Offset of end of dirty region. */ - struct ucred *b_rcred; /* Read credentials reference. */ - struct ucred *b_wcred; /* Write credentials reference. */ - int b_validoff; /* Offset in buffer of valid region. */ - int b_validend; /* Offset of end of valid region. */ - daddr_t b_pblkno; /* physical block number */ - caddr_t b_savekva; /* saved kva for transfer while bouncing */ - void *b_driver1; /* for private use by the driver */ - void *b_driver2; /* for private use by the driver */ - void *b_spc; - struct vm_page *b_pages[(MAXPHYS + PAGE_SIZE - 1)/PAGE_SIZE]; - int b_npages; -}; - -/* Device driver compatibility definitions. */ -#define b_active b_bcount /* Driver queue head: drive active. */ -#define b_data b_un.b_addr /* b_un.b_addr is not changeable. */ -#define b_errcnt b_resid /* Retry count while I/O in progress. */ -#define iodone biodone /* Old name for biodone. */ -#define iowait biowait /* Old name for biowait. */ - -/* - * These flags are kept in b_flags. - */ -#define B_AGE 0x00000001 /* Move to age queue when I/O done. */ -#define B_APPENDWRITE 0x00000002 /* Append-write in progress. */ -#define B_ASYNC 0x00000004 /* Start I/O, do not wait. */ -#define B_BAD 0x00000008 /* Bad block revectoring in progress. */ -#define B_BUSY 0x00000010 /* I/O in progress. */ -#define B_CACHE 0x00000020 /* Bread found us in the cache. */ -#define B_CALL 0x00000040 /* Call b_iodone from biodone. */ -#define B_DELWRI 0x00000080 /* Delay I/O until buffer reused. */ -#define B_DIRTY 0x00000100 /* Dirty page to be pushed out async. */ -#define B_DONE 0x00000200 /* I/O completed. */ -#define B_EINTR 0x00000400 /* I/O was interrupted */ -#define B_ERROR 0x00000800 /* I/O error occurred. */ -#define B_GATHERED 0x00001000 /* LFS: already in a segment. */ -#define B_INVAL 0x00002000 /* Does not contain valid info. */ -#define B_LOCKED 0x00004000 /* Locked in core (not reusable). */ -#define B_NOCACHE 0x00008000 /* Do not cache block after use. */ -#define B_MALLOC 0x00010000 /* malloced b_data */ -#define B_CLUSTEROK 0x00020000 /* Pagein op, so swap() can count it. */ -#define B_PHYS 0x00040000 /* I/O to user memory. */ -#define B_RAW 0x00080000 /* Set by physio for raw transfers. */ -#define B_READ 0x00100000 /* Read buffer. */ -#define B_TAPE 0x00200000 /* Magnetic tape I/O. */ -#define B_RELBUF 0x00400000 /* Release VMIO buffer. */ -#define B_WANTED 0x00800000 /* Process wants this buffer. */ -#define B_WRITE 0x00000000 /* Write buffer (pseudo flag). */ -#define B_WRITEINPROG 0x01000000 /* Write in progress. */ -#define B_XXX 0x02000000 /* Debugging flag. */ -#define B_PAGING 0x04000000 /* volatile paging I/O -- bypass VMIO */ -#define B_VMIO 0x20000000 /* VMIO flag */ -#define B_CLUSTER 0x40000000 /* pagein op, so swap() can count it */ -#define B_BOUNCE 0x80000000 /* bounce buffer flag */ - -/* - * This structure describes a clustered I/O. It is stored in the b_saveaddr - * field of the buffer on which I/O is done. At I/O completion, cluster - * callback uses the structure to parcel I/O's to individual buffers, and - * then free's this structure. - */ -struct cluster_save { - long bs_bcount; /* Saved b_bcount. */ - long bs_bufsize; /* Saved b_bufsize. */ - void *bs_saveaddr; /* Saved b_addr. */ - int bs_nchildren; /* Number of associated buffers. */ - struct buf **bs_children; /* List of associated buffers. */ -}; - -/* - * number of buffer hash entries - */ -#define BUFHSZ 512 - -/* - * buffer hash table calculation, originally by David Greenman - */ -#define BUFHASH(vnp, bn) \ - (&bufhashtbl[(((unsigned long)(vnp) >> 7)+(int)(bn)) % BUFHSZ]) - -/* - * Definitions for the buffer free lists. - */ -#define BUFFER_QUEUES 6 /* number of free buffer queues */ - -LIST_HEAD(bufhashhdr, buf) bufhashtbl[BUFHSZ], invalhash; -TAILQ_HEAD(bqueues, buf) bufqueues[BUFFER_QUEUES]; - -#define QUEUE_NONE 0 /* on no queue */ -#define QUEUE_LOCKED 1 /* locked buffers */ -#define QUEUE_LRU 2 /* useful buffers */ -#define QUEUE_VMIO 3 /* VMIO buffers */ -#define QUEUE_AGE 4 /* not-useful buffers */ -#define QUEUE_EMPTY 5 /* empty buffer headers*/ - -/* - * Zero out the buffer's data area. - */ -#define clrbuf(bp) { \ - blkclr((bp)->b_data, (u_int)(bp)->b_bcount); \ - (bp)->b_resid = 0; \ -} - -/* Flags to low-level allocation routines. */ -#define B_CLRBUF 0x01 /* Request allocated buffer be cleared. */ -#define B_SYNC 0x02 /* Do all allocations synchronously. */ - -#ifdef KERNEL -extern int nbuf; /* The number of buffer headers */ -extern struct buf *buf; /* The buffer headers. */ -extern char *buffers; /* The buffer contents. */ -extern int bufpages; /* Number of memory pages in the buffer pool. */ -extern struct buf *swbuf; /* Swap I/O buffer headers. */ -extern int nswbuf; /* Number of swap I/O buffer headers. */ -extern TAILQ_HEAD(swqueue, buf) bswlist; - -__BEGIN_DECLS -void bufinit __P((void)); -void bremfree __P((struct buf *)); -int bread __P((struct vnode *, daddr_t, int, - struct ucred *, struct buf **)); -int breadn __P((struct vnode *, daddr_t, int, daddr_t *, int *, int, - struct ucred *, struct buf **)); -int bwrite __P((struct buf *)); -void bdwrite __P((struct buf *)); -void bawrite __P((struct buf *)); -void brelse __P((struct buf *)); -void vfs_bio_awrite __P((struct buf *)); -struct buf * getpbuf __P((void)); -struct buf *incore __P((struct vnode *, daddr_t)); -int inmem __P((struct vnode *, daddr_t)); -struct buf *getblk __P((struct vnode *, daddr_t, int, int, int)); -struct buf *geteblk __P((int)); -int allocbuf __P((struct buf *, int)); -int biowait __P((struct buf *)); -void biodone __P((struct buf *)); - -void cluster_callback __P((struct buf *)); -int cluster_read __P((struct vnode *, u_quad_t, daddr_t, long, - struct ucred *, struct buf **)); -void cluster_wbuild __P((struct vnode *, struct buf *, long, daddr_t, int, - daddr_t)); -void cluster_write __P((struct buf *, u_quad_t)); -int physio __P((void (*)(), struct buf *, dev_t, int, u_int (*)(), - struct uio *)); -u_int minphys __P((struct buf *)); -void vfs_bio_clrbuf __P((struct buf *)); -void vfs_busy_pages __P((struct buf *, int clear_modify)); -void vfs_unbusy_pages(struct buf *); -void vwakeup __P((struct buf *)); -void vmapbuf __P((struct buf *)); -void vunmapbuf __P((struct buf *)); -void relpbuf __P((struct buf *)); -void brelvp __P((struct buf *)); -void bgetvp __P((struct vnode *, struct buf *)); -void pbgetvp __P((struct vnode *, struct buf *)); -void pbrelvp __P((struct buf *)); -void reassignbuf __P((struct buf *, struct vnode *)); -struct buf *trypbuf __P((void)); -void vm_bounce_alloc __P((struct buf *)); -void vm_bounce_free __P((struct buf *)); -vm_offset_t vm_bounce_kva_alloc __P((int)); -void vm_bounce_kva_alloc_free __P((vm_offset_t, int)); -__END_DECLS -#endif -#endif /* !_SYS_BUF_H_ */ diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/callout.h b/lib/drivers/oskittcp/include/freebsd/src/sys/sys/callout.h deleted file mode 100644 index 76d7519b5fa..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/callout.h +++ /dev/null @@ -1,56 +0,0 @@ -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * (c) UNIX System Laboratories, Inc. - * All or some portions of this file are derived from material licensed - * to the University of California by American Telephone and Telegraph - * Co. or Unix System Laboratories, Inc. and are reproduced herein with - * the permission of UNIX System Laboratories, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)callout.h 8.2 (Berkeley) 1/21/94 - */ - -#ifndef _SYS_CALLOUT_H_ -#define _SYS_CALLOUT_H_ - -struct callout { - struct callout *c_next; /* next callout in queue */ - void *c_arg; /* function argument */ - void (*c_func) __P((void *)); /* function to call */ - int c_time; /* ticks to the event */ -}; - -#ifdef KERNEL -extern struct callout *callfree, *callout, calltodo; -extern int ncallout; -#endif - -#endif diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/cdefs.h b/lib/drivers/oskittcp/include/freebsd/src/sys/sys/cdefs.h deleted file mode 100644 index 3072090c296..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/cdefs.h +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Berkeley Software Design, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)cdefs.h 8.7 (Berkeley) 1/21/94 - */ - -#ifndef _SYS_CDEFS_H_ -#define _SYS_CDEFS_H_ - -#if defined(__cplusplus) -#define __BEGIN_DECLS extern "C" { -#define __END_DECLS }; -#else -#define __BEGIN_DECLS -#define __END_DECLS -#endif - -/* - * The __CONCAT macro is used to concatenate parts of symbol names, e.g. - * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo. - * The __CONCAT macro is a bit tricky -- make sure you don't put spaces - * in between its arguments. __CONCAT can also concatenate double-quoted - * strings produced by the __STRING macro, but this only works with ANSI C. - */ -#if defined(__STDC__) || defined(__cplusplus) -#define __P(protos) protos /* full-blown ANSI C */ -#define __CONCAT1(x,y) x ## y -#define __CONCAT(x,y) __CONCAT1(x,y) -#define __STRING(x) #x - -#define __const const /* define reserved names to standard */ -#define __signed signed -#define __volatile volatile -#if defined(__cplusplus) -#define __inline inline /* convert to C++ keyword */ -#else -#ifndef __GNUC__ -#define __inline /* delete GCC keyword */ -#endif /* !__GNUC__ */ -#endif /* !__cplusplus */ - -#else /* !(__STDC__ || __cplusplus) */ -#define __P(protos) () /* traditional C preprocessor */ -#define __CONCAT(x,y) x/**/y -#define __STRING(x) "x" - -#ifndef __GNUC__ -#define __const /* delete pseudo-ANSI C keywords */ -#define __inline -#define __signed -#define __volatile -/* - * In non-ANSI C environments, new programs will want ANSI-only C keywords - * deleted from the program and old programs will want them left alone. - * When using a compiler other than gcc, programs using the ANSI C keywords - * const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS. - * When using "gcc -traditional", we assume that this is the intent; if - * __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone. - */ -#ifndef NO_ANSI_KEYWORDS -#define const /* delete ANSI C keywords */ -#define inline -#define signed -#define volatile -#endif -#endif /* !NO_ANSI_KEYWORDS */ -#endif /* !(__STDC__ || __cplusplus) */ - -#ifdef _MSC_VER -# undef __CONCAT -# define __CONCAT(x,y) x ## y -#endif/*_MSC_VER*/ -/* - * GCC1 and some versions of GCC2 declare dead (non-returning) and - * pure (no side effects) functions using "volatile" and "const"; - * unfortunately, these then cause warnings under "-ansi -pedantic". - * GCC2.5 uses a new, peculiar __attribute__((attrs)) style. All of - * these work for GNU C++ (modulo a slight glitch in the C++ grammar - * in the distribution version of 2.5.5). - */ -#if __GNUC__ < 2 -#define __dead -#define __dead2 -#define __pure -#define __pure2 -#define __attribute__(x) -#endif -#if __GNUC__ == 2 && __GNUC_MINOR__ < 5 -#define __dead __volatile -#define __dead2 -#define __pure __const -#define __pure2 -#endif -#if __GNUC__ == 2 && __GNUC_MINOR__ > 5 || __GNUC__ >= 3 -#define __dead -#define __dead2 __attribute__((noreturn)) -#define __pure -#define __pure2 __attribute__((const)) -#endif - -#ifdef __GNUC__ -#ifdef __STDC__ -#define __weak_reference(sym,alias) \ - __asm__(".stabs \"_" #alias "\",11,0,0,0"); \ - __asm__(".stabs \"_" #sym "\",1,0,0,0") -#define __warn_references(sym,msg) \ - __asm__(".stabs \"" msg "\",30,0,0,0"); \ - __asm__(".stabs \"_" #sym "\",1,0,0,0") -#else -#define __weak_reference(sym,alias) \ - __asm__(".stabs \"_/**/alias\",11,0,0,0"); \ - __asm__(".stabs \"_/**/sym\",1,0,0,0") -#define __warn_references(sym,msg) \ - __asm__(".stabs msg,30,0,0,0"); \ - __asm__(".stabs \"_/**/sym\",1,0,0,0") -#endif -#endif - -#endif /* !_SYS_CDEFS_H_ */ diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/domain.h b/lib/drivers/oskittcp/include/freebsd/src/sys/sys/domain.h deleted file mode 100644 index 5c8e4418ce1..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/domain.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)domain.h 8.1 (Berkeley) 6/2/93 - */ - -#ifndef _SYS_DOMAIN_H_ -#define _SYS_DOMAIN_H_ - -/* - * Structure per communications domain. - */ - -/* - * Forward structure declarations for function prototypes [sic]. - */ -struct mbuf; - -struct domain { - int dom_family; /* AF_xxx */ - char *dom_name; - void (*dom_init) /* initialize domain data structures */ - __P((void)); - int (*dom_externalize) /* externalize access rights */ - __P((struct mbuf *)); - int (*dom_dispose) /* dispose of internalized rights */ - __P((struct mbuf *)); - struct protosw *dom_protosw, *dom_protoswNPROTOSW; - struct domain *dom_next; - int (*dom_rtattach) /* initialize routing table */ - __P((void **, int)); - int dom_rtoffset; /* an arg to rtattach, in bits */ - int dom_maxrtkey; /* for routing layer */ -}; - -#ifdef KERNEL -extern struct domain *domains; - -#define DOMAIN_SET(name) \ - DATA_SET(domain_set, name ## domain); - -#endif - -#endif diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/errno.h b/lib/drivers/oskittcp/include/freebsd/src/sys/sys/errno.h deleted file mode 100644 index de7ee230ab9..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/errno.h +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1989, 1993 - * The Regents of the University of California. All rights reserved. - * (c) UNIX System Laboratories, Inc. - * All or some portions of this file are derived from material licensed - * to the University of California by American Telephone and Telegraph - * Co. or Unix System Laboratories, Inc. and are reproduced herein with - * the permission of UNIX System Laboratories, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)errno.h 8.5 (Berkeley) 1/21/94 - */ - -#ifndef _SYS_ERRNO_H_ -#define _SYS_ERRNO_H_ - -#ifndef KERNEL -extern int errno; /* global error number */ -#endif - -#define EPERM 1 /* Operation not permitted */ -#define ENOENT 2 /* No such file or directory */ -#define ESRCH 3 /* No such process */ -#define EINTR 4 /* Interrupted system call */ -#define EIO 5 /* Input/output error */ -#define ENXIO 6 /* Device not configured */ -#define E2BIG 7 /* Argument list too long */ -#define ENOEXEC 8 /* Exec format error */ -#define EBADF 9 /* Bad file descriptor */ -#define ECHILD 10 /* No child processes */ -#ifndef EDEADLK -#define EDEADLK 11 /* Resource deadlock avoided */ - /* 11 was EAGAIN */ -#endif//EDEADLK -#define ENOMEM 12 /* Cannot allocate memory */ -#define EACCES 13 /* Permission denied */ -#define EFAULT 14 /* Bad address */ -#ifndef _POSIX_SOURCE -#define ENOTBLK 15 /* Block device required */ -#endif -#define EBUSY 16 /* Device busy */ -#define EEXIST 17 /* File exists */ -#define EXDEV 18 /* Cross-device link */ -#define ENODEV 19 /* Operation not supported by device */ -#define ENOTDIR 20 /* Not a directory */ -#define EISDIR 21 /* Is a directory */ -#define EINVAL 22 /* Invalid argument */ -#define ENFILE 23 /* Too many open files in system */ -#define EMFILE 24 /* Too many open files */ -#define ENOTTY 25 /* Inappropriate ioctl for device */ -#ifndef _POSIX_SOURCE -#define ETXTBSY 26 /* Text file busy */ -#endif -#define EFBIG 27 /* File too large */ -#define ENOSPC 28 /* No space left on device */ -#define ESPIPE 29 /* Illegal seek */ -#define EROFS 30 /* Read-only file system */ -#define EMLINK 31 /* Too many links */ -#define EPIPE 32 /* Broken pipe */ - -/* math software */ -#define EDOM 33 /* Numerical argument out of domain */ -#define ERANGE 34 /* Result too large */ - -/* non-blocking and interrupt i/o */ -#ifndef EAGAIN -#define EAGAIN 35 /* Resource temporarily unavailable */ -#endif//EAGAIN -#ifndef _POSIX_SOURCE -#define EWOULDBLOCK EAGAIN /* Operation would block */ -#define EINPROGRESS 36 /* Operation now in progress */ -#define EALREADY 37 /* Operation already in progress */ - -/* ipc/network software -- argument errors */ -#define ENOTSOCK 38 /* Socket operation on non-socket */ -#define EDESTADDRREQ 39 /* Destination address required */ -#define EMSGSIZE 40 /* Message too long */ -#define EPROTOTYPE 41 /* Protocol wrong type for socket */ -#define ENOPROTOOPT 42 /* Protocol not available */ -#define EPROTONOSUPPORT 43 /* Protocol not supported */ -#define ESOCKTNOSUPPORT 44 /* Socket type not supported */ -#define EOPNOTSUPP 45 /* Operation not supported */ -#define EPFNOSUPPORT 46 /* Protocol family not supported */ -#define EAFNOSUPPORT 47 /* Address family not supported by protocol family */ -#define EADDRINUSE 48 /* Address already in use */ -#define EADDRNOTAVAIL 49 /* Can't assign requested address */ - -/* ipc/network software -- operational errors */ -#define ENETDOWN 50 /* Network is down */ -#define ENETUNREACH 51 /* Network is unreachable */ -#define ENETRESET 52 /* Network dropped connection on reset */ -#define ECONNABORTED 53 /* Software caused connection abort */ -#define ECONNRESET 54 /* Connection reset by peer */ -#define ENOBUFS 55 /* No buffer space available */ -#define EISCONN 56 /* Socket is already connected */ -#define ENOTCONN 57 /* Socket is not connected */ -#define ESHUTDOWN 58 /* Can't send after socket shutdown */ -#define ETOOMANYREFS 59 /* Too many references: can't splice */ -#define ETIMEDOUT 60 /* Operation timed out */ -#define ECONNREFUSED 61 /* Connection refused */ - -#define ELOOP 62 /* Too many levels of symbolic links */ -#endif /* _POSIX_SOURCE */ -#ifndef ENAMETOOLONG -#define ENAMETOOLONG 63 /* File name too long */ -#endif//ENAMETOOLONG - -/* should be rearranged */ -#ifndef _POSIX_SOURCE -#define EHOSTDOWN 64 /* Host is down */ -#define EHOSTUNREACH 65 /* No route to host */ -#endif /* _POSIX_SOURCE */ -#ifndef ENOTEMPTY -#define ENOTEMPTY 66 /* Directory not empty */ -#endif//ENOTEMPTY - -/* quotas & mush */ -#ifndef _POSIX_SOURCE -#define EPROCLIM 67 /* Too many processes */ -#define EUSERS 68 /* Too many users */ -#define EDQUOT 69 /* Disc quota exceeded */ - -/* Network File System */ -#define ESTALE 70 /* Stale NFS file handle */ -#define EREMOTE 71 /* Too many levels of remote in path */ -#define EBADRPC 72 /* RPC struct is bad */ -#define ERPCMISMATCH 73 /* RPC version wrong */ -#define EPROGUNAVAIL 74 /* RPC prog. not avail */ -#define EPROGMISMATCH 75 /* Program version wrong */ -#define EPROCUNAVAIL 76 /* Bad procedure for program */ -#endif /* _POSIX_SOURCE */ - -#ifndef ENOLCK -#define ENOLCK 77 /* No locks available */ -#endif//ENOLCK -#ifndef ENOSYS -#define ENOSYS 78 /* Function not implemented */ -#endif//ENOSYS - -#ifndef _POSIX_SOURCE -#define EFTYPE 79 /* Inappropriate file type or format */ -#define EAUTH 80 /* Authentication error */ -#define ENEEDAUTH 81 /* Need authenticator */ -#define ELAST 81 /* Must be equal largest errno */ -#endif /* _POSIX_SOURCE */ - -#ifdef KERNEL -/* pseudo-errors returned inside kernel to modify return to process */ -#define ERESTART -1 /* restart syscall */ -#define EJUSTRETURN -2 /* don't modify regs, just return */ -#endif - -#endif diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/fcntl.h b/lib/drivers/oskittcp/include/freebsd/src/sys/sys/fcntl.h deleted file mode 100644 index 62762f3498a..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/fcntl.h +++ /dev/null @@ -1,190 +0,0 @@ -/*- - * Copyright (c) 1983, 1990, 1993 - * The Regents of the University of California. All rights reserved. - * (c) UNIX System Laboratories, Inc. - * All or some portions of this file are derived from material licensed - * to the University of California by American Telephone and Telegraph - * Co. or Unix System Laboratories, Inc. and are reproduced herein with - * the permission of UNIX System Laboratories, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)fcntl.h 8.3 (Berkeley) 1/21/94 - */ - -#ifndef _SYS_FCNTL_H_ -#define _SYS_FCNTL_H_ - -/* - * This file includes the definitions for open and fcntl - * described by POSIX for ; it also includes - * related kernel definitions. - */ - -#ifndef KERNEL -#include -#endif - -/* - * File status flags: these are used by open(2), fcntl(2). - * They are also used (indirectly) in the kernel file structure f_flags, - * which is a superset of the open/fcntl flags. Open flags and f_flags - * are inter-convertible using OFLAGS(fflags) and FFLAGS(oflags). - * Open/fcntl flags begin with O_; kernel-internal flags begin with F. - */ -/* open-only flags */ -#define O_RDONLY 0x0000 /* open for reading only */ -#define O_WRONLY 0x0001 /* open for writing only */ -#define O_RDWR 0x0002 /* open for reading and writing */ -#define O_ACCMODE 0x0003 /* mask for above modes */ - -/* - * Kernel encoding of open mode; separate read and write bits that are - * independently testable: 1 greater than the above. - * - * XXX - * FREAD and FWRITE are excluded from the #ifdef KERNEL so that TIOCFLUSH, - * which was documented to use FREAD/FWRITE, continues to work. - */ -#ifndef _POSIX_SOURCE -#define FREAD 0x0001 -#define FWRITE 0x0002 -#endif -#define O_NONBLOCK 0x0004 /* no delay */ -#define O_APPEND 0x0008 /* set append mode */ -#ifndef _POSIX_SOURCE -#define O_SHLOCK 0x0010 /* open with shared file lock */ -#define O_EXLOCK 0x0020 /* open with exclusive file lock */ -#define O_ASYNC 0x0040 /* signal pgrp when data ready */ -#define O_FSYNC 0x0080 /* synchronous writes */ -#endif -#define O_CREAT 0x0200 /* create if nonexistant */ -#define O_TRUNC 0x0400 /* truncate to zero length */ -#define O_EXCL 0x0800 /* error if already exists */ -#ifdef KERNEL -#define FMARK 0x1000 /* mark during gc() */ -#define FDEFER 0x2000 /* defer for next gc pass */ -#define FHASLOCK 0x4000 /* descriptor holds advisory lock */ -#endif - -/* defined by POSIX 1003.1; BSD default, so no bit required */ -#define O_NOCTTY 0 /* don't assign controlling terminal */ - -#ifdef KERNEL -/* convert from open() flags to/from fflags; convert O_RD/WR to FREAD/FWRITE */ -#define FFLAGS(oflags) ((oflags) + 1) -#define OFLAGS(fflags) ((fflags) - 1) - -/* bits to save after open */ -#define FMASK (FREAD|FWRITE|FAPPEND|FASYNC|FFSYNC|FNONBLOCK) -/* bits settable by fcntl(F_SETFL, ...) */ -#define FCNTLFLAGS (FAPPEND|FASYNC|FFSYNC|FNONBLOCK) -#endif - -/* - * The O_* flags used to have only F* names, which were used in the kernel - * and by fcntl. We retain the F* names for the kernel f_flags field - * and for backward compatibility for fcntl. - */ -#ifndef _POSIX_SOURCE -#define FAPPEND O_APPEND /* kernel/compat */ -#define FASYNC O_ASYNC /* kernel/compat */ -#define FFSYNC O_FSYNC /* kernel */ -#define FNONBLOCK O_NONBLOCK /* kernel */ -#define FNDELAY O_NONBLOCK /* compat */ -#define O_NDELAY O_NONBLOCK /* compat */ -#endif - -/* - * Constants used for fcntl(2) - */ - -/* command values */ -#define F_DUPFD 0 /* duplicate file descriptor */ -#define F_GETFD 1 /* get file descriptor flags */ -#define F_SETFD 2 /* set file descriptor flags */ -#define F_GETFL 3 /* get file status flags */ -#define F_SETFL 4 /* set file status flags */ -#ifndef _POSIX_SOURCE -#define F_GETOWN 5 /* get SIGIO/SIGURG proc/pgrp */ -#define F_SETOWN 6 /* set SIGIO/SIGURG proc/pgrp */ -#endif -#define F_GETLK 7 /* get record locking information */ -#define F_SETLK 8 /* set record locking information */ -#define F_SETLKW 9 /* F_SETLK; wait if blocked */ - -/* file descriptor flags (F_GETFD, F_SETFD) */ -#define FD_CLOEXEC 1 /* close-on-exec flag */ - -/* record locking flags (F_GETLK, F_SETLK, F_SETLKW) */ -#define F_RDLCK 1 /* shared or read lock */ -#define F_UNLCK 2 /* unlock */ -#define F_WRLCK 3 /* exclusive or write lock */ -#ifdef KERNEL -#define F_WAIT 0x010 /* Wait until lock is granted */ -#define F_FLOCK 0x020 /* Use flock(2) semantics for lock */ -#define F_POSIX 0x040 /* Use POSIX semantics for lock */ -#endif - -/* - * Advisory file segment locking data type - - * information passed to system by user - */ -struct flock { - off_t l_start; /* starting offset */ - off_t l_len; /* len = 0 means until end of file */ - pid_t l_pid; /* lock owner */ - short l_type; /* lock type: read/write, etc. */ - short l_whence; /* type of l_start */ -}; - - -#ifndef _POSIX_SOURCE -/* lock operations for flock(2) */ -#define LOCK_SH 0x01 /* shared file lock */ -#define LOCK_EX 0x02 /* exclusive file lock */ -#define LOCK_NB 0x04 /* don't block when locking */ -#define LOCK_UN 0x08 /* unlock file */ -#endif - - -#ifndef KERNEL -#include - -__BEGIN_DECLS -int open __P((const char *, int, ...)); -int creat __P((const char *, mode_t)); -int fcntl __P((int, int, ...)); -#ifndef _POSIX_SOURCE -int flock __P((int, int)); -#endif /* !_POSIX_SOURCE */ -__END_DECLS -#endif - -#endif /* !_SYS_FCNTL_H_ */ diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/file.h b/lib/drivers/oskittcp/include/freebsd/src/sys/sys/file.h deleted file mode 100644 index 6f122605b13..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/file.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1989, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)file.h 8.1 (Berkeley) 6/2/93 - */ - -#ifndef _SYS_FILE_H_ -#define _SYS_FILE_H_ - -#include -#include - -#ifdef KERNEL -struct proc; -struct uio; - -/* - * Kernel descriptor table. - * One entry for each open kernel vnode and socket. - */ -struct file { - struct file *f_filef; /* list of active files */ - struct file **f_fileb; /* list of active files */ - short f_flag; /* see fcntl.h */ -#define DTYPE_VNODE 1 /* file */ -#define DTYPE_SOCKET 2 /* communications endpoint */ - short f_type; /* descriptor type */ - short f_count; /* reference count */ - short f_msgcount; /* references from message queue */ - struct ucred *f_cred; /* credentials associated with descriptor */ - struct fileops { - int (*fo_read) __P((struct file *fp, struct uio *uio, - struct ucred *cred)); - int (*fo_write) __P((struct file *fp, struct uio *uio, - struct ucred *cred)); - int (*fo_ioctl) __P((struct file *fp, int com, - caddr_t data, struct proc *p)); - int (*fo_select) __P((struct file *fp, int which, - struct proc *p)); - int (*fo_close) __P((struct file *fp, struct proc *p)); - } *f_ops; - off_t f_offset; - caddr_t f_data; /* vnode or socket */ -}; - -extern struct file *filehead; /* head of list of open files */ -extern struct fileops vnops; -extern int maxfiles; /* kernel limit on number of open files */ -extern int maxfilesperproc; /* per process limit on number of open files */ -extern int nfiles; /* actual number of open files */ - -#endif /* KERNEL */ - -#endif diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/filedesc.h b/lib/drivers/oskittcp/include/freebsd/src/sys/sys/filedesc.h deleted file mode 100644 index 4b0dec7cff7..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/filedesc.h +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)filedesc.h 8.1 (Berkeley) 6/2/93 - */ - -#ifndef _SYS_FILEDESC_H_ -#define _SYS_FILEDESC_H_ - -/* - * This structure is used for the management of descriptors. It may be - * shared by multiple processes. - * - * A process is initially started out with NDFILE descriptors stored within - * this structure, selected to be enough for typical applications based on - * the historical limit of 20 open files (and the usage of descriptors by - * shells). If these descriptors are exhausted, a larger descriptor table - * may be allocated, up to a process' resource limit; the internal arrays - * are then unused. The initial expansion is set to NDEXTENT; each time - * it runs out, it is doubled until the resource limit is reached. NDEXTENT - * should be selected to be the biggest multiple of OFILESIZE (see below) - * that will fit in a power-of-two sized piece of memory. - */ -#define NDFILE 20 -#define NDEXTENT 50 /* 250 bytes in 256-byte alloc. */ - -struct filedesc { - struct file **fd_ofiles; /* file structures for open files */ - char *fd_ofileflags; /* per-process open file flags */ - struct vnode *fd_cdir; /* current directory */ - struct vnode *fd_rdir; /* root directory */ - int fd_nfiles; /* number of open files allocated */ - u_short fd_lastfile; /* high-water mark of fd_ofiles */ - u_short fd_freefile; /* approx. next free file */ - u_short fd_cmask; /* mask for file creation */ - u_short fd_refcnt; /* reference count */ -}; - -/* - * Basic allocation of descriptors: - * one of the above, plus arrays for NDFILE descriptors. - */ -struct filedesc0 { - struct filedesc fd_fd; - /* - * These arrays are used when the number of open files is - * <= NDFILE, and are then pointed to by the pointers above. - */ - struct file *fd_dfiles[NDFILE]; - char fd_dfileflags[NDFILE]; -}; - -/* - * Per-process open flags. - */ -#define UF_EXCLOSE 0x01 /* auto-close on exec */ -#define UF_MAPPED 0x02 /* mapped from device */ - -/* - * Storage required per open file descriptor. - */ -#define OFILESIZE (sizeof(struct file *) + sizeof(char)) - -#ifdef KERNEL -/* - * Kernel global variables and routines. - */ -int dupfdopen __P((struct filedesc *, int, int, int, int)); -int fdalloc __P((struct proc *p, int want, int *result)); -int fdavail __P((struct proc *p, int n)); -int falloc __P((struct proc *p, struct file **resultfp, int *resultfd)); -void ffree __P((struct file *)); -struct filedesc *fdcopy __P((struct proc *p)); -void fdfree __P((struct proc *p)); -int closef __P((struct file *fp,struct proc *p)); -void fdcloseexec __P((struct proc *p)); -#endif - -#endif diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/filio.h b/lib/drivers/oskittcp/include/freebsd/src/sys/sys/filio.h deleted file mode 100644 index c1566c26495..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/filio.h +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * Copyright (c) 1982, 1986, 1990, 1993, 1994 - * The Regents of the University of California. All rights reserved. - * (c) UNIX System Laboratories, Inc. - * All or some portions of this file are derived from material licensed - * to the University of California by American Telephone and Telegraph - * Co. or Unix System Laboratories, Inc. and are reproduced herein with - * the permission of UNIX System Laboratories, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)filio.h 8.1 (Berkeley) 3/28/94 - */ - -#ifndef _SYS_FILIO_H_ -#define _SYS_FILIO_H_ - -#ifndef __REACTOS__ -#include - -/* Generic file-descriptor ioctl's. */ -#define FIOCLEX _IO('f', 1) /* set close on exec on fd */ -#define FIONCLEX _IO('f', 2) /* remove close on exec */ -#define FIONREAD _IOR('f', 127, int) /* get # bytes to read */ -#define FIONBIO _IOW('f', 126, int) /* set/clear non-blocking i/o */ -#define FIOASYNC _IOW('f', 125, int) /* set/clear async i/o */ -#define FIOSETOWN _IOW('f', 124, int) /* set owner */ -#define FIOGETOWN _IOR('f', 123, int) /* get owner */ -#endif - -#endif /* !_SYS_FILIO_H_ */ diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/ioccom.h b/lib/drivers/oskittcp/include/freebsd/src/sys/sys/ioccom.h deleted file mode 100644 index 355df44d6ee..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/ioccom.h +++ /dev/null @@ -1,68 +0,0 @@ -/*- - * Copyright (c) 1982, 1986, 1990, 1993, 1994 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)ioccom.h 8.2 (Berkeley) 3/28/94 - */ - -#ifndef _SYS_IOCCOM_H_ -#define _SYS_IOCCOM_H_ - -/* - * Ioctl's have the command encoded in the lower word, and the size of - * any in or out parameters in the upper word. The high 3 bits of the - * upper word are used to encode the in/out status of the parameter. - */ -#ifndef __REACTOS__ -#define IOCPARM_MASK 0x1fff /* parameter length, at most 13 bits */ -#define IOCPARM_LEN(x) (((x) >> 16) & IOCPARM_MASK) -#define IOCBASECMD(x) ((x) & ~(IOCPARM_MASK << 16)) -#define IOCGROUP(x) (((x) >> 8) & 0xff) -#endif - -#define IOCPARM_MAX NBPG /* max size of ioctl, mult. of NBPG */ -#define IOC_VOID 0x20000000 /* no parameters */ -#define IOC_OUT 0x40000000 /* copy out parameters */ -#define IOC_IN 0x80000000 /* copy in parameters */ -#define IOC_INOUT (IOC_IN|IOC_OUT) -#define IOC_DIRMASK 0xe0000000 /* mask for IN/OUT/VOID */ - -#ifndef __REACTOS__ -#define _IOC(inout,group,num,len) \ - (inout | ((len & IOCPARM_MASK) << 16) | ((group) << 8) | (num)) -#define _IO(g,n) _IOC(IOC_VOID, (g), (n), 0) -#define _IOR(g,n,t) _IOC(IOC_OUT, (g), (n), sizeof(t)) -#define _IOW(g,n,t) _IOC(IOC_IN, (g), (n), sizeof(t)) -/* this should be _IORW, but stdio got there first */ -#define _IOWR(g,n,t) _IOC(IOC_INOUT, (g), (n), sizeof(t)) -#endif - -#endif /* !_SYS_IOCCOM_H_ */ diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/ioctl.h b/lib/drivers/oskittcp/include/freebsd/src/sys/sys/ioctl.h deleted file mode 100644 index d04394fd181..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/ioctl.h +++ /dev/null @@ -1,84 +0,0 @@ -/*- - * Copyright (c) 1982, 1986, 1990, 1993, 1994 - * The Regents of the University of California. All rights reserved. - * (c) UNIX System Laboratories, Inc. - * All or some portions of this file are derived from material licensed - * to the University of California by American Telephone and Telegraph - * Co. or Unix System Laboratories, Inc. and are reproduced herein with - * the permission of UNIX System Laboratories, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)ioctl.h 8.6 (Berkeley) 3/28/94 - */ - -#ifndef _SYS_IOCTL_H_ -#define _SYS_IOCTL_H_ - -#include - -/* - * Pun for SunOS prior to 3.2. SunOS 3.2 and later support TIOCGWINSZ - * and TIOCSWINSZ (yes, even 3.2-3.5, the fact that it wasn't documented - * nonwithstanding). - */ -struct ttysize { - unsigned short ts_lines; - unsigned short ts_cols; - unsigned short ts_xxx; - unsigned short ts_yyy; -}; -#define TIOCGSIZE TIOCGWINSZ -#define TIOCSSIZE TIOCSWINSZ - -#include - -#include -#include - -#ifndef KERNEL - -#include - -__BEGIN_DECLS -int ioctl __P((int, unsigned long, ...)); -__END_DECLS -#endif /* !KERNEL */ -#endif /* !_SYS_IOCTL_H_ */ - -/* - * Keep outside _SYS_IOCTL_H_ - * Compatability with old terminal driver - * - * Source level -> #define USE_OLD_TTY - * Kernel level -> options COMPAT_43 or COMPAT_SUNOS - */ -#if defined(USE_OLD_TTY) || defined(COMPAT_43) || defined(COMPAT_SUNOS) -#include -#endif diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/kernel.h b/lib/drivers/oskittcp/include/freebsd/src/sys/sys/kernel.h deleted file mode 100644 index 18f031a900c..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/kernel.h +++ /dev/null @@ -1,129 +0,0 @@ -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * (c) UNIX System Laboratories, Inc. - * All or some portions of this file are derived from material licensed - * to the University of California by American Telephone and Telegraph - * Co. or Unix System Laboratories, Inc. and are reproduced herein with - * the permission of UNIX System Laboratories, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)kernel.h 8.3 (Berkeley) 1/21/94 - * $\Id: kernel.h,v 1.9 1995/03/20 19:20:26 wollman Exp $ - */ - -#ifndef _SYS_KERNEL_H_ -#define _SYS_KERNEL_H_ - -/* Global variables for the kernel. */ - -/* 1.1 */ -extern long hostid; -extern char hostname[MAXHOSTNAMELEN]; -extern int hostnamelen; -extern char domainname[MAXHOSTNAMELEN]; -extern int domainnamelen; -extern char kernelname[MAXPATHLEN]; - -/* 1.2 */ -extern volatile struct timeval mono_time; -extern struct timeval boottime; -extern struct timeval runtime; -#ifdef _MSC_VER /* TODO FIXME - need a library-specific macro for this one */ -extern volatile struct timeval kern_time; -#else/*_MSC_VER*/ -extern volatile struct timeval time; -#endif/*_MSC_VER*/ -extern struct timezone tz; /* XXX */ - -extern int tick; /* usec per tick (1000000 / hz) */ -extern int hz; /* system clock's frequency */ -extern int stathz; /* statistics clock's frequency */ -extern int profhz; /* profiling clock's frequency */ -extern int ticks; -extern int lbolt; /* once a second sleep address */ -extern int tickdelta; -extern long timedelta; - -/* - * The following macros are used to declare global sets of objects, which - * are collected by the linker into a `struct linker_set' as defined below. - * - * NB: the constants defined below must match those defined in - * ld/ld.h. Since their calculation requires arithmetic, we - * can't name them symbolically (e.g., 23 is N_SETT | N_EXT). - */ -#ifdef _MSC_VER -#define MAKE_SET(set, sym, type) -#else -#if defined(_M_AMD64) -#define MAKE_SET(set, sym, type) \ - asm(".stabs \"" #set "\", " #type ", 0, 0, " #sym) -#else -#define MAKE_SET(set, sym, type) \ - asm(".stabs \"_" #set "\", " #type ", 0, 0, _" #sym) -#endif -#endif -#define TEXT_SET(set, sym) MAKE_SET(set, sym, 23) -#define DATA_SET(set, sym) MAKE_SET(set, sym, 25) -#define BSS_SET(set, sym) MAKE_SET(set, sym, 27) -#define ABS_SET(set, sym) MAKE_SET(set, sym, 21) - -#ifdef PSEUDO_LKM -#include -#include -#include -#include - -#define PSEUDO_SET(init, name) \ - extern struct linker_set MODVNOPS; \ - MOD_MISC(#name); \ - int name ## _load(struct lkm_table *lkmtp, int cmd) \ - { init(); return 0; } \ - int name ## _unload(struct lkm_table *lkmtp, int cmd) \ - { return EINVAL; } \ - int \ - name ## _mod(struct lkm_table *lkmtp, int cmd, int ver) { \ - DISPATCH(lkmtp, cmd, ver, name ## _load, name ## _unload, \ - nosys); } -#else /* PSEUDO_LKM */ - -#define PSEUDO_SET(sym, name) TEXT_SET(pseudo_set, sym) - -#endif /* PSEUDO_LKM */ - -struct linker_set { - int ls_length; - caddr_t ls_items[1]; /* really ls_length of them, trailing NULL */ -}; - -extern const struct linker_set execsw_set; - -#endif diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/libkern.h b/lib/drivers/oskittcp/include/freebsd/src/sys/sys/libkern.h deleted file mode 100644 index c5437567fa5..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/libkern.h +++ /dev/null @@ -1,65 +0,0 @@ -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)libkern.h 8.1 (Berkeley) 6/10/93 - */ - -#include - -static __inline int imax(int a, int b) { return (a > b ? a : b); } -static __inline int imin(int a, int b) { return (a < b ? a : b); } -static __inline long lmax(long a, long b) { return (a > b ? a : b); } -static __inline long lmin(long a, long b) { return (a < b ? a : b); } -#ifdef max -#undef max -#endif//max -#ifdef min -#undef min -#endif//min -static __inline u_int max(u_int a, u_int b) { return (a > b ? a : b); } -static __inline u_int min(u_int a, u_int b) { return (a < b ? a : b); } -static __inline quad_t qmax(quad_t a, quad_t b) { return (a > b ? a : b); } -static __inline quad_t qmin(quad_t a, quad_t b) { return (a < b ? a : b); } -static __inline u_long ulmax(u_long a, u_long b) { return (a > b ? a : b); } -static __inline u_long ulmin(u_long a, u_long b) { return (a < b ? a : b); } - -/* Prototypes for non-quad routines. */ -int bcmp __P((const void *, const void *, size_t)); -#ifndef HAVE_INLINE_FFS -int ffs __P((int)); -#endif -int locc __P((int, char *, u_int)); -u_long random __P((void)); -char *rindex __P((const char *, int)); -int scanc __P((u_int, u_char *, u_char *, int)); -int skpc __P((int, int, char *)); - diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/malloc.h b/lib/drivers/oskittcp/include/freebsd/src/sys/sys/malloc.h deleted file mode 100644 index bde211cd137..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/malloc.h +++ /dev/null @@ -1,335 +0,0 @@ -/* - * Copyright (c) 1987, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)malloc.h 8.3 (Berkeley) 1/12/94 - */ - -#ifndef _SYS_MALLOC_H_ -#define _SYS_MALLOC_H_ - -#if !defined(OSKIT) || defined(__REACTOS__) -#define KMEMSTATS -#endif - -/* - * flags to malloc - */ -#define M_WAITOK 0x0000 -#define M_NOWAIT 0x0001 -#define M_KERNEL 0x0002 - -/* - * Types of memory to be allocated - */ -#define M_FREE 0 /* should be on free list */ -#define M_MBUF 1 /* mbuf */ -#define M_DEVBUF 2 /* device driver memory */ -#define M_SOCKET 3 /* socket structure */ -#define M_PCB 4 /* protocol control block */ -#define M_RTABLE 5 /* routing tables */ -#define M_HTABLE 6 /* IMP host tables */ -#define M_FTABLE 7 /* fragment reassembly header */ -#define M_ZOMBIE 8 /* zombie proc status */ -#define M_IFADDR 9 /* interface address */ -#define M_SOOPTS 10 /* socket options */ -#define M_SONAME 11 /* socket name */ -#define M_NAMEI 12 /* namei path name buffer */ -#define M_GPROF 13 /* kernel profiling buffer */ -#define M_IOCTLOPS 14 /* ioctl data buffer */ -#define M_MAPMEM 15 /* mapped memory descriptors */ -#define M_CRED 16 /* credentials */ -#define M_PGRP 17 /* process group header */ -#define M_SESSION 18 /* session header */ -#define M_IOV 19 /* large iov's */ -#define M_MOUNT 20 /* vfs mount struct */ -#define M_FHANDLE 21 /* network file handle */ -#define M_NFSREQ 22 /* NFS request header */ -#define M_NFSMNT 23 /* NFS mount structure */ -#define M_NFSNODE 24 /* NFS vnode private part */ -#define M_VNODE 25 /* Dynamically allocated vnodes */ -#define M_CACHE 26 /* Dynamically allocated cache entries */ -#define M_DQUOT 27 /* UFS quota entries */ -#define M_UFSMNT 28 /* UFS mount structure */ -#define M_SHM 29 /* SVID compatible shared memory segments */ -#define M_VMMAP 30 /* VM map structures */ -#define M_VMMAPENT 31 /* VM map entry structures */ -#define M_VMOBJ 32 /* VM object structure */ -#define M_VMOBJHASH 33 /* VM object hash structure */ -#define M_VMPMAP 34 /* VM pmap */ -#define M_VMPVENT 35 /* VM phys-virt mapping entry */ -#define M_VMPAGER 36 /* XXX: VM pager struct */ -#define M_VMPGDATA 37 /* XXX: VM pager private data */ -#define M_FILE 38 /* Open file structure */ -#define M_FILEDESC 39 /* Open file descriptor table */ -#define M_LOCKF 40 /* Byte-range locking structures */ -#define M_PROC 41 /* Proc structures */ -#define M_SUBPROC 42 /* Proc sub-structures */ -#define M_SEGMENT 43 /* Segment for LFS */ -#define M_LFSNODE 44 /* LFS vnode private part */ -#define M_FFSNODE 45 /* FFS vnode private part */ -#define M_MFSNODE 46 /* MFS vnode private part */ -#define M_NQLEASE 47 /* Nqnfs lease */ -#define M_NQMHOST 48 /* Nqnfs host address table */ -#define M_NETADDR 49 /* Export host address structure */ -#define M_NFSSVC 50 /* Nfs server structure */ -#define M_NFSUID 51 /* Nfs uid mapping structure */ -#define M_NFSD 52 /* Nfs server daemon structure */ -#define M_IPMOPTS 53 /* internet multicast options */ -#define M_IPMADDR 54 /* internet multicast address */ -#define M_IFMADDR 55 /* link-level multicast address */ -#define M_MRTABLE 56 /* multicast routing tables */ -#define M_ISOFSMNT 57 /* ISOFS mount structure */ -#define M_ISOFSNODE 58 /* ISOFS vnode private part */ -#define M_MSDOSFSMNT 59 /* MSDOSFS mount structure */ -#define M_MSDOSFSNODE 60 /* MSDOSFS vnode private part */ -#define M_MSDOSFSFAT 61 /* MSDOSFS file allocation table */ -#define M_DEVFSMNT 62 /* DEVFS mount structure */ -#define M_DEVFSBACK 63 /* DEVFS Back node */ -#define M_DEVFSFRONT 64 /* DEVFS Front node */ -#define M_DEVFSNODE 65 /* DEVFS node */ -#define M_TEMP 74 /* misc temporary data buffers */ -#define M_TTYS 75 /* tty data structures */ -#define M_GZIP 76 /* Gzip trees */ -#define M_IPFW 77 /* IpFw/IpAcct chain's */ -#define M_DEVL 78 /* isa_device lists in userconfig() */ -#define M_LAST 79 /* Must be last type + 1 */ - -#define INITKMEMNAMES { \ - "free", /* 0 M_FREE */ \ - "mbuf", /* 1 M_MBUF */ \ - "devbuf", /* 2 M_DEVBUF */ \ - "socket", /* 3 M_SOCKET */ \ - "pcb", /* 4 M_PCB */ \ - "routetbl", /* 5 M_RTABLE */ \ - "hosttbl", /* 6 M_HTABLE */ \ - "fragtbl", /* 7 M_FTABLE */ \ - "zombie", /* 8 M_ZOMBIE */ \ - "ifaddr", /* 9 M_IFADDR */ \ - "soopts", /* 10 M_SOOPTS */ \ - "soname", /* 11 M_SONAME */ \ - "namei", /* 12 M_NAMEI */ \ - "gprof", /* 13 M_GPROF */ \ - "ioctlops", /* 14 M_IOCTLOPS */ \ - "mapmem", /* 15 M_MAPMEM */ \ - "cred", /* 16 M_CRED */ \ - "pgrp", /* 17 M_PGRP */ \ - "session", /* 18 M_SESSION */ \ - "iov", /* 19 M_IOV */ \ - "mount", /* 20 M_MOUNT */ \ - "fhandle", /* 21 M_FHANDLE */ \ - "NFS req", /* 22 M_NFSREQ */ \ - "NFS mount", /* 23 M_NFSMNT */ \ - "NFS node", /* 24 M_NFSNODE */ \ - "vnodes", /* 25 M_VNODE */ \ - "namecache", /* 26 M_CACHE */ \ - "UFS quota", /* 27 M_DQUOT */ \ - "UFS mount", /* 28 M_UFSMNT */ \ - "shm", /* 29 M_SHM */ \ - "VM map", /* 30 M_VMMAP */ \ - "VM mapent", /* 31 M_VMMAPENT */ \ - "VM object", /* 32 M_VMOBJ */ \ - "VM objhash", /* 33 M_VMOBJHASH */ \ - "VM pmap", /* 34 M_VMPMAP */ \ - "VM pvmap", /* 35 M_VMPVENT */ \ - "VM pager", /* 36 M_VMPAGER */ \ - "VM pgdata", /* 37 M_VMPGDATA */ \ - "file", /* 38 M_FILE */ \ - "file desc", /* 39 M_FILEDESC */ \ - "lockf", /* 40 M_LOCKF */ \ - "proc", /* 41 M_PROC */ \ - "subproc", /* 42 M_SUBPROC */ \ - "LFS segment", /* 43 M_SEGMENT */ \ - "LFS node", /* 44 M_LFSNODE */ \ - "FFS node", /* 45 M_FFSNODE */ \ - "MFS node", /* 46 M_MFSNODE */ \ - "NQNFS Lease", /* 47 M_NQLEASE */ \ - "NQNFS Host", /* 48 M_NQMHOST */ \ - "Export Host", /* 49 M_NETADDR */ \ - "NFS srvsock", /* 50 M_NFSSVC */ \ - "NFS uid", /* 51 M_NFSUID */ \ - "NFS daemon", /* 52 M_NFSD */ \ - "ip_moptions", /* 53 M_IPMOPTS */ \ - "in_multi", /* 54 M_IPMADDR */ \ - "ether_multi", /* 55 M_IFMADDR */ \ - "mrt", /* 56 M_MRTABLE */ \ - "ISOFS mount", /* 57 M_ISOFSMNT */ \ - "ISOFS node", /* 58 M_ISOFSNODE */ \ - "MSDOSFS mount",/* 59 M_MSDOSFSMNT */ \ - "MSDOSFS node", /* 60 M_MSDOSFSNODE */ \ - "MSDOSFS FAT", /* 61 M_MSDOSFSFAR */ \ - "DEVFS mount", /* 62 M_DEVFSMNT */ \ - "DEVFS back", /* 63 M_DEVFSBACK */ \ - "DEVFS front", /* 64 M_DEVFSFRONT */ \ - "DEVFS node", /* 65 M_DEVFSNODE */ \ - NULL, \ - NULL, NULL, NULL, NULL, NULL, \ - NULL, NULL, \ - "temp", /* 74 M_TEMP */ \ - "ttys", /* 75 M_TTYS */ \ - "Gzip trees", /* 76 M_GZIP */ \ - "IpFw/IpAcct", /* 77 M_IPFW */ \ - "isa_devlist", /* 78 M_DEVL */ \ -} - -struct kmemstats { - long ks_inuse; /* # of packets of this type currently in use */ - long ks_calls; /* total packets of this type ever allocated */ - long ks_memuse; /* total memory held in bytes */ - u_short ks_limblocks; /* number of times blocked for hitting limit */ - u_short ks_mapblocks; /* number of times blocked for kernel map */ - long ks_maxused; /* maximum number ever used */ - long ks_limit; /* most that are allowed to exist */ - long ks_size; /* sizes of this thing that are allocated */ - long ks_spare; -}; - -/* - * Array of descriptors that describe the contents of each page - */ -struct kmemusage { - short ku_indx; /* bucket index */ - union { - u_short freecnt;/* for small allocations, free pieces in page */ - u_short pagecnt;/* for large allocations, pages alloced */ - } ku_un; -}; -#define ku_freecnt ku_un.freecnt -#define ku_pagecnt ku_un.pagecnt - -/* - * Set of buckets for each size of memory block that is retained - */ -struct kmembuckets { - caddr_t kb_next; /* list of free blocks */ - caddr_t kb_last; /* last free block */ - long kb_calls; /* total calls to allocate this size */ - long kb_total; /* total number of blocks allocated */ - long kb_totalfree; /* # of free elements in this bucket */ - long kb_elmpercl; /* # of elements in this sized allocation */ - long kb_highwat; /* high water mark */ - long kb_couldfree; /* over high water mark and could free */ -}; - -#ifdef KERNEL -#define MINALLOCSIZE (1 << MINBUCKET) -#define BUCKETINDX(size) \ - (size) <= (MINALLOCSIZE * 128) \ - ? (size) <= (MINALLOCSIZE * 8) \ - ? (size) <= (MINALLOCSIZE * 2) \ - ? (size) <= (MINALLOCSIZE * 1) \ - ? (MINBUCKET + 0) \ - : (MINBUCKET + 1) \ - : (size) <= (MINALLOCSIZE * 4) \ - ? (MINBUCKET + 2) \ - : (MINBUCKET + 3) \ - : (size) <= (MINALLOCSIZE* 32) \ - ? (size) <= (MINALLOCSIZE * 16) \ - ? (MINBUCKET + 4) \ - : (MINBUCKET + 5) \ - : (size) <= (MINALLOCSIZE * 64) \ - ? (MINBUCKET + 6) \ - : (MINBUCKET + 7) \ - : (size) <= (MINALLOCSIZE * 2048) \ - ? (size) <= (MINALLOCSIZE * 512) \ - ? (size) <= (MINALLOCSIZE * 256) \ - ? (MINBUCKET + 8) \ - : (MINBUCKET + 9) \ - : (size) <= (MINALLOCSIZE * 1024) \ - ? (MINBUCKET + 10) \ - : (MINBUCKET + 11) \ - : (size) <= (MINALLOCSIZE * 8192) \ - ? (size) <= (MINALLOCSIZE * 4096) \ - ? (MINBUCKET + 12) \ - : (MINBUCKET + 13) \ - : (size) <= (MINALLOCSIZE * 16384) \ - ? (MINBUCKET + 14) \ - : (MINBUCKET + 15) - -/* - * Turn virtual addresses into kmem map indicies - */ -#define kmemxtob(alloc) (kmembase + (alloc) * NBPG) -#define btokmemx(addr) (((caddr_t)(addr) - kmembase) / NBPG) -#define btokup(addr) (&kmemusage[((caddr_t)(addr) - kmembase) >> CLSHIFT]) - -/* - * Macro versions for the usual cases of malloc/free - */ -#if defined(KMEMSTATS) || defined(DIAGNOSTIC) -#define MALLOC(space, cast, size, type, flags) \ - (space) = (cast)fbsd_malloc((u_long)(size), __FILE__, __LINE__, type, flags) -#define FREE(addr, type) fbsd_free((caddr_t)(addr), __FILE__, __LINE__, type) -#else /* do not collect statistics */ -#define MALLOC(space, cast, size, type, flags) { \ - register struct kmembuckets *kbp = &bucket[BUCKETINDX(size)]; \ - long s = splimp(); \ - if (kbp->kb_next == NULL) { \ - (space) = (cast)fbsd_malloc((u_long)(size), __FILE__, __LINE__, type, flags); \ - } else { \ - (space) = (cast)kbp->kb_next; \ - kbp->kb_next = *(caddr_t *)(space); \ - } \ - splx(s); \ -} - -#define FREE(addr, type) { \ - register struct kmembuckets *kbp; \ - register struct kmemusage *kup = btokup(addr); \ - long s = splimp(); \ - if (1 << kup->ku_indx > MAXALLOCSAVE) { \ - fbsd_free((caddr_t)(addr), __FILE__, __LINE__, type); \ - } else { \ - kbp = &bucket[kup->ku_indx]; \ - if (kbp->kb_next == NULL) \ - kbp->kb_next = (caddr_t)(addr); \ - else \ - *(caddr_t *)(kbp->kb_last) = (caddr_t)(addr); \ - *(caddr_t *)(addr) = NULL; \ - kbp->kb_last = (caddr_t)(addr); \ - } \ - splx(s); \ -} -#endif /* do not collect statistics */ - -extern struct kmemstats kmemstats[]; -extern struct kmemusage *kmemusage; -extern char *kmembase; -extern struct kmembuckets bucket[]; -#ifndef __REACTOS__ -extern void *malloc __P((unsigned long size, ...)); -extern void free __P((void *addr, ...)); -#else -#define malloc(size, flags, id) fbsd_malloc(size, __FILE__, __LINE__) -#define free(area, flags) fbsd_free(area, __FILE__, __LINE__) -#endif -#endif /* KERNEL */ -#endif /* !_SYS_MALLOC_H_ */ diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/mbuf.h b/lib/drivers/oskittcp/include/freebsd/src/sys/sys/mbuf.h deleted file mode 100644 index 7a6b0f07f19..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/mbuf.h +++ /dev/null @@ -1,537 +0,0 @@ -/* - * Copyright (c) 1997-1998 University of Utah and the Flux Group. - * All rights reserved. - * - * This file is part of the Flux OSKit. The OSKit is free software, also known - * as "open source;" you can redistribute it and/or modify it under the terms - * of the GNU General Public License (GPL), version 2, as published by the Free - * Software Foundation (FSF). To explore alternate licensing terms, contact - * the University of Utah at csl-dist@cs.utah.edu or +1-801-585-3271. - * - * The OSKit 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 GPL for more details. You should have - * received a copy of the GPL along with the OSKit; see the file COPYING. If - * not, write to the FSF, 59 Temple Place #330, Boston, MA 02111-1307, USA. - */ -/* - * Copyright (c) 1982, 1986, 1988, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)mbuf.h 8.3 (Berkeley) 1/21/94 - * $\Id: mbuf.h,v 1.9 1994/11/14 13:54:20 bde Exp $ - */ - -#ifndef _SYS_MBUF_H_ -#define _SYS_MBUF_H_ - -#ifndef M_WAITOK -#include -#endif - -/* - * Mbufs are of a single size, MSIZE (machine/machparam.h), which - * includes overhead. An mbuf may add a single "mbuf cluster" of size - * MCLBYTES (also in machine/machparam.h), which has no additional overhead - * and is used instead of the internal data area; this is done when - * at least MINCLSIZE of data must be stored. - */ - -#define MLEN (MSIZE - sizeof(struct m_hdr)) /* normal data len */ -#define MHLEN (MLEN - sizeof(struct pkthdr)) /* data len w/pkthdr */ - -#define MINCLSIZE (MHLEN + MLEN) /* smallest amount to put in cluster */ -#define M_MAXCOMPRESS (MHLEN / 2) /* max amount to copy for compression */ - -/* - * Macros for type conversion - * mtod(m,t) - convert mbuf pointer to data pointer of correct type - * dtom(x) - convert data pointer within mbuf to mbuf pointer (XXX) - * mtocl(x) - convert pointer within cluster to cluster index # - * cltom(x) - convert cluster # to ptr to beginning of cluster - */ -#define mtod(m,t) ((t)((m)->m_data)) -#ifndef __REACTOS__ -#define dtom(x) ((struct mbuf *)((int)(x) & ~(MSIZE-1))) -#else -#define dtom(x) ((struct mbuf *)((int)(x) - sizeof(struct m_hdr))) -#endif -#ifndef OSKIT -#define mtocl(x) (((u_int)(x) - (u_int)mbutl) >> MCLSHIFT) -#define cltom(x) ((caddr_t)((u_int)mbutl + ((u_int)(x) << MCLSHIFT))) -#endif /* OSKIT */ - -/* header at beginning of each mbuf: */ -struct m_hdr { - struct mbuf *mh_next; /* next buffer in chain */ - struct mbuf *mh_nextpkt; /* next chain in queue/record */ - int mh_len; /* amount of data in this mbuf */ - caddr_t mh_data; /* location of data */ - short mh_type; /* type of data in this mbuf */ - short mh_flags; /* flags; see below */ -}; - -/* record/packet header in first mbuf of chain; valid if M_PKTHDR set */ -struct pkthdr { - int len; /* total packet length */ - struct ifnet *rcvif; /* rcv interface */ -}; - -/* description of external storage mapped into mbuf, valid if M_EXT set */ -struct m_ext { - caddr_t ext_buf; /* start of buffer */ -#ifdef OSKIT - struct oskit_bufio *ext_bufio; /* OS Kit bufio pointer */ -#else - void (*ext_free) /* free routine if not the usual */ - __P((caddr_t, u_int)); -#endif - u_int ext_size; /* size of buffer, for ext_free */ -}; - -struct mbuf { - struct m_hdr m_hdr; - union { - struct { - struct pkthdr MH_pkthdr; /* M_PKTHDR set */ - union { - struct m_ext MH_ext; /* M_EXT set */ - char MH_databuf[MHLEN]; - } MH_dat; - } MH; - char M_databuf[MLEN]; /* !M_PKTHDR, !M_EXT */ - } M_dat; -}; -#define m_next m_hdr.mh_next -#define m_len m_hdr.mh_len -#define m_data m_hdr.mh_data -#define m_type m_hdr.mh_type -#define m_flags m_hdr.mh_flags -#define m_nextpkt m_hdr.mh_nextpkt -#define m_act m_nextpkt -#define m_pkthdr M_dat.MH.MH_pkthdr -#define m_ext M_dat.MH.MH_dat.MH_ext -#define m_pktdat M_dat.MH.MH_dat.MH_databuf -#define m_dat M_dat.M_databuf - -/* mbuf flags */ -#if defined(OSKIT) && !defined(__REACTOS__) -#include -/* - * A small step for mankind, but a huge leap for BSD: - * We consistently use oskit_bufios for external mbufs - */ -#endif -#define M_EXT 0x0001 /* has associated external storage */ -#define M_PKTHDR 0x0002 /* start of record */ -#define M_EOR 0x0004 /* end of record */ - -/* mbuf pkthdr flags, also in m_flags */ -#define M_BCAST 0x0100 /* send/received as link-level broadcast */ -#define M_MCAST 0x0200 /* send/received as link-level multicast */ - -/* flags copied when copying m_pkthdr */ -#define M_COPYFLAGS (M_PKTHDR|M_EOR|M_BCAST|M_MCAST) - -/* mbuf types */ -#define MT_FREE 0 /* should be on free list */ -#define MT_DATA 1 /* dynamic (data) allocation */ -#define MT_HEADER 2 /* packet header */ -#define MT_SOCKET 3 /* socket structure */ -#define MT_PCB 4 /* protocol control block */ -#define MT_RTABLE 5 /* routing tables */ -#define MT_HTABLE 6 /* IMP host tables */ -#define MT_ATABLE 7 /* address resolution tables */ -#define MT_SONAME 8 /* socket name */ -#define MT_SOOPTS 10 /* socket options */ -#define MT_FTABLE 11 /* fragment reassembly header */ -#define MT_RIGHTS 12 /* access rights */ -#define MT_IFADDR 13 /* interface address */ -#define MT_CONTROL 14 /* extra-data protocol message */ -#define MT_OOBDATA 15 /* expedited data */ - -/* flags to m_get/MGET */ -#define M_DONTWAIT M_NOWAIT -#define M_WAIT M_WAITOK - -/* - * mbuf utility macros: - * - * MBUFLOCK(code) - * prevents a section of code from from being interrupted by network - * drivers. - */ -#define MBUFLOCK(code) \ - { int ms = splimp(); \ - { code } \ - splx(ms); \ - } - -/* - * mbuf allocation/deallocation macros: - * - * MGET(struct mbuf *m, int how, int type) - * allocates an mbuf and initializes it to contain internal data. - * - * MGETHDR(struct mbuf *m, int how, int type) - * allocates an mbuf and initializes it to contain a packet header - * and internal data. - */ -#define MGET(m, how, type) { \ - MALLOC((m), struct mbuf *, MSIZE, mbtypes[type], (how)); \ - OS_DbgPrint(OSK_MID_TRACE,("(MGET) got mbuf @ %x\n", m)); \ - if (m) { \ - (m)->m_type = (type); \ - MBUFLOCK(mbstat.m_mtypes[type]++;) \ - (m)->m_next = (struct mbuf *)NULL; \ - (m)->m_nextpkt = (struct mbuf *)NULL; \ - (m)->m_data = (m)->m_dat; \ - (m)->m_flags = 0; \ - } else \ - (m) = m_retry((how), (type)); \ -} - -#define MGETHDR(m, how, type) { \ - MALLOC((m), struct mbuf *, MSIZE, mbtypes[type], (how)); \ - OS_DbgPrint(OSK_MID_TRACE,("(MGETHDR) got mbuf @ %x\n", m)); \ - if (m) { \ - (m)->m_type = (type); \ - MBUFLOCK(mbstat.m_mtypes[type]++;) \ - (m)->m_next = (struct mbuf *)NULL; \ - (m)->m_nextpkt = (struct mbuf *)NULL; \ - (m)->m_data = (m)->m_pktdat; \ - (m)->m_flags = M_PKTHDR; \ - } else \ - (m) = m_retryhdr((how), (type)); \ -} - -#ifdef OSKIT -#define MGET_DONT_RECURSE(m, how, type) { \ - MALLOC((m), struct mbuf *, MSIZE, mbtypes[type], (how)); \ - OS_DbgPrint(OSK_MID_TRACE,("(MGET_DONT_RECURSE) got mbuf @ %x\n", m)); \ - if (m) { \ - (m)->m_type = (type); \ - MBUFLOCK(mbstat.m_mtypes[type]++;) \ - (m)->m_next = (struct mbuf *)NULL; \ - (m)->m_nextpkt = (struct mbuf *)NULL; \ - (m)->m_data = (m)->m_dat; \ - (m)->m_flags = 0; \ - } else \ - (m) = (struct mbuf *)0; \ -} - -#define MGETHDR_DONT_RECURSE(m, how, type) { \ - MALLOC((m), struct mbuf *, MSIZE, mbtypes[type], (how)); \ - OS_DbgPrint(OSK_MID_TRACE,("(MGETHDR_DONT_RECURSE) got mbuf @ %x\n", m)); \ - if (m) { \ - (m)->m_type = (type); \ - MBUFLOCK(mbstat.m_mtypes[type]++;) \ - (m)->m_next = (struct mbuf *)NULL; \ - (m)->m_nextpkt = (struct mbuf *)NULL; \ - (m)->m_data = (m)->m_pktdat; \ - (m)->m_flags = M_PKTHDR; \ - } else \ - (m) = (struct mbuf *)0; \ -} -#endif /* OSKIT */ - -#ifndef OSKIT -/* - * Mbuf cluster macros. - * MCLALLOC(caddr_t p, int how) allocates an mbuf cluster. - * MCLGET adds such clusters to a normal mbuf; - * the flag M_EXT is set upon success. - * MCLFREE releases a reference to a cluster allocated by MCLALLOC, - * freeing the cluster if the reference count has reached 0. - * - * Normal mbuf clusters are normally treated as character arrays - * after allocation, but use the first word of the buffer as a free list - * pointer while on the free list. - */ -union mcluster { - union mcluster *mcl_next; - char mcl_buf[MCLBYTES]; -}; - -#define MCLALLOC(p, how) \ - MBUFLOCK( \ - OS_DbgPrint(OSK_MID_TRACE,("(MCLALLOC)\n")); \ - if (mclfree == 0) \ - (void)m_clalloc(1, (how)); \ - (p) = (caddr_t)mclfree; \ - if ((p)) { \ - ++mclrefcnt[mtocl(p)]; \ - mbstat.m_clfree--; \ - mclfree = ((union mcluster *)(p))->mcl_next; \ - } \ - ) - -#define MCLGET(m, how) \ - { MCLALLOC((m)->m_ext.ext_buf, (how)); \ - OS_DbgPrint(OSK_MID_TRACE,("(MCLGET) m = %x\n", m)); \ - if ((m)->m_ext.ext_buf != NULL) { \ - (m)->m_data = (m)->m_ext.ext_buf; \ - (m)->m_flags |= M_EXT; \ - (m)->m_ext.ext_size = MCLBYTES; \ - } \ - } - -#define MCLFREE(p) \ - MBUFLOCK ( \ - OS_DbgPrint(OSK_MID_TRACE,("(MCLFREE)\n")); \ - if (--mclrefcnt[mtocl(p)] == 0) { \ - ((union mcluster *)(p))->mcl_next = mclfree; \ - mclfree = (union mcluster *)(p); \ - mbstat.m_clfree++; \ - } \ - ) -#else -#define MCLGET(m, how) \ - { (m)->m_ext.ext_bufio = oskit_bufio_create(MCLBYTES); \ - OS_DbgPrint(OSK_MID_TRACE,("(!OSKIT MCLGET)\n")); \ - oskit_bufio_map((m)->m_ext.ext_bufio, \ - (void **)&((m)->m_ext.ext_buf), 0, MCLBYTES); \ - if ((m)->m_ext.ext_buf != NULL) { \ - (m)->m_data = (m)->m_ext.ext_buf; \ - (m)->m_flags |= M_EXT; \ - (m)->m_ext.ext_size = MCLBYTES; \ - } \ - } -#endif /* !OSKIT */ - -/* - * MFREE(struct mbuf *m, struct mbuf *n) - * Free a single mbuf and associated external storage. - * Place the successor, if any, in n. - */ -#ifdef notyet -#define MFREE(m, n) \ - { MBUFLOCK(mbstat.m_mtypes[(m)->m_type]--;) \ - if ((m)->m_flags & M_EXT) { \ - if ((m)->m_ext.ext_free) \ - (*((m)->m_ext.ext_free))((m)->m_ext.ext_buf, \ - (m)->m_ext.ext_size); \ - else \ - MCLFREE((m)->m_ext.ext_buf); \ - } \ - (n) = (m)->m_next; \ - FREE((m), mbtypes[(m)->m_type]); \ - m = NULL; \ - } -#else /* notyet */ -#ifdef OSKIT -#define MFREE(m, nn) \ - { MBUFLOCK(mbstat.m_mtypes[(m)->m_type]--;) \ - OS_DbgPrint(OSK_MID_TRACE,("(OSKIT MFREE) m = %x\n", m)); \ - if ((m)->m_flags & M_EXT) { \ - oskit_bufio_release((m)->m_ext.ext_bufio); \ - } \ - (nn) = (m)->m_next; \ - FREE((m), mbtypes[(m)->m_type]); \ - m = NULL; \ - } -#else /* !OSKIT */ -#define MFREE(m, nn) \ - { MBUFLOCK(mbstat.m_mtypes[(m)->m_type]--;) \ - OS_DbgPrint(OSK_MID_TRACE,("(!OSKIT MFREE) m = %x\n", m)); \ - if ((m)->m_flags & M_EXT) { \ - MCLFREE((m)->m_ext.ext_buf); \ - } \ - (nn) = (m)->m_next; \ - FREE((m), mbtypes[(m)->m_type]); \ - m = NULL; \ - } -#endif /* OSKIT */ -#endif - -/* - * Copy mbuf pkthdr from from to to. - * from must have M_PKTHDR set, and to must be empty. - */ -#define M_COPY_PKTHDR(to, from) { \ - OS_DbgPrint(OSK_MID_TRACE,("(M_COPY_PKTHDR) to %x from %x\n", to, from)); \ - (to)->m_pkthdr = (from)->m_pkthdr; \ - (to)->m_flags = (from)->m_flags & M_COPYFLAGS; \ - (to)->m_data = (to)->m_pktdat; \ -} - -/* - * Set the m_data pointer of a newly-allocated mbuf (m_get/MGET) to place - * an object of the specified size at the end of the mbuf, longword aligned. - */ -#define M_ALIGN(m, len) \ - { \ - OS_DbgPrint(OSK_MID_TRACE,("(M_ALIGN) %d @ %x\n", m, len)); \ - (m)->m_data += (MLEN - (len)) &~ (sizeof(long) - 1); \ - } -/* - * As above, for mbufs allocated with m_gethdr/MGETHDR - * or initialized by M_COPY_PKTHDR. - */ -#define MH_ALIGN(m, len) \ - { \ - OS_DbgPrint(OSK_MID_TRACE,("(MH_ALIGN) %d @ %x\n", m, len)); \ - (m)->m_data += (MHLEN - (len)) &~ (sizeof(long) - 1); \ - } - -/* - * Compute the amount of space available - * before the current start of data in an mbuf. - */ -#ifdef OSKIT -/* Be bold and strong: why shouldn't that work??? */ -#define M_LEADINGSPACE(m) \ - ((m)->m_flags & M_EXT ? (m)->m_data - (m)->m_ext.ext_buf : \ - (m)->m_flags & M_PKTHDR ? (m)->m_data - (m)->m_pktdat : \ - (m)->m_data - (m)->m_dat) -#else -#define M_LEADINGSPACE(m) \ - ((m)->m_flags & M_EXT ? /* (m)->m_data - (m)->m_ext.ext_buf */ 0 : \ - (m)->m_flags & M_PKTHDR ? (m)->m_data - (m)->m_pktdat : \ - (m)->m_data - (m)->m_dat) -#endif /* OSKIT */ - -/* - * Compute the amount of space available - * after the end of data in an mbuf. - */ -#define M_TRAILINGSPACE(m) \ - OS_DbgPrint(OSK_MID_TRACE,("(M_TRAILINGSPACE) %x\n", m)); \ - ((m)->m_flags & M_EXT ? (m)->m_ext.ext_buf + (m)->m_ext.ext_size - \ - ((m)->m_data + (m)->m_len) : \ - &(m)->m_dat[MLEN] - ((m)->m_data + (m)->m_len)) - -/* - * Arrange to prepend space of size plen to mbuf m. - * If a new mbuf must be allocated, how specifies whether to wait. - * If how is M_DONTWAIT and allocation fails, the original mbuf chain - * is freed and m is set to NULL. - */ -#define M_PREPEND(m, plen, how) { \ - OS_DbgPrint(OSK_MID_TRACE,("(M_PREPEND) %d on %x\n", plen, m)); \ - if (M_LEADINGSPACE(m) >= (plen)) { \ - (m)->m_data -= (plen); \ - (m)->m_len += (plen); \ - } else \ - (m) = m_prepend((m), (plen), (how)); \ - if ((m) && (m)->m_flags & M_PKTHDR) \ - (m)->m_pkthdr.len += (plen); \ -} - -/* change mbuf to new type */ -#define MCHTYPE(m, t) { \ - OS_DbgPrint(OSK_MID_TRACE,("(MCHTYPE) %x %x\n", m, t)); \ - MBUFLOCK(mbstat.m_mtypes[(m)->m_type]--; mbstat.m_mtypes[t]++;) \ - (m)->m_type = t;\ -} - -/* length to m_copy to copy all */ -#define M_COPYALL 1000000000 - -/* compatiblity with 4.3 */ -#define m_copy(m, o, l) m_copym((m), (o), (l), M_DONTWAIT) - -/* - * Mbuf statistics. - */ -struct mbstat { - u_long m_mbufs; /* mbufs obtained from page pool */ - u_long m_clusters; /* clusters obtained from page pool */ - u_long m_spare; /* spare field */ - u_long m_clfree; /* free clusters */ - u_long m_drops; /* times failed to find space */ - u_long m_wait; /* times waited for space */ - u_long m_drain; /* times drained protocols for space */ - u_short m_mtypes[256]; /* type specific mbuf allocations */ -}; - -#ifdef KERNEL -#ifndef OSKIT -extern struct mbuf *mbutl; /* virtual address of mclusters */ -extern char *mclrefcnt; /* cluster reference counts */ -#endif /* !OSKIT */ -struct mbstat mbstat; -#ifndef OSKIT -extern int nmbclusters; -union mcluster *mclfree; -#endif /* !OSKIT */ -int max_linkhdr; /* largest link-level header */ -int max_protohdr; /* largest protocol header */ -int max_hdr; /* largest link+protocol header */ -int max_datalen; /* MHLEN - max_hdr */ -extern int mbtypes[]; /* XXX */ - -int m_clalloc __P((int, int)); -void m_copyback __P((struct mbuf *, int, int, caddr_t)); -struct mbuf *m_retry __P((int, int)); -struct mbuf *m_retryhdr __P((int, int)); -void m_reclaim __P((void)); -struct mbuf *m_get __P((int, int)); -struct mbuf *m_gethdr __P((int, int)); -struct mbuf *m_getclr __P((int, int)); -struct mbuf *m_free __P((struct mbuf *)); -void m_freem __P((struct mbuf *)); -struct mbuf *m_prepend __P((struct mbuf *,int,int)); -struct mbuf *m_copym __P((struct mbuf *, int, int, int)); -void m_copydata __P((struct mbuf *,int,int,caddr_t)); -void m_cat __P((struct mbuf *,struct mbuf *)); -void m_adj __P((struct mbuf *,int)); -struct mbuf *m_pullup __P((struct mbuf *, int)); -struct mbuf *m_split __P((struct mbuf *,int,int)); -struct mbuf *m_devget __P((char *, int, int, struct ifnet *, - void (*copy)(struct mbuf *, caddr_t, u_int))); - -#ifdef MBTYPES -int mbtypes[] = { /* XXX */ - M_FREE, /* MT_FREE 0 should be on free list */ - M_MBUF, /* MT_DATA 1 dynamic (data) allocation */ - M_MBUF, /* MT_HEADER 2 packet header */ - M_SOCKET, /* MT_SOCKET 3 socket structure */ - M_PCB, /* MT_PCB 4 protocol control block */ - M_RTABLE, /* MT_RTABLE 5 routing tables */ - M_HTABLE, /* MT_HTABLE 6 IMP host tables */ - 0, /* MT_ATABLE 7 address resolution tables */ - M_MBUF, /* MT_SONAME 8 socket name */ - 0, /* 9 */ - M_SOOPTS, /* MT_SOOPTS 10 socket options */ - M_FTABLE, /* MT_FTABLE 11 fragment reassembly header */ - M_MBUF, /* MT_RIGHTS 12 access rights */ - M_IFADDR, /* MT_IFADDR 13 interface address */ - M_MBUF, /* MT_CONTROL 14 extra-data protocol message */ - M_MBUF, /* MT_OOBDATA 15 expedited data */ -#ifdef DATAKIT - 25, 26, 27, 28, 29, 30, 31, 32 /* datakit ugliness */ -#endif -}; -#endif -#endif - -#endif /* !_SYS_MBUF_H_ */ diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/param.h b/lib/drivers/oskittcp/include/freebsd/src/sys/sys/param.h deleted file mode 100644 index c56fd8bf8e5..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/param.h +++ /dev/null @@ -1,225 +0,0 @@ -/*- - * Copyright (c) 1982, 1986, 1989, 1993 - * The Regents of the University of California. All rights reserved. - * (c) UNIX System Laboratories, Inc. - * All or some portions of this file are derived from material licensed - * to the University of California by American Telephone and Telegraph - * Co. or Unix System Laboratories, Inc. and are reproduced herein with - * the permission of UNIX System Laboratories, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)param.h 8.2 (Berkeley) 1/21/94 - */ - -#ifndef _SYS_PARAM_H_ -#define _SYS_PARAM_H_ - -#define BSD 199306 /* System version (year & month). */ -#define BSD4_3 1 -#define BSD4_4 1 - -#ifndef NULL -#define NULL 0 -#endif - -#ifndef LOCORE -#include -#endif - -/* - * Machine-independent constants (some used in following include files). - * Redefined constants are from POSIX 1003.1 limits file. - * - * MAXCOMLEN should be >= sizeof(ac_comm) (see ) - * MAXLOGNAME should be >= UT_NAMESIZE (see ) - */ -#include - -#define MAXCOMLEN 16 /* max command name remembered */ -#define MAXINTERP 32 /* max interpreter file name length */ -#define MAXLOGNAME 12 /* max login name length */ -#define MAXUPRC CHILD_MAX /* max simultaneous processes */ -#define NCARGS ARG_MAX /* max bytes for an exec function */ -#define NGROUPS NGROUPS_MAX /* max number groups */ -#define NOFILE OPEN_MAX /* max open files per process */ -#define NOGROUP 65535 /* marker for empty group set member */ -#define MAXHOSTNAMELEN 256 /* max hostname size */ - -/* More types and definitions used throughout the kernel. */ -#ifdef KERNEL -#include -#include -#include -#include -#include -#include -#include -#endif - -/* Signals. */ -#include - -/* Machine type dependent parameters. */ -#include -#include - -/* - * Priorities. Note that with 32 run queues, differences less than 4 are - * insignificant. - */ -#define PSWP 0 -#define PVM 4 -#define PINOD 8 -#define PRIBIO 16 -#define PVFS 20 -#define PZERO 22 /* No longer magic, shouldn't be here. XXX */ -#define PSOCK 24 -#define PWAIT 32 -#define PLOCK 36 -#define PPAUSE 40 -#define PUSER 50 -#define MAXPRI 127 /* Priorities range from 0 through MAXPRI. */ - -#define PRIMASK 0x0ff -#define PCATCH 0x100 /* OR'd with pri for tsleep to check signals */ - -#define NZERO 0 /* default "nice" */ - -#define NBPW sizeof(int) /* number of bytes per word (integer) */ - -#define CMASK 022 /* default file mask: S_IWGRP|S_IWOTH */ -#define NODEV (dev_t)(-1) /* non-existent device */ - -/* - * Clustering of hardware pages on machines with ridiculously small - * page sizes is done here. The paging subsystem deals with units of - * CLSIZE pte's describing NBPG (from machine/machparam.h) pages each. - */ -#define CLBYTES (CLSIZE*NBPG) -#define CLOFSET (CLSIZE*NBPG-1) /* for clusters, like PGOFSET */ -#define claligned(x) ((((int)(x))&CLOFSET)==0) -#define CLOFF CLOFSET -#define CLSHIFT (PGSHIFT+CLSIZELOG2) - -#if CLSIZE==1 -#define clbase(i) (i) -#define clrnd(i) (i) -#else -/* Give the base virtual address (first of CLSIZE). */ -#define clbase(i) ((i) &~ (CLSIZE-1)) -/* Round a number of clicks up to a whole cluster. */ -#define clrnd(i) (((i) + (CLSIZE-1)) &~ (CLSIZE-1)) -#endif - -#define CBLOCK 128 /* Clist block size, must be a power of 2. */ -#define CBQSIZE (CBLOCK/NBBY) /* Quote bytes/cblock - can do better. */ - /* Data chars/clist. */ -#define CBSIZE (CBLOCK - sizeof(struct cblock *) - CBQSIZE) -#define CROUND (CBLOCK - 1) /* Clist rounding. */ - -/* - * File system parameters and macros. - * - * The file system is made out of blocks of at most MAXBSIZE units, with - * smaller units (fragments) only in the last direct block. MAXBSIZE - * primarily determines the size of buffers in the buffer pool. It may be - * made larger without any effect on existing file systems; however making - * it smaller make make some file systems unmountable. Also, MAXBSIZE - * must be less than MAXPHYS!!! - */ -#define MAXBSIZE 16384 -#define MAXFRAG 8 - -/* - * MAXPATHLEN defines the longest permissable path length after expanding - * symbolic links. It is used to allocate a temporary buffer from the buffer - * pool in which to do the name expansion, hence should be a power of two, - * and must be less than or equal to MAXBSIZE. MAXSYMLINKS defines the - * maximum number of symbolic links that may be expanded in a path name. - * It should be set high enough to allow all legitimate uses, but halt - * infinite loops reasonably quickly. - */ -#define MAXPATHLEN PATH_MAX -#define MAXSYMLINKS 32 - -/* Bit map related macros. */ -#define setbit(a,i) ((a)[(i)/NBBY] |= 1<<((i)%NBBY)) -#define clrbit(a,i) ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY))) -#define isset(a,i) ((a)[(i)/NBBY] & (1<<((i)%NBBY))) -#define isclr(a,i) (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0) - -/* Macros for counting and rounding. */ -#ifndef howmany -#define howmany(x, y) (((x)+((y)-1))/(y)) -#endif -#define rounddown(x, y) (((x)/(y))*(y)) -#define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) -#define powerof2(x) ((((x)-1)&(x))==0) - -/* Macros for min/max. */ -#ifndef KERNEL -#define MIN(a,b) (((a)<(b))?(a):(b)) -#define MAX(a,b) (((a)>(b))?(a):(b)) -#endif - -/* - * Constants for setting the parameters of the kernel memory allocator. - * - * 2 ** MINBUCKET is the smallest unit of memory that will be - * allocated. It must be at least large enough to hold a pointer. - * - * Units of memory less or equal to MAXALLOCSAVE will permanently - * allocate physical memory; requests for these size pieces of - * memory are quite fast. Allocations greater than MAXALLOCSAVE must - * always allocate and free physical memory; requests for these - * size allocations should be done infrequently as they will be slow. - * - * Constraints: CLBYTES <= MAXALLOCSAVE <= 2 ** (MINBUCKET + 14), and - * MAXALLOCSIZE must be a power of two. - */ -#define MINBUCKET 4 /* 4 => min allocation of 16 bytes */ -#define MAXALLOCSAVE (2 * CLBYTES) - -/* - * Scale factor for scaled integers used to count %cpu time and load avgs. - * - * The number of CPU `tick's that map to a unique `%age' can be expressed - * by the formula (1 / (2 ^ (FSHIFT - 11))). The maximum load average that - * can be calculated (assuming 32 bits) can be closely approximated using - * the formula (2 ^ (2 * (16 - FSHIFT))) for (FSHIFT < 15). - * - * For the scheduler to maintain a 1:1 mapping of CPU `tick' to `%age', - * FSHIFT must be at least 11; this gives us a maximum load avg of ~1024. - */ -#undef FSHIFT -#define FSHIFT 11 /* bits to right of fixed binary point */ -#define FSCALE (1< /* Machine-dependent proc substruct. */ -#include /* For struct rtprio. */ -#include /* For struct selinfo. */ -#include /* For structs itimerval, timeval. */ -#include - -#ifdef OSKIT -#ifndef __REACTOS__ -#include -#else -#include -#endif -#endif - -/* - * One structure allocated per session. - */ -struct session { - int s_count; /* Ref cnt; pgrps in session. */ - struct proc *s_leader; /* Session leader. */ - struct vnode *s_ttyvp; /* Vnode of controlling terminal. */ - struct tty *s_ttyp; /* Controlling terminal. */ - char s_login[MAXLOGNAME]; /* Setlogin() name. */ -}; - -/* - * One structure allocated per process group. - */ -struct pgrp { - struct pgrp *pg_hforw; /* Forward link in hash bucket. */ - struct proc *pg_mem; /* Pointer to pgrp members. */ - struct session *pg_session; /* Pointer to session. */ - pid_t pg_id; /* Pgrp id. */ - int pg_jobc; /* # procs qualifying pgrp for job control */ -}; - -/* - * Description of a process. - * - * This structure contains the information needed to manage a thread of - * control, known in UN*X as a process; it has references to substructures - * containing descriptions of things that the process uses, but may share - * with related processes. The process structure and the substructures - * are always addressible except for those marked "(PROC ONLY)" below, - * which might be addressible only on a processor on which the process - * is running. - */ -struct proc { -#ifndef OSKIT - struct proc *p_forw; /* Doubly-linked run/sleep queue. */ - struct proc *p_back; - struct proc *p_next; /* Linked list of active procs */ - struct proc **p_prev; /* and zombies. */ - - /* substructures: */ - struct pcred *p_cred; /* Process owner's identity. */ - struct filedesc *p_fd; /* Ptr to open files structure. */ - struct pstats *p_stats; /* Accounting/statistics (PROC ONLY). */ - struct plimit *p_limit; /* Process limits. */ - struct vmspace *p_vmspace; /* Address space. */ - struct sigacts *p_sigacts; /* Signal actions, state (PROC ONLY). */ - -#define p_ucred p_cred->pc_ucred -#define p_rlimit p_limit->pl_rlimit - - int p_flag; /* P_* flags. */ - char p_stat; /* S* process status. */ - - char p_pad1[3]; - - pid_t p_pid; /* Process identifier. */ - struct proc *p_hash; /* Hashed based on p_pid for kill+exit+... */ - struct proc *p_pgrpnxt; /* Pointer to next process in process group. */ - struct proc *p_pptr; /* Pointer to process structure of parent. */ - struct proc *p_osptr; /* Pointer to older sibling processes. */ - -/* The following fields are all zeroed upon creation in fork. */ -#define p_startzero p_ysptr - struct proc *p_ysptr; /* Pointer to younger siblings. */ - struct proc *p_cptr; /* Pointer to youngest living child. */ - pid_t p_oppid; /* Save parent pid during ptrace. XXX */ - int p_dupfd; /* Sideways return value from fdopen. XXX */ - - /* scheduling */ - u_int p_estcpu; /* Time averaged value of p_cpticks. */ - int p_cpticks; /* Ticks of cpu time. */ - fixpt_t p_pctcpu; /* %cpu for this process during p_swtime */ - void *p_wchan; /* Sleep address. */ - char *p_wmesg; /* Reason for sleep. */ - u_int p_swtime; /* Time swapped in or out. */ - u_int p_slptime; /* Time since last blocked. */ - - struct itimerval p_realtimer; /* Alarm timer. */ - struct timeval p_rtime; /* Real time. */ - u_quad_t p_uticks; /* Statclock hits in user mode. */ - u_quad_t p_sticks; /* Statclock hits in system mode. */ - u_quad_t p_iticks; /* Statclock hits processing intr. */ - - int p_traceflag; /* Kernel trace points. */ - struct vnode *p_tracep; /* Trace to vnode. */ - - int p_siglist; /* Signals arrived but not delivered. */ - - struct vnode *p_textvp; /* Vnode of executable. */ - - char p_lock; /* Process lock count. */ - char p_pad2[3]; /* alignment */ - long p_spare[2]; /* Pad to 256, avoid shifting eproc. XXX */ - -/* End area that is zeroed on creation. */ -#define p_endzero p_startcopy - -/* The following fields are all copied upon creation in fork. */ -#define p_startcopy p_sigmask - - sigset_t p_sigmask; /* Current signal mask. */ - sigset_t p_sigignore; /* Signals being ignored. */ - sigset_t p_sigcatch; /* Signals being caught by user. */ - - u_char p_priority; /* Process priority. */ - u_char p_usrpri; /* User-priority based on p_cpu and p_nice. */ - char p_nice; /* Process "nice" value. */ - char p_comm[MAXCOMLEN+1]; - - struct pgrp *p_pgrp; /* Pointer to process group. */ - - struct sysentvec *p_sysent; /* System call dispatch information. */ - - struct rtprio p_rtprio; /* Realtime priority. */ -/* End area that is copied on creation. */ -#define p_endcopy p_thread - int p_thread; /* Id for this "thread"; Mach glue. XXX */ - struct user *p_addr; /* Kernel virtual addr of u-area (PROC ONLY). */ - struct mdproc p_md; /* Any machine-dependent fields. */ - - u_short p_xstat; /* Exit status for wait; also stop signal. */ - u_short p_acflag; /* Accounting flags. */ - struct rusage *p_ru; /* Exit information. XXX */ -#else /* OSKIT */ - /* - * let's build our own rudimentary struct proc - */ - struct proc *p_forw; /* Doubly-linked run/sleep queue. */ - struct pcred *p_cred; /* Process owner's identity. */ - struct pstats *p_stats; /* Accounting/statistics (PROC ONLY). */ -#define p_ucred p_cred->pc_ucred - int p_flag; /* P_* flags. */ - char p_stat; /* S* process status. */ - pid_t p_pid; /* Process identifier. */ - void *p_wchan; /* Sleep address. */ - char *p_wmesg; /* Reason for sleep. */ - u_short p_acflag; /* Accounting flags. */ - - osenv_sleeprec_t p_sr; - /* - * When selrecord is invoked, this points to an object used to - * manage a set of listeners - */ - struct listener_mgr *p_sel; -#endif /* !OSKIT */ -}; - -#define p_session p_pgrp->pg_session -#define p_pgid p_pgrp->pg_id - -/* Status values. */ -#define SIDL 1 /* Process being created by fork. */ -#define SRUN 2 /* Currently runnable. */ -#define SSLEEP 3 /* Sleeping on an address. */ -#define SSTOP 4 /* Process debugging or suspension. */ -#define SZOMB 5 /* Awaiting collection by parent. */ - -/* These flags are kept in p_flags. */ -#define P_ADVLOCK 0x00001 /* Process may hold a POSIX advisory lock. */ -#define P_CONTROLT 0x00002 /* Has a controlling terminal. */ -#define P_INMEM 0x00004 /* Loaded into memory. */ -#define P_NOCLDSTOP 0x00008 /* No SIGCHLD when children stop. */ -#define P_PPWAIT 0x00010 /* Parent is waiting for child to exec/exit. */ -#define P_PROFIL 0x00020 /* Has started profiling. */ -#define P_SELECT 0x00040 /* Selecting; wakeup/waiting danger. */ -#define P_SINTR 0x00080 /* Sleep is interruptible. */ -#define P_SUGID 0x00100 /* Had set id privileges since last exec. */ -#define P_SYSTEM 0x00200 /* System proc: no sigs, stats or swapping. */ -#define P_TIMEOUT 0x00400 /* Timing out during sleep. */ -#define P_TRACED 0x00800 /* Debugged process being traced. */ -#define P_WAITED 0x01000 /* Debugging process has waited for child. */ -#define P_WEXIT 0x02000 /* Working on exiting. */ -#define P_EXEC 0x04000 /* Process called exec. */ -#define P_SWAPPING 0x40000 /* Process is being swapped. */ - -/* Should probably be changed into a hold count (They have. -DG). */ -#define P_NOSWAP 0x08000 /* Another flag to prevent swap out. */ -#define P_PHYSIO 0x10000 /* Doing physical I/O. */ - -/* Should be moved to machine-dependent areas. */ -#define P_OWEUPC 0x20000 /* Owe process an addupc() call at next ast. */ - -/* - * MOVE TO ucred.h? - * - * Shareable process credentials (always resident). This includes a reference - * to the current user credentials as well as real and saved ids that may be - * used to change ids. - */ -struct pcred { - struct ucred *pc_ucred; /* Current credentials. */ - uid_t p_ruid; /* Real user id. */ - uid_t p_svuid; /* Saved effective user id. */ - gid_t p_rgid; /* Real group id. */ - gid_t p_svgid; /* Saved effective group id. */ - int p_refcnt; /* Number of references. */ -}; - -#ifdef KERNEL -/* - * We use process IDs <= PID_MAX; PID_MAX + 1 must also fit in a pid_t, - * as it is used to represent "no process group". - */ -#define PID_MAX 30000 -#define NO_PID 30001 -#define PIDHASH(pid) ((pid) & pidhashmask) - -#define SESS_LEADER(p) ((p)->p_session->s_leader == (p)) -#define SESSHOLD(s) ((s)->s_count++) -#define SESSRELE(s) { \ - if (--(s)->s_count == 0) \ - FREE(s, M_SESSION); \ -} - -extern struct proc *pidhash[]; /* In param.c. */ -extern struct pgrp *pgrphash[]; /* In param.c. */ -extern struct proc *curproc; /* Current running proc. */ -extern struct proc proc0; /* Process slot for swapper. */ -extern int nprocs, maxproc; /* Current and max number of procs. */ -extern int maxprocperuid; /* Max procs per uid. */ -extern int pidhashmask; /* In param.c. */ - -extern volatile struct proc *allproc; /* List of active procs. */ -extern struct proc *zombproc; /* List of zombie procs. */ -extern struct proc *initproc, *pageproc; /* Process slots for init, pager. */ - -#define NQS 32 /* 32 run queues. */ -struct prochd { - struct proc *ph_link; /* Linked list of running processes. */ - struct proc *ph_rlink; -}; -extern struct prochd qs[]; -extern struct prochd rtqs[]; -extern struct prochd idqs[]; -extern int whichqs; /* Bit mask summary of non-empty Q's. */ - -int chgproccnt __P((uid_t, int)); -struct proc *pfind __P((pid_t)); /* Find process by id. */ -struct proc *zpfind __P((pid_t)); /* Find zombie process by id. */ -struct pgrp *pgfind __P((pid_t)); /* Find process group by id. */ -void mi_switch __P((void)); -void resetpriority __P((struct proc *)); -void roundrobin __P((void *)); -void schedcpu __P((void *)); -void setrunnable __P((struct proc *)); -void setrunqueue __P((struct proc *)); -void remrq __P((struct proc *)); -void cpu_switch __P((struct proc *)); -void sleep __P((void *chan, int pri)); -int tsleep __P((void *chan, int pri, char *wmesg, int timo)); -void unsleep __P((struct proc *)); -void wakeup __P((struct socket *so, void *chan)); - -__dead void cpu_exit __P((struct proc *)) __dead2; -__dead void exit1 __P((struct proc *, int)) __dead2; -void fixjobc __P((struct proc *, struct pgrp *, int)); -int acct_process __P((struct proc *)); -int leavepgrp __P((struct proc *)); -int enterpgrp __P((struct proc *, pid_t, int)); -int trace_req __P((struct proc *)); -void cpu_wait __P((struct proc *)); -int cpu_coredump __P((struct proc *, struct vnode *, struct ucred *)); -int inferior __P((struct proc *)); -#endif /* KERNEL */ - -#endif /* !_SYS_PROC_H_ */ diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/protosw.h b/lib/drivers/oskittcp/include/freebsd/src/sys/sys/protosw.h deleted file mode 100644 index 8d5e161e5a3..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/protosw.h +++ /dev/null @@ -1,221 +0,0 @@ -/*- - * Copyright (c) 1982, 1986, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)protosw.h 8.1 (Berkeley) 6/2/93 - */ - -#ifndef _SYS_PROTOSW_H_ -#define _SYS_PROTOSW_H_ - -/* - * Protocol switch table. - * - * Each protocol has a handle initializing one of these structures, - * which is used for protocol-protocol and system-protocol communication. - * - * A protocol is called through the pr_init entry before any other. - * Thereafter it is called every 200ms through the pr_fasttimo entry and - * every 500ms through the pr_slowtimo for timer based actions. - * The system will call the pr_drain entry if it is low on space and - * this should throw away any non-critical data. - * - * Protocols pass data between themselves as chains of mbufs using - * the pr_input and pr_output hooks. Pr_input passes data up (towards - * UNIX) and pr_output passes it down (towards the imps); control - * information passes up and down on pr_ctlinput and pr_ctloutput. - * The protocol is responsible for the space occupied by any the - * arguments to these entries and must dispose it. - * - * The userreq routine interfaces protocols to the system and is - * described below. - */ -struct protosw { - short pr_type; /* socket type used for */ - struct domain *pr_domain; /* domain protocol a member of */ - short pr_protocol; /* protocol number */ - short pr_flags; /* see below */ -/* protocol-protocol hooks */ - void (*pr_input)(); /* input to protocol (from below) */ - int (*pr_output)(); /* output to protocol (from above) */ - void (*pr_ctlinput)(); /* control input (from below) */ - int (*pr_ctloutput)(); /* control output (from above) */ -/* user-protocol hook */ - int (*pr_usrreq)(); /* user request: see list below */ -/* utility hooks */ - void (*pr_init)(); /* initialization hook */ - void (*pr_fasttimo)(); /* fast timeout (200ms) */ - void (*pr_slowtimo)(); /* slow timeout (500ms) */ - void (*pr_drain)(); /* flush any excess space possible */ - int (*pr_sysctl)(); /* sysctl for protocol */ -}; - -#define PR_SLOWHZ 2 /* 2 slow timeouts per second */ -#define PR_FASTHZ 5 /* 5 fast timeouts per second */ - -/* - * Values for pr_flags. - * PR_ADDR requires PR_ATOMIC; - * PR_ADDR and PR_CONNREQUIRED are mutually exclusive. - * PR_IMPLOPCL means that the protocol allows sendto without prior connect, - * and the protocol understands the MSG_EOF flag. The first property is - * is only relevant if PR_CONNREQUIRED is set (otherwise sendto is allowed - * anyhow). - */ -#define PR_ATOMIC 0x01 /* exchange atomic messages only */ -#define PR_ADDR 0x02 /* addresses given with messages */ -#define PR_CONNREQUIRED 0x04 /* connection required by protocol */ -#define PR_WANTRCVD 0x08 /* want PRU_RCVD calls */ -#define PR_RIGHTS 0x10 /* passes capabilities */ -#define PR_IMPLOPCL 0x20 /* implied open/close */ - -/* - * The arguments to usrreq are: - * (*protosw[].pr_usrreq)(up, req, m, nam, opt); - * where up is a (struct socket *), req is one of these requests, - * m is a optional mbuf chain containing a message, - * nam is an optional mbuf chain containing an address, - * and opt is a pointer to a socketopt structure or nil. - * The protocol is responsible for disposal of the mbuf chain m, - * the caller is responsible for any space held by nam and opt. - * A non-zero return from usrreq gives an - * UNIX error number which should be passed to higher level software. - */ -#define PRU_ATTACH 0 /* attach protocol to up */ -#define PRU_DETACH 1 /* detach protocol from up */ -#define PRU_BIND 2 /* bind socket to address */ -#define PRU_LISTEN 3 /* listen for connection */ -#define PRU_CONNECT 4 /* establish connection to peer */ -#define PRU_ACCEPT 5 /* accept connection from peer */ -#define PRU_DISCONNECT 6 /* disconnect from peer */ -#define PRU_SHUTDOWN 7 /* won't send any more data */ -#define PRU_RCVD 8 /* have taken data; more room now */ -#define PRU_SEND 9 /* send this data */ -#define PRU_ABORT 10 /* abort (fast DISCONNECT, DETATCH) */ -#define PRU_CONTROL 11 /* control operations on protocol */ -#define PRU_SENSE 12 /* return status into m */ -#define PRU_RCVOOB 13 /* retrieve out of band data */ -#define PRU_SENDOOB 14 /* send out of band data */ -#define PRU_SOCKADDR 15 /* fetch socket's address */ -#define PRU_PEERADDR 16 /* fetch peer's address */ -#define PRU_CONNECT2 17 /* connect two sockets */ -/* begin for protocols internal use */ -#define PRU_FASTTIMO 18 /* 200ms timeout */ -#define PRU_SLOWTIMO 19 /* 500ms timeout */ -#define PRU_PROTORCV 20 /* receive from below */ -#define PRU_PROTOSEND 21 /* send to below */ -#define PRU_SEND_EOF 22 /* send and close */ -#define PRU_NREQ 22 - -#ifdef PRUREQUESTS -char *prurequests[] = { - "ATTACH", "DETACH", "BIND", "LISTEN", - "CONNECT", "ACCEPT", "DISCONNECT", "SHUTDOWN", - "RCVD", "SEND", "ABORT", "CONTROL", - "SENSE", "RCVOOB", "SENDOOB", "SOCKADDR", - "PEERADDR", "CONNECT2", "FASTTIMO", "SLOWTIMO", - "PROTORCV", "PROTOSEND", - "SEND_EOF", -}; -#endif - -/* - * The arguments to the ctlinput routine are - * (*protosw[].pr_ctlinput)(cmd, sa, arg); - * where cmd is one of the commands below, sa is a pointer to a sockaddr, - * and arg is an optional caddr_t argument used within a protocol family. - */ -#define PRC_IFDOWN 0 /* interface transition */ -#define PRC_ROUTEDEAD 1 /* select new route if possible ??? */ -#define PRC_QUENCH2 3 /* DEC congestion bit says slow down */ -#define PRC_QUENCH 4 /* some one said to slow down */ -#define PRC_MSGSIZE 5 /* message size forced drop */ -#define PRC_HOSTDEAD 6 /* host appears to be down */ -#define PRC_HOSTUNREACH 7 /* deprecated (use PRC_UNREACH_HOST) */ -#define PRC_UNREACH_NET 8 /* no route to network */ -#define PRC_UNREACH_HOST 9 /* no route to host */ -#define PRC_UNREACH_PROTOCOL 10 /* dst says bad protocol */ -#define PRC_UNREACH_PORT 11 /* bad port # */ -/* was PRC_UNREACH_NEEDFRAG 12 (use PRC_MSGSIZE) */ -#define PRC_UNREACH_SRCFAIL 13 /* source route failed */ -#define PRC_REDIRECT_NET 14 /* net routing redirect */ -#define PRC_REDIRECT_HOST 15 /* host routing redirect */ -#define PRC_REDIRECT_TOSNET 16 /* redirect for type of service & net */ -#define PRC_REDIRECT_TOSHOST 17 /* redirect for tos & host */ -#define PRC_TIMXCEED_INTRANS 18 /* packet lifetime expired in transit */ -#define PRC_TIMXCEED_REASS 19 /* lifetime expired on reass q */ -#define PRC_PARAMPROB 20 /* header incorrect */ - -#define PRC_NCMDS 21 - -#define PRC_IS_REDIRECT(cmd) \ - ((cmd) >= PRC_REDIRECT_NET && (cmd) <= PRC_REDIRECT_TOSHOST) - -#ifdef PRCREQUESTS -char *prcrequests[] = { - "IFDOWN", "ROUTEDEAD", "#2", "DEC-BIT-QUENCH2", - "QUENCH", "MSGSIZE", "HOSTDEAD", "#7", - "NET-UNREACH", "HOST-UNREACH", "PROTO-UNREACH", "PORT-UNREACH", - "#12", "SRCFAIL-UNREACH", "NET-REDIRECT", "HOST-REDIRECT", - "TOSNET-REDIRECT", "TOSHOST-REDIRECT", "TX-INTRANS", "TX-REASS", - "PARAMPROB" -}; -#endif - -/* - * The arguments to ctloutput are: - * (*protosw[].pr_ctloutput)(req, so, level, optname, optval); - * req is one of the actions listed below, so is a (struct socket *), - * level is an indication of which protocol layer the option is intended. - * optname is a protocol dependent socket option request, - * optval is a pointer to a mbuf-chain pointer, for value-return results. - * The protocol is responsible for disposal of the mbuf chain *optval - * if supplied, - * the caller is responsible for any space held by *optval, when returned. - * A non-zero return from usrreq gives an - * UNIX error number which should be passed to higher level software. - */ -#define PRCO_GETOPT 0 -#define PRCO_SETOPT 1 - -#define PRCO_NCMDS 2 - -#ifdef PRCOREQUESTS -char *prcorequests[] = { - "GETOPT", "SETOPT", -}; -#endif - -#ifdef KERNEL -extern struct protosw *pffindproto(), *pffindtype(); -#endif - -#endif diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/queue.h b/lib/drivers/oskittcp/include/freebsd/src/sys/sys/queue.h deleted file mode 100644 index aee0bc595da..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/queue.h +++ /dev/null @@ -1,393 +0,0 @@ -/* - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)queue.h 8.5 (Berkeley) 8/20/94 - */ - -#ifndef _SYS_QUEUE_H_ -#define _SYS_QUEUE_H_ - -/* - * This file defines five types of data structures: singly-linked lists, - * slingly-linked tail queues, lists, tail queues, and circular queues. - * - * A singly-linked list is headed by a single forward pointer. The elements - * are singly linked for minimum space and pointer manipulation overhead at - * the expense of O(n) removal for arbitrary elements. New elements can be - * added to the list after an existing element or at the head of the list. - * Elements being removed from the head of the list should use the explicit - * macro for this purpose for optimum efficiency. A singly-linked list may - * only be traversed in the forward direction. Singly-linked lists are ideal - * for applications with large datasets and few or no removals or for - * implementing a LIFO queue. - * - * A singly-linked tail queue is headed by a pair of pointers, one to the - * head of the list and the other to the tail of the list. The elements are - * singly linked for minimum space and pointer manipulation overhead at the - * expense of O(n) removal for arbitrary elements. New elements can be added - * to the list after an existing element, at the head of the list, or at the - * end of the list. Elements being removed from the head of the tail queue - * should use the explicit macro for this purpose for optimum efficiency. - * A singly-linked tail queue may only be traversed in the forward direction. - * Singly-linked tail queues are ideal for applications with large datasets - * and few or no removals or for implementing a FIFO queue. - * - * A list is headed by a single forward pointer (or an array of forward - * pointers for a hash table header). The elements are doubly linked - * so that an arbitrary element can be removed without a need to - * traverse the list. New elements can be added to the list before - * or after an existing element or at the head of the list. A list - * may only be traversed in the forward direction. - * - * A tail queue is headed by a pair of pointers, one to the head of the - * list and the other to the tail of the list. The elements are doubly - * linked so that an arbitrary element can be removed without a need to - * traverse the list. New elements can be added to the list before or - * after an existing element, at the head of the list, or at the end of - * the list. A tail queue may only be traversed in the forward direction. - * - * A circle queue is headed by a pair of pointers, one to the head of the - * list and the other to the tail of the list. The elements are doubly - * linked so that an arbitrary element can be removed without a need to - * traverse the list. New elements can be added to the list before or after - * an existing element, at the head of the list, or at the end of the list. - * A circle queue may be traversed in either direction, but has a more - * complex end of list detection. - * - * For details on the use of these macros, see the queue(3) manual page. - */ - -#undef SLIST_HEAD -#undef SLIST_ENTRY -#undef SLIST_INIT - -/* - * Singly-linked List definitions. - */ -#define SLIST_HEAD(name, type) \ -struct name { \ - struct type *slh_first; /* first element */ \ -} - -#if 0 -#define SLIST_ENTRY(type) \ -struct { \ - struct type *sle_next; /* next element */ \ -} -#endif - -/* - * Singly-linked List functions. - */ -#define SLIST_INIT(head) { \ - (head)->slh_first = NULL; \ -} - -#define SLIST_INSERT_AFTER(slistelm, elm, field) { \ - (elm)->field.sle_next = (slistelm)->field.sle_next; \ - (slistelm)->field.sle_next = (elm); \ -} - -#define SLIST_INSERT_HEAD(head, elm, field) { \ - (elm)->field.sle_next = (head)->slh_first; \ - (head)->slh_first = (elm); \ -} - -#define SLIST_REMOVE_HEAD(head, field) { \ - (head)->slh_first = (head)->slh_first->field.sle_next; \ -} - -#define SLIST_REMOVE(head, elm, type, field) { \ - if ((head)->slh_first == (elm)) { \ - SLIST_REMOVE_HEAD((head), field); \ - } \ - else { \ - struct type *curelm = (head)->slh_first; \ - while( curelm->field.sle_next != (elm) ) \ - curelm = curelm->field.sle_next; \ - curelm->field.sle_next = \ - curelm->field.sle_next->field.sle_next; \ - } \ -} - -/* - * Singly-linked Tail queue definitions. - */ -#define STAILQ_HEAD(name, type) \ -struct name { \ - struct type *stqh_first;/* first element */ \ - struct type **stqh_last;/* addr of last next element */ \ -} - -#define STAILQ_ENTRY(type) \ -struct { \ - struct type *stqe_next; /* next element */ \ -} - -/* - * Singly-linked Tail queue functions. - */ -#define STAILQ_INIT(head) { \ - (head)->stqh_first = NULL; \ - (head)->stqh_last = &(head)->stqh_first; \ -} - -#define STAILQ_INSERT_HEAD(head, elm, field) { \ - if (((elm)->field.stqe_next = (head)->stqh_first) == NULL) \ - (head)->stqh_last = &(elm)->field.stqe_next; \ - (head)->stqh_first = (elm); \ -} - -#define STAILQ_INSERT_TAIL(head, elm, field) { \ - (elm)->field.stqe_next = NULL; \ - *(head)->stqh_last = (elm); \ - (head)->stqh_last = &(elm)->field.stqe_next; \ -} - -#define STAILQ_INSERT_AFTER(head, tqelm, elm, field) { \ - if (((elm)->field.stqe_next = (tqelm)->field.stqe_next) == NULL)\ - (head)->stqh_last = &(elm)->field.stqe_next; \ - (tqelm)->field.stqe_next = (elm); \ -} - -#define STAILQ_REMOVE_HEAD(head, field) { \ - if (((head)->stqh_first = \ - (head)->stqh_first->field.stqe_next) == NULL) \ - (head)->stqh_last = &(head)->stqh_first; \ -} - -#define STAILQ_REMOVE(head, elm, type, field) { \ - if ((head)->stqh_first == (elm)) { \ - STAILQ_REMOVE_HEAD(head, field); \ - } \ - else { \ - struct type *curelm = (head)->stqh_first; \ - while( curelm->field.stqe_next != (elm) ) \ - curelm = curelm->field.stqe_next; \ - if((curelm->field.stqe_next = \ - curelm->field.stqe_next->field.stqe_next) == NULL) \ - (head)->stqh_last = &(curelm)->field.stqe_next; \ - } \ -} - -/* - * List definitions. - */ -#define LIST_HEAD(name, type) \ -struct name { \ - struct type *lh_first; /* first element */ \ -} - -#define LIST_ENTRY(type) \ -struct { \ - struct type *le_next; /* next element */ \ - struct type **le_prev; /* address of previous next element */ \ -} - -/* - * List functions. - */ -#define LIST_INIT(head) { \ - (head)->lh_first = NULL; \ -} - -#define LIST_INSERT_AFTER(listelm, elm, field) { \ - if (((elm)->field.le_next = (listelm)->field.le_next) != NULL) \ - (listelm)->field.le_next->field.le_prev = \ - &(elm)->field.le_next; \ - (listelm)->field.le_next = (elm); \ - (elm)->field.le_prev = &(listelm)->field.le_next; \ -} - -#define LIST_INSERT_BEFORE(listelm, elm, field) { \ - (elm)->field.le_prev = (listelm)->field.le_prev; \ - (elm)->field.le_next = (listelm); \ - *(listelm)->field.le_prev = (elm); \ - (listelm)->field.le_prev = &(elm)->field.le_next; \ -} - -#define LIST_INSERT_HEAD(head, elm, field) { \ - if (((elm)->field.le_next = (head)->lh_first) != NULL) \ - (head)->lh_first->field.le_prev = &(elm)->field.le_next;\ - (head)->lh_first = (elm); \ - (elm)->field.le_prev = &(head)->lh_first; \ -} - -#define LIST_REMOVE(elm, field) { \ - if ((elm)->field.le_next != NULL) \ - (elm)->field.le_next->field.le_prev = \ - (elm)->field.le_prev; \ - *(elm)->field.le_prev = (elm)->field.le_next; \ -} - -/* - * Tail queue definitions. - */ -#define TAILQ_HEAD(name, type) \ -struct name { \ - struct type *tqh_first; /* first element */ \ - struct type **tqh_last; /* addr of last next element */ \ -} - -#define TAILQ_ENTRY(type) \ -struct { \ - struct type *tqe_next; /* next element */ \ - struct type **tqe_prev; /* address of previous next element */ \ -} - -/* - * Tail queue functions. - */ -#define TAILQ_INIT(head) { \ - (head)->tqh_first = NULL; \ - (head)->tqh_last = &(head)->tqh_first; \ -} - -#define TAILQ_INSERT_HEAD(head, elm, field) { \ - if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \ - (head)->tqh_first->field.tqe_prev = \ - &(elm)->field.tqe_next; \ - else \ - (head)->tqh_last = &(elm)->field.tqe_next; \ - (head)->tqh_first = (elm); \ - (elm)->field.tqe_prev = &(head)->tqh_first; \ -} - -#define TAILQ_INSERT_TAIL(head, elm, field) { \ - (elm)->field.tqe_next = NULL; \ - (elm)->field.tqe_prev = (head)->tqh_last; \ - *(head)->tqh_last = (elm); \ - (head)->tqh_last = &(elm)->field.tqe_next; \ -} - -#define TAILQ_INSERT_AFTER(head, listelm, elm, field) { \ - if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\ - (elm)->field.tqe_next->field.tqe_prev = \ - &(elm)->field.tqe_next; \ - else \ - (head)->tqh_last = &(elm)->field.tqe_next; \ - (listelm)->field.tqe_next = (elm); \ - (elm)->field.tqe_prev = &(listelm)->field.tqe_next; \ -} - -#define TAILQ_INSERT_BEFORE(listelm, elm, field) { \ - (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \ - (elm)->field.tqe_next = (listelm); \ - *(listelm)->field.tqe_prev = (elm); \ - (listelm)->field.tqe_prev = &(elm)->field.tqe_next; \ -} - -#define TAILQ_REMOVE(head, elm, field) { \ - if (((elm)->field.tqe_next) != NULL) \ - (elm)->field.tqe_next->field.tqe_prev = \ - (elm)->field.tqe_prev; \ - else \ - (head)->tqh_last = (elm)->field.tqe_prev; \ - *(elm)->field.tqe_prev = (elm)->field.tqe_next; \ -} - -/* - * Circular queue definitions. - */ -#define CIRCLEQ_HEAD(name, type) \ -struct name { \ - struct type *cqh_first; /* first element */ \ - struct type *cqh_last; /* last element */ \ -} - -#define CIRCLEQ_ENTRY(type) \ -struct { \ - struct type *cqe_next; /* next element */ \ - struct type *cqe_prev; /* previous element */ \ -} - -/* - * Circular queue functions. - */ -#define CIRCLEQ_INIT(head) { \ - (head)->cqh_first = (void *)(head); \ - (head)->cqh_last = (void *)(head); \ -} - -#define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) { \ - (elm)->field.cqe_next = (listelm)->field.cqe_next; \ - (elm)->field.cqe_prev = (listelm); \ - if ((listelm)->field.cqe_next == (void *)(head)) \ - (head)->cqh_last = (elm); \ - else \ - (listelm)->field.cqe_next->field.cqe_prev = (elm); \ - (listelm)->field.cqe_next = (elm); \ -} - -#define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) { \ - (elm)->field.cqe_next = (listelm); \ - (elm)->field.cqe_prev = (listelm)->field.cqe_prev; \ - if ((listelm)->field.cqe_prev == (void *)(head)) \ - (head)->cqh_first = (elm); \ - else \ - (listelm)->field.cqe_prev->field.cqe_next = (elm); \ - (listelm)->field.cqe_prev = (elm); \ -} - -#define CIRCLEQ_INSERT_HEAD(head, elm, field) { \ - (elm)->field.cqe_next = (head)->cqh_first; \ - (elm)->field.cqe_prev = (void *)(head); \ - if ((head)->cqh_last == (void *)(head)) \ - (head)->cqh_last = (elm); \ - else \ - (head)->cqh_first->field.cqe_prev = (elm); \ - (head)->cqh_first = (elm); \ -} - -#define CIRCLEQ_INSERT_TAIL(head, elm, field) { \ - (elm)->field.cqe_next = (void *)(head); \ - (elm)->field.cqe_prev = (head)->cqh_last; \ - if ((head)->cqh_first == (void *)(head)) \ - (head)->cqh_first = (elm); \ - else \ - (head)->cqh_last->field.cqe_next = (elm); \ - (head)->cqh_last = (elm); \ -} - -#define CIRCLEQ_REMOVE(head, elm, field) { \ - if ((elm)->field.cqe_next == (void *)(head)) \ - (head)->cqh_last = (elm)->field.cqe_prev; \ - else \ - (elm)->field.cqe_next->field.cqe_prev = \ - (elm)->field.cqe_prev; \ - if ((elm)->field.cqe_prev == (void *)(head)) \ - (head)->cqh_first = (elm)->field.cqe_next; \ - else \ - (elm)->field.cqe_prev->field.cqe_next = \ - (elm)->field.cqe_next; \ -} -#endif /* !_SYS_QUEUE_H_ */ diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/resource.h b/lib/drivers/oskittcp/include/freebsd/src/sys/sys/resource.h deleted file mode 100644 index cff763c56e5..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/resource.h +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)resource.h 8.2 (Berkeley) 1/4/94 - */ - -#ifndef _SYS_RESOURCE_H_ -#define _SYS_RESOURCE_H_ - -/* - * Process priority specifications to get/setpriority. - */ -#define PRIO_MIN -20 -#define PRIO_MAX 20 - -#define PRIO_PROCESS 0 -#define PRIO_PGRP 1 -#define PRIO_USER 2 - -/* - * Resource utilization information. - */ - -#define RUSAGE_SELF 0 -#define RUSAGE_CHILDREN -1 - -struct rusage { - struct timeval ru_utime; /* user time used */ - struct timeval ru_stime; /* system time used */ - long ru_maxrss; /* max resident set size */ -#define ru_first ru_ixrss - long ru_ixrss; /* integral shared memory size */ - long ru_idrss; /* integral unshared data " */ - long ru_isrss; /* integral unshared stack " */ - long ru_minflt; /* page reclaims */ - long ru_majflt; /* page faults */ - long ru_nswap; /* swaps */ - long ru_inblock; /* block input operations */ - long ru_oublock; /* block output operations */ - long ru_msgsnd; /* messages sent */ - long ru_msgrcv; /* messages received */ - long ru_nsignals; /* signals received */ - long ru_nvcsw; /* voluntary context switches */ - long ru_nivcsw; /* involuntary " */ -#define ru_last ru_nivcsw -}; - -/* - * Resource limits - */ -#define RLIMIT_CPU 0 /* cpu time in milliseconds */ -#define RLIMIT_FSIZE 1 /* maximum file size */ -#define RLIMIT_DATA 2 /* data size */ -#define RLIMIT_STACK 3 /* stack size */ -#define RLIMIT_CORE 4 /* core file size */ -#define RLIMIT_RSS 5 /* resident set size */ -#define RLIMIT_MEMLOCK 6 /* locked-in-memory address space */ -#define RLIMIT_NPROC 7 /* number of processes */ -#define RLIMIT_NOFILE 8 /* number of open files */ - -#define RLIM_NLIMITS 9 /* number of resource limits */ - -#include /* XXX for quad_t */ - -#define RLIM_INFINITY (((u_quad_t)1 << 63) - 1) - -struct orlimit { - long rlim_cur; /* current (soft) limit */ - long rlim_max; /* maximum value for rlim_cur */ -}; - -struct rlimit { - quad_t rlim_cur; /* current (soft) limit */ - quad_t rlim_max; /* maximum value for rlim_cur */ -}; - -/* Load average structure. */ -struct loadavg { - fixpt_t ldavg[3]; - long fscale; -}; - -#ifdef KERNEL -extern struct loadavg averunnable; - -#else -#include - -__BEGIN_DECLS -int getpriority __P((int, int)); -int getrlimit __P((int, struct rlimit *)); -int getrusage __P((int, struct rusage *)); -int setpriority __P((int, int, int)); -int setrlimit __P((int, const struct rlimit *)); -__END_DECLS - -#endif /* KERNEL */ -#endif /* !_SYS_RESOURCE_H_ */ diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/resourcevar.h b/lib/drivers/oskittcp/include/freebsd/src/sys/sys/resourcevar.h deleted file mode 100644 index 1dd0dc55418..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/resourcevar.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)resourcevar.h 8.3 (Berkeley) 2/22/94 - */ - -#ifndef _SYS_RESOURCEVAR_H_ -#define _SYS_RESOURCEVAR_H_ - -/* - * Kernel per-process accounting / statistics - * (not necessarily resident except when running). - */ -struct pstats { -#define pstat_startzero p_ru - struct rusage p_ru; /* stats for this proc */ - struct rusage p_cru; /* sum of stats for reaped children */ -#define pstat_endzero pstat_startcopy - -#define pstat_startcopy p_timer - struct itimerval p_timer[3]; /* virtual-time timers */ - - struct uprof { /* profile arguments */ - caddr_t pr_base; /* buffer base */ - u_long pr_size; /* buffer size */ - u_long pr_off; /* pc offset */ - u_long pr_scale; /* pc scaling */ - u_long pr_addr; /* temp storage for addr until AST */ - u_long pr_ticks; /* temp storage for ticks until AST */ - } p_prof; -#define pstat_endcopy p_start - struct timeval p_start; /* starting time */ -}; - -/* - * Kernel shareable process resource limits. Because this structure - * is moderately large but changes infrequently, it is normally - * shared copy-on-write after forks. If a group of processes - * ("threads") share modifications, the PL_SHAREMOD flag is set, - * and a copy must be made for the child of a new fork that isn't - * sharing modifications to the limits. - */ -struct plimit { - struct rlimit pl_rlimit[RLIM_NLIMITS]; -#define PL_SHAREMOD 0x01 /* modifications are shared */ - int p_lflags; - int p_refcnt; /* number of references */ -}; - -/* add user profiling from AST */ -#define ADDUPROF(p) \ - addupc_task(p, \ - (p)->p_stats->p_prof.pr_addr, (p)->p_stats->p_prof.pr_ticks) - -#ifdef KERNEL -int addupc __P((int pc, struct uprof *up, int ticks)); -void addupc_intr __P((struct proc *p, u_long pc, u_int ticks)); -void addupc_task __P((struct proc *p, u_long pc, u_int ticks)); -void calcru __P((struct proc *p, struct timeval *up, struct timeval *sp, - struct timeval *ip)); -int fuswintr __P((void *base)); -struct plimit - *limcopy __P((struct plimit *lim)); -void ruadd __P((struct rusage *ru, struct rusage *ru2)); -int suswintr __P((void *base, int word)); -#endif - -#endif /* !_SYS_RESOURCEVAR_H_ */ diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/rtprio.h b/lib/drivers/oskittcp/include/freebsd/src/sys/sys/rtprio.h deleted file mode 100644 index 9719930d324..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/rtprio.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 1994, Henrik Vestergaard Draboel - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by (name). - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -#ifndef _SYS_RTPRIO_H_ -#define _SYS_RTPRIO_H_ - -/* - * Process realtime-priority specifications to rtprio. - */ - -/* priority types */ -#define RTP_PRIO_REALTIME 0 -#define RTP_PRIO_NORMAL 1 -#define RTP_PRIO_IDLE 2 - -/* priority range */ -#define RTP_PRIO_MIN 0 /* Highest priority */ -#define RTP_PRIO_MAX 31 /* Lowest priority */ - -/* - * rtprio() syscall functions - */ -#define RTP_LOOKUP 0 -#define RTP_SET 1 - -#ifndef LOCORE -struct rtprio { - u_short type; - u_short prio; -}; -#endif - -#ifndef KERNEL -#include - -__BEGIN_DECLS -int rtprio __P((int, pid_t, struct rtprio *)); -__END_DECLS -#endif /* !KERNEL */ -#endif /* !_SYS_RTPRIO_H_ */ diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/select.h b/lib/drivers/oskittcp/include/freebsd/src/sys/sys/select.h deleted file mode 100644 index 128c5e72cdd..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/select.h +++ /dev/null @@ -1,58 +0,0 @@ -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)select.h 8.2 (Berkeley) 1/4/94 - */ - -#ifndef _SYS_SELECT_H_ -#define _SYS_SELECT_H_ - -#if defined(OSKIT) -struct listener_mgr; -#endif - -/* Included to suppress warnings about struct socket being declared in the - * parameter list. Selinfo reoredered with struct socket. */ - -struct selinfo; -struct socket; - -#include - -#ifdef KERNEL -struct proc; - -void selrecord __P((struct proc *selector, struct selinfo *)); -void selwakeup __P((struct socket *so, struct selinfo *)); -#endif - -#endif /* !_SYS_SELECT_H_ */ diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/signal.h b/lib/drivers/oskittcp/include/freebsd/src/sys/sys/signal.h deleted file mode 100644 index ad025895730..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/signal.h +++ /dev/null @@ -1,194 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1989, 1991, 1993 - * The Regents of the University of California. All rights reserved. - * (c) UNIX System Laboratories, Inc. - * All or some portions of this file are derived from material licensed - * to the University of California by American Telephone and Telegraph - * Co. or Unix System Laboratories, Inc. and are reproduced herein with - * the permission of UNIX System Laboratories, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)signal.h 8.2 (Berkeley) 1/21/94 - */ - -#ifndef _SYS_SIGNAL_H_ -#define _SYS_SIGNAL_H_ - -#define NSIG 32 /* counting 0; could be 33 (mask is 1-32) */ - -#ifndef _ANSI_SOURCE -#include /* sigcontext; codes for SIGILL, SIGFPE */ -#endif - -#define SIGHUP 1 /* hangup */ -#define SIGINT 2 /* interrupt */ -#define SIGQUIT 3 /* quit */ -#define SIGILL 4 /* illegal instruction (not reset when caught) */ -#ifndef _POSIX_SOURCE -#define SIGTRAP 5 /* trace trap (not reset when caught) */ -#endif -#define SIGABRT 6 /* abort() */ -#ifndef _POSIX_SOURCE -#define SIGIOT SIGABRT /* compatibility */ -#define SIGEMT 7 /* EMT instruction */ -#endif -#define SIGFPE 8 /* floating point exception */ -#define SIGKILL 9 /* kill (cannot be caught or ignored) */ -#ifndef _POSIX_SOURCE -#define SIGBUS 10 /* bus error */ -#endif -#define SIGSEGV 11 /* segmentation violation */ -#ifndef _POSIX_SOURCE -#define SIGSYS 12 /* bad argument to system call */ -#endif -#define SIGPIPE 13 /* write on a pipe with no one to read it */ -#define SIGALRM 14 /* alarm clock */ -#define SIGTERM 15 /* software termination signal from kill */ -#ifndef _POSIX_SOURCE -#define SIGURG 16 /* urgent condition on IO channel */ -#endif -#define SIGSTOP 17 /* sendable stop signal not from tty */ -#define SIGTSTP 18 /* stop signal from tty */ -#define SIGCONT 19 /* continue a stopped process */ -#define SIGCHLD 20 /* to parent on child stop or exit */ -#define SIGTTIN 21 /* to readers pgrp upon background tty read */ -#define SIGTTOU 22 /* like TTIN for output if (tp->t_local<OSTOP) */ -#ifndef _POSIX_SOURCE -#define SIGIO 23 /* input/output possible signal */ -#define SIGXCPU 24 /* exceeded CPU time limit */ -#define SIGXFSZ 25 /* exceeded file size limit */ -#define SIGVTALRM 26 /* virtual time alarm */ -#define SIGPROF 27 /* profiling time alarm */ -#define SIGWINCH 28 /* window size changes */ -#define SIGINFO 29 /* information request */ -#endif -#define SIGUSR1 30 /* user defined signal 1 */ -#define SIGUSR2 31 /* user defined signal 2 */ - -#if defined(_ANSI_SOURCE) || defined(__cplusplus) -/* - * Language spec sez we must list exactly one parameter, even though we - * actually supply three. Ugh! - */ -#define SIG_DFL (void (*)(int))0 -#define SIG_IGN (void (*)(int))1 -#define SIG_ERR (void (*)(int))-1 -#else -#define SIG_DFL (void (*)())0 -#define SIG_IGN (void (*)())1 -#define SIG_ERR (void (*)())-1 -#endif - -#ifndef _ANSI_SOURCE -typedef unsigned int sigset_t; - -/* - * Signal vector "template" used in sigaction call. - */ -struct sigaction { - void (*sa_handler)(); /* signal handler */ - sigset_t sa_mask; /* signal mask to apply */ - int sa_flags; /* see signal options below */ -}; -#ifndef _POSIX_SOURCE -#define SA_ONSTACK 0x0001 /* take signal on signal stack */ -#define SA_RESTART 0x0002 /* restart system on signal return */ -#define SA_DISABLE 0x0004 /* disable taking signals on alternate stack */ -#ifdef COMPAT_SUNOS -#define SA_USERTRAMP 0x0100 /* do not bounce off kernel's sigtramp */ -#endif -#endif -#define SA_NOCLDSTOP 0x0008 /* do not generate SIGCHLD on child stop */ - -/* - * Flags for sigprocmask: - */ -#define SIG_BLOCK 1 /* block specified signal set */ -#define SIG_UNBLOCK 2 /* unblock specified signal set */ -#define SIG_SETMASK 3 /* set specified signal set */ - -#ifndef _POSIX_SOURCE -#ifndef KERNEL -#include -#endif -typedef void (*sig_t) __P((int)); /* type of signal function */ - -/* - * Structure used in sigaltstack call. - */ -struct sigaltstack { - char *ss_sp; /* signal stack base */ - int ss_size; /* signal stack length */ - int ss_flags; /* SA_DISABLE and/or SA_ONSTACK */ -}; -#define MINSIGSTKSZ 8192 /* minimum allowable stack */ -#define SIGSTKSZ (MINSIGSTKSZ + 32768) /* recommended stack size */ - -/* - * 4.3 compatibility: - * Signal vector "template" used in sigvec call. - */ -struct sigvec { - void (*sv_handler)(); /* signal handler */ - int sv_mask; /* signal mask to apply */ - int sv_flags; /* see signal options below */ -}; - -#define SV_ONSTACK SA_ONSTACK -#define SV_INTERRUPT SA_RESTART /* same bit, opposite sense */ -#define sv_onstack sv_flags /* isn't compatibility wonderful! */ - -/* - * Structure used in sigstack call. - */ -struct sigstack { - char *ss_sp; /* signal stack pointer */ - int ss_onstack; /* current status */ -}; - -/* - * Macro for converting signal number to a mask suitable for - * sigblock(). - */ -#define sigmask(m) (1 << ((m)-1)) - -#define BADSIG SIG_ERR - -#endif /* !_POSIX_SOURCE */ -#endif /* !_ANSI_SOURCE */ - -/* - * For historical reasons; programs expect signal's return value to be - * defined by . - */ -__BEGIN_DECLS -void (*signal __P((int, void (*) __P((int))))) __P((int)); -__END_DECLS -#endif /* !_SYS_SIGNAL_H_ */ diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/signalvar.h b/lib/drivers/oskittcp/include/freebsd/src/sys/sys/signalvar.h deleted file mode 100644 index 2c5394d96f4..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/signalvar.h +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)signalvar.h 8.3 (Berkeley) 1/4/94 - */ - -#ifndef _SYS_SIGNALVAR_H_ /* tmp for user.h */ -#define _SYS_SIGNALVAR_H_ - -/* - * Kernel signal definitions and data structures, - * not exported to user programs. - */ - -/* - * Process signal actions and state, needed only within the process - * (not necessarily resident). - */ -struct sigacts { - sig_t ps_sigact[NSIG]; /* disposition of signals */ - sigset_t ps_catchmask[NSIG]; /* signals to be blocked */ - sigset_t ps_sigonstack; /* signals to take on sigstack */ - sigset_t ps_sigintr; /* signals that interrupt syscalls */ - sigset_t ps_oldmask; /* saved mask from before sigpause */ - int ps_flags; /* signal flags, below */ - struct sigaltstack ps_sigstk; /* sp & on stack state variable */ - int ps_sig; /* for core dump/debugger XXX */ - int ps_code; /* for core dump/debugger XXX */ - int ps_addr; /* for core dump/debugger XXX */ - sigset_t ps_usertramp; /* SunOS compat; libc sigtramp XXX */ -}; - -/* signal flags */ -#define SAS_OLDMASK 0x01 /* need to restore mask before pause */ -#define SAS_ALTSTACK 0x02 /* have alternate signal stack */ - -/* additional signal action values, used only temporarily/internally */ -#define SIG_CATCH (void (*)())2 -#define SIG_HOLD (void (*)())3 - -/* - * get signal action for process and signal; currently only for current process - */ -#define SIGACTION(p, sig) (p->p_sigacts->ps_sigact[(sig)]) - -/* - * Determine signal that should be delivered to process p, the current - * process, 0 if none. If there is a pending stop signal with default - * action, the process stops in issig(). - */ -#define CURSIG(p) \ - (((p)->p_siglist == 0 || \ - (((p)->p_flag & P_TRACED) == 0 && \ - ((p)->p_siglist & ~(p)->p_sigmask) == 0)) ? \ - 0 : issignal(p)) - -/* - * Clear a pending signal from a process. - */ -#define CLRSIG(p, sig) { (p)->p_siglist &= ~sigmask(sig); } - -/* - * Signal properties and actions. - * The array below categorizes the signals and their default actions - * according to the following properties: - */ -#define SA_KILL 0x01 /* terminates process by default */ -#define SA_CORE 0x02 /* ditto and coredumps */ -#define SA_STOP 0x04 /* suspend process */ -#define SA_TTYSTOP 0x08 /* ditto, from tty */ -#define SA_IGNORE 0x10 /* ignore by default */ -#define SA_CONT 0x20 /* continue if suspended */ -#define SA_CANTMASK 0x40 /* non-maskable, catchable */ - -#ifdef SIGPROP -int sigprop[NSIG + 1] = { - 0, /* unused */ - SA_KILL, /* SIGHUP */ - SA_KILL, /* SIGINT */ - SA_KILL|SA_CORE, /* SIGQUIT */ - SA_KILL|SA_CORE, /* SIGILL */ - SA_KILL|SA_CORE, /* SIGTRAP */ - SA_KILL|SA_CORE, /* SIGABRT */ - SA_KILL|SA_CORE, /* SIGEMT */ - SA_KILL|SA_CORE, /* SIGFPE */ - SA_KILL, /* SIGKILL */ - SA_KILL|SA_CORE, /* SIGBUS */ - SA_KILL|SA_CORE, /* SIGSEGV */ - SA_KILL|SA_CORE, /* SIGSYS */ - SA_KILL, /* SIGPIPE */ - SA_KILL, /* SIGALRM */ - SA_KILL, /* SIGTERM */ - SA_IGNORE, /* SIGURG */ - SA_STOP, /* SIGSTOP */ - SA_STOP|SA_TTYSTOP, /* SIGTSTP */ - SA_IGNORE|SA_CONT, /* SIGCONT */ - SA_IGNORE, /* SIGCHLD */ - SA_STOP|SA_TTYSTOP, /* SIGTTIN */ - SA_STOP|SA_TTYSTOP, /* SIGTTOU */ - SA_IGNORE, /* SIGIO */ - SA_KILL, /* SIGXCPU */ - SA_KILL, /* SIGXFSZ */ - SA_KILL, /* SIGVTALRM */ - SA_KILL, /* SIGPROF */ - SA_IGNORE, /* SIGWINCH */ - SA_IGNORE, /* SIGINFO */ - SA_KILL, /* SIGUSR1 */ - SA_KILL, /* SIGUSR2 */ -}; - -#define contsigmask (sigmask(SIGCONT)) -#define stopsigmask (sigmask(SIGSTOP) | sigmask(SIGTSTP) | \ - sigmask(SIGTTIN) | sigmask(SIGTTOU)) - -#endif /* SIGPROP */ - -#define sigcantmask (sigmask(SIGKILL) | sigmask(SIGSTOP)) - -#ifdef KERNEL -/* - * Machine-independent functions: - */ -int coredump __P((struct proc *p)); -void execsigs __P((struct proc *p)); -void gsignal __P((int pgid, int sig)); -int issig __P((struct proc *p)); -int issignal __P((struct proc *p)); -void killproc __P((struct proc *, char *)); -void pgsignal __P((struct pgrp *pgrp, int sig, int checkctty)); -void postsig __P((int sig)); -void psignal __P((struct proc *p, int sig)); -void sigexit __P((struct proc *, int)); -void siginit __P((struct proc *p)); -void trapsignal __P((struct proc *p, int sig, unsigned code)); - -/* - * Machine-dependent functions: - */ -void sendsig __P((sig_t action, int sig, int returnmask, unsigned code)); -#endif /* KERNEL */ -#endif /* !_SYS_SIGNALVAR_H_ */ diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/socket.h b/lib/drivers/oskittcp/include/freebsd/src/sys/sys/socket.h deleted file mode 100644 index f350db3541e..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/socket.h +++ /dev/null @@ -1,377 +0,0 @@ -/* - * Copyright (c) 1982, 1985, 1986, 1988, 1993, 1994 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)socket.h 8.4 (Berkeley) 2/21/94 - */ - -#ifndef _OSK_SYS_SOCKET_H_ -#define _OSK_SYS_SOCKET_H_ - -/* - * Definitions related to sockets: types, address families, options. - */ - -/* - * Types - */ -#define SOCK_STREAM 1 /* stream socket */ -#define SOCK_DGRAM 2 /* datagram socket */ -#define SOCK_RAW 3 /* raw-protocol interface */ -#define SOCK_RDM 4 /* reliably-delivered message */ -#define SOCK_SEQPACKET 5 /* sequenced packet stream */ - -/* - * Option flags per-socket. - */ -#define SO_DEBUG 0x0001 /* turn on debugging info recording */ -#define SO_ACCEPTCONN 0x0002 /* socket has had listen() */ -#define SO_REUSEADDR 0x0004 /* allow local address reuse */ -#define SO_KEEPALIVE 0x0008 /* keep connections alive */ -#define SO_DONTROUTE 0x0010 /* just use interface addresses */ -#define SO_BROADCAST 0x0020 /* permit sending of broadcast msgs */ -#define SO_USELOOPBACK 0x0040 /* bypass hardware when possible */ -#define SO_LINGER 0x0080 /* linger on close if data present */ -#define SO_OOBINLINE 0x0100 /* leave received OOB data in line */ -#define SO_REUSEPORT 0x0200 /* allow local address & port reuse */ - -/* - * Additional options, not kept in so_options. - */ -#define SO_SNDBUF 0x1001 /* send buffer size */ -#define SO_RCVBUF 0x1002 /* receive buffer size */ -#define SO_SNDLOWAT 0x1003 /* send low-water mark */ -#define SO_RCVLOWAT 0x1004 /* receive low-water mark */ -#define SO_SNDTIMEO 0x1005 /* send timeout */ -#define SO_RCVTIMEO 0x1006 /* receive timeout */ -#define SO_ERROR 0x1007 /* get error status and clear */ -#define SO_TYPE 0x1008 /* get socket type */ - -/* - * Structure used for manipulating linger option. - */ -#ifndef _WINSOCKAPI_ -struct linger { - int l_onoff; /* option on/off */ - int l_linger; /* linger time */ -}; -#endif//_WINSOCKAPI_ - -/* - * Level number for (get/set)sockopt() to apply to socket itself. - */ -#define SOL_SOCKET 0xffff /* options for socket level */ - -/* - * Address families. - */ -#define AF_UNSPEC 0 /* unspecified */ -#define AF_LOCAL 1 /* local to host (pipes, portals) */ -#ifndef _WINSOCKAPI_ -#define AF_UNIX AF_LOCAL /* backward compatibility */ -#endif//_WINSOCKAPI_ -#define AF_INET 2 /* internetwork: UDP, TCP, etc. */ -#define AF_IMPLINK 3 /* arpanet imp addresses */ -#define AF_PUP 4 /* pup protocols: e.g. BSP */ -#define AF_CHAOS 5 /* mit CHAOS protocols */ -#define AF_NS 6 /* XEROX NS protocols */ -#define AF_ISO 7 /* ISO protocols */ -#define AF_OSI AF_ISO -#define AF_ECMA 8 /* european computer manufacturers */ -#define AF_DATAKIT 9 /* datakit protocols */ -#define AF_CCITT 10 /* CCITT protocols, X.25 etc */ -#define AF_SNA 11 /* IBM SNA */ -#define AF_DECnet 12 /* DECnet */ -#define AF_DLI 13 /* DEC Direct data link interface */ -#define AF_LAT 14 /* LAT */ -#define AF_HYLINK 15 /* NSC Hyperchannel */ -#define AF_APPLETALK 16 /* Apple Talk */ -#define AF_ROUTE 17 /* Internal Routing Protocol */ -#define AF_LINK 18 /* Link layer interface */ -#define pseudo_AF_XTP 19 /* eXpress Transfer Protocol (no AF) */ -#define AF_COIP 20 /* connection-oriented IP, aka ST II */ -#define AF_CNT 21 /* Computer Network Technology */ -#define pseudo_AF_RTIP 22 /* Help Identify RTIP packets */ -#ifndef _WINSOCKAPI_ -#define AF_IPX 23 /* Novell Internet Protocol */ -#endif//_WINSOCKAPI_ -#define AF_SIP 24 /* Simple Internet Protocol */ -#define pseudo_AF_PIP 25 /* Help Identify PIP packets */ -#define AF_ISDN 26 /* Integrated Services Digital Network*/ -#define AF_E164 AF_ISDN /* CCITT E.164 recommendation */ -#define pseudo_AF_KEY 27 /* Internal key-management function */ -#ifndef _WINSOCKAPI_ -#define AF_INET6 28 /* IPv6 */ - -#define AF_MAX 29 -#endif//_WINSOCKAPI_ - - -/* - * Structure used by kernel to store most - * addresses. - */ -#ifdef _WINSOCKAPI_ -#define sockaddr bsd_sockaddr -#define sockproto bsd_sockproto -#endif//_WINSOCKAPI_ - -struct sockaddr { - u_char sa_len; /* total length */ - u_char sa_family; /* address family */ - char sa_data[14]; /* actually longer; address value */ -}; - -/* - * Structure used by kernel to pass protocol - * information in raw sockets. - */ -struct sockproto { - u_short sp_family; /* address family */ - u_short sp_protocol; /* protocol */ -}; - -/* - * Protocol families, same as address families for now. - */ -#define PF_UNSPEC AF_UNSPEC -#define PF_LOCAL AF_LOCAL -#ifndef _WINSOCKAPI_ -#define PF_UNIX PF_LOCAL /* backward compatibility */ -#endif//_WINSOCKAPI_ -#define PF_INET AF_INET -#define PF_IMPLINK AF_IMPLINK -#define PF_PUP AF_PUP -#define PF_CHAOS AF_CHAOS -#define PF_NS AF_NS -#define PF_ISO AF_ISO -#ifndef _WINSOCKAPI_ -#define PF_OSI AF_ISO -#endif//_WINSOCKAPI_ -#define PF_ECMA AF_ECMA -#define PF_DATAKIT AF_DATAKIT -#define PF_CCITT AF_CCITT -#define PF_SNA AF_SNA -#define PF_DECnet AF_DECnet -#define PF_DLI AF_DLI -#define PF_LAT AF_LAT -#define PF_HYLINK AF_HYLINK -#define PF_APPLETALK AF_APPLETALK -#define PF_ROUTE AF_ROUTE -#define PF_LINK AF_LINK -#define PF_XTP pseudo_AF_XTP /* really just proto family, no AF */ -#define PF_COIP AF_COIP -#define PF_CNT AF_CNT -#define PF_SIP AF_SIP -#define PF_IPX AF_IPX /* same format as AF_NS */ -#define PF_RTIP pseudo_AF_FTIP /* same format as AF_INET */ -#define PF_PIP pseudo_AF_PIP -#define PF_ISDN AF_ISDN - -#define PF_MAX AF_MAX - -/* - * Definitions for network related sysctl, CTL_NET. - * - * Second level is protocol family. - * Third level is protocol number. - * - * Further levels are defined by the individual families below. - */ -#define NET_MAXID AF_MAX - -#define CTL_NET_NAMES { \ - { 0, 0 }, \ - { "unix", CTLTYPE_NODE }, \ - { "inet", CTLTYPE_NODE }, \ - { "implink", CTLTYPE_NODE }, \ - { "pup", CTLTYPE_NODE }, \ - { "chaos", CTLTYPE_NODE }, \ - { "xerox_ns", CTLTYPE_NODE }, \ - { "iso", CTLTYPE_NODE }, \ - { "emca", CTLTYPE_NODE }, \ - { "datakit", CTLTYPE_NODE }, \ - { "ccitt", CTLTYPE_NODE }, \ - { "ibm_sna", CTLTYPE_NODE }, \ - { "decnet", CTLTYPE_NODE }, \ - { "dec_dli", CTLTYPE_NODE }, \ - { "lat", CTLTYPE_NODE }, \ - { "hylink", CTLTYPE_NODE }, \ - { "appletalk", CTLTYPE_NODE }, \ - { "route", CTLTYPE_NODE }, \ - { "link_layer", CTLTYPE_NODE }, \ - { "xtp", CTLTYPE_NODE }, \ - { "coip", CTLTYPE_NODE }, \ - { "cnt", CTLTYPE_NODE }, \ - { "rtip", CTLTYPE_NODE }, \ - { "ipx", CTLTYPE_NODE }, \ - { "sip", CTLTYPE_NODE }, \ - { "pip", CTLTYPE_NODE }, \ -} - -/* - * PF_ROUTE - Routing table - * - * Three additional levels are defined: - * Fourth: address family, 0 is wildcard - * Fifth: type of info, defined below - * Sixth: flag(s) to mask with for NET_RT_FLAGS - */ -#define NET_RT_DUMP 1 /* dump; may limit to a.f. */ -#define NET_RT_FLAGS 2 /* by flags, e.g. RESOLVING */ -#define NET_RT_IFLIST 3 /* survey interface list */ -#define NET_RT_MAXID 4 - -#define CTL_NET_RT_NAMES { \ - { 0, 0 }, \ - { "dump", CTLTYPE_STRUCT }, \ - { "flags", CTLTYPE_STRUCT }, \ - { "iflist", CTLTYPE_STRUCT }, \ -} - -/* - * Maximum queue length specifiable by listen. - */ -#ifndef _WINSOCKAPI_ -#define SOMAXCONN 128 -#endif//_WINSOCKAPI_ - -/* - * Message header for recvmsg and sendmsg calls. - * Used value-result for recvmsg, value only for sendmsg. - */ -struct msghdr { - caddr_t msg_name; /* optional address */ - u_int msg_namelen; /* size of address */ - struct iovec *msg_iov; /* scatter/gather array */ - u_int msg_iovlen; /* # elements in msg_iov */ - caddr_t msg_control; /* ancillary data, see below */ - u_int msg_controllen; /* ancillary data buffer len */ - int msg_flags; /* flags on received message */ -}; - -#endif - -#ifndef MSG_OOB -#define MSG_OOB 0x1 /* process out-of-band data */ -#define MSG_PEEK 0x2 /* peek at incoming message */ -#define MSG_DONTROUTE 0x4 /* send without using routing tables */ -#endif -#ifndef MSG_EOR -#define MSG_EOR 0x8 /* data completes record */ -#define MSG_TRUNC 0x10 /* data discarded before delivery */ -#define MSG_CTRUNC 0x20 /* control data lost before delivery */ -#define MSG_WAITALL 0x40 /* wait for full request or error */ -#endif -#ifndef MSG_DONTWAIT -#define MSG_DONTWAIT 0x80 /* this message should be nonblocking */ -#define MSG_EOF 0x100 /* data completes connection */ -#define MSG_COMPAT 0x8000 /* used in sendit() */ -#endif - -#ifndef __REACTOS__ -/* - * Header for ancillary data objects in msg_control buffer. - * Used for additional information with/about a datagram - * not expressible by flags. The format is a sequence - * of message elements headed by cmsghdr structures. - */ -struct cmsghdr { - u_int cmsg_len; /* data byte count, including hdr */ - int cmsg_level; /* originating protocol */ - int cmsg_type; /* protocol-specific type */ -/* followed by u_char cmsg_data[]; */ -}; - -/* given pointer to struct cmsghdr, return pointer to data */ -#define CMSG_DATA(cmsg) ((u_char *)((cmsg) + 1)) - -/* given pointer to struct cmsghdr, return pointer to next cmsghdr */ -#define CMSG_NXTHDR(mhdr, cmsg) \ - (((caddr_t)(cmsg) + (cmsg)->cmsg_len + sizeof(struct cmsghdr) > \ - (mhdr)->msg_control + (mhdr)->msg_controllen) ? \ - (struct cmsghdr *)NULL : \ - (struct cmsghdr *)((caddr_t)(cmsg) + ALIGN((cmsg)->cmsg_len))) - -#define CMSG_FIRSTHDR(mhdr) ((struct cmsghdr *)(mhdr)->msg_control) - -/* "Socket"-level control message types: */ -#define SCM_RIGHTS 0x01 /* access rights (array of int) */ - -/* - * 4.3 compat sockaddr, move to compat file later - */ -struct osockaddr { - u_short sa_family; /* address family */ - char sa_data[14]; /* up to 14 bytes of direct address */ -}; - -/* - * 4.3-compat message header (move to compat file later). - */ -struct omsghdr { - caddr_t msg_name; /* optional address */ - int msg_namelen; /* size of address */ - struct iovec *msg_iov; /* scatter/gather array */ - int msg_iovlen; /* # elements in msg_iov */ - caddr_t msg_accrights; /* access rights sent/received */ - int msg_accrightslen; -}; - -#ifndef KERNEL - -#include - -__BEGIN_DECLS -int accept __P((int, struct sockaddr *, int *)); -int bind __P((int, const struct sockaddr *, int)); -int connect __P((int, const struct sockaddr *, int)); -int getpeername __P((int, struct sockaddr *, int *)); -int getsockname __P((int, struct sockaddr *, int *)); -int getsockopt __P((int, int, int, void *, int *)); -int listen __P((int, int)); -ssize_t recv __P((int, void *, size_t, int)); -ssize_t recvfrom __P((int, void *, size_t, int, struct sockaddr *, int *)); -ssize_t recvmsg __P((int, struct msghdr *, int)); -ssize_t send __P((int, const void *, size_t, int)); -ssize_t sendto __P((int, const void *, - size_t, int, const struct sockaddr *, int)); -ssize_t sendmsg __P((int, const struct msghdr *, int)); -int setsockopt __P((int, int, int, const void *, int)); -int shutdown __P((int, int)); -int socket __P((int, int, int)); -int socketpair __P((int, int, int, int *)); -__END_DECLS - -#else /* KERNEL */ -void pfctlinput __P((int, struct sockaddr *)); -#endif /* !KERNEL */ -#endif /* !_OSK_SYS_SOCKET_H_ */ diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/socketvar.h b/lib/drivers/oskittcp/include/freebsd/src/sys/sys/socketvar.h deleted file mode 100644 index ab007da6433..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/socketvar.h +++ /dev/null @@ -1,280 +0,0 @@ -/*- - * Copyright (c) 1982, 1986, 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)socketvar.h 8.1 (Berkeley) 6/2/93 - */ - -#ifndef _SYS_SOCKETVAR_H_ -#define _SYS_SOCKETVAR_H_ - -#include /* for struct stat */ -#include /* for struct filedesc */ -#include /* for struct selinfo */ - -/* Warning suppression */ -struct sockaddr; - -/* - * Used to maintain information about processes that wish to be - * notified when I/O becomes possible. - * - * Moved from sys/select.h and replaced with an #include. - */ -struct selinfo { -#if defined(OSKIT) - struct listener_mgr *si_sel; -#endif /* OSKIT */ - pid_t si_pid; /* process to be notified */ - short si_flags; /* see below */ -}; -#define SI_COLL 0x0001 /* collision occurred */ - - -/* - * Kernel structure per socket. - * Contains send and receive buffer queues, - * handle on protocol and pointer to protocol - * private data and error information. - */ -struct socket { - short so_type; /* generic type, see socket.h */ - short so_options; /* from socket call, see socket.h */ - short so_linger; /* time to linger while closing */ - short so_state; /* internal state flags SS_*, below */ - caddr_t so_pcb; /* protocol control block */ - void *so_connection; /* connection (outside context) */ - struct protosw *so_proto; /* protocol handle */ -/* - * Variables for connection queueing. - * Socket where accepts occur is so_head in all subsidiary sockets. - * If so_head is 0, socket is not related to an accept. - * For head socket so_q0 queues partially completed connections, - * while so_q is a queue of connections ready to be accepted. - * If a connection is aborted and it has so_head set, then - * it has to be pulled out of either so_q0 or so_q. - * We allow connections to queue up based on current queue lengths - * and limit on number of queued connections for this socket. - */ - struct socket *so_head; /* back pointer to accept socket */ - struct socket *so_q0; /* queue of partial connections */ - struct socket *so_q; /* queue of incoming connections */ - short so_q0len; /* partials on so_q0 */ - short so_qlen; /* number of connections on so_q */ - short so_qlimit; /* max number queued connections */ - short so_timeo; /* connection timeout */ - u_short so_error; /* error affecting connection */ - pid_t so_pgid; /* pgid for signals */ - u_long so_oobmark; /* chars to oob mark */ -/* - * Variables for socket buffering. - */ - struct sockbuf { - u_long sb_cc; /* actual chars in buffer */ - u_long sb_hiwat; /* max actual char count */ - u_long sb_mbcnt; /* chars of mbufs used */ - u_long sb_mbmax; /* max chars of mbufs to use */ - long sb_lowat; /* low water mark */ - struct mbuf *sb_mb; /* the mbuf chain */ - struct selinfo sb_sel; /* process selecting read/write */ - short sb_flags; /* flags, see below */ - short sb_timeo; /* timeout for read/write */ - } so_rcv, so_snd; -#define SB_MAX (256*1024) /* default for max chars in sockbuf */ -#define SB_LOCK 0x01 /* lock on data queue */ -#define SB_WANT 0x02 /* someone is waiting to lock */ -#define SB_WAIT 0x04 /* someone is waiting for data/space */ -#define SB_SEL 0x08 /* someone is selecting */ -#define SB_ASYNC 0x10 /* ASYNC I/O, need signals */ -#define SB_NOTIFY (SB_WAIT|SB_SEL|SB_ASYNC) -#define SB_NOINTR 0x40 /* operations not interruptible */ - - caddr_t so_tpcb; /* Wisc. protocol control block XXX */ - void (*so_upcall) __P((struct socket *so, caddr_t arg, int waitf)); - caddr_t so_upcallarg; /* Arg for above */ -}; - -/* - * Socket state bits. - */ -#define SS_NOFDREF 0x001 /* no file table ref any more */ -#define SS_ISCONNECTED 0x002 /* socket connected to a peer */ -#define SS_ISCONNECTING 0x004 /* in process of connecting to peer */ -#define SS_ISDISCONNECTING 0x008 /* in process of disconnecting */ -#define SS_CANTSENDMORE 0x010 /* can't send more data to peer */ -#define SS_CANTRCVMORE 0x020 /* can't receive more data from peer */ -#define SS_RCVATMARK 0x040 /* at mark on input */ - -#define SS_PRIV 0x080 /* privileged for broadcast, raw... */ -#define SS_NBIO 0x100 /* non-blocking ops */ -#define SS_ASYNC 0x200 /* async i/o notify */ -#define SS_ISCONFIRMING 0x400 /* deciding to accept connection req */ - - -/* - * Macros for sockets and socket buffering. - */ - -/* - * How much space is there in a socket buffer (so->so_snd or so->so_rcv)? - * This is problematical if the fields are unsigned, as the space might - * still be negative (cc > hiwat or mbcnt > mbmax). Should detect - * overflow and return 0. Should use "lmin" but it doesn't exist now. - */ -#define sbspace(sb) \ - ((long) imin((int)((sb)->sb_hiwat - (sb)->sb_cc), \ - (int)((sb)->sb_mbmax - (sb)->sb_mbcnt))) - -/* do we have to send all at once on a socket? */ -#define sosendallatonce(so) \ - ((so)->so_proto->pr_flags & PR_ATOMIC) - -/* can we read something from so? */ -#define soreadable(so) \ - ((so)->so_rcv.sb_cc >= (so)->so_rcv.sb_lowat || \ - ((so)->so_state & SS_CANTRCVMORE) || \ - (so)->so_qlen || (so)->so_error) - -/* can we write something to so? */ -#define sowriteable(so) \ - ((sbspace(&(so)->so_snd) >= (so)->so_snd.sb_lowat && \ - (((so)->so_state&SS_ISCONNECTED) || \ - ((so)->so_proto->pr_flags&PR_CONNREQUIRED)==0)) || \ - ((so)->so_state & SS_CANTSENDMORE) || \ - (so)->so_error) - -/* adjust counters in sb reflecting allocation of m */ -#define sballoc(sb, m) { \ - (sb)->sb_cc += (m)->m_len; \ - (sb)->sb_mbcnt += MSIZE; \ - if ((m)->m_flags & M_EXT) \ - (sb)->sb_mbcnt += (m)->m_ext.ext_size; \ -} - -/* adjust counters in sb reflecting freeing of m */ -#define sbfree(sb, m) { \ - (sb)->sb_cc -= (m)->m_len; \ - (sb)->sb_mbcnt -= MSIZE; \ - if ((m)->m_flags & M_EXT) \ - (sb)->sb_mbcnt -= (m)->m_ext.ext_size; \ -} - -/* - * Set lock on sockbuf sb; sleep if lock is already held. - * Unless SB_NOINTR is set on sockbuf, sleep is interruptible. - * Returns error without lock if sleep is interrupted. - */ -#define sblock(sb, wf) ((sb)->sb_flags & SB_LOCK ? \ - (((wf) == M_WAITOK) ? sb_lock(sb) : EWOULDBLOCK) : \ - ((sb)->sb_flags |= SB_LOCK), 0) - -/* release lock on sockbuf sb */ -#define sbunlock(so, sb) { \ - (sb)->sb_flags &= ~SB_LOCK; \ - if ((sb)->sb_flags & SB_WANT) { \ - (sb)->sb_flags &= ~SB_WANT; \ - wakeup(so, (caddr_t)&(sb)->sb_flags); \ - } \ -} - -#define sorwakeup(so) { sowakeup((so), &(so)->so_rcv); \ - if ((so)->so_upcall) \ - (*((so)->so_upcall))((so), (so)->so_upcallarg, M_DONTWAIT); \ - } - -#define sowwakeup(so) sowakeup((so), &(so)->so_snd) - -#ifdef KERNEL -extern u_long sb_max; -/* to catch callers missing new second argument to sonewconn: */ -#define sonewconn(head, connstatus) sonewconn1((head), (connstatus)) -struct socket *sonewconn1 __P((struct socket *head, int connstatus)); - -/* strings for sleep message: */ -extern char netio[], netcon[], netcls[]; - -/* - * File operations on sockets. - */ -int soo_read __P((struct file *fp, struct uio *uio, struct ucred *cred)); -int soo_write __P((struct file *fp, struct uio *uio, struct ucred *cred)); -int soo_ioctl __P((struct file *fp, int com, caddr_t data, struct proc *p)); -int soo_select __P((struct file *fp, int which, struct proc *p)); -int soo_close __P((struct file *fp, struct proc *p)); -int soo_stat __P((struct socket *, struct stat *)); - -/* - * From uipc_socket and friends - */ -void soqinsque __P((struct socket *, struct socket *, int)); -void sowakeup __P((struct socket *, struct sockbuf *)); -void socantrcvmore __P((struct socket *)); -void socantsendmore __P((struct socket *)); -void sbrelease __P((struct sockbuf *)); -void sbappend __P((struct sockbuf *, struct mbuf *)); -void sbappendrecord __P((struct sockbuf *, struct mbuf *)); -int sbappendcontrol __P((struct sockbuf *, struct mbuf *, struct mbuf *)); -int sbappendaddr __P((struct sockbuf *, struct sockaddr *, struct mbuf *, struct mbuf *)); -void sbdroprecord __P((struct sockbuf *)); -void sbcompress __P((struct sockbuf *, struct mbuf *, struct mbuf *)); -void sbflush __P((struct sockbuf *)); -int sbreserve __P((struct sockbuf *,u_long)); -int soreserve __P((struct socket *,u_long,u_long)); -int sb_lock __P((struct sockbuf *)); -int sbwait __P((struct sockbuf *)); -void sbdrop __P((struct sockbuf *, int)); -void sofree __P((struct socket *)); -void sorflush __P((struct socket *)); -int soqremque __P((struct socket *,int)); -int soabort __P((struct socket *)); -void soisdisconnected __P((struct socket *)); -void soisconnected __P((struct socket *)); -void soisconnecting __P((struct socket *)); -void soisdisconnecting __P((struct socket *)); -void sohasoutofband __P((struct socket *)); -int sodisconnect __P((struct socket *)); -int sosend __P((struct socket *,struct mbuf *, struct uio *, struct mbuf *, struct mbuf *, int)); -int socreate __P((int, struct socket **,int,int)); -int getsock __P((struct filedesc *,int,struct file **)); -int sockargs __P((struct mbuf **,caddr_t,int,int)); -int sobind __P((struct socket *,struct mbuf *)); -int solisten __P((struct socket *,int)); -int soaccept __P((struct socket *,struct mbuf *)); -int soconnect __P((struct socket *,struct mbuf *)); -int soconnect2 __P((struct socket *,struct socket *)); -int soclose __P((struct socket *)); -int soshutdown __P((struct socket *,int)); -int soreceive __P((struct socket *,struct mbuf **,struct uio *,struct mbuf **,struct mbuf **,int *)); -int sosetopt __P((struct socket *,int, int, struct mbuf *)); -int sogetopt __P((struct socket *,int, int, struct mbuf **)); -#endif - -#endif diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/sockio.h b/lib/drivers/oskittcp/include/freebsd/src/sys/sys/sockio.h deleted file mode 100644 index 05dfd904a5f..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/sockio.h +++ /dev/null @@ -1,88 +0,0 @@ -/*- - * Copyright (c) 1982, 1986, 1990, 1993, 1994 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)sockio.h 8.1 (Berkeley) 3/28/94 - */ - -#ifndef _SYS_SOCKIO_H_ -#define _SYS_SOCKIO_H_ - -#ifndef __REACTOS__ -#include - -/* Socket ioctl's. */ -#define SIOCSHIWAT _IOW('s', 0, int) /* set high watermark */ -#define SIOCGHIWAT _IOR('s', 1, int) /* get high watermark */ -#define SIOCSLOWAT _IOW('s', 2, int) /* set low watermark */ -#define SIOCGLOWAT _IOR('s', 3, int) /* get low watermark */ -#define SIOCATMARK _IOR('s', 7, int) /* at oob mark? */ -#define SIOCSPGRP _IOW('s', 8, int) /* set process group */ -#define SIOCGPGRP _IOR('s', 9, int) /* get process group */ - -#define SIOCADDRT _IOW('r', 10, struct ortentry) /* add route */ -#define SIOCDELRT _IOW('r', 11, struct ortentry) /* delete route */ -#define SIOCSETRTINFO _IOWR('r', 12, struct fullrtentry) /* change aux info */ -#define SIOCGETRTINFO _IOWR('r', 13, struct fullrtentry) /* read aux info */ -#define SIOCGETVIFINF _IOWR('r', 14, struct vif_conf) /* read m/c vifs */ -#define SIOCGETVIFCNT _IOWR('r', 15, struct sioc_vif_req)/* get vif pkt cnt */ -#define SIOCGETSGCNT _IOWR('r', 16, struct sioc_sg_req) /* get s,g pkt cnt */ - -#define SIOCSIFADDR _IOW('i', 12, struct ifreq) /* set ifnet address */ -#define OSIOCGIFADDR _IOWR('i', 13, struct ifreq) /* get ifnet address */ -#define SIOCGIFADDR _IOWR('i', 33, struct ifreq) /* get ifnet address */ -#define SIOCSIFDSTADDR _IOW('i', 14, struct ifreq) /* set p-p address */ -#define OSIOCGIFDSTADDR _IOWR('i', 15, struct ifreq) /* get p-p address */ -#define SIOCGIFDSTADDR _IOWR('i', 34, struct ifreq) /* get p-p address */ -#define SIOCSIFFLAGS _IOW('i', 16, struct ifreq) /* set ifnet flags */ -#define SIOCGIFFLAGS _IOWR('i', 17, struct ifreq) /* get ifnet flags */ -#define OSIOCGIFBRDADDR _IOWR('i', 18, struct ifreq) /* get broadcast addr */ -#define SIOCGIFBRDADDR _IOWR('i', 35, struct ifreq) /* get broadcast addr */ -#define SIOCSIFBRDADDR _IOW('i', 19, struct ifreq) /* set broadcast addr */ -#define OSIOCGIFCONF _IOWR('i', 20, struct ifconf) /* get ifnet list */ -#define SIOCGIFCONF _IOWR('i', 36, struct ifconf) /* get ifnet list */ -#define OSIOCGIFNETMASK _IOWR('i', 21, struct ifreq) /* get net addr mask */ -#define SIOCGIFNETMASK _IOWR('i', 37, struct ifreq) /* get net addr mask */ -#define SIOCSIFNETMASK _IOW('i', 22, struct ifreq) /* set net addr mask */ -#define SIOCGIFMETRIC _IOWR('i', 23, struct ifreq) /* get IF metric */ -#define SIOCSIFMETRIC _IOW('i', 24, struct ifreq) /* set IF metric */ -#define SIOCDIFADDR _IOW('i', 25, struct ifreq) /* delete IF addr */ -#define SIOCAIFADDR _IOW('i', 26, struct ifaliasreq)/* add/chg IF alias */ - -#define SIOCADDMULTI _IOW('i', 49, struct ifreq) /* add m'cast addr */ -#define SIOCDELMULTI _IOW('i', 50, struct ifreq) /* del m'cast addr */ -#define SIOCGIFMTU _IOWR('i', 51, struct ifreq) /* get IF mtu */ -#define SIOCSIFMTU _IOW('i', 52, struct ifreq) /* set IF mtu */ -#define SIOCGIFPHYS _IOWR('i', 53, struct ifreq) /* get IF wire */ -#define SIOCSIFPHYS _IOW('i', 54, struct ifreq) /* set IF wire */ -#endif - -#endif /* !_SYS_SOCKIO_H_ */ diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/stat.h b/lib/drivers/oskittcp/include/freebsd/src/sys/sys/stat.h deleted file mode 100644 index 385cfd70a4b..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/stat.h +++ /dev/null @@ -1,205 +0,0 @@ -/*- - * Copyright (c) 1982, 1986, 1989, 1993 - * The Regents of the University of California. All rights reserved. - * (c) UNIX System Laboratories, Inc. - * All or some portions of this file are derived from material licensed - * to the University of California by American Telephone and Telegraph - * Co. or Unix System Laboratories, Inc. and are reproduced herein with - * the permission of UNIX System Laboratories, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)stat.h 8.6 (Berkeley) 3/8/94 - */ - -#ifndef _SYS_STAT_H_ -#define _SYS_STAT_H_ - -/* - * XXX we need this for struct timespec. We get miscellaneous namespace - * pollution with it. struct timespace itself is namespace pollution if - * _POSIX_SOURCE is defined. - */ -#include - -#ifndef _POSIX_SOURCE -struct ostat { - unsigned short st_dev; /* inode's device */ - ino_t st_ino; /* inode's number */ - mode_t st_mode; /* inode protection mode */ - nlink_t st_nlink; /* number of hard links */ - unsigned short st_uid; /* user ID of the file's owner */ - unsigned short st_gid; /* group ID of the file's group */ - unsigned short st_rdev; /* device type */ - long st_size; /* file size, in bytes */ - struct timespec st_atimespec; /* time of last access */ - struct timespec st_mtimespec; /* time of last data modification */ - struct timespec st_ctimespec; /* time of last file status change */ - long st_blksize; /* optimal blocksize for I/O */ - long st_blocks; /* blocks allocated for file */ - unsigned long st_flags; /* user defined flags for file */ - unsigned long st_gen; /* file generation number */ -}; -#endif /* !_POSIX_SOURCE */ - -//#ifndef _MSC_VER -struct stat { - dev_t st_dev; /* inode's device */ - ino_t st_ino; /* inode's number */ - mode_t st_mode; /* inode protection mode */ - nlink_t st_nlink; /* number of hard links */ - uid_t st_uid; /* user ID of the file's owner */ - gid_t st_gid; /* group ID of the file's group */ - dev_t st_rdev; /* device type */ - struct timespec st_atimespec; /* time of last access */ - struct timespec st_mtimespec; /* time of last data modification */ - struct timespec st_ctimespec; /* time of last file status change */ - off_t st_size; /* file size, in bytes */ - quad_t st_blocks; /* blocks allocated for file */ - unsigned long st_blksize; /* optimal blocksize for I/O */ - unsigned long st_flags; /* user defined flags for file */ - unsigned long st_gen; /* file generation number */ - long st_lspare; - quad_t st_qspare[2]; -}; -//#endif//_MSC_VER -#define st_atime st_atimespec.ts_sec -#define st_mtime st_mtimespec.ts_sec -#define st_ctime st_ctimespec.ts_sec - -#define S_ISUID 0004000 /* set user id on execution */ -#define S_ISGID 0002000 /* set group id on execution */ -#ifndef _POSIX_SOURCE -#define S_ISTXT 0001000 /* sticky bit */ -#endif - -#define S_IRWXU 0000700 /* RWX mask for owner */ -#define S_IRUSR 0000400 /* R for owner */ -#define S_IWUSR 0000200 /* W for owner */ -#define S_IXUSR 0000100 /* X for owner */ - -#ifndef _POSIX_SOURCE -#define S_IREAD S_IRUSR -#define S_IWRITE S_IWUSR -#define S_IEXEC S_IXUSR -#endif - -#define S_IRWXG 0000070 /* RWX mask for group */ -#define S_IRGRP 0000040 /* R for group */ -#define S_IWGRP 0000020 /* W for group */ -#define S_IXGRP 0000010 /* X for group */ - -#define S_IRWXO 0000007 /* RWX mask for other */ -#define S_IROTH 0000004 /* R for other */ -#define S_IWOTH 0000002 /* W for other */ -#define S_IXOTH 0000001 /* X for other */ - -#ifndef _POSIX_SOURCE -#define S_IFMT 0170000 /* type of file mask */ -#define S_IFIFO 0010000 /* named pipe (fifo) */ -#define S_IFCHR 0020000 /* character special */ -#define S_IFDIR 0040000 /* directory */ -#define S_IFBLK 0060000 /* block special */ -#define S_IFREG 0100000 /* regular */ -#define S_IFLNK 0120000 /* symbolic link */ -#define S_IFSOCK 0140000 /* socket */ -#define S_ISVTX 0001000 /* save swapped text even after use */ -#endif - -#define S_ISDIR(m) (((m) & 0170000) == 0040000) /* directory */ -#define S_ISCHR(m) (((m) & 0170000) == 0020000) /* char special */ -#define S_ISBLK(m) (((m) & 0170000) == 0060000) /* block special */ -#define S_ISREG(m) (((m) & 0170000) == 0100000) /* regular file */ -#define S_ISFIFO(m) (((m) & 0170000) == 0010000 || \ - ((m) & 0170000) == 0140000) /* fifo or socket */ -#ifndef _POSIX_SOURCE -#define S_ISLNK(m) (((m) & 0170000) == 0120000) /* symbolic link */ -#define S_ISSOCK(m) (((m) & 0170000) == 0010000 || \ - ((m) & 0170000) == 0140000) /* fifo or socket */ -#endif - -#ifndef _POSIX_SOURCE -#define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO) /* 0777 */ - /* 7777 */ -#define ALLPERMS (S_ISUID|S_ISGID|S_ISTXT|S_IRWXU|S_IRWXG|S_IRWXO) - /* 0666 */ -#define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH) - -#define S_BLKSIZE 512 /* block size used in the stat struct */ - -/* - * Definitions of flags stored in file flags word. - * - * Super-user and owner changeable flags. - */ -#define UF_SETTABLE 0x0000ffff /* mask of owner changeable flags */ -#define UF_NODUMP 0x00000001 /* do not dump file */ -#define UF_IMMUTABLE 0x00000002 /* file may not be changed */ -#define UF_APPEND 0x00000004 /* writes to file may only append */ -/* - * Super-user changeable flags. - */ -#define SF_SETTABLE 0xffff0000 /* mask of superuser changeable flags */ -#define SF_ARCHIVED 0x00010000 /* file is archived */ -#define SF_IMMUTABLE 0x00020000 /* file may not be changed */ -#define SF_APPEND 0x00040000 /* writes to file may only append */ - -#ifdef KERNEL -/* - * Shorthand abbreviations of above. - */ -#define APPEND (UF_APPEND | SF_APPEND) -#define IMMUTABLE (UF_IMMUTABLE | SF_IMMUTABLE) -#endif - -#endif /* !_POSIX_SOURCE */ - -#ifdef KERNEL -void cvtstat __P((struct stat *, struct ostat *)); -#else /* KERNEL */ -#include - -__BEGIN_DECLS -int chmod __P((const char *, mode_t)); -int fstat __P((int, struct stat *)); -int mkdir __P((const char *, mode_t)); -int mkfifo __P((const char *, mode_t)); -int stat __P((const char *, struct stat *)); -mode_t umask __P((mode_t)); -#ifndef _POSIX_SOURCE -int chflags __P((const char *, u_long)); -int fchflags __P((int, u_long)); -int fchmod __P((int, mode_t)); -int lstat __P((const char *, struct stat *)); -#endif -__END_DECLS - -#endif /* KERNEL */ - -#endif /* !_SYS_STAT_H_ */ diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/sysctl.h b/lib/drivers/oskittcp/include/freebsd/src/sys/sys/sysctl.h deleted file mode 100644 index c3aa9667fcc..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/sysctl.h +++ /dev/null @@ -1,412 +0,0 @@ -/* - * Copyright (c) 1989, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Mike Karels at Berkeley Software Design, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)sysctl.h 8.1 (Berkeley) 6/2/93 - * $\Id: sysctl.h,v 1.23.4.5 1996/09/19 08:19:00 pst Exp $ - */ - -#ifndef _SYS_SYSCTL_H_ -#define _SYS_SYSCTL_H_ - -/* - * These are for the eproc structure defined below. - */ -#ifndef KERNEL -#include -#include -#include -#include -#endif - -/* - * Definitions for sysctl call. The sysctl call uses a hierarchical name - * for objects that can be examined or modified. The name is expressed as - * a sequence of integers. Like a file path name, the meaning of each - * component depends on its place in the hierarchy. The top-level and kern - * identifiers are defined here, and other identifiers are defined in the - * respective subsystem header files. - */ - -#define CTL_MAXNAME 12 /* largest number of components supported */ - -/* - * Each subsystem defined by sysctl defines a list of variables - * for that subsystem. Each name is either a node with further - * levels defined below it, or it is a leaf of some particular - * type given below. Each sysctl level defines a set of name/type - * pairs to be used by sysctl(1) in manipulating the subsystem. - */ -struct ctlname { - char *ctl_name; /* subsystem name */ - int ctl_type; /* type of name */ -}; -#define CTLTYPE_NODE 1 /* name is a node */ -#define CTLTYPE_INT 2 /* name describes an integer */ -#define CTLTYPE_STRING 3 /* name describes a string */ -#define CTLTYPE_QUAD 4 /* name describes a 64-bit number */ -#define CTLTYPE_STRUCT 5 /* name describes a structure */ - -/* - * Top-level identifiers - */ -#define CTL_UNSPEC 0 /* unused */ -#define CTL_KERN 1 /* "high kernel": proc, limits */ -#define CTL_VM 2 /* virtual memory */ -#define CTL_FS 3 /* file system, mount type is next */ -#define CTL_NET 4 /* network, see socket.h */ -#define CTL_DEBUG 5 /* debugging parameters */ -#define CTL_HW 6 /* generic cpu/io */ -#define CTL_MACHDEP 7 /* machine dependent */ -#define CTL_USER 8 /* user-level */ -#define CTL_MAXID 9 /* number of valid top-level ids */ - -#define CTL_NAMES { \ - { 0, 0 }, \ - { "kern", CTLTYPE_NODE }, \ - { "vm", CTLTYPE_NODE }, \ - { "fs", CTLTYPE_NODE }, \ - { "net", CTLTYPE_NODE }, \ - { "debug", CTLTYPE_NODE }, \ - { "hw", CTLTYPE_NODE }, \ - { "machdep", CTLTYPE_NODE }, \ - { "user", CTLTYPE_NODE }, \ -} - -/* - * CTL_KERN identifiers - */ -#define KERN_OSTYPE 1 /* string: system version */ -#define KERN_OSRELEASE 2 /* string: system release */ -#define KERN_OSREV 3 /* int: system revision */ -#define KERN_VERSION 4 /* string: compile time info */ -#define KERN_MAXVNODES 5 /* int: max vnodes */ -#define KERN_MAXPROC 6 /* int: max processes */ -#define KERN_MAXFILES 7 /* int: max open files */ -#define KERN_ARGMAX 8 /* int: max arguments to exec */ -#define KERN_SECURELVL 9 /* int: system security level */ -#define KERN_HOSTNAME 10 /* string: hostname */ -#define KERN_HOSTID 11 /* int: host identifier */ -#define KERN_CLOCKRATE 12 /* struct: struct clockrate */ -#define KERN_VNODE 13 /* struct: vnode structures */ -#define KERN_PROC 14 /* struct: process entries */ -#define KERN_FILE 15 /* struct: file entries */ -#define KERN_PROF 16 /* node: kernel profiling info */ -#define KERN_POSIX1 17 /* int: POSIX.1 version */ -#define KERN_NGROUPS 18 /* int: # of supplemental group ids */ -#define KERN_JOB_CONTROL 19 /* int: is job control available */ -#define KERN_SAVED_IDS 20 /* int: saved set-user/group-ID */ -#define KERN_BOOTTIME 21 /* struct: time kernel was booted */ -#define KERN_DOMAINNAME 22 /* string: YP domain name */ -#define KERN_UPDATEINTERVAL 23 /* int: update process sleep time */ -#define KERN_OSRELDATE 24 /* int: OS release date */ -#define KERN_NTP_PLL 25 /* node: NTP PLL control */ -#define KERN_BOOTFILE 26 /* string: name of booted kernel */ -#define KERN_MAXFILESPERPROC 27 /* int: max open files per proc */ -#define KERN_MAXPROCPERUID 28 /* int: max processes per uid */ -#define KERN_DUMPDEV 29 /* dev_t: device to dump on */ -#define KERN_SOMAXCONN 30 /* int: max connections in listen q */ -#define KERN_MAXSOCKBUF 31 /* int: max size of a socket buffer */ -#define KERN_PS_STRINGS 32 /* int: address of PS_STRINGS */ -#define KERN_USRSTACK 33 /* int: address of USRSTACK */ -#define KERN_SOCKBUF_WASTE 34 /* int: reserved sockbuf space */ -#define KERN_SOMINQUEUE 35 /* int: override socket listen() */ -#define KERN_MAXID 36 /* number of valid kern ids */ - -#define CTL_KERN_NAMES { \ - { 0, 0 }, \ - { "ostype", CTLTYPE_STRING }, \ - { "osrelease", CTLTYPE_STRING }, \ - { "osrevision", CTLTYPE_INT }, \ - { "version", CTLTYPE_STRING }, \ - { "maxvnodes", CTLTYPE_INT }, \ - { "maxproc", CTLTYPE_INT }, \ - { "maxfiles", CTLTYPE_INT }, \ - { "argmax", CTLTYPE_INT }, \ - { "securelevel", CTLTYPE_INT }, \ - { "hostname", CTLTYPE_STRING }, \ - { "hostid", CTLTYPE_INT }, \ - { "clockrate", CTLTYPE_STRUCT }, \ - { "vnode", CTLTYPE_STRUCT }, \ - { "proc", CTLTYPE_STRUCT }, \ - { "file", CTLTYPE_STRUCT }, \ - { "profiling", CTLTYPE_NODE }, \ - { "posix1version", CTLTYPE_INT }, \ - { "ngroups", CTLTYPE_INT }, \ - { "job_control", CTLTYPE_INT }, \ - { "saved_ids", CTLTYPE_INT }, \ - { "boottime", CTLTYPE_STRUCT }, \ - { "domainname", CTLTYPE_STRING }, \ - { "update", CTLTYPE_INT }, \ - { "osreldate", CTLTYPE_INT }, \ - { "ntp_pll", CTLTYPE_NODE }, \ - { "bootfile", CTLTYPE_STRING }, \ - { "maxfilesperproc", CTLTYPE_INT }, \ - { "maxprocperuid", CTLTYPE_INT }, \ - { "dumpdev", CTLTYPE_STRUCT }, /* we lie; don't print as int */ \ - { "somaxconn", CTLTYPE_INT }, \ - { "maxsockbuf", CTLTYPE_INT }, \ - { "ps_strings", CTLTYPE_INT }, \ - { "usrstack", CTLTYPE_INT }, \ - { "sockbuf_waste_factor", CTLTYPE_INT }, \ - { "sominqueue", CTLTYPE_INT }, \ -} - -/* - * CTL_FS identifiers - */ -#define FS_VFSCONF 0 /* get configured filesystems */ -#define FS_MAXID 1 /* number of items */ - -#define CTL_FS_NAMES { \ - { "vfsconf", CTLTYPE_STRUCT }, \ -} - -/* - * KERN_PROC subtypes - */ -#define KERN_PROC_ALL 0 /* everything */ -#define KERN_PROC_PID 1 /* by process id */ -#define KERN_PROC_PGRP 2 /* by process group id */ -#define KERN_PROC_SESSION 3 /* by session of pid */ -#define KERN_PROC_TTY 4 /* by controlling tty */ -#define KERN_PROC_UID 5 /* by effective uid */ -#define KERN_PROC_RUID 6 /* by real uid */ - -/* - * KERN_PROC subtype ops return arrays of augmented proc structures: - */ -struct kinfo_proc { - struct proc kp_proc; /* proc structure */ - struct eproc { - struct proc *e_paddr; /* address of proc */ - struct session *e_sess; /* session pointer */ - struct pcred e_pcred; /* process credentials */ - struct ucred e_ucred; /* current credentials */ -#if defined(sparc) || defined(__REACTOS__) - struct { - segsz_t vm_rssize; /* resident set size */ - segsz_t vm_tsize; /* text size */ - segsz_t vm_dsize; /* data size */ - segsz_t vm_ssize; /* stack size */ - } e_vm; -#else -#ifndef OSKIT - struct vmspace e_vm; /* address space */ -#endif -#endif - pid_t e_ppid; /* parent process id */ - pid_t e_pgid; /* process group id */ - short e_jobc; /* job control counter */ - dev_t e_tdev; /* controlling tty dev */ - pid_t e_tpgid; /* tty process group id */ - struct session *e_tsess; /* tty session pointer */ -#define WMESGLEN 7 - char e_wmesg[WMESGLEN+1]; /* wchan message */ - segsz_t e_xsize; /* text size */ - short e_xrssize; /* text rss */ - short e_xccount; /* text references */ - short e_xswrss; - long e_flag; -#define EPROC_CTTY 0x01 /* controlling tty vnode active */ -#define EPROC_SLEADER 0x02 /* session leader */ - char e_login[MAXLOGNAME]; /* setlogin() name */ - long e_spare[4]; - } kp_eproc; -}; - -/* - * CTL_HW identifiers - */ -#define HW_MACHINE 1 /* string: machine class */ -#define HW_MODEL 2 /* string: specific machine model */ -#define HW_NCPU 3 /* int: number of cpus */ -#define HW_BYTEORDER 4 /* int: machine byte order */ -#define HW_PHYSMEM 5 /* int: total memory */ -#define HW_USERMEM 6 /* int: non-kernel memory */ -#define HW_PAGESIZE 7 /* int: software page size */ -#define HW_DISKNAMES 8 /* strings: disk drive names */ -#define HW_DISKSTATS 9 /* struct: diskstats[] */ -#define HW_FLOATINGPT 10 /* int: has HW floating point? */ -#define HW_DEVCONF 11 /* node: device configuration */ -#define HW_MAXID 12 /* number of valid hw ids */ - -#define CTL_HW_NAMES { \ - { 0, 0 }, \ - { "machine", CTLTYPE_STRING }, \ - { "model", CTLTYPE_STRING }, \ - { "ncpu", CTLTYPE_INT }, \ - { "byteorder", CTLTYPE_INT }, \ - { "physmem", CTLTYPE_INT }, \ - { "usermem", CTLTYPE_INT }, \ - { "pagesize", CTLTYPE_INT }, \ - { "disknames", CTLTYPE_STRUCT }, \ - { "diskstats", CTLTYPE_STRUCT }, \ - { "floatingpoint", CTLTYPE_INT }, \ - { "devconf", CTLTYPE_NODE }, \ -} - -/* - * CTL_USER definitions - */ -#define USER_CS_PATH 1 /* string: _CS_PATH */ -#define USER_BC_BASE_MAX 2 /* int: BC_BASE_MAX */ -#define USER_BC_DIM_MAX 3 /* int: BC_DIM_MAX */ -#define USER_BC_SCALE_MAX 4 /* int: BC_SCALE_MAX */ -#define USER_BC_STRING_MAX 5 /* int: BC_STRING_MAX */ -#define USER_COLL_WEIGHTS_MAX 6 /* int: COLL_WEIGHTS_MAX */ -#define USER_EXPR_NEST_MAX 7 /* int: EXPR_NEST_MAX */ -#define USER_LINE_MAX 8 /* int: LINE_MAX */ -#define USER_RE_DUP_MAX 9 /* int: RE_DUP_MAX */ -#define USER_POSIX2_VERSION 10 /* int: POSIX2_VERSION */ -#define USER_POSIX2_C_BIND 11 /* int: POSIX2_C_BIND */ -#define USER_POSIX2_C_DEV 12 /* int: POSIX2_C_DEV */ -#define USER_POSIX2_CHAR_TERM 13 /* int: POSIX2_CHAR_TERM */ -#define USER_POSIX2_FORT_DEV 14 /* int: POSIX2_FORT_DEV */ -#define USER_POSIX2_FORT_RUN 15 /* int: POSIX2_FORT_RUN */ -#define USER_POSIX2_LOCALEDEF 16 /* int: POSIX2_LOCALEDEF */ -#define USER_POSIX2_SW_DEV 17 /* int: POSIX2_SW_DEV */ -#define USER_POSIX2_UPE 18 /* int: POSIX2_UPE */ -#define USER_STREAM_MAX 19 /* int: POSIX2_STREAM_MAX */ -#define USER_TZNAME_MAX 20 /* int: POSIX2_TZNAME_MAX */ -#define USER_MAXID 21 /* number of valid user ids */ - -#define CTL_USER_NAMES { \ - { 0, 0 }, \ - { "cs_path", CTLTYPE_STRING }, \ - { "bc_base_max", CTLTYPE_INT }, \ - { "bc_dim_max", CTLTYPE_INT }, \ - { "bc_scale_max", CTLTYPE_INT }, \ - { "bc_string_max", CTLTYPE_INT }, \ - { "coll_weights_max", CTLTYPE_INT }, \ - { "expr_nest_max", CTLTYPE_INT }, \ - { "line_max", CTLTYPE_INT }, \ - { "re_dup_max", CTLTYPE_INT }, \ - { "posix2_version", CTLTYPE_INT }, \ - { "posix2_c_bind", CTLTYPE_INT }, \ - { "posix2_c_dev", CTLTYPE_INT }, \ - { "posix2_char_term", CTLTYPE_INT }, \ - { "posix2_fort_dev", CTLTYPE_INT }, \ - { "posix2_fort_run", CTLTYPE_INT }, \ - { "posix2_localedef", CTLTYPE_INT }, \ - { "posix2_sw_dev", CTLTYPE_INT }, \ - { "posix2_upe", CTLTYPE_INT }, \ - { "stream_max", CTLTYPE_INT }, \ - { "tzname_max", CTLTYPE_INT }, \ -} - -/* - * CTL_DEBUG definitions - * - * Second level identifier specifies which debug variable. - * Third level identifier specifies which stucture component. - */ -#define CTL_DEBUG_NAME 0 /* string: variable name */ -#define CTL_DEBUG_VALUE 1 /* int: variable value */ -#define CTL_DEBUG_MAXID 20 - -#ifdef KERNEL -#if defined(DEBUG) || defined(DIAGNOSTIC) -/* - * CTL_DEBUG variables. - * - * These are declared as separate variables so that they can be - * individually initialized at the location of their associated - * variable. The loader prevents multiple use by issuing errors - * if a variable is initialized in more than one place. They are - * aggregated into an array in debug_sysctl(), so that it can - * conveniently locate them when querried. If more debugging - * variables are added, they must also be declared here and also - * entered into the array. - */ -struct ctldebug { - char *debugname; /* name of debugging variable */ - int *debugvar; /* pointer to debugging variable */ -}; -extern struct ctldebug debug0, debug1, debug2, debug3, debug4; -extern struct ctldebug debug5, debug6, debug7, debug8, debug9; -extern struct ctldebug debug10, debug11, debug12, debug13, debug14; -extern struct ctldebug debug15, debug16, debug17, debug18, debug19; -#endif /* DEBUG */ - -extern char cpu_model[]; -extern int hw_float; -extern char machine[]; -extern char osrelease[]; -extern char ostype[]; - -/* - * Internal sysctl function calling convention: - * - * (*sysctlfn)(name, namelen, oldval, oldlenp, newval, newlen, p); - * - * The name parameter points at the next component of the name to be - * interpreted. The namelen parameter is the number of integers in - * the name. - */ -typedef int (sysctlfn) - __P((int *, u_int, void *, size_t *, void *, size_t, struct proc *)); - -sysctlfn cpu_sysctl; -sysctlfn dev_sysctl; -sysctlfn fs_sysctl; -sysctlfn hw_sysctl; -sysctlfn kern_sysctl; -sysctlfn net_sysctl; -sysctlfn ntp_sysctl; -sysctlfn vm_sysctl; - -int sysctl_int __P((void *, size_t *, void *, size_t, int *)); -int sysctl_rdint __P((void *, size_t *, void *, int)); -int sysctl_string __P((void *, size_t *, void *, size_t, char *, int)); -int sysctl_rdstring __P((void *, size_t *, void *, char *)); -int sysctl_rdstruct __P((void *, size_t *, void *, void *, int)); -int sysctl_struct __P((void *oldp, size_t *, void *, size_t, void *, int)); -void fill_eproc __P((struct proc *, struct eproc *)); - -int sysctl_clockrate __P((char *, size_t*)); -int sysctl_vnode __P((char *, size_t*)); -int sysctl_file __P((char *, size_t*)); -int sysctl_doproc __P((int *, u_int, char *, size_t*)); -int sysctl_doprof __P((int *, u_int, void *, size_t *, void *, size_t)); - -#else /* !KERNEL */ -#include - -__BEGIN_DECLS -int sysctl __P((int *, u_int, void *, size_t *, void *, size_t)); -__END_DECLS -#endif /* KERNEL */ - -#endif /* !_SYS_SYSCTL_H_ */ diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/syslimits.h b/lib/drivers/oskittcp/include/freebsd/src/sys/sys/syslimits.h deleted file mode 100644 index 502474c96de..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/syslimits.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 1988, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)syslimits.h 8.1 (Berkeley) 6/2/93 - */ - -#ifndef _SYS_SYSLIMITS_H_ -#define _SYS_SYSLIMITS_H_ - -#define ARG_MAX 65536 /* max bytes for an exec function */ -#ifndef CHILD_MAX -#define CHILD_MAX 40 /* max simultaneous processes */ -#endif -#define LINK_MAX 32767 /* max file link count */ -#define MAX_CANON 255 /* max bytes in term canon input line */ -#define MAX_INPUT 255 /* max bytes in terminal input */ -#define NAME_MAX 255 /* max bytes in a file name */ -#define NGROUPS_MAX 16 /* max supplemental group id's */ -#ifndef OPEN_MAX -#define OPEN_MAX 64 /* max open files per process */ -#endif -#ifndef PATH_MAX -#define PATH_MAX 1024 /* max bytes in pathname */ -#endif -#define PIPE_BUF 512 /* max bytes for atomic pipe writes */ - -#define BC_BASE_MAX 99 /* max ibase/obase values in bc(1) */ -#define BC_DIM_MAX 2048 /* max array elements in bc(1) */ -#define BC_SCALE_MAX 99 /* max scale value in bc(1) */ -#define BC_STRING_MAX 1000 /* max const string length in bc(1) */ -#define COLL_WEIGHTS_MAX 0 /* max weights for order keyword */ -#define EXPR_NEST_MAX 32 /* max expressions nested in expr(1) */ -#define LINE_MAX 2048 /* max bytes in an input line */ -#define RE_DUP_MAX 255 /* max RE's in interval notation */ - -#endif diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/syslog.h b/lib/drivers/oskittcp/include/freebsd/src/sys/sys/syslog.h deleted file mode 100644 index 34f7c2a89a7..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/syslog.h +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1988, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)syslog.h 8.1 (Berkeley) 6/2/93 - */ - -#ifndef _SYS_SYSLOG_H_ -#define _SYS_SYSLOG_H_ - -#define _PATH_LOG "/dev/log" - -/* - * priorities/facilities are encoded into a single 32-bit quantity, where the - * bottom 3 bits are the priority (0-7) and the top 28 bits are the facility - * (0-big number). Both the priorities and the facilities map roughly - * one-to-one to strings in the syslogd(8) source code. This mapping is - * included in this file. - * - * priorities (these are ordered) - */ -#define LOG_EMERG 0 /* system is unusable */ -#define LOG_ALERT 1 /* action must be taken immediately */ -#define LOG_CRIT 2 /* critical conditions */ -#define LOG_ERR 3 /* error conditions */ -#define LOG_WARNING 4 /* warning conditions */ -#define LOG_NOTICE 5 /* normal but significant condition */ -#define LOG_INFO 6 /* informational */ -#define LOG_DEBUG 7 /* debug-level messages */ - -#define LOG_PRIMASK 0x07 /* mask to extract priority part (internal) */ - /* extract priority */ -#define LOG_PRI(p) ((p) & LOG_PRIMASK) -#define LOG_MAKEPRI(fac, pri) (((fac) << 3) | (pri)) - -#ifdef SYSLOG_NAMES -#define INTERNAL_NOPRI 0x10 /* the "no priority" priority */ - /* mark "facility" */ -#define INTERNAL_MARK LOG_MAKEPRI(LOG_NFACILITIES, 0) -typedef struct _code { - char *c_name; - int c_val; -} CODE; - -CODE prioritynames[] = { - "alert", LOG_ALERT, - "crit", LOG_CRIT, - "debug", LOG_DEBUG, - "emerg", LOG_EMERG, - "err", LOG_ERR, - "error", LOG_ERR, /* DEPRECATED */ - "info", LOG_INFO, - "none", INTERNAL_NOPRI, /* INTERNAL */ - "notice", LOG_NOTICE, - "panic", LOG_EMERG, /* DEPRECATED */ - "warn", LOG_WARNING, /* DEPRECATED */ - "warning", LOG_WARNING, - NULL, -1, -}; -#endif - -/* facility codes */ -#define LOG_KERN (0<<3) /* kernel messages */ -#define LOG_USER (1<<3) /* random user-level messages */ -#define LOG_MAIL (2<<3) /* mail system */ -#define LOG_DAEMON (3<<3) /* system daemons */ -#define LOG_AUTH (4<<3) /* security/authorization messages */ -#define LOG_SYSLOG (5<<3) /* messages generated internally by syslogd */ -#define LOG_LPR (6<<3) /* line printer subsystem */ -#define LOG_NEWS (7<<3) /* network news subsystem */ -#define LOG_UUCP (8<<3) /* UUCP subsystem */ -#define LOG_CRON (9<<3) /* clock daemon */ -#define LOG_AUTHPRIV (10<<3) /* security/authorization messages (private) */ -#define LOG_FTP (11<<3) /* ftp daemon */ - - /* other codes through 15 reserved for system use */ -#define LOG_LOCAL0 (16<<3) /* reserved for local use */ -#define LOG_LOCAL1 (17<<3) /* reserved for local use */ -#define LOG_LOCAL2 (18<<3) /* reserved for local use */ -#define LOG_LOCAL3 (19<<3) /* reserved for local use */ -#define LOG_LOCAL4 (20<<3) /* reserved for local use */ -#define LOG_LOCAL5 (21<<3) /* reserved for local use */ -#define LOG_LOCAL6 (22<<3) /* reserved for local use */ -#define LOG_LOCAL7 (23<<3) /* reserved for local use */ - -#define LOG_NFACILITIES 24 /* current number of facilities */ -#define LOG_FACMASK 0x03f8 /* mask to extract facility part */ - /* facility of pri */ -#define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3) - -#ifdef SYSLOG_NAMES -CODE facilitynames[] = { - "auth", LOG_AUTH, - "authpriv", LOG_AUTHPRIV, - "cron", LOG_CRON, - "daemon", LOG_DAEMON, - "ftp", LOG_FTP, - "kern", LOG_KERN, - "lpr", LOG_LPR, - "mail", LOG_MAIL, - "mark", INTERNAL_MARK, /* INTERNAL */ - "news", LOG_NEWS, - "security", LOG_AUTH, /* DEPRECATED */ - "syslog", LOG_SYSLOG, - "user", LOG_USER, - "uucp", LOG_UUCP, - "local0", LOG_LOCAL0, - "local1", LOG_LOCAL1, - "local2", LOG_LOCAL2, - "local3", LOG_LOCAL3, - "local4", LOG_LOCAL4, - "local5", LOG_LOCAL5, - "local6", LOG_LOCAL6, - "local7", LOG_LOCAL7, - NULL, -1, -}; -#endif - -#ifdef KERNEL -#define LOG_PRINTF -1 /* pseudo-priority to indicate use of printf */ -#endif - -/* - * arguments to setlogmask. - */ -#define LOG_MASK(pri) (1 << (pri)) /* mask for one priority */ -#define LOG_UPTO(pri) ((1 << ((pri)+1)) - 1) /* all priorities through pri */ - -/* - * Option flags for openlog. - * - * LOG_ODELAY no longer does anything. - * LOG_NDELAY is the inverse of what it used to be. - */ -#define LOG_PID 0x01 /* log the pid with each message */ -#define LOG_CONS 0x02 /* log on the console if errors in sending */ -#define LOG_ODELAY 0x04 /* delay open until first syslog() (default) */ -#define LOG_NDELAY 0x08 /* don't delay open */ -#define LOG_NOWAIT 0x10 /* don't wait for console forks: DEPRECATED */ -#define LOG_PERROR 0x20 /* log to stderr as well */ - -#ifdef KERNEL - -#else /* not KERNEL */ - -/* - * Don't use va_list in the vsyslog() prototype. Va_list is typedef'd in two - * places ( and ), so if we include one - * of them here we may collide with the utility's includes. It's unreasonable - * for utilities to have to include one of them to include syslog.h, so we get - * _BSD_VA_LIST_ from and use it. - */ -#include -#include - -__BEGIN_DECLS -void closelog __P((void)); -void openlog __P((const char *, int, int)); -int setlogmask __P((int)); -void syslog __P((int, const char *, ...)); -void vsyslog __P((int, const char *, _BSD_VA_LIST_)); -__END_DECLS - -#ifdef OSKIT -/* - * Silliness. - */ -typedef void (*oskit_syslogger_t)(int, const char *, ...); -extern oskit_syslogger_t oskit_libc_syslogger; -#endif - -#endif /* !KERNEL */ - -#endif diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/systm.h b/lib/drivers/oskittcp/include/freebsd/src/sys/sys/systm.h deleted file mode 100644 index 98b73e4ffdc..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/systm.h +++ /dev/null @@ -1,264 +0,0 @@ -/*- - * Copyright (c) 1982, 1988, 1991, 1993 - * The Regents of the University of California. All rights reserved. - * (c) UNIX System Laboratories, Inc. - * All or some portions of this file are derived from material licensed - * to the University of California by American Telephone and Telegraph - * Co. or Unix System Laboratories, Inc. and are reproduced herein with - * the permission of UNIX System Laboratories, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)systm.h 8.4 (Berkeley) 2/23/94 - */ - -#ifndef _SYS_SYSTM_H_ -#define _SYS_SYSTM_H_ - -#include -#include - -/* - * The `securelevel' variable controls the security level of the system. - * It can only be decreased by process 1 (/sbin/init). - * - * Security levels are as follows: - * -1 permannently insecure mode - always run system in level 0 mode. - * 0 insecure mode - immutable and append-only flags make be turned off. - * All devices may be read or written subject to permission modes. - * 1 secure mode - immutable and append-only flags may not be changed; - * raw disks of mounted filesystems, /dev/mem, and /dev/kmem are - * read-only. - * 2 highly secure mode - same as (1) plus raw disks are always - * read-only whether mounted or not. This level precludes tampering - * with filesystems by unmounting them, but also inhibits running - * newfs while the system is secured. - * - * In normal operation, the system runs in level 0 mode while single user - * and in level 1 mode while multiuser. If level 2 mode is desired while - * running multiuser, it can be set in the multiuser startup script - * (/etc/rc.local) using sysctl(1). If it is desired to run the system - * in level 0 mode while multiuser, initialize the variable securelevel - * in /sys/kern/kern_sysctl.c to -1. Note that it is NOT initialized to - * zero as that would allow the kernel binary to be patched to -1. - * Without initialization, securelevel loads in the BSS area which only - * comes into existence when the kernel is loaded and hence cannot be - * patched by a stalking hacker. - */ -extern int securelevel; /* system security level */ - -extern int cold; /* nonzero if we are doing a cold boot */ -extern const char *panicstr; /* panic message */ -extern char version[]; /* system version */ -extern char copyright[]; /* system copyright */ - -extern int nblkdev; /* number of entries in bdevsw */ -extern int nchrdev; /* number of entries in cdevsw */ -extern struct swdevt *swdevt; /* swap-device information */ -extern int nswdev; /* number of swap devices */ -extern int nswap; /* size of swap space */ - -extern int selwait; /* select timeout address */ - -extern u_char curpriority; /* priority of current process */ - -extern int physmem; /* physical memory */ - -extern dev_t dumpdev; /* dump device */ -extern long dumplo; /* offset into dumpdev */ - -extern dev_t rootdev; /* root device */ -extern struct vnode *rootvp; /* vnode equivalent to above */ - -extern dev_t swapdev; /* swapping device */ -extern struct vnode *swapdev_vp;/* vnode equivalent to above */ - -extern int boothowto; /* reboot flags, from console subsystem */ - -/* - * General function declarations. - */ -int nullop __P((void)); -int enodev __P((void)); -int enoioctl __P((void)); -int enxio __P((void)); -int eopnotsupp __P((void)); -int seltrue __P((dev_t dev, int which, struct proc *p)); -int ureadc __P((int, struct uio *)); -void *hashinit __P((int count, int type, u_long *hashmask)); -void *phashinit __P((int count, int type, u_long *nentries)); - -//__dead void panic __P((const char *, ...)) __dead2; -__dead void boot __P((int)) __dead2; -void tablefull __P((const char *)); -void addlog __P((const char *, ...)); -#ifndef __REACTOS__ -void log __P((int, const char *, ...)); -void printf __P((const char *, ...)); -#else -#include -#include - - -//int __cdecl vprintf(const char *, va_list); - -#define log bsd_log -static __inline int bsd_log ( int blah, const char* fmt, ... ) -{ - va_list arg; - int i = 0; - va_start(arg, fmt); -#ifndef __NTDRIVER__ - i = vprintf ( fmt, arg ); -#endif - va_end(arg); - return i; -} -#endif -void uprintf __P((const char *, ...)); -int sprintf __P((char *buf, const char *, ...)); -void ttyprintf __P((struct tty *, const char *, ...)); -void kprintf __P((const char *fmt, int flags, struct tty *tp, va_list ap)); - -#ifndef __REACTOS__ -void bcopy __P((const void *from, void *to, size_t len)); -#endif -void ovbcopy __P((const void *from, void *to, size_t len)); -void blkclr __P((void *buf, u_int len)); -void bzero __P((void *buf, size_t len)); - -#ifndef __REACTOS__ -void *memcpy __P((void *to, const void *from, size_t len)); -#endif - -int copystr __P((void *kfaddr, void *kdaddr, u_int len, u_int *done)); -int copyinstr __P((void *udaddr, void *kaddr, u_int len, u_int *done)); -int copyoutstr __P((void *kaddr, void *udaddr, u_int len, u_int *done)); -int copyin __P((void *udaddr, void *kaddr, u_int len)); -int copyout __P((void *kaddr, void *udaddr, u_int len)); - -int fubyte __P((void *base)); -int fuibyte __P((void *base)); -int subyte __P((void *base, int byte)); -int suibyte __P((void *base, int byte)); -int fuword __P((void *base)); -int fuiword __P((void *base)); -int suword __P((void *base, int word)); -int susword __P((void *base, int word)); -int suiword __P((void *base, int word)); - -int hzto __P((struct timeval *tv)); -void realitexpire __P((void *)); - -struct clockframe; -void hardclock __P((struct clockframe *frame)); -void softclock __P((void)); -void statclock __P((struct clockframe *frame)); - -void initclocks __P((void)); - -void startprofclock __P((struct proc *)); -void stopprofclock __P((struct proc *)); -void setstatclockrate __P((int hzrate)); - -void hardupdate __P((long)); -#include - -/* Initialize the world */ -extern void consinit(void); -extern void kmeminit(void); -extern void cpu_startup(void); -extern void usrinfoinit(void); -extern void rqinit(void); -extern void vfsinit(void); -extern void mbinit(void); -extern void clist_init(void); -extern void ifinit(void); -extern void domaininit(void); -extern void cpu_initclocks(void); -extern void vntblinit(void); -extern void nchinit(void); - -/* Finalize the world. */ -void shutdown_nice __P((void)); - -extern __dead void vm_pageout(void) __dead2; /* pagedaemon, called in proc 2 */ -extern __dead void vfs_update(void) __dead2; /* update, called in proc 3 */ -extern __dead void scheduler(void) __dead2; /* sched, called in process 0 */ - -/* - * Kernel to clock driver interface. - */ -void inittodr __P((time_t base)); -void resettodr __P((void)); -void startrtclock __P((void)); - -/* Timeouts */ -typedef void (timeout_t)(void *); /* actual timeout function type */ -typedef timeout_t *timeout_func_t; /* a pointer to this type */ - -void timeout(timeout_func_t, void *, int); -void untimeout(timeout_func_t, void *); -void logwakeup __P((void)); - -/* Syscalls that are called internally. */ -struct close_args { - int fd; -}; -int close __P((struct proc *, struct close_args *uap, int *retval)); -struct execve_args { - char *fname; - char **argv; - char **envv; -}; -int execve __P((struct proc *, struct execve_args *, int *retval)); - -#if 0 -struct fork_args { - int dummy; -}; -int fork __P((struct proc *, struct fork_args *, int retval[])); -#endif - -struct sync_args { - int dummy; -}; -int sync __P((struct proc *, struct sync_args *, int *retval)); -struct wait_args { - int pid; - int *status; - int options; - struct rusage *rusage; -#if defined(COMPAT_43) || defined(COMPAT_IBCS2) - int compat; /* pseudo */ -#endif -}; -int wait1 __P((struct proc *, struct wait_args *, int retval[])); - -#endif /* !_SYS_SYSTM_H_ */ diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/time.h b/lib/drivers/oskittcp/include/freebsd/src/sys/sys/time.h deleted file mode 100644 index 891f6ad5a3f..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/time.h +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)time.h 8.1 (Berkeley) 6/2/93 - */ - -#ifndef _SYS_TIME_H_ -#define _SYS_TIME_H_ - -/* - * Structure returned by gettimeofday(2) system call, - * and used in other calls. - */ -#ifndef _WINSOCKAPI_ -struct timeval { - long tv_sec; /* seconds */ - long tv_usec; /* and microseconds */ -}; -#endif//_WINSOCKAPI_ -/* - * Structure defined by POSIX.4 to be like a timeval. - */ -struct timespec { - long ts_sec; /* seconds */ - long ts_nsec; /* and nanoseconds */ -}; - -#define TIMEVAL_TO_TIMESPEC(tv, ts) { \ - (ts)->ts_sec = (tv)->tv_sec; \ - (ts)->ts_nsec = (tv)->tv_usec * 1000; \ -} -#define TIMESPEC_TO_TIMEVAL(tv, ts) { \ - (tv)->tv_sec = (ts)->ts_sec; \ - (tv)->tv_usec = (ts)->ts_nsec / 1000; \ -} - -struct timezone { - int tz_minuteswest; /* minutes west of Greenwich */ - int tz_dsttime; /* type of dst correction */ -}; -#define DST_NONE 0 /* not on dst */ -#define DST_USA 1 /* USA style dst */ -#define DST_AUST 2 /* Australian style dst */ -#define DST_WET 3 /* Western European dst */ -#define DST_MET 4 /* Middle European dst */ -#define DST_EET 5 /* Eastern European dst */ -#define DST_CAN 6 /* Canada */ - -/* Operations on timevals. */ -#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0 -#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) -#ifndef _MSC_VER -#define timercmp(tvp, uvp, cmp) \ - (((tvp)->tv_sec == (uvp)->tv_sec) ? \ - ((tvp)->tv_usec cmp (uvp)->tv_usec) : \ - ((tvp)->tv_sec cmp (uvp)->tv_sec)) -#endif - -/* - * Names of the interval timers, and structure - * defining a timer setting. - */ -#define ITIMER_REAL 0 -#define ITIMER_VIRTUAL 1 -#define ITIMER_PROF 2 - -struct itimerval { - struct timeval it_interval; /* timer interval */ - struct timeval it_value; /* current value */ -}; - -/* - * Getkerninfo clock information structure - */ -struct clockinfo { - int hz; /* clock frequency */ - int tick; /* micro-seconds per hz tick */ - int stathz; /* statistics clock frequency */ - int profhz; /* profiling clock frequency */ -}; - -#ifdef KERNEL - -int itimerdecr __P((struct itimerval *itp,int usec)); -int itimerfix __P((struct timeval *)); -void microtime __P((struct timeval *)); -void timevaladd __P((struct timeval *, struct timeval *)); -void timevalfix __P((struct timeval *)); -void timevalsub __P((struct timeval *, struct timeval *)); - -#else /* not KERNEL */ -#include - -#ifndef _POSIX_SOURCE -#include - -__BEGIN_DECLS -int adjtime __P((const struct timeval *, struct timeval *)); -int getitimer __P((int, struct itimerval *)); -int gettimeofday __P((struct timeval *, struct timezone *)); -int setitimer __P((int, const struct itimerval *, struct itimerval *)); -int settimeofday __P((const struct timeval *, const struct timezone *)); -int utimes __P((const char *, const struct timeval *)); -__END_DECLS -#endif /* !POSIX */ - -#endif /* !KERNEL */ - -#endif /* !_SYS_TIME_H_ */ diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/ttycom.h b/lib/drivers/oskittcp/include/freebsd/src/sys/sys/ttycom.h deleted file mode 100644 index 3ae6ee516e0..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/ttycom.h +++ /dev/null @@ -1,139 +0,0 @@ -/*- - * Copyright (c) 1982, 1986, 1990, 1993, 1994 - * The Regents of the University of California. All rights reserved. - * (c) UNIX System Laboratories, Inc. - * All or some portions of this file are derived from material licensed - * to the University of California by American Telephone and Telegraph - * Co. or Unix System Laboratories, Inc. and are reproduced herein with - * the permission of UNIX System Laboratories, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)ttycom.h 8.1 (Berkeley) 3/28/94 - */ - -#ifndef _SYS_TTYCOM_H_ -#define _SYS_TTYCOM_H_ - -#include - -/* - * Tty ioctl's except for those supported only for backwards compatibility - * with the old tty driver. - */ - -/* - * Window/terminal size structure. This information is stored by the kernel - * in order to provide a consistent interface, but is not used by the kernel. - */ -struct winsize { - unsigned short ws_row; /* rows, in characters */ - unsigned short ws_col; /* columns, in characters */ - unsigned short ws_xpixel; /* horizontal size, pixels */ - unsigned short ws_ypixel; /* vertical size, pixels */ -}; - -#define TIOCMODG _IOR('t', 3, int) /* get modem control state */ -#define TIOCMODS _IOW('t', 4, int) /* set modem control state */ -#define TIOCM_LE 0001 /* line enable */ -#define TIOCM_DTR 0002 /* data terminal ready */ -#define TIOCM_RTS 0004 /* request to send */ -#define TIOCM_ST 0010 /* secondary transmit */ -#define TIOCM_SR 0020 /* secondary receive */ -#define TIOCM_CTS 0040 /* clear to send */ -#define TIOCM_CAR 0100 /* carrier detect */ -#define TIOCM_CD TIOCM_CAR -#define TIOCM_RNG 0200 /* ring */ -#define TIOCM_RI TIOCM_RNG -#define TIOCM_DSR 0400 /* data set ready */ - /* 8-10 compat */ -#define TIOCEXCL _IO('t', 13) /* set exclusive use of tty */ -#define TIOCNXCL _IO('t', 14) /* reset exclusive use of tty */ - /* 15 unused */ -#define TIOCFLUSH _IOW('t', 16, int) /* flush buffers */ - /* 17-18 compat */ -#define TIOCGETA _IOR('t', 19, struct termios) /* get termios struct */ -#define TIOCSETA _IOW('t', 20, struct termios) /* set termios struct */ -#define TIOCSETAW _IOW('t', 21, struct termios) /* drain output, set */ -#define TIOCSETAF _IOW('t', 22, struct termios) /* drn out, fls in, set */ -#define TIOCGETD _IOR('t', 26, int) /* get line discipline */ -#define TIOCSETD _IOW('t', 27, int) /* set line discipline */ - /* 127-124 compat */ -#define TIOCSBRK _IO('t', 123) /* set break bit */ -#define TIOCCBRK _IO('t', 122) /* clear break bit */ -#define TIOCSDTR _IO('t', 121) /* set data terminal ready */ -#define TIOCCDTR _IO('t', 120) /* clear data terminal ready */ -#define TIOCGPGRP _IOR('t', 119, int) /* get pgrp of tty */ -#define TIOCSPGRP _IOW('t', 118, int) /* set pgrp of tty */ - /* 117-116 compat */ -#define TIOCOUTQ _IOR('t', 115, int) /* output queue size */ -#define TIOCSTI _IOW('t', 114, char) /* simulate terminal input */ -#define TIOCNOTTY _IO('t', 113) /* void tty association */ -#define TIOCPKT _IOW('t', 112, int) /* pty: set/clear packet mode */ -#define TIOCPKT_DATA 0x00 /* data packet */ -#define TIOCPKT_FLUSHREAD 0x01 /* flush packet */ -#define TIOCPKT_FLUSHWRITE 0x02 /* flush packet */ -#define TIOCPKT_STOP 0x04 /* stop output */ -#define TIOCPKT_START 0x08 /* start output */ -#define TIOCPKT_NOSTOP 0x10 /* no more ^S, ^Q */ -#define TIOCPKT_DOSTOP 0x20 /* now do ^S ^Q */ -#define TIOCPKT_IOCTL 0x40 /* state change of pty driver */ -#define TIOCSTOP _IO('t', 111) /* stop output, like ^S */ -#define TIOCSTART _IO('t', 110) /* start output, like ^Q */ -#define TIOCMSET _IOW('t', 109, int) /* set all modem bits */ -#define TIOCMBIS _IOW('t', 108, int) /* bis modem bits */ -#define TIOCMBIC _IOW('t', 107, int) /* bic modem bits */ -#define TIOCMGET _IOR('t', 106, int) /* get all modem bits */ -#define TIOCREMOTE _IOW('t', 105, int) /* remote input editing */ -#define TIOCGWINSZ _IOR('t', 104, struct winsize) /* get window size */ -#define TIOCSWINSZ _IOW('t', 103, struct winsize) /* set window size */ -#define TIOCUCNTL _IOW('t', 102, int) /* pty: set/clr usr cntl mode */ -#define TIOCSTAT _IO('t', 101) /* simulate a control-T status msg */ -#define UIOCCMD(n) _IO('u', n) /* usr cntl op "n" */ -#define TIOCCONS _IOW('t', 98, int) /* become virtual console */ -#define TIOCSCTTY _IO('t', 97) /* become controlling tty */ -#define TIOCEXT _IOW('t', 96, int) /* pty: external processing */ -#define TIOCSIG _IO('t', 95) /* pty: generate signal */ -#define TIOCDRAIN _IO('t', 94) /* wait till output drained */ -#define TIOCMSDTRWAIT _IOW('t', 91, int) /* modem: set wait on close */ -#define TIOCMGDTRWAIT _IOR('t', 90, int) /* modem: get wait on close */ -#define TIOCTIMESTAMP _IOR('t', 89, struct timeval) /* get timestamp of - last interrupt for xntp. */ -#define TIOCDSIMICROCODE _IO('t', 85) /* Download microcode to - DSI Softmodem */ -#define TIOCSDRAINWAIT _IOW('t', 87, int) /* set ttywait timeout */ -#define TIOCGDRAINWAIT _IOR('t', 86, int) /* get ttywait timeout */ - -#define TTYDISC 0 /* termios tty line discipline */ -#define TABLDISC 3 /* tablet discipline */ -#define SLIPDISC 4 /* serial IP discipline */ -#define PPPDISC 5 /* PPP discipline */ - - -#endif /* !_SYS_TTYCOM_H_ */ diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/types.h b/lib/drivers/oskittcp/include/freebsd/src/sys/sys/types.h deleted file mode 100644 index e55825568ae..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/types.h +++ /dev/null @@ -1,187 +0,0 @@ -/*- - * Copyright (c) 1982, 1986, 1991, 1993 - * The Regents of the University of California. All rights reserved. - * (c) UNIX System Laboratories, Inc. - * All or some portions of this file are derived from material licensed - * to the University of California by American Telephone and Telegraph - * Co. or Unix System Laboratories, Inc. and are reproduced herein with - * the permission of UNIX System Laboratories, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)types.h 8.4 (Berkeley) 1/21/94 - */ - -#ifndef _SYS_TYPES_H_ -#define _SYS_TYPES_H_ - -#include - -/* Machine type dependent parameters. */ -#include - -#if !defined(_POSIX_SOURCE) -typedef unsigned char u_char; -typedef unsigned short u_short; -typedef unsigned int u_int; -typedef unsigned long u_long; -typedef unsigned short ushort; /* Sys V compatibility */ -typedef unsigned int uint; /* Sys V compatibility */ - -#ifdef _MSC_VER -typedef unsigned __int64 u_quad_t; /* quads */ -typedef __int64 quad_t; -#else -typedef unsigned long long u_quad_t; /* quads */ -typedef long long quad_t; -#endif/*_MSC_VER*/ -typedef quad_t * qaddr_t; - -typedef char * caddr_t; /* core address */ -typedef long daddr_t; /* disk address */ -#ifndef _DEV_T_DEFINED -#define _DEV_T_DEFINED -typedef unsigned long dev_t; /* device number */ -#endif//_DEV_T_DEFINED -typedef unsigned long fixpt_t; /* fixed point number */ -typedef unsigned long gid_t; /* group id */ -#ifndef _INO_T_DEFINED -#define _INO_T_DEFINED -typedef unsigned long ino_t; /* inode number */ -#endif//_INO_T_DEFINED -typedef unsigned short mode_t; /* permissions */ -typedef unsigned short nlink_t; /* link count */ -#ifndef _OFF_T_DEFINED -#define _OFF_T_DEFINED -typedef quad_t off_t; /* file offset */ -#endif//_OFF_T_DEFINED -typedef long pid_t; /* process id */ -typedef long segsz_t; /* segment size */ -typedef long swblk_t; /* swap offset */ -typedef unsigned long uid_t; /* user id */ -#endif - -/* - * This belongs in unistd.h, but is placed here to ensure that programs - * casting the second parameter of lseek to off_t will get the correct - * version of lseek. - */ -#ifndef KERNEL -__BEGIN_DECLS -off_t lseek __P((int, off_t, int)); -__END_DECLS -#endif - -#ifndef _POSIX_SOURCE -/* - * minor() gives a cookie instead of an index since we don't want to - * change the meanings of bits 0-15 or waste time and space shifting - * bits 16-31 for devices that don't use them. - */ -#define major(x) ((int)(((u_int)(x) >> 8)&0xff)) /* major number */ -#define minor(x) ((int)((x)&0xffff00ff)) /* minor number */ -#define makedev(x,y) ((dev_t)(((x)<<8) | (y))) /* create dev_t */ -#endif - -#include -#include - -#ifdef _BSD_CLOCK_T_ -#define _CLOCK_T_DEFINED -typedef _BSD_CLOCK_T_ clock_t; -#undef _BSD_CLOCK_T_ -#endif - -#ifdef _BSD_SIZE_T_ -#define _SIZE_T_DEFINED -typedef _BSD_SIZE_T_ size_t; -#undef _BSD_SIZE_T_ -#endif - -#ifdef _BSD_SSIZE_T_ -typedef _BSD_SSIZE_T_ ssize_t; -#define _SSIZE_T_DEFINED -#undef _BSD_SSIZE_T_ -#endif - -#ifdef _BSD_TIME_T_ -#define _TIME_T_DEFINED -typedef _BSD_TIME_T_ time_t; -#undef _BSD_TIME_T_ -#endif - -#ifndef _POSIX_SOURCE -#define NBBY 8 /* number of bits in a byte */ - -/* - * Select uses bit masks of file descriptors in longs. These macros - * manipulate such bit fields (the filesystem macros use chars). - * FD_SETSIZE may be defined by the user, but the default here should - * be enough for most uses. - */ -#ifndef FD_SETSIZE -#define FD_SETSIZE 256 -#endif - -typedef long fd_mask; -#define NFDBITS (sizeof(fd_mask) * NBBY) /* bits per mask */ - -#ifndef howmany -#define howmany(x, y) (((x)+((y)-1))/(y)) -#endif - -#ifndef _MSC_VER -typedef struct fd_set { - fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)]; -} fd_set; - -#define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS))) -#define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS))) -#define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS))) -#define FD_COPY(f, t) bcopy(f, t, sizeof(*(f))) -#define FD_ZERO(p) bzero(p, sizeof(*(p))) -#endif/*_MSC_VER*/ - -#if defined(__STDC__) && defined(KERNEL) -/* - * Forward structure declarations for function prototypes. We include the - * common structures that cross subsystem boundaries here; others are mostly - * used in the same place that the structure is defined. - */ -struct proc; -struct pgrp; -struct ucred; -struct rusage; -struct file; -struct buf; -struct tty; -struct uio; -#endif -#endif /* !_POSIX_SOURCE */ -#endif /* !_SYS_TYPES_H_ */ diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/ucred.h b/lib/drivers/oskittcp/include/freebsd/src/sys/sys/ucred.h deleted file mode 100644 index 0d74bd9d02e..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/ucred.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 1989, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)ucred.h 8.2 (Berkeley) 1/4/94 - */ - -#ifndef _SYS_UCRED_H_ -#define _SYS_UCRED_H_ - -/* - * Credentials. - */ -struct ucred { - u_short cr_ref; /* reference count */ - uid_t cr_uid; /* effective user id */ - short cr_ngroups; /* number of groups */ - gid_t cr_groups[NGROUPS]; /* groups */ -}; -#define cr_gid cr_groups[0] -#define NOCRED ((struct ucred *)-1) /* no credential available */ -#define FSCRED ((struct ucred *)-2) /* filesystem credential */ - -#ifdef KERNEL -#define crhold(cr) (cr)->cr_ref++ -struct ucred *crget(void); -struct ucred *crcopy(struct ucred *); -struct ucred *crdup(struct ucred *); -extern void crfree(struct ucred *); -extern int suser(struct ucred *, u_short *); -int groupmember __P((gid_t, struct ucred *)); - -#endif /* KERNEL */ - -#endif /* !_SYS_UCRED_H_ */ diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/uio.h b/lib/drivers/oskittcp/include/freebsd/src/sys/sys/uio.h deleted file mode 100644 index 35e46ab1021..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/uio.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1993, 1994 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)uio.h 8.5 (Berkeley) 2/22/94 - */ - -#ifndef _SYS_UIO_H_ -#define _SYS_UIO_H_ - -/* - * XXX - * iov_base should be a void *. - */ -struct iovec { - char *iov_base; /* Base address. */ - size_t iov_len; /* Length. */ -}; - -enum uio_rw { UIO_READ, UIO_WRITE }; - -/* Segment flag values. */ -enum uio_seg { - UIO_USERSPACE, /* from user data space */ - UIO_SYSSPACE, /* from system space */ - UIO_USERISPACE, /* from user I space */ - UIO_NOCOPY /* don't copy, already in object */ -}; - -#ifdef KERNEL -struct uio { - struct iovec *uio_iov; - int uio_iovcnt; - off_t uio_offset; - int uio_resid; - enum uio_seg uio_segflg; - enum uio_rw uio_rw; - struct proc *uio_procp; -}; - -/* - * Limits - */ -#define UIO_MAXIOV 1024 /* max 1K of iov's */ -#define UIO_SMALLIOV 8 /* 8 on stack, else malloc */ -#endif /* KERNEL */ - -#ifdef KERNEL - -int uiomove __P((caddr_t, int, struct uio *)); - -#else /* !KERNEL */ - -#include - -__BEGIN_DECLS -ssize_t readv __P((int, const struct iovec *, int)); -ssize_t writev __P((int, const struct iovec *, int)); -__END_DECLS - -#endif /* KERNEL */ - -#endif /* !_SYS_UIO_H_ */ diff --git a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/unistd.h b/lib/drivers/oskittcp/include/freebsd/src/sys/sys/unistd.h deleted file mode 100644 index cb4b33e1299..00000000000 --- a/lib/drivers/oskittcp/include/freebsd/src/sys/sys/unistd.h +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 1989, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)unistd.h 8.2 (Berkeley) 1/7/94 - */ - -#ifndef _SYS_UNISTD_H_ -#define _SYS_UNISTD_H_ - -/* compile-time symbolic constants */ -#define _POSIX_JOB_CONTROL /* implementation supports job control */ - -/* - * This feature does not work for root according to POSIX 1003.1. - * We use the saved IDs in seteuid/setegid, which are not currently - * part of the POSIX 1003.1 specification. - */ -#define _POSIX_SAVED_IDS /* saved set-user-ID and set-group-ID */ - -#define _POSIX_VERSION 198808L -#define _POSIX2_VERSION 199212L - -/* execution-time symbolic constants */ - /* chown requires appropriate privileges */ -#define _POSIX_CHOWN_RESTRICTED 1 - /* too-long path components generate errors */ -#define _POSIX_NO_TRUNC 1 - /* may disable terminal special characters */ -#define _POSIX_VDISABLE 0xff - -/* access function */ -#define F_OK 0 /* test for existence of file */ -#define X_OK 0x01 /* test for execute or search permission */ -#define W_OK 0x02 /* test for write permission */ -#define R_OK 0x04 /* test for read permission */ - -/* whence values for lseek(2) */ -#define SEEK_SET 0 /* set file offset to offset */ -#define SEEK_CUR 1 /* set file offset to current plus offset */ -#define SEEK_END 2 /* set file offset to EOF plus offset */ - -#ifndef _POSIX_SOURCE -/* whence values for lseek(2); renamed by POSIX 1003.1 */ -#define L_SET SEEK_SET -#define L_INCR SEEK_CUR -#define L_XTND SEEK_END -#endif - -/* configurable pathname variables */ -#define _PC_LINK_MAX 1 -#define _PC_MAX_CANON 2 -#define _PC_MAX_INPUT 3 -#define _PC_NAME_MAX 4 -#define _PC_PATH_MAX 5 -#define _PC_PIPE_BUF 6 -#define _PC_CHOWN_RESTRICTED 7 -#define _PC_NO_TRUNC 8 -#define _PC_VDISABLE 9 - -/* configurable system variables */ -#define _SC_ARG_MAX 1 -#define _SC_CHILD_MAX 2 -#define _SC_CLK_TCK 3 -#define _SC_NGROUPS_MAX 4 -#define _SC_OPEN_MAX 5 -#define _SC_JOB_CONTROL 6 -#define _SC_SAVED_IDS 7 -#define _SC_VERSION 8 -#define _SC_BC_BASE_MAX 9 -#define _SC_BC_DIM_MAX 10 -#define _SC_BC_SCALE_MAX 11 -#define _SC_BC_STRING_MAX 12 -#define _SC_COLL_WEIGHTS_MAX 13 -#define _SC_EXPR_NEST_MAX 14 -#define _SC_LINE_MAX 15 -#define _SC_RE_DUP_MAX 16 -#define _SC_2_VERSION 17 -#define _SC_2_C_BIND 18 -#define _SC_2_C_DEV 19 -#define _SC_2_CHAR_TERM 20 -#define _SC_2_FORT_DEV 21 -#define _SC_2_FORT_RUN 22 -#define _SC_2_LOCALEDEF 23 -#define _SC_2_SW_DEV 24 -#define _SC_2_UPE 25 -#define _SC_STREAM_MAX 26 -#define _SC_TZNAME_MAX 27 - -/* configurable system strings */ -#define _CS_PATH 1 - -#endif /* !_SYS_UNISTD_H_ */ diff --git a/lib/drivers/oskittcp/include/osenv.h b/lib/drivers/oskittcp/include/osenv.h deleted file mode 100644 index bb5dca2de7b..00000000000 --- a/lib/drivers/oskittcp/include/osenv.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef OSENV_H -#define OSENV_H - -static __inline void osenv_intr_enable(void) {} -static __inline void osenv_intr_disable(void) {} - -void oskit_bufio_addref(void *buf); -void oskit_bufio_release(void *buf); -void* oskit_bufio_create(int len); -void oskit_bufio_map(void *srcbuf, void**dstbuf, int off, int len); - -#define osenv_sleeprec_t void* - -#endif diff --git a/lib/drivers/oskittcp/include/oskitdebug.h b/lib/drivers/oskittcp/include/oskitdebug.h deleted file mode 100644 index 32754aae1cf..00000000000 --- a/lib/drivers/oskittcp/include/oskitdebug.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS TCP/IP protocol driver - * FILE: include/debug.h - * PURPOSE: Debugging support macros - * DEFINES: DBG - Enable debug output - * NASSERT - Disable assertions - */ -#ifndef __OSKITDEBUG_H -#define __OSKITDEBUG_H - -#define OSK_NORMAL_MASK 0x000000FF -#define OSK_SPECIAL_MASK 0xFFFFFF00 -#define OSK_MIN_TRACE 0x00000001 -#define OSK_MID_TRACE 0x00000002 -#define OSK_MAX_TRACE 0x00000003 - -#define OSK_DEBUG_CHECK 0x00000100 -#define OSK_DEBUG_MEMORY 0x00000200 -#define OSK_DEBUG_BUFFER 0x00000400 -#define OSK_DEBUG_IRP 0x00000800 -#define OSK_DEBUG_REFCOUNT 0x00001000 -#define OSK_DEBUG_ADDRFILE 0x00002000 -#define OSK_DEBUG_DATALINK 0x00004000 -#define OSK_DEBUG_ARP 0x00008000 -#define OSK_DEBUG_IP 0x00010000 -#define OSK_DEBUG_UDP 0x00020000 -#define OSK_DEBUG_TCP 0x00040000 -#define OSK_DEBUG_ICMP 0x00080000 -#define OSK_DEBUG_ROUTER 0x00100000 -#define OSK_DEBUG_RCACHE 0x00200000 -#define OSK_DEBUG_NCACHE 0x00400000 -#define OSK_DEBUG_CPOINT 0x00800000 -#define OSK_DEBUG_ULTRA 0xFFFFFFFF - -#include - -#if DBG - -extern OSK_UINT OskitDebugTraceLevel; - -#ifdef _MSC_VER - -#define OS_DbgPrint(_t_, _x_) \ - if (((OskitDebugTraceLevel & OSK_NORMAL_MASK) >= _t_) || \ - ((OskitDebugTraceLevel & _t_) > OSK_NORMAL_MASK)) { \ - DbgPrint("(%s:%d) ", __FILE__, __LINE__); \ - DbgPrint _x_ ; \ - } - -#else /* _MSC_VER */ - -#define OS_DbgPrint(_t_, _x_) \ - if (((OskitDebugTraceLevel & OSK_NORMAL_MASK) >= _t_) || \ - ((OskitDebugTraceLevel & _t_) > OSK_NORMAL_MASK)) { \ - DbgPrint("(%s:%d)(%s) ", __FILE__, __LINE__, __FUNCTION__); \ - DbgPrint _x_ ; \ - } - -#endif /* _MSC_VER */ - -#define ASSERT_IRQL(x) ASSERT(KeGetCurrentIrql() <= (x)) - -#else /* DBG */ - -#define OS_DbgPrint(_t_, _x_) - -#if 0 -#define ASSERT_IRQL(x) -#define ASSERT(x) -#endif - -#endif /* DBG */ - -#ifndef _MSC_VER -#define assert(x) ASSERT(x) -#endif//_MSC_VER -#define assert_irql(x) ASSERT_IRQL(x) - -#endif /* __OSKITDEBUG_H */ - -/* EOF */ diff --git a/lib/drivers/oskittcp/include/oskiterrno.h b/lib/drivers/oskittcp/include/oskiterrno.h deleted file mode 100644 index f6b68e7f046..00000000000 --- a/lib/drivers/oskittcp/include/oskiterrno.h +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1989, 1993 - * The Regents of the University of California. All rights reserved. - * (c) UNIX System Laboratories, Inc. - * All or some portions of this file are derived from material licensed - * to the University of California by American Telephone and Telegraph - * Co. or Unix System Laboratories, Inc. and are reproduced herein with - * the permission of UNIX System Laboratories, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)errno.h 8.5 (Berkeley) 1/21/94 - */ - -#ifndef _OSK_SYS_ERRNO_H_ -#define _OSK_SYS_ERRNO_H_ - -#ifndef __REACTOS__ -#ifndef KERNEL -extern int errno; /* global error number */ -#endif -#undef _POSIX_SOURCE -#endif - -#ifdef _POSIX_SOURCE -#error yuck -#endif - -#define OSK_EPERM 1 /* Operation not permitted */ -#define OSK_ENOENT 2 /* No such file or directory */ -#define OSK_ESRCH 3 /* No such process */ -#define OSK_EINTR 4 /* Interrupted system call */ -#define OSK_EIO 5 /* Input/output error */ -#define OSK_ENXIO 6 /* Device not configured */ -#define OSK_E2BIG 7 /* Argument list too long */ -#define OSK_ENOEXEC 8 /* Exec format error */ -#define OSK_EBADF 9 /* Bad file descriptor */ -#define OSK_ECHILD 10 /* No child processes */ -#define OSK_EDEADLK 11 /* Resource deadlock avoided */ -/* 11 was OSK_EAGAIN */ -#define OSK_ENOMEM 12 /* Cannot allocate memory */ -#define OSK_EACCES 13 /* Permission denied */ -#define OSK_EFAULT 14 /* Bad address */ -#ifndef _POSIX_SOURCE -#define OSK_ENOTBLK 15 /* Block device required */ -#endif -#define OSK_EBUSY 16 /* Device busy */ -#define OSK_EEXIST 17 /* File exists */ -#define OSK_EXDEV 18 /* Cross-device link */ -#define OSK_ENODEV 19 /* Operation not supported by device */ -#define OSK_ENOTDIR 20 /* Not a directory */ -#define OSK_EISDIR 21 /* Is a directory */ -#define OSK_EINVAL 22 /* Invalid argument */ -#define OSK_ENFILE 23 /* Too many open files in system */ -#define OSK_EMFILE 24 /* Too many open files */ -#define OSK_ENOTTY 25 /* Inappropriate ioctl for device */ -#ifndef _POSIX_SOURCE -#define OSK_ETXTBSY 26 /* Text file busy */ -#endif -#define OSK_EFBIG 27 /* File too large */ -#define OSK_ENOSPC 28 /* No space left on device */ -#define OSK_ESPIPE 29 /* Illegal seek */ -#define OSK_EROFS 30 /* Read-only file system */ -#define OSK_EMLINK 31 /* Too many links */ -#define OSK_EPIPE 32 /* Broken pipe */ - -/* math software */ -#define OSK_EDOM 33 /* Numerical argument out of domain */ -#define OSK_ERANGE 34 /* Result too large */ - -/* non-blocking and interrupt i/o */ -#define OSK_EAGAIN 35 /* Resource temporarily unavailable */ -#ifndef _POSIX_SOURCE -#define OSK_EWOULDBLOCK OSK_EAGAIN /* Operation would block */ -#define OSK_EINPROGRESS 36 /* Operation now in progress */ -#define OSK_EALREADY 37 /* Operation already in progress */ - -/* ipc/network software -- argument errors */ -#define OSK_ENOTSOCK 38 /* Socket operation on non-socket */ -#define OSK_EDESTADDRREQ 39 /* Destination address required */ -#define OSK_EMSGSIZE 40 /* Message too long */ -#define OSK_EPROTOTYPE 41 /* Protocol wrong type for socket */ -#define OSK_ENOPROTOOPT 42 /* Protocol not available */ -#define OSK_EPROTONOSUPPORT 43 /* Protocol not supported */ -#define OSK_ESOCKTNOSUPPORT 44 /* Socket type not supported */ -#define OSK_EOPNOTSUPP 45 /* Operation not supported */ -#define OSK_EPFNOSUPPORT 46 /* Protocol family not supported */ -#define OSK_EAFNOSUPPORT 47 /* Address family not supported by protocol family */ -#define OSK_EADDRINUSE 48 /* Address already in use */ -#define OSK_EADDRNOTAVAIL 49 /* Can't assign requested address */ - -/* ipc/network software -- operational errors */ -#define OSK_ENETDOWN 50 /* Network is down */ -#define OSK_ENETUNREACH 51 /* Network is unreachable */ -#define OSK_ENETRESET 52 /* Network dropped connection on reset */ -#define OSK_ECONNABORTED 53 /* Software caused connection abort */ -#define OSK_ECONNRESET 54 /* Connection reset by peer */ -#define OSK_ENOBUFS 55 /* No buffer space available */ -#define OSK_EISCONN 56 /* Socket is already connected */ -#define OSK_ENOTCONN 57 /* Socket is not connected */ -#define OSK_ESHUTDOWN 58 /* Can't send after socket shutdown */ -#define OSK_ETOOMANYREFS 59 /* Too many references: can't splice */ -#define OSK_ETIMEDOUT 60 /* Operation timed out */ -#define OSK_ECONNREFUSED 61 /* Connection refused */ - -#define OSK_ELOOP 62 /* Too many levels of symbolic links */ -#endif /* _POSIX_SOURCE */ -#define OSK_ENAMETOOLONG 63 /* File name too long */ - -/* should be rearranged */ -#ifndef _POSIX_SOURCE -#define OSK_EHOSTDOWN 64 /* Host is down */ -#define OSK_EHOSTUNREACH 65 /* No route to host */ -#endif /* _POSIX_SOURCE */ -#define OSK_ENOTEMPTY 66 /* Directory not empty */ - -/* quotas & mush */ -#ifndef _POSIX_SOURCE -#define OSK_EPROCLIM 67 /* Too many processes */ -#define OSK_EUSERS 68 /* Too many users */ -#define OSK_EDQUOT 69 /* Disc quota exceeded */ - -/* Network File System */ -#define OSK_ESTALE 70 /* Stale NFS file handle */ -#define OSK_EREMOTE 71 /* Too many levels of remote in path */ -#define OSK_EBADRPC 72 /* RPC struct is bad */ -#define OSK_ERPCMISMATCH 73 /* RPC version wrong */ -#define OSK_EPROGUNAVAIL 74 /* RPC prog. not avail */ -#define OSK_EPROGMISMATCH 75 /* Program version wrong */ -#define OSK_EPROCUNAVAIL 76 /* Bad procedure for program */ -#endif /* _POSIX_SOURCE */ - -#define OSK_ENOLCK 77 /* No locks available */ -#define OSK_ENOSYS 78 /* Function not implemented */ - -#ifndef _POSIX_SOURCE -#define OSK_EFTYPE 79 /* Inappropriate file type or format */ -#define OSK_EAUTH 80 /* Authentication error */ -#define OSK_ENEEDAUTH 81 /* Need authenticator */ -#define OSK_ELAST 81 /* Must be equal largest errno */ -#endif /* _POSIX_SOURCE */ - -#ifdef KERNEL -/* pseudo-errors returned inside kernel to modify return to process */ -#define OSK_ERESTART -1 /* restart syscall */ -#define OSK_EJUSTRETURN -2 /* don't modify regs, just return */ -#endif - -#endif/*OSK_SYS_ERRNO*/ diff --git a/lib/drivers/oskittcp/include/oskitfreebsd.h b/lib/drivers/oskittcp/include/oskitfreebsd.h deleted file mode 100644 index f7d48504d5f..00000000000 --- a/lib/drivers/oskittcp/include/oskitfreebsd.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef _OSKITFREEBSD_H -#define _OSKITFREEBSD_H - -// Hacky? Yep -#undef PAGE_SIZE -#undef PAGE_SHIFT -#include - -#ifdef linux -#include -#endif - -extern void oskittcp_die(const char *file, int line); - -#define printf DbgPrint -#define vprintf DbgVPrint -#define ovbcopy(src,dst,n) memmove(dst,src,n) -#define bzero(x,y) memset(x,0,y) -#define bcopy(src,dst,n) memcpy(dst,src,n) -#ifdef _MSC_VER -static __inline void panic ( const char* fmt, ... ) -{ - va_list arg; - va_start(arg, fmt); - printf ( "oskit PANIC: " ); - vprintf ( fmt, arg ); - va_end(arg); - // TODO FIXME - print stack trace... - oskittcp_die("",-1); -} -#else//_MSC_VER -#define panic(...) do { printf(__VA_ARGS__); \ - oskittcp_die(__FILE__,__LINE__); } while(0) -#endif//_MSC_VER -#define kmem_malloc(x,y,z) malloc(y,0,0) - -#endif//_OSKITFREEBSD_H diff --git a/lib/drivers/oskittcp/include/oskittcp.h b/lib/drivers/oskittcp/include/oskittcp.h deleted file mode 100644 index c8f6066e65b..00000000000 --- a/lib/drivers/oskittcp/include/oskittcp.h +++ /dev/null @@ -1,215 +0,0 @@ -#ifndef OSKITTCP_H -#define OSKITTCP_H - -#ifdef linux -#include -#endif - -#ifdef KERNEL -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -struct connect_args { - int s; - caddr_t name; - int namelen; -}; -#endif - -#include - -#define IPHDR_SIZE 20 -#define SEL_CONNECT 1 -#define SEL_FIN 2 -#define SEL_RST 4 -#define SEL_ABRT 8 -#define SEL_READ 16 -#define SEL_WRITE 32 -#define SEL_ACCEPT 64 -#define SEL_OOB 128 -#define SEL_ERROR 256 -#define SEL_FINOUT 512 - -typedef int (*OSKITTCP_SOCKET_STATE) - ( void *ClientData, - void *WhichSocket, - void *WhichConnection, - OSK_UINT NewState ); - -typedef int (*OSKITTCP_SEND_PACKET) - ( void *ClientData, - OSK_PCHAR Data, - OSK_UINT Len ); - -typedef struct ifaddr *(*OSKITTCP_FIND_INTERFACE) - ( void *ClientData, - OSK_UINT AddrType, - OSK_UINT FindType, - struct sockaddr *ReqAddr ); - -typedef void *(*OSKITTCP_MALLOC) - ( void *ClientData, - OSK_UINT Bytes, - OSK_PCHAR File, - OSK_UINT Line ); - -typedef void (*OSKITTCP_FREE) - ( void *ClientData, - void *data, - OSK_PCHAR File, - OSK_UINT Line ); - -typedef int (*OSKITTCP_SLEEP) - ( void *ClientData, void *token, int priority, char *msg, int tmio ); - -typedef void (*OSKITTCP_WAKEUP)( void *ClientData, void *token ); - -typedef struct _OSKITTCP_EVENT_HANDLERS { - void *ClientData; - OSKITTCP_SOCKET_STATE SocketState; - OSKITTCP_SEND_PACKET PacketSend; - OSKITTCP_FIND_INTERFACE FindInterface; - OSKITTCP_MALLOC TCPMalloc; - OSKITTCP_FREE TCPFree; - OSKITTCP_SLEEP Sleep; - OSKITTCP_WAKEUP Wakeup; -} OSKITTCP_EVENT_HANDLERS, *POSKITTCP_EVENT_HANDLERS; - -extern OSKITTCP_EVENT_HANDLERS OtcpEvent; - -extern void InitOskitTCP( void ); -extern void DeinitOskitTCP( void ); -extern void TimerOskitTCP( int FastTimer, int SlowTimer ); -extern void OskitDumpBuffer( OSK_PCHAR Data, OSK_UINT Len ); -extern int OskitTCPShutdown( void *socket, int disconn_type ); -extern int OskitTCPSocket( void *Connection, void **ConnectionContext, - int Af, int Type, int Proto ); -extern void RegisterOskitTCPEventHandlers -( POSKITTCP_EVENT_HANDLERS EventHandlers ); -extern void OskitTCPReceiveDatagram( OSK_PCHAR Data, OSK_UINT Len, - OSK_UINT IpHeaderLen ); -extern int OskitTCPReceive( void *socket, - void *Addr, - OSK_PCHAR Data, - OSK_UINT Len, - OSK_UINT *OutLen, - OSK_UINT Flags ); -extern int OskitTCPSend( void *socket, - OSK_PCHAR Data, - OSK_UINT Len, - OSK_UINT *OutLen, - OSK_UINT Flags ); - -extern int OskitTCPConnect( void *socket, - void *nam, OSK_UINT namelen ); -extern int OskitTCPClose( void *socket ); - -extern int OskitTCPBind( void *socket, - void *nam, OSK_UINT namelen ); - -extern int OskitTCPAccept( void *socket, void **new_socket, - void *context, void *addr_out, - OSK_UINT addr_len, - OSK_UINT *out_addr_len, - OSK_UINT finish_accept ); - -extern int OskitTCPListen( void *socket, int backlog ); - -extern int OskitTCPRecv( void *connection, - OSK_PCHAR Data, - OSK_UINT Len, - OSK_UINT *OutLen, - OSK_UINT Flags ); - -int OskitTCPGetAddress( void *socket, - OSK_UINT *LocalAddress, - OSK_UI16 *LocalPort, - OSK_UINT *RemoteAddress, - OSK_UI16 *RemotePort ); - -int OskitTCPGetSockOpt(void *socket, - int level, - int optname, - char *buffer, - int *size); - -int OskitTCPSetSockOpt(void *socket, - int level, - int optname, - char *buffer, - int size); - -int OskitTCPDisconnect(void *socket); - -int OskitTCPGetSocketError(void *socket); - -#undef errno - -void *fbsd_malloc( unsigned int bytes, char *file, unsigned line, ... ); -void fbsd_free( void *data, char *file, unsigned line, ... ); -#if 0 -#define malloc(x) fbsd_malloc(x,__FILE__,__LINE__) -#define free(x) fbsd_free(x,__FILE__,__LINE__) -#endif -#define kern_malloc(x,y,z) kern_malloc_needs_definition(x,y,z) -#define kern_free(x,y,z) kern_free_needs_definition(x,w,z) - -/* Error codes */ -#include - -#define SOCK_MAXADDRLEN 255 - -#define OSK_MSG_OOB 0x01 -#define OSK_MSG_PEEK 0x02 -#define OSK_MSG_DONTWAIT 0x80 - -#define FREAD 0x0001 -#define FWRITE 0x0002 - -/* Don't define this unless your are insane or aicom */ -//#define LOCK_SPAM - -#ifdef LOCK_SPAM -#define OSKLock() if (!KeTryToAcquireSpinLockAtDpcLevel(&OSKLock)) \ - { \ - DbgPrint("OSKLock WAIT (%s)\n", __FUNCTION__); \ - KeAcquireSpinLockAtDpcLevel(&OSKLock); \ - } \ - DbgPrint("OSKLock >>>> (%s)\n", __FUNCTION__) - -#define OSKUnlock() KeReleaseSpinLockFromDpcLevel(&OSKLock); \ - DbgPrint("OSKLock <<<< (%s)\n", __FUNCTION__) -#else -#define OSKLock() KeAcquireSpinLockAtDpcLevel(&OSKLock) -#define OSKUnlock() KeReleaseSpinLockFromDpcLevel(&OSKLock) -#endif - -#define OSKLockAndRaise(x) KeRaiseIrql(DISPATCH_LEVEL, x); \ - OSKLock() -#define OSKUnlockAndLower(x) OSKUnlock(); \ - KeLowerIrql(x) - -#endif/*OSKITTCP_H*/ diff --git a/lib/drivers/oskittcp/include/oskittypes.h b/lib/drivers/oskittcp/include/oskittypes.h deleted file mode 100644 index aeb5867ebba..00000000000 --- a/lib/drivers/oskittcp/include/oskittypes.h +++ /dev/null @@ -1,35 +0,0 @@ - -#ifndef OSKITTYPES_H -#define OSKITTYPES_H - -typedef struct sockaddr OSK_SOCKADDR; -typedef unsigned char *OSK_PCHAR; -typedef unsigned int OSK_UINT; -typedef unsigned short OSK_UI16; -typedef char * osk_caddr_t; - -#define SWAP_FAMILY_LEN(sabuf,s) \ - (sabuf)->sin_family = htons((sabuf)->sin_family) -/* do { s = (sabuf)->sin_family; (sabuf)->sin_family = (sabuf)->sin_len; (sabuf)->sin_len = s; } while(0); */ - -/* - * The ifaddr structure contains information about one address - * of an interface. They are maintained by the different address families, - * are allocated and attached when an address is set, and are linked - * together so all addresses for an interface can be located. - */ -typedef struct ifaddr { - struct sockaddr *ifa_addr; /* address of interface */ - struct sockaddr *ifa_dstaddr; /* other end of p-to-p link */ -#define ifa_broadaddr ifa_dstaddr /* broadcast address interface */ - struct sockaddr *ifa_netmask; /* used to determine subnet */ - unsigned short ifa_flags; /* mostly rt_flags for cloning */ - short ifa_refcnt; /* extra to malloc for link info */ - int ifa_metric; /* cost of going out this interface */ - unsigned short ifa_mtu; /* MTU */ -} OSK_IFADDR, *POSK_IFADDR; - -#define IFA_ROUTE RTF_UP /* route installed */ -#define OSK_IFQ_MAXLEN 50 - -#endif/*OSKITTYPES_H*/ diff --git a/lib/drivers/oskittcp/notes.txt b/lib/drivers/oskittcp/notes.txt deleted file mode 100644 index b7b2ef6ee22..00000000000 --- a/lib/drivers/oskittcp/notes.txt +++ /dev/null @@ -1,32 +0,0 @@ -The story so far: 20040819 - -This is from memory so it might not be completely accurate. - -tcp_input is called from OskitTCPReceiveDatagram ... I'm not so sure that -this part is correct. I believe that at least the ACK number calculation -is correct as is. Reads are wierd and i'm not sure where the problem is. -We get the wrong number of bytes back in some cases, and strange characters -received. I think this is because the ip header is double counted at some -point the way we do things. We at least seem to ack the 'right' packet at -this point. - -sosend is currently doing wierd stuff. -We send data into sosend and it appears to make it intact into tcp_usrreq. -After that, the data that goes on the wire seems to have the first 20 bytes -uninitialized, so i believe that something thinks we should submit this data -differently. Not sure why it's doing that. - -I think we have our timeouts right as retransmission appears to work. We -need to verify that all types of retransmission are properly served. - -I'm seeing some wierd errors in sbflush and sbappend. Not sure what these -mean or why they're happening. I'm trying to figure out sbappend especially -by looking over bsd cross-reference but it's one of the more lightly -documented parts of bsd. A wierd thing about sbappend is that it seems to -want to see an M_EOR flag at the end of the so->so_rcv->sb_mb chain. When -it gets there it should append the input chain. - -=== NOTES FROM WORKING WITH ROYCE3 === - -tcp_output: between line 511 and 614 m is initialized. Where i was printing -it it didn't have data yet. diff --git a/lib/drivers/oskittcp/oskittcp.rbuild b/lib/drivers/oskittcp/oskittcp.rbuild deleted file mode 100644 index c6332f252d7..00000000000 --- a/lib/drivers/oskittcp/oskittcp.rbuild +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - include/freebsd - include/freebsd/sys/include - include/freebsd/src/sys - include/freebsd/dev/include - include/freebsd/net/include - include - - defaults.c - in.c - in_cksum.c - in_pcb.c - in_proto.c - in_rmx.c - inet_ntoa.c - interface.c - ip_input.c - ip_output.c - kern_clock.c - kern_subr.c - osenv.c - param.c - radix.c - random.c - raw_cb.c - raw_ip.c - raw_usrreq.c - route.c - rtsock.c - scanc.c - sleep.c - tcp_input.c - tcp_output.c - tcp_subr.c - tcp_usrreq.c - tcp_debug.c - tcp_timer.c - uipc_domain.c - uipc_mbuf.c - uipc_socket.c - uipc_socket2.c - - diff --git a/lib/drivers/oskittcp/oskittcp/defaults.c b/lib/drivers/oskittcp/oskittcp/defaults.c deleted file mode 100644 index bfc27f9ad95..00000000000 --- a/lib/drivers/oskittcp/oskittcp/defaults.c +++ /dev/null @@ -1,204 +0,0 @@ -/* - * Copyright (c) 1996-1998 University of Utah and the Flux Group. - * All rights reserved. - * - * This file is part of the Flux OSKit. The OSKit is free software, also known - * as "open source;" you can redistribute it and/or modify it under the terms - * of the GNU General Public License (GPL), version 2, as published by the Free - * Software Foundation (FSF). To explore alternate licensing terms, contact - * the University of Utah at csl-dist@cs.utah.edu or +1-801-585-3271. - * - * The OSKit 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 GPL for more details. You should have - * received a copy of the GPL along with the OSKit; see the file COPYING. If - * not, write to the FSF, 59 Temple Place #330, Boston, MA 02111-1307, USA. - */ -/* - * Routines necessary for the bsdnet code. - */ - -#include -#include -#include -#include -#include -#include -#include "net/netisr.h" - -int oskit_cpl; /* for machine/spl.h */ -int bootverbose; /* networking code wants to know whether booting - is to be verbose */ -int securelevel = 3; /* used in ip_fw.c:ip_fw_ctl -- make it > 2 */ - -vm_map_t mb_map; /* this is passed in kmem_alloc, but ignored there */ - -struct proc proc0; -struct proc *curproc = &proc0; - -struct domain localdomain; /* see uipc_domain.c ADDDOMAIN macro */ - -/* ---------------------------------------------------------------------- */ - -/* - * find a process by pid - */ -struct proc * -pfind(pid_t pid) -{ - printf("%s called, pid=%d, returning x%p\n", - "pfind", (int)pid, (void*)&proc0); - return &proc0; -} - -/* - * signal a process - */ -void -psignal (struct proc *p, int sig) -{ - printf("%s called, proc=x%p sig=%d\n", "psignal", p, sig); -} - -/* - * signal a process group - */ -void -gsignal (int pgid, int sig) -{ - printf("%s called, pgid=%d sig=%d\n", "gsignal", pgid, sig); -} - -/* ---------------------------------------------------------------------- */ - -/* - * copy in from userspace - */ -int -copyin (void *udaddr, void *kaddr, u_int len) -{ - memcpy(kaddr, udaddr, len); - return 0; -} - -/* - * copy out to userspace - */ -int -copyout (void *kaddr, void *udaddr, u_int len) -{ - memcpy(udaddr, kaddr, len); - return 0; -} - -/* - * even though these functions have an odd signature, - * they only copy one byte - */ -int subyte (void *base, int byte) -{ - return (int)(base = (char *)byte); -} - -int suibyte (void *base, int byte) -{ - return (int)(base = (char *)byte); -} - -/* ---------------------------------------------------------------------- */ - -#ifndef __REACTOS__ -/* - * log some information - */ -void -log (int level, const char *format, ...) -{ - extern int vprintf(const char *, va_list); - va_list args; - va_start(args, format); - printf("__FUNCTION__(%d):", level); - vprintf(format, args); - va_end(args); -} -#endif - -/* ---------------------------------------------------------------------- */ - -/* - * do we have super user credentials? - */ -/* ARGSUSED */ -int -suser(struct ucred *ucred, u_short *acflag) -{ - /* of course. */ - return 0; -} - -/* ---------------------------------------------------------------------- */ -/* - * stuff stolen from kern/kern_sysctl.c - */ -/* - * Validate parameters and get old / set new parameters - * for an integer-valued sysctl function. - */ -int -sysctl_int(oldp, oldlenp, newp, newlen, valp) - void *oldp; - size_t *oldlenp; - void *newp; - size_t newlen; - int *valp; -{ - int error = 0; - - if (oldp && *oldlenp < sizeof(int)) - return (ENOMEM); - if (newp && newlen != sizeof(int)) - return (EINVAL); - *oldlenp = sizeof(int); - if (oldp) - error = copyout(valp, oldp, sizeof(int)); - if (error == 0 && newp) - error = copyin(newp, valp, sizeof(int)); - return (error); -} - -/* - * Validate parameters and get old parameters - * for a structure oriented sysctl function. - */ -int -sysctl_rdstruct(oldp, oldlenp, newp, sp, len) - void *oldp; - size_t *oldlenp; - void *newp, *sp; - int len; -{ - int error = 0; - - if (oldp && *oldlenp < len) - return (ENOMEM); - if (newp) - return (EPERM); - *oldlenp = len; - if (oldp) - error = copyout(sp, oldp, len); - return (error); -} - -int bcmp(const void *b1, const void *b2, size_t len) -{ - return RtlCompareMemory(b1, b2, len); -} - -#ifndef _MSC_VER - -int memcmp(const void *b1, const void *b2, size_t len) -{ - return RtlCompareMemory(b1, b2, len); -} - -#endif diff --git a/lib/drivers/oskittcp/oskittcp/in.c b/lib/drivers/oskittcp/oskittcp/in.c deleted file mode 100644 index 56c6f4fb1c1..00000000000 --- a/lib/drivers/oskittcp/oskittcp/in.c +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)in.c 8.2 (Berkeley) 11/15/93 - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include - -#include - -/* - * This structure is used to keep track of in_multi chains which belong to - * deleted interface addresses. - */ -#ifndef __REACTOS__ -static LIST_HEAD(in_mk_type, multi_kludge) in_mk; /* XXX BSS initialization */ -#endif - -struct multi_kludge { - LIST_ENTRY(multi_kludge) mk_entry; - struct ifnet *mk_ifp; - struct in_multihead mk_head; -}; - -#ifndef SUBNETSARELOCAL -#define SUBNETSARELOCAL 1 -#endif -int subnetsarelocal = SUBNETSARELOCAL; -/* - * Return 1 if an internet address is for a ``local'' host - * (one to which we have a connection). If subnetsarelocal - * is true, this includes other subnets of the local net. - * Otherwise, it includes only the directly-connected (sub)nets. - */ -int -in_localaddr(in) - struct in_addr in; -{ - register u_long i = ntohl(in.s_addr); - register struct in_ifaddr *ia; - - if (subnetsarelocal) { - for (ia = in_ifaddr; ia; ia = ia->ia_next) - if ((i & ia->ia_netmask) == ia->ia_net) - return (1); - } else { - for (ia = in_ifaddr; ia; ia = ia->ia_next) - if ((i & ia->ia_subnetmask) == ia->ia_subnet) - return (1); - } - return (0); -} - -int in_interfaces; /* number of external internet interfaces */ - -/* - * Generic internet control operations (ioctl's). - * Ifp is 0 if not an interface-specific ioctl. - */ -/* ARGSUSED */ -int -in_control(so, cmd, data, ifp) - struct socket *so; - int cmd; - caddr_t data; - register struct ifnet *ifp; -{ - return (0); -} - -/* - * Delete a multicast address record. - */ -void -in_delmulti(inm) - register struct in_multi *inm; -{ -#if 0 - register struct in_multi **p; - struct ifreq ifr; - int s = splnet(); - - if (--inm->inm_refcount == 0) { - /* - * No remaining claims to this record; let IGMP know that - * we are leaving the multicast group. - */ - /* igmp_leavegroup(inm); XXX arty */ - /* - * Unlink from list. - */ - LIST_REMOVE(inm, inm_entry); - - /* - * Notify the network driver to update its multicast reception - * filter. - */ - ((struct sockaddr_in *)&(ifr.ifr_addr))->sin_family = AF_INET; - ((struct sockaddr_in *)&(ifr.ifr_addr))->sin_addr = - inm->inm_addr; - (*inm->inm_ifp->if_ioctl)(inm->inm_ifp, SIOCDELMULTI, - (caddr_t)&ifr); - free(inm, M_IPMADDR); - } - splx(s); -#endif -} diff --git a/lib/drivers/oskittcp/oskittcp/in_cksum.c b/lib/drivers/oskittcp/oskittcp/in_cksum.c deleted file mode 100644 index 25a567532f6..00000000000 --- a/lib/drivers/oskittcp/oskittcp/in_cksum.c +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright (c) 1988, 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)in_cksum.c 8.1 (Berkeley) 6/10/93 - */ - -#include -#include -#include - -/* - * Checksum routine for Internet Protocol family headers (Portable Version). - * - * This routine is very heavily used in the network - * code and should be modified for each CPU to be as fast as possible. - */ - -#define ADDCARRY(x) (x > 65535 ? x -= 65535 : x) -#define REDUCE {l_util.l = sum; sum = l_util.s[0] + l_util.s[1]; ADDCARRY(sum);} - -int -in_cksum(m, len) - register struct mbuf *m; - register int len; -{ - register u_short *w; - register int sum = 0; - register int mlen = 0; - int byte_swapped = 0; - - union { - char c[2]; - u_short s; - } s_util; - union { - u_short s[2]; - long l; - } l_util; - - for (;m && len; m = m->m_next) { - if (m->m_len == 0) - continue; - w = mtod(m, u_short *); - if (mlen == -1) { - /* - * The first byte of this mbuf is the continuation - * of a word spanning between this mbuf and the - * last mbuf. - * - * s_util.c[0] is already saved when scanning previous - * mbuf. - */ - s_util.c[1] = *(char *)w; - sum += s_util.s; - w = (u_short *)((char *)w + 1); - mlen = m->m_len - 1; - len--; - } else - mlen = m->m_len; - if (len < mlen) - mlen = len; - len -= mlen; - /* - * Force to even boundary. - */ - if ((1 & (int) w) && (mlen > 0)) { - REDUCE; - sum <<= 8; - s_util.c[0] = *(u_char *)w; - w = (u_short *)((char *)w + 1); - mlen--; - byte_swapped = 1; - } - /* - * Unroll the loop to make overhead from - * branches &c small. - */ - while ((mlen -= 32) >= 0) { - sum += w[0]; sum += w[1]; sum += w[2]; sum += w[3]; - sum += w[4]; sum += w[5]; sum += w[6]; sum += w[7]; - sum += w[8]; sum += w[9]; sum += w[10]; sum += w[11]; - sum += w[12]; sum += w[13]; sum += w[14]; sum += w[15]; - w += 16; - } - mlen += 32; - while ((mlen -= 8) >= 0) { - sum += w[0]; sum += w[1]; sum += w[2]; sum += w[3]; - w += 4; - } - mlen += 8; - if (mlen == 0 && byte_swapped == 0) - continue; - REDUCE; - while ((mlen -= 2) >= 0) { - sum += *w++; - } - if (byte_swapped) { - REDUCE; - sum <<= 8; - byte_swapped = 0; - if (mlen == -1) { - s_util.c[1] = *(char *)w; - sum += s_util.s; - mlen = 0; - } else - mlen = -1; - } else if (mlen == -1) - s_util.c[0] = *(char *)w; - } - if (len) { - panic("cksum: out of data: need %d bytes\n", len); - } - if (mlen == -1) { - /* The last mbuf has odd # of bytes. Follow the - standard (the odd byte may be shifted left by 8 bits - or not as determined by endian-ness of the machine) */ - s_util.c[1] = 0; - sum += s_util.s; - } - REDUCE; - return (~sum & 0xffff); -} diff --git a/lib/drivers/oskittcp/oskittcp/in_pcb.c b/lib/drivers/oskittcp/oskittcp/in_pcb.c deleted file mode 100644 index d90a9645b21..00000000000 --- a/lib/drivers/oskittcp/oskittcp/in_pcb.c +++ /dev/null @@ -1,671 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1991, 1993, 1995 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)in_pcb.c 8.2 (Berkeley) 1/4/94 - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include - -#include - -struct in_addr zeroin_addr; - -int -in_pcballoc(so, pcbinfo) - struct socket *so; - struct inpcbinfo *pcbinfo; -{ - register struct inpcb *inp; - int s; - - MALLOC(inp, struct inpcb *, sizeof(*inp), M_PCB, M_NOWAIT); - if (inp == NULL) - return (ENOBUFS); - bzero((caddr_t)inp, sizeof(*inp)); - inp->inp_pcbinfo = pcbinfo; - inp->inp_socket = so; - s = splnet(); - LIST_INSERT_HEAD(pcbinfo->listhead, inp, inp_list); - in_pcbinshash(inp); - splx(s); - so->so_pcb = (caddr_t)inp; - return (0); -} - -int -in_pcbbind(inp, nam) - register struct inpcb *inp; - struct mbuf *nam; -{ - register struct socket *so = inp->inp_socket; - struct inpcbhead *head = inp->inp_pcbinfo->listhead; - unsigned short *lastport = &inp->inp_pcbinfo->lastport; - struct sockaddr_in *sin; -#ifndef __REACTOS__ - struct proc *p = curproc; /* XXX */ -#endif - u_short lport = 0; - int wild = 0, reuseport = (so->so_options & SO_REUSEPORT); -#ifndef __REACTOS__ - int error; -#endif - - OS_DbgPrint(OSK_MID_TRACE,("Called\n")); - - if( nam ) OskitDumpBuffer((OSK_PCHAR)nam->m_data, nam->m_len ); - -#ifndef __REACTOS__ - if (in_ifaddr == 0) { - OS_DbgPrint(OSK_MID_TRACE,("Leaving EADDRNOTAVAIL\n")); - return (EADDRNOTAVAIL); - } -#endif - if (inp->inp_lport || inp->inp_laddr.s_addr != INADDR_ANY) - return (EINVAL); - if ((so->so_options & (SO_REUSEADDR|SO_REUSEPORT)) == 0 && - ((so->so_proto->pr_flags & PR_CONNREQUIRED) == 0 || - (so->so_options & SO_ACCEPTCONN) == 0)) - wild = INPLOOKUP_WILDCARD; - if (nam) { - sin = mtod(nam, struct sockaddr_in *); - if (nam->m_len != sizeof (*sin)) { - OS_DbgPrint(OSK_MID_TRACE,("Leaving EINVAL\n")); - return (EINVAL); - } -#ifdef notdef - /* - * We should check the family, but old programs - * incorrectly fail to initialize it. - */ - if (sin->sin_family != AF_INET) { - OS_DbgPrint(OSK_MID_TRACE,("Leaving EAFNOSUPPORT\n")); - return (EAFNOSUPPORT); - } -#endif - lport = sin->sin_port; - if (IN_MULTICAST(ntohl(sin->sin_addr.s_addr))) { - /* - * Treat SO_REUSEADDR as SO_REUSEPORT for multicast; - * allow complete duplication of binding if - * SO_REUSEPORT is set, or if SO_REUSEADDR is set - * and a multicast address is bound on both - * new and duplicated sockets. - */ - if (so->so_options & SO_REUSEADDR) - reuseport = SO_REUSEADDR|SO_REUSEPORT; - } else if (sin->sin_addr.s_addr != INADDR_ANY) { - sin->sin_port = 0; /* yech... */ - OS_DbgPrint(OSK_MID_TRACE,("Calling ifwithaddr\n")); - if (ifa_ifwithaddr((struct sockaddr *)sin) == 0) { - OS_DbgPrint(OSK_MID_TRACE, - ("Leaving EADDRNOTAVAIL\n")); - return (EADDRNOTAVAIL); - } - OS_DbgPrint(OSK_MID_TRACE,("Yep, we have that addr\n")); - } - if (lport) { - struct inpcb *t; - -#ifndef __REACTOS__ - /* GROSS */ - if (ntohs(lport) < IPPORT_RESERVED && - (error = suser(p->p_ucred, &p->p_acflag))) { - OS_DbgPrint(OSK_MID_TRACE, - ("Leaving EACCESS\n")); - return (EACCES); - } -#endif - t = in_pcblookup(head, zeroin_addr, 0, - sin->sin_addr, lport, wild); - if (t && (reuseport & t->inp_socket->so_options) == 0) - { - OS_DbgPrint(OSK_MID_TRACE, - ("Leaving EADDRINUSE\n")); - return (EADDRINUSE); - } - } - inp->inp_laddr = sin->sin_addr; - } - if (lport == 0) - do { - ++*lastport; - OS_DbgPrint(OSK_MID_TRACE,("Finding port %d\n", - *lastport)); - if (*lastport < IPPORT_RESERVED || - *lastport > IPPORT_USERRESERVED) - *lastport = IPPORT_RESERVED; - lport = htons(*lastport); - } while (in_pcblookup(head, - zeroin_addr, 0, inp->inp_laddr, - lport, wild)); - inp->inp_lport = lport; - in_pcbrehash(inp); - - OS_DbgPrint(OSK_MID_TRACE,("Returning success\n")); - return (0); -} - -/* - * Transform old in_pcbconnect() into an inner subroutine for new - * in_pcbconnect(): Do some validity-checking on the remote - * address (in mbuf 'nam') and then determine local host address - * (i.e., which interface) to use to access that remote host. - * - * This preserves definition of in_pcbconnect(), while supporting a - * slightly different version for T/TCP. (This is more than - * a bit of a kludge, but cleaning up the internal interfaces would - * have forced minor changes in every protocol). - */ - -int -in_pcbladdr(inp, nam, plocal_sin) - register struct inpcb *inp; - struct mbuf *nam; - struct sockaddr_in **plocal_sin; -{ - struct in_ifaddr *ia; -#ifndef __REACTOS__ - struct sockaddr_in *ifaddr = 0; -#endif - register struct sockaddr_in *sin = mtod(nam, struct sockaddr_in *); - - OS_DbgPrint(OSK_MID_TRACE,("Called\n")); - - if (nam->m_len != sizeof (*sin)) - return (EINVAL); - if (sin->sin_family != AF_INET) - return (EAFNOSUPPORT); - if (sin->sin_port == 0) - return (EADDRNOTAVAIL); - if (in_ifaddr) { - /* - * If the destination address is INADDR_ANY, - * use the primary local address. - * If the supplied address is INADDR_BROADCAST, - * and the primary interface supports broadcast, - * choose the broadcast address for that interface. - */ -#define satosin(sa) ((struct sockaddr_in *)(sa)) -#define sintosa(sin) ((struct sockaddr *)(sin)) -#define ifatoia(ifa) ((struct in_ifaddr *)(ifa)) - if (sin->sin_addr.s_addr == INADDR_ANY) - sin->sin_addr = IA_SIN(in_ifaddr)->sin_addr; -#ifndef __REACTOS__ - else if (sin->sin_addr.s_addr == (u_long)INADDR_BROADCAST && - (in_ifaddr->ia_ifp->if_flags & IFF_BROADCAST)) - sin->sin_addr = satosin(&in_ifaddr->ia_broadaddr)->sin_addr; -#endif - } - if (inp->inp_laddr.s_addr == INADDR_ANY) { - register struct route *ro; - - ia = (struct in_ifaddr *)0; - /* - * If route is known or can be allocated now, - * our src addr is taken from the i/f, else punt. - */ - ro = &inp->inp_route; - if (ro->ro_rt && - (satosin(&ro->ro_dst)->sin_addr.s_addr != - sin->sin_addr.s_addr || - inp->inp_socket->so_options & SO_DONTROUTE)) { - RTFREE(ro->ro_rt); - ro->ro_rt = (struct rtentry *)0; - } - if ((inp->inp_socket->so_options & SO_DONTROUTE) == 0 && /*XXX*/ - (ro->ro_rt == (struct rtentry *)0 || - ro->ro_rt->rt_ifp == (struct ifnet *)0)) { - /* No route yet, so try to acquire one */ - ro->ro_dst.sa_family = AF_INET; - ro->ro_dst.sa_len = sizeof(struct sockaddr_in); - ((struct sockaddr_in *) &ro->ro_dst)->sin_addr = - sin->sin_addr; - rtalloc(ro); - } - /* - * If we found a route, use the address - * corresponding to the outgoing interface - * unless it is the loopback (in case a route - * to our address on another net goes to loopback). - */ - if (ro->ro_rt && !(ro->ro_rt->rt_ifp->if_flags & IFF_LOOPBACK)) - ia = ifatoia(ro->ro_rt->rt_ifa); - if (ia == 0) { - u_short fport = sin->sin_port; - - sin->sin_port = 0; - ia = ifatoia(ifa_ifwithdstaddr(sintosa(sin))); - - if (ia == 0) - ia = ifatoia(ifa_ifwithnet(sintosa(sin))); - sin->sin_port = fport; - if (ia == 0) - ia = in_ifaddr; - if (ia == 0) - return (EADDRNOTAVAIL); - } - /* - * If the destination address is multicast and an outgoing - * interface has been set as a multicast option, use the - * address of that interface as our source address. - */ -#ifndef __REACTOS__ - if (IN_MULTICAST(ntohl(sin->sin_addr.s_addr)) && - inp->inp_moptions != NULL) { - struct ip_moptions *imo; - struct ifnet *ifp; - - imo = inp->inp_moptions; - if (imo->imo_multicast_ifp != NULL) { - ifp = imo->imo_multicast_ifp; - for (ia = in_ifaddr; ia; ia = ia->ia_next) - if (ia->ia_ifp == ifp) - break; - if (ia == 0) - return (EADDRNOTAVAIL); - } - } -#endif - /* - * Don't do pcblookup call here; return interface in plocal_sin - * and exit to caller, that will do the lookup. - */ - *plocal_sin = (struct sockaddr_in *)ia->ia_ifa.ifa_addr; - OS_DbgPrint(OSK_MID_TRACE,("plocal sin %x\n", - (*plocal_sin)->sin_addr.s_addr)); - - } - return(0); -} - -/* - * Outer subroutine: - * Connect from a socket to a specified address. - * Both address and port must be specified in argument sin. - * If don't have a local address for this socket yet, - * then pick one. - */ -int -in_pcbconnect(inp, nam) - register struct inpcb *inp; - struct mbuf *nam; -{ - struct sockaddr_in *ifaddr; - register struct sockaddr_in *sin = mtod(nam, struct sockaddr_in *); - int error; - - /* - * Call inner routine, to assign local interface address. - */ - if ((error = in_pcbladdr(inp, nam, &ifaddr))) - return(error); - - if (in_pcblookuphash(inp->inp_pcbinfo, sin->sin_addr, sin->sin_port, - inp->inp_laddr.s_addr ? inp->inp_laddr : ifaddr->sin_addr, - inp->inp_lport) != NULL) - return (EADDRINUSE); - if (inp->inp_laddr.s_addr == INADDR_ANY) { - if (inp->inp_lport == 0) - (void)in_pcbbind(inp, (struct mbuf *)0); - inp->inp_laddr = ifaddr->sin_addr; - } - inp->inp_faddr = sin->sin_addr; - inp->inp_fport = sin->sin_port; - in_pcbrehash(inp); - return (0); -} - -void -in_pcbdisconnect(inp) - struct inpcb *inp; -{ - - inp->inp_faddr.s_addr = INADDR_ANY; - inp->inp_fport = 0; - in_pcbrehash(inp); - if (inp->inp_socket->so_state & SS_NOFDREF) - in_pcbdetach(inp); -} - -void -in_pcbdetach(inp) - struct inpcb *inp; -{ - struct socket *so = inp->inp_socket; - int s; - - so->so_pcb = 0; - sofree(so); - if (inp->inp_options) - (void)m_free(inp->inp_options); - if (inp->inp_route.ro_rt) - rtfree(inp->inp_route.ro_rt); - ip_freemoptions(inp->inp_moptions); - s = splnet(); - LIST_REMOVE(inp, inp_hash); - LIST_REMOVE(inp, inp_list); - splx(s); - FREE(inp, M_PCB); -} - -void -in_setsockaddr(inp, nam) - register struct inpcb *inp; - struct mbuf *nam; -{ - register struct sockaddr_in *sin; - - nam->m_len = sizeof (*sin); - sin = mtod(nam, struct sockaddr_in *); - bzero((caddr_t)sin, sizeof (*sin)); - sin->sin_family = AF_INET; - sin->sin_len = sizeof(*sin); - sin->sin_port = inp->inp_lport; - sin->sin_addr = inp->inp_laddr; -} - -void -in_setpeeraddr(inp, nam) - struct inpcb *inp; - struct mbuf *nam; -{ - register struct sockaddr_in *sin; - - nam->m_len = sizeof (*sin); - sin = mtod(nam, struct sockaddr_in *); - bzero((caddr_t)sin, sizeof (*sin)); - sin->sin_family = AF_INET; - sin->sin_len = sizeof(*sin); - sin->sin_port = inp->inp_fport; - sin->sin_addr = inp->inp_faddr; -} - -/* - * Pass some notification to all connections of a protocol - * associated with address dst. The local address and/or port numbers - * may be specified to limit the search. The "usual action" will be - * taken, depending on the ctlinput cmd. The caller must filter any - * cmds that are uninteresting (e.g., no error in the map). - * Call the protocol specific routine (if any) to report - * any errors for each matching socket. - * - * Must be called at splnet. - */ -void -in_pcbnotify(head, dst, fport_arg, laddr, lport_arg, cmd, notify) - struct inpcbhead *head; - struct sockaddr *dst; - u_int fport_arg, lport_arg; - struct in_addr laddr; - int cmd; - void (*notify) __P((struct inpcb *, int)); -{ - register struct inpcb *inp, *oinp; - struct in_addr faddr; - u_short fport = fport_arg, lport = lport_arg; - int errno, s; - - if ((unsigned)cmd > PRC_NCMDS || dst->sa_family != AF_INET) - return; - faddr = ((struct sockaddr_in *)dst)->sin_addr; - if (faddr.s_addr == INADDR_ANY) - return; - - /* - * Redirects go to all references to the destination, - * and use in_rtchange to invalidate the route cache. - * Dead host indications: notify all references to the destination. - * Otherwise, if we have knowledge of the local port and address, - * deliver only to that socket. - */ - if (PRC_IS_REDIRECT(cmd) || cmd == PRC_HOSTDEAD) { - fport = 0; - lport = 0; - laddr.s_addr = 0; - if (cmd != PRC_HOSTDEAD) - notify = in_rtchange; - } - errno = inetctlerrmap[cmd]; - s = splnet(); - for (inp = head->lh_first; inp != NULL;) { - if (inp->inp_faddr.s_addr != faddr.s_addr || - inp->inp_socket == 0 || - (lport && inp->inp_lport != lport) || - (laddr.s_addr && inp->inp_laddr.s_addr != laddr.s_addr) || - (fport && inp->inp_fport != fport)) { - inp = inp->inp_list.le_next; - continue; - } - oinp = inp; - inp = inp->inp_list.le_next; - if (notify) - (*notify)(oinp, errno); - } - splx(s); -} - -/* - * Check for alternatives when higher level complains - * about service problems. For now, invalidate cached - * routing information. If the route was created dynamically - * (by a redirect), time to try a default gateway again. - */ -void -in_losing(inp) - struct inpcb *inp; -{ - register struct rtentry *rt; - struct rt_addrinfo info; - - if ((rt = inp->inp_route.ro_rt)) { - inp->inp_route.ro_rt = 0; - bzero((caddr_t)&info, sizeof(info)); - info.rti_info[RTAX_DST] = - (struct sockaddr *)&inp->inp_route.ro_dst; - info.rti_info[RTAX_GATEWAY] = rt->rt_gateway; - info.rti_info[RTAX_NETMASK] = rt_mask(rt); - rt_missmsg(RTM_LOSING, &info, rt->rt_flags, 0); - if (rt->rt_flags & RTF_DYNAMIC) - (void) rtrequest(RTM_DELETE, rt_key(rt), - rt->rt_gateway, rt_mask(rt), rt->rt_flags, - (struct rtentry **)0); - else - /* - * A new route can be allocated - * the next time output is attempted. - */ - rtfree(rt); - } -} - -/* - * After a routing change, flush old routing - * and allocate a (hopefully) better one. - */ -void -in_rtchange(inp, errno) - register struct inpcb *inp; - int errno; -{ - if (inp->inp_route.ro_rt) { - rtfree(inp->inp_route.ro_rt); - inp->inp_route.ro_rt = 0; - /* - * A new route can be allocated the next time - * output is attempted. - */ - } -} - -struct inpcb * -in_pcblookup(head, faddr, fport_arg, laddr, lport_arg, flags) - struct inpcbhead *head; - struct in_addr faddr, laddr; - u_int fport_arg, lport_arg; - int flags; -{ - register struct inpcb *inp, *match = NULL; - int matchwild = 3, wildcard; - u_short fport = fport_arg, lport = lport_arg; - int s; - - s = splnet(); - - for (inp = head->lh_first; inp != NULL; inp = inp->inp_list.le_next) { - if (inp->inp_lport != lport) - continue; - wildcard = 0; - if (inp->inp_faddr.s_addr != INADDR_ANY) { - if (faddr.s_addr == INADDR_ANY) - wildcard++; - else if (inp->inp_faddr.s_addr != faddr.s_addr || - inp->inp_fport != fport) - continue; - } else { - if (faddr.s_addr != INADDR_ANY) - wildcard++; - } - if (inp->inp_laddr.s_addr != INADDR_ANY) { - if (laddr.s_addr == INADDR_ANY) - wildcard++; - else if (inp->inp_laddr.s_addr != laddr.s_addr) - continue; - } else { - if (laddr.s_addr != INADDR_ANY) - wildcard++; - } - if (wildcard && (flags & INPLOOKUP_WILDCARD) == 0) - continue; - if (wildcard < matchwild) { - match = inp; - matchwild = wildcard; - if (matchwild == 0) { - break; - } - } - } - splx(s); - return (match); -} - -/* - * Lookup PCB in hash list. - */ -struct inpcb * -in_pcblookuphash(pcbinfo, faddr, fport_arg, laddr, lport_arg) - struct inpcbinfo *pcbinfo; - struct in_addr faddr, laddr; - u_int fport_arg, lport_arg; -{ - struct inpcbhead *head; - register struct inpcb *inp; - u_short fport = fport_arg, lport = lport_arg; - int s; - - s = splnet(); - /* - * First look for an exact match. - */ - head = &pcbinfo->hashbase[(faddr.s_addr + lport + fport) % pcbinfo->hashsize]; - - for (inp = head->lh_first; inp != NULL; inp = inp->inp_hash.le_next) { - if (inp->inp_faddr.s_addr != faddr.s_addr || - inp->inp_fport != fport || - inp->inp_lport != lport || - inp->inp_laddr.s_addr != laddr.s_addr) - continue; - /* - * Move PCB to head of this hash chain so that it can be - * found more quickly in the future. - */ - if (inp != head->lh_first) { - LIST_REMOVE(inp, inp_hash); - LIST_INSERT_HEAD(head, inp, inp_hash); - } - break; - } - splx(s); - return (inp); -} - -/* - * Insert PCB into hash chain. Must be called at splnet. - */ -void -in_pcbinshash(inp) - struct inpcb *inp; -{ - struct inpcbhead *head; - - head = &inp->inp_pcbinfo->hashbase[(inp->inp_faddr.s_addr + - inp->inp_lport + inp->inp_fport) % inp->inp_pcbinfo->hashsize]; - - LIST_INSERT_HEAD(head, inp, inp_hash); -} - -void -in_pcbrehash(inp) - struct inpcb *inp; -{ - struct inpcbhead *head; - int s; - - s = splnet(); - LIST_REMOVE(inp, inp_hash); - - head = &inp->inp_pcbinfo->hashbase[(inp->inp_faddr.s_addr + - inp->inp_lport + inp->inp_fport) % inp->inp_pcbinfo->hashsize]; - - LIST_INSERT_HEAD(head, inp, inp_hash); - splx(s); -} diff --git a/lib/drivers/oskittcp/oskittcp/in_proto.c b/lib/drivers/oskittcp/oskittcp/in_proto.c deleted file mode 100644 index 8d2022e0d75..00000000000 --- a/lib/drivers/oskittcp/oskittcp/in_proto.c +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * From: @(#)in_proto.c 8.1 (Berkeley) 6/10/93 - */ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef TCPDEBUG -#include -#endif -#include -#include -/* - * TCP/IP protocol family: IP, ICMP, UDP, TCP. - */ - -#ifdef NSIP -void idpip_input(), nsip_ctlinput(); -#endif - -#ifdef TPIP -void tpip_input(), tpip_ctlinput(), tp_ctloutput(); -int tp_init(), tp_slowtimo(), tp_drain(), tp_usrreq(); -#endif - -#ifdef EON -void eoninput(), eonctlinput(), eonprotoinit(); -#endif /* EON */ - -void rsvp_input(struct mbuf *, int); -void ipip_input(struct mbuf *, int); - -extern struct domain inetdomain; - -struct protosw inetsw[] = { -{ SOCK_STREAM, &inetdomain, IPPROTO_TCP, - PR_CONNREQUIRED|PR_IMPLOPCL|PR_WANTRCVD, - tcp_input, 0, tcp_ctlinput, tcp_ctloutput, - tcp_usrreq, - tcp_init, tcp_fasttimo, tcp_slowtimo, tcp_drain, tcp_sysctl -}, -}; - -extern int in_inithead(void **, int); - -struct domain inetdomain = - { AF_INET, "internet", 0, 0, 0, - inetsw, &inetsw[sizeof(inetsw)/sizeof(inetsw[0])], 0, - in_inithead, 32, sizeof(struct sockaddr_in) - }; - -DOMAIN_SET(inet); - -#include "imp.h" -#if NIMP > 0 -extern struct domain impdomain; -int rimp_output(), hostslowtimo(); - -struct protosw impsw[] = { -{ SOCK_RAW, &impdomain, 0, PR_ATOMIC|PR_ADDR, - 0, rimp_output, 0, 0, - rip_usrreq, - 0, 0, hostslowtimo, 0, -}, -}; - -struct domain impdomain = - { AF_IMPLINK, "imp", 0, 0, 0, - impsw, &impsw[sizeof (impsw)/sizeof(impsw[0])] }; - -DOMAIN_SET(imp); - -#endif - -#if 0 -#include "hy.h" -#if NHY > 0 -/* - * HYPERchannel protocol family: raw interface. - */ -int rhy_output(); -extern struct domain hydomain; - -struct protosw hysw[] = { -{ SOCK_RAW, &hydomain, 0, PR_ATOMIC|PR_ADDR, - 0, rhy_output, 0, 0, - rip_usrreq, - 0, 0, 0, 0, -}, -}; - -struct domain hydomain = - { AF_HYLINK, "hy", 0, 0, 0, hysw, &hysw[sizeof (hysw)/sizeof(hysw[0])] }; - -DOMAIN_SET(hy); -#endif -#endif diff --git a/lib/drivers/oskittcp/oskittcp/in_rmx.c b/lib/drivers/oskittcp/oskittcp/in_rmx.c deleted file mode 100644 index ce8d1b0e2d1..00000000000 --- a/lib/drivers/oskittcp/oskittcp/in_rmx.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright 1994, 1995 Massachusetts Institute of Technology - * - * Permission to use, copy, modify, and distribute this software and - * its documentation for any purpose and without fee is hereby - * granted, provided that both the above copyright notice and this - * permission notice appear in all copies, that both the above - * copyright notice and this permission notice appear in all - * supporting documentation, and that the name of M.I.T. not be used - * in advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. M.I.T. makes - * no representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied - * warranty. - * - * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS - * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT - * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -/* - * This code does two things necessary for the enhanced TCP metrics to - * function in a useful manner: - * 1) It marks all non-host routes as `cloning', thus ensuring that - * every actual reference to such a route actually gets turned - * into a reference to a host route to the specific destination - * requested. - * 2) When such routes lose all their references, it arranges for them - * to be deleted in some random collection of circumstances, so that - * a large quantity of stale routing data is not kept in kernel memory - * indefinitely. See in_rtqtimo() below for the exact mechanism. - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include - -/* - * Initialize our routing tree. - */ -int -in_inithead(void **head, int off) -{ - struct radix_node_head *rnh; - - if(!rn_inithead(head, off)) - return 0; - - if(head != (void **)&rt_tables[AF_INET]) /* BOGUS! */ - return 1; /* only do this for the real routing table */ - - rnh = *head; -#if 0 - rnh->rnh_addaddr = in_addroute; - rnh->rnh_matchaddr = in_matroute; - rnh->rnh_close = in_clsroute; - in_rtqtimo(rnh); /* kick off timeout first time */ -#endif - return 1; -} - diff --git a/lib/drivers/oskittcp/oskittcp/inet_ntoa.c b/lib/drivers/oskittcp/oskittcp/inet_ntoa.c deleted file mode 100644 index d25dff83f84..00000000000 --- a/lib/drivers/oskittcp/oskittcp/inet_ntoa.c +++ /dev/null @@ -1,51 +0,0 @@ - -/* - * Copyright 1994, 1995 Massachusetts Institute of Technology - * - * Permission to use, copy, modify, and distribute this software and - * its documentation for any purpose and without fee is hereby - * granted, provided that both the above copyright notice and this - * permission notice appear in all copies, that both the above - * copyright notice and this permission notice appear in all - * supporting documentation, and that the name of M.I.T. not be used - * in advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. M.I.T. makes - * no representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied - * warranty. - * - * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS - * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT - * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#include - -#include - -#ifndef __REACTOS__ -char * -inet_ntoa(struct in_addr ina) -{ - static char buf[4*sizeof "123"]; - unsigned char *ucp = (unsigned char *)&ina; - - sprintf(buf, "%d.%d.%d.%d", - ucp[0] & 0xff, - ucp[1] & 0xff, - ucp[2] & 0xff, - ucp[3] & 0xff); - return buf; -} - -#endif diff --git a/lib/drivers/oskittcp/oskittcp/interface.c b/lib/drivers/oskittcp/oskittcp/interface.c deleted file mode 100644 index 9205757f8c8..00000000000 --- a/lib/drivers/oskittcp/oskittcp/interface.c +++ /dev/null @@ -1,715 +0,0 @@ -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -struct linker_set domain_set; - -OSKITTCP_EVENT_HANDLERS OtcpEvent = { 0 }; - -//OSK_UINT OskitDebugTraceLevel = OSK_DEBUG_ULTRA; -OSK_UINT OskitDebugTraceLevel = 0; - -KSPIN_LOCK OSKLock; - -/* SPL */ -unsigned cpl; -unsigned net_imask; -unsigned volatile ipending; -struct timeval boottime; - -void clock_init(); -int _snprintf(char * buf, size_t cnt, const char *fmt, ...); - -void *fbsd_malloc( unsigned int bytes, char *file, unsigned line, ... ) { - if( !OtcpEvent.TCPMalloc ) panic("no malloc"); - return OtcpEvent.TCPMalloc - ( OtcpEvent.ClientData, (OSK_UINT)bytes, (OSK_PCHAR)file, line ); -} - -void fbsd_free( void *data, char *file, unsigned line, ... ) { - if( !OtcpEvent.TCPFree ) panic("no free"); - OtcpEvent.TCPFree( OtcpEvent.ClientData, data, (OSK_PCHAR)file, line ); -} - -void InitOskitTCP() { - OS_DbgPrint(OSK_MID_TRACE,("Init Called\n")); - KeInitializeSpinLock(&OSKLock); - OS_DbgPrint(OSK_MID_TRACE,("Rawip Init\n")); - rip_init(); - raw_init(); - OS_DbgPrint(OSK_MID_TRACE,("Route Init\n")); - route_init(); - OS_DbgPrint(OSK_MID_TRACE,("Init clock\n")); - clock_init(); - OS_DbgPrint(OSK_MID_TRACE,("Init TCP\n")); - tcp_init(); - OS_DbgPrint(OSK_MID_TRACE,("Init routing\n")); - domaininit(); - OS_DbgPrint(OSK_MID_TRACE,("Init Finished\n")); - tcp_iss = 1024; -} - -void DeinitOskitTCP() { -} - -void TimerOskitTCP( int FastTimer, int SlowTimer ) { - KIRQL OldIrql; - - /* This function is a special case in which we cannot use OSKLock/OSKUnlock - * because we don't enter with the connection lock held */ - - OSKLockAndRaise(&OldIrql); - if ( SlowTimer ) { - tcp_slowtimo(); - } - if ( FastTimer ) { - tcp_fasttimo(); - } - OSKUnlockAndLower(OldIrql); -} - -void RegisterOskitTCPEventHandlers( POSKITTCP_EVENT_HANDLERS EventHandlers ) { - memcpy( &OtcpEvent, EventHandlers, sizeof(OtcpEvent) ); -} - -void OskitDumpBuffer( OSK_PCHAR Data, OSK_UINT Len ) -{ - unsigned int i; - char line[81]; - static const char* hex = "0123456789abcdef"; - - for ( i = 0; i < Len; i++ ) - { - int align = i & 0xf; - int align3 = (align<<1) + align; - unsigned char c = Data[i]; - if ( !align ) - { - if ( i ) DbgPrint( line ); - _snprintf ( line, sizeof(line)-1, "%08x: \n", &Data[i] ); - line[sizeof(line)-1] = '\0'; - } - - line[10+align3] = hex[(c>>4)&0xf]; - line[11+align3] = hex[c&0xf]; - if ( !isprint(c) ) - c = '.'; - line[59+align] = c; - } - if ( Len & 0xf ) - DbgPrint ( line ); -} - -void InitializeSocketFlags(struct socket *so) -{ - so->so_state |= SS_NBIO; - so->so_options |= SO_DONTROUTE; -} - -/* From uipc_syscalls.c */ - -int OskitTCPSocket( void *context, - void **aso, - int domain, - int type, - int proto ) -{ - struct socket *so; - int error ; - - OSKLock(); - error = socreate(domain, &so, type, proto); - if( !error ) { - so->so_connection = context; - InitializeSocketFlags(so); - *aso = so; - } - OSKUnlock(); - - return error; -} - -int OskitTCPRecv( void *connection, - OSK_PCHAR Data, - OSK_UINT Len, - OSK_UINT *OutLen, - OSK_UINT Flags ) { - struct uio uio = { 0 }; - struct iovec iov = { 0 }; - int error = 0; - int tcp_flags = 0; - - if (!connection) - return OSK_ESHUTDOWN; - - OS_DbgPrint(OSK_MID_TRACE, - ("so->so_state %x\n", ((struct socket *)connection)->so_state)); - - if( Flags & OSK_MSG_OOB ) tcp_flags |= MSG_OOB; - if( Flags & OSK_MSG_DONTWAIT ) tcp_flags |= MSG_DONTWAIT; - if( Flags & OSK_MSG_PEEK ) tcp_flags |= MSG_PEEK; - - iov.iov_len = Len; - iov.iov_base = (char *)Data; - uio.uio_iov = &iov; - uio.uio_iovcnt = 1; - uio.uio_offset = 0; - uio.uio_resid = Len; - uio.uio_segflg = UIO_SYSSPACE; - uio.uio_rw = UIO_READ; - uio.uio_procp = NULL; - - OS_DbgPrint(OSK_MID_TRACE,("Reading %d bytes from TCP:\n", Len)); - - OSKLock(); - error = soreceive( connection, NULL, &uio, NULL, NULL /* SCM_RIGHTS */, - &tcp_flags ); - OSKUnlock(); - - if (error == 0) *OutLen = Len - uio.uio_resid; - - return error; -} - -int OskitTCPBind( void *socket, - void *nam, OSK_UINT namelen ) { - int error = EFAULT; - struct socket *so = socket; - struct mbuf sabuf; - struct sockaddr addr; - - OS_DbgPrint(OSK_MID_TRACE,("Called, socket = %08x\n", socket)); - - if (!socket) - return OSK_ESHUTDOWN; - - if( nam ) - addr = *((struct sockaddr *)nam); - - RtlZeroMemory(&sabuf, sizeof(sabuf)); - sabuf.m_data = (void *)&addr; - sabuf.m_len = sizeof(addr); - - addr.sa_family = addr.sa_len; - addr.sa_len = sizeof(struct sockaddr); - - OSKLock(); - error = sobind(so, &sabuf); - OSKUnlock(); - - OS_DbgPrint(OSK_MID_TRACE,("Ending: %08x\n", error)); - return (error); -} - -int OskitTCPConnect( void *socket, void *nam, OSK_UINT namelen ) { - struct socket *so = socket; - int error = EFAULT; - struct mbuf sabuf; - struct sockaddr addr; - - OS_DbgPrint(OSK_MID_TRACE,("Called, socket = %08x\n", socket)); - - if (!socket) - return OSK_ESHUTDOWN; - - OS_DbgPrint(OSK_MIN_TRACE,("Nam: %x\n", nam)); - - if( nam ) - addr = *((struct sockaddr *)nam); - - RtlZeroMemory(&sabuf, sizeof(sabuf)); - sabuf.m_data = (void *)&addr; - sabuf.m_len = sizeof(addr); - - addr.sa_family = addr.sa_len; - addr.sa_len = sizeof(struct sockaddr); - - OSKLock(); - error = soconnect(so, &sabuf); - OSKUnlock(); - - if (error == 0) error = OSK_EINPROGRESS; - - OS_DbgPrint(OSK_MID_TRACE,("Ending: %08x\n", error)); - return (error); -} - -int OskitTCPDisconnect(void *socket) -{ - int error; - - if (!socket) - return OSK_ESHUTDOWN; - - OSKLock(); - error = sodisconnect(socket); - OSKUnlock(); - - return error; -} - -int OskitTCPShutdown( void *socket, int disconn_type ) { - int error; - - if (!socket) - return OSK_ESHUTDOWN; - - OSKLock(); - error = soshutdown( socket, disconn_type ); - OSKUnlock(); - - return error; -} - -int OskitTCPClose( void *socket ) { - int error; - - if (!socket) - return OSK_ESHUTDOWN; - - OSKLock(); - error = soclose( socket ); - OSKUnlock(); - - return error; -} - -int OskitTCPSend( void *socket, OSK_PCHAR Data, OSK_UINT Len, - OSK_UINT *OutLen, OSK_UINT flags ) { - int error; - struct uio uio; - struct iovec iov; - - if (!socket) - return OSK_ESHUTDOWN; - - iov.iov_len = Len; - iov.iov_base = (char *)Data; - uio.uio_iov = &iov; - uio.uio_iovcnt = 1; - uio.uio_offset = 0; - uio.uio_resid = Len; - uio.uio_segflg = UIO_SYSSPACE; - uio.uio_rw = UIO_WRITE; - uio.uio_procp = NULL; - - OSKLock(); - error = sosend( socket, NULL, &uio, NULL, NULL, 0 ); - OSKUnlock(); - - if (error == 0) *OutLen = Len - uio.uio_resid; - - return error; -} - -int OskitTCPAccept( void *socket, - void **new_socket, - void *context, - void *AddrOut, - OSK_UINT AddrLen, - OSK_UINT *OutAddrLen, - OSK_UINT FinishAccepting ) { - struct socket *head = (void *)socket; - struct sockaddr *name = (struct sockaddr *)AddrOut; - struct socket **newso = (struct socket **)new_socket; - struct socket *so = socket; - struct sockaddr_in sa; - struct mbuf mnam; - struct inpcb *inp; - int namelen = 0, error = 0, s; - - if (!socket) - return OSK_ESHUTDOWN; - - if (!new_socket) - return OSK_EINVAL; - - OS_DbgPrint(OSK_MID_TRACE,("OSKITTCP: Doing accept (Finish %d)\n", - FinishAccepting)); - - if (name) - /* that's a copyin actually */ - namelen = *OutAddrLen; - - OSKLock(); - - s = splnet(); - - if ((head->so_options & SO_ACCEPTCONN) == 0) { - OS_DbgPrint(OSK_MID_TRACE,("OSKITTCP: head->so_options = %x, wanted bit %x\n", - head->so_options, SO_ACCEPTCONN)); - error = EINVAL; - goto out; - } - - OS_DbgPrint(OSK_MID_TRACE,("head->so_q = %x, head->so_state = %x\n", - head->so_q, head->so_state)); - - if (head->so_q == NULL) { - error = EWOULDBLOCK; - goto out; - } - - /* - * At this point we know that there is at least one connection - * ready to be accepted. Remove it from the queue. - */ - so = head->so_q; - - inp = so ? (struct inpcb *)so->so_pcb : NULL; - if( inp && name ) { - ((struct sockaddr_in *)AddrOut)->sin_addr.s_addr = - inp->inp_faddr.s_addr; - ((struct sockaddr_in *)AddrOut)->sin_port = inp->inp_fport; - } - - OS_DbgPrint(OSK_MID_TRACE,("error = %d\n", error)); - if( FinishAccepting && so ) { - - mnam.m_data = (char *)&sa; - mnam.m_len = sizeof(sa); - - error = soaccept(so, &mnam); - if (error) - goto out; - - soqremque(so, 1); - so->so_connection = context; - soisconnected(so); - - *newso = so; - - OS_DbgPrint(OSK_MID_TRACE,("error = %d\n", error)); - if (name) { - /* check sa_len before it is destroyed */ - memcpy( AddrOut, &sa, AddrLen < sizeof(sa) ? AddrLen : sizeof(sa) ); - OS_DbgPrint(OSK_MID_TRACE,("error = %d\n", error)); - *OutAddrLen = namelen; /* copyout actually */ - } - OS_DbgPrint(OSK_MID_TRACE,("error = %d\n", error)); - } -out: - splx(s); - OSKUnlock(); - OS_DbgPrint(OSK_MID_TRACE,("OSKITTCP: Returning %d\n", error)); - return (error); -} - -/* The story so far - * - * We have a packet. While we store the fields we want in host byte order - * outside the original packet, the bsd stack modifies them in place. - */ - -void OskitTCPReceiveDatagram( OSK_PCHAR Data, OSK_UINT Len, - OSK_UINT IpHeaderLen ) { - struct mbuf *Ip; - struct ip *iph; - - OSKLock(); - Ip = m_devget( (char *)Data, Len, 0, NULL, NULL ); - if( !Ip ) - { - OSKUnlock(); - return; /* drop the segment */ - } - - //memcpy( Ip->m_data, Data, Len ); - Ip->m_pkthdr.len = IpHeaderLen; - - /* Do the transformations on the header that tcp_input expects */ - iph = mtod(Ip, struct ip *); - NTOHS(iph->ip_len); - iph->ip_len -= sizeof(struct ip); - - OS_DbgPrint(OSK_MAX_TRACE, - ("OskitTCPReceiveDatagram: %d (%d header) Bytes\n", Len, - IpHeaderLen)); - - tcp_input(Ip, IpHeaderLen); - OSKUnlock(); - - /* The buffer Ip is freed by tcp_input */ -} - -int OskitTCPSetSockOpt(void *socket, - int level, - int optname, - char *buffer, - int size) -{ - struct mbuf *m; - int error; - - if (!socket) - return OSK_ESHUTDOWN; - - if (size >= MLEN) - return OSK_EINVAL; - - OSKLock(); - m = m_get(M_WAIT, MT_SOOPTS); - if (!m) - { - OSKUnlock(); - return OSK_ENOMEM; - } - - m->m_len = size; - - memcpy(m->m_data, buffer, size); - - /* m is freed by sosetopt */ - error = sosetopt(socket, level, optname, m); - OSKUnlock(); - - return error; -} - -int OskitTCPGetSockOpt(void *socket, - int level, - int optname, - char *buffer, - int *size) -{ - int error, oldsize = *size; - struct mbuf *m; - - if (!socket) - return OSK_ESHUTDOWN; - - OSKLock(); - error = sogetopt(socket, level, optname, &m); - if (!error) - { - *size = m->m_len; - - if (!buffer || oldsize < m->m_len) - { - m_freem(m); - OSKUnlock(); - return OSK_EINVAL; - } - - memcpy(buffer, m->m_data, m->m_len); - - m_freem(m); - } - OSKUnlock(); - - return error; -} - -int OskitTCPListen( void *socket, int backlog ) { - int error; - - if (!socket) - return OSK_ESHUTDOWN; - - OS_DbgPrint(OSK_MID_TRACE,("Called, socket = %08x\n", socket)); - - OSKLock(); - error = solisten( socket, backlog ); - OSKUnlock(); - - OS_DbgPrint(OSK_MID_TRACE,("Ending: %08x\n", error)); - - return error; -} - -int OskitTCPSetAddress( void *socket, - OSK_UINT LocalAddress, - OSK_UI16 LocalPort, - OSK_UINT RemoteAddress, - OSK_UI16 RemotePort ) { - struct socket *so = socket; - struct inpcb *inp; - - if (!socket) - return OSK_ESHUTDOWN; - - OSKLock(); - inp = (struct inpcb *)so->so_pcb; - inp->inp_laddr.s_addr = LocalAddress; - inp->inp_lport = LocalPort; - inp->inp_faddr.s_addr = RemoteAddress; - inp->inp_fport = RemotePort; - OSKUnlock(); - - return 0; -} - -int OskitTCPGetAddress( void *socket, - OSK_UINT *LocalAddress, - OSK_UI16 *LocalPort, - OSK_UINT *RemoteAddress, - OSK_UI16 *RemotePort ) { - struct socket *so = socket; - struct inpcb *inp; - - if (!socket) - return OSK_ESHUTDOWN; - - OSKLock(); - inp = (struct inpcb *)so->so_pcb; - *LocalAddress = inp->inp_laddr.s_addr; - *LocalPort = inp->inp_lport; - *RemoteAddress = inp->inp_faddr.s_addr; - *RemotePort = inp->inp_fport; - OSKUnlock(); - - return 0; -} - -int OskitTCPGetSocketError(void *socket) { - struct socket *so = socket; - int error; - - if (!socket) - return OSK_ESHUTDOWN; - - OSKLock(); - error = so->so_error; - OSKUnlock(); - - return error; -} - -struct ifaddr *ifa_iffind(struct sockaddr *addr, int type) -{ - if( OtcpEvent.FindInterface ) - return OtcpEvent.FindInterface( OtcpEvent.ClientData, - PF_INET, - type, - addr ); - else - return NULL; -} - -void oskittcp_die( const char *file, int line ) { - DbgPrint("\n\n*** OSKITTCP: Panic Called at %s:%d ***\n", file, line); - ASSERT(FALSE); -} - -/* Stuff supporting the BSD network-interface interface */ -struct ifaddr **ifnet_addrs; -struct ifnet *ifnet; - -void -ifinit() -{ -} - - -void -if_attach(ifp) - struct ifnet *ifp; -{ - panic("if_attach\n"); -} - -struct ifnet * -ifunit(char *name) -{ - return 0; -} - -/* - * Handle interface watchdog timer routines. Called - * from softclock, we decrement timers (if set) and - * call the appropriate interface routine on expiration. - */ -void -if_slowtimo(arg) - void *arg; -{ -#if 0 - register struct ifnet *ifp; - int s = splimp(); - - for (ifp = ifnet; ifp; ifp = ifp->if_next) { - if (ifp->if_timer == 0 || --ifp->if_timer) - continue; - if (ifp->if_watchdog) - (*ifp->if_watchdog)(ifp->if_unit); - } - splx(s); - timeout(if_slowtimo, (void *)0, hz / IFNET_SLOWHZ); -#endif -} - -/* - * Locate an interface based on a complete address. - */ - -/*ARGSUSED*/ -struct ifaddr *ifa_ifwithaddr(addr) - struct sockaddr *addr; -{ - struct ifaddr *ifaddr = ifa_ifwithnet( addr ); - struct sockaddr_in *addr_in; - struct sockaddr_in *faddr_in; - - if( !ifaddr ) { - OS_DbgPrint(OSK_MID_TRACE,("No ifaddr\n")); - return NULL; - } else { - OS_DbgPrint(OSK_MID_TRACE,("ifaddr @ %x\n", ifaddr)); - } - - addr_in = (struct sockaddr_in *)addr; - faddr_in = (struct sockaddr_in *)ifaddr->ifa_addr; - - if( faddr_in->sin_addr.s_addr == addr_in->sin_addr.s_addr ) - return ifaddr; - else - return NULL; -} - -/* - * Locate the point to point interface with a given destination address. - */ -/*ARGSUSED*/ -struct ifaddr * -ifa_ifwithdstaddr(addr) - register struct sockaddr *addr; -{ - OS_DbgPrint(OSK_MID_TRACE,("Called\n")); - return ifa_iffind(addr, IFF_POINTOPOINT); -} - -/* - * Find an interface on a specific network. If many, choice - * is most specific found. - */ -struct ifaddr *ifa_ifwithnet(addr) - struct sockaddr *addr; -{ - struct sockaddr_in *sin; - struct ifaddr *ifaddr = ifa_iffind(addr, IFF_UNICAST); - - if( ifaddr ) - { - sin = (struct sockaddr_in *)&ifaddr->ifa_addr; - - OS_DbgPrint(OSK_MID_TRACE,("ifaddr->addr = %x\n", - sin->sin_addr.s_addr)); - } - - return ifaddr; -} - diff --git a/lib/drivers/oskittcp/oskittcp/ip_input.c b/lib/drivers/oskittcp/oskittcp/ip_input.c deleted file mode 100644 index d816fe69725..00000000000 --- a/lib/drivers/oskittcp/oskittcp/ip_input.c +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1988, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)ip_input.c 8.2 (Berkeley) 1/4/94 - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include - -u_char inetctlerrmap[PRC_NCMDS] = { - 0, 0, 0, 0, - 0, EMSGSIZE, EHOSTDOWN, EHOSTUNREACH, - EHOSTUNREACH, EHOSTUNREACH, ECONNREFUSED, ECONNREFUSED, - EMSGSIZE, EHOSTUNREACH, 0, 0, - 0, 0, 0, 0, - ENOPROTOOPT -}; - -struct in_ifaddr *in_ifaddr; /* first inet address */ -int ip_defttl = IPDEFTTL; -struct ipstat ipstat; - -/* - * We need to save the IP options in case a protocol wants to respond - * to an incoming packet over the same route if the packet got here - * using IP source routing. This allows connection establishment and - * maintenance when the remote end is on a network that is not known - * to us. - */ -int ip_nhops = 0; -static struct ip_srcrt { - struct in_addr dst; /* final destination */ - char nop; /* one NOP to align */ - char srcopt[IPOPT_OFFSET + 1]; /* OPTVAL, OLEN and OFFSET */ - struct in_addr route[MAX_IPOPTLEN/sizeof(struct in_addr)]; -} ip_srcrt; - -/* - * Strip out IP options, at higher - * level protocol in the kernel. - * Second argument is buffer to which options - * will be moved, and return value is their length. - * XXX should be deleted; last arg currently ignored. - */ -void -ip_stripoptions(m, mopt) - register struct mbuf *m; - struct mbuf *mopt; -{ - register int i; - struct ip *ip = mtod(m, struct ip *); - register caddr_t opts; - int olen; - - olen = (ip->ip_hl<<2) - sizeof (struct ip); - opts = (caddr_t)(ip + 1); - i = m->m_len - (sizeof (struct ip) + olen); - bcopy(opts + olen, opts, (unsigned)i); - m->m_len -= olen; - if (m->m_flags & M_PKTHDR) - m->m_pkthdr.len -= olen; - ip->ip_hl = sizeof(struct ip) >> 2; -} - -/* - * Retrieve incoming source route for use in replies, - * in the same form used by setsockopt. - * The first hop is placed before the options, will be removed later. - */ -struct mbuf * -ip_srcroute() -{ - register struct in_addr *p, *q; - register struct mbuf *m; - - if (ip_nhops == 0) - return ((struct mbuf *)0); - m = m_get(M_DONTWAIT, MT_SOOPTS); - if (m == 0) - return ((struct mbuf *)0); - -#define OPTSIZ (sizeof(ip_srcrt.nop) + sizeof(ip_srcrt.srcopt)) - - /* length is (nhops+1)*sizeof(addr) + sizeof(nop + srcrt header) */ - m->m_len = ip_nhops * sizeof(struct in_addr) + sizeof(struct in_addr) + - OPTSIZ; -#ifdef DIAGNOSTIC - if (ipprintfs) - printf("ip_srcroute: nhops %d mlen %d", ip_nhops, m->m_len); -#endif - - /* - * First save first hop for return route - */ - p = &ip_srcrt.route[ip_nhops - 1]; - *(mtod(m, struct in_addr *)) = *p--; -#ifdef DIAGNOSTIC - if (ipprintfs) - printf(" hops %lx", ntohl(mtod(m, struct in_addr *)->s_addr)); -#endif - - /* - * Copy option fields and padding (nop) to mbuf. - */ - ip_srcrt.nop = IPOPT_NOP; - ip_srcrt.srcopt[IPOPT_OFFSET] = IPOPT_MINOFF; - (void)memcpy(mtod(m, caddr_t) + sizeof(struct in_addr), - &ip_srcrt.nop, OPTSIZ); - q = (struct in_addr *)(mtod(m, caddr_t) + - sizeof(struct in_addr) + OPTSIZ); -#undef OPTSIZ - /* - * Record return path as an IP source route, - * reversing the path (pointers are now aligned). - */ - while (p >= ip_srcrt.route) { -#ifdef DIAGNOSTIC - if (ipprintfs) - printf(" %lx", ntohl(q->s_addr)); -#endif - *q++ = *p--; - } - /* - * Last hop goes to final destination. - */ - *q = ip_srcrt.dst; -#ifdef DIAGNOSTIC - if (ipprintfs) - printf(" %lx\n", ntohl(q->s_addr)); -#endif - return (m); -} diff --git a/lib/drivers/oskittcp/oskittcp/ip_output.c b/lib/drivers/oskittcp/oskittcp/ip_output.c deleted file mode 100644 index 25f8be98fe3..00000000000 --- a/lib/drivers/oskittcp/oskittcp/ip_output.c +++ /dev/null @@ -1,1289 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1988, 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)ip_output.c 8.3 (Berkeley) 1/21/94 - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include - -#include - -#ifdef vax -#include -#endif -#include - -u_short ip_id; - -static struct mbuf *ip_insertoptions __P((struct mbuf *, struct mbuf *, int *)); -#ifndef __REACTOS__ -static void ip_mloopback - __P((struct ifnet *, struct mbuf *, struct sockaddr_in *)); -#endif - -/* - * IP output. The packet in mbuf chain m contains a skeletal IP - * header (with len, off, ttl, proto, tos, src, dst). - * The mbuf chain containing the packet will be freed. - * The mbuf opt, if present, will not be freed. - */ -int -ip_output(m0, opt, ro, flags, imo) - struct mbuf *m0; - struct mbuf *opt; - struct route *ro; - int flags; - struct ip_moptions *imo; -{ - register struct ip *ip, *mhip; -#ifndef __REACTOS__ - register struct ifnet *ifp; -#endif - register struct mbuf *m = m0; - register int hlen = sizeof (struct ip); - int len = 0, off, error = 0; - /* - * It might seem obvious at first glance that one could easily - * make a one-behind cache out of this by simply making `iproute' - * static and eliminating the bzero() below. However, this turns - * out not to work, for two reasons: - * - * 1) This routine needs to be reentrant. It can be called - * recursively from encapsulating network interfaces, and it - * is always called recursively from ip_mforward(). - * - * 2) You turn out not to gain much. There is already a one- - * behind cache implemented for the specific case of forwarding, - * and sends on a connected socket will use a route associated - * with the PCB. The only cases left are sends on unconnected - * and raw sockets, and if these cases are really significant, - * something is seriously wrong. - */ - struct route iproute; - struct sockaddr_in *dst; - struct in_ifaddr *ia = NULL; - -#ifdef DIAGNOSTIC - if ((m->m_flags & M_PKTHDR) == 0) - panic("ip_output no HDR"); -#endif - if (opt) { - m = ip_insertoptions(m, opt, &len); - hlen = len; - } - ip = mtod(m, struct ip *); - /* - * Fill in IP header. - */ - if ((flags & (IP_FORWARDING|IP_RAWOUTPUT)) == 0) { - ip->ip_v = IPVERSION; - ip->ip_off &= IP_DF; - ip->ip_id = htons(ip_id++); - ip->ip_hl = hlen >> 2; - ipstat.ips_localout++; - } else { - hlen = ip->ip_hl << 2; - } - /* - * Route packet. - */ - if (ro == 0) { - ro = &iproute; - bzero((caddr_t)ro, sizeof (*ro)); - } - dst = (struct sockaddr_in *)&ro->ro_dst; - /* - * If there is a cached route, - * check that it is to the same destination - * and is still up. If not, free it and try again. - */ - if (ro->ro_rt && ((ro->ro_rt->rt_flags & RTF_UP) == 0 || - dst->sin_addr.s_addr != ip->ip_dst.s_addr)) { - RTFREE(ro->ro_rt); - ro->ro_rt = (struct rtentry *)0; - } - if (ro->ro_rt == 0) { - dst->sin_family = AF_INET; - dst->sin_len = sizeof(*dst); - dst->sin_addr = ip->ip_dst; - } - /* - * If routing to interface only, - * short circuit routing lookup. - */ -#define ifatoia(ifa) ((struct in_ifaddr *)(ifa)) -#define sintosa(sin) ((struct sockaddr *)(sin)) -#ifndef __REACTOS__ - if (flags & IP_ROUTETOIF) { - if ((ia = ifatoia(ifa_ifwithdstaddr(sintosa(dst)))) == 0 && - (ia = ifatoia(ifa_ifwithnet(sintosa(dst)))) == 0) { - ipstat.ips_noroute++; - error = ENETUNREACH; - goto bad; - } - - ifp = ia->ia_ifp; - ip->ip_ttl = 1; - } else { - /* - * If this is the case, we probably don't want to allocate - * a protocol-cloned route since we didn't get one from the - * ULP. This lets TCP do its thing, while not burdening - * forwarding or ICMP with the overhead of cloning a route. - * Of course, we still want to do any cloning requested by - * the link layer, as this is probably required in all cases - * for correct operation (as it is for ARP). - */ - - if (ro->ro_rt == 0) - rtalloc_ign(ro, RTF_PRCLONING); - if (ro->ro_rt == 0) { - ipstat.ips_noroute++; - OS_DbgPrint(OSK_MID_TRACE,("EHOSTUNREACH\n")); - error = EHOSTUNREACH; - goto bad; - } - ia = ifatoia(ro->ro_rt->rt_ifa); - ifp = ro->ro_rt->rt_ifp; - ro->ro_rt->rt_use++; - if (ro->ro_rt->rt_flags & RTF_GATEWAY) - dst = (struct sockaddr_in *)ro->ro_rt->rt_gateway; - } - -#else - if ((ia = ifatoia(ifa_ifwithdstaddr(sintosa(dst)))) == 0 && - (ia = ifatoia(ifa_ifwithnet(sintosa(dst)))) == 0) { - ipstat.ips_noroute++; - error = ENETUNREACH; - goto bad; - } -#endif - -#ifndef __REACTOS__ - if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr))) { - struct in_multi *inm; - - m->m_flags |= M_MCAST; - /* - * IP destination address is multicast. Make sure "dst" - * still points to the address in "ro". (It may have been - * changed to point to a gateway address, above.) - */ - dst = (struct sockaddr_in *)&ro->ro_dst; - /* - * See if the caller provided any multicast options - */ - if (imo != NULL) { - ip->ip_ttl = imo->imo_multicast_ttl; - if (imo->imo_multicast_ifp != NULL) - ifp = imo->imo_multicast_ifp; - if (imo->imo_multicast_vif != -1) - ip->ip_src.s_addr = - ip_mcast_src(imo->imo_multicast_vif); - } else - ip->ip_ttl = IP_DEFAULT_MULTICAST_TTL; - /* - * Confirm that the outgoing interface supports multicast. - */ - if ((imo == NULL) || (imo->imo_multicast_vif == -1)) { - if ((ifp->if_flags & IFF_MULTICAST) == 0) { - ipstat.ips_noroute++; - error = ENETUNREACH; - goto bad; - } - } - /* - * If source address not specified yet, use address - * of outgoing interface. - */ - if (ip->ip_src.s_addr == INADDR_ANY) { - register struct in_ifaddr *ia; - - panic("We don't handle this yet\n"); - for (ia = in_ifaddr; ia; ia = ia->ia_next) - if (ia->ia_ifp == ifp) { - ip->ip_src = IA_SIN(ia)->sin_addr; - break; - } - } - - IN_LOOKUP_MULTI(ip->ip_dst, ifp, inm); - if (inm != NULL && - (imo == NULL || imo->imo_multicast_loop)) { - /* - * If we belong to the destination multicast group - * on the outgoing interface, and the caller did not - * forbid loopback, loop back a copy. - */ - ip_mloopback(ifp, m, dst); - } - else { - /* - * If we are acting as a multicast router, perform - * multicast forwarding as if the packet had just - * arrived on the interface to which we are about - * to send. The multicast forwarding function - * recursively calls this function, using the - * IP_FORWARDING flag to prevent infinite recursion. - * - * Multicasts that are looped back by ip_mloopback(), - * above, will be forwarded by the ip_input() routine, - * if necessary. - */ - if (ip_mrouter && (flags & IP_FORWARDING) == 0) { - /* - * Check if rsvp daemon is running. If not, don't - * set ip_moptions. This ensures that the packet - * is multicast and not just sent down one link - * as prescribed by rsvpd. - */ - if (!rsvp_on) - imo = NULL; - if (ip_mforward(ip, ifp, m, imo) != 0) { - m_freem(m); - goto done; - } - } - } - - /* - * Multicasts with a time-to-live of zero may be looped- - * back, above, but must not be transmitted on a network. - * Also, multicasts addressed to the loopback interface - * are not sent -- the above call to ip_mloopback() will - * loop back a copy if this host actually belongs to the - * destination group on the loopback interface. - */ - if (ip->ip_ttl == 0 || ifp->if_flags & IFF_LOOPBACK) { - m_freem(m); - goto done; - } - - goto sendit; - } -#endif - -#ifdef __REACTOS__ - /* - * If source address not specified yet, use address - * of outgoing interface. - */ - if (ip->ip_src.s_addr == INADDR_ANY) - ip->ip_src = IA_SIN(ia)->sin_addr; -#endif -#ifndef __REACTOS__ - /* - * Verify that we have any chance at all of being able to queue - * the packet or packet fragments - */ - if ((ifp->if_snd.ifq_len + ip->ip_len / ifp->if_mtu + 1) >= - ifp->if_snd.ifq_maxlen) { - error = ENOBUFS; - goto bad; - } - - /* - * Look for broadcast address and - * and verify user is allowed to send - * such a packet. - */ - if (in_broadcast(dst->sin_addr, ifp)) { - if ((ifp->if_flags & IFF_BROADCAST) == 0) { - error = EADDRNOTAVAIL; - goto bad; - } - if ((flags & IP_ALLOWBROADCAST) == 0) { - error = EACCES; - goto bad; - } - /* don't allow broadcast messages to be fragmented */ - if ((u_short)ip->ip_len > ifp->if_mtu) { - error = EMSGSIZE; - goto bad; - } - m->m_flags |= M_BCAST; - } else - m->m_flags &= ~M_BCAST; -#endif - -#ifndef __REACTOS__ -sendit: - /* - * Check with the firewall... - */ - if (!(*ip_fw_chk_ptr)(m,ip,ifp,1)) { - error = EACCES; - goto done; - } -#endif - - /* - * If small enough for interface, can just send directly. - */ - - /* FIXME: This was ROS-modified code. Where is the original? */ - if ((u_short)ip->ip_len <= ((struct ifaddr *)ia)->ifa_mtu) { - ip->ip_len = htons((u_short)ip->ip_len); - ip->ip_off = htons((u_short)ip->ip_off); - ip->ip_sum = 0; - ip->ip_sum = in_cksum(m, hlen); -#ifdef __REACTOS__ - if( OtcpEvent.PacketSend ) { - struct mbuf *new_m; - new_m = m_get( M_DONTWAIT, 0 ); - if ( NULL == new_m ) { - error = ENOBUFS; - goto done; - } - MCLGET( new_m, M_DONTWAIT ); - if (0 == (new_m->m_flags & M_EXT)) { - m_free( new_m ); - error = ENOBUFS; - goto done; - } - m_copydata( m, 0, htons(ip->ip_len), new_m->m_data ); - new_m->m_len = htons(ip->ip_len); - error = OtcpEvent.PacketSend( OtcpEvent.ClientData, - (OSK_PCHAR)new_m->m_data, new_m->m_len ); - m_free( new_m ); - m_freem( m ); - goto done; - } -#else - error = (*ifp->if_output)(ifp, m, - (struct sockaddr *)dst, ro->ro_rt); -#endif - } - /* - * Too large for interface; fragment if possible. - * Must be able to put at least 8 bytes per fragment. - */ - if (ip->ip_off & IP_DF) { - error = EMSGSIZE; -#ifndef __REACTOS__ -#if 1 - /* - * This case can happen if the user changed the MTU - * of an interface after enabling IP on it. Because - * most netifs don't keep track of routes pointing to - * them, there is no way for one to update all its - * routes when the MTU is changed. - */ - if ((ro->ro_rt->rt_flags & (RTF_UP | RTF_HOST)) - && !(ro->ro_rt->rt_rmx.rmx_locks & RTV_MTU) - && (ro->ro_rt->rt_rmx.rmx_mtu > ifp->if_mtu)) { - ro->ro_rt->rt_rmx.rmx_mtu = ifp->if_mtu; - } -#endif -#endif - ipstat.ips_cantfrag++; - goto bad; - } -#ifndef __REACTOS__ - len = (ifp->if_mtu - hlen) &~ 7; - if (len < 8) { - error = EMSGSIZE; - goto bad; - } -#else - len = (((struct ifaddr *)ia)->ifa_mtu - hlen) & ~7; -#endif - - { - int mhlen, firstlen = len; - struct mbuf **mnext = &m->m_nextpkt; - - /* - * Loop through length of segment after first fragment, - * make new header and copy data of each part and link onto chain. - */ - m0 = m; - mhlen = sizeof (struct ip); - for (off = hlen + len; off < (u_short)ip->ip_len; off += len) { - OS_DbgPrint(OSK_MID_TRACE,("off = %d, len = %d\n", off, len)); - MGETHDR(m, M_DONTWAIT, MT_HEADER); - if (m == 0) { - error = ENOBUFS; - ipstat.ips_odropped++; - goto sendorfree; - } - m->m_data += max_linkhdr; - mhip = mtod(m, struct ip *); - *mhip = *ip; - if (hlen > sizeof (struct ip)) { - mhlen = ip_optcopy(ip, mhip) + sizeof (struct ip); - mhip->ip_hl = mhlen >> 2; - } - m->m_len = mhlen; - mhip->ip_off = ((off - hlen) >> 3) + (ip->ip_off & ~IP_MF); - if (ip->ip_off & IP_MF) - mhip->ip_off |= IP_MF; - if (off + len >= (u_short)ip->ip_len) - len = (u_short)ip->ip_len - off; - else - mhip->ip_off |= IP_MF; - mhip->ip_len = htons((u_short)(len + mhlen)); - m->m_next = m_copy(m0, off, len); - if (m->m_next == 0) { - (void) m_free(m); - error = ENOBUFS; /* ??? */ - ipstat.ips_odropped++; - goto sendorfree; - } - m->m_pkthdr.len = mhlen + len; - m->m_pkthdr.rcvif = (struct ifnet *)0; - mhip->ip_off = htons((u_short)mhip->ip_off); - mhip->ip_sum = 0; - mhip->ip_sum = in_cksum(m, mhlen); - *mnext = m; - mnext = &m->m_nextpkt; - ipstat.ips_ofragments++; - } - /* - * Update first fragment by trimming what's been copied out - * and updating header, then send each fragment (in order). - */ - m = m0; - OS_DbgPrint(OSK_MID_TRACE,("hlen %d firstlen %d ip->ip_len %x\n", - hlen, firstlen, ip->ip_len)); - OS_DbgPrint(OSK_MID_TRACE,("hlen + firstlen - ip->ip_len %d\n", - hlen + firstlen - (u_short)ip->ip_len)); - m_adj(m, hlen + firstlen - (u_short)ip->ip_len); - m->m_pkthdr.len = hlen + firstlen; - ip->ip_len = htons((u_short)(m->m_pkthdr.len)); - ip->ip_off = htons((u_short)(ip->ip_off | IP_MF)); - ip->ip_sum = 0; - ip->ip_sum = in_cksum(m, hlen - sizeof( struct ip ) ); - - OS_DbgPrint(OSK_MID_TRACE,("ip->ip_len = %x\n", ip->ip_len)); - -sendorfree: - for (m = m0; m; m = m0) { - m0 = m->m_nextpkt; - m->m_nextpkt = 0; -#ifndef __REACTOS__ - if (error == 0) - error = (*ifp->if_output)(ifp, m, - (struct sockaddr *)dst, ro->ro_rt); - else - m_freem(m); -#else - if( error == 0 && OtcpEvent.PacketSend ) { - struct mbuf *new_m; - MGET( new_m, M_DONTWAIT, 0 ); - if ( NULL == new_m ) { - error = ENOBUFS; - goto done; - } - MCLGET( new_m, M_DONTWAIT ); - if (0 == (new_m->m_flags & M_EXT)) { - m_free( new_m ); - error = ENOBUFS; - goto done; - } - m_copydata( m, 0, m->m_pkthdr.len, new_m->m_data ); - new_m->m_len = m->m_pkthdr.len; - error = OtcpEvent.PacketSend( OtcpEvent.ClientData, - (OSK_PCHAR)new_m->m_data, new_m->m_len ); - m_free( new_m ); - m_freem( m ); - } - - OS_DbgPrint(OSK_MID_TRACE,("Error from upper layer: %d\n", error)); -#endif - } - - if (error == 0) - ipstat.ips_fragmented++; - } -done: - if (ro == &iproute && (flags & IP_ROUTETOIF) == 0 && ro->ro_rt) { - RTFREE(ro->ro_rt); - } - - return (error); -bad: - m_freem(m0); - goto done; -} - -/* - * Insert IP options into preformed packet. - * Adjust IP destination as required for IP source routing, - * as indicated by a non-zero in_addr at the start of the options. - * - * XXX This routine assumes that the packet has no options in place. - */ -static struct mbuf * -ip_insertoptions(m, opt, phlen) - register struct mbuf *m; - struct mbuf *opt; - int *phlen; -{ - register struct ipoption *p = mtod(opt, struct ipoption *); - struct mbuf *n; - register struct ip *ip = mtod(m, struct ip *); - unsigned optlen; - - optlen = opt->m_len - sizeof(p->ipopt_dst); - if (optlen + (u_short)ip->ip_len > IP_MAXPACKET) - return (m); /* XXX should fail */ - if (p->ipopt_dst.s_addr) - ip->ip_dst = p->ipopt_dst; - if (m->m_flags & M_EXT || m->m_data - optlen < m->m_pktdat) { - MGETHDR(n, M_DONTWAIT, MT_HEADER); - if (n == 0) - return (m); - n->m_pkthdr.len = m->m_pkthdr.len + optlen; - m->m_len -= sizeof(struct ip); - m->m_data += sizeof(struct ip); - n->m_next = m; - m = n; - m->m_len = optlen + sizeof(struct ip); - m->m_data += max_linkhdr; - (void)memcpy(mtod(m, void *), ip, sizeof(struct ip)); - } else { - m->m_data -= optlen; - m->m_len += optlen; - m->m_pkthdr.len += optlen; - ovbcopy((caddr_t)ip, mtod(m, caddr_t), sizeof(struct ip)); - } - ip = mtod(m, struct ip *); - (void)memcpy(ip + 1, p->ipopt_list, (unsigned)optlen); - *phlen = sizeof(struct ip) + optlen; - ip->ip_hl = *phlen >> 2; - ip->ip_len += optlen; - return (m); -} - -/* - * Copy options from ip to jp, - * omitting those not copied during fragmentation. - */ -int -ip_optcopy(ip, jp) - struct ip *ip, *jp; -{ - register u_char *cp, *dp; - int opt, optlen, cnt; - - cp = (u_char *)(ip + 1); - dp = (u_char *)(jp + 1); - cnt = (ip->ip_hl << 2) - sizeof (struct ip); - for (; cnt > 0; cnt -= optlen, cp += optlen) { - opt = cp[0]; - if (opt == IPOPT_EOL) - break; - if (opt == IPOPT_NOP) { - /* Preserve for IP mcast tunnel's LSRR alignment. */ - *dp++ = IPOPT_NOP; - optlen = 1; - continue; - } else - optlen = cp[IPOPT_OLEN]; - /* bogus lengths should have been caught by ip_dooptions */ - if (optlen > cnt) - optlen = cnt; - if (IPOPT_COPIED(opt)) { - (void)memcpy(dp, cp, (unsigned)optlen); - dp += optlen; - } - } - for (optlen = dp - (u_char *)(jp+1); optlen & 0x3; optlen++) - *dp++ = IPOPT_EOL; - return (optlen); -} - -/* - * IP socket option processing. - */ -int -ip_ctloutput(op, so, level, optname, mp) - int op; - struct socket *so; - int level, optname; - struct mbuf **mp; -{ - register struct inpcb *inp = sotoinpcb(so); - register struct mbuf *m = *mp; - register int optval = 0; - int error = 0; - - if (level != IPPROTO_IP) { - error = EINVAL; - if (op == PRCO_SETOPT && *mp) - (void) m_free(*mp); - } else switch (op) { - - case PRCO_SETOPT: - switch (optname) { - case IP_OPTIONS: -#ifdef notyet - case IP_RETOPTS: - return (ip_pcbopts(optname, &inp->inp_options, m)); -#else - return (ip_pcbopts(&inp->inp_options, m)); -#endif - - case IP_TOS: - case IP_TTL: - case IP_RECVOPTS: - case IP_RECVRETOPTS: - case IP_RECVDSTADDR: - if (m == 0 || m->m_len != sizeof(int)) - error = EINVAL; - else { - optval = *mtod(m, int *); - switch (optname) { - - case IP_TOS: - inp->inp_ip.ip_tos = optval; - break; - - case IP_TTL: - inp->inp_ip.ip_ttl = optval; - break; -#define OPTSET(bit) \ - if (optval) \ - inp->inp_flags |= bit; \ - else \ - inp->inp_flags &= ~bit; - - case IP_RECVOPTS: - OPTSET(INP_RECVOPTS); - break; - - case IP_RECVRETOPTS: - OPTSET(INP_RECVRETOPTS); - break; - - case IP_RECVDSTADDR: - OPTSET(INP_RECVDSTADDR); - break; - } - } - break; -#undef OPTSET - - case IP_MULTICAST_IF: - case IP_MULTICAST_VIF: - case IP_MULTICAST_TTL: - case IP_MULTICAST_LOOP: - case IP_ADD_MEMBERSHIP: - case IP_DROP_MEMBERSHIP: - error = ip_setmoptions(optname, &inp->inp_moptions, m); - break; - - default: - error = ENOPROTOOPT; - break; - } - if (m) - (void)m_free(m); - break; - - case PRCO_GETOPT: - switch (optname) { - case IP_OPTIONS: - case IP_RETOPTS: - *mp = m = m_get(M_WAIT, MT_SOOPTS); - if (inp->inp_options) { - m->m_len = inp->inp_options->m_len; - (void)memcpy(mtod(m, void *), - mtod(inp->inp_options, void *), (unsigned)m->m_len); - } else - m->m_len = 0; - break; - - case IP_TOS: - case IP_TTL: - case IP_RECVOPTS: - case IP_RECVRETOPTS: - case IP_RECVDSTADDR: - *mp = m = m_get(M_WAIT, MT_SOOPTS); - m->m_len = sizeof(int); - switch (optname) { - - case IP_TOS: - optval = inp->inp_ip.ip_tos; - break; - - case IP_TTL: - optval = inp->inp_ip.ip_ttl; - break; - -#define OPTBIT(bit) (inp->inp_flags & bit ? 1 : 0) - - case IP_RECVOPTS: - optval = OPTBIT(INP_RECVOPTS); - break; - - case IP_RECVRETOPTS: - optval = OPTBIT(INP_RECVRETOPTS); - break; - - case IP_RECVDSTADDR: - optval = OPTBIT(INP_RECVDSTADDR); - break; - } - *mtod(m, int *) = optval; - break; - - case IP_MULTICAST_IF: - case IP_MULTICAST_VIF: - case IP_MULTICAST_TTL: - case IP_MULTICAST_LOOP: - case IP_ADD_MEMBERSHIP: - case IP_DROP_MEMBERSHIP: - error = ip_getmoptions(optname, inp->inp_moptions, mp); - break; - - default: - error = ENOPROTOOPT; - break; - } - break; - } - return (error); -} - -/* - * Set up IP options in pcb for insertion in output packets. - * Store in mbuf with pointer in pcbopt, adding pseudo-option - * with destination address if source routed. - */ -int -#ifdef notyet -ip_pcbopts(optname, pcbopt, m) - int optname; -#else -ip_pcbopts(pcbopt, m) -#endif - struct mbuf **pcbopt; - register struct mbuf *m; -{ - register int cnt, optlen; - register u_char *cp; - u_char opt; - - /* turn off any old options */ - if (*pcbopt) - (void)m_free(*pcbopt); - *pcbopt = 0; - if (m == (struct mbuf *)0 || m->m_len == 0) { - /* - * Only turning off any previous options. - */ - if (m) - (void)m_free(m); - return (0); - } - -#ifndef vax - if (m->m_len % sizeof(long)) - goto bad; -#endif - /* - * IP first-hop destination address will be stored before - * actual options; move other options back - * and clear it when none present. - */ - if (m->m_data + m->m_len + sizeof(struct in_addr) >= &m->m_dat[MLEN]) - goto bad; - cnt = m->m_len; - m->m_len += sizeof(struct in_addr); - cp = mtod(m, u_char *) + sizeof(struct in_addr); - ovbcopy(mtod(m, caddr_t), (caddr_t)cp, (unsigned)cnt); - bzero(mtod(m, caddr_t), sizeof(struct in_addr)); - - for (; cnt > 0; cnt -= optlen, cp += optlen) { - opt = cp[IPOPT_OPTVAL]; - if (opt == IPOPT_EOL) - break; - if (opt == IPOPT_NOP) - optlen = 1; - else { - optlen = cp[IPOPT_OLEN]; - if (optlen <= IPOPT_OLEN || optlen > cnt) - goto bad; - } - switch (opt) { - - default: - break; - - case IPOPT_LSRR: - case IPOPT_SSRR: - /* - * user process specifies route as: - * ->A->B->C->D - * D must be our final destination (but we can't - * check that since we may not have connected yet). - * A is first hop destination, which doesn't appear in - * actual IP option, but is stored before the options. - */ - if (optlen < IPOPT_MINOFF - 1 + sizeof(struct in_addr)) - goto bad; - m->m_len -= sizeof(struct in_addr); - cnt -= sizeof(struct in_addr); - optlen -= sizeof(struct in_addr); - cp[IPOPT_OLEN] = optlen; - /* - * Move first hop before start of options. - */ - bcopy((caddr_t)&cp[IPOPT_OFFSET+1], mtod(m, caddr_t), - sizeof(struct in_addr)); - /* - * Then copy rest of options back - * to close up the deleted entry. - */ - ovbcopy((caddr_t)(&cp[IPOPT_OFFSET+1] + - sizeof(struct in_addr)), - (caddr_t)&cp[IPOPT_OFFSET+1], - (unsigned)cnt + sizeof(struct in_addr)); - break; - } - } - if (m->m_len > MAX_IPOPTLEN + sizeof(struct in_addr)) - goto bad; - *pcbopt = m; - return (0); - -bad: - (void)m_free(m); - return (EINVAL); -} - -/* - * Set the IP multicast options in response to user setsockopt(). - */ -int -ip_setmoptions(optname, imop, m) - int optname; - struct ip_moptions **imop; - struct mbuf *m; -{ - register int error = 0; -#ifndef __REACTOS__ - u_char loop; - register int i; - struct in_addr addr; - register struct ip_mreq *mreq; - register struct ifnet *ifp; -#endif - register struct ip_moptions *imo = *imop; -#ifndef __REACTOS__ - struct route ro; - register struct sockaddr_in *dst; - int s; -#endif - - if (imo == NULL) { - /* - * No multicast option buffer attached to the pcb; - * allocate one and initialize to default values. - */ - imo = (struct ip_moptions*)malloc(sizeof(*imo), M_IPMOPTS, - M_WAITOK); - - if (imo == NULL) - return (ENOBUFS); - *imop = imo; - imo->imo_multicast_ifp = NULL; - imo->imo_multicast_vif = -1; - imo->imo_multicast_ttl = IP_DEFAULT_MULTICAST_TTL; - imo->imo_multicast_loop = IP_DEFAULT_MULTICAST_LOOP; - imo->imo_num_memberships = 0; - } - - switch (optname) { -#ifndef __REACTOS__ - /* store an index number for the vif you wanna use in the send */ - case IP_MULTICAST_VIF: - if (!legal_vif_num) { - error = EOPNOTSUPP; - break; - } - if (m == NULL || m->m_len != sizeof(int)) { - error = EINVAL; - break; - } - i = *(mtod(m, int *)); - if (!legal_vif_num(i) && (i != -1)) { - error = EINVAL; - break; - } - imo->imo_multicast_vif = i; - break; - - case IP_MULTICAST_IF: - /* - * Select the interface for outgoing multicast packets. - */ - if (m == NULL || m->m_len != sizeof(struct in_addr)) { - error = EINVAL; - break; - } - addr = *(mtod(m, struct in_addr *)); - /* - * INADDR_ANY is used to remove a previous selection. - * When no interface is selected, a default one is - * chosen every time a multicast packet is sent. - */ - if (addr.s_addr == INADDR_ANY) { - imo->imo_multicast_ifp = NULL; - break; - } - /* - * The selected interface is identified by its local - * IP address. Find the interface and confirm that - * it supports multicasting. - */ - s = splimp(); - INADDR_TO_IFP(addr, ifp); - if (ifp == NULL || (ifp->if_flags & IFF_MULTICAST) == 0) { - error = EADDRNOTAVAIL; - break; - } - imo->imo_multicast_ifp = ifp; - splx(s); - break; - - case IP_MULTICAST_TTL: - /* - * Set the IP time-to-live for outgoing multicast packets. - */ - if (m == NULL || m->m_len != 1) { - error = EINVAL; - break; - } - imo->imo_multicast_ttl = *(mtod(m, u_char *)); - break; - - case IP_MULTICAST_LOOP: - /* - * Set the loopback flag for outgoing multicast packets. - * Must be zero or one. - */ - if (m == NULL || m->m_len != 1 || - (loop = *(mtod(m, u_char *))) > 1) { - error = EINVAL; - break; - } - imo->imo_multicast_loop = loop; - break; - - case IP_ADD_MEMBERSHIP: - /* - * Add a multicast group membership. - * Group must be a valid IP multicast address. - */ - if (m == NULL || m->m_len != sizeof(struct ip_mreq)) { - error = EINVAL; - break; - } - mreq = mtod(m, struct ip_mreq *); - if (!IN_MULTICAST(ntohl(mreq->imr_multiaddr.s_addr))) { - error = EINVAL; - break; - } - s = splimp(); - /* - * If no interface address was provided, use the interface of - * the route to the given multicast address. - */ - if (mreq->imr_interface.s_addr == INADDR_ANY) { - bzero((caddr_t)&ro, sizeof(ro)); - dst = (struct sockaddr_in *)&ro.ro_dst; - dst->sin_len = sizeof(*dst); - dst->sin_family = AF_INET; - dst->sin_addr = mreq->imr_multiaddr; - rtalloc(&ro); - if (ro.ro_rt == NULL) { - error = EADDRNOTAVAIL; - splx(s); - break; - } - ifp = ro.ro_rt->rt_ifp; - rtfree(ro.ro_rt); - } - else { - INADDR_TO_IFP(mreq->imr_interface, ifp); - } - - /* - * See if we found an interface, and confirm that it - * supports multicast. - */ - if (ifp == NULL || (ifp->if_flags & IFF_MULTICAST) == 0) { - error = EADDRNOTAVAIL; - splx(s); - break; - } - /* - * See if the membership already exists or if all the - * membership slots are full. - */ - for (i = 0; i < imo->imo_num_memberships; ++i) { - if (imo->imo_membership[i]->inm_ifp == ifp && - imo->imo_membership[i]->inm_addr.s_addr - == mreq->imr_multiaddr.s_addr) - break; - } - if (i < imo->imo_num_memberships) { - error = EADDRINUSE; - splx(s); - break; - } - if (i == IP_MAX_MEMBERSHIPS) { - error = ETOOMANYREFS; - splx(s); - break; - } - /* - * Everything looks good; add a new record to the multicast - * address list for the given interface. - */ - if ((imo->imo_membership[i] = - in_addmulti(&mreq->imr_multiaddr, ifp)) == NULL) { - error = ENOBUFS; - splx(s); - break; - } - ++imo->imo_num_memberships; - splx(s); - break; - - case IP_DROP_MEMBERSHIP: - /* - * Drop a multicast group membership. - * Group must be a valid IP multicast address. - */ - if (m == NULL || m->m_len != sizeof(struct ip_mreq)) { - error = EINVAL; - break; - } - mreq = mtod(m, struct ip_mreq *); - if (!IN_MULTICAST(ntohl(mreq->imr_multiaddr.s_addr))) { - error = EINVAL; - break; - } - - s = splimp(); - /* - * If an interface address was specified, get a pointer - * to its ifnet structure. - */ - if (mreq->imr_interface.s_addr == INADDR_ANY) - ifp = NULL; - else { - INADDR_TO_IFP(mreq->imr_interface, ifp); - if (ifp == NULL) { - error = EADDRNOTAVAIL; - splx(s); - break; - } - } - /* - * Find the membership in the membership array. - */ - for (i = 0; i < imo->imo_num_memberships; ++i) { - if ((ifp == NULL || - imo->imo_membership[i]->inm_ifp == ifp) && - imo->imo_membership[i]->inm_addr.s_addr == - mreq->imr_multiaddr.s_addr) - break; - } - if (i == imo->imo_num_memberships) { - error = EADDRNOTAVAIL; - splx(s); - break; - } - /* - * Give up the multicast address record to which the - * membership points. - */ - in_delmulti(imo->imo_membership[i]); - /* - * Remove the gap in the membership array. - */ - for (++i; i < imo->imo_num_memberships; ++i) - imo->imo_membership[i-1] = imo->imo_membership[i]; - --imo->imo_num_memberships; - splx(s); - break; -#endif - default: - error = EOPNOTSUPP; - break; - } - - /* - * If all options have default values, no need to keep the mbuf. - */ - if (imo->imo_multicast_ifp == NULL && - imo->imo_multicast_vif == -1 && - imo->imo_multicast_ttl == IP_DEFAULT_MULTICAST_TTL && - imo->imo_multicast_loop == IP_DEFAULT_MULTICAST_LOOP && - imo->imo_num_memberships == 0) { - free(*imop, M_IPMOPTS); - *imop = NULL; - } - - return (error); -} - -/* - * Return the IP multicast options in response to user getsockopt(). - */ -int -ip_getmoptions(optname, imo, mp) - int optname; - register struct ip_moptions *imo; - register struct mbuf **mp; -{ -#ifndef __REACTOS__ - u_char *ttl; - u_char *loop; - struct in_addr *addr; - struct in_ifaddr *ia; -#endif - - *mp = m_get(M_WAIT, MT_SOOPTS); - - switch (optname) { -#ifndef __REACTOS__ - case IP_MULTICAST_VIF: - if (imo != NULL) - *(mtod(*mp, int *)) = imo->imo_multicast_vif; - else - *(mtod(*mp, int *)) = -1; - (*mp)->m_len = sizeof(int); - return(0); - - case IP_MULTICAST_IF: - addr = mtod(*mp, struct in_addr *); - (*mp)->m_len = sizeof(struct in_addr); - if (imo == NULL || imo->imo_multicast_ifp == NULL) - addr->s_addr = INADDR_ANY; - else { - IFP_TO_IA(imo->imo_multicast_ifp, ia); - addr->s_addr = (ia == NULL) ? INADDR_ANY - : IA_SIN(ia)->sin_addr.s_addr; - } - return (0); - - case IP_MULTICAST_TTL: - ttl = mtod(*mp, u_char *); - (*mp)->m_len = 1; - *ttl = (imo == NULL) ? IP_DEFAULT_MULTICAST_TTL - : imo->imo_multicast_ttl; - return (0); - - case IP_MULTICAST_LOOP: - loop = mtod(*mp, u_char *); - (*mp)->m_len = 1; - *loop = (imo == NULL) ? IP_DEFAULT_MULTICAST_LOOP - : imo->imo_multicast_loop; - return (0); -#endif - default: - return (EOPNOTSUPP); - } -} - -/* - * Discard the IP multicast options. - */ -void -ip_freemoptions(imo) - register struct ip_moptions *imo; -{ - register int i; - - if (imo != NULL) { - for (i = 0; i < imo->imo_num_memberships; ++i) - in_delmulti(imo->imo_membership[i]); - free(imo, M_IPMOPTS); - } -} - -#ifndef __REACTOS__ -/* - * Routine called from ip_output() to loop back a copy of an IP multicast - * packet to the input queue of a specified interface. Note that this - * calls the output routine of the loopback "driver", but with an interface - * pointer that might NOT be a loopback interface -- evil, but easier than - * replicating that code here. - */ -static void -ip_mloopback(ifp, m, dst) - struct ifnet *ifp; - register struct mbuf *m; - register struct sockaddr_in *dst; -{ - register struct ip *ip; - struct mbuf *copym; - - copym = m_copy(m, 0, M_COPYALL); - if (copym != NULL) { - /* - * We don't bother to fragment if the IP length is greater - * than the interface's MTU. Can this possibly matter? - */ - ip = mtod(copym, struct ip *); - ip->ip_len = htons((u_short)ip->ip_len); - ip->ip_off = htons((u_short)ip->ip_off); - ip->ip_sum = 0; - ip->ip_sum = in_cksum(copym, ip->ip_hl << 2); - (void) looutput(ifp, copym, (struct sockaddr *)dst, NULL); - } -} -#endif diff --git a/lib/drivers/oskittcp/oskittcp/kern_clock.c b/lib/drivers/oskittcp/oskittcp/kern_clock.c deleted file mode 100644 index 12907131486..00000000000 --- a/lib/drivers/oskittcp/oskittcp/kern_clock.c +++ /dev/null @@ -1,308 +0,0 @@ -/* - * Copyright (c) 1997-1998 University of Utah and the Flux Group. - * All rights reserved. - * - * This file is part of the Flux OSKit. The OSKit is free software, also known - * as "open source;" you can redistribute it and/or modify it under the terms - * of the GNU General Public License (GPL), version 2, as published by the Free - * Software Foundation (FSF). To explore alternate licensing terms, contact - * the University of Utah at csl-dist@cs.utah.edu or +1-801-585-3271. - * - * The OSKit 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 GPL for more details. You should have - * received a copy of the GPL along with the OSKit; see the file COPYING. If - * not, write to the FSF, 59 Temple Place #330, Boston, MA 02111-1307, USA. - */ -/* - * I am having no mercy with this file. - * I ripped out everything I didn't need - */ -/*- - * Copyright (c) 1982, 1986, 1991, 1993 - * The Regents of the University of California. All rights reserved. - * (c) UNIX System Laboratories, Inc. - * All or some portions of this file are derived from material licensed - * to the University of California by American Telephone and Telegraph - * Co. or Unix System Laboratories, Inc. and are reproduced herein with - * the permission of UNIX System Laboratories, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)kern_clock.c 8.5 (Berkeley) 1/21/94 - * $\Id: kern_clock.c,v 1.26 1996/07/30 16:59:22 bde Exp $ - */ - -/* Portions of this software are covered by the following: */ -/****************************************************************************** - * * - * Copyright (c) David L. Mills 1993, 1994 * - * * - * Permission to use, copy, modify, and distribute this software and its * - * documentation for any purpose and without fee is hereby granted, provided * - * that the above copyright notice appears in all copies and that both the * - * copyright notice and this permission notice appear in supporting * - * documentation, and that the name University of Delaware not be used in * - * advertising or publicity pertaining to distribution of the software * - * without specific, written prior permission. The University of Delaware * - * makes no representations about the suitability this software for any * - * purpose. It is provided "as is" without express or implied warranty. * - * * - *****************************************************************************/ - -#include -#include -#include -#include -#include - -/* Exported to machdep.c. */ -struct callout *callfree, *callout; - -struct callout calltodo; - -long tk_cancc; -long tk_nin; -long tk_nout; -long tk_rawcc; - -/* - * Clock handling routines. - * - * This code is written to operate with two timers that run independently of - * each other. The main clock, running hz times per second, is used to keep - * track of real time. The second timer handles kernel and user profiling, - * and does resource use estimation. If the second timer is programmable, - * it is randomized to avoid aliasing between the two clocks. For example, - * the randomization prevents an adversary from always giving up the cpu - * just before its quantum expires. Otherwise, it would never accumulate - * cpu ticks. The mean frequency of the second timer is stathz. - * - * If no second timer exists, stathz will be zero; in this case we drive - * profiling and statistics off the main clock. This WILL NOT be accurate; - * do not do it unless absolutely necessary. - * - * The statistics clock may (or may not) be run at a higher rate while - * profiling. This profile clock runs at profhz. We require that profhz - * be an integral multiple of stathz. - * - * If the statistics clock is running fast, it must be divided by the ratio - * profhz/stathz for statistics. (For profiling, every tick counts.) - */ - -/* - * TODO: - * allocate more timeout table slots when table overflows. - */ - -/* - * Bump a timeval by a small number of usec's. - */ -#define BUMPTIME(t, usec) { \ - register volatile struct timeval *tp = (t); \ - register long us; \ - \ - tp->tv_usec = us = tp->tv_usec + (usec); \ - if (us >= 1000000) { \ - tp->tv_usec = us - 1000000; \ - tp->tv_sec++; \ - } \ -} - -int ticks; -volatile struct timeval kern_time; -volatile struct timeval mono_time; - -/* - * Software (low priority) clock interrupt. - * Run periodic events from timeout queue. - */ -/*ARGSUSED*/ -void -softclock() -{ - register struct callout *c; - register void *arg; - register void (*func) __P((void *)); - register int s; - - s = splhigh(); - while ((c = calltodo.c_next) != NULL && c->c_time <= 0) { - func = c->c_func; - arg = c->c_arg; - calltodo.c_next = c->c_next; - c->c_next = callfree; - callfree = c; - splx(s); - (*func)(arg); - (void) splhigh(); - } - splx(s); -} - -/* - * timeout -- - * Execute a function after a specified length of time. - * - * untimeout -- - * Cancel previous timeout function call. - * - * See AT&T BCI Driver Reference Manual for specification. This - * implementation differs from that one in that no identification - * value is returned from timeout, rather, the original arguments - * to timeout are used to identify entries for untimeout. - */ -void -timeout(ftn, arg, ticks) - timeout_t ftn; - void *arg; - register int ticks; -{ - register struct callout *new, *p, *t; - register int s; - - if (ticks <= 0) - ticks = 1; - - /* Lock out the clock. */ - s = splhigh(); - - /* Fill in the next free callout structure. */ - if (callfree == NULL) - panic("timeout table full"); - new = callfree; - callfree = new->c_next; - new->c_arg = arg; - new->c_func = ftn; - - /* - * The time for each event is stored as a difference from the time - * of the previous event on the queue. Walk the queue, correcting - * the ticks argument for queue entries passed. Correct the ticks - * value for the queue entry immediately after the insertion point - * as well. Watch out for negative c_time values; these represent - * overdue events. - */ - for (p = &calltodo; - (t = p->c_next) != NULL && ticks > t->c_time; p = t) - if (t->c_time > 0) - ticks -= t->c_time; - new->c_time = ticks; - if (t != NULL) - t->c_time -= ticks; - - /* Insert the new entry into the queue. */ - p->c_next = new; - new->c_next = t; - splx(s); -} - -void -untimeout(ftn, arg) - timeout_t ftn; - void *arg; -{ - register struct callout *p, *t; - register int s; - - s = splhigh(); - for (p = &calltodo; (t = p->c_next) != NULL; p = t) - if (t->c_func == ftn && t->c_arg == arg) { - /* Increment next entry's tick count. */ - if (t->c_next && t->c_time > 0) - t->c_next->c_time += t->c_time; - - /* Move entry from callout queue to callfree queue. */ - p->c_next = t->c_next; - t->c_next = callfree; - callfree = t; - break; - } - splx(s); -} - -/* - * Compute number of hz until specified time. Used to - * compute third argument to timeout() from an absolute time. - */ -int -hzto(tv) - struct timeval *tv; -{ - register unsigned long ticks; - register long sec, usec; - int s; - - /* - * If the number of usecs in the whole seconds part of the time - * difference fits in a long, then the total number of usecs will - * fit in an unsigned long. Compute the total and convert it to - * ticks, rounding up and adding 1 to allow for the current tick - * to expire. Rounding also depends on unsigned long arithmetic - * to avoid overflow. - * - * Otherwise, if the number of ticks in the whole seconds part of - * the time difference fits in a long, then convert the parts to - * ticks separately and add, using similar rounding methods and - * overflow avoidance. This method would work in the previous - * case but it is slightly slower and assumes that hz is integral. - * - * Otherwise, round the time difference down to the maximum - * representable value. - * - * If ints have 32 bits, then the maximum value for any timeout in - * 10ms ticks is 248 days. - */ - s = splclock(); - sec = tv->tv_sec - kern_time.tv_sec; - usec = tv->tv_usec - kern_time.tv_usec; - splx(s); - if (usec < 0) { - sec--; - usec += 1000000; - } - if (sec < 0) { -#ifdef DIAGNOSTIC - printf("hzto: negative time difference %ld sec %ld usec\n", - sec, usec); -#endif - ticks = 1; - } else if (sec <= LONG_MAX / 1000000) - ticks = (sec * 1000000 + (unsigned long)usec + (tick - 1)) - / tick + 1; - else if (sec <= LONG_MAX / hz) - ticks = sec * hz - + ((unsigned long)usec + (tick - 1)) / tick + 1; - else - ticks = LONG_MAX; - if (ticks > INT_MAX) - ticks = INT_MAX; - return (ticks); -} - diff --git a/lib/drivers/oskittcp/oskittcp/kern_subr.c b/lib/drivers/oskittcp/oskittcp/kern_subr.c deleted file mode 100644 index a7daef481f3..00000000000 --- a/lib/drivers/oskittcp/oskittcp/kern_subr.c +++ /dev/null @@ -1,252 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1991, 1993 - * The Regents of the University of California. All rights reserved. - * (c) UNIX System Laboratories, Inc. - * All or some portions of this file are derived from material licensed - * to the University of California by American Telephone and Telegraph - * Co. or Unix System Laboratories, Inc. and are reproduced herein with - * the permission of UNIX System Laboratories, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)kern_subr.c 8.3 (Berkeley) 1/21/94 - */ - -#include -#include -#include -#include -#include -#include - -int -uiomove(cp, n, uio) - register caddr_t cp; - register int n; - register struct uio *uio; -{ - register struct iovec *iov; - u_int cnt; - int error; - -#ifdef DIAGNOSTIC - if (uio->uio_rw != UIO_READ && uio->uio_rw != UIO_WRITE) - panic("uiomove: mode"); - if (uio->uio_segflg == UIO_USERSPACE && uio->uio_procp != curproc) - panic("uiomove proc"); -#endif - while (n > 0 && uio->uio_resid) { - iov = uio->uio_iov; - cnt = iov->iov_len; - if (cnt == 0) { - uio->uio_iov++; - uio->uio_iovcnt--; - continue; - } - if (cnt > n) - cnt = n; - - switch (uio->uio_segflg) { - - case UIO_USERSPACE: - case UIO_USERISPACE: - if (uio->uio_rw == UIO_READ) - error = copyout(cp, iov->iov_base, cnt); - else - error = copyin(iov->iov_base, cp, cnt); - if (error) - return (error); - break; - - case UIO_SYSSPACE: - if (uio->uio_rw == UIO_READ) - bcopy((caddr_t)cp, iov->iov_base, cnt); - else - bcopy(iov->iov_base, (caddr_t)cp, cnt); - break; - case UIO_NOCOPY: - break; - } - iov->iov_base += cnt; - iov->iov_len -= cnt; - uio->uio_resid -= cnt; - uio->uio_offset += cnt; - cp += cnt; - n -= cnt; - } - return (0); -} - -/* - * Give next character to user as result of read. - */ -int -ureadc(c, uio) - register int c; - register struct uio *uio; -{ - register struct iovec *iov; - -again: - if (uio->uio_iovcnt == 0 || uio->uio_resid == 0) - panic("ureadc"); - iov = uio->uio_iov; - if (iov->iov_len == 0) { - uio->uio_iovcnt--; - uio->uio_iov++; - goto again; - } - switch (uio->uio_segflg) { - - case UIO_USERSPACE: - if (subyte(iov->iov_base, c) < 0) - return (EFAULT); - break; - - case UIO_SYSSPACE: - *iov->iov_base = c; - break; - - case UIO_USERISPACE: - if (suibyte(iov->iov_base, c) < 0) - return (EFAULT); - break; - case UIO_NOCOPY: - break; - } - iov->iov_base++; - iov->iov_len--; - uio->uio_resid--; - uio->uio_offset++; - return (0); -} - -#ifdef vax /* unused except by ct.c, other oddities XXX */ -/* - * Get next character written in by user from uio. - */ -int -uwritec(uio) - struct uio *uio; -{ - register struct iovec *iov; - register int c; - - if (uio->uio_resid <= 0) - return (-1); -again: - if (uio->uio_iovcnt <= 0) - panic("uwritec"); - iov = uio->uio_iov; - if (iov->iov_len == 0) { - uio->uio_iov++; - if (--uio->uio_iovcnt == 0) - return (-1); - goto again; - } - switch (uio->uio_segflg) { - - case UIO_USERSPACE: - c = fubyte(iov->iov_base); - break; - - case UIO_SYSSPACE: - c = *(u_char *) iov->iov_base; - break; - - case UIO_USERISPACE: - c = fuibyte(iov->iov_base); - break; - } - if (c < 0) - return (-1); - iov->iov_base++; - iov->iov_len--; - uio->uio_resid--; - uio->uio_offset++; - return (c); -} -#endif /* vax */ - -/* - * General routine to allocate a hash table. - */ -void * -hashinit(elements, type, hashmask) - int elements, type; - u_long *hashmask; -{ - long hashsize; - LIST_HEAD(generic, generic) *hashtbl; - int i; - - if (elements <= 0) - panic("hashinit: bad elements"); - for (hashsize = 1; hashsize <= elements; hashsize <<= 1) - continue; - hashsize >>= 1; - hashtbl = malloc((u_long)hashsize * sizeof(*hashtbl), type, M_WAITOK); - for (i = 0; i < hashsize; i++) - LIST_INIT(&hashtbl[i]); - *hashmask = hashsize - 1; - return (hashtbl); -} - -#define NPRIMES 27 -static int primes[] = { 1, 13, 31, 61, 127, 251, 509, 761, 1021, 1531, 2039, - 2557, 3067, 3583, 4093, 4603, 5119, 5623, 6143, 6653, - 7159, 7673, 8191, 12281, 16381, 24571, 32749 }; - -/* - * General routine to allocate a prime number sized hash table. - */ -void * -phashinit(elements, type, nentries) - int elements, type; - u_long *nentries; -{ - long hashsize; - LIST_HEAD(generic, generic) *hashtbl; - int i; - - if (elements <= 0) - panic("phashinit: bad elements"); - for (i = 1, hashsize = primes[1]; hashsize <= elements;) { - i++; - if (i == NPRIMES) - break; - hashsize = primes[i]; - } - hashsize = primes[i - 1]; - hashtbl = malloc((u_long)hashsize * sizeof(*hashtbl), type, M_WAITOK); - for (i = 0; i < hashsize; i++) - LIST_INIT(&hashtbl[i]); - *nentries = hashsize; - return (hashtbl); -} diff --git a/lib/drivers/oskittcp/oskittcp/osenv.c b/lib/drivers/oskittcp/oskittcp/osenv.c deleted file mode 100644 index aa8d246c63f..00000000000 --- a/lib/drivers/oskittcp/oskittcp/osenv.c +++ /dev/null @@ -1,50 +0,0 @@ -#include "oskittcp.h" - -unsigned oskit_freebsd_cpl; - -/* We have to store a reference count somewhere so we - * don't free a buffer being referenced in another mbuf. - * I just decided to add an extra char to the beginning of - * the buffer and store the reference count there. I doubt the ref count - * will ever even get close to 0xFF so we should be ok. Remember that - * only one thread can ever be inside oskit due to OSKLock so this should - * be safe. - */ - -void oskit_bufio_addref(void *buf) -{ - unsigned char* fullbuf = ((unsigned char*)buf) - sizeof(char); - -#if DBG - if (fullbuf[0] == 0xFF) - panic("oskit_bufio_addref: ref count overflow"); -#endif - - fullbuf[0]++; -} -void oskit_bufio_release(void *buf) -{ - unsigned char* fullbuf = ((unsigned char*)buf) - sizeof(char); - - if (--fullbuf[0] == 0) - free(fullbuf, 0); -} -void* oskit_bufio_create(int len) -{ - unsigned char* fullbuf = malloc(len + sizeof(char), __FILE__, __LINE__); - if (fullbuf == NULL) - return NULL; - - fullbuf[0] = 1; - - return (void*)(fullbuf + sizeof(char)); -} -void oskit_bufio_map(void *srcbuf, void**dstbuf, int off, int len) -{ -#if DBG - if (off != 0) - panic("oskit_bufio_map: offset is non-zero"); -#endif - - *dstbuf = srcbuf; -} diff --git a/lib/drivers/oskittcp/oskittcp/param.c b/lib/drivers/oskittcp/oskittcp/param.c deleted file mode 100644 index da631e16a81..00000000000 --- a/lib/drivers/oskittcp/oskittcp/param.c +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) 1997-1998 University of Utah and the Flux Group. - * All rights reserved. - * - * This file is part of the Flux OSKit. The OSKit is free software, also known - * as "open source;" you can redistribute it and/or modify it under the terms - * of the GNU General Public License (GPL), version 2, as published by the Free - * Software Foundation (FSF). To explore alternate licensing terms, contact - * the University of Utah at csl-dist@cs.utah.edu or +1-801-585-3271. - * - * The OSKit 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 GPL for more details. You should have - * received a copy of the GPL along with the OSKit; see the file COPYING. If - * not, write to the FSF, 59 Temple Place #330, Boston, MA 02111-1307, USA. - */ - -#define HZ 100 -#define MAXUSERS 64 - -int hz = HZ; -int tick = 1000000 / HZ; -int nmbclusters = 512 + MAXUSERS * 16; - diff --git a/lib/drivers/oskittcp/oskittcp/radix.c b/lib/drivers/oskittcp/oskittcp/radix.c deleted file mode 100644 index a23552cc517..00000000000 --- a/lib/drivers/oskittcp/oskittcp/radix.c +++ /dev/null @@ -1,1006 +0,0 @@ -/* - * Copyright (c) 1988, 1989, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)radix.c 8.4 (Berkeley) 11/2/94 - */ - -/* - * Routines to build and maintain radix trees for routing lookups. - */ -#ifndef _RADIX_H_ -#include -#ifdef KERNEL -#include -#include -#define M_DONTWAIT M_NOWAIT -#include -#else -#include -#endif -#include -#include -#endif -#include - -int max_keylen; -struct radix_mask *rn_mkfreelist; -struct radix_node_head *mask_rnhead; -static char *addmask_key; -static char normal_chars[] = {0, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, -1}; -static char *rn_zeros, *rn_ones; - -#define rn_masktop (mask_rnhead->rnh_treetop) -#undef Bcmp -#define Bcmp(a, b, l) (l == 0 ? 0 : bcmp((caddr_t)(a), (caddr_t)(b), (u_long)l)) -/* - * The data structure for the keys is a radix tree with one way - * branching removed. The index rn_b at an internal node n represents a bit - * position to be tested. The tree is arranged so that all descendants - * of a node n have keys whose bits all agree up to position rn_b - 1. - * (We say the index of n is rn_b.) - * - * There is at least one descendant which has a one bit at position rn_b, - * and at least one with a zero there. - * - * A route is determined by a pair of key and mask. We require that the - * bit-wise logical and of the key and mask to be the key. - * We define the index of a route to associated with the mask to be - * the first bit number in the mask where 0 occurs (with bit number 0 - * representing the highest order bit). - * - * We say a mask is normal if every bit is 0, past the index of the mask. - * If a node n has a descendant (k, m) with index(m) == index(n) == rn_b, - * and m is a normal mask, then the route applies to every descendant of n. - * If the index(m) < rn_b, this implies the trailing last few bits of k - * before bit b are all 0, (and hence consequently true of every descendant - * of n), so the route applies to all descendants of the node as well. - * - * Similar logic shows that a non-normal mask m such that - * index(m) <= index(n) could potentially apply to many children of n. - * Thus, for each non-host route, we attach its mask to a list at an internal - * node as high in the tree as we can go. - * - * The present version of the code makes use of normal routes in short- - * circuiting an explict mask and compare operation when testing whether - * a key satisfies a normal route, and also in remembering the unique leaf - * that governs a subtree. - */ - -struct radix_node * -rn_search(v_arg, head) - void *v_arg; - struct radix_node *head; -{ - register struct radix_node *x; - register caddr_t v; - - for (x = head, v = v_arg; x->rn_b >= 0;) { - if (x->rn_bmask & v[x->rn_off]) - x = x->rn_r; - else - x = x->rn_l; - } - return (x); -}; - -struct radix_node * -rn_search_m(v_arg, head, m_arg) - struct radix_node *head; - void *v_arg, *m_arg; -{ - register struct radix_node *x; - register caddr_t v = v_arg, m = m_arg; - - for (x = head; x->rn_b >= 0;) { - if ((x->rn_bmask & m[x->rn_off]) && - (x->rn_bmask & v[x->rn_off])) - x = x->rn_r; - else - x = x->rn_l; - } - return x; -}; - -int -rn_refines(m_arg, n_arg) - void *m_arg, *n_arg; -{ - register caddr_t m = m_arg, n = n_arg; - register caddr_t lim, lim2 = lim = n + *(u_char *)n; - int longer = (*(u_char *)n++) - (int)(*(u_char *)m++); - int masks_are_equal = 1; - - if (longer > 0) - lim -= longer; - while (n < lim) { - if (*n & ~(*m)) - return 0; - if (*n++ != *m++) - masks_are_equal = 0; - } - while (n < lim2) - if (*n++) - return 0; - if (masks_are_equal && (longer < 0)) - for (lim2 = m - longer; m < lim2; ) - if (*m++) - return 1; - return (!masks_are_equal); -} - -struct radix_node * -rn_lookup(v_arg, m_arg, head) - void *v_arg, *m_arg; - struct radix_node_head *head; -{ - register struct radix_node *x; - caddr_t netmask = 0; - - if (m_arg) { - if ((x = rn_addmask(m_arg, 1, head->rnh_treetop->rn_off)) == 0) - return (0); - netmask = x->rn_key; - } - x = rn_match(v_arg, head); - if (x && netmask) { - while (x && x->rn_mask != netmask) - x = x->rn_dupedkey; - } - return x; -} - -static int -rn_satsifies_leaf(trial, leaf, skip) - char *trial; - register struct radix_node *leaf; - int skip; -{ - register char *cp = trial, *cp2 = leaf->rn_key, *cp3 = leaf->rn_mask; - char *cplim; - int length = min(*(u_char *)cp, *(u_char *)cp2); - - if (cp3 == 0) - cp3 = rn_ones; - else - length = min(length, *(u_char *)cp3); - cplim = cp + length; cp3 += skip; cp2 += skip; - for (cp += skip; cp < cplim; cp++, cp2++, cp3++) - if ((*cp ^ *cp2) & *cp3) - return 0; - return 1; -} - -struct radix_node * -rn_match(v_arg, head) - void *v_arg; - struct radix_node_head *head; -{ - caddr_t v = v_arg; - register struct radix_node *t = head->rnh_treetop, *x; - register caddr_t cp = v, cp2; - caddr_t cplim; - struct radix_node *saved_t, *top = t; - int off = t->rn_off, vlen = *(u_char *)cp, matched_off; - register int test, b, rn_b; - - /* - * Open code rn_search(v, top) to avoid overhead of extra - * subroutine call. - */ - for (; t->rn_b >= 0; ) { - if (t->rn_bmask & cp[t->rn_off]) - t = t->rn_r; - else - t = t->rn_l; - } - /* - * See if we match exactly as a host destination - * or at least learn how many bits match, for normal mask finesse. - * - * It doesn't hurt us to limit how many bytes to check - * to the length of the mask, since if it matches we had a genuine - * match and the leaf we have is the most specific one anyway; - * if it didn't match with a shorter length it would fail - * with a long one. This wins big for class B&C netmasks which - * are probably the most common case... - */ - if (t->rn_mask) - vlen = *(u_char *)t->rn_mask; - cp += off; cp2 = t->rn_key + off; cplim = v + vlen; - for (; cp < cplim; cp++, cp2++) - if (*cp != *cp2) - goto on1; - /* - * This extra grot is in case we are explicitly asked - * to look up the default. Ugh! - */ - if ((t->rn_flags & RNF_ROOT) && t->rn_dupedkey) - t = t->rn_dupedkey; - return t; -on1: - test = (*cp ^ *cp2) & 0xff; /* find first bit that differs */ - for (b = 7; (test >>= 1) > 0;) - b--; - matched_off = cp - v; - b += matched_off << 3; - rn_b = -1 - b; - /* - * If there is a host route in a duped-key chain, it will be first. - */ - if ((saved_t = t)->rn_mask == 0) - t = t->rn_dupedkey; - for (; t; t = t->rn_dupedkey) - /* - * Even if we don't match exactly as a host, - * we may match if the leaf we wound up at is - * a route to a net. - */ - if (t->rn_flags & RNF_NORMAL) { - if (rn_b <= t->rn_b) - return t; - } else if (rn_satsifies_leaf(v, t, matched_off)) - return t; - t = saved_t; - /* start searching up the tree */ - do { - register struct radix_mask *m; - t = t->rn_p; - m = t->rn_mklist; - if (m) { - /* - * If non-contiguous masks ever become important - * we can restore the masking and open coding of - * the search and satisfaction test and put the - * calculation of "off" back before the "do". - */ - do { - if (m->rm_flags & RNF_NORMAL) { - if (rn_b <= m->rm_b) - return (m->rm_leaf); - } else { - off = min(t->rn_off, matched_off); - x = rn_search_m(v, t, m->rm_mask); - while (x && x->rn_mask != m->rm_mask) - x = x->rn_dupedkey; - if (x && rn_satsifies_leaf(v, x, off)) - return x; - } - m = m->rm_mklist; - } while (m); - } - } while (t != top); - return 0; -}; - -#ifdef RN_DEBUG -int rn_nodenum; -struct radix_node *rn_clist; -int rn_saveinfo; -int rn_debug = 1; -#endif - -struct radix_node * -rn_newpair(v, b, nodes) - void *v; - int b; - struct radix_node nodes[2]; -{ - register struct radix_node *tt = nodes, *t = tt + 1; - t->rn_b = b; t->rn_bmask = 0x80 >> (b & 7); - t->rn_l = tt; t->rn_off = b >> 3; - tt->rn_b = -1; tt->rn_key = (caddr_t)v; tt->rn_p = t; - tt->rn_flags = t->rn_flags = RNF_ACTIVE; -#ifdef RN_DEBUG - tt->rn_info = rn_nodenum++; t->rn_info = rn_nodenum++; - tt->rn_twin = t; tt->rn_ybro = rn_clist; rn_clist = tt; -#endif - return t; -} - -struct radix_node * -rn_insert(v_arg, head, dupentry, nodes) - void *v_arg; - struct radix_node_head *head; - int *dupentry; - struct radix_node nodes[2]; -{ - caddr_t v = v_arg; - struct radix_node *top = head->rnh_treetop; - int head_off = top->rn_off, vlen = (int)*((u_char *)v); - register struct radix_node *t = rn_search(v_arg, top); - register caddr_t cp = v + head_off; - register int b; - struct radix_node *tt; - /* - * Find first bit at which v and t->rn_key differ - */ - { - register caddr_t cp2 = t->rn_key + head_off; - register int cmp_res; - caddr_t cplim = v + vlen; - - while (cp < cplim) - if (*cp2++ != *cp++) - goto on1; - *dupentry = 1; - return t; -on1: - *dupentry = 0; - cmp_res = (cp[-1] ^ cp2[-1]) & 0xff; - for (b = (cp - v) << 3; cmp_res; b--) - cmp_res >>= 1; - } - { - register struct radix_node *p, *x = top; - cp = v; - do { - p = x; - if (cp[x->rn_off] & x->rn_bmask) - x = x->rn_r; - else x = x->rn_l; - } while (b > (unsigned) x->rn_b); /* x->rn_b < b && x->rn_b >= 0 */ -#ifdef RN_DEBUG - if (rn_debug) - log(LOG_DEBUG, "rn_insert: Going In:\n"), traverse(p); -#endif - t = rn_newpair(v_arg, b, nodes); tt = t->rn_l; - if ((cp[p->rn_off] & p->rn_bmask) == 0) - p->rn_l = t; - else - p->rn_r = t; - x->rn_p = t; t->rn_p = p; /* frees x, p as temp vars below */ - if ((cp[t->rn_off] & t->rn_bmask) == 0) { - t->rn_r = x; - } else { - t->rn_r = tt; t->rn_l = x; - } -#ifdef RN_DEBUG - if (rn_debug) - log(LOG_DEBUG, "rn_insert: Coming Out:\n"), traverse(p); -#endif - } - return (tt); -} - -struct radix_node * -rn_addmask(n_arg, search, skip) - int search, skip; - void *n_arg; -{ - caddr_t netmask = (caddr_t)n_arg; - register struct radix_node *x; - register caddr_t cp, cplim; - register int b = 0, mlen, j; - int maskduplicated, m0, isnormal; - struct radix_node *saved_x; - static int last_zeroed = 0; - - if ((mlen = *(u_char *)netmask) > max_keylen) - mlen = max_keylen; - if (skip == 0) - skip = 1; - if (mlen <= skip) - return (mask_rnhead->rnh_nodes); - if (skip > 1) - Bcopy(rn_ones + 1, addmask_key + 1, skip - 1); - if ((m0 = mlen) > skip) - Bcopy(netmask + skip, addmask_key + skip, mlen - skip); - /* - * Trim trailing zeroes. - */ - for (cp = addmask_key + mlen; (cp > addmask_key) && cp[-1] == 0;) - cp--; - mlen = cp - addmask_key; - if (mlen <= skip) { - if (m0 >= last_zeroed) - last_zeroed = mlen; - return (mask_rnhead->rnh_nodes); - } - if (m0 < last_zeroed) - Bzero(addmask_key + m0, last_zeroed - m0); - *addmask_key = last_zeroed = mlen; - x = rn_search(addmask_key, rn_masktop); - if (Bcmp(addmask_key, x->rn_key, mlen) != 0) - x = 0; - if (x || search) - return (x); - R_Malloc(x, struct radix_node *, max_keylen + 2 * sizeof (*x)); - if ((saved_x = x) == 0) - return (0); - Bzero(x, max_keylen + 2 * sizeof (*x)); - netmask = cp = (caddr_t)(x + 2); - Bcopy(addmask_key, cp, mlen); - x = rn_insert(cp, mask_rnhead, &maskduplicated, x); - if (maskduplicated) { - log(LOG_ERR, "rn_addmask: mask impossibly already in tree"); - Free(saved_x); - return (x); - } - /* - * Calculate index of mask, and check for normalcy. - */ - cplim = netmask + mlen; isnormal = 1; - for (cp = netmask + skip; (cp < cplim) && *(u_char *)cp == 0xff;) - cp++; - if (cp != cplim) { - for (j = 0x80; (j & *cp) != 0; j >>= 1) - b++; - if (*cp != normal_chars[b] || cp != (cplim - 1)) - isnormal = 0; - } - b += (cp - netmask) << 3; - x->rn_b = -1 - b; - if (isnormal) - x->rn_flags |= RNF_NORMAL; - return (x); -} - -static int /* XXX: arbitrary ordering for non-contiguous masks */ -rn_lexobetter(m_arg, n_arg) - void *m_arg, *n_arg; -{ - register u_char *mp = m_arg, *np = n_arg, *lim; - - if (*mp > *np) - return 1; /* not really, but need to check longer one first */ - if (*mp == *np) - for (lim = mp + *mp; mp < lim;) - if (*mp++ > *np++) - return 1; - return 0; -} - -static struct radix_mask * -rn_new_radix_mask(tt, next) - register struct radix_node *tt; - register struct radix_mask *next; -{ - register struct radix_mask *m; - - MKGet(m); - if (m == 0) { - log(LOG_ERR, "Mask for route not entered\n"); - return (0); - } - Bzero(m, sizeof *m); - m->rm_b = tt->rn_b; - m->rm_flags = tt->rn_flags; - if (tt->rn_flags & RNF_NORMAL) - m->rm_leaf = tt; - else - m->rm_mask = tt->rn_mask; - m->rm_mklist = next; - tt->rn_mklist = m; - return m; -} - -struct radix_node * -rn_addroute(v_arg, n_arg, head, treenodes) - void *v_arg, *n_arg; - struct radix_node_head *head; - struct radix_node treenodes[2]; -{ - caddr_t v = (caddr_t)v_arg, netmask = (caddr_t)n_arg; - register struct radix_node *t, *x = 0, *tt; - struct radix_node *saved_tt, *top = head->rnh_treetop; - short b = 0, b_leaf = 0; - int keyduplicated; - caddr_t mmask; - struct radix_mask *m, **mp; - - /* - * In dealing with non-contiguous masks, there may be - * many different routes which have the same mask. - * We will find it useful to have a unique pointer to - * the mask to speed avoiding duplicate references at - * nodes and possibly save time in calculating indices. - */ - if (netmask) { - if ((x = rn_addmask(netmask, 0, top->rn_off)) == 0) - return (0); - b_leaf = x->rn_b; - b = -1 - x->rn_b; - netmask = x->rn_key; - } - /* - * Deal with duplicated keys: attach node to previous instance - */ - saved_tt = tt = rn_insert(v, head, &keyduplicated, treenodes); - if (keyduplicated) { - for (t = tt; tt; t = tt, tt = tt->rn_dupedkey) { - if (tt->rn_mask == netmask) - return (0); - if (netmask == 0 || - (tt->rn_mask && - ((b_leaf < tt->rn_b) || /* index(netmask) > node */ - rn_refines(netmask, tt->rn_mask) || - rn_lexobetter(netmask, tt->rn_mask)))) - break; - } - /* - * If the mask is not duplicated, we wouldn't - * find it among possible duplicate key entries - * anyway, so the above test doesn't hurt. - * - * We sort the masks for a duplicated key the same way as - * in a masklist -- most specific to least specific. - * This may require the unfortunate nuisance of relocating - * the head of the list. - */ - if (tt == saved_tt) { - struct radix_node *xx = x; - /* link in at head of list */ - (tt = treenodes)->rn_dupedkey = t; - tt->rn_flags = t->rn_flags; - tt->rn_p = x = t->rn_p; - t->rn_p = tt; /* parent */ - if (x->rn_l == t) x->rn_l = tt; else x->rn_r = tt; - saved_tt = tt; x = xx; - } else { - (tt = treenodes)->rn_dupedkey = t->rn_dupedkey; - t->rn_dupedkey = tt; - tt->rn_p = t; /* parent */ - if (tt->rn_dupedkey) /* parent */ - tt->rn_dupedkey->rn_p = tt; /* parent */ - } -#ifdef RN_DEBUG - t=tt+1; tt->rn_info = rn_nodenum++; t->rn_info = rn_nodenum++; - tt->rn_twin = t; tt->rn_ybro = rn_clist; rn_clist = tt; -#endif - tt->rn_key = (caddr_t) v; - tt->rn_b = -1; - tt->rn_flags = RNF_ACTIVE; - } - /* - * Put mask in tree. - */ - if (netmask) { - tt->rn_mask = netmask; - tt->rn_b = x->rn_b; - tt->rn_flags |= x->rn_flags & RNF_NORMAL; - } - t = saved_tt->rn_p; - if (keyduplicated) - goto on2; - b_leaf = -1 - t->rn_b; - if (t->rn_r == saved_tt) x = t->rn_l; else x = t->rn_r; - /* Promote general routes from below */ - if (x->rn_b < 0) { - for (mp = &t->rn_mklist; x; x = x->rn_dupedkey) - if (x->rn_mask && (x->rn_b >= b_leaf) && x->rn_mklist == 0) { - *mp = m = rn_new_radix_mask(x, 0); - if (m) - mp = &m->rm_mklist; - } - } else if (x->rn_mklist) { - /* - * Skip over masks whose index is > that of new node - */ - for (mp = &x->rn_mklist; (m = *mp); mp = &m->rm_mklist) - if (m->rm_b >= b_leaf) - break; - t->rn_mklist = m; *mp = 0; - } -on2: - /* Add new route to highest possible ancestor's list */ - if ((netmask == 0) || (b > t->rn_b )) - return tt; /* can't lift at all */ - b_leaf = tt->rn_b; - do { - x = t; - t = t->rn_p; - } while (b <= t->rn_b && x != top); - /* - * Search through routes associated with node to - * insert new route according to index. - * Need same criteria as when sorting dupedkeys to avoid - * double loop on deletion. - */ - for (mp = &x->rn_mklist; (m = *mp); mp = &m->rm_mklist) { - if (m->rm_b < b_leaf) - continue; - if (m->rm_b > b_leaf) - break; - if (m->rm_flags & RNF_NORMAL) { - mmask = m->rm_leaf->rn_mask; - if (tt->rn_flags & RNF_NORMAL) { - log(LOG_ERR, - "Non-unique normal route, mask not entered"); - return tt; - } - } else - mmask = m->rm_mask; - if (mmask == netmask) { - m->rm_refs++; - tt->rn_mklist = m; - return tt; - } - if (rn_refines(netmask, mmask) || rn_lexobetter(netmask, mmask)) - break; - } - *mp = rn_new_radix_mask(tt, *mp); - return tt; -} - -struct radix_node * -rn_delete(v_arg, netmask_arg, head) - void *v_arg, *netmask_arg; - struct radix_node_head *head; -{ - register struct radix_node *t, *p, *x, *tt; - struct radix_mask *m, *saved_m, **mp; - struct radix_node *dupedkey, *saved_tt, *top; - caddr_t v, netmask; - int b, head_off, vlen; - - v = v_arg; - netmask = netmask_arg; - x = head->rnh_treetop; - tt = rn_search(v, x); - head_off = x->rn_off; - vlen = *(u_char *)v; - saved_tt = tt; - top = x; - if (tt == 0 || - Bcmp(v + head_off, tt->rn_key + head_off, vlen - head_off)) - return (0); - /* - * Delete our route from mask lists. - */ - if (netmask) { - if ((x = rn_addmask(netmask, 1, head_off)) == 0) - return (0); - netmask = x->rn_key; - while (tt->rn_mask != netmask) - if ((tt = tt->rn_dupedkey) == 0) - return (0); - } - if (tt->rn_mask == 0 || (saved_m = m = tt->rn_mklist) == 0) - goto on1; - if (tt->rn_flags & RNF_NORMAL) { - if (m->rm_leaf != tt || m->rm_refs > 0) { - log(LOG_ERR, "rn_delete: inconsistent annotation\n"); - return 0; /* dangling ref could cause disaster */ - } - } else { - if (m->rm_mask != tt->rn_mask) { - log(LOG_ERR, "rn_delete: inconsistent annotation\n"); - goto on1; - } - if (--m->rm_refs >= 0) - goto on1; - } - b = -1 - tt->rn_b; - t = saved_tt->rn_p; - if (b > t->rn_b) - goto on1; /* Wasn't lifted at all */ - do { - x = t; - t = t->rn_p; - } while (b <= t->rn_b && x != top); - for (mp = &x->rn_mklist; (m = *mp); mp = &m->rm_mklist) - if (m == saved_m) { - *mp = m->rm_mklist; - MKFree(m); - break; - } - if (m == 0) { - log(LOG_ERR, "rn_delete: couldn't find our annotation\n"); - if (tt->rn_flags & RNF_NORMAL) - return (0); /* Dangling ref to us */ - } -on1: - /* - * Eliminate us from tree - */ - if (tt->rn_flags & RNF_ROOT) - return (0); -#ifdef RN_DEBUG - /* Get us out of the creation list */ - for (t = rn_clist; t && t->rn_ybro != tt; t = t->rn_ybro) {} - if (t) t->rn_ybro = tt->rn_ybro; -#endif - t = tt->rn_p; - dupedkey = saved_tt->rn_dupedkey; - if (dupedkey) { - /* - * at this point, tt is the deletion target and saved_tt - * is the head of the dupekey chain - */ - if (tt == saved_tt) { - /* remove from head of chain */ - x = dupedkey; x->rn_p = t; - if (t->rn_l == tt) t->rn_l = x; else t->rn_r = x; - } else { - /* find node in front of tt on the chain */ - for (x = p = saved_tt; p && p->rn_dupedkey != tt;) - p = p->rn_dupedkey; - if (p) { - p->rn_dupedkey = tt->rn_dupedkey; - if (tt->rn_dupedkey) /* parent */ - tt->rn_dupedkey->rn_p = p; /* parent */ - } else log(LOG_ERR, "rn_delete: couldn't find us\n"); - } - t = tt + 1; - if (t->rn_flags & RNF_ACTIVE) { -#ifndef RN_DEBUG - *++x = *t; p = t->rn_p; -#else - b = t->rn_info; *++x = *t; t->rn_info = b; p = t->rn_p; -#endif - if (p->rn_l == t) p->rn_l = x; else p->rn_r = x; - x->rn_l->rn_p = x; x->rn_r->rn_p = x; - } - goto out; - } - if (t->rn_l == tt) x = t->rn_r; else x = t->rn_l; - p = t->rn_p; - if (p->rn_r == t) p->rn_r = x; else p->rn_l = x; - x->rn_p = p; - /* - * Demote routes attached to us. - */ - if (t->rn_mklist) { - if (x->rn_b >= 0) { - for (mp = &x->rn_mklist; (m = *mp);) - mp = &m->rm_mklist; - *mp = t->rn_mklist; - } else { - /* If there are any key,mask pairs in a sibling - duped-key chain, some subset will appear sorted - in the same order attached to our mklist */ - for (m = t->rn_mklist; m && x; x = x->rn_dupedkey) - if (m == x->rn_mklist) { - struct radix_mask *mm = m->rm_mklist; - x->rn_mklist = 0; - if (--(m->rm_refs) < 0) - MKFree(m); - m = mm; - } - if (m) - log(LOG_ERR, "%s %p at %x\n", - "rn_delete: Orphaned Mask", m, x); - } - } - /* - * We may be holding an active internal node in the tree. - */ - x = tt + 1; - if (t != x) { -#ifndef RN_DEBUG - *t = *x; -#else - b = t->rn_info; *t = *x; t->rn_info = b; -#endif - t->rn_l->rn_p = t; t->rn_r->rn_p = t; - p = x->rn_p; - if (p->rn_l == x) p->rn_l = t; else p->rn_r = t; - } -out: - tt->rn_flags &= ~RNF_ACTIVE; - tt[1].rn_flags &= ~RNF_ACTIVE; - return (tt); -} - -/* - * This is the same as rn_walktree() except for the parameters and the - * exit. - */ -int -rn_walktree_from(h, a, m, f, w) - struct radix_node_head *h; - void *a, *m; - register int (*f)(); - void *w; -{ - int error; - struct radix_node *base, *next; - u_char *xa = (u_char *)a; - u_char *xm = (u_char *)m; - register struct radix_node *rn, *last = 0 /* shut up gcc */; - int stopping = 0; - int lastb; - - /* - * rn_search_m is sort-of-open-coded here. - */ - /* printf("about to search\n"); */ - for (rn = h->rnh_treetop; rn->rn_b >= 0; ) { - last = rn; - /* printf("rn_b %d, rn_bmask %x, xm[rn_off] %x\n", - rn->rn_b, rn->rn_bmask, xm[rn->rn_off]); */ - if (!(rn->rn_bmask & xm[rn->rn_off])) { - break; - } - if (rn->rn_bmask & xa[rn->rn_off]) { - rn = rn->rn_r; - } else { - rn = rn->rn_l; - } - } - /* printf("done searching\n"); */ - - /* - * Two cases: either we stepped off the end of our mask, - * in which case last == rn, or we reached a leaf, in which - * case we want to start from the last node we looked at. - * Either way, last is the node we want to start from. - */ - rn = last; - lastb = rn->rn_b; - - /* printf("rn %p, lastb %d\n", rn, lastb);*/ - - /* - * This gets complicated because we may delete the node - * while applying the function f to it, so we need to calculate - * the successor node in advance. - */ - while (rn->rn_b >= 0) - rn = rn->rn_l; - - while (!stopping) { - /* printf("node %p (%d)\n", rn, rn->rn_b); */ - base = rn; - /* If at right child go back up, otherwise, go right */ - while (rn->rn_p->rn_r == rn && !(rn->rn_flags & RNF_ROOT)) { - rn = rn->rn_p; - - /* if went up beyond last, stop */ - if (rn->rn_b < lastb) { - stopping = 1; - /* printf("up too far\n"); */ - } - } - - /* Find the next *leaf* since next node might vanish, too */ - for (rn = rn->rn_p->rn_r; rn->rn_b >= 0;) - rn = rn->rn_l; - next = rn; - /* Process leaves */ - while ((rn = base) != 0) { - base = rn->rn_dupedkey; - /* printf("leaf %p\n", rn); */ - if (!(rn->rn_flags & RNF_ROOT) - && (error = (*f)(rn, w))) - return (error); - } - rn = next; - - if (rn->rn_flags & RNF_ROOT) { - /* printf("root, stopping"); */ - stopping = 1; - } - - } - return 0; -} - -int -rn_walktree(h, f, w) - struct radix_node_head *h; - register int (*f)(); - void *w; -{ - int error; - struct radix_node *base, *next; - register struct radix_node *rn = h->rnh_treetop; - /* - * This gets complicated because we may delete the node - * while applying the function f to it, so we need to calculate - * the successor node in advance. - */ - /* First time through node, go left */ - while (rn->rn_b >= 0) - rn = rn->rn_l; - for (;;) { - base = rn; - /* If at right child go back up, otherwise, go right */ - while (rn->rn_p->rn_r == rn && (rn->rn_flags & RNF_ROOT) == 0) - rn = rn->rn_p; - /* Find the next *leaf* since next node might vanish, too */ - for (rn = rn->rn_p->rn_r; rn->rn_b >= 0;) - rn = rn->rn_l; - next = rn; - /* Process leaves */ - while ((rn = base)) { - base = rn->rn_dupedkey; - if (!(rn->rn_flags & RNF_ROOT) && (error = (*f)(rn, w))) - return (error); - } - rn = next; - if (rn->rn_flags & RNF_ROOT) - return (0); - } - /* NOTREACHED */ -} - -int -rn_inithead(head, off) - void **head; - int off; -{ - register struct radix_node_head *rnh; - register struct radix_node *t, *tt, *ttt; - if (*head) - return (1); - R_Malloc(rnh, struct radix_node_head *, sizeof (*rnh)); - if (rnh == 0) - return (0); - Bzero(rnh, sizeof (*rnh)); - *head = rnh; - t = rn_newpair(rn_zeros, off, rnh->rnh_nodes); - ttt = rnh->rnh_nodes + 2; - t->rn_r = ttt; - t->rn_p = t; - tt = t->rn_l; - tt->rn_flags = t->rn_flags = RNF_ROOT | RNF_ACTIVE; - tt->rn_b = -1 - off; - *ttt = *tt; - ttt->rn_key = rn_ones; - rnh->rnh_addaddr = rn_addroute; - rnh->rnh_deladdr = rn_delete; - rnh->rnh_matchaddr = rn_match; - rnh->rnh_lookup = rn_lookup; - rnh->rnh_walktree = rn_walktree; - rnh->rnh_walktree_from = rn_walktree_from; - rnh->rnh_treetop = t; - return (1); -} - -void -rn_init() -{ - char *cp, *cplim; -#ifdef KERNEL - struct domain *dom; - - for (dom = domains; dom; dom = dom->dom_next) - if (dom->dom_maxrtkey > max_keylen) - max_keylen = dom->dom_maxrtkey; -#endif - if (max_keylen == 0) { - log(LOG_ERR, - "rn_init: radix functions require max_keylen be set\n"); - return; - } - R_Malloc(rn_zeros, char *, 3 * max_keylen); - if (rn_zeros == NULL) - panic("rn_init"); - Bzero(rn_zeros, 3 * max_keylen); - rn_ones = cp = rn_zeros + max_keylen; - addmask_key = cplim = rn_ones + max_keylen; - while (cp < cplim) - *cp++ = -1; - if (rn_inithead((void **)&mask_rnhead, 0) == 0) - panic("rn_init 2"); -} diff --git a/lib/drivers/oskittcp/oskittcp/random.c b/lib/drivers/oskittcp/oskittcp/random.c deleted file mode 100644 index ffbf03030e1..00000000000 --- a/lib/drivers/oskittcp/oskittcp/random.c +++ /dev/null @@ -1,63 +0,0 @@ -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)random.c 8.1 (Berkeley) 6/10/93 - */ - -#include - -/* - * Pseudo-random number generator for randomizing the profiling clock, - * and whatever else we might use it for. The result is uniform on - * [0, 2^31 - 1]. - */ -unsigned long -random() -{ - static unsigned long randseed = 1; - register long x, hi, lo, t; - - /* - * Compute x[n + 1] = (7^5 * x[n]) mod (2^31 - 1). - * From "Random number generators: good ones are hard to find", - * Park and Miller, Communications of the ACM, vol. 31, no. 10, - * October 1988, p. 1195. - */ - x = randseed; - hi = x / 127773; - lo = x % 127773; - t = 16807 * lo - 2836 * hi; - if (t <= 0) - t += 0x7fffffff; - randseed = t; - return (t); -} diff --git a/lib/drivers/oskittcp/oskittcp/raw_cb.c b/lib/drivers/oskittcp/oskittcp/raw_cb.c deleted file mode 100644 index c0d39d84729..00000000000 --- a/lib/drivers/oskittcp/oskittcp/raw_cb.c +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright (c) 1980, 1986, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)raw_cb.c 8.1 (Berkeley) 6/10/93 - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include - -/* - * Routines to manage the raw protocol control blocks. - * - * TODO: - * hash lookups by protocol family/protocol + address family - * take care of unique address problems per AF? - * redo address binding to allow wildcards - */ - -u_long raw_sendspace = RAWSNDQ; -u_long raw_recvspace = RAWRCVQ; - -/* - * Allocate a control block and a nominal amount - * of buffer space for the socket. - */ -int -raw_attach(so, proto) - register struct socket *so; - int proto; -{ - register struct rawcb *rp = sotorawcb(so); - int error; - - /* - * It is assumed that raw_attach is called - * after space has been allocated for the - * rawcb. - */ - if (rp == 0) - return (ENOBUFS); - error = soreserve(so, raw_sendspace, raw_recvspace); - if (error) - return (error); - rp->rcb_socket = so; - rp->rcb_proto.sp_family = so->so_proto->pr_domain->dom_family; - rp->rcb_proto.sp_protocol = proto; - insque(rp, &rawcb); - return (0); -} - -/* - * Detach the raw connection block and discard - * socket resources. - */ -void -raw_detach(rp) - register struct rawcb *rp; -{ - struct socket *so = rp->rcb_socket; - - so->so_pcb = 0; - sofree(so); - remque(rp); -#ifdef notdef - if (rp->rcb_laddr) - m_freem(dtom(rp->rcb_laddr)); - rp->rcb_laddr = 0; -#endif - free((caddr_t)(rp), M_PCB); -} - -/* - * Disconnect and possibly release resources. - */ -void -raw_disconnect(rp) - struct rawcb *rp; -{ - -#ifdef notdef - if (rp->rcb_faddr) - m_freem(dtom(rp->rcb_faddr)); - rp->rcb_faddr = 0; -#endif - if (rp->rcb_socket->so_state & SS_NOFDREF) - raw_detach(rp); -} - -#ifdef notdef -int -raw_bind(so, nam) - register struct socket *so; - struct mbuf *nam; -{ - struct sockaddr *addr = mtod(nam, struct sockaddr *); - register struct rawcb *rp; - - if (ifnet == 0) - return (EADDRNOTAVAIL); - rp = sotorawcb(so); - nam = m_copym(nam, 0, M_COPYALL, M_WAITOK); - rp->rcb_laddr = mtod(nam, struct sockaddr *); - return (0); -} -#endif diff --git a/lib/drivers/oskittcp/oskittcp/raw_ip.c b/lib/drivers/oskittcp/oskittcp/raw_ip.c deleted file mode 100644 index dc2c31be8d4..00000000000 --- a/lib/drivers/oskittcp/oskittcp/raw_ip.c +++ /dev/null @@ -1,457 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1988, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)raw_ip.c 8.7 (Berkeley) 5/15/95 - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#ifndef __REACTOS__ -#include -#endif - -#include -#include - -static struct inpcbhead ripcb; -static struct inpcbinfo ripcbinfo; - -/* - * Nominal space allocated to a raw ip socket. - */ -#define RIPSNDQ 8192 -#define RIPRCVQ 8192 - -/* - * Raw interface to IP protocol. - */ - -/* - * Initialize raw connection block q. - */ -void -rip_init() -{ - LIST_INIT(&ripcb); - ripcbinfo.listhead = &ripcb; - /* - * XXX We don't use the hash list for raw IP, but it's easier - * to allocate a one entry hash list than it is to check all - * over the place for hashbase == NULL. - */ - ripcbinfo.hashbase = phashinit(1, M_PCB, &ripcbinfo.hashsize); -} - -static struct sockaddr_in ripsrc = { sizeof(ripsrc), AF_INET }; -/* - * Setup generic address and protocol structures - * for raw_input routine, then pass them along with - * mbuf chain. - */ -void -rip_input(m) - struct mbuf *m; -{ - register struct ip *ip = mtod(m, struct ip *); - register struct inpcb *inp; - struct socket *last = 0; - - ripsrc.sin_addr = ip->ip_src; - OS_DbgPrint(OSK_MID_TRACE,("ripsrc: %x\n", ip->ip_src)); - for (inp = ripcb.lh_first; inp != NULL; inp = inp->inp_list.le_next) { - OS_DbgPrint(OSK_MID_TRACE,("Looking at %d %x -> %x\n", - inp->inp_ip.ip_p, - inp->inp_laddr.s_addr, - inp->inp_faddr.s_addr)); - if (inp->inp_ip.ip_p && inp->inp_ip.ip_p != ip->ip_p) - continue; - if (inp->inp_laddr.s_addr && - inp->inp_laddr.s_addr != ip->ip_dst.s_addr) - continue; - if (inp->inp_faddr.s_addr && - inp->inp_faddr.s_addr != ip->ip_src.s_addr) - continue; - if (last) { - struct mbuf *n = m_copy(m, 0, (int)M_COPYALL); - if (n) { - if (sbappendaddr(&last->so_rcv, - (struct sockaddr *)&ripsrc, n, - (struct mbuf *)0) == 0) - /* should notify about lost packet */ - m_freem(n); - else - sorwakeup(last); - } - } - last = inp->inp_socket; - } - if (last) { - if (sbappendaddr(&last->so_rcv, (struct sockaddr *)&ripsrc, - m, (struct mbuf *)0) == 0) - m_freem(m); - else - sorwakeup(last); - } else { - m_freem(m); - ipstat.ips_noproto++; - ipstat.ips_delivered--; - } -} - -/* - * Generate IP header and pass packet to ip_output. - * Tack on options user may have setup with control call. - */ -int -rip_output(m, so, dst) - register struct mbuf *m; - struct socket *so; - u_long dst; -{ - register struct ip *ip; - register struct inpcb *inp = sotoinpcb(so); -#ifndef __REACTOS__ - struct mbuf *opts; -#endif - int flags = (so->so_options & SO_DONTROUTE) | IP_ALLOWBROADCAST; - - /* - * If the user handed us a complete IP packet, use it. - * Otherwise, allocate an mbuf for a header and fill it in. - */ - if ((inp->inp_flags & INP_HDRINCL) == 0) { - M_PREPEND(m, sizeof(struct ip), M_WAIT); - ip = mtod(m, struct ip *); - ip->ip_tos = 0; - ip->ip_off = 0; - ip->ip_p = inp->inp_ip.ip_p; - ip->ip_len = m->m_pkthdr.len; - ip->ip_src = inp->inp_laddr; - ip->ip_dst.s_addr = dst; - ip->ip_ttl = MAXTTL; - } else { - ip = mtod(m, struct ip *); - /* don't allow both user specified and setsockopt options, - and don't allow packet length sizes that will crash */ - if (((ip->ip_hl != (sizeof (*ip) >> 2)) && inp->inp_options) || - (ip->ip_len > m->m_pkthdr.len)) { - m_freem(m); - return EINVAL; - } - if (ip->ip_id == 0) - ip->ip_id = htons(ip_id++); - /* XXX prevent ip_output from overwriting header fields */ - flags |= IP_RAWOUTPUT; - ipstat.ips_rawout++; - } - return (ip_output(m, inp->inp_options, &inp->inp_route, flags, - inp->inp_moptions)); -} - -/* - * Raw IP socket option processing. - */ -int -rip_ctloutput(op, so, level, optname, m) - int op; - struct socket *so; - int level, optname; - struct mbuf **m; -{ - register int error = EINVAL; -#ifndef __REACTOS__ - register struct inpcb *inp = sotoinpcb(so); - - if (level != IPPROTO_IP) { - if (op == PRCO_SETOPT && *m) - (void)m_free(*m); - return (EINVAL); - } - - switch (optname) { - - case IP_HDRINCL: - error = 0; - if (op == PRCO_SETOPT) { - if (m == 0 || *m == 0 || (*m)->m_len < sizeof (int)) - error = EINVAL; - else if (*mtod(*m, int *)) - inp->inp_flags |= INP_HDRINCL; - else - inp->inp_flags &= ~INP_HDRINCL; - if (*m) - (void)m_free(*m); - } else { - *m = m_get(M_WAIT, MT_SOOPTS); - (*m)->m_len = sizeof (int); - *mtod(*m, int *) = inp->inp_flags & INP_HDRINCL; - } - return (error); - - case IP_FW_GET: - if (ip_fw_ctl_ptr==NULL || op == PRCO_SETOPT) { - if (*m) (void)m_free(*m); - return(EINVAL); - } - return (*ip_fw_ctl_ptr)(optname, m); - case IP_FW_ADD: - case IP_FW_DEL: - case IP_FW_FLUSH: - case IP_FW_ZERO: - if (ip_fw_ctl_ptr==NULL || op != PRCO_SETOPT) { - if (*m) (void)m_free(*m); - return(EINVAL); - } - - return (*ip_fw_ctl_ptr)(optname, m); - return(error); - - case IP_RSVP_ON: - return ip_rsvp_init(so); - break; - - case IP_RSVP_OFF: - return ip_rsvp_done(); - break; - - case IP_RSVP_VIF_ON: - return ip_rsvp_vif_init(so, *m); - - case IP_RSVP_VIF_OFF: - return ip_rsvp_vif_done(so, *m); - - case MRT_INIT: - case MRT_DONE: - case MRT_ADD_VIF: - case MRT_DEL_VIF: - case MRT_ADD_MFC: - case MRT_DEL_MFC: - case MRT_VERSION: - case MRT_ASSERT: - if (op == PRCO_SETOPT) { - error = ip_mrouter_set(optname, so, *m); - if (*m) - (void)m_free(*m); - } else if (op == PRCO_GETOPT) { - error = ip_mrouter_get(optname, so, m); - } else - error = EINVAL; - return (error); - } - return (ip_ctloutput(op, so, level, optname, m)); -#else - return error; -#endif -} - -static u_long rip_sendspace = RIPSNDQ; /* XXX sysctl ? */ -static u_long rip_recvspace = RIPRCVQ; /* XXX sysctl ? */ - -/*ARGSUSED*/ -int -rip_usrreq(so, req, m, nam, control) - register struct socket *so; - int req; - struct mbuf *m, *nam, *control; -{ - register int error = 0; - register struct inpcb *inp = sotoinpcb(so); - - if (req == PRU_CONTROL) - return (in_control(so, (u_long)m, (caddr_t)nam, - (struct ifnet *)control)); - - switch (req) { - - case PRU_ATTACH: - if (inp) - panic("rip_attach"); - if ((so->so_state & SS_PRIV) == 0) { - error = EACCES; - break; - } - if ((error = soreserve(so, rip_sendspace, rip_recvspace)) || - (error = in_pcballoc(so, &ripcbinfo))) - break; - inp = (struct inpcb *)so->so_pcb; - inp->inp_ip.ip_p = (int)nam; - break; - - case PRU_DISCONNECT: - if ((so->so_state & SS_ISCONNECTED) == 0) { - error = ENOTCONN; - break; - } - /* FALLTHROUGH */ - case PRU_ABORT: - soisdisconnected(so); - /* FALLTHROUGH */ - case PRU_DETACH: - if (inp == 0) - panic("rip_detach"); -#ifndef __REACTOS__ - if (so == ip_mrouter) - ip_mrouter_done(); - ip_rsvp_force_done(so); - if (so == ip_rsvpd) - ip_rsvp_done(); -#endif - in_pcbdetach(inp); - break; - - case PRU_BIND: - { - struct sockaddr_in *addr = mtod(nam, struct sockaddr_in *); - - if (nam->m_len != sizeof(*addr)) { - error = EINVAL; - break; - } - if ((ifnet == 0) || - ((addr->sin_family != AF_INET) && - (addr->sin_family != AF_IMPLINK)) || - (addr->sin_addr.s_addr && - ifa_ifwithaddr((struct sockaddr *)addr) == 0)) { - error = EADDRNOTAVAIL; - break; - } - inp->inp_laddr = addr->sin_addr; - break; - } - case PRU_CONNECT: - { - struct sockaddr_in *addr = mtod(nam, struct sockaddr_in *); - - if (nam->m_len != sizeof(*addr)) { - error = EINVAL; - break; - } - if (ifnet == 0) { - error = EADDRNOTAVAIL; - break; - } - if ((addr->sin_family != AF_INET) && - (addr->sin_family != AF_IMPLINK)) { - error = EAFNOSUPPORT; - break; - } - inp->inp_faddr = addr->sin_addr; - soisconnected(so); - break; - } - - case PRU_CONNECT2: - error = EOPNOTSUPP; - break; - - /* - * Mark the connection as being incapable of further input. - */ - case PRU_SHUTDOWN: - socantsendmore(so); - break; - - /* - * Ship a packet out. The appropriate raw output - * routine handles any massaging necessary. - */ - case PRU_SEND: - { - register u_long dst; - - if (so->so_state & SS_ISCONNECTED) { - if (nam) { - error = EISCONN; - break; - } - dst = inp->inp_faddr.s_addr; - } else { - if (nam == NULL) { - error = ENOTCONN; - break; - } - dst = mtod(nam, struct sockaddr_in *)->sin_addr.s_addr; - } - error = rip_output(m, so, dst); - m = NULL; - break; - } - - case PRU_SENSE: - /* - * stat: don't bother with a blocksize. - */ - return (0); - - /* - * Not supported. - */ - case PRU_RCVOOB: - case PRU_RCVD: - case PRU_LISTEN: - case PRU_ACCEPT: - case PRU_SENDOOB: - error = EOPNOTSUPP; - break; - - case PRU_SOCKADDR: - in_setsockaddr(inp, nam); - break; - - case PRU_PEERADDR: - in_setpeeraddr(inp, nam); - break; - - default: - panic("rip_usrreq"); - } - if (m != NULL) - m_freem(m); - return (error); -} diff --git a/lib/drivers/oskittcp/oskittcp/raw_usrreq.c b/lib/drivers/oskittcp/oskittcp/raw_usrreq.c deleted file mode 100644 index 286bcced72d..00000000000 --- a/lib/drivers/oskittcp/oskittcp/raw_usrreq.c +++ /dev/null @@ -1,314 +0,0 @@ -/* - * Copyright (c) 1980, 1986, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)raw_usrreq.c 8.1 (Berkeley) 6/10/93 - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include - -/* - * Initialize raw connection block q. - */ -void -raw_init() -{ - - rawcb.rcb_next = rawcb.rcb_prev = &rawcb; -} - - -/* - * Raw protocol input routine. Find the socket - * associated with the packet(s) and move them over. If - * nothing exists for this packet, drop it. - */ -/* - * Raw protocol interface. - */ -void -raw_input(m0, proto, src, dst) - struct mbuf *m0; - register struct sockproto *proto; - struct sockaddr *src, *dst; -{ - register struct rawcb *rp; - register struct mbuf *m = m0; - register int sockets = 0; - struct socket *last; - - last = 0; - for (rp = rawcb.rcb_next; rp != &rawcb; rp = rp->rcb_next) { - if (rp->rcb_proto.sp_family != proto->sp_family) - continue; - if (rp->rcb_proto.sp_protocol && - rp->rcb_proto.sp_protocol != proto->sp_protocol) - continue; - /* - * We assume the lower level routines have - * placed the address in a canonical format - * suitable for a structure comparison. - * - * Note that if the lengths are not the same - * the comparison will fail at the first byte. - */ -#define equal(a1, a2) \ - (bcmp((caddr_t)(a1), (caddr_t)(a2), a1->sa_len) == 0) - if (rp->rcb_laddr && !equal(rp->rcb_laddr, dst)) - continue; - if (rp->rcb_faddr && !equal(rp->rcb_faddr, src)) - continue; - if (last) { - struct mbuf *n; - n = m_copy(m, 0, (int)M_COPYALL); - if (n) { - if (sbappendaddr(&last->so_rcv, src, - n, (struct mbuf *)0) == 0) - /* should notify about lost packet */ - m_freem(n); - else { - sorwakeup(last); - sockets++; - } - } - } - last = rp->rcb_socket; - } - if (last) { - if (sbappendaddr(&last->so_rcv, src, - m, (struct mbuf *)0) == 0) - m_freem(m); - else { - sorwakeup(last); - sockets++; - } - } else - m_freem(m); -} - -/*ARGSUSED*/ -void -raw_ctlinput(cmd, arg) - int cmd; - struct sockaddr *arg; -{ - - if (cmd < 0 || cmd > PRC_NCMDS) - return; - /* INCOMPLETE */ -} - -/*ARGSUSED*/ -int -raw_usrreq(so, req, m, nam, control) - struct socket *so; - int req; - struct mbuf *m, *nam, *control; -{ - register struct rawcb *rp = sotorawcb(so); - register int error = 0; - int len; - - if (req == PRU_CONTROL) - return (EOPNOTSUPP); - if (control && control->m_len) { - error = EOPNOTSUPP; - goto release; - } - if (rp == 0) { - error = EINVAL; - goto release; - } - switch (req) { - - /* - * Allocate a raw control block and fill in the - * necessary info to allow packets to be routed to - * the appropriate raw interface routine. - */ - case PRU_ATTACH: - if ((so->so_state & SS_PRIV) == 0) { - error = EACCES; - break; - } - error = raw_attach(so, (int)nam); - break; - - /* - * Destroy state just before socket deallocation. - * Flush data or not depending on the options. - */ - case PRU_DETACH: - if (rp == 0) { - error = ENOTCONN; - break; - } - raw_detach(rp); - break; - - /* - * If a socket isn't bound to a single address, - * the raw input routine will hand it anything - * within that protocol family (assuming there's - * nothing else around it should go to). - */ - case PRU_CONNECT: - error = EINVAL; -#if 0 - if (rp->rcb_faddr) { - error = EISCONN; - break; - } - nam = m_copym(nam, 0, M_COPYALL, M_WAIT); - rp->rcb_faddr = mtod(nam, struct sockaddr *); - soisconnected(so); -#endif - break; - - case PRU_BIND: - error = EINVAL; -#if 0 - if (rp->rcb_laddr) { - error = EINVAL; /* XXX */ - break; - } - error = raw_bind(so, nam); -#endif - break; - - case PRU_CONNECT2: - error = EOPNOTSUPP; - goto release; - - case PRU_DISCONNECT: - if (rp->rcb_faddr == 0) { - error = ENOTCONN; - break; - } - raw_disconnect(rp); - soisdisconnected(so); - break; - - /* - * Mark the connection as being incapable of further input. - */ - case PRU_SHUTDOWN: - socantsendmore(so); - break; - - /* - * Ship a packet out. The appropriate raw output - * routine handles any massaging necessary. - */ - case PRU_SEND: - if (nam) { - if (rp->rcb_faddr) { - error = EISCONN; - break; - } - rp->rcb_faddr = mtod(nam, struct sockaddr *); - } else if (rp->rcb_faddr == 0) { - error = ENOTCONN; - break; - } - error = (*so->so_proto->pr_output)(m, so); - m = NULL; - if (nam) - rp->rcb_faddr = 0; - break; - - case PRU_ABORT: - raw_disconnect(rp); - sofree(so); - soisdisconnected(so); - break; - - case PRU_SENSE: - /* - * stat: don't bother with a blocksize. - */ - return (0); - - /* - * Not supported. - */ - case PRU_RCVOOB: - case PRU_RCVD: - return(EOPNOTSUPP); - - case PRU_LISTEN: - case PRU_ACCEPT: - case PRU_SENDOOB: - error = EOPNOTSUPP; - break; - - case PRU_SOCKADDR: - if (rp->rcb_laddr == 0) { - error = EINVAL; - break; - } - len = rp->rcb_laddr->sa_len; - bcopy((caddr_t)rp->rcb_laddr, mtod(nam, caddr_t), (unsigned)len); - nam->m_len = len; - break; - - case PRU_PEERADDR: - if (rp->rcb_faddr == 0) { - error = ENOTCONN; - break; - } - len = rp->rcb_faddr->sa_len; - bcopy((caddr_t)rp->rcb_faddr, mtod(nam, caddr_t), (unsigned)len); - nam->m_len = len; - break; - - default: - panic("raw_usrreq"); - } -release: - if (m != NULL) - m_freem(m); - return (error); -} diff --git a/lib/drivers/oskittcp/oskittcp/route.c b/lib/drivers/oskittcp/oskittcp/route.c deleted file mode 100644 index 59311a4648c..00000000000 --- a/lib/drivers/oskittcp/oskittcp/route.c +++ /dev/null @@ -1,818 +0,0 @@ -/* - * Copyright (c) 1980, 1986, 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)route.c 8.2 (Berkeley) 11/15/93 - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#ifndef __REACTOS__ -#include -#endif -#include - -#define SA(p) ((struct sockaddr *)(p)) - -int rttrash; /* routes not in table but not freed */ -struct sockaddr wildcard; /* zero valued cookie for wildcard searches */ - -void -rtable_init(table) - void **table; -{ - struct domain *dom; - for (dom = domains; dom; dom = dom->dom_next) - if (dom->dom_rtattach) - dom->dom_rtattach(&table[dom->dom_family], - dom->dom_rtoffset); -} - -void -route_init() -{ - rn_init(); /* initialize all zeroes, all ones, mask table */ - rtable_init((void **)rt_tables); -} - -/* - * Packet routing routines. - */ -void -rtalloc(ro) - register struct route *ro; -{ - if (ro->ro_rt && ro->ro_rt->rt_ifp && (ro->ro_rt->rt_flags & RTF_UP)) - return; /* XXX */ - ro->ro_rt = rtalloc1(&ro->ro_dst, 1, 0UL); -} - -void -rtalloc_ign(ro, ignore) - register struct route *ro; - u_long ignore; -{ - if (ro->ro_rt && ro->ro_rt->rt_ifp && (ro->ro_rt->rt_flags & RTF_UP)) - return; /* XXX */ - ro->ro_rt = rtalloc1(&ro->ro_dst, 1, ignore); -} - -struct rtentry * -rtalloc1(dst, report, ignflags) - register struct sockaddr *dst; - int report; - u_long ignflags; -{ -#ifndef __REACTOS__ - register struct radix_node_head *rnh = rt_tables[dst->sa_family]; - register struct rtentry *rt; - register struct radix_node *rn; - struct rtentry *newrt = 0; - struct rt_addrinfo info; - u_long nflags; - int s = splnet(), err = 0, msgtype = RTM_MISS; - - if (rnh && (rn = rnh->rnh_matchaddr((caddr_t)dst, rnh)) && - ((rn->rn_flags & RNF_ROOT) == 0)) { - newrt = rt = (struct rtentry *)rn; - nflags = rt->rt_flags & ~ignflags; - if (report && (nflags & (RTF_CLONING | RTF_PRCLONING))) { - err = rtrequest(RTM_RESOLVE, dst, SA(0), - SA(0), 0, &newrt); - if (err) { - newrt = rt; - rt->rt_refcnt++; - goto miss; - } - if ((rt = newrt) && (rt->rt_flags & RTF_XRESOLVE)) { - msgtype = RTM_RESOLVE; - goto miss; - } - } else - rt->rt_refcnt++; - } else { - rtstat.rts_unreach++; - miss: if (report) { - bzero((caddr_t)&info, sizeof(info)); - info.rti_info[RTAX_DST] = dst; - rt_missmsg(msgtype, &info, 0, err); - } - } - splx(s); - return (newrt); -#else - return NULL; -#endif -} - -void -rtfree(rt) - register struct rtentry *rt; -{ - register struct radix_node_head *rnh = - rt_tables[rt_key(rt)->sa_family]; - register struct ifaddr *ifa; - - if (rt == 0 || rnh == 0) - panic("rtfree"); - rt->rt_refcnt--; - if(rnh->rnh_close && rt->rt_refcnt == 0) { - rnh->rnh_close((struct radix_node *)rt, rnh); - } - if (rt->rt_refcnt <= 0 && (rt->rt_flags & RTF_UP) == 0) { - if (rt->rt_nodes->rn_flags & (RNF_ACTIVE | RNF_ROOT)) - panic ("rtfree 2"); - rttrash--; - if (rt->rt_refcnt < 0) { - printf("rtfree: %p not freed (neg refs)\n", rt); - return; - } - ifa = rt->rt_ifa; - IFAFREE(ifa); - if (rt->rt_parent) { - RTFREE(rt->rt_parent); - } - Free(rt_key(rt)); - Free(rt); - } -} - -void -ifafree(ifa) - register struct ifaddr *ifa; -{ - if (ifa == NULL) - panic("ifafree"); - if (ifa->ifa_refcnt == 0) - free(ifa, M_IFADDR); - else - ifa->ifa_refcnt--; -} - -/* - * Force a routing table entry to the specified - * destination to go through the given gateway. - * Normally called as a result of a routing redirect - * message from the network layer. - * - * N.B.: must be called at splnet - * - */ -void -rtredirect(dst, gateway, netmask, flags, src, rtp) - struct sockaddr *dst, *gateway, *netmask, *src; - int flags; - struct rtentry **rtp; -{ - register struct rtentry *rt; - int error = 0; - short *stat = 0; - struct rt_addrinfo info; - struct ifaddr *ifa; - - /* verify the gateway is directly reachable */ - if ((ifa = ifa_ifwithnet(gateway)) == 0) { - error = ENETUNREACH; - goto out; - } - rt = rtalloc1(dst, 0, 0UL); - /* - * If the redirect isn't from our current router for this dst, - * it's either old or wrong. If it redirects us to ourselves, - * we have a routing loop, perhaps as a result of an interface - * going down recently. - */ -#define equal(a1, a2) (bcmp((caddr_t)(a1), (caddr_t)(a2), (a1)->sa_len) == 0) - if (!(flags & RTF_DONE) && rt && - (!equal(src, rt->rt_gateway) || rt->rt_ifa != ifa)) - error = EINVAL; - else if (ifa_ifwithaddr(gateway)) { - OS_DbgPrint(OSK_MID_TRACE,("EHOSTUNREACH\n")); - error = EHOSTUNREACH; - } - if (error) - goto done; - /* - * Create a new entry if we just got back a wildcard entry - * or the the lookup failed. This is necessary for hosts - * which use routing redirects generated by smart gateways - * to dynamically build the routing tables. - */ - if ((rt == 0) || (rt_mask(rt) && rt_mask(rt)->sa_len < 2)) - goto create; - /* - * Don't listen to the redirect if it's - * for a route to an interface. - */ - if (rt->rt_flags & RTF_GATEWAY) { - if (((rt->rt_flags & RTF_HOST) == 0) && (flags & RTF_HOST)) { - /* - * Changing from route to net => route to host. - * Create new route, rather than smashing route to net. - */ - create: - flags |= RTF_GATEWAY | RTF_DYNAMIC; - error = rtrequest((int)RTM_ADD, dst, gateway, - netmask, flags, - (struct rtentry **)0); - stat = &rtstat.rts_dynamic; - } else { - /* - * Smash the current notion of the gateway to - * this destination. Should check about netmask!!! - */ - rt->rt_flags |= RTF_MODIFIED; - flags |= RTF_MODIFIED; - stat = &rtstat.rts_newgateway; - rt_setgate(rt, rt_key(rt), gateway); - } - } else { - OS_DbgPrint(OSK_MID_TRACE,("EHOSTUNREACH\n")); - error = EHOSTUNREACH; - } -done: - if (rt) { - if (rtp && !error) - *rtp = rt; - else - rtfree(rt); - } -out: - if (error) - rtstat.rts_badredirect++; - else if (stat != NULL) - (*stat)++; - bzero((caddr_t)&info, sizeof(info)); - info.rti_info[RTAX_DST] = dst; - info.rti_info[RTAX_GATEWAY] = gateway; - info.rti_info[RTAX_NETMASK] = netmask; - info.rti_info[RTAX_AUTHOR] = src; - rt_missmsg(RTM_REDIRECT, &info, flags, error); -} - -/* -* Routing table ioctl interface. -*/ -int -rtioctl(req, data, p) - int req; - caddr_t data; - struct proc *p; -{ -#ifdef INET - /* Multicast goop, grrr... */ - return mrt_ioctl(req, data, p); -#else /* INET */ - return ENXIO; -#endif /* INET */ -} - -struct ifaddr * -ifa_ifwithroute(flags, dst, gateway) - int flags; - struct sockaddr *dst, *gateway; -{ - register struct ifaddr *ifa; - - OS_DbgPrint(OSK_MID_TRACE,("Called: flags %\n", flags)); - OskitDumpBuffer( (void *)dst, sizeof(*dst) ); - OskitDumpBuffer( (void *)gateway, sizeof(*gateway) ); - - if ((flags & RTF_GATEWAY) == 0) { - /* - * If we are adding a route to an interface, - * and the interface is a pt to pt link - * we should search for the destination - * as our clue to the interface. Otherwise - * we can use the local address. - */ - ifa = 0; - if (flags & RTF_HOST) { - ifa = ifa_ifwithdstaddr(dst); - } - if (ifa == 0) - ifa = ifa_ifwithaddr(gateway); - } else { - /* - * If we are adding a route to a remote net - * or host, the gateway may still be on the - * other end of a pt to pt link. - */ - ifa = ifa_ifwithdstaddr(gateway); - } - if (ifa == 0) - ifa = ifa_ifwithnet(gateway); - if (ifa == 0) { - struct rtentry *rt = rtalloc1(dst, 0, 0UL); - if (rt == 0) - return (0); - rt->rt_refcnt--; - if ((ifa = rt->rt_ifa) == 0) - return (0); - } -#ifndef __REACTOS__ - if (ifa->ifa_addr->sa_family != dst->sa_family) { - struct ifaddr *oifa = ifa; - ifa = ifaof_ifpforaddr(dst, ifa->ifa_ifp); - if (ifa == 0) - ifa = oifa; - } -#endif - - OS_DbgPrint(OSK_MID_TRACE,("Leaving: %x\n")); - - return (ifa); -} - -#define ROUNDUP(a) (a>0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long)) - -#ifndef __REACTOS__ -static int rt_fixdelete(struct radix_node *, void *); -#endif -static int rt_fixchange(struct radix_node *, void *); - -struct rtfc_arg { - struct rtentry *rt0; - struct radix_node_head *rnh; -}; - -int -rtrequest(req, dst, gateway, netmask, flags, ret_nrt) - int req, flags; - struct sockaddr *dst, *gateway, *netmask; - struct rtentry **ret_nrt; -{ - int s = splnet(); int error = 0; - register struct rtentry *rt; - register struct radix_node *rn; - register struct radix_node_head *rnh; - struct ifaddr *ifa; - struct sockaddr *ndst; -#ifndef __REACTOS__ - u_long prflags = 0UL; -#endif -#define senderr(x) { error = x ; goto bad; } - - if ((rnh = rt_tables[dst->sa_family]) == 0) - senderr(ESRCH); - if (flags & RTF_HOST) - netmask = 0; - switch (req) { -#ifndef __REACTOS__ - case RTM_DELETE: - if ((rn = rnh->rnh_deladdr(dst, netmask, rnh)) == 0) - senderr(ESRCH); - if (rn->rn_flags & (RNF_ACTIVE | RNF_ROOT)) - panic ("rtrequest delete"); - rt = (struct rtentry *)rn; - - /* - * Now search what's left of the subtree for any cloned - * routes which might have been formed from this node. - */ - if ((rt->rt_flags & RTF_PRCLONING) && netmask) { - rnh->rnh_walktree_from(rnh, dst, netmask, - rt_fixdelete, rt); - } - - if (rt->rt_gwroute) { - rt = rt->rt_gwroute; RTFREE(rt); - (rt = (struct rtentry *)rn)->rt_gwroute = 0; - } - - /* - * NB: RTF_UP must be set during the search above, - * because we might delete the last ref, causing - * rt to get freed prematurely. - */ - rt->rt_flags &= ~RTF_UP; - - if ((ifa = rt->rt_ifa) && ifa->ifa_rtrequest) - ifa->ifa_rtrequest(RTM_DELETE, rt, SA(0)); - rttrash++; - if (ret_nrt) - *ret_nrt = rt; - else if (rt->rt_refcnt <= 0) { - rt->rt_refcnt++; - rtfree(rt); - } - break; -#endif - - case RTM_RESOLVE: - if (ret_nrt == 0 || (rt = *ret_nrt) == 0) - senderr(EINVAL); - ifa = rt->rt_ifa; - flags = rt->rt_flags & - ~(RTF_CLONING | RTF_PRCLONING | RTF_STATIC); - flags |= RTF_WASCLONED; - gateway = rt->rt_gateway; - if ((netmask = rt->rt_genmask) == 0) - flags |= RTF_HOST; - goto makeroute; - -#ifndef __REACTOS__ - case RTM_ADD: - if ((flags & RTF_GATEWAY) && !gateway) - panic("rtrequest: GATEWAY but no gateway"); - - if ((ifa = ifa_ifwithroute(flags, dst, gateway)) == 0) - senderr(ENETUNREACH); -#endif - - makeroute: - R_Malloc(rt, struct rtentry *, sizeof(*rt)); - if (rt == 0) - senderr(ENOBUFS); - Bzero(rt, sizeof(*rt)); - rt->rt_flags = RTF_UP | flags; - if (rt_setgate(rt, dst, gateway)) { - Free(rt); - senderr(ENOBUFS); - } - ndst = rt_key(rt); - if (netmask) { - rt_maskedcopy(dst, ndst, netmask); - } else - Bcopy(dst, ndst, dst->sa_len); - - /* - * This moved from below so that rnh->rnh_addaddr() can - * examine the ifa and ifp if it so desires. - */ - ifa->ifa_refcnt++; - rt->rt_ifa = ifa; -#ifndef __REACTOS__ - rt->rt_ifp = ifa->ifa_ifp; -#endif - - rn = rnh->rnh_addaddr((caddr_t)ndst, (caddr_t)netmask, - rnh, rt->rt_nodes); - if (rn == 0) { - struct rtentry *rt2; - /* - * Uh-oh, we already have one of these in the tree. - * We do a special hack: if the route that's already - * there was generated by the protocol-cloning - * mechanism, then we just blow it away and retry - * the insertion of the new one. - */ - rt2 = rtalloc1(dst, 0, RTF_PRCLONING); - if (rt2 && rt2->rt_parent) { - rtrequest(RTM_DELETE, - (struct sockaddr *)rt_key(rt2), - rt2->rt_gateway, - rt_mask(rt2), rt2->rt_flags, 0); - RTFREE(rt2); - rn = rnh->rnh_addaddr((caddr_t)ndst, - (caddr_t)netmask, - rnh, rt->rt_nodes); - } else if (rt2) { - RTFREE(rt2); - } - } - - if (rn == 0) { - if (rt->rt_gwroute) - rtfree(rt->rt_gwroute); - if (rt->rt_ifa) { - IFAFREE(rt->rt_ifa); - } - Free(rt_key(rt)); - Free(rt); - senderr(EEXIST); - } - rt->rt_parent = 0; - - if (req == RTM_RESOLVE) { - rt->rt_rmx = (*ret_nrt)->rt_rmx; /* copy metrics */ - if ((*ret_nrt)->rt_flags & RTF_PRCLONING) { - rt->rt_parent = (*ret_nrt); - (*ret_nrt)->rt_refcnt++; - } - } -#ifndef __REACTOS__ - if (ifa->ifa_rtrequest) - ifa->ifa_rtrequest(req, rt, SA(ret_nrt ? *ret_nrt : 0)); -#endif - /* - * We repeat the same procedure from rt_setgate() here because - * it doesn't fire when we call it there because the node - * hasn't been added to the tree yet. - */ - if (!(rt->rt_flags & RTF_HOST)) { - struct rtfc_arg arg; - arg.rnh = rnh; - arg.rt0 = rt; - rnh->rnh_walktree_from(rnh, rt_key(rt), rt_mask(rt), - rt_fixchange, &arg); - } - - if (ret_nrt) { - *ret_nrt = rt; - rt->rt_refcnt++; - } - break; - } -bad: - splx(s); - return (error); -} - -/* - * Called from rtrequest(RTM_DELETE, ...) to fix up the route's ``family'' - * (i.e., the routes related to it by the operation of cloning). This - * routine is iterated over all potential former-child-routes by way of - * rnh->rnh_walktree_from() above, and those that actually are children of - * the late parent (passed in as VP here) are themselves deleted. - */ -#ifndef __REACTOS__ -static int -rt_fixdelete(struct radix_node *rn, void *vp) -{ - struct rtentry *rt = (struct rtentry *)rn; - struct rtentry *rt0 = vp; - - if (rt->rt_parent == rt0 && !(rt->rt_flags & RTF_PINNED)) { - return rtrequest(RTM_DELETE, rt_key(rt), - (struct sockaddr *)0, rt_mask(rt), - rt->rt_flags, (struct rtentry **)0); - } - return 0; -} -#endif - -/* - * This routine is called from rt_setgate() to do the analogous thing for - * adds and changes. There is the added complication in this case of a - * middle insert; i.e., insertion of a new network route between an older - * network route and (cloned) host routes. For this reason, a simple check - * of rt->rt_parent is insufficient; each candidate route must be tested - * against the (mask, value) of the new route (passed as before in vp) - * to see if the new route matches it. Unfortunately, this has the obnoxious - * property of also triggering for insertion /above/ a pre-existing network - * route and clones. Sigh. This may be fixed some day. - * - * XXX - it may be possible to do fixdelete() for changes and reserve this - * routine just for adds. I'm not sure why I thought it was necessary to do - * changes this way. - */ -#ifdef DEBUG -int rtfcdebug = 0; -#endif - -static int -rt_fixchange(struct radix_node *rn, void *vp) -{ - struct rtentry *rt = (struct rtentry *)rn; - struct rtfc_arg *ap = vp; - struct rtentry *rt0 = ap->rt0; - struct radix_node_head *rnh = ap->rnh; - u_char *xk1, *xm1, *xk2; - int i, len; - -#ifdef DEBUG - if (rtfcdebug) - printf("rt_fixchange: rt %p, rt0 %p\n", rt, rt0); -#endif - - if (!rt->rt_parent || (rt->rt_flags & RTF_PINNED)) { -#ifdef DEBUG - if(rtfcdebug) printf("no parent or pinned\n"); -#endif - return 0; - } - - if (rt->rt_parent == rt0) { -#ifdef DEBUG - if(rtfcdebug) printf("parent match\n"); -#endif - return rtrequest(RTM_DELETE, rt_key(rt), - (struct sockaddr *)0, rt_mask(rt), - rt->rt_flags, (struct rtentry **)0); - } - - /* - * There probably is a function somewhere which does this... - * if not, there should be. - */ - len = imin(((struct sockaddr *)rt_key(rt0))->sa_len, - ((struct sockaddr *)rt_key(rt))->sa_len); - - xk1 = (u_char *)rt_key(rt0); - xm1 = (u_char *)rt_mask(rt0); - xk2 = (u_char *)rt_key(rt); - - for (i = rnh->rnh_treetop->rn_off; i < len; i++) { - if ((xk2[i] & xm1[i]) != xk1[i]) { -#ifdef DEBUG - if(rtfcdebug) printf("no match\n"); -#endif - return 0; - } - } - - /* - * OK, this node is a clone, and matches the node currently being - * changed/added under the node's mask. So, get rid of it. - */ -#ifdef DEBUG - if(rtfcdebug) printf("deleting\n"); -#endif - return rtrequest(RTM_DELETE, rt_key(rt), (struct sockaddr *)0, - rt_mask(rt), rt->rt_flags, (struct rtentry **)0); -} - -int -rt_setgate(rt0, dst, gate) - struct rtentry *rt0; - struct sockaddr *dst, *gate; -{ - caddr_t new, old; - int dlen = ROUNDUP(dst->sa_len), glen = ROUNDUP(gate->sa_len); - register struct rtentry *rt = rt0; - struct radix_node_head *rnh = rt_tables[dst->sa_family]; - - if (rt->rt_gateway == 0 || glen > ROUNDUP(rt->rt_gateway->sa_len)) { - old = (caddr_t)rt_key(rt); - R_Malloc(new, caddr_t, dlen + glen); - if (new == 0) - return 1; - rt->rt_nodes->rn_key = new; - } else { - new = rt->rt_nodes->rn_key; - old = 0; - } - Bcopy(gate, (rt->rt_gateway = (struct sockaddr *)(new + dlen)), glen); - if (old) { - Bcopy(dst, new, dlen); - Free(old); - } - if (rt->rt_gwroute) { - rt = rt->rt_gwroute; RTFREE(rt); - rt = rt0; rt->rt_gwroute = 0; - } - /* - * Cloning loop avoidance: - * In the presence of protocol-cloning and bad configuration, - * it is possible to get stuck in bottomless mutual recursion - * (rtrequest rt_setgate rtalloc1). We avoid this by not allowing - * protocol-cloning to operate for gateways (which is probably the - * correct choice anyway), and avoid the resulting reference loops - * by disallowing any route to run through itself as a gateway. - * This is obviuosly mandatory when we get rt->rt_output(). - */ - if (rt->rt_flags & RTF_GATEWAY) { - rt->rt_gwroute = rtalloc1(gate, 1, RTF_PRCLONING); - if (rt->rt_gwroute == rt) { - RTFREE(rt->rt_gwroute); - rt->rt_gwroute = 0; - return 1; /* failure */ - } - } - - /* - * This isn't going to do anything useful for host routes, so - * don't bother. Also make sure we have a reasonable mask - * (we don't yet have one during adds). - */ - if (!(rt->rt_flags & RTF_HOST) && rt_mask(rt) != 0) { - struct rtfc_arg arg; - arg.rnh = rnh; - arg.rt0 = rt; - rnh->rnh_walktree_from(rnh, rt_key(rt), rt_mask(rt), - rt_fixchange, &arg); - } - - return 0; -} - -void -rt_maskedcopy(src, dst, netmask) - struct sockaddr *src, *dst, *netmask; -{ - register u_char *cp1 = (u_char *)src; - register u_char *cp2 = (u_char *)dst; - register u_char *cp3 = (u_char *)netmask; - u_char *cplim = cp2 + *cp3; - u_char *cplim2 = cp2 + *cp1; - - *cp2++ = *cp1++; *cp2++ = *cp1++; /* copies sa_len & sa_family */ - cp3 += 2; - if (cplim > cplim2) - cplim = cplim2; - while (cp2 < cplim) - *cp2++ = *cp1++ & *cp3++; - if (cp2 < cplim2) - bzero((caddr_t)cp2, (unsigned)(cplim2 - cp2)); -} - -/* - * Set up a routing table entry, normally - * for an interface. - */ -int -rtinit(ifa, cmd, flags) - register struct ifaddr *ifa; - int cmd, flags; -{ - int error = EADDRNOTAVAIL; -#ifndef __REACTOS__ - register struct rtentry *rt; - register struct sockaddr *dst; - register struct sockaddr *deldst; - struct mbuf *m = 0; - struct rtentry *nrt = 0; - - dst = flags & RTF_HOST ? ifa->ifa_dstaddr : ifa->ifa_addr; - if (cmd == RTM_DELETE) { - if ((flags & RTF_HOST) == 0 && ifa->ifa_netmask) { - m = m_get(M_WAIT, MT_SONAME); - deldst = mtod(m, struct sockaddr *); - rt_maskedcopy(dst, deldst, ifa->ifa_netmask); - dst = deldst; - } - rt = rtalloc1(dst, 0, 0UL); - if (rt) { - rt->rt_refcnt--; - if (rt->rt_ifa != ifa) { - if (m) - (void) m_free(m); - return (flags & RTF_HOST ? EHOSTUNREACH - : ENETUNREACH); - } - } - } - error = rtrequest(cmd, dst, ifa->ifa_addr, ifa->ifa_netmask, - flags | ifa->ifa_flags, &nrt); - if (m) - (void) m_free(m); - if (cmd == RTM_DELETE && error == 0 && (rt = nrt)) { - rt_newaddrmsg(cmd, ifa, error, nrt); - if (rt->rt_refcnt <= 0) { - rt->rt_refcnt++; - rtfree(rt); - } - } - if (cmd == RTM_ADD && error == 0 && (rt = nrt)) { - rt->rt_refcnt--; - if (rt->rt_ifa != ifa) { - printf("rtinit: wrong ifa (%p) was (%p)\n", ifa, - rt->rt_ifa); - if (rt->rt_ifa->ifa_rtrequest) - rt->rt_ifa->ifa_rtrequest(RTM_DELETE, rt, SA(0)); - IFAFREE(rt->rt_ifa); - rt->rt_ifa = ifa; - rt->rt_ifp = ifa->ifa_ifp; - ifa->ifa_refcnt++; - if (ifa->ifa_rtrequest) - ifa->ifa_rtrequest(RTM_ADD, rt, SA(0)); - } - rt_newaddrmsg(cmd, ifa, error, nrt); - } -#endif - return (error); -} diff --git a/lib/drivers/oskittcp/oskittcp/rtsock.c b/lib/drivers/oskittcp/oskittcp/rtsock.c deleted file mode 100644 index b7caadc5eab..00000000000 --- a/lib/drivers/oskittcp/oskittcp/rtsock.c +++ /dev/null @@ -1,819 +0,0 @@ -/* - * Copyright (c) 1988, 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)rtsock.c 8.5 (Berkeley) 11/2/94 - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -struct sockaddr route_dst = { 2, PF_ROUTE, }; -struct sockaddr route_src = { 2, PF_ROUTE, }; -struct sockproto route_proto = { PF_ROUTE, }; - -struct walkarg { - int w_op, w_arg, w_given, w_needed, w_tmemsize; - caddr_t w_where, w_tmem; -}; - -static struct mbuf * - rt_msg1 __P((int, struct rt_addrinfo *)); -static int rt_msg2 __P((int, - struct rt_addrinfo *, caddr_t, struct walkarg *)); -static void rt_xaddrs __P((caddr_t, caddr_t, struct rt_addrinfo *)); - -/* Sleazy use of local variables throughout file, warning!!!! */ -#define dst info.rti_info[RTAX_DST] -#define gate info.rti_info[RTAX_GATEWAY] -#define netmask info.rti_info[RTAX_NETMASK] -#define genmask info.rti_info[RTAX_GENMASK] -#define ifpaddr info.rti_info[RTAX_IFP] -#define ifaaddr info.rti_info[RTAX_IFA] -#define brdaddr info.rti_info[RTAX_BRD] - -/*ARGSUSED*/ -int -route_usrreq(so, req, m, nam, control) - register struct socket *so; - int req; - struct mbuf *m, *nam, *control; -{ - register int error = 0; - register struct rawcb *rp = sotorawcb(so); - int s; - - if (req == PRU_ATTACH) { - MALLOC(rp, struct rawcb *, sizeof(*rp), M_PCB, M_WAITOK); - so->so_pcb = (caddr_t)rp; - if (so->so_pcb) - bzero(so->so_pcb, sizeof(*rp)); - - } - if (req == PRU_DETACH && rp) { - int af = rp->rcb_proto.sp_protocol; - if (af == AF_INET) - route_cb.ip_count--; - else if (af == AF_NS) - route_cb.ns_count--; - else if (af == AF_ISO) - route_cb.iso_count--; - route_cb.any_count--; - } - s = splnet(); - error = raw_usrreq(so, req, m, nam, control); - rp = sotorawcb(so); - if (req == PRU_ATTACH && rp) { - int af = rp->rcb_proto.sp_protocol; - if (error) { - free((caddr_t)rp, M_PCB); - splx(s); - return (error); - } - if (af == AF_INET) - route_cb.ip_count++; - else if (af == AF_NS) - route_cb.ns_count++; - else if (af == AF_ISO) - route_cb.iso_count++; - rp->rcb_faddr = &route_src; - route_cb.any_count++; - soisconnected(so); - so->so_options |= SO_USELOOPBACK; - } - splx(s); - return (error); -} - -/*ARGSUSED*/ -int -route_output(m, so) - register struct mbuf *m; - struct socket *so; -{ - register struct rt_msghdr *rtm = 0; - register struct rtentry *rt = 0; - struct rtentry *saved_nrt = 0; - struct radix_node_head *rnh; - struct rt_addrinfo info; - int len, error = 0; - struct ifnet *ifp = 0; - struct ifaddr *ifa = 0; - -#define senderr(e) { error = e; goto flush;} - if (m == 0 || ((m->m_len < sizeof(long)) && - (m = m_pullup(m, sizeof(long))) == 0)) - return (ENOBUFS); - if ((m->m_flags & M_PKTHDR) == 0) - panic("route_output"); - len = m->m_pkthdr.len; - if (len < sizeof(*rtm) || - len != mtod(m, struct rt_msghdr *)->rtm_msglen) { - dst = 0; - senderr(EINVAL); - } - R_Malloc(rtm, struct rt_msghdr *, len); - if (rtm == 0) { - dst = 0; - senderr(ENOBUFS); - } - m_copydata(m, 0, len, (caddr_t)rtm); - if (rtm->rtm_version != RTM_VERSION) { - dst = 0; - senderr(EPROTONOSUPPORT); - } - rtm->rtm_pid = curproc->p_pid; - info.rti_addrs = rtm->rtm_addrs; - rt_xaddrs((caddr_t)(rtm + 1), len + (caddr_t)rtm, &info); - if (dst == 0) - senderr(EINVAL); - if (genmask) { - struct radix_node *t; - t = rn_addmask((caddr_t)genmask, 0, 1); - if (t && Bcmp(genmask, t->rn_key, *(u_char *)genmask) == 0) - genmask = (struct sockaddr *)(t->rn_key); - else - senderr(ENOBUFS); - } - switch (rtm->rtm_type) { - - case RTM_ADD: - if (gate == 0) - senderr(EINVAL); - error = rtrequest(RTM_ADD, dst, gate, netmask, - rtm->rtm_flags, &saved_nrt); - if (error == 0 && saved_nrt) { - rt_setmetrics(rtm->rtm_inits, - &rtm->rtm_rmx, &saved_nrt->rt_rmx); - saved_nrt->rt_refcnt--; - saved_nrt->rt_genmask = genmask; - } - break; - - case RTM_DELETE: - error = rtrequest(RTM_DELETE, dst, gate, netmask, - rtm->rtm_flags, &saved_nrt); - if (error == 0) { - if ((rt = saved_nrt)) - rt->rt_refcnt++; - goto report; - } - break; - - case RTM_GET: - case RTM_CHANGE: - case RTM_LOCK: - if ((rnh = rt_tables[dst->sa_family]) == 0) { - senderr(EAFNOSUPPORT); - } else if ((rt = (struct rtentry *) - rnh->rnh_lookup(dst, netmask, rnh))) - rt->rt_refcnt++; - else - senderr(ESRCH); - switch(rtm->rtm_type) { - - case RTM_GET: - report: - dst = rt_key(rt); - gate = rt->rt_gateway; - netmask = rt_mask(rt); - genmask = rt->rt_genmask; - if (rtm->rtm_addrs & (RTA_IFP | RTA_IFA)) { - ifp = rt->rt_ifp; - if (ifp) { - ifpaddr = ifp->if_addrlist->ifa_addr; - ifaaddr = rt->rt_ifa->ifa_addr; - rtm->rtm_index = ifp->if_index; - } else { - ifpaddr = 0; - ifaaddr = 0; - } - } - len = rt_msg2(rtm->rtm_type, &info, (caddr_t)0, - (struct walkarg *)0); - if (len > rtm->rtm_msglen) { - struct rt_msghdr *new_rtm; - R_Malloc(new_rtm, struct rt_msghdr *, len); - if (new_rtm == 0) - senderr(ENOBUFS); - Bcopy(rtm, new_rtm, rtm->rtm_msglen); - Free(rtm); rtm = new_rtm; - } - (void)rt_msg2(rtm->rtm_type, &info, (caddr_t)rtm, - (struct walkarg *)0); - rtm->rtm_flags = rt->rt_flags; - rtm->rtm_rmx = rt->rt_rmx; - rtm->rtm_addrs = info.rti_addrs; - break; - - case RTM_CHANGE: - if (gate && rt_setgate(rt, rt_key(rt), gate)) - senderr(EDQUOT); - - /* - * If they tried to change things but didn't specify - * the required gateway, then just use the old one. - * This can happen if the user tries to change the - * flags on the default route without changing the - * default gateway. Changing flags still doesn't work. - */ - if ((rt->rt_flags & RTF_GATEWAY) && !gate) - gate = rt->rt_gateway; - -#ifndef __REACTOS__ - /* new gateway could require new ifaddr, ifp; - flags may also be different; ifp may be specified - by ll sockaddr when protocol address is ambiguous */ - if (ifpaddr && (ifa = ifa_ifwithnet(ifpaddr)) && - (ifp = ifa->ifa_ifp)) - ifa = ifaof_ifpforaddr(ifaaddr ? ifaaddr : gate, - ifp); -#endif - - else if ((ifaaddr && (ifa = ifa_ifwithaddr(ifaaddr))) || - (ifa = ifa_ifwithroute(rt->rt_flags, - rt_key(rt), gate))) -#ifndef __REACTOS__ - ifp = ifa->ifa_ifp; -#else - (void)0; -#endif - if (ifa) { - register struct ifaddr *oifa = rt->rt_ifa; - if (oifa != ifa) { -#ifndef __REACTOS__ - if (oifa && oifa->ifa_rtrequest) - oifa->ifa_rtrequest(RTM_DELETE, - rt, gate); -#endif - IFAFREE(rt->rt_ifa); - rt->rt_ifa = ifa; - ifa->ifa_refcnt++; - rt->rt_ifp = ifp; - } - } - rt_setmetrics(rtm->rtm_inits, &rtm->rtm_rmx, - &rt->rt_rmx); -#ifndef __REACTOS__ - if (rt->rt_ifa && rt->rt_ifa->ifa_rtrequest) - rt->rt_ifa->ifa_rtrequest(RTM_ADD, rt, gate); -#endif - if (genmask) - rt->rt_genmask = genmask; - /* - * Fall into - */ - case RTM_LOCK: - rt->rt_rmx.rmx_locks &= ~(rtm->rtm_inits); - rt->rt_rmx.rmx_locks |= - (rtm->rtm_inits & rtm->rtm_rmx.rmx_locks); - break; - } - break; - - default: - senderr(EOPNOTSUPP); - } - -flush: - if (rtm) { - if (error) - rtm->rtm_errno = error; - else - rtm->rtm_flags |= RTF_DONE; - } - if (rt) - rtfree(rt); - { - register struct rawcb *rp = 0; - /* - * Check to see if we don't want our own messages. - */ - if ((so->so_options & SO_USELOOPBACK) == 0) { - if (route_cb.any_count <= 1) { - if (rtm) - Free(rtm); - m_freem(m); - return (error); - } - /* There is another listener, so construct message */ - rp = sotorawcb(so); - } - if (rtm) { - m_copyback(m, 0, rtm->rtm_msglen, (caddr_t)rtm); - Free(rtm); - } - if (rp) - rp->rcb_proto.sp_family = 0; /* Avoid us */ - if (dst) - route_proto.sp_protocol = dst->sa_family; - raw_input(m, &route_proto, &route_src, &route_dst); - if (rp) - rp->rcb_proto.sp_family = PF_ROUTE; - } - return (error); -} - -void -rt_setmetrics(which, in, out) - u_long which; - register struct rt_metrics *in, *out; -{ -#define metric(f, e) if (which & (f)) out->e = in->e; - metric(RTV_RPIPE, rmx_recvpipe); - metric(RTV_SPIPE, rmx_sendpipe); - metric(RTV_SSTHRESH, rmx_ssthresh); - metric(RTV_RTT, rmx_rtt); - metric(RTV_RTTVAR, rmx_rttvar); - metric(RTV_HOPCOUNT, rmx_hopcount); - metric(RTV_MTU, rmx_mtu); - metric(RTV_EXPIRE, rmx_expire); -#undef metric -} - -#define ROUNDUP(a) \ - ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long)) -#define ADVANCE(x, n) (x += ROUNDUP((n)->sa_len)) - -static void -rt_xaddrs(cp, cplim, rtinfo) - register caddr_t cp, cplim; - register struct rt_addrinfo *rtinfo; -{ - register struct sockaddr *sa; - register int i; - - bzero(rtinfo->rti_info, sizeof(rtinfo->rti_info)); - for (i = 0; (i < RTAX_MAX) && (cp < cplim); i++) { - if ((rtinfo->rti_addrs & (1 << i)) == 0) - continue; - rtinfo->rti_info[i] = sa = (struct sockaddr *)cp; - ADVANCE(cp, sa); - } -} - -static struct mbuf * -rt_msg1(type, rtinfo) - int type; - register struct rt_addrinfo *rtinfo; -{ - register struct rt_msghdr *rtm; - register struct mbuf *m; - register int i; - register struct sockaddr *sa; - int len, dlen; - - m = m_gethdr(M_DONTWAIT, MT_DATA); - if (m == 0) - return (m); - switch (type) { - - case RTM_DELADDR: - case RTM_NEWADDR: - len = sizeof(struct ifa_msghdr); - break; - - case RTM_IFINFO: - len = sizeof(struct if_msghdr); - break; - - default: - len = sizeof(struct rt_msghdr); - } - if (len > MHLEN) - panic("rt_msg1"); - m->m_pkthdr.len = m->m_len = len; - m->m_pkthdr.rcvif = 0; - rtm = mtod(m, struct rt_msghdr *); - bzero((caddr_t)rtm, len); - for (i = 0; i < RTAX_MAX; i++) { - if ((sa = rtinfo->rti_info[i]) == NULL) - continue; - rtinfo->rti_addrs |= (1 << i); - dlen = ROUNDUP(sa->sa_len); - m_copyback(m, len, dlen, (caddr_t)sa); - len += dlen; - } - if (m->m_pkthdr.len != len) { - m_freem(m); - return (NULL); - } - rtm->rtm_msglen = len; - rtm->rtm_version = RTM_VERSION; - rtm->rtm_type = type; - return (m); -} - -static int -rt_msg2(type, rtinfo, cp, w) - int type; - register struct rt_addrinfo *rtinfo; - caddr_t cp; - struct walkarg *w; -{ - register int i; - int len, dlen, second_time = 0; - caddr_t cp0; - - rtinfo->rti_addrs = 0; -again: - switch (type) { - - case RTM_DELADDR: - case RTM_NEWADDR: - len = sizeof(struct ifa_msghdr); - break; - - case RTM_IFINFO: - len = sizeof(struct if_msghdr); - break; - - default: - len = sizeof(struct rt_msghdr); - } - cp0 = cp; - if (cp0) - cp += len; - for (i = 0; i < RTAX_MAX; i++) { - register struct sockaddr *sa; - - if ((sa = rtinfo->rti_info[i]) == 0) - continue; - rtinfo->rti_addrs |= (1 << i); - dlen = ROUNDUP(sa->sa_len); - if (cp) { - bcopy((caddr_t)sa, cp, (unsigned)dlen); - cp += dlen; - } - len += dlen; - } - if (cp == 0 && w != NULL && !second_time) { - register struct walkarg *rw = w; - - rw->w_needed += len; - if (rw->w_needed <= 0 && rw->w_where) { - if (rw->w_tmemsize < len) { - if (rw->w_tmem) - free(rw->w_tmem, M_RTABLE); - rw->w_tmem = (caddr_t) - malloc(len, M_RTABLE, M_NOWAIT); - if (rw->w_tmem) - rw->w_tmemsize = len; - } - if (rw->w_tmem) { - cp = rw->w_tmem; - second_time = 1; - goto again; - } else - rw->w_where = 0; - } - } - if (cp) { - register struct rt_msghdr *rtm = (struct rt_msghdr *)cp0; - - rtm->rtm_version = RTM_VERSION; - rtm->rtm_type = type; - rtm->rtm_msglen = len; - } - return (len); -} - -/* - * This routine is called to generate a message from the routing - * socket indicating that a redirect has occured, a routing lookup - * has failed, or that a protocol has detected timeouts to a particular - * destination. - */ -void -rt_missmsg(type, rtinfo, flags, error) - int type, flags, error; - register struct rt_addrinfo *rtinfo; -{ - register struct rt_msghdr *rtm; - register struct mbuf *m; - struct sockaddr *sa = rtinfo->rti_info[RTAX_DST]; - - if (route_cb.any_count == 0) - return; - m = rt_msg1(type, rtinfo); - if (m == 0) - return; - rtm = mtod(m, struct rt_msghdr *); - rtm->rtm_flags = RTF_DONE | flags; - rtm->rtm_errno = error; - rtm->rtm_addrs = rtinfo->rti_addrs; - route_proto.sp_protocol = sa ? sa->sa_family : 0; - raw_input(m, &route_proto, &route_src, &route_dst); -} - -/* - * This routine is called to generate a message from the routing - * socket indicating that the status of a network interface has changed. - */ -void -rt_ifmsg(ifp) - register struct ifnet *ifp; -{ - register struct if_msghdr *ifm; - struct mbuf *m; - struct rt_addrinfo info; - - if (route_cb.any_count == 0) - return; - bzero((caddr_t)&info, sizeof(info)); - m = rt_msg1(RTM_IFINFO, &info); - if (m == 0) - return; - ifm = mtod(m, struct if_msghdr *); - ifm->ifm_index = ifp->if_index; - ifm->ifm_flags = (u_short)ifp->if_flags; - ifm->ifm_data = ifp->if_data; - ifm->ifm_addrs = 0; - route_proto.sp_protocol = 0; - raw_input(m, &route_proto, &route_src, &route_dst); -} - -/* - * This is called to generate messages from the routing socket - * indicating a network interface has had addresses associated with it. - * if we ever reverse the logic and replace messages TO the routing - * socket indicate a request to configure interfaces, then it will - * be unnecessary as the routing socket will automatically generate - * copies of it. - */ -void -rt_newaddrmsg(cmd, ifa, error, rt) - int cmd, error; - register struct ifaddr *ifa; - register struct rtentry *rt; -{ - struct rt_addrinfo info; - struct sockaddr *sa = 0; - int pass; - struct mbuf *m = 0; -#ifndef __REACTOS__ - struct ifnet *ifp = ifa->ifa_ifp; -#endif - - if (route_cb.any_count == 0) - return; - for (pass = 1; pass < 3; pass++) { - bzero((caddr_t)&info, sizeof(info)); - if ((cmd == RTM_ADD && pass == 1) || - (cmd == RTM_DELETE && pass == 2)) { - register struct ifa_msghdr *ifam; - int ncmd = cmd == RTM_ADD ? RTM_NEWADDR : RTM_DELADDR; - - ifaaddr = sa = ifa->ifa_addr; -#ifndef __REACTOS__ - ifpaddr = ifp->if_addrlist->ifa_addr; -#endif - netmask = ifa->ifa_netmask; - brdaddr = ifa->ifa_dstaddr; - if ((m = rt_msg1(ncmd, &info)) == NULL) - continue; - ifam = mtod(m, struct ifa_msghdr *); -#ifndef __REACTOS__ - ifam->ifam_index = ifp->if_index; -#endif - ifam->ifam_metric = ifa->ifa_metric; - ifam->ifam_flags = ifa->ifa_flags; - ifam->ifam_addrs = info.rti_addrs; - } - if ((cmd == RTM_ADD && pass == 2) || - (cmd == RTM_DELETE && pass == 1)) { - register struct rt_msghdr *rtm; - - if (rt == 0) - continue; - netmask = rt_mask(rt); - dst = sa = rt_key(rt); - gate = rt->rt_gateway; - if ((m = rt_msg1(cmd, &info)) == NULL) - continue; - rtm = mtod(m, struct rt_msghdr *); -#ifndef __REACTOS__ - rtm->rtm_index = ifp->if_index; -#endif - rtm->rtm_flags |= rt->rt_flags; - rtm->rtm_errno = error; - rtm->rtm_addrs = info.rti_addrs; - } - route_proto.sp_protocol = sa ? sa->sa_family : 0; - raw_input(m, &route_proto, &route_src, &route_dst); - } -} - -/* - * This is used in dumping the kernel table via sysctl(). - */ -int -sysctl_dumpentry(rn, w) - struct radix_node *rn; - register struct walkarg *w; -{ - register struct rtentry *rt = (struct rtentry *)rn; - int error = 0, size; - struct rt_addrinfo info; - - if (w->w_op == NET_RT_FLAGS && !(rt->rt_flags & w->w_arg)) - return 0; - bzero((caddr_t)&info, sizeof(info)); - dst = rt_key(rt); - gate = rt->rt_gateway; - netmask = rt_mask(rt); - genmask = rt->rt_genmask; - size = rt_msg2(RTM_GET, &info, 0, w); - if (w->w_where && w->w_tmem) { - register struct rt_msghdr *rtm = (struct rt_msghdr *)w->w_tmem; - - rtm->rtm_flags = rt->rt_flags; - rtm->rtm_use = rt->rt_use; - rtm->rtm_rmx = rt->rt_rmx; - rtm->rtm_index = rt->rt_ifp->if_index; - rtm->rtm_errno = rtm->rtm_pid = rtm->rtm_seq = 0; - rtm->rtm_addrs = info.rti_addrs; - error = copyout((caddr_t)rtm, w->w_where, size); - if (error) - w->w_where = NULL; - else - w->w_where += size; - } - return (error); -} - -int -sysctl_iflist(af, w) - int af; - register struct walkarg *w; -{ - register struct ifnet *ifp; - register struct ifaddr *ifa; - struct rt_addrinfo info; - int len, error = 0; - - bzero((caddr_t)&info, sizeof(info)); - for (ifp = ifnet; ifp; ifp = ifp->if_next) { - if (w->w_arg && w->w_arg != ifp->if_index) - continue; - ifa = ifp->if_addrlist; - ifpaddr = ifa->ifa_addr; - len = rt_msg2(RTM_IFINFO, &info, (caddr_t)0, w); - ifpaddr = 0; - if (w->w_where && w->w_tmem) { - register struct if_msghdr *ifm; - - ifm = (struct if_msghdr *)w->w_tmem; - ifm->ifm_index = ifp->if_index; - ifm->ifm_flags = (u_short)ifp->if_flags; - ifm->ifm_data = ifp->if_data; - ifm->ifm_addrs = info.rti_addrs; - error = copyout((caddr_t)ifm, w->w_where, len); - if (error) - return (error); - w->w_where += len; - } -#ifndef __REACTOS__ - while ((ifa = ifa->ifa_next) != 0) { - if (af && af != ifa->ifa_addr->sa_family) - continue; - ifaaddr = ifa->ifa_addr; - netmask = ifa->ifa_netmask; - brdaddr = ifa->ifa_dstaddr; - len = rt_msg2(RTM_NEWADDR, &info, 0, w); - if (w->w_where && w->w_tmem) { - register struct ifa_msghdr *ifam; - - ifam = (struct ifa_msghdr *)w->w_tmem; - ifam->ifam_index = ifa->ifa_ifp->if_index; - ifam->ifam_flags = ifa->ifa_flags; - ifam->ifam_metric = ifa->ifa_metric; - ifam->ifam_addrs = info.rti_addrs; - error = copyout(w->w_tmem, w->w_where, len); - if (error) - return (error); - w->w_where += len; - } - } -#endif - ifaaddr = netmask = brdaddr = 0; - } - return (0); -} - -int -sysctl_rtable(name, namelen, where, given, new, newlen) - int *name; - int namelen; - caddr_t where; - size_t *given; - caddr_t *new; - size_t newlen; -{ - register struct radix_node_head *rnh; - int i, s, error = EINVAL; - u_char af; - struct walkarg w; - - if (new) - return (EPERM); - if (namelen != 3) - return (EINVAL); - af = name[0]; - Bzero(&w, sizeof(w)); - w.w_where = where; - w.w_given = *given; - w.w_needed = 0 - w.w_given; - w.w_op = name[1]; - w.w_arg = name[2]; - - s = splnet(); - switch (w.w_op) { - - case NET_RT_DUMP: - case NET_RT_FLAGS: - for (i = 1; i <= AF_MAX; i++) - if ((rnh = rt_tables[i]) && (af == 0 || af == i) && - (error = rnh->rnh_walktree(rnh, - sysctl_dumpentry, &w))) - break; - break; - - case NET_RT_IFLIST: - error = sysctl_iflist(af, &w); - } - splx(s); - if (w.w_tmem) - free(w.w_tmem, M_RTABLE); - w.w_needed += w.w_given; - if (where) { - *given = w.w_where - where; - if (*given < w.w_needed) - return (ENOMEM); - } else { - *given = (11 * w.w_needed) / 10; - } - return (error); -} - -/* - * Definitions of protocols supported in the ROUTE domain. - */ - -extern struct domain routedomain; /* or at least forward */ - -struct protosw routesw[] = { -{ SOCK_RAW, &routedomain, 0, PR_ATOMIC|PR_ADDR, - raw_input, route_output, raw_ctlinput, 0, - route_usrreq, - raw_init, 0, 0, 0, - sysctl_rtable, -} -}; - -struct domain routedomain = - { PF_ROUTE, "route", route_init, 0, 0, - routesw, &routesw[sizeof(routesw)/sizeof(routesw[0])] }; - -DOMAIN_SET(route); diff --git a/lib/drivers/oskittcp/oskittcp/scanc.c b/lib/drivers/oskittcp/oskittcp/scanc.c deleted file mode 100644 index 491bd36464d..00000000000 --- a/lib/drivers/oskittcp/oskittcp/scanc.c +++ /dev/null @@ -1,52 +0,0 @@ -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)scanc.c 8.1 (Berkeley) 6/10/93 - * - * $\Id: scanc.c,v 1.3 1995/03/17 06:15:39 phk Exp $ - */ - -#include - -int -scanc(size, cp, table, mask0) - u_int size; - register u_char *cp, table[]; - int mask0; -{ - register u_char *end; - register u_char mask; - - mask = mask0; - for (end = &cp[size]; cp < end && (table[*cp] & mask) == 0; ++cp); - return (end - cp); -} diff --git a/lib/drivers/oskittcp/oskittcp/sleep.c b/lib/drivers/oskittcp/oskittcp/sleep.c deleted file mode 100644 index e6779fd6675..00000000000 --- a/lib/drivers/oskittcp/oskittcp/sleep.c +++ /dev/null @@ -1,93 +0,0 @@ -#include -#include -#include -#include - -/* clock_init */ -int ncallout = 256; -struct callout *callout; - -void init_freebsd_sched() { -} - -int tsleep( void *token, int priority, char *wmesg, int tmio ) { - if( !OtcpEvent.Sleep ) panic("no sleep"); - return - OtcpEvent.Sleep( OtcpEvent.ClientData, token, priority, wmesg, tmio ); -} - -void wakeup( struct socket *so, void *token ) { - OSK_UINT flags = 0; - - OS_DbgPrint - (OSK_MID_TRACE,("XXX Bytes to receive: %d state %x\n", - so->so_rcv.sb_cc, so->so_state)); - - if( so->so_state & SS_ISCONNECTED ) { - OS_DbgPrint(OSK_MID_TRACE,("Socket connected!\n")); - flags |= SEL_CONNECT; - } - if( so->so_q ) { - OS_DbgPrint(OSK_MID_TRACE,("Socket accepting q\n")); - flags |= SEL_ACCEPT; - } - if( so->so_rcv.sb_cc > 0 ) { - OS_DbgPrint(OSK_MID_TRACE,("Socket readable\n")); - flags |= SEL_READ; - } - if( 0 < sbspace(&so->so_snd) ) { - OS_DbgPrint(OSK_MID_TRACE,("Socket writeable\n")); - flags |= SEL_WRITE; - } - if (!so->so_pcb) { - OS_DbgPrint(OSK_MID_TRACE,("Socket dying\n")); - flags |= SEL_FIN; - } - - OS_DbgPrint(OSK_MID_TRACE,("Wakeup %x (socket %x, state %x)!\n", - token, so, - so->so_state)); - - if( OtcpEvent.SocketState ) - OtcpEvent.SocketState( OtcpEvent.ClientData, - so, - so ? so->so_connection : 0, - flags ); - - if( OtcpEvent.Wakeup ) - OtcpEvent.Wakeup( OtcpEvent.ClientData, token ); - - OS_DbgPrint(OSK_MID_TRACE,("Wakeup done %x\n", token)); -} - -/* ---------------------------------------------------------------------- */ - - -static void -timeout_init(void) -{ - int i; - - callout = (struct callout *) - malloc(sizeof(struct callout) * ncallout, M_FREE, M_WAITOK); - if (!callout) - panic("can't allocate callout queue!\n"); - - /* - * Initialize callouts - */ - callfree = callout; - for (i = 1; i < ncallout; i++) - callout[i-1].c_next = &callout[i]; - -} - -/* get clock up and running */ -void clock_init() -{ - timeout_init(); - /* inittodr(0); // what does this do? */ - /* boottime = kern_time; */ - /* Start a clock we can use for timeouts */ -} - diff --git a/lib/drivers/oskittcp/oskittcp/tcp_debug.c b/lib/drivers/oskittcp/oskittcp/tcp_debug.c deleted file mode 100644 index 4be1cd7f23b..00000000000 --- a/lib/drivers/oskittcp/oskittcp/tcp_debug.c +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)tcp_debug.c 8.1 (Berkeley) 6/10/93 - */ - -#ifdef TCPDEBUG -/* load symbolic names */ -#define PRUREQUESTS -#define TCPSTATES -#define TCPTIMERS -#define TANAMES -#endif - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef _MSC_VER -unsigned long __stdcall GetTickCount(); -#endif//_MSC_VER - -#ifdef TCPDEBUG -int tcpconsdebug = 0; -#endif -/* - * Tcp debug routines - */ -void -tcp_trace(act, ostate, tp, ti, req) - short act, ostate; - struct tcpcb *tp; - struct tcpiphdr *ti; - int req; -{ -#ifdef TCPDEBUG - tcp_seq seq, ack; - int len, flags; -#endif - struct tcp_debug *td = &tcp_debug[tcp_debx++]; - - if (tcp_debx == TCP_NDEBUG) - tcp_debx = 0; -#ifdef _MSC_VER - td->td_time = GetTickCount(); -#else - td->td_time = iptime(); -#endif - td->td_act = act; - td->td_ostate = ostate; - td->td_tcb = (caddr_t)tp; - if (tp) - td->td_cb = *tp; - else - bzero((caddr_t)&td->td_cb, sizeof (*tp)); - if (ti) - td->td_ti = *ti; - else - bzero((caddr_t)&td->td_ti, sizeof (*ti)); - td->td_req = req; -#ifdef TCPDEBUG - if (tcpconsdebug == 0) - return; - if (tp) - printf("%p %s:", tp, tcpstates[ostate]); - else - printf("???????? "); - printf("%s ", tanames[act]); - switch (act) { - - case TA_INPUT: - case TA_OUTPUT: - case TA_DROP: - if (ti == 0) - break; - seq = ti->ti_seq; - ack = ti->ti_ack; - len = ti->ti_len; - if (act == TA_OUTPUT) { - seq = ntohl(seq); - ack = ntohl(ack); - len = ntohs((u_short)len); - } - if (act == TA_OUTPUT) - len -= sizeof (struct tcphdr); - if (len) - printf("[%x..%x)", seq, seq+len); - else - printf("%x", seq); - printf("@%x, urp=%x", ack, ti->ti_urp); - flags = ti->ti_flags; - if (flags) { - char *cp = "<"; -#define pf(f) { \ - if (ti->ti_flags & TH_##f) { \ - printf("%s%s", cp, #f); \ - cp = ","; \ - } \ -} - pf(SYN); pf(ACK); pf(FIN); pf(RST); pf(PUSH); pf(URG); - printf(">"); - } - break; - - case TA_USER: - printf("%s", prurequests[req&0xff]); - if ((req & 0xff) == PRU_SLOWTIMO) - printf("<%s>", tcptimers[req>>8]); - break; - } - if (tp) - printf(" -> %s", tcpstates[tp->t_state]); - /* print out internal state of tp !?! */ - printf("\n"); - if (tp == 0) - return; - printf("\trcv_(nxt,wnd,up) (%x,%x,%x) snd_(una,nxt,max) (%x,%x,%x)\n", - tp->rcv_nxt, tp->rcv_wnd, tp->rcv_up, tp->snd_una, tp->snd_nxt, - tp->snd_max); - printf("\tsnd_(wl1,wl2,wnd) (%x,%x,%x)\n", - tp->snd_wl1, tp->snd_wl2, tp->snd_wnd); -#endif /* TCPDEBUG */ -} diff --git a/lib/drivers/oskittcp/oskittcp/tcp_input.c b/lib/drivers/oskittcp/oskittcp/tcp_input.c deleted file mode 100644 index 39116abf15f..00000000000 --- a/lib/drivers/oskittcp/oskittcp/tcp_input.c +++ /dev/null @@ -1,2170 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1988, 1990, 1993, 1994 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * From: @(#)tcp_input.c 8.5 (Berkeley) 4/10/94 - */ - -#ifndef TUBA_INCLUDE -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef TCPDEBUG -#include -struct tcpiphdr tcp_saveti; -#endif - -int tcprexmtthresh = 3; -tcp_seq tcp_iss; -tcp_cc tcp_ccgen; -struct tcpstat tcpstat; -u_long tcp_now; -struct inpcbhead tcb; -struct inpcbinfo tcbinfo; - -#endif /* TUBA_INCLUDE */ - -/* - * Insert segment ti into reassembly queue of tcp with - * control block tp. Return TH_FIN if reassembly now includes - * a segment with FIN. The macro form does the common case inline - * (segment is the next to be received on an established connection, - * and the queue is empty), avoiding linkage into and removal - * from the queue and repetition of various conversions. - * Set DELACK for segments received in order, but ack immediately - * when segments are out of order (so fast retransmit can work). - */ -#ifdef TCP_ACK_HACK -#define TCP_REASS(tp, ti, m, so, flags) { \ - if ((ti)->ti_seq == (tp)->rcv_nxt && \ - (tp)->seg_next == (struct tcpiphdr *)(tp) && \ - (tp)->t_state == TCPS_ESTABLISHED) { \ - if (ti->ti_flags & TH_PUSH) \ - tp->t_flags |= TF_ACKNOW; \ - else \ - tp->t_flags |= TF_DELACK; \ - (tp)->rcv_nxt += (ti)->ti_len; \ - flags = (ti)->ti_flags & TH_FIN; \ - tcpstat.tcps_rcvpack++;\ - tcpstat.tcps_rcvbyte += (ti)->ti_len;\ - sbappend(&(so)->so_rcv, (m)); \ - sorwakeup(so); \ - } else { \ - (flags) = tcp_reass((tp), (ti), (m)); \ - tp->t_flags |= TF_ACKNOW; \ - } \ -} -#else -#define TCP_REASS(tp, ti, m, so, flags) { \ - if ((ti)->ti_seq == (tp)->rcv_nxt && \ - (tp)->seg_next == (struct tcpiphdr *)(tp) && \ - (tp)->t_state == TCPS_ESTABLISHED) { \ - tp->t_flags |= TF_DELACK; \ - (tp)->rcv_nxt += (ti)->ti_len; \ - flags = (ti)->ti_flags & TH_FIN; \ - tcpstat.tcps_rcvpack++;\ - tcpstat.tcps_rcvbyte += (ti)->ti_len;\ - sbappend(&(so)->so_rcv, (m)); \ - sorwakeup(so); \ - } else { \ - (flags) = tcp_reass((tp), (ti), (m)); \ - tp->t_flags |= TF_ACKNOW; \ - } \ -} -#endif -#ifndef TUBA_INCLUDE - -int -tcp_reass(tp, ti, m) - register struct tcpcb *tp; - register struct tcpiphdr *ti; - struct mbuf *m; -{ - register struct tcpiphdr *q; - struct socket *so = tp->t_inpcb->inp_socket; - int flags; - - /* - * Call with ti==0 after become established to - * force pre-ESTABLISHED data up to user socket. - */ - if (ti == 0) - goto present; - - /* - * Find a segment which begins after this one does. - */ - for (q = tp->seg_next; q != (struct tcpiphdr *)tp; - q = (struct tcpiphdr *)q->ti_next) - if (SEQ_GT(q->ti_seq, ti->ti_seq)) - break; - - /* - * If there is a preceding segment, it may provide some of - * our data already. If so, drop the data from the incoming - * segment. If it provides all of our data, drop us. - */ - if ((struct tcpiphdr *)q->ti_prev != (struct tcpiphdr *)tp) { - register int i; - q = (struct tcpiphdr *)q->ti_prev; - /* conversion to int (in i) handles seq wraparound */ - i = q->ti_seq + q->ti_len - ti->ti_seq; - if (i > 0) { - if (i >= ti->ti_len) { - tcpstat.tcps_rcvduppack++; - tcpstat.tcps_rcvdupbyte += ti->ti_len; - m_freem(m); - /* - * Try to present any queued data - * at the left window edge to the user. - * This is needed after the 3-WHS - * completes. - */ - goto present; /* ??? */ - } - m_adj(m, i); - ti->ti_len -= i; - ti->ti_seq += i; - } - q = (struct tcpiphdr *)(q->ti_next); - } - tcpstat.tcps_rcvoopack++; - tcpstat.tcps_rcvoobyte += ti->ti_len; - REASS_MBUF(ti) = m; /* XXX */ - - /* - * While we overlap succeeding segments trim them or, - * if they are completely covered, dequeue them. - */ - while (q != (struct tcpiphdr *)tp) { - register int i = (ti->ti_seq + ti->ti_len) - q->ti_seq; - if (i <= 0) - break; - if (i < q->ti_len) { - q->ti_seq += i; - q->ti_len -= i; - m_adj(REASS_MBUF(q), i); - break; - } - q = (struct tcpiphdr *)q->ti_next; - m = REASS_MBUF((struct tcpiphdr *)q->ti_prev); - remque(q->ti_prev); - m_freem(m); - } - - /* - * Stick new segment in its place. - */ - insque(ti, q->ti_prev); - -present: - /* - * Present data to user, advancing rcv_nxt through - * completed sequence space. - */ - if (!TCPS_HAVEESTABLISHED(tp->t_state)) - return (0); - ti = tp->seg_next; - if (ti == (struct tcpiphdr *)tp || ti->ti_seq != tp->rcv_nxt) - return (0); - do { - tp->rcv_nxt += ti->ti_len; - OS_DbgPrint(OSK_MID_TRACE,("Added %d to rcv_nxt (result %d)\n", - ti->ti_len, tp->rcv_nxt)); - flags = ti->ti_flags & TH_FIN; - remque(ti); - m = REASS_MBUF(ti); - ti = (struct tcpiphdr *)ti->ti_next; - if (so->so_state & SS_CANTRCVMORE) - m_freem(m); - else - sbappend(&so->so_rcv, m); - } while (ti != (struct tcpiphdr *)tp && ti->ti_seq == tp->rcv_nxt); - sorwakeup(so); - return (flags); -} - -/* - * TCP input routine, follows pages 65-76 of the - * protocol specification dated September, 1981 very closely. - */ -void -tcp_input(m, iphlen) - register struct mbuf *m; - int iphlen; -{ - register struct tcpiphdr *ti; - register struct inpcb *inp; - caddr_t optp = NULL; - int optlen = 0; - int len, tlen, off; - register struct tcpcb *tp = 0; - register int tiflags; - struct socket *so = 0; - int todrop, acked, ourfinisacked, needoutput = 0; - struct in_addr laddr; - int dropsocket = 0; - int iss = 0; - u_long tiwin; - struct tcpopt to; /* options in this segment */ - struct rmxp_tao *taop; /* pointer to our TAO cache entry */ - struct rmxp_tao tao_noncached; /* in case there's no cached entry */ -#ifdef TCPDEBUG - short ostate = 0; -#endif - bzero((char *)&to, sizeof(to)); - - tcpstat.tcps_rcvtotal++; - /* - * Get IP and TCP header together in first mbuf. - * Note: IP leaves IP header in first mbuf. - */ - ti = mtod(m, struct tcpiphdr *); - if (iphlen > sizeof (struct ip)) - ip_stripoptions(m, (struct mbuf *)0); - if (m->m_len < sizeof (struct tcpiphdr)) { - if ((m = m_pullup(m, sizeof (struct tcpiphdr))) == 0) { - tcpstat.tcps_rcvshort++; - return; - } - ti = mtod(m, struct tcpiphdr *); - } - - /* - * Checksum extended TCP header and data. - */ - tlen = ((struct ip *)ti)->ip_len; - len = sizeof (struct ip) + tlen; - ti->ti_next = ti->ti_prev = 0; - ti->ti_x1 = 0; - ti->ti_len = (u_short)tlen; - HTONS(ti->ti_len); -#ifndef __REACTOS__ /* Checksum already done in IPReceive */ - ti->ti_sum = in_cksum(m, len); - if (ti->ti_sum) { - printf("TCP: Bad Checksum\n"); - tcpstat.tcps_rcvbadsum++; - goto drop; - } -#endif -#endif /* TUBA_INCLUDE */ - - /* - * Check that TCP offset makes sense, - * pull out TCP options and adjust length. XXX - */ - off = ti->ti_off << 2; - if (off < sizeof (struct tcphdr) || off > tlen) { - tcpstat.tcps_rcvbadoff++; - goto drop; - } - tlen -= off; - ti->ti_len = tlen; - if (off > sizeof (struct tcphdr)) { - if (m->m_len < sizeof(struct ip) + off) { - if ((m = m_pullup(m, sizeof (struct ip) + off)) == 0) { - tcpstat.tcps_rcvshort++; - return; - } - ti = mtod(m, struct tcpiphdr *); - } - optlen = off - sizeof (struct tcphdr); - optp = mtod(m, caddr_t) + sizeof (struct tcpiphdr); - } - tiflags = ti->ti_flags; - - /* - * Convert TCP protocol specific fields to host format. - */ - NTOHL(ti->ti_seq); - NTOHL(ti->ti_ack); - NTOHS(ti->ti_win); - NTOHS(ti->ti_urp); - - /* - * Drop TCP, IP headers and TCP options. - */ - m->m_data += sizeof(struct tcpiphdr)+off-sizeof(struct tcphdr); - m->m_len -= sizeof(struct tcpiphdr)+off-sizeof(struct tcphdr); - - /* - * Locate pcb for segment. - */ -findpcb: - /* - * First look for an exact match. - */ - inp = in_pcblookuphash(&tcbinfo, ti->ti_src, ti->ti_sport, - ti->ti_dst, ti->ti_dport); - /* - * ...and if that fails, do a wildcard search. - */ - if (inp == NULL) { - inp = in_pcblookup(&tcb, ti->ti_src, ti->ti_sport, - ti->ti_dst, ti->ti_dport, INPLOOKUP_WILDCARD); - } - - /* - * If the state is CLOSED (i.e., TCB does not exist) then - * all data in the incoming segment is discarded. - * If the TCB exists but is in CLOSED state, it is embryonic, - * but should either do a listen or a connect soon. - */ - if (inp == NULL) - goto dropwithreset; - tp = intotcpcb(inp); - if (tp == 0) - goto dropwithreset; - if (tp->t_state == TCPS_CLOSED) - goto drop; - - /* Unscale the window into a 32-bit value. */ - if ((tiflags & TH_SYN) == 0) - tiwin = ti->ti_win << tp->snd_scale; - else - tiwin = ti->ti_win; - - so = inp->inp_socket; - if (so->so_options & (SO_DEBUG|SO_ACCEPTCONN)) { -#ifdef TCPDEBUG - if (so->so_options & SO_DEBUG) { - ostate = tp->t_state; - tcp_saveti = *ti; - } -#endif - if (so->so_options & SO_ACCEPTCONN) { - register struct tcpcb *tp0 = tp; - struct socket *so2; - if ((tiflags & (TH_RST|TH_ACK|TH_SYN)) != TH_SYN) { - /* - * Note: dropwithreset makes sure we don't - * send a RST in response to a RST. - */ - if (tiflags & TH_ACK) { - tcpstat.tcps_badsyn++; - goto dropwithreset; - } - goto drop; - } - so2 = sonewconn(so, 0); - if (so2 == 0) { - unsigned int i, j, qlen; - - static int rnd; - static long old_mono_secs; - static unsigned int cur_cnt, old_cnt; - - tcpstat.tcps_listendrop++; - - /* - * Keep a decaying average of the number - * of overruns we've been getting. - */ - if ((i = (mono_time.tv_sec - - old_mono_secs)) != 0) { - old_mono_secs = mono_time.tv_sec; - old_cnt = cur_cnt / i; - cur_cnt = 0; - } - - so2 = so->so_q0; - if (so2 == 0) - goto drop; - - /* - * If we've been getting a lot of hits, - * random drop an incomplete connection - * from the queue, otherwise, fall through - * so we head-drop from the queue. - */ - qlen = so->so_q0len; - if (++cur_cnt > qlen || old_cnt > qlen) { - rnd = (314159 * rnd + 66329) & 0xffff; - j = ((qlen + 1) * rnd) >> 16; - - while (j-- && so2) - so2 = so2->so_q0; - } - if (so2) { - tcp_drop(sototcpcb(so2), ETIMEDOUT); - so2 = sonewconn(so, 0); - } - if (!so2) - goto drop; - } - so = so2; - /* - * This is ugly, but .... - * - * Mark socket as temporary until we're - * committed to keeping it. The code at - * ``drop'' and ``dropwithreset'' check the - * flag dropsocket to see if the temporary - * socket created here should be discarded. - * We mark the socket as discardable until - * we're committed to it below in TCPS_LISTEN. - */ - dropsocket++; - inp = (struct inpcb *)so->so_pcb; - inp->inp_laddr = ti->ti_dst; - inp->inp_lport = ti->ti_dport; - in_pcbrehash(inp); -#if BSD>=43 - inp->inp_options = ip_srcroute(); -#endif - tp = intotcpcb(inp); - tp->t_state = TCPS_LISTEN; - tp->t_flags |= tp0->t_flags & (TF_NOPUSH|TF_NOOPT); - - /* Compute proper scaling value from buffer space */ - while (tp->request_r_scale < TCP_MAX_WINSHIFT && - TCP_MAXWIN << tp->request_r_scale < so->so_rcv.sb_hiwat) - tp->request_r_scale++; - } - } - - /* - * Segment received on connection. - * Reset idle time and keep-alive timer. - */ - tp->t_idle = 0; - if (TCPS_HAVEESTABLISHED(tp->t_state)) - tp->t_timer[TCPT_KEEP] = tcp_keepidle; - - /* - * Process options if not in LISTEN state, - * else do it below (after getting remote address). - */ - if (tp->t_state != TCPS_LISTEN) - tcp_dooptions(tp, (u_char *)optp, optlen, ti, &to); - - /* - * Header prediction: check for the two common cases - * of a uni-directional data xfer. If the packet has - * no control flags, is in-sequence, the window didn't - * change and we're not retransmitting, it's a - * candidate. If the length is zero and the ack moved - * forward, we're the sender side of the xfer. Just - * free the data acked & wake any higher level process - * that was blocked waiting for space. If the length - * is non-zero and the ack didn't move, we're the - * receiver side. If we're getting packets in-order - * (the reassembly queue is empty), add the data to - * the socket buffer and note that we need a delayed ack. - * Make sure that the hidden state-flags are also off. - * Since we check for TCPS_ESTABLISHED above, it can only - * be TH_NEEDSYN. - */ - if (tp->t_state == TCPS_ESTABLISHED && - (tiflags & (TH_SYN|TH_FIN|TH_RST|TH_URG|TH_ACK)) == TH_ACK && - ((tp->t_flags & (TF_NEEDSYN|TF_NEEDFIN)) == 0) && - ((to.to_flag & TOF_TS) == 0 || - TSTMP_GEQ(to.to_tsval, tp->ts_recent)) && - /* - * Using the CC option is compulsory if once started: - * the segment is OK if no T/TCP was negotiated or - * if the segment has a CC option equal to CCrecv - */ - ((tp->t_flags & (TF_REQ_CC|TF_RCVD_CC)) != (TF_REQ_CC|TF_RCVD_CC) || - ((to.to_flag & TOF_CC) != 0 && to.to_cc == tp->cc_recv)) && - ti->ti_seq == tp->rcv_nxt && - tiwin && tiwin == tp->snd_wnd && - tp->snd_nxt == tp->snd_max) { - - /* - * If last ACK falls within this segment's sequence numbers, - * record the timestamp. - * NOTE that the test is modified according to the latest - * proposal of the tcplw@cray.com list (Braden 1993/04/26). - */ - if ((to.to_flag & TOF_TS) != 0 && - SEQ_LEQ(ti->ti_seq, tp->last_ack_sent)) { - tp->ts_recent_age = tcp_now; - tp->ts_recent = to.to_tsval; - } - - if (ti->ti_len == 0) { - if (SEQ_GT(ti->ti_ack, tp->snd_una) && - SEQ_LEQ(ti->ti_ack, tp->snd_max) && - tp->snd_cwnd >= tp->snd_wnd) { - /* - * this is a pure ack for outstanding data. - */ - ++tcpstat.tcps_predack; - if ((to.to_flag & TOF_TS) != 0) - tcp_xmit_timer(tp, - tcp_now - to.to_tsecr + 1); - else if (tp->t_rtt && - SEQ_GT(ti->ti_ack, tp->t_rtseq)) - tcp_xmit_timer(tp, tp->t_rtt); - acked = ti->ti_ack - tp->snd_una; - tcpstat.tcps_rcvackpack++; - tcpstat.tcps_rcvackbyte += acked; - sbdrop(&so->so_snd, acked); - tp->snd_una = ti->ti_ack; - m_freem(m); - - /* - * If all outstanding data are acked, stop - * retransmit timer, otherwise restart timer - * using current (possibly backed-off) value. - * If process is waiting for space, - * wakeup/selwakeup/signal. If data - * are ready to send, let tcp_output - * decide between more output or persist. - */ - if (tp->snd_una == tp->snd_max) - tp->t_timer[TCPT_REXMT] = 0; - else if (tp->t_timer[TCPT_PERSIST] == 0) - tp->t_timer[TCPT_REXMT] = tp->t_rxtcur; - - if (so->so_snd.sb_flags & SB_NOTIFY) - sowwakeup(so); - if (so->so_snd.sb_cc) - (void) tcp_output(tp); - return; - } - } else if (ti->ti_ack == tp->snd_una && - tp->seg_next == (struct tcpiphdr *)tp && - ti->ti_len <= sbspace(&so->so_rcv)) { - /* - * this is a pure, in-sequence data packet - * with nothing on the reassembly queue and - * we have enough buffer space to take it. - */ - ++tcpstat.tcps_preddat; - tp->rcv_nxt += ti->ti_len; - OS_DbgPrint(OSK_MID_TRACE,("Added %d to rcv_nxt\n", ti->ti_len - sizeof(struct ip))); - tcpstat.tcps_rcvpack++; - tcpstat.tcps_rcvbyte += ti->ti_len; - /* - * Add data to socket buffer. - */ - sbappend(&so->so_rcv, m); - sorwakeup(so); -#ifdef TCP_ACK_HACK - /* - * If this is a short packet, then ACK now - with Nagel - * congestion avoidance sender won't send more until - * he gets an ACK. - */ - if (tiflags & TH_PUSH) { - tp->t_flags |= TF_ACKNOW; - tcp_output(tp); - } else { - tp->t_flags |= TF_DELACK; - } -#else - tp->t_flags |= TF_DELACK; -#endif - return; - } - } - - /* - * Calculate amount of space in receive window, - * and then do TCP input processing. - * Receive window is amount of space in rcv queue, - * but not less than advertised window. - */ - { int win; - - win = sbspace(&so->so_rcv); - if (win < 0) - win = 0; - tp->rcv_wnd = max(win, (int)(tp->rcv_adv - tp->rcv_nxt)); - } - - switch (tp->t_state) { - - /* - * If the state is LISTEN then ignore segment if it contains an RST. - * If the segment contains an ACK then it is bad and send a RST. - * If it does not contain a SYN then it is not interesting; drop it. - * Don't bother responding if the destination was a broadcast. - * Otherwise initialize tp->rcv_nxt, and tp->irs, select an initial - * tp->iss, and send a segment: - * - * Also initialize tp->snd_nxt to tp->iss+1 and tp->snd_una to tp->iss. - * Fill in remote peer address fields if not previously specified. - * Enter SYN_RECEIVED state, and process any other fields of this - * segment in this state. - */ - case TCPS_LISTEN: { - struct mbuf *am; - register struct sockaddr_in *sin; - - if (tiflags & TH_RST) - goto drop; - if (tiflags & TH_ACK) - goto dropwithreset; - if ((tiflags & TH_SYN) == 0) - goto drop; - /* - * RFC1122 4.2.3.10, p. 104: discard bcast/mcast SYN - * in_broadcast() should never return true on a received - * packet with M_BCAST not set. - */ - if (m->m_flags & (M_BCAST|M_MCAST) || - IN_MULTICAST(ntohl(ti->ti_dst.s_addr))) - goto drop; - am = m_get(M_DONTWAIT, MT_SONAME); /* XXX */ - if (am == NULL) - goto drop; - am->m_len = sizeof (struct sockaddr_in); - sin = mtod(am, struct sockaddr_in *); - sin->sin_family = AF_INET; - sin->sin_len = sizeof(*sin); - sin->sin_addr = ti->ti_src; - sin->sin_port = ti->ti_sport; - bzero((caddr_t)sin->sin_zero, sizeof(sin->sin_zero)); - laddr = inp->inp_laddr; - if (inp->inp_laddr.s_addr == INADDR_ANY) - inp->inp_laddr = ti->ti_dst; - if (in_pcbconnect(inp, am)) { - inp->inp_laddr = laddr; - (void) m_free(am); - goto drop; - } - (void) m_free(am); - tp->t_template = tcp_template(tp); - if (tp->t_template == 0) { - tp = tcp_drop(tp, ENOBUFS); - dropsocket = 0; /* socket is already gone */ - goto drop; - } - if ((taop = tcp_gettaocache(inp)) == NULL) { - taop = &tao_noncached; - bzero(taop, sizeof(*taop)); - } - tcp_dooptions(tp, (u_char *)optp, optlen, ti, &to); - if (iss) - tp->iss = iss; - else - tp->iss = tcp_iss; - tcp_iss += TCP_ISSINCR/2; - tp->irs = ti->ti_seq; - tcp_sendseqinit(tp); - tcp_rcvseqinit(tp); - /* - * Initialization of the tcpcb for transaction; - * set SND.WND = SEG.WND, - * initialize CCsend and CCrecv. - */ - tp->snd_wnd = tiwin; /* initial send-window */ - tp->cc_send = CC_INC(tcp_ccgen); - tp->cc_recv = to.to_cc; - /* - * Perform TAO test on incoming CC (SEG.CC) option, if any. - * - compare SEG.CC against cached CC from the same host, - * if any. - * - if SEG.CC > chached value, SYN must be new and is accepted - * immediately: save new CC in the cache, mark the socket - * connected, enter ESTABLISHED state, turn on flag to - * send a SYN in the next segment. - * A virtual advertised window is set in rcv_adv to - * initialize SWS prevention. Then enter normal segment - * processing: drop SYN, process data and FIN. - * - otherwise do a normal 3-way handshake. - */ - if ((to.to_flag & TOF_CC) != 0) { - if (taop->tao_cc != 0 && CC_GT(to.to_cc, taop->tao_cc)) { - taop->tao_cc = to.to_cc; - tp->t_state = TCPS_ESTABLISHED; - - /* - * If there is a FIN, or if there is data and the - * connection is local, then delay SYN,ACK(SYN) in - * the hope of piggy-backing it on a response - * segment. Otherwise must send ACK now in case - * the other side is slow starting. - */ - if ((tiflags & TH_FIN) || (ti->ti_len != 0 && - in_localaddr(inp->inp_faddr))) - tp->t_flags |= (TF_DELACK | TF_NEEDSYN); - else - tp->t_flags |= (TF_ACKNOW | TF_NEEDSYN); - - /* - * Limit the `virtual advertised window' to TCP_MAXWIN - * here. Even if we requested window scaling, it will - * become effective only later when our SYN is acked. - */ - tp->rcv_adv += min(tp->rcv_wnd, TCP_MAXWIN); - tcpstat.tcps_connects++; - soisconnected(so); - tp->t_timer[TCPT_KEEP] = tcp_keepinit; - dropsocket = 0; /* committed to socket */ - tcpstat.tcps_accepts++; - goto trimthenstep6; - } - /* else do standard 3-way handshake */ - } else { - /* - * No CC option, but maybe CC.NEW: - * invalidate cached value. - */ - taop->tao_cc = 0; - } - /* - * TAO test failed or there was no CC option, - * do a standard 3-way handshake. - */ - tp->t_flags |= TF_ACKNOW; - tp->t_state = TCPS_SYN_RECEIVED; - tp->t_timer[TCPT_KEEP] = tcp_keepinit; - dropsocket = 0; /* committed to socket */ - tcpstat.tcps_accepts++; - goto trimthenstep6; - } - - /* - * If the state is SYN_RECEIVED: - * do just the ack and RST checks from SYN_SENT state. - * If the state is SYN_SENT: - * if seg contains an ACK, but not for our SYN, drop the input. - * if seg contains a RST, then drop the connection. - * if seg does not contain SYN, then drop it. - * Otherwise this is an acceptable SYN segment - * initialize tp->rcv_nxt and tp->irs - * if seg contains ack then advance tp->snd_una - * if SYN has been acked change to ESTABLISHED else SYN_RCVD state - * arrange for segment to be acked (eventually) - * continue processing rest of data/controls, beginning with URG - */ - case TCPS_SYN_RECEIVED: - case TCPS_SYN_SENT: - if ((taop = tcp_gettaocache(inp)) == NULL) { - taop = &tao_noncached; - bzero(taop, sizeof(*taop)); - } - - if ((tiflags & TH_ACK) && - (SEQ_LEQ(ti->ti_ack, tp->iss) || - SEQ_GT(ti->ti_ack, tp->snd_max))) { - /* - * If we have a cached CCsent for the remote host, - * hence we haven't just crashed and restarted, - * do not send a RST. This may be a retransmission - * from the other side after our earlier ACK was lost. - * Our new SYN, when it arrives, will serve as the - * needed ACK. - */ - if (taop->tao_ccsent != 0) - goto drop; - else - goto dropwithreset; - } - if (tiflags & TH_RST) { - if (tiflags & TH_ACK) - tp = tcp_drop(tp, ECONNREFUSED); - goto drop; - } - if (tp->t_state == TCPS_SYN_RECEIVED) - break; - if ((tiflags & TH_SYN) == 0) - goto drop; - tp->snd_wnd = ti->ti_win; /* initial send window */ - tp->cc_recv = to.to_cc; /* foreign CC */ - - tp->irs = ti->ti_seq; - tcp_rcvseqinit(tp); - if (tiflags & TH_ACK) { - /* - * Our SYN was acked. If segment contains CC.ECHO - * option, check it to make sure this segment really - * matches our SYN. If not, just drop it as old - * duplicate, but send an RST if we're still playing - * by the old rules. - */ - if ((to.to_flag & TOF_CCECHO) && - tp->cc_send != to.to_ccecho) { - if (taop->tao_ccsent != 0) - goto drop; - else - goto dropwithreset; - } - tcpstat.tcps_connects++; - soisconnected(so); - /* Do window scaling on this connection? */ - if ((tp->t_flags & (TF_RCVD_SCALE|TF_REQ_SCALE)) == - (TF_RCVD_SCALE|TF_REQ_SCALE)) { - tp->snd_scale = tp->requested_s_scale; - tp->rcv_scale = tp->request_r_scale; - } - /* Segment is acceptable, update cache if undefined. */ - if (taop->tao_ccsent == 0) - taop->tao_ccsent = to.to_ccecho; - - tp->rcv_adv += tp->rcv_wnd; - tp->snd_una++; /* SYN is acked */ - /* - * If there's data, delay ACK; if there's also a FIN - * ACKNOW will be turned on later. - */ - if (ti->ti_len != 0) - tp->t_flags |= TF_DELACK; - else - tp->t_flags |= TF_ACKNOW; - /* - * Received in SYN_SENT[*] state. - * Transitions: - * SYN_SENT --> ESTABLISHED - * SYN_SENT* --> FIN_WAIT_1 - */ - if (tp->t_flags & TF_NEEDFIN) { - tp->t_state = TCPS_FIN_WAIT_1; - tp->t_flags &= ~TF_NEEDFIN; - tiflags &= ~TH_SYN; - } else { - tp->t_state = TCPS_ESTABLISHED; - tp->t_timer[TCPT_KEEP] = tcp_keepidle; - } - } else { - /* - * Received initial SYN in SYN-SENT[*] state => simul- - * taneous open. If segment contains CC option and there is - * a cached CC, apply TAO test; if it succeeds, connection is - * half-synchronized. Otherwise, do 3-way handshake: - * SYN-SENT -> SYN-RECEIVED - * SYN-SENT* -> SYN-RECEIVED* - * If there was no CC option, clear cached CC value. - */ - tp->t_flags |= TF_ACKNOW; - tp->t_timer[TCPT_REXMT] = 0; - if (to.to_flag & TOF_CC) { - if (taop->tao_cc != 0 && - CC_GT(to.to_cc, taop->tao_cc)) { - /* - * update cache and make transition: - * SYN-SENT -> ESTABLISHED* - * SYN-SENT* -> FIN-WAIT-1* - */ - taop->tao_cc = to.to_cc; - if (tp->t_flags & TF_NEEDFIN) { - tp->t_state = TCPS_FIN_WAIT_1; - tp->t_flags &= ~TF_NEEDFIN; - } else { - tp->t_state = TCPS_ESTABLISHED; - tp->t_timer[TCPT_KEEP] = tcp_keepidle; - } - tp->t_flags |= TF_NEEDSYN; - } else - tp->t_state = TCPS_SYN_RECEIVED; - } else { - /* CC.NEW or no option => invalidate cache */ - taop->tao_cc = 0; - tp->t_state = TCPS_SYN_RECEIVED; - } - } - -trimthenstep6: - /* - * Advance ti->ti_seq to correspond to first data byte. - * If data, trim to stay within window, - * dropping FIN if necessary. - */ - ti->ti_seq++; - if (ti->ti_len > tp->rcv_wnd) { - todrop = ti->ti_len - tp->rcv_wnd; - m_adj(m, -todrop); - ti->ti_len = tp->rcv_wnd; - tiflags &= ~TH_FIN; - tcpstat.tcps_rcvpackafterwin++; - tcpstat.tcps_rcvbyteafterwin += todrop; - } - tp->snd_wl1 = ti->ti_seq - 1; - tp->rcv_up = ti->ti_seq; - /* - * Client side of transaction: already sent SYN and data. - * If the remote host used T/TCP to validate the SYN, - * our data will be ACK'd; if so, enter normal data segment - * processing in the middle of step 5, ack processing. - * Otherwise, goto step 6. - */ - if (tiflags & TH_ACK) - goto process_ACK; - goto step6; - /* - * If the state is LAST_ACK or CLOSING or TIME_WAIT: - * if segment contains a SYN and CC [not CC.NEW] option: - * if state == TIME_WAIT and connection duration > MSL, - * drop packet and send RST; - * - * if SEG.CC > CCrecv then is new SYN, and can implicitly - * ack the FIN (and data) in retransmission queue. - * Complete close and delete TCPCB. Then reprocess - * segment, hoping to find new TCPCB in LISTEN state; - * - * else must be old SYN; drop it. - * else do normal processing. - */ - case TCPS_LAST_ACK: - case TCPS_CLOSING: - case TCPS_TIME_WAIT: - if ((tiflags & TH_SYN) && - (to.to_flag & TOF_CC) && tp->cc_recv != 0) { - if (tp->t_state == TCPS_TIME_WAIT && - tp->t_duration > TCPTV_MSL) - goto dropwithreset; - if (CC_GT(to.to_cc, tp->cc_recv)) { - tp = tcp_close(tp); - goto findpcb; - } - else - goto drop; - } - break; /* continue normal processing */ - } - - /* - * States other than LISTEN or SYN_SENT. - * First check timestamp, if present. - * Then check the connection count, if present. - * Then check that at least some bytes of segment are within - * receive window. If segment begins before rcv_nxt, - * drop leading data (and SYN); if nothing left, just ack. - * - * RFC 1323 PAWS: If we have a timestamp reply on this segment - * and it's less than ts_recent, drop it. - */ - if ((to.to_flag & TOF_TS) != 0 && (tiflags & TH_RST) == 0 && - tp->ts_recent && TSTMP_LT(to.to_tsval, tp->ts_recent)) { - - /* Check to see if ts_recent is over 24 days old. */ - if ((int)(tcp_now - tp->ts_recent_age) > TCP_PAWS_IDLE) { - /* - * Invalidate ts_recent. If this segment updates - * ts_recent, the age will be reset later and ts_recent - * will get a valid value. If it does not, setting - * ts_recent to zero will at least satisfy the - * requirement that zero be placed in the timestamp - * echo reply when ts_recent isn't valid. The - * age isn't reset until we get a valid ts_recent - * because we don't want out-of-order segments to be - * dropped when ts_recent is old. - */ - tp->ts_recent = 0; - } else { - tcpstat.tcps_rcvduppack++; - tcpstat.tcps_rcvdupbyte += ti->ti_len; - tcpstat.tcps_pawsdrop++; - goto dropafterack; - } - } - - /* - * T/TCP mechanism - * If T/TCP was negotiated and the segment doesn't have CC, - * or if it's CC is wrong then drop the segment. - * RST segments do not have to comply with this. - */ - if ((tp->t_flags & (TF_REQ_CC|TF_RCVD_CC)) == (TF_REQ_CC|TF_RCVD_CC) && - ((to.to_flag & TOF_CC) == 0 || tp->cc_recv != to.to_cc) && - (tiflags & TH_RST) == 0) - goto dropafterack; - - todrop = tp->rcv_nxt - ti->ti_seq; - if (todrop > 0) { - if (tiflags & TH_SYN) { - tiflags &= ~TH_SYN; - ti->ti_seq++; - if (ti->ti_urp > 1) - ti->ti_urp--; - else - tiflags &= ~TH_URG; - todrop--; - } - /* - * Following if statement from Stevens, vol. 2, p. 960. - */ - if (todrop > ti->ti_len - || (todrop == ti->ti_len && (tiflags & TH_FIN) == 0)) { - /* - * Any valid FIN must be to the left of the window. - * At this point the FIN must be a duplicate or out - * of sequence; drop it. - */ - tiflags &= ~TH_FIN; - - /* - * Send an ACK to resynchronize and drop any data. - * But keep on processing for RST or ACK. - */ - tp->t_flags |= TF_ACKNOW; - todrop = ti->ti_len; - tcpstat.tcps_rcvduppack++; - tcpstat.tcps_rcvdupbyte += todrop; - } else { - tcpstat.tcps_rcvpartduppack++; - tcpstat.tcps_rcvpartdupbyte += todrop; - } - m_adj(m, todrop); - ti->ti_seq += todrop; - ti->ti_len -= todrop; - if (ti->ti_urp > todrop) - ti->ti_urp -= todrop; - else { - tiflags &= ~TH_URG; - ti->ti_urp = 0; - } - } - - /* - * If new data are received on a connection after the - * user processes are gone, then RST the other end. - */ - if ((so->so_state & SS_NOFDREF) && - tp->t_state > TCPS_CLOSE_WAIT && ti->ti_len) { - tp = tcp_close(tp); - tcpstat.tcps_rcvafterclose++; - goto dropwithreset; - } - - /* - * If segment ends after window, drop trailing data - * (and PUSH and FIN); if nothing left, just ACK. - */ - todrop = (ti->ti_seq+ti->ti_len) - (tp->rcv_nxt+tp->rcv_wnd); - if (todrop > 0) { - tcpstat.tcps_rcvpackafterwin++; - if (todrop >= ti->ti_len) { - tcpstat.tcps_rcvbyteafterwin += ti->ti_len; - /* - * If a new connection request is received - * while in TIME_WAIT, drop the old connection - * and start over if the sequence numbers - * are above the previous ones. - */ - if (tiflags & TH_SYN && - tp->t_state == TCPS_TIME_WAIT && - SEQ_GT(ti->ti_seq, tp->rcv_nxt)) { - iss = tp->rcv_nxt + TCP_ISSINCR; - tp = tcp_close(tp); - goto findpcb; - } - /* - * If window is closed can only take segments at - * window edge, and have to drop data and PUSH from - * incoming segments. Continue processing, but - * remember to ack. Otherwise, drop segment - * and ack. - */ - if (tp->rcv_wnd == 0 && ti->ti_seq == tp->rcv_nxt) { - tp->t_flags |= TF_ACKNOW; - tcpstat.tcps_rcvwinprobe++; - } else - goto dropafterack; - } else - tcpstat.tcps_rcvbyteafterwin += todrop; - m_adj(m, -todrop); - ti->ti_len -= todrop; - tiflags &= ~(TH_PUSH|TH_FIN); - } - - /* - * If last ACK falls within this segment's sequence numbers, - * record its timestamp. - * NOTE that the test is modified according to the latest - * proposal of the tcplw@cray.com list (Braden 1993/04/26). - */ - if ((to.to_flag & TOF_TS) != 0 && - SEQ_LEQ(ti->ti_seq, tp->last_ack_sent)) { - tp->ts_recent_age = tcp_now; - tp->ts_recent = to.to_tsval; - } - - /* - * If the RST bit is set examine the state: - * SYN_RECEIVED STATE: - * If passive open, return to LISTEN state. - * If active open, inform user that connection was refused. - * ESTABLISHED, FIN_WAIT_1, FIN_WAIT2, CLOSE_WAIT STATES: - * Inform user that connection was reset, and close tcb. - * CLOSING, LAST_ACK, TIME_WAIT STATES - * Close the tcb. - */ - if (tiflags&TH_RST) switch (tp->t_state) { - - case TCPS_SYN_RECEIVED: - so->so_error = ECONNREFUSED; - goto close; - - case TCPS_ESTABLISHED: - case TCPS_FIN_WAIT_1: - case TCPS_FIN_WAIT_2: - case TCPS_CLOSE_WAIT: - so->so_error = ECONNRESET; - close: - tp->t_state = TCPS_CLOSED; - tcpstat.tcps_drops++; - tp = tcp_close(tp); - goto drop; - - case TCPS_CLOSING: - case TCPS_LAST_ACK: - case TCPS_TIME_WAIT: - tp = tcp_close(tp); - goto drop; - } - - /* - * If a SYN is in the window, then this is an - * error and we send an RST and drop the connection. - */ - if (tiflags & TH_SYN) { - tp = tcp_drop(tp, ECONNRESET); - goto dropwithreset; - } - - /* - * If the ACK bit is off: if in SYN-RECEIVED state or SENDSYN - * flag is on (half-synchronized state), then queue data for - * later processing; else drop segment and return. - */ - if ((tiflags & TH_ACK) == 0) { - if (tp->t_state == TCPS_SYN_RECEIVED || - (tp->t_flags & TF_NEEDSYN)) - goto step6; - else - goto drop; - } - - /* - * Ack processing. - */ - switch (tp->t_state) { - - /* - * In SYN_RECEIVED state if the ack ACKs our SYN then enter - * ESTABLISHED state and continue processing, otherwise - * send an RST. - */ - case TCPS_SYN_RECEIVED: - if (SEQ_GT(tp->snd_una, ti->ti_ack) || - SEQ_GT(ti->ti_ack, tp->snd_max)) - goto dropwithreset; - - tcpstat.tcps_connects++; - soisconnected(so); - /* Do window scaling? */ - if ((tp->t_flags & (TF_RCVD_SCALE|TF_REQ_SCALE)) == - (TF_RCVD_SCALE|TF_REQ_SCALE)) { - tp->snd_scale = tp->requested_s_scale; - tp->rcv_scale = tp->request_r_scale; - } - /* - * Upon successful completion of 3-way handshake, - * update cache.CC if it was undefined, pass any queued - * data to the user, and advance state appropriately. - */ - if ((taop = tcp_gettaocache(inp)) != NULL && - taop->tao_cc == 0) - taop->tao_cc = tp->cc_recv; - - /* - * Make transitions: - * SYN-RECEIVED -> ESTABLISHED - * SYN-RECEIVED* -> FIN-WAIT-1 - */ - if (tp->t_flags & TF_NEEDFIN) { - tp->t_state = TCPS_FIN_WAIT_1; - tp->t_flags &= ~TF_NEEDFIN; - } else { - tp->t_state = TCPS_ESTABLISHED; - tp->t_timer[TCPT_KEEP] = tcp_keepidle; - } - /* - * If segment contains data or ACK, will call tcp_reass() - * later; if not, do so now to pass queued data to user. - */ - if (ti->ti_len == 0 && (tiflags & TH_FIN) == 0) - (void) tcp_reass(tp, (struct tcpiphdr *)0, - (struct mbuf *)0); - tp->snd_wl1 = ti->ti_seq - 1; - /* fall into ... */ - - /* - * In ESTABLISHED state: drop duplicate ACKs; ACK out of range - * ACKs. If the ack is in the range - * tp->snd_una < ti->ti_ack <= tp->snd_max - * then advance tp->snd_una to ti->ti_ack and drop - * data from the retransmission queue. If this ACK reflects - * more up to date window information we update our window information. - */ - case TCPS_ESTABLISHED: - case TCPS_FIN_WAIT_1: - case TCPS_FIN_WAIT_2: - case TCPS_CLOSE_WAIT: - case TCPS_CLOSING: - case TCPS_LAST_ACK: - case TCPS_TIME_WAIT: - - if (SEQ_LEQ(ti->ti_ack, tp->snd_una)) { - if (ti->ti_len == 0 && tiwin == tp->snd_wnd) { - tcpstat.tcps_rcvdupack++; - /* - * If we have outstanding data (other than - * a window probe), this is a completely - * duplicate ack (ie, window info didn't - * change), the ack is the biggest we've - * seen and we've seen exactly our rexmt - * threshhold of them, assume a packet - * has been dropped and retransmit it. - * Kludge snd_nxt & the congestion - * window so we send only this one - * packet. - * - * We know we're losing at the current - * window size so do congestion avoidance - * (set ssthresh to half the current window - * and pull our congestion window back to - * the new ssthresh). - * - * Dup acks mean that packets have left the - * network (they're now cached at the receiver) - * so bump cwnd by the amount in the receiver - * to keep a constant cwnd packets in the - * network. - */ - if (tp->t_timer[TCPT_REXMT] == 0 || - ti->ti_ack != tp->snd_una) - tp->t_dupacks = 0; - else if (++tp->t_dupacks == tcprexmtthresh) { - tcp_seq onxt = tp->snd_nxt; - u_int win = - min(tp->snd_wnd, tp->snd_cwnd) / 2 / - tp->t_maxseg; - - if (win < 2) - win = 2; - tp->snd_ssthresh = win * tp->t_maxseg; - tp->t_timer[TCPT_REXMT] = 0; - tp->t_rtt = 0; - tp->snd_nxt = ti->ti_ack; - tp->snd_cwnd = tp->t_maxseg; - (void) tcp_output(tp); - tp->snd_cwnd = tp->snd_ssthresh + - tp->t_maxseg * tp->t_dupacks; - if (SEQ_GT(onxt, tp->snd_nxt)) - tp->snd_nxt = onxt; - goto drop; - } else if (tp->t_dupacks > tcprexmtthresh) { - tp->snd_cwnd += tp->t_maxseg; - (void) tcp_output(tp); - goto drop; - } - } else - tp->t_dupacks = 0; - break; - } - /* - * If the congestion window was inflated to account - * for the other side's cached packets, retract it. - */ - if (tp->t_dupacks > tcprexmtthresh && - tp->snd_cwnd > tp->snd_ssthresh) - tp->snd_cwnd = tp->snd_ssthresh; - tp->t_dupacks = 0; - if (SEQ_GT(ti->ti_ack, tp->snd_max)) { - tcpstat.tcps_rcvacktoomuch++; - goto dropafterack; - } - /* - * If we reach this point, ACK is not a duplicate, - * i.e., it ACKs something we sent. - */ - if (tp->t_flags & TF_NEEDSYN) { - /* - * T/TCP: Connection was half-synchronized, and our - * SYN has been ACK'd (so connection is now fully - * synchronized). Go to non-starred state, - * increment snd_una for ACK of SYN, and check if - * we can do window scaling. - */ - tp->t_flags &= ~TF_NEEDSYN; - tp->snd_una++; - /* Do window scaling? */ - if ((tp->t_flags & (TF_RCVD_SCALE|TF_REQ_SCALE)) == - (TF_RCVD_SCALE|TF_REQ_SCALE)) { - tp->snd_scale = tp->requested_s_scale; - tp->rcv_scale = tp->request_r_scale; - } - } - -process_ACK: - acked = ti->ti_ack - tp->snd_una; - tcpstat.tcps_rcvackpack++; - tcpstat.tcps_rcvackbyte += acked; - - /* - * If we have a timestamp reply, update smoothed - * round trip time. If no timestamp is present but - * transmit timer is running and timed sequence - * number was acked, update smoothed round trip time. - * Since we now have an rtt measurement, cancel the - * timer backoff (cf., Phil Karn's retransmit alg.). - * Recompute the initial retransmit timer. - */ - if (to.to_flag & TOF_TS) - tcp_xmit_timer(tp, tcp_now - to.to_tsecr + 1); - else if (tp->t_rtt && SEQ_GT(ti->ti_ack, tp->t_rtseq)) - tcp_xmit_timer(tp,tp->t_rtt); - - /* - * If all outstanding data is acked, stop retransmit - * timer and remember to restart (more output or persist). - * If there is more data to be acked, restart retransmit - * timer, using current (possibly backed-off) value. - */ - if (ti->ti_ack == tp->snd_max) { - tp->t_timer[TCPT_REXMT] = 0; - needoutput = 1; - } else if (tp->t_timer[TCPT_PERSIST] == 0) - tp->t_timer[TCPT_REXMT] = tp->t_rxtcur; - - /* - * If no data (only SYN) was ACK'd, - * skip rest of ACK processing. - */ - if (acked == 0) - goto step6; - - /* - * When new data is acked, open the congestion window. - * If the window gives us less than ssthresh packets - * in flight, open exponentially (maxseg per packet). - * Otherwise open linearly: maxseg per window - * (maxseg^2 / cwnd per packet). - */ - { - register u_int cw = tp->snd_cwnd; - register u_int incr = tp->t_maxseg; - - if (cw > tp->snd_ssthresh) - incr = incr * incr / cw; - tp->snd_cwnd = min(cw + incr, TCP_MAXWIN<snd_scale); - } - if (acked > so->so_snd.sb_cc) { - tp->snd_wnd -= so->so_snd.sb_cc; - sbdrop(&so->so_snd, (int)so->so_snd.sb_cc); - ourfinisacked = 1; - } else { - sbdrop(&so->so_snd, acked); - tp->snd_wnd -= acked; - ourfinisacked = 0; - } - if (so->so_snd.sb_flags & SB_NOTIFY) - sowwakeup(so); - tp->snd_una = ti->ti_ack; - if (SEQ_LT(tp->snd_nxt, tp->snd_una)) - tp->snd_nxt = tp->snd_una; - - switch (tp->t_state) { - - /* - * In FIN_WAIT_1 STATE in addition to the processing - * for the ESTABLISHED state if our FIN is now acknowledged - * then enter FIN_WAIT_2. - */ - case TCPS_FIN_WAIT_1: - if (ourfinisacked) { - /* - * If we can't receive any more - * data, then closing user can proceed. - * Starting the timer is contrary to the - * specification, but if we don't get a FIN - * we'll hang forever. - */ - if (so->so_state & SS_CANTRCVMORE) { - soisdisconnected(so); - tp->t_timer[TCPT_2MSL] = tcp_maxidle; - } - tp->t_state = TCPS_FIN_WAIT_2; - } - break; - - /* - * In CLOSING STATE in addition to the processing for - * the ESTABLISHED state if the ACK acknowledges our FIN - * then enter the TIME-WAIT state, otherwise ignore - * the segment. - */ - case TCPS_CLOSING: - if (ourfinisacked) { - tp->t_state = TCPS_TIME_WAIT; - tcp_canceltimers(tp); - /* Shorten TIME_WAIT [RFC-1644, p.28] */ - if (tp->cc_recv != 0 && - tp->t_duration < TCPTV_MSL) - tp->t_timer[TCPT_2MSL] = - tp->t_rxtcur * TCPTV_TWTRUNC; - else - tp->t_timer[TCPT_2MSL] = 2 * TCPTV_MSL; - soisdisconnected(so); - } - break; - - /* - * In LAST_ACK, we may still be waiting for data to drain - * and/or to be acked, as well as for the ack of our FIN. - * If our FIN is now acknowledged, delete the TCB, - * enter the closed state and return. - */ - case TCPS_LAST_ACK: - if (ourfinisacked) { - tp = tcp_close(tp); - goto drop; - } - break; - - /* - * In TIME_WAIT state the only thing that should arrive - * is a retransmission of the remote FIN. Acknowledge - * it and restart the finack timer. - */ - case TCPS_TIME_WAIT: - tp->t_timer[TCPT_2MSL] = 2 * TCPTV_MSL; - goto dropafterack; - } - } - -step6: - /* - * Update window information. - * Don't look at window if no ACK: TAC's send garbage on first SYN. - */ - if ((tiflags & TH_ACK) && - (SEQ_LT(tp->snd_wl1, ti->ti_seq) || - (tp->snd_wl1 == ti->ti_seq && (SEQ_LT(tp->snd_wl2, ti->ti_ack) || - (tp->snd_wl2 == ti->ti_ack && tiwin > tp->snd_wnd))))) { - /* keep track of pure window updates */ - if (ti->ti_len == 0 && - tp->snd_wl2 == ti->ti_ack && tiwin > tp->snd_wnd) - tcpstat.tcps_rcvwinupd++; - tp->snd_wnd = tiwin; - tp->snd_wl1 = ti->ti_seq; - tp->snd_wl2 = ti->ti_ack; - if (tp->snd_wnd > tp->max_sndwnd) - tp->max_sndwnd = tp->snd_wnd; - needoutput = 1; - } - - /* - * Process segments with URG. - */ - if ((tiflags & TH_URG) && ti->ti_urp && - TCPS_HAVERCVDFIN(tp->t_state) == 0) { - /* - * This is a kludge, but if we receive and accept - * random urgent pointers, we'll crash in - * soreceive. It's hard to imagine someone - * actually wanting to send this much urgent data. - */ - if (ti->ti_urp + so->so_rcv.sb_cc > sb_max) { - ti->ti_urp = 0; /* XXX */ - tiflags &= ~TH_URG; /* XXX */ - goto dodata; /* XXX */ - } - /* - * If this segment advances the known urgent pointer, - * then mark the data stream. This should not happen - * in CLOSE_WAIT, CLOSING, LAST_ACK or TIME_WAIT STATES since - * a FIN has been received from the remote side. - * In these states we ignore the URG. - * - * According to RFC961 (Assigned Protocols), - * the urgent pointer points to the last octet - * of urgent data. We continue, however, - * to consider it to indicate the first octet - * of data past the urgent section as the original - * spec states (in one of two places). - */ - if (SEQ_GT(ti->ti_seq+ti->ti_urp, tp->rcv_up)) { - tp->rcv_up = ti->ti_seq + ti->ti_urp; - so->so_oobmark = so->so_rcv.sb_cc + - (tp->rcv_up - tp->rcv_nxt) - 1; - if (so->so_oobmark == 0) - so->so_state |= SS_RCVATMARK; - sohasoutofband(so); - tp->t_oobflags &= ~(TCPOOB_HAVEDATA | TCPOOB_HADDATA); - } - /* - * Remove out of band data so doesn't get presented to user. - * This can happen independent of advancing the URG pointer, - * but if two URG's are pending at once, some out-of-band - * data may creep in... ick. - */ - if (ti->ti_urp <= (u_long)ti->ti_len -#ifdef SO_OOBINLINE - && (so->so_options & SO_OOBINLINE) == 0 -#endif - ) - tcp_pulloutofband(so, ti, m); - } else - /* - * If no out of band data is expected, - * pull receive urgent pointer along - * with the receive window. - */ - if (SEQ_GT(tp->rcv_nxt, tp->rcv_up)) - tp->rcv_up = tp->rcv_nxt; -dodata: /* XXX */ - - /* - * Process the segment text, merging it into the TCP sequencing queue, - * and arranging for acknowledgment of receipt if necessary. - * This process logically involves adjusting tp->rcv_wnd as data - * is presented to the user (this happens in tcp_usrreq.c, - * case PRU_RCVD). If a FIN has already been received on this - * connection then we just ignore the text. - */ - if ((ti->ti_len || (tiflags&TH_FIN)) && - TCPS_HAVERCVDFIN(tp->t_state) == 0) { - TCP_REASS(tp, ti, m, so, tiflags); - /* - * Note the amount of data that peer has sent into - * our window, in order to estimate the sender's - * buffer size. - */ - len = so->so_rcv.sb_hiwat - (tp->rcv_adv - tp->rcv_nxt); - } else { - m_freem(m); - tiflags &= ~TH_FIN; - } - - /* - * If FIN is received ACK the FIN and let the user know - * that the connection is closing. - */ - if (tiflags & TH_FIN) { - if (TCPS_HAVERCVDFIN(tp->t_state) == 0) { - socantrcvmore(so); - /* - * If connection is half-synchronized - * (ie NEEDSYN flag on) then delay ACK, - * so it may be piggybacked when SYN is sent. - * Otherwise, since we received a FIN then no - * more input can be expected, send ACK now. - */ - if (tp->t_flags & TF_NEEDSYN) - tp->t_flags |= TF_DELACK; - else - tp->t_flags |= TF_ACKNOW; - tp->rcv_nxt++; - } - switch (tp->t_state) { - - /* - * In SYN_RECEIVED and ESTABLISHED STATES - * enter the CLOSE_WAIT state. - */ - case TCPS_SYN_RECEIVED: - case TCPS_ESTABLISHED: - tp->t_state = TCPS_CLOSE_WAIT; - break; - - /* - * If still in FIN_WAIT_1 STATE FIN has not been acked so - * enter the CLOSING state. - */ - case TCPS_FIN_WAIT_1: - tp->t_state = TCPS_CLOSING; - break; - - /* - * In FIN_WAIT_2 state enter the TIME_WAIT state, - * starting the time-wait timer, turning off the other - * standard timers. - */ - case TCPS_FIN_WAIT_2: - tp->t_state = TCPS_TIME_WAIT; - tcp_canceltimers(tp); - /* Shorten TIME_WAIT [RFC-1644, p.28] */ - if (tp->cc_recv != 0 && - tp->t_duration < TCPTV_MSL) { - tp->t_timer[TCPT_2MSL] = - tp->t_rxtcur * TCPTV_TWTRUNC; - /* For transaction client, force ACK now. */ - tp->t_flags |= TF_ACKNOW; - } - else - tp->t_timer[TCPT_2MSL] = 2 * TCPTV_MSL; - soisdisconnected(so); - break; - - /* - * In TIME_WAIT state restart the 2 MSL time_wait timer. - */ - case TCPS_TIME_WAIT: - tp->t_timer[TCPT_2MSL] = 2 * TCPTV_MSL; - break; - } - } -#ifdef TCPDEBUG - if (so->so_options & SO_DEBUG) - tcp_trace(TA_INPUT, ostate, tp, &tcp_saveti, 0); -#endif - - /* - * Return any desired output. - */ - if (needoutput || (tp->t_flags & TF_ACKNOW)) - (void) tcp_output(tp); - return; - -dropafterack: - /* - * Generate an ACK dropping incoming segment if it occupies - * sequence space, where the ACK reflects our state. - */ - if (tiflags & TH_RST) - goto drop; -#ifdef TCPDEBUG - if (so->so_options & SO_DEBUG) - tcp_trace(TA_DROP, ostate, tp, &tcp_saveti, 0); -#endif - m_freem(m); - tp->t_flags |= TF_ACKNOW; - (void) tcp_output(tp); - return; - -dropwithreset: - /* - * Generate a RST, dropping incoming segment. - * Make ACK acceptable to originator of segment. - * Don't bother to respond if destination was broadcast/multicast. - */ - if ((tiflags & TH_RST) || m->m_flags & (M_BCAST|M_MCAST) || - IN_MULTICAST(ntohl(ti->ti_dst.s_addr))) - goto drop; -#ifdef TCPDEBUG - if (tp == 0 || (tp->t_inpcb->inp_socket->so_options & SO_DEBUG)) - tcp_trace(TA_DROP, ostate, tp, &tcp_saveti, 0); -#endif - if (tiflags & TH_ACK) - tcp_respond(tp, ti, m, (tcp_seq)0, ti->ti_ack, TH_RST); - else { - if (tiflags & TH_SYN) - ti->ti_len++; - tcp_respond(tp, ti, m, ti->ti_seq+ti->ti_len, (tcp_seq)0, - TH_RST|TH_ACK); - } - /* destroy temporarily created socket */ - if (dropsocket) - (void) soabort(so); - return; - -drop: - /* - * Drop space held by incoming segment and return. - */ -#ifdef TCPDEBUG - if (tp == 0 || (tp->t_inpcb->inp_socket->so_options & SO_DEBUG)) - tcp_trace(TA_DROP, ostate, tp, &tcp_saveti, 0); -#endif - m_freem(m); - /* destroy temporarily created socket */ - if (dropsocket) - (void) soabort(so); - return; -#ifndef TUBA_INCLUDE -} - -void -tcp_dooptions(tp, cp, cnt, ti, to) - struct tcpcb *tp; - u_char *cp; - int cnt; - struct tcpiphdr *ti; - struct tcpopt *to; -{ - u_short mss = 0; - int opt, optlen; - - for (; cnt > 0; cnt -= optlen, cp += optlen) { - opt = cp[0]; - if (opt == TCPOPT_EOL) - break; - if (opt == TCPOPT_NOP) - optlen = 1; - else { - optlen = cp[1]; - if (optlen <= 0) - break; - } - switch (opt) { - - default: - continue; - - case TCPOPT_MAXSEG: - if (optlen != TCPOLEN_MAXSEG) - continue; - if (!(ti->ti_flags & TH_SYN)) - continue; - bcopy((char *) cp + 2, (char *) &mss, sizeof(mss)); - NTOHS(mss); - break; - - case TCPOPT_WINDOW: - if (optlen != TCPOLEN_WINDOW) - continue; - if (!(ti->ti_flags & TH_SYN)) - continue; - tp->t_flags |= TF_RCVD_SCALE; - tp->requested_s_scale = min(cp[2], TCP_MAX_WINSHIFT); - break; - - case TCPOPT_TIMESTAMP: - if (optlen != TCPOLEN_TIMESTAMP) - continue; - to->to_flag |= TOF_TS; - bcopy((char *)cp + 2, - (char *)&to->to_tsval, sizeof(to->to_tsval)); - NTOHL(to->to_tsval); - bcopy((char *)cp + 6, - (char *)&to->to_tsecr, sizeof(to->to_tsecr)); - NTOHL(to->to_tsecr); - - /* - * A timestamp received in a SYN makes - * it ok to send timestamp requests and replies. - */ - if (ti->ti_flags & TH_SYN) { - tp->t_flags |= TF_RCVD_TSTMP; - tp->ts_recent = to->to_tsval; - tp->ts_recent_age = tcp_now; - } - break; - case TCPOPT_CC: - if (optlen != TCPOLEN_CC) - continue; - to->to_flag |= TOF_CC; - bcopy((char *)cp + 2, - (char *)&to->to_cc, sizeof(to->to_cc)); - NTOHL(to->to_cc); - /* - * A CC or CC.new option received in a SYN makes - * it ok to send CC in subsequent segments. - */ - if (ti->ti_flags & TH_SYN) - tp->t_flags |= TF_RCVD_CC; - break; - case TCPOPT_CCNEW: - if (optlen != TCPOLEN_CC) - continue; - if (!(ti->ti_flags & TH_SYN)) - continue; - to->to_flag |= TOF_CCNEW; - bcopy((char *)cp + 2, - (char *)&to->to_cc, sizeof(to->to_cc)); - NTOHL(to->to_cc); - /* - * A CC or CC.new option received in a SYN makes - * it ok to send CC in subsequent segments. - */ - tp->t_flags |= TF_RCVD_CC; - break; - case TCPOPT_CCECHO: - if (optlen != TCPOLEN_CC) - continue; - if (!(ti->ti_flags & TH_SYN)) - continue; - to->to_flag |= TOF_CCECHO; - bcopy((char *)cp + 2, - (char *)&to->to_ccecho, sizeof(to->to_ccecho)); - NTOHL(to->to_ccecho); - break; - } - } - if (ti->ti_flags & TH_SYN) - tcp_mss(tp, mss); /* sets t_maxseg */ -} - -/* - * Pull out of band byte out of a segment so - * it doesn't appear in the user's data queue. - * It is still reflected in the segment length for - * sequencing purposes. - */ -void -tcp_pulloutofband(so, ti, m) - struct socket *so; - struct tcpiphdr *ti; - register struct mbuf *m; -{ - int cnt = ti->ti_urp - 1; - - while (cnt >= 0) { - if (m->m_len > cnt) { - char *cp = mtod(m, caddr_t) + cnt; - struct tcpcb *tp = sototcpcb(so); - - tp->t_iobc = *cp; - tp->t_oobflags |= TCPOOB_HAVEDATA; - bcopy(cp+1, cp, (unsigned)(m->m_len - cnt - 1)); - m->m_len--; - return; - } - cnt -= m->m_len; - m = m->m_next; - if (m == 0) - break; - } - panic("tcp_pulloutofband"); -} - -/* - * Collect new round-trip time estimate - * and update averages and current timeout. - */ -void -tcp_xmit_timer(tp, rtt) - register struct tcpcb *tp; - short rtt; -{ - register short delta; - - tcpstat.tcps_rttupdated++; - tp->t_rttupdated++; - if (tp->t_srtt != 0) { - /* - * srtt is stored as fixed point with 3 bits after the - * binary point (i.e., scaled by 8). The following magic - * is equivalent to the smoothing algorithm in rfc793 with - * an alpha of .875 (srtt = rtt/8 + srtt*7/8 in fixed - * point). Adjust rtt to origin 0. - */ - delta = rtt - 1 - (tp->t_srtt >> TCP_RTT_SHIFT); - if ((tp->t_srtt += delta) <= 0) - tp->t_srtt = 1; - /* - * We accumulate a smoothed rtt variance (actually, a - * smoothed mean difference), then set the retransmit - * timer to smoothed rtt + 4 times the smoothed variance. - * rttvar is stored as fixed point with 2 bits after the - * binary point (scaled by 4). The following is - * equivalent to rfc793 smoothing with an alpha of .75 - * (rttvar = rttvar*3/4 + |delta| / 4). This replaces - * rfc793's wired-in beta. - */ - if (delta < 0) - delta = -delta; - delta -= (tp->t_rttvar >> TCP_RTTVAR_SHIFT); - if ((tp->t_rttvar += delta) <= 0) - tp->t_rttvar = 1; - } else { - /* - * No rtt measurement yet - use the unsmoothed rtt. - * Set the variance to half the rtt (so our first - * retransmit happens at 3*rtt). - */ - tp->t_srtt = rtt << TCP_RTT_SHIFT; - tp->t_rttvar = rtt << (TCP_RTTVAR_SHIFT - 1); - } - tp->t_rtt = 0; - tp->t_rxtshift = 0; - - /* - * the retransmit should happen at rtt + 4 * rttvar. - * Because of the way we do the smoothing, srtt and rttvar - * will each average +1/2 tick of bias. When we compute - * the retransmit timer, we want 1/2 tick of rounding and - * 1 extra tick because of +-1/2 tick uncertainty in the - * firing of the timer. The bias will give us exactly the - * 1.5 tick we need. But, because the bias is - * statistical, we have to test that we don't drop below - * the minimum feasible timer (which is 2 ticks). - */ - TCPT_RANGESET(tp->t_rxtcur, TCP_REXMTVAL(tp), - tp->t_rttmin, TCPTV_REXMTMAX); - - /* - * We received an ack for a packet that wasn't retransmitted; - * it is probably safe to discard any error indications we've - * received recently. This isn't quite right, but close enough - * for now (a route might have failed after we sent a segment, - * and the return path might not be symmetrical). - */ - tp->t_softerror = 0; -} - -/* - * Determine a reasonable value for maxseg size. - * If the route is known, check route for mtu. - * If none, use an mss that can be handled on the outgoing - * interface without forcing IP to fragment; if bigger than - * an mbuf cluster (MCLBYTES), round down to nearest multiple of MCLBYTES - * to utilize large mbufs. If no route is found, route has no mtu, - * or the destination isn't local, use a default, hopefully conservative - * size (usually 512 or the default IP max size, but no more than the mtu - * of the interface), as we can't discover anything about intervening - * gateways or networks. We also initialize the congestion/slow start - * window to be a single segment if the destination isn't local. - * While looking at the routing entry, we also initialize other path-dependent - * parameters from pre-set or cached values in the routing entry. - * - * Also take into account the space needed for options that we - * send regularly. Make maxseg shorter by that amount to assure - * that we can send maxseg amount of data even when the options - * are present. Store the upper limit of the length of options plus - * data in maxopd. - * - * NOTE that this routine is only called when we process an incoming - * segment, for outgoing segments only tcp_mssopt is called. - * - * In case of T/TCP, we call this routine during implicit connection - * setup as well (offer = -1), to initialize maxseg from the cached - * MSS of our peer. - */ -void -tcp_mss(tp, offer) - struct tcpcb *tp; - int offer; -{ -#ifndef __REACTOS__ - register struct rtentry *rt; - struct ifnet *ifp = NULL; - struct rmxp_tao *taop; - register int rtt; -#endif - register int mss; - u_long bufsize; - struct inpcb *inp; - struct socket *so; - int origoffer = offer; - - inp = tp->t_inpcb; - so = inp->inp_socket; -#ifndef __REACTOS__ - if ((rt = tcp_rtlookup(inp)) == NULL) { - tp->t_maxopd = tp->t_maxseg = tcp_mssdflt; - return; - } - ifp = rt->rt_ifp; - - taop = rmx_taop(rt->rt_rmx); - /* - * Offer == -1 means that we didn't receive SYN yet, - * use cached value in that case; - */ - if (offer == -1) - offer = taop->tao_mssopt; -#endif - /* - * Offer == 0 means that there was no MSS on the SYN segment, - * in this case we use tcp_mssdflt. - */ - if (offer == 0) - offer = tcp_mssdflt; - else - /* - * Sanity check: make sure that maxopd will be large - * enough to allow some data on segments even is the - * all the option space is used (40bytes). Otherwise - * funny things may happen in tcp_output. - */ - offer = max(offer, 64); -#ifndef __REACTOS__ - taop->tao_mssopt = offer; - - /* - * While we're here, check if there's an initial rtt - * or rttvar. Convert from the route-table units - * to scaled multiples of the slow timeout timer. - */ - if (tp->t_srtt == 0 && (rtt = rt->rt_rmx.rmx_rtt)) { - /* - * XXX the lock bit for RTT indicates that the value - * is also a minimum value; this is subject to time. - */ - if (rt->rt_rmx.rmx_locks & RTV_RTT) - tp->t_rttmin = rtt / (RTM_RTTUNIT / PR_SLOWHZ); - tp->t_srtt = rtt / (RTM_RTTUNIT / (PR_SLOWHZ * TCP_RTT_SCALE)); - tcpstat.tcps_usedrtt++; - if (rt->rt_rmx.rmx_rttvar) { - tp->t_rttvar = rt->rt_rmx.rmx_rttvar / - (RTM_RTTUNIT / (PR_SLOWHZ * TCP_RTTVAR_SCALE)); - tcpstat.tcps_usedrttvar++; - } else { - /* default variation is +- 1 rtt */ - tp->t_rttvar = - tp->t_srtt * TCP_RTTVAR_SCALE / TCP_RTT_SCALE; - } - TCPT_RANGESET(tp->t_rxtcur, - ((tp->t_srtt >> 2) + tp->t_rttvar) >> 1, - tp->t_rttmin, TCPTV_REXMTMAX); - } - /* - * if there's an mtu associated with the route, use it - */ - if (rt->rt_rmx.rmx_mtu) - mss = rt->rt_rmx.rmx_mtu - sizeof(struct tcpiphdr); - else - { - mss = ifp->if_mtu - sizeof(struct tcpiphdr); - if (!in_localaddr(inp->inp_faddr)) - mss = min(mss, tcp_mssdflt); - } -#else - mss = tcp_mssopt(tp); - mss = min(mss, tcp_mssdflt); -#endif - mss = min(mss, offer); - /* - * maxopd stores the maximum length of data AND options - * in a segment; maxseg is the amount of data in a normal - * segment. We need to store this value (maxopd) apart - * from maxseg, because now every segment carries options - * and thus we normally have somewhat less data in segments. - */ - tp->t_maxopd = mss; - - /* - * In case of T/TCP, origoffer==-1 indicates, that no segments - * were received yet. In this case we just guess, otherwise - * we do the same as before T/TCP. - */ - if ((tp->t_flags & (TF_REQ_TSTMP|TF_NOOPT)) == TF_REQ_TSTMP && - (origoffer == -1 || - (tp->t_flags & TF_RCVD_TSTMP) == TF_RCVD_TSTMP)) - mss -= TCPOLEN_TSTAMP_APPA; - if ((tp->t_flags & (TF_REQ_CC|TF_NOOPT)) == TF_REQ_CC && - (origoffer == -1 || - (tp->t_flags & TF_RCVD_CC) == TF_RCVD_CC)) - mss -= TCPOLEN_CC_APPA; - -#if (MCLBYTES & (MCLBYTES - 1)) == 0 - if (mss > MCLBYTES) - mss &= ~(MCLBYTES-1); -#else - if (mss > MCLBYTES) - mss = mss / MCLBYTES * MCLBYTES; -#endif - /* - * If there's a pipesize, change the socket buffer - * to that size. Make the socket buffers an integral - * number of mss units; if the mss is larger than - * the socket buffer, decrease the mss. - */ -#if defined(RTV_SPIPE) && !defined(__REACTOS__) - if ((bufsize = rt->rt_rmx.rmx_sendpipe) == 0) -#endif - bufsize = so->so_snd.sb_hiwat; - if (bufsize < mss) - mss = bufsize; - else { - bufsize = roundup(bufsize, mss); - if (bufsize > sb_max) - bufsize = sb_max; - (void)sbreserve(&so->so_snd, bufsize); - } - tp->t_maxseg = mss; - -#if defined(RTV_RPIPE) && !defined(__REACTOS__) - if ((bufsize = rt->rt_rmx.rmx_recvpipe) == 0) -#endif - bufsize = so->so_rcv.sb_hiwat; - if (bufsize > mss) { - bufsize = roundup(bufsize, mss); - if (bufsize > sb_max) - bufsize = sb_max; - (void)sbreserve(&so->so_rcv, bufsize); - } -#ifndef __REACTOS__ - /* - * Don't force slow-start on local network. - */ - if (!in_localaddr(inp->inp_faddr)) -#endif - tp->snd_cwnd = mss; - -#ifndef __REACTOS__ - if (rt->rt_rmx.rmx_ssthresh) { - /* - * There's some sort of gateway or interface - * buffer limit on the path. Use this to set - * the slow start threshhold, but set the - * threshold to no less than 2*mss. - */ - tp->snd_ssthresh = max(2 * mss, rt->rt_rmx.rmx_ssthresh); - tcpstat.tcps_usedssthresh++; - } -#endif -} - -/* - * Determine the MSS option to send on an outgoing SYN. - */ -int -tcp_mssopt(tp) - struct tcpcb *tp; -{ -#ifndef __REACTOS__ - struct rtentry *rt; - - rt = tcp_rtlookup(tp->t_inpcb); - if (rt == NULL) - return tcp_mssdflt; - - return rt->rt_ifp->if_mtu - sizeof(struct tcpiphdr); -#else - struct ifaddr *ifa = ifa_ifwithnet((struct sockaddr *)&tp->t_inpcb->inp_faddr); - if (ifa == NULL) - return tcp_mssdflt; - - return ifa->ifa_mtu - sizeof(struct tcpiphdr); -#endif -} -#endif /* TUBA_INCLUDE */ diff --git a/lib/drivers/oskittcp/oskittcp/tcp_output.c b/lib/drivers/oskittcp/oskittcp/tcp_output.c deleted file mode 100644 index 1e9e4318983..00000000000 --- a/lib/drivers/oskittcp/oskittcp/tcp_output.c +++ /dev/null @@ -1,777 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1988, 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)tcp_output.c 8.3 (Berkeley) 12/30/93 - */ - -#define TCPOUTFLAGS -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef TCPDEBUG -#include -#endif -#include - -#ifdef notyet -extern struct mbuf *m_copypack(); -#endif - -#define IS_LOOPBACK_ADDR(addr) \ - ((ntohl(addr) & IN_CLASSA_NET) == (IN_LOOPBACKNET << IN_CLASSA_NSHIFT)) - -/* - * Tcp output routine: figure out what should be sent and send it. - */ -int -tcp_output(tp) - register struct tcpcb *tp; -{ - register struct socket *so = tp->t_inpcb->inp_socket; - register long len, win; - int off, flags, error; - register struct mbuf *m; - register struct tcpiphdr *ti; - u_char opt[TCP_MAXOLEN]; - unsigned optlen, hdrlen; - int idle, sendalot; - struct rmxp_tao *taop; - struct rmxp_tao tao_noncached; - - OS_DbgPrint(OSK_MID_TRACE,("Called\n")); - - /* - * Determine length of data that should be transmitted, - * and flags that will be used. - * If there is some data or critical controls (SYN, RST) - * to send, then transmit; otherwise, investigate further. - */ - idle = (tp->snd_max == tp->snd_una); - if (idle && tp->t_idle >= tp->t_rxtcur) - /* - * We have been idle for "a while" and no acks are - * expected to clock out any data we send -- - * slow start to get ack "clock" running again. - */ - tp->snd_cwnd = tp->t_maxseg; -again: - OS_DbgPrint(OSK_MID_TRACE,("again:\n")); - sendalot = 0; - off = tp->snd_nxt - tp->snd_una; - win = min(tp->snd_wnd, tp->snd_cwnd); - - flags = tcp_outflags[tp->t_state]; - /* - * Get standard flags, and add SYN or FIN if requested by 'hidden' - * state flags. - */ - if (tp->t_flags & TF_NEEDFIN) - flags |= TH_FIN; - if (tp->t_flags & TF_NEEDSYN) - flags |= TH_SYN; - - /* - * If in persist timeout with window of 0, send 1 byte. - * Otherwise, if window is small but nonzero - * and timer expired, we will send what we can - * and go to transmit state. - */ - if (tp->t_force) { - if (win == 0) { - /* - * If we still have some data to send, then - * clear the FIN bit. Usually this would - * happen below when it realizes that we - * aren't sending all the data. However, - * if we have exactly 1 byte of unset data, - * then it won't clear the FIN bit below, - * and if we are in persist state, we wind - * up sending the packet without recording - * that we sent the FIN bit. - * - * We can't just blindly clear the FIN bit, - * because if we don't have any more data - * to send then the probe will be the FIN - * itself. - */ - if (off < so->so_snd.sb_cc) - flags &= ~TH_FIN; - win = 1; - } else { - tp->t_timer[TCPT_PERSIST] = 0; - tp->t_rxtshift = 0; - } - } - - len = min(so->so_snd.sb_cc, win) - off; - - if ((taop = tcp_gettaocache(tp->t_inpcb)) == NULL) { - taop = &tao_noncached; - bzero(taop, sizeof(*taop)); - } - - /* - * Lop off SYN bit if it has already been sent. However, if this - * is SYN-SENT state and if segment contains data and if we don't - * know that foreign host supports TAO, suppress sending segment. - */ - if ((flags & TH_SYN) && SEQ_GT(tp->snd_nxt, tp->snd_una)) { - flags &= ~TH_SYN; - off--, len++; - if (len > 0 && tp->t_state == TCPS_SYN_SENT && - taop->tao_ccsent == 0) { - OS_DbgPrint(OSK_MID_TRACE,("leaving 0\n")); - return 0; - } - } - - /* - * Be careful not to send data and/or FIN on SYN segments - * in cases when no CC option will be sent. - * This measure is needed to prevent interoperability problems - * with not fully conformant TCP implementations. - */ - if ((flags & TH_SYN) && - ((tp->t_flags & TF_NOOPT) || !(tp->t_flags & TF_REQ_CC) || - ((flags & TH_ACK) && !(tp->t_flags & TF_RCVD_CC)))) { - len = 0; - flags &= ~TH_FIN; - } - - if (len < 0) { - /* - * If FIN has been sent but not acked, - * but we haven't been called to retransmit, - * len will be -1. Otherwise, window shrank - * after we sent into it. If window shrank to 0, - * cancel pending retransmit, pull snd_nxt back - * to (closed) window, and set the persist timer - * if it isn't already going. If the window didn't - * close completely, just wait for an ACK. - */ - len = 0; - if (win == 0) { - tp->t_timer[TCPT_REXMT] = 0; - tp->t_rxtshift = 0; - tp->snd_nxt = tp->snd_una; - if (tp->t_timer[TCPT_PERSIST] == 0) - tcp_setpersist(tp); - } - } - if (len > tp->t_maxseg) { - len = tp->t_maxseg; - sendalot = 1; - } - if (SEQ_LT(tp->snd_nxt + len, tp->snd_una + so->so_snd.sb_cc)) - flags &= ~TH_FIN; - - win = sbspace(&so->so_rcv); - - /* - * Sender silly window avoidance. If connection is idle or using - * the loopback interface and can send all data, a maximum segment, - * at least a maximum default-size segment do it, - * or are forced, do it; otherwise don't bother. - * If peer's buffer is tiny, then send - * when window is at least half open. - * If retransmitting (possibly after persist timer forced us - * to send into a small window), then must resend. - */ - if (len) { - if (len == tp->t_maxseg) - goto send; - if ((idle || tp->t_flags & TF_NODELAY || - IS_LOOPBACK_ADDR(tp->t_inpcb->inp_laddr.s_addr)) && - (tp->t_flags & TF_NOPUSH) == 0 && - len + off >= so->so_snd.sb_cc) - goto send; - if (tp->t_force) - goto send; - if (len >= tp->max_sndwnd / 2 && tp->max_sndwnd > 0) - goto send; - if (SEQ_LT(tp->snd_nxt, tp->snd_max)) - goto send; - } - - /* - * Compare available window to amount of window - * known to peer (as advertised window less - * next expected input). If the difference is at least two - * max size segments, or at least 50% of the maximum possible - * window, then want to send a window update to peer. - */ - if (win > 0) { - /* - * "adv" is the amount we can increase the window, - * taking into account that we are limited by - * TCP_MAXWIN << tp->rcv_scale. - */ - long adv = min(win, (long)TCP_MAXWIN << tp->rcv_scale) - - (tp->rcv_adv - tp->rcv_nxt); - - if (adv >= (long) (2 * tp->t_maxseg)) - goto send; - if (2 * adv >= (long) so->so_rcv.sb_hiwat) - goto send; - } - - /* - * Send if we owe peer an ACK. - */ - if (tp->t_flags & TF_ACKNOW) - goto send; - if ((flags & TH_RST) || - ((flags & TH_SYN) && (tp->t_flags & TF_NEEDSYN) == 0)) - goto send; - if (SEQ_GT(tp->snd_up, tp->snd_una)) - goto send; - /* - * If our state indicates that FIN should be sent - * and we have not yet done so, or we're retransmitting the FIN, - * then we need to send. - */ - if (flags & TH_FIN && - ((tp->t_flags & TF_SENTFIN) == 0 || tp->snd_nxt == tp->snd_una)) - goto send; - - /* - * TCP window updates are not reliable, rather a polling protocol - * using ``persist'' packets is used to insure receipt of window - * updates. The three ``states'' for the output side are: - * idle not doing retransmits or persists - * persisting to move a small or zero window - * (re)transmitting and thereby not persisting - * - * tp->t_timer[TCPT_PERSIST] - * is set when we are in persist state. - * tp->t_force - * is set when we are called to send a persist packet. - * tp->t_timer[TCPT_REXMT] - * is set when we are retransmitting - * The output side is idle when both timers are zero. - * - * If send window is too small, there is data to transmit, and no - * retransmit or persist is pending, then go to persist state. - * If nothing happens soon, send when timer expires: - * if window is nonzero, transmit what we can, - * otherwise force out a byte. - */ - if (so->so_snd.sb_cc && tp->t_timer[TCPT_REXMT] == 0 && - tp->t_timer[TCPT_PERSIST] == 0) { - tp->t_rxtshift = 0; - tcp_setpersist(tp); - } - - /* - * No reason to send a segment, just return. - */ - OS_DbgPrint(OSK_MID_TRACE,("leaving 0\n")); - return (0); - -send: - OS_DbgPrint(OSK_MID_TRACE,("send:\n")); - /* - * Before ESTABLISHED, force sending of initial options - * unless TCP set not to do any options. - * NOTE: we assume that the IP/TCP header plus TCP options - * always fit in a single mbuf, leaving room for a maximum - * link header, i.e. - * max_linkhdr + sizeof (struct tcpiphdr) + optlen <= MHLEN - */ - optlen = 0; - hdrlen = sizeof (struct tcpiphdr); - if (flags & TH_SYN) { - tp->snd_nxt = tp->iss; - if ((tp->t_flags & TF_NOOPT) == 0) { - u_short mss; - - opt[0] = TCPOPT_MAXSEG; - opt[1] = TCPOLEN_MAXSEG; - mss = htons((u_short) tcp_mssopt(tp)); - (void)memcpy(opt + 2, &mss, sizeof(mss)); - optlen = TCPOLEN_MAXSEG; - - if ((tp->t_flags & TF_REQ_SCALE) && - ((flags & TH_ACK) == 0 || - (tp->t_flags & TF_RCVD_SCALE))) { - *((u_long *) (opt + optlen)) = htonl( - TCPOPT_NOP << 24 | - TCPOPT_WINDOW << 16 | - TCPOLEN_WINDOW << 8 | - tp->request_r_scale); - optlen += 4; - } - } - } - - /* - * Send a timestamp and echo-reply if this is a SYN and our side - * wants to use timestamps (TF_REQ_TSTMP is set) or both our side - * and our peer have sent timestamps in our SYN's. - */ - if ((tp->t_flags & (TF_REQ_TSTMP|TF_NOOPT)) == TF_REQ_TSTMP && - (flags & TH_RST) == 0 && - ((flags & TH_ACK) == 0 || - (tp->t_flags & TF_RCVD_TSTMP))) { - u_long *lp = (u_long *)(opt + optlen); - - /* Form timestamp option as shown in appendix A of RFC 1323. */ - *lp++ = htonl(TCPOPT_TSTAMP_HDR); - *lp++ = htonl(tcp_now); - *lp = htonl(tp->ts_recent); - optlen += TCPOLEN_TSTAMP_APPA; - } - - /* - * Send `CC-family' options if our side wants to use them (TF_REQ_CC), - * options are allowed (!TF_NOOPT) and it's not a RST. - */ - if ((tp->t_flags & (TF_REQ_CC|TF_NOOPT)) == TF_REQ_CC && - (flags & TH_RST) == 0) { - switch (flags & (TH_SYN|TH_ACK)) { - /* - * This is a normal ACK, send CC if we received CC before - * from our peer. - */ - case TH_ACK: - if (!(tp->t_flags & TF_RCVD_CC)) - break; - /*FALLTHROUGH*/ - - /* - * We can only get here in T/TCP's SYN_SENT* state, when - * we're a sending a non-SYN segment without waiting for - * the ACK of our SYN. A check above assures that we only - * do this if our peer understands T/TCP. - */ - case 0: - opt[optlen++] = TCPOPT_NOP; - opt[optlen++] = TCPOPT_NOP; - opt[optlen++] = TCPOPT_CC; - opt[optlen++] = TCPOLEN_CC; - *(u_int32_t *)&opt[optlen] = htonl(tp->cc_send); - - optlen += 4; - break; - - /* - * This is our initial SYN, check whether we have to use - * CC or CC.new. - */ - case TH_SYN: - opt[optlen++] = TCPOPT_NOP; - opt[optlen++] = TCPOPT_NOP; - opt[optlen++] = tp->t_flags & TF_SENDCCNEW ? - TCPOPT_CCNEW : TCPOPT_CC; - opt[optlen++] = TCPOLEN_CC; - *(u_int32_t *)&opt[optlen] = htonl(tp->cc_send); - optlen += 4; - break; - - /* - * This is a SYN,ACK; send CC and CC.echo if we received - * CC from our peer. - */ - case (TH_SYN|TH_ACK): - if (tp->t_flags & TF_RCVD_CC) { - opt[optlen++] = TCPOPT_NOP; - opt[optlen++] = TCPOPT_NOP; - opt[optlen++] = TCPOPT_CC; - opt[optlen++] = TCPOLEN_CC; - *(u_int32_t *)&opt[optlen] = - htonl(tp->cc_send); - optlen += 4; - opt[optlen++] = TCPOPT_NOP; - opt[optlen++] = TCPOPT_NOP; - opt[optlen++] = TCPOPT_CCECHO; - opt[optlen++] = TCPOLEN_CC; - *(u_int32_t *)&opt[optlen] = - htonl(tp->cc_recv); - optlen += 4; - } - break; - } - } - - hdrlen += optlen; - - /* - * Adjust data length if insertion of options will - * bump the packet length beyond the t_maxopd length. - * Clear the FIN bit because we cut off the tail of - * the segment. - */ - if (len + optlen > tp->t_maxopd) { - /* - * If there is still more to send, don't close the connection. - */ - flags &= ~TH_FIN; - len = tp->t_maxopd - optlen; - sendalot = 1; - } - -/*#ifdef DIAGNOSTIC*/ - if (max_linkhdr + hdrlen > MHLEN) - panic("tcphdr too big"); -/*#endif*/ - - /* - * Grab a header mbuf, attaching a copy of data to - * be transmitted, and initialize the header from - * the template for sends on this connection. - */ - if (len) { - if (tp->t_force && len == 1) - tcpstat.tcps_sndprobe++; - else if (SEQ_LT(tp->snd_nxt, tp->snd_max)) { - tcpstat.tcps_sndrexmitpack++; - tcpstat.tcps_sndrexmitbyte += len; - } else { - tcpstat.tcps_sndpack++; - tcpstat.tcps_sndbyte += len; - } -#ifdef notyet - if ((m = m_copypack(so->so_snd.sb_mb, off, - (int)len, max_linkhdr + hdrlen)) == 0) { - error = ENOBUFS; - goto out; - } - /* - * m_copypack left space for our hdr; use it. - */ - m->m_len += hdrlen; - m->m_data -= hdrlen; -#else - MGETHDR(m, M_DONTWAIT, MT_HEADER); - if (m == NULL) { - error = ENOBUFS; - goto out; - } - m->m_data += max_linkhdr; - m->m_len = hdrlen; - /* m is not initialized here ... see below up to line - * in_cksum to see how it gets there */ - if (len <= MHLEN - hdrlen - max_linkhdr) { - m_copydata(so->so_snd.sb_mb, off, (int) len, - mtod(m, caddr_t) + hdrlen); - m->m_len += len; - } else { - m->m_next = m_copy(so->so_snd.sb_mb, off, (int) len); - // the buffer is allocated, but not filled with the tcp - // header yet, so dumping it here yields garbage... - //OskitDumpBuffer(mtod(m, caddr_t), len); - if (m->m_next == 0) { - (void) m_free(m); - error = ENOBUFS; - goto out; - } - } -#endif - /* - * If we're sending everything we've got, set PUSH. - * (This will keep happy those implementations which only - * give data to the user when a buffer fills or - * a PUSH comes in.) - */ - if (off + len == so->so_snd.sb_cc) - flags |= TH_PUSH; - } else { - if (tp->t_flags & TF_ACKNOW) - tcpstat.tcps_sndacks++; - else if (flags & (TH_SYN|TH_FIN|TH_RST)) - tcpstat.tcps_sndctrl++; - else if (SEQ_GT(tp->snd_up, tp->snd_una)) - tcpstat.tcps_sndurg++; - else - tcpstat.tcps_sndwinup++; - - MGETHDR(m, M_DONTWAIT, MT_HEADER); - if (m == NULL) { - error = ENOBUFS; - goto out; - } - m->m_data += max_linkhdr; - m->m_len = hdrlen; - } - m->m_pkthdr.rcvif = (struct ifnet *)0; - - /* This pulls the data ptr from m and start initting it... - * before this point, m is empty. */ - ti = mtod(m, struct tcpiphdr *); - if (tp->t_template == 0) - panic("tcp_output"); - (void)memcpy(ti, tp->t_template, sizeof (struct tcpiphdr)); - - /* - * Fill in fields, remembering maximum advertised - * window for use in delaying messages about window sizes. - * If resending a FIN, be sure not to use a new sequence number. - */ - if (flags & TH_FIN && tp->t_flags & TF_SENTFIN && - tp->snd_nxt == tp->snd_max) - tp->snd_nxt--; - /* - * If we are doing retransmissions, then snd_nxt will - * not reflect the first unsent octet. For ACK only - * packets, we do not want the sequence number of the - * retransmitted packet, we want the sequence number - * of the next unsent octet. So, if there is no data - * (and no SYN or FIN), use snd_max instead of snd_nxt - * when filling in ti_seq. But if we are in persist - * state, snd_max might reflect one byte beyond the - * right edge of the window, so use snd_nxt in that - * case, since we know we aren't doing a retransmission. - * (retransmit and persist are mutually exclusive...) - */ - if (len || (flags & (TH_SYN|TH_FIN)) || tp->t_timer[TCPT_PERSIST]) - ti->ti_seq = htonl(tp->snd_nxt); - else - ti->ti_seq = htonl(tp->snd_max); - ti->ti_ack = htonl(tp->rcv_nxt); - - if (optlen) { - (void)memcpy(ti + 1, opt, optlen); - ti->ti_off = (sizeof (struct tcphdr) + optlen) >> 2; - } - ti->ti_flags = flags; - /* - * Calculate receive window. Don't shrink window, - * but avoid silly window syndrome. - */ - if (win < (long)(so->so_rcv.sb_hiwat / 4) && win < (long)tp->t_maxseg) - win = 0; - if (win > (long)TCP_MAXWIN << tp->rcv_scale) - win = (long)TCP_MAXWIN << tp->rcv_scale; - if (win < (long)(tp->rcv_adv - tp->rcv_nxt)) - win = (long)(tp->rcv_adv - tp->rcv_nxt); - ti->ti_win = htons((u_short) (win>>tp->rcv_scale)); - if (SEQ_GT(tp->snd_up, tp->snd_nxt)) { - ti->ti_urp = htons((u_short)(tp->snd_up - tp->snd_nxt)); - ti->ti_flags |= TH_URG; - } else - /* - * If no urgent pointer to send, then we pull - * the urgent pointer to the left edge of the send window - * so that it doesn't drift into the send window on sequence - * number wraparound. - */ - tp->snd_up = tp->snd_una; /* drag it along */ - - /* - * Put TCP length in extended header, and then - * checksum extended header and data. - */ - if (len + optlen) - ti->ti_len = htons((u_short)(sizeof (struct tcphdr) + - optlen + len)); - ti->ti_sum = in_cksum(m, (int)(hdrlen + len)); - - /* - * In transmit state, time the transmission and arrange for - * the retransmit. In persist state, just set snd_max. - */ - if (tp->t_force == 0 || tp->t_timer[TCPT_PERSIST] == 0) { - tcp_seq startseq = tp->snd_nxt; - - /* - * Advance snd_nxt over sequence space of this segment. - */ - if (flags & (TH_SYN|TH_FIN)) { - if (flags & TH_SYN) - tp->snd_nxt++; - if (flags & TH_FIN) { - tp->snd_nxt++; - tp->t_flags |= TF_SENTFIN; - } - } - tp->snd_nxt += len; - if (SEQ_GT(tp->snd_nxt, tp->snd_max)) { - tp->snd_max = tp->snd_nxt; - /* - * Time this transmission if not a retransmission and - * not currently timing anything. - */ - if (tp->t_rtt == 0) { - tp->t_rtt = 1; - tp->t_rtseq = startseq; - tcpstat.tcps_segstimed++; - } - } - - /* - * Set retransmit timer if not currently set, - * and not doing an ack or a keep-alive probe. - * Initial value for retransmit timer is smoothed - * round-trip time + 2 * round-trip time variance. - * Initialize shift counter which is used for backoff - * of retransmit time. - */ - if (tp->t_timer[TCPT_REXMT] == 0 && - tp->snd_nxt != tp->snd_una) { - tp->t_timer[TCPT_REXMT] = tp->t_rxtcur; - if (tp->t_timer[TCPT_PERSIST]) { - tp->t_timer[TCPT_PERSIST] = 0; - tp->t_rxtshift = 0; - } - } - } else - if (SEQ_GT(tp->snd_nxt + len, tp->snd_max)) - tp->snd_max = tp->snd_nxt + len; - -#ifdef TCPDEBUG - /* - * Trace. - */ - if (so->so_options & SO_DEBUG) - tcp_trace(TA_OUTPUT, tp->t_state, tp, ti, 0); -#endif - - /* - * Fill in IP length and desired time to live and - * send to IP level. There should be a better way - * to handle ttl and tos; we could keep them in - * the template, but need a way to checksum without them. - */ - m->m_pkthdr.len = hdrlen + len; -#ifdef TUBA - if (tp->t_tuba_pcb) - error = tuba_output(m, tp); - else -#endif - { -#if 1 - struct rtentry *rt; -#endif - ((struct ip *)ti)->ip_len = m->m_pkthdr.len; - ((struct ip *)ti)->ip_ttl = tp->t_inpcb->inp_ip.ip_ttl; /* XXX */ - ((struct ip *)ti)->ip_tos = tp->t_inpcb->inp_ip.ip_tos; /* XXX */ -#if 1 - /* - * See if we should do MTU discovery. We do it only if the following - * are true: - * 1) we have a valid route to the destination - * 2) the MTU is not locked (if it is, then discovery has been - * disabled) - */ - if ((rt = tp->t_inpcb->inp_route.ro_rt) - && rt->rt_flags & RTF_UP - && !(rt->rt_rmx.rmx_locks & RTV_MTU)) { - ((struct ip *)ti)->ip_off |= IP_DF; - } -#endif - error = ip_output(m, tp->t_inpcb->inp_options, &tp->t_inpcb->inp_route, - so->so_options & SO_DONTROUTE, 0); - } - if (error) { -out: - if (error == ENOBUFS) { - tcp_quench(tp->t_inpcb, 0); - OS_DbgPrint(OSK_MID_TRACE,("quench 0\n")); - return (0); - } -#if 1 - if (error == EMSGSIZE) { - /* - * ip_output() will have already fixed the route - * for us. tcp_mtudisc() will, as its last action, - * initiate retransmission, so it is important to - * not do so here. - */ - tcp_mtudisc(tp->t_inpcb, 0); - OS_DbgPrint(OSK_MID_TRACE,("mtudisc 0\n")); - return 0; - } -#endif - if ((error == EHOSTUNREACH || error == ENETDOWN) - && TCPS_HAVERCVDSYN(tp->t_state)) { - tp->t_softerror = error; - OS_DbgPrint(OSK_MID_TRACE,("softerror %d\n", error)); - return (0); - } - OS_DbgPrint(OSK_MID_TRACE,("error %d\n", error)); - return (error); - } - tcpstat.tcps_sndtotal++; - - /* - * Data sent (as far as we can tell). - * If this advertises a larger window than any other segment, - * then remember the size of the advertised window. - * Any pending ACK has now been sent. - */ - if (win > 0 && SEQ_GT(tp->rcv_nxt+win, tp->rcv_adv)) - tp->rcv_adv = tp->rcv_nxt + win; - tp->last_ack_sent = tp->rcv_nxt; - tp->t_flags &= ~(TF_ACKNOW|TF_DELACK); - if (sendalot) - goto again; - OS_DbgPrint(OSK_MID_TRACE,("leaving 0\n")); - return (0); -} - -void -tcp_setpersist(tp) - register struct tcpcb *tp; -{ - register int t = ((tp->t_srtt >> 2) + tp->t_rttvar) >> 1; - - if (tp->t_timer[TCPT_REXMT]) - panic("tcp_output REXMT"); - /* - * Start/restart persistance timer. - */ - TCPT_RANGESET(tp->t_timer[TCPT_PERSIST], - t * tcp_backoff[tp->t_rxtshift], - TCPTV_PERSMIN, TCPTV_PERSMAX); - if (tp->t_rxtshift < TCP_MAXRXTSHIFT) - tp->t_rxtshift++; -} diff --git a/lib/drivers/oskittcp/oskittcp/tcp_subr.c b/lib/drivers/oskittcp/oskittcp/tcp_subr.c deleted file mode 100644 index b9c215140e2..00000000000 --- a/lib/drivers/oskittcp/oskittcp/tcp_subr.c +++ /dev/null @@ -1,615 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1988, 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)tcp_subr.c 8.1 (Berkeley) 6/10/93 - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef TCPDEBUG -#include -#endif -#include - -/* patchable/settable parameters for tcp */ -int tcp_mssdflt = TCP_MSS; -int tcp_rttdflt = TCPTV_SRTTDFLT / PR_SLOWHZ; -int tcp_do_rfc1323 = 1; -int tcp_do_rfc1644 = 1; -static void tcp_cleartaocache(void); - -/* - * Target size of TCP PCB hash table. Will be rounded down to a prime - * number. - */ -#ifndef TCBHASHSIZE -#define TCBHASHSIZE 128 -#endif - -/* - * Tcp initialization - */ -void -tcp_init() -{ - - tcp_iss = boottime.tv_sec; /* wrong */ - tcp_ccgen = 1; - tcp_cleartaocache(); - LIST_INIT(&tcb); - tcbinfo.listhead = &tcb; - tcbinfo.hashbase = phashinit(TCBHASHSIZE, M_PCB, &tcbinfo.hashsize); - if (max_protohdr < sizeof(struct tcpiphdr)) - max_protohdr = sizeof(struct tcpiphdr); - if (max_linkhdr + sizeof(struct tcpiphdr) > MHLEN) - panic("tcp_init"); -} - -/* - * Create template to be used to send tcp packets on a connection. - * Call after host entry created, allocates an mbuf and fills - * in a skeletal tcp/ip header, minimizing the amount of work - * necessary when the connection is used. - */ -struct tcpiphdr * -tcp_template(tp) - struct tcpcb *tp; -{ - register struct inpcb *inp = tp->t_inpcb; - register struct mbuf *m; - register struct tcpiphdr *n; - - if ((n = tp->t_template) == 0) { - m = m_get(M_DONTWAIT, MT_HEADER); - OS_DbgPrint(OSK_MID_TRACE,("tp->t_template = %x\n", m)); - if (m == NULL) - return (0); - m->m_len = sizeof (struct tcpiphdr); - n = mtod(m, struct tcpiphdr *); - } - n->ti_next = n->ti_prev = 0; - n->ti_x1 = 0; - n->ti_pr = IPPROTO_TCP; - n->ti_len = htons(sizeof (struct tcpiphdr) - sizeof (struct ip)); - n->ti_src = inp->inp_laddr; - OS_DbgPrint(OSK_MID_TRACE,("INP_LADDR = %x\n", n->ti_src)); - n->ti_dst = inp->inp_faddr; - n->ti_sport = inp->inp_lport; - n->ti_dport = inp->inp_fport; - n->ti_seq = 0; - n->ti_ack = 0; - n->ti_x2 = 0; - n->ti_off = 5; - n->ti_flags = 0; - n->ti_win = 0; - n->ti_sum = 0; - n->ti_urp = 0; - return (n); -} - -/* - * Send a single message to the TCP at address specified by - * the given TCP/IP header. If m == 0, then we make a copy - * of the tcpiphdr at ti and send directly to the addressed host. - * This is used to force keep alive messages out using the TCP - * template for a connection tp->t_template. If flags are given - * then we send a message back to the TCP which originated the - * segment ti, and discard the mbuf containing it and any other - * attached mbufs. - * - * In any case the ack and sequence number of the transmitted - * segment are as specified by the parameters. - */ -void -tcp_respond(tp, ti, m, ack, seq, flags) - struct tcpcb *tp; - register struct tcpiphdr *ti; - register struct mbuf *m; - tcp_seq ack, seq; - int flags; -{ - register int tlen; - int win = 0; - struct route *ro = 0; - - if (tp) { - win = sbspace(&tp->t_inpcb->inp_socket->so_rcv); - ro = &tp->t_inpcb->inp_route; - } - if (m == 0) { - m = m_gethdr(M_DONTWAIT, MT_HEADER); - if (m == NULL) - return; -#ifdef TCP_COMPAT_42 - tlen = 1; -#else - tlen = 0; -#endif - m->m_data += max_linkhdr; - *mtod(m, struct tcpiphdr *) = *ti; - ti = mtod(m, struct tcpiphdr *); - flags = TH_ACK; - } else { - m_freem(m->m_next); - m->m_next = 0; - m->m_data = (caddr_t)ti; - m->m_len = sizeof (struct tcpiphdr); - tlen = 0; -#define xchg(a,b,type) { type t; t=a; a=b; b=t; } - xchg(ti->ti_dst.s_addr, ti->ti_src.s_addr, u_long); - xchg(ti->ti_dport, ti->ti_sport, u_short); -#undef xchg - } - ti->ti_len = htons((u_short)(sizeof (struct tcphdr) + tlen)); - tlen += sizeof (struct tcpiphdr); - m->m_len = tlen; - m->m_pkthdr.len = tlen; - m->m_pkthdr.rcvif = (struct ifnet *) 0; - ti->ti_next = ti->ti_prev = 0; - ti->ti_x1 = 0; - ti->ti_seq = htonl(seq); - ti->ti_ack = htonl(ack); - ti->ti_x2 = 0; - ti->ti_off = sizeof (struct tcphdr) >> 2; - ti->ti_flags = flags; - if (tp) - ti->ti_win = htons((u_short) (win >> tp->rcv_scale)); - else - ti->ti_win = htons((u_short)win); - ti->ti_urp = 0; - ti->ti_sum = 0; - ti->ti_sum = in_cksum(m, tlen); - ((struct ip *)ti)->ip_len = tlen; - ((struct ip *)ti)->ip_ttl = ip_defttl; -#ifdef TCPDEBUG - if (tp == NULL || (tp->t_inpcb->inp_socket->so_options & SO_DEBUG)) - tcp_trace(TA_OUTPUT, 0, tp, ti, 0); -#endif - (void) ip_output(m, NULL, ro, 0, NULL); -} - -/* - * Create a new TCP control block, making an - * empty reassembly queue and hooking it to the argument - * protocol control block. - */ -struct tcpcb * -tcp_newtcpcb(inp) - struct inpcb *inp; -{ - register struct tcpcb *tp; - - tp = malloc(sizeof(*tp), M_PCB, M_NOWAIT); - if (tp == NULL) - return ((struct tcpcb *)0); - bzero((char *) tp, sizeof(struct tcpcb)); - tp->seg_next = tp->seg_prev = (struct tcpiphdr *)tp; - tp->t_maxseg = tp->t_maxopd = tcp_mssdflt; - - if (tcp_do_rfc1323) - tp->t_flags = (TF_REQ_SCALE|TF_REQ_TSTMP); - if (tcp_do_rfc1644) - tp->t_flags |= TF_REQ_CC; - tp->t_inpcb = inp; - /* - * Init srtt to TCPTV_SRTTBASE (0), so we can tell that we have no - * rtt estimate. Set rttvar so that srtt + 2 * rttvar gives - * reasonable initial retransmit time. - */ - tp->t_srtt = TCPTV_SRTTBASE; - tp->t_rttvar = tcp_rttdflt * PR_SLOWHZ << 2; - tp->t_rttmin = TCPTV_MIN; - TCPT_RANGESET(tp->t_rxtcur, - ((TCPTV_SRTTBASE >> 2) + (TCPTV_SRTTDFLT << 2)) >> 1, - TCPTV_MIN, TCPTV_REXMTMAX); - tp->snd_cwnd = TCP_MAXWIN << TCP_MAX_WINSHIFT; - tp->snd_ssthresh = TCP_MAXWIN << TCP_MAX_WINSHIFT; - inp->inp_ip.ip_ttl = ip_defttl; - inp->inp_ppcb = (caddr_t)tp; - return (tp); -} - -/* - * Drop a TCP connection, reporting - * the specified error. If connection is synchronized, - * then send a RST to peer. - */ -struct tcpcb * -tcp_drop(tp, errno) - register struct tcpcb *tp; - int errno; -{ - struct socket *so = tp->t_inpcb->inp_socket; - - if (TCPS_HAVERCVDSYN(tp->t_state)) { - tp->t_state = TCPS_CLOSED; - (void) tcp_output(tp); - tcpstat.tcps_drops++; - } else - tcpstat.tcps_conndrops++; - if (errno == ETIMEDOUT && tp->t_softerror) - errno = tp->t_softerror; - so->so_error = errno; - return (tcp_close(tp)); -} - -/* - * Close a TCP control block: - * discard all space held by the tcp - * discard internet protocol block - * wake up any sleepers - */ -struct tcpcb * -tcp_close(tp) - register struct tcpcb *tp; -{ - register struct tcpiphdr *t; - struct inpcb *inp = tp->t_inpcb; - struct socket *so = inp->inp_socket; - register struct mbuf *m; -#ifdef RTV_RTT - register struct rtentry *rt; - - /* - * If we got enough samples through the srtt filter, - * save the rtt and rttvar in the routing entry. - * 'Enough' is arbitrarily defined as the 16 samples. - * 16 samples is enough for the srtt filter to converge - * to within 5% of the correct value; fewer samples and - * we could save a very bogus rtt. - * - * Don't update the default route's characteristics and don't - * update anything that the user "locked". - */ - if (tp->t_rttupdated >= 16 && - (rt = inp->inp_route.ro_rt) && - ((struct sockaddr_in *)rt_key(rt))->sin_addr.s_addr != INADDR_ANY) { - register u_long i = 0; - - if ((rt->rt_rmx.rmx_locks & RTV_RTT) == 0) { - i = tp->t_srtt * - (RTM_RTTUNIT / (PR_SLOWHZ * TCP_RTT_SCALE)); - if (rt->rt_rmx.rmx_rtt && i) - /* - * filter this update to half the old & half - * the new values, converting scale. - * See route.h and tcp_var.h for a - * description of the scaling constants. - */ - rt->rt_rmx.rmx_rtt = - (rt->rt_rmx.rmx_rtt + i) / 2; - else - rt->rt_rmx.rmx_rtt = i; - tcpstat.tcps_cachedrtt++; - } - if ((rt->rt_rmx.rmx_locks & RTV_RTTVAR) == 0) { - i = tp->t_rttvar * - (RTM_RTTUNIT / (PR_SLOWHZ * TCP_RTTVAR_SCALE)); - if (rt->rt_rmx.rmx_rttvar && i) - rt->rt_rmx.rmx_rttvar = - (rt->rt_rmx.rmx_rttvar + i) / 2; - else - rt->rt_rmx.rmx_rttvar = i; - tcpstat.tcps_cachedrttvar++; - } - /* - * update the pipelimit (ssthresh) if it has been updated - * already or if a pipesize was specified & the threshhold - * got below half the pipesize. I.e., wait for bad news - * before we start updating, then update on both good - * and bad news. - */ - if (((rt->rt_rmx.rmx_locks & RTV_SSTHRESH) == 0 && - ((i = tp->snd_ssthresh) != 0) && rt->rt_rmx.rmx_ssthresh) || - i < (rt->rt_rmx.rmx_sendpipe / 2)) { - /* - * convert the limit from user data bytes to - * packets then to packet data bytes. - */ - i = (i + tp->t_maxseg / 2) / tp->t_maxseg; - if (i < 2) - i = 2; - i *= (u_long)(tp->t_maxseg + sizeof (struct tcpiphdr)); - if (rt->rt_rmx.rmx_ssthresh) - rt->rt_rmx.rmx_ssthresh = - (rt->rt_rmx.rmx_ssthresh + i) / 2; - else - rt->rt_rmx.rmx_ssthresh = i; - tcpstat.tcps_cachedssthresh++; - } - } -#endif /* RTV_RTT */ - /* free the reassembly queue, if any */ - t = tp->seg_next; - while (t != (struct tcpiphdr *)tp) { - t = (struct tcpiphdr *)t->ti_next; - m = REASS_MBUF((struct tcpiphdr *)t->ti_prev); - remque(t->ti_prev); - m_freem(m); - } - if (tp->t_template) - (void) m_free(dtom(tp->t_template)); - free(tp, M_PCB); - inp->inp_ppcb = 0; - soisdisconnected(so); - in_pcbdetach(inp); - tcpstat.tcps_closed++; - return ((struct tcpcb *)0); -} - -void -tcp_drain() -{ - -} - -/* - * Notify a tcp user of an asynchronous error; - * store error as soft error, but wake up user - * (for now, won't do anything until can select for soft error). - */ -void -tcp_notify(inp, error) - struct inpcb *inp; - int error; -{ - register struct tcpcb *tp = (struct tcpcb *)inp->inp_ppcb; - register struct socket *so = inp->inp_socket; - - /* - * Ignore some errors if we are hooked up. - * If connection hasn't completed, has retransmitted several times, - * and receives a second error, give up now. This is better - * than waiting a long time to establish a connection that - * can never complete. - */ - if (tp->t_state == TCPS_ESTABLISHED && - (error == EHOSTUNREACH || error == ENETUNREACH || - error == EHOSTDOWN)) { - return; - } else if (tp->t_state < TCPS_ESTABLISHED && tp->t_rxtshift > 3 && - tp->t_softerror) - so->so_error = error; - else - tp->t_softerror = error; - wakeup( so, (caddr_t) &so->so_timeo); - sorwakeup(so); - sowwakeup(so); -} - -void -tcp_ctlinput(cmd, sa, ip) - int cmd; - struct sockaddr *sa; - register struct ip *ip; -{ - register struct tcphdr *th; - void (*notify) __P((struct inpcb *, int)) = tcp_notify; - - if (cmd == PRC_QUENCH) - notify = tcp_quench; -#if 1 - else if (cmd == PRC_MSGSIZE) - notify = tcp_mtudisc; -#endif - else if (!PRC_IS_REDIRECT(cmd) && - ((unsigned)cmd > PRC_NCMDS || inetctlerrmap[cmd] == 0)) - return; - if (ip) { - th = (struct tcphdr *)((caddr_t)ip + (ip->ip_hl << 2)); - in_pcbnotify(&tcb, sa, th->th_dport, ip->ip_src, th->th_sport, - cmd, notify); - } else - in_pcbnotify(&tcb, sa, 0, zeroin_addr, 0, cmd, notify); -} - -/* - * When a source quench is received, close congestion window - * to one segment. We will gradually open it again as we proceed. - */ -void -tcp_quench(inp, errno) - struct inpcb *inp; - int errno; -{ - struct tcpcb *tp = intotcpcb(inp); - - if (tp) - tp->snd_cwnd = tp->t_maxseg; -} - -#if 1 -/* - * When `need fragmentation' ICMP is received, update our idea of the MSS - * based on the new value in the route. Also nudge TCP to send something, - * since we know the packet we just sent was dropped. - * This duplicates some code in the tcp_mss() function in tcp_input.c. - */ -void -tcp_mtudisc(inp, errno) - struct inpcb *inp; - int errno; -{ - struct tcpcb *tp = intotcpcb(inp); - struct rtentry *rt; - struct rmxp_tao *taop; - struct socket *so = inp->inp_socket; - int offered; - int mss; - - if (tp) { - rt = tcp_rtlookup(inp); - if (!rt || !rt->rt_rmx.rmx_mtu) { - tp->t_maxopd = tp->t_maxseg = tcp_mssdflt; - return; - } - taop = rmx_taop(rt->rt_rmx); - offered = taop->tao_mssopt; - mss = rt->rt_rmx.rmx_mtu - sizeof(struct tcpiphdr); - if (offered) - mss = min(mss, offered); - /* - * XXX - The above conditional probably violates the TCP - * spec. The problem is that, since we don't know the - * other end's MSS, we are supposed to use a conservative - * default. But, if we do that, then MTU discovery will - * never actually take place, because the conservative - * default is much less than the MTUs typically seen - * on the Internet today. For the moment, we'll sweep - * this under the carpet. - * - * The conservative default might not actually be a problem - * if the only case this occurs is when sending an initial - * SYN with options and data to a host we've never talked - * to before. Then, they will reply with an MSS value which - * will get recorded and the new parameters should get - * recomputed. For Further Study. - */ - if (tp->t_maxopd <= mss) - return; - tp->t_maxopd = mss; - - if ((tp->t_flags & (TF_REQ_TSTMP|TF_NOOPT)) == TF_REQ_TSTMP && - (tp->t_flags & TF_RCVD_TSTMP) == TF_RCVD_TSTMP) - mss -= TCPOLEN_TSTAMP_APPA; - if ((tp->t_flags & (TF_REQ_CC|TF_NOOPT)) == TF_REQ_CC && - (tp->t_flags & TF_RCVD_CC) == TF_RCVD_CC) - mss -= TCPOLEN_CC_APPA; -#if (MCLBYTES & (MCLBYTES - 1)) == 0 - if (mss > MCLBYTES) - mss &= ~(MCLBYTES-1); -#else - if (mss > MCLBYTES) - mss = mss / MCLBYTES * MCLBYTES; -#endif - if (so->so_snd.sb_hiwat < mss) - mss = so->so_snd.sb_hiwat; - - tp->t_maxseg = mss; - - tcpstat.tcps_mturesent++; - tp->t_rtt = 0; - tp->snd_nxt = tp->snd_una; - tcp_output(tp); - } -} -#endif - -/* - * Look-up the routing entry to the peer of this inpcb. If no route - * is found and it cannot be allocated the return NULL. This routine - * is called by TCP routines that access the rmx structure and by tcp_mss - * to get the interface MTU. - */ -struct rtentry * -tcp_rtlookup(inp) - struct inpcb *inp; -{ -#ifndef __REACTOS__ - struct route *ro; - struct rtentry *rt; - - ro = &inp->inp_route; - rt = ro->ro_rt; - if (rt == NULL || !(rt->rt_flags & RTF_UP)) { - /* No route yet, so try to acquire one */ - if (inp->inp_faddr.s_addr != INADDR_ANY) { - ro->ro_dst.sa_family = AF_INET; - ro->ro_dst.sa_len = sizeof(ro->ro_dst); - ((struct sockaddr_in *) &ro->ro_dst)->sin_addr = - inp->inp_faddr; - rtalloc(ro); - rt = ro->ro_rt; - } - } - return rt; -#else - return NULL; -#endif -} - -/* - * Return a pointer to the cached information about the remote host. - * The cached information is stored in the protocol specific part of - * the route metrics. - */ -struct rmxp_tao * -tcp_gettaocache(inp) - struct inpcb *inp; -{ - struct rtentry *rt = tcp_rtlookup(inp); - - /* Make sure this is a host route and is up. */ - if (rt == NULL || - (rt->rt_flags & (RTF_UP|RTF_HOST)) != (RTF_UP|RTF_HOST)) - return NULL; - - return rmx_taop(rt->rt_rmx); -} - -/* - * Clear all the TAO cache entries, called from tcp_init. - * - * XXX - * This routine is just an empty one, because we assume that the routing - * routing tables are initialized at the same time when TCP, so there is - * nothing in the cache left over. - */ -static void -tcp_cleartaocache(void) -{ } diff --git a/lib/drivers/oskittcp/oskittcp/tcp_timer.c b/lib/drivers/oskittcp/oskittcp/tcp_timer.c deleted file mode 100644 index dd2ff8d276c..00000000000 --- a/lib/drivers/oskittcp/oskittcp/tcp_timer.c +++ /dev/null @@ -1,358 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1988, 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)tcp_timer.c 8.1 (Berkeley) 6/10/93 - */ - -#ifndef TUBA_INCLUDE -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef TCPDEBUG -#include -#endif - -int tcp_keepidle = TCPTV_KEEP_IDLE; -int tcp_keepintvl = TCPTV_KEEPINTVL; -int tcp_keepinit = TCPTV_KEEP_INIT; -int tcp_maxidle; -int tcp_maxpersistidle = TCPTV_KEEP_IDLE; -int tcp_totbackoff = 511; -#endif /* TUBA_INCLUDE */ -/* - * Fast timeout routine for processing delayed acks - */ -void -tcp_fasttimo() -{ - register struct inpcb *inp; - register struct tcpcb *tp; - int s; - - s = splnet(); - - for (inp = tcb.lh_first; inp != NULL; inp = inp->inp_list.le_next) { - if ((tp = (struct tcpcb *)inp->inp_ppcb) && - (tp->t_flags & TF_DELACK)) { - tp->t_flags &= ~TF_DELACK; - tp->t_flags |= TF_ACKNOW; - tcpstat.tcps_delack++; - (void) tcp_output(tp); - } - } - splx(s); -} - -/* - * Tcp protocol timeout routine called every 500 ms. - * Updates the timers in all active tcb's and - * causes finite state machine actions if timers expire. - */ -void -tcp_slowtimo() -{ - register struct inpcb *ip, *ipnxt; - register struct tcpcb *tp; - register int i; - int s; -#ifdef TCPDEBUG - int ostate; -#endif - - s = splnet(); - - tcp_maxidle = TCPTV_KEEPCNT * tcp_keepintvl; - - ip = tcb.lh_first; - if (ip == NULL) { - splx(s); - return; - } - /* - * Search through tcb's and update active timers. - */ - for (; ip != NULL; ip = ipnxt) { - ipnxt = ip->inp_list.le_next; - tp = intotcpcb(ip); - if (tp == 0) - continue; - for (i = 0; i < TCPT_NTIMERS; i++) { - if (tp->t_timer[i] && --tp->t_timer[i] == 0) { -#ifdef TCPDEBUG - ostate = tp->t_state; -#endif - tp = tcp_timers(tp, i); - if (tp == NULL) - goto tpgone; -#ifdef TCPDEBUG - if (tp->t_inpcb->inp_socket->so_options - & SO_DEBUG) - tcp_trace(TA_USER, ostate, tp, - (struct tcpiphdr *)0, - PRU_SLOWTIMO); -#endif - } - } - tp->t_idle++; - tp->t_duration++; - if (tp->t_rtt) - tp->t_rtt++; -tpgone: - ; - } - tcp_iss += TCP_ISSINCR/PR_SLOWHZ; /* increment iss */ -#ifdef TCP_COMPAT_42 - if ((int)tcp_iss < 0) - tcp_iss = 0; /* XXX */ -#endif - tcp_now++; /* for timestamps */ - splx(s); -} -#ifndef TUBA_INCLUDE - -/* - * Cancel all timers for TCP tp. - */ -void -tcp_canceltimers(tp) - struct tcpcb *tp; -{ - register int i; - - for (i = 0; i < TCPT_NTIMERS; i++) - tp->t_timer[i] = 0; -} - -int tcp_backoff[TCP_MAXRXTSHIFT + 1] = - { 1, 2, 4, 8, 16, 32, 64, 64, 64, 64, 64, 64, 64 }; - -/* - * TCP timer processing. - */ -struct tcpcb * -tcp_timers(tp, timer) - register struct tcpcb *tp; - int timer; -{ - register int rexmt; - - switch (timer) { - - /* - * 2 MSL timeout in shutdown went off. If we're closed but - * still waiting for peer to close and connection has been idle - * too long, or if 2MSL time is up from TIME_WAIT, delete connection - * control block. Otherwise, check again in a bit. - */ - case TCPT_2MSL: - if (tp->t_state != TCPS_TIME_WAIT && - tp->t_idle <= tcp_maxidle) - tp->t_timer[TCPT_2MSL] = tcp_keepintvl; - else - tp = tcp_close(tp); - break; - - /* - * Retransmission timer went off. Message has not - * been acked within retransmit interval. Back off - * to a longer retransmit interval and retransmit one segment. - */ - case TCPT_REXMT: - if (++tp->t_rxtshift > TCP_MAXRXTSHIFT) { - tp->t_rxtshift = TCP_MAXRXTSHIFT; - tcpstat.tcps_timeoutdrop++; - tp = tcp_drop(tp, tp->t_softerror ? - tp->t_softerror : ETIMEDOUT); - break; - } - tcpstat.tcps_rexmttimeo++; - rexmt = TCP_REXMTVAL(tp) * tcp_backoff[tp->t_rxtshift]; - TCPT_RANGESET(tp->t_rxtcur, rexmt, - tp->t_rttmin, TCPTV_REXMTMAX); - tp->t_timer[TCPT_REXMT] = tp->t_rxtcur; - /* - * If losing, let the lower level know and try for - * a better route. Also, if we backed off this far, - * our srtt estimate is probably bogus. Clobber it - * so we'll take the next rtt measurement as our srtt; - * move the current srtt into rttvar to keep the current - * retransmit times until then. - */ - if (tp->t_rxtshift > TCP_MAXRXTSHIFT / 4) { - in_losing(tp->t_inpcb); - tp->t_rttvar += (tp->t_srtt >> TCP_RTT_SHIFT); - tp->t_srtt = 0; - } - tp->snd_nxt = tp->snd_una; - /* - * Force a segment to be sent. - */ - tp->t_flags |= TF_ACKNOW; - /* - * If timing a segment in this window, stop the timer. - */ - tp->t_rtt = 0; - /* - * Close the congestion window down to one segment - * (we'll open it by one segment for each ack we get). - * Since we probably have a window's worth of unacked - * data accumulated, this "slow start" keeps us from - * dumping all that data as back-to-back packets (which - * might overwhelm an intermediate gateway). - * - * There are two phases to the opening: Initially we - * open by one mss on each ack. This makes the window - * size increase exponentially with time. If the - * window is larger than the path can handle, this - * exponential growth results in dropped packet(s) - * almost immediately. To get more time between - * drops but still "push" the network to take advantage - * of improving conditions, we switch from exponential - * to linear window opening at some threshhold size. - * For a threshhold, we use half the current window - * size, truncated to a multiple of the mss. - * - * (the minimum cwnd that will give us exponential - * growth is 2 mss. We don't allow the threshhold - * to go below this.) - */ - { - u_int win = min(tp->snd_wnd, tp->snd_cwnd) / 2 / tp->t_maxseg; - if (win < 2) - win = 2; - tp->snd_cwnd = tp->t_maxseg; - tp->snd_ssthresh = win * tp->t_maxseg; - tp->t_dupacks = 0; - } - (void) tcp_output(tp); - break; - - /* - * Persistance timer into zero window. - * Force a byte to be output, if possible. - */ - case TCPT_PERSIST: - tcpstat.tcps_persisttimeo++; - /* - * Hack: if the peer is dead/unreachable, we do not - * time out if the window is closed. After a full - * backoff, drop the connection if the idle time - * (no responses to probes) reaches the maximum - * backoff that we would use if retransmitting. - */ - if (tp->t_rxtshift == TCP_MAXRXTSHIFT) { - u_long maxidle = TCP_REXMTVAL(tp); - if (maxidle < tp->t_rttmin) - maxidle = tp->t_rttmin; - maxidle *= tcp_totbackoff; - if (tp->t_idle >= tcp_maxpersistidle || - tp->t_idle >= maxidle) { - tcpstat.tcps_persistdrop++; - tp = tcp_drop(tp, ETIMEDOUT); - break; - } - } - tcp_setpersist(tp); - tp->t_force = 1; - (void) tcp_output(tp); - tp->t_force = 0; - break; - - /* - * Keep-alive timer went off; send something - * or drop connection if idle for too long. - */ - case TCPT_KEEP: - tcpstat.tcps_keeptimeo++; - if (tp->t_state < TCPS_ESTABLISHED) - goto dropit; - if (tp->t_inpcb->inp_socket->so_options & SO_KEEPALIVE && - tp->t_state <= TCPS_CLOSING) { - if (tp->t_idle >= tcp_keepidle + tcp_maxidle) - goto dropit; - /* - * Send a packet designed to force a response - * if the peer is up and reachable: - * either an ACK if the connection is still alive, - * or an RST if the peer has closed the connection - * due to timeout or reboot. - * Using sequence number tp->snd_una-1 - * causes the transmitted zero-length segment - * to lie outside the receive window; - * by the protocol spec, this requires the - * correspondent TCP to respond. - */ - tcpstat.tcps_keepprobe++; -#ifdef TCP_COMPAT_42 - /* - * The keepalive packet must have nonzero length - * to get a 4.2 host to respond. - */ - tcp_respond(tp, tp->t_template, (struct mbuf *)NULL, - tp->rcv_nxt - 1, tp->snd_una - 1, 0); -#else - tcp_respond(tp, tp->t_template, (struct mbuf *)NULL, - tp->rcv_nxt, tp->snd_una - 1, 0); -#endif - tp->t_timer[TCPT_KEEP] = tcp_keepintvl; - } else - tp->t_timer[TCPT_KEEP] = tcp_keepidle; - break; - dropit: - tcpstat.tcps_keepdrops++; - tp = tcp_drop(tp, ETIMEDOUT); - break; - } - return (tp); -} -#endif /* TUBA_INCLUDE */ diff --git a/lib/drivers/oskittcp/oskittcp/tcp_usrreq.c b/lib/drivers/oskittcp/oskittcp/tcp_usrreq.c deleted file mode 100644 index c283b2068fb..00000000000 --- a/lib/drivers/oskittcp/oskittcp/tcp_usrreq.c +++ /dev/null @@ -1,775 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1988, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * From: @(#)tcp_usrreq.c 8.2 (Berkeley) 1/3/94 - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef TCPDEBUG -#include -#endif - -/* - * TCP protocol interface to socket abstraction. - */ -extern char *tcpstates[]; - -/* - * Process a TCP user request for TCP tb. If this is a send request - * then m is the mbuf chain of send data. If this is a timer expiration - * (called from the software clock routine), then timertype tells which timer. - */ -/*ARGSUSED*/ -int -tcp_usrreq(so, req, m, nam, control) - struct socket *so; - int req; - struct mbuf *m, *nam, *control; -{ - register struct inpcb *inp; - register struct tcpcb *tp = 0; - struct sockaddr_in *sinp; - int s; - int error = 0; -#ifdef TCPDEBUG - int ostate; -#endif - - if (req == PRU_CONTROL) - return (in_control(so, (u_long)m, (caddr_t)nam, - (struct ifnet *)control)); - if (control && control->m_len) { - m_freem(control); - if (m) - m_freem(m); - return (EINVAL); - } - - s = splnet(); - inp = sotoinpcb(so); - /* - * When a TCP is attached to a socket, then there will be - * a (struct inpcb) pointed at by the socket, and this - * structure will point at a subsidary (struct tcpcb). - */ - if (inp == 0 && req != PRU_ATTACH) { - splx(s); -#if 0 - /* - * The following corrects an mbuf leak under rare - * circumstances, but has not been fully tested. - */ - if (m && req != PRU_SENSE) - m_freem(m); -#else - /* safer version of fix for mbuf leak */ - if (m && (req == PRU_SEND || req == PRU_SENDOOB)) - m_freem(m); -#endif - return (EINVAL); /* XXX */ - } - if (inp) { - tp = intotcpcb(inp); - /* WHAT IF TP IS 0? */ -#ifdef KPROF - tcp_acounts[tp->t_state][req]++; -#endif -#ifdef TCPDEBUG - ostate = tp->t_state; - } else - ostate = 0; -#else /* TCPDEBUG */ - } -#endif /* TCPDEBUG */ - - switch (req) { - - /* - * TCP attaches to socket via PRU_ATTACH, reserving space, - * and an internet control block. - */ - case PRU_ATTACH: - if (inp) { - error = EISCONN; - break; - } - error = tcp_attach(so); - if (error) - break; - if ((so->so_options & SO_LINGER) && so->so_linger == 0) - so->so_linger = TCP_LINGERTIME * hz; - tp = sototcpcb(so); - break; - - /* - * PRU_DETACH detaches the TCP protocol from the socket. - * If the protocol state is non-embryonic, then can't - * do this directly: have to initiate a PRU_DISCONNECT, - * which may finish later; embryonic TCB's can just - * be discarded here. - */ - case PRU_DETACH: - if (tp->t_state > TCPS_LISTEN) - tp = tcp_disconnect(tp); - else - tp = tcp_close(tp); - break; - - /* - * Give the socket an address. - */ - case PRU_BIND: - /* - * Must check for multicast addresses and disallow binding - * to them. - */ - sinp = mtod(nam, struct sockaddr_in *); - if (sinp->sin_family == AF_INET && - IN_MULTICAST(ntohl(sinp->sin_addr.s_addr))) { - error = EAFNOSUPPORT; - break; - } - error = in_pcbbind(inp, nam); - if (error) - break; - break; - - /* - * Prepare to accept connections. - */ - case PRU_LISTEN: - if (inp->inp_lport == 0) - error = in_pcbbind(inp, NULL); - if (error == 0) - tp->t_state = TCPS_LISTEN; - break; - - /* - * Initiate connection to peer. - * Create a template for use in transmissions on this connection. - * Enter SYN_SENT state, and mark socket as connecting. - * Start keep-alive timer, and seed output sequence space. - * Send initial segment on connection. - */ - case PRU_CONNECT: - /* - * Must disallow TCP ``connections'' to multicast addresses. - */ - sinp = mtod(nam, struct sockaddr_in *); - if (sinp->sin_family == AF_INET - && IN_MULTICAST(ntohl(sinp->sin_addr.s_addr))) { - error = EAFNOSUPPORT; - break; - } - - if ((error = tcp_connect(tp, nam)) != 0) - break; - error = tcp_output(tp); - break; - - /* - * Create a TCP connection between two sockets. - */ - case PRU_CONNECT2: - error = EOPNOTSUPP; - break; - - /* - * Initiate disconnect from peer. - * If connection never passed embryonic stage, just drop; - * else if don't need to let data drain, then can just drop anyways, - * else have to begin TCP shutdown process: mark socket disconnecting, - * drain unread data, state switch to reflect user close, and - * send segment (e.g. FIN) to peer. Socket will be really disconnected - * when peer sends FIN and acks ours. - * - * SHOULD IMPLEMENT LATER PRU_CONNECT VIA REALLOC TCPCB. - */ - case PRU_DISCONNECT: - tp = tcp_disconnect(tp); - break; - - /* - * Accept a connection. Essentially all the work is - * done at higher levels; just return the address - * of the peer, storing through addr. - */ - case PRU_ACCEPT: - in_setpeeraddr(inp, nam); - break; - - /* - * Mark the connection as being incapable of further output. - */ - case PRU_SHUTDOWN: - socantsendmore(so); - tp = tcp_usrclosed(tp); - if (tp) - error = tcp_output(tp); - break; - - /* - * After a receive, possibly send window update to peer. - */ - case PRU_RCVD: - (void) tcp_output(tp); - break; - - /* - * Do a send by putting data in output queue and updating urgent - * marker if URG set. Possibly send more data. - */ - case PRU_SEND_EOF: - case PRU_SEND: - sbappend(&so->so_snd, m); - if (nam && tp->t_state < TCPS_SYN_SENT) { - /* - * Do implied connect if not yet connected, - * initialize window to default value, and - * initialize maxseg/maxopd using peer's cached - * MSS. - */ - error = tcp_connect(tp, nam); - if (error) - break; - tp->snd_wnd = TTCP_CLIENT_SND_WND; - tcp_mss(tp, -1); - } - - if (req == PRU_SEND_EOF) { - /* - * Close the send side of the connection after - * the data is sent. - */ - socantsendmore(so); - tp = tcp_usrclosed(tp); - } - if (tp != NULL) - error = tcp_output(tp); - break; - - /* - * Abort the TCP. - */ - case PRU_ABORT: - tp = tcp_drop(tp, ECONNABORTED); - break; - - case PRU_SENSE: - ((struct stat *) m)->st_blksize = so->so_snd.sb_hiwat; - (void) splx(s); - return (0); - - case PRU_RCVOOB: - if ((so->so_oobmark == 0 && - (so->so_state & SS_RCVATMARK) == 0) || - so->so_options & SO_OOBINLINE || - tp->t_oobflags & TCPOOB_HADDATA) { - error = EINVAL; - break; - } - if ((tp->t_oobflags & TCPOOB_HAVEDATA) == 0) { - error = EWOULDBLOCK; - break; - } - m->m_len = 1; - *mtod(m, caddr_t) = tp->t_iobc; - if (((int)nam & MSG_PEEK) == 0) - tp->t_oobflags ^= (TCPOOB_HAVEDATA | TCPOOB_HADDATA); - break; - - case PRU_SENDOOB: - if (sbspace(&so->so_snd) < -512) { - m_freem(m); - error = ENOBUFS; - break; - } - /* - * According to RFC961 (Assigned Protocols), - * the urgent pointer points to the last octet - * of urgent data. We continue, however, - * to consider it to indicate the first octet - * of data past the urgent section. - * Otherwise, snd_up should be one lower. - */ - sbappend(&so->so_snd, m); - if (nam && tp->t_state < TCPS_SYN_SENT) { - /* - * Do implied connect if not yet connected, - * initialize window to default value, and - * initialize maxseg/maxopd using peer's cached - * MSS. - */ - error = tcp_connect(tp, nam); - if (error) - break; - tp->snd_wnd = TTCP_CLIENT_SND_WND; - tcp_mss(tp, -1); - } - tp->snd_up = tp->snd_una + so->so_snd.sb_cc; - tp->t_force = 1; - error = tcp_output(tp); - tp->t_force = 0; - break; - - case PRU_SOCKADDR: - in_setsockaddr(inp, nam); - break; - - case PRU_PEERADDR: - in_setpeeraddr(inp, nam); - break; - - /* - * TCP slow timer went off; going through this - * routine for tracing's sake. - */ - case PRU_SLOWTIMO: - tp = tcp_timers(tp, (int)nam); -#ifdef TCPDEBUG - req |= (int)nam << 8; /* for debug's sake */ -#endif - break; - - default: - panic("tcp_usrreq"); - } -#ifdef TCPDEBUG - if (tp && (so->so_options & SO_DEBUG)) - tcp_trace(TA_USER, ostate, tp, (struct tcpiphdr *)0, req); -#endif - splx(s); - return (error); -} - -/* - * Common subroutine to open a TCP connection to remote host specified - * by struct sockaddr_in in mbuf *nam. Call in_pcbbind to assign a local - * port number if needed. Call in_pcbladdr to do the routing and to choose - * a local host address (interface). If there is an existing incarnation - * of the same connection in TIME-WAIT state and if the remote host was - * sending CC options and if the connection duration was < MSL, then - * truncate the previous TIME-WAIT state and proceed. - * Initialize connection parameters and enter SYN-SENT state. - */ -int -tcp_connect(tp, nam) - register struct tcpcb *tp; - struct mbuf *nam; -{ - struct inpcb *inp = tp->t_inpcb, *oinp; - struct socket *so = inp->inp_socket; - struct tcpcb *otp; - struct sockaddr_in *sin = mtod(nam, struct sockaddr_in *); - struct sockaddr_in *ifaddr; - int error; - struct rmxp_tao *taop; - struct rmxp_tao tao_noncached; - - OS_DbgPrint(OSK_MID_TRACE,("Called\n")); - - if (inp->inp_lport == 0) { - error = in_pcbbind(inp, NULL); - if (error) - return error; - } - - /* - * Cannot simply call in_pcbconnect, because there might be an - * earlier incarnation of this same connection still in - * TIME_WAIT state, creating an ADDRINUSE error. - */ - error = in_pcbladdr(inp, nam, &ifaddr); - if (error) { - OS_DbgPrint(OSK_MID_TRACE,("leaving %d\n", error)); - return error; - } - oinp = in_pcblookup(inp->inp_pcbinfo->listhead, - sin->sin_addr, sin->sin_port, - inp->inp_laddr.s_addr != INADDR_ANY ? inp->inp_laddr - : ifaddr->sin_addr, - inp->inp_lport, 0); - if (oinp) { - if (oinp != inp && (otp = intotcpcb(oinp)) != NULL && - otp->t_state == TCPS_TIME_WAIT && - otp->t_duration < TCPTV_MSL && - (otp->t_flags & TF_RCVD_CC)) - otp = tcp_close(otp); - else { - OS_DbgPrint(OSK_MID_TRACE,("leaving EADDRINUSE\n")); - return EADDRINUSE; - } - } - if (inp->inp_laddr.s_addr == INADDR_ANY) - inp->inp_laddr = ifaddr->sin_addr; - inp->inp_faddr = sin->sin_addr; - inp->inp_fport = sin->sin_port; - in_pcbrehash(inp); - - tp->t_template = tcp_template(tp); - if (tp->t_template == 0) { - in_pcbdisconnect(inp); - OS_DbgPrint(OSK_MID_TRACE,("Leaving ENOBUFS\n")); - return ENOBUFS; - } - - /* Compute window scaling to request. */ - while (tp->request_r_scale < TCP_MAX_WINSHIFT && - (TCP_MAXWIN << tp->request_r_scale) < so->so_rcv.sb_hiwat) - tp->request_r_scale++; - - soisconnecting(so); - tcpstat.tcps_connattempt++; - tp->t_state = TCPS_SYN_SENT; - tp->t_timer[TCPT_KEEP] = tcp_keepinit; - tp->iss = tcp_iss; tcp_iss += TCP_ISSINCR/2; - tcp_sendseqinit(tp); - - /* - * Generate a CC value for this connection and - * check whether CC or CCnew should be used. - */ - if ((taop = tcp_gettaocache(tp->t_inpcb)) == NULL) { - taop = &tao_noncached; - bzero(taop, sizeof(*taop)); - } - - tp->cc_send = CC_INC(tcp_ccgen); - if (taop->tao_ccsent != 0 && - CC_GEQ(tp->cc_send, taop->tao_ccsent)) { - taop->tao_ccsent = tp->cc_send; - } else { - taop->tao_ccsent = 0; - tp->t_flags |= TF_SENDCCNEW; - } - - OS_DbgPrint(OSK_MID_TRACE,("Leaving 0\n")); - return 0; -} - -int -tcp_ctloutput(op, so, level, optname, mp) - int op; - struct socket *so; - int level, optname; - struct mbuf **mp; -{ - int error = 0, s; - struct inpcb *inp; - register struct tcpcb *tp; - register struct mbuf *m; - register int i; - - s = splnet(); - inp = sotoinpcb(so); - if (inp == NULL) { - splx(s); - if (op == PRCO_SETOPT && *mp) - (void) m_free(*mp); - return (ECONNRESET); - } - if (level != IPPROTO_TCP) { - error = ip_ctloutput(op, so, level, optname, mp); - splx(s); - return (error); - } - tp = intotcpcb(inp); - - switch (op) { - - case PRCO_SETOPT: - m = *mp; - switch (optname) { - - case TCP_NODELAY: - if (m == NULL || m->m_len < sizeof (int)) - error = EINVAL; - else if (*mtod(m, int *)) - tp->t_flags |= TF_NODELAY; - else - tp->t_flags &= ~TF_NODELAY; - break; - - case TCP_MAXSEG: - if (m && (i = *mtod(m, int *)) > 0 && i <= tp->t_maxseg) - tp->t_maxseg = i; - else - error = EINVAL; - break; - - case TCP_NOOPT: - if (m == NULL || m->m_len < sizeof (int)) - error = EINVAL; - else if (*mtod(m, int *)) - tp->t_flags |= TF_NOOPT; - else - tp->t_flags &= ~TF_NOOPT; - break; - - case TCP_NOPUSH: - if (m == NULL || m->m_len < sizeof (int)) - error = EINVAL; - else if (*mtod(m, int *)) - tp->t_flags |= TF_NOPUSH; - else - tp->t_flags &= ~TF_NOPUSH; - break; - - default: - error = ENOPROTOOPT; - break; - } - if (m) - (void) m_free(m); - break; - - case PRCO_GETOPT: - *mp = m = m_get(M_WAIT, MT_SOOPTS); - m->m_len = sizeof(int); - - switch (optname) { - case TCP_NODELAY: - *mtod(m, int *) = tp->t_flags & TF_NODELAY; - break; - case TCP_MAXSEG: - *mtod(m, int *) = tp->t_maxseg; - break; - case TCP_NOOPT: - *mtod(m, int *) = tp->t_flags & TF_NOOPT; - break; - case TCP_NOPUSH: - *mtod(m, int *) = tp->t_flags & TF_NOPUSH; - break; - default: - error = ENOPROTOOPT; - break; - } - break; - } - splx(s); - return (error); -} - -/* - * tcp_sendspace and tcp_recvspace are the default send and receive window - * sizes, respectively. These are obsolescent (this information should - * be set by the route). - */ -u_long tcp_sendspace = 1024*16; -u_long tcp_recvspace = 1024*16; - -/* - * Attach TCP protocol to socket, allocating - * internet protocol control block, tcp control block, - * bufer space, and entering LISTEN state if to accept connections. - */ -int -tcp_attach(so) - struct socket *so; -{ - register struct tcpcb *tp; - struct inpcb *inp; - int error; - - if (so->so_snd.sb_hiwat == 0 || so->so_rcv.sb_hiwat == 0) { - error = soreserve(so, tcp_sendspace, tcp_recvspace); - if (error) - return (error); - } - error = in_pcballoc(so, &tcbinfo); - if (error) - return (error); - inp = sotoinpcb(so); - tp = tcp_newtcpcb(inp); - if (tp == 0) { - int nofd = so->so_state & SS_NOFDREF; /* XXX */ - - so->so_state &= ~SS_NOFDREF; /* don't free the socket yet */ - in_pcbdetach(inp); - so->so_state |= nofd; - return (ENOBUFS); - } - tp->t_state = TCPS_CLOSED; - return (0); -} - -/* - * Initiate (or continue) disconnect. - * If embryonic state, just send reset (once). - * If in ``let data drain'' option and linger null, just drop. - * Otherwise (hard), mark socket disconnecting and drop - * current input data; switch states based on user close, and - * send segment to peer (with FIN). - */ -struct tcpcb * -tcp_disconnect(tp) - register struct tcpcb *tp; -{ - struct socket *so = tp->t_inpcb->inp_socket; - - if (tp->t_state < TCPS_ESTABLISHED) - tp = tcp_close(tp); - else if ((so->so_options & SO_LINGER) && so->so_linger == 0) - tp = tcp_drop(tp, 0); - else { - soisdisconnecting(so); - sbflush(&so->so_rcv); - tp = tcp_usrclosed(tp); - if (tp) - (void) tcp_output(tp); - } - return (tp); -} - -/* - * User issued close, and wish to trail through shutdown states: - * if never received SYN, just forget it. If got a SYN from peer, - * but haven't sent FIN, then go to FIN_WAIT_1 state to send peer a FIN. - * If already got a FIN from peer, then almost done; go to LAST_ACK - * state. In all other cases, have already sent FIN to peer (e.g. - * after PRU_SHUTDOWN), and just have to play tedious game waiting - * for peer to send FIN or not respond to keep-alives, etc. - * We can let the user exit from the close as soon as the FIN is acked. - */ -struct tcpcb * -tcp_usrclosed(tp) - register struct tcpcb *tp; -{ - - switch (tp->t_state) { - - case TCPS_CLOSED: - case TCPS_LISTEN: - tp->t_state = TCPS_CLOSED; - tp = tcp_close(tp); - break; - - case TCPS_SYN_SENT: - case TCPS_SYN_RECEIVED: - tp->t_flags |= TF_NEEDFIN; - break; - - case TCPS_ESTABLISHED: - tp->t_state = TCPS_FIN_WAIT_1; - break; - - case TCPS_CLOSE_WAIT: - tp->t_state = TCPS_LAST_ACK; - break; - } - if (tp && tp->t_state >= TCPS_FIN_WAIT_2) { - soisdisconnected(tp->t_inpcb->inp_socket); - /* To prevent the connection hanging in FIN_WAIT_2 forever. */ - if (tp->t_state == TCPS_FIN_WAIT_2) - tp->t_timer[TCPT_2MSL] = tcp_maxidle; - } - return (tp); -} - -/* - * Sysctl for tcp variables. - */ -int -tcp_sysctl(name, namelen, oldp, oldlenp, newp, newlen) - int *name; - u_int namelen; - void *oldp; - size_t *oldlenp; - void *newp; - size_t newlen; -{ - /* All sysctl names at this level are terminal. */ - if (namelen != 1) - return (ENOTDIR); - - switch (name[0]) { - case TCPCTL_DO_RFC1323: - return (sysctl_int(oldp, oldlenp, newp, newlen, - &tcp_do_rfc1323)); - case TCPCTL_DO_RFC1644: - return (sysctl_int(oldp, oldlenp, newp, newlen, - &tcp_do_rfc1644)); - case TCPCTL_MSSDFLT: - return (sysctl_int(oldp, oldlenp, newp, newlen, - &tcp_mssdflt)); - case TCPCTL_STATS: - return (sysctl_rdstruct(oldp, oldlenp, newp, &tcpstat, - sizeof tcpstat)); - case TCPCTL_RTTDFLT: - return (sysctl_int(oldp, oldlenp, newp, newlen, &tcp_rttdflt)); - case TCPCTL_KEEPIDLE: - return (sysctl_int(oldp, oldlenp, newp, newlen, - &tcp_keepidle)); - case TCPCTL_KEEPINTVL: - return (sysctl_int(oldp, oldlenp, newp, newlen, - &tcp_keepintvl)); - case TCPCTL_SENDSPACE: - return (sysctl_int(oldp, oldlenp, newp, newlen, - (int *)&tcp_sendspace)); /* XXX */ - case TCPCTL_RECVSPACE: - return (sysctl_int(oldp, oldlenp, newp, newlen, - (int *)&tcp_recvspace)); /* XXX */ - case TCPCTL_KEEPINIT: - return (sysctl_int(oldp, oldlenp, newp, newlen, - &tcp_keepinit)); - default: - return (ENOPROTOOPT); - } - /* NOTREACHED */ -} diff --git a/lib/drivers/oskittcp/oskittcp/uipc_domain.c b/lib/drivers/oskittcp/oskittcp/uipc_domain.c deleted file mode 100644 index 7ab1555b6f3..00000000000 --- a/lib/drivers/oskittcp/oskittcp/uipc_domain.c +++ /dev/null @@ -1,231 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)uipc_domain.c 8.2 (Berkeley) 10/18/93 - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -void pffasttimo __P((void *)); -void pfslowtimo __P((void *)); - -struct domain *domains; - -#define ADDDOMAIN(x) { \ - extern struct domain __CONCAT(x,domain); \ - __CONCAT(x,domain.dom_next) = domains; \ - domains = &__CONCAT(x,domain); \ -} - -extern struct linker_set domain_set; - -void -domaininit() -{ - register struct domain *dp, **dpp; - register struct protosw *pr; - - //printf("domaininit starting\n"); - - /* - * NB - local domain is always present. - */ - ADDDOMAIN(local); - ADDDOMAIN(inet); - - for (dpp = (struct domain **)domain_set.ls_items; *dpp; dpp++) { - //printf("(1) Domain %s counting\n", (**dpp).dom_name); - (**dpp).dom_next = domains; - domains = *dpp; - } - -/* - not in our sources -#ifdef ISDN - ADDDOMAIN(isdn); -#endif -*/ - for (dp = domains; dp; dp = dp->dom_next) { - //printf("(1) Domain %s initializing\n", dp->dom_name); - if (dp->dom_init) - (*dp->dom_init)(); - for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) { - //printf("Registering protocols for %s\n", dp->dom_name); - if (pr->pr_init) - (*pr->pr_init)(); - } - if( dp->dom_next && !dp->dom_next->dom_name ) - dp->dom_next = 0; - } - - if (max_linkhdr < 16) /* XXX */ - max_linkhdr = 16; - max_hdr = max_linkhdr + max_protohdr; - max_datalen = MHLEN - max_hdr; - timeout(pffasttimo, (void *)0, 1); - timeout(pfslowtimo, (void *)0, 1); - - //printf("Domaininit done\n"); -} - -struct protosw * -pffindtype(family, type) - int family, type; -{ - register struct domain *dp; - register struct protosw *pr; - - for (dp = domains; dp; dp = dp->dom_next) - if (dp->dom_family == family) - goto found; - return (0); -found: - for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) - if (pr->pr_type && pr->pr_type == type) - return (pr); - return (0); -} - -struct protosw * -pffindproto(family, protocol, type) - int family, protocol, type; -{ - register struct domain *dp; - register struct protosw *pr; - struct protosw *maybe = 0; - - if (family == 0) - return (0); - for (dp = domains; dp; dp = dp->dom_next) - if (dp->dom_family == family) - goto found; - return (0); -found: - for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) { - if ((pr->pr_protocol == protocol) && (pr->pr_type == type)) - return (pr); - - if (type == SOCK_RAW && pr->pr_type == SOCK_RAW && - pr->pr_protocol == 0 && maybe == (struct protosw *)0) - maybe = pr; - } - return (maybe); -} - -int -net_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p) - int *name; - u_int namelen; - void *oldp; - size_t *oldlenp; - void *newp; - size_t newlen; - struct proc *p; -{ - register struct domain *dp; - register struct protosw *pr; - int family, protocol; - - /* - * All sysctl names at this level are nonterminal; - * next two components are protocol family and protocol number, - * then at least one addition component. - */ - if (namelen < 3) - return (EISDIR); /* overloaded */ - family = name[0]; - protocol = name[1]; - - if (family == 0) - return (0); - for (dp = domains; dp; dp = dp->dom_next) - if (dp->dom_family == family) - goto found; - return (ENOPROTOOPT); -found: - for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) - if (pr->pr_protocol == protocol && pr->pr_sysctl) - return ((*pr->pr_sysctl)(name + 2, namelen - 2, - oldp, oldlenp, newp, newlen)); - return (ENOPROTOOPT); -} - -void -pfctlinput(cmd, sa) - int cmd; - struct sockaddr *sa; -{ - register struct domain *dp; - register struct protosw *pr; - - for (dp = domains; dp; dp = dp->dom_next) - for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) - if (pr->pr_ctlinput) - (*pr->pr_ctlinput)(cmd, sa, (caddr_t)0); -} - -void -pfslowtimo(arg) - void *arg; -{ - register struct domain *dp; - register struct protosw *pr; - - for (dp = domains; dp; dp = dp->dom_next) - for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) - if (pr->pr_slowtimo) - (*pr->pr_slowtimo)(); - timeout(pfslowtimo, (void *)0, hz/2); -} - -void -pffasttimo(arg) - void *arg; -{ - register struct domain *dp; - register struct protosw *pr; - - for (dp = domains; dp; dp = dp->dom_next) - for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) - if (pr->pr_fasttimo) - (*pr->pr_fasttimo)(); - timeout(pffasttimo, (void *)0, hz/5); -} diff --git a/lib/drivers/oskittcp/oskittcp/uipc_mbuf.c b/lib/drivers/oskittcp/oskittcp/uipc_mbuf.c deleted file mode 100644 index ee86ffc4889..00000000000 --- a/lib/drivers/oskittcp/oskittcp/uipc_mbuf.c +++ /dev/null @@ -1,794 +0,0 @@ -/* - * Copyright (c) 1997-1998 University of Utah and the Flux Group. - * All rights reserved. - * - * This file is part of the Flux OSKit. The OSKit is free software, also known - * as "open source;" you can redistribute it and/or modify it under the terms - * of the GNU General Public License (GPL), version 2, as published by the Free - * Software Foundation (FSF). To explore alternate licensing terms, contact - * the University of Utah at csl-dist@cs.utah.edu or +1-801-585-3271. - * - * The OSKit 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 GPL for more details. You should have - * received a copy of the GPL along with the OSKit; see the file COPYING. If - * not, write to the FSF, 59 Temple Place #330, Boston, MA 02111-1307, USA. - */ -/* - * Copyright (c) 1982, 1986, 1988, 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)uipc_mbuf.c 8.2 (Berkeley) 1/4/94 - */ - -#include -#include -#include -#include -#define MBTYPES -#include -#include -#include -#include -#include - -#include -#include - -#ifndef OSKIT -extern vm_map_t mb_map; -struct mbuf *mbutl; -char *mclrefcnt; -int mb_map_full; - -void -mbinit() -{ - int s; - -#if CLBYTES < 4096 -#define NCL_INIT (4096/CLBYTES) -#else -#define NCL_INIT 1 -#endif - //printf("Here1\n"); - s = splimp(); - if (m_clalloc(NCL_INIT, M_DONTWAIT) == 0) - goto bad; - //printf("Here2\n"); - splx(s); - return; -bad: - panic("mbinit"); -} - -/* - * Allocate some number of mbuf clusters - * and place on cluster free list. - * Must be called at splimp. - */ -/* ARGSUSED */ -int -m_clalloc(ncl, nowait) - register int ncl; - int nowait; -{ -#ifndef __REACTOS__ - static int logged; -#endif - register caddr_t p; - register int i; - int npg; - - /* - * Once we run out of map space, it will be impossible - * to get any more (nothing is ever freed back to the - * map). - */ - if (mb_map_full) - return (0); - - npg = ncl * CLSIZE; - - //printf("kmem_malloc(%d)\n", npg); - - p = (caddr_t)kmem_malloc(mb_map, ctob(npg), - nowait ? M_NOWAIT : M_WAITOK); - - //printf("kmem_malloc done\n"); - - /* - * Either the map is now full, or this is nowait and there - * are no pages left. - */ - if (p == NULL) - return (0); - - ncl = ncl * CLBYTES / MCLBYTES; - for (i = 0; i < ncl; i++) { - ((union mcluster *)p)->mcl_next = mclfree; - //printf( "Freeing %x onto the free list\n", p); - mclfree = (union mcluster *)p; - p += MCLBYTES; - mbstat.m_clfree++; - } - mbstat.m_clusters += ncl; - //printf( "done with m_clalloc\n"); - return (1); -} -#endif /* !OSKIT */ - -/* - * When MGET failes, ask protocols to free space when short of memory, - * then re-attempt to allocate an mbuf. - */ -struct mbuf * -m_retry(i, t) - int i, t; -{ - register struct mbuf *m; - - m_reclaim(); -/* - * I'm getting rid of the utterly ugly redefinition of m_retry - * - same for m_retryhdr below - */ -#ifndef OSKIT - MGET(m,i,t); -#else - MGET_DONT_RECURSE(m, i, t); -#endif - if (m != NULL) - mbstat.m_wait++; - else - mbstat.m_drops++; - return (m); -} - -/* - * As above; retry an MGETHDR. - */ -struct mbuf * -m_retryhdr(i, t) - int i, t; -{ - register struct mbuf *m; - - m_reclaim(); -#ifndef OSKIT - MGETHDR(m, i, t); -#else - MGETHDR_DONT_RECURSE(m, i, t); -#endif - if (m != NULL) - mbstat.m_wait++; - else - mbstat.m_drops++; - return (m); -} - -void -m_reclaim() -{ - register struct domain *dp; - register struct protosw *pr; - int s = splimp(); - - for (dp = domains; dp; dp = dp->dom_next) { - for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) { - if (pr->pr_drain) - (*pr->pr_drain)(); - } - } - - splx(s); - mbstat.m_drain++; -} - -/* - * Space allocation routines. - * These are also available as macros - * for critical paths. - */ -struct mbuf * -m_get(nowait, type) - int nowait, type; -{ - register struct mbuf *m; - - MGET(m, nowait, type); - return (m); -} - -struct mbuf * -m_gethdr(nowait, type) - int nowait, type; -{ - register struct mbuf *m; - - MGETHDR(m, nowait, type); - return (m); -} - -struct mbuf * -m_getclr(nowait, type) - int nowait, type; -{ - register struct mbuf *m; - - MGET(m, nowait, type); - if (m == 0) - return (0); - bzero(mtod(m, caddr_t), MLEN); - return (m); -} - -struct mbuf * -m_free(m) - struct mbuf *m; -{ - register struct mbuf *n; - - MFREE(m, n); - return (n); -} - -void -m_freem(m) - register struct mbuf *m; -{ - register struct mbuf *n; - - if (m == NULL) - return; - do { - MFREE(m, n); - m = n; - } while (m); -} - -/* - * Mbuffer utility routines. - */ - -/* - * Lesser-used path for M_PREPEND: - * allocate new mbuf to prepend to chain, - * copy junk along. - */ -struct mbuf * -m_prepend(m, len, how) - register struct mbuf *m; - int len, how; -{ - struct mbuf *mn; - - MGET(mn, how, m->m_type); - if (mn == (struct mbuf *)NULL) { - m_freem(m); - return ((struct mbuf *)NULL); - } - if (m->m_flags & M_PKTHDR) { - M_COPY_PKTHDR(mn, m); - m->m_flags &= ~M_PKTHDR; - } - mn->m_next = m; - m = mn; - if (len < MHLEN) - MH_ALIGN(m, len); - m->m_len = len; - return (m); -} - -/* - * Make a copy of an mbuf chain starting "off0" bytes from the beginning, - * continuing for "len" bytes. If len is M_COPYALL, copy to end of mbuf. - * The wait parameter is a choice of M_WAIT/M_DONTWAIT from caller. - */ -int MCFail; - -struct mbuf * -m_copym(m, off0, len, wait) - register struct mbuf *m; - int off0, wait; - register int len; -{ - register struct mbuf *n, **np; - register int off = off0; - struct mbuf *top; - int copyhdr = 0; - - if (off < 0 || len < 0) - panic("m_copym: off %d, len %d", off, len); - if (off == 0 && m->m_flags & M_PKTHDR) - copyhdr = 1; - while (off > 0) { - if (m == 0) - panic("m_copym: %d", off); - if (off < m->m_len) - break; - off -= m->m_len; - m = m->m_next; - } - np = ⊤ - top = 0; - while (len > 0) { - if (m == 0) { - if (len != M_COPYALL) - panic("m_copym"); - break; - } - MGET(n, wait, m->m_type); - *np = n; - if (n == 0) - goto nospace; - if (copyhdr) { - M_COPY_PKTHDR(n, m); - if (len == M_COPYALL) - n->m_pkthdr.len -= off0; - else - n->m_pkthdr.len = len; - copyhdr = 0; - } - n->m_len = min(len, m->m_len - off); - - if (m->m_flags & M_EXT) { - n->m_data = m->m_data + off; -#ifdef OSKIT - oskit_bufio_addref(m->m_ext.ext_bufio); -#else - mclrefcnt[mtocl(m->m_ext.ext_buf)]++; -#endif /* OSKIT */ - n->m_ext = m->m_ext; - n->m_flags |= M_EXT; - } else - bcopy(mtod(m, caddr_t)+off, mtod(n, caddr_t), - (unsigned)n->m_len); - if (len != M_COPYALL) - len -= n->m_len; - off = 0; - m = m->m_next; - np = &n->m_next; - } - if (top == 0) - MCFail++; - return (top); -nospace: - m_freem(top); - MCFail++; - return (0); -} - -/* - * Copy data from an mbuf chain starting "off" bytes from the beginning, - * continuing for "len" bytes, into the indicated buffer. - */ -void -m_copydata(m, off, len, cp) - register struct mbuf *m; - register int off; - register int len; - caddr_t cp; -{ - register unsigned count; - - if (off < 0 || len < 0) - panic("m_copydata"); - while (off > 0) { - if (m == 0) - panic("m_copydata"); - if (off < m->m_len) - break; - off -= m->m_len; - m = m->m_next; - } - while (len > 0) { - if (m == 0) - panic("m_copydata"); - count = min(m->m_len - off, len); - OS_DbgPrint(OSK_MID_TRACE,("count %d len %d\n", count, len)); - bcopy(mtod(m, caddr_t) + off, cp, count); - len -= count; - cp += count; - off = 0; - m = m->m_next; - } -} - -/* - * Concatenate mbuf chain n to m. - * Both chains must be of the same type (e.g. MT_DATA). - * Any m_pkthdr is not updated. - */ -void -m_cat(m, n) - register struct mbuf *m, *n; -{ - while (m->m_next) - m = m->m_next; - while (n) { - if (m->m_flags & M_EXT || - m->m_data + m->m_len + n->m_len >= &m->m_dat[MLEN]) { - /* just join the two chains */ - m->m_next = n; - return; - } - /* splat the data from one into the other */ - bcopy(mtod(n, caddr_t), mtod(m, caddr_t) + m->m_len, - (u_int)n->m_len); - m->m_len += n->m_len; - n = m_free(n); - } -} - -void -m_adj(mp, req_len) - struct mbuf *mp; - int req_len; -{ - register int len = req_len; - register struct mbuf *m; - register int count; - - if ((m = mp) == NULL) - return; - if (len >= 0) { - /* - * Trim from head. - */ - while (m != NULL && len > 0) { - if (m->m_len <= len) { - len -= m->m_len; - m->m_len = 0; - m = m->m_next; - } else { - m->m_len -= len; - m->m_data += len; - len = 0; - } - } - m = mp; - if (mp->m_flags & M_PKTHDR) - m->m_pkthdr.len -= (req_len - len); - } else { - /* - * Trim from tail. Scan the mbuf chain, - * calculating its length and finding the last mbuf. - * If the adjustment only affects this mbuf, then just - * adjust and return. Otherwise, rescan and truncate - * after the remaining size. - */ - len = -len; - count = 0; - for (;;) { - count += m->m_len; - if (m->m_next == (struct mbuf *)0) - break; - m = m->m_next; - } - if (m->m_len >= len) { - m->m_len -= len; - if (mp->m_flags & M_PKTHDR) - mp->m_pkthdr.len -= len; - return; - } - count -= len; - if (count < 0) - count = 0; - /* - * Correct length for chain is "count". - * Find the mbuf with last data, adjust its length, - * and toss data from remaining mbufs on chain. - */ - m = mp; - if (m->m_flags & M_PKTHDR) - m->m_pkthdr.len = count; - for (; m; m = m->m_next) { - if (m->m_len >= count) { - m->m_len = count; - break; - } - count -= m->m_len; - } - while (m->m_next) - (m = m->m_next) ->m_len = 0; - } -} - -/* - * Rearange an mbuf chain so that len bytes are contiguous - * and in the data area of an mbuf (so that mtod and dtom - * will work for a structure of size len). Returns the resulting - * mbuf chain on success, frees it and returns null on failure. - * If there is room, it will add up to max_protohdr-len extra bytes to the - * contiguous region in an attempt to avoid being called next time. - */ -int MPFail; - -struct mbuf * -m_pullup(n, len) - register struct mbuf *n; - int len; -{ - register struct mbuf *m; - register int count; - int space; - - /* - * If first mbuf has no cluster, and has room for len bytes - * without shifting current data, pullup into it, - * otherwise allocate a new mbuf to prepend to the chain. - */ - if ((n->m_flags & M_EXT) == 0 && - n->m_data + len < &n->m_dat[MLEN] && n->m_next) { - if (n->m_len >= len) - return (n); - m = n; - n = n->m_next; - len -= m->m_len; - } else { - if (len > MHLEN) - goto bad; - MGET(m, M_DONTWAIT, n->m_type); - if (m == 0) - goto bad; - m->m_len = 0; - if (n->m_flags & M_PKTHDR) { - M_COPY_PKTHDR(m, n); - n->m_flags &= ~M_PKTHDR; - } - } - space = &m->m_dat[MLEN] - (m->m_data + m->m_len); - do { - count = min(min(max(len, max_protohdr), space), n->m_len); - bcopy(mtod(n, caddr_t), mtod(m, caddr_t) + m->m_len, - (unsigned)count); - len -= count; - m->m_len += count; - n->m_len -= count; - space -= count; - if (n->m_len) - n->m_data += count; - else - n = m_free(n); - } while (len > 0 && n); - if (len > 0) { - (void) m_free(m); - goto bad; - } - m->m_next = n; - return (m); -bad: - m_freem(n); - MPFail++; - return (0); -} - -/* - * Partition an mbuf chain in two pieces, returning the tail -- - * all but the first len0 bytes. In case of failure, it returns NULL and - * attempts to restore the chain to its original state. - */ -struct mbuf * -m_split(m0, len0, wait) - register struct mbuf *m0; - int len0, wait; -{ - register struct mbuf *m, *n; - unsigned len = len0, remain; - - for (m = m0; m && len > m->m_len; m = m->m_next) - len -= m->m_len; - if (m == 0) - return (0); - remain = m->m_len - len; - if (m0->m_flags & M_PKTHDR) { - MGETHDR(n, wait, m0->m_type); - if (n == 0) - return (0); - n->m_pkthdr.rcvif = m0->m_pkthdr.rcvif; - n->m_pkthdr.len = m0->m_pkthdr.len - len0; - m0->m_pkthdr.len = len0; - if (m->m_flags & M_EXT) - goto extpacket; - if (remain > MHLEN) { - /* m can't be the lead packet */ - MH_ALIGN(n, 0); - n->m_next = m_split(m, len, wait); - if (n->m_next == 0) { - (void) m_free(n); - return (0); - } else - return (n); - } else - MH_ALIGN(n, remain); - } else if (remain == 0) { - n = m->m_next; - m->m_next = 0; - return (n); - } else { - MGET(n, wait, m->m_type); - if (n == 0) - return (0); - M_ALIGN(n, remain); - } -extpacket: - if (m->m_flags & M_EXT) { - n->m_flags |= M_EXT; - n->m_ext = m->m_ext; -#ifdef OSKIT - oskit_bufio_addref(m->m_ext.ext_bufio); -#else - mclrefcnt[mtocl(m->m_ext.ext_buf)]++; -#endif /* OSKIT */ - m->m_ext.ext_size = 0; /* For Accounting XXXXXX danger */ - n->m_data = m->m_data + len; - } else { - bcopy(mtod(m, caddr_t) + len, mtod(n, caddr_t), remain); - } - n->m_len = remain; - m->m_len = len; - n->m_next = m->m_next; - m->m_next = 0; - return (n); -} - -#if !defined(OSKIT) || defined(__REACTOS__) -/* currently not OS Kit approved, and shouldn't be needed in the first place */ - -/* - * Routine to copy from device local memory into mbufs. - */ -struct mbuf * -m_devget(buf, totlen, off0, ifp, copy) - char *buf; - int totlen, off0; - struct ifnet *ifp; - void (*copy)(); -{ - register struct mbuf *m; - struct mbuf *top = 0, **mp = ⊤ - register int off = off0, len; - register char *cp; - char *epkt; - - cp = buf; - epkt = cp + totlen; - if (off) { - cp += off + 2 * sizeof(u_short); - totlen -= 2 * sizeof(u_short); - } - MGETHDR(m, M_DONTWAIT, MT_DATA); - if (m == 0) - return (0); -#ifndef __REACTOS__ - m->m_pkthdr.rcvif = ifp; -#else - m->m_pkthdr.rcvif = 0; -#endif - m->m_pkthdr.len = totlen; - m->m_len = MHLEN; - - while (totlen > 0) { - if (top) { - MGET(m, M_DONTWAIT, MT_DATA); - if (m == 0) { - m_freem(top); - return (0); - } - m->m_len = MLEN; - } - len = min(totlen, epkt - cp); - if (len >= MINCLSIZE) { - MCLGET(m, M_DONTWAIT); - if (m->m_flags & M_EXT) - m->m_len = len = min(len, MCLBYTES); - else - len = m->m_len; - } else { - /* - * Place initial small packet/header at end of mbuf. - */ - if (len < m->m_len) { - if (top == 0 && len + max_linkhdr <= m->m_len) - m->m_data += max_linkhdr; - m->m_len = len; - } else - len = m->m_len; - } - if (copy) - copy(cp, mtod(m, caddr_t), (unsigned)len); - else - bcopy(cp, mtod(m, caddr_t), (unsigned)len); - cp += len; - *mp = m; - mp = &m->m_next; - totlen -= len; - if (cp == epkt) - cp = buf; - } - return (top); -} - -#endif /* !OSKIT */ - -/* - * Copy data from a buffer back into the indicated mbuf chain, - * starting "off" bytes from the beginning, extending the mbuf - * chain if necessary. - */ -void -m_copyback(m0, off, len, cp) - struct mbuf *m0; - register int off; - register int len; - caddr_t cp; -{ - register int mlen; - register struct mbuf *m = m0, *n; - int totlen = 0; - - if (m0 == 0) - return; - while (off > (mlen = m->m_len)) { - off -= mlen; - totlen += mlen; - if (m->m_next == 0) { - n = m_getclr(M_DONTWAIT, m->m_type); - if (n == 0) - goto out; - n->m_len = min(MLEN, len + off); - m->m_next = n; - } - m = m->m_next; - } - while (len > 0) { - mlen = min (m->m_len - off, len); - bcopy(cp, off + mtod(m, caddr_t), (unsigned)mlen); - cp += mlen; - len -= mlen; - mlen += off; - off = 0; - totlen += mlen; - if (len == 0) - break; - if (m->m_next == 0) { - n = m_get(M_DONTWAIT, m->m_type); - if (n == 0) - break; - n->m_len = min(MLEN, len); - m->m_next = n; - } - m = m->m_next; - } -out: if (((m = m0)->m_flags & M_PKTHDR) && (m->m_pkthdr.len < totlen)) - m->m_pkthdr.len = totlen; -} diff --git a/lib/drivers/oskittcp/oskittcp/uipc_socket.c b/lib/drivers/oskittcp/oskittcp/uipc_socket.c deleted file mode 100644 index 2bd3c7a4e45..00000000000 --- a/lib/drivers/oskittcp/oskittcp/uipc_socket.c +++ /dev/null @@ -1,1077 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1988, 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)uipc_socket.c 8.3 (Berkeley) 4/15/94 - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* - * Exported to userland via sysctl - */ -int somaxconn = SOMAXCONN; - -/* - * Socket operation routines. - * These routines are called by the routines in - * sys_socket.c or from a system process, and - * implement the semantics of socket operations by - * switching out to the protocol specific routines. - */ -/*ARGSUSED*/ -int -socreate(dom, aso, type, proto) - int dom; - struct socket **aso; - register int type; - int proto; -{ -#ifndef __REACTOS__ - struct proc *p = curproc; /* XXX */ -#endif - register struct protosw *prp; - register struct socket *so; - register int error; - - if (proto) - prp = pffindproto(dom, proto, type); - else - prp = pffindtype(dom, type); - if (prp == 0 || prp->pr_usrreq == 0) - return (EPROTONOSUPPORT); - if (prp->pr_type != type) - return (EPROTOTYPE); - MALLOC(so, struct socket *, sizeof(*so), M_SOCKET, M_WAIT); - bzero((caddr_t)so, sizeof(*so)); - so->so_type = type; -#ifndef __REACTOS__ - if (p->p_ucred->cr_uid == 0) - so->so_state = SS_PRIV; -#endif - so->so_proto = prp; - error = - (*prp->pr_usrreq)(so, PRU_ATTACH, - (struct mbuf *)0, (struct mbuf *)proto, (struct mbuf *)0); - if (error) { - so->so_state |= SS_NOFDREF; - sofree(so); - return (error); - } - *aso = so; - return (0); -} - -int -sobind(so, nam) - struct socket *so; - struct mbuf *nam; -{ - int s = splnet(); - int error; - - error = - (*so->so_proto->pr_usrreq)(so, PRU_BIND, - (struct mbuf *)0, nam, (struct mbuf *)0); - splx(s); - return (error); -} - -int -solisten(so, backlog) - register struct socket *so; - int backlog; -{ - int s = splnet(), error; - - error = - (*so->so_proto->pr_usrreq)(so, PRU_LISTEN, - (struct mbuf *)0, (struct mbuf *)0, (struct mbuf *)0); - if (error) { - splx(s); - return (error); - } - if (so->so_q == 0) - so->so_options |= SO_ACCEPTCONN; - if (backlog < 0 || backlog > somaxconn) - backlog = somaxconn; - so->so_qlimit = backlog; - splx(s); - return (0); -} - -void -sofree(so) - register struct socket *so; -{ - - if (so->so_pcb || (so->so_state & SS_NOFDREF) == 0) - return; - if (so->so_head) { - if (!soqremque(so, 0) && !soqremque(so, 1)) - panic("sofree dq"); - so->so_head = 0; - } - sbrelease(&so->so_snd); - sorflush(so); - FREE(so, M_SOCKET); -} - -/* - * Close a socket on last file table reference removal. - * Initiate disconnect if connected. - * Free socket when disconnect complete. - */ -int -soclose(so) - register struct socket *so; -{ - int s = splnet(); /* conservative */ - int error = 0; - - if (so->so_options & SO_ACCEPTCONN) { - while (so->so_q0) - (void) soabort(so->so_q0); - while (so->so_q) - (void) soabort(so->so_q); - } - if (so->so_pcb == 0) - goto discard; - if (so->so_state & SS_ISCONNECTED) { - if ((so->so_state & SS_ISDISCONNECTING) == 0) { - error = sodisconnect(so); - if (error) - goto drop; - } - if (so->so_options & SO_LINGER) { - if ((so->so_state & SS_ISDISCONNECTING) && - (so->so_state & SS_NBIO)) - goto drop; - while (so->so_state & SS_ISCONNECTED) { - error = tsleep((caddr_t)&so->so_timeo, - PSOCK | PCATCH, netcls, so->so_linger * 1000); - if (error) - break; - } - } - } -drop: - if (so->so_pcb) { - int error2 = - (*so->so_proto->pr_usrreq)(so, PRU_DETACH, - (struct mbuf *)0, (struct mbuf *)0, (struct mbuf *)0); - if (error == 0) - error = error2; - } -discard: - if (so->so_state & SS_NOFDREF) - panic("soclose: NOFDREF"); - so->so_state |= SS_NOFDREF; - sofree(so); - splx(s); - return (error); -} - -/* - * Must be called at splnet... - */ -int -soabort(so) - struct socket *so; -{ - - return ( - (*so->so_proto->pr_usrreq)(so, PRU_ABORT, - (struct mbuf *)0, (struct mbuf *)0, (struct mbuf *)0)); -} - -int -soaccept(so, nam) - register struct socket *so; - struct mbuf *nam; -{ - int s = splnet(); - int error; - - if ((so->so_state & SS_NOFDREF) == 0) - panic("soaccept: !NOFDREF"); - so->so_state &= ~SS_NOFDREF; - error = (*so->so_proto->pr_usrreq)(so, PRU_ACCEPT, - (struct mbuf *)0, nam, (struct mbuf *)0); - splx(s); - return (error); -} - -int -soconnect(so, nam) - register struct socket *so; - struct mbuf *nam; -{ - int s; - int error; - - if (so->so_options & SO_ACCEPTCONN) - return (EOPNOTSUPP); - s = splnet(); - /* - * If protocol is connection-based, can only connect once. - * Otherwise, if connected, try to disconnect first. - * This allows user to disconnect by connecting to, e.g., - * a null address. - */ - if (so->so_state & (SS_ISCONNECTED|SS_ISCONNECTING) && - ((so->so_proto->pr_flags & PR_CONNREQUIRED) || - (error = sodisconnect(so)))) - error = EISCONN; - else - error = (*so->so_proto->pr_usrreq)(so, PRU_CONNECT, - (struct mbuf *)0, nam, (struct mbuf *)0); - splx(s); - return (error); -} - -int -soconnect2(so1, so2) - register struct socket *so1; - struct socket *so2; -{ - int s = splnet(); - int error; - - error = (*so1->so_proto->pr_usrreq)(so1, PRU_CONNECT2, - (struct mbuf *)0, (struct mbuf *)so2, (struct mbuf *)0); - splx(s); - return (error); -} - -int -sodisconnect(so) - register struct socket *so; -{ - int s = splnet(); - int error; - - if ((so->so_state & SS_ISCONNECTED) == 0) { - error = ENOTCONN; - goto bad; - } - if (so->so_state & SS_ISDISCONNECTING) { - error = EALREADY; - goto bad; - } - error = (*so->so_proto->pr_usrreq)(so, PRU_DISCONNECT, - (struct mbuf *)0, (struct mbuf *)0, (struct mbuf *)0); -bad: - splx(s); - return (error); -} - -#define SBLOCKWAIT(f) (((f) & MSG_DONTWAIT) ? M_NOWAIT : M_WAITOK) -/* - * Send on a socket. - * If send must go all at once and message is larger than - * send buffering, then hard error. - * Lock against other senders. - * If must go all at once and not enough room now, then - * inform user that this would block and do nothing. - * Otherwise, if nonblocking, send as much as possible. - * The data to be sent is described by "uio" if nonzero, - * otherwise by the mbuf chain "top" (which must be null - * if uio is not). Data provided in mbuf chain must be small - * enough to send all at once. - * - * Returns nonzero on error, timeout or signal; callers - * must check for short counts if EINTR/ERESTART are returned. - * Data and control buffers are freed on return. - */ -int -sosend(so, addr, uio, top, control, flags) - register struct socket *so; - struct mbuf *addr; - struct uio *uio; - struct mbuf *top; - struct mbuf *control; - int flags; -{ -#ifndef __REACTOS__ - struct proc *p = curproc; /* XXX */ -#endif - struct mbuf **mp; - register struct mbuf *m; - register long space, len, resid; - int clen = 0, error, s, dontroute, mlen; - int atomic = sosendallatonce(so) || top; - - if (uio) - resid = uio->uio_resid; - else - resid = top->m_pkthdr.len; - /* - * In theory resid should be unsigned. - * However, space must be signed, as it might be less than 0 - * if we over-committed, and we must use a signed comparison - * of space and resid. On the other hand, a negative resid - * causes us to loop sending 0-length segments to the protocol. - */ - if (resid < 0) - return (EINVAL); - dontroute = - (flags & MSG_DONTROUTE) && (so->so_options & SO_DONTROUTE) == 0 && - (so->so_proto->pr_flags & PR_ATOMIC); -#ifndef __REACTOS__ - p->p_stats->p_ru.ru_msgsnd++; -#endif - if (control) - clen = control->m_len; -#define snderr(errno) { error = errno; splx(s); goto release; } - -restart: - error = sblock(&so->so_snd, SBLOCKWAIT(flags)); - if (error) - goto out; - do { - s = splnet(); - if (so->so_state & SS_CANTSENDMORE) - snderr(EPIPE); - if (so->so_error) - snderr(so->so_error); - if ((so->so_state & SS_ISCONNECTED) == 0) { - /* - * `sendto' and `sendmsg' is allowed on a connection- - * based socket if it supports implied connect. - * Return ENOTCONN if not connected and no address is - * supplied. - */ - if ((so->so_proto->pr_flags & PR_CONNREQUIRED) && - (so->so_proto->pr_flags & PR_IMPLOPCL) == 0) { - if ((so->so_state & SS_ISCONFIRMING) == 0 && - !(resid == 0 && clen != 0)) - snderr(ENOTCONN); - } else if (addr == 0) - snderr(so->so_proto->pr_flags & PR_CONNREQUIRED ? - ENOTCONN : EDESTADDRREQ); - } - space = sbspace(&so->so_snd); - if (flags & MSG_OOB) - space += 1024; - if ((atomic && resid > so->so_snd.sb_hiwat) || - clen > so->so_snd.sb_hiwat) - snderr(EMSGSIZE); - if (space < resid + clen && uio && - (atomic || space < so->so_snd.sb_lowat || space < clen)) { - if (so->so_state & SS_NBIO) - snderr(EWOULDBLOCK); - sbunlock(so, &so->so_snd); - error = sbwait(&so->so_snd); - splx(s); - if (error) - goto out; - goto restart; - } - splx(s); - mp = ⊤ - space -= clen; - do { - if (uio == NULL) { - /* - * Data is prepackaged in "top". - */ - resid = 0; - if (flags & MSG_EOR) - top->m_flags |= M_EOR; - } else do { - if (top == 0) { - MGETHDR(m, M_WAIT, MT_DATA); - mlen = MHLEN; - m->m_pkthdr.len = 0; - m->m_pkthdr.rcvif = (struct ifnet *)0; - } else { - MGET(m, M_WAIT, MT_DATA); - mlen = MLEN; - } - if (resid >= MINCLSIZE) { - MCLGET(m, M_WAIT); - if ((m->m_flags & M_EXT) == 0) - goto nopages; - mlen = MCLBYTES; - len = min(min(mlen, resid), space); - } else { -nopages: - len = min(min(mlen, resid), space); - /* - * For datagram protocols, leave room - * for protocol headers in first mbuf. - */ - if (atomic && top == 0 && len < mlen) - MH_ALIGN(m, len); - } - space -= len; - error = uiomove(mtod(m, caddr_t), (int)len, uio); - resid = uio->uio_resid; - m->m_len = len; - *mp = m; - top->m_pkthdr.len += len; - if (error) - goto release; - mp = &m->m_next; - if (resid <= 0) { - if (flags & MSG_EOR) - top->m_flags |= M_EOR; - break; - } - } while (space > 0 && atomic); - if (dontroute) - so->so_options |= SO_DONTROUTE; - s = splnet(); /* XXX */ - error = (*so->so_proto->pr_usrreq)(so, - (flags & MSG_OOB) ? PRU_SENDOOB : - /* - * If the user set MSG_EOF, the protocol - * understands this flag and nothing left to - * send then use PRU_SEND_EOF instead of PRU_SEND. - */ - ((flags & MSG_EOF) && - (so->so_proto->pr_flags & PR_IMPLOPCL) && - (resid <= 0)) ? - PRU_SEND_EOF : PRU_SEND, - top, addr, control); - splx(s); - if (dontroute) - so->so_options &= ~SO_DONTROUTE; - clen = 0; - control = 0; - top = 0; - mp = ⊤ - if (error) - goto release; - } while (resid && space > 0); - } while (resid); - -release: - sbunlock(so, &so->so_snd); -out: - if (top) - m_freem(top); - if (control) - m_freem(control); - return (error); -} - -/* - * Implement receive operations on a socket. - * We depend on the way that records are added to the sockbuf - * by sbappend*. In particular, each record (mbufs linked through m_next) - * must begin with an address if the protocol so specifies, - * followed by an optional mbuf or mbufs containing ancillary data, - * and then zero or more mbufs of data. - * In order to avoid blocking network interrupts for the entire time here, - * we splx() while doing the actual copy to user space. - * Although the sockbuf is locked, new data may still be appended, - * and thus we must maintain consistency of the sockbuf during that time. - * - * The caller may receive the data as a single mbuf chain by supplying - * an mbuf **mp0 for use in returning the chain. The uio is then used - * only for the count in uio_resid. - */ -int -soreceive(so, paddr, uio, mp0, controlp, flagsp) - register struct socket *so; - struct mbuf **paddr; - struct uio *uio; - struct mbuf **mp0; - struct mbuf **controlp; - int *flagsp; -{ - register struct mbuf *m, **mp; - register int flags, len, error, s, offset; - struct protosw *pr = so->so_proto; - struct mbuf *nextrecord; - int moff, type = 0; - int orig_resid = uio->uio_resid; - - mp = mp0; - if (paddr) - *paddr = 0; - if (controlp) - *controlp = 0; - if (flagsp) - flags = *flagsp &~ MSG_EOR; - else - flags = 0; - if (flags & MSG_OOB) { - m = m_get(M_WAIT, MT_DATA); - error = (*pr->pr_usrreq)(so, PRU_RCVOOB, - m, (struct mbuf *)(flags & MSG_PEEK), (struct mbuf *)0); - if (error) - goto bad; - do { - error = uiomove(mtod(m, caddr_t), - (int) min(uio->uio_resid, m->m_len), uio); - m = m_free(m); - } while (uio->uio_resid && error == 0 && m); -bad: - if (m) - m_freem(m); - return (error); - } - if (mp) - *mp = (struct mbuf *)0; - if (so->so_state & SS_ISCONFIRMING && uio->uio_resid) - (*pr->pr_usrreq)(so, PRU_RCVD, (struct mbuf *)0, - (struct mbuf *)0, (struct mbuf *)0); - -restart: - error = sblock(&so->so_rcv, SBLOCKWAIT(flags)); - if (error) - return (error); - s = splnet(); - - m = so->so_rcv.sb_mb; - /* - * If we have less data than requested, block awaiting more - * (subject to any timeout) if: - * 1. the current count is less than the low water mark, or - * 2. MSG_WAITALL is set, and it is possible to do the entire - * receive operation at once if we block (resid <= hiwat). - * 3. MSG_DONTWAIT is not set - * If MSG_WAITALL is set but resid is larger than the receive buffer, - * we have to do the receive in sections, and thus risk returning - * a short count if a timeout or signal occurs after we start. - */ - if (m == 0 || (((flags & MSG_DONTWAIT) == 0 && - so->so_rcv.sb_cc < uio->uio_resid) && - (so->so_rcv.sb_cc < so->so_rcv.sb_lowat || - ((flags & MSG_WAITALL) && uio->uio_resid <= so->so_rcv.sb_hiwat)) && - m->m_nextpkt == 0 && (pr->pr_flags & PR_ATOMIC) == 0)) { -#ifdef DIAGNOSTIC - if (m == 0 && so->so_rcv.sb_cc) - panic("receive 1"); -#endif - if (so->so_error) { - if (m) - goto dontblock; - error = so->so_error; - if ((flags & MSG_PEEK) == 0) - so->so_error = 0; - goto release; - } - if (so->so_state & SS_CANTRCVMORE) { - if (m) - goto dontblock; - else - goto release; - } - for (; m; m = m->m_next) - if (m->m_type == MT_OOBDATA || (m->m_flags & M_EOR)) { - m = so->so_rcv.sb_mb; - goto dontblock; - } - if ((so->so_state & (SS_ISCONNECTED|SS_ISCONNECTING)) == 0 && - (so->so_proto->pr_flags & PR_CONNREQUIRED)) { - printf("so: %x\n", so); - __asm__("int3"); - error = ENOTCONN; - goto release; - } - if (uio->uio_resid == 0) - goto release; - if ((so->so_state & SS_NBIO) || (flags & MSG_DONTWAIT)) { - error = EWOULDBLOCK; - goto release; - } - sbunlock(so, &so->so_rcv); - error = sbwait(&so->so_rcv); - splx(s); - if (error) - return (error); - goto restart; - } -dontblock: - if (uio->uio_procp) - uio->uio_procp->p_stats->p_ru.ru_msgrcv++; - nextrecord = m->m_nextpkt; - if (pr->pr_flags & PR_ADDR) { -#ifdef DIAGNOSTIC - if (m->m_type != MT_SONAME) - panic("receive 1a"); -#endif - orig_resid = 0; - if (flags & MSG_PEEK) { - if (paddr) - *paddr = m_copy(m, 0, m->m_len); - m = m->m_next; - } else { - sbfree(&so->so_rcv, m); - if (paddr) { - *paddr = m; - so->so_rcv.sb_mb = m->m_next; - m->m_next = 0; - m = so->so_rcv.sb_mb; - } else { - MFREE(m, so->so_rcv.sb_mb); - m = so->so_rcv.sb_mb; - } - } - } - while (m && m->m_type == MT_CONTROL && error == 0) { - if (flags & MSG_PEEK) { - if (controlp) - *controlp = m_copy(m, 0, m->m_len); - m = m->m_next; - } else { - sbfree(&so->so_rcv, m); -#ifndef __REACTOS__ - if (controlp) { - if (pr->pr_domain->dom_externalize && - mtod(m, struct cmsghdr *)->cmsg_type == - SCM_RIGHTS) - error = (*pr->pr_domain->dom_externalize)(m); - *controlp = m; - so->so_rcv.sb_mb = m->m_next; - m->m_next = 0; - m = so->so_rcv.sb_mb; - } else -#endif - { - MFREE(m, so->so_rcv.sb_mb); - m = so->so_rcv.sb_mb; - } - } - if (controlp) { - orig_resid = 0; - controlp = &(*controlp)->m_next; - } - } - if (m) { - if ((flags & MSG_PEEK) == 0) - m->m_nextpkt = nextrecord; - type = m->m_type; - if (type == MT_OOBDATA) - flags |= MSG_OOB; - } - moff = 0; - offset = 0; - while (m && uio->uio_resid > 0 && error == 0) { - if (m->m_type == MT_OOBDATA) { - if (type != MT_OOBDATA) - break; - } else if (type == MT_OOBDATA) - break; -#ifdef DIAGNOSTIC - else if (m->m_type != MT_DATA && m->m_type != MT_HEADER) - panic("receive 3"); -#endif - so->so_state &= ~SS_RCVATMARK; - len = uio->uio_resid; - if (so->so_oobmark && len > so->so_oobmark - offset) - len = so->so_oobmark - offset; - if (len > m->m_len - moff) - len = m->m_len - moff; - /* - * If mp is set, just pass back the mbufs. - * Otherwise copy them out via the uio, then free. - * Sockbuf must be consistent here (points to current mbuf, - * it points to next record) when we drop priority; - * we must note any additions to the sockbuf when we - * block interrupts again. - */ - if (mp == 0) { - splx(s); - error = uiomove(mtod(m, caddr_t) + moff, (int)len, uio); - s = splnet(); - } else - uio->uio_resid -= len; - if (len == m->m_len - moff) { - if (m->m_flags & M_EOR) - flags |= MSG_EOR; - if (flags & MSG_PEEK) { - m = m->m_next; - moff = 0; - } else { - nextrecord = m->m_nextpkt; - sbfree(&so->so_rcv, m); - if (mp) { - *mp = m; - mp = &m->m_next; - so->so_rcv.sb_mb = m = m->m_next; - *mp = (struct mbuf *)0; - } else { - MFREE(m, so->so_rcv.sb_mb); - m = so->so_rcv.sb_mb; - } - if (m) - m->m_nextpkt = nextrecord; - } - } else { - if (flags & MSG_PEEK) - moff += len; - else { - if (mp) - *mp = m_copym(m, 0, len, M_WAIT); - m->m_data += len; - m->m_len -= len; - so->so_rcv.sb_cc -= len; - } - } - if (so->so_oobmark) { - if ((flags & MSG_PEEK) == 0) { - so->so_oobmark -= len; - if (so->so_oobmark == 0) { - so->so_state |= SS_RCVATMARK; - break; - } - } else { - offset += len; - if (offset == so->so_oobmark) - break; - } - } - if (flags & MSG_EOR) - break; - /* - * If the MSG_WAITALL flag is set (for non-atomic socket), - * we must not quit until "uio->uio_resid == 0" or an error - * termination. If a signal/timeout occurs, return - * with a short count but without error. - * Keep sockbuf locked against other readers. - */ - while (flags & MSG_WAITALL && m == 0 && uio->uio_resid > 0 && - !sosendallatonce(so) && !nextrecord) { - if (so->so_error || so->so_state & SS_CANTRCVMORE) - break; - error = sbwait(&so->so_rcv); - if (error) { - sbunlock(so, &so->so_rcv); - splx(s); - return (0); - } - m = so->so_rcv.sb_mb; - if (m) - nextrecord = m->m_nextpkt; - } - } - - if (m && pr->pr_flags & PR_ATOMIC) { - flags |= MSG_TRUNC; - if ((flags & MSG_PEEK) == 0) - (void) sbdroprecord(&so->so_rcv); - } - if ((flags & MSG_PEEK) == 0) { - if (m == 0) - so->so_rcv.sb_mb = nextrecord; - if (pr->pr_flags & PR_WANTRCVD && so->so_pcb) - (*pr->pr_usrreq)(so, PRU_RCVD, (struct mbuf *)0, - (struct mbuf *)flags, (struct mbuf *)0); - } - if (orig_resid == uio->uio_resid && orig_resid && - (flags & MSG_EOR) == 0 && (so->so_state & SS_CANTRCVMORE) == 0) { - sbunlock(so, &so->so_rcv); - splx(s); - goto restart; - } - - if (flagsp) - *flagsp |= flags; -release: - sbunlock(so, &so->so_rcv); - splx(s); - return (error); -} - -int -soshutdown(so, how) - register struct socket *so; - register int how; -{ - register struct protosw *pr = so->so_proto; - - how++; - if (how & FREAD) - sorflush(so); - if (how & FWRITE) - return ((*pr->pr_usrreq)(so, PRU_SHUTDOWN, - (struct mbuf *)0, (struct mbuf *)0, (struct mbuf *)0)); - return (0); -} - -void -sorflush(so) - register struct socket *so; -{ - register struct sockbuf *sb = &so->so_rcv; - register struct protosw *pr = so->so_proto; - register int s; - struct sockbuf asb; - - sb->sb_flags |= SB_NOINTR; - (void) sblock(sb, M_WAITOK); - s = splimp(); - socantrcvmore(so); - sbunlock(so, sb); - asb = *sb; - bzero((caddr_t)sb, sizeof (*sb)); - splx(s); - if (pr->pr_flags & PR_RIGHTS && pr->pr_domain->dom_dispose) - (*pr->pr_domain->dom_dispose)(asb.sb_mb); - sbrelease(&asb); -} - -int -sosetopt(so, level, optname, m0) - register struct socket *so; - int level, optname; - struct mbuf *m0; -{ - int error = 0; - register struct mbuf *m = m0; - - if (level != SOL_SOCKET) { - if (so->so_proto && so->so_proto->pr_ctloutput) - return ((*so->so_proto->pr_ctloutput) - (PRCO_SETOPT, so, level, optname, &m0)); - error = ENOPROTOOPT; - } else { - switch (optname) { - - case SO_LINGER: - if (m == NULL || m->m_len != sizeof (struct linger)) { - error = EINVAL; - goto bad; - } - so->so_linger = mtod(m, struct linger *)->l_linger; - /* fall thru... */ - - case SO_DEBUG: - case SO_KEEPALIVE: - case SO_DONTROUTE: - case SO_USELOOPBACK: - case SO_BROADCAST: - case SO_REUSEADDR: - case SO_REUSEPORT: - case SO_OOBINLINE: - if (m == NULL || m->m_len < sizeof (int)) { - error = EINVAL; - goto bad; - } - if (*mtod(m, int *)) - so->so_options |= optname; - else - so->so_options &= ~optname; - break; - - case SO_SNDBUF: - case SO_RCVBUF: - case SO_SNDLOWAT: - case SO_RCVLOWAT: - if (m == NULL || m->m_len < sizeof (int)) { - error = EINVAL; - goto bad; - } - switch (optname) { - - case SO_SNDBUF: - case SO_RCVBUF: - if (sbreserve(optname == SO_SNDBUF ? - &so->so_snd : &so->so_rcv, - (u_long) *mtod(m, int *)) == 0) { - error = ENOBUFS; - goto bad; - } - break; - - case SO_SNDLOWAT: - so->so_snd.sb_lowat = *mtod(m, int *); - break; - case SO_RCVLOWAT: - so->so_rcv.sb_lowat = *mtod(m, int *); - break; - } - break; - - case SO_SNDTIMEO: - case SO_RCVTIMEO: - { - struct timeval *tv; - short val; - - if (m == NULL || m->m_len < sizeof (*tv)) { - error = EINVAL; - goto bad; - } - tv = mtod(m, struct timeval *); - if (tv->tv_sec > SHRT_MAX / hz - hz) { - error = EDOM; - goto bad; - } - val = tv->tv_sec * hz + tv->tv_usec / tick; - - switch (optname) { - - case SO_SNDTIMEO: - so->so_snd.sb_timeo = val; - break; - case SO_RCVTIMEO: - so->so_rcv.sb_timeo = val; - break; - } - break; - } - - default: - error = ENOPROTOOPT; - break; - } - if (error == 0 && so->so_proto && so->so_proto->pr_ctloutput) { - (void) ((*so->so_proto->pr_ctloutput) - (PRCO_SETOPT, so, level, optname, &m0)); - m = NULL; /* freed by protocol */ - } - } -bad: - if (m) - (void) m_free(m); - return (error); -} - -int -sogetopt(so, level, optname, mp) - register struct socket *so; - int level, optname; - struct mbuf **mp; -{ - register struct mbuf *m; - - if (level != SOL_SOCKET) { - if (so->so_proto && so->so_proto->pr_ctloutput) { - return ((*so->so_proto->pr_ctloutput) - (PRCO_GETOPT, so, level, optname, mp)); - } else - return (ENOPROTOOPT); - } else { - m = m_get(M_WAIT, MT_SOOPTS); - m->m_len = sizeof (int); - - switch (optname) { - - case SO_LINGER: - m->m_len = sizeof (struct linger); - mtod(m, struct linger *)->l_onoff = - so->so_options & SO_LINGER; - mtod(m, struct linger *)->l_linger = so->so_linger; - break; - - case SO_USELOOPBACK: - case SO_DONTROUTE: - case SO_DEBUG: - case SO_KEEPALIVE: - case SO_REUSEADDR: - case SO_REUSEPORT: - case SO_BROADCAST: - case SO_OOBINLINE: - *mtod(m, int *) = so->so_options & optname; - break; - - case SO_TYPE: - *mtod(m, int *) = so->so_type; - break; - - case SO_ERROR: - *mtod(m, int *) = so->so_error; - so->so_error = 0; - break; - - case SO_SNDBUF: - *mtod(m, int *) = so->so_snd.sb_hiwat; - break; - - case SO_RCVBUF: - *mtod(m, int *) = so->so_rcv.sb_hiwat; - break; - - case SO_SNDLOWAT: - *mtod(m, int *) = so->so_snd.sb_lowat; - break; - - case SO_RCVLOWAT: - *mtod(m, int *) = so->so_rcv.sb_lowat; - break; - - case SO_SNDTIMEO: - case SO_RCVTIMEO: - { - int val = (optname == SO_SNDTIMEO ? - so->so_snd.sb_timeo : so->so_rcv.sb_timeo); - - m->m_len = sizeof(struct timeval); - mtod(m, struct timeval *)->tv_sec = val / hz; - mtod(m, struct timeval *)->tv_usec = - (val % hz) * tick; - break; - } - - default: - (void)m_free(m); - return (ENOPROTOOPT); - } - *mp = m; - return (0); - } -} - -void -sohasoutofband(so) - register struct socket *so; -{ - struct proc *p; - - if (so->so_pgid < 0) - gsignal(-so->so_pgid, SIGURG); - else if (so->so_pgid > 0 && (p = pfind(so->so_pgid)) != 0) - psignal(p, SIGURG); -#ifndef __REACTOS__ - selwakeup(so, &so->so_rcv.sb_sel); -#else - sorwakeup(so); -#endif -} diff --git a/lib/drivers/oskittcp/oskittcp/uipc_socket2.c b/lib/drivers/oskittcp/oskittcp/uipc_socket2.c deleted file mode 100644 index 4155922d804..00000000000 --- a/lib/drivers/oskittcp/oskittcp/uipc_socket2.c +++ /dev/null @@ -1,819 +0,0 @@ -/* - * Copyright (c) 1982, 1986, 1988, 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)uipc_socket2.c 8.1 (Berkeley) 6/10/93 - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* - * Primitive routines for operating on sockets and socket buffers - */ - -/* strings for sleep message: */ -char netio[] = "netio"; -char netcon[] = "netcon"; -char netcls[] = "netcls"; - -/* these two are sysctl visible */ -u_long sb_max = SB_MAX; /* patchable */ - -u_long sb_efficiency = 8; /* parameter for sbreserve() */ - -int sominqueue = 0; /* minimum queue override */ - -/* - * Procedures to manipulate state flags of socket - * and do appropriate wakeups. Normal sequence from the - * active (originating) side is that soisconnecting() is - * called during processing of connect() call, - * resulting in an eventual call to soisconnected() if/when the - * connection is established. When the connection is torn down - * soisdisconnecting() is called during processing of disconnect() call, - * and soisdisconnected() is called when the connection to the peer - * is totally severed. The semantics of these routines are such that - * connectionless protocols can call soisconnected() and soisdisconnected() - * only, bypassing the in-progress calls when setting up a ``connection'' - * takes no time. - * - * From the passive side, a socket is created with - * two queues of sockets: so_q0 for connections in progress - * and so_q for connections already made and awaiting user acceptance. - * As a protocol is preparing incoming connections, it creates a socket - * structure queued on so_q0 by calling sonewconn(). When the connection - * is established, soisconnected() is called, and transfers the - * socket structure to so_q, making it available to accept(). - * - * If a socket is closed with sockets on either - * so_q0 or so_q, these sockets are dropped. - * - * If higher level protocols are implemented in - * the kernel, the wakeups done here will sometimes - * cause software-interrupt process scheduling. - */ - -void -soisconnecting(so) - register struct socket *so; -{ - OS_DbgPrint(OSK_MID_TRACE,("Called %x\n", so)); - so->so_state &= ~(SS_ISCONNECTED|SS_ISDISCONNECTING); - so->so_state |= SS_ISCONNECTING; -} - -void -soisconnected(so) - register struct socket *so; -{ - register struct socket *head = so->so_head; - - OS_DbgPrint(OSK_MID_TRACE,("Called %x\n", so)); - - so->so_state &= ~(SS_ISCONNECTING|SS_ISDISCONNECTING|SS_ISCONFIRMING); - so->so_state |= SS_ISCONNECTED; - if (head && soqremque(so, 0)) { - soqinsque(head, so, 1); - sorwakeup(head); - wakeup(so, (caddr_t)&head->so_timeo); - } else { - wakeup(so, (caddr_t)&so->so_timeo); -#ifndef __REACTOS__ - sorwakeup(so); - sowwakeup(so); -#endif - } -} - -void -soisdisconnecting(so) - register struct socket *so; -{ - OS_DbgPrint(OSK_MID_TRACE,("Called %x\n", so)); - so->so_state &= ~SS_ISCONNECTING; - so->so_state |= (SS_ISDISCONNECTING|SS_CANTRCVMORE|SS_CANTSENDMORE); - wakeup(so, (caddr_t)&so->so_timeo); -#ifndef __REACTOS__ - sowwakeup(so); - sorwakeup(so); -#endif -} - -void -soisdisconnected(so) - register struct socket *so; -{ - OS_DbgPrint(OSK_MID_TRACE,("Called %x\n", so)); - - so->so_state &= ~(SS_ISCONNECTING|SS_ISCONNECTED|SS_ISDISCONNECTING); - so->so_state |= (SS_CANTRCVMORE|SS_CANTSENDMORE); - wakeup(so, (caddr_t)&so->so_timeo); -#ifndef __REACTOS__ - sowwakeup(so); - sorwakeup(so); -#endif -} - -/* - * When an attempt at a new connection is noted on a socket - * which accepts connections, sonewconn is called. If the - * connection is possible (subject to space constraints, etc.) - * then we allocate a new structure, propoerly linked into the - * data structure of the original socket, and return this. - * Connstatus may be 0, or SO_ISCONFIRMING, or SO_ISCONNECTED. - * - * Currently, sonewconn() is defined as sonewconn1() in socketvar.h - * to catch calls that are missing the (new) second parameter. - */ -struct socket * -sonewconn1(head, connstatus) - register struct socket *head; - int connstatus; -{ - register struct socket *so; - int soqueue = connstatus ? 1 : 0; - - OS_DbgPrint(OSK_MID_TRACE,("Called %x\n", head)); - - if ((head->so_qlen + head->so_q0len > 3 * head->so_qlimit / 2) && - (head->so_qlen + head->so_q0len > sominqueue)) - return ((struct socket *)0); - MALLOC(so, struct socket *, sizeof(*so), M_SOCKET, M_DONTWAIT); - if (so == NULL) - return ((struct socket *)0); - bzero((caddr_t)so, sizeof(*so)); - so->so_type = head->so_type; - so->so_options = head->so_options &~ SO_ACCEPTCONN; - so->so_linger = head->so_linger; - so->so_state = head->so_state | SS_NOFDREF; - so->so_proto = head->so_proto; - so->so_timeo = head->so_timeo; - so->so_pgid = head->so_pgid; - (void) soreserve(so, head->so_snd.sb_hiwat, head->so_rcv.sb_hiwat); - soqinsque(head, so, soqueue); - if ((*so->so_proto->pr_usrreq)(so, PRU_ATTACH, - (struct mbuf *)0, (struct mbuf *)0, (struct mbuf *)0)) { - (void) soqremque(so, soqueue); - (void) free((caddr_t)so, M_SOCKET); - return ((struct socket *)0); - } - if (connstatus) { -#ifndef __REACTOS__ - sorwakeup(head); -#endif - wakeup(head, (caddr_t)&head->so_timeo); - so->so_state |= connstatus; - } - return (so); -} - -void -soqinsque(head, so, q) - register struct socket *head, *so; - int q; -{ - - register struct socket **prev; - so->so_head = head; - if (q == 0) { - head->so_q0len++; - so->so_q0 = 0; - for (prev = &(head->so_q0); *prev; ) - prev = &((*prev)->so_q0); - } else { - head->so_qlen++; - so->so_q = 0; - for (prev = &(head->so_q); *prev; ) - prev = &((*prev)->so_q); - } - *prev = so; -} - -int -soqremque(so, q) - register struct socket *so; - int q; -{ - register struct socket *head, *prev, *next; - - head = so->so_head; - prev = head; - for (;;) { - next = q ? prev->so_q : prev->so_q0; - if (next == so) - break; - if (next == 0) - return (0); - prev = next; - } - if (q == 0) { - prev->so_q0 = next->so_q0; - head->so_q0len--; - } else { - prev->so_q = next->so_q; - head->so_qlen--; - } - next->so_q0 = next->so_q = 0; - next->so_head = 0; - return (1); -} - -/* - * Socantsendmore indicates that no more data will be sent on the - * socket; it would normally be applied to a socket when the user - * informs the system that no more data is to be sent, by the protocol - * code (in case PRU_SHUTDOWN). Socantrcvmore indicates that no more data - * will be received, and will normally be applied to the socket by a - * protocol when it detects that the peer will send no more data. - * Data queued for reading in the socket may yet be read. - */ - -void -socantsendmore(so) - struct socket *so; -{ - - so->so_state |= SS_CANTSENDMORE; - sowwakeup(so); -} - -void -socantrcvmore(so) - struct socket *so; -{ - - so->so_state |= SS_CANTRCVMORE; - sorwakeup(so); -} - -/* - * Wait for data to arrive at/drain from a socket buffer. - */ -int -sbwait(sb) - struct sockbuf *sb; -{ - - sb->sb_flags |= SB_WAIT; - return (tsleep((caddr_t)&sb->sb_cc, - (sb->sb_flags & SB_NOINTR) ? PSOCK : PSOCK | PCATCH, netio, - sb->sb_timeo)); -} - -/* - * Lock a sockbuf already known to be locked; - * return any error returned from sleep (EINTR). - */ -int -sb_lock(sb) - register struct sockbuf *sb; -{ - int error; - - while (sb->sb_flags & SB_LOCK) { - sb->sb_flags |= SB_WANT; - error = tsleep((caddr_t)&sb->sb_flags, - (sb->sb_flags & SB_NOINTR) ? PSOCK : PSOCK|PCATCH, - netio, 0); - if (error) - return (error); - } - sb->sb_flags |= SB_LOCK; - return (0); -} - -/* - * Wakeup processes waiting on a socket buffer. - * Do asynchronous notification via SIGIO - * if the socket has the SS_ASYNC flag set. - */ -void -sowakeup(so, sb) - register struct socket *so; - register struct sockbuf *sb; -{ - struct proc *p; - - wakeup(so, &sb->sb_sel); -#ifndef OSKIT - /* - * in the OS Kit, we do not want notifications to stop - */ - sb->sb_flags &= ~SB_SEL; -#endif - if (sb->sb_flags & SB_WAIT) { - sb->sb_flags &= ~SB_WAIT; - wakeup(so, (caddr_t)&sb->sb_cc); - } - if (so->so_state & SS_ASYNC) { - if (so->so_pgid < 0) - gsignal(-so->so_pgid, SIGIO); - else if (so->so_pgid > 0 && (p = pfind(so->so_pgid)) != 0) - psignal(p, SIGIO); - } -} - -/* - * Socket buffer (struct sockbuf) utility routines. - * - * Each socket contains two socket buffers: one for sending data and - * one for receiving data. Each buffer contains a queue of mbufs, - * information about the number of mbufs and amount of data in the - * queue, and other fields allowing select() statements and notification - * on data availability to be implemented. - * - * Data stored in a socket buffer is maintained as a list of records. - * Each record is a list of mbufs chained together with the m_next - * field. Records are chained together with the m_nextpkt field. The upper - * level routine soreceive() expects the following conventions to be - * observed when placing information in the receive buffer: - * - * 1. If the protocol requires each message be preceded by the sender's - * name, then a record containing that name must be present before - * any associated data (mbuf's must be of type MT_SONAME). - * 2. If the protocol supports the exchange of ``access rights'' (really - * just additional data associated with the message), and there are - * ``rights'' to be received, then a record containing this data - * should be present (mbuf's must be of type MT_RIGHTS). - * 3. If a name or rights record exists, then it must be followed by - * a data record, perhaps of zero length. - * - * Before using a new socket structure it is first necessary to reserve - * buffer space to the socket, by calling sbreserve(). This should commit - * some of the available buffer space in the system buffer pool for the - * socket (currently, it does nothing but enforce limits). The space - * should be released by calling sbrelease() when the socket is destroyed. - */ - -int -soreserve(so, sndcc, rcvcc) - register struct socket *so; - u_long sndcc, rcvcc; -{ - - if (sbreserve(&so->so_snd, sndcc) == 0) - goto bad; - if (sbreserve(&so->so_rcv, rcvcc) == 0) - goto bad2; - if (so->so_rcv.sb_lowat == 0) - so->so_rcv.sb_lowat = 1; - if (so->so_snd.sb_lowat == 0) - so->so_snd.sb_lowat = MCLBYTES; - if (so->so_snd.sb_lowat > so->so_snd.sb_hiwat) - so->so_snd.sb_lowat = so->so_snd.sb_hiwat; - return (0); -bad2: - sbrelease(&so->so_snd); -bad: - return (ENOBUFS); -} - -/* - * Allot mbufs to a sockbuf. - * Attempt to scale mbmax so that mbcnt doesn't become limiting - * if buffering efficiency is near the normal case. - */ -int -sbreserve(sb, cc) - struct sockbuf *sb; - u_long cc; -{ - - if (cc > sb_max * MCLBYTES / (MSIZE + MCLBYTES)) - return (0); - sb->sb_hiwat = cc; - sb->sb_mbmax = min(cc * sb_efficiency, sb_max); - if (sb->sb_lowat > sb->sb_hiwat) - sb->sb_lowat = sb->sb_hiwat; - return (1); -} - -/* - * Free mbufs held by a socket, and reserved mbuf space. - */ -void -sbrelease(sb) - struct sockbuf *sb; -{ - - sbflush(sb); - sb->sb_hiwat = sb->sb_mbmax = 0; -} - -/* - * Routines to add and remove - * data from an mbuf queue. - * - * The routines sbappend() or sbappendrecord() are normally called to - * append new mbufs to a socket buffer, after checking that adequate - * space is available, comparing the function sbspace() with the amount - * of data to be added. sbappendrecord() differs from sbappend() in - * that data supplied is treated as the beginning of a new record. - * To place a sender's address, optional access rights, and data in a - * socket receive buffer, sbappendaddr() should be used. To place - * access rights and data in a socket receive buffer, sbappendrights() - * should be used. In either case, the new data begins a new record. - * Note that unlike sbappend() and sbappendrecord(), these routines check - * for the caller that there will be enough space to store the data. - * Each fails if there is not enough space, or if it cannot find mbufs - * to store additional information in. - * - * Reliable protocols may use the socket send buffer to hold data - * awaiting acknowledgement. Data is normally copied from a socket - * send buffer in a protocol with m_copy for output to a peer, - * and then removing the data from the socket buffer with sbdrop() - * or sbdroprecord() when the data is acknowledged by the peer. - */ - -/* - * Append mbuf chain m to the last record in the - * socket buffer sb. The additional space associated - * the mbuf chain is recorded in sb. Empty mbufs are - * discarded and mbufs are compacted where possible. - */ -void -sbappend(sb, m) - struct sockbuf *sb; - struct mbuf *m; -{ - register struct mbuf *n; - - OS_DbgPrint(OSK_MID_TRACE,("Called\n")); - - if (m == 0) - return; - n = sb->sb_mb; - if (n) { - while (n->m_nextpkt) - n = n->m_nextpkt; - do { - if (n->m_flags & M_EOR) { - sbappendrecord(sb, m); /* XXXXXX!!!! */ - OS_DbgPrint(OSK_MID_TRACE,("Leaving (rec)\n")); - return; - } - } while (n->m_next && (n = n->m_next)); - } - sbcompress(sb, m, n); - - OS_DbgPrint(OSK_MID_TRACE,("Leaving\n")); -} - -#ifdef SOCKBUF_DEBUG -void -sbcheck(sb) - register struct sockbuf *sb; -{ - register struct mbuf *m; - register int len = 0, mbcnt = 0; - - for (m = sb->sb_mb; m; m = m->m_next) { - len += m->m_len; - mbcnt += MSIZE; - if (m->m_flags & M_EXT) - mbcnt += m->m_ext.ext_size; - if (m->m_nextpkt) - panic("sbcheck nextpkt"); - } - if (len != sb->sb_cc || mbcnt != sb->sb_mbcnt) { - printf("cc %d != %d || mbcnt %d != %d\n", len, sb->sb_cc, - mbcnt, sb->sb_mbcnt); - panic("sbcheck"); - } -} -#endif - -/* - * As above, except the mbuf chain - * begins a new record. - */ -void -sbappendrecord(sb, m0) - register struct sockbuf *sb; - register struct mbuf *m0; -{ - register struct mbuf *m; - - if (m0 == 0) - return; - m = sb->sb_mb; - if (m) - while (m->m_nextpkt) - m = m->m_nextpkt; - /* - * Put the first mbuf on the queue. - * Note this permits zero length records. - */ - sballoc(sb, m0); - if (m) - m->m_nextpkt = m0; - else - sb->sb_mb = m0; - m = m0->m_next; - m0->m_next = 0; - if (m && (m0->m_flags & M_EOR)) { - m0->m_flags &= ~M_EOR; - m->m_flags |= M_EOR; - } - sbcompress(sb, m, m0); -} - -/* - * As above except that OOB data - * is inserted at the beginning of the sockbuf, - * but after any other OOB data. - */ -void -sbinsertoob(sb, m0) - register struct sockbuf *sb; - register struct mbuf *m0; -{ - register struct mbuf *m; - register struct mbuf **mp; - - if (m0 == 0) - return; - for (mp = &sb->sb_mb; *mp ; mp = &((*mp)->m_nextpkt)) { - m = *mp; - again: - switch (m->m_type) { - - case MT_OOBDATA: - continue; /* WANT next train */ - - case MT_CONTROL: - m = m->m_next; - if (m) - goto again; /* inspect THIS train further */ - } - break; - } - /* - * Put the first mbuf on the queue. - * Note this permits zero length records. - */ - sballoc(sb, m0); - m0->m_nextpkt = *mp; - *mp = m0; - m = m0->m_next; - m0->m_next = 0; - if (m && (m0->m_flags & M_EOR)) { - m0->m_flags &= ~M_EOR; - m->m_flags |= M_EOR; - } - sbcompress(sb, m, m0); -} - -/* - * Append address and data, and optionally, control (ancillary) data - * to the receive queue of a socket. If present, - * m0 must include a packet header with total length. - * Returns 0 if no space in sockbuf or insufficient mbufs. - */ -int -sbappendaddr(sb, asa, m0, control) - register struct sockbuf *sb; - struct sockaddr *asa; - struct mbuf *m0, *control; -{ - register struct mbuf *m, *n; - int space = asa->sa_len; - -if (m0 && (m0->m_flags & M_PKTHDR) == 0) -panic("sbappendaddr"); - if (m0) - space += m0->m_pkthdr.len; - for (n = control; n; n = n->m_next) { - space += n->m_len; - if (n->m_next == 0) /* keep pointer to last control buf */ - break; - } - if (space > sbspace(sb)) - return (0); - if (asa->sa_len > MLEN) - return (0); - MGET(m, M_DONTWAIT, MT_SONAME); - if (m == 0) - return (0); - m->m_len = asa->sa_len; - bcopy((caddr_t)asa, mtod(m, caddr_t), asa->sa_len); - if (n) - n->m_next = m0; /* concatenate data to control */ - else - control = m0; - m->m_next = control; - for (n = m; n; n = n->m_next) - sballoc(sb, n); - n = sb->sb_mb; - if (n) { - while (n->m_nextpkt) - n = n->m_nextpkt; - n->m_nextpkt = m; - } else - sb->sb_mb = m; - return (1); -} - -int -sbappendcontrol(sb, m0, control) - struct sockbuf *sb; - struct mbuf *control, *m0; -{ - register struct mbuf *m, *n; - int space = 0; - - if (control == 0) - panic("sbappendcontrol"); - for (m = control; ; m = m->m_next) { - space += m->m_len; - if (m->m_next == 0) - break; - } - n = m; /* save pointer to last control buffer */ - for (m = m0; m; m = m->m_next) - space += m->m_len; - if (space > sbspace(sb)) - return (0); - n->m_next = m0; /* concatenate data to control */ - for (m = control; m; m = m->m_next) - sballoc(sb, m); - n = sb->sb_mb; - if (n) { - while (n->m_nextpkt) - n = n->m_nextpkt; - n->m_nextpkt = control; - } else - sb->sb_mb = control; - return (1); -} - -/* - * Compress mbuf chain m into the socket - * buffer sb following mbuf n. If n - * is null, the buffer is presumed empty. - */ -void -sbcompress(sb, m, n) - register struct sockbuf *sb; - register struct mbuf *m, *n; -{ - register int eor = 0; - register struct mbuf *o; - - while (m) { - eor |= m->m_flags & M_EOR; - if (m->m_len == 0 && - (eor == 0 || - (((o = m->m_next) || (o = n)) && - o->m_type == m->m_type))) { - m = m_free(m); - continue; - } - if (n && (n->m_flags & (M_EXT | M_EOR)) == 0 && - (n->m_data + n->m_len + m->m_len) < &n->m_dat[MLEN] && - n->m_type == m->m_type) { - bcopy(mtod(m, caddr_t), mtod(n, caddr_t) + n->m_len, - (unsigned)m->m_len); - n->m_len += m->m_len; - sb->sb_cc += m->m_len; - m = m_free(m); - continue; - } - if (n) - n->m_next = m; - else - sb->sb_mb = m; - sballoc(sb, m); - n = m; - m->m_flags &= ~M_EOR; - m = m->m_next; - n->m_next = 0; - } - if (eor) { - if (n) - n->m_flags |= eor; - else - printf("semi-panic: sbcompress\n"); - } -} - -/* - * Free all mbufs in a sockbuf. - * Check that all resources are reclaimed. - */ -void -sbflush(sb) - register struct sockbuf *sb; -{ - - if (sb->sb_flags & SB_LOCK) - panic("sbflush"); - while (sb->sb_mbcnt) - sbdrop(sb, (int)sb->sb_cc); - if (sb->sb_cc || sb->sb_mb) - panic("sbflush 2"); -} - -/* - * Drop data from (the front of) a sockbuf. - */ -void -sbdrop(sb, len) - register struct sockbuf *sb; - register int len; -{ - register struct mbuf *m, *mn; - struct mbuf *next; - - next = (m = sb->sb_mb) ? m->m_nextpkt : 0; - while (len > 0) { - if (m == 0) { - if (next == 0) - panic("sbdrop"); - m = next; - next = m->m_nextpkt; - continue; - } - if (m->m_len > len) { - m->m_len -= len; - m->m_data += len; - sb->sb_cc -= len; - break; - } - len -= m->m_len; - sbfree(sb, m); - MFREE(m, mn); - m = mn; - } - while (m && m->m_len == 0) { - sbfree(sb, m); - MFREE(m, mn); - m = mn; - } - if (m) { - sb->sb_mb = m; - m->m_nextpkt = next; - } else - sb->sb_mb = next; -} - -/* - * Drop a record off the front of a sockbuf - * and move the next record to the front. - */ -void -sbdroprecord(sb) - register struct sockbuf *sb; -{ - register struct mbuf *m, *mn; - - m = sb->sb_mb; - if (m) { - sb->sb_mb = m->m_nextpkt; - do { - sbfree(sb, m); - MFREE(m, mn); - m = mn; - } while (m); - } -} diff --git a/lib/drivers/sound/CMakeLists.txt b/lib/drivers/sound/CMakeLists.txt index 17bc771d157..3865a53aaf8 100644 --- a/lib/drivers/sound/CMakeLists.txt +++ b/lib/drivers/sound/CMakeLists.txt @@ -1,5 +1,5 @@ -add_subdirectory(legacy) +#add_subdirectory(legacy) add_subdirectory(mmebuddy) add_subdirectory(mment4) add_subdirectory(mmixer) diff --git a/lib/drivers/sound/mmebuddy/CMakeLists.txt b/lib/drivers/sound/mmebuddy/CMakeLists.txt index 19af9789f1c..a4c04f261ed 100644 --- a/lib/drivers/sound/mmebuddy/CMakeLists.txt +++ b/lib/drivers/sound/mmebuddy/CMakeLists.txt @@ -26,4 +26,5 @@ list(APPEND SOURCE wave/streaming.c) add_library(mmebuddy ${SOURCE}) +add_pch(mmebuddy precomp.h) add_dependencies(mmebuddy psdk) diff --git a/lib/drivers/sound/mmebuddy/auxiliary/auxMessage.c b/lib/drivers/sound/mmebuddy/auxiliary/auxMessage.c index 9cfa0d941e6..6a164de0c8b 100644 --- a/lib/drivers/sound/mmebuddy/auxiliary/auxMessage.c +++ b/lib/drivers/sound/mmebuddy/auxiliary/auxMessage.c @@ -9,14 +9,7 @@ * PROGRAMMERS: Andrew Greenwood (silverblade@reactos.org) */ -#include -#include -#include - -#include -#include - -#include +#include "precomp.h" /* Standard MME driver entry-point for messages relating to auxiliary devices. diff --git a/lib/drivers/sound/mmebuddy/capabilities.c b/lib/drivers/sound/mmebuddy/capabilities.c index edf75990783..aa257078fa4 100644 --- a/lib/drivers/sound/mmebuddy/capabilities.c +++ b/lib/drivers/sound/mmebuddy/capabilities.c @@ -8,12 +8,7 @@ * PROGRAMMERS: Andrew Greenwood (silverblade@reactos.org) */ -#include -#include -#include -#include -#include -#include +#include "precomp.h" /* Obtains the capabilities of a sound device. This routine ensures that the diff --git a/lib/drivers/sound/mmebuddy/deviceinstance.c b/lib/drivers/sound/mmebuddy/deviceinstance.c index 0558b2b4501..33f23e3105f 100644 --- a/lib/drivers/sound/mmebuddy/deviceinstance.c +++ b/lib/drivers/sound/mmebuddy/deviceinstance.c @@ -8,10 +8,7 @@ * PROGRAMMERS: Andrew Greenwood (silverblade@reactos.org) */ -#include -#include -#include -#include +#include "precomp.h" /* Restrain ourselves from flooding the kernel device! diff --git a/lib/drivers/sound/mmebuddy/devicelist.c b/lib/drivers/sound/mmebuddy/devicelist.c index e4e4791012e..c2003927320 100644 --- a/lib/drivers/sound/mmebuddy/devicelist.c +++ b/lib/drivers/sound/mmebuddy/devicelist.c @@ -8,12 +8,7 @@ * PROGRAMMERS: Andrew Greenwood (silverblade@reactos.org) */ -#include -#include -#include -#include -#include -#include +#include "precomp.h" ULONG SoundDeviceCounts[SOUND_DEVICE_TYPES]; PSOUND_DEVICE SoundDeviceListHeads[SOUND_DEVICE_TYPES]; diff --git a/lib/drivers/sound/mmebuddy/functiontable.c b/lib/drivers/sound/mmebuddy/functiontable.c index 18d7d765299..ce5b38b2431 100644 --- a/lib/drivers/sound/mmebuddy/functiontable.c +++ b/lib/drivers/sound/mmebuddy/functiontable.c @@ -10,10 +10,7 @@ * PROGRAMMERS: Andrew Greenwood (silverblade@reactos.org) */ -#include -#include -#include -#include +#include "precomp.h" /* Attaches a function table to a sound device. Any NULL entries in this diff --git a/lib/drivers/sound/mmebuddy/kernel.c b/lib/drivers/sound/mmebuddy/kernel.c index 62766b0c6a7..63b57a41f96 100644 --- a/lib/drivers/sound/mmebuddy/kernel.c +++ b/lib/drivers/sound/mmebuddy/kernel.c @@ -9,11 +9,7 @@ * PROGRAMMERS: Andrew Greenwood (silverblade@reactos.org) */ -#include -#include -#include -#include -#include +#include "precomp.h" /* Wraps around CreateFile in order to provide a simpler interface tailored diff --git a/lib/drivers/sound/mmebuddy/midi/midMessage.c b/lib/drivers/sound/mmebuddy/midi/midMessage.c index 95738d78d89..d9a9f9c5273 100644 --- a/lib/drivers/sound/mmebuddy/midi/midMessage.c +++ b/lib/drivers/sound/mmebuddy/midi/midMessage.c @@ -9,14 +9,7 @@ * PROGRAMMERS: Andrew Greenwood (silverblade@reactos.org) */ -#include -#include -#include - -#include -#include - -#include +#include "precomp.h" /* Standard MME driver entry-point for messages relating to MIDI input. diff --git a/lib/drivers/sound/mmebuddy/midi/modMessage.c b/lib/drivers/sound/mmebuddy/midi/modMessage.c index d189b03fd1b..e6c09004a5b 100644 --- a/lib/drivers/sound/mmebuddy/midi/modMessage.c +++ b/lib/drivers/sound/mmebuddy/midi/modMessage.c @@ -9,14 +9,7 @@ * PROGRAMMERS: Andrew Greenwood (silverblade@reactos.org) */ -#include -#include -#include - -#include -#include - -#include +#include "precomp.h" /* Standard MME driver entry-point for messages relating to MIDI output. diff --git a/lib/drivers/sound/mmebuddy/mixer/mxdMessage.c b/lib/drivers/sound/mmebuddy/mixer/mxdMessage.c index 7652d9ef7ea..aa196993b6d 100644 --- a/lib/drivers/sound/mmebuddy/mixer/mxdMessage.c +++ b/lib/drivers/sound/mmebuddy/mixer/mxdMessage.c @@ -9,14 +9,7 @@ * PROGRAMMERS: Andrew Greenwood (silverblade@reactos.org) */ -#include -#include -#include - -#include -#include -#undef NDEBUG -#include +#include "precomp.h" MMRESULT MmeGetLineInfo( diff --git a/lib/drivers/sound/mmebuddy/mmebuddy.rbuild b/lib/drivers/sound/mmebuddy/mmebuddy.rbuild index bb108747349..5c646a4fa3c 100644 --- a/lib/drivers/sound/mmebuddy/mmebuddy.rbuild +++ b/lib/drivers/sound/mmebuddy/mmebuddy.rbuild @@ -7,11 +7,11 @@ devicelist.c deviceinstance.c functiontable.c - mmewrap.c + mmewrap.c reentrancy.c utility.c kernel.c - thread.c + thread.c widMessage.c wodMessage.c @@ -29,4 +29,5 @@ auxMessage.c + precomp.h diff --git a/lib/drivers/sound/mmebuddy/mmewrap.c b/lib/drivers/sound/mmebuddy/mmewrap.c index 5b651540bde..bf850d24257 100644 --- a/lib/drivers/sound/mmebuddy/mmewrap.c +++ b/lib/drivers/sound/mmebuddy/mmewrap.c @@ -8,12 +8,7 @@ * PROGRAMMERS: Andrew Greenwood (silverblade@reactos.org) */ -#include -#include -#include -#include -#include -#include +#include "precomp.h" /* diff --git a/lib/drivers/sound/mmebuddy/precomp.h b/lib/drivers/sound/mmebuddy/precomp.h new file mode 100644 index 00000000000..c1fa03c9264 --- /dev/null +++ b/lib/drivers/sound/mmebuddy/precomp.h @@ -0,0 +1,6 @@ +#include +#include +#include +#include +#include +#include diff --git a/lib/drivers/sound/mmebuddy/reentrancy.c b/lib/drivers/sound/mmebuddy/reentrancy.c index 16ed1a1f9bb..8fc41bb10af 100644 --- a/lib/drivers/sound/mmebuddy/reentrancy.c +++ b/lib/drivers/sound/mmebuddy/reentrancy.c @@ -8,12 +8,7 @@ * PROGRAMMERS: Andrew Greenwood (silverblade@reactos.org) */ -#include -#include -#include -#include -#include -#include +#include "precomp.h" HANDLE EntrypointMutexes[SOUND_DEVICE_TYPES]; diff --git a/lib/drivers/sound/mmebuddy/thread.c b/lib/drivers/sound/mmebuddy/thread.c index 625cf9654de..484758279c0 100644 --- a/lib/drivers/sound/mmebuddy/thread.c +++ b/lib/drivers/sound/mmebuddy/thread.c @@ -8,11 +8,7 @@ * PROGRAMMERS: Andrew Greenwood (silverblade@reactos.org) */ -#include -#include -#include -#include -#include +#include "precomp.h" DWORD WINAPI SoundThreadMain( diff --git a/lib/drivers/sound/mmebuddy/utility.c b/lib/drivers/sound/mmebuddy/utility.c index 0a53fdf43a8..18c2d7638b7 100644 --- a/lib/drivers/sound/mmebuddy/utility.c +++ b/lib/drivers/sound/mmebuddy/utility.c @@ -8,11 +8,7 @@ * PROGRAMMERS: Andrew Greenwood (silverblade@reactos.org) */ -#include -#include -#include - -#include +#include "precomp.h" static HANDLE ProcessHeapHandle = NULL; static UINT CurrentAllocations = 0; diff --git a/lib/drivers/sound/mmebuddy/wave/format.c b/lib/drivers/sound/mmebuddy/wave/format.c index 34541c4fa0c..b3076b717cc 100644 --- a/lib/drivers/sound/mmebuddy/wave/format.c +++ b/lib/drivers/sound/mmebuddy/wave/format.c @@ -8,12 +8,7 @@ * PROGRAMMERS: Andrew Greenwood (silverblade@reactos.org) */ -#include -#include -#include -#include -#include -#include +#include "precomp.h" MMRESULT QueryWaveDeviceFormatSupport( diff --git a/lib/drivers/sound/mmebuddy/wave/header.c b/lib/drivers/sound/mmebuddy/wave/header.c index 998edef57af..bb80270f308 100644 --- a/lib/drivers/sound/mmebuddy/wave/header.c +++ b/lib/drivers/sound/mmebuddy/wave/header.c @@ -8,12 +8,7 @@ * PROGRAMMERS: Andrew Greenwood (silverblade@reactos.org) */ -#include -#include -#include -#include -#include -#include +#include "precomp.h" /* diff --git a/lib/drivers/sound/mmebuddy/wave/streaming.c b/lib/drivers/sound/mmebuddy/wave/streaming.c index d892f2d1f36..3a4cabc9385 100644 --- a/lib/drivers/sound/mmebuddy/wave/streaming.c +++ b/lib/drivers/sound/mmebuddy/wave/streaming.c @@ -8,12 +8,7 @@ * PROGRAMMERS: Andrew Greenwood (silverblade@reactos.org) */ -#include -#include -#include -#include -#include -#include +#include "precomp.h" /* diff --git a/lib/drivers/sound/mmebuddy/wave/widMessage.c b/lib/drivers/sound/mmebuddy/wave/widMessage.c index 6584d3d7bac..81fd344a413 100644 --- a/lib/drivers/sound/mmebuddy/wave/widMessage.c +++ b/lib/drivers/sound/mmebuddy/wave/widMessage.c @@ -9,14 +9,7 @@ * PROGRAMMERS: Andrew Greenwood (silverblade@reactos.org) */ -#include -#include -#include - -#include -#include - -#include +#include "precomp.h" /* Standard MME driver entry-point for messages relating to wave audio diff --git a/lib/drivers/sound/mmebuddy/wave/wodMessage.c b/lib/drivers/sound/mmebuddy/wave/wodMessage.c index a1202a8e5cc..e73bdf0ecc8 100644 --- a/lib/drivers/sound/mmebuddy/wave/wodMessage.c +++ b/lib/drivers/sound/mmebuddy/wave/wodMessage.c @@ -9,14 +9,7 @@ * PROGRAMMERS: Andrew Greenwood (silverblade@reactos.org) */ -#include -#include -#include - -#include -#include - -#include +#include "precomp.h" #if 0 MMRESULT HelloWorld(PSOUND_DEVICE_INSTANCE Instance, PVOID String) diff --git a/lib/drivers/sound/mment4/CMakeLists.txt b/lib/drivers/sound/mment4/CMakeLists.txt index da02da9f7f3..96ab5293d76 100644 --- a/lib/drivers/sound/mment4/CMakeLists.txt +++ b/lib/drivers/sound/mment4/CMakeLists.txt @@ -11,4 +11,5 @@ list(APPEND SOURCE control.c) add_library(mment4 ${SOURCE}) +add_pch(mment4 precomp.h) add_dependencies(mment4 psdk) diff --git a/lib/drivers/sound/mment4/control.c b/lib/drivers/sound/mment4/control.c index 077620bf7ec..66a5c0991c7 100644 --- a/lib/drivers/sound/mment4/control.c +++ b/lib/drivers/sound/mment4/control.c @@ -9,14 +9,7 @@ */ #define NDEBUG - -#include -#include -#include -#include -#include -#include -#include +#include "precomp.h" /* Convenience routine for getting the path of a device and opening it. diff --git a/lib/drivers/sound/mment4/detect.c b/lib/drivers/sound/mment4/detect.c index 06d03411d1d..dd5d9ac2410 100644 --- a/lib/drivers/sound/mment4/detect.c +++ b/lib/drivers/sound/mment4/detect.c @@ -11,15 +11,7 @@ * PROGRAMMERS: Andrew Greenwood (silverblade@reactos.org) */ -#include -#include -#include -#include -#include -#include - -#include -#include +#include "precomp.h" /* This is the "nice" way to discover audio devices in NT4 - go into the diff --git a/lib/drivers/sound/mment4/mment4.rbuild b/lib/drivers/sound/mment4/mment4.rbuild index dbd777e36fb..f0e59ba6532 100644 --- a/lib/drivers/sound/mment4/mment4.rbuild +++ b/lib/drivers/sound/mment4/mment4.rbuild @@ -5,5 +5,6 @@ 1 detect.c registry.c - control.c + control.c + precomp.h diff --git a/lib/drivers/sound/mment4/precomp.h b/lib/drivers/sound/mment4/precomp.h new file mode 100644 index 00000000000..cece5d1ea25 --- /dev/null +++ b/lib/drivers/sound/mment4/precomp.h @@ -0,0 +1,8 @@ +#include +#include +#include +#include +#include +#include +#include +#include diff --git a/lib/drivers/sound/mment4/registry.c b/lib/drivers/sound/mment4/registry.c index a606ef77736..aa6dbeac678 100644 --- a/lib/drivers/sound/mment4/registry.c +++ b/lib/drivers/sound/mment4/registry.c @@ -8,16 +8,7 @@ * PROGRAMMERS: Andrew Greenwood (silverblade@reactos.org) */ -#include -#include -#include -#include - -#include -#include - -#include -#include +#include "precomp.h" /* Open the parameters key of a sound driver. diff --git a/lib/drivers/sound/mmixer/CMakeLists.txt b/lib/drivers/sound/mmixer/CMakeLists.txt index 4edfc124e47..213b0800bdd 100644 --- a/lib/drivers/sound/mmixer/CMakeLists.txt +++ b/lib/drivers/sound/mmixer/CMakeLists.txt @@ -15,5 +15,6 @@ list(APPEND SOURCE topology.c) add_library(mmixer ${SOURCE}) +add_pch(mmixer priv.h) add_dependencies(mmixer bugcodes) diff --git a/lib/drivers/sound/mmixer/mmixer.rbuild b/lib/drivers/sound/mmixer/mmixer.rbuild index c2d7fdae645..79b09eefe17 100644 --- a/lib/drivers/sound/mmixer/mmixer.rbuild +++ b/lib/drivers/sound/mmixer/mmixer.rbuild @@ -10,4 +10,5 @@ sup.c wave.c topology.c + priv.h diff --git a/lib/drivers/sound/mmixer/priv.h b/lib/drivers/sound/mmixer/priv.h index 3746f6d247b..d5446b81b37 100644 --- a/lib/drivers/sound/mmixer/priv.h +++ b/lib/drivers/sound/mmixer/priv.h @@ -1,5 +1,3 @@ -#pragma once - #include #include diff --git a/lib/drivers/sound/soundblaster/CMakeLists.txt b/lib/drivers/sound/soundblaster/CMakeLists.txt index 96648442ea2..eaf49f91706 100644 --- a/lib/drivers/sound/soundblaster/CMakeLists.txt +++ b/lib/drivers/sound/soundblaster/CMakeLists.txt @@ -13,4 +13,5 @@ list(APPEND SOURCE mixer.c) add_library(soundblaster ${SOURCE}) +add_pch(soundblaster precomp.h) add_dependencies(soundblaster bugcodes) diff --git a/lib/drivers/sound/soundblaster/dsp_io.c b/lib/drivers/sound/soundblaster/dsp_io.c index 320efc1cab0..9dac6419554 100644 --- a/lib/drivers/sound/soundblaster/dsp_io.c +++ b/lib/drivers/sound/soundblaster/dsp_io.c @@ -13,11 +13,7 @@ Functions documented in sbdsp.h */ -#include -#include - -#include -#include +#include "precomp.h" NTSTATUS SbDspReset( diff --git a/lib/drivers/sound/soundblaster/mixer.c b/lib/drivers/sound/soundblaster/mixer.c index c6f9197eec0..3301317b8bc 100644 --- a/lib/drivers/sound/soundblaster/mixer.c +++ b/lib/drivers/sound/soundblaster/mixer.c @@ -18,10 +18,7 @@ The I/O switches are used for muting/unmuting mic, etc. */ -#include -#include - -#include +#include "precomp.h" VOID SbMixerReset(IN PUCHAR BasePort) diff --git a/lib/drivers/sound/soundblaster/precomp.h b/lib/drivers/sound/soundblaster/precomp.h new file mode 100644 index 00000000000..a6b29209b61 --- /dev/null +++ b/lib/drivers/sound/soundblaster/precomp.h @@ -0,0 +1,4 @@ +#include +#include +#include +#include diff --git a/lib/drivers/sound/soundblaster/rate.c b/lib/drivers/sound/soundblaster/rate.c index e539e7ef14c..6855f61a5cf 100644 --- a/lib/drivers/sound/soundblaster/rate.c +++ b/lib/drivers/sound/soundblaster/rate.c @@ -13,10 +13,7 @@ Functions documented in sbdsp.h */ -#include -#include - -#include +#include "precomp.h" BOOLEAN SbDspIsValidInputRate( diff --git a/lib/drivers/sound/soundblaster/soundblaster.rbuild b/lib/drivers/sound/soundblaster/soundblaster.rbuild index ab64c8c3588..24a37d1bcbe 100644 --- a/lib/drivers/sound/soundblaster/soundblaster.rbuild +++ b/lib/drivers/sound/soundblaster/soundblaster.rbuild @@ -10,4 +10,5 @@ speaker.c rate.c mixer.c + precomp.h diff --git a/lib/drivers/sound/soundblaster/speaker.c b/lib/drivers/sound/soundblaster/speaker.c index a7dc60540cf..a74a0b5d99f 100644 --- a/lib/drivers/sound/soundblaster/speaker.c +++ b/lib/drivers/sound/soundblaster/speaker.c @@ -13,10 +13,7 @@ Functions documented in sbdsp.h */ -#include -#include - -#include +#include "precomp.h" NTSTATUS SbDspEnableSpeaker( diff --git a/lib/drivers/sound/soundblaster/version.c b/lib/drivers/sound/soundblaster/version.c index 045d1662a29..c6f95fcd5dd 100644 --- a/lib/drivers/sound/soundblaster/version.c +++ b/lib/drivers/sound/soundblaster/version.c @@ -13,10 +13,7 @@ Functions documented in sbdsp.h */ -#include -#include - -#include +#include "precomp.h" NTSTATUS SbDspGetVersion( diff --git a/lib/epsapi/CMakeLists.txt b/lib/epsapi/CMakeLists.txt index 4eb87dfe28a..bbbeb7dd8b5 100644 --- a/lib/epsapi/CMakeLists.txt +++ b/lib/epsapi/CMakeLists.txt @@ -4,5 +4,5 @@ add_library(epsapi enum/modules.c enum/processes.c) +add_pch(epsapi enum/precomp.h) add_dependencies(epsapi psdk) - diff --git a/lib/epsapi/enum/drivers.c b/lib/epsapi/enum/drivers.c index 179b698f15d..961628da76e 100644 --- a/lib/epsapi/enum/drivers.c +++ b/lib/epsapi/enum/drivers.c @@ -14,16 +14,11 @@ * and improve reusability */ -#define WIN32_NO_STATUS -#include -#define NTOS_MODE_USER -#include +#include "precomp.h" #define NDEBUG #include -#include - NTSTATUS NTAPI PsaEnumerateSystemModules(IN PSYSMOD_ENUM_ROUTINE Callback, IN OUT PVOID CallbackContext) diff --git a/lib/epsapi/enum/modules.c b/lib/epsapi/enum/modules.c index 55915ee594e..f5a3d73d479 100644 --- a/lib/epsapi/enum/modules.c +++ b/lib/epsapi/enum/modules.c @@ -18,16 +18,12 @@ * isolated in its own library to clear the confusion * and improve reusability */ -#define WIN32_NO_STATUS -#include -#define NTOS_MODE_USER -#include + +#include "precomp.h" #define NDEBUG #include -#include - NTSTATUS NTAPI PsaEnumerateProcessModules(IN HANDLE ProcessHandle, IN PPROCMOD_ENUM_ROUTINE Callback, diff --git a/lib/epsapi/enum/precomp.h b/lib/epsapi/enum/precomp.h new file mode 100644 index 00000000000..3d029daf987 --- /dev/null +++ b/lib/epsapi/enum/precomp.h @@ -0,0 +1,9 @@ +#define WIN32_NO_STATUS +#include +#define NTOS_MODE_USER +#include +#include +#include +#include + +#include diff --git a/lib/epsapi/enum/processes.c b/lib/epsapi/enum/processes.c index 45ebb595b1e..3d772d0b5d1 100644 --- a/lib/epsapi/enum/processes.c +++ b/lib/epsapi/enum/processes.c @@ -30,12 +30,8 @@ * isolated in its own library to clear the confusion * and improve reusability */ -#define WIN32_NO_STATUS -#include -#define NTOS_MODE_USER -#include -#include +#include "precomp.h" #define NDEBUG #include diff --git a/lib/epsapi/epsapi.rbuild b/lib/epsapi/epsapi.rbuild index 787b7161f41..2a6e273e6db 100644 --- a/lib/epsapi/epsapi.rbuild +++ b/lib/epsapi/epsapi.rbuild @@ -5,5 +5,6 @@ drivers.c modules.c processes.c + precomp.h diff --git a/lib/fslib/ext2lib/CMakeLists.txt b/lib/fslib/ext2lib/CMakeLists.txt index c9122d3b788..c5f771c6442 100644 --- a/lib/fslib/ext2lib/CMakeLists.txt +++ b/lib/fslib/ext2lib/CMakeLists.txt @@ -10,4 +10,5 @@ list(APPEND SOURCE Super.c Uuid.c) add_library(ext2lib ${SOURCE}) +add_pch(ext2lib Mke2fs.h) add_dependencies(ext2lib psdk) diff --git a/lib/fslib/ext2lib/Mke2fs.h b/lib/fslib/ext2lib/Mke2fs.h index 4afba0dff8b..31dacea7638 100644 --- a/lib/fslib/ext2lib/Mke2fs.h +++ b/lib/fslib/ext2lib/Mke2fs.h @@ -5,15 +5,15 @@ * HOMEPAGE: http://ext2.yeah.net */ -#pragma once - /* INCLUDES **************************************************************/ - #define WIN32_NO_STATUS #include #define NTOS_MODE_USER -#include +#include +#include +#include +#include #include #include "string.h" diff --git a/lib/fslib/ext2lib/Uuid.c b/lib/fslib/ext2lib/Uuid.c index 5284cd94b1b..572b8fbadcd 100644 --- a/lib/fslib/ext2lib/Uuid.c +++ b/lib/fslib/ext2lib/Uuid.c @@ -7,8 +7,7 @@ /* INCLUDES **************************************************************/ -#include "windows.h" -#include "types.h" +#include "Mke2fs.h" /* DEFINITIONS ***********************************************************/ diff --git a/lib/fslib/ntfslib/ntfslib.h b/lib/fslib/ntfslib/ntfslib.h index b50dfbf16c6..cf6713e6558 100644 --- a/lib/fslib/ntfslib/ntfslib.h +++ b/lib/fslib/ntfslib/ntfslib.h @@ -6,5 +6,5 @@ #define WIN32_NO_STATUS #include #define NTOS_MODE_USER -#include +#include #include diff --git a/lib/fslib/vfatlib/CMakeLists.txt b/lib/fslib/vfatlib/CMakeLists.txt index 675bbbd16af..8dfeaa58a66 100644 --- a/lib/fslib/vfatlib/CMakeLists.txt +++ b/lib/fslib/vfatlib/CMakeLists.txt @@ -12,4 +12,5 @@ list(APPEND SOURCE fat32.c vfatlib.c) add_library(vfatlib ${SOURCE}) +add_pch(vfatlib vfatlib.h) add_dependencies(vfatlib psdk) diff --git a/lib/fslib/vfatlib/check/check.c b/lib/fslib/vfatlib/check/check.c index e4b76be7204..64be1e94ce7 100644 --- a/lib/fslib/vfatlib/check/check.c +++ b/lib/fslib/vfatlib/check/check.c @@ -5,15 +5,11 @@ /* FAT32, VFAT, Atari format support, and various fixes additions May 1998 * by Roman Hodek */ - #include "vfatlib.h" -#include #define NDEBUG #include - - static DOS_FILE *root; /* get start field of a dir entry */ diff --git a/lib/fslib/vfatlib/check/lfn.c b/lib/fslib/vfatlib/check/lfn.c index af6b459dba5..fc0b7827b8d 100644 --- a/lib/fslib/vfatlib/check/lfn.c +++ b/lib/fslib/vfatlib/check/lfn.c @@ -4,8 +4,6 @@ #include "vfatlib.h" -#include // for INT_MAX definition - #define NDEBUG #include diff --git a/lib/fslib/vfatlib/fat12.c b/lib/fslib/vfatlib/fat12.c index 58725223777..b9f8bad46f2 100644 --- a/lib/fslib/vfatlib/fat12.c +++ b/lib/fslib/vfatlib/fat12.c @@ -56,11 +56,11 @@ Fat12WriteBootSector(IN HANDLE FileHandle, { IO_STATUS_BLOCK IoStatusBlock; NTSTATUS Status; - PUCHAR NewBootSector; + PFAT16_BOOT_SECTOR NewBootSector; LARGE_INTEGER FileOffset; /* Allocate buffer for new bootsector */ - NewBootSector = (PUCHAR)RtlAllocateHeap(RtlGetProcessHeap (), + NewBootSector = (PFAT16_BOOT_SECTOR)RtlAllocateHeap(RtlGetProcessHeap (), 0, BootSector->BytesPerSector); if (NewBootSector == NULL) @@ -70,10 +70,13 @@ Fat12WriteBootSector(IN HANDLE FileHandle, memset(NewBootSector, 0, BootSector->BytesPerSector); /* Copy FAT16 BPB to new bootsector */ - memcpy((NewBootSector + 3), + memcpy(&NewBootSector->OEMName[0], &BootSector->OEMName[0], 59); /* FAT16 BPB length (up to (not including) Res2) */ + /* Write the boot sector signature */ + NewBootSector->Signature1 = 0xAA550000; + /* Write sector 0 */ FileOffset.QuadPart = 0ULL; Status = NtWriteFile(FileHandle, @@ -289,8 +292,16 @@ Fat12Format(IN HANDLE FileHandle, /* Calculate cluster size */ if (ClusterSize == 0) { - /* 4KB Cluster (Harddisk only) */ - ClusterSize = 4096; + if (DiskGeometry->MediaType == FixedMedia) + { + /* 4KB Cluster (Harddisk only) */ + ClusterSize = 4096; + } + else + { + /* 512 byte cluster (floppy) */ + ClusterSize = 512; + } } SectorCount = PartitionInfo->PartitionLength.QuadPart >> @@ -312,7 +323,7 @@ Fat12Format(IN HANDLE FileHandle, BootSector.Heads = DiskGeometry->TracksPerCylinder; BootSector.HiddenSectors = PartitionInfo->HiddenSectors; BootSector.SectorsHuge = (SectorCount >= 0x10000) ? (unsigned long)SectorCount : 0; - BootSector.Drive = 0xff; /* No BIOS boot drive available */ + BootSector.Drive = DiskGeometry->MediaType == FixedMedia ? 0x80 : 0x00; BootSector.ExtBootSignature = 0x29; BootSector.VolumeID = CalcVolumeSerialNumber(); if ((Label == NULL) || (Label->Buffer == NULL)) diff --git a/lib/fslib/vfatlib/fat16.c b/lib/fslib/vfatlib/fat16.c index 1194de905e7..8cd7551d938 100644 --- a/lib/fslib/vfatlib/fat16.c +++ b/lib/fslib/vfatlib/fat16.c @@ -56,11 +56,11 @@ Fat16WriteBootSector(IN HANDLE FileHandle, { IO_STATUS_BLOCK IoStatusBlock; NTSTATUS Status; - PUCHAR NewBootSector; + PFAT16_BOOT_SECTOR NewBootSector; LARGE_INTEGER FileOffset; /* Allocate buffer for new bootsector */ - NewBootSector = (PUCHAR)RtlAllocateHeap(RtlGetProcessHeap(), + NewBootSector = (PFAT16_BOOT_SECTOR)RtlAllocateHeap(RtlGetProcessHeap(), 0, BootSector->BytesPerSector); if (NewBootSector == NULL) @@ -70,10 +70,13 @@ Fat16WriteBootSector(IN HANDLE FileHandle, memset(NewBootSector, 0, BootSector->BytesPerSector); /* Copy FAT16 BPB to new bootsector */ - memcpy((NewBootSector + 3), + memcpy(&NewBootSector->OEMName[0], &BootSector->OEMName[0], 59); /* FAT16 BPB length (up to (not including) Res2) */ + /* Write the boot sector signature */ + NewBootSector->Signature1 = 0xAA550000; + /* Write sector 0 */ FileOffset.QuadPart = 0ULL; Status = NtWriteFile(FileHandle, @@ -327,7 +330,7 @@ Fat16Format(IN HANDLE FileHandle, BootSector.Heads = DiskGeometry->TracksPerCylinder; BootSector.HiddenSectors = PartitionInfo->HiddenSectors; BootSector.SectorsHuge = (SectorCount >= 0x10000) ? (unsigned long)SectorCount : 0; - BootSector.Drive = 0xff; /* No BIOS boot drive available */ + BootSector.Drive = DiskGeometry->MediaType == FixedMedia ? 0x80 : 0x00; BootSector.ExtBootSignature = 0x29; BootSector.VolumeID = CalcVolumeSerialNumber(); if ((Label == NULL) || (Label->Buffer == NULL)) diff --git a/lib/fslib/vfatlib/fat32.c b/lib/fslib/vfatlib/fat32.c index 9be3e050b12..0137fabe70c 100644 --- a/lib/fslib/vfatlib/fat32.c +++ b/lib/fslib/vfatlib/fat32.c @@ -56,11 +56,11 @@ Fat32WriteBootSector(IN HANDLE FileHandle, { IO_STATUS_BLOCK IoStatusBlock; NTSTATUS Status; - PUCHAR NewBootSector; + PFAT32_BOOT_SECTOR NewBootSector; LARGE_INTEGER FileOffset; /* Allocate buffer for new bootsector */ - NewBootSector = (PUCHAR)RtlAllocateHeap(RtlGetProcessHeap(), + NewBootSector = (PFAT32_BOOT_SECTOR)RtlAllocateHeap(RtlGetProcessHeap(), 0, BootSector->BytesPerSector); if (NewBootSector == NULL) @@ -70,10 +70,13 @@ Fat32WriteBootSector(IN HANDLE FileHandle, memset(NewBootSector, 0, BootSector->BytesPerSector); /* Copy FAT32 BPB to new bootsector */ - memcpy((NewBootSector + 3), + memcpy(&NewBootSector->OEMName[0], &BootSector->OEMName[0], 87); /* FAT32 BPB length (up to (not including) Res2) */ + /* Write the boot sector signature */ + NewBootSector->Signature1 = 0xAA550000; + /* Write sector 0 */ FileOffset.QuadPart = 0ULL; Status = NtWriteFile(FileHandle, @@ -405,7 +408,7 @@ Fat32Format(IN HANDLE FileHandle, BootSector.RootCluster = 2; BootSector.FSInfoSector = 1; BootSector.BootBackup = 6; - BootSector.Drive = 0xff; /* No BIOS boot drive available */ + BootSector.Drive = DiskGeometry->MediaType == FixedMedia ? 0x80 : 0x00; BootSector.ExtBootSignature = 0x29; BootSector.VolumeID = CalcVolumeSerialNumber (); if ((Label == NULL) || (Label->Buffer == NULL)) diff --git a/lib/fslib/vfatlib/vfatlib.c b/lib/fslib/vfatlib/vfatlib.c index 58738e68f54..e46501c0fba 100644 --- a/lib/fslib/vfatlib/vfatlib.c +++ b/lib/fslib/vfatlib/vfatlib.c @@ -32,7 +32,7 @@ VfatFormat(IN PUNICODE_STRING DriveRoot, HANDLE FileHandle; PARTITION_INFORMATION PartitionInfo; FORMAT_CONTEXT Context; - NTSTATUS Status; + NTSTATUS Status, LockStatus; DPRINT("VfatFormat(DriveRoot '%wZ')\n", DriveRoot); @@ -127,6 +127,58 @@ VfatFormat(IN PUNICODE_STRING DriveRoot, PartitionInfo.RewritePartition = FALSE; PartitionInfo.RecognizedPartition = FALSE; } + + /* If it already has a FAT FS, we'll use that type. + * If it doesn't, we will determine the FAT type based on size and offset */ + if (PartitionInfo.PartitionType != PARTITION_FAT_12 && + PartitionInfo.PartitionType != PARTITION_FAT_16 && + PartitionInfo.PartitionType != PARTITION_HUGE && + PartitionInfo.PartitionType != PARTITION_XINT13 && + PartitionInfo.PartitionType != PARTITION_FAT32 && + PartitionInfo.PartitionType != PARTITION_FAT32_XINT13) + { + /* Determine the correct type based upon size and offset (copied from usetup) */ + if (PartitionInfo.PartitionLength.QuadPart < (4200LL * 1024LL)) + { + /* FAT12 CHS partition (disk is smaller than 4.1MB) */ + PartitionInfo.PartitionType = PARTITION_FAT_12; + } + else if (PartitionInfo.StartingOffset.QuadPart < (1024LL * 255LL * 63LL * 512LL)) + { + /* Partition starts below the 8.4GB boundary ==> CHS partition */ + + if (PartitionInfo.PartitionLength.QuadPart < (32LL * 1024LL * 1024LL)) + { + /* FAT16 CHS partition (partiton size < 32MB) */ + PartitionInfo.PartitionType = PARTITION_FAT_16; + } + else if (PartitionInfo.PartitionLength.QuadPart < (512LL * 1024LL * 1024LL)) + { + /* FAT16 CHS partition (partition size < 512MB) */ + PartitionInfo.PartitionType = PARTITION_HUGE; + } + else + { + /* FAT32 CHS partition (partition size >= 512MB) */ + PartitionInfo.PartitionType = PARTITION_FAT32; + } + } + else + { + /* Partition starts above the 8.4GB boundary ==> LBA partition */ + + if (PartitionInfo.PartitionLength.QuadPart < (512LL * 1024LL * 1024LL)) + { + /* FAT16 LBA partition (partition size < 512MB) */ + PartitionInfo.PartitionType = PARTITION_XINT13; + } + else + { + /* FAT32 LBA partition (partition size >= 512MB) */ + PartitionInfo.PartitionType = PARTITION_FAT32_XINT13; + } + } + } DPRINT("PartitionType 0x%x\n", PartitionInfo.PartitionType); DPRINT("StartingOffset %I64d\n", PartitionInfo.StartingOffset.QuadPart); @@ -143,6 +195,21 @@ VfatFormat(IN PUNICODE_STRING DriveRoot, Callback (PROGRESS, 0, (PVOID)&Context.Percent); } + LockStatus = NtFsControlFile(FileHandle, + NULL, + NULL, + NULL, + &Iosb, + FSCTL_LOCK_VOLUME, + NULL, + 0, + NULL, + 0); + if (!NT_SUCCESS(LockStatus)) + { + DPRINT1("WARNING: Failed to lock volume for formatting! Format may fail! (Status: 0x%x)\n", LockStatus); + } + if (PartitionInfo.PartitionType == PARTITION_FAT_12) { /* FAT12 */ @@ -184,6 +251,21 @@ VfatFormat(IN PUNICODE_STRING DriveRoot, Status = STATUS_INVALID_PARAMETER; } + LockStatus = NtFsControlFile(FileHandle, + NULL, + NULL, + NULL, + &Iosb, + FSCTL_UNLOCK_VOLUME, + NULL, + 0, + NULL, + 0); + if (!NT_SUCCESS(LockStatus)) + { + DPRINT1("Failed to unlock volume (Status: 0x%x)\n", LockStatus); + } + NtClose(FileHandle); if (Callback != NULL) diff --git a/lib/fslib/vfatlib/vfatlib.h b/lib/fslib/vfatlib/vfatlib.h index 8e96ca574ec..c8fcdfec656 100644 --- a/lib/fslib/vfatlib/vfatlib.h +++ b/lib/fslib/vfatlib/vfatlib.h @@ -4,12 +4,20 @@ * FILE: vfatlib.h */ +#include + #define WIN32_NO_STATUS #include #define NTOS_MODE_USER -#include +#include +#include +#include +#include #include +#include +#include // for INT_MAX definition + #include "check/dosfsck.h" #include "check/common.h" #include "check/io.h" diff --git a/lib/fslib/vfatlib/vfatlib.rbuild b/lib/fslib/vfatlib/vfatlib.rbuild index 1d40958cdf9..037df56faca 100644 --- a/lib/fslib/vfatlib/vfatlib.rbuild +++ b/lib/fslib/vfatlib/vfatlib.rbuild @@ -6,6 +6,7 @@ fat16.c fat32.c vfatlib.c + vfatlib.h boot.c diff --git a/lib/fslib/vfatxlib/CMakeLists.txt b/lib/fslib/vfatxlib/CMakeLists.txt index 94ba818ea7b..1f4e54439d4 100644 --- a/lib/fslib/vfatxlib/CMakeLists.txt +++ b/lib/fslib/vfatxlib/CMakeLists.txt @@ -1,4 +1,10 @@ add_library(vfatxlib fatx.c vfatxlib.c) -add_dependencies(vfatxlib psdk) +add_pch(vfatxlib vfatxlib.h) +target_link_libraries(vfatxlib chkstk) +if(NOT MSVC) + target_link_libraries(vfatxlib -lgcc) +endif() + +add_dependencies(vfatxlib psdk) diff --git a/lib/fslib/vfatxlib/vfatxlib.h b/lib/fslib/vfatxlib/vfatxlib.h index 4c035e2dfb5..ce3a62e271d 100644 --- a/lib/fslib/vfatxlib/vfatxlib.h +++ b/lib/fslib/vfatxlib/vfatxlib.h @@ -6,7 +6,10 @@ #define WIN32_NO_STATUS #include #define NTOS_MODE_USER -#include +#include +#include +#include +#include #include #include diff --git a/lib/fslib/vfatxlib/vfatxlib.rbuild b/lib/fslib/vfatxlib/vfatxlib.rbuild index bc7736cd6a7..2a41ebcbd73 100644 --- a/lib/fslib/vfatxlib/vfatxlib.rbuild +++ b/lib/fslib/vfatxlib/vfatxlib.rbuild @@ -4,4 +4,5 @@ . fatx.c vfatxlib.c + vfatxlib.h diff --git a/lib/host/wcsfuncs/CMakeLists.txt b/lib/host/wcsfuncs/CMakeLists.txt deleted file mode 100644 index 5f16bcbfbbd..00000000000 --- a/lib/host/wcsfuncs/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ - -add_library(host_wcsfuncs wcsfuncs.c) diff --git a/lib/host/wcsfuncs/wcsfuncs.c b/lib/host/wcsfuncs/wcsfuncs.c deleted file mode 100644 index 58dafe13cd3..00000000000 --- a/lib/host/wcsfuncs/wcsfuncs.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - PROJECT: ReactOS - LICENSE: GPL v2 or any later version - FILE: lib/host/wcsfuncs/wcsfuncs.c - PURPOSE: Reimplemented wide-character string functions for host tools (to be independent of the host wchar_t size) - COPYRIGHT: Copyright 2008 Colin Finck -*/ - -#include - -/* Function implementations */ -SIZE_T utf16_wcslen(PCWSTR str) -{ - SIZE_T i; - - for(i = 0; str[i]; i++); - - return i; -} - - -SIZE_T strlenW(PCWSTR str) -{ - SIZE_T i; - - for(i = 0; str[i]; i++); - - return i; -} - - -PWSTR utf16_wcschr(PWSTR str, WCHAR c) -{ - SIZE_T i; - - for(i = 0; str[i] && str[i] != c; i++); - - if(str[i]) - return &str[i]; - else - return NULL; -} - -PWSTR strchrW(PWSTR str, WCHAR c) -{ - SIZE_T i; - - for(i = 0; str[i] && str[i] != c; i++); - - if(str[i]) - return &str[i]; - else - return NULL; -} - -INT utf16_wcsncmp(PCWSTR string1, PCWSTR string2, size_t count) -{ - while(count--) - { - if(*string1 != *string2) - return 1; - - if(*string1 == 0) - return 0; - - string1++; - string2++; - } - - return 0; -} - -INT strncmpW(PCWSTR string1, PCWSTR string2, size_t count) -{ - while(count--) - { - if(*string1 != *string2) - return 1; - - if(*string1 == 0) - return 0; - - string1++; - string2++; - } - - return 0; -} diff --git a/lib/host/wcsfuncs/wcsfuncs.rbuild b/lib/host/wcsfuncs/wcsfuncs.rbuild deleted file mode 100644 index 15025ed2ad5..00000000000 --- a/lib/host/wcsfuncs/wcsfuncs.rbuild +++ /dev/null @@ -1,5 +0,0 @@ - - - - wcsfuncs.c - diff --git a/lib/inflib/builddep.h b/lib/inflib/builddep.h index 8c38864be9c..d123ab313b6 100644 --- a/lib/inflib/builddep.h +++ b/lib/inflib/builddep.h @@ -8,7 +8,7 @@ /* Definitions native to the host on which we're building */ -#include +#include #include #include diff --git a/lib/inflib/inflib.mak b/lib/inflib/inflib.mak index fa23df27d8f..8a4bf38d274 100644 --- a/lib/inflib/inflib.mak +++ b/lib/inflib/inflib.mak @@ -32,7 +32,7 @@ INFLIB_HOST_OBJECTS = \ INFLIB_HOST_CFLAGS = -O3 -Wall -Wpointer-arith -Wconversion \ -Wstrict-prototypes -Wmissing-prototypes -DINFLIB_HOST \ - -Iinclude/reactos -Iinclude $(HOST_CFLAGS) + -Iinclude/host -Iinclude $(HOST_CFLAGS) $(INFLIB_HOST_TARGET): $(INFLIB_HOST_OBJECTS) | $(INFLIB_OUT) $(ECHO_HOSTAR) diff --git a/lib/lib.rbuild b/lib/lib.rbuild index 90f4ba6050c..15d0b7fb0de 100644 --- a/lib/lib.rbuild +++ b/lib/lib.rbuild @@ -31,9 +31,6 @@ - - - diff --git a/lib/lsalib/lsa.c b/lib/lsalib/lsa.c index 31c2aeb197f..f2fe9d702bb 100644 --- a/lib/lsalib/lsa.c +++ b/lib/lsalib/lsa.c @@ -9,7 +9,9 @@ /* INCLUDES ******************************************************************/ -#include +#include +#include +#include #include #include diff --git a/lib/newinflib/CMakeLists.txt b/lib/newinflib/CMakeLists.txt index 901bd996132..65b092e11fc 100644 --- a/lib/newinflib/CMakeLists.txt +++ b/lib/newinflib/CMakeLists.txt @@ -5,23 +5,24 @@ list(APPEND GLOBAL_FILES infput.c) if(CMAKE_CROSSCOMPILING) - list(APPEND SOURCE + list(APPEND SOURCE infrosgen.c infrosget.c infrosput.c) add_library(inflib ${GLOBAL_FILES} ${SOURCE}) + add_pch(inflib inflib.h) add_dependencies(inflib psdk) else() - list(APPEND SOURCE + list(APPEND SOURCE infhostgen.c infhostget.c infhostput.c infhostrtl.c) - add_definitions(-DWINE_UNICODE_API= -D__NO_CTYPE_INLINES -DINFLIB_HOST -DUSE_HOST_WCSFUNCS) + add_definitions(-D__NO_CTYPE_INLINES -DINFLIB_HOST) if(NOT MSVC) - add_definitions(-Wpointer-arith -Wwrite-strings) + add_compiler_flags(-Wpointer-arith -Wwrite-strings) endif() add_library(inflibhost ${GLOBAL_FILES} ${SOURCE}) target_link_libraries(inflibhost unicode) diff --git a/lib/newinflib/builddep.h b/lib/newinflib/builddep.h index 51b4d4850d7..f00bdda03a0 100644 --- a/lib/newinflib/builddep.h +++ b/lib/newinflib/builddep.h @@ -8,8 +8,7 @@ /* Definitions native to the host on which we're building */ -#include -#include +#include #include #include @@ -62,7 +61,9 @@ BOOLEAN NTAPI RtlIsTextUnicode( PVOID buf, INT len, INT *pf ); #define WIN32_NO_STATUS #include #define NTOS_MODE_USER -#include +#include +#include +#include extern PVOID InfpHeap; @@ -82,6 +83,6 @@ extern PVOID InfpHeap; #endif /* INFLIB_HOST */ -#include +#include /* EOF */ diff --git a/lib/newinflib/inflib.rbuild b/lib/newinflib/inflib.rbuild index 7c758a7c332..c6758ab5559 100644 --- a/lib/newinflib/inflib.rbuild +++ b/lib/newinflib/inflib.rbuild @@ -9,13 +9,11 @@ infrosgen.c infrosget.c infrosput.c + inflib.h - " " - . - -Wwrite-strings -Wpointer-arith diff --git a/lib/pseh/CMakeLists.txt b/lib/pseh/CMakeLists.txt index 23207e13a8a..be835b2c266 100644 --- a/lib/pseh/CMakeLists.txt +++ b/lib/pseh/CMakeLists.txt @@ -14,14 +14,22 @@ if(NOT MSVC) endif() add_library(pseh ${SOURCE}) + target_link_libraries(pseh chkstk) add_dependencies(pseh psdk) else() - list(APPEND SOURCE - dummy.c - i386/seh.s - i386/seh_prolog.s) + if(ARCH MATCHES i386) + list(APPEND SOURCE + dummy.c + i386/seh.s + i386/seh_prolog.s) + elseif(ARCH MATCHES amd64) + list(APPEND SOURCE + dummy.c + amd64/seh.s + amd64/seh_prolog.s) + endif() add_library(pseh ${SOURCE}) add_dependencies(pseh asm) diff --git a/lib/pseh/amd64/seh.s b/lib/pseh/amd64/seh.s new file mode 100644 index 00000000000..14df30687df --- /dev/null +++ b/lib/pseh/amd64/seh.s @@ -0,0 +1,52 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS CRT + * FILE: lib/pseh/amd64/seh.S + * PURPOSE: SEH Support for the CRT + * PROGRAMMERS: + */ + +/* INCLUDES ******************************************************************/ + +#include + +#define DISPOSITION_DISMISS 0 +#define DISPOSITION_CONTINUE_SEARCH 1 +#define DISPOSITION_COLLIDED_UNWIND 3 + +#define EXCEPTION_EXIT_UNWIND 4 +#define EXCEPTION_UNWINDING 2 + + +EXTERN RtlUnwind:PROC + +/* GLOBALS *******************************************************************/ + +PUBLIC _global_unwind2 +PUBLIC _local_unwind2 +PUBLIC _abnormal_termination +PUBLIC _except_handler2 +PUBLIC _except_handler3 + +/* FUNCTIONS *****************************************************************/ + +.code +_unwind_handler: + ret + +_global_unwind2: + ret + +_abnormal_termination: + ret + +_local_unwind2: + ret + +_except_handler2: + ret + +_except_handler3: + ret + +END diff --git a/lib/pseh/amd64/seh_prolog.s b/lib/pseh/amd64/seh_prolog.s new file mode 100644 index 00000000000..d03063534d7 --- /dev/null +++ b/lib/pseh/amd64/seh_prolog.s @@ -0,0 +1,25 @@ +/* + * COPYRIGHT: GNU GPL, see COPYING in the top level directory + * PROJECT: ReactOS CRT + * FILE: lib/pseh/amd64/seh_prolog.S + * PURPOSE: SEH Support for MSVC + * PROGRAMMERS: Timo Kreuzer + */ + +/* INCLUDES ******************************************************************/ + +#include + +EXTERN _except_handler3:PROC + +.code + +PUBLIC _SEH_prolog +_SEH_prolog: + + +PUBLIC _SEH_epilog +_SEH_epilog: + ret + +END diff --git a/lib/rossym_new/CMakeLists.txt b/lib/rossym_new/CMakeLists.txt index 2b05860e247..0a63d5b3ca3 100644 --- a/lib/rossym_new/CMakeLists.txt +++ b/lib/rossym_new/CMakeLists.txt @@ -1,27 +1,25 @@ if(MSVC) -add_library(rossym dummy.c) + add_library(rossym dummy.c) else() -add_definitions(-D_NTSYSTEM_) -list(APPEND SOURCE - delete.c - dwarf386.c - dwarfabbrev.c - dwarfaranges.c - dwarfcfa.c - dwarfinfo.c - dwarfget.c - dwarfopen.c - dwarfpc.c - dwarfpubnames.c - find.c - fromfile.c - iofile.c - init.c - initkm.c - initum.c - pe.c - zwfile.c) -add_library(rossym ${SOURCE}) -add_dependencies(rossym psdk bugcodes) + add_definitions(-D_NTSYSTEM_) + list(APPEND SOURCE + delete.c + dwarfabbrev.c + dwarfaranges.c + dwarfcfa.c + dwarfget.c + dwarfinfo.c + dwarfopen.c + dwarfpc.c + dwarfpubnames.c + find.c + fromfile.c + init.c + initum.c + pe.c + zwfile.c) + add_library(rossym ${SOURCE}) + add_pch(rossym precomp.h) + add_dependencies(rossym psdk bugcodes) endif() diff --git a/lib/rossym_new/compat.h b/lib/rossym_new/compat.h index 64dc549f11c..80f0e94d0e4 100644 --- a/lib/rossym_new/compat.h +++ b/lib/rossym_new/compat.h @@ -19,6 +19,19 @@ typedef long long s64int; typedef ulong size_t; #endif +DECLSPEC_NORETURN +NTSYSAPI +VOID +NTAPI +RtlRaiseStatus(IN NTSTATUS Status); + +#undef assert +#define assert(x) do { \ + if (!(x)) { \ + werrstr("(%s:%d) assertion " #x " failed\n", __FILE__, __LINE__); \ + RtlRaiseStatus(STATUS_ASSERTION_FAILURE); \ + } \ + } while (0) #define offsetof(x,y) FIELD_OFFSET(x,y) #define nil (0) @@ -32,6 +45,14 @@ void *RosSymRealloc(void *mem, ulong newsize); void xfree(void *v); #define werrstr(str, ...) DPRINT(str "\n" ,##__VA_ARGS__) +#if 0 +#ifdef NDEBUG +#define werrstr(x, ...) +#else +#define werrstr(x, ...) printf("(%s:%d) " x "\n",__FILE__,__LINE__,##__VA_ARGS__) +#endif +#endif + #define malloc(x) RosSymAllocMem(x) #define mallocz(x,y) RosSymAllocMemZero(x,y) #define free(x) xfree(x) diff --git a/lib/rossym_new/delete.c b/lib/rossym_new/delete.c index 1e6fe8393e2..314ff526f9e 100644 --- a/lib/rossym_new/delete.c +++ b/lib/rossym_new/delete.c @@ -7,17 +7,7 @@ * PROGRAMMERS: Ge van Geldorp (gvg@reactos.com) */ -#define NTOSAPI -#include -#include -#include - -#define NDEBUG -#include - -#include "rossympriv.h" -#include "pe.h" -#include "dwarf.h" +#include VOID RosSymDelete(PROSSYM_INFO RosSymInfo) diff --git a/lib/rossym_new/dummy.c b/lib/rossym_new/dummy.c index 2e4703fe528..8cc5263691a 100644 --- a/lib/rossym_new/dummy.c +++ b/lib/rossym_new/dummy.c @@ -8,25 +8,53 @@ BOOLEAN RosSymCreateFromFile(PVOID FileContext, PROSSYM_INFO *RosSymInfo) { + UNIMPLEMENTED; return FALSE; } VOID RosSymDelete(PROSSYM_INFO RosSymInfo) { + UNIMPLEMENTED; +} + +VOID +RosSymFreeInfo(PROSSYM_LINEINFO LineInfo) +{ + UNIMPLEMENTED; } BOOLEAN RosSymGetAddressInformation(PROSSYM_INFO RosSymInfo, ULONG_PTR RelativeAddress, - ULONG *LineNumber, - char *FileName, - char *FunctionName) + PROSSYM_LINEINFO RosSymLineInfo) { + UNIMPLEMENTED; return FALSE; } +VOID +RosSymInit(PROSSYM_CALLBACKS Callbacks) +{ + UNIMPLEMENTED; +} + VOID RosSymInitKernelMode(VOID) { + UNIMPLEMENTED; } + +BOOLEAN +RosSymAggregate(PROSSYM_INFO RosSymInfo, PCHAR Type, PROSSYM_AGGREGATE Aggregate) +{ + UNIMPLEMENTED; + return FALSE; +} + +VOID +RosSymFreeAggregate(PROSSYM_AGGREGATE Aggregate) +{ + UNIMPLEMENTED; +} + diff --git a/lib/rossym_new/dwarf.h b/lib/rossym_new/dwarf.h index 04689814bd7..3d1101e2e99 100644 --- a/lib/rossym_new/dwarf.h +++ b/lib/rossym_new/dwarf.h @@ -6,6 +6,8 @@ typedef struct DwarfBlock DwarfBlock; typedef struct DwarfBuf DwarfBuf; typedef struct DwarfExpr DwarfExpr; typedef struct DwarfSym DwarfSym; +typedef struct DwarfStack DwarfStack; +typedef struct DwarfParam DwarfParam; typedef union DwarfVal DwarfVal; enum @@ -203,6 +205,16 @@ struct DwarfBlock ulong len; }; +struct DwarfParam +{ + char *name; + ulong unit; + ulong type; + ulong loctype; + ulong fde, len; + ulong value; +}; + /* not for consumer use */ struct DwarfBuf { @@ -372,19 +384,16 @@ struct DwarfExpr struct DwarfSym { - DwarfAttrs attrs; - + DwarfAttrs attrs; + /* not for consumer use... */ - DwarfBuf b; - ulong unit; - uint uoff; - ulong aoff; - int depth; - int allunits; - ulong nextunit; + uint num; + DwarfBuf b; + int depth; + ulong unit, childoff, nextunit; + ulong aoff; }; - struct _Pe; Dwarf *dwarfopen(struct _Pe *elf); void dwarfclose(Dwarf*); @@ -398,9 +407,11 @@ int dwarfenumunit(Dwarf*, ulong, DwarfSym*); int dwarfseeksym(Dwarf*, ulong, ulong, DwarfSym*); int dwarfenum(Dwarf*, DwarfSym*); int dwarfnextsym(Dwarf*, DwarfSym*); -int dwarfnextsymat(Dwarf*, DwarfSym*, int); -int dwarfpctoline(Dwarf*, ulong, char**, char**, char**, char **, ulong*, ulong*, ulong*); -int dwarfunwind(Dwarf*, ulong, DwarfExpr*, DwarfExpr*, DwarfExpr*, int); +int dwarfnextsymat(Dwarf*, DwarfSym *parent, DwarfSym *child); +int dwarfpctoline(Dwarf*, DwarfSym *proc, ulong, char**, char**, ulong *); +int dwarfgetarg(Dwarf *d, const char *name, DwarfBuf *locbuf, ulong cfa, PROSSYM_REGISTERS registers, ulong *value); +int dwarfgettype(Dwarf *d, DwarfSym *param, DwarfSym *type); + ulong dwarfget1(DwarfBuf*); ulong dwarfget2(DwarfBuf*); ulong dwarfget4(DwarfBuf*); @@ -411,7 +422,10 @@ ulong dwarfgetaddr(DwarfBuf*); int dwarfgetn(DwarfBuf*, uchar*, int); uchar *dwarfgetnref(DwarfBuf*, ulong); char *dwarfgetstring(DwarfBuf*); - +int dwarfcomputecfa(Dwarf *d, DwarfExpr *cfa, PROSSYM_REGISTERS registers, ulong *cfaLocation); +int dwarfregunwind(Dwarf *d, ulong pc, ulong fde, DwarfExpr *cfa, PROSSYM_REGISTERS registers); +int dwarfargvalue(Dwarf *d, DwarfSym *proc, ulong pc, ulong cfa, PROSSYM_REGISTERS registers, DwarfParam *parameters); +int dwarfgetparams(Dwarf *d, DwarfSym *s, ulong pc, int pnum, DwarfParam *paramblocks); typedef struct DwarfAbbrev DwarfAbbrev; typedef struct DwarfAttr DwarfAttr; @@ -449,6 +463,7 @@ struct Dwarf DwarfBlock pubtypes; DwarfBlock ranges; DwarfBlock str; + DwarfBlock loc; /* little cache */ struct { @@ -458,14 +473,16 @@ struct Dwarf } acache; }; +struct DwarfStack +{ + ulong storage[16]; // own storage + ulong *data; + ulong length, max; +}; + DwarfAbbrev *dwarfgetabbrev(Dwarf*, ulong, ulong); int dwarfgetinfounit(Dwarf*, ulong, DwarfBlock*); +void dwarfdumpsym(Dwarf *d, DwarfSym *s); -extern int dwarf386nregs; -extern char *dwarf386regs[]; -extern char *dwarf386fp; - -#define SYMBOL_SIZE 18 #define MAXIMUM_DWARF_NAME_SIZE 64 -#define MAXIMUM_COFF_SYMBOL_LENGTH 256 diff --git a/lib/rossym_new/dwarfabbrev.c b/lib/rossym_new/dwarfabbrev.c index d21ca6a25d1..aba3b14464b 100644 --- a/lib/rossym_new/dwarfabbrev.c +++ b/lib/rossym_new/dwarfabbrev.c @@ -6,136 +6,131 @@ * explicit reference counting if this turns out not to be acceptable. */ -#define NTOSAPI -#include -#include -#include "rossympriv.h" -#include +#include #define NDEBUG #include -#include "rossym.h" -#include "rossympriv.h" -#include "dwarf.h" - static int parseabbrevs(Dwarf*, ulong, DwarfAbbrev*, DwarfAttr*, int*, int*); DwarfAbbrev *dwarfgetabbrev(Dwarf*, ulong, ulong); static int loadabbrevs(Dwarf *d, ulong off, DwarfAbbrev **aa) { - int nattr, nabbrev; - DwarfAbbrev *abbrev; - DwarfAttr *attr; + int nattr, nabbrev; + DwarfAbbrev *abbrev; + DwarfAttr *attr; - if(d->acache.off == off && d->acache.na){ - *aa = d->acache.a; - return d->acache.na; - } + if(d->acache.off == off && d->acache.na){ + *aa = d->acache.a; + return d->acache.na; + } - /* two passes - once to count, then allocate, then a second to copy */ - if(parseabbrevs(d, off, nil, nil, &nabbrev, &nattr) < 0) { - return -1; - } + /* two passes - once to count, then allocate, then a second to copy */ + if(parseabbrevs(d, off, nil, nil, &nabbrev, &nattr) < 0) { + return -1; + } - abbrev = malloc(nabbrev*sizeof(DwarfAbbrev) + nattr*sizeof(DwarfAttr)); - attr = (DwarfAttr*)(abbrev+nabbrev); + abbrev = malloc(nabbrev*sizeof(DwarfAbbrev) + nattr*sizeof(DwarfAttr)); + attr = (DwarfAttr*)(abbrev+nabbrev); - if(parseabbrevs(d, off, abbrev, attr, nil, nil) < 0){ - free(abbrev); - return -1; - } + if(parseabbrevs(d, off, abbrev, attr, nil, nil) < 0){ + free(abbrev); + return -1; + } - free(d->acache.a); - d->acache.a = abbrev; - d->acache.na = nabbrev; - d->acache.off = off; + free(d->acache.a); + d->acache.a = abbrev; + d->acache.na = nabbrev; + d->acache.off = off; - *aa = abbrev; - return nabbrev; + *aa = abbrev; + return nabbrev; } static int parseabbrevs(Dwarf *d, ulong off, DwarfAbbrev *abbrev, DwarfAttr *attr, int *pnabbrev, int *pnattr) { - int i, nabbrev, nattr, haskids; - ulong num, tag, name, form; - DwarfBuf b; + int i, nabbrev, nattr, haskids; + ulong num, tag, name, form; + DwarfBuf b; - if(off >= d->abbrev.len){ - werrstr("bad abbrev section offset 0x%lux >= 0x%lux\n", off, d->abbrev.len); - return -1; - } + if(off >= d->abbrev.len){ + werrstr("bad abbrev section offset 0x%lux >= 0x%lux", off, d->abbrev.len); + return -1; + } - memset(&b, 0, sizeof b); - b.p = d->abbrev.data + off; - b.ep = d->abbrev.data + d->abbrev.len; + memset(&b, 0, sizeof b); + b.p = d->abbrev.data + off; + b.ep = d->abbrev.data + d->abbrev.len; - nabbrev = 0; - nattr = 0; - for(;;){ - if(b.p == nil){ - werrstr("malformed abbrev data"); - return -1; - } - num = dwarfget128(&b); - if(num == 0) - break; - tag = dwarfget128(&b); - haskids = dwarfget1(&b); - for(i=0;; i++){ - name = dwarfget128(&b); - form = dwarfget128(&b); - if(name == 0 && form == 0) - break; - if(attr){ - attr[i].name = name; - attr[i].form = form; - } - } - if(abbrev){ - abbrev->num = num; - abbrev->tag = tag; - abbrev->haskids = haskids; - abbrev->attr = attr; - abbrev->nattr = i; - abbrev++; - attr += i; - } - nabbrev++; - nattr += i; - } - if(pnabbrev) - *pnabbrev = nabbrev; - if(pnattr) - *pnattr = nattr; - return 0; + nabbrev = 0; + nattr = 0; + for(;;){ + if(b.p == nil){ + werrstr("malformed abbrev data"); + return -1; + } + num = dwarfget128(&b); + if(num == 0) + break; + tag = dwarfget128(&b); + werrstr("abbrev: num %d tag %x @ %x", num, tag, b.p - d->abbrev.data); + haskids = dwarfget1(&b); + for(i=0;; i++){ + name = dwarfget128(&b); + form = dwarfget128(&b); + assert(form < 0x3000); + if(name == 0 && form == 0) + break; + if(attr){ + attr[i].name = name; + attr[i].form = form; + } + } + if(abbrev){ + abbrev->num = num; + abbrev->tag = tag; + abbrev->haskids = haskids; + abbrev->attr = attr; + abbrev->nattr = i; + abbrev++; + attr += i; + } + nabbrev++; + nattr += i; + } + if(pnabbrev) + *pnabbrev = nabbrev; + if(pnattr) + *pnattr = nattr; + return 0; } static DwarfAbbrev* findabbrev(DwarfAbbrev *a, int na, ulong num) { - int i; + int i; - for(i=0; i -#include -#include "rossympriv.h" -#include +#include #define NDEBUG #include -#include "dwarf.h" - int dwarfaddrtounit(Dwarf *d, ulong addr, ulong *unit) { - DwarfBuf b; - int segsize, i; - ulong len, id, off, base, size; - uchar *start, *end; + DwarfBuf b; + int segsize, i; + ulong len, id, off, base, size; + uchar *start, *end; - memset(&b, 0, sizeof b); - b.d = d; - b.p = d->aranges.data; - b.ep = b.p + d->aranges.len; + memset(&b, 0, sizeof b); + b.d = d; + b.p = d->aranges.data; + b.ep = b.p + d->aranges.len; - while(b.p < b.ep){ - start = b.p; - len = dwarfget4(&b); - if (!len) { b.ep = b.p - 4; return -1; } - if((id = dwarfget2(&b)) != 2){ - if(b.p == nil){ - underflow: - werrstr("buffer underflow reading address ranges header"); - }else - werrstr("bad dwarf version 0x%x in address ranges header", id); - return -1; - } - off = dwarfget4(&b); - b.addrsize = dwarfget1(&b); - if(d->addrsize == 0) - d->addrsize = b.addrsize; - segsize = dwarfget1(&b); - USED(segsize); /* what am i supposed to do with this? */ - if(b.p == nil) - goto underflow; - if((i = (b.p-start) % (2*b.addrsize)) != 0) - b.p += 2*b.addrsize - i; - end = start+4+len; - while(b.p!=nil && b.paddrsize == 0) + d->addrsize = b.addrsize; + segsize = dwarfget1(&b); + USED(segsize); /* what am i supposed to do with this? */ + if(b.p == nil) + goto underflow; + if((i = (b.p-start) % (2*b.addrsize)) != 0) + b.p += 2*b.addrsize - i; + end = start+4+len; + while(b.p!=nil && b.p -#include -#include "rossympriv.h" -#include +#include #define NDEBUG #include -#include "dwarf.h" - -#define trace 0 +#define trace 1 typedef struct State State; struct State @@ -71,7 +65,7 @@ dwarfunwind(Dwarf *d, ulong pc, DwarfExpr *cfa, DwarfExpr *ra, DwarfExpr *r, int memset(r, 0, nr*sizeof(r[0])); for(i=0; iiquantum = dwarfget128(&b); @@ -163,6 +158,7 @@ findfde(Dwarf *d, ulong pc, State *s, DwarfBuf *fde) }else{ /* FDE */ base = dwarfgetaddr(&b); size = dwarfgetaddr(&b); + if (trace) werrstr("FDE: base %x-%x (want pc %x)", base, base+size, pc); fde->p = b.p; fde->ep = next; s->loc = base; @@ -171,7 +167,7 @@ findfde(Dwarf *d, ulong pc, State *s, DwarfBuf *fde) return 0; } } - werrstr("cannot find call frame information for pc 0x%lux", pc); + werrstr("cannot find call frame information for pc 0x%lx", pc); return -1; } @@ -180,7 +176,7 @@ static int checkreg(State *s, long r) { if(r < 0 || r >= s->nr){ - werrstr("bad register number 0x%lux", r); + werrstr("bad register number 0x%lx", r); return -1; } return 0; @@ -197,20 +193,21 @@ dexec(DwarfBuf *b, State *s, int locstop) if(b->p == b->ep){ if(s->initr) s->loc = s->endloc; + werrstr("end dexec"); return 0; } c = dwarfget1(b); if(b->p == nil){ werrstr("ran out of instructions during cfa program"); - if(trace) werrstr("%r\n"); + if(trace) werrstr("%r"); return -1; } - if(trace) werrstr("+ loc=0x%lux op 0x%ux ", s->loc, c); + if(trace) werrstr("+ loc=0x%x op 0x%x ", s->loc, c); switch(c>>6){ case 1: /* advance location */ arg1 = c&0x3F; advance: - if(trace) werrstr("loc += %ld\n", arg1*s->iquantum); + if(trace) werrstr("loc += %ld", arg1*s->iquantum); s->loc += arg1 * s->iquantum; if(locstop) return 0; @@ -220,7 +217,7 @@ dexec(DwarfBuf *b, State *s, int locstop) arg1 = c&0x3F; arg2 = dwarfget128(b); offset: - if(trace) werrstr("r%ld += %ld\n", arg1, arg2*s->dquantum); + if(trace) werrstr("r%ld += %ld", arg1, arg2*s->dquantum); if(checkreg(s, arg1) < 0) return -1; s->r[arg1].type = RuleCfaOffset; @@ -230,7 +227,7 @@ dexec(DwarfBuf *b, State *s, int locstop) case 3: /* restore initial setting */ arg1 = c&0x3F; restore: - if(trace) werrstr("r%ld = init\n", arg1); + if(trace) werrstr("r%ld = init", arg1); if(checkreg(s, arg1) < 0) return -1; s->r[arg1] = s->initr[arg1]; @@ -239,12 +236,12 @@ dexec(DwarfBuf *b, State *s, int locstop) switch(c){ case 0: /* nop */ - if(trace) werrstr("nop\n"); + if(trace) werrstr("nop"); continue; case 0x01: /* set location */ s->loc = dwarfgetaddr(b); - if(trace) werrstr("loc = 0x%lux\n", s->loc); + if(trace) werrstr("loc = 0x%lx", s->loc); if(locstop) return 0; continue; @@ -272,7 +269,7 @@ dexec(DwarfBuf *b, State *s, int locstop) case 0x07: /* undefined */ arg1 = dwarfget128(b); - if(trace) werrstr("r%ld = undef\n", arg1); + if(trace) werrstr("r%ld = undef", arg1); if(checkreg(s, arg1) < 0) return -1; s->r[arg1].type = RuleUndef; @@ -280,7 +277,7 @@ dexec(DwarfBuf *b, State *s, int locstop) case 0x08: /* same value */ arg1 = dwarfget128(b); - if(trace) werrstr("r%ld = same\n", arg1); + if(trace) werrstr("r%ld = same", arg1); if(checkreg(s, arg1) < 0) return -1; s->r[arg1].type = RuleSame; @@ -289,7 +286,7 @@ dexec(DwarfBuf *b, State *s, int locstop) case 0x09: /* register */ arg1 = dwarfget128(b); arg2 = dwarfget128(b); - if(trace) werrstr("r%ld = r%ld\n", arg1, arg2); + if(trace) werrstr("r%ld = r%ld", arg1, arg2); if(checkreg(s, arg1) < 0 || checkreg(s, arg2) < 0) return -1; s->r[arg1].type = RuleRegister; @@ -298,7 +295,7 @@ dexec(DwarfBuf *b, State *s, int locstop) case 0x0A: /* remember state */ e = malloc(s->nr*sizeof(e[0])); - if(trace) werrstr("push\n"); + if(trace) werrstr("push"); if(e == nil) return -1; void *newstack = malloc(s->nstack*sizeof(s->stack[0])); @@ -319,7 +316,7 @@ dexec(DwarfBuf *b, State *s, int locstop) continue; case 0x0B: /* restore state */ - if(trace) werrstr("pop\n"); + if(trace) werrstr("pop"); if(s->nstack == 0){ werrstr("restore state underflow"); return -1; @@ -334,7 +331,7 @@ dexec(DwarfBuf *b, State *s, int locstop) arg1 = dwarfget128(b); arg2 = dwarfget128(b); defcfa: - if(trace) werrstr("cfa %ld(r%ld)\n", arg2, arg1); + if(trace) werrstr("cfa %ld(r%ld)", arg2, arg1); if(checkreg(s, arg1) < 0) return -1; s->cfa->type = RuleRegOff; @@ -344,7 +341,7 @@ dexec(DwarfBuf *b, State *s, int locstop) case 0x0D: /* def cfa register */ arg1 = dwarfget128(b); - if(trace) werrstr("cfa reg r%ld\n", arg1); + if(trace) werrstr("cfa reg r%ld", arg1); if(s->cfa->type != RuleRegOff){ werrstr("change CFA register but CFA not in register+offset form"); return -1; @@ -357,7 +354,7 @@ dexec(DwarfBuf *b, State *s, int locstop) case 0x0E: /* def cfa offset */ arg1 = dwarfget128(b); cfaoffset: - if(trace) werrstr("cfa off %ld\n", arg1); + if(trace) werrstr("cfa off %ld", arg1); if(s->cfa->type != RuleRegOff){ werrstr("change CFA offset but CFA not in register+offset form"); return -1; @@ -366,7 +363,7 @@ dexec(DwarfBuf *b, State *s, int locstop) continue; case 0x0F: /* def cfa expression */ - if(trace) werrstr("cfa expr\n"); + if(trace) werrstr("cfa expr"); s->cfa->type = RuleLocation; s->cfa->loc.len = dwarfget128(b); s->cfa->loc.data = dwarfgetnref(b, s->cfa->loc.len); @@ -374,7 +371,7 @@ dexec(DwarfBuf *b, State *s, int locstop) case 0x10: /* def reg expression */ arg1 = dwarfget128(b); - if(trace) werrstr("reg expr r%ld\n", arg1); + if(trace) werrstr("reg expr r%ld", arg1); if(checkreg(s, arg1) < 0) return -1; s->r[arg1].type = RuleLocation; @@ -397,11 +394,98 @@ dexec(DwarfBuf *b, State *s, int locstop) goto cfaoffset; default: /* unknown */ - werrstr("unknown opcode 0x%ux in cfa program", c); + werrstr("unknown opcode 0x%x in cfa program", c); return -1; } } /* not reached */ } +int dwarfcomputecfa(Dwarf *d, DwarfExpr *cfa, PROSSYM_REGISTERS registers, ulong *cfaLocation) +{ + switch (cfa->type) { + case RuleRegOff: + *cfaLocation = registers->Registers[cfa->reg] + cfa->offset; + werrstr("cfa reg %d (%x) offset %x = %x", cfa->reg, (ulong)registers->Registers[cfa->reg], cfa->offset, cfaLocation); + break; + default: + werrstr("cfa->type %x", cfa->type); + return -1; + } + return 0; +} + +int dwarfregunwind(Dwarf *d, ulong pc, ulong fde, DwarfExpr *cfa, PROSSYM_REGISTERS registers) +{ + int i; + State s = { }; + DwarfExpr initr[sizeof(registers->Registers) / sizeof(registers->Registers[0])] = { }; + DwarfExpr r[sizeof(registers->Registers) / sizeof(registers->Registers[0])] = { }; + DwarfExpr ra; + + int nr = s.nr = sizeof(registers->Registers) / sizeof(registers->Registers[0]); + s.initr = initr; + s.r = r; + for (i = 0; i < sizeof(r) / sizeof(r[0]); i++) { + r[i].type = RuleRegister; + r[i].offset = registers->Registers[i]; + r[i].reg = i; + } + + int res = dwarfunwind(d, pc, cfa, &ra, initr, sizeof(initr) / sizeof(initr[0])); + if (res == -1) return -1; + + ulong cfaLocation; + + if (dwarfcomputecfa(d, cfa, registers, &cfaLocation) == -1) + return -1; + + for (i = 0; i < nr; i++) { + switch (r[i].type) { + case RuleUndef: + werrstr("Undefined register slot %d", i); + assert(FALSE); + break; + case RuleSame: + break; + case RuleRegister: + registers->Registers[i] = registers->Registers[r[i].reg]; + break; + case RuleRegOff: { + BOOLEAN success = + RosSymCallbacks.MemGetProc + (d->pe->fd, + ®isters->Registers[i], + r[i].offset + registers->Registers[r[i].reg], + d->addrsize); + if (!success) return -1; + } break; + case RuleCfaOffset: + { + BOOLEAN success = + RosSymCallbacks.MemGetProc + (d->pe->fd, + ®isters->Registers[i], + r[i].offset + cfaLocation, + d->addrsize); + werrstr("reg[%d] = %x: cfa offset (cfa %x, offset %x) -> @%x", i, (ulong)registers->Registers[i], cfaLocation, initr[i].offset, r[i].offset + cfaLocation); + if (!success) return -1; + } break; + default: + werrstr("We don't yet support cfa rule %d in slot %d", r[i].type, i); + assert(FALSE); + break; + } + } + + ulong cfaSpace[4]; + for (i = 0; i < sizeof(cfaSpace) / sizeof(cfaSpace[0]); i++) { + RosSymCallbacks.MemGetProc + (d->pe->fd, &cfaSpace[i], cfaLocation + (i * 4), d->addrsize); + } + werrstr("CFA(%x) [%08x, %08x, %08x, %08x]", + cfaLocation, cfaSpace[0], cfaSpace[1], cfaSpace[2], cfaSpace[3]); + + return 0; +} diff --git a/lib/rossym_new/dwarfget.c b/lib/rossym_new/dwarfget.c index d32177cd1db..949e9d9145f 100644 --- a/lib/rossym_new/dwarfget.c +++ b/lib/rossym_new/dwarfget.c @@ -2,18 +2,11 @@ * Dwarf data format parsing routines. */ -#define NTOSAPI -#include -#include -#include "rossympriv.h" -#include +#include #define NDEBUG #include -#include "dwarf.h" -#include "pe.h" - ulong dwarfget1(DwarfBuf *b) { @@ -139,7 +132,7 @@ dwarfgetaddr(DwarfBuf *b) return dwarfget8(b); default: if(++nbad == 1) - werrstr("dwarf: unexpected address size %lud in dwarfgetaddr\n", b->addrsize); + werrstr("dwarf: unexpected address size %lud in dwarfgetaddr", b->addrsize); b->p = nil; return 0; } @@ -190,7 +183,7 @@ dwarfget128(DwarfBuf *b) while(b->pep && *b->p&0x80) b->p++; if(++nbad == 1) - werrstr("dwarf: overflow during parsing of uleb128 integer\n"); + werrstr("dwarf: overflow during parsing of uleb128 integer"); return c; } diff --git a/lib/rossym_new/dwarfinfo.c b/lib/rossym_new/dwarfinfo.c index cc25499483a..1dc7fd4fdb1 100644 --- a/lib/rossym_new/dwarfinfo.c +++ b/lib/rossym_new/dwarfinfo.c @@ -2,660 +2,1011 @@ * Dwarf info parse and search. */ -#define NTOSAPI -#include -#include -#include -#include "rossympriv.h" -#include - +#include #define NDEBUG #include -#include "dwarf.h" -#include - enum { - DwarfAttrSibling = 0x01, - DwarfAttrLocation = 0x02, - DwarfAttrName = 0x03, - DwarfAttrOrdering = 0x09, - DwarfAttrByteSize = 0x0B, - DwarfAttrBitOffset = 0x0C, - DwarfAttrBitSize = 0x0D, - DwarfAttrStmtList = 0x10, - DwarfAttrLowpc = 0x11, - DwarfAttrHighpc = 0x12, - DwarfAttrLanguage = 0x13, - DwarfAttrDiscr = 0x15, - DwarfAttrDiscrValue = 0x16, - DwarfAttrVisibility = 0x17, - DwarfAttrImport = 0x18, - DwarfAttrStringLength = 0x19, - DwarfAttrCommonRef = 0x1A, - DwarfAttrCompDir = 0x1B, - DwarfAttrConstValue = 0x1C, - DwarfAttrContainingType = 0x1D, - DwarfAttrDefaultValue = 0x1E, - DwarfAttrInline = 0x20, - DwarfAttrIsOptional = 0x21, - DwarfAttrLowerBound = 0x22, - DwarfAttrProducer = 0x25, - DwarfAttrPrototyped = 0x27, - DwarfAttrReturnAddr = 0x2A, - DwarfAttrStartScope = 0x2C, - DwarfAttrStrideSize = 0x2E, - DwarfAttrUpperBound = 0x2F, - DwarfAttrAbstractOrigin = 0x31, - DwarfAttrAccessibility = 0x32, - DwarfAttrAddrClass = 0x33, - DwarfAttrArtificial = 0x34, - DwarfAttrBaseTypes = 0x35, - DwarfAttrCalling = 0x36, - DwarfAttrCount = 0x37, - DwarfAttrDataMemberLoc = 0x38, - DwarfAttrDeclColumn = 0x39, - DwarfAttrDeclFile = 0x3A, - DwarfAttrDeclLine = 0x3B, - DwarfAttrDeclaration = 0x3C, - DwarfAttrDiscrList = 0x3D, - DwarfAttrEncoding = 0x3E, - DwarfAttrExternal = 0x3F, - DwarfAttrFrameBase = 0x40, - DwarfAttrFriend = 0x41, - DwarfAttrIdentifierCase = 0x42, - DwarfAttrMacroInfo = 0x43, - DwarfAttrNamelistItem = 0x44, - DwarfAttrPriority = 0x45, - DwarfAttrSegment = 0x46, - DwarfAttrSpecification = 0x47, - DwarfAttrStaticLink = 0x48, - DwarfAttrType = 0x49, - DwarfAttrUseLocation = 0x4A, - DwarfAttrVarParam = 0x4B, - DwarfAttrVirtuality = 0x4C, - DwarfAttrVtableElemLoc = 0x4D, - DwarfAttrAllocated = 0x4E, - DwarfAttrAssociated = 0x4F, - DwarfAttrDataLocation = 0x50, - DwarfAttrStride = 0x51, - DwarfAttrEntrypc = 0x52, - DwarfAttrUseUTF8 = 0x53, - DwarfAttrExtension = 0x54, - DwarfAttrRanges = 0x55, - DwarfAttrTrampoline = 0x56, - DwarfAttrCallColumn = 0x57, - DwarfAttrCallFile = 0x58, - DwarfAttrCallLine = 0x59, - DwarfAttrDescription = 0x5A, - DwarfAttrMax, + DwarfAttrSibling = 0x01, + DwarfAttrLocation = 0x02, + DwarfAttrName = 0x03, + DwarfAttrOrdering = 0x09, + DwarfAttrByteSize = 0x0B, + DwarfAttrBitOffset = 0x0C, + DwarfAttrBitSize = 0x0D, + DwarfAttrStmtList = 0x10, + DwarfAttrLowpc = 0x11, + DwarfAttrHighpc = 0x12, + DwarfAttrLanguage = 0x13, + DwarfAttrDiscr = 0x15, + DwarfAttrDiscrValue = 0x16, + DwarfAttrVisibility = 0x17, + DwarfAttrImport = 0x18, + DwarfAttrStringLength = 0x19, + DwarfAttrCommonRef = 0x1A, + DwarfAttrCompDir = 0x1B, + DwarfAttrConstValue = 0x1C, + DwarfAttrContainingType = 0x1D, + DwarfAttrDefaultValue = 0x1E, + DwarfAttrInline = 0x20, + DwarfAttrIsOptional = 0x21, + DwarfAttrLowerBound = 0x22, + DwarfAttrProducer = 0x25, + DwarfAttrPrototyped = 0x27, + DwarfAttrReturnAddr = 0x2A, + DwarfAttrStartScope = 0x2C, + DwarfAttrStrideSize = 0x2E, + DwarfAttrUpperBound = 0x2F, + DwarfAttrAbstractOrigin = 0x31, + DwarfAttrAccessibility = 0x32, + DwarfAttrAddrClass = 0x33, + DwarfAttrArtificial = 0x34, + DwarfAttrBaseTypes = 0x35, + DwarfAttrCalling = 0x36, + DwarfAttrCount = 0x37, + DwarfAttrDataMemberLoc = 0x38, + DwarfAttrDeclColumn = 0x39, + DwarfAttrDeclFile = 0x3A, + DwarfAttrDeclLine = 0x3B, + DwarfAttrDeclaration = 0x3C, + DwarfAttrDiscrList = 0x3D, + DwarfAttrEncoding = 0x3E, + DwarfAttrExternal = 0x3F, + DwarfAttrFrameBase = 0x40, + DwarfAttrFriend = 0x41, + DwarfAttrIdentifierCase = 0x42, + DwarfAttrMacroInfo = 0x43, + DwarfAttrNamelistItem = 0x44, + DwarfAttrPriority = 0x45, + DwarfAttrSegment = 0x46, + DwarfAttrSpecification = 0x47, + DwarfAttrStaticLink = 0x48, + DwarfAttrType = 0x49, + DwarfAttrUseLocation = 0x4A, + DwarfAttrVarParam = 0x4B, + DwarfAttrVirtuality = 0x4C, + DwarfAttrVtableElemLoc = 0x4D, + DwarfAttrAllocated = 0x4E, + DwarfAttrAssociated = 0x4F, + DwarfAttrDataLocation = 0x50, + DwarfAttrStride = 0x51, + DwarfAttrEntrypc = 0x52, + DwarfAttrUseUTF8 = 0x53, + DwarfAttrExtension = 0x54, + DwarfAttrRanges = 0x55, + DwarfAttrTrampoline = 0x56, + DwarfAttrCallColumn = 0x57, + DwarfAttrCallFile = 0x58, + DwarfAttrCallLine = 0x59, + DwarfAttrDescription = 0x5A, + DwarfAttrMax, - FormAddr = 0x01, - FormDwarfBlock2 = 0x03, - FormDwarfBlock4 = 0x04, - FormData2 = 0x05, - FormData4 = 0x06, - FormData8 = 0x07, - FormString = 0x08, - FormDwarfBlock = 0x09, - FormDwarfBlock1 = 0x0A, - FormData1 = 0x0B, - FormFlag = 0x0C, - FormSdata = 0x0D, - FormStrp = 0x0E, - FormUdata = 0x0F, - FormRefAddr = 0x10, - FormRef1 = 0x11, - FormRef2 = 0x12, - FormRef4 = 0x13, - FormRef8 = 0x14, - FormRefUdata = 0x15, - FormIndirect = 0x16 + FormAddr = 0x01, + FormDwarfBlock2 = 0x03, + FormDwarfBlock4 = 0x04, + FormData2 = 0x05, + FormData4 = 0x06, + FormData8 = 0x07, + FormString = 0x08, + FormDwarfBlock = 0x09, + FormDwarfBlock1 = 0x0A, + FormData1 = 0x0B, + FormFlag = 0x0C, + FormSdata = 0x0D, + FormStrp = 0x0E, + FormUdata = 0x0F, + FormRefAddr = 0x10, + FormRef1 = 0x11, + FormRef2 = 0x12, + FormRef4 = 0x13, + FormRef8 = 0x14, + FormRefUdata = 0x15, + FormIndirect = 0x16 }; -static int parseattrs(DwarfBuf*, ulong, DwarfAbbrev*, DwarfAttrs*); +static int parseattrs(Dwarf *d, DwarfBuf*, ulong, ulong, DwarfAbbrev*, DwarfAttrs*); static int getulong(DwarfBuf*, int, ulong, ulong*, int*); static int getuchar(DwarfBuf*, int, uchar*); -static int getstring(DwarfBuf*, int, char**); +static int getstring(Dwarf *d, DwarfBuf*, int, char**); static int getblock(DwarfBuf*, int, DwarfBlock*); -static int skipform(DwarfBuf*, int); -static int constblock(Dwarf*, DwarfBlock*, ulong*); +static int skipform(Dwarf *d, DwarfBuf*, int); int dwarflookupnameinunit(Dwarf *d, ulong unit, char *name, DwarfSym *s) { - if(dwarfenumunit(d, unit, s) < 0) - return -1; - - dwarfnextsymat(d, s, 0); /* s is now the CompileUnit */ - while(dwarfnextsymat(d, s, 1) == 1) - if(s->attrs.name && strcmp(s->attrs.name, name) == 0) - return 0; - werrstr("symbol '%s' not found", name); - return -1; + DwarfSym compunit = { }; + if(dwarfenumunit(d, unit, &compunit) < 0) + return -1; + while(dwarfnextsymat(d, &compunit, s) == 0) { + werrstr("got %s looking for %s\n", s->attrs.name, name); + if(s->attrs.name && strcmp(s->attrs.name, name) == 0) + return 0; + } + werrstr("symbol '%s' not found", name); + return -1; } - int dwarflookupsubname(Dwarf *d, DwarfSym *parent, char *name, DwarfSym *s) { - *s = *parent; - while(dwarfnextsymat(d, s, parent->depth+1)) - if(s->attrs.name && strcmp(s->attrs.name, name) == 0) - return 0; - werrstr("symbol '%s' not found", name); - return -1; + *s = *parent; + while(dwarfnextsymat(d, parent, s)) + if(s->attrs.name && strcmp(s->attrs.name, name) == 0) + return 0; + werrstr("symbol '%s' not found", name); + return -1; +} + +int +dwarflookupchildtag(Dwarf *d, DwarfSym *parent, ulong tag, DwarfSym *s) +{ + int rsym = dwarfnextsymat(d, parent, s); + while (rsym == 0 && s->attrs.tag != tag) { + if (s->attrs.haskids) { + DwarfSym p = *s; + int csym = dwarflookupchildtag(d, &p, tag, s); + if (csym == 0) { + return csym; + } + } + rsym = dwarfnextsym(d, s); + } + return rsym; } int dwarflookuptag(Dwarf *d, ulong unit, ulong tag, DwarfSym *s) { - if(dwarfenumunit(d, unit, s) < 0) { - return -1; - } - - dwarfnextsymat(d, s, 0); /* s is now the CompileUnit */ - if(s->attrs.tag == tag) { - return 0; - } - while(dwarfnextsymat(d, s, 1) == 1) - if(s->attrs.tag == tag) { - return 0; - } - werrstr("symbol with tag 0x%lux not found", tag); - return -1; + DwarfSym compunit = { }; + if (dwarfenumunit(d, unit, &compunit) < 0) { + return -1; + } + do { + if (compunit.attrs.tag == tag) { + *s = compunit; + return 0; + } + if (dwarflookupchildtag(d, &compunit, tag, s) == 0) + return 0; + } while(dwarfnextsym(d, &compunit) == 0); + werrstr("symbol with tag 0x%lux not found", tag); + return -1; } int dwarfseeksym(Dwarf *d, ulong unit, ulong off, DwarfSym *s) { - if(dwarfenumunit(d, unit, s) < 0) - return -1; - s->b.p = d->info.data + unit + off; - if(dwarfnextsymat(d, s, 0) != 1) - return -1; - return 0; + DwarfSym compunit = { }; + if(dwarfenumunit(d, unit, &compunit) < 0) + return -1; + werrstr("dwarfseeksym: unit %x off %x\n", unit, off); + s->b.d = d; + s->b.p = d->info.data + unit + off; + s->b.ep = compunit.b.ep; + if(dwarfnextsymat(d, &compunit, s) == -1) + return -1; + werrstr("dwarfseeksym: unit %x off %x, tag %x", unit, off, s->attrs.tag); + return 0; } int dwarflookupfn(Dwarf *d, ulong unit, ulong pc, DwarfSym *s) { - if(dwarfenumunit(d, unit, s) < 0) - return -1; - - if(dwarfnextsymat(d, s, 0) != 1) - return -1; - /* s is now the CompileUnit */ - - while(dwarfnextsymat(d, s, 1) == 1){ - if(s->attrs.tag != TagSubprogram) - continue; - if(s->attrs.lowpc <= pc && pc < s->attrs.highpc) - return 0; - } - werrstr("fn containing pc 0x%lux not found", pc); - return -1; + DwarfSym compunit = { }; + if(dwarfenumunit(d, unit, &compunit) < 0) + return -1; + while(dwarfnextsymat(d, &compunit, s) == 0){ + if(s->attrs.tag != TagSubprogram) + continue; + if(s->attrs.lowpc <= pc && pc < s->attrs.highpc) + return 0; + } + werrstr("fn containing pc 0x%lux not found", pc); + return -1; } int dwarfenumunit(Dwarf *d, ulong unit, DwarfSym *s) { - int i; - ulong aoff, len; + int i; + ulong aoff, len; - if(unit >= d->info.len){ - werrstr("dwarf unit address 0x%x >= 0x%x out of range", unit, d->info.len); - return -1; - } - memset(s, 0, sizeof *s); - memset(&s->b, 0, sizeof s->b); + if(unit >= d->info.len){ + werrstr("dwarf unit address 0x%x >= 0x%x out of range", unit, d->info.len); + return -1; + } + memset(s, 0, sizeof *s); + memset(&s->b, 0, sizeof s->b); - s->b.d = d; - s->b.p = d->info.data + unit; - s->b.ep = d->info.data + d->info.len; - len = dwarfget4(&s->b); - s->nextunit = unit + 4 + len; - - if(s->b.ep - s->b.p < len){ - badheader: - werrstr("bad dwarf unit header at unit 0x%lux", unit); - return -1; - } - s->b.ep = s->b.p+len; - if((i=dwarfget2(&s->b)) != 2) - goto badheader; - aoff = dwarfget4(&s->b); - s->b.addrsize = dwarfget1(&s->b); - if(d->addrsize == 0) - d->addrsize = s->b.addrsize; - if(s->b.p == nil) - goto badheader; - - s->aoff = aoff; + s->b.d = d; + s->b.p = d->info.data + unit; + s->b.ep = d->info.data + d->info.len; + len = dwarfget4(&s->b); s->unit = unit; - s->depth = 0; - return 0; -} + s->nextunit = unit + 4 + len; + s->b.ep = d->info.data + s->nextunit; -int -dwarfenum(Dwarf *d, DwarfSym *s) -{ - if(dwarfenumunit(d, 0, s) < 0) - return -1; - s->allunits = 1; - return 0; + if(s->b.ep - s->b.p < len){ + badheader: + werrstr("bad dwarf unit header at unit 0x%lux end %x start %x len %x", unit, s->b.ep - d->info.data, s->b.p - d->info.data, len); + return -1; + } + s->b.ep = s->b.p+len; + if((i=dwarfget2(&s->b)) > 4) + goto badheader; + aoff = dwarfget4(&s->b); + s->b.addrsize = dwarfget1(&s->b); + if(d->addrsize == 0) + d->addrsize = s->b.addrsize; + if(s->b.p == nil) + goto badheader; + + s->aoff = aoff; + + return dwarfnextsym(d, s); } int dwarfnextsym(Dwarf *d, DwarfSym *s) { - ulong num; - DwarfAbbrev *a; + ulong num; + DwarfAbbrev *a; - if(s->attrs.haskids) - s->depth++; -top: - if(s->b.p >= s->b.ep){ - if(s->allunits && s->nextunit < d->info.len){ - if(dwarfenumunit(d, s->nextunit, s) < 0) { - return -1; - } - s->allunits = 1; - goto top; - } - return 0; - } + werrstr("sym at %x (left %x)\n", s->b.p - d->info.data, s->b.ep - s->b.p); - s->uoff = s->b.p - (d->info.data+s->unit); - num = dwarfget128(&s->b); - if(num == 0){ - if(s->depth == 0) { - return 0; - } - if(s->depth > 0) - s->depth--; - goto top; - } + num = dwarfget128(&s->b); + werrstr("abbrev num %x\n", num); + s->num = num; + if(num == 0){ + return -1; + } - a = dwarfgetabbrev(d, s->aoff, num); - if(a == nil){ - werrstr("getabbrev %ud %ud for %ud,%ud: %r\n", s->aoff, num, s->unit, s->uoff); - return -1; - } - if(parseattrs(&s->b, s->unit, a, &s->attrs) < 0) { - return -1; - } - return 1; + a = dwarfgetabbrev(d, s->aoff, num); + werrstr("a %p\n", a); + if(a == nil){ + werrstr("getabbrev %x %x for %x", s->aoff, num, s->unit); + return -1; + } + + if(parseattrs(d, &s->b, s->attrs.tag, s->unit, a, &s->attrs) < 0) { + return -1; + } + + if (s->attrs.haskids) { + DwarfSym childSkip = { }; + s->childoff = s->b.p - d->info.data; + werrstr("Set childoff at %x\n", s->childoff); + int r = dwarfnextsymat(d, s, &childSkip); + while (r == 0) { + r = dwarfnextsym(d, &childSkip); + } + s->b = childSkip.b; + } else { + s->childoff = 0; + } + return 0; } int -dwarfnextsymat(Dwarf *d, DwarfSym *s, int depth) +dwarfnextsymat(Dwarf *d, DwarfSym *parent, DwarfSym *child) { - int r; - DwarfSym t; - uint sib; + uint sib; - if(s->depth == depth && s->attrs.have.sibling){ - sib = s->attrs.sibling; - if(sib < d->info.len && d->info.data+sib >= s->b.p) - s->b.p = d->info.data+sib; - s->attrs.haskids = 0; - } + if (!parent->attrs.haskids || !parent->childoff) + return -1; - /* - * The funny game with t and s make sure that - * if we get to the end of a run of a particular - * depth, we leave s so that a call to nextsymat with depth-1 - * will actually produce the desired guy. We could change - * the interface to dwarfnextsym instead, but I'm scared - * to touch it. - */ - t = *s; - for(;;){ - if((r = dwarfnextsym(d, &t)) != 1) { - return r; - } - if(t.depth < depth){ - /* went too far - nothing to see */ - return 0; - } - *s = t; - if(t.depth == depth) { - return 1; - } - } + child->unit = parent->unit; + child->aoff = parent->aoff; + child->depth = parent->depth + 1; + if(child->attrs.have.sibling){ + sib = child->attrs.sibling; + if(sib < d->info.len && d->info.data+sib > child->b.p) + child->b.p = d->info.data+sib; + else if (sib >= d->info.len) { + werrstr("sibling reported as out of bounds %d vs %d", sib, d->info.len); + return -1; + } else if (d->info.data+sib+parent->unit < child->b.p) { + werrstr("subsequent sibling is listed before prev %d vs %d", sib+parent->unit, child->b.p - d->info.data); + return -1; + } + } + + // Uninitialized + if (!child->b.d) { + child->b = parent->b; + child->b.p = parent->childoff + parent->b.d->info.data; + werrstr("Rewound to childoff %x\n", parent->childoff); + } + + return dwarfnextsym(d, child); } typedef struct Parse Parse; struct Parse { - int name; - int off; - int haveoff; - int type; + const char *namestr; + int name; + int off; + int haveoff; + int type; }; +#define ATTR(x) (#x)+9, x #define OFFSET(x) offsetof(DwarfAttrs, x), offsetof(DwarfAttrs, have.x) static Parse plist[] = { /* Font Tab 4 */ - { DwarfAttrAbstractOrigin, OFFSET(abstractorigin), TReference }, - { DwarfAttrAccessibility, OFFSET(accessibility), TConstant }, - { DwarfAttrAddrClass, OFFSET(addrclass), TConstant }, - { DwarfAttrArtificial, OFFSET(isartificial), TFlag }, - { DwarfAttrBaseTypes, OFFSET(basetypes), TReference }, - { DwarfAttrBitOffset, OFFSET(bitoffset), TConstant }, - { DwarfAttrBitSize, OFFSET(bitsize), TConstant }, - { DwarfAttrByteSize, OFFSET(bytesize), TConstant }, - { DwarfAttrCalling, OFFSET(calling), TConstant }, - { DwarfAttrCommonRef, OFFSET(commonref), TReference }, - { DwarfAttrCompDir, OFFSET(compdir), TString }, - { DwarfAttrConstValue, OFFSET(constvalue), TString|TConstant|TBlock }, - { DwarfAttrContainingType, OFFSET(containingtype), TReference }, - { DwarfAttrCount, OFFSET(count), TConstant|TReference }, - { DwarfAttrDataMemberLoc, OFFSET(datamemberloc), TBlock|TConstant|TReference }, - { DwarfAttrDeclColumn, OFFSET(declcolumn), TConstant }, - { DwarfAttrDeclFile, OFFSET(declfile), TConstant }, - { DwarfAttrDeclLine, OFFSET(declline), TConstant }, - { DwarfAttrDeclaration, OFFSET(isdeclaration), TFlag }, - { DwarfAttrDefaultValue, OFFSET(defaultvalue), TReference }, - { DwarfAttrDiscr, OFFSET(discr), TReference }, - { DwarfAttrDiscrList, OFFSET(discrlist), TBlock }, - { DwarfAttrDiscrValue, OFFSET(discrvalue), TConstant }, - { DwarfAttrEncoding, OFFSET(encoding), TConstant }, - { DwarfAttrExternal, OFFSET(isexternal), TFlag }, - { DwarfAttrFrameBase, OFFSET(framebase), TBlock|TConstant }, - { DwarfAttrFriend, OFFSET(friend), TReference }, - { DwarfAttrHighpc, OFFSET(highpc), TAddress }, - { DwarfAttrEntrypc, OFFSET(entrypc), TAddress }, - { DwarfAttrIdentifierCase, OFFSET(identifiercase), TConstant }, - { DwarfAttrImport, OFFSET(import), TReference }, - { DwarfAttrInline, OFFSET(inlined), TConstant }, - { DwarfAttrIsOptional, OFFSET(isoptional), TFlag }, - { DwarfAttrLanguage, OFFSET(language), TConstant }, - { DwarfAttrLocation, OFFSET(location), TBlock|TConstant }, - { DwarfAttrLowerBound, OFFSET(lowerbound), TConstant|TReference }, - { DwarfAttrLowpc, OFFSET(lowpc), TAddress }, - { DwarfAttrMacroInfo, OFFSET(macroinfo), TConstant }, - { DwarfAttrName, OFFSET(name), TString }, - { DwarfAttrNamelistItem, OFFSET(namelistitem), TBlock }, - { DwarfAttrOrdering, OFFSET(ordering), TConstant }, - { DwarfAttrPriority, OFFSET(priority), TReference }, - { DwarfAttrProducer, OFFSET(producer), TString }, - { DwarfAttrPrototyped, OFFSET(isprototyped), TFlag }, - { DwarfAttrRanges, OFFSET(ranges), TReference }, - { DwarfAttrReturnAddr, OFFSET(returnaddr), TBlock|TConstant }, - { DwarfAttrSegment, OFFSET(segment), TBlock|TConstant }, - { DwarfAttrSibling, OFFSET(sibling), TReference }, - { DwarfAttrSpecification, OFFSET(specification), TReference }, - { DwarfAttrStartScope, OFFSET(startscope), TConstant }, - { DwarfAttrStaticLink, OFFSET(staticlink), TBlock|TConstant }, - { DwarfAttrStmtList, OFFSET(stmtlist), TConstant }, - { DwarfAttrStrideSize, OFFSET(stridesize), TConstant }, - { DwarfAttrStringLength, OFFSET(stringlength), TBlock|TConstant }, - { DwarfAttrType, OFFSET(type), TReference }, - { DwarfAttrUpperBound, OFFSET(upperbound), TConstant|TReference }, - { DwarfAttrUseLocation, OFFSET(uselocation), TBlock|TConstant }, - { DwarfAttrVarParam, OFFSET(isvarparam), TFlag }, - { DwarfAttrVirtuality, OFFSET(virtuality), TConstant }, - { DwarfAttrVisibility, OFFSET(visibility), TConstant }, - { DwarfAttrVtableElemLoc, OFFSET(vtableelemloc), TBlock|TReference }, - { } + { ATTR(DwarfAttrAbstractOrigin), OFFSET(abstractorigin), TReference }, + { ATTR(DwarfAttrAccessibility), OFFSET(accessibility), TConstant }, + { ATTR(DwarfAttrAddrClass), OFFSET(addrclass), TConstant }, + { ATTR(DwarfAttrBaseTypes), OFFSET(basetypes), TReference }, + { ATTR(DwarfAttrBitOffset), OFFSET(bitoffset), TConstant }, + { ATTR(DwarfAttrBitSize), OFFSET(bitsize), TConstant }, + { ATTR(DwarfAttrByteSize), OFFSET(bytesize), TConstant }, + { ATTR(DwarfAttrCalling), OFFSET(calling), TConstant }, + { ATTR(DwarfAttrCommonRef), OFFSET(commonref), TReference }, + { ATTR(DwarfAttrCompDir), OFFSET(compdir), TString }, + { ATTR(DwarfAttrConstValue), OFFSET(constvalue), TString|TConstant|TBlock }, + { ATTR(DwarfAttrContainingType), OFFSET(containingtype), TReference }, + { ATTR(DwarfAttrCount), OFFSET(count), TConstant|TReference }, + { ATTR(DwarfAttrDataMemberLoc), OFFSET(datamemberloc), TBlock|TConstant|TReference }, + { ATTR(DwarfAttrDeclColumn), OFFSET(declcolumn), TConstant }, + { ATTR(DwarfAttrDeclFile), OFFSET(declfile), TConstant }, + { ATTR(DwarfAttrDeclLine), OFFSET(declline), TConstant }, + { ATTR(DwarfAttrDefaultValue), OFFSET(defaultvalue), TReference }, + { ATTR(DwarfAttrDiscr), OFFSET(discr), TReference }, + { ATTR(DwarfAttrDiscrList), OFFSET(discrlist), TBlock }, + { ATTR(DwarfAttrDiscrValue), OFFSET(discrvalue), TConstant }, + { ATTR(DwarfAttrEncoding), OFFSET(encoding), TConstant }, + { ATTR(DwarfAttrFrameBase), OFFSET(framebase), TBlock|TConstant }, + { ATTR(DwarfAttrFriend), OFFSET(friend), TReference }, + { ATTR(DwarfAttrHighpc), OFFSET(highpc), TAddress }, + { ATTR(DwarfAttrEntrypc), OFFSET(entrypc), TAddress }, + { ATTR(DwarfAttrIdentifierCase), OFFSET(identifiercase), TConstant }, + { ATTR(DwarfAttrImport), OFFSET(import), TReference }, + { ATTR(DwarfAttrInline), OFFSET(inlined), TConstant }, + { ATTR(DwarfAttrArtificial), OFFSET(isartificial), TFlag }, + { ATTR(DwarfAttrDeclaration), OFFSET(isdeclaration), TFlag }, + { ATTR(DwarfAttrExternal), OFFSET(isexternal), TFlag }, + { ATTR(DwarfAttrIsOptional), OFFSET(isoptional), TFlag }, + { ATTR(DwarfAttrPrototyped), OFFSET(isprototyped), TFlag }, + { ATTR(DwarfAttrVarParam), OFFSET(isvarparam), TFlag }, + { ATTR(DwarfAttrLanguage), OFFSET(language), TConstant }, + { ATTR(DwarfAttrLocation), OFFSET(location), TReference|TBlock }, + { ATTR(DwarfAttrLowerBound), OFFSET(lowerbound), TConstant|TReference }, + { ATTR(DwarfAttrLowpc), OFFSET(lowpc), TAddress }, + { ATTR(DwarfAttrMacroInfo), OFFSET(macroinfo), TConstant }, + { ATTR(DwarfAttrName), OFFSET(name), TString }, + { ATTR(DwarfAttrNamelistItem), OFFSET(namelistitem), TBlock }, + { ATTR(DwarfAttrOrdering), OFFSET(ordering), TConstant }, + { ATTR(DwarfAttrPriority), OFFSET(priority), TReference }, + { ATTR(DwarfAttrProducer), OFFSET(producer), TString }, + { ATTR(DwarfAttrRanges), OFFSET(ranges), TReference }, + { ATTR(DwarfAttrReturnAddr), OFFSET(returnaddr), TBlock|TConstant }, + { ATTR(DwarfAttrSegment), OFFSET(segment), TBlock|TConstant }, + { ATTR(DwarfAttrSibling), OFFSET(sibling), TReference }, + { ATTR(DwarfAttrSpecification), OFFSET(specification), TReference }, + { ATTR(DwarfAttrStartScope), OFFSET(startscope), TConstant }, + { ATTR(DwarfAttrStaticLink), OFFSET(staticlink), TBlock|TConstant }, + { ATTR(DwarfAttrStmtList), OFFSET(stmtlist), TConstant }, + { ATTR(DwarfAttrStrideSize), OFFSET(stridesize), TConstant }, + { ATTR(DwarfAttrStringLength), OFFSET(stringlength), TBlock|TConstant }, + { ATTR(DwarfAttrType), OFFSET(type), TReference }, + { ATTR(DwarfAttrUpperBound), OFFSET(upperbound), TConstant|TReference }, + { ATTR(DwarfAttrUseLocation), OFFSET(uselocation), TBlock|TConstant }, + { ATTR(DwarfAttrVirtuality), OFFSET(virtuality), TConstant }, + { ATTR(DwarfAttrVisibility), OFFSET(visibility), TConstant }, + { ATTR(DwarfAttrVtableElemLoc), OFFSET(vtableelemloc), TBlock|TReference }, + { } }; static Parse ptab[DwarfAttrMax]; static int -parseattrs(DwarfBuf *b, ulong unit, DwarfAbbrev *a, DwarfAttrs *attrs) +parseattrs(Dwarf *d, DwarfBuf *b, ulong tag, ulong unit, DwarfAbbrev *a, DwarfAttrs *attrs) { - int i, f, n, got; - static int nbad; - void *v; + int i, f, n, got; + static int nbad; + void *v; - /* initialize ptab first time through for quick access */ - if(ptab[DwarfAttrName].name != DwarfAttrName) - for(i=0; plist[i].name; i++) - ptab[plist[i].name] = plist[i]; + /* initialize ptab first time through for quick access */ + if(ptab[DwarfAttrName].name != DwarfAttrName) + for(i=0; plist[i].name; i++) + ptab[plist[i].name] = plist[i]; - memset(attrs, 0, sizeof *attrs); - attrs->tag = a->tag; - attrs->haskids = a->haskids; + memset(attrs, 0, sizeof *attrs); + attrs->tag = a->tag; + attrs->haskids = a->haskids; - for(i=0; inattr; i++){ - n = a->attr[i].name; - f = a->attr[i].form; - if(n < 0 || n >= DwarfAttrMax || ptab[n].name==0){ - if(++nbad == 1) - werrstr("dwarf parse attrs: unexpected attribute name 0x%x", n); - continue; //return -1; - } - v = (char*)attrs + ptab[n].off; - got = 0; - if(f == FormIndirect) - f = dwarfget128(b); - if((ptab[n].type&(TConstant|TReference|TAddress)) - && getulong(b, f, unit, v, &got) >= 0) - ; - else if((ptab[n].type&TFlag) && getuchar(b, f, v) >= 0) - got = TFlag; - else if((ptab[n].type&TString) && getstring(b, f, v) >= 0) - got = TString; - else if((ptab[n].type&TBlock) && getblock(b, f, v) >= 0) - got = TBlock; - else{ - if(skipform(b, f) < 0){ - if(++nbad == 1) - werrstr("dwarf parse attrs: cannot skip form %d", f); - return -1; - } - } - if(got == TBlock && (ptab[n].type&TConstant)) - got = constblock(b->d, v, v); - *((uchar*)attrs+ptab[n].haveoff) = got; - } - return 0; + for(i=0; inattr; i++){ + n = a->attr[i].name; + f = a->attr[i].form; + werrstr("struct: (@%x) n %x f %x (%d %d)\n", b->p - d->info.data, n, f, ptab[n].haveoff, ptab[n].off); + if(n < 0 || n >= DwarfAttrMax || ptab[n].name==0) { + if (skipform(d, b, f) < 0) { + if(++nbad == 1) + werrstr("dwarf parse attrs: cannot skip form %d", f); + return -1; + } + continue; + } + v = (char*)attrs + ptab[n].off; + got = 0; + if(f == FormIndirect) + f = dwarfget128(b); + if((ptab[n].type&(TConstant|TReference|TAddress)) + && getulong(b, f, unit, v, &got) >= 0) + ; + else if((ptab[n].type&TFlag) && getuchar(b, f, v) >= 0) + got = TFlag; + else if((ptab[n].type&TString) && getstring(d, b, f, v) >= 0) + got = TString; + else if((ptab[n].type&TBlock) && getblock(b, f, v) >= 0) { + got = TBlock; + } else { + werrstr("Skipping form %x\n", f); + if(skipform(d, b, f) < 0){ + //if(++nbad == 1) + werrstr("dwarf parse attrs: cannot skip form %d", f); + return -1; + } + } +#if 0 + if(got == TBlock && (ptab[n].type&TConstant)) + got = constblock(b->d, v, v); +#endif + *((uchar*)attrs+ptab[n].haveoff) = got; + } + + if (attrs->have.name) + werrstr("%s: tag %x kids %d (last %x)\n", attrs->name, attrs->tag, attrs->haskids, b->p - b->d->info.data); + + return 0; } static int getulong(DwarfBuf *b, int form, ulong unit, ulong *u, int *type) { - static int nbad; - uvlong uv; + static int nbad; + uvlong uv; - switch(form){ - default: - return -1; + switch(form){ + default: + return -1; /* addresses */ - case FormAddr: - *type = TAddress; - *u = dwarfgetaddr(b); - return 0; + case FormAddr: + *type = TAddress; + *u = dwarfgetaddr(b); + return 0; /* references */ - case FormRefAddr: - /* absolute ref in .debug_info */ - *type = TReference; - *u = dwarfgetaddr(b); - return 0; - case FormRef1: - *u = dwarfget1(b); - goto relativeref; - case FormRef2: - *u = dwarfget2(b); - goto relativeref; - case FormRef4: - *u = dwarfget4(b); - goto relativeref; - case FormRef8: - *u = dwarfget8(b); - goto relativeref; - case FormRefUdata: - *u = dwarfget128(b); - relativeref: - *u += unit; - *type = TReference; - return 0; + case FormRefAddr: + /* absolute ref in .debug_info */ + *type = TReference; + *u = dwarfgetaddr(b); + return 0; + case FormRef1: + *u = dwarfget1(b); + goto relativeref; + case FormRef2: + *u = dwarfget2(b); + goto relativeref; + case FormRef4: + *u = dwarfget4(b); + goto relativeref; + case FormRef8: + *u = dwarfget8(b); + goto relativeref; + case FormRefUdata: + *u = dwarfget128(b); + relativeref: + *u += unit; + *type = TReference; + return 0; /* constants */ - case FormData1: - *u = dwarfget1(b); - goto constant; - case FormData2: - *u = dwarfget2(b); - goto constant; - case FormData4: - *u = dwarfget4(b); - goto constant; - case FormData8: - uv = dwarfget8(b); - *u = uv; - if(uv != *u && ++nbad == 1) - werrstr("dwarf: truncating 64-bit attribute constants"); - goto constant; - case FormSdata: - *u = dwarfget128s(b); - goto constant; - case FormUdata: - *u = dwarfget128(b); - constant: - *type = TConstant; - return 0; - } + case FormData1: + *u = dwarfget1(b); + goto constant; + case FormData2: + *u = dwarfget2(b); + goto constant; + case FormData4: + *u = dwarfget4(b); + goto constant; + case FormData8: + uv = dwarfget8(b); + *u = uv; + if(uv != *u && ++nbad == 1) + werrstr("dwarf: truncating 64-bit attribute constants"); + goto constant; + case FormSdata: + *u = dwarfget128s(b); + goto constant; + case FormUdata: + *u = dwarfget128(b); + constant: + *type = TConstant; + return 0; + } } static int getuchar(DwarfBuf *b, int form, uchar *u) { - switch(form){ - default: - return -1; + switch(form){ + default: + return -1; - case FormFlag: - *u = dwarfget1(b); - return 0; - } + case FormFlag: + *u = dwarfget1(b); + return 0; + } } static int -getstring(DwarfBuf *b, int form, char **s) +getstring(Dwarf *d, DwarfBuf *b, int form, char **s) { - static int nbad; - ulong u; + static int nbad; + ulong u, x; - switch(form){ - default: - return -1; + switch(form){ + default: + return -1; - case FormString: - *s = dwarfgetstring(b); - return 0; + case FormString: + x = b->p - d->info.data; + *s = dwarfgetstring(b); + for (u = 0; (*s)[u]; u++) { + assert(isprint((*s)[u])); + } + return 0; - case FormStrp: - u = dwarfget4(b); - if(u >= b->d->str.len){ - if(++nbad == 1) - werrstr("dwarf: bad string pointer 0x%lux in attribute", u); - /* don't return error - maybe can proceed */ - *s = nil; - }else - *s = (char*)b->d->str.data + u; - return 0; + case FormStrp: + u = dwarfget4(b); + if(u >= b->d->str.len){ + if(++nbad == 1) + werrstr("dwarf: bad string pointer 0x%lux in attribute", u); + /* don't return error - maybe can proceed */ + *s = nil; + }else + *s = (char*)b->d->str.data + u; + return 0; - } + } } static int getblock(DwarfBuf *b, int form, DwarfBlock *bl) { - ulong n; + ulong n; - switch(form){ - default: - return -1; - case FormDwarfBlock: - n = dwarfget128(b); - goto copyn; - case FormDwarfBlock1: - n = dwarfget1(b); - goto copyn; - case FormDwarfBlock2: - n = dwarfget2(b); - goto copyn; - case FormDwarfBlock4: - n = dwarfget4(b); - copyn: - bl->data = dwarfgetnref(b, n); - bl->len = n; - if(bl->data == nil) - return -1; - return 0; - } -} - -static int -constblock(Dwarf *d, DwarfBlock *bl, ulong *pval) -{ - DwarfBuf b; - - memset(&b, 0, sizeof b); - b.p = bl->data; - b.ep = bl->data+bl->len; - b.d = d; - - switch(dwarfget1(&b)){ - case OpAddr: - *pval = dwarfgetaddr(&b); - return TConstant; - case OpConst1u: - *pval = dwarfget1(&b); - return TConstant; - case OpConst1s: - *pval = (schar)dwarfget1(&b); - return TConstant; - case OpConst2u: - *pval = dwarfget2(&b); - return TConstant; - case OpConst2s: - *pval = (s16int)dwarfget2(&b); - return TConstant; - case OpConst4u: - *pval = dwarfget4(&b); - return TConstant; - case OpConst4s: - *pval = (s32int)dwarfget4(&b); - return TConstant; - case OpConst8u: - *pval = (u64int)dwarfget8(&b); - return TConstant; - case OpConst8s: - *pval = (s64int)dwarfget8(&b); - return TConstant; - case OpConstu: - *pval = dwarfget128(&b); - return TConstant; - case OpConsts: - *pval = dwarfget128s(&b); - return TConstant; - case OpPlusUconst: - *pval = dwarfget128(&b); - return TConstant; - default: - return TBlock; - } + switch(form){ + default: + return -1; + case FormDwarfBlock: + n = dwarfget128(b); + goto copyn; + case FormDwarfBlock1: + n = dwarfget1(b); + goto copyn; + case FormDwarfBlock2: + n = dwarfget2(b); + goto copyn; + case FormDwarfBlock4: + n = dwarfget4(b); + copyn: + bl->data = dwarfgetnref(b, n); + bl->len = n; + if(bl->data == nil) + return -1; + return 0; + } } /* last resort */ static int -skipform(DwarfBuf *b, int form) +skipform(Dwarf *d, DwarfBuf *b, int form) { - int type; - DwarfVal val; + int type; + DwarfVal val; - if(getulong(b, form, 0, &val.c, &type) < 0 - && getuchar(b, form, (uchar*)&val) < 0 - && getstring(b, form, &val.s) < 0 - && getblock(b, form, &val.b) < 0) - return -1; - return 0; + if(getulong(b, form, 0, &val.c, &type) < 0 + && getuchar(b, form, (uchar*)&val) < 0 + && getstring(d, b, form, &val.s) < 0 + && getblock(b, form, &val.b) < 0) + return -1; + return 0; } +void stackinit(DwarfStack *stack) +{ + memset(stack, 0, sizeof(*stack)); + stack->data = stack->storage; + stack->length = 0; stack->max = sizeof(stack->storage) / sizeof(stack->storage[0]); +} + +void stackpush(DwarfStack *stack, ulong value) +{ + if (stack->length == stack->max) { + ulong *newstack = malloc(sizeof(ulong)*stack->max*2); + memcpy(newstack, stack->data, sizeof(ulong)*stack->length); + if (stack->data != stack->storage) + free(stack->data); + stack->data = newstack; + stack->max *= 2; + } + werrstr("stack[%d] = %x", stack->length, value); + stack->data[stack->length++] = value; +} + +ulong stackpop(DwarfStack *stack) +{ + ASSERT(stack->length > 0); + ulong val = stack->data[--stack->length]; + werrstr("pop stack[%d] -> %x", stack->length, val); + return val; +} + +void stackfree(DwarfStack *stack) +{ + if (stack->data != stack->storage) + free(stack->data); +} + +// Returns -1 on failure +int dwarfgetarg(Dwarf *d, const char *name, DwarfBuf *buf, ulong cfa, PROSSYM_REGISTERS registers, ulong *result) +{ + int ret = 0; + DwarfStack stack = { }; + stackinit(&stack); + stackpush(&stack, cfa); + while (buf->p < buf->ep) { + int opcode = dwarfget1(buf); + werrstr("opcode %x", opcode); + switch (opcode) { + case 0: + buf->p = buf->ep; + break; + case OpAddr: + if (d->addrsize == 4) { + stackpush(&stack, dwarfget4(buf)); + break; + } else { + werrstr("%s: we only support 4 byte addrs", name); + goto fatal; + } + case OpConst1s: { + signed char c = dwarfget1(buf); + stackpush(&stack, c); + } break; + case OpConst1u: + stackpush(&stack, dwarfget1(buf)); + break; + case OpConst2s: { + signed short s = dwarfget2(buf); + stackpush(&stack, s); + } break; + case OpConst2u: + stackpush(&stack, dwarfget2(buf)); + break; + case OpConst4s: { + signed int i = dwarfget4(buf); + stackpush(&stack, i); + } break; + case OpConst4u: + stackpush(&stack, dwarfget4(buf)); + break; + case OpConst8s: + case OpConst8u: + werrstr("const 8 not yet supported"); + goto fatal; + case OpConsts: + stackpush(&stack, dwarfget128s(buf)); + break; + case OpConstu: + stackpush(&stack, dwarfget128(buf)); + break; + case OpDup: { + ulong popped = stackpop(&stack); + stackpush(&stack, popped); + stackpush(&stack, popped); + } break; + case OpDrop: + stackpop(&stack); + break; + case OpOver: { + if (stack.length < 2) goto fatal; + stackpush(&stack, stack.data[stack.length-2]); + } break; + case OpPick: { + ulong arg = dwarfget1(buf); + if (arg >= stack.length) goto fatal; + arg = stack.data[stack.length-1-arg]; + stackpush(&stack, arg); + } break; + case OpSwap: { + ulong a = stackpop(&stack), b = stackpop(&stack); + stackpush(&stack, b); + stackpush(&stack, a); + } break; + case OpRot: { + ulong a = stackpop(&stack), b = stackpop(&stack), c = stackpop(&stack); + stackpush(&stack, b); + stackpush(&stack, c); + stackpush(&stack, a); + } break; + case OpXderef: + case OpXderefSize: + werrstr("Xderef not yet supported"); + goto fatal; + case OpAbs: { + long a = stackpop(&stack); + stackpush(&stack, a < 0 ? -a : a); + } break; + case OpAnd: + stackpush(&stack, stackpop(&stack) & stackpop(&stack)); + break; + case OpDiv: { + ulong a = stackpop(&stack), b = stackpop(&stack); + stackpush(&stack, b / a); + } break; + case OpMinus: { + ulong a = stackpop(&stack), b = stackpop(&stack); + stackpush(&stack, b - a); + } break; + case OpMod: { + ulong a = stackpop(&stack), b = stackpop(&stack); + stackpush(&stack, b % a); + } break; + case OpMul: + stackpush(&stack, stackpop(&stack) * stackpop(&stack)); + break; + case OpNeg: + stackpush(&stack, -stackpop(&stack)); + break; + case OpNot: + stackpush(&stack, ~stackpop(&stack)); + break; + case OpOr: + stackpush(&stack, stackpop(&stack) | stackpop(&stack)); + break; + case OpPlus: + stackpush(&stack, stackpop(&stack) + stackpop(&stack)); + break; + case OpPlusUconst: + stackpush(&stack, stackpop(&stack) + dwarfget128(buf)); + break; + case OpShl: { + ulong a = stackpop(&stack), b = stackpop(&stack); + stackpush(&stack, b << a); + } break; + case OpShr: { + ulong a = stackpop(&stack), b = stackpop(&stack); + stackpush(&stack, b >> a); + } break; + case OpShra: { + ulong a = stackpop(&stack); + long b = stackpop(&stack); + if (b < 0) + b = -(-b >> a); + else + b = b >> a; + stackpush(&stack, b); + } break; + case OpXor: + stackpush(&stack, stackpop(&stack) ^ stackpop(&stack)); + break; + case OpSkip: + buf->p += dwarfget2(buf); + break; + case OpBra: { + ulong a = dwarfget2(buf); + if (stackpop(&stack)) + buf->p += a; + } break; + case OpEq: + stackpush(&stack, stackpop(&stack) == stackpop(&stack)); + break; + case OpGe: { + ulong a = stackpop(&stack), b = stackpop(&stack); + stackpush(&stack, b >= a); + } break; + case OpGt: { + ulong a = stackpop(&stack), b = stackpop(&stack); + stackpush(&stack, b > a); + } break; + case OpLe: { + ulong a = stackpop(&stack), b = stackpop(&stack); + stackpush(&stack, b <= a); + } break; + case OpLt: { + ulong a = stackpop(&stack), b = stackpop(&stack); + stackpush(&stack, b < a); + } break; + case OpNe: + stackpush(&stack, stackpop(&stack) != stackpop(&stack)); + break; + case OpNop: + break; + case OpDeref: { + ulong val, addr = stackpop(&stack); + if (!RosSymCallbacks.MemGetProc + (d->pe->fd, + &val, + addr, + d->addrsize)) + goto fatal; + stackpush(&stack, val); + } break; + case OpDerefSize: { + ulong val, addr = stackpop(&stack), size = dwarfget1(buf); + if (!RosSymCallbacks.MemGetProc + (d->pe->fd, + &val, + addr, + size)) + goto fatal; + stackpush(&stack, val); + } break; + case OpFbreg: { + ulong val, addr = cfa, offset = dwarfget128s(buf); + werrstr("FBREG cfa %x offset %x", cfa, offset); + if (!RosSymCallbacks.MemGetProc + (d->pe->fd, + &val, + addr+offset, + d->addrsize)) + goto fatal; + stackpush(&stack, val); + } break; + case OpPiece: + werrstr("OpPiece not supported"); + goto fatal; + default: + if (opcode >= OpLit0 && opcode < OpReg0) + stackpush(&stack, opcode - OpLit0); + else if (opcode >= OpReg0 && opcode < OpBreg0) { + ulong reg = opcode - OpReg0; + werrstr("REG[%d] value %x", reg, (ulong)registers->Registers[reg]); + stackpush(&stack, registers->Registers[reg]); + } else if (opcode >= OpBreg0 && opcode < OpRegx) { + ulong val, + reg = opcode - OpBreg0, + addr = registers->Registers[reg], + offset = dwarfget128s(buf); + werrstr("BREG[%d] reg %x offset %x", reg, addr, offset); + if (!RosSymCallbacks.MemGetProc + (d->pe->fd, + &val, + addr + offset, + d->addrsize)) + goto fatal; + stackpush(&stack, val); + } else { + werrstr("opcode %x not supported", opcode); + goto fatal; + } + break; + } + } + if (stack.length < 1) goto fatal; + *result = stackpop(&stack); + werrstr("%s: value %x", name, *result); + goto finish; + +fatal: + ret = -1; + +finish: + stackfree(&stack); + return ret; +} + +int dwarfargvalue(Dwarf *d, DwarfSym *proc, ulong pc, ulong cfa, PROSSYM_REGISTERS registers, DwarfParam *parameter) +{ + int gotarg; + DwarfSym unit = { }; + + if (dwarfenumunit(d, proc->unit, &unit) == -1) + return -1; + + werrstr("lookup in unit %x-%x, pc %x", unit.attrs.lowpc, unit.attrs.highpc, pc); + pc -= unit.attrs.lowpc; + + werrstr("paramblock %s -> unit %x type %x fde %x len %d registers %x", + parameter->name, + parameter->unit, + parameter->type, + parameter->fde, + parameter->len, + registers); + + // Seek our range in loc + DwarfBuf locbuf; + DwarfBuf instream = { }; + + locbuf.d = d; + locbuf.addrsize = d->addrsize; + + if (parameter->loctype == TConstant) { + locbuf.p = d->loc.data + parameter->fde; + locbuf.ep = d->loc.data + d->loc.len; + ulong start, end, len; + do { + len = 0; + start = dwarfget4(&locbuf); + end = dwarfget4(&locbuf); + if (start && end) { + len = dwarfget2(&locbuf); + instream = locbuf; + instream.ep = instream.p + len; + locbuf.p = instream.ep; + } + werrstr("ip %x s %x e %x (%x bytes)", pc, start, end, len); + } while (start && end && (start > pc || end <= pc)); + } else if (parameter->loctype == TBlock) { + instream = locbuf; + instream.p = (void *)parameter->fde; + instream.ep = instream.p + parameter->len; + } else { + werrstr("Wrong block type for parameter %s", parameter->name); + return -1; + } + + gotarg = dwarfgetarg(d, parameter->name, &instream, cfa, registers, ¶meter->value); + if (gotarg == -1) + return -1; + + return 0; +} + +void +dwarfdumpsym(Dwarf *d, DwarfSym *s) +{ + int i, j; + werrstr("tag %x\n", s->attrs.tag); + for (j = 0; plist[j].name; j++) { + char *have = ((char*)&s->attrs) + plist[j].haveoff; + char *attr = ((char*)&s->attrs) + plist[j].off; + if (*have == TString) { + char *str = *((char **)attr); + werrstr("%s: %s\n", plist[j].namestr, str); + } else if (*have == TReference) { + DwarfVal *val = ((DwarfVal*)attr); + werrstr("%s: %x:%x\n", plist[j].namestr, val->b.data, val->b.len); + } else if (*have) + werrstr("%s: (%x)\n", plist[j].namestr, *have); + } +} + +int +dwarfgetparams(Dwarf *d, DwarfSym *s, ulong pc, int pnum, DwarfParam *paramblocks) +{ + int ip = 0; + DwarfSym param = { }; + int res = dwarfnextsymat(d, s, ¶m); + while (res == 0 && ip < pnum) { + if (param.attrs.tag == TagFormalParameter && + param.attrs.have.name && + param.attrs.have.location) { + paramblocks[ip].name = malloc(strlen(param.attrs.name)+1); + strcpy(paramblocks[ip].name, param.attrs.name); + paramblocks[ip].unit = param.unit; + paramblocks[ip].type = param.attrs.type; + paramblocks[ip].loctype = param.attrs.have.location; + paramblocks[ip].len = param.attrs.location.b.len; + paramblocks[ip].fde = param.attrs.location.b.data; + werrstr("param[%d] block %s -> type %x loctype %x fde %x len %x", + ip, + paramblocks[ip].name, + paramblocks[ip].type, + paramblocks[ip].loctype, + paramblocks[ip].fde, + paramblocks[ip].len); + ip++; + } + res = dwarfnextsymat(d, s, ¶m); + } + return ip; +} diff --git a/lib/rossym_new/dwarfopen.c b/lib/rossym_new/dwarfopen.c index 9a5f20c80fa..02d414d834b 100644 --- a/lib/rossym_new/dwarfopen.c +++ b/lib/rossym_new/dwarfopen.c @@ -1,15 +1,8 @@ -#define NTOSAPI -#include -#include -#include "rossympriv.h" -#include +#include #define NDEBUG #include -#include "dwarf.h" -#include "pe.h" - /* Adapted for PE */ Dwarf* @@ -30,9 +23,10 @@ dwarfopen(Pe *pe) if(pe->loadsection(pe, ".debug_abbrev", &d->abbrev) < 0 || pe->loadsection(pe, ".debug_aranges", &d->aranges) < 0 || pe->loadsection(pe, ".debug_line", &d->line) < 0 - || pe->loadsection(pe, ".debug_pubnames", &d->pubnames) < 0 - || pe->loadsection(pe, ".debug_info", &d->info) < 0) + || pe->loadsection(pe, ".debug_info", &d->info) < 0 + || pe->loadsection(pe, ".debug_loc", &d->loc) < 0) goto err; + pe->loadsection(pe, ".debug_pubnames", &d->pubnames); pe->loadsection(pe, ".debug_frame", &d->frame); pe->loadsection(pe, ".debug_ranges", &d->ranges); pe->loadsection(pe, ".debug_str", &d->str); @@ -49,6 +43,7 @@ err: free(d->ranges.data); free(d->str.data); free(d->info.data); + free(d->loc.data); free(d); return nil; } diff --git a/lib/rossym_new/dwarfpc.c b/lib/rossym_new/dwarfpc.c index 4edb5569ae9..eb7b7d2d9f8 100644 --- a/lib/rossym_new/dwarfpc.c +++ b/lib/rossym_new/dwarfpc.c @@ -11,375 +11,397 @@ * The encoding may be small, but it sure isn't simple! */ -#define NTOSAPI -#include -#include -#include "rossympriv.h" -#include +#include #define NDEBUG #include - -#include "dwarf.h" -#include "pe.h" - #define trace 0 enum { - Isstmt = 1<<0, - BasicDwarfBlock = 1<<1, - EndSequence = 1<<2, - PrologueEnd = 1<<3, - EpilogueBegin = 1<<4 + Isstmt = 1<<0, + BasicDwarfBlock = 1<<1, + EndSequence = 1<<2, + PrologueEnd = 1<<3, + EpilogueBegin = 1<<4 }; typedef struct State State; struct State { - ulong addr; - ulong file; - ulong line; - ulong column; - ulong flags; - ulong isa; + ulong addr; + ulong file; + ulong line; + ulong column; + ulong flags; + ulong isa; }; int -dwarfpctoline(Dwarf *d, ulong pc, char **cdir, char **dir, char **file, char **function, ulong *line, ulong *mtime, ulong *length) +dwarfpctoline(Dwarf *d, DwarfSym *proc, ulong pc, char **file, char **function, ulong *line) { - uchar *prog, *opcount, *end, *dirs; - ulong off, unit, len, vers, x, start, lastline; - int i, first, firstline, op, a, l, quantum, isstmt, linebase, linerange, opcodebase, nf; - char *files, *s; - DwarfBuf b; - DwarfSym sym; - State emit, cur, reset; - uchar **f, **newf; + char *cdir; + uchar *prog, *opcount, *end, *dirs; + ulong off, unit, len, vers, x, start, lastline; + int i, first, firstline, op, a, l, quantum, isstmt, linebase, linerange, opcodebase, nf; + char *files, *s; + DwarfBuf b; + DwarfSym sym; + State emit, cur, reset; + char **f, **newf; - f = nil; + f = nil; + memset(proc, 0, sizeof(*proc)); - if(dwarfaddrtounit(d, pc, &unit) < 0 - || dwarflookuptag(d, unit, TagCompileUnit, &sym) < 0) - return -1; + int runit = dwarfaddrtounit(d, pc, &unit); + if (runit < 0) + return -1; + int rtag = dwarflookuptag(d, unit, TagCompileUnit, &sym); + if (rtag < 0) + return -1; - if(!sym.attrs.have.stmtlist){ - werrstr("no line mapping information for 0x%x", pc); - return -1; - } - off = sym.attrs.stmtlist; - if(off >= d->line.len){ - werrstr("bad stmtlist\n"); - goto bad; + if(!sym.attrs.have.stmtlist){ + werrstr("no line mapping information for 0x%x", pc); + return -1; + } + off = sym.attrs.stmtlist; + if(off >= d->line.len){ + werrstr("bad stmtlist"); + goto bad; + } + + if(trace) werrstr("unit 0x%x stmtlist 0x%x", unit, sym.attrs.stmtlist); + + memset(&b, 0, sizeof b); + b.d = d; + b.p = d->line.data + off; + b.ep = b.p + d->line.len; + b.addrsize = sym.b.addrsize; /* should i get this from somewhere else? */ + + len = dwarfget4(&b); + if(b.p==nil || b.p+len > b.ep || b.p+len < b.p){ + werrstr("bad len"); + goto bad; + } + + b.ep = b.p+len; + vers = dwarfget2(&b); + if(vers != 2){ + werrstr("bad dwarf version 0x%x", vers); + return -1; + } + + len = dwarfget4(&b); + if(b.p==nil || b.p+len > b.ep || b.p+len < b.p){ + werrstr("another bad len"); + goto bad; + } + prog = b.p+len; + + quantum = dwarfget1(&b); + isstmt = dwarfget1(&b); + linebase = (schar)dwarfget1(&b); + linerange = (schar)dwarfget1(&b); + opcodebase = dwarfget1(&b); + + opcount = b.p-1; + dwarfgetnref(&b, opcodebase-1); + if(b.p == nil){ + werrstr("bad opcode chart"); + goto bad; + } + + /* just skip the files and dirs for now; we'll come back */ + dirs = b.p; + while (b.p && *b.p) + dwarfgetstring(&b); + dwarfget1(&b); + + files = (char*)b.p; + while(b.p!=nil && *b.p!=0){ + dwarfgetstring(&b); + dwarfget128(&b); + dwarfget128(&b); + dwarfget128(&b); + } + dwarfget1(&b); + + /* move on to the program */ + if(b.p == nil || b.p > prog){ + werrstr("bad header"); + goto bad; + } + b.p = prog; + + reset.addr = 0; + reset.file = 1; + reset.line = 1; + reset.column = 0; + reset.flags = isstmt ? Isstmt : 0; + reset.isa = 0; + + cur = reset; + emit = reset; + nf = 0; + start = 0; + if(trace) werrstr("program @ %lu ... %.*H opbase = %d", b.p - d->line.data, b.ep-b.p, b.p, opcodebase); + first = 1; + while(b.p != nil){ + firstline = 0; + op = dwarfget1(&b); + if(trace) werrstr("\tline %lu, addr 0x%x, op %d %.10H", cur.line, cur.addr, op, b.p); + if(op >= opcodebase){ + a = (op - opcodebase) / linerange; + l = (op - opcodebase) % linerange + linebase; + cur.line += l; + cur.addr += a * quantum; + if(trace) werrstr(" +%d,%d", a, l); + emit: + if(first){ + if(cur.addr > pc){ + werrstr("found wrong line mapping 0x%x for pc 0x%x", cur.addr, pc); + /* This is an overzealous check. gcc can produce discontiguous ranges + and reorder statements, so it's possible for a future line to start + ahead of pc and still find a matching one. */ + /*goto out;*/ + firstline = 1; + } + first = 0; + start = cur.addr; + } + if(cur.addr > pc && !firstline) + break; + if(b.p == nil){ + werrstr("buffer underflow in line mapping"); + goto out; + } + emit = cur; + if(emit.flags & EndSequence){ + werrstr("found wrong line mapping 0x%x-0x%x for pc 0x%x", start, cur.addr, pc); + goto out; + } + cur.flags &= ~(BasicDwarfBlock|PrologueEnd|EpilogueBegin); + }else{ + switch(op){ + case 0: /* extended op code */ + if(trace) werrstr(" ext"); + len = dwarfget128(&b); + end = b.p+len; + if(b.p == nil || end > b.ep || end < b.p || len < 1) + goto bad; + switch(dwarfget1(&b)){ + case 1: /* end sequence */ + if(trace) werrstr(" end"); + cur.flags |= EndSequence; + goto emit; + case 2: /* set address */ + cur.addr = dwarfgetaddr(&b); + if(trace) werrstr(" set pc 0x%x", cur.addr); + break; + case 3: /* define file */ + newf = malloc(nf+1*sizeof(f[0])); + if (newf) + RtlMoveMemory(newf, f, nf*sizeof(f[0])); + if(newf == nil) + goto out; + free(f); + f = newf; + f[nf++] = s = dwarfgetstring(&b); + DPRINT1("str %s", s); + dwarfget128(&b); + dwarfget128(&b); + dwarfget128(&b); + if(trace) werrstr(" def file %s", s); + break; + } + if(b.p == nil || b.p > end) + goto bad; + b.p = end; + break; + case 1: /* emit */ + if(trace) werrstr(" emit"); + goto emit; + case 2: /* advance pc */ + a = dwarfget128(&b); + if(trace) werrstr(" advance pc + %lu", a*quantum); + cur.addr += a * quantum; + break; + case 3: /* advance line */ + l = dwarfget128s(&b); + if(trace) werrstr(" advance line + %ld", l); + cur.line += l; + break; + case 4: /* set file */ + if(trace) werrstr(" set file"); + cur.file = dwarfget128s(&b); + break; + case 5: /* set column */ + if(trace) werrstr(" set column"); + cur.column = dwarfget128(&b); + break; + case 6: /* negate stmt */ + if(trace) werrstr(" negate stmt"); + cur.flags ^= Isstmt; + break; + case 7: /* set basic block */ + if(trace) werrstr(" set basic block"); + cur.flags |= BasicDwarfBlock; + break; + case 8: /* const add pc */ + a = (255 - opcodebase) / linerange * quantum; + if(trace) werrstr(" const add pc + %d", a); + cur.addr += a; + break; + case 9: /* fixed advance pc */ + a = dwarfget2(&b); + if(trace) werrstr(" fixed advance pc + %d", a); + cur.addr += a; + break; + case 10: /* set prologue end */ + if(trace) werrstr(" set prologue end"); + cur.flags |= PrologueEnd; + break; + case 11: /* set epilogue begin */ + if(trace) werrstr(" set epilogue begin"); + cur.flags |= EpilogueBegin; + break; + case 12: /* set isa */ + if(trace) werrstr(" set isa"); + cur.isa = dwarfget128(&b); + break; + default: /* something new - skip it */ + if(trace) werrstr(" unknown %d", opcount[op]); + for(i=0; i 0 && b.p!=nil && *b.p!=0; i--){ + dwarfgetstring(&b); + dwarfget128(&b); + dwarfget128(&b); + dwarfget128(&b); + } + if(b.p == nil){ + werrstr("problem parsing file data second time (cannot happen)"); + goto bad; + } + if(*b.p == 0){ + if(i >= nf){ + werrstr("bad file index in mapping data"); + goto bad; + } + b.p = (uchar*)f[i]; + } + s = dwarfgetstring(&b); + *file = s; + i = dwarfget128(&b); /* directory */ + x = dwarfget128(&b); + x = dwarfget128(&b); + + /* fetch dir name */ + cdir = sym.attrs.have.compdir ? sym.attrs.compdir : 0; + + char *dwarfdir; + dwarfdir = nil; + b.p = dirs; + for (x = 1; b.p && *b.p; x++) { + dwarfdir = dwarfgetstring(&b); + if (x == i) break; } - if(trace) werrstr("unit 0x%x stmtlist 0x%x", unit, sym.attrs.stmtlist); - - memset(&b, 0, sizeof b); - b.d = d; - b.p = d->line.data + off; - b.ep = b.p + d->line.len; - b.addrsize = sym.b.addrsize; /* should i get this from somewhere else? */ - - len = dwarfget4(&b); - if(b.p==nil || b.p+len > b.ep || b.p+len < b.p){ - werrstr("bad len\n"); - goto bad; - } - - b.ep = b.p+len; - vers = dwarfget2(&b); - if(vers != 2){ - werrstr("bad dwarf version 0x%x", vers); - return -1; - } - - len = dwarfget4(&b); - if(b.p==nil || b.p+len > b.ep || b.p+len < b.p){ - werrstr("another bad len\n"); - goto bad; - } - prog = b.p+len; - - quantum = dwarfget1(&b); - isstmt = dwarfget1(&b); - linebase = (schar)dwarfget1(&b); - linerange = (schar)dwarfget1(&b); - opcodebase = dwarfget1(&b); - - opcount = b.p-1; - dwarfgetnref(&b, opcodebase-1); - if(b.p == nil){ - werrstr("bad opcode chart\n"); - goto bad; - } - - /* just skip the files and dirs for now; we'll come back */ - dirs = b.p; - while (b.p && *b.p) - dwarfgetstring(&b); - dwarfget1(&b); - - files = (char*)b.p; - while(b.p!=nil && *b.p!=0){ - dwarfgetstring(&b); - dwarfget128(&b); - dwarfget128(&b); - dwarfget128(&b); - } - dwarfget1(&b); - - /* move on to the program */ - if(b.p == nil || b.p > prog){ - werrstr("bad header\n"); - goto bad; - } - b.p = prog; - - reset.addr = 0; - reset.file = 1; - reset.line = 1; - reset.column = 0; - reset.flags = isstmt ? Isstmt : 0; - reset.isa = 0; - - cur = reset; - emit = reset; - nf = 0; - start = 0; - if(trace) werrstr("program @ %lu ... %.*H opbase = %d\n", b.p - d->line.data, b.ep-b.p, b.p, opcodebase); - first = 1; - while(b.p != nil){ - firstline = 0; - op = dwarfget1(&b); - if(trace) werrstr("\tline %lu, addr 0x%x, op %d %.10H", cur.line, cur.addr, op, b.p); - if(op >= opcodebase){ - a = (op - opcodebase) / linerange; - l = (op - opcodebase) % linerange + linebase; - cur.line += l; - cur.addr += a * quantum; - if(trace) werrstr(" +%d,%d\n", a, l); - emit: - if(first){ - if(cur.addr > pc){ - werrstr("found wrong line mapping 0x%x for pc 0x%x", cur.addr, pc); - /* This is an overzealous check. gcc can produce discontiguous ranges - and reorder statements, so it's possible for a future line to start - ahead of pc and still find a matching one. */ - /*goto out;*/ - firstline = 1; + if (!cdir && dwarfdir) + cdir = dwarfdir; + + char *filefull = malloc(strlen(cdir) + strlen(*file) + 2); + strcpy(filefull, cdir); + strcat(filefull, "/"); + strcat(filefull, *file); + *file = filefull; + + *function = nil; + lastline = 0; + + runit = dwarfaddrtounit(d, pc, &unit); + if (runit == 0) { + DwarfSym compunit = { }; + int renum = dwarfenumunit(d, unit, &compunit); + if (renum < 0) + return -1; + renum = dwarfnextsymat(d, &compunit, proc); + while (renum == 0) { + if (proc->attrs.tag == TagSubprogram && + proc->attrs.have.name) + { + if (proc->attrs.lowpc <= pc && proc->attrs.highpc > pc) { + *function = malloc(strlen(proc->attrs.name)+1); + strcpy(*function, proc->attrs.name); + goto done; } - first = 0; - start = cur.addr; } - if(cur.addr > pc && !firstline) - break; - if(b.p == nil){ - werrstr("buffer underflow in line mapping"); - goto out; - } - emit = cur; - if(emit.flags & EndSequence){ - werrstr("found wrong line mapping 0x%x-0x%x for pc 0x%x", start, cur.addr, pc); - goto out; - } - cur.flags &= ~(BasicDwarfBlock|PrologueEnd|EpilogueBegin); - }else{ - switch(op){ - case 0: /* extended op code */ - if(trace) werrstr(" ext"); - len = dwarfget128(&b); - end = b.p+len; - if(b.p == nil || end > b.ep || end < b.p || len < 1) - goto bad; - switch(dwarfget1(&b)){ - case 1: /* end sequence */ - if(trace) werrstr(" end\n"); - cur.flags |= EndSequence; - goto emit; - case 2: /* set address */ - cur.addr = dwarfgetaddr(&b); - if(trace) werrstr(" set pc 0x%x\n", cur.addr); - break; - case 3: /* define file */ - newf = malloc(nf+1*sizeof(f[0])); - if (newf) - RtlMoveMemory(newf, f, nf*sizeof(f[0])); - if(newf == nil) - goto out; - f[nf++] = b.p; - s = dwarfgetstring(&b); - dwarfget128(&b); - dwarfget128(&b); - dwarfget128(&b); - if(trace) werrstr(" def file %s\n", s); - break; + renum = dwarfnextsym(d, proc); + } + } + + // Next search by declaration + runit = dwarfaddrtounit(d, pc, &unit); + if (runit == 0) { + DwarfSym compunit = { }; + int renum = dwarfenumunit(d, unit, &compunit); + if (renum < 0) + return -1; + renum = dwarfnextsymat(d, &compunit, proc); + while (renum == 0) { + if (proc->attrs.tag == TagSubprogram && + proc->attrs.have.name && + proc->attrs.declfile == emit.file) + { + if (proc->attrs.declline <= *line && + proc->attrs.declline > lastline) { + free(*function); + *function = malloc(strlen(proc->attrs.name)+1); + strcpy(*function, proc->attrs.name); + goto done; } - if(b.p == nil || b.p > end) - goto bad; - b.p = end; - break; - case 1: /* emit */ - if(trace) werrstr(" emit\n"); - goto emit; - case 2: /* advance pc */ - a = dwarfget128(&b); - if(trace) werrstr(" advance pc + %lu\n", a*quantum); - cur.addr += a * quantum; - break; - case 3: /* advance line */ - l = dwarfget128s(&b); - if(trace) werrstr(" advance line + %ld\n", l); - cur.line += l; - break; - case 4: /* set file */ - if(trace) werrstr(" set file\n"); - cur.file = dwarfget128s(&b); - break; - case 5: /* set column */ - if(trace) werrstr(" set column\n"); - cur.column = dwarfget128(&b); - break; - case 6: /* negate stmt */ - if(trace) werrstr(" negate stmt\n"); - cur.flags ^= Isstmt; - break; - case 7: /* set basic block */ - if(trace) werrstr(" set basic block\n"); - cur.flags |= BasicDwarfBlock; - break; - case 8: /* const add pc */ - a = (255 - opcodebase) / linerange * quantum; - if(trace) werrstr(" const add pc + %d\n", a); - cur.addr += a; - break; - case 9: /* fixed advance pc */ - a = dwarfget2(&b); - if(trace) werrstr(" fixed advance pc + %d\n", a); - cur.addr += a; - break; - case 10: /* set prologue end */ - if(trace) werrstr(" set prologue end\n"); - cur.flags |= PrologueEnd; - break; - case 11: /* set epilogue begin */ - if(trace) werrstr(" set epilogue begin\n"); - cur.flags |= EpilogueBegin; - break; - case 12: /* set isa */ - if(trace) werrstr(" set isa\n"); - cur.isa = dwarfget128(&b); - break; - default: /* something new - skip it */ - if(trace) werrstr(" unknown %d\n", opcount[op]); - for(i=0; iattrs.declline; } - } - } - if(b.p == nil) - goto bad; - - /* finally! the data we seek is in "emit" */ - - if(emit.file == 0){ - werrstr("invalid file index in mapping data"); - goto out; - } - if(line) - *line = emit.line; - - /* skip over first emit.file-2 guys */ - b.p = (uchar*)files; - for(i=emit.file-1; i > 0 && b.p!=nil && *b.p!=0; i--){ - dwarfgetstring(&b); - dwarfget128(&b); - dwarfget128(&b); - dwarfget128(&b); - } - if(b.p == nil){ - werrstr("problem parsing file data second time (cannot happen)"); - goto bad; - } - if(*b.p == 0){ - if(i >= nf){ - werrstr("bad file index in mapping data"); - goto bad; - } - b.p = f[i]; - } - s = dwarfgetstring(&b); - if(file) - *file = s; - i = dwarfget128(&b); /* directory */ - x = dwarfget128(&b); - if(mtime) - *mtime = x; - x = dwarfget128(&b); - if(length) - *length = x; - - /* fetch dir name */ - if(cdir) - *cdir = sym.attrs.compdir; - - if(dir){ - *dir = nil; - b.p = dirs; - for (x = 1; b.p && *b.p; x++) - if (x == i) { - *dir = dwarfgetstring(&b); - break; - } - } - - *function = nil; - lastline = 0; -#if 0 - if (dwarfenumunit(d, unit, &proc) >= 0) { - dwarfnextsymat(d, &proc, 0); - while (dwarfnextsymat(d, &proc, 1) == 1) { - if (proc.attrs.tag == TagSubprogram && - proc.attrs.have.name && - proc.attrs.declfile == emit.file && - proc.attrs.declline <= *line && - proc.attrs.declline > lastline) { - lastline = proc.attrs.declline; - free(*function); - *function = malloc(strlen(proc.attrs.name)+1); - strcpy(*function, proc.attrs.name); - } - } - } -#elif 1 - ulong lastaddr = 0; - *function = NULL; - for (i = 0; i < d->pe->nsymbols; i++) { - if (d->pe->symtab[i].address > lastaddr && - d->pe->symtab[i].address <= pc - d->pe->imagebase && - d->pe->symtab[i].address < d->pe->imagesize) { - lastaddr = d->pe->symtab[i].address; - *function = d->pe->symtab[i].name; - } - } -#else - // *sigh* we get unrelocated low_pc and high_pc because the dwarf symbols - // are not 'loaded' in the PE sense. - if (dwarflookupfn(d, unit, pc, &proc) >= 0) { - *function = malloc(strlen(proc.attrs.name)+1); - strcpy(*function, proc.attrs.name); - } -#endif - - /* free at last, free at last */ - free(f); - return 0; + renum = dwarfnextsym(d, proc); + } + } + /* free at last, free at last */ +done: + free(f); + return 0; bad: - werrstr("corrupted line mapping for 0x%x", pc); + werrstr("corrupted line mapping for 0x%x", pc); out: - free(f); - return -1; + free(f); + return -1; } +VOID RosSymFreeInfo(PROSSYM_LINEINFO LineInfo) +{ + int i; + free(LineInfo->FileName); + LineInfo->FileName = NULL; + free(LineInfo->FunctionName); + LineInfo->FunctionName = NULL; + for (i = 0; i < sizeof(LineInfo->Parameters)/sizeof(LineInfo->Parameters[0]); i++) + free(LineInfo->Parameters[i].ValueName); +} diff --git a/lib/rossym_new/dwarfpubnames.c b/lib/rossym_new/dwarfpubnames.c index 8a8d802b797..1f8712de29f 100644 --- a/lib/rossym_new/dwarfpubnames.c +++ b/lib/rossym_new/dwarfpubnames.c @@ -1,13 +1,8 @@ -#define NTOSAPI -#include -#include -#include +#include #define NDEBUG #include -#include "dwarf.h" - static int _dwarfnametounit(Dwarf *d, char *name, DwarfBlock *bl, DwarfSym *s) { diff --git a/lib/rossym_new/find.c b/lib/rossym_new/find.c index 5f613dc573d..74a96e823f4 100644 --- a/lib/rossym_new/find.c +++ b/lib/rossym_new/find.c @@ -35,52 +35,223 @@ * SUCH DAMAGE. */ -#include -#include -#include "rossympriv.h" +#include #define NDEBUG #include -#include "rossym.h" -#include "dwarf.h" -#include "pe.h" - BOOLEAN -RosSymGetAddressInformation(PROSSYM_INFO RosSymInfo, - ULONG_PTR RelativeAddress, - ULONG *LineNumber, - char *FileName, - char *FunctionName) +RosSymGetAddressInformation +(PROSSYM_INFO RosSymInfo, + ULONG_PTR RelativeAddress, + PROSSYM_LINEINFO RosSymLineInfo) { - char *cdir, *dir, *file, *function; - ulong line, mtime, length; + ROSSYM_REGISTERS registers; + DwarfParam params[sizeof(RosSymLineInfo->Parameters)/sizeof(RosSymLineInfo->Parameters[0])]; + DwarfSym proc = { }; + int i; int res = dwarfpctoline (RosSymInfo, + &proc, RelativeAddress + RosSymInfo->pe->imagebase, - &cdir, - &dir, - &file, - &function, - &line, - &mtime, - &length); - if (res != -1) { - *LineNumber = line; - FileName[0] = 0; - if (dir) { - strcpy(FileName, dir); - strcat(FileName, "/"); - } - if (file) - strcat(FileName, file); - FunctionName[0] = 0; - if (function) - strcpy(FunctionName, function); - return TRUE; - } else { + &RosSymLineInfo->FileName, + &RosSymLineInfo->FunctionName, + &RosSymLineInfo->LineNumber); + if (res == -1) { + werrstr("Could not get basic function info"); return FALSE; - } + } + + if (!(RosSymLineInfo->Flags & ROSSYM_LINEINFO_HAS_REGISTERS)) + return TRUE; + + registers = RosSymLineInfo->Registers; + + DwarfExpr cfa = { }; + ulong cfaLocation; + if (dwarfregunwind + (RosSymInfo, + RelativeAddress + RosSymInfo->pe->imagebase, + proc.attrs.framebase.c, + &cfa, + ®isters) == -1) { + werrstr("Can't get cfa location for %s", RosSymLineInfo->FunctionName); + return TRUE; + } + + res = dwarfgetparams + (RosSymInfo, + &proc, + RelativeAddress + RosSymInfo->pe->imagebase, + sizeof(params)/sizeof(params[0]), + params); + + if (res == -1) { + werrstr("%s: could not get params at all", RosSymLineInfo->FunctionName); + RosSymLineInfo->NumParams = 0; + return TRUE; + } + + werrstr("%s: res %d", RosSymLineInfo->FunctionName, res); + RosSymLineInfo->NumParams = res; + + res = dwarfcomputecfa(RosSymInfo, &cfa, ®isters, &cfaLocation); + if (res == -1) { + werrstr("%s: could not get our own cfa", RosSymLineInfo->FunctionName); + return TRUE; + } + + for (i = 0; i < RosSymLineInfo->NumParams; i++) { + werrstr("Getting arg %s, unit %x, type %x", + params[i].name, params[i].unit, params[i].type); + res = dwarfargvalue + (RosSymInfo, + &proc, + RelativeAddress + RosSymInfo->pe->imagebase, + cfaLocation, + ®isters, + ¶ms[i]); + if (res == -1) { RosSymLineInfo->NumParams = i; return TRUE; } + werrstr("%s: %x", params[i].name, params[i].value); + RosSymLineInfo->Parameters[i].ValueName = malloc(strlen(params[i].name)+1); + strcpy(RosSymLineInfo->Parameters[i].ValueName, params[i].name); + free(params[i].name); + RosSymLineInfo->Parameters[i].Value = params[i].value; + } + + return TRUE; +} + +VOID +RosSymFreeAggregate(PROSSYM_AGGREGATE Aggregate) +{ + int i; + for (i = 0; i < Aggregate->NumElements; i++) { + free(Aggregate->Elements[i].Name); + free(Aggregate->Elements[i].Type); + } + free(Aggregate->Elements); +} + +BOOLEAN +RosSymAggregate(PROSSYM_INFO RosSymInfo, PCHAR Type, PROSSYM_AGGREGATE Aggregate) +{ + char *tchar; + ulong unit, typeoff = 0; + DwarfSym type = { }; + // Get the first unit + if (dwarfaddrtounit(RosSymInfo, RosSymInfo->pe->codestart + RosSymInfo->pe->imagebase, &unit) == -1) + return FALSE; + + if (Type[0] == '#') { + for (tchar = Type + 1; *tchar; tchar++) { + typeoff *= 10; + typeoff += *tchar - '0'; + } + if (dwarfseeksym(RosSymInfo, unit, typeoff, &type) == -1) + return FALSE; + } else if (dwarflookupnameinunit(RosSymInfo, unit, Type, &type) != 0 || + (type.attrs.tag != TagStructType && type.attrs.tag != TagUnionType)) + return FALSE; + + DwarfSym element = { }, inner = { }; + int count = 0; + + werrstr("type %s (want %s) type %x\n", type.attrs.name, Type, type.attrs.type); + + if (type.attrs.have.type) { + if (dwarfseeksym(RosSymInfo, unit, type.attrs.type, &inner) == -1) + return FALSE; + type = inner; + } + + werrstr("finding members %d\n", type.attrs.haskids); + while (dwarfnextsymat(RosSymInfo, &type, &element) != -1) { + if (element.attrs.have.name) + werrstr("%x %s\n", element.attrs.tag, element.attrs.name); + if (element.attrs.tag == TagMember) count++; + } + + werrstr("%d members\n", count); + + if (!count) return FALSE; + memset(&element, 0, sizeof(element)); + Aggregate->NumElements = count; + Aggregate->Elements = malloc(sizeof(ROSSYM_AGGREGATE_MEMBER) * count); + count = 0; + werrstr("Enumerating %s\n", Type); + while (dwarfnextsymat(RosSymInfo, &type, &element) != -1) { + memset(&Aggregate->Elements[count], 0, sizeof(*Aggregate->Elements)); + if (element.attrs.tag == TagMember) { + if (element.attrs.have.name) { + Aggregate->Elements[count].Name = malloc(strlen(element.attrs.name) + 1); + strcpy(Aggregate->Elements[count].Name, element.attrs.name); + } + Aggregate->Elements[count].TypeId = element.attrs.type; + // Seek our range in loc + DwarfBuf locbuf; + DwarfBuf instream = { }; + + locbuf.d = RosSymInfo; + locbuf.addrsize = RosSymInfo->addrsize; + + if (element.attrs.have.datamemberloc) { + instream = locbuf; + instream.p = element.attrs.datamemberloc.b.data; + instream.ep = element.attrs.datamemberloc.b.data + element.attrs.datamemberloc.b.len; + werrstr("datamemberloc type %x %p:%x\n", + element.attrs.have.datamemberloc, + element.attrs.datamemberloc.b.data, element.attrs.datamemberloc.b.len); + } + + if (dwarfgetarg(RosSymInfo, element.attrs.name, &instream, 0, NULL, &Aggregate->Elements[count].BaseOffset) == -1) + Aggregate->Elements[count].BaseOffset = -1; + werrstr("tag %x name %s base %x type %x\n", + element.attrs.tag, element.attrs.name, + Aggregate->Elements[count].BaseOffset, + Aggregate->Elements[count].TypeId); + count++; + } + } + for (count = 0; count < Aggregate->NumElements; count++) { + memset(&type, 0, sizeof(type)); + memset(&inner, 0, sizeof(inner)); + werrstr("seeking type %x (%s) from %s\n", + Aggregate->Elements[count].TypeId, + Aggregate->Elements[count].Type, + Aggregate->Elements[count].Name); + dwarfseeksym(RosSymInfo, unit, Aggregate->Elements[count].TypeId, &type); + while (type.attrs.have.type && type.attrs.tag != TagPointerType) { + if (dwarfseeksym(RosSymInfo, unit, type.attrs.type, &inner) == -1) + return FALSE; + type = inner; + } + //dwarfdumpsym(RosSymInfo, &type); + if (type.attrs.have.name) { + Aggregate->Elements[count].Type = malloc(strlen(type.attrs.name) + 1); + strcpy(Aggregate->Elements[count].Type, type.attrs.name); + } else { + char strbuf[128] = {'#'}, *bufptr = strbuf + 1; + ulong idcopy = Aggregate->Elements[count].TypeId; + ulong mult = 1; + while (mult * 10 < idcopy) mult *= 10; + while (mult > 0) { + *bufptr++ = '0' + ((idcopy / mult) % 10); + mult /= 10; + } + Aggregate->Elements[count].Type = malloc(strlen(strbuf) + 1); + strcpy(Aggregate->Elements[count].Type, strbuf); + } + if (type.attrs.tag == TagPointerType) + Aggregate->Elements[count].Size = RosSymInfo->addrsize; + else + Aggregate->Elements[count].Size = type.attrs.bytesize; + if (type.attrs.have.bitsize) + Aggregate->Elements[count].Bits = type.attrs.bitsize; + if (type.attrs.have.bitoffset) + Aggregate->Elements[count].FirstBit = type.attrs.bitoffset; + } + return TRUE; } /* EOF */ diff --git a/lib/rossym_new/fromfile.c b/lib/rossym_new/fromfile.c index 00884a5a56b..587d2b719e7 100644 --- a/lib/rossym_new/fromfile.c +++ b/lib/rossym_new/fromfile.c @@ -7,204 +7,151 @@ * PROGRAMMERS: Ge van Geldorp (gvg@reactos.com) */ -#define NTOSAPI -#include -#include -#include -#include "rossympriv.h" -#include "pe.h" -#include - -#include "dwarf.h" +#include #define NDEBUG #include +#define SYMBOL_SIZE 18 + extern NTSTATUS RosSymStatus; BOOLEAN RosSymCreateFromFile(PVOID FileContext, PROSSYM_INFO *RosSymInfo) { - IMAGE_DOS_HEADER DosHeader; - IMAGE_NT_HEADERS NtHeaders; - PIMAGE_SECTION_HEADER SectionHeaders; - unsigned SectionIndex; - unsigned SymbolTable, NumSymbols; + IMAGE_DOS_HEADER DosHeader; + IMAGE_NT_HEADERS NtHeaders; + PIMAGE_SECTION_HEADER SectionHeaders; + unsigned SectionIndex; + unsigned SymbolTable, NumSymbols; - /* Load DOS header */ - if (! RosSymSeekFile(FileContext, 0)) + /* Load DOS header */ + if (! RosSymSeekFile(FileContext, 0)) { - DPRINT1("Could not rewind file\n"); - return FALSE; - } - if (! RosSymReadFile(FileContext, &DosHeader, sizeof(IMAGE_DOS_HEADER))) - { - DPRINT1("Failed to read DOS header %x\n", RosSymStatus); - return FALSE; + werrstr("Could not rewind file\n"); + return FALSE; } - if (! ROSSYM_IS_VALID_DOS_HEADER(&DosHeader)) + if (! RosSymReadFile(FileContext, &DosHeader, sizeof(IMAGE_DOS_HEADER))) { - DPRINT1("Image doesn't have a valid DOS header\n"); - return FALSE; + werrstr("Failed to read DOS header %x\n", RosSymStatus); + return FALSE; + } + if (! ROSSYM_IS_VALID_DOS_HEADER(&DosHeader)) + { + werrstr("Image doesn't have a valid DOS header\n"); + return FALSE; } - /* Load NT headers */ - if (! RosSymSeekFile(FileContext, DosHeader.e_lfanew)) + /* Load NT headers */ + if (! RosSymSeekFile(FileContext, DosHeader.e_lfanew)) { - DPRINT1("Failed seeking to NT headers\n"); - return FALSE; + werrstr("Failed seeking to NT headers\n"); + return FALSE; } - if (! RosSymReadFile(FileContext, &NtHeaders, sizeof(IMAGE_NT_HEADERS))) + if (! RosSymReadFile(FileContext, &NtHeaders, sizeof(IMAGE_NT_HEADERS))) { - DPRINT1("Failed to read NT headers\n"); - return FALSE; + werrstr("Failed to read NT headers\n"); + return FALSE; } - if (! ROSSYM_IS_VALID_NT_HEADERS(&NtHeaders)) + if (! ROSSYM_IS_VALID_NT_HEADERS(&NtHeaders)) { - DPRINT1("Image doesn't have a valid PE header\n"); - return FALSE; + werrstr("Image doesn't have a valid PE header\n"); + return FALSE; } - SymbolTable = NtHeaders.FileHeader.PointerToSymbolTable; - NumSymbols = NtHeaders.FileHeader.NumberOfSymbols; + SymbolTable = NtHeaders.FileHeader.PointerToSymbolTable; + NumSymbols = NtHeaders.FileHeader.NumberOfSymbols; - if (!NumSymbols) + if (!NumSymbols) { - DPRINT1("Image doesn't have debug symbols\n"); - return FALSE; + werrstr("Image doesn't have debug symbols\n"); + return FALSE; } - DPRINT("SymbolTable %x NumSymbols %x\n", SymbolTable, NumSymbols); + DPRINT("SymbolTable %x NumSymbols %x\n", SymbolTable, NumSymbols); - /* Load section headers */ - if (! RosSymSeekFile(FileContext, (char *) IMAGE_FIRST_SECTION(&NtHeaders) - - (char *) &NtHeaders + DosHeader.e_lfanew)) + /* Load section headers */ + if (! RosSymSeekFile(FileContext, (char *) IMAGE_FIRST_SECTION(&NtHeaders) - + (char *) &NtHeaders + DosHeader.e_lfanew)) { - DPRINT1("Failed seeking to section headers\n"); - return FALSE; + werrstr("Failed seeking to section headers\n"); + return FALSE; } - DPRINT("Alloc section headers\n"); - SectionHeaders = RosSymAllocMem(NtHeaders.FileHeader.NumberOfSections - * sizeof(IMAGE_SECTION_HEADER)); - if (NULL == SectionHeaders) + DPRINT("Alloc section headers\n"); + SectionHeaders = RosSymAllocMem(NtHeaders.FileHeader.NumberOfSections + * sizeof(IMAGE_SECTION_HEADER)); + if (NULL == SectionHeaders) { - DPRINT1("Failed to allocate memory for %u section headers\n", - NtHeaders.FileHeader.NumberOfSections); - return FALSE; + werrstr("Failed to allocate memory for %u section headers\n", + NtHeaders.FileHeader.NumberOfSections); + return FALSE; } - if (! RosSymReadFile(FileContext, SectionHeaders, - NtHeaders.FileHeader.NumberOfSections - * sizeof(IMAGE_SECTION_HEADER))) + if (! RosSymReadFile(FileContext, SectionHeaders, + NtHeaders.FileHeader.NumberOfSections + * sizeof(IMAGE_SECTION_HEADER))) { - RosSymFreeMem(SectionHeaders); - DPRINT1("Failed to read section headers\n"); - return FALSE; + RosSymFreeMem(SectionHeaders); + werrstr("Failed to read section headers\n"); + return FALSE; } - // Convert names to ANSI_STRINGs - for (SectionIndex = 0; SectionIndex < NtHeaders.FileHeader.NumberOfSections; - SectionIndex++) - { - ANSI_STRING astr; - if (SectionHeaders[SectionIndex].Name[0] != '/') { - DPRINT("Short name string %d, %s\n", SectionIndex, SectionHeaders[SectionIndex].Name); - astr.Buffer = RosSymAllocMem(IMAGE_SIZEOF_SHORT_NAME); - memcpy(astr.Buffer, SectionHeaders[SectionIndex].Name, IMAGE_SIZEOF_SHORT_NAME); - astr.MaximumLength = IMAGE_SIZEOF_SHORT_NAME; - astr.Length = GetStrnlen(astr.Buffer, IMAGE_SIZEOF_SHORT_NAME); - } else { - UNICODE_STRING intConv; - NTSTATUS Status; - ULONG StringOffset; + // Convert names to ANSI_STRINGs + for (SectionIndex = 0; SectionIndex < NtHeaders.FileHeader.NumberOfSections; + SectionIndex++) + { + ANSI_STRING astr; + if (SectionHeaders[SectionIndex].Name[0] != '/') { + DPRINT("Short name string %d, %s\n", SectionIndex, SectionHeaders[SectionIndex].Name); + astr.Buffer = RosSymAllocMem(IMAGE_SIZEOF_SHORT_NAME); + memcpy(astr.Buffer, SectionHeaders[SectionIndex].Name, IMAGE_SIZEOF_SHORT_NAME); + astr.MaximumLength = IMAGE_SIZEOF_SHORT_NAME; + astr.Length = GetStrnlen(astr.Buffer, IMAGE_SIZEOF_SHORT_NAME); + } else { + UNICODE_STRING intConv; + NTSTATUS Status; + ULONG StringOffset; - Status = RtlCreateUnicodeStringFromAsciiz(&intConv, (PCSZ)SectionHeaders[SectionIndex].Name + 1); - if (!NT_SUCCESS(Status)) goto freeall; - Status = RtlUnicodeStringToInteger(&intConv, 10, &StringOffset); - RtlFreeUnicodeString(&intConv); - if (!NT_SUCCESS(Status)) goto freeall; - if (!RosSymSeekFile(FileContext, SymbolTable + NumSymbols * SYMBOL_SIZE + StringOffset)) - goto freeall; - astr.Buffer = RosSymAllocMem(MAXIMUM_DWARF_NAME_SIZE); - if (!RosSymReadFile(FileContext, astr.Buffer, MAXIMUM_DWARF_NAME_SIZE)) - goto freeall; - astr.Length = GetStrnlen(astr.Buffer, MAXIMUM_DWARF_NAME_SIZE); - astr.MaximumLength = MAXIMUM_DWARF_NAME_SIZE; - DPRINT("Long name %d, %s\n", SectionIndex, astr.Buffer); - } - *ANSI_NAME_STRING(&SectionHeaders[SectionIndex]) = astr; - } + Status = RtlCreateUnicodeStringFromAsciiz(&intConv, (PCSZ)SectionHeaders[SectionIndex].Name + 1); + if (!NT_SUCCESS(Status)) goto freeall; + Status = RtlUnicodeStringToInteger(&intConv, 10, &StringOffset); + RtlFreeUnicodeString(&intConv); + if (!NT_SUCCESS(Status)) goto freeall; + if (!RosSymSeekFile(FileContext, SymbolTable + NumSymbols * SYMBOL_SIZE + StringOffset)) + goto freeall; + astr.Buffer = RosSymAllocMem(MAXIMUM_DWARF_NAME_SIZE); + if (!RosSymReadFile(FileContext, astr.Buffer, MAXIMUM_DWARF_NAME_SIZE)) + goto freeall; + astr.Length = GetStrnlen(astr.Buffer, MAXIMUM_DWARF_NAME_SIZE); + astr.MaximumLength = MAXIMUM_DWARF_NAME_SIZE; + DPRINT("Long name %d, %s\n", SectionIndex, astr.Buffer); + } + *ANSI_NAME_STRING(&SectionHeaders[SectionIndex]) = astr; + } - DPRINT("Done with sections\n"); - Pe *pe = RosSymAllocMem(sizeof(*pe)); - pe->fd = FileContext; - pe->e2 = peget2; - pe->e4 = peget4; - pe->e8 = peget8; - pe->nsections = NtHeaders.FileHeader.NumberOfSections; - pe->sect = SectionHeaders; - pe->nsymbols = NtHeaders.FileHeader.NumberOfSymbols; - pe->symtab = malloc(pe->nsymbols * sizeof(CoffSymbol)); - SYMENT SymbolData; - int i, j; - DPRINT("Getting symbol data\n"); - ASSERT(sizeof(SymbolData) == 18); - for (i = 0, j = 0; i < pe->nsymbols; i++) { - if (!RosSymSeekFile - (FileContext, - NtHeaders.FileHeader.PointerToSymbolTable + i * sizeof(SymbolData))) - goto freeall; - if (!RosSymReadFile(FileContext, &SymbolData, sizeof(SymbolData))) - goto freeall; - if ((SymbolData.e_scnum < 1) || - (SymbolData.e_sclass != C_EXT && - SymbolData.e_sclass != C_STAT)) - continue; - int section = SymbolData.e_scnum - 1; - if (SymbolData.e.e.e_zeroes) { - pe->symtab[j].name = malloc(sizeof(SymbolData.e.e_name)+1); - memcpy(pe->symtab[j].name, SymbolData.e.e_name, sizeof(SymbolData.e.e_name)); - pe->symtab[j].name[sizeof(SymbolData.e.e_name)] = 0; - } else { - if (!RosSymSeekFile - (FileContext, - NtHeaders.FileHeader.PointerToSymbolTable + - (NtHeaders.FileHeader.NumberOfSymbols * 18) + - SymbolData.e.e.e_offset)) - goto freeall; - pe->symtab[j].name = malloc(MAXIMUM_COFF_SYMBOL_LENGTH+1); - pe->symtab[j].name[MAXIMUM_COFF_SYMBOL_LENGTH] = 0; - // It's possible that we've got a string just at the end of the file - // we'll skip that symbol if needed - if (!RosSymReadFile(FileContext, pe->symtab[j].name, MAXIMUM_COFF_SYMBOL_LENGTH)) { - free(pe->symtab[j].name); - continue; - } - } - if (pe->symtab[j].name[0] == '.') { - free(pe->symtab[j].name); - continue; - } - pe->symtab[j].address = pe->sect[section].VirtualAddress + SymbolData.e_value; - j++; - } - DPRINT("%d symbols\n", j); - pe->nsymbols = j; - pe->imagebase = pe->loadbase = NtHeaders.OptionalHeader.ImageBase; - pe->imagesize = NtHeaders.OptionalHeader.SizeOfImage; - pe->loadsection = loaddisksection; - DPRINT("do dwarfopen\n"); - *RosSymInfo = dwarfopen(pe); - DPRINT("done %x\n", *RosSymInfo); + DPRINT("Done with sections\n"); + Pe *pe = RosSymAllocMem(sizeof(*pe)); + pe->fd = FileContext; + pe->e2 = peget2; + pe->e4 = peget4; + pe->e8 = peget8; + pe->nsections = NtHeaders.FileHeader.NumberOfSections; + pe->sect = SectionHeaders; + pe->imagebase = pe->loadbase = NtHeaders.OptionalHeader.ImageBase; + pe->imagesize = NtHeaders.OptionalHeader.SizeOfImage; + pe->codestart = NtHeaders.OptionalHeader.BaseOfCode; + pe->datastart = NtHeaders.OptionalHeader.BaseOfData; + pe->loadsection = loaddisksection; + *RosSymInfo = dwarfopen(pe); - return TRUE; + return TRUE; freeall: - for (SectionIndex = 0; SectionIndex < NtHeaders.FileHeader.NumberOfSections; - SectionIndex++) - RtlFreeAnsiString(ANSI_NAME_STRING(&SectionHeaders[SectionIndex])); - RosSymFreeMem(SectionHeaders); + for (SectionIndex = 0; SectionIndex < NtHeaders.FileHeader.NumberOfSections; + SectionIndex++) + RtlFreeAnsiString(ANSI_NAME_STRING(&SectionHeaders[SectionIndex])); + RosSymFreeMem(SectionHeaders); - return FALSE; + return FALSE; } /* EOF */ diff --git a/lib/rossym_new/init.c b/lib/rossym_new/init.c index 80be79a1ee0..d13fc09f0e4 100644 --- a/lib/rossym_new/init.c +++ b/lib/rossym_new/init.c @@ -7,9 +7,7 @@ * PROGRAMMERS: Ge van Geldorp (gvg@reactos.com) */ -#include -#include -#include "rossympriv.h" +#include ROSSYM_CALLBACKS RosSymCallbacks; diff --git a/lib/rossym_new/initum.c b/lib/rossym_new/initum.c index 5a80fd37eef..0bc24694205 100644 --- a/lib/rossym_new/initum.c +++ b/lib/rossym_new/initum.c @@ -7,15 +7,7 @@ * PROGRAMMERS: Ge van Geldorp (gvg@reactos.com) */ -#define WIN32_NO_STATUS -#include -#include -#include "rossympriv.h" -#define NTOS_MODE_USER -#include - -#define NDEBUG -#include +#include static PVOID RosSymAllocMemUM(ULONG_PTR Size) @@ -29,6 +21,12 @@ RosSymFreeMemUM(PVOID Area) RtlFreeHeap(RtlGetProcessHeap(), 0, Area); } +static BOOLEAN +RosSymGetMemUM(ULONG_PTR *Target, PVOID SourceMem, ULONG Size) +{ + return FALSE; +} + VOID RosSymInitUserMode(VOID) { @@ -37,7 +35,8 @@ RosSymInitUserMode(VOID) RosSymAllocMemUM, RosSymFreeMemUM, RosSymZwReadFile, - RosSymZwSeekFile + RosSymZwSeekFile, + RosSymGetMemUM }; RosSymInit(&KmCallbacks); diff --git a/lib/rossym_new/pe.c b/lib/rossym_new/pe.c index a00716cd185..62dcfb5f589 100644 --- a/lib/rossym_new/pe.c +++ b/lib/rossym_new/pe.c @@ -1,34 +1,25 @@ -#define NTOSAPI -#include -#include -#include -#include "rossympriv.h" -#include +#include #define NDEBUG #include -#include "dwarf.h" -#include "pe.h" -#include "rossympriv.h" - PeSect *pesection(Pe *pe, const char *name) { int i; ANSI_STRING WantName; RtlInitAnsiString(&WantName, name); - DPRINT("Searching for section %s\n", name); + werrstr("Searching for section %s\n", name); for (i = 0; i < pe->nsections; i++) { PANSI_STRING AnsiString = ANSI_NAME_STRING(&pe->sect[i]); if (WantName.Length == AnsiString->Length && !memcmp(AnsiString->Buffer, name, WantName.Length)) { - DPRINT("Found %s (%d) @ %x (%x)\n", name, i, + werrstr("Found %s (%d) @ %x (%x)\n", name, i, ((PCHAR)pe->imagebase)+pe->sect[i].VirtualAddress, pe->sect[i].SizeOfRawData); return &pe->sect[i]; } } - DPRINT("%s not found\n", name); + werrstr("%s not found\n", name); return nil; } @@ -84,11 +75,11 @@ loadmemsection(Pe *pe, char *name, DwarfBlock *b) if((s = pesection(pe, name)) == nil) return -1; - DPRINT("Loading section %s (ImageBase %x RVA %x)\n", name, pe->fd, s->VirtualAddress); + werrstr("Loading section %s (ImageBase %x RVA %x)\n", name, pe->fd, s->VirtualAddress); b->data = RosSymAllocMem(s->SizeOfRawData); b->len = s->SizeOfRawData; PCHAR DataSource = ((char *)pe->fd) + s->VirtualAddress; - DPRINT("Copying to %x from %x (%x)\n", DataSource, b->data, b->len); + werrstr("Copying to %x from %x (%x)\n", DataSource, b->data, b->len); RtlCopyMemory(b->data, DataSource, s->SizeOfRawData); return s->SizeOfRawData; @@ -111,10 +102,6 @@ void pefree(Pe *pe) { for (i = 0; i < pe->nsections; i++) { RtlFreeAnsiString(ANSI_NAME_STRING(&pe->sect[i])); } - for (i = 0; i < pe->nsymbols; i++) { - free(pe->symtab[i].name); - } - free(pe->symtab); free(pe->sect); free(pe); } @@ -125,16 +112,16 @@ void xfree(void *v) { ulong pefindrva(struct _IMAGE_SECTION_HEADER *SectionHeaders, int NumberOfSections, ulong TargetPhysical) { int i; - DPRINT("Finding RVA for Physical %x\n", TargetPhysical); + werrstr("Finding RVA for Physical %x\n", TargetPhysical); for (i = 0; i < NumberOfSections; i++) { - DPRINT("Section %d name %s Raw %x Virt %x\n", + werrstr("Section %d name %s Raw %x Virt %x\n", i, ANSI_NAME_STRING(&SectionHeaders[i])->Buffer, SectionHeaders[i].PointerToRawData, SectionHeaders[i].VirtualAddress); if (TargetPhysical >= SectionHeaders[i].PointerToRawData && TargetPhysical < SectionHeaders[i].PointerToRawData + SectionHeaders[i].SizeOfRawData) { - DPRINT("RVA %x\n", TargetPhysical - SectionHeaders[i].PointerToRawData + SectionHeaders[i].VirtualAddress); + werrstr("RVA %x\n", TargetPhysical - SectionHeaders[i].PointerToRawData + SectionHeaders[i].VirtualAddress); return TargetPhysical - SectionHeaders[i].PointerToRawData + SectionHeaders[i].VirtualAddress; } } diff --git a/lib/rossym_new/pe.h b/lib/rossym_new/pe.h index 5e659a216e9..066d79b2ac6 100644 --- a/lib/rossym_new/pe.h +++ b/lib/rossym_new/pe.h @@ -6,49 +6,20 @@ struct DwarfBlock; typedef struct _IMAGE_SECTION_HEADER PeSect; -typedef struct _CoffSymbol { - ulong address; - char *name; -} CoffSymbol; - typedef struct _Pe { void *fd; u16int (*e2)(const unsigned char *data); u32int (*e4)(const unsigned char *data); u64int (*e8)(const unsigned char *data); ulong imagebase, imagesize, loadbase; - ulong nsymbols; - CoffSymbol *symtab; + ulong codestart, datastart; int (*loadsection)(struct _Pe *pe, char *name, struct DwarfBlock *b); int nsections; struct _IMAGE_SECTION_HEADER *sect; } Pe; -#define E_SYMNMLEN 8 -#include -typedef struct { - union { - char e_name[E_SYMNMLEN]; - struct { - unsigned long e_zeroes; - unsigned long e_offset; - } e; - } e; - unsigned long e_value; - short e_scnum; - unsigned short e_type; - unsigned char e_sclass; - unsigned char e_numaux; -} SYMENT, *PSYMENT; -#include - -#define C_EXT 2 -#define C_STAT 3 -#define DT_FCN 0x40 - Pe *peopen(const char *name); int loaddisksection(struct _Pe *pe, char *name, struct DwarfBlock *b); -int loadmemsection(struct _Pe *pe, char *name, struct DwarfBlock *b); u16int peget2(const unsigned char *ptr); u32int peget4(const unsigned char *ptr); u64int peget8(const unsigned char *ptr); diff --git a/lib/rossym_new/precomp.h b/lib/rossym_new/precomp.h new file mode 100644 index 00000000000..13026f11122 --- /dev/null +++ b/lib/rossym_new/precomp.h @@ -0,0 +1,10 @@ +#define NTOSAPI +#include +#include +#include +#include +#include + +#include "rossympriv.h" +#include "pe.h" +#include "dwarf.h" diff --git a/lib/rossym_new/rossympriv.h b/lib/rossym_new/rossympriv.h index ffeb2ce6782..1a604ef3f47 100644 --- a/lib/rossym_new/rossympriv.h +++ b/lib/rossym_new/rossympriv.h @@ -9,19 +9,19 @@ #pragma once +#define HIGHBIT 0x80000000 + extern ROSSYM_CALLBACKS RosSymCallbacks; #define RosSymAllocMem(Size) (*RosSymCallbacks.AllocMemProc)(Size) #define RosSymFreeMem(Area) (*RosSymCallbacks.FreeMemProc)(Area) #define RosSymReadFile(FileContext, Buffer, Size) (*RosSymCallbacks.ReadFileProc)((FileContext), (Buffer), (Size)) #define RosSymSeekFile(FileContext, Position) (*RosSymCallbacks.SeekFileProc)((FileContext), (Position)) +#define RosSymGetMem(TargetAddress, Address, Size) (*RosSymCallbacks.MemGetProc)((TargetAddress), (Address), (Size)) extern BOOLEAN RosSymZwReadFile(PVOID FileContext, PVOID Buffer, ULONG Size); extern BOOLEAN RosSymZwSeekFile(PVOID FileContext, ULONG_PTR Position); -extern BOOLEAN RosSymIoReadFile(PVOID FileContext, PVOID Buffer, ULONG Size); -extern BOOLEAN RosSymIoSeekFile(PVOID FileContext, ULONG_PTR Position); - #define ROSSYM_IS_VALID_DOS_HEADER(DosHeader) (IMAGE_DOS_SIGNATURE == (DosHeader)->e_magic \ && 0L != (DosHeader)->e_lfanew) #define ROSSYM_IS_VALID_NT_HEADERS(NtHeaders) (IMAGE_NT_SIGNATURE == (NtHeaders)->Signature \ diff --git a/lib/rossym_new/zwfile.c b/lib/rossym_new/zwfile.c index a6ce196c632..99556e4e8cd 100644 --- a/lib/rossym_new/zwfile.c +++ b/lib/rossym_new/zwfile.c @@ -7,13 +7,7 @@ * PROGRAMMERS: Ge van Geldorp (gvg@reactos.com) */ -#define NTOSAPI -#include -#include -#include "rossympriv.h" - -#define NDEBUG -#include +#include NTSTATUS RosSymStatus; diff --git a/lib/rtl/CMakeLists.txt b/lib/rtl/CMakeLists.txt index 64194389eac..da0f979d2dd 100644 --- a/lib/rtl/CMakeLists.txt +++ b/lib/rtl/CMakeLists.txt @@ -97,6 +97,6 @@ elseif(ARCH MATCHES powerpc) powerpc/thread.c) endif() -add_library(rtl ${CMAKE_CURRENT_BINARY_DIR}/rtl_rtl.h.gch ${SOURCE}) -add_pch(rtl ${CMAKE_CURRENT_SOURCE_DIR}/rtl.h ${SOURCE}) +add_library(rtl ${SOURCE}) +add_pch(rtl rtl.h) add_dependencies(rtl psdk asm) diff --git a/lib/rtl/actctx.c b/lib/rtl/actctx.c index 2abea6e172c..e607960033f 100644 --- a/lib/rtl/actctx.c +++ b/lib/rtl/actctx.c @@ -2370,26 +2370,32 @@ RtlReleaseActivationContext( HANDLE handle ) } NTSTATUS -NTAPI RtlActivateActivationContext( ULONG unknown, HANDLE handle, PULONG_PTR cookie ) +NTAPI RtlActivateActivationContextEx( ULONG flags, PTEB tebAddress, HANDLE handle, PULONG_PTR cookie ) { RTL_ACTIVATION_CONTEXT_STACK_FRAME *frame; - + if (!(frame = RtlAllocateHeap( RtlGetProcessHeap(), 0, sizeof(*frame) ))) return STATUS_NO_MEMORY; - - frame->Previous = NtCurrentTeb()->ActivationContextStackPointer->ActiveFrame; + + frame->Previous = tebAddress->ActivationContextStackPointer->ActiveFrame; frame->ActivationContext = handle; frame->Flags = 0; - - NtCurrentTeb()->ActivationContextStackPointer->ActiveFrame = frame; + + tebAddress->ActivationContextStackPointer->ActiveFrame = frame; RtlAddRefActivationContext( handle ); - + *cookie = (ULONG_PTR)frame; DPRINT( "%p cookie=%lx\n", handle, *cookie ); return STATUS_SUCCESS; } +NTSTATUS +NTAPI RtlActivateActivationContext( ULONG flags, HANDLE handle, PULONG_PTR cookie ) +{ + return RtlActivateActivationContextEx(flags, NtCurrentTeb(), handle, cookie); +} + NTSTATUS NTAPI RtlDeactivateActivationContext( ULONG flags, ULONG_PTR cookie ) @@ -2736,6 +2742,10 @@ NTAPI RtlAllocateActivationContextStack(IN PVOID *Context) { PACTIVATION_CONTEXT_STACK ContextStack; + + /* FIXME: Check if it's already allocated */ + //if (*Context) return STATUS_SUCCESS; + ContextStack = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, sizeof (ACTIVATION_CONTEXT_STACK) ); if (!ContextStack) { @@ -2798,7 +2808,16 @@ RtlActivateActivationContextUnsafeFast(IN PRTL_CALLER_ALLOCATED_ACTIVATION_CONTE /* Return pointer to the activation frame */ return &Frame->Frame; #else - return NULL; + + RTL_ACTIVATION_CONTEXT_STACK_FRAME *frame = &Frame->Frame; + + frame->Previous = NtCurrentTeb()->ActivationContextStackPointer->ActiveFrame; + frame->ActivationContext = Context; + frame->Flags = 0; + + NtCurrentTeb()->ActivationContextStackPointer->ActiveFrame = frame; + + return STATUS_SUCCESS; #endif } @@ -2806,7 +2825,6 @@ PRTL_ACTIVATION_CONTEXT_STACK_FRAME FASTCALL RtlDeactivateActivationContextUnsafeFast(IN PRTL_CALLER_ALLOCATED_ACTIVATION_CONTEXT_STACK_FRAME_EXTENDED Frame) { -#if NEW_NTDLL_LOADER RTL_ACTIVATION_CONTEXT_STACK_FRAME *frame, *top; /* find the right frame */ @@ -2814,15 +2832,15 @@ RtlDeactivateActivationContextUnsafeFast(IN PRTL_CALLER_ALLOCATED_ACTIVATION_CON frame = &Frame->Frame; if (!frame) + { + DPRINT1("No top frame!\n"); RtlRaiseStatus( STATUS_SXS_INVALID_DEACTIVATION ); + } /* pop everything up to and including frame */ NtCurrentTeb()->ActivationContextStackPointer->ActiveFrame = frame->Previous; return frame; -#else - return NULL; -#endif } diff --git a/lib/rtl/bitmap.c b/lib/rtl/bitmap.c index 42c03abe2b0..6e88bd9188b 100644 --- a/lib/rtl/bitmap.c +++ b/lib/rtl/bitmap.c @@ -152,11 +152,11 @@ RtlFindMostSignificantBit(ULONGLONG Value) if (BitScanReverse(&Position, Value >> 32)) { - return Position + 32; + return (CCHAR)(Position + 32); } else if (BitScanReverse(&Position, (ULONG)Value)) { - return Position; + return (CCHAR)Position; } return -1; @@ -170,11 +170,11 @@ RtlFindLeastSignificantBit(ULONGLONG Value) if (BitScanForward(&Position, (ULONG)Value)) { - return Position; + return (CCHAR)Position; } else if (BitScanForward(&Position, Value >> 32)) { - return Position + 32; + return (CCHAR)(Position + 32); } return -1; @@ -187,9 +187,6 @@ RtlInitializeBitMap( IN PULONG BitMapBuffer, IN ULONG SizeOfBitMap) { - // FIXME: some bugger here! - //ASSERT(SizeOfBitMap > 0); - /* Setup the bitmap header */ BitMapHeader->SizeOfBitMap = SizeOfBitMap; BitMapHeader->Buffer = BitMapBuffer; @@ -212,7 +209,7 @@ RtlSetAllBits( IN OUT PRTL_BITMAP BitMapHeader) { ULONG LengthInUlongs; - + LengthInUlongs = (BitMapHeader->SizeOfBitMap + 31) >> 5; RtlFillMemoryUlong(BitMapHeader->Buffer, LengthInUlongs << 2, ~0); } @@ -481,7 +478,7 @@ RtlFindSetBits( IN ULONG NumberToFind, IN ULONG HintIndex) { - ULONG CurrentBit, CurrentLength; + ULONG CurrentBit, Margin, CurrentLength; /* Check for valid parameters */ if (!BitMapHeader || NumberToFind > BitMapHeader->SizeOfBitMap) @@ -495,12 +492,15 @@ RtlFindSetBits( return HintIndex; } + /* First margin is end of bitmap */ + Margin = BitMapHeader->SizeOfBitMap; + +retry: /* Start with hint index, length is 0 */ CurrentBit = HintIndex; - CurrentLength = 0; /* Loop until something is found or the end is reached */ - while (CurrentBit + NumberToFind <= BitMapHeader->SizeOfBitMap) + while (CurrentBit + NumberToFind <= Margin) { /* Search for the next set run, by skipping a clear run */ CurrentBit += RtlpGetLengthOfRunClear(BitMapHeader, @@ -522,6 +522,15 @@ RtlFindSetBits( CurrentBit += CurrentLength; } + /* Did we start at a hint? */ + if (HintIndex) + { + /* Retry at the start */ + Margin = min(HintIndex + NumberToFind, BitMapHeader->SizeOfBitMap); + HintIndex = 0; + goto retry; + } + /* Nothing found */ return MAXULONG; } @@ -641,7 +650,7 @@ RtlFindClearRuns( for (Run = 0; Run < SizeOfRunArray; Run++) { /* Look for a run */ - NumberOfBits = RtlFindNextForwardRunClear(BitMapHeader, + NumberOfBits = RtlFindNextForwardRunClear(BitMapHeader, FromIndex, &StartingIndex); @@ -672,7 +681,7 @@ RtlFindClearRuns( while (1) { /* Look for a run */ - NumberOfBits = RtlFindNextForwardRunClear(BitMapHeader, + NumberOfBits = RtlFindNextForwardRunClear(BitMapHeader, FromIndex, &StartingIndex); @@ -716,7 +725,7 @@ RtlFindLongestRunClear( while (1) { /* Look for a run */ - NumberOfBits = RtlFindNextForwardRunClear(BitMapHeader, + NumberOfBits = RtlFindNextForwardRunClear(BitMapHeader, FromIndex, &Index); @@ -749,7 +758,7 @@ RtlFindLongestRunSet( while (1) { /* Look for a run */ - NumberOfBits = RtlFindNextForwardRunSet(BitMapHeader, + NumberOfBits = RtlFindNextForwardRunSet(BitMapHeader, FromIndex, &Index); diff --git a/lib/rtl/error.c b/lib/rtl/error.c index 6ab69dbcf9a..5396f142396 100644 --- a/lib/rtl/error.c +++ b/lib/rtl/error.c @@ -56,8 +56,8 @@ ULONG WINAPI RtlNtStatusToDosErrorNoTeb( NTSTATUS status ) while (table->start) { - if (status < table->start) break; - if (status < table->end) + if ((ULONG)status < table->start) break; + if ((ULONG)status < table->end) { DWORD ret = table->table[status - table->start]; /* unknown entries are 0 */ diff --git a/lib/rtl/generictable.c b/lib/rtl/generictable.c index dee9cf18190..6cb57fd6d7a 100644 --- a/lib/rtl/generictable.c +++ b/lib/rtl/generictable.c @@ -213,7 +213,7 @@ RtlInsertElementGenericTableFull(IN PRTL_GENERIC_TABLE Table, Table->TableRoot = RtlSplay(NewNode); /* Return status */ - if (NewElement) *NewElement = (SearchResult == TableFoundNode); + if (NewElement) *NewElement = (SearchResult != TableFoundNode); /* Return pointer to user data */ return &((PTABLE_ENTRY_HEADER)NewNode)->UserData; @@ -300,7 +300,7 @@ RtlDeleteElementGenericTable(IN PRTL_GENERIC_TABLE Table, /* Get the splay links and table search result immediately */ Result = RtlpFindGenericTableNodeOrParent(Table, Buffer, &NodeOrParent); - if ((Result == TableEmptyTree) || (Result != TableFoundNode)) + if (Result != TableFoundNode) { /* Nothing to delete */ return FALSE; diff --git a/lib/rtl/heap.c b/lib/rtl/heap.c index b0bb0dfa8be..96b9939eb5b 100644 --- a/lib/rtl/heap.c +++ b/lib/rtl/heap.c @@ -121,7 +121,7 @@ RtlpInitializeHeap(PHEAP Heap, ASSERT(*HeaderSize <= PAGE_SIZE); /* Initialize heap's header */ - Heap->Entry.Size = (*HeaderSize) >> HEAP_ENTRY_SHIFT; + Heap->Entry.Size = (USHORT)((*HeaderSize) >> HEAP_ENTRY_SHIFT); Heap->Entry.Flags = HEAP_ENTRY_BUSY; Heap->Signature = HEAP_SIGNATURE; @@ -306,7 +306,7 @@ RtlpInsertFreeBlock(PHEAP Heap, } else { - Size = BlockSize; + Size = (USHORT)BlockSize; FreeEntry->Flags = Flags; } @@ -640,18 +640,18 @@ RtlpFindAndCommitPages(PHEAP Heap, DPRINT("Updating UcrDescriptor %p, new Address %p, size %d\n", UcrDescriptor, UcrDescriptor->Address, UcrDescriptor->Size); - + /* Set various first entry fields*/ FirstEntry->SegmentOffset = LastEntry->SegmentOffset; - FirstEntry->Size = *Size >> HEAP_ENTRY_SHIFT; + FirstEntry->Size = (USHORT)(*Size >> HEAP_ENTRY_SHIFT); FirstEntry->PreviousSize = LastEntry->Size; /* Check if anything left in this UCR */ if (UcrDescriptor->Size == 0) { /* It's fully exhausted */ - - /* Check if this is the end of the segment */ + + /* Check if this is the end of the segment */ if(UcrDescriptor->Address == Segment->LastValidEntry) { FirstEntry->Flags = HEAP_ENTRY_LAST_ENTRY; @@ -674,7 +674,7 @@ RtlpFindAndCommitPages(PHEAP Heap, { FirstEntry->Flags = HEAP_ENTRY_LAST_ENTRY; } - + /* We're done */ return (PHEAP_FREE_ENTRY)FirstEntry; } @@ -792,7 +792,7 @@ RtlpDeCommitFreeBlock(PHEAP Heap, { /* Adjust size of this free entry and insert it */ FreeEntry->Flags = HEAP_ENTRY_LAST_ENTRY; - FreeEntry->Size = PrecedingSize; + FreeEntry->Size = (USHORT)PrecedingSize; Heap->TotalFreeSize += PrecedingSize; /* Insert it into the free list */ @@ -811,9 +811,9 @@ RtlpDeCommitFreeBlock(PHEAP Heap, NextFreeEntry->Flags = 0; NextFreeEntry->PreviousSize = 0; NextFreeEntry->SegmentOffset = Segment->Entry.SegmentOffset; - NextFreeEntry->Size = NextSize; + NextFreeEntry->Size = (USHORT)NextSize; - ((PHEAP_FREE_ENTRY)((PHEAP_ENTRY)NextFreeEntry + NextSize))->PreviousSize = NextSize; + ((PHEAP_FREE_ENTRY)((PHEAP_ENTRY)NextFreeEntry + NextSize))->PreviousSize = (USHORT)NextSize; Heap->TotalFreeSize += NextSize; RtlpInsertFreeBlockHelper(Heap, NextFreeEntry, NextSize, FALSE); @@ -961,7 +961,7 @@ RtlpAddHeapToProcessList(PHEAP Heap) /* Add the heap to the process heaps */ Peb->ProcessHeaps[Peb->NumberOfHeaps] = Heap; Peb->NumberOfHeaps++; - Heap->ProcessHeapsListIndex = Peb->NumberOfHeaps; + Heap->ProcessHeapsListIndex = (USHORT)Peb->NumberOfHeaps; // } _SEH2_FINALLY { /* Release the lock */ @@ -1075,12 +1075,12 @@ RtlpCoalesceFreeBlocks (PHEAP Heap, FreeEntry = CurrentEntry; *FreeSize = *FreeSize + CurrentEntry->Size; Heap->TotalFreeSize -= CurrentEntry->Size; - FreeEntry->Size = *FreeSize; + FreeEntry->Size = (USHORT)(*FreeSize); /* Also update previous size if needed */ if (!(FreeEntry->Flags & HEAP_ENTRY_LAST_ENTRY)) { - ((PHEAP_ENTRY)FreeEntry + *FreeSize)->PreviousSize = *FreeSize; + ((PHEAP_ENTRY)FreeEntry + *FreeSize)->PreviousSize = (USHORT)(*FreeSize); } } @@ -1110,12 +1110,12 @@ RtlpCoalesceFreeBlocks (PHEAP Heap, /* Update sizes */ *FreeSize = *FreeSize + NextEntry->Size; Heap->TotalFreeSize -= NextEntry->Size; - FreeEntry->Size = *FreeSize; + FreeEntry->Size = (USHORT)(*FreeSize); /* Also update previous size if needed */ if (!(FreeEntry->Flags & HEAP_ENTRY_LAST_ENTRY)) { - ((PHEAP_ENTRY)FreeEntry + *FreeSize)->PreviousSize = *FreeSize; + ((PHEAP_ENTRY)FreeEntry + *FreeSize)->PreviousSize = (USHORT)(*FreeSize); } } } @@ -1749,7 +1749,7 @@ RtlpSplitEntry(PHEAP Heap, SIZE_T Index, SIZE_T Size) { - PHEAP_FREE_ENTRY SplitBlock; + PHEAP_FREE_ENTRY SplitBlock, SplitBlock2; UCHAR FreeFlags; PHEAP_ENTRY InUseEntry; SIZE_T FreeSize; @@ -1767,8 +1767,8 @@ RtlpSplitEntry(PHEAP Heap, FreeSize = InUseEntry->Size - Index; /* Update it's size fields (we don't need their data anymore) */ - InUseEntry->Size = Index; - InUseEntry->UnusedBytes = AllocationSize - Size; + InUseEntry->Size = (USHORT)Index; + InUseEntry->UnusedBytes = (UCHAR)(AllocationSize - Size); /* If there is something to split - do the split */ if (FreeSize != 0) @@ -1789,14 +1789,65 @@ RtlpSplitEntry(PHEAP Heap, /* Initialize it */ SplitBlock->Flags = FreeFlags; SplitBlock->SegmentOffset = InUseEntry->SegmentOffset; - SplitBlock->Size = FreeSize; - SplitBlock->PreviousSize = Index; - - /* Coalesce it with the next entry */ - SplitBlock = RtlpCoalesceFreeBlocks(Heap, SplitBlock, &FreeSize, FALSE); - RtlpInsertFreeBlock(Heap, SplitBlock, FreeSize); - - /* Reset the flag */ + SplitBlock->Size = (USHORT)FreeSize; + SplitBlock->PreviousSize = (USHORT)Index; + + /* Check if it's the last entry */ + if (FreeFlags & HEAP_ENTRY_LAST_ENTRY) + { + /* Insert it to the free list if it's the last entry */ + RtlpInsertFreeBlockHelper(Heap, SplitBlock, FreeSize, FALSE); + Heap->TotalFreeSize += FreeSize; + } + else + { + /* Not so easy - need to update next's previous size too */ + SplitBlock2 = (PHEAP_FREE_ENTRY)((PHEAP_ENTRY)SplitBlock + FreeSize); + + if (SplitBlock2->Flags & HEAP_ENTRY_BUSY) + { + SplitBlock2->PreviousSize = (USHORT)FreeSize; + RtlpInsertFreeBlockHelper(Heap, SplitBlock, FreeSize, FALSE); + Heap->TotalFreeSize += FreeSize; + } + else + { + /* Even more complex - the next entry is free, so we can merge them into one! */ + SplitBlock->Flags = SplitBlock2->Flags; + + /* Remove that next entry */ + RtlpRemoveFreeBlock(Heap, SplitBlock2, FALSE, FALSE); + + /* Update sizes */ + FreeSize += SplitBlock2->Size; + Heap->TotalFreeSize -= SplitBlock2->Size; + + if (FreeSize <= HEAP_MAX_BLOCK_SIZE) + { + /* Insert it back */ + SplitBlock->Size = (USHORT)FreeSize; + + /* Don't forget to update previous size of the next entry! */ + if (!(SplitBlock->Flags & HEAP_ENTRY_LAST_ENTRY)) + { + ((PHEAP_FREE_ENTRY)((PHEAP_ENTRY)SplitBlock + FreeSize))->PreviousSize = (USHORT)FreeSize; + } + + /* Actually insert it */ + RtlpInsertFreeBlockHelper(Heap, SplitBlock, (USHORT)FreeSize, FALSE); + + /* Update total size */ + Heap->TotalFreeSize += FreeSize; + } + else + { + /* Resulting block is quite big */ + RtlpInsertFreeBlock(Heap, SplitBlock, FreeSize); + } + } + } + + /* Reset flags of the free entry */ FreeFlags = 0; } } @@ -2043,7 +2094,7 @@ RtlAllocateHeap(IN PVOID HeapPtr, /* Initialize this block */ InUseEntry = (PHEAP_ENTRY)FreeBlock; InUseEntry->Flags = HEAP_ENTRY_BUSY | (FreeFlags & HEAP_ENTRY_LAST_ENTRY); - InUseEntry->UnusedBytes = AllocationSize - Size; + InUseEntry->UnusedBytes = (UCHAR)(AllocationSize - Size); InUseEntry->SmallTagIndex = 0; } else @@ -2146,7 +2197,7 @@ RtlAllocateHeap(IN PVOID HeapPtr, } /* Initialize the newly allocated block */ - VirtualBlock->BusyBlock.Size = (AllocationSize - Size); + VirtualBlock->BusyBlock.Size = (USHORT)(AllocationSize - Size); VirtualBlock->BusyBlock.Flags = HEAP_ENTRY_VIRTUAL_ALLOC | HEAP_ENTRY_EXTRA_PRESENT | HEAP_ENTRY_BUSY; VirtualBlock->CommitSize = AllocationSize; VirtualBlock->ReserveSize = AllocationSize; @@ -2422,8 +2473,8 @@ RtlpGrowBlockInPlace (IN PHEAP Heap, } /* Update sizes */ - InUseEntry->Size = Index; - InUseEntry->UnusedBytes = ((Index << HEAP_ENTRY_SHIFT) - Size); + InUseEntry->Size = (USHORT)Index; + InUseEntry->UnusedBytes = (UCHAR)((Index << HEAP_ENTRY_SHIFT) - Size); /* Check if there is a free space remaining after merging those blocks */ if (!FreeSize) @@ -2441,7 +2492,7 @@ RtlpGrowBlockInPlace (IN PHEAP Heap, /* Complex case, we need to split the block to give unused free space back to the heap */ UnusedEntry = (PHEAP_FREE_ENTRY)(InUseEntry + Index); - UnusedEntry->PreviousSize = Index; + UnusedEntry->PreviousSize = (USHORT)Index; UnusedEntry->SegmentOffset = InUseEntry->SegmentOffset; /* Update the following block or set the last entry in the segment */ @@ -2449,7 +2500,7 @@ RtlpGrowBlockInPlace (IN PHEAP Heap, { /* Set flags and size */ UnusedEntry->Flags = RememberFlags; - UnusedEntry->Size = FreeSize; + UnusedEntry->Size = (USHORT)FreeSize; /* Insert it to the heap and update total size */ RtlpInsertFreeBlockHelper(Heap, UnusedEntry, FreeSize, FALSE); @@ -2464,10 +2515,10 @@ RtlpGrowBlockInPlace (IN PHEAP Heap, { /* Update flags and set size of the unused space entry */ UnusedEntry->Flags = RememberFlags & (~HEAP_ENTRY_LAST_ENTRY); - UnusedEntry->Size = FreeSize; + UnusedEntry->Size = (USHORT)FreeSize; /* Update previous size of the following entry */ - FollowingEntry->PreviousSize = FreeSize; + FollowingEntry->PreviousSize = (USHORT)FreeSize; /* Insert it to the heap and update total free size */ RtlpInsertFreeBlockHelper(Heap, UnusedEntry, FreeSize, FALSE); @@ -2490,10 +2541,10 @@ RtlpGrowBlockInPlace (IN PHEAP Heap, if (FreeSize <= HEAP_MAX_BLOCK_SIZE) { /* Fine for a dedicated list */ - UnusedEntry->Size = FreeSize; + UnusedEntry->Size = (USHORT)FreeSize; if (!(RememberFlags & HEAP_ENTRY_LAST_ENTRY)) - ((PHEAP_ENTRY)UnusedEntry + FreeSize)->PreviousSize = FreeSize; + ((PHEAP_ENTRY)UnusedEntry + FreeSize)->PreviousSize = (USHORT)FreeSize; /* Insert it back and update total size */ RtlpInsertFreeBlockHelper(Heap, UnusedEntry, FreeSize, FALSE); @@ -2645,7 +2696,7 @@ RtlReAllocateHeap(HANDLE HeapPtr, { RtlEnterHeapLock(Heap->LockVariable); HeapLocked = TRUE; - Flags ^= HEAP_NO_SERIALIZE; + Flags &= ~HEAP_NO_SERIALIZE; } /* Get the pointer to the in-use entry */ @@ -2699,7 +2750,7 @@ RtlReAllocateHeap(HANDLE HeapPtr, if (InUseEntry->Flags & HEAP_ENTRY_VIRTUAL_ALLOC) { /* Simple in case of a virtual alloc - just an unused size */ - InUseEntry->Size = AllocationSize - Size; + InUseEntry->Size = (USHORT)(AllocationSize - Size); } else if (InUseEntry->Flags & HEAP_ENTRY_EXTRA_PRESENT) { @@ -2711,12 +2762,12 @@ RtlReAllocateHeap(HANDLE HeapPtr, // FIXME Tagging, TagIndex /* Update unused bytes count */ - InUseEntry->UnusedBytes = AllocationSize - Size; + InUseEntry->UnusedBytes = (UCHAR)(AllocationSize - Size); } else { // FIXME Tagging, SmallTagIndex - InUseEntry->UnusedBytes = AllocationSize - Size; + InUseEntry->UnusedBytes = (UCHAR)(AllocationSize - Size); } /* If new size is bigger than the old size */ @@ -2798,14 +2849,14 @@ RtlReAllocateHeap(HANDLE HeapPtr, /* Initialize this entry */ SplitBlock->Flags = FreeFlags; - SplitBlock->PreviousSize = Index; + SplitBlock->PreviousSize = (USHORT)Index; SplitBlock->SegmentOffset = InUseEntry->SegmentOffset; /* Remember free size */ FreeSize = InUseEntry->Size - Index; /* Set new size */ - InUseEntry->Size = Index; + InUseEntry->Size = (USHORT)Index; InUseEntry->Flags &= ~HEAP_ENTRY_LAST_ENTRY; /* Is that the last entry */ @@ -2851,12 +2902,12 @@ RtlReAllocateHeap(HANDLE HeapPtr, if (FreeSize <= HEAP_MAX_BLOCK_SIZE) { - SplitBlock->Size = FreeSize; + SplitBlock->Size = (USHORT)FreeSize; if (!(SplitBlock->Flags & HEAP_ENTRY_LAST_ENTRY)) { /* Update previous size of the next entry */ - ((PHEAP_FREE_ENTRY)((PHEAP_ENTRY)SplitBlock + FreeSize))->PreviousSize = FreeSize; + ((PHEAP_FREE_ENTRY)((PHEAP_ENTRY)SplitBlock + FreeSize))->PreviousSize = (USHORT)FreeSize; } /* Insert the new one back and update total size */ @@ -3193,7 +3244,7 @@ RtlpValidateHeapEntry( HeapEntry >= Segment->LastValidEntry)) goto invalid_entry; - if ((HeapEntry->Flags & HEAP_ENTRY_FILL_PATTERN) && + if ((HeapEntry->Flags & HEAP_ENTRY_FILL_PATTERN) && !RtlpCheckInUsePattern(HeapEntry)) goto invalid_entry; diff --git a/lib/rtl/image.c b/lib/rtl/image.c index ce54a6b4df9..2064dc29db3 100644 --- a/lib/rtl/image.c +++ b/lib/rtl/image.c @@ -120,36 +120,139 @@ LdrVerifyMappedImageMatchesChecksum( return (BOOLEAN)(CalcSum == HeaderSum); #else + /* + * FIXME: Warning, this violates the PE standard and makes ReactOS drivers + * and other system code when normally on Windows they would not, since + * we do not write the checksum in them. + * Our compilers should be made to write out the checksum and this function + * should be enabled as to reject badly checksummed code. + */ return TRUE; #endif } +/* + * @implemented + */ +NTSTATUS +NTAPI +RtlImageNtHeaderEx(IN ULONG Flags, + IN PVOID Base, + IN ULONG64 Size, + OUT PIMAGE_NT_HEADERS *OutHeaders) +{ + PIMAGE_NT_HEADERS NtHeaders; + PIMAGE_DOS_HEADER DosHeader; + BOOLEAN WantsRangeCheck; + + /* You must want NT Headers, no? */ + if (!OutHeaders) return STATUS_INVALID_PARAMETER; + + /* Assume failure */ + *OutHeaders = NULL; + + /* Validate Flags */ + if (Flags &~ RTL_IMAGE_NT_HEADER_EX_FLAG_NO_RANGE_CHECK) + { + DPRINT1("Invalid flag combination... check for new API flags?\n"); + return STATUS_INVALID_PARAMETER; + } + + /* Validate base */ + if (!(Base) || (Base == (PVOID)-1)) return STATUS_INVALID_PARAMETER; + + /* Check if the caller wants validation */ + WantsRangeCheck = !(Flags & RTL_IMAGE_NT_HEADER_EX_FLAG_NO_RANGE_CHECK); + if (WantsRangeCheck) + { + /* Make sure the image size is at least big enough for the DOS header */ + if (Size < sizeof(IMAGE_DOS_HEADER)) + { + DPRINT1("Size too small\n"); + return STATUS_INVALID_IMAGE_FORMAT; + } + } + + /* Check if the DOS Signature matches */ + DosHeader = Base; + if (DosHeader->e_magic != IMAGE_DOS_SIGNATURE) + { + /* Not a valid COFF */ + DPRINT1("Not an MZ file\n"); + return STATUS_INVALID_IMAGE_FORMAT; + } + + /* Check if the caller wants validation */ + if (WantsRangeCheck) + { + /* The offset should fit in the passsed-in size */ + if (DosHeader->e_lfanew >= Size) + { + /* Fail */ + DPRINT1("e_lfanew is larger than PE file\n"); + return STATUS_INVALID_IMAGE_FORMAT; + } + + /* It shouldn't be past 4GB either */ + if (DosHeader->e_lfanew >= + (MAXULONG - sizeof(IMAGE_DOS_SIGNATURE) - sizeof(IMAGE_FILE_HEADER))) + { + /* Fail */ + DPRINT1("e_lfanew is larger than 4GB\n"); + return STATUS_INVALID_IMAGE_FORMAT; + } + + /* And the whole file shouldn't overflow past 4GB */ + if ((DosHeader->e_lfanew + + sizeof(IMAGE_DOS_SIGNATURE) - sizeof(IMAGE_FILE_HEADER)) >= Size) + { + /* Fail */ + DPRINT1("PE is larger than 4GB\n"); + return STATUS_INVALID_IMAGE_FORMAT; + } + } + + /* The offset also can't be larger than 256MB, as a hard-coded check */ + if (DosHeader->e_lfanew >= (256 * 1024 * 1024)) + { + /* Fail */ + DPRINT1("PE offset is larger than 256MB\n"); + return STATUS_INVALID_IMAGE_FORMAT; + } + + /* Now it's safe to get the NT Headers */ + NtHeaders = (PIMAGE_NT_HEADERS)((ULONG_PTR)Base + DosHeader->e_lfanew); + + /* Verify the PE Signature */ + if (NtHeaders->Signature != IMAGE_NT_SIGNATURE) + { + /* Fail */ + DPRINT1("PE signature missing\n"); + return STATUS_INVALID_IMAGE_FORMAT; + } + + /* Now return success and the NT header */ + *OutHeaders = NtHeaders; + return STATUS_SUCCESS; +} + /* * @implemented */ PIMAGE_NT_HEADERS NTAPI -RtlImageNtHeader(IN PVOID BaseAddress) +RtlImageNtHeader(IN PVOID Base) { PIMAGE_NT_HEADERS NtHeader; - PIMAGE_DOS_HEADER DosHeader = (PIMAGE_DOS_HEADER)BaseAddress; - if (DosHeader && SWAPW(DosHeader->e_magic) != IMAGE_DOS_SIGNATURE) - { - DPRINT1("DosHeader->e_magic %x\n", SWAPW(DosHeader->e_magic)); - DPRINT1("NtHeader 0x%lx\n", ((ULONG_PTR)BaseAddress + SWAPD(DosHeader->e_lfanew))); - } - else - { - NtHeader = (PIMAGE_NT_HEADERS)((ULONG_PTR)BaseAddress + SWAPD(DosHeader->e_lfanew)); - if (SWAPD(NtHeader->Signature) == IMAGE_NT_SIGNATURE) - return NtHeader; - } - - return NULL; + /* Call the new API */ + RtlImageNtHeaderEx(RTL_IMAGE_NT_HEADER_EX_FLAG_NO_RANGE_CHECK, + Base, + 0, + &NtHeader); + return NtHeader; } - /* * @implemented */ diff --git a/lib/rtl/path.c b/lib/rtl/path.c index d0b4e21a7a1..6b19214e6d7 100644 --- a/lib/rtl/path.c +++ b/lib/rtl/path.c @@ -25,176 +25,913 @@ /* GLOBALS ********************************************************************/ static const WCHAR DeviceRootW[] = L"\\\\.\\"; +const UNICODE_STRING DeviceRootString = RTL_CONSTANT_STRING(L"\\\\.\\"); -static const UNICODE_STRING _condev = RTL_CONSTANT_STRING(L"\\\\.\\CON"); +const UNICODE_STRING RtlpDosDevicesUncPrefix = RTL_CONSTANT_STRING(L"\\??\\UNC\\"); +const UNICODE_STRING RtlpWin32NtRootSlash = RTL_CONSTANT_STRING(L"\\\\?\\"); +const UNICODE_STRING RtlpDosSlashCONDevice = RTL_CONSTANT_STRING(L"\\\\.\\CON"); +const UNICODE_STRING RtlpDosDevicesPrefix = RTL_CONSTANT_STRING(L"\\??\\"); -static const UNICODE_STRING _lpt = RTL_CONSTANT_STRING(L"LPT"); +const UNICODE_STRING RtlpDosLPTDevice = RTL_CONSTANT_STRING(L"LPT"); +const UNICODE_STRING RtlpDosCOMDevice = RTL_CONSTANT_STRING(L"COM"); +const UNICODE_STRING RtlpDosPRNDevice = RTL_CONSTANT_STRING(L"PRN"); +const UNICODE_STRING RtlpDosAUXDevice = RTL_CONSTANT_STRING(L"AUX"); +const UNICODE_STRING RtlpDosCONDevice = RTL_CONSTANT_STRING(L"CON"); +const UNICODE_STRING RtlpDosNULDevice = RTL_CONSTANT_STRING(L"NUL"); -static const UNICODE_STRING _com = RTL_CONSTANT_STRING(L"COM"); +/* PRIVATE FUNCTIONS **********************************************************/ -static const UNICODE_STRING _prn = RTL_CONSTANT_STRING(L"PRN"); - -static const UNICODE_STRING _aux = RTL_CONSTANT_STRING(L"AUX"); - -static const UNICODE_STRING _con = RTL_CONSTANT_STRING(L"CON"); - -static const UNICODE_STRING _nul = RTL_CONSTANT_STRING(L"NUL"); - -/* FUNCTIONS *****************************************************************/ - - -/* - * @implemented - */ -ULONG NTAPI RtlGetLongestNtPathLength (VOID) +ULONG +NTAPI +RtlIsDosDeviceName_Ustr(IN PUNICODE_STRING PathString) { - return (MAX_PATH + 9); -} + UNICODE_STRING PathCopy; + PWCHAR Start, End; + ULONG PathChars, ColonCount = 0; + USHORT ReturnOffset = 0, ReturnLength; + WCHAR c; + /* Validate the input */ + if (!PathString) return 0; -/* - * @implemented - * - */ -ULONG NTAPI -RtlDetermineDosPathNameType_U(PCWSTR Path) -{ - DPRINT("RtlDetermineDosPathNameType_U %S\n", Path); - - if (Path == NULL) - { - return RtlPathTypeUnknown; - } - - if (IS_PATH_SEPARATOR(Path[0])) - { - if (!IS_PATH_SEPARATOR(Path[1])) return RtlPathTypeRooted; /* \xxx */ - if (Path[2] != L'.') return RtlPathTypeUncAbsolute; /* \\xxx */ - if (IS_PATH_SEPARATOR(Path[3])) return RtlPathTypeLocalDevice; /* \\.\xxx */ - if (Path[3]) return RtlPathTypeUncAbsolute; /* \\.xxxx */ - - return RtlPathTypeRootLocalDevice; /* \\. */ - } - else - { - if (!Path[0] || Path[1] != L':') return RtlPathTypeRelative; /* xxx */ - if (IS_PATH_SEPARATOR(Path[2])) return RtlPathTypeDriveAbsolute; /* x:\xxx */ - - return RtlPathTypeDriveRelative; /* x:xxx */ - } -} - - -/* returns 0 if name is not valid DOS device name, or DWORD with - * offset in bytes to DOS device name from beginning of buffer in high word - * and size in bytes of DOS device name in low word */ - -/* - * @implemented - */ -ULONG NTAPI -RtlIsDosDeviceName_U(PWSTR dos_name) -{ - static const WCHAR consoleW[] = {'\\','\\','.','\\','C','O','N',0}; - static const WCHAR auxW[3] = {'A','U','X'}; - static const WCHAR comW[3] = {'C','O','M'}; - static const WCHAR conW[3] = {'C','O','N'}; - static const WCHAR lptW[3] = {'L','P','T'}; - static const WCHAR nulW[3] = {'N','U','L'}; - static const WCHAR prnW[3] = {'P','R','N'}; - - const WCHAR *start, *end, *p; - - switch(RtlDetermineDosPathNameType_U( dos_name )) + /* Check what type of path this is */ + switch (RtlDetermineDosPathNameType_Ustr(PathString)) { - case RtlPathTypeUnknown: - case RtlPathTypeUncAbsolute: - return 0; - case RtlPathTypeLocalDevice: - if (!_wcsicmp( dos_name, consoleW )) - return MAKELONG( sizeof(conW), 4 * sizeof(WCHAR) ); /* 4 is length of \\.\ prefix */ - return 0; - case RtlPathTypeDriveAbsolute: - case RtlPathTypeDriveRelative: - start = dos_name + 2; /* skip drive letter */ - break; - default: - start = dos_name; - break; + /* Fail for UNC or unknown paths */ + case RtlPathTypeUnknown: + case RtlPathTypeUncAbsolute: + return 0; + + /* Make special check for the CON device */ + case RtlPathTypeLocalDevice: + if (RtlEqualUnicodeString(PathString, &RtlpDosSlashCONDevice, TRUE)) + { + /* This should return 0x80006 */ + return MAKELONG(RtlpDosCONDevice.Length, DeviceRootString.Length); + } + return 0; + + default: + break; } - /* find start of file name */ - for (p = start; *p; p++) if (IS_PATH_SEPARATOR(*p)) start = p + 1; + /* Make a copy of the string */ + PathCopy = *PathString; - /* truncate at extension and ':' */ - for (end = start; *end; end++) if (*end == '.' || *end == ':') break; - end--; + /* Return if there's no characters */ + PathChars = PathCopy.Length / sizeof(WCHAR); + if (!PathChars) return 0; - /* remove trailing spaces */ - while (end >= start && *end == ' ') end--; - - /* now we have a potential device name between start and end, check it */ - switch(end - start + 1) + /* Check for drive path and truncate */ + if (PathCopy.Buffer[PathChars - 1] == L':') { - case 3: - if (_wcsnicmp( start, auxW, 3 ) && - _wcsnicmp( start, conW, 3 ) && - _wcsnicmp( start, nulW, 3 ) && - _wcsnicmp( start, prnW, 3 )) break; - return MAKELONG( 3 * sizeof(WCHAR), (start - dos_name) * sizeof(WCHAR) ); - case 4: - if (_wcsnicmp( start, comW, 3 ) && _wcsnicmp( start, lptW, 3 )) break; - if (*end <= '0' || *end > '9') break; - return MAKELONG( 4 * sizeof(WCHAR), (start - dos_name) * sizeof(WCHAR) ); - default: /* can't match anything */ - break; + /* Fixup the lengths */ + PathCopy.Length -= sizeof(WCHAR); + if (!--PathChars) return 0; + + /* Remember this for later */ + ColonCount = 1; } + + /* Check for extension or space, and truncate */ + c = PathCopy.Buffer[PathChars - 1]; + do + { + /* Stop if we hit a space or period */ + if ((c != '.') && (c != ' ')) break; + + /* Fixup the lengths and get the next character */ + PathCopy.Length -= sizeof(WCHAR); + if (!--PathChars) c = PathCopy.Buffer[PathChars - 1]; + + /* Remember this for later */ + ColonCount++; + } while (PathChars); + + /* Anything still left? */ + if (PathChars) + { + /* Loop from the end */ + for (End = &PathCopy.Buffer[PathChars - 1]; + End >= PathCopy.Buffer; + --End) + { + /* Check if the character is a path or drive separator */ + c = *End; + if ((c == '\\') || (c == '/') || ((c == ':') && (End == PathCopy.Buffer + 1))) + { + /* Get the next lower case character */ + End++; + c = *End | ' '; // ' ' == ('z' - 'Z') + + /* Check if it's a DOS device (LPT, COM, PRN, AUX, or NUL) */ + if ((End < &PathCopy.Buffer[PathCopy.Length / sizeof(WCHAR)]) && + ((c == 'l') || (c == 'c') || (c == 'p') || (c == 'a') || (c == 'n'))) + { + /* Calculate the offset */ + ReturnOffset = (PCHAR)End - (PCHAR)PathCopy.Buffer; + + /* Build the final string */ + PathCopy.Length -= ReturnOffset; + PathCopy.Length -= (ColonCount * sizeof(WCHAR)); + PathCopy.Buffer = End; + break; + } + } + + return 0; + } + + /* Get the next lower case character and check if it's a DOS device */ + c = *PathCopy.Buffer | ' '; // ' ' == ('z' - 'Z') + if ((c != 'l') && (c != 'c') && (c != 'p') && (c != 'a') && (c != 'n')) + { + /* Not LPT, COM, PRN, AUX, or NUL */ + return 0; + } + } + + /* Now skip past any extra extension or drive letter characters */ + Start = PathCopy.Buffer; + End = &Start[PathChars]; + while (Start < End) + { + c = *Start; + if ((c == '.') || (c == ':')) break; + Start++; + } + + /* And then go backwards to get rid of spaces */ + while ((Start > PathCopy.Buffer) && (Start[-1] == ' ')) --Start; + + /* Finally see how many characters are left, and that's our size */ + PathChars = Start - PathCopy.Buffer; + PathCopy.Length = PathChars * sizeof(WCHAR); + + /* Check if this is a COM or LPT port, which has a digit after it */ + if ((PathChars == 4) && + (iswdigit(PathCopy.Buffer[3]) && (PathCopy.Buffer[3] != '0'))) + { + /* Don't compare the number part, just check for LPT or COM */ + PathCopy.Length -= sizeof(WCHAR); + if ((RtlEqualUnicodeString(&PathCopy, &RtlpDosLPTDevice, TRUE)) || + (RtlEqualUnicodeString(&PathCopy, &RtlpDosCOMDevice, TRUE))) + { + /* Found it */ + ReturnLength = sizeof(L"COM1"); + return MAKELONG(ReturnOffset, ReturnLength); + } + } + else if ((PathChars == 3) && + ((RtlEqualUnicodeString(&PathCopy, &RtlpDosPRNDevice, TRUE)) || + (RtlEqualUnicodeString(&PathCopy, &RtlpDosAUXDevice, TRUE)) || + (RtlEqualUnicodeString(&PathCopy, &RtlpDosNULDevice, TRUE)) || + (RtlEqualUnicodeString(&PathCopy, &RtlpDosCONDevice, TRUE)))) + { + /* Otherwise this was something like AUX, NUL, PRN, or CON */ + ReturnLength = sizeof(L"AUX"); + return MAKELONG(ReturnOffset, ReturnLength); + } + + /* Otherwise, this isn't a valid DOS device */ return 0; } +RTL_PATH_TYPE +NTAPI +RtlDetermineDosPathNameType_Ustr(IN PCUNICODE_STRING PathString) +{ + PWCHAR Path; + ULONG Chars; + + /* Validate the input */ + if (!PathString) return RtlPathTypeUnknown; + + Path = PathString->Buffer; + Chars = PathString->Length / sizeof(WCHAR); + + /* Return if there are no characters */ + if (!Chars) return RtlPathTypeUnknown; + + /* + * The algorithm is similar to RtlDetermineDosPathNameType_U but here we + * actually check for the path length before touching the characters + */ + if ((Chars < 1) || (IS_PATH_SEPARATOR(Path[0]))) + { + if ((Chars < 2) || !(IS_PATH_SEPARATOR(Path[1]))) return RtlPathTypeRooted; /* \x */ + if ((Chars < 3) || ((Path[2] != L'.') && (Path[2] != L'?'))) return RtlPathTypeUncAbsolute;/* \\x */ + if ((Chars >= 4) && (IS_PATH_SEPARATOR(Path[3]))) return RtlPathTypeLocalDevice; /* \\.\x or \\?\x */ + if (Chars != 3) return RtlPathTypeUncAbsolute; /* \\.x or \\?x */ + return RtlPathTypeRootLocalDevice; /* \\. or \\? */ + } + else + { + if ((Chars < 2) || (!(Path[0]) || (Path[1] != L':'))) return RtlPathTypeRelative; /* x */ + if ((Chars < 3) || (IS_PATH_SEPARATOR(Path[2]))) return RtlPathTypeDriveAbsolute; /* x:\ */ + return RtlPathTypeDriveRelative; /* x: */ + } +} + +NTSTATUS +NTAPI +RtlpCheckDeviceName(IN PUNICODE_STRING FileName, + IN ULONG Length, + OUT PBOOLEAN NameInvalid) +{ + PWCHAR Buffer; + NTSTATUS Status; + + /* Allocate a large enough buffer */ + Buffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, FileName->Length); + if (Buffer) + { + /* Assume failure */ + *NameInvalid = TRUE; + + /* Copy the filename */ + RtlCopyMemory(Buffer, FileName->Buffer, FileName->Length); + + /* And add a dot at the end */ + Buffer[Length / sizeof(WCHAR)] = L'.'; + Buffer[(Length / sizeof(WCHAR)) + 1] = UNICODE_NULL; + + /* Check if the file exists or not */ + *NameInvalid = RtlDoesFileExists_U(Buffer) ? FALSE: TRUE; + + /* Get rid of the buffer now */ + Status = RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer); + } + else + { + /* Assume the name is ok, but fail the call */ + *NameInvalid = FALSE; + Status = STATUS_NO_MEMORY; + } + + /* Return the status */ + return Status; +} + +ULONG +NTAPI +RtlGetFullPathName_Ustr(IN PUNICODE_STRING FileName, + IN ULONG Size, + IN PWSTR Buffer, + OUT PCWSTR *ShortName, + OUT PBOOLEAN InvalidName, + OUT RTL_PATH_TYPE *PathType) +{ + PWCHAR FileNameBuffer; + ULONG FileNameLength, FileNameChars, DosLength, DosLengthOffset, FullLength; + WCHAR c; + NTSTATUS Status; + + /* For now, assume the name is valid */ + DPRINT("Filename: %wZ\n", FileName); + DPRINT("Size and buffer: %lx %S\n", Size, Buffer); + if (InvalidName) *InvalidName = FALSE; + + /* Handle initial path type and failure case */ + *PathType = RtlPathTypeUnknown; + if (!(Size) || !(Buffer) || !(FileName) || + !(FileName->Length) || (FileName->Buffer[0] == UNICODE_NULL)) return 0; + + /* Break filename into component parts */ + FileNameBuffer = FileName->Buffer; + FileNameLength = FileName->Length; + FileNameChars = FileNameLength / sizeof(WCHAR); + + /* Kill trailing spaces */ + c = FileNameBuffer[FileNameChars - 1]; + while ((FileNameLength) && (c == L' ')) + { + /* Keep going, ignoring the spaces */ + FileNameLength -= sizeof(WCHAR); + if (FileNameLength) c = FileNameBuffer[FileNameLength / sizeof(WCHAR) - 1]; + } + + /* Check if anything is left */ + if (!FileNameLength) return 0; + + /* Check if this is a DOS name */ + DosLength = RtlIsDosDeviceName_Ustr(FileName); + DPRINT("DOS length for filename: %lx %wZ\n", DosLength, FileName); + if (DosLength) + { + /* Zero out the short name */ + if (ShortName) *ShortName = NULL; + + /* See comment for RtlIsDosDeviceName_Ustr if this is confusing... */ + DosLengthOffset = DosLength >> 16; + DosLength = DosLength & 0xFFFF; + + /* Do we have a DOS length, and does the caller want validity? */ + if ((InvalidName) && (DosLengthOffset)) + { + /* Do the check */ + Status = RtlpCheckDeviceName(FileName, DosLengthOffset, InvalidName); + + /* If the check failed, or the name is invalid, fail here */ + if (!NT_SUCCESS(Status)) return 0; + if (*InvalidName) return 0; + } + + /* Add the size of the device root and check if it fits in the size */ + FullLength = DosLength + DeviceRootString.Length; + if (FullLength < Size) + { + /* Add the device string */ + RtlMoveMemory(Buffer, DeviceRootString.Buffer, DeviceRootString.Length); + + /* Now add the DOS device name */ + RtlMoveMemory((PCHAR)Buffer + DeviceRootString.Length, + (PCHAR)FileNameBuffer + DosLengthOffset, + DosLength); + + /* Null terminate */ + *(PWCHAR)((ULONG_PTR)Buffer + FullLength) = UNICODE_NULL; + return FullLength; + } + + /* Otherwise, there's no space, so return the buffer size needed */ + if ((FullLength + sizeof(UNICODE_NULL)) > UNICODE_STRING_MAX_BYTES) return 0; + return FullLength + sizeof(UNICODE_NULL); + } + + /* This should work well enough for our current needs */ + *PathType = RtlDetermineDosPathNameType_U(FileNameBuffer); + DPRINT("Path type: %lx\n", *PathType); + + /* This is disgusting... but avoids re-writing everything */ + DPRINT("Calling old API with %s and %lx and %S\n", FileNameBuffer, Size, Buffer); + return RtlGetFullPathName_U(FileNameBuffer, Size, Buffer, (PWSTR*)ShortName); +} + +NTSTATUS +NTAPI +RtlpWin32NTNameToNtPathName_U(IN PUNICODE_STRING DosPath, + OUT PUNICODE_STRING NtPath, + OUT PCWSTR *PartName, + OUT PRTL_RELATIVE_NAME_U RelativeName) +{ + ULONG DosLength; + PWSTR NewBuffer, p; + + /* Validate the input */ + if (!DosPath) return STATUS_OBJECT_NAME_INVALID; + + /* Validate the DOS length */ + DosLength = DosPath->Length; + if (DosLength >= UNICODE_STRING_MAX_BYTES) return STATUS_NAME_TOO_LONG; + + /* Make space for the new path */ + NewBuffer = RtlAllocateHeap(RtlGetProcessHeap(), + 0, + DosLength + sizeof(UNICODE_NULL)); + if (!NewBuffer) return STATUS_NO_MEMORY; + + /* Copy the prefix, and then the rest of the DOS path, and NULL-terminate */ + RtlCopyMemory(NewBuffer, RtlpDosDevicesPrefix.Buffer, RtlpDosDevicesPrefix.Length); + RtlCopyMemory((PCHAR)NewBuffer + RtlpDosDevicesPrefix.Length, + DosPath->Buffer + RtlpDosDevicesPrefix.Length / sizeof(WCHAR), + DosPath->Length - RtlpDosDevicesPrefix.Length); + NewBuffer[DosLength / sizeof(WCHAR)] = UNICODE_NULL; + + /* Did the caller send a relative name? */ + if (RelativeName) + { + /* Zero initialize it */ + RtlInitEmptyUnicodeString(&RelativeName->RelativeName, NULL, 0); + RelativeName->ContainingDirectory = NULL; + RelativeName->CurDirRef = 0; + } + + /* Did the caller request a partial name? */ + if (PartName) + { + /* Loop from the back until we find a path separator */ + p = &NewBuffer[(DosLength - 1) / sizeof (WCHAR)]; + while (p > NewBuffer) if (*p-- == '\\') break; + + /* Was one found? */ + if (p > NewBuffer) + { + /* Move past it -- anything left? */ + p++; + if (!*p) + { + /* The path ends with a path separator, no part name */ + *PartName = NULL; + } + else + { + /* What follows the path separator is the part name */ + *PartName = p; + } + } + } + + /* Build the final NT path string */ + NtPath->Length = DosLength; + NtPath->Buffer = NewBuffer; + NtPath->MaximumLength = DosLength + sizeof(UNICODE_NULL); + return STATUS_SUCCESS; +} + +NTSTATUS +NTAPI +RtlpDosPathNameToRelativeNtPathName_Ustr(IN BOOLEAN HaveRelative, + IN PCUNICODE_STRING DosName, + OUT PUNICODE_STRING NtName, + OUT PCWSTR *PartName, + OUT PRTL_RELATIVE_NAME_U RelativeName) +{ + WCHAR BigBuffer[MAX_PATH + 1]; + PWCHAR PrefixBuffer, NewBuffer, Buffer; + ULONG MaxLength, PathLength, PrefixLength, PrefixCut, LengthChars, Length; + UNICODE_STRING CapturedDosName, PartNameString; + BOOLEAN QuickPath; + RTL_PATH_TYPE InputPathType, BufferPathType; + NTSTATUS Status; + BOOLEAN NameInvalid; + + /* Assume MAX_PATH for now */ + DPRINT("Relative: %lx DosName: %wZ NtName: %wZ, PartName: %p, RelativeName: %p\n", + HaveRelative, DosName, NtName, PartName, RelativeName); + MaxLength = sizeof(BigBuffer); + + /* Validate the input */ + if (!DosName) return STATUS_OBJECT_NAME_INVALID; + + /* Capture input string */ + CapturedDosName = *DosName; + + /* Check for \\?\\ form */ + if ((CapturedDosName.Length <= RtlpWin32NtRootSlash.Length) || + (CapturedDosName.Buffer[0] != RtlpWin32NtRootSlash.Buffer[0]) || + (CapturedDosName.Buffer[1] != RtlpWin32NtRootSlash.Buffer[1]) || + (CapturedDosName.Buffer[2] != RtlpWin32NtRootSlash.Buffer[2]) || + (CapturedDosName.Buffer[3] != RtlpWin32NtRootSlash.Buffer[3])) + { + /* Quick path won't be used */ + QuickPath = FALSE; + + /* Use the static buffer */ + Buffer = BigBuffer; + MaxLength += RtlpDosDevicesUncPrefix.Length; + + /* Allocate a buffer to hold the path */ + NewBuffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, MaxLength); + DPRINT("Length: %lx\n", MaxLength); + if (!NewBuffer) return STATUS_NO_MEMORY; + } + else + { + /* Use the optimized path after acquiring the lock */ + QuickPath = 1; + NewBuffer = NULL; + } + + /* Lock the PEB and check if the quick path can be used */ + RtlAcquirePebLock(); + if (QuickPath) + { + /* Some simple fixups will get us the correct path */ + DPRINT("Quick path\n"); + Status = RtlpWin32NTNameToNtPathName_U(&CapturedDosName, + NtName, + PartName, + RelativeName); + + /* Release the lock, we're done here */ + RtlReleasePebLock(); + return Status; + } + + /* Call the main function to get the full path name and length */ + PathLength = RtlGetFullPathName_Ustr(&CapturedDosName, + MAX_PATH * sizeof(WCHAR), + Buffer, + PartName, + &NameInvalid, + &InputPathType); + if ((NameInvalid) || !(PathLength) || (PathLength > (MAX_PATH * sizeof(WCHAR)))) + { + /* Invalid name, fail */ + DPRINT("Invalid name: %lx Path Length: %lx\n", NameInvalid, PathLength); + RtlFreeHeap(RtlGetProcessHeap(), 0, NewBuffer); + RtlReleasePebLock(); + return STATUS_OBJECT_NAME_INVALID; + } + + /* Start by assuming the path starts with \??\ (DOS Devices Path) */ + PrefixLength = RtlpDosDevicesPrefix.Length; + PrefixBuffer = RtlpDosDevicesPrefix.Buffer; + PrefixCut = 0; + + /* Check where it really is */ + BufferPathType = RtlDetermineDosPathNameType_U(Buffer); + DPRINT("Buffer: %S Type: %lx\n", Buffer, BufferPathType); + switch (BufferPathType) + { + /* It's actually a UNC path in \??\UNC\ */ + case RtlPathTypeUncAbsolute: + PrefixLength = RtlpDosDevicesUncPrefix.Length; + PrefixBuffer = RtlpDosDevicesUncPrefix.Buffer; + PrefixCut = 2; + break; + + case RtlPathTypeLocalDevice: + /* We made a good guess, go with it but skip the \??\ */ + PrefixCut = 4; + break; + + case RtlPathTypeDriveAbsolute: + case RtlPathTypeDriveRelative: + case RtlPathTypeRooted: + case RtlPathTypeRelative: + /* Our guess was good, roll with it */ + break; + + /* Nothing else is expected */ + default: + ASSERT(FALSE); + + } + + /* Now copy the prefix and the buffer */ + RtlCopyMemory(NewBuffer, PrefixBuffer, PrefixLength); + RtlCopyMemory((PCHAR)NewBuffer + PrefixLength, + &Buffer[PrefixCut], + PathLength - (PrefixCut * sizeof(WCHAR))); + + /* Compute the length */ + Length = PathLength - PrefixCut * sizeof(WCHAR) + PrefixLength; + LengthChars = Length / sizeof(WCHAR); + + /* Setup the actual NT path string and terminate it */ + NtName->Buffer = NewBuffer; + NtName->Length = Length; + NtName->MaximumLength = MaxLength; + NewBuffer[LengthChars] = UNICODE_NULL; + DPRINT("new buffer: %S\n", NewBuffer); + DPRINT("NT Name: %wZ\n", NtName); + + /* Check if a partial name was requested */ + if ((PartName) && (*PartName)) + { + /* Convert to Unicode */ + Status = RtlInitUnicodeStringEx(&PartNameString, *PartName); + if (NT_SUCCESS(Status)) + { + /* Set the partial name */ + *PartName = &NewBuffer[LengthChars - (PartNameString.Length / sizeof(WCHAR))]; + } + else + { + /* Fail */ + RtlFreeHeap(RtlGetProcessHeap(), 0, NewBuffer); + RtlReleasePebLock(); + return Status; + } + } + + /* Check if a relative name was asked for */ + if (RelativeName) + { + /* Setup the structure */ + RtlInitEmptyUnicodeString(&RelativeName->RelativeName, NULL, 0); + RelativeName->ContainingDirectory = NULL; + RelativeName->CurDirRef = 0; + + /* Check if the input path itself was relative */ + if (InputPathType == RtlPathTypeRelative) + { + /* FIXME: HACK: Old code */ + PCURDIR cd; + UNICODE_STRING us; + cd = (PCURDIR)&(NtCurrentPeb ()->ProcessParameters->CurrentDirectory.DosPath); + if (cd->Handle) + { + RtlInitUnicodeString(&us, Buffer); + us.Length = (cd->DosPath.Length < us.Length) ? cd->DosPath.Length : us.Length; + if (RtlEqualUnicodeString(&us, &cd->DosPath, TRUE)) + { + Length = ((cd->DosPath.Length / sizeof(WCHAR)) - PrefixCut) + ((InputPathType == 1) ? 8 : 4); + RelativeName->RelativeName.Buffer = NewBuffer + Length; + RelativeName->RelativeName.Length = NtName->Length - (Length * sizeof(WCHAR)); + RelativeName->RelativeName.MaximumLength = RelativeName->RelativeName.Length; + RelativeName->ContainingDirectory = cd->Handle; + } + } + } + } + + /* Done */ + RtlReleasePebLock(); + return STATUS_SUCCESS; +} + +NTSTATUS +NTAPI +RtlpDosPathNameToRelativeNtPathName_U(IN BOOLEAN HaveRelative, + IN PCWSTR DosName, + OUT PUNICODE_STRING NtName, + OUT PCWSTR *PartName, + OUT PRTL_RELATIVE_NAME_U RelativeName) +{ + NTSTATUS Status; + UNICODE_STRING NameString; + + /* Create the unicode name */ + Status = RtlInitUnicodeStringEx(&NameString, DosName); + if (NT_SUCCESS(Status)) + { + /* Call the unicode function */ + Status = RtlpDosPathNameToRelativeNtPathName_Ustr(HaveRelative, + &NameString, + NtName, + PartName, + RelativeName); + } + + /* Return status */ + return Status; +} + +BOOLEAN +NTAPI +RtlDosPathNameToRelativeNtPathName_Ustr(IN PCUNICODE_STRING DosName, + OUT PUNICODE_STRING NtName, + OUT PCWSTR *PartName, + OUT PRTL_RELATIVE_NAME_U RelativeName) +{ + /* Call the internal function */ + ASSERT(RelativeName); + return NT_SUCCESS(RtlpDosPathNameToRelativeNtPathName_Ustr(TRUE, + DosName, + NtName, + PartName, + RelativeName)); +} + +BOOLEAN +NTAPI +RtlDoesFileExists_UstrEx(IN PCUNICODE_STRING FileName, + IN BOOLEAN SucceedIfBusy) +{ + BOOLEAN Result; + RTL_RELATIVE_NAME_U RelativeName; + UNICODE_STRING NtPathName; + PVOID Buffer; + OBJECT_ATTRIBUTES ObjectAttributes; + NTSTATUS Status; + FILE_BASIC_INFORMATION BasicInformation; + + /* Validate the input */ + if (!FileName) return FALSE; + + /* Get the NT Path */ + Result = RtlDosPathNameToRelativeNtPathName_Ustr(FileName, + &NtPathName, + NULL, + &RelativeName); + if (!Result) return FALSE; + + /* Save the buffer */ + Buffer = NtPathName.Buffer; + + /* Check if we have a relative name */ + if (RelativeName.RelativeName.Length) + { + /* Use it */ + NtPathName = RelativeName.RelativeName; + } + else + { + /* Otherwise ignore it */ + RelativeName.ContainingDirectory = NULL; + } + + /* Initialize the object attributes */ + InitializeObjectAttributes(&ObjectAttributes, + &NtPathName, + OBJ_CASE_INSENSITIVE, + RelativeName.ContainingDirectory, + NULL); + + /* Query the attributes and free the buffer now */ + Status = ZwQueryAttributesFile(&ObjectAttributes, &BasicInformation); + RtlReleaseRelativeName(&RelativeName); + RtlFreeHeap(RtlGetProcessHeap(), 0, Buffer); + + /* Check if we failed */ + if (!NT_SUCCESS(Status)) + { + /* Check if we failed because the file is in use */ + if ((Status == STATUS_SHARING_VIOLATION) || + (Status == STATUS_ACCESS_DENIED)) + { + /* Check if the caller wants this to be considered OK */ + Result = SucceedIfBusy ? TRUE : FALSE; + } + else + { + /* A failure because the file didn't exist */ + Result = FALSE; + } + } + else + { + /* The file exists */ + Result = TRUE; + } + + /* Return the result */ + return Result; +} + +BOOLEAN +NTAPI +RtlDoesFileExists_UStr(IN PUNICODE_STRING FileName) +{ + /* Call the updated API */ + return RtlDoesFileExists_UstrEx(FileName, TRUE); +} + +BOOLEAN +NTAPI +RtlDoesFileExists_UEx(IN PCWSTR FileName, + IN BOOLEAN SucceedIfBusy) +{ + UNICODE_STRING NameString; + + /* Create the unicode name*/ + if (NT_SUCCESS(RtlInitUnicodeStringEx(&NameString, FileName))) + { + /* Call the unicode function */ + return RtlDoesFileExists_UstrEx(&NameString, SucceedIfBusy); + } + + /* Fail */ + return FALSE; +} + +/* PUBLIC FUNCTIONS ***********************************************************/ /* * @implemented */ -ULONG NTAPI -RtlGetCurrentDirectory_U(ULONG MaximumLength, - PWSTR Buffer) +VOID +NTAPI +RtlReleaseRelativeName(IN PRTL_RELATIVE_NAME_U RelativeName) { - ULONG Length; - PCURDIR cd; - - DPRINT ("RtlGetCurrentDirectory %lu %p\n", MaximumLength, Buffer); - - RtlAcquirePebLock(); - - cd = (PCURDIR)&(NtCurrentPeb ()->ProcessParameters->CurrentDirectory.DosPath); - Length = cd->DosPath.Length / sizeof(WCHAR); - if (cd->DosPath.Buffer[Length - 1] == L'\\' && - cd->DosPath.Buffer[Length - 2] != L':') - Length--; - - DPRINT ("cd->DosPath.Buffer %S Length %lu\n", - cd->DosPath.Buffer, Length); - - if (MaximumLength / sizeof(WCHAR) > Length) - { - memcpy (Buffer, - cd->DosPath.Buffer, - Length * sizeof(WCHAR)); - Buffer[Length] = 0; - } - else - { - Length++; - } - - RtlReleasePebLock (); - - DPRINT ("CurrentDirectory %S\n", Buffer); - - return (Length * sizeof(WCHAR)); + /* Check if a directory reference was grabbed */ + if (RelativeName->CurDirRef) + { + /* FIXME: Not yet supported */ + UNIMPLEMENTED; + RelativeName->CurDirRef = NULL; + } } +/* + * @implemented + */ +ULONG +NTAPI +RtlGetLongestNtPathLength(VOID) +{ + /* + * The longest NT path is a DOS path that actually sits on a UNC path (ie: + * a mapped network drive), which is accessed through the DOS Global?? path. + * This is, and has always been equal to, 269 characters, except in Wine + * which claims this is 277. Go figure. + */ + return (MAX_PATH + RtlpDosDevicesUncPrefix.Length + sizeof(ANSI_NULL)); +} + +/* + * @implemented + */ +ULONG +NTAPI +RtlDetermineDosPathNameType_U(IN PCWSTR Path) +{ + DPRINT("RtlDetermineDosPathNameType_U %S\n", Path); + + /* Validate the input */ + if (!Path) return RtlPathTypeUnknown; + + /* Unlike the newer RtlDetermineDosPathNameType_U we assume 4 characters */ + if (IS_PATH_SEPARATOR(Path[0])) + { + if (!IS_PATH_SEPARATOR(Path[1])) return RtlPathTypeRooted; /* \x */ + if ((Path[2] != L'.') && (Path[2] != L'?')) return RtlPathTypeUncAbsolute;/* \\x */ + if (IS_PATH_SEPARATOR(Path[3])) return RtlPathTypeLocalDevice; /* \\.\x or \\?\x */ + if (Path[3]) return RtlPathTypeUncAbsolute; /* \\.x or \\?x */ + return RtlPathTypeRootLocalDevice; /* \\. or \\? */ + } + else + { + if (!(Path[0]) || (Path[1] != L':')) return RtlPathTypeRelative; /* x */ + if (IS_PATH_SEPARATOR(Path[2])) return RtlPathTypeDriveAbsolute; /* x:\ */ + return RtlPathTypeDriveRelative; /* x: */ + } +} + +/* + * @implemented + */ +ULONG +NTAPI +RtlIsDosDeviceName_U(IN PWSTR Path) +{ + UNICODE_STRING PathString; + NTSTATUS Status; + + /* Build the string */ + Status = RtlInitUnicodeStringEx(&PathString, Path); + if (!NT_SUCCESS(Status)) return 0; + + /* + * Returns 0 if name is not valid DOS device name, or DWORD with + * offset in bytes to DOS device name from beginning of buffer in high word + * and size in bytes of DOS device name in low word + */ + return RtlIsDosDeviceName_Ustr(&PathString); +} + +/* + * @implemented + */ +ULONG +NTAPI +RtlGetCurrentDirectory_U(IN ULONG MaximumLength, + IN PWSTR Buffer) +{ + ULONG Length, Bytes; + PCURDIR CurDir; + PWSTR CurDirName; + DPRINT("RtlGetCurrentDirectory %lu %p\n", MaximumLength, Buffer); + + /* Lock the PEB to get the current directory */ + RtlAcquirePebLock(); + CurDir = &NtCurrentPeb()->ProcessParameters->CurrentDirectory; + + /* Get the buffer and character length */ + CurDirName = CurDir->DosPath.Buffer; + Length = CurDir->DosPath.Length / sizeof(WCHAR); + ASSERT((CurDirName != NULL) && (Length > 0)); + + /* Check for x:\ vs x:\path\foo (note the trailing slash) */ + Bytes = Length * sizeof(WCHAR); + if ((Length <= 1) || (CurDirName[Length - 2] == L':')) + { + /* Check if caller does not have enough space */ + if (MaximumLength <= Bytes) + { + /* Call has no space for it, fail, add the trailing slash */ + RtlReleasePebLock(); + return Bytes + sizeof(L'\\'); + } + } + else + { + /* Check if caller does not have enough space */ + if (MaximumLength <= Bytes) + { + /* Call has no space for it, fail */ + RtlReleasePebLock(); + return Bytes; + } + } + + /* Copy the buffer since we seem to have space */ + RtlCopyMemory(Buffer, CurDirName, Bytes); + + /* The buffer should end with a path separator */ + ASSERT(Buffer[Length - 1] == L'\\'); + + /* Again check for our two cases (drive root vs path) */ + if ((Length <= 1) || (Buffer[Length - 2] != L':')) + { + /* Replace the trailing slash with a null */ + Buffer[Length - 1] = UNICODE_NULL; + --Length; + } + else + { + /* Append the null char since there's no trailing slash */ + Buffer[Length] = UNICODE_NULL; + } + + /* Release PEB lock */ + RtlReleasePebLock(); + DPRINT("CurrentDirectory %S\n", Buffer); + return Length * sizeof(WCHAR); +} /* * @implemented @@ -628,323 +1365,83 @@ ULONG NTAPI RtlGetFullPathName_U( return reqsize; } - /* * @implemented */ -BOOLEAN NTAPI -RtlDosPathNameToNtPathName_U(IN PCWSTR DosPathName, - OUT PUNICODE_STRING NtPathName, - OUT PCWSTR *NtFileNamePart, - OUT CURDIR *DirectoryInfo) -{ - UNICODE_STRING us; - PCURDIR cd; - ULONG Type; - ULONG Size; - ULONG Length; - ULONG tmpLength; - ULONG Offset; - WCHAR fullname[MAX_PATH + 1]; - PWSTR Buffer = NULL; - - RtlInitUnicodeString (&us, DosPathName); - if (us.Length > 8) - { - Buffer = us.Buffer; - /* check for "\\?\" - allows to use very long filenames ( up to 32k ) */ - if (Buffer[0] == L'\\' && Buffer[1] == L'\\' && - Buffer[2] == L'?' && Buffer[3] == L'\\') - { - /* allocate the new string and simply copy it */ - NtPathName->Length = us.Length; - NtPathName->MaximumLength = us.Length + sizeof(WCHAR); - NtPathName->Buffer = RtlAllocateHeap(RtlGetProcessHeap(), - 0, - NtPathName->MaximumLength); - if (NtPathName->Buffer == NULL) - { - return FALSE; - } - - /* copy the string */ - RtlCopyMemory(NtPathName->Buffer, - us.Buffer, - NtPathName->Length); - NtPathName->Buffer[us.Length / sizeof(WCHAR)] = L'\0'; - - /* change the \\?\ prefix to \??\ */ - NtPathName->Buffer[1] = L'?'; - - if (NtFileNamePart != NULL) - { - PWSTR FilePart = NULL; - PWSTR s; - - /* try to find the last separator */ - s = NtPathName->Buffer + (NtPathName->Length / sizeof(WCHAR)); - while (s != NtPathName->Buffer) - { - if (*s == L'\\') - { - FilePart = s + 1; - break; - } - s--; - } - - *NtFileNamePart = FilePart; - } - - if (DirectoryInfo != NULL) - { - DirectoryInfo->DosPath.Length = 0; - DirectoryInfo->DosPath.MaximumLength = 0; - DirectoryInfo->DosPath.Buffer = NULL; - DirectoryInfo->Handle = NULL; - } - - return TRUE; - } - } - - Buffer = RtlAllocateHeap (RtlGetProcessHeap (), - 0, - sizeof( fullname ) + MAX_PFX_SIZE); - if (Buffer == NULL) - { - return FALSE; - } - - RtlAcquirePebLock (); - - Size = RtlGetFullPathName_U (DosPathName, - sizeof(fullname), - fullname, - (PWSTR*)NtFileNamePart); - if (Size == 0 || Size > MAX_PATH * sizeof(WCHAR)) - { - RtlFreeHeap (RtlGetProcessHeap (), - 0, - Buffer); - RtlReleasePebLock (); - return FALSE; - } - - /* Set NT prefix */ - Offset = 0; - memcpy (Buffer, L"\\??\\", 4 * sizeof(WCHAR)); - tmpLength = 4; - - Type = RtlDetermineDosPathNameType_U (fullname); - switch (Type) - { - case 1: - memcpy (Buffer + tmpLength, L"UNC\\", 4 * sizeof(WCHAR)); - tmpLength += 4; - Offset = 2; - break; /* \\xxx */ - - case 6: - Offset = 4; - break; /* \\.\xxx */ - } - Length = wcslen(fullname + Offset); - memcpy (Buffer + tmpLength, fullname + Offset, (Length + 1) * sizeof(WCHAR)); - Length += tmpLength; - if (Type == RtlPathTypeDriveAbsolute || - Type == RtlPathTypeDriveRelative) - { - /* make the drive letter to uppercase */ - Buffer[tmpLength] = towupper(Buffer[tmpLength]); - } - - /* set NT filename */ - NtPathName->Length = Length * sizeof(WCHAR); - NtPathName->MaximumLength = sizeof(fullname) + MAX_PFX_SIZE; - NtPathName->Buffer = Buffer; - - /* set pointer to file part if possible */ - if (NtFileNamePart && *NtFileNamePart) - *NtFileNamePart = Buffer + Length - wcslen (*NtFileNamePart); - - /* Set name and handle structure if possible */ - if (DirectoryInfo) - { - memset (DirectoryInfo, 0, sizeof(CURDIR)); - cd = (PCURDIR)&(NtCurrentPeb ()->ProcessParameters->CurrentDirectory.DosPath); - if (Type == 5 && cd->Handle) - { - RtlInitUnicodeString(&us, fullname); - if (RtlEqualUnicodeString(&us, &cd->DosPath, TRUE)) - { - Length = ((cd->DosPath.Length / sizeof(WCHAR)) - Offset) + ((Type == 1) ? 8 : 4); - DirectoryInfo->DosPath.Buffer = Buffer + Length; - DirectoryInfo->DosPath.Length = NtPathName->Length - (Length * sizeof(WCHAR)); - DirectoryInfo->DosPath.MaximumLength = DirectoryInfo->DosPath.Length; - DirectoryInfo->Handle = cd->Handle; - } - } - } - - RtlReleasePebLock(); - return TRUE; -} - - -/* - * @implemented - */ -/****************************************************************** - * RtlDosSearchPath_U - * - * Searches a file of name 'name' into a ';' separated list of paths - * (stored in paths) - * Doesn't seem to search elsewhere than the paths list - * Stores the result in buffer (file_part will point to the position - * of the file name in the buffer) - * FIXME: - * - how long shall the paths be ??? (MAX_PATH or larger with \\?\ constructs ???) - */ -ULONG +BOOLEAN NTAPI -RtlDosSearchPath_U(PCWSTR paths, - PCWSTR search, - PCWSTR ext, - ULONG buffer_size, - PWSTR buffer, - PWSTR* file_part) +RtlDosPathNameToNtPathName_U(IN PCWSTR DosName, + OUT PUNICODE_STRING NtName, + OUT PCWSTR *PartName, + OUT PRTL_RELATIVE_NAME_U RelativeName) { - RTL_PATH_TYPE type = RtlDetermineDosPathNameType_U(search); - ULONG len = 0; - - if (type == RtlPathTypeRelative) - { - ULONG allocated = 0, needed, filelen; - WCHAR *name = NULL; - - filelen = 1 /* for \ */ + wcslen(search) + 1 /* \0 */; - - /* Windows only checks for '.' without worrying about path components */ - if (wcschr( search, '.' )) ext = NULL; - if (ext != NULL) filelen += wcslen(ext); - - while (*paths) - { - LPCWSTR ptr; - - for (needed = 0, ptr = paths; *ptr != 0 && *ptr++ != ';'; needed++); - if (needed + filelen > allocated) - { - if (!name) name = RtlAllocateHeap(RtlGetProcessHeap(), 0, - (needed + filelen) * sizeof(WCHAR)); - else - { - WCHAR *newname = RtlReAllocateHeap(RtlGetProcessHeap(), 0, name, - (needed + filelen) * sizeof(WCHAR)); - if (!newname) RtlFreeHeap(RtlGetProcessHeap(), 0, name); - name = newname; - } - if (!name) return 0; - allocated = needed + filelen; - } - memmove(name, paths, needed * sizeof(WCHAR)); - /* append '\\' if none is present */ - if (needed > 0 && name[needed - 1] != '\\') name[needed++] = '\\'; - wcscpy(&name[needed], search); - if (ext) wcscat(&name[needed], ext); - if (RtlDoesFileExists_U(name)) - { - len = RtlGetFullPathName_U(name, buffer_size, buffer, file_part); - break; - } - paths = ptr; - } - RtlFreeHeap(RtlGetProcessHeap(), 0, name); - } - else if (RtlDoesFileExists_U(search)) - { - len = RtlGetFullPathName_U(search, buffer_size, buffer, file_part); - } - - return len; + /* Call the internal function */ + return NT_SUCCESS(RtlpDosPathNameToRelativeNtPathName_U(FALSE, + DosName, + NtName, + PartName, + RelativeName)); } - /* * @implemented */ -BOOLEAN NTAPI -RtlDoesFileExists_U(IN PCWSTR FileName) +NTSTATUS +NTAPI +RtlDosPathNameToNtPathName_U_WithStatus(IN PCWSTR DosName, + OUT PUNICODE_STRING NtName, + OUT PCWSTR *PartName, + OUT PRTL_RELATIVE_NAME_U RelativeName) { - UNICODE_STRING NtFileName; - OBJECT_ATTRIBUTES Attr; - FILE_BASIC_INFORMATION Info; - NTSTATUS Status; - CURDIR CurDir; - - if (!RtlDosPathNameToNtPathName_U (FileName, - &NtFileName, - NULL, - &CurDir)) - return FALSE; - - if (CurDir.DosPath.Length) - NtFileName = CurDir.DosPath; - else - CurDir.Handle = 0; - - InitializeObjectAttributes (&Attr, - &NtFileName, - OBJ_CASE_INSENSITIVE, - CurDir.Handle, - NULL); - - Status = ZwQueryAttributesFile (&Attr, &Info); - - RtlFreeUnicodeString(&NtFileName); - - - if (NT_SUCCESS(Status) || - Status == STATUS_SHARING_VIOLATION || - Status == STATUS_ACCESS_DENIED) - return TRUE; - - return FALSE; + /* Call the internal function */ + return RtlpDosPathNameToRelativeNtPathName_U(FALSE, + DosName, + NtName, + PartName, + RelativeName); } +/* + * @implemented + */ +BOOLEAN +NTAPI +RtlDosPathNameToRelativeNtPathName_U(IN PWSTR DosName, + OUT PUNICODE_STRING NtName, + OUT PCWSTR *PartName, + OUT PRTL_RELATIVE_NAME_U RelativeName) +{ + /* Call the internal function */ + ASSERT(RelativeName); + return NT_SUCCESS(RtlpDosPathNameToRelativeNtPathName_U(TRUE, + DosName, + NtName, + PartName, + RelativeName)); +} + +/* + * @implemented + */ +NTSTATUS +NTAPI +RtlDosPathNameToRelativeNtPathName_U_WithStatus(IN PWSTR DosName, + OUT PUNICODE_STRING NtName, + OUT PCWSTR *PartName, + OUT PRTL_RELATIVE_NAME_U RelativeName) +{ + /* Call the internal function */ + ASSERT(RelativeName); + return RtlpDosPathNameToRelativeNtPathName_U(TRUE, + DosName, + NtName, + PartName, + RelativeName); +} /* * @unimplemented */ -BOOLEAN NTAPI -RtlDosPathNameToRelativeNtPathName_U(PVOID Unknown1, - PVOID Unknown2, - PVOID Unknown3, - PVOID Unknown4) -{ - DPRINT1("RtlDosPathNameToRelativeNtPathName_U(0x%p, 0x%p, 0x%p, 0x%p) UNIMPLEMENTED!\n", - Unknown1, Unknown2, Unknown3, Unknown4); - return FALSE; -} - - -/* - * @unimplemented - */ -VOID NTAPI -RtlReleaseRelativeName(PVOID Unknown) -{ - DPRINT1("RtlReleaseRelativeName(0x%p) UNIMPLEMENTED\n", Unknown); -} - -NTSTATUS NTAPI -RtlpEnsureBufferSize(ULONG Unknown1, ULONG Unknown2, ULONG Unknown3) -{ - DPRINT1("RtlpEnsureBufferSize: stub\n"); - return STATUS_NOT_IMPLEMENTED; -} - NTSTATUS NTAPI RtlNtPathNameToDosPathName(ULONG Unknown1, ULONG Unknown2, ULONG Unknown3, ULONG Unknown4) { @@ -952,4 +1449,166 @@ RtlNtPathNameToDosPathName(ULONG Unknown1, ULONG Unknown2, ULONG Unknown3, ULONG return STATUS_NOT_IMPLEMENTED; } +/* + * @implemented + */ +ULONG +NTAPI +RtlDosSearchPath_U(IN PCWSTR Path, + IN PCWSTR FileName, + IN PCWSTR Extension, + IN ULONG Size, + IN PWSTR Buffer, + OUT PWSTR *PartName) +{ + NTSTATUS Status; + ULONG ExtensionLength, Length, FileNameLength, PathLength; + UNICODE_STRING TempString; + PWCHAR NewBuffer, BufferStart; + PCWSTR p; + + /* Validate the input */ + if (!(Path) || !(FileName)) return 0; + + /* Check if this is an absolute path */ + if (RtlDetermineDosPathNameType_U(FileName) != RtlPathTypeRelative) + { + /* Check if the file exists */ + if (RtlDoesFileExists_UEx(FileName, TRUE)) + { + /* Get the full name, which does the DOS lookup */ + return RtlGetFullPathName_U(FileName, Size, Buffer, PartName); + } + + /* Doesn't exist, so fail */ + return 0; + } + + /* Scan the filename */ + p = FileName; + while (*p) + { + /* Looking for an extension */ + if (*p == '.') + { + /* No extension string needed -- it's part of the filename */ + Extension = NULL; + break; + } + + /* Next character */ + p++; + } + + /* Do we have an extension? */ + if (!Extension) + { + /* Nope, don't worry about one */ + ExtensionLength = 0; + } + else + { + /* Build a temporary string to get the extension length */ + Status = RtlInitUnicodeStringEx(&TempString, Extension); + if (!NT_SUCCESS(Status)) return 0; + ExtensionLength = TempString.Length; + } + + /* Build a temporary string to get the path length */ + Status = RtlInitUnicodeStringEx(&TempString, Path); + if (!NT_SUCCESS(Status)) return 0; + PathLength = TempString.Length; + + /* Build a temporary string to get the filename length */ + Status = RtlInitUnicodeStringEx(&TempString, FileName); + if (!NT_SUCCESS(Status)) return 0; + FileNameLength = TempString.Length; + + /* Allocate the buffer for the new string name */ + NewBuffer = RtlAllocateHeap(RtlGetProcessHeap(), + 0, + FileNameLength + + ExtensionLength + + PathLength + + 3 * sizeof(WCHAR)); + if (!NewBuffer) + { + /* Fail the call */ + DbgPrint("%s: Failing due to out of memory (RtlAllocateHeap failure)\n", + __FUNCTION__); + return 0; + } + + /* Final loop to build the path */ + while (TRUE) + { + /* Check if we have a valid character */ + BufferStart = NewBuffer; + if (*Path) + { + /* Loop as long as there's no semicolon */ + while (*Path != ';') + { + /* Copy the next character */ + *BufferStart++ = *Path++; + if (!*Path) break; + } + + /* We found a semi-colon, to stop path processing on this loop */ + if (*Path == ';') ++Path; + } + + /* Add a terminating slash if needed */ + if ((BufferStart != NewBuffer) && (BufferStart[-1] != '\\')) + { + *BufferStart++ = '\\'; + } + + /* Bail out if we reached the end */ + if (!*Path) Path = NULL; + + /* Copy the file name and check if an extension is needed */ + RtlCopyMemory(BufferStart, FileName, FileNameLength); + if (ExtensionLength) + { + /* Copy the extension too */ + RtlCopyMemory((PCHAR)BufferStart + FileNameLength, + Extension, + ExtensionLength + sizeof(WCHAR)); + } + else + { + /* Just NULL-terminate */ + *(PWCHAR)((PCHAR)BufferStart + FileNameLength) = UNICODE_NULL; + } + + /* Now, does this file exist? */ + if (RtlDoesFileExists_UEx(NewBuffer, FALSE)) + { + /* Call the full-path API to get the length */ + Length = RtlGetFullPathName_U(NewBuffer, Size, Buffer, PartName); + break; + } + + /* If we got here, path doesn't exist, so fail the call */ + Length = 0; + if (!Path) break; + } + + /* Free the allocation and return the length */ + RtlFreeHeap(RtlGetProcessHeap(), 0, NewBuffer); + return Length; +} + +/* + * @implemented + */ +BOOLEAN +NTAPI +RtlDoesFileExists_U(IN PCWSTR FileName) +{ + /* Call the new function */ + return RtlDoesFileExists_UEx(FileName, TRUE); +} + /* EOF */ diff --git a/lib/rtl/rtl.h b/lib/rtl/rtl.h index 848ab3d0b04..15a6ba843aa 100644 --- a/lib/rtl/rtl.h +++ b/lib/rtl/rtl.h @@ -22,7 +22,19 @@ /* PSDK/NDK Headers */ #include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include /* Internal RTL header */ #include "rtlp.h" diff --git a/lib/rtl/splaytree.c b/lib/rtl/splaytree.c index df319e21e7f..28f1027d175 100644 --- a/lib/rtl/splaytree.c +++ b/lib/rtl/splaytree.c @@ -13,13 +13,134 @@ #define NDEBUG #include +//#define VERIFY_SWAP_SPLAY_LINKS + /* FUNCTIONS ***************************************************************/ +static +VOID +FixupChildLinks(PRTL_SPLAY_LINKS Links, BOOLEAN Root, BOOLEAN LeftChild) +{ + if (RtlLeftChild(Links)) { + RtlInsertAsLeftChild(Links, RtlLeftChild(Links)); + } + if (RtlRightChild(Links)) { + RtlInsertAsRightChild(Links, RtlRightChild(Links)); + } + if (!Root) { + if (LeftChild) { + RtlInsertAsLeftChild(RtlParent(Links), Links); + } else { + RtlInsertAsRightChild(RtlParent(Links), Links); + } + } +} + +/* + +Given the tree: + D + B F +A C E G + +Swap(Q,S): + +Q S Q.P Q.L Q.R S.P S.L S.R +A C S.P S.L S.R Q.P Q.L Q.R +B A S S.L S.R Q.P Q Q.R +B C S S.L S.R Q.P Q.L Q +D A S.P S.L S.R S Q.L Q.R +D B S S.L S.R S Q Q.R +D F S S.L S.R S Q.L Q + +When Q is the immediate parent of S, + Set Q's parent to S, and the proper child ptr of S to Q +When Q is the root, + Set S's parent to S + */ + +static VOID SwapSplayLinks(PRTL_SPLAY_LINKS LinkA, PRTL_SPLAY_LINKS LinkB) { - DPRINT1("UNIMPLEMENTED!\n"); + if (RtlParent(LinkA) == LinkB || RtlIsRoot(LinkB)) { + PRTL_SPLAY_LINKS Tmp = LinkA; + LinkA = LinkB; + LinkB = Tmp; + } + + { + RTL_SPLAY_LINKS Ta = *LinkA, Tb = *LinkB; + BOOLEAN RootA = RtlIsRoot(LinkA), + LeftA = RtlIsLeftChild(LinkA), + LeftB = RtlIsLeftChild(LinkB); + *LinkB = Ta; *LinkA = Tb; + + // A was parent of B is a special case: A->Parent is now B + if (RtlParent(&Tb) == LinkA) { + if (!RootA) { + if (LeftA) { + RtlInsertAsLeftChild(RtlParent(&Ta), LinkB); + } else { + RtlInsertAsRightChild(RtlParent(&Ta), LinkB); + } + } + if (LeftB) { + RtlInsertAsLeftChild(LinkB, LinkA); + } else { + RtlInsertAsRightChild(LinkB, LinkA); + } + } + + FixupChildLinks(LinkA, FALSE, LeftB); + FixupChildLinks(LinkB, RootA, LeftA); + + // A was root is a special case: B->Parent is now B + if (RootA) + RtlParent(LinkB) = LinkB; + +#ifdef VERIFY_SWAP_SPLAY_LINKS + // Verify the distinct cases of node swap + if (RootA) { + if (RtlParent(&Tb) == LinkA) { + // LinkA = D, LinkB = B + // D B S S.L S.R S Q Q.R + ASSERT(RtlParent(LinkA) == LinkB); + ASSERT(RtlLeftChild(LinkA) == RtlLeftChild(&Tb)); + ASSERT(RtlRightChild(LinkA) == RtlRightChild(&Tb)); + ASSERT(RtlParent(LinkB) == LinkB); + ASSERT(RtlLeftChild(LinkB) == (LeftB ? LinkA : RtlLeftChild(&Ta))); + ASSERT(RtlRightChild(LinkB) == (LeftB ? RtlRightChild(&Ta) : LinkA)); + } else { + // LinkA = D, LinkB = A + // D A S.P S.L S.R S Q.L Q.R + ASSERT(RtlParent(LinkA) == RtlParent(&Tb)); + ASSERT(RtlLeftChild(LinkA) == RtlLeftChild(&Tb)); + ASSERT(RtlRightChild(LinkA) == RtlRightChild(&Tb)); + ASSERT(RtlParent(LinkB) == LinkB); + ASSERT(RtlLeftChild(LinkB) == RtlLeftChild(&Ta)); + ASSERT(RtlRightChild(LinkB) == RtlRightChild(&Ta)); + } + } else { + if (RtlParent(&Tb) == LinkA) { + // LinkA = B, LinkB = A + // B A S S.L S.R Q.P Q Q.R + ASSERT(RtlParent(LinkA) == LinkB); + ASSERT(RtlLeftChild(LinkA) == RtlLeftChild(&Tb)); + ASSERT(RtlRightChild(LinkA) == RtlRightChild(&Tb)); + ASSERT(RtlParent(LinkB) == RtlParent(&Ta)); + ASSERT(RtlLeftChild(LinkB) == (LeftB ? LinkA : RtlLeftChild(&Ta))); + ASSERT(RtlRightChild(LinkB) == (LeftB ? RtlRightChild(&Ta) : LinkA)); + } else { + // LinkA = A, LinkB = C + // A C S.P S.L S.R Q.P Q.L Q.R + ASSERT(!memcmp(LinkA, &Tb, sizeof(Tb))); + ASSERT(!memcmp(LinkB, &Ta, sizeof(Ta))); + } + } +#endif + } } /* @@ -513,6 +634,7 @@ RtlSplay(PRTL_SPLAY_LINKS Links) } /* Return the root entry */ + ASSERT(RtlIsRoot(N)); return N; } diff --git a/lib/rtl/unicode.c b/lib/rtl/unicode.c index e49896efa4e..7089bb3697d 100644 --- a/lib/rtl/unicode.c +++ b/lib/rtl/unicode.c @@ -2382,6 +2382,19 @@ RtlValidateUnicodeString(IN ULONG Flags, } } +/* + * @unimplemented + */ +NTSTATUS NTAPI +RtlpEnsureBufferSize(ULONG Unknown1, ULONG Unknown2, ULONG Unknown3) +{ + DPRINT1("RtlpEnsureBufferSize: stub\n"); + return STATUS_NOT_IMPLEMENTED; +} + +/* + * @implemented + */ NTSTATUS NTAPI RtlFindCharInUnicodeString(IN ULONG Flags, diff --git a/lib/rtl/workitem.c b/lib/rtl/workitem.c index c74aea8b48d..cb6c83ab35a 100644 --- a/lib/rtl/workitem.c +++ b/lib/rtl/workitem.c @@ -45,7 +45,7 @@ static LONG ThreadPoolIOWorkerThreads; static LONG ThreadPoolIOWorkerThreadsRequests; static LONG ThreadPoolIOWorkerThreadsLongRequests; -#define IsThreadPoolInitialized() ((volatile LONG)ThreadPoolInitialized == 1) +#define IsThreadPoolInitialized() (*((volatile LONG*)&ThreadPoolInitialized) == 1) static NTSTATUS RtlpInitializeThreadPool(VOID) @@ -614,8 +614,8 @@ Wait: /* FIXME - figure out an effective method to determine if it's appropriate to lower the number of threads. For now let's always terminate if there's at least one thread and no queued items. */ - Terminate = ((volatile LONG)ThreadPoolIOWorkerThreads - (volatile LONG)ThreadPoolIOWorkerThreadsLongRequests >= WORKERTHREAD_CREATION_THRESHOLD) && - ((volatile LONG)ThreadPoolIOWorkerThreadsRequests == 0); + Terminate = (*((volatile LONG*)&ThreadPoolIOWorkerThreads) - *((volatile LONG*)&ThreadPoolIOWorkerThreadsLongRequests) >= WORKERTHREAD_CREATION_THRESHOLD) && + (*((volatile LONG*)&ThreadPoolIOWorkerThreadsRequests) == 0); if (Terminate) { @@ -718,7 +718,7 @@ RtlpWorkerThreadProc(IN PVOID Parameter) { /* FIXME - we might want to optimize this */ if (TimeoutCount++ > 2 && - (volatile LONG)ThreadPoolWorkerThreads - (volatile LONG)ThreadPoolWorkerThreadsLongRequests >= WORKERTHREAD_CREATION_THRESHOLD) + *((volatile LONG*)&ThreadPoolWorkerThreads) - *((volatile LONG*)&ThreadPoolWorkerThreadsLongRequests) >= WORKERTHREAD_CREATION_THRESHOLD) { Terminate = TRUE; } @@ -819,7 +819,7 @@ RtlQueueWorkItem(IN WORKERCALLBACKFUNC Function, /* Grow the thread pool */ Status = RtlpStartWorkerThread(RtlpIoWorkerThreadProc); - if (!NT_SUCCESS(Status) && (volatile LONG)ThreadPoolIOWorkerThreads != 0) + if (!NT_SUCCESS(Status) && *((volatile LONG*)&ThreadPoolIOWorkerThreads) != 0) { /* We failed to create the thread, but there's at least one there so we can at least queue the request */ @@ -846,7 +846,7 @@ RtlQueueWorkItem(IN WORKERCALLBACKFUNC Function, /* Grow the thread pool */ Status = RtlpStartWorkerThread(RtlpWorkerThreadProc); - if (!NT_SUCCESS(Status) && (volatile LONG)ThreadPoolWorkerThreads != 0) + if (!NT_SUCCESS(Status) && *((volatile LONG*)&ThreadPoolWorkerThreads) != 0) { /* We failed to create the thread, but there's at least one there so we can at least queue the request */ diff --git a/lib/sdk/crt/CMakeLists.txt b/lib/sdk/crt/CMakeLists.txt index 663b57292c4..7d86713a2f6 100644 --- a/lib/sdk/crt/CMakeLists.txt +++ b/lib/sdk/crt/CMakeLists.txt @@ -3,6 +3,23 @@ include_directories(include) add_definitions(-D_CRTBLD) +if(ARCH MATCHES i386) + list(APPEND CHKSTK_SOURCE except/i386/chkstk_asm.s) + if(NOT MSVC) + list(APPEND CHKSTK_SOURCE except/i386/chkstk_ms.s) + endif() +elseif(ARCH MATCHES amd64) + list(APPEND CHKSTK_SOURCE except/amd64/chkstk_asm.s) + if(NOT MSVC) + list(APPEND CHKSTK_SOURCE except/amd64/chkstk_ms.s) + endif() +elseif(ARCH MATCHES powerpc) + list(APPEND CHKSTK_SOURCE except/powerpc/chkstk_asm.s) +endif() + +add_library(chkstk ${CHKSTK_SOURCE}) +add_dependencies(chkstk asm) + include(crt.cmake) include(libcntpr.cmake) include(msvcrtex.cmake) diff --git a/lib/sdk/crt/crt.cmake b/lib/sdk/crt/crt.cmake index 29c1dd97e41..adc9f0910e3 100644 --- a/lib/sdk/crt/crt.cmake +++ b/lib/sdk/crt/crt.cmake @@ -45,6 +45,12 @@ list(APPEND CRT_SOURCE math/frexp.c math/huge_val.c math/hypot.c + math/ieee754/j0_y0.c + math/ieee754/j1_y1.c + math/ieee754/jn_yn.c + math/j0_y0.c + math/j1_y1.c + math/jn_yn.c math/ldiv.c math/logf.c math/modf.c @@ -298,7 +304,6 @@ list(APPEND CRT_SOURCE if(ARCH MATCHES i386) list(APPEND CRT_SOURCE - except/i386/chkstk_asm.s except/i386/prolog.s except/i386/seh.s except/i386/seh_prolog.s @@ -309,9 +314,12 @@ if(ARCH MATCHES i386) float/i386/logb.c float/i386/statfp.c setjmp/i386/setjmp.s) + if(MSVC) + list(APPEND CRT_SOURCE + except/i386/cpp.s) + endif() elseif(ARCH MATCHES amd64) list(APPEND CRT_SOURCE - except/amd64/chkstk_asm.s except/amd64/seh.s float/i386/clearfp.c float/i386/cntrlfp.c @@ -431,8 +439,8 @@ if(ARCH MATCHES amd64) math/amd64/tan.S) endif() -add_library(crt ${CMAKE_CURRENT_BINARY_DIR}/crt_precomp.h.gch ${CRT_SOURCE}) - +add_library(crt ${CRT_SOURCE}) +target_link_libraries(crt chkstk) set_property(TARGET crt PROPERTY COMPILE_DEFINITIONS __MINGW_IMPORT=extern USE_MSVCRT_PREFIX _MSVCRT_LIB_ _MSVCRT_ _MT) -add_pch(crt ${CMAKE_CURRENT_SOURCE_DIR}/precomp.h ${CRT_SOURCE}) +add_pch(crt precomp.h) add_dependencies(crt psdk asm) diff --git a/lib/sdk/crt/crt.rbuild b/lib/sdk/crt/crt.rbuild index eb4a65895ab..a7f49cecac4 100644 --- a/lib/sdk/crt/crt.rbuild +++ b/lib/sdk/crt/crt.rbuild @@ -144,6 +144,9 @@ frexp.c huge_val.c hypot.c + j0_y0.c + j1_y1.c + jn_yn.c ldiv.c logf.c modf.c @@ -154,6 +157,12 @@ sinh.c tanh.c powl.c + + + j0_y0.c + j1_y1.c + jn_yn.c + @@ -190,10 +199,6 @@ ldexp.c sqrtf.c - - cos.c diff --git a/lib/sdk/crt/except/amd64/chkstk_asm.s b/lib/sdk/crt/except/amd64/chkstk_asm.s index 113b45bc100..421ab55a772 100644 --- a/lib/sdk/crt/except/amd64/chkstk_asm.s +++ b/lib/sdk/crt/except/amd64/chkstk_asm.s @@ -13,22 +13,20 @@ /* CODE **********************************************************************/ .code64 -PUBLIC MsgUnimplemented MsgUnimplemented: -.asciz "WARNING: %s at %s:%d is UNIMPLEMENTED!\n" + .ascii "Unimplemented", CR, LF, NUL - -FUNC _chkstk +FUNC __chkstk .endprolog UNIMPLEMENTED chkstk ret -ENDFUNC _chkstk +ENDFUNC __chkstk -FUNC _alloca_probe +FUNC __alloca_probe .endprolog UNIMPLEMENTED alloca_probe ret -ENDFUNC _alloca_probe +ENDFUNC __alloca_probe END /* EOF */ diff --git a/lib/sdk/crt/except/amd64/chkstk_ms.s b/lib/sdk/crt/except/amd64/chkstk_ms.s index 95423d25eac..dbf9eb2e691 100644 --- a/lib/sdk/crt/except/amd64/chkstk_ms.s +++ b/lib/sdk/crt/except/amd64/chkstk_ms.s @@ -28,17 +28,17 @@ ___chkstk_ms: lea rcx, [rsp + 24] /* point past return addr */ jb l_LessThanAPage -.l_MoreThanAPage: +l_MoreThanAPage: sub rcx, PAGE_SIZE /* yes, move pointer down 4k */ - or [rcx], 0 /* probe there */ + or byte ptr [rcx], 0 /* probe there */ sub rax, PAGE_SIZE /* decrement count */ cmp rax, PAGE_SIZE ja l_MoreThanAPage /* and do it again */ -.l_LessThanAPage: +l_LessThanAPage: sub rcx, rax - or [rcx], 0 /* less than 4k, just peek here */ + or byte ptr [rcx], 0 /* less than 4k, just peek here */ pop rax //cfi_pop(%rax) diff --git a/lib/sdk/crt/except/cpp.c b/lib/sdk/crt/except/cpp.c index 158a277c9ec..92d33b5b0c4 100644 --- a/lib/sdk/crt/except/cpp.c +++ b/lib/sdk/crt/except/cpp.c @@ -710,15 +710,6 @@ __ASM_EXCEPTION_VTABLE(__non_rtti_object) #endif #endif -#ifdef _MSC_VER -#pragma message ("HAXX!") -const vtable_ptr MSVCRT_exception_vtable; -const vtable_ptr MSVCRT_bad_typeid_vtable; -const vtable_ptr MSVCRT_bad_cast_vtable; -const vtable_ptr MSVCRT___non_rtti_object_vtable; -const vtable_ptr MSVCRT_type_info_vtable; -#endif - /* Static RTTI for exported objects */ static const type_info exception_type_info = diff --git a/lib/sdk/crt/except/cppexcept.c b/lib/sdk/crt/except/cppexcept.c index 17d6715d7f9..99f6a3cfbde 100644 --- a/lib/sdk/crt/except/cppexcept.c +++ b/lib/sdk/crt/except/cppexcept.c @@ -41,24 +41,40 @@ DWORD CDECL cxx_frame_handler( PEXCEPTION_RECORD rec, cxx_exception_frame* frame EXCEPTION_REGISTRATION_RECORD* nested_frame, int nested_trylevel ); /* call a function with a given ebp */ -static inline void *call_ebp_func( void *func, void *ebp ) -{ - void *ret; - int dummy; #ifdef _MSC_VER -#pragma message ("call_ebp_func is unimplemented for MSC") +#pragma warning(disable:4731) // don't warn about modification of ebp +#endif +static inline void *call_ebp_func( void *func, void *_ebp ) +{ + void *result; +#ifdef _MSC_VER + __asm + { + mov eax, func + push ebx + push ebp + mov ebp, _ebp + call eax + pop ebp + pop ebx + mov result, eax + } #else + int dummy; __asm__ __volatile__ ("pushl %%ebx\n\t" "pushl %%ebp\n\t" "movl %4,%%ebp\n\t" "call *%%eax\n\t" "popl %%ebp\n\t" "popl %%ebx" - : "=a" (ret), "=S" (dummy), "=D" (dummy) - : "0" (func), "1" (ebp) : "ecx", "edx", "memory" ); + : "=a" (result), "=S" (dummy), "=D" (dummy) + : "0" (func), "1" (_ebp) : "ecx", "edx", "memory" ); #endif - return ret; + return result; } +#ifdef _MSC_VER +#pragma warning(default:4731) +#endif /* call a copy constructor */ static inline void call_copy_ctor( void *func, void *this, void *src, int has_vbase ) diff --git a/lib/sdk/crt/except/i386/cpp.s b/lib/sdk/crt/except/i386/cpp.s new file mode 100644 index 00000000000..a77d02aa93d --- /dev/null +++ b/lib/sdk/crt/except/i386/cpp.s @@ -0,0 +1,112 @@ + + +#include + +.code +.align 4 + +MACRO(DEFINE_THISCALL_WRAPPER, cxxname, stdcallname) +EXTERN &stdcallname:PROC +PUBLIC &cxxname +&cxxname: + pop eax + push ecx + push eax + jmp &stdcallname +ENDM + +DEFINE_THISCALL_WRAPPER ??0exception@@QAE@ABQBD@Z, _MSVCRT_exception_ctor@8 +DEFINE_THISCALL_WRAPPER ??0exception@@QAE@ABQBDH@Z, _MSVCRT_exception_ctor_noalloc@12 +DEFINE_THISCALL_WRAPPER ??0exception@@QAE@ABV0@@Z, _MSVCRT_exception_copy_ctor@8 +DEFINE_THISCALL_WRAPPER ??0exception@@QAE@XZ, _MSVCRT_exception_default_ctor@4 +DEFINE_THISCALL_WRAPPER ??1exception@@UAE@XZ, _MSVCRT_exception_dtor@4 +DEFINE_THISCALL_WRAPPER ??4exception@@QAEAAV0@ABV0@@Z, _MSVCRT_exception_opequals@8 +DEFINE_THISCALL_WRAPPER ??_Eexception@@UAEPAXI@Z, _MSVCRT_exception_vector_dtor@8 +DEFINE_THISCALL_WRAPPER ??_Gexception@@UAEPAXI@Z, _MSVCRT_exception_scalar_dtor@8 +DEFINE_THISCALL_WRAPPER ?what@exception@@UBEPBDXZ, _MSVCRT_what_exception@4 +DEFINE_THISCALL_WRAPPER ??0bad_typeid@@QAE@ABV0@@Z, _MSVCRT_bad_typeid_copy_ctor@8 +DEFINE_THISCALL_WRAPPER ??0bad_typeid@@QAE@PBD@Z, _MSVCRT_bad_typeid_ctor@8 +DEFINE_THISCALL_WRAPPER ??_Fbad_typeid@@QAEXXZ, _MSVCRT_bad_typeid_default_ctor@4 +DEFINE_THISCALL_WRAPPER ??1bad_typeid@@UAE@XZ, _MSVCRT_bad_typeid_dtor@4 +DEFINE_THISCALL_WRAPPER ??4bad_typeid@@QAEAAV0@ABV0@@Z, _MSVCRT_bad_typeid_opequals@8 +DEFINE_THISCALL_WRAPPER ??_Ebad_typeid@@UAEPAXI@Z, _MSVCRT_bad_typeid_vector_dtor@8 +DEFINE_THISCALL_WRAPPER ??_Gbad_typeid@@UAEPAXI@Z, _MSVCRT_bad_typeid_scalar_dtor@8 +DEFINE_THISCALL_WRAPPER ??0__non_rtti_object@@QAE@ABV0@@Z, _MSVCRT___non_rtti_object_copy_ctor@8 +DEFINE_THISCALL_WRAPPER ??0__non_rtti_object@@QAE@PBD@Z, _MSVCRT___non_rtti_object_ctor@8 +DEFINE_THISCALL_WRAPPER ??1__non_rtti_object@@UAE@XZ, _MSVCRT___non_rtti_object_dtor@4 +DEFINE_THISCALL_WRAPPER ??4__non_rtti_object@@QAEAAV0@ABV0@@Z, _MSVCRT___non_rtti_object_opequals@8 +DEFINE_THISCALL_WRAPPER ??_E__non_rtti_object@@UAEPAXI@Z, _MSVCRT___non_rtti_object_vector_dtor@8 +DEFINE_THISCALL_WRAPPER ??_G__non_rtti_object@@UAEPAXI@Z, _MSVCRT___non_rtti_object_scalar_dtor@8 +DEFINE_THISCALL_WRAPPER ??0bad_cast@@AAE@PBQBD@Z, _MSVCRT_bad_cast_ctor@8 +DEFINE_THISCALL_WRAPPER ??0bad_cast@@QAE@ABQBD@Z, _MSVCRT_bad_cast_ctor@8 +DEFINE_THISCALL_WRAPPER ??0bad_cast@@QAE@ABV0@@Z, _MSVCRT_bad_cast_copy_ctor@8 +DEFINE_THISCALL_WRAPPER ??0bad_cast@@QAE@PBD@Z, _MSVCRT_bad_cast_ctor_charptr@8 +DEFINE_THISCALL_WRAPPER ??_Fbad_cast@@QAEXXZ, _MSVCRT_bad_cast_default_ctor@4 +DEFINE_THISCALL_WRAPPER ??1bad_cast@@UAE@XZ, _MSVCRT_bad_cast_dtor@4 +DEFINE_THISCALL_WRAPPER ??4bad_cast@@QAEAAV0@ABV0@@Z, _MSVCRT_bad_cast_opequals@8 +DEFINE_THISCALL_WRAPPER ??_Ebad_cast@@UAEPAXI@Z, _MSVCRT_bad_cast_vector_dtor@8 +DEFINE_THISCALL_WRAPPER ??_Gbad_cast@@UAEPAXI@Z, _MSVCRT_bad_cast_scalar_dtor@8 +DEFINE_THISCALL_WRAPPER ??8type_info@@QBEHABV0@@Z, _MSVCRT_type_info_opequals_equals@8 +DEFINE_THISCALL_WRAPPER ??9type_info@@QBEHABV0@@Z, _MSVCRT_type_info_opnot_equals@8 +DEFINE_THISCALL_WRAPPER ?before@type_info@@QBEHABV1@@Z, _MSVCRT_type_info_before@8 +DEFINE_THISCALL_WRAPPER ??1type_info@@UAE@XZ, _MSVCRT_type_info_dtor@4 +DEFINE_THISCALL_WRAPPER ?name@type_info@@QBEPBDXZ, _MSVCRT_type_info_name@4 +DEFINE_THISCALL_WRAPPER ?raw_name@type_info@@QBEPBDXZ, _MSVCRT_type_info_raw_name@4 + + +#undef _MSVCRT_ +MACRO(START_VTABLE, shortname, cxxname) +EXTERN _&shortname&_rtti:PROC +EXTERN ___thiscall_MSVCRT_&shortname&_vector_dtor:PROC + .long _&shortname&_rtti +PUBLIC _MSVCRT_&shortname&_vtable +_MSVCRT_&shortname&_vtable: +PUBLIC &cxxname +&cxxname: + .long ___thiscall_MSVCRT_&shortname&_vector_dtor +ENDM + +MACRO(DEFINE_EXCEPTION_VTABLE, shortname, cxxname) + START_VTABLE shortname, cxxname + EXTERN ___thiscall_MSVCRT_what_exception:PROC + .long ___thiscall_MSVCRT_what_exception +ENDM + +START_VTABLE type_info, __dummyname_type_info +DEFINE_EXCEPTION_VTABLE exception, ??_7exception@@6B@ +DEFINE_EXCEPTION_VTABLE bad_typeid, ??_7bad_typeid@@6B@ +DEFINE_EXCEPTION_VTABLE bad_cast, ??_7bad_cast@@6B@ +DEFINE_EXCEPTION_VTABLE __non_rtti_object, ??_7__non_rtti_object@@6B@ + +EXTERN _MSVCRT_operator_delete:PROC +PUBLIC ??3@YAXPAX@Z +??3@YAXPAX@Z: + jmp _MSVCRT_operator_delete + +EXTERN _MSVCRT_operator_new:PROC +PUBLIC ??_U@YAPAXI@Z +??_U@YAPAXI@Z: + jmp _MSVCRT_operator_new + + +MACRO(DEFINE_ALIAS, alias, orig, type) +EXTERN &orig:&type +ALIAS <&alias> = <&orig> +ENDM + +DEFINE_ALIAS ??_V@YAXPAX@Z, _MSVCRT_operator_delete, PROC +DEFINE_ALIAS ??2@YAPAXI@Z, _MSVCRT_operator_new, PROC +DEFINE_ALIAS ?_query_new_handler@@YAP6AHI@ZXZ, _MSVCRT__query_new_handler, PROC +DEFINE_ALIAS ?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z, _MSVCRT__set_new_handler, PROC +DEFINE_ALIAS ?set_new_handler@@YAP6AXXZP6AXXZ@Z, _MSVCRT_set_new_handler, PROC +DEFINE_ALIAS ?_query_new_mode@@YAHXZ, _MSVCRT__query_new_mode, PROC +DEFINE_ALIAS ?_set_new_mode@@YAHH@Z, _MSVCRT__set_new_mode, PROC +DEFINE_ALIAS ?_set_se_translator@@YAP6AXIPAU_EXCEPTION_POINTERS@@@ZP6AXI0@Z@Z, _MSVCRT__set_se_translator, PROC +DEFINE_ALIAS ?set_terminate@@YAP6AXXZP6AXXZ@Z, _MSVCRT_set_terminate, PROC +DEFINE_ALIAS ?set_unexpected@@YAP6AXXZP6AXXZ@Z, _MSVCRT_set_unexpected, PROC +DEFINE_ALIAS ?terminate@@YAXXZ, _MSVCRT_terminate, PROC +DEFINE_ALIAS ?unexpected@@YAXXZ, _MSVCRT_unexpected, PROC + + +END + diff --git a/lib/sdk/crt/libcntpr.cmake b/lib/sdk/crt/libcntpr.cmake index 8065d454934..011b9c3e3d5 100644 --- a/lib/sdk/crt/libcntpr.cmake +++ b/lib/sdk/crt/libcntpr.cmake @@ -93,6 +93,9 @@ if(ARCH MATCHES i386) math/i386/tan_asm.s math/i386/ci.c misc/i386/readcr4.S) + if(NOT MSVC) + list(APPEND LIBCNTPR_SOURCE except/i386/chkstk_ms.s) + endif() elseif(ARCH MATCHES amd64) list(APPEND LIBCNTPR_SOURCE except/amd64/chkstk_asm.s diff --git a/lib/sdk/crt/math/amd64/fabs.S b/lib/sdk/crt/math/amd64/fabs.S index 84452dc1942..0900acceed9 100644 --- a/lib/sdk/crt/math/amd64/fabs.S +++ b/lib/sdk/crt/math/amd64/fabs.S @@ -18,4 +18,8 @@ _fabs: UNIMPLEMENTED fabs ret +#ifdef _USE_ML +ALIAS = <_fabs> +#endif + END diff --git a/lib/sdk/crt/math/ieee754/ieee754.h b/lib/sdk/crt/math/ieee754/ieee754.h new file mode 100644 index 00000000000..888ca20298b --- /dev/null +++ b/lib/sdk/crt/math/ieee754/ieee754.h @@ -0,0 +1,54 @@ +#pragma once + +typedef __int32 int32_t; +typedef unsigned __int32 u_int32_t; + +typedef union +{ + double value; + struct + { + u_int32_t lsw; + u_int32_t msw; + } parts; +} ieee_double_shape_type; + +#define EXTRACT_WORDS(ix0,ix1,d) \ +do { \ + ieee_double_shape_type ew_u; \ + ew_u.value = (d); \ + (ix0) = ew_u.parts.msw; \ + (ix1) = ew_u.parts.lsw; \ +} while (0) + +/* Get the more significant 32 bit int from a double. */ + +#define GET_HIGH_WORD(i,d) \ +do { \ + ieee_double_shape_type gh_u; \ + gh_u.value = (d); \ + (i) = gh_u.parts.msw; \ +} while (0) + +#define GET_LOW_WORD(i,d) \ +do { \ + ieee_double_shape_type gl_u; \ + gl_u.value = (d); \ + (i) = gl_u.parts.lsw; \ +} while (0) + +static __inline double __ieee754_sqrt(double x) {return sqrt(x);} +static __inline double __ieee754_log(double x) {return log(x);} +static __inline double __cos(double x) {return cos(x);} +static __inline void __sincos(double x, double *s, double *c) +{ + *s = sin(x); + *c = cos(x); +} + +double __ieee754_j0(double); +double __ieee754_j1(double); +double __ieee754_jn(int, double); +double __ieee754_y0(double); +double __ieee754_y1(double); +double __ieee754_yn(int, double); diff --git a/lib/sdk/crt/math/ieee754/j0_y0.c b/lib/sdk/crt/math/ieee754/j0_y0.c new file mode 100644 index 00000000000..e24f85637a7 --- /dev/null +++ b/lib/sdk/crt/math/ieee754/j0_y0.c @@ -0,0 +1,529 @@ +/* @(#)e_j0.c 5.1 93/09/24 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ +/* Modified by Naohiko Shimizu/Tokai University, Japan 1997/08/26, + for performance improvement on pipelined processors. +*/ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: e_j0.c,v 1.8 1995/05/10 20:45:23 jtc Exp $"; +#endif + +/* __ieee754_j0(x), __ieee754_y0(x) + * Bessel function of the first and second kinds of order zero. + * Method -- j0(x): + * 1. For tiny x, we use j0(x) = 1 - x^2/4 + x^4/64 - ... + * 2. Reduce x to |x| since j0(x)=j0(-x), and + * for x in (0,2) + * j0(x) = 1-z/4+ z^2*R0/S0, where z = x*x; + * (precision: |j0-1+z/4-z^2R0/S0 |<2**-63.67 ) + * for x in (2,inf) + * j0(x) = sqrt(2/(pi*x))*(p0(x)*cos(x0)-q0(x)*sin(x0)) + * where x0 = x-pi/4. It is better to compute sin(x0),cos(x0) + * as follow: + * cos(x0) = cos(x)cos(pi/4)+sin(x)sin(pi/4) + * = 1/sqrt(2) * (cos(x) + sin(x)) + * sin(x0) = sin(x)cos(pi/4)-cos(x)sin(pi/4) + * = 1/sqrt(2) * (sin(x) - cos(x)) + * (To avoid cancellation, use + * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x)) + * to compute the worse one.) + * + * 3 Special cases + * j0(nan)= nan + * j0(0) = 1 + * j0(inf) = 0 + * + * Method -- y0(x): + * 1. For x<2. + * Since + * y0(x) = 2/pi*(j0(x)*(ln(x/2)+Euler) + x^2/4 - ...) + * therefore y0(x)-2/pi*j0(x)*ln(x) is an even function. + * We use the following function to approximate y0, + * y0(x) = U(z)/V(z) + (2/pi)*(j0(x)*ln(x)), z= x^2 + * where + * U(z) = u00 + u01*z + ... + u06*z^6 + * V(z) = 1 + v01*z + ... + v04*z^4 + * with absolute approximation error bounded by 2**-72. + * Note: For tiny x, U/V = u0 and j0(x)~1, hence + * y0(tiny) = u0 + (2/pi)*ln(tiny), (choose tiny<2**-27) + * 2. For x>=2. + * y0(x) = sqrt(2/(pi*x))*(p0(x)*cos(x0)+q0(x)*sin(x0)) + * where x0 = x-pi/4. It is better to compute sin(x0),cos(x0) + * by the method mentioned above. + * 3. Special cases: y0(0)=-inf, y0(x<0)=NaN, y0(inf)=0. + */ + +#include "math.h" +#include "ieee754.h" + +#ifdef __STDC__ +static double pzero(double), qzero(double); +#else +static double pzero(), qzero(); +#endif + +#ifdef __STDC__ +static const double +#else +static double +#endif +huge = 1e300, +one = 1.0, +invsqrtpi= 5.64189583547756279280e-01, /* 0x3FE20DD7, 0x50429B6D */ +tpi = 6.36619772367581382433e-01, /* 0x3FE45F30, 0x6DC9C883 */ + /* R0/S0 on [0, 2.00] */ +R[] = {0.0, 0.0, 1.56249999999999947958e-02, /* 0x3F8FFFFF, 0xFFFFFFFD */ + -1.89979294238854721751e-04, /* 0xBF28E6A5, 0xB61AC6E9 */ + 1.82954049532700665670e-06, /* 0x3EBEB1D1, 0x0C503919 */ + -4.61832688532103189199e-09}, /* 0xBE33D5E7, 0x73D63FCE */ +S[] = {0.0, 1.56191029464890010492e-02, /* 0x3F8FFCE8, 0x82C8C2A4 */ + 1.16926784663337450260e-04, /* 0x3F1EA6D2, 0xDD57DBF4 */ + 5.13546550207318111446e-07, /* 0x3EA13B54, 0xCE84D5A9 */ + 1.16614003333790000205e-09}; /* 0x3E1408BC, 0xF4745D8F */ + +#ifdef __STDC__ +static const double zero = 0.0; +#else +static double zero = 0.0; +#endif + +#ifdef __STDC__ + double __ieee754_j0(double x) +#else + double __ieee754_j0(x) + double x; +#endif +{ + double z, s,c,ss,cc,r,u,v,r1,r2,s1,s2,z2,z4; + int32_t hx,ix; + + GET_HIGH_WORD(hx,x); + ix = hx&0x7fffffff; + if(ix>=0x7ff00000) return one/(x*x); + x = fabs(x); + if(ix >= 0x40000000) { /* |x| >= 2.0 */ + __sincos (x, &s, &c); + ss = s-c; + cc = s+c; + if(ix<0x7fe00000) { /* make sure x+x not overflow */ + z = -__cos(x+x); + if ((s*c)0x48000000) z = (invsqrtpi*cc)/__ieee754_sqrt(x); + else { + u = pzero(x); v = qzero(x); + z = invsqrtpi*(u*cc-v*ss)/__ieee754_sqrt(x); + } + return z; + } + if(ix<0x3f200000) { /* |x| < 2**-13 */ + if(huge+x>one) { /* raise inexact if x != 0 */ + if(ix<0x3e400000) return one; /* |x|<2**-27 */ + else return one - 0.25*x*x; + } + } + z = x*x; +#ifdef DO_NOT_USE_THIS + r = z*(R02+z*(R03+z*(R04+z*R05))); + s = one+z*(S01+z*(S02+z*(S03+z*S04))); +#else + r1 = z*R[2]; z2=z*z; + r2 = R[3]+z*R[4]; z4=z2*z2; + r = r1 + z2*r2 + z4*R[5]; + s1 = one+z*S[1]; + s2 = S[2]+z*S[3]; + s = s1 + z2*s2 + z4*S[4]; +#endif + if(ix < 0x3FF00000) { /* |x| < 1.00 */ + return one + z*(-0.25+(r/s)); + } else { + u = 0.5*x; + return((one+u)*(one-u)+z*(r/s)); + } +} + +#ifdef __STDC__ +static const double +#else +static double +#endif +U[] = {-7.38042951086872317523e-02, /* 0xBFB2E4D6, 0x99CBD01F */ + 1.76666452509181115538e-01, /* 0x3FC69D01, 0x9DE9E3FC */ + -1.38185671945596898896e-02, /* 0xBF8C4CE8, 0xB16CFA97 */ + 3.47453432093683650238e-04, /* 0x3F36C54D, 0x20B29B6B */ + -3.81407053724364161125e-06, /* 0xBECFFEA7, 0x73D25CAD */ + 1.95590137035022920206e-08, /* 0x3E550057, 0x3B4EABD4 */ + -3.98205194132103398453e-11}, /* 0xBDC5E43D, 0x693FB3C8 */ +V[] = {1.27304834834123699328e-02, /* 0x3F8A1270, 0x91C9C71A */ + 7.60068627350353253702e-05, /* 0x3F13ECBB, 0xF578C6C1 */ + 2.59150851840457805467e-07, /* 0x3E91642D, 0x7FF202FD */ + 4.41110311332675467403e-10}; /* 0x3DFE5018, 0x3BD6D9EF */ + +#ifdef __STDC__ + double __ieee754_y0(double x) +#else + double __ieee754_y0(x) + double x; +#endif +{ + double z, s,c,ss,cc,u,v,z2,z4,z6,u1,u2,u3,v1,v2; + int32_t hx,ix,lx; + + EXTRACT_WORDS(hx,lx,x); + ix = 0x7fffffff&hx; + /* Y0(NaN) is NaN, y0(-inf) is Nan, y0(inf) is 0, y0(0) is -inf. */ + if(ix>=0x7ff00000) return one/(x+x*x); + if((ix|lx)==0) return -HUGE_VAL+x; /* -inf and overflow exception. */ + if(hx<0) return zero/(zero*x); + if(ix >= 0x40000000) { /* |x| >= 2.0 */ + /* y0(x) = sqrt(2/(pi*x))*(p0(x)*sin(x0)+q0(x)*cos(x0)) + * where x0 = x-pi/4 + * Better formula: + * cos(x0) = cos(x)cos(pi/4)+sin(x)sin(pi/4) + * = 1/sqrt(2) * (sin(x) + cos(x)) + * sin(x0) = sin(x)cos(3pi/4)-cos(x)sin(3pi/4) + * = 1/sqrt(2) * (sin(x) - cos(x)) + * To avoid cancellation, use + * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x)) + * to compute the worse one. + */ + __sincos (x, &s, &c); + ss = s-c; + cc = s+c; + /* + * j0(x) = 1/sqrt(pi) * (P(0,x)*cc - Q(0,x)*ss) / sqrt(x) + * y0(x) = 1/sqrt(pi) * (P(0,x)*ss + Q(0,x)*cc) / sqrt(x) + */ + if(ix<0x7fe00000) { /* make sure x+x not overflow */ + z = -__cos(x+x); + if ((s*c)0x48000000) z = (invsqrtpi*ss)/__ieee754_sqrt(x); + else { + u = pzero(x); v = qzero(x); + z = invsqrtpi*(u*ss+v*cc)/__ieee754_sqrt(x); + } + return z; + } + if(ix<=0x3e400000) { /* x < 2**-27 */ + return(U[0] + tpi*__ieee754_log(x)); + } + z = x*x; +#ifdef DO_NOT_USE_THIS + u = u00+z*(u01+z*(u02+z*(u03+z*(u04+z*(u05+z*u06))))); + v = one+z*(v01+z*(v02+z*(v03+z*v04))); +#else + u1 = U[0]+z*U[1]; z2=z*z; + u2 = U[2]+z*U[3]; z4=z2*z2; + u3 = U[4]+z*U[5]; z6=z4*z2; + u = u1 + z2*u2 + z4*u3 + z6*U[6]; + v1 = one+z*V[0]; + v2 = V[1]+z*V[2]; + v = v1 + z2*v2 + z4*V[3]; +#endif + return(u/v + tpi*(__ieee754_j0(x)*__ieee754_log(x))); +} + +/* The asymptotic expansions of pzero is + * 1 - 9/128 s^2 + 11025/98304 s^4 - ..., where s = 1/x. + * For x >= 2, We approximate pzero by + * pzero(x) = 1 + (R/S) + * where R = pR0 + pR1*s^2 + pR2*s^4 + ... + pR5*s^10 + * S = 1 + pS0*s^2 + ... + pS4*s^10 + * and + * | pzero(x)-1-R/S | <= 2 ** ( -60.26) + */ +#ifdef __STDC__ +static const double pR8[6] = { /* for x in [inf, 8]=1/[0,0.125] */ +#else +static double pR8[6] = { /* for x in [inf, 8]=1/[0,0.125] */ +#endif + 0.00000000000000000000e+00, /* 0x00000000, 0x00000000 */ + -7.03124999999900357484e-02, /* 0xBFB1FFFF, 0xFFFFFD32 */ + -8.08167041275349795626e+00, /* 0xC02029D0, 0xB44FA779 */ + -2.57063105679704847262e+02, /* 0xC0701102, 0x7B19E863 */ + -2.48521641009428822144e+03, /* 0xC0A36A6E, 0xCD4DCAFC */ + -5.25304380490729545272e+03, /* 0xC0B4850B, 0x36CC643D */ +}; +#ifdef __STDC__ +static const double pS8[5] = { +#else +static double pS8[5] = { +#endif + 1.16534364619668181717e+02, /* 0x405D2233, 0x07A96751 */ + 3.83374475364121826715e+03, /* 0x40ADF37D, 0x50596938 */ + 4.05978572648472545552e+04, /* 0x40E3D2BB, 0x6EB6B05F */ + 1.16752972564375915681e+05, /* 0x40FC810F, 0x8F9FA9BD */ + 4.76277284146730962675e+04, /* 0x40E74177, 0x4F2C49DC */ +}; + +#ifdef __STDC__ +static const double pR5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */ +#else +static double pR5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */ +#endif + -1.14125464691894502584e-11, /* 0xBDA918B1, 0x47E495CC */ + -7.03124940873599280078e-02, /* 0xBFB1FFFF, 0xE69AFBC6 */ + -4.15961064470587782438e+00, /* 0xC010A370, 0xF90C6BBF */ + -6.76747652265167261021e+01, /* 0xC050EB2F, 0x5A7D1783 */ + -3.31231299649172967747e+02, /* 0xC074B3B3, 0x6742CC63 */ + -3.46433388365604912451e+02, /* 0xC075A6EF, 0x28A38BD7 */ +}; +#ifdef __STDC__ +static const double pS5[5] = { +#else +static double pS5[5] = { +#endif + 6.07539382692300335975e+01, /* 0x404E6081, 0x0C98C5DE */ + 1.05125230595704579173e+03, /* 0x40906D02, 0x5C7E2864 */ + 5.97897094333855784498e+03, /* 0x40B75AF8, 0x8FBE1D60 */ + 9.62544514357774460223e+03, /* 0x40C2CCB8, 0xFA76FA38 */ + 2.40605815922939109441e+03, /* 0x40A2CC1D, 0xC70BE864 */ +}; + +#ifdef __STDC__ +static const double pR3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */ +#else +static double pR3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */ +#endif + -2.54704601771951915620e-09, /* 0xBE25E103, 0x6FE1AA86 */ + -7.03119616381481654654e-02, /* 0xBFB1FFF6, 0xF7C0E24B */ + -2.40903221549529611423e+00, /* 0xC00345B2, 0xAEA48074 */ + -2.19659774734883086467e+01, /* 0xC035F74A, 0x4CB94E14 */ + -5.80791704701737572236e+01, /* 0xC04D0A22, 0x420A1A45 */ + -3.14479470594888503854e+01, /* 0xC03F72AC, 0xA892D80F */ +}; +#ifdef __STDC__ +static const double pS3[5] = { +#else +static double pS3[5] = { +#endif + 3.58560338055209726349e+01, /* 0x4041ED92, 0x84077DD3 */ + 3.61513983050303863820e+02, /* 0x40769839, 0x464A7C0E */ + 1.19360783792111533330e+03, /* 0x4092A66E, 0x6D1061D6 */ + 1.12799679856907414432e+03, /* 0x40919FFC, 0xB8C39B7E */ + 1.73580930813335754692e+02, /* 0x4065B296, 0xFC379081 */ +}; + +#ifdef __STDC__ +static const double pR2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */ +#else +static double pR2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */ +#endif + -8.87534333032526411254e-08, /* 0xBE77D316, 0xE927026D */ + -7.03030995483624743247e-02, /* 0xBFB1FF62, 0x495E1E42 */ + -1.45073846780952986357e+00, /* 0xBFF73639, 0x8A24A843 */ + -7.63569613823527770791e+00, /* 0xC01E8AF3, 0xEDAFA7F3 */ + -1.11931668860356747786e+01, /* 0xC02662E6, 0xC5246303 */ + -3.23364579351335335033e+00, /* 0xC009DE81, 0xAF8FE70F */ +}; +#ifdef __STDC__ +static const double pS2[5] = { +#else +static double pS2[5] = { +#endif + 2.22202997532088808441e+01, /* 0x40363865, 0x908B5959 */ + 1.36206794218215208048e+02, /* 0x4061069E, 0x0EE8878F */ + 2.70470278658083486789e+02, /* 0x4070E786, 0x42EA079B */ + 1.53875394208320329881e+02, /* 0x40633C03, 0x3AB6FAFF */ + 1.46576176948256193810e+01, /* 0x402D50B3, 0x44391809 */ +}; + +#ifdef __STDC__ + static double pzero(double x) +#else + static double pzero(x) + double x; +#endif +{ +#ifdef __STDC__ + const double *p = 0,*q = 0; +#else + double *p = 0,*q = 0; +#endif + double z,r,s,z2,z4,r1,r2,r3,s1,s2,s3; + int32_t ix; + GET_HIGH_WORD(ix,x); + ix &= 0x7fffffff; + if(ix>=0x40200000) {p = pR8; q= pS8;} + else if(ix>=0x40122E8B){p = pR5; q= pS5;} + else if(ix>=0x4006DB6D){p = pR3; q= pS3;} + else if(ix>=0x40000000){p = pR2; q= pS2;} + z = one/(x*x); +#ifdef DO_NOT_USE_THIS + r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5])))); + s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*q[4])))); +#else + r1 = p[0]+z*p[1]; z2=z*z; + r2 = p[2]+z*p[3]; z4=z2*z2; + r3 = p[4]+z*p[5]; + r = r1 + z2*r2 + z4*r3; + s1 = one+z*q[0]; + s2 = q[1]+z*q[2]; + s3 = q[3]+z*q[4]; + s = s1 + z2*s2 + z4*s3; +#endif + return one+ r/s; +} + + +/* For x >= 8, the asymptotic expansions of qzero is + * -1/8 s + 75/1024 s^3 - ..., where s = 1/x. + * We approximate pzero by + * qzero(x) = s*(-1.25 + (R/S)) + * where R = qR0 + qR1*s^2 + qR2*s^4 + ... + qR5*s^10 + * S = 1 + qS0*s^2 + ... + qS5*s^12 + * and + * | qzero(x)/s +1.25-R/S | <= 2 ** ( -61.22) + */ +#ifdef __STDC__ +static const double qR8[6] = { /* for x in [inf, 8]=1/[0,0.125] */ +#else +static double qR8[6] = { /* for x in [inf, 8]=1/[0,0.125] */ +#endif + 0.00000000000000000000e+00, /* 0x00000000, 0x00000000 */ + 7.32421874999935051953e-02, /* 0x3FB2BFFF, 0xFFFFFE2C */ + 1.17682064682252693899e+01, /* 0x40278952, 0x5BB334D6 */ + 5.57673380256401856059e+02, /* 0x40816D63, 0x15301825 */ + 8.85919720756468632317e+03, /* 0x40C14D99, 0x3E18F46D */ + 3.70146267776887834771e+04, /* 0x40E212D4, 0x0E901566 */ +}; +#ifdef __STDC__ +static const double qS8[6] = { +#else +static double qS8[6] = { +#endif + 1.63776026895689824414e+02, /* 0x406478D5, 0x365B39BC */ + 8.09834494656449805916e+03, /* 0x40BFA258, 0x4E6B0563 */ + 1.42538291419120476348e+05, /* 0x41016652, 0x54D38C3F */ + 8.03309257119514397345e+05, /* 0x412883DA, 0x83A52B43 */ + 8.40501579819060512818e+05, /* 0x4129A66B, 0x28DE0B3D */ + -3.43899293537866615225e+05, /* 0xC114FD6D, 0x2C9530C5 */ +}; + +#ifdef __STDC__ +static const double qR5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */ +#else +static double qR5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */ +#endif + 1.84085963594515531381e-11, /* 0x3DB43D8F, 0x29CC8CD9 */ + 7.32421766612684765896e-02, /* 0x3FB2BFFF, 0xD172B04C */ + 5.83563508962056953777e+00, /* 0x401757B0, 0xB9953DD3 */ + 1.35111577286449829671e+02, /* 0x4060E392, 0x0A8788E9 */ + 1.02724376596164097464e+03, /* 0x40900CF9, 0x9DC8C481 */ + 1.98997785864605384631e+03, /* 0x409F17E9, 0x53C6E3A6 */ +}; +#ifdef __STDC__ +static const double qS5[6] = { +#else +static double qS5[6] = { +#endif + 8.27766102236537761883e+01, /* 0x4054B1B3, 0xFB5E1543 */ + 2.07781416421392987104e+03, /* 0x40A03BA0, 0xDA21C0CE */ + 1.88472887785718085070e+04, /* 0x40D267D2, 0x7B591E6D */ + 5.67511122894947329769e+04, /* 0x40EBB5E3, 0x97E02372 */ + 3.59767538425114471465e+04, /* 0x40E19118, 0x1F7A54A0 */ + -5.35434275601944773371e+03, /* 0xC0B4EA57, 0xBEDBC609 */ +}; + +#ifdef __STDC__ +static const double qR3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */ +#else +static double qR3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */ +#endif + 4.37741014089738620906e-09, /* 0x3E32CD03, 0x6ADECB82 */ + 7.32411180042911447163e-02, /* 0x3FB2BFEE, 0x0E8D0842 */ + 3.34423137516170720929e+00, /* 0x400AC0FC, 0x61149CF5 */ + 4.26218440745412650017e+01, /* 0x40454F98, 0x962DAEDD */ + 1.70808091340565596283e+02, /* 0x406559DB, 0xE25EFD1F */ + 1.66733948696651168575e+02, /* 0x4064D77C, 0x81FA21E0 */ +}; +#ifdef __STDC__ +static const double qS3[6] = { +#else +static double qS3[6] = { +#endif + 4.87588729724587182091e+01, /* 0x40486122, 0xBFE343A6 */ + 7.09689221056606015736e+02, /* 0x40862D83, 0x86544EB3 */ + 3.70414822620111362994e+03, /* 0x40ACF04B, 0xE44DFC63 */ + 6.46042516752568917582e+03, /* 0x40B93C6C, 0xD7C76A28 */ + 2.51633368920368957333e+03, /* 0x40A3A8AA, 0xD94FB1C0 */ + -1.49247451836156386662e+02, /* 0xC062A7EB, 0x201CF40F */ +}; + +#ifdef __STDC__ +static const double qR2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */ +#else +static double qR2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */ +#endif + 1.50444444886983272379e-07, /* 0x3E84313B, 0x54F76BDB */ + 7.32234265963079278272e-02, /* 0x3FB2BEC5, 0x3E883E34 */ + 1.99819174093815998816e+00, /* 0x3FFFF897, 0xE727779C */ + 1.44956029347885735348e+01, /* 0x402CFDBF, 0xAAF96FE5 */ + 3.16662317504781540833e+01, /* 0x403FAA8E, 0x29FBDC4A */ + 1.62527075710929267416e+01, /* 0x403040B1, 0x71814BB4 */ +}; +#ifdef __STDC__ +static const double qS2[6] = { +#else +static double qS2[6] = { +#endif + 3.03655848355219184498e+01, /* 0x403E5D96, 0xF7C07AED */ + 2.69348118608049844624e+02, /* 0x4070D591, 0xE4D14B40 */ + 8.44783757595320139444e+02, /* 0x408A6645, 0x22B3BF22 */ + 8.82935845112488550512e+02, /* 0x408B977C, 0x9C5CC214 */ + 2.12666388511798828631e+02, /* 0x406A9553, 0x0E001365 */ + -5.31095493882666946917e+00, /* 0xC0153E6A, 0xF8B32931 */ +}; + +#ifdef __STDC__ + static double qzero(double x) +#else + static double qzero(x) + double x; +#endif +{ +#ifdef __STDC__ + const double *p = 0,*q = 0; +#else + double *p = 0,*q = 0; +#endif + double s,r,z,z2,z4,z6,r1,r2,r3,s1,s2,s3; + int32_t ix; + GET_HIGH_WORD(ix,x); + ix &= 0x7fffffff; + if(ix>=0x40200000) {p = qR8; q= qS8;} + else if(ix>=0x40122E8B){p = qR5; q= qS5;} + else if(ix>=0x4006DB6D){p = qR3; q= qS3;} + else if(ix>=0x40000000){p = qR2; q= qS2;} + z = one/(x*x); +#ifdef DO_NOT_USE_THIS + r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5])))); + s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*(q[4]+z*q[5]))))); +#else + r1 = p[0]+z*p[1]; z2=z*z; + r2 = p[2]+z*p[3]; z4=z2*z2; + r3 = p[4]+z*p[5]; z6=z4*z2; + r= r1 + z2*r2 + z4*r3; + s1 = one+z*q[0]; + s2 = q[1]+z*q[2]; + s3 = q[3]+z*q[4]; + s = s1 + z2*s2 + z4*s3 +z6*q[5]; +#endif + return (-.125 + r/s)/x; +} diff --git a/lib/sdk/crt/math/ieee754/j1_y1.c b/lib/sdk/crt/math/ieee754/j1_y1.c new file mode 100644 index 00000000000..18c7e6df9b9 --- /dev/null +++ b/lib/sdk/crt/math/ieee754/j1_y1.c @@ -0,0 +1,530 @@ +/* @(#)e_j1.c 5.1 93/09/24 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ +/* Modified by Naohiko Shimizu/Tokai University, Japan 1997/08/26, + for performance improvement on pipelined processors. +*/ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: e_j1.c,v 1.8 1995/05/10 20:45:27 jtc Exp $"; +#endif + +/* __ieee754_j1(x), __ieee754_y1(x) + * Bessel function of the first and second kinds of order zero. + * Method -- j1(x): + * 1. For tiny x, we use j1(x) = x/2 - x^3/16 + x^5/384 - ... + * 2. Reduce x to |x| since j1(x)=-j1(-x), and + * for x in (0,2) + * j1(x) = x/2 + x*z*R0/S0, where z = x*x; + * (precision: |j1/x - 1/2 - R0/S0 |<2**-61.51 ) + * for x in (2,inf) + * j1(x) = sqrt(2/(pi*x))*(p1(x)*cos(x1)-q1(x)*sin(x1)) + * y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x1)+q1(x)*cos(x1)) + * where x1 = x-3*pi/4. It is better to compute sin(x1),cos(x1) + * as follow: + * cos(x1) = cos(x)cos(3pi/4)+sin(x)sin(3pi/4) + * = 1/sqrt(2) * (sin(x) - cos(x)) + * sin(x1) = sin(x)cos(3pi/4)-cos(x)sin(3pi/4) + * = -1/sqrt(2) * (sin(x) + cos(x)) + * (To avoid cancellation, use + * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x)) + * to compute the worse one.) + * + * 3 Special cases + * j1(nan)= nan + * j1(0) = 0 + * j1(inf) = 0 + * + * Method -- y1(x): + * 1. screen out x<=0 cases: y1(0)=-inf, y1(x<0)=NaN + * 2. For x<2. + * Since + * y1(x) = 2/pi*(j1(x)*(ln(x/2)+Euler)-1/x-x/2+5/64*x^3-...) + * therefore y1(x)-2/pi*j1(x)*ln(x)-1/x is an odd function. + * We use the following function to approximate y1, + * y1(x) = x*U(z)/V(z) + (2/pi)*(j1(x)*ln(x)-1/x), z= x^2 + * where for x in [0,2] (abs err less than 2**-65.89) + * U(z) = U0[0] + U0[1]*z + ... + U0[4]*z^4 + * V(z) = 1 + v0[0]*z + ... + v0[4]*z^5 + * Note: For tiny x, 1/x dominate y1 and hence + * y1(tiny) = -2/pi/tiny, (choose tiny<2**-54) + * 3. For x>=2. + * y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x1)+q1(x)*cos(x1)) + * where x1 = x-3*pi/4. It is better to compute sin(x1),cos(x1) + * by method mentioned above. + */ + +#include "math.h" +#include "ieee754.h" + +#ifdef __STDC__ +static double pone(double), qone(double); +#else +static double pone(), qone(); +#endif + +#ifdef __STDC__ +static const double +#else +static double +#endif +huge = 1e300, +one = 1.0, +invsqrtpi= 5.64189583547756279280e-01, /* 0x3FE20DD7, 0x50429B6D */ +tpi = 6.36619772367581382433e-01, /* 0x3FE45F30, 0x6DC9C883 */ + /* R0/S0 on [0,2] */ +R[] = {-6.25000000000000000000e-02, /* 0xBFB00000, 0x00000000 */ + 1.40705666955189706048e-03, /* 0x3F570D9F, 0x98472C61 */ + -1.59955631084035597520e-05, /* 0xBEF0C5C6, 0xBA169668 */ + 4.96727999609584448412e-08}, /* 0x3E6AAAFA, 0x46CA0BD9 */ +S[] = {0.0, 1.91537599538363460805e-02, /* 0x3F939D0B, 0x12637E53 */ + 1.85946785588630915560e-04, /* 0x3F285F56, 0xB9CDF664 */ + 1.17718464042623683263e-06, /* 0x3EB3BFF8, 0x333F8498 */ + 5.04636257076217042715e-09, /* 0x3E35AC88, 0xC97DFF2C */ + 1.23542274426137913908e-11}; /* 0x3DAB2ACF, 0xCFB97ED8 */ + +#ifdef __STDC__ +static const double zero = 0.0; +#else +static double zero = 0.0; +#endif + +#ifdef __STDC__ + double __ieee754_j1(double x) +#else + double __ieee754_j1(x) + double x; +#endif +{ + double z, s,c,ss,cc,r,u,v,y,r1,r2,s1,s2,s3,z2,z4; + int32_t hx,ix; + + GET_HIGH_WORD(hx,x); + ix = hx&0x7fffffff; + if(ix>=0x7ff00000) return one/x; + y = fabs(x); + if(ix >= 0x40000000) { /* |x| >= 2.0 */ + __sincos (y, &s, &c); + ss = -s-c; + cc = s-c; + if(ix<0x7fe00000) { /* make sure y+y not overflow */ + z = __cos(y+y); + if ((s*c)>zero) cc = z/ss; + else ss = z/cc; + } + /* + * j1(x) = 1/sqrt(pi) * (P(1,x)*cc - Q(1,x)*ss) / sqrt(x) + * y1(x) = 1/sqrt(pi) * (P(1,x)*ss + Q(1,x)*cc) / sqrt(x) + */ + if(ix>0x48000000) z = (invsqrtpi*cc)/__ieee754_sqrt(y); + else { + u = pone(y); v = qone(y); + z = invsqrtpi*(u*cc-v*ss)/__ieee754_sqrt(y); + } + if(hx<0) return -z; + else return z; + } + if(ix<0x3e400000) { /* |x|<2**-27 */ + if(huge+x>one) return 0.5*x;/* inexact if x!=0 necessary */ + } + z = x*x; +#ifdef DO_NOT_USE_THIS + r = z*(r00+z*(r01+z*(r02+z*r03))); + s = one+z*(s01+z*(s02+z*(s03+z*(s04+z*s05)))); + r *= x; +#else + r1 = z*R[0]; z2=z*z; + r2 = R[1]+z*R[2]; z4=z2*z2; + r = r1 + z2*r2 + z4*R[3]; + r *= x; + s1 = one+z*S[1]; + s2 = S[2]+z*S[3]; + s3 = S[4]+z*S[5]; + s = s1 + z2*s2 + z4*s3; +#endif + return(x*0.5+r/s); +} + +#ifdef __STDC__ +static const double U0[5] = { +#else +static double U0[5] = { +#endif + -1.96057090646238940668e-01, /* 0xBFC91866, 0x143CBC8A */ + 5.04438716639811282616e-02, /* 0x3FA9D3C7, 0x76292CD1 */ + -1.91256895875763547298e-03, /* 0xBF5F55E5, 0x4844F50F */ + 2.35252600561610495928e-05, /* 0x3EF8AB03, 0x8FA6B88E */ + -9.19099158039878874504e-08, /* 0xBE78AC00, 0x569105B8 */ +}; +#ifdef __STDC__ +static const double V0[5] = { +#else +static double V0[5] = { +#endif + 1.99167318236649903973e-02, /* 0x3F94650D, 0x3F4DA9F0 */ + 2.02552581025135171496e-04, /* 0x3F2A8C89, 0x6C257764 */ + 1.35608801097516229404e-06, /* 0x3EB6C05A, 0x894E8CA6 */ + 6.22741452364621501295e-09, /* 0x3E3ABF1D, 0x5BA69A86 */ + 1.66559246207992079114e-11, /* 0x3DB25039, 0xDACA772A */ +}; + +#ifdef __STDC__ + double __ieee754_y1(double x) +#else + double __ieee754_y1(x) + double x; +#endif +{ + double z, s,c,ss,cc,u,v,u1,u2,v1,v2,v3,z2,z4; + int32_t hx,ix,lx; + + EXTRACT_WORDS(hx,lx,x); + ix = 0x7fffffff&hx; + /* if Y1(NaN) is NaN, Y1(-inf) is NaN, Y1(inf) is 0 */ + if(ix>=0x7ff00000) return one/(x+x*x); + if((ix|lx)==0) return -HUGE_VAL+x; /* -inf and overflow exception. */; + if(hx<0) return zero/(zero*x); + if(ix >= 0x40000000) { /* |x| >= 2.0 */ + __sincos (x, &s, &c); + ss = -s-c; + cc = s-c; + if(ix<0x7fe00000) { /* make sure x+x not overflow */ + z = __cos(x+x); + if ((s*c)>zero) cc = z/ss; + else ss = z/cc; + } + /* y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x0)+q1(x)*cos(x0)) + * where x0 = x-3pi/4 + * Better formula: + * cos(x0) = cos(x)cos(3pi/4)+sin(x)sin(3pi/4) + * = 1/sqrt(2) * (sin(x) - cos(x)) + * sin(x0) = sin(x)cos(3pi/4)-cos(x)sin(3pi/4) + * = -1/sqrt(2) * (cos(x) + sin(x)) + * To avoid cancellation, use + * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x)) + * to compute the worse one. + */ + if(ix>0x48000000) z = (invsqrtpi*ss)/__ieee754_sqrt(x); + else { + u = pone(x); v = qone(x); + z = invsqrtpi*(u*ss+v*cc)/__ieee754_sqrt(x); + } + return z; + } + if(ix<=0x3c900000) { /* x < 2**-54 */ + return(-tpi/x); + } + z = x*x; +#ifdef DO_NOT_USE_THIS + u = U0[0]+z*(U0[1]+z*(U0[2]+z*(U0[3]+z*U0[4]))); + v = one+z*(V0[0]+z*(V0[1]+z*(V0[2]+z*(V0[3]+z*V0[4])))); +#else + u1 = U0[0]+z*U0[1];z2=z*z; + u2 = U0[2]+z*U0[3];z4=z2*z2; + u = u1 + z2*u2 + z4*U0[4]; + v1 = one+z*V0[0]; + v2 = V0[1]+z*V0[2]; + v3 = V0[3]+z*V0[4]; + v = v1 + z2*v2 + z4*v3; +#endif + return(x*(u/v) + tpi*(__ieee754_j1(x)*__ieee754_log(x)-one/x)); +} + +/* For x >= 8, the asymptotic expansions of pone is + * 1 + 15/128 s^2 - 4725/2^15 s^4 - ..., where s = 1/x. + * We approximate pone by + * pone(x) = 1 + (R/S) + * where R = pr0 + pr1*s^2 + pr2*s^4 + ... + pr5*s^10 + * S = 1 + ps0*s^2 + ... + ps4*s^10 + * and + * | pone(x)-1-R/S | <= 2 ** ( -60.06) + */ + +#ifdef __STDC__ +static const double pr8[6] = { /* for x in [inf, 8]=1/[0,0.125] */ +#else +static double pr8[6] = { /* for x in [inf, 8]=1/[0,0.125] */ +#endif + 0.00000000000000000000e+00, /* 0x00000000, 0x00000000 */ + 1.17187499999988647970e-01, /* 0x3FBDFFFF, 0xFFFFFCCE */ + 1.32394806593073575129e+01, /* 0x402A7A9D, 0x357F7FCE */ + 4.12051854307378562225e+02, /* 0x4079C0D4, 0x652EA590 */ + 3.87474538913960532227e+03, /* 0x40AE457D, 0xA3A532CC */ + 7.91447954031891731574e+03, /* 0x40BEEA7A, 0xC32782DD */ +}; +#ifdef __STDC__ +static const double ps8[5] = { +#else +static double ps8[5] = { +#endif + 1.14207370375678408436e+02, /* 0x405C8D45, 0x8E656CAC */ + 3.65093083420853463394e+03, /* 0x40AC85DC, 0x964D274F */ + 3.69562060269033463555e+04, /* 0x40E20B86, 0x97C5BB7F */ + 9.76027935934950801311e+04, /* 0x40F7D42C, 0xB28F17BB */ + 3.08042720627888811578e+04, /* 0x40DE1511, 0x697A0B2D */ +}; + +#ifdef __STDC__ +static const double pr5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */ +#else +static double pr5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */ +#endif + 1.31990519556243522749e-11, /* 0x3DAD0667, 0xDAE1CA7D */ + 1.17187493190614097638e-01, /* 0x3FBDFFFF, 0xE2C10043 */ + 6.80275127868432871736e+00, /* 0x401B3604, 0x6E6315E3 */ + 1.08308182990189109773e+02, /* 0x405B13B9, 0x452602ED */ + 5.17636139533199752805e+02, /* 0x40802D16, 0xD052D649 */ + 5.28715201363337541807e+02, /* 0x408085B8, 0xBB7E0CB7 */ +}; +#ifdef __STDC__ +static const double ps5[5] = { +#else +static double ps5[5] = { +#endif + 5.92805987221131331921e+01, /* 0x404DA3EA, 0xA8AF633D */ + 9.91401418733614377743e+02, /* 0x408EFB36, 0x1B066701 */ + 5.35326695291487976647e+03, /* 0x40B4E944, 0x5706B6FB */ + 7.84469031749551231769e+03, /* 0x40BEA4B0, 0xB8A5BB15 */ + 1.50404688810361062679e+03, /* 0x40978030, 0x036F5E51 */ +}; + +#ifdef __STDC__ +static const double pr3[6] = { +#else +static double pr3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */ +#endif + 3.02503916137373618024e-09, /* 0x3E29FC21, 0xA7AD9EDD */ + 1.17186865567253592491e-01, /* 0x3FBDFFF5, 0x5B21D17B */ + 3.93297750033315640650e+00, /* 0x400F76BC, 0xE85EAD8A */ + 3.51194035591636932736e+01, /* 0x40418F48, 0x9DA6D129 */ + 9.10550110750781271918e+01, /* 0x4056C385, 0x4D2C1837 */ + 4.85590685197364919645e+01, /* 0x4048478F, 0x8EA83EE5 */ +}; +#ifdef __STDC__ +static const double ps3[5] = { +#else +static double ps3[5] = { +#endif + 3.47913095001251519989e+01, /* 0x40416549, 0xA134069C */ + 3.36762458747825746741e+02, /* 0x40750C33, 0x07F1A75F */ + 1.04687139975775130551e+03, /* 0x40905B7C, 0x5037D523 */ + 8.90811346398256432622e+02, /* 0x408BD67D, 0xA32E31E9 */ + 1.03787932439639277504e+02, /* 0x4059F26D, 0x7C2EED53 */ +}; + +#ifdef __STDC__ +static const double pr2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */ +#else +static double pr2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */ +#endif + 1.07710830106873743082e-07, /* 0x3E7CE9D4, 0xF65544F4 */ + 1.17176219462683348094e-01, /* 0x3FBDFF42, 0xBE760D83 */ + 2.36851496667608785174e+00, /* 0x4002F2B7, 0xF98FAEC0 */ + 1.22426109148261232917e+01, /* 0x40287C37, 0x7F71A964 */ + 1.76939711271687727390e+01, /* 0x4031B1A8, 0x177F8EE2 */ + 5.07352312588818499250e+00, /* 0x40144B49, 0xA574C1FE */ +}; +#ifdef __STDC__ +static const double ps2[5] = { +#else +static double ps2[5] = { +#endif + 2.14364859363821409488e+01, /* 0x40356FBD, 0x8AD5ECDC */ + 1.25290227168402751090e+02, /* 0x405F5293, 0x14F92CD5 */ + 2.32276469057162813669e+02, /* 0x406D08D8, 0xD5A2DBD9 */ + 1.17679373287147100768e+02, /* 0x405D6B7A, 0xDA1884A9 */ + 8.36463893371618283368e+00, /* 0x4020BAB1, 0xF44E5192 */ +}; + +#ifdef __STDC__ + static double pone(double x) +#else + static double pone(x) + double x; +#endif +{ +#ifdef __STDC__ + const double *p = 0,*q = 0; +#else + double *p = 0,*q = 0; +#endif + double z,r,s,r1,r2,r3,s1,s2,s3,z2,z4; + int32_t ix; + GET_HIGH_WORD(ix,x); + ix &= 0x7fffffff; + if(ix>=0x40200000) {p = pr8; q= ps8;} + else if(ix>=0x40122E8B){p = pr5; q= ps5;} + else if(ix>=0x4006DB6D){p = pr3; q= ps3;} + else if(ix>=0x40000000){p = pr2; q= ps2;} + z = one/(x*x); +#ifdef DO_NOT_USE_THIS + r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5])))); + s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*q[4])))); +#else + r1 = p[0]+z*p[1]; z2=z*z; + r2 = p[2]+z*p[3]; z4=z2*z2; + r3 = p[4]+z*p[5]; + r = r1 + z2*r2 + z4*r3; + s1 = one+z*q[0]; + s2 = q[1]+z*q[2]; + s3 = q[3]+z*q[4]; + s = s1 + z2*s2 + z4*s3; +#endif + return one+ r/s; +} + + +/* For x >= 8, the asymptotic expansions of qone is + * 3/8 s - 105/1024 s^3 - ..., where s = 1/x. + * We approximate pone by + * qone(x) = s*(0.375 + (R/S)) + * where R = qr1*s^2 + qr2*s^4 + ... + qr5*s^10 + * S = 1 + qs1*s^2 + ... + qs6*s^12 + * and + * | qone(x)/s -0.375-R/S | <= 2 ** ( -61.13) + */ + +#ifdef __STDC__ +static const double qr8[6] = { /* for x in [inf, 8]=1/[0,0.125] */ +#else +static double qr8[6] = { /* for x in [inf, 8]=1/[0,0.125] */ +#endif + 0.00000000000000000000e+00, /* 0x00000000, 0x00000000 */ + -1.02539062499992714161e-01, /* 0xBFBA3FFF, 0xFFFFFDF3 */ + -1.62717534544589987888e+01, /* 0xC0304591, 0xA26779F7 */ + -7.59601722513950107896e+02, /* 0xC087BCD0, 0x53E4B576 */ + -1.18498066702429587167e+04, /* 0xC0C724E7, 0x40F87415 */ + -4.84385124285750353010e+04, /* 0xC0E7A6D0, 0x65D09C6A */ +}; +#ifdef __STDC__ +static const double qs8[6] = { +#else +static double qs8[6] = { +#endif + 1.61395369700722909556e+02, /* 0x40642CA6, 0xDE5BCDE5 */ + 7.82538599923348465381e+03, /* 0x40BE9162, 0xD0D88419 */ + 1.33875336287249578163e+05, /* 0x4100579A, 0xB0B75E98 */ + 7.19657723683240939863e+05, /* 0x4125F653, 0x72869C19 */ + 6.66601232617776375264e+05, /* 0x412457D2, 0x7719AD5C */ + -2.94490264303834643215e+05, /* 0xC111F969, 0x0EA5AA18 */ +}; + +#ifdef __STDC__ +static const double qr5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */ +#else +static double qr5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */ +#endif + -2.08979931141764104297e-11, /* 0xBDB6FA43, 0x1AA1A098 */ + -1.02539050241375426231e-01, /* 0xBFBA3FFF, 0xCB597FEF */ + -8.05644828123936029840e+00, /* 0xC0201CE6, 0xCA03AD4B */ + -1.83669607474888380239e+02, /* 0xC066F56D, 0x6CA7B9B0 */ + -1.37319376065508163265e+03, /* 0xC09574C6, 0x6931734F */ + -2.61244440453215656817e+03, /* 0xC0A468E3, 0x88FDA79D */ +}; +#ifdef __STDC__ +static const double qs5[6] = { +#else +static double qs5[6] = { +#endif + 8.12765501384335777857e+01, /* 0x405451B2, 0xFF5A11B2 */ + 1.99179873460485964642e+03, /* 0x409F1F31, 0xE77BF839 */ + 1.74684851924908907677e+04, /* 0x40D10F1F, 0x0D64CE29 */ + 4.98514270910352279316e+04, /* 0x40E8576D, 0xAABAD197 */ + 2.79480751638918118260e+04, /* 0x40DB4B04, 0xCF7C364B */ + -4.71918354795128470869e+03, /* 0xC0B26F2E, 0xFCFFA004 */ +}; + +#ifdef __STDC__ +static const double qr3[6] = { +#else +static double qr3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */ +#endif + -5.07831226461766561369e-09, /* 0xBE35CFA9, 0xD38FC84F */ + -1.02537829820837089745e-01, /* 0xBFBA3FEB, 0x51AEED54 */ + -4.61011581139473403113e+00, /* 0xC01270C2, 0x3302D9FF */ + -5.78472216562783643212e+01, /* 0xC04CEC71, 0xC25D16DA */ + -2.28244540737631695038e+02, /* 0xC06C87D3, 0x4718D55F */ + -2.19210128478909325622e+02, /* 0xC06B66B9, 0x5F5C1BF6 */ +}; +#ifdef __STDC__ +static const double qs3[6] = { +#else +static double qs3[6] = { +#endif + 4.76651550323729509273e+01, /* 0x4047D523, 0xCCD367E4 */ + 6.73865112676699709482e+02, /* 0x40850EEB, 0xC031EE3E */ + 3.38015286679526343505e+03, /* 0x40AA684E, 0x448E7C9A */ + 5.54772909720722782367e+03, /* 0x40B5ABBA, 0xA61D54A6 */ + 1.90311919338810798763e+03, /* 0x409DBC7A, 0x0DD4DF4B */ + -1.35201191444307340817e+02, /* 0xC060E670, 0x290A311F */ +}; + +#ifdef __STDC__ +static const double qr2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */ +#else +static double qr2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */ +#endif + -1.78381727510958865572e-07, /* 0xBE87F126, 0x44C626D2 */ + -1.02517042607985553460e-01, /* 0xBFBA3E8E, 0x9148B010 */ + -2.75220568278187460720e+00, /* 0xC0060484, 0x69BB4EDA */ + -1.96636162643703720221e+01, /* 0xC033A9E2, 0xC168907F */ + -4.23253133372830490089e+01, /* 0xC04529A3, 0xDE104AAA */ + -2.13719211703704061733e+01, /* 0xC0355F36, 0x39CF6E52 */ +}; +#ifdef __STDC__ +static const double qs2[6] = { +#else +static double qs2[6] = { +#endif + 2.95333629060523854548e+01, /* 0x403D888A, 0x78AE64FF */ + 2.52981549982190529136e+02, /* 0x406F9F68, 0xDB821CBA */ + 7.57502834868645436472e+02, /* 0x4087AC05, 0xCE49A0F7 */ + 7.39393205320467245656e+02, /* 0x40871B25, 0x48D4C029 */ + 1.55949003336666123687e+02, /* 0x40637E5E, 0x3C3ED8D4 */ + -4.95949898822628210127e+00, /* 0xC013D686, 0xE71BE86B */ +}; + +#ifdef __STDC__ + static double qone(double x) +#else + static double qone(x) + double x; +#endif +{ +#ifdef __STDC__ + const double *p = 0,*q = 0; +#else + double *p = 0,*q = 0; +#endif + double s,r,z,r1,r2,r3,s1,s2,s3,z2,z4,z6; + int32_t ix; + GET_HIGH_WORD(ix,x); + ix &= 0x7fffffff; + if(ix>=0x40200000) {p = qr8; q= qs8;} + else if(ix>=0x40122E8B){p = qr5; q= qs5;} + else if(ix>=0x4006DB6D){p = qr3; q= qs3;} + else if(ix>=0x40000000){p = qr2; q= qs2;} + z = one/(x*x); +#ifdef DO_NOT_USE_THIS + r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5])))); + s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*(q[4]+z*q[5]))))); +#else + r1 = p[0]+z*p[1]; z2=z*z; + r2 = p[2]+z*p[3]; z4=z2*z2; + r3 = p[4]+z*p[5]; z6=z4*z2; + r = r1 + z2*r2 + z4*r3; + s1 = one+z*q[0]; + s2 = q[1]+z*q[2]; + s3 = q[3]+z*q[4]; + s = s1 + z2*s2 + z4*s3 + z6*q[5]; +#endif + return (.375 + r/s)/x; +} diff --git a/lib/sdk/crt/math/ieee754/jn_yn.c b/lib/sdk/crt/math/ieee754/jn_yn.c new file mode 100644 index 00000000000..c827b528d25 --- /dev/null +++ b/lib/sdk/crt/math/ieee754/jn_yn.c @@ -0,0 +1,287 @@ +/* @(#)e_jn.c 5.1 93/09/24 */ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: e_jn.c,v 1.9 1995/05/10 20:45:34 jtc Exp $"; +#endif + +/* + * __ieee754_jn(n, x), __ieee754_yn(n, x) + * floating point Bessel's function of the 1st and 2nd kind + * of order n + * + * Special cases: + * y0(0)=y1(0)=yn(n,0) = -inf with overflow signal; + * y0(-ve)=y1(-ve)=yn(n,-ve) are NaN with invalid signal. + * Note 2. About jn(n,x), yn(n,x) + * For n=0, j0(x) is called, + * for n=1, j1(x) is called, + * for nx, a continued fraction approximation to + * j(n,x)/j(n-1,x) is evaluated and then backward + * recursion is used starting from a supposed value + * for j(n,x). The resulting value of j(0,x) is + * compared with the actual value to correct the + * supposed value of j(n,x). + * + * yn(n,x) is similar in all respects, except + * that forward recursion is used for all + * values of n>1. + * + */ + +#include "math.h" +#include "ieee754.h" + +#ifdef __STDC__ +static const double +#else +static double +#endif +invsqrtpi= 5.64189583547756279280e-01, /* 0x3FE20DD7, 0x50429B6D */ +two = 2.00000000000000000000e+00, /* 0x40000000, 0x00000000 */ +one = 1.00000000000000000000e+00; /* 0x3FF00000, 0x00000000 */ + +#ifdef __STDC__ +static const double zero = 0.00000000000000000000e+00; +#else +static double zero = 0.00000000000000000000e+00; +#endif + +#ifdef __STDC__ + double __ieee754_jn(int n, double x) +#else + double __ieee754_jn(n,x) + int n; double x; +#endif +{ + int32_t i,hx,ix,lx, sgn; + double a, b, temp, di; + double z, w; + + /* J(-n,x) = (-1)^n * J(n, x), J(n, -x) = (-1)^n * J(n, x) + * Thus, J(-n,x) = J(n,-x) + */ + EXTRACT_WORDS(hx,lx,x); + ix = 0x7fffffff&hx; + /* if J(n,NaN) is NaN */ + if((ix|((u_int32_t)(lx|-lx))>>31)>0x7ff00000) return x+x; + if(n<0){ + n = -n; + x = -x; + hx ^= 0x80000000; + } + if(n==0) return(__ieee754_j0(x)); + if(n==1) return(__ieee754_j1(x)); + sgn = (n&1)&(hx>>31); /* even n -- 0, odd n -- sign(x) */ + x = fabs(x); + if((ix|lx)==0||ix>=0x7ff00000) /* if x is 0 or inf */ + b = zero; + else if((double)n<=x) { + /* Safe to use J(n+1,x)=2n/x *J(n,x)-J(n-1,x) */ + if(ix>=0x52D00000) { /* x > 2**302 */ + /* (x >> n**2) + * Jn(x) = cos(x-(2n+1)*pi/4)*sqrt(2/x*pi) + * Yn(x) = sin(x-(2n+1)*pi/4)*sqrt(2/x*pi) + * Let s=sin(x), c=cos(x), + * xn=x-(2n+1)*pi/4, sqt2 = sqrt(2),then + * + * n sin(xn)*sqt2 cos(xn)*sqt2 + * ---------------------------------- + * 0 s-c c+s + * 1 -s-c -c+s + * 2 -s+c -c-s + * 3 s+c c-s + */ + double s; + double c; + __sincos (x, &s, &c); + switch(n&3) { + case 0: temp = c + s; break; + case 1: temp = -c + s; break; + case 2: temp = -c - s; break; + case 3: temp = c - s; break; + } + b = invsqrtpi*temp/__ieee754_sqrt(x); + } else { + a = __ieee754_j0(x); + b = __ieee754_j1(x); + for(i=1;i33) /* underflow */ + b = zero; + else { + temp = x*0.5; b = temp; + for (a=one,i=2;i<=n;i++) { + a *= (double)i; /* a = n! */ + b *= temp; /* b = (x/2)^n */ + } + b = b/a; + } + } else { + /* use backward recurrence */ + /* x x^2 x^2 + * J(n,x)/J(n-1,x) = ---- ------ ------ ..... + * 2n - 2(n+1) - 2(n+2) + * + * 1 1 1 + * (for large x) = ---- ------ ------ ..... + * 2n 2(n+1) 2(n+2) + * -- - ------ - ------ - + * x x x + * + * Let w = 2n/x and h=2/x, then the above quotient + * is equal to the continued fraction: + * 1 + * = ----------------------- + * 1 + * w - ----------------- + * 1 + * w+h - --------- + * w+2h - ... + * + * To determine how many terms needed, let + * Q(0) = w, Q(1) = w(w+h) - 1, + * Q(k) = (w+k*h)*Q(k-1) - Q(k-2), + * When Q(k) > 1e4 good for single + * When Q(k) > 1e9 good for double + * When Q(k) > 1e17 good for quadruple + */ + /* determine k */ + double t,v; + double q0,q1,h,tmp; int32_t k,m; + w = (n+n)/(double)x; h = 2.0/(double)x; + q0 = w; z = w+h; q1 = w*z - 1.0; k=1; + while(q1<1.0e9) { + k += 1; z += h; + tmp = z*q1 - q0; + q0 = q1; + q1 = tmp; + } + m = n+n; + for(t=zero, i = 2*(n+k); i>=m; i -= 2) t = one/(i/x-t); + a = t; + b = one; + /* estimate log((2/x)^n*n!) = n*log(2/x)+n*ln(n) + * Hence, if n*(log(2n/x)) > ... + * single 8.8722839355e+01 + * double 7.09782712893383973096e+02 + * long double 1.1356523406294143949491931077970765006170e+04 + * then recurrent value may overflow and the result is + * likely underflow to zero + */ + tmp = n; + v = two/x; + tmp = tmp*__ieee754_log(fabs(v*tmp)); + if(tmp<7.09782712893383973096e+02) { + for(i=n-1,di=(double)(i+i);i>0;i--){ + temp = b; + b *= di; + b = b/x - a; + a = temp; + di -= two; + } + } else { + for(i=n-1,di=(double)(i+i);i>0;i--){ + temp = b; + b *= di; + b = b/x - a; + a = temp; + di -= two; + /* scale b to avoid spurious overflow */ + if(b>1e100) { + a /= b; + t /= b; + b = one; + } + } + } + b = (t*__ieee754_j0(x)/b); + } + } + if(sgn==1) return -b; else return b; +} + +#ifdef __STDC__ + double __ieee754_yn(int n, double x) +#else + double __ieee754_yn(n,x) + int n; double x; +#endif +{ + int32_t i,hx,ix,lx; + int32_t sign; + double a, b, temp; + + EXTRACT_WORDS(hx,lx,x); + ix = 0x7fffffff&hx; + /* if Y(n,NaN) is NaN */ + if((ix|((u_int32_t)(lx|-lx))>>31)>0x7ff00000) return x+x; + if((ix|lx)==0) return -HUGE_VAL+x; /* -inf and overflow exception. */; + if(hx<0) return zero/(zero*x); + sign = 1; + if(n<0){ + n = -n; + sign = 1 - ((n&1)<<1); + } + if(n==0) return(__ieee754_y0(x)); + if(n==1) return(sign*__ieee754_y1(x)); + if(ix==0x7ff00000) return zero; + if(ix>=0x52D00000) { /* x > 2**302 */ + /* (x >> n**2) + * Jn(x) = cos(x-(2n+1)*pi/4)*sqrt(2/x*pi) + * Yn(x) = sin(x-(2n+1)*pi/4)*sqrt(2/x*pi) + * Let s=sin(x), c=cos(x), + * xn=x-(2n+1)*pi/4, sqt2 = sqrt(2),then + * + * n sin(xn)*sqt2 cos(xn)*sqt2 + * ---------------------------------- + * 0 s-c c+s + * 1 -s-c -c+s + * 2 -s+c -c-s + * 3 s+c c-s + */ + double c; + double s; + __sincos (x, &s, &c); + switch(n&3) { + case 0: temp = s - c; break; + case 1: temp = -s - c; break; + case 2: temp = -s + c; break; + case 3: temp = s + c; break; + } + b = invsqrtpi*temp/__ieee754_sqrt(x); + } else { + u_int32_t high; + a = __ieee754_y0(x); + b = __ieee754_y1(x); + /* quit if b is -inf */ + GET_HIGH_WORD(high,b); + for(i=1;i0) return b; else return -b; +} diff --git a/lib/sdk/crt/math/j0_y0.c b/lib/sdk/crt/math/j0_y0.c index d6787deeb28..c656e210b33 100644 --- a/lib/sdk/crt/math/j0_y0.c +++ b/lib/sdk/crt/math/j0_y0.c @@ -1,4 +1,6 @@ #include +#include +#include "ieee754/ieee754.h" typedef int fpclass_t; fpclass_t _fpclass(double __d); @@ -10,7 +12,7 @@ int *_errno(void); double _j0(double num) { /* FIXME: errno handling */ - return j0(num); + return __ieee754_j0(num); } /* @@ -19,8 +21,8 @@ double _j0(double num) double _y0(double num) { double retval; - if (!isfinite(num)) *_errno() = EDOM; - retval = y0(num); + if (!_finite(num)) *_errno() = EDOM; + retval = __ieee754_y0(num); if (_fpclass(retval) == _FPCLASS_NINF) { *_errno() = EDOM; diff --git a/lib/sdk/crt/math/j1_y1.c b/lib/sdk/crt/math/j1_y1.c index b050889d7ae..7a2bc2a8645 100644 --- a/lib/sdk/crt/math/j1_y1.c +++ b/lib/sdk/crt/math/j1_y1.c @@ -1,4 +1,6 @@ #include +#include +#include "ieee754/ieee754.h" typedef int fpclass_t; fpclass_t _fpclass(double __d); @@ -10,7 +12,7 @@ int *_errno(void); double _j1(double num) { /* FIXME: errno handling */ - return j1(num); + return __ieee754_j1(num); } /* @@ -19,8 +21,8 @@ double _j1(double num) double _y1(double num) { double retval; - if (!isfinite(num)) *_errno() = EDOM; - retval = y1(num); + if (!_finite(num)) *_errno() = EDOM; + retval = __ieee754_y1(num); if (_fpclass(retval) == _FPCLASS_NINF) { *_errno() = EDOM; diff --git a/lib/sdk/crt/math/jn_yn.c b/lib/sdk/crt/math/jn_yn.c index 34f2dee7a4d..141e4f2e951 100644 --- a/lib/sdk/crt/math/jn_yn.c +++ b/lib/sdk/crt/math/jn_yn.c @@ -1,4 +1,6 @@ #include +#include +#include "ieee754/ieee754.h" typedef int fpclass_t; fpclass_t _fpclass(double __d); @@ -10,7 +12,7 @@ int *_errno(void); double _jn(int n, double num) { /* FIXME: errno handling */ - return jn(n, num); + return __ieee754_jn(n, num); } /* @@ -19,8 +21,8 @@ double _jn(int n, double num) double _yn(int order, double num) { double retval; - if (!isfinite(num)) *_errno() = EDOM; - retval = yn(order,num); + if (!_finite(num)) *_errno() = EDOM; + retval = __ieee754_yn(order,num); if (_fpclass(retval) == _FPCLASS_NINF) { *_errno() = EDOM; diff --git a/lib/sdk/crt/msvcrtex.cmake b/lib/sdk/crt/msvcrtex.cmake index ece7f959dd0..9099448f55e 100644 --- a/lib/sdk/crt/msvcrtex.cmake +++ b/lib/sdk/crt/msvcrtex.cmake @@ -2,12 +2,13 @@ include_directories(include/internal/mingw-w64) if(NOT MSVC) - add_definitions(-Wno-main) + add_compiler_flags(-Wno-main) endif() list(APPEND MSVCRTEX_SOURCE startup/crtexe.c startup/wcrtexe.c + startup/crt_handler.c startup/crtdll.c startup/_newmode.c startup/wildcard.c @@ -18,8 +19,7 @@ list(APPEND MSVCRTEX_SOURCE startup/merr.c startup/atonexit.c startup/txtmode.c - startup/pseudo-reloc.c - startup/pseudo-reloc-list.c + startup/pesect.c startup/tlsmcrt.c startup/tlsthrd.c startup/tlsmthread.c @@ -35,13 +35,25 @@ list(APPEND MSVCRTEX_SOURCE misc/ofmt_stub.c ) +if(NOT MSVC) +list(APPEND MSVCRTEX_SOURCE + startup/pseudo-reloc.c + startup/pseudo-reloc-list.c) +endif() + if(ARCH MATCHES i386) list(APPEND MSVCRTEX_SOURCE except/i386/chkstk_asm.s + except/i386/chkstk_ms.s math/i386/ci.c - math/i386/ftol2_asm.S + math/i386/ftol2_asm.s math/i386/alldiv_asm.s ) +elseif(ARCH MATCHES amd64) +list(APPEND MSVCRTEX_SOURCE + except/amd64/chkstk_asm.s + except/amd64/chkstk_ms.s + math/amd64/alldiv.S) endif() if(MSVC) @@ -58,3 +70,4 @@ if(NOT MSVC) target_link_libraries(msvcrtex oldnames) endif() +add_dependencies(msvcrtex psdk asm) diff --git a/lib/sdk/crt/precomp.h b/lib/sdk/crt/precomp.h index acc6e6d7dec..b257c931382 100644 --- a/lib/sdk/crt/precomp.h +++ b/lib/sdk/crt/precomp.h @@ -27,7 +27,7 @@ /* PSDK/NDK Headers */ #define WIN32_NO_STATUS #include -#include +#include #if !defined(_MSC_VER) #include diff --git a/lib/sdk/crt/printf/streamout.c b/lib/sdk/crt/printf/streamout.c index 66aae271dd5..0f26f32ee6b 100644 --- a/lib/sdk/crt/printf/streamout.c +++ b/lib/sdk/crt/printf/streamout.c @@ -73,7 +73,7 @@ enum #ifndef _USER32_WSPRINTF void -#ifdef _LIBCNT +#ifdef _LIBCNT_ /* Due to restrictions in kernel mode regarding the use of floating point, we prevent it from being inlined */ __declspec(noinline) @@ -540,7 +540,7 @@ streamout(FILE *stream, const TCHAR *format, va_list argptr) if ((__int64)val64 < 0) { - val64 = -val64; + val64 = -(__int64)val64; prefix = _T("-"); } else if (flags & FLAG_FORCE_SIGN) diff --git a/lib/sdk/crt/startup/cinitexe.c b/lib/sdk/crt/startup/cinitexe.c index b7a957fd72f..ee441ed77f9 100644 --- a/lib/sdk/crt/startup/cinitexe.c +++ b/lib/sdk/crt/startup/cinitexe.c @@ -1,11 +1,12 @@ #include -#include #include #ifdef _MSC_VER #pragma comment(linker, "/merge:.CRT=.rdata") #endif +typedef void (__cdecl *_PVFV)(void); + _CRTALLOC(".CRT$XIA") _PVFV __xi_a[] = { NULL }; _CRTALLOC(".CRT$XIZ") _PVFV __xi_z[] = { NULL }; _CRTALLOC(".CRT$XCA") _PVFV __xc_a[] = { NULL }; diff --git a/lib/sdk/crt/startup/crt_handler.c b/lib/sdk/crt/startup/crt_handler.c new file mode 100644 index 00000000000..5d7dc22bebd --- /dev/null +++ b/lib/sdk/crt/startup/crt_handler.c @@ -0,0 +1,290 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined (_WIN64) && defined (__ia64__) +#error FIXME: Unsupported __ImageBase implementation. +#else +#ifndef _MSC_VER +#define __ImageBase __MINGW_LSYMBOL(_image_base__) +#endif +/* This symbol is defined by the linker. */ +extern IMAGE_DOS_HEADER __ImageBase; +#endif + +#pragma pack(push,1) +typedef struct _UNWIND_INFO { + BYTE VersionAndFlags; + BYTE PrologSize; + BYTE CountOfUnwindCodes; + BYTE FrameRegisterAndOffset; + ULONG AddressOfExceptionHandler; +} UNWIND_INFO,*PUNWIND_INFO; +#pragma pack(pop) + +PIMAGE_SECTION_HEADER _FindPESectionByName (const char *); +PIMAGE_SECTION_HEADER _FindPESectionExec (size_t); +PBYTE _GetPEImageBase (void); + +int __mingw_init_ehandler (void); +extern void _fpreset (void); + +#if defined(_WIN64) && !defined(_MSC_VER) +EXCEPTION_DISPOSITION __mingw_SEH_error_handler(struct _EXCEPTION_RECORD *, void *, struct _CONTEXT *, void *); + +#define MAX_PDATA_ENTRIES 32 +static RUNTIME_FUNCTION emu_pdata[MAX_PDATA_ENTRIES]; +static UNWIND_INFO emu_xdata[MAX_PDATA_ENTRIES]; + +int +__mingw_init_ehandler (void) +{ + static int was_here = 0; + size_t e = 0; + PIMAGE_SECTION_HEADER pSec; + PBYTE _ImageBase = _GetPEImageBase (); + + if (was_here || !_ImageBase) + return was_here; + was_here = 1; + if (_FindPESectionByName (".pdata") != NULL) + return 1; + + /* Allocate # of e tables and entries. */ + memset (emu_pdata, 0, sizeof (RUNTIME_FUNCTION) * MAX_PDATA_ENTRIES); + memset (emu_xdata, 0, sizeof (UNWIND_INFO) * MAX_PDATA_ENTRIES); + + e = 0; + /* Fill tables and entries. */ + while (e < MAX_PDATA_ENTRIES && (pSec = _FindPESectionExec (e)) != NULL) + { + emu_xdata[e].VersionAndFlags = 9; /* UNW_FLAG_EHANDLER | UNW_VERSION */ + emu_xdata[e].AddressOfExceptionHandler = + (DWORD)(size_t) ((LPBYTE)__mingw_SEH_error_handler - _ImageBase); + emu_pdata[e].BeginAddress = pSec->VirtualAddress; + emu_pdata[e].EndAddress = pSec->VirtualAddress + pSec->Misc.VirtualSize; + emu_pdata[e].UnwindData = + (DWORD)(size_t)((LPBYTE)&emu_xdata[e] - _ImageBase); + ++e; + } +#ifdef _DEBUG_CRT + if (!e || e > MAX_PDATA_ENTRIES) + abort (); +#endif + /* RtlAddFunctionTable. */ + if (e != 0) + RtlAddFunctionTable (emu_pdata, e, (DWORD64)_ImageBase); + return 1; +} + +extern void _fpreset (void); + +EXCEPTION_DISPOSITION +__mingw_SEH_error_handler (struct _EXCEPTION_RECORD* ExceptionRecord, + void *EstablisherFrame __attribute__ ((unused)), + struct _CONTEXT* ContextRecord __attribute__ ((unused)), + void *DispatcherContext __attribute__ ((unused))) +{ + EXCEPTION_DISPOSITION action = ExceptionContinueSearch; /* EXCEPTION_CONTINUE_SEARCH; */ + void (*old_handler) (int); + int reset_fpu = 0; + + switch (ExceptionRecord->ExceptionCode) + { + case EXCEPTION_ACCESS_VIOLATION: + /* test if the user has set SIGSEGV */ + old_handler = signal (SIGSEGV, SIG_DFL); + if (old_handler == SIG_IGN) + { + /* this is undefined if the signal was raised by anything other + than raise (). */ + signal (SIGSEGV, SIG_IGN); + action = 0; //EXCEPTION_CONTINUE_EXECUTION; + } + else if (old_handler != SIG_DFL) + { + /* This means 'old' is a user defined function. Call it */ + (*old_handler) (SIGSEGV); + action = 0; // EXCEPTION_CONTINUE_EXECUTION; + } + else + action = 4; /* EXCEPTION_EXECUTE_HANDLER; */ + break; + case EXCEPTION_ILLEGAL_INSTRUCTION: + case EXCEPTION_PRIV_INSTRUCTION: + /* test if the user has set SIGILL */ + old_handler = signal (SIGILL, SIG_DFL); + if (old_handler == SIG_IGN) + { + /* this is undefined if the signal was raised by anything other + than raise (). */ + signal (SIGILL, SIG_IGN); + action = 0; // EXCEPTION_CONTINUE_EXECUTION; + } + else if (old_handler != SIG_DFL) + { + /* This means 'old' is a user defined function. Call it */ + (*old_handler) (SIGILL); + action = 0; // EXCEPTION_CONTINUE_EXECUTION; + } + else + action = 4; /* EXCEPTION_EXECUTE_HANDLER;*/ + break; + case EXCEPTION_FLT_INVALID_OPERATION: + case EXCEPTION_FLT_DIVIDE_BY_ZERO: + case EXCEPTION_FLT_DENORMAL_OPERAND: + case EXCEPTION_FLT_OVERFLOW: + case EXCEPTION_FLT_UNDERFLOW: + case EXCEPTION_FLT_INEXACT_RESULT: + reset_fpu = 1; + /* fall through. */ + + case EXCEPTION_INT_DIVIDE_BY_ZERO: + /* test if the user has set SIGFPE */ + old_handler = signal (SIGFPE, SIG_DFL); + if (old_handler == SIG_IGN) + { + signal (SIGFPE, SIG_IGN); + if (reset_fpu) + _fpreset (); + action = 0; // EXCEPTION_CONTINUE_EXECUTION; + } + else if (old_handler != SIG_DFL) + { + /* This means 'old' is a user defined function. Call it */ + (*old_handler) (SIGFPE); + action = 0; // EXCEPTION_CONTINUE_EXECUTION; + } + break; + case EXCEPTION_DATATYPE_MISALIGNMENT: + case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: + case EXCEPTION_FLT_STACK_CHECK: + case EXCEPTION_INT_OVERFLOW: + case EXCEPTION_INVALID_HANDLE: + /*case EXCEPTION_POSSIBLE_DEADLOCK: */ + action = 0; // EXCEPTION_CONTINUE_EXECUTION; + break; + default: + break; + } + return action; +} + +#endif + +LPTOP_LEVEL_EXCEPTION_FILTER __mingw_oldexcpt_handler = NULL; + +long CALLBACK +_gnu_exception_handler (EXCEPTION_POINTERS *exception_data); + +#define GCC_MAGIC (('G' << 16) | ('C' << 8) | 'C' | (1U << 29)) + +long CALLBACK +_gnu_exception_handler (EXCEPTION_POINTERS *exception_data) +{ + void (*old_handler) (int); + long action = EXCEPTION_CONTINUE_SEARCH; + int reset_fpu = 0; + +#ifdef __SEH__ + if ((exception_data->ExceptionRecord->ExceptionCode & 0x20ffffff) == GCC_MAGIC) + { + if ((exception_data->ExceptionRecord->ExceptionFlags & EXCEPTION_NONCONTINUABLE) == 0) + return EXCEPTION_CONTINUE_EXECUTION; + } +#endif + + switch (exception_data->ExceptionRecord->ExceptionCode) + { + case EXCEPTION_ACCESS_VIOLATION: + /* test if the user has set SIGSEGV */ + old_handler = signal (SIGSEGV, SIG_DFL); + if (old_handler == SIG_IGN) + { + /* this is undefined if the signal was raised by anything other + than raise (). */ + signal (SIGSEGV, SIG_IGN); + action = EXCEPTION_CONTINUE_EXECUTION; + } + else if (old_handler != SIG_DFL) + { + /* This means 'old' is a user defined function. Call it */ + (*old_handler) (SIGSEGV); + action = EXCEPTION_CONTINUE_EXECUTION; + } + break; + + case EXCEPTION_ILLEGAL_INSTRUCTION: + case EXCEPTION_PRIV_INSTRUCTION: + /* test if the user has set SIGILL */ + old_handler = signal (SIGILL, SIG_DFL); + if (old_handler == SIG_IGN) + { + /* this is undefined if the signal was raised by anything other + than raise (). */ + signal (SIGILL, SIG_IGN); + action = EXCEPTION_CONTINUE_EXECUTION; + } + else if (old_handler != SIG_DFL) + { + /* This means 'old' is a user defined function. Call it */ + (*old_handler) (SIGILL); + action = EXCEPTION_CONTINUE_EXECUTION; + } + break; + + case EXCEPTION_FLT_INVALID_OPERATION: + case EXCEPTION_FLT_DIVIDE_BY_ZERO: + case EXCEPTION_FLT_DENORMAL_OPERAND: + case EXCEPTION_FLT_OVERFLOW: + case EXCEPTION_FLT_UNDERFLOW: + case EXCEPTION_FLT_INEXACT_RESULT: + reset_fpu = 1; + /* fall through. */ + + case EXCEPTION_INT_DIVIDE_BY_ZERO: + /* test if the user has set SIGFPE */ + old_handler = signal (SIGFPE, SIG_DFL); + if (old_handler == SIG_IGN) + { + signal (SIGFPE, SIG_IGN); + if (reset_fpu) + _fpreset (); + action = EXCEPTION_CONTINUE_EXECUTION; + } + else if (old_handler != SIG_DFL) + { + /* This means 'old' is a user defined function. Call it */ + (*old_handler) (SIGFPE); + action = EXCEPTION_CONTINUE_EXECUTION; + } + break; +#ifdef _WIN64 + case EXCEPTION_DATATYPE_MISALIGNMENT: + case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: + case EXCEPTION_FLT_STACK_CHECK: + case EXCEPTION_INT_OVERFLOW: + case EXCEPTION_INVALID_HANDLE: + /*case EXCEPTION_POSSIBLE_DEADLOCK: */ + action = EXCEPTION_CONTINUE_EXECUTION; + break; +#endif + default: + break; + } + + if (action == EXCEPTION_CONTINUE_SEARCH && __mingw_oldexcpt_handler) + action = (*__mingw_oldexcpt_handler)(exception_data); + return action; +} diff --git a/lib/sdk/crt/startup/crtdll.c b/lib/sdk/crt/startup/crtdll.c index 001cbd7358f..6fa17a821f8 100644 --- a/lib/sdk/crt/startup/crtdll.c +++ b/lib/sdk/crt/startup/crtdll.c @@ -33,8 +33,12 @@ #include extern void __cdecl _initterm(_PVFV *,_PVFV *); -extern void __main (); + +#if defined(__GNUC__) +extern void __main (void); extern void _pei386_runtime_relocator (void); +#endif + extern _CRTALLOC(".CRT$XIA") _PIFV __xi_a[]; extern _CRTALLOC(".CRT$XIZ") _PIFV __xi_z[]; extern _CRTALLOC(".CRT$XCA") _PVFV __xc_a[]; @@ -179,7 +183,9 @@ __DllMainCRTStartup (HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved) retcode = FALSE; goto i__leave; } +#if defined(__GNUC__) _pei386_runtime_relocator (); +#endif if (dwReason == DLL_PROCESS_ATTACH || dwReason == DLL_THREAD_ATTACH) { retcode = _CRT_INIT (hDllHandle, dwReason, lpreserved); @@ -194,7 +200,9 @@ __DllMainCRTStartup (HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved) } } if (dwReason == DLL_PROCESS_ATTACH) +#if defined(__GNUC__) __main (); +#endif retcode = DllMain(hDllHandle,dwReason,lpreserved); if (dwReason == DLL_PROCESS_ATTACH && ! retcode) { diff --git a/lib/sdk/crt/startup/crtexe.c b/lib/sdk/crt/startup/crtexe.c index 6bee420c8dc..8d15e29ebc3 100644 --- a/lib/sdk/crt/startup/crtexe.c +++ b/lib/sdk/crt/startup/crtexe.c @@ -20,7 +20,7 @@ #include #include #include -#include +#include #ifndef __winitenv extern wchar_t *** __MINGW_IMP_SYMBOL(__winitenv); @@ -33,7 +33,7 @@ extern char *** __MINGW_IMP_SYMBOL(__initenv); #endif /* Hack, for bug in ld. Will be removed soon. */ -#ifndef _MSC_VER +#if defined(__GNUC__) #define __ImageBase __MINGW_LSYMBOL(_image_base__) #endif @@ -49,6 +49,8 @@ __declspec(dllimport) void __setusermatherr(int (__cdecl *)(struct _exception *) extern int * __MINGW_IMP_SYMBOL(_fmode); extern int * __MINGW_IMP_SYMBOL(_commode); +#undef _fmode +extern int _fmode; extern int * __MINGW_IMP_SYMBOL(_commode); #define _commode (* __MINGW_IMP_SYMBOL(_commode)) extern int _dowildcard; @@ -58,7 +60,9 @@ int _MINGW_INSTALL_DEBUG_MATHERR __attribute__((weak)) = 0; #else int __declspec(selectany) _MINGW_INSTALL_DEBUG_MATHERR = 0; #endif + extern int __defaultmatherr; + extern _CRTIMP void __cdecl _initterm(_PVFV *, _PVFV *); static int __cdecl check_managed_app (void); @@ -81,8 +85,13 @@ _TCHAR *__mingw_winmain_lpCmdLine; DWORD __mingw_winmain_nShowCmd; static int argc; -#ifdef WPRFLAG + +#if defined(__GNUC__) extern void __main(void); +extern void _pei386_runtime_relocator (void); +#endif + +#ifdef WPRFLAG static wchar_t **argv; static wchar_t **envp; #else @@ -95,10 +104,10 @@ static int mainret=0; static int managedapp; static int has_cctor = 0; static _startupinfo startinfo; -static LPTOP_LEVEL_EXCEPTION_FILTER __mingw_oldexcpt_handler = NULL; +extern LPTOP_LEVEL_EXCEPTION_FILTER __mingw_oldexcpt_handler; -extern void _pei386_runtime_relocator (void); -static long CALLBACK _gnu_exception_handler (EXCEPTION_POINTERS * exception_data); + +long CALLBACK _gnu_exception_handler (EXCEPTION_POINTERS * exception_data); #ifdef WPRFLAG static void duplicate_ppstrings (int ac, wchar_t ***av); #else @@ -131,11 +140,7 @@ pre_c_init (void) #endif if (_MINGW_INSTALL_DEBUG_MATHERR) { - if (! __defaultmatherr) - { - __setusermatherr (_matherr); - __defaultmatherr = 1; - } + __setusermatherr (_matherr); } if (__globallocalestatus == -1) @@ -162,9 +167,24 @@ int WinMainCRTStartup (void); int WinMainCRTStartup (void) { + int ret = 255; +#ifdef __SEH__ + asm ("\t.l_startw:\n" + "\t.seh_handler __C_specific_handler, @except\n" + "\t.seh_handlerdata\n" + "\t.long 1\n" + "\t.rva .l_startw, .l_endw, _gnu_exception_handler ,.l_endw\n" + "\t.text" + ); +#endif mingw_app_type = 1; __security_init_cookie (); - return __tmainCRTStartup (); + ret = __tmainCRTStartup (); +#ifdef __SEH__ + asm ("\tnop\n" + "\t.l_endw: nop\n"); +#endif + return ret; } int mainCRTStartup (void); @@ -175,9 +195,24 @@ int __mingw_init_ehandler (void); int mainCRTStartup (void) { + int ret = 255; +#ifdef __SEH__ + asm ("\t.l_start:\n" + "\t.seh_handler __C_specific_handler, @except\n" + "\t.seh_handlerdata\n" + "\t.long 1\n" + "\t.rva .l_start, .l_end, _gnu_exception_handler ,.l_end\n" + "\t.text" + ); +#endif mingw_app_type = 0; __security_init_cookie (); - return __tmainCRTStartup (); + ret = __tmainCRTStartup (); +#ifdef __SEH__ + asm ("\tnop\n" + "\t.l_end: nop\n"); +#endif + return ret; } static @@ -188,7 +223,16 @@ __tmainCRTStartup (void) STARTUPINFO StartupInfo; WINBOOL inDoubleQuote = FALSE; memset (&StartupInfo, 0, sizeof (STARTUPINFO)); - + +#if !defined(_WIN64) && defined(__GNUC__) + /* We need to make sure that this function is build with frame-pointer + and that we align the stack to 16 bytes for the sake of SSE ops in main + or in functions inlined into main. */ + lpszCommandLine = (_TCHAR *) alloca (32); + memset (lpszCommandLine, 0xcc, 32); + asm __volatile__ ("andl $-16, %%esp" : : : "%esp"); +#endif + if (mingw_app_type) GetStartupInfo (&StartupInfo); { @@ -229,9 +273,11 @@ __tmainCRTStartup (void) if (__dyn_tls_init_callback != NULL) __dyn_tls_init_callback (NULL, DLL_THREAD_ATTACH, NULL); +#if defined(__GNUC__) _pei386_runtime_relocator (); +#endif __mingw_oldexcpt_handler = SetUnhandledExceptionFilter (_gnu_exception_handler); -#ifdef _WIN64 +#if defined(_WIN64) && !defined(_MSC_VER) __mingw_init_ehandler (); #endif __mingw_prepare_except_for_msvcr80_and_higher (); @@ -241,37 +287,39 @@ __tmainCRTStartup (void) if (mingw_app_type) { #ifdef WPRFLAG - lpszCommandLine = (_TCHAR *) _wcmdln; + lpszCommandLine = (_TCHAR *) _wcmdln; #else - lpszCommandLine = (char *) _acmdln; + lpszCommandLine = (char *) _acmdln; #endif - while (*lpszCommandLine > SPACECHAR || (*lpszCommandLine&&inDoubleQuote)) - { - if (*lpszCommandLine == DQUOTECHAR) - inDoubleQuote = !inDoubleQuote; -#ifdef _MBCS - if (_ismbblead (*lpszCommandLine)) + while (*lpszCommandLine > SPACECHAR || (*lpszCommandLine && inDoubleQuote)) { - if (lpszCommandLine) /* FIXME: Why this check? Should I check for *lpszCommandLine != 0 too? */ - lpszCommandLine++; - } + if (*lpszCommandLine == DQUOTECHAR) + inDoubleQuote = !inDoubleQuote; +#ifdef _MBCS + if (_ismbblead (*lpszCommandLine)) + { + if (lpszCommandLine) /* FIXME: Why this check? Should I check for *lpszCommandLine != 0 too? */ + lpszCommandLine++; + } #endif - ++lpszCommandLine; - } - while (*lpszCommandLine && (*lpszCommandLine <= SPACECHAR)) - lpszCommandLine++; + ++lpszCommandLine; + } + while (*lpszCommandLine && (*lpszCommandLine <= SPACECHAR)) + lpszCommandLine++; - __mingw_winmain_hInstance = (HINSTANCE) &__ImageBase; - __mingw_winmain_lpCmdLine = lpszCommandLine; - __mingw_winmain_nShowCmd = StartupInfo.dwFlags & STARTF_USESHOWWINDOW ? - StartupInfo.wShowWindow : SW_SHOWDEFAULT; - } + __mingw_winmain_hInstance = (HINSTANCE) &__ImageBase; + __mingw_winmain_lpCmdLine = lpszCommandLine; + __mingw_winmain_nShowCmd = StartupInfo.dwFlags & STARTF_USESHOWWINDOW ? + StartupInfo.wShowWindow : SW_SHOWDEFAULT; + } duplicate_ppstrings (argc, &argv); +#if defined(__GNUC__) + __main (); +#endif #ifdef WPRFLAG __winitenv = envp; /* C++ initialization. gcc inserts this call automatically for a function called main, but not for wmain. */ - __main (); mainret = wmain (argc, argv, envp); #else __initenv = envp; @@ -329,97 +377,6 @@ check_managed_app (void) return 0; } -static long CALLBACK -_gnu_exception_handler (EXCEPTION_POINTERS *exception_data) -{ - void (*old_handler) (int); - long action = EXCEPTION_CONTINUE_SEARCH; - int reset_fpu = 0; - - switch (exception_data->ExceptionRecord->ExceptionCode) - { - case EXCEPTION_ACCESS_VIOLATION: - /* test if the user has set SIGSEGV */ - old_handler = signal (SIGSEGV, SIG_DFL); - if (old_handler == SIG_IGN) - { - /* this is undefined if the signal was raised by anything other - than raise (). */ - signal (SIGSEGV, SIG_IGN); - action = EXCEPTION_CONTINUE_EXECUTION; - } - else if (old_handler != SIG_DFL) - { - /* This means 'old' is a user defined function. Call it */ - (*old_handler) (SIGSEGV); - action = EXCEPTION_CONTINUE_EXECUTION; - } - break; - - case EXCEPTION_ILLEGAL_INSTRUCTION: - case EXCEPTION_PRIV_INSTRUCTION: - /* test if the user has set SIGILL */ - old_handler = signal (SIGILL, SIG_DFL); - if (old_handler == SIG_IGN) - { - /* this is undefined if the signal was raised by anything other - than raise (). */ - signal (SIGILL, SIG_IGN); - action = EXCEPTION_CONTINUE_EXECUTION; - } - else if (old_handler != SIG_DFL) - { - /* This means 'old' is a user defined function. Call it */ - (*old_handler) (SIGILL); - action = EXCEPTION_CONTINUE_EXECUTION; - } - break; - - case EXCEPTION_FLT_INVALID_OPERATION: - case EXCEPTION_FLT_DIVIDE_BY_ZERO: - case EXCEPTION_FLT_DENORMAL_OPERAND: - case EXCEPTION_FLT_OVERFLOW: - case EXCEPTION_FLT_UNDERFLOW: - case EXCEPTION_FLT_INEXACT_RESULT: - reset_fpu = 1; - /* fall through. */ - - case EXCEPTION_INT_DIVIDE_BY_ZERO: - /* test if the user has set SIGFPE */ - old_handler = signal (SIGFPE, SIG_DFL); - if (old_handler == SIG_IGN) - { - signal (SIGFPE, SIG_IGN); - if (reset_fpu) - _fpreset (); - action = EXCEPTION_CONTINUE_EXECUTION; - } - else if (old_handler != SIG_DFL) - { - /* This means 'old' is a user defined function. Call it */ - (*old_handler) (SIGFPE); - action = EXCEPTION_CONTINUE_EXECUTION; - } - break; -#ifdef _WIN64 - case EXCEPTION_DATATYPE_MISALIGNMENT: - case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: - case EXCEPTION_FLT_STACK_CHECK: - case EXCEPTION_INT_OVERFLOW: - case EXCEPTION_INVALID_HANDLE: - /*case EXCEPTION_POSSIBLE_DEADLOCK: */ - action = EXCEPTION_CONTINUE_EXECUTION; - break; -#endif - default: - break; - } - - if (action == EXCEPTION_CONTINUE_SEARCH && __mingw_oldexcpt_handler) - action = (*__mingw_oldexcpt_handler)(exception_data); - return action; -} - #ifdef WPRFLAG static size_t wbytelen(const wchar_t *p) { @@ -477,8 +434,8 @@ __mingw_invalidParameterHandler (const wchar_t * __UNUSED_PARAM_1(expression), uintptr_t __UNUSED_PARAM(pReserved)) { #ifdef __MINGW_SHOW_INVALID_PARAMETER_EXCEPTION - wprintf(L"Invalid parameter detected in function %s. File: %s Line: %d\n", function, file, line); - wprintf(L"Expression: %s\n", expression); + wprintf(L"Invalid parameter detected in function %s. File: %s Line: %d\n", function, file, line); + wprintf(L"Expression: %s\n", expression); #endif } diff --git a/lib/sdk/crt/startup/gccmain.c b/lib/sdk/crt/startup/gccmain.c index c046e8d77dc..a0e0483ff72 100644 --- a/lib/sdk/crt/startup/gccmain.c +++ b/lib/sdk/crt/startup/gccmain.c @@ -12,13 +12,6 @@ typedef void (*func_ptr) (void); extern func_ptr __CTOR_LIST__[]; extern func_ptr __DTOR_LIST__[]; -static HMODULE hMsvcrt = NULL; -static int free_Msvcrt = 0; - -typedef void __cdecl flongjmp(jmp_buf _Buf,int _Value); - -flongjmp *fctMsvcrtLongJmp = NULL; - void __do_global_dtors (void); void __do_global_ctors (void); void __main (void); @@ -33,12 +26,6 @@ __do_global_dtors (void) (*(p)) (); p++; } - if (free_Msvcrt && hMsvcrt) - { - free_Msvcrt = 0; - FreeLibrary (hMsvcrt); - hMsvcrt = NULL; - } } void @@ -47,19 +34,6 @@ __do_global_ctors (void) unsigned long nptrs = (unsigned long) (ptrdiff_t) __CTOR_LIST__[0]; unsigned long i; - if (!hMsvcrt) { - hMsvcrt = GetModuleHandleA ("msvcr80.dll"); - if (!hMsvcrt) - hMsvcrt = GetModuleHandleA ("msvcr70.dll"); - if (!hMsvcrt) - hMsvcrt = GetModuleHandleA ("msvcrt.dll"); - if (!hMsvcrt) { - hMsvcrt = LoadLibraryA ("msvcrt.dll"); - free_Msvcrt = 1; - } - fctMsvcrtLongJmp = (flongjmp *) GetProcAddress( hMsvcrt, "longjmp"); - } - if (nptrs == (unsigned long) -1) { for (nptrs = 0; __CTOR_LIST__[nptrs + 1] != 0; nptrs++); diff --git a/lib/sdk/crt/startup/gs_support.c b/lib/sdk/crt/startup/gs_support.c index dd072382339..8151fc3b542 100644 --- a/lib/sdk/crt/startup/gs_support.c +++ b/lib/sdk/crt/startup/gs_support.c @@ -23,11 +23,6 @@ #endif /* Externals. */ -#ifdef _WIN64 -PRUNTIME_FUNCTION RtlLookupFunctionEntry (ULONG64, PULONG64, PVOID); -PVOID RtlVirtualUnwind (ULONG HandlerType, ULONG64, ULONG64, PRUNTIME_FUNCTION, - PCONTEXT, PVOID *, PULONG64, PVOID); -#endif typedef LONG NTSTATUS; /* same as in ntdef.h / winternl.h */ diff --git a/lib/sdk/crt/startup/merr.c b/lib/sdk/crt/startup/merr.c index 0500021cd14..2728cdbcf6d 100644 --- a/lib/sdk/crt/startup/merr.c +++ b/lib/sdk/crt/startup/merr.c @@ -10,6 +10,31 @@ int __defaultmatherr = 0; +typedef int (__cdecl *fUserMathErr)(struct _exception *); +static fUserMathErr stUserMathErr; + +void __mingw_raise_matherr (int typ, const char *name, double a1, double a2, + double rslt) +{ + struct _exception ex; + if (!stUserMathErr) + return; + ex.type = typ; + ex.name = name; + ex.arg1 = a1; + ex.arg2 = a2; + ex.retval = rslt; + (*stUserMathErr)(&ex); +} + +#undef __setusermatherr + +void __mingw_setusermatherr (int (__cdecl *f)(struct _exception *)) +{ + stUserMathErr = f; + __setusermatherr (f); +} + int __CRTDECL _matherr (struct _exception *pexcept) { @@ -50,3 +75,4 @@ _matherr (struct _exception *pexcept) type, pexcept->name, pexcept->arg1, pexcept->arg2, pexcept->retval); return 0; } + diff --git a/lib/sdk/crt/startup/pesect.c b/lib/sdk/crt/startup/pesect.c new file mode 100644 index 00000000000..c24061fbe61 --- /dev/null +++ b/lib/sdk/crt/startup/pesect.c @@ -0,0 +1,186 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the w64 mingw-runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ + +#include +#include + +#if defined (_WIN64) && defined (__ia64__) +#error FIXME: Unsupported __ImageBase implementation. +#else +/* Hack, for bug in ld. Will be removed soon. */ +#ifndef _MSC_VER +#define __ImageBase __MINGW_LSYMBOL(_image_base__) +#endif +/* This symbol is defined by the linker. */ +extern IMAGE_DOS_HEADER __ImageBase; +#endif + +WINBOOL _ValidateImageBase (PBYTE); + +WINBOOL +_ValidateImageBase (PBYTE pImageBase) +{ + PIMAGE_DOS_HEADER pDOSHeader; + PIMAGE_NT_HEADERS pNTHeader; + PIMAGE_OPTIONAL_HEADER pOptHeader; + + pDOSHeader = (PIMAGE_DOS_HEADER) pImageBase; + if (pDOSHeader->e_magic != IMAGE_DOS_SIGNATURE) + return FALSE; + pNTHeader = (PIMAGE_NT_HEADERS) ((PBYTE) pDOSHeader + pDOSHeader->e_lfanew); + if (pNTHeader->Signature != IMAGE_NT_SIGNATURE) + return FALSE; + pOptHeader = (PIMAGE_OPTIONAL_HEADER) &pNTHeader->OptionalHeader; + if (pOptHeader->Magic != IMAGE_NT_OPTIONAL_HDR_MAGIC) + return FALSE; + return TRUE; +} + +PIMAGE_SECTION_HEADER _FindPESection (PBYTE, DWORD_PTR); + +PIMAGE_SECTION_HEADER +_FindPESection (PBYTE pImageBase, DWORD_PTR rva) +{ + PIMAGE_NT_HEADERS pNTHeader; + PIMAGE_SECTION_HEADER pSection; + unsigned int iSection; + + pNTHeader = (PIMAGE_NT_HEADERS) (pImageBase + ((PIMAGE_DOS_HEADER) pImageBase)->e_lfanew); + + for (iSection = 0, pSection = IMAGE_FIRST_SECTION (pNTHeader); + iSection < pNTHeader->FileHeader.NumberOfSections; + ++iSection,++pSection) + { + if (rva >= pSection->VirtualAddress + && rva < pSection->VirtualAddress + pSection->Misc.VirtualSize) + return pSection; + } + return NULL; +} + +PIMAGE_SECTION_HEADER _FindPESectionByName (const char *); + +PIMAGE_SECTION_HEADER +_FindPESectionByName (const char *pName) +{ + PBYTE pImageBase; + PIMAGE_NT_HEADERS pNTHeader; + PIMAGE_SECTION_HEADER pSection; + unsigned int iSection; + + /* Long names aren't supported. */ + if (strlen (pName) > IMAGE_SIZEOF_SHORT_NAME) + return NULL; + + pImageBase = (PBYTE) &__ImageBase; + if (! _ValidateImageBase (pImageBase)) + return NULL; + + pNTHeader = (PIMAGE_NT_HEADERS) (pImageBase + ((PIMAGE_DOS_HEADER) pImageBase)->e_lfanew); + + for (iSection = 0, pSection = IMAGE_FIRST_SECTION (pNTHeader); + iSection < pNTHeader->FileHeader.NumberOfSections; + ++iSection,++pSection) + { + if (!strncmp ((char *) &pSection->Name[0], pName, IMAGE_SIZEOF_SHORT_NAME)) + return pSection; + } + return NULL; +} + +int __mingw_GetSectionCount (void); +PIMAGE_SECTION_HEADER __mingw_GetSectionForAddress (LPVOID p); + +PIMAGE_SECTION_HEADER +__mingw_GetSectionForAddress (LPVOID p) +{ + PBYTE pImageBase; + DWORD_PTR rva; + + pImageBase = (PBYTE) &__ImageBase; + if (! _ValidateImageBase (pImageBase)) + return NULL; + + rva = (DWORD_PTR) (((PBYTE) p) - pImageBase); + return _FindPESection (pImageBase, rva); +} + +int +__mingw_GetSectionCount (void) +{ + PBYTE pImageBase; + PIMAGE_NT_HEADERS pNTHeader; + + pImageBase = (PBYTE) &__ImageBase; + if (! _ValidateImageBase (pImageBase)) + return 0; + + pNTHeader = (PIMAGE_NT_HEADERS) (pImageBase + ((PIMAGE_DOS_HEADER) pImageBase)->e_lfanew); + + return (int) pNTHeader->FileHeader.NumberOfSections; +} + + +PIMAGE_SECTION_HEADER _FindPESectionExec (size_t); + +PIMAGE_SECTION_HEADER +_FindPESectionExec (size_t eNo) +{ + PBYTE pImageBase; + PIMAGE_NT_HEADERS pNTHeader; + PIMAGE_SECTION_HEADER pSection; + unsigned int iSection; + + pImageBase = (PBYTE) &__ImageBase; + if (! _ValidateImageBase (pImageBase)) + return NULL; + + pNTHeader = (PIMAGE_NT_HEADERS) (pImageBase + ((PIMAGE_DOS_HEADER) pImageBase)->e_lfanew); + + for (iSection = 0, pSection = IMAGE_FIRST_SECTION (pNTHeader); + iSection < pNTHeader->FileHeader.NumberOfSections; + ++iSection,++pSection) + { + if ((pSection->Characteristics & IMAGE_SCN_MEM_EXECUTE) != 0) + { + if (!eNo) + return pSection; + --eNo; + } + } + return NULL; +} + +PBYTE _GetPEImageBase (void); + +PBYTE +_GetPEImageBase (void) +{ + PBYTE pImageBase; + pImageBase = (PBYTE) &__ImageBase; + if (! _ValidateImageBase (pImageBase)) + return NULL; + return pImageBase; +} + +WINBOOL _IsNonwritableInCurrentImage (PBYTE); + +WINBOOL +_IsNonwritableInCurrentImage (PBYTE pTarget) +{ + PBYTE pImageBase; + DWORD_PTR rvaTarget; + PIMAGE_SECTION_HEADER pSection; + + pImageBase = (PBYTE) &__ImageBase; + if (! _ValidateImageBase (pImageBase)) + return FALSE; + rvaTarget = pTarget - pImageBase; + pSection = _FindPESection (pImageBase, rvaTarget); + if (pSection == NULL) + return FALSE; + return (pSection->Characteristics & IMAGE_SCN_MEM_WRITE) == 0; +} diff --git a/lib/sdk/crt/startup/pseudo-reloc.c b/lib/sdk/crt/startup/pseudo-reloc.c index d87b3dc5709..61cc7123176 100644 --- a/lib/sdk/crt/startup/pseudo-reloc.c +++ b/lib/sdk/crt/startup/pseudo-reloc.c @@ -158,6 +158,87 @@ __report_error (const char *msg, ...) #endif } +/* For mingw-w64 we have additional helpers to get image information + on runtime. This allows us to cache for pseudo-relocation pass + the temporary access of code/read-only sections. + This step speeds up pseudo-relocation pass. */ +#ifdef __MINGW64_VERSION_MAJOR +extern int __mingw_GetSectionCount (void); +extern PIMAGE_SECTION_HEADER __mingw_GetSectionForAddress (LPVOID p); +extern PBYTE _GetPEImageBase (void); + +typedef struct sSecInfo { + /* Keeps altered section flags, or zero if nothing was changed. */ + DWORD old_protect; + PBYTE sec_start; + PIMAGE_SECTION_HEADER hash; +} sSecInfo; + +static sSecInfo *the_secs = NULL; +static int maxSections = 0; + +static void +mark_section_writable (LPVOID addr) +{ + MEMORY_BASIC_INFORMATION b; + PIMAGE_SECTION_HEADER h; + int i; + + for (i = 0; i < maxSections; i++) + { + if (the_secs[i].sec_start <= ((LPBYTE) addr) + && ((LPBYTE) addr) < (the_secs[i].sec_start + the_secs[i].hash->Misc.VirtualSize)) + return; + } + h = __mingw_GetSectionForAddress (addr); + if (!h) + { + __report_error ("Address %p has no image-section", addr); + return; + } + the_secs[i].hash = h; + the_secs[i].old_protect = 0; + the_secs[i].sec_start = _GetPEImageBase () + h->VirtualAddress; + + if (!VirtualQuery (the_secs[i].sec_start, &b, sizeof(b))) + { + __report_error (" VirtualQuery failed for %d bytes at address %p", + (int) h->Misc.VirtualSize, the_secs[i].sec_start); + return; + } + + if (b.Protect != PAGE_EXECUTE_READWRITE && b.Protect != PAGE_READWRITE) + VirtualProtect (b.BaseAddress, b.RegionSize, PAGE_EXECUTE_READWRITE, + &the_secs[i].old_protect); + ++maxSections; + return; +} + +static void +restore_modified_sections (void) +{ + int i; + MEMORY_BASIC_INFORMATION b; + DWORD oldprot; + + for (i = 0; i < maxSections; i++) + { + if (the_secs[i].old_protect == 0) + continue; + if (!VirtualQuery (the_secs[i].sec_start, &b, sizeof(b))) + { + __report_error (" VirtualQuery failed for %d bytes at address %p", + (int) the_secs[i].hash->Misc.VirtualSize, + the_secs[i].sec_start); + return; + } + VirtualProtect (b.BaseAddress, b.RegionSize, the_secs[i].old_protect, + &oldprot); + } +} + +#endif /* __MINGW64_VERSION_MAJOR */ + /* This function temporarily marks the page containing addr * writable, before copying len bytes from *src to *addr, and * then restores the original protection settings to the page. @@ -174,12 +255,15 @@ __report_error (const char *msg, ...) static void __write_memory (void *addr, const void *src, size_t len) { +#ifndef __MINGW64_VERSION_MAJOR MEMORY_BASIC_INFORMATION b; DWORD oldprot; +#endif /* ! __MINGW64_VERSION_MAJOR */ if (!len) return; +#ifndef __MINGW64_VERSION_MAJOR if (!VirtualQuery (addr, &b, sizeof(b))) { __report_error (" VirtualQuery failed for %d bytes at address %p", @@ -189,12 +273,18 @@ __write_memory (void *addr, const void *src, size_t len) /* Temporarily allow write access to read-only protected memory. */ if (b.Protect != PAGE_EXECUTE_READWRITE && b.Protect != PAGE_READWRITE) VirtualProtect (b.BaseAddress, b.RegionSize, PAGE_EXECUTE_READWRITE, - &oldprot); + &oldprot); +#else /* ! __MINGW64_VERSION_MAJOR */ + mark_section_writable ((LPVOID) addr); +#endif /* __MINGW64_VERSION_MAJOR */ + /* write the data. */ memcpy (addr, src, len); /* Restore original protection. */ +#ifndef __MINGW64_VERSION_MAJOR if (b.Protect != PAGE_EXECUTE_READWRITE && b.Protect != PAGE_READWRITE) VirtualProtect (b.BaseAddress, b.RegionSize, oldprot, &oldprot); +#endif /* !__MINGW64_VERSION_MAJOR */ } #define RP_VERSION_V1 0 @@ -361,10 +451,23 @@ void _pei386_runtime_relocator (void) { static NO_COPY int was_init = 0; +#ifdef __MINGW64_VERSION_MAJOR + int mSecs; +#endif /* __MINGW64_VERSION_MAJOR */ + if (was_init) return; ++was_init; +#ifdef __MINGW64_VERSION_MAJOR + mSecs = __mingw_GetSectionCount (); + the_secs = (sSecInfo *) alloca (sizeof (sSecInfo) * (size_t) mSecs); + maxSections = 0; +#endif /* __MINGW64_VERSION_MAJOR */ + do_pseudo_reloc (&__RUNTIME_PSEUDO_RELOC_LIST__, &__RUNTIME_PSEUDO_RELOC_LIST_END__, - &__ImageBase); + &__MINGW_LSYMBOL(_image_base__)); +#ifdef __MINGW64_VERSION_MAJOR + restore_modified_sections (); +#endif /* __MINGW64_VERSION_MAJOR */ } diff --git a/lib/sdk/crt/startup/tlssup.c b/lib/sdk/crt/startup/tlssup.c index 1c32d0d62a6..3a0e63518d0 100644 --- a/lib/sdk/crt/startup/tlssup.c +++ b/lib/sdk/crt/startup/tlssup.c @@ -50,18 +50,11 @@ _CRTALLOC(".tls$ZZZ") char _tls_end = 0; _CRTALLOC(".CRT$XLA") PIMAGE_TLS_CALLBACK __xl_a = 0; _CRTALLOC(".CRT$XLZ") PIMAGE_TLS_CALLBACK __xl_z = 0; -#ifdef _WIN64 -_CRTALLOC(".tls") const IMAGE_TLS_DIRECTORY64 _tls_used = { - (ULONGLONG) &_tls_start+1, (ULONGLONG) &_tls_end, (ULONGLONG) &_tls_index, - (ULONGLONG) (&__xl_a+1), (ULONG) 0, (ULONG) 0 -}; -#else _CRTALLOC(".tls") const IMAGE_TLS_DIRECTORY _tls_used = { - (ULONG)(ULONG_PTR) &_tls_start+1, (ULONG)(ULONG_PTR) &_tls_end, - (ULONG)(ULONG_PTR) &_tls_index, (ULONG)(ULONG_PTR) (&__xl_a+1), + (ULONG_PTR) &_tls_start+1, (ULONG_PTR) &_tls_end, + (ULONG_PTR) &_tls_index, (ULONG_PTR) (&__xl_a+1), (ULONG) 0, (ULONG) 0 }; -#endif #ifndef __CRT_THREAD #ifdef HAVE_ATTRIBUTE_THREAD @@ -99,6 +92,7 @@ BOOL WINAPI __dyn_tls_init (HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved) { _PVFV *pfunc; + uintptr_t ps; #ifndef _WIN64 if (_winmajor < 4) @@ -135,8 +129,11 @@ __dyn_tls_init (HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved) return TRUE; } - for (pfunc = &__xd_a + 1; pfunc != &__xd_z; ++pfunc) + ps = (uintptr_t) &__xd_a; + ps += sizeof (uintptr_t); + for ( ; ps != (uintptr_t) &__xd_z; ps += sizeof (uintptr_t)) { + pfunc = (_PVFV *) ps; if (*pfunc != NULL) (*pfunc)(); } diff --git a/lib/sdk/crt/stdio/_flsbuf.c b/lib/sdk/crt/stdio/_flsbuf.c index c2b7df29d4c..8eeeba1125a 100644 --- a/lib/sdk/crt/stdio/_flsbuf.c +++ b/lib/sdk/crt/stdio/_flsbuf.c @@ -24,6 +24,9 @@ _flsbuf(int ch, FILE *stream) return EOF; } + /* Always reset _cnt */ + stream->_cnt = 0; + /* Check if this was a read buffer */ if (stream->_flag & _IOREAD) { @@ -31,7 +34,6 @@ _flsbuf(int ch, FILE *stream) if (!(stream->_flag & _IOEOF)) { stream->_flag |= _IOERR; - stream->_cnt = 0; return EOF; } @@ -43,16 +45,17 @@ _flsbuf(int ch, FILE *stream) stream->_flag &= ~(_IOREAD|_IOEOF); stream->_flag |= _IOWRT; - /* If we have no buffer, try to allocate one */ - if (!stream->_base && stream != stdout && stream != stderr) + /* Check if should get a buffer */ + if (!(stream->_flag & _IONBF) && stream != stdout && stream != stderr) { - alloc_buffer(stream); + /* If we have no buffer, try to allocate one */ + if (!stream->_base) alloc_buffer(stream); } - /* Check if we have a buffer now */ - if (stream->_base) + /* Check if we can use a buffer now */ + if (stream->_base && !(stream->_flag & _IONBF)) { - /* We have one, check if there is something to write */ + /* We can, check if there is something to write */ count = stream->_ptr - stream->_base; if (count > 0) written = _write(stream->_file, stream->_base, count); diff --git a/lib/sdk/crt/string/atol.c b/lib/sdk/crt/string/atol.c index b66d1767d77..c05a72f8312 100644 --- a/lib/sdk/crt/string/atol.c +++ b/lib/sdk/crt/string/atol.c @@ -9,14 +9,9 @@ long atol(const char *str) return (long)_atoi64(str); } -long _wtol(const wchar_t *str) -{ - return (long)_wtoi64(str); -} - int _atoldbl(_LDOUBLE *value, char *str) { /* FIXME needs error checking for huge/small values */ //*value = strtold(str,0); return -1; -} \ No newline at end of file +} diff --git a/lib/sdk/crt/string/splitp.c b/lib/sdk/crt/string/splitp.c index ea41fb08c03..b12cee28ce5 100644 --- a/lib/sdk/crt/string/splitp.c +++ b/lib/sdk/crt/string/splitp.c @@ -1,3 +1,10 @@ +/* + * PROJECT: ReactOS Kernel + * LICENSE: BSD - See COPYING.ARM in the top level directory + * PURPOSE: CRT: implementation of _splitpath / _wsplitpath + * PROGRAMMERS: Timo Kreuzer + */ + #include #include @@ -6,64 +13,74 @@ */ void _tsplitpath(const _TCHAR* path, _TCHAR* drive, _TCHAR* dir, _TCHAR* fname, _TCHAR* ext) { - _TCHAR* tmp_drive = NULL; - _TCHAR* tmp_dir = NULL; - _TCHAR* tmp_ext = NULL; + const _TCHAR *src, *dir_start, *file_start = 0, *ext_start = 0; - tmp_drive = (_TCHAR*)_tcschr(path,':'); - if (drive) + /* Truncate all output strings */ + if (drive) drive[0] = '\0'; + if (dir) dir[0] = '\0'; + if (fname) fname[0] = '\0'; + if (ext) ext[0] = '\0'; + + /* Check parameter */ + if (!path) { - if (tmp_drive) - { - _tcsncpy(drive,tmp_drive-1,2); - *(drive+2) = 0; - } - else - { - *drive = 0; - } - } - if (!tmp_drive) - { - tmp_drive = (_TCHAR*)path - 1; +#ifndef _LIBCNT_ + __set_errno(EINVAL); +#endif + return; } - tmp_dir = (_TCHAR*)_tcsrchr(path,'\\'); - if (dir) + /* Skip '\\?\' prefix */ + if ((path[0] == '\\') && (path[1] == '\\') && + (path[2] == '?') && (path[3] == '\\')) path += 4; + + if (path[0] == '\0') return; + + /* Check if we have a drive letter (only 1 char supported) */ + if (path[1] == ':') { - if (tmp_dir) + if (drive) { - _tcsncpy(dir,tmp_drive+1,tmp_dir-tmp_drive); - *(dir+(tmp_dir-tmp_drive)) = 0; - } - else - { - *dir =0; + drive[0] = path[0]; + drive[1] = ':'; + drive[2] = '\0'; } + path += 2; + } + + /* Scan the rest of the string */ + dir_start = path; + while (*path != '\0') + { + /* Remember last path seperator and last dot */ + if ((*path == '\\') || (*path == '/')) file_start = path + 1; + if (*path == '.') ext_start = path; + path++; } - /* If the dot is before the last dir separator, it's part - * of a directory name, not the start of the extension */ - if (!tmp_ext || tmp_ext < tmp_dir) + /* Check if we got a file name / extension */ + if (!file_start) file_start = path; + if (!ext_start || ext_start < file_start) ext_start = path; + + if (dir) { - tmp_ext = (_TCHAR*)path+_tcslen(path); - } - if (ext) - { - _tcscpy(ext,tmp_ext); + src = dir_start; + while (src < file_start) *dir++ = *src++; + *dir = '\0'; } - if (fname) + if (fname) { - if (tmp_dir) - { - _tcsncpy(fname,tmp_dir+1,tmp_ext-tmp_dir-1); - *(fname+(tmp_ext-tmp_dir-1)) = 0; - } - else - { - _tcsncpy(fname,tmp_drive+1,tmp_ext-tmp_drive-1); - *(fname+(tmp_ext-path))=0; - } + src = file_start; + while (src < ext_start) *fname++ = *src++; + *fname = '\0'; + } + + if (ext) + { + src = ext_start; + while (*src != '\0') *ext++ = *src++; + *ext = '\0'; } } + diff --git a/lib/sdk/nt/entry_point.c b/lib/sdk/nt/entry_point.c index 01255a9cedb..5cf7ef6d1e2 100644 --- a/lib/sdk/nt/entry_point.c +++ b/lib/sdk/nt/entry_point.c @@ -13,7 +13,8 @@ #include #include #define NTOS_MODE_USER -#include +#include +#include NTSTATUS __cdecl diff --git a/lib/smlib/CMakeLists.txt b/lib/smlib/CMakeLists.txt index 1151b92dde7..2bcda9d48c8 100644 --- a/lib/smlib/CMakeLists.txt +++ b/lib/smlib/CMakeLists.txt @@ -1,6 +1,4 @@ -add_definitions(-D_DLL -D__USE_CRTIMP) - include_directories(${REACTOS_SOURCE_DIR}/include/reactos/subsys) list(APPEND SOURCE @@ -10,4 +8,5 @@ list(APPEND SOURCE lookupss.c) add_library(smlib ${SOURCE}) +add_pch(smlib precomp.h) add_dependencies(smlib psdk) diff --git a/lib/smlib/precomp.h b/lib/smlib/precomp.h index efb3720aaf4..49da659bf1a 100644 --- a/lib/smlib/precomp.h +++ b/lib/smlib/precomp.h @@ -12,7 +12,11 @@ #define WIN32_NO_STATUS #include #define NTOS_MODE_USER -#include +#include +#include +#include +#include +#include #include diff --git a/media/doc/README.WINE b/media/doc/README.WINE index 1385a5967a6..47db38e01dd 100644 --- a/media/doc/README.WINE +++ b/media/doc/README.WINE @@ -187,6 +187,8 @@ reactos/dll/win32/xinput1_3 # Autosync reactos/dll/win32/xinput9_1_0 # Autosync reactos/dll/win32/xmllite # Autosync +reactos/dll/cpl/inetcpl # Synced to Wine-1.3.21 + ReactOS shares the following programs with Winehq. reactos/base/applications/cmdutils/xcopy # Autosync diff --git a/media/inf/CMakeLists.txt b/media/inf/CMakeLists.txt index f21f8eb15ba..716ed694c93 100644 --- a/media/inf/CMakeLists.txt +++ b/media/inf/CMakeLists.txt @@ -5,9 +5,11 @@ list(APPEND INF_FILES bda.inf cdrom.inf cpu.inf + disk.inf display.inf fdc.inf font.inf + hal.inf hdc.inf intl.inf keyboard.inf @@ -23,6 +25,7 @@ list(APPEND INF_FILES nettcpip.inf ports.inf scsi.inf + unknown.inf usb.inf usbport.inf usbstor.inf diff --git a/media/inf/disk.inf b/media/inf/disk.inf new file mode 100644 index 00000000000..64ef86f0679 Binary files /dev/null and b/media/inf/disk.inf differ diff --git a/media/inf/hal.inf b/media/inf/hal.inf new file mode 100644 index 00000000000..628ed703151 Binary files /dev/null and b/media/inf/hal.inf differ diff --git a/media/inf/hdc.inf b/media/inf/hdc.inf index 7c8aa5245fd..88efbc0e5ff 100644 Binary files a/media/inf/hdc.inf and b/media/inf/hdc.inf differ diff --git a/media/inf/inf.rbuild b/media/inf/inf.rbuild index 4acd24b101f..da6f3876c56 100644 --- a/media/inf/inf.rbuild +++ b/media/inf/inf.rbuild @@ -7,9 +7,11 @@ bda.inf cdrom.inf cpu.inf + disk.inf display.inf fdc.inf font.inf + hal.inf hdc.inf intl.inf keyboard.inf @@ -26,6 +28,7 @@ ports.inf scsi.inf syssetup.inf + unknown.inf usb.inf usbport.inf usbstor.inf diff --git a/media/inf/ports.inf b/media/inf/ports.inf index ebe6dfa00d8..4589d3b1113 100644 Binary files a/media/inf/ports.inf and b/media/inf/ports.inf differ diff --git a/media/inf/syssetup.inf b/media/inf/syssetup.inf index f293c265a58..34c63dfb4fe 100644 --- a/media/inf/syssetup.inf +++ b/media/inf/syssetup.inf @@ -5,6 +5,7 @@ ClassGUID = {00000000-0000-0000-0000-000000000000} [DeviceInfsToInstall] battery.inf cdrom.inf +disk.inf display.inf fdc.inf hdc.inf @@ -14,6 +15,7 @@ msmouse.inf NET_NIC.inf ports.inf scsi.inf +unknown.inf usbport.inf audio.inf ks.inf diff --git a/media/inf/syssetup.inf.tpl b/media/inf/syssetup.inf.tpl index f1c7ff67ce6..420669743ec 100644 --- a/media/inf/syssetup.inf.tpl +++ b/media/inf/syssetup.inf.tpl @@ -16,8 +16,10 @@ ClassGUID={00000000-0000-0000-0000-000000000000} ; we use a separate one to keep things clean battery.inf cdrom.inf +disk.inf display.inf fdc.inf +hal.inf hdc.inf keyboard.inf machine.inf @@ -25,6 +27,7 @@ msmouse.inf NET_NIC.inf ports.inf scsi.inf +unknown.inf usbport.inf audio.inf ks.inf diff --git a/media/inf/unknown.inf b/media/inf/unknown.inf new file mode 100644 index 00000000000..65494da18d9 Binary files /dev/null and b/media/inf/unknown.inf differ diff --git a/media/vgafonts/CMakeLists.txt b/media/vgafonts/CMakeLists.txt index b3ae7540c8e..9ca1ccac40c 100644 --- a/media/vgafonts/CMakeLists.txt +++ b/media/vgafonts/CMakeLists.txt @@ -12,7 +12,7 @@ list(APPEND SOURCE add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/vgafonts.cab COMMAND native-cabman -M raw -S ${CMAKE_CURRENT_BINARY_DIR}/vgafonts.cab ${SOURCE} - DEPENDS ${SOURCE}) + DEPENDS ${SOURCE} native-cabman) add_custom_target(vgafonts DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/vgafonts.cab) diff --git a/ntoskrnl/CMakeLists.txt b/ntoskrnl/CMakeLists.txt index 4ad133b4a22..f970b480d41 100644 --- a/ntoskrnl/CMakeLists.txt +++ b/ntoskrnl/CMakeLists.txt @@ -83,12 +83,12 @@ list(APPEND SOURCE ex/event.c ex/evtpair.c ex/exintrin.c - ex/fastinterlck.c ex/fmutex.c ex/handle.c ex/harderr.c ex/hdlsterm.c ex/init.c + ex/interlocked.c ex/keyedevt.c ex/locale.c ex/lookas.c @@ -276,10 +276,8 @@ list(APPEND SOURCE if(ARCH MATCHES i386) list(APPEND SOURCE config/i386/cmhardwr.c - ex/i386/interlck_asm.S ex/i386/fastinterlck_asm.S ex/i386/ioport.S - ke/freeldr.c ke/i386/abios.c ke/i386/cpu.c ke/i386/context.c @@ -306,7 +304,6 @@ if(ARCH MATCHES i386) elseif(ARCH MATCHES amd64) list(APPEND SOURCE config/i386/cmhardwr.c - ex/amd64/fastinterlck.c ke/amd64/boot.S ke/amd64/context.c ke/amd64/cpu.c @@ -421,9 +418,13 @@ else() # _WINKD_ endif() -add_executable(ntoskrnl ${CMAKE_CURRENT_BINARY_DIR}/ntoskrnl_ntoskrnl.h.gch ${SOURCE}) +add_executable(ntoskrnl ${SOURCE}) -set_entrypoint(ntoskrnl KiSystemStartup@4) +if (ARCH MATCHES i386) + set_entrypoint(ntoskrnl KiSystemStartup@4) +else() + set_entrypoint(ntoskrnl KiSystemStartup) +endif() set_subsystem(ntoskrnl native) if(MSVC) @@ -445,11 +446,10 @@ target_link_libraries(ntoskrnl add_importlibs(ntoskrnl hal kdcom bootvid) -add_pch(ntoskrnl ${CMAKE_CURRENT_SOURCE_DIR}/include/ntoskrnl.h ${SOURCE}) +add_pch(ntoskrnl include/ntoskrnl.h) add_dependencies(ntoskrnl psdk bugcodes asm) add_cd_file(TARGET ntoskrnl DESTINATION reactos/system32 NO_CAB FOR all) add_importlib_target(ntoskrnl.spec) add_library(ntdllsys ntdll.S) -set_target_properties(ntdllsys PROPERTIES LINKER_LANGUAGE C) diff --git a/ntoskrnl/cache/newcc.h b/ntoskrnl/cache/newcc.h index ab93976f724..cbe95caa7c9 100644 --- a/ntoskrnl/cache/newcc.h +++ b/ntoskrnl/cache/newcc.h @@ -75,7 +75,7 @@ CcInitializeCacheManager(VOID); VOID NTAPI -CcShutdownSystem(); +CcShutdownSystem(VOID); VOID NTAPI diff --git a/ntoskrnl/cache/section/data.c b/ntoskrnl/cache/section/data.c index 4e2d81bcc32..f168d62b835 100644 --- a/ntoskrnl/cache/section/data.c +++ b/ntoskrnl/cache/section/data.c @@ -58,7 +58,6 @@ extern KSPIN_LOCK MiSectionPageTableLock; /* GLOBALS *******************************************************************/ ULONG_PTR MmSubsectionBase; -BOOLEAN MmAllocationFragment; NTSTATUS NTAPI @@ -307,7 +306,7 @@ MmFinalizeSegment(PMM_CACHE_SECTION_SEGMENT Segment) MmUnlockCacheSectionSegment(Segment); } DPRINTC("Segment %x destroy\n", Segment); - ExFreePool(Segment); + ExFreePoolWithTag(Segment, TAG_MM_SECTION_SEGMENT); } NTSTATUS diff --git a/ntoskrnl/cache/section/io.c b/ntoskrnl/cache/section/io.c index a49e1820a62..951bd23445f 100644 --- a/ntoskrnl/cache/section/io.c +++ b/ntoskrnl/cache/section/io.c @@ -71,16 +71,17 @@ MiSimpleReadComplete PIRP Irp, PVOID Context) { + PMDL Mdl = Irp->MdlAddress; + /* Unlock MDL Pages, page 167. */ DPRINT("MiSimpleReadComplete %x\n", Irp); - PMDL Mdl = Irp->MdlAddress; while (Mdl) { DPRINT("MDL Unlock %x\n", Mdl); MmUnlockPages(Mdl); Mdl = Mdl->Next; } - + /* Check if there's an MDL */ while ((Mdl = Irp->MdlAddress)) { @@ -95,9 +96,9 @@ MiSimpleReadComplete NTSTATUS NTAPI MiSimpleRead -(PFILE_OBJECT FileObject, +(PFILE_OBJECT FileObject, PLARGE_INTEGER FileOffset, - PVOID Buffer, + PVOID Buffer, ULONG Length, #ifdef __ROS_CMAKE__ BOOLEAN Paging, @@ -109,28 +110,28 @@ MiSimpleRead KEVENT ReadWait; PDEVICE_OBJECT DeviceObject; PIO_STACK_LOCATION IrpSp; - + ASSERT(FileObject); ASSERT(FileOffset); ASSERT(Buffer); ASSERT(ReadStatus); - + DeviceObject = MmGetDeviceObjectForFile(FileObject); ReadStatus->Status = STATUS_INTERNAL_ERROR; ReadStatus->Information = 0; - + ASSERT(DeviceObject); DPRINT - ("PAGING READ: FileObject %x <%wZ> Offset %08x%08x Length %d\n", - &FileObject, + ("PAGING READ: FileObject %x <%wZ> Offset %08x%08x Length %d\n", + &FileObject, &FileObject->FileName, FileOffset->HighPart, FileOffset->LowPart, Length); KeInitializeEvent(&ReadWait, NotificationEvent, FALSE); - + Irp = IoBuildAsynchronousFsdRequest (IRP_MJ_READ, DeviceObject, @@ -138,7 +139,7 @@ MiSimpleRead Length, FileOffset, ReadStatus); - + if (!Irp) { return STATUS_NO_MEMORY; @@ -168,10 +169,10 @@ MiSimpleRead DPRINT1("KeWaitForSingleObject(&ReadWait)\n"); if (!NT_SUCCESS (KeWaitForSingleObject - (&ReadWait, - Suspended, - KernelMode, - FALSE, + (&ReadWait, + Suspended, + KernelMode, + FALSE, NULL))) { DPRINT1("Warning: Failed to wait for synchronous IRP\n"); @@ -179,10 +180,10 @@ MiSimpleRead return Status; } } - + DPRINT("Paging IO Done: %08x\n", ReadStatus->Status); - Status = - ReadStatus->Status == STATUS_END_OF_FILE ? + Status = + ReadStatus->Status == STATUS_END_OF_FILE ? STATUS_SUCCESS : ReadStatus->Status; return Status; } @@ -190,9 +191,9 @@ MiSimpleRead NTSTATUS NTAPI _MiSimpleWrite -(PFILE_OBJECT FileObject, +(PFILE_OBJECT FileObject, PLARGE_INTEGER FileOffset, - PVOID Buffer, + PVOID Buffer, ULONG Length, PIO_STATUS_BLOCK ReadStatus, const char *File, @@ -203,24 +204,24 @@ _MiSimpleWrite KEVENT ReadWait; PDEVICE_OBJECT DeviceObject; PIO_STACK_LOCATION IrpSp; - + ASSERT(FileObject); ASSERT(FileOffset); ASSERT(Buffer); ASSERT(ReadStatus); - + ObReferenceObject(FileObject); DeviceObject = MmGetDeviceObjectForFile(FileObject); ASSERT(DeviceObject); - + DPRINT - ("PAGING WRITE: FileObject %x Offset %x Length %d (%s:%d)\n", - &FileObject, + ("PAGING WRITE: FileObject %x Offset %x Length %d (%s:%d)\n", + &FileObject, FileOffset->LowPart, Length, File, Line); - + KeInitializeEvent(&ReadWait, NotificationEvent, FALSE); Irp = IoBuildAsynchronousFsdRequest @@ -230,15 +231,15 @@ _MiSimpleWrite Length, FileOffset, ReadStatus); - + if (!Irp) { ObDereferenceObject(FileObject); return STATUS_NO_MEMORY; } - + Irp->Flags = IRP_PAGING_IO | IRP_SYNCHRONOUS_PAGING_IO | IRP_NOCACHE | IRP_SYNCHRONOUS_API; - + Irp->UserEvent = &ReadWait; Irp->Tail.Overlay.OriginalFileObject = FileObject; Irp->Tail.Overlay.Thread = PsGetCurrentThread(); @@ -246,7 +247,7 @@ _MiSimpleWrite IrpSp->Control |= SL_INVOKE_ON_SUCCESS | SL_INVOKE_ON_ERROR; IrpSp->FileObject = FileObject; IrpSp->CompletionRoutine = MiSimpleReadComplete; - + DPRINT("Call Driver\n"); Status = IoCallDriver(DeviceObject, Irp); DPRINT("Status %x\n", Status); @@ -258,10 +259,10 @@ _MiSimpleWrite DPRINT1("KeWaitForSingleObject(&ReadWait)\n"); if (!NT_SUCCESS (KeWaitForSingleObject - (&ReadWait, - Suspended, - KernelMode, - FALSE, + (&ReadWait, + Suspended, + KernelMode, + FALSE, NULL))) { DPRINT1("Warning: Failed to wait for synchronous IRP\n"); @@ -269,7 +270,7 @@ _MiSimpleWrite return Status; } } - + DPRINT("Paging IO Done: %08x\n", ReadStatus->Status); return ReadStatus->Status; } @@ -295,11 +296,11 @@ _MiWriteBackPage if (!PageBuffer) return STATUS_NO_MEMORY; - OldIrql = KfRaiseIrql(DISPATCH_LEVEL); + KeRaiseIrql(DISPATCH_LEVEL, &OldIrql); Hyperspace = MmCreateHyperspaceMapping(Page); RtlCopyMemory(PageBuffer, Hyperspace, PAGE_SIZE); MmDeleteHyperspaceMapping(Hyperspace); - KfLowerIrql(OldIrql); + KeLowerIrql(OldIrql); DPRINT1("MiWriteBackPage(%wZ,%08x%08x,%s:%d)\n", &FileObject->FileName, FileOffset->u.HighPart, FileOffset->u.LowPart, File, Line); Status = MiSimpleWrite @@ -310,7 +311,7 @@ _MiWriteBackPage &Iosb); ExFreePool(PageBuffer); - + if (!NT_SUCCESS(Status)) { DPRINT1("MiSimpleWrite failed (%x)\n", Status); diff --git a/ntoskrnl/cc/copy.c b/ntoskrnl/cc/copy.c index 7e3d401d488..7162b6ab74e 100644 --- a/ntoskrnl/cc/copy.c +++ b/ntoskrnl/cc/copy.c @@ -255,7 +255,7 @@ WriteCacheSegment(PCACHE_SEGMENT CacheSeg) // MmGlobalPageDirectory and the real system PDE directory. What a mess... // { - int i = 0; + ULONG i = 0; do { MmGetPfnForProcess(NULL, (PVOID)((ULONG_PTR)CacheSeg->BaseAddress + (i << PAGE_SHIFT))); diff --git a/ntoskrnl/config/cmboot.c b/ntoskrnl/config/cmboot.c index 1416c4dfe01..6af7e3c16f6 100644 --- a/ntoskrnl/config/cmboot.c +++ b/ntoskrnl/config/cmboot.c @@ -12,7 +12,11 @@ #include "ntoskrnl.h" #define NDEBUG #include "debug.h" - + +/* GLOBALS ********************************************************************/ + +extern ULONG InitSafeBootMode; + /* FUNCTIONS ******************************************************************/ HCELL_INDEX @@ -383,6 +387,7 @@ CmpFindDrivers(IN PHHIVE Hive, IN PLIST_ENTRY DriverListHead) { HCELL_INDEX ServicesCell, ControlCell, GroupOrderCell, DriverCell; + HCELL_INDEX SafeBootCell = HCELL_NIL; UNICODE_STRING Name; ULONG i; WCHAR Buffer[128]; @@ -416,6 +421,31 @@ CmpFindDrivers(IN PHHIVE Hive, GroupOrderCell = CmpFindSubKeyByName(Hive, Node, &Name); if (GroupOrderCell == HCELL_NIL) return FALSE; + /* Get Safe Boot cell */ + if(InitSafeBootMode) + { + /* Open the Safe Boot key */ + RtlInitUnicodeString(&Name, L"SafeBoot"); + Node = HvGetCell(Hive, ControlCell); + ASSERT(Node); + SafeBootCell = CmpFindSubKeyByName(Hive, Node, &Name); + if (SafeBootCell == HCELL_NIL) return FALSE; + + /* Open the correct start key (depending on the mode) */ + Node = HvGetCell(Hive, SafeBootCell); + ASSERT(Node); + switch(InitSafeBootMode) + { + /* NOTE: Assumes MINIMAL (1) and DSREPAIR (3) load same items */ + case 1: + case 3: RtlInitUnicodeString(&Name, L"Minimal"); break; + case 2: RtlInitUnicodeString(&Name, L"Network"); break; + default: return FALSE; + } + SafeBootCell = CmpFindSubKeyByName(Hive, Node, &Name); + if(SafeBootCell == HCELL_NIL) return FALSE; + } + /* Build the root registry path */ RtlInitEmptyUnicodeString(&KeyPath, Buffer, sizeof(Buffer)); RtlAppendUnicodeToString(&KeyPath, L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\"); @@ -425,8 +455,9 @@ CmpFindDrivers(IN PHHIVE Hive, DriverCell = CmpFindSubKeyByNumber(Hive, ServicesNode, i); while (DriverCell != HCELL_NIL) { - /* Make sure it's a driver of this start type */ - if (CmpIsLoadType(Hive, DriverCell, LoadType)) + /* Make sure it's a driver of this start type AND is "safe" to load */ + if (CmpIsLoadType(Hive, DriverCell, LoadType) && + CmpIsSafe(Hive, SafeBootCell, DriverCell)) { /* Add it to the list */ CmpAddDriverToList(Hive, @@ -687,4 +718,106 @@ CmpResolveDriverDependencies(IN PLIST_ENTRY DriverListHead) return TRUE; } +BOOLEAN +NTAPI +INIT_FUNCTION +CmpIsSafe(IN PHHIVE Hive, + IN HCELL_INDEX SafeBootCell, + IN HCELL_INDEX DriverCell) +{ + PCM_KEY_NODE SafeBootNode; + PCM_KEY_NODE DriverNode; + PCM_KEY_VALUE KeyValue; + HCELL_INDEX CellIndex; + ULONG Length = 0; + UNICODE_STRING Name; + PWCHAR OriginalName; + ASSERT(Hive->ReleaseCellRoutine == NULL); + + /* Driver key node (mandatory) */ + ASSERT(DriverCell != HCELL_NIL); + DriverNode = HvGetCell(Hive, DriverCell); + ASSERT(DriverNode); + + /* Safe boot key node (optional but return TRUE if not present) */ + if(SafeBootCell == HCELL_NIL) return TRUE; + SafeBootNode = HvGetCell(Hive, SafeBootCell); + if(!SafeBootNode) return FALSE; + + /* Search by the name from the group */ + RtlInitUnicodeString(&Name, L"Group"); + CellIndex = CmpFindValueByName(Hive, DriverNode, &Name); + if(CellIndex != HCELL_NIL) + { + KeyValue = HvGetCell(Hive, CellIndex); + ASSERT(KeyValue); + if (KeyValue->Type == REG_SZ || KeyValue->Type == REG_EXPAND_SZ) + { + /* Compose the search 'key' */ + Name.Buffer = (PWCHAR)CmpValueToData(Hive, KeyValue, &Length); + if (!Name.Buffer) return FALSE; + Name.Length = Length - sizeof(UNICODE_NULL); + Name.MaximumLength = Name.Length; + /* Search for corresponding key in the Safe Boot key */ + CellIndex = CmpFindSubKeyByName(Hive, SafeBootNode, &Name); + if(CellIndex != HCELL_NIL) return TRUE; + } + } + + /* Group has not been found - find driver name */ + Name.Length = DriverNode->Flags & KEY_COMP_NAME ? + CmpCompressedNameSize(DriverNode->Name, + DriverNode->NameLength) : + DriverNode->NameLength; + Name.MaximumLength = Name.Length; + /* Now allocate the buffer for it and copy the name */ + Name.Buffer = CmpAllocate(Name.Length, FALSE, TAG_CM); + if (!Name.Buffer) return FALSE; + if (DriverNode->Flags & KEY_COMP_NAME) + { + /* Compressed name */ + CmpCopyCompressedName(Name.Buffer, + Name.Length, + DriverNode->Name, + DriverNode->NameLength); + } + else + { + /* Normal name */ + RtlCopyMemory(Name.Buffer, DriverNode->Name, DriverNode->NameLength); + } + CellIndex = CmpFindSubKeyByName(Hive, SafeBootNode, &Name); + RtlFreeUnicodeString(&Name); + if(CellIndex != HCELL_NIL) return TRUE; + + /* Not group or driver name - search by image name */ + RtlInitUnicodeString(&Name, L"ImagePath"); + CellIndex = CmpFindValueByName(Hive, DriverNode, &Name); + if(CellIndex != HCELL_NIL) + { + KeyValue = HvGetCell(Hive, CellIndex); + ASSERT(KeyValue); + if (KeyValue->Type == REG_SZ || KeyValue->Type == REG_EXPAND_SZ) + { + /* Compose the search 'key' */ + OriginalName = (PWCHAR)CmpValueToData(Hive, KeyValue, &Length); + if (!OriginalName) return FALSE; + /* Get the base image file name */ + Name.Buffer = wcsrchr(OriginalName, L'\\'); + if (!Name.Buffer) return FALSE; + ++Name.Buffer; + /* Length of the base name must be >=1 */ + Name.Length = Length - ((PUCHAR)Name.Buffer - (PUCHAR)OriginalName) + - sizeof(UNICODE_NULL); + if(Name.Length < 1) return FALSE; + Name.MaximumLength = Name.Length; + /* Search for corresponding key in the Safe Boot key */ + CellIndex = CmpFindSubKeyByName(Hive, SafeBootNode, &Name); + if(CellIndex != HCELL_NIL) return TRUE; + } + } + /* Nothing found - nothing else to search */ + return FALSE; +} + /* EOF */ diff --git a/ntoskrnl/config/cmindex.c b/ntoskrnl/config/cmindex.c index 6cc3b75f195..ace3b54e79a 100644 --- a/ntoskrnl/config/cmindex.c +++ b/ntoskrnl/config/cmindex.c @@ -1166,7 +1166,7 @@ CmpSplitLeaf(IN PHHIVE Hive, PCM_KEY_INDEX IndexKey, LeafKey, NewKey; PCM_KEY_FAST_INDEX FastLeaf; HCELL_INDEX LeafCell, NewCell; - ULONG FirstHalf, LastHalf; + USHORT FirstHalf, LastHalf; ULONG EntrySize, TotalSize; /* Get the cell */ @@ -1290,7 +1290,7 @@ CmpSplitLeaf(IN PHHIVE Hive, } /* Shift the data inside the root key */ - if (RootSelect < (IndexKey->Count - 1)) + if ((RootSelect + 1) < IndexKey->Count) { RtlMoveMemory(&IndexKey->List[RootSelect + 2], &IndexKey->List[RootSelect + 1], @@ -1425,7 +1425,7 @@ CmpSelectLeaf(IN PHHIVE Hive, } /* No, it doesn't fit, check the next adjacent leaf */ - if (SubKeyIndex < (IndexKey->Count - 1)) + if ((SubKeyIndex + 1) < IndexKey->Count) { /* Yes, there is space */ LeafCell = IndexKey->List[SubKeyIndex + 1]; diff --git a/ntoskrnl/config/cmsysini.c b/ntoskrnl/config/cmsysini.c index f6b3142a68b..8159383ecbf 100644 --- a/ntoskrnl/config/cmsysini.c +++ b/ntoskrnl/config/cmsysini.c @@ -1946,13 +1946,16 @@ CmpSetVersionData(VOID) UNICODE_STRING KeyName; UNICODE_STRING ValueName; UNICODE_STRING ValueData; - HANDLE KeyHandle; + HANDLE SoftwareKeyHandle = NULL; + HANDLE MicrosoftKeyHandle = NULL; + HANDLE WindowsNtKeyHandle = NULL; + HANDLE CurrentVersionKeyHandle = NULL; WCHAR Buffer[128]; NTSTATUS Status; /* Open the 'CurrentVersion' key */ RtlInitUnicodeString(&KeyName, - L"\\REGISTRY\\MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion"); + L"\\REGISTRY\\MACHINE\\SOFTWARE"); InitializeObjectAttributes(&ObjectAttributes, &KeyName, @@ -1960,7 +1963,7 @@ CmpSetVersionData(VOID) NULL, NULL); - Status = NtCreateKey(&KeyHandle, + Status = NtCreateKey(&SoftwareKeyHandle, KEY_CREATE_SUB_KEY, &ObjectAttributes, 0, @@ -1973,6 +1976,75 @@ CmpSetVersionData(VOID) return; } + /* Open the 'CurrentVersion' key */ + RtlInitUnicodeString(&KeyName, + L"Microsoft"); + + InitializeObjectAttributes(&ObjectAttributes, + &KeyName, + OBJ_CASE_INSENSITIVE, + SoftwareKeyHandle, + NULL); + + Status = NtCreateKey(&MicrosoftKeyHandle, + KEY_CREATE_SUB_KEY, + &ObjectAttributes, + 0, + NULL, + 0, + NULL); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to create key %wZ (Status: %08lx)\n", &KeyName, Status); + goto done; + } + + /* Open the 'CurrentVersion' key */ + RtlInitUnicodeString(&KeyName, + L"Windows NT"); + + InitializeObjectAttributes(&ObjectAttributes, + &KeyName, + OBJ_CASE_INSENSITIVE, + MicrosoftKeyHandle, + NULL); + + Status = NtCreateKey(&WindowsNtKeyHandle, + KEY_CREATE_SUB_KEY, + &ObjectAttributes, + 0, + NULL, + 0, + NULL); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to create key %wZ (Status: %08lx)\n", &KeyName, Status); + goto done; + } + + /* Open the 'CurrentVersion' key */ + RtlInitUnicodeString(&KeyName, + L"CurrentVersion"); + + InitializeObjectAttributes(&ObjectAttributes, + &KeyName, + OBJ_CASE_INSENSITIVE, + WindowsNtKeyHandle, + NULL); + + Status = NtCreateKey(&CurrentVersionKeyHandle, + KEY_CREATE_SUB_KEY | KEY_SET_VALUE, + &ObjectAttributes, + 0, + NULL, + 0, + NULL); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to create key %wZ (Status: %08lx)\n", &KeyName, Status); + goto done; + } + /* Set the 'CurrentType' value */ RtlInitUnicodeString(&ValueName, L"CurrentType"); @@ -1994,15 +2066,26 @@ CmpSetVersionData(VOID) RtlInitUnicodeString(&ValueData, Buffer); - NtSetValueKey(KeyHandle, + NtSetValueKey(CurrentVersionKeyHandle, &ValueName, 0, REG_SZ, ValueData.Buffer, ValueData.Length + sizeof(WCHAR)); - /* Close the key */ - NtClose(KeyHandle); +done:; + /* Close the keys */ + if (CurrentVersionKeyHandle != NULL) + NtClose(CurrentVersionKeyHandle); + + if (WindowsNtKeyHandle != NULL) + NtClose(WindowsNtKeyHandle); + + if (MicrosoftKeyHandle != NULL) + NtClose(MicrosoftKeyHandle); + + if (SoftwareKeyHandle != NULL) + NtClose(SoftwareKeyHandle); } /* EOF */ diff --git a/ntoskrnl/ex/amd64/fastinterlck.c b/ntoskrnl/ex/amd64/fastinterlck.c deleted file mode 100644 index b9ca32aab1b..00000000000 --- a/ntoskrnl/ex/amd64/fastinterlck.c +++ /dev/null @@ -1,114 +0,0 @@ -/* - * PROJECT: ReactOS Kernel - * LICENSE: BSD - See COPYING.ARM in the top level directory - * FILE: ntoskrnl/ex/fastinterlck.c - * PURPOSE: Portable Ex*Interlocked and REGISTER routines for amd64 - * PROGRAMMERS: ReactOS Portable Systems Group - * Timo Kreuzer - */ - -/* INCLUDES *******************************************************************/ - -#include -#define NDEBUG -#include - -#undef ExInterlockedAddLargeInteger -#undef ExInterlockedAddUlong -#undef ExInterlockedExtendZone -#undef ExInterlockedInsertHeadList -#undef ExInterlockedInsertTailList -#undef ExInterlockedPopEntryList -#undef ExInterlockedPushEntryList -#undef ExInterlockedRemoveHeadList -#undef ExpInterlockedFlushSList -#undef ExpInterlockedPopEntrySList -#undef ExpInterlockedPushEntrySList - -/* FUNCTIONS ******************************************************************/ - -LARGE_INTEGER -ExInterlockedAddLargeInteger(IN PLARGE_INTEGER Addend, - IN LARGE_INTEGER Increment, - IN PKSPIN_LOCK Lock) -{ - LARGE_INTEGER Int; - Int.QuadPart = _InterlockedExchangeAdd64(&Addend->QuadPart, - Increment.QuadPart); - return Int; -} - -ULONG -ExInterlockedAddUlong(IN PULONG Addend, - IN ULONG Increment, - PKSPIN_LOCK Lock) -{ - return (ULONG)_InterlockedExchangeAdd((PLONG)Addend, Increment); -} - -PLIST_ENTRY -ExInterlockedInsertHeadList(IN PLIST_ENTRY ListHead, - IN PLIST_ENTRY ListEntry, - IN PKSPIN_LOCK Lock) -{ - KIRQL OldIrql; - PLIST_ENTRY OldHead = NULL; - KeAcquireSpinLock(Lock, &OldIrql); - if (!IsListEmpty(ListHead)) OldHead = ListEntry->Flink; - InsertHeadList(ListHead, ListEntry); - KeReleaseSpinLock(Lock, OldIrql); - return OldHead; -} - -PLIST_ENTRY -ExInterlockedInsertTailList(IN PLIST_ENTRY ListHead, - IN PLIST_ENTRY ListEntry, - IN PKSPIN_LOCK Lock) -{ - KIRQL OldIrql; - PLIST_ENTRY OldHead = NULL; - KeAcquireSpinLock(Lock, &OldIrql); - if (!IsListEmpty(ListHead)) OldHead = ListEntry->Blink; - InsertTailList(ListHead, ListEntry); - KeReleaseSpinLock(Lock, OldIrql); - return OldHead; -} - -PSINGLE_LIST_ENTRY -ExInterlockedPopEntryList(IN PSINGLE_LIST_ENTRY ListHead, - IN PKSPIN_LOCK Lock) -{ - KIRQL OldIrql; - PSINGLE_LIST_ENTRY FirstEntry; - KeAcquireSpinLock(Lock, &OldIrql); - FirstEntry = PopEntryList(ListHead); - KeReleaseSpinLock(Lock, OldIrql); - return FirstEntry; -} - -PSINGLE_LIST_ENTRY -ExInterlockedPushEntryList(IN PSINGLE_LIST_ENTRY ListHead, - IN PSINGLE_LIST_ENTRY ListEntry, - IN PKSPIN_LOCK Lock) -{ - KIRQL OldIrql; - PSINGLE_LIST_ENTRY OldHead = NULL; - KeAcquireSpinLock(Lock, &OldIrql); - OldHead = ListHead->Next; - PushEntryList(ListHead, ListEntry); - KeReleaseSpinLock(Lock, OldIrql); - return OldHead; -} - -PLIST_ENTRY -ExInterlockedRemoveHeadList(IN PLIST_ENTRY ListHead, - IN PKSPIN_LOCK Lock) -{ - KIRQL OldIrql; - PLIST_ENTRY OldHead = NULL; - KeAcquireSpinLock(Lock, &OldIrql); - if (!IsListEmpty(ListHead)) OldHead = RemoveHeadList(ListHead); - KeReleaseSpinLock(Lock, OldIrql); - return OldHead; -} - diff --git a/ntoskrnl/ex/atom.c b/ntoskrnl/ex/atom.c index e2b6d784792..29e6a3dd954 100644 --- a/ntoskrnl/ex/atom.c +++ b/ntoskrnl/ex/atom.c @@ -172,7 +172,8 @@ NtAddAtom(IN PWSTR AtomName, } /* If we captured anything, free it */ - if ((CapturedName) && (CapturedName != AtomName)) ExFreePool(CapturedName); + if ((CapturedName) && (CapturedName != AtomName)) + ExFreePoolWithTag(CapturedName, TAG_ATOM); /* Return to caller */ return Status; @@ -321,7 +322,8 @@ NtFindAtom(IN PWSTR AtomName, } /* If we captured anything, free it */ - if ((CapturedName) && (CapturedName != AtomName)) ExFreePool(CapturedName); + if ((CapturedName) && (CapturedName != AtomName)) + ExFreePoolWithTag(CapturedName, TAG_ATOM); /* Return to caller */ return Status; diff --git a/ntoskrnl/ex/callback.c b/ntoskrnl/ex/callback.c index 202e2944e3e..15a30aecfdf 100644 --- a/ntoskrnl/ex/callback.c +++ b/ntoskrnl/ex/callback.c @@ -77,7 +77,7 @@ NTAPI ExFreeCallBack(IN PEX_CALLBACK_ROUTINE_BLOCK CallbackBlock) { /* Just free it from memory */ - ExFreePool(CallbackBlock); + ExFreePoolWithTag(CallbackBlock, CALLBACK_TAG); } VOID @@ -602,7 +602,7 @@ ExRegisterCallback(IN PCALLBACK_OBJECT CallbackObject, KeReleaseSpinLock(&CallbackObject->Lock, OldIrql); /* Free the registration */ - ExFreePool(CallbackRegistration); + ExFreePoolWithTag(CallbackRegistration, CALLBACK_TAG); CallbackRegistration = NULL; /* Dereference the object */ @@ -676,7 +676,7 @@ ExUnregisterCallback(IN PVOID CallbackRegistrationHandle) KeReleaseSpinLock(&CallbackObject->Lock, OldIrql); /* Delete this registration */ - ExFreePool(CallbackRegistration); + ExFreePoolWithTag(CallbackRegistration, CALLBACK_TAG); /* Remove the reference */ ObDereferenceObject(CallbackObject); diff --git a/ntoskrnl/ex/fastinterlck.c b/ntoskrnl/ex/fastinterlck.c deleted file mode 100644 index d16968a0ea0..00000000000 --- a/ntoskrnl/ex/fastinterlck.c +++ /dev/null @@ -1,460 +0,0 @@ -/* - * PROJECT: ReactOS Kernel - * LICENSE: BSD - See COPYING.ARM in the top level directory - * FILE: ntoskrnl/ex/fastinterlck.c - * PURPOSE: Portable Ex*Interlocked and REGISTER routines for non-x86 - * PROGRAMMERS: ReactOS Portable Systems Group - */ - -/* INCLUDES *******************************************************************/ - -#if defined(_ARM_) || defined(_PPC_) || defined(NTOS_USE_GENERICS) - -#include -#define NDEBUG -#include - -#undef ExInterlockedPushEntrySList -#undef ExInterlockedPopEntrySList -#undef ExInterlockedAddULong -#undef ExInterlockedIncrementLong -#undef ExInterlockedDecrementLong -#undef ExInterlockedAddLargeStatistic - -/* FUNCTIONS ******************************************************************/ - -PSLIST_ENTRY -NTAPI -InterlockedPushEntrySList(IN PSLIST_HEADER ListHead, - IN PSLIST_ENTRY ListEntry) -{ - - PSINGLE_LIST_ENTRY FirstEntry, NextEntry; - PSINGLE_LIST_ENTRY Entry = (PVOID)ListEntry, Head = (PVOID)ListHead; - - FirstEntry = Head->Next; - do - { - Entry->Next = FirstEntry; - NextEntry = FirstEntry; - FirstEntry = (PVOID)_InterlockedCompareExchange((PLONG)Head, - (LONG)Entry, - (LONG)FirstEntry); - } while (FirstEntry != NextEntry); - - return FirstEntry; -} - -PSLIST_ENTRY -NTAPI -InterlockedPopEntrySList(IN PSLIST_HEADER ListHead) -{ - PSINGLE_LIST_ENTRY FirstEntry, NextEntry, Head = (PVOID)ListHead; - - FirstEntry = Head->Next; - do - { - if (!FirstEntry) return NULL; - - NextEntry = FirstEntry; - FirstEntry = (PVOID)_InterlockedCompareExchange((PLONG)Head, - (LONG)FirstEntry->Next, - (LONG)FirstEntry); - } while (FirstEntry != NextEntry); - - return FirstEntry; -} - -PSINGLE_LIST_ENTRY -FASTCALL -ExInterlockedFlushSList(IN PSLIST_HEADER ListHead) -{ - return (PVOID)_InterlockedExchange((PLONG)&ListHead->Next.Next, (LONG)NULL); -} - -PSLIST_ENTRY -FASTCALL -ExInterlockedPushEntrySList(IN PSLIST_HEADER ListHead, - IN PSLIST_ENTRY ListEntry, - IN PKSPIN_LOCK Lock) -{ - return InterlockedPushEntrySList(ListHead, ListEntry); -} - -PSINGLE_LIST_ENTRY -NTAPI -ExInterlockedPopEntrySList(IN PSLIST_HEADER ListHead, - IN PKSPIN_LOCK Lock) -{ - return InterlockedPopEntrySList(ListHead); -} - -ULONG -FASTCALL -ExfInterlockedAddUlong(IN PULONG Addend, - IN ULONG Increment, - PKSPIN_LOCK Lock) -{ - KIRQL OldIrql; - KeAcquireSpinLock(Lock, &OldIrql); - *Addend += Increment; - KeReleaseSpinLock(Lock, OldIrql); - return *Addend; -} - -LONGLONG -FASTCALL -ExfInterlockedCompareExchange64(IN OUT LONGLONG volatile *Destination, - IN PLONGLONG Exchange, - IN PLONGLONG Comparand) -{ - LONGLONG Result; - - Result = *Destination; - if (*Destination == *Comparand) *Destination = *Exchange; - return Result; -} - -PLIST_ENTRY -FASTCALL -ExfInterlockedInsertHeadList(IN PLIST_ENTRY ListHead, - IN PLIST_ENTRY ListEntry, - IN PKSPIN_LOCK Lock) -{ - KIRQL OldIrql; - PLIST_ENTRY OldHead = NULL; - KeAcquireSpinLock(Lock, &OldIrql); - if (!IsListEmpty(ListHead)) OldHead = ListEntry->Flink; - InsertHeadList(ListHead, ListEntry); - KeReleaseSpinLock(Lock, OldIrql); - return OldHead; -} - -PLIST_ENTRY -FASTCALL -ExfInterlockedInsertTailList(IN PLIST_ENTRY ListHead, - IN PLIST_ENTRY ListEntry, - IN PKSPIN_LOCK Lock) -{ - KIRQL OldIrql; - PLIST_ENTRY OldHead = NULL; - KeAcquireSpinLock(Lock, &OldIrql); - if (!IsListEmpty(ListHead)) OldHead = ListEntry->Blink; - InsertTailList(ListHead, ListEntry); - KeReleaseSpinLock(Lock, OldIrql); - return OldHead; -} - -PSINGLE_LIST_ENTRY -FASTCALL -ExfInterlockedPopEntryList(IN PSINGLE_LIST_ENTRY ListHead, - IN PKSPIN_LOCK Lock) -{ - UNIMPLEMENTED; - return NULL; -} - -PSINGLE_LIST_ENTRY -FASTCALL -ExfInterlockedPushEntryList(IN PSINGLE_LIST_ENTRY ListHead, - IN PSINGLE_LIST_ENTRY ListEntry, - IN PKSPIN_LOCK Lock) -{ - UNIMPLEMENTED; - return NULL; -} - -PLIST_ENTRY -FASTCALL -ExfInterlockedRemoveHeadList(IN PLIST_ENTRY ListHead, - IN PKSPIN_LOCK Lock) -{ - return ExInterlockedRemoveHeadList(ListHead, Lock); -} - -LARGE_INTEGER -NTAPI -ExInterlockedAddLargeInteger(IN PLARGE_INTEGER Addend, - IN LARGE_INTEGER Increment, - IN PKSPIN_LOCK Lock) -{ - LARGE_INTEGER Integer = {{0}}; - UNIMPLEMENTED; - return Integer; -} - -ULONG -NTAPI -ExInterlockedAddUlong(IN PULONG Addend, - IN ULONG Increment, - PKSPIN_LOCK Lock) -{ - return (ULONG)_InterlockedExchangeAdd((PLONG)Addend, Increment); -} - -INTERLOCKED_RESULT -NTAPI -ExInterlockedIncrementLong(IN PLONG Addend, - IN PKSPIN_LOCK Lock) -{ - return _InterlockedIncrement(Addend); -} - -INTERLOCKED_RESULT -NTAPI -ExInterlockedDecrementLong(IN PLONG Addend, - IN PKSPIN_LOCK Lock) -{ - return _InterlockedDecrement(Addend); -} - -ULONG -NTAPI -ExInterlockedExchangeUlong(IN PULONG Target, - IN ULONG Value, - IN PKSPIN_LOCK Lock) -{ - return (ULONG)_InterlockedExchange((PLONG)Target, Value); -} - -PLIST_ENTRY -NTAPI -ExInterlockedInsertHeadList(IN PLIST_ENTRY ListHead, - IN PLIST_ENTRY ListEntry, - IN PKSPIN_LOCK Lock) -{ - KIRQL OldIrql; - PLIST_ENTRY OldHead = NULL; - KeAcquireSpinLock(Lock, &OldIrql); - if (!IsListEmpty(ListHead)) OldHead = ListEntry->Flink; - InsertHeadList(ListHead, ListEntry); - KeReleaseSpinLock(Lock, OldIrql); - return OldHead; -} - -PLIST_ENTRY -NTAPI -ExInterlockedInsertTailList(IN PLIST_ENTRY ListHead, - IN PLIST_ENTRY ListEntry, - IN PKSPIN_LOCK Lock) -{ - KIRQL OldIrql; - PLIST_ENTRY OldHead = NULL; - KeAcquireSpinLock(Lock, &OldIrql); - if (!IsListEmpty(ListHead)) OldHead = ListEntry->Blink; - InsertTailList(ListHead, ListEntry); - KeReleaseSpinLock(Lock, OldIrql); - return OldHead; -} - -PSINGLE_LIST_ENTRY -NTAPI -ExInterlockedPopEntryList(IN PSINGLE_LIST_ENTRY ListHead, - IN PKSPIN_LOCK Lock) -{ - KIRQL OldIrql; - PSINGLE_LIST_ENTRY OldHead = NULL; - KeAcquireSpinLock(Lock, &OldIrql); - OldHead = PopEntryList(ListHead); - KeReleaseSpinLock(Lock, OldIrql); - return OldHead; -} - -PSINGLE_LIST_ENTRY -NTAPI -ExInterlockedPushEntryList(IN PSINGLE_LIST_ENTRY ListHead, - IN PSINGLE_LIST_ENTRY ListEntry, - IN PKSPIN_LOCK Lock) -{ - KIRQL OldIrql; - PSINGLE_LIST_ENTRY OldHead = NULL; - KeAcquireSpinLock(Lock, &OldIrql); - OldHead = ListHead->Next; - PushEntryList(ListHead, ListEntry); - KeReleaseSpinLock(Lock, OldIrql); - return OldHead; -} - -PLIST_ENTRY -NTAPI -ExInterlockedRemoveHeadList(IN PLIST_ENTRY ListHead, - IN PKSPIN_LOCK Lock) -{ - KIRQL OldIrql; - PLIST_ENTRY OldHead = NULL; - KeAcquireSpinLock(Lock, &OldIrql); - if (!IsListEmpty(ListHead)) OldHead = RemoveHeadList(ListHead); - KeReleaseSpinLock(Lock, OldIrql); - return OldHead; -} - -VOID -FASTCALL -ExInterlockedAddLargeStatistic(IN PLONGLONG Addend, - IN ULONG Increment) -{ - UNIMPLEMENTED; -} - -LONGLONG -FASTCALL -ExInterlockedCompareExchange64(IN OUT LONGLONG volatile *Destination, - IN PLONGLONG Exchange, - IN PLONGLONG Comparand, - IN PKSPIN_LOCK Lock) -{ - KIRQL OldIrql; - LONGLONG Result; - - KeAcquireSpinLock(Lock, &OldIrql); - Result = *Destination; - if (*Destination == *Comparand) *Destination = *Exchange; - KeReleaseSpinLock(Lock, OldIrql); - return Result; -} - -VOID -NTAPI -READ_REGISTER_BUFFER_UCHAR(IN PUCHAR Register, - IN PUCHAR Buffer, - IN ULONG Count) -{ - PUCHAR registerBuffer = Register; - PUCHAR readBuffer = Buffer; - ULONG readCount; - - for (readCount = Count; readCount--; readBuffer++, registerBuffer++) - { - *readBuffer = *(volatile UCHAR * const)registerBuffer; - } -} - -VOID -NTAPI -READ_REGISTER_BUFFER_ULONG(IN PULONG Register, - IN PULONG Buffer, - IN ULONG Count) -{ - PULONG registerBuffer = Register; - PULONG readBuffer = Buffer; - ULONG readCount; - - for (readCount = Count; readCount--; readBuffer++, registerBuffer++) - { - *readBuffer = *(volatile ULONG * const)registerBuffer; - } -} - -VOID -NTAPI -READ_REGISTER_BUFFER_USHORT(IN PUSHORT Register, - IN PUSHORT Buffer, - IN ULONG Count) -{ - PUSHORT registerBuffer = Register; - PUSHORT readBuffer = Buffer; - ULONG readCount; - - for (readCount = Count; readCount--; readBuffer++, registerBuffer++) - { - *readBuffer = *(volatile USHORT * const)registerBuffer; - } -} - -UCHAR -NTAPI -READ_REGISTER_UCHAR(IN PUCHAR Register) -{ - return *(volatile UCHAR * const)Register; -} - -ULONG -NTAPI -READ_REGISTER_ULONG(IN PULONG Register) -{ - return *(volatile ULONG * const)Register; -} - -USHORT -NTAPI -READ_REGISTER_USHORT(IN PUSHORT Register) -{ - return *(volatile USHORT * const)Register; -} - -VOID -NTAPI -WRITE_REGISTER_BUFFER_UCHAR(IN PUCHAR Register, - IN PUCHAR Buffer, - IN ULONG Count) -{ - PUCHAR registerBuffer = Register; - PUCHAR writeBuffer = Buffer; - ULONG writeCount; - for (writeCount = Count; writeCount--; writeBuffer++, registerBuffer++) - { - *(volatile UCHAR * const)registerBuffer = *writeBuffer; - } - KeFlushWriteBuffer(); -} - -VOID -NTAPI -WRITE_REGISTER_BUFFER_ULONG(IN PULONG Register, - IN PULONG Buffer, - IN ULONG Count) -{ - PULONG registerBuffer = Register; - PULONG writeBuffer = Buffer; - ULONG writeCount; - for (writeCount = Count; writeCount--; writeBuffer++, registerBuffer++) - { - *(volatile ULONG * const)registerBuffer = *writeBuffer; - } - KeFlushWriteBuffer(); -} - -VOID -NTAPI -WRITE_REGISTER_BUFFER_USHORT(IN PUSHORT Register, - IN PUSHORT Buffer, - IN ULONG Count) -{ - PUSHORT registerBuffer = Register; - PUSHORT writeBuffer = Buffer; - ULONG writeCount; - for (writeCount = Count; writeCount--; writeBuffer++, registerBuffer++) - { - *(volatile USHORT * const)registerBuffer = *writeBuffer; - } - KeFlushWriteBuffer(); -} - -VOID -NTAPI -WRITE_REGISTER_UCHAR(IN PUCHAR Register, - IN UCHAR Value) -{ - *(volatile UCHAR * const)Register = Value; - KeFlushWriteBuffer(); -} - -VOID -NTAPI -WRITE_REGISTER_ULONG(IN PULONG Register, - IN ULONG Value) -{ - *(volatile ULONG * const)Register = Value; - KeFlushWriteBuffer(); -} - -VOID -NTAPI -WRITE_REGISTER_USHORT(IN PUSHORT Register, - IN USHORT Value) -{ - *(volatile USHORT * const)Register = Value; - KeFlushWriteBuffer(); -} - -#endif diff --git a/ntoskrnl/ex/handle.c b/ntoskrnl/ex/handle.c index 755bc5d59b2..1fe2bb12846 100644 --- a/ntoskrnl/ex/handle.c +++ b/ntoskrnl/ex/handle.c @@ -132,7 +132,7 @@ ExpAllocateTablePagedPool(IN PEPROCESS Process OPTIONAL, PVOID Buffer; /* Do the allocation */ - Buffer = ExAllocatePoolWithTag(PagedPool, Size, 'btbO'); + Buffer = ExAllocatePoolWithTag(PagedPool, Size, TAG_OBJECT_TABLE); if (Buffer) { /* Clear the memory */ @@ -157,7 +157,7 @@ ExpAllocateTablePagedPoolNoZero(IN PEPROCESS Process OPTIONAL, PVOID Buffer; /* Do the allocation */ - Buffer = ExAllocatePoolWithTag(PagedPool, Size, 'btbO'); + Buffer = ExAllocatePoolWithTag(PagedPool, Size, TAG_OBJECT_TABLE); if (Buffer) { /* Check if we have a process to charge quota */ @@ -178,7 +178,7 @@ ExpFreeTablePagedPool(IN PEPROCESS Process OPTIONAL, IN SIZE_T Size) { /* Free the buffer */ - ExFreePool(Buffer); + ExFreePoolWithTag(Buffer, TAG_OBJECT_TABLE); if (Process) { /* FIXME: Release quota */ @@ -273,7 +273,7 @@ ExpFreeHandleTable(IN PHANDLE_TABLE HandleTable) } /* Free the actual table and check if we need to release quota */ - ExFreePool(HandleTable); + ExFreePoolWithTag(HandleTable, TAG_OBJECT_TABLE); if (Process) { /* FIXME: TODO */ @@ -345,7 +345,7 @@ ExpAllocateHandleTable(IN PEPROCESS Process OPTIONAL, /* Allocate the table */ HandleTable = ExAllocatePoolWithTag(PagedPool, sizeof(HANDLE_TABLE), - 'btbO'); + TAG_OBJECT_TABLE); if (!HandleTable) return NULL; /* Check if we have a process */ @@ -362,7 +362,7 @@ ExpAllocateHandleTable(IN PEPROCESS Process OPTIONAL, if (!HandleTableTable) { /* Failed, free the table */ - ExFreePool(HandleTable); + ExFreePoolWithTag(HandleTable, TAG_OBJECT_TABLE); return NULL; } diff --git a/ntoskrnl/ex/harderr.c b/ntoskrnl/ex/harderr.c index 2b4aeed3274..c1035da6960 100644 --- a/ntoskrnl/ex/harderr.c +++ b/ntoskrnl/ex/harderr.c @@ -640,7 +640,7 @@ NtRaiseHardError(IN NTSTATUS ErrorStatus, _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { /* Free captured buffer */ - if (SafeParams) ExFreePool(SafeParams); + if (SafeParams) ExFreePoolWithTag(SafeParams, TAG_ERR); /* Return the exception code */ _SEH2_YIELD(return _SEH2_GetExceptionCode()); @@ -676,7 +676,7 @@ NtRaiseHardError(IN NTSTATUS ErrorStatus, if (PreviousMode != KernelMode) { /* That means we have a buffer to free */ - if (SafeParams) ExFreePool(SafeParams); + if (SafeParams) ExFreePoolWithTag(SafeParams, TAG_ERR); /* Enter SEH Block for return */ _SEH2_TRY diff --git a/ntoskrnl/ex/i386/fastinterlck_asm.S b/ntoskrnl/ex/i386/fastinterlck_asm.S index 3acb19b18a9..8de4260ab87 100644 --- a/ntoskrnl/ex/i386/fastinterlck_asm.S +++ b/ntoskrnl/ex/i386/fastinterlck_asm.S @@ -4,7 +4,6 @@ * FILE: ntoskrnl/ex/i386/fastinterlck_asm.S * PURPOSE: FASTCALL Interlocked Functions * PROGRAMMERS: Alex Ionescu (alex@relsoft.net) - * Paolo Bonzini */ /* INCLUDES ******************************************************************/ @@ -32,381 +31,27 @@ */ PUBLIC @ExInterlockedAddLargeStatistic@8 @ExInterlockedAddLargeStatistic@8: - push ebp - push ebx - mov ebp, ecx -Again: - /* Load comparand in eax for cmpxchg */ - mov eax, [ebp] +#ifdef CONFIG_SMP + /* Do the addition */ + lock add [ecx], edx - /* Compute low word of the result in ebx */ - mov ebx, edx - add ebx, eax - - /* Carry needs cmpxchg8b */ - jc Slow - - /* Fast path still needs to be atomic, so use cmpxchg and retry if it fails - * Hopefully it will still get through this path :) */ - LOCK cmpxchg [ecx], ebx - jnz Again - - /* Thats it */ - pop ebx - pop ebp + /* Check for carry bit and return */ + jb .l1 ret -Slow: - /* Save increment across cmpxchg8b */ - push edx - - /* Finish loading comparand in edx:eax */ - mov edx, [ebp+4] - - /* Result in ecx:ebx (we know there's carry) */ - lea ecx, [edx+1] - - /* Do a full exchange */ - LOCK cmpxchg8b [ebp] - - /* restore increment */ - pop edx - - /* Need to retry */ - jnz Again - - /* Thats it */ - pop ebx - pop ebp - ret - - -/*ULONG - *FASTCALL - *ExfInterlockedAddUlong(IN PULONG Addend, - * IN ULONG Increment, - * IN PKSPIN_LOCK Lock) - */ -PUBLIC @ExfInterlockedAddUlong@12 -@ExfInterlockedAddUlong@12: - - /* Save flags */ - pushfd - -#ifdef CONFIG_SMP - /* Get lock address */ - mov eax, [esp+8] -.start1: -#endif - /* Disable interrupts */ - cli - - /* Acquire lock */ - ACQUIRE_SPINLOCK(eax, .spin1) - - /* Do the add */ - mov eax, [ecx] - add [ecx], edx - -#ifdef CONFIG_SMP - /* Get spinlock address and release it */ - mov edx, [esp+8] - RELEASE_SPINLOCK(edx) -#endif - - /* Restore flags and return */ - popfd - ret 4 - -#ifdef CONFIG_SMP -.spin1: - /* Restore flags and spin */ - popfd - pushfd - SPIN_ON_LOCK(eax, .start1) -#endif - -/*PLIST_ENTRY - *FASTCALL - *ExfInterlockedInsertHeadList(IN PLIST_ENTRY ListHead, - * IN PLIST_ENTRY ListEntry, - * IN PKSPIN_LOCK Lock) - */ -PUBLIC @ExfInterlockedInsertHeadList@12 -@ExfInterlockedInsertHeadList@12: - -#ifdef CONFIG_SMP - /* Save lock address */ - push esi - mov esi, [esp+8] -#endif - - /* Save flags and disable interrupts */ - pushfd -.start2: - cli - - /* Acquire lock */ - ACQUIRE_SPINLOCK(esi, .spin2) - - /* Get list pointer */ - mov eax, [ecx] - - /* Do the insert */ - mov [edx], eax - mov [edx+4], ecx - mov [ecx], edx - mov [eax+4], edx - - /* Release lock and restore flags */ - RELEASE_SPINLOCK(esi) - popfd - -#ifdef CONFIG_SMP - pop esi -#endif - - /* Check if list was empty */ - xor eax, ecx - jz .l2 - - /* Return list pointer */ - xor eax, ecx -.l2: - ret 4 - -#ifdef CONFIG_SMP -.spin2: - popfd - pushfd - SPIN_ON_LOCK(esi, .start2) -#endif - -/*PLIST_ENTRY - *FASTCALL - *ExfInterlockedInsertTailList(IN PLIST_ENTRY ListHead, - * IN PLIST_ENTRY ListEntry, - * IN PKSPIN_LOCK Lock) - */ -PUBLIC @ExfInterlockedInsertTailList@12 -@ExfInterlockedInsertTailList@12: - -#ifdef CONFIG_SMP - /* Save lock address */ - push esi - mov esi, [esp+8] -#endif - - /* Save flags and disable interrupts */ - pushfd -.start3: - cli - - /* Acquire lock */ - ACQUIRE_SPINLOCK(esi, .spin3) - - /* Get list pointer */ - mov eax, [ecx+4] - - /* Do the insert */ - mov [edx], ecx - mov [edx+4], eax - mov [ecx+4], edx - mov [eax], edx - - /* Release lock and restore flags */ - RELEASE_SPINLOCK(esi) - popfd - -#ifdef CONFIG_SMP - pop esi -#endif - - /* Check if list was empty */ - xor eax, ecx - jz .l3 - - /* Return list pointer */ - xor eax, ecx -.l3: - ret 4 - -#ifdef CONFIG_SMP -.spin3: - popfd - pushfd - SPIN_ON_LOCK(esi, .start3) -#endif - -/*PLIST_ENTRY - *FASTCALL - *ExfInterlockedRemoveHeadList(IN PLIST_ENTRY ListHead, - * IN PKSPIN_LOCK Lock) - */ -PUBLIC @ExfInterlockedRemoveHeadList@8 -@ExfInterlockedRemoveHeadList@8: - - /* Save flags and disable interrupts */ -.start4: - pushfd - cli - ACQUIRE_SPINLOCK(edx, .spin4) - - /* Get list pointer */ - mov eax, [ecx] - - /* Check if it's empty */ - cmp eax, ecx - je .l4 - - /* Get the next entry and do the deletion */ -#ifdef CONFIG_SMP - push ebx - mov ebx, [eax] - mov [ecx], ebx - mov [ebx+4], ecx +.l1: + /* Add carry */ + lock adc dword ptr [ecx+4], 0 #else - mov edx, [eax] - mov [ecx], edx - mov [edx+4], ecx + /* Do the addition and add the carry */ + add dword ptr [ecx], edx + adc dword ptr [ecx+4], 0 #endif - - /* Release lock */ -#ifdef CONFIG_SMP - RELEASE_SPINLOCK(edx) - pop ebx -#endif - - /* Restore flags */ - popfd - /* Return */ ret -.l4: - /* Release lock */ - RELEASE_SPINLOCK(edx) - /* Restore flags */ - popfd - - /* Return empty list */ - xor eax, eax - ret - -#ifdef CONFIG_SMP -.spin4: - popfd - SPIN_ON_LOCK(edx, .start4) -#endif - -/*PSINGLE_LIST_ENTRY - *FASTCALL - *ExfInterlockedPopEntryList(IN PSINGLE_LIST_ENTRY ListHead, - * IN PKSPIN_LOCK Lock) - */ -PUBLIC @ExfInterlockedPopEntryList@8 -@ExfInterlockedPopEntryList@8: - - /* Save flags and disable interrupts */ -.start5: - pushfd - cli - ACQUIRE_SPINLOCK(edx, .spin5) - - /* Get list pointer */ - mov eax, [ecx] - - /* Check if it's empty */ - or eax, eax - je .l6 - - /* Get next entry and do deletion */ -#ifdef CONFIG_SMP - push edx -#endif - mov edx, [eax] - mov [ecx], edx -#ifdef CONFIG_SMP - pop edx -#endif - -.l5: - /* Release lock */ - RELEASE_SPINLOCK(edx) - - /* Restore flags */ - popfd - - /* Return */ - ret - -.l6: - /* Return empty list */ - xor eax, eax - jmp .l5 - -#ifdef CONFIG_SMP -.spin5: - popfd - SPIN_ON_LOCK(edx, .start5) -#endif - -/*PSINGLE_LIST_ENTRY - *FASTCALL - *ExfInterlockedPushEntryList(IN PSINGLE_LIST_ENTRY ListHead, - * IN PSINGLE_LIST_ENTRY ListEntry, - * IN PKSPIN_LOCK Lock) - */ -PUBLIC @ExfInterlockedPushEntryList@12 -@ExfInterlockedPushEntryList@12: - - /* Save flags */ - pushfd - - /* Save lock pointer */ -#ifdef CONFIG_SMP - push edx - mov edx, [esp+12] -#endif - - /* Disable interrupts */ -.start6: - cli -#ifdef CONFIG_SMP - ACQUIRE_SPINLOCK(edx, .spin6) - pop edx -#endif - - /* Get list pointer */ - mov eax, [ecx] - - /* Do push */ - mov [edx], eax - mov [ecx], edx - - /* Release lock */ -#ifdef CONFIG_SMP - mov edx, [esp+8] - RELEASE_SPINLOCK(edx) -#endif - - /* Restore flags */ - popfd - - /* Return */ - ret 4 - -#ifdef CONFIG_SMP -.spin6: - pop edx - popfd - pushfd - push edx - mov edx, [esp+12] - SPIN_ON_LOCK(edx, .start6) -#endif /*PSINGLE_LIST_ENTRY *FASTCALL @@ -536,301 +181,5 @@ PUBLIC @ExInterlockedFlushSList@4 pop ebx ret -/*INTERLOCKED_RESULT - *FASTCALL - *Exfi386InterlockedIncrementLong(IN PLONG Addend) - */ -PUBLIC @Exfi386InterlockedIncrementLong@4 -@Exfi386InterlockedIncrementLong@4: - - /* Do the op */ - LOCK add dword ptr [ecx], 1 - - /* Return */ - lahf - and eax, EFLAG_SELECT - ret - -/*INTERLOCKED_RESULT - *FASTCALL - *Exfi386InterlockedDecrementLong(IN PLONG Addend) - */ -PUBLIC @Exfi386InterlockedDecrementLong@4 -@Exfi386InterlockedDecrementLong@4: - - /* Do the op */ - LOCK sub dword ptr [ecx], 1 - - /* Return */ - lahf - and eax, EFLAG_SELECT - ret - -/*ULONG - *FASTCALL - *Exfi386InterlockedExchangeUlong(IN PULONG Taget, - * IN ULONG Value) - */ -PUBLIC @Exfi386InterlockedExchangeUlong@8 -@Exfi386InterlockedExchangeUlong@8: - -#ifdef CONFIG_SMP - /* On MP, do the exchange */ - xchg [ecx], edx - mov eax, edx -#else - /* On UP, use cmpxchg */ - mov eax, [ecx] -.l11: - cmpxchg [ecx], edx - jnz .l11 -#endif - - /* Return */ - ret - -/*PVOID - *FASTCALL - *ExfInterlockedCompareExchange64(IN PLONGLONG Destination, - * IN PLONGLONG Exchange, - * IN PLONGLONG Comperand) - */ -PUBLIC @ExfInterlockedCompareExchange64@12 -@ExfInterlockedCompareExchange64@12: - - /* Save registers */ - push ebx - push ebp - - /* Get destination pointer, exchange value and comperand value/address */ - mov ebp, ecx - mov ebx, [edx] - mov ecx, [edx+4] - mov edx, [esp+12] - mov eax, [edx] - mov edx, [edx+4] - - /* Do the op */ - LOCK cmpxchg8b qword ptr [ebp] - - /* Restore volatiles */ - pop ebp - pop ebx - - /* Return */ - ret 4 - -/*PVOID - *FASTCALL - *ExfInterlockedCompareExchange64(IN PLONGLONG Destination, - * IN PLONGLONG Exchange, - * IN PLONGLONG Comperand, - * IN PKSPIN_LOCK Lock) - */ -PUBLIC @ExInterlockedCompareExchange64@16 -@ExInterlockedCompareExchange64@16: - - /* Save registers */ - push ebp - push ebp - - /* Get destination pointer, exchange value and comperand value/address */ - mov ebp, ecx - mov ebx, [edx] - mov ecx, [edx+4] - mov edx, [esp+12] - mov eax, [edx] - mov edx, [edx+4] - - /* Do the op */ - LOCK cmpxchg8b qword ptr [ebp] - - /* Restore volatiles */ - pop ebp - pop ebx - - /* Return */ - ret 8 - -/*** Non-586 functions ***/ - -/*PSINGLE_LIST_ENTRY - *FASTCALL - *ExfInterlockedPopEntrySList(IN PSINGLE_LIST_ENTRY ListHead, - * IN PKSPIN_LOCK Lock) - */ -PUBLIC @ExfInterlockedPopEntrySList@8 -@ExfInterlockedPopEntrySList@8: - - /* Save flags */ -.starta: - pushfd - - /* Disable interrupts */ - cli - - /* Acquire lock */ - ACQUIRE_SPINLOCK(edx, .spina) - - /* Get the next link and check if it's empty */ - mov eax, [ecx] - or eax, eax - jz .l12 - - /* Get address of the next link and store it */ - push [eax] - pop [ecx] - - /* Decrement list depth */ - dec dword ptr [ecx+4] - -.l12: -#ifdef CONFIG_SMP - /* Release spinlock */ - RELEASE_SPINLOCK(edx) -#endif - - /* Restore flags and return */ - popfd - ret 0 - -#ifdef CONFIG_SMP -.spina: - /* Restore flags and spin */ - popfd - SPIN_ON_LOCK(edx, .starta) -#endif - -/*PSINGLE_LIST_ENTRY - *FASTCALL - *ExfInterlockedPushEntrySList(IN PSINGLE_LIST_ENTRY ListHead, - * IN PSINGLE_LIST_ENTRY ListEntry, - * IN PKSPIN_LOCK Lock) - */ -PUBLIC @ExfInterlockedPushEntrySList@12 -@ExfInterlockedPushEntrySList@12: - - /* Save flags */ -.startb: - pushfd - - /* Disable interrupts */ - cli - - /* Acquire lock */ -#ifndef CONFIG_SMP - mov eax, [esp+8] - ACQUIRE_SPINLOCK(eax, .spinb) -#endif - - /* Get the next link and check if it's empty */ - push [ecx] - - /* Get address of the next link and store it */ - pop [edx] - mov [ecx], edx - - /* Increment list depth */ - inc dword ptr [ecx+4] - -#ifdef CONFIG_SMP - /* Release spinlock */ - RELEASE_SPINLOCK(eax) -#endif - - /* Restore flags and return */ - popfd - ret 4 - -#ifdef CONFIG_SMP -.spinb: - /* Restore flags and spin */ - popfd - SPIN_ON_LOCK(eax, .startb) -#endif - -/*PVOID - *FASTCALL - *ExpInterlockedCompareExchange64(IN PLONGLONG Destination, - * IN PLONGLONG Exchange, - * IN PLONGLONG Comperand, - * IN PKSPIN_LOCK Lock) - */ -PUBLIC @ExpInterlockedCompareExchange64@16 -@ExpInterlockedCompareExchange64@16: - - /* Save registers */ - push ebp - push ebp - - /* Get destination pointer, exchange value and comperand value/address */ - mov ebp, ecx - mov ebx, [edx] - mov ecx, [edx+4] - mov edx, [esp+12] - mov eax, [edx] - mov edx, [edx+4] - -#ifdef CONFIG_SMP - /* Save ESI so we can store KSPINLOCK in it */ - push esi - - /* Save flags and lock, and disable interrupts */ - pushfd - mov esi, [esp+24] -.startc: - cli - - /* Acquire the spinlock */ - ACQUIRE_SPINLOCK(esi, .spinc) -#else - /* Save flags and disable interrupts */ - pushfd - cli -#endif - - /* Compare bottom */ - cmp eax, [ebp] - jne NoMatch - - /* Compare top */ - cmp edx, [ebp+4] - jne NoMatch - - /* Save new value */ - mov [ebp], ebx - mov [ebp+4], ecx - -AfterSave: -#ifdef CONFIG_SMP - /* Release lock, restore volatiles and flags */ - RELEASE_SPINLOCK(esi) - popfd - pop esi -#else - popfd -#endif - - /* Restore the other volatiles and return */ - pop ebp - pop ebx - - /* Return */ - ret 8 - -NoMatch: - /* Return the current value */ - mov eax, [ebp] - mov edx, [ebp+4] - jmp AfterSave - -#ifdef CONFIG_SMP -.spinc: - /* Restore flags and spin */ - popfd - pushfd - SPIN_ON_LOCK(esi, .startc) -#endif - END /* EOF */ diff --git a/ntoskrnl/ex/i386/interlck_asm.S b/ntoskrnl/ex/i386/interlck_asm.S deleted file mode 100644 index 755813e80d8..00000000000 --- a/ntoskrnl/ex/i386/interlck_asm.S +++ /dev/null @@ -1,564 +0,0 @@ -/* - * COPYRIGHT: See COPYING in the top level directory - * PROJECT: ReactOS kernel - * FILE: ntoskrnl/ex/i386/interlck_asm.S - * PURPOSE: STDCALL Interlocked Functions - * PROGRAMMERS: Alex Ionescu (alex@relsoft.net) - */ - -/* INCLUDES ******************************************************************/ - -#include -#include -#include - -/* FUNCTIONS ****************************************************************/ - -.code32 - -/* - * NOTE: These functions must obey the following rules: - * - Acquire locks only on MP systems. - * - Be safe at HIGH_LEVEL (no paged access). - * - Preserve flags. - * - Disable interrups. - */ - -/*PLIST_ENTRY - *NTAPI - *ExInterlockedAddLargeInteger(IN PLIST_ENTRY ListHead, - * IN PLIST_ENTRY ListEntry, - * IN PKSPIN_LOCK Lock) - */ -PUBLIC _ExInterlockedAddLargeInteger@16 -_ExInterlockedAddLargeInteger@16: - - /* Prepare stack frame */ - push ebp - mov ebp, esp - sub esp, 8 - - /* Save lock pointer */ -#ifdef CONFIG_SMP - mov eax, [ebp+20] -#endif - - /* Save flags and disable interrupts */ -.start1: - pushfd - cli - - /* Acquire lock */ - ACQUIRE_SPINLOCK(eax, .spin1) - - /* Do the calculation */ - mov eax, [ebp+8] - mov ecx, [eax] - mov edx, [eax+4] - - /* Save result */ - mov [ebp-8], ecx - mov [ebp-4], edx - - /* Add increment */ - add ecx, [ebp+12] - adc edx, [ebp+16] - - /* Save result */ - mov [eax], ecx - mov [eax+4], edx - - /* Release lock */ -#ifdef CONFIG_SMP - mov eax, [ebp+20] - RELEASE_SPINLOCK(eax) -#endif - - /* Restore flags */ - popfd - - /* Restore frame and return values */ - mov eax, [ebp-8] - mov edx, [ebp-4] - mov esp, ebp - pop ebp - ret 16 - -#ifdef CONFIG_SMP -.spin1: - popfd - SPIN_ON_LOCK(eax, .start1) -#endif - -/*PLIST_ENTRY - *NTAPI - *ExInterlockedInsertHeadList(IN PLIST_ENTRY ListHead, - * IN PLIST_ENTRY ListEntry, - * IN PKSPIN_LOCK Lock) - */ -PUBLIC _ExInterlockedAddUlong@12 -_ExInterlockedAddUlong@12: - - /* Save flags and disable interrupts */ - pushfd - - /* Get lock address */ -#ifdef CONFIG_SMP - mov edx, [ebp+16] -#endif -.start2: - cli - - /* Acquire lock */ - ACQUIRE_SPINLOCK(edx, .spin2) - - /* Do the calculation */ - mov ecx, [esp+8] -#ifdef CONFIG_SMP - mov eax, [ecx] - add eax, [esp+12] - - /* Save result */ - mov [ecx], eax -#else - - /* Do the calculation */ - mov edx, [ecx] - mov eax, edx - add edx, [esp+12] - - /* Save result */ - mov [ecx], edx -#endif - - /* Release lock, restore flags and return */ -#ifdef CONFIG_SMP - sub eax, [esp+12] - RELEASE_SPINLOCK(edx) -#endif - popfd - ret 12 - -#ifdef CONFIG_SMP -.spin2: - popfd - pushfd - SPIN_ON_LOCK(eax, .start2) -#endif - -/*PLIST_ENTRY - *NTAPI - *ExInterlockedInsertHeadList(IN PLIST_ENTRY ListHead, - * IN PLIST_ENTRY ListEntry, - * IN PKSPIN_LOCK Lock) - */ -PUBLIC _ExInterlockedInsertHeadList@12 -_ExInterlockedInsertHeadList@12: - - /* Save lock pointer */ -#ifdef CONFIG_SMP - mov edx, [esp+12] -#endif - - /* Save flags and disable interrupts */ -.start3: - pushfd - cli - ACQUIRE_SPINLOCK(edx, .spin3) - - /* Get list pointers */ - mov eax, [esp+8] - mov ecx, [esp+12] - mov edx, [eax] - - /* Do the insert */ - mov [ecx], edx - mov [ecx+4], eax - mov [eax], ecx - mov [edx+4], ecx - - /* Release lock */ -#ifdef CONFIG_SMP - mov ecx, [esp+16] - RELEASE_SPINLOCK(ecx) -#endif - - /* Restore flags */ - popfd - - /* check if the list was empty and return NULL */ - xor eax, edx - jz .l2 - - /* Return pointer */ - mov eax, edx - -.l2: - ret 12 - -#ifdef CONFIG_SMP -.spin3: - popfd - SPIN_ON_LOCK(edx, .start3) -#endif - -/*PLIST_ENTRY - *NTAPI - *ExInterlockedInsertTailList(IN PLIST_ENTRY ListHead, - * IN PLIST_ENTRY ListEntry, - * IN PKSPIN_LOCK Lock) - */ -PUBLIC _ExInterlockedInsertTailList@12 -_ExInterlockedInsertTailList@12: - - /* Save lock pointer */ -#ifdef CONFIG_SMP - mov edx, [esp+12] -#endif - - /* Save flags and disable interrupts */ -.start4: - pushfd - cli - ACQUIRE_SPINLOCK(edx, .spin4) - - /* Get list pointers */ - mov eax, [esp+8] - mov ecx, [esp+12] - mov edx, [eax+4] - - /* Do the insert */ - mov [ecx], eax - mov [ecx+4], edx - mov [eax+4], ecx - mov [edx], ecx - - /* Release lock */ -#ifdef CONFIG_SMP - mov ecx, [esp+16] - RELEASE_SPINLOCK(ecx) -#endif - - /* Restore flags */ - popfd - - /* Check if the list was empty and return NULL */ - xor eax, edx - jz .l3 - - /* Return pointer */ - mov eax, edx - -.l3: - ret 12 - -#ifdef CONFIG_SMP -.spin4: - popfd - SPIN_ON_LOCK(edx, .start4) -#endif - -/*PLIST_ENTRY - *NTAPI - *ExInterlockedRemoveHeadList(IN PLIST_ENTRY ListHead, - * IN PKSPIN_LOCK Lock) - */ -PUBLIC _ExInterlockedRemoveHeadList@8 -_ExInterlockedRemoveHeadList@8: - - /* Save lock pointer */ -#ifdef CONFIG_SMP - mov edx, [esp+8] -#endif - - /* Save flags and disable interrupts */ -.start5: - pushfd - cli - ACQUIRE_SPINLOCK(edx, .spin5) - - /* Get list pointers */ - mov edx, [esp+8] - mov eax, [edx] - - /* Check if it's empty */ - cmp eax, edx - je .l4 - - /* Get next entry and do deletion */ - mov ecx, [eax] - mov [edx], ecx - mov [ecx+4], edx - - /* Release lock */ -#ifdef CONFIG_SMP - mov ecx, [esp+12] - RELEASE_SPINLOCK(edx) -#endif - - /* Restore flags */ - popfd - - /* Return */ - ret 8 - -.l4: - /* Release lock */ -#ifdef CONFIG_SMP - mov edx, [esp+12] - RELEASE_SPINLOCK(edx) -#endif - - /* Restore flags */ - popfd - - /* Return empty list */ - xor eax, eax - ret 8 - -#ifdef CONFIG_SMP -.spin5: - popfd - SPIN_ON_LOCK(edx, .start5) -#endif - -/*PSINGLE_LIST_ENTRY - *NTAPI - *ExInterlockedPopEntryList(IN PSINGLE_LIST_ENTRY ListHead, - * IN PKSPIN_LOCK Lock) - */ -PUBLIC _ExInterlockedPopEntryList@8 -_ExInterlockedPopEntryList@8: - - /* Save lock pointer */ -#ifdef CONFIG_SMP - mov edx, [esp+8] -#endif - - /* Save flags and disable interrupts */ -.start6: - pushfd - cli - ACQUIRE_SPINLOCK(edx, .spin6) - - /* Get list pointers */ - mov edx, [esp+8] - mov eax, [ecx] - - /* Check if it's empty */ - or eax, eax - je .l6 - - /* Get next entry and do deletion */ - mov edx, [eax] - mov [ecx], edx - -.l5: - /* Release lock */ -#ifdef CONFIG_SMP - mov ecx, [esp+12] - RELEASE_SPINLOCK(edx) -#endif - - /* Restore flags */ - popfd - - /* Return */ - ret 8 - -.l6: - /* Return empty list */ - xor eax, eax - jmp .l5 - -#ifdef CONFIG_SMP -.spin6: - popfd - SPIN_ON_LOCK(edx, .start6) -#endif - -/*PSINGLE_LIST_ENTRY - *NTAPI - *ExInterlockedPushEntryList(IN PSINGLE_LIST_ENTRY ListHead, - * IN PSINGLE_LIST_ENTRY ListEntry, - * IN PKSPIN_LOCK Lock) - */ -PUBLIC _ExInterlockedPushEntryList@12 -_ExInterlockedPushEntryList@12: - - /* Save lock pointer */ -#ifdef CONFIG_SMP - mov edx, [esp+12] -#endif - - /* Save flags and disable interrupts */ -.start7: - pushfd - cli - ACQUIRE_SPINLOCK(edx, .spin7) - - /* Get list pointers */ - mov edx, [esp+8] - mov eax, [edx] - mov ecx, [esp+12] - - /* Do push */ - mov [ecx], eax - mov [edx], ecx - - /* Release lock */ -#ifdef CONFIG_SMP - mov ecx, [esp+16] - RELEASE_SPINLOCK(edx) -#endif - - /* Restore flags */ - popfd - - /* Return */ - ret 12 - -#ifdef CONFIG_SMP -.spin7: - popfd - SPIN_ON_LOCK(edx, .start7) -#endif - -/*INTERLOCKED_RESULT - *NTAPI - *ExInterlockedIncrementLong(IN PLONG Addend, - * IN PKSPIN_LOCK Lock) - */ -PUBLIC _ExInterlockedIncrementLong@8 -_ExInterlockedIncrementLong@8: - - /* Get addend */ - mov eax, [esp+4] - - /* Do the op */ - LOCK add dword ptr [eax], 1 - - /* Return */ - lahf - and eax, EFLAG_SELECT - ret 8 - -/*INTERLOCKED_RESULT - *NTAPI - *ExInterlockedDecrementLong(IN PLONG Addend, - * IN PKSPIN_LOCK Lock) - */ -PUBLIC _ExInterlockedDecrementLong@8 -_ExInterlockedDecrementLong@8: - - /* Get addend */ - mov eax, [esp+4] - - /* Do the op */ - LOCK sub dword ptr [eax], 1 - - /* Return */ - lahf - and eax, EFLAG_SELECT - ret 8 - -/*ULONG - *NTAPI - *ExInterlockedExchangeUlong(IN PULONG Target, - * IN ULONG Value, - * IN PKSPIN_LOCK Lock) - */ -PUBLIC _ExInterlockedExchangeUlong@12 -_ExInterlockedExchangeUlong@12: - - /* Get pointers */ - mov edx, [esp+4] - mov eax, [esp+8] - -#ifdef CONFIG_SMP - /* On MP, do the exchange */ - xchg [edx], eax -#else - /* On UP, disable interrupts and save flags */ - pushfd - cli - - /* Switch values */ - mov eax, [edx] - mov [edx], ecx - popfd -#endif - - /* Return */ - ret 12 - -/*INTERLOCKED_RESULT - *NTAPI - *Exi386InterlockedIncrementLong(IN PLONG Addend, - * IN PKSPIN_LOCK Lock) - */ -PUBLIC _Exi386InterlockedIncrementLong@4 -_Exi386InterlockedIncrementLong@4: - - /* Get addend */ - mov eax, [esp+4] - - /* Do the op */ - LOCK add dword ptr [eax], 1 - - /* Return */ - lahf - and eax, EFLAG_SELECT - ret 4 - -/*INTERLOCKED_RESULT - *NTAPI - *Exi386InterlockedDecrementLong(IN PLONG Addend, - * IN PKSPIN_LOCK Lock) - */ -PUBLIC _Exi386InterlockedDecrementLong@4 -_Exi386InterlockedDecrementLong@4: - - /* Get addend */ - mov eax, [esp+4] - - /* Do the op */ - LOCK sub dword ptr [eax], 1 - - /* Return */ - lahf - and eax, EFLAG_SELECT - ret 8 - -/*ULONG - *NTAPI - *Exi386InterlockedExchangeUlong(IN PULONG Target, - * IN ULONG Value, - * IN PKSPIN_LOCK Lock) - */ -PUBLIC _Exi386InterlockedExchangeUlong@12 -_Exi386InterlockedExchangeUlong@12: - - /* Get pointers */ - mov edx, [esp+4] - mov eax, [esp+8] - -#ifdef CONFIG_SMP - /* On MP, do the exchange */ - xchg [edx], eax -#else - /* On UP, disable interrupts and save flags */ - pushfd - cli - - /* Switch values */ - mov eax, [edx] - mov [edx], ecx - popfd -#endif - - /* Return */ - ret 8 - -END -/* EOF */ diff --git a/ntoskrnl/ex/init.c b/ntoskrnl/ex/init.c index 302d1fff48a..f017d4147aa 100644 --- a/ntoskrnl/ex/init.c +++ b/ntoskrnl/ex/init.c @@ -10,6 +10,7 @@ /* INCLUDES ******************************************************************/ #include +#include #define NDEBUG #include @@ -244,7 +245,7 @@ ExpInitNls(IN PLOADER_PARAMETER_BLOCK LoaderBlock) /* Allocate the a new buffer since loader memory will be freed */ ExpNlsTableBase = ExAllocatePoolWithTag(NonPagedPool, ExpNlsTableSize, - 'iltR'); + TAG_RTLI); if (!ExpNlsTableBase) KeBugCheck(PHASE0_INITIALIZATION_FAILED); /* Copy the codepage data in its new location. */ @@ -334,7 +335,7 @@ ExpInitNls(IN PLOADER_PARAMETER_BLOCK LoaderBlock) RtlCopyMemory(SectionBase, ExpNlsTableBase, ExpNlsTableSize); /* Free the previously allocated buffer and set the new location */ - ExFreePoolWithTag(ExpNlsTableBase, 'iltR'); + ExFreePoolWithTag(ExpNlsTableBase, TAG_RTLI); ExpNlsTableBase = SectionBase; /* Initialize the NLS Tables */ @@ -1313,7 +1314,7 @@ Phase1InitializationDiscard(IN PVOID Context) size_t Remaining; PRTL_USER_PROCESS_INFORMATION ProcessInfo; KEY_VALUE_PARTIAL_INFORMATION KeyPartialInfo; - UNICODE_STRING KeyName, DebugString; + UNICODE_STRING KeyName; OBJECT_ATTRIBUTES ObjectAttributes; HANDLE KeyHandle, OptionHandle; PRTL_USER_PROCESS_PARAMETERS ProcessParameters = NULL; @@ -1321,7 +1322,7 @@ Phase1InitializationDiscard(IN PVOID Context) /* Allocate the initialization buffer */ InitBuffer = ExAllocatePoolWithTag(NonPagedPool, sizeof(INIT_BUFFER), - 'tinI'); + TAG_INIT); if (!InitBuffer) { /* Bugcheck */ @@ -1792,7 +1793,10 @@ Phase1InitializationDiscard(IN PVOID Context) &KeyPartialInfo, sizeof(KeyPartialInfo), &Length); - if (!NT_SUCCESS(Status)) AlternateShell = FALSE; + if (!(NT_SUCCESS(Status) || Status == STATUS_BUFFER_OVERFLOW)) + { + AlternateShell = FALSE; + } } /* Create the option key */ @@ -1901,39 +1905,34 @@ Phase1InitializationDiscard(IN PVOID Context) /* Initialize Power Subsystem in Phase 1*/ if (!PoInitSystem(1)) KeBugCheck(INTERNAL_POWER_ERROR); + /* Update progress bar */ + InbvUpdateProgressBar(90); + /* Initialize the Process Manager at Phase 1 */ if (!PsInitSystem(LoaderBlock)) KeBugCheck(PROCESS1_INITIALIZATION_FAILED); - /* Update progress bar */ - InbvUpdateProgressBar(85); - /* Make sure nobody touches the loader block again */ if (LoaderBlock == KeLoaderBlock) KeLoaderBlock = NULL; LoaderBlock = Context = NULL; - /* Update progress bar */ - InbvUpdateProgressBar(90); - - /* Launch initial process */ - DPRINT1("Free non-cache pages: %lx\n", MmAvailablePages + MiMemoryConsumers[MC_CACHE].PagesUsed); - ProcessInfo = &InitBuffer->ProcessInfo; - ExpLoadInitialProcess(InitBuffer, &ProcessParameters, &Environment); - /* Update progress bar */ InbvUpdateProgressBar(100); /* Allow strings to be displayed */ InbvEnableDisplayString(TRUE); - /* Wait 5 seconds for it to initialize */ + /* Launch initial process */ + DPRINT1("Free non-cache pages: %lx\n", MmAvailablePages + MiMemoryConsumers[MC_CACHE].PagesUsed); + ProcessInfo = &InitBuffer->ProcessInfo; + ExpLoadInitialProcess(InitBuffer, &ProcessParameters, &Environment); + + /* Wait 5 seconds for initial process to initialize */ Timeout.QuadPart = Int32x32To64(5, -10000000); Status = ZwWaitForSingleObject(ProcessInfo->ProcessHandle, FALSE, &Timeout); - if (InbvBootDriverInstalled) FinalizeBootLogo(); if (Status == STATUS_SUCCESS) { /* Failed, display error */ - RtlInitUnicodeString(&DebugString, L"INIT: Session Manager terminated."); - ZwDisplayString(&DebugString); + DPRINT1("INIT: Session Manager terminated.\n"); /* Bugcheck the system if SMSS couldn't initialize */ KeBugCheck(SESSION5_INITIALIZATION_FAILED); @@ -1957,11 +1956,14 @@ Phase1InitializationDiscard(IN PVOID Context) &Size, MEM_RELEASE); + /* Clean the screen */ + if (InbvBootDriverInstalled) FinalizeBootLogo(); + /* Increase init phase */ ExpInitializationPhase++; /* Free the boot buffer */ - ExFreePool(InitBuffer); + ExFreePoolWithTag(InitBuffer, TAG_INIT); DPRINT1("Free non-cache pages: %lx\n", MmAvailablePages + MiMemoryConsumers[MC_CACHE].PagesUsed); } diff --git a/ntoskrnl/ex/interlocked.c b/ntoskrnl/ex/interlocked.c new file mode 100644 index 00000000000..65b3872bee2 --- /dev/null +++ b/ntoskrnl/ex/interlocked.c @@ -0,0 +1,545 @@ +/* +* PROJECT: ReactOS Kernel +* LICENSE: GPL - See COPYING in the top level directory +* FILE: ntoskrnl/ex/interlocked.c +* PURPOSE: Interlocked functions +* PROGRAMMERS: Timo Kreuzer (timo.kreuzer@reactos.org) +*/ + +/* INCLUDES *****************************************************************/ + +#include + +#define NDEBUG +#include + +#undef ExInterlockedAddUlong +#undef ExInterlockedInsertHeadList +#undef ExInterlockedInsertTailList +#undef ExInterlockedRemoveHeadList +#undef ExInterlockedPopEntryList +#undef ExInterlockedPushEntryList +#undef ExInterlockedIncrementLong +#undef ExInterlockedDecrementLong +#undef ExInterlockedExchangeUlong +#undef ExInterlockedCompareExchange64 + + +/* FUNCTIONS ****************************************************************/ + +FORCEINLINE +BOOLEAN +_ExiDisableInteruptsAndAcquireSpinlock( + IN OUT PKSPIN_LOCK Lock) +{ + BOOLEAN Enabled; + + /* Disable interrupts */ + Enabled = KeDisableInterrupts(); + + /* Acquire the spinlock (inline) */ + KxAcquireSpinLock(Lock); + + return Enabled; +} + +FORCEINLINE +VOID +_ExiReleaseSpinLockAndRestoreInterupts( + IN OUT PKSPIN_LOCK Lock, + BOOLEAN Enable) +{ + /* Release the spinlock */ + KxReleaseSpinLock(Lock); + + /* Restore interrupts */ + KeRestoreInterrupts(Enable); +} + + +LARGE_INTEGER +NTAPI +ExInterlockedAddLargeInteger( + IN OUT PLARGE_INTEGER Addend, + IN LARGE_INTEGER Increment, + IN OUT PKSPIN_LOCK Lock) +{ + LARGE_INTEGER OldValue; + BOOLEAN Enable; + + /* Disable interrupts and acquire the spinlock */ + Enable = _ExiDisableInteruptsAndAcquireSpinlock(Lock); + + /* Save the old value */ + OldValue.QuadPart = Addend->QuadPart; + + /* Do the operation */ + Addend->QuadPart += Increment.QuadPart; + + /* Release the spinlock and restore interrupts */ + _ExiReleaseSpinLockAndRestoreInterupts(Lock, Enable); + + /* Return the old value */ + return OldValue; +} + +ULONG +NTAPI +ExInterlockedAddUlong( + IN OUT PULONG Addend, + IN ULONG Increment, + IN OUT PKSPIN_LOCK Lock) +{ + BOOLEAN Enable; + ULONG OldValue; + + /* Disable interrupts and acquire the spinlock */ + Enable = _ExiDisableInteruptsAndAcquireSpinlock(Lock); + + /* Save the old value */ + OldValue = *Addend; + + /* Do the operation */ + *Addend += Increment; + + /* Release the spinlock and restore interrupts */ + _ExiReleaseSpinLockAndRestoreInterupts(Lock, Enable); + + /* Return the old value */ + return OldValue; +} + +PLIST_ENTRY +NTAPI +ExInterlockedInsertHeadList( + IN OUT PLIST_ENTRY ListHead, + IN OUT PLIST_ENTRY ListEntry, + IN OUT PKSPIN_LOCK Lock) +{ + BOOLEAN Enable; + PLIST_ENTRY FirstEntry; + + /* Disable interrupts and acquire the spinlock */ + Enable = _ExiDisableInteruptsAndAcquireSpinlock(Lock); + + /* Save the first entry */ + FirstEntry = ListHead->Flink; + + /* Insert the new entry */ + InsertHeadList(ListHead, ListEntry); + + /* Release the spinlock and restore interrupts */ + _ExiReleaseSpinLockAndRestoreInterupts(Lock, Enable); + + /* Return the old first entry or NULL for empty list */ + return (FirstEntry == ListHead) ? NULL : FirstEntry; +} + +PLIST_ENTRY +NTAPI +ExInterlockedInsertTailList( + IN OUT PLIST_ENTRY ListHead, + IN OUT PLIST_ENTRY ListEntry, + IN OUT PKSPIN_LOCK Lock) +{ + BOOLEAN Enable; + PLIST_ENTRY LastEntry; + + /* Disable interrupts and acquire the spinlock */ + Enable = _ExiDisableInteruptsAndAcquireSpinlock(Lock); + + /* Save the last entry */ + LastEntry = ListHead->Blink; + + /* Insert the new entry */ + InsertTailList(ListHead, ListEntry); + + /* Release the spinlock and restore interrupts */ + _ExiReleaseSpinLockAndRestoreInterupts(Lock, Enable); + + /* Return the old last entry or NULL for empty list */ + return (LastEntry == ListHead) ? NULL : LastEntry; +} + +PLIST_ENTRY +NTAPI +ExInterlockedRemoveHeadList( + IN OUT PLIST_ENTRY ListHead, + IN OUT PKSPIN_LOCK Lock) +{ + BOOLEAN Enable; + PLIST_ENTRY ListEntry; + + /* Disable interrupts and acquire the spinlock */ + Enable = _ExiDisableInteruptsAndAcquireSpinlock(Lock); + + /* Check if the list is empty */ + if (IsListEmpty(ListHead)) + { + /* Return NULL */ + ListEntry = NULL; + } + else + { + /* Remove the first entry from the list head */ + ListEntry = RemoveHeadList(ListHead); + } + + /* Release the spinlock and restore interrupts */ + _ExiReleaseSpinLockAndRestoreInterupts(Lock, Enable); + + /* Return the entry */ + return ListEntry; +} + +PSINGLE_LIST_ENTRY +NTAPI +ExInterlockedPopEntryList( + IN OUT PSINGLE_LIST_ENTRY ListHead, + IN OUT PKSPIN_LOCK Lock) +{ + BOOLEAN Enable; + PSINGLE_LIST_ENTRY ListEntry; + + /* Disable interrupts and acquire the spinlock */ + Enable = _ExiDisableInteruptsAndAcquireSpinlock(Lock); + + /* Pop the first entry from the list */ + ListEntry = PopEntryList(ListHead); + + /* Release the spinlock and restore interrupts */ + _ExiReleaseSpinLockAndRestoreInterupts(Lock, Enable); + + /* Return the entry */ + return ListEntry; +} + +PSINGLE_LIST_ENTRY +NTAPI +ExInterlockedPushEntryList( + IN OUT PSINGLE_LIST_ENTRY ListHead, + IN OUT PSINGLE_LIST_ENTRY ListEntry, + IN OUT PKSPIN_LOCK Lock) +{ + BOOLEAN Enable; + PSINGLE_LIST_ENTRY OldListEntry; + + /* Disable interrupts and acquire the spinlock */ + Enable = _ExiDisableInteruptsAndAcquireSpinlock(Lock); + + /* Save the old top entry */ + OldListEntry = ListHead->Next; + + /* Push a new entry on the list */ + PushEntryList(ListHead, ListEntry); + + /* Release the spinlock and restore interrupts */ + _ExiReleaseSpinLockAndRestoreInterupts(Lock, Enable); + + /* Return the entry */ + return OldListEntry; +} + +INTERLOCKED_RESULT +NTAPI +ExInterlockedIncrementLong( + IN PLONG Addend, + IN PKSPIN_LOCK Lock) +{ + LONG Result; + + Result = _InterlockedIncrement(Addend); + return (Result < 0) ? ResultNegative : + (Result > 0) ? ResultPositive : + ResultZero; +} + +INTERLOCKED_RESULT +NTAPI +ExInterlockedDecrementLong( + IN PLONG Addend, + IN PKSPIN_LOCK Lock) +{ + LONG Result; + + Result = _InterlockedDecrement(Addend); + return (Result < 0) ? ResultNegative : + (Result > 0) ? ResultPositive : + ResultZero; +} + +ULONG +NTAPI +ExInterlockedExchangeUlong( + IN PULONG Target, + IN ULONG Value, + IN PKSPIN_LOCK Lock) +{ + return (ULONG)_InterlockedExchange((PLONG)Target, (LONG)Value); +} + +#ifdef _M_IX86 + +ULONG +FASTCALL +ExfInterlockedAddUlong( + IN OUT PULONG Addend, + IN ULONG Increment, + IN OUT PKSPIN_LOCK Lock) +{ + BOOLEAN Enable; + ULONG OldValue; + + /* Disable interrupts and acquire the spinlock */ + Enable = _ExiDisableInteruptsAndAcquireSpinlock(Lock); + + /* Save the old value */ + OldValue = *Addend; + + /* Do the operation */ + *Addend += Increment; + + /* Release the spinlock and restore interrupts */ + _ExiReleaseSpinLockAndRestoreInterupts(Lock, Enable); + + /* Return the old value */ + return OldValue; +} + +PLIST_ENTRY +FASTCALL +ExfInterlockedInsertHeadList( + IN OUT PLIST_ENTRY ListHead, + IN PLIST_ENTRY ListEntry, + IN OUT PKSPIN_LOCK Lock) +{ + BOOLEAN Enable; + PLIST_ENTRY FirstEntry; + + /* Disable interrupts and acquire the spinlock */ + Enable = _ExiDisableInteruptsAndAcquireSpinlock(Lock); + + /* Save the first entry */ + FirstEntry = ListHead->Flink; + + /* Insert the new entry */ + InsertHeadList(ListHead, ListEntry); + + /* Release the spinlock and restore interrupts */ + _ExiReleaseSpinLockAndRestoreInterupts(Lock, Enable); + + /* Return the old first entry or NULL for empty list */ + return (FirstEntry == ListHead) ? NULL : FirstEntry; +} + +PLIST_ENTRY +FASTCALL +ExfInterlockedInsertTailList( + IN OUT PLIST_ENTRY ListHead, + IN PLIST_ENTRY ListEntry, + IN OUT PKSPIN_LOCK Lock) +{ + BOOLEAN Enable; + PLIST_ENTRY LastEntry; + + /* Disable interrupts and acquire the spinlock */ + Enable = _ExiDisableInteruptsAndAcquireSpinlock(Lock); + + /* Save the last entry */ + LastEntry = ListHead->Blink; + + /* Insert the new entry */ + InsertTailList(ListHead, ListEntry); + + /* Release the spinlock and restore interrupts */ + _ExiReleaseSpinLockAndRestoreInterupts(Lock, Enable); + + /* Return the old last entry or NULL for empty list */ + return (LastEntry == ListHead) ? NULL : LastEntry; +} + + +PLIST_ENTRY +FASTCALL +ExfInterlockedRemoveHeadList( + IN OUT PLIST_ENTRY ListHead, + IN OUT PKSPIN_LOCK Lock) +{ + BOOLEAN Enable; + PLIST_ENTRY ListEntry; + + /* Disable interrupts and acquire the spinlock */ + Enable = _ExiDisableInteruptsAndAcquireSpinlock(Lock); + + /* Check if the list is empty */ + if (IsListEmpty(ListHead)) + { + /* Return NULL */ + ListEntry = NULL; + } + else + { + /* Remove the first entry from the list head */ + ListEntry = RemoveHeadList(ListHead); + } + + /* Release the spinlock and restore interrupts */ + _ExiReleaseSpinLockAndRestoreInterupts(Lock, Enable); + + /* return the entry */ + return ListEntry; +} + +PSINGLE_LIST_ENTRY +FASTCALL +ExfInterlockedPopEntryList( + IN OUT PSINGLE_LIST_ENTRY ListHead, + IN OUT PKSPIN_LOCK Lock) +{ + BOOLEAN Enable; + PSINGLE_LIST_ENTRY ListEntry; + + /* Disable interrupts and acquire the spinlock */ + Enable = _ExiDisableInteruptsAndAcquireSpinlock(Lock); + + /* Pop the first entry from the list */ + ListEntry = PopEntryList(ListHead); + + /* Release the spinlock and restore interrupts */ + _ExiReleaseSpinLockAndRestoreInterupts(Lock, Enable); + + /* return the entry */ + return ListEntry; +} + +PSINGLE_LIST_ENTRY +FASTCALL +ExfInterlockedPushEntryList( + IN OUT PSINGLE_LIST_ENTRY ListHead, + IN PSINGLE_LIST_ENTRY ListEntry, + IN OUT PKSPIN_LOCK Lock) +{ + BOOLEAN Enable; + PSINGLE_LIST_ENTRY OldListEntry; + + /* Disable interrupts and acquire the spinlock */ + Enable = _ExiDisableInteruptsAndAcquireSpinlock(Lock); + + /* Save the old top entry */ + OldListEntry = ListHead->Next; + + /* Push a new entry on the list */ + PushEntryList(ListHead, ListEntry); + + /* Release the spinlock and restore interrupts */ + _ExiReleaseSpinLockAndRestoreInterupts(Lock, Enable); + + /* return the entry */ + return OldListEntry; +} + +INTERLOCKED_RESULT +NTAPI +Exi386InterlockedIncrementLong( + IN PLONG Addend) +{ + LONG Result; + + Result = _InterlockedIncrement(Addend); + return (Result < 0) ? ResultNegative : + (Result > 0) ? ResultPositive : + ResultZero; +} + +INTERLOCKED_RESULT +FASTCALL +Exfi386InterlockedIncrementLong( + IN OUT LONG volatile *Addend) +{ + LONG Result; + + Result = _InterlockedIncrement(Addend); + return (Result < 0) ? ResultNegative : + (Result > 0) ? ResultPositive : + ResultZero; +} + +INTERLOCKED_RESULT +NTAPI +Exi386InterlockedDecrementLong( + IN PLONG Addend) +{ + LONG Result; + + Result = _InterlockedDecrement(Addend); + return (Result < 0) ? ResultNegative : + (Result > 0) ? ResultPositive : + ResultZero; +} + +INTERLOCKED_RESULT +FASTCALL +Exfi386InterlockedDecrementLong( + IN OUT PLONG Addend) +{ + LONG Result; + + Result = _InterlockedDecrement(Addend); + return (Result < 0) ? ResultNegative : + (Result > 0) ? ResultPositive : + ResultZero; +} + +LONG +NTAPI +Exi386InterlockedExchangeUlong( + PLONG Target, + LONG Exchange) +{ + return _InterlockedExchange(Target, Exchange); +} + +ULONG +FASTCALL +Exfi386InterlockedExchangeUlong( + IN OUT PULONG Target, + IN ULONG Exchange) +{ + return _InterlockedExchange((PLONG)Target, Exchange); +} + +LONGLONG +FASTCALL +ExInterlockedCompareExchange64( + IN OUT LONGLONG volatile *Destination, + IN PLONGLONG Exchange, + IN PLONGLONG Comparand, + IN PKSPIN_LOCK Lock) +{ + return _InterlockedCompareExchange64(Destination, *Exchange, *Comparand); +} + +LONGLONG +FASTCALL +ExfInterlockedCompareExchange64( + IN OUT LONGLONG volatile *Destination, + IN PLONGLONG Exchange, + IN PLONGLONG Comparand) +{ + return _InterlockedCompareExchange64(Destination, *Exchange, *Comparand); +} +#endif + +#if 0 + +VOID +FASTCALL +ExInterlockedAddLargeStatistic( + IN OUT PLARGE_INTEGER Addend, + IN ULONG Increment) +{ +} + + +#endif + diff --git a/ntoskrnl/ex/profile.c b/ntoskrnl/ex/profile.c index f931edfb9b5..adf8221efe6 100644 --- a/ntoskrnl/ex/profile.c +++ b/ntoskrnl/ex/profile.c @@ -54,7 +54,7 @@ ExpDeleteProfile(PVOID ObjectBody) /* Unmap the Locked Buffer */ MmUnmapLockedPages(Profile->LockedBufferAddress, Profile->Mdl); MmUnlockPages(Profile->Mdl); - ExFreePool(Profile->Mdl); + IoFreeMdl(Profile->Mdl); } /* Check if a Process is associated and reference it */ @@ -368,7 +368,7 @@ NtStartProfile(IN HANDLE ProfileHandle) } /* Allocate the Mdl Structure */ - Profile->Mdl = MmCreateMdl(NULL, Profile->Buffer, Profile->BufferSize); + Profile->Mdl = IoAllocateMdl(Profile->Buffer, Profile->BufferSize, FALSE, FALSE, NULL); /* Protect this in SEH as we might raise an exception */ _SEH2_TRY @@ -381,7 +381,7 @@ NtStartProfile(IN HANDLE ProfileHandle) /* Release our lock, free the buffer, dereference and return */ KeReleaseMutex(&ExpProfileMutex, FALSE); ObDereferenceObject(Profile); - ExFreePool(ProfileObject); + ExFreePoolWithTag(ProfileObject, TAG_PROFILE); _SEH2_YIELD(return _SEH2_GetExceptionCode()); } _SEH2_END; @@ -449,7 +449,7 @@ NtStopProfile(IN HANDLE ProfileHandle) /* Unlock the Buffer */ MmUnmapLockedPages(Profile->LockedBufferAddress, Profile->Mdl); MmUnlockPages(Profile->Mdl); - ExFreePool(Profile->ProfileObject); + ExFreePoolWithTag(Profile->ProfileObject, TAG_PROFILE); /* Clear the Locked Buffer pointer, meaning the Object is Stopped */ Profile->LockedBufferAddress = NULL; diff --git a/ntoskrnl/ex/resource.c b/ntoskrnl/ex/resource.c index 1ea2ec0d7b4..1d33a45e322 100644 --- a/ntoskrnl/ex/resource.c +++ b/ntoskrnl/ex/resource.c @@ -13,8 +13,8 @@ #include /* Macros for reading resource flags */ -#define IsExclusiveWaiting(r) (r->NumberOfExclusiveWaiters) -#define IsSharedWaiting(r) (r->NumberOfSharedWaiters) +#define IsExclusiveWaiting(r) (r->NumberOfExclusiveWaiters > 0) +#define IsSharedWaiting(r) (r->NumberOfSharedWaiters > 0) #define IsOwnedExclusive(r) (r->Flag & ResourceOwnedExclusive) #define IsBoostAllowed(r) (!(r->Flag & ResourceHasDisabledPriorityBoost)) @@ -220,7 +220,7 @@ ExpAllocateExclusiveWaiterEvent(IN PERESOURCE Resource, { /* Someone already set it, free our event */ DPRINT1("WARNING: Handling race condition\n"); - ExFreePool(Event); + ExFreePoolWithTag(Event, TAG_RESOURCE_EVENT); } break; @@ -280,7 +280,7 @@ ExpAllocateSharedWaiterSemaphore(IN PERESOURCE Resource, { /* Someone already set it, free our semaphore */ DPRINT1("WARNING: Handling race condition\n"); - ExFreePool(Semaphore); + ExFreePoolWithTag(Semaphore, TAG_RESOURCE_SEMAPHORE); } break; @@ -356,7 +356,7 @@ ExpExpandResourceOwnerTable(IN PERESOURCE Resource, { /* Resource changed while we weren't holding the lock; bail out */ ExReleaseResourceLock(Resource, LockHandle); - ExFreePool(Table); + ExFreePoolWithTag(Table, TAG_RESOURCE_TABLE); } else { @@ -380,7 +380,7 @@ ExpExpandResourceOwnerTable(IN PERESOURCE Resource, ExReleaseResourceLock(Resource, LockHandle); /* Free the old table */ - if (Owner) ExFreePool(Owner); + if (Owner) ExFreePoolWithTag(Owner, TAG_RESOURCE_TABLE); /* Set the resource index */ if (!OldSize) OldSize = 1; @@ -1159,7 +1159,7 @@ TryAcquire: { /* Release the lock and return */ ExReleaseResourceLock(Resource, &LockHandle); - return TRUE; + return FALSE; } /* Check if we have a shared waiters semaphore */ @@ -1276,7 +1276,7 @@ TryAcquire: { /* So bail out if we're not allowed */ ExReleaseResourceLock(Resource, &LockHandle); - return TRUE; + return FALSE; } /* Check if we have a shared waiters semaphore */ @@ -1359,7 +1359,7 @@ TryAcquire: { /* So bail out if we're not allowed */ ExReleaseResourceLock(Resource, &LockHandle); - return TRUE; + return FALSE; } /* Check if we have a shared waiters semaphore */ @@ -1473,9 +1473,9 @@ ExDeleteResourceLite(IN PERESOURCE Resource) KeReleaseInStackQueuedSpinLock(&LockHandle); /* Free every structure */ - if (Resource->OwnerTable) ExFreePool(Resource->OwnerTable); - if (Resource->SharedWaiters) ExFreePool(Resource->SharedWaiters); - if (Resource->ExclusiveWaiters) ExFreePool(Resource->ExclusiveWaiters); + if (Resource->OwnerTable) ExFreePoolWithTag(Resource->OwnerTable, TAG_RESOURCE_TABLE); + if (Resource->SharedWaiters) ExFreePoolWithTag(Resource->SharedWaiters, TAG_RESOURCE_SEMAPHORE); + if (Resource->ExclusiveWaiters) ExFreePoolWithTag(Resource->ExclusiveWaiters, TAG_RESOURCE_EVENT); /* Return success */ return STATUS_SUCCESS; diff --git a/ntoskrnl/ex/sysinfo.c b/ntoskrnl/ex/sysinfo.c index 483c92057ea..837c9e6fc41 100644 --- a/ntoskrnl/ex/sysinfo.c +++ b/ntoskrnl/ex/sysinfo.c @@ -1465,8 +1465,9 @@ QSI_DEF(SystemExceptionInformation) PSYSTEM_EXCEPTION_INFORMATION ExceptionInformation = (PSYSTEM_EXCEPTION_INFORMATION)Buffer; PKPRCB Prcb; - ULONG i, AlignmentFixupCount = 0, ExceptionDispatchCount = 0; + ULONG AlignmentFixupCount = 0, ExceptionDispatchCount = 0; ULONG FloatingEmulationCount = 0, ByteWordEmulationCount = 0; + CHAR i; /* Check size of a buffer, it must match our expectations */ if (sizeof(SYSTEM_EXCEPTION_INFORMATION) != Size) @@ -1523,8 +1524,9 @@ QSI_DEF(SystemContextSwitchInformation) { PSYSTEM_CONTEXT_SWITCH_INFORMATION ContextSwitchInformation = (PSYSTEM_CONTEXT_SWITCH_INFORMATION)Buffer; - ULONG ContextSwitches, i; + ULONG ContextSwitches; PKPRCB Prcb; + CHAR i; /* Check size of a buffer, it must match our expectations */ if (sizeof(SYSTEM_CONTEXT_SWITCH_INFORMATION) != Size) @@ -1775,11 +1777,15 @@ QSI_DEF(SystemInvalidInfoClass4) /* Class 50 - System range start address */ QSI_DEF(SystemRangeStartInformation) { - /* FIXME */ - DPRINT1("NtQuerySystemInformation - SystemRangeStartInformation not implemented\n"); - return STATUS_NOT_IMPLEMENTED; -} + /* Check user buffer's size */ + if (Size != sizeof(ULONG_PTR)) return STATUS_INFO_LENGTH_MISMATCH; + *(PULONG_PTR)Buffer = (ULONG_PTR)MmSystemRangeStart; + + if (ReqSize) *ReqSize = sizeof(ULONG_PTR); + + return STATUS_SUCCESS; +} /* Class 51 - Driver verifier information */ QSI_DEF(SystemVerifierInformation) diff --git a/ntoskrnl/ex/win32k.c b/ntoskrnl/ex/win32k.c index 9cd929996c9..9cf0a09a19a 100644 --- a/ntoskrnl/ex/win32k.c +++ b/ntoskrnl/ex/win32k.c @@ -43,7 +43,7 @@ PKWIN32_DELETEMETHOD_CALLOUT ExpDesktopObjectDelete = NULL; /* FUNCTIONS ****************************************************************/ -NTSTATUS +BOOLEAN NTAPI ExpDesktopOkToClose( IN PEPROCESS Process OPTIONAL, IN PVOID Object, @@ -57,10 +57,10 @@ ExpDesktopOkToClose( IN PEPROCESS Process OPTIONAL, Parameters.Handle = Handle; Parameters.PreviousMode = AccessMode; - return ExpDesktopObjectOkToClose(&Parameters); + return NT_SUCCESS(ExpDesktopObjectOkToClose(&Parameters)); } -NTSTATUS +BOOLEAN NTAPI ExpWindowStationOkToClose( IN PEPROCESS Process OPTIONAL, IN PVOID Object, @@ -74,7 +74,7 @@ ExpWindowStationOkToClose( IN PEPROCESS Process OPTIONAL, Parameters.Handle = Handle; Parameters.PreviousMode = AccessMode; - return ExpWindowStationObjectOkToClose(&Parameters); + return NT_SUCCESS(ExpWindowStationObjectOkToClose(&Parameters)); } VOID diff --git a/ntoskrnl/fstub/disksup.c b/ntoskrnl/fstub/disksup.c index c4a67c3413f..72643f87e4e 100644 --- a/ntoskrnl/fstub/disksup.c +++ b/ntoskrnl/fstub/disksup.c @@ -159,7 +159,7 @@ xHalpGetRDiskCount(VOID) BOOLEAN First = TRUE; ULONG Count; - DirectoryInfo = ExAllocatePool(PagedPool, 2 * PAGE_SIZE); + DirectoryInfo = ExAllocatePoolWithTag(PagedPool, 2 * PAGE_SIZE, TAG_FILE_SYSTEM); if (DirectoryInfo == NULL) { return 0; @@ -178,7 +178,7 @@ xHalpGetRDiskCount(VOID) if (!NT_SUCCESS(Status)) { DPRINT1("ZwOpenDirectoryObject for %wZ failed, status=%lx\n", &ArcName, Status); - ExFreePool(DirectoryInfo); + ExFreePoolWithTag(DirectoryInfo, TAG_FILE_SYSTEM); return 0; } @@ -223,7 +223,7 @@ xHalpGetRDiskCount(VOID) } } } - ExFreePool(DirectoryInfo); + ExFreePoolWithTag(DirectoryInfo, TAG_FILE_SYSTEM); return RDiskCount; } @@ -377,8 +377,8 @@ xHalQueryDriveLayout(IN PUNICODE_STRING DeviceName, PDRIVE_LAYOUT_INFORMATION Buffer; /* Allocate a partition list for a single entry. */ - Buffer = ExAllocatePool(NonPagedPool, - sizeof(DRIVE_LAYOUT_INFORMATION)); + Buffer = ExAllocatePoolWithTag(NonPagedPool, + sizeof(DRIVE_LAYOUT_INFORMATION), TAG_FILE_SYSTEM); if (Buffer != NULL) { RtlZeroMemory(Buffer, @@ -398,7 +398,7 @@ xHalQueryDriveLayout(IN PUNICODE_STRING DeviceName, /* Read the partition table */ Status = IoReadPartitionTable(DeviceObject, DiskGeometry.BytesPerSector, - FALSE, + TRUE, LayoutInfo); } @@ -446,13 +446,13 @@ xHalIoAssignDriveLetters(IN PLOADER_PARAMETER_BLOCK LoaderBlock, DPRINT("RDiskCount %d\n", RDiskCount); - Buffer1 = (PWSTR)ExAllocatePool(PagedPool, - 64 * sizeof(WCHAR)); - Buffer2 = (PWSTR)ExAllocatePool(PagedPool, - 32 * sizeof(WCHAR)); + Buffer1 = (PWSTR)ExAllocatePoolWithTag(PagedPool, + 64 * sizeof(WCHAR), TAG_FILE_SYSTEM); + Buffer2 = (PWSTR)ExAllocatePoolWithTag(PagedPool, + 32 * sizeof(WCHAR), TAG_FILE_SYSTEM); - PartialInformation = (PKEY_VALUE_PARTIAL_INFORMATION)ExAllocatePool(PagedPool, - sizeof(KEY_VALUE_PARTIAL_INFORMATION) + sizeof(REG_DISK_MOUNT_INFO)); + PartialInformation = (PKEY_VALUE_PARTIAL_INFORMATION)ExAllocatePoolWithTag(PagedPool, + sizeof(KEY_VALUE_PARTIAL_INFORMATION) + sizeof(REG_DISK_MOUNT_INFO), TAG_FILE_SYSTEM); if (!Buffer1 || !Buffer2 || !PartialInformation) return; @@ -528,13 +528,13 @@ xHalIoAssignDriveLetters(IN PLOADER_PARAMETER_BLOCK LoaderBlock, /* Initialize layout array */ if (ConfigInfo->DiskCount == 0) goto end_assign_disks; - LayoutArray = ExAllocatePool(NonPagedPool, - ConfigInfo->DiskCount * sizeof(PDRIVE_LAYOUT_INFORMATION)); + LayoutArray = ExAllocatePoolWithTag(NonPagedPool, + ConfigInfo->DiskCount * sizeof(PDRIVE_LAYOUT_INFORMATION), TAG_FILE_SYSTEM); if (!LayoutArray) { - ExFreePool(PartialInformation); - ExFreePool(Buffer2); - ExFreePool(Buffer1); + ExFreePoolWithTag(PartialInformation, TAG_FILE_SYSTEM); + ExFreePoolWithTag(Buffer2, TAG_FILE_SYSTEM); + ExFreePoolWithTag(Buffer1, TAG_FILE_SYSTEM); if (hKey) ZwClose(hKey); } @@ -896,9 +896,9 @@ xHalIoAssignDriveLetters(IN PLOADER_PARAMETER_BLOCK LoaderBlock, for (i = 0; i < ConfigInfo->DiskCount; i++) { if (LayoutArray[i] != NULL) - ExFreePool(LayoutArray[i]); + ExFreePoolWithTag(LayoutArray[i], TAG_FILE_SYSTEM); } - ExFreePool(LayoutArray); + ExFreePoolWithTag(LayoutArray, TAG_FILE_SYSTEM); end_assign_disks: /* Assign floppy drives */ @@ -948,9 +948,9 @@ end_assign_disks: /* Anything else to do? */ - ExFreePool(PartialInformation); - ExFreePool(Buffer2); - ExFreePool(Buffer1); + ExFreePoolWithTag(PartialInformation, TAG_FILE_SYSTEM); + ExFreePoolWithTag(Buffer2, TAG_FILE_SYSTEM); + ExFreePoolWithTag(Buffer1, TAG_FILE_SYSTEM); if (hKey) { ZwClose(hKey); @@ -1249,8 +1249,8 @@ xHalGetPartialGeometry(IN PDEVICE_OBJECT DeviceObject, Cleanup: /* Free all the pointers */ if (Event) ExFreePoolWithTag(Event, TAG_FILE_SYSTEM); - if (IoStatusBlock) ExFreePool(IoStatusBlock); - if (DiskGeometry) ExFreePool(DiskGeometry); + if (IoStatusBlock) ExFreePoolWithTag(IoStatusBlock, TAG_FILE_SYSTEM); + if (DiskGeometry) ExFreePoolWithTag(DiskGeometry, TAG_FILE_SYSTEM); return; } @@ -1425,7 +1425,7 @@ xHalIoReadPartitionTable(IN PDEVICE_OBJECT DeviceObject, { /* EZ Drive found, bias the offset */ IsEzDrive = TRUE; - ExFreePool(MbrBuffer); + ExFreePoolWithTag(MbrBuffer, TAG_FILE_SYSTEM); Offset.QuadPart = 512; } @@ -1843,7 +1843,7 @@ xHalIoSetPartitionInformation(IN PDEVICE_OBJECT DeviceObject, { /* EZ Drive found, bias the offset */ IsEzDrive = TRUE; - ExFreePool(MbrBuffer); + ExFreePoolWithTag(MbrBuffer, TAG_FILE_SYSTEM); Offset.QuadPart = 512; } @@ -1995,7 +1995,7 @@ xHalIoSetPartitionInformation(IN PDEVICE_OBJECT DeviceObject, } while (i < PartitionNumber); /* Everything done, cleanup */ - if (Buffer) ExFreePool(Buffer); + if (Buffer) ExFreePoolWithTag(Buffer, TAG_FILE_SYSTEM); return Status; } @@ -2043,7 +2043,7 @@ xHalIoWritePartitionTable(IN PDEVICE_OBJECT DeviceObject, { /* EZ Drive found, bias the offset */ IsEzDrive = TRUE; - ExFreePool(MbrBuffer); + ExFreePoolWithTag(MbrBuffer, TAG_FILE_SYSTEM); Offset.QuadPart = 512; } diff --git a/ntoskrnl/fstub/fstubex.c b/ntoskrnl/fstub/fstubex.c index 5f99ce82995..6035ed8fd32 100644 --- a/ntoskrnl/fstub/fstubex.c +++ b/ntoskrnl/fstub/fstubex.c @@ -893,7 +893,7 @@ FstubReadHeaderEFI(IN PDISK_INFORMATION Disk, /* Allocate a buffer to read a sector on the disk */ Sector = ExAllocatePoolWithTag(NonPagedPool, Disk->SectorSize, - 'BtsF'); + TAG_FSTUB); if (!Sector) { DPRINT("EFI::Lacking resources!\n"); @@ -911,7 +911,7 @@ FstubReadHeaderEFI(IN PDISK_INFORMATION Disk, (PUSHORT)Sector); if (!NT_SUCCESS(Status)) { - ExFreePoolWithTag(Sector, 'BtsF'); + ExFreePoolWithTag(Sector, TAG_FSTUB); DPRINT("EFI::Failed reading sector for partition entry!\n"); return Status; } @@ -931,7 +931,7 @@ FstubReadHeaderEFI(IN PDISK_INFORMATION Disk, (PUSHORT)Sector); if (!NT_SUCCESS(Status)) { - ExFreePoolWithTag(Sector, 'BtsF'); + ExFreePoolWithTag(Sector, TAG_FSTUB); DPRINT("EFI::Failed reading sector for partition entry!\n"); return Status; } @@ -944,7 +944,7 @@ FstubReadHeaderEFI(IN PDISK_INFORMATION Disk, } /* Finally, release memory */ - ExFreePoolWithTag(Sector, 'BtsF'); + ExFreePoolWithTag(Sector, TAG_FSTUB); /* Compare checksums */ if (PreviousCRC32 == EFIHeader->PartitionEntryCRC32) diff --git a/ntoskrnl/fstub/translate.c b/ntoskrnl/fstub/translate.c index 839e6f01488..3fa15e0c091 100644 --- a/ntoskrnl/fstub/translate.c +++ b/ntoskrnl/fstub/translate.c @@ -40,10 +40,9 @@ FstubTranslateResource(IN OUT PVOID Context OPTIONAL, IN PDEVICE_OBJECT PhysicalDeviceObject, OUT PCM_PARTIAL_RESOURCE_DESCRIPTOR Target) { - INT k; KIRQL Irql; KAFFINITY Affinity; - ULONG MinimumVector, Vector; + ULONG MinimumVector, Vector, k; PIO_RESOURCE_DESCRIPTOR Alternative; NTSTATUS Status = STATUS_UNSUCCESSFUL; PAGED_CODE(); diff --git a/ntoskrnl/inbv/inbv.c b/ntoskrnl/inbv/inbv.c index 98aff194e3f..dc5f2419516 100644 --- a/ntoskrnl/inbv/inbv.c +++ b/ntoskrnl/inbv/inbv.c @@ -10,16 +10,16 @@ KSPIN_LOCK BootDriverLock; KIRQL InbvOldIrql; INBV_DISPLAY_STATE InbvDisplayState; -BOOLEAN InbvBootDriverInstalled; -BOOLEAN InbvDisplayDebugStrings; +BOOLEAN InbvBootDriverInstalled = FALSE; +BOOLEAN InbvDisplayDebugStrings = FALSE; INBV_DISPLAY_STRING_FILTER InbvDisplayFilter; ULONG ProgressBarLeft, ProgressBarTop; -BOOLEAN ShowProgressBar; +BOOLEAN ShowProgressBar = FALSE; INBV_PROGRESS_STATE InbvProgressState; INBV_RESET_DISPLAY_PARAMETERS InbvResetDisplayParameters; ULONG ResourceCount; PUCHAR ResourceList[64]; -BOOLEAN SysThreadCreated; +BOOLEAN SysThreadCreated = FALSE; ROT_BAR_TYPE RotBarSelection; ULONG PltRotBarStatus; BT_PROGRESS_INDICATOR InbvProgressIndicator = {0, 25, 0}; @@ -576,7 +576,7 @@ NtDisplayString(IN PUNICODE_STRING DisplayString) VOID NTAPI INIT_FUNCTION -DisplayBootBitmap(IN BOOLEAN SosMode) +DisplayBootBitmap(IN BOOLEAN TextMode) { PVOID Header, Band, Text, Screen; ROT_BAR_TYPE TempRotBarSelection = RB_UNSPECIFIED; @@ -591,9 +591,9 @@ DisplayBootBitmap(IN BOOLEAN SosMode) InbvReleaseLock(); } - /* Check if this is SOS mode */ + /* Check if this is text mode */ ShowProgressBar = FALSE; - if (SosMode) + if (TextMode) { /* Check if this is a server OS */ if (SharedUserData->NtProductType == NtProductWinNt) @@ -696,6 +696,9 @@ DisplayBootBitmap(IN BOOLEAN SosMode) /* Draw the progress bar bit */ // if (Bar) InbvBitBlt(Bar, 0, 0); + + /* Set filter which will draw text display if needed */ + InbvInstallDisplayStringFilter(DisplayFilter); } /* Do we have a system thread? */ @@ -709,6 +712,30 @@ DisplayBootBitmap(IN BOOLEAN SosMode) } } +VOID +NTAPI +INIT_FUNCTION +DisplayFilter(PCHAR *String) +{ + /* Windows hack to skip first dots */ + static BOOLEAN DotHack = TRUE; + + /* If "." is given set *String to empty string */ + if(DotHack && strcmp(*String, ".") == 0) + *String = ""; + + if(**String) + { + /* Remove the filter */ + InbvInstallDisplayStringFilter(NULL); + + DotHack = FALSE; + + /* Draw text screen */ + DisplayBootBitmap(TRUE); + } +} + VOID NTAPI INIT_FUNCTION diff --git a/ntoskrnl/include/internal/amd64/intrin_i.h b/ntoskrnl/include/internal/amd64/intrin_i.h index d3dca40eaf2..bbfaff7e251 100644 --- a/ntoskrnl/include/internal/amd64/intrin_i.h +++ b/ntoskrnl/include/internal/amd64/intrin_i.h @@ -104,8 +104,6 @@ static __inline__ __attribute__((always_inline)) void __str(unsigned short *Dest #elif defined(_MSC_VER) -#define UNIMPLEMENTED DbgPrint("%s is unimplemented!!!\n", __FUNCTION__); - void __lgdt(void *Source); void __sgdt(void *Destination); diff --git a/ntoskrnl/include/internal/amd64/ke.h b/ntoskrnl/include/internal/amd64/ke.h index bbad6b89771..f0ab9086abb 100644 --- a/ntoskrnl/include/internal/amd64/ke.h +++ b/ntoskrnl/include/internal/amd64/ke.h @@ -134,6 +134,31 @@ extern ULONG KeI386CpuStep; #define KeGetTrapFrameInterruptState(TrapFrame) \ BooleanFlagOn((TrapFrame)->EFlags, EFLAGS_INTERRUPT_MASK) +/* Diable interrupts and return whether they were enabled before */ +BOOLEAN +NTAPI +KeDisableInterrupts(VOID) +{ + ULONG Flags; + BOOLEAN Return; + + /* Get EFLAGS and check if the interrupt bit is set */ + Flags = __readeflags(); + Return = (Flags & EFLAGS_INTERRUPT_MASK) ? TRUE: FALSE; + + /* Disable interrupts */ + _disable(); + return Return; +} + +/* Restore previous interrupt state */ +FORCEINLINE +VOID +KeRestoreInterrupts(BOOLEAN WereEnabled) +{ + if (WereEnabled) _enable(); +} + // // Invalidates the TLB entry for a specified address // diff --git a/ntoskrnl/include/internal/amd64/mm.h b/ntoskrnl/include/internal/amd64/mm.h index 38380cfd90e..8c5db54af6f 100644 --- a/ntoskrnl/include/internal/amd64/mm.h +++ b/ntoskrnl/include/internal/amd64/mm.h @@ -142,6 +142,9 @@ MiIsPdeForAddressValid(PVOID Address) (MiAddressToPde(Address)->u.Hard.Valid)); } +#define MiPdeToPte(PDE) ((PMMPTE)MiPteToAddress(PDE)) +#define MiPteToPde(PTE) ((PMMPDE)MiAddressToPte(PTE)) + #define ADDR_TO_PAGE_TABLE(v) (((ULONG_PTR)(v)) / (512 * PAGE_SIZE)) #define ADDR_TO_PDE_OFFSET(v) ((((ULONG_PTR)(v)) / (512 * PAGE_SIZE))) #define ADDR_TO_PTE_OFFSET(v) ((((ULONG_PTR)(v)) % (512 * PAGE_SIZE)) / PAGE_SIZE) diff --git a/ntoskrnl/include/internal/arm/ke.h b/ntoskrnl/include/internal/arm/ke.h index 3fbe4eb3ad9..1b5f72c6a94 100644 --- a/ntoskrnl/include/internal/arm/ke.h +++ b/ntoskrnl/include/internal/arm/ke.h @@ -65,6 +65,31 @@ // //#define KeGetTrapFrameInterruptState(TrapFrame) +FORCEINLINE +BOOLEAN +KeDisableInterrupts(VOID) +{ + ARM_STATUS_REGISTER Flags; + + // + // Get current interrupt state and disable interrupts + // + Flags = KeArmStatusRegisterGet(); + _disable(); + + // + // Return previous interrupt state + // + return Flags.IrqDisable; +} + +FORCEINLINE +VOID +KeRestoreInterrupts(BOOLEAN WereEnabled) +{ + if (WereEnabled) _enable(); +} + // // Invalidates the TLB entry for a specified address // diff --git a/ntoskrnl/include/internal/cm.h b/ntoskrnl/include/internal/cm.h index d7d118cfa44..619455b6fac 100644 --- a/ntoskrnl/include/internal/cm.h +++ b/ntoskrnl/include/internal/cm.h @@ -33,7 +33,7 @@ if (x & CmpTraceLevel) DbgPrint(__VA_ARGS__) #endif #else -#define CMTRACE(x, ...) DPRINT(__VA_ARGS__) +#define CMTRACE(x, fmt, ...) DPRINT(fmt, ##__VA_ARGS__) #endif // @@ -1569,6 +1569,13 @@ CmpResolveDriverDependencies( IN PLIST_ENTRY DriverListHead ); +BOOLEAN +NTAPI +CmpIsSafe( + IN PHHIVE Hive, + IN HCELL_INDEX SafeBootCell, + IN HCELL_INDEX DriverCell); + // // Global variables accessible from all of Cm // diff --git a/ntoskrnl/include/internal/dbgk.h b/ntoskrnl/include/internal/dbgk.h index 457fcf0e5bf..d1e8f814c2a 100644 --- a/ntoskrnl/include/internal/dbgk.h +++ b/ntoskrnl/include/internal/dbgk.h @@ -43,7 +43,7 @@ } #endif #else -#define DBGKTRACE(x, ...) DPRINT(__VA_ARGS__) +#define DBGKTRACE(x, fmt, ...) DPRINT(fmt, ##__VA_ARGS__) #endif VOID diff --git a/ntoskrnl/include/internal/ex.h b/ntoskrnl/include/internal/ex.h index 85a726b0cd8..548dd90a9b5 100644 --- a/ntoskrnl/include/internal/ex.h +++ b/ntoskrnl/include/internal/ex.h @@ -480,7 +480,7 @@ ULONG ExGetCountFastReference(IN EX_FAST_REF FastRef) { /* Return the reference count */ - return FastRef.RefCnt; + return (ULONG)FastRef.RefCnt; } FORCEINLINE diff --git a/ntoskrnl/include/internal/fsrtl.h b/ntoskrnl/include/internal/fsrtl.h index b0777de94cc..16bb399a893 100644 --- a/ntoskrnl/include/internal/fsrtl.h +++ b/ntoskrnl/include/internal/fsrtl.h @@ -36,7 +36,7 @@ if (x & FsRtlpTraceLevel) DbgPrint(__VA_ARGS__) #endif #else -#define FSTRACE(x, ...) DPRINT(__VA_ARGS__) +#define FSTRACE(x, fmt, ...) DPRINT(fmt, ##__VA_ARGS__) #endif // diff --git a/ntoskrnl/include/internal/hdl.h b/ntoskrnl/include/internal/hdl.h index c38aa3fe666..349a9070f7b 100644 --- a/ntoskrnl/include/internal/hdl.h +++ b/ntoskrnl/include/internal/hdl.h @@ -7,6 +7,7 @@ */ #define _HDL_ #include +#include // // Define this if you want debugging support @@ -29,7 +30,7 @@ if (x & HdlpTraceLevel) DbgPrint(__VA_ARGS__) #endif #else -#define HDLTRACE(x, ...) DPRINT(__VA_ARGS__) +#define HDLTRACE(x, fmt, ...) DPRINT(fmt, ##__VA_ARGS__) #endif // @@ -150,6 +151,38 @@ typedef enum _HEADLESS_CMD HeadlessCmdPutData } HEADLESS_CMD, *PHEADLESS_CMD; +typedef enum _HEADLESS_TERM_PORT_TYPE +{ + HeadlessUndefinedPortType = 0, + HeadlessSerialPort +} HEADLESS_TERM_PORT_TYPE, *PHEADLESS_TERM_PORT_TYPE; + +typedef enum _HEADLESS_TERM_SERIAL_PORT +{ + SerialPortUndefined = 0, + ComPort1, + ComPort2, + ComPort3, + ComPort4 +} HEADLESS_TERM_SERIAL_PORT, *PHEADLESS_TERM_SERIAL_PORT; + +typedef struct _HEADLESS_RSP_QUERY_INFO +{ + HEADLESS_TERM_PORT_TYPE PortType; + union + { + struct + { + BOOLEAN TerminalAttached; + BOOLEAN UsedBiosSettings; + HEADLESS_TERM_SERIAL_PORT TerminalPort; + PUCHAR TerminalPortBaseAddress; + ULONG TerminalBaudRate; + UCHAR TerminalType; + } Serial; + }; +} HEADLESS_RSP_QUERY_INFO, *PHEADLESS_RSP_QUERY_INFO; + typedef struct _HEADLESS_CMD_PUT_STRING { UCHAR String[1]; diff --git a/ntoskrnl/include/internal/i386/asmmacro.S b/ntoskrnl/include/internal/i386/asmmacro.S index 920885be86a..77d989e9011 100644 --- a/ntoskrnl/include/internal/i386/asmmacro.S +++ b/ntoskrnl/include/internal/i386/asmmacro.S @@ -217,11 +217,18 @@ MACRO(KiCallHandler, Handler) ENDM MACRO(TRAP_ENTRY, Trap, Flags) -EXTERN @&Trap&Handler@4 :PROC + EXTERN @&Trap&Handler@4 :PROC PUBLIC _&Trap - _&Trap: - KiEnterTrap Flags - KiCallHandler @&Trap&Handler@4 + .PROC &Trap + /* Generate proper debugging symbols */ + FPO 0, 0, 0, 0, 1, FRAME_TRAP + + /* Common code to create the trap frame */ + KiEnterTrap Flags + + /* Call the C handler */ + KiCallHandler @&Trap&Handler@4 + .ENDP &Trap ENDM #define KI_RESTORE_EAX HEX(001) @@ -329,7 +336,7 @@ PUBLIC @&Name&@4 if (Flags AND KI_RESTORE_EFLAGS) /* Restore EFLAGS */ - popf + popfd endif @@ -343,7 +350,7 @@ PUBLIC @&Name&@4 elseif (Flags AND KI_EXIT_IRET) /* Return with iret */ - iret + iretd elseif (Flags AND KI_EXIT_JMP) diff --git a/ntoskrnl/include/internal/i386/ke.h b/ntoskrnl/include/internal/i386/ke.h index 7aa98846ca5..f4fe39b97d7 100644 --- a/ntoskrnl/include/internal/i386/ke.h +++ b/ntoskrnl/include/internal/i386/ke.h @@ -164,6 +164,31 @@ typedef struct _KV8086_STACK_FRAME KV86_FRAME V86Frame; } KV8086_STACK_FRAME, *PKV8086_STACK_FRAME; +/* Diable interrupts and return whether they were enabled before */ +FORCEINLINE +BOOLEAN +KeDisableInterrupts(VOID) +{ + ULONG Flags; + BOOLEAN Return; + + /* Get EFLAGS and check if the interrupt bit is set */ + Flags = __readeflags(); + Return = (Flags & EFLAGS_INTERRUPT_MASK) ? TRUE: FALSE; + + /* Disable interrupts */ + _disable(); + return Return; +} + +/* Restore previous interrupt state */ +FORCEINLINE +VOID +KeRestoreInterrupts(BOOLEAN WereEnabled) +{ + if (WereEnabled) _enable(); +} + // // Registers an interrupt handler with an IDT vector // @@ -457,6 +482,7 @@ extern VOID __cdecl KiTrap08(VOID); extern VOID __cdecl KiTrap13(VOID); extern VOID __cdecl KiFastCallEntry(VOID); extern VOID NTAPI ExpInterlockedPopEntrySListFault(VOID); +extern VOID NTAPI ExpInterlockedPopEntrySListResume(VOID); extern VOID __cdecl CopyParams(VOID); extern VOID __cdecl ReadBatch(VOID); extern VOID __cdecl FrRestore(VOID); @@ -600,13 +626,6 @@ KiDispatchException2Args(IN NTSTATUS Code, // // Performs a system call // -NTSTATUS -FORCEINLINE -KiSystemCallTrampoline(IN PVOID Handler, - IN PVOID Arguments, - IN ULONG StackBytes) -{ - NTSTATUS Result; /* * This sequence does a RtlCopyMemory(Stack - StackBytes, Arguments, StackBytes) @@ -624,6 +643,14 @@ KiSystemCallTrampoline(IN PVOID Handler, * */ #ifdef __GNUC__ +NTSTATUS +FORCEINLINE +KiSystemCallTrampoline(IN PVOID Handler, + IN PVOID Arguments, + IN ULONG StackBytes) +{ + NTSTATUS Result; + __asm__ __volatile__ ( "subl %1, %%esp\n" @@ -639,25 +666,32 @@ KiSystemCallTrampoline(IN PVOID Handler, "r"(Handler) : "%esp", "%esi", "%edi" ); + return Result; +} #elif defined(_MSC_VER) +NTSTATUS +FORCEINLINE +KiSystemCallTrampoline(IN PVOID Handler, + IN PVOID Arguments, + IN ULONG StackBytes) +{ __asm { mov ecx, StackBytes - mov edx, Arguments + mov esi, Arguments + mov eax, Handler sub esp, ecx mov edi, esp - mov esi, edx shr ecx, 2 rep movsd - call Handler - mov Result, eax + call eax } + /* Return with result in EAX */ +} #else #error Unknown Compiler #endif - return Result; -} // // Checks for pending APCs @@ -699,6 +733,7 @@ KiCheckForApcDelivery(IN PKTRAP_FRAME TrapFrame) // // Converts a base thread to a GUI thread // +#ifdef __GNUC__ NTSTATUS FORCEINLINE KiConvertToGuiThread(VOID) @@ -722,35 +757,26 @@ KiConvertToGuiThread(VOID) * on its merry way. * */ -#ifdef __GNUC__ __asm__ __volatile__ ( - "movl %%ebp, %1\n" - "subl %%esp, %1\n" - "call _PsConvertToGuiThread@0\n" - "addl %%esp, %1\n" - "movl %1, %%ebp\n" - "movl %%eax, %0\n" - : "=r"(Result), "=r"(StackFrame) + "movl %%ebp, %1\n\t" + "subl %%esp, %1\n\t" + "call _PsConvertToGuiThread@0\n\t" + "addl %%esp, %1\n\t" + "movl %1, %%ebp" + : "=a"(Result), "=r"(StackFrame) : : "%esp", "%ecx", "%edx", "memory" ); + return Result; +} #elif defined(_MSC_VER) - NTSTATUS NTAPI PsConvertToGuiThread(VOID); - __asm - { - mov StackFrame, ebp - sub StackFrame, esp - call PsConvertToGuiThread - add StackFrame, esp - mov ebp, StackFrame - mov Result, eax - } +NTSTATUS +NTAPI +KiConvertToGuiThread(VOID); #else #error Unknown Compiler #endif - return Result; -} // // Switches from boot loader to initial kernel stack @@ -803,7 +829,7 @@ KiIret(VOID) #elif defined(_MSC_VER) __asm { - iret + iretd } #else #error Unsupported compiler @@ -844,4 +870,11 @@ Ki386PerfEnd(VOID) KeGetContextSwitches(KeGetCurrentPrcb())); } +FORCEINLINE +PULONG +KiGetUserModeStackAddress(void) +{ + return &(KeGetCurrentThread()->TrapFrame->HardwareEsp); +} + #endif diff --git a/ntoskrnl/include/internal/inbv.h b/ntoskrnl/include/internal/inbv.h index 9d9e737e690..d8446aa2305 100644 --- a/ntoskrnl/include/internal/inbv.h +++ b/ntoskrnl/include/internal/inbv.h @@ -42,7 +42,13 @@ InbvEnableBootDriver( VOID NTAPI DisplayBootBitmap( - IN BOOLEAN SosMode + IN BOOLEAN TextMode +); + +VOID +NTAPI +DisplayFilter( + IN PCHAR *String ); VOID diff --git a/ntoskrnl/include/internal/io.h b/ntoskrnl/include/internal/io.h index 8edb68e75be..cbcf466b00c 100644 --- a/ntoskrnl/include/internal/io.h +++ b/ntoskrnl/include/internal/io.h @@ -10,7 +10,7 @@ // // Define this if you want debugging support // -#define _IO_DEBUG_ 0x00 +#define _IO_DEBUG_ 0x01 // // These define the Debug Masks Supported @@ -43,7 +43,7 @@ } #endif #else -#define IOTRACE(x, ...) DPRINT(__VA_ARGS__) +#define IOTRACE(x, fmt, ...) DPRINT(fmt, ##__VA_ARGS__) #endif // @@ -600,6 +600,11 @@ IopFreeDeviceNode( IN PDEVICE_NODE DeviceNode ); +NTSTATUS +NTAPI +IopQueryDeviceCapabilities(PDEVICE_NODE DeviceNode, + PDEVICE_CAPABILITIES DeviceCaps); + NTSTATUS NTAPI IopSynchronousCall( @@ -691,6 +696,11 @@ IopCreateRegistryKeyEx( OUT PULONG Disposition OPTIONAL ); + +NTSTATUS +IopTraverseDeviceTree( + PDEVICETREE_TRAVERSE_CONTEXT Context); + // // PnP Routines // @@ -785,6 +795,16 @@ IopStartDevice( IN PDEVICE_NODE DeviceNode ); +NTSTATUS +IopStopDevice( + IN PDEVICE_NODE DeviceNode +); + +NTSTATUS +IopRemoveDevice( + IN PDEVICE_NODE DeviceNode +); + PVPB NTAPI IopCheckVpbMounted( @@ -823,7 +843,7 @@ IopCreateVpb( VOID NTAPI -IopDereferenceVpb( +IopDereferenceVpbAndFree( IN PVPB Vpb ); @@ -854,8 +874,15 @@ IopDereferenceDeviceObject( NTSTATUS NTAPI -IoGetRelatedTargetDevice(IN PFILE_OBJECT FileObject, - OUT PDEVICE_OBJECT *DeviceObject +IoGetRelatedTargetDevice( + IN PFILE_OBJECT FileObject, + OUT PDEVICE_OBJECT *DeviceObject +); + +VOID +NTAPI +IopUnloadDevice( + IN PDEVICE_OBJECT DeviceObject ); // diff --git a/ntoskrnl/include/internal/kd.h b/ntoskrnl/include/internal/kd.h index 5bb1060b548..22729be76ef 100644 --- a/ntoskrnl/include/internal/kd.h +++ b/ntoskrnl/include/internal/kd.h @@ -75,15 +75,21 @@ KdbSymProcessSymbols( BOOLEAN KdbSymPrintAddress( - IN PVOID Address); + IN PVOID Address, + IN PKTRAP_FRAME Context +); NTSTATUS KdbSymGetAddressInformation( IN PROSSYM_INFO RosSymInfo, IN ULONG_PTR RelativeAddress, +#ifdef __ROS_CMAKE__ + IN PROSSYM_LINEINFO RosSymLineInfo +#else OUT PULONG LineNumber OPTIONAL, OUT PCH FileName OPTIONAL, OUT PCH FunctionName OPTIONAL +#endif ); #endif diff --git a/ntoskrnl/include/internal/ke.h b/ntoskrnl/include/internal/ke.h index 56f3ee013c2..1dbb1f48e28 100644 --- a/ntoskrnl/include/internal/ke.h +++ b/ntoskrnl/include/internal/ke.h @@ -164,7 +164,7 @@ extern VOID __cdecl KiInterruptTemplate(VOID); #define TIMER_WAIT_BLOCK 0x3L #ifdef _M_ARM // FIXME: remove this once our headers are cleaned up -// +// // A system call ID is formatted as such: // .________________________________________________________________. // | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | @@ -187,7 +187,7 @@ extern VOID __cdecl KiInterruptTemplate(VOID); // // NB. From assembly code, the table number must be computed as an offset into // the service descriptor table. -// +// // Each entry into the table is 16 bytes long on 32-bit architectures, and // 32 bytes long on 64-bit architectures. // @@ -864,7 +864,7 @@ KeBugCheckWithTf( ULONG_PTR BugCheckParameter4, PKTRAP_FRAME Tf ); - + BOOLEAN NTAPI KiHandleNmi(VOID); @@ -1020,12 +1020,6 @@ KiCallUserMode( IN PULONG OutputLength ); -PULONG -NTAPI -KiGetUserModeStackAddress( - VOID -); - VOID NTAPI KiInitMachineDependent(VOID); @@ -1039,12 +1033,6 @@ VOID NTAPI KeThawExecution(IN BOOLEAN Enable); -BOOLEAN -NTAPI -KeDisableInterrupts( - VOID -); - VOID FASTCALL KeAcquireQueuedSpinLockAtDpcLevel( diff --git a/ntoskrnl/include/internal/ke_x.h b/ntoskrnl/include/internal/ke_x.h index 2c05bfe25bf..8b0ef980b23 100644 --- a/ntoskrnl/include/internal/ke_x.h +++ b/ntoskrnl/include/internal/ke_x.h @@ -8,7 +8,7 @@ #ifndef _M_ARM FORCEINLINE -UCHAR +KPROCESSOR_MODE KeGetPreviousMode(VOID) { /* Return the current mode */ diff --git a/ntoskrnl/include/internal/lpc.h b/ntoskrnl/include/internal/lpc.h index ad5ecba6699..34392c4c185 100644 --- a/ntoskrnl/include/internal/lpc.h +++ b/ntoskrnl/include/internal/lpc.h @@ -46,7 +46,7 @@ } #endif #else -#define LPCTRACE(x, ...) DPRINT(__VA_ARGS__) +#define LPCTRACE(x, fmt, ...) DPRINT(fmt, ##__VA_ARGS__) #endif // diff --git a/ntoskrnl/include/internal/mm.h b/ntoskrnl/include/internal/mm.h index 02fa7e9d6d6..803dc81b5a7 100644 --- a/ntoskrnl/include/internal/mm.h +++ b/ntoskrnl/include/internal/mm.h @@ -6,6 +6,7 @@ struct _EPROCESS; +extern PMMSUPPORT MmKernelAddressSpace; extern PFN_NUMBER MiFreeSwapPages; extern PFN_NUMBER MiUsedSwapPages; extern SIZE_T MmTotalPagedPoolQuota; @@ -1119,10 +1120,6 @@ BOOLEAN NTAPI MmIsDirtyPageRmap(PFN_NUMBER Page); -NTSTATUS -NTAPI -MmWritePagePhysicalAddress(PFN_NUMBER Page); - NTSTATUS NTAPI MmPageOutPhysicalAddress(PFN_NUMBER Page); @@ -1138,9 +1135,9 @@ MiGetPfnEntry(IN PFN_NUMBER Pfn) /* Make sure the PFN number is valid */ if (Pfn > MmHighestPhysicalPage) return NULL; - + /* Make sure this page actually has a PFN entry */ - if ((MiPfnBitMap.Buffer) && !(RtlTestBit(&MiPfnBitMap, Pfn))) return NULL; + if ((MiPfnBitMap.Buffer) && !(RtlTestBit(&MiPfnBitMap, (ULONG)Pfn))) return NULL; /* Get the entry */ Page = &MmPfnDatabase[Pfn]; @@ -1342,7 +1339,7 @@ MmRawDeleteVirtualMapping(PVOID Address); VOID NTAPI MmGetPageFileMapping( - struct _EPROCESS *Process, + struct _EPROCESS *Process, PVOID Address, SWAPENTRY* SwapEntry); @@ -1739,7 +1736,15 @@ MmCallDllInitialize( IN PLIST_ENTRY ListHead ); -extern PMMSUPPORT MmKernelAddressSpace; + +/* procsup.c *****************************************************************/ + +NTSTATUS +NTAPI +MmGrowKernelStack( + IN PVOID StackPointer +); + FORCEINLINE VOID diff --git a/ntoskrnl/include/internal/ntoskrnl.h b/ntoskrnl/include/internal/ntoskrnl.h index ceb4800423f..7e1d8ef250f 100644 --- a/ntoskrnl/include/internal/ntoskrnl.h +++ b/ntoskrnl/include/internal/ntoskrnl.h @@ -59,6 +59,7 @@ #define KeReleaseGuardedMutexUnsafe _KeReleaseGuardedMutexUnsafe #define KeTryToAcquireGuardedMutex _KeTryToAcquireGuardedMutex +#include "tag.h" #include "ke.h" #include "ob.h" #include "mm.h" @@ -83,7 +84,6 @@ #endif #include "dbgk.h" #include "spinlock.h" -#include "tag.h" #include "test.h" #include "inbv.h" #include "vdm.h" diff --git a/ntoskrnl/include/internal/ob.h b/ntoskrnl/include/internal/ob.h index 532565ee390..cd690958549 100644 --- a/ntoskrnl/include/internal/ob.h +++ b/ntoskrnl/include/internal/ob.h @@ -31,7 +31,7 @@ if (x & ObpTraceLevel) DbgPrint(__VA_ARGS__) #endif #else -#define OBTRACE(x, ...) DPRINT(__VA_ARGS__) +#define OBTRACE(x, fmt, ...) DPRINT(fmt, ##__VA_ARGS__) #endif // diff --git a/ntoskrnl/include/internal/ob_x.h b/ntoskrnl/include/internal/ob_x.h index aa9d59cd05d..d3966ed1a3e 100644 --- a/ntoskrnl/include/internal/ob_x.h +++ b/ntoskrnl/include/internal/ob_x.h @@ -136,7 +136,7 @@ ObpDereferenceNameInfo(IN POBJECT_HEADER_NAME_INFO HeaderNameInfo) if (HeaderNameInfo->Name.Buffer) { /* We can get rid of the object name now */ - ExFreePool(HeaderNameInfo->Name.Buffer); + ExFreePoolWithTag(HeaderNameInfo->Name.Buffer, OB_NAME_TAG); RtlInitEmptyUnicodeString(&HeaderNameInfo->Name, NULL, 0); } diff --git a/ntoskrnl/include/internal/po.h b/ntoskrnl/include/internal/po.h index 86e25595164..dcc4d0dbcbb 100644 --- a/ntoskrnl/include/internal/po.h +++ b/ntoskrnl/include/internal/po.h @@ -30,7 +30,7 @@ if (x & PopTraceLevel) DbgPrint(__VA_ARGS__) #endif #else -#define POTRACE(x, ...) DPRINT(__VA_ARGS__) +#define POTRACE(x, fmt, ...) DPRINT(fmt, ##__VA_ARGS__) #endif typedef struct _PO_HIBER_PERF @@ -291,7 +291,8 @@ PoVolumeDevice( NTSTATUS NTAPI PopSetSystemPowerState( - SYSTEM_POWER_STATE PowerState + SYSTEM_POWER_STATE PowerState, + POWER_ACTION PowerAction ); VOID diff --git a/ntoskrnl/include/internal/ps.h b/ntoskrnl/include/internal/ps.h index bf18cf818b3..af02c4557f9 100644 --- a/ntoskrnl/include/internal/ps.h +++ b/ntoskrnl/include/internal/ps.h @@ -54,7 +54,7 @@ __LINE__, \ OBJECT_TO_OBJECT_HEADER(x)->PointerCount) #else -#define PSTRACE(x, ...) DPRINT(__VA_ARGS__) +#define PSTRACE(x, fmt, ...) DPRINT(fmt, ##__VA_ARGS__) #define PSREFTRACE(x) #endif diff --git a/ntoskrnl/include/internal/spinlock.h b/ntoskrnl/include/internal/spinlock.h index 6d1ca71c231..6b38fb9c158 100644 --- a/ntoskrnl/include/internal/spinlock.h +++ b/ntoskrnl/include/internal/spinlock.h @@ -21,6 +21,10 @@ KxAcquireSpinLock(IN PKSPIN_LOCK SpinLock) { /* On UP builds, spinlocks don't exist at IRQL >= DISPATCH */ UNREFERENCED_PARAMETER(SpinLock); + + /* Add an explicit memory barrier to prevent the compiler from reordering + memory accesses across the borders of spinlocks */ + KeMemoryBarrierWithoutFence(); } // @@ -32,6 +36,10 @@ KxReleaseSpinLock(IN PKSPIN_LOCK SpinLock) { /* On UP builds, spinlocks don't exist at IRQL >= DISPATCH */ UNREFERENCED_PARAMETER(SpinLock); + + /* Add an explicit memory barrier to prevent the compiler from reordering + memory accesses across the borders of spinlocks */ + KeMemoryBarrierWithoutFence(); } #else diff --git a/ntoskrnl/include/internal/tag.h b/ntoskrnl/include/internal/tag.h index 244665c2c99..fa3526e46eb 100644 --- a/ntoskrnl/include/internal/tag.h +++ b/ntoskrnl/include/internal/tag.h @@ -8,11 +8,21 @@ /* formely located in include/callback.h */ #define CALLBACK_TAG 'KBLC' +/* formely located in dbg/dbgkobj.c */ +#define TAG_DEBUG_EVENT 'EgbD' + /* formerly located in ex/resource.c */ #define TAG_RESOURCE_TABLE 'aTeR' #define TAG_RESOURCE_EVENT 'aTeR' #define TAG_RESOURCE_SEMAPHORE 'aTeR' +/* formerly located in ex/handle.c */ +#define TAG_OBJECT_TABLE 'btbO' + +/* formerly located in ex/init.c */ +#define TAG_INIT 'tinI' +#define TAG_RTLI 'iltR' + /* formerly located in fs/notify.c */ #define FSRTL_NOTIFY_TAG 'ITON' @@ -92,6 +102,7 @@ #define TAG_DRIVER_MEM 'MVRD' /* drvm */ #define TAG_MODULE_OBJECT 'omlk' /* klmo - kernel ldr module object */ #define TAG_LDR_WSTR 'swlk' /* klws - kernel ldr wide string */ +#define TAG_LDR_IMPORTS 'klim' /* klim - kernel ldr imports */ /* formerly located in lpc/connect */ #define TAG_LPC_CONNECT_MESSAGE 'CCPL' @@ -101,6 +112,7 @@ /* formerly located in mm/marea.c */ #define TAG_MAREA 'ERAM' +#define TAG_MVAD 'VADM' /* formerly located in mm/pageop.c */ #define TAG_MM_PAGEOP 'POPM' @@ -114,6 +126,9 @@ /* formerly located in mm/rmap.c */ #define TAG_RMAP 'PAMR' +/* formerly located in mm/ARM3/section.c */ +#define TAG_MM ' mM' + /* formerly located in mm/section.c */ #define TAG_MM_SECTION_SEGMENT 'SSMM' #define TAG_SECTION_PAGE_TABLE 'TPSM' @@ -123,6 +138,9 @@ #define TAG_SYMLINK_TTARGET 'TTYS' #define TAG_SYMLINK_TARGET 'TMYS' +/* formerly located in ob/obsdcach.c */ +#define TAG_OB_SD_CACHE 'cSbO' + /* Object Manager Tags */ #define OB_NAME_TAG 'mNbO' #define OB_DIR_TAG 'iDbO' @@ -153,6 +171,11 @@ /* formerly located in se/sd.c */ #define TAG_SD 'dSeS' +/* formerly located in se/token.c */ +#define TAG_TOKEN_USERS 'uKOT' +#define TAG_TOKEN_PRIVILAGES 'pKOT' +#define TAG_TOKEN_ACL 'kDOT' + /* LPC Tags */ #define TAG_LPC_MESSAGE 'McpL' #define TAG_LPC_ZONE 'ZcpL' diff --git a/ntoskrnl/include/internal/trap_x.h b/ntoskrnl/include/internal/trap_x.h index 09d17ed94e3..dadd25d61fa 100644 --- a/ntoskrnl/include/internal/trap_x.h +++ b/ntoskrnl/include/internal/trap_x.h @@ -34,7 +34,7 @@ FORCEINLINE KiUserTrap(IN PKTRAP_FRAME TrapFrame) { /* Anything else but Ring 0 is Ring 3 */ - return (TrapFrame->SegCs & MODE_MASK); + return !!(TrapFrame->SegCs & MODE_MASK); } // diff --git a/ntoskrnl/include/internal/vdm.h b/ntoskrnl/include/internal/vdm.h index 5934fc535ef..5ff64e1a055 100644 --- a/ntoskrnl/include/internal/vdm.h +++ b/ntoskrnl/include/internal/vdm.h @@ -27,7 +27,7 @@ if (x & VdmpTraceLevel) DbgPrint(__VA_ARGS__) #endif #else -#define VMTRACE(x, ...) DPRINT(__VA_ARGS__) +#define VMTRACE(x, fmt, ...) DPRINT(fmt, ##__VA_ARGS__) #endif // diff --git a/ntoskrnl/include/ntoskrnl.h b/ntoskrnl/include/ntoskrnl.h index 40c03b89d1d..21e1a0e1be1 100644 --- a/ntoskrnl/include/ntoskrnl.h +++ b/ntoskrnl/include/ntoskrnl.h @@ -17,6 +17,7 @@ #ifdef _M_AMD64 #define IoAllocateAdapterChannel _IoAllocateAdapterChannel #define KeGetCurrentThread _KeGetCurrentThread +#define RtlFillMemoryUlong _RtlFillMemoryUlong #endif /* Version Data */ @@ -32,14 +33,30 @@ #include #undef NTHALAPI #define NTHALAPI __declspec(dllimport) -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #undef TEXT #define TEXT(s) L##s #include #include - -/* FIXME: Temporary until Winldr is used */ -#include +#include /* C Headers */ #include @@ -52,7 +69,6 @@ #include /* ReactOS Headers */ -#include #include /* SetupLDR Support */ diff --git a/ntoskrnl/io/iomgr/device.c b/ntoskrnl/io/iomgr/device.c index 738ec9744b3..97643b680f8 100644 --- a/ntoskrnl/io/iomgr/device.c +++ b/ntoskrnl/io/iomgr/device.c @@ -19,9 +19,10 @@ ULONG IopDeviceObjectNumber = 0; LIST_ENTRY ShutdownListHead, LastChanceShutdownListHead; KSPIN_LOCK ShutdownListLock; -extern LIST_ENTRY IopDiskFsListHead; -extern LIST_ENTRY IopCdRomFsListHead; -extern LIST_ENTRY IopTapeFsListHead; +extern LIST_ENTRY IopDiskFileSystemQueueHead; +extern LIST_ENTRY IopCdRomFileSystemQueueHead; +extern LIST_ENTRY IopTapeFileSystemQueueHead; +extern ERESOURCE IopDatabaseResource; /* PRIVATE FUNCTIONS **********************************************************/ @@ -48,9 +49,12 @@ NTAPI IopDeleteDevice(IN PVOID ObjectBody) { PDEVICE_OBJECT DeviceObject = ObjectBody; + PDEVICE_NODE DeviceNode = IopGetDeviceNode(DeviceObject); PAGED_CODE(); - - /* TODO: Delete Device Node */ + + /* Cleanup and free the device node */ + if (DeviceNode) + IopFreeDeviceNode(DeviceNode); /* Dereference the driver object, referenced in IoCreateDevice */ if (DeviceObject->DriverObject) @@ -184,14 +188,17 @@ IoShutdownSystem(IN ULONG Phase) } else if (Phase == 1) { + /* Acquire resource forever */ + ExAcquireResourceExclusiveLite(&IopDatabaseResource, TRUE); + /* Shutdown disk file systems */ - IopShutdownBaseFileSystems(&IopDiskFsListHead); + IopShutdownBaseFileSystems(&IopDiskFileSystemQueueHead); /* Shutdown cdrom file systems */ - IopShutdownBaseFileSystems(&IopCdRomFsListHead); + IopShutdownBaseFileSystems(&IopCdRomFileSystemQueueHead); /* Shutdown tape filesystems */ - IopShutdownBaseFileSystems(&IopTapeFsListHead); + IopShutdownBaseFileSystems(&IopTapeFileSystemQueueHead); /* Loop last-chance shutdown notifications */ ListEntry = ExInterlockedRemoveHeadList(&LastChanceShutdownListHead, diff --git a/ntoskrnl/io/iomgr/deviface.c b/ntoskrnl/io/iomgr/deviface.c index 0a52f2aaf8d..6d6adcf9554 100644 --- a/ntoskrnl/io/iomgr/deviface.c +++ b/ntoskrnl/io/iomgr/deviface.c @@ -1136,23 +1136,6 @@ IoRegisterDeviceInterface(IN PDEVICE_OBJECT PhysicalDeviceObject, } RtlAppendUnicodeToString(SymbolicLinkName, L"#"); RtlAppendUnicodeStringToString(SymbolicLinkName, &GuidString); - SymbolicLinkName->Buffer[SymbolicLinkName->Length/sizeof(WCHAR)] = L'\0'; - - /* Create symbolic link */ - DPRINT("IoRegisterDeviceInterface(): creating symbolic link %wZ -> %wZ\n", SymbolicLinkName, &PdoNameInfo->Name); - Status = IoCreateSymbolicLink(SymbolicLinkName, &PdoNameInfo->Name); - if (!NT_SUCCESS(Status) && ReferenceString == NULL) - { - DPRINT1("IoCreateSymbolicLink() failed with status 0x%08lx\n", Status); - ZwClose(SubKey); - ZwClose(InterfaceKey); - ZwClose(ClassKey); - ExFreePool(SubKeyName.Buffer); - ExFreePool(InterfaceKeyName.Buffer); - ExFreePool(BaseKeyName.Buffer); - ExFreePool(SymbolicLinkName->Buffer); - return Status; - } if (ReferenceString && ReferenceString->Length) { @@ -1163,23 +1146,44 @@ IoRegisterDeviceInterface(IN PDEVICE_OBJECT PhysicalDeviceObject, /* Write symbolic link name in registry */ SymbolicLinkName->Buffer[1] = '\\'; - Status = ZwSetValueKey( - SubKey, - &SymbolicLink, - 0, /* TileIndex */ - REG_SZ, - SymbolicLinkName->Buffer, - SymbolicLinkName->Length); + Status = ZwSetValueKey(SubKey, + &SymbolicLink, + 0, /* TileIndex */ + REG_SZ, + SymbolicLinkName->Buffer, + SymbolicLinkName->Length); if (!NT_SUCCESS(Status)) { DPRINT1("ZwSetValueKey() failed with status 0x%08lx\n", Status); + ZwClose(SubKey); + ZwClose(InterfaceKey); + ZwClose(ClassKey); + ExFreePool(SubKeyName.Buffer); + ExFreePool(InterfaceKeyName.Buffer); + ExFreePool(BaseKeyName.Buffer); ExFreePool(SymbolicLinkName->Buffer); + return Status; } else { SymbolicLinkName->Buffer[1] = '?'; } + /* Create symbolic link */ + DPRINT("IoRegisterDeviceInterface(): creating symbolic link %wZ -> %wZ\n", SymbolicLinkName, &PdoNameInfo->Name); + Status = IoCreateSymbolicLink(SymbolicLinkName, &PdoNameInfo->Name); + + /* If the symbolic link already exists, return an informational success status */ + if (Status == STATUS_OBJECT_NAME_COLLISION) + Status = STATUS_OBJECT_NAME_EXISTS; + + /* Check if it really failed */ + if (!NT_SUCCESS(Status)) + { + DPRINT1("IoCreateSymbolicLink() failed with status 0x%08lx\n", Status); + ExFreePool(SymbolicLinkName->Buffer); + } + ZwClose(SubKey); ZwClose(InterfaceKey); ZwClose(ClassKey); diff --git a/ntoskrnl/io/iomgr/driver.c b/ntoskrnl/io/iomgr/driver.c index f273111ce56..1689f022525 100644 --- a/ntoskrnl/io/iomgr/driver.c +++ b/ntoskrnl/io/iomgr/driver.c @@ -310,51 +310,65 @@ IopLoadServiceModule( return STATUS_UNSUCCESSFUL; } - /* Open CurrentControlSet */ - RtlInitUnicodeString(&CCSName, - L"\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Services"); - Status = IopOpenRegistryKeyEx(&CCSKey, NULL, &CCSName, KEY_READ); - if (!NT_SUCCESS(Status)) + if (ExpInTextModeSetup) { - DPRINT1("ZwOpenKey() failed with Status %08X\n", Status); - return Status; - } + /* We have no registry, but luckily we know where all the drivers are */ - /* Open service key */ - Status = IopOpenRegistryKeyEx(&ServiceKey, CCSKey, ServiceName, KEY_READ); - if (!NT_SUCCESS(Status)) + /* ServiceStart < 4 is all that matters */ + ServiceStart = 0; + + /* IopNormalizeImagePath will do all of the work for us if we give it an empty string */ + ServiceImagePath.Length = ServiceImagePath.MaximumLength = 0; + ServiceImagePath.Buffer = NULL; + } + else { - DPRINT1("ZwOpenKey() failed with Status %08X\n", Status); + /* Open CurrentControlSet */ + RtlInitUnicodeString(&CCSName, + L"\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Services"); + Status = IopOpenRegistryKeyEx(&CCSKey, NULL, &CCSName, KEY_READ); + if (!NT_SUCCESS(Status)) + { + DPRINT1("ZwOpenKey() failed with Status %08X\n", Status); + return Status; + } + + /* Open service key */ + Status = IopOpenRegistryKeyEx(&ServiceKey, CCSKey, ServiceName, KEY_READ); + if (!NT_SUCCESS(Status)) + { + DPRINT1("ZwOpenKey() failed with Status %08X\n", Status); + ZwClose(CCSKey); + return Status; + } + + /* + * Get information about the service. + */ + + RtlZeroMemory(QueryTable, sizeof(QueryTable)); + + RtlInitUnicodeString(&ServiceImagePath, NULL); + + QueryTable[0].Name = L"Start"; + QueryTable[0].Flags = RTL_QUERY_REGISTRY_DIRECT; + QueryTable[0].EntryContext = &ServiceStart; + + QueryTable[1].Name = L"ImagePath"; + QueryTable[1].Flags = RTL_QUERY_REGISTRY_DIRECT; + QueryTable[1].EntryContext = &ServiceImagePath; + + Status = RtlQueryRegistryValues(RTL_REGISTRY_HANDLE, + (PWSTR)ServiceKey, QueryTable, NULL, NULL); + + ZwClose(ServiceKey); ZwClose(CCSKey); - return Status; - } - /* - * Get information about the service. - */ - - RtlZeroMemory(QueryTable, sizeof(QueryTable)); - - RtlInitUnicodeString(&ServiceImagePath, NULL); - - QueryTable[0].Name = L"Start"; - QueryTable[0].Flags = RTL_QUERY_REGISTRY_DIRECT; - QueryTable[0].EntryContext = &ServiceStart; - - QueryTable[1].Name = L"ImagePath"; - QueryTable[1].Flags = RTL_QUERY_REGISTRY_DIRECT; - QueryTable[1].EntryContext = &ServiceImagePath; - - Status = RtlQueryRegistryValues(RTL_REGISTRY_HANDLE, - (PWSTR)ServiceKey, QueryTable, NULL, NULL); - - ZwClose(ServiceKey); - ZwClose(CCSKey); - - if (!NT_SUCCESS(Status)) - { - DPRINT1("RtlQueryRegistryValues() failed (Status %x)\n", Status); - return Status; + if (!NT_SUCCESS(Status)) + { + DPRINT1("RtlQueryRegistryValues() failed (Status %x)\n", Status); + return Status; + } } /* @@ -369,20 +383,24 @@ IopLoadServiceModule( return Status; } - /* - * Case for disabled drivers - */ + /* + * Case for disabled drivers + */ - if (ServiceStart >= 4) - { - /* FIXME: Check if it is the right status code */ - Status = STATUS_PLUGPLAY_NO_DEVICE; - } - else - { - DPRINT("Loading module\n"); - Status = MmLoadSystemImage(&ServiceImagePath, NULL, NULL, 0, (PVOID)ModuleObject, &BaseAddress); - } + if (ServiceStart >= 4) + { + /* FIXME: Check if it is the right status code */ + Status = STATUS_PLUGPLAY_NO_DEVICE; + } + else + { + DPRINT("Loading module\n"); + Status = MmLoadSystemImage(&ServiceImagePath, NULL, NULL, 0, (PVOID)ModuleObject, &BaseAddress); + if (NT_SUCCESS(Status)) + { + IopDisplayLoadingMessage(ServiceName); + } + } ExFreePool(ServiceImagePath.Buffer); @@ -836,7 +854,6 @@ IopInitializeBuiltinDriver(IN PLDR_DATA_TABLE_ENTRY LdrEntry) DPRINT1("Driver '%wZ' load failed, status (%x)\n", ModuleName, Status); return(Status); } - DeviceNode->ServiceName = ServiceName; /* * Initialize the driver @@ -1820,8 +1837,6 @@ IopLoadUnloadDriver(PLOAD_UNLOAD_PARAMS LoadParams) cur--; } - IopDisplayLoadingMessage(&ServiceName); - /* * Get service type. */ @@ -1868,21 +1883,6 @@ IopLoadUnloadDriver(PLOAD_UNLOAD_PARAMS LoadParams) DPRINT("FullImagePath: '%wZ'\n", &ImagePath); DPRINT("Type: %lx\n", Type); - /* - * Create device node - */ - - /* Use IopRootDeviceNode for now */ - Status = IopCreateDeviceNode(IopRootDeviceNode, NULL, &ServiceName, &DeviceNode); - - if (!NT_SUCCESS(Status)) - { - DPRINT("IopCreateDeviceNode() failed (Status %lx)\n", Status); - LoadParams->Status = Status; - (VOID)KeSetEvent(&LoadParams->Event, 0, FALSE); - return; - } - /* Get existing DriverObject pointer (in case the driver has already been loaded and initialized) */ Status = IopGetDriverObject( @@ -1902,23 +1902,29 @@ IopLoadUnloadDriver(PLOAD_UNLOAD_PARAMS LoadParams) if (!NT_SUCCESS(Status) && Status != STATUS_IMAGE_ALREADY_LOADED) { DPRINT("MmLoadSystemImage() failed (Status %lx)\n", Status); - IopFreeDeviceNode(DeviceNode); LoadParams->Status = Status; (VOID)KeSetEvent(&LoadParams->Event, 0, FALSE); return; } - /* - * Set a service name for the device node - */ - - RtlCreateUnicodeString(&DeviceNode->ServiceName, ServiceName.Buffer); - /* * Initialize the driver module if it's loaded for the first time */ if (Status != STATUS_IMAGE_ALREADY_LOADED) { + Status = IopCreateDeviceNode(IopRootDeviceNode, NULL, &ServiceName, &DeviceNode); + + if (!NT_SUCCESS(Status)) + { + DPRINT("IopCreateDeviceNode() failed (Status %lx)\n", Status); + MmUnloadSystemImage(ModuleObject); + LoadParams->Status = Status; + (VOID)KeSetEvent(&LoadParams->Event, 0, FALSE); + return; + } + + IopDisplayLoadingMessage(&DeviceNode->ServiceName); + Status = IopInitializeDriverModule( DeviceNode, ModuleObject, @@ -1936,11 +1942,11 @@ IopLoadUnloadDriver(PLOAD_UNLOAD_PARAMS LoadParams) (VOID)KeSetEvent(&LoadParams->Event, 0, FALSE); return; } + + /* Initialize and start device */ + IopInitializeDevice(DeviceNode, DriverObject); + Status = IopStartDevice(DeviceNode); } - - /* Initialize and start device */ - IopInitializeDevice(DeviceNode, DriverObject); - Status = IopStartDevice(DeviceNode); } else { @@ -1948,9 +1954,6 @@ IopLoadUnloadDriver(PLOAD_UNLOAD_PARAMS LoadParams) /* IopGetDriverObject references the DriverObject, so dereference it */ ObDereferenceObject(DriverObject); - - /* Free device node since driver loading failed */ - IopFreeDeviceNode(DeviceNode); } /* Pass status to the caller and signal the event */ diff --git a/ntoskrnl/io/iomgr/file.c b/ntoskrnl/io/iomgr/file.c index 43686de19d6..745a964cd9c 100644 --- a/ntoskrnl/io/iomgr/file.c +++ b/ntoskrnl/io/iomgr/file.c @@ -408,7 +408,8 @@ IopParseDevice(IN PVOID ParseObject, if (!(DirectOpen) && !(RemainingName->Length) && !(OpenPacket->RelatedFileObject) && - ((wcsstr(CompleteName->Buffer, L"Harddisk"))) && + ((wcsstr(CompleteName->Buffer, L"Harddisk")) || + (wcsstr(CompleteName->Buffer, L"Floppy"))) && !(UseDummyFile)) { DPRINT1("Using IopParseDevice() hack. Requested invalid attributes: %lx\n", @@ -479,7 +480,7 @@ IopParseDevice(IN PVOID ParseObject, { /* Dereference the device and VPB, then fail */ IopDereferenceDeviceObject(OriginalDeviceObject, FALSE); - if (Vpb) IopDereferenceVpb(Vpb); + if (Vpb) IopDereferenceVpbAndFree(Vpb); return STATUS_INSUFFICIENT_RESOURCES; } @@ -577,7 +578,7 @@ IopParseDevice(IN PVOID ParseObject, /* Dereference the device and VPB */ IopDereferenceDeviceObject(OriginalDeviceObject, FALSE); - if (Vpb) IopDereferenceVpb(Vpb); + if (Vpb) IopDereferenceVpbAndFree(Vpb); /* We failed, return status */ OpenPacket->FinalStatus = Status; @@ -687,7 +688,7 @@ IopParseDevice(IN PVOID ParseObject, /* Dereference the device object and VPB */ IopDereferenceDeviceObject(OriginalDeviceObject, FALSE); - if (Vpb) IopDereferenceVpb(Vpb); + if (Vpb) IopDereferenceVpbAndFree(Vpb); /* Clear the FO and dereference it */ FileObject->DeviceObject = NULL; @@ -762,7 +763,7 @@ IopParseDevice(IN PVOID ParseObject, if (FileObject->FileName.Length) { /* Free it */ - ExFreePool(FileObject->FileName.Buffer); + ExFreePoolWithTag(FileObject->FileName.Buffer, TAG_IO_NAME); FileObject->FileName.Length = 0; } @@ -783,7 +784,7 @@ IopParseDevice(IN PVOID ParseObject, IopDereferenceDeviceObject(OriginalDeviceObject, FALSE); /* Unless the driver cancelled the open, dereference the VPB */ - if (!(OpenCancelled) && (Vpb)) IopDereferenceVpb(Vpb); + if (!(OpenCancelled) && (Vpb)) IopDereferenceVpbAndFree(Vpb); /* Set the status and return */ OpenPacket->FinalStatus = Status; @@ -806,7 +807,7 @@ IopParseDevice(IN PVOID ParseObject, if (OwnerDevice != DeviceObject) { /* We have to de-reference the VPB we had associated */ - if (Vpb) IopDereferenceVpb(Vpb); + if (Vpb) IopDereferenceVpbAndFree(Vpb); /* And re-associate with the actual one */ Vpb = FileObject->Vpb; @@ -868,7 +869,7 @@ IopParseDevice(IN PVOID ParseObject, } /* Free our buffer */ - ExFreePool(FileBasicInfo); + ExFreePoolWithTag(FileBasicInfo, TAG_IO); } else { @@ -1331,7 +1332,7 @@ IopQueryNameFile(IN PVOID ObjectBody, if (!NT_SUCCESS(Status) && (Status != STATUS_INFO_LENGTH_MISMATCH)) { /* Free the buffer and fail */ - ExFreePool(LocalInfo); + ExFreePoolWithTag(LocalInfo, TAG_IO); return Status; } @@ -1375,7 +1376,7 @@ IopQueryNameFile(IN PVOID ObjectBody, if (NT_ERROR(Status)) { /* Fail on errors only, allow warnings */ - ExFreePool(LocalInfo); + ExFreePoolWithTag(LocalInfo, TAG_IO); return Status; } @@ -1386,7 +1387,7 @@ IopQueryNameFile(IN PVOID ObjectBody, *ReturnLength += LocalFileInfo->FileNameLength; /* Free the allocated buffer and return failure */ - ExFreePool(LocalInfo); + ExFreePoolWithTag(LocalInfo, TAG_IO); return STATUS_BUFFER_OVERFLOW; } @@ -1414,7 +1415,7 @@ IopQueryNameFile(IN PVOID ObjectBody, sizeof(UNICODE_NULL); /* Free buffer and return */ - ExFreePool(LocalInfo); + ExFreePoolWithTag(LocalInfo, TAG_IO); return Status; } @@ -1908,7 +1909,7 @@ IoCreateFile(OUT PHANDLE FileHandle, if (OpenPacket.FileObject->FileName.Length) { /* It had a name, free it */ - ExFreePool(OpenPacket.FileObject->FileName.Buffer); + ExFreePoolWithTag(OpenPacket.FileObject->FileName.Buffer, TAG_IO_NAME); } /* Clear the device object to invalidate the FO, and dereference */ diff --git a/ntoskrnl/io/iomgr/iofunc.c b/ntoskrnl/io/iomgr/iofunc.c index 22e8710a4e3..49976c68855 100644 --- a/ntoskrnl/io/iomgr/iofunc.c +++ b/ntoskrnl/io/iomgr/iofunc.c @@ -370,7 +370,7 @@ IopDeviceFsIoControl(IN HANDLE DeviceHandle, StackPtr->MajorFunction = IsDevIoCtl ? IRP_MJ_DEVICE_CONTROL : IRP_MJ_FILE_SYSTEM_CONTROL; - StackPtr->MinorFunction = 0; + StackPtr->MinorFunction = 0; /* Minor function 0 is IRP_MN_USER_FS_REQUEST */ StackPtr->Control = 0; StackPtr->Flags = 0; StackPtr->Parameters.DeviceIoControl.Type3InputBuffer = NULL; diff --git a/ntoskrnl/io/iomgr/iomgr.c b/ntoskrnl/io/iomgr/iomgr.c index 38e72ec10cb..c390029ebe7 100644 --- a/ntoskrnl/io/iomgr/iomgr.c +++ b/ntoskrnl/io/iomgr/iomgr.c @@ -52,19 +52,17 @@ extern LIST_ENTRY ShutdownListHead; extern LIST_ENTRY LastChanceShutdownListHead; extern KSPIN_LOCK ShutdownListLock; extern POBJECT_TYPE IoAdapterObjectType; -ERESOURCE IopDatabaseResource; -extern ERESOURCE FileSystemListLock; +extern ERESOURCE IopDatabaseResource; ERESOURCE IopSecurityResource; -extern KGUARDED_MUTEX FsChangeNotifyListLock; extern KGUARDED_MUTEX PnpNotifyListLock; -extern LIST_ENTRY IopDiskFsListHead; -extern LIST_ENTRY IopCdRomFsListHead; -extern LIST_ENTRY IopTapeFsListHead; -extern LIST_ENTRY IopNetworkFsListHead; +extern LIST_ENTRY IopDiskFileSystemQueueHead; +extern LIST_ENTRY IopCdRomFileSystemQueueHead; +extern LIST_ENTRY IopTapeFileSystemQueueHead; +extern LIST_ENTRY IopNetworkFileSystemQueueHead; extern LIST_ENTRY DriverBootReinitListHead; extern LIST_ENTRY DriverReinitListHead; extern LIST_ENTRY PnpNotifyListHead; -extern LIST_ENTRY FsChangeNotifyListHead; +extern LIST_ENTRY IopFsNotifyChangeQueueHead; extern LIST_ENTRY IopErrorLogListHead; extern LIST_ENTRY IopTimerQueueHead; extern KDPC IopTimerDpc; @@ -450,20 +448,18 @@ IoInitSystem(IN PLOADER_PARAMETER_BLOCK LoaderBlock) /* Initialize all locks and lists */ ExInitializeResource(&IopDatabaseResource); - ExInitializeResource(&FileSystemListLock); ExInitializeResource(&IopSecurityResource); - KeInitializeGuardedMutex(&FsChangeNotifyListLock); KeInitializeGuardedMutex(&PnpNotifyListLock); - InitializeListHead(&IopDiskFsListHead); - InitializeListHead(&IopCdRomFsListHead); - InitializeListHead(&IopTapeFsListHead); - InitializeListHead(&IopNetworkFsListHead); + InitializeListHead(&IopDiskFileSystemQueueHead); + InitializeListHead(&IopCdRomFileSystemQueueHead); + InitializeListHead(&IopTapeFileSystemQueueHead); + InitializeListHead(&IopNetworkFileSystemQueueHead); InitializeListHead(&DriverBootReinitListHead); InitializeListHead(&DriverReinitListHead); InitializeListHead(&PnpNotifyListHead); InitializeListHead(&ShutdownListHead); InitializeListHead(&LastChanceShutdownListHead); - InitializeListHead(&FsChangeNotifyListHead); + InitializeListHead(&IopFsNotifyChangeQueueHead); InitializeListHead(&IopErrorLogListHead); KeInitializeSpinLock(&IoStatisticsLock); KeInitializeSpinLock(&DriverReinitListLock); @@ -484,10 +480,18 @@ IoInitSystem(IN PLOADER_PARAMETER_BLOCK LoaderBlock) KeSetTimerEx(&IopTimer, ExpireTime, 1000, &IopTimerDpc); /* Create Object Types */ - if (!IopCreateObjectTypes()) return FALSE; + if (!IopCreateObjectTypes()) + { + DPRINT1("IopCreateObjectTypes failed!\n"); + return FALSE; + } /* Create Object Directories */ - if (!IopCreateRootDirectories()) return FALSE; + if (!IopCreateRootDirectories()) + { + DPRINT1("IopCreateRootDirectories failed!\n"); + return FALSE; + } /* Initialize PnP manager */ IopInitializePlugPlayServices(); @@ -515,10 +519,19 @@ IoInitSystem(IN PLOADER_PARAMETER_BLOCK LoaderBlock) IopLoaderBlock = NULL; /* Create ARC names for boot devices */ - if (!NT_SUCCESS(IopCreateArcNames(LoaderBlock))) return FALSE; + Status = IopCreateArcNames(LoaderBlock); + if (!NT_SUCCESS(Status)) + { + DPRINT1("IopCreateArcNames failed: %lx\n", Status); + return FALSE; + } /* Mark the system boot partition */ - if (!IopMarkBootPartition(LoaderBlock)) return FALSE; + if (!IopMarkBootPartition(LoaderBlock)) + { + DPRINT1("IopMarkBootPartition failed!\n"); + return FALSE; + } /* Initialize PnP root relations */ IopEnumerateDevice(IopRootDeviceNode->PhysicalDeviceObject); @@ -543,7 +556,11 @@ IoInitSystem(IN PLOADER_PARAMETER_BLOCK LoaderBlock) /* Convert SystemRoot from ARC to NT path */ Status = IopReassignSystemRoot(LoaderBlock, &NtBootPath); - if (!NT_SUCCESS(Status)) return FALSE; + if (!NT_SUCCESS(Status)) + { + DPRINT1("IopReassignSystemRoot failed: %lx\n", Status); + return FALSE; + } /* Set the ANSI_STRING for the root path */ RootString.MaximumLength = NtSystemRoot.MaximumLength / sizeof(WCHAR); @@ -554,7 +571,11 @@ IoInitSystem(IN PLOADER_PARAMETER_BLOCK LoaderBlock) /* Convert the path into the ANSI_STRING */ Status = RtlUnicodeStringToAnsiString(&RootString, &NtSystemRoot, FALSE); - if (!NT_SUCCESS(Status)) return FALSE; + if (!NT_SUCCESS(Status)) + { + DPRINT1("RtlUnicodeStringToAnsiString failed: %lx\n", Status); + return FALSE; + } /* Assign drive letters */ IoAssignDriveLetters(LoaderBlock, @@ -564,10 +585,19 @@ IoInitSystem(IN PLOADER_PARAMETER_BLOCK LoaderBlock) /* Update system root */ Status = RtlAnsiStringToUnicodeString(&NtSystemRoot, &RootString, FALSE); - if (!NT_SUCCESS(Status)) return FALSE; + if (!NT_SUCCESS(Status)) + { + DPRINT1("RtlAnsiStringToUnicodeString failed: %lx\n", Status); + return FALSE; + } /* Load the System DLL and its Entrypoints */ - if (!NT_SUCCESS(PsLocateSystemDll())) return FALSE; + Status = PsLocateSystemDll(); + if (!NT_SUCCESS(Status)) + { + DPRINT1("PsLocateSystemDll failed: %lx\n", Status); + return FALSE; + } /* Return success */ return TRUE; diff --git a/ntoskrnl/io/iomgr/remlock.c b/ntoskrnl/io/iomgr/remlock.c index 55eaff47d23..c0617b2ec7d 100644 --- a/ntoskrnl/io/iomgr/remlock.c +++ b/ntoskrnl/io/iomgr/remlock.c @@ -5,6 +5,7 @@ * PURPOSE: Remove Lock Support * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org) * Filip Navara (navaraf@reactos.org) + * Pierre Schweitzer (pierre.schweitzer@reactos.org) */ /* INCLUDES ******************************************************************/ @@ -13,6 +14,15 @@ #define NDEBUG #include +typedef struct _IO_REMOVE_LOCK_TRACKING_BLOCK +{ + PIO_REMOVE_LOCK_TRACKING_BLOCK Next; + PVOID Tag; + LARGE_INTEGER LockMoment; + LPCSTR File; + ULONG Line; +} IO_REMOVE_LOCK_TRACKING_BLOCK; + /* FUNCTIONS *****************************************************************/ /* @@ -29,26 +39,34 @@ IoInitializeRemoveLockEx(IN PIO_REMOVE_LOCK RemoveLock, PEXTENDED_IO_REMOVE_LOCK Lock = (PEXTENDED_IO_REMOVE_LOCK)RemoveLock; PAGED_CODE(); - /* Check if this is a debug lock */ - if (RemlockSize == sizeof(IO_REMOVE_LOCK_DBG_BLOCK)) - { - /* Clear the lock */ - RtlZeroMemory(Lock, RemlockSize); + ASSERT(HighWatermark < MAXLONG); - /* Setup debug parameters */ - Lock->Dbg.HighWatermark = HighWatermark; - Lock->Dbg.MaxLockedTicks = MaxLockedMinutes * 600000000; - Lock->Dbg.AllocateTag = AllocateTag; - KeInitializeSpinLock(&Lock->Dbg.Spin); - } - else + /* If no lock given, nothing to do */ + if (!Lock) { - /* Otherwise, setup a free block */ - Lock->Common.Removed = FALSE; - Lock->Common.IoCount = 1; - KeInitializeEvent(&Lock->Common.RemoveEvent, - SynchronizationEvent, - FALSE); + return; + } + + switch (RemlockSize) + { + /* Check if this is a debug lock */ + case (sizeof(IO_REMOVE_LOCK_DBG_BLOCK) + sizeof(IO_REMOVE_LOCK_COMMON_BLOCK)): + /* Setup debug parameters */ + Lock->Dbg.Signature = 'COLR'; + Lock->Dbg.HighWatermark = HighWatermark; + Lock->Dbg.MaxLockedTicks = KeQueryTimeIncrement() * MaxLockedMinutes * 600000000; + Lock->Dbg.AllocateTag = AllocateTag; + KeInitializeSpinLock(&(Lock->Dbg.Spin)); + Lock->Dbg.LowMemoryCount = 0; + Lock->Dbg.Blocks = NULL; + + case sizeof(IO_REMOVE_LOCK_COMMON_BLOCK): + /* Setup a free block */ + Lock->Common.Removed = FALSE; + Lock->Common.IoCount = 1; + KeInitializeEvent(&Lock->Common.RemoveEvent, + SynchronizationEvent, + FALSE); } } @@ -63,27 +81,52 @@ IoAcquireRemoveLockEx(IN PIO_REMOVE_LOCK RemoveLock, IN ULONG Line, IN ULONG RemlockSize) { + KIRQL OldIrql; + LONG LockValue; + PIO_REMOVE_LOCK_TRACKING_BLOCK TrackingBlock; PEXTENDED_IO_REMOVE_LOCK Lock = (PEXTENDED_IO_REMOVE_LOCK)RemoveLock; /* Increase the lock count */ - InterlockedIncrement(&Lock->Common.IoCount); + LockValue = InterlockedIncrement(&(Lock->Common.IoCount)); + ASSERT(LockValue > 0); if (!Lock->Common.Removed) { /* Check what kind of lock this is */ - if (RemlockSize == sizeof(IO_REMOVE_LOCK_DBG_BLOCK)) + if (RemlockSize == (sizeof(IO_REMOVE_LOCK_DBG_BLOCK) + sizeof(IO_REMOVE_LOCK_COMMON_BLOCK))) { - /* FIXME: Not yet supported */ - DPRINT1("UNIMPLEMENTED\n"); - ASSERT(FALSE); + ASSERT(Lock->Dbg.HighWatermark == 0 || LockValue <= Lock->Dbg.HighWatermark); + + /* Allocate a tracking block */ + TrackingBlock = ExAllocatePoolWithTag(NonPagedPool, sizeof(IO_REMOVE_LOCK_TRACKING_BLOCK), Lock->Dbg.AllocateTag); + if (!TrackingBlock) + { + /* Keep count of failures for lock release and missing tags */ + InterlockedIncrement(&(Lock->Dbg.LowMemoryCount)); + } + else + { + /* Initialize block */ + RtlZeroMemory(TrackingBlock, sizeof(IO_REMOVE_LOCK_TRACKING_BLOCK)); + TrackingBlock->Tag = Tag; + TrackingBlock->File = File; + TrackingBlock->Line = Line; + KeQueryTickCount(&(TrackingBlock->LockMoment)); + + /* Queue the block */ + KeAcquireSpinLock(&(Lock->Dbg.Spin), &OldIrql); + TrackingBlock->Next = Lock->Dbg.Blocks; + Lock->Dbg.Blocks = TrackingBlock; + KeReleaseSpinLock(&(Lock->Dbg.Spin), OldIrql); + } } } else { /* Otherwise, decrement the count and check if it's gone */ - if (!InterlockedDecrement(&Lock->Common.IoCount)) + if (!InterlockedDecrement(&(Lock->Common.IoCount))) { /* Signal the event */ - KeSetEvent(&Lock->Common.RemoveEvent, IO_NO_INCREMENT, FALSE); + KeSetEvent(&(Lock->Common.RemoveEvent), IO_NO_INCREMENT, FALSE); } /* Return pending delete */ @@ -103,21 +146,86 @@ IoReleaseRemoveLockEx(IN PIO_REMOVE_LOCK RemoveLock, IN PVOID Tag, IN ULONG RemlockSize) { + KIRQL OldIrql; + LONG LockValue; + BOOLEAN TagFound; + LARGE_INTEGER CurrentMoment; + PIO_REMOVE_LOCK_TRACKING_BLOCK TrackingBlock; + PIO_REMOVE_LOCK_TRACKING_BLOCK *TrackingBlockLink; PEXTENDED_IO_REMOVE_LOCK Lock = (PEXTENDED_IO_REMOVE_LOCK)RemoveLock; /* Check what kind of lock this is */ - if (RemlockSize == sizeof(IO_REMOVE_LOCK_DBG_BLOCK)) + if (RemlockSize == (sizeof(IO_REMOVE_LOCK_DBG_BLOCK) + sizeof(IO_REMOVE_LOCK_COMMON_BLOCK))) { - /* FIXME: Not yet supported */ - DPRINT1("UNIMPLEMENTED\n"); - ASSERT(FALSE); + /* Acquire blocks queue */ + KeAcquireSpinLock(&(Lock->Dbg.Spin), &OldIrql); + + /* Get the release moment */ + KeQueryTickCount(&CurrentMoment); + + /* Start browsing tracking blocks to find a block that would match given tag */ + TagFound = FALSE; + TrackingBlock = Lock->Dbg.Blocks; + TrackingBlockLink = &(Lock->Dbg.Blocks); + while (TrackingBlock != NULL) + { + /* First of all, check if the lock was locked for too long */ + if (Lock->Dbg.MaxLockedTicks && + CurrentMoment.QuadPart - TrackingBlock->LockMoment.QuadPart > Lock->Dbg.MaxLockedTicks) + { + DPRINT("Lock %#08lx (with tag %#08lx) was supposed to be held at max %I64d ticks but lasted longer\n", + Lock, TrackingBlock->Tag, Lock->Dbg.MaxLockedTicks); + DPRINT("Lock was acquired in file %s at line %d\n", TrackingBlock->File, TrackingBlock->Line); + ASSERT(FALSE); + } + + /* Check if this is the first matching tracking block */ + if ((TagFound == FALSE) && (TrackingBlock->Tag == Tag)) + { + /* Unlink this tracking block, and free it */ + TagFound = TRUE; + *TrackingBlockLink = TrackingBlock->Next; + ExFreePoolWithTag(TrackingBlock, Lock->Dbg.AllocateTag); + TrackingBlock = *TrackingBlockLink; + } + else + { + /* Go to the next tracking block */ + TrackingBlockLink = &(TrackingBlock->Next); + TrackingBlock = TrackingBlock->Next; + } + } + + /* We're done, release queue lock */ + KeReleaseSpinLock(&(Lock->Dbg.Spin), OldIrql); + + /* If we didn't find any matching block */ + if (TagFound == FALSE) + { + /* Check if it was because we were low in memory + * If yes, then ignore, that's normal + */ + if (InterlockedDecrement(&(Lock->Dbg.LowMemoryCount)) < 0) + { + /* Otherwise signal the issue, it shouldn't happen */ + InterlockedIncrement(&(Lock->Dbg.LowMemoryCount)); + DPRINT("Failed finding block for tag: %#08lx\n", Tag); + ASSERT(FALSE); + } + } } /* Decrement the lock count */ - if (!InterlockedDecrement(&Lock->Common.IoCount)) + LockValue = InterlockedDecrement(&(Lock->Common.IoCount)); + ASSERT(LockValue >= 0); + + if (!LockValue) { + /* Someone should be waiting... */ + ASSERT(Lock->Common.Removed); + /* Signal the event */ - KeSetEvent(&Lock->Common.RemoveEvent, IO_NO_INCREMENT, FALSE); + KeSetEvent(&(Lock->Common.RemoveEvent), IO_NO_INCREMENT, FALSE); } } @@ -130,15 +238,21 @@ IoReleaseRemoveLockAndWaitEx(IN PIO_REMOVE_LOCK RemoveLock, IN PVOID Tag, IN ULONG RemlockSize) { + LONG LockValue; + PIO_REMOVE_LOCK_TRACKING_BLOCK TrackingBlock; PEXTENDED_IO_REMOVE_LOCK Lock = (PEXTENDED_IO_REMOVE_LOCK)RemoveLock; PAGED_CODE(); /* Remove the lock and decrement the count */ Lock->Common.Removed = TRUE; + LockValue = InterlockedDecrement(&Lock->Common.IoCount); + ASSERT(LockValue > 0); + + /* If we are still > 0, then wait for the others to remove lock */ if (InterlockedDecrement(&Lock->Common.IoCount) > 0) { /* Wait for it */ - KeWaitForSingleObject(&Lock->Common.RemoveEvent, + KeWaitForSingleObject(&(Lock->Common.RemoveEvent), Executive, KernelMode, FALSE, @@ -146,11 +260,22 @@ IoReleaseRemoveLockAndWaitEx(IN PIO_REMOVE_LOCK RemoveLock, } /* Check what kind of lock this is */ - if (RemlockSize == sizeof(IO_REMOVE_LOCK_DBG_BLOCK)) + if (RemlockSize == (sizeof(IO_REMOVE_LOCK_DBG_BLOCK) + sizeof(IO_REMOVE_LOCK_COMMON_BLOCK))) { - /* FIXME: Not yet supported */ - DPRINT1("UNIMPLEMENTED\n"); - ASSERT(FALSE); + /* A block must be remaining */ + ASSERT(Lock->Dbg.Blocks); + + /* Get it */ + TrackingBlock = Lock->Dbg.Blocks; + /* Tag should match */ + if (TrackingBlock->Tag != Tag) + { + DPRINT("Last tracking block tag invalid! Expected: %x, having: %x\n", Tag, TrackingBlock->Tag); + ASSERT(TrackingBlock->Tag != Tag); + } + + /* Release block */ + ExFreePoolWithTag(Lock->Dbg.Blocks, Lock->Dbg.AllocateTag); } } diff --git a/ntoskrnl/io/iomgr/util.c b/ntoskrnl/io/iomgr/util.c index e2c0bcee0c1..c1164977a67 100644 --- a/ntoskrnl/io/iomgr/util.c +++ b/ntoskrnl/io/iomgr/util.c @@ -166,8 +166,7 @@ IoCheckEaBufferValidity(IN PFILE_FULL_EA_INFORMATION EaBuffer, OUT PULONG ErrorOffset) { PFILE_FULL_EA_INFORMATION EaBufferEnd; - ULONG NextEaBufferOffset; - LONG IntEaLength; + ULONG NextEaBufferOffset, IntEaLength; PAGED_CODE(); diff --git a/ntoskrnl/io/iomgr/volume.c b/ntoskrnl/io/iomgr/volume.c index f95e6e75201..f7d17dd3df7 100644 --- a/ntoskrnl/io/iomgr/volume.c +++ b/ntoskrnl/io/iomgr/volume.c @@ -6,6 +6,7 @@ * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org) * Herv Poussineau (hpoussin@reactos.org) * Eric Kohl + * Pierre Schweitzer (pierre.schweitzer@reactos.org) */ /* INCLUDES *****************************************************************/ @@ -21,14 +22,60 @@ /* GLOBALS ******************************************************************/ -ERESOURCE FileSystemListLock; -LIST_ENTRY IopDiskFsListHead, IopNetworkFsListHead; -LIST_ENTRY IopCdRomFsListHead, IopTapeFsListHead; -KGUARDED_MUTEX FsChangeNotifyListLock; -LIST_ENTRY FsChangeNotifyListHead; +ERESOURCE IopDatabaseResource; +LIST_ENTRY IopDiskFileSystemQueueHead, IopNetworkFileSystemQueueHead; +LIST_ENTRY IopCdRomFileSystemQueueHead, IopTapeFileSystemQueueHead; +LIST_ENTRY IopFsNotifyChangeQueueHead; +ULONG IopFsRegistrationOps; /* PRIVATE FUNCTIONS *********************************************************/ +/* + * @halfplemented + */ +VOID +NTAPI +IopDecrementDeviceObjectRef(IN PDEVICE_OBJECT DeviceObject, + IN BOOLEAN UnloadIfUnused) +{ + KIRQL OldIrql; + + /* Acquire lock */ + OldIrql = KeAcquireQueuedSpinLock(LockQueueIoDatabaseLock); + ASSERT(DeviceObject->ReferenceCount > 0); + + if (--DeviceObject->ReferenceCount > 0) + { + KeReleaseQueuedSpinLock(LockQueueIoDatabaseLock, OldIrql); + return; + } + + /* Here, DO is not referenced any longer, check if we have to unload it */ + if (UnloadIfUnused || IoGetDevObjExtension(DeviceObject)->ExtensionFlags & + (DOE_UNLOAD_PENDING | DOE_DELETE_PENDING | DOE_REMOVE_PENDING)) + { + /* Unload the driver */ + IopUnloadDevice(DeviceObject); + } + + /* Release lock */ + KeReleaseQueuedSpinLock(LockQueueIoDatabaseLock, OldIrql); +} + +/* + * @implemented + */ +VOID +NTAPI +IopDecrementDeviceObjectHandleCount(IN PDEVICE_OBJECT DeviceObject) +{ + /* Just decrease reference count */ + IopDecrementDeviceObjectRef(DeviceObject, FALSE); +} + +/* + * @implemented + */ PVPB NTAPI IopCheckVpbMounted(IN POPEN_PACKET OpenPacket, @@ -100,6 +147,9 @@ IopCheckVpbMounted(IN POPEN_PACKET OpenPacket, return Vpb; } +/* + * @implemented + */ NTSTATUS NTAPI IopCreateVpb(IN PDEVICE_OBJECT DeviceObject) @@ -110,7 +160,7 @@ IopCreateVpb(IN PDEVICE_OBJECT DeviceObject) Vpb = ExAllocatePoolWithTag(NonPagedPool, sizeof(VPB), TAG_VPB); - if (!Vpb) return STATUS_UNSUCCESSFUL; + if (!Vpb) return STATUS_INSUFFICIENT_RESOURCES; /* Clear it so we don't waste time manually */ RtlZeroMemory(Vpb, sizeof(VPB)); @@ -125,9 +175,12 @@ IopCreateVpb(IN PDEVICE_OBJECT DeviceObject) return STATUS_SUCCESS; } +/* + * @implemented + */ VOID NTAPI -IopDereferenceVpb(IN PVPB Vpb) +IopDereferenceVpbAndFree(IN PVPB Vpb) { KIRQL OldIrql; @@ -136,21 +189,30 @@ IopDereferenceVpb(IN PVPB Vpb) Vpb->ReferenceCount--; /* Check if we're out of references */ - if (!Vpb->ReferenceCount) + if (!Vpb->ReferenceCount && Vpb->RealDevice->Vpb == Vpb && + !(Vpb->Flags & VPB_PERSISTENT)) { - /* FIXME: IMPLEMENT CLEANUP! */ - ASSERT(FALSE); - } + /* Release VPB lock */ + IoReleaseVpbSpinLock(OldIrql); - /* Release VPB lock */ - IoReleaseVpbSpinLock(OldIrql); + /* And free VPB */ + ExFreePoolWithTag(Vpb, TAG_VPB); + } + else + { + /* Release VPB lock */ + IoReleaseVpbSpinLock(OldIrql); + } } +/* + * @implemented + */ BOOLEAN NTAPI -IopReferenceVpbForVerify(IN PDEVICE_OBJECT DeviceObject, - OUT PDEVICE_OBJECT *FileSystemObject, - OUT PVPB *Vpb) +IopReferenceVerifyVpb(IN PDEVICE_OBJECT DeviceObject, + OUT PDEVICE_OBJECT *FileSystemObject, + OUT PVPB *Vpb) { KIRQL OldIrql; PVPB LocalVpb; @@ -181,9 +243,9 @@ IopReferenceVpbForVerify(IN PDEVICE_OBJECT DeviceObject, PVPB NTAPI -IopInitializeVpbForMount(IN PDEVICE_OBJECT DeviceObject, - IN PDEVICE_OBJECT AttachedDeviceObject, - IN BOOLEAN Raw) +IopMountInitializeVpb(IN PDEVICE_OBJECT DeviceObject, + IN PDEVICE_OBJECT AttachedDeviceObject, + IN BOOLEAN Raw) { KIRQL OldIrql; PVPB Vpb; @@ -212,20 +274,20 @@ IopInitializeVpbForMount(IN PDEVICE_OBJECT DeviceObject, return Vpb; } +/* + * @implemented + */ VOID -NTAPI +FORCEINLINE IopNotifyFileSystemChange(IN PDEVICE_OBJECT DeviceObject, IN BOOLEAN DriverActive) { PFS_CHANGE_NOTIFY_ENTRY ChangeEntry; PLIST_ENTRY ListEntry; - /* Acquire the notification lock */ - KeAcquireGuardedMutex(&FsChangeNotifyListLock); - /* Loop the list */ - ListEntry = FsChangeNotifyListHead.Flink; - while (ListEntry != &FsChangeNotifyListHead) + ListEntry = IopFsNotifyChangeQueueHead.Flink; + while (ListEntry != &IopFsNotifyChangeQueueHead) { /* Get the entry */ ChangeEntry = CONTAINING_RECORD(ListEntry, @@ -238,11 +300,47 @@ IopNotifyFileSystemChange(IN PDEVICE_OBJECT DeviceObject, /* Go to the next entry */ ListEntry = ListEntry->Flink; } - - /* Release the lock */ - KeReleaseGuardedMutex(&FsChangeNotifyListLock); } +/* + * @implemented + */ +ULONG +FASTCALL +IopInterlockedIncrementUlong(IN KSPIN_LOCK_QUEUE_NUMBER Queue, + IN PULONG Ulong) +{ + KIRQL Irql; + ULONG OldValue; + + Irql = KeAcquireQueuedSpinLock(Queue); + OldValue = (*Ulong)++; + KeReleaseQueuedSpinLock(Queue, Irql); + + return OldValue; +} + +/* + * @implemented + */ +ULONG +FASTCALL +IopInterlockedDecrementUlong(IN KSPIN_LOCK_QUEUE_NUMBER Queue, + IN PULONG Ulong) +{ + KIRQL Irql; + ULONG OldValue; + + Irql = KeAcquireQueuedSpinLock(Queue); + OldValue = (*Ulong)--; + KeReleaseQueuedSpinLock(Queue, Irql); + + return OldValue; +} + +/* + * @implemented + */ VOID NTAPI IopShutdownBaseFileSystems(IN PLIST_ENTRY ListHead) @@ -254,9 +352,6 @@ IopShutdownBaseFileSystems(IN PLIST_ENTRY ListHead) KEVENT Event; NTSTATUS Status; - /* Lock the FS List and initialize an event to wait on */ - KeEnterCriticalRegion(); - ExAcquireResourceSharedLite(&FileSystemListLock,TRUE); KeInitializeEvent(&Event, NotificationEvent, FALSE); /* Get the first entry and start looping */ @@ -268,6 +363,9 @@ IopShutdownBaseFileSystems(IN PLIST_ENTRY ListHead) DEVICE_OBJECT, Queue.ListEntry); + ObReferenceObject(DeviceObject); + IopInterlockedIncrementUlong(LockQueueIoDatabaseLock, (PULONG)&DeviceObject->ReferenceCount); + /* Check if we're attached */ if (DeviceObject->AttachedDevice) { @@ -293,18 +391,20 @@ IopShutdownBaseFileSystems(IN PLIST_ENTRY ListHead) /* Reset the event */ KeClearEvent(&Event); + IopDecrementDeviceObjectRef(DeviceObject, FALSE); + ObDereferenceObject(DeviceObject); + /* Go to the next entry */ ListEntry = ListEntry->Flink; } - - /* Release the lock */ - ExReleaseResourceLite(&FileSystemListLock); - KeLeaveCriticalRegion(); } +/* + * @implemented + */ VOID NTAPI -IopLoadFileSystem(IN PDEVICE_OBJECT DeviceObject) +IopLoadFileSystemDriver(IN PDEVICE_OBJECT DeviceObject) { IO_STATUS_BLOCK IoStatusBlock; PIO_STACK_LOCATION StackPtr; @@ -347,8 +447,14 @@ IopLoadFileSystem(IN PDEVICE_OBJECT DeviceObject) KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL); } } + + /* Dereference DO - FsRec? - Comment out call, since it breaks up 2nd stage boot, needs more research. */ +// IopDecrementDeviceObjectRef(AttachedDeviceObject, TRUE); } +/* + * @implemented + */ NTSTATUS NTAPI IopMountVolume(IN PDEVICE_OBJECT DeviceObject, @@ -366,7 +472,7 @@ IopMountVolume(IN PDEVICE_OBJECT DeviceObject, LIST_ENTRY LocalList; PDEVICE_OBJECT AttachedDeviceObject = DeviceObject; PDEVICE_OBJECT FileSystemDeviceObject, ParentFsDeviceObject; - ULONG FsStackOverhead; + ULONG FsStackOverhead, RegistrationOps; PAGED_CODE(); /* Check if the device isn't already locked */ @@ -387,7 +493,7 @@ IopMountVolume(IN PDEVICE_OBJECT DeviceObject, /* Acquire the FS Lock*/ KeEnterCriticalRegion(); - ExAcquireResourceSharedLite(&FileSystemListLock, TRUE); + ExAcquireResourceSharedLite(&IopDatabaseResource, TRUE); /* Make sure we weren't already mounted */ if (!(DeviceObject->Vpb->Flags & (VPB_MOUNTED | VPB_REMOVE_PENDING))) @@ -411,17 +517,17 @@ IopMountVolume(IN PDEVICE_OBJECT DeviceObject, (DeviceObject->DeviceType == FILE_DEVICE_VIRTUAL_DISK)) { /* Use the disk list */ - FsList = &IopDiskFsListHead; + FsList = &IopDiskFileSystemQueueHead; } else if (DeviceObject->DeviceType == FILE_DEVICE_CD_ROM) { /* Use the CD-ROM list */ - FsList = &IopCdRomFsListHead; + FsList = &IopCdRomFileSystemQueueHead; } else { /* It's gotta be a tape... */ - FsList = &IopTapeFsListHead; + FsList = &IopTapeFileSystemQueueHead; } /* Now loop the fs list until one of the file systems accepts us */ @@ -502,6 +608,13 @@ IopMountVolume(IN PDEVICE_OBJECT DeviceObject, StackPtr->Parameters.MountVolume.DeviceObject = AttachedDeviceObject; + /* Save registration operations */ + RegistrationOps = IopFsRegistrationOps; + + /* Release locks */ + IopInterlockedIncrementUlong(LockQueueIoDatabaseLock, (PULONG)&DeviceObject->ReferenceCount); + ExReleaseResourceLite(&IopDatabaseResource); + /* Call the driver */ Status = IoCallDriver(FileSystemDeviceObject, Irp); if (Status == STATUS_PENDING) @@ -515,14 +628,17 @@ IopMountVolume(IN PDEVICE_OBJECT DeviceObject, Status = IoStatusBlock.Status; } + ExAcquireResourceSharedLite(&IopDatabaseResource, TRUE); + IopInterlockedDecrementUlong(LockQueueIoDatabaseLock, (PULONG)&DeviceObject->ReferenceCount); + /* Check if mounting was successful */ if (NT_SUCCESS(Status)) { /* Mount the VPB */ - *Vpb = IopInitializeVpbForMount(DeviceObject, - AttachedDeviceObject, - (DeviceObject->Vpb->Flags & - VPB_RAW_MOUNT)); + *Vpb = IopMountInitializeVpb(DeviceObject, + AttachedDeviceObject, + (DeviceObject->Vpb->Flags & + VPB_RAW_MOUNT)); } else { @@ -534,11 +650,22 @@ IopMountVolume(IN PDEVICE_OBJECT DeviceObject, break; } + /* If there were registration operations in the meanwhile */ + if (RegistrationOps != IopFsRegistrationOps) + { + /* We need to setup a local list to pickup where we left */ + LocalList.Flink = FsList->Flink; + ListEntry = &LocalList; + + Status = STATUS_UNRECOGNIZED_VOLUME; + } + /* Otherwise, check if we need to load the FS driver */ if (Status == STATUS_FS_DRIVER_REQUIRED) { /* We need to release the lock */ - ExReleaseResourceLite(&FileSystemListLock); + IopInterlockedIncrementUlong(LockQueueIoDatabaseLock, (PULONG)&DeviceObject->ReferenceCount); + ExReleaseResourceLite(&IopDatabaseResource); /* Release the device lock if we're holding it */ if (!DeviceIsLocked) @@ -546,8 +673,11 @@ IopMountVolume(IN PDEVICE_OBJECT DeviceObject, KeSetEvent(&DeviceObject->DeviceLock, 0, FALSE); } + /* Leave critical section */ + KeLeaveCriticalRegion(); + /* Load the FS */ - IopLoadFileSystem(ParentFsDeviceObject); + IopLoadFileSystemDriver(ParentFsDeviceObject); /* Check if the device isn't already locked */ if (!DeviceIsLocked) @@ -569,7 +699,8 @@ IopMountVolume(IN PDEVICE_OBJECT DeviceObject, } /* Reacquire the lock */ - ExAcquireResourceSharedLite(&FileSystemListLock, TRUE); + KeEnterCriticalRegion(); + ExAcquireResourceSharedLite(&IopDatabaseResource, TRUE); /* When we released the lock, make sure nobody beat us */ if (DeviceObject->Vpb->Flags & VPB_MOUNTED) @@ -593,7 +724,7 @@ IopMountVolume(IN PDEVICE_OBJECT DeviceObject, * file system. */ if (!(AllowRawMount) && - (Status != STATUS_UNRECOGNIZED_VOLUME) && + (Status != STATUS_UNRECOGNIZED_VOLUME) && (FsRtlIsTotalDeviceFailure(Status))) { /* Break out and give up */ @@ -620,7 +751,7 @@ IopMountVolume(IN PDEVICE_OBJECT DeviceObject, } /* Release the FS lock */ - ExReleaseResourceLite(&FileSystemListLock); + ExReleaseResourceLite(&IopDatabaseResource); KeLeaveCriticalRegion(); /* Release the device lock if we're holding it */ @@ -628,7 +759,8 @@ IopMountVolume(IN PDEVICE_OBJECT DeviceObject, /* Check if we failed to mount the boot partition */ if ((!NT_SUCCESS(Status)) && - (DeviceObject->Flags & DO_SYSTEM_BOOT_PARTITION)) + (DeviceObject->Flags & DO_SYSTEM_BOOT_PARTITION) && + ExpInitializationPhase < 2) { /* Bugcheck the system */ KeBugCheckEx(INACCESSIBLE_BOOT_DEVICE, @@ -642,19 +774,96 @@ IopMountVolume(IN PDEVICE_OBJECT DeviceObject, return Status; } +/* + * @implemented + */ +VOID +NTAPI +IopNotifyAlreadyRegisteredFileSystems(IN PLIST_ENTRY ListHead, + IN PDRIVER_FS_NOTIFICATION DriverNotificationRoutine, + BOOLEAN SkipRawFs) +{ + PLIST_ENTRY ListEntry; + PDEVICE_OBJECT DeviceObject; + + /* Browse the whole list */ + ListEntry = ListHead->Flink; + while (ListEntry != ListHead) + { + /* Check if we reached rawfs and if we have to skip it */ + if (ListEntry->Flink == ListHead && SkipRawFs) + { + return; + } + + /* Otherwise, get DO and notify */ + DeviceObject = CONTAINING_RECORD(ListEntry, + DEVICE_OBJECT, + Queue.ListEntry); + + DriverNotificationRoutine(DeviceObject, TRUE); + + /* Go to the next entry */ + ListEntry = ListEntry->Flink; + } +} + /* PUBLIC FUNCTIONS **********************************************************/ /* - * @unimplemented + * @implemented */ NTSTATUS NTAPI -IoEnumerateRegisteredFiltersList(IN PDRIVER_OBJECT *DriverObjectList, +IoEnumerateRegisteredFiltersList(OUT PDRIVER_OBJECT *DriverObjectList, IN ULONG DriverObjectListSize, OUT PULONG ActualNumberDriverObjects) { - UNIMPLEMENTED; - return STATUS_UNSUCCESSFUL; + PLIST_ENTRY ListEntry; + NTSTATUS Status = STATUS_SUCCESS; + PFS_CHANGE_NOTIFY_ENTRY ChangeEntry; + ULONG ListSize = 0, MaximumSize = DriverObjectListSize / sizeof(PDRIVER_OBJECT); + + /* Acquire the FS lock */ + KeEnterCriticalRegion(); + ExAcquireResourceExclusiveLite(&IopDatabaseResource, TRUE); + + /* Browse the whole list */ + ListEntry = IopFsNotifyChangeQueueHead.Flink; + while (ListEntry != &IopFsNotifyChangeQueueHead) + { + ChangeEntry = CONTAINING_RECORD(ListEntry, + FS_CHANGE_NOTIFY_ENTRY, + FsChangeNotifyList); + + /* If buffer is still big enough */ + if (ListSize < MaximumSize) + { + /* Reference the driver object */ + ObReferenceObject(ChangeEntry->DriverObject); + /* And pass it to the caller */ + DriverObjectList[ListSize] = ChangeEntry->DriverObject; + } + else + { + Status = STATUS_BUFFER_TOO_SMALL; + } + + /* Increase size counter */ + ListSize++; + + /* Go to the next entry */ + ListEntry = ListEntry->Flink; + } + + /* Return list size */ + *ActualNumberDriverObjects = ListSize; + + /* Release the FS lock */ + ExReleaseResourceLite(&IopDatabaseResource); + KeLeaveCriticalRegion(); + + return Status; } /* @@ -669,20 +878,21 @@ IoVerifyVolume(IN PDEVICE_OBJECT DeviceObject, PIO_STACK_LOCATION StackPtr; KEVENT Event; PIRP Irp; - NTSTATUS Status = STATUS_SUCCESS, VpbStatus; + NTSTATUS Status, VpbStatus; PDEVICE_OBJECT FileSystemDeviceObject; PVPB Vpb, NewVpb; BOOLEAN WasNotMounted = TRUE; /* Wait on the device lock */ - KeWaitForSingleObject(&DeviceObject->DeviceLock, - Executive, - KernelMode, - FALSE, - NULL); + Status = KeWaitForSingleObject(&DeviceObject->DeviceLock, + Executive, + KernelMode, + FALSE, + NULL); + ASSERT(Status == STATUS_SUCCESS); /* Reference the VPB */ - if (IopReferenceVpbForVerify(DeviceObject, &FileSystemDeviceObject, &Vpb)) + if (IopReferenceVerifyVpb(DeviceObject, &FileSystemDeviceObject, &Vpb)) { /* Initialize the event */ KeInitializeEvent(&Event, NotificationEvent, FALSE); @@ -698,7 +908,11 @@ IoVerifyVolume(IN PDEVICE_OBJECT DeviceObject, /* Allocate the IRP */ Irp = IoAllocateIrp(FileSystemDeviceObject->StackSize, FALSE); - if (!Irp) return STATUS_INSUFFICIENT_RESOURCES; + if (!Irp) + { + Status = STATUS_INSUFFICIENT_RESOURCES; + goto Release; + } /* Set it up */ Irp->UserIosb = &IoStatusBlock; @@ -726,28 +940,37 @@ IoVerifyVolume(IN PDEVICE_OBJECT DeviceObject, } /* Dereference the VPB */ - IopDereferenceVpb(Vpb); + IopDereferenceVpbAndFree(Vpb); } /* Check if we had the wrong volume or didn't mount at all */ - if ((Status == STATUS_WRONG_VOLUME) || (WasNotMounted)) + if (Status == STATUS_WRONG_VOLUME) { /* Create a VPB */ VpbStatus = IopCreateVpb(DeviceObject); if (NT_SUCCESS(VpbStatus)) { + PoVolumeDevice(DeviceObject); + /* Mount it */ VpbStatus = IopMountVolume(DeviceObject, AllowRawMount, TRUE, FALSE, &NewVpb); + + /* If we got a new VPB, dereference it */ + if (NewVpb) + { + IopInterlockedDecrementUlong(LockQueueIoVpbLock, &NewVpb->ReferenceCount); + } } /* If we failed, remove the verify flag */ if (!NT_SUCCESS(VpbStatus)) DeviceObject->Flags &= ~DO_VERIFY_VOLUME; } +Release: /* Signal the device lock and return */ KeSetEvent(&DeviceObject->DeviceLock, IO_NO_INCREMENT, FALSE); return Status; @@ -765,28 +988,28 @@ IoRegisterFileSystem(IN PDEVICE_OBJECT DeviceObject) /* Acquire the FS lock */ KeEnterCriticalRegion(); - ExAcquireResourceExclusiveLite(&FileSystemListLock, TRUE); + ExAcquireResourceExclusiveLite(&IopDatabaseResource, TRUE); /* Check what kind of FS this is */ if (DeviceObject->DeviceType == FILE_DEVICE_DISK_FILE_SYSTEM) { /* Use the disk list */ - FsList = &IopDiskFsListHead; + FsList = &IopDiskFileSystemQueueHead; } else if (DeviceObject->DeviceType == FILE_DEVICE_NETWORK_FILE_SYSTEM) { /* Use the network device list */ - FsList = &IopNetworkFsListHead; + FsList = &IopNetworkFileSystemQueueHead; } else if (DeviceObject->DeviceType == FILE_DEVICE_CD_ROM_FILE_SYSTEM) { /* Use the CD-ROM list */ - FsList = &IopCdRomFsListHead; + FsList = &IopCdRomFileSystemQueueHead; } else if (DeviceObject->DeviceType == FILE_DEVICE_TAPE_FILE_SYSTEM) { /* Use the tape list */ - FsList = &IopTapeFsListHead; + FsList = &IopTapeFileSystemQueueHead; } /* Make sure that we have a valid list */ @@ -805,15 +1028,21 @@ IoRegisterFileSystem(IN PDEVICE_OBJECT DeviceObject) } } + /* Update operations counter */ + IopFsRegistrationOps++; + /* Clear the initializing flag */ DeviceObject->Flags &= ~DO_DEVICE_INITIALIZING; - /* Release the FS Lock */ - ExReleaseResourceLite(&FileSystemListLock); - KeLeaveCriticalRegion(); - /* Notify file systems of the addition */ IopNotifyFileSystemChange(DeviceObject, TRUE); + + /* Release the FS Lock */ + ExReleaseResourceLite(&IopDatabaseResource); + KeLeaveCriticalRegion(); + + /* Ensure driver won't be unloaded */ + IopInterlockedIncrementUlong(LockQueueIoDatabaseLock, (PULONG)&DeviceObject->ReferenceCount); } /* @@ -827,17 +1056,26 @@ IoUnregisterFileSystem(IN PDEVICE_OBJECT DeviceObject) /* Acquire the FS lock */ KeEnterCriticalRegion(); - ExAcquireResourceExclusiveLite(&FileSystemListLock, TRUE); + ExAcquireResourceExclusiveLite(&IopDatabaseResource, TRUE); - /* Simply remove the entry */ - RemoveEntryList(&DeviceObject->Queue.ListEntry); + /* Simply remove the entry - if queued */ + if (DeviceObject->Queue.ListEntry.Flink) + { + RemoveEntryList(&DeviceObject->Queue.ListEntry); + } /* And notify all registered file systems */ IopNotifyFileSystemChange(DeviceObject, FALSE); + /* Update operations counter */ + IopFsRegistrationOps++; + /* Then release the lock */ - ExReleaseResourceLite(&FileSystemListLock); + ExReleaseResourceLite(&IopDatabaseResource); KeLeaveCriticalRegion(); + + /* Decrease reference count to allow unload */ + IopInterlockedDecrementUlong(LockQueueIoDatabaseLock, (PULONG)&DeviceObject->ReferenceCount); } /* @@ -846,25 +1084,62 @@ IoUnregisterFileSystem(IN PDEVICE_OBJECT DeviceObject) NTSTATUS NTAPI IoRegisterFsRegistrationChange(IN PDRIVER_OBJECT DriverObject, - IN PDRIVER_FS_NOTIFICATION FSDNotificationProc) + IN PDRIVER_FS_NOTIFICATION DriverNotificationRoutine) { PFS_CHANGE_NOTIFY_ENTRY Entry; PAGED_CODE(); + /* Acquire the list lock */ + KeEnterCriticalRegion(); + ExAcquireResourceExclusiveLite(&IopDatabaseResource, TRUE); + + /* Check if that driver is already registered (successive calls) + * See MSDN note: http://msdn.microsoft.com/en-us/library/ff548499%28v=vs.85%29.aspx + */ + if (!IsListEmpty(&IopFsNotifyChangeQueueHead)) + { + Entry = CONTAINING_RECORD(IopFsNotifyChangeQueueHead.Blink, + FS_CHANGE_NOTIFY_ENTRY, + FsChangeNotifyList); + + if (Entry->DriverObject == DriverObject && + Entry->FSDNotificationProc == DriverNotificationRoutine) + { + /* Release the lock */ + ExReleaseResourceLite(&IopDatabaseResource); + + return STATUS_DEVICE_ALREADY_ATTACHED; + } + } + /* Allocate a notification entry */ Entry = ExAllocatePoolWithTag(PagedPool, sizeof(FS_CHANGE_NOTIFY_ENTRY), TAG_FS_CHANGE_NOTIFY); - if (!Entry) return(STATUS_INSUFFICIENT_RESOURCES); + if (!Entry) + { + /* Release the lock */ + ExReleaseResourceLite(&IopDatabaseResource); + + return STATUS_INSUFFICIENT_RESOURCES; + } /* Save the driver object and notification routine */ Entry->DriverObject = DriverObject; - Entry->FSDNotificationProc = FSDNotificationProc; + Entry->FSDNotificationProc = DriverNotificationRoutine; /* Insert it into the notification list */ - KeAcquireGuardedMutex(&FsChangeNotifyListLock); - InsertTailList(&FsChangeNotifyListHead, &Entry->FsChangeNotifyList); - KeReleaseGuardedMutex(&FsChangeNotifyListLock); + InsertTailList(&IopFsNotifyChangeQueueHead, &Entry->FsChangeNotifyList); + + /* Start notifying all already present FS */ + IopNotifyAlreadyRegisteredFileSystems(&IopNetworkFileSystemQueueHead, DriverNotificationRoutine, FALSE); + IopNotifyAlreadyRegisteredFileSystems(&IopCdRomFileSystemQueueHead, DriverNotificationRoutine, TRUE); + IopNotifyAlreadyRegisteredFileSystems(&IopDiskFileSystemQueueHead, DriverNotificationRoutine, TRUE); + IopNotifyAlreadyRegisteredFileSystems(&IopTapeFileSystemQueueHead, DriverNotificationRoutine, TRUE); + + /* Release the lock */ + ExReleaseResourceLite(&IopDatabaseResource); + KeLeaveCriticalRegion(); /* Reference the driver */ ObReferenceObject(DriverObject); @@ -884,11 +1159,12 @@ IoUnregisterFsRegistrationChange(IN PDRIVER_OBJECT DriverObject, PAGED_CODE(); /* Acquire the list lock */ - KeAcquireGuardedMutex(&FsChangeNotifyListLock); + KeEnterCriticalRegion(); + ExAcquireResourceExclusiveLite(&IopDatabaseResource, TRUE); /* Loop the list */ - NextEntry = FsChangeNotifyListHead.Flink; - while (NextEntry != &FsChangeNotifyListHead) + NextEntry = IopFsNotifyChangeQueueHead.Flink; + while (NextEntry != &IopFsNotifyChangeQueueHead) { /* Get the entry */ ChangeEntry = CONTAINING_RECORD(NextEntry, @@ -910,7 +1186,10 @@ IoUnregisterFsRegistrationChange(IN PDRIVER_OBJECT DriverObject, } /* Release the lock and dereference the driver */ - KeReleaseGuardedMutex(&FsChangeNotifyListLock); + ExReleaseResourceLite(&IopDatabaseResource); + KeLeaveCriticalRegion(); + + /* Dereference the driver */ ObDereferenceObject(DriverObject); } diff --git a/ntoskrnl/io/pnpmgr/plugplay.c b/ntoskrnl/io/pnpmgr/plugplay.c index 9c01544bcbf..bd52f4d4a87 100644 --- a/ntoskrnl/io/pnpmgr/plugplay.c +++ b/ntoskrnl/io/pnpmgr/plugplay.c @@ -551,10 +551,20 @@ IopResetDevice(PPLUGPLAY_CONTROL_RESET_DEVICE_DATA ResetDeviceData) DeviceNode = IopGetDeviceNode(DeviceObject); - /* FIXME: we should stop the device, before starting it again */ +#if 0 + /* Remove the device */ + if (DeviceNode->Flags & DNF_ENUMERATED) + { + Status = IopRemoveDevice(DeviceNode); + if (!NT_SUCCESS(Status)) + { + DPRINT1("WARNING: Ignoring failed IopRemoveDevice() for %wZ (likely a driver bug)\n", &DeviceNode->InstancePath); + } + } +#endif - /* Start the device */ - IopDeviceNodeClearFlag(DeviceNode, DNF_DISABLED); + /* Reenumerate the device and its children */ + DeviceNode->Flags &= ~DNF_DISABLED; Status = IopActionConfigureChildServices(DeviceNode, DeviceNode->Parent); if (NT_SUCCESS(Status)) diff --git a/ntoskrnl/io/pnpmgr/pnpmgr.c b/ntoskrnl/io/pnpmgr/pnpmgr.c index 0d8a1995d82..f8bb18b478d 100644 --- a/ntoskrnl/io/pnpmgr/pnpmgr.c +++ b/ntoskrnl/io/pnpmgr/pnpmgr.c @@ -13,8 +13,6 @@ #define NDEBUG #include -//#define ENABLE_ACPI - /* GLOBALS *******************************************************************/ PDEVICE_NODE IopRootDeviceNode; @@ -45,6 +43,12 @@ IopCreateDeviceKeyPath(IN PCUNICODE_STRING RegistryPath, IN ULONG CreateOptions, OUT PHANDLE Handle); +VOID +IopCancelPrepareDeviceForRemoval(PDEVICE_OBJECT DeviceObject); + +NTSTATUS +IopPrepareDeviceForRemoval(PDEVICE_OBJECT DeviceObject); + PDEVICE_NODE FASTCALL IopGetDeviceNode(PDEVICE_OBJECT DeviceObject) @@ -89,6 +93,10 @@ IopInitializeDevice(PDEVICE_NODE DeviceNode, DriverObject, DeviceNode->PhysicalDeviceObject); if (!NT_SUCCESS(Status)) { + DPRINT1("%wZ->AddDevice(%wZ) failed with status 0x%x\n", + &DriverObject->DriverName, + &DeviceNode->InstancePath, + Status); IopDeviceNodeSetFlag(DeviceNode, DNF_DISABLED); return Status; } @@ -125,6 +133,90 @@ IopInitializeDevice(PDEVICE_NODE DeviceNode, return STATUS_SUCCESS; } +static +NTSTATUS +NTAPI +IopSendEject(IN PDEVICE_OBJECT DeviceObject) +{ + IO_STACK_LOCATION Stack; + PVOID Dummy; + + RtlZeroMemory(&Stack, sizeof(IO_STACK_LOCATION)); + Stack.MajorFunction = IRP_MJ_PNP; + Stack.MinorFunction = IRP_MN_EJECT; + + return IopSynchronousCall(DeviceObject, &Stack, &Dummy); +} + +static +VOID +NTAPI +IopSendSurpriseRemoval(IN PDEVICE_OBJECT DeviceObject) +{ + IO_STACK_LOCATION Stack; + PVOID Dummy; + + RtlZeroMemory(&Stack, sizeof(IO_STACK_LOCATION)); + Stack.MajorFunction = IRP_MJ_PNP; + Stack.MinorFunction = IRP_MN_SURPRISE_REMOVAL; + + /* Drivers should never fail a IRP_MN_SURPRISE_REMOVAL request */ + IopSynchronousCall(DeviceObject, &Stack, &Dummy); +} + +static +NTSTATUS +NTAPI +IopQueryRemoveDevice(IN PDEVICE_OBJECT DeviceObject) +{ + PDEVICE_NODE DeviceNode = IopGetDeviceNode(DeviceObject); + IO_STACK_LOCATION Stack; + PVOID Dummy; + NTSTATUS Status; + + ASSERT(DeviceNode); + + IopQueueTargetDeviceEvent(&GUID_DEVICE_REMOVE_PENDING, + &DeviceNode->InstancePath); + + RtlZeroMemory(&Stack, sizeof(IO_STACK_LOCATION)); + Stack.MajorFunction = IRP_MJ_PNP; + Stack.MinorFunction = IRP_MN_QUERY_REMOVE_DEVICE; + + Status = IopSynchronousCall(DeviceObject, &Stack, &Dummy); + + IopNotifyPlugPlayNotification(DeviceObject, + EventCategoryTargetDeviceChange, + &GUID_TARGET_DEVICE_QUERY_REMOVE, + NULL, + NULL); + + if (!NT_SUCCESS(Status)) + { + DPRINT1("Removal vetoed by %wZ\n", &DeviceNode->InstancePath); + IopQueueTargetDeviceEvent(&GUID_DEVICE_REMOVAL_VETOED, + &DeviceNode->InstancePath); + } + + return Status; +} + +static +NTSTATUS +NTAPI +IopQueryStopDevice(IN PDEVICE_OBJECT DeviceObject) +{ + IO_STACK_LOCATION Stack; + PVOID Dummy; + + RtlZeroMemory(&Stack, sizeof(IO_STACK_LOCATION)); + Stack.MajorFunction = IRP_MJ_PNP; + Stack.MinorFunction = IRP_MN_QUERY_STOP_DEVICE; + + return IopSynchronousCall(DeviceObject, &Stack, &Dummy); +} + +static VOID NTAPI IopSendRemoveDevice(IN PDEVICE_OBJECT DeviceObject) @@ -138,6 +230,50 @@ IopSendRemoveDevice(IN PDEVICE_OBJECT DeviceObject) /* Drivers should never fail a IRP_MN_REMOVE_DEVICE request */ IopSynchronousCall(DeviceObject, &Stack, &Dummy); + + IopNotifyPlugPlayNotification(DeviceObject, + EventCategoryTargetDeviceChange, + &GUID_TARGET_DEVICE_REMOVE_COMPLETE, + NULL, + NULL); +} + +static +VOID +NTAPI +IopCancelRemoveDevice(IN PDEVICE_OBJECT DeviceObject) +{ + IO_STACK_LOCATION Stack; + PVOID Dummy; + + RtlZeroMemory(&Stack, sizeof(IO_STACK_LOCATION)); + Stack.MajorFunction = IRP_MJ_PNP; + Stack.MinorFunction = IRP_MN_CANCEL_REMOVE_DEVICE; + + /* Drivers should never fail a IRP_MN_CANCEL_REMOVE_DEVICE request */ + IopSynchronousCall(DeviceObject, &Stack, &Dummy); + + IopNotifyPlugPlayNotification(DeviceObject, + EventCategoryTargetDeviceChange, + &GUID_TARGET_DEVICE_REMOVE_CANCELLED, + NULL, + NULL); +} + +static +VOID +NTAPI +IopSendStopDevice(IN PDEVICE_OBJECT DeviceObject) +{ + IO_STACK_LOCATION Stack; + PVOID Dummy; + + RtlZeroMemory(&Stack, sizeof(IO_STACK_LOCATION)); + Stack.MajorFunction = IRP_MJ_PNP; + Stack.MinorFunction = IRP_MN_STOP_DEVICE; + + /* Drivers should never fail a IRP_MN_STOP_DEVICE request */ + IopSynchronousCall(DeviceObject, &Stack, &Dummy); } VOID @@ -148,44 +284,51 @@ IopStartDevice2(IN PDEVICE_OBJECT DeviceObject) PDEVICE_NODE DeviceNode; NTSTATUS Status; PVOID Dummy; + DEVICE_CAPABILITIES DeviceCapabilities; /* Get the device node */ DeviceNode = IopGetDeviceNode(DeviceObject); + ASSERT(!(DeviceNode->Flags & DNF_DISABLED)); + /* Build the I/O stack locaiton */ RtlZeroMemory(&Stack, sizeof(IO_STACK_LOCATION)); Stack.MajorFunction = IRP_MJ_PNP; Stack.MinorFunction = IRP_MN_START_DEVICE; - /* Check if we didn't already report the resources */ - if (!(DeviceNode->Flags & DNF_RESOURCE_REPORTED)) - { - /* Report them */ - Stack.Parameters.StartDevice.AllocatedResources = - DeviceNode->ResourceList; - Stack.Parameters.StartDevice.AllocatedResourcesTranslated = - DeviceNode->ResourceListTranslated; - } - - /* I don't think we set this flag yet */ - ASSERT(!(DeviceNode->Flags & DNF_STOPPED)); - + Stack.Parameters.StartDevice.AllocatedResources = + DeviceNode->ResourceList; + Stack.Parameters.StartDevice.AllocatedResourcesTranslated = + DeviceNode->ResourceListTranslated; + /* Do the call */ Status = IopSynchronousCall(DeviceObject, &Stack, &Dummy); if (!NT_SUCCESS(Status)) { /* Send an IRP_MN_REMOVE_DEVICE request */ - IopSendRemoveDevice(DeviceObject); + IopRemoveDevice(DeviceNode); /* Set the appropriate flag */ DeviceNode->Flags |= DNF_START_FAILED; - DPRINT1("Warning: PnP Start failed (%wZ)\n", &DeviceNode->InstancePath); + DPRINT1("Warning: PnP Start failed (%wZ) [Status: 0x%x]\n", &DeviceNode->InstancePath, Status); return; } + DPRINT("Sending IRP_MN_QUERY_CAPABILITIES to device stack (after start)\n"); + + Status = IopQueryDeviceCapabilities(DeviceNode, &DeviceCapabilities); + if (!NT_SUCCESS(Status)) + { + DPRINT("IopInitiatePnpIrp() failed (Status 0x%08lx)\n", Status); + } + + /* Invalidate device state so IRP_MN_QUERY_PNP_DEVICE_STATE is sent */ + IoInvalidateDeviceState(DeviceObject); + /* Otherwise, mark us as started */ DeviceNode->Flags |= DNF_STARTED; + DeviceNode->Flags &= ~DNF_STOPPED; /* We now need enumeration */ DeviceNode->Flags |= DNF_NEED_ENUMERATION_ONLY; @@ -204,9 +347,6 @@ IopStartAndEnumerateDevice(IN PDEVICE_NODE DeviceNode) ASSERT((DeviceNode->Flags & (DNF_RESOURCE_ASSIGNED | DNF_RESOURCE_REPORTED | DNF_NO_RESOURCE_REQUIRED))); - ASSERT((!(DeviceNode->Flags & (DNF_HAS_PROBLEM | - DNF_STARTED | - DNF_START_REQUEST_PENDING)))); /* Get the device object */ DeviceObject = DeviceNode->PhysicalDeviceObject; @@ -234,7 +374,6 @@ IopStartAndEnumerateDevice(IN PDEVICE_NODE DeviceNode) { /* Enumerate us */ IoSynchronousInvalidateDeviceRelations(DeviceObject, BusRelations); - IopDeviceNodeClearFlag(DeviceNode, DNF_NEED_ENUMERATION_ONLY); Status = STATUS_SUCCESS; } else @@ -247,6 +386,28 @@ IopStartAndEnumerateDevice(IN PDEVICE_NODE DeviceNode) return Status; } +NTSTATUS +IopStopDevice( + PDEVICE_NODE DeviceNode) +{ + NTSTATUS Status; + + DPRINT("Stopping device: %wZ\n", &DeviceNode->InstancePath); + + Status = IopQueryStopDevice(DeviceNode->PhysicalDeviceObject); + if (NT_SUCCESS(Status)) + { + IopSendStopDevice(DeviceNode->PhysicalDeviceObject); + + DeviceNode->Flags &= ~(DNF_STARTED | DNF_START_REQUEST_PENDING); + DeviceNode->Flags |= DNF_STOPPED; + + return STATUS_SUCCESS; + } + + return Status; +} + NTSTATUS IopStartDevice( PDEVICE_NODE DeviceNode) @@ -256,11 +417,8 @@ IopStartDevice( UNICODE_STRING KeyName; OBJECT_ATTRIBUTES ObjectAttributes; - if (DeviceNode->Flags & (DNF_STARTED | DNF_START_REQUEST_PENDING)) - { - /* Nothing to do here */ + if (DeviceNode->Flags & DNF_DISABLED) return STATUS_SUCCESS; - } Status = IopAssignDeviceResources(DeviceNode); if (!NT_SUCCESS(Status)) @@ -307,6 +465,9 @@ IopQueryDeviceCapabilities(PDEVICE_NODE DeviceNode, { IO_STATUS_BLOCK StatusBlock; IO_STACK_LOCATION Stack; + NTSTATUS Status; + HANDLE InstanceKey; + UNICODE_STRING ValueName; /* Set up the Header */ RtlZeroMemory(DeviceCaps, sizeof(DEVICE_CAPABILITIES)); @@ -320,10 +481,49 @@ IopQueryDeviceCapabilities(PDEVICE_NODE DeviceNode, Stack.Parameters.DeviceCapabilities.Capabilities = DeviceCaps; /* Send the IRP */ - return IopInitiatePnpIrp(DeviceNode->PhysicalDeviceObject, - &StatusBlock, - IRP_MN_QUERY_CAPABILITIES, - &Stack); + Status = IopInitiatePnpIrp(DeviceNode->PhysicalDeviceObject, + &StatusBlock, + IRP_MN_QUERY_CAPABILITIES, + &Stack); + if (!NT_SUCCESS(Status)) + { + DPRINT1("IRP_MN_QUERY_CAPABILITIES failed with status 0x%x\n", Status); + return Status; + } + + DeviceNode->CapabilityFlags = *(PULONG)((ULONG_PTR)&DeviceCaps->Version + sizeof(DeviceCaps->Version)); + + if (DeviceCaps->NoDisplayInUI) + DeviceNode->UserFlags |= DNUF_DONT_SHOW_IN_UI; + else + DeviceNode->UserFlags &= ~DNUF_DONT_SHOW_IN_UI; + + Status = IopCreateDeviceKeyPath(&DeviceNode->InstancePath, 0, &InstanceKey); + if (NT_SUCCESS(Status)) + { + /* Set 'Capabilities' value */ + RtlInitUnicodeString(&ValueName, L"Capabilities"); + Status = ZwSetValueKey(InstanceKey, + &ValueName, + 0, + REG_DWORD, + (PVOID)&DeviceNode->CapabilityFlags, + sizeof(ULONG)); + + /* Set 'UINumber' value */ + if (DeviceCaps->UINumber != MAXULONG) + { + RtlInitUnicodeString(&ValueName, L"UINumber"); + Status = ZwSetValueKey(InstanceKey, + &ValueName, + 0, + REG_DWORD, + &DeviceCaps->UINumber, + sizeof(ULONG)); + } + } + + return Status; } static VOID NTAPI @@ -685,6 +885,14 @@ IopSynchronousCall(IN PDEVICE_OBJECT DeviceObject, Irp->IoStatus.Status = IoStatusBlock.Status = STATUS_NOT_SUPPORTED; Irp->IoStatus.Information = IoStatusBlock.Information = 0; + /* Special case for IRP_MN_FILTER_RESOURCE_REQUIREMENTS */ + if (IoStackLocation->MinorFunction == IRP_MN_FILTER_RESOURCE_REQUIREMENTS) + { + /* Copy the resource requirements list into the IOSB */ + Irp->IoStatus.Information = + IoStatusBlock.Information = (ULONG_PTR)IoStackLocation->Parameters.FilterResourceRequirements.IoResourceRequirementList; + } + /* Initialize the event */ KeInitializeEvent(&Event, SynchronizationEvent, FALSE); @@ -1192,6 +1400,13 @@ IopActionInterrogateDeviceStack(PDEVICE_NODE DeviceNode, return STATUS_UNSUCCESSFUL; } + /* Skip processing if it was already completed before */ + if (DeviceNode->Flags & DNF_PROCESSED) + { + /* Nothing to do */ + return STATUS_SUCCESS; + } + /* Get Locale ID */ Status = ZwQueryDefaultLocale(FALSE, &LocaleId); if (!NT_SUCCESS(Status)) @@ -1227,7 +1442,7 @@ IopActionInterrogateDeviceStack(PDEVICE_NODE DeviceNode, DPRINT("IopInitiatePnpIrp() failed (Status %x)\n", Status); } - DPRINT("Sending IRP_MN_QUERY_CAPABILITIES to device stack\n"); + DPRINT("Sending IRP_MN_QUERY_CAPABILITIES to device stack (after enumeration)\n"); Status = IopQueryDeviceCapabilities(DeviceNode, &DeviceCapabilities); if (!NT_SUCCESS(Status)) @@ -1235,7 +1450,15 @@ IopActionInterrogateDeviceStack(PDEVICE_NODE DeviceNode, DPRINT("IopInitiatePnpIrp() failed (Status 0x%08lx)\n", Status); } - DeviceNode->CapabilityFlags = *(PULONG)((ULONG_PTR)&DeviceCapabilities + 4); + /* This bit is only check after enumeration */ + if (DeviceCapabilities.HardwareDisabled) + { + /* FIXME: Cleanup device */ + DeviceNode->Flags |= DNF_DISABLED; + return STATUS_SUCCESS; + } + else + DeviceNode->Flags &= ~DNF_DISABLED; if (!DeviceCapabilities.UniqueID) { @@ -1297,29 +1520,6 @@ IopActionInterrogateDeviceStack(PDEVICE_NODE DeviceNode, DPRINT1("Failed to create the instance key! (Status %lx)\n", Status); } - { - /* Set 'Capabilities' value */ - RtlInitUnicodeString(&ValueName, L"Capabilities"); - Status = ZwSetValueKey(InstanceKey, - &ValueName, - 0, - REG_DWORD, - (PVOID)&DeviceNode->CapabilityFlags, - sizeof(ULONG)); - - /* Set 'UINumber' value */ - if (DeviceCapabilities.UINumber != MAXULONG) - { - RtlInitUnicodeString(&ValueName, L"UINumber"); - Status = ZwSetValueKey(InstanceKey, - &ValueName, - 0, - REG_DWORD, - &DeviceCapabilities.UINumber, - sizeof(ULONG)); - } - } - DPRINT("Sending IRP_MN_QUERY_ID.BusQueryHardwareIDs to device stack\n"); Stack.Parameters.QueryId.IdType = BusQueryHardwareIDs; @@ -1566,6 +1766,44 @@ IopActionInterrogateDeviceStack(PDEVICE_NODE DeviceNode, return STATUS_SUCCESS; } +static +VOID +IopHandleDeviceRemoval( + IN PDEVICE_NODE DeviceNode, + IN PDEVICE_RELATIONS DeviceRelations) +{ + PDEVICE_NODE Child = DeviceNode->Child, NextChild; + ULONG i; + BOOLEAN Found; + + while (Child != NULL) + { + NextChild = Child->Sibling; + Found = FALSE; + + for (i = 0; DeviceRelations && i < DeviceRelations->Count; i++) + { + if (IopGetDeviceNode(DeviceRelations->Objects[i]) == Child) + { + Found = TRUE; + break; + } + } + + if (!Found) + { + IopSendSurpriseRemoval(Child->PhysicalDeviceObject); + + /* Tell the user-mode PnP manager that a device was removed */ + IopQueueTargetDeviceEvent(&GUID_DEVICE_SURPRISE_REMOVAL, + &Child->InstancePath); + + IopSendRemoveDevice(Child->PhysicalDeviceObject); + } + + Child = NextChild; + } +} NTSTATUS IopEnumerateDevice( @@ -1583,11 +1821,14 @@ IopEnumerateDevice( DPRINT("DeviceObject 0x%p\n", DeviceObject); - DPRINT("Sending GUID_DEVICE_ARRIVAL\n"); + if (DeviceNode->Flags & DNF_NEED_ENUMERATION_ONLY) + { + DeviceNode->Flags &= ~DNF_NEED_ENUMERATION_ONLY; - /* Report the device to the user-mode pnp manager */ - IopQueueTargetDeviceEvent(&GUID_DEVICE_ARRIVAL, - &DeviceNode->InstancePath); + DPRINT("Sending GUID_DEVICE_ARRIVAL\n"); + IopQueueTargetDeviceEvent(&GUID_DEVICE_ARRIVAL, + &DeviceNode->InstancePath); + } DPRINT("Sending IRP_MN_QUERY_DEVICE_RELATIONS to device stack\n"); @@ -1606,10 +1847,18 @@ IopEnumerateDevice( DeviceRelations = (PDEVICE_RELATIONS)IoStatusBlock.Information; + /* + * Send removal IRPs for devices that have disappeared + * NOTE: This code handles the case where no relations are specified + */ + IopHandleDeviceRemoval(DeviceNode, DeviceRelations); + + /* Now we bail if nothing was returned */ if (!DeviceRelations) { + /* We're all done */ DPRINT("No PDOs\n"); - return STATUS_UNSUCCESSFUL; + return STATUS_SUCCESS; } DPRINT("Got %u PDOs\n", DeviceRelations->Count); @@ -1757,7 +2006,7 @@ IopActionConfigureChildServices(PDEVICE_NODE DeviceNode, return STATUS_UNSUCCESSFUL; } - if (!IopDeviceNodeHasFlag(DeviceNode, DNF_DISABLED)) + if (!(DeviceNode->Flags & (DNF_DISABLED | DNF_STARTED | DNF_ADDED))) { WCHAR RegKeyBuffer[MAX_PATH]; UNICODE_STRING RegKey; @@ -1880,7 +2129,7 @@ IopActionInitChildServices(PDEVICE_NODE DeviceNode, * Make sure this device node is a direct child of the parent device node * that is given as an argument */ -#if 0 + if (DeviceNode->Parent != ParentDeviceNode) { /* @@ -1889,7 +2138,7 @@ IopActionInitChildServices(PDEVICE_NODE DeviceNode, DPRINT("Stop\n"); return STATUS_UNSUCCESSFUL; } -#endif + if (IopDeviceNodeHasFlag(DeviceNode, DNF_STARTED) || IopDeviceNodeHasFlag(DeviceNode, DNF_ADDED) || IopDeviceNodeHasFlag(DeviceNode, DNF_DISABLED)) @@ -2460,143 +2709,73 @@ cleanup: } static BOOLEAN INIT_FUNCTION -IopIsAcpiComputer(VOID) +IopIsFirmwareMapperDisabled(VOID) { -#ifndef ENABLE_ACPI - return FALSE; -#else - UNICODE_STRING MultiKeyPathU = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\HARDWARE\\DESCRIPTION\\System\\MultifunctionAdapter"); - UNICODE_STRING IdentifierU = RTL_CONSTANT_STRING(L"Identifier"); - UNICODE_STRING AcpiBiosIdentifier = RTL_CONSTANT_STRING(L"ACPI BIOS"); + UNICODE_STRING KeyPathU = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\SYSTEM\\CURRENTCONTROLSET\\Control\\Pnp"); + UNICODE_STRING KeyNameU = RTL_CONSTANT_STRING(L"DisableFirmwareMapper"); OBJECT_ATTRIBUTES ObjectAttributes; - PKEY_BASIC_INFORMATION pDeviceInformation = NULL; - ULONG DeviceInfoLength = sizeof(KEY_BASIC_INFORMATION) + 50 * sizeof(WCHAR); - PKEY_VALUE_PARTIAL_INFORMATION pValueInformation = NULL; - ULONG ValueInfoLength = sizeof(KEY_VALUE_PARTIAL_INFORMATION) + 50 * sizeof(WCHAR); - ULONG RequiredSize; - ULONG IndexDevice = 0; - UNICODE_STRING DeviceName, ValueName; - HANDLE hDevicesKey = NULL; - HANDLE hDeviceKey = NULL; + HANDLE hPnpKey; + PKEY_VALUE_PARTIAL_INFORMATION KeyInformation; + ULONG DesiredLength, Length, KeyValue; NTSTATUS Status; - BOOLEAN ret = FALSE; - InitializeObjectAttributes(&ObjectAttributes, &MultiKeyPathU, OBJ_KERNEL_HANDLE | OBJ_CASE_INSENSITIVE, NULL, NULL); - Status = ZwOpenKey(&hDevicesKey, KEY_ENUMERATE_SUB_KEYS, &ObjectAttributes); - if (!NT_SUCCESS(Status)) + InitializeObjectAttributes(&ObjectAttributes, &KeyPathU, OBJ_KERNEL_HANDLE | OBJ_CASE_INSENSITIVE, NULL, NULL); + Status = ZwOpenKey(&hPnpKey, KEY_QUERY_VALUE, &ObjectAttributes); + if (NT_SUCCESS(Status)) { - DPRINT("ZwOpenKey() failed with status 0x%08lx\n", Status); - goto cleanup; + Status = ZwQueryValueKey(hPnpKey, + &KeyNameU, + KeyValuePartialInformation, + NULL, + 0, + &DesiredLength); + if ((Status == STATUS_BUFFER_TOO_SMALL) || + (Status == STATUS_BUFFER_OVERFLOW)) + { + Length = DesiredLength; + KeyInformation = ExAllocatePool(PagedPool, Length); + if (KeyInformation) + { + Status = ZwQueryValueKey(hPnpKey, + &KeyNameU, + KeyValuePartialInformation, + KeyInformation, + Length, + &DesiredLength); + if (NT_SUCCESS(Status) && KeyInformation->DataLength == sizeof(ULONG)) + { + KeyValue = (ULONG)(*KeyInformation->Data); + } + else + { + DPRINT1("ZwQueryValueKey(%wZ%wZ) failed\n", &KeyPathU, &KeyNameU); + KeyValue = 0; + } + + ExFreePool(KeyInformation); + } + else + { + DPRINT1("Failed to allocate memory for registry query\n"); + KeyValue = 0; + } + } + else + { + DPRINT1("ZwQueryValueKey(%wZ%wZ) failed with status 0x%08lx\n", &KeyPathU, &KeyNameU, Status); + KeyValue = 0; + } + + ZwClose(hPnpKey); + } + else + { + DPRINT1("ZwOpenKey(%wZ) failed with status 0x%08lx\n", &KeyPathU, Status); } - pDeviceInformation = ExAllocatePool(PagedPool, DeviceInfoLength); - if (!pDeviceInformation) - { - DPRINT("ExAllocatePool() failed\n"); - Status = STATUS_NO_MEMORY; - goto cleanup; - } + DPRINT1("Firmware mapper is %s\n", KeyValue != 0 ? "disabled" : "enabled"); - pValueInformation = ExAllocatePool(PagedPool, ValueInfoLength); - if (!pDeviceInformation) - { - DPRINT("ExAllocatePool() failed\n"); - Status = STATUS_NO_MEMORY; - goto cleanup; - } - - while (TRUE) - { - Status = ZwEnumerateKey(hDevicesKey, IndexDevice, KeyBasicInformation, pDeviceInformation, DeviceInfoLength, &RequiredSize); - if (Status == STATUS_NO_MORE_ENTRIES) - break; - else if (Status == STATUS_BUFFER_OVERFLOW || Status == STATUS_BUFFER_TOO_SMALL) - { - ExFreePool(pDeviceInformation); - DeviceInfoLength = RequiredSize; - pDeviceInformation = ExAllocatePool(PagedPool, DeviceInfoLength); - if (!pDeviceInformation) - { - DPRINT("ExAllocatePool() failed\n"); - Status = STATUS_NO_MEMORY; - goto cleanup; - } - Status = ZwEnumerateKey(hDevicesKey, IndexDevice, KeyBasicInformation, pDeviceInformation, DeviceInfoLength, &RequiredSize); - } - if (!NT_SUCCESS(Status)) - { - DPRINT("ZwEnumerateKey() failed with status 0x%08lx\n", Status); - goto cleanup; - } - IndexDevice++; - - /* Open device key */ - DeviceName.Length = DeviceName.MaximumLength = pDeviceInformation->NameLength; - DeviceName.Buffer = pDeviceInformation->Name; - InitializeObjectAttributes(&ObjectAttributes, &DeviceName, OBJ_KERNEL_HANDLE, hDevicesKey, NULL); - Status = ZwOpenKey( - &hDeviceKey, - KEY_QUERY_VALUE, - &ObjectAttributes); - if (!NT_SUCCESS(Status)) - { - DPRINT("ZwOpenKey() failed with status 0x%08lx\n", Status); - goto cleanup; - } - - /* Read identifier */ - Status = ZwQueryValueKey(hDeviceKey, &IdentifierU, KeyValuePartialInformation, pValueInformation, ValueInfoLength, &RequiredSize); - if (Status == STATUS_BUFFER_OVERFLOW || Status == STATUS_BUFFER_TOO_SMALL) - { - ExFreePool(pValueInformation); - ValueInfoLength = RequiredSize; - pValueInformation = ExAllocatePool(PagedPool, ValueInfoLength); - if (!pValueInformation) - { - DPRINT("ExAllocatePool() failed\n"); - Status = STATUS_NO_MEMORY; - goto cleanup; - } - Status = ZwQueryValueKey(hDeviceKey, &IdentifierU, KeyValuePartialInformation, pValueInformation, ValueInfoLength, &RequiredSize); - } - if (!NT_SUCCESS(Status)) - { - DPRINT("ZwQueryValueKey() failed with status 0x%08lx\n", Status); - goto nextdevice; - } - else if (pValueInformation->Type != REG_SZ) - { - DPRINT("Wrong registry type: got 0x%lx, expected 0x%lx\n", pValueInformation->Type, REG_SZ); - goto nextdevice; - } - - ValueName.Length = ValueName.MaximumLength = pValueInformation->DataLength; - ValueName.Buffer = (PWCHAR)pValueInformation->Data; - if (ValueName.Length >= sizeof(WCHAR) && ValueName.Buffer[ValueName.Length / sizeof(WCHAR) - 1] == UNICODE_NULL) - ValueName.Length -= sizeof(WCHAR); - if (RtlCompareUnicodeString(&ValueName, &AcpiBiosIdentifier, FALSE) == 0) - { - DPRINT("Found ACPI BIOS\n"); - ret = TRUE; - goto cleanup; - } - -nextdevice: - ZwClose(hDeviceKey); - hDeviceKey = NULL; - } - -cleanup: - if (pDeviceInformation) - ExFreePool(pDeviceInformation); - if (pValueInformation) - ExFreePool(pValueInformation); - if (hDevicesKey) - ZwClose(hDevicesKey); - if (hDeviceKey) - ZwClose(hDeviceKey); - return ret; -#endif + return (KeyValue != 0) ? TRUE : FALSE; } NTSTATUS @@ -2607,17 +2786,9 @@ IopUpdateRootKey(VOID) UNICODE_STRING EnumU = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Enum"); UNICODE_STRING RootPathU = RTL_CONSTANT_STRING(L"Root"); UNICODE_STRING MultiKeyPathU = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\HARDWARE\\DESCRIPTION\\System\\MultifunctionAdapter"); - UNICODE_STRING DeviceDescU = RTL_CONSTANT_STRING(L"DeviceDesc"); - UNICODE_STRING HardwareIDU = RTL_CONSTANT_STRING(L"HardwareID"); - UNICODE_STRING LogConfU = RTL_CONSTANT_STRING(L"LogConf"); - UNICODE_STRING HalAcpiDevice = RTL_CONSTANT_STRING(L"ACPI_HAL"); - UNICODE_STRING HalAcpiId = RTL_CONSTANT_STRING(L"0000"); - UNICODE_STRING HalAcpiDeviceDesc = RTL_CONSTANT_STRING(L"HAL ACPI"); - UNICODE_STRING HalAcpiHardwareID = RTL_CONSTANT_STRING(L"*PNP0C08\0"); OBJECT_ATTRIBUTES ObjectAttributes; - HANDLE hEnum, hRoot, hHalAcpiDevice, hHalAcpiId, hLogConf; + HANDLE hEnum, hRoot; NTSTATUS Status; - ULONG Disposition; InitializeObjectAttributes(&ObjectAttributes, &EnumU, OBJ_KERNEL_HANDLE | OBJ_CASE_INSENSITIVE, NULL, NULL); Status = ZwCreateKey(&hEnum, KEY_CREATE_SUB_KEY, &ObjectAttributes, 0, NULL, 0, NULL); @@ -2636,35 +2807,7 @@ IopUpdateRootKey(VOID) return Status; } - if (IopIsAcpiComputer()) - { - InitializeObjectAttributes(&ObjectAttributes, &HalAcpiDevice, OBJ_KERNEL_HANDLE | OBJ_CASE_INSENSITIVE, hRoot, NULL); - Status = ZwCreateKey(&hHalAcpiDevice, KEY_CREATE_SUB_KEY, &ObjectAttributes, 0, NULL, 0, NULL); - ZwClose(hRoot); - if (!NT_SUCCESS(Status)) - return Status; - InitializeObjectAttributes(&ObjectAttributes, &HalAcpiId, OBJ_KERNEL_HANDLE | OBJ_CASE_INSENSITIVE, hHalAcpiDevice, NULL); - Status = ZwCreateKey(&hHalAcpiId, KEY_CREATE_SUB_KEY | KEY_SET_VALUE, &ObjectAttributes, 0, NULL, 0, &Disposition); - ZwClose(hHalAcpiDevice); - if (!NT_SUCCESS(Status)) - return Status; - if (Disposition == REG_CREATED_NEW_KEY) - { - Status = ZwSetValueKey(hHalAcpiId, &DeviceDescU, 0, REG_SZ, HalAcpiDeviceDesc.Buffer, HalAcpiDeviceDesc.MaximumLength); - if (NT_SUCCESS(Status)) - Status = ZwSetValueKey(hHalAcpiId, &HardwareIDU, 0, REG_MULTI_SZ, HalAcpiHardwareID.Buffer, HalAcpiHardwareID.MaximumLength); - } - if (NT_SUCCESS(Status)) - { - InitializeObjectAttributes(&ObjectAttributes, &LogConfU, OBJ_KERNEL_HANDLE | OBJ_CASE_INSENSITIVE, hHalAcpiId, NULL); - Status = ZwCreateKey(&hLogConf, 0, &ObjectAttributes, 0, NULL, REG_OPTION_VOLATILE, NULL); - if (NT_SUCCESS(Status)) - ZwClose(hLogConf); - } - ZwClose(hHalAcpiId); - return Status; - } - else + if (!IopIsFirmwareMapperDisabled()) { Status = IopOpenRegistryKeyEx(&hEnum, NULL, &MultiKeyPathU, KEY_ENUMERATE_SUB_KEYS); if (!NT_SUCCESS(Status)) @@ -2682,9 +2825,16 @@ IopUpdateRootKey(VOID) NULL, 0); ZwClose(hEnum); - ZwClose(hRoot); - return Status; } + else + { + /* Enumeration is disabled */ + Status = STATUS_SUCCESS; + } + + ZwClose(hRoot); + + return Status; } NTSTATUS @@ -3041,33 +3191,6 @@ PnpBusTypeGuidGet(IN USHORT Index, return Status; } -NTSTATUS -NTAPI -PpIrpQueryCapabilities(IN PDEVICE_OBJECT DeviceObject, - OUT PDEVICE_CAPABILITIES DeviceCaps) -{ - PVOID Dummy; - IO_STACK_LOCATION Stack; - - PAGED_CODE(); - - /* Set up the Header */ - RtlZeroMemory(DeviceCaps, sizeof(DEVICE_CAPABILITIES)); - DeviceCaps->Size = sizeof(DEVICE_CAPABILITIES); - DeviceCaps->Version = 1; - DeviceCaps->Address = -1; - DeviceCaps->UINumber = -1; - - /* Set up the Stack */ - RtlZeroMemory(&Stack, sizeof(IO_STACK_LOCATION)); - Stack.MajorFunction = IRP_MJ_PNP; - Stack.MinorFunction = IRP_MN_QUERY_CAPABILITIES; - Stack.Parameters.DeviceCapabilities.Capabilities = DeviceCaps; - - /* Send the IRP */ - return IopSynchronousCall(DeviceObject, &Stack, &Dummy); -} - NTSTATUS NTAPI PnpDeviceObjectToDeviceInstance(IN PDEVICE_OBJECT DeviceObject, @@ -3269,6 +3392,8 @@ IoGetDeviceProperty(IN PDEVICE_OBJECT DeviceObject, NTSTATUS Status = STATUS_BUFFER_TOO_SMALL; GUID BusTypeGuid; POBJECT_NAME_INFORMATION ObjectNameInfo = NULL; + BOOLEAN NullTerminate = FALSE; + DPRINT("IoGetDeviceProperty(0x%p %d)\n", DeviceObject, DeviceProperty); /* Assume failure */ @@ -3319,7 +3444,10 @@ IoGetDeviceProperty(IN PDEVICE_OBJECT DeviceObject, /* Get the name from the path */ EnumeratorNameEnd = wcschr(DeviceInstanceName, OBJ_NAME_PATH_SEPARATOR); ASSERT(EnumeratorNameEnd); - + + /* This string needs to be NULL-terminated */ + NullTerminate = TRUE; + /* This is the format of the returned data */ PIP_RETURN_DATA((EnumeratorNameEnd - DeviceInstanceName) * sizeof(WCHAR), DeviceInstanceName); @@ -3327,7 +3455,7 @@ IoGetDeviceProperty(IN PDEVICE_OBJECT DeviceObject, case DevicePropertyAddress: /* Query the device caps */ - Status = PpIrpQueryCapabilities(DeviceObject, &DeviceCaps); + Status = IopQueryDeviceCapabilities(DeviceNode, &DeviceCaps); if (!NT_SUCCESS(Status) || (DeviceCaps.Address == MAXULONG)) return STATUS_OBJECT_NAME_NOT_FOUND; @@ -3369,7 +3497,10 @@ IoGetDeviceProperty(IN PDEVICE_OBJECT DeviceObject, /* It's up to the caller to try again */ Status = STATUS_BUFFER_TOO_SMALL; } - + + /* This string needs to be NULL-terminated */ + NullTerminate = TRUE; + /* Return if successful */ if (NT_SUCCESS(Status)) PIP_RETURN_DATA(ObjectNameInfo->Name.Length, ObjectNameInfo->Name.Buffer); @@ -3435,15 +3566,14 @@ IoGetDeviceProperty(IN PDEVICE_OBJECT DeviceObject, else if (NT_SUCCESS(Status)) { /* We know up-front how much data to expect, check the caller's buffer */ - *ResultLength = ReturnLength; - if (ReturnLength <= BufferLength) + *ResultLength = ReturnLength + (NullTerminate ? sizeof(UNICODE_NULL) : 0); + if (*ResultLength <= BufferLength) { /* Buffer is all good, copy the data */ RtlCopyMemory(PropertyBuffer, Data, ReturnLength); - /* Check for properties that require a null-terminated string */ - if ((DeviceProperty == DevicePropertyEnumeratorName) || - (DeviceProperty == DevicePropertyPhysicalDeviceObjectName)) + /* Check if we need to NULL-terminate the string */ + if (NullTerminate) { /* Terminate the string */ ((PWCHAR)PropertyBuffer)[ReturnLength / sizeof(WCHAR)] = UNICODE_NULL; @@ -3465,13 +3595,115 @@ IoGetDeviceProperty(IN PDEVICE_OBJECT DeviceObject, } /* - * @unimplemented + * @implemented */ VOID NTAPI IoInvalidateDeviceState(IN PDEVICE_OBJECT PhysicalDeviceObject) { - UNIMPLEMENTED; + PDEVICE_NODE DeviceNode = IopGetDeviceNode(PhysicalDeviceObject); + IO_STACK_LOCATION Stack; + ULONG PnPFlags; + NTSTATUS Status; + IO_STATUS_BLOCK IoStatusBlock; + + RtlZeroMemory(&Stack, sizeof(IO_STACK_LOCATION)); + Stack.MajorFunction = IRP_MJ_PNP; + Stack.MinorFunction = IRP_MN_QUERY_PNP_DEVICE_STATE; + + Status = IopSynchronousCall(PhysicalDeviceObject, &Stack, (PVOID*)&PnPFlags); + if (!NT_SUCCESS(Status)) + { + DPRINT1("IRP_MN_QUERY_PNP_DEVICE_STATE failed with status 0x%x\n", Status); + return; + } + + if (PnPFlags & PNP_DEVICE_NOT_DISABLEABLE) + DeviceNode->UserFlags |= DNUF_NOT_DISABLEABLE; + else + DeviceNode->UserFlags &= ~DNUF_NOT_DISABLEABLE; + + if (PnPFlags & PNP_DEVICE_DONT_DISPLAY_IN_UI) + DeviceNode->UserFlags |= DNUF_DONT_SHOW_IN_UI; + else + DeviceNode->UserFlags &= ~DNUF_DONT_SHOW_IN_UI; + + if ((PnPFlags & PNP_DEVICE_REMOVED) || + ((PnPFlags & PNP_DEVICE_FAILED) && !(PnPFlags & PNP_DEVICE_RESOURCE_REQUIREMENTS_CHANGED))) + { + /* Surprise removal */ + + IopSendSurpriseRemoval(PhysicalDeviceObject); + + /* Tell the user-mode PnP manager that a device was removed */ + IopQueueTargetDeviceEvent(&GUID_DEVICE_SURPRISE_REMOVAL, + &DeviceNode->InstancePath); + + IopSendRemoveDevice(PhysicalDeviceObject); + } + else if ((PnPFlags & PNP_DEVICE_FAILED) && (PnPFlags & PNP_DEVICE_RESOURCE_REQUIREMENTS_CHANGED)) + { + /* Stop for resource rebalance */ + + Status = IopStopDevice(DeviceNode); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Failed to stop device for rebalancing\n"); + + /* Stop failed so don't rebalance */ + PnPFlags &= ~PNP_DEVICE_RESOURCE_REQUIREMENTS_CHANGED; + } + } + + /* Resource rebalance */ + if (PnPFlags & PNP_DEVICE_RESOURCE_REQUIREMENTS_CHANGED) + { + DPRINT("Sending IRP_MN_QUERY_RESOURCES to device stack\n"); + + Status = IopInitiatePnpIrp(PhysicalDeviceObject, + &IoStatusBlock, + IRP_MN_QUERY_RESOURCES, + NULL); + if (NT_SUCCESS(Status) && IoStatusBlock.Information) + { + DeviceNode->BootResources = + (PCM_RESOURCE_LIST)IoStatusBlock.Information; + IopDeviceNodeSetFlag(DeviceNode, DNF_HAS_BOOT_CONFIG); + } + else + { + DPRINT("IopInitiatePnpIrp() failed (Status %x) or IoStatusBlock.Information=NULL\n", Status); + DeviceNode->BootResources = NULL; + } + + DPRINT("Sending IRP_MN_QUERY_RESOURCE_REQUIREMENTS to device stack\n"); + + Status = IopInitiatePnpIrp(PhysicalDeviceObject, + &IoStatusBlock, + IRP_MN_QUERY_RESOURCE_REQUIREMENTS, + NULL); + if (NT_SUCCESS(Status)) + { + DeviceNode->ResourceRequirements = + (PIO_RESOURCE_REQUIREMENTS_LIST)IoStatusBlock.Information; + } + else + { + DPRINT("IopInitiatePnpIrp() failed (Status %08lx)\n", Status); + DeviceNode->ResourceRequirements = NULL; + } + + /* IRP_MN_FILTER_RESOURCE_REQUIREMENTS is called indirectly by IopStartDevice */ + if (IopStartDevice(DeviceNode) != STATUS_SUCCESS) + { + DPRINT1("Restart after resource rebalance failed\n"); + + DeviceNode->Flags &= ~(DNF_STARTED | DNF_START_REQUEST_PENDING); + DeviceNode->Flags |= DNF_START_FAILED; + + IopRemoveDevice(DeviceNode); + } + } } /** @@ -3629,14 +3861,379 @@ IoOpenDeviceRegistryKey(IN PDEVICE_OBJECT DeviceObject, return Status; } +static +NTSTATUS +IopQueryRemoveChildDevices(PDEVICE_NODE ParentDeviceNode) +{ + PDEVICE_NODE ChildDeviceNode, NextDeviceNode, FailedRemoveDevice; + NTSTATUS Status; + KIRQL OldIrql; + + KeAcquireSpinLock(&IopDeviceTreeLock, &OldIrql); + ChildDeviceNode = ParentDeviceNode->Child; + while (ChildDeviceNode != NULL) + { + NextDeviceNode = ChildDeviceNode->Sibling; + KeReleaseSpinLock(&IopDeviceTreeLock, OldIrql); + + Status = IopPrepareDeviceForRemoval(ChildDeviceNode->PhysicalDeviceObject); + if (!NT_SUCCESS(Status)) + { + FailedRemoveDevice = ChildDeviceNode; + goto cleanup; + } + + KeAcquireSpinLock(&IopDeviceTreeLock, &OldIrql); + ChildDeviceNode = NextDeviceNode; + } + KeReleaseSpinLock(&IopDeviceTreeLock, OldIrql); + + return STATUS_SUCCESS; + +cleanup: + KeAcquireSpinLock(&IopDeviceTreeLock, &OldIrql); + ChildDeviceNode = ParentDeviceNode->Child; + while (ChildDeviceNode != NULL) + { + NextDeviceNode = ChildDeviceNode->Sibling; + KeReleaseSpinLock(&IopDeviceTreeLock, OldIrql); + + IopCancelPrepareDeviceForRemoval(ChildDeviceNode->PhysicalDeviceObject); + + /* IRP_MN_CANCEL_REMOVE_DEVICE is also sent to the device + * that failed the IRP_MN_QUERY_REMOVE_DEVICE request */ + if (ChildDeviceNode == FailedRemoveDevice) + return Status; + + ChildDeviceNode = NextDeviceNode; + + KeAcquireSpinLock(&IopDeviceTreeLock, &OldIrql); + } + KeReleaseSpinLock(&IopDeviceTreeLock, OldIrql); + + return Status; +} + +static +VOID +IopSendRemoveChildDevices(PDEVICE_NODE ParentDeviceNode) +{ + PDEVICE_NODE ChildDeviceNode, NextDeviceNode; + KIRQL OldIrql; + + KeAcquireSpinLock(&IopDeviceTreeLock, &OldIrql); + ChildDeviceNode = ParentDeviceNode->Child; + while (ChildDeviceNode != NULL) + { + NextDeviceNode = ChildDeviceNode->Sibling; + KeReleaseSpinLock(&IopDeviceTreeLock, OldIrql); + + IopSendRemoveDevice(ChildDeviceNode->PhysicalDeviceObject); + + ChildDeviceNode = NextDeviceNode; + + KeAcquireSpinLock(&IopDeviceTreeLock, &OldIrql); + } + KeReleaseSpinLock(&IopDeviceTreeLock, OldIrql); +} + +static +VOID +IopCancelRemoveChildDevices(PDEVICE_NODE ParentDeviceNode) +{ + PDEVICE_NODE ChildDeviceNode, NextDeviceNode; + KIRQL OldIrql; + + KeAcquireSpinLock(&IopDeviceTreeLock, &OldIrql); + ChildDeviceNode = ParentDeviceNode->Child; + while (ChildDeviceNode != NULL) + { + NextDeviceNode = ChildDeviceNode->Sibling; + KeReleaseSpinLock(&IopDeviceTreeLock, OldIrql); + + IopCancelPrepareDeviceForRemoval(ChildDeviceNode->PhysicalDeviceObject); + + ChildDeviceNode = NextDeviceNode; + + KeAcquireSpinLock(&IopDeviceTreeLock, &OldIrql); + } + KeReleaseSpinLock(&IopDeviceTreeLock, OldIrql); +} + +static +NTSTATUS +IopQueryRemoveDeviceRelations(PDEVICE_RELATIONS DeviceRelations) +{ + /* This function DOES NOT dereference the device objects on SUCCESS + * but it DOES dereference device objects on FAILURE */ + + ULONG i, j; + NTSTATUS Status; + + for (i = 0; i < DeviceRelations->Count; i++) + { + Status = IopPrepareDeviceForRemoval(DeviceRelations->Objects[i]); + if (!NT_SUCCESS(Status)) + { + j = i; + goto cleanup; + } + } + + return STATUS_SUCCESS; + +cleanup: + /* IRP_MN_CANCEL_REMOVE_DEVICE is also sent to the device + * that failed the IRP_MN_QUERY_REMOVE_DEVICE request */ + for (i = 0; i <= j; i++) + { + IopCancelPrepareDeviceForRemoval(DeviceRelations->Objects[i]); + ObDereferenceObject(DeviceRelations->Objects[i]); + DeviceRelations->Objects[i] = NULL; + } + for (; i < DeviceRelations->Count; i++) + { + ObDereferenceObject(DeviceRelations->Objects[i]); + DeviceRelations->Objects[i] = NULL; + } + ExFreePool(DeviceRelations); + + return Status; +} + +static +VOID +IopSendRemoveDeviceRelations(PDEVICE_RELATIONS DeviceRelations) +{ + /* This function DOES dereference the device objects in all cases */ + + ULONG i; + + for (i = 0; i < DeviceRelations->Count; i++) + { + IopSendRemoveDevice(DeviceRelations->Objects[i]); + ObDereferenceObject(DeviceRelations->Objects[i]); + DeviceRelations->Objects[i] = NULL; + } + + ExFreePool(DeviceRelations); +} + +static +VOID +IopCancelRemoveDeviceRelations(PDEVICE_RELATIONS DeviceRelations) +{ + /* This function DOES dereference the device objects in all cases */ + + ULONG i; + + for (i = 0; i < DeviceRelations->Count; i++) + { + IopCancelPrepareDeviceForRemoval(DeviceRelations->Objects[i]); + ObDereferenceObject(DeviceRelations->Objects[i]); + DeviceRelations->Objects[i] = NULL; + } + + ExFreePool(DeviceRelations); +} + +VOID +IopCancelPrepareDeviceForRemoval(PDEVICE_OBJECT DeviceObject) +{ + IO_STACK_LOCATION Stack; + IO_STATUS_BLOCK IoStatusBlock; + PDEVICE_RELATIONS DeviceRelations; + NTSTATUS Status; + + IopCancelRemoveDevice(DeviceObject); + + Stack.Parameters.QueryDeviceRelations.Type = RemovalRelations; + + Status = IopInitiatePnpIrp(DeviceObject, + &IoStatusBlock, + IRP_MN_QUERY_DEVICE_RELATIONS, + &Stack); + if (!NT_SUCCESS(Status)) + { + DPRINT("IopInitiatePnpIrp() failed with status 0x%08lx\n", Status); + DeviceRelations = NULL; + } + else + { + DeviceRelations = (PDEVICE_RELATIONS)IoStatusBlock.Information; + } + + if (DeviceRelations) + IopCancelRemoveDeviceRelations(DeviceRelations); +} + +NTSTATUS +IopPrepareDeviceForRemoval(IN PDEVICE_OBJECT DeviceObject) +{ + PDEVICE_NODE DeviceNode = IopGetDeviceNode(DeviceObject); + IO_STACK_LOCATION Stack; + IO_STATUS_BLOCK IoStatusBlock; + PDEVICE_RELATIONS DeviceRelations; + NTSTATUS Status; + + if (DeviceNode->UserFlags & DNUF_NOT_DISABLEABLE) + { + DPRINT1("Removal not allowed for %wZ\n", &DeviceNode->InstancePath); + return STATUS_UNSUCCESSFUL; + } + + if (IopQueryRemoveDevice(DeviceObject) != STATUS_SUCCESS) + { + DPRINT1("Removal vetoed by failing the query remove request\n"); + + IopCancelRemoveDevice(DeviceObject); + + return STATUS_UNSUCCESSFUL; + } + + Stack.Parameters.QueryDeviceRelations.Type = RemovalRelations; + + Status = IopInitiatePnpIrp(DeviceObject, + &IoStatusBlock, + IRP_MN_QUERY_DEVICE_RELATIONS, + &Stack); + if (!NT_SUCCESS(Status)) + { + DPRINT("IopInitiatePnpIrp() failed with status 0x%08lx\n", Status); + DeviceRelations = NULL; + } + else + { + DeviceRelations = (PDEVICE_RELATIONS)IoStatusBlock.Information; + } + + if (DeviceRelations) + { + Status = IopQueryRemoveDeviceRelations(DeviceRelations); + if (!NT_SUCCESS(Status)) + return Status; + } + + Status = IopQueryRemoveChildDevices(DeviceNode); + if (!NT_SUCCESS(Status)) + { + if (DeviceRelations) + IopCancelRemoveDeviceRelations(DeviceRelations); + return Status; + } + + if (DeviceRelations) + IopSendRemoveDeviceRelations(DeviceRelations); + IopSendRemoveChildDevices(DeviceNode); + + return STATUS_SUCCESS; +} + +NTSTATUS +IopRemoveDevice(PDEVICE_NODE DeviceNode) +{ + NTSTATUS Status; + + DPRINT("Removing device: %wZ\n", &DeviceNode->InstancePath); + + Status = IopPrepareDeviceForRemoval(DeviceNode->PhysicalDeviceObject); + if (NT_SUCCESS(Status)) + { + IopSendRemoveDevice(DeviceNode->PhysicalDeviceObject); + IopQueueTargetDeviceEvent(&GUID_DEVICE_SAFE_REMOVAL, + &DeviceNode->InstancePath); + DeviceNode->Flags |= DNF_WILL_BE_REMOVED; + return STATUS_SUCCESS; + } + + return Status; +} + /* - * @unimplemented + * @implemented */ VOID NTAPI IoRequestDeviceEject(IN PDEVICE_OBJECT PhysicalDeviceObject) { - UNIMPLEMENTED; + PDEVICE_NODE DeviceNode = IopGetDeviceNode(PhysicalDeviceObject); + PDEVICE_RELATIONS DeviceRelations; + IO_STATUS_BLOCK IoStatusBlock; + IO_STACK_LOCATION Stack; + DEVICE_CAPABILITIES Capabilities; + NTSTATUS Status; + + IopQueueTargetDeviceEvent(&GUID_DEVICE_KERNEL_INITIATED_EJECT, + &DeviceNode->InstancePath); + + if (IopQueryDeviceCapabilities(DeviceNode, &Capabilities) != STATUS_SUCCESS) + { + goto cleanup; + } + + Stack.Parameters.QueryDeviceRelations.Type = EjectionRelations; + + Status = IopInitiatePnpIrp(PhysicalDeviceObject, + &IoStatusBlock, + IRP_MN_QUERY_DEVICE_RELATIONS, + &Stack); + if (!NT_SUCCESS(Status)) + { + DPRINT("IopInitiatePnpIrp() failed with status 0x%08lx\n", Status); + DeviceRelations = NULL; + } + else + { + DeviceRelations = (PDEVICE_RELATIONS)IoStatusBlock.Information; + } + + if (DeviceRelations) + { + Status = IopQueryRemoveDeviceRelations(DeviceRelations); + if (!NT_SUCCESS(Status)) + goto cleanup; + } + + Status = IopQueryRemoveChildDevices(DeviceNode); + if (!NT_SUCCESS(Status)) + { + if (DeviceRelations) + IopCancelRemoveDeviceRelations(DeviceRelations); + goto cleanup; + } + + if (IopPrepareDeviceForRemoval(PhysicalDeviceObject) != STATUS_SUCCESS) + { + if (DeviceRelations) + IopCancelRemoveDeviceRelations(DeviceRelations); + IopCancelRemoveChildDevices(DeviceNode); + goto cleanup; + } + + if (DeviceRelations) + IopSendRemoveDeviceRelations(DeviceRelations); + IopSendRemoveChildDevices(DeviceNode); + + if (Capabilities.EjectSupported) + { + if (IopSendEject(PhysicalDeviceObject) != STATUS_SUCCESS) + { + goto cleanup; + } + } + else + { + DeviceNode->Flags |= DNF_DISABLED; + } + + IopQueueTargetDeviceEvent(&GUID_DEVICE_EJECT, + &DeviceNode->InstancePath); + + return; + +cleanup: + IopQueueTargetDeviceEvent(&GUID_DEVICE_EJECT_VETOED, + &DeviceNode->InstancePath); } /* @@ -3702,7 +4299,7 @@ IoSynchronousInvalidateDeviceRelations( } /* - * @unimplemented + * @implemented */ BOOLEAN NTAPI @@ -3712,6 +4309,11 @@ IoTranslateBusAddress(IN INTERFACE_TYPE InterfaceType, IN OUT PULONG AddressSpace, OUT PPHYSICAL_ADDRESS TranslatedAddress) { - UNIMPLEMENTED; - return FALSE; + /* FIXME: Notify the resource arbiter */ + + return HalTranslateBusAddress(InterfaceType, + BusNumber, + BusAddress, + AddressSpace, + TranslatedAddress); } diff --git a/ntoskrnl/io/pnpmgr/pnpnotify.c b/ntoskrnl/io/pnpmgr/pnpnotify.c index 6e43d7143cf..372ba30b64b 100644 --- a/ntoskrnl/io/pnpmgr/pnpnotify.c +++ b/ntoskrnl/io/pnpmgr/pnpnotify.c @@ -23,6 +23,7 @@ typedef struct _PNP_NOTIFY_ENTRY PVOID Context; UNICODE_STRING Guid; PFILE_OBJECT FileObject; + PDRIVER_OBJECT DriverObject; PDRIVER_NOTIFICATION_CALLBACK_ROUTINE PnpNotificationProc; } PNP_NOTIFY_ENTRY, *PPNP_NOTIFY_ENTRY; @@ -118,7 +119,6 @@ IopNotifyPlugPlayNotification( NotificationInfos->Version = 1; NotificationInfos->Size = sizeof(TARGET_DEVICE_REMOVAL_NOTIFICATION); RtlCopyMemory(&NotificationInfos->Event, Event, sizeof(GUID)); - NotificationInfos->FileObject = (PFILE_OBJECT)EventCategoryData1; } else { @@ -176,22 +176,21 @@ IopNotifyPlugPlayNotification( } case EventCategoryTargetDeviceChange: { - if (Event != &GUID_PNP_CUSTOM_NOTIFICATION) - { - if (ChangeEntry->FileObject == (PFILE_OBJECT)EventCategoryData1) - CallCurrentEntry = TRUE; - } - else - { - Status = IoGetRelatedTargetDevice(ChangeEntry->FileObject, &EntryDeviceObject); - if (NT_SUCCESS(Status)) - { - if (DeviceObject == EntryDeviceObject) - { - ((PTARGET_DEVICE_CUSTOM_NOTIFICATION)NotificationStructure)->FileObject = ChangeEntry->FileObject; - CallCurrentEntry = TRUE; - } - } + Status = IoGetRelatedTargetDevice(ChangeEntry->FileObject, &EntryDeviceObject); + if (NT_SUCCESS(Status)) + { + if (DeviceObject == EntryDeviceObject) + { + if (Event == &GUID_PNP_CUSTOM_NOTIFICATION) + { + ((PTARGET_DEVICE_CUSTOM_NOTIFICATION)NotificationStructure)->FileObject = ChangeEntry->FileObject; + } + else + { + ((PTARGET_DEVICE_REMOVAL_NOTIFICATION)NotificationStructure)->FileObject = ChangeEntry->FileObject; + } + CallCurrentEntry = TRUE; + } } } default: @@ -319,6 +318,7 @@ IoRegisterPlugPlayNotification(IN IO_NOTIFICATION_EVENT_CATEGORY EventCategory, Entry->PnpNotificationProc = CallbackRoutine; Entry->EventCategory = EventCategory; Entry->Context = Context; + Entry->DriverObject = DriverObject; switch (EventCategory) { case EventCategoryDeviceInterfaceChange: @@ -377,9 +377,14 @@ IoUnregisterPlugPlayNotification(IN PVOID NotificationEntry) DPRINT("__FUNCTION__(NotificationEntry %p) called\n", Entry); KeAcquireGuardedMutex(&PnpNotifyListLock); - RtlFreeUnicodeString(&Entry->Guid); RemoveEntryList(&Entry->PnpNotifyList); KeReleaseGuardedMutex(&PnpNotifyListLock); + RtlFreeUnicodeString(&Entry->Guid); + + ObDereferenceObject(Entry->DriverObject); + + ExFreePoolWithTag(Entry, TAG_PNP_NOTIFY); + return STATUS_SUCCESS; } diff --git a/ntoskrnl/io/pnpmgr/pnpreport.c b/ntoskrnl/io/pnpmgr/pnpreport.c index 94a20dc18ce..d63a7018ba6 100644 --- a/ntoskrnl/io/pnpmgr/pnpreport.c +++ b/ntoskrnl/io/pnpmgr/pnpreport.c @@ -248,7 +248,8 @@ IoReportDetectedDevice(IN PDRIVER_OBJECT DriverObject, IopActionConfigureChildServices(DeviceNode, DeviceNode->Parent); /* Open a handle to the instance path key */ - Status = IopCreateDeviceKeyPath(&DeviceNode->InstancePath, 0, &InstanceKey); + /* REG_OPTION_VOLATILE is a HACK!!! */ + Status = IopCreateDeviceKeyPath(&DeviceNode->InstancePath, REG_OPTION_VOLATILE, &InstanceKey); if (!NT_SUCCESS(Status)) return Status; @@ -258,16 +259,16 @@ IoReportDetectedDevice(IN PDRIVER_OBJECT DriverObject, L"DETECTED%ls\\%wZ", IfString, &ServiceName); - HardwareId[IdLength++] = UNICODE_NULL; + IdLength++; /* Add DETECTED\DriverName */ IdLength += swprintf(&HardwareId[IdLength], L"DETECTED\\%wZ", &ServiceName); - HardwareId[IdLength++] = UNICODE_NULL; + IdLength++; /* Terminate the string with another null */ - HardwareId[IdLength] = UNICODE_NULL; + HardwareId[IdLength++] = UNICODE_NULL; /* Store the value for CompatibleIDs */ RtlInitUnicodeString(&ValueName, L"CompatibleIDs"); @@ -289,10 +290,12 @@ IoReportDetectedDevice(IN PDRIVER_OBJECT DriverObject, L"DETECTED%ls\\%wZ", IfString, &ServiceName); - HardwareId[++IdLength] = UNICODE_NULL; + IdLength++; + + HardwareId[IdLength++] = UNICODE_NULL; /* Write the value to the registry */ - Status = ZwSetValueKey(InstanceKey, &ValueName, 0, REG_SZ, HardwareId, IdLength * sizeof(WCHAR)); + Status = ZwSetValueKey(InstanceKey, &ValueName, 0, REG_MULTI_SZ, HardwareId, IdLength * sizeof(WCHAR)); if (!NT_SUCCESS(Status)) { DPRINT("Failed to write the hardware ID: 0x%x\n", Status); diff --git a/ntoskrnl/io/pnpmgr/pnpres.c b/ntoskrnl/io/pnpmgr/pnpres.c index ac1884e2d11..7a649ac6e45 100644 --- a/ntoskrnl/io/pnpmgr/pnpres.c +++ b/ntoskrnl/io/pnpmgr/pnpres.c @@ -217,6 +217,7 @@ IopCreateResourceListFromRequirements( for (ii = 0; ii < ResList->Count; ii++) { PIO_RESOURCE_DESCRIPTOR ReqDesc = &ResList->Descriptors[ii]; + BOOLEAN FoundResource = TRUE; /* FIXME: Handle alternate ranges */ if (ReqDesc->Option == IO_RESOURCE_ALTERNATIVE) @@ -240,6 +241,8 @@ IopCreateResourceListFromRequirements( *ResourceList = NULL; return STATUS_CONFLICTING_ADDRESSES; } + + FoundResource = FALSE; } break; @@ -256,6 +259,8 @@ IopCreateResourceListFromRequirements( *ResourceList = NULL; return STATUS_CONFLICTING_ADDRESSES; } + + FoundResource = FALSE; } break; @@ -272,6 +277,8 @@ IopCreateResourceListFromRequirements( *ResourceList = NULL; return STATUS_CONFLICTING_ADDRESSES; } + + FoundResource = FALSE; } break; @@ -288,6 +295,8 @@ IopCreateResourceListFromRequirements( *ResourceList = NULL; return STATUS_CONFLICTING_ADDRESSES; } + + FoundResource = FALSE; } break; @@ -303,16 +312,22 @@ IopCreateResourceListFromRequirements( *ResourceList = NULL; return STATUS_CONFLICTING_ADDRESSES; } + + FoundResource = FALSE; } break; default: DPRINT1("Unsupported resource type: %x\n", ReqDesc->Type); + FoundResource = FALSE; break; } - (*ResourceList)->List[0].PartialResourceList.Count++; - ResDesc++; + if (FoundResource) + { + (*ResourceList)->List[0].PartialResourceList.Count++; + ResDesc++; + } } } @@ -758,6 +773,13 @@ IopTranslateDeviceResources( DPRINT1("Failed to translate port resource (Start: 0x%I64x)\n", DescriptorRaw->u.Port.Start.QuadPart); goto cleanup; } + + if (AddressSpace == 0) + { + /* This is actually a memory resource */ + DescriptorRaw->Type = CmResourceTypeMemory; + DescriptorTranslated->Type = CmResourceTypeMemory; + } break; } case CmResourceTypeInterrupt: @@ -793,6 +815,13 @@ IopTranslateDeviceResources( DPRINT1("Failed to translate memory resource (Start: 0xI64x)\n", DescriptorRaw->u.Memory.Start.QuadPart); goto cleanup; } + + if (AddressSpace != 0) + { + /* This is actually an I/O port resource */ + DescriptorRaw->Type = CmResourceTypePort; + DescriptorTranslated->Type = CmResourceTypePort; + } } case CmResourceTypeDma: diff --git a/ntoskrnl/io/pnpmgr/pnproot.c b/ntoskrnl/io/pnpmgr/pnproot.c index 638c66557b9..c2501cd14a5 100644 --- a/ntoskrnl/io/pnpmgr/pnproot.c +++ b/ntoskrnl/io/pnpmgr/pnproot.c @@ -142,7 +142,7 @@ PnpRootCreateDevice( UNICODE_STRING PathSep = RTL_CONSTANT_STRING(L"\\"); ULONG NextInstance; UNICODE_STRING EnumKeyName = RTL_CONSTANT_STRING(L"\\Registry\\Machine\\" REGSTR_PATH_SYSTEMENUM); - HANDLE EnumHandle, DeviceKeyHandle = INVALID_HANDLE_VALUE; + HANDLE EnumHandle, DeviceKeyHandle = INVALID_HANDLE_VALUE, InstanceKeyHandle; RTL_QUERY_REGISTRY_TABLE QueryTable[2]; OBJECT_ATTRIBUTES ObjectAttributes; @@ -241,6 +241,18 @@ tryagain: goto cleanup; } + /* Finish creating the instance path in the registry */ + InitializeObjectAttributes(&ObjectAttributes, &Device->InstanceID, OBJ_CASE_INSENSITIVE, DeviceKeyHandle, NULL); + Status = ZwCreateKey(&InstanceKeyHandle, KEY_QUERY_VALUE, &ObjectAttributes, 0, NULL, REG_OPTION_VOLATILE, NULL); + if (NT_SUCCESS(Status)) + { + DPRINT1("Failed to create instance path (0x%x)\n", Status); + goto cleanup; + } + + /* Just close the handle */ + ZwClose(InstanceKeyHandle); + if (FullInstancePath) { FullInstancePath->MaximumLength = Device->DeviceID.Length + PathSep.Length + Device->InstanceID.Length; diff --git a/ntoskrnl/io/pnpmgr/pnputil.c b/ntoskrnl/io/pnpmgr/pnputil.c index f274f3db679..9bbccaca5ee 100644 --- a/ntoskrnl/io/pnpmgr/pnputil.c +++ b/ntoskrnl/io/pnpmgr/pnputil.c @@ -178,7 +178,7 @@ PnpRegSzToString(IN PWCHAR RegSzData, for (p = RegSzData; p < pp; p++) if (!*p) break; /* Return it */ - if (StringLength) *StringLength = p - RegSzData; + if (StringLength) *StringLength = (p - RegSzData) * sizeof(WCHAR); return TRUE; } diff --git a/ntoskrnl/kd/kdio.c b/ntoskrnl/kd/kdio.c index 4c18d4c721d..ee41ccbeaa3 100644 --- a/ntoskrnl/kd/kdio.c +++ b/ntoskrnl/kd/kdio.c @@ -10,6 +10,7 @@ /* INCLUDES ******************************************************************/ #include +#include #include /* GLOBALS *******************************************************************/ @@ -29,7 +30,19 @@ KD_PORT_INFORMATION SerialPortInfo = { DEFAULT_DEBUG_PORT, DEFAULT_DEBUG_BAUD_RA /* Current Port in use. FIXME: Do we support more then one? */ ULONG KdpPort; -/* DEBUG LOG FUNCTIONS *******************************************************/ +#define KdpScreenLineLenght 80 +CHAR KdpScreenLineBuffer[KdpScreenLineLenght + 1] = ""; +ULONG KdpScreenLineBufferPos = 0, KdpScreenLineLength = 0; + +const ULONG KdpDmesgBufferSize = 128 * 1024; // 512*1024; // 5*1024*1024; +PCHAR KdpDmesgBuffer = NULL; +volatile ULONG KdpDmesgCurrentPosition = 0; +volatile ULONG KdpDmesgFreeBytes = 0; +volatile ULONG KdbDmesgTotalWritten = 0; +KSPIN_LOCK KdpDmesgLogSpinLock; +volatile BOOLEAN KdbpIsInDmesgMode = FALSE; + +/* FILE DEBUG LOG FUNCTIONS **************************************************/ VOID NTAPI @@ -45,8 +58,14 @@ KdpLoggerThread(PVOID Context) KeWaitForSingleObject(&KdpLoggerThreadEvent, 0, KernelMode, FALSE, NULL); /* Bug */ + /* Keep KdpCurrentPosition and KdpFreeBytes values in local + * variables to avoid their possible change from Producer part, + * KdpPrintToLogFile function + */ end = KdpCurrentPosition; num = KdpFreeBytes; + + /* Now securely calculate values, based on local variables */ beg = (end + num) % KdpBufferSize; num = KdpBufferSize - num; @@ -144,6 +163,7 @@ KdpInitDebugLog(PKD_DISPATCH_TABLE DispatchTable, IO_STATUS_BLOCK Iosb; HANDLE ThreadHandle; KPRIORITY Priority; + SIZE_T MemSizeMBs; if (!KdpDebugMode.File) return; @@ -171,6 +191,8 @@ KdpInitDebugLog(PKD_DISPATCH_TABLE DispatchTable, /* Display separator + ReactOS version at start of the debug log */ DPRINT1("---------------------------------------------------------------\n"); DPRINT1("ReactOS "KERNEL_VERSION_STR" (Build "KERNEL_VERSION_BUILD_STR")\n"); + MemSizeMBs = MmNumberOfPhysicalPages * PAGE_SIZE / 1024 / 1024; + DPRINT1("%u System Processor [%u MB Memory]\n", KeNumberProcessors, MemSizeMBs); } else if (BootPhase == 2) { @@ -272,6 +294,7 @@ NTAPI KdpSerialInit(PKD_DISPATCH_TABLE DispatchTable, ULONG BootPhase) { + SIZE_T MemSizeMBs; if (!KdpDebugMode.Serial) return; if (BootPhase == 0) @@ -297,6 +320,8 @@ KdpSerialInit(PKD_DISPATCH_TABLE DispatchTable, /* Display separator + ReactOS version at start of the debug log */ DPRINT1("-----------------------------------------------------\n"); DPRINT1("ReactOS "KERNEL_VERSION_STR" (Build "KERNEL_VERSION_BUILD_STR")\n"); + MemSizeMBs = MmNumberOfPhysicalPages * PAGE_SIZE / 1024 / 1024; + DPRINT1("%u System Processor [%u MB Memory]\n", KeNumberProcessors, MemSizeMBs); DPRINT1("Command Line: %s\n", KeLoaderBlock->LoadOptions); DPRINT1("ARC Paths: %s %s %s %s\n", KeLoaderBlock->ArcBootDeviceName, KeLoaderBlock->NtHalPathName, @@ -311,13 +336,121 @@ KdpSerialInit(PKD_DISPATCH_TABLE DispatchTable, /* SCREEN FUNCTIONS **********************************************************/ +/* + * Screen debug logger function KdpScreenPrint() writes text messages into + * KdpDmesgBuffer, using it as a circular buffer. KdpDmesgBuffer contents could + * be later (re)viewed using dmesg command of kdbg. KdpScreenPrint() protects + * KdpDmesgBuffer from simultaneous writes by use of KdpDmesgLogSpinLock. + */ VOID NTAPI KdpScreenPrint(LPSTR Message, ULONG Length) { - /* Call HAL */ - HalDisplayString(Message); + ULONG beg, end, num; + KIRQL OldIrql; + PCHAR pch = (PCHAR) Message; + + while (*pch) + { + if(*pch == '\b') + { + /* HalDisplayString does not support '\b'. Workaround it and use '\r' */ + if(KdpScreenLineLength > 0) + { + /* Remove last character from buffer */ + KdpScreenLineBuffer[--KdpScreenLineLength] = '\0'; + KdpScreenLineBufferPos = KdpScreenLineLength; + + /* Clear row and print line again */ + HalDisplayString("\r"); + HalDisplayString(KdpScreenLineBuffer); + } + } + else + { + KdpScreenLineBuffer[KdpScreenLineLength++] = *pch; + KdpScreenLineBuffer[KdpScreenLineLength] = '\0'; + } + + if(*pch == '\n' || KdpScreenLineLength == KdpScreenLineLenght) + { + /* Print buffered characters */ + if(KdpScreenLineBufferPos != KdpScreenLineLength) + HalDisplayString(KdpScreenLineBuffer + KdpScreenLineBufferPos); + + /* Clear line buffer */ + KdpScreenLineBuffer[0] = '\0'; + KdpScreenLineLength = KdpScreenLineBufferPos = 0; + } + + ++pch; + } + + /* Print buffered characters */ + if(KdpScreenLineBufferPos != KdpScreenLineLength) + { + HalDisplayString(KdpScreenLineBuffer + KdpScreenLineBufferPos); + KdpScreenLineBufferPos = KdpScreenLineLength; + } + + /* Dmesg: store Message in the buffer to show it later */ + if (KdbpIsInDmesgMode) + return; + + if (KdpDmesgBuffer == NULL) + return; + + /* Acquire the printing spinlock without waiting at raised IRQL */ + while (TRUE) + { + /* Wait when the spinlock becomes available */ + while (!KeTestSpinLock(&KdpDmesgLogSpinLock)); + + /* Spinlock was free, raise IRQL */ + KeRaiseIrql(HIGH_LEVEL, &OldIrql); + + /* Try to get the spinlock */ + if (KeTryToAcquireSpinLockAtDpcLevel(&KdpDmesgLogSpinLock)) + break; + + /* Someone else got the spinlock, lower IRQL back */ + KeLowerIrql(OldIrql); + } + + /* Invariant: always_true(KdpDmesgFreeBytes == KdpDmesgBufferSize); + * set num to min(KdpDmesgFreeBytes, Length). + */ + num = (Length < KdpDmesgFreeBytes) ? Length : KdpDmesgFreeBytes; + beg = KdpDmesgCurrentPosition; + if (num != 0) + { + end = (beg + num) % KdpDmesgBufferSize; + if (end > beg) + { + RtlCopyMemory(KdpDmesgBuffer + beg, Message, Length); + } + else + { + RtlCopyMemory(KdpDmesgBuffer + beg, Message, KdpDmesgBufferSize - beg); + RtlCopyMemory(KdpDmesgBuffer, Message + (KdpDmesgBufferSize - beg), end); + } + KdpDmesgCurrentPosition = end; + + /* Counting the total bytes written */ + KdbDmesgTotalWritten += num; + } + + /* Release spinlock */ + KiReleaseSpinLock(&KdpDmesgLogSpinLock); + + /* Lower IRQL */ + KeLowerIrql(OldIrql); + + /* Optional step(?): find out a way to notify about buffer exhaustion, + * and possibly fall into kbd to use dmesg command: user will read + * debug messages before they will be wiped over by next writes. + */ } VOID @@ -325,6 +458,7 @@ NTAPI KdpScreenInit(PKD_DISPATCH_TABLE DispatchTable, ULONG BootPhase) { + SIZE_T MemSizeMBs; if (!KdpDebugMode.Screen) return; if (BootPhase == 0) @@ -336,6 +470,30 @@ KdpScreenInit(PKD_DISPATCH_TABLE DispatchTable, /* Register as a Provider */ InsertTailList(&KdProviders, &DispatchTable->KdProvidersList); } + else if (BootPhase == 1) + { + /* Allocate a buffer for dmesg log buffer. +1 for terminating null, + * see kdbp_cli.c:KdbpCmdDmesg()/2 + */ + KdpDmesgBuffer = ExAllocatePool(NonPagedPool, KdpDmesgBufferSize + 1); + RtlZeroMemory(KdpDmesgBuffer, KdpDmesgBufferSize + 1); + KdpDmesgFreeBytes = KdpDmesgBufferSize; + KdbDmesgTotalWritten = 0; + + /* Initialize spinlock */ + KeInitializeSpinLock(&KdpDmesgLogSpinLock); + + /* Display separator + ReactOS version at start of the debug log */ + DPRINT1("-----------------------------------------------------\n"); + DPRINT1("ReactOS "KERNEL_VERSION_STR" (Build "KERNEL_VERSION_BUILD_STR")\n"); + MemSizeMBs = MmNumberOfPhysicalPages * PAGE_SIZE / 1024 / 1024; + DPRINT1("%u System Processor [%u MB Memory]\n", KeNumberProcessors, MemSizeMBs); + DPRINT1("Command Line: %s\n", KeLoaderBlock->LoadOptions); + DPRINT1("ARC Paths: %s %s %s %s\n", KeLoaderBlock->ArcBootDeviceName, + KeLoaderBlock->NtHalPathName, + KeLoaderBlock->ArcHalDeviceName, + KeLoaderBlock->NtBootPathName); + } else if (BootPhase == 2) { HalDisplayString("\n Screen debugging enabled\n\n"); diff --git a/ntoskrnl/kd64/kddata.c b/ntoskrnl/kd64/kddata.c index 3d2be608f59..901ffb21a7c 100644 --- a/ntoskrnl/kd64/kddata.c +++ b/ntoskrnl/kd64/kddata.c @@ -356,7 +356,7 @@ PULONG KdComponentTable[104] = &Kd_ENDOFTABLE_Mask, }; -ULONG KdComponentTableSize = sizeof(KdComponentTable); +ULONG KdComponentTableSize = sizeof(KdComponentTable) / sizeof(KdComponentTable[0]); // // Debugger Data diff --git a/ntoskrnl/kdbg/i386/i386-dis.c b/ntoskrnl/kdbg/i386/i386-dis.c index 95425a227a0..2e0619515d9 100644 --- a/ntoskrnl/kdbg/i386/i386-dis.c +++ b/ntoskrnl/kdbg/i386/i386-dis.c @@ -78,7 +78,7 @@ KdbpMemoryError(int Status, unsigned int Addr, static void KdbpPrintAddressInCode(unsigned int Addr, struct disassemble_info * Ignored) { - if (!KdbSymPrintAddress((void*)Addr)) + if (!KdbSymPrintAddress((void*)Addr, NULL)) { DbgPrint("<%08x>", Addr); } diff --git a/ntoskrnl/kdbg/i386/kdb_help.S b/ntoskrnl/kdbg/i386/kdb_help.S index e586f14c5e7..9884c66e1c5 100644 --- a/ntoskrnl/kdbg/i386/kdb_help.S +++ b/ntoskrnl/kdbg/i386/kdb_help.S @@ -116,7 +116,7 @@ _KdbEnter: /* * Return to the caller. */ - iret + iretd PUBLIC _KdbpStackSwitchAndCall@8 diff --git a/ntoskrnl/kdbg/kdb_cli.c b/ntoskrnl/kdbg/kdb_cli.c index a45009cf7c1..99a4dab2dd5 100644 --- a/ntoskrnl/kdbg/kdb_cli.c +++ b/ntoskrnl/kdbg/kdb_cli.c @@ -42,6 +42,13 @@ #define KEY_SCAN_UP 72 #define KEY_SCAN_DOWN 80 +/* Scan codes of keyboard keys: */ +#define KEYSC_END 0x004f +#define KEYSC_PAGEUP 0x0049 +#define KEYSC_PAGEDOWN 0x0051 +#define KEYSC_HOME 0x0047 +#define KEYSC_ARROWUP 0x0048 + #define KDB_ENTER_CONDITION_TO_STRING(cond) \ ((cond) == KdbDoNotEnter ? "never" : \ ((cond) == KdbEnterAlways ? "always" : \ @@ -81,6 +88,11 @@ static BOOLEAN KdbpCmdBugCheck(ULONG Argc, PCHAR Argv[]); static BOOLEAN KdbpCmdFilter(ULONG Argc, PCHAR Argv[]); static BOOLEAN KdbpCmdSet(ULONG Argc, PCHAR Argv[]); static BOOLEAN KdbpCmdHelp(ULONG Argc, PCHAR Argv[]); +static BOOLEAN KdbpCmdDmesg(ULONG Argc, PCHAR Argv[]); + +#ifdef __ROS_CMAKE__ +static BOOLEAN KdbpCmdPrintStruct(ULONG Argc, PCHAR Argv[]); +#endif /* GLOBALS *******************************************************************/ @@ -101,6 +113,15 @@ static LONG KdbNumberOfColsTerminal = -1; PCHAR KdbInitFileBuffer = NULL; /* Buffer where KDBinit file is loaded into during initialization */ BOOLEAN KdbpBugCheckRequested = FALSE; +/* Vars for dmesg */ +/* defined in ../kd/kdio.c, declare here: */ +extern volatile BOOLEAN KdbpIsInDmesgMode; +extern const ULONG KdpDmesgBufferSize; +extern PCHAR KdpDmesgBuffer; +extern volatile ULONG KdpDmesgCurrentPosition; +extern volatile ULONG KdpDmesgFreeBytes; +extern volatile ULONG KdbDmesgTotalWritten; + static const struct { PCHAR Name; @@ -118,6 +139,9 @@ static const struct { "sregs", "sregs", "Display status registers.", KdbpCmdRegs }, { "dregs", "dregs", "Display debug registers.", KdbpCmdRegs }, { "bt", "bt [*frameaddr|thread id]", "Prints current backtrace or from given frame addr", KdbpCmdBackTrace }, +#ifdef __ROS_CMAKE__ + { "dt", "dt [mod] [type] [addr]", "Print a struct. Addr is optional.", KdbpCmdPrintStruct }, +#endif /* Flow control */ { NULL, NULL, "Flow control", NULL }, @@ -150,6 +174,8 @@ static const struct { "bugcheck", "bugcheck", "Bugchecks the system.", KdbpCmdBugCheck }, { "filter", "filter [error|warning|trace|info|level]+|-[componentname|default]", "Enable/disable debug channels", KdbpCmdFilter }, { "set", "set [var] [value]", "Sets var to value or displays value of var.", KdbpCmdSet }, + { "dmesg", "dmesg", "Display debug messages on screen, with navigation on pages.", KdbpCmdDmesg }, + { "kmsg", "kmsg", "Kernel dmesg. Alias for dmesg.", KdbpCmdDmesg }, { "help", "help", "Display help screen.", KdbpCmdHelp } }; @@ -434,6 +460,144 @@ KdbpCmdEvalExpression( return TRUE; } +#ifdef __ROS_CMAKE__ + +/*!\brief Print a struct + */ +static VOID +KdbpPrintStructInternal +(PROSSYM_INFO Info, + PCHAR Indent, + BOOLEAN DoRead, + PVOID BaseAddress, + PROSSYM_AGGREGATE Aggregate) +{ + ULONG i; + ULONGLONG Result; + PROSSYM_AGGREGATE_MEMBER Member; + ULONG IndentLen = strlen(Indent); + ROSSYM_AGGREGATE MemberAggregate = {0 }; + + for (i = 0; i < Aggregate->NumElements; i++) { + Member = &Aggregate->Elements[i]; + KdbpPrint("%s%p+%x: %s", Indent, ((PCHAR)BaseAddress) + Member->BaseOffset, Member->Size, Member->Name ? Member->Name : ""); + if (DoRead) { + if (!strcmp(Member->Type, "_UNICODE_STRING")) { + KdbpPrint("\"%wZ\"\n", ((PCHAR)BaseAddress) + Member->BaseOffset); + continue; + } else if (!strcmp(Member->Type, "PUNICODE_STRING")) { + KdbpPrint("\"%wZ\"\n", *(((PUNICODE_STRING*)((PCHAR)BaseAddress) + Member->BaseOffset))); + continue; + } + switch (Member->Size) { + case 1: + case 2: + case 4: + case 8: { + Result = 0; + if (NT_SUCCESS(KdbpSafeReadMemory(&Result, ((PCHAR)BaseAddress) + Member->BaseOffset, Member->Size))) { + if (Member->Bits) { + Result >>= Member->FirstBit; + Result &= ((1 << Member->Bits) - 1); + } + KdbpPrint(" %lx\n", Result); + } + else goto readfail; + break; + } + default: { + if (Member->Size < 8) { + if (NT_SUCCESS(KdbpSafeReadMemory(&Result, ((PCHAR)BaseAddress) + Member->BaseOffset, Member->Size))) { + ULONG j; + for (j = 0; j < Member->Size; j++) { + KdbpPrint(" %02x", (int)(Result & 0xff)); + Result >>= 8; + } + } else goto readfail; + } else { + KdbpPrint(" %s @ %p {\n", Member->Type, ((PCHAR)BaseAddress) + Member->BaseOffset); + Indent[IndentLen] = ' '; + if (RosSymAggregate(Info, Member->Type, &MemberAggregate)) { + KdbpPrintStructInternal(Info, Indent, DoRead, ((PCHAR)BaseAddress) + Member->BaseOffset, &MemberAggregate); + RosSymFreeAggregate(&MemberAggregate); + } + Indent[IndentLen] = 0; + KdbpPrint("%s}\n", Indent); + } break; + } + } + } else { + readfail: + if (Member->Size <= 8) { + KdbpPrint(" ??\n"); + } else { + KdbpPrint(" %s @ %x {\n", Member->Type, Member->BaseOffset); + Indent[IndentLen] = ' '; + if (RosSymAggregate(Info, Member->Type, &MemberAggregate)) { + KdbpPrintStructInternal(Info, Indent, DoRead, BaseAddress, &MemberAggregate); + RosSymFreeAggregate(&MemberAggregate); + } + Indent[IndentLen] = 0; + KdbpPrint("%s}\n", Indent); + } + } + } +} + +PROSSYM_INFO KdbpSymFindCachedFile(PUNICODE_STRING ModName); + +static BOOLEAN +KdbpCmdPrintStruct( + ULONG Argc, + PCHAR Argv[]) +{ + ULONG i; + ULONGLONG Result = 0; + PVOID BaseAddress = 0; + ROSSYM_AGGREGATE Aggregate = {0}; + UNICODE_STRING ModName = {0}; + ANSI_STRING AnsiName = {0}; + CHAR Indent[100] = {0}; + PROSSYM_INFO Info; + + if (Argc < 3) goto end; + AnsiName.Length = AnsiName.MaximumLength = strlen(Argv[1]); + AnsiName.Buffer = Argv[1]; + RtlAnsiStringToUnicodeString(&ModName, &AnsiName, TRUE); + Info = KdbpSymFindCachedFile(&ModName); + + if (!Info || !RosSymAggregate(Info, Argv[2], &Aggregate)) { + DPRINT1("Could not get aggregate\n"); + goto end; + } + + // Get an argument for location if it was given + if (Argc > 3) { + ULONG len; + PCHAR ArgStart = Argv[3]; + DPRINT1("Trying to get expression\n"); + for (i = 3; i < Argc - 1; i++) + { + len = strlen(Argv[i]); + Argv[i][len] = ' '; + } + + /* Evaluate the expression */ + DPRINT1("Arg: %s\n", ArgStart); + if (KdbpEvaluateExpression(ArgStart, strlen(ArgStart), &Result)) { + BaseAddress = (PVOID)(ULONG_PTR)Result; + DPRINT1("BaseAddress: %p\n", BaseAddress); + } + } + DPRINT1("BaseAddress %p\n", BaseAddress); + KdbpPrintStructInternal(Info, Indent, !!BaseAddress, BaseAddress, &Aggregate); +end: + RosSymFreeAggregate(&Aggregate); + RtlFreeUnicodeString(&ModName); + return TRUE; +} +#endif + /*!\brief Display list of active debug channels */ static BOOLEAN @@ -595,7 +759,7 @@ KdbpCmdDisassembleX( while (Count > 0) { - if (!KdbSymPrintAddress((PVOID)Address)) + if (!KdbSymPrintAddress((PVOID)Address, NULL)) KdbpPrint("<%x>:", Address); else KdbpPrint(":"); @@ -621,7 +785,7 @@ KdbpCmdDisassembleX( /* Disassemble */ while (Count-- > 0) { - if (!KdbSymPrintAddress((PVOID)Address)) + if (!KdbSymPrintAddress((PVOID)Address, NULL)) KdbpPrint("<%08x>: ", Address); else KdbpPrint(": "); @@ -794,6 +958,7 @@ KdbpCmdBackTrace( ULONGLONG Result = 0; ULONG_PTR Frame = KdbCurrentTrapFrame->Tf.Ebp; ULONG_PTR Address; + KTRAP_FRAME TrapFrame; if (Argc >= 2) { @@ -853,15 +1018,19 @@ KdbpCmdBackTrace( KdbpPrint("Eip:\n"); /* Try printing the function at EIP */ - if (!KdbSymPrintAddress((PVOID)KdbCurrentTrapFrame->Tf.Eip)) + if (!KdbSymPrintAddress((PVOID)KdbCurrentTrapFrame->Tf.Eip, &KdbCurrentTrapFrame->Tf)) KdbpPrint("<%08x>\n", KdbCurrentTrapFrame->Tf.Eip); else KdbpPrint("\n"); } + TrapFrame = KdbCurrentTrapFrame->Tf; KdbpPrint("Frames:\n"); + for (;;) { + BOOLEAN GotNextFrame; + if (Frame == 0) break; @@ -871,8 +1040,11 @@ KdbpCmdBackTrace( break; } + if ((GotNextFrame = NT_SUCCESS(KdbpSafeReadMemory(&Frame, (PVOID)Frame, sizeof (ULONG_PTR))))) + TrapFrame.Ebp = Frame; + /* Print the location of the call instruction */ - if (!KdbSymPrintAddress((PVOID)(Address - 5))) + if (!KdbSymPrintAddress((PVOID)(Address - 5), &TrapFrame)) KdbpPrint("<%08x>\n", Address); else KdbpPrint("\n"); @@ -882,7 +1054,7 @@ KdbpCmdBackTrace( if (Address == 0) break; - if (!NT_SUCCESS(KdbpSafeReadMemory(&Frame, (PVOID)Frame, sizeof (ULONG_PTR)))) + if (!GotNextFrame) { KdbpPrint("Couldn't access memory at 0x%p!\n", Frame); break; @@ -1160,7 +1332,7 @@ KdbpCmdBreakPoint(ULONG Argc, PCHAR Argv[]) if (strcmp(Argv[i+1], "IF") == 0) /* IF found */ { ConditionArgIndex = i + 2; - if (ConditionArgIndex >= Argc) + if ((ULONG)ConditionArgIndex >= Argc) { KdbpPrint("%s: IF requires condition expression.\n", Argv[0]); return TRUE; @@ -1887,6 +2059,58 @@ KdbpCmdBugCheck( return FALSE; } +VOID +KdbpPager( + IN PCHAR Buffer, + IN ULONG BufLength); + +/*!\brief Display debug messages on screen, with paging. + * + * Keys for per-page view: Home, End, PageUp, Arrow Up, PageDown, + * all others are as PageDown. + */ +static BOOLEAN +KdbpCmdDmesg( + ULONG Argc, + PCHAR Argv[]) +{ + ULONG beg, end; + + KdbpIsInDmesgMode = TRUE; /* Toggle logging flag */ + if (!KdpDmesgBuffer) + { + KdbpPrint("Dmesg: error, buffer is not allocated! /DEBUGPORT=SCREEN kernel param required for dmesg.\n"); + return TRUE; + } + + KdbpPrint("*** Dmesg *** TotalWritten=%lu, BufferSize=%lu, CurrentPosition=%lu\n", + KdbDmesgTotalWritten, KdpDmesgBufferSize, KdpDmesgCurrentPosition); + + // Pass data to the pager: + end = KdpDmesgCurrentPosition; + beg = (end + KdpDmesgFreeBytes) % KdpDmesgBufferSize; + + // no roll-overs, and overwritten=lost bytes + if (KdbDmesgTotalWritten <= KdpDmesgBufferSize) + { + // show buffer (KdpDmesgBuffer + beg, num) + KdbpPager(KdpDmesgBuffer, KdpDmesgCurrentPosition); + } + else + { + // show 2 buffers: (KdpDmesgBuffer + beg, KdpDmesgBufferSize - beg) + // and: (KdpDmesgBuffer, end) + KdbpPager(KdpDmesgBuffer + beg, KdpDmesgBufferSize - beg); + KdbpPrint("*** Dmesg: buffer rollup ***\n"); + KdbpPager(KdpDmesgBuffer, end); + } + KdbpPrint("*** Dmesg: end of output ***\n"); + + KdbpIsInDmesgMode = FALSE; /* Toggle logging flag */ + + return TRUE; +} + /*!\brief Sets or displays a config variables value. */ static BOOLEAN @@ -2102,6 +2326,7 @@ KdbpCmdHelp( * * \note Doesn't correctly handle \\t and terminal escape sequences when calculating the * number of lines required to print a single line from the Buffer in the terminal. + * Prints maximum 4096 chars, because of its buffer size. */ VOID KdbpPrint( @@ -2207,12 +2432,12 @@ KdbpPrint( if (KdbNumberOfRowsTerminal <= 0) { /* Set number of rows to the default. */ - KdbNumberOfRowsTerminal = 24; + KdbNumberOfRowsTerminal = 23; //24; //Mna.: 23 for SCREEN debugport } else if (KdbNumberOfColsTerminal <= 0) { /* Set number of cols to the default. */ - KdbNumberOfColsTerminal = 80; + KdbNumberOfColsTerminal = 75; //80; //Mna.: 75 for SCREEN debugport } } @@ -2248,6 +2473,7 @@ KdbpPrint( DbgPrint("\n"); DbgPrint("--- Press q to abort, any other key to continue ---"); + RowsPrintedByTerminal++; /* added by Mna. */ if (KdbDebugState & KD_DEBUG_KDSERIAL) c = KdbpGetCharSerial(); @@ -2329,6 +2555,351 @@ KdbpPrint( } } +/** memrchr(), explicitly defined, since was absent in MinGW of RosBE. */ +/* + * Reverse memchr() + * Find the last occurrence of 'c' in the buffer 's' of size 'n'. + */ +void * +memrchr(const void *s, int c, size_t n) +{ + const unsigned char *cp; + + if (n != 0) + { + cp = (unsigned char *)s + n; + do + { + if (*(--cp) == (unsigned char)c) + return (void *)cp; + } while (--n != 0); + } + return NULL; +} + +/*!\brief Calculate pointer position for N lines upper of current position. + * + * \param Buffer Characters buffer to operate on. + * \param BufLength Buffer size. + * + * \note Calculate pointer position for N lines upper of current displaying + * position within the given buffer. + * + * Used by KdbpPager(). + * Now N lines count is hardcoded to KdbNumberOfRowsTerminal. + */ +PCHAR +CountOnePageUp(PCHAR Buffer, ULONG BufLength, PCHAR pCurPos) +{ + PCHAR p; + // p0 is initial guess of Page Start + ULONG p0len = KdbNumberOfRowsTerminal * KdbNumberOfColsTerminal; + PCHAR p0 = pCurPos - p0len; + PCHAR prev_p = p0, p1; + ULONG j; + + if (pCurPos < Buffer) + pCurPos = Buffer; + ASSERT(pCurPos <= Buffer + BufLength); + + p = memrchr(p0, '\n', p0len); + if (NULL == p) + p = p0; + for (j = KdbNumberOfRowsTerminal; j--; ) + { + int linesCnt; + p1 = memrchr(p0, '\n', p-p0); + prev_p = p; + p = p1; + if (NULL == p) + { + p = prev_p; + if (NULL == p) + p = p0; + break; + } + linesCnt = (KdbNumberOfColsTerminal+prev_p-p-2) / KdbNumberOfColsTerminal; + if (linesCnt > 1) + j -= linesCnt-1; + } + + ASSERT(p != 0); + ++p; + return p; +} + +/*!\brief Prints the given string with, page by page. + * + * \param Buffer Characters buffer to print. + * \param BufferLen Buffer size. + * + * \note Doesn't correctly handle \\t and terminal escape sequences when calculating the + * number of lines required to print a single line from the Buffer in the terminal. + * Maximum length of buffer is limited only by memory size. + * + * Note: BufLength should be greater then (KdbNumberOfRowsTerminal * KdbNumberOfColsTerminal). + * + */ +VOID +KdbpPager( + IN PCHAR Buffer, + IN ULONG BufLength) +{ + static CHAR InBuffer[4096]; + static BOOLEAN TerminalInitialized = FALSE; + static BOOLEAN TerminalConnected = FALSE; + static BOOLEAN TerminalReportsSize = TRUE; + CHAR c = '\0'; + PCHAR p, p2; + ULONG Length; + ULONG i, j; + LONG RowsPrintedByTerminal; + ULONG ScanCode; + + if( BufLength == 0) + return; + + /* Check if the user has aborted output of the current command */ + if (KdbOutputAborted) + return; + + /* Initialize the terminal */ + if (!TerminalInitialized) + { + DbgPrint("\x1b[7h"); /* Enable linewrap */ + + /* Query terminal type */ + /*DbgPrint("\x1b[Z");*/ + DbgPrint("\x05"); + + TerminalInitialized = TRUE; + Length = 0; + KeStallExecutionProcessor(100000); + + for (;;) + { + c = KdbpTryGetCharSerial(5000); + if (c == -1) + break; + + InBuffer[Length++] = c; + if (Length >= (sizeof (InBuffer) - 1)) + break; + } + + InBuffer[Length] = '\0'; + if (Length > 0) + TerminalConnected = TRUE; + } + + /* Get number of rows and columns in terminal */ + if ((KdbNumberOfRowsTerminal < 0) || (KdbNumberOfColsTerminal < 0) || + (KdbNumberOfRowsPrinted) == 0) /* Refresh terminal size each time when number of rows printed is 0 */ + { + if ((KdbDebugState & KD_DEBUG_KDSERIAL) && TerminalConnected && TerminalReportsSize) + { + /* Try to query number of rows from terminal. A reply looks like "\x1b[8;24;80t" */ + TerminalReportsSize = FALSE; + KeStallExecutionProcessor(100000); + DbgPrint("\x1b[18t"); + c = KdbpTryGetCharSerial(5000); + + if (c == KEY_ESC) + { + c = KdbpTryGetCharSerial(5000); + if (c == '[') + { + Length = 0; + + for (;;) + { + c = KdbpTryGetCharSerial(5000); + if (c == -1) + break; + + InBuffer[Length++] = c; + if (isalpha(c) || Length >= (sizeof (InBuffer) - 1)) + break; + } + + InBuffer[Length] = '\0'; + if (InBuffer[0] == '8' && InBuffer[1] == ';') + { + for (i = 2; (i < Length) && (InBuffer[i] != ';'); i++); + + if (Buffer[i] == ';') + { + Buffer[i++] = '\0'; + + /* Number of rows is now at Buffer + 2 and number of cols at Buffer + i */ + KdbNumberOfRowsTerminal = strtoul(InBuffer + 2, NULL, 0); + KdbNumberOfColsTerminal = strtoul(InBuffer + i, NULL, 0); + TerminalReportsSize = TRUE; + } + } + } + /* Clear further characters */ + while ((c = KdbpTryGetCharSerial(5000)) != -1); + } + } + + if (KdbNumberOfRowsTerminal <= 0) + { + /* Set number of rows to the default. */ + KdbNumberOfRowsTerminal = 24; + } + else if (KdbNumberOfColsTerminal <= 0) + { + /* Set number of cols to the default. */ + KdbNumberOfColsTerminal = 80; + } + } + + /* Get the string */ + p = Buffer; + + while (p[0] != '\0') + { + if ( p > Buffer+BufLength) + { + DbgPrint("Dmesg: error, p > Buffer+BufLength,d=%d", p - (Buffer+BufLength)); + return; + } + i = strcspn(p, "\n"); + + // Are we out of buffer? + if (p + i > Buffer + BufLength) + // Leaving pager function: + break; + + /* Calculate the number of lines which will be printed in the terminal + * when outputting the current line + */ + if (i > 0) + RowsPrintedByTerminal = (i + KdbNumberOfColsPrinted - 1) / KdbNumberOfColsTerminal; + else + RowsPrintedByTerminal = 0; + + if (p[i] == '\n') + RowsPrintedByTerminal++; + + /*DbgPrint("!%d!%d!%d!%d!", KdbNumberOfRowsPrinted, KdbNumberOfColsPrinted, i, RowsPrintedByTerminal);*/ + + /* Display a prompt if we printed one screen full of text */ + if (KdbNumberOfRowsTerminal > 0 && + (LONG)(KdbNumberOfRowsPrinted + RowsPrintedByTerminal) >= KdbNumberOfRowsTerminal) + { + if (KdbNumberOfColsPrinted > 0) + DbgPrint("\n"); + + DbgPrint("--- Press q to abort, e/End,h/Home,u/PgUp, other key/PgDn ---"); + RowsPrintedByTerminal++; + + if (KdbDebugState & KD_DEBUG_KDSERIAL) + c = KdbpGetCharSerial(); + else + c = KdbpGetCharKeyboard(&ScanCode); + + if (c == '\r') + { + /* Try to read '\n' which might follow '\r' - if \n is not received here + * it will be interpreted as "return" when the next command should be read. + */ + if (KdbDebugState & KD_DEBUG_KDSERIAL) + c = KdbpTryGetCharSerial(5); + else + c = KdbpTryGetCharKeyboard(&ScanCode, 5); + } + + //DbgPrint("\n"); //Consize version: don't show pressed key + DbgPrint(" '%c'/scan=%04x\n", c, ScanCode); // Shows pressed key + + if (c == 'q') + { + KdbOutputAborted = TRUE; + return; + } + if ( ScanCode == KEYSC_END || c=='e') + { + PCHAR pBufEnd = Buffer + BufLength; + p = CountOnePageUp(Buffer, BufLength, pBufEnd); + i = strcspn(p, "\n"); + } + else if (ScanCode == KEYSC_PAGEUP || c=='u') + { + p = CountOnePageUp(Buffer, BufLength, p); + i = strcspn(p, "\n"); + } + else if (ScanCode == KEYSC_HOME || c=='h') + { + p = Buffer; + i = strcspn(p, "\n"); + } + else if (ScanCode == KEYSC_ARROWUP) + { + p = CountOnePageUp(Buffer, BufLength, p); + i = strcspn(p, "\n"); + } + + KdbNumberOfRowsPrinted = 0; + KdbNumberOfColsPrinted = 0; + } + + /* Insert a NUL after the line and print only the current line. */ + if (p[i] == '\n' && p[i + 1] != '\0') + { + c = p[i + 1]; + p[i + 1] = '\0'; + } + else + { + c = '\0'; + } + + /* Remove escape sequences from the line if there's no terminal connected */ + if (!TerminalConnected) + { + while ((p2 = strrchr(p, '\x1b'))) /* Look for escape character */ + { + if (p2[1] == '[') + { + j = 2; + while (!isalpha(p2[j++])); + strcpy(p2, p2 + j); + } + else + { + strcpy(p2, p2 + 1); + } + } + } + + // The main printing of the current line: + DbgPrint(p); + + // restore not null char with saved: + if (c != '\0') + p[i + 1] = c; + + /* Set p to the start of the next line and + * remember the number of rows/cols printed + */ + p += i; + if (p[0] == '\n') + { + p++; + KdbNumberOfColsPrinted = 0; + } + else + { + ASSERT(p[0] == '\0'); + KdbNumberOfColsPrinted += i; + } + + KdbNumberOfRowsPrinted += RowsPrintedByTerminal; + } +} + /*!\brief Appends a command to the command history * * \param Command Pointer to the command to append to the history. @@ -2666,7 +3237,7 @@ KdbpCliMainLoop( if (EnteredOnSingleStep) { - if (!KdbSymPrintAddress((PVOID)KdbCurrentTrapFrame->Tf.Eip)) + if (!KdbSymPrintAddress((PVOID)KdbCurrentTrapFrame->Tf.Eip, &KdbCurrentTrapFrame->Tf)) { KdbpPrint("<%x>", KdbCurrentTrapFrame->Tf.Eip); } @@ -2693,6 +3264,9 @@ KdbpCliMainLoop( /* Main loop */ do { + /* Reset the number of rows/cols printed */ + KdbNumberOfRowsPrinted = KdbNumberOfColsPrinted = 0; + /* Print the prompt */ KdbpPrint("kdb:> "); @@ -2957,7 +3531,7 @@ KdpPrompt(IN LPSTR InString, KdbpTryGetCharKeyboard(&DummyScanCode, 5); } - /* + /* * Null terminate the output string -- documentation states that * DbgPrompt does not null terminate, but it does */ @@ -2965,7 +3539,7 @@ KdpPrompt(IN LPSTR InString, /* Print a new line */ KdPortPutByteEx(&SerialPortInfo, '\r'); - KdPortPutByteEx(&SerialPortInfo, '\n'); + KdPortPutByteEx(&SerialPortInfo, '\n'); /* Release spinlock */ KiReleaseSpinLock(&KdpSerialSpinLock); diff --git a/ntoskrnl/kdbg/kdb_symbols.c b/ntoskrnl/kdbg/kdb_symbols.c index 6caf0fd6df9..f54f1cc14c1 100644 --- a/ntoskrnl/kdbg/kdb_symbols.c +++ b/ntoskrnl/kdbg/kdb_symbols.c @@ -122,7 +122,8 @@ KdbpSymFindModule( */ BOOLEAN KdbSymPrintAddress( - IN PVOID Address) + IN PVOID Address, + IN PKTRAP_FRAME Context) { PLDR_DATA_TABLE_ENTRY LdrEntry; ULONG_PTR RelativeAddress; @@ -248,6 +249,7 @@ KdbpSymAddCachedFile( IN PROSSYM_INFO RosSymInfo) { PIMAGE_SYMBOL_INFO_CACHE CacheEntry; + KIRQL Irql; DPRINT("Adding symbol file: RosSymInfo = %p\n", RosSymInfo); @@ -264,7 +266,9 @@ KdbpSymAddCachedFile( ASSERT(CacheEntry->FileName.Buffer); CacheEntry->RefCount = 1; CacheEntry->RosSymInfo = RosSymInfo; - InsertTailList(&SymbolFileListHead, &CacheEntry->ListEntry); /* FIXME: Lock list? */ + KeAcquireSpinLock(&SymbolFileListLock, &Irql); + InsertTailList(&SymbolFileListHead, &CacheEntry->ListEntry); + KeReleaseSpinLock(&SymbolFileListLock, Irql); } /*! \brief Remove a symbol file (reference) from the cache. diff --git a/ntoskrnl/kdbg/kdb_symbols.cmake.c b/ntoskrnl/kdbg/kdb_symbols.cmake.c index 64325b1ba17..f176e78c0d8 100644 --- a/ntoskrnl/kdbg/kdb_symbols.cmake.c +++ b/ntoskrnl/kdbg/kdb_symbols.cmake.c @@ -28,7 +28,6 @@ typedef struct _IMAGE_SYMBOL_INFO_CACHE IMAGE_SYMBOL_INFO_CACHE, *PIMAGE_SYMBOL_INFO_CACHE; typedef struct _ROSSYM_KM_OWN_CONTEXT { - ROSSYM_OWN_FILECONTEXT Rossym; LARGE_INTEGER FileOffset; PFILE_OBJECT FileObject; } ROSSYM_KM_OWN_CONTEXT, *PROSSYM_KM_OWN_CONTEXT; @@ -36,8 +35,8 @@ typedef struct _ROSSYM_KM_OWN_CONTEXT { static BOOLEAN LoadSymbols; static LIST_ENTRY SymbolFileListHead; static KSPIN_LOCK SymbolFileListLock; -static PROSSYM_INFO KdbpRosSymInfo; -static ULONG_PTR KdbpImageBase; +//static PROSSYM_INFO KdbpRosSymInfo; +//static ULONG_PTR KdbpImageBase; BOOLEAN KdbpSymbolsInitialized = FALSE; /* FUNCTIONS ****************************************************************/ @@ -65,7 +64,7 @@ KdbpReadSymFile(PVOID FileContext, PVOID Buffer, ULONG Length) return NT_SUCCESS(Status); } -static PROSSYM_OWN_FILECONTEXT +static PROSSYM_KM_OWN_CONTEXT KdbpCaptureFileForSymbols(PFILE_OBJECT FileObject) { PROSSYM_KM_OWN_CONTEXT Context = ExAllocatePool(NonPagedPool, sizeof(*Context)); @@ -73,15 +72,12 @@ KdbpCaptureFileForSymbols(PFILE_OBJECT FileObject) ObReferenceObject(FileObject); Context->FileOffset.QuadPart = 0; Context->FileObject = FileObject; - Context->Rossym.ReadFileProc = KdbpReadSymFile; - Context->Rossym.SeekFileProc = KdbpSeekSymFile; - return &Context->Rossym; + return Context; } static VOID -KdbpReleaseFileForSymbols(PROSSYM_OWN_FILECONTEXT FileContext) +KdbpReleaseFileForSymbols(PROSSYM_KM_OWN_CONTEXT Context) { - PROSSYM_KM_OWN_CONTEXT Context = (PROSSYM_KM_OWN_CONTEXT)FileContext; ObDereferenceObject(Context->FileObject); ExFreePool(Context); } @@ -175,31 +171,80 @@ KdbpSymFindModule( */ BOOLEAN KdbSymPrintAddress( - IN PVOID Address) + IN PVOID Address, + IN PKTRAP_FRAME Context) { + int i; PMEMORY_AREA MemoryArea = NULL; PROS_SECTION_OBJECT SectionObject; PLDR_DATA_TABLE_ENTRY LdrEntry; - PROSSYM_OWN_FILECONTEXT FileContext; +#if 0 + PROSSYM_KM_OWN_CONTEXT FileContext; +#endif ULONG_PTR RelativeAddress; NTSTATUS Status; - ULONG LineNumber; - CHAR FileName[256]; - CHAR FunctionName[256]; + ROSSYM_LINEINFO LineInfo = {0}; + + struct { + enum _ROSSYM_REGNAME regname; + size_t ctx_offset; + } regmap[] = { + { ROSSYM_X86_EDX, FIELD_OFFSET(KTRAP_FRAME, Edx) }, + { ROSSYM_X86_EAX, FIELD_OFFSET(KTRAP_FRAME, Eax) }, + { ROSSYM_X86_ECX, FIELD_OFFSET(KTRAP_FRAME, Ecx) }, + { ROSSYM_X86_EBX, FIELD_OFFSET(KTRAP_FRAME, Ebx) }, + { ROSSYM_X86_ESI, FIELD_OFFSET(KTRAP_FRAME, Esi) }, + { ROSSYM_X86_EDI, FIELD_OFFSET(KTRAP_FRAME, Edi) }, + { ROSSYM_X86_EBP, FIELD_OFFSET(KTRAP_FRAME, Ebp) }, + { ROSSYM_X86_ESP, FIELD_OFFSET(KTRAP_FRAME, HardwareEsp) } + }; + + if (Context) + { +#if 0 + // Disable arguments for now + DPRINT("Has Context %x (EBP %x)\n", Context, Context->Ebp); + LineInfo.Flags = ROSSYM_LINEINFO_HAS_REGISTERS; +#endif + + for (i = 0; i < sizeof(regmap) / sizeof(regmap[0]); i++) { + memcpy + (&LineInfo.Registers.Registers[regmap[i].regname], + ((PCHAR)Context)+regmap[i].ctx_offset, + sizeof(ULONG_PTR)); + DPRINT("DWARF REG[%d] -> %x\n", regmap[i].regname, LineInfo.Registers.Registers[regmap[i].regname]); + } + } if (!KdbpSymbolsInitialized || !KdbpSymFindModule(Address, NULL, -1, &LdrEntry)) return FALSE; RelativeAddress = (ULONG_PTR)Address - (ULONG_PTR)LdrEntry->DllBase; - Status = KdbSymGetAddressInformation(LdrEntry->PatchInformation, - RelativeAddress, - &LineNumber, - FileName, - FunctionName); + Status = KdbSymGetAddressInformation + (LdrEntry->PatchInformation, + RelativeAddress, + &LineInfo); + if (NT_SUCCESS(Status)) { DbgPrint("<%wZ:%x (%s:%d (%s))>", - &LdrEntry->BaseDllName, RelativeAddress, FileName, LineNumber, FunctionName); + &LdrEntry->BaseDllName, RelativeAddress, LineInfo.FileName, LineInfo.LineNumber, LineInfo.FunctionName); + if (Context && LineInfo.NumParams) + { + int i; + char *comma = ""; + DbgPrint("("); + for (i = 0; i < LineInfo.NumParams; i++) { + DbgPrint + ("%s%s=%llx", + comma, + LineInfo.Parameters[i].ValueName, + LineInfo.Parameters[i].Value); + comma = ","; + } + DbgPrint(")"); + } + return TRUE; } else if (Address < MmSystemRangeStart) @@ -209,8 +254,10 @@ KdbSymPrintAddress( { goto end; } + SectionObject = MemoryArea->Data.SectionData.Section; if (!(SectionObject->AllocationAttributes & SEC_IMAGE)) goto end; +#if 0 if (MemoryArea->StartingAddress != (PVOID)KdbpImageBase) { if (KdbpRosSymInfo) @@ -232,21 +279,41 @@ KdbSymPrintAddress( if (KdbpRosSymInfo) { RelativeAddress = (ULONG_PTR)Address - KdbpImageBase; + RosSymFreeInfo(&LineInfo); Status = KdbSymGetAddressInformation (KdbpRosSymInfo, RelativeAddress, - &LineNumber, - FileName, - FunctionName); + &LineInfo); if (NT_SUCCESS(Status)) { DbgPrint ("<%wZ:%x (%s:%d (%s))>", &SectionObject->FileObject->FileName, - RelativeAddress, FileName, LineNumber, FunctionName); + RelativeAddress, + LineInfo.FileName, + LineInfo.LineNumber, + LineInfo.FunctionName); + + if (Context && LineInfo.NumParams) + { + int i; + char *comma = ""; + DbgPrint("("); + for (i = 0; i < LineInfo.NumParams; i++) { + DbgPrint + ("%s%s=%llx", + comma, + LineInfo.Parameters[i].ValueName, + LineInfo.Parameters[i].Value); + comma = ","; + } + DbgPrint(")"); + } + return TRUE; } } +#endif } end: @@ -276,13 +343,11 @@ NTSTATUS KdbSymGetAddressInformation( IN PROSSYM_INFO RosSymInfo, IN ULONG_PTR RelativeAddress, - OUT PULONG LineNumber OPTIONAL, - OUT PCH FileName OPTIONAL, - OUT PCH FunctionName OPTIONAL) + IN PROSSYM_LINEINFO LineInfo) { if (!KdbpSymbolsInitialized || !RosSymInfo || - !RosSymGetAddressInformation(RosSymInfo, RelativeAddress, LineNumber, FileName, FunctionName)) + !RosSymGetAddressInformation(RosSymInfo, RelativeAddress, LineInfo)) { return STATUS_UNSUCCESSFUL; } @@ -302,7 +367,7 @@ KdbSymGetAddressInformation( * * \sa KdbpSymAddCachedFile */ -static PROSSYM_INFO +PROSSYM_INFO KdbpSymFindCachedFile( IN PUNICODE_STRING FileName) { @@ -348,7 +413,7 @@ KdbpSymAddCachedFile( { PIMAGE_SYMBOL_INFO_CACHE CacheEntry; - DPRINT("Adding symbol file: RosSymInfo = %p\n", RosSymInfo); + DPRINT("Adding symbol file: %wZ RosSymInfo = %p\n", FileName, RosSymInfo); /* allocate entry */ CacheEntry = ExAllocatePoolWithTag(NonPagedPool, sizeof (IMAGE_SYMBOL_INFO_CACHE), TAG_KDBS); @@ -359,6 +424,7 @@ KdbpSymAddCachedFile( CacheEntry->FileName.Buffer = ExAllocatePoolWithTag(NonPagedPool, FileName->Length, TAG_KDBS); + CacheEntry->FileName.MaximumLength = FileName->Length; RtlCopyUnicodeString(&CacheEntry->FileName, FileName); ASSERT(CacheEntry->FileName.Buffer); CacheEntry->RefCount = 1; @@ -419,7 +485,7 @@ KdbpSymRemoveCachedFile( * * \sa KdbpSymUnloadModuleSymbols */ -static VOID +VOID KdbpSymLoadModuleSymbols( IN PUNICODE_STRING FileName, OUT PROSSYM_INFO *RosSymInfo) @@ -429,7 +495,7 @@ KdbpSymLoadModuleSymbols( NTSTATUS Status; IO_STATUS_BLOCK IoStatusBlock; PFILE_OBJECT FileObject; - PROSSYM_OWN_FILECONTEXT FileContext; + PROSSYM_KM_OWN_CONTEXT FileContext; /* Allow KDB to break on module load */ KdbModuleLoaded(FileName); @@ -451,7 +517,7 @@ KdbpSymLoadModuleSymbols( /* Open the file */ InitializeObjectAttributes(&ObjectAttributes, FileName, - OBJ_CASE_INSENSITIVE, + OBJ_CASE_INSENSITIVE|OBJ_KERNEL_HANDLE, NULL, NULL); @@ -462,10 +528,10 @@ KdbpSymLoadModuleSymbols( &ObjectAttributes, &IoStatusBlock, FILE_SHARE_READ|FILE_SHARE_WRITE, - FILE_SYNCHRONOUS_IO_NONALERT); + FILE_NON_DIRECTORY_FILE|FILE_SYNCHRONOUS_IO_NONALERT); if (!NT_SUCCESS(Status)) { - DPRINT("Could not open image file: %wZ\n", FileName); + DPRINT("Could not open image file(%x): %wZ\n", Status, FileName); return; } @@ -491,8 +557,17 @@ KdbpSymLoadModuleSymbols( if (RosSymCreateFromFile(FileContext, RosSymInfo)) { /* add file to cache */ - KdbpSymAddCachedFile(FileName, *RosSymInfo); - DPRINT("Installed symbols: %wZ %p\n", FileName, *RosSymInfo); + int i; + UNICODE_STRING TruncatedName = *FileName; + for (i = (TruncatedName.Length / sizeof(WCHAR)) - 1; i >= 0; i--) + if (TruncatedName.Buffer[i] == '\\') { + TruncatedName.Buffer += i+1; + TruncatedName.Length -= (i+1)*sizeof(WCHAR); + TruncatedName.MaximumLength -= (i+1)*sizeof(WCHAR); + break; + } + KdbpSymAddCachedFile(&TruncatedName, *RosSymInfo); + DPRINT("Installed symbols: %wZ %p\n", &TruncatedName, *RosSymInfo); } KdbpReleaseFileForSymbols(FileContext); } @@ -512,13 +587,45 @@ KdbSymProcessSymbols( } /* Remove symbol info if it already exists */ - if (LdrEntry->PatchInformation) + if (LdrEntry->PatchInformation) { KdbpSymRemoveCachedFile(LdrEntry->PatchInformation); + } /* Error loading symbol info, try to load it from file */ KdbpSymLoadModuleSymbols(&LdrEntry->FullDllName, (PROSSYM_INFO*)&LdrEntry->PatchInformation); + if (!LdrEntry->PatchInformation) { + // HACK: module dll names don't identify the real files + UNICODE_STRING SystemRoot; + UNICODE_STRING ModuleNameCopy; + RtlInitUnicodeString(&SystemRoot, L"\\SystemRoot\\system32\\Drivers\\"); + ModuleNameCopy.Length = 0; + ModuleNameCopy.MaximumLength = + LdrEntry->BaseDllName.MaximumLength + SystemRoot.MaximumLength; + ModuleNameCopy.Buffer = ExAllocatePool(NonPagedPool, SystemRoot.MaximumLength + LdrEntry->BaseDllName.MaximumLength); + RtlCopyUnicodeString(&ModuleNameCopy, &SystemRoot); + RtlCopyMemory + (ModuleNameCopy.Buffer + ModuleNameCopy.Length / sizeof(WCHAR), + LdrEntry->BaseDllName.Buffer, + LdrEntry->BaseDllName.Length); + ModuleNameCopy.Length += LdrEntry->BaseDllName.Length; + KdbpSymLoadModuleSymbols(&ModuleNameCopy, + (PROSSYM_INFO*)&LdrEntry->PatchInformation); + if (!LdrEntry->PatchInformation) { + SystemRoot.Length -= strlen("Drivers\\") * sizeof(WCHAR); + RtlCopyUnicodeString(&ModuleNameCopy, &SystemRoot); + RtlCopyMemory + (ModuleNameCopy.Buffer + ModuleNameCopy.Length / sizeof(WCHAR), + LdrEntry->BaseDllName.Buffer, + LdrEntry->BaseDllName.Length); + ModuleNameCopy.Length += LdrEntry->BaseDllName.Length; + KdbpSymLoadModuleSymbols(&ModuleNameCopy, + (PROSSYM_INFO*)&LdrEntry->PatchInformation); + } + RtlFreeUnicodeString(&ModuleNameCopy); + } + /* It already added symbols to cache */ DPRINT("Installed symbols: %wZ@%p-%p %p\n", &LdrEntry->BaseDllName, @@ -536,6 +643,26 @@ KdbDebugPrint( /* Nothing here */ } +static PVOID KdbpSymAllocMem(ULONG_PTR size) +{ + return ExAllocatePoolWithTag(NonPagedPool, size, 'RSYM'); +} + +static VOID KdbpSymFreeMem(PVOID Area) +{ + return ExFreePool(Area); +} + +static BOOLEAN KdbpSymReadMem(PVOID FileContext, PVOID TargetDebug, PVOID SourceMem, ULONG Size) +{ + return NT_SUCCESS(KdbpSafeReadMemory(TargetDebug, SourceMem, Size)); +} + +static ROSSYM_CALLBACKS KdbpRosSymCallbacks = { + KdbpSymAllocMem, KdbpSymFreeMem, + KdbpReadSymFile, KdbpSeekSymFile, + KdbpSymReadMem +}; /*! \brief Initializes the KDB symbols implementation. * @@ -621,7 +748,7 @@ KdbInitialize( p1 = p2; } - RosSymInitKernelMode(); + RosSymInit(&KdbpRosSymCallbacks); } else if (BootPhase == 3) { diff --git a/ntoskrnl/ke/amd64/boot.S b/ntoskrnl/ke/amd64/boot.S index 4efbef3f94a..03da69ede75 100644 --- a/ntoskrnl/ke/amd64/boot.S +++ b/ntoskrnl/ke/amd64/boot.S @@ -8,7 +8,6 @@ /* INCLUDES ******************************************************************/ #include - #include EXTERN KiInitializeKernelAndGotoIdleLoop:PROC @@ -19,7 +18,6 @@ EXTERN KiInitializeKernelAndGotoIdleLoop:PROC /* FUNCTIONS *****************************************************************/ .code64 -.text /** * VOID diff --git a/ntoskrnl/ke/amd64/ctxswitch.S b/ntoskrnl/ke/amd64/ctxswitch.S index 1c9b13e5737..b0c52c233bc 100644 --- a/ntoskrnl/ke/amd64/ctxswitch.S +++ b/ntoskrnl/ke/amd64/ctxswitch.S @@ -10,7 +10,6 @@ /* INCLUDES ******************************************************************/ #include - #include /* FUNCTIONS ****************************************************************/ @@ -166,7 +165,7 @@ KiSwapContext: mov [rsp+0], rbp /* Get the PCR */ - mov rbx, gs:[KPCR_SELF] + mov rbx, gs:[PcSelf] /* Get the current thread */ mov rdi, rcx diff --git a/ntoskrnl/ke/amd64/spinlock.c b/ntoskrnl/ke/amd64/spinlock.c index 9c485fd8d43..ae19862c255 100644 --- a/ntoskrnl/ke/amd64/spinlock.c +++ b/ntoskrnl/ke/amd64/spinlock.c @@ -23,14 +23,14 @@ KIRQL KeAcquireSpinLockRaiseToSynch(PKSPIN_LOCK SpinLock) { -#ifndef CONFIG_SMP KIRQL OldIrql; - /* Simply raise to dispatch */ - KeRaiseIrql(DISPATCH_LEVEL, &OldIrql); + + /* Raise to sync */ + KeRaiseIrql(SYNCH_LEVEL, &OldIrql); + + /* Acquire the lock and return */ + KxAcquireSpinLock(SpinLock); return OldIrql; -#else - UNIMPLEMENTED; -#endif } /* @@ -40,14 +40,14 @@ KIRQL NTAPI KeAcquireSpinLockRaiseToDpc(PKSPIN_LOCK SpinLock) { -#ifndef CONFIG_SMP KIRQL OldIrql; - /* Simply raise to dispatch */ + + /* Raise to dispatch */ KeRaiseIrql(DISPATCH_LEVEL, &OldIrql); + + /* Acquire the lock and return */ + KxAcquireSpinLock(SpinLock); return OldIrql; -#else - UNIMPLEMENTED; -#endif } /* @@ -58,12 +58,9 @@ NTAPI KeReleaseSpinLock(PKSPIN_LOCK SpinLock, KIRQL OldIrql) { -#ifndef CONFIG_SMP - /* Simply lower IRQL back */ + /* Release the lock and lower IRQL back */ + KxReleaseSpinLock(SpinLock); KeLowerIrql(OldIrql); -#else - UNIMPLEMENTED; -#endif } /* @@ -72,14 +69,14 @@ KeReleaseSpinLock(PKSPIN_LOCK SpinLock, KIRQL KeAcquireQueuedSpinLock(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber) { -#ifndef CONFIG_SMP KIRQL OldIrql; - /* Simply raise to dispatch */ + + /* Raise to dispatch */ KeRaiseIrql(DISPATCH_LEVEL, &OldIrql); + + /* Acquire the lock */ + KxAcquireSpinLock(KeGetCurrentPrcb()->LockQueue[LockNumber].Lock); // HACK return OldIrql; -#else - UNIMPLEMENTED; -#endif } /* @@ -88,14 +85,14 @@ KeAcquireQueuedSpinLock(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber) KIRQL KeAcquireQueuedSpinLockRaiseToSynch(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber) { -#ifndef CONFIG_SMP KIRQL OldIrql; - /* Simply raise to dispatch */ - KeRaiseIrql(DISPATCH_LEVEL, &OldIrql); + + /* Raise to synch */ + KeRaiseIrql(SYNCH_LEVEL, &OldIrql); + + /* Acquire the lock */ + KxAcquireSpinLock(KeGetCurrentPrcb()->LockQueue[LockNumber].Lock); // HACK return OldIrql; -#else - UNIMPLEMENTED; -#endif } /* @@ -105,14 +102,18 @@ VOID KeAcquireInStackQueuedSpinLock(IN PKSPIN_LOCK SpinLock, IN PKLOCK_QUEUE_HANDLE LockHandle) { -#ifndef CONFIG_SMP - /* Simply raise to dispatch */ + /* Set up the lock */ + LockHandle->LockQueue.Next = NULL; + LockHandle->LockQueue.Lock = SpinLock; + + /* Raise to dispatch */ KeRaiseIrql(DISPATCH_LEVEL, &LockHandle->OldIrql); -#else - UNIMPLEMENTED; -#endif + + /* Acquire the lock */ + KxAcquireSpinLock(LockHandle->LockQueue.Lock); // HACK } + /* * @implemented */ @@ -120,14 +121,18 @@ VOID KeAcquireInStackQueuedSpinLockRaiseToSynch(IN PKSPIN_LOCK SpinLock, IN PKLOCK_QUEUE_HANDLE LockHandle) { -#ifndef CONFIG_SMP - /* Simply raise to synch */ + /* Set up the lock */ + LockHandle->LockQueue.Next = NULL; + LockHandle->LockQueue.Lock = SpinLock; + + /* Raise to synch */ KeRaiseIrql(SYNCH_LEVEL, &LockHandle->OldIrql); -#else - UNIMPLEMENTED; -#endif + + /* Acquire the lock */ + KxAcquireSpinLock(LockHandle->LockQueue.Lock); // HACK } + /* * @implemented */ @@ -135,28 +140,26 @@ VOID KeReleaseQueuedSpinLock(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber, IN KIRQL OldIrql) { -#ifndef CONFIG_SMP - /* Simply lower IRQL back */ + /* Release the lock */ + KxReleaseSpinLock(KeGetCurrentPrcb()->LockQueue[LockNumber].Lock); // HACK + + /* Lower IRQL back */ KeLowerIrql(OldIrql); -#else - UNIMPLEMENTED; -#endif } + /* * @implemented */ VOID KeReleaseInStackQueuedSpinLock(IN PKLOCK_QUEUE_HANDLE LockHandle) { -#ifndef CONFIG_SMP /* Simply lower IRQL back */ + KxReleaseSpinLock(LockHandle->LockQueue.Lock); // HACK KeLowerIrql(LockHandle->OldIrql); -#else - UNIMPLEMENTED; -#endif } + /* * @implemented */ @@ -168,10 +171,15 @@ KeTryToAcquireQueuedSpinLockRaiseToSynch(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber, /* Simply raise to dispatch */ KeRaiseIrql(DISPATCH_LEVEL, OldIrql); + /* Add an explicit memory barrier to prevent the compiler from reordering + memory accesses across the borders of spinlocks */ + KeMemoryBarrierWithoutFence(); + /* Always return true on UP Machines */ return TRUE; #else UNIMPLEMENTED; + ASSERT(FALSE); #endif } @@ -186,10 +194,15 @@ KeTryToAcquireQueuedSpinLock(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber, /* Simply raise to dispatch */ KeRaiseIrql(DISPATCH_LEVEL, OldIrql); + /* Add an explicit memory barrier to prevent the compiler from reordering + memory accesses across the borders of spinlocks */ + KeMemoryBarrierWithoutFence(); + /* Always return true on UP Machines */ return TRUE; #else UNIMPLEMENTED; + ASSERT(FALSE); #endif } diff --git a/ntoskrnl/ke/amd64/trap.S b/ntoskrnl/ke/amd64/trap.S index e0831d24f1e..4c41a877102 100644 --- a/ntoskrnl/ke/amd64/trap.S +++ b/ntoskrnl/ke/amd64/trap.S @@ -259,7 +259,6 @@ ENDM /* FUNCTIONS *****************************************************************/ -.text .code64 ALIGN 8 @@ -907,6 +906,8 @@ PUBLIC KiUnexpectedInterrupt .ENDP KiUnexpectedInterrupt #ifdef _MSC_VER +#undef lgdt +#undef lidt //void __lgdt(void *Source); PUBLIC __lgdt diff --git a/ntoskrnl/ke/arm/cpu.c b/ntoskrnl/ke/arm/cpu.c index 37d8a1569fd..5b458517cf1 100644 --- a/ntoskrnl/ke/arm/cpu.c +++ b/ntoskrnl/ke/arm/cpu.c @@ -90,23 +90,6 @@ KeInvalidateAllCaches(VOID) return TRUE; } -BOOLEAN -NTAPI -KeDisableInterrupts(VOID) -{ - ARM_STATUS_REGISTER Flags; - - // - // Get current interrupt state and disable interrupts - // - Flags = KeArmStatusRegisterGet(); - _disable(); - - // - // Return previous interrupt state - // - return Flags.IrqDisable; -} /* PUBLIC FUNCTIONS ***********************************************************/ @@ -130,17 +113,17 @@ KeFlushEntireTb(IN BOOLEAN Invalid, IN BOOLEAN AllProcessors) { KIRQL OldIrql; - + // // Raise the IRQL for the TB Flush // OldIrql = KeRaiseIrqlToSynchLevel(); - + // // Flush the TB for the Current CPU // KeFlushCurrentTb(); - + // // Return to Original IRQL // @@ -168,7 +151,7 @@ NTAPI KeQueryActiveProcessors(VOID) { PAGED_CODE(); - + // // Simply return the number of active processors // @@ -186,7 +169,7 @@ KeSaveStateForHibernate(IN PKPROCESSOR_STATE State) // Capture the context // RtlCaptureContext(&State->ContextFrame); - + // // Capture the control state // diff --git a/ntoskrnl/ke/bug.c b/ntoskrnl/ke/bug.c index 284f4252ccd..54a752842c2 100644 --- a/ntoskrnl/ke/bug.c +++ b/ntoskrnl/ke/bug.c @@ -266,7 +266,7 @@ KeRosDumpStackFrameArray(IN PULONG_PTR Frames, if (p) { #ifdef KDBG - if (!KdbSymPrintAddress((PVOID)Addr)) + if (!KdbSymPrintAddress((PVOID)Addr, NULL)) #endif { /* Print out the module name */ diff --git a/ntoskrnl/ke/freeldr.c b/ntoskrnl/ke/freeldr.c deleted file mode 100644 index 2e0d17ce178..00000000000 --- a/ntoskrnl/ke/freeldr.c +++ /dev/null @@ -1,1416 +0,0 @@ -/* - * PROJECT: ReactOS Kernel - * LICENSE: GPL - See COPYING in the top level directory - * FILE: ntoskrnl/ke/freeldr.c - * PURPOSE: FreeLDR Bootstrap Support - * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org) - */ - -/* INCLUDES *****************************************************************/ - -#if !defined(_X86_) - -#include -#define NDEBUG -#include - -#if defined(_PPC_) -#include -#define KERNEL_RVA(x) RVA(x,0x80800000) -#define KERNEL_DESCRIPTOR_PAGE(x) (((ULONG_PTR)x + KernelBase) >> PAGE_SHIFT) -#else -#define KERNEL_RVA(x) RVA(x,KSEG0_BASE) -#define KERNEL_DESCRIPTOR_PAGE(x) (((ULONG_PTR)x &~ KSEG0_BASE) >> PAGE_SHIFT) -#endif - -typedef struct _BIOS_MEMORY_DESCRIPTOR -{ - ULONG BlockBase; - ULONG BlockSize; -} BIOS_MEMORY_DESCRIPTOR, *PBIOS_MEMORY_DESCRIPTOR; - -/* GLOBALS *******************************************************************/ - -/* FreeLDR Loader Data */ -PROS_LOADER_PARAMETER_BLOCK KeRosLoaderBlock; -ADDRESS_RANGE KeMemoryMap[64]; -ULONG KeMemoryMapRangeCount; - -/* NT Loader Module/Descriptor Count */ -ULONG BldrCurrentMd; -ULONG BldrCurrentMod; - -/* NT Loader Data. Eats up about 100KB! */ -LOADER_PARAMETER_BLOCK BldrLoaderBlock; // 0x0000 -LOADER_PARAMETER_EXTENSION BldrExtensionBlock; // 0x0060 -CHAR BldrCommandLine[256]; // 0x00DC -CHAR BldrArcBootPath[64]; // 0x01DC -CHAR BldrArcHalPath[64]; // 0x021C -CHAR BldrNtHalPath[64]; // 0x025C -CHAR BldrNtBootPath[64]; // 0x029C -LDR_DATA_TABLE_ENTRY BldrModules[64]; // 0x02DC -MEMORY_ALLOCATION_DESCRIPTOR BldrMemoryDescriptors[60]; // 0x14DC -WCHAR BldrModuleStrings[64][260]; // 0x19DC -WCHAR BldrModuleStringsFull[64][260]; // 0x9BDC -NLS_DATA_BLOCK BldrNlsDataBlock; // 0x11DDC -SETUP_LOADER_BLOCK BldrSetupBlock; // 0x11DE8 -ARC_DISK_INFORMATION BldrArcDiskInfo; // 0x12134 -CHAR BldrArcNames[32][256]; // 0x1213C -ARC_DISK_SIGNATURE BldrDiskInfo[32]; // 0x1413C -CHAR BldrArcHwBuffer[16 * 1024]; // 0x1843C - -/* BIOS Memory Map */ -BIOS_MEMORY_DESCRIPTOR BiosMemoryDescriptors[16] = { { 0, 0 }, }; -PBIOS_MEMORY_DESCRIPTOR BiosMemoryDescriptorList = BiosMemoryDescriptors; - -/* ARC Memory Map */ -ULONG NumberDescriptors = 0; -MEMORY_DESCRIPTOR MDArray[60] = { { 0, 0, 0 }, }; - -#if defined(_X86_) - -/* The Boot TSS */ -KTSS KiBootTss; - -/* Old boot style IDT */ -KIDTENTRY KiBootIdt[256]; - -/* The Boot GDT */ -KGDTENTRY KiBootGdt[256] = -{ - {0x0000, 0x0000, {{0x00, 0x00, 0x00, 0x00}}}, /* KGDT_NULL */ - {0xffff, 0x0000, {{0x00, 0x9b, 0xcf, 0x00}}}, /* KGDT_R0_CODE */ - {0xffff, 0x0000, {{0x00, 0x93, 0xcf, 0x00}}}, /* KGDT_R0_DATA */ - {0xffff, 0x0000, {{0x00, 0xfb, 0xcf, 0x00}}}, /* KGDT_R3_CODE */ - {0xffff, 0x0000, {{0x00, 0xf3, 0xcf, 0x00}}}, /* KGDT_R3_DATA*/ - {0x0000, 0x0000, {{0x00, 0x00, 0x00, 0x00}}}, /* KGDT_TSS */ - {0x0001, 0xf000, {{0xdf, 0x93, 0xc0, 0xff}}}, /* KGDT_R0_PCR */ - {0x0fff, 0x0000, {{0x00, 0xf3, 0x40, 0x00}}}, /* KGDT_R3_TEB */ - {0x0000, 0x0000, {{0x00, 0x00, 0x00, 0x00}}}, /* KGDT_UNUSED */ - {0x0000, 0x0000, {{0x00, 0x00, 0x00, 0x00}}}, /* KGDT_LDT */ - {0x0000, 0x0000, {{0x00, 0x00, 0x00, 0x00}}}, /* KGDT_DF_TSS */ - {0x0000, 0x0000, {{0x00, 0x00, 0x00, 0x00}}} /* KGDT_NMI_TSS */ -}; - -/* GDT Descriptor */ -KDESCRIPTOR KiGdtDescriptor = {0, sizeof(KiBootGdt) - 1, (ULONG)KiBootGdt}; - -#endif - -/* FUNCTIONS *****************************************************************/ - -PMEMORY_ALLOCATION_DESCRIPTOR -NTAPI -KiRosGetMdFromArray(VOID) -{ - /* Return the next MD from the list, but make sure we don't overflow */ - if (BldrCurrentMd > 60) ASSERT(FALSE); - return &BldrMemoryDescriptors[BldrCurrentMd++]; -} - -VOID -NTAPI -KiRosAddBiosBlock(ULONG Address, - ULONG Size) -{ - PBIOS_MEMORY_DESCRIPTOR BiosBlock = BiosMemoryDescriptorList; - - /* Loop our BIOS Memory Descriptor List */ - while (BiosBlock->BlockSize > 0) - { - /* Check if we've found a matching head block */ - if (Address + Size == BiosBlock->BlockBase) - { - /* Simply enlarge and rebase it */ - BiosBlock->BlockBase = Address; - BiosBlock->BlockSize += Size; - break; - } - - /* Check if we've found a matching tail block */ - if (Address == (BiosBlock->BlockBase + BiosBlock->BlockSize)) - { - /* Simply enlarge it */ - BiosBlock->BlockSize += Size; - break; - } - - /* Nothing suitable found, try the next block */ - BiosBlock++; - } - - /* No usable blocks found, found a free block instead */ - if (!BiosBlock->BlockSize) - { - /* Write our data */ - BiosBlock->BlockBase = Address; - BiosBlock->BlockSize = Size; - - /* Create a new block and mark it as the end of the array */ - BiosBlock++; - BiosBlock->BlockBase = BiosBlock->BlockSize = 0L; - } -} - -VOID -NTAPI -KiRosBuildBiosMemoryMap(VOID) -{ - ULONG BlockBegin, BlockEnd; - ULONG j; - - /* Loop the BIOS Memory Map */ - for (j = 0; j < KeMemoryMapRangeCount; j++) - { - /* Get the start and end addresses */ - BlockBegin = KeMemoryMap[j].BaseAddrLow; - BlockEnd = KeMemoryMap[j].BaseAddrLow + KeMemoryMap[j].LengthLow - 1; - - /* Make sure this isn't a > 4GB descriptor */ - if (!KeMemoryMap[j].BaseAddrHigh) - { - /* Make sure we don't overflow */ - if (BlockEnd < BlockBegin) BlockEnd = 0xFFFFFFFF; - - /* Check if this is free memory */ - if (KeMemoryMap[j].Type == 1) - { - /* Add it to our BIOS descriptors */ - KiRosAddBiosBlock(BlockBegin, BlockEnd - BlockBegin + 1); - } - } - } -} - -NTSTATUS -NTAPI -KiRosAllocateArcDescriptor(IN ULONG PageBegin, - IN ULONG PageEnd, - IN MEMORY_TYPE MemoryType) -{ - ULONG i; - - /* Loop all our descriptors */ - for (i = 0; i < NumberDescriptors; i++) - { - /* Attempt to fing a free block that describes our region */ - if ((MDArray[i].MemoryType == MemoryFree) && - (MDArray[i].BasePage <= PageBegin) && - (MDArray[i].BasePage + MDArray[i].PageCount > PageBegin) && - (MDArray[i].BasePage + MDArray[i].PageCount >= PageEnd)) - { - /* Found one! */ - break; - } - } - - /* Check if we found no free blocks, and fail if so */ - if (i == NumberDescriptors) return ENOMEM; - - /* Check if the block has our base address */ - if (MDArray[i].BasePage == PageBegin) - { - /* Check if it also has our ending address */ - if ((MDArray[i].BasePage + MDArray[i].PageCount) == PageEnd) - { - /* Then convert this region into our new memory type */ - MDArray[i].MemoryType = MemoryType; - } - else - { - /* Otherwise, make sure we have enough descriptors */ - if (NumberDescriptors == 60) return ENOMEM; - - /* Cut this descriptor short */ - MDArray[i].BasePage = PageEnd; - MDArray[i].PageCount -= (PageEnd - PageBegin); - - /* And allocate a new descriptor for our memory range */ - MDArray[NumberDescriptors].BasePage = PageBegin; - MDArray[NumberDescriptors].PageCount = PageEnd - PageBegin; - MDArray[NumberDescriptors].MemoryType = MemoryType; - NumberDescriptors++; - } - } - else if ((MDArray[i].BasePage + MDArray[i].PageCount) == PageEnd) - { - /* This block has our end address, make sure we have a free block */ - if (NumberDescriptors == 60) return ENOMEM; - - /* Rebase this descriptor */ - MDArray[i].PageCount = PageBegin - MDArray[i].BasePage; - - /* And allocate a new descriptor for our memory range */ - MDArray[NumberDescriptors].BasePage = PageBegin; - MDArray[NumberDescriptors].PageCount = PageEnd - PageBegin; - MDArray[NumberDescriptors].MemoryType = MemoryType; - NumberDescriptors++; - } - else - { - /* We'll need two descriptors, make sure they're available */ - if ((NumberDescriptors + 1) >= 60) return ENOMEM; - - /* Allocate a free memory descriptor for what follows us */ - MDArray[NumberDescriptors].BasePage = PageEnd; - MDArray[NumberDescriptors].PageCount = MDArray[i].PageCount - - (PageEnd - MDArray[i].BasePage); - MDArray[NumberDescriptors].MemoryType = MemoryFree; - NumberDescriptors++; - - /* Cut down the current free descriptor */ - MDArray[i].PageCount = PageBegin - MDArray[i].BasePage; - - /* Allocate a new memory descriptor for our memory range */ - MDArray[NumberDescriptors].BasePage = PageBegin; - MDArray[NumberDescriptors].PageCount = PageEnd - PageBegin; - MDArray[NumberDescriptors].MemoryType = MemoryType; - NumberDescriptors++; - } - - /* Everything went well */ - return STATUS_SUCCESS; -} - -NTSTATUS -NTAPI -KiRosConfigureArcDescriptor(IN ULONG PageBegin, - IN ULONG PageEnd, - IN TYPE_OF_MEMORY MemoryType) -{ - ULONG i; - ULONG BlockBegin, BlockEnd; - MEMORY_TYPE BlockType; - BOOLEAN Combined = FALSE; - - /* If this descriptor seems bogus, just return */ - if (PageEnd <= PageBegin) return STATUS_SUCCESS; - - /* Loop every ARC descriptor, trying to find one we can modify */ - for (i = 0; i < NumberDescriptors; i++) - { - /* Get its settings */ - BlockBegin = MDArray[i].BasePage; - BlockEnd = MDArray[i].BasePage + MDArray[i].PageCount; - BlockType = MDArray[i].MemoryType; - - /* Check if we can fit inside this block */ - if (BlockBegin < PageBegin) - { - /* Check if we are larger then it */ - if ((BlockEnd > PageBegin) && (BlockEnd <= PageEnd)) - { - /* Make it end where we start */ - BlockEnd = PageBegin; - } - - /* Check if it ends after we do */ - if (BlockEnd > PageEnd) - { - /* Make sure we can allocate a descriptor */ - if (NumberDescriptors == 60) return ENOMEM; - - /* Create a descriptor for whatever memory we're not part of */ - MDArray[NumberDescriptors].MemoryType = BlockType; - MDArray[NumberDescriptors].BasePage = PageEnd; - MDArray[NumberDescriptors].PageCount = BlockEnd - PageEnd; - NumberDescriptors++; - - /* The next block ending is now where we begin */ - BlockEnd = PageBegin; - } - } - else - { - /* Check if the blog begins inside our range */ - if (BlockBegin < PageEnd) - { - /* Check if it ends before we do */ - if (BlockEnd < PageEnd) - { - /* Then make it disappear */ - BlockEnd = BlockBegin; - } - else - { - /* Otherwise make it start where we end */ - BlockBegin = PageEnd; - } - } - } - - /* Check if the block matches us, and we haven't tried combining yet */ - if (((TYPE_OF_MEMORY)BlockType == MemoryType) && !(Combined)) - { - /* Check if it starts where we end */ - if (BlockBegin == PageEnd) - { - /* Make it start with us, and combine us */ - BlockBegin = PageBegin; - Combined = TRUE; - } - else if (BlockEnd == PageBegin) - { - /* Otherwise, it ends where we begin, combine its ending */ - BlockEnd = PageEnd; - Combined = TRUE; - } - } - - /* Check the original block data matches with what we came up with */ - if ((MDArray[i].BasePage == BlockBegin) && - (MDArray[i].PageCount == BlockEnd - BlockBegin)) - { - /* Then skip it */ - continue; - } - - /* Otherwise, set our new settings for this block */ - MDArray[i].BasePage = BlockBegin; - MDArray[i].PageCount = BlockEnd - BlockBegin; - - /* Check if we are killing the block */ - if (BlockBegin == BlockEnd) - { - /* Delete this block and restart the loop properly */ - NumberDescriptors--; - if (i < NumberDescriptors) MDArray[i] = MDArray[NumberDescriptors]; - i--; - } - } - - /* If we got here without combining, we need to allocate a new block */ - if (!(Combined) && (MemoryType < LoaderMaximum)) - { - /* Make sure there's enough descriptors */ - if (NumberDescriptors == 60) return ENOMEM; - - /* Allocate a new block with our data */ - MDArray[NumberDescriptors].MemoryType = MemoryType; - MDArray[NumberDescriptors].BasePage = PageBegin; - MDArray[NumberDescriptors].PageCount = PageEnd - PageBegin; - NumberDescriptors++; - } - - /* Changes complete, return success */ - return STATUS_SUCCESS; -} - -NTSTATUS -NTAPI -KiRosBuildOsMemoryMap(VOID) -{ - PBIOS_MEMORY_DESCRIPTOR MdBlock; - ULONG BlockStart, BlockEnd, BiasedStart, BiasedEnd, PageStart, PageEnd; - NTSTATUS Status = STATUS_SUCCESS; - ULONG BiosPage = 0xA0; - - /* Loop the BIOS Memory Descriptor List */ - MdBlock = BiosMemoryDescriptorList; - while (MdBlock->BlockSize) - { - /* Get the statrt and end addresses */ - BlockStart = MdBlock->BlockBase; - BlockEnd = BlockStart + MdBlock->BlockSize - 1; - - /* Align them to page boundaries */ - BiasedStart = BlockStart & (PAGE_SIZE - 1); - if (BiasedStart) BlockStart = BlockStart + PAGE_SIZE - BiasedStart; - BiasedEnd = (BlockEnd + 1) & (ULONG)(PAGE_SIZE - 1); - if (BiasedEnd) BlockEnd -= BiasedEnd; - - /* Get the actual page numbers */ - PageStart = BlockStart >> PAGE_SHIFT; - PageEnd = (BlockEnd + 1) >> PAGE_SHIFT; - - /* If we're starting at page 0, then put the BIOS page at the end */ - if (!PageStart) BiosPage = PageEnd; - - /* Check if we did any alignment */ - if (BiasedStart) - { - /* Mark that region as reserved */ - Status = KiRosConfigureArcDescriptor(PageStart - 1, - PageStart, - MemorySpecialMemory); - if (Status != STATUS_SUCCESS) break; - } - - /* Check if we did any alignment */ - if (BiasedEnd) - { - /* Mark that region as reserved */ - Status = KiRosConfigureArcDescriptor(PageEnd - 1, - PageEnd, - MemorySpecialMemory); - if (Status != STATUS_SUCCESS) break; - - /* If the bios page was the last page, use the next one instead */ - if (BiosPage == PageEnd) BiosPage += 1; - } - - /* Check if the page is below the 16MB Memory hole */ - if (PageEnd <= 0xFC0) - { - /* It is, mark the memory a free */ - Status = KiRosConfigureArcDescriptor(PageStart, - PageEnd, - LoaderFree); - } - else if (PageStart >= 0x1000) - { - /* It's over 16MB, so that memory gets marked as reserve */ - Status = KiRosConfigureArcDescriptor(PageStart, - PageEnd, - LoaderFree); - } - else - { - /* Check if it starts below the memory hole */ - if (PageStart < 0xFC0) - { - /* Mark that part as free */ - Status = KiRosConfigureArcDescriptor(PageStart, - 0xFC0, - MemoryFree); - if (Status != STATUS_SUCCESS) break; - - /* And update the page start for the code below */ - PageStart = 0xFC0; - } - - /* Any code in the memory hole region ends up as reserve */ - Status = KiRosConfigureArcDescriptor(PageStart, - PageEnd, - LoaderFree); - } - - /* If we failed, break out, otherwise, go to the next BIOS block */ - if (Status != STATUS_SUCCESS) break; - MdBlock++; - } - - /* If anything failed until now, return error code */ - if (Status != STATUS_SUCCESS) return Status; - -#if defined(_X86_) - /* Set the top 16MB region as reserved */ - Status = KiRosConfigureArcDescriptor(0xFC0, 0x1000, MemorySpecialMemory); - if (Status != STATUS_SUCCESS) return Status; - - /* Setup the BIOS region as reserved */ - KiRosConfigureArcDescriptor(0xA0, 0x100, LoaderMaximum); - KiRosConfigureArcDescriptor(BiosPage, 0x100, MemoryFirmwarePermanent); - - /* Build an entry for the IVT */ - Status = KiRosAllocateArcDescriptor(0, 1, MemoryFirmwarePermanent); - if (Status != STATUS_SUCCESS) return Status; -#endif - - /* Build an entry for the KPCR and KUSER_SHARED_DATA */ - Status = KiRosAllocateArcDescriptor(1, 3, LoaderStartupPcrPage); - if (Status != STATUS_SUCCESS) return Status; - - /* Build an entry for the PDE and return the status */ - Status = KiRosAllocateArcDescriptor(KeRosLoaderBlock-> - PageDirectoryStart >> PAGE_SHIFT, - KeRosLoaderBlock-> - PageDirectoryEnd >> PAGE_SHIFT, - LoaderMemoryData); - return Status; -} - -#if defined(_X86_) -VOID -NTAPI -KiRosBuildReservedMemoryMap(VOID) -{ - ULONG j; - ULONG BlockBegin, BlockEnd, BiasedPage; - - /* Loop the BIOS Memory Map */ - for (j = 0; j < KeMemoryMapRangeCount; j++) - { - /* Get the start and end addresses */ - BlockBegin = KeMemoryMap[j].BaseAddrLow; - BlockEnd = BlockBegin + KeMemoryMap[j].LengthLow - 1; - - /* Make sure it wasn't a > 4GB descriptor */ - if (!KeMemoryMap[j].BaseAddrHigh) - { - /* Make sure it doesn't overflow */ - if (BlockEnd < BlockBegin) BlockEnd = 0xFFFFFFFF; - - /* Check if this was free memory */ - if (KeMemoryMap[j].Type == 1) - { - /* Get the page-aligned addresses */ - BiasedPage = BlockBegin & (PAGE_SIZE - 1); - BlockBegin >>= PAGE_SHIFT; - if (BiasedPage) BlockBegin++; - BlockEnd = (BlockEnd >> PAGE_SHIFT) + 1; - - /* Check if the block is within the 16MB memory hole */ - if ((BlockBegin < 0xFC0) && (BlockEnd >= 0xFC0)) - { - /* Don't allow it to cross this boundary */ - BlockBegin = 0xFC0; - } - - /* Check if the boundary is across 16MB */ - if ((BlockEnd > 0xFFF) && (BlockBegin <= 0xFFF)) - { - /* Don't let it cross */ - BlockEnd = 0xFFF; - } - - /* Check if the block describes the memory hole */ - if ((BlockBegin >= 0xFC0) && (BlockEnd <= 0xFFF)) - { - /* Set this region as temporary */ - KiRosConfigureArcDescriptor(BlockBegin, - BlockEnd, - MemoryFirmwareTemporary); - } - } - else - { - /* Get the page-aligned addresses */ - BlockBegin >>= PAGE_SHIFT; - BiasedPage = (BlockEnd + 1) & (PAGE_SIZE - 1); - BlockEnd >>= PAGE_SHIFT; - if (BiasedPage) BlockEnd++; - - /* Set this memory as reserved */ - KiRosConfigureArcDescriptor(BlockBegin, - BlockEnd + 1, - MemorySpecialMemory); - } - } - } -} -#endif - -VOID -NTAPI -KiRosInsertNtDescriptor(IN PMEMORY_ALLOCATION_DESCRIPTOR NewDescriptor) -{ - PLIST_ENTRY ListHead, PreviousEntry, NextEntry; - PMEMORY_ALLOCATION_DESCRIPTOR Descriptor = NULL, NextDescriptor = NULL; - - /* Loop the memory descriptor list */ - ListHead = &KeLoaderBlock->MemoryDescriptorListHead; - PreviousEntry = ListHead; - NextEntry = ListHead->Flink; - while (NextEntry != ListHead) - { - /* Get the current descriptor and check if it's below ours */ - NextDescriptor = CONTAINING_RECORD(NextEntry, - MEMORY_ALLOCATION_DESCRIPTOR, - ListEntry); - if (NewDescriptor->BasePage < NextDescriptor->BasePage) break; - - /* It isn't, save the previous entry and descriptor, and try again */ - PreviousEntry = NextEntry; - Descriptor = NextDescriptor; - NextEntry = NextEntry->Flink; - } - - /* So we found the right spot to insert. Is this free memory? */ - if (NewDescriptor->MemoryType != LoaderFree) - { - /* It isn't, so insert us before the last descriptor */ - InsertHeadList(PreviousEntry, &NewDescriptor->ListEntry); - } - else - { - /* We're free memory. Check if the entry we found is also free memory */ - if ((PreviousEntry != ListHead) && - ((Descriptor->MemoryType == LoaderFree) || - (Descriptor->MemoryType == LoaderReserve)) && - ((Descriptor->BasePage + Descriptor->PageCount) == - NewDescriptor->BasePage)) - { - /* It's free memory, and we're right after it. Enlarge that block */ - Descriptor->PageCount += NewDescriptor->PageCount; - NewDescriptor = Descriptor; - } - else - { - /* Our range scan't be combined, so just insert us separately */ - InsertHeadList(PreviousEntry, &NewDescriptor->ListEntry); - } - - /* Check if we merged with an existing free memory block */ - if ((NextEntry != ListHead) && - ((NextDescriptor->MemoryType == LoaderFree) || - (NextDescriptor->MemoryType == LoaderReserve)) && - ((NewDescriptor->BasePage + NewDescriptor->PageCount) == - NextDescriptor->BasePage)) - { - /* Update our own block */ - NewDescriptor->PageCount += NextDescriptor->PageCount; - - /* Remove the next block */ - RemoveEntryList(&NextDescriptor->ListEntry); - } - } -} - -NTSTATUS -NTAPI -KiRosBuildNtDescriptor(IN PMEMORY_ALLOCATION_DESCRIPTOR MemoryDescriptor, - IN MEMORY_TYPE MemoryType, - IN ULONG BasePage, - IN ULONG PageCount) -{ - PMEMORY_ALLOCATION_DESCRIPTOR Descriptor, NextDescriptor = NULL; - LONG Delta; - TYPE_OF_MEMORY CurrentType; - BOOLEAN UseNext; - - /* Check how many pages we'll be consuming */ - Delta = BasePage - MemoryDescriptor->BasePage; - if (!(Delta) && (PageCount == MemoryDescriptor->PageCount)) - { - /* We can simply convert the current descriptor into our new type */ - MemoryDescriptor->MemoryType = MemoryType; - } - else - { - /* Get the current memory type of the descriptor, and reserve it */ - CurrentType = MemoryDescriptor->MemoryType; - MemoryDescriptor->MemoryType = LoaderSpecialMemory; - - /* Check if we'll need another descriptor for what's left of memory */ - UseNext = ((BasePage != MemoryDescriptor->BasePage) && - (Delta + PageCount != MemoryDescriptor->PageCount)); - - /* Get a descriptor */ - Descriptor = KiRosGetMdFromArray(); - if (!Descriptor) return STATUS_INSUFFICIENT_RESOURCES; - - /* Check if we are using another descriptor */ - if (UseNext) - { - /* Allocate that one too */ - NextDescriptor = KiRosGetMdFromArray(); - if (!NextDescriptor) return STATUS_INSUFFICIENT_RESOURCES; - } - - /* Build the descriptor we got */ - Descriptor->MemoryType = MemoryType; - Descriptor->BasePage = BasePage; - Descriptor->PageCount = PageCount; - - /* Check if we're starting at the same place as the old one */ - if (BasePage == MemoryDescriptor->BasePage) - { - /* Simply decrease the old descriptor and rebase it */ - MemoryDescriptor->BasePage += PageCount; - MemoryDescriptor->PageCount -= PageCount; - MemoryDescriptor->MemoryType = CurrentType; - } - else if (Delta + PageCount == MemoryDescriptor->PageCount) - { - /* We finish where the old one did, shorten it */ - MemoryDescriptor->PageCount -= PageCount; - MemoryDescriptor->MemoryType = CurrentType; - } - else - { - /* We're inside the current block, mark our free region */ - NextDescriptor->MemoryType = LoaderFree; - NextDescriptor->BasePage = BasePage + PageCount; - NextDescriptor->PageCount = MemoryDescriptor->PageCount - - (PageCount + Delta); - - /* And cut down the current descriptor */ - MemoryDescriptor->PageCount = Delta; - MemoryDescriptor->MemoryType = CurrentType; - - /* Finally, insert our new free descriptor into the list */ - KiRosInsertNtDescriptor(NextDescriptor); - } - - /* Insert the descriptor we allocated */ - KiRosInsertNtDescriptor(Descriptor); - } - - /* Return success */ - return STATUS_SUCCESS; -} - -PMEMORY_ALLOCATION_DESCRIPTOR -NTAPI -KiRosFindNtDescriptor(IN ULONG BasePage) -{ - PMEMORY_ALLOCATION_DESCRIPTOR MdBlock = NULL; - PLIST_ENTRY NextEntry, ListHead; - - /* Scan the memory descriptor list */ - ListHead = &KeLoaderBlock->MemoryDescriptorListHead; - NextEntry = ListHead->Flink; - while (NextEntry != ListHead) - { - /* Get the current descriptor */ - MdBlock = CONTAINING_RECORD(NextEntry, - MEMORY_ALLOCATION_DESCRIPTOR, - ListEntry); - - /* Check if it can contain our memory range */ - if ((MdBlock->BasePage <= BasePage) && - (MdBlock->BasePage + MdBlock->PageCount > BasePage)) - { - /* It can, break out */ - break; - } - - /* Go to the next descriptor */ - NextEntry = NextEntry->Flink; - } - - /* Return the descriptor we found, if any */ - return MdBlock; -} - -NTSTATUS -NTAPI -KiRosAllocateNtDescriptor(IN TYPE_OF_MEMORY MemoryType, - IN ULONG BasePage, - IN ULONG PageCount, - IN ULONG Alignment, - OUT PULONG ReturnedBase) -{ - PMEMORY_ALLOCATION_DESCRIPTOR MdBlock; - ULONG AlignedBase, AlignedLimit; - PMEMORY_ALLOCATION_DESCRIPTOR ActiveMdBlock; - ULONG ActiveAlignedBase = 0; - PLIST_ENTRY NextEntry, ListHead; - - /* If no information was given, make some assumptions */ - if (!Alignment) Alignment = 1; - if (!PageCount) PageCount = 1; - - /* Start looking for a matching descvriptor */ - do - { - /* Calculate the limit of the range */ - AlignedLimit = PageCount + BasePage; - - /* Find a descriptor that already contains our base address */ - MdBlock = KiRosFindNtDescriptor(BasePage); - - if (MdBlock) - { - /* If it contains our limit as well, break out early */ - if ((MdBlock->PageCount + MdBlock->BasePage) >= AlignedLimit) break; - } - - /* Loop the memory list */ - ActiveMdBlock = NULL; - ListHead = &KeLoaderBlock->MemoryDescriptorListHead; - NextEntry = ListHead->Flink; - while (NextEntry != ListHead) - { - /* Get the current descriptors */ - MdBlock = CONTAINING_RECORD(NextEntry, - MEMORY_ALLOCATION_DESCRIPTOR, - ListEntry); - - /* Align the base address and our limit */ - AlignedBase = (MdBlock->BasePage + (Alignment - 1)) &~ Alignment; - AlignedLimit = MdBlock->PageCount - - AlignedBase + - MdBlock->BasePage; - - /* Check if this is a free block that can satisfy us */ - if ((MdBlock->MemoryType == LoaderFree) && - (AlignedLimit <= MdBlock->PageCount) && - (PageCount <= AlignedLimit)) - { - /* It is, stop searching */ - ActiveMdBlock = MdBlock; - ActiveAlignedBase = AlignedBase; - break; - } - - /* Try the next block */ - NextEntry = NextEntry->Flink; - } - - /* See if we came up with an adequate block */ - if (ActiveMdBlock) - { - /* Generate a descriptor in it */ - *ReturnedBase = AlignedBase; - return KiRosBuildNtDescriptor(ActiveMdBlock, - MemoryType, - ActiveAlignedBase, - PageCount); - } - } while (TRUE); - - /* We found a matching block, generate a descriptor with it */ - *ReturnedBase = BasePage; - return KiRosBuildNtDescriptor(MdBlock, MemoryType, BasePage, PageCount); -} - -NTSTATUS -NTAPI -KiRosBuildArcMemoryList(VOID) -{ - PMEMORY_ALLOCATION_DESCRIPTOR Descriptor; - MEMORY_DESCRIPTOR *Memory; - ULONG i; - - /* Loop all BIOS Memory Descriptors */ - for (i = 0; i < NumberDescriptors; i++) - { - /* Get the current descriptor */ - Memory = &MDArray[i]; - - /* Allocate an NT Memory Descriptor */ - Descriptor = KiRosGetMdFromArray(); - if (!Descriptor) return ENOMEM; - - /* Copy the memory type */ - Descriptor->MemoryType = Memory->MemoryType; - if (Memory->MemoryType == MemoryFreeContiguous) - { - /* Convert this to free */ - Descriptor->MemoryType = LoaderFree; - } - else if (Memory->MemoryType == MemorySpecialMemory) - { - /* Convert this to special memory */ - Descriptor->MemoryType = LoaderSpecialMemory; - } - - /* Copy the range data */ - Descriptor->BasePage = Memory->BasePage; - Descriptor->PageCount = Memory->PageCount; - - /* Insert the descriptor */ - if (Descriptor->PageCount) KiRosInsertNtDescriptor(Descriptor); - } - - /* All went well */ - return STATUS_SUCCESS; -} - -VOID -NTAPI -KiRosFixupComponentTree(IN PCONFIGURATION_COMPONENT_DATA p, - IN ULONG i) -{ - PCONFIGURATION_COMPONENT pp; - - /* Loop each entry */ - while (p) - { - /* Grab the component entry */ - pp = &p->ComponentEntry; - - /* Fixup the pointers */ - if (pp->Identifier) pp->Identifier = (PVOID)((ULONG_PTR)pp->Identifier + i); - if (p->ConfigurationData) p->ConfigurationData = (PVOID)((ULONG_PTR)p->ConfigurationData + i); - if (p->Parent) p->Parent = (PVOID)((ULONG_PTR)p->Parent + i); - if (p->Sibling) p->Sibling = (PVOID)((ULONG_PTR)p->Sibling + i); - if (p->Child) p->Child = (PVOID)((ULONG_PTR)p->Child + i); - - /* Check if we have a child */ - if (p->Child) KiRosFixupComponentTree(p->Child, i); - - /* Get to the next entry */ - p = p->Sibling; - } -} - -VOID -NTAPI -KiRosFrldrLpbToNtLpb(IN PROS_LOADER_PARAMETER_BLOCK RosLoaderBlock, - IN PLOADER_PARAMETER_BLOCK *NtLoaderBlock) -{ - PLOADER_PARAMETER_BLOCK LoaderBlock; - PLDR_DATA_TABLE_ENTRY LdrEntry; - PLOADER_MODULE RosEntry = NULL; - ULONG i, j, ModSize; - PVOID ModStart; - PCHAR DriverName; - PCHAR BootPath, HalPath; - CHAR CommandLine[256]; - PARC_DISK_SIGNATURE RosDiskInfo, ArcDiskInfo; - PIMAGE_NT_HEADERS NtHeader; - WCHAR PathToDrivers[] = L"\\SystemRoot\\System32\\drivers\\"; - WCHAR PathToSystem32[] = L"\\SystemRoot\\System32\\"; - WCHAR PathSetup[] = L"\\SystemRoot\\"; - CHAR DriverNameLow[256]; - ULONG Base; - size_t Remaining; - WCHAR *StringEnd; -#if defined(_PPC_) - ULONG KernelBase = RosLoaderBlock->ModsAddr[0].ModStart; -#endif - - /* Set the NT Loader block and initialize it */ - *NtLoaderBlock = KeLoaderBlock = LoaderBlock = &BldrLoaderBlock; - RtlZeroMemory(LoaderBlock, sizeof(LOADER_PARAMETER_BLOCK)); - - /* Set the NLS Data block */ - LoaderBlock->NlsData = &BldrNlsDataBlock; - - /* Set the ARC Data block */ - LoaderBlock->ArcDiskInformation = &BldrArcDiskInfo; - - /* Assume this is from FreeLDR's SetupLdr */ - LoaderBlock->SetupLdrBlock = &BldrSetupBlock; - - /* Setup the list heads */ - InitializeListHead(&LoaderBlock->LoadOrderListHead); - InitializeListHead(&LoaderBlock->MemoryDescriptorListHead); - InitializeListHead(&LoaderBlock->BootDriverListHead); - InitializeListHead(&LoaderBlock->ArcDiskInformation->DiskSignatureListHead); - - /* Build the free memory map, which uses BIOS Descriptors */ - KiRosBuildBiosMemoryMap(); - - /* Build entries for ReactOS memory ranges, which uses ARC Descriptors */ - KiRosBuildOsMemoryMap(); - -#if defined(_X86_) - /* Build entries for the reserved map, which uses ARC Descriptors */ - KiRosBuildReservedMemoryMap(); -#endif - - /* Now convert the BIOS and ARC Descriptors into NT Memory Descirptors */ - KiRosBuildArcMemoryList(); - - /* Loop boot driver list */ - for (i = 0; i < RosLoaderBlock->ModsCount; i++) - { - /* Get the ROS loader entry */ - RosEntry = &RosLoaderBlock->ModsAddr[i]; - DriverName = (PCHAR)RosEntry->String; - ModStart = (PVOID)RosEntry->ModStart; - ModSize = RosEntry->ModEnd - (ULONG_PTR)ModStart; - -#if defined(_PPC_) - ModStart -= KernelBase; -#endif - - /* Check if this is any of the NLS files */ - if (!_stricmp(DriverName, "ansi.nls")) - { - /* ANSI Code page */ - LoaderBlock->NlsData->AnsiCodePageData = KERNEL_RVA(ModStart); - - /* Create an MD for it */ - KiRosAllocateNtDescriptor(LoaderNlsData, - KERNEL_DESCRIPTOR_PAGE(ModStart), - (ModSize + PAGE_SIZE - 1)>> PAGE_SHIFT, - 0, - &Base); - continue; - } - else if (!_stricmp(DriverName, "oem.nls")) - { - /* OEM Code page */ - LoaderBlock->NlsData->OemCodePageData = KERNEL_RVA(ModStart); - - /* Create an MD for it */ - KiRosAllocateNtDescriptor(LoaderNlsData, - KERNEL_DESCRIPTOR_PAGE(ModStart), - (ModSize + PAGE_SIZE - 1)>> PAGE_SHIFT, - 0, - &Base); - continue; - } - else if (!_stricmp(DriverName, "casemap.nls")) - { - /* Unicode Code page */ - LoaderBlock->NlsData->UnicodeCodePageData = KERNEL_RVA(ModStart); - - /* Create an MD for it */ - KiRosAllocateNtDescriptor(LoaderNlsData, - KERNEL_DESCRIPTOR_PAGE(ModStart), - (ModSize + PAGE_SIZE - 1)>> PAGE_SHIFT, - 0, - &Base); - continue; - } - - /* Check if this is the SYSTEM hive */ - if (!(_stricmp(DriverName, "system")) || - !(_stricmp(DriverName, "system.hiv"))) - { - /* Save registry data */ - LoaderBlock->RegistryBase = KERNEL_RVA(ModStart); - LoaderBlock->RegistryLength = ModSize; - - /* Disable setup mode */ - LoaderBlock->SetupLdrBlock = NULL; - - /* Create an MD for it */ - KiRosAllocateNtDescriptor(LoaderRegistryData, - KERNEL_DESCRIPTOR_PAGE(ModStart), - (ModSize + PAGE_SIZE - 1)>> PAGE_SHIFT, - 0, - &Base); - continue; - } - - /* Check if this is the HARDWARE hive */ - if (!(_stricmp(DriverName, "hardware")) || - !(_stricmp(DriverName, "hardware.hiv"))) - { - /* Create an MD for it */ - KiRosAllocateNtDescriptor(LoaderRegistryData, - KERNEL_DESCRIPTOR_PAGE(ModStart), - (ModSize + PAGE_SIZE - 1)>> PAGE_SHIFT, - 0, - &Base); - continue; - } - - /* Check if this is the kernel */ - if (!(_stricmp(DriverName, "ntoskrnl.exe"))) - { - /* Create an MD for it */ - KiRosAllocateNtDescriptor(LoaderSystemCode, - KERNEL_DESCRIPTOR_PAGE(ModStart), - (ModSize + PAGE_SIZE - 1)>> PAGE_SHIFT, - 0, - &Base); - } - else if (!(_stricmp(DriverName, "hal.dll"))) - { - /* Create an MD for the HAL */ - KiRosAllocateNtDescriptor(LoaderHalCode, - KERNEL_DESCRIPTOR_PAGE(ModStart), - (ModSize + PAGE_SIZE - 1)>> PAGE_SHIFT, - 0, - &Base); - } - else - { - /* Create an MD for any driver */ - KiRosAllocateNtDescriptor(LoaderBootDriver, - KERNEL_DESCRIPTOR_PAGE(ModStart), - (ModSize + PAGE_SIZE - 1)>> PAGE_SHIFT, - 0, - &Base); - } - -#if defined(_PPC_) - ModStart += 0x80800000; -#endif - - /* Lowercase the drivername so we can check its extension later */ - strcpy(DriverNameLow, DriverName); - _strlwr(DriverNameLow); - - /* Setup the loader entry */ - LdrEntry = &BldrModules[i]; - RtlZeroMemory(LdrEntry, sizeof(LDR_DATA_TABLE_ENTRY)); - - /* Convert driver name from ANSI to Unicode */ - for (j = 0; j < strlen(DriverName); j++) - { - BldrModuleStrings[i][j] = DriverName[j]; - } - - /* Setup driver name */ - RtlInitUnicodeString(&LdrEntry->BaseDllName, BldrModuleStrings[i]); - - /* Construct a correct full name */ - BldrModuleStringsFull[i][0] = 0; - LdrEntry->FullDllName.MaximumLength = sizeof(BldrModuleStringsFull[i]); - LdrEntry->FullDllName.Length = 0; - LdrEntry->FullDllName.Buffer = BldrModuleStringsFull[i]; - - /* Guess the path */ - if (LoaderBlock->SetupLdrBlock) - { - UNICODE_STRING TempString; - RtlInitUnicodeString(&TempString, PathSetup); - RtlAppendUnicodeStringToString(&LdrEntry->FullDllName, &TempString); - } - else if (strstr(DriverNameLow, ".dll") || strstr(DriverNameLow, ".exe")) - { - UNICODE_STRING TempString; - RtlInitUnicodeString(&TempString, PathToSystem32); - RtlAppendUnicodeStringToString(&LdrEntry->FullDllName, &TempString); - } - else /* .sys */ - { - UNICODE_STRING TempString; - RtlInitUnicodeString(&TempString, PathToDrivers); - RtlAppendUnicodeStringToString(&LdrEntry->FullDllName, &TempString); - } - - /* Append base name of the driver */ - RtlAppendUnicodeStringToString(&LdrEntry->FullDllName, &LdrEntry->BaseDllName); - - /* Copy data from Freeldr Module Entry */ - LdrEntry->DllBase = ModStart; - LdrEntry->SizeOfImage = ModSize; - - /* Copy additional data */ - NtHeader = RtlImageNtHeader(ModStart); - LdrEntry->EntryPoint = RVA(ModStart, - NtHeader-> - OptionalHeader.AddressOfEntryPoint); - - /* Initialize other data */ - LdrEntry->LoadCount = 1; - LdrEntry->Flags = LDRP_IMAGE_DLL | - LDRP_ENTRY_PROCESSED; - if (RosEntry->Reserved) LdrEntry->Flags |= LDRP_ENTRY_INSERTED; - - /* Check if this is HAL */ - if (!(_stricmp(DriverName, "hal.dll"))) - { - /* Check if there is a second entry already */ - if (LoaderBlock->LoadOrderListHead.Flink->Flink != - &LoaderBlock->LoadOrderListHead) - { - PLIST_ENTRY OldSecondEntry; - - /* Get the second entry */ - OldSecondEntry = - LoaderBlock->LoadOrderListHead.Flink->Flink; - - /* Set up our entry correctly */ - LdrEntry->InLoadOrderLinks.Flink = OldSecondEntry; - LdrEntry->InLoadOrderLinks.Blink = OldSecondEntry->Blink; - - /* Make the first entry (always the kernel) point to us */ - LoaderBlock->LoadOrderListHead.Flink->Flink = - &LdrEntry->InLoadOrderLinks; - - /* Make the old entry point back to us and continue looping */ - OldSecondEntry->Blink = &LdrEntry->InLoadOrderLinks; - continue; - } - } - - /* Insert it into the loader block */ - InsertTailList(&LoaderBlock->LoadOrderListHead, - &LdrEntry->InLoadOrderLinks); - } - - /* Now mark the remainder of the FreeLDR 6MB area as "in use" */ - KiRosAllocateNtDescriptor(LoaderMemoryData, - KERNEL_DESCRIPTOR_PAGE(RosEntry->ModEnd), - KERNEL_DESCRIPTOR_PAGE((0x80800000 + 0x600000)) - - KERNEL_DESCRIPTOR_PAGE(RosEntry->ModEnd), - 0, - &Base); - - /* Check if we have a ramdisk */ - if ((RosLoaderBlock->RdAddr) && (RosLoaderBlock->RdLength)) - { - /* Build a descriptor for it */ - KiRosAllocateNtDescriptor(LoaderXIPRom, - KERNEL_DESCRIPTOR_PAGE(RosLoaderBlock->RdAddr), - (RosLoaderBlock->RdLength + PAGE_SIZE - 1) >> PAGE_SHIFT, - 0, - &Base); - } - - /* Setup command line */ - LoaderBlock->LoadOptions = BldrCommandLine; - strcpy(BldrCommandLine, RosLoaderBlock->CommandLine); - - /* Setup the extension block */ - LoaderBlock->Extension = &BldrExtensionBlock; - LoaderBlock->Extension->Size = sizeof(LOADER_PARAMETER_EXTENSION); - LoaderBlock->Extension->MajorVersion = 5; - LoaderBlock->Extension->MinorVersion = 2; - - /* FreeLDR hackllocates 1536 static pages for the initial boot images */ - LoaderBlock->Extension->LoaderPagesSpanned = 1536 * PAGE_SIZE; - - /* ReactOS always boots the kernel at 0x80800000 (just like NT 5.2) */ - LoaderBlock->Extension->LoaderPagesSpanned += 0x80800000 - KSEG0_BASE; - - /* Now convert to pages */ - LoaderBlock->Extension->LoaderPagesSpanned /= PAGE_SIZE; - - /* Check if FreeLdr detected a ACPI table */ - if (RosLoaderBlock->Flags & MB_FLAGS_ACPI_TABLE) - { - /* Set the pointer to something for compatibility */ - LoaderBlock->Extension->AcpiTable = (PVOID)1; - } - - /* Now setup the setup block if we have one */ - if (LoaderBlock->SetupLdrBlock) - { - /* All we'll setup right now is the flag for text-mode setup */ - LoaderBlock->SetupLdrBlock->Flags = SETUPLDR_TEXT_MODE; - } - - /* Make a copy of the command line */ - strcpy(CommandLine, LoaderBlock->LoadOptions); - - /* Find the first \, separating the ARC path from NT path */ - BootPath = strchr(CommandLine, '\\'); - *BootPath = ANSI_NULL; - RtlStringCbCopyA(BldrArcBootPath, sizeof(BldrArcBootPath), CommandLine); - LoaderBlock->ArcBootDeviceName = BldrArcBootPath; - - /* The rest of the string is the NT path */ - HalPath = strchr(BootPath + 1, ' '); - *HalPath = ANSI_NULL; - Remaining = sizeof(BldrNtBootPath); - RtlStringCbCopyExA(BldrNtBootPath, Remaining, "\\", &StringEnd, &Remaining, 0); - RtlStringCbCopyExA(StringEnd, Remaining, BootPath + 1, &StringEnd, &Remaining, 0); - RtlStringCbCopyA(StringEnd, Remaining, "\\"); - LoaderBlock->NtBootPathName = BldrNtBootPath; - - /* Set the HAL paths */ - RtlStringCbCopyA(BldrArcHalPath, sizeof(BldrArcHalPath), BldrArcBootPath); - LoaderBlock->ArcHalDeviceName = BldrArcHalPath; - strcpy(BldrNtHalPath, "\\"); - LoaderBlock->NtHalPathName = BldrNtHalPath; - - /* Use this new command line */ - RtlStringCbCopyA(LoaderBlock->LoadOptions, 255, HalPath + 2); - - /* Parse it and change every slash to a space */ - BootPath = LoaderBlock->LoadOptions; - do {if (*BootPath == '/') *BootPath = ' ';} while (*BootPath++); - - /* Now let's loop ARC disk information */ - for (i = 0; i < RosLoaderBlock->DrivesCount; i++) - { - /* Get the ROS loader entry */ - RosDiskInfo = &RosLoaderBlock->DrivesAddr[i]; - - /* Get the ARC structure */ - ArcDiskInfo = &BldrDiskInfo[i]; - - /* Copy the data over */ - ArcDiskInfo->Signature = RosDiskInfo->Signature; - ArcDiskInfo->CheckSum = RosDiskInfo->CheckSum; - - /* Copy the ARC Name */ - strcpy(BldrArcNames[i], RosDiskInfo->ArcName); - ArcDiskInfo->ArcName = BldrArcNames[i]; - - /* Insert into the list */ - InsertTailList(&LoaderBlock->ArcDiskInformation->DiskSignatureListHead, - &ArcDiskInfo->ListEntry); - } - - /* Copy the ARC Hardware Tree */ - RtlCopyMemory(BldrArcHwBuffer, (PVOID)RosLoaderBlock->ArchExtra, 16 * 1024); - LoaderBlock->ConfigurationRoot = (PVOID)BldrArcHwBuffer; - - /* Apply fixups */ - KiRosFixupComponentTree(LoaderBlock->ConfigurationRoot, - (ULONG_PTR)BldrArcHwBuffer - - RosLoaderBlock->ArchExtra); -} - -VOID -NTAPI -KiSetupSyscallHandler(); - -VOID -NTAPI -KiRosPrepareForSystemStartup(IN PROS_LOADER_PARAMETER_BLOCK LoaderBlock) -{ - PLOADER_PARAMETER_BLOCK NtLoaderBlock; - ULONG size, i = 0, *ent; -#if defined(_X86_) - PKTSS Tss; - PKGDTENTRY TssEntry; - KDESCRIPTOR IdtDescriptor; - - __sidt(&IdtDescriptor.Limit); - RtlCopyMemory(KiBootIdt, (PVOID)IdtDescriptor.Base, IdtDescriptor.Limit + 1); - IdtDescriptor.Base = (ULONG)&KiBootIdt; - IdtDescriptor.Limit = sizeof(KiBootIdt) - 1; - - /* Load the GDT and IDT */ - Ke386SetGlobalDescriptorTable(&KiGdtDescriptor.Limit); - __lidt(&IdtDescriptor.Limit); - - /* Initialize the boot TSS */ - Tss = &KiBootTss; - TssEntry = &KiBootGdt[KGDT_TSS / sizeof(KGDTENTRY)]; - TssEntry->HighWord.Bits.Type = I386_TSS; - TssEntry->HighWord.Bits.Pres = 1; - TssEntry->HighWord.Bits.Dpl = 0; - TssEntry->BaseLow = (USHORT)((ULONG_PTR)Tss & 0xFFFF); - TssEntry->HighWord.Bytes.BaseMid = (UCHAR)((ULONG_PTR)Tss >> 16); - TssEntry->HighWord.Bytes.BaseHi = (UCHAR)((ULONG_PTR)Tss >> 24); - - /* Set the TSS selector */ - Ke386SetTr(KGDT_TSS); -#endif - -#if defined(_M_PPC) - // Zero bats. We might have residual bats set that will interfere with - // our mapping of ofwldr. - for (i = 0; i < 4; i++) - { - SetBat(i, 0, 0, 0); SetBat(i, 1, 0, 0); - } - KiSetupSyscallHandler(); - DbgPrint("Kernel Power (%08x)\n", LoaderBlock); - DbgPrint("ArchExtra (%08x)!\n", LoaderBlock->ArchExtra); -#endif - - /* Save pointer to ROS Block */ - KeRosLoaderBlock = LoaderBlock; - - /* Save memory manager data */ - KeMemoryMapRangeCount = 0; - if (LoaderBlock->Flags & MB_FLAGS_MMAP_INFO) - { - /* We have a memory map from the nice BIOS */ - ent = ((PULONG)(LoaderBlock->MmapAddr - sizeof(ULONG))); - size = *ent; - i = 0; - - /* Map it until we run out of size */ - while (i < LoaderBlock->MmapLength) - { - /* Copy into the Kernel Memory Map */ - memcpy (&KeMemoryMap[KeMemoryMapRangeCount], - (PVOID)(LoaderBlock->MmapAddr + i), - sizeof(ADDRESS_RANGE)); - - /* Increase Memory Map Count */ - KeMemoryMapRangeCount++; - - /* Increase Size */ - i += size; - } - - /* Save data */ - LoaderBlock->MmapLength = KeMemoryMapRangeCount * sizeof(ADDRESS_RANGE); - LoaderBlock->MmapAddr = (ULONG)KeMemoryMap; - } - else - { - /* Nothing from BIOS */ - LoaderBlock->MmapLength = 0; - LoaderBlock->MmapAddr = (ULONG)KeMemoryMap; - } - - /* Convert the loader block */ - KiRosFrldrLpbToNtLpb(KeRosLoaderBlock, &NtLoaderBlock); - -#if defined(_M_PPC) - DbgPrint("Finished KiRosFrldrLpbToNtLpb\n"); -#endif - - /* Do general System Startup */ - KiSystemStartup(NtLoaderBlock); -} -#endif diff --git a/ntoskrnl/ke/i386/cpu.c b/ntoskrnl/ke/i386/cpu.c index 7f3358cdee9..74c1043fe0a 100644 --- a/ntoskrnl/ke/i386/cpu.c +++ b/ntoskrnl/ke/i386/cpu.c @@ -41,7 +41,7 @@ ULONG KeDcacheFlushCount = 0; ULONG KeIcacheFlushCount = 0; ULONG KiDmaIoCoherency = 0; ULONG KePrefetchNTAGranularity = 32; -CHAR KeNumberProcessors; +CHAR KeNumberProcessors = 0; KAFFINITY KeActiveProcessors = 1; BOOLEAN KiI386PentiumLockErrataPresent; BOOLEAN KiSMTProcessorsPresent; @@ -1173,22 +1173,6 @@ KiI386PentiumLockErrataFixup(VOID) MmSetPageProtect(NULL, NewIdt, PAGE_READONLY); } -BOOLEAN -NTAPI -KeDisableInterrupts(VOID) -{ - ULONG Flags; - BOOLEAN Return; - - /* Get EFLAGS and check if the interrupt bit is set */ - Flags = __readeflags(); - Return = (Flags & EFLAGS_INTERRUPT_MASK) ? TRUE: FALSE; - - /* Disable interrupts */ - _disable(); - return Return; -} - BOOLEAN NTAPI KeInvalidateAllCaches(VOID) diff --git a/ntoskrnl/ke/i386/exp.c b/ntoskrnl/ke/i386/exp.c index 6ef92e0b91f..2aa53f655a5 100644 --- a/ntoskrnl/ke/i386/exp.c +++ b/ntoskrnl/ke/i386/exp.c @@ -611,7 +611,7 @@ KeContextToTrapFrame(IN PCONTEXT Context, if (PreviousMode != KernelMode) { /* Save the mask */ - KeGetCurrentThread()->DispatcherHeader.DebugActive = DrMask; + KeGetCurrentThread()->DispatcherHeader.DebugActive = (DrMask != 0); } } diff --git a/ntoskrnl/ke/i386/kiinit.c b/ntoskrnl/ke/i386/kiinit.c index 45b25ed7ec6..49b2362c3d0 100644 --- a/ntoskrnl/ke/i386/kiinit.c +++ b/ntoskrnl/ke/i386/kiinit.c @@ -690,10 +690,7 @@ KiSystemStartup(IN PLOADER_PARAMETER_BLOCK LoaderBlock) /* Boot cycles timestamp */ BootCycles = __rdtsc(); -#if !defined(_X86_) - /* Check if we are being booted from FreeLDR */ - if (!((ULONG_PTR)LoaderBlock & 0x80000000)) KiRosPrepareForSystemStartup((PROS_LOADER_PARAMETER_BLOCK)LoaderBlock); -#endif + /* Save the loader block and get the current CPU */ KeLoaderBlock = LoaderBlock; Cpu = KeNumberProcessors; diff --git a/ntoskrnl/ke/i386/trap.s b/ntoskrnl/ke/i386/trap.s index f3c99c48c77..8d7a809c6c5 100644 --- a/ntoskrnl/ke/i386/trap.s +++ b/ntoskrnl/ke/i386/trap.s @@ -32,6 +32,8 @@ EXTERN _KiTrap02:PROC .data ASSUME nothing +.align 16 + PUBLIC _KiIdt _KiIdt: /* This is the Software Interrupt Table that we handle in this file: */ @@ -124,15 +126,19 @@ _KiInterruptTemplateDispatch: EXTERN @KiSystemServiceHandler@8:PROC PUBLIC _KiSystemService -_KiSystemService: +.PROC KiSystemService + FPO 0, 0, 0, 0, 1, FRAME_TRAP KiEnterTrap (KI_PUSH_FAKE_ERROR_CODE OR KI_NONVOLATILES_ONLY OR KI_DONT_SAVE_SEGS) KiCallHandler @KiSystemServiceHandler@8 +.ENDP KiSystemService EXTERN @KiFastCallEntryHandler@8:PROC PUBLIC _KiFastCallEntry -_KiFastCallEntry: +.PROC KiFastCallEntry + FPO 0, 0, 0, 0, 1, FRAME_TRAP KiEnterTrap (KI_FAST_SYSTEM_CALL OR KI_NONVOLATILES_ONLY OR KI_DONT_SAVE_SEGS) KiCallHandler @KiFastCallEntryHandler@8 +.ENDP KiFastCallEntry PUBLIC _KiStartUnexpectedRange@0 _KiStartUnexpectedRange@0: @@ -156,4 +162,30 @@ KiTrapExitStub KiEditedTrapReturn, (KI_RESTORE_VOLATILES OR KI_RESTORE_EF KiTrapExitStub KiTrapReturn, (KI_RESTORE_VOLATILES OR KI_RESTORE_SEGMENTS OR KI_EXIT_IRET) KiTrapExitStub KiTrapReturnNoSegments, (KI_RESTORE_VOLATILES OR KI_EXIT_IRET) +#ifdef _MSC_VER +EXTERN _PsConvertToGuiThread@0:PROC + +PUBLIC _KiConvertToGuiThread@0 +_KiConvertToGuiThread@0: + /* Safe ebx */ + push ebx + + /* Calculate the stack frame offset in ebx */ + mov ebx, ebp + sub ebx, esp + + /* Call the worker function */ + call _PsConvertToGuiThread@0 + + /* Adjust ebp to the new stack */ + mov ebp, esp + add ebp, ebx + + /* Restore ebx */ + pop ebx + + /* return to the caller */ + ret +#endif + END diff --git a/ntoskrnl/ke/i386/traphdlr.c b/ntoskrnl/ke/i386/traphdlr.c index c3f5893d1e8..e733cba8519 100644 --- a/ntoskrnl/ke/i386/traphdlr.c +++ b/ntoskrnl/ke/i386/traphdlr.c @@ -42,7 +42,7 @@ UCHAR KiTrapIoTable[] = 0xEE, /* OUT */ 0xEF, /* OUT */ 0x6E, /* OUTS */ - 0x6F, /* OUTS */ + 0x6F, /* OUTS */ }; PFAST_SYSTEM_CALL_EXIT KiFastCallExitHandler; @@ -143,7 +143,7 @@ KiServiceExit(IN PKTRAP_FRAME TrapFrame, KiCommonExit(TrapFrame, 0); /* Restore previous mode */ - KeGetCurrentThread()->PreviousMode = TrapFrame->PreviousPreviousMode; + KeGetCurrentThread()->PreviousMode = (CCHAR)TrapFrame->PreviousPreviousMode; /* Check for user mode exit */ if (TrapFrame->SegCs & MODE_MASK) @@ -174,7 +174,7 @@ KiServiceExit2(IN PKTRAP_FRAME TrapFrame) KiCommonExit(TrapFrame, 0); /* Restore previous mode */ - KeGetCurrentThread()->PreviousMode = TrapFrame->PreviousPreviousMode; + KeGetCurrentThread()->PreviousMode = (CCHAR)TrapFrame->PreviousPreviousMode; /* Check if this was a V8086 trap */ if (TrapFrame->EFlags & EFLAGS_V86_MASK) KiTrapReturnNoSegments(TrapFrame); @@ -213,7 +213,7 @@ KiDebugHandler(IN PKTRAP_FRAME TrapFrame, Parameter1, Parameter2, Parameter3, - TrapFrame); + TrapFrame); } DECLSPEC_NORETURN @@ -463,7 +463,7 @@ KiTrap02(VOID) // // Note that in reality, we are already on the NMI tss -- we just need to // update the PCR to reflect this - // + // PCR->TSS = NmiTss; __writeeflags(__readeflags() &~ EFLAGS_NESTED_TASK); TssGdt->HighWord.Bits.Dpl = 0; @@ -527,7 +527,7 @@ KiTrap02(VOID) // Although the CPU disabled NMIs, we just did a BIOS Call, which could've // totally changed things. // - // We have to make sure we're still in our original NMI -- a nested NMI + // We have to make sure we're still in our original NMI -- a nested NMI // will point back to the NMI TSS, and in that case we're hosed. // if (PCR->TSS->Backlink != KGDT_NMI_TSS) @@ -652,7 +652,7 @@ KiTrap06Handler(IN PKTRAP_FRAME TrapFrame) { /* Should only happen in VDM mode */ UNIMPLEMENTED; - while (TRUE); + while (TRUE); } /* Bring IRQL back */ @@ -910,7 +910,7 @@ KiTrap0DHandler(IN PKTRAP_FRAME TrapFrame) { /* Should only happen in VDM mode */ UNIMPLEMENTED; - while (TRUE); + while (TRUE); } /* Bring IRQL back */ @@ -933,7 +933,7 @@ KiTrap0DHandler(IN PKTRAP_FRAME TrapFrame) /* Enable interrupts and check error code */ _enable(); if (!TrapFrame->ErrCode) - { + { /* FIXME: Use SEH */ Instructions = (PUCHAR)TrapFrame->Eip; @@ -1047,7 +1047,7 @@ KiTrap0DHandler(IN PKTRAP_FRAME TrapFrame) TrapFrame); } - /* + /* * Check for a fault during checking of the user instruction. * * Note that the SEH handler will catch invalid EIP, but we could be dealing @@ -1059,7 +1059,7 @@ KiTrap0DHandler(IN PKTRAP_FRAME TrapFrame) { /* Not implemented */ UNIMPLEMENTED; - while (TRUE); + while (TRUE); } /* @@ -1100,7 +1100,7 @@ KiTrap0DHandler(IN PKTRAP_FRAME TrapFrame) if (Instructions[0] == 0xCF) { /* - * Some evil shit is going on here -- this is not the SS:ESP you're + * Some evil shit is going on here -- this is not the SS:ESP you're * looking for! Instead, this is actually CS:EIP you're looking at! * Why? Because part of the trap frame actually corresponds to the IRET * stack during the trap exit! @@ -1121,8 +1121,8 @@ KiTrap0DHandler(IN PKTRAP_FRAME TrapFrame) /* So since we're not dealing with the above case, check for RDMSR/WRMSR */ if ((Instructions[0] == 0xF) && // 2-byte opcode - (((Instructions[1] >> 8) == 0x30) || // RDMSR - ((Instructions[2] >> 8) == 0x32))) // WRMSR + ((Instructions[1] == 0x32) || // RDMSR + (Instructions[1] == 0x30))) // WRMSR { /* Unknown CPU MSR, so raise an access violation */ KiDispatchException0Args(STATUS_ACCESS_VIOLATION, @@ -1199,6 +1199,35 @@ KiTrap0EHandler(IN PKTRAP_FRAME TrapFrame) #endif } + /* Check for S-LIST fault in kernel mode */ + if (TrapFrame->Eip == (ULONG_PTR)ExpInterlockedPopEntrySListFault) + { + PSLIST_HEADER SListHeader; + + /* Sanity check that the assembly is correct: + This must be mov ebx, [eax] + Followed by cmpxchg8b [ebp] */ + ASSERT((((UCHAR*)TrapFrame->Eip)[0] == 0x8B) && + (((UCHAR*)TrapFrame->Eip)[1] == 0x18) && + (((UCHAR*)TrapFrame->Eip)[2] == 0x0F) && + (((UCHAR*)TrapFrame->Eip)[3] == 0xC7) && + (((UCHAR*)TrapFrame->Eip)[4] == 0x4D) && + (((UCHAR*)TrapFrame->Eip)[5] == 0x00)); + + /* Get the pointer to the SLIST_HEADER */ + SListHeader = (PSLIST_HEADER)TrapFrame->Ebp; + + /* Check if the Next member of the SLIST_HEADER was changed */ + if (SListHeader->Next.Next != (PSLIST_ENTRY)TrapFrame->Eax) + { + /* Restart the operation */ + TrapFrame->Eip = (ULONG_PTR)ExpInterlockedPopEntrySListResume; + + /* Continue execution */ + KiEoiHelper(TrapFrame); + } + } + /* Call the access fault handler */ Status = MmAccessFault(TrapFrame->ErrCode & 1, (PVOID)Cr2, @@ -1206,14 +1235,6 @@ KiTrap0EHandler(IN PKTRAP_FRAME TrapFrame) TrapFrame); if (NT_SUCCESS(Status)) KiEoiHelper(TrapFrame); - /* Check for S-LIST fault */ - if (TrapFrame->Eip == (ULONG_PTR)ExpInterlockedPopEntrySListFault) - { - /* Not yet implemented */ - UNIMPLEMENTED; - while (TRUE); - } - /* Check for syscall fault */ #if 0 if ((TrapFrame->Eip == (ULONG_PTR)CopyParams) || @@ -1496,7 +1517,7 @@ KiSystemCall(IN PKTRAP_FRAME TrapFrame, /* Save previous mode */ TrapFrame->PreviousPreviousMode = Thread->PreviousMode; - /* Save the SEH chain and terminate it for now */ + /* Save the SEH chain and terminate it for now */ TrapFrame->ExceptionList = KeGetPcr()->NtTib.ExceptionList; KeGetPcr()->NtTib.ExceptionList = EXCEPTION_CHAIN_END; @@ -1533,7 +1554,7 @@ KiSystemCall(IN PKTRAP_FRAME TrapFrame, goto ExitCall; } - /* Convert us to a GUI thread -- must wrap in ASM to get new EBP */ + /* Convert us to a GUI thread -- must wrap in ASM to get new EBP */ Result = KiConvertToGuiThread(); if (!NT_SUCCESS(Result)) { @@ -1541,7 +1562,7 @@ KiSystemCall(IN PKTRAP_FRAME TrapFrame, //SetLastWin32Error(RtlNtStatusToDosError(Result)); goto ExitCall; } - + /* Reload trap frame and descriptor table pointer from new stack */ TrapFrame = *(volatile PVOID*)&Thread->TrapFrame; DescriptorTable = (PVOID)(*(volatile ULONG_PTR*)&Thread->ServiceTable + Offset); diff --git a/ntoskrnl/ke/i386/usercall.c b/ntoskrnl/ke/i386/usercall.c index 07ce4442df4..9363c6fed5f 100644 --- a/ntoskrnl/ke/i386/usercall.c +++ b/ntoskrnl/ke/i386/usercall.c @@ -4,6 +4,7 @@ * FILE: ntoskrnl/ke/i386/usercall.c * PURPOSE: User-mode Callout Mechanisms (APC and Win32K Callbacks) * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org) + * Timo Kreuzer (timo.kreuzer@reactos.org) */ /* INCLUDES ******************************************************************/ @@ -208,4 +209,147 @@ KeUserModeCallback(IN ULONG RoutineIndex, return CallbackStatus; } + +/* + * Stack layout for KiUserModeCallout: + * ---------------------------------- + * KCALLOUT_FRAME.ResultLength <= 2nd Parameter to KiCallUserMode + * KCALLOUT_FRAME.Result <= 1st Parameter to KiCallUserMode + * KCALLOUT_FRAME.ReturnAddress <= Return address of KiCallUserMode + * KCALLOUT_FRAME.Ebp \ + * KCALLOUT_FRAME.Ebx | = non-volatile registers, pushed + * KCALLOUT_FRAME.Esi | by KiCallUserMode + * KCALLOUT_FRAME.Edi / + * KCALLOUT_FRAME.CallbackStack + * KCALLOUT_FRAME.TrapFrame + * KCALLOUT_FRAME.InitialStack <= CalloutFrame points here + * ---------------------------------- + * ~~ optional alignment ~~ + * ---------------------------------- + * FX_SAVE_AREA + * ---------------------------------- + * KTRAP_FRAME + * ---------------------------------- + * ~~ begin of stack frame for KiUserModeCallout ~~ + * + */ + +NTSTATUS +FASTCALL +KiUserModeCallout(PKCALLOUT_FRAME CalloutFrame) +{ + PKTHREAD CurrentThread; + PKTRAP_FRAME TrapFrame, CallbackTrapFrame; + PFX_SAVE_AREA FxSaveArea, OldFxSaveArea; + PKPCR Pcr; + PKTSS Tss; + ULONG_PTR InitialStack; + NTSTATUS Status; + + /* Get the current thread */ + CurrentThread = KeGetCurrentThread(); + +#if DBG + /* Check if we are at pasive level */ + if (KeGetCurrentIrql() != PASSIVE_LEVEL) + { + /* We're not, bugcheck */ + KeBugCheckEx(IRQL_GT_ZERO_AT_SYSTEM_SERVICE, + 0, + KeGetCurrentIrql(), + 0, + 0); + } + + /* Check if we are attached or APCs are disabled */ + if ((CurrentThread->ApcStateIndex != OriginalApcEnvironment) || + (CurrentThread->CombinedApcDisable > 0)) + { + KeBugCheckEx(APC_INDEX_MISMATCH, + 0, + CurrentThread->ApcStateIndex, + CurrentThread->CombinedApcDisable, + 0); + } +#endif + + /* Align stack on a 16-byte boundary */ + InitialStack = ALIGN_DOWN_BY(CalloutFrame, 16); + + /* Check if we have enough space on the stack */ + if ((InitialStack - KERNEL_STACK_SIZE) < CurrentThread->StackLimit) + { + /* We don't, we'll have to grow our stack */ + Status = MmGrowKernelStack((PVOID)InitialStack); + + /* Quit if we failed */ + if (!NT_SUCCESS(Status)) return Status; + } + + /* Save the current callback stack and initial stack */ + CalloutFrame->CallbackStack = (ULONG_PTR)CurrentThread->CallbackStack; + CalloutFrame->InitialStack = (ULONG_PTR)CurrentThread->InitialStack; + + /* Get and save the trap frame */ + TrapFrame = CurrentThread->TrapFrame; + CalloutFrame->TrapFrame = (ULONG_PTR)TrapFrame; + + /* Set the new callback stack */ + CurrentThread->CallbackStack = CalloutFrame; + + /* Set destination and origin NPX Areas */ + OldFxSaveArea = (PVOID)(CalloutFrame->InitialStack - sizeof(FX_SAVE_AREA)); + FxSaveArea = (PVOID)(InitialStack - sizeof(FX_SAVE_AREA)); + + /* Disable interrupts so we can fill the NPX State */ + _disable(); + + /* Now copy the NPX State */ + FxSaveArea->U.FnArea.ControlWord = OldFxSaveArea->U.FnArea.ControlWord; + FxSaveArea->U.FnArea.StatusWord = OldFxSaveArea->U.FnArea.StatusWord; + FxSaveArea->U.FnArea.TagWord = OldFxSaveArea->U.FnArea.TagWord; + FxSaveArea->U.FnArea.DataSelector = OldFxSaveArea->U.FnArea.DataSelector; + FxSaveArea->Cr0NpxState = OldFxSaveArea->Cr0NpxState; + + /* Set the stack address */ + CurrentThread->InitialStack = (PVOID)InitialStack; + + /* Locate the trap frame on the callback stack */ + CallbackTrapFrame = (PVOID)((ULONG_PTR)FxSaveArea - sizeof(KTRAP_FRAME)); + + /* Copy the trap frame to the new location */ + *CallbackTrapFrame = *TrapFrame; + + /* Get PCR */ + Pcr = KeGetPcr(); + + /* Update the exception list */ + CallbackTrapFrame->ExceptionList = Pcr->NtTib.ExceptionList; + + /* Get TSS */ + Tss = Pcr->TSS; + + /* Check for V86 mode */ + if (CallbackTrapFrame->EFlags & EFLAGS_V86_MASK) + { + /* Set new stack address in TSS (full trap frame) */ + Tss->Esp0 = (ULONG_PTR)(CallbackTrapFrame + 1); + } + else + { + /* Set new stack address in TSS (non-V86 trap frame) */ + Tss->Esp0 = (ULONG_PTR)&CallbackTrapFrame->V86Es; + } + + /* Set user-mode dispatcher address as EIP */ + CallbackTrapFrame->Eip = (ULONG_PTR)KeUserCallbackDispatcher; + + /* Bring interrupts back */ + _enable(); + + /* Exit to user-mode */ + KiServiceExit(CallbackTrapFrame, 0); +} + + /* EOF */ diff --git a/ntoskrnl/ke/i386/usercall_asm.S b/ntoskrnl/ke/i386/usercall_asm.S index a5ab6c914e3..62078c92d86 100644 --- a/ntoskrnl/ke/i386/usercall_asm.S +++ b/ntoskrnl/ke/i386/usercall_asm.S @@ -13,24 +13,15 @@ #include EXTERN _MmGrowKernelStack@4:PROC -EXTERN _KeUserCallbackDispatcher:PROC +EXTERN _KeUserCallbackDispatcher:DWORD EXTERN @KiServiceExit@8:PROC EXTERN _KeGetCurrentIrql@0:PROC EXTERN _KeBugCheckEx@20:PROC +EXTERN @KiUserModeCallout@4:PROC /* FUNCTIONS ****************************************************************/ .code -PUBLIC _KiGetUserModeStackAddress@0 -_KiGetUserModeStackAddress@0: - - /* Get the current thread's trapframe and return the esp */ - mov eax, fs:[KPCR_CURRENT_THREAD] - mov eax, [eax+KTHREAD_TRAP_FRAME] - lea eax, [eax+KTRAP_FRAME_ESP] - ret - - /*++ * @name KiCallUserMode * @@ -58,166 +49,23 @@ _KiGetUserModeStackAddress@0: PUBLIC _KiCallUserMode@8 _KiCallUserMode@8: - /* Save volatile registers */ + /* Push non-volatile registers on the stack. + This is part of the KCALLOUT_FRAME */ push ebp push ebx push esi push edi - /* Get the current thread */ - mov ebx, fs:[KPCR_CURRENT_THREAD] + /* load the address of the callout frame into ecx */ + lea ecx, [esp - 12] - /* Make sure we're at passive */ -#if DBG - call _KeGetCurrentIrql@0 - or al, al - jz AtPassive + /* Allocate space for the inital stack */ + sub esp, 12 + NPX_FRAME_LENGTH + KTRAP_FRAME_LENGTH + 16 - /* We're not, bugcheck! */ - push 0 - push 0 - push eax - push 0 - push IRQL_GT_ZERO_AT_SYSTEM_SERVICE - call _KeBugCheckEx@20 + call @KiUserModeCallout@4 -AtPassive: + add esp, 12 + NPX_FRAME_LENGTH + KTRAP_FRAME_LENGTH + 16 - /* Make sure that we are not attached and that APCs are not disabled */ - movzx eax, byte ptr [ebx+KTHREAD_APC_STATE_INDEX] - mov edx, [ebx+KTHREAD_COMBINED_APC_DISABLE] - or eax, eax - jnz InvalidIndex - or edx, edx - jz ApcsEnabled - -InvalidIndex: - - push 0 - push edx - push eax - push 0 - push APC_INDEX_MISMATCH - call _KeBugCheckEx@20 -ApcsEnabled: -#endif - - /* Get the lowest stack limit and check if we can handle it */ - lea eax, [esp-HEX(3000)] - cmp eax, [ebx+KTHREAD_STACK_LIMIT] - jnb StackOk - - /* We can't, we'll have to grow our stack */ - push esp - call _MmGrowKernelStack@4 - - /* Quit if we failed */ - or eax, eax - jnz GrowFailed - - /* Save the current callback stack */ -StackOk: - push [ebx+KTHREAD_CALLBACK_STACK] - - /* Get and save the trap frame */ - mov edx, [ebx+KTHREAD_TRAP_FRAME] - push edx - - /* Get and save the initial stack */ - mov esi, [ebx+KTHREAD_INITIAL_STACK] - push esi - - /* Set the new callback stack */ - mov [ebx+KTHREAD_CALLBACK_STACK], esp - - /* Align stack on 16-byte boundary */ - and esp, NOT 15 - mov edi, esp - - /* Set destination and origin NPX Areas */ - sub esp, NPX_FRAME_LENGTH - sub esi, NPX_FRAME_LENGTH - - /* Disable interrupts so we can fill the NPX State */ - cli - - /* Now copy the NPX State */ - mov ecx, [esi+FP_CONTROL_WORD] - mov [esp+FP_CONTROL_WORD], ecx - mov ecx, [esi+FP_STATUS_WORD] - mov [esp+FP_STATUS_WORD], ecx - mov ecx, [esi+FP_TAG_WORD] - mov [esp+FP_TAG_WORD], ecx - mov ecx, [esi+FP_DATA_SELECTOR] - mov [esp+FP_DATA_SELECTOR], ecx - mov ecx, [esi+FN_CR0_NPX_STATE] - mov [esp+FN_CR0_NPX_STATE], ecx - - /* Get TSS */ - mov esi, fs:[KPCR_TSS] - - /* Set the stack address */ - mov [ebx+KTHREAD_INITIAL_STACK], edi - - /* Bias the stack for V86 mode */ - mov ecx, esp - sub esp, 16 - test dword ptr [edx+KTRAP_FRAME_EFLAGS], EFLAGS_V86_MASK - jnz DontBias - mov ecx, esp - -DontBias: - /* Set new stack address in TSS */ - mov [esi+KTSS_ESP0], ecx - - /* Allocate the trap frame and set it */ - sub esp, KTRAP_FRAME_V86_ES - mov ebp, esp - - /* Set copy iterator and dest/origin parameters and do the copy */ - mov ecx, (KTRAP_FRAME_V86_ES - KTRAP_FRAME_FS) / 4 - lea edi, [esp+KTRAP_FRAME_FS] - lea esi, [edx+KTRAP_FRAME_FS] - rep movsd - - /* Copy DR7 */ - mov edi, [edx+KTRAP_FRAME_DR7] - test edi, NOT DR7_RESERVED_MASK - mov [esp+KTRAP_FRAME_DR7], edi - - /* Check if we need to save debug registers */ - jnz SaveDebug - - /* Get user-mode dispatcher address and set it as EIP */ -SetEip: - mov eax, _KeUserCallbackDispatcher - mov [esp+KTRAP_FRAME_EIP], eax - - /* Set the exception list */ - mov eax, fs:[KPCR_EXCEPTION_LIST] - mov [esp+KTRAP_FRAME_EXCEPTION_LIST], eax - - /* Set the previous mode */ - mov eax, [edx+KTRAP_FRAME_PREVIOUS_MODE] - mov [esp+KTRAP_FRAME_PREVIOUS_MODE], eax - - /* Bring interrupts back */ - sti - - /* Exit to user-mode */ - mov ecx, esp - jmp @KiServiceExit@8 - -SaveDebug: - - /* Copy all 5 DRs */ - mov ecx, 5 - lea edi, [esp+KTRAP_FRAME_DR0] - lea esi, [edx+KTRAP_FRAME_DR0] - rep movsd - jmp SetEip - -GrowFailed: /* Restore registers */ pop edi pop esi diff --git a/ntoskrnl/ke/queue.c b/ntoskrnl/ke/queue.c index 30819786b73..90345ddc785 100644 --- a/ntoskrnl/ke/queue.c +++ b/ntoskrnl/ke/queue.c @@ -247,7 +247,7 @@ KeRemoveQueue(IN PKQUEUE Queue, PKTIMER Timer = &Thread->Timer; BOOLEAN Swappable; PLARGE_INTEGER OriginalDueTime = Timeout; - LARGE_INTEGER DueTime, NewDueTime, InterruptTime; + LARGE_INTEGER DueTime = {{0}}, NewDueTime, InterruptTime; ULONG Hand = 0; ASSERT_QUEUE(Queue); ASSERT_IRQL_LESS_OR_EQUAL(DISPATCH_LEVEL); diff --git a/ntoskrnl/ke/thrdschd.c b/ntoskrnl/ke/thrdschd.c index d100c3b8900..14e22ba137d 100644 --- a/ntoskrnl/ke/thrdschd.c +++ b/ntoskrnl/ke/thrdschd.c @@ -696,6 +696,28 @@ KiSetAffinityThread(IN PKTHREAD Thread, return OldAffinity; } +// +// This macro exists because NtYieldExecution locklessly attempts to read from +// the KPRCB's ready summary, and the usual way of going through KeGetCurrentPrcb +// would require getting fs:1C first (or gs), and then doing another dereference. +// In an attempt to minimize the amount of instructions and potential race/tear +// that could happen, Windows seems to define this as a macro that directly acceses +// the ready summary through a single fs: read by going through the KPCR's PrcbData. +// +// See http://research.microsoft.com/en-us/collaboration/global/asia-pacific/ +// programs/trk_case4_process-thread_management.pdf +// +// We need this per-arch because sometimes it's Prcb and sometimes PrcbData, and +// because on x86 it's FS, and on x64 it's GS (not sure what it is on ARM/PPC). +// +#ifdef _M_IX86 +#define KiGetCurrentReadySummary() __readfsdword(FIELD_OFFSET(KIPCR, PrcbData.ReadySummary)) +#elif _M_AMD64 +#define KiGetCurrentReadySummary() __readgsdword(FIELD_OFFSET(KIPCR, Prcb.ReadySummary)) +#else +#error Implement me! +#endif + /* * @implemented */ @@ -703,16 +725,23 @@ NTSTATUS NTAPI NtYieldExecution(VOID) { - NTSTATUS Status = STATUS_NO_YIELD_PERFORMED; + NTSTATUS Status; KIRQL OldIrql; - PKPRCB Prcb = KeGetCurrentPrcb(); - PKTHREAD Thread = KeGetCurrentThread(), NextThread; + PKPRCB Prcb; + PKTHREAD Thread, NextThread; + + /* NB: No instructions (other than entry code) should preceed this line */ /* Fail if there's no ready summary */ - if (!Prcb->ReadySummary) return Status; + if (!KiGetCurrentReadySummary()) return STATUS_NO_YIELD_PERFORMED; - /* Raise IRQL to synch */ + /* Now get the current thread, set the status... */ + Status = STATUS_NO_YIELD_PERFORMED; + Thread = KeGetCurrentThread(); + + /* Raise IRQL to synch and get the KPRCB now */ OldIrql = KeRaiseIrqlToSynchLevel(); + Prcb = KeGetCurrentPrcb(); /* Now check if there's still a ready summary */ if (Prcb->ReadySummary) diff --git a/ntoskrnl/ke/wait.c b/ntoskrnl/ke/wait.c index 3fc51062ba4..79e350b6447 100644 --- a/ntoskrnl/ke/wait.c +++ b/ntoskrnl/ke/wait.c @@ -413,7 +413,7 @@ KeWaitForSingleObject(IN PVOID Object, PKTIMER Timer = &Thread->Timer; NTSTATUS WaitStatus; BOOLEAN Swappable; - LARGE_INTEGER DueTime, NewDueTime, InterruptTime; + LARGE_INTEGER DueTime = {{0}}, NewDueTime, InterruptTime; PLARGE_INTEGER OriginalDueTime = Timeout; ULONG Hand = 0; @@ -580,7 +580,7 @@ KeWaitForMultipleObjects(IN ULONG Count, NTSTATUS WaitStatus = STATUS_SUCCESS; BOOLEAN Swappable; PLARGE_INTEGER OriginalDueTime = Timeout; - LARGE_INTEGER DueTime, NewDueTime, InterruptTime; + LARGE_INTEGER DueTime = {{0}}, NewDueTime, InterruptTime; ULONG Index, Hand = 0; /* Make sure the Wait Count is valid */ diff --git a/ntoskrnl/lpc/complete.c b/ntoskrnl/lpc/complete.c index 67de3871976..1ef57631b62 100644 --- a/ntoskrnl/lpc/complete.c +++ b/ntoskrnl/lpc/complete.c @@ -148,7 +148,11 @@ NtAcceptConnectPort(OUT PHANDLE PortHandle, RtlCopyMemory(ConnectMessage + 1, ReplyMessage + 1, ConnectionInfoLength); /* At this point, if the caller refused the connection, go to cleanup */ - if (!AcceptConnection) goto Cleanup; + if (!AcceptConnection) + { + DPRINT1("LPC connection was refused\n"); + goto Cleanup; + } /* Otherwise, create the actual port */ Status = ObCreateObject(PreviousMode, @@ -222,6 +226,11 @@ NtAcceptConnectPort(OUT PHANDLE PortHandle, { /* Otherwise, quit */ ObDereferenceObject(ServerPort); + DPRINT1("Client section mapping failed: %lx\n", Status); + DPRINT1("View base, offset, size: %lx %lx %lx\n", + ServerPort->ClientSectionBase, + ConnectMessage->ClientView.ViewSize, + SectionOffset); goto Cleanup; } } diff --git a/ntoskrnl/mm/ARM3/contmem.c b/ntoskrnl/mm/ARM3/contmem.c index 8fd906e9897..bb5f6ea0ac7 100644 --- a/ntoskrnl/mm/ARM3/contmem.c +++ b/ntoskrnl/mm/ARM3/contmem.c @@ -430,7 +430,7 @@ MiAllocateContiguousMemory(IN SIZE_T NumberOfBytes, // // No such luck // - ExFreePool(BaseAddress); + ExFreePoolWithTag(BaseAddress, 'mCmM'); } } @@ -472,7 +472,7 @@ MiFreeContiguousMemory(IN PVOID BaseAddress) // // It did, so just use the pool to free this // - ExFreePool(BaseAddress); + ExFreePoolWithTag(BaseAddress, 'mCmM'); return; } diff --git a/ntoskrnl/mm/ARM3/expool.c b/ntoskrnl/mm/ARM3/expool.c index eb5bc01692f..4d07a9ea7a0 100644 --- a/ntoskrnl/mm/ARM3/expool.c +++ b/ntoskrnl/mm/ARM3/expool.c @@ -452,7 +452,7 @@ ExAllocatePoolWithTag(IN POOL_TYPE PoolType, PLIST_ENTRY ListHead; PPOOL_HEADER Entry, NextEntry, FragmentEntry; KIRQL OldIrql; - ULONG BlockSize, i; + USHORT BlockSize, i; // // Some sanity checks @@ -495,7 +495,8 @@ ExAllocatePoolWithTag(IN POOL_TYPE PoolType, // request would've been treated as a POOL_MAX_ALLOC earlier and resulted in // the direct allocation of pages. // - i = (NumberOfBytes + sizeof(POOL_HEADER) + (POOL_BLOCK_SIZE - 1)) / POOL_BLOCK_SIZE; + i = (USHORT)((NumberOfBytes + sizeof(POOL_HEADER) + (POOL_BLOCK_SIZE - 1)) + / POOL_BLOCK_SIZE); // // Loop in the free lists looking for a block if this size. Start with the @@ -736,7 +737,7 @@ ExAllocatePool(POOL_TYPE PoolType, // // Use a default tag of "None" // - return ExAllocatePoolWithTag(PoolType, NumberOfBytes, 'enoN'); + return ExAllocatePoolWithTag(PoolType, NumberOfBytes, TAG_NONE); } /* @@ -748,7 +749,7 @@ ExFreePoolWithTag(IN PVOID P, IN ULONG TagToFree) { PPOOL_HEADER Entry, NextEntry; - ULONG BlockSize; + USHORT BlockSize; KIRQL OldIrql; POOL_TYPE PoolType; PPOOL_DESCRIPTOR PoolDesc; @@ -788,6 +789,15 @@ ExFreePoolWithTag(IN PVOID P, // OldIrql = ExLockPool(PoolDesc); + // + // Check block tag + // + if (TagToFree && TagToFree != Entry->PoolTag) + { + DPRINT1("Freeing pool - invalid tag specified: %.4s != %.4s\n", (char*)&TagToFree, (char*)&Entry->PoolTag); + KeBugCheckEx(BAD_POOL_CALLER, 0x0A, (ULONG_PTR)P, Entry->PoolTag, TagToFree); + } + // // Check if the next allocation is at the end of the page // diff --git a/ntoskrnl/mm/ARM3/miarm.h b/ntoskrnl/mm/ARM3/miarm.h index 7b24a18062d..048b9f3e8a0 100644 --- a/ntoskrnl/mm/ARM3/miarm.h +++ b/ntoskrnl/mm/ARM3/miarm.h @@ -244,7 +244,7 @@ extern const ULONG MmProtectToValue[32]; // Returns the color of a page // #define MI_GET_PAGE_COLOR(x) ((x) & MmSecondaryColorMask) -#define MI_GET_NEXT_COLOR(x) (MI_GET_PAGE_COLOR(++MmSystemPageColor)) +#define MI_GET_NEXT_COLOR() (MI_GET_PAGE_COLOR(++MmSystemPageColor)) #define MI_GET_NEXT_PROCESS_COLOR(x) (MI_GET_PAGE_COLOR(++(x)->NextPageColor)) #ifndef _M_AMD64 diff --git a/ntoskrnl/mm/ARM3/miavl.h b/ntoskrnl/mm/ARM3/miavl.h index da698d6f70c..b16c84eea67 100644 --- a/ntoskrnl/mm/ARM3/miavl.h +++ b/ntoskrnl/mm/ARM3/miavl.h @@ -20,7 +20,7 @@ * * The other difference is that the AVL package for Rtl has custom callbacks for * comparison purposes (which would access some internal, opaque, user data) while - * the Mm package stores the user-data inline as StartingVpn and EndingVpn. So + * the Mm package stores the user-data inline as StartingVpn and EndingVpn. So * when a compare is being made, RtlpAvlCompareRoutine is called, which will either * perform the Mm work, or call the user-specified callback in the Rtl case. */ @@ -54,7 +54,7 @@ RtlpAvlCompareRoutine(IN PRTL_AVL_TABLE Table, { return GenericEqual; } - else + else { return GenericGreaterThan; } @@ -80,7 +80,7 @@ SCHAR FORCEINLINE RtlBalance(IN PRTL_BALANCED_LINKS Node) { - return Node->u1.Balance; + return (SCHAR)Node->u1.Balance; } PRTL_BALANCED_LINKS diff --git a/ntoskrnl/mm/ARM3/mmdbg.c b/ntoskrnl/mm/ARM3/mmdbg.c index ae476a78ab2..1029fdf8e0f 100644 --- a/ntoskrnl/mm/ARM3/mmdbg.c +++ b/ntoskrnl/mm/ARM3/mmdbg.c @@ -17,6 +17,8 @@ #ifndef _WINKD_ #define KdpDprintf DPRINT +#elif defined(NDEBUG) +#define KdpDprintf(...) #endif /* GLOBALS ********************************************************************/ @@ -148,6 +150,8 @@ MmDbgCopyMemory(IN ULONG64 Address, { NTSTATUS Status; PVOID TargetAddress; + ULONG64 PhysicalAddress; + PMMPTE PointerPte; // // No local kernel debugging support yet, so don't worry about locking @@ -236,34 +240,30 @@ MmDbgCopyMemory(IN ULONG64 Address, // No session space support yet // ASSERT(MmIsSessionAddress(TargetAddress) == FALSE); - } - // - // If we are going to write to the address then make sure it is writeable too - // - if ((Flags & MMDBG_COPY_WRITE) && - (!MI_IS_PAGE_WRITEABLE(MiAddressToPte(TargetAddress)))) - { - // - // Check if we mapped anything - // - if (Flags & MMDBG_COPY_PHYSICAL) + /* If we are going to write to the address, then check if its writable */ + PointerPte = MiAddressToPte(TargetAddress); + if ((Flags & MMDBG_COPY_WRITE) && !MI_IS_PAGE_WRITEABLE(PointerPte)) { - // - // Get rid of the mapping - // - MiDbgUnTranslatePhysicalAddress(); - } + /* Not writable, we need to do a physical copy */ + Flags |= MMDBG_COPY_PHYSICAL; - // - // Fail - // - // FIXME: We should attempt to override the write protection instead of - // failing here - // - KdpDprintf("MmDbgCopyMemory: Failing Write for Protected Address 0x%p\n", - TargetAddress); - return STATUS_UNSUCCESSFUL; + /* Calculate the physical address */ + PhysicalAddress = PointerPte->u.Hard.PageFrameNumber << PAGE_SHIFT; + PhysicalAddress += BYTE_OFFSET(Address); + + /* Translate the physical address */ + TargetAddress = MiDbgTranslatePhysicalAddress(PhysicalAddress, Flags); + + /* Check if translation failed */ + if (!TargetAddress) + { + /* Fail */ + KdpDprintf("MmDbgCopyMemory: Failed to translate for write " + "%I64x (%I64x)\n", PhysicalAddress, Address); + return STATUS_UNSUCCESSFUL; + } + } } // diff --git a/ntoskrnl/mm/ARM3/mminit.c b/ntoskrnl/mm/ARM3/mminit.c index 650b67b47ee..74831fe508a 100644 --- a/ntoskrnl/mm/ARM3/mminit.c +++ b/ntoskrnl/mm/ARM3/mminit.c @@ -1087,7 +1087,7 @@ MiCreateMemoryEvent(IN PUNICODE_STRING Name, FALSE); CleanUp: /* Free the DACL */ - ExFreePool(Dacl); + ExFreePoolWithTag(Dacl, 'lcaD'); /* Check if this is the success path */ if (NT_SUCCESS(Status)) @@ -1533,7 +1533,7 @@ MmInitializeMemoryLimits(IN PLOADER_PARAMETER_BLOCK LoaderBlock, RtlCopyMemory(NewBuffer->Run, Buffer->Run, sizeof(PHYSICAL_MEMORY_RUN) * Run); - ExFreePool(Buffer); + ExFreePoolWithTag(Buffer, 'lMmM'); // // Now use the new buffer diff --git a/ntoskrnl/mm/ARM3/pagfault.c b/ntoskrnl/mm/ARM3/pagfault.c index f3f2b6c129f..646f77cb205 100644 --- a/ntoskrnl/mm/ARM3/pagfault.c +++ b/ntoskrnl/mm/ARM3/pagfault.c @@ -583,10 +583,19 @@ MiDispatchFault(IN BOOLEAN StoreInstruction, } // - // The PTE must be invalid, but not totally blank + // The PTE must be invalid // ASSERT(TempPte.u.Hard.Valid == 0); - ASSERT(TempPte.u.Long != 0); + + /* Check if the PTE is completely empty */ + if (TempPte.u.Long == 0) + { + KeBugCheckEx(PAGE_FAULT_IN_NONPAGED_AREA, + (ULONG_PTR)Address, + StoreInstruction, + (ULONG_PTR)TrapInformation, + 2); + } // // No prototype, transition or page file software PTEs in ARM3 yet @@ -727,11 +736,6 @@ MmArmAccessFault(IN BOOLEAN StoreInstruction, // Writing to a read-only page (the stuff ARM3 works with is write, // so again, moot point). // - if (StoreInstruction) - { - DPRINT1("Should NEVER happen on ARM3!!!\n"); - return STATUS_ACCESS_VIOLATION; - } // // Otherwise, the PDE was probably invalid, and all is good now @@ -776,11 +780,6 @@ MmArmAccessFault(IN BOOLEAN StoreInstruction, // Writing to a read-only page (the stuff ARM3 works with is write, // so again, moot point. // - if (StoreInstruction) - { - DPRINT1("Should NEVER happen on ARM3!!!\n"); - return STATUS_ACCESS_VIOLATION; - } /* Release the working set */ MiUnlockWorkingSet(CurrentThread, WorkingSet); diff --git a/ntoskrnl/mm/ARM3/procsup.c b/ntoskrnl/mm/ARM3/procsup.c index f40e5171256..79612f17b31 100644 --- a/ntoskrnl/mm/ARM3/procsup.c +++ b/ntoskrnl/mm/ARM3/procsup.c @@ -576,13 +576,7 @@ MmCreatePeb(IN PEPROCESS Process, // Attach to Process // KeAttachProcess(&Process->Pcb); - - // - // Allocate the PEB - // - Status = MiCreatePebOrTeb(Process, sizeof(PEB), (PULONG_PTR)&Peb); - ASSERT(NT_SUCCESS(Status)); - + // // Map NLS Tables // @@ -596,7 +590,25 @@ MmCreatePeb(IN PEPROCESS Process, ViewShare, MEM_TOP_DOWN, PAGE_READONLY); - if (!NT_SUCCESS(Status)) return Status; + DPRINT1("NLS Tables at: %p\n", TableBase); + if (!NT_SUCCESS(Status)) + { + /* Cleanup and exit */ + KeDetachProcess(); + return Status; + } + + // + // Allocate the PEB + // + Status = MiCreatePebOrTeb(Process, sizeof(PEB), (PULONG_PTR)&Peb); + DPRINT1("PEB at: %p\n", Peb); + if (!NT_SUCCESS(Status)) + { + /* Cleanup and exit */ + KeDetachProcess(); + return Status; + } // // Use SEH in case we can't load the PEB @@ -636,7 +648,7 @@ MmCreatePeb(IN PEPROCESS Process, // Heap and Debug Data // Peb->NumberOfProcessors = KeNumberProcessors; - Peb->BeingDebugged = (BOOLEAN)(Process->DebugPort != NULL ? TRUE : FALSE); + Peb->BeingDebugged = (BOOLEAN)(Process->DebugPort != NULL); Peb->NtGlobalFlag = NtGlobalFlag; /*Peb->HeapSegmentReserve = MmHeapSegmentReserve; Peb->HeapSegmentCommit = MmHeapSegmentCommit; @@ -730,34 +742,20 @@ MmCreatePeb(IN PEPROCESS Process, Peb->OSMinorVersion = (NtHeaders->OptionalHeader.Win32VersionValue >> 8) & 0xFF; Peb->OSBuildNumber = (NtHeaders->OptionalHeader.Win32VersionValue >> 16) & 0x3FFF; Peb->OSPlatformId = (NtHeaders->OptionalHeader.Win32VersionValue >> 30) ^ 2; - } - // - // Process the image config data overrides if specfied - // - if (ImageConfigData != NULL) - { - // - // Process CSD version override - // - if (ImageConfigData->CSDVersion) + /* Process CSD version override */ + if ((ImageConfigData) && (ImageConfigData->CSDVersion)) { - // - // Set new data - // + /* Take the value from the image configuration directory */ Peb->OSCSDVersion = ImageConfigData->CSDVersion; } + } - // - // Process affinity mask ovverride - // - if (ImageConfigData->ProcessAffinityMask) - { - // - // Set new data - // - ProcessAffinityMask = ImageConfigData->ProcessAffinityMask; - } + /* Process optional process affinity mask override */ + if ((ImageConfigData) && (ImageConfigData->ProcessAffinityMask)) + { + /* Take the value from the image configuration directory */ + ProcessAffinityMask = ImageConfigData->ProcessAffinityMask; } // @@ -767,6 +765,7 @@ MmCreatePeb(IN PEPROCESS Process, // // Force it to use CPU 0 // + /* FIXME: this should use the MmRotatingUniprocessorNumber */ Peb->ImageProcessAffinityMask = 0; } else diff --git a/ntoskrnl/mm/ARM3/section.c b/ntoskrnl/mm/ARM3/section.c index eee56cbf783..af122899a76 100644 --- a/ntoskrnl/mm/ARM3/section.c +++ b/ntoskrnl/mm/ARM3/section.c @@ -177,7 +177,7 @@ MiInitializeSystemSpaceMap(IN PVOID InputSession OPTIONAL) BitmapSize = sizeof(RTL_BITMAP) + ((((MmSystemViewSize / MI_SYSTEM_VIEW_BUCKET_SIZE) + 31) / 32) * sizeof(ULONG)); Session->SystemSpaceBitMap = ExAllocatePoolWithTag(NonPagedPool, BitmapSize, - ' mM'); + TAG_MM); ASSERT(Session->SystemSpaceBitMap); RtlInitializeBitMap(Session->SystemSpaceBitMap, (PULONG)(Session->SystemSpaceBitMap + 1), @@ -198,7 +198,7 @@ MiInitializeSystemSpaceMap(IN PVOID InputSession OPTIONAL) /* Allocate and zero the view table */ Session->SystemSpaceViewTable = ExAllocatePoolWithTag(NonPagedPool, AllocSize, - ' mM'); + TAG_MM); ASSERT(Session->SystemSpaceViewTable != NULL); RtlZeroMemory(Session->SystemSpaceViewTable, AllocSize); @@ -948,7 +948,7 @@ MmGetFileNameForFileObject(IN PFILE_OBJECT FileObject, ULONG ReturnLength; /* Allocate memory for our structure */ - ObjectNameInfo = ExAllocatePoolWithTag(PagedPool, 1024, ' mM'); + ObjectNameInfo = ExAllocatePoolWithTag(PagedPool, 1024, TAG_MM); if (!ObjectNameInfo) return STATUS_NO_MEMORY; /* Query the name */ @@ -960,7 +960,7 @@ MmGetFileNameForFileObject(IN PFILE_OBJECT FileObject, { /* Failed, free memory */ DPRINT1("Name query failed\n"); - ExFreePoolWithTag(ObjectNameInfo, ' mM'); + ExFreePoolWithTag(ObjectNameInfo, TAG_MM); *ModuleName = NULL; return Status; } @@ -1088,7 +1088,7 @@ NotSection: ModuleNameInformation->Name.Buffer); /* Free temp taged buffer from MmGetFileNameForFileObject() */ - ExFreePoolWithTag(ModuleNameInformation, ' mM'); + ExFreePoolWithTag(ModuleNameInformation, TAG_MM); DPRINT("Found ModuleName %S by address %p\n", ModuleName->Buffer, Address); } diff --git a/ntoskrnl/mm/ARM3/sysldr.c b/ntoskrnl/mm/ARM3/sysldr.c index 2ca28005d9c..51d5cec2839 100644 --- a/ntoskrnl/mm/ARM3/sysldr.c +++ b/ntoskrnl/mm/ARM3/sysldr.c @@ -336,7 +336,7 @@ MmCallDllInitialize(IN PLDR_DATA_TABLE_ENTRY LdrEntry, Status = DllInit(&RegPath); /* Clean up */ - ExFreePool(RegPath.Buffer); + ExFreePoolWithTag(RegPath.Buffer, TAG_LDR_WSTR); /* Return status value which DllInitialize returned */ return Status; @@ -427,7 +427,7 @@ MiDereferenceImports(IN PLOAD_IMPORTS ImportList) !((ULONG_PTR)LdrEntry->LoadedImports & MM_SYSLDR_SINGLE_ENTRY)) { /* Free them */ - ExFreePool(CurrentImports); + ExFreePoolWithTag(CurrentImports, TAG_LDR_IMPORTS); } } else @@ -458,7 +458,7 @@ MiClearImports(IN PLDR_DATA_TABLE_ENTRY LdrEntry) } /* Otherwise, free the import list */ - ExFreePool(LdrEntry->LoadedImports); + ExFreePoolWithTag(LdrEntry->LoadedImports, TAG_LDR_IMPORTS); LdrEntry->LoadedImports = MM_SYSLDR_BOOT_LOADED; } @@ -948,7 +948,7 @@ MmUnloadSystemImage(IN PVOID ImageHandle) if (LdrEntry->FullDllName.Buffer) { /* Free it */ - ExFreePool(LdrEntry->FullDllName.Buffer); + ExFreePoolWithTag(LdrEntry->FullDllName.Buffer, TAG_LDR_WSTR); } /* Check if we had a section */ @@ -959,7 +959,7 @@ MmUnloadSystemImage(IN PVOID ImageHandle) } /* Free the entry */ - ExFreePool(LdrEntry); + ExFreePoolWithTag(LdrEntry, TAG_MODULE_OBJECT); } /* Release the system lock and return */ @@ -1022,7 +1022,7 @@ MiResolveImageReferences(IN PVOID ImageBase, LoadedImportsSize = ImportCount * sizeof(PVOID) + sizeof(SIZE_T); LoadedImports = ExAllocatePoolWithTag(PagedPool, LoadedImportsSize, - 'TDmM'); + TAG_LDR_IMPORTS); if (LoadedImports) { /* Zero it */ @@ -1059,7 +1059,7 @@ MiResolveImageReferences(IN PVOID ImageBase, { /* It's not, it's importing stuff it shouldn't be! */ MiDereferenceImports(LoadedImports); - if (LoadedImports) ExFreePoolWithTag(LoadedImports, 'TDmM'); + if (LoadedImports) ExFreePoolWithTag(LoadedImports, TAG_LDR_IMPORTS); return STATUS_PROCEDURE_NOT_FOUND; } @@ -1073,7 +1073,7 @@ MiResolveImageReferences(IN PVOID ImageBase, { /* This is not kernel code */ MiDereferenceImports(LoadedImports); - if (LoadedImports) ExFreePoolWithTag(LoadedImports, 'TDmM'); + if (LoadedImports) ExFreePoolWithTag(LoadedImports, TAG_LDR_IMPORTS); return STATUS_PROCEDURE_NOT_FOUND; } @@ -1098,7 +1098,7 @@ MiResolveImageReferences(IN PVOID ImageBase, { /* Failed */ MiDereferenceImports(LoadedImports); - if (LoadedImports) ExFreePoolWithTag(LoadedImports, 'TDmM'); + if (LoadedImports) ExFreePoolWithTag(LoadedImports, TAG_LDR_IMPORTS); return Status; } @@ -1153,7 +1153,7 @@ CheckDllState: sizeof(UNICODE_NULL); DllName.Buffer = ExAllocatePoolWithTag(NonPagedPool, DllName.MaximumLength, - 'TDmM'); + TAG_LDR_WSTR); if (DllName.Buffer) { /* Setup the base length and copy it */ @@ -1177,7 +1177,7 @@ CheckDllState: if (NT_SUCCESS(Status)) { /* We can free the DLL Name */ - ExFreePool(DllName.Buffer); + ExFreePoolWithTag(DllName.Buffer, TAG_LDR_WSTR); } else { @@ -1219,7 +1219,7 @@ CheckDllState: /* Cleanup and return */ RtlFreeUnicodeString(&NameString); MiDereferenceImports(LoadedImports); - if (LoadedImports) ExFreePoolWithTag(LoadedImports, 'TDmM'); + if (LoadedImports) ExFreePoolWithTag(LoadedImports, TAG_LDR_IMPORTS); return Status; } @@ -1252,7 +1252,7 @@ CheckDllState: { /* Cleanup and return */ MiDereferenceImports(LoadedImports); - if (LoadedImports) ExFreePoolWithTag(LoadedImports, 'TDmM'); + if (LoadedImports) ExFreePoolWithTag(LoadedImports, TAG_LDR_IMPORTS); DPRINT1("Warning: Driver failed to load, %S not found\n", *MissingDriver); return STATUS_DRIVER_ENTRYPOINT_NOT_FOUND; } @@ -1282,7 +1282,7 @@ CheckDllState: { /* Cleanup and return */ MiDereferenceImports(LoadedImports); - if (LoadedImports) ExFreePoolWithTag(LoadedImports, 'TDmM'); + if (LoadedImports) ExFreePoolWithTag(LoadedImports, TAG_LDR_IMPORTS); return Status; } @@ -1315,13 +1315,13 @@ CheckDllState: if (!ImportCount) { /* Free the list and set it to no imports */ - ExFreePoolWithTag(LoadedImports, 'TDmM'); + ExFreePoolWithTag(LoadedImports, TAG_LDR_IMPORTS); LoadedImports = MM_SYSLDR_NO_IMPORTS; } else if (ImportCount == 1) { /* Just one entry, we can free the table and only use our entry */ - ExFreePoolWithTag(LoadedImports, 'TDmM'); + ExFreePoolWithTag(LoadedImports, TAG_LDR_IMPORTS); LoadedImports = (PLOAD_IMPORTS)ImportEntry; } else if (ImportCount != LoadedImports->Count) @@ -1330,7 +1330,7 @@ CheckDllState: LoadedImportsSize = ImportCount * sizeof(PVOID) + sizeof(SIZE_T); NewImports = ExAllocatePoolWithTag(PagedPool, LoadedImportsSize, - 'TDmM'); + TAG_LDR_IMPORTS); if (NewImports) { /* Set count */ @@ -1349,7 +1349,7 @@ CheckDllState: } /* Free the old copy */ - ExFreePoolWithTag(LoadedImports, 'TDmM'); + ExFreePoolWithTag(LoadedImports, TAG_LDR_IMPORTS); LoadedImports = NewImports; } } @@ -1625,7 +1625,7 @@ MiBuildImportsForBootDrivers(VOID) if (!(HalEntry) || (!KernelEntry)) return STATUS_NOT_FOUND; /* Allocate the list */ - EntryArray = ExAllocatePoolWithTag(PagedPool, Modules * sizeof(PVOID), 'TDmM'); + EntryArray = ExAllocatePoolWithTag(PagedPool, Modules * sizeof(PVOID), TAG_LDR_IMPORTS); if (!EntryArray) return STATUS_INSUFFICIENT_RESOURCES; /* Loop the loaded module list again */ @@ -1773,7 +1773,7 @@ MiBuildImportsForBootDrivers(VOID) LoadedImportsSize = ImportSize * sizeof(PVOID) + sizeof(SIZE_T); LoadedImports = ExAllocatePoolWithTag(PagedPool, LoadedImportsSize, - 'TDmM'); + TAG_LDR_IMPORTS); ASSERT(LoadedImports); /* Save the count */ @@ -1805,7 +1805,7 @@ MiBuildImportsForBootDrivers(VOID) } /* Free the initial array */ - ExFreePool(EntryArray); + ExFreePoolWithTag(EntryArray, TAG_LDR_IMPORTS); /* FIXME: Might not need to keep the HAL/Kernel imports around */ @@ -1923,7 +1923,7 @@ MiInitializeLoadedModuleList(IN PLOADER_PARAMETER_BLOCK LoaderBlock) EntrySize = sizeof(LDR_DATA_TABLE_ENTRY) + LdrEntry->BaseDllName.MaximumLength + sizeof(UNICODE_NULL); - NewEntry = ExAllocatePoolWithTag(NonPagedPool, EntrySize, TAG_LDR_WSTR); + NewEntry = ExAllocatePoolWithTag(NonPagedPool, EntrySize, TAG_MODULE_OBJECT); if (!NewEntry) return FALSE; /* Copy the entry over */ @@ -2086,7 +2086,7 @@ MiWriteProtectSystemImage(IN PVOID ImageBase) PIMAGE_NT_HEADERS NtHeaders; PIMAGE_SECTION_HEADER Section; PFN_NUMBER DriverPages; - ULONG CurrentProtection, SectionProtection, CombinedProtection, ProtectionMask; + ULONG CurrentProtection, SectionProtection, CombinedProtection = 0, ProtectionMask; ULONG Sections, Size; ULONG_PTR BaseAddress, CurrentAddress; PMMPTE PointerPte, StartPte, LastPte, CurrentPte, ComboPte = NULL; @@ -2561,7 +2561,7 @@ MmLoadSystemImage(IN PUNICODE_STRING FileName, } /* Allocate a buffer we'll use for names */ - Buffer = ExAllocatePoolWithTag(NonPagedPool, MAX_PATH, 'nLmM'); + Buffer = ExAllocatePoolWithTag(NonPagedPool, MAX_PATH, TAG_LDR_WSTR); if (!Buffer) return STATUS_INSUFFICIENT_RESOURCES; /* Check for a separator */ @@ -2906,7 +2906,7 @@ LoaderScan: if (LdrEntry->FullDllName.Buffer) { /* Free it */ - ExFreePool(LdrEntry->FullDllName.Buffer); + ExFreePoolWithTag(LdrEntry->FullDllName.Buffer, TAG_LDR_WSTR); } /* Free the entry itself */ @@ -3004,7 +3004,7 @@ Quickie: /* if (NamePrefix) ExFreePool(PrefixName.Buffer); */ /* Free the name buffer and return status */ - ExFreePoolWithTag(Buffer, 'nLmM'); + ExFreePoolWithTag(Buffer, TAG_LDR_WSTR); return Status; } diff --git a/ntoskrnl/mm/ARM3/vadnode.c b/ntoskrnl/mm/ARM3/vadnode.c index 551a1946f8e..0d6fbd6a47c 100644 --- a/ntoskrnl/mm/ARM3/vadnode.c +++ b/ntoskrnl/mm/ARM3/vadnode.c @@ -393,11 +393,11 @@ MiFindEmptyAddressRangeDownTree(IN SIZE_T Length, /* Calculate the initial upper margin */ HighVpn = BoundaryAddress >> PAGE_SHIFT; - /* Starting from the root, go down until the right-most child, - trying to stay below the boundary. */ + /* Starting from the root, go down until the right-most child + * which is just behind the boundary*/ LowestNode = Node = RtlRightChildAvl(&Table->BalancedRoot); - while ( (Child = RtlRightChildAvl(Node)) && - Child->EndingVpn < HighVpn ) Node = Child; + while (((Child = RtlRightChildAvl(Node)) != 0 ) + && (Node->EndingVpn < HighVpn )) Node = Child; /* Now loop the Vad nodes */ while (Node) diff --git a/ntoskrnl/mm/anonmem.c b/ntoskrnl/mm/anonmem.c index 766a8fc17c2..70211e5fb72 100644 --- a/ntoskrnl/mm/anonmem.c +++ b/ntoskrnl/mm/anonmem.c @@ -48,89 +48,6 @@ /* FUNCTIONS *****************************************************************/ -NTSTATUS -NTAPI -MmWritePageVirtualMemory(PMMSUPPORT AddressSpace, - PMEMORY_AREA MemoryArea, - PVOID Address, - PMM_PAGEOP PageOp) -{ - SWAPENTRY SwapEntry; - PFN_NUMBER Page; - NTSTATUS Status; - PEPROCESS Process = MmGetAddressSpaceOwner(AddressSpace); - - /* - * Check for paging out from a deleted virtual memory area. - */ - if (MemoryArea->DeleteInProgress) - { - PageOp->Status = STATUS_UNSUCCESSFUL; - KeSetEvent(&PageOp->CompletionEvent, IO_NO_INCREMENT, FALSE); - MmReleasePageOp(PageOp); - return(STATUS_UNSUCCESSFUL); - } - - Page = MmGetPfnForProcess(Process, Address); - - /* - * Get that the page actually is dirty. - */ - if (!MmIsDirtyPage(Process, Address)) - { - PageOp->Status = STATUS_SUCCESS; - KeSetEvent(&PageOp->CompletionEvent, IO_NO_INCREMENT, FALSE); - MmReleasePageOp(PageOp); - return(STATUS_SUCCESS); - } - - /* - * Speculatively set the mapping to clean. - */ - MmSetCleanPage(Process, Address); - - /* - * If necessary, allocate an entry in the paging file for this page - */ - SwapEntry = MmGetSavedSwapEntryPage(Page); - if (SwapEntry == 0) - { - SwapEntry = MmAllocSwapPage(); - if (SwapEntry == 0) - { - MmSetDirtyPage(Process, Address); - PageOp->Status = STATUS_PAGEFILE_QUOTA_EXCEEDED; - KeSetEvent(&PageOp->CompletionEvent, IO_NO_INCREMENT, FALSE); - MmReleasePageOp(PageOp); - return(STATUS_PAGEFILE_QUOTA_EXCEEDED); - } - } - - /* - * Write the page to the pagefile - */ - Status = MmWriteToSwapPage(SwapEntry, Page); - if (!NT_SUCCESS(Status)) - { - DPRINT1("MM: Failed to write to swap page (Status was 0x%.8X)\n", - Status); - MmSetDirtyPage(Process, Address); - PageOp->Status = STATUS_UNSUCCESSFUL; - KeSetEvent(&PageOp->CompletionEvent, IO_NO_INCREMENT, FALSE); - MmReleasePageOp(PageOp); - return(STATUS_UNSUCCESSFUL); - } - - /* - * Otherwise we have succeeded. - */ - MmSetSavedSwapEntryPage(Page, SwapEntry); - PageOp->Status = STATUS_SUCCESS; - KeSetEvent(&PageOp->CompletionEvent, IO_NO_INCREMENT, FALSE); - MmReleasePageOp(PageOp); - return(STATUS_SUCCESS); -} - NTSTATUS NTAPI MmPageOutVirtualMemory(PMMSUPPORT AddressSpace, diff --git a/ntoskrnl/mm/freelist.c b/ntoskrnl/mm/freelist.c index 7eef9593f95..b9097511cd8 100644 --- a/ntoskrnl/mm/freelist.c +++ b/ntoskrnl/mm/freelist.c @@ -33,7 +33,6 @@ PFN_NUMBER MmAvailablePages; PFN_NUMBER MmResidentAvailablePages; PFN_NUMBER MmResidentAvailableAtInit; -SIZE_T MmTotalCommitLimit; SIZE_T MmTotalCommittedPages; SIZE_T MmSharedCommit; SIZE_T MmDriverCommit; diff --git a/ntoskrnl/mm/marea.c b/ntoskrnl/mm/marea.c index dc50d13f723..86c9b015243 100644 --- a/ntoskrnl/mm/marea.c +++ b/ntoskrnl/mm/marea.c @@ -377,7 +377,7 @@ MmInsertMemoryArea( PMMVAD Vad; ASSERT(marea->Type == MEMORY_AREA_VIRTUAL_MEMORY || marea->Type == MEMORY_AREA_SECTION_VIEW); - Vad = ExAllocatePoolWithTag(NonPagedPool, sizeof(MMVAD), 'Fake'); + Vad = ExAllocatePoolWithTag(NonPagedPool, sizeof(MMVAD), TAG_MVAD); ASSERT(Vad); RtlZeroMemory(Vad, sizeof(MMVAD)); Vad->StartingVpn = PAGE_ROUND_DOWN(marea->StartingAddress) >> PAGE_SHIFT; @@ -776,7 +776,7 @@ MmFreeMemoryArea( MiRemoveNode(MemoryArea->Vad, &Process->VadRoot); } - ExFreePool(MemoryArea->Vad); + ExFreePoolWithTag(MemoryArea->Vad, TAG_MVAD); MemoryArea->Vad = NULL; } } diff --git a/ntoskrnl/mm/region.c b/ntoskrnl/mm/region.c index 9c79738b036..413d96bc6b3 100644 --- a/ntoskrnl/mm/region.c +++ b/ntoskrnl/mm/region.c @@ -53,7 +53,7 @@ MmSplitRegion(PMM_REGION InitialRegion, PVOID InitialBaseAddress, TAG_MM_REGION); if (NewRegion1 == NULL) { - ExFreePool(NewRegion2); + ExFreePoolWithTag(NewRegion2, TAG_MM_REGION); return(NULL); } NewRegion1->Type = NewType; @@ -86,14 +86,14 @@ MmSplitRegion(PMM_REGION InitialRegion, PVOID InitialBaseAddress, } else { - ExFreePool(NewRegion2); + ExFreePoolWithTag(NewRegion2, TAG_MM_REGION); } /* Either remove or shrink the initial region. */ if (InitialBaseAddress == StartAddress) { RemoveEntryList(&InitialRegion->RegionListEntry); - ExFreePool(InitialRegion); + ExFreePoolWithTag(InitialRegion, TAG_MM_REGION); } else { @@ -123,17 +123,6 @@ MmAlterRegion(PMMSUPPORT AddressSpace, PVOID BaseAddress, */ InitialRegion = MmFindRegion(BaseAddress, RegionListHead, StartAddress, &InitialBaseAddress); - if (((char*)StartAddress + Length) > - ((char*)InitialBaseAddress + InitialRegion->Length)) - { - RemainingLength = ((char*)StartAddress + Length) - - ((char*)InitialBaseAddress + InitialRegion->Length); - } - else - { - RemainingLength = 0; - } - /* * If necessary then split the region into the affected and unaffected parts. */ @@ -146,10 +135,19 @@ MmAlterRegion(PMMSUPPORT AddressSpace, PVOID BaseAddress, { return(STATUS_NO_MEMORY); } + if(NewRegion->Length < Length) + RemainingLength = Length - NewRegion->Length; + else + RemainingLength = 0; } else { NewRegion = InitialRegion; + if(((ULONG_PTR)InitialBaseAddress + NewRegion->Length) < + ((ULONG_PTR)StartAddress + Length)) + RemainingLength = ((ULONG_PTR)StartAddress + Length) - ((ULONG_PTR)InitialBaseAddress + NewRegion->Length); + else + RemainingLength = 0; } /* @@ -163,7 +161,7 @@ MmAlterRegion(PMMSUPPORT AddressSpace, PVOID BaseAddress, while (RemainingLength > 0 && CurrentRegion->Length <= RemainingLength && CurrentEntry != RegionListHead) { - if (CurrentRegion->Type != NewType && + if (CurrentRegion->Type != NewType || CurrentRegion->Protect != NewProtect) { AlterFunc(AddressSpace, CurrentBaseAddress, CurrentRegion->Length, @@ -176,7 +174,7 @@ MmAlterRegion(PMMSUPPORT AddressSpace, PVOID BaseAddress, RemainingLength -= CurrentRegion->Length; CurrentEntry = CurrentEntry->Flink; RemoveEntryList(&CurrentRegion->RegionListEntry); - ExFreePool(CurrentRegion); + ExFreePoolWithTag(CurrentRegion, TAG_MM_REGION); CurrentRegion = CONTAINING_RECORD(CurrentEntry, MM_REGION, RegionListEntry); } @@ -188,10 +186,10 @@ MmAlterRegion(PMMSUPPORT AddressSpace, PVOID BaseAddress, { CurrentRegion = CONTAINING_RECORD(CurrentEntry, MM_REGION, RegionListEntry); - if (CurrentRegion->Type != NewType && + if (CurrentRegion->Type != NewType || CurrentRegion->Protect != NewProtect) { - AlterFunc(AddressSpace, CurrentBaseAddress, CurrentRegion->Length, + AlterFunc(AddressSpace, CurrentBaseAddress, RemainingLength, CurrentRegion->Type, CurrentRegion->Protect, NewType, NewProtect); } @@ -212,7 +210,7 @@ MmAlterRegion(PMMSUPPORT AddressSpace, PVOID BaseAddress, { NewRegion->Length += CurrentRegion->Length; RemoveEntryList(&CurrentRegion->RegionListEntry); - ExFreePool(CurrentRegion); + ExFreePoolWithTag(CurrentRegion, TAG_MM_REGION); } } @@ -229,7 +227,7 @@ MmAlterRegion(PMMSUPPORT AddressSpace, PVOID BaseAddress, { NewRegion->Length += CurrentRegion->Length; RemoveEntryList(&CurrentRegion->RegionListEntry); - ExFreePool(CurrentRegion); + ExFreePoolWithTag(CurrentRegion, TAG_MM_REGION); } } diff --git a/ntoskrnl/mm/section.c b/ntoskrnl/mm/section.c index 7749a03eb05..6948d47de18 100644 --- a/ntoskrnl/mm/section.c +++ b/ntoskrnl/mm/section.c @@ -124,8 +124,6 @@ MM_SECTION_PAGEOUT_CONTEXT; POBJECT_TYPE MmSectionObjectType = NULL; -SIZE_T MmAllocationFragment; - ULONG_PTR MmSubsectionBase; static ULONG SectionCharacteristicsToProtect[16] = diff --git a/ntoskrnl/ntoskrnl-generic.rbuild b/ntoskrnl/ntoskrnl-generic.rbuild index 9eb9bcd86b0..ab24126b800 100644 --- a/ntoskrnl/ntoskrnl-generic.rbuild +++ b/ntoskrnl/ntoskrnl-generic.rbuild @@ -113,9 +113,6 @@ dpc.c eventobj.c except.c - - freeldr.c - freeze.c gate.c gmutex.c @@ -221,16 +218,10 @@ - interlck_asm.S fastinterlck_asm.S ioport.S - - - fastinterlck.c - - atom.c callback.c dbgctrl.c @@ -238,12 +229,12 @@ event.c evtpair.c exintrin.c - fastinterlck.c fmutex.c handle.c harderr.c hdlsterm.c init.c + interlocked.c keyedevt.c locale.c lookas.c diff --git a/ntoskrnl/ntoskrnl.pspec b/ntoskrnl/ntoskrnl.pspec index 1c65cc24145..78d357dc75d 100644 --- a/ntoskrnl/ntoskrnl.pspec +++ b/ntoskrnl/ntoskrnl.pspec @@ -198,7 +198,7 @@ @ FASTCALL -arch=i386 Exfi386InterlockedExchangeUlong(ptr long) @ FASTCALL -arch=i386 Exfi386InterlockedIncrementLong(ptr) @ stdcall -arch=i386 Exi386InterlockedDecrementLong(ptr) -@ stdcall -arch=i386 Exi386InterlockedExchangeUlong(ptr long long) +@ stdcall -arch=i386 Exi386InterlockedExchangeUlong(ptr long) @ stdcall -arch=i386 Exi386InterlockedIncrementLong(ptr) @ FASTCALL -arch=i386 ExiAcquireFastMutex(ptr) ExAcquireFastMutex @ FASTCALL -arch=i386 ExiReleaseFastMutex(ptr) ExReleaseFastMutex @@ -325,7 +325,7 @@ @ extern HalDispatchTable _HalDispatchTable @ FASTCALL HalExamineMBR(ptr long long ptr) @ extern HalPrivateDispatchTable -;HeadlessDispatch +@ stdcall HeadlessDispatch(long ptr long ptr ptr) @ stdcall InbvAcquireDisplayOwnership() @ stdcall InbvCheckDisplayOwnership() @ stdcall InbvDisplayString(str) diff --git a/ntoskrnl/ntoskrnl.rbuild b/ntoskrnl/ntoskrnl.rbuild index 6a541aca975..0de9334ffc2 100644 --- a/ntoskrnl/ntoskrnl.rbuild +++ b/ntoskrnl/ntoskrnl.rbuild @@ -4,8 +4,8 @@ + + include + ntdll.S + - - include - ntdll.S - diff --git a/ntoskrnl/ntoskrnl.spec b/ntoskrnl/ntoskrnl.spec index 021abac3809..a4d99747be6 100644 --- a/ntoskrnl/ntoskrnl.spec +++ b/ntoskrnl/ntoskrnl.spec @@ -178,7 +178,7 @@ @ fastcall -arch=i386 Exfi386InterlockedExchangeUlong(ptr long) @ fastcall -arch=i386 Exfi386InterlockedIncrementLong(ptr) @ stdcall -arch=i386 Exi386InterlockedDecrementLong(ptr) -@ stdcall -arch=i386 Exi386InterlockedExchangeUlong(ptr long long) +@ stdcall -arch=i386 Exi386InterlockedExchangeUlong(ptr long) @ stdcall -arch=i386 Exi386InterlockedIncrementLong(ptr) @ fastcall -arch=i386 ExiAcquireFastMutex(ptr) ExAcquireFastMutex @ fastcall -arch=i386 ExiReleaseFastMutex(ptr) ExReleaseFastMutex @@ -305,7 +305,7 @@ @ extern HalDispatchTable _HalDispatchTable @ fastcall HalExamineMBR(ptr long long ptr) @ extern HalPrivateDispatchTable -;HeadlessDispatch +@ stdcall HeadlessDispatch(long ptr long ptr ptr) @ stdcall InbvAcquireDisplayOwnership() @ stdcall InbvCheckDisplayOwnership() @ stdcall InbvDisplayString(str) diff --git a/ntoskrnl/ob/obname.c b/ntoskrnl/ob/obname.c index a387cb4e81b..6d0efd32695 100644 --- a/ntoskrnl/ob/obname.c +++ b/ntoskrnl/ob/obname.c @@ -694,7 +694,7 @@ ParseFromRoot: ObjectHeader))) { /* Either couldn't allocate the name, or insert failed */ - if (NewName) ExFreePool(NewName); + if (NewName) ExFreePoolWithTag(NewName, OB_NAME_TAG); /* Fail due to memory reasons */ Status = STATUS_INSUFFICIENT_RESOURCES; diff --git a/ntoskrnl/ob/obsdcach.c b/ntoskrnl/ob/obsdcach.c index 52e5a8d5096..840298e3a61 100644 --- a/ntoskrnl/ob/obsdcach.c +++ b/ntoskrnl/ob/obsdcach.c @@ -132,7 +132,7 @@ ObpCreateCacheEntry(IN PSECURITY_DESCRIPTOR SecurityDescriptor, /* Calculate the memory we'll need to allocate and allocate it */ CacheSize = Length + (sizeof(SECURITY_DESCRIPTOR_HEADER) - sizeof(QUAD)); - SdHeader = ExAllocatePoolWithTag(PagedPool, CacheSize, 'cSbO'); + SdHeader = ExAllocatePoolWithTag(PagedPool, CacheSize, TAG_OB_SD_CACHE); if (!SdHeader) return NULL; /* Setup the header */ diff --git a/ntoskrnl/po/poshtdwn.c b/ntoskrnl/po/poshtdwn.c index 919ffd4eefb..54e27e25063 100644 --- a/ntoskrnl/po/poshtdwn.c +++ b/ntoskrnl/po/poshtdwn.c @@ -84,6 +84,7 @@ PopShutdownSystem(IN POWER_ACTION SystemAction) /* Try platform driver first, then legacy */ //PopInvokeSystemStateHandler(PowerStateShutdownReset, NULL); + PopSetSystemPowerState(PowerSystemShutdown, SystemAction); HalReturnToFirmware(HalRebootRoutine); break; @@ -102,7 +103,7 @@ PopShutdownSystem(IN POWER_ACTION SystemAction) //PopInvokeSystemStateHandler(PowerStateShutdownOff, NULL); /* ReactOS Hack */ - PopSetSystemPowerState(PowerSystemShutdown); + PopSetSystemPowerState(PowerSystemShutdown, SystemAction); PopShutdownHandler(); /* If that didn't work, call the HAL */ diff --git a/ntoskrnl/po/power.c b/ntoskrnl/po/power.c index a4f45c0f38c..85839a9ce67 100644 --- a/ntoskrnl/po/power.c +++ b/ntoskrnl/po/power.c @@ -23,6 +23,13 @@ typedef struct _REQUEST_POWER_ITEM PVOID Context; } REQUEST_POWER_ITEM, *PREQUEST_POWER_ITEM; +typedef struct _POWER_STATE_TRAVERSE_CONTEXT +{ + SYSTEM_POWER_STATE SystemPowerState; + POWER_ACTION PowerAction; + PDEVICE_OBJECT PowerDevice; +} POWER_STATE_TRAVERSE_CONTEXT, *PPOWER_STATE_TRAVERSE_CONTEXT; + PDEVICE_NODE PopSystemPowerDeviceNode = NULL; BOOLEAN PopAcpiPresent = FALSE; POP_POWER_ACTION PopAction; @@ -64,53 +71,33 @@ PopCleanupPowerState(IN PPOWER_STATE PowerState) } NTSTATUS -NTAPI -PopSetSystemPowerState(SYSTEM_POWER_STATE PowerState) +PopSendQuerySystemPowerState(PDEVICE_OBJECT DeviceObject, SYSTEM_POWER_STATE SystemState, POWER_ACTION PowerAction) { - IO_STATUS_BLOCK IoStatusBlock; - PDEVICE_OBJECT DeviceObject; - PIO_STACK_LOCATION IrpSp; - PDEVICE_OBJECT Fdo; - NTSTATUS Status; KEVENT Event; + IO_STATUS_BLOCK IoStatusBlock; + PIO_STACK_LOCATION IrpSp; PIRP Irp; - - if (!PopAcpiPresent) return STATUS_NOT_IMPLEMENTED; - - Status = IopGetSystemPowerDeviceObject(&DeviceObject); - if (!NT_SUCCESS(Status)) - { - DPRINT1("No system power driver available\n"); - return STATUS_UNSUCCESSFUL; - } - - Fdo = IoGetAttachedDeviceReference(DeviceObject); - - if (Fdo == DeviceObject) - { - DPRINT("An FDO was not attached\n"); - return STATUS_UNSUCCESSFUL; - } - + NTSTATUS Status; + KeInitializeEvent(&Event, NotificationEvent, FALSE); - + Irp = IoBuildSynchronousFsdRequest(IRP_MJ_POWER, - Fdo, + DeviceObject, NULL, 0, NULL, &Event, &IoStatusBlock); - + IrpSp = IoGetNextIrpStackLocation(Irp); - IrpSp->MinorFunction = IRP_MN_SET_POWER; + IrpSp->MinorFunction = IRP_MN_QUERY_POWER; IrpSp->Parameters.Power.Type = SystemPowerState; - IrpSp->Parameters.Power.State.SystemState = PowerState; - - DPRINT("Calling ACPI driver"); - Status = PoCallDriver(Fdo, Irp); + IrpSp->Parameters.Power.State.SystemState = SystemState; + IrpSp->Parameters.Power.ShutdownType = PowerAction; + + Status = PoCallDriver(DeviceObject, Irp); if (Status == STATUS_PENDING) { KeWaitForSingleObject(&Event, @@ -118,10 +105,176 @@ PopSetSystemPowerState(SYSTEM_POWER_STATE PowerState) KernelMode, FALSE, NULL); - Status = IoStatusBlock.Status; + Status = IoStatusBlock.Status; } + + return Status; +} - ObDereferenceObject(Fdo); +NTSTATUS +PopSendSetSystemPowerState(PDEVICE_OBJECT DeviceObject, SYSTEM_POWER_STATE SystemState, POWER_ACTION PowerAction) +{ + KEVENT Event; + IO_STATUS_BLOCK IoStatusBlock; + PIO_STACK_LOCATION IrpSp; + PIRP Irp; + NTSTATUS Status; + + KeInitializeEvent(&Event, + NotificationEvent, + FALSE); + + Irp = IoBuildSynchronousFsdRequest(IRP_MJ_POWER, + DeviceObject, + NULL, + 0, + NULL, + &Event, + &IoStatusBlock); + + IrpSp = IoGetNextIrpStackLocation(Irp); + IrpSp->MinorFunction = IRP_MN_SET_POWER; + IrpSp->Parameters.Power.Type = SystemPowerState; + IrpSp->Parameters.Power.State.SystemState = SystemState; + IrpSp->Parameters.Power.ShutdownType = PowerAction; + + Status = PoCallDriver(DeviceObject, Irp); + if (Status == STATUS_PENDING) + { + KeWaitForSingleObject(&Event, + Executive, + KernelMode, + FALSE, + NULL); + Status = IoStatusBlock.Status; + } + + return Status; +} + +NTSTATUS +PopQuerySystemPowerStateTraverse(PDEVICE_NODE DeviceNode, + PVOID Context) +{ + PPOWER_STATE_TRAVERSE_CONTEXT PowerStateContext = Context; + NTSTATUS Status; + + DPRINT("PopQuerySystemPowerStateTraverse(%p, %p)\n", DeviceNode, Context); + + if (DeviceNode == IopRootDeviceNode) + return STATUS_SUCCESS; + + if (DeviceNode->Flags & DNF_LEGACY_DRIVER) + return STATUS_SUCCESS; + + Status = PopSendQuerySystemPowerState(DeviceNode->PhysicalDeviceObject, + PowerStateContext->SystemPowerState, + PowerStateContext->PowerAction); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Device '%wZ' failed IRP_MN_QUERY_POWER\n", &DeviceNode->InstancePath); + } + +#if 0 + return Status; +#else + return STATUS_SUCCESS; +#endif +} + +NTSTATUS +PopSetSystemPowerStateTraverse(PDEVICE_NODE DeviceNode, + PVOID Context) +{ + PPOWER_STATE_TRAVERSE_CONTEXT PowerStateContext = Context; + NTSTATUS Status; + + DPRINT("PopSetSystemPowerStateTraverse(%p, %p)\n", DeviceNode, Context); + + if (DeviceNode == IopRootDeviceNode) + return STATUS_SUCCESS; + + if (DeviceNode->PhysicalDeviceObject == PowerStateContext->PowerDevice) + return STATUS_SUCCESS; + + if (DeviceNode->Flags & DNF_LEGACY_DRIVER) + return STATUS_SUCCESS; + + Status = PopSendSetSystemPowerState(DeviceNode->PhysicalDeviceObject, + PowerStateContext->SystemPowerState, + PowerStateContext->PowerAction); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Device '%wZ' failed IRP_MN_SET_POWER\n", &DeviceNode->InstancePath); + } + +#if 0 + return Status; +#else + return STATUS_SUCCESS; +#endif +} + +NTSTATUS +NTAPI +PopSetSystemPowerState(SYSTEM_POWER_STATE PowerState, POWER_ACTION PowerAction) +{ + PDEVICE_OBJECT DeviceObject; + PDEVICE_OBJECT Fdo; + NTSTATUS Status; + DEVICETREE_TRAVERSE_CONTEXT Context; + POWER_STATE_TRAVERSE_CONTEXT PowerContext; + + Status = IopGetSystemPowerDeviceObject(&DeviceObject); + if (!NT_SUCCESS(Status)) + { + DPRINT1("No system power driver available\n"); + Fdo = NULL; + } + else + { + Fdo = IoGetAttachedDeviceReference(DeviceObject); + if (Fdo == DeviceObject) + { + DPRINT("An FDO was not attached\n"); + return STATUS_UNSUCCESSFUL; + } + } + + /* Set up context */ + PowerContext.PowerAction = PowerAction; + PowerContext.SystemPowerState = PowerState; + PowerContext.PowerDevice = Fdo; + + /* Query for system power change */ + IopInitDeviceTreeTraverseContext(&Context, + IopRootDeviceNode, + PopQuerySystemPowerStateTraverse, + &PowerContext); + + Status = IopTraverseDeviceTree(&Context); + if (!NT_SUCCESS(Status)) + { + DPRINT1("Query system power state failed; changing state anyway\n"); + } + + /* Set system power change */ + IopInitDeviceTreeTraverseContext(&Context, + IopRootDeviceNode, + PopSetSystemPowerStateTraverse, + &PowerContext); + + IopTraverseDeviceTree(&Context); + + if (!PopAcpiPresent) return STATUS_NOT_IMPLEMENTED; + + if (Fdo != NULL) + { + if (PowerAction != PowerActionShutdownReset) + PopSendSetSystemPowerState(Fdo, PowerState, PowerAction); + + ObDereferenceObject(Fdo); + } return Status; } @@ -421,7 +574,7 @@ PoRequestPowerIrp(IN PDEVICE_OBJECT DeviceObject, *pIrp = Irp; IoSetCompletionRoutine(Irp, PopRequestPowerIrpCompletion, RequestPowerItem, TRUE, TRUE, TRUE); - IoCallDriver(TopDeviceObject, Irp); + PoCallDriver(TopDeviceObject, Irp); /* Always return STATUS_PENDING. The completion routine * will call CompletionFunction and complete the Irp. diff --git a/ntoskrnl/se/acl.c b/ntoskrnl/se/acl.c index 35e4a7520e9..2c4532d270c 100644 --- a/ntoskrnl/se/acl.c +++ b/ntoskrnl/se/acl.c @@ -311,7 +311,7 @@ SepCaptureAcl(IN PACL InputAcl, _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { /* Free the ACL and return the exception code */ - ExFreePool(NewAcl); + ExFreePoolWithTag(NewAcl, TAG_ACL); _SEH2_YIELD(return _SEH2_GetExceptionCode()); } _SEH2_END; @@ -361,7 +361,7 @@ SepReleaseAcl(IN PACL CapturedAcl, (AccessMode != KernelMode || (AccessMode == KernelMode && CaptureIfKernel))) { - ExFreePool(CapturedAcl); + ExFreePoolWithTag(CapturedAcl, TAG_ACL); } } diff --git a/ntoskrnl/se/sd.c b/ntoskrnl/se/sd.c index 0e0eadcea36..d58a6eab7ee 100644 --- a/ntoskrnl/se/sd.c +++ b/ntoskrnl/se/sd.c @@ -686,7 +686,7 @@ Offset += ROUND_UP(Type##Size, sizeof(ULONG)); \ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { /* We failed to copy the data to the new descriptor */ - ExFreePool(NewDescriptor); + ExFreePoolWithTag(NewDescriptor, TAG_SD); _SEH2_YIELD(return _SEH2_GetExceptionCode()); } _SEH2_END; @@ -1248,7 +1248,7 @@ SeDeassignSecurity(PSECURITY_DESCRIPTOR *SecurityDescriptor) if (*SecurityDescriptor != NULL) { - ExFreePool(*SecurityDescriptor); + ExFreePoolWithTag(*SecurityDescriptor, TAG_SD); *SecurityDescriptor = NULL; } diff --git a/ntoskrnl/se/sid.c b/ntoskrnl/se/sid.c index 93b8bde6d16..aefa07cd6e9 100644 --- a/ntoskrnl/se/sid.c +++ b/ntoskrnl/se/sid.c @@ -60,34 +60,34 @@ VOID NTAPI FreeInitializedSids(VOID) { - if (SeNullSid) ExFreePool(SeNullSid); - if (SeWorldSid) ExFreePool(SeWorldSid); - if (SeLocalSid) ExFreePool(SeLocalSid); - if (SeCreatorOwnerSid) ExFreePool(SeCreatorOwnerSid); - if (SeCreatorGroupSid) ExFreePool(SeCreatorGroupSid); - if (SeCreatorOwnerServerSid) ExFreePool(SeCreatorOwnerServerSid); - if (SeCreatorGroupServerSid) ExFreePool(SeCreatorGroupServerSid); - if (SeNtAuthoritySid) ExFreePool(SeNtAuthoritySid); - if (SeDialupSid) ExFreePool(SeDialupSid); - if (SeNetworkSid) ExFreePool(SeNetworkSid); - if (SeBatchSid) ExFreePool(SeBatchSid); - if (SeInteractiveSid) ExFreePool(SeInteractiveSid); - if (SeServiceSid) ExFreePool(SeServiceSid); - if (SePrincipalSelfSid) ExFreePool(SePrincipalSelfSid); - if (SeLocalSystemSid) ExFreePool(SeLocalSystemSid); - if (SeAuthenticatedUserSid) ExFreePool(SeAuthenticatedUserSid); - if (SeRestrictedCodeSid) ExFreePool(SeRestrictedCodeSid); - if (SeAliasAdminsSid) ExFreePool(SeAliasAdminsSid); - if (SeAliasUsersSid) ExFreePool(SeAliasUsersSid); - if (SeAliasGuestsSid) ExFreePool(SeAliasGuestsSid); - if (SeAliasPowerUsersSid) ExFreePool(SeAliasPowerUsersSid); - if (SeAliasAccountOpsSid) ExFreePool(SeAliasAccountOpsSid); - if (SeAliasSystemOpsSid) ExFreePool(SeAliasSystemOpsSid); - if (SeAliasPrintOpsSid) ExFreePool(SeAliasPrintOpsSid); - if (SeAliasBackupOpsSid) ExFreePool(SeAliasBackupOpsSid); - if (SeAuthenticatedUsersSid) ExFreePool(SeAuthenticatedUsersSid); - if (SeRestrictedSid) ExFreePool(SeRestrictedSid); - if (SeAnonymousLogonSid) ExFreePool(SeAnonymousLogonSid); + if (SeNullSid) ExFreePoolWithTag(SeNullSid, TAG_SID); + if (SeWorldSid) ExFreePoolWithTag(SeWorldSid, TAG_SID); + if (SeLocalSid) ExFreePoolWithTag(SeLocalSid, TAG_SID); + if (SeCreatorOwnerSid) ExFreePoolWithTag(SeCreatorOwnerSid, TAG_SID); + if (SeCreatorGroupSid) ExFreePoolWithTag(SeCreatorGroupSid, TAG_SID); + if (SeCreatorOwnerServerSid) ExFreePoolWithTag(SeCreatorOwnerServerSid, TAG_SID); + if (SeCreatorGroupServerSid) ExFreePoolWithTag(SeCreatorGroupServerSid, TAG_SID); + if (SeNtAuthoritySid) ExFreePoolWithTag(SeNtAuthoritySid, TAG_SID); + if (SeDialupSid) ExFreePoolWithTag(SeDialupSid, TAG_SID); + if (SeNetworkSid) ExFreePoolWithTag(SeNetworkSid, TAG_SID); + if (SeBatchSid) ExFreePoolWithTag(SeBatchSid, TAG_SID); + if (SeInteractiveSid) ExFreePoolWithTag(SeInteractiveSid, TAG_SID); + if (SeServiceSid) ExFreePoolWithTag(SeServiceSid, TAG_SID); + if (SePrincipalSelfSid) ExFreePoolWithTag(SePrincipalSelfSid, TAG_SID); + if (SeLocalSystemSid) ExFreePoolWithTag(SeLocalSystemSid, TAG_SID); + if (SeAuthenticatedUserSid) ExFreePoolWithTag(SeAuthenticatedUserSid, TAG_SID); + if (SeRestrictedCodeSid) ExFreePoolWithTag(SeRestrictedCodeSid, TAG_SID); + if (SeAliasAdminsSid) ExFreePoolWithTag(SeAliasAdminsSid, TAG_SID); + if (SeAliasUsersSid) ExFreePoolWithTag(SeAliasUsersSid, TAG_SID); + if (SeAliasGuestsSid) ExFreePoolWithTag(SeAliasGuestsSid, TAG_SID); + if (SeAliasPowerUsersSid) ExFreePoolWithTag(SeAliasPowerUsersSid, TAG_SID); + if (SeAliasAccountOpsSid) ExFreePoolWithTag(SeAliasAccountOpsSid, TAG_SID); + if (SeAliasSystemOpsSid) ExFreePoolWithTag(SeAliasSystemOpsSid, TAG_SID); + if (SeAliasPrintOpsSid) ExFreePoolWithTag(SeAliasPrintOpsSid, TAG_SID); + if (SeAliasBackupOpsSid) ExFreePoolWithTag(SeAliasBackupOpsSid, TAG_SID); + if (SeAuthenticatedUsersSid) ExFreePoolWithTag(SeAuthenticatedUsersSid, TAG_SID); + if (SeRestrictedSid) ExFreePoolWithTag(SeRestrictedSid, TAG_SID); + if (SeAnonymousLogonSid) ExFreePoolWithTag(SeAnonymousLogonSid, TAG_SID); } BOOLEAN @@ -306,7 +306,7 @@ SepCaptureSid(IN PSID InputSid, _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { /* Free the SID and return the exception code */ - ExFreePool(NewSid); + ExFreePoolWithTag(NewSid, TAG_SID); _SEH2_YIELD(return _SEH2_GetExceptionCode()); } _SEH2_END; @@ -357,7 +357,7 @@ SepReleaseSid(IN PSID CapturedSid, (AccessMode != KernelMode || (AccessMode == KernelMode && CaptureIfKernel))) { - ExFreePool(CapturedSid); + ExFreePoolWithTag(CapturedSid, TAG_SID); } } diff --git a/ntoskrnl/se/token.c b/ntoskrnl/se/token.c index d13bc1a0f4f..d70e27710b6 100644 --- a/ntoskrnl/se/token.c +++ b/ntoskrnl/se/token.c @@ -293,7 +293,7 @@ SepDuplicateToken(PTOKEN Token, AccessToken->UserAndGroups = (PSID_AND_ATTRIBUTES)ExAllocatePoolWithTag(PagedPool, uLength, - 'uKOT'); + TAG_TOKEN_USERS); EndMem = &AccessToken->UserAndGroups[AccessToken->UserAndGroupCount]; @@ -320,7 +320,7 @@ SepDuplicateToken(PTOKEN Token, AccessToken->Privileges = (PLUID_AND_ATTRIBUTES)ExAllocatePoolWithTag(PagedPool, uLength, - 'pKOT'); + TAG_TOKEN_PRIVILAGES); for (i = 0; i < AccessToken->PrivilegeCount; i++) { @@ -335,7 +335,7 @@ SepDuplicateToken(PTOKEN Token, AccessToken->DefaultDacl = (PACL) ExAllocatePoolWithTag(PagedPool, Token->DefaultDacl->AclSize, - 'kDOT'); + TAG_TOKEN_ACL); memcpy(AccessToken->DefaultDacl, Token->DefaultDacl, Token->DefaultDacl->AclSize); @@ -460,13 +460,13 @@ SepDeleteToken(PVOID ObjectBody) PTOKEN AccessToken = (PTOKEN)ObjectBody; if (AccessToken->UserAndGroups) - ExFreePool(AccessToken->UserAndGroups); + ExFreePoolWithTag(AccessToken->UserAndGroups, TAG_TOKEN_USERS); if (AccessToken->Privileges) - ExFreePool(AccessToken->Privileges); + ExFreePoolWithTag(AccessToken->Privileges, TAG_TOKEN_PRIVILAGES); if (AccessToken->DefaultDacl) - ExFreePool(AccessToken->DefaultDacl); + ExFreePoolWithTag(AccessToken->DefaultDacl, TAG_TOKEN_ACL); } @@ -639,7 +639,7 @@ SepCreateToken(OUT PHANDLE TokenHandle, AccessToken->UserAndGroups = (PSID_AND_ATTRIBUTES)ExAllocatePoolWithTag(PagedPool, uLength, - 'uKOT'); + TAG_TOKEN_USERS); EndMem = &AccessToken->UserAndGroups[AccessToken->UserAndGroupCount]; @@ -675,7 +675,7 @@ SepCreateToken(OUT PHANDLE TokenHandle, AccessToken->Privileges = (PLUID_AND_ATTRIBUTES)ExAllocatePoolWithTag(PagedPool, uLength, - 'pKOT'); + TAG_TOKEN_PRIVILAGES); if (PreviousMode != KernelMode) { @@ -704,7 +704,7 @@ SepCreateToken(OUT PHANDLE TokenHandle, AccessToken->DefaultDacl = (PACL) ExAllocatePoolWithTag(PagedPool, DefaultDacl->AclSize, - 'kDOT'); + TAG_TOKEN_ACL); memcpy(AccessToken->DefaultDacl, DefaultDacl, DefaultDacl->AclSize); @@ -1720,7 +1720,7 @@ NtSetInformationToken(IN HANDLE TokenHandle, /* Free the previous dacl if present */ if(Token->DefaultDacl != NULL) { - ExFreePool(Token->DefaultDacl); + ExFreePoolWithTag(Token->DefaultDacl, TAG_TOKEN_ACL); } /* Set the new dacl */ @@ -1732,7 +1732,7 @@ NtSetInformationToken(IN HANDLE TokenHandle, /* Clear and free the default dacl if present */ if (Token->DefaultDacl != NULL) { - ExFreePool(Token->DefaultDacl); + ExFreePoolWithTag(Token->DefaultDacl, TAG_TOKEN_ACL); Token->DefaultDacl = NULL; } } @@ -2478,7 +2478,7 @@ NtOpenThreadTokenEx(IN HANDLE ThreadHandle, PreviousMode, &hToken); } - if (Dacl) ExFreePool(Dacl); + if (Dacl) ExFreePoolWithTag(Dacl, TAG_TOKEN_ACL); if (OpenAsSelf) { diff --git a/ros_cd.cmake b/ros_cd.cmake deleted file mode 100644 index 6b5382161aa..00000000000 --- a/ros_cd.cmake +++ /dev/null @@ -1,159 +0,0 @@ -#reactos.dff -add_custom_command( - OUTPUT ${REACTOS_BINARY_DIR}/boot/reactos.dff - COMMAND ${CMAKE_COMMAND} -E copy ${REACTOS_SOURCE_DIR}/boot/bootdata/packages/reactos.dff.in ${REACTOS_BINARY_DIR}/boot/reactos.dff - DEPENDS ${REACTOS_SOURCE_DIR}/boot/bootdata/packages/reactos.dff.in) - -file(STRINGS ${REACTOS_BINARY_DIR}/boot/ros_cab_target.txt CAB_TARGET_ENTRIES) -foreach(ENTRY ${CAB_TARGET_ENTRIES}) - string(REGEX REPLACE "^(.*)\t.*" "\\1" _targetname ${ENTRY}) - string(REGEX REPLACE "^.*\t(.)" "\\1" _dir_num ${ENTRY}) - get_target_property(_FILENAME ${_targetname} LOCATION) - if(NOT CMAKE_HOST_SYSTEM_NAME MATCHES Windows) - set(_FILENAME '\"${_FILENAME}\"') - endif() - add_custom_command( - OUTPUT ${REACTOS_BINARY_DIR}/boot/reactos.dff - COMMAND ${CMAKE_COMMAND} -E echo ${_FILENAME} ${_dir_num} >> ${REACTOS_BINARY_DIR}/boot/reactos.dff - DEPENDS ${_targetname} - APPEND) -endforeach() - -file(STRINGS ${REACTOS_BINARY_DIR}/boot/ros_cab.txt CAB_TARGET_ENTRIES) -foreach(ENTRY ${CAB_TARGET_ENTRIES}) - string(REGEX REPLACE "^(.*)\t.*" "\\1" _FILENAME ${ENTRY}) - string(REGEX REPLACE "^.*\t(.)" "\\1" _dir_num ${ENTRY}) - if(NOT CMAKE_HOST_SYSTEM_NAME MATCHES Windows) - set(QUOTED_FILENAME '\"${_FILENAME}\"') - else() - set(QUOTED_FILENAME ${_FILENAME}) - endif() - add_custom_command( - OUTPUT ${REACTOS_BINARY_DIR}/boot/reactos.dff - COMMAND ${CMAKE_COMMAND} -E echo ${QUOTED_FILENAME} ${_dir_num} >> ${REACTOS_BINARY_DIR}/boot/reactos.dff - DEPENDS ${_FILENAME} - APPEND) -endforeach() - -#reactos.cab -add_custom_command( - OUTPUT ${REACTOS_BINARY_DIR}/boot/reactos.inf - COMMAND native-cabman -C ${REACTOS_BINARY_DIR}/boot/reactos.dff -L ${REACTOS_BINARY_DIR}/boot -I -P ${REACTOS_SOURCE_DIR} - DEPENDS ${REACTOS_BINARY_DIR}/boot/reactos.dff) -add_custom_command( - OUTPUT ${REACTOS_BINARY_DIR}/boot/reactos.cab - COMMAND native-cabman -C ${REACTOS_BINARY_DIR}/boot/reactos.dff -RC ${REACTOS_BINARY_DIR}/boot/reactos.inf -L ${REACTOS_BINARY_DIR}/boot -N -P ${REACTOS_SOURCE_DIR} - DEPENDS ${REACTOS_BINARY_DIR}/boot/reactos.inf) - -#bootcd target -macro(create_bootcd_dir BOOTCD_DIR _target) - - file(MAKE_DIRECTORY - "${BOOTCD_DIR}" - "${BOOTCD_DIR}/loader" - "${BOOTCD_DIR}/reactos" - "${BOOTCD_DIR}/reactos/system32") - - file(STRINGS ${REACTOS_BINARY_DIR}/boot/ros_minicd_target.txt MINICD_TARGET_ENTRIES) - foreach(ENTRY ${MINICD_TARGET_ENTRIES}) - string(REGEX REPLACE "^(.*)\t.*\t.*" "\\1" _targetname ${ENTRY}) - string(REGEX REPLACE "^.*\t(.*)\t.*" "\\1" _DIR ${ENTRY}) - string(REGEX REPLACE "^.*\t.*\t(.*)" "\\1"_NAMEONCD ${ENTRY}) - get_target_property(_FILENAME ${_targetname} LOCATION) - set(filename ${BOOTCD_DIR}/${_DIR}/${_NAMEONCD}) - list(APPEND ${_target}_FILES ${filename}) - add_custom_command( - OUTPUT ${filename} - COMMAND ${CMAKE_COMMAND} -E copy ${_FILENAME} ${filename} - DEPENDS ${_targetname}) - endforeach() - - file(STRINGS ${REACTOS_BINARY_DIR}/boot/ros_minicd.txt MINICD_ENTRIES) - foreach(ENTRY ${MINICD_ENTRIES}) - string(REGEX REPLACE "^(.*)\t.*\t.*" "\\1" _FILENAME ${ENTRY}) - string(REGEX REPLACE "^.*\t(.*)\t.*" "\\1" _DIR ${ENTRY}) - string(REGEX REPLACE "^.*\t.*\t(.*)" "\\1"_NAMEONCD ${ENTRY}) - set(filename ${BOOTCD_DIR}/${_DIR}/${_NAMEONCD}) - list(APPEND ${_target}_FILES ${filename}) - add_custom_command( - OUTPUT ${filename} - COMMAND ${CMAKE_COMMAND} -E copy ${_FILENAME} ${filename} - DEPENDS ${_FILENAME}) - endforeach() - - add_custom_command( - OUTPUT ${BOOTCD_DIR}/reactos/reactos.inf ${BOOTCD_DIR}/reactos/reactos.cab - COMMAND ${CMAKE_COMMAND} -E copy ${REACTOS_BINARY_DIR}/boot/reactos.inf ${BOOTCD_DIR}/reactos/reactos.inf - COMMAND ${CMAKE_COMMAND} -E copy ${REACTOS_BINARY_DIR}/boot/reactos.cab ${BOOTCD_DIR}/reactos/reactos.cab - DEPENDS ${REACTOS_BINARY_DIR}/boot/reactos.cab) - list(APPEND ${_target}_FILES ${filename} ${BOOTCD_DIR}/reactos/reactos.inf ${BOOTCD_DIR}/reactos/reactos.cab) -endmacro() - -create_bootcd_dir(${REACTOS_BINARY_DIR}/boot/bootcd bootcd) -add_custom_target(bootcd - COMMAND native-cdmake -v -j -m -b ${CMAKE_CURRENT_BINARY_DIR}/boot/freeldr/bootsect/isoboot.bin ${BOOTCD_DIR} REACTOS ${REACTOS_BINARY_DIR}/bootcd.iso - DEPENDS ${bootcd_FILES}) -add_dependencies(bootcd dosmbr ext2 fat32 fat isoboot isobtrt vgafonts) -set_directory_properties(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${REACTOS_BINARY_DIR}/bootcd.iso) - -#bootcdregtest target -create_bootcd_dir(${REACTOS_BINARY_DIR}/boot/bootcdregtest bootcdregtest) -add_custom_command( - OUTPUT ${REACTOS_BINARY_DIR}/boot/bootcdregtest/reactos/unattend.inf - COMMAND ${CMAKE_COMMAND} -E copy ${REACTOS_SOURCE_DIR}/boot/bootdata/bootcdregtest/unattend.inf ${REACTOS_BINARY_DIR}/boot/bootcdregtest/reactos/unattend.inf - DEPENDS ${REACTOS_SOURCE_DIR}/boot/bootdata/bootcdregtest/unattend.inf ${REACTOS_BINARY_DIR}/boot/bootcdregtest) -add_custom_target(bootcdregtest - COMMAND native-cdmake -v -j -m -b ${CMAKE_CURRENT_BINARY_DIR}/boot/freeldr/bootsect/isoboot.bin ${REACTOS_BINARY_DIR}/boot/bootcdregtest REACTOS ${REACTOS_BINARY_DIR}/bootcdregtest.iso - DEPENDS ${REACTOS_BINARY_DIR}/boot/bootcdregtest/reactos/unattend.inf ${bootcdregtest_FILES}) -add_dependencies(bootcdregtest dosmbr ext2 fat32 fat isoboot isobtrt vgafonts) - - -#livecd target -file(MAKE_DIRECTORY - "${LIVECD_DIR}" - "${LIVECD_DIR}/loader" - "${LIVECD_DIR}/Profiles" - "${LIVECD_DIR}/Profiles/All Users" - "${LIVECD_DIR}/Profiles/All Users/Desktop" - "${LIVECD_DIR}/Profiles/Default User" - "${LIVECD_DIR}/Profiles/Default User/Desktop" - "${LIVECD_DIR}/Profiles/Default User/My Documents" - "${LIVECD_DIR}/reactos" - "${LIVECD_DIR}/reactos/inf" - "${LIVECD_DIR}/reactos/fonts" - "${LIVECD_DIR}/reactos/system32" - "${LIVECD_DIR}/reactos/system32/config") - -file(STRINGS ${REACTOS_BINARY_DIR}/boot/ros_livecd_target.txt LIVECD_TARGET_ENTRIES) -foreach(ENTRY ${LIVECD_TARGET_ENTRIES}) - string(REGEX REPLACE "^(.*)\t.*\t.*" "\\1" _targetname ${ENTRY}) - string(REGEX REPLACE "^.*\t(.*)\t.*" "\\1" _DIR ${ENTRY}) - string(REGEX REPLACE "^.*\t.*\t(.*)" "\\1"_NAMEONCD ${ENTRY}) - get_target_property(_FILENAME ${_targetname} LOCATION) - set(filename ${LIVECD_DIR}/${_DIR}/${_NAMEONCD}) - list(APPEND LIVECD_FILES ${filename}) - add_custom_command( - OUTPUT ${filename} - COMMAND ${CMAKE_COMMAND} -E copy ${_FILENAME} ${LIVECD_DIR}/${_DIR}/${_NAMEONCD} - DEPENDS ${_targetname}) -endforeach() -file(STRINGS ${REACTOS_BINARY_DIR}/boot/ros_livecd.txt LIVECD_ENTRIES) - -foreach(ENTRY ${LIVECD_ENTRIES}) - string(REGEX REPLACE "^(.*)\t.*\t.*" "\\1" _FILENAME ${ENTRY}) - string(REGEX REPLACE "^.*\t(.*)\t.*" "\\1" _DIR ${ENTRY}) - string(REGEX REPLACE "^.*\t.*\t(.*)" "\\1"_NAMEONCD ${ENTRY}) - set(filename ${LIVECD_DIR}/${_DIR}/${_NAMEONCD}) - list(APPEND LIVECD_FILES ${filename}) - add_custom_command( - OUTPUT ${filename} - COMMAND ${CMAKE_COMMAND} -E copy ${_FILENAME} ${LIVECD_DIR}/${_DIR}/${_NAMEONCD} - DEPENDS ${_FILENAME}) -endforeach() - -add_custom_target(livecd - COMMAND native-cdmake -v -j -m -b ${CMAKE_CURRENT_BINARY_DIR}/boot/freeldr/bootsect/isoboot.bin ${LIVECD_DIR} REACTOS ${REACTOS_BINARY_DIR}/livecd.iso - DEPENDS ${LIVECD_FILES}) -add_dependencies(livecd isoboot livecd_hives vgafonts) - -set_directory_properties(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${REACTOS_BINARY_DIR}/livecd.iso) diff --git a/subsystems/ntvdm/lang/bg-BG.rc b/subsystems/ntvdm/lang/bg-BG.rc index 7573738976f..663207c7362 100644 --- a/subsystems/ntvdm/lang/bg-BG.rc +++ b/subsystems/ntvdm/lang/bg-BG.rc @@ -1,4 +1,3 @@ -#include "resource.h" /* * Moved all hardcoded strings to En.rc. * By Magnus Olsen 2005 diff --git a/subsystems/ntvdm/lang/cs-CZ.rc b/subsystems/ntvdm/lang/cs-CZ.rc index c92be54c218..8db30d071f8 100644 --- a/subsystems/ntvdm/lang/cs-CZ.rc +++ b/subsystems/ntvdm/lang/cs-CZ.rc @@ -1,4 +1,3 @@ -#include "resource.h" /* FILE: subsystems/ntvdm/lang/cs-CZ.rc * TRANSLATOR: Radek Liska aka Black_Fox (radekliska at gmail dot com) * UPDATED: 2008-06-24 diff --git a/subsystems/ntvdm/lang/de-DE.rc b/subsystems/ntvdm/lang/de-DE.rc index 57c22a41caa..423a74f7fd1 100644 --- a/subsystems/ntvdm/lang/de-DE.rc +++ b/subsystems/ntvdm/lang/de-DE.rc @@ -1,4 +1,3 @@ -#include "resource.h" /* * Translate into German. * By Rouven Wessling 2005 pentiumforever@gmail.com diff --git a/subsystems/ntvdm/lang/en-US.rc b/subsystems/ntvdm/lang/en-US.rc index 1fb2b9c5b1e..9f8624727b3 100644 --- a/subsystems/ntvdm/lang/en-US.rc +++ b/subsystems/ntvdm/lang/en-US.rc @@ -1,4 +1,3 @@ -#include "resource.h" /* * Moved all hardcoded strings to En.rc. * By Magnus Olsen 2005 diff --git a/subsystems/ntvdm/lang/es-ES.rc b/subsystems/ntvdm/lang/es-ES.rc index 1d41703bd23..0741393bafa 100644 --- a/subsystems/ntvdm/lang/es-ES.rc +++ b/subsystems/ntvdm/lang/es-ES.rc @@ -1,4 +1,3 @@ -#include "resource.h" /* * Spanish Resource File * Reactos(c)2006 Samuel Serapion diff --git a/subsystems/ntvdm/lang/fr-FR.rc b/subsystems/ntvdm/lang/fr-FR.rc index 7d2ea41e283..37b86936720 100644 --- a/subsystems/ntvdm/lang/fr-FR.rc +++ b/subsystems/ntvdm/lang/fr-FR.rc @@ -1,4 +1,3 @@ -#include "resource.h" /* * Moved all hardcoded strings to En.rc. * By Magnus Olsen 2005 diff --git a/subsystems/ntvdm/lang/hu-HU.rc b/subsystems/ntvdm/lang/hu-HU.rc index 9880e4fd4e9..8ca986fb82f 100644 --- a/subsystems/ntvdm/lang/hu-HU.rc +++ b/subsystems/ntvdm/lang/hu-HU.rc @@ -1,4 +1,3 @@ -#include "resource.h" /* * Hungarian resource file for ntvdm * Moved all hardcoded strings to En.rc. diff --git a/subsystems/ntvdm/lang/id-ID.rc b/subsystems/ntvdm/lang/id-ID.rc index 6f03553b439..6e6508cc551 100644 --- a/subsystems/ntvdm/lang/id-ID.rc +++ b/subsystems/ntvdm/lang/id-ID.rc @@ -1,4 +1,3 @@ -#include "resource.h" LANGUAGE LANG_INDONESIAN, SUBLANG_DEFAULT STRINGTABLE DISCARDABLE diff --git a/subsystems/ntvdm/lang/it-IT.rc b/subsystems/ntvdm/lang/it-IT.rc index efd064599de..27482474a6a 100644 --- a/subsystems/ntvdm/lang/it-IT.rc +++ b/subsystems/ntvdm/lang/it-IT.rc @@ -1,4 +1,3 @@ -#include "resource.h" /* * PROJECT: ReactOS Virtual DOS Machine * LICENSE: GPL - See COPYING in the top level directory diff --git a/subsystems/ntvdm/lang/ja-JP.rc b/subsystems/ntvdm/lang/ja-JP.rc index 1807eac418a..aaacec4699f 100644 --- a/subsystems/ntvdm/lang/ja-JP.rc +++ b/subsystems/ntvdm/lang/ja-JP.rc @@ -1,4 +1,3 @@ -#include "resource.h" /* * Moved all hardcoded strings to En.rc. * By Magnus Olsen 2005 diff --git a/subsystems/ntvdm/lang/no-NO.rc b/subsystems/ntvdm/lang/no-NO.rc index bce76b56da8..fded50c397b 100644 --- a/subsystems/ntvdm/lang/no-NO.rc +++ b/subsystems/ntvdm/lang/no-NO.rc @@ -1,4 +1,3 @@ -#include "resource.h" /* * Moved all hardcoded strings to En.rc. * By Magnus Olsen 2005 diff --git a/subsystems/ntvdm/lang/pl-PL.rc b/subsystems/ntvdm/lang/pl-PL.rc index 046b4d5dbcc..30c3186d441 100644 --- a/subsystems/ntvdm/lang/pl-PL.rc +++ b/subsystems/ntvdm/lang/pl-PL.rc @@ -1,14 +1,14 @@ -#include "resource.h" /* -* translated by xrogers (http://rogers.cyberdusk.pl/) -* xxrogers@users.sourceforge.net -* https://sourceforge.net/projects/reactospl -*/ - + * translated by xrogers + * xxrogers@users.sourceforge.net + * https://sourceforge.net/projects/reactospl + * UTF-8 conversion by Caemyr (May, 2011) + */ + LANGUAGE LANG_POLISH, SUBLANG_DEFAULT STRINGTABLE DISCARDABLE BEGIN STRING_WelcomeMsg, "Wirtualna maszyna DOS dla ReactOS.\n" -STRING_PromptMsg, "Wcinij r aby uruchomi, s aby wyczy lub q, aby zakoczy." +STRING_PromptMsg, "Wciśnij r aby uruchomić, s aby wyłączyć lub q, aby zakończyć." END diff --git a/subsystems/ntvdm/lang/pt-BR.rc b/subsystems/ntvdm/lang/pt-BR.rc index b72c34b77ce..0c256c72971 100644 --- a/subsystems/ntvdm/lang/pt-BR.rc +++ b/subsystems/ntvdm/lang/pt-BR.rc @@ -1,4 +1,3 @@ -#include "resource.h" /* * Moved all hardcoded strings to En.rc. * By Magnus Olsen 2005 diff --git a/subsystems/ntvdm/lang/ru-RU.rc b/subsystems/ntvdm/lang/ru-RU.rc index b185e68ffe4..c446b86ccce 100644 --- a/subsystems/ntvdm/lang/ru-RU.rc +++ b/subsystems/ntvdm/lang/ru-RU.rc @@ -1,4 +1,3 @@ -#include "resource.h" /* * Moved all hardcoded strings to En.rc. * By Magnus Olsen 2005 @@ -8,6 +7,6 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT STRINGTABLE DISCARDABLE BEGIN -STRING_WelcomeMsg, " DOS ReactOS.\n" -STRING_PromptMsg, " r , s q ." +STRING_WelcomeMsg, "Виртуальная машина поддержки DOS для ReactOS.\n" +STRING_PromptMsg, "Введите r для запуска, s для выключения или q выхода." END diff --git a/subsystems/ntvdm/lang/sk-SK.rc b/subsystems/ntvdm/lang/sk-SK.rc index 7910ca982f4..f510a578036 100644 --- a/subsystems/ntvdm/lang/sk-SK.rc +++ b/subsystems/ntvdm/lang/sk-SK.rc @@ -1,5 +1,3 @@ -#include "resource.h" - /* TRANSLATOR: Mrio Kamr /Mario Kacmar/ aka Kario (kario@szm.sk) * DATE OF TR: 12-02-2008 */ diff --git a/subsystems/ntvdm/lang/th-TH.rc b/subsystems/ntvdm/lang/th-TH.rc index c2aa41cb14a..1eea0bce494 100644 --- a/subsystems/ntvdm/lang/th-TH.rc +++ b/subsystems/ntvdm/lang/th-TH.rc @@ -1,4 +1,3 @@ -#include "resource.h" LANGUAGE LANG_THAI, SUBLANG_DEFAULT STRINGTABLE DISCARDABLE diff --git a/subsystems/ntvdm/lang/uk-UA.rc b/subsystems/ntvdm/lang/uk-UA.rc index 6cb86f82f80..be237589f7c 100644 --- a/subsystems/ntvdm/lang/uk-UA.rc +++ b/subsystems/ntvdm/lang/uk-UA.rc @@ -6,13 +6,11 @@ * TRANSLATOR: Artem Reznikov */ -#include "resource.h" - LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT STRINGTABLE DISCARDABLE BEGIN -STRING_WelcomeMsg, "ϳ DOS ReactOS.\n" -STRING_PromptMsg, " r , s q, ." +STRING_WelcomeMsg, "Підтримка віртуальної машини DOS у ReactOS.\n" +STRING_PromptMsg, "Введіть r для запуску, s для закриття або q, щоб вийти зараз." END diff --git a/subsystems/ntvdm/lang/zh-CN.rc b/subsystems/ntvdm/lang/zh-CN.rc index ccf65275424..82b27de2611 100644 --- a/subsystems/ntvdm/lang/zh-CN.rc +++ b/subsystems/ntvdm/lang/zh-CN.rc @@ -1,4 +1,3 @@ -#include "resource.h" LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED STRINGTABLE DISCARDABLE diff --git a/subsystems/ntvdm/lang/zh-TW.rc b/subsystems/ntvdm/lang/zh-TW.rc index a1b185a6f73..fc1ad4b0b78 100644 --- a/subsystems/ntvdm/lang/zh-TW.rc +++ b/subsystems/ntvdm/lang/zh-TW.rc @@ -1,4 +1,3 @@ -#include "resource.h" LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL STRINGTABLE DISCARDABLE diff --git a/subsystems/ntvdm/ntvdm.c b/subsystems/ntvdm/ntvdm.c index 5a9a29a8e58..47cebc4e49a 100644 --- a/subsystems/ntvdm/ntvdm.c +++ b/subsystems/ntvdm/ntvdm.c @@ -13,12 +13,8 @@ #define WIN32_NO_STATUS #include #include -#include #include "resource.h" -#define NTOS_MODE_USER -#include - #define NDEBUG #include diff --git a/subsystems/ntvdm/rsrc.rc b/subsystems/ntvdm/rsrc.rc index 5c3792d2c80..20dd735e539 100644 --- a/subsystems/ntvdm/rsrc.rc +++ b/subsystems/ntvdm/rsrc.rc @@ -14,10 +14,13 @@ #include "lang/ja-JP.rc" #include "lang/no-NO.rc" #include "lang/th-TH.rc" -#include "lang/uk-UA.rc" -#include "lang/pl-PL.rc" #include "lang/pt-BR.rc" -#include "lang/ru-RU.rc" #include "lang/sk-SK.rc" #include "lang/zh-CN.rc" #include "lang/zh-TW.rc" + +// UTF-8 +#pragma code_page(65001) +#include "lang/pl-PL.rc" +#include "lang/ru-RU.rc" +#include "lang/uk-UA.rc" diff --git a/subsystems/win32/csrss/csrsrv/CMakeLists.txt b/subsystems/win32/csrss/csrsrv/CMakeLists.txt index 34944902ed3..6d96ca4c6b5 100644 --- a/subsystems/win32/csrss/csrsrv/CMakeLists.txt +++ b/subsystems/win32/csrss/csrsrv/CMakeLists.txt @@ -13,20 +13,15 @@ list(APPEND SOURCE init.c ${CMAKE_CURRENT_BINARY_DIR}/csrsrv.def) -add_library(csrsrv SHARED ${CMAKE_CURRENT_BINARY_DIR}/csrsrv_srv.h.gch ${SOURCE}) +add_library(csrsrv SHARED ${SOURCE}) target_link_libraries(csrsrv ${PSEH_LIB}) set_module_type(csrsrv nativedll) -if(MSVC) -set_entrypoint(csrsrv DllMainCRTStartup) -endif() - - add_importlibs(csrsrv ntdll smdll) -add_pch(csrsrv ${CMAKE_CURRENT_SOURCE_DIR}/srv.h ${SOURCE}) +add_pch(csrsrv srv.h) add_dependencies(csrsrv psdk bugcodes) add_cd_file(TARGET csrsrv DESTINATION reactos/system32 FOR all) diff --git a/subsystems/win32/csrss/csrsrv/api/process.c b/subsystems/win32/csrss/csrsrv/api/process.c index 58fb959611b..c1e7fdb1921 100644 --- a/subsystems/win32/csrss/csrsrv/api/process.c +++ b/subsystems/win32/csrss/csrsrv/api/process.c @@ -1,5 +1,5 @@ /* - * reactos/subsys/csrss/api/process.c + * subsystems/win32/csrss/csrsrv/api/process.c * * "\windows\ApiPort" port process management functions * @@ -105,6 +105,7 @@ PCSRSS_PROCESS_DATA WINAPI CsrCreateProcessData(HANDLE ProcessId) PROCESS_ALL_ACCESS, &ObjectAttributes, &ClientId); + DPRINT1("CSR Process: %p Handle: %p\n", pProcessData, pProcessData->Process); if (!NT_SUCCESS(Status)) { ProcessData[hash] = pProcessData->next; diff --git a/subsystems/win32/csrss/csrsrv/api/user.c b/subsystems/win32/csrss/csrsrv/api/user.c index de4e49f66e1..952dc24b710 100644 --- a/subsystems/win32/csrss/csrsrv/api/user.c +++ b/subsystems/win32/csrss/csrsrv/api/user.c @@ -1,6 +1,6 @@ /* $Id$ * - * reactos/subsys/csrss/api/user.c + * subsystems/win32/csrss/csrsrv/api/user.c * * User functions * diff --git a/subsystems/win32/csrss/csrsrv/api/wapi.c b/subsystems/win32/csrss/csrsrv/api/wapi.c index 88005c6fe7b..678cbde92ca 100644 --- a/subsystems/win32/csrss/csrsrv/api/wapi.c +++ b/subsystems/win32/csrss/csrsrv/api/wapi.c @@ -1,6 +1,6 @@ /* $Id$ * - * reactos/subsys/csrss/api/wapi.c + * subsystems/win32/csrss/csrsrv/api/wapi.c * * CSRSS port message processing * @@ -12,8 +12,6 @@ #include -#define NDEBUG - #define NDEBUG #include @@ -118,6 +116,353 @@ CsrHandleHardError(IN PCSRSS_PROCESS_DATA ProcessData, (VOID)CallHardError(ProcessData, Message); } +PVOID CsrSrvSharedSectionHeap; +PVOID CsrSrvSharedSectionBase; +PVOID *CsrSrvSharedStaticServerData; +ULONG CsrSrvSharedSectionSize; +HANDLE CsrSrvSharedSection; + +/*++ + * @name CsrSrvCreateSharedSection + * + * The CsrSrvCreateSharedSection creates the Shared Section that all CSR Server + * DLLs and Clients can use to share data. + * + * @param ParameterValue + * Specially formatted string from our registry command-line which + * specifies various arguments for the shared section. + * + * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL + * othwerwise. + * + * @remarks None. + * + *--*/ +NTSTATUS +NTAPI +CsrSrvCreateSharedSection(IN PCHAR ParameterValue) +{ + PCHAR SizeValue = ParameterValue; + ULONG Size; + NTSTATUS Status; + LARGE_INTEGER SectionSize; + ULONG ViewSize = 0; + SYSTEM_BASIC_INFORMATION CsrNtSysInfo; + PPEB Peb = NtCurrentPeb(); + + /* ReactOS Hackssss */ + Status = NtQuerySystemInformation(SystemBasicInformation, + &CsrNtSysInfo, + sizeof(SYSTEM_BASIC_INFORMATION), + NULL); + ASSERT(NT_SUCCESS(Status)); + + /* Find the first comma, and null terminate */ + while (*SizeValue) + { + if (*SizeValue == ',') + { + *SizeValue++ = '\0'; + break; + } + else + { + SizeValue++; + } + } + + /* Make sure it's valid */ + if (!*SizeValue) return STATUS_INVALID_PARAMETER; + + /* Convert it to an integer */ + Status = RtlCharToInteger(SizeValue, 0, &Size); + if (!NT_SUCCESS(Status)) return Status; + + /* Multiply by 1024 entries and round to page size */ + CsrSrvSharedSectionSize = ROUND_UP(Size * 1024, CsrNtSysInfo.PageSize); + DPRINT1("Size: %lx\n", CsrSrvSharedSectionSize); + + /* Create the Secion */ + SectionSize.LowPart = CsrSrvSharedSectionSize; + SectionSize.HighPart = 0; + Status = NtCreateSection(&CsrSrvSharedSection, + SECTION_ALL_ACCESS, + NULL, + &SectionSize, + PAGE_EXECUTE_READWRITE, + SEC_BASED | SEC_RESERVE, + NULL); + if (!NT_SUCCESS(Status)) return Status; + + /* Map the section */ + Status = NtMapViewOfSection(CsrSrvSharedSection, + NtCurrentProcess(), + &CsrSrvSharedSectionBase, + 0, + 0, + NULL, + &ViewSize, + ViewUnmap, + MEM_TOP_DOWN, + PAGE_EXECUTE_READWRITE); + if(!NT_SUCCESS(Status)) + { + /* Fail */ + NtClose(CsrSrvSharedSection); + return(Status); + } + + /* FIXME: Write the value to registry */ + + /* The Heap is the same place as the Base */ + CsrSrvSharedSectionHeap = CsrSrvSharedSectionBase; + + /* Create the heap */ + if (!(RtlCreateHeap(HEAP_ZERO_MEMORY, + CsrSrvSharedSectionHeap, + CsrSrvSharedSectionSize, + PAGE_SIZE, + 0, + 0))) + { + /* Failure, unmap section and return */ + NtUnmapViewOfSection(NtCurrentProcess(), + CsrSrvSharedSectionBase); + NtClose(CsrSrvSharedSection); + return STATUS_NO_MEMORY; + } + + /* Now allocate space from the heap for the Shared Data */ + CsrSrvSharedStaticServerData = RtlAllocateHeap(CsrSrvSharedSectionHeap, + 0, + 4 * // HAX CSR_SERVER_DLL_MAX * + sizeof(PVOID)); + + /* Write the values to the PEB */ + Peb->ReadOnlySharedMemoryBase = CsrSrvSharedSectionBase; + Peb->ReadOnlySharedMemoryHeap = CsrSrvSharedSectionHeap; + Peb->ReadOnlyStaticServerData = CsrSrvSharedStaticServerData; + + /* Return */ + return STATUS_SUCCESS; +} + +/*++ + * @name CsrSrvAttachSharedSection + * + * The CsrSrvAttachSharedSection maps the CSR Shared Section into a new + * CSR Process' address space, and returns the pointers to the section + * through the Connection Info structure. + * + * @param CsrProcess + * Pointer to the CSR Process that is attempting a connection. + * + * @param ConnectInfo + * Pointer to the CSR Connection Info structure for the incoming + * connection. + * + * @return STATUS_SUCCESS in case of success, STATUS_UNSUCCESSFUL + * othwerwise. + * + * @remarks None. + * + *--*/ +NTSTATUS +NTAPI +CsrSrvAttachSharedSection(IN PCSRSS_PROCESS_DATA CsrProcess OPTIONAL, + OUT PCSR_CONNECTION_INFO ConnectInfo) +{ + NTSTATUS Status; + ULONG ViewSize = 0; + + /* Check if we have a process */ + if (CsrProcess) + { + /* Map the sectio into this process */ + DPRINT1("CSR Process Handle: %p. CSR Process: %p\n", CsrProcess->Process, CsrProcess); + Status = NtMapViewOfSection(CsrSrvSharedSection, + CsrProcess->Process, + &CsrSrvSharedSectionBase, + 0, + 0, + NULL, + &ViewSize, + ViewUnmap, + SEC_NO_CHANGE, + PAGE_EXECUTE_READ); + if (Status == STATUS_CONFLICTING_ADDRESSES) + { + /* I Think our csrss tries to connect to itself... */ + DPRINT1("Multiple mapping hack\n"); + Status = STATUS_SUCCESS; + } + if (!NT_SUCCESS(Status)) return Status; + } + + /* Write the values in the Connection Info structure */ + ConnectInfo->SharedSectionBase = CsrSrvSharedSectionBase; + ConnectInfo->SharedSectionHeap = CsrSrvSharedSectionHeap; + ConnectInfo->SharedSectionData = CsrSrvSharedStaticServerData; + + /* Return success */ + return STATUS_SUCCESS; +} + +PBASE_STATIC_SERVER_DATA BaseStaticServerData; + +VOID +WINAPI +BasepFakeStaticServerData(VOID) +{ + NTSTATUS Status; + WCHAR Buffer[MAX_PATH]; + PWCHAR HeapBuffer; + UNICODE_STRING SystemRootString; + UNICODE_STRING UnexpandedSystemRootString = RTL_CONSTANT_STRING(L"%SystemRoot%"); + UNICODE_STRING BaseSrvCSDString; + UNICODE_STRING BaseSrvWindowsDirectory; + UNICODE_STRING BaseSrvWindowsSystemDirectory; + UNICODE_STRING BnoString; + RTL_QUERY_REGISTRY_TABLE BaseServerRegistryConfigurationTable[2] = + { + { + NULL, + RTL_QUERY_REGISTRY_DIRECT, + L"CSDVersion", + &BaseSrvCSDString + }, + {0} + }; + + /* Get the Windows directory */ + RtlInitEmptyUnicodeString(&SystemRootString, Buffer, sizeof(Buffer)); + Status = RtlExpandEnvironmentStrings_U(NULL, + &UnexpandedSystemRootString, + &SystemRootString, + NULL); + DPRINT1("Status: %lx. Root: %wZ\n", Status, &SystemRootString); + ASSERT(NT_SUCCESS(Status)); + + /* Create the base directory */ + Buffer[SystemRootString.Length / sizeof(WCHAR)] = UNICODE_NULL; + Status = RtlCreateUnicodeString(&BaseSrvWindowsDirectory, + SystemRootString.Buffer); + ASSERT(NT_SUCCESS(Status)); + + /* Create the system directory */ + wcscat(SystemRootString.Buffer, L"\\system32"); + Status = RtlCreateUnicodeString(&BaseSrvWindowsSystemDirectory, + SystemRootString.Buffer); + ASSERT(NT_SUCCESS(Status)); + + /* FIXME: Check Session ID */ + wcscpy(Buffer, L"\\BaseNamedObjects"); + RtlInitUnicodeString(&BnoString, Buffer); + + /* Allocate the server data */ + BaseStaticServerData = RtlAllocateHeap(CsrSrvSharedSectionHeap, + HEAP_ZERO_MEMORY, + sizeof(BASE_STATIC_SERVER_DATA)); + ASSERT(BaseStaticServerData != NULL); + + /* Process timezone information */ + BaseStaticServerData->TermsrvClientTimeZoneId = TIME_ZONE_ID_INVALID; + BaseStaticServerData->TermsrvClientTimeZoneChangeNum = 0; + Status = NtQuerySystemInformation(SystemTimeOfDayInformation, + &BaseStaticServerData->TimeOfDay, + sizeof(BaseStaticServerData->TimeOfDay), + NULL); + ASSERT(NT_SUCCESS(Status)); + + /* Make a shared heap copy of the Windows directory */ + BaseStaticServerData->WindowsDirectory = BaseSrvWindowsDirectory; + HeapBuffer = RtlAllocateHeap(CsrSrvSharedSectionHeap, + 0, + BaseSrvWindowsDirectory.MaximumLength); + ASSERT(HeapBuffer); + RtlCopyMemory(HeapBuffer, + BaseStaticServerData->WindowsDirectory.Buffer, + BaseSrvWindowsDirectory.MaximumLength); + BaseStaticServerData->WindowsDirectory.Buffer = HeapBuffer; + + /* Make a shared heap copy of the System directory */ + BaseStaticServerData->WindowsSystemDirectory = BaseSrvWindowsSystemDirectory; + HeapBuffer = RtlAllocateHeap(CsrSrvSharedSectionHeap, + 0, + BaseSrvWindowsSystemDirectory.MaximumLength); + ASSERT(HeapBuffer); + RtlCopyMemory(HeapBuffer, + BaseStaticServerData->WindowsSystemDirectory.Buffer, + BaseSrvWindowsSystemDirectory.MaximumLength); + BaseStaticServerData->WindowsSystemDirectory.Buffer = HeapBuffer; + + /* This string is not used */ + RtlInitEmptyUnicodeString(&BaseStaticServerData->WindowsSys32x86Directory, + NULL, + 0); + + /* Make a shared heap copy of the BNO directory */ + BaseStaticServerData->NamedObjectDirectory = BnoString; + BaseStaticServerData->NamedObjectDirectory.MaximumLength = BnoString.Length + + sizeof(UNICODE_NULL); + HeapBuffer = RtlAllocateHeap(CsrSrvSharedSectionHeap, + 0, + BaseStaticServerData->NamedObjectDirectory.MaximumLength); + ASSERT(HeapBuffer); + RtlCopyMemory(HeapBuffer, + BaseStaticServerData->NamedObjectDirectory.Buffer, + BaseStaticServerData->NamedObjectDirectory.MaximumLength); + BaseStaticServerData->NamedObjectDirectory.Buffer = HeapBuffer; + + /* + * Confirmed that in Windows, CSDNumber and RCNumber are actually Length + * and MaximumLength of the CSD String, since the same UNICODE_STRING is + * being queried twice, the first time as a ULONG! + * + * Somehow, in Windows this doesn't cause a buffer overflow, but it might + * in ReactOS, so this code is disabled until someone figures out WTF. + */ + BaseStaticServerData->CSDNumber = 0; + BaseStaticServerData->RCNumber = 0; + + /* Initialize the CSD string and query its value from the registry */ + RtlInitEmptyUnicodeString(&BaseSrvCSDString, Buffer, sizeof(Buffer)); + Status = RtlQueryRegistryValues(RTL_REGISTRY_WINDOWS_NT, + L"", + BaseServerRegistryConfigurationTable, + NULL, + NULL); + if (NT_SUCCESS(Status)) + { + /* Copy into the shared buffer */ + wcsncpy(BaseStaticServerData->CSDVersion, + BaseSrvCSDString.Buffer, + BaseSrvCSDString.Length / sizeof(WCHAR)); + } + else + { + /* NULL-terminate to indicate nothing is there */ + BaseStaticServerData->CSDVersion[0] = UNICODE_NULL; + } + + /* Cache the system information */ + Status = NtQuerySystemInformation(SystemBasicInformation, + &BaseStaticServerData->SysInfo, + sizeof(BaseStaticServerData->SysInfo), + NULL); + ASSERT(NT_SUCCESS(Status)); + + /* FIXME: Should query the registry for these */ + BaseStaticServerData->DefaultSeparateVDM = FALSE; + BaseStaticServerData->IsWowTaskReady = FALSE; + BaseStaticServerData->LUIDDeviceMapsEnabled = FALSE; + + /* FIXME: Symlinks */ + + /* Finally, set the pointer */ + CsrSrvSharedStaticServerData[CSR_CONSOLE] = BaseStaticServerData; +} + NTSTATUS WINAPI CsrpHandleConnectionRequest (PPORT_MESSAGE Request, IN HANDLE hApiListenPort) @@ -127,23 +472,19 @@ CsrpHandleConnectionRequest (PPORT_MESSAGE Request, PCSRSS_PROCESS_DATA ProcessData = NULL; REMOTE_PORT_VIEW LpcRead; CLIENT_ID ClientId; + BOOLEAN AllowConnection = FALSE; + PCSR_CONNECTION_INFO ConnectInfo; LpcRead.Length = sizeof(LpcRead); ServerPort = NULL; DPRINT("CSR: %s: Handling: %p\n", __FUNCTION__, Request); - Status = NtAcceptConnectPort(&ServerPort, - NULL, - Request, - TRUE, - 0, - & LpcRead); - if (!NT_SUCCESS(Status)) - { - DPRINT1("CSR: NtAcceptConnectPort() failed\n"); - return Status; - } - + ConnectInfo = (PCSR_CONNECTION_INFO)(Request + 1); + + /* Save the process ID */ + RtlZeroMemory(ConnectInfo, sizeof(CSR_CONNECTION_INFO)); + ConnectInfo->ProcessId = NtCurrentTeb()->ClientId.UniqueProcess; + ProcessData = CsrGetProcessData(Request->ClientId.UniqueProcess); if (ProcessData == NULL) { @@ -152,16 +493,59 @@ CsrpHandleConnectionRequest (PPORT_MESSAGE Request, { DPRINT1("Unable to allocate or find data for process 0x%x\n", Request->ClientId.UniqueProcess); - Status = STATUS_UNSUCCESSFUL; - return Status; } } + + if (ProcessData->Process == NULL) + { + OBJECT_ATTRIBUTES ObjectAttributes; + + InitializeObjectAttributes(&ObjectAttributes, + NULL, + 0, + NULL, + NULL); + DPRINT1("WARNING: CSR PROCESS WITH NO CSR PROCESS HANDLE???\n"); + ClientId.UniqueThread = 0; + Status = NtOpenProcess(&ProcessData->Process, + PROCESS_ALL_ACCESS, + &ObjectAttributes, + &Request->ClientId); + DPRINT1("Status: %lx. Handle: %lx\n", Status, ProcessData->Process); + } + + if (ProcessData) + { + /* Attach the Shared Section */ + Status = CsrSrvAttachSharedSection(ProcessData, ConnectInfo); + if (NT_SUCCESS(Status)) + { + DPRINT1("Connection ok\n"); + AllowConnection = TRUE; + } + else + { + DPRINT1("Shared section map failed: %lx\n", Status); + } + } + + Status = NtAcceptConnectPort(&ServerPort, + NULL, + Request, + AllowConnection, + 0, + & LpcRead); + if (!NT_SUCCESS(Status)) + { + DPRINT1("CSR: NtAcceptConnectPort() failed\n"); + return Status; + } ProcessData->CsrSectionViewBase = LpcRead.ViewBase; ProcessData->CsrSectionViewSize = LpcRead.ViewSize; ProcessData->ServerCommunicationPort = ServerPort; - Status = NtCompleteConnectPort(ServerPort); + if (AllowConnection) Status = NtCompleteConnectPort(ServerPort); if (!NT_SUCCESS(Status)) { DPRINT1("CSR: NtCompleteConnectPort() failed\n"); diff --git a/subsystems/win32/csrss/csrsrv/csrsrv.rbuild b/subsystems/win32/csrss/csrsrv/csrsrv.rbuild index c7b9b53acff..987ed18944d 100644 --- a/subsystems/win32/csrss/csrsrv/csrsrv.rbuild +++ b/subsystems/win32/csrss/csrsrv/csrsrv.rbuild @@ -1,6 +1,6 @@ - + . . diff --git a/subsystems/win32/csrss/csrsrv/init.c b/subsystems/win32/csrss/csrsrv/init.c index fa8d6273765..e0b1a99c094 100644 --- a/subsystems/win32/csrss/csrsrv/init.c +++ b/subsystems/win32/csrss/csrsrv/init.c @@ -1,7 +1,7 @@ /* * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS CSR Sub System - * FILE: subsys/csr/csrsrv/init.c + * FILE: subsystems/win32/csrss/csrsrv/init.c * PURPOSE: CSR Server DLL Initialization * PROGRAMMERS: ReactOS Portable Systems Group */ @@ -482,12 +482,23 @@ CsrpCreateBNODirectory (int argc, char ** argv, char ** envp) return Status; } + +VOID +WINAPI +BasepFakeStaticServerData(VOID); + +NTSTATUS +NTAPI +CsrSrvCreateSharedSection(IN PCHAR ParameterValue); + /********************************************************************** * CsrpCreateHeap/3 */ static NTSTATUS CsrpCreateHeap (int argc, char ** argv, char ** envp) { + CHAR Value[] = "1024,3072,512"; + NTSTATUS Status; DPRINT("CSR: %s called\n", __FUNCTION__); CsrssApiHeap = RtlCreateHeap(HEAP_GROWABLE, @@ -500,6 +511,16 @@ CsrpCreateHeap (int argc, char ** argv, char ** envp) { return STATUS_UNSUCCESSFUL; } + + + Status = CsrSrvCreateSharedSection(Value); + if (Status != STATUS_SUCCESS) + { + DPRINT1("CsrSrvCreateSharedSection failed with status 0x%08lx\n", Status); + ASSERT(FALSE); + } + + BasepFakeStaticServerData(); return STATUS_SUCCESS; } @@ -778,9 +799,9 @@ CsrServerInitialization(ULONG ArgumentCount, BOOL NTAPI -DllMainCRTStartup(HANDLE hDll, - DWORD dwReason, - LPVOID lpReserved) +DllMain(HANDLE hDll, + DWORD dwReason, + LPVOID lpReserved) { /* We don't do much */ UNREFERENCED_PARAMETER(hDll); diff --git a/subsystems/win32/csrss/csrsrv/procsup.c b/subsystems/win32/csrss/csrsrv/procsup.c index d139d9701d6..c62bf6a3f8d 100644 --- a/subsystems/win32/csrss/csrsrv/procsup.c +++ b/subsystems/win32/csrss/csrsrv/procsup.c @@ -1,7 +1,7 @@ /* * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS CSR Sub System - * FILE: subsys/csr/csrsrv/procsup.c + * FILE: subsystems/win32/csrss/csrsrv/procsup.c * PURPOSE: CSR Process Management * PROGRAMMERS: ReactOS Portable Systems Group * Alex Ionescu @@ -26,7 +26,6 @@ extern RTL_CRITICAL_SECTION ProcessDataLock; extern PCSRSS_PROCESS_DATA ProcessData[256]; PCSRSS_PROCESS_DATA CsrRootProcess; -LIST_ENTRY CsrThreadHashTable[256]; SECURITY_QUALITY_OF_SERVICE CsrSecurityQos = { sizeof(SECURITY_QUALITY_OF_SERVICE), diff --git a/subsystems/win32/csrss/csrsrv/srv.h b/subsystems/win32/csrss/csrsrv/srv.h index b784e6ed575..204d4ea9324 100644 --- a/subsystems/win32/csrss/csrsrv/srv.h +++ b/subsystems/win32/csrss/csrsrv/srv.h @@ -4,7 +4,16 @@ #define WIN32_NO_STATUS #include #include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include /* CSR Header */ //#include @@ -18,3 +27,7 @@ /* Internal CSRSS Headers */ #include #include + +/* Defines */ +#define ROUND_UP(n, align) ROUND_DOWN(((ULONG)n) + (align) - 1, (align)) +#define ROUND_DOWN(n, align) (((ULONG)n) & ~((align) - 1l)) diff --git a/subsystems/win32/csrss/csrsrv/thredsup.c b/subsystems/win32/csrss/csrsrv/thredsup.c index e893888773b..27e5b093c0f 100644 --- a/subsystems/win32/csrss/csrsrv/thredsup.c +++ b/subsystems/win32/csrss/csrsrv/thredsup.c @@ -1,7 +1,7 @@ /* * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS CSR Sub System - * FILE: subsys/csr/csrsrv/procsup.c + * FILE: subsystems/win32/csrss/csrsrv/thredsup.c * PURPOSE: CSR Process Management * PROGRAMMERS: ReactOS Portable Systems Group * Alex Ionescu diff --git a/subsystems/win32/csrss/csrss.c b/subsystems/win32/csrss/csrss.c index c5f574584fb..280cee466d3 100644 --- a/subsystems/win32/csrss/csrss.c +++ b/subsystems/win32/csrss/csrss.c @@ -11,7 +11,6 @@ #define WIN32_NO_STATUS #include -#include #include #define NDEBUG #include diff --git a/subsystems/win32/csrss/include/api.h b/subsystems/win32/csrss/include/api.h index 7e956b66698..fab8af89151 100644 --- a/subsystems/win32/csrss/include/api.h +++ b/subsystems/win32/csrss/include/api.h @@ -9,7 +9,8 @@ #pragma once #define NTOS_MODE_USER -#include +#include +#include #include diff --git a/subsystems/win32/csrss/win32csr/CMakeLists.txt b/subsystems/win32/csrss/win32csr/CMakeLists.txt index 20f278a69e3..8b694222473 100644 --- a/subsystems/win32/csrss/win32csr/CMakeLists.txt +++ b/subsystems/win32/csrss/win32csr/CMakeLists.txt @@ -1,4 +1,3 @@ -add_definitions(-D_DLL -D__USE_CRTIMP) include_directories( BEFORE . @@ -19,7 +18,7 @@ list(APPEND SOURCE desktopbg.c dllmain.c exitros.c - file.c + file.c guiconsole.c handle.c harderror.c @@ -28,7 +27,7 @@ list(APPEND SOURCE win32csr.rc ${CMAKE_CURRENT_BINARY_DIR}/win32csr.def) -add_library(win32csr SHARED ${CMAKE_CURRENT_BINARY_DIR}/win32csr_w32csr.h.gch ${SOURCE}) +add_library(win32csr SHARED ${SOURCE}) target_link_libraries(win32csr win32ksys @@ -38,7 +37,7 @@ set_module_type(win32csr win32dll) add_importlibs(win32csr user32 gdi32 advapi32 psapi msvcrt kernel32 ntdll) -add_pch(win32csr ${CMAKE_CURRENT_SOURCE_DIR}/w32csr.h ${SOURCE}) +add_pch(win32csr w32csr.h) add_dependencies(win32csr bugcodes) add_cd_file(TARGET win32csr DESTINATION reactos/system32 FOR all) diff --git a/subsystems/win32/csrss/win32csr/console.c b/subsystems/win32/csrss/win32csr/console.c index 99a622bb3b7..f74cd28168c 100644 --- a/subsystems/win32/csrss/win32csr/console.c +++ b/subsystems/win32/csrss/win32csr/console.c @@ -286,7 +286,7 @@ CSR_API(CsrAllocConsole) FALSE, 0)) { - DPRINT1("DuplicateHandle() failed: %d\n", GetLastError); + DPRINT1("DuplicateHandle() failed: %lu\n", GetLastError()); ConioDeleteConsole((Object_t *) Console); if (NewConsole || !ProcessData->bInheritHandles) { diff --git a/subsystems/win32/csrss/win32csr/harderror.c b/subsystems/win32/csrss/win32csr/harderror.c index ee195f7aab2..11666d644fb 100644 --- a/subsystems/win32/csrss/win32csr/harderror.c +++ b/subsystems/win32/csrss/win32csr/harderror.c @@ -106,6 +106,25 @@ CsrpGetClientFileName( return STATUS_SUCCESS; } +static +VOID +CsrpFreeStringParameters( + IN OUT PULONG_PTR Parameters, + IN PHARDERROR_MSG HardErrorMessage) +{ + ULONG nParam; + + /* Loop all parameters */ + for (nParam = 0; nParam < HardErrorMessage->NumberOfParameters; nParam++) + { + /* Check if the current parameter is a string */ + if (HardErrorMessage->UnicodeStringParameterMask & (1 << nParam) && Parameters[nParam]) + { + /* Free the string buffer */ + RtlFreeHeap(RtlGetProcessHeap(), 0, (PVOID)Parameters[nParam]); + } + } +} static NTSTATUS @@ -115,62 +134,82 @@ CsrpCaptureStringParameters( IN PHARDERROR_MSG HardErrorMessage, HANDLE hProcess) { - ULONG nParam, UnicodeStringParameterMask, Size = 0; - NTSTATUS Status; - UNICODE_STRING TempStringU; - CHAR *ParamString; - - UnicodeStringParameterMask = HardErrorMessage->UnicodeStringParameterMask; + ULONG nParam, Size = 0; + NTSTATUS Status = STATUS_SUCCESS; + UNICODE_STRING TempStringU, ParamStringU; + ANSI_STRING TempStringA; /* Read all strings from client space */ - for (nParam = 0; - nParam < HardErrorMessage->NumberOfParameters; - nParam++, UnicodeStringParameterMask >>= 1) + for (nParam = 0; nParam < HardErrorMessage->NumberOfParameters; nParam++) { Parameters[nParam] = 0; /* Check if the current parameter is a unicode string */ - if (UnicodeStringParameterMask & 0x01) + if (HardErrorMessage->UnicodeStringParameterMask & (1 << nParam)) { /* Read the UNICODE_STRING from the process memory */ Status = NtReadVirtualMemory(hProcess, (PVOID)HardErrorMessage->Parameters[nParam], - &TempStringU, - sizeof(TempStringU), + &ParamStringU, + sizeof(ParamStringU), NULL); - if (!NT_SUCCESS(Status)) return Status; + if (!NT_SUCCESS(Status)) + break; /* Allocate a buffer for the string */ - ParamString = RtlAllocateHeap(RtlGetProcessHeap(), - HEAP_ZERO_MEMORY, - TempStringU.Length + sizeof(WCHAR)); + TempStringU.MaximumLength = ParamStringU.Length; + TempStringU.Length = ParamStringU.Length; + TempStringU.Buffer = RtlAllocateHeap(RtlGetProcessHeap(), + HEAP_ZERO_MEMORY, + TempStringU.MaximumLength); - if (!ParamString) + if (!TempStringU.Buffer) { - DPRINT1("Cannot allocate memory %d\n", TempStringU.Length); - return STATUS_NO_MEMORY; + DPRINT1("Cannot allocate memory %u\n", TempStringU.MaximumLength); + Status = STATUS_NO_MEMORY; } /* Read the string buffer from the process memory */ Status = NtReadVirtualMemory(hProcess, + ParamStringU.Buffer, TempStringU.Buffer, - ParamString, - TempStringU.Length, + ParamStringU.Length, NULL); if (!NT_SUCCESS(Status)) { DPRINT1("NtReadVirtualMemory failed with code: %lx\n", Status); - RtlFreeHeap(RtlGetProcessHeap(), 0, ParamString); - return Status; + RtlFreeHeap(RtlGetProcessHeap(), 0, TempStringU.Buffer); + break; } - /* Zero terminate the string */ - ParamString[TempStringU.Length] = 0; - ParamString[TempStringU.Length + 1] = 0; - DPRINT("ParamString=\'%S\'\n", ParamString); + DPRINT("ParamString=\'%wZ\'\n", &TempStringU); - Parameters[nParam] = (ULONG_PTR)ParamString; + /* Allocate a buffer for converted to ANSI string */ + TempStringA.MaximumLength = RtlUnicodeStringToAnsiSize(&TempStringU); + TempStringA.Buffer = RtlAllocateHeap(RtlGetProcessHeap(), + HEAP_ZERO_MEMORY, + TempStringA.MaximumLength); + + if (!TempStringA.Buffer) + { + DPRINT1("Cannot allocate memory %u\n", TempStringA.MaximumLength); + RtlFreeHeap(RtlGetProcessHeap(), 0, TempStringU.Buffer); + Status = STATUS_NO_MEMORY; + break; + } + + /* Convert string to ANSI and free temporary buffer */ + Status = RtlUnicodeStringToAnsiString(&TempStringA, &TempStringU, FALSE); + RtlFreeHeap(RtlGetProcessHeap(), 0, TempStringU.Buffer); + if (!NT_SUCCESS(Status)) + { + RtlFreeHeap(RtlGetProcessHeap(), 0, TempStringA.Buffer); + break; + } + + /* Note: RtlUnicodeStringToAnsiString returns NULL terminated string */ + Parameters[nParam] = (ULONG_PTR)TempStringA.Buffer; Size += TempStringU.Length; } else @@ -180,34 +219,15 @@ CsrpCaptureStringParameters( } } - *SizeOfAllUnicodeStrings = Size; - return STATUS_SUCCESS; -} - -static -VOID -CsrpFreeStringParameters( - IN OUT PULONG_PTR Parameters, - IN PHARDERROR_MSG HardErrorMessage) -{ - ULONG nParam, UnicodeStringParameterMask; - - UnicodeStringParameterMask = HardErrorMessage->UnicodeStringParameterMask; - - /* Loop all parameters */ - for (nParam = 0; - nParam < HardErrorMessage->NumberOfParameters; - nParam++, UnicodeStringParameterMask >>= 1) + if (!NT_SUCCESS(Status)) { - /* Check if the current parameter is a string */ - if (UnicodeStringParameterMask & 0x01) - { - /* Free the string buffer */ - RtlFreeHeap(RtlGetProcessHeap(), 0, (PVOID)Parameters[nParam]); - } + CsrpFreeStringParameters(Parameters, HardErrorMessage); + return Status; } -} + *SizeOfAllUnicodeStrings = Size; + return Status; +} static NTSTATUS diff --git a/subsystems/win32/csrss/win32csr/lang/cs-CZ.rc b/subsystems/win32/csrss/win32csr/lang/cs-CZ.rc new file mode 100644 index 00000000000..283cdfe48c3 --- /dev/null +++ b/subsystems/win32/csrss/win32csr/lang/cs-CZ.rc @@ -0,0 +1,63 @@ +/* FILE: subsystems/win32/csrss/win32csr/lang/cs-CZ.rc + * TRANSLATOR: Radek Liska aka Black_Fox (radekliska at gmail dot com) + * UPDATED: 2011-04-09 + */ + +LANGUAGE LANG_CZECH, SUBLANG_DEFAULT + +IDD_END_NOW DIALOGEX DISCARDABLE 0, 0, 200, 95 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Ukonit program - " +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Probh ukonen programu... ekejte, prosm",IDC_STATIC,7,7,186,11 + CONTROL "Progress",IDC_PROGRESS,"msctls_progress32",WS_BORDER, + 7,20,186,13 + LTEXT "IPokud zvolte okamit ukonen programu, vechna neuloen data budou ztracena. Kliknutm na Ukonit okamit ukonte program.", + IDC_STATIC,7,40,186,26 + DEFPUSHBUTTON "&Ukonit okamit",IDC_END_NOW,150,71,43,17 +END + +IDD_NOT_RESPONDING DIALOGEX DISCARDABLE 0, 0, 192, 122 +STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Ukonit program - " +FONT 8, "MS Shell Dlg" +BEGIN + DEFPUSHBUTTON "Storno",IDCANCEL,142,98,43,17 + PUSHBUTTON "&Ukonit okamit",IDC_END_NOW,78,98,43,17 + LTEXT "Tento program neodpovd",IDC_STATIC,7,7,178,8 + LTEXT "Kliknutm na Storno se lze vrtit do systmu ReactOS a ovit stav programu", + IDC_STATIC,7,26,178,16 + LTEXT "Pokud zvolte okamit ukonen programu, vechna neuloen data budou ztracena. Kliknutm na Ukonit okamit ukonte program.", + IDC_STATIC,7,53,178,26 +END + +IDD_SWITCH_APP DIALOGEX 90, 90, 265, 170 +STYLE DS_SYSMODAL | DS_SETFONT | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE +EXSTYLE WS_EX_TOPMOST | WS_EX_WINDOWEDGE +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + LTEXT "",IDC_STATIC_CUR_APP,39,139,204,16,SS_SUNKEN,WS_EX_STATICEDGE +END + +STRINGTABLE +BEGIN + IDS_EDIT "Upravit" + IDS_MARK "Oznait" + IDS_COPY "Koprovat\tEnter" + IDS_PASTE "Vloit" + IDS_SELECTALL "Oznait ve" + IDS_SCROLL "Posunout" + IDS_FIND "Najt..." + IDS_DEFAULTS "Vchoz" + IDS_PROPERTIES "Vlastnosti" + IDS_SCROLLHERE "Posunout sem" + IDS_SCROLLTOP "Posunout na zatek" + IDS_SCROLLBOTTOM "Posunout na konec" + IDS_SCROLLPAGE_UP "O strnku ve" + IDS_SCROLLPAGE_DOWN "O strnku ne" + IDS_SCROLLUP "Posunout nahoru" + IDS_SCROLLDOWN "Posunout dol" + + IDS_COMMAND_PROMPT "Pkazov dek" +END diff --git a/subsystems/win32/csrss/win32csr/lang/pl-PL.rc b/subsystems/win32/csrss/win32csr/lang/pl-PL.rc index 3d9d5d2a318..1fdbfbeec8a 100644 --- a/subsystems/win32/csrss/win32csr/lang/pl-PL.rc +++ b/subsystems/win32/csrss/win32csr/lang/pl-PL.rc @@ -1,35 +1,37 @@ /* -* translated by xrogers (http://rogers.cyberdusk.pl/) -* xxrogers@users.sourceforge.net -* https://sourceforge.net/projects/reactospl -* translation update by Olaf Siejka (Caemyr), Apr 2011 -*/ + * translated by xrogers + * xxrogers@users.sourceforge.net + * https://sourceforge.net/projects/reactospl + * translation update by Olaf Siejka (Caemyr), Apr 2011 + * UTF-8 conversion by Caemyr (May, 2011) + */ + LANGUAGE LANG_POLISH, SUBLANG_DEFAULT IDD_END_NOW DIALOGEX DISCARDABLE 0, 0, 200, 95 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Zakocz program - " +CAPTION "Zakończ program - " FONT 8, "MS Shell Dlg" BEGIN - LTEXT "Trwa zamykanie programu... Prosz czeka",IDC_STATIC,7,7,186,11 - CONTROL "Postp",IDC_PROGRESS,"msctls_progress32",WS_BORDER, + LTEXT "Trwa zamykanie programu... Proszę czekać",IDC_STATIC,7,7,186,11 + CONTROL "Postęp",IDC_PROGRESS,"msctls_progress32",WS_BORDER, 7,20,186,13 - LTEXT "Jeli zdecydujesz si zamkn program natychmiastowo, utracisz wszelkie niezapisane dane. Aby zakoczy program, wcinij Zakocz teraz.", + LTEXT "Jeśli zdecydujesz się zamknąć program natychmiastowo, utracisz wszelkie niezapisane dane. Aby zakończyć program, wciśnij Zakończ teraz.", IDC_STATIC,7,40,186,26 - DEFPUSHBUTTON "&Zakocz teraz",IDC_END_NOW,150,71,43,17 + DEFPUSHBUTTON "&Zakończ teraz",IDC_END_NOW,150,71,43,17 END IDD_NOT_RESPONDING DIALOGEX DISCARDABLE 0, 0, 192, 122 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Zakocz program - " +CAPTION "Zakończ program - " FONT 8, "MS Shell Dlg" BEGIN DEFPUSHBUTTON "Anuluj",IDCANCEL,142,98,43,17 - PUSHBUTTON "&Zakocz teraz",IDC_END_NOW,78,98,43,17 + PUSHBUTTON "&Zakończ teraz",IDC_END_NOW,78,98,43,17 LTEXT "Wybrany program nie odpowiada",IDC_STATIC,7,7,178,8 - LTEXT "Aby powrci do ReactOS i sprawdzi status programu, kliknij Anuluj", + LTEXT "Aby powrócić do ReactOS i sprawdzić status programu, kliknij Anuluj", IDC_STATIC,7,26,178,16 - LTEXT "Jeli zdecydujesz si zamkn program natychmiastowo, utracisz wszelkie niezapisane dane. Aby zakoczy program, wcinij Zakocz teraz.", + LTEXT "Jeśli zdecydujesz się zamknąć program natychmiastowo, utracisz wszelkie niezapisane dane. Aby zakończyć program, wciśnij Zakończ teraz.", IDC_STATIC,7,53,178,26 END @@ -45,20 +47,20 @@ STRINGTABLE BEGIN IDS_EDIT "Edytuj" IDS_MARK "Zaznacz" - IDS_COPY "Kopiuj\tWejd" + IDS_COPY "Kopiuj\tWejdź" IDS_PASTE "Wklej" IDS_SELECTALL "Zaznacz wszystko" - IDS_SCROLL "Przewi" - IDS_FIND "Znajd..." - IDS_DEFAULTS "Ustawienia domylne" - IDS_PROPERTIES "Waciwoci" - IDS_SCROLLHERE "Przewi tutaj" - IDS_SCROLLTOP "Przewi na pocztek" - IDS_SCROLLBOTTOM "Przewi na koniec" + IDS_SCROLL "Przewiń" + IDS_FIND "Znajdź..." + IDS_DEFAULTS "Ustawienia domyślne" + IDS_PROPERTIES "Właściwości" + IDS_SCROLLHERE "Przewiń tutaj" + IDS_SCROLLTOP "Przewiń na początek" + IDS_SCROLLBOTTOM "Przewiń na koniec" IDS_SCROLLPAGE_UP "Poprzednia strona" - IDS_SCROLLPAGE_DOWN "Nastpna strona" - IDS_SCROLLUP "Przewi do gry" - IDS_SCROLLDOWN "Przewi na d" + IDS_SCROLLPAGE_DOWN "Następna strona" + IDS_SCROLLUP "Przewiń do góry" + IDS_SCROLLDOWN "Przewiń na dół" IDS_COMMAND_PROMPT "Wiersz polecenia" END diff --git a/subsystems/win32/csrss/win32csr/lang/ru-RU.rc b/subsystems/win32/csrss/win32csr/lang/ru-RU.rc index 207fa1f4bab..a8acd99f5e0 100644 --- a/subsystems/win32/csrss/win32csr/lang/ru-RU.rc +++ b/subsystems/win32/csrss/win32csr/lang/ru-RU.rc @@ -2,28 +2,28 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT IDD_END_NOW DIALOGEX DISCARDABLE 0, 0, 200, 95 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " - " +CAPTION "Завершение программы - " FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ... ",IDC_STATIC,7,7,186,11 + LTEXT "Завершение программы... Пажалуйста подождите",IDC_STATIC,7,7,186,11 CONTROL "Progress",IDC_PROGRESS,"msctls_progress32",WS_BORDER, 7,20,186,13 - LTEXT " , . """"", + LTEXT "Если вы завершите программу сейчас, то вы можете потерять несохраненные данные. Чтобы завешить программу сейчас нажмите ""Завершить""", IDC_STATIC,7,40,186,26 - DEFPUSHBUTTON "&",IDC_END_NOW,150,71,43,17 + DEFPUSHBUTTON "&Завешить",IDC_END_NOW,150,71,43,17 END IDD_NOT_RESPONDING DIALOGEX DISCARDABLE 0, 0, 192, 122 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " - " +CAPTION "Завершение программы - " FONT 8, "MS Shell Dlg" BEGIN - DEFPUSHBUTTON "",IDCANCEL,142,98,43,17 - PUSHBUTTON "&",IDC_END_NOW,78,98,43,17 - LTEXT " ",IDC_STATIC,7,7,178,8 - LTEXT " ReactOS """"", + DEFPUSHBUTTON "Отмена",IDCANCEL,142,98,43,17 + PUSHBUTTON "&Завершить",IDC_END_NOW,78,98,43,17 + LTEXT "Эта программа не отвечает",IDC_STATIC,7,7,178,8 + LTEXT "Для возврата в ReactOS и сохранения данных нажмите ""Отмена""", IDC_STATIC,7,26,178,16 - LTEXT " , . """"", + LTEXT "Если вы завершите программу сейчас, то вы можете потерять несохраненные данные. Чтобы завешить программу сейчас нажмите ""Завершить""", IDC_STATIC,7,53,178,26 END @@ -37,21 +37,21 @@ END STRINGTABLE BEGIN - IDS_EDIT "" - IDS_MARK "" - IDS_COPY "\tEnter" - IDS_PASTE "" - IDS_SELECTALL " " - IDS_SCROLL "" - IDS_FIND "..." - IDS_DEFAULTS "" - IDS_PROPERTIES "" + IDS_EDIT "Изменить" + IDS_MARK "Пометить" + IDS_COPY "Копировать\tEnter" + IDS_PASTE "Вставить" + IDS_SELECTALL "Выделить все" + IDS_SCROLL "Прокрутить" + IDS_FIND "Искать..." + IDS_DEFAULTS "Умолчания" + IDS_PROPERTIES "Свойства" IDS_SCROLLHERE "Scroll Here" IDS_SCROLLTOP "Scroll Top" - IDS_SCROLLBOTTOM " " - IDS_SCROLLPAGE_UP " " - IDS_SCROLLPAGE_DOWN " " - IDS_SCROLLUP " " + IDS_SCROLLBOTTOM "Прокрутить вниз" + IDS_SCROLLPAGE_UP "Вверх страницы" + IDS_SCROLLPAGE_DOWN "Вниз страницы" + IDS_SCROLLUP "Прокрутить вверх" IDS_SCROLLDOWN "Scroll Down" IDS_COMMAND_PROMPT "Command Prompt" diff --git a/subsystems/win32/csrss/win32csr/lang/uk-UA.rc b/subsystems/win32/csrss/win32csr/lang/uk-UA.rc index f419341da73..8b6e67bf543 100644 --- a/subsystems/win32/csrss/win32csr/lang/uk-UA.rc +++ b/subsystems/win32/csrss/win32csr/lang/uk-UA.rc @@ -10,28 +10,28 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT IDD_END_NOW DIALOGEX DISCARDABLE 0, 0, 200, 95 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " - " +CAPTION "Завершення програми - " FONT 8, "MS Shell Dlg" BEGIN - LTEXT " ... ",IDC_STATIC,7,7,186,11 - CONTROL "",IDC_PROGRESS,"msctls_progress32",WS_BORDER, + LTEXT "Завершення програми... Зачекайте",IDC_STATIC,7,7,186,11 + CONTROL "Прогрес",IDC_PROGRESS,"msctls_progress32",WS_BORDER, 7,20,186,13 - LTEXT " , . , ' '", + LTEXT "Якщо завершити програму негайно, то можна втратити всі незбережені дані. Щоб завершити програму зараз, натисніть 'Завершити зараз'", IDC_STATIC,7,40,186,26 - DEFPUSHBUTTON "& ",IDC_END_NOW,150,71,43,17 + DEFPUSHBUTTON "&Завершити зараз",IDC_END_NOW,150,71,43,17 END IDD_NOT_RESPONDING DIALOGEX DISCARDABLE 0, 0, 192, 122 STYLE DS_SHELLFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION " - " +CAPTION "Завершення програми - " FONT 8, "MS Shell Dlg" BEGIN - DEFPUSHBUTTON "",IDCANCEL,142,98,43,17 - PUSHBUTTON "& ",IDC_END_NOW,78,98,43,17 - LTEXT " ",IDC_STATIC,7,7,178,8 - LTEXT " ReactOS , ''", + DEFPUSHBUTTON "Скасувати",IDCANCEL,142,98,43,17 + PUSHBUTTON "&Завершити зараз",IDC_END_NOW,78,98,43,17 + LTEXT "Ця програма не відповідає",IDC_STATIC,7,7,178,8 + LTEXT "Щоб повернутися у ReactOS і перевірити стан програми, натисніть 'Скасувати'", IDC_STATIC,7,26,178,16 - LTEXT " , . , ' '", + LTEXT "Якщо завершити програму негайно, то можна втратити всі незбережені дані. Щоб завершити програму зараз, натисніть 'Завершити зараз'", IDC_STATIC,7,53,178,26 END @@ -45,22 +45,22 @@ END STRINGTABLE BEGIN - IDS_EDIT "" - IDS_MARK "" - IDS_COPY "\tEnter" - IDS_PASTE "" - IDS_SELECTALL " " - IDS_SCROLL "" - IDS_FIND "..." - IDS_DEFAULTS "" - IDS_PROPERTIES "" - IDS_SCROLLHERE " " - IDS_SCROLLTOP " " - IDS_SCROLLBOTTOM " " - IDS_SCROLLPAGE_UP " " - IDS_SCROLLPAGE_DOWN " " - IDS_SCROLLUP " " - IDS_SCROLLDOWN " " + IDS_EDIT "Редагувати" + IDS_MARK "Виділити" + IDS_COPY "Копіювати\tEnter" + IDS_PASTE "Вставити" + IDS_SELECTALL "Виділити все" + IDS_SCROLL "Прокрутити" + IDS_FIND "Знайти..." + IDS_DEFAULTS "Замовчування" + IDS_PROPERTIES "Властивості" + IDS_SCROLLHERE "Прокрутити сюди" + IDS_SCROLLTOP "Прокрутити на початок" + IDS_SCROLLBOTTOM "Прокрутити на кінець" + IDS_SCROLLPAGE_UP "Попередня сотрінка" + IDS_SCROLLPAGE_DOWN "Наступна сторінка" + IDS_SCROLLUP "Прокрутити догори" + IDS_SCROLLDOWN "Прокрутити донизу" - IDS_COMMAND_PROMPT " " + IDS_COMMAND_PROMPT "Командний рядок" END diff --git a/subsystems/win32/csrss/win32csr/rsrc.rc b/subsystems/win32/csrss/win32csr/rsrc.rc index bf2ce4067a4..027eb6cf51a 100644 --- a/subsystems/win32/csrss/win32csr/rsrc.rc +++ b/subsystems/win32/csrss/win32csr/rsrc.rc @@ -6,6 +6,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL 1 ICON DISCARDABLE res/terminal.ico #include "lang/bg-BG.rc" +#include "lang/cs-CZ.rc" #include "lang/de-DE.rc" #include "lang/el-GR.rc" #include "lang/en-US.rc" @@ -15,11 +16,13 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL #include "lang/it-IT.rc" #include "lang/ja-JP.rc" #include "lang/no-NO.rc" -#include "lang/pl-PL.rc" -#include "lang/ru-RU.rc" #include "lang/sk-SK.rc" #include "lang/sv-SE.rc" -#include "lang/uk-UA.rc" #include "lang/zh-CN.rc" #include "lang/zh-TW.rc" +// UTF-8 +#pragma code_page(65001) +#include "lang/pl-PL.rc" +#include "lang/ru-RU.rc" +#include "lang/uk-UA.rc" diff --git a/subsystems/win32/csrss/win32csr/w32csr.h b/subsystems/win32/csrss/win32csr/w32csr.h index 8516cccd034..575ab2a73bc 100644 --- a/subsystems/win32/csrss/win32csr/w32csr.h +++ b/subsystems/win32/csrss/win32csr/w32csr.h @@ -2,35 +2,24 @@ #define WIN32_NO_STATUS #include #define NTOS_MODE_USER -#include +#include +#include +#include -#include #include -/* Our own BLUE.SYS Driver for Console Output */ -#include - /* External Winlogon Header */ #include /* Internal CSRSS Headers */ -#include #include #include #include -#include "file.h" #include "guiconsole.h" #include "tuiconsole.h" -#include /* Public Win32K Headers */ -#include #include -#include - -#include -#include -#include #include "resource.h" diff --git a/subsystems/win32/win32k/CMakeLists.txt b/subsystems/win32/win32k/CMakeLists.txt index da0d3cba119..4dc998c1246 100644 --- a/subsystems/win32/win32k/CMakeLists.txt +++ b/subsystems/win32/win32k/CMakeLists.txt @@ -22,7 +22,8 @@ list(APPEND GENDIB_FILES add_custom_command( OUTPUT ${GENDIB_FILES} - COMMAND native-gendib ${CMAKE_CURRENT_BINARY_DIR}/dib) + COMMAND native-gendib ${CMAKE_CURRENT_BINARY_DIR}/dib + DEPENDS native-gendib) list(APPEND SOURCE dib/alphablend.c @@ -182,7 +183,6 @@ list(APPEND SOURCE endif() add_library(win32k SHARED - ${CMAKE_CURRENT_BINARY_DIR}/win32k_pch.h.gch ${CMAKE_CURRENT_BINARY_DIR}/win32k.def ${SOURCE}) @@ -194,8 +194,9 @@ target_link_libraries(win32k libcntpr) add_importlibs(win32k ntoskrnl hal ftfd) -add_pch(win32k ${CMAKE_CURRENT_SOURCE_DIR}/pch.h ${SOURCE}) +add_pch(win32k pch.h) add_cd_file(TARGET win32k DESTINATION reactos/system32 FOR all) add_importlib_target(win32k.spec) add_library(win32ksys sys-stubs.S) +set_source_files_properties(sys-stubs.S PROPERTIES OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/w32ksvc.h) diff --git a/subsystems/win32/win32k/dib/stretchblt.c b/subsystems/win32/win32k/dib/stretchblt.c index 45a5b8f826b..914d6722a9a 100644 --- a/subsystems/win32/win32k/dib/stretchblt.c +++ b/subsystems/win32/win32k/dib/stretchblt.c @@ -43,11 +43,11 @@ BOOLEAN DIB_XXBPP_StretchBlt(SURFOBJ *DestSurf, SURFOBJ *SourceSurf, SURFOBJ *Ma LONG PatternX = 0, PatternY = 0; - ASSERT(IS_VALID_ROP4(ROP)); - BOOL UsesSource = ROP4_USES_SOURCE(ROP); BOOL UsesPattern = ROP4_USES_PATTERN(ROP); + ASSERT(IS_VALID_ROP4(ROP)); + fnDest_GetPixel = DibFunctionsForBitmapFormat[DestSurf->iBitmapFormat].DIB_GetPixel; fnDest_PutPixel = DibFunctionsForBitmapFormat[DestSurf->iBitmapFormat].DIB_PutPixel; diff --git a/subsystems/win32/win32k/include/cursoricon.h b/subsystems/win32/win32k/include/cursoricon.h index f60023c5805..2b3d703bb97 100644 --- a/subsystems/win32/win32k/include/cursoricon.h +++ b/subsystems/win32/win32k/include/cursoricon.h @@ -71,8 +71,6 @@ PCURICON_OBJECT FASTCALL UserGetCurIconObject(HCURSOR hCurIcon); BOOL UserSetCursorPos( INT x, INT y, DWORD flags, ULONG_PTR dwExtraInfo, BOOL Hook); -int UserShowCursor(BOOL bShow); - PSYSTEM_CURSORINFO IntGetSysCursorInfo(VOID); #define IntReleaseCurIconObject(CurIconObj) \ diff --git a/subsystems/win32/win32k/include/gdidebug.h b/subsystems/win32/win32k/include/gdidebug.h index 0f5221cc89f..5b53ec44218 100644 --- a/subsystems/win32/win32k/include/gdidebug.h +++ b/subsystems/win32/win32k/include/gdidebug.h @@ -30,7 +30,7 @@ typedef struct _LOGENTRY #if DBG_ENABLE_EVENT_LOGGING VOID NTAPI DbgDumpEventList(PSLIST_HEADER pslh); -VOID NTAPI DbgLogEvent(PSLIST_HEADER pslh, EVENT_TYPE nEventType, LPARAM lParam); +VOID NTAPI DbgLogEvent(PSLIST_HEADER pslh, LOG_EVENT_TYPE nEventType, LPARAM lParam); VOID NTAPI DbgCleanupEventList(PSLIST_HEADER pslh); #define DBG_LOGEVENT(pslh, type, val) DbgLogEvent(pslh, type, (ULONG_PTR)val) #define DBG_INITLOG(pslh) InitializeSListHead(pslh) @@ -43,28 +43,12 @@ VOID NTAPI DbgCleanupEventList(PSLIST_HEADER pslh); #define DBG_CLEANUP_EVENT_LIST(pslh) #endif -extern ULONG gulLogUnique; - -extern ULONG gulDebugChannels; - -enum _DEBUGCHANNELS -{ - DbgCustom = 1, - DbgObjects = 2, - DbgBitBlt = 4, - DbgXlate = 8, - DbgModeSwitch = 16, -}; VOID NTAPI DbgDumpGdiHandleTable(VOID); ULONG NTAPI DbgCaptureStackBackTace(PVOID* pFrames, ULONG nFramesToCapture); BOOL NTAPI DbgGdiHTIntegrityCheck(VOID); VOID NTAPI DbgDumpLockedGdiHandles(VOID); -#define DBGENABLE(ch) gulDebugChannels |= (ch); -#define DBGDISABLE(ch) gulDebugChannels &= ~(ch); -#define DPRINTCH(ch) if (gulDebugChannels & (ch)) DbgPrint - #define KeRosDumpStackFrames(Frames, Count) KdSystemDebugControl('DsoR', (PVOID)Frames, Count, NULL, 0, NULL, KernelMode) NTSYSAPI ULONG APIENTRY RtlWalkFrameChain(OUT PVOID *Callers, IN ULONG Count, IN ULONG Flags); diff --git a/subsystems/win32/win32k/include/msgqueue.h b/subsystems/win32/win32k/include/msgqueue.h index fd11f162409..691c814f1ce 100644 --- a/subsystems/win32/win32k/include/msgqueue.h +++ b/subsystems/win32/win32k/include/msgqueue.h @@ -1,6 +1,7 @@ #pragma once #include "hook.h" +#include "cursoricon.h" #define MSQ_HUNG 5000 #define MSQ_NORMAL 0 @@ -59,8 +60,6 @@ typedef struct _USER_MESSAGE_QUEUE LIST_ENTRY PostedMessagesListHead; /* Queue for hardware messages for the queue. */ LIST_ENTRY HardwareMessagesListHead; - /* Lock for the hardware message list. */ - KMUTEX HardwareLock; /* True if a WM_MOUSEMOVE is pending */ BOOLEAN MouseMoved; /* Current WM_MOUSEMOVE message */ @@ -111,6 +110,11 @@ typedef struct _USER_MESSAGE_QUEUE /* state of each key */ UCHAR KeyState[256]; + /* showing cursor counter (value>=0 - cursor visible, value<0 - cursor hidden) */ + INT ShowingCursor; + /* cursor object */ + PCURICON_OBJECT CursorObject; + /* messages that are currently dispatched by other threads */ LIST_ENTRY DispatchingMessagesHead; /* messages that are currently dispatched by this message queue, required for cleanup */ @@ -322,4 +326,10 @@ UINT FASTCALL GetWakeMask(UINT, UINT); VOID FASTCALL MsqWakeQueue(PUSER_MESSAGE_QUEUE,DWORD,BOOL); VOID FASTCALL ClearMsgBitsMask(PUSER_MESSAGE_QUEUE,UINT); +int UserShowCursor(BOOL bShow); +PCURICON_OBJECT +FASTCALL +UserSetCursor(PCURICON_OBJECT NewCursor, + BOOL ForceChange); + /* EOF */ diff --git a/subsystems/win32/win32k/include/napi.h b/subsystems/win32/win32k/include/napi.h index 9ae543bc76a..58319329f60 100644 --- a/subsystems/win32/win32k/include/napi.h +++ b/subsystems/win32/win32k/include/napi.h @@ -16,7 +16,7 @@ UCHAR Win32kSSPT[] = { #include "w32ksvc.h" }; -#define MIN_SYSCALL_NUMBER 0 +#define MIN_SYSCALL_NUMBER 0x1000 #define NUMBER_OF_SYSCALLS (sizeof(Win32kSSPT) / sizeof(Win32kSSPT[0])) -#define MAX_SYSCALL_NUMBER (NUMBER_OF_SYSCALLS - 1) +#define MAX_SYSCALL_NUMBER 0x1000 + (NUMBER_OF_SYSCALLS - 1) ULONG Win32kNumberOfSysCalls = NUMBER_OF_SYSCALLS; diff --git a/subsystems/win32/win32k/include/win32.h b/subsystems/win32/win32k/include/win32.h index 0204ff96bf1..51c0a094c2f 100644 --- a/subsystems/win32/win32k/include/win32.h +++ b/subsystems/win32/win32k/include/win32.h @@ -192,4 +192,8 @@ typedef struct _PROCESSINFO struct _GDI_POOL *pPoolDcAttr; struct _GDI_POOL *pPoolBrushAttr; struct _GDI_POOL *pPoolRgnAttr; + +#ifdef DBG + BYTE DbgChannelLevel[DbgChCount]; +#endif } PROCESSINFO; diff --git a/subsystems/win32/win32k/include/win32kdebug.h b/subsystems/win32/win32k/include/win32kdebug.h new file mode 100644 index 00000000000..2bd70465a38 --- /dev/null +++ b/subsystems/win32/win32k/include/win32kdebug.h @@ -0,0 +1,174 @@ +#pragma once + +/* + When a process is created, DbgInitDebugChannels will locate DEBUGCHANNEL + environment variable and extract information about debug channels. + This information includes which of the win32k debug channels will be + enabled for the current process and which level of a channel will be active. + This information will be stored in ppi->DbgChannelLevel. + In this way user mode can control how win32k debugging will work when + the following macros are used: ERR, FIXME, WARN, TRACE + + By default only the ERR channel will be active. Remember that other + debug channels can be activated for applications that are executed with a DEBUGCHANNEL + + Valid syntax for DEBUGCHANNEL is the following: + +UserProcess,info+UserWnd,err+UserWndpos,-listview + warn+UserMsgQ,-UserMsgGet,+shell + + Note the following: + The debug level is not required + The operation to enable/disable (+/-) and the name of the channel is required + Channels are devided by commas + No spaces are allowed + The syntax is case sensitive. Levels must be lowercase and + the names of the channels must be exactly like they are defined in DBG_DEFAULT_CHANNEL + This syntax can be mixed with wine debug channels without problems + +*/ + +#ifdef DBG + + typedef struct + { + PWCHAR Name; + ULONG Id; + } DBG_CHANNEL; + + /* note: the following values don't need to be sorted */ + enum _DEBUGCHANNELS + { + DbgChEngBlt, + DbgChEngBrush, + DbgChEngClip, + DbgChEngCursor, + DbgChEngDev, + DbgChEngErr, + DbgChEngEvent, + DbgChEngGrad, + DbgChEngLDev, + DbgChEngLine, + DbgChEngMapping, + DbgChEngPDev, + DbgChEngSurface, + DbgChEngWnd, + DbgChEngXlate, + DbgChGdiBitmap, + DbgChGdiBlt, + DbgChGdiBrush, + DbgChGdiClipRgn, + DbgChGdiCoord, + DbgChGdiDC, + DbgChGdiDCAttr, + DbgChGdiDCState, + DbgChGdiDev, + DbgChGdiDib, + DbgChGdiFont, + DbgChGdiLine, + DbgChGdiObj, + DbgChGdiPalette, + DbgChGdiPath, + DbgChGdiPen, + DbgChGdiPool, + DbgChGdiRgn, + DbgChGdiText, + DbgChGdiXFormObj, + DbgChUserAccel, + DbgChUserCalproc, + DbgChUserCaret, + DbgChUserClass, + DbgChUserClipbrd, + DbgChUserCsr, + DbgChUserDce, + DbgChUserDesktop, + DbgChUserEvent, + DbgChUserFocus, + DbgChUserHook, + DbgChUserHotkey, + DbgChUserIcon, + DbgChUserInput, + DbgChUserKbd, + DbgChUserKbdLayout, + DbgChUserMenu, + DbgChUserMetric, + DbgChUserMonitor, + DbgChUserMsgGet, + DbgChUserMsgQ, + DbgChUserMsgSend, + DbgChUserObj, + DbgChUserProcess, + DbgChUserProp, + DbgChUserScrollbar, + DbgChUserSysparam, + DbgChUserThread, + DbgChUserTimer, + DbgChUserWinsta, + DbgChUserWnd, + DbgChUserWndpos, + DbgChCount + }; + + #define DISABLED_LEVEL 0x0 + #define ERR_LEVEL 0x1 + #define FIXME_LEVEL 0x2 + #define WARN_LEVEL 0x4 + #define TRACE_LEVEL 0x8 + + #define MAX_LEVEL ERR_LEVEL | FIXME_LEVEL | WARN_LEVEL | TRACE_LEVEL + + /* the following assert is needed to make sure that the + debugging routines are not used before we get a ppi*/ + #define DBG_GET_PPI (ASSERT(PsGetCurrentProcessWin32Process()), (PPROCESSINFO)PsGetCurrentProcessWin32Process()) + #define DBG_DEFAULT_CHANNEL(x) static int DbgDefaultChannel = DbgCh##x; + + #define DBG_ENABLE_CHANNEL(ppi,ch,level) ((ppi)->DbgChannelLevel[ch] |= level) + #define DBG_DISABLE_CHANNEL(ppi,ch,level) ((ppi)->DbgChannelLevel[ch] &= ~level) + #define DBG_IS_CHANNEL_ENABLED(ppi,ch,level) ((ppi)->DbgChannelLevel[ch] & level) + + #define DBG_PRINT(ppi,ch,level,fmt, ...) do { \ + if(DBG_IS_CHANNEL_ENABLED(ppi,ch,level)) \ + DbgPrint("(%s:%d) " fmt, __FILE__, __LINE__, ##__VA_ARGS__); \ + }while(0); + + #define ERR(fmt, ...) DBG_PRINT(DBG_GET_PPI, DbgDefaultChannel, ERR_LEVEL,"err: " fmt, __VA_ARGS__) + #define FIXME(fmt, ...) DBG_PRINT(DBG_GET_PPI, DbgDefaultChannel, FIXME_LEVEL,"fixme: " fmt, __VA_ARGS__) + #define WARN(fmt, ...) DBG_PRINT(DBG_GET_PPI, DbgDefaultChannel, WARN_LEVEL,"warn: " fmt, __VA_ARGS__) + #define TRACE(fmt, ...) DBG_PRINT(DBG_GET_PPI, DbgDefaultChannel, TRACE_LEVEL,"trace: " fmt, __VA_ARGS__) + + #define ERR_CH(ch,fmt, ...) DBG_PRINT(DBG_GET_PPI, DbgCh##ch, ERR_LEVEL, "err: " fmt, __VA_ARGS__) + #define FIXME_CH(ch,fmt, ...) DBG_PRINT(DBG_GET_PPI, DbgCh##ch, FIXME_LEVEL, "fixme: " fmt, __VA_ARGS__) + #define WARN_CH(ch,fmt, ...) DBG_PRINT(DBG_GET_PPI, DbgCh##ch, WARN_LEVEL, "warn: " fmt, __VA_ARGS__) + #define TRACE_CH(ch,fmt, ...) DBG_PRINT(DBG_GET_PPI, DbgCh##ch, TRACE_LEVEL, "trace: " fmt, __VA_ARGS__) + + #define ERR_PPI(ppi,ch,fmt, ...) DBG_PRINT(ppi, DbgCh##ch, ERR_LEVEL,"err: " fmt, __VA_ARGS__) + #define FIXME_PPI(ppi,ch,fmt, ...) DBG_PRINT(ppi, DbgCh##ch, FIXME_LEVEL,"fixme: " fmt, __VA_ARGS__) + #define WARN_PPI(ppi,ch,fmt, ...) DBG_PRINT(ppi, DbgCh##ch, WARN_LEVEL,"warn: " fmt, __VA_ARGS__) + #define TRACE_PPI(ppi,ch,fmt, ...) DBG_PRINT(ppi, DbgCh##ch, TRACE_LEVEL,"trace: " fmt, __VA_ARGS__) + +#else + #define DBG_GET_PPI + #define DBG_DEFAULT_CHANNEL(x) () + + #define DBG_ENABLE_CHANNEL(ppi,ch,level) () + #define DBG_DISABLE_CHANNEL(ppi,ch,level) () + #define DBG_IS_CHANNEL_ENABLED(ppi,ch,level) () + + #define DBG_PRINT(ppi,ch,level) + + #define ERR(fmt, ...) + #define FIXME(fmt, ...) + #define WARN(fmt, ...) + #define TRACE(fmt, ...) + + #define ERR_CH(ch,fmt, ...) + #define FIXME_CH(ch,fmt, ...) + #define WARN_CH(ch,fmt, ...) + #define TRACE_CH(ch,fmt, ...) + + #define ERR_PPI(ppi,ch,fmt, ...) + #define FIXME_PPI(ppi,ch,fmt, ...) + #define WARN_PPI(ppi,ch,fmt, ...) + #define TRACE_PPI(ppi,ch,fmt, ...) +#endif + +BOOL DbgInitDebugChannels(); diff --git a/subsystems/win32/win32k/include/win32kp.h b/subsystems/win32/win32k/include/win32kp.h index 7c79d893c7b..f2843b1cf55 100644 --- a/subsystems/win32/win32k/include/win32kp.h +++ b/subsystems/win32/win32k/include/win32kp.h @@ -24,6 +24,7 @@ #define DBG_ENABLE_SERVICE_HOOKS 0 /* Internal Win32k Headers */ +#include #include #include #include diff --git a/subsystems/win32/win32k/include/window.h b/subsystems/win32/win32k/include/window.h index 44e6a8c86db..6b5d2f25898 100644 --- a/subsystems/win32/win32k/include/window.h +++ b/subsystems/win32/win32k/include/window.h @@ -28,6 +28,21 @@ BOOL FASTCALL UserUpdateUiState(PWND Wnd, WPARAM wParam); #define HAS_THINFRAME(Style, ExStyle) \ (((Style) & WS_BORDER) || (!((Style) & (WS_CHILD | WS_POPUP)))) +#define HAS_BIGFRAME(style,exStyle) \ + (((style) & (WS_THICKFRAME | WS_DLGFRAME)) || \ + ((exStyle) & WS_EX_DLGMODALFRAME)) + +#define HAS_STATICOUTERFRAME(style,exStyle) \ + (((exStyle) & (WS_EX_STATICEDGE|WS_EX_DLGMODALFRAME)) == \ + WS_EX_STATICEDGE) + +#define HAS_ANYFRAME(style,exStyle) \ + (((style) & (WS_THICKFRAME | WS_DLGFRAME | WS_BORDER)) || \ + ((exStyle) & WS_EX_DLGMODALFRAME) || \ + !((style) & (WS_CHILD | WS_POPUP))) + +#define HAS_MENU(pWnd,style) ((((style) & (WS_CHILD | WS_POPUP)) != WS_CHILD) && pWnd->IDMenu) + #define IntIsDesktopWindow(WndObj) \ (WndObj->spwndParent == NULL) @@ -112,5 +127,6 @@ PWND FASTCALL co_UserCreateWindowEx(CREATESTRUCTW*, PUNICODE_STRING, PLARGE_STRI WNDPROC FASTCALL IntGetWindowProc(PWND,BOOL); BOOL FASTCALL IntEnableWindow(HWND,BOOL); +DWORD FASTCALL GetNCHitEx(PWND pWnd, POINT pt); /* EOF */ diff --git a/subsystems/win32/win32k/main/dllmain.c b/subsystems/win32/win32k/main/dllmain.c index caa5ee314ed..39e387fb8e6 100644 --- a/subsystems/win32/win32k/main/dllmain.c +++ b/subsystems/win32/win32k/main/dllmain.c @@ -23,6 +23,7 @@ PSECTION_OBJECT GlobalUserHeapSection = NULL; PSERVERINFO gpsi = NULL; // Global User Server Information. SHORT gusLanguageID; +PPROCESSINFO ppiScrnSaver; extern ULONG_PTR Win32kSSDT[]; extern UCHAR Win32kSSPT[]; @@ -48,7 +49,7 @@ Win32kProcessCallback(struct _EPROCESS *Process, /* FIXME - lock the process */ Win32Process = ExAllocatePoolWithTag(NonPagedPool, sizeof(PROCESSINFO), - 'p23W'); + USERTAG_PROCESSINFO); if (Win32Process == NULL) RETURN( STATUS_NO_MEMORY); @@ -63,8 +64,16 @@ Win32kProcessCallback(struct _EPROCESS *Process, SIZE_T ViewSize = 0; LARGE_INTEGER Offset; PVOID UserBase = NULL; + PRTL_USER_PROCESS_PARAMETERS pParams = NULL; NTSTATUS Status; extern PSECTION_OBJECT GlobalUserHeapSection; + +#ifdef DBG + DbgInitDebugChannels(); +#endif + + TRACE_PPI(Win32Process, UserProcess,"Allocated ppi for PID:%d\n", Process->UniqueProcessId); + DPRINT("Creating W32 process PID:%d at IRQ level: %lu\n", Process->UniqueProcessId, KeGetCurrentIrql()); /* map the global heap into the process */ @@ -109,11 +118,19 @@ Win32kProcessCallback(struct _EPROCESS *Process, /* map the gdi handle table to user land */ Process->Peb->GdiSharedHandleTable = GDI_MapHandleTable(Process); Process->Peb->GdiDCAttributeList = GDI_BATCH_LIMIT; + pParams = Process->Peb->ProcessParameters; } Win32Process->peProcess = Process; /* setup process flags */ - Win32Process->W32PF_flags = 0; + Win32Process->W32PF_flags = W32PF_THREADCONNECTED; + + if ( pParams && + pParams->WindowFlags & STARTF_SCRNSAVER ) + { + ppiScrnSaver = Win32Process; + Win32Process->W32PF_flags |= W32PF_SCREENSAVER; + } /* Create pools for GDI object attributes */ Win32Process->pPoolDcAttr = GdiPoolCreate(sizeof(DC_ATTR), 'acdG'); @@ -128,6 +145,8 @@ Win32kProcessCallback(struct _EPROCESS *Process, DPRINT("Destroying W32 process PID:%d at IRQ level: %lu\n", Process->UniqueProcessId, KeGetCurrentIrql()); Win32Process->W32PF_flags |= W32PF_TERMINATED; + if (ppiScrnSaver == Win32Process) ppiScrnSaver = NULL; + /* Notify logon application to restart shell if needed */ if(Win32Process->rpdeskStartup->pDeskInfo) { @@ -138,9 +157,9 @@ Win32kProcessCallback(struct _EPROCESS *Process, DPRINT1("Shell process is exiting (%d)\n", ExitCode); - UserPostMessage(hwndSAS, - WM_LOGONNOTIFY, - LN_SHELL_EXITED, + UserPostMessage(hwndSAS, + WM_LOGONNOTIFY, + LN_SHELL_EXITED, ExitCode); } } @@ -184,6 +203,10 @@ Win32kProcessCallback(struct _EPROCESS *Process, GdiPoolDestroy(Win32Process->pPoolDcAttr); GdiPoolDestroy(Win32Process->pPoolBrushAttr); GdiPoolDestroy(Win32Process->pPoolRgnAttr); + + /* Ftee the PROCESSINFO */ + PsSetProcessWin32Process(Process, NULL); + ExFreePoolWithTag(Win32Process, USERTAG_PROCESSINFO); } RETURN( STATUS_SUCCESS); @@ -201,9 +224,9 @@ Win32kThreadCallback(struct _ETHREAD *Thread, PSW32THREADCALLOUTTYPE Type) { struct _EPROCESS *Process; - PTHREADINFO Win32Thread; + PTHREADINFO ptiCurrent; int i; - DECLARE_RETURN(NTSTATUS); + NTSTATUS Status; DPRINT("Enter Win32kThreadCallback\n"); UserEnterExclusive(); @@ -211,59 +234,63 @@ Win32kThreadCallback(struct _ETHREAD *Thread, Process = Thread->ThreadsProcess; /* Get the Win32 Thread */ - Win32Thread = PsGetThreadWin32Thread(Thread); + ptiCurrent = PsGetThreadWin32Thread(Thread); /* Allocate one if needed */ - if (!Win32Thread) + if (!ptiCurrent) { /* FIXME - lock the process */ - Win32Thread = ExAllocatePoolWithTag(NonPagedPool, - sizeof(THREADINFO), - 't23W'); + ptiCurrent = ExAllocatePoolWithTag(NonPagedPool, + sizeof(THREADINFO), + USERTAG_THREADINFO); - if (Win32Thread == NULL) RETURN( STATUS_NO_MEMORY); + if (ptiCurrent == NULL) + { + Status = STATUS_NO_MEMORY; + goto leave; + } - RtlZeroMemory(Win32Thread, sizeof(THREADINFO)); + RtlZeroMemory(ptiCurrent, sizeof(THREADINFO)); - PsSetThreadWin32Thread(Thread, Win32Thread); + PsSetThreadWin32Thread(Thread, ptiCurrent); /* FIXME - unlock the process */ } + if (Type == PsW32ThreadCalloutInitialize) { HWINSTA hWinSta = NULL; PTEB pTeb; HDESK hDesk = NULL; - NTSTATUS Status; PUNICODE_STRING DesktopPath; PDESKTOP pdesk; PRTL_USER_PROCESS_PARAMETERS ProcessParams = (Process->Peb ? Process->Peb->ProcessParameters : NULL); DPRINT("Creating W32 thread TID:%d at IRQ level: %lu\n", Thread->Cid.UniqueThread, KeGetCurrentIrql()); - InitializeListHead(&Win32Thread->WindowListHead); - InitializeListHead(&Win32Thread->W32CallbackListHead); - InitializeListHead(&Win32Thread->PtiLink); + InitializeListHead(&ptiCurrent->WindowListHead); + InitializeListHead(&ptiCurrent->W32CallbackListHead); + InitializeListHead(&ptiCurrent->PtiLink); for (i = 0; i < NB_HOOKS; i++) { - InitializeListHead(&Win32Thread->aphkStart[i]); + InitializeListHead(&ptiCurrent->aphkStart[i]); } - Win32Thread->TIF_flags &= ~TIF_INCLEANUP; - co_IntDestroyCaret(Win32Thread); - Win32Thread->ppi = PsGetCurrentProcessWin32Process(); - Win32Thread->ptiSibling = Win32Thread->ppi->ptiList; - Win32Thread->ppi->ptiList = Win32Thread; - Win32Thread->ppi->cThreads++; - if (Win32Thread->rpdesk && !Win32Thread->pDeskInfo) + ptiCurrent->TIF_flags &= ~TIF_INCLEANUP; + co_IntDestroyCaret(ptiCurrent); + ptiCurrent->ppi = PsGetCurrentProcessWin32Process(); + ptiCurrent->ptiSibling = ptiCurrent->ppi->ptiList; + ptiCurrent->ppi->ptiList = ptiCurrent; + ptiCurrent->ppi->cThreads++; + if (ptiCurrent->rpdesk && !ptiCurrent->pDeskInfo) { - Win32Thread->pDeskInfo = Win32Thread->rpdesk->pDeskInfo; + ptiCurrent->pDeskInfo = ptiCurrent->rpdesk->pDeskInfo; } - Win32Thread->MessageQueue = MsqCreateMessageQueue(Thread); - Win32Thread->KeyboardLayout = W32kGetDefaultKeyLayout(); - Win32Thread->pEThread = Thread; + ptiCurrent->MessageQueue = MsqCreateMessageQueue(Thread); + ptiCurrent->KeyboardLayout = W32kGetDefaultKeyLayout(); + ptiCurrent->pEThread = Thread; /* HAAAAAAAACK! This should go to Win32kProcessCallback */ - if(Win32Thread->ppi->hdeskStartup == NULL) + if(ptiCurrent->ppi->hdeskStartup == NULL) { /* * inherit the thread desktop and process window station (if not yet inherited) from the process startup @@ -294,8 +321,8 @@ Win32kThreadCallback(struct _ETHREAD *Thread, if(NT_SUCCESS(Status)) { - Win32Thread->ppi->hdeskStartup = hDesk; - Win32Thread->ppi->rpdeskStartup = pdesk; + ptiCurrent->ppi->hdeskStartup = hDesk; + ptiCurrent->ppi->rpdeskStartup = pdesk; } } } @@ -305,9 +332,9 @@ Win32kThreadCallback(struct _ETHREAD *Thread, } } - if (Win32Thread->ppi->hdeskStartup != NULL) + if (ptiCurrent->ppi->hdeskStartup != NULL) { - if (!IntSetThreadDesktop(Win32Thread->ppi->hdeskStartup, FALSE)) + if (!IntSetThreadDesktop(ptiCurrent->ppi->hdeskStartup, FALSE)) { DPRINT1("Unable to set thread desktop\n"); } @@ -317,20 +344,21 @@ Win32kThreadCallback(struct _ETHREAD *Thread, if (pTeb) { /* Attempt to startup client support which should have been initialized in IntSetThreadDesktop. */ PCLIENTINFO pci = (PCLIENTINFO)pTeb->Win32ClientInfo; - Win32Thread->pClientInfo = pci; - pci->ppi = Win32Thread->ppi; - pci->fsHooks = Win32Thread->fsHooks; - if (Win32Thread->KeyboardLayout) pci->hKL = Win32Thread->KeyboardLayout->hkl; - pci->dwTIFlags = Win32Thread->TIF_flags; + ptiCurrent->pClientInfo = pci; + pci->ppi = ptiCurrent->ppi; + pci->fsHooks = ptiCurrent->fsHooks; + if (ptiCurrent->KeyboardLayout) pci->hKL = ptiCurrent->KeyboardLayout->hkl; + pci->dwTIFlags = ptiCurrent->TIF_flags; + /* CI may not have been initialized. */ - if (!pci->pDeskInfo && Win32Thread->pDeskInfo) + if (!pci->pDeskInfo && ptiCurrent->pDeskInfo) { if (!pci->ulClientDelta) pci->ulClientDelta = DesktopHeapGetUserDelta(); - pci->pDeskInfo = (PVOID)((ULONG_PTR)Win32Thread->pDeskInfo - pci->ulClientDelta); + pci->pDeskInfo = (PVOID)((ULONG_PTR)ptiCurrent->pDeskInfo - pci->ulClientDelta); } - if (Win32Thread->pcti && pci->pDeskInfo) - pci->pClientThreadInfo = (PVOID)((ULONG_PTR)Win32Thread->pcti - pci->ulClientDelta); + if (ptiCurrent->pcti && pci->pDeskInfo) + pci->pClientThreadInfo = (PVOID)((ULONG_PTR)ptiCurrent->pcti - pci->ulClientDelta); else pci->pClientThreadInfo = NULL; } @@ -338,73 +366,83 @@ Win32kThreadCallback(struct _ETHREAD *Thread, { DPRINT1("No TEB for this Thread!\n"); // System thread running! Now SendMessage should be okay. - Win32Thread->pcti = &Win32Thread->cti; + ptiCurrent->pcti = &ptiCurrent->cti; } GetW32ThreadInfo(); } else { - PTHREADINFO pti; - PSINGLE_LIST_ENTRY e; + PTHREADINFO *ppti; + PSINGLE_LIST_ENTRY psle; + PPROCESSINFO ppiCurrent; DPRINT("Destroying W32 thread TID:%d at IRQ level: %lu\n", Thread->Cid.UniqueThread, KeGetCurrentIrql()); - Win32Thread->TIF_flags |= TIF_INCLEANUP; - pti = Win32Thread->ppi->ptiList; - if (pti == Win32Thread) + ppiCurrent = ptiCurrent->ppi; + ptiCurrent->TIF_flags |= TIF_INCLEANUP; + + /* Find the THREADINFO in the PROCESSINFO's list */ + ppti = &ppiCurrent->ptiList; + while (*ppti != NULL && *ppti != ptiCurrent) { - Win32Thread->ppi->ptiList = Win32Thread->ptiSibling; - Win32Thread->ppi->cThreads--; + ppti = &((*ppti)->ptiSibling); } - else - { - do - { - if (pti->ptiSibling == Win32Thread) - { - pti->ptiSibling = Win32Thread->ptiSibling; - Win32Thread->ppi->cThreads--; - break; - } - pti = pti->ptiSibling; - } - while (pti); - } - DceFreeThreadDCE(Win32Thread); + + /* we must have found it */ + ASSERT(*ppti == ptiCurrent); + + /* Remove it from the list */ + *ppti = ptiCurrent->ptiSibling; + + DceFreeThreadDCE(ptiCurrent); HOOK_DestroyThreadHooks(Thread); EVENT_DestroyThreadEvents(Thread); + /* Cleanup timers */ - DestroyTimersForThread(Win32Thread); - KeSetEvent(Win32Thread->MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE); + DestroyTimersForThread(ptiCurrent); + KeSetEvent(ptiCurrent->MessageQueue->NewMessages, IO_NO_INCREMENT, FALSE); UnregisterThreadHotKeys(Thread); + /* what if this co_ func crash in umode? what will clean us up then? */ co_DestroyThreadWindows(Thread); - IntBlockInput(Win32Thread, FALSE); - MsqDestroyMessageQueue(Win32Thread->MessageQueue); - IntCleanupThreadCallbacks(Win32Thread); + IntBlockInput(ptiCurrent, FALSE); + MsqDestroyMessageQueue(ptiCurrent->MessageQueue); + IntCleanupThreadCallbacks(ptiCurrent); /* cleanup user object references stack */ - e = PopEntryList(&Win32Thread->ReferencesList); - while (e) + psle = PopEntryList(&ptiCurrent->ReferencesList); + while (psle) { - PUSER_REFERENCE_ENTRY ref = CONTAINING_RECORD(e, USER_REFERENCE_ENTRY, Entry); + PUSER_REFERENCE_ENTRY ref = CONTAINING_RECORD(psle, USER_REFERENCE_ENTRY, Entry); DPRINT("thread clean: remove reference obj 0x%x\n",ref->obj); UserDereferenceObject(ref->obj); - e = PopEntryList(&Win32Thread->ReferencesList); + psle = PopEntryList(&ptiCurrent->ReferencesList); } IntSetThreadDesktop(NULL, TRUE); + /* Decrement thread count and check if its 0 */ + ppiCurrent->cThreads--; + if (ppiCurrent->cThreads == 0) + { + /* UGLY: Prevent this function from being called later + when we don't have a THREADINFO anymore. */ + UserSetCursor(NULL, TRUE); + } + + /* Free the THREADINFO */ PsSetThreadWin32Thread(Thread, NULL); + ExFreePoolWithTag(ptiCurrent, USERTAG_THREADINFO); } - RETURN( STATUS_SUCCESS); + Status = STATUS_SUCCESS; -CLEANUP: +leave: UserLeave(); - DPRINT("Leave Win32kThreadCallback, ret=%i\n",_ret_); - END_CLEANUP; + DPRINT("Leave Win32kThreadCallback, Status=0x%lx\n",Status); + + return Status; } NTSTATUS diff --git a/subsystems/win32/win32k/misc/registry.c b/subsystems/win32/win32k/misc/registry.c index 455aa3f8a36..a572b9ec3e6 100644 --- a/subsystems/win32/win32k/misc/registry.c +++ b/subsystems/win32/win32k/misc/registry.c @@ -84,16 +84,14 @@ RegQueryValue( cbDataSize = cbInfoSize - FIELD_OFFSET(KEY_VALUE_PARTIAL_INFORMATION, Data); + /* Note: STATUS_BUFFER_OVERFLOW is not a success */ if (NT_SUCCESS(Status)) { /* Did we get the right type */ if (pInfo->Type == ulType) { - /* Copy the contents to the caller. Make sure strings are null terminated */ - if (ulType == REG_SZ || ulType == REG_MULTI_SZ || ulType == REG_EXPAND_SZ) - RtlStringCbCopyNW((LPWSTR)pvData, *pcbValue, (LPWSTR)pInfo->Data, cbDataSize); - else - RtlCopyMemory(pvData, pInfo->Data, cbDataSize); + /* Copy the contents to the caller */ + RtlCopyMemory(pvData, pInfo->Data, cbDataSize); } else Status = STATUS_OBJECT_TYPE_MISMATCH; diff --git a/subsystems/win32/win32k/ntuser/class.c b/subsystems/win32/win32k/ntuser/class.c index 74595eccaa3..4f298de6229 100644 --- a/subsystems/win32/win32k/ntuser/class.c +++ b/subsystems/win32/win32k/ntuser/class.c @@ -13,9 +13,6 @@ #define NDEBUG #include -#define TRACE DPRINT -#define WARN DPRINT1 -#define ERR DPRINT1 REGISTER_SYSCLASS DefaultServerClasses[] = { @@ -1636,7 +1633,7 @@ UserSetClassLongPtr(IN PCLS Class, { PULONG_PTR Data; - TRACE("SetClassLong(%d, %x)\n", Index, NewLong); + DPRINT("SetClassLong(%d, %x)\n", Index, NewLong); if (Index + sizeof(ULONG_PTR) < Index || Index + sizeof(ULONG_PTR) > Class->cbclsExtra) @@ -1944,7 +1941,7 @@ UserRegisterSystemClasses(VOID) } else { - WARN("!!! Registering system class failed!\n"); + DPRINT1("!!! Registering system class failed!\n"); Ret = FALSE; } } @@ -2269,9 +2266,9 @@ NtUserGetClassInfo( CapturedClassName = ProbeForReadUnicodeString(ClassName); if (CapturedClassName.Length == 0) - TRACE("hInst %p atom %04X lpWndClassEx %p Ansi %d\n", hInstance, CapturedClassName.Buffer, lpWndClassEx, Ansi); + DPRINT("hInst %p atom %04X lpWndClassEx %p Ansi %d\n", hInstance, CapturedClassName.Buffer, lpWndClassEx, Ansi); else - TRACE("hInst %p class %wZ lpWndClassEx %p Ansi %d\n", hInstance, &CapturedClassName, lpWndClassEx, Ansi); + DPRINT("hInst %p class %wZ lpWndClassEx %p Ansi %d\n", hInstance, &CapturedClassName, lpWndClassEx, Ansi); if (CapturedClassName.Length & 1) { @@ -2299,7 +2296,7 @@ NtUserGetClassInfo( { if (!IS_ATOM(CapturedClassName.Buffer)) { - ERR("NtUserGetClassInfo() got ClassName instead of Atom!\n"); + DPRINT1("NtUserGetClassInfo() got ClassName instead of Atom!\n"); EngSetLastError(ERROR_INVALID_PARAMETER); Ret = FALSE; _SEH2_LEAVE; @@ -2463,7 +2460,7 @@ NtUserGetWOWClass(HINSTANCE hInstance, { if (!IS_ATOM(ClassName->Buffer)) { - ERR("NtUserGetWOWClass() got ClassName instead of Atom!\n"); + DPRINT1("NtUserGetWOWClass() got ClassName instead of Atom!\n"); Hit = TRUE; } else diff --git a/subsystems/win32/win32k/ntuser/cursoricon.c b/subsystems/win32/win32k/ntuser/cursoricon.c index 7daa480494c..0b3c419ed1f 100644 --- a/subsystems/win32/win32k/ntuser/cursoricon.c +++ b/subsystems/win32/win32k/ntuser/cursoricon.c @@ -99,80 +99,14 @@ PCURICON_OBJECT FASTCALL UserGetCurIconObject(HCURSOR hCurIcon) return CurIcon; } -PCURICON_OBJECT -FASTCALL -UserSetCursor( - PCURICON_OBJECT NewCursor, - BOOL ForceChange) -{ - PSYSTEM_CURSORINFO CurInfo; - PCURICON_OBJECT OldCursor; - HDC hdcScreen; - - CurInfo = IntGetSysCursorInfo(); - - OldCursor = CurInfo->CurrentCursorObject; - - /* Is the new cursor the same as the old cursor? */ - if (OldCursor == NewCursor) - { - /* Nothing to to do in this case */ - return OldCursor; - } - - /* Get the screen DC */ - if(!(hdcScreen = IntGetScreenDC())) - { - return (HCURSOR)0; - } - - /* Do we have a new cursor? */ - if (NewCursor) - { - CurInfo->ShowingCursor = 0; - CurInfo->CurrentCursorObject = NewCursor; - - /* Call GDI to set the new screen cursor */ - GreSetPointerShape(hdcScreen, - NewCursor->IconInfo.hbmMask, - NewCursor->IconInfo.hbmColor, - NewCursor->IconInfo.xHotspot, - NewCursor->IconInfo.yHotspot, - gpsi->ptCursor.x, - gpsi->ptCursor.y); - } - else - { - /* Check if were diplaying a cursor */ - if (OldCursor && CurInfo->ShowingCursor >= 0) - { - /* Remove the cursor */ - GreMovePointer(hdcScreen, -1, -1); - DPRINT("Removing pointer!\n"); - } - - CurInfo->CurrentCursorObject = NULL; - CurInfo->ShowingCursor = -1; - } - - /* Return the old cursor */ - return OldCursor; -} - BOOL UserSetCursorPos( INT x, INT y, DWORD flags, ULONG_PTR dwExtraInfo, BOOL Hook) { PWND DesktopWindow; PSYSTEM_CURSORINFO CurInfo; - HDC hDC; MSG Msg; RECTL rcClip; POINT pt; - if(!(hDC = IntGetScreenDC())) - { - return FALSE; - } - if(!(DesktopWindow = UserGetDesktopWindow())) { return FALSE; @@ -194,58 +128,19 @@ BOOL UserSetCursorPos( INT x, INT y, DWORD flags, ULONG_PTR dwExtraInfo, BOOL Ho pt.x = x; pt.y = y; - /* 3. Generate a mouse move message, this sets the htEx and Track Window too. */ + /* 1. Generate a mouse move message, this sets the htEx and Track Window too. */ Msg.message = WM_MOUSEMOVE; Msg.wParam = CurInfo->ButtonsDown; Msg.lParam = MAKELPARAM(x, y); Msg.pt = pt; co_MsqInsertMouseMessage(&Msg, flags, dwExtraInfo, Hook); - /* 1. Store the new cursor position */ + /* 2. Store the new cursor position */ gpsi->ptCursor = pt; - /* 2. Move the mouse pointer */ - GreMovePointer(hDC, x, y); - return TRUE; } -/* Called from NtUserCallOneParam with Routine ONEPARAM_ROUTINE_SHOWCURSOR - * User32 macro NtUserShowCursor */ -int UserShowCursor(BOOL bShow) -{ - PSYSTEM_CURSORINFO CurInfo = IntGetSysCursorInfo(); - HDC hdcScreen; - - if (!(hdcScreen = IntGetScreenDC())) - { - return -1; /* No mouse */ - } - - if (bShow == FALSE) - { - /* Check if were diplaying a cursor */ - if (CurInfo->ShowingCursor == 0) - { - /* Remove the pointer */ - GreMovePointer(hdcScreen, -1, -1); - DPRINT("Removing pointer!\n"); - } - CurInfo->ShowingCursor--; - } - else - { - if (CurInfo->ShowingCursor == -1) - { - /*Show the pointer*/ - GreMovePointer(hdcScreen, gpsi->ptCursor.x, gpsi->ptCursor.y); - } - CurInfo->ShowingCursor++; - } - - return CurInfo->ShowingCursor; -} - /* * We have to register that this object is in use by the current * process. The only way to do that seems to be to walk the list diff --git a/subsystems/win32/win32k/ntuser/defwnd.c b/subsystems/win32/win32k/ntuser/defwnd.c index c2560749508..470df873eaf 100644 --- a/subsystems/win32/win32k/ntuser/defwnd.c +++ b/subsystems/win32/win32k/ntuser/defwnd.c @@ -115,6 +115,7 @@ DefWndHandleSysCommand(PWND pWnd, WPARAM wParam, LPARAM lParam) { case SC_SCREENSAVE: DPRINT1("Screensaver Called!\n"); + UserPostMessage(hwndSAS, WM_LOGONNOTIFY, LN_START_SCREENSAVE, 0); // always lParam 0 == not Secure break; default: @@ -214,5 +215,207 @@ IntDefWindowProc( return lResult; } +static HICON NC_IconForWindow( PWND pWnd ) +{ + HICON hIcon = 0; + + if (!pWnd->pcls || pWnd->fnid == FNID_DESKTOP) return hIcon; + if (!hIcon) hIcon = pWnd->pcls->hIconSm; + if (!hIcon) hIcon = pWnd->pcls->hIcon; + + if (!hIcon && pWnd->style & DS_MODALFRAME) + { // Fake it out for now, we use it as a test. + hIcon = (HICON)1; + /* FIXME: Need to setup Registry System Cursor & Icons via Callbacks at init time! */ + if (!hIcon) hIcon = gpsi->hIconSmWindows; // Both are IDI_WINLOGO Small + if (!hIcon) hIcon = gpsi->hIcoWindows; // Reg size. + } + return hIcon; +} + +DWORD FASTCALL +GetNCHitEx(PWND pWnd, POINT pt) +{ + RECT rcWindow, rcClient; + DWORD Style, ExStyle; + + if (!pWnd) return HTNOWHERE; + + rcClient.left = rcClient.top = rcWindow.left = rcWindow.top = 0; + rcWindow.right = pWnd->rcWindow.right; + rcWindow.bottom = pWnd->rcWindow.bottom; + rcClient.right = pWnd->rcClient.right; + rcClient.bottom = pWnd->rcClient.bottom; + + if (!IntPtInRect(&rcWindow, pt)) return HTNOWHERE; + + Style = pWnd->style; + ExStyle = pWnd->ExStyle; + + if (Style & WS_MINIMIZE) return HTCAPTION; + + if (IntPtInRect( &rcClient, pt )) return HTCLIENT; + + /* Check borders */ + if (HAS_THICKFRAME( Style, ExStyle )) + { + RECTL_vInflateRect(&rcWindow, -UserGetSystemMetrics(SM_CXFRAME), -UserGetSystemMetrics(SM_CYFRAME) ); + if (!IntPtInRect(&rcWindow, pt)) + { + /* Check top sizing border */ + if (pt.y < rcWindow.top) + { + if (pt.x < rcWindow.left+UserGetSystemMetrics(SM_CXSIZE)) return HTTOPLEFT; + if (pt.x >= rcWindow.right-UserGetSystemMetrics(SM_CXSIZE)) return HTTOPRIGHT; + return HTTOP; + } + /* Check bottom sizing border */ + if (pt.y >= rcWindow.bottom) + { + if (pt.x < rcWindow.left+UserGetSystemMetrics(SM_CXSIZE)) return HTBOTTOMLEFT; + if (pt.x >= rcWindow.right-UserGetSystemMetrics(SM_CXSIZE)) return HTBOTTOMRIGHT; + return HTBOTTOM; + } + /* Check left sizing border */ + if (pt.x < rcWindow.left) + { + if (pt.y < rcWindow.top+UserGetSystemMetrics(SM_CYSIZE)) return HTTOPLEFT; + if (pt.y >= rcWindow.bottom-UserGetSystemMetrics(SM_CYSIZE)) return HTBOTTOMLEFT; + return HTLEFT; + } + /* Check right sizing border */ + if (pt.x >= rcWindow.right) + { + if (pt.y < rcWindow.top+UserGetSystemMetrics(SM_CYSIZE)) return HTTOPRIGHT; + if (pt.y >= rcWindow.bottom-UserGetSystemMetrics(SM_CYSIZE)) return HTBOTTOMRIGHT; + return HTRIGHT; + } + } + } + else /* No thick frame */ + { + if (HAS_DLGFRAME( Style, ExStyle )) + RECTL_vInflateRect(&rcWindow, -UserGetSystemMetrics(SM_CXDLGFRAME), -UserGetSystemMetrics(SM_CYDLGFRAME)); + else if (HAS_THINFRAME( Style, ExStyle )) + RECTL_vInflateRect(&rcWindow, -UserGetSystemMetrics(SM_CXBORDER), -UserGetSystemMetrics(SM_CYBORDER)); + if (!IntPtInRect( &rcWindow, pt )) return HTBORDER; + } + + /* Check caption */ + + if ((Style & WS_CAPTION) == WS_CAPTION) + { + if (ExStyle & WS_EX_TOOLWINDOW) + rcWindow.top += UserGetSystemMetrics(SM_CYSMCAPTION) - 1; + else + rcWindow.top += UserGetSystemMetrics(SM_CYCAPTION) - 1; + if (!IntPtInRect( &rcWindow, pt )) + { + BOOL min_or_max_box = (Style & WS_MAXIMIZEBOX) || + (Style & WS_MINIMIZEBOX); + if (ExStyle & WS_EX_LAYOUTRTL) + { + /* Check system menu */ + if ((Style & WS_SYSMENU) && !(ExStyle & WS_EX_TOOLWINDOW) && NC_IconForWindow(pWnd)) + { + rcWindow.right -= UserGetSystemMetrics(SM_CYCAPTION) - 1; + if (pt.x > rcWindow.right) return HTSYSMENU; + } + + /* Check close button */ + if (Style & WS_SYSMENU) + { + rcWindow.left += UserGetSystemMetrics(SM_CYCAPTION); + if (pt.x < rcWindow.left) return HTCLOSE; + } + + /* Check maximize box */ + /* In win95 there is automatically a Maximize button when there is a minimize one*/ + if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW)) + { + rcWindow.left += UserGetSystemMetrics(SM_CXSIZE); + if (pt.x < rcWindow.left) return HTMAXBUTTON; + } + + /* Check minimize box */ + if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW)) + { + rcWindow.left += UserGetSystemMetrics(SM_CXSIZE); + if (pt.x < rcWindow.left) return HTMINBUTTON; + } + } + else + { + /* Check system menu */ + if ((Style & WS_SYSMENU) && !(ExStyle & WS_EX_TOOLWINDOW) && NC_IconForWindow(pWnd)) + { + rcWindow.left += UserGetSystemMetrics(SM_CYCAPTION) - 1; + if (pt.x < rcWindow.left) return HTSYSMENU; + } + + /* Check close button */ + if (Style & WS_SYSMENU) + { + rcWindow.right -= UserGetSystemMetrics(SM_CYCAPTION); + if (pt.x > rcWindow.right) return HTCLOSE; + } + + /* Check maximize box */ + /* In win95 there is automatically a Maximize button when there is a minimize one*/ + if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW)) + { + rcWindow.right -= UserGetSystemMetrics(SM_CXSIZE); + if (pt.x > rcWindow.right) return HTMAXBUTTON; + } + + /* Check minimize box */ + if (min_or_max_box && !(ExStyle & WS_EX_TOOLWINDOW)) + { + rcWindow.right -= UserGetSystemMetrics(SM_CXSIZE); + if (pt.x > rcWindow.right) return HTMINBUTTON; + } + } + return HTCAPTION; + } + } + + /* Check menu bar */ + + if (HAS_MENU( pWnd, Style ) && (pt.y < rcClient.top) && + (pt.x >= rcClient.left) && (pt.x < rcClient.right)) + return HTMENU; + + /* Check vertical scroll bar */ + + if (ExStyle & WS_EX_LAYOUTRTL) ExStyle ^= WS_EX_LEFTSCROLLBAR; + if (Style & WS_VSCROLL) + { + if((ExStyle & WS_EX_LEFTSCROLLBAR) != 0) + rcClient.left -= UserGetSystemMetrics(SM_CXVSCROLL); + else + rcClient.right += UserGetSystemMetrics(SM_CXVSCROLL); + if (IntPtInRect( &rcClient, pt )) return HTVSCROLL; + } + + /* Check horizontal scroll bar */ + + if (Style & WS_HSCROLL) + { + rcClient.bottom += UserGetSystemMetrics(SM_CYHSCROLL); + if (IntPtInRect( &rcClient, pt )) + { + /* Check size box */ + if ((Style & WS_VSCROLL) && + ((((ExStyle & WS_EX_LEFTSCROLLBAR) != 0) && (pt.x <= rcClient.left + UserGetSystemMetrics(SM_CXVSCROLL))) || + (((ExStyle & WS_EX_LEFTSCROLLBAR) == 0) && (pt.x >= rcClient.right - UserGetSystemMetrics(SM_CXVSCROLL))))) + return HTSIZE; + return HTHSCROLL; + } + } + + /* Has to return HTNOWHERE if nothing was found + Could happen when a window has a customized non client area */ + return HTNOWHERE; +} /* EOF */ diff --git a/subsystems/win32/win32k/ntuser/desktop.c b/subsystems/win32/win32k/ntuser/desktop.c index 3dbfdcf117e..46b5a7763f2 100644 --- a/subsystems/win32/win32k/ntuser/desktop.c +++ b/subsystems/win32/win32k/ntuser/desktop.c @@ -14,9 +14,6 @@ #define NDEBUG #include -#define TRACE DPRINT -#define WARN DPRINT1 -#define ERR DPRINT1 static VOID @@ -178,17 +175,17 @@ IntDesktopOkToClose(PWIN32_OKAYTOCLOSEMETHOD_PARAMETERS Parameters) if( pti == NULL) { /* This happens when we leak desktop handles */ - return TRUE; + return STATUS_SUCCESS; } /* Do not allow the current desktop or the initial desktop to be closed */ if( Parameters->Handle == pti->ppi->hdeskStartup || Parameters->Handle == pti->hdesk) { - return FALSE; + return STATUS_ACCESS_DENIED; } - return TRUE; + return STATUS_SUCCESS; } /* PRIVATE FUNCTIONS **********************************************************/ @@ -1346,6 +1343,7 @@ NtUserPaintDesktop(HDC hDC) HWND hWndDesktop; BOOL doPatBlt = TRUE; PWND WndDesktop; + static WCHAR s_wszSafeMode[] = L"Safe Mode"; int len; COLORREF color_old; UINT align_old; @@ -1367,133 +1365,132 @@ NtUserPaintDesktop(HDC hDC) RETURN(FALSE); } - DesktopBrush = (HBRUSH)WndDesktop->pcls->hbrBackground; + if (!UserGetSystemMetrics(SM_CLEANBOOT)) + { + DesktopBrush = (HBRUSH)WndDesktop->pcls->hbrBackground; + /* + * Paint desktop background + */ + if (WinSta->hbmWallpaper != NULL) + { + SIZE sz; + int x, y; + HDC hWallpaperDC; - /* - * Paint desktop background - */ + sz.cx = WndDesktop->rcWindow.right - WndDesktop->rcWindow.left; + sz.cy = WndDesktop->rcWindow.bottom - WndDesktop->rcWindow.top; - if (WinSta->hbmWallpaper != NULL) - { - PWND DeskWin; - - DeskWin = UserGetWindowObject(hWndDesktop); - - if (DeskWin) - { - SIZE sz; - int x, y; - HDC hWallpaperDC; - - sz.cx = DeskWin->rcWindow.right - DeskWin->rcWindow.left; - sz.cy = DeskWin->rcWindow.bottom - DeskWin->rcWindow.top; - - if (WinSta->WallpaperMode == wmStretch || - WinSta->WallpaperMode == wmTile) - { - x = 0; - y = 0; - } - else - { - /* Find the upper left corner, can be negtive if the bitmap is bigger then the screen */ - x = (sz.cx / 2) - (WinSta->cxWallpaper / 2); - y = (sz.cy / 2) - (WinSta->cyWallpaper / 2); - } - - hWallpaperDC = NtGdiCreateCompatibleDC(hDC); - if(hWallpaperDC != NULL) - { - HBITMAP hOldBitmap; - - /* fill in the area that the bitmap is not going to cover */ - if (x > 0 || y > 0) + if (WinSta->WallpaperMode == wmStretch || + WinSta->WallpaperMode == wmTile) { - /* FIXME - clip out the bitmap - can be replaced with "NtGdiPatBlt(hDC, x, y, WinSta->cxWallpaper, WinSta->cyWallpaper, PATCOPY | DSTINVERT);" - once we support DSTINVERT */ - PreviousBrush = NtGdiSelectBrush(hDC, DesktopBrush); - NtGdiPatBlt(hDC, Rect.left, Rect.top, Rect.right, Rect.bottom, PATCOPY); - NtGdiSelectBrush(hDC, PreviousBrush); - } - - /*Do not fill the background after it is painted no matter the size of the picture */ - doPatBlt = FALSE; - - hOldBitmap = NtGdiSelectBitmap(hWallpaperDC, WinSta->hbmWallpaper); - - if (WinSta->WallpaperMode == wmStretch) - { - if(Rect.right && Rect.bottom) - NtGdiStretchBlt(hDC, - x, - y, - sz.cx, - sz.cy, - hWallpaperDC, - 0, - 0, - WinSta->cxWallpaper, - WinSta->cyWallpaper, - SRCCOPY, - 0); - - } - else if (WinSta->WallpaperMode == wmTile) - { - /* paint the bitmap across the screen then down */ - for(y = 0; y < Rect.bottom; y += WinSta->cyWallpaper) - { - for(x = 0; x < Rect.right; x += WinSta->cxWallpaper) - { - NtGdiBitBlt(hDC, - x, - y, - WinSta->cxWallpaper, - WinSta->cyWallpaper, - hWallpaperDC, - 0, - 0, - SRCCOPY, - 0, - 0); - } - } + x = 0; + y = 0; } else { - NtGdiBitBlt(hDC, - x, - y, - WinSta->cxWallpaper, - WinSta->cyWallpaper, - hWallpaperDC, - 0, - 0, - SRCCOPY, - 0, - 0); + /* Find the upper left corner, can be negtive if the bitmap is bigger then the screen */ + x = (sz.cx / 2) - (WinSta->cxWallpaper / 2); + y = (sz.cy / 2) - (WinSta->cyWallpaper / 2); } - NtGdiSelectBitmap(hWallpaperDC, hOldBitmap); - NtGdiDeleteObjectApp(hWallpaperDC); - } - } - } - /* Back ground is set to none, clear the screen */ - if (doPatBlt) - { + hWallpaperDC = NtGdiCreateCompatibleDC(hDC); + if(hWallpaperDC != NULL) + { + HBITMAP hOldBitmap; + + /* fill in the area that the bitmap is not going to cover */ + if (x > 0 || y > 0) + { + /* FIXME - clip out the bitmap + can be replaced with "NtGdiPatBlt(hDC, x, y, WinSta->cxWallpaper, WinSta->cyWallpaper, PATCOPY | DSTINVERT);" + once we support DSTINVERT */ + PreviousBrush = NtGdiSelectBrush(hDC, DesktopBrush); + NtGdiPatBlt(hDC, Rect.left, Rect.top, Rect.right, Rect.bottom, PATCOPY); + NtGdiSelectBrush(hDC, PreviousBrush); + } + + /*Do not fill the background after it is painted no matter the size of the picture */ + doPatBlt = FALSE; + + hOldBitmap = NtGdiSelectBitmap(hWallpaperDC, WinSta->hbmWallpaper); + + if (WinSta->WallpaperMode == wmStretch) + { + if(Rect.right && Rect.bottom) + NtGdiStretchBlt(hDC, + x, + y, + sz.cx, + sz.cy, + hWallpaperDC, + 0, + 0, + WinSta->cxWallpaper, + WinSta->cyWallpaper, + SRCCOPY, + 0); + + } + else if (WinSta->WallpaperMode == wmTile) + { + /* paint the bitmap across the screen then down */ + for(y = 0; y < Rect.bottom; y += WinSta->cyWallpaper) + { + for(x = 0; x < Rect.right; x += WinSta->cxWallpaper) + { + NtGdiBitBlt(hDC, + x, + y, + WinSta->cxWallpaper, + WinSta->cyWallpaper, + hWallpaperDC, + 0, + 0, + SRCCOPY, + 0, + 0); + } + } + } + else + { + NtGdiBitBlt(hDC, + x, + y, + WinSta->cxWallpaper, + WinSta->cyWallpaper, + hWallpaperDC, + 0, + 0, + SRCCOPY, + 0, + 0); + } + NtGdiSelectBitmap(hWallpaperDC, hOldBitmap); + NtGdiDeleteObjectApp(hWallpaperDC); + } + } + } + else + { + /* Black desktop background in Safe Mode */ + DesktopBrush = StockObjects[BLACK_BRUSH]; + } + + /* Back ground is set to none, clear the screen */ + if (doPatBlt) + { PreviousBrush = NtGdiSelectBrush(hDC, DesktopBrush); NtGdiPatBlt(hDC, Rect.left, Rect.top, Rect.right, Rect.bottom, PATCOPY); NtGdiSelectBrush(hDC, PreviousBrush); - } + } /* * Display system version on the desktop background */ - if (g_PaintDesktopVersion) + if (g_PaintDesktopVersion||UserGetSystemMetrics(SM_CLEANBOOT)) { static WCHAR s_wszVersion[256] = {0}; RECTL rect; @@ -1519,7 +1516,29 @@ NtUserPaintDesktop(HDC hDC) align_old = IntGdiSetTextAlign(hDC, TA_RIGHT); mode_old = IntGdiSetBkMode(hDC, TRANSPARENT); - GreExtTextOutW(hDC, rect.right-16, rect.bottom-48, 0, NULL, s_wszVersion, len, NULL, 0); + if(!UserGetSystemMetrics(SM_CLEANBOOT)) + { + GreExtTextOutW(hDC, rect.right-16, rect.bottom-48, 0, NULL, s_wszVersion, len, NULL, 0); + } + else + { + /* Safe Mode */ + /* Version information text in top center */ + IntGdiSetTextAlign(hDC, TA_CENTER|TA_TOP); + GreExtTextOutW(hDC, (rect.right+rect.left)/2, rect.top, 0, NULL, s_wszVersion, len, NULL, 0); + /* Safe Mode text in corners */ + len = wcslen(s_wszSafeMode); + IntGdiSetTextAlign(hDC, TA_RIGHT|TA_TOP); + GreExtTextOutW(hDC, rect.right, rect.top, 0, NULL, s_wszSafeMode, len, NULL, 0); + IntGdiSetTextAlign(hDC, TA_RIGHT|TA_BASELINE); + GreExtTextOutW(hDC, rect.right, rect.bottom, 0, NULL, s_wszSafeMode, len, NULL, 0); + IntGdiSetTextAlign(hDC, TA_LEFT|TA_TOP); + GreExtTextOutW(hDC, rect.left, rect.top, 0, NULL, s_wszSafeMode, len, NULL, 0); + IntGdiSetTextAlign(hDC, TA_LEFT|TA_BASELINE); + GreExtTextOutW(hDC, rect.left, rect.bottom, 0, NULL, s_wszSafeMode, len, NULL, 0); + + } + IntGdiSetBkMode(hDC, mode_old); IntGdiSetTextAlign(hDC, align_old); @@ -1710,7 +1729,7 @@ IntUnmapDesktopView(IN PDESKTOP DesktopObject) PW32HEAP_USER_MAPPING HeapMapping, *PrevLink; NTSTATUS Status = STATUS_SUCCESS; - TRACE("DO %p\n"); + DPRINT("DO %p\n"); CurrentWin32Process = PsGetCurrentProcessWin32Process(); PrevLink = &CurrentWin32Process->HeapMappings.Next; diff --git a/subsystems/win32/win32k/ntuser/display.c b/subsystems/win32/win32k/ntuser/display.c index 76c0d25f315..b5ea068167a 100644 --- a/subsystems/win32/win32k/ntuser/display.c +++ b/subsystems/win32/win32k/ntuser/display.c @@ -634,7 +634,6 @@ NtUserEnumDisplaySettings( BOOL APIENTRY UserClipCursor(RECTL *prcl); VOID APIENTRY UserRedrawDesktop(); -HCURSOR FASTCALL UserSetCursor(PCURICON_OBJECT NewCursor, BOOL ForceChange); LONG APIENTRY diff --git a/subsystems/win32/win32k/ntuser/hook.c b/subsystems/win32/win32k/ntuser/hook.c index 466232d6b43..c743294f596 100644 --- a/subsystems/win32/win32k/ntuser/hook.c +++ b/subsystems/win32/win32k/ntuser/hook.c @@ -5,6 +5,7 @@ * FILE: subsystems/win32/win32k/ntuser/hook.c * PROGRAMER: Casper S. Hornstrup (chorns@users.sourceforge.net) * James Tabor (james.tabor@rectos.org) + * Rafal Harabien (rafalh@reactos.org) * * REVISION HISTORY: * 06-06-2001 CSH Created @@ -29,15 +30,15 @@ typedef struct _HOOKPACK static LRESULT FASTCALL -IntCallLowLevelHook( PHOOK Hook, - INT Code, - WPARAM wParam, - LPARAM lParam) +co_IntCallLowLevelHook(PHOOK Hook, + INT Code, + WPARAM wParam, + LPARAM lParam) { NTSTATUS Status; PTHREADINFO pti; PHOOKPACK pHP; - INT Size; + INT Size = 0; UINT uTimeout = 300; BOOL Block = FALSE; ULONG_PTR uResult = 0; @@ -53,7 +54,6 @@ IntCallLowLevelHook( PHOOK Hook, pHP->pHk = Hook; pHP->lParam = lParam; pHP->pHookStructs = NULL; - Size = 0; // This prevents stack corruption from the caller. switch(Hook->HookId) @@ -170,13 +170,14 @@ co_HOOK_CallHookNext( PHOOK Hook, &Hook->ModuleName); } +static LRESULT FASTCALL -IntCallDebugHook( PHOOK Hook, - int Code, - WPARAM wParam, - LPARAM lParam, - BOOL Ansi) +co_IntCallDebugHook(PHOOK Hook, + int Code, + WPARAM wParam, + LPARAM lParam, + BOOL Ansi) { LRESULT lResult = 0; ULONG Size; @@ -302,13 +303,14 @@ IntCallDebugHook( PHOOK Hook, return lResult; } +static LRESULT FASTCALL -UserCallNextHookEx( PHOOK Hook, - int Code, - WPARAM wParam, - LPARAM lParam, - BOOL Ansi) +co_UserCallNextHookEx(PHOOK Hook, + int Code, + WPARAM wParam, + LPARAM lParam, + BOOL Ansi) { LRESULT lResult = 0; BOOL BadChk = FALSE; @@ -697,7 +699,7 @@ UserCallNextHookEx( PHOOK Hook, } case WH_DEBUG: - lResult = IntCallDebugHook(Hook, Code, wParam, lParam, Ansi); + lResult = co_IntCallDebugHook(Hook, Code, wParam, lParam, Ansi); break; /* @@ -740,31 +742,36 @@ IntGetHookObject(HHOOK hHook) return Hook; } -/* get the first hook in the chain */ static -PHOOK +HHOOK* FASTCALL -IntGetFirstHook(PLIST_ENTRY Table) +IntGetGlobalHookHandles(PDESKTOP pdo, int HookId) { - PLIST_ENTRY Elem = Table->Flink; + PLIST_ENTRY pLastHead, pElem; + unsigned i = 0; + unsigned cHooks = 0; + HHOOK *pList; + PHOOK pHook; - if (IsListEmpty(Table)) return NULL; + pLastHead = &pdo->pDeskInfo->aphkStart[HOOKID_TO_INDEX(HookId)]; + for (pElem = pLastHead->Flink; pElem != pLastHead; pElem = pElem->Flink) + ++cHooks; + + pList = ExAllocatePoolWithTag(PagedPool, (cHooks + 1) * sizeof(HHOOK), TAG_HOOK); + if(!pList) + { + EngSetLastError(ERROR_NOT_ENOUGH_MEMORY); + return NULL; + } - return Elem == Table ? NULL : CONTAINING_RECORD(Elem, HOOK, Chain); -} - -static -PHOOK -FASTCALL -IntGetNextGlobalHook(PHOOK Hook, PDESKTOP pdo) -{ - int HookId = Hook->HookId; - PLIST_ENTRY Elem; - - Elem = Hook->Chain.Flink; - if (Elem != &pdo->pDeskInfo->aphkStart[HOOKID_TO_INDEX(HookId)]) - return CONTAINING_RECORD(Elem, HOOK, Chain); - return NULL; + for (pElem = pLastHead->Flink; pElem != pLastHead; pElem = pElem->Flink) + { + pHook = CONTAINING_RECORD(pElem, HOOK, Chain); + pList[i++] = pHook->head.h; + } + pList[i] = NULL; + + return pList; } /* find the next hook in the chain */ @@ -773,22 +780,23 @@ FASTCALL IntGetNextHook(PHOOK Hook) { int HookId = Hook->HookId; - PLIST_ENTRY Elem; + PLIST_ENTRY pLastHead, pElem; PTHREADINFO pti; if (Hook->Thread) { pti = ((PTHREADINFO)Hook->Thread->Tcb.Win32Thread); - - Elem = Hook->Chain.Flink; - if (Elem != &pti->aphkStart[HOOKID_TO_INDEX(HookId)]) - return CONTAINING_RECORD(Elem, HOOK, Chain); + pLastHead = &pti->aphkStart[HOOKID_TO_INDEX(HookId)]; } else { pti = PsGetCurrentThreadWin32Thread(); - return IntGetNextGlobalHook(Hook, pti->rpdesk); + pLastHead = &pti->rpdesk->pDeskInfo->aphkStart[HOOKID_TO_INDEX(HookId)]; } + + pElem = Hook->Chain.Flink; + if (pElem != pLastHead) + return CONTAINING_RECORD(pElem, HOOK, Chain); return NULL; } @@ -810,7 +818,7 @@ IntFreeHook(PHOOK Hook) /* remove a hook, freeing it from the chain */ static -BOOL +VOID FASTCALL IntRemoveHook(PHOOK Hook) { @@ -837,7 +845,6 @@ IntRemoveHook(PHOOK Hook) { } _SEH2_END; - return TRUE; } } else // Global @@ -851,10 +858,8 @@ IntRemoveHook(PHOOK Hook) IsListEmpty(&pdo->pDeskInfo->aphkStart[HOOKID_TO_INDEX(HookId)]) ) { pdo->pDeskInfo->fsHooks &= ~HOOKID_TO_FLAG(HookId); - return TRUE; } } - return FALSE; } VOID @@ -875,27 +880,21 @@ HOOK_DestroyThreadHooks(PETHREAD Thread) DPRINT1("Kill Thread Hooks pti 0x%x pdo 0x%x\n",pti,pdo); return; } - ObReferenceObject(Thread); // Local Thread cleanup. if (pti->fsHooks) { for (HookId = WH_MINHOOK; HookId <= WH_MAXHOOK; HookId++) { - PLIST_ENTRY pLLE = &pti->aphkStart[HOOKID_TO_INDEX(HookId)]; + PLIST_ENTRY pLastHead = &pti->aphkStart[HOOKID_TO_INDEX(HookId)]; - if (IsListEmpty(pLLE)) continue; - - pElem = pLLE->Flink; - HookObj = CONTAINING_RECORD(pElem, HOOK, Chain); - do + pElem = pLastHead->Flink; + while (pElem != pLastHead) { - if (!HookObj) break; - if (IntRemoveHook(HookObj)) break; - pElem = HookObj->Chain.Flink; HookObj = CONTAINING_RECORD(pElem, HOOK, Chain); + pElem = HookObj->Chain.Flink; // get next element before hook is destroyed + IntRemoveHook(HookObj); } - while (pElem != pLLE); } pti->fsHooks = 0; } @@ -905,25 +904,19 @@ HOOK_DestroyThreadHooks(PETHREAD Thread) for (HookId = WH_MINHOOK; HookId <= WH_MAXHOOK; HookId++) { PLIST_ENTRY pGLE = &pdo->pDeskInfo->aphkStart[HOOKID_TO_INDEX(HookId)]; - - if (IsListEmpty(pGLE)) continue; - + pElem = pGLE->Flink; - HookObj = CONTAINING_RECORD(pElem, HOOK, Chain); - do + while (pElem != pGLE) { - if (!HookObj) break; + HookObj = CONTAINING_RECORD(pElem, HOOK, Chain); + pElem = HookObj->Chain.Flink; // get next element before hook is destroyed if (HookObj->head.pti == pti) { - if (IntRemoveHook(HookObj)) break; + IntRemoveHook(HookObj); } - pElem = HookObj->Chain.Flink; - HookObj = CONTAINING_RECORD(pElem, HOOK, Chain); } - while (pElem != pGLE); } } - ObDereferenceObject(Thread); return; } @@ -940,10 +933,11 @@ co_HOOK_CallHooks( INT HookId, PHOOK Hook, SaveHook; PTHREADINFO pti; PCLIENTINFO ClientInfo; - PLIST_ENTRY pLLE, pGLE; + PLIST_ENTRY pLastHead; PDESKTOP pdo; BOOL Local = FALSE, Global = FALSE; LRESULT Result = 0; + USER_REFERENCE_ENTRY Ref; ASSERT(WH_MINHOOK <= HookId && HookId <= WH_MAXHOOK); @@ -992,14 +986,15 @@ co_HOOK_CallHooks( INT HookId, */ if ( Local ) { - pLLE = &pti->aphkStart[HOOKID_TO_INDEX(HookId)]; - Hook = IntGetFirstHook(pLLE); - if (!Hook) + pLastHead = &pti->aphkStart[HOOKID_TO_INDEX(HookId)]; + if (IsListEmpty(pLastHead)) { DPRINT1("No Local Hook Found!\n"); goto Exit; } - ObReferenceObject(Hook->Thread); + + Hook = CONTAINING_RECORD(pLastHead->Flink, HOOK, Chain); + UserRefObjectCo(Hook, &Ref); ClientInfo = pti->pClientInfo; SaveHook = pti->sphkCurrent; @@ -1043,44 +1038,46 @@ co_HOOK_CallHooks( INT HookId, } pti->sphkCurrent = SaveHook; Hook->phkNext = NULL; - ObDereferenceObject(Hook->Thread); + UserDerefObjectCo(Hook); } if ( Global ) { PTHREADINFO ptiHook; + HHOOK *pHookHandles; + unsigned i; - pGLE = &pdo->pDeskInfo->aphkStart[HOOKID_TO_INDEX(HookId)]; - Hook = IntGetFirstHook(pGLE); - if (!Hook) - { - DPRINT1("No Global Hook Found!\n"); + /* Keep hooks in array because hooks can be destroyed in user world */ + pHookHandles = IntGetGlobalHookHandles(pdo, HookId); + if(!pHookHandles) goto Exit; - } + /* Performance goes down the drain. If more hooks are associated to this * hook ID, this will have to post to each of the thread message queues * or make a direct call. */ - do + for(i = 0; pHookHandles[i]; ++i) { + Hook = (PHOOK)UserGetObject(gHandleTable, pHookHandles[i], otHook); + if(!Hook) + { + DPRINT1("Invalid hook!\n"); + continue; + } + UserRefObjectCo(Hook, &Ref); + /* Hook->Thread is null, we hax around this with Hook->head.pti. */ ptiHook = Hook->head.pti; - /* "Global hook monitors messages for all threads in the same desktop - * as the calling thread." - */ - if ( ptiHook->TIF_flags & (TIF_INCLEANUP|TIF_DISABLEHOOKS) || - ptiHook->rpdesk != pdo) + if ( (pti->TIF_flags & TIF_DISABLEHOOKS) || (ptiHook->TIF_flags & TIF_INCLEANUP)) { - DPRINT("Next Hook 0x%x, 0x%x\n",ptiHook->rpdesk,pdo); - Hook = IntGetNextGlobalHook(Hook, pdo); - if (!Hook) break; + DPRINT("Next Hook 0x%x, 0x%x\n", ptiHook->rpdesk, pdo); continue; } - // Lockup the thread while this links through user world. - ObReferenceObject(ptiHook->pEThread); + if (ptiHook != pti ) - { // Block | TimeOut + { + // Block | TimeOut if ( HookId == WH_JOURNALPLAYBACK || // 1 | 0 HookId == WH_JOURNALRECORD || // 1 | 0 HookId == WH_KEYBOARD || // 1 | 200 @@ -1088,13 +1085,12 @@ co_HOOK_CallHooks( INT HookId, HookId == WH_KEYBOARD_LL || // 0 | 300 HookId == WH_MOUSE_LL ) // 0 | 300 { - DPRINT("\nGlobal Hook posting to another Thread! %d\n",HookId ); - Result = IntCallLowLevelHook(Hook, Code, wParam, lParam); + DPRINT("\nGlobal Hook posting to another Thread! %d\n", HookId); + Result = co_IntCallLowLevelHook(Hook, Code, wParam, lParam); } } else { /* Make the direct call. */ - DPRINT("\nLocal Hook calling to Thread! %d\n",HookId ); Result = co_IntCallHookProc( HookId, Code, wParam, @@ -1103,11 +1099,10 @@ co_HOOK_CallHooks( INT HookId, Hook->Ansi, &Hook->ModuleName); } - ObDereferenceObject(ptiHook->pEThread); - Hook = IntGetNextGlobalHook(Hook, pdo); + UserDerefObjectCo(Hook); } - while ( Hook ); - DPRINT("Ret: Global HookId %d Result 0x%x\n", HookId,Result); + ExFreePoolWithTag(pHookHandles, TAG_HOOK); + DPRINT("Ret: Global HookId %d Result 0x%x\n", HookId, Result); } Exit: return Result; @@ -1118,7 +1113,7 @@ FASTCALL IntUnhookWindowsHook(int HookId, HOOKPROC pfnFilterProc) { PHOOK Hook; - PLIST_ENTRY pLLE, pLE; + PLIST_ENTRY pLastHead, pElement; PTHREADINFO pti = PsGetCurrentThreadWin32Thread(); if (HookId < WH_MINHOOK || WH_MAXHOOK < HookId ) @@ -1129,15 +1124,13 @@ IntUnhookWindowsHook(int HookId, HOOKPROC pfnFilterProc) if (pti->fsHooks) { - pLLE = &pti->aphkStart[HOOKID_TO_INDEX(HookId)]; + pLastHead = &pti->aphkStart[HOOKID_TO_INDEX(HookId)]; - if (IsListEmpty(pLLE)) return FALSE; - - pLE = pLLE->Flink; - Hook = CONTAINING_RECORD(pLE, HOOK, Chain); - do + pElement = pLastHead->Flink; + while (pElement != pLastHead) { - if (!Hook) break; + Hook = CONTAINING_RECORD(pElement, HOOK, Chain); + if (Hook->Proc == pfnFilterProc) { if (Hook->head.pti == pti) @@ -1152,10 +1145,9 @@ IntUnhookWindowsHook(int HookId, HOOKPROC pfnFilterProc) return FALSE; } } - pLE = Hook->Chain.Flink; - Hook = CONTAINING_RECORD(pLE, HOOK, Chain); + + pElement = Hook->Chain.Flink; } - while (pLE != pLLE); } return FALSE; } @@ -1207,7 +1199,7 @@ NtUserCallNextHookEx( int Code, if (ClientInfo && NextObj) { NextObj->phkNext = IntGetNextHook(NextObj); - lResult = UserCallNextHookEx( NextObj, Code, wParam, lParam, NextObj->Ansi); + lResult = co_UserCallNextHookEx( NextObj, Code, wParam, lParam, NextObj->Ansi); } RETURN( lResult); @@ -1252,14 +1244,13 @@ NtUserSetWindowsHookEx( HINSTANCE Mod, NTSTATUS Status; HHOOK Handle; PETHREAD Thread = NULL; - PTHREADINFO ptiCurrent, pti = NULL; - BOOL Hit = FALSE; + PTHREADINFO pti, ptiHook = NULL; DECLARE_RETURN(HHOOK); DPRINT("Enter NtUserSetWindowsHookEx\n"); UserEnterExclusive(); - ptiCurrent = PsGetCurrentThreadWin32Thread(); + pti = PsGetCurrentThreadWin32Thread(); if (HookId < WH_MINHOOK || WH_MAXHOOK < HookId ) { @@ -1294,11 +1285,11 @@ NtUserSetWindowsHookEx( HINSTANCE Mod, RETURN( NULL); } - pti = Thread->Tcb.Win32Thread; + ptiHook = Thread->Tcb.Win32Thread; ObDereferenceObject(Thread); - if ( pti->rpdesk != ptiCurrent->rpdesk) // gptiCurrent->rpdesk) + if ( ptiHook->rpdesk != pti->rpdesk) // gptiCurrent->rpdesk) { DPRINT1("Local hook wrong desktop HookId: %d\n",HookId); EngSetLastError(ERROR_ACCESS_DENIED); @@ -1322,7 +1313,7 @@ NtUserSetWindowsHookEx( HINSTANCE Mod, RETURN( NULL); } - if ( (pti->TIF_flags & (TIF_CSRSSTHREAD|TIF_SYSTEMTHREAD)) && + if ( (ptiHook->TIF_flags & (TIF_CSRSSTHREAD|TIF_SYSTEMTHREAD)) && (HookId == WH_GETMESSAGE || HookId == WH_CALLWNDPROC || HookId == WH_CBT || @@ -1339,7 +1330,7 @@ NtUserSetWindowsHookEx( HINSTANCE Mod, } else /* system-global hook */ { - pti = ptiCurrent; // gptiCurrent; + ptiHook = pti; // gptiCurrent; if ( !Mod && (HookId == WH_GETMESSAGE || HookId == WH_CALLWNDPROC || @@ -1379,68 +1370,60 @@ NtUserSetWindowsHookEx( HINSTANCE Mod, Hook->ihmod = (INT)Mod; // Module Index from atom table, Do this for now. Hook->Thread = Thread; /* Set Thread, Null is Global. */ Hook->HookId = HookId; - Hook->rpdesk = pti->rpdesk; + Hook->rpdesk = ptiHook->rpdesk; Hook->phkNext = NULL; /* Dont use as a chain! Use link lists for chaining. */ Hook->Proc = HookProc; Hook->Ansi = Ansi; - DPRINT("Set Hook Desk 0x%x DeskInfo 0x%x Handle Desk 0x%x\n",pti->rpdesk, pti->pDeskInfo,Hook->head.rpdesk); + DPRINT("Set Hook Desk 0x%x DeskInfo 0x%x Handle Desk 0x%x\n", ptiHook->rpdesk, ptiHook->pDeskInfo,Hook->head.rpdesk); if (ThreadId) /* thread-local hook */ { - InsertHeadList(&pti->aphkStart[HOOKID_TO_INDEX(HookId)], &Hook->Chain); - pti->sphkCurrent = NULL; - Hook->ptiHooked = pti; - pti->fsHooks |= HOOKID_TO_FLAG(HookId); + InsertHeadList(&ptiHook->aphkStart[HOOKID_TO_INDEX(HookId)], &Hook->Chain); + ptiHook->sphkCurrent = NULL; + Hook->ptiHooked = ptiHook; + ptiHook->fsHooks |= HOOKID_TO_FLAG(HookId); - if (pti->pClientInfo) + if (ptiHook->pClientInfo) { - if ( pti->ppi == ptiCurrent->ppi) /* gptiCurrent->ppi) */ + if ( ptiHook->ppi == pti->ppi) /* gptiCurrent->ppi) */ { _SEH2_TRY { - pti->pClientInfo->fsHooks = pti->fsHooks; - pti->pClientInfo->phkCurrent = NULL; + ptiHook->pClientInfo->fsHooks = ptiHook->fsHooks; + ptiHook->pClientInfo->phkCurrent = NULL; } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - Hit = TRUE; - } - _SEH2_END; - if (Hit) { DPRINT1("Problem writing to Local ClientInfo!\n"); } + _SEH2_END; } else { - KeAttachProcess(&pti->ppi->peProcess->Pcb); + KeAttachProcess(&ptiHook->ppi->peProcess->Pcb); _SEH2_TRY { - pti->pClientInfo->fsHooks = pti->fsHooks; - pti->pClientInfo->phkCurrent = NULL; + ptiHook->pClientInfo->fsHooks = ptiHook->fsHooks; + ptiHook->pClientInfo->phkCurrent = NULL; } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { - Hit = TRUE; + DPRINT1("Problem writing to Remote ClientInfo!\n"); } _SEH2_END; KeDetachProcess(); - if (Hit) - { - DPRINT1("Problem writing to Remote ClientInfo!\n"); - } } } } else { - InsertHeadList(&pti->rpdesk->pDeskInfo->aphkStart[HOOKID_TO_INDEX(HookId)], &Hook->Chain); + InsertHeadList(&ptiHook->rpdesk->pDeskInfo->aphkStart[HOOKID_TO_INDEX(HookId)], &Hook->Chain); Hook->ptiHooked = NULL; //gptiCurrent->pDeskInfo->fsHooks |= HOOKID_TO_FLAG(HookId); - pti->rpdesk->pDeskInfo->fsHooks |= HOOKID_TO_FLAG(HookId); - pti->sphkCurrent = NULL; - pti->pClientInfo->phkCurrent = NULL; + ptiHook->rpdesk->pDeskInfo->fsHooks |= HOOKID_TO_FLAG(HookId); + ptiHook->sphkCurrent = NULL; + ptiHook->pClientInfo->phkCurrent = NULL; } RtlInitUnicodeString(&Hook->ModuleName, NULL); diff --git a/subsystems/win32/win32k/ntuser/input.c b/subsystems/win32/win32k/ntuser/input.c index 81128b9c61e..48b06297255 100644 --- a/subsystems/win32/win32k/ntuser/input.c +++ b/subsystems/win32/win32k/ntuser/input.c @@ -18,6 +18,7 @@ extern BYTE gQueueKeyStateTable[]; extern NTSTATUS Win32kInitWin32Thread(PETHREAD Thread); +extern PPROCESSINFO ppiScrnSaver; /* GLOBALS *******************************************************************/ @@ -27,6 +28,7 @@ PTHREADINFO ptiMouse; PKTIMER MasterTimer = NULL; PATTACHINFO gpai = NULL; +static DWORD LastInputTick = 0; static HANDLE MouseDeviceHandle; static HANDLE MouseThreadHandle; static CLIENT_ID MouseThreadId; @@ -59,50 +61,52 @@ DWORD IntLastInputTick(BOOL LastInputTickSetGet); DWORD IntLastInputTick(BOOL LastInputTickSetGet) { - static DWORD LastInputTick = 0; - if (LastInputTickSetGet == TRUE) - { - LARGE_INTEGER TickCount; - KeQueryTickCount(&TickCount); - LastInputTick = TickCount.u.LowPart * (KeQueryTimeIncrement() / 10000); - } - return LastInputTick; + if (LastInputTickSetGet == TRUE) + { + LARGE_INTEGER TickCount; + KeQueryTickCount(&TickCount); + LastInputTick = MsqCalculateMessageTime(&TickCount); + if (gpsi) gpsi->dwLastRITEventTickCount = LastInputTick; + } + return LastInputTick; } -BOOL -APIENTRY -NtUserGetLastInputInfo(PLASTINPUTINFO plii) + +VOID FASTCALL DoTheScreenSaver(VOID) { - BOOL ret = TRUE; + LARGE_INTEGER TickCount; + DWORD Test, TO; - UserEnterShared(); + if (gspv.iScrSaverTimeout > 0) // Zero means Off. + { + KeQueryTickCount(&TickCount); + Test = MsqCalculateMessageTime(&TickCount); + Test = Test - LastInputTick; + TO = 1000 * gspv.iScrSaverTimeout; + if (Test > TO) + { + DPRINT("Screensaver Message Start! Tick %d Timeout %d \n", Test, gspv.iScrSaverTimeout); - _SEH2_TRY - { - if (ProbeForReadUint(&plii->cbSize) != sizeof(LASTINPUTINFO)) - { - EngSetLastError(ERROR_INVALID_PARAMETER); - ret = FALSE; - _SEH2_LEAVE; - } - - ProbeForWrite(plii, sizeof(LASTINPUTINFO), sizeof(DWORD)); - - plii->dwTime = IntLastInputTick(FALSE); - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - SetLastNtError(_SEH2_GetExceptionCode()); - ret = FALSE; - } - _SEH2_END; - - UserLeave(); - - return ret; + if (ppiScrnSaver) // We are or we are not the screensaver, prevent reentry... + { + if (!(ppiScrnSaver->W32PF_flags & W32PF_IDLESCREENSAVER)) + { + ppiScrnSaver->W32PF_flags |= W32PF_IDLESCREENSAVER; + DPRINT1("Screensaver is Idle\n"); + } + } + else + { + PUSER_MESSAGE_QUEUE ForegroundQueue = IntGetFocusMessageQueue(); + if (ForegroundQueue && ForegroundQueue->ActiveWindow) + UserPostMessage(hwndSAS, WM_LOGONNOTIFY, LN_START_SCREENSAVE, 1); // lParam 1 == Secure + else + UserPostMessage(hwndSAS, WM_LOGONNOTIFY, LN_START_SCREENSAVE, 0); + } + } + } } - VOID FASTCALL ProcessMouseInputData(PMOUSE_INPUT_DATA Data, ULONG InputCount) { @@ -482,7 +486,7 @@ static VOID APIENTRY co_IntKeyboardSendAltKeyMsg() { DPRINT1("co_IntKeyboardSendAltKeyMsg\n"); - //co_MsqPostKeyboardMessage(WM_SYSCOMMAND,SC_KEYMENU,0); // This sends everything into a msg loop! +// co_MsqPostKeyboardMessage(WM_SYSCOMMAND,SC_KEYMENU,0); // This sends everything into a msg loop! } static VOID APIENTRY diff --git a/subsystems/win32/win32k/ntuser/metric.c b/subsystems/win32/win32k/ntuser/metric.c index e8829570a16..060f0df11be 100644 --- a/subsystems/win32/win32k/ntuser/metric.c +++ b/subsystems/win32/win32k/ntuser/metric.c @@ -23,9 +23,21 @@ BOOL FASTCALL InitMetrics(VOID) { - INT *piSysMet; + INT *piSysMet = gpsi->aiSysMet; ULONG Width, Height; + /* note: used for the SM_CLEANBOOT metric */ + DWORD dwValue = 0; + HKEY hKey = 0; + + /* Clean boot */ + piSysMet[SM_CLEANBOOT] = 0; // fallback value of 0 (normal mode) + if(NT_SUCCESS(RegOpenKey(L"\\REGISTRY\\MACHINE\\SYSTEM\\CurrentControlSet\\Control\\SafeBoot\\Option", &hKey))) + { + if(RegReadDWORD(hKey, L"OptionValue", &dwValue)) piSysMet[SM_CLEANBOOT] = (INT)dwValue; + ZwClose(hKey); + } + /* FIXME: HACK, due to missing PDEV on first init */ if (!pPrimarySurface) { @@ -38,8 +50,6 @@ InitMetrics(VOID) Height = pPrimarySurface->gdiinfo.ulVertRes; } - piSysMet = gpsi->aiSysMet; - /* Screen sizes */ piSysMet[SM_CXSCREEN] = Width; piSysMet[SM_CYSCREEN] = Height; @@ -146,7 +156,6 @@ InitMetrics(VOID) piSysMet[SM_SLOWMACHINE] = 0; piSysMet[SM_SECURE] = 0; piSysMet[SM_DBCSENABLED] = 0; - piSysMet[SM_CLEANBOOT] = 0; piSysMet[SM_SHOWSOUNDS] = gspv.bShowSounds; piSysMet[SM_MIDEASTENABLED] = 0; piSysMet[SM_CMONITORS] = 1; diff --git a/subsystems/win32/win32k/ntuser/msgqueue.c b/subsystems/win32/win32k/ntuser/msgqueue.c index 78561022f9b..f7aa35318db 100644 --- a/subsystems/win32/win32k/ntuser/msgqueue.c +++ b/subsystems/win32/win32k/ntuser/msgqueue.c @@ -17,6 +17,8 @@ #define NDEBUG #include +VOID FASTCALL DoTheScreenSaver(VOID); + /* GLOBALS *******************************************************************/ static PAGED_LOOKASIDE_LIST MessageLookasideList; @@ -41,6 +43,183 @@ MsqInitializeImpl(VOID) return(STATUS_SUCCESS); } +PWND FASTCALL +IntChildrenWindowFromPoint(PWND pWndTop, INT x, INT y) +{ + PWND pWnd, pWndChild; + + if (!(pWndTop->style & WS_VISIBLE)) return NULL; + if ((pWndTop->style & WS_DISABLED)) return NULL; + if (!IntPtInWindow(pWndTop, x, y)) return NULL; + + if (x - pWndTop->rcClient.left < pWndTop->rcClient.right && + y - pWndTop->rcClient.top < pWndTop->rcClient.bottom ) + { + for (pWnd = pWndTop->spwndChild; + pWnd != NULL; + pWnd = pWnd->spwndNext) + { + if (pWnd->state2 & WNDS2_INDESTROY || pWnd->state & WNDS_DESTROYED ) + { + DPRINT("The Window is in DESTROY!\n"); + continue; + } + + pWndChild = IntChildrenWindowFromPoint(pWnd, x, y); + + if (pWndChild) + { + return pWndChild; + } + } + } + return pWndTop; +} + +PWND FASTCALL +IntTopLevelWindowFromPoint(INT x, INT y) +{ + PWND pWnd, pwndDesktop; + + /* Get the desktop window */ + pwndDesktop = UserGetDesktopWindow(); + if (!pwndDesktop) + return NULL; + + /* Loop all top level windows */ + for (pWnd = pwndDesktop->spwndChild; + pWnd != NULL; + pWnd = pWnd->spwndNext) + { + if (pWnd->state2 & WNDS2_INDESTROY || pWnd->state & WNDS_DESTROYED) + { + DPRINT("The Window is in DESTROY!\n"); + continue; + } + + if ((pWnd->style & WS_VISIBLE) && IntPtInWindow(pWnd, x, y)) + return pWnd; + } + + /* Window has not been found */ + return NULL; +} + +PCURICON_OBJECT +FASTCALL +UserSetCursor( + PCURICON_OBJECT NewCursor, + BOOL ForceChange) +{ + PCURICON_OBJECT OldCursor; + HDC hdcScreen; + PTHREADINFO pti; + PUSER_MESSAGE_QUEUE MessageQueue; + PWND pWnd; + + pti = PsGetCurrentThreadWin32Thread(); + MessageQueue = pti->MessageQueue; + + /* Get the screen DC */ + if(!(hdcScreen = IntGetScreenDC())) + { + return (HCURSOR)0; + } + + OldCursor = MessageQueue->CursorObject; + + /* Check if cursors are different */ + if (OldCursor == NewCursor) + return OldCursor; + + /* Update cursor for this message queue */ + MessageQueue->CursorObject = NewCursor; + + /* If cursor is not visible we have nothing to do */ + if (MessageQueue->ShowingCursor < 0) + return OldCursor; + + /* Update cursor if this message queue controls it */ + pWnd = IntTopLevelWindowFromPoint(gpsi->ptCursor.x, gpsi->ptCursor.y); + if (pWnd && pWnd->head.pti->MessageQueue == MessageQueue) + { + if (NewCursor) + { + /* Call GDI to set the new screen cursor */ + GreSetPointerShape(hdcScreen, + NewCursor->IconInfo.hbmMask, + NewCursor->IconInfo.hbmColor, + NewCursor->IconInfo.xHotspot, + NewCursor->IconInfo.yHotspot, + gpsi->ptCursor.x, + gpsi->ptCursor.y); + } + else /* Note: OldCursor != NewCursor so we have to hide cursor */ + { + /* Remove the cursor */ + GreMovePointer(hdcScreen, -1, -1); + DPRINT("Removing pointer!\n"); + } + IntGetSysCursorInfo()->CurrentCursorObject = NewCursor; + } + + /* Return the old cursor */ + return OldCursor; +} + +/* Called from NtUserCallOneParam with Routine ONEPARAM_ROUTINE_SHOWCURSOR + * User32 macro NtUserShowCursor */ +int UserShowCursor(BOOL bShow) +{ + HDC hdcScreen; + PTHREADINFO pti; + PUSER_MESSAGE_QUEUE MessageQueue; + PWND pWnd; + + if (!(hdcScreen = IntGetScreenDC())) + { + return -1; /* No mouse */ + } + + pti = PsGetCurrentThreadWin32Thread(); + MessageQueue = pti->MessageQueue; + + /* Update counter */ + MessageQueue->ShowingCursor += bShow ? 1 : -1; + + /* Check for trivial cases */ + if ((bShow && MessageQueue->ShowingCursor != 0) || + (!bShow && MessageQueue->ShowingCursor != -1)) + { + /* Note: w don't update global info here because it is used only + internally to check if cursor is visible */ + return MessageQueue->ShowingCursor; + } + + /* Check if cursor is above window owned by this MessageQueue */ + pWnd = IntTopLevelWindowFromPoint(gpsi->ptCursor.x, gpsi->ptCursor.y); + if (pWnd && pWnd->head.pti->MessageQueue == MessageQueue) + { + if (bShow) + { + /* Show the pointer */ + GreMovePointer(hdcScreen, gpsi->ptCursor.x, gpsi->ptCursor.y); + DPRINT("Showing pointer!\n"); + } + else + { + /* Remove the pointer */ + GreMovePointer(hdcScreen, -1, -1); + DPRINT("Removing pointer!\n"); + } + + /* Update global info */ + IntGetSysCursorInfo()->ShowingCursor = MessageQueue->ShowingCursor; + } + + return MessageQueue->ShowingCursor; +} + DWORD FASTCALL UserGetKeyState(DWORD key) { DWORD ret = 0; @@ -305,13 +484,15 @@ co_MsqInsertMouseMessage(MSG* Msg, DWORD flags, ULONG_PTR dwExtraInfo, BOOL Hook MSLLHOOKSTRUCT MouseHookData; PDESKTOP pDesk; PWND pwnd, pwndDesktop; + HDC hdcScreen; + PSYSTEM_CURSORINFO CurInfo; KeQueryTickCount(&LargeTickCount); Msg->time = MsqCalculateMessageTime(&LargeTickCount); MouseHookData.pt.x = LOWORD(Msg->lParam); MouseHookData.pt.y = HIWORD(Msg->lParam); - switch(Msg->message) + switch (Msg->message) { case WM_MOUSEWHEEL: MouseHookData.mouseData = MAKELONG(0, GET_WHEEL_DELTA_WPARAM(Msg->wParam)); @@ -342,57 +523,80 @@ co_MsqInsertMouseMessage(MSG* Msg, DWORD flags, ULONG_PTR dwExtraInfo, BOOL Hook /* Get the desktop window */ pwndDesktop = UserGetDesktopWindow(); - if(!pwndDesktop) - return; - - /* Set hit somewhere on the desktop */ + if (!pwndDesktop) return; pDesk = pwndDesktop->head.rpdesk; - pDesk->htEx = HTNOWHERE; - pDesk->spwndTrack = pwndDesktop; /* Check if the mouse is captured */ Msg->hwnd = IntGetCaptureWindow(); - if(Msg->hwnd != NULL) + if (Msg->hwnd != NULL) { pwnd = UserGetWindowObject(Msg->hwnd); - if ((pwnd->style & WS_VISIBLE) && - IntPtInWindow(pwnd, Msg->pt.x, Msg->pt.y)) - { - pDesk->htEx = HTCLIENT; - pDesk->spwndTrack = pwnd; - } } else { - /* Loop all top level windows to find which one should receive input */ - for( pwnd = pwndDesktop->spwndChild; - pwnd != NULL; - pwnd = pwnd->spwndNext ) - { - if ( pwnd->state2 & WNDS2_INDESTROY || pwnd->state & WNDS_DESTROYED ) - { - DPRINT("The Window is in DESTROY!\n"); - continue; - } - - if((pwnd->style & WS_VISIBLE) && - IntPtInWindow(pwnd, Msg->pt.x, Msg->pt.y)) - { - Msg->hwnd = pwnd->head.h; - pDesk->htEx = HTCLIENT; - pDesk->spwndTrack = pwnd; - break; - } - } + pwnd = IntTopLevelWindowFromPoint(Msg->pt.x, Msg->pt.y); + if (pwnd) Msg->hwnd = pwnd->head.h; } - /* Check if we found a window */ - if(Msg->hwnd != NULL && pwnd != NULL) + if (pwnd) { - if(Msg->message == WM_MOUSEMOVE) + PWND pwndTrack = IntChildrenWindowFromPoint(pwnd, Msg->pt.x, Msg->pt.y); + + if ( pDesk->spwndTrack != pwndTrack && pDesk->dwDTFlags & (DF_TME_LEAVE|DF_TME_HOVER) ) + { + if ( pDesk->dwDTFlags & DF_TME_LEAVE ) + UserPostMessage( UserHMGetHandle(pDesk->spwndTrack), + (pDesk->htEx != HTCLIENT) ? WM_NCMOUSELEAVE : WM_MOUSELEAVE, + 0, 0); + + if ( pDesk->dwDTFlags & DF_TME_HOVER ) + IntKillTimer(UserHMGetHandle(pDesk->spwndTrack), ID_EVENT_SYSTIMER_MOUSEHOVER, TRUE); + + pDesk->dwDTFlags &= ~(DF_TME_LEAVE|DF_TME_HOVER); + } + pDesk->spwndTrack = pwndTrack; + pDesk->htEx = GetNCHitEx(pDesk->spwndTrack, Msg->pt); + } + + hdcScreen = IntGetScreenDC(); + CurInfo = IntGetSysCursorInfo(); + + /* Check if we found a window */ + if (Msg->hwnd != NULL && pwnd != NULL) + { + if (Msg->message == WM_MOUSEMOVE) { - /* Mouse move is a special case*/ - MsqPostMouseMove(pwnd->head.pti->MessageQueue, Msg); + PUSER_MESSAGE_QUEUE MessageQueue = pwnd->head.pti->MessageQueue; + + /* Check if cursor should be visible */ + if(hdcScreen && + MessageQueue->CursorObject && + MessageQueue->ShowingCursor >= 0) + { + /* Check if shape has changed */ + if(CurInfo->CurrentCursorObject != MessageQueue->CursorObject) + { + /* Call GDI to set the new screen cursor */ + GreSetPointerShape(hdcScreen, + MessageQueue->CursorObject->IconInfo.hbmMask, + MessageQueue->CursorObject->IconInfo.hbmColor, + MessageQueue->CursorObject->IconInfo.xHotspot, + MessageQueue->CursorObject->IconInfo.yHotspot, + gpsi->ptCursor.x, + gpsi->ptCursor.y); + } else + GreMovePointer(hdcScreen, Msg->pt.x, Msg->pt.y); + } + /* Check if w have to hide cursor */ + else if (CurInfo->ShowingCursor >= 0) + GreMovePointer(hdcScreen, -1, -1); + + /* Update global cursor info */ + CurInfo->ShowingCursor = MessageQueue->ShowingCursor; + CurInfo->CurrentCursorObject = MessageQueue->CursorObject; + + /* Mouse move is a special case */ + MsqPostMouseMove(MessageQueue, Msg); } else { @@ -400,13 +604,20 @@ co_MsqInsertMouseMessage(MSG* Msg, DWORD flags, ULONG_PTR dwExtraInfo, BOOL Hook MsqPostMessage(pwnd->head.pti->MessageQueue, Msg, TRUE, QS_MOUSEBUTTON); } } + else if (hdcScreen) + { + /* always show cursor on background; FIXME: set default pointer */ + GreMovePointer(hdcScreen, Msg->pt.x, Msg->pt.y); + CurInfo->ShowingCursor = 0; + } /* Do GetMouseMovePointsEx FIFO. */ MouseHistoryOfMoves[gcur_count].x = Msg->pt.x; MouseHistoryOfMoves[gcur_count].y = Msg->pt.y; MouseHistoryOfMoves[gcur_count].time = Msg->time; MouseHistoryOfMoves[gcur_count].dwExtraInfo = dwExtraInfo; - if (gcur_count++ == 64) gcur_count = 0; // 0 - 63 is 64, FIFO forwards. + if (++gcur_count == ARRAYSIZE(MouseHistoryOfMoves)) + gcur_count = 0; // 0 - 63 is 64, FIFO forwards. } // @@ -1581,7 +1792,7 @@ VOID CALLBACK HungAppSysTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) { - //DoTheScreenSaver(); + DoTheScreenSaver(); DPRINT("HungAppSysTimerProc\n"); // Process list of windows that are hung and waiting. } @@ -1599,13 +1810,14 @@ MsqInitializeMessageQueue(struct _ETHREAD *Thread, PUSER_MESSAGE_QUEUE MessageQu InitializeListHead(&MessageQueue->HardwareMessagesListHead); InitializeListHead(&MessageQueue->DispatchingMessagesHead); InitializeListHead(&MessageQueue->LocalDispatchingMessagesHead); - KeInitializeMutex(&MessageQueue->HardwareLock, 0); MessageQueue->QuitPosted = FALSE; MessageQueue->QuitExitCode = 0; KeQueryTickCount(&LargeTickCount); MessageQueue->LastMsgRead = LargeTickCount.u.LowPart; MessageQueue->FocusWindow = NULL; MessageQueue->NewMessagesHandle = NULL; + MessageQueue->ShowingCursor = 0; + MessageQueue->CursorObject = NULL; Status = ZwCreateEvent(&MessageQueue->NewMessagesHandle, EVENT_ALL_ACCESS, NULL, SynchronizationEvent, FALSE); @@ -1761,6 +1973,18 @@ MsqCleanupMessageQueue(PUSER_MESSAGE_QUEUE MessageQueue) MessageQueue->nCntsQBits[QSRosPostMessage] = 0; MessageQueue->nCntsQBits[QSRosSendMessage] = 0; MessageQueue->nCntsQBits[QSRosHotKey] = 0; + + if (MessageQueue->CursorObject) + { + PCURICON_OBJECT pCursor = MessageQueue->CursorObject; + + /* Change to another cursor if we going to dereference current one */ + if (IntGetSysCursorInfo()->CurrentCursorObject == pCursor) + UserSetCursor(NULL, TRUE); + + UserDereferenceObject(pCursor); + } + } PUSER_MESSAGE_QUEUE FASTCALL @@ -1987,5 +2211,4 @@ NtUserSetKeyboardState(LPBYTE lpKeyState) return ret; } - /* EOF */ diff --git a/subsystems/win32/win32k/ntuser/object.c b/subsystems/win32/win32k/ntuser/object.c index 142f5600d9a..22fd92a6893 100644 --- a/subsystems/win32/win32k/ntuser/object.c +++ b/subsystems/win32/win32k/ntuser/object.c @@ -261,31 +261,7 @@ void *get_user_object_handle(PUSER_HANDLE_TABLE ht, HANDLE* handle, USER_OBJECT return entry->ptr; } -/* return the next user handle after 'handle' that is of a given type */ -PVOID UserGetNextHandle(PUSER_HANDLE_TABLE ht, HANDLE* handle, USER_OBJECT_TYPE type ) -{ - PUSER_HANDLE_ENTRY entry; - if (!*handle) - entry = ht->handles; - else - { - int index = (((unsigned int)*handle & 0xffff) - FIRST_USER_HANDLE) >> 1; - if (index < 0 || index >= ht->nb_handles) - return NULL; - entry = ht->handles + index + 1; /* start from the next one */ - } - while (entry < ht->handles + ht->nb_handles) - { - if (!type || entry->type == type) - { - *handle = entry_to_handle(ht, entry ); - return entry->ptr; - } - entry++; - } - return NULL; -} BOOL FASTCALL UserCreateHandleTable(VOID) { @@ -383,7 +359,7 @@ UserCreateObject( PUSER_HANDLE_TABLE ht, case otMenu: case otCallProc: ((PPROCDESKHEAD)Object)->rpdesk = rpdesk; - ((PPROCDESKHEAD)Object)->pSelf = Object; + ((PPROCDESKHEAD)Object)->pSelf = Object; break; case otCursorIcon: @@ -469,7 +445,7 @@ FASTCALL UserDeleteObject(HANDLE h, USER_OBJECT_TYPE type ) { PVOID body = UserGetObject(gHandleTable, h, type); - + if (!body) return FALSE; ASSERT( ((PHEAD)body)->cLockObj >= 1); diff --git a/subsystems/win32/win32k/ntuser/painting.c b/subsystems/win32/win32k/ntuser/painting.c index fcea7dc0043..1e66ce50ce3 100644 --- a/subsystems/win32/win32k/ntuser/painting.c +++ b/subsystems/win32/win32k/ntuser/painting.c @@ -1579,110 +1579,78 @@ CLEANUP: END_CLEANUP; } - -BOOL -UserDrawSysMenuButton( - PWND pWnd, - HDC hDc, - RECTL *lpRc, - BOOL Down) -{ - HICON hIcon; - PCURICON_OBJECT pIcon; - - ASSERT(pWnd && lpRc); - - /* Get the icon to draw. We don't care about WM_GETICON here. */ - - hIcon = pWnd->pcls->hIconSm; - - if(!hIcon) - { - DPRINT("Wnd class has no small icon.\n"); - hIcon = pWnd->pcls->hIcon; - } - - if(!hIcon) - { - DPRINT("Wnd class hasn't any icon.\n"); - //FIXME: Draw "winlogo" icon. - return FALSE; - } - - if(!(pIcon = UserGetCurIconObject(hIcon))) - { - DPRINT1("UserGetCurIconObject() failed!\n"); - return FALSE; - } - - return UserDrawIconEx(hDc, lpRc->left, lpRc->top, pIcon, - UserGetSystemMetrics(SM_CXSMICON), - UserGetSystemMetrics(SM_CYSMICON), - 0, NULL, DI_NORMAL); -} - BOOL UserDrawCaptionText( HDC hDc, const PUNICODE_STRING Text, const RECTL *lpRc, - UINT uFlags) + UINT uFlags, + HFONT hFont) { - HFONT hOldFont = NULL, hFont = NULL; + HFONT hOldFont = NULL; COLORREF OldTextColor; NONCLIENTMETRICSW nclm; NTSTATUS Status; - #ifndef NDEBUG + BOOLEAN bDeleteFont = FALSE; + SIZE Size; +#ifndef NDEBUG INT i; - DPRINT("%s:", __FUNCTION__); + DPRINT(""); // print filename and line no. for(i = 0; i < Text->Length/sizeof(WCHAR); i++) DbgPrint("%C", Text->Buffer[i]); DbgPrint(", %d\n", Text->Length/sizeof(WCHAR)); - #endif +#endif nclm.cbSize = sizeof(nclm); if(!UserSystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &nclm, 0)) { - DPRINT1("%s: UserSystemParametersInfo() failed!\n", __FUNCTION__); + DPRINT1("UserSystemParametersInfo() failed!\n"); return FALSE; } + if (!hFont) + { + if(uFlags & DC_SMALLCAP) + Status = TextIntCreateFontIndirect(&nclm.lfSmCaptionFont, &hFont); + else + Status = TextIntCreateFontIndirect(&nclm.lfCaptionFont, &hFont); + + if(!NT_SUCCESS(Status)) + { + DPRINT1("TextIntCreateFontIndirect() failed! Status: 0x%x\n", Status); + return FALSE; + } + + bDeleteFont = TRUE; + } + IntGdiSetBkMode(hDc, TRANSPARENT); - if(uFlags & DC_SMALLCAP) - Status = TextIntCreateFontIndirect(&nclm.lfSmCaptionFont, &hFont); - else Status = TextIntCreateFontIndirect(&nclm.lfCaptionFont, &hFont); - - if(!NT_SUCCESS(Status)) - { - DPRINT1("%s: TextIntCreateFontIndirect() failed! Status: 0x%x\n", - __FUNCTION__, Status); - return FALSE; - } - hOldFont = NtGdiSelectFont(hDc, hFont); if(!hOldFont) { - DPRINT1("%s: SelectFont() failed!\n", __FUNCTION__); - GreDeleteObject(hFont); - return FALSE; + DPRINT1("SelectFont() failed!\n"); + /* Don't fail */ } if(uFlags & DC_INBUTTON) OldTextColor = IntGdiSetTextColor(hDc, IntGetSysColor(COLOR_BTNTEXT)); - else OldTextColor = IntGdiSetTextColor(hDc, IntGetSysColor(uFlags & DC_ACTIVE + else + OldTextColor = IntGdiSetTextColor(hDc, IntGetSysColor(uFlags & DC_ACTIVE ? COLOR_CAPTIONTEXT : COLOR_INACTIVECAPTIONTEXT)); //FIXME: If string doesn't fit to rc, truncate it and add ellipsis. - - GreExtTextOutW(hDc, lpRc->left, - lpRc->top, 0, NULL, Text->Buffer, - Text->Length/sizeof(WCHAR), NULL, 0); + GreGetTextExtentW(hDc, Text->Buffer, Text->Length/sizeof(WCHAR), &Size, 0); + GreExtTextOutW(hDc, + lpRc->left, (lpRc->top + lpRc->bottom)/2 - Size.cy/2, + 0, NULL, Text->Buffer, Text->Length/sizeof(WCHAR), NULL, 0); IntGdiSetTextColor(hDc, OldTextColor); - NtGdiSelectFont(hDc, hOldFont); - GreDeleteObject(hFont); + if (hOldFont) + NtGdiSelectFont(hDc, hOldFont); + if (bDeleteFont) + GreDeleteObject(hFont); return TRUE; } @@ -1693,51 +1661,17 @@ BOOL UserDrawCaption( RECTL *lpRc, HFONT hFont, HICON hIcon, - const PUNICODE_STRING str, + const PUNICODE_STRING Str, UINT uFlags) { BOOL Ret = FALSE; - HBITMAP hMemBmp = NULL, hOldBmp = NULL; - HBRUSH hOldBrush = NULL; - HDC hMemDc = NULL; - ULONG Height; - UINT VCenter = 0, Padding = 0; - RECTL r = *lpRc; - LONG ButtonWidth, IconWidth; + HBRUSH hBgBrush, hOldBrush = NULL; + RECTL Rect = *lpRc; BOOL HasIcon; - //ASSERT(pWnd != NULL); - RECTL_vMakeWellOrdered(lpRc); - hMemBmp = NtGdiCreateCompatibleBitmap(hDc, - lpRc->right - lpRc->left, - lpRc->bottom - lpRc->top); - if(!hMemBmp) - { - DPRINT1("%s: NtGdiCreateCompatibleBitmap() failed!\n", __FUNCTION__); - return FALSE; - } - - hMemDc = NtGdiCreateCompatibleDC(hDc); - if(!hMemDc) - { - DPRINT1("%s: NtGdiCreateCompatibleDC() failed!\n", __FUNCTION__); - goto cleanup; - } - - hOldBmp = NtGdiSelectBitmap(hMemDc, hMemBmp); - if(!hOldBmp) - { - DPRINT1("%s: NtGdiSelectBitmap() failed!\n", __FUNCTION__); - goto cleanup; - } - - Height = UserGetSystemMetrics(SM_CYCAPTION) - 1; - VCenter = (lpRc->bottom - lpRc->top) / 2; - Padding = VCenter - (Height / 2); - - if ((!hIcon) && (pWnd != NULL)) + if (!hIcon && pWnd != NULL) { HasIcon = (uFlags & DC_ICON) && (pWnd->style & WS_SYSMENU) && !(uFlags & DC_SMALLCAP) && !(pWnd->ExStyle & WS_EX_DLGMODALFRAME) @@ -1746,203 +1680,114 @@ BOOL UserDrawCaption( else HasIcon = (hIcon != 0); - IconWidth = UserGetSystemMetrics(SM_CXSIZE) + Padding; - - r.left = Padding; - r.right = r.left + (lpRc->right - lpRc->left); - r.top = Padding; - r.bottom = r.top + (Height / 2); - // Draw the caption background - if(uFlags & DC_INBUTTON) + if((uFlags & DC_GRADIENT) && !(uFlags & DC_INBUTTON)) { - hOldBrush = NtGdiSelectBrush(hMemDc, - IntGetSysColorBrush(COLOR_3DFACE)); + static GRADIENT_RECT gcap = {0, 1}; + TRIVERTEX Vertices[2]; + COLORREF Colors[2]; - if(!hOldBrush) + Colors[0] = IntGetSysColor((uFlags & DC_ACTIVE) ? + COLOR_ACTIVECAPTION : COLOR_INACTIVECAPTION); + + Colors[1] = IntGetSysColor((uFlags & DC_ACTIVE) ? + COLOR_GRADIENTACTIVECAPTION : COLOR_GRADIENTINACTIVECAPTION); + + Vertices[0].x = Rect.left; + Vertices[0].y = Rect.top; + Vertices[0].Red = (WORD)Colors[0]<<8; + Vertices[0].Green = (WORD)Colors[0] & 0xFF00; + Vertices[0].Blue = (WORD)(Colors[0]>>8) & 0xFF00; + Vertices[0].Alpha = 0; + + Vertices[1].x = Rect.right; + Vertices[1].y = Rect.bottom; + Vertices[1].Red = (WORD)Colors[1]<<8; + Vertices[1].Green = (WORD)Colors[1] & 0xFF00; + Vertices[1].Blue = (WORD)(Colors[1]>>8) & 0xFF00; + Vertices[1].Alpha = 0; + + if(!GreGradientFill(hDc, Vertices, 2, &gcap, 1, GRADIENT_FILL_RECT_H)) { - DPRINT1("%s: NtGdiSelectBrush() failed!\n", __FUNCTION__); + DPRINT1("GreGradientFill() failed!\n"); goto cleanup; } - - if(!NtGdiPatBlt(hMemDc, 0, 0, - lpRc->right - lpRc->left, - lpRc->bottom - lpRc->top, - PATCOPY)) - { - DPRINT1("%s: NtGdiPatBlt() failed!\n", __FUNCTION__); - goto cleanup; - } - - if(HasIcon) r.left+=IconWidth; } else { - r.right = (lpRc->right - lpRc->left); - if(uFlags & DC_SMALLCAP) - ButtonWidth = UserGetSystemMetrics(SM_CXSMSIZE) - 2; - else ButtonWidth = UserGetSystemMetrics(SM_CXSIZE) - 2; + if(uFlags & DC_INBUTTON) + hBgBrush = IntGetSysColorBrush(COLOR_3DFACE); + else if(uFlags & DC_ACTIVE) + hBgBrush = IntGetSysColorBrush(COLOR_ACTIVECAPTION); + else + hBgBrush = IntGetSysColorBrush(COLOR_INACTIVECAPTION); - hOldBrush = NtGdiSelectBrush(hMemDc, - IntGetSysColorBrush(uFlags & DC_ACTIVE ? - COLOR_ACTIVECAPTION : COLOR_INACTIVECAPTION)); + hOldBrush = NtGdiSelectBrush(hDc, hBgBrush); if(!hOldBrush) { - DPRINT1("%s: NtGdiSelectBrush() failed!\n", __FUNCTION__); + DPRINT1("NtGdiSelectBrush() failed!\n"); goto cleanup; } - if(HasIcon && (uFlags & DC_GRADIENT)) + if(!NtGdiPatBlt(hDc, Rect.left, Rect.top, + Rect.right - Rect.left, + Rect.bottom - Rect.top, + PATCOPY)) { - NtGdiPatBlt(hMemDc, 0, 0, - IconWidth+1, - lpRc->bottom - lpRc->top, - PATCOPY); - r.left+=IconWidth; + DPRINT1("NtGdiPatBlt() failed!\n"); + goto cleanup; } - else - { - NtGdiPatBlt(hMemDc, 0, 0, - lpRc->right - lpRc->left, - lpRc->bottom - lpRc->top, - PATCOPY); - } - - if(uFlags & DC_GRADIENT) - { - static GRADIENT_RECT gcap = {0, 1}; - TRIVERTEX vert[2]; - COLORREF Colors[2]; - - if (pWnd != NULL) - { - if(pWnd->style & WS_SYSMENU) - { - r.right -= 3 + ButtonWidth; - if(!(uFlags & DC_SMALLCAP)) - { - if(pWnd->style & (WS_MAXIMIZEBOX | WS_MINIMIZEBOX)) - r.right -= 2 + 2 * ButtonWidth; - else r.right -= 2; - r.right -= 2; - } - - //Draw buttons background - if(!NtGdiSelectBrush(hMemDc, - IntGetSysColorBrush(uFlags & DC_ACTIVE ? - COLOR_GRADIENTACTIVECAPTION:COLOR_GRADIENTINACTIVECAPTION))) - { - DPRINT1("%s: NtGdiSelectBrush() failed!\n", __FUNCTION__); - goto cleanup; - } - - NtGdiPatBlt(hMemDc, - r.right, - 0, - lpRc->right - lpRc->left - r.right, - lpRc->bottom - lpRc->top, - PATCOPY); - } - } - - Colors[0] = IntGetSysColor((uFlags & DC_ACTIVE) ? - COLOR_ACTIVECAPTION : COLOR_INACTIVECAPTION); - - Colors[1] = IntGetSysColor((uFlags & DC_ACTIVE) ? - COLOR_GRADIENTACTIVECAPTION : COLOR_GRADIENTINACTIVECAPTION); - - vert[0].x = r.left; - vert[0].y = 0; - vert[0].Red = (WORD)Colors[0]<<8; - vert[0].Green = (WORD)Colors[0] & 0xFF00; - vert[0].Blue = (WORD)(Colors[0]>>8) & 0xFF00; - vert[0].Alpha = 0; - - vert[1].x = r.right; - vert[1].y = lpRc->bottom - lpRc->top; - vert[1].Red = (WORD)Colors[1]<<8; - vert[1].Green = (WORD)Colors[1] & 0xFF00; - vert[1].Blue = (WORD)(Colors[1]>>8) & 0xFF00; - vert[1].Alpha = 0; - - if(!GreGradientFill(hMemDc, vert, 2, &gcap, - 1, GRADIENT_FILL_RECT_H)) - { - DPRINT1("%s: IntGdiGradientFill() failed!\n", __FUNCTION__); - } - - } //if(uFlags & DC_GRADIENT) } - if(HasIcon) + /* Draw icon */ + if (HasIcon) { - r.top ++; - r.left -= --IconWidth; - /* FIXME: Draw the Icon when pWnd == NULL but hIcon is valid */ - if (pWnd != NULL) - UserDrawSysMenuButton(pWnd, hMemDc, &r, FALSE); + PCURICON_OBJECT pIcon = NULL; - r.left += IconWidth; - r.top --; + if (!hIcon && pWnd) + { + hIcon = pWnd->pcls->hIconSm; // FIXME: Windows does not do that + if(!hIcon) + hIcon = pWnd->pcls->hIcon; + } + + if (hIcon) + pIcon = UserGetCurIconObject(hIcon); + + if (pIcon) + { + LONG cx = UserGetSystemMetrics(SM_CXSMICON); + LONG cy = UserGetSystemMetrics(SM_CYSMICON); + LONG x = Rect.left - cx/2 + 1 + (Rect.bottom - Rect.top)/2; // this is really what Window does + LONG y = (Rect.top + Rect.bottom)/2 - cy/2; // center + UserDrawIconEx(hDc, x, y, pIcon, cx, cy, 0, NULL, DI_NORMAL); + } } - r.top ++; - r.left += 2; - - r.bottom = r.top + Height; + if (hIcon) + Rect.left += Rect.bottom - Rect.top; if((uFlags & DC_TEXT)) { - if(!(uFlags & DC_GRADIENT)) - { - r.right = (lpRc->right - lpRc->left); + Rect.left += 2; - if(uFlags & DC_SMALLCAP) - ButtonWidth = UserGetSystemMetrics(SM_CXSMSIZE) - 2; - else ButtonWidth = UserGetSystemMetrics(SM_CXSIZE) - 2; - - if ((pWnd != NULL) && (pWnd->style & WS_SYSMENU)) - { - r.right -= 3 + ButtonWidth; - if(! (uFlags & DC_SMALLCAP)) - { - if(pWnd->style & (WS_MAXIMIZEBOX | WS_MINIMIZEBOX)) - r.right -= 2 + 2 * ButtonWidth; - else r.right -= 2; - r.right -= 2; - } - } - } - - /* FIXME: hFont isn't handled */ - if (str) - UserDrawCaptionText(hMemDc, str, &r, uFlags); - else if (pWnd != NULL) + if (Str) + UserDrawCaptionText(hDc, Str, &Rect, uFlags, hFont); + else if (pWnd != NULL) // FIXME: Windows does not do that { UNICODE_STRING ustr; ustr.Buffer = pWnd->strName.Buffer; ustr.Length = pWnd->strName.Length; ustr.MaximumLength = pWnd->strName.MaximumLength; - UserDrawCaptionText(hMemDc, &ustr, &r, uFlags); + UserDrawCaptionText(hDc, &ustr, &Rect, uFlags, hFont); } } - if(!NtGdiBitBlt(hDc, lpRc->left, lpRc->top, - lpRc->right - lpRc->left, lpRc->bottom - lpRc->top, - hMemDc, 0, 0, SRCCOPY, 0, 0)) - { - DPRINT1("%s: NtGdiBitBlt() failed!\n", __FUNCTION__); - goto cleanup; - } - Ret = TRUE; cleanup: - if (hOldBrush) NtGdiSelectBrush(hMemDc, hOldBrush); - if (hOldBmp) NtGdiSelectBitmap(hMemDc, hOldBmp); - if (hMemBmp) GreDeleteObject(hMemBmp); - if (hMemDc) NtGdiDeleteObjectApp(hMemDc); + if (hOldBrush) NtGdiSelectBrush(hDc, hOldBrush); return Ret; } diff --git a/subsystems/win32/win32k/ntuser/sysparams.c b/subsystems/win32/win32k/ntuser/sysparams.c index c1ac0effdda..440abb29162 100644 --- a/subsystems/win32/win32k/ntuser/sysparams.c +++ b/subsystems/win32/win32k/ntuser/sysparams.c @@ -59,6 +59,7 @@ static const WCHAR* VAL_HOVERHEIGHT = L"MouseHoverHeight"; static const WCHAR* KEY_DESKTOP = L"Control Panel\\Desktop"; static const WCHAR* VAL_SCRTO = L"ScreenSaveTimeOut"; +static const WCHAR* VAL_SCRNSV = L"SCRNSAVE.EXE"; static const WCHAR* VAL_SCRACT = L"ScreenSaveActive"; static const WCHAR* VAL_GRID = L"GridGranularity"; static const WCHAR* VAL_DRAG = L"DragFullWindows"; @@ -136,6 +137,20 @@ SpiLoadUserPrefMask(DWORD dValue) return Result; } +static +DWORD +SpiLoadTimeOut(VOID) +{ // Must have the string! + WCHAR szApplicationName[MAX_PATH]; + RtlZeroMemory(&szApplicationName, sizeof(szApplicationName)); + if (!RegReadUserSetting(KEY_DESKTOP, VAL_SCRNSV, REG_SZ, &szApplicationName, sizeof(szApplicationName))) + { + return 0; + } + if (wcslen(szApplicationName) == 0) return 0; + return SpiLoadInt(KEY_DESKTOP, VAL_SCRTO, 0); +} + static INT SpiLoadMouse(PCWSTR pwszValue, INT iValue) @@ -280,7 +295,7 @@ SpiUpdatePerUserSystemParameters() gspv.bDropShadow = 1; gspv.dwMenuShowDelay = 100; - gspv.iScrSaverTimeout = 10; + gspv.iScrSaverTimeout = SpiLoadTimeOut(); gspv.bScrSaverActive = FALSE; gspv.bScrSaverRunning = FALSE; #if(WINVER >= 0x0600) diff --git a/subsystems/win32/win32k/ntuser/vis.c b/subsystems/win32/win32k/ntuser/vis.c index 78939bd4025..71ebbf94033 100644 --- a/subsystems/win32/win32k/ntuser/vis.c +++ b/subsystems/win32/win32k/ntuser/vis.c @@ -156,12 +156,12 @@ co_VIS_WindowLayoutChanged( ASSERT_REFS_CO(Wnd); - Temp = IntSysCreateRectRgn(0, 0, 0, 0); - NtGdiCombineRgn(Temp, NewlyExposed, NULL, RGN_COPY); - Parent = Wnd->spwndParent; if(Parent) { + Temp = IntSysCreateRectRgn(0, 0, 0, 0); + + NtGdiCombineRgn(Temp, NewlyExposed, NULL, RGN_COPY); NtGdiOffsetRgn(Temp, Wnd->rcWindow.left - Parent->rcClient.left, Wnd->rcWindow.top - Parent->rcClient.top); @@ -171,8 +171,9 @@ co_VIS_WindowLayoutChanged( RDW_FRAME | RDW_ERASE | RDW_INVALIDATE | RDW_ALLCHILDREN); UserDerefObjectCo(Parent); + + GreDeleteObject(Temp); } - GreDeleteObject(Temp); } /* EOF */ diff --git a/subsystems/win32/win32k/ntuser/winpos.c b/subsystems/win32/win32k/ntuser/winpos.c index 98502e08935..eff6d368886 100644 --- a/subsystems/win32/win32k/ntuser/winpos.c +++ b/subsystems/win32/win32k/ntuser/winpos.c @@ -982,7 +982,6 @@ co_WinPosSetWindowPos( int RgnType; HDC Dc; RECTL CopyRect; - RECTL TempRect; PWND Ancestor; ASSERT_REFS_CO(Window); @@ -1008,13 +1007,6 @@ co_WinPosSetWindowPos( co_WinPosDoWinPosChanging(Window, &WinPos, &NewWindowRect, &NewClientRect); - /* Fix up the flags. */ - if (!WinPosFixupFlags(&WinPos, Window)) - { - EngSetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } - /* Does the window still exist? */ if (!IntIsWindow(WinPos.hwnd)) { @@ -1022,6 +1014,13 @@ co_WinPosSetWindowPos( return FALSE; } + /* Fix up the flags. */ + if (!WinPosFixupFlags(&WinPos, Window)) + { + EngSetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + Ancestor = UserGetAncestor(Window, GA_PARENT); if ( (WinPos.flags & (SWP_NOZORDER | SWP_HIDEWINDOW | SWP_SHOWWINDOW)) != SWP_NOZORDER && @@ -1033,17 +1032,18 @@ co_WinPosSetWindowPos( if (!(WinPos.flags & SWP_NOREDRAW)) { /* Compute the visible region before the window position is changed */ - if (!(WinPos.flags & (SWP_NOREDRAW | SWP_SHOWWINDOW)) && + if (!(WinPos.flags & SWP_SHOWWINDOW) && (WinPos.flags & (SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_HIDEWINDOW | SWP_FRAMECHANGED)) != (SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER)) { - VisBefore = VIS_ComputeVisibleRegion(Window, FALSE, FALSE, TRUE); + VisBefore = VIS_ComputeVisibleRegion(Window, FALSE, FALSE, + (Window->style & WS_CLIPSIBLINGS) ? TRUE : FALSE); VisRgn = NULL; if ( VisBefore != NULL && (VisRgn = (PROSRGNDATA)RGNOBJAPI_Lock(VisBefore, NULL)) && - REGION_GetRgnBox(VisRgn, &TempRect) == NULLREGION ) + REGION_Complexity(VisRgn) == NULLREGION ) { RGNOBJAPI_Unlock(VisRgn); GreDeleteObject(VisBefore); @@ -1084,8 +1084,8 @@ co_WinPosSetWindowPos( /* FIXME: Actually do something with WVR_VALIDRECTS */ - if ( NewClientRect.left != OldClientRect.left || - NewClientRect.top != OldClientRect.top) + if (NewClientRect.left != OldClientRect.left || + NewClientRect.top != OldClientRect.top) { WinPosInternalMoveWindow(Window, NewClientRect.left - OldClientRect.left, @@ -1095,7 +1095,7 @@ co_WinPosSetWindowPos( Window->rcWindow = NewWindowRect; Window->rcClient = NewClientRect; - if (!(WinPos.flags & SWP_SHOWWINDOW) && (WinPos.flags & SWP_HIDEWINDOW)) + if (WinPos.flags & SWP_HIDEWINDOW) { /* Clear the update region */ co_UserRedrawWindow( Window, @@ -1103,20 +1103,16 @@ co_WinPosSetWindowPos( 0, RDW_VALIDATE | RDW_NOFRAME | RDW_NOERASE | RDW_NOINTERNALPAINT | RDW_ALLCHILDREN); - if ((Window->style & WS_VISIBLE) && - Window->spwndParent == UserGetDesktopWindow()) - { + if (Window->spwndParent == UserGetDesktopWindow()) co_IntShellHookNotify(HSHELL_WINDOWDESTROYED, (LPARAM)Window->head.h); - } + Window->style &= ~WS_VISIBLE; } else if (WinPos.flags & SWP_SHOWWINDOW) { - if (!(Window->style & WS_VISIBLE) && - Window->spwndParent == UserGetDesktopWindow() ) - { + if (Window->spwndParent == UserGetDesktopWindow()) co_IntShellHookNotify(HSHELL_WINDOWCREATED, (LPARAM)Window->head.h); - } + Window->style |= WS_VISIBLE; } @@ -1132,12 +1128,13 @@ co_WinPosSetWindowPos( if (!(WinPos.flags & SWP_NOREDRAW)) { /* Determine the new visible region */ - VisAfter = VIS_ComputeVisibleRegion(Window, FALSE, FALSE, TRUE); + VisAfter = VIS_ComputeVisibleRegion(Window, FALSE, FALSE, + (Window->style & WS_CLIPSIBLINGS) ? TRUE : FALSE); VisRgn = NULL; if ( VisAfter != NULL && (VisRgn = (PROSRGNDATA)RGNOBJAPI_Lock(VisAfter, NULL)) && - REGION_GetRgnBox(VisRgn, &TempRect) == NULLREGION ) + REGION_Complexity(VisRgn) == NULLREGION ) { RGNOBJAPI_Unlock(VisRgn); GreDeleteObject(VisAfter); @@ -1311,15 +1308,13 @@ co_WinPosSetWindowPos( if (VisBefore != NULL) { ExposedRgn = IntSysCreateRectRgn(0, 0, 0, 0); - NtGdiCombineRgn(ExposedRgn, VisBefore, NULL, RGN_COPY); + RgnType = NtGdiCombineRgn(ExposedRgn, VisBefore, NULL, RGN_COPY); NtGdiOffsetRgn( ExposedRgn, OldWindowRect.left - NewWindowRect.left, OldWindowRect.top - NewWindowRect.top); if (VisAfter != NULL) RgnType = NtGdiCombineRgn(ExposedRgn, ExposedRgn, VisAfter, RGN_DIFF); - else - RgnType = SIMPLEREGION; if (RgnType != ERROR && RgnType != NULLREGION) { @@ -1367,6 +1362,17 @@ co_WinPosSetWindowPos( IntNotifyWinEvent(EVENT_OBJECT_LOCATIONCHANGE, pWnd, OBJID_WINDOW, CHILDID_SELF, WEF_SETBYWNDPTI); } + if(IntPtInWindow(Window, gpsi->ptCursor.x, gpsi->ptCursor.y)) + { + /* Generate mouse move message */ + MSG msg; + msg.message = WM_MOUSEMOVE; + msg.wParam = IntGetSysCursorInfo()->ButtonsDown; + msg.lParam = MAKELPARAM(gpsi->ptCursor.x, gpsi->ptCursor.y); + msg.pt = gpsi->ptCursor; + co_MsqInsertMouseMessage(&msg, 0, 0, TRUE); + } + return TRUE; } @@ -1624,6 +1630,7 @@ co_WinPosSearchChildren( if(pwndChild != NULL) { /* We found a window. Don't send any more WM_NCHITTEST messages */ + ExFreePool(List); UserDereferenceObject(ScopeWin); return pwndChild; } diff --git a/subsystems/win32/win32k/ntuser/winsta.c b/subsystems/win32/win32k/ntuser/winsta.c index 10150292b73..4f835f4e054 100644 --- a/subsystems/win32/win32k/ntuser/winsta.c +++ b/subsystems/win32/win32k/ntuser/winsta.c @@ -187,19 +187,20 @@ IntWinStaObjectParse(PWIN32_PARSEMETHOD_PARAMETERS Parameters) return STATUS_OBJECT_TYPE_MISMATCH; } -NTSTATUS NTAPI +NTSTATUS +NTAPI IntWinstaOkToClose(PWIN32_OKAYTOCLOSEMETHOD_PARAMETERS Parameters) { PPROCESSINFO ppi; ppi = PsGetCurrentProcessWin32Process(); - if(Parameters->Handle == ppi->hwinsta) + if(ppi && (Parameters->Handle == ppi->hwinsta)) { - return FALSE; + return STATUS_ACCESS_DENIED; } - return TRUE; + return STATUS_SUCCESS; } /* PRIVATE FUNCTIONS **********************************************************/ @@ -974,7 +975,7 @@ UserSetProcessWindowStation(HWINSTA hWindowStation) /* * FIXME - don't allow changing the window station if there are threads that are attached to desktops and own gui objects */ - + PsSetProcessWindowStation(ppi->peProcess, hWindowStation); ppi->prpwinsta = NewWinSta; diff --git a/subsystems/win32/win32k/objects/bitblt.c b/subsystems/win32/win32k/objects/bitblt.c index 27444939482..9be4017f917 100644 --- a/subsystems/win32/win32k/objects/bitblt.c +++ b/subsystems/win32/win32k/objects/bitblt.c @@ -903,6 +903,7 @@ NtGdiPatBlt( if (dc->dctype == DC_TYPE_INFO) { DC_UnlockDc(dc); + DPRINT1("NtGdiPatBlt on info DC!\n"); /* Yes, Windows really returns TRUE in this case */ return TRUE; } diff --git a/subsystems/win32/win32k/objects/dibobj.c b/subsystems/win32/win32k/objects/dibobj.c index fdc8f92b416..71d9c611a5c 100644 --- a/subsystems/win32/win32k/objects/dibobj.c +++ b/subsystems/win32/win32k/objects/dibobj.c @@ -321,71 +321,6 @@ cleanup: return result; } -// FIXME by Removing NtGdiSetDIBits!!! -// This is a victim of the Win32k Initialization BUG!!!!! -// Converts a DIB to a device-dependent bitmap -INT -APIENTRY -NtGdiSetDIBits( - HDC hDC, - HBITMAP hBitmap, - UINT StartScan, - UINT ScanLines, - CONST VOID *Bits, - CONST BITMAPINFO *bmi, - UINT ColorUse) -{ - PDC Dc = NULL; - INT Ret; - NTSTATUS Status = STATUS_SUCCESS; - - if (!Bits) return 0; - - _SEH2_TRY - { - ProbeForRead(&bmi->bmiHeader.biSize, sizeof(DWORD), 1); - ProbeForRead(bmi, bmi->bmiHeader.biSize, 1); - ProbeForRead(bmi, DIB_BitmapInfoSize(bmi, ColorUse), 1); - ProbeForRead(Bits, - DIB_GetDIBImageBytes(bmi->bmiHeader.biWidth, - ScanLines, - bmi->bmiHeader.biBitCount), - 1); - } - _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) - { - Status = _SEH2_GetExceptionCode(); - } - _SEH2_END - - if (!NT_SUCCESS(Status)) - { - return 0; - } - - /* Lock DC if asked to */ - if(ColorUse == DIB_PAL_COLORS) - { - Dc = DC_LockDc(hDC); - if (NULL == Dc) - { - EngSetLastError(ERROR_INVALID_HANDLE); - return 0; - } - if (Dc->dctype == DC_TYPE_INFO) - { - DC_UnlockDc(Dc); - return 0; - } - } - - Ret = IntSetDIBits(Dc, hBitmap, StartScan, ScanLines, Bits, bmi, ColorUse); - - if(Dc) DC_UnlockDc(Dc); - - return Ret; -} - W32KAPI INT APIENTRY diff --git a/subsystems/win32/win32k/objects/freetype.c b/subsystems/win32/win32k/objects/freetype.c index 2315b9058cc..1c3a9259582 100644 --- a/subsystems/win32/win32k/objects/freetype.c +++ b/subsystems/win32/win32k/objects/freetype.c @@ -2165,8 +2165,8 @@ TextIntGetTextExtentPoint(PDC dc, error = FT_Set_Pixel_Sizes(face, TextObj->logfont.elfEnumLogfontEx.elfLogFont.lfWidth, /* FIXME should set character height if neg */ - (TextObj->logfont.elfEnumLogfontEx.elfLogFont.lfHeight == 0 ? - dc->ppdev->devinfo.lfDefaultFont.lfHeight : abs(TextObj->logfont.elfEnumLogfontEx.elfLogFont.lfHeight))); + (TextObj->logfont.elfEnumLogfontEx.elfLogFont.lfHeight == 0 ? + dc->ppdev->devinfo.lfDefaultFont.lfHeight : abs(TextObj->logfont.elfEnumLogfontEx.elfLogFont.lfHeight))); if (error) { DPRINT1("Error in setting pixel sizes: %u\n", error); @@ -3394,13 +3394,13 @@ GreExtTextOutW( previous = 0; - if (pdcattr->lTextAlign & TA_RIGHT) + if ((pdcattr->lTextAlign & TA_CENTER) == TA_CENTER) { - RealXStart -= TextWidth; + RealXStart -= TextWidth / 2; } else { - RealXStart -= TextWidth / 2; + RealXStart -= TextWidth; } } diff --git a/subsystems/win32/win32k/objects/gdidbg.c b/subsystems/win32/win32k/objects/gdidbg.c index ca48ec72f22..4d556614b56 100644 --- a/subsystems/win32/win32k/objects/gdidbg.c +++ b/subsystems/win32/win32k/objects/gdidbg.c @@ -15,9 +15,79 @@ extern ULONG gulFirstFree; extern ULONG gulFirstUnused; -ULONG gulDebugChannels = 0; ULONG gulLogUnique = 0; +/* note the following values need to be sorted */ +DBG_CHANNEL DbgChannels[DbgChCount]={ + {L"EngBlt", DbgChEngBlt}, + {L"EngBrush", DbgChEngBrush}, + {L"EngClip", DbgChEngClip}, + {L"EngCursor", DbgChEngCursor}, + {L"EngDev", DbgChEngDev}, + {L"EngErr", DbgChEngErr}, + {L"EngEvent", DbgChEngEvent}, + {L"EngGrad", DbgChEngGrad}, + {L"EngLDev", DbgChEngLDev}, + {L"EngLine", DbgChEngLine}, + {L"EngMapping", DbgChEngMapping}, + {L"EngPDev", DbgChEngPDev}, + {L"EngSurface", DbgChEngSurface}, + {L"EngWnd", DbgChEngWnd}, + {L"EngXlate", DbgChEngXlate}, + {L"GdiBitmap", DbgChGdiBitmap}, + {L"GdiBlt", DbgChGdiBlt}, + {L"GdiBrush", DbgChGdiBrush}, + {L"GdiClipRgn", DbgChGdiClipRgn}, + {L"GdiCoord", DbgChGdiCoord}, + {L"GdiDC", DbgChGdiDC}, + {L"GdiDCAttr", DbgChGdiDCAttr}, + {L"GdiDCState", DbgChGdiDCState}, + {L"GdiDev", DbgChGdiDev}, + {L"GdiDib", DbgChGdiDib}, + {L"GdiFont", DbgChGdiFont}, + {L"GdiLine", DbgChGdiLine}, + {L"GdiObj", DbgChGdiObj}, + {L"GdiPalette", DbgChGdiPalette}, + {L"GdiPath", DbgChGdiPath}, + {L"GdiPen", DbgChGdiPen}, + {L"GdiPool", DbgChGdiPool}, + {L"GdiRgn", DbgChGdiRgn}, + {L"GdiText", DbgChGdiText}, + {L"GdiXFormObj", DbgChGdiXFormObj}, + {L"UserAccel", DbgChUserAccel}, + {L"UserCalproc", DbgChUserCalproc}, + {L"UserCaret", DbgChUserCaret}, + {L"UserClass", DbgChUserClass}, + {L"UserClipbrd", DbgChUserClipbrd}, + {L"UserCsr", DbgChUserCsr}, + {L"UserDce", DbgChUserDce}, + {L"UserDesktop", DbgChUserDesktop}, + {L"UserEvent", DbgChUserEvent}, + {L"UserFocus", DbgChUserFocus}, + {L"UserHook", DbgChUserHook}, + {L"UserHotkey", DbgChUserHotkey}, + {L"UserIcon", DbgChUserIcon}, + {L"UserInput", DbgChUserInput}, + {L"UserKbd", DbgChUserKbd}, + {L"UserKbdLayout", DbgChUserKbdLayout}, + {L"UserMenu", DbgChUserMenu}, + {L"UserMetric", DbgChUserMetric}, + {L"UserMonitor", DbgChUserMonitor}, + {L"UserMsgGet", DbgChUserMsgGet}, + {L"UserMsgQ", DbgChUserMsgQ}, + {L"UserMsgSend", DbgChUserMsgSend}, + {L"UserObj", DbgChUserObj}, + {L"UserProcess", DbgChUserProcess}, + {L"UserProp", DbgChUserProp}, + {L"UserScrollbar", DbgChUserScrollbar}, + {L"UserSysparam", DbgChUserSysparam}, + {L"UserTimer", DbgChUserTimer}, + {L"UserThread", DbgChUserThread}, + {L"UserWinsta", DbgChUserWinsta}, + {L"UserWnd", DbgChUserWnd}, + {L"UserWndpos", DbgChUserWndpos} +}; + #ifdef GDI_DEBUG #if 0 static @@ -305,7 +375,7 @@ DbgDumpLockedGdiHandles() VOID NTAPI -DbgLogEvent(PSLIST_HEADER pslh, EVENT_TYPE nEventType, LPARAM lParam) +DbgLogEvent(PSLIST_HEADER pslh, LOG_EVENT_TYPE nEventType, LPARAM lParam) { PLOGENTRY pLogEntry; @@ -437,3 +507,223 @@ DbgPostServiceHook(ULONG ulSyscallId, ULONG_PTR ulResult) return ulResult; } +NTSTATUS NTAPI +QueryEnvironmentVariable(PUNICODE_STRING Name, + PUNICODE_STRING Value) +{ + NTSTATUS Status; + PWSTR wcs; + UNICODE_STRING var; + PWSTR val; + PPEB Peb; + PWSTR Environment; + + /* Ugly hack for reactos system threads */ + if(!NtCurrentTeb()) + { + return(STATUS_VARIABLE_NOT_FOUND); + } + + Peb = NtCurrentPeb(); + + if (Peb == NULL) + { + return(STATUS_VARIABLE_NOT_FOUND); + } + + Environment = Peb->ProcessParameters->Environment; + + if (Environment == NULL) + { + return(STATUS_VARIABLE_NOT_FOUND); + } + + Value->Length = 0; + + wcs = Environment; + while (*wcs) + { + var.Buffer = wcs++; + wcs = wcschr(wcs, L'='); + if (wcs == NULL) + { + wcs = var.Buffer + wcslen(var.Buffer); + } + if (*wcs) + { + var.Length = var.MaximumLength = (wcs - var.Buffer) * sizeof(WCHAR); + val = ++wcs; + wcs += wcslen(wcs); + + if (RtlEqualUnicodeString(&var, Name, TRUE)) + { + Value->Length = (wcs - val) * sizeof(WCHAR); + if (Value->Length <= Value->MaximumLength) + { + memcpy(Value->Buffer, val, + min(Value->Length + sizeof(WCHAR), Value->MaximumLength)); + Status = STATUS_SUCCESS; + } + else + { + Status = STATUS_BUFFER_TOO_SMALL; + } + + return(Status); + } + } + wcs++; + } + + return(STATUS_VARIABLE_NOT_FOUND); +} + +static int +DbgCompareChannels(const void * a, const void * b) +{ + return wcscmp((WCHAR*)a, ((DBG_CHANNEL*)b)->Name); +} + +static BOOL +DbgAddDebugChannel(PPROCESSINFO ppi, WCHAR* channel, WCHAR* level, WCHAR op) +{ + DBG_CHANNEL *ChannelEntry; + UINT iLevel, iChannel; + + DbgPrint("Found channel %S,level %S, operation %C\n", channel, level, op); + + ChannelEntry = (DBG_CHANNEL*)bsearch(channel, + DbgChannels, + DbgChCount, + sizeof(DBG_CHANNEL), + DbgCompareChannels); + if(ChannelEntry == NULL) + { + DbgPrint("Failed to find channel %S\n", channel); + return FALSE; + } + + iChannel = ChannelEntry->Id; + ASSERT(iChannel >= 0 && iChannel < DbgChCount); + + if(level == NULL || *level == L'\0' ||wcslen(level) == 0 ) + iLevel = MAX_LEVEL; + else if(wcsncmp(level, L"err", 3) == 0) + iLevel = ERR_LEVEL; + else if(wcsncmp(level, L"fixme", 5) == 0) + iLevel = FIXME_LEVEL; + else if(wcsncmp(level, L"warn", 4) == 0) + iLevel = WARN_LEVEL; + else if (wcsncmp(level, L"trace", 4) == 0) + iLevel = TRACE_LEVEL; + else + return FALSE; + + if(op==L'+') + { + DBG_ENABLE_CHANNEL(ppi, iChannel, iLevel); + } + else + { + DBG_DISABLE_CHANNEL(ppi, iChannel, iLevel); + } + + return TRUE; +} + +static BOOL +DbgParseDebugChannels(PPROCESSINFO ppi, PUNICODE_STRING Value) +{ + WCHAR *str, *separator, *c, op; + + str = Value->Buffer; + + do + { + separator = wcschr(str, L','); + if(separator != NULL) + *separator = L'\0'; + + c = wcschr(str, L'+'); + if(c == NULL) + c = wcschr(str, L'-'); + + if(c != NULL) + { + op = *c; + *c = L'\0'; + c++; + + DbgAddDebugChannel(ppi, c, str, op); + } + + str = separator + 1; + }while(separator != NULL); + + return TRUE; +} + +BOOL DbgInitDebugChannels() +{ + WCHAR valBuffer[100]; + UNICODE_STRING Value; + UNICODE_STRING Name = RTL_CONSTANT_STRING(L"DEBUGCHANNEL"); + NTSTATUS Status; + PPROCESSINFO ppi; + BOOL ret; + + /* Initialize all channels to ERROR */ + ppi = PsGetCurrentProcessWin32Process(); + RtlFillMemory( ppi->DbgChannelLevel, + sizeof(ppi->DbgChannelLevel), + ERR_LEVEL); + + /* Find DEBUGCHANNEL env var */ + Value.Buffer = valBuffer; + Value.Length = 0; + Value.MaximumLength = sizeof(valBuffer); + Status = QueryEnvironmentVariable(&Name, &Value); + + /* It does not exist */ + if(Status == STATUS_VARIABLE_NOT_FOUND) + { + /* There is nothing more to do */ + return TRUE; + } + + /* If the buffer in the stack is not enough allocate it */ + if(Status == STATUS_BUFFER_TOO_SMALL) + { + Value.Buffer = ExAllocatePool(PagedPool, Value.MaximumLength); + if(Value.Buffer == NULL) + { + return FALSE; + } + + /* Get the env var again */ + Status = QueryEnvironmentVariable(&Name, &Value); + } + + /* Check for error */ + if(!NT_SUCCESS(Status)) + { + if(Value.Buffer != valBuffer) + { + ExFreePool(Value.Buffer); + } + + return FALSE; + } + + /* Parse the variable */ + ret = DbgParseDebugChannels(ppi, &Value); + + /* Clean up*/ + if(Value.Buffer != valBuffer) + { + ExFreePool(Value.Buffer); + } + + return ret; +} + diff --git a/subsystems/win32/win32k/objects/gdipool.c b/subsystems/win32/win32k/objects/gdipool.c index c78c789e215..2c9862b365d 100644 --- a/subsystems/win32/win32k/objects/gdipool.c +++ b/subsystems/win32/win32k/objects/gdipool.c @@ -139,6 +139,13 @@ GdiPoolAllocate( /* Get a free section */ ple = pPool->leReadyList.Flink; pSection = CONTAINING_RECORD(ple, GDI_POOL_SECTION, leReadyLink); + if (pSection->cAllocCount >= pPool->cSlotsPerSection) + { + DPRINT1("pSection->cAllocCount=%ld, pPool->cSlotsPerSection=%ld\n", + pSection->cAllocCount, pPool->cSlotsPerSection); + DBG_DUMP_EVENT_LIST(&pPool->slhLog); + ASSERT(FALSE); + } ASSERT(pSection->cAllocCount < pPool->cSlotsPerSection); } else diff --git a/subsystems/win32/win32k/objects/text.c b/subsystems/win32/win32k/objects/text.c index 6c3fe7a6605..77521fc959c 100644 --- a/subsystems/win32/win32k/objects/text.c +++ b/subsystems/win32/win32k/objects/text.c @@ -15,7 +15,6 @@ /** Functions *****************************************************************/ -#if 0 /* flOpts : GetTextExtentPoint32W = 0 @@ -135,7 +134,6 @@ GreGetTextExtentExW( DC_UnlockDc(pdc); return Result; } -#endif DWORD APIENTRY diff --git a/subsystems/win32/win32k/pch.h b/subsystems/win32/win32k/pch.h index b703d6b868b..47fda2295d5 100644 --- a/subsystems/win32/win32k/pch.h +++ b/subsystems/win32/win32k/pch.h @@ -13,11 +13,20 @@ #define _NO_COM /* DDK/NDK/SDK Headers */ +#undef NTDDI_VERSION +#define NTDDI_VERSION NTDDI_WS03SP1 #include #include #include #include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include /* Win32 Headers */ diff --git a/subsystems/win32/win32k/w32ksvc.db b/subsystems/win32/win32k/w32ksvc.db index 0ff90f786d8..e797b044a97 100644 --- a/subsystems/win32/win32k/w32ksvc.db +++ b/subsystems/win32/win32k/w32ksvc.db @@ -675,7 +675,6 @@ NtGdiDrawStream 3 # # #ReactOS specific syscalls -NtGdiSetDIBits 7 NtGdiSetViewportOrgEx 4 NtGdiSetWindowOrgEx 4 NtGdiGetFontFamilyInfo 4 @@ -684,7 +683,6 @@ NtGdiOffsetWindowOrgEx 4 # NtUserBuildMenuItemList 4 NtUserGetMenuDefaultItem 3 -NtUserGetLastInputInfo 1 NtUserGetMinMaxInfo 3 NtUserGetMonitorInfo 2 NtUserMenuInfo 3 diff --git a/subsystems/win32/win32k/w32ksvc.h b/subsystems/win32/win32k/w32ksvc.h index 27b727cb5d9..1bd678d0570 100644 --- a/subsystems/win32/win32k/w32ksvc.h +++ b/subsystems/win32/win32k/w32ksvc.h @@ -675,7 +675,6 @@ SVC_(GdiDrawStream, 3) // ReactOS, specific, syscalls) -SVC_(GdiSetDIBits, 7) SVC_(GdiSetViewportOrgEx, 4) SVC_(GdiSetWindowOrgEx, 4) SVC_(GdiGetFontFamilyInfo, 4) @@ -684,7 +683,6 @@ SVC_(GdiOffsetWindowOrgEx, 4) SVC_(UserBuildMenuItemList, 4) SVC_(UserGetMenuDefaultItem, 3) -SVC_(UserGetLastInputInfo, 1) SVC_(UserGetMinMaxInfo, 3) SVC_(UserGetMonitorInfo, 2) SVC_(UserMenuInfo, 3) diff --git a/toolchain-mingw32.cmake b/toolchain-gcc.cmake similarity index 61% rename from toolchain-mingw32.cmake rename to toolchain-gcc.cmake index e50a63d0424..d760592e1ab 100644 --- a/toolchain-mingw32.cmake +++ b/toolchain-gcc.cmake @@ -24,26 +24,27 @@ else() set(CCACHE "" CACHE STRING "ccache") endif() -# the name of the target operating system +# The name of the target operating system set(CMAKE_SYSTEM_NAME Windows) set(CMAKE_SYSTEM_PROCESSOR i686) -# which compilers to use for C and C++ +# Which compilers to use for C and C++ set(CMAKE_C_COMPILER ${CCACHE} ${MINGW_PREFIX}gcc) set(CMAKE_CXX_COMPILER ${CCACHE} ${MINGW_PREFIX}g++) set(CMAKE_RC_COMPILER ${MINGW_PREFIX}windres) set(CMAKE_ASM_COMPILER ${MINGW_PREFIX}gcc) -set(CMAKE_ASM_COMPILE_OBJECT " -x assembler-with-cpp -o -I${REACTOS_SOURCE_DIR}/include/asm -I${REACTOS_BINARY_DIR}/include/asm -D__ASM__ -c ") -# Use stdcall fixups, and don't link with anything by default unless we say so +if(NOT CMAKE_HOST_SYSTEM_NAME MATCHES Windows) + set(CMAKE_AR ${MINGW_PREFIX}ar) + set(CMAKE_C_CREATE_STATIC_LIBRARY "${CMAKE_AR} crs ") + set(CMAKE_CXX_CREATE_STATIC_LIBRARY ${CMAKE_C_CREATE_STATIC_LIBRARY}) + set(CMAKE_ASM_CREATE_STATIC_LIBRARY ${CMAKE_C_CREATE_STATIC_LIBRARY}) +endif() + +# 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 "" CACHE STRING "Standard C++ Libraries") -if(ARCH MATCHES i386) - set(CMAKE_SHARED_LINKER_FLAGS_INIT "-nodefaultlibs -nostdlib -Wl,--enable-auto-image-base -Wl,--disable-auto-import") -#-Wl,-T,${REACTOS_SOURCE_DIR}/global.lds -elseif(ARCH MATCHES amd64) - set(CMAKE_SHARED_LINKER_FLAGS_INIT "-nodefaultlibs -nostdlib -Wl,--enable-auto-image-base -Wl,--disable-auto-import") -endif() +set(CMAKE_SHARED_LINKER_FLAGS_INIT "-nodefaultlibs -nostdlib -Wl,--enable-auto-image-base -Wl,--disable-auto-import") diff --git a/toolchain-msvc.cmake b/toolchain-msvc.cmake index e2db500e731..d46476affd8 100644 --- a/toolchain-msvc.cmake +++ b/toolchain-msvc.cmake @@ -13,12 +13,6 @@ else() set(CMAKE_ASM_COMPILER ml) endif() -set(CMAKE_RC_COMPILE_OBJECT " /I${REACTOS_SOURCE_DIR}/include/psdk /I${REACTOS_BINARY_DIR}/include/psdk /I${REACTOS_SOURCE_DIR}/include /I${REACTOS_SOURCE_DIR}/include/reactos /I${REACTOS_BINARY_DIR}/include/reactos /I${REACTOS_SOURCE_DIR}/include/reactos/wine /I${REACTOS_SOURCE_DIR}/include/crt /I${REACTOS_SOURCE_DIR}/include/crt/mingw32 /fo ") - -set(CMAKE_ASM_COMPILE_OBJECT - " /nologo /X /I${REACTOS_SOURCE_DIR}/include/asm /I${REACTOS_BINARY_DIR}/include/asm /D__ASM__ /D_USE_ML /EP /c > .tmp" - " /nologo /Cp /Fo /c /Ta .tmp") - set(CMAKE_C_STANDARD_LIBRARIES "" CACHE INTERNAL "") if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86")